From: support Date: Tue, 28 Mar 2023 13:29:59 +0000 (+0000) Subject: Built motion from commit b0a9a629.|2.6.33 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22my-avatar.png/%22?a=commitdiff_plain;h=72814dbb99dc836e6a11f525907d63de1e5bc00c;p=motion2.git Built motion from commit b0a9a629.|2.6.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 0bc805a..c51dbca 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-28T12:37:06.275Z", + "time": "2023-03-28T13:14:05.745Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 32cd1af..f13eb83 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-28T12:37:06.275Z", + "time": "2023-03-28T13:14:05.745Z", "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 040ae72..343a4d7 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 _0x575d=['contactManager','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','STRING'];(function(_0x330061,_0x12ccdc){var _0x4f1366=function(_0x4b468d){while(--_0x4b468d){_0x330061['push'](_0x330061['shift']());}};_0x4f1366(++_0x12ccdc);}(_0x575d,0x1de));var _0xd575=function(_0xe12d49,_0x22264b){_0xe12d49=_0xe12d49-0x0;var _0x3050fd=_0x575d[_0xe12d49];return _0x3050fd;};'use strict';var Sequelize=require(_0xd575('0x0'));module[_0xd575('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5b1c82){return this[_0xd575('0x2')](_0xd575('0x3'));}},'action':{'type':Sequelize[_0xd575('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xd575('0x5'),_0xd575('0x6'),_0xd575('0x7'),'jscripty',_0xd575('0x8'),_0xd575('0x9'),_0xd575('0xa'),_0xd575('0xb')]],'msg':_0xd575('0xc')}},'comment':_0xd575('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xd575('0xd')},'data2':{'type':Sequelize[_0xd575('0x4')](0x1000),'comment':_0xd575('0xe')},'data3':{'type':Sequelize[_0xd575('0x4')](0x1000),'comment':_0xd575('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xd575('0x10')},'data5':{'type':Sequelize[_0xd575('0x4')](0x1000),'comments':_0xd575('0x11')},'data6':{'type':Sequelize[_0xd575('0x4')],'comments':_0xd575('0x12')},'data7':{'type':Sequelize[_0xd575('0x13')],'comments':_0xd575('0x14')}}; \ No newline at end of file +var _0x884a=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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)]'];(function(_0x1d4e6e,_0x19f830){var _0x4a135e=function(_0xac770b){while(--_0xac770b){_0x1d4e6e['push'](_0x1d4e6e['shift']());}};_0x4a135e(++_0x19f830);}(_0x884a,0x1f2));var _0xa884=function(_0xb5a4a0,_0x3f8ffa){_0xb5a4a0=_0xb5a4a0-0x0;var _0x1b9ea6=_0x884a[_0xb5a4a0];return _0x1b9ea6;};'use strict';var Sequelize=require(_0xa884('0x0'));module[_0xa884('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1d5caa){return this['getDataValue'](_0xa884('0x2'));}},'action':{'type':Sequelize[_0xa884('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xa884('0x4'),_0xa884('0x5'),_0xa884('0x6'),_0xa884('0x7'),_0xa884('0x8'),_0xa884('0x9'),_0xa884('0xa'),_0xa884('0xb')]],'msg':_0xa884('0xc')}},'comment':_0xa884('0xc')},'data1':{'type':Sequelize[_0xa884('0x3')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xa884('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xa884('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xa884('0xf')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xa884('0x10')},'data6':{'type':Sequelize[_0xa884('0x3')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xa884('0x11')],'comments':_0xa884('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 2eb7202..c5d3bbb 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 _0xc1d8=['then','end','error','stack','name','send','body','find','params','Action','catch','zip-dir','fast-json-patch','moment','bluebird','sox','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update'];(function(_0x5b166e,_0xb1c1cd){var _0x2805b1=function(_0x34f8d8){while(--_0x34f8d8){_0x5b166e['push'](_0x5b166e['shift']());}};_0x2805b1(++_0xb1c1cd);}(_0xc1d8,0x123));var _0x8c1d=function(_0x1c4c47,_0x3d92c3){_0x1c4c47=_0x1c4c47-0x0;var _0x37ff58=_0xc1d8[_0x1c4c47];return _0x37ff58;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8c1d('0x0'));var jsonpatch=require(_0x8c1d('0x1'));var rp=require('request-promise');var moment=require(_0x8c1d('0x2'));var BPromise=require(_0x8c1d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8c1d('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c1d('0x5'));var _=require(_0x8c1d('0x6'));var squel=require('squel');var crypto=require(_0x8c1d('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x8c1d('0x8'));var toCsv=require('to-csv');var querystring=require(_0x8c1d('0x9'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8c1d('0xa'));var qs=require(_0x8c1d('0xb'));var as=require(_0x8c1d('0xc'));var hardwareService=require(_0x8c1d('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x8c1d('0xe'));var config=require(_0x8c1d('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c1d('0x10'))['db'];function respondWithStatusCode(_0x2bab51,_0x58bb21){_0x58bb21=_0x58bb21||0xcc;return function(_0x990339){if(_0x990339){return _0x2bab51[_0x8c1d('0x11')](_0x58bb21);}return _0x2bab51[_0x8c1d('0x12')](_0x58bb21)['end']();};}function respondWithResult(_0x413162,_0x2809b1){_0x2809b1=_0x2809b1||0xc8;return function(_0x3bdd9d){if(_0x3bdd9d){return _0x413162[_0x8c1d('0x12')](_0x2809b1)[_0x8c1d('0x13')](_0x3bdd9d);}};}function respondWithFilteredResult(_0x148bd9,_0xdb9820){return function(_0x189fed){if(_0x189fed){var _0x3fb293=typeof _0xdb9820[_0x8c1d('0x14')]===_0x8c1d('0x15')&&typeof _0xdb9820[_0x8c1d('0x16')]==='undefined';var _0x538ec2=_0x189fed[_0x8c1d('0x17')];var _0x249c17=_0x3fb293?0x0:_0xdb9820[_0x8c1d('0x14')];var _0x19610b=_0x3fb293?_0x189fed[_0x8c1d('0x17')]:_0xdb9820[_0x8c1d('0x14')]+_0xdb9820['limit'];var _0x430bf5;if(_0x19610b>=_0x538ec2){_0x19610b=_0x538ec2;_0x430bf5=0xc8;}else{_0x430bf5=0xce;}_0x148bd9[_0x8c1d('0x12')](_0x430bf5);return _0x148bd9[_0x8c1d('0x18')](_0x8c1d('0x19'),_0x249c17+'-'+_0x19610b+'/'+_0x538ec2)['json'](_0x189fed);}return null;};}function patchUpdates(_0x4b1336){return function(_0x348ff9){try{jsonpatch['apply'](_0x348ff9,_0x4b1336,!![]);}catch(_0x52714a){return BPromise[_0x8c1d('0x1a')](_0x52714a);}return _0x348ff9[_0x8c1d('0x1b')]();};}function saveUpdates(_0x3f3bb0,_0x5ad75e){return function(_0x1d644c){if(_0x1d644c){return _0x1d644c[_0x8c1d('0x1c')](_0x3f3bb0)[_0x8c1d('0x1d')](function(_0x524210){return _0x524210;});}return null;};}function removeEntity(_0x315be4,_0x457e93){return function(_0x123ceb){if(_0x123ceb){return _0x123ceb['destroy']()[_0x8c1d('0x1d')](function(){_0x315be4['status'](0xcc)[_0x8c1d('0x1e')]();});}};}function handleEntityNotFound(_0x4a2f32,_0x46077b){return function(_0x133905){if(!_0x133905){_0x4a2f32['sendStatus'](0x194);}return _0x133905;};}function handleError(_0x609e9c,_0x2d09ba){_0x2d09ba=_0x2d09ba||0x1f4;return function(_0xe4b5fd){logger[_0x8c1d('0x1f')](_0xe4b5fd[_0x8c1d('0x20')]);if(_0xe4b5fd['name']){delete _0xe4b5fd[_0x8c1d('0x21')];}_0x609e9c[_0x8c1d('0x12')](_0x2d09ba)[_0x8c1d('0x22')](_0xe4b5fd);};}exports['update']=function(_0x2b192c,_0x50a9f8){if(_0x2b192c[_0x8c1d('0x23')]['id']){delete _0x2b192c[_0x8c1d('0x23')]['id'];}return db['Action'][_0x8c1d('0x24')]({'where':{'id':_0x2b192c[_0x8c1d('0x25')]['id']}})[_0x8c1d('0x1d')](handleEntityNotFound(_0x50a9f8,null))[_0x8c1d('0x1d')](saveUpdates(_0x2b192c[_0x8c1d('0x23')],null))[_0x8c1d('0x1d')](respondWithResult(_0x50a9f8,null))['catch'](handleError(_0x50a9f8,null));};exports['destroy']=function(_0x1d2253,_0x503463){return db[_0x8c1d('0x26')][_0x8c1d('0x24')]({'where':{'id':_0x1d2253[_0x8c1d('0x25')]['id']}})[_0x8c1d('0x1d')](handleEntityNotFound(_0x503463,null))[_0x8c1d('0x1d')](removeEntity(_0x503463,null))[_0x8c1d('0x27')](handleError(_0x503463,null));}; \ No newline at end of file +var _0xad07=['status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','name','send','update','body','Action','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xad07,0x6a));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7ad0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7ad0('0x1'));var jsonpatch=require(_0x7ad0('0x2'));var rp=require(_0x7ad0('0x3'));var moment=require(_0x7ad0('0x4'));var BPromise=require(_0x7ad0('0x5'));var Mustache=require(_0x7ad0('0x6'));var util=require(_0x7ad0('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7ad0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ad0('0x9'));var deskjs=require(_0x7ad0('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7ad0('0xb'));var Papa=require(_0x7ad0('0xc'));var Redis=require(_0x7ad0('0xd'));var authService=require(_0x7ad0('0xe'));var qs=require(_0x7ad0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ad0('0x10'));var logger=require(_0x7ad0('0x11'))(_0x7ad0('0x12'));var utils=require(_0x7ad0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7ad0('0x14'));var db=require(_0x7ad0('0x15'))['db'];function respondWithStatusCode(_0x2e0747,_0x1bfc51){_0x1bfc51=_0x1bfc51||0xcc;return function(_0x150d34){if(_0x150d34){return _0x2e0747[_0x7ad0('0x16')](_0x1bfc51);}return _0x2e0747[_0x7ad0('0x17')](_0x1bfc51)['end']();};}function respondWithResult(_0x1c9537,_0x3cd9b7){_0x3cd9b7=_0x3cd9b7||0xc8;return function(_0x1bfe8f){if(_0x1bfe8f){return _0x1c9537[_0x7ad0('0x17')](_0x3cd9b7)[_0x7ad0('0x18')](_0x1bfe8f);}};}function respondWithFilteredResult(_0x54a916,_0x2b20c5){return function(_0x4316b1){if(_0x4316b1){var _0xece8e1=typeof _0x2b20c5[_0x7ad0('0x19')]==='undefined'&&typeof _0x2b20c5[_0x7ad0('0x1a')]===_0x7ad0('0x1b');var _0xeaab2f=_0x4316b1[_0x7ad0('0x1c')];var _0x1c410a=_0xece8e1?0x0:_0x2b20c5[_0x7ad0('0x19')];var _0x54624b=_0xece8e1?_0x4316b1[_0x7ad0('0x1c')]:_0x2b20c5[_0x7ad0('0x19')]+_0x2b20c5[_0x7ad0('0x1a')];var _0x504797;if(_0x54624b>=_0xeaab2f){_0x54624b=_0xeaab2f;_0x504797=0xc8;}else{_0x504797=0xce;}_0x54a916[_0x7ad0('0x17')](_0x504797);return _0x54a916[_0x7ad0('0x1d')](_0x7ad0('0x1e'),_0x1c410a+'-'+_0x54624b+'/'+_0xeaab2f)[_0x7ad0('0x18')](_0x4316b1);}return null;};}function patchUpdates(_0x10abbd){return function(_0x26e8d5){try{jsonpatch[_0x7ad0('0x1f')](_0x26e8d5,_0x10abbd,!![]);}catch(_0x56121b){return BPromise['reject'](_0x56121b);}return _0x26e8d5[_0x7ad0('0x20')]();};}function saveUpdates(_0x82c437,_0xe3bc25){return function(_0x401f2b){if(_0x401f2b){return _0x401f2b['update'](_0x82c437)[_0x7ad0('0x21')](function(_0x2a9cd0){return _0x2a9cd0;});}return null;};}function removeEntity(_0x3d3b76,_0x2d8018){return function(_0x399f8f){if(_0x399f8f){return _0x399f8f[_0x7ad0('0x22')]()[_0x7ad0('0x21')](function(){_0x3d3b76[_0x7ad0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aeb81,_0x1e40bd){return function(_0x576f49){if(!_0x576f49){_0x5aeb81[_0x7ad0('0x16')](0x194);}return _0x576f49;};}function handleError(_0x2771a7,_0x1f4b3b){_0x1f4b3b=_0x1f4b3b||0x1f4;return function(_0x15be61){logger[_0x7ad0('0x23')](_0x15be61['stack']);if(_0x15be61[_0x7ad0('0x24')]){delete _0x15be61[_0x7ad0('0x24')];}_0x2771a7['status'](_0x1f4b3b)[_0x7ad0('0x25')](_0x15be61);};}exports[_0x7ad0('0x26')]=function(_0x2cddef,_0x431ce8){if(_0x2cddef['body']['id']){delete _0x2cddef[_0x7ad0('0x27')]['id'];}return db[_0x7ad0('0x28')]['find']({'where':{'id':_0x2cddef[_0x7ad0('0x29')]['id']}})[_0x7ad0('0x21')](handleEntityNotFound(_0x431ce8,null))[_0x7ad0('0x21')](saveUpdates(_0x2cddef[_0x7ad0('0x27')],null))[_0x7ad0('0x21')](respondWithResult(_0x431ce8,null))[_0x7ad0('0x2a')](handleError(_0x431ce8,null));};exports[_0x7ad0('0x22')]=function(_0x1faf79,_0x274127){return db['Action']['find']({'where':{'id':_0x1faf79[_0x7ad0('0x29')]['id']}})[_0x7ad0('0x21')](handleEntityNotFound(_0x274127,null))[_0x7ad0('0x21')](removeEntity(_0x274127,null))[_0x7ad0('0x2a')](handleError(_0x274127,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 48924f3..b585d6d 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 _0x25fd=['request-promise','rimraf','../../config/environment','exports','define','../../config/logger','api','bluebird'];(function(_0x444154,_0x371c6b){var _0x56cfc6=function(_0x1685a8){while(--_0x1685a8){_0x444154['push'](_0x444154['shift']());}};_0x56cfc6(++_0x371c6b);}(_0x25fd,0x16d));var _0xd25f=function(_0x464b23,_0x2b4fac){_0x464b23=_0x464b23-0x0;var _0x4db267=_0x25fd[_0x464b23];return _0x4db267;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd25f('0x0'))(_0xd25f('0x1'));var moment=require('moment');var BPromise=require(_0xd25f('0x2'));var rp=require(_0xd25f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd25f('0x4'));var config=require(_0xd25f('0x5'));var attributes=require('./action.attributes');module[_0xd25f('0x6')]=function(_0x4ad800,_0x2752d7){return _0x4ad800[_0xd25f('0x7')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7400=['./action.attributes','Action','tools_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f087e,_0x24ae0c){var _0x2146c5=function(_0x4b755f){while(--_0x4b755f){_0x2f087e['push'](_0x2f087e['shift']());}};_0x2146c5(++_0x24ae0c);}(_0x7400,0x1d7));var _0x0740=function(_0x290c31,_0x534b8a){_0x290c31=_0x290c31-0x0;var _0x2eb0ac=_0x7400[_0x290c31];return _0x2eb0ac;};'use strict';var _=require('lodash');var util=require(_0x0740('0x0'));var logger=require(_0x0740('0x1'))(_0x0740('0x2'));var moment=require(_0x0740('0x3'));var BPromise=require(_0x0740('0x4'));var rp=require(_0x0740('0x5'));var fs=require('fs');var path=require(_0x0740('0x6'));var rimraf=require(_0x0740('0x7'));var config=require(_0x0740('0x8'));var attributes=require(_0x0740('0x9'));module['exports']=function(_0x430d15,_0x25cdee){return _0x430d15['define'](_0x0740('0xa'),attributes,{'tableName':_0x0740('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index eed0485..d00cf27 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0xf494,0x1c6));var _0x4f49=function(_0x3f7650,_0x50cd0a){_0x3f7650=_0x3f7650-0x0;var _0x308e4f=_0xf494[_0x3f7650];return _0x308e4f;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x52193e,_0x5191eb){var _0x2ff254=function(_0x410484){while(--_0x410484){_0x52193e['push'](_0x52193e['shift']());}};_0x2ff254(++_0x5191eb);}(_0x5fab,0x177));var _0xb5fa=function(_0x15b932,_0x39ba3f){_0x15b932=_0x15b932-0x0;var _0x28fa64=_0x5fab[_0x15b932];return _0x28fa64;};'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']('Action,\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')]('Action,\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']('Action,\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/action/index.js b/server/api/action/index.js index bae94f3..6c194ae 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 _0xf6e9=['delete','destroy','exports','util','path','Router','../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x2238b9,_0x1c9a06){var _0xe294d5=function(_0x2b8f84){while(--_0x2b8f84){_0x2238b9['push'](_0x2238b9['shift']());}};_0xe294d5(++_0x1c9a06);}(_0xf6e9,0xe0));var _0x9f6e=function(_0xd83f3e,_0x3c909e){_0xd83f3e=_0xd83f3e-0x0;var _0x3afffc=_0xf6e9[_0xd83f3e];return _0x3afffc;};'use strict';var multer=require('multer');var util=require(_0x9f6e('0x0'));var path=require(_0x9f6e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9f6e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9f6e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9f6e('0x4'));var controller=require(_0x9f6e('0x5'));router[_0x9f6e('0x6')](_0x9f6e('0x7'),auth[_0x9f6e('0x8')](),controller[_0x9f6e('0x9')]);router[_0x9f6e('0xa')](_0x9f6e('0x7'),auth[_0x9f6e('0x8')](),controller[_0x9f6e('0xb')]);module[_0x9f6e('0xc')]=router; \ No newline at end of file +var _0xd495=['isAuthenticated','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x2e018c,_0x54ed5e){var _0x471254=function(_0x2040bf){while(--_0x2040bf){_0x2e018c['push'](_0x2e018c['shift']());}};_0x471254(++_0x54ed5e);}(_0xd495,0x189));var _0x5d49=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xd495[_0x489b87];return _0x1823b6;};'use strict';var multer=require(_0x5d49('0x0'));var util=require(_0x5d49('0x1'));var path=require(_0x5d49('0x2'));var timeout=require(_0x5d49('0x3'));var express=require(_0x5d49('0x4'));var router=express['Router']();var fs_extra=require(_0x5d49('0x5'));var auth=require(_0x5d49('0x6'));var interaction=require(_0x5d49('0x7'));var config=require(_0x5d49('0x8'));var controller=require(_0x5d49('0x9'));router[_0x5d49('0xa')](_0x5d49('0xb'),auth[_0x5d49('0xc')](),controller[_0x5d49('0xd')]);router['delete'](_0x5d49('0xb'),auth[_0x5d49('0xc')](),controller['destroy']);module[_0x5d49('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index f255142..d704a3e 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 _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xdc97,0x13b));var _0x7dc9=function(_0x255aa7,_0x774e3e){_0x255aa7=_0x255aa7-0x0;var _0x327639=_0xdc97[_0x255aa7];return _0x327639;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file +var _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x1c31ec,_0x240f49){var _0x30d29d=function(_0x14b732){while(--_0x14b732){_0x1c31ec['push'](_0x1c31ec['shift']());}};_0x30d29d(++_0x240f49);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1cc3ce,_0x43791e){_0x1cc3ce=_0x1cc3ce-0x0;var _0x4ac6ac=_0x3f8a[_0x1cc3ce];return _0x4ac6ac;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f173c61..82aa3a1 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 _0xf2c2=['status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','length','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','ROUND(%s)','IS\x20NOT\x20EMPTY','operator','keyBy','from','function','web','randomstring','generate','output','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','savename','countTable','COUNT(*)','run','runReport','SUM(%s)','alias','debug','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf2c2,0x132));var _0x2f2c=function(_0x3c18bd,_0x5eda61){_0x3c18bd=_0x3c18bd-0x0;var _0x29ae98=_0xf2c2[_0x3c18bd];return _0x29ae98;};'use strict';var emlformat=require(_0x2f2c('0x0'));var rimraf=require(_0x2f2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2f2c('0x2'));var moment=require(_0x2f2c('0x3'));var BPromise=require(_0x2f2c('0x4'));var Mustache=require(_0x2f2c('0x5'));var util=require(_0x2f2c('0x6'));var path=require(_0x2f2c('0x7'));var sox=require('sox');var csv=require(_0x2f2c('0x8'));var ejs=require(_0x2f2c('0x9'));var fs=require('fs');var fs_extra=require(_0x2f2c('0xa'));var _=require('lodash');var squel=require(_0x2f2c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2f2c('0xc'));var toCsv=require(_0x2f2c('0x8'));var querystring=require(_0x2f2c('0xd'));var Papa=require('papaparse');var Redis=require(_0x2f2c('0xe'));var authService=require(_0x2f2c('0xf'));var qs=require(_0x2f2c('0x10'));var as=require(_0x2f2c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2f2c('0x12'));var utils=require(_0x2f2c('0x13'));var config=require(_0x2f2c('0x14'));var licenseUtil=require(_0x2f2c('0x15'));var db=require(_0x2f2c('0x16'))['db'];var dbH=require(_0x2f2c('0x16'))['dbH'];function respondWithStatusCode(_0x52b387,_0x3ad41e){_0x3ad41e=_0x3ad41e||0xcc;return function(_0x526c7f){if(_0x526c7f){return _0x52b387[_0x2f2c('0x17')](_0x3ad41e);}return _0x52b387[_0x2f2c('0x18')](_0x3ad41e)[_0x2f2c('0x19')]();};}function respondWithResult(_0x154d23,_0x3ba97b){_0x3ba97b=_0x3ba97b||0xc8;return function(_0x9f7f9d){if(_0x9f7f9d){return _0x154d23[_0x2f2c('0x18')](_0x3ba97b)['json'](_0x9f7f9d);}};}function respondWithFilteredResult(_0x263c15,_0x24b260){return function(_0x37a6b2){if(_0x37a6b2){var _0x3af135=typeof _0x24b260[_0x2f2c('0x1a')]===_0x2f2c('0x1b')&&typeof _0x24b260[_0x2f2c('0x1c')]===_0x2f2c('0x1b');var _0x4e1350=_0x37a6b2['count'];var _0x235cbf=_0x3af135?0x0:_0x24b260[_0x2f2c('0x1a')];var _0x3f5adc=_0x3af135?_0x37a6b2[_0x2f2c('0x1d')]:_0x24b260[_0x2f2c('0x1a')]+_0x24b260[_0x2f2c('0x1c')];var _0x4fa73c;if(_0x3f5adc>=_0x4e1350){_0x3f5adc=_0x4e1350;_0x4fa73c=0xc8;}else{_0x4fa73c=0xce;}_0x263c15[_0x2f2c('0x18')](_0x4fa73c);return _0x263c15[_0x2f2c('0x1e')](_0x2f2c('0x1f'),_0x235cbf+'-'+_0x3f5adc+'/'+_0x4e1350)[_0x2f2c('0x20')](_0x37a6b2);}return null;};}function patchUpdates(_0x5f55c8){return function(_0x42c406){try{jsonpatch['apply'](_0x42c406,_0x5f55c8,!![]);}catch(_0x2e00c2){return BPromise[_0x2f2c('0x21')](_0x2e00c2);}return _0x42c406[_0x2f2c('0x22')]();};}function saveUpdates(_0x4ce150,_0x4d8156){return function(_0x3a2762){if(_0x3a2762){return _0x3a2762[_0x2f2c('0x23')](_0x4ce150)[_0x2f2c('0x24')](function(_0x38d161){return _0x38d161;});}return null;};}function removeEntity(_0x39730a,_0x74d3ef){return function(_0x584d48){if(_0x584d48){return _0x584d48[_0x2f2c('0x25')]()[_0x2f2c('0x24')](function(){var _0x1b6d02=_0x584d48['get']({'plain':!![]});var _0x13a619=_0x2f2c('0x26');return db['UserProfileResource'][_0x2f2c('0x25')]({'where':{'type':_0x13a619,'resourceId':_0x1b6d02['id']}})[_0x2f2c('0x24')](function(){return _0x584d48;});})[_0x2f2c('0x24')](function(){_0x39730a[_0x2f2c('0x18')](0xcc)[_0x2f2c('0x19')]();});}};}function handleEntityNotFound(_0xe58b8e,_0x531511){return function(_0x78e5e4){if(!_0x78e5e4){_0xe58b8e[_0x2f2c('0x17')](0x194);}return _0x78e5e4;};}function handleError(_0x16ee0a,_0x38e921){_0x38e921=_0x38e921||0x1f4;return function(_0x1015e8){logger[_0x2f2c('0x27')](_0x1015e8[_0x2f2c('0x28')]);if(_0x1015e8[_0x2f2c('0x29')]){delete _0x1015e8[_0x2f2c('0x29')];}_0x16ee0a[_0x2f2c('0x18')](_0x38e921)[_0x2f2c('0x2a')](_0x1015e8);};}exports[_0x2f2c('0x2b')]=function(_0x34daa9,_0xcf7b13){var _0x2fb406={},_0x53bf65={},_0x471874={'count':0x0,'rows':[]};var _0x373bb5=_[_0x2f2c('0x2c')](db[_0x2f2c('0x2d')][_0x2f2c('0x2e')],function(_0x3bcb5f){return{'name':_0x3bcb5f[_0x2f2c('0x2f')],'type':_0x3bcb5f[_0x2f2c('0x30')][_0x2f2c('0x31')]};});_0x53bf65['model']=_[_0x2f2c('0x2c')](_0x373bb5,_0x2f2c('0x29'));_0x53bf65['query']=_['keys'](_0x34daa9[_0x2f2c('0x32')]);_0x53bf65[_0x2f2c('0x33')]=_[_0x2f2c('0x34')](_0x53bf65['model'],_0x53bf65['query']);_0x2fb406[_0x2f2c('0x35')]=_[_0x2f2c('0x34')](_0x53bf65[_0x2f2c('0x36')],qs[_0x2f2c('0x37')](_0x34daa9[_0x2f2c('0x32')][_0x2f2c('0x37')]));_0x2fb406[_0x2f2c('0x35')]=_0x2fb406[_0x2f2c('0x35')]['length']?_0x2fb406[_0x2f2c('0x35')]:_0x53bf65[_0x2f2c('0x36')];if(!_0x34daa9[_0x2f2c('0x32')][_0x2f2c('0x38')]('nolimit')){_0x2fb406['limit']=qs[_0x2f2c('0x1c')](_0x34daa9[_0x2f2c('0x32')][_0x2f2c('0x1c')]);_0x2fb406[_0x2f2c('0x1a')]=qs[_0x2f2c('0x1a')](_0x34daa9[_0x2f2c('0x32')][_0x2f2c('0x1a')]);}_0x2fb406[_0x2f2c('0x39')]=qs[_0x2f2c('0x3a')](_0x34daa9['query']['sort']);_0x2fb406[_0x2f2c('0x3b')]=qs['filters'](_[_0x2f2c('0x3c')](_0x34daa9[_0x2f2c('0x32')],_0x53bf65[_0x2f2c('0x33')]),_0x373bb5);if(_0x34daa9[_0x2f2c('0x32')][_0x2f2c('0x3d')]){_0x2fb406[_0x2f2c('0x3b')]=_['merge'](_0x2fb406['where'],{'$or':_[_0x2f2c('0x2c')](_0x373bb5,function(_0x2945de){if(_0x2945de['type']!==_0x2f2c('0x3e')){var _0x11e0e6={};_0x11e0e6[_0x2945de['name']]={'$like':'%'+_0x34daa9[_0x2f2c('0x32')][_0x2f2c('0x3d')]+'%'};return _0x11e0e6;}})});}_0x2fb406=_[_0x2f2c('0x3f')]({},_0x2fb406,_0x34daa9[_0x2f2c('0x40')]);var _0xaafc82={'where':_0x2fb406['where']};return db[_0x2f2c('0x2d')][_0x2f2c('0x1d')](_0xaafc82)[_0x2f2c('0x24')](function(_0x2000d9){_0x471874[_0x2f2c('0x1d')]=_0x2000d9;if(_0x34daa9[_0x2f2c('0x32')][_0x2f2c('0x41')]){_0x2fb406[_0x2f2c('0x42')]=[{'all':!![]}];}return db[_0x2f2c('0x2d')][_0x2f2c('0x43')](_0x2fb406);})['then'](function(_0x5d9a0c){_0x471874[_0x2f2c('0x44')]=_0x5d9a0c;return _0x471874;})[_0x2f2c('0x24')](respondWithFilteredResult(_0xcf7b13,_0x2fb406))[_0x2f2c('0x45')](handleError(_0xcf7b13,null));};exports[_0x2f2c('0x46')]=function(_0x3aa4b0,_0x5da674){var _0x1835c4={'raw':![],'where':{'id':_0x3aa4b0[_0x2f2c('0x47')]['id']}},_0x4a05ef={};_0x4a05ef['model']=_[_0x2f2c('0x48')](db[_0x2f2c('0x2d')]['rawAttributes']);_0x4a05ef['query']=_['keys'](_0x3aa4b0[_0x2f2c('0x32')]);_0x4a05ef[_0x2f2c('0x33')]=_[_0x2f2c('0x34')](_0x4a05ef[_0x2f2c('0x36')],_0x4a05ef[_0x2f2c('0x32')]);_0x1835c4['attributes']=_[_0x2f2c('0x34')](_0x4a05ef[_0x2f2c('0x36')],qs['fields'](_0x3aa4b0[_0x2f2c('0x32')][_0x2f2c('0x37')]));_0x1835c4[_0x2f2c('0x35')]=_0x1835c4[_0x2f2c('0x35')]['length']?_0x1835c4[_0x2f2c('0x35')]:_0x4a05ef[_0x2f2c('0x36')];if(_0x3aa4b0['query']['includeAll']){_0x1835c4[_0x2f2c('0x42')]=[{'all':!![]}];}_0x1835c4=_[_0x2f2c('0x3f')]({},_0x1835c4,_0x3aa4b0[_0x2f2c('0x40')]);return db[_0x2f2c('0x2d')][_0x2f2c('0x49')](_0x1835c4)['then'](handleEntityNotFound(_0x5da674,null))[_0x2f2c('0x24')](respondWithResult(_0x5da674,null))[_0x2f2c('0x45')](handleError(_0x5da674,null));};exports[_0x2f2c('0x4a')]=function(_0x30d888,_0x132c02){return db[_0x2f2c('0x2d')]['create'](_0x30d888['body'],{})['then'](function(_0x30f6df){var _0x4e723c=_0x30d888[_0x2f2c('0x4b')][_0x2f2c('0x4c')]({'plain':!![]});if(!_0x4e723c)throw new Error(_0x2f2c('0x4d'));if(_0x4e723c[_0x2f2c('0x4e')]===_0x2f2c('0x4b')){var _0x28ac2f=_0x30f6df['get']({'plain':!![]});var _0x483ea7=_0x2f2c('0x4f');return db[_0x2f2c('0x50')][_0x2f2c('0x49')]({'where':{'name':_0x483ea7,'userProfileId':_0x4e723c[_0x2f2c('0x51')]},'raw':!![]})['then'](function(_0x18157d){if(_0x18157d&&_0x18157d[_0x2f2c('0x52')]===0x0){return db[_0x2f2c('0x53')][_0x2f2c('0x4a')]({'name':_0x28ac2f[_0x2f2c('0x29')],'resourceId':_0x28ac2f['id'],'type':'CustomReports','sectionId':_0x18157d['id']},{})['then'](function(){return _0x30f6df;});}else{return _0x30f6df;}})['catch'](function(_0x2b60ea){logger[_0x2f2c('0x27')](_0x2f2c('0x54'),_0x2b60ea);throw _0x2b60ea;});}return _0x30f6df;})[_0x2f2c('0x24')](respondWithResult(_0x132c02,0xc9))['catch'](handleError(_0x132c02,null));};exports[_0x2f2c('0x23')]=function(_0x1d367d,_0x507ef9){if(_0x1d367d['body']['id']){delete _0x1d367d[_0x2f2c('0x55')]['id'];}return db[_0x2f2c('0x2d')][_0x2f2c('0x49')]({'where':{'id':_0x1d367d[_0x2f2c('0x47')]['id']}})[_0x2f2c('0x24')](handleEntityNotFound(_0x507ef9,null))[_0x2f2c('0x24')](saveUpdates(_0x1d367d['body'],null))[_0x2f2c('0x24')](respondWithResult(_0x507ef9,null))[_0x2f2c('0x45')](handleError(_0x507ef9,null));};exports[_0x2f2c('0x25')]=function(_0xfc2612,_0x2ba350){return db['AnalyticCustomReport'][_0x2f2c('0x49')]({'where':{'id':_0xfc2612[_0x2f2c('0x47')]['id']}})[_0x2f2c('0x24')](handleEntityNotFound(_0x2ba350,null))[_0x2f2c('0x24')](removeEntity(_0x2ba350,null))[_0x2f2c('0x45')](handleError(_0x2ba350,null));};exports['preview']=function(_0x1cb238,_0x2eb800){var _0xcd834b=0xa;var _0x2ff8c2=[_0x2f2c('0x56'),_0x2f2c('0x57'),'right_join',_0x2f2c('0x58')];var _0x2bc8e3={'SUM':'SUM(%s)','COUNT':_0x2f2c('0x59'),'COUNT DISTINCT':_0x2f2c('0x5a'),'MAX':_0x2f2c('0x5b'),'MIN':_0x2f2c('0x5c'),'AVG':_0x2f2c('0x5d'),'GROUP_CONCAT':_0x2f2c('0x5e'),'GROUP_CONCAT ASC':_0x2f2c('0x5f'),'GROUP_CONCAT DESC':_0x2f2c('0x60')};var _0x358684={'SEC_TO_TIME':_0x2f2c('0x61'),'DATE':_0x2f2c('0x62'),'HOUR':_0x2f2c('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2f2c('0x64')};var _0x4c0a0a=function(_0xb166ab){return!_[_0x2f2c('0x65')]([_0x2f2c('0x66'),'IS\x20NOT\x20NULL',_0x2f2c('0x67'),'IS\x20NOT\x20EMPTY'],_0xb166ab);};var _0x4b11dc=function(_0x78e0f6){if(!_0x78e0f6||!_0x78e0f6[_0x2f2c('0x68')][_0x2f2c('0x69')]){return'';}for(var _0xe50982='(',_0x532e9f=0x0;_0x532e9f<_0x78e0f6['rules'][_0x2f2c('0x69')];_0x532e9f+=0x1){_0x532e9f>0x0&&(_0xe50982+='\x20'+_0x78e0f6['operator']+'\x20');_0xe50982+=_0x78e0f6[_0x2f2c('0x68')][_0x532e9f][_0x2f2c('0x6a')]?_0x4b11dc(_0x78e0f6[_0x2f2c('0x68')][_0x532e9f][_0x2f2c('0x6a')]):_0x78e0f6[_0x2f2c('0x68')][_0x532e9f][_0x2f2c('0x6b')]+'\x20'+_0x78e0f6[_0x2f2c('0x68')][_0x532e9f]['condition']+(_0x4c0a0a(_0x78e0f6[_0x2f2c('0x68')][_0x532e9f][_0x2f2c('0x6c')])?'\x20'+_0x78e0f6['rules'][_0x532e9f][_0x2f2c('0x6d')]:'');}return _0xe50982+')';};var _0x87f98d={'where':{'id':_0x1cb238[_0x2f2c('0x47')]['id']}},_0x30a2fa,_0x2ae587,_0x158715,_0x33cb27,_0x6f2f0f;_0x87f98d=_[_0x2f2c('0x3f')]({},_0x87f98d,_0x1cb238[_0x2f2c('0x40')]);return db[_0x2f2c('0x2d')][_0x2f2c('0x49')](_0x87f98d)[_0x2f2c('0x24')](function(_0xf7fc23){if(_0xf7fc23){_0x30a2fa=_0xf7fc23;return _0xf7fc23[_0x2f2c('0x6e')]();}return null;})[_0x2f2c('0x24')](function(_0x4209b3){if(_0x4209b3){if(!_0x4209b3[_0x2f2c('0x69')]){throw new db[(_0x2f2c('0x6f'))][(_0x2f2c('0x70'))](_0x2f2c('0x71'),0x193);}_0x2ae587=_0x4209b3;return db[_0x2f2c('0x72')][_0x2f2c('0x43')]({'raw':!![]});}return null;})[_0x2f2c('0x24')](function(_0x2d9926){if(_0x2d9926){_0x158715=_['keyBy'](_0x2d9926,'id');var _0x438bd1;var _0x492c21=squel[_0x2f2c('0x73')]();_0x492c21['from'](_0x30a2fa[_0x2f2c('0x74')]);for(var _0x41280a=0x0;_0x41280a<_0x2ae587['length'];_0x41280a+=0x1){_0x438bd1=_0x2ae587[_0x41280a][_0x2f2c('0x75')]?_0x158715[_0x2ae587[_0x41280a][_0x2f2c('0x75')]][_0x2f2c('0x76')]:_0x2ae587[_0x41280a][_0x2f2c('0x6b')];_0x438bd1=_0x2ae587[_0x41280a]['function']?_[_0x2f2c('0x77')](_0x2bc8e3[_0x2ae587[_0x41280a]['function']],'%s',_0x438bd1):_0x438bd1;_0x438bd1=_0x2ae587[_0x41280a]['format']?_['replace'](_0x358684[_0x2ae587[_0x41280a][_0x2f2c('0x78')]],'%s',_0x438bd1):_0x438bd1;if(_0x2ae587[_0x41280a][_0x2f2c('0x79')]){_0x492c21[_0x2f2c('0x6a')](_0x438bd1);}_0x2ae587[_0x41280a][_0x2f2c('0x7a')]&&_0x492c21[_0x2f2c('0x39')](_0x438bd1,_0x2ae587[_0x41280a][_0x2f2c('0x7a')]===_0x2f2c('0x7b')?![]:!![]);_0x492c21[_0x2f2c('0x6b')](_0x438bd1,_0x2ae587[_0x41280a]['alias']||_0x438bd1);}if(_0x30a2fa[_0x2f2c('0x7c')]){_0x30a2fa['joins']=JSON[_0x2f2c('0x7d')](_0x30a2fa[_0x2f2c('0x7c')]);for(var _0x45267b=0x0;_0x45267b<_0x30a2fa[_0x2f2c('0x7c')][_0x2f2c('0x69')];_0x45267b+=0x1){if(_0x30a2fa[_0x2f2c('0x7c')][_0x45267b]['type']&&_[_0x2f2c('0x65')](_0x2ff8c2,_0x30a2fa[_0x2f2c('0x7c')][_0x45267b][_0x2f2c('0x30')])&&_0x30a2fa[_0x2f2c('0x7c')][_0x45267b][_0x2f2c('0x7e')]&&_0x30a2fa['joins'][_0x45267b]['foreignTable']&&_0x30a2fa[_0x2f2c('0x7c')][_0x45267b][_0x2f2c('0x7f')]){_0x492c21[_0x30a2fa['joins'][_0x45267b]['type']](_0x30a2fa['joins'][_0x45267b][_0x2f2c('0x80')],null,util[_0x2f2c('0x78')](_0x2f2c('0x81'),_0x30a2fa[_0x2f2c('0x74')],_0x30a2fa[_0x2f2c('0x7c')][_0x45267b][_0x2f2c('0x7e')],_0x30a2fa[_0x2f2c('0x7c')][_0x45267b][_0x2f2c('0x80')],_0x30a2fa[_0x2f2c('0x7c')][_0x45267b][_0x2f2c('0x7f')]));}}}if(_0x30a2fa[_0x2f2c('0x82')]){_0x30a2fa[_0x2f2c('0x82')]=JSON[_0x2f2c('0x7d')](_0x30a2fa[_0x2f2c('0x82')]);_0x492c21['where'](_0x4b11dc(_0x30a2fa[_0x2f2c('0x82')][_0x2f2c('0x6a')]));}_0x6f2f0f=_0x492c21[_0x2f2c('0x83')]();_0x492c21[_0x2f2c('0x1c')](_0xcd834b);_0x492c21[_0x2f2c('0x1a')](0x0);logger['debug'](_0x2f2c('0x84'),_0x492c21[_0x2f2c('0x85')]());return dbH['sequelize'][_0x2f2c('0x32')](_0x492c21[_0x2f2c('0x85')](),{'type':dbH[_0x2f2c('0x86')][_0x2f2c('0x87')][_0x2f2c('0x88')]});}})['then'](respondWithResult(_0x2eb800,null))['catch'](handleError(_0x2eb800,null));};function runReport(_0x2fddb6,_0x3cb3ac,_0x1ccda9){var _0x5b3eaf=_0x3cb3ac[_0x2f2c('0x29')];var _0x2c7f8a=0xa;var _0x5a06c2=[_0x2f2c('0x56'),_0x2f2c('0x57'),_0x2f2c('0x89'),_0x2f2c('0x58')];var _0x122b27={'SUM':'SUM(%s)','COUNT':_0x2f2c('0x59'),'COUNT DISTINCT':_0x2f2c('0x5a'),'MAX':_0x2f2c('0x5b'),'MIN':_0x2f2c('0x5c'),'AVG':_0x2f2c('0x5d'),'GROUP_CONCAT':_0x2f2c('0x5e'),'GROUP_CONCAT ASC':_0x2f2c('0x5f'),'GROUP_CONCAT DESC':_0x2f2c('0x60')};var _0x19fb06={'SEC_TO_TIME':_0x2f2c('0x61'),'DATE':'DATE(%s)','HOUR':_0x2f2c('0x63'),'ROUND':_0x2f2c('0x8a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x18cd42=function(_0x49bc74){return!_['includes']([_0x2f2c('0x66'),'IS\x20NOT\x20NULL',_0x2f2c('0x67'),_0x2f2c('0x8b')],_0x49bc74);};var _0x522e97=function(_0x49a561){if(!_0x49a561||!_0x49a561[_0x2f2c('0x68')][_0x2f2c('0x69')]){return'';}for(var _0x246d84='(',_0x293730=0x0;_0x293730<_0x49a561['rules'][_0x2f2c('0x69')];_0x293730+=0x1){_0x293730>0x0&&(_0x246d84+='\x20'+_0x49a561[_0x2f2c('0x8c')]+'\x20');_0x246d84+=_0x49a561[_0x2f2c('0x68')][_0x293730][_0x2f2c('0x6a')]?_0x522e97(_0x49a561[_0x2f2c('0x68')][_0x293730]['group']):_0x49a561[_0x2f2c('0x68')][_0x293730]['field']+'\x20'+_0x49a561[_0x2f2c('0x68')][_0x293730][_0x2f2c('0x6c')]+(_0x18cd42(_0x49a561['rules'][_0x293730][_0x2f2c('0x6c')])?'\x20'+_0x49a561[_0x2f2c('0x68')][_0x293730][_0x2f2c('0x6d')]:'');}return _0x246d84+')';};var _0x3556b1={'where':{'id':_0x2fddb6['id']}},_0x3111a1,_0x36fa86,_0x3dabc5,_0x5710c6,_0x710210;_0x3556b1=_[_0x2f2c('0x3f')]({},_0x3556b1,_0x1ccda9);return db[_0x2f2c('0x2d')][_0x2f2c('0x49')](_0x3556b1)[_0x2f2c('0x24')](function(_0x589525){if(_0x589525){_0x3111a1=_0x589525;return _0x589525[_0x2f2c('0x6e')]();}return null;})[_0x2f2c('0x24')](function(_0x38c741){if(_0x38c741){if(!_0x38c741[_0x2f2c('0x69')]){throw new db[(_0x2f2c('0x6f'))]['ValidationErrorItem'](_0x2f2c('0x71'),0x193);}_0x36fa86=_0x38c741;return db[_0x2f2c('0x72')][_0x2f2c('0x43')]({'raw':!![]});}return null;})[_0x2f2c('0x24')](function(_0x267704){if(_0x267704){_0x3dabc5=_[_0x2f2c('0x8d')](_0x267704,'id');var _0x228730;var _0x3bda1b=squel[_0x2f2c('0x73')]();_0x3bda1b[_0x2f2c('0x8e')](_0x3111a1[_0x2f2c('0x74')]);for(var _0x1ee2cf=0x0;_0x1ee2cf<_0x36fa86['length'];_0x1ee2cf+=0x1){_0x228730=_0x36fa86[_0x1ee2cf][_0x2f2c('0x75')]?_0x3dabc5[_0x36fa86[_0x1ee2cf][_0x2f2c('0x75')]][_0x2f2c('0x76')]:_0x36fa86[_0x1ee2cf][_0x2f2c('0x6b')];_0x228730=_0x36fa86[_0x1ee2cf][_0x2f2c('0x8f')]?_[_0x2f2c('0x77')](_0x122b27[_0x36fa86[_0x1ee2cf][_0x2f2c('0x8f')]],'%s',_0x228730):_0x228730;_0x228730=_0x36fa86[_0x1ee2cf][_0x2f2c('0x78')]?_[_0x2f2c('0x77')](_0x19fb06[_0x36fa86[_0x1ee2cf][_0x2f2c('0x78')]],'%s',_0x228730):_0x228730;if(_0x36fa86[_0x1ee2cf][_0x2f2c('0x79')]){_0x3bda1b[_0x2f2c('0x6a')](_0x228730);}_0x36fa86[_0x1ee2cf][_0x2f2c('0x7a')]&&_0x3bda1b['order'](_0x228730,_0x36fa86[_0x1ee2cf]['orderBy']===_0x2f2c('0x7b')?![]:!![]);_0x3bda1b['field'](_0x228730,_0x36fa86[_0x1ee2cf]['alias']||_0x228730);}if(_0x3111a1['joins']){_0x3111a1[_0x2f2c('0x7c')]=JSON[_0x2f2c('0x7d')](_0x3111a1[_0x2f2c('0x7c')]);for(var _0x808227=0x0;_0x808227<_0x3111a1[_0x2f2c('0x7c')][_0x2f2c('0x69')];_0x808227+=0x1){if(_0x3111a1[_0x2f2c('0x7c')][_0x808227][_0x2f2c('0x30')]&&_[_0x2f2c('0x65')](_0x5a06c2,_0x3111a1[_0x2f2c('0x7c')][_0x808227][_0x2f2c('0x30')])&&_0x3111a1[_0x2f2c('0x7c')][_0x808227][_0x2f2c('0x7e')]&&_0x3111a1[_0x2f2c('0x7c')][_0x808227]['foreignTable']&&_0x3111a1[_0x2f2c('0x7c')][_0x808227]['foreignKey']){_0x3bda1b[_0x3111a1[_0x2f2c('0x7c')][_0x808227]['type']](_0x3111a1[_0x2f2c('0x7c')][_0x808227][_0x2f2c('0x80')],null,util[_0x2f2c('0x78')]('%s.%s\x20=\x20%s.%s',_0x3111a1[_0x2f2c('0x74')],_0x3111a1[_0x2f2c('0x7c')][_0x808227][_0x2f2c('0x7e')],_0x3111a1['joins'][_0x808227]['foreignTable'],_0x3111a1[_0x2f2c('0x7c')][_0x808227][_0x2f2c('0x7f')]));}}}if(_0x3111a1[_0x2f2c('0x82')]){_0x3111a1[_0x2f2c('0x82')]=JSON[_0x2f2c('0x7d')](_0x3111a1[_0x2f2c('0x82')]);_0x3bda1b['where'](_0x522e97(_0x3111a1[_0x2f2c('0x82')][_0x2f2c('0x6a')]));}_0x710210=_0x3bda1b['clone']();_0x3bda1b[_0x2f2c('0x1c')](_0x2c7f8a);_0x3bda1b['offset'](0x0);return;}})[_0x2f2c('0x24')](function(){if(_0x3cb3ac['output']===_0x2f2c('0x90')){return null;}var _0x18c2e3=_[_0x2f2c('0x3f')](_0x3cb3ac,{'name':_0x3cb3ac['fullPath']||_0x3cb3ac[_0x2f2c('0x29')]||_0x3111a1['name'],'basename':_0x5b3eaf,'savename':util['format']('%s-%s.%s',_0x3cb3ac['name']||_0x3111a1[_0x2f2c('0x29')],require(_0x2f2c('0x91'))[_0x2f2c('0x92')](0x4),_0x3cb3ac[_0x2f2c('0x93')]||_0x2f2c('0x94')),'reportId':_0x3111a1['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x2f2c('0x4a')](_0x18c2e3,{'raw':!![]});})[_0x2f2c('0x24')](function(_0x4ab61c){if(_0x3111a1[_0x2f2c('0x74')]===_0x2f2c('0x95')){_0x710210['where'](_0x3111a1[_0x2f2c('0x74')]+_0x2f2c('0x96'),_0x3cb3ac[_0x2f2c('0x97')],_0x3cb3ac[_0x2f2c('0x98')]);}else{_0x710210[_0x2f2c('0x3b')](_0x3111a1['table']+_0x2f2c('0x99'),_0x3cb3ac[_0x2f2c('0x97')],_0x3cb3ac[_0x2f2c('0x98')]);}if(_0x4ab61c){logger[_0x2f2c('0x9a')](_0x2f2c('0x9b'),_0x710210[_0x2f2c('0x85')]());require('child_process')[_0x2f2c('0x9c')](path[_0x2f2c('0x56')](__dirname,'../../components/export/',_0x4ab61c[_0x2f2c('0x93')]),[_0x4ab61c['id'],_0x710210['toString'](),path[_0x2f2c('0x56')](__dirname,'../../files/reports',_0x4ab61c[_0x2f2c('0x9d')]),_0x5b3eaf]);return _0x4ab61c;}else{var _0xf96117=squel[_0x2f2c('0x73')]();_0xf96117[_0x2f2c('0x8e')]('('+_0x710210[_0x2f2c('0x85')]()+')',_0x2f2c('0x9e'));_0xf96117[_0x2f2c('0x6b')](_0x2f2c('0x9f'),'count');_0x710210['limit'](_0x3cb3ac[_0x2f2c('0x1c')]||_0x2c7f8a);_0x710210['offset'](_0x3cb3ac[_0x2f2c('0x1a')]||0x0);return dbH[_0x2f2c('0x86')][_0x2f2c('0x32')](_0xf96117[_0x2f2c('0x85')](),{'type':dbH['sequelize']['QueryTypes'][_0x2f2c('0x88')]})[_0x2f2c('0x24')](function(_0x3a926b){if(!_0x3a926b[_0x2f2c('0x69')]){_0x5710c6=0x0;}else{_0x5710c6=_0x3a926b[0x0][_0x2f2c('0x1d')]||0x0;}return dbH[_0x2f2c('0x86')][_0x2f2c('0x32')](_0x710210[_0x2f2c('0x85')](),{'type':dbH[_0x2f2c('0x86')]['QueryTypes'][_0x2f2c('0x88')]});})[_0x2f2c('0x24')](function(_0x4a1e7b){return{'rows':_0x4a1e7b||[],'count':_0x5710c6};});}});}exports[_0x2f2c('0xa0')]=function(_0x4a077d,_0x25a6a5){return runReport(_0x4a077d[_0x2f2c('0x47')],_0x4a077d[_0x2f2c('0x32')],_0x4a077d[_0x2f2c('0x40')])[_0x2f2c('0x24')](respondWithResult(_0x25a6a5,null))['catch'](handleError(_0x25a6a5,null));};exports[_0x2f2c('0xa1')]=runReport;exports[_0x2f2c('0x32')]=function(_0x3ce7d2,_0x1613bd){var _0x1af2ee=0xa;var _0x527b18=['join','left_join',_0x2f2c('0x89'),_0x2f2c('0x58')];var _0x344949={'SUM':_0x2f2c('0xa2'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2f2c('0x5b'),'MIN':_0x2f2c('0x5c'),'AVG':_0x2f2c('0x5d'),'GROUP_CONCAT':_0x2f2c('0x5e'),'GROUP_CONCAT ASC':_0x2f2c('0x5f'),'GROUP_CONCAT DESC':_0x2f2c('0x60')};var _0x2658fe={'SEC_TO_TIME':_0x2f2c('0x61'),'DATE':_0x2f2c('0x62'),'HOUR':_0x2f2c('0x63'),'ROUND':_0x2f2c('0x8a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4b16d7=function(_0x4761be){return!_[_0x2f2c('0x65')]([_0x2f2c('0x66'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2f2c('0x8b')],_0x4761be);};var _0x4bf8ef=function(_0x563c5c){if(!_0x563c5c||!_0x563c5c[_0x2f2c('0x68')][_0x2f2c('0x69')]){return'';}for(var _0x5b633f='(',_0x409883=0x0;_0x409883<_0x563c5c[_0x2f2c('0x68')][_0x2f2c('0x69')];_0x409883+=0x1){_0x409883>0x0&&(_0x5b633f+='\x20'+_0x563c5c['operator']+'\x20');_0x5b633f+=_0x563c5c[_0x2f2c('0x68')][_0x409883][_0x2f2c('0x6a')]?_0x4bf8ef(_0x563c5c[_0x2f2c('0x68')][_0x409883][_0x2f2c('0x6a')]):_0x563c5c[_0x2f2c('0x68')][_0x409883]['field']+'\x20'+_0x563c5c[_0x2f2c('0x68')][_0x409883][_0x2f2c('0x6c')]+(_0x4b16d7(_0x563c5c['rules'][_0x409883]['condition'])?'\x20'+_0x563c5c['rules'][_0x409883]['value']:'');}return _0x5b633f+')';};var _0x37e319={'where':{'id':_0x3ce7d2['params']['id']}},_0x11543d,_0x59fe41,_0x4dee9e,_0x1050f9,_0x1dfdc3;_0x37e319=_['merge']({},_0x37e319,_0x3ce7d2[_0x2f2c('0x40')]);return db[_0x2f2c('0x2d')][_0x2f2c('0x49')](_0x37e319)[_0x2f2c('0x24')](function(_0x37ec5f){if(_0x37ec5f){_0x11543d=_0x37ec5f;return _0x37ec5f[_0x2f2c('0x6e')]();}return null;})['then'](function(_0x286fc8){if(_0x286fc8){if(!_0x286fc8[_0x2f2c('0x69')]){throw new db[(_0x2f2c('0x6f'))][(_0x2f2c('0x70'))](_0x2f2c('0x71'),0x193);}_0x59fe41=_0x286fc8;return db[_0x2f2c('0x72')]['findAll']({'raw':!![]});}return null;})[_0x2f2c('0x24')](function(_0x9e1417){if(_0x9e1417){_0x4dee9e=_['keyBy'](_0x9e1417,'id');var _0x1af39d;var _0x1d2d3a=squel[_0x2f2c('0x73')]();_0x1d2d3a[_0x2f2c('0x8e')](_0x11543d[_0x2f2c('0x74')]);for(var _0x1c689e=0x0;_0x1c689e<_0x59fe41['length'];_0x1c689e+=0x1){_0x1af39d=_0x59fe41[_0x1c689e]['MetricId']?_0x4dee9e[_0x59fe41[_0x1c689e][_0x2f2c('0x75')]]['metric']:_0x59fe41[_0x1c689e][_0x2f2c('0x6b')];_0x1af39d=_0x59fe41[_0x1c689e]['function']?_['replace'](_0x344949[_0x59fe41[_0x1c689e][_0x2f2c('0x8f')]],'%s',_0x1af39d):_0x1af39d;_0x1af39d=_0x59fe41[_0x1c689e]['format']?_[_0x2f2c('0x77')](_0x2658fe[_0x59fe41[_0x1c689e][_0x2f2c('0x78')]],'%s',_0x1af39d):_0x1af39d;if(_0x59fe41[_0x1c689e][_0x2f2c('0x79')]){_0x1d2d3a['group'](_0x1af39d);}_0x59fe41[_0x1c689e][_0x2f2c('0x7a')]&&_0x1d2d3a[_0x2f2c('0x39')](_0x1af39d,_0x59fe41[_0x1c689e][_0x2f2c('0x7a')]===_0x2f2c('0x7b')?![]:!![]);_0x1d2d3a[_0x2f2c('0x6b')](_0x1af39d,_0x59fe41[_0x1c689e][_0x2f2c('0xa3')]||_0x1af39d);}if(_0x11543d[_0x2f2c('0x7c')]){_0x11543d[_0x2f2c('0x7c')]=JSON[_0x2f2c('0x7d')](_0x11543d[_0x2f2c('0x7c')]);for(var _0x461955=0x0;_0x461955<_0x11543d[_0x2f2c('0x7c')][_0x2f2c('0x69')];_0x461955+=0x1){if(_0x11543d[_0x2f2c('0x7c')][_0x461955][_0x2f2c('0x30')]&&_[_0x2f2c('0x65')](_0x527b18,_0x11543d[_0x2f2c('0x7c')][_0x461955][_0x2f2c('0x30')])&&_0x11543d['joins'][_0x461955][_0x2f2c('0x7e')]&&_0x11543d[_0x2f2c('0x7c')][_0x461955][_0x2f2c('0x80')]&&_0x11543d[_0x2f2c('0x7c')][_0x461955][_0x2f2c('0x7f')]){_0x1d2d3a[_0x11543d[_0x2f2c('0x7c')][_0x461955][_0x2f2c('0x30')]](_0x11543d[_0x2f2c('0x7c')][_0x461955][_0x2f2c('0x80')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x11543d[_0x2f2c('0x74')],_0x11543d[_0x2f2c('0x7c')][_0x461955][_0x2f2c('0x7e')],_0x11543d[_0x2f2c('0x7c')][_0x461955][_0x2f2c('0x80')],_0x11543d['joins'][_0x461955]['foreignKey']));}}}if(_0x11543d[_0x2f2c('0x82')]){_0x11543d[_0x2f2c('0x82')]=JSON['parse'](_0x11543d['conditions']);_0x1d2d3a['where'](_0x4bf8ef(_0x11543d[_0x2f2c('0x82')][_0x2f2c('0x6a')]));}_0x1dfdc3=_0x1d2d3a[_0x2f2c('0x83')]();_0x1d2d3a[_0x2f2c('0x1c')](_0x1af2ee);_0x1d2d3a[_0x2f2c('0x1a')](0x0);logger[_0x2f2c('0xa4')]('Limited\x20Query:',_0x1d2d3a[_0x2f2c('0x85')]());return dbH['sequelize'][_0x2f2c('0x32')](_0x1d2d3a[_0x2f2c('0x85')](),{'type':dbH[_0x2f2c('0x86')][_0x2f2c('0x87')][_0x2f2c('0x88')]});}})[_0x2f2c('0x24')](function(){return{'sql':_0x1dfdc3[_0x2f2c('0x85')]()};})['then'](respondWithResult(_0x1613bd,null))[_0x2f2c('0x45')](handleError(_0x1613bd,null));}; \ No newline at end of file +var _0x8bec=['Sequelize','ValidationErrorItem','AnalyticMetric','table','MetricId','replace','function','format','groupBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','Limited\x20Query:','toString','QueryTypes','SELECT','join','right_join','SUM(%s)','MIN(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','IS\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','metric','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','savename','select','countTable','COUNT(*)','sequelize','run','DATE(%s)','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','end','error','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','preview','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields'];(function(_0x34e5a8,_0x1670a4){var _0x5bc365=function(_0x47a389){while(--_0x47a389){_0x34e5a8['push'](_0x34e5a8['shift']());}};_0x5bc365(++_0x1670a4);}(_0x8bec,0xdd));var _0xc8be=function(_0x3701cf,_0x25c0b8){_0x3701cf=_0x3701cf-0x0;var _0x4ea60b=_0x8bec[_0x3701cf];return _0x4ea60b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8be('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8be('0x1'));var rp=require(_0xc8be('0x2'));var moment=require(_0xc8be('0x3'));var BPromise=require(_0xc8be('0x4'));var Mustache=require(_0xc8be('0x5'));var util=require('util');var path=require(_0xc8be('0x6'));var sox=require(_0xc8be('0x7'));var csv=require(_0xc8be('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8be('0x9'));var squel=require(_0xc8be('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8be('0xb'));var deskjs=require(_0xc8be('0xc'));var toCsv=require(_0xc8be('0x8'));var querystring=require(_0xc8be('0xd'));var Papa=require(_0xc8be('0xe'));var Redis=require(_0xc8be('0xf'));var authService=require(_0xc8be('0x10'));var qs=require(_0xc8be('0x11'));var as=require(_0xc8be('0x12'));var hardwareService=require(_0xc8be('0x13'));var logger=require(_0xc8be('0x14'))(_0xc8be('0x15'));var utils=require('../../config/utils');var config=require(_0xc8be('0x16'));var licenseUtil=require(_0xc8be('0x17'));var db=require(_0xc8be('0x18'))['db'];var dbH=require('../../mysqldb')[_0xc8be('0x19')];function respondWithStatusCode(_0x51f0b0,_0xc81750){_0xc81750=_0xc81750||0xcc;return function(_0x3474c1){if(_0x3474c1){return _0x51f0b0[_0xc8be('0x1a')](_0xc81750);}return _0x51f0b0[_0xc8be('0x1b')](_0xc81750)['end']();};}function respondWithResult(_0x530ad4,_0x715138){_0x715138=_0x715138||0xc8;return function(_0x49f9d5){if(_0x49f9d5){return _0x530ad4[_0xc8be('0x1b')](_0x715138)[_0xc8be('0x1c')](_0x49f9d5);}};}function respondWithFilteredResult(_0x5bd966,_0x18ec0b){return function(_0x4ba583){if(_0x4ba583){var _0x48e5ca=typeof _0x18ec0b['offset']==='undefined'&&typeof _0x18ec0b[_0xc8be('0x1d')]===_0xc8be('0x1e');var _0x349c08=_0x4ba583[_0xc8be('0x1f')];var _0x5eaef5=_0x48e5ca?0x0:_0x18ec0b['offset'];var _0x28a34f=_0x48e5ca?_0x4ba583[_0xc8be('0x1f')]:_0x18ec0b[_0xc8be('0x20')]+_0x18ec0b[_0xc8be('0x1d')];var _0xa357cf;if(_0x28a34f>=_0x349c08){_0x28a34f=_0x349c08;_0xa357cf=0xc8;}else{_0xa357cf=0xce;}_0x5bd966[_0xc8be('0x1b')](_0xa357cf);return _0x5bd966[_0xc8be('0x21')](_0xc8be('0x22'),_0x5eaef5+'-'+_0x28a34f+'/'+_0x349c08)[_0xc8be('0x1c')](_0x4ba583);}return null;};}function patchUpdates(_0x4ed146){return function(_0x28e58b){try{jsonpatch[_0xc8be('0x23')](_0x28e58b,_0x4ed146,!![]);}catch(_0x1c34b8){return BPromise['reject'](_0x1c34b8);}return _0x28e58b[_0xc8be('0x24')]();};}function saveUpdates(_0x275020,_0x926280){return function(_0x4a6a15){if(_0x4a6a15){return _0x4a6a15[_0xc8be('0x25')](_0x275020)[_0xc8be('0x26')](function(_0x45d13f){return _0x45d13f;});}return null;};}function removeEntity(_0x3d529b,_0xa0ed02){return function(_0x5039a4){if(_0x5039a4){return _0x5039a4[_0xc8be('0x27')]()['then'](function(){var _0x17e0c8=_0x5039a4[_0xc8be('0x28')]({'plain':!![]});var _0x4b3354=_0xc8be('0x29');return db[_0xc8be('0x2a')][_0xc8be('0x27')]({'where':{'type':_0x4b3354,'resourceId':_0x17e0c8['id']}})[_0xc8be('0x26')](function(){return _0x5039a4;});})[_0xc8be('0x26')](function(){_0x3d529b[_0xc8be('0x1b')](0xcc)[_0xc8be('0x2b')]();});}};}function handleEntityNotFound(_0x326b19,_0x3d3183){return function(_0x2d0886){if(!_0x2d0886){_0x326b19[_0xc8be('0x1a')](0x194);}return _0x2d0886;};}function handleError(_0xccb34a,_0x11f8e9){_0x11f8e9=_0x11f8e9||0x1f4;return function(_0x29ff47){logger[_0xc8be('0x2c')](_0x29ff47['stack']);if(_0x29ff47[_0xc8be('0x2d')]){delete _0x29ff47[_0xc8be('0x2d')];}_0xccb34a[_0xc8be('0x1b')](_0x11f8e9)[_0xc8be('0x2e')](_0x29ff47);};}exports['index']=function(_0x5087ea,_0x1595b9){var _0x179f80={},_0x4eb9b6={},_0x170b2e={'count':0x0,'rows':[]};var _0x224548=_['map'](db[_0xc8be('0x2f')][_0xc8be('0x30')],function(_0x39c631){return{'name':_0x39c631[_0xc8be('0x31')],'type':_0x39c631[_0xc8be('0x32')][_0xc8be('0x33')]};});_0x4eb9b6[_0xc8be('0x34')]=_['map'](_0x224548,_0xc8be('0x2d'));_0x4eb9b6[_0xc8be('0x35')]=_[_0xc8be('0x36')](_0x5087ea[_0xc8be('0x35')]);_0x4eb9b6[_0xc8be('0x37')]=_[_0xc8be('0x38')](_0x4eb9b6[_0xc8be('0x34')],_0x4eb9b6[_0xc8be('0x35')]);_0x179f80[_0xc8be('0x39')]=_[_0xc8be('0x38')](_0x4eb9b6[_0xc8be('0x34')],qs[_0xc8be('0x3a')](_0x5087ea['query'][_0xc8be('0x3a')]));_0x179f80[_0xc8be('0x39')]=_0x179f80[_0xc8be('0x39')][_0xc8be('0x3b')]?_0x179f80[_0xc8be('0x39')]:_0x4eb9b6['model'];if(!_0x5087ea[_0xc8be('0x35')][_0xc8be('0x3c')]('nolimit')){_0x179f80['limit']=qs[_0xc8be('0x1d')](_0x5087ea['query']['limit']);_0x179f80[_0xc8be('0x20')]=qs[_0xc8be('0x20')](_0x5087ea[_0xc8be('0x35')]['offset']);}_0x179f80[_0xc8be('0x3d')]=qs[_0xc8be('0x3e')](_0x5087ea['query'][_0xc8be('0x3e')]);_0x179f80[_0xc8be('0x3f')]=qs[_0xc8be('0x37')](_[_0xc8be('0x40')](_0x5087ea[_0xc8be('0x35')],_0x4eb9b6[_0xc8be('0x37')]),_0x224548);if(_0x5087ea[_0xc8be('0x35')][_0xc8be('0x41')]){_0x179f80[_0xc8be('0x3f')]=_['merge'](_0x179f80['where'],{'$or':_[_0xc8be('0x42')](_0x224548,function(_0x2a20f8){if(_0x2a20f8[_0xc8be('0x32')]!==_0xc8be('0x43')){var _0x1da866={};_0x1da866[_0x2a20f8[_0xc8be('0x2d')]]={'$like':'%'+_0x5087ea['query'][_0xc8be('0x41')]+'%'};return _0x1da866;}})});}_0x179f80=_[_0xc8be('0x44')]({},_0x179f80,_0x5087ea[_0xc8be('0x45')]);var _0x10da5c={'where':_0x179f80['where']};return db[_0xc8be('0x2f')]['count'](_0x10da5c)[_0xc8be('0x26')](function(_0x147698){_0x170b2e[_0xc8be('0x1f')]=_0x147698;if(_0x5087ea[_0xc8be('0x35')][_0xc8be('0x46')]){_0x179f80['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xc8be('0x47')](_0x179f80);})['then'](function(_0x120ba3){_0x170b2e[_0xc8be('0x48')]=_0x120ba3;return _0x170b2e;})[_0xc8be('0x26')](respondWithFilteredResult(_0x1595b9,_0x179f80))[_0xc8be('0x49')](handleError(_0x1595b9,null));};exports['show']=function(_0x3de8da,_0x5ade06){var _0x44fff4={'raw':![],'where':{'id':_0x3de8da[_0xc8be('0x4a')]['id']}},_0x5e6524={};_0x5e6524[_0xc8be('0x34')]=_[_0xc8be('0x36')](db[_0xc8be('0x2f')][_0xc8be('0x30')]);_0x5e6524[_0xc8be('0x35')]=_[_0xc8be('0x36')](_0x3de8da['query']);_0x5e6524['filters']=_[_0xc8be('0x38')](_0x5e6524[_0xc8be('0x34')],_0x5e6524['query']);_0x44fff4[_0xc8be('0x39')]=_['intersection'](_0x5e6524['model'],qs[_0xc8be('0x3a')](_0x3de8da['query'][_0xc8be('0x3a')]));_0x44fff4[_0xc8be('0x39')]=_0x44fff4[_0xc8be('0x39')][_0xc8be('0x3b')]?_0x44fff4[_0xc8be('0x39')]:_0x5e6524[_0xc8be('0x34')];if(_0x3de8da[_0xc8be('0x35')][_0xc8be('0x46')]){_0x44fff4[_0xc8be('0x4b')]=[{'all':!![]}];}_0x44fff4=_[_0xc8be('0x44')]({},_0x44fff4,_0x3de8da['options']);return db[_0xc8be('0x2f')]['find'](_0x44fff4)[_0xc8be('0x26')](handleEntityNotFound(_0x5ade06,null))[_0xc8be('0x26')](respondWithResult(_0x5ade06,null))[_0xc8be('0x49')](handleError(_0x5ade06,null));};exports[_0xc8be('0x4c')]=function(_0x472673,_0x48cb1f){return db['AnalyticCustomReport'][_0xc8be('0x4c')](_0x472673[_0xc8be('0x4d')],{})['then'](function(_0x3d1431){var _0x3ff5dd=_0x472673['user'][_0xc8be('0x28')]({'plain':!![]});if(!_0x3ff5dd)throw new Error(_0xc8be('0x4e'));if(_0x3ff5dd[_0xc8be('0x4f')]==='user'){var _0x15ec9e=_0x3d1431[_0xc8be('0x28')]({'plain':!![]});var _0x2d2d07=_0xc8be('0x50');return db[_0xc8be('0x51')]['find']({'where':{'name':_0x2d2d07,'userProfileId':_0x3ff5dd[_0xc8be('0x52')]},'raw':!![]})['then'](function(_0x235e96){if(_0x235e96&&_0x235e96[_0xc8be('0x53')]===0x0){return db[_0xc8be('0x2a')]['create']({'name':_0x15ec9e['name'],'resourceId':_0x15ec9e['id'],'type':_0xc8be('0x29'),'sectionId':_0x235e96['id']},{})[_0xc8be('0x26')](function(){return _0x3d1431;});}else{return _0x3d1431;}})[_0xc8be('0x49')](function(_0x2c07c9){logger[_0xc8be('0x2c')](_0xc8be('0x54'),_0x2c07c9);throw _0x2c07c9;});}return _0x3d1431;})[_0xc8be('0x26')](respondWithResult(_0x48cb1f,0xc9))['catch'](handleError(_0x48cb1f,null));};exports[_0xc8be('0x25')]=function(_0x3d5af8,_0x4b128f){if(_0x3d5af8[_0xc8be('0x4d')]['id']){delete _0x3d5af8[_0xc8be('0x4d')]['id'];}return db[_0xc8be('0x2f')]['find']({'where':{'id':_0x3d5af8[_0xc8be('0x4a')]['id']}})[_0xc8be('0x26')](handleEntityNotFound(_0x4b128f,null))[_0xc8be('0x26')](saveUpdates(_0x3d5af8['body'],null))[_0xc8be('0x26')](respondWithResult(_0x4b128f,null))[_0xc8be('0x49')](handleError(_0x4b128f,null));};exports[_0xc8be('0x27')]=function(_0x593e95,_0x2e6015){return db[_0xc8be('0x2f')][_0xc8be('0x55')]({'where':{'id':_0x593e95[_0xc8be('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e6015,null))[_0xc8be('0x26')](removeEntity(_0x2e6015,null))['catch'](handleError(_0x2e6015,null));};exports[_0xc8be('0x56')]=function(_0x455072,_0x2fcafd){var _0x5d3629=0xa;var _0x4c4964=['join',_0xc8be('0x57'),'right_join',_0xc8be('0x58')];var _0xadab50={'SUM':'SUM(%s)','COUNT':_0xc8be('0x59'),'COUNT DISTINCT':_0xc8be('0x5a'),'MAX':_0xc8be('0x5b'),'MIN':'MIN(%s)','AVG':_0xc8be('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc8be('0x5d'),'GROUP_CONCAT DESC':_0xc8be('0x5e')};var _0x311678={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xc8be('0x5f'),'UNIX_TIMESTAMP':_0xc8be('0x60')};var _0x430756=function(_0x212ec6){return!_[_0xc8be('0x61')](['IS\x20NULL',_0xc8be('0x62'),_0xc8be('0x63'),_0xc8be('0x64')],_0x212ec6);};var _0x43e1b8=function(_0x2e31de){if(!_0x2e31de||!_0x2e31de[_0xc8be('0x65')][_0xc8be('0x3b')]){return'';}for(var _0x5329c8='(',_0x393e50=0x0;_0x393e50<_0x2e31de[_0xc8be('0x65')][_0xc8be('0x3b')];_0x393e50+=0x1){_0x393e50>0x0&&(_0x5329c8+='\x20'+_0x2e31de[_0xc8be('0x66')]+'\x20');_0x5329c8+=_0x2e31de[_0xc8be('0x65')][_0x393e50][_0xc8be('0x67')]?_0x43e1b8(_0x2e31de[_0xc8be('0x65')][_0x393e50][_0xc8be('0x67')]):_0x2e31de[_0xc8be('0x65')][_0x393e50][_0xc8be('0x68')]+'\x20'+_0x2e31de[_0xc8be('0x65')][_0x393e50][_0xc8be('0x69')]+(_0x430756(_0x2e31de[_0xc8be('0x65')][_0x393e50][_0xc8be('0x69')])?'\x20'+_0x2e31de[_0xc8be('0x65')][_0x393e50]['value']:'');}return _0x5329c8+')';};var _0x4ff668={'where':{'id':_0x455072['params']['id']}},_0x485220,_0x9dacf,_0x5ad2f6,_0x2869e9,_0x108ec6;_0x4ff668=_[_0xc8be('0x44')]({},_0x4ff668,_0x455072['options']);return db['AnalyticCustomReport']['find'](_0x4ff668)['then'](function(_0x2fa9e0){if(_0x2fa9e0){_0x485220=_0x2fa9e0;return _0x2fa9e0[_0xc8be('0x6a')]();}return null;})[_0xc8be('0x26')](function(_0xbc2525){if(_0xbc2525){if(!_0xbc2525[_0xc8be('0x3b')]){throw new db[(_0xc8be('0x6b'))][(_0xc8be('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x9dacf=_0xbc2525;return db[_0xc8be('0x6d')][_0xc8be('0x47')]({'raw':!![]});}return null;})[_0xc8be('0x26')](function(_0xe065a0){if(_0xe065a0){_0x5ad2f6=_['keyBy'](_0xe065a0,'id');var _0x330423;var _0x419288=squel['select']();_0x419288['from'](_0x485220[_0xc8be('0x6e')]);for(var _0x3f1c05=0x0;_0x3f1c05<_0x9dacf[_0xc8be('0x3b')];_0x3f1c05+=0x1){_0x330423=_0x9dacf[_0x3f1c05][_0xc8be('0x6f')]?_0x5ad2f6[_0x9dacf[_0x3f1c05][_0xc8be('0x6f')]]['metric']:_0x9dacf[_0x3f1c05][_0xc8be('0x68')];_0x330423=_0x9dacf[_0x3f1c05]['function']?_[_0xc8be('0x70')](_0xadab50[_0x9dacf[_0x3f1c05][_0xc8be('0x71')]],'%s',_0x330423):_0x330423;_0x330423=_0x9dacf[_0x3f1c05]['format']?_[_0xc8be('0x70')](_0x311678[_0x9dacf[_0x3f1c05][_0xc8be('0x72')]],'%s',_0x330423):_0x330423;if(_0x9dacf[_0x3f1c05][_0xc8be('0x73')]){_0x419288[_0xc8be('0x67')](_0x330423);}_0x9dacf[_0x3f1c05]['orderBy']&&_0x419288[_0xc8be('0x3d')](_0x330423,_0x9dacf[_0x3f1c05]['orderBy']===_0xc8be('0x74')?![]:!![]);_0x419288[_0xc8be('0x68')](_0x330423,_0x9dacf[_0x3f1c05][_0xc8be('0x75')]||_0x330423);}if(_0x485220[_0xc8be('0x76')]){_0x485220[_0xc8be('0x76')]=JSON['parse'](_0x485220[_0xc8be('0x76')]);for(var _0x21cd12=0x0;_0x21cd12<_0x485220[_0xc8be('0x76')][_0xc8be('0x3b')];_0x21cd12+=0x1){if(_0x485220['joins'][_0x21cd12][_0xc8be('0x32')]&&_[_0xc8be('0x61')](_0x4c4964,_0x485220[_0xc8be('0x76')][_0x21cd12][_0xc8be('0x32')])&&_0x485220[_0xc8be('0x76')][_0x21cd12][_0xc8be('0x77')]&&_0x485220[_0xc8be('0x76')][_0x21cd12]['foreignTable']&&_0x485220[_0xc8be('0x76')][_0x21cd12]['foreignKey']){_0x419288[_0x485220[_0xc8be('0x76')][_0x21cd12]['type']](_0x485220[_0xc8be('0x76')][_0x21cd12][_0xc8be('0x78')],null,util[_0xc8be('0x72')](_0xc8be('0x79'),_0x485220[_0xc8be('0x6e')],_0x485220[_0xc8be('0x76')][_0x21cd12][_0xc8be('0x77')],_0x485220[_0xc8be('0x76')][_0x21cd12][_0xc8be('0x78')],_0x485220[_0xc8be('0x76')][_0x21cd12][_0xc8be('0x7a')]));}}}if(_0x485220[_0xc8be('0x7b')]){_0x485220['conditions']=JSON[_0xc8be('0x7c')](_0x485220['conditions']);_0x419288[_0xc8be('0x3f')](_0x43e1b8(_0x485220[_0xc8be('0x7b')][_0xc8be('0x67')]));}_0x108ec6=_0x419288[_0xc8be('0x7d')]();_0x419288['limit'](_0x5d3629);_0x419288[_0xc8be('0x20')](0x0);logger['debug'](_0xc8be('0x7e'),_0x419288[_0xc8be('0x7f')]());return dbH['sequelize'][_0xc8be('0x35')](_0x419288['toString'](),{'type':dbH['sequelize'][_0xc8be('0x80')][_0xc8be('0x81')]});}})[_0xc8be('0x26')](respondWithResult(_0x2fcafd,null))['catch'](handleError(_0x2fcafd,null));};function runReport(_0x688161,_0x3870fb,_0x1f2020){var _0x28dd19=_0x3870fb[_0xc8be('0x2d')];var _0x147cd7=0xa;var _0xa383b6=[_0xc8be('0x82'),'left_join',_0xc8be('0x83'),_0xc8be('0x58')];var _0x41fa9b={'SUM':_0xc8be('0x84'),'COUNT':_0xc8be('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc8be('0x5b'),'MIN':_0xc8be('0x85'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc8be('0x86'),'GROUP_CONCAT ASC':_0xc8be('0x5d'),'GROUP_CONCAT DESC':_0xc8be('0x5e')};var _0xc4b85b={'SEC_TO_TIME':_0xc8be('0x87'),'DATE':'DATE(%s)','HOUR':_0xc8be('0x88'),'ROUND':_0xc8be('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x53b3d2=function(_0x263803){return!_['includes']([_0xc8be('0x89'),'IS\x20NOT\x20NULL',_0xc8be('0x63'),'IS\x20NOT\x20EMPTY'],_0x263803);};var _0x6fc3d3=function(_0x3fced6){if(!_0x3fced6||!_0x3fced6['rules']['length']){return'';}for(var _0x593dd0='(',_0x20fd0b=0x0;_0x20fd0b<_0x3fced6['rules'][_0xc8be('0x3b')];_0x20fd0b+=0x1){_0x20fd0b>0x0&&(_0x593dd0+='\x20'+_0x3fced6[_0xc8be('0x66')]+'\x20');_0x593dd0+=_0x3fced6['rules'][_0x20fd0b][_0xc8be('0x67')]?_0x6fc3d3(_0x3fced6[_0xc8be('0x65')][_0x20fd0b][_0xc8be('0x67')]):_0x3fced6[_0xc8be('0x65')][_0x20fd0b][_0xc8be('0x68')]+'\x20'+_0x3fced6[_0xc8be('0x65')][_0x20fd0b][_0xc8be('0x69')]+(_0x53b3d2(_0x3fced6[_0xc8be('0x65')][_0x20fd0b][_0xc8be('0x69')])?'\x20'+_0x3fced6[_0xc8be('0x65')][_0x20fd0b]['value']:'');}return _0x593dd0+')';};var _0x2bb7f9={'where':{'id':_0x688161['id']}},_0x32b758,_0x1a9162,_0x33bdcf,_0x5a69ad,_0x596c3b;_0x2bb7f9=_[_0xc8be('0x44')]({},_0x2bb7f9,_0x1f2020);return db[_0xc8be('0x2f')][_0xc8be('0x55')](_0x2bb7f9)[_0xc8be('0x26')](function(_0x3c7d22){if(_0x3c7d22){_0x32b758=_0x3c7d22;return _0x3c7d22[_0xc8be('0x6a')]();}return null;})[_0xc8be('0x26')](function(_0x34448e){if(_0x34448e){if(!_0x34448e['length']){throw new db['Sequelize'][(_0xc8be('0x6c'))](_0xc8be('0x8a'),0x193);}_0x1a9162=_0x34448e;return db['AnalyticMetric'][_0xc8be('0x47')]({'raw':!![]});}return null;})[_0xc8be('0x26')](function(_0x3ce586){if(_0x3ce586){_0x33bdcf=_[_0xc8be('0x8b')](_0x3ce586,'id');var _0x2c5407;var _0x4e5272=squel['select']();_0x4e5272[_0xc8be('0x8c')](_0x32b758[_0xc8be('0x6e')]);for(var _0x470c99=0x0;_0x470c99<_0x1a9162[_0xc8be('0x3b')];_0x470c99+=0x1){_0x2c5407=_0x1a9162[_0x470c99]['MetricId']?_0x33bdcf[_0x1a9162[_0x470c99][_0xc8be('0x6f')]][_0xc8be('0x8d')]:_0x1a9162[_0x470c99]['field'];_0x2c5407=_0x1a9162[_0x470c99][_0xc8be('0x71')]?_[_0xc8be('0x70')](_0x41fa9b[_0x1a9162[_0x470c99]['function']],'%s',_0x2c5407):_0x2c5407;_0x2c5407=_0x1a9162[_0x470c99]['format']?_[_0xc8be('0x70')](_0xc4b85b[_0x1a9162[_0x470c99]['format']],'%s',_0x2c5407):_0x2c5407;if(_0x1a9162[_0x470c99]['groupBy']){_0x4e5272['group'](_0x2c5407);}_0x1a9162[_0x470c99][_0xc8be('0x8e')]&&_0x4e5272[_0xc8be('0x3d')](_0x2c5407,_0x1a9162[_0x470c99][_0xc8be('0x8e')]==='DESC'?![]:!![]);_0x4e5272[_0xc8be('0x68')](_0x2c5407,_0x1a9162[_0x470c99][_0xc8be('0x75')]||_0x2c5407);}if(_0x32b758['joins']){_0x32b758[_0xc8be('0x76')]=JSON[_0xc8be('0x7c')](_0x32b758['joins']);for(var _0x55beaa=0x0;_0x55beaa<_0x32b758['joins'][_0xc8be('0x3b')];_0x55beaa+=0x1){if(_0x32b758[_0xc8be('0x76')][_0x55beaa]['type']&&_[_0xc8be('0x61')](_0xa383b6,_0x32b758[_0xc8be('0x76')][_0x55beaa]['type'])&&_0x32b758[_0xc8be('0x76')][_0x55beaa]['parentKey']&&_0x32b758[_0xc8be('0x76')][_0x55beaa]['foreignTable']&&_0x32b758[_0xc8be('0x76')][_0x55beaa][_0xc8be('0x7a')]){_0x4e5272[_0x32b758[_0xc8be('0x76')][_0x55beaa][_0xc8be('0x32')]](_0x32b758[_0xc8be('0x76')][_0x55beaa][_0xc8be('0x78')],null,util['format'](_0xc8be('0x79'),_0x32b758['table'],_0x32b758[_0xc8be('0x76')][_0x55beaa]['parentKey'],_0x32b758[_0xc8be('0x76')][_0x55beaa][_0xc8be('0x78')],_0x32b758[_0xc8be('0x76')][_0x55beaa][_0xc8be('0x7a')]));}}}if(_0x32b758[_0xc8be('0x7b')]){_0x32b758[_0xc8be('0x7b')]=JSON['parse'](_0x32b758[_0xc8be('0x7b')]);_0x4e5272[_0xc8be('0x3f')](_0x6fc3d3(_0x32b758[_0xc8be('0x7b')][_0xc8be('0x67')]));}_0x596c3b=_0x4e5272[_0xc8be('0x7d')]();_0x4e5272[_0xc8be('0x1d')](_0x147cd7);_0x4e5272[_0xc8be('0x20')](0x0);return;}})['then'](function(){if(_0x3870fb[_0xc8be('0x8f')]===_0xc8be('0x90')){return null;}var _0x548685=_[_0xc8be('0x44')](_0x3870fb,{'name':_0x3870fb[_0xc8be('0x91')]||_0x3870fb[_0xc8be('0x2d')]||_0x32b758['name'],'basename':_0x28dd19,'savename':util['format'](_0xc8be('0x92'),_0x3870fb[_0xc8be('0x2d')]||_0x32b758[_0xc8be('0x2d')],require(_0xc8be('0x93'))[_0xc8be('0x94')](0x4),_0x3870fb[_0xc8be('0x8f')]||_0xc8be('0x95')),'reportId':_0x32b758['id'],'reportType':_0xc8be('0x96')});return db[_0xc8be('0x97')][_0xc8be('0x4c')](_0x548685,{'raw':!![]});})['then'](function(_0x34cdfe){if(_0x32b758[_0xc8be('0x6e')]==='cdr'){_0x596c3b[_0xc8be('0x3f')](_0x32b758[_0xc8be('0x6e')]+_0xc8be('0x98'),_0x3870fb[_0xc8be('0x99')],_0x3870fb[_0xc8be('0x9a')]);}else{_0x596c3b[_0xc8be('0x3f')](_0x32b758[_0xc8be('0x6e')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3870fb[_0xc8be('0x99')],_0x3870fb[_0xc8be('0x9a')]);}if(_0x34cdfe){logger[_0xc8be('0x9b')](_0xc8be('0x9c'),_0x596c3b['toString']());require('child_process')['fork'](path[_0xc8be('0x82')](__dirname,'../../components/export/',_0x34cdfe['output']),[_0x34cdfe['id'],_0x596c3b['toString'](),path[_0xc8be('0x82')](__dirname,'../../files/reports',_0x34cdfe[_0xc8be('0x9d')]),_0x28dd19]);return _0x34cdfe;}else{var _0x473864=squel[_0xc8be('0x9e')]();_0x473864[_0xc8be('0x8c')]('('+_0x596c3b[_0xc8be('0x7f')]()+')',_0xc8be('0x9f'));_0x473864[_0xc8be('0x68')](_0xc8be('0xa0'),_0xc8be('0x1f'));_0x596c3b[_0xc8be('0x1d')](_0x3870fb['limit']||_0x147cd7);_0x596c3b['offset'](_0x3870fb[_0xc8be('0x20')]||0x0);return dbH['sequelize'][_0xc8be('0x35')](_0x473864[_0xc8be('0x7f')](),{'type':dbH['sequelize'][_0xc8be('0x80')][_0xc8be('0x81')]})[_0xc8be('0x26')](function(_0x5e162c){if(!_0x5e162c['length']){_0x5a69ad=0x0;}else{_0x5a69ad=_0x5e162c[0x0][_0xc8be('0x1f')]||0x0;}return dbH[_0xc8be('0xa1')][_0xc8be('0x35')](_0x596c3b[_0xc8be('0x7f')](),{'type':dbH[_0xc8be('0xa1')][_0xc8be('0x80')][_0xc8be('0x81')]});})[_0xc8be('0x26')](function(_0x5d19fb){return{'rows':_0x5d19fb||[],'count':_0x5a69ad};});}});}exports[_0xc8be('0xa2')]=function(_0x135519,_0x39df69){return runReport(_0x135519['params'],_0x135519['query'],_0x135519['options'])[_0xc8be('0x26')](respondWithResult(_0x39df69,null))[_0xc8be('0x49')](handleError(_0x39df69,null));};exports['runReport']=runReport;exports[_0xc8be('0x35')]=function(_0x20eaeb,_0x5459a8){var _0x2832c3=0xa;var _0x20bea8=[_0xc8be('0x82'),_0xc8be('0x57'),_0xc8be('0x83'),_0xc8be('0x58')];var _0x58ed5f={'SUM':_0xc8be('0x84'),'COUNT':_0xc8be('0x59'),'COUNT DISTINCT':_0xc8be('0x5a'),'MAX':_0xc8be('0x5b'),'MIN':_0xc8be('0x85'),'AVG':_0xc8be('0x5c'),'GROUP_CONCAT':_0xc8be('0x86'),'GROUP_CONCAT ASC':_0xc8be('0x5d'),'GROUP_CONCAT DESC':_0xc8be('0x5e')};var _0x4b7ae5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc8be('0xa3'),'HOUR':'HOUR(%s)','ROUND':_0xc8be('0x5f'),'UNIX_TIMESTAMP':_0xc8be('0x60')};var _0x3738fb=function(_0x2d2f9e){return!_['includes']([_0xc8be('0x89'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2d2f9e);};var _0xb3f27a=function(_0x2f3c8c){if(!_0x2f3c8c||!_0x2f3c8c[_0xc8be('0x65')]['length']){return'';}for(var _0x1cbc3e='(',_0x494b15=0x0;_0x494b15<_0x2f3c8c[_0xc8be('0x65')][_0xc8be('0x3b')];_0x494b15+=0x1){_0x494b15>0x0&&(_0x1cbc3e+='\x20'+_0x2f3c8c[_0xc8be('0x66')]+'\x20');_0x1cbc3e+=_0x2f3c8c[_0xc8be('0x65')][_0x494b15]['group']?_0xb3f27a(_0x2f3c8c[_0xc8be('0x65')][_0x494b15][_0xc8be('0x67')]):_0x2f3c8c[_0xc8be('0x65')][_0x494b15][_0xc8be('0x68')]+'\x20'+_0x2f3c8c[_0xc8be('0x65')][_0x494b15]['condition']+(_0x3738fb(_0x2f3c8c[_0xc8be('0x65')][_0x494b15][_0xc8be('0x69')])?'\x20'+_0x2f3c8c[_0xc8be('0x65')][_0x494b15]['value']:'');}return _0x1cbc3e+')';};var _0x4d9b54={'where':{'id':_0x20eaeb[_0xc8be('0x4a')]['id']}},_0x2d16bc,_0xf1d11c,_0x383f81,_0xd992b1,_0x152bf1;_0x4d9b54=_[_0xc8be('0x44')]({},_0x4d9b54,_0x20eaeb[_0xc8be('0x45')]);return db['AnalyticCustomReport'][_0xc8be('0x55')](_0x4d9b54)[_0xc8be('0x26')](function(_0x2db12c){if(_0x2db12c){_0x2d16bc=_0x2db12c;return _0x2db12c[_0xc8be('0x6a')]();}return null;})[_0xc8be('0x26')](function(_0x512a8c){if(_0x512a8c){if(!_0x512a8c[_0xc8be('0x3b')]){throw new db[(_0xc8be('0x6b'))][(_0xc8be('0x6c'))](_0xc8be('0x8a'),0x193);}_0xf1d11c=_0x512a8c;return db[_0xc8be('0x6d')][_0xc8be('0x47')]({'raw':!![]});}return null;})[_0xc8be('0x26')](function(_0x24842c){if(_0x24842c){_0x383f81=_[_0xc8be('0x8b')](_0x24842c,'id');var _0x3fe10e;var _0x2a88c9=squel[_0xc8be('0x9e')]();_0x2a88c9['from'](_0x2d16bc[_0xc8be('0x6e')]);for(var _0x1e5e20=0x0;_0x1e5e20<_0xf1d11c[_0xc8be('0x3b')];_0x1e5e20+=0x1){_0x3fe10e=_0xf1d11c[_0x1e5e20]['MetricId']?_0x383f81[_0xf1d11c[_0x1e5e20][_0xc8be('0x6f')]][_0xc8be('0x8d')]:_0xf1d11c[_0x1e5e20][_0xc8be('0x68')];_0x3fe10e=_0xf1d11c[_0x1e5e20][_0xc8be('0x71')]?_[_0xc8be('0x70')](_0x58ed5f[_0xf1d11c[_0x1e5e20][_0xc8be('0x71')]],'%s',_0x3fe10e):_0x3fe10e;_0x3fe10e=_0xf1d11c[_0x1e5e20][_0xc8be('0x72')]?_[_0xc8be('0x70')](_0x4b7ae5[_0xf1d11c[_0x1e5e20]['format']],'%s',_0x3fe10e):_0x3fe10e;if(_0xf1d11c[_0x1e5e20][_0xc8be('0x73')]){_0x2a88c9[_0xc8be('0x67')](_0x3fe10e);}_0xf1d11c[_0x1e5e20]['orderBy']&&_0x2a88c9[_0xc8be('0x3d')](_0x3fe10e,_0xf1d11c[_0x1e5e20][_0xc8be('0x8e')]===_0xc8be('0x74')?![]:!![]);_0x2a88c9[_0xc8be('0x68')](_0x3fe10e,_0xf1d11c[_0x1e5e20]['alias']||_0x3fe10e);}if(_0x2d16bc[_0xc8be('0x76')]){_0x2d16bc[_0xc8be('0x76')]=JSON[_0xc8be('0x7c')](_0x2d16bc[_0xc8be('0x76')]);for(var _0x39f3fd=0x0;_0x39f3fd<_0x2d16bc['joins'][_0xc8be('0x3b')];_0x39f3fd+=0x1){if(_0x2d16bc['joins'][_0x39f3fd]['type']&&_[_0xc8be('0x61')](_0x20bea8,_0x2d16bc[_0xc8be('0x76')][_0x39f3fd][_0xc8be('0x32')])&&_0x2d16bc['joins'][_0x39f3fd][_0xc8be('0x77')]&&_0x2d16bc[_0xc8be('0x76')][_0x39f3fd][_0xc8be('0x78')]&&_0x2d16bc['joins'][_0x39f3fd][_0xc8be('0x7a')]){_0x2a88c9[_0x2d16bc['joins'][_0x39f3fd][_0xc8be('0x32')]](_0x2d16bc['joins'][_0x39f3fd]['foreignTable'],null,util[_0xc8be('0x72')](_0xc8be('0x79'),_0x2d16bc['table'],_0x2d16bc[_0xc8be('0x76')][_0x39f3fd]['parentKey'],_0x2d16bc[_0xc8be('0x76')][_0x39f3fd][_0xc8be('0x78')],_0x2d16bc[_0xc8be('0x76')][_0x39f3fd][_0xc8be('0x7a')]));}}}if(_0x2d16bc[_0xc8be('0x7b')]){_0x2d16bc['conditions']=JSON['parse'](_0x2d16bc[_0xc8be('0x7b')]);_0x2a88c9[_0xc8be('0x3f')](_0xb3f27a(_0x2d16bc[_0xc8be('0x7b')][_0xc8be('0x67')]));}_0x152bf1=_0x2a88c9[_0xc8be('0x7d')]();_0x2a88c9['limit'](_0x2832c3);_0x2a88c9[_0xc8be('0x20')](0x0);logger['debug'](_0xc8be('0x7e'),_0x2a88c9['toString']());return dbH['sequelize'][_0xc8be('0x35')](_0x2a88c9[_0xc8be('0x7f')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0xc8be('0x26')](function(){return{'sql':_0x152bf1[_0xc8be('0x7f')]()};})[_0xc8be('0x26')](respondWithResult(_0x5459a8,null))[_0xc8be('0x49')](handleError(_0x5459a8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index cdf6e96..597cd9b 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 _0xbb3d=['path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2cc74b,_0x29ab49){var _0x44213c=function(_0x38cf75){while(--_0x38cf75){_0x2cc74b['push'](_0x2cc74b['shift']());}};_0x44213c(++_0x29ab49);}(_0xbb3d,0x132));var _0xdbb3=function(_0x4dac30,_0x3b1e61){_0x4dac30=_0x4dac30-0x0;var _0x4ae741=_0xbb3d[_0x4dac30];return _0x4ae741;};'use strict';var _=require(_0xdbb3('0x0'));var util=require('util');var logger=require(_0xdbb3('0x1'))(_0xdbb3('0x2'));var moment=require(_0xdbb3('0x3'));var BPromise=require(_0xdbb3('0x4'));var rp=require(_0xdbb3('0x5'));var fs=require('fs');var path=require(_0xdbb3('0x6'));var rimraf=require(_0xdbb3('0x7'));var config=require('../../config/environment');var attributes=require(_0xdbb3('0x8'));module[_0xdbb3('0x9')]=function(_0x3f212e,_0xb6a001){return _0x3f212e[_0xdbb3('0xa')](_0xdbb3('0xb'),attributes,{'tableName':_0xdbb3('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f78=['request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4c028a,_0x374103){var _0xf118a7=function(_0x3ab377){while(--_0x3ab377){_0x4c028a['push'](_0x4c028a['shift']());}};_0xf118a7(++_0x374103);}(_0x9f78,0x97));var _0x89f7=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0x9f78[_0x3a7634];return _0x23bbe9;};'use strict';var _=require(_0x89f7('0x0'));var util=require('util');var logger=require(_0x89f7('0x1'))(_0x89f7('0x2'));var moment=require(_0x89f7('0x3'));var BPromise=require(_0x89f7('0x4'));var rp=require(_0x89f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89f7('0x6'));var config=require(_0x89f7('0x7'));var attributes=require(_0x89f7('0x8'));module[_0x89f7('0x9')]=function(_0x13bdbf,_0x33c68e){return _0x13bdbf[_0x89f7('0xa')](_0x89f7('0xb'),attributes,{'tableName':_0x89f7('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 2fdafb0..10c1688 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 _0xb63f=['http','request','then','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x504b79,_0x4115b0){var _0x10f21a=function(_0x36dcb9){while(--_0x36dcb9){_0x504b79['push'](_0x504b79['shift']());}};_0x10f21a(++_0x4115b0);}(_0xb63f,0xb5));var _0xfb63=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0xb63f[_0x27a3cb];return _0x54ff38;};'use strict';var _=require(_0xfb63('0x0'));var util=require(_0xfb63('0x1'));var moment=require(_0xfb63('0x2'));var BPromise=require(_0xfb63('0x3'));var rs=require(_0xfb63('0x4'));var fs=require('fs');var Redis=require(_0xfb63('0x5'));var db=require(_0xfb63('0x6'))['db'];var utils=require(_0xfb63('0x7'));var logger=require('../../config/logger')(_0xfb63('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb63('0x9'));var client=jayson[_0xfb63('0xa')][_0xfb63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f37e4,_0x8b59fa,_0x19b167){return new BPromise(function(_0x2f9e19,_0x2ae4ba){return client[_0xfb63('0xc')](_0x1f37e4,_0x19b167)[_0xfb63('0xd')](function(_0x4590e2){logger[_0xfb63('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x8b59fa,'request\x20sent');logger[_0xfb63('0xf')](_0xfb63('0x10'),_0x8b59fa,_0xfb63('0x11'),JSON[_0xfb63('0x12')](_0x4590e2));if(_0x4590e2[_0xfb63('0x13')]){if(_0x4590e2['error'][_0xfb63('0x14')]===0x1f4){logger[_0xfb63('0x13')](_0xfb63('0x15'),_0x8b59fa,_0x4590e2[_0xfb63('0x13')][_0xfb63('0x16')]);return _0x2ae4ba(_0x4590e2[_0xfb63('0x13')][_0xfb63('0x16')]);}logger[_0xfb63('0x13')](_0xfb63('0x15'),_0x8b59fa,_0x4590e2['error']['message']);return _0x2f9e19(_0x4590e2[_0xfb63('0x13')][_0xfb63('0x16')]);}else{logger[_0xfb63('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x8b59fa,_0xfb63('0x11'));_0x2f9e19(_0x4590e2['result']['message']);}})[_0xfb63('0x17')](function(_0x26e7b3){logger[_0xfb63('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x8b59fa,_0x26e7b3);_0x2ae4ba(_0x26e7b3);});});} \ No newline at end of file +var _0x4cda=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','error','AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0x3ee91e,_0x466a5a){var _0x239405=function(_0x3f2d09){while(--_0x3f2d09){_0x3ee91e['push'](_0x3ee91e['shift']());}};_0x239405(++_0x466a5a);}(_0x4cda,0x86));var _0xa4cd=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4cda[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xa4cd('0x0'));var util=require('util');var moment=require(_0xa4cd('0x1'));var BPromise=require(_0xa4cd('0x2'));var rs=require(_0xa4cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa4cd('0x4'));var logger=require(_0xa4cd('0x5'))(_0xa4cd('0x6'));var config=require(_0xa4cd('0x7'));var jayson=require(_0xa4cd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30c845,_0x569074,_0x46a1fe){return new BPromise(function(_0x2663fc,_0x5aea0c){return client[_0xa4cd('0x9')](_0x30c845,_0x46a1fe)['then'](function(_0x9cfc8f){logger[_0xa4cd('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x569074,_0xa4cd('0xb'));logger[_0xa4cd('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x569074,'request\x20sent',JSON['stringify'](_0x9cfc8f));if(_0x9cfc8f['error']){if(_0x9cfc8f[_0xa4cd('0xd')]['code']===0x1f4){logger[_0xa4cd('0xd')](_0xa4cd('0xe'),_0x569074,_0x9cfc8f[_0xa4cd('0xd')][_0xa4cd('0xf')]);return _0x5aea0c(_0x9cfc8f['error'][_0xa4cd('0xf')]);}logger['error'](_0xa4cd('0xe'),_0x569074,_0x9cfc8f['error'][_0xa4cd('0xf')]);return _0x2663fc(_0x9cfc8f['error']['message']);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x569074,'request\x20sent');_0x2663fc(_0x9cfc8f[_0xa4cd('0x10')]['message']);}})['catch'](function(_0x2c3f8d){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x569074,_0x2c3f8d);_0x5aea0c(_0x2c3f8d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 1181008..6205bc1 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 _0x7383=['get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3cc69f,_0x7eb3f3){var _0x3f8719=function(_0x893a0f){while(--_0x893a0f){_0x3cc69f['push'](_0x3cc69f['shift']());}};_0x3f8719(++_0x7eb3f3);}(_0x7383,0xb1));var _0x3738=function(_0x3cd41d,_0x1bc2ec){_0x3cd41d=_0x3cd41d-0x0;var _0x535d9e=_0x7383[_0x3cd41d];return _0x535d9e;};'use strict';var multer=require(_0x3738('0x0'));var util=require(_0x3738('0x1'));var path=require(_0x3738('0x2'));var timeout=require(_0x3738('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3738('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3738('0x5'));var config=require(_0x3738('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x3738('0x7')]('/',auth[_0x3738('0x8')](),controller[_0x3738('0x9')]);router[_0x3738('0x7')](_0x3738('0xa'),auth[_0x3738('0x8')](),controller[_0x3738('0xb')]);router[_0x3738('0x7')](_0x3738('0xc'),auth['isAuthenticated'](),controller[_0x3738('0xd')]);router['get'](_0x3738('0xe'),auth[_0x3738('0x8')](),controller['run']);router[_0x3738('0x7')](_0x3738('0xf'),auth[_0x3738('0x8')](),controller[_0x3738('0x10')]);router[_0x3738('0x11')]('/',auth[_0x3738('0x8')](),controller[_0x3738('0x12')]);router[_0x3738('0x13')](_0x3738('0xa'),auth['isAuthenticated'](),controller[_0x3738('0x14')]);router[_0x3738('0x15')](_0x3738('0xa'),auth[_0x3738('0x8')](),controller[_0x3738('0x16')]);module['exports']=router; \ No newline at end of file +var _0xca52=['index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xca52,0x1be));var _0x2ca5=function(_0x2c2e25,_0x5a8652){_0x2c2e25=_0x2c2e25-0x0;var _0x5aadd7=_0xca52[_0x2c2e25];return _0x5aadd7;};'use strict';var multer=require('multer');var util=require(_0x2ca5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2ca5('0x1'));var router=express[_0x2ca5('0x2')]();var fs_extra=require(_0x2ca5('0x3'));var auth=require(_0x2ca5('0x4'));var interaction=require(_0x2ca5('0x5'));var config=require(_0x2ca5('0x6'));var controller=require(_0x2ca5('0x7'));router[_0x2ca5('0x8')]('/',auth[_0x2ca5('0x9')](),controller[_0x2ca5('0xa')]);router[_0x2ca5('0x8')](_0x2ca5('0xb'),auth['isAuthenticated'](),controller[_0x2ca5('0xc')]);router[_0x2ca5('0x8')](_0x2ca5('0xd'),auth[_0x2ca5('0x9')](),controller[_0x2ca5('0xe')]);router[_0x2ca5('0x8')](_0x2ca5('0xf'),auth[_0x2ca5('0x9')](),controller[_0x2ca5('0x10')]);router[_0x2ca5('0x8')]('/:id/query',auth['isAuthenticated'](),controller[_0x2ca5('0x11')]);router[_0x2ca5('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2ca5('0x13')](_0x2ca5('0xb'),auth['isAuthenticated'](),controller[_0x2ca5('0x14')]);router[_0x2ca5('0x15')](_0x2ca5('0xb'),auth[_0x2ca5('0x9')](),controller[_0x2ca5('0x16')]);module[_0x2ca5('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 87e375e..9ffd8ef 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 _0x687b=['STRING','TEXT','sequelize','exports'];(function(_0x8d6ae0,_0x34531a){var _0x502eef=function(_0x1b5987){while(--_0x1b5987){_0x8d6ae0['push'](_0x8d6ae0['shift']());}};_0x502eef(++_0x34531a);}(_0x687b,0x14a));var _0xb687=function(_0x564523,_0x5db1c8){_0x564523=_0x564523-0x0;var _0x404d2a=_0x687b[_0x564523];return _0x404d2a;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb687('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xb687('0x3')]},'joins':{'type':Sequelize[_0xb687('0x3')]}}; \ No newline at end of file +var _0x5d17=['sequelize','exports','STRING','TEXT'];(function(_0x1f2359,_0x628c12){var _0x2eeba8=function(_0x2624bf){while(--_0x2624bf){_0x1f2359['push'](_0x1f2359['shift']());}};_0x2eeba8(++_0x628c12);}(_0x5d17,0x114));var _0x75d1=function(_0x15af0f,_0x5454ce){_0x15af0f=_0x15af0f-0x0;var _0x2bd1cb=_0x5d17[_0x15af0f];return _0x2bd1cb;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x75d1('0x2')]},'table':{'type':Sequelize[_0x75d1('0x2')]},'conditions':{'type':Sequelize[_0x75d1('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 4f5e919..d2385e8 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 _0xdc97=['startDate','toString','../../components/export/','savename','COUNT(*)','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','DefaultReports','UserProfileResource','error','stack','name','map','AnalyticDefaultReport','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','condition','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','join','SUM(%s)','COUNT(%s)','value','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','clone','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','default','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc97,0x13b));var _0x7dc9=function(_0x4193c6,_0x191424){_0x4193c6=_0x4193c6-0x0;var _0xf64d0a=_0xdc97[_0x4193c6];return _0xf64d0a;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x7dc9('0x16')];function respondWithStatusCode(_0x14e5db,_0x5c6ca5){_0x5c6ca5=_0x5c6ca5||0xcc;return function(_0xbd06be){if(_0xbd06be){return _0x14e5db[_0x7dc9('0x17')](_0x5c6ca5);}return _0x14e5db[_0x7dc9('0x18')](_0x5c6ca5)[_0x7dc9('0x19')]();};}function respondWithResult(_0x31d43d,_0x11af93){_0x11af93=_0x11af93||0xc8;return function(_0x524d09){if(_0x524d09){return _0x31d43d[_0x7dc9('0x18')](_0x11af93)[_0x7dc9('0x1a')](_0x524d09);}};}function respondWithFilteredResult(_0x1b0aa1,_0x442819){return function(_0x11606f){if(_0x11606f){var _0xbe0437=typeof _0x442819[_0x7dc9('0x1b')]===_0x7dc9('0x1c')&&typeof _0x442819[_0x7dc9('0x1d')]==='undefined';var _0x22577e=_0x11606f['count'];var _0x1f5906=_0xbe0437?0x0:_0x442819[_0x7dc9('0x1b')];var _0x5d61d7=_0xbe0437?_0x11606f[_0x7dc9('0x1e')]:_0x442819[_0x7dc9('0x1b')]+_0x442819[_0x7dc9('0x1d')];var _0x4b2703;if(_0x5d61d7>=_0x22577e){_0x5d61d7=_0x22577e;_0x4b2703=0xc8;}else{_0x4b2703=0xce;}_0x1b0aa1[_0x7dc9('0x18')](_0x4b2703);return _0x1b0aa1[_0x7dc9('0x1f')](_0x7dc9('0x20'),_0x1f5906+'-'+_0x5d61d7+'/'+_0x22577e)[_0x7dc9('0x1a')](_0x11606f);}return null;};}function patchUpdates(_0x155cc4){return function(_0x2b38d6){try{jsonpatch['apply'](_0x2b38d6,_0x155cc4,!![]);}catch(_0x593e60){return BPromise[_0x7dc9('0x21')](_0x593e60);}return _0x2b38d6[_0x7dc9('0x22')]();};}function saveUpdates(_0x596e0f,_0x349001){return function(_0x27f7fa){if(_0x27f7fa){return _0x27f7fa['update'](_0x596e0f)[_0x7dc9('0x23')](function(_0x43d31f){return _0x43d31f;});}return null;};}function removeEntity(_0x41110a,_0x4906b1){return function(_0x424763){if(_0x424763){return _0x424763[_0x7dc9('0x24')]()[_0x7dc9('0x23')](function(){var _0x55a482=_0x424763['get']({'plain':!![]});var _0x4b9ba6=_0x7dc9('0x25');return db[_0x7dc9('0x26')]['destroy']({'where':{'type':_0x4b9ba6,'resourceId':_0x55a482['id']}})['then'](function(){return _0x424763;});})[_0x7dc9('0x23')](function(){_0x41110a['status'](0xcc)[_0x7dc9('0x19')]();});}};}function handleEntityNotFound(_0x1c690b,_0x3a74a0){return function(_0x3e4102){if(!_0x3e4102){_0x1c690b[_0x7dc9('0x17')](0x194);}return _0x3e4102;};}function handleError(_0x450124,_0x236d42){_0x236d42=_0x236d42||0x1f4;return function(_0x229f8e){logger[_0x7dc9('0x27')](_0x229f8e[_0x7dc9('0x28')]);if(_0x229f8e[_0x7dc9('0x29')]){delete _0x229f8e[_0x7dc9('0x29')];}_0x450124['status'](_0x236d42)['send'](_0x229f8e);};}exports['index']=function(_0x49a4a5,_0x4a68f0){var _0x553a03={},_0x58c4e8={},_0x59f5d8={'count':0x0,'rows':[]};var _0x4463dc=_[_0x7dc9('0x2a')](db[_0x7dc9('0x2b')][_0x7dc9('0x2c')],function(_0x3300ff){return{'name':_0x3300ff[_0x7dc9('0x2d')],'type':_0x3300ff['type']['key']};});_0x58c4e8['model']=_[_0x7dc9('0x2a')](_0x4463dc,'name');_0x58c4e8[_0x7dc9('0x2e')]=_[_0x7dc9('0x2f')](_0x49a4a5[_0x7dc9('0x2e')]);_0x58c4e8[_0x7dc9('0x30')]=_[_0x7dc9('0x31')](_0x58c4e8[_0x7dc9('0x32')],_0x58c4e8[_0x7dc9('0x2e')]);_0x553a03[_0x7dc9('0x33')]=_['intersection'](_0x58c4e8[_0x7dc9('0x32')],qs['fields'](_0x49a4a5[_0x7dc9('0x2e')][_0x7dc9('0x34')]));_0x553a03[_0x7dc9('0x33')]=_0x553a03[_0x7dc9('0x33')]['length']?_0x553a03[_0x7dc9('0x33')]:_0x58c4e8['model'];if(!_0x49a4a5[_0x7dc9('0x2e')]['hasOwnProperty']('nolimit')){_0x553a03[_0x7dc9('0x1d')]=qs[_0x7dc9('0x1d')](_0x49a4a5[_0x7dc9('0x2e')][_0x7dc9('0x1d')]);_0x553a03['offset']=qs[_0x7dc9('0x1b')](_0x49a4a5[_0x7dc9('0x2e')][_0x7dc9('0x1b')]);}_0x553a03[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x49a4a5[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x553a03[_0x7dc9('0x37')]=qs[_0x7dc9('0x30')](_[_0x7dc9('0x38')](_0x49a4a5[_0x7dc9('0x2e')],_0x58c4e8[_0x7dc9('0x30')]),_0x4463dc);if(_0x49a4a5['query'][_0x7dc9('0x39')]){_0x553a03[_0x7dc9('0x37')]=_[_0x7dc9('0x3a')](_0x553a03[_0x7dc9('0x37')],{'$or':_['map'](_0x4463dc,function(_0x3492e6){if(_0x3492e6[_0x7dc9('0x3b')]!==_0x7dc9('0x3c')){var _0x3876b6={};_0x3876b6[_0x3492e6[_0x7dc9('0x29')]]={'$like':'%'+_0x49a4a5[_0x7dc9('0x2e')]['filter']+'%'};return _0x3876b6;}})});}_0x553a03=_['merge']({},_0x553a03,_0x49a4a5[_0x7dc9('0x3d')]);var _0x36a965={'where':_0x553a03['where']};return db[_0x7dc9('0x2b')]['count'](_0x36a965)[_0x7dc9('0x23')](function(_0x2a91fe){_0x59f5d8[_0x7dc9('0x1e')]=_0x2a91fe;if(_0x49a4a5['query'][_0x7dc9('0x3e')]){_0x553a03[_0x7dc9('0x3f')]=[{'all':!![]}];}return db[_0x7dc9('0x2b')][_0x7dc9('0x40')](_0x553a03);})[_0x7dc9('0x23')](function(_0x23499a){_0x59f5d8[_0x7dc9('0x41')]=_0x23499a;return _0x59f5d8;})['then'](respondWithFilteredResult(_0x4a68f0,_0x553a03))[_0x7dc9('0x42')](handleError(_0x4a68f0,null));};exports['show']=function(_0x52d883,_0xcced6c){var _0x294276={'raw':!![],'where':{'id':_0x52d883[_0x7dc9('0x43')]['id']}},_0x18c8a1={};_0x18c8a1[_0x7dc9('0x32')]=_[_0x7dc9('0x2f')](db[_0x7dc9('0x2b')][_0x7dc9('0x2c')]);_0x18c8a1[_0x7dc9('0x2e')]=_['keys'](_0x52d883[_0x7dc9('0x2e')]);_0x18c8a1[_0x7dc9('0x30')]=_[_0x7dc9('0x31')](_0x18c8a1[_0x7dc9('0x32')],_0x18c8a1[_0x7dc9('0x2e')]);_0x294276[_0x7dc9('0x33')]=_['intersection'](_0x18c8a1[_0x7dc9('0x32')],qs[_0x7dc9('0x34')](_0x52d883['query'][_0x7dc9('0x34')]));_0x294276[_0x7dc9('0x33')]=_0x294276[_0x7dc9('0x33')]['length']?_0x294276[_0x7dc9('0x33')]:_0x18c8a1['model'];if(_0x52d883['query'][_0x7dc9('0x3e')]){_0x294276[_0x7dc9('0x3f')]=[{'all':!![]}];}_0x294276=_[_0x7dc9('0x3a')]({},_0x294276,_0x52d883['options']);return db['AnalyticDefaultReport'][_0x7dc9('0x44')](_0x294276)['then'](handleEntityNotFound(_0xcced6c,null))[_0x7dc9('0x23')](respondWithResult(_0xcced6c,null))[_0x7dc9('0x42')](handleError(_0xcced6c,null));};exports['create']=function(_0x24ccce,_0x1d6c0a){return db[_0x7dc9('0x2b')][_0x7dc9('0x45')](_0x24ccce[_0x7dc9('0x46')],{})[_0x7dc9('0x23')](function(_0x86739f){var _0x3a1102=_0x24ccce[_0x7dc9('0x47')][_0x7dc9('0x48')]({'plain':!![]});if(!_0x3a1102)throw new Error(_0x7dc9('0x49'));if(_0x3a1102[_0x7dc9('0x4a')]===_0x7dc9('0x47')){var _0x59be9b=_0x86739f[_0x7dc9('0x48')]({'plain':!![]});var _0x4fcfd5='Reports';return db[_0x7dc9('0x4b')][_0x7dc9('0x44')]({'where':{'name':_0x4fcfd5,'userProfileId':_0x3a1102[_0x7dc9('0x4c')]},'raw':!![]})[_0x7dc9('0x23')](function(_0x346d27){if(_0x346d27&&_0x346d27['autoAssociation']===0x0){return db[_0x7dc9('0x26')][_0x7dc9('0x45')]({'name':_0x59be9b[_0x7dc9('0x29')],'resourceId':_0x59be9b['id'],'type':'DefaultReports','sectionId':_0x346d27['id']},{})[_0x7dc9('0x23')](function(){return _0x86739f;});}else{return _0x86739f;}})[_0x7dc9('0x42')](function(_0x2cf133){logger[_0x7dc9('0x27')](_0x7dc9('0x4d'),_0x2cf133);throw _0x2cf133;});}return _0x86739f;})[_0x7dc9('0x23')](respondWithResult(_0x1d6c0a,0xc9))['catch'](handleError(_0x1d6c0a,null));};exports[_0x7dc9('0x4e')]=function(_0x2ecc80,_0x2b0941){if(_0x2ecc80[_0x7dc9('0x46')]['id']){delete _0x2ecc80[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x2b')][_0x7dc9('0x44')]({'where':{'id':_0x2ecc80[_0x7dc9('0x43')]['id']}})[_0x7dc9('0x23')](handleEntityNotFound(_0x2b0941,null))[_0x7dc9('0x23')](saveUpdates(_0x2ecc80[_0x7dc9('0x46')],null))[_0x7dc9('0x23')](respondWithResult(_0x2b0941,null))['catch'](handleError(_0x2b0941,null));};exports[_0x7dc9('0x24')]=function(_0x39be46,_0x38df9a){return db[_0x7dc9('0x2b')][_0x7dc9('0x44')]({'where':{'id':_0x39be46['params']['id']}})[_0x7dc9('0x23')](handleEntityNotFound(_0x38df9a,null))[_0x7dc9('0x23')](removeEntity(_0x38df9a,null))[_0x7dc9('0x42')](handleError(_0x38df9a,null));};exports[_0x7dc9('0x4f')]=function(_0x2a1db8,_0x2f01a0){var _0x495a06=0xa;var _0x547caa=['join',_0x7dc9('0x50'),_0x7dc9('0x51'),_0x7dc9('0x52')];var _0x2afefc={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7dc9('0x53'),'MAX':_0x7dc9('0x54'),'MIN':_0x7dc9('0x55'),'AVG':_0x7dc9('0x56'),'GROUP_CONCAT':_0x7dc9('0x57'),'GROUP_CONCAT ASC':_0x7dc9('0x58'),'GROUP_CONCAT DESC':_0x7dc9('0x59')};var _0x4905f6={'SEC_TO_TIME':_0x7dc9('0x5a'),'DATE':_0x7dc9('0x5b'),'HOUR':_0x7dc9('0x5c'),'ROUND':_0x7dc9('0x5d'),'UNIX_TIMESTAMP':_0x7dc9('0x5e')};var _0x4bbf8b=function(_0x175858){return!_[_0x7dc9('0x5f')]([_0x7dc9('0x60'),_0x7dc9('0x61'),_0x7dc9('0x62'),_0x7dc9('0x63')],_0x175858);};var _0x286ac5=function(_0x2a02ed){if(!_0x2a02ed||!_0x2a02ed[_0x7dc9('0x64')][_0x7dc9('0x65')]){return'';}for(var _0x19c209='(',_0xf3ae59=0x0;_0xf3ae59<_0x2a02ed[_0x7dc9('0x64')]['length'];_0xf3ae59+=0x1){_0xf3ae59>0x0&&(_0x19c209+='\x20'+_0x2a02ed[_0x7dc9('0x66')]+'\x20');_0x19c209+=_0x2a02ed['rules'][_0xf3ae59][_0x7dc9('0x67')]?_0x286ac5(_0x2a02ed[_0x7dc9('0x64')][_0xf3ae59]['group']):_0x2a02ed[_0x7dc9('0x64')][_0xf3ae59][_0x7dc9('0x68')]+'\x20'+_0x2a02ed['rules'][_0xf3ae59][_0x7dc9('0x69')]+(_0x4bbf8b(_0x2a02ed[_0x7dc9('0x64')][_0xf3ae59][_0x7dc9('0x69')])?'\x20'+_0x2a02ed['rules'][_0xf3ae59]['value']:'');}return _0x19c209+')';};var _0x205d01={'where':{'id':_0x2a1db8[_0x7dc9('0x43')]['id']}},_0x366d4d,_0x4ed60e,_0x3aba59,_0x15d02f,_0x2bbf61;_0x205d01=_[_0x7dc9('0x3a')]({},_0x205d01,_0x2a1db8[_0x7dc9('0x3d')]);return db['AnalyticDefaultReport'][_0x7dc9('0x44')](_0x205d01)[_0x7dc9('0x23')](function(_0x3f81dd){if(_0x3f81dd){_0x366d4d=_0x3f81dd;return _0x3f81dd['getFields']();}return null;})['then'](function(_0x1b2369){if(_0x1b2369){if(!_0x1b2369[_0x7dc9('0x65')]){throw new db[(_0x7dc9('0x6a'))][(_0x7dc9('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ed60e=_0x1b2369;return db['AnalyticMetric'][_0x7dc9('0x40')]({'raw':!![]});}return null;})[_0x7dc9('0x23')](function(_0x25f8b3){if(_0x25f8b3){_0x3aba59=_[_0x7dc9('0x6c')](_0x25f8b3,'id');var _0x5d211b;var _0xea1728=squel[_0x7dc9('0x6d')]();_0xea1728[_0x7dc9('0x6e')](_0x366d4d[_0x7dc9('0x6f')]);for(var _0x19e0b1=0x0;_0x19e0b1<_0x4ed60e[_0x7dc9('0x65')];_0x19e0b1+=0x1){_0x5d211b=_0x4ed60e[_0x19e0b1][_0x7dc9('0x70')]?_0x3aba59[_0x4ed60e[_0x19e0b1]['MetricId']][_0x7dc9('0x71')]:_0x4ed60e[_0x19e0b1][_0x7dc9('0x68')];_0x5d211b=_0x4ed60e[_0x19e0b1]['function']?_['replace'](_0x2afefc[_0x4ed60e[_0x19e0b1][_0x7dc9('0x72')]],'%s',_0x5d211b):_0x5d211b;_0x5d211b=_0x4ed60e[_0x19e0b1]['format']?_[_0x7dc9('0x73')](_0x4905f6[_0x4ed60e[_0x19e0b1][_0x7dc9('0x74')]],'%s',_0x5d211b):_0x5d211b;if(_0x4ed60e[_0x19e0b1][_0x7dc9('0x75')]){_0xea1728[_0x7dc9('0x67')](_0x5d211b);}_0x4ed60e[_0x19e0b1][_0x7dc9('0x76')]&&_0xea1728[_0x7dc9('0x35')](_0x5d211b,_0x4ed60e[_0x19e0b1][_0x7dc9('0x76')]===_0x7dc9('0x77')?![]:!![]);_0xea1728[_0x7dc9('0x68')](_0x5d211b,_0x4ed60e[_0x19e0b1][_0x7dc9('0x78')]||_0x5d211b);}if(_0x366d4d['joins']){_0x366d4d[_0x7dc9('0x79')]=JSON[_0x7dc9('0x7a')](_0x366d4d[_0x7dc9('0x79')]);for(var _0x499393=0x0;_0x499393<_0x366d4d[_0x7dc9('0x79')]['length'];_0x499393+=0x1){if(_0x366d4d['joins'][_0x499393][_0x7dc9('0x3b')]&&_[_0x7dc9('0x5f')](_0x547caa,_0x366d4d['joins'][_0x499393][_0x7dc9('0x3b')])&&_0x366d4d['joins'][_0x499393]['parentKey']&&_0x366d4d[_0x7dc9('0x79')][_0x499393][_0x7dc9('0x7b')]&&_0x366d4d[_0x7dc9('0x79')][_0x499393][_0x7dc9('0x7c')]){_0xea1728[_0x366d4d['joins'][_0x499393][_0x7dc9('0x3b')]](_0x366d4d[_0x7dc9('0x79')][_0x499393][_0x7dc9('0x7b')],null,util[_0x7dc9('0x74')](_0x7dc9('0x7d'),_0x366d4d[_0x7dc9('0x6f')],_0x366d4d[_0x7dc9('0x79')][_0x499393][_0x7dc9('0x7e')],_0x366d4d['joins'][_0x499393]['foreignTable'],_0x366d4d[_0x7dc9('0x79')][_0x499393]['foreignKey']));}}}if(_0x366d4d[_0x7dc9('0x7f')]){_0x366d4d[_0x7dc9('0x7f')]=JSON[_0x7dc9('0x7a')](_0x366d4d[_0x7dc9('0x7f')]);_0xea1728['where'](_0x286ac5(_0x366d4d[_0x7dc9('0x7f')][_0x7dc9('0x67')]));}_0x2bbf61=_0xea1728['clone']();_0xea1728[_0x7dc9('0x1d')](_0x495a06);_0xea1728[_0x7dc9('0x1b')](0x0);logger[_0x7dc9('0x80')](_0x7dc9('0x81'),_0xea1728['toString']());return dbH[_0x7dc9('0x82')][_0x7dc9('0x2e')](_0xea1728['toString'](),{'type':dbH['sequelize'][_0x7dc9('0x83')][_0x7dc9('0x84')]});}})['then'](respondWithResult(_0x2f01a0,null))[_0x7dc9('0x42')](handleError(_0x2f01a0,null));};function runReport(_0x5f08f6,_0x2e7296,_0x1d0722){var _0x1acdba=_0x2e7296['name'];var _0x33d68c=0xa;var _0x3c7daf=[_0x7dc9('0x85'),'left_join',_0x7dc9('0x51'),'cross_join'];var _0x5761cb={'SUM':_0x7dc9('0x86'),'COUNT':_0x7dc9('0x87'),'COUNT DISTINCT':_0x7dc9('0x53'),'MAX':_0x7dc9('0x54'),'MIN':_0x7dc9('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7dc9('0x57'),'GROUP_CONCAT ASC':_0x7dc9('0x58'),'GROUP_CONCAT DESC':_0x7dc9('0x59')};var _0x2dc92e={'SEC_TO_TIME':_0x7dc9('0x5a'),'DATE':'DATE(%s)','HOUR':_0x7dc9('0x5c'),'ROUND':_0x7dc9('0x5d'),'UNIX_TIMESTAMP':_0x7dc9('0x5e')};var _0x200df7=function(_0x53c992){return!_[_0x7dc9('0x5f')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x7dc9('0x62'),'IS\x20NOT\x20EMPTY'],_0x53c992);};var _0x21da79=function(_0x476a24){if(!_0x476a24||!_0x476a24[_0x7dc9('0x64')][_0x7dc9('0x65')]){return'';}for(var _0x38dccc='(',_0xc716c3=0x0;_0xc716c3<_0x476a24['rules'][_0x7dc9('0x65')];_0xc716c3+=0x1){_0xc716c3>0x0&&(_0x38dccc+='\x20'+_0x476a24[_0x7dc9('0x66')]+'\x20');_0x38dccc+=_0x476a24[_0x7dc9('0x64')][_0xc716c3][_0x7dc9('0x67')]?_0x21da79(_0x476a24[_0x7dc9('0x64')][_0xc716c3]['group']):_0x476a24[_0x7dc9('0x64')][_0xc716c3]['field']+'\x20'+_0x476a24[_0x7dc9('0x64')][_0xc716c3][_0x7dc9('0x69')]+(_0x200df7(_0x476a24[_0x7dc9('0x64')][_0xc716c3]['condition'])?'\x20'+_0x476a24[_0x7dc9('0x64')][_0xc716c3][_0x7dc9('0x88')]:'');}return _0x38dccc+')';};var _0x5e8806={'where':{'id':_0x5f08f6['id']}},_0x1a9c7e,_0x3f8839,_0xf74b6,_0x2b3d46,_0x5c466d;_0x5e8806=_[_0x7dc9('0x3a')]({},_0x5e8806,_0x1d0722);return db['AnalyticDefaultReport'][_0x7dc9('0x44')](_0x5e8806)[_0x7dc9('0x23')](function(_0x3e06b3){if(_0x3e06b3){_0x1a9c7e=_0x3e06b3;return _0x3e06b3['getFields']();}return null;})[_0x7dc9('0x23')](function(_0x4588a7){if(_0x4588a7){if(!_0x4588a7[_0x7dc9('0x65')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7dc9('0x89'),0x193);}_0x3f8839=_0x4588a7;return db[_0x7dc9('0x8a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0xb0c228){if(_0xb0c228){_0xf74b6=_[_0x7dc9('0x6c')](_0xb0c228,'id');var _0x5f3487;var _0x29c228=squel['select']();_0x29c228[_0x7dc9('0x6e')](_0x1a9c7e[_0x7dc9('0x6f')]);for(var _0x235473=0x0;_0x235473<_0x3f8839[_0x7dc9('0x65')];_0x235473+=0x1){_0x5f3487=_0x3f8839[_0x235473][_0x7dc9('0x70')]?_0xf74b6[_0x3f8839[_0x235473][_0x7dc9('0x70')]]['metric']:_0x3f8839[_0x235473][_0x7dc9('0x68')];_0x5f3487=_0x3f8839[_0x235473][_0x7dc9('0x72')]?_[_0x7dc9('0x73')](_0x5761cb[_0x3f8839[_0x235473][_0x7dc9('0x72')]],'%s',_0x5f3487):_0x5f3487;_0x5f3487=_0x3f8839[_0x235473][_0x7dc9('0x74')]?_['replace'](_0x2dc92e[_0x3f8839[_0x235473][_0x7dc9('0x74')]],'%s',_0x5f3487):_0x5f3487;if(_0x3f8839[_0x235473][_0x7dc9('0x75')]){_0x29c228[_0x7dc9('0x67')](_0x5f3487);}_0x3f8839[_0x235473][_0x7dc9('0x76')]&&_0x29c228['order'](_0x5f3487,_0x3f8839[_0x235473][_0x7dc9('0x76')]===_0x7dc9('0x77')?![]:!![]);_0x29c228['field'](_0x5f3487,_0x3f8839[_0x235473][_0x7dc9('0x78')]||_0x5f3487);}if(_0x1a9c7e['joins']){_0x1a9c7e[_0x7dc9('0x79')]=JSON[_0x7dc9('0x7a')](_0x1a9c7e[_0x7dc9('0x79')]);for(var _0x4173c2=0x0;_0x4173c2<_0x1a9c7e[_0x7dc9('0x79')][_0x7dc9('0x65')];_0x4173c2+=0x1){if(_0x1a9c7e[_0x7dc9('0x79')][_0x4173c2][_0x7dc9('0x3b')]&&_['includes'](_0x3c7daf,_0x1a9c7e[_0x7dc9('0x79')][_0x4173c2][_0x7dc9('0x3b')])&&_0x1a9c7e[_0x7dc9('0x79')][_0x4173c2][_0x7dc9('0x7e')]&&_0x1a9c7e[_0x7dc9('0x79')][_0x4173c2]['foreignTable']&&_0x1a9c7e[_0x7dc9('0x79')][_0x4173c2][_0x7dc9('0x7c')]){_0x29c228[_0x1a9c7e[_0x7dc9('0x79')][_0x4173c2][_0x7dc9('0x3b')]](_0x1a9c7e['joins'][_0x4173c2][_0x7dc9('0x7b')],null,util['format'](_0x7dc9('0x7d'),_0x1a9c7e['table'],_0x1a9c7e[_0x7dc9('0x79')][_0x4173c2][_0x7dc9('0x7e')],_0x1a9c7e[_0x7dc9('0x79')][_0x4173c2][_0x7dc9('0x7b')],_0x1a9c7e[_0x7dc9('0x79')][_0x4173c2][_0x7dc9('0x7c')]));}}}if(_0x1a9c7e[_0x7dc9('0x7f')]){_0x1a9c7e[_0x7dc9('0x7f')]=JSON[_0x7dc9('0x7a')](_0x1a9c7e[_0x7dc9('0x7f')]);_0x29c228[_0x7dc9('0x37')](_0x21da79(_0x1a9c7e[_0x7dc9('0x7f')]['group']));}_0x5c466d=_0x29c228[_0x7dc9('0x8b')]();_0x29c228[_0x7dc9('0x1d')](_0x33d68c);_0x29c228[_0x7dc9('0x1b')](0x0);return;}})[_0x7dc9('0x23')](function(){if(_0x2e7296['output']===_0x7dc9('0x8c')){return null;}var _0x35e061=_[_0x7dc9('0x3a')](_0x2e7296,{'name':_0x2e7296[_0x7dc9('0x8d')]||_0x2e7296['name']||_0x1a9c7e[_0x7dc9('0x29')],'basename':_0x1acdba,'savename':util[_0x7dc9('0x74')](_0x7dc9('0x8e'),_0x2e7296['name']||_0x1a9c7e['name'],require(_0x7dc9('0x8f'))[_0x7dc9('0x90')](0x4),_0x2e7296[_0x7dc9('0x91')]||_0x7dc9('0x92')),'reportId':_0x1a9c7e['id'],'reportType':_0x7dc9('0x93')});return db['AnalyticExtractedReport'][_0x7dc9('0x45')](_0x35e061,{'raw':!![]});})[_0x7dc9('0x23')](function(_0x648bf9){if(_0x1a9c7e[_0x7dc9('0x6f')]==='cdr'){_0x5c466d[_0x7dc9('0x37')](_0x1a9c7e['table']+_0x7dc9('0x94'),_0x2e7296['startDate'],_0x2e7296[_0x7dc9('0x95')]);}else{_0x5c466d[_0x7dc9('0x37')](_0x1a9c7e[_0x7dc9('0x6f')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2e7296[_0x7dc9('0x96')],_0x2e7296[_0x7dc9('0x95')]);}if(_0x648bf9){logger['info']('Run\x20Query:',_0x5c466d[_0x7dc9('0x97')]());require('child_process')['fork'](path[_0x7dc9('0x85')](__dirname,_0x7dc9('0x98'),_0x648bf9[_0x7dc9('0x91')]),[_0x648bf9['id'],_0x5c466d['toString'](),path['join'](__dirname,'../../files/reports',_0x648bf9[_0x7dc9('0x99')]),_0x1acdba]);return _0x648bf9;}else{var _0xb825f3=squel[_0x7dc9('0x6d')]();_0xb825f3[_0x7dc9('0x6e')]('('+_0x5c466d['toString']()+')','countTable');_0xb825f3[_0x7dc9('0x68')](_0x7dc9('0x9a'),_0x7dc9('0x1e'));_0x5c466d['limit'](_0x2e7296['limit']||_0x33d68c);_0x5c466d[_0x7dc9('0x1b')](_0x2e7296['offset']||0x0);return dbH[_0x7dc9('0x82')][_0x7dc9('0x2e')](_0xb825f3['toString'](),{'type':dbH[_0x7dc9('0x82')][_0x7dc9('0x83')][_0x7dc9('0x84')]})[_0x7dc9('0x23')](function(_0x14cbd9){if(!_0x14cbd9[_0x7dc9('0x65')]){_0x2b3d46=0x0;}else{_0x2b3d46=_0x14cbd9[0x0][_0x7dc9('0x1e')]||0x0;}return dbH[_0x7dc9('0x82')]['query'](_0x5c466d[_0x7dc9('0x97')](),{'type':dbH['sequelize'][_0x7dc9('0x83')]['SELECT']});})[_0x7dc9('0x23')](function(_0x20f245){return{'rows':_0x20f245||[],'count':_0x2b3d46};});}});}exports['run']=function(_0x67d933,_0x1b2b88){return runReport(_0x67d933[_0x7dc9('0x43')],_0x67d933[_0x7dc9('0x2e')],_0x67d933[_0x7dc9('0x3d')])['then'](respondWithResult(_0x1b2b88,null))[_0x7dc9('0x42')](handleError(_0x1b2b88,null));};exports['runReport']=runReport;exports[_0x7dc9('0x2e')]=function(_0x313b41,_0x275675){var _0x299c23=0xa;var _0x4c1c43=[_0x7dc9('0x85'),_0x7dc9('0x50'),'right_join',_0x7dc9('0x52')];var _0x1fbaea={'SUM':_0x7dc9('0x86'),'COUNT':_0x7dc9('0x87'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7dc9('0x54'),'MIN':_0x7dc9('0x55'),'AVG':_0x7dc9('0x56'),'GROUP_CONCAT':_0x7dc9('0x57'),'GROUP_CONCAT ASC':_0x7dc9('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6c7fdc={'SEC_TO_TIME':_0x7dc9('0x5a'),'DATE':_0x7dc9('0x5b'),'HOUR':_0x7dc9('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7dc9('0x5e')};var _0x5c9d64=function(_0x59710c){return!_['includes']([_0x7dc9('0x60'),_0x7dc9('0x61'),_0x7dc9('0x62'),_0x7dc9('0x63')],_0x59710c);};var _0x24a1e2=function(_0x45bcf4){if(!_0x45bcf4||!_0x45bcf4[_0x7dc9('0x64')][_0x7dc9('0x65')]){return'';}for(var _0x4b18e1='(',_0x28e50e=0x0;_0x28e50e<_0x45bcf4[_0x7dc9('0x64')][_0x7dc9('0x65')];_0x28e50e+=0x1){_0x28e50e>0x0&&(_0x4b18e1+='\x20'+_0x45bcf4['operator']+'\x20');_0x4b18e1+=_0x45bcf4[_0x7dc9('0x64')][_0x28e50e][_0x7dc9('0x67')]?_0x24a1e2(_0x45bcf4[_0x7dc9('0x64')][_0x28e50e][_0x7dc9('0x67')]):_0x45bcf4[_0x7dc9('0x64')][_0x28e50e][_0x7dc9('0x68')]+'\x20'+_0x45bcf4[_0x7dc9('0x64')][_0x28e50e][_0x7dc9('0x69')]+(_0x5c9d64(_0x45bcf4[_0x7dc9('0x64')][_0x28e50e][_0x7dc9('0x69')])?'\x20'+_0x45bcf4[_0x7dc9('0x64')][_0x28e50e][_0x7dc9('0x88')]:'');}return _0x4b18e1+')';};var _0x1dc474={'where':{'id':_0x313b41[_0x7dc9('0x43')]['id']}},_0x31121a,_0x454b3a,_0x409a9f,_0x187f17,_0x809ae5;_0x1dc474=_[_0x7dc9('0x3a')]({},_0x1dc474,_0x313b41['options']);return db[_0x7dc9('0x2b')]['find'](_0x1dc474)[_0x7dc9('0x23')](function(_0x56e1ba){if(_0x56e1ba){_0x31121a=_0x56e1ba;return _0x56e1ba['getFields']();}return null;})[_0x7dc9('0x23')](function(_0x342b95){if(_0x342b95){if(!_0x342b95['length']){throw new db[(_0x7dc9('0x6a'))]['ValidationErrorItem'](_0x7dc9('0x89'),0x193);}_0x454b3a=_0x342b95;return db[_0x7dc9('0x8a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x338c78){if(_0x338c78){_0x409a9f=_[_0x7dc9('0x6c')](_0x338c78,'id');var _0x8ee4f4;var _0x8f887e=squel['select']();_0x8f887e[_0x7dc9('0x6e')](_0x31121a[_0x7dc9('0x6f')]);for(var _0x4e2edf=0x0;_0x4e2edf<_0x454b3a[_0x7dc9('0x65')];_0x4e2edf+=0x1){_0x8ee4f4=_0x454b3a[_0x4e2edf][_0x7dc9('0x70')]?_0x409a9f[_0x454b3a[_0x4e2edf]['MetricId']]['metric']:_0x454b3a[_0x4e2edf][_0x7dc9('0x68')];_0x8ee4f4=_0x454b3a[_0x4e2edf][_0x7dc9('0x72')]?_[_0x7dc9('0x73')](_0x1fbaea[_0x454b3a[_0x4e2edf][_0x7dc9('0x72')]],'%s',_0x8ee4f4):_0x8ee4f4;_0x8ee4f4=_0x454b3a[_0x4e2edf]['format']?_[_0x7dc9('0x73')](_0x6c7fdc[_0x454b3a[_0x4e2edf]['format']],'%s',_0x8ee4f4):_0x8ee4f4;if(_0x454b3a[_0x4e2edf]['groupBy']){_0x8f887e[_0x7dc9('0x67')](_0x8ee4f4);}_0x454b3a[_0x4e2edf][_0x7dc9('0x76')]&&_0x8f887e[_0x7dc9('0x35')](_0x8ee4f4,_0x454b3a[_0x4e2edf][_0x7dc9('0x76')]===_0x7dc9('0x77')?![]:!![]);_0x8f887e[_0x7dc9('0x68')](_0x8ee4f4,_0x454b3a[_0x4e2edf][_0x7dc9('0x78')]||_0x8ee4f4);}if(_0x31121a['joins']){_0x31121a[_0x7dc9('0x79')]=JSON[_0x7dc9('0x7a')](_0x31121a[_0x7dc9('0x79')]);for(var _0x283f96=0x0;_0x283f96<_0x31121a[_0x7dc9('0x79')][_0x7dc9('0x65')];_0x283f96+=0x1){if(_0x31121a[_0x7dc9('0x79')][_0x283f96]['type']&&_[_0x7dc9('0x5f')](_0x4c1c43,_0x31121a[_0x7dc9('0x79')][_0x283f96][_0x7dc9('0x3b')])&&_0x31121a[_0x7dc9('0x79')][_0x283f96][_0x7dc9('0x7e')]&&_0x31121a['joins'][_0x283f96][_0x7dc9('0x7b')]&&_0x31121a['joins'][_0x283f96][_0x7dc9('0x7c')]){_0x8f887e[_0x31121a[_0x7dc9('0x79')][_0x283f96]['type']](_0x31121a[_0x7dc9('0x79')][_0x283f96][_0x7dc9('0x7b')],null,util[_0x7dc9('0x74')](_0x7dc9('0x7d'),_0x31121a[_0x7dc9('0x6f')],_0x31121a[_0x7dc9('0x79')][_0x283f96]['parentKey'],_0x31121a[_0x7dc9('0x79')][_0x283f96][_0x7dc9('0x7b')],_0x31121a['joins'][_0x283f96][_0x7dc9('0x7c')]));}}}if(_0x31121a[_0x7dc9('0x7f')]){_0x31121a['conditions']=JSON['parse'](_0x31121a[_0x7dc9('0x7f')]);_0x8f887e[_0x7dc9('0x37')](_0x24a1e2(_0x31121a[_0x7dc9('0x7f')]['group']));}_0x809ae5=_0x8f887e[_0x7dc9('0x8b')]();_0x8f887e['limit'](_0x299c23);_0x8f887e[_0x7dc9('0x1b')](0x0);logger[_0x7dc9('0x80')](_0x7dc9('0x81'),_0x8f887e['toString']());return dbH[_0x7dc9('0x82')]['query'](_0x8f887e['toString'](),{'type':dbH[_0x7dc9('0x82')][_0x7dc9('0x83')][_0x7dc9('0x84')]});}})[_0x7dc9('0x23')](function(){return{'sql':_0x809ae5[_0x7dc9('0x97')]()};})['then'](respondWithResult(_0x275675,null))['catch'](handleError(_0x275675,null));}; \ No newline at end of file +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(_0x5d3afa,_0x584768){var _0x230dd9=function(_0x5ca224){while(--_0x5ca224){_0x5d3afa['push'](_0x5d3afa['shift']());}};_0x230dd9(++_0x584768);}(_0x53ec,0x192));var _0xc53e=function(_0x3fe440,_0x18d0cb){_0x3fe440=_0x3fe440-0x0;var _0x30cf95=_0x53ec[_0x3fe440];return _0x30cf95;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 4971dff..d609720 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 _0x5612=['define','analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x5612,0x1db));var _0x2561=function(_0xe435e3,_0x390a8c){_0xe435e3=_0xe435e3-0x0;var _0x11b08b=_0x5612[_0xe435e3];return _0x11b08b;};'use strict';var _=require(_0x2561('0x0'));var util=require('util');var logger=require(_0x2561('0x1'))(_0x2561('0x2'));var moment=require(_0x2561('0x3'));var BPromise=require(_0x2561('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2561('0x5'));var rimraf=require(_0x2561('0x6'));var config=require(_0x2561('0x7'));var attributes=require(_0x2561('0x8'));module['exports']=function(_0x2a4078,_0x302100){return _0x2a4078[_0x2561('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x2561('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa721=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','AnalyticDefaultReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa721,0xdc));var _0x1a72=function(_0x479af1,_0x17d64b){_0x479af1=_0x479af1-0x0;var _0x43b150=_0xa721[_0x479af1];return _0x43b150;};'use strict';var _=require('lodash');var util=require(_0x1a72('0x0'));var logger=require(_0x1a72('0x1'))(_0x1a72('0x2'));var moment=require(_0x1a72('0x3'));var BPromise=require(_0x1a72('0x4'));var rp=require(_0x1a72('0x5'));var fs=require('fs');var path=require(_0x1a72('0x6'));var rimraf=require(_0x1a72('0x7'));var config=require('../../config/environment');var attributes=require(_0x1a72('0x8'));module['exports']=function(_0x136bf2,_0x3e25c3){return _0x136bf2['define'](_0x1a72('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 8ad4e69..60b067e 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 _0xa1d7=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x2300c7,_0x255f74){var _0x23f720=function(_0x3fea57){while(--_0x3fea57){_0x2300c7['push'](_0x2300c7['shift']());}};_0x23f720(++_0x255f74);}(_0xa1d7,0x1a0));var _0x7a1d=function(_0x359d3e,_0x9d9e5b){_0x359d3e=_0x359d3e-0x0;var _0x533931=_0xa1d7[_0x359d3e];return _0x533931;};'use strict';var _=require(_0x7a1d('0x0'));var util=require(_0x7a1d('0x1'));var moment=require(_0x7a1d('0x2'));var BPromise=require(_0x7a1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a1d('0x4'));var db=require(_0x7a1d('0x5'))['db'];var utils=require(_0x7a1d('0x6'));var logger=require(_0x7a1d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7a1d('0x8'));var client=jayson[_0x7a1d('0x9')][_0x7a1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57d4b4,_0x4789d8,_0x428575){return new BPromise(function(_0xb47950,_0x415dc2){return client[_0x7a1d('0xb')](_0x57d4b4,_0x428575)['then'](function(_0x3dc372){logger[_0x7a1d('0xc')](_0x7a1d('0xd'),_0x4789d8,_0x7a1d('0xe'));logger[_0x7a1d('0xf')](_0x7a1d('0x10'),_0x4789d8,_0x7a1d('0xe'),JSON['stringify'](_0x3dc372));if(_0x3dc372[_0x7a1d('0x11')]){if(_0x3dc372[_0x7a1d('0x11')][_0x7a1d('0x12')]===0x1f4){logger[_0x7a1d('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4789d8,_0x3dc372[_0x7a1d('0x11')]['message']);return _0x415dc2(_0x3dc372[_0x7a1d('0x11')]['message']);}logger[_0x7a1d('0x11')](_0x7a1d('0xd'),_0x4789d8,_0x3dc372[_0x7a1d('0x11')]['message']);return _0xb47950(_0x3dc372['error'][_0x7a1d('0x13')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4789d8,_0x7a1d('0xe'));_0xb47950(_0x3dc372[_0x7a1d('0x14')][_0x7a1d('0x13')]);}})[_0x7a1d('0x15')](function(_0x4e13d6){logger[_0x7a1d('0x11')](_0x7a1d('0xd'),_0x4789d8,_0x4e13d6);_0x415dc2(_0x4e13d6);});});} \ No newline at end of file +var _0x46a9=['info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x8e2ff7,_0x38bad8){var _0x47b333=function(_0x1df3ff){while(--_0x1df3ff){_0x8e2ff7['push'](_0x8e2ff7['shift']());}};_0x47b333(++_0x38bad8);}(_0x46a9,0xd0));var _0x946a=function(_0x47ace6,_0x107f47){_0x47ace6=_0x47ace6-0x0;var _0x5060d7=_0x46a9[_0x47ace6];return _0x5060d7;};'use strict';var _=require(_0x946a('0x0'));var util=require(_0x946a('0x1'));var moment=require(_0x946a('0x2'));var BPromise=require(_0x946a('0x3'));var rs=require(_0x946a('0x4'));var fs=require('fs');var Redis=require(_0x946a('0x5'));var db=require(_0x946a('0x6'))['db'];var utils=require(_0x946a('0x7'));var logger=require('../../config/logger')(_0x946a('0x8'));var config=require(_0x946a('0x9'));var jayson=require(_0x946a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1babd5,_0x44de83,_0x126b00){return new BPromise(function(_0x34f2b9,_0xf4095d){return client[_0x946a('0xb')](_0x1babd5,_0x126b00)['then'](function(_0xe45053){logger[_0x946a('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x44de83,_0x946a('0xd'));logger[_0x946a('0xe')](_0x946a('0xf'),_0x44de83,_0x946a('0xd'),JSON[_0x946a('0x10')](_0xe45053));if(_0xe45053['error']){if(_0xe45053[_0x946a('0x11')][_0x946a('0x12')]===0x1f4){logger['error'](_0x946a('0x13'),_0x44de83,_0xe45053[_0x946a('0x11')][_0x946a('0x14')]);return _0xf4095d(_0xe45053[_0x946a('0x11')][_0x946a('0x14')]);}logger[_0x946a('0x11')](_0x946a('0x13'),_0x44de83,_0xe45053[_0x946a('0x11')][_0x946a('0x14')]);return _0x34f2b9(_0xe45053[_0x946a('0x11')][_0x946a('0x14')]);}else{logger[_0x946a('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x44de83,_0x946a('0xd'));_0x34f2b9(_0xe45053[_0x946a('0x15')]['message']);}})['catch'](function(_0x5eedac){logger['error'](_0x946a('0x13'),_0x44de83,_0x5eedac);_0xf4095d(_0x5eedac);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 3f91a8a..5a67d13 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 _0x0ee6=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','post','update','destroy','exports','multer','util'];(function(_0x17a5d2,_0x90eb17){var _0x182b7e=function(_0x5e6076){while(--_0x5e6076){_0x17a5d2['push'](_0x17a5d2['shift']());}};_0x182b7e(++_0x90eb17);}(_0x0ee6,0x106));var _0x60ee=function(_0x12939e,_0x46d77a){_0x12939e=_0x12939e-0x0;var _0x3a6764=_0x0ee6[_0x12939e];return _0x3a6764;};'use strict';var multer=require(_0x60ee('0x0'));var util=require(_0x60ee('0x1'));var path=require('path');var timeout=require(_0x60ee('0x2'));var express=require(_0x60ee('0x3'));var router=express[_0x60ee('0x4')]();var fs_extra=require(_0x60ee('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x60ee('0x6'));var config=require(_0x60ee('0x7'));var controller=require(_0x60ee('0x8'));router[_0x60ee('0x9')]('/',auth[_0x60ee('0xa')](),controller['index']);router['get'](_0x60ee('0xb'),auth[_0x60ee('0xa')](),controller[_0x60ee('0xc')]);router[_0x60ee('0x9')](_0x60ee('0xd'),auth[_0x60ee('0xa')](),controller[_0x60ee('0xe')]);router[_0x60ee('0x9')](_0x60ee('0xf'),auth[_0x60ee('0xa')](),controller[_0x60ee('0x10')]);router[_0x60ee('0x9')](_0x60ee('0x11'),auth[_0x60ee('0xa')](),controller['query']);router[_0x60ee('0x12')]('/',auth[_0x60ee('0xa')](),controller['create']);router['put'](_0x60ee('0xb'),auth[_0x60ee('0xa')](),controller[_0x60ee('0x13')]);router['delete']('/:id',auth[_0x60ee('0xa')](),controller[_0x60ee('0x14')]);module[_0x60ee('0x15')]=router; \ No newline at end of file +var _0xb1ef=['./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f4c53,_0x58ba7b){var _0x568ff1=function(_0x1b6013){while(--_0x1b6013){_0x4f4c53['push'](_0x4f4c53['shift']());}};_0x568ff1(++_0x58ba7b);}(_0xb1ef,0x93));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xfb1e('0x0'));var util=require(_0xfb1e('0x1'));var path=require('path');var timeout=require(_0xfb1e('0x2'));var express=require(_0xfb1e('0x3'));var router=express[_0xfb1e('0x4')]();var fs_extra=require(_0xfb1e('0x5'));var auth=require(_0xfb1e('0x6'));var interaction=require(_0xfb1e('0x7'));var config=require(_0xfb1e('0x8'));var controller=require(_0xfb1e('0x9'));router['get']('/',auth[_0xfb1e('0xa')](),controller[_0xfb1e('0xb')]);router[_0xfb1e('0xc')](_0xfb1e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xfb1e('0xc')](_0xfb1e('0xe'),auth[_0xfb1e('0xa')](),controller[_0xfb1e('0xf')]);router[_0xfb1e('0xc')](_0xfb1e('0x10'),auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x11')]);router['get'](_0xfb1e('0x12'),auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x13')]);router[_0xfb1e('0x14')]('/',auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x15')]);router[_0xfb1e('0x16')]('/:id',auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x17')]);router['delete'](_0xfb1e('0xd'),auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x18')]);module[_0xfb1e('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 26a7443..f8d5c70 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 _0xf33d=['Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x453002,_0x577cda){var _0xf82e62=function(_0x4435a3){while(--_0x4435a3){_0x453002['push'](_0x453002['shift']());}};_0xf82e62(++_0x577cda);}(_0xf33d,0x198));var _0xdf33=function(_0x475703,_0x5a274d){_0x475703=_0x475703-0x0;var _0x3ddf84=_0xf33d[_0x475703];return _0x3ddf84;};'use strict';var Sequelize=require(_0xdf33('0x0'));var moment=require(_0xdf33('0x1'));module['exports']={'name':{'type':Sequelize[_0xdf33('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xdf33('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xdf33('0x3')](_0xdf33('0x4'),_0xdf33('0x5'),_0xdf33('0x6')),'allowNull':![],'defaultValue':_0xdf33('0x4')},'savename':{'type':Sequelize[_0xdf33('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xdf33('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xdf33('0x8')},'type':{'type':Sequelize[_0xdf33('0x3')](_0xdf33('0x9'),_0xdf33('0xa')),'allowNull':![],'defaultValue':_0xdf33('0x9')},'reportId':{'type':Sequelize[_0xdf33('0xb')](0xb)[_0xdf33('0xc')]},'reportType':{'type':Sequelize[_0xdf33('0x2')]}}; \ No newline at end of file +var _0x0274=['manual','scheduled','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x3aaab6,_0x1db2aa){var _0x343aa7=function(_0x4ac7bc){while(--_0x4ac7bc){_0x3aaab6['push'](_0x3aaab6['shift']());}};_0x343aa7(++_0x1db2aa);}(_0x0274,0xf3));var _0x4027=function(_0x3dc254,_0x4eb6fd){_0x3dc254=_0x3dc254-0x0;var _0x29dcb2=_0x0274[_0x3dc254];return _0x29dcb2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4027('0x0'));module[_0x4027('0x1')]={'name':{'type':Sequelize[_0x4027('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x4027('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x4027('0x3')](_0x4027('0x4'),_0x4027('0x5'),_0x4027('0x6')),'allowNull':![],'defaultValue':_0x4027('0x4')},'savename':{'type':Sequelize[_0x4027('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x4027('0x7')]},'endDate':{'type':Sequelize[_0x4027('0x7')]},'status':{'type':Sequelize[_0x4027('0x2')],'defaultValue':_0x4027('0x8')},'type':{'type':Sequelize['ENUM'](_0x4027('0x9'),_0x4027('0xa')),'allowNull':![],'defaultValue':_0x4027('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x4027('0xb')]},'reportType':{'type':Sequelize[_0x4027('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2badef0..2ad81f5 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 _0x9542=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','end','sendStatus','error','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','download','basename','savename','existsSync','join','root','server/files/reports','Sequelize','exists','format','%s.%s','output','toLowerCase','zip-dir','fast-json-patch'];(function(_0x4b1cd2,_0x25de86){var _0x44a70c=function(_0x56602c){while(--_0x56602c){_0x4b1cd2['push'](_0x4b1cd2['shift']());}};_0x44a70c(++_0x25de86);}(_0x9542,0x11e));var _0x2954=function(_0x345e23,_0x1fdbb7){_0x345e23=_0x345e23-0x0;var _0x46ae83=_0x9542[_0x345e23];return _0x46ae83;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2954('0x0'));var jsonpatch=require(_0x2954('0x1'));var rp=require(_0x2954('0x2'));var moment=require(_0x2954('0x3'));var BPromise=require(_0x2954('0x4'));var Mustache=require(_0x2954('0x5'));var util=require(_0x2954('0x6'));var path=require(_0x2954('0x7'));var sox=require(_0x2954('0x8'));var csv=require(_0x2954('0x9'));var ejs=require(_0x2954('0xa'));var fs=require('fs');var fs_extra=require(_0x2954('0xb'));var _=require('lodash');var squel=require(_0x2954('0xc'));var crypto=require(_0x2954('0xd'));var jsforce=require(_0x2954('0xe'));var deskjs=require(_0x2954('0xf'));var toCsv=require(_0x2954('0x9'));var querystring=require(_0x2954('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2954('0x11'));var qs=require(_0x2954('0x12'));var as=require(_0x2954('0x13'));var hardwareService=require(_0x2954('0x14'));var logger=require(_0x2954('0x15'))('api');var utils=require(_0x2954('0x16'));var config=require(_0x2954('0x17'));var licenseUtil=require(_0x2954('0x18'));var db=require(_0x2954('0x19'))['db'];function respondWithStatusCode(_0x45c3d9,_0x9d0207){_0x9d0207=_0x9d0207||0xcc;return function(_0x2ed60b){if(_0x2ed60b){return _0x45c3d9['sendStatus'](_0x9d0207);}return _0x45c3d9['status'](_0x9d0207)['end']();};}function respondWithResult(_0x1f0daf,_0x12e955){_0x12e955=_0x12e955||0xc8;return function(_0x3a5f39){if(_0x3a5f39){return _0x1f0daf[_0x2954('0x1a')](_0x12e955)[_0x2954('0x1b')](_0x3a5f39);}};}function respondWithFilteredResult(_0x38b022,_0x264809){return function(_0x38759c){if(_0x38759c){var _0x353225=typeof _0x264809[_0x2954('0x1c')]==='undefined'&&typeof _0x264809[_0x2954('0x1d')]==='undefined';var _0x3c1562=_0x38759c[_0x2954('0x1e')];var _0x513ed7=_0x353225?0x0:_0x264809[_0x2954('0x1c')];var _0x4e8c92=_0x353225?_0x38759c[_0x2954('0x1e')]:_0x264809[_0x2954('0x1c')]+_0x264809['limit'];var _0x1d0d10;if(_0x4e8c92>=_0x3c1562){_0x4e8c92=_0x3c1562;_0x1d0d10=0xc8;}else{_0x1d0d10=0xce;}_0x38b022['status'](_0x1d0d10);return _0x38b022[_0x2954('0x1f')](_0x2954('0x20'),_0x513ed7+'-'+_0x4e8c92+'/'+_0x3c1562)['json'](_0x38759c);}return null;};}function patchUpdates(_0x2515e5){return function(_0x317cb2){try{jsonpatch[_0x2954('0x21')](_0x317cb2,_0x2515e5,!![]);}catch(_0x283e1f){return BPromise[_0x2954('0x22')](_0x283e1f);}return _0x317cb2[_0x2954('0x23')]();};}function saveUpdates(_0x45fb53,_0x28bf99){return function(_0x137599){if(_0x137599){return _0x137599['update'](_0x45fb53)[_0x2954('0x24')](function(_0x3350fa){return _0x3350fa;});}return null;};}function removeEntity(_0x1ac966,_0x565876){return function(_0xfdadb2){if(_0xfdadb2){return _0xfdadb2[_0x2954('0x25')]()['then'](function(){var _0x23fd16=_0xfdadb2[_0x2954('0x26')]({'plain':!![]});var _0x96538a=_0x2954('0x27');return db[_0x2954('0x28')]['destroy']({'where':{'type':_0x96538a,'resourceId':_0x23fd16['id']}})[_0x2954('0x24')](function(){return _0xfdadb2;});})[_0x2954('0x24')](function(){_0x1ac966[_0x2954('0x1a')](0xcc)[_0x2954('0x29')]();});}};}function handleEntityNotFound(_0x3c1547,_0x15f219){return function(_0x162c9f){if(!_0x162c9f){_0x3c1547[_0x2954('0x2a')](0x194);}return _0x162c9f;};}function handleError(_0x3474f4,_0x406ab9){_0x406ab9=_0x406ab9||0x1f4;return function(_0x6dad7){logger[_0x2954('0x2b')](_0x6dad7['stack']);if(_0x6dad7[_0x2954('0x2c')]){delete _0x6dad7['name'];}_0x3474f4[_0x2954('0x1a')](_0x406ab9)['send'](_0x6dad7);};}exports[_0x2954('0x2d')]=function(_0x2cb23e,_0x3e7994){var _0x2e85fe={},_0x48d7a7={},_0x3a611c={'count':0x0,'rows':[]};var _0xd51d33=_[_0x2954('0x2e')](db['AnalyticExtractedReport']['rawAttributes'],function(_0xa2f84c){return{'name':_0xa2f84c[_0x2954('0x2f')],'type':_0xa2f84c['type'][_0x2954('0x30')]};});_0x48d7a7[_0x2954('0x31')]=_[_0x2954('0x2e')](_0xd51d33,'name');_0x48d7a7[_0x2954('0x32')]=_[_0x2954('0x33')](_0x2cb23e[_0x2954('0x32')]);_0x48d7a7[_0x2954('0x34')]=_[_0x2954('0x35')](_0x48d7a7[_0x2954('0x31')],_0x48d7a7[_0x2954('0x32')]);_0x2e85fe[_0x2954('0x36')]=_['intersection'](_0x48d7a7[_0x2954('0x31')],qs[_0x2954('0x37')](_0x2cb23e[_0x2954('0x32')][_0x2954('0x37')]));_0x2e85fe[_0x2954('0x36')]=_0x2e85fe[_0x2954('0x36')][_0x2954('0x38')]?_0x2e85fe[_0x2954('0x36')]:_0x48d7a7[_0x2954('0x31')];if(!_0x2cb23e[_0x2954('0x32')][_0x2954('0x39')](_0x2954('0x3a'))){_0x2e85fe[_0x2954('0x1d')]=qs[_0x2954('0x1d')](_0x2cb23e[_0x2954('0x32')][_0x2954('0x1d')]);_0x2e85fe[_0x2954('0x1c')]=qs[_0x2954('0x1c')](_0x2cb23e[_0x2954('0x32')][_0x2954('0x1c')]);}_0x2e85fe[_0x2954('0x3b')]=qs[_0x2954('0x3c')](_0x2cb23e[_0x2954('0x32')]['sort']);_0x2e85fe[_0x2954('0x3d')]=qs[_0x2954('0x34')](_['pick'](_0x2cb23e[_0x2954('0x32')],_0x48d7a7[_0x2954('0x34')]),_0xd51d33);if(_0x2cb23e[_0x2954('0x32')][_0x2954('0x3e')]){_0x2e85fe[_0x2954('0x3d')]=_[_0x2954('0x3f')](_0x2e85fe['where'],{'$or':_['map'](_0xd51d33,function(_0x470d4a){if(_0x470d4a[_0x2954('0x40')]!=='VIRTUAL'){var _0x3ea6ea={};_0x3ea6ea[_0x470d4a[_0x2954('0x2c')]]={'$like':'%'+_0x2cb23e['query'][_0x2954('0x3e')]+'%'};return _0x3ea6ea;}})});}_0x2e85fe=_[_0x2954('0x3f')]({},_0x2e85fe,_0x2cb23e[_0x2954('0x41')]);var _0x489fd8={'where':_0x2e85fe[_0x2954('0x3d')]};return db[_0x2954('0x42')][_0x2954('0x1e')](_0x489fd8)['then'](function(_0x3f4857){_0x3a611c[_0x2954('0x1e')]=_0x3f4857;if(_0x2cb23e['query'][_0x2954('0x43')]){_0x2e85fe[_0x2954('0x44')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x2954('0x45')](_0x2e85fe);})[_0x2954('0x24')](function(_0x109ddf){_0x3a611c[_0x2954('0x46')]=_0x109ddf;return _0x3a611c;})[_0x2954('0x24')](respondWithFilteredResult(_0x3e7994,_0x2e85fe))[_0x2954('0x47')](handleError(_0x3e7994,null));};exports[_0x2954('0x48')]=function(_0x51dca6,_0x3bc272){var _0x3aa099={'raw':!![],'where':{'id':_0x51dca6['params']['id']}},_0x36306c={};_0x36306c[_0x2954('0x31')]=_[_0x2954('0x33')](db[_0x2954('0x42')][_0x2954('0x49')]);_0x36306c[_0x2954('0x32')]=_[_0x2954('0x33')](_0x51dca6[_0x2954('0x32')]);_0x36306c[_0x2954('0x34')]=_['intersection'](_0x36306c[_0x2954('0x31')],_0x36306c[_0x2954('0x32')]);_0x3aa099[_0x2954('0x36')]=_[_0x2954('0x35')](_0x36306c[_0x2954('0x31')],qs[_0x2954('0x37')](_0x51dca6[_0x2954('0x32')]['fields']));_0x3aa099['attributes']=_0x3aa099['attributes'][_0x2954('0x38')]?_0x3aa099[_0x2954('0x36')]:_0x36306c[_0x2954('0x31')];if(_0x51dca6[_0x2954('0x32')]['includeAll']){_0x3aa099[_0x2954('0x44')]=[{'all':!![]}];}_0x3aa099=_[_0x2954('0x3f')]({},_0x3aa099,_0x51dca6[_0x2954('0x41')]);return db['AnalyticExtractedReport'][_0x2954('0x4a')](_0x3aa099)[_0x2954('0x24')](handleEntityNotFound(_0x3bc272,null))[_0x2954('0x24')](respondWithResult(_0x3bc272,null))[_0x2954('0x47')](handleError(_0x3bc272,null));};exports[_0x2954('0x4b')]=function(_0x468662,_0x51eaa7){return db[_0x2954('0x42')][_0x2954('0x4b')](_0x468662[_0x2954('0x4c')],{})[_0x2954('0x24')](function(_0x36de21){var _0x570760=_0x468662[_0x2954('0x4d')][_0x2954('0x26')]({'plain':!![]});if(!_0x570760)throw new Error(_0x2954('0x4e'));if(_0x570760['role']===_0x2954('0x4d')){var _0x2eebbd=_0x36de21[_0x2954('0x26')]({'plain':!![]});var _0x49d50f=_0x2954('0x27');return db[_0x2954('0x4f')]['find']({'where':{'name':_0x49d50f,'userProfileId':_0x570760[_0x2954('0x50')]},'raw':!![]})[_0x2954('0x24')](function(_0x4498b7){if(_0x4498b7&&_0x4498b7[_0x2954('0x51')]===0x0){return db[_0x2954('0x28')]['create']({'name':_0x2eebbd[_0x2954('0x2c')],'resourceId':_0x2eebbd['id'],'type':_0x4498b7[_0x2954('0x2c')],'sectionId':_0x4498b7['id']},{})[_0x2954('0x24')](function(){return _0x36de21;});}else{return _0x36de21;}})[_0x2954('0x47')](function(_0x146a34){logger[_0x2954('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x146a34);throw _0x146a34;});}return _0x36de21;})['then'](respondWithResult(_0x51eaa7,0xc9))['catch'](handleError(_0x51eaa7,null));};exports['update']=function(_0x131e4,_0x37e977){if(_0x131e4[_0x2954('0x4c')]['id']){delete _0x131e4[_0x2954('0x4c')]['id'];}return db[_0x2954('0x42')][_0x2954('0x4a')]({'where':{'id':_0x131e4[_0x2954('0x52')]['id']}})[_0x2954('0x24')](handleEntityNotFound(_0x37e977,null))['then'](saveUpdates(_0x131e4['body'],null))[_0x2954('0x24')](respondWithResult(_0x37e977,null))['catch'](handleError(_0x37e977,null));};exports[_0x2954('0x25')]=function(_0x954683,_0xb3915e){return db[_0x2954('0x42')][_0x2954('0x4a')]({'where':{'id':_0x954683['params']['id']}})[_0x2954('0x24')](handleEntityNotFound(_0xb3915e,null))[_0x2954('0x24')](removeEntity(_0xb3915e,null))[_0x2954('0x47')](handleError(_0xb3915e,null));};exports[_0x2954('0x53')]=function(_0x4b4ce5,_0x149747,_0x31889e){return db['AnalyticExtractedReport'][_0x2954('0x4a')]({'where':{'id':_0x4b4ce5[_0x2954('0x52')]['id']},'attributes':['name',_0x2954('0x54'),_0x2954('0x55'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x149747,null))[_0x2954('0x24')](function(_0x4a7741){if(_0x4a7741){if(!fs[_0x2954('0x56')](path[_0x2954('0x57')](config[_0x2954('0x58')],_0x2954('0x59'),_0x4a7741[_0x2954('0x55')]))){throw new db[(_0x2954('0x5a'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x4b4ce5[_0x2954('0x32')][_0x2954('0x5b')]){return _0x149747[_0x2954('0x2a')](0xc8);}return _0x149747[_0x2954('0x53')](path[_0x2954('0x57')](config[_0x2954('0x58')],_0x2954('0x59'),_0x4a7741[_0x2954('0x55')]),util[_0x2954('0x5c')](_0x2954('0x5d'),_0x4a7741[_0x2954('0x54')]||_0x4a7741[_0x2954('0x2c')],_0x4a7741[_0x2954('0x5e')][_0x2954('0x5f')]()));}})[_0x2954('0x47')](handleError(_0x149747,null));}; \ No newline at end of file +var _0x142c=['existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','rows','params','find','catch','create','body','user','role','ExtractedReports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','output'];(function(_0x6e4a9e,_0x506af2){var _0xbd0fb1=function(_0xf49152){while(--_0xf49152){_0x6e4a9e['push'](_0x6e4a9e['shift']());}};_0xbd0fb1(++_0x506af2);}(_0x142c,0x67));var _0xc142=function(_0x28c3ba,_0xe1ea2d){_0x28c3ba=_0x28c3ba-0x0;var _0x10b950=_0x142c[_0x28c3ba];return _0x10b950;};'use strict';var emlformat=require(_0xc142('0x0'));var rimraf=require(_0xc142('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc142('0x2'));var rp=require(_0xc142('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc142('0x4'));var util=require('util');var path=require(_0xc142('0x5'));var sox=require(_0xc142('0x6'));var csv=require('to-csv');var ejs=require(_0xc142('0x7'));var fs=require('fs');var fs_extra=require(_0xc142('0x8'));var _=require('lodash');var squel=require(_0xc142('0x9'));var crypto=require(_0xc142('0xa'));var jsforce=require(_0xc142('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc142('0xc'));var querystring=require(_0xc142('0xd'));var Papa=require(_0xc142('0xe'));var Redis=require(_0xc142('0xf'));var authService=require(_0xc142('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc142('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc142('0x12'))(_0xc142('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc142('0x14'));var db=require(_0xc142('0x15'))['db'];function respondWithStatusCode(_0x81e126,_0x597c3e){_0x597c3e=_0x597c3e||0xcc;return function(_0xdaf6f6){if(_0xdaf6f6){return _0x81e126[_0xc142('0x16')](_0x597c3e);}return _0x81e126['status'](_0x597c3e)['end']();};}function respondWithResult(_0x3ce5bb,_0x23ed1f){_0x23ed1f=_0x23ed1f||0xc8;return function(_0xd8a04e){if(_0xd8a04e){return _0x3ce5bb[_0xc142('0x17')](_0x23ed1f)['json'](_0xd8a04e);}};}function respondWithFilteredResult(_0x29f8d3,_0x52ad72){return function(_0x509761){if(_0x509761){var _0x21610d=typeof _0x52ad72['offset']==='undefined'&&typeof _0x52ad72[_0xc142('0x18')]===_0xc142('0x19');var _0x511642=_0x509761[_0xc142('0x1a')];var _0x30f284=_0x21610d?0x0:_0x52ad72[_0xc142('0x1b')];var _0x39145e=_0x21610d?_0x509761[_0xc142('0x1a')]:_0x52ad72['offset']+_0x52ad72[_0xc142('0x18')];var _0x324fe4;if(_0x39145e>=_0x511642){_0x39145e=_0x511642;_0x324fe4=0xc8;}else{_0x324fe4=0xce;}_0x29f8d3[_0xc142('0x17')](_0x324fe4);return _0x29f8d3['set'](_0xc142('0x1c'),_0x30f284+'-'+_0x39145e+'/'+_0x511642)[_0xc142('0x1d')](_0x509761);}return null;};}function patchUpdates(_0x44e3a2){return function(_0x105a6f){try{jsonpatch[_0xc142('0x1e')](_0x105a6f,_0x44e3a2,!![]);}catch(_0x3358a8){return BPromise['reject'](_0x3358a8);}return _0x105a6f[_0xc142('0x1f')]();};}function saveUpdates(_0x3a97dd,_0x14ee89){return function(_0x13ed83){if(_0x13ed83){return _0x13ed83[_0xc142('0x20')](_0x3a97dd)[_0xc142('0x21')](function(_0x192272){return _0x192272;});}return null;};}function removeEntity(_0x2846f7,_0x2d421b){return function(_0x1e0ce7){if(_0x1e0ce7){return _0x1e0ce7[_0xc142('0x22')]()[_0xc142('0x21')](function(){var _0x56d37a=_0x1e0ce7[_0xc142('0x23')]({'plain':!![]});var _0x1c62d6='ExtractedReports';return db[_0xc142('0x24')][_0xc142('0x22')]({'where':{'type':_0x1c62d6,'resourceId':_0x56d37a['id']}})['then'](function(){return _0x1e0ce7;});})[_0xc142('0x21')](function(){_0x2846f7[_0xc142('0x17')](0xcc)[_0xc142('0x25')]();});}};}function handleEntityNotFound(_0x2d1121,_0x327213){return function(_0x22fbc3){if(!_0x22fbc3){_0x2d1121['sendStatus'](0x194);}return _0x22fbc3;};}function handleError(_0x364fe6,_0x5b9a0f){_0x5b9a0f=_0x5b9a0f||0x1f4;return function(_0x3deaf2){logger[_0xc142('0x26')](_0x3deaf2[_0xc142('0x27')]);if(_0x3deaf2['name']){delete _0x3deaf2[_0xc142('0x28')];}_0x364fe6['status'](_0x5b9a0f)['send'](_0x3deaf2);};}exports['index']=function(_0x439656,_0x419ab9){var _0x3da49e={},_0x322d2b={},_0x3ae49b={'count':0x0,'rows':[]};var _0x47555a=_['map'](db['AnalyticExtractedReport'][_0xc142('0x29')],function(_0x390b05){return{'name':_0x390b05[_0xc142('0x2a')],'type':_0x390b05[_0xc142('0x2b')]['key']};});_0x322d2b[_0xc142('0x2c')]=_[_0xc142('0x2d')](_0x47555a,_0xc142('0x28'));_0x322d2b[_0xc142('0x2e')]=_[_0xc142('0x2f')](_0x439656['query']);_0x322d2b[_0xc142('0x30')]=_[_0xc142('0x31')](_0x322d2b['model'],_0x322d2b[_0xc142('0x2e')]);_0x3da49e[_0xc142('0x32')]=_[_0xc142('0x31')](_0x322d2b['model'],qs[_0xc142('0x33')](_0x439656[_0xc142('0x2e')][_0xc142('0x33')]));_0x3da49e[_0xc142('0x32')]=_0x3da49e[_0xc142('0x32')][_0xc142('0x34')]?_0x3da49e['attributes']:_0x322d2b['model'];if(!_0x439656[_0xc142('0x2e')][_0xc142('0x35')](_0xc142('0x36'))){_0x3da49e[_0xc142('0x18')]=qs['limit'](_0x439656[_0xc142('0x2e')][_0xc142('0x18')]);_0x3da49e[_0xc142('0x1b')]=qs['offset'](_0x439656[_0xc142('0x2e')][_0xc142('0x1b')]);}_0x3da49e[_0xc142('0x37')]=qs['sort'](_0x439656[_0xc142('0x2e')][_0xc142('0x38')]);_0x3da49e[_0xc142('0x39')]=qs[_0xc142('0x30')](_[_0xc142('0x3a')](_0x439656[_0xc142('0x2e')],_0x322d2b[_0xc142('0x30')]),_0x47555a);if(_0x439656[_0xc142('0x2e')][_0xc142('0x3b')]){_0x3da49e[_0xc142('0x39')]=_[_0xc142('0x3c')](_0x3da49e[_0xc142('0x39')],{'$or':_[_0xc142('0x2d')](_0x47555a,function(_0x37d99d){if(_0x37d99d[_0xc142('0x2b')]!==_0xc142('0x3d')){var _0x2369c6={};_0x2369c6[_0x37d99d['name']]={'$like':'%'+_0x439656['query'][_0xc142('0x3b')]+'%'};return _0x2369c6;}})});}_0x3da49e=_['merge']({},_0x3da49e,_0x439656[_0xc142('0x3e')]);var _0x3c3183={'where':_0x3da49e[_0xc142('0x39')]};return db[_0xc142('0x3f')][_0xc142('0x1a')](_0x3c3183)['then'](function(_0x511763){_0x3ae49b[_0xc142('0x1a')]=_0x511763;if(_0x439656['query'][_0xc142('0x40')]){_0x3da49e[_0xc142('0x41')]=[{'all':!![]}];}return db[_0xc142('0x3f')][_0xc142('0x42')](_0x3da49e);})[_0xc142('0x21')](function(_0x1f871f){_0x3ae49b[_0xc142('0x43')]=_0x1f871f;return _0x3ae49b;})['then'](respondWithFilteredResult(_0x419ab9,_0x3da49e))['catch'](handleError(_0x419ab9,null));};exports['show']=function(_0x1d63a1,_0x41d455){var _0x1aa7eb={'raw':!![],'where':{'id':_0x1d63a1[_0xc142('0x44')]['id']}},_0x2fcc38={};_0x2fcc38[_0xc142('0x2c')]=_[_0xc142('0x2f')](db[_0xc142('0x3f')][_0xc142('0x29')]);_0x2fcc38[_0xc142('0x2e')]=_['keys'](_0x1d63a1[_0xc142('0x2e')]);_0x2fcc38[_0xc142('0x30')]=_[_0xc142('0x31')](_0x2fcc38[_0xc142('0x2c')],_0x2fcc38[_0xc142('0x2e')]);_0x1aa7eb[_0xc142('0x32')]=_[_0xc142('0x31')](_0x2fcc38['model'],qs[_0xc142('0x33')](_0x1d63a1[_0xc142('0x2e')][_0xc142('0x33')]));_0x1aa7eb[_0xc142('0x32')]=_0x1aa7eb['attributes'][_0xc142('0x34')]?_0x1aa7eb[_0xc142('0x32')]:_0x2fcc38[_0xc142('0x2c')];if(_0x1d63a1['query'][_0xc142('0x40')]){_0x1aa7eb['include']=[{'all':!![]}];}_0x1aa7eb=_[_0xc142('0x3c')]({},_0x1aa7eb,_0x1d63a1[_0xc142('0x3e')]);return db[_0xc142('0x3f')][_0xc142('0x45')](_0x1aa7eb)[_0xc142('0x21')](handleEntityNotFound(_0x41d455,null))[_0xc142('0x21')](respondWithResult(_0x41d455,null))[_0xc142('0x46')](handleError(_0x41d455,null));};exports[_0xc142('0x47')]=function(_0x422e52,_0x472072){return db[_0xc142('0x3f')][_0xc142('0x47')](_0x422e52[_0xc142('0x48')],{})['then'](function(_0x293e09){var _0x458036=_0x422e52[_0xc142('0x49')][_0xc142('0x23')]({'plain':!![]});if(!_0x458036)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x458036[_0xc142('0x4a')]===_0xc142('0x49')){var _0x2bd9b1=_0x293e09[_0xc142('0x23')]({'plain':!![]});var _0x5959ba=_0xc142('0x4b');return db['UserProfileSection'][_0xc142('0x45')]({'where':{'name':_0x5959ba,'userProfileId':_0x458036['userProfileId']},'raw':!![]})['then'](function(_0x2377cb){if(_0x2377cb&&_0x2377cb[_0xc142('0x4c')]===0x0){return db[_0xc142('0x24')][_0xc142('0x47')]({'name':_0x2bd9b1[_0xc142('0x28')],'resourceId':_0x2bd9b1['id'],'type':_0x2377cb['name'],'sectionId':_0x2377cb['id']},{})[_0xc142('0x21')](function(){return _0x293e09;});}else{return _0x293e09;}})['catch'](function(_0x2fb763){logger[_0xc142('0x26')](_0xc142('0x4d'),_0x2fb763);throw _0x2fb763;});}return _0x293e09;})[_0xc142('0x21')](respondWithResult(_0x472072,0xc9))[_0xc142('0x46')](handleError(_0x472072,null));};exports[_0xc142('0x20')]=function(_0x28aa16,_0x1abb53){if(_0x28aa16[_0xc142('0x48')]['id']){delete _0x28aa16['body']['id'];}return db[_0xc142('0x3f')]['find']({'where':{'id':_0x28aa16[_0xc142('0x44')]['id']}})[_0xc142('0x21')](handleEntityNotFound(_0x1abb53,null))['then'](saveUpdates(_0x28aa16[_0xc142('0x48')],null))['then'](respondWithResult(_0x1abb53,null))[_0xc142('0x46')](handleError(_0x1abb53,null));};exports[_0xc142('0x22')]=function(_0x4ed10f,_0x2d78ec){return db[_0xc142('0x3f')][_0xc142('0x45')]({'where':{'id':_0x4ed10f[_0xc142('0x44')]['id']}})[_0xc142('0x21')](handleEntityNotFound(_0x2d78ec,null))['then'](removeEntity(_0x2d78ec,null))['catch'](handleError(_0x2d78ec,null));};exports['download']=function(_0x42f579,_0x23692b,_0x490747){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x42f579['params']['id']},'attributes':[_0xc142('0x28'),'basename','savename',_0xc142('0x4e')],'raw':!![]})[_0xc142('0x21')](handleEntityNotFound(_0x23692b,null))['then'](function(_0x3674d7){if(_0x3674d7){if(!fs[_0xc142('0x4f')](path[_0xc142('0x50')](config[_0xc142('0x51')],_0xc142('0x52'),_0x3674d7[_0xc142('0x53')]))){throw new db[(_0xc142('0x54'))][(_0xc142('0x55'))](_0xc142('0x56'));}if(_0x42f579[_0xc142('0x2e')]['exists']){return _0x23692b[_0xc142('0x16')](0xc8);}return _0x23692b[_0xc142('0x57')](path[_0xc142('0x50')](config[_0xc142('0x51')],_0xc142('0x52'),_0x3674d7['savename']),util[_0xc142('0x58')](_0xc142('0x59'),_0x3674d7['basename']||_0x3674d7[_0xc142('0x28')],_0x3674d7['output'][_0xc142('0x5a')]()));}})[_0xc142('0x46')](handleError(_0x23692b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index cf06400..c60a1fa 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 _0x2334=['../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x43a108,_0x5d559c){var _0x27838c=function(_0x187114){while(--_0x187114){_0x43a108['push'](_0x43a108['shift']());}};_0x27838c(++_0x5d559c);}(_0x2334,0x1e6));var _0x4233=function(_0x2cfb2b,_0x30c0f1){_0x2cfb2b=_0x2cfb2b-0x0;var _0x403a5c=_0x2334[_0x2cfb2b];return _0x403a5c;};'use strict';var _=require(_0x4233('0x0'));var util=require(_0x4233('0x1'));var logger=require(_0x4233('0x2'))(_0x4233('0x3'));var moment=require('moment');var BPromise=require(_0x4233('0x4'));var rp=require(_0x4233('0x5'));var fs=require('fs');var path=require(_0x4233('0x6'));var rimraf=require(_0x4233('0x7'));var config=require(_0x4233('0x8'));var attributes=require(_0x4233('0x9'));module[_0x4233('0xa')]=function(_0x1bff29,_0x12d09d){return _0x1bff29[_0x4233('0xb')](_0x4233('0xc'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf951=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x9ccc17,_0x1d087c){var _0x46e989=function(_0x302510){while(--_0x302510){_0x9ccc17['push'](_0x9ccc17['shift']());}};_0x46e989(++_0x1d087c);}(_0xf951,0x192));var _0x1f95=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0xf951[_0x420f2a];return _0x28f802;};'use strict';var _=require(_0x1f95('0x0'));var util=require(_0x1f95('0x1'));var logger=require(_0x1f95('0x2'))('api');var moment=require(_0x1f95('0x3'));var BPromise=require(_0x1f95('0x4'));var rp=require(_0x1f95('0x5'));var fs=require('fs');var path=require(_0x1f95('0x6'));var rimraf=require(_0x1f95('0x7'));var config=require(_0x1f95('0x8'));var attributes=require(_0x1f95('0x9'));module[_0x1f95('0xa')]=function(_0x544067,_0xd5500b){return _0x544067['define']('AnalyticExtractedReport',attributes,{'tableName':_0x1f95('0xb'),'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 eeed9a8..3444f4d 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 _0x671e=['../../config/logger','rpc','jayson/promise','client','request','then','info','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','AnalyticExtractedReport,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x5024c7,_0xd560bd){var _0xf2f316=function(_0x4d7748){while(--_0x4d7748){_0x5024c7['push'](_0x5024c7['shift']());}};_0xf2f316(++_0xd560bd);}(_0x671e,0xd6));var _0xe671=function(_0x2d7b60,_0x1a0fbe){_0x2d7b60=_0x2d7b60-0x0;var _0x36b9e1=_0x671e[_0x2d7b60];return _0x36b9e1;};'use strict';var _=require(_0xe671('0x0'));var util=require(_0xe671('0x1'));var moment=require(_0xe671('0x2'));var BPromise=require('bluebird');var rs=require(_0xe671('0x3'));var fs=require('fs');var Redis=require(_0xe671('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe671('0x5'));var logger=require(_0xe671('0x6'))(_0xe671('0x7'));var config=require('../../config/environment');var jayson=require(_0xe671('0x8'));var client=jayson[_0xe671('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b847,_0x7ec84b,_0xda7edc){return new BPromise(function(_0x4033d9,_0x48f194){return client[_0xe671('0xa')](_0x27b847,_0xda7edc)[_0xe671('0xb')](function(_0x3f9985){logger[_0xe671('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x7ec84b,'request\x20sent');logger[_0xe671('0xd')](_0xe671('0xe'),_0x7ec84b,_0xe671('0xf'),JSON['stringify'](_0x3f9985));if(_0x3f9985[_0xe671('0x10')]){if(_0x3f9985[_0xe671('0x10')][_0xe671('0x11')]===0x1f4){logger[_0xe671('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x7ec84b,_0x3f9985[_0xe671('0x10')]['message']);return _0x48f194(_0x3f9985[_0xe671('0x10')]['message']);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x7ec84b,_0x3f9985['error'][_0xe671('0x12')]);return _0x4033d9(_0x3f9985[_0xe671('0x10')][_0xe671('0x12')]);}else{logger[_0xe671('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x7ec84b,_0xe671('0xf'));_0x4033d9(_0x3f9985[_0xe671('0x13')][_0xe671('0x12')]);}})[_0xe671('0x14')](function(_0x381dd6){logger['error'](_0xe671('0x15'),_0x7ec84b,_0x381dd6);_0x48f194(_0x381dd6);});});} \ No newline at end of file +var _0x81e8=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch'];(function(_0x2a5bb7,_0x3a0bf3){var _0x503330=function(_0x61d76b){while(--_0x61d76b){_0x2a5bb7['push'](_0x2a5bb7['shift']());}};_0x503330(++_0x3a0bf3);}(_0x81e8,0x168));var _0x881e=function(_0x2340be,_0x2b92fd){_0x2340be=_0x2340be-0x0;var _0x278704=_0x81e8[_0x2340be];return _0x278704;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x881e('0x0'));var BPromise=require(_0x881e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x881e('0x2'));var db=require(_0x881e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x881e('0x4'))('rpc');var config=require(_0x881e('0x5'));var jayson=require(_0x881e('0x6'));var client=jayson[_0x881e('0x7')][_0x881e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x318dcd,_0x474273,_0x950463){return new BPromise(function(_0xd3fd39,_0x515686){return client[_0x881e('0x9')](_0x318dcd,_0x950463)[_0x881e('0xa')](function(_0xfae24d){logger[_0x881e('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x474273,_0x881e('0xc'));logger[_0x881e('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x474273,_0x881e('0xc'),JSON[_0x881e('0xe')](_0xfae24d));if(_0xfae24d[_0x881e('0xf')]){if(_0xfae24d[_0x881e('0xf')]['code']===0x1f4){logger['error'](_0x881e('0x10'),_0x474273,_0xfae24d[_0x881e('0xf')]['message']);return _0x515686(_0xfae24d['error'][_0x881e('0x11')]);}logger[_0x881e('0xf')](_0x881e('0x10'),_0x474273,_0xfae24d[_0x881e('0xf')][_0x881e('0x11')]);return _0xd3fd39(_0xfae24d[_0x881e('0xf')]['message']);}else{logger[_0x881e('0xb')](_0x881e('0x10'),_0x474273,_0x881e('0xc'));_0xd3fd39(_0xfae24d[_0x881e('0x12')]['message']);}})[_0x881e('0x13')](function(_0xd9734b){logger[_0x881e('0xf')](_0x881e('0x10'),_0x474273,_0xd9734b);_0x515686(_0xd9734b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 2a5fb75..55bef8d 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 _0x40c3=['delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','download','post','put','update'];(function(_0x236c6f,_0x49d2de){var _0x1228ca=function(_0x174b40){while(--_0x174b40){_0x236c6f['push'](_0x236c6f['shift']());}};_0x1228ca(++_0x49d2de);}(_0x40c3,0xfe));var _0x340c=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x40c3[_0x174ef5];return _0x1cc379;};'use strict';var multer=require('multer');var util=require(_0x340c('0x0'));var path=require(_0x340c('0x1'));var timeout=require('connect-timeout');var express=require(_0x340c('0x2'));var router=express[_0x340c('0x3')]();var fs_extra=require(_0x340c('0x4'));var auth=require(_0x340c('0x5'));var interaction=require(_0x340c('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x340c('0x7')]('/',auth[_0x340c('0x8')](),controller[_0x340c('0x9')]);router[_0x340c('0x7')](_0x340c('0xa'),auth[_0x340c('0x8')](),controller[_0x340c('0xb')]);router['get']('/:id/download',auth[_0x340c('0x8')](),controller[_0x340c('0xc')]);router[_0x340c('0xd')]('/',auth[_0x340c('0x8')](),controller['create']);router[_0x340c('0xe')](_0x340c('0xa'),auth[_0x340c('0x8')](),controller[_0x340c('0xf')]);router[_0x340c('0x10')](_0x340c('0xa'),auth[_0x340c('0x8')](),controller['destroy']);module[_0x340c('0x11')]=router; \ No newline at end of file +var _0x483d=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','/:id/download','isAuthenticated','post','create'];(function(_0x1b46ae,_0x3e272a){var _0x3323d9=function(_0x162cb7){while(--_0x162cb7){_0x1b46ae['push'](_0x1b46ae['shift']());}};_0x3323d9(++_0x3e272a);}(_0x483d,0xc1));var _0xd483=function(_0x2b4cb4,_0x18a0ad){_0x2b4cb4=_0x2b4cb4-0x0;var _0x112fb6=_0x483d[_0x2b4cb4];return _0x112fb6;};'use strict';var multer=require(_0xd483('0x0'));var util=require(_0xd483('0x1'));var path=require(_0xd483('0x2'));var timeout=require(_0xd483('0x3'));var express=require(_0xd483('0x4'));var router=express[_0xd483('0x5')]();var fs_extra=require(_0xd483('0x6'));var auth=require(_0xd483('0x7'));var interaction=require(_0xd483('0x8'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xd483('0x9')]('/',auth['isAuthenticated'](),controller[_0xd483('0xa')]);router['get'](_0xd483('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd483('0x9')](_0xd483('0xc'),auth[_0xd483('0xd')](),controller['download']);router[_0xd483('0xe')]('/',auth[_0xd483('0xd')](),controller[_0xd483('0xf')]);router[_0xd483('0x10')](_0xd483('0xb'),auth[_0xd483('0xd')](),controller[_0xd483('0x11')]);router[_0xd483('0x12')](_0xd483('0xb'),auth[_0xd483('0xd')](),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 055d375..4190442 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 _0x7f85=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x384e27,_0x21ca5b){var _0x2ccfc5=function(_0x57bde7){while(--_0x57bde7){_0x384e27['push'](_0x384e27['shift']());}};_0x2ccfc5(++_0x21ca5b);}(_0x7f85,0x174));var _0x57f8=function(_0x3bd608,_0x4983d3){_0x3bd608=_0x3bd608-0x0;var _0x538339=_0x7f85[_0x3bd608];return _0x538339;};'use strict';var Sequelize=require(_0x57f8('0x0'));module[_0x57f8('0x1')]={'field':{'type':Sequelize[_0x57f8('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x57f8('0x3')]},'format':{'type':Sequelize[_0x57f8('0x3')]},'groupBy':{'type':Sequelize[_0x57f8('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x57f8('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xac53=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xac53,0xef));var _0x3ac5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac53[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3ac5('0x0'));module[_0x3ac5('0x1')]={'field':{'type':Sequelize[_0x3ac5('0x2')]},'alias':{'type':Sequelize[_0x3ac5('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x3ac5('0x3')]},'groupBy':{'type':Sequelize[_0x3ac5('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x3ac5('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 4903e95..d81f93e 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 _0x0a1c=['fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','bulkCreate','body','update','params','destroy','ids','addFields','findOne','sequelize','transaction','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes'];(function(_0x4a1385,_0x368d60){var _0xf4e8c2=function(_0x358911){while(--_0x358911){_0x4a1385['push'](_0x4a1385['shift']());}};_0xf4e8c2(++_0x368d60);}(_0x0a1c,0x7a));var _0xc0a1=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x0a1c[_0x2307fa];return _0x496486;};'use strict';var emlformat=require(_0xc0a1('0x0'));var rimraf=require(_0xc0a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc0a1('0x2'));var moment=require(_0xc0a1('0x3'));var BPromise=require(_0xc0a1('0x4'));var Mustache=require(_0xc0a1('0x5'));var util=require('util');var path=require(_0xc0a1('0x6'));var sox=require(_0xc0a1('0x7'));var csv=require(_0xc0a1('0x8'));var ejs=require(_0xc0a1('0x9'));var fs=require('fs');var fs_extra=require(_0xc0a1('0xa'));var _=require(_0xc0a1('0xb'));var squel=require(_0xc0a1('0xc'));var crypto=require('crypto');var jsforce=require(_0xc0a1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc0a1('0x8'));var querystring=require(_0xc0a1('0xe'));var Papa=require('papaparse');var Redis=require(_0xc0a1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc0a1('0x10'));var as=require(_0xc0a1('0x11'));var hardwareService=require(_0xc0a1('0x12'));var logger=require('../../config/logger')(_0xc0a1('0x13'));var utils=require(_0xc0a1('0x14'));var config=require(_0xc0a1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0a1('0x16'))['db'];function respondWithStatusCode(_0x3fbaa4,_0x224c49){_0x224c49=_0x224c49||0xcc;return function(_0x430272){if(_0x430272){return _0x3fbaa4[_0xc0a1('0x17')](_0x224c49);}return _0x3fbaa4[_0xc0a1('0x18')](_0x224c49)[_0xc0a1('0x19')]();};}function respondWithResult(_0x4e612f,_0x22d02c){_0x22d02c=_0x22d02c||0xc8;return function(_0x446d76){if(_0x446d76){return _0x4e612f[_0xc0a1('0x18')](_0x22d02c)['json'](_0x446d76);}};}function respondWithFilteredResult(_0x1b3d3a,_0x6545e){return function(_0x1acf75){if(_0x1acf75){var _0x54acc5=typeof _0x6545e[_0xc0a1('0x1a')]===_0xc0a1('0x1b')&&typeof _0x6545e[_0xc0a1('0x1c')]==='undefined';var _0x38e063=_0x1acf75[_0xc0a1('0x1d')];var _0x176850=_0x54acc5?0x0:_0x6545e[_0xc0a1('0x1a')];var _0x33a91f=_0x54acc5?_0x1acf75[_0xc0a1('0x1d')]:_0x6545e['offset']+_0x6545e[_0xc0a1('0x1c')];var _0x35c55e;if(_0x33a91f>=_0x38e063){_0x33a91f=_0x38e063;_0x35c55e=0xc8;}else{_0x35c55e=0xce;}_0x1b3d3a[_0xc0a1('0x18')](_0x35c55e);return _0x1b3d3a[_0xc0a1('0x1e')]('Content-Range',_0x176850+'-'+_0x33a91f+'/'+_0x38e063)[_0xc0a1('0x1f')](_0x1acf75);}return null;};}function patchUpdates(_0x117259){return function(_0xb11365){try{jsonpatch[_0xc0a1('0x20')](_0xb11365,_0x117259,!![]);}catch(_0x5904ee){return BPromise[_0xc0a1('0x21')](_0x5904ee);}return _0xb11365[_0xc0a1('0x22')]();};}function saveUpdates(_0x221a35,_0xb46e0e){return function(_0x56cb73){if(_0x56cb73){return _0x56cb73['update'](_0x221a35)[_0xc0a1('0x23')](function(_0x26848c){return _0x26848c;});}return null;};}function removeEntity(_0x32e785,_0x1e19d5){return function(_0x3e75c8){if(_0x3e75c8){return _0x3e75c8['destroy']()['then'](function(){_0x32e785[_0xc0a1('0x18')](0xcc)[_0xc0a1('0x19')]();});}};}function handleEntityNotFound(_0x549197,_0x42d761){return function(_0xea0f0d){if(!_0xea0f0d){_0x549197[_0xc0a1('0x17')](0x194);}return _0xea0f0d;};}function handleError(_0x1ecb37,_0x11cbeb){_0x11cbeb=_0x11cbeb||0x1f4;return function(_0x47f927){logger[_0xc0a1('0x24')](_0x47f927[_0xc0a1('0x25')]);if(_0x47f927[_0xc0a1('0x26')]){delete _0x47f927[_0xc0a1('0x26')];}_0x1ecb37['status'](_0x11cbeb)[_0xc0a1('0x27')](_0x47f927);};}exports[_0xc0a1('0x28')]=function(_0x5bdd7e,_0x1649ac){var _0x195502={},_0x5249c0={},_0x409de2={'count':0x0,'rows':[]};var _0x5df710=_[_0xc0a1('0x29')](db[_0xc0a1('0x2a')][_0xc0a1('0x2b')],function(_0x401f5d){return{'name':_0x401f5d[_0xc0a1('0x2c')],'type':_0x401f5d['type'][_0xc0a1('0x2d')]};});_0x5249c0[_0xc0a1('0x2e')]=_[_0xc0a1('0x29')](_0x5df710,'name');_0x5249c0['query']=_[_0xc0a1('0x2f')](_0x5bdd7e[_0xc0a1('0x30')]);_0x5249c0['filters']=_[_0xc0a1('0x31')](_0x5249c0[_0xc0a1('0x2e')],_0x5249c0[_0xc0a1('0x30')]);_0x195502[_0xc0a1('0x32')]=_['intersection'](_0x5249c0[_0xc0a1('0x2e')],qs[_0xc0a1('0x33')](_0x5bdd7e[_0xc0a1('0x30')][_0xc0a1('0x33')]));_0x195502[_0xc0a1('0x32')]=_0x195502[_0xc0a1('0x32')][_0xc0a1('0x34')]?_0x195502[_0xc0a1('0x32')]:_0x5249c0[_0xc0a1('0x2e')];if(!_0x5bdd7e[_0xc0a1('0x30')][_0xc0a1('0x35')](_0xc0a1('0x36'))){_0x195502[_0xc0a1('0x1c')]=qs[_0xc0a1('0x1c')](_0x5bdd7e['query']['limit']);_0x195502[_0xc0a1('0x1a')]=qs[_0xc0a1('0x1a')](_0x5bdd7e[_0xc0a1('0x30')]['offset']);}_0x195502[_0xc0a1('0x37')]=qs[_0xc0a1('0x38')](_0x5bdd7e[_0xc0a1('0x30')]['sort']);_0x195502[_0xc0a1('0x39')]=qs[_0xc0a1('0x3a')](_[_0xc0a1('0x3b')](_0x5bdd7e[_0xc0a1('0x30')],_0x5249c0['filters']),_0x5df710);if(_0x5bdd7e[_0xc0a1('0x30')][_0xc0a1('0x3c')]){_0x195502[_0xc0a1('0x39')]=_[_0xc0a1('0x3d')](_0x195502[_0xc0a1('0x39')],{'$or':_[_0xc0a1('0x29')](_0x5df710,function(_0x39b974){if(_0x39b974[_0xc0a1('0x3e')]!==_0xc0a1('0x3f')){var _0x42119d={};_0x42119d[_0x39b974[_0xc0a1('0x26')]]={'$like':'%'+_0x5bdd7e[_0xc0a1('0x30')]['filter']+'%'};return _0x42119d;}})});}_0x195502=_[_0xc0a1('0x3d')]({},_0x195502,_0x5bdd7e[_0xc0a1('0x40')]);var _0x5d94ce={'where':_0x195502[_0xc0a1('0x39')]};return db['AnalyticFieldReport'][_0xc0a1('0x1d')](_0x5d94ce)[_0xc0a1('0x23')](function(_0xc50e76){_0x409de2['count']=_0xc50e76;if(_0x5bdd7e[_0xc0a1('0x30')][_0xc0a1('0x41')]){_0x195502['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xc0a1('0x42')](_0x195502);})[_0xc0a1('0x23')](function(_0x12c4de){_0x409de2[_0xc0a1('0x43')]=_0x12c4de;return _0x409de2;})['then'](respondWithFilteredResult(_0x1649ac,_0x195502))[_0xc0a1('0x44')](handleError(_0x1649ac,null));};exports[_0xc0a1('0x45')]=function(_0x5d565d,_0xa6f31d){var _0x12856d={'raw':![],'where':{'id':_0x5d565d['params']['id']}},_0x3ce3c7={};_0x3ce3c7[_0xc0a1('0x2e')]=_[_0xc0a1('0x2f')](db['AnalyticFieldReport']['rawAttributes']);_0x3ce3c7[_0xc0a1('0x30')]=_[_0xc0a1('0x2f')](_0x5d565d[_0xc0a1('0x30')]);_0x3ce3c7['filters']=_[_0xc0a1('0x31')](_0x3ce3c7['model'],_0x3ce3c7['query']);_0x12856d['attributes']=_[_0xc0a1('0x31')](_0x3ce3c7[_0xc0a1('0x2e')],qs[_0xc0a1('0x33')](_0x5d565d[_0xc0a1('0x30')][_0xc0a1('0x33')]));_0x12856d['attributes']=_0x12856d[_0xc0a1('0x32')][_0xc0a1('0x34')]?_0x12856d[_0xc0a1('0x32')]:_0x3ce3c7[_0xc0a1('0x2e')];if(_0x5d565d[_0xc0a1('0x30')][_0xc0a1('0x41')]){_0x12856d[_0xc0a1('0x46')]=[{'all':!![]}];}_0x12856d=_[_0xc0a1('0x3d')]({},_0x12856d,_0x5d565d[_0xc0a1('0x40')]);return db[_0xc0a1('0x2a')][_0xc0a1('0x47')](_0x12856d)[_0xc0a1('0x23')](handleEntityNotFound(_0xa6f31d,null))[_0xc0a1('0x23')](respondWithResult(_0xa6f31d,null))[_0xc0a1('0x44')](handleError(_0xa6f31d,null));};exports[_0xc0a1('0x48')]=function(_0x1b4a40,_0x3ca1e5){return db[_0xc0a1('0x2a')][_0xc0a1('0x48')](_0x1b4a40['body'],{})['then'](respondWithResult(_0x3ca1e5,0xc9))['catch'](handleError(_0x3ca1e5,null));};exports[_0xc0a1('0x49')]=function(_0xc874d3,_0x596d3a){return db[_0xc0a1('0x2a')]['bulkCreate'](_0xc874d3[_0xc0a1('0x4a')],{'raw':![],'individualHooks':!![]})[_0xc0a1('0x23')](respondWithResult(_0x596d3a,0xc9))[_0xc0a1('0x44')](handleError(_0x596d3a,null));};exports[_0xc0a1('0x4b')]=function(_0x55d06b,_0x5ca4ee){if(_0x55d06b[_0xc0a1('0x4a')]['id']){delete _0x55d06b[_0xc0a1('0x4a')]['id'];}return db[_0xc0a1('0x2a')][_0xc0a1('0x47')]({'where':{'id':_0x55d06b[_0xc0a1('0x4c')]['id']}})[_0xc0a1('0x23')](handleEntityNotFound(_0x5ca4ee,null))[_0xc0a1('0x23')](saveUpdates(_0x55d06b['body'],null))['then'](respondWithResult(_0x5ca4ee,null))[_0xc0a1('0x44')](handleError(_0x5ca4ee,null));};exports['destroy']=function(_0x2d94f3,_0x2bf4f5){return db[_0xc0a1('0x2a')][_0xc0a1('0x47')]({'where':{'id':_0x2d94f3['params']['id']}})[_0xc0a1('0x23')](handleEntityNotFound(_0x2bf4f5,null))[_0xc0a1('0x23')](removeEntity(_0x2bf4f5,null))[_0xc0a1('0x44')](handleError(_0x2bf4f5,null));};exports['bulkDestroy']=function(_0x2f8ea7,_0x31d2f3){return db[_0xc0a1('0x2a')][_0xc0a1('0x4d')]({'where':{'id':_0x2f8ea7[_0xc0a1('0x30')][_0xc0a1('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xc0a1('0x23')](respondWithResult(_0x31d2f3,0xcc))[_0xc0a1('0x44')](handleError(_0x31d2f3,null));};exports[_0xc0a1('0x4f')]=function(_0x24132d,_0x56c3d1,_0x56aab3){return db['AnalyticCustomReport'][_0xc0a1('0x50')]({'where':{'id':_0x24132d[_0xc0a1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x56c3d1,null))[_0xc0a1('0x23')](function(_0x1d8dcb){if(_0x1d8dcb){return db[_0xc0a1('0x51')][_0xc0a1('0x52')](function(_0x440d95){return db[_0xc0a1('0x2a')][_0xc0a1('0x4d')]({'where':{'CustomReportId':_0x24132d['params']['id']},'transaction':_0x440d95})['then'](function(_0xcd6ab4){var _0x40b9d4=_[_0xc0a1('0x29')](_0x24132d[_0xc0a1('0x4a')],function(_0x5dfb9e){delete _0x5dfb9e['id'];_0x5dfb9e['CustomReportId']=_0x24132d[_0xc0a1('0x4c')]['id'];return _0x5dfb9e;});return db[_0xc0a1('0x2a')][_0xc0a1('0x49')](_0x40b9d4,{'transaction':_0x440d95});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x24132d[_0xc0a1('0x4c')]['id']}});});}})[_0xc0a1('0x23')](respondWithResult(_0x56c3d1,null))['catch'](handleError(_0x56c3d1,null));}; \ No newline at end of file +var _0x2128=['params','merge','find','create','bulkCreate','body','bulkDestroy','addFields','sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','AnalyticFieldReport','includeAll','include','catch','show'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x2128,0x1e3));var _0x8212=function(_0x4f918e,_0xcd500e){_0x4f918e=_0x4f918e-0x0;var _0x15ee0c=_0x2128[_0x4f918e];return _0x15ee0c;};'use strict';var emlformat=require(_0x8212('0x0'));var rimraf=require(_0x8212('0x1'));var zipdir=require(_0x8212('0x2'));var jsonpatch=require(_0x8212('0x3'));var rp=require(_0x8212('0x4'));var moment=require('moment');var BPromise=require(_0x8212('0x5'));var Mustache=require('mustache');var util=require(_0x8212('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8212('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8212('0x8'));var squel=require(_0x8212('0x9'));var crypto=require(_0x8212('0xa'));var jsforce=require(_0x8212('0xb'));var deskjs=require(_0x8212('0xc'));var toCsv=require(_0x8212('0xd'));var querystring=require(_0x8212('0xe'));var Papa=require('papaparse');var Redis=require(_0x8212('0xf'));var authService=require(_0x8212('0x10'));var qs=require(_0x8212('0x11'));var as=require(_0x8212('0x12'));var hardwareService=require(_0x8212('0x13'));var logger=require(_0x8212('0x14'))(_0x8212('0x15'));var utils=require(_0x8212('0x16'));var config=require(_0x8212('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8212('0x18'))['db'];function respondWithStatusCode(_0x3385c1,_0x4f74ca){_0x4f74ca=_0x4f74ca||0xcc;return function(_0x5757b5){if(_0x5757b5){return _0x3385c1[_0x8212('0x19')](_0x4f74ca);}return _0x3385c1[_0x8212('0x1a')](_0x4f74ca)[_0x8212('0x1b')]();};}function respondWithResult(_0x395904,_0x14c17a){_0x14c17a=_0x14c17a||0xc8;return function(_0xffb143){if(_0xffb143){return _0x395904['status'](_0x14c17a)[_0x8212('0x1c')](_0xffb143);}};}function respondWithFilteredResult(_0x2ce1ca,_0x5f3a49){return function(_0x58f542){if(_0x58f542){var _0x2ce07c=typeof _0x5f3a49[_0x8212('0x1d')]===_0x8212('0x1e')&&typeof _0x5f3a49['limit']==='undefined';var _0x413e81=_0x58f542['count'];var _0x3e65c3=_0x2ce07c?0x0:_0x5f3a49[_0x8212('0x1d')];var _0x274101=_0x2ce07c?_0x58f542[_0x8212('0x1f')]:_0x5f3a49[_0x8212('0x1d')]+_0x5f3a49['limit'];var _0x19eedf;if(_0x274101>=_0x413e81){_0x274101=_0x413e81;_0x19eedf=0xc8;}else{_0x19eedf=0xce;}_0x2ce1ca[_0x8212('0x1a')](_0x19eedf);return _0x2ce1ca[_0x8212('0x20')](_0x8212('0x21'),_0x3e65c3+'-'+_0x274101+'/'+_0x413e81)[_0x8212('0x1c')](_0x58f542);}return null;};}function patchUpdates(_0x3aa93c){return function(_0x14dd8a){try{jsonpatch[_0x8212('0x22')](_0x14dd8a,_0x3aa93c,!![]);}catch(_0x203cca){return BPromise[_0x8212('0x23')](_0x203cca);}return _0x14dd8a[_0x8212('0x24')]();};}function saveUpdates(_0x264933,_0x2c5587){return function(_0x137dd8){if(_0x137dd8){return _0x137dd8[_0x8212('0x25')](_0x264933)['then'](function(_0x54c056){return _0x54c056;});}return null;};}function removeEntity(_0x55be1d,_0x53daa4){return function(_0x4a6056){if(_0x4a6056){return _0x4a6056[_0x8212('0x26')]()[_0x8212('0x27')](function(){_0x55be1d[_0x8212('0x1a')](0xcc)[_0x8212('0x1b')]();});}};}function handleEntityNotFound(_0x332124,_0x5ba21d){return function(_0x3978da){if(!_0x3978da){_0x332124[_0x8212('0x19')](0x194);}return _0x3978da;};}function handleError(_0x431139,_0xfa3216){_0xfa3216=_0xfa3216||0x1f4;return function(_0x578055){logger[_0x8212('0x28')](_0x578055[_0x8212('0x29')]);if(_0x578055[_0x8212('0x2a')]){delete _0x578055['name'];}_0x431139[_0x8212('0x1a')](_0xfa3216)['send'](_0x578055);};}exports[_0x8212('0x2b')]=function(_0x51450d,_0x55ce2c){var _0x4e8a2={},_0x1222ed={},_0xd2d53f={'count':0x0,'rows':[]};var _0x478c12=_[_0x8212('0x2c')](db['AnalyticFieldReport'][_0x8212('0x2d')],function(_0x1172f4){return{'name':_0x1172f4[_0x8212('0x2e')],'type':_0x1172f4[_0x8212('0x2f')]['key']};});_0x1222ed[_0x8212('0x30')]=_[_0x8212('0x2c')](_0x478c12,'name');_0x1222ed[_0x8212('0x31')]=_[_0x8212('0x32')](_0x51450d[_0x8212('0x31')]);_0x1222ed[_0x8212('0x33')]=_[_0x8212('0x34')](_0x1222ed[_0x8212('0x30')],_0x1222ed[_0x8212('0x31')]);_0x4e8a2['attributes']=_[_0x8212('0x34')](_0x1222ed[_0x8212('0x30')],qs[_0x8212('0x35')](_0x51450d[_0x8212('0x31')][_0x8212('0x35')]));_0x4e8a2[_0x8212('0x36')]=_0x4e8a2[_0x8212('0x36')][_0x8212('0x37')]?_0x4e8a2[_0x8212('0x36')]:_0x1222ed[_0x8212('0x30')];if(!_0x51450d['query'][_0x8212('0x38')](_0x8212('0x39'))){_0x4e8a2[_0x8212('0x3a')]=qs[_0x8212('0x3a')](_0x51450d[_0x8212('0x31')]['limit']);_0x4e8a2['offset']=qs[_0x8212('0x1d')](_0x51450d[_0x8212('0x31')]['offset']);}_0x4e8a2[_0x8212('0x3b')]=qs[_0x8212('0x3c')](_0x51450d[_0x8212('0x31')][_0x8212('0x3c')]);_0x4e8a2[_0x8212('0x3d')]=qs[_0x8212('0x33')](_[_0x8212('0x3e')](_0x51450d[_0x8212('0x31')],_0x1222ed[_0x8212('0x33')]),_0x478c12);if(_0x51450d[_0x8212('0x31')][_0x8212('0x3f')]){_0x4e8a2[_0x8212('0x3d')]=_['merge'](_0x4e8a2['where'],{'$or':_[_0x8212('0x2c')](_0x478c12,function(_0x1cc23f){if(_0x1cc23f[_0x8212('0x2f')]!=='VIRTUAL'){var _0x255662={};_0x255662[_0x1cc23f[_0x8212('0x2a')]]={'$like':'%'+_0x51450d[_0x8212('0x31')][_0x8212('0x3f')]+'%'};return _0x255662;}})});}_0x4e8a2=_['merge']({},_0x4e8a2,_0x51450d[_0x8212('0x40')]);var _0x4d1520={'where':_0x4e8a2[_0x8212('0x3d')]};return db[_0x8212('0x41')][_0x8212('0x1f')](_0x4d1520)[_0x8212('0x27')](function(_0x4832d9){_0xd2d53f[_0x8212('0x1f')]=_0x4832d9;if(_0x51450d[_0x8212('0x31')][_0x8212('0x42')]){_0x4e8a2[_0x8212('0x43')]=[{'all':!![]}];}return db[_0x8212('0x41')]['findAll'](_0x4e8a2);})['then'](function(_0x3a9182){_0xd2d53f['rows']=_0x3a9182;return _0xd2d53f;})[_0x8212('0x27')](respondWithFilteredResult(_0x55ce2c,_0x4e8a2))[_0x8212('0x44')](handleError(_0x55ce2c,null));};exports[_0x8212('0x45')]=function(_0x43c3b9,_0x45e9d5){var _0x1a5cd1={'raw':![],'where':{'id':_0x43c3b9[_0x8212('0x46')]['id']}},_0x5ac481={};_0x5ac481['model']=_[_0x8212('0x32')](db[_0x8212('0x41')][_0x8212('0x2d')]);_0x5ac481[_0x8212('0x31')]=_[_0x8212('0x32')](_0x43c3b9[_0x8212('0x31')]);_0x5ac481[_0x8212('0x33')]=_[_0x8212('0x34')](_0x5ac481['model'],_0x5ac481[_0x8212('0x31')]);_0x1a5cd1[_0x8212('0x36')]=_[_0x8212('0x34')](_0x5ac481[_0x8212('0x30')],qs['fields'](_0x43c3b9['query'][_0x8212('0x35')]));_0x1a5cd1[_0x8212('0x36')]=_0x1a5cd1[_0x8212('0x36')][_0x8212('0x37')]?_0x1a5cd1[_0x8212('0x36')]:_0x5ac481[_0x8212('0x30')];if(_0x43c3b9[_0x8212('0x31')][_0x8212('0x42')]){_0x1a5cd1[_0x8212('0x43')]=[{'all':!![]}];}_0x1a5cd1=_[_0x8212('0x47')]({},_0x1a5cd1,_0x43c3b9[_0x8212('0x40')]);return db['AnalyticFieldReport'][_0x8212('0x48')](_0x1a5cd1)[_0x8212('0x27')](handleEntityNotFound(_0x45e9d5,null))[_0x8212('0x27')](respondWithResult(_0x45e9d5,null))[_0x8212('0x44')](handleError(_0x45e9d5,null));};exports[_0x8212('0x49')]=function(_0x2a4f18,_0x23127b){return db['AnalyticFieldReport'][_0x8212('0x49')](_0x2a4f18['body'],{})[_0x8212('0x27')](respondWithResult(_0x23127b,0xc9))['catch'](handleError(_0x23127b,null));};exports['bulkCreate']=function(_0x112a53,_0x34b1ac){return db['AnalyticFieldReport'][_0x8212('0x4a')](_0x112a53[_0x8212('0x4b')],{'raw':![],'individualHooks':!![]})[_0x8212('0x27')](respondWithResult(_0x34b1ac,0xc9))['catch'](handleError(_0x34b1ac,null));};exports[_0x8212('0x25')]=function(_0x353f66,_0x204be8){if(_0x353f66[_0x8212('0x4b')]['id']){delete _0x353f66[_0x8212('0x4b')]['id'];}return db['AnalyticFieldReport'][_0x8212('0x48')]({'where':{'id':_0x353f66['params']['id']}})[_0x8212('0x27')](handleEntityNotFound(_0x204be8,null))[_0x8212('0x27')](saveUpdates(_0x353f66[_0x8212('0x4b')],null))[_0x8212('0x27')](respondWithResult(_0x204be8,null))[_0x8212('0x44')](handleError(_0x204be8,null));};exports[_0x8212('0x26')]=function(_0x8d5b10,_0x59650e){return db[_0x8212('0x41')][_0x8212('0x48')]({'where':{'id':_0x8d5b10[_0x8212('0x46')]['id']}})[_0x8212('0x27')](handleEntityNotFound(_0x59650e,null))[_0x8212('0x27')](removeEntity(_0x59650e,null))[_0x8212('0x44')](handleError(_0x59650e,null));};exports[_0x8212('0x4c')]=function(_0x3c8ff6,_0x3a3ca4){return db[_0x8212('0x41')][_0x8212('0x26')]({'where':{'id':_0x3c8ff6[_0x8212('0x31')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x8212('0x27')](respondWithResult(_0x3a3ca4,0xcc))['catch'](handleError(_0x3a3ca4,null));};exports[_0x8212('0x4d')]=function(_0x4c01c6,_0x2a81b2,_0x5dc879){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x4c01c6[_0x8212('0x46')]['id']}})[_0x8212('0x27')](handleEntityNotFound(_0x2a81b2,null))[_0x8212('0x27')](function(_0x37a897){if(_0x37a897){return db[_0x8212('0x4e')]['transaction'](function(_0x2137d4){return db['AnalyticFieldReport'][_0x8212('0x26')]({'where':{'CustomReportId':_0x4c01c6[_0x8212('0x46')]['id']},'transaction':_0x2137d4})[_0x8212('0x27')](function(_0x1c5360){var _0x4620f0=_[_0x8212('0x2c')](_0x4c01c6[_0x8212('0x4b')],function(_0x3a31c3){delete _0x3a31c3['id'];_0x3a31c3['CustomReportId']=_0x4c01c6['params']['id'];return _0x3a31c3;});return db[_0x8212('0x41')][_0x8212('0x4a')](_0x4620f0,{'transaction':_0x2137d4});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x4c01c6[_0x8212('0x46')]['id']}});});}})[_0x8212('0x27')](respondWithResult(_0x2a81b2,null))[_0x8212('0x44')](handleError(_0x2a81b2,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 5574dd4..278c88f 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 _0x4c69=['exports','define','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x4c69,0x13b));var _0x94c6=function(_0x2efcd4,_0x3d9689){_0x2efcd4=_0x2efcd4-0x0;var _0x5c5848=_0x4c69[_0x2efcd4];return _0x5c5848;};'use strict';var _=require('lodash');var util=require(_0x94c6('0x0'));var logger=require(_0x94c6('0x1'))(_0x94c6('0x2'));var moment=require(_0x94c6('0x3'));var BPromise=require(_0x94c6('0x4'));var rp=require(_0x94c6('0x5'));var fs=require('fs');var path=require(_0x94c6('0x6'));var rimraf=require(_0x94c6('0x7'));var config=require(_0x94c6('0x8'));var attributes=require(_0x94c6('0x9'));module[_0x94c6('0xa')]=function(_0x1fd01d,_0x38a523){return _0x1fd01d[_0x94c6('0xb')]('AnalyticFieldReport',attributes,{'tableName':_0x94c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd887=['request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird'];(function(_0x4ef6f3,_0xac58f1){var _0x82f917=function(_0x2a1a3b){while(--_0x2a1a3b){_0x4ef6f3['push'](_0x4ef6f3['shift']());}};_0x82f917(++_0xac58f1);}(_0xd887,0xcd));var _0x7d88=function(_0x5f0e14,_0x373cbb){_0x5f0e14=_0x5f0e14-0x0;var _0x3ed494=_0xd887[_0x5f0e14];return _0x3ed494;};'use strict';var _=require(_0x7d88('0x0'));var util=require(_0x7d88('0x1'));var logger=require(_0x7d88('0x2'))(_0x7d88('0x3'));var moment=require('moment');var BPromise=require(_0x7d88('0x4'));var rp=require(_0x7d88('0x5'));var fs=require('fs');var path=require(_0x7d88('0x6'));var rimraf=require(_0x7d88('0x7'));var config=require(_0x7d88('0x8'));var attributes=require(_0x7d88('0x9'));module[_0x7d88('0xa')]=function(_0x2a6753,_0x464b67){return _0x2a6753[_0x7d88('0xb')](_0x7d88('0xc'),attributes,{'tableName':_0x7d88('0xd'),'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 4d8905e..d5bca05 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 _0x67ca=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67ca,0x1cc));var _0xa67c=function(_0x559cf1,_0x195290){_0x559cf1=_0x559cf1-0x0;var _0x5a3eaa=_0x67ca[_0x559cf1];return _0x5a3eaa;};'use strict';var _=require(_0xa67c('0x0'));var util=require(_0xa67c('0x1'));var moment=require(_0xa67c('0x2'));var BPromise=require(_0xa67c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa67c('0x4'));var db=require(_0xa67c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa67c('0x6'))(_0xa67c('0x7'));var config=require('../../config/environment');var jayson=require(_0xa67c('0x8'));var client=jayson[_0xa67c('0x9')][_0xa67c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e274,_0x50a638,_0x2bc140){return new BPromise(function(_0x3bcc41,_0x3d9fab){return client[_0xa67c('0xb')](_0x19e274,_0x2bc140)[_0xa67c('0xc')](function(_0x3fff8b){logger[_0xa67c('0xd')](_0xa67c('0xe'),_0x50a638,'request\x20sent');logger[_0xa67c('0xf')](_0xa67c('0x10'),_0x50a638,_0xa67c('0x11'),JSON[_0xa67c('0x12')](_0x3fff8b));if(_0x3fff8b[_0xa67c('0x13')]){if(_0x3fff8b[_0xa67c('0x13')][_0xa67c('0x14')]===0x1f4){logger[_0xa67c('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x50a638,_0x3fff8b[_0xa67c('0x13')][_0xa67c('0x15')]);return _0x3d9fab(_0x3fff8b[_0xa67c('0x13')]['message']);}logger[_0xa67c('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x50a638,_0x3fff8b['error']['message']);return _0x3bcc41(_0x3fff8b[_0xa67c('0x13')][_0xa67c('0x15')]);}else{logger[_0xa67c('0xd')](_0xa67c('0xe'),_0x50a638,_0xa67c('0x11'));_0x3bcc41(_0x3fff8b[_0xa67c('0x16')][_0xa67c('0x15')]);}})['catch'](function(_0x3e86e5){logger['error'](_0xa67c('0xe'),_0x50a638,_0x3e86e5);_0x3d9fab(_0x3e86e5);});});} \ No newline at end of file +var _0x9394=['http','request','then','request\x20sent','debug','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../config/environment'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x9394,0x74));var _0x4939=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0x9394[_0x1073ad];return _0x528474;};'use strict';var _=require('lodash');var util=require(_0x4939('0x0'));var moment=require('moment');var BPromise=require(_0x4939('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4939('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4939('0x3'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4939('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x124278,_0x45b8a6,_0x3e6ba5){return new BPromise(function(_0x26459e,_0x410b67){return client[_0x4939('0x5')](_0x124278,_0x3e6ba5)[_0x4939('0x6')](function(_0x136aba){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x45b8a6,_0x4939('0x7'));logger[_0x4939('0x8')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x45b8a6,_0x4939('0x7'),JSON['stringify'](_0x136aba));if(_0x136aba['error']){if(_0x136aba[_0x4939('0x9')][_0x4939('0xa')]===0x1f4){logger[_0x4939('0x9')](_0x4939('0xb'),_0x45b8a6,_0x136aba['error'][_0x4939('0xc')]);return _0x410b67(_0x136aba[_0x4939('0x9')][_0x4939('0xc')]);}logger[_0x4939('0x9')](_0x4939('0xb'),_0x45b8a6,_0x136aba[_0x4939('0x9')]['message']);return _0x26459e(_0x136aba[_0x4939('0x9')][_0x4939('0xc')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x45b8a6,_0x4939('0x7'));_0x26459e(_0x136aba[_0x4939('0xd')]['message']);}})[_0x4939('0xe')](function(_0x590f92){logger[_0x4939('0x9')](_0x4939('0xb'),_0x45b8a6,_0x590f92);_0x410b67(_0x590f92);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 6cbd0ab..a79ad54 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(_0x37438c,_0x122afd){var _0x1a5190=function(_0x3fc6f4){while(--_0x3fc6f4){_0x37438c['push'](_0x37438c['shift']());}};_0x1a5190(++_0x122afd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x3fa107,_0x5d443c){var _0x1b5b37=function(_0x4df7b2){while(--_0x4df7b2){_0x3fa107['push'](_0x3fa107['shift']());}};_0x1b5b37(++_0x5d443c);}(_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('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 3edb9b6..d1dc8e5 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 _0x608a=['exports','STRING','TEXT'];(function(_0x9d2852,_0x352f85){var _0x22e86d=function(_0x1ec97b){while(--_0x1ec97b){_0x9d2852['push'](_0x9d2852['shift']());}};_0x22e86d(++_0x352f85);}(_0x608a,0xff));var _0xa608=function(_0x3952e2,_0x1e7975){_0x3952e2=_0x3952e2-0x0;var _0x5b8f5d=_0x608a[_0x3952e2];return _0x5b8f5d;};'use strict';var Sequelize=require('sequelize');module[_0xa608('0x0')]={'name':{'type':Sequelize[_0xa608('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xa608('0x1')]},'metric':{'type':Sequelize[_0xa608('0x2')]},'description':{'type':Sequelize[_0xa608('0x1')]}}; \ No newline at end of file +var _0xa74f=['STRING','TEXT'];(function(_0x4adfba,_0x3bb57e){var _0x2bbb97=function(_0x5a8d7a){while(--_0x5a8d7a){_0x4adfba['push'](_0x4adfba['shift']());}};_0x2bbb97(++_0x3bb57e);}(_0xa74f,0x9a));var _0xfa74=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0xa74f[_0xbe40ad];return _0x50fac9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfa74('0x0')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xfa74('0x1')]},'description':{'type':Sequelize[_0xfa74('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index cb1d5f6..1f26f08 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 _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x58a292,_0x147f41){var _0x986e54=function(_0x3bfccb){while(--_0x3bfccb){_0x58a292['push'](_0x58a292['shift']());}};_0x986e54(++_0x147f41);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x00bb[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1edf67,_0x192956){var _0x48ce6f=function(_0x273b05){while(--_0x273b05){_0x1edf67['push'](_0x1edf67['shift']());}};_0x48ce6f(++_0x192956);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xe51596,_0x314d5b){_0xe51596=_0xe51596-0x0;var _0x22c705=_0xf2ca[_0xe51596];return _0x22c705;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index c8b21ea..3ce0394 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 _0xd072=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd072,0x132));var _0x2d07=function(_0x5ca144,_0x4326fb){_0x5ca144=_0x5ca144-0x0;var _0x198104=_0xd072[_0x5ca144];return _0x198104;};'use strict';var _=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var logger=require(_0x2d07('0x2'))(_0x2d07('0x3'));var moment=require(_0x2d07('0x4'));var BPromise=require(_0x2d07('0x5'));var rp=require(_0x2d07('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d07('0x7'));var config=require(_0x2d07('0x8'));var attributes=require(_0x2d07('0x9'));module[_0x2d07('0xa')]=function(_0x34731c,_0x51aae0){return _0x34731c[_0x2d07('0xb')](_0x2d07('0xc'),attributes,{'tableName':_0x2d07('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a9a=['define','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x536068,_0x3de52c){var _0x4a5db2=function(_0x1a8091){while(--_0x1a8091){_0x536068['push'](_0x536068['shift']());}};_0x4a5db2(++_0x3de52c);}(_0x2a9a,0x64));var _0xa2a9=function(_0x5dbf5b,_0x52706b){_0x5dbf5b=_0x5dbf5b-0x0;var _0x3b395b=_0x2a9a[_0x5dbf5b];return _0x3b395b;};'use strict';var _=require(_0xa2a9('0x0'));var util=require('util');var logger=require(_0xa2a9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa2a9('0x2'));var rp=require(_0xa2a9('0x3'));var fs=require('fs');var path=require(_0xa2a9('0x4'));var rimraf=require(_0xa2a9('0x5'));var config=require(_0xa2a9('0x6'));var attributes=require('./analyticMetric.attributes');module[_0xa2a9('0x7')]=function(_0x2c31a4,_0x37648b){return _0x2c31a4[_0xa2a9('0x8')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index d8967e3..7721e61 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 _0xc4d9=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x16f0e8,_0x25b381){var _0x418a8f=function(_0x3192c8){while(--_0x3192c8){_0x16f0e8['push'](_0x16f0e8['shift']());}};_0x418a8f(++_0x25b381);}(_0xc4d9,0x1d6));var _0x9c4d=function(_0x3b94dd,_0x4dff75){_0x3b94dd=_0x3b94dd-0x0;var _0x439ae0=_0xc4d9[_0x3b94dd];return _0x439ae0;};'use strict';var _=require(_0x9c4d('0x0'));var util=require('util');var moment=require(_0x9c4d('0x1'));var BPromise=require(_0x9c4d('0x2'));var rs=require(_0x9c4d('0x3'));var fs=require('fs');var Redis=require(_0x9c4d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c4d('0x5'));var logger=require('../../config/logger')(_0x9c4d('0x6'));var config=require(_0x9c4d('0x7'));var jayson=require(_0x9c4d('0x8'));var client=jayson[_0x9c4d('0x9')][_0x9c4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x431687,_0x3bd9c8,_0x542b8b){return new BPromise(function(_0x4ed463,_0x5e540d){return client['request'](_0x431687,_0x542b8b)[_0x9c4d('0xb')](function(_0x1dbbf7){logger[_0x9c4d('0xc')](_0x9c4d('0xd'),_0x3bd9c8,'request\x20sent');logger[_0x9c4d('0xe')](_0x9c4d('0xf'),_0x3bd9c8,_0x9c4d('0x10'),JSON[_0x9c4d('0x11')](_0x1dbbf7));if(_0x1dbbf7[_0x9c4d('0x12')]){if(_0x1dbbf7[_0x9c4d('0x12')]['code']===0x1f4){logger['error'](_0x9c4d('0xd'),_0x3bd9c8,_0x1dbbf7[_0x9c4d('0x12')]['message']);return _0x5e540d(_0x1dbbf7[_0x9c4d('0x12')]['message']);}logger[_0x9c4d('0x12')](_0x9c4d('0xd'),_0x3bd9c8,_0x1dbbf7[_0x9c4d('0x12')][_0x9c4d('0x13')]);return _0x4ed463(_0x1dbbf7[_0x9c4d('0x12')]['message']);}else{logger[_0x9c4d('0xc')](_0x9c4d('0xd'),_0x3bd9c8,_0x9c4d('0x10'));_0x4ed463(_0x1dbbf7[_0x9c4d('0x14')][_0x9c4d('0x13')]);}})[_0x9c4d('0x15')](function(_0x55e051){logger[_0x9c4d('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x3bd9c8,_0x55e051);_0x5e540d(_0x55e051);});});} \ No newline at end of file +var _0x3eb1=['debug','stringify','error','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x1d7c83,_0x2d8f2d){var _0x283ef2=function(_0x68da53){while(--_0x68da53){_0x1d7c83['push'](_0x1d7c83['shift']());}};_0x283ef2(++_0x2d8f2d);}(_0x3eb1,0x1b9));var _0x13eb=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x3eb1[_0x2e04ef];return _0x5722b0;};'use strict';var _=require('lodash');var util=require(_0x13eb('0x0'));var moment=require('moment');var BPromise=require(_0x13eb('0x1'));var rs=require(_0x13eb('0x2'));var fs=require('fs');var Redis=require(_0x13eb('0x3'));var db=require(_0x13eb('0x4'))['db'];var utils=require(_0x13eb('0x5'));var logger=require(_0x13eb('0x6'))(_0x13eb('0x7'));var config=require(_0x13eb('0x8'));var jayson=require(_0x13eb('0x9'));var client=jayson['client'][_0x13eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5463e0,_0x46d68a,_0x36bb2d){return new BPromise(function(_0x425fc4,_0x44836d){return client['request'](_0x5463e0,_0x36bb2d)[_0x13eb('0xb')](function(_0x1be678){logger[_0x13eb('0xc')](_0x13eb('0xd'),_0x46d68a,_0x13eb('0xe'));logger[_0x13eb('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x46d68a,_0x13eb('0xe'),JSON[_0x13eb('0x10')](_0x1be678));if(_0x1be678[_0x13eb('0x11')]){if(_0x1be678[_0x13eb('0x11')]['code']===0x1f4){logger[_0x13eb('0x11')](_0x13eb('0xd'),_0x46d68a,_0x1be678[_0x13eb('0x11')][_0x13eb('0x12')]);return _0x44836d(_0x1be678[_0x13eb('0x11')][_0x13eb('0x12')]);}logger['error'](_0x13eb('0xd'),_0x46d68a,_0x1be678[_0x13eb('0x11')][_0x13eb('0x12')]);return _0x425fc4(_0x1be678[_0x13eb('0x11')][_0x13eb('0x12')]);}else{logger[_0x13eb('0xc')](_0x13eb('0xd'),_0x46d68a,_0x13eb('0xe'));_0x425fc4(_0x1be678['result'][_0x13eb('0x12')]);}})['catch'](function(_0x69db0){logger[_0x13eb('0x11')](_0x13eb('0xd'),_0x46d68a,_0x69db0);_0x44836d(_0x69db0);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 15bb0d7..cdc262b 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 _0xf2ca=['/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','put','update','delete'];(function(_0x8da1a3,_0xbf8497){var _0x11237b=function(_0x24477b){while(--_0x24477b){_0x8da1a3['push'](_0x8da1a3['shift']());}};_0x11237b(++_0xbf8497);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x5a5c11,_0x358f6b){_0x5a5c11=_0x5a5c11-0x0;var _0x5d6ba7=_0xf2ca[_0x5a5c11];return _0x5d6ba7;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./analyticMetric.controller');router[_0xaf2c('0x9')]('/',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0x9')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xc')]);router['post']('/',auth[_0xaf2c('0xa')](),controller['create']);router[_0xaf2c('0xd')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xe')]);router[_0xaf2c('0xf')](_0xaf2c('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xaf2c('0x11')]=router; \ No newline at end of file +var _0xe548=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','./analyticMetric.controller','isAuthenticated','get','/:id','show','post','create'];(function(_0x5eefbb,_0x5da8f4){var _0x52056f=function(_0x1ce15c){while(--_0x1ce15c){_0x5eefbb['push'](_0x5eefbb['shift']());}};_0x52056f(++_0x5da8f4);}(_0xe548,0x184));var _0x8e54=function(_0x16e5d1,_0x9cf085){_0x16e5d1=_0x16e5d1-0x0;var _0x3f72e6=_0xe548[_0x16e5d1];return _0x3f72e6;};'use strict';var multer=require(_0x8e54('0x0'));var util=require(_0x8e54('0x1'));var path=require(_0x8e54('0x2'));var timeout=require(_0x8e54('0x3'));var express=require(_0x8e54('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(_0x8e54('0x5'));router['get']('/',auth[_0x8e54('0x6')](),controller['index']);router[_0x8e54('0x7')](_0x8e54('0x8'),auth[_0x8e54('0x6')](),controller[_0x8e54('0x9')]);router[_0x8e54('0xa')]('/',auth[_0x8e54('0x6')](),controller[_0x8e54('0xb')]);router['put'](_0x8e54('0x8'),auth[_0x8e54('0x6')](),controller[_0x8e54('0xc')]);router[_0x8e54('0xd')](_0x8e54('0x8'),auth['isAuthenticated'](),controller[_0x8e54('0xe')]);module[_0x8e54('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index cced493..a2efd01 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 _0x6452=['sequelize','exports'];(function(_0x4a8b5b,_0x523af7){var _0x58566d=function(_0x372f06){while(--_0x372f06){_0x4a8b5b['push'](_0x4a8b5b['shift']());}};_0x58566d(++_0x523af7);}(_0x6452,0x12e));var _0x2645=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0x6452[_0x53f964];return _0x17be6c;};'use strict';var Sequelize=require(_0x2645('0x0'));module[_0x2645('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xde35=['TEXT','sequelize','exports'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xde35,0x17b));var _0x5de3=function(_0x439dcc,_0x49dfb1){_0x439dcc=_0x439dcc-0x0;var _0xf5e34b=_0xde35[_0x439dcc];return _0xf5e34b;};'use strict';var Sequelize=require(_0x5de3('0x0'));module[_0x5de3('0x1')]={'tree':{'type':Sequelize[_0x5de3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 764f198..c031a65 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 _0xdcb2=['name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','error'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xdcb2,0x68));var _0x2dcb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdcb2[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x2dcb('0x0'));var rimraf=require(_0x2dcb('0x1'));var zipdir=require(_0x2dcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2dcb('0x3'));var moment=require(_0x2dcb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2dcb('0x5'));var util=require(_0x2dcb('0x6'));var path=require('path');var sox=require(_0x2dcb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dcb('0x8'));var squel=require('squel');var crypto=require(_0x2dcb('0x9'));var jsforce=require(_0x2dcb('0xa'));var deskjs=require(_0x2dcb('0xb'));var toCsv=require(_0x2dcb('0xc'));var querystring=require(_0x2dcb('0xd'));var Papa=require(_0x2dcb('0xe'));var Redis=require(_0x2dcb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2dcb('0x10'));var as=require(_0x2dcb('0x11'));var hardwareService=require(_0x2dcb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2dcb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2dcb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a2559,_0x57024b){_0x57024b=_0x57024b||0xcc;return function(_0x109919){if(_0x109919){return _0x3a2559[_0x2dcb('0x15')](_0x57024b);}return _0x3a2559['status'](_0x57024b)[_0x2dcb('0x16')]();};}function respondWithResult(_0x3e5c90,_0x3507fe){_0x3507fe=_0x3507fe||0xc8;return function(_0x1273ec){if(_0x1273ec){return _0x3e5c90['status'](_0x3507fe)[_0x2dcb('0x17')](_0x1273ec);}};}function respondWithFilteredResult(_0x42a2c1,_0x565c6b){return function(_0x54c543){if(_0x54c543){var _0x3e2bae=typeof _0x565c6b[_0x2dcb('0x18')]===_0x2dcb('0x19')&&typeof _0x565c6b[_0x2dcb('0x1a')]===_0x2dcb('0x19');var _0x3b044c=_0x54c543[_0x2dcb('0x1b')];var _0x329578=_0x3e2bae?0x0:_0x565c6b['offset'];var _0x496bb2=_0x3e2bae?_0x54c543[_0x2dcb('0x1b')]:_0x565c6b['offset']+_0x565c6b[_0x2dcb('0x1a')];var _0x1a7b52;if(_0x496bb2>=_0x3b044c){_0x496bb2=_0x3b044c;_0x1a7b52=0xc8;}else{_0x1a7b52=0xce;}_0x42a2c1[_0x2dcb('0x1c')](_0x1a7b52);return _0x42a2c1[_0x2dcb('0x1d')]('Content-Range',_0x329578+'-'+_0x496bb2+'/'+_0x3b044c)['json'](_0x54c543);}return null;};}function patchUpdates(_0x2ddec4){return function(_0x4a9b5a){try{jsonpatch[_0x2dcb('0x1e')](_0x4a9b5a,_0x2ddec4,!![]);}catch(_0x4c176f){return BPromise['reject'](_0x4c176f);}return _0x4a9b5a[_0x2dcb('0x1f')]();};}function saveUpdates(_0x41f413,_0xcf23ff){return function(_0x1958be){if(_0x1958be){return _0x1958be[_0x2dcb('0x20')](_0x41f413)[_0x2dcb('0x21')](function(_0x34fd0a){return _0x34fd0a;});}return null;};}function removeEntity(_0x7cf8bc,_0xab5906){return function(_0x2bd648){if(_0x2bd648){return _0x2bd648[_0x2dcb('0x22')]()['then'](function(){_0x7cf8bc[_0x2dcb('0x1c')](0xcc)[_0x2dcb('0x16')]();});}};}function handleEntityNotFound(_0x4fa037,_0x1fe23a){return function(_0x36fd21){if(!_0x36fd21){_0x4fa037['sendStatus'](0x194);}return _0x36fd21;};}function handleError(_0x2e36f8,_0x2d1e80){_0x2d1e80=_0x2d1e80||0x1f4;return function(_0x18bd22){logger[_0x2dcb('0x23')](_0x18bd22['stack']);if(_0x18bd22[_0x2dcb('0x24')]){delete _0x18bd22[_0x2dcb('0x24')];}_0x2e36f8[_0x2dcb('0x1c')](_0x2d1e80)[_0x2dcb('0x25')](_0x18bd22);};}exports['index']=function(_0x31b5db,_0xce46d9){var _0x3dacac={},_0x4b276d={},_0x5ec161={'count':0x0,'rows':[]};var _0x871f2c=_[_0x2dcb('0x26')](db['AnalyticTreeReport'][_0x2dcb('0x27')],function(_0x6de47b){return{'name':_0x6de47b[_0x2dcb('0x28')],'type':_0x6de47b[_0x2dcb('0x29')][_0x2dcb('0x2a')]};});_0x4b276d[_0x2dcb('0x2b')]=_[_0x2dcb('0x26')](_0x871f2c,_0x2dcb('0x24'));_0x4b276d[_0x2dcb('0x2c')]=_[_0x2dcb('0x2d')](_0x31b5db[_0x2dcb('0x2c')]);_0x4b276d['filters']=_[_0x2dcb('0x2e')](_0x4b276d[_0x2dcb('0x2b')],_0x4b276d[_0x2dcb('0x2c')]);_0x3dacac['attributes']=_[_0x2dcb('0x2e')](_0x4b276d[_0x2dcb('0x2b')],qs[_0x2dcb('0x2f')](_0x31b5db[_0x2dcb('0x2c')][_0x2dcb('0x2f')]));_0x3dacac[_0x2dcb('0x30')]=_0x3dacac['attributes']['length']?_0x3dacac[_0x2dcb('0x30')]:_0x4b276d['model'];if(!_0x31b5db[_0x2dcb('0x2c')][_0x2dcb('0x31')]('nolimit')){_0x3dacac['limit']=qs[_0x2dcb('0x1a')](_0x31b5db[_0x2dcb('0x2c')]['limit']);_0x3dacac[_0x2dcb('0x18')]=qs[_0x2dcb('0x18')](_0x31b5db[_0x2dcb('0x2c')]['offset']);}_0x3dacac[_0x2dcb('0x32')]=qs['sort'](_0x31b5db['query'][_0x2dcb('0x33')]);_0x3dacac[_0x2dcb('0x34')]=qs[_0x2dcb('0x35')](_[_0x2dcb('0x36')](_0x31b5db[_0x2dcb('0x2c')],_0x4b276d[_0x2dcb('0x35')]),_0x871f2c);if(_0x31b5db[_0x2dcb('0x2c')][_0x2dcb('0x37')]){_0x3dacac[_0x2dcb('0x34')]=_[_0x2dcb('0x38')](_0x3dacac['where'],{'$or':_[_0x2dcb('0x26')](_0x871f2c,function(_0x46ed22){if(_0x46ed22[_0x2dcb('0x29')]!==_0x2dcb('0x39')){var _0x12c32b={};_0x12c32b[_0x46ed22[_0x2dcb('0x24')]]={'$like':'%'+_0x31b5db[_0x2dcb('0x2c')][_0x2dcb('0x37')]+'%'};return _0x12c32b;}})});}_0x3dacac=_[_0x2dcb('0x38')]({},_0x3dacac,_0x31b5db[_0x2dcb('0x3a')]);var _0x4ddc12={'where':_0x3dacac[_0x2dcb('0x34')]};return db[_0x2dcb('0x3b')][_0x2dcb('0x1b')](_0x4ddc12)[_0x2dcb('0x21')](function(_0x19f5b9){_0x5ec161[_0x2dcb('0x1b')]=_0x19f5b9;if(_0x31b5db[_0x2dcb('0x2c')][_0x2dcb('0x3c')]){_0x3dacac[_0x2dcb('0x3d')]=[{'all':!![]}];}return db[_0x2dcb('0x3b')][_0x2dcb('0x3e')](_0x3dacac);})['then'](function(_0x13e298){_0x5ec161[_0x2dcb('0x3f')]=_0x13e298;return _0x5ec161;})[_0x2dcb('0x21')](respondWithFilteredResult(_0xce46d9,_0x3dacac))[_0x2dcb('0x40')](handleError(_0xce46d9,null));};exports['show']=function(_0x19ea51,_0x345a27){var _0x4f5ed6={'raw':!![],'where':{'id':_0x19ea51[_0x2dcb('0x41')]['id']}},_0x21a036={};_0x21a036[_0x2dcb('0x2b')]=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x21a036[_0x2dcb('0x2c')]=_[_0x2dcb('0x2d')](_0x19ea51[_0x2dcb('0x2c')]);_0x21a036[_0x2dcb('0x35')]=_[_0x2dcb('0x2e')](_0x21a036[_0x2dcb('0x2b')],_0x21a036[_0x2dcb('0x2c')]);_0x4f5ed6[_0x2dcb('0x30')]=_[_0x2dcb('0x2e')](_0x21a036[_0x2dcb('0x2b')],qs[_0x2dcb('0x2f')](_0x19ea51['query']['fields']));_0x4f5ed6[_0x2dcb('0x30')]=_0x4f5ed6['attributes'][_0x2dcb('0x42')]?_0x4f5ed6[_0x2dcb('0x30')]:_0x21a036[_0x2dcb('0x2b')];if(_0x19ea51[_0x2dcb('0x2c')][_0x2dcb('0x3c')]){_0x4f5ed6[_0x2dcb('0x3d')]=[{'all':!![]}];}_0x4f5ed6=_[_0x2dcb('0x38')]({},_0x4f5ed6,_0x19ea51[_0x2dcb('0x3a')]);return db[_0x2dcb('0x3b')][_0x2dcb('0x43')](_0x4f5ed6)[_0x2dcb('0x21')](handleEntityNotFound(_0x345a27,null))['then'](respondWithResult(_0x345a27,null))[_0x2dcb('0x40')](handleError(_0x345a27,null));};exports[_0x2dcb('0x44')]=function(_0x4f996f,_0x3b3fe2){return db[_0x2dcb('0x3b')][_0x2dcb('0x44')](_0x4f996f[_0x2dcb('0x45')],{})['then'](respondWithResult(_0x3b3fe2,0xc9))[_0x2dcb('0x40')](handleError(_0x3b3fe2,null));};exports[_0x2dcb('0x20')]=function(_0x3c7089,_0xf73df6){if(_0x3c7089[_0x2dcb('0x45')]['id']){delete _0x3c7089['body']['id'];}return db[_0x2dcb('0x3b')][_0x2dcb('0x43')]({'where':{'id':_0x3c7089[_0x2dcb('0x41')]['id']}})[_0x2dcb('0x21')](handleEntityNotFound(_0xf73df6,null))[_0x2dcb('0x21')](saveUpdates(_0x3c7089['body'],null))[_0x2dcb('0x21')](respondWithResult(_0xf73df6,null))[_0x2dcb('0x40')](handleError(_0xf73df6,null));};exports[_0x2dcb('0x22')]=function(_0x1ae8fa,_0x33a3ea){return db[_0x2dcb('0x3b')]['find']({'where':{'id':_0x1ae8fa[_0x2dcb('0x41')]['id']}})[_0x2dcb('0x21')](handleEntityNotFound(_0x33a3ea,null))['then'](removeEntity(_0x33a3ea,null))['catch'](handleError(_0x33a3ea,null));}; \ No newline at end of file +var _0xb134=['rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','options','includeAll','include','findAll','catch','show','params','keys','merge','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','AnalyticTreeReport'];(function(_0x856f37,_0x51476a){var _0x5ee158=function(_0x4ef3d9){while(--_0x4ef3d9){_0x856f37['push'](_0x856f37['shift']());}};_0x5ee158(++_0x51476a);}(_0xb134,0xb1));var _0x4b13=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0xb134[_0x2c3a8f];return _0x189412;};'use strict';var emlformat=require(_0x4b13('0x0'));var rimraf=require(_0x4b13('0x1'));var zipdir=require(_0x4b13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b13('0x3'));var moment=require(_0x4b13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4b13('0x5'));var util=require(_0x4b13('0x6'));var path=require(_0x4b13('0x7'));var sox=require(_0x4b13('0x8'));var csv=require(_0x4b13('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b13('0xa'));var _=require('lodash');var squel=require(_0x4b13('0xb'));var crypto=require('crypto');var jsforce=require(_0x4b13('0xc'));var deskjs=require(_0x4b13('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4b13('0xe'));var Papa=require(_0x4b13('0xf'));var Redis=require(_0x4b13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4b13('0x11'));var as=require(_0x4b13('0x12'));var hardwareService=require(_0x4b13('0x13'));var logger=require(_0x4b13('0x14'))(_0x4b13('0x15'));var utils=require(_0x4b13('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4b13('0x17'));var db=require(_0x4b13('0x18'))['db'];function respondWithStatusCode(_0x10e723,_0x297b4e){_0x297b4e=_0x297b4e||0xcc;return function(_0x53b8e0){if(_0x53b8e0){return _0x10e723['sendStatus'](_0x297b4e);}return _0x10e723[_0x4b13('0x19')](_0x297b4e)['end']();};}function respondWithResult(_0x4eb5c7,_0x2c2617){_0x2c2617=_0x2c2617||0xc8;return function(_0x10360b){if(_0x10360b){return _0x4eb5c7[_0x4b13('0x19')](_0x2c2617)[_0x4b13('0x1a')](_0x10360b);}};}function respondWithFilteredResult(_0x2cdafb,_0x18d0a4){return function(_0x496a35){if(_0x496a35){var _0x2abd8a=typeof _0x18d0a4[_0x4b13('0x1b')]==='undefined'&&typeof _0x18d0a4['limit']===_0x4b13('0x1c');var _0x50d3e3=_0x496a35[_0x4b13('0x1d')];var _0x5b240a=_0x2abd8a?0x0:_0x18d0a4[_0x4b13('0x1b')];var _0x3bb8da=_0x2abd8a?_0x496a35[_0x4b13('0x1d')]:_0x18d0a4[_0x4b13('0x1b')]+_0x18d0a4[_0x4b13('0x1e')];var _0x47028f;if(_0x3bb8da>=_0x50d3e3){_0x3bb8da=_0x50d3e3;_0x47028f=0xc8;}else{_0x47028f=0xce;}_0x2cdafb[_0x4b13('0x19')](_0x47028f);return _0x2cdafb[_0x4b13('0x1f')]('Content-Range',_0x5b240a+'-'+_0x3bb8da+'/'+_0x50d3e3)['json'](_0x496a35);}return null;};}function patchUpdates(_0x2dd3b0){return function(_0x2f00eb){try{jsonpatch[_0x4b13('0x20')](_0x2f00eb,_0x2dd3b0,!![]);}catch(_0x51e18e){return BPromise[_0x4b13('0x21')](_0x51e18e);}return _0x2f00eb[_0x4b13('0x22')]();};}function saveUpdates(_0x567d60,_0x1a9cd0){return function(_0x1a2448){if(_0x1a2448){return _0x1a2448['update'](_0x567d60)[_0x4b13('0x23')](function(_0x552987){return _0x552987;});}return null;};}function removeEntity(_0x3f75af,_0x1e212f){return function(_0x4290c4){if(_0x4290c4){return _0x4290c4[_0x4b13('0x24')]()[_0x4b13('0x23')](function(){_0x3f75af[_0x4b13('0x19')](0xcc)[_0x4b13('0x25')]();});}};}function handleEntityNotFound(_0xdbc295,_0x49ddf4){return function(_0x4b99f3){if(!_0x4b99f3){_0xdbc295['sendStatus'](0x194);}return _0x4b99f3;};}function handleError(_0x209fae,_0x2adf7c){_0x2adf7c=_0x2adf7c||0x1f4;return function(_0x42d101){logger[_0x4b13('0x26')](_0x42d101[_0x4b13('0x27')]);if(_0x42d101[_0x4b13('0x28')]){delete _0x42d101['name'];}_0x209fae[_0x4b13('0x19')](_0x2adf7c)[_0x4b13('0x29')](_0x42d101);};}exports[_0x4b13('0x2a')]=function(_0x289ec1,_0x493427){var _0x437884={},_0x5544f5={},_0x218b10={'count':0x0,'rows':[]};var _0x15e386=_[_0x4b13('0x2b')](db[_0x4b13('0x2c')][_0x4b13('0x2d')],function(_0x5783c8){return{'name':_0x5783c8[_0x4b13('0x2e')],'type':_0x5783c8[_0x4b13('0x2f')][_0x4b13('0x30')]};});_0x5544f5[_0x4b13('0x31')]=_['map'](_0x15e386,_0x4b13('0x28'));_0x5544f5[_0x4b13('0x32')]=_['keys'](_0x289ec1[_0x4b13('0x32')]);_0x5544f5[_0x4b13('0x33')]=_['intersection'](_0x5544f5[_0x4b13('0x31')],_0x5544f5[_0x4b13('0x32')]);_0x437884[_0x4b13('0x34')]=_[_0x4b13('0x35')](_0x5544f5[_0x4b13('0x31')],qs['fields'](_0x289ec1[_0x4b13('0x32')][_0x4b13('0x36')]));_0x437884[_0x4b13('0x34')]=_0x437884[_0x4b13('0x34')][_0x4b13('0x37')]?_0x437884['attributes']:_0x5544f5[_0x4b13('0x31')];if(!_0x289ec1['query'][_0x4b13('0x38')]('nolimit')){_0x437884[_0x4b13('0x1e')]=qs[_0x4b13('0x1e')](_0x289ec1[_0x4b13('0x32')][_0x4b13('0x1e')]);_0x437884[_0x4b13('0x1b')]=qs['offset'](_0x289ec1[_0x4b13('0x32')][_0x4b13('0x1b')]);}_0x437884[_0x4b13('0x39')]=qs[_0x4b13('0x3a')](_0x289ec1[_0x4b13('0x32')][_0x4b13('0x3a')]);_0x437884['where']=qs['filters'](_['pick'](_0x289ec1[_0x4b13('0x32')],_0x5544f5[_0x4b13('0x33')]),_0x15e386);if(_0x289ec1['query'][_0x4b13('0x3b')]){_0x437884[_0x4b13('0x3c')]=_['merge'](_0x437884[_0x4b13('0x3c')],{'$or':_[_0x4b13('0x2b')](_0x15e386,function(_0x1aba72){if(_0x1aba72[_0x4b13('0x2f')]!=='VIRTUAL'){var _0x48d032={};_0x48d032[_0x1aba72[_0x4b13('0x28')]]={'$like':'%'+_0x289ec1[_0x4b13('0x32')][_0x4b13('0x3b')]+'%'};return _0x48d032;}})});}_0x437884=_['merge']({},_0x437884,_0x289ec1[_0x4b13('0x3d')]);var _0x9556a4={'where':_0x437884[_0x4b13('0x3c')]};return db['AnalyticTreeReport'][_0x4b13('0x1d')](_0x9556a4)['then'](function(_0x24f5a1){_0x218b10['count']=_0x24f5a1;if(_0x289ec1['query'][_0x4b13('0x3e')]){_0x437884[_0x4b13('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x4b13('0x40')](_0x437884);})[_0x4b13('0x23')](function(_0xb0e781){_0x218b10['rows']=_0xb0e781;return _0x218b10;})[_0x4b13('0x23')](respondWithFilteredResult(_0x493427,_0x437884))[_0x4b13('0x41')](handleError(_0x493427,null));};exports[_0x4b13('0x42')]=function(_0x46eb3d,_0x1a75c6){var _0x3acba2={'raw':!![],'where':{'id':_0x46eb3d[_0x4b13('0x43')]['id']}},_0x111d96={};_0x111d96[_0x4b13('0x31')]=_[_0x4b13('0x44')](db['AnalyticTreeReport'][_0x4b13('0x2d')]);_0x111d96['query']=_[_0x4b13('0x44')](_0x46eb3d['query']);_0x111d96[_0x4b13('0x33')]=_[_0x4b13('0x35')](_0x111d96['model'],_0x111d96[_0x4b13('0x32')]);_0x3acba2[_0x4b13('0x34')]=_[_0x4b13('0x35')](_0x111d96['model'],qs[_0x4b13('0x36')](_0x46eb3d[_0x4b13('0x32')]['fields']));_0x3acba2[_0x4b13('0x34')]=_0x3acba2[_0x4b13('0x34')][_0x4b13('0x37')]?_0x3acba2['attributes']:_0x111d96['model'];if(_0x46eb3d[_0x4b13('0x32')][_0x4b13('0x3e')]){_0x3acba2[_0x4b13('0x3f')]=[{'all':!![]}];}_0x3acba2=_[_0x4b13('0x45')]({},_0x3acba2,_0x46eb3d[_0x4b13('0x3d')]);return db[_0x4b13('0x2c')][_0x4b13('0x46')](_0x3acba2)['then'](handleEntityNotFound(_0x1a75c6,null))[_0x4b13('0x23')](respondWithResult(_0x1a75c6,null))[_0x4b13('0x41')](handleError(_0x1a75c6,null));};exports['create']=function(_0x83a317,_0x116549){return db[_0x4b13('0x2c')][_0x4b13('0x47')](_0x83a317['body'],{})['then'](respondWithResult(_0x116549,0xc9))[_0x4b13('0x41')](handleError(_0x116549,null));};exports[_0x4b13('0x48')]=function(_0x36a9aa,_0x26634a){if(_0x36a9aa[_0x4b13('0x49')]['id']){delete _0x36a9aa[_0x4b13('0x49')]['id'];}return db[_0x4b13('0x2c')][_0x4b13('0x46')]({'where':{'id':_0x36a9aa[_0x4b13('0x43')]['id']}})[_0x4b13('0x23')](handleEntityNotFound(_0x26634a,null))[_0x4b13('0x23')](saveUpdates(_0x36a9aa['body'],null))['then'](respondWithResult(_0x26634a,null))[_0x4b13('0x41')](handleError(_0x26634a,null));};exports[_0x4b13('0x24')]=function(_0x14ca42,_0x3011b0){return db[_0x4b13('0x2c')][_0x4b13('0x46')]({'where':{'id':_0x14ca42[_0x4b13('0x43')]['id']}})[_0x4b13('0x23')](handleEntityNotFound(_0x3011b0,null))[_0x4b13('0x23')](removeEntity(_0x3011b0,null))[_0x4b13('0x41')](handleError(_0x3011b0,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 21c7472..79af4c5 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 _0x0345=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','util','../../config/logger','api','moment','bluebird','path'];(function(_0x169e4a,_0x350d6b){var _0x1de1f7=function(_0x5f220e){while(--_0x5f220e){_0x169e4a['push'](_0x169e4a['shift']());}};_0x1de1f7(++_0x350d6b);}(_0x0345,0x9a));var _0x5034=function(_0x25ae0d,_0x437699){_0x25ae0d=_0x25ae0d-0x0;var _0x35a2df=_0x0345[_0x25ae0d];return _0x35a2df;};'use strict';var _=require('lodash');var util=require(_0x5034('0x0'));var logger=require(_0x5034('0x1'))(_0x5034('0x2'));var moment=require(_0x5034('0x3'));var BPromise=require(_0x5034('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5034('0x5'));var rimraf=require(_0x5034('0x6'));var config=require(_0x5034('0x7'));var attributes=require(_0x5034('0x8'));module[_0x5034('0x9')]=function(_0x1fd1da,_0x4f482a){return _0x1fd1da['define']('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99a1=['../../config/logger','moment','bluebird','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x494223,_0x2c1f71){var _0xdaf98=function(_0x1f790e){while(--_0x1f790e){_0x494223['push'](_0x494223['shift']());}};_0xdaf98(++_0x2c1f71);}(_0x99a1,0x172));var _0x199a=function(_0x4ae97e,_0x508e0f){_0x4ae97e=_0x4ae97e-0x0;var _0x1b546a=_0x99a1[_0x4ae97e];return _0x1b546a;};'use strict';var _=require(_0x199a('0x0'));var util=require(_0x199a('0x1'));var logger=require(_0x199a('0x2'))('api');var moment=require(_0x199a('0x3'));var BPromise=require(_0x199a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x199a('0x5'));var rimraf=require('rimraf');var config=require(_0x199a('0x6'));var attributes=require(_0x199a('0x7'));module[_0x199a('0x8')]=function(_0x2b7040,_0x405e5d){return _0x2b7040[_0x199a('0x9')](_0x199a('0xa'),attributes,{'tableName':_0x199a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 1495e74..1d9dcb4 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x5e3650,_0x32c428){_0x5e3650=_0x5e3650-0x0;var _0x3d7d62=_0x7a54[_0x5e3650];return _0x3d7d62;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x212604,_0x44fce5){var _0x50f47f=function(_0x4ca2ab){while(--_0x4ca2ab){_0x212604['push'](_0x212604['shift']());}};_0x50f47f(++_0x44fce5);}(_0xdb28,0x106));var _0x8db2=function(_0x2c1245,_0x3ecf01){_0x2c1245=_0x2c1245-0x0;var _0x33d0de=_0xdb28[_0x2c1245];return _0x33d0de;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 7e5c3d0..3016f2a 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 _0x2ef3=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','show','post','create','/:id','update','destroy','exports','util','connect-timeout','../../components/auth/service'];(function(_0x274394,_0x6fd912){var _0x2a2773=function(_0x2ab84c){while(--_0x2ab84c){_0x274394['push'](_0x274394['shift']());}};_0x2a2773(++_0x6fd912);}(_0x2ef3,0xdd));var _0x32ef=function(_0x35549f,_0x3c2772){_0x35549f=_0x35549f-0x0;var _0x4d55d0=_0x2ef3[_0x35549f];return _0x4d55d0;};'use strict';var multer=require('multer');var util=require(_0x32ef('0x0'));var path=require('path');var timeout=require(_0x32ef('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x2'));var interaction=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));var controller=require(_0x32ef('0x5'));router['get']('/',auth[_0x32ef('0x6')](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x32ef('0x9')]);router[_0x32ef('0xa')]('/',auth['isAuthenticated'](),controller[_0x32ef('0xb')]);router['put'](_0x32ef('0xc'),auth[_0x32ef('0x6')](),controller[_0x32ef('0xd')]);router['delete'](_0x32ef('0xc'),auth[_0x32ef('0x6')](),controller[_0x32ef('0xe')]);module[_0x32ef('0xf')]=router; \ No newline at end of file +var _0x97d5=['Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','post','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x57a9d6,_0x244a86){var _0x403639=function(_0x3f16ed){while(--_0x3f16ed){_0x57a9d6['push'](_0x57a9d6['shift']());}};_0x403639(++_0x244a86);}(_0x97d5,0x19c));var _0x597d=function(_0x537719,_0x5b6014){_0x537719=_0x537719-0x0;var _0x351486=_0x97d5[_0x537719];return _0x351486;};'use strict';var multer=require('multer');var util=require(_0x597d('0x0'));var path=require(_0x597d('0x1'));var timeout=require(_0x597d('0x2'));var express=require(_0x597d('0x3'));var router=express[_0x597d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x597d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x597d('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x597d('0x7')]('/',auth['isAuthenticated'](),controller[_0x597d('0x8')]);router['get']('/:id',auth[_0x597d('0x9')](),controller['show']);router[_0x597d('0xa')]('/',auth[_0x597d('0x9')](),controller[_0x597d('0xb')]);router[_0x597d('0xc')]('/:id',auth[_0x597d('0x9')](),controller[_0x597d('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x597d('0xe')]);module[_0x597d('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f7b8250..79ad735 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 _0xe920=['STRING','sequelize','exports'];(function(_0x3d33b3,_0x6b936c){var _0x126090=function(_0x2fa252){while(--_0x2fa252){_0x3d33b3['push'](_0x3d33b3['shift']());}};_0x126090(++_0x6b936c);}(_0xe920,0xbe));var _0x0e92=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0xe920[_0x523adf];return _0x283870;};'use strict';var Sequelize=require(_0x0e92('0x0'));module[_0x0e92('0x1')]={'name':{'type':Sequelize[_0x0e92('0x2')]},'basename':{'type':Sequelize[_0x0e92('0x2')]},'type':{'type':Sequelize[_0x0e92('0x2')]}}; \ No newline at end of file +var _0x0f69=['STRING'];(function(_0x5d5d2b,_0x40d997){var _0x32d20c=function(_0x380483){while(--_0x380483){_0x5d5d2b['push'](_0x5d5d2b['shift']());}};_0x32d20c(++_0x40d997);}(_0x0f69,0x173));var _0x90f6=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x0f69[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x90f6('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x90f6('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 08d6ba9..e09ec63 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 _0x9ab4=['then','destroy','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','find','catch','clone','params','get','createdAt','omit','updatedAt','create','body','update','file','originalname','mimetype','server/files/attachments/','join','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','to-csv','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','count','Content-Range','apply','reject'];(function(_0x20b5a5,_0x56b921){var _0x15d417=function(_0x5dfc0b){while(--_0x5dfc0b){_0x20b5a5['push'](_0x20b5a5['shift']());}};_0x15d417(++_0x56b921);}(_0x9ab4,0x127));var _0x49ab=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9ab4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x49ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49ab('0x1'));var jsonpatch=require(_0x49ab('0x2'));var rp=require(_0x49ab('0x3'));var moment=require(_0x49ab('0x4'));var BPromise=require(_0x49ab('0x5'));var Mustache=require('mustache');var util=require(_0x49ab('0x6'));var path=require(_0x49ab('0x7'));var sox=require(_0x49ab('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49ab('0x9'));var _=require('lodash');var squel=require(_0x49ab('0xa'));var crypto=require(_0x49ab('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x49ab('0xc'));var querystring=require(_0x49ab('0xd'));var Papa=require(_0x49ab('0xe'));var Redis=require(_0x49ab('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x49ab('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49ab('0x11'));var logger=require(_0x49ab('0x12'))('api');var utils=require(_0x49ab('0x13'));var config=require(_0x49ab('0x14'));var licenseUtil=require(_0x49ab('0x15'));var db=require(_0x49ab('0x16'))['db'];function respondWithStatusCode(_0x269a60,_0x45cfda){_0x45cfda=_0x45cfda||0xcc;return function(_0x56d32b){if(_0x56d32b){return _0x269a60[_0x49ab('0x17')](_0x45cfda);}return _0x269a60[_0x49ab('0x18')](_0x45cfda)[_0x49ab('0x19')]();};}function respondWithResult(_0x2173f7,_0x445f28){_0x445f28=_0x445f28||0xc8;return function(_0x52d668){if(_0x52d668){return _0x2173f7[_0x49ab('0x18')](_0x445f28)[_0x49ab('0x1a')](_0x52d668);}};}function respondWithFilteredResult(_0xaed587,_0x24ccd3){return function(_0x1c269a){if(_0x1c269a){var _0x51f952=typeof _0x24ccd3[_0x49ab('0x1b')]===_0x49ab('0x1c')&&typeof _0x24ccd3['limit']==='undefined';var _0x1d2c90=_0x1c269a[_0x49ab('0x1d')];var _0x2e35df=_0x51f952?0x0:_0x24ccd3[_0x49ab('0x1b')];var _0x14b224=_0x51f952?_0x1c269a[_0x49ab('0x1d')]:_0x24ccd3[_0x49ab('0x1b')]+_0x24ccd3['limit'];var _0x18a835;if(_0x14b224>=_0x1d2c90){_0x14b224=_0x1d2c90;_0x18a835=0xc8;}else{_0x18a835=0xce;}_0xaed587[_0x49ab('0x18')](_0x18a835);return _0xaed587['set'](_0x49ab('0x1e'),_0x2e35df+'-'+_0x14b224+'/'+_0x1d2c90)[_0x49ab('0x1a')](_0x1c269a);}return null;};}function patchUpdates(_0xf3fba){return function(_0xdca87c){try{jsonpatch[_0x49ab('0x1f')](_0xdca87c,_0xf3fba,!![]);}catch(_0xd10eb2){return BPromise[_0x49ab('0x20')](_0xd10eb2);}return _0xdca87c['save']();};}function saveUpdates(_0x57e219,_0x3bc31c){return function(_0x53dd63){if(_0x53dd63){return _0x53dd63['update'](_0x57e219)[_0x49ab('0x21')](function(_0x10fbf3){return _0x10fbf3;});}return null;};}function removeEntity(_0x5c4db0,_0x3757b3){return function(_0x5c8b32){if(_0x5c8b32){return _0x5c8b32[_0x49ab('0x22')]()['then'](function(){_0x5c4db0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ee67,_0x191322){return function(_0x9fb8dc){if(!_0x9fb8dc){_0x25ee67['sendStatus'](0x194);}return _0x9fb8dc;};}function handleError(_0x153160,_0x24bed6){_0x24bed6=_0x24bed6||0x1f4;return function(_0x551668){logger[_0x49ab('0x23')](_0x551668[_0x49ab('0x24')]);if(_0x551668[_0x49ab('0x25')]){delete _0x551668[_0x49ab('0x25')];}_0x153160[_0x49ab('0x18')](_0x24bed6)[_0x49ab('0x26')](_0x551668);};}exports[_0x49ab('0x27')]=function(_0x38e5eb,_0x5d09e9){var _0x278202={},_0x328717={},_0x4c907f={'count':0x0,'rows':[]};var _0x4bc6a4=_['map'](db[_0x49ab('0x28')][_0x49ab('0x29')],function(_0x525a0b){return{'name':_0x525a0b[_0x49ab('0x2a')],'type':_0x525a0b[_0x49ab('0x2b')]['key']};});_0x328717[_0x49ab('0x2c')]=_[_0x49ab('0x2d')](_0x4bc6a4,_0x49ab('0x25'));_0x328717[_0x49ab('0x2e')]=_[_0x49ab('0x2f')](_0x38e5eb[_0x49ab('0x2e')]);_0x328717[_0x49ab('0x30')]=_[_0x49ab('0x31')](_0x328717[_0x49ab('0x2c')],_0x328717[_0x49ab('0x2e')]);_0x278202[_0x49ab('0x32')]=_[_0x49ab('0x31')](_0x328717[_0x49ab('0x2c')],qs[_0x49ab('0x33')](_0x38e5eb[_0x49ab('0x2e')]['fields']));_0x278202[_0x49ab('0x32')]=_0x278202[_0x49ab('0x32')][_0x49ab('0x34')]?_0x278202[_0x49ab('0x32')]:_0x328717[_0x49ab('0x2c')];if(!_0x38e5eb[_0x49ab('0x2e')][_0x49ab('0x35')]('nolimit')){_0x278202[_0x49ab('0x36')]=qs[_0x49ab('0x36')](_0x38e5eb[_0x49ab('0x2e')][_0x49ab('0x36')]);_0x278202[_0x49ab('0x1b')]=qs[_0x49ab('0x1b')](_0x38e5eb[_0x49ab('0x2e')]['offset']);}_0x278202['order']=qs[_0x49ab('0x37')](_0x38e5eb[_0x49ab('0x2e')][_0x49ab('0x37')]);_0x278202[_0x49ab('0x38')]=qs['filters'](_[_0x49ab('0x39')](_0x38e5eb['query'],_0x328717[_0x49ab('0x30')]),_0x4bc6a4);if(_0x38e5eb[_0x49ab('0x2e')][_0x49ab('0x3a')]){_0x278202[_0x49ab('0x38')]=_[_0x49ab('0x3b')](_0x278202[_0x49ab('0x38')],{'$or':_[_0x49ab('0x2d')](_0x4bc6a4,function(_0x558c86){if(_0x558c86[_0x49ab('0x2b')]!==_0x49ab('0x3c')){var _0xb89a84={};_0xb89a84[_0x558c86[_0x49ab('0x25')]]={'$like':'%'+_0x38e5eb['query'][_0x49ab('0x3a')]+'%'};return _0xb89a84;}})});}_0x278202=_[_0x49ab('0x3b')]({},_0x278202,_0x38e5eb[_0x49ab('0x3d')]);var _0x179b45={'where':_0x278202[_0x49ab('0x38')]};return db[_0x49ab('0x28')][_0x49ab('0x1d')](_0x179b45)[_0x49ab('0x21')](function(_0x4b2b3f){_0x4c907f['count']=_0x4b2b3f;if(_0x38e5eb[_0x49ab('0x2e')][_0x49ab('0x3e')]){_0x278202[_0x49ab('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0x49ab('0x40')](_0x278202);})[_0x49ab('0x21')](function(_0x4bd001){_0x4c907f['rows']=_0x4bd001;return _0x4c907f;})[_0x49ab('0x21')](respondWithFilteredResult(_0x5d09e9,_0x278202))['catch'](handleError(_0x5d09e9,null));};exports['show']=function(_0x45e98a,_0x4f6205){var _0x824f21={'raw':!![],'where':{'id':_0x45e98a['params']['id']}},_0x32ae5b={};_0x32ae5b['model']=_[_0x49ab('0x2f')](db[_0x49ab('0x28')][_0x49ab('0x29')]);_0x32ae5b[_0x49ab('0x2e')]=_[_0x49ab('0x2f')](_0x45e98a['query']);_0x32ae5b[_0x49ab('0x30')]=_['intersection'](_0x32ae5b[_0x49ab('0x2c')],_0x32ae5b[_0x49ab('0x2e')]);_0x824f21[_0x49ab('0x32')]=_[_0x49ab('0x31')](_0x32ae5b[_0x49ab('0x2c')],qs[_0x49ab('0x33')](_0x45e98a[_0x49ab('0x2e')][_0x49ab('0x33')]));_0x824f21[_0x49ab('0x32')]=_0x824f21[_0x49ab('0x32')]['length']?_0x824f21[_0x49ab('0x32')]:_0x32ae5b[_0x49ab('0x2c')];if(_0x45e98a[_0x49ab('0x2e')][_0x49ab('0x3e')]){_0x824f21[_0x49ab('0x3f')]=[{'all':!![]}];}_0x824f21=_['merge']({},_0x824f21,_0x45e98a['options']);return db[_0x49ab('0x28')][_0x49ab('0x41')](_0x824f21)[_0x49ab('0x21')](handleEntityNotFound(_0x4f6205,null))[_0x49ab('0x21')](respondWithResult(_0x4f6205,null))[_0x49ab('0x42')](handleError(_0x4f6205,null));};exports[_0x49ab('0x43')]=function(_0x59952d,_0x15c975){var _0x446adf={'where':{'id':_0x59952d[_0x49ab('0x44')]['id']}},_0x287dc4={};_0x287dc4['model']=_[_0x49ab('0x2f')](db[_0x49ab('0x28')][_0x49ab('0x29')]);_0x446adf[_0x49ab('0x32')]=_[_0x49ab('0x31')](_0x287dc4[_0x49ab('0x2c')],qs[_0x49ab('0x33')](_0x59952d['query']['fields']));_0x446adf[_0x49ab('0x32')]=_0x446adf[_0x49ab('0x32')][_0x49ab('0x34')]?_0x446adf['attributes']:_0x287dc4['model'];if(_0x59952d[_0x49ab('0x2e')][_0x49ab('0x3e')]){_0x446adf[_0x49ab('0x3f')]=[{'all':!![]}];}_0x446adf=_[_0x49ab('0x3b')]({},_0x446adf,_0x59952d['options']);return db[_0x49ab('0x28')][_0x49ab('0x41')](_0x446adf)[_0x49ab('0x21')](handleEntityNotFound(_0x15c975,null))[_0x49ab('0x21')](function(_0xe023e6){if(_0xe023e6){var _0x578890=_0xe023e6[_0x49ab('0x45')]({'plain':!![]});_0x578890=qs['omit'](_0x578890,['id',_0x49ab('0x46'),'updatedAt']);_0x59952d['body']=_[_0x49ab('0x47')](_0x59952d['body'],['id',_0x49ab('0x46'),_0x49ab('0x48')]);return db[_0x49ab('0x28')][_0x49ab('0x49')](_[_0x49ab('0x3b')](_0x578890,_0x59952d[_0x49ab('0x4a')]),{'include':_0x59952d[_0x49ab('0x2e')][_0x49ab('0x3e')]?[{'all':!![]}]:undefined});}})[_0x49ab('0x21')](respondWithResult(_0x15c975,0xc9))['catch'](handleError(_0x15c975,null));};exports[_0x49ab('0x4b')]=function(_0xb9bc98,_0x1534d3){if(_0xb9bc98['body']['id']){delete _0xb9bc98[_0x49ab('0x4a')]['id'];}return db[_0x49ab('0x28')][_0x49ab('0x41')]({'where':{'id':_0xb9bc98[_0x49ab('0x44')]['id']}})['then'](handleEntityNotFound(_0x1534d3,null))[_0x49ab('0x21')](saveUpdates(_0xb9bc98[_0x49ab('0x4a')],null))[_0x49ab('0x21')](respondWithResult(_0x1534d3,null))[_0x49ab('0x42')](handleError(_0x1534d3,null));};exports[_0x49ab('0x22')]=function(_0x346562,_0x2b3dc4){return db['Attachment'][_0x49ab('0x41')]({'where':{'id':_0x346562[_0x49ab('0x44')]['id']}})[_0x49ab('0x21')](handleEntityNotFound(_0x2b3dc4,null))['then'](removeEntity(_0x2b3dc4,null))[_0x49ab('0x42')](handleError(_0x2b3dc4,null));};exports[_0x49ab('0x49')]=function(_0x111b06,_0x2f853a,_0x3bafeb){_0x111b06['body'][_0x49ab('0x25')]=_0x111b06[_0x49ab('0x4c')][_0x49ab('0x4d')];_0x111b06[_0x49ab('0x4a')]['basename']=_0x111b06['file']['filename'];_0x111b06[_0x49ab('0x4a')]['type']=_0x111b06[_0x49ab('0x4c')][_0x49ab('0x4e')];return db[_0x49ab('0x28')][_0x49ab('0x49')](_0x111b06[_0x49ab('0x4a')])[_0x49ab('0x21')](respondWithResult(_0x2f853a,0xc9))[_0x49ab('0x42')](handleError(_0x2f853a,null));};exports['download']=function(_0x2fc455,_0x344a5b,_0x216ab6){return db['Attachment']['findOne']({'where':{'id':_0x2fc455['params']['id']},'raw':!![]})[_0x49ab('0x21')](handleEntityNotFound(_0x344a5b,null))[_0x49ab('0x21')](function(_0x3c52a8){if(_0x3c52a8){var _0x2a6e1b=_0x3c52a8['ChatOfflineMessageId']!==null;var _0x566124=path['join'](config['root'],_0x49ab('0x4f'));if(_0x2a6e1b){_0x566124=path[_0x49ab('0x50')](_0x566124,'offline-chat/');}var _0x1b253d=path['join'](_0x566124,_0x3c52a8['basename']);return _0x344a5b[_0x49ab('0x51')](_0x1b253d);}})[_0x49ab('0x42')](handleError(_0x344a5b,null));}; \ No newline at end of file +var _0x3248=['lodash','squel','jsforce','desk.js','to-csv','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','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','Attachment','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','clone','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x5c0827,_0x139440){var _0x3f0951=function(_0x574488){while(--_0x574488){_0x5c0827['push'](_0x5c0827['shift']());}};_0x3f0951(++_0x139440);}(_0x3248,0x165));var _0x8324=function(_0x40e78d,_0x3e74a6){_0x40e78d=_0x40e78d-0x0;var _0x5b4577=_0x3248[_0x40e78d];return _0x5b4577;};'use strict';var emlformat=require(_0x8324('0x0'));var rimraf=require(_0x8324('0x1'));var zipdir=require(_0x8324('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8324('0x3'));var moment=require('moment');var BPromise=require(_0x8324('0x4'));var Mustache=require(_0x8324('0x5'));var util=require(_0x8324('0x6'));var path=require(_0x8324('0x7'));var sox=require(_0x8324('0x8'));var csv=require('to-csv');var ejs=require(_0x8324('0x9'));var fs=require('fs');var fs_extra=require(_0x8324('0xa'));var _=require(_0x8324('0xb'));var squel=require(_0x8324('0xc'));var crypto=require('crypto');var jsforce=require(_0x8324('0xd'));var deskjs=require(_0x8324('0xe'));var toCsv=require(_0x8324('0xf'));var querystring=require(_0x8324('0x10'));var Papa=require(_0x8324('0x11'));var Redis=require(_0x8324('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8324('0x13'));var as=require(_0x8324('0x14'));var hardwareService=require(_0x8324('0x15'));var logger=require('../../config/logger')(_0x8324('0x16'));var utils=require(_0x8324('0x17'));var config=require(_0x8324('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120218,_0x521d0e){_0x521d0e=_0x521d0e||0xcc;return function(_0x113ee7){if(_0x113ee7){return _0x120218[_0x8324('0x19')](_0x521d0e);}return _0x120218[_0x8324('0x1a')](_0x521d0e)[_0x8324('0x1b')]();};}function respondWithResult(_0x1d81f4,_0x574b1c){_0x574b1c=_0x574b1c||0xc8;return function(_0x54f071){if(_0x54f071){return _0x1d81f4[_0x8324('0x1a')](_0x574b1c)[_0x8324('0x1c')](_0x54f071);}};}function respondWithFilteredResult(_0x38e146,_0x5166a1){return function(_0x3d8452){if(_0x3d8452){var _0x4fd389=typeof _0x5166a1[_0x8324('0x1d')]===_0x8324('0x1e')&&typeof _0x5166a1[_0x8324('0x1f')]==='undefined';var _0x4e5af9=_0x3d8452[_0x8324('0x20')];var _0x4cdccb=_0x4fd389?0x0:_0x5166a1[_0x8324('0x1d')];var _0xd51031=_0x4fd389?_0x3d8452[_0x8324('0x20')]:_0x5166a1[_0x8324('0x1d')]+_0x5166a1[_0x8324('0x1f')];var _0x4d86f3;if(_0xd51031>=_0x4e5af9){_0xd51031=_0x4e5af9;_0x4d86f3=0xc8;}else{_0x4d86f3=0xce;}_0x38e146['status'](_0x4d86f3);return _0x38e146[_0x8324('0x21')](_0x8324('0x22'),_0x4cdccb+'-'+_0xd51031+'/'+_0x4e5af9)[_0x8324('0x1c')](_0x3d8452);}return null;};}function patchUpdates(_0x306db7){return function(_0x342275){try{jsonpatch[_0x8324('0x23')](_0x342275,_0x306db7,!![]);}catch(_0x3655a3){return BPromise[_0x8324('0x24')](_0x3655a3);}return _0x342275[_0x8324('0x25')]();};}function saveUpdates(_0xab73b1,_0x3887db){return function(_0x4f7a90){if(_0x4f7a90){return _0x4f7a90[_0x8324('0x26')](_0xab73b1)[_0x8324('0x27')](function(_0x4b3dd5){return _0x4b3dd5;});}return null;};}function removeEntity(_0x2b7f3c,_0x313c28){return function(_0x57f6a0){if(_0x57f6a0){return _0x57f6a0[_0x8324('0x28')]()[_0x8324('0x27')](function(){_0x2b7f3c[_0x8324('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34642c,_0x443dd7){return function(_0x4f2901){if(!_0x4f2901){_0x34642c[_0x8324('0x19')](0x194);}return _0x4f2901;};}function handleError(_0x2638aa,_0xc20f85){_0xc20f85=_0xc20f85||0x1f4;return function(_0x2c4c6d){logger['error'](_0x2c4c6d['stack']);if(_0x2c4c6d[_0x8324('0x29')]){delete _0x2c4c6d[_0x8324('0x29')];}_0x2638aa[_0x8324('0x1a')](_0xc20f85)[_0x8324('0x2a')](_0x2c4c6d);};}exports[_0x8324('0x2b')]=function(_0x2ab76c,_0x1c64d0){var _0x29e959={},_0x398744={},_0xcc2bcb={'count':0x0,'rows':[]};var _0x3decbf=_[_0x8324('0x2c')](db[_0x8324('0x2d')][_0x8324('0x2e')],function(_0x4c5293){return{'name':_0x4c5293[_0x8324('0x2f')],'type':_0x4c5293[_0x8324('0x30')]['key']};});_0x398744['model']=_[_0x8324('0x2c')](_0x3decbf,_0x8324('0x29'));_0x398744[_0x8324('0x31')]=_[_0x8324('0x32')](_0x2ab76c[_0x8324('0x31')]);_0x398744[_0x8324('0x33')]=_[_0x8324('0x34')](_0x398744[_0x8324('0x35')],_0x398744['query']);_0x29e959[_0x8324('0x36')]=_[_0x8324('0x34')](_0x398744[_0x8324('0x35')],qs[_0x8324('0x37')](_0x2ab76c['query'][_0x8324('0x37')]));_0x29e959['attributes']=_0x29e959[_0x8324('0x36')][_0x8324('0x38')]?_0x29e959['attributes']:_0x398744[_0x8324('0x35')];if(!_0x2ab76c[_0x8324('0x31')][_0x8324('0x39')](_0x8324('0x3a'))){_0x29e959['limit']=qs[_0x8324('0x1f')](_0x2ab76c['query'][_0x8324('0x1f')]);_0x29e959['offset']=qs[_0x8324('0x1d')](_0x2ab76c[_0x8324('0x31')][_0x8324('0x1d')]);}_0x29e959[_0x8324('0x3b')]=qs[_0x8324('0x3c')](_0x2ab76c[_0x8324('0x31')][_0x8324('0x3c')]);_0x29e959['where']=qs[_0x8324('0x33')](_[_0x8324('0x3d')](_0x2ab76c['query'],_0x398744[_0x8324('0x33')]),_0x3decbf);if(_0x2ab76c[_0x8324('0x31')][_0x8324('0x3e')]){_0x29e959[_0x8324('0x3f')]=_[_0x8324('0x40')](_0x29e959[_0x8324('0x3f')],{'$or':_['map'](_0x3decbf,function(_0x4d1b05){if(_0x4d1b05[_0x8324('0x30')]!==_0x8324('0x41')){var _0x3436c4={};_0x3436c4[_0x4d1b05[_0x8324('0x29')]]={'$like':'%'+_0x2ab76c[_0x8324('0x31')]['filter']+'%'};return _0x3436c4;}})});}_0x29e959=_[_0x8324('0x40')]({},_0x29e959,_0x2ab76c[_0x8324('0x42')]);var _0x3a81e7={'where':_0x29e959[_0x8324('0x3f')]};return db['Attachment'][_0x8324('0x20')](_0x3a81e7)[_0x8324('0x27')](function(_0x178e10){_0xcc2bcb[_0x8324('0x20')]=_0x178e10;if(_0x2ab76c[_0x8324('0x31')][_0x8324('0x43')]){_0x29e959['include']=[{'all':!![]}];}return db[_0x8324('0x2d')][_0x8324('0x44')](_0x29e959);})[_0x8324('0x27')](function(_0x172949){_0xcc2bcb[_0x8324('0x45')]=_0x172949;return _0xcc2bcb;})[_0x8324('0x27')](respondWithFilteredResult(_0x1c64d0,_0x29e959))[_0x8324('0x46')](handleError(_0x1c64d0,null));};exports[_0x8324('0x47')]=function(_0x549d86,_0x10f39b){var _0x1f936e={'raw':!![],'where':{'id':_0x549d86[_0x8324('0x48')]['id']}},_0x247d1b={};_0x247d1b[_0x8324('0x35')]=_[_0x8324('0x32')](db[_0x8324('0x2d')][_0x8324('0x2e')]);_0x247d1b[_0x8324('0x31')]=_[_0x8324('0x32')](_0x549d86[_0x8324('0x31')]);_0x247d1b['filters']=_['intersection'](_0x247d1b[_0x8324('0x35')],_0x247d1b[_0x8324('0x31')]);_0x1f936e['attributes']=_[_0x8324('0x34')](_0x247d1b[_0x8324('0x35')],qs['fields'](_0x549d86[_0x8324('0x31')][_0x8324('0x37')]));_0x1f936e[_0x8324('0x36')]=_0x1f936e['attributes'][_0x8324('0x38')]?_0x1f936e[_0x8324('0x36')]:_0x247d1b['model'];if(_0x549d86['query'][_0x8324('0x43')]){_0x1f936e[_0x8324('0x49')]=[{'all':!![]}];}_0x1f936e=_['merge']({},_0x1f936e,_0x549d86[_0x8324('0x42')]);return db['Attachment'][_0x8324('0x4a')](_0x1f936e)[_0x8324('0x27')](handleEntityNotFound(_0x10f39b,null))[_0x8324('0x27')](respondWithResult(_0x10f39b,null))[_0x8324('0x46')](handleError(_0x10f39b,null));};exports[_0x8324('0x4b')]=function(_0x25fc77,_0x391b81){var _0x5706aa={'where':{'id':_0x25fc77['params']['id']}},_0x5d5a4f={};_0x5d5a4f[_0x8324('0x35')]=_['keys'](db['Attachment']['rawAttributes']);_0x5706aa['attributes']=_[_0x8324('0x34')](_0x5d5a4f[_0x8324('0x35')],qs['fields'](_0x25fc77['query'][_0x8324('0x37')]));_0x5706aa[_0x8324('0x36')]=_0x5706aa[_0x8324('0x36')][_0x8324('0x38')]?_0x5706aa['attributes']:_0x5d5a4f[_0x8324('0x35')];if(_0x25fc77[_0x8324('0x31')]['includeAll']){_0x5706aa[_0x8324('0x49')]=[{'all':!![]}];}_0x5706aa=_[_0x8324('0x40')]({},_0x5706aa,_0x25fc77[_0x8324('0x42')]);return db['Attachment']['find'](_0x5706aa)[_0x8324('0x27')](handleEntityNotFound(_0x391b81,null))[_0x8324('0x27')](function(_0x298208){if(_0x298208){var _0x312bcd=_0x298208['get']({'plain':!![]});_0x312bcd=qs['omit'](_0x312bcd,['id',_0x8324('0x4c'),_0x8324('0x4d')]);_0x25fc77[_0x8324('0x4e')]=_[_0x8324('0x4f')](_0x25fc77[_0x8324('0x4e')],['id',_0x8324('0x4c'),_0x8324('0x4d')]);return db[_0x8324('0x2d')]['create'](_[_0x8324('0x40')](_0x312bcd,_0x25fc77[_0x8324('0x4e')]),{'include':_0x25fc77[_0x8324('0x31')][_0x8324('0x43')]?[{'all':!![]}]:undefined});}})[_0x8324('0x27')](respondWithResult(_0x391b81,0xc9))[_0x8324('0x46')](handleError(_0x391b81,null));};exports[_0x8324('0x26')]=function(_0x5c2f17,_0x104133){if(_0x5c2f17[_0x8324('0x4e')]['id']){delete _0x5c2f17['body']['id'];}return db['Attachment'][_0x8324('0x4a')]({'where':{'id':_0x5c2f17[_0x8324('0x48')]['id']}})['then'](handleEntityNotFound(_0x104133,null))[_0x8324('0x27')](saveUpdates(_0x5c2f17[_0x8324('0x4e')],null))[_0x8324('0x27')](respondWithResult(_0x104133,null))[_0x8324('0x46')](handleError(_0x104133,null));};exports[_0x8324('0x28')]=function(_0xf3d800,_0x1f18da){return db['Attachment'][_0x8324('0x4a')]({'where':{'id':_0xf3d800[_0x8324('0x48')]['id']}})[_0x8324('0x27')](handleEntityNotFound(_0x1f18da,null))[_0x8324('0x27')](removeEntity(_0x1f18da,null))['catch'](handleError(_0x1f18da,null));};exports[_0x8324('0x50')]=function(_0x714e84,_0x46a4bc,_0x41ffb8){_0x714e84[_0x8324('0x4e')]['name']=_0x714e84[_0x8324('0x51')][_0x8324('0x52')];_0x714e84[_0x8324('0x4e')][_0x8324('0x53')]=_0x714e84[_0x8324('0x51')][_0x8324('0x54')];_0x714e84['body']['type']=_0x714e84[_0x8324('0x51')]['mimetype'];return db[_0x8324('0x2d')][_0x8324('0x50')](_0x714e84['body'])[_0x8324('0x27')](respondWithResult(_0x46a4bc,0xc9))[_0x8324('0x46')](handleError(_0x46a4bc,null));};exports[_0x8324('0x55')]=function(_0x17034c,_0x4e3798,_0x442f60){return db[_0x8324('0x2d')][_0x8324('0x56')]({'where':{'id':_0x17034c[_0x8324('0x48')]['id']},'raw':!![]})[_0x8324('0x27')](handleEntityNotFound(_0x4e3798,null))[_0x8324('0x27')](function(_0x23e374){if(_0x23e374){var _0x3490df=_0x23e374[_0x8324('0x57')]!==null;var _0x462cb9=path[_0x8324('0x58')](config[_0x8324('0x59')],_0x8324('0x5a'));if(_0x3490df){_0x462cb9=path['join'](_0x462cb9,_0x8324('0x5b'));}var _0x5bc255=path[_0x8324('0x58')](_0x462cb9,_0x23e374['basename']);return _0x4e3798[_0x8324('0x55')](_0x5bc255);}})[_0x8324('0x46')](handleError(_0x4e3798,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index dcff5e9..3f69152 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 _0x9efc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','attachments','lodash','util','../../config/logger'];(function(_0xa45c45,_0x2de75d){var _0x5ab426=function(_0x310b5e){while(--_0x310b5e){_0xa45c45['push'](_0xa45c45['shift']());}};_0x5ab426(++_0x2de75d);}(_0x9efc,0x97));var _0xc9ef=function(_0x45c5f9,_0x1ad8c9){_0x45c5f9=_0x45c5f9-0x0;var _0x22cc60=_0x9efc[_0x45c5f9];return _0x22cc60;};'use strict';var _=require(_0xc9ef('0x0'));var util=require(_0xc9ef('0x1'));var logger=require(_0xc9ef('0x2'))(_0xc9ef('0x3'));var moment=require(_0xc9ef('0x4'));var BPromise=require(_0xc9ef('0x5'));var rp=require(_0xc9ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9ef('0x7'));var config=require(_0xc9ef('0x8'));var attributes=require(_0xc9ef('0x9'));module['exports']=function(_0x45f0ad,_0x560298){return _0x45f0ad['define']('Attachment',attributes,{'tableName':_0xc9ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbe3=['../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0xfbe3,0xa1));var _0x3fbe=function(_0x2e7522,_0x5b1548){_0x2e7522=_0x2e7522-0x0;var _0x200019=_0xfbe3[_0x2e7522];return _0x200019;};'use strict';var _=require(_0x3fbe('0x0'));var util=require('util');var logger=require(_0x3fbe('0x1'))(_0x3fbe('0x2'));var moment=require(_0x3fbe('0x3'));var BPromise=require(_0x3fbe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fbe('0x5'));var rimraf=require(_0x3fbe('0x6'));var config=require(_0x3fbe('0x7'));var attributes=require(_0x3fbe('0x8'));module['exports']=function(_0x507f81,_0x4d0fab){return _0x507f81[_0x3fbe('0x9')](_0x3fbe('0xa'),attributes,{'tableName':_0x3fbe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index d38b650..27aae84 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 _0xfaa4=['http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Attachment','create','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xe3b50f,_0x2d8aa2){var _0xfb095d=function(_0x3a2e92){while(--_0x3a2e92){_0xe3b50f['push'](_0xe3b50f['shift']());}};_0xfb095d(++_0x2d8aa2);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x47f56f,_0x32a463){_0x47f56f=_0x47f56f-0x0;var _0x4b285d=_0xfaa4[_0x47f56f];return _0x4b285d;};'use strict';var _=require(_0x4faa('0x0'));var util=require(_0x4faa('0x1'));var moment=require(_0x4faa('0x2'));var BPromise=require(_0x4faa('0x3'));var rs=require(_0x4faa('0x4'));var fs=require('fs');var Redis=require(_0x4faa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4faa('0x6'));var logger=require(_0x4faa('0x7'))(_0x4faa('0x8'));var config=require(_0x4faa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4faa('0xa')][_0x4faa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa46a7d,_0x504f83,_0x528871){return new BPromise(function(_0x5d476f,_0x159843){return client[_0x4faa('0xc')](_0xa46a7d,_0x528871)[_0x4faa('0xd')](function(_0x4dd4d4){logger[_0x4faa('0xe')](_0x4faa('0xf'),_0x504f83,_0x4faa('0x10'));logger[_0x4faa('0x11')](_0x4faa('0x12'),_0x504f83,'request\x20sent',JSON['stringify'](_0x4dd4d4));if(_0x4dd4d4[_0x4faa('0x13')]){if(_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x14')]===0x1f4){logger[_0x4faa('0x13')](_0x4faa('0xf'),_0x504f83,_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x15')]);return _0x159843(_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x15')]);}logger[_0x4faa('0x13')](_0x4faa('0xf'),_0x504f83,_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x15')]);return _0x5d476f(_0x4dd4d4['error'][_0x4faa('0x15')]);}else{logger[_0x4faa('0xe')](_0x4faa('0xf'),_0x504f83,'request\x20sent');_0x5d476f(_0x4dd4d4[_0x4faa('0x16')][_0x4faa('0x15')]);}})[_0x4faa('0x17')](function(_0x536a2b){logger[_0x4faa('0x13')](_0x4faa('0xf'),_0x504f83,_0x536a2b);_0x159843(_0x536a2b);});});}exports['CreateAttachment']=function(_0x5d8c8a){var _0x5444d9=this;return new Promise(function(_0x33592d,_0x361cdc){return db[_0x4faa('0x18')][_0x4faa('0x19')](_0x5d8c8a['body'],{'raw':_0x5d8c8a[_0x4faa('0x1a')]?_0x5d8c8a[_0x4faa('0x1a')][_0x4faa('0x1b')]===undefined?!![]:![]:!![]})[_0x4faa('0xd')](function(_0x492417){logger[_0x4faa('0xe')]('CreateAttachment',_0x5d8c8a);logger['debug'](_0x4faa('0x1c'),_0x5d8c8a,JSON['stringify'](_0x492417));_0x33592d(_0x492417);})['catch'](function(_0x14683b){logger[_0x4faa('0x13')](_0x4faa('0x1c'),_0x14683b[_0x4faa('0x15')],_0x5d8c8a);_0x361cdc(_0x5444d9[_0x4faa('0x13')](0x1f4,_0x14683b[_0x4faa('0x15')]));});});}; \ No newline at end of file +var _0xf46a=['http','then','request\x20sent','debug','stringify','error','code','Attachment,\x20%s,\x20%s','message','info','Attachment','create','options','CreateAttachment','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xb5a881,_0x101dd8){var _0x1979ce=function(_0xcf7a83){while(--_0xcf7a83){_0xb5a881['push'](_0xb5a881['shift']());}};_0x1979ce(++_0x101dd8);}(_0xf46a,0xa4));var _0xaf46=function(_0x3ebb6d,_0x38c763){_0x3ebb6d=_0x3ebb6d-0x0;var _0x4b1351=_0xf46a[_0x3ebb6d];return _0x4b1351;};'use strict';var _=require(_0xaf46('0x0'));var util=require('util');var moment=require(_0xaf46('0x1'));var BPromise=require(_0xaf46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf46('0x3'));var db=require(_0xaf46('0x4'))['db'];var utils=require(_0xaf46('0x5'));var logger=require(_0xaf46('0x6'))(_0xaf46('0x7'));var config=require(_0xaf46('0x8'));var jayson=require(_0xaf46('0x9'));var client=jayson[_0xaf46('0xa')][_0xaf46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9e9887,_0x4f76cc,_0xa4a618){return new BPromise(function(_0x105943,_0x328d92){return client['request'](_0x9e9887,_0xa4a618)[_0xaf46('0xc')](function(_0x4e67c0){logger['info']('Attachment,\x20%s,\x20%s',_0x4f76cc,_0xaf46('0xd'));logger[_0xaf46('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4f76cc,_0xaf46('0xd'),JSON[_0xaf46('0xf')](_0x4e67c0));if(_0x4e67c0[_0xaf46('0x10')]){if(_0x4e67c0['error'][_0xaf46('0x11')]===0x1f4){logger['error'](_0xaf46('0x12'),_0x4f76cc,_0x4e67c0['error'][_0xaf46('0x13')]);return _0x328d92(_0x4e67c0['error'][_0xaf46('0x13')]);}logger[_0xaf46('0x10')](_0xaf46('0x12'),_0x4f76cc,_0x4e67c0[_0xaf46('0x10')][_0xaf46('0x13')]);return _0x105943(_0x4e67c0[_0xaf46('0x10')][_0xaf46('0x13')]);}else{logger[_0xaf46('0x14')]('Attachment,\x20%s,\x20%s',_0x4f76cc,'request\x20sent');_0x105943(_0x4e67c0['result'][_0xaf46('0x13')]);}})['catch'](function(_0x498720){logger[_0xaf46('0x10')](_0xaf46('0x12'),_0x4f76cc,_0x498720);_0x328d92(_0x498720);});});}exports['CreateAttachment']=function(_0x128ad8){var _0x3a26f1=this;return new Promise(function(_0x224413,_0xd1b9ce){return db[_0xaf46('0x15')][_0xaf46('0x16')](_0x128ad8['body'],{'raw':_0x128ad8[_0xaf46('0x17')]?_0x128ad8[_0xaf46('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xaf46('0xc')](function(_0x4459d5){logger['info']('CreateAttachment',_0x128ad8);logger['debug'](_0xaf46('0x18'),_0x128ad8,JSON[_0xaf46('0xf')](_0x4459d5));_0x224413(_0x4459d5);})['catch'](function(_0x183cb6){logger['error'](_0xaf46('0x18'),_0x183cb6[_0xaf46('0x13')],_0x128ad8);_0xd1b9ce(_0x3a26f1[_0xaf46('0x10')](0x1f4,_0x183cb6[_0xaf46('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 89cdfa7..9038913 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 _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(_0x35907a,_0x6ef545){var _0x49b1d6=function(_0x2d5c4d){while(--_0x2d5c4d){_0x35907a['push'](_0x35907a['shift']());}};_0x49b1d6(++_0x6ef545);}(_0x5f2f,0x73));var _0xf5f2=function(_0x579873,_0x4865a9){_0x579873=_0x579873-0x0;var _0x222961=_0x5f2f[_0x579873];return _0x222961;};'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 +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x0b0e,0x187));var _0xe0b0=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x0b0e[_0x483d8b];return _0x6500f1;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index d9ea48a..d630fca 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 _0x9509=['online','user','agent','then','blocked','blockedAt','add','minutes','getLicense','status','send','message','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','User','passport','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','domain','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt'];(function(_0x23aa0f,_0x51c827){var _0x3749bd=function(_0x5ea1c8){while(--_0x5ea1c8){_0x23aa0f['push'](_0x23aa0f['shift']());}};_0x3749bd(++_0x51c827);}(_0x9509,0x1bb));var _0x9950=function(_0x5c1a8d,_0x2fee45){_0x5c1a8d=_0x5c1a8d-0x0;var _0xda1a1e=_0x9509[_0x5c1a8d];return _0xda1a1e;};'use strict';var passport=require(_0x9950('0x0'));var LocalStrategy=require('passport-local')[_0x9950('0x1')];var moment=require(_0x9950('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x9950('0x3'));var util=require(_0x9950('0x4'));var db=require(_0x9950('0x5'))['db'];var authService=require(_0x9950('0x6'));var utils=require(_0x9950('0x7'));var config=require(_0x9950('0x8'));var logger=require('../../config/logger')(_0x9950('0x9'));function isActiveDirectoryConfigured(_0x1b6ee9){var _0x4cdcf5=![];if(typeof _0x1b6ee9[_0x9950('0xa')]!==_0x9950('0xb')){_0x4cdcf5=_0x1b6ee9[_0x9950('0xa')][_0x9950('0xc')]&&_0x1b6ee9['activedirectory']['url']&&_0x1b6ee9[_0x9950('0xa')][_0x9950('0xd')];}return _0x4cdcf5;}function adAuthenticate(_0x22cd05,_0x3a8c45,_0x2ec994){return new BPromise(function(_0x80ea7,_0x1e151d){try{var _0xf3636f=new ActiveDirectory(_0x22cd05);_0xf3636f['authenticate'](_0x3a8c45,_0x2ec994,function(_0x448255,_0x118033){if(_0x448255){logger[_0x9950('0xe')](_0x9950('0xf'),_0x3a8c45,util['inspect'](_0x448255,{'showHidden':![],'depth':null}));_0x1e151d(_0x9950('0x10'));}else if(!_0x118033){logger[_0x9950('0xe')](_0x9950('0x11'),_0x3a8c45);_0x1e151d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x80ea7(_0x118033);}});}catch(_0x156db9){_0x1e151d(_0x156db9);}});}function ActiveDirectoryAuthenticate(_0x1cd65e,_0x2ea1cb,_0x571ec3,_0x51c90c){var _0x59afdc,_0x24e736;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x9950('0x12'),_0x2ea1cb);return _0x51c90c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x9950('0x13')]['findOne']({'where':{'id':0x1},'attributes':[_0x9950('0x14'),_0x9950('0x15')],'raw':!![]})['then'](function(_0x4d3eb5){_0x59afdc=_0x4d3eb5;if(!_0x59afdc[_0x9950('0x14')]){logger[_0x9950('0xe')](_0x9950('0x16'),_0x2ea1cb);throw new Error(_0x9950('0x10'));}return _0x1cd65e[_0x9950('0x17')]({'attributes':['id',_0x9950('0x18'),_0x9950('0x19'),_0x9950('0x1a'),'role','disabled','blocked','blockedAt',_0x9950('0x1b')],'where':{'name':_0x2ea1cb,'role':{'$or':['admin',_0x9950('0x1c'),_0x9950('0x1d')]},'adSsoEnabled':!![]}});})[_0x9950('0x1e')](function(_0x2f1cdf){if(!_0x2f1cdf||_0x2f1cdf&&_0x2f1cdf[_0x9950('0x18')]!==_0x2ea1cb){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x24e736=_0x2f1cdf;var _0x392421=_0x24e736[_0x9950('0x18')]+'@'+config[_0x9950('0xa')]['domain'];return adAuthenticate(config[_0x9950('0xa')],_0x392421,_0x571ec3);})['then'](function(_0x5f1800){if(_0x24e736['disabled']){throw new Error(_0x9950('0x10'));}if(_0x59afdc[_0x9950('0x15')]>0x0){if(_0x24e736[_0x9950('0x1f')]){if(moment(_0x24e736[_0x9950('0x20')])[_0x9950('0x21')](_0x59afdc[_0x9950('0x15')],_0x9950('0x22'))>moment()){throw new Error(_0x9950('0x10'));}return utils['clearBlockUser'](_0x24e736,0x0,![],null)[_0x9950('0x1e')](function(){return utils[_0x9950('0x23')](_0x24e736);})[_0x9950('0x1e')](function(){return _0x51c90c(null,_0x24e736);});}else{return utils[_0x9950('0x23')](_0x24e736)[_0x9950('0x1e')](function(){return _0x51c90c(null,_0x24e736);});}}else{return utils[_0x9950('0x23')](_0x24e736)[_0x9950('0x1e')](function(){return _0x51c90c(null,_0x24e736);});}})['catch'](function(_0x1e47bc){return _0x51c90c(null,![],_0x1e47bc);});}function handleError(_0x11c4a4,_0x5a982f,_0x3df1f0){return _0x11c4a4[_0x9950('0x24')](_0x5a982f||0x1f4)[_0x9950('0x25')]({'message':_0x3df1f0?_0x3df1f0[_0x9950('0x26')]||_0x3df1f0:''});}exports['login']=function(_0x3ffbd8,_0x159189,_0x4a673d){passport[_0x9950('0x27')](_0x9950('0x28'),function(_0x428a22,_0x1e3b7f,_0x5b0f1d){var _0x2db60f=_0x428a22||_0x5b0f1d;if(_0x2db60f){return handleError(_0x159189,0x191,_0x2db60f);}if(!_0x1e3b7f){return handleError(_0x159189,0x194,{'message':_0x9950('0x29')});}else{var _0x31222={'payload':{'id':_0x1e3b7f['id'],'role':_0x1e3b7f[_0x9950('0x2a')]},'options':{'expiresIn':0x15180}};return authService[_0x9950('0x2b')](_0x31222)[_0x9950('0x1e')](function(_0x3c7f73){_0x159189[_0x9950('0x2c')]({'id':_0x1e3b7f['id'],'token':_0x3c7f73,'statusCall':'','isAlreadyLogged':_0x1e3b7f[_0x9950('0x1b')]});});}})(_0x3ffbd8,_0x159189,_0x4a673d);};passport[_0x9950('0x2d')]('ad-login',new LocalStrategy({'usernameField':_0x9950('0x18'),'passwordField':_0x9950('0x19')},function(_0x13fd5e,_0x236ff8,_0xeea1b2){return ActiveDirectoryAuthenticate(db[_0x9950('0x2e')],_0x13fd5e,_0x236ff8,_0xeea1b2);})); \ No newline at end of file +var _0x1b21=['blockedAt','agent','domain','add','clearBlockUser','getLicense','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','use','password','User','passport','Strategy','activedirectory2','bluebird','util','../../components/auth/service','../../config/environment','api','activedirectory','undefined','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','blocked'];(function(_0x17e319,_0x347c53){var _0xd6ba0f=function(_0x487e6b){while(--_0x487e6b){_0x17e319['push'](_0x17e319['shift']());}};_0xd6ba0f(++_0x347c53);}(_0x1b21,0x14e));var _0x11b2=function(_0xd6c062,_0x51fbea){_0xd6c062=_0xd6c062-0x0;var _0x38ce9c=_0x1b21[_0xd6c062];return _0x38ce9c;};'use strict';var passport=require(_0x11b2('0x0'));var LocalStrategy=require('passport-local')[_0x11b2('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x11b2('0x2'));var BPromise=require(_0x11b2('0x3'));var util=require(_0x11b2('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x11b2('0x5'));var utils=require('../../config/utils');var config=require(_0x11b2('0x6'));var logger=require('../../config/logger')(_0x11b2('0x7'));function isActiveDirectoryConfigured(_0x1d7810){var _0x4ab51d=![];if(typeof _0x1d7810[_0x11b2('0x8')]!==_0x11b2('0x9')){_0x4ab51d=_0x1d7810['activedirectory'][_0x11b2('0xa')]&&_0x1d7810[_0x11b2('0x8')][_0x11b2('0xb')]&&_0x1d7810[_0x11b2('0x8')]['domain'];}return _0x4ab51d;}function adAuthenticate(_0x2a9f1c,_0x3d3faa,_0x3cba72){return new BPromise(function(_0x572381,_0x5e312b){try{var _0x4799a5=new ActiveDirectory(_0x2a9f1c);_0x4799a5[_0x11b2('0xc')](_0x3d3faa,_0x3cba72,function(_0xcf2c7,_0xae2573){if(_0xcf2c7){logger[_0x11b2('0xd')](_0x11b2('0xe'),_0x3d3faa,util[_0x11b2('0xf')](_0xcf2c7,{'showHidden':![],'depth':null}));_0x5e312b(_0x11b2('0x10'));}else if(!_0xae2573){logger[_0x11b2('0xd')](_0x11b2('0x11'),_0x3d3faa);_0x5e312b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x572381(_0xae2573);}});}catch(_0x2c4316){_0x5e312b(_0x2c4316);}});}function ActiveDirectoryAuthenticate(_0x4e2d36,_0x41a981,_0x3fd4d0,_0x571927){var _0x2153c8,_0x183e9b;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x41a981);return _0x571927(null,![],{'message':_0x11b2('0x10')});}return db[_0x11b2('0x12')]['findOne']({'where':{'id':0x1},'attributes':[_0x11b2('0x13'),_0x11b2('0x14')],'raw':!![]})[_0x11b2('0x15')](function(_0x137f88){_0x2153c8=_0x137f88;if(!_0x2153c8[_0x11b2('0x13')]){logger[_0x11b2('0xd')](_0x11b2('0x16'),_0x41a981);throw new Error(_0x11b2('0x10'));}return _0x4e2d36[_0x11b2('0x17')]({'attributes':['id',_0x11b2('0x18'),'password','salt','role','disabled',_0x11b2('0x19'),_0x11b2('0x1a'),'online'],'where':{'name':_0x41a981,'role':{'$or':['admin','user',_0x11b2('0x1b')]},'adSsoEnabled':!![]}});})[_0x11b2('0x15')](function(_0x49ef99){if(!_0x49ef99||_0x49ef99&&_0x49ef99[_0x11b2('0x18')]!==_0x41a981){throw new Error(_0x11b2('0x10'));}_0x183e9b=_0x49ef99;var _0x59dd9d=_0x183e9b[_0x11b2('0x18')]+'@'+config[_0x11b2('0x8')][_0x11b2('0x1c')];return adAuthenticate(config[_0x11b2('0x8')],_0x59dd9d,_0x3fd4d0);})[_0x11b2('0x15')](function(_0x4321e2){if(_0x183e9b['disabled']){throw new Error(_0x11b2('0x10'));}if(_0x2153c8[_0x11b2('0x14')]>0x0){if(_0x183e9b[_0x11b2('0x19')]){if(moment(_0x183e9b['blockedAt'])[_0x11b2('0x1d')](_0x2153c8['blockDuration'],'minutes')>moment()){throw new Error(_0x11b2('0x10'));}return utils[_0x11b2('0x1e')](_0x183e9b,0x0,![],null)[_0x11b2('0x15')](function(){return utils[_0x11b2('0x1f')](_0x183e9b);})[_0x11b2('0x15')](function(){return _0x571927(null,_0x183e9b);});}else{return utils['getLicense'](_0x183e9b)[_0x11b2('0x15')](function(){return _0x571927(null,_0x183e9b);});}}else{return utils[_0x11b2('0x1f')](_0x183e9b)[_0x11b2('0x15')](function(){return _0x571927(null,_0x183e9b);});}})['catch'](function(_0x460703){return _0x571927(null,![],_0x460703);});}function handleError(_0x2458ee,_0x29d015,_0x40b55e){return _0x2458ee['status'](_0x29d015||0x1f4)['send']({'message':_0x40b55e?_0x40b55e['message']||_0x40b55e:''});}exports[_0x11b2('0x20')]=function(_0x2feb6c,_0x48136d,_0x4700aa){passport[_0x11b2('0xc')](_0x11b2('0x21'),function(_0xab7a0a,_0x544022,_0x2eea65){var _0x22e0e8=_0xab7a0a||_0x2eea65;if(_0x22e0e8){return handleError(_0x48136d,0x191,_0x22e0e8);}if(!_0x544022){return handleError(_0x48136d,0x194,{'message':_0x11b2('0x22')});}else{var _0x2f645e={'payload':{'id':_0x544022['id'],'role':_0x544022[_0x11b2('0x23')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2f645e)[_0x11b2('0x15')](function(_0x38b922){_0x48136d[_0x11b2('0x24')]({'id':_0x544022['id'],'token':_0x38b922,'statusCall':'','isAlreadyLogged':_0x544022['online']});});}})(_0x2feb6c,_0x48136d,_0x4700aa);};passport[_0x11b2('0x25')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x11b2('0x26')},function(_0x2d566a,_0x242996,_0x3994ef){return ActiveDirectoryAuthenticate(db[_0x11b2('0x27')],_0x2d566a,_0x242996,_0x3994ef);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index ceec8eb..802fd26 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 _0xde16=['post','exports','express','./authActiveDirectory.controller'];(function(_0x165eb7,_0x39ec5c){var _0x3a5082=function(_0x4b1223){while(--_0x4b1223){_0x165eb7['push'](_0x165eb7['shift']());}};_0x3a5082(++_0x39ec5c);}(_0xde16,0x18e));var _0x6de1=function(_0x41195b,_0x5087e1){_0x41195b=_0x41195b-0x0;var _0x53360c=_0xde16[_0x41195b];return _0x53360c;};'use strict';var express=require(_0x6de1('0x0'));var router=express['Router']();var controller=require(_0x6de1('0x1'));router[_0x6de1('0x2')]('/',controller['login']);module[_0x6de1('0x3')]=router; \ No newline at end of file +var _0xd7ad=['./authActiveDirectory.controller','post','login','exports','Router'];(function(_0xd1213b,_0x2a06e5){var _0x55bc1e=function(_0x12f618){while(--_0x12f618){_0xd1213b['push'](_0xd1213b['shift']());}};_0x55bc1e(++_0x2a06e5);}(_0xd7ad,0x90));var _0xdd7a=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xd7ad[_0x125ff8];return _0x2d9ef;};'use strict';var express=require('express');var router=express[_0xdd7a('0x0')]();var controller=require(_0xdd7a('0x1'));router[_0xdd7a('0x2')]('/',controller[_0xdd7a('0x3')]);module[_0xdd7a('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d9f20b8..502a25d 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(_0x57ae10,_0x5e1089){var _0x5b58dd=function(_0x1c75bf){while(--_0x1c75bf){_0x57ae10['push'](_0x57ae10['shift']());}};_0x5b58dd(++_0x5e1089);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x94b021,_0x3e419c){var _0xfde528=function(_0x21be48){while(--_0x21be48){_0x94b021['push'](_0x94b021['shift']());}};_0xfde528(++_0x3e419c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 687c25f..33da97c 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 _0x64c4=['./authGoogle.controller','../user/user.controller.js','get','login','callback','isMiddleware','setTokenCookie','exports','passport'];(function(_0x17b693,_0x137279){var _0x354af3=function(_0x3cc527){while(--_0x3cc527){_0x17b693['push'](_0x17b693['shift']());}};_0x354af3(++_0x137279);}(_0x64c4,0x13a));var _0x464c=function(_0x449c41,_0x30c2bd){_0x449c41=_0x449c41-0x0;var _0x4a8a78=_0x64c4[_0x449c41];return _0x4a8a78;};'use strict';var express=require('express');var passport=require(_0x464c('0x0'));var router=express['Router']();var controller=require(_0x464c('0x1'));var userController=require(_0x464c('0x2'));var authService=require('../../components/auth/service');router[_0x464c('0x3')]('/',controller[_0x464c('0x4')]);router[_0x464c('0x3')]('/callback',controller[_0x464c('0x5')],authService[_0x464c('0x6')],userController[_0x464c('0x4')],authService[_0x464c('0x7')]);module[_0x464c('0x8')]=router; \ No newline at end of file +var _0xc94a=['express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','setTokenCookie'];(function(_0x4e8875,_0x1e44f2){var _0x257b43=function(_0x978de){while(--_0x978de){_0x4e8875['push'](_0x4e8875['shift']());}};_0x257b43(++_0x1e44f2);}(_0xc94a,0x14a));var _0xac94=function(_0x3cb539,_0x244bb7){_0x3cb539=_0x3cb539-0x0;var _0x2f748f=_0xc94a[_0x3cb539];return _0x2f748f;};'use strict';var express=require(_0xac94('0x0'));var passport=require(_0xac94('0x1'));var router=express['Router']();var controller=require(_0xac94('0x2'));var userController=require(_0xac94('0x3'));var authService=require(_0xac94('0x4'));router['get']('/',controller[_0xac94('0x5')]);router[_0xac94('0x6')](_0xac94('0x7'),controller[_0xac94('0x8')],authService['isMiddleware'],userController['login'],authService[_0xac94('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index db7f06a..d18eb80 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 _0x1600=['send','reset','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','blockDuration','then','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','SendMail','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','email','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'];(function(_0x33a7b9,_0x21efd5){var _0x177aea=function(_0x3c0c8f){while(--_0x3c0c8f){_0x33a7b9['push'](_0x33a7b9['shift']());}};_0x177aea(++_0x21efd5);}(_0x1600,0x1a8));var _0x0160=function(_0x1c8a26,_0x5562c8){_0x1c8a26=_0x1c8a26-0x0;var _0x59c1e5=_0x1600[_0x1c8a26];return _0x59c1e5;};'use strict';var util=require(_0x0160('0x0'));var passport=require(_0x0160('0x1'));var LocalStrategy=require(_0x0160('0x2'))[_0x0160('0x3')];var jayson=require(_0x0160('0x4'));var _=require('lodash');var rs=require(_0x0160('0x5'));var moment=require('moment');var db=require(_0x0160('0x6'))['db'];var authService=require(_0x0160('0x7'));var utils=require(_0x0160('0x8'));var client=jayson['client'][_0x0160('0x9')]({'port':0x232b});function localAuthenticate(_0x1431b2,_0x5e56ba,_0x4e1dd2,_0x10377d){var _0x2d7f2f,_0x108100;return db['Setting'][_0x0160('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0160('0xb')],'raw':!![]})[_0x0160('0xc')](function(_0x546f52){_0x2d7f2f=_0x546f52;return _0x1431b2[_0x0160('0xa')]({'attributes':['id',_0x0160('0xd'),_0x0160('0xe'),_0x0160('0xf'),_0x0160('0x10'),'disabled',_0x0160('0x11'),_0x0160('0x12'),_0x0160('0x13')],'where':{'name':_0x5e56ba,'role':{'$or':[_0x0160('0x14'),_0x0160('0x15'),_0x0160('0x16')]}}});})[_0x0160('0xc')](function(_0x5c0162){if(!_0x5c0162||_0x5c0162&&_0x5c0162[_0x0160('0xd')]!==_0x5e56ba){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x108100=_0x5c0162;return _0x108100;}})['then'](function(){_0x108100[_0x0160('0x17')](_0x4e1dd2,function(_0x1b7550,_0x24e7e8){var _0x4f2b22=_0x108100['loginAttempts']+0x1;if(_0x1b7550){return _0x10377d(_0x1b7550);}else if(!_0x24e7e8){if(_0x108100[_0x0160('0x18')]){return _0x10377d(null,![],{'message':_0x0160('0x19')});}else if(_0x2d7f2f[_0x0160('0x1a')]>0x0){if(_0x108100['blocked']){if(_0x2d7f2f[_0x0160('0xb')]>0x0){if(moment(_0x108100[_0x0160('0x12')])['add'](_0x2d7f2f[_0x0160('0xb')],_0x0160('0x1b'))>moment()){return _0x10377d(null,![],{'message':_0x0160('0x19')});}else{return utils['clearBlockUser'](_0x108100,_0x4f2b22,![],null)[_0x0160('0xc')](function(){return _0x10377d(null,![],{'message':_0x0160('0x19')});});}}else{return _0x10377d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4f2b22>=_0x2d7f2f[_0x0160('0x1a')]){return utils['clearBlockUser'](_0x108100,0x0,!![],moment())[_0x0160('0xc')](function(){return _0x10377d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x0160('0x1c')](_0x108100,_0x4f2b22,![],null)[_0x0160('0xc')](function(){return _0x10377d(null,![],{'message':_0x0160('0x19')});});}}}else{return _0x10377d(null,![],{'message':_0x0160('0x19')});}}else{if(_0x108100[_0x0160('0x18')]){return _0x10377d(null,![],{'message':_0x0160('0x19')});}else if(_0x2d7f2f[_0x0160('0x1a')]>0x0){if(_0x108100['blocked']){if(_0x2d7f2f['blockDuration']>0x0){if(moment(_0x108100[_0x0160('0x12')])[_0x0160('0x1d')](_0x2d7f2f[_0x0160('0xb')],_0x0160('0x1b'))>moment()){return _0x10377d(null,![],{'message':_0x0160('0x19')});}else{return utils['clearBlockUser'](_0x108100,0x0,![],null)[_0x0160('0xc')](function(){return utils[_0x0160('0x1e')](_0x108100);})[_0x0160('0xc')](function(){return _0x10377d(null,_0x108100);});}}else{return _0x10377d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x108100,0x0,![],null)[_0x0160('0xc')](function(){return utils[_0x0160('0x1e')](_0x108100);})[_0x0160('0xc')](function(){return _0x10377d(null,_0x108100);})[_0x0160('0x1f')](function(_0x590dab){return _0x10377d(null,![],_0x590dab);});}}else{if(_0x108100['blocked']){return _0x10377d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0160('0x1e')](_0x108100)[_0x0160('0xc')](function(){return _0x10377d(null,_0x108100);});}}}});})['catch'](function(_0x2e1ff4){return _0x10377d(null,![],_0x2e1ff4);});}function sendServiceMail(_0x325957){return db[_0x0160('0x20')][_0x0160('0x21')]({'where':{'service':!![]},'attributes':['id',_0x0160('0xd'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x0160('0x22'),'include':[{'model':db[_0x0160('0x23')],'as':_0x0160('0x23')}]}]})[_0x0160('0xc')](function(_0x41bd35){if(!_0x41bd35){throw new Error(_0x0160('0x24'));}var _0x3fa10b=_0x41bd35['getSmtpOptions']();var _0x38419e={'account':_0x3fa10b,'message':_[_0x0160('0x25')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x41bd35['name'],_0x41bd35['email']||_0x41bd35[_0x0160('0x22')]['user'])},_0x325957)};return client['request'](_0x0160('0x26'),_0x38419e);})[_0x0160('0xc')](function(_0x583579){if(_0x583579['error']){throw new Error(util[_0x0160('0x27')](_0x0160('0x28'),_0x583579[_0x0160('0x29')][_0x0160('0x2a')]||JSON['stringify'](_0x583579[_0x0160('0x29')])));}return!![];});}function handleError(_0xbf5959,_0xc53323,_0x14851c){return _0xbf5959[_0x0160('0x2b')](_0xc53323||0x1f4)['send']({'message':_0x14851c?_0x14851c['message']||_0x14851c:''});}exports[_0x0160('0x2c')]=function(_0x299958,_0x7d7da4,_0xc09e3e){passport[_0x0160('0x17')](_0x0160('0x2d'),function(_0x57d0fb,_0x5d17ce,_0x4b57f8){var _0x21ba9d=_0x57d0fb||_0x4b57f8;if(_0x21ba9d){return handleError(_0x7d7da4,0x191,_0x21ba9d);}if(!_0x5d17ce){return handleError(_0x7d7da4,0x194,{'message':_0x0160('0x2e')});}else{var _0x16672f={'payload':{'id':_0x5d17ce['id'],'role':_0x5d17ce[_0x0160('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x0160('0x2f')](_0x16672f)[_0x0160('0xc')](function(_0x275162){_0x7d7da4[_0x0160('0x30')]({'id':_0x5d17ce['id'],'token':_0x275162,'statusCall':'','isAlreadyLogged':_0x5d17ce['online']});});}})(_0x299958,_0x7d7da4,_0xc09e3e);};exports[_0x0160('0x31')]=function(_0x5ef1da,_0x3243e1){if(!_0x5ef1da[_0x0160('0x32')][_0x0160('0x33')]){return handleError(_0x3243e1,0x1f4,{'message':_0x0160('0x34')});}var _0x2cea11=rs[_0x0160('0x35')]();_0x5ef1da[_0x0160('0x32')]['email']=_0x5ef1da[_0x0160('0x32')][_0x0160('0x33')][_0x0160('0x36')]()[_0x0160('0x37')]();var _0x30cc45;return db[_0x0160('0x38')][_0x0160('0xa')]({'where':{'id':0x1},'attributes':[_0x0160('0x1a'),'blockDuration'],'raw':!![]})[_0x0160('0xc')](function(_0x14b314){_0x30cc45=_0x14b314;return db[_0x0160('0x39')][_0x0160('0x21')]({'where':{'email':_0x5ef1da[_0x0160('0x32')][_0x0160('0x33')]}});})[_0x0160('0xc')](function(_0x511bae){if(!_0x511bae){throw new Error(_0x0160('0x3a'));}if(_0x511bae[_0x0160('0x18')]){throw new Error(_0x0160('0x3b'));}if(_0x511bae['blocked']){if(moment(_0x511bae['blockedAt'])[_0x0160('0x1d')](_0x30cc45[_0x0160('0xb')],_0x0160('0x1b'))>moment()){throw new Error(_0x0160('0x3c'));}else{_0x511bae[_0x0160('0x11')]=![];_0x511bae['blockedAt']=null;}}_0x511bae['resetPasswordToken']=_0x2cea11;_0x511bae[_0x0160('0x3d')]=Date['now']()+0x36ee80;return _0x511bae['save']();})[_0x0160('0xc')](function(){return sendServiceMail({'to':_0x5ef1da[_0x0160('0x32')][_0x0160('0x33')],'subject':_0x0160('0x3e'),'text':_0x0160('0x3f')+_0x0160('0x40')+'https://'+_0x5ef1da[_0x0160('0x41')][_0x0160('0x42')]+'/reset/'+_0x2cea11+'\x0a\x0a'+_0x0160('0x43')});})[_0x0160('0xc')](function(){_0x3243e1[_0x0160('0x2b')](0xc8)[_0x0160('0x44')]({'message':'Reset\x20Email\x20sent!'});})[_0x0160('0x1f')](function(_0x2b0b2a){return handleError(_0x3243e1,0x1f4,_0x2b0b2a);});};exports[_0x0160('0x45')]=function(_0x49ec85,_0x31220d){return db[_0x0160('0x39')][_0x0160('0x21')]({'where':{'resetPasswordToken':_0x49ec85['params'][_0x0160('0x46')],'resetPasswordExpires':{'$gt':Date[_0x0160('0x47')]()}}})[_0x0160('0xc')](function(_0x15cde7){if(!_0x15cde7){throw new Error(_0x0160('0x48'));}return db[_0x0160('0x38')]['findOne']({'attributes':['id',_0x0160('0x49'),'enforcePasswordHistory',_0x0160('0x4a')]})[_0x0160('0xc')](function(_0x20a7fa){if(_0x20a7fa['securePassword'])authService[_0x0160('0x4b')](_0x49ec85[_0x0160('0x32')]['password']);if(!_0x20a7fa[_0x0160('0x4c')]||!_0x15cde7[_0x0160('0x4d')])return _0x15cde7;authService[_0x0160('0x4e')](_0x49ec85[_0x0160('0x32')][_0x0160('0xe')],_0x15cde7[_0x0160('0x4d')],_0x20a7fa[_0x0160('0x4a')]);return _0x15cde7;})[_0x0160('0xc')](function(){_0x15cde7['password']=_0x49ec85[_0x0160('0x32')]['password'];_0x15cde7['resetPasswordToken']=null;_0x15cde7[_0x0160('0x3d')]=null;return _0x15cde7[_0x0160('0x4f')]();});})[_0x0160('0xc')](function(){_0x31220d[_0x0160('0x2b')](0xc8)[_0x0160('0x44')]({'message':_0x0160('0x50')});})[_0x0160('0x1f')](function(_0x4ef17a){return handleError(_0x31220d,0x1f4,_0x4ef17a);});};passport[_0x0160('0x51')](_0x0160('0x2d'),new LocalStrategy({'usernameField':_0x0160('0xd'),'passwordField':_0x0160('0xe')},function(_0x162d74,_0x595a12,_0x5a8f06){return localAuthenticate(db[_0x0160('0x39')],_0x162d74,_0x595a12,_0x5a8f06);})); \ No newline at end of file +var _0x1c03=['loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blocked','blockedAt'];(function(_0x4060bb,_0x2e0569){var _0x1c7d5e=function(_0x523d38){while(--_0x523d38){_0x4060bb['push'](_0x4060bb['shift']());}};_0x1c7d5e(++_0x2e0569);}(_0x1c03,0x13e));var _0x31c0=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0x1c03[_0x4314d7];return _0x5c599b;};'use strict';var util=require(_0x31c0('0x0'));var passport=require(_0x31c0('0x1'));var LocalStrategy=require(_0x31c0('0x2'))[_0x31c0('0x3')];var jayson=require('jayson/promise');var _=require(_0x31c0('0x4'));var rs=require(_0x31c0('0x5'));var moment=require(_0x31c0('0x6'));var db=require(_0x31c0('0x7'))['db'];var authService=require(_0x31c0('0x8'));var utils=require(_0x31c0('0x9'));var client=jayson['client'][_0x31c0('0xa')]({'port':0x232b});function localAuthenticate(_0x52061d,_0xe7223c,_0x27abed,_0x5a93fb){var _0x5e9dd4,_0x502218;return db[_0x31c0('0xb')][_0x31c0('0xc')]({'where':{'id':0x1},'attributes':[_0x31c0('0xd'),'blockDuration'],'raw':!![]})[_0x31c0('0xe')](function(_0x43a273){_0x5e9dd4=_0x43a273;return _0x52061d['findOne']({'attributes':['id',_0x31c0('0xf'),_0x31c0('0x10'),_0x31c0('0x11'),_0x31c0('0x12'),_0x31c0('0x13'),_0x31c0('0x14'),_0x31c0('0x15'),_0x31c0('0x16')],'where':{'name':_0xe7223c,'role':{'$or':[_0x31c0('0x17'),_0x31c0('0x18'),'agent']}}});})[_0x31c0('0xe')](function(_0x471c0c){if(!_0x471c0c||_0x471c0c&&_0x471c0c[_0x31c0('0xf')]!==_0xe7223c){throw new Error(_0x31c0('0x19'));}else{_0x502218=_0x471c0c;return _0x502218;}})[_0x31c0('0xe')](function(){_0x502218[_0x31c0('0x1a')](_0x27abed,function(_0x5693d6,_0xe60635){var _0x57ea30=_0x502218[_0x31c0('0x16')]+0x1;if(_0x5693d6){return _0x5a93fb(_0x5693d6);}else if(!_0xe60635){if(_0x502218['disabled']){return _0x5a93fb(null,![],{'message':_0x31c0('0x19')});}else if(_0x5e9dd4['allowedLoginAttempts']>0x0){if(_0x502218['blocked']){if(_0x5e9dd4[_0x31c0('0x1b')]>0x0){if(moment(_0x502218[_0x31c0('0x15')])[_0x31c0('0x1c')](_0x5e9dd4[_0x31c0('0x1b')],_0x31c0('0x1d'))>moment()){return _0x5a93fb(null,![],{'message':_0x31c0('0x19')});}else{return utils['clearBlockUser'](_0x502218,_0x57ea30,![],null)[_0x31c0('0xe')](function(){return _0x5a93fb(null,![],{'message':_0x31c0('0x19')});});}}else{return _0x5a93fb(null,![],{'message':_0x31c0('0x19')});}}else{if(_0x57ea30>=_0x5e9dd4[_0x31c0('0xd')]){return utils[_0x31c0('0x1e')](_0x502218,0x0,!![],moment())['then'](function(){return _0x5a93fb(null,![],{'message':_0x31c0('0x19')});});}else{return utils[_0x31c0('0x1e')](_0x502218,_0x57ea30,![],null)[_0x31c0('0xe')](function(){return _0x5a93fb(null,![],{'message':_0x31c0('0x19')});});}}}else{return _0x5a93fb(null,![],{'message':_0x31c0('0x19')});}}else{if(_0x502218['disabled']){return _0x5a93fb(null,![],{'message':_0x31c0('0x19')});}else if(_0x5e9dd4[_0x31c0('0xd')]>0x0){if(_0x502218[_0x31c0('0x14')]){if(_0x5e9dd4[_0x31c0('0x1b')]>0x0){if(moment(_0x502218[_0x31c0('0x15')])['add'](_0x5e9dd4[_0x31c0('0x1b')],_0x31c0('0x1d'))>moment()){return _0x5a93fb(null,![],{'message':_0x31c0('0x19')});}else{return utils[_0x31c0('0x1e')](_0x502218,0x0,![],null)['then'](function(){return utils['getLicense'](_0x502218);})['then'](function(){return _0x5a93fb(null,_0x502218);});}}else{return _0x5a93fb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x31c0('0x1e')](_0x502218,0x0,![],null)[_0x31c0('0xe')](function(){return utils[_0x31c0('0x1f')](_0x502218);})[_0x31c0('0xe')](function(){return _0x5a93fb(null,_0x502218);})[_0x31c0('0x20')](function(_0x432361){return _0x5a93fb(null,![],_0x432361);});}}else{if(_0x502218[_0x31c0('0x14')]){return _0x5a93fb(null,![],{'message':_0x31c0('0x19')});}else{return utils[_0x31c0('0x1f')](_0x502218)[_0x31c0('0xe')](function(){return _0x5a93fb(null,_0x502218);});}}}});})['catch'](function(_0x5e50cd){return _0x5a93fb(null,![],_0x5e50cd);});}function sendServiceMail(_0x659378){return db[_0x31c0('0x21')]['find']({'where':{'service':!![]},'attributes':['id','name',_0x31c0('0x22')],'include':[{'model':db[_0x31c0('0x23')],'as':'Smtp','include':[{'model':db[_0x31c0('0x24')],'as':_0x31c0('0x24')}]}]})[_0x31c0('0xe')](function(_0x3363f8){if(!_0x3363f8){throw new Error(_0x31c0('0x25'));}var _0x3bafe7=_0x3363f8['getSmtpOptions']();var _0x2684e1={'account':_0x3bafe7,'message':_[_0x31c0('0x26')]({'from':util[_0x31c0('0x27')](_0x31c0('0x28'),_0x3363f8[_0x31c0('0xf')],_0x3363f8['email']||_0x3363f8[_0x31c0('0x29')][_0x31c0('0x18')])},_0x659378)};return client[_0x31c0('0x2a')](_0x31c0('0x2b'),_0x2684e1);})[_0x31c0('0xe')](function(_0xb3d7e9){if(_0xb3d7e9[_0x31c0('0x2c')]){throw new Error(util[_0x31c0('0x27')](_0x31c0('0x2d'),_0xb3d7e9['error'][_0x31c0('0x2e')]||JSON[_0x31c0('0x2f')](_0xb3d7e9[_0x31c0('0x2c')])));}return!![];});}function handleError(_0x4581b7,_0xabb9b3,_0x58db4b){return _0x4581b7[_0x31c0('0x30')](_0xabb9b3||0x1f4)[_0x31c0('0x31')]({'message':_0x58db4b?_0x58db4b[_0x31c0('0x2e')]||_0x58db4b:''});}exports[_0x31c0('0x32')]=function(_0x505a12,_0x20e4cc,_0x59513e){passport[_0x31c0('0x1a')](_0x31c0('0x33'),function(_0x49ec60,_0x45e981,_0x17df1d){var _0x396418=_0x49ec60||_0x17df1d;if(_0x396418){return handleError(_0x20e4cc,0x191,_0x396418);}if(!_0x45e981){return handleError(_0x20e4cc,0x194,{'message':_0x31c0('0x34')});}else{var _0x1199f8={'payload':{'id':_0x45e981['id'],'role':_0x45e981[_0x31c0('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x31c0('0x35')](_0x1199f8)[_0x31c0('0xe')](function(_0x5b9eaa){_0x20e4cc[_0x31c0('0x36')]({'id':_0x45e981['id'],'token':_0x5b9eaa,'statusCall':'','isAlreadyLogged':_0x45e981[_0x31c0('0x37')]});});}})(_0x505a12,_0x20e4cc,_0x59513e);};exports[_0x31c0('0x38')]=function(_0x4a7317,_0x336b42){if(!_0x4a7317['body']['email']){return handleError(_0x336b42,0x1f4,{'message':_0x31c0('0x39')});}var _0x57a41b=rs[_0x31c0('0x3a')]();_0x4a7317[_0x31c0('0x3b')][_0x31c0('0x22')]=_0x4a7317['body'][_0x31c0('0x22')][_0x31c0('0x3c')]()[_0x31c0('0x3d')]();var _0xcedd85;return db[_0x31c0('0xb')][_0x31c0('0xc')]({'where':{'id':0x1},'attributes':[_0x31c0('0xd'),'blockDuration'],'raw':!![]})['then'](function(_0x1a2cb4){_0xcedd85=_0x1a2cb4;return db[_0x31c0('0x3e')][_0x31c0('0x3f')]({'where':{'email':_0x4a7317[_0x31c0('0x3b')][_0x31c0('0x22')]}});})['then'](function(_0xd39f1a){if(!_0xd39f1a){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xd39f1a[_0x31c0('0x13')]){throw new Error(_0x31c0('0x40'));}if(_0xd39f1a[_0x31c0('0x14')]){if(moment(_0xd39f1a[_0x31c0('0x15')])['add'](_0xcedd85['blockDuration'],_0x31c0('0x1d'))>moment()){throw new Error(_0x31c0('0x41'));}else{_0xd39f1a[_0x31c0('0x14')]=![];_0xd39f1a[_0x31c0('0x15')]=null;}}_0xd39f1a[_0x31c0('0x42')]=_0x57a41b;_0xd39f1a['resetPasswordExpires']=Date[_0x31c0('0x43')]()+0x36ee80;return _0xd39f1a[_0x31c0('0x44')]();})[_0x31c0('0xe')](function(){return sendServiceMail({'to':_0x4a7317[_0x31c0('0x3b')][_0x31c0('0x22')],'subject':_0x31c0('0x45'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x31c0('0x46')+_0x31c0('0x47')+_0x4a7317[_0x31c0('0x48')][_0x31c0('0x49')]+_0x31c0('0x4a')+_0x57a41b+'\x0a\x0a'+_0x31c0('0x4b')});})['then'](function(){_0x336b42[_0x31c0('0x30')](0xc8)[_0x31c0('0x31')]({'message':_0x31c0('0x4c')});})[_0x31c0('0x20')](function(_0x4251b0){return handleError(_0x336b42,0x1f4,_0x4251b0);});};exports['reset']=function(_0x3491d8,_0x34c743){return db[_0x31c0('0x3e')][_0x31c0('0x3f')]({'where':{'resetPasswordToken':_0x3491d8['params'][_0x31c0('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x31c0('0x43')]()}}})[_0x31c0('0xe')](function(_0x252e4a){if(!_0x252e4a){throw new Error(_0x31c0('0x4e'));}return db[_0x31c0('0xb')][_0x31c0('0xc')]({'attributes':['id',_0x31c0('0x4f'),'enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0xf863c9){if(_0xf863c9[_0x31c0('0x4f')])authService['validatePasswordPattern'](_0x3491d8[_0x31c0('0x3b')]['password']);if(!_0xf863c9['enforcePasswordHistory']||!_0x252e4a[_0x31c0('0x50')])return _0x252e4a;authService[_0x31c0('0x51')](_0x3491d8['body'][_0x31c0('0x10')],_0x252e4a[_0x31c0('0x50')],_0xf863c9[_0x31c0('0x52')]);return _0x252e4a;})[_0x31c0('0xe')](function(){_0x252e4a[_0x31c0('0x10')]=_0x3491d8[_0x31c0('0x3b')]['password'];_0x252e4a[_0x31c0('0x42')]=null;_0x252e4a['resetPasswordExpires']=null;return _0x252e4a['save']();});})[_0x31c0('0xe')](function(){_0x34c743[_0x31c0('0x30')](0xc8)[_0x31c0('0x31')]({'message':_0x31c0('0x53')});})[_0x31c0('0x20')](function(_0x1b2511){return handleError(_0x34c743,0x1f4,_0x1b2511);});};passport[_0x31c0('0x54')](_0x31c0('0x33'),new LocalStrategy({'usernameField':_0x31c0('0xf'),'passwordField':_0x31c0('0x10')},function(_0x50ed13,_0x420555,_0x42c7cd){return localAuthenticate(db[_0x31c0('0x3e')],_0x50ed13,_0x420555,_0x42c7cd);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index cd7522e..ba6c69f 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 _0xf2a2=['reset','exports','Router','./authLocal.controller','login','post','/forgot'];(function(_0x25eb1c,_0x479599){var _0x2a3b73=function(_0x3c61a6){while(--_0x3c61a6){_0x25eb1c['push'](_0x25eb1c['shift']());}};_0x2a3b73(++_0x479599);}(_0xf2a2,0x183));var _0x2f2a=function(_0x5e3415,_0x14a028){_0x5e3415=_0x5e3415-0x0;var _0x39a0b4=_0xf2a2[_0x5e3415];return _0x39a0b4;};'use strict';var express=require('express');var router=express[_0x2f2a('0x0')]();var controller=require(_0x2f2a('0x1'));router['post']('/',controller[_0x2f2a('0x2')]);router[_0x2f2a('0x3')](_0x2f2a('0x4'),controller['forgot']);router[_0x2f2a('0x3')]('/reset/:token',controller[_0x2f2a('0x5')]);module[_0x2f2a('0x6')]=router; \ No newline at end of file +var _0x8cc7=['/forgot','forgot','reset','exports','Router','./authLocal.controller','post','login'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8cc7,0x104));var _0x78cc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x8cc7[_0xbca1b1];return _0x4e1686;};'use strict';var express=require('express');var router=express[_0x78cc('0x0')]();var controller=require(_0x78cc('0x1'));router[_0x78cc('0x2')]('/',controller[_0x78cc('0x3')]);router[_0x78cc('0x2')](_0x78cc('0x4'),controller[_0x78cc('0x5')]);router['post']('/reset/:token',controller[_0x78cc('0x6')]);module[_0x78cc('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 9627ff4..50b6b2f 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 _0x94b3=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x572c32,_0x13ef5e){var _0x4ad5d9=function(_0xa4768a){while(--_0xa4768a){_0x572c32['push'](_0x572c32['shift']());}};_0x4ad5d9(++_0x13ef5e);}(_0x94b3,0x107));var _0x394b=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x94b3[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0x394b('0x0'));module['exports']={'name':{'type':Sequelize[_0x394b('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x394b('0x1')]},'status':{'type':Sequelize[_0x394b('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x394b('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xc0a9=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x3fe7ff,_0x3b3b48){var _0x12600d=function(_0x1e4485){while(--_0x1e4485){_0x3fe7ff['push'](_0x3fe7ff['shift']());}};_0x12600d(++_0x3b3b48);}(_0xc0a9,0x1c3));var _0x9c0a=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xc0a9[_0x1a7846];return _0x48049;};'use strict';var Sequelize=require(_0x9c0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c0a('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x9c0a('0x1')]},'description':{'type':Sequelize[_0x9c0a('0x1')]},'status':{'type':Sequelize[_0x9c0a('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9c0a('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 09963ec..23b4bf9 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 _0xc370=['findOne','Action','getActions','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','send','index','map','Automation','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','addConditions','Condition','ids','omit','getConditions','pick','addActions'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0xc370,0x144));var _0x0c37=function(_0x37aa08,_0xb5e492){_0x37aa08=_0x37aa08-0x0;var _0x9f44dc=_0xc370[_0x37aa08];return _0x9f44dc;};'use strict';var emlformat=require(_0x0c37('0x0'));var rimraf=require(_0x0c37('0x1'));var zipdir=require(_0x0c37('0x2'));var jsonpatch=require(_0x0c37('0x3'));var rp=require('request-promise');var moment=require(_0x0c37('0x4'));var BPromise=require(_0x0c37('0x5'));var Mustache=require(_0x0c37('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0c37('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c37('0x8'));var squel=require(_0x0c37('0x9'));var crypto=require(_0x0c37('0xa'));var jsforce=require(_0x0c37('0xb'));var deskjs=require(_0x0c37('0xc'));var toCsv=require(_0x0c37('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0c37('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0c37('0xf'));var hardwareService=require(_0x0c37('0x10'));var logger=require(_0x0c37('0x11'))(_0x0c37('0x12'));var utils=require(_0x0c37('0x13'));var config=require(_0x0c37('0x14'));var licenseUtil=require(_0x0c37('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18c00e,_0x4cc52a){_0x4cc52a=_0x4cc52a||0xcc;return function(_0x16d770){if(_0x16d770){return _0x18c00e[_0x0c37('0x16')](_0x4cc52a);}return _0x18c00e[_0x0c37('0x17')](_0x4cc52a)[_0x0c37('0x18')]();};}function respondWithResult(_0x490199,_0x75e9a3){_0x75e9a3=_0x75e9a3||0xc8;return function(_0xb18414){if(_0xb18414){return _0x490199[_0x0c37('0x17')](_0x75e9a3)['json'](_0xb18414);}};}function respondWithFilteredResult(_0x397937,_0x48625d){return function(_0x701da8){if(_0x701da8){var _0x3c8ff4=typeof _0x48625d['offset']===_0x0c37('0x19')&&typeof _0x48625d[_0x0c37('0x1a')]===_0x0c37('0x19');var _0x14b395=_0x701da8[_0x0c37('0x1b')];var _0x2f9153=_0x3c8ff4?0x0:_0x48625d[_0x0c37('0x1c')];var _0x54df83=_0x3c8ff4?_0x701da8[_0x0c37('0x1b')]:_0x48625d[_0x0c37('0x1c')]+_0x48625d[_0x0c37('0x1a')];var _0x53216d;if(_0x54df83>=_0x14b395){_0x54df83=_0x14b395;_0x53216d=0xc8;}else{_0x53216d=0xce;}_0x397937[_0x0c37('0x17')](_0x53216d);return _0x397937[_0x0c37('0x1d')](_0x0c37('0x1e'),_0x2f9153+'-'+_0x54df83+'/'+_0x14b395)['json'](_0x701da8);}return null;};}function patchUpdates(_0x414bff){return function(_0x67b2b1){try{jsonpatch['apply'](_0x67b2b1,_0x414bff,!![]);}catch(_0x28cc89){return BPromise[_0x0c37('0x1f')](_0x28cc89);}return _0x67b2b1[_0x0c37('0x20')]();};}function saveUpdates(_0x331465,_0x2c634c){return function(_0x59005b){if(_0x59005b){return _0x59005b[_0x0c37('0x21')](_0x331465)[_0x0c37('0x22')](function(_0x32f610){return _0x32f610;});}return null;};}function removeEntity(_0x2f1703,_0x3be96d){return function(_0x21b143){if(_0x21b143){return _0x21b143[_0x0c37('0x23')]()[_0x0c37('0x22')](function(){_0x2f1703[_0x0c37('0x17')](0xcc)[_0x0c37('0x18')]();});}};}function handleEntityNotFound(_0x43ad23,_0x2f1e32){return function(_0x5e4012){if(!_0x5e4012){_0x43ad23[_0x0c37('0x16')](0x194);}return _0x5e4012;};}function handleError(_0x17fffe,_0x4b497d){_0x4b497d=_0x4b497d||0x1f4;return function(_0x385607){logger['error'](_0x385607[_0x0c37('0x24')]);if(_0x385607['name']){delete _0x385607['name'];}_0x17fffe[_0x0c37('0x17')](_0x4b497d)[_0x0c37('0x25')](_0x385607);};}exports[_0x0c37('0x26')]=function(_0x459c1e,_0x45be12){var _0x14c9e2={},_0x18af06={},_0x2ad0c3={'count':0x0,'rows':[]};var _0x25fa3a=_[_0x0c37('0x27')](db[_0x0c37('0x28')]['rawAttributes'],function(_0x5c4c63){return{'name':_0x5c4c63['fieldName'],'type':_0x5c4c63['type']['key']};});_0x18af06[_0x0c37('0x29')]=_['map'](_0x25fa3a,_0x0c37('0x2a'));_0x18af06[_0x0c37('0x2b')]=_[_0x0c37('0x2c')](_0x459c1e['query']);_0x18af06[_0x0c37('0x2d')]=_[_0x0c37('0x2e')](_0x18af06['model'],_0x18af06[_0x0c37('0x2b')]);_0x14c9e2[_0x0c37('0x2f')]=_['intersection'](_0x18af06[_0x0c37('0x29')],qs[_0x0c37('0x30')](_0x459c1e[_0x0c37('0x2b')][_0x0c37('0x30')]));_0x14c9e2['attributes']=_0x14c9e2[_0x0c37('0x2f')][_0x0c37('0x31')]?_0x14c9e2[_0x0c37('0x2f')]:_0x18af06[_0x0c37('0x29')];if(!_0x459c1e[_0x0c37('0x2b')][_0x0c37('0x32')]('nolimit')){_0x14c9e2[_0x0c37('0x1a')]=qs[_0x0c37('0x1a')](_0x459c1e[_0x0c37('0x2b')][_0x0c37('0x1a')]);_0x14c9e2['offset']=qs[_0x0c37('0x1c')](_0x459c1e['query'][_0x0c37('0x1c')]);}_0x14c9e2['order']=qs[_0x0c37('0x33')](_0x459c1e[_0x0c37('0x2b')]['sort']);_0x14c9e2[_0x0c37('0x34')]=qs[_0x0c37('0x2d')](_['pick'](_0x459c1e[_0x0c37('0x2b')],_0x18af06[_0x0c37('0x2d')]),_0x25fa3a);if(_0x459c1e['query'][_0x0c37('0x35')]){_0x14c9e2[_0x0c37('0x34')]=_[_0x0c37('0x36')](_0x14c9e2[_0x0c37('0x34')],{'$or':_['map'](_0x25fa3a,function(_0x30f520){if(_0x30f520[_0x0c37('0x37')]!==_0x0c37('0x38')){var _0x324db9={};_0x324db9[_0x30f520['name']]={'$like':'%'+_0x459c1e[_0x0c37('0x2b')][_0x0c37('0x35')]+'%'};return _0x324db9;}})});}_0x14c9e2=_[_0x0c37('0x36')]({},_0x14c9e2,_0x459c1e[_0x0c37('0x39')]);var _0x9d941d={'where':_0x14c9e2[_0x0c37('0x34')]};return db['Automation'][_0x0c37('0x1b')](_0x9d941d)[_0x0c37('0x22')](function(_0x2a96d6){_0x2ad0c3[_0x0c37('0x1b')]=_0x2a96d6;if(_0x459c1e[_0x0c37('0x2b')][_0x0c37('0x3a')]){_0x14c9e2[_0x0c37('0x3b')]=[{'all':!![]}];}return db['Automation'][_0x0c37('0x3c')](_0x14c9e2);})[_0x0c37('0x22')](function(_0x47658d){_0x2ad0c3[_0x0c37('0x3d')]=_0x47658d;return _0x2ad0c3;})[_0x0c37('0x22')](respondWithFilteredResult(_0x45be12,_0x14c9e2))[_0x0c37('0x3e')](handleError(_0x45be12,null));};exports[_0x0c37('0x3f')]=function(_0x2803ab,_0x36e390){var _0x380324={'raw':![],'where':{'id':_0x2803ab[_0x0c37('0x40')]['id']}},_0x150f45={};_0x150f45[_0x0c37('0x29')]=_[_0x0c37('0x2c')](db[_0x0c37('0x28')][_0x0c37('0x41')]);_0x150f45[_0x0c37('0x2b')]=_[_0x0c37('0x2c')](_0x2803ab[_0x0c37('0x2b')]);_0x150f45[_0x0c37('0x2d')]=_[_0x0c37('0x2e')](_0x150f45[_0x0c37('0x29')],_0x150f45[_0x0c37('0x2b')]);_0x380324[_0x0c37('0x2f')]=_['intersection'](_0x150f45[_0x0c37('0x29')],qs[_0x0c37('0x30')](_0x2803ab[_0x0c37('0x2b')][_0x0c37('0x30')]));_0x380324['attributes']=_0x380324[_0x0c37('0x2f')]['length']?_0x380324[_0x0c37('0x2f')]:_0x150f45[_0x0c37('0x29')];if(_0x2803ab[_0x0c37('0x2b')][_0x0c37('0x3a')]){_0x380324[_0x0c37('0x3b')]=[{'all':!![]}];}_0x380324=_['merge']({},_0x380324,_0x2803ab['options']);return db[_0x0c37('0x28')][_0x0c37('0x42')](_0x380324)[_0x0c37('0x22')](handleEntityNotFound(_0x36e390,null))[_0x0c37('0x22')](respondWithResult(_0x36e390,null))[_0x0c37('0x3e')](handleError(_0x36e390,null));};exports[_0x0c37('0x43')]=function(_0x1a6d9f,_0x2cd361){return db[_0x0c37('0x28')][_0x0c37('0x43')](_0x1a6d9f['body'],{})['then'](respondWithResult(_0x2cd361,0xc9))[_0x0c37('0x3e')](handleError(_0x2cd361,null));};exports[_0x0c37('0x21')]=function(_0x1f07d4,_0x46bbcd){if(_0x1f07d4[_0x0c37('0x44')]['id']){delete _0x1f07d4[_0x0c37('0x44')]['id'];}return db['Automation'][_0x0c37('0x42')]({'where':{'id':_0x1f07d4[_0x0c37('0x40')]['id']}})['then'](handleEntityNotFound(_0x46bbcd,null))[_0x0c37('0x22')](saveUpdates(_0x1f07d4[_0x0c37('0x44')],null))['then'](respondWithResult(_0x46bbcd,null))[_0x0c37('0x3e')](handleError(_0x46bbcd,null));};exports['destroy']=function(_0x2ae5c1,_0x5674d9){return db[_0x0c37('0x28')][_0x0c37('0x42')]({'where':{'id':_0x2ae5c1[_0x0c37('0x40')]['id']}})[_0x0c37('0x22')](handleEntityNotFound(_0x5674d9,null))[_0x0c37('0x22')](removeEntity(_0x5674d9,null))[_0x0c37('0x3e')](handleError(_0x5674d9,null));};exports[_0x0c37('0x45')]=function(_0x44a263,_0x94598b,_0xb37b2a){return db[_0x0c37('0x46')][_0x0c37('0x42')]({'where':{'id':_0x44a263[_0x0c37('0x40')]['id']}})[_0x0c37('0x22')](handleEntityNotFound(_0x94598b,null))['then'](function(_0x32d7f0){if(_0x32d7f0){return _0x32d7f0[_0x0c37('0x45')](_0x44a263[_0x0c37('0x44')][_0x0c37('0x47')],_[_0x0c37('0x48')](_0x44a263[_0x0c37('0x44')],[_0x0c37('0x47'),'id'])||{});}})[_0x0c37('0x22')](respondWithResult(_0x94598b,null))[_0x0c37('0x3e')](handleError(_0x94598b,null));};exports[_0x0c37('0x49')]=function(_0x5cdbf3,_0x2c8c86,_0x555b6e){var _0x41190c={};var _0x3e1ecb={};var _0x2eb984;var _0x3ca4b7;return db['Automation']['findOne']({'where':{'id':_0x5cdbf3[_0x0c37('0x40')]['id']}})['then'](handleEntityNotFound(_0x2c8c86,null))['then'](function(_0x586948){if(_0x586948){_0x2eb984=_0x586948;_0x3e1ecb[_0x0c37('0x29')]=_[_0x0c37('0x2c')](db['Condition']['rawAttributes']);_0x3e1ecb[_0x0c37('0x2b')]=_[_0x0c37('0x2c')](_0x5cdbf3[_0x0c37('0x2b')]);_0x3e1ecb[_0x0c37('0x2d')]=_[_0x0c37('0x2e')](_0x3e1ecb[_0x0c37('0x29')],_0x3e1ecb[_0x0c37('0x2b')]);_0x41190c['attributes']=_['intersection'](_0x3e1ecb['model'],qs[_0x0c37('0x30')](_0x5cdbf3['query'][_0x0c37('0x30')]));_0x41190c[_0x0c37('0x2f')]=_0x41190c[_0x0c37('0x2f')][_0x0c37('0x31')]?_0x41190c[_0x0c37('0x2f')]:_0x3e1ecb[_0x0c37('0x29')];_0x41190c['order']=qs[_0x0c37('0x33')](_0x5cdbf3[_0x0c37('0x2b')][_0x0c37('0x33')]);_0x41190c[_0x0c37('0x34')]=qs['filters'](_[_0x0c37('0x4a')](_0x5cdbf3[_0x0c37('0x2b')],_0x3e1ecb[_0x0c37('0x2d')]));if(_0x5cdbf3[_0x0c37('0x2b')][_0x0c37('0x35')]){_0x41190c[_0x0c37('0x34')]=_['merge'](_0x41190c['where'],{'$or':_['map'](_0x41190c['attributes'],function(_0x13dd92){var _0x4474f4={};_0x4474f4[_0x13dd92]={'$like':'%'+_0x5cdbf3[_0x0c37('0x2b')][_0x0c37('0x35')]+'%'};return _0x4474f4;})});}_0x41190c=_[_0x0c37('0x36')]({},_0x41190c,_0x5cdbf3['options']);return _0x2eb984[_0x0c37('0x49')](_0x41190c);}})[_0x0c37('0x22')](function(_0x492a19){if(_0x492a19){_0x3ca4b7=_0x492a19['length'];if(!_0x5cdbf3[_0x0c37('0x2b')][_0x0c37('0x32')]('nolimit')){_0x41190c[_0x0c37('0x1a')]=qs['limit'](_0x5cdbf3['query'][_0x0c37('0x1a')]);_0x41190c[_0x0c37('0x1c')]=qs['offset'](_0x5cdbf3[_0x0c37('0x2b')][_0x0c37('0x1c')]);}return _0x2eb984[_0x0c37('0x49')](_0x41190c);}})[_0x0c37('0x22')](function(_0x14c99e){if(_0x14c99e){return _0x14c99e?{'count':_0x3ca4b7,'rows':_0x14c99e}:null;}})[_0x0c37('0x22')](respondWithResult(_0x2c8c86,null))[_0x0c37('0x3e')](handleError(_0x2c8c86,null));};exports[_0x0c37('0x4b')]=function(_0x2c7cae,_0x14dab1,_0x51622d){return db['Action']['find']({'where':{'id':_0x2c7cae['params']['id']}})[_0x0c37('0x22')](handleEntityNotFound(_0x14dab1,null))[_0x0c37('0x22')](function(_0x59bd7e){if(_0x59bd7e){return _0x59bd7e[_0x0c37('0x4b')](_0x2c7cae[_0x0c37('0x44')]['ids'],_[_0x0c37('0x48')](_0x2c7cae[_0x0c37('0x44')],[_0x0c37('0x47'),'id'])||{});}})['then'](respondWithResult(_0x14dab1,null))[_0x0c37('0x3e')](handleError(_0x14dab1,null));};exports['getActions']=function(_0x53cf65,_0x40fb98,_0x5e8309){var _0x5b8ced={};var _0x47853b={};var _0x397f0a;var _0x28d34b;return db['Automation'][_0x0c37('0x4c')]({'where':{'id':_0x53cf65[_0x0c37('0x40')]['id']}})[_0x0c37('0x22')](handleEntityNotFound(_0x40fb98,null))['then'](function(_0x12e060){if(_0x12e060){_0x397f0a=_0x12e060;_0x47853b[_0x0c37('0x29')]=_['keys'](db[_0x0c37('0x4d')][_0x0c37('0x41')]);_0x47853b['query']=_[_0x0c37('0x2c')](_0x53cf65[_0x0c37('0x2b')]);_0x47853b[_0x0c37('0x2d')]=_[_0x0c37('0x2e')](_0x47853b[_0x0c37('0x29')],_0x47853b[_0x0c37('0x2b')]);_0x5b8ced[_0x0c37('0x2f')]=_[_0x0c37('0x2e')](_0x47853b[_0x0c37('0x29')],qs['fields'](_0x53cf65['query']['fields']));_0x5b8ced[_0x0c37('0x2f')]=_0x5b8ced[_0x0c37('0x2f')][_0x0c37('0x31')]?_0x5b8ced['attributes']:_0x47853b[_0x0c37('0x29')];_0x5b8ced['order']=qs[_0x0c37('0x33')](_0x53cf65[_0x0c37('0x2b')][_0x0c37('0x33')]);_0x5b8ced[_0x0c37('0x34')]=qs[_0x0c37('0x2d')](_[_0x0c37('0x4a')](_0x53cf65[_0x0c37('0x2b')],_0x47853b[_0x0c37('0x2d')]));if(_0x53cf65[_0x0c37('0x2b')][_0x0c37('0x35')]){_0x5b8ced[_0x0c37('0x34')]=_[_0x0c37('0x36')](_0x5b8ced[_0x0c37('0x34')],{'$or':_[_0x0c37('0x27')](_0x5b8ced[_0x0c37('0x2f')],function(_0x316a6d){var _0x24614a={};_0x24614a[_0x316a6d]={'$like':'%'+_0x53cf65[_0x0c37('0x2b')]['filter']+'%'};return _0x24614a;})});}_0x5b8ced=_[_0x0c37('0x36')]({},_0x5b8ced,_0x53cf65[_0x0c37('0x39')]);return _0x397f0a[_0x0c37('0x4e')](_0x5b8ced);}})['then'](function(_0x39bda8){if(_0x39bda8){_0x28d34b=_0x39bda8[_0x0c37('0x31')];if(!_0x53cf65[_0x0c37('0x2b')][_0x0c37('0x32')](_0x0c37('0x4f'))){_0x5b8ced[_0x0c37('0x1a')]=qs[_0x0c37('0x1a')](_0x53cf65['query'][_0x0c37('0x1a')]);_0x5b8ced[_0x0c37('0x1c')]=qs[_0x0c37('0x1c')](_0x53cf65['query'][_0x0c37('0x1c')]);}return _0x397f0a['getActions'](_0x5b8ced);}})[_0x0c37('0x22')](function(_0x41e1ea){if(_0x41e1ea){return _0x41e1ea?{'count':_0x28d34b,'rows':_0x41e1ea}:null;}})[_0x0c37('0x22')](respondWithResult(_0x40fb98,null))[_0x0c37('0x3e')](handleError(_0x40fb98,null));}; \ No newline at end of file +var _0xe88a=['papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','stack','name','send','index','Automation','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','map','VIRTUAL','filter','options','includeAll','include','rows','rawAttributes','find','catch','create','body','params','addConditions','Condition','ids','omit','getConditions','findOne','nolimit','Action','addActions','getActions','eml-format','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv'];(function(_0x552c10,_0x5ce987){var _0x3242d2=function(_0x49b922){while(--_0x49b922){_0x552c10['push'](_0x552c10['shift']());}};_0x3242d2(++_0x5ce987);}(_0xe88a,0x128));var _0xae88=function(_0x4a01e9,_0x595c4d){_0x4a01e9=_0x4a01e9-0x0;var _0x362b9c=_0xe88a[_0x4a01e9];return _0x362b9c;};'use strict';var emlformat=require(_0xae88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae88('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae88('0x2'));var moment=require(_0xae88('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xae88('0x4'));var util=require('util');var path=require(_0xae88('0x5'));var sox=require(_0xae88('0x6'));var csv=require('to-csv');var ejs=require(_0xae88('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae88('0x8'));var squel=require(_0xae88('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xae88('0xa'));var toCsv=require(_0xae88('0xb'));var querystring=require('querystring');var Papa=require(_0xae88('0xc'));var Redis=require(_0xae88('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae88('0xe'));var logger=require('../../config/logger')(_0xae88('0xf'));var utils=require(_0xae88('0x10'));var config=require(_0xae88('0x11'));var licenseUtil=require(_0xae88('0x12'));var db=require(_0xae88('0x13'))['db'];function respondWithStatusCode(_0x388a58,_0x3cf8a3){_0x3cf8a3=_0x3cf8a3||0xcc;return function(_0xfdd6d3){if(_0xfdd6d3){return _0x388a58[_0xae88('0x14')](_0x3cf8a3);}return _0x388a58[_0xae88('0x15')](_0x3cf8a3)[_0xae88('0x16')]();};}function respondWithResult(_0x4220f8,_0x4cca50){_0x4cca50=_0x4cca50||0xc8;return function(_0x131140){if(_0x131140){return _0x4220f8[_0xae88('0x15')](_0x4cca50)[_0xae88('0x17')](_0x131140);}};}function respondWithFilteredResult(_0x57f7c4,_0x3a6165){return function(_0x438fd8){if(_0x438fd8){var _0x5f4054=typeof _0x3a6165[_0xae88('0x18')]==='undefined'&&typeof _0x3a6165[_0xae88('0x19')]===_0xae88('0x1a');var _0x40e154=_0x438fd8[_0xae88('0x1b')];var _0x94aae4=_0x5f4054?0x0:_0x3a6165[_0xae88('0x18')];var _0x59e535=_0x5f4054?_0x438fd8[_0xae88('0x1b')]:_0x3a6165[_0xae88('0x18')]+_0x3a6165[_0xae88('0x19')];var _0x10d149;if(_0x59e535>=_0x40e154){_0x59e535=_0x40e154;_0x10d149=0xc8;}else{_0x10d149=0xce;}_0x57f7c4[_0xae88('0x15')](_0x10d149);return _0x57f7c4[_0xae88('0x1c')](_0xae88('0x1d'),_0x94aae4+'-'+_0x59e535+'/'+_0x40e154)[_0xae88('0x17')](_0x438fd8);}return null;};}function patchUpdates(_0x2775f0){return function(_0x30b440){try{jsonpatch['apply'](_0x30b440,_0x2775f0,!![]);}catch(_0xc7f9c4){return BPromise['reject'](_0xc7f9c4);}return _0x30b440['save']();};}function saveUpdates(_0x13df66,_0xc9217f){return function(_0x5682b4){if(_0x5682b4){return _0x5682b4[_0xae88('0x1e')](_0x13df66)['then'](function(_0x22e6af){return _0x22e6af;});}return null;};}function removeEntity(_0x24f97f,_0x2d78ac){return function(_0x457f25){if(_0x457f25){return _0x457f25[_0xae88('0x1f')]()[_0xae88('0x20')](function(){_0x24f97f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be1e8,_0x11aecb){return function(_0x539dd8){if(!_0x539dd8){_0x3be1e8[_0xae88('0x14')](0x194);}return _0x539dd8;};}function handleError(_0x10b5f4,_0x4e6cd0){_0x4e6cd0=_0x4e6cd0||0x1f4;return function(_0x3f82c){logger['error'](_0x3f82c[_0xae88('0x21')]);if(_0x3f82c[_0xae88('0x22')]){delete _0x3f82c[_0xae88('0x22')];}_0x10b5f4[_0xae88('0x15')](_0x4e6cd0)[_0xae88('0x23')](_0x3f82c);};}exports[_0xae88('0x24')]=function(_0x16636f,_0x9d0416){var _0x1aea5b={},_0x531644={},_0xc95593={'count':0x0,'rows':[]};var _0x4dadcb=_['map'](db[_0xae88('0x25')]['rawAttributes'],function(_0x4d21b9){return{'name':_0x4d21b9[_0xae88('0x26')],'type':_0x4d21b9[_0xae88('0x27')]['key']};});_0x531644['model']=_['map'](_0x4dadcb,'name');_0x531644[_0xae88('0x28')]=_[_0xae88('0x29')](_0x16636f[_0xae88('0x28')]);_0x531644['filters']=_['intersection'](_0x531644[_0xae88('0x2a')],_0x531644['query']);_0x1aea5b[_0xae88('0x2b')]=_[_0xae88('0x2c')](_0x531644[_0xae88('0x2a')],qs[_0xae88('0x2d')](_0x16636f[_0xae88('0x28')][_0xae88('0x2d')]));_0x1aea5b['attributes']=_0x1aea5b[_0xae88('0x2b')][_0xae88('0x2e')]?_0x1aea5b[_0xae88('0x2b')]:_0x531644[_0xae88('0x2a')];if(!_0x16636f[_0xae88('0x28')][_0xae88('0x2f')]('nolimit')){_0x1aea5b['limit']=qs[_0xae88('0x19')](_0x16636f[_0xae88('0x28')][_0xae88('0x19')]);_0x1aea5b[_0xae88('0x18')]=qs[_0xae88('0x18')](_0x16636f[_0xae88('0x28')][_0xae88('0x18')]);}_0x1aea5b[_0xae88('0x30')]=qs['sort'](_0x16636f[_0xae88('0x28')][_0xae88('0x31')]);_0x1aea5b[_0xae88('0x32')]=qs['filters'](_[_0xae88('0x33')](_0x16636f[_0xae88('0x28')],_0x531644[_0xae88('0x34')]),_0x4dadcb);if(_0x16636f[_0xae88('0x28')]['filter']){_0x1aea5b[_0xae88('0x32')]=_[_0xae88('0x35')](_0x1aea5b[_0xae88('0x32')],{'$or':_[_0xae88('0x36')](_0x4dadcb,function(_0x5493ee){if(_0x5493ee[_0xae88('0x27')]!==_0xae88('0x37')){var _0x32e308={};_0x32e308[_0x5493ee[_0xae88('0x22')]]={'$like':'%'+_0x16636f['query'][_0xae88('0x38')]+'%'};return _0x32e308;}})});}_0x1aea5b=_[_0xae88('0x35')]({},_0x1aea5b,_0x16636f[_0xae88('0x39')]);var _0x316d02={'where':_0x1aea5b[_0xae88('0x32')]};return db[_0xae88('0x25')][_0xae88('0x1b')](_0x316d02)['then'](function(_0x496c72){_0xc95593[_0xae88('0x1b')]=_0x496c72;if(_0x16636f['query'][_0xae88('0x3a')]){_0x1aea5b[_0xae88('0x3b')]=[{'all':!![]}];}return db[_0xae88('0x25')]['findAll'](_0x1aea5b);})[_0xae88('0x20')](function(_0x4879e5){_0xc95593[_0xae88('0x3c')]=_0x4879e5;return _0xc95593;})[_0xae88('0x20')](respondWithFilteredResult(_0x9d0416,_0x1aea5b))['catch'](handleError(_0x9d0416,null));};exports['show']=function(_0xdbc575,_0x2caafe){var _0x5cc1c1={'raw':![],'where':{'id':_0xdbc575['params']['id']}},_0x308d76={};_0x308d76[_0xae88('0x2a')]=_[_0xae88('0x29')](db[_0xae88('0x25')][_0xae88('0x3d')]);_0x308d76['query']=_[_0xae88('0x29')](_0xdbc575['query']);_0x308d76[_0xae88('0x34')]=_[_0xae88('0x2c')](_0x308d76[_0xae88('0x2a')],_0x308d76[_0xae88('0x28')]);_0x5cc1c1[_0xae88('0x2b')]=_[_0xae88('0x2c')](_0x308d76[_0xae88('0x2a')],qs[_0xae88('0x2d')](_0xdbc575['query']['fields']));_0x5cc1c1[_0xae88('0x2b')]=_0x5cc1c1[_0xae88('0x2b')][_0xae88('0x2e')]?_0x5cc1c1[_0xae88('0x2b')]:_0x308d76[_0xae88('0x2a')];if(_0xdbc575[_0xae88('0x28')][_0xae88('0x3a')]){_0x5cc1c1[_0xae88('0x3b')]=[{'all':!![]}];}_0x5cc1c1=_[_0xae88('0x35')]({},_0x5cc1c1,_0xdbc575[_0xae88('0x39')]);return db[_0xae88('0x25')][_0xae88('0x3e')](_0x5cc1c1)[_0xae88('0x20')](handleEntityNotFound(_0x2caafe,null))['then'](respondWithResult(_0x2caafe,null))[_0xae88('0x3f')](handleError(_0x2caafe,null));};exports[_0xae88('0x40')]=function(_0x1ad7b5,_0x3cf614){return db[_0xae88('0x25')][_0xae88('0x40')](_0x1ad7b5[_0xae88('0x41')],{})[_0xae88('0x20')](respondWithResult(_0x3cf614,0xc9))[_0xae88('0x3f')](handleError(_0x3cf614,null));};exports['update']=function(_0x4afdc6,_0x5262a1){if(_0x4afdc6['body']['id']){delete _0x4afdc6[_0xae88('0x41')]['id'];}return db[_0xae88('0x25')][_0xae88('0x3e')]({'where':{'id':_0x4afdc6[_0xae88('0x42')]['id']}})['then'](handleEntityNotFound(_0x5262a1,null))[_0xae88('0x20')](saveUpdates(_0x4afdc6[_0xae88('0x41')],null))[_0xae88('0x20')](respondWithResult(_0x5262a1,null))[_0xae88('0x3f')](handleError(_0x5262a1,null));};exports[_0xae88('0x1f')]=function(_0x1e4682,_0x1d6a83){return db[_0xae88('0x25')]['find']({'where':{'id':_0x1e4682['params']['id']}})['then'](handleEntityNotFound(_0x1d6a83,null))[_0xae88('0x20')](removeEntity(_0x1d6a83,null))['catch'](handleError(_0x1d6a83,null));};exports[_0xae88('0x43')]=function(_0x62c530,_0xc72a3f,_0x1489a4){return db[_0xae88('0x44')][_0xae88('0x3e')]({'where':{'id':_0x62c530[_0xae88('0x42')]['id']}})['then'](handleEntityNotFound(_0xc72a3f,null))[_0xae88('0x20')](function(_0x1137ba){if(_0x1137ba){return _0x1137ba[_0xae88('0x43')](_0x62c530[_0xae88('0x41')][_0xae88('0x45')],_[_0xae88('0x46')](_0x62c530['body'],['ids','id'])||{});}})[_0xae88('0x20')](respondWithResult(_0xc72a3f,null))['catch'](handleError(_0xc72a3f,null));};exports[_0xae88('0x47')]=function(_0x578320,_0x54dab2,_0x2103cd){var _0x3cec0a={};var _0x47def1={};var _0x54a9a8;var _0x1ff8aa;return db[_0xae88('0x25')][_0xae88('0x48')]({'where':{'id':_0x578320[_0xae88('0x42')]['id']}})[_0xae88('0x20')](handleEntityNotFound(_0x54dab2,null))[_0xae88('0x20')](function(_0x48c37c){if(_0x48c37c){_0x54a9a8=_0x48c37c;_0x47def1[_0xae88('0x2a')]=_[_0xae88('0x29')](db[_0xae88('0x44')][_0xae88('0x3d')]);_0x47def1[_0xae88('0x28')]=_['keys'](_0x578320[_0xae88('0x28')]);_0x47def1[_0xae88('0x34')]=_['intersection'](_0x47def1[_0xae88('0x2a')],_0x47def1[_0xae88('0x28')]);_0x3cec0a[_0xae88('0x2b')]=_[_0xae88('0x2c')](_0x47def1[_0xae88('0x2a')],qs['fields'](_0x578320[_0xae88('0x28')][_0xae88('0x2d')]));_0x3cec0a[_0xae88('0x2b')]=_0x3cec0a[_0xae88('0x2b')][_0xae88('0x2e')]?_0x3cec0a['attributes']:_0x47def1['model'];_0x3cec0a[_0xae88('0x30')]=qs[_0xae88('0x31')](_0x578320['query']['sort']);_0x3cec0a[_0xae88('0x32')]=qs[_0xae88('0x34')](_['pick'](_0x578320[_0xae88('0x28')],_0x47def1[_0xae88('0x34')]));if(_0x578320[_0xae88('0x28')]['filter']){_0x3cec0a[_0xae88('0x32')]=_['merge'](_0x3cec0a[_0xae88('0x32')],{'$or':_[_0xae88('0x36')](_0x3cec0a[_0xae88('0x2b')],function(_0x5134eb){var _0x523a9f={};_0x523a9f[_0x5134eb]={'$like':'%'+_0x578320['query'][_0xae88('0x38')]+'%'};return _0x523a9f;})});}_0x3cec0a=_[_0xae88('0x35')]({},_0x3cec0a,_0x578320[_0xae88('0x39')]);return _0x54a9a8[_0xae88('0x47')](_0x3cec0a);}})[_0xae88('0x20')](function(_0x32f7c5){if(_0x32f7c5){_0x1ff8aa=_0x32f7c5[_0xae88('0x2e')];if(!_0x578320[_0xae88('0x28')][_0xae88('0x2f')](_0xae88('0x49'))){_0x3cec0a[_0xae88('0x19')]=qs[_0xae88('0x19')](_0x578320['query'][_0xae88('0x19')]);_0x3cec0a[_0xae88('0x18')]=qs[_0xae88('0x18')](_0x578320[_0xae88('0x28')]['offset']);}return _0x54a9a8[_0xae88('0x47')](_0x3cec0a);}})[_0xae88('0x20')](function(_0x5deb54){if(_0x5deb54){return _0x5deb54?{'count':_0x1ff8aa,'rows':_0x5deb54}:null;}})[_0xae88('0x20')](respondWithResult(_0x54dab2,null))[_0xae88('0x3f')](handleError(_0x54dab2,null));};exports['addActions']=function(_0x4afafb,_0xb7748c,_0x225fcf){return db[_0xae88('0x4a')]['find']({'where':{'id':_0x4afafb['params']['id']}})[_0xae88('0x20')](handleEntityNotFound(_0xb7748c,null))[_0xae88('0x20')](function(_0x530886){if(_0x530886){return _0x530886[_0xae88('0x4b')](_0x4afafb[_0xae88('0x41')][_0xae88('0x45')],_[_0xae88('0x46')](_0x4afafb[_0xae88('0x41')],['ids','id'])||{});}})[_0xae88('0x20')](respondWithResult(_0xb7748c,null))[_0xae88('0x3f')](handleError(_0xb7748c,null));};exports[_0xae88('0x4c')]=function(_0x53e7b7,_0x5b6269,_0x2816c6){var _0x22ec57={};var _0x2cc181={};var _0x5783a9;var _0x1c0d48;return db[_0xae88('0x25')][_0xae88('0x48')]({'where':{'id':_0x53e7b7[_0xae88('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b6269,null))['then'](function(_0x39ec0b){if(_0x39ec0b){_0x5783a9=_0x39ec0b;_0x2cc181[_0xae88('0x2a')]=_[_0xae88('0x29')](db[_0xae88('0x4a')][_0xae88('0x3d')]);_0x2cc181['query']=_[_0xae88('0x29')](_0x53e7b7[_0xae88('0x28')]);_0x2cc181[_0xae88('0x34')]=_[_0xae88('0x2c')](_0x2cc181[_0xae88('0x2a')],_0x2cc181[_0xae88('0x28')]);_0x22ec57[_0xae88('0x2b')]=_['intersection'](_0x2cc181[_0xae88('0x2a')],qs[_0xae88('0x2d')](_0x53e7b7[_0xae88('0x28')][_0xae88('0x2d')]));_0x22ec57[_0xae88('0x2b')]=_0x22ec57['attributes'][_0xae88('0x2e')]?_0x22ec57[_0xae88('0x2b')]:_0x2cc181['model'];_0x22ec57[_0xae88('0x30')]=qs[_0xae88('0x31')](_0x53e7b7[_0xae88('0x28')]['sort']);_0x22ec57[_0xae88('0x32')]=qs[_0xae88('0x34')](_[_0xae88('0x33')](_0x53e7b7[_0xae88('0x28')],_0x2cc181[_0xae88('0x34')]));if(_0x53e7b7['query'][_0xae88('0x38')]){_0x22ec57[_0xae88('0x32')]=_[_0xae88('0x35')](_0x22ec57[_0xae88('0x32')],{'$or':_['map'](_0x22ec57[_0xae88('0x2b')],function(_0x4d64c5){var _0xde26c2={};_0xde26c2[_0x4d64c5]={'$like':'%'+_0x53e7b7[_0xae88('0x28')][_0xae88('0x38')]+'%'};return _0xde26c2;})});}_0x22ec57=_[_0xae88('0x35')]({},_0x22ec57,_0x53e7b7['options']);return _0x5783a9[_0xae88('0x4c')](_0x22ec57);}})[_0xae88('0x20')](function(_0x8d0be3){if(_0x8d0be3){_0x1c0d48=_0x8d0be3[_0xae88('0x2e')];if(!_0x53e7b7[_0xae88('0x28')]['hasOwnProperty'](_0xae88('0x49'))){_0x22ec57['limit']=qs[_0xae88('0x19')](_0x53e7b7[_0xae88('0x28')][_0xae88('0x19')]);_0x22ec57[_0xae88('0x18')]=qs[_0xae88('0x18')](_0x53e7b7[_0xae88('0x28')]['offset']);}return _0x5783a9[_0xae88('0x4c')](_0x22ec57);}})[_0xae88('0x20')](function(_0x1a8cbe){if(_0x1a8cbe){return _0x1a8cbe?{'count':_0x1c0d48,'rows':_0x1a8cbe}:null;}})[_0xae88('0x20')](respondWithResult(_0x5b6269,null))[_0xae88('0x3f')](handleError(_0x5b6269,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6350c1f..0e5cc27 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 _0xe9dc=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports','tools_automations'];(function(_0x5680d6,_0x17e6a5){var _0x163574=function(_0xcaff76){while(--_0xcaff76){_0x5680d6['push'](_0x5680d6['shift']());}};_0x163574(++_0x17e6a5);}(_0xe9dc,0xc8));var _0xce9d=function(_0x563c35,_0x207732){_0x563c35=_0x563c35-0x0;var _0x2d746e=_0xe9dc[_0x563c35];return _0x2d746e;};'use strict';var _=require(_0xce9d('0x0'));var util=require('util');var logger=require(_0xce9d('0x1'))('api');var moment=require(_0xce9d('0x2'));var BPromise=require(_0xce9d('0x3'));var rp=require(_0xce9d('0x4'));var fs=require('fs');var path=require(_0xce9d('0x5'));var rimraf=require(_0xce9d('0x6'));var config=require('../../config/environment');var attributes=require(_0xce9d('0x7'));module[_0xce9d('0x8')]=function(_0x54e9ac,_0x22b63e){return _0x54e9ac['define']('Automation',attributes,{'tableName':_0xce9d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b81=['request-promise','path','rimraf','../../config/environment','define','Automation','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3a3a79,_0x13a8d8){var _0x1dc3e2=function(_0x1f1468){while(--_0x1f1468){_0x3a3a79['push'](_0x3a3a79['shift']());}};_0x1dc3e2(++_0x13a8d8);}(_0x4b81,0x171));var _0x14b8=function(_0x48e80b,_0x1e3ff6){_0x48e80b=_0x48e80b-0x0;var _0xce688f=_0x4b81[_0x48e80b];return _0xce688f;};'use strict';var _=require(_0x14b8('0x0'));var util=require(_0x14b8('0x1'));var logger=require(_0x14b8('0x2'))('api');var moment=require(_0x14b8('0x3'));var BPromise=require(_0x14b8('0x4'));var rp=require(_0x14b8('0x5'));var fs=require('fs');var path=require(_0x14b8('0x6'));var rimraf=require(_0x14b8('0x7'));var config=require(_0x14b8('0x8'));var attributes=require('./automation.attributes');module['exports']=function(_0x20b1cf,_0x4660b1){return _0x20b1cf[_0x14b8('0x9')](_0x14b8('0xa'),attributes,{'tableName':'tools_automations','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 442671f..57fb629 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 _0x1aab=['Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x1aab,0x122));var _0xb1aa=function(_0x1ea76c,_0x4c3e11){_0x1ea76c=_0x1ea76c-0x0;var _0xe2ae67=_0x1aab[_0x1ea76c];return _0xe2ae67;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var moment=require(_0xb1aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1aa('0x4'))['db'];var utils=require(_0xb1aa('0x5'));var logger=require(_0xb1aa('0x6'))(_0xb1aa('0x7'));var config=require(_0xb1aa('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb1aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x277448,_0x13a350,_0x283ad6){return new BPromise(function(_0x3415f7,_0x405387){return client[_0xb1aa('0xa')](_0x277448,_0x283ad6)['then'](function(_0x12067d){logger[_0xb1aa('0xb')]('Automation,\x20%s,\x20%s',_0x13a350,_0xb1aa('0xc'));logger[_0xb1aa('0xd')](_0xb1aa('0xe'),_0x13a350,_0xb1aa('0xc'),JSON[_0xb1aa('0xf')](_0x12067d));if(_0x12067d[_0xb1aa('0x10')]){if(_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x11')]===0x1f4){logger[_0xb1aa('0x10')](_0xb1aa('0x12'),_0x13a350,_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x13')]);return _0x405387(_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x13')]);}logger[_0xb1aa('0x10')]('Automation,\x20%s,\x20%s',_0x13a350,_0x12067d['error'][_0xb1aa('0x13')]);return _0x3415f7(_0x12067d['error'][_0xb1aa('0x13')]);}else{logger['info'](_0xb1aa('0x12'),_0x13a350,'request\x20sent');_0x3415f7(_0x12067d[_0xb1aa('0x14')]['message']);}})[_0xb1aa('0x15')](function(_0x408bf8){logger['error'](_0xb1aa('0x12'),_0x13a350,_0x408bf8);_0x405387(_0x408bf8);});});} \ No newline at end of file +var _0x32f4=['info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x190e94,_0x117fc1){var _0x3012a0=function(_0x500c69){while(--_0x500c69){_0x190e94['push'](_0x190e94['shift']());}};_0x3012a0(++_0x117fc1);}(_0x32f4,0x154));var _0x432f=function(_0x5eda13,_0x1c8307){_0x5eda13=_0x5eda13-0x0;var _0x501325=_0x32f4[_0x5eda13];return _0x501325;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('Automation,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('Automation,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f3defd9..f2f2f49 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 _0x79a8=['delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','post','addConditions','addActions','put','update'];(function(_0x5573a0,_0x138a81){var _0x979e79=function(_0x29f34b){while(--_0x29f34b){_0x5573a0['push'](_0x5573a0['shift']());}};_0x979e79(++_0x138a81);}(_0x79a8,0x1d0));var _0x879a=function(_0x187e82,_0x5254eb){_0x187e82=_0x187e82-0x0;var _0x58625e=_0x79a8[_0x187e82];return _0x58625e;};'use strict';var multer=require(_0x879a('0x0'));var util=require('util');var path=require(_0x879a('0x1'));var timeout=require(_0x879a('0x2'));var express=require(_0x879a('0x3'));var router=express['Router']();var fs_extra=require(_0x879a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var controller=require(_0x879a('0x7'));router[_0x879a('0x8')]('/',auth[_0x879a('0x9')](),controller[_0x879a('0xa')]);router[_0x879a('0x8')](_0x879a('0xb'),auth['isAuthenticated'](),controller[_0x879a('0xc')]);router['get'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller['getConditions']);router[_0x879a('0x8')](_0x879a('0xe'),auth[_0x879a('0x9')](),controller['getActions']);router[_0x879a('0xf')]('/',auth[_0x879a('0x9')](),controller['create']);router['post'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller[_0x879a('0x10')]);router[_0x879a('0xf')]('/:id/actions',auth[_0x879a('0x9')](),controller[_0x879a('0x11')]);router[_0x879a('0x12')](_0x879a('0xb'),auth[_0x879a('0x9')](),controller[_0x879a('0x13')]);router[_0x879a('0x14')](_0x879a('0xb'),auth[_0x879a('0x9')](),controller[_0x879a('0x15')]);module['exports']=router; \ No newline at end of file +var _0x26c2=['addConditions','addActions','put','destroy','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','create','post'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x26c2,0x130));var _0x226c=function(_0x2b24e0,_0x15173c){_0x2b24e0=_0x2b24e0-0x0;var _0x3f095d=_0x26c2[_0x2b24e0];return _0x3f095d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x226c('0x0'));var express=require(_0x226c('0x1'));var router=express[_0x226c('0x2')]();var fs_extra=require(_0x226c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x226c('0x4'));var config=require(_0x226c('0x5'));var controller=require('./automation.controller');router[_0x226c('0x6')]('/',auth[_0x226c('0x7')](),controller[_0x226c('0x8')]);router[_0x226c('0x6')](_0x226c('0x9'),auth['isAuthenticated'](),controller[_0x226c('0xa')]);router[_0x226c('0x6')](_0x226c('0xb'),auth[_0x226c('0x7')](),controller[_0x226c('0xc')]);router['get'](_0x226c('0xd'),auth[_0x226c('0x7')](),controller['getActions']);router['post']('/',auth[_0x226c('0x7')](),controller[_0x226c('0xe')]);router[_0x226c('0xf')](_0x226c('0xb'),auth[_0x226c('0x7')](),controller[_0x226c('0x10')]);router[_0x226c('0xf')]('/:id/actions',auth['isAuthenticated'](),controller[_0x226c('0x11')]);router[_0x226c('0x12')](_0x226c('0x9'),auth[_0x226c('0x7')](),controller['update']);router['delete'](_0x226c('0x9'),auth[_0x226c('0x7')](),controller[_0x226c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 24ad794..d872692 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 _0x87b0=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\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','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x5389b9,_0x56f74e){var _0xc1d58=function(_0x34ba52){while(--_0x34ba52){_0x5389b9['push'](_0x5389b9['shift']());}};_0xc1d58(++_0x56f74e);}(_0x87b0,0x101));var _0x087b=function(_0x4c92db,_0x3da920){_0x4c92db=_0x4c92db-0x0;var _0x4f2019=_0x87b0[_0x4c92db];return _0x4f2019;};'use strict';var Sequelize=require(_0x087b('0x0'));module[_0x087b('0x1')]={'name':{'type':Sequelize[_0x087b('0x2')],'unique':_0x087b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x087b('0x4')](_0x087b('0x5')),'allowNull':![],'defaultValue':_0x087b('0x5')},'description':{'type':Sequelize[_0x087b('0x2')]},'active':{'type':Sequelize[_0x087b('0x6')],'defaultValue':0x0,'comment':_0x087b('0x7')},'limitCalls':{'type':Sequelize[_0x087b('0x8')](0x4)[_0x087b('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x087b('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x087b('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x087b('0xb')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x087b('0x8')](0x5)[_0x087b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x087b('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x087b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x087b('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x087b('0x8')](0x5)[_0x087b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x087b('0x8')](0x3)[_0x087b('0x9')],'defaultValue':0x3,'comment':_0x087b('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x087b('0x8')](0x5)[_0x087b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x087b('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x087b('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x087b('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x087b('0x4')](_0x087b('0x11'),_0x087b('0x12'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x087b('0x6')],'defaultValue':0x0,'comment':_0x087b('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x087b('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x087b('0x8')](0x9)[_0x087b('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x087b('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x087b('0x8')](0x9)[_0x087b('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x087b('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x087b('0x8')](0x9)[_0x087b('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x087b('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x087b('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x087b('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x087b('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x087b('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x087b('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x087b('0x8')](0x5)[_0x087b('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x087b('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x087b('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x087b('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x087b('0x1b'),_0x087b('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x087b('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x087b('0x8')](0x3)[_0x087b('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x087b('0x1d')},'dialCutDigit':{'type':Sequelize[_0x087b('0x8')](0x3)[_0x087b('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x087b('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x087b('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x087b('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x087b('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x087b('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x087b('0x8')](0x3)[_0x087b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x087b('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x087b('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x087b('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x087b('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x087b('0x8')](0x5)[_0x087b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x087b('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x087b('0x8')](0x3)[_0x087b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x087b('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x087b('0x8')](0x5)[_0x087b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x087b('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x087b('0x8')](0x3)[_0x087b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x087b('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x087b('0x8')](0x5)[_0x087b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x087b('0x27')}}; \ No newline at end of file +var _0x80ff=['Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','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','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\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','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x80ff,0x1e4));var _0xf80f=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x80ff[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0xf80f('0x0'));module[_0xf80f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf80f('0x2')](_0xf80f('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xf80f('0x4')]},'active':{'type':Sequelize[_0xf80f('0x5')],'defaultValue':0x0,'comment':_0xf80f('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xf80f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf80f('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf80f('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xf80f('0x9')](0x3)[_0xf80f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf80f('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf80f('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf80f('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf80f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf80f('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xf80f('0x9')](0x3)[_0xf80f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf80f('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf80f('0x9')](0x5)[_0xf80f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf80f('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf80f('0x9')](0x5)[_0xf80f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf80f('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf80f('0x9')](0x3)[_0xf80f('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf80f('0x10')},'dialTimezone':{'type':Sequelize[_0xf80f('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf80f('0x4')],'defaultValue':_0xf80f('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xf80f('0x2')](_0xf80f('0x12'),_0xf80f('0x13'),'onlyIfOpen'),'defaultValue':_0xf80f('0x12')},'dialAMDActive':{'type':Sequelize[_0xf80f('0x5')],'defaultValue':0x0,'comment':_0xf80f('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf80f('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf80f('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xf80f('0x9')](0x9)[_0xf80f('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf80f('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf80f('0x9')](0x9)[_0xf80f('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf80f('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf80f('0x9')](0x9)[_0xf80f('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf80f('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0xf80f('0x9')](0x9)[_0xf80f('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf80f('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf80f('0x9')](0x9)[_0xf80f('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf80f('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf80f('0x9')](0x9)[_0xf80f('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf80f('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf80f('0x9')](0x5)[_0xf80f('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf80f('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xf80f('0x2')](_0xf80f('0x1c'),_0xf80f('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xf80f('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf80f('0x9')](0x3)[_0xf80f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xf80f('0x9')](0x3)[_0xf80f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf80f('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf80f('0x9')](0x3)[_0xf80f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf80f('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf80f('0x9')](0x5)[_0xf80f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xf80f('0x9')](0x3)[_0xf80f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xf80f('0x9')](0x5)[_0xf80f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf80f('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf80f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf80f('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf80f('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xf80f('0x9')](0x3)[_0xf80f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf80f('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf80f('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf80f('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf80f('0x9')](0x3)[_0xf80f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf80f('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf80f('0x9')](0x5)[_0xf80f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf80f('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index fd93979..6bdb749 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 _0x6f54=['CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','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','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','insert','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','deletedAt\x20IS\x20NULL','removeBlackLists','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','IvrCampaigns','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Campaign','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','getHoppers','findOne','CmHopper','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks'];(function(_0x23c02b,_0x411b4d){var _0x25efc5=function(_0x50e9e4){while(--_0x50e9e4){_0x23c02b['push'](_0x23c02b['shift']());}};_0x25efc5(++_0x411b4d);}(_0x6f54,0xcf));var _0x46f5=function(_0x34395d,_0x45b7f0){_0x34395d=_0x34395d-0x0;var _0x327e89=_0x6f54[_0x34395d];return _0x327e89;};'use strict';var emlformat=require(_0x46f5('0x0'));var rimraf=require(_0x46f5('0x1'));var zipdir=require(_0x46f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x46f5('0x3'));var BPromise=require(_0x46f5('0x4'));var Mustache=require(_0x46f5('0x5'));var util=require(_0x46f5('0x6'));var path=require('path');var sox=require(_0x46f5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46f5('0x8'));var _=require('lodash');var squel=require(_0x46f5('0x9'));var crypto=require(_0x46f5('0xa'));var jsforce=require(_0x46f5('0xb'));var deskjs=require(_0x46f5('0xc'));var toCsv=require(_0x46f5('0xd'));var querystring=require(_0x46f5('0xe'));var Papa=require(_0x46f5('0xf'));var Redis=require(_0x46f5('0x10'));var authService=require(_0x46f5('0x11'));var qs=require(_0x46f5('0x12'));var as=require(_0x46f5('0x13'));var hardwareService=require(_0x46f5('0x14'));var logger=require(_0x46f5('0x15'))(_0x46f5('0x16'));var utils=require('../../config/utils');var config=require(_0x46f5('0x17'));var licenseUtil=require(_0x46f5('0x18'));var db=require(_0x46f5('0x19'))['db'];function respondWithStatusCode(_0x5c6df5,_0x138e02){_0x138e02=_0x138e02||0xcc;return function(_0x9741d5){if(_0x9741d5){return _0x5c6df5['sendStatus'](_0x138e02);}return _0x5c6df5[_0x46f5('0x1a')](_0x138e02)[_0x46f5('0x1b')]();};}function respondWithResult(_0x1b1d34,_0x1190fc){_0x1190fc=_0x1190fc||0xc8;return function(_0x51a90a){if(_0x51a90a){return _0x1b1d34['status'](_0x1190fc)[_0x46f5('0x1c')](_0x51a90a);}};}function respondWithFilteredResult(_0x40a47e,_0x52674d){return function(_0xd57cc6){if(_0xd57cc6){var _0x3960e6=typeof _0x52674d[_0x46f5('0x1d')]===_0x46f5('0x1e')&&typeof _0x52674d[_0x46f5('0x1f')]===_0x46f5('0x1e');var _0x1adbb1=_0xd57cc6[_0x46f5('0x20')];var _0x551ee0=_0x3960e6?0x0:_0x52674d[_0x46f5('0x1d')];var _0x1b910b=_0x3960e6?_0xd57cc6[_0x46f5('0x20')]:_0x52674d[_0x46f5('0x1d')]+_0x52674d['limit'];var _0x389831;if(_0x1b910b>=_0x1adbb1){_0x1b910b=_0x1adbb1;_0x389831=0xc8;}else{_0x389831=0xce;}_0x40a47e[_0x46f5('0x1a')](_0x389831);return _0x40a47e[_0x46f5('0x21')](_0x46f5('0x22'),_0x551ee0+'-'+_0x1b910b+'/'+_0x1adbb1)[_0x46f5('0x1c')](_0xd57cc6);}return null;};}function patchUpdates(_0x425a2e){return function(_0x58195a){try{jsonpatch[_0x46f5('0x23')](_0x58195a,_0x425a2e,!![]);}catch(_0x3ed408){return BPromise[_0x46f5('0x24')](_0x3ed408);}return _0x58195a[_0x46f5('0x25')]();};}function saveUpdates(_0x49556c,_0x5d52bf){return function(_0x362033){if(_0x362033){return _0x362033[_0x46f5('0x26')](_0x49556c)[_0x46f5('0x27')](function(_0x2a004d){return _0x2a004d;});}return null;};}function removeEntity(_0x52e610,_0x4c6e30){return function(_0x2993f6){if(_0x2993f6){return _0x2993f6['destroy']()[_0x46f5('0x27')](function(){var _0xc096c6=_0x2993f6['get']({'plain':!![]});var _0x3aa949=_0x46f5('0x28');return db[_0x46f5('0x29')][_0x46f5('0x2a')]({'where':{'type':_0x3aa949,'resourceId':_0xc096c6['id']}})['then'](function(){return _0x2993f6;});})['then'](function(){_0x52e610[_0x46f5('0x1a')](0xcc)[_0x46f5('0x1b')]();});}};}function handleEntityNotFound(_0x4b2769,_0x4a2fe1){return function(_0x3156d5){if(!_0x3156d5){_0x4b2769[_0x46f5('0x2b')](0x194);}return _0x3156d5;};}function handleError(_0x6f3b1d,_0x548310){_0x548310=_0x548310||0x1f4;return function(_0x48b761){logger['error'](_0x48b761[_0x46f5('0x2c')]);if(_0x48b761[_0x46f5('0x2d')]){delete _0x48b761[_0x46f5('0x2d')];}_0x6f3b1d['status'](_0x548310)[_0x46f5('0x2e')](_0x48b761);};}exports[_0x46f5('0x2f')]=function(_0x47aab6,_0x48281a){var _0x36a4bb={},_0x456c02={},_0x1c8f58={'count':0x0,'rows':[]};var _0x317af7=_[_0x46f5('0x30')](db['Campaign'][_0x46f5('0x31')],function(_0x413360){return{'name':_0x413360[_0x46f5('0x32')],'type':_0x413360['type']['key']};});_0x456c02['model']=_[_0x46f5('0x30')](_0x317af7,_0x46f5('0x2d'));_0x456c02[_0x46f5('0x33')]=_['keys'](_0x47aab6[_0x46f5('0x33')]);_0x456c02[_0x46f5('0x34')]=_['intersection'](_0x456c02[_0x46f5('0x35')],_0x456c02[_0x46f5('0x33')]);_0x36a4bb[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x456c02['model'],qs[_0x46f5('0x38')](_0x47aab6['query'][_0x46f5('0x38')]));_0x36a4bb['attributes']=_0x36a4bb[_0x46f5('0x36')][_0x46f5('0x39')]?_0x36a4bb[_0x46f5('0x36')]:_0x456c02['model'];if(!_0x47aab6[_0x46f5('0x33')][_0x46f5('0x3a')](_0x46f5('0x3b'))){_0x36a4bb[_0x46f5('0x1f')]=qs[_0x46f5('0x1f')](_0x47aab6['query'][_0x46f5('0x1f')]);_0x36a4bb[_0x46f5('0x1d')]=qs[_0x46f5('0x1d')](_0x47aab6[_0x46f5('0x33')]['offset']);}_0x36a4bb[_0x46f5('0x3c')]=qs[_0x46f5('0x3d')](_0x47aab6[_0x46f5('0x33')]['sort']);_0x36a4bb[_0x46f5('0x3e')]=qs[_0x46f5('0x34')](_[_0x46f5('0x3f')](_0x47aab6[_0x46f5('0x33')],_0x456c02[_0x46f5('0x34')]),_0x317af7);if(_0x47aab6['query'][_0x46f5('0x40')]){_0x36a4bb[_0x46f5('0x3e')]=_[_0x46f5('0x41')](_0x36a4bb[_0x46f5('0x3e')],{'$or':_[_0x46f5('0x30')](_0x317af7,function(_0x3a5980){if(_0x3a5980[_0x46f5('0x42')]!==_0x46f5('0x43')){var _0x4a31d0={};_0x4a31d0[_0x3a5980[_0x46f5('0x2d')]]={'$like':'%'+_0x47aab6[_0x46f5('0x33')]['filter']+'%'};return _0x4a31d0;}})});}_0x36a4bb=_[_0x46f5('0x41')]({},_0x36a4bb,_0x47aab6[_0x46f5('0x44')]);var _0xe79100={'where':_0x36a4bb[_0x46f5('0x3e')]};return db[_0x46f5('0x45')][_0x46f5('0x20')](_0xe79100)['then'](function(_0x29c47d){_0x1c8f58['count']=_0x29c47d;if(_0x47aab6[_0x46f5('0x33')]['includeAll']){_0x36a4bb[_0x46f5('0x46')]=[{'all':!![]}];}return db[_0x46f5('0x45')][_0x46f5('0x47')](_0x36a4bb);})[_0x46f5('0x27')](function(_0x53cb12){_0x1c8f58[_0x46f5('0x48')]=_0x53cb12;return _0x1c8f58;})[_0x46f5('0x27')](respondWithFilteredResult(_0x48281a,_0x36a4bb))[_0x46f5('0x49')](handleError(_0x48281a,null));};exports[_0x46f5('0x4a')]=function(_0x9f4676,_0x51c34e){var _0x20c69e={'raw':![],'where':{'id':_0x9f4676[_0x46f5('0x4b')]['id']}},_0x1a8f57={};_0x1a8f57['model']=_['keys'](db['Campaign'][_0x46f5('0x31')]);_0x1a8f57[_0x46f5('0x33')]=_[_0x46f5('0x4c')](_0x9f4676[_0x46f5('0x33')]);_0x1a8f57[_0x46f5('0x34')]=_[_0x46f5('0x37')](_0x1a8f57[_0x46f5('0x35')],_0x1a8f57[_0x46f5('0x33')]);_0x20c69e[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x1a8f57['model'],qs[_0x46f5('0x38')](_0x9f4676['query'][_0x46f5('0x38')]));_0x20c69e['attributes']=_0x20c69e['attributes'][_0x46f5('0x39')]?_0x20c69e[_0x46f5('0x36')]:_0x1a8f57[_0x46f5('0x35')];if(_0x9f4676['query'][_0x46f5('0x4d')]){_0x20c69e[_0x46f5('0x46')]=[{'all':!![]}];}_0x20c69e=_[_0x46f5('0x41')]({},_0x20c69e,_0x9f4676[_0x46f5('0x44')]);return db['Campaign'][_0x46f5('0x4e')](_0x20c69e)[_0x46f5('0x27')](handleEntityNotFound(_0x51c34e,null))[_0x46f5('0x27')](respondWithResult(_0x51c34e,null))['catch'](handleError(_0x51c34e,null));};exports[_0x46f5('0x4f')]=function(_0x236409,_0x276192){return db[_0x46f5('0x45')][_0x46f5('0x4f')](_0x236409[_0x46f5('0x50')],{})[_0x46f5('0x27')](function(_0x1216de){var _0x15594e=_0x236409[_0x46f5('0x51')]['get']({'plain':!![]});if(!_0x15594e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15594e[_0x46f5('0x52')]==='user'){var _0xbd2189=_0x1216de[_0x46f5('0x53')]({'plain':!![]});var _0x5305e9=_0x46f5('0x28');return db[_0x46f5('0x54')][_0x46f5('0x4e')]({'where':{'name':_0x5305e9,'userProfileId':_0x15594e[_0x46f5('0x55')]},'raw':!![]})[_0x46f5('0x27')](function(_0x302d29){if(_0x302d29&&_0x302d29['autoAssociation']===0x0){return db[_0x46f5('0x29')][_0x46f5('0x4f')]({'name':_0xbd2189[_0x46f5('0x2d')],'resourceId':_0xbd2189['id'],'type':_0x302d29[_0x46f5('0x2d')],'sectionId':_0x302d29['id']},{})[_0x46f5('0x27')](function(){return _0x1216de;});}else{return _0x1216de;}})[_0x46f5('0x49')](function(_0x5e26c6){logger['error'](_0x46f5('0x56'),_0x5e26c6);throw _0x5e26c6;});}return _0x1216de;})[_0x46f5('0x27')](respondWithResult(_0x276192,0xc9))[_0x46f5('0x49')](handleError(_0x276192,null));};exports['clone']=function(_0x4e3932,_0xf21b38){var _0x518a81={'where':{'id':_0x4e3932[_0x46f5('0x4b')]['id']}},_0x376006={};_0x376006[_0x46f5('0x35')]=_[_0x46f5('0x4c')](db[_0x46f5('0x45')]['rawAttributes']);_0x518a81[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x376006['model'],qs[_0x46f5('0x38')](_0x4e3932[_0x46f5('0x33')][_0x46f5('0x38')]));_0x518a81[_0x46f5('0x36')]=_0x518a81['attributes'][_0x46f5('0x39')]?_0x518a81[_0x46f5('0x36')]:_0x376006[_0x46f5('0x35')];if(_0x4e3932[_0x46f5('0x33')][_0x46f5('0x4d')]){_0x518a81[_0x46f5('0x46')]=[{'all':!![]}];}_0x518a81=_[_0x46f5('0x41')]({},_0x518a81,_0x4e3932['options']);return db[_0x46f5('0x45')]['find'](_0x518a81)['then'](handleEntityNotFound(_0xf21b38,null))['then'](function(_0x3c1c1a){if(_0x3c1c1a){var _0xcbe605=_0x3c1c1a['get']({'plain':!![]});_0xcbe605=qs[_0x46f5('0x57')](_0xcbe605,['id','createdAt',_0x46f5('0x58')]);_0x4e3932['body']=_[_0x46f5('0x57')](_0x4e3932[_0x46f5('0x50')],['id',_0x46f5('0x59'),_0x46f5('0x58')]);return db[_0x46f5('0x45')]['create'](_[_0x46f5('0x41')](_0xcbe605,_0x4e3932['body']),{'include':_0x4e3932[_0x46f5('0x33')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x1ea05e){var _0x513ee2=_0x4e3932['user'][_0x46f5('0x53')]({'plain':!![]});if(!_0x513ee2)throw new Error(_0x46f5('0x5a'));if(_0x513ee2['role']==='user'){var _0x59b3bc=_0x1ea05e[_0x46f5('0x53')]({'plain':!![]});var _0x1487dd=_0x46f5('0x28');return db[_0x46f5('0x54')][_0x46f5('0x4e')]({'where':{'name':_0x1487dd,'userProfileId':_0x513ee2[_0x46f5('0x55')]},'raw':!![]})['then'](function(_0x12964b){if(_0x12964b&&_0x12964b[_0x46f5('0x5b')]===0x0){return db[_0x46f5('0x29')][_0x46f5('0x4f')]({'name':_0x59b3bc['name'],'resourceId':_0x59b3bc['id'],'type':_0x12964b[_0x46f5('0x2d')],'sectionId':_0x12964b['id']},{})['then'](function(){return _0x1ea05e;});}else{return _0x1ea05e;}})[_0x46f5('0x49')](function(_0x2054e1){logger[_0x46f5('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2054e1);throw _0x2054e1;});}return _0x1ea05e;});}})[_0x46f5('0x27')](respondWithResult(_0xf21b38,0xc9))['catch'](handleError(_0xf21b38,null));};exports['update']=function(_0x1e0bbb,_0x54e179){if(_0x1e0bbb[_0x46f5('0x50')]['id']){delete _0x1e0bbb[_0x46f5('0x50')]['id'];}return db['Campaign'][_0x46f5('0x4e')]({'where':{'id':_0x1e0bbb[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x54e179,null))[_0x46f5('0x27')](saveUpdates(_0x1e0bbb[_0x46f5('0x50')],null))[_0x46f5('0x27')](respondWithResult(_0x54e179,null))[_0x46f5('0x49')](handleError(_0x54e179,null));};exports[_0x46f5('0x2a')]=function(_0x46acb3,_0xbe7698){return db[_0x46f5('0x45')][_0x46f5('0x4e')]({'where':{'id':_0x46acb3['params']['id']}})['then'](handleEntityNotFound(_0xbe7698,null))[_0x46f5('0x27')](removeEntity(_0xbe7698,null))['catch'](handleError(_0xbe7698,null));};exports[_0x46f5('0x5d')]=function(_0x24108a,_0x3bb638,_0xf370f8){var _0x58ef6d={'raw':!![],'where':{}};var _0x5286ff={};var _0x3629f7={'count':0x0,'rows':[]};return db[_0x46f5('0x45')][_0x46f5('0x5e')]({'where':{'id':_0x24108a[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x3bb638,null))['then'](function(_0x490b25){if(_0x490b25){_0x5286ff['model']=_[_0x46f5('0x4c')](db[_0x46f5('0x5f')][_0x46f5('0x31')]);_0x5286ff[_0x46f5('0x33')]=_[_0x46f5('0x4c')](_0x24108a[_0x46f5('0x33')]);_0x5286ff['filters']=_['intersection'](_0x5286ff['model'],_0x5286ff[_0x46f5('0x33')]);_0x58ef6d[_0x46f5('0x36')]=_['intersection'](_0x5286ff['model'],qs['fields'](_0x24108a['query'][_0x46f5('0x38')]));_0x58ef6d[_0x46f5('0x36')]=_0x58ef6d[_0x46f5('0x36')][_0x46f5('0x39')]?_0x58ef6d[_0x46f5('0x36')]:_0x5286ff[_0x46f5('0x35')];if(!_0x24108a[_0x46f5('0x33')][_0x46f5('0x3a')](_0x46f5('0x3b'))){_0x58ef6d[_0x46f5('0x1f')]=qs['limit'](_0x24108a[_0x46f5('0x33')]['limit']);_0x58ef6d[_0x46f5('0x1d')]=qs[_0x46f5('0x1d')](_0x24108a[_0x46f5('0x33')]['offset']);}_0x58ef6d['order']=qs[_0x46f5('0x3d')](_0x24108a[_0x46f5('0x33')]['sort']);_0x58ef6d['where']=qs[_0x46f5('0x34')](_[_0x46f5('0x3f')](_0x24108a[_0x46f5('0x33')],_0x5286ff[_0x46f5('0x34')]));_0x58ef6d['where'][_0x46f5('0x60')]=_0x490b25['id'];if(_0x24108a[_0x46f5('0x33')][_0x46f5('0x40')]){_0x58ef6d[_0x46f5('0x3e')]=_[_0x46f5('0x41')](_0x58ef6d[_0x46f5('0x3e')],{'$or':_[_0x46f5('0x30')](_0x58ef6d[_0x46f5('0x36')],function(_0x13853f){var _0x3d888c={};_0x3d888c[_0x13853f]={'$like':'%'+_0x24108a[_0x46f5('0x33')][_0x46f5('0x40')]+'%'};return _0x3d888c;})});}_0x58ef6d=_[_0x46f5('0x41')]({},_0x58ef6d,_0x24108a[_0x46f5('0x44')]);return db[_0x46f5('0x5f')][_0x46f5('0x20')]({'where':_0x58ef6d[_0x46f5('0x3e')]})[_0x46f5('0x27')](function(_0x159faa){_0x3629f7[_0x46f5('0x20')]=_0x159faa;if(_0x24108a[_0x46f5('0x33')][_0x46f5('0x4d')]){_0x58ef6d[_0x46f5('0x46')]=[{'all':!![]}];}return db[_0x46f5('0x5f')][_0x46f5('0x47')](_0x58ef6d);})[_0x46f5('0x27')](function(_0x5c3eef){_0x3629f7[_0x46f5('0x48')]=_0x5c3eef;return _0x3629f7;});}})[_0x46f5('0x27')](respondWithFilteredResult(_0x3bb638,_0x58ef6d))[_0x46f5('0x49')](handleError(_0x3bb638,null));};exports['getHopperHistories']=function(_0x2b4f7f,_0x4068df,_0x3fac1e){var _0x1a83ea={'raw':!![],'where':{}};var _0x27389d={};var _0x3c4467={'count':0x0,'rows':[]};return db[_0x46f5('0x45')][_0x46f5('0x5e')]({'where':{'id':_0x2b4f7f[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x4068df,null))['then'](function(_0x371ed2){if(_0x371ed2){_0x27389d['model']=_['keys'](db[_0x46f5('0x61')][_0x46f5('0x31')]);_0x27389d[_0x46f5('0x33')]=_['keys'](_0x2b4f7f[_0x46f5('0x33')]);_0x27389d['filters']=_[_0x46f5('0x37')](_0x27389d[_0x46f5('0x35')],_0x27389d[_0x46f5('0x33')]);_0x1a83ea[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x27389d['model'],qs[_0x46f5('0x38')](_0x2b4f7f[_0x46f5('0x33')][_0x46f5('0x38')]));_0x1a83ea[_0x46f5('0x36')]=_0x1a83ea[_0x46f5('0x36')][_0x46f5('0x39')]?_0x1a83ea['attributes']:_0x27389d[_0x46f5('0x35')];if(!_0x2b4f7f[_0x46f5('0x33')][_0x46f5('0x3a')](_0x46f5('0x3b'))){_0x1a83ea[_0x46f5('0x1f')]=qs[_0x46f5('0x1f')](_0x2b4f7f['query'][_0x46f5('0x1f')]);_0x1a83ea['offset']=qs[_0x46f5('0x1d')](_0x2b4f7f[_0x46f5('0x33')][_0x46f5('0x1d')]);}_0x1a83ea[_0x46f5('0x3c')]=qs[_0x46f5('0x3d')](_0x2b4f7f['query'][_0x46f5('0x3d')]);_0x1a83ea['where']=qs['filters'](_[_0x46f5('0x3f')](_0x2b4f7f['query'],_0x27389d['filters']));_0x1a83ea[_0x46f5('0x3e')][_0x46f5('0x60')]=_0x371ed2['id'];if(_0x2b4f7f[_0x46f5('0x33')][_0x46f5('0x40')]){_0x1a83ea[_0x46f5('0x3e')]=_[_0x46f5('0x41')](_0x1a83ea[_0x46f5('0x3e')],{'$or':_['map'](_0x1a83ea[_0x46f5('0x36')],function(_0x188fa5){var _0x14dc1e={};_0x14dc1e[_0x188fa5]={'$like':'%'+_0x2b4f7f[_0x46f5('0x33')][_0x46f5('0x40')]+'%'};return _0x14dc1e;})});}_0x1a83ea=_['merge']({},_0x1a83ea,_0x2b4f7f['options']);return db['CmHopperHistory'][_0x46f5('0x20')]({'where':_0x1a83ea[_0x46f5('0x3e')]})['then'](function(_0xabacc8){_0x3c4467['count']=_0xabacc8;if(_0x2b4f7f['query'][_0x46f5('0x4d')]){_0x1a83ea['include']=[{'all':!![]}];}return db[_0x46f5('0x61')]['findAll'](_0x1a83ea);})['then'](function(_0x23f81e){_0x3c4467[_0x46f5('0x48')]=_0x23f81e;return _0x3c4467;});}})[_0x46f5('0x27')](respondWithFilteredResult(_0x4068df,_0x1a83ea))['catch'](handleError(_0x4068df,null));};exports[_0x46f5('0x62')]=function(_0x210b96,_0x4fecb7,_0x54a32e){var _0x447e09={'raw':!![],'where':{}};var _0x4a14e7={};var _0x574bf4={'count':0x0,'rows':[]};return db[_0x46f5('0x45')][_0x46f5('0x5e')]({'where':{'id':_0x210b96[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x4fecb7,null))[_0x46f5('0x27')](function(_0x4230c1){if(_0x4230c1){_0x4a14e7[_0x46f5('0x35')]=_[_0x46f5('0x4c')](db[_0x46f5('0x63')]['rawAttributes']);_0x4a14e7[_0x46f5('0x33')]=_[_0x46f5('0x4c')](_0x210b96['query']);_0x4a14e7[_0x46f5('0x34')]=_['intersection'](_0x4a14e7[_0x46f5('0x35')],_0x4a14e7['query']);_0x447e09[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x4a14e7[_0x46f5('0x35')],qs[_0x46f5('0x38')](_0x210b96['query']['fields']));_0x447e09[_0x46f5('0x36')]=_0x447e09[_0x46f5('0x36')][_0x46f5('0x39')]?_0x447e09['attributes']:_0x4a14e7[_0x46f5('0x35')];if(!_0x210b96['query'][_0x46f5('0x3a')]('nolimit')){_0x447e09['limit']=qs['limit'](_0x210b96['query'][_0x46f5('0x1f')]);_0x447e09[_0x46f5('0x1d')]=qs[_0x46f5('0x1d')](_0x210b96['query']['offset']);}_0x447e09[_0x46f5('0x3c')]=qs[_0x46f5('0x3d')](_0x210b96[_0x46f5('0x33')][_0x46f5('0x3d')]);_0x447e09[_0x46f5('0x3e')]=qs[_0x46f5('0x34')](_[_0x46f5('0x3f')](_0x210b96[_0x46f5('0x33')],_0x4a14e7[_0x46f5('0x34')]));_0x447e09['where']['CampaignId']=_0x4230c1['id'];if(_0x210b96[_0x46f5('0x33')][_0x46f5('0x40')]){_0x447e09[_0x46f5('0x3e')]=_[_0x46f5('0x41')](_0x447e09[_0x46f5('0x3e')],{'$or':_[_0x46f5('0x30')](_0x447e09[_0x46f5('0x36')],function(_0x40cc78){var _0x1df111={};_0x1df111[_0x40cc78]={'$like':'%'+_0x210b96['query'][_0x46f5('0x40')]+'%'};return _0x1df111;})});}_0x447e09=_[_0x46f5('0x41')]({},_0x447e09,_0x210b96[_0x46f5('0x44')]);return db[_0x46f5('0x63')][_0x46f5('0x20')]({'where':_0x447e09[_0x46f5('0x3e')]})[_0x46f5('0x27')](function(_0x3f48f0){_0x574bf4['count']=_0x3f48f0;if(_0x210b96[_0x46f5('0x33')][_0x46f5('0x4d')]){_0x447e09[_0x46f5('0x46')]=[{'all':!![]}];}return db[_0x46f5('0x63')][_0x46f5('0x47')](_0x447e09);})[_0x46f5('0x27')](function(_0x5edb99){_0x574bf4[_0x46f5('0x48')]=_0x5edb99;return _0x574bf4;});}})['then'](respondWithFilteredResult(_0x4fecb7,_0x447e09))['catch'](handleError(_0x4fecb7,null));};exports[_0x46f5('0x64')]=function(_0x1d4b81,_0x508e17,_0x449847){var _0x5282a9={'raw':!![],'where':{}};var _0x3c5f8d={};var _0x249087={'count':0x0,'rows':[]};return db[_0x46f5('0x45')]['findOne']({'where':{'id':_0x1d4b81[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x508e17,null))[_0x46f5('0x27')](function(_0x2a9d1b){if(_0x2a9d1b){_0x3c5f8d[_0x46f5('0x35')]=_[_0x46f5('0x4c')](db[_0x46f5('0x65')][_0x46f5('0x31')]);_0x3c5f8d[_0x46f5('0x33')]=_['keys'](_0x1d4b81[_0x46f5('0x33')]);_0x3c5f8d['filters']=_['intersection'](_0x3c5f8d['model'],_0x3c5f8d['query']);_0x5282a9[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x3c5f8d[_0x46f5('0x35')],qs['fields'](_0x1d4b81['query'][_0x46f5('0x38')]));_0x5282a9[_0x46f5('0x36')]=_0x5282a9['attributes']['length']?_0x5282a9['attributes']:_0x3c5f8d['model'];if(!_0x1d4b81[_0x46f5('0x33')][_0x46f5('0x3a')]('nolimit')){_0x5282a9[_0x46f5('0x1f')]=qs[_0x46f5('0x1f')](_0x1d4b81['query'][_0x46f5('0x1f')]);_0x5282a9['offset']=qs['offset'](_0x1d4b81[_0x46f5('0x33')][_0x46f5('0x1d')]);}_0x5282a9[_0x46f5('0x3c')]=qs['sort'](_0x1d4b81[_0x46f5('0x33')][_0x46f5('0x3d')]);_0x5282a9[_0x46f5('0x3e')]=qs['filters'](_['pick'](_0x1d4b81['query'],_0x3c5f8d['filters']));_0x5282a9['where'][_0x46f5('0x60')]=_0x2a9d1b['id'];if(_0x1d4b81[_0x46f5('0x33')][_0x46f5('0x40')]){_0x5282a9[_0x46f5('0x3e')]=_[_0x46f5('0x41')](_0x5282a9[_0x46f5('0x3e')],{'$or':_['map'](_0x5282a9['attributes'],function(_0x5eef48){var _0x33679a={};_0x33679a[_0x5eef48]={'$like':'%'+_0x1d4b81['query']['filter']+'%'};return _0x33679a;})});}_0x5282a9=_[_0x46f5('0x41')]({},_0x5282a9,_0x1d4b81[_0x46f5('0x44')]);return db[_0x46f5('0x65')][_0x46f5('0x20')]({'where':_0x5282a9[_0x46f5('0x3e')]})[_0x46f5('0x27')](function(_0x53fd24){_0x249087[_0x46f5('0x20')]=_0x53fd24;if(_0x1d4b81['query'][_0x46f5('0x4d')]){_0x5282a9[_0x46f5('0x46')]=[{'all':!![]}];}return db[_0x46f5('0x65')][_0x46f5('0x47')](_0x5282a9);})[_0x46f5('0x27')](function(_0x3ea26e){_0x249087[_0x46f5('0x48')]=_0x3ea26e;return _0x249087;});}})['then'](respondWithFilteredResult(_0x508e17,_0x5282a9))[_0x46f5('0x49')](handleError(_0x508e17,null));};exports[_0x46f5('0x66')]=function(_0x3349f9,_0x49ac67,_0x2a7726){var _0x1b9907={};var _0x39b066={};var _0x37569b;var _0x2ac67f;return db[_0x46f5('0x45')][_0x46f5('0x5e')]({'where':{'id':_0x3349f9[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x49ac67,null))[_0x46f5('0x27')](function(_0x3e4a22){if(_0x3e4a22){_0x37569b=_0x3e4a22;_0x39b066[_0x46f5('0x35')]=_[_0x46f5('0x4c')](db['CmList'][_0x46f5('0x31')]);_0x39b066['query']=_[_0x46f5('0x4c')](_0x3349f9[_0x46f5('0x33')]);_0x39b066[_0x46f5('0x34')]=_['intersection'](_0x39b066['model'],_0x39b066[_0x46f5('0x33')]);_0x1b9907['attributes']=_[_0x46f5('0x37')](_0x39b066[_0x46f5('0x35')],qs[_0x46f5('0x38')](_0x3349f9[_0x46f5('0x33')]['fields']));_0x1b9907['attributes']=_0x1b9907[_0x46f5('0x36')]['length']?_0x1b9907[_0x46f5('0x36')]:_0x39b066[_0x46f5('0x35')];_0x1b9907[_0x46f5('0x3c')]=qs[_0x46f5('0x3d')](_0x3349f9[_0x46f5('0x33')]['sort']);_0x1b9907[_0x46f5('0x3e')]=qs[_0x46f5('0x34')](_[_0x46f5('0x3f')](_0x3349f9[_0x46f5('0x33')],_0x39b066[_0x46f5('0x34')]));if(_0x3349f9['query'][_0x46f5('0x40')]){_0x1b9907['where']=_['merge'](_0x1b9907['where'],{'$or':_[_0x46f5('0x30')](_0x1b9907['attributes'],function(_0x33d63b){var _0x10bd78={};_0x10bd78[_0x33d63b]={'$like':'%'+_0x3349f9['query'][_0x46f5('0x40')]+'%'};return _0x10bd78;})});}_0x1b9907=_[_0x46f5('0x41')]({},_0x1b9907,_0x3349f9['options']);return _0x37569b['getLists'](_0x1b9907);}})['then'](function(_0x1bfe4e){if(_0x1bfe4e){_0x2ac67f=_0x1bfe4e[_0x46f5('0x39')];if(!_0x3349f9['query'][_0x46f5('0x3a')]('nolimit')){_0x1b9907[_0x46f5('0x1f')]=qs['limit'](_0x3349f9[_0x46f5('0x33')][_0x46f5('0x1f')]);_0x1b9907['offset']=qs[_0x46f5('0x1d')](_0x3349f9[_0x46f5('0x33')][_0x46f5('0x1d')]);}return _0x37569b[_0x46f5('0x66')](_0x1b9907);}})[_0x46f5('0x27')](function(_0x1fa566){if(_0x1fa566){return _0x1fa566?{'count':_0x2ac67f,'rows':_0x1fa566}:null;}})['then'](respondWithResult(_0x49ac67,null))[_0x46f5('0x49')](handleError(_0x49ac67,null));};exports[_0x46f5('0x67')]=function(_0x59fcda,_0x4b8cc0,_0x5195a0){var _0x1fbd73,_0x474e7c;var _0x945063=[];var _0xb9c66c=moment()[_0x46f5('0x68')](_0x46f5('0x69'));return db['Campaign'][_0x46f5('0x4e')]({'where':{'id':_0x59fcda[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x4b8cc0,null))[_0x46f5('0x27')](function(_0x32ddb9){if(_0x32ddb9){_0x474e7c=_0x32ddb9;return _0x32ddb9['addLists'](_0x59fcda[_0x46f5('0x50')][_0x46f5('0x6a')],_[_0x46f5('0x57')](_0x59fcda['body'],[_0x46f5('0x6a'),'id'])||{});}return null;})[_0x46f5('0x6b')](function(_0x263dd7){var _0x17e43e;var _0x5ed8bf;_0x1fbd73=_0x263dd7||[];var _0x21cbb8=[];if(_0x263dd7){for(var _0x26199b=0x0;_0x26199b<_0x263dd7[_0x46f5('0x39')];_0x26199b+=0x1){var _0x529103=_0x263dd7[_0x26199b][_0x46f5('0x53')]({'plain':!![]});_0x474e7c['dialCheckDuplicateType']=_0x59fcda[_0x46f5('0x50')][_0x46f5('0x6c')]?_0x59fcda['body'][_0x46f5('0x6c')]:_0x474e7c['dialCheckDuplicateType'];switch(_0x474e7c[_0x46f5('0x6c')]){case _0x46f5('0x6d'):_0x17e43e=squel['insert']()[_0x46f5('0x6e')]('cm_hopper')['fromQuery']([_0x46f5('0x6f'),_0x46f5('0x70'),_0x46f5('0x71'),_0x46f5('0x72'),'CampaignId',_0x46f5('0x59'),'updatedAt'],squel[_0x46f5('0x73')]()[_0x46f5('0x74')](_0x46f5('0x6f'),_0x46f5('0x6f'))['field'](_0x46f5('0x75'),_0x46f5('0x70'))['field']('id','ContactId')[_0x46f5('0x74')](_0x529103[_0x46f5('0x76')][_0x46f5('0x77')](),_0x46f5('0x72'))[_0x46f5('0x74')](_0x59fcda[_0x46f5('0x4b')]['id'][_0x46f5('0x77')](),_0x46f5('0x60'))[_0x46f5('0x74')]('\x27'+_0xb9c66c+'\x27','createdAt')['field']('\x27'+_0xb9c66c+'\x27',_0x46f5('0x58'))['from'](_0x46f5('0x78'))[_0x46f5('0x3e')]('deletedAt\x20IS\x20NULL')[_0x46f5('0x3e')](_0x46f5('0x79'),_0x529103[_0x46f5('0x76')][_0x46f5('0x77')]())[_0x46f5('0x3e')](_0x46f5('0x7a'))['where'](_0x46f5('0x7b'),squel[_0x46f5('0x73')]()[_0x46f5('0x74')](_0x46f5('0x7c'))[_0x46f5('0x7d')](_0x46f5('0x7e'))[_0x46f5('0x3e')]('CampaignId\x20=\x20?',_0x59fcda[_0x46f5('0x4b')]['id'][_0x46f5('0x77')]()))[_0x46f5('0x3e')](_0x46f5('0x7b'),squel[_0x46f5('0x73')]()[_0x46f5('0x74')](_0x46f5('0x7f'))['from'](_0x46f5('0x80'))[_0x46f5('0x3e')](_0x46f5('0x81'),_0x59fcda[_0x46f5('0x4b')]['id'][_0x46f5('0x77')]())))[_0x46f5('0x77')]();break;case _0x46f5('0x82'):_0x17e43e=squel['insert']()[_0x46f5('0x6e')]('cm_hopper')[_0x46f5('0x83')](['phone',_0x46f5('0x70'),_0x46f5('0x71'),_0x46f5('0x72'),_0x46f5('0x60'),_0x46f5('0x59'),'updatedAt'],squel[_0x46f5('0x73')]()['field'](_0x46f5('0x6f'),_0x46f5('0x6f'))['field'](_0x46f5('0x75'),_0x46f5('0x70'))[_0x46f5('0x74')]('id',_0x46f5('0x71'))[_0x46f5('0x74')](_0x529103[_0x46f5('0x76')][_0x46f5('0x77')](),_0x46f5('0x72'))[_0x46f5('0x74')](_0x59fcda[_0x46f5('0x4b')]['id'][_0x46f5('0x77')](),_0x46f5('0x60'))['field']('\x27'+_0xb9c66c+'\x27',_0x46f5('0x59'))['field']('\x27'+_0xb9c66c+'\x27','updatedAt')[_0x46f5('0x7d')](_0x46f5('0x78'))[_0x46f5('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0x46f5('0x79'),_0x529103[_0x46f5('0x76')][_0x46f5('0x77')]())[_0x46f5('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x46f5('0x3e')](_0x46f5('0x7b'),squel[_0x46f5('0x73')]()['field'](_0x46f5('0x7f'))['from'](_0x46f5('0x80'))[_0x46f5('0x3e')]('CampaignId\x20=\x20?',_0x59fcda[_0x46f5('0x4b')]['id']['toString']())))['toString']();break;default:_0x17e43e=squel[_0x46f5('0x84')]()[_0x46f5('0x6e')](_0x46f5('0x80'))[_0x46f5('0x83')]([_0x46f5('0x6f'),_0x46f5('0x70'),_0x46f5('0x71'),_0x46f5('0x72'),_0x46f5('0x60'),_0x46f5('0x59'),'updatedAt'],squel[_0x46f5('0x73')]()[_0x46f5('0x74')](_0x46f5('0x6f'),_0x46f5('0x6f'))[_0x46f5('0x74')](_0x46f5('0x75'),'scheduledAt')[_0x46f5('0x74')]('id','ContactId')[_0x46f5('0x74')](_0x529103[_0x46f5('0x76')][_0x46f5('0x77')](),_0x46f5('0x72'))[_0x46f5('0x74')](_0x59fcda[_0x46f5('0x4b')]['id']['toString'](),'CampaignId')[_0x46f5('0x74')]('\x27'+_0xb9c66c+'\x27',_0x46f5('0x59'))[_0x46f5('0x74')]('\x27'+_0xb9c66c+'\x27','updatedAt')['from'](_0x46f5('0x78'))['where']('deletedAt\x20IS\x20NULL')[_0x46f5('0x3e')]('ListId\x20=\x20?',_0x529103[_0x46f5('0x76')][_0x46f5('0x77')]())[_0x46f5('0x3e')](_0x46f5('0x7a')))[_0x46f5('0x77')]();}_0x5ed8bf=squel[_0x46f5('0x84')]()[_0x46f5('0x6e')](_0x46f5('0x85'))[_0x46f5('0x83')]([_0x46f5('0x86'),_0x46f5('0x70'),'phone',_0x46f5('0x87'),'createdAt',_0x46f5('0x58')],squel[_0x46f5('0x73')]()[_0x46f5('0x74')](_0x46f5('0x88'),'id')[_0x46f5('0x74')](_0x46f5('0x75'),_0x46f5('0x70'))[_0x46f5('0x74')](_0x46f5('0x89'),_0x46f5('0x6f'))['field'](_0x46f5('0x8a'),_0x46f5('0x87'))[_0x46f5('0x74')]('\x27'+_0xb9c66c+'\x27','createdAt')[_0x46f5('0x74')]('\x27'+_0xb9c66c+'\x27',_0x46f5('0x58'))['from'](_0x46f5('0x8b'),'ci')[_0x46f5('0x8c')]('cm_hopper','h',_0x46f5('0x8d'))[_0x46f5('0x3e')](_0x46f5('0x8e'),_0x529103[_0x46f5('0x76')]['toString']())['where'](_0x46f5('0x8f'),_0x59fcda[_0x46f5('0x4b')]['id'][_0x46f5('0x77')]())[_0x46f5('0x3e')](_0x46f5('0x90'),_0xb9c66c))['toString']();_0x21cbb8[_0x46f5('0x91')](db['sequelize'][_0x46f5('0x33')](_0x17e43e));_0x945063[_0x46f5('0x91')](db[_0x46f5('0x92')]['query'](_0x5ed8bf));}return BPromise['all'](_0x21cbb8);}})[_0x46f5('0x27')](function(){return BPromise[_0x46f5('0x93')](_0x945063);})[_0x46f5('0x27')](function(){return _0x1fbd73;})['then'](respondWithResult(_0x4b8cc0,null))[_0x46f5('0x49')](handleError(_0x4b8cc0,null));};exports[_0x46f5('0x94')]=function(_0xeb05d8,_0x3eb947,_0xa132e){return db[_0x46f5('0x45')][_0x46f5('0x4e')]({'where':{'id':_0xeb05d8['params']['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x3eb947,null))['then'](function(_0x4ef723){if(_0x4ef723){return _0x4ef723[_0x46f5('0x94')](_0xeb05d8['query'][_0x46f5('0x6a')]);}})['then'](function(_0x415861){if(_0x415861){return db[_0x46f5('0x5f')]['destroy']({'where':{'ListId':_0xeb05d8[_0x46f5('0x33')][_0x46f5('0x6a')],'CampaignId':_0xeb05d8['params']['id']}})['then'](function(){return _0x415861;});}})[_0x46f5('0x27')](respondWithStatusCode(_0x3eb947,null))[_0x46f5('0x49')](handleError(_0x3eb947,null));};exports['getBlackLists']=function(_0x4fbc97,_0x345a93,_0x2109e4){var _0xd0aa3f={};var _0x562f6c={};var _0x4fb5dd;var _0x402313;return db[_0x46f5('0x45')][_0x46f5('0x5e')]({'where':{'id':_0x4fbc97[_0x46f5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x345a93,null))[_0x46f5('0x27')](function(_0x3e8951){if(_0x3e8951){_0x4fb5dd=_0x3e8951;_0x562f6c[_0x46f5('0x35')]=_[_0x46f5('0x4c')](db['CmList'][_0x46f5('0x31')]);_0x562f6c[_0x46f5('0x33')]=_['keys'](_0x4fbc97[_0x46f5('0x33')]);_0x562f6c[_0x46f5('0x34')]=_[_0x46f5('0x37')](_0x562f6c['model'],_0x562f6c['query']);_0xd0aa3f[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x562f6c['model'],qs[_0x46f5('0x38')](_0x4fbc97['query'][_0x46f5('0x38')]));_0xd0aa3f['attributes']=_0xd0aa3f['attributes'][_0x46f5('0x39')]?_0xd0aa3f[_0x46f5('0x36')]:_0x562f6c[_0x46f5('0x35')];_0xd0aa3f[_0x46f5('0x3c')]=qs[_0x46f5('0x3d')](_0x4fbc97[_0x46f5('0x33')][_0x46f5('0x3d')]);_0xd0aa3f[_0x46f5('0x3e')]=qs[_0x46f5('0x34')](_['pick'](_0x4fbc97[_0x46f5('0x33')],_0x562f6c[_0x46f5('0x34')]));if(_0x4fbc97['query'][_0x46f5('0x40')]){_0xd0aa3f[_0x46f5('0x3e')]=_[_0x46f5('0x41')](_0xd0aa3f[_0x46f5('0x3e')],{'$or':_['map'](_0xd0aa3f[_0x46f5('0x36')],function(_0x59fb14){var _0x2da486={};_0x2da486[_0x59fb14]={'$like':'%'+_0x4fbc97[_0x46f5('0x33')][_0x46f5('0x40')]+'%'};return _0x2da486;})});}_0xd0aa3f=_['merge']({},_0xd0aa3f,_0x4fbc97[_0x46f5('0x44')]);return _0x4fb5dd[_0x46f5('0x95')](_0xd0aa3f);}})['then'](function(_0x25025e){if(_0x25025e){_0x402313=_0x25025e[_0x46f5('0x39')];if(!_0x4fbc97[_0x46f5('0x33')]['hasOwnProperty'](_0x46f5('0x3b'))){_0xd0aa3f[_0x46f5('0x1f')]=qs[_0x46f5('0x1f')](_0x4fbc97[_0x46f5('0x33')]['limit']);_0xd0aa3f['offset']=qs[_0x46f5('0x1d')](_0x4fbc97[_0x46f5('0x33')][_0x46f5('0x1d')]);}return _0x4fb5dd[_0x46f5('0x95')](_0xd0aa3f);}})[_0x46f5('0x27')](function(_0x422bc6){if(_0x422bc6){return _0x422bc6?{'count':_0x402313,'rows':_0x422bc6}:null;}})['then'](respondWithResult(_0x345a93,null))[_0x46f5('0x49')](handleError(_0x345a93,null));};exports[_0x46f5('0x96')]=function(_0x1cefa2,_0x10c9b7,_0x4b173a){var _0xe50fd4,_0x4e36fc;var _0x3be685=[];var _0x593068=moment()[_0x46f5('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x46f5('0x45')]['find']({'where':{'id':_0x1cefa2['params']['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x10c9b7,null))[_0x46f5('0x27')](function(_0x4be102){if(_0x4be102){_0x4e36fc=_0x4be102;return _0x4be102[_0x46f5('0x96')](_0x1cefa2[_0x46f5('0x50')][_0x46f5('0x6a')],_[_0x46f5('0x57')](_0x1cefa2[_0x46f5('0x50')],[_0x46f5('0x6a'),'id'])||{});}return null;})[_0x46f5('0x6b')](function(_0x6594d0){var _0x5f8174;var _0x471a65;_0xe50fd4=_0x6594d0||[];var _0x411f5a=[];if(_0x6594d0){for(var _0x773bc7=0x0;_0x773bc7<_0x6594d0[_0x46f5('0x39')];_0x773bc7+=0x1){var _0x5e0df5=_0x6594d0[_0x773bc7][_0x46f5('0x53')]({'plain':!![]});_0x5f8174=squel['insert']()['into'](_0x46f5('0x97'))[_0x46f5('0x83')]([_0x46f5('0x6f'),_0x46f5('0x71'),_0x46f5('0x72'),_0x46f5('0x60'),_0x46f5('0x59'),_0x46f5('0x58')],squel[_0x46f5('0x73')]()[_0x46f5('0x74')]('phone',_0x46f5('0x6f'))[_0x46f5('0x74')]('id',_0x46f5('0x71'))[_0x46f5('0x74')](_0x5e0df5[_0x46f5('0x76')][_0x46f5('0x77')](),_0x46f5('0x72'))['field'](_0x1cefa2[_0x46f5('0x4b')]['id'][_0x46f5('0x77')](),_0x46f5('0x60'))[_0x46f5('0x74')](_0x46f5('0x75'),_0x46f5('0x59'))[_0x46f5('0x74')](_0x46f5('0x75'),'updatedAt')[_0x46f5('0x7d')]('cm_contacts')[_0x46f5('0x3e')](_0x46f5('0x98'))['where'](_0x46f5('0x79'),_0x5e0df5[_0x46f5('0x76')][_0x46f5('0x77')]())[_0x46f5('0x3e')](_0x46f5('0x7a')))[_0x46f5('0x77')]();_0x411f5a[_0x46f5('0x91')](db[_0x46f5('0x92')][_0x46f5('0x33')](_0x5f8174));}return BPromise['all'](_0x411f5a);}})[_0x46f5('0x27')](function(){return _0xe50fd4;})['then'](respondWithResult(_0x10c9b7,null))[_0x46f5('0x49')](handleError(_0x10c9b7,null));};exports[_0x46f5('0x99')]=function(_0x4b71e8,_0x1b5de7,_0x12f95d){return db[_0x46f5('0x45')][_0x46f5('0x4e')]({'where':{'id':_0x4b71e8[_0x46f5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1b5de7,null))[_0x46f5('0x27')](function(_0x4be6ab){if(_0x4be6ab){return _0x4be6ab[_0x46f5('0x99')](_0x4b71e8[_0x46f5('0x33')]['ids']);}})[_0x46f5('0x27')](function(_0x1e67e6){if(_0x1e67e6){return db['CmHopperBlack'][_0x46f5('0x2a')]({'where':{'ListId':_0x4b71e8[_0x46f5('0x33')][_0x46f5('0x6a')],'CampaignId':_0x4b71e8[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](function(){return _0x1e67e6;});}})[_0x46f5('0x27')](respondWithStatusCode(_0x1b5de7,null))['catch'](handleError(_0x1b5de7,null));}; \ No newline at end of file +var _0x53aa=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','params','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','fromQuery','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','phone','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','cm_hopper','insert','cm_hopper_additional_phones','cmHopperId','ci.OrderBY','OrderBy','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','get','IvrCampaigns','UserProfileResource','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','Campaign','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error'];(function(_0x515472,_0x525e8c){var _0x2583d5=function(_0x51b54b){while(--_0x51b54b){_0x515472['push'](_0x515472['shift']());}};_0x2583d5(++_0x525e8c);}(_0x53aa,0x167));var _0xa53a=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x53aa[_0x29d915];return _0x160f86;};'use strict';var emlformat=require(_0xa53a('0x0'));var rimraf=require(_0xa53a('0x1'));var zipdir=require(_0xa53a('0x2'));var jsonpatch=require(_0xa53a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa53a('0x4'));var Mustache=require('mustache');var util=require(_0xa53a('0x5'));var path=require(_0xa53a('0x6'));var sox=require(_0xa53a('0x7'));var csv=require(_0xa53a('0x8'));var ejs=require(_0xa53a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa53a('0xa'));var squel=require(_0xa53a('0xb'));var crypto=require('crypto');var jsforce=require(_0xa53a('0xc'));var deskjs=require(_0xa53a('0xd'));var toCsv=require(_0xa53a('0x8'));var querystring=require('querystring');var Papa=require(_0xa53a('0xe'));var Redis=require('ioredis');var authService=require(_0xa53a('0xf'));var qs=require(_0xa53a('0x10'));var as=require(_0xa53a('0x11'));var hardwareService=require(_0xa53a('0x12'));var logger=require(_0xa53a('0x13'))(_0xa53a('0x14'));var utils=require(_0xa53a('0x15'));var config=require(_0xa53a('0x16'));var licenseUtil=require(_0xa53a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x448fcb,_0x52cb14){_0x52cb14=_0x52cb14||0xcc;return function(_0x3d5a63){if(_0x3d5a63){return _0x448fcb[_0xa53a('0x18')](_0x52cb14);}return _0x448fcb[_0xa53a('0x19')](_0x52cb14)[_0xa53a('0x1a')]();};}function respondWithResult(_0x252c59,_0x333cdc){_0x333cdc=_0x333cdc||0xc8;return function(_0xebb4b7){if(_0xebb4b7){return _0x252c59[_0xa53a('0x19')](_0x333cdc)[_0xa53a('0x1b')](_0xebb4b7);}};}function respondWithFilteredResult(_0x1ce266,_0x2d1f21){return function(_0x427d66){if(_0x427d66){var _0x5c5a14=typeof _0x2d1f21[_0xa53a('0x1c')]===_0xa53a('0x1d')&&typeof _0x2d1f21['limit']===_0xa53a('0x1d');var _0x3f3869=_0x427d66[_0xa53a('0x1e')];var _0xf61650=_0x5c5a14?0x0:_0x2d1f21[_0xa53a('0x1c')];var _0x379a0b=_0x5c5a14?_0x427d66[_0xa53a('0x1e')]:_0x2d1f21[_0xa53a('0x1c')]+_0x2d1f21[_0xa53a('0x1f')];var _0x1e1401;if(_0x379a0b>=_0x3f3869){_0x379a0b=_0x3f3869;_0x1e1401=0xc8;}else{_0x1e1401=0xce;}_0x1ce266[_0xa53a('0x19')](_0x1e1401);return _0x1ce266[_0xa53a('0x20')](_0xa53a('0x21'),_0xf61650+'-'+_0x379a0b+'/'+_0x3f3869)[_0xa53a('0x1b')](_0x427d66);}return null;};}function patchUpdates(_0x584c4e){return function(_0x4527c8){try{jsonpatch[_0xa53a('0x22')](_0x4527c8,_0x584c4e,!![]);}catch(_0x478ff2){return BPromise[_0xa53a('0x23')](_0x478ff2);}return _0x4527c8['save']();};}function saveUpdates(_0x1a2a2a,_0x352f91){return function(_0xc5fe37){if(_0xc5fe37){return _0xc5fe37[_0xa53a('0x24')](_0x1a2a2a)[_0xa53a('0x25')](function(_0x324a24){return _0x324a24;});}return null;};}function removeEntity(_0x5cdb5c,_0x138a10){return function(_0x2cc210){if(_0x2cc210){return _0x2cc210['destroy']()[_0xa53a('0x25')](function(){var _0x3878e0=_0x2cc210[_0xa53a('0x26')]({'plain':!![]});var _0x1d9466=_0xa53a('0x27');return db[_0xa53a('0x28')][_0xa53a('0x29')]({'where':{'type':_0x1d9466,'resourceId':_0x3878e0['id']}})['then'](function(){return _0x2cc210;});})['then'](function(){_0x5cdb5c[_0xa53a('0x19')](0xcc)[_0xa53a('0x1a')]();});}};}function handleEntityNotFound(_0x512d96,_0x3d11a2){return function(_0xe10903){if(!_0xe10903){_0x512d96[_0xa53a('0x18')](0x194);}return _0xe10903;};}function handleError(_0x33565a,_0x2ffcb6){_0x2ffcb6=_0x2ffcb6||0x1f4;return function(_0x1e796b){logger['error'](_0x1e796b[_0xa53a('0x2a')]);if(_0x1e796b[_0xa53a('0x2b')]){delete _0x1e796b[_0xa53a('0x2b')];}_0x33565a['status'](_0x2ffcb6)['send'](_0x1e796b);};}exports[_0xa53a('0x2c')]=function(_0x37ef40,_0x1bb99d){var _0x4bd9b9={},_0x2d78eb={},_0xd60689={'count':0x0,'rows':[]};var _0x7e6177=_[_0xa53a('0x2d')](db['Campaign']['rawAttributes'],function(_0x2b7024){return{'name':_0x2b7024[_0xa53a('0x2e')],'type':_0x2b7024[_0xa53a('0x2f')][_0xa53a('0x30')]};});_0x2d78eb[_0xa53a('0x31')]=_[_0xa53a('0x2d')](_0x7e6177,_0xa53a('0x2b'));_0x2d78eb[_0xa53a('0x32')]=_[_0xa53a('0x33')](_0x37ef40['query']);_0x2d78eb[_0xa53a('0x34')]=_['intersection'](_0x2d78eb[_0xa53a('0x31')],_0x2d78eb[_0xa53a('0x32')]);_0x4bd9b9[_0xa53a('0x35')]=_[_0xa53a('0x36')](_0x2d78eb[_0xa53a('0x31')],qs[_0xa53a('0x37')](_0x37ef40[_0xa53a('0x32')][_0xa53a('0x37')]));_0x4bd9b9[_0xa53a('0x35')]=_0x4bd9b9['attributes'][_0xa53a('0x38')]?_0x4bd9b9['attributes']:_0x2d78eb['model'];if(!_0x37ef40[_0xa53a('0x32')][_0xa53a('0x39')](_0xa53a('0x3a'))){_0x4bd9b9['limit']=qs[_0xa53a('0x1f')](_0x37ef40['query'][_0xa53a('0x1f')]);_0x4bd9b9[_0xa53a('0x1c')]=qs['offset'](_0x37ef40[_0xa53a('0x32')][_0xa53a('0x1c')]);}_0x4bd9b9[_0xa53a('0x3b')]=qs['sort'](_0x37ef40[_0xa53a('0x32')][_0xa53a('0x3c')]);_0x4bd9b9['where']=qs[_0xa53a('0x34')](_[_0xa53a('0x3d')](_0x37ef40[_0xa53a('0x32')],_0x2d78eb[_0xa53a('0x34')]),_0x7e6177);if(_0x37ef40[_0xa53a('0x32')]['filter']){_0x4bd9b9[_0xa53a('0x3e')]=_[_0xa53a('0x3f')](_0x4bd9b9['where'],{'$or':_[_0xa53a('0x2d')](_0x7e6177,function(_0x11e623){if(_0x11e623[_0xa53a('0x2f')]!==_0xa53a('0x40')){var _0x4602b5={};_0x4602b5[_0x11e623[_0xa53a('0x2b')]]={'$like':'%'+_0x37ef40[_0xa53a('0x32')][_0xa53a('0x41')]+'%'};return _0x4602b5;}})});}_0x4bd9b9=_[_0xa53a('0x3f')]({},_0x4bd9b9,_0x37ef40[_0xa53a('0x42')]);var _0x50fd89={'where':_0x4bd9b9[_0xa53a('0x3e')]};return db['Campaign'][_0xa53a('0x1e')](_0x50fd89)[_0xa53a('0x25')](function(_0x4a9d5d){_0xd60689[_0xa53a('0x1e')]=_0x4a9d5d;if(_0x37ef40[_0xa53a('0x32')][_0xa53a('0x43')]){_0x4bd9b9[_0xa53a('0x44')]=[{'all':!![]}];}return db[_0xa53a('0x45')][_0xa53a('0x46')](_0x4bd9b9);})[_0xa53a('0x25')](function(_0x3fc9ea){_0xd60689[_0xa53a('0x47')]=_0x3fc9ea;return _0xd60689;})[_0xa53a('0x25')](respondWithFilteredResult(_0x1bb99d,_0x4bd9b9))[_0xa53a('0x48')](handleError(_0x1bb99d,null));};exports[_0xa53a('0x49')]=function(_0x4f5178,_0x1e4536){var _0x55ded6={'raw':![],'where':{'id':_0x4f5178['params']['id']}},_0x1dd82b={};_0x1dd82b[_0xa53a('0x31')]=_[_0xa53a('0x33')](db[_0xa53a('0x45')][_0xa53a('0x4a')]);_0x1dd82b[_0xa53a('0x32')]=_[_0xa53a('0x33')](_0x4f5178[_0xa53a('0x32')]);_0x1dd82b[_0xa53a('0x34')]=_[_0xa53a('0x36')](_0x1dd82b[_0xa53a('0x31')],_0x1dd82b[_0xa53a('0x32')]);_0x55ded6[_0xa53a('0x35')]=_[_0xa53a('0x36')](_0x1dd82b[_0xa53a('0x31')],qs[_0xa53a('0x37')](_0x4f5178['query']['fields']));_0x55ded6[_0xa53a('0x35')]=_0x55ded6[_0xa53a('0x35')][_0xa53a('0x38')]?_0x55ded6[_0xa53a('0x35')]:_0x1dd82b[_0xa53a('0x31')];if(_0x4f5178[_0xa53a('0x32')][_0xa53a('0x43')]){_0x55ded6[_0xa53a('0x44')]=[{'all':!![]}];}_0x55ded6=_[_0xa53a('0x3f')]({},_0x55ded6,_0x4f5178['options']);return db[_0xa53a('0x45')][_0xa53a('0x4b')](_0x55ded6)[_0xa53a('0x25')](handleEntityNotFound(_0x1e4536,null))[_0xa53a('0x25')](respondWithResult(_0x1e4536,null))[_0xa53a('0x48')](handleError(_0x1e4536,null));};exports['create']=function(_0xd16651,_0xec389b){return db[_0xa53a('0x45')][_0xa53a('0x4c')](_0xd16651[_0xa53a('0x4d')],{})[_0xa53a('0x25')](function(_0x30e30f){var _0x10b86b=_0xd16651[_0xa53a('0x4e')][_0xa53a('0x26')]({'plain':!![]});if(!_0x10b86b)throw new Error(_0xa53a('0x4f'));if(_0x10b86b[_0xa53a('0x50')]===_0xa53a('0x4e')){var _0x515f62=_0x30e30f[_0xa53a('0x26')]({'plain':!![]});var _0x5380bb=_0xa53a('0x27');return db[_0xa53a('0x51')]['find']({'where':{'name':_0x5380bb,'userProfileId':_0x10b86b[_0xa53a('0x52')]},'raw':!![]})[_0xa53a('0x25')](function(_0x13acaf){if(_0x13acaf&&_0x13acaf[_0xa53a('0x53')]===0x0){return db[_0xa53a('0x28')][_0xa53a('0x4c')]({'name':_0x515f62[_0xa53a('0x2b')],'resourceId':_0x515f62['id'],'type':_0x13acaf[_0xa53a('0x2b')],'sectionId':_0x13acaf['id']},{})[_0xa53a('0x25')](function(){return _0x30e30f;});}else{return _0x30e30f;}})['catch'](function(_0x56a4ef){logger[_0xa53a('0x54')](_0xa53a('0x55'),_0x56a4ef);throw _0x56a4ef;});}return _0x30e30f;})[_0xa53a('0x25')](respondWithResult(_0xec389b,0xc9))['catch'](handleError(_0xec389b,null));};exports[_0xa53a('0x56')]=function(_0x1a9449,_0x36b9c){var _0x2416f3={'where':{'id':_0x1a9449['params']['id']}},_0x5709e9={};_0x5709e9[_0xa53a('0x31')]=_[_0xa53a('0x33')](db[_0xa53a('0x45')][_0xa53a('0x4a')]);_0x2416f3[_0xa53a('0x35')]=_[_0xa53a('0x36')](_0x5709e9[_0xa53a('0x31')],qs[_0xa53a('0x37')](_0x1a9449[_0xa53a('0x32')][_0xa53a('0x37')]));_0x2416f3['attributes']=_0x2416f3[_0xa53a('0x35')]['length']?_0x2416f3['attributes']:_0x5709e9[_0xa53a('0x31')];if(_0x1a9449[_0xa53a('0x32')][_0xa53a('0x43')]){_0x2416f3['include']=[{'all':!![]}];}_0x2416f3=_[_0xa53a('0x3f')]({},_0x2416f3,_0x1a9449[_0xa53a('0x42')]);return db['Campaign'][_0xa53a('0x4b')](_0x2416f3)[_0xa53a('0x25')](handleEntityNotFound(_0x36b9c,null))[_0xa53a('0x25')](function(_0x4fbe3b){if(_0x4fbe3b){var _0x75f0e0=_0x4fbe3b[_0xa53a('0x26')]({'plain':!![]});_0x75f0e0=qs[_0xa53a('0x57')](_0x75f0e0,['id',_0xa53a('0x58'),_0xa53a('0x59')]);_0x1a9449['body']=_['omit'](_0x1a9449['body'],['id','createdAt','updatedAt']);return db[_0xa53a('0x45')][_0xa53a('0x4c')](_[_0xa53a('0x3f')](_0x75f0e0,_0x1a9449['body']),{'include':_0x1a9449[_0xa53a('0x32')][_0xa53a('0x43')]?[{'all':!![]}]:undefined})[_0xa53a('0x25')](function(_0x5556da){var _0x306891=_0x1a9449['user']['get']({'plain':!![]});if(!_0x306891)throw new Error(_0xa53a('0x4f'));if(_0x306891['role']===_0xa53a('0x4e')){var _0xfa9984=_0x5556da[_0xa53a('0x26')]({'plain':!![]});var _0x35c243=_0xa53a('0x27');return db[_0xa53a('0x51')]['find']({'where':{'name':_0x35c243,'userProfileId':_0x306891[_0xa53a('0x52')]},'raw':!![]})[_0xa53a('0x25')](function(_0x1439a4){if(_0x1439a4&&_0x1439a4['autoAssociation']===0x0){return db[_0xa53a('0x28')][_0xa53a('0x4c')]({'name':_0xfa9984[_0xa53a('0x2b')],'resourceId':_0xfa9984['id'],'type':_0x1439a4[_0xa53a('0x2b')],'sectionId':_0x1439a4['id']},{})[_0xa53a('0x25')](function(){return _0x5556da;});}else{return _0x5556da;}})[_0xa53a('0x48')](function(_0x5bd848){logger[_0xa53a('0x54')](_0xa53a('0x55'),_0x5bd848);throw _0x5bd848;});}return _0x5556da;});}})['then'](respondWithResult(_0x36b9c,0xc9))[_0xa53a('0x48')](handleError(_0x36b9c,null));};exports[_0xa53a('0x24')]=function(_0x530ca8,_0x4c7f47){if(_0x530ca8['body']['id']){delete _0x530ca8[_0xa53a('0x4d')]['id'];}return db[_0xa53a('0x45')][_0xa53a('0x4b')]({'where':{'id':_0x530ca8[_0xa53a('0x5a')]['id']}})[_0xa53a('0x25')](handleEntityNotFound(_0x4c7f47,null))['then'](saveUpdates(_0x530ca8[_0xa53a('0x4d')],null))[_0xa53a('0x25')](respondWithResult(_0x4c7f47,null))[_0xa53a('0x48')](handleError(_0x4c7f47,null));};exports[_0xa53a('0x29')]=function(_0x16ac88,_0x240a25){return db[_0xa53a('0x45')][_0xa53a('0x4b')]({'where':{'id':_0x16ac88[_0xa53a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x240a25,null))['then'](removeEntity(_0x240a25,null))['catch'](handleError(_0x240a25,null));};exports[_0xa53a('0x5b')]=function(_0x25044f,_0x11f1c3,_0x3f16df){var _0x17f983={'raw':!![],'where':{}};var _0x229f8c={};var _0x4143f2={'count':0x0,'rows':[]};return db[_0xa53a('0x45')][_0xa53a('0x5c')]({'where':{'id':_0x25044f[_0xa53a('0x5a')]['id']}})[_0xa53a('0x25')](handleEntityNotFound(_0x11f1c3,null))[_0xa53a('0x25')](function(_0x363ae1){if(_0x363ae1){_0x229f8c['model']=_[_0xa53a('0x33')](db[_0xa53a('0x5d')][_0xa53a('0x4a')]);_0x229f8c[_0xa53a('0x32')]=_[_0xa53a('0x33')](_0x25044f[_0xa53a('0x32')]);_0x229f8c[_0xa53a('0x34')]=_[_0xa53a('0x36')](_0x229f8c['model'],_0x229f8c['query']);_0x17f983[_0xa53a('0x35')]=_[_0xa53a('0x36')](_0x229f8c['model'],qs['fields'](_0x25044f[_0xa53a('0x32')][_0xa53a('0x37')]));_0x17f983[_0xa53a('0x35')]=_0x17f983[_0xa53a('0x35')]['length']?_0x17f983[_0xa53a('0x35')]:_0x229f8c[_0xa53a('0x31')];if(!_0x25044f[_0xa53a('0x32')][_0xa53a('0x39')](_0xa53a('0x3a'))){_0x17f983[_0xa53a('0x1f')]=qs[_0xa53a('0x1f')](_0x25044f[_0xa53a('0x32')][_0xa53a('0x1f')]);_0x17f983[_0xa53a('0x1c')]=qs[_0xa53a('0x1c')](_0x25044f[_0xa53a('0x32')][_0xa53a('0x1c')]);}_0x17f983[_0xa53a('0x3b')]=qs[_0xa53a('0x3c')](_0x25044f[_0xa53a('0x32')][_0xa53a('0x3c')]);_0x17f983[_0xa53a('0x3e')]=qs[_0xa53a('0x34')](_['pick'](_0x25044f[_0xa53a('0x32')],_0x229f8c[_0xa53a('0x34')]));_0x17f983[_0xa53a('0x3e')][_0xa53a('0x5e')]=_0x363ae1['id'];if(_0x25044f[_0xa53a('0x32')]['filter']){_0x17f983[_0xa53a('0x3e')]=_[_0xa53a('0x3f')](_0x17f983['where'],{'$or':_[_0xa53a('0x2d')](_0x17f983[_0xa53a('0x35')],function(_0x3a7675){var _0x15976a={};_0x15976a[_0x3a7675]={'$like':'%'+_0x25044f['query'][_0xa53a('0x41')]+'%'};return _0x15976a;})});}_0x17f983=_[_0xa53a('0x3f')]({},_0x17f983,_0x25044f[_0xa53a('0x42')]);return db['CmHopper']['count']({'where':_0x17f983[_0xa53a('0x3e')]})[_0xa53a('0x25')](function(_0x343235){_0x4143f2['count']=_0x343235;if(_0x25044f[_0xa53a('0x32')][_0xa53a('0x43')]){_0x17f983[_0xa53a('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0xa53a('0x46')](_0x17f983);})[_0xa53a('0x25')](function(_0x5da9ce){_0x4143f2[_0xa53a('0x47')]=_0x5da9ce;return _0x4143f2;});}})[_0xa53a('0x25')](respondWithFilteredResult(_0x11f1c3,_0x17f983))['catch'](handleError(_0x11f1c3,null));};exports[_0xa53a('0x5f')]=function(_0x27decf,_0xdec0eb,_0x77779){var _0x208d92={'raw':!![],'where':{}};var _0x324446={};var _0x916b0a={'count':0x0,'rows':[]};return db[_0xa53a('0x45')][_0xa53a('0x5c')]({'where':{'id':_0x27decf[_0xa53a('0x5a')]['id']}})[_0xa53a('0x25')](handleEntityNotFound(_0xdec0eb,null))[_0xa53a('0x25')](function(_0x2a3227){if(_0x2a3227){_0x324446[_0xa53a('0x31')]=_[_0xa53a('0x33')](db[_0xa53a('0x60')][_0xa53a('0x4a')]);_0x324446[_0xa53a('0x32')]=_[_0xa53a('0x33')](_0x27decf['query']);_0x324446['filters']=_[_0xa53a('0x36')](_0x324446['model'],_0x324446[_0xa53a('0x32')]);_0x208d92[_0xa53a('0x35')]=_[_0xa53a('0x36')](_0x324446[_0xa53a('0x31')],qs[_0xa53a('0x37')](_0x27decf[_0xa53a('0x32')]['fields']));_0x208d92[_0xa53a('0x35')]=_0x208d92['attributes'][_0xa53a('0x38')]?_0x208d92[_0xa53a('0x35')]:_0x324446[_0xa53a('0x31')];if(!_0x27decf[_0xa53a('0x32')][_0xa53a('0x39')]('nolimit')){_0x208d92[_0xa53a('0x1f')]=qs[_0xa53a('0x1f')](_0x27decf[_0xa53a('0x32')]['limit']);_0x208d92[_0xa53a('0x1c')]=qs[_0xa53a('0x1c')](_0x27decf[_0xa53a('0x32')][_0xa53a('0x1c')]);}_0x208d92[_0xa53a('0x3b')]=qs[_0xa53a('0x3c')](_0x27decf[_0xa53a('0x32')]['sort']);_0x208d92[_0xa53a('0x3e')]=qs['filters'](_[_0xa53a('0x3d')](_0x27decf[_0xa53a('0x32')],_0x324446[_0xa53a('0x34')]));_0x208d92[_0xa53a('0x3e')]['CampaignId']=_0x2a3227['id'];if(_0x27decf[_0xa53a('0x32')][_0xa53a('0x41')]){_0x208d92[_0xa53a('0x3e')]=_['merge'](_0x208d92['where'],{'$or':_['map'](_0x208d92[_0xa53a('0x35')],function(_0x5004e8){var _0x31ec53={};_0x31ec53[_0x5004e8]={'$like':'%'+_0x27decf[_0xa53a('0x32')][_0xa53a('0x41')]+'%'};return _0x31ec53;})});}_0x208d92=_[_0xa53a('0x3f')]({},_0x208d92,_0x27decf[_0xa53a('0x42')]);return db[_0xa53a('0x60')][_0xa53a('0x1e')]({'where':_0x208d92[_0xa53a('0x3e')]})[_0xa53a('0x25')](function(_0x2335ea){_0x916b0a['count']=_0x2335ea;if(_0x27decf['query']['includeAll']){_0x208d92[_0xa53a('0x44')]=[{'all':!![]}];}return db[_0xa53a('0x60')][_0xa53a('0x46')](_0x208d92);})['then'](function(_0x439134){_0x916b0a[_0xa53a('0x47')]=_0x439134;return _0x916b0a;});}})[_0xa53a('0x25')](respondWithFilteredResult(_0xdec0eb,_0x208d92))[_0xa53a('0x48')](handleError(_0xdec0eb,null));};exports[_0xa53a('0x61')]=function(_0x2b1cb2,_0x131375,_0x17eddb){var _0xf317e7={'raw':!![],'where':{}};var _0x1c9cd3={};var _0x454358={'count':0x0,'rows':[]};return db['Campaign'][_0xa53a('0x5c')]({'where':{'id':_0x2b1cb2[_0xa53a('0x5a')]['id']}})[_0xa53a('0x25')](handleEntityNotFound(_0x131375,null))['then'](function(_0x34c13b){if(_0x34c13b){_0x1c9cd3[_0xa53a('0x31')]=_['keys'](db[_0xa53a('0x62')][_0xa53a('0x4a')]);_0x1c9cd3[_0xa53a('0x32')]=_[_0xa53a('0x33')](_0x2b1cb2[_0xa53a('0x32')]);_0x1c9cd3[_0xa53a('0x34')]=_[_0xa53a('0x36')](_0x1c9cd3['model'],_0x1c9cd3[_0xa53a('0x32')]);_0xf317e7[_0xa53a('0x35')]=_[_0xa53a('0x36')](_0x1c9cd3['model'],qs[_0xa53a('0x37')](_0x2b1cb2['query'][_0xa53a('0x37')]));_0xf317e7['attributes']=_0xf317e7[_0xa53a('0x35')][_0xa53a('0x38')]?_0xf317e7[_0xa53a('0x35')]:_0x1c9cd3[_0xa53a('0x31')];if(!_0x2b1cb2['query'][_0xa53a('0x39')]('nolimit')){_0xf317e7[_0xa53a('0x1f')]=qs['limit'](_0x2b1cb2[_0xa53a('0x32')]['limit']);_0xf317e7[_0xa53a('0x1c')]=qs[_0xa53a('0x1c')](_0x2b1cb2[_0xa53a('0x32')][_0xa53a('0x1c')]);}_0xf317e7[_0xa53a('0x3b')]=qs['sort'](_0x2b1cb2['query'][_0xa53a('0x3c')]);_0xf317e7['where']=qs[_0xa53a('0x34')](_[_0xa53a('0x3d')](_0x2b1cb2[_0xa53a('0x32')],_0x1c9cd3[_0xa53a('0x34')]));_0xf317e7[_0xa53a('0x3e')][_0xa53a('0x5e')]=_0x34c13b['id'];if(_0x2b1cb2['query'][_0xa53a('0x41')]){_0xf317e7[_0xa53a('0x3e')]=_[_0xa53a('0x3f')](_0xf317e7[_0xa53a('0x3e')],{'$or':_[_0xa53a('0x2d')](_0xf317e7['attributes'],function(_0x25e9c9){var _0x4e3b51={};_0x4e3b51[_0x25e9c9]={'$like':'%'+_0x2b1cb2[_0xa53a('0x32')][_0xa53a('0x41')]+'%'};return _0x4e3b51;})});}_0xf317e7=_['merge']({},_0xf317e7,_0x2b1cb2[_0xa53a('0x42')]);return db[_0xa53a('0x62')][_0xa53a('0x1e')]({'where':_0xf317e7[_0xa53a('0x3e')]})[_0xa53a('0x25')](function(_0x447fbb){_0x454358['count']=_0x447fbb;if(_0x2b1cb2[_0xa53a('0x32')][_0xa53a('0x43')]){_0xf317e7[_0xa53a('0x44')]=[{'all':!![]}];}return db[_0xa53a('0x62')]['findAll'](_0xf317e7);})[_0xa53a('0x25')](function(_0x17d295){_0x454358[_0xa53a('0x47')]=_0x17d295;return _0x454358;});}})[_0xa53a('0x25')](respondWithFilteredResult(_0x131375,_0xf317e7))['catch'](handleError(_0x131375,null));};exports[_0xa53a('0x63')]=function(_0x10fa08,_0x2de2e8,_0x16c3f4){var _0x3e0ce2={'raw':!![],'where':{}};var _0x941bad={};var _0x20871b={'count':0x0,'rows':[]};return db[_0xa53a('0x45')][_0xa53a('0x5c')]({'where':{'id':_0x10fa08[_0xa53a('0x5a')]['id']}})[_0xa53a('0x25')](handleEntityNotFound(_0x2de2e8,null))[_0xa53a('0x25')](function(_0x3151bb){if(_0x3151bb){_0x941bad[_0xa53a('0x31')]=_[_0xa53a('0x33')](db[_0xa53a('0x64')][_0xa53a('0x4a')]);_0x941bad[_0xa53a('0x32')]=_[_0xa53a('0x33')](_0x10fa08[_0xa53a('0x32')]);_0x941bad[_0xa53a('0x34')]=_[_0xa53a('0x36')](_0x941bad[_0xa53a('0x31')],_0x941bad[_0xa53a('0x32')]);_0x3e0ce2[_0xa53a('0x35')]=_[_0xa53a('0x36')](_0x941bad[_0xa53a('0x31')],qs[_0xa53a('0x37')](_0x10fa08['query']['fields']));_0x3e0ce2[_0xa53a('0x35')]=_0x3e0ce2['attributes'][_0xa53a('0x38')]?_0x3e0ce2['attributes']:_0x941bad[_0xa53a('0x31')];if(!_0x10fa08[_0xa53a('0x32')]['hasOwnProperty']('nolimit')){_0x3e0ce2[_0xa53a('0x1f')]=qs[_0xa53a('0x1f')](_0x10fa08['query'][_0xa53a('0x1f')]);_0x3e0ce2[_0xa53a('0x1c')]=qs['offset'](_0x10fa08[_0xa53a('0x32')][_0xa53a('0x1c')]);}_0x3e0ce2['order']=qs[_0xa53a('0x3c')](_0x10fa08[_0xa53a('0x32')]['sort']);_0x3e0ce2[_0xa53a('0x3e')]=qs[_0xa53a('0x34')](_['pick'](_0x10fa08[_0xa53a('0x32')],_0x941bad[_0xa53a('0x34')]));_0x3e0ce2['where'][_0xa53a('0x5e')]=_0x3151bb['id'];if(_0x10fa08[_0xa53a('0x32')]['filter']){_0x3e0ce2[_0xa53a('0x3e')]=_[_0xa53a('0x3f')](_0x3e0ce2[_0xa53a('0x3e')],{'$or':_[_0xa53a('0x2d')](_0x3e0ce2[_0xa53a('0x35')],function(_0x32eebf){var _0x4911eb={};_0x4911eb[_0x32eebf]={'$like':'%'+_0x10fa08[_0xa53a('0x32')][_0xa53a('0x41')]+'%'};return _0x4911eb;})});}_0x3e0ce2=_[_0xa53a('0x3f')]({},_0x3e0ce2,_0x10fa08[_0xa53a('0x42')]);return db[_0xa53a('0x64')]['count']({'where':_0x3e0ce2[_0xa53a('0x3e')]})['then'](function(_0x34e770){_0x20871b['count']=_0x34e770;if(_0x10fa08[_0xa53a('0x32')][_0xa53a('0x43')]){_0x3e0ce2[_0xa53a('0x44')]=[{'all':!![]}];}return db[_0xa53a('0x64')][_0xa53a('0x46')](_0x3e0ce2);})[_0xa53a('0x25')](function(_0x443530){_0x20871b[_0xa53a('0x47')]=_0x443530;return _0x20871b;});}})[_0xa53a('0x25')](respondWithFilteredResult(_0x2de2e8,_0x3e0ce2))[_0xa53a('0x48')](handleError(_0x2de2e8,null));};exports[_0xa53a('0x65')]=function(_0x588aaa,_0x211888,_0x1a41f2){var _0x17ba41={};var _0x192edf={};var _0x5727ed;var _0x21ca42;return db[_0xa53a('0x45')]['findOne']({'where':{'id':_0x588aaa[_0xa53a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x211888,null))[_0xa53a('0x25')](function(_0x279a2a){if(_0x279a2a){_0x5727ed=_0x279a2a;_0x192edf[_0xa53a('0x31')]=_[_0xa53a('0x33')](db[_0xa53a('0x66')]['rawAttributes']);_0x192edf[_0xa53a('0x32')]=_[_0xa53a('0x33')](_0x588aaa[_0xa53a('0x32')]);_0x192edf[_0xa53a('0x34')]=_[_0xa53a('0x36')](_0x192edf[_0xa53a('0x31')],_0x192edf['query']);_0x17ba41[_0xa53a('0x35')]=_[_0xa53a('0x36')](_0x192edf[_0xa53a('0x31')],qs['fields'](_0x588aaa[_0xa53a('0x32')][_0xa53a('0x37')]));_0x17ba41[_0xa53a('0x35')]=_0x17ba41[_0xa53a('0x35')][_0xa53a('0x38')]?_0x17ba41[_0xa53a('0x35')]:_0x192edf[_0xa53a('0x31')];_0x17ba41[_0xa53a('0x3b')]=qs[_0xa53a('0x3c')](_0x588aaa[_0xa53a('0x32')][_0xa53a('0x3c')]);_0x17ba41[_0xa53a('0x3e')]=qs[_0xa53a('0x34')](_[_0xa53a('0x3d')](_0x588aaa['query'],_0x192edf[_0xa53a('0x34')]));if(_0x588aaa[_0xa53a('0x32')][_0xa53a('0x41')]){_0x17ba41[_0xa53a('0x3e')]=_[_0xa53a('0x3f')](_0x17ba41[_0xa53a('0x3e')],{'$or':_['map'](_0x17ba41[_0xa53a('0x35')],function(_0x20a11d){var _0x1a02a0={};_0x1a02a0[_0x20a11d]={'$like':'%'+_0x588aaa[_0xa53a('0x32')][_0xa53a('0x41')]+'%'};return _0x1a02a0;})});}_0x17ba41=_[_0xa53a('0x3f')]({},_0x17ba41,_0x588aaa[_0xa53a('0x42')]);return _0x5727ed[_0xa53a('0x65')](_0x17ba41);}})[_0xa53a('0x25')](function(_0x35d9dc){if(_0x35d9dc){_0x21ca42=_0x35d9dc[_0xa53a('0x38')];if(!_0x588aaa[_0xa53a('0x32')][_0xa53a('0x39')](_0xa53a('0x3a'))){_0x17ba41[_0xa53a('0x1f')]=qs[_0xa53a('0x1f')](_0x588aaa['query'][_0xa53a('0x1f')]);_0x17ba41['offset']=qs['offset'](_0x588aaa[_0xa53a('0x32')]['offset']);}return _0x5727ed['getLists'](_0x17ba41);}})[_0xa53a('0x25')](function(_0x2e02ca){if(_0x2e02ca){return _0x2e02ca?{'count':_0x21ca42,'rows':_0x2e02ca}:null;}})[_0xa53a('0x25')](respondWithResult(_0x211888,null))['catch'](handleError(_0x211888,null));};exports[_0xa53a('0x67')]=function(_0x51754e,_0x9f05cb,_0x15e837){var _0x132533,_0xadb0af;var _0x3bcca7=[];var _0x1218e7=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0xa53a('0x45')]['find']({'where':{'id':_0x51754e[_0xa53a('0x5a')]['id']}})[_0xa53a('0x25')](handleEntityNotFound(_0x9f05cb,null))['then'](function(_0x3c238e){if(_0x3c238e){_0xadb0af=_0x3c238e;return _0x3c238e[_0xa53a('0x67')](_0x51754e[_0xa53a('0x4d')]['ids'],_['omit'](_0x51754e[_0xa53a('0x4d')],[_0xa53a('0x68'),'id'])||{});}return null;})[_0xa53a('0x69')](function(_0x24d470){var _0x406f0c;var _0x10685e;_0x132533=_0x24d470||[];var _0x2254d3=[];if(_0x24d470){for(var _0x582064=0x0;_0x582064<_0x24d470[_0xa53a('0x38')];_0x582064+=0x1){var _0x131d06=_0x24d470[_0x582064][_0xa53a('0x26')]({'plain':!![]});_0xadb0af[_0xa53a('0x6a')]=_0x51754e[_0xa53a('0x4d')][_0xa53a('0x6a')]?_0x51754e[_0xa53a('0x4d')][_0xa53a('0x6a')]:_0xadb0af[_0xa53a('0x6a')];switch(_0xadb0af[_0xa53a('0x6a')]){case _0xa53a('0x6b'):_0x406f0c=squel['insert']()[_0xa53a('0x6c')]('cm_hopper')[_0xa53a('0x6d')](['phone',_0xa53a('0x6e'),_0xa53a('0x6f'),_0xa53a('0x70'),_0xa53a('0x5e'),_0xa53a('0x58'),_0xa53a('0x59')],squel[_0xa53a('0x71')]()[_0xa53a('0x72')]('phone','phone')[_0xa53a('0x72')](_0xa53a('0x73'),_0xa53a('0x6e'))['field']('id','ContactId')['field'](_0x131d06[_0xa53a('0x74')][_0xa53a('0x75')](),_0xa53a('0x70'))[_0xa53a('0x72')](_0x51754e[_0xa53a('0x5a')]['id'][_0xa53a('0x75')](),_0xa53a('0x5e'))['field']('\x27'+_0x1218e7+'\x27','createdAt')[_0xa53a('0x72')]('\x27'+_0x1218e7+'\x27','updatedAt')[_0xa53a('0x76')](_0xa53a('0x77'))['where']('deletedAt\x20IS\x20NULL')[_0xa53a('0x3e')]('ListId\x20=\x20?',_0x131d06['CmListId'][_0xa53a('0x75')]())[_0xa53a('0x3e')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa53a('0x71')]()[_0xa53a('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0xa53a('0x76')](_0xa53a('0x78'))[_0xa53a('0x3e')](_0xa53a('0x79'),_0x51754e[_0xa53a('0x5a')]['id'][_0xa53a('0x75')]()))['where'](_0xa53a('0x7a'),squel[_0xa53a('0x71')]()[_0xa53a('0x72')](_0xa53a('0x7b'))[_0xa53a('0x76')]('cm_hopper')[_0xa53a('0x3e')](_0xa53a('0x79'),_0x51754e[_0xa53a('0x5a')]['id'][_0xa53a('0x75')]())))[_0xa53a('0x75')]();break;case _0xa53a('0x7c'):_0x406f0c=squel['insert']()[_0xa53a('0x6c')]('cm_hopper')[_0xa53a('0x6d')]([_0xa53a('0x7d'),_0xa53a('0x6e'),_0xa53a('0x6f'),_0xa53a('0x70'),_0xa53a('0x5e'),_0xa53a('0x58'),_0xa53a('0x59')],squel[_0xa53a('0x71')]()['field'](_0xa53a('0x7d'),'phone')[_0xa53a('0x72')](_0xa53a('0x73'),'scheduledAt')['field']('id',_0xa53a('0x6f'))['field'](_0x131d06[_0xa53a('0x74')][_0xa53a('0x75')](),'ListId')['field'](_0x51754e[_0xa53a('0x5a')]['id'][_0xa53a('0x75')](),_0xa53a('0x5e'))[_0xa53a('0x72')]('\x27'+_0x1218e7+'\x27','createdAt')[_0xa53a('0x72')]('\x27'+_0x1218e7+'\x27',_0xa53a('0x59'))[_0xa53a('0x76')]('cm_contacts')[_0xa53a('0x3e')](_0xa53a('0x7e'))[_0xa53a('0x3e')](_0xa53a('0x7f'),_0x131d06[_0xa53a('0x74')][_0xa53a('0x75')]())[_0xa53a('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xa53a('0x3e')](_0xa53a('0x7a'),squel[_0xa53a('0x71')]()['field'](_0xa53a('0x7b'))[_0xa53a('0x76')](_0xa53a('0x80'))['where'](_0xa53a('0x79'),_0x51754e['params']['id']['toString']())))[_0xa53a('0x75')]();break;default:_0x406f0c=squel[_0xa53a('0x81')]()[_0xa53a('0x6c')](_0xa53a('0x80'))[_0xa53a('0x6d')]([_0xa53a('0x7d'),_0xa53a('0x6e'),'ContactId','ListId',_0xa53a('0x5e'),'createdAt',_0xa53a('0x59')],squel['select']()[_0xa53a('0x72')]('phone',_0xa53a('0x7d'))[_0xa53a('0x72')](_0xa53a('0x73'),'scheduledAt')['field']('id',_0xa53a('0x6f'))[_0xa53a('0x72')](_0x131d06[_0xa53a('0x74')][_0xa53a('0x75')](),_0xa53a('0x70'))['field'](_0x51754e[_0xa53a('0x5a')]['id'][_0xa53a('0x75')](),_0xa53a('0x5e'))['field']('\x27'+_0x1218e7+'\x27',_0xa53a('0x58'))['field']('\x27'+_0x1218e7+'\x27',_0xa53a('0x59'))[_0xa53a('0x76')](_0xa53a('0x77'))[_0xa53a('0x3e')](_0xa53a('0x7e'))[_0xa53a('0x3e')](_0xa53a('0x7f'),_0x131d06[_0xa53a('0x74')]['toString']())[_0xa53a('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xa53a('0x75')]();}_0x10685e=squel[_0xa53a('0x81')]()['into'](_0xa53a('0x82'))[_0xa53a('0x6d')]([_0xa53a('0x83'),_0xa53a('0x6e'),'phone','OrderBy',_0xa53a('0x58'),'updatedAt'],squel[_0xa53a('0x71')]()[_0xa53a('0x72')]('h.id','id')[_0xa53a('0x72')](_0xa53a('0x73'),_0xa53a('0x6e'))[_0xa53a('0x72')]('ci.item',_0xa53a('0x7d'))[_0xa53a('0x72')](_0xa53a('0x84'),_0xa53a('0x85'))[_0xa53a('0x72')]('\x27'+_0x1218e7+'\x27',_0xa53a('0x58'))['field']('\x27'+_0x1218e7+'\x27',_0xa53a('0x59'))[_0xa53a('0x76')]('cm_contact_has_items','ci')['join'](_0xa53a('0x80'),'h',_0xa53a('0x86'))['where'](_0xa53a('0x87'),_0x131d06[_0xa53a('0x74')]['toString']())['where'](_0xa53a('0x88'),_0x51754e[_0xa53a('0x5a')]['id'][_0xa53a('0x75')]())[_0xa53a('0x3e')](_0xa53a('0x89'),_0x1218e7))[_0xa53a('0x75')]();_0x2254d3[_0xa53a('0x8a')](db[_0xa53a('0x8b')][_0xa53a('0x32')](_0x406f0c));_0x3bcca7[_0xa53a('0x8a')](db['sequelize'][_0xa53a('0x32')](_0x10685e));}return BPromise[_0xa53a('0x8c')](_0x2254d3);}})[_0xa53a('0x25')](function(){return BPromise[_0xa53a('0x8c')](_0x3bcca7);})['then'](function(){return _0x132533;})[_0xa53a('0x25')](respondWithResult(_0x9f05cb,null))[_0xa53a('0x48')](handleError(_0x9f05cb,null));};exports['removeLists']=function(_0x19f146,_0x48569e,_0x1f1790){return db['Campaign'][_0xa53a('0x4b')]({'where':{'id':_0x19f146[_0xa53a('0x5a')]['id']}})[_0xa53a('0x25')](handleEntityNotFound(_0x48569e,null))['then'](function(_0x3d0a22){if(_0x3d0a22){return _0x3d0a22[_0xa53a('0x8d')](_0x19f146[_0xa53a('0x32')]['ids']);}})[_0xa53a('0x25')](function(_0x456fdc){if(_0x456fdc){return db['CmHopper'][_0xa53a('0x29')]({'where':{'ListId':_0x19f146[_0xa53a('0x32')]['ids'],'CampaignId':_0x19f146[_0xa53a('0x5a')]['id']}})[_0xa53a('0x25')](function(){return _0x456fdc;});}})[_0xa53a('0x25')](respondWithStatusCode(_0x48569e,null))[_0xa53a('0x48')](handleError(_0x48569e,null));};exports[_0xa53a('0x8e')]=function(_0x3cb79d,_0x226e59,_0x24dc87){var _0x15a860={};var _0x208e72={};var _0x2b5c2d;var _0x1aa738;return db[_0xa53a('0x45')][_0xa53a('0x5c')]({'where':{'id':_0x3cb79d[_0xa53a('0x5a')]['id']}})[_0xa53a('0x25')](handleEntityNotFound(_0x226e59,null))[_0xa53a('0x25')](function(_0x250e29){if(_0x250e29){_0x2b5c2d=_0x250e29;_0x208e72['model']=_[_0xa53a('0x33')](db[_0xa53a('0x66')]['rawAttributes']);_0x208e72['query']=_[_0xa53a('0x33')](_0x3cb79d[_0xa53a('0x32')]);_0x208e72[_0xa53a('0x34')]=_[_0xa53a('0x36')](_0x208e72['model'],_0x208e72[_0xa53a('0x32')]);_0x15a860[_0xa53a('0x35')]=_[_0xa53a('0x36')](_0x208e72[_0xa53a('0x31')],qs[_0xa53a('0x37')](_0x3cb79d[_0xa53a('0x32')]['fields']));_0x15a860[_0xa53a('0x35')]=_0x15a860[_0xa53a('0x35')][_0xa53a('0x38')]?_0x15a860[_0xa53a('0x35')]:_0x208e72[_0xa53a('0x31')];_0x15a860[_0xa53a('0x3b')]=qs['sort'](_0x3cb79d['query']['sort']);_0x15a860[_0xa53a('0x3e')]=qs[_0xa53a('0x34')](_['pick'](_0x3cb79d['query'],_0x208e72[_0xa53a('0x34')]));if(_0x3cb79d[_0xa53a('0x32')][_0xa53a('0x41')]){_0x15a860[_0xa53a('0x3e')]=_[_0xa53a('0x3f')](_0x15a860[_0xa53a('0x3e')],{'$or':_[_0xa53a('0x2d')](_0x15a860[_0xa53a('0x35')],function(_0x1d007d){var _0x25b669={};_0x25b669[_0x1d007d]={'$like':'%'+_0x3cb79d['query'][_0xa53a('0x41')]+'%'};return _0x25b669;})});}_0x15a860=_[_0xa53a('0x3f')]({},_0x15a860,_0x3cb79d[_0xa53a('0x42')]);return _0x2b5c2d['getBlackLists'](_0x15a860);}})['then'](function(_0x16bf8b){if(_0x16bf8b){_0x1aa738=_0x16bf8b[_0xa53a('0x38')];if(!_0x3cb79d['query']['hasOwnProperty'](_0xa53a('0x3a'))){_0x15a860['limit']=qs[_0xa53a('0x1f')](_0x3cb79d['query'][_0xa53a('0x1f')]);_0x15a860[_0xa53a('0x1c')]=qs[_0xa53a('0x1c')](_0x3cb79d[_0xa53a('0x32')]['offset']);}return _0x2b5c2d['getBlackLists'](_0x15a860);}})[_0xa53a('0x25')](function(_0x5d7e51){if(_0x5d7e51){return _0x5d7e51?{'count':_0x1aa738,'rows':_0x5d7e51}:null;}})[_0xa53a('0x25')](respondWithResult(_0x226e59,null))[_0xa53a('0x48')](handleError(_0x226e59,null));};exports[_0xa53a('0x8f')]=function(_0x367414,_0x2d7f1c,_0x50ee18){var _0x1bef52,_0x2d6cdd;var _0x457ebb=[];var _0x5c61c5=moment()[_0xa53a('0x90')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xa53a('0x45')]['find']({'where':{'id':_0x367414[_0xa53a('0x5a')]['id']}})[_0xa53a('0x25')](handleEntityNotFound(_0x2d7f1c,null))[_0xa53a('0x25')](function(_0x5ee541){if(_0x5ee541){_0x2d6cdd=_0x5ee541;return _0x5ee541[_0xa53a('0x8f')](_0x367414[_0xa53a('0x4d')][_0xa53a('0x68')],_[_0xa53a('0x57')](_0x367414[_0xa53a('0x4d')],['ids','id'])||{});}return null;})[_0xa53a('0x69')](function(_0x340371){var _0x4d63de;var _0x599b17;_0x1bef52=_0x340371||[];var _0x4142f5=[];if(_0x340371){for(var _0x28dbf4=0x0;_0x28dbf4<_0x340371['length'];_0x28dbf4+=0x1){var _0x29a129=_0x340371[_0x28dbf4][_0xa53a('0x26')]({'plain':!![]});_0x4d63de=squel['insert']()[_0xa53a('0x6c')](_0xa53a('0x91'))[_0xa53a('0x6d')]([_0xa53a('0x7d'),_0xa53a('0x6f'),_0xa53a('0x70'),_0xa53a('0x5e'),_0xa53a('0x58'),_0xa53a('0x59')],squel['select']()[_0xa53a('0x72')]('phone',_0xa53a('0x7d'))[_0xa53a('0x72')]('id','ContactId')[_0xa53a('0x72')](_0x29a129[_0xa53a('0x74')][_0xa53a('0x75')](),_0xa53a('0x70'))[_0xa53a('0x72')](_0x367414[_0xa53a('0x5a')]['id']['toString'](),_0xa53a('0x5e'))[_0xa53a('0x72')](_0xa53a('0x73'),'createdAt')['field']('NOW()','updatedAt')[_0xa53a('0x76')](_0xa53a('0x77'))['where'](_0xa53a('0x7e'))[_0xa53a('0x3e')](_0xa53a('0x7f'),_0x29a129[_0xa53a('0x74')][_0xa53a('0x75')]())[_0xa53a('0x3e')](_0xa53a('0x92')))[_0xa53a('0x75')]();_0x4142f5['push'](db[_0xa53a('0x8b')][_0xa53a('0x32')](_0x4d63de));}return BPromise[_0xa53a('0x8c')](_0x4142f5);}})['then'](function(){return _0x1bef52;})[_0xa53a('0x25')](respondWithResult(_0x2d7f1c,null))[_0xa53a('0x48')](handleError(_0x2d7f1c,null));};exports['removeBlackLists']=function(_0x1732fd,_0xb0a044,_0x4d3e55){return db[_0xa53a('0x45')][_0xa53a('0x4b')]({'where':{'id':_0x1732fd[_0xa53a('0x5a')]['id']}})['then'](handleEntityNotFound(_0xb0a044,null))[_0xa53a('0x25')](function(_0x48f3c8){if(_0x48f3c8){return _0x48f3c8[_0xa53a('0x93')](_0x1732fd[_0xa53a('0x32')][_0xa53a('0x68')]);}})[_0xa53a('0x25')](function(_0x536871){if(_0x536871){return db[_0xa53a('0x64')]['destroy']({'where':{'ListId':_0x1732fd[_0xa53a('0x32')]['ids'],'CampaignId':_0x1732fd[_0xa53a('0x5a')]['id']}})['then'](function(){return _0x536871;});}})[_0xa53a('0x25')](respondWithStatusCode(_0xb0a044,null))[_0xa53a('0x48')](handleError(_0xb0a044,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6c6542d..2e8581d 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(_0x592ad2,_0x55f950){var _0x4e0139=function(_0x138688){while(--_0x138688){_0x592ad2['push'](_0x592ad2['shift']());}};_0x4e0139(++_0x55f950);}(_0x7a54,0x106));var _0x47a5=function(_0x1eb93a,_0x27f136){_0x1eb93a=_0x1eb93a-0x0;var _0x33f1ad=_0x7a54[_0x1eb93a];return _0x33f1ad;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 8708704..72700ef 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 _0x2e31=['error','code','message','GetCampaign','Campaign','raw','options','where','attributes','limit','include','map','model','then','debug','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x178f22,_0x197f05){var _0x561380=function(_0x50fd69){while(--_0x50fd69){_0x178f22['push'](_0x178f22['shift']());}};_0x561380(++_0x197f05);}(_0x2e31,0x145));var _0x12e3=function(_0x180c15,_0x2bc8c6){_0x180c15=_0x180c15-0x0;var _0x255632=_0x2e31[_0x180c15];return _0x255632;};'use strict';var _=require(_0x12e3('0x0'));var util=require(_0x12e3('0x1'));var moment=require(_0x12e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x12e3('0x3'));var fs=require('fs');var Redis=require(_0x12e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x12e3('0x5'))(_0x12e3('0x6'));var config=require(_0x12e3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x12e3('0x8')][_0x12e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aefcf,_0x5f056f,_0x37f287){return new BPromise(function(_0x403cc5,_0x31e2cf){return client[_0x12e3('0xa')](_0x5aefcf,_0x37f287)['then'](function(_0x438c7e){logger[_0x12e3('0xb')](_0x12e3('0xc'),_0x5f056f,'request\x20sent');logger['debug'](_0x12e3('0xd'),_0x5f056f,_0x12e3('0xe'),JSON[_0x12e3('0xf')](_0x438c7e));if(_0x438c7e[_0x12e3('0x10')]){if(_0x438c7e[_0x12e3('0x10')][_0x12e3('0x11')]===0x1f4){logger[_0x12e3('0x10')](_0x12e3('0xc'),_0x5f056f,_0x438c7e[_0x12e3('0x10')][_0x12e3('0x12')]);return _0x31e2cf(_0x438c7e[_0x12e3('0x10')][_0x12e3('0x12')]);}logger['error'](_0x12e3('0xc'),_0x5f056f,_0x438c7e[_0x12e3('0x10')][_0x12e3('0x12')]);return _0x403cc5(_0x438c7e['error'][_0x12e3('0x12')]);}else{logger[_0x12e3('0xb')]('Campaign,\x20%s,\x20%s',_0x5f056f,'request\x20sent');_0x403cc5(_0x438c7e['result'][_0x12e3('0x12')]);}})['catch'](function(_0x2f26b1){logger[_0x12e3('0x10')](_0x12e3('0xc'),_0x5f056f,_0x2f26b1);_0x31e2cf(_0x2f26b1);});});}exports[_0x12e3('0x13')]=function(_0x211c6a){var _0x2041e9=this;return new Promise(function(_0x5a63c8,_0x77ad03){return db[_0x12e3('0x14')]['findAll']({'raw':_0x211c6a['options']?_0x211c6a['options'][_0x12e3('0x15')]===undefined?!![]:![]:!![],'where':_0x211c6a['options']?_0x211c6a[_0x12e3('0x16')][_0x12e3('0x17')]||null:null,'attributes':_0x211c6a['options']?_0x211c6a['options'][_0x12e3('0x18')]||null:null,'limit':_0x211c6a[_0x12e3('0x16')]?_0x211c6a[_0x12e3('0x16')][_0x12e3('0x19')]||null:null,'include':_0x211c6a['options']?_0x211c6a['options'][_0x12e3('0x1a')]?_[_0x12e3('0x1b')](_0x211c6a[_0x12e3('0x16')][_0x12e3('0x1a')],function(_0x2cf78a){return{'model':db[_0x2cf78a['model']],'as':_0x2cf78a['as'],'attributes':_0x2cf78a[_0x12e3('0x18')],'include':_0x2cf78a[_0x12e3('0x1a')]?_[_0x12e3('0x1b')](_0x2cf78a[_0x12e3('0x1a')],function(_0x43a59f){return{'model':db[_0x43a59f[_0x12e3('0x1c')]],'as':_0x43a59f['as'],'attributes':_0x43a59f['attributes'],'include':_0x43a59f[_0x12e3('0x1a')]?_[_0x12e3('0x1b')](_0x43a59f[_0x12e3('0x1a')],function(_0x42765f){return{'model':db[_0x42765f['model']],'as':_0x42765f['as'],'attributes':_0x42765f[_0x12e3('0x18')]};}):[]};}):[]};}):[]:[]})[_0x12e3('0x1d')](function(_0x2293ec){logger['info'](_0x12e3('0x13'),_0x211c6a);logger[_0x12e3('0x1e')](_0x12e3('0x13'),_0x211c6a,JSON[_0x12e3('0xf')](_0x2293ec));_0x5a63c8(_0x2293ec);})['catch'](function(_0x342ad2){logger[_0x12e3('0x10')](_0x12e3('0x13'),_0x342ad2['message'],_0x211c6a);_0x77ad03(_0x2041e9[_0x12e3('0x10')](0x1f4,_0x342ad2['message']));});});}; \ No newline at end of file +var _0xe062=['request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','info','result','catch','GetCampaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','request','then'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xe062,0xd5));var _0x2e06=function(_0xac93e6,_0x387ad9){_0xac93e6=_0xac93e6-0x0;var _0x333dde=_0xe062[_0xac93e6];return _0x333dde;};'use strict';var _=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var moment=require('moment');var BPromise=require(_0x2e06('0x2'));var rs=require(_0x2e06('0x3'));var fs=require('fs');var Redis=require(_0x2e06('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e06('0x5'))(_0x2e06('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e06('0x7')][_0x2e06('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52bf0a,_0x5747de,_0x255317){return new BPromise(function(_0x31645b,_0x8ede0e){return client[_0x2e06('0x9')](_0x52bf0a,_0x255317)[_0x2e06('0xa')](function(_0x2a2ee4){logger['info']('Campaign,\x20%s,\x20%s',_0x5747de,_0x2e06('0xb'));logger[_0x2e06('0xc')](_0x2e06('0xd'),_0x5747de,'request\x20sent',JSON[_0x2e06('0xe')](_0x2a2ee4));if(_0x2a2ee4[_0x2e06('0xf')]){if(_0x2a2ee4[_0x2e06('0xf')][_0x2e06('0x10')]===0x1f4){logger['error'](_0x2e06('0x11'),_0x5747de,_0x2a2ee4[_0x2e06('0xf')]['message']);return _0x8ede0e(_0x2a2ee4[_0x2e06('0xf')][_0x2e06('0x12')]);}logger['error'](_0x2e06('0x11'),_0x5747de,_0x2a2ee4[_0x2e06('0xf')][_0x2e06('0x12')]);return _0x31645b(_0x2a2ee4[_0x2e06('0xf')][_0x2e06('0x12')]);}else{logger[_0x2e06('0x13')]('Campaign,\x20%s,\x20%s',_0x5747de,_0x2e06('0xb'));_0x31645b(_0x2a2ee4[_0x2e06('0x14')][_0x2e06('0x12')]);}})[_0x2e06('0x15')](function(_0x41d1fc){logger[_0x2e06('0xf')](_0x2e06('0x11'),_0x5747de,_0x41d1fc);_0x8ede0e(_0x41d1fc);});});}exports[_0x2e06('0x16')]=function(_0x1418e4){var _0x4fd048=this;return new Promise(function(_0x209942,_0x45052c){return db['Campaign'][_0x2e06('0x17')]({'raw':_0x1418e4[_0x2e06('0x18')]?_0x1418e4[_0x2e06('0x18')][_0x2e06('0x19')]===undefined?!![]:![]:!![],'where':_0x1418e4[_0x2e06('0x18')]?_0x1418e4[_0x2e06('0x18')][_0x2e06('0x1a')]||null:null,'attributes':_0x1418e4[_0x2e06('0x18')]?_0x1418e4[_0x2e06('0x18')][_0x2e06('0x1b')]||null:null,'limit':_0x1418e4[_0x2e06('0x18')]?_0x1418e4[_0x2e06('0x18')][_0x2e06('0x1c')]||null:null,'include':_0x1418e4[_0x2e06('0x18')]?_0x1418e4[_0x2e06('0x18')][_0x2e06('0x1d')]?_[_0x2e06('0x1e')](_0x1418e4[_0x2e06('0x18')]['include'],function(_0x21eea1){return{'model':db[_0x21eea1[_0x2e06('0x1f')]],'as':_0x21eea1['as'],'attributes':_0x21eea1[_0x2e06('0x1b')],'include':_0x21eea1[_0x2e06('0x1d')]?_[_0x2e06('0x1e')](_0x21eea1[_0x2e06('0x1d')],function(_0x73d502){return{'model':db[_0x73d502[_0x2e06('0x1f')]],'as':_0x73d502['as'],'attributes':_0x73d502[_0x2e06('0x1b')],'include':_0x73d502['include']?_[_0x2e06('0x1e')](_0x73d502[_0x2e06('0x1d')],function(_0xdcb6f8){return{'model':db[_0xdcb6f8[_0x2e06('0x1f')]],'as':_0xdcb6f8['as'],'attributes':_0xdcb6f8[_0x2e06('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x455bf3){logger['info'](_0x2e06('0x16'),_0x1418e4);logger[_0x2e06('0xc')]('GetCampaign',_0x1418e4,JSON[_0x2e06('0xe')](_0x455bf3));_0x209942(_0x455bf3);})[_0x2e06('0x15')](function(_0x3ff289){logger['error']('GetCampaign',_0x3ff289[_0x2e06('0x12')],_0x1418e4);_0x45052c(_0x4fd048[_0x2e06('0xf')](0x1f4,_0x3ff289[_0x2e06('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 11161b9..ff79a92 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 _0xfb10=['getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','post','create','/:id/clone','clone','/:id/blacklists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x3f71aa,_0x49508b){var _0x37bfa1=function(_0x187906){while(--_0x187906){_0x3f71aa['push'](_0x3f71aa['shift']());}};_0x37bfa1(++_0x49508b);}(_0xfb10,0x13c));var _0x0fb1=function(_0xf74e23,_0x39108d){_0xf74e23=_0xf74e23-0x0;var _0xa43443=_0xfb10[_0xf74e23];return _0xa43443;};'use strict';var multer=require(_0x0fb1('0x0'));var util=require(_0x0fb1('0x1'));var path=require(_0x0fb1('0x2'));var timeout=require(_0x0fb1('0x3'));var express=require(_0x0fb1('0x4'));var router=express[_0x0fb1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0fb1('0x6'));var interaction=require(_0x0fb1('0x7'));var config=require(_0x0fb1('0x8'));var controller=require('./campaign.controller');router[_0x0fb1('0x9')]('/',auth[_0x0fb1('0xa')](),controller[_0x0fb1('0xb')]);router['get'](_0x0fb1('0xc'),auth[_0x0fb1('0xa')](),controller[_0x0fb1('0xd')]);router[_0x0fb1('0x9')]('/:id/hoppers',auth[_0x0fb1('0xa')](),controller[_0x0fb1('0xe')]);router['get'](_0x0fb1('0xf'),auth['isAuthenticated'](),controller[_0x0fb1('0x10')]);router[_0x0fb1('0x9')](_0x0fb1('0x11'),auth[_0x0fb1('0xa')](),controller[_0x0fb1('0x12')]);router['get'](_0x0fb1('0x13'),auth[_0x0fb1('0xa')](),controller['getHopperBlacks']);router[_0x0fb1('0x9')](_0x0fb1('0x14'),auth[_0x0fb1('0xa')](),controller[_0x0fb1('0x15')]);router[_0x0fb1('0x9')]('/:id/blacklists',auth[_0x0fb1('0xa')](),controller['getBlackLists']);router[_0x0fb1('0x16')]('/',auth[_0x0fb1('0xa')](),controller[_0x0fb1('0x17')]);router[_0x0fb1('0x16')](_0x0fb1('0x18'),auth[_0x0fb1('0xa')](),controller[_0x0fb1('0x19')]);router[_0x0fb1('0x16')]('/:id/lists',auth[_0x0fb1('0xa')](),controller['addLists']);router[_0x0fb1('0x16')](_0x0fb1('0x1a'),auth[_0x0fb1('0xa')](),controller['addBlackLists']);router[_0x0fb1('0x1b')](_0x0fb1('0xc'),auth['isAuthenticated'](),controller[_0x0fb1('0x1c')]);router[_0x0fb1('0x1d')]('/:id',auth[_0x0fb1('0xa')](),controller['destroy']);router[_0x0fb1('0x1d')](_0x0fb1('0x14'),auth[_0x0fb1('0xa')](),controller[_0x0fb1('0x1e')]);router['delete'](_0x0fb1('0x1a'),auth[_0x0fb1('0xa')](),controller[_0x0fb1('0x1f')]);module[_0x0fb1('0x20')]=router; \ No newline at end of file +var _0x8ff3=['clone','/:id/lists','addLists','addBlackLists','update','delete','destroy','removeLists','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','post'];(function(_0x4348b4,_0x2c2ccc){var _0xeb68d4=function(_0x1b4489){while(--_0x1b4489){_0x4348b4['push'](_0x4348b4['shift']());}};_0xeb68d4(++_0x2c2ccc);}(_0x8ff3,0x1bb));var _0x38ff=function(_0xea46d,_0x254082){_0xea46d=_0xea46d-0x0;var _0x1fa4c5=_0x8ff3[_0xea46d];return _0x1fa4c5;};'use strict';var multer=require('multer');var util=require(_0x38ff('0x0'));var path=require('path');var timeout=require(_0x38ff('0x1'));var express=require(_0x38ff('0x2'));var router=express[_0x38ff('0x3')]();var fs_extra=require(_0x38ff('0x4'));var auth=require(_0x38ff('0x5'));var interaction=require(_0x38ff('0x6'));var config=require(_0x38ff('0x7'));var controller=require('./campaign.controller');router[_0x38ff('0x8')]('/',auth[_0x38ff('0x9')](),controller[_0x38ff('0xa')]);router[_0x38ff('0x8')](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0xc')]);router[_0x38ff('0x8')](_0x38ff('0xd'),auth[_0x38ff('0x9')](),controller[_0x38ff('0xe')]);router[_0x38ff('0x8')](_0x38ff('0xf'),auth['isAuthenticated'](),controller[_0x38ff('0x10')]);router[_0x38ff('0x8')](_0x38ff('0x11'),auth[_0x38ff('0x9')](),controller['getHopperFinals']);router[_0x38ff('0x8')](_0x38ff('0x12'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x13')]);router[_0x38ff('0x8')]('/:id/lists',auth[_0x38ff('0x9')](),controller['getLists']);router[_0x38ff('0x8')](_0x38ff('0x14'),auth[_0x38ff('0x9')](),controller['getBlackLists']);router[_0x38ff('0x15')]('/',auth[_0x38ff('0x9')](),controller['create']);router['post']('/:id/clone',auth[_0x38ff('0x9')](),controller[_0x38ff('0x16')]);router[_0x38ff('0x15')](_0x38ff('0x17'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x18')]);router[_0x38ff('0x15')](_0x38ff('0x14'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x19')]);router['put'](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x1a')]);router[_0x38ff('0x1b')](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x1c')]);router[_0x38ff('0x1b')](_0x38ff('0x17'),auth['isAuthenticated'](),controller[_0x38ff('0x1d')]);router['delete'](_0x38ff('0x14'),auth[_0x38ff('0x9')](),controller['removeBlackLists']);module[_0x38ff('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 9c82dc4..96c498f 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 _0xc33b=['exports','STRING','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xc33b,0x18e));var _0xbc33=function(_0x298af3,_0x126792){_0x298af3=_0x298af3-0x0;var _0x12ab2d=_0xc33b[_0x298af3];return _0x12ab2d;};'use strict';var Sequelize=require(_0xbc33('0x0'));module[_0xbc33('0x1')]={'key':{'type':Sequelize[_0xbc33('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xbc33('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbc33('0x2')]},'name':{'type':Sequelize[_0xbc33('0x4')],'get':function(){return this[_0xbc33('0x5')](_0xbc33('0x6'));}}}; \ No newline at end of file +var _0x02b5=['exports','STRING','TEXT','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x33f9bf,_0x2bb19f){var _0x563569=function(_0xaf83bf){while(--_0xaf83bf){_0x33f9bf['push'](_0x33f9bf['shift']());}};_0x563569(++_0x2bb19f);}(_0x02b5,0xd7));var _0x502b=function(_0x69f6e7,_0x26b73e){_0x69f6e7=_0x69f6e7-0x0;var _0x135a2d=_0x02b5[_0x69f6e7];return _0x135a2d;};'use strict';var Sequelize=require(_0x502b('0x0'));module[_0x502b('0x1')]={'key':{'type':Sequelize[_0x502b('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x502b('0x3')],'length':_0x502b('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x502b('0x2')]},'name':{'type':Sequelize[_0x502b('0x5')],'get':function(){return this[_0x502b('0x6')](_0x502b('0x7'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index ac9fef7..23f1dd0 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 _0x2b1e=['filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','CannedAnswer','includeAll','rows','catch','show','params','find','body','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','get','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','jsforce','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','CannedAnswers','UserProfileResource','error','name','map','rawAttributes','type','model','keys'];(function(_0x36bd64,_0x588653){var _0x3da4c3=function(_0x18ddba){while(--_0x18ddba){_0x36bd64['push'](_0x36bd64['shift']());}};_0x3da4c3(++_0x588653);}(_0x2b1e,0xc3));var _0xe2b1=function(_0x11486a,_0x51bfa1){_0x11486a=_0x11486a-0x0;var _0x27ec65=_0x2b1e[_0x11486a];return _0x27ec65;};'use strict';var emlformat=require(_0xe2b1('0x0'));var rimraf=require(_0xe2b1('0x1'));var zipdir=require(_0xe2b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2b1('0x3'));var moment=require(_0xe2b1('0x4'));var BPromise=require(_0xe2b1('0x5'));var Mustache=require(_0xe2b1('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe2b1('0x7'));var csv=require('to-csv');var ejs=require(_0xe2b1('0x8'));var fs=require('fs');var fs_extra=require(_0xe2b1('0x9'));var _=require(_0xe2b1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe2b1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe2b1('0xc'));var querystring=require('querystring');var Papa=require(_0xe2b1('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe2b1('0xe'));var hardwareService=require(_0xe2b1('0xf'));var logger=require(_0xe2b1('0x10'))(_0xe2b1('0x11'));var utils=require(_0xe2b1('0x12'));var config=require(_0xe2b1('0x13'));var licenseUtil=require(_0xe2b1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6d0e,_0x476775){_0x476775=_0x476775||0xcc;return function(_0x5b5232){if(_0x5b5232){return _0x4c6d0e[_0xe2b1('0x15')](_0x476775);}return _0x4c6d0e[_0xe2b1('0x16')](_0x476775)[_0xe2b1('0x17')]();};}function respondWithResult(_0x4a7ec1,_0x8db311){_0x8db311=_0x8db311||0xc8;return function(_0x279221){if(_0x279221){return _0x4a7ec1['status'](_0x8db311)[_0xe2b1('0x18')](_0x279221);}};}function respondWithFilteredResult(_0x136738,_0xfb5916){return function(_0x15f351){if(_0x15f351){var _0x540137=typeof _0xfb5916[_0xe2b1('0x19')]===_0xe2b1('0x1a')&&typeof _0xfb5916[_0xe2b1('0x1b')]===_0xe2b1('0x1a');var _0x2e02fb=_0x15f351[_0xe2b1('0x1c')];var _0x510c88=_0x540137?0x0:_0xfb5916[_0xe2b1('0x19')];var _0x40bfef=_0x540137?_0x15f351[_0xe2b1('0x1c')]:_0xfb5916['offset']+_0xfb5916[_0xe2b1('0x1b')];var _0x275793;if(_0x40bfef>=_0x2e02fb){_0x40bfef=_0x2e02fb;_0x275793=0xc8;}else{_0x275793=0xce;}_0x136738['status'](_0x275793);return _0x136738[_0xe2b1('0x1d')](_0xe2b1('0x1e'),_0x510c88+'-'+_0x40bfef+'/'+_0x2e02fb)[_0xe2b1('0x18')](_0x15f351);}return null;};}function patchUpdates(_0x32422d){return function(_0x381edc){try{jsonpatch[_0xe2b1('0x1f')](_0x381edc,_0x32422d,!![]);}catch(_0x188ff8){return BPromise[_0xe2b1('0x20')](_0x188ff8);}return _0x381edc[_0xe2b1('0x21')]();};}function saveUpdates(_0x2223c9,_0x446b6d){return function(_0x409189){if(_0x409189){return _0x409189['update'](_0x2223c9)['then'](function(_0x1f8955){return _0x1f8955;});}return null;};}function removeEntity(_0x123250,_0xaf7ea0){return function(_0x1d32f0){if(_0x1d32f0){return _0x1d32f0[_0xe2b1('0x22')]()[_0xe2b1('0x23')](function(){var _0x33fa4f=_0x1d32f0['get']({'plain':!![]});var _0x3a41dc=_0xe2b1('0x24');return db[_0xe2b1('0x25')]['destroy']({'where':{'type':_0x3a41dc,'resourceId':_0x33fa4f['id']}})['then'](function(){return _0x1d32f0;});})[_0xe2b1('0x23')](function(){_0x123250[_0xe2b1('0x16')](0xcc)[_0xe2b1('0x17')]();});}};}function handleEntityNotFound(_0x3bc2f6,_0x3f423f){return function(_0x10936f){if(!_0x10936f){_0x3bc2f6['sendStatus'](0x194);}return _0x10936f;};}function handleError(_0x4fba7d,_0x5195f3){_0x5195f3=_0x5195f3||0x1f4;return function(_0x1b0d26){logger[_0xe2b1('0x26')](_0x1b0d26['stack']);if(_0x1b0d26['name']){delete _0x1b0d26[_0xe2b1('0x27')];}_0x4fba7d['status'](_0x5195f3)['send'](_0x1b0d26);};}exports['index']=function(_0xf798a7,_0x1cbcf2){var _0x4ea145={},_0x4b3291={},_0x9a0e6c={'count':0x0,'rows':[]};var _0x5b47cc=_[_0xe2b1('0x28')](db['CannedAnswer'][_0xe2b1('0x29')],function(_0x3fbb3){return{'name':_0x3fbb3['fieldName'],'type':_0x3fbb3[_0xe2b1('0x2a')]['key']};});_0x4b3291[_0xe2b1('0x2b')]=_[_0xe2b1('0x28')](_0x5b47cc,_0xe2b1('0x27'));_0x4b3291['query']=_[_0xe2b1('0x2c')](_0xf798a7['query']);_0x4b3291[_0xe2b1('0x2d')]=_[_0xe2b1('0x2e')](_0x4b3291['model'],_0x4b3291[_0xe2b1('0x2f')]);_0x4ea145[_0xe2b1('0x30')]=_['intersection'](_0x4b3291['model'],qs[_0xe2b1('0x31')](_0xf798a7[_0xe2b1('0x2f')]['fields']));_0x4ea145[_0xe2b1('0x30')]=_0x4ea145[_0xe2b1('0x30')][_0xe2b1('0x32')]?_0x4ea145[_0xe2b1('0x30')]:_0x4b3291[_0xe2b1('0x2b')];if(!_0xf798a7[_0xe2b1('0x2f')]['hasOwnProperty'](_0xe2b1('0x33'))){_0x4ea145[_0xe2b1('0x1b')]=qs[_0xe2b1('0x1b')](_0xf798a7['query'][_0xe2b1('0x1b')]);_0x4ea145[_0xe2b1('0x19')]=qs['offset'](_0xf798a7['query'][_0xe2b1('0x19')]);}_0x4ea145[_0xe2b1('0x34')]=qs['sort'](_0xf798a7[_0xe2b1('0x2f')][_0xe2b1('0x35')]);_0x4ea145[_0xe2b1('0x36')]=qs[_0xe2b1('0x2d')](_[_0xe2b1('0x37')](_0xf798a7[_0xe2b1('0x2f')],_0x4b3291['filters']),_0x5b47cc);if(_0xf798a7[_0xe2b1('0x2f')]['filter']){_0x4ea145[_0xe2b1('0x36')]=_[_0xe2b1('0x38')](_0x4ea145[_0xe2b1('0x36')],{'$or':[{'key':{'$like':'%'+_0xf798a7[_0xe2b1('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0xf798a7[_0xe2b1('0x2f')]['filter']+'%'}}]});}_0x4ea145=_[_0xe2b1('0x38')]({},_0x4ea145,_0xf798a7[_0xe2b1('0x39')]);var _0x33561d={'where':_0x4ea145[_0xe2b1('0x36')]};return db[_0xe2b1('0x3a')][_0xe2b1('0x1c')](_0x33561d)[_0xe2b1('0x23')](function(_0x272787){_0x9a0e6c[_0xe2b1('0x1c')]=_0x272787;if(_0xf798a7[_0xe2b1('0x2f')][_0xe2b1('0x3b')]){_0x4ea145['include']=[{'all':!![]}];}return db[_0xe2b1('0x3a')]['findAll'](_0x4ea145);})['then'](function(_0x237fbf){_0x9a0e6c[_0xe2b1('0x3c')]=_0x237fbf;return _0x9a0e6c;})[_0xe2b1('0x23')](respondWithFilteredResult(_0x1cbcf2,_0x4ea145))[_0xe2b1('0x3d')](handleError(_0x1cbcf2,null));};exports[_0xe2b1('0x3e')]=function(_0x432a78,_0xdcfdd0){var _0x6b5626={'raw':!![],'where':{'id':_0x432a78[_0xe2b1('0x3f')]['id']}},_0x165927={};_0x165927['model']=_['keys'](db[_0xe2b1('0x3a')][_0xe2b1('0x29')]);_0x165927[_0xe2b1('0x2f')]=_['keys'](_0x432a78[_0xe2b1('0x2f')]);_0x165927['filters']=_[_0xe2b1('0x2e')](_0x165927[_0xe2b1('0x2b')],_0x165927[_0xe2b1('0x2f')]);_0x6b5626[_0xe2b1('0x30')]=_[_0xe2b1('0x2e')](_0x165927[_0xe2b1('0x2b')],qs[_0xe2b1('0x31')](_0x432a78[_0xe2b1('0x2f')][_0xe2b1('0x31')]));_0x6b5626[_0xe2b1('0x30')]=_0x6b5626[_0xe2b1('0x30')]['length']?_0x6b5626[_0xe2b1('0x30')]:_0x165927[_0xe2b1('0x2b')];if(_0x432a78[_0xe2b1('0x2f')][_0xe2b1('0x3b')]){_0x6b5626['include']=[{'all':!![]}];}_0x6b5626=_['merge']({},_0x6b5626,_0x432a78['options']);return db[_0xe2b1('0x3a')][_0xe2b1('0x40')](_0x6b5626)[_0xe2b1('0x23')](handleEntityNotFound(_0xdcfdd0,null))[_0xe2b1('0x23')](respondWithResult(_0xdcfdd0,null))[_0xe2b1('0x3d')](handleError(_0xdcfdd0,null));};exports['update']=function(_0x54638f,_0x1ce3b7){if(_0x54638f[_0xe2b1('0x41')]['id']){delete _0x54638f['body']['id'];}return db[_0xe2b1('0x3a')]['find']({'where':{'id':_0x54638f[_0xe2b1('0x3f')]['id']}})[_0xe2b1('0x23')](handleEntityNotFound(_0x1ce3b7,null))[_0xe2b1('0x23')](saveUpdates(_0x54638f[_0xe2b1('0x41')],null))[_0xe2b1('0x23')](respondWithResult(_0x1ce3b7,null))['catch'](handleError(_0x1ce3b7,null));};exports[_0xe2b1('0x22')]=function(_0x4c3170,_0x18803e){return db[_0xe2b1('0x3a')][_0xe2b1('0x40')]({'where':{'id':_0x4c3170['params']['id']}})['then'](handleEntityNotFound(_0x18803e,null))['then'](removeEntity(_0x18803e,null))[_0xe2b1('0x3d')](handleError(_0x18803e,null));};exports['create']=function(_0x101cec,_0x1ad455){var _0x2ba19e={'key':_0x101cec[_0xe2b1('0x41')][_0xe2b1('0x42')]};if(_0x101cec[_0xe2b1('0x41')][_0xe2b1('0x43')]){_0x2ba19e[_0xe2b1('0x43')]=_0x101cec[_0xe2b1('0x41')][_0xe2b1('0x43')];}else if(_0x101cec[_0xe2b1('0x41')][_0xe2b1('0x44')]){_0x2ba19e[_0xe2b1('0x44')]=_0x101cec[_0xe2b1('0x41')][_0xe2b1('0x44')];}else if(_0x101cec[_0xe2b1('0x41')][_0xe2b1('0x45')]){_0x2ba19e[_0xe2b1('0x45')]=_0x101cec[_0xe2b1('0x41')][_0xe2b1('0x45')];}else if(_0x101cec[_0xe2b1('0x41')]['ChatWebsiteId']){_0x2ba19e['ChatWebsiteId']=_0x101cec['body'][_0xe2b1('0x46')];}return db[_0xe2b1('0x3a')][_0xe2b1('0x40')]({'where':_0x2ba19e})[_0xe2b1('0x23')](function(_0x2aa5cf){if(_0x2aa5cf){throw new db[(_0xe2b1('0x47'))][(_0xe2b1('0x48'))](_0xe2b1('0x49'));}return db[_0xe2b1('0x3a')][_0xe2b1('0x4a')](_0x101cec[_0xe2b1('0x41')]);})['then'](function(_0x4070dc){var _0x1626ad=_0x101cec['user'][_0xe2b1('0x4b')]({'plain':!![]});if(!_0x1626ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1626ad['role']===_0xe2b1('0x4c')){var _0x3ec7b0=_0x4070dc[_0xe2b1('0x4b')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xe2b1('0x24'),'userProfileId':_0x1626ad[_0xe2b1('0x4d')]},'raw':!![]})[_0xe2b1('0x23')](function(_0x4b901d){if(_0x4b901d&&_0x4b901d[_0xe2b1('0x4e')]===0x0){return db['UserProfileResource'][_0xe2b1('0x4a')]({'name':_0x3ec7b0['name'],'resourceId':_0x3ec7b0['id'],'type':_0x4b901d[_0xe2b1('0x27')],'sectionId':_0x4b901d['id']},{})[_0xe2b1('0x23')](function(){return _0x4070dc;});}else{return _0x4070dc;}})[_0xe2b1('0x3d')](function(_0x5292b5){logger[_0xe2b1('0x26')](_0xe2b1('0x4f'),_0x5292b5);throw _0x5292b5;});}return _0x4070dc;})[_0xe2b1('0x23')](respondWithResult(_0x1ad455,0xc9))['catch'](handleError(_0x1ad455,null));}; \ No newline at end of file +var _0xd52d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','get','destroy','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','params','keys','catch','body','find','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0xd52d,0x95));var _0xdd52=function(_0x3120d3,_0x3350f8){_0x3120d3=_0x3120d3-0x0;var _0x38ce5d=_0xd52d[_0x3120d3];return _0x38ce5d;};'use strict';var emlformat=require(_0xdd52('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd52('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd52('0x2'));var moment=require(_0xdd52('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdd52('0x4'));var util=require(_0xdd52('0x5'));var path=require('path');var sox=require(_0xdd52('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd52('0x7'));var _=require(_0xdd52('0x8'));var squel=require(_0xdd52('0x9'));var crypto=require(_0xdd52('0xa'));var jsforce=require(_0xdd52('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd52('0xc'));var querystring=require(_0xdd52('0xd'));var Papa=require(_0xdd52('0xe'));var Redis=require(_0xdd52('0xf'));var authService=require(_0xdd52('0x10'));var qs=require(_0xdd52('0x11'));var as=require(_0xdd52('0x12'));var hardwareService=require(_0xdd52('0x13'));var logger=require('../../config/logger')(_0xdd52('0x14'));var utils=require(_0xdd52('0x15'));var config=require(_0xdd52('0x16'));var licenseUtil=require(_0xdd52('0x17'));var db=require(_0xdd52('0x18'))['db'];function respondWithStatusCode(_0x36952f,_0x1da86f){_0x1da86f=_0x1da86f||0xcc;return function(_0x3564ac){if(_0x3564ac){return _0x36952f[_0xdd52('0x19')](_0x1da86f);}return _0x36952f[_0xdd52('0x1a')](_0x1da86f)[_0xdd52('0x1b')]();};}function respondWithResult(_0x4cc74b,_0x417123){_0x417123=_0x417123||0xc8;return function(_0x5a649e){if(_0x5a649e){return _0x4cc74b[_0xdd52('0x1a')](_0x417123)[_0xdd52('0x1c')](_0x5a649e);}};}function respondWithFilteredResult(_0xb9e2c8,_0x28d9d9){return function(_0x4e9d32){if(_0x4e9d32){var _0x2d4d53=typeof _0x28d9d9[_0xdd52('0x1d')]==='undefined'&&typeof _0x28d9d9[_0xdd52('0x1e')]===_0xdd52('0x1f');var _0x13db77=_0x4e9d32[_0xdd52('0x20')];var _0x10b757=_0x2d4d53?0x0:_0x28d9d9[_0xdd52('0x1d')];var _0x5030c8=_0x2d4d53?_0x4e9d32[_0xdd52('0x20')]:_0x28d9d9['offset']+_0x28d9d9[_0xdd52('0x1e')];var _0x5a88ca;if(_0x5030c8>=_0x13db77){_0x5030c8=_0x13db77;_0x5a88ca=0xc8;}else{_0x5a88ca=0xce;}_0xb9e2c8[_0xdd52('0x1a')](_0x5a88ca);return _0xb9e2c8[_0xdd52('0x21')](_0xdd52('0x22'),_0x10b757+'-'+_0x5030c8+'/'+_0x13db77)[_0xdd52('0x1c')](_0x4e9d32);}return null;};}function patchUpdates(_0x23e3d5){return function(_0x258045){try{jsonpatch['apply'](_0x258045,_0x23e3d5,!![]);}catch(_0x33b7a9){return BPromise[_0xdd52('0x23')](_0x33b7a9);}return _0x258045['save']();};}function saveUpdates(_0x44108b,_0x27260d){return function(_0x4d84be){if(_0x4d84be){return _0x4d84be[_0xdd52('0x24')](_0x44108b)['then'](function(_0x4c6baf){return _0x4c6baf;});}return null;};}function removeEntity(_0x3c0a49,_0x17b8d7){return function(_0x4a0cef){if(_0x4a0cef){return _0x4a0cef['destroy']()[_0xdd52('0x25')](function(){var _0x3f7f6e=_0x4a0cef[_0xdd52('0x26')]({'plain':!![]});var _0x554fe5='CannedAnswers';return db['UserProfileResource'][_0xdd52('0x27')]({'where':{'type':_0x554fe5,'resourceId':_0x3f7f6e['id']}})[_0xdd52('0x25')](function(){return _0x4a0cef;});})['then'](function(){_0x3c0a49['status'](0xcc)[_0xdd52('0x1b')]();});}};}function handleEntityNotFound(_0x51ff92,_0x3e63fb){return function(_0x105788){if(!_0x105788){_0x51ff92[_0xdd52('0x19')](0x194);}return _0x105788;};}function handleError(_0x2d0ce6,_0x150aba){_0x150aba=_0x150aba||0x1f4;return function(_0x276b9f){logger[_0xdd52('0x28')](_0x276b9f[_0xdd52('0x29')]);if(_0x276b9f[_0xdd52('0x2a')]){delete _0x276b9f[_0xdd52('0x2a')];}_0x2d0ce6['status'](_0x150aba)[_0xdd52('0x2b')](_0x276b9f);};}exports[_0xdd52('0x2c')]=function(_0x35aeac,_0x48628b){var _0x38ca3b={},_0x4b112f={},_0x36079c={'count':0x0,'rows':[]};var _0x15fca2=_[_0xdd52('0x2d')](db[_0xdd52('0x2e')][_0xdd52('0x2f')],function(_0x14432e){return{'name':_0x14432e[_0xdd52('0x30')],'type':_0x14432e[_0xdd52('0x31')]['key']};});_0x4b112f['model']=_[_0xdd52('0x2d')](_0x15fca2,'name');_0x4b112f[_0xdd52('0x32')]=_['keys'](_0x35aeac['query']);_0x4b112f['filters']=_[_0xdd52('0x33')](_0x4b112f[_0xdd52('0x34')],_0x4b112f[_0xdd52('0x32')]);_0x38ca3b[_0xdd52('0x35')]=_[_0xdd52('0x33')](_0x4b112f[_0xdd52('0x34')],qs['fields'](_0x35aeac['query'][_0xdd52('0x36')]));_0x38ca3b['attributes']=_0x38ca3b[_0xdd52('0x35')][_0xdd52('0x37')]?_0x38ca3b[_0xdd52('0x35')]:_0x4b112f[_0xdd52('0x34')];if(!_0x35aeac[_0xdd52('0x32')][_0xdd52('0x38')](_0xdd52('0x39'))){_0x38ca3b['limit']=qs[_0xdd52('0x1e')](_0x35aeac[_0xdd52('0x32')][_0xdd52('0x1e')]);_0x38ca3b['offset']=qs[_0xdd52('0x1d')](_0x35aeac[_0xdd52('0x32')]['offset']);}_0x38ca3b[_0xdd52('0x3a')]=qs[_0xdd52('0x3b')](_0x35aeac[_0xdd52('0x32')][_0xdd52('0x3b')]);_0x38ca3b[_0xdd52('0x3c')]=qs[_0xdd52('0x3d')](_['pick'](_0x35aeac[_0xdd52('0x32')],_0x4b112f[_0xdd52('0x3d')]),_0x15fca2);if(_0x35aeac[_0xdd52('0x32')][_0xdd52('0x3e')]){_0x38ca3b[_0xdd52('0x3c')]=_[_0xdd52('0x3f')](_0x38ca3b['where'],{'$or':[{'key':{'$like':'%'+_0x35aeac[_0xdd52('0x32')][_0xdd52('0x3e')]+'%'}},{'value':{'$like':'%'+_0x35aeac[_0xdd52('0x32')][_0xdd52('0x3e')]+'%'}}]});}_0x38ca3b=_['merge']({},_0x38ca3b,_0x35aeac[_0xdd52('0x40')]);var _0x1eeca0={'where':_0x38ca3b[_0xdd52('0x3c')]};return db[_0xdd52('0x2e')][_0xdd52('0x20')](_0x1eeca0)[_0xdd52('0x25')](function(_0x13416c){_0x36079c[_0xdd52('0x20')]=_0x13416c;if(_0x35aeac[_0xdd52('0x32')][_0xdd52('0x41')]){_0x38ca3b[_0xdd52('0x42')]=[{'all':!![]}];}return db[_0xdd52('0x2e')][_0xdd52('0x43')](_0x38ca3b);})['then'](function(_0x529426){_0x36079c[_0xdd52('0x44')]=_0x529426;return _0x36079c;})['then'](respondWithFilteredResult(_0x48628b,_0x38ca3b))['catch'](handleError(_0x48628b,null));};exports['show']=function(_0x7d5a62,_0x2a1f09){var _0xe91c15={'raw':!![],'where':{'id':_0x7d5a62[_0xdd52('0x45')]['id']}},_0x508f89={};_0x508f89[_0xdd52('0x34')]=_[_0xdd52('0x46')](db['CannedAnswer'][_0xdd52('0x2f')]);_0x508f89['query']=_['keys'](_0x7d5a62[_0xdd52('0x32')]);_0x508f89[_0xdd52('0x3d')]=_[_0xdd52('0x33')](_0x508f89['model'],_0x508f89[_0xdd52('0x32')]);_0xe91c15[_0xdd52('0x35')]=_['intersection'](_0x508f89[_0xdd52('0x34')],qs[_0xdd52('0x36')](_0x7d5a62['query']['fields']));_0xe91c15[_0xdd52('0x35')]=_0xe91c15['attributes']['length']?_0xe91c15[_0xdd52('0x35')]:_0x508f89[_0xdd52('0x34')];if(_0x7d5a62[_0xdd52('0x32')][_0xdd52('0x41')]){_0xe91c15[_0xdd52('0x42')]=[{'all':!![]}];}_0xe91c15=_['merge']({},_0xe91c15,_0x7d5a62[_0xdd52('0x40')]);return db['CannedAnswer']['find'](_0xe91c15)['then'](handleEntityNotFound(_0x2a1f09,null))[_0xdd52('0x25')](respondWithResult(_0x2a1f09,null))[_0xdd52('0x47')](handleError(_0x2a1f09,null));};exports[_0xdd52('0x24')]=function(_0x2a08b4,_0x47883c){if(_0x2a08b4[_0xdd52('0x48')]['id']){delete _0x2a08b4[_0xdd52('0x48')]['id'];}return db[_0xdd52('0x2e')]['find']({'where':{'id':_0x2a08b4['params']['id']}})[_0xdd52('0x25')](handleEntityNotFound(_0x47883c,null))[_0xdd52('0x25')](saveUpdates(_0x2a08b4['body'],null))['then'](respondWithResult(_0x47883c,null))[_0xdd52('0x47')](handleError(_0x47883c,null));};exports[_0xdd52('0x27')]=function(_0x14716f,_0x7450b4){return db[_0xdd52('0x2e')][_0xdd52('0x49')]({'where':{'id':_0x14716f[_0xdd52('0x45')]['id']}})[_0xdd52('0x25')](handleEntityNotFound(_0x7450b4,null))[_0xdd52('0x25')](removeEntity(_0x7450b4,null))[_0xdd52('0x47')](handleError(_0x7450b4,null));};exports[_0xdd52('0x4a')]=function(_0x184902,_0x39f996){var _0xf91238={'key':_0x184902[_0xdd52('0x48')][_0xdd52('0x4b')]};if(_0x184902['body'][_0xdd52('0x4c')]){_0xf91238['MailAccountId']=_0x184902[_0xdd52('0x48')][_0xdd52('0x4c')];}else if(_0x184902[_0xdd52('0x48')]['SmsAccountId']){_0xf91238[_0xdd52('0x4d')]=_0x184902[_0xdd52('0x48')][_0xdd52('0x4d')];}else if(_0x184902[_0xdd52('0x48')][_0xdd52('0x4e')]){_0xf91238[_0xdd52('0x4e')]=_0x184902['body'][_0xdd52('0x4e')];}else if(_0x184902[_0xdd52('0x48')][_0xdd52('0x4f')]){_0xf91238[_0xdd52('0x4f')]=_0x184902[_0xdd52('0x48')][_0xdd52('0x4f')];}return db['CannedAnswer'][_0xdd52('0x49')]({'where':_0xf91238})['then'](function(_0x590c75){if(_0x590c75){throw new db['Sequelize']['ValidationError'](_0xdd52('0x50'));}return db['CannedAnswer'][_0xdd52('0x4a')](_0x184902[_0xdd52('0x48')]);})[_0xdd52('0x25')](function(_0x31c24a){var _0x2abf54=_0x184902[_0xdd52('0x51')][_0xdd52('0x26')]({'plain':!![]});if(!_0x2abf54)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2abf54['role']===_0xdd52('0x51')){var _0x38d31c=_0x31c24a[_0xdd52('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xdd52('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x2abf54[_0xdd52('0x52')]},'raw':!![]})['then'](function(_0x2feb57){if(_0x2feb57&&_0x2feb57[_0xdd52('0x53')]===0x0){return db[_0xdd52('0x54')][_0xdd52('0x4a')]({'name':_0x38d31c[_0xdd52('0x2a')],'resourceId':_0x38d31c['id'],'type':_0x2feb57[_0xdd52('0x2a')],'sectionId':_0x2feb57['id']},{})[_0xdd52('0x25')](function(){return _0x31c24a;});}else{return _0x31c24a;}})['catch'](function(_0x3660c1){logger[_0xdd52('0x28')](_0xdd52('0x55'),_0x3660c1);throw _0x3660c1;});}return _0x31c24a;})['then'](respondWithResult(_0x39f996,0xc9))['catch'](handleError(_0x39f996,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0fc1ca3..594bbd7 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 _0x1daa=['bluebird','request-promise','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x3daeb6,_0xb8cb46){var _0x4d7a95=function(_0x4b6613){while(--_0x4b6613){_0x3daeb6['push'](_0x3daeb6['shift']());}};_0x4d7a95(++_0xb8cb46);}(_0x1daa,0xce));var _0xa1da=function(_0x38651d,_0x5ca1bc){_0x38651d=_0x38651d-0x0;var _0x3f4c9b=_0x1daa[_0x38651d];return _0x3f4c9b;};'use strict';var _=require(_0xa1da('0x0'));var util=require(_0xa1da('0x1'));var logger=require(_0xa1da('0x2'))('api');var moment=require(_0xa1da('0x3'));var BPromise=require(_0xa1da('0x4'));var rp=require(_0xa1da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x8092e9,_0x95cdbb){return _0x8092e9[_0xa1da('0x6')](_0xa1da('0x7'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1da('0x8'),'collate':_0xa1da('0x9')});}; \ No newline at end of file +var _0xc0ec=['define','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x59b889,_0x4b026c){var _0x470d3f=function(_0x52eeb2){while(--_0x52eeb2){_0x59b889['push'](_0x59b889['shift']());}};_0x470d3f(++_0x4b026c);}(_0xc0ec,0x9f));var _0xcc0e=function(_0x597c8e,_0x398a0f){_0x597c8e=_0x597c8e-0x0;var _0xd70119=_0xc0ec[_0x597c8e];return _0xd70119;};'use strict';var _=require(_0xcc0e('0x0'));var util=require(_0xcc0e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc0e('0x2'));var BPromise=require(_0xcc0e('0x3'));var rp=require(_0xcc0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc0e('0x5'));var config=require(_0xcc0e('0x6'));var attributes=require(_0xcc0e('0x7'));module[_0xcc0e('0x8')]=function(_0x189281,_0x418f4b){return _0x189281[_0xcc0e('0x9')]('CannedAnswer',attributes,{'tableName':_0xcc0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xcc0e('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 710df69..ac06c8a 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(_0x4ec371,_0x3dbc42){var _0x4eb717=function(_0x52e416){while(--_0x52e416){_0x4ec371['push'](_0x4ec371['shift']());}};_0x4eb717(++_0x3dbc42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x1f373b,_0x37360f){var _0x4f7aa5=function(_0x5a3619){while(--_0x5a3619){_0x1f373b['push'](_0x1f373b['shift']());}};_0x4f7aa5(++_0x37360f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 0bed988..18a2be7 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 _0xd589=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x4d85db,_0x5933cb){var _0x11685c=function(_0x3e18d5){while(--_0x3e18d5){_0x4d85db['push'](_0x4d85db['shift']());}};_0x11685c(++_0x5933cb);}(_0xd589,0x80));var _0x9d58=function(_0x5b3df9,_0x4668e4){_0x5b3df9=_0x5b3df9-0x0;var _0x168ac4=_0xd589[_0x5b3df9];return _0x168ac4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9d58('0x0'));var timeout=require(_0x9d58('0x1'));var express=require(_0x9d58('0x2'));var router=express[_0x9d58('0x3')]();var fs_extra=require(_0x9d58('0x4'));var auth=require(_0x9d58('0x5'));var interaction=require(_0x9d58('0x6'));var config=require(_0x9d58('0x7'));var controller=require(_0x9d58('0x8'));router['get']('/',auth[_0x9d58('0x9')](),controller[_0x9d58('0xa')]);router[_0x9d58('0xb')](_0x9d58('0xc'),auth[_0x9d58('0x9')](),controller[_0x9d58('0xd')]);router[_0x9d58('0xe')]('/',auth[_0x9d58('0x9')](),controller[_0x9d58('0xf')]);router['put'](_0x9d58('0xc'),auth[_0x9d58('0x9')](),controller[_0x9d58('0x10')]);router[_0x9d58('0x11')](_0x9d58('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9d58('0x12')]=router; \ No newline at end of file +var _0xbbfc=['update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0x57ad41,_0x8d87ff){var _0x1d4965=function(_0x3a35b6){while(--_0x3a35b6){_0x57ad41['push'](_0x57ad41['shift']());}};_0x1d4965(++_0x8d87ff);}(_0xbbfc,0x1de));var _0xcbbf=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xbbfc[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0xcbbf('0x0'));var util=require(_0xcbbf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbbf('0x2'));var router=express[_0xcbbf('0x3')]();var fs_extra=require(_0xcbbf('0x4'));var auth=require(_0xcbbf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcbbf('0x6'));var controller=require(_0xcbbf('0x7'));router[_0xcbbf('0x8')]('/',auth['isAuthenticated'](),controller[_0xcbbf('0x9')]);router[_0xcbbf('0x8')]('/:id',auth[_0xcbbf('0xa')](),controller[_0xcbbf('0xb')]);router[_0xcbbf('0xc')]('/',auth[_0xcbbf('0xa')](),controller[_0xcbbf('0xd')]);router[_0xcbbf('0xe')](_0xcbbf('0xf'),auth['isAuthenticated'](),controller[_0xcbbf('0x10')]);router[_0xcbbf('0x11')](_0xcbbf('0xf'),auth['isAuthenticated'](),controller[_0xcbbf('0x12')]);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 b60b53f..267da8d 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 _0x5265=['DATE','STRING','INTEGER','sequelize','exports'];(function(_0xb6669a,_0x4e6bac){var _0x734d12=function(_0x23d870){while(--_0x23d870){_0xb6669a['push'](_0xb6669a['shift']());}};_0x734d12(++_0x4e6bac);}(_0x5265,0x10c));var _0x5526=function(_0x4379d5,_0x4c18a0){_0x4379d5=_0x4379d5-0x0;var _0x30cb80=_0x5265[_0x4379d5];return _0x30cb80;};'use strict';var Sequelize=require(_0x5526('0x0'));module[_0x5526('0x1')]={'calldate':{'type':Sequelize[_0x5526('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x5526('0x3')]},'dst':{'type':Sequelize[_0x5526('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5526('0x3')]},'dstchannel':{'type':Sequelize[_0x5526('0x3')]},'lastapp':{'type':Sequelize[_0x5526('0x3')]},'lastdata':{'type':Sequelize[_0x5526('0x3')]},'duration':{'type':Sequelize[_0x5526('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5526('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x5526('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5526('0x3')]},'userfield':{'type':Sequelize[_0x5526('0x3')]},'uniqueid':{'type':Sequelize[_0x5526('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x5526('0x3')]},'peeraccount':{'type':Sequelize[_0x5526('0x3')]},'type':{'type':Sequelize[_0x5526('0x3')]},'tag':{'type':Sequelize[_0x5526('0x3')]}}; \ No newline at end of file +var _0xb5cd=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x5806c3,_0x5105d8){var _0x48ac77=function(_0x4826ec){while(--_0x4826ec){_0x5806c3['push'](_0x5806c3['shift']());}};_0x48ac77(++_0x5105d8);}(_0xb5cd,0x134));var _0xdb5c=function(_0x3bd305,_0x2de198){_0x3bd305=_0x3bd305-0x0;var _0x4f9dfc=_0xb5cd[_0x3bd305];return _0x4f9dfc;};'use strict';var Sequelize=require(_0xdb5c('0x0'));module[_0xdb5c('0x1')]={'calldate':{'type':Sequelize[_0xdb5c('0x2')],'allowNull':![],'defaultValue':_0xdb5c('0x3')},'clid':{'type':Sequelize[_0xdb5c('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xdb5c('0x4')]},'dcontext':{'type':Sequelize[_0xdb5c('0x4')]},'channel':{'type':Sequelize[_0xdb5c('0x4')]},'dstchannel':{'type':Sequelize[_0xdb5c('0x4')]},'lastapp':{'type':Sequelize[_0xdb5c('0x4')]},'lastdata':{'type':Sequelize[_0xdb5c('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdb5c('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdb5c('0x4')]},'amaflags':{'type':Sequelize[_0xdb5c('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdb5c('0x4')]},'linkedid':{'type':Sequelize[_0xdb5c('0x4')]},'sequence':{'type':Sequelize[_0xdb5c('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdb5c('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b7d4a5c..b5cecd4 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 _0x6363=['destroy','describe','eml-format','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/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','index','map','Cdr','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6363,0x13a));var _0x3636=function(_0x163157,_0x53c0dc){_0x163157=_0x163157-0x0;var _0x1e1796=_0x6363[_0x163157];return _0x1e1796;};'use strict';var emlformat=require(_0x3636('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3636('0x1'));var jsonpatch=require(_0x3636('0x2'));var rp=require(_0x3636('0x3'));var moment=require(_0x3636('0x4'));var BPromise=require(_0x3636('0x5'));var Mustache=require(_0x3636('0x6'));var util=require(_0x3636('0x7'));var path=require(_0x3636('0x8'));var sox=require(_0x3636('0x9'));var csv=require(_0x3636('0xa'));var ejs=require(_0x3636('0xb'));var fs=require('fs');var fs_extra=require(_0x3636('0xc'));var _=require(_0x3636('0xd'));var squel=require(_0x3636('0xe'));var crypto=require('crypto');var jsforce=require(_0x3636('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3636('0xa'));var querystring=require(_0x3636('0x10'));var Papa=require(_0x3636('0x11'));var Redis=require(_0x3636('0x12'));var authService=require(_0x3636('0x13'));var qs=require(_0x3636('0x14'));var as=require(_0x3636('0x15'));var hardwareService=require(_0x3636('0x16'));var logger=require(_0x3636('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x3636('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3636('0x19'))['db'];function respondWithStatusCode(_0x41ddae,_0x62d6f9){_0x62d6f9=_0x62d6f9||0xcc;return function(_0x13ca35){if(_0x13ca35){return _0x41ddae[_0x3636('0x1a')](_0x62d6f9);}return _0x41ddae[_0x3636('0x1b')](_0x62d6f9)[_0x3636('0x1c')]();};}function respondWithResult(_0x12dfa9,_0x3295ab){_0x3295ab=_0x3295ab||0xc8;return function(_0x7b4b16){if(_0x7b4b16){return _0x12dfa9[_0x3636('0x1b')](_0x3295ab)[_0x3636('0x1d')](_0x7b4b16);}};}function respondWithFilteredResult(_0xcb2aa3,_0x3fc712){return function(_0x23cc34){if(_0x23cc34){var _0x3cbd0d=typeof _0x3fc712[_0x3636('0x1e')]==='undefined'&&typeof _0x3fc712[_0x3636('0x1f')]===_0x3636('0x20');var _0x4aa7fc=_0x23cc34[_0x3636('0x21')];var _0x5aa0ff=_0x3cbd0d?0x0:_0x3fc712['offset'];var _0xae6469=_0x3cbd0d?_0x23cc34[_0x3636('0x21')]:_0x3fc712[_0x3636('0x1e')]+_0x3fc712[_0x3636('0x1f')];var _0xe0e633;if(_0xae6469>=_0x4aa7fc){_0xae6469=_0x4aa7fc;_0xe0e633=0xc8;}else{_0xe0e633=0xce;}_0xcb2aa3[_0x3636('0x1b')](_0xe0e633);return _0xcb2aa3[_0x3636('0x22')](_0x3636('0x23'),_0x5aa0ff+'-'+_0xae6469+'/'+_0x4aa7fc)['json'](_0x23cc34);}return null;};}function patchUpdates(_0x48f598){return function(_0x316930){try{jsonpatch[_0x3636('0x24')](_0x316930,_0x48f598,!![]);}catch(_0x42b271){return BPromise['reject'](_0x42b271);}return _0x316930[_0x3636('0x25')]();};}function saveUpdates(_0xa46471,_0x15a0b3){return function(_0xe34cd9){if(_0xe34cd9){return _0xe34cd9[_0x3636('0x26')](_0xa46471)[_0x3636('0x27')](function(_0x4f5b0e){return _0x4f5b0e;});}return null;};}function removeEntity(_0x517fda,_0x368356){return function(_0x4ee098){if(_0x4ee098){return _0x4ee098['destroy']()[_0x3636('0x27')](function(){_0x517fda['status'](0xcc)[_0x3636('0x1c')]();});}};}function handleEntityNotFound(_0x4c24cf,_0x36f4c5){return function(_0x477c34){if(!_0x477c34){_0x4c24cf[_0x3636('0x1a')](0x194);}return _0x477c34;};}function handleError(_0x201ea1,_0x112b96){_0x112b96=_0x112b96||0x1f4;return function(_0x20ca8b){logger[_0x3636('0x28')](_0x20ca8b[_0x3636('0x29')]);if(_0x20ca8b[_0x3636('0x2a')]){delete _0x20ca8b[_0x3636('0x2a')];}_0x201ea1[_0x3636('0x1b')](_0x112b96)['send'](_0x20ca8b);};}exports[_0x3636('0x2b')]=function(_0x236f54,_0x2d644c){var _0x22b12f={},_0xd37c62={},_0x17e062={'count':0x0,'rows':[]};var _0x52ad91=_[_0x3636('0x2c')](db[_0x3636('0x2d')]['rawAttributes'],function(_0x8fffb0){return{'name':_0x8fffb0[_0x3636('0x2e')],'type':_0x8fffb0[_0x3636('0x2f')][_0x3636('0x30')]};});_0xd37c62[_0x3636('0x31')]=_['map'](_0x52ad91,_0x3636('0x2a'));_0xd37c62[_0x3636('0x32')]=_[_0x3636('0x33')](_0x236f54[_0x3636('0x32')]);_0xd37c62[_0x3636('0x34')]=_[_0x3636('0x35')](_0xd37c62[_0x3636('0x31')],_0xd37c62[_0x3636('0x32')]);_0x22b12f[_0x3636('0x36')]=_['intersection'](_0xd37c62['model'],qs[_0x3636('0x37')](_0x236f54['query']['fields']));_0x22b12f[_0x3636('0x36')]=_0x22b12f[_0x3636('0x36')][_0x3636('0x38')]?_0x22b12f['attributes']:_0xd37c62[_0x3636('0x31')];if(!_0x236f54[_0x3636('0x32')][_0x3636('0x39')](_0x3636('0x3a'))){_0x22b12f[_0x3636('0x1f')]=qs[_0x3636('0x1f')](_0x236f54[_0x3636('0x32')][_0x3636('0x1f')]);_0x22b12f[_0x3636('0x1e')]=qs[_0x3636('0x1e')](_0x236f54[_0x3636('0x32')][_0x3636('0x1e')]);}_0x22b12f[_0x3636('0x3b')]=qs['sort'](_0x236f54[_0x3636('0x32')][_0x3636('0x3c')]);_0x22b12f[_0x3636('0x3d')]=qs[_0x3636('0x34')](_['pick'](_0x236f54['query'],_0xd37c62[_0x3636('0x34')]),_0x52ad91);if(_0x236f54[_0x3636('0x32')][_0x3636('0x3e')]){_0x22b12f['where']=_[_0x3636('0x3f')](_0x22b12f[_0x3636('0x3d')],{'$or':_['map'](_0x52ad91,function(_0x58f03d){if(_0x58f03d[_0x3636('0x2f')]!=='VIRTUAL'){var _0x8c04cf={};_0x8c04cf[_0x58f03d[_0x3636('0x2a')]]={'$like':'%'+_0x236f54[_0x3636('0x32')][_0x3636('0x3e')]+'%'};return _0x8c04cf;}})});}_0x22b12f=_[_0x3636('0x3f')]({},_0x22b12f,_0x236f54[_0x3636('0x40')]);var _0x448397={'where':_0x22b12f[_0x3636('0x3d')]};return db[_0x3636('0x2d')]['count'](_0x448397)[_0x3636('0x27')](function(_0x44cb9c){_0x17e062[_0x3636('0x21')]=_0x44cb9c;if(_0x236f54[_0x3636('0x32')][_0x3636('0x41')]){_0x22b12f[_0x3636('0x42')]=[{'all':!![]}];}return db[_0x3636('0x2d')][_0x3636('0x43')](_0x22b12f);})[_0x3636('0x27')](function(_0x4df331){_0x17e062[_0x3636('0x44')]=_0x4df331;return _0x17e062;})[_0x3636('0x27')](respondWithFilteredResult(_0x2d644c,_0x22b12f))[_0x3636('0x45')](handleError(_0x2d644c,null));};exports[_0x3636('0x46')]=function(_0x9c59e0,_0x122cb2){var _0x201e2c={'raw':!![],'where':{'id':_0x9c59e0[_0x3636('0x47')]['id']}},_0x401281={};_0x401281[_0x3636('0x31')]=_[_0x3636('0x33')](db[_0x3636('0x2d')][_0x3636('0x48')]);_0x401281[_0x3636('0x32')]=_[_0x3636('0x33')](_0x9c59e0['query']);_0x401281[_0x3636('0x34')]=_[_0x3636('0x35')](_0x401281[_0x3636('0x31')],_0x401281[_0x3636('0x32')]);_0x201e2c[_0x3636('0x36')]=_[_0x3636('0x35')](_0x401281[_0x3636('0x31')],qs[_0x3636('0x37')](_0x9c59e0[_0x3636('0x32')][_0x3636('0x37')]));_0x201e2c[_0x3636('0x36')]=_0x201e2c[_0x3636('0x36')][_0x3636('0x38')]?_0x201e2c['attributes']:_0x401281['model'];if(_0x9c59e0['query'][_0x3636('0x41')]){_0x201e2c['include']=[{'all':!![]}];}_0x201e2c=_['merge']({},_0x201e2c,_0x9c59e0[_0x3636('0x40')]);return db[_0x3636('0x2d')][_0x3636('0x49')](_0x201e2c)['then'](handleEntityNotFound(_0x122cb2,null))[_0x3636('0x27')](respondWithResult(_0x122cb2,null))[_0x3636('0x45')](handleError(_0x122cb2,null));};exports[_0x3636('0x4a')]=function(_0x179410,_0x37a33e){return db[_0x3636('0x2d')][_0x3636('0x4a')](_0x179410[_0x3636('0x4b')],{})[_0x3636('0x27')](respondWithResult(_0x37a33e,0xc9))['catch'](handleError(_0x37a33e,null));};exports[_0x3636('0x26')]=function(_0x33c140,_0x16b65a){if(_0x33c140[_0x3636('0x4b')]['id']){delete _0x33c140[_0x3636('0x4b')]['id'];}return db[_0x3636('0x2d')]['find']({'where':{'id':_0x33c140[_0x3636('0x47')]['id']}})[_0x3636('0x27')](handleEntityNotFound(_0x16b65a,null))[_0x3636('0x27')](saveUpdates(_0x33c140[_0x3636('0x4b')],null))[_0x3636('0x27')](respondWithResult(_0x16b65a,null))['catch'](handleError(_0x16b65a,null));};exports[_0x3636('0x4c')]=function(_0x285ff1,_0xa61651){return db[_0x3636('0x2d')][_0x3636('0x49')]({'where':{'id':_0x285ff1['params']['id']}})[_0x3636('0x27')](handleEntityNotFound(_0xa61651,null))['then'](removeEntity(_0xa61651,null))['catch'](handleError(_0xa61651,null));};exports[_0x3636('0x4d')]=function(_0x1c1ec0,_0x2575ba){return db[_0x3636('0x2d')]['describe']()['then'](respondWithResult(_0x2575ba,null))[_0x3636('0x45')](handleError(_0x2575ba,null));}; \ No newline at end of file +var _0xe015=['type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','limit','set','Content-Range','json','reject','update','then','destroy','name','send','index','Cdr','rawAttributes'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0xe015,0x13b));var _0x5e01=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe015[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x5e01('0x0'));var rimraf=require(_0x5e01('0x1'));var zipdir=require(_0x5e01('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e01('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5e01('0x4'));var util=require(_0x5e01('0x5'));var path=require(_0x5e01('0x6'));var sox=require(_0x5e01('0x7'));var csv=require('to-csv');var ejs=require(_0x5e01('0x8'));var fs=require('fs');var fs_extra=require(_0x5e01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e01('0xa'));var jsforce=require(_0x5e01('0xb'));var deskjs=require(_0x5e01('0xc'));var toCsv=require(_0x5e01('0xd'));var querystring=require(_0x5e01('0xe'));var Papa=require(_0x5e01('0xf'));var Redis=require('ioredis');var authService=require(_0x5e01('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5e01('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e01('0x12'))(_0x5e01('0x13'));var utils=require('../../config/utils');var config=require(_0x5e01('0x14'));var licenseUtil=require(_0x5e01('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x560ae2,_0x3d0b04){_0x3d0b04=_0x3d0b04||0xcc;return function(_0x160f79){if(_0x160f79){return _0x560ae2[_0x5e01('0x16')](_0x3d0b04);}return _0x560ae2[_0x5e01('0x17')](_0x3d0b04)[_0x5e01('0x18')]();};}function respondWithResult(_0x16bc8f,_0x4bd426){_0x4bd426=_0x4bd426||0xc8;return function(_0x36da26){if(_0x36da26){return _0x16bc8f['status'](_0x4bd426)['json'](_0x36da26);}};}function respondWithFilteredResult(_0x1df2e0,_0x2dd70c){return function(_0x494b8a){if(_0x494b8a){var _0x27c6e7=typeof _0x2dd70c['offset']===_0x5e01('0x19')&&typeof _0x2dd70c['limit']===_0x5e01('0x19');var _0x5d85e3=_0x494b8a[_0x5e01('0x1a')];var _0x5eda1d=_0x27c6e7?0x0:_0x2dd70c['offset'];var _0x35a002=_0x27c6e7?_0x494b8a[_0x5e01('0x1a')]:_0x2dd70c['offset']+_0x2dd70c[_0x5e01('0x1b')];var _0x2df752;if(_0x35a002>=_0x5d85e3){_0x35a002=_0x5d85e3;_0x2df752=0xc8;}else{_0x2df752=0xce;}_0x1df2e0[_0x5e01('0x17')](_0x2df752);return _0x1df2e0[_0x5e01('0x1c')](_0x5e01('0x1d'),_0x5eda1d+'-'+_0x35a002+'/'+_0x5d85e3)[_0x5e01('0x1e')](_0x494b8a);}return null;};}function patchUpdates(_0x173410){return function(_0x153eb1){try{jsonpatch['apply'](_0x153eb1,_0x173410,!![]);}catch(_0x150ebf){return BPromise[_0x5e01('0x1f')](_0x150ebf);}return _0x153eb1['save']();};}function saveUpdates(_0xf6fe3f,_0x306cff){return function(_0x337ad2){if(_0x337ad2){return _0x337ad2[_0x5e01('0x20')](_0xf6fe3f)[_0x5e01('0x21')](function(_0x284803){return _0x284803;});}return null;};}function removeEntity(_0x5efff9,_0x329315){return function(_0x720922){if(_0x720922){return _0x720922[_0x5e01('0x22')]()[_0x5e01('0x21')](function(){_0x5efff9['status'](0xcc)[_0x5e01('0x18')]();});}};}function handleEntityNotFound(_0x23264f,_0x31eb7f){return function(_0x4f94d0){if(!_0x4f94d0){_0x23264f[_0x5e01('0x16')](0x194);}return _0x4f94d0;};}function handleError(_0x23454e,_0x12a19a){_0x12a19a=_0x12a19a||0x1f4;return function(_0x28344a){logger['error'](_0x28344a['stack']);if(_0x28344a[_0x5e01('0x23')]){delete _0x28344a['name'];}_0x23454e[_0x5e01('0x17')](_0x12a19a)[_0x5e01('0x24')](_0x28344a);};}exports[_0x5e01('0x25')]=function(_0xc26cf8,_0x592a61){var _0x531f0a={},_0x4a4a9f={},_0x51a98d={'count':0x0,'rows':[]};var _0x350ab4=_['map'](db[_0x5e01('0x26')][_0x5e01('0x27')],function(_0xc6d3c2){return{'name':_0xc6d3c2['fieldName'],'type':_0xc6d3c2[_0x5e01('0x28')][_0x5e01('0x29')]};});_0x4a4a9f[_0x5e01('0x2a')]=_[_0x5e01('0x2b')](_0x350ab4,'name');_0x4a4a9f['query']=_[_0x5e01('0x2c')](_0xc26cf8[_0x5e01('0x2d')]);_0x4a4a9f[_0x5e01('0x2e')]=_[_0x5e01('0x2f')](_0x4a4a9f[_0x5e01('0x2a')],_0x4a4a9f[_0x5e01('0x2d')]);_0x531f0a[_0x5e01('0x30')]=_[_0x5e01('0x2f')](_0x4a4a9f[_0x5e01('0x2a')],qs[_0x5e01('0x31')](_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x31')]));_0x531f0a['attributes']=_0x531f0a[_0x5e01('0x30')][_0x5e01('0x32')]?_0x531f0a[_0x5e01('0x30')]:_0x4a4a9f['model'];if(!_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x33')]('nolimit')){_0x531f0a[_0x5e01('0x1b')]=qs[_0x5e01('0x1b')](_0xc26cf8[_0x5e01('0x2d')]['limit']);_0x531f0a[_0x5e01('0x34')]=qs[_0x5e01('0x34')](_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x34')]);}_0x531f0a[_0x5e01('0x35')]=qs[_0x5e01('0x36')](_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x36')]);_0x531f0a[_0x5e01('0x37')]=qs[_0x5e01('0x2e')](_[_0x5e01('0x38')](_0xc26cf8[_0x5e01('0x2d')],_0x4a4a9f[_0x5e01('0x2e')]),_0x350ab4);if(_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x39')]){_0x531f0a['where']=_[_0x5e01('0x3a')](_0x531f0a['where'],{'$or':_['map'](_0x350ab4,function(_0x34e8f5){if(_0x34e8f5[_0x5e01('0x28')]!==_0x5e01('0x3b')){var _0x117fb3={};_0x117fb3[_0x34e8f5[_0x5e01('0x23')]]={'$like':'%'+_0xc26cf8['query'][_0x5e01('0x39')]+'%'};return _0x117fb3;}})});}_0x531f0a=_[_0x5e01('0x3a')]({},_0x531f0a,_0xc26cf8['options']);var _0x3c37d5={'where':_0x531f0a[_0x5e01('0x37')]};return db[_0x5e01('0x26')]['count'](_0x3c37d5)[_0x5e01('0x21')](function(_0xfed2d2){_0x51a98d['count']=_0xfed2d2;if(_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x3c')]){_0x531f0a['include']=[{'all':!![]}];}return db['Cdr'][_0x5e01('0x3d')](_0x531f0a);})['then'](function(_0x2d7423){_0x51a98d[_0x5e01('0x3e')]=_0x2d7423;return _0x51a98d;})[_0x5e01('0x21')](respondWithFilteredResult(_0x592a61,_0x531f0a))[_0x5e01('0x3f')](handleError(_0x592a61,null));};exports['show']=function(_0x296d33,_0xb93846){var _0x23275f={'raw':!![],'where':{'id':_0x296d33[_0x5e01('0x40')]['id']}},_0x44a5e4={};_0x44a5e4[_0x5e01('0x2a')]=_[_0x5e01('0x2c')](db['Cdr'][_0x5e01('0x27')]);_0x44a5e4[_0x5e01('0x2d')]=_[_0x5e01('0x2c')](_0x296d33[_0x5e01('0x2d')]);_0x44a5e4[_0x5e01('0x2e')]=_['intersection'](_0x44a5e4[_0x5e01('0x2a')],_0x44a5e4[_0x5e01('0x2d')]);_0x23275f[_0x5e01('0x30')]=_[_0x5e01('0x2f')](_0x44a5e4[_0x5e01('0x2a')],qs[_0x5e01('0x31')](_0x296d33[_0x5e01('0x2d')]['fields']));_0x23275f[_0x5e01('0x30')]=_0x23275f['attributes'][_0x5e01('0x32')]?_0x23275f[_0x5e01('0x30')]:_0x44a5e4[_0x5e01('0x2a')];if(_0x296d33[_0x5e01('0x2d')][_0x5e01('0x3c')]){_0x23275f[_0x5e01('0x41')]=[{'all':!![]}];}_0x23275f=_['merge']({},_0x23275f,_0x296d33[_0x5e01('0x42')]);return db['Cdr'][_0x5e01('0x43')](_0x23275f)[_0x5e01('0x21')](handleEntityNotFound(_0xb93846,null))[_0x5e01('0x21')](respondWithResult(_0xb93846,null))[_0x5e01('0x3f')](handleError(_0xb93846,null));};exports[_0x5e01('0x44')]=function(_0x1fbb1f,_0x555204){return db['Cdr'][_0x5e01('0x44')](_0x1fbb1f[_0x5e01('0x45')],{})[_0x5e01('0x21')](respondWithResult(_0x555204,0xc9))[_0x5e01('0x3f')](handleError(_0x555204,null));};exports[_0x5e01('0x20')]=function(_0x389520,_0x661d){if(_0x389520[_0x5e01('0x45')]['id']){delete _0x389520[_0x5e01('0x45')]['id'];}return db[_0x5e01('0x26')][_0x5e01('0x43')]({'where':{'id':_0x389520['params']['id']}})[_0x5e01('0x21')](handleEntityNotFound(_0x661d,null))[_0x5e01('0x21')](saveUpdates(_0x389520[_0x5e01('0x45')],null))['then'](respondWithResult(_0x661d,null))[_0x5e01('0x3f')](handleError(_0x661d,null));};exports[_0x5e01('0x22')]=function(_0x3fd5ac,_0xa8ff1b){return db[_0x5e01('0x26')]['find']({'where':{'id':_0x3fd5ac[_0x5e01('0x40')]['id']}})['then'](handleEntityNotFound(_0xa8ff1b,null))[_0x5e01('0x21')](removeEntity(_0xa8ff1b,null))[_0x5e01('0x3f')](handleError(_0xa8ff1b,null));};exports[_0x5e01('0x46')]=function(_0x4c368c,_0x11b36f){return db[_0x5e01('0x26')][_0x5e01('0x46')]()[_0x5e01('0x21')](respondWithResult(_0x11b36f,null))[_0x5e01('0x3f')](handleError(_0x11b36f,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 01763e8..3ee29bc 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3be4e4,_0x5dd6fb){var _0x17fc2f=function(_0x17320d){while(--_0x17320d){_0x3be4e4['push'](_0x3be4e4['shift']());}};_0x17fc2f(++_0x5dd6fb);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3fab4b,_0x5eba6e){var _0x564570=function(_0x4b51b8){while(--_0x4b51b8){_0x3fab4b['push'](_0x3fab4b['shift']());}};_0x564570(++_0x5eba6e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 2210ff8..4b77297 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 _0x4b4c=['Cdr,\x20%s,\x20%s,\x20%s','stringify','code','Cdr,\x20%s,\x20%s','error','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','request\x20sent','debug'];(function(_0x4d4f4f,_0x32b2e2){var _0x5d48bc=function(_0x5a15de){while(--_0x5a15de){_0x4d4f4f['push'](_0x4d4f4f['shift']());}};_0x5d48bc(++_0x32b2e2);}(_0x4b4c,0x80));var _0xc4b4=function(_0x4559ad,_0x2eba0c){_0x4559ad=_0x4559ad-0x0;var _0x392de1=_0x4b4c[_0x4559ad];return _0x392de1;};'use strict';var _=require('lodash');var util=require(_0xc4b4('0x0'));var moment=require(_0xc4b4('0x1'));var BPromise=require('bluebird');var rs=require(_0xc4b4('0x2'));var fs=require('fs');var Redis=require(_0xc4b4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4b4('0x4'));var logger=require(_0xc4b4('0x5'))('rpc');var config=require(_0xc4b4('0x6'));var jayson=require(_0xc4b4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46cda2,_0x330940,_0x1eab66){return new BPromise(function(_0x3d31ec,_0x443d2e){return client['request'](_0x46cda2,_0x1eab66)[_0xc4b4('0x8')](function(_0x108893){logger[_0xc4b4('0x9')]('Cdr,\x20%s,\x20%s',_0x330940,_0xc4b4('0xa'));logger[_0xc4b4('0xb')](_0xc4b4('0xc'),_0x330940,'request\x20sent',JSON[_0xc4b4('0xd')](_0x108893));if(_0x108893['error']){if(_0x108893['error'][_0xc4b4('0xe')]===0x1f4){logger['error'](_0xc4b4('0xf'),_0x330940,_0x108893[_0xc4b4('0x10')]['message']);return _0x443d2e(_0x108893['error'][_0xc4b4('0x11')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x330940,_0x108893['error'][_0xc4b4('0x11')]);return _0x3d31ec(_0x108893[_0xc4b4('0x10')][_0xc4b4('0x11')]);}else{logger[_0xc4b4('0x9')]('Cdr,\x20%s,\x20%s',_0x330940,_0xc4b4('0xa'));_0x3d31ec(_0x108893[_0xc4b4('0x12')][_0xc4b4('0x11')]);}})[_0xc4b4('0x13')](function(_0x1460b4){logger[_0xc4b4('0x10')](_0xc4b4('0xf'),_0x330940,_0x1460b4);_0x443d2e(_0x1460b4);});});} \ No newline at end of file +var _0x4edc=['../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x1c3386,_0x2868c0){var _0x2cc8e9=function(_0x556aa2){while(--_0x556aa2){_0x1c3386['push'](_0x1c3386['shift']());}};_0x2cc8e9(++_0x2868c0);}(_0x4edc,0x14e));var _0xc4ed=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x4edc[_0x16771d];return _0x386f11;};'use strict';var _=require('lodash');var util=require(_0xc4ed('0x0'));var moment=require(_0xc4ed('0x1'));var BPromise=require(_0xc4ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4ed('0x3'));var db=require(_0xc4ed('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc4ed('0x5'));var config=require(_0xc4ed('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc4ed('0x7')][_0xc4ed('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c84cc,_0x3b480d,_0xc0b02c){return new BPromise(function(_0x18e271,_0x4091ca){return client[_0xc4ed('0x9')](_0x1c84cc,_0xc0b02c)[_0xc4ed('0xa')](function(_0x299804){logger[_0xc4ed('0xb')](_0xc4ed('0xc'),_0x3b480d,_0xc4ed('0xd'));logger['debug'](_0xc4ed('0xe'),_0x3b480d,'request\x20sent',JSON['stringify'](_0x299804));if(_0x299804[_0xc4ed('0xf')]){if(_0x299804[_0xc4ed('0xf')][_0xc4ed('0x10')]===0x1f4){logger['error'](_0xc4ed('0xc'),_0x3b480d,_0x299804[_0xc4ed('0xf')][_0xc4ed('0x11')]);return _0x4091ca(_0x299804['error'][_0xc4ed('0x11')]);}logger[_0xc4ed('0xf')](_0xc4ed('0xc'),_0x3b480d,_0x299804[_0xc4ed('0xf')][_0xc4ed('0x11')]);return _0x18e271(_0x299804[_0xc4ed('0xf')][_0xc4ed('0x11')]);}else{logger[_0xc4ed('0xb')](_0xc4ed('0xc'),_0x3b480d,_0xc4ed('0xd'));_0x18e271(_0x299804[_0xc4ed('0x12')]['message']);}})[_0xc4ed('0x13')](function(_0x1d1d2f){logger['error'](_0xc4ed('0xc'),_0x3b480d,_0x1d1d2f);_0x4091ca(_0x1d1d2f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 8ad410d..4b2bc72 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 _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(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),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 +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(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 c9bdaf8..deeaf90 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 _0x6556=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x44d87e,_0x236f5a){var _0x53a1b4=function(_0x591cf2){while(--_0x591cf2){_0x44d87e['push'](_0x44d87e['shift']());}};_0x53a1b4(++_0x236f5a);}(_0x6556,0x7a));var _0x6655=function(_0x1720ed,_0x585710){_0x1720ed=_0x1720ed-0x0;var _0x449644=_0x6556[_0x1720ed];return _0x449644;};'use strict';var Sequelize=require(_0x6655('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6655('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6655('0x2')],'allowNull':![],'defaultValue':_0x6655('0x3')},'appdata':{'type':Sequelize[_0x6655('0x4')]()},'description':{'type':Sequelize[_0x6655('0x2')]},'interval':{'type':Sequelize[_0x6655('0x2')],'defaultValue':_0x6655('0x5')}}; \ No newline at end of file +var _0xfac2=['*,*,*,*','INTEGER','STRING','noop','TEXT'];(function(_0x428a63,_0x5c8b4c){var _0x6662ad=function(_0x4c1eaa){while(--_0x4c1eaa){_0x428a63['push'](_0x428a63['shift']());}};_0x6662ad(++_0x5c8b4c);}(_0xfac2,0xbf));var _0x2fac=function(_0x3950ba,_0x5a473a){_0x3950ba=_0x3950ba-0x0;var _0x38c4c5=_0xfac2[_0x3950ba];return _0x38c4c5;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x2fac('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x2fac('0x1')],'allowNull':![],'defaultValue':_0x2fac('0x2')},'appdata':{'type':Sequelize[_0x2fac('0x3')]()},'description':{'type':Sequelize[_0x2fac('0x1')]},'interval':{'type':Sequelize[_0x2fac('0x1')],'defaultValue':_0x2fac('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 3431de4..aeee7e9 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 _0xbee3=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','find','catch','body','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbee3,0xd5));var _0x3bee=function(_0x1e0b23,_0x447f13){_0x1e0b23=_0x1e0b23-0x0;var _0x9e049c=_0xbee3[_0x1e0b23];return _0x9e049c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];function respondWithStatusCode(_0x407526,_0x6950d0){_0x6950d0=_0x6950d0||0xcc;return function(_0x410124){if(_0x410124){return _0x407526[_0x3bee('0x17')](_0x6950d0);}return _0x407526[_0x3bee('0x18')](_0x6950d0)['end']();};}function respondWithResult(_0xad01f9,_0x33504d){_0x33504d=_0x33504d||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0xad01f9[_0x3bee('0x18')](_0x33504d)[_0x3bee('0x19')](_0x31ac52);}};}function respondWithFilteredResult(_0x5b9473,_0x558436){return function(_0x346767){if(_0x346767){var _0x515397=typeof _0x558436[_0x3bee('0x1a')]===_0x3bee('0x1b')&&typeof _0x558436['limit']==='undefined';var _0x1582a4=_0x346767[_0x3bee('0x1c')];var _0xfdba3b=_0x515397?0x0:_0x558436[_0x3bee('0x1a')];var _0x49095a=_0x515397?_0x346767[_0x3bee('0x1c')]:_0x558436[_0x3bee('0x1a')]+_0x558436[_0x3bee('0x1d')];var _0x49b32d;if(_0x49095a>=_0x1582a4){_0x49095a=_0x1582a4;_0x49b32d=0xc8;}else{_0x49b32d=0xce;}_0x5b9473[_0x3bee('0x18')](_0x49b32d);return _0x5b9473[_0x3bee('0x1e')](_0x3bee('0x1f'),_0xfdba3b+'-'+_0x49095a+'/'+_0x1582a4)['json'](_0x346767);}return null;};}function patchUpdates(_0x4f36af){return function(_0x1afd0f){try{jsonpatch[_0x3bee('0x20')](_0x1afd0f,_0x4f36af,!![]);}catch(_0x57aba4){return BPromise[_0x3bee('0x21')](_0x57aba4);}return _0x1afd0f[_0x3bee('0x22')]();};}function saveUpdates(_0x2eea75,_0x179e62){return function(_0x28c248){if(_0x28c248){return _0x28c248[_0x3bee('0x23')](_0x2eea75)[_0x3bee('0x24')](function(_0x582fa9){return _0x582fa9;});}return null;};}function removeEntity(_0x8ae4ca,_0x1ed0c1){return function(_0x1fed5a){if(_0x1fed5a){return _0x1fed5a[_0x3bee('0x25')]()['then'](function(){_0x8ae4ca[_0x3bee('0x18')](0xcc)[_0x3bee('0x26')]();});}};}function handleEntityNotFound(_0x1e0111,_0x4b4cd4){return function(_0x5ed022){if(!_0x5ed022){_0x1e0111[_0x3bee('0x17')](0x194);}return _0x5ed022;};}function handleError(_0x479f45,_0x5341e2){_0x5341e2=_0x5341e2||0x1f4;return function(_0x2c0e50){logger[_0x3bee('0x27')](_0x2c0e50[_0x3bee('0x28')]);if(_0x2c0e50['name']){delete _0x2c0e50[_0x3bee('0x29')];}_0x479f45[_0x3bee('0x18')](_0x5341e2)[_0x3bee('0x2a')](_0x2c0e50);};}exports['show']=function(_0x239fa4,_0xf08fb3){var _0x3a3d92={'raw':!![],'where':{'id':_0x239fa4[_0x3bee('0x2b')]['id']}},_0x496abd={};_0x496abd[_0x3bee('0x2c')]=_[_0x3bee('0x2d')](db[_0x3bee('0x2e')][_0x3bee('0x2f')]);_0x496abd['query']=_['keys'](_0x239fa4[_0x3bee('0x30')]);_0x496abd[_0x3bee('0x31')]=_[_0x3bee('0x32')](_0x496abd[_0x3bee('0x2c')],_0x496abd['query']);_0x3a3d92['attributes']=_[_0x3bee('0x32')](_0x496abd[_0x3bee('0x2c')],qs['fields'](_0x239fa4['query'][_0x3bee('0x33')]));_0x3a3d92[_0x3bee('0x34')]=_0x3a3d92[_0x3bee('0x34')][_0x3bee('0x35')]?_0x3a3d92[_0x3bee('0x34')]:_0x496abd[_0x3bee('0x2c')];if(_0x239fa4[_0x3bee('0x30')][_0x3bee('0x36')]){_0x3a3d92[_0x3bee('0x37')]=[{'all':!![]}];}_0x3a3d92=_[_0x3bee('0x38')]({},_0x3a3d92,_0x239fa4['options']);return db['ChatApplication'][_0x3bee('0x39')](_0x3a3d92)['then'](handleEntityNotFound(_0xf08fb3,null))['then'](respondWithResult(_0xf08fb3,null))[_0x3bee('0x3a')](handleError(_0xf08fb3,null));};exports[_0x3bee('0x23')]=function(_0x15bba3,_0x474cf5){if(_0x15bba3[_0x3bee('0x3b')]['id']){delete _0x15bba3[_0x3bee('0x3b')]['id'];}return db[_0x3bee('0x2e')][_0x3bee('0x39')]({'where':{'id':_0x15bba3['params']['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x474cf5,null))[_0x3bee('0x24')](saveUpdates(_0x15bba3['body'],null))[_0x3bee('0x24')](respondWithResult(_0x474cf5,null))[_0x3bee('0x3a')](handleError(_0x474cf5,null));};exports[_0x3bee('0x25')]=function(_0x13d2d5,_0x195540){return db['ChatApplication']['find']({'where':{'id':_0x13d2d5[_0x3bee('0x2b')]['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x195540,null))[_0x3bee('0x24')](removeEntity(_0x195540,null))[_0x3bee('0x3a')](handleError(_0x195540,null));}; \ No newline at end of file +var _0x9efc=['limit','set','Content-Range','apply','save','then','stack','name','send','show','model','keys','query','intersection','attributes','fields','length','include','merge','options','ChatApplication','find','catch','update','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count'];(function(_0x48849a,_0x288d24){var _0x453b62=function(_0x1edc05){while(--_0x1edc05){_0x48849a['push'](_0x48849a['shift']());}};_0x453b62(++_0x288d24);}(_0x9efc,0x19c));var _0xc9ef=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0x9efc[_0x35d3a8];return _0x182378;};'use strict';var emlformat=require(_0xc9ef('0x0'));var rimraf=require(_0xc9ef('0x1'));var zipdir=require(_0xc9ef('0x2'));var jsonpatch=require(_0xc9ef('0x3'));var rp=require(_0xc9ef('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc9ef('0x5'));var util=require('util');var path=require(_0xc9ef('0x6'));var sox=require('sox');var csv=require(_0xc9ef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9ef('0x8'));var _=require(_0xc9ef('0x9'));var squel=require(_0xc9ef('0xa'));var crypto=require(_0xc9ef('0xb'));var jsforce=require(_0xc9ef('0xc'));var deskjs=require(_0xc9ef('0xd'));var toCsv=require(_0xc9ef('0x7'));var querystring=require(_0xc9ef('0xe'));var Papa=require(_0xc9ef('0xf'));var Redis=require(_0xc9ef('0x10'));var authService=require(_0xc9ef('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9ef('0x12'));var logger=require('../../config/logger')(_0xc9ef('0x13'));var utils=require('../../config/utils');var config=require(_0xc9ef('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3297a4,_0x35fb8b){_0x35fb8b=_0x35fb8b||0xcc;return function(_0x2ce47b){if(_0x2ce47b){return _0x3297a4[_0xc9ef('0x15')](_0x35fb8b);}return _0x3297a4[_0xc9ef('0x16')](_0x35fb8b)[_0xc9ef('0x17')]();};}function respondWithResult(_0x17eed6,_0x19f4ab){_0x19f4ab=_0x19f4ab||0xc8;return function(_0x106a92){if(_0x106a92){return _0x17eed6[_0xc9ef('0x16')](_0x19f4ab)[_0xc9ef('0x18')](_0x106a92);}};}function respondWithFilteredResult(_0x5a7043,_0x1665e8){return function(_0x181c2b){if(_0x181c2b){var _0xc63528=typeof _0x1665e8[_0xc9ef('0x19')]===_0xc9ef('0x1a')&&typeof _0x1665e8['limit']===_0xc9ef('0x1a');var _0xd0cd36=_0x181c2b[_0xc9ef('0x1b')];var _0x122fb8=_0xc63528?0x0:_0x1665e8[_0xc9ef('0x19')];var _0x2d1b60=_0xc63528?_0x181c2b[_0xc9ef('0x1b')]:_0x1665e8[_0xc9ef('0x19')]+_0x1665e8[_0xc9ef('0x1c')];var _0xcc0fd8;if(_0x2d1b60>=_0xd0cd36){_0x2d1b60=_0xd0cd36;_0xcc0fd8=0xc8;}else{_0xcc0fd8=0xce;}_0x5a7043[_0xc9ef('0x16')](_0xcc0fd8);return _0x5a7043[_0xc9ef('0x1d')](_0xc9ef('0x1e'),_0x122fb8+'-'+_0x2d1b60+'/'+_0xd0cd36)[_0xc9ef('0x18')](_0x181c2b);}return null;};}function patchUpdates(_0x572f83){return function(_0x13f7d6){try{jsonpatch[_0xc9ef('0x1f')](_0x13f7d6,_0x572f83,!![]);}catch(_0x32999b){return BPromise['reject'](_0x32999b);}return _0x13f7d6[_0xc9ef('0x20')]();};}function saveUpdates(_0x23a402,_0x1ffff8){return function(_0x2bc10b){if(_0x2bc10b){return _0x2bc10b['update'](_0x23a402)[_0xc9ef('0x21')](function(_0x27df1f){return _0x27df1f;});}return null;};}function removeEntity(_0x486dc1,_0x3357e3){return function(_0xcd720a){if(_0xcd720a){return _0xcd720a['destroy']()[_0xc9ef('0x21')](function(){_0x486dc1[_0xc9ef('0x16')](0xcc)[_0xc9ef('0x17')]();});}};}function handleEntityNotFound(_0xf746bb,_0x55cdab){return function(_0x1c6422){if(!_0x1c6422){_0xf746bb[_0xc9ef('0x15')](0x194);}return _0x1c6422;};}function handleError(_0x2d804e,_0xec1e62){_0xec1e62=_0xec1e62||0x1f4;return function(_0x53bf57){logger['error'](_0x53bf57[_0xc9ef('0x22')]);if(_0x53bf57[_0xc9ef('0x23')]){delete _0x53bf57[_0xc9ef('0x23')];}_0x2d804e['status'](_0xec1e62)[_0xc9ef('0x24')](_0x53bf57);};}exports[_0xc9ef('0x25')]=function(_0x2b5831,_0x4042fc){var _0x147812={'raw':!![],'where':{'id':_0x2b5831['params']['id']}},_0x58f88d={};_0x58f88d[_0xc9ef('0x26')]=_[_0xc9ef('0x27')](db['ChatApplication']['rawAttributes']);_0x58f88d[_0xc9ef('0x28')]=_['keys'](_0x2b5831[_0xc9ef('0x28')]);_0x58f88d['filters']=_[_0xc9ef('0x29')](_0x58f88d[_0xc9ef('0x26')],_0x58f88d[_0xc9ef('0x28')]);_0x147812[_0xc9ef('0x2a')]=_[_0xc9ef('0x29')](_0x58f88d[_0xc9ef('0x26')],qs['fields'](_0x2b5831[_0xc9ef('0x28')][_0xc9ef('0x2b')]));_0x147812['attributes']=_0x147812[_0xc9ef('0x2a')][_0xc9ef('0x2c')]?_0x147812[_0xc9ef('0x2a')]:_0x58f88d[_0xc9ef('0x26')];if(_0x2b5831[_0xc9ef('0x28')]['includeAll']){_0x147812[_0xc9ef('0x2d')]=[{'all':!![]}];}_0x147812=_[_0xc9ef('0x2e')]({},_0x147812,_0x2b5831[_0xc9ef('0x2f')]);return db[_0xc9ef('0x30')][_0xc9ef('0x31')](_0x147812)['then'](handleEntityNotFound(_0x4042fc,null))['then'](respondWithResult(_0x4042fc,null))[_0xc9ef('0x32')](handleError(_0x4042fc,null));};exports[_0xc9ef('0x33')]=function(_0x2452d9,_0x5f10c9){if(_0x2452d9['body']['id']){delete _0x2452d9[_0xc9ef('0x34')]['id'];}return db[_0xc9ef('0x30')]['find']({'where':{'id':_0x2452d9['params']['id']}})[_0xc9ef('0x21')](handleEntityNotFound(_0x5f10c9,null))[_0xc9ef('0x21')](saveUpdates(_0x2452d9[_0xc9ef('0x34')],null))['then'](respondWithResult(_0x5f10c9,null))[_0xc9ef('0x32')](handleError(_0x5f10c9,null));};exports[_0xc9ef('0x35')]=function(_0x30d2ba,_0x4ef921){return db[_0xc9ef('0x30')][_0xc9ef('0x31')]({'where':{'id':_0x30d2ba[_0xc9ef('0x36')]['id']}})['then'](handleEntityNotFound(_0x4ef921,null))['then'](removeEntity(_0x4ef921,null))[_0xc9ef('0x32')](handleError(_0x4ef921,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a455a95..47da10d 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 _0xabc7=['request-promise','path','./chatApplication.attributes','exports','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5138f1,_0x31dfb9){var _0x2e2533=function(_0x25bbc7){while(--_0x25bbc7){_0x5138f1['push'](_0x5138f1['shift']());}};_0x2e2533(++_0x31dfb9);}(_0xabc7,0xc7));var _0x7abc=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xabc7[_0x432682];return _0x463d05;};'use strict';var _=require(_0x7abc('0x0'));var util=require(_0x7abc('0x1'));var logger=require(_0x7abc('0x2'))('api');var moment=require(_0x7abc('0x3'));var BPromise=require(_0x7abc('0x4'));var rp=require(_0x7abc('0x5'));var fs=require('fs');var path=require(_0x7abc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7abc('0x7'));module[_0x7abc('0x8')]=function(_0x542c09,_0x226476){return _0x542c09['define']('ChatApplication',attributes,{'tableName':_0x7abc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7abc('0xa'),'collate':_0x7abc('0xb')});}; \ No newline at end of file +var _0x65b9=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','./chatApplication.attributes','exports','define'];(function(_0x3b20b6,_0x605618){var _0x19be63=function(_0x47deca){while(--_0x47deca){_0x3b20b6['push'](_0x3b20b6['shift']());}};_0x19be63(++_0x605618);}(_0x65b9,0x154));var _0x965b=function(_0x4643b2,_0x5ba362){_0x4643b2=_0x4643b2-0x0;var _0x5ab087=_0x65b9[_0x4643b2];return _0x5ab087;};'use strict';var _=require(_0x965b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x965b('0x1'));var moment=require('moment');var BPromise=require(_0x965b('0x2'));var rp=require(_0x965b('0x3'));var fs=require('fs');var path=require(_0x965b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x965b('0x5'));module[_0x965b('0x6')]=function(_0x556e5f,_0x5015a3){return _0x556e5f[_0x965b('0x7')](_0x965b('0x8'),attributes,{'tableName':_0x965b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x965b('0xa'),'collate':_0x965b('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index fbd8f32..5b4393b 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 _0x8349=['http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x538d22,_0x577235){var _0x343115=function(_0x41f1ee){while(--_0x41f1ee){_0x538d22['push'](_0x538d22['shift']());}};_0x343115(++_0x577235);}(_0x8349,0xe9));var _0x9834=function(_0x5e8d3e,_0x18ed2e){_0x5e8d3e=_0x5e8d3e-0x0;var _0x1348c0=_0x8349[_0x5e8d3e];return _0x1348c0;};'use strict';var _=require(_0x9834('0x0'));var util=require(_0x9834('0x1'));var moment=require(_0x9834('0x2'));var BPromise=require(_0x9834('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9834('0x4'));var logger=require(_0x9834('0x5'))(_0x9834('0x6'));var config=require(_0x9834('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9834('0x8')][_0x9834('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b8dcd,_0x4f08df,_0x4c4082){return new BPromise(function(_0x1617d1,_0x5149fb){return client[_0x9834('0xa')](_0x5b8dcd,_0x4c4082)[_0x9834('0xb')](function(_0x41fe75){logger[_0x9834('0xc')](_0x9834('0xd'),_0x4f08df,_0x9834('0xe'));logger[_0x9834('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4f08df,'request\x20sent',JSON[_0x9834('0x10')](_0x41fe75));if(_0x41fe75[_0x9834('0x11')]){if(_0x41fe75[_0x9834('0x11')][_0x9834('0x12')]===0x1f4){logger[_0x9834('0x11')](_0x9834('0xd'),_0x4f08df,_0x41fe75[_0x9834('0x11')][_0x9834('0x13')]);return _0x5149fb(_0x41fe75[_0x9834('0x11')][_0x9834('0x13')]);}logger[_0x9834('0x11')](_0x9834('0xd'),_0x4f08df,_0x41fe75[_0x9834('0x11')]['message']);return _0x1617d1(_0x41fe75['error']['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x4f08df,_0x9834('0xe'));_0x1617d1(_0x41fe75[_0x9834('0x14')][_0x9834('0x13')]);}})[_0x9834('0x15')](function(_0x2ee9a6){logger[_0x9834('0x11')](_0x9834('0xd'),_0x4f08df,_0x2ee9a6);_0x5149fb(_0x2ee9a6);});});} \ No newline at end of file +var _0xb00a=['info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x5a2330,_0x1ee98c){var _0x50da64=function(_0x33682f){while(--_0x33682f){_0x5a2330['push'](_0x5a2330['shift']());}};_0x50da64(++_0x1ee98c);}(_0xb00a,0x171));var _0xab00=function(_0x10e2c0,_0xa19c34){_0x10e2c0=_0x10e2c0-0x0;var _0x1a7c4d=_0xb00a[_0x10e2c0];return _0x1a7c4d;};'use strict';var _=require(_0xab00('0x0'));var util=require(_0xab00('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab00('0x2'))['db'];var utils=require(_0xab00('0x3'));var logger=require(_0xab00('0x4'))(_0xab00('0x5'));var config=require(_0xab00('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xab00('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9a43,_0x2287f8,_0x52d888){return new BPromise(function(_0x43037a,_0x171e3d){return client[_0xab00('0x8')](_0x2c9a43,_0x52d888)['then'](function(_0x48637f){logger[_0xab00('0x9')](_0xab00('0xa'),_0x2287f8,'request\x20sent');logger['debug'](_0xab00('0xb'),_0x2287f8,'request\x20sent',JSON['stringify'](_0x48637f));if(_0x48637f[_0xab00('0xc')]){if(_0x48637f[_0xab00('0xc')][_0xab00('0xd')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x2287f8,_0x48637f[_0xab00('0xc')][_0xab00('0xe')]);return _0x171e3d(_0x48637f[_0xab00('0xc')]['message']);}logger[_0xab00('0xc')](_0xab00('0xa'),_0x2287f8,_0x48637f[_0xab00('0xc')][_0xab00('0xe')]);return _0x43037a(_0x48637f[_0xab00('0xc')]['message']);}else{logger[_0xab00('0x9')]('ChatApplication,\x20%s,\x20%s',_0x2287f8,_0xab00('0xf'));_0x43037a(_0x48637f[_0xab00('0x10')][_0xab00('0xe')]);}})[_0xab00('0x11')](function(_0x3c0899){logger[_0xab00('0xc')](_0xab00('0xa'),_0x2287f8,_0x3c0899);_0x171e3d(_0x3c0899);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 491c04b..8244b10 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 _0x8180=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x8180,0x182));var _0x0818=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x8180[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require('multer');var util=require(_0x0818('0x0'));var path=require(_0x0818('0x1'));var timeout=require(_0x0818('0x2'));var express=require(_0x0818('0x3'));var router=express[_0x0818('0x4')]();var fs_extra=require(_0x0818('0x5'));var auth=require(_0x0818('0x6'));var interaction=require(_0x0818('0x7'));var config=require(_0x0818('0x8'));var controller=require('./chatApplication.controller');router[_0x0818('0x9')]('/:id',auth[_0x0818('0xa')](),controller['show']);router[_0x0818('0xb')](_0x0818('0xc'),auth[_0x0818('0xa')](),controller[_0x0818('0xd')]);router[_0x0818('0xe')](_0x0818('0xc'),auth[_0x0818('0xa')](),controller[_0x0818('0xf')]);module[_0x0818('0x10')]=router; \ No newline at end of file +var _0xcbb9=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbb9,0x1a8));var _0x9cbb=function(_0x408da2,_0x427832){_0x408da2=_0x408da2-0x0;var _0x5ca6e7=_0xcbb9[_0x408da2];return _0x5ca6e7;};'use strict';var multer=require(_0x9cbb('0x0'));var util=require(_0x9cbb('0x1'));var path=require(_0x9cbb('0x2'));var timeout=require('connect-timeout');var express=require(_0x9cbb('0x3'));var router=express[_0x9cbb('0x4')]();var fs_extra=require(_0x9cbb('0x5'));var auth=require(_0x9cbb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9cbb('0x7'));var controller=require(_0x9cbb('0x8'));router[_0x9cbb('0x9')](_0x9cbb('0xa'),auth[_0x9cbb('0xb')](),controller[_0x9cbb('0xc')]);router[_0x9cbb('0xd')](_0x9cbb('0xa'),auth[_0x9cbb('0xb')](),controller['update']);router[_0x9cbb('0xe')]('/:id',auth[_0x9cbb('0xb')](),controller[_0x9cbb('0xf')]);module[_0x9cbb('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f9b9e4b..2e9fb5e 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 _0x20de=['STRING','BOOLEAN','sequelize'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x20de,0x134));var _0xe20d=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x20de[_0x19b3f9];return _0x18c3f6;};'use strict';var Sequelize=require(_0xe20d('0x0'));module['exports']={'name':{'type':Sequelize[_0xe20d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe20d('0x1')]},'write':{'type':Sequelize[_0xe20d('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x090d=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1d3cdb,_0x1e72d8){var _0x12700a=function(_0x31f980){while(--_0x31f980){_0x1d3cdb['push'](_0x1d3cdb['shift']());}};_0x12700a(++_0x1e72d8);}(_0x090d,0xf5));var _0xd090=function(_0x32b2c3,_0x333f80){_0x32b2c3=_0x32b2c3-0x0;var _0x4ed7f9=_0x090d[_0x32b2c3];return _0x4ed7f9;};'use strict';var Sequelize=require(_0xd090('0x0'));module[_0xd090('0x1')]={'name':{'type':Sequelize[_0xd090('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd090('0x2')]},'write':{'type':Sequelize[_0xd090('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index d8349b3..66a2972 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 _0x5bee=['keys','length','create','body','find','describe','ChatInternalMessage','user','toInteger','ids','omit','getMembers','findOne','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','destroy','then','name','send','index','map','rawAttributes','fieldName','key','query','intersection','attributes','model','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','ChatGroup','includeAll','include','rows','catch','params'];(function(_0xfb65aa,_0x1651a6){var _0x2aee31=function(_0x492245){while(--_0x492245){_0xfb65aa['push'](_0xfb65aa['shift']());}};_0x2aee31(++_0x1651a6);}(_0x5bee,0x72));var _0xe5be=function(_0x5a2b06,_0x254bbb){_0x5a2b06=_0x5a2b06-0x0;var _0x40e9b0=_0x5bee[_0x5a2b06];return _0x40e9b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5be('0x0'));var zipdir=require(_0xe5be('0x1'));var jsonpatch=require(_0xe5be('0x2'));var rp=require('request-promise');var moment=require(_0xe5be('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe5be('0x4'));var util=require(_0xe5be('0x5'));var path=require(_0xe5be('0x6'));var sox=require('sox');var csv=require(_0xe5be('0x7'));var ejs=require(_0xe5be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5be('0x9'));var squel=require(_0xe5be('0xa'));var crypto=require(_0xe5be('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe5be('0xc'));var toCsv=require(_0xe5be('0x7'));var querystring=require('querystring');var Papa=require(_0xe5be('0xd'));var Redis=require(_0xe5be('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe5be('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5be('0x10'));var logger=require(_0xe5be('0x11'))(_0xe5be('0x12'));var utils=require(_0xe5be('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe5be('0x14'));var db=require(_0xe5be('0x15'))['db'];config['redis']=_[_0xe5be('0x16')](config[_0xe5be('0x17')],{'host':_0xe5be('0x18'),'port':0x18eb});var socket=require(_0xe5be('0x19'))(new Redis(config[_0xe5be('0x17')]));require(_0xe5be('0x1a'))['register'](socket);function respondWithStatusCode(_0x58c8f3,_0x1973bc){_0x1973bc=_0x1973bc||0xcc;return function(_0xe0aa16){if(_0xe0aa16){return _0x58c8f3[_0xe5be('0x1b')](_0x1973bc);}return _0x58c8f3['status'](_0x1973bc)['end']();};}function respondWithResult(_0x3842e8,_0x261ba3){_0x261ba3=_0x261ba3||0xc8;return function(_0xb2c93f){if(_0xb2c93f){return _0x3842e8[_0xe5be('0x1c')](_0x261ba3)[_0xe5be('0x1d')](_0xb2c93f);}};}function respondWithFilteredResult(_0x383b1c,_0x4603ea){return function(_0x4953aa){if(_0x4953aa){var _0x2f35a5=typeof _0x4603ea[_0xe5be('0x1e')]===_0xe5be('0x1f')&&typeof _0x4603ea['limit']===_0xe5be('0x1f');var _0x4f85fd=_0x4953aa[_0xe5be('0x20')];var _0x18fc71=_0x2f35a5?0x0:_0x4603ea[_0xe5be('0x1e')];var _0x412014=_0x2f35a5?_0x4953aa['count']:_0x4603ea['offset']+_0x4603ea['limit'];var _0x36c8d8;if(_0x412014>=_0x4f85fd){_0x412014=_0x4f85fd;_0x36c8d8=0xc8;}else{_0x36c8d8=0xce;}_0x383b1c[_0xe5be('0x1c')](_0x36c8d8);return _0x383b1c[_0xe5be('0x21')]('Content-Range',_0x18fc71+'-'+_0x412014+'/'+_0x4f85fd)['json'](_0x4953aa);}return null;};}function patchUpdates(_0x48acd4){return function(_0x4f9a50){try{jsonpatch[_0xe5be('0x22')](_0x4f9a50,_0x48acd4,!![]);}catch(_0x574c5f){return BPromise[_0xe5be('0x23')](_0x574c5f);}return _0x4f9a50[_0xe5be('0x24')]();};}function saveUpdates(_0x49a8c5,_0x472a9b){return function(_0x4e7314){if(_0x4e7314){return _0x4e7314[_0xe5be('0x25')](_0x49a8c5)['then'](function(_0x4a1f87){return _0x4a1f87;});}return null;};}function removeEntity(_0x2b822b,_0x408544){return function(_0x3ec7f8){if(_0x3ec7f8){return _0x3ec7f8[_0xe5be('0x26')]()[_0xe5be('0x27')](function(){_0x2b822b[_0xe5be('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xac2390,_0x3b03e3){return function(_0x2a3ce3){if(!_0x2a3ce3){_0xac2390[_0xe5be('0x1b')](0x194);}return _0x2a3ce3;};}function handleError(_0x2c6a82,_0x41fb16){_0x41fb16=_0x41fb16||0x1f4;return function(_0x1ec965){logger['error'](_0x1ec965['stack']);if(_0x1ec965[_0xe5be('0x28')]){delete _0x1ec965[_0xe5be('0x28')];}_0x2c6a82[_0xe5be('0x1c')](_0x41fb16)[_0xe5be('0x29')](_0x1ec965);};}exports[_0xe5be('0x2a')]=function(_0x188e08,_0x52eac3){var _0x5c5fee={},_0x20ed1d={},_0x2d5f5e={'count':0x0,'rows':[]};var _0x458883=_[_0xe5be('0x2b')](db['ChatGroup'][_0xe5be('0x2c')],function(_0x160595){return{'name':_0x160595[_0xe5be('0x2d')],'type':_0x160595['type'][_0xe5be('0x2e')]};});_0x20ed1d['model']=_[_0xe5be('0x2b')](_0x458883,_0xe5be('0x28'));_0x20ed1d['query']=_['keys'](_0x188e08[_0xe5be('0x2f')]);_0x20ed1d['filters']=_[_0xe5be('0x30')](_0x20ed1d['model'],_0x20ed1d['query']);_0x5c5fee[_0xe5be('0x31')]=_[_0xe5be('0x30')](_0x20ed1d[_0xe5be('0x32')],qs[_0xe5be('0x33')](_0x188e08[_0xe5be('0x2f')][_0xe5be('0x33')]));_0x5c5fee[_0xe5be('0x31')]=_0x5c5fee[_0xe5be('0x31')]['length']?_0x5c5fee['attributes']:_0x20ed1d[_0xe5be('0x32')];if(!_0x188e08[_0xe5be('0x2f')][_0xe5be('0x34')]('nolimit')){_0x5c5fee[_0xe5be('0x35')]=qs[_0xe5be('0x35')](_0x188e08['query'][_0xe5be('0x35')]);_0x5c5fee[_0xe5be('0x1e')]=qs[_0xe5be('0x1e')](_0x188e08[_0xe5be('0x2f')][_0xe5be('0x1e')]);}_0x5c5fee[_0xe5be('0x36')]=qs[_0xe5be('0x37')](_0x188e08['query'][_0xe5be('0x37')]);_0x5c5fee[_0xe5be('0x38')]=qs[_0xe5be('0x39')](_[_0xe5be('0x3a')](_0x188e08[_0xe5be('0x2f')],_0x20ed1d[_0xe5be('0x39')]),_0x458883);if(_0x188e08['query'][_0xe5be('0x3b')]){_0x5c5fee[_0xe5be('0x38')]=_[_0xe5be('0x3c')](_0x5c5fee['where'],{'$or':_[_0xe5be('0x2b')](_0x458883,function(_0x5cd882){if(_0x5cd882[_0xe5be('0x3d')]!==_0xe5be('0x3e')){var _0x237115={};_0x237115[_0x5cd882[_0xe5be('0x28')]]={'$like':'%'+_0x188e08[_0xe5be('0x2f')][_0xe5be('0x3b')]+'%'};return _0x237115;}})});}_0x5c5fee=_['merge']({},_0x5c5fee,_0x188e08[_0xe5be('0x3f')]);var _0x2c48bb={'where':_0x5c5fee['where']};return db[_0xe5be('0x40')][_0xe5be('0x20')](_0x2c48bb)['then'](function(_0x555ed3){_0x2d5f5e[_0xe5be('0x20')]=_0x555ed3;if(_0x188e08['query'][_0xe5be('0x41')]){_0x5c5fee[_0xe5be('0x42')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x5c5fee);})[_0xe5be('0x27')](function(_0x2de16b){_0x2d5f5e[_0xe5be('0x43')]=_0x2de16b;return _0x2d5f5e;})[_0xe5be('0x27')](respondWithFilteredResult(_0x52eac3,_0x5c5fee))[_0xe5be('0x44')](handleError(_0x52eac3,null));};exports['show']=function(_0x10aa65,_0x52f6c6){var _0xd2ae52={'raw':!![],'where':{'id':_0x10aa65[_0xe5be('0x45')]['id']}},_0x264e63={};_0x264e63[_0xe5be('0x32')]=_[_0xe5be('0x46')](db[_0xe5be('0x40')][_0xe5be('0x2c')]);_0x264e63[_0xe5be('0x2f')]=_[_0xe5be('0x46')](_0x10aa65['query']);_0x264e63[_0xe5be('0x39')]=_[_0xe5be('0x30')](_0x264e63[_0xe5be('0x32')],_0x264e63[_0xe5be('0x2f')]);_0xd2ae52[_0xe5be('0x31')]=_[_0xe5be('0x30')](_0x264e63['model'],qs[_0xe5be('0x33')](_0x10aa65[_0xe5be('0x2f')][_0xe5be('0x33')]));_0xd2ae52[_0xe5be('0x31')]=_0xd2ae52[_0xe5be('0x31')][_0xe5be('0x47')]?_0xd2ae52[_0xe5be('0x31')]:_0x264e63['model'];if(_0x10aa65['query']['includeAll']){_0xd2ae52[_0xe5be('0x42')]=[{'all':!![]}];}_0xd2ae52=_[_0xe5be('0x3c')]({},_0xd2ae52,_0x10aa65[_0xe5be('0x3f')]);return db[_0xe5be('0x40')]['find'](_0xd2ae52)[_0xe5be('0x27')](handleEntityNotFound(_0x52f6c6,null))[_0xe5be('0x27')](respondWithResult(_0x52f6c6,null))[_0xe5be('0x44')](handleError(_0x52f6c6,null));};exports[_0xe5be('0x48')]=function(_0x3bd420,_0x10839a){return db['ChatGroup'][_0xe5be('0x48')](_0x3bd420[_0xe5be('0x49')],{})[_0xe5be('0x27')](respondWithResult(_0x10839a,0xc9))['catch'](handleError(_0x10839a,null));};exports[_0xe5be('0x25')]=function(_0x249dbe,_0x126d1e){if(_0x249dbe['body']['id']){delete _0x249dbe[_0xe5be('0x49')]['id'];}return db[_0xe5be('0x40')][_0xe5be('0x4a')]({'where':{'id':_0x249dbe[_0xe5be('0x45')]['id']}})[_0xe5be('0x27')](handleEntityNotFound(_0x126d1e,null))[_0xe5be('0x27')](saveUpdates(_0x249dbe[_0xe5be('0x49')],null))['then'](respondWithResult(_0x126d1e,null))['catch'](handleError(_0x126d1e,null));};exports['destroy']=function(_0x3ca258,_0x1e231a){return db['ChatGroup']['find']({'where':{'id':_0x3ca258[_0xe5be('0x45')]['id']}})[_0xe5be('0x27')](handleEntityNotFound(_0x1e231a,null))[_0xe5be('0x27')](removeEntity(_0x1e231a,null))[_0xe5be('0x44')](handleError(_0x1e231a,null));};exports[_0xe5be('0x4b')]=function(_0x41cd7c,_0x1ea110){return db['ChatGroup'][_0xe5be('0x4b')]()[_0xe5be('0x27')](respondWithResult(_0x1ea110,null))[_0xe5be('0x44')](handleError(_0x1ea110,null));};exports['getUnread']=function(_0x565d12,_0x2c4e43,_0x547fc6){return db[_0xe5be('0x4c')][_0xe5be('0x20')]({'where':{'ChatGroupId':_0x565d12[_0xe5be('0x45')]['id'],'ToId':_0x565d12[_0xe5be('0x4d')]['id'],'read':![]}})[_0xe5be('0x27')](function(_0x77bca1){return{'id':_[_0xe5be('0x4e')](_0x565d12['params']['id']),'count':_0x77bca1};})['then'](respondWithResult(_0x2c4e43,null))[_0xe5be('0x44')](handleError(_0x2c4e43,null));};exports['addMembers']=function(_0x331552,_0x4a103c,_0x7c3386){return db[_0xe5be('0x40')][_0xe5be('0x4a')]({'where':{'id':_0x331552[_0xe5be('0x45')]['id']}})[_0xe5be('0x27')](handleEntityNotFound(_0x4a103c,null))[_0xe5be('0x27')](function(_0x3d813e){if(_0x3d813e){return _0x3d813e['addMembers'](_0x331552[_0xe5be('0x49')][_0xe5be('0x4f')],_[_0xe5be('0x50')](_0x331552[_0xe5be('0x49')],[_0xe5be('0x4f'),'id'])||{});}})[_0xe5be('0x27')](respondWithResult(_0x4a103c,null))[_0xe5be('0x44')](handleError(_0x4a103c,null));};exports[_0xe5be('0x51')]=function(_0x1b6a29,_0x29d277,_0xf3c42f){var _0x5781d8={};var _0x2b7cd1={};var _0x35dbab;var _0x1cf95d;return db[_0xe5be('0x40')][_0xe5be('0x52')]({'where':{'id':_0x1b6a29[_0xe5be('0x45')]['id']}})[_0xe5be('0x27')](handleEntityNotFound(_0x29d277,null))['then'](function(_0x322e75){if(_0x322e75){_0x35dbab=_0x322e75;_0x2b7cd1['model']=_[_0xe5be('0x46')](db['User']['rawAttributes']);_0x2b7cd1[_0xe5be('0x2f')]=_[_0xe5be('0x46')](_0x1b6a29[_0xe5be('0x2f')]);_0x2b7cd1[_0xe5be('0x39')]=_['intersection'](_0x2b7cd1[_0xe5be('0x32')],_0x2b7cd1[_0xe5be('0x2f')]);_0x5781d8['attributes']=_[_0xe5be('0x30')](_0x2b7cd1['model'],qs['fields'](_0x1b6a29[_0xe5be('0x2f')][_0xe5be('0x33')]));_0x5781d8[_0xe5be('0x31')]=_0x5781d8[_0xe5be('0x31')]['length']?_0x5781d8[_0xe5be('0x31')]:_0x2b7cd1[_0xe5be('0x32')];_0x5781d8[_0xe5be('0x36')]=qs[_0xe5be('0x37')](_0x1b6a29[_0xe5be('0x2f')]['sort']);_0x5781d8[_0xe5be('0x38')]=qs[_0xe5be('0x39')](_[_0xe5be('0x3a')](_0x1b6a29[_0xe5be('0x2f')],_0x2b7cd1[_0xe5be('0x39')]));if(_0x1b6a29['query']['filter']){_0x5781d8[_0xe5be('0x38')]=_[_0xe5be('0x3c')](_0x5781d8[_0xe5be('0x38')],{'$or':_[_0xe5be('0x2b')](_0x5781d8[_0xe5be('0x31')],function(_0x49de6e){var _0x5c48b5={};_0x5c48b5[_0x49de6e]={'$like':'%'+_0x1b6a29[_0xe5be('0x2f')][_0xe5be('0x3b')]+'%'};return _0x5c48b5;})});}_0x5781d8=_[_0xe5be('0x3c')]({},_0x5781d8,_0x1b6a29[_0xe5be('0x3f')]);return _0x35dbab[_0xe5be('0x51')](_0x5781d8);}})[_0xe5be('0x27')](function(_0x28fc73){if(_0x28fc73){_0x1cf95d=_0x28fc73[_0xe5be('0x47')];if(!_0x1b6a29[_0xe5be('0x2f')]['hasOwnProperty']('nolimit')){_0x5781d8[_0xe5be('0x35')]=qs[_0xe5be('0x35')](_0x1b6a29['query'][_0xe5be('0x35')]);_0x5781d8[_0xe5be('0x1e')]=qs[_0xe5be('0x1e')](_0x1b6a29[_0xe5be('0x2f')][_0xe5be('0x1e')]);}return _0x35dbab[_0xe5be('0x51')](_0x5781d8);}})['then'](function(_0x2ffa57){if(_0x2ffa57){return _0x2ffa57?{'count':_0x1cf95d,'rows':_0x2ffa57}:null;}})[_0xe5be('0x27')](respondWithResult(_0x29d277,null))[_0xe5be('0x44')](handleError(_0x29d277,null));};exports[_0xe5be('0x53')]=function(_0x122289,_0x47d009,_0x414925){return db[_0xe5be('0x40')]['find']({'where':{'id':_0x122289[_0xe5be('0x45')]['id']}})[_0xe5be('0x27')](handleEntityNotFound(_0x47d009,null))['then'](function(_0x3f519e){if(_0x3f519e){return _0x3f519e[_0xe5be('0x53')](_0x122289[_0xe5be('0x2f')][_0xe5be('0x4f')]);}})[_0xe5be('0x27')](respondWithStatusCode(_0x47d009,null))[_0xe5be('0x44')](handleError(_0x47d009,null));};exports[_0xe5be('0x54')]=function(_0x2faffd,_0x439bad,_0x5ef288){if(_0x2faffd[_0xe5be('0x49')]['id']){delete _0x2faffd[_0xe5be('0x49')]['id'];}return db['ChatGroup'][_0xe5be('0x4a')]({'where':{'id':_0x2faffd[_0xe5be('0x45')]['id']}})[_0xe5be('0x27')](handleEntityNotFound(_0x439bad,null))[_0xe5be('0x27')](function(_0x575957){if(_0x575957){_0x2faffd[_0xe5be('0x49')][_0xe5be('0x55')]=_0x575957['id'];return db['ChatInternalMessage'][_0xe5be('0x48')](_0x2faffd['body']);}})[_0xe5be('0x27')](respondWithResult(_0x439bad,null))[_0xe5be('0x44')](handleError(_0x439bad,null));};exports[_0xe5be('0x56')]=function(_0x425863,_0x2466aa,_0x489f8c){var _0x4c758b={};var _0x479137={};var _0x74148e;var _0x11d08c;return db[_0xe5be('0x40')][_0xe5be('0x52')]({'where':{'id':_0x425863['params']['id']}})[_0xe5be('0x27')](handleEntityNotFound(_0x2466aa,null))[_0xe5be('0x27')](function(_0x2dfb24){if(_0x2dfb24){_0x74148e=_0x2dfb24;_0x479137['model']=_[_0xe5be('0x46')](db[_0xe5be('0x4c')][_0xe5be('0x2c')]);_0x479137[_0xe5be('0x2f')]=_[_0xe5be('0x46')](_0x425863[_0xe5be('0x2f')]);_0x479137['filters']=_[_0xe5be('0x30')](_0x479137[_0xe5be('0x32')],_0x479137['query']);_0x4c758b[_0xe5be('0x31')]=_[_0xe5be('0x30')](_0x479137[_0xe5be('0x32')],qs[_0xe5be('0x33')](_0x425863['query']['fields']));_0x4c758b['attributes']=_0x4c758b[_0xe5be('0x31')][_0xe5be('0x47')]?_0x4c758b[_0xe5be('0x31')]:_0x479137[_0xe5be('0x32')];_0x4c758b[_0xe5be('0x36')]=qs[_0xe5be('0x37')](_0x425863[_0xe5be('0x2f')]['sort']);_0x4c758b[_0xe5be('0x38')]=qs['filters'](_[_0xe5be('0x3a')](_0x425863[_0xe5be('0x2f')],_0x479137[_0xe5be('0x39')]));if(_0x425863[_0xe5be('0x2f')]['filter']){_0x4c758b[_0xe5be('0x38')]=_[_0xe5be('0x3c')](_0x4c758b['where'],{'$or':_[_0xe5be('0x2b')](_0x4c758b['attributes'],function(_0x3a04e3){var _0x332ab3={};_0x332ab3[_0x3a04e3]={'$like':'%'+_0x425863[_0xe5be('0x2f')]['filter']+'%'};return _0x332ab3;})});}if(_0x425863[_0xe5be('0x2f')][_0xe5be('0x57')]){var _0x540966=_0x425863[_0xe5be('0x2f')]['$gte'][_0xe5be('0x58')](',');var _0x318d06={};_0x318d06[_0x540966[0x0]]={'$gte':moment(_0x540966[0x1])[_0xe5be('0x59')](_0xe5be('0x5a'))};_0x4c758b[_0xe5be('0x38')]=_[_0xe5be('0x3c')](_0x4c758b[_0xe5be('0x38')],_0x318d06);}_0x4c758b=_['merge']({},_0x4c758b,_0x425863[_0xe5be('0x3f')]);return _0x74148e['getMessages'](_0x4c758b);}})['then'](function(_0x33f878){if(_0x33f878){_0x11d08c=_0x33f878[_0xe5be('0x47')];if(!_0x425863[_0xe5be('0x2f')][_0xe5be('0x34')](_0xe5be('0x5b'))){_0x4c758b[_0xe5be('0x35')]=qs[_0xe5be('0x35')](_0x425863[_0xe5be('0x2f')][_0xe5be('0x35')]);_0x4c758b['offset']=qs[_0xe5be('0x1e')](_0x425863[_0xe5be('0x2f')]['offset']);}return _0x74148e[_0xe5be('0x56')](_0x4c758b);}})[_0xe5be('0x27')](function(_0x5bc794){if(_0x5bc794){return _0x5bc794?{'count':_0x11d08c,'rows':_0x5bc794}:null;}})['then'](respondWithResult(_0x2466aa,null))['catch'](handleError(_0x2466aa,null));}; \ No newline at end of file +var _0x2e72=['format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','error','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','toInteger','addMembers','omit','ids','getMembers','User','order','sort','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','findOne','$gte','split'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x2e72,0x11c));var _0x22e7=function(_0x571d85,_0xda439c){_0x571d85=_0x571d85-0x0;var _0x3c2e07=_0x2e72[_0x571d85];return _0x3c2e07;};'use strict';var emlformat=require(_0x22e7('0x0'));var rimraf=require(_0x22e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x22e7('0x2'));var moment=require('moment');var BPromise=require(_0x22e7('0x3'));var Mustache=require('mustache');var util=require(_0x22e7('0x4'));var path=require('path');var sox=require(_0x22e7('0x5'));var csv=require(_0x22e7('0x6'));var ejs=require(_0x22e7('0x7'));var fs=require('fs');var fs_extra=require(_0x22e7('0x8'));var _=require(_0x22e7('0x9'));var squel=require(_0x22e7('0xa'));var crypto=require(_0x22e7('0xb'));var jsforce=require(_0x22e7('0xc'));var deskjs=require(_0x22e7('0xd'));var toCsv=require(_0x22e7('0x6'));var querystring=require(_0x22e7('0xe'));var Papa=require(_0x22e7('0xf'));var Redis=require(_0x22e7('0x10'));var authService=require(_0x22e7('0x11'));var qs=require(_0x22e7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22e7('0x13'))('api');var utils=require(_0x22e7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x22e7('0x15'));var db=require(_0x22e7('0x16'))['db'];config[_0x22e7('0x17')]=_['defaults'](config[_0x22e7('0x17')],{'host':_0x22e7('0x18'),'port':0x18eb});var socket=require(_0x22e7('0x19'))(new Redis(config['redis']));require(_0x22e7('0x1a'))[_0x22e7('0x1b')](socket);function respondWithStatusCode(_0x12f7e9,_0x425572){_0x425572=_0x425572||0xcc;return function(_0x2576a7){if(_0x2576a7){return _0x12f7e9['sendStatus'](_0x425572);}return _0x12f7e9[_0x22e7('0x1c')](_0x425572)[_0x22e7('0x1d')]();};}function respondWithResult(_0x9ebc9e,_0x208e8e){_0x208e8e=_0x208e8e||0xc8;return function(_0x33718d){if(_0x33718d){return _0x9ebc9e['status'](_0x208e8e)[_0x22e7('0x1e')](_0x33718d);}};}function respondWithFilteredResult(_0x4e6df2,_0x168745){return function(_0x3cdcf2){if(_0x3cdcf2){var _0x14f211=typeof _0x168745[_0x22e7('0x1f')]===_0x22e7('0x20')&&typeof _0x168745[_0x22e7('0x21')]==='undefined';var _0x2a7a9c=_0x3cdcf2[_0x22e7('0x22')];var _0x1e252c=_0x14f211?0x0:_0x168745[_0x22e7('0x1f')];var _0x25ab8d=_0x14f211?_0x3cdcf2[_0x22e7('0x22')]:_0x168745[_0x22e7('0x1f')]+_0x168745[_0x22e7('0x21')];var _0xf5470a;if(_0x25ab8d>=_0x2a7a9c){_0x25ab8d=_0x2a7a9c;_0xf5470a=0xc8;}else{_0xf5470a=0xce;}_0x4e6df2[_0x22e7('0x1c')](_0xf5470a);return _0x4e6df2['set'](_0x22e7('0x23'),_0x1e252c+'-'+_0x25ab8d+'/'+_0x2a7a9c)[_0x22e7('0x1e')](_0x3cdcf2);}return null;};}function patchUpdates(_0x1bf7f9){return function(_0xe07d48){try{jsonpatch['apply'](_0xe07d48,_0x1bf7f9,!![]);}catch(_0x8ec519){return BPromise['reject'](_0x8ec519);}return _0xe07d48['save']();};}function saveUpdates(_0x2f2c99,_0x59d2f9){return function(_0x2051d1){if(_0x2051d1){return _0x2051d1[_0x22e7('0x24')](_0x2f2c99)[_0x22e7('0x25')](function(_0x29556e){return _0x29556e;});}return null;};}function removeEntity(_0x23e373,_0xf6048c){return function(_0x691319){if(_0x691319){return _0x691319[_0x22e7('0x26')]()['then'](function(){_0x23e373[_0x22e7('0x1c')](0xcc)[_0x22e7('0x1d')]();});}};}function handleEntityNotFound(_0x37d4ff,_0x6db24f){return function(_0x3af842){if(!_0x3af842){_0x37d4ff[_0x22e7('0x27')](0x194);}return _0x3af842;};}function handleError(_0x56e23d,_0x246bb2){_0x246bb2=_0x246bb2||0x1f4;return function(_0x3e883c){logger[_0x22e7('0x28')](_0x3e883c['stack']);if(_0x3e883c[_0x22e7('0x29')]){delete _0x3e883c[_0x22e7('0x29')];}_0x56e23d[_0x22e7('0x1c')](_0x246bb2)[_0x22e7('0x2a')](_0x3e883c);};}exports[_0x22e7('0x2b')]=function(_0x2096c3,_0x133ce7){var _0xbd59df={},_0x5be9aa={},_0x39431d={'count':0x0,'rows':[]};var _0x2d05be=_[_0x22e7('0x2c')](db[_0x22e7('0x2d')][_0x22e7('0x2e')],function(_0x323bba){return{'name':_0x323bba['fieldName'],'type':_0x323bba[_0x22e7('0x2f')][_0x22e7('0x30')]};});_0x5be9aa[_0x22e7('0x31')]=_[_0x22e7('0x2c')](_0x2d05be,_0x22e7('0x29'));_0x5be9aa[_0x22e7('0x32')]=_[_0x22e7('0x33')](_0x2096c3[_0x22e7('0x32')]);_0x5be9aa[_0x22e7('0x34')]=_[_0x22e7('0x35')](_0x5be9aa[_0x22e7('0x31')],_0x5be9aa[_0x22e7('0x32')]);_0xbd59df[_0x22e7('0x36')]=_[_0x22e7('0x35')](_0x5be9aa[_0x22e7('0x31')],qs['fields'](_0x2096c3[_0x22e7('0x32')][_0x22e7('0x37')]));_0xbd59df[_0x22e7('0x36')]=_0xbd59df[_0x22e7('0x36')][_0x22e7('0x38')]?_0xbd59df[_0x22e7('0x36')]:_0x5be9aa[_0x22e7('0x31')];if(!_0x2096c3[_0x22e7('0x32')][_0x22e7('0x39')](_0x22e7('0x3a'))){_0xbd59df[_0x22e7('0x21')]=qs['limit'](_0x2096c3[_0x22e7('0x32')]['limit']);_0xbd59df[_0x22e7('0x1f')]=qs[_0x22e7('0x1f')](_0x2096c3[_0x22e7('0x32')]['offset']);}_0xbd59df['order']=qs['sort'](_0x2096c3[_0x22e7('0x32')]['sort']);_0xbd59df[_0x22e7('0x3b')]=qs[_0x22e7('0x34')](_[_0x22e7('0x3c')](_0x2096c3['query'],_0x5be9aa[_0x22e7('0x34')]),_0x2d05be);if(_0x2096c3[_0x22e7('0x32')][_0x22e7('0x3d')]){_0xbd59df['where']=_[_0x22e7('0x3e')](_0xbd59df[_0x22e7('0x3b')],{'$or':_[_0x22e7('0x2c')](_0x2d05be,function(_0x3b27c0){if(_0x3b27c0['type']!==_0x22e7('0x3f')){var _0x4518b1={};_0x4518b1[_0x3b27c0['name']]={'$like':'%'+_0x2096c3[_0x22e7('0x32')][_0x22e7('0x3d')]+'%'};return _0x4518b1;}})});}_0xbd59df=_[_0x22e7('0x3e')]({},_0xbd59df,_0x2096c3[_0x22e7('0x40')]);var _0x1e10bd={'where':_0xbd59df[_0x22e7('0x3b')]};return db[_0x22e7('0x2d')][_0x22e7('0x22')](_0x1e10bd)[_0x22e7('0x25')](function(_0x1b2bc0){_0x39431d[_0x22e7('0x22')]=_0x1b2bc0;if(_0x2096c3[_0x22e7('0x32')][_0x22e7('0x41')]){_0xbd59df[_0x22e7('0x42')]=[{'all':!![]}];}return db[_0x22e7('0x2d')][_0x22e7('0x43')](_0xbd59df);})[_0x22e7('0x25')](function(_0x3bc116){_0x39431d[_0x22e7('0x44')]=_0x3bc116;return _0x39431d;})[_0x22e7('0x25')](respondWithFilteredResult(_0x133ce7,_0xbd59df))[_0x22e7('0x45')](handleError(_0x133ce7,null));};exports[_0x22e7('0x46')]=function(_0x265136,_0xba8bf4){var _0x18072c={'raw':!![],'where':{'id':_0x265136[_0x22e7('0x47')]['id']}},_0x59bf1a={};_0x59bf1a[_0x22e7('0x31')]=_[_0x22e7('0x33')](db['ChatGroup']['rawAttributes']);_0x59bf1a[_0x22e7('0x32')]=_[_0x22e7('0x33')](_0x265136['query']);_0x59bf1a[_0x22e7('0x34')]=_[_0x22e7('0x35')](_0x59bf1a['model'],_0x59bf1a['query']);_0x18072c[_0x22e7('0x36')]=_[_0x22e7('0x35')](_0x59bf1a[_0x22e7('0x31')],qs['fields'](_0x265136[_0x22e7('0x32')]['fields']));_0x18072c['attributes']=_0x18072c[_0x22e7('0x36')]['length']?_0x18072c[_0x22e7('0x36')]:_0x59bf1a[_0x22e7('0x31')];if(_0x265136[_0x22e7('0x32')][_0x22e7('0x41')]){_0x18072c['include']=[{'all':!![]}];}_0x18072c=_[_0x22e7('0x3e')]({},_0x18072c,_0x265136[_0x22e7('0x40')]);return db['ChatGroup'][_0x22e7('0x48')](_0x18072c)[_0x22e7('0x25')](handleEntityNotFound(_0xba8bf4,null))[_0x22e7('0x25')](respondWithResult(_0xba8bf4,null))[_0x22e7('0x45')](handleError(_0xba8bf4,null));};exports[_0x22e7('0x49')]=function(_0x11b014,_0x1b2b48){return db[_0x22e7('0x2d')][_0x22e7('0x49')](_0x11b014['body'],{})[_0x22e7('0x25')](respondWithResult(_0x1b2b48,0xc9))[_0x22e7('0x45')](handleError(_0x1b2b48,null));};exports[_0x22e7('0x24')]=function(_0x7e30f0,_0x47aa08){if(_0x7e30f0[_0x22e7('0x4a')]['id']){delete _0x7e30f0[_0x22e7('0x4a')]['id'];}return db[_0x22e7('0x2d')][_0x22e7('0x48')]({'where':{'id':_0x7e30f0[_0x22e7('0x47')]['id']}})[_0x22e7('0x25')](handleEntityNotFound(_0x47aa08,null))[_0x22e7('0x25')](saveUpdates(_0x7e30f0['body'],null))['then'](respondWithResult(_0x47aa08,null))[_0x22e7('0x45')](handleError(_0x47aa08,null));};exports[_0x22e7('0x26')]=function(_0x1e0f80,_0x42142c){return db[_0x22e7('0x2d')][_0x22e7('0x48')]({'where':{'id':_0x1e0f80['params']['id']}})['then'](handleEntityNotFound(_0x42142c,null))['then'](removeEntity(_0x42142c,null))[_0x22e7('0x45')](handleError(_0x42142c,null));};exports[_0x22e7('0x4b')]=function(_0x1728b4,_0x1820d0){return db[_0x22e7('0x2d')][_0x22e7('0x4b')]()[_0x22e7('0x25')](respondWithResult(_0x1820d0,null))[_0x22e7('0x45')](handleError(_0x1820d0,null));};exports['getUnread']=function(_0x118142,_0x10aff1,_0x5087c0){return db['ChatInternalMessage'][_0x22e7('0x22')]({'where':{'ChatGroupId':_0x118142['params']['id'],'ToId':_0x118142['user']['id'],'read':![]}})[_0x22e7('0x25')](function(_0x4a7aa8){return{'id':_[_0x22e7('0x4c')](_0x118142[_0x22e7('0x47')]['id']),'count':_0x4a7aa8};})[_0x22e7('0x25')](respondWithResult(_0x10aff1,null))[_0x22e7('0x45')](handleError(_0x10aff1,null));};exports[_0x22e7('0x4d')]=function(_0x323d3c,_0x5733fd,_0x330031){return db[_0x22e7('0x2d')][_0x22e7('0x48')]({'where':{'id':_0x323d3c['params']['id']}})['then'](handleEntityNotFound(_0x5733fd,null))[_0x22e7('0x25')](function(_0x6e17b0){if(_0x6e17b0){return _0x6e17b0['addMembers'](_0x323d3c[_0x22e7('0x4a')]['ids'],_[_0x22e7('0x4e')](_0x323d3c[_0x22e7('0x4a')],[_0x22e7('0x4f'),'id'])||{});}})[_0x22e7('0x25')](respondWithResult(_0x5733fd,null))[_0x22e7('0x45')](handleError(_0x5733fd,null));};exports[_0x22e7('0x50')]=function(_0x48bdef,_0xa8c13c,_0x136bed){var _0x4b3200={};var _0x4c11c6={};var _0x838af0;var _0x581ff9;return db[_0x22e7('0x2d')]['findOne']({'where':{'id':_0x48bdef[_0x22e7('0x47')]['id']}})['then'](handleEntityNotFound(_0xa8c13c,null))[_0x22e7('0x25')](function(_0x18f553){if(_0x18f553){_0x838af0=_0x18f553;_0x4c11c6[_0x22e7('0x31')]=_['keys'](db[_0x22e7('0x51')]['rawAttributes']);_0x4c11c6[_0x22e7('0x32')]=_[_0x22e7('0x33')](_0x48bdef[_0x22e7('0x32')]);_0x4c11c6['filters']=_[_0x22e7('0x35')](_0x4c11c6[_0x22e7('0x31')],_0x4c11c6['query']);_0x4b3200[_0x22e7('0x36')]=_[_0x22e7('0x35')](_0x4c11c6[_0x22e7('0x31')],qs[_0x22e7('0x37')](_0x48bdef[_0x22e7('0x32')][_0x22e7('0x37')]));_0x4b3200[_0x22e7('0x36')]=_0x4b3200[_0x22e7('0x36')]['length']?_0x4b3200[_0x22e7('0x36')]:_0x4c11c6['model'];_0x4b3200[_0x22e7('0x52')]=qs[_0x22e7('0x53')](_0x48bdef['query']['sort']);_0x4b3200['where']=qs[_0x22e7('0x34')](_[_0x22e7('0x3c')](_0x48bdef[_0x22e7('0x32')],_0x4c11c6[_0x22e7('0x34')]));if(_0x48bdef['query'][_0x22e7('0x3d')]){_0x4b3200['where']=_['merge'](_0x4b3200[_0x22e7('0x3b')],{'$or':_[_0x22e7('0x2c')](_0x4b3200['attributes'],function(_0x4501ae){var _0x2d5e94={};_0x2d5e94[_0x4501ae]={'$like':'%'+_0x48bdef[_0x22e7('0x32')][_0x22e7('0x3d')]+'%'};return _0x2d5e94;})});}_0x4b3200=_[_0x22e7('0x3e')]({},_0x4b3200,_0x48bdef[_0x22e7('0x40')]);return _0x838af0[_0x22e7('0x50')](_0x4b3200);}})[_0x22e7('0x25')](function(_0x251f00){if(_0x251f00){_0x581ff9=_0x251f00['length'];if(!_0x48bdef[_0x22e7('0x32')][_0x22e7('0x39')]('nolimit')){_0x4b3200['limit']=qs[_0x22e7('0x21')](_0x48bdef[_0x22e7('0x32')][_0x22e7('0x21')]);_0x4b3200[_0x22e7('0x1f')]=qs[_0x22e7('0x1f')](_0x48bdef[_0x22e7('0x32')][_0x22e7('0x1f')]);}return _0x838af0[_0x22e7('0x50')](_0x4b3200);}})[_0x22e7('0x25')](function(_0x36d08d){if(_0x36d08d){return _0x36d08d?{'count':_0x581ff9,'rows':_0x36d08d}:null;}})[_0x22e7('0x25')](respondWithResult(_0xa8c13c,null))[_0x22e7('0x45')](handleError(_0xa8c13c,null));};exports[_0x22e7('0x54')]=function(_0x494281,_0x55dbe9,_0x184dee){return db[_0x22e7('0x2d')][_0x22e7('0x48')]({'where':{'id':_0x494281[_0x22e7('0x47')]['id']}})['then'](handleEntityNotFound(_0x55dbe9,null))[_0x22e7('0x25')](function(_0x18a528){if(_0x18a528){return _0x18a528[_0x22e7('0x54')](_0x494281[_0x22e7('0x32')][_0x22e7('0x4f')]);}})[_0x22e7('0x25')](respondWithStatusCode(_0x55dbe9,null))[_0x22e7('0x45')](handleError(_0x55dbe9,null));};exports[_0x22e7('0x55')]=function(_0x429edc,_0x56c860,_0x5bff9b){if(_0x429edc[_0x22e7('0x4a')]['id']){delete _0x429edc['body']['id'];}return db[_0x22e7('0x2d')][_0x22e7('0x48')]({'where':{'id':_0x429edc[_0x22e7('0x47')]['id']}})[_0x22e7('0x25')](handleEntityNotFound(_0x56c860,null))[_0x22e7('0x25')](function(_0x5c42c1){if(_0x5c42c1){_0x429edc[_0x22e7('0x4a')][_0x22e7('0x56')]=_0x5c42c1['id'];return db[_0x22e7('0x57')][_0x22e7('0x49')](_0x429edc[_0x22e7('0x4a')]);}})['then'](respondWithResult(_0x56c860,null))[_0x22e7('0x45')](handleError(_0x56c860,null));};exports[_0x22e7('0x58')]=function(_0x3a9b27,_0xfda45d,_0x352801){var _0x2e144d={};var _0x16be42={};var _0x603722;var _0x10ec9d;return db['ChatGroup'][_0x22e7('0x59')]({'where':{'id':_0x3a9b27[_0x22e7('0x47')]['id']}})['then'](handleEntityNotFound(_0xfda45d,null))[_0x22e7('0x25')](function(_0x14d466){if(_0x14d466){_0x603722=_0x14d466;_0x16be42[_0x22e7('0x31')]=_[_0x22e7('0x33')](db[_0x22e7('0x57')]['rawAttributes']);_0x16be42[_0x22e7('0x32')]=_[_0x22e7('0x33')](_0x3a9b27[_0x22e7('0x32')]);_0x16be42[_0x22e7('0x34')]=_[_0x22e7('0x35')](_0x16be42[_0x22e7('0x31')],_0x16be42[_0x22e7('0x32')]);_0x2e144d['attributes']=_[_0x22e7('0x35')](_0x16be42[_0x22e7('0x31')],qs[_0x22e7('0x37')](_0x3a9b27[_0x22e7('0x32')][_0x22e7('0x37')]));_0x2e144d[_0x22e7('0x36')]=_0x2e144d['attributes'][_0x22e7('0x38')]?_0x2e144d['attributes']:_0x16be42[_0x22e7('0x31')];_0x2e144d['order']=qs['sort'](_0x3a9b27[_0x22e7('0x32')][_0x22e7('0x53')]);_0x2e144d[_0x22e7('0x3b')]=qs['filters'](_[_0x22e7('0x3c')](_0x3a9b27['query'],_0x16be42[_0x22e7('0x34')]));if(_0x3a9b27[_0x22e7('0x32')][_0x22e7('0x3d')]){_0x2e144d[_0x22e7('0x3b')]=_['merge'](_0x2e144d[_0x22e7('0x3b')],{'$or':_[_0x22e7('0x2c')](_0x2e144d[_0x22e7('0x36')],function(_0x30ec01){var _0x2f0f87={};_0x2f0f87[_0x30ec01]={'$like':'%'+_0x3a9b27[_0x22e7('0x32')]['filter']+'%'};return _0x2f0f87;})});}if(_0x3a9b27[_0x22e7('0x32')][_0x22e7('0x5a')]){var _0x259c41=_0x3a9b27[_0x22e7('0x32')]['$gte'][_0x22e7('0x5b')](',');var _0x44ed73={};_0x44ed73[_0x259c41[0x0]]={'$gte':moment(_0x259c41[0x1])[_0x22e7('0x5c')](_0x22e7('0x5d'))};_0x2e144d[_0x22e7('0x3b')]=_['merge'](_0x2e144d[_0x22e7('0x3b')],_0x44ed73);}_0x2e144d=_['merge']({},_0x2e144d,_0x3a9b27['options']);return _0x603722[_0x22e7('0x58')](_0x2e144d);}})[_0x22e7('0x25')](function(_0x20b74e){if(_0x20b74e){_0x10ec9d=_0x20b74e[_0x22e7('0x38')];if(!_0x3a9b27[_0x22e7('0x32')][_0x22e7('0x39')](_0x22e7('0x3a'))){_0x2e144d[_0x22e7('0x21')]=qs[_0x22e7('0x21')](_0x3a9b27['query']['limit']);_0x2e144d[_0x22e7('0x1f')]=qs['offset'](_0x3a9b27[_0x22e7('0x32')][_0x22e7('0x1f')]);}return _0x603722[_0x22e7('0x58')](_0x2e144d);}})[_0x22e7('0x25')](function(_0x52978d){if(_0x52978d){return _0x52978d?{'count':_0x10ec9d,'rows':_0x52978d}:null;}})[_0x22e7('0x25')](respondWithResult(_0xfda45d,null))[_0x22e7('0x45')](handleError(_0xfda45d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 76f5ad8..5f420c4 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 _0x7750=['hook','events','ChatGroup','setMaxListeners','emit'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0x7750,0x182));var _0x0775=function(_0x5b77fe,_0x3ba4ec){_0x5b77fe=_0x5b77fe-0x0;var _0x33cf70=_0x7750[_0x5b77fe];return _0x33cf70;};'use strict';var EventEmitter=require(_0x0775('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x0775('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0775('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x255bdc){return function(_0x26b370,_0x114bbd,_0x3a2f34){ChatGroupEvents[_0x0775('0x3')](_0x255bdc+':'+_0x26b370['id'],_0x26b370);ChatGroupEvents[_0x0775('0x3')](_0x255bdc,_0x26b370);_0x3a2f34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x0775('0x4')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x7d8d=['hook','exports','events','../../mysqldb','ChatGroup','save','remove','emit','hasOwnProperty'];(function(_0x1c8e01,_0x214061){var _0x1c0a52=function(_0x2903b2){while(--_0x2903b2){_0x1c8e01['push'](_0x1c8e01['shift']());}};_0x1c0a52(++_0x214061);}(_0x7d8d,0x134));var _0xd7d8=function(_0x59f624,_0x5d01bd){_0x59f624=_0x59f624-0x0;var _0xc848a5=_0x7d8d[_0x59f624];return _0xc848a5;};'use strict';var EventEmitter=require(_0xd7d8('0x0'));var ChatGroup=require(_0xd7d8('0x1'))['db'][_0xd7d8('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd7d8('0x3'),'afterUpdate':'update','afterDestroy':_0xd7d8('0x4')};function emitEvent(_0x12de2f){return function(_0xb37a2b,_0x443200,_0x4a2da3){ChatGroupEvents[_0xd7d8('0x5')](_0x12de2f+':'+_0xb37a2b['id'],_0xb37a2b);ChatGroupEvents[_0xd7d8('0x5')](_0x12de2f,_0xb37a2b);_0x4a2da3(null);};}for(var e in events){if(events[_0xd7d8('0x6')](e)){var event=events[e];ChatGroup[_0xd7d8('0x7')](e,emitEvent(event));}}module[_0xd7d8('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index d4a5c61..a30014d 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 _0xe3c5=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes','exports','chat_groups'];(function(_0x9056a4,_0x421387){var _0x39324e=function(_0x54d19a){while(--_0x54d19a){_0x9056a4['push'](_0x9056a4['shift']());}};_0x39324e(++_0x421387);}(_0xe3c5,0xfa));var _0x5e3c=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0xe3c5[_0x5f746f];return _0x198d15;};'use strict';var _=require(_0x5e3c('0x0'));var util=require('util');var logger=require(_0x5e3c('0x1'))('api');var moment=require(_0x5e3c('0x2'));var BPromise=require(_0x5e3c('0x3'));var rp=require(_0x5e3c('0x4'));var fs=require('fs');var path=require(_0x5e3c('0x5'));var rimraf=require('rimraf');var config=require(_0x5e3c('0x6'));var attributes=require(_0x5e3c('0x7'));module[_0x5e3c('0x8')]=function(_0x599055,_0x2a13a1){return _0x599055['define']('ChatGroup',attributes,{'tableName':_0x5e3c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e9a=['./chatGroup.attributes','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x302e01,_0xfd8a5){var _0x379e38=function(_0x240e7b){while(--_0x240e7b){_0x302e01['push'](_0x302e01['shift']());}};_0x379e38(++_0xfd8a5);}(_0x5e9a,0xee));var _0xa5e9=function(_0x5264ff,_0x51395b){_0x5264ff=_0x5264ff-0x0;var _0x390fd3=_0x5e9a[_0x5264ff];return _0x390fd3;};'use strict';var _=require('lodash');var util=require(_0xa5e9('0x0'));var logger=require(_0xa5e9('0x1'))(_0xa5e9('0x2'));var moment=require(_0xa5e9('0x3'));var BPromise=require(_0xa5e9('0x4'));var rp=require(_0xa5e9('0x5'));var fs=require('fs');var path=require(_0xa5e9('0x6'));var rimraf=require(_0xa5e9('0x7'));var config=require(_0xa5e9('0x8'));var attributes=require(_0xa5e9('0x9'));module['exports']=function(_0x8644ca,_0x2fd666){return _0x8644ca[_0xa5e9('0xa')](_0xa5e9('0xb'),attributes,{'tableName':_0xa5e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 9b57e57..d12947b 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 _0x536e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x536e,0x155));var _0xe536=function(_0x550eb7,_0x465856){_0x550eb7=_0x550eb7-0x0;var _0x33bffe=_0x536e[_0x550eb7];return _0x33bffe;};'use strict';var _=require(_0xe536('0x0'));var util=require(_0xe536('0x1'));var moment=require(_0xe536('0x2'));var BPromise=require(_0xe536('0x3'));var rs=require(_0xe536('0x4'));var fs=require('fs');var Redis=require(_0xe536('0x5'));var db=require(_0xe536('0x6'))['db'];var utils=require(_0xe536('0x7'));var logger=require(_0xe536('0x8'))(_0xe536('0x9'));var config=require(_0xe536('0xa'));var jayson=require(_0xe536('0xb'));var client=jayson[_0xe536('0xc')][_0xe536('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe536('0xe')],{'host':_0xe536('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe536('0xe')]));require(_0xe536('0x10'))[_0xe536('0x11')](socket);function respondWithRpcPromise(_0x1d9dcd,_0x2581df,_0x1df409){return new BPromise(function(_0xe08ef0,_0x507dad){return client['request'](_0x1d9dcd,_0x1df409)[_0xe536('0x12')](function(_0xbec6ca){logger['info'](_0xe536('0x13'),_0x2581df,_0xe536('0x14'));logger[_0xe536('0x15')](_0xe536('0x16'),_0x2581df,_0xe536('0x14'),JSON[_0xe536('0x17')](_0xbec6ca));if(_0xbec6ca['error']){if(_0xbec6ca[_0xe536('0x18')][_0xe536('0x19')]===0x1f4){logger[_0xe536('0x18')](_0xe536('0x13'),_0x2581df,_0xbec6ca[_0xe536('0x18')]['message']);return _0x507dad(_0xbec6ca[_0xe536('0x18')][_0xe536('0x1a')]);}logger[_0xe536('0x18')]('ChatGroup,\x20%s,\x20%s',_0x2581df,_0xbec6ca[_0xe536('0x18')][_0xe536('0x1a')]);return _0xe08ef0(_0xbec6ca[_0xe536('0x18')][_0xe536('0x1a')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x2581df,_0xe536('0x14'));_0xe08ef0(_0xbec6ca[_0xe536('0x1b')][_0xe536('0x1a')]);}})[_0xe536('0x1c')](function(_0x4f6eb2){logger['error'](_0xe536('0x13'),_0x2581df,_0x4f6eb2);_0x507dad(_0x4f6eb2);});});} \ No newline at end of file +var _0x331c=['ioredis','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment'];(function(_0x28fac3,_0x49b0e7){var _0x3b79e6=function(_0x25a1b8){while(--_0x25a1b8){_0x28fac3['push'](_0x28fac3['shift']());}};_0x3b79e6(++_0x49b0e7);}(_0x331c,0xf0));var _0xc331=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x331c[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xc331('0x0'));var util=require('util');var moment=require(_0xc331('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc331('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc331('0x3'))('rpc');var config=require(_0xc331('0x4'));var jayson=require(_0xc331('0x5'));var client=jayson['client'][_0xc331('0x6')]({'port':0x232a});config[_0xc331('0x7')]=_['defaults'](config[_0xc331('0x7')],{'host':_0xc331('0x8'),'port':0x18eb});var socket=require(_0xc331('0x9'))(new Redis(config[_0xc331('0x7')]));require('./chatGroup.socket')[_0xc331('0xa')](socket);function respondWithRpcPromise(_0x55769a,_0x2c4a55,_0x3d9205){return new BPromise(function(_0x4381be,_0x199287){return client[_0xc331('0xb')](_0x55769a,_0x3d9205)[_0xc331('0xc')](function(_0x3e5932){logger[_0xc331('0xd')](_0xc331('0xe'),_0x2c4a55,'request\x20sent');logger[_0xc331('0xf')](_0xc331('0x10'),_0x2c4a55,_0xc331('0x11'),JSON[_0xc331('0x12')](_0x3e5932));if(_0x3e5932[_0xc331('0x13')]){if(_0x3e5932[_0xc331('0x13')]['code']===0x1f4){logger[_0xc331('0x13')](_0xc331('0xe'),_0x2c4a55,_0x3e5932['error'][_0xc331('0x14')]);return _0x199287(_0x3e5932[_0xc331('0x13')][_0xc331('0x14')]);}logger[_0xc331('0x13')]('ChatGroup,\x20%s,\x20%s',_0x2c4a55,_0x3e5932['error'][_0xc331('0x14')]);return _0x4381be(_0x3e5932[_0xc331('0x13')]['message']);}else{logger[_0xc331('0xd')](_0xc331('0xe'),_0x2c4a55,'request\x20sent');_0x4381be(_0x3e5932[_0xc331('0x15')][_0xc331('0x14')]);}})['catch'](function(_0x110afe){logger[_0xc331('0x13')](_0xc331('0xe'),_0x2c4a55,_0x110afe);_0x199287(_0x110afe);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 510a066..6db246d 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 _0x40d1=['remove','update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x102469,_0x3af853){var _0x57cd31=function(_0x57de24){while(--_0x57de24){_0x102469['push'](_0x102469['shift']());}};_0x57cd31(++_0x3af853);}(_0x40d1,0x130));var _0x140d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x40d1[_0x1035c1];return _0x308d67;};'use strict';var ChatGroupEvents=require(_0x140d('0x0'));var events=[_0x140d('0x1'),_0x140d('0x2'),_0x140d('0x3')];function createListener(_0x25d61a,_0x3be6ee){return function(_0x247473){_0x3be6ee[_0x140d('0x4')](_0x25d61a,_0x247473);};}function removeListener(_0x39fc6a,_0x3289fb){return function(){ChatGroupEvents[_0x140d('0x5')](_0x39fc6a,_0x3289fb);};}exports[_0x140d('0x6')]=function(_0x14d72f){for(var _0x424ae4=0x0,_0x801b4b=events[_0x140d('0x7')];_0x424ae4<_0x801b4b;_0x424ae4++){var _0x5e424b=events[_0x424ae4];var _0x50fd0c=createListener(_0x140d('0x8')+_0x5e424b,_0x14d72f);ChatGroupEvents['on'](_0x5e424b,_0x50fd0c);}}; \ No newline at end of file +var _0x8892=['save','update','emit','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8892,0xb7));var _0x2889=function(_0x174024,_0x1c34d3){_0x174024=_0x174024-0x0;var _0x1e6f08=_0x8892[_0x174024];return _0x1e6f08;};'use strict';var ChatGroupEvents=require(_0x2889('0x0'));var events=[_0x2889('0x1'),'remove',_0x2889('0x2')];function createListener(_0x22378f,_0x5dadc3){return function(_0x11009a){_0x5dadc3[_0x2889('0x3')](_0x22378f,_0x11009a);};}function removeListener(_0x13e14a,_0x1377ff){return function(){ChatGroupEvents[_0x2889('0x4')](_0x13e14a,_0x1377ff);};}exports[_0x2889('0x5')]=function(_0x51062c){for(var _0x1f7787=0x0,_0x231348=events[_0x2889('0x6')];_0x1f7787<_0x231348;_0x1f7787++){var _0x5202c9=events[_0x1f7787];var _0x34bf98=createListener(_0x2889('0x7')+_0x5202c9,_0x51062c);ChatGroupEvents['on'](_0x5202c9,_0x34bf98);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index fcdf46c..c4abd36 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 _0x68ac=['connect-timeout','Router','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','put','update','delete','destroy','removeMembers','exports','util','path'];(function(_0x45b9b1,_0x432eab){var _0x245b7d=function(_0x35f14a){while(--_0x35f14a){_0x45b9b1['push'](_0x45b9b1['shift']());}};_0x245b7d(++_0x432eab);}(_0x68ac,0x6a));var _0xc68a=function(_0x38fad2,_0x169ef8){_0x38fad2=_0x38fad2-0x0;var _0x1fd3fa=_0x68ac[_0x38fad2];return _0x1fd3fa;};'use strict';var multer=require('multer');var util=require(_0xc68a('0x0'));var path=require(_0xc68a('0x1'));var timeout=require(_0xc68a('0x2'));var express=require('express');var router=express[_0xc68a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc68a('0x4'));var controller=require('./chatGroup.controller');router[_0xc68a('0x5')]('/',auth['isAuthenticated'](),controller[_0xc68a('0x6')]);router['get'](_0xc68a('0x7'),auth[_0xc68a('0x8')](),controller[_0xc68a('0x9')]);router[_0xc68a('0x5')](_0xc68a('0xa'),auth['isAuthenticated'](),controller[_0xc68a('0xb')]);router[_0xc68a('0x5')](_0xc68a('0xc'),auth[_0xc68a('0x8')](),controller[_0xc68a('0xd')]);router[_0xc68a('0x5')](_0xc68a('0xe'),auth[_0xc68a('0x8')](),controller[_0xc68a('0xf')]);router[_0xc68a('0x5')](_0xc68a('0x10'),auth['isAuthenticated'](),controller[_0xc68a('0x11')]);router[_0xc68a('0x12')]('/',auth[_0xc68a('0x8')](),controller[_0xc68a('0x13')]);router[_0xc68a('0x12')](_0xc68a('0xe'),auth[_0xc68a('0x8')](),controller['addMembers']);router[_0xc68a('0x12')](_0xc68a('0x10'),auth['isAuthenticated'](),controller[_0xc68a('0x14')]);router[_0xc68a('0x15')](_0xc68a('0xa'),auth[_0xc68a('0x8')](),controller[_0xc68a('0x16')]);router[_0xc68a('0x17')](_0xc68a('0xa'),auth['isAuthenticated'](),controller[_0xc68a('0x18')]);router[_0xc68a('0x17')]('/:id/members',auth[_0xc68a('0x8')](),controller[_0xc68a('0x19')]);module[_0xc68a('0x1a')]=router; \ No newline at end of file +var _0x8aef=['/describe','describe','get','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x3fc287,_0x5c3f36){var _0x33af9f=function(_0x27cfc6){while(--_0x27cfc6){_0x3fc287['push'](_0x3fc287['shift']());}};_0x33af9f(++_0x5c3f36);}(_0x8aef,0x9e));var _0xf8ae=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x8aef[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0xf8ae('0x0'));var util=require(_0xf8ae('0x1'));var path=require(_0xf8ae('0x2'));var timeout=require(_0xf8ae('0x3'));var express=require(_0xf8ae('0x4'));var router=express[_0xf8ae('0x5')]();var fs_extra=require(_0xf8ae('0x6'));var auth=require(_0xf8ae('0x7'));var interaction=require(_0xf8ae('0x8'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth[_0xf8ae('0x9')](),controller['index']);router['get'](_0xf8ae('0xa'),auth[_0xf8ae('0x9')](),controller[_0xf8ae('0xb')]);router[_0xf8ae('0xc')](_0xf8ae('0xd'),auth[_0xf8ae('0x9')](),controller['show']);router[_0xf8ae('0xc')](_0xf8ae('0xe'),auth[_0xf8ae('0x9')](),controller[_0xf8ae('0xf')]);router[_0xf8ae('0xc')](_0xf8ae('0x10'),auth[_0xf8ae('0x9')](),controller[_0xf8ae('0x11')]);router['get'](_0xf8ae('0x12'),auth[_0xf8ae('0x9')](),controller[_0xf8ae('0x13')]);router[_0xf8ae('0x14')]('/',auth[_0xf8ae('0x9')](),controller[_0xf8ae('0x15')]);router[_0xf8ae('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0xf8ae('0x16')]);router[_0xf8ae('0x14')](_0xf8ae('0x12'),auth[_0xf8ae('0x9')](),controller[_0xf8ae('0x17')]);router[_0xf8ae('0x18')]('/:id',auth[_0xf8ae('0x9')](),controller[_0xf8ae('0x19')]);router[_0xf8ae('0x1a')](_0xf8ae('0xd'),auth[_0xf8ae('0x9')](),controller['destroy']);router[_0xf8ae('0x1a')](_0xf8ae('0x10'),auth[_0xf8ae('0x9')](),controller['removeMembers']);module[_0xf8ae('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index b5942f3..f06bad5 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 _0x0bf5=['BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x5c6a78,_0x5c0503){var _0x236c5e=function(_0x44ef45){while(--_0x44ef45){_0x5c6a78['push'](_0x5c6a78['shift']());}};_0x236c5e(++_0x5c0503);}(_0x0bf5,0x11c));var _0x50bf=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x0bf5[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x50bf('0x0'));module[_0x50bf('0x1')]={'closed':{'type':Sequelize[_0x50bf('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x50bf('0x3')]},'ratingType':{'type':Sequelize[_0x50bf('0x4')](_0x50bf('0x5'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x50bf('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x50bf('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x50bf('0x8')]},'disposition':{'type':Sequelize[_0x50bf('0x7')]},'secondDisposition':{'type':Sequelize[_0x50bf('0x7')]},'thirdDisposition':{'type':Sequelize[_0x50bf('0x7')]},'note':{'type':Sequelize[_0x50bf('0x7')]},'browserName':{'type':Sequelize[_0x50bf('0x7')]},'browserVersion':{'type':Sequelize[_0x50bf('0x7')]},'osName':{'type':Sequelize[_0x50bf('0x7')]},'osVersion':{'type':Sequelize[_0x50bf('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x50bf('0x7')]},'deviceType':{'type':Sequelize[_0x50bf('0x7')]},'referer':{'type':Sequelize[_0x50bf('0x6')]},'customerIp':{'type':Sequelize[_0x50bf('0x7')]},'formData':{'type':Sequelize[_0x50bf('0x6')](_0x50bf('0x9'))},'read1stAt':{'type':Sequelize[_0x50bf('0x8')]},'lastMsgAt':{'type':Sequelize[_0x50bf('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x50bf('0x4')]('in',_0x50bf('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x50bf('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x50bf('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x50bf('0x3')]}}; \ No newline at end of file +var _0x1596=['INTEGER','sequelize','exports','BOOLEAN','star','thumb','TEXT','STRING','DATE','long','ENUM','out'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x1596,0x175));var _0x6159=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1596[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x6159('0x0'));module[_0x6159('0x1')]={'closed':{'type':Sequelize[_0x6159('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x6159('0x3'),_0x6159('0x4')),'defaultValue':_0x6159('0x3')},'ratingMessage':{'type':Sequelize[_0x6159('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x6159('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6159('0x7')]},'disposition':{'type':Sequelize[_0x6159('0x6')]},'secondDisposition':{'type':Sequelize[_0x6159('0x6')]},'thirdDisposition':{'type':Sequelize[_0x6159('0x6')]},'note':{'type':Sequelize[_0x6159('0x6')]},'browserName':{'type':Sequelize[_0x6159('0x6')]},'browserVersion':{'type':Sequelize[_0x6159('0x6')]},'osName':{'type':Sequelize[_0x6159('0x6')]},'osVersion':{'type':Sequelize[_0x6159('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x6159('0x6')]},'deviceType':{'type':Sequelize[_0x6159('0x6')]},'referer':{'type':Sequelize[_0x6159('0x5')]},'customerIp':{'type':Sequelize[_0x6159('0x6')]},'formData':{'type':Sequelize[_0x6159('0x5')](_0x6159('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x6159('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x6159('0x9')]('in',_0x6159('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6159('0x6')]},'customerPort':{'type':Sequelize[_0x6159('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x6159('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x6159('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6159('0xb')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 4827ac9..aa6700f 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 _0xe705=['redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','destroy','stack','name','render','merge','body','contact','interaction','account','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','options','find','create','update','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','closed','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ContactId','%s%d','Visitor','agentAlias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','ids','getMessages','findOne','length','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','secret','includeAgent','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','push','Contact','firstName','Account','Owner','get','mkdirSync','Chat','N.A.','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x3dc24c,_0x1f231d){var _0x4f0e1d=function(_0x3c4b6e){while(--_0x3c4b6e){_0x3dc24c['push'](_0x3dc24c['shift']());}};_0x4f0e1d(++_0x1f231d);}(_0xe705,0xc8));var _0x5e70=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0xe705[_0x54a9e3];return _0x247cce;};'use strict';var rimraf=require(_0x5e70('0x0'));var zipdir=require(_0x5e70('0x1'));var rp=require(_0x5e70('0x2'));var moment=require(_0x5e70('0x3'));var BPromise=require(_0x5e70('0x4'));var Mustache=require('mustache');var util=require(_0x5e70('0x5'));var path=require(_0x5e70('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5e70('0x7'));var Redis=require(_0x5e70('0x8'));var interaction=require(_0x5e70('0x9'));var qs=require(_0x5e70('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0x5e70('0xb'))('api');var config=require(_0x5e70('0xc'));var db=require(_0x5e70('0xd'))['db'];config[_0x5e70('0xe')]=_['defaults'](config[_0x5e70('0xe')],{'host':_0x5e70('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5e70('0x10'))[_0x5e70('0x11')](socket);var jayson=require(_0x5e70('0x12'));var client=jayson[_0x5e70('0x13')][_0x5e70('0x14')]({'port':0x232b});var client9004=jayson[_0x5e70('0x13')][_0x5e70('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x2fb9d2,_0x55f4f7,_0x3d68eb,_0x37d258){return new BPromise(function(_0x17d963,_0x2c30ee){var _0x4895ae=_0x37d258||client;return _0x4895ae[_0x5e70('0x15')](_0x2fb9d2,_0x3d68eb)[_0x5e70('0x16')](function(_0x40b261){logger['info'](_0x5e70('0x17'),_0x55f4f7,_0x5e70('0x18'));logger[_0x5e70('0x19')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x55f4f7,'request\x20sent',JSON[_0x5e70('0x1a')](_0x40b261));if(_0x40b261[_0x5e70('0x1b')]){if(_0x40b261[_0x5e70('0x1b')]['code']===0x1f4){logger[_0x5e70('0x1b')](_0x5e70('0x17'),_0x55f4f7,_0x40b261[_0x5e70('0x1b')][_0x5e70('0x1c')]);return _0x2c30ee(_0x40b261[_0x5e70('0x1b')][_0x5e70('0x1c')]);}logger[_0x5e70('0x1b')](_0x5e70('0x17'),_0x55f4f7,_0x40b261[_0x5e70('0x1b')][_0x5e70('0x1c')]);return _0x17d963(_0x40b261[_0x5e70('0x1b')][_0x5e70('0x1c')]);}else{logger[_0x5e70('0x1d')](_0x5e70('0x17'),_0x55f4f7,'request\x20sent');_0x17d963(_0x40b261[_0x5e70('0x1e')]['message']);}})[_0x5e70('0x1f')](function(_0xdc589e){logger[_0x5e70('0x1b')](_0x5e70('0x17'),_0x55f4f7,_0xdc589e);_0x2c30ee(_0xdc589e);});});}function respondWithStatusCode(_0x43fcfc,_0x515782){_0x515782=_0x515782||0xcc;return function(_0x313229){if(_0x313229){return _0x43fcfc[_0x5e70('0x20')](_0x515782);}return _0x43fcfc['status'](_0x515782)[_0x5e70('0x21')]();};}function respondWithResult(_0x17f0ae,_0xf5e495){_0xf5e495=_0xf5e495||0xc8;return function(_0x18d401){if(_0x18d401){return _0x17f0ae[_0x5e70('0x22')](_0xf5e495)[_0x5e70('0x23')](_0x18d401);}};}function respondWithFilteredResult(_0x4f033b,_0xa5bd7c){return function(_0x11043d){if(_0x11043d){var _0x26dba6=typeof _0xa5bd7c[_0x5e70('0x24')]===_0x5e70('0x25')&&typeof _0xa5bd7c['limit']===_0x5e70('0x25');var _0x3d2978=_0x11043d[_0x5e70('0x26')];var _0xafb6fd=_0x26dba6?0x0:_0xa5bd7c[_0x5e70('0x24')];var _0x5bc0c4=_0x26dba6?_0x11043d[_0x5e70('0x26')]:_0xa5bd7c['offset']+_0xa5bd7c[_0x5e70('0x27')];var _0x47dd0c;if(_0x5bc0c4>=_0x3d2978){_0x5bc0c4=_0x3d2978;_0x47dd0c=0xc8;}else{_0x47dd0c=0xce;}_0x4f033b['status'](_0x47dd0c);return _0x4f033b[_0x5e70('0x28')]('Content-Range',_0xafb6fd+'-'+_0x5bc0c4+'/'+_0x3d2978)[_0x5e70('0x23')](_0x11043d);}return null;};}function saveUpdates(_0x380bc6){return function(_0x27fba0){if(_0x27fba0){return _0x27fba0['update'](_0x380bc6)['then'](function(_0x5b650c){return _0x5b650c;});}return null;};}function removeEntity(_0x4d3fe3){return function(_0x33aaad){if(_0x33aaad){return _0x33aaad[_0x5e70('0x29')]()[_0x5e70('0x16')](function(){_0x4d3fe3[_0x5e70('0x22')](0xcc)[_0x5e70('0x21')]();});}};}function handleEntityNotFound(_0x7b080){return function(_0x32eb29){if(!_0x32eb29){_0x7b080['sendStatus'](0x194);}return _0x32eb29;};}function handleError(_0x5f0c06,_0x596c52){_0x596c52=_0x596c52||0x1f4;return function(_0x1af793){logger['error'](_0x1af793[_0x5e70('0x2a')]);if(_0x1af793['name']){delete _0x1af793[_0x5e70('0x2b')];}_0x5f0c06[_0x5e70('0x22')](_0x596c52)['send'](_0x1af793);};}function getMustacheRender(_0x146333,_0x1f7d07){return Mustache[_0x5e70('0x2c')](_0x146333,_[_0x5e70('0x2d')](_0x1f7d07[_0x5e70('0x2e')],{'contact':_0x1f7d07[_0x5e70('0x2f')],'message':_0x1f7d07[_0x5e70('0x1c')],'agent':_0x1f7d07['agent'],'interaction':_0x1f7d07[_0x5e70('0x30')],'account':_0x1f7d07[_0x5e70('0x31')]}))||'';}exports['index']=function(_0x4364db,_0x261cc1){var _0x408d23={};var _0x3509b3=_[_0x5e70('0x32')](db[_0x5e70('0x33')][_0x5e70('0x34')],function(_0x5de661){return{'name':_0x5de661[_0x5e70('0x35')],'type':_0x5de661[_0x5e70('0x36')][_0x5e70('0x37')]};});_0x408d23=qs[_0x5e70('0x38')](_0x3509b3,_0x4364db);return interaction[_0x5e70('0x39')](_0x5e70('0x3a'),_0x4364db[_0x5e70('0x3b')],_0x4364db[_0x5e70('0x3c')],_0x408d23,_0x3509b3)[_0x5e70('0x16')](respondWithFilteredResult(_0x261cc1,_0x408d23))['catch'](handleError(_0x261cc1,null));};exports[_0x5e70('0x3d')]=function(_0x2a5152,_0x941360){var _0x3d38cf={'raw':![],'where':{'id':_0x2a5152[_0x5e70('0x3e')]['id']}},_0x3752af={};_0x3752af[_0x5e70('0x3f')]=_[_0x5e70('0x40')](db[_0x5e70('0x33')][_0x5e70('0x34')]);_0x3752af[_0x5e70('0x3b')]=_[_0x5e70('0x40')](_0x2a5152['query']);_0x3752af[_0x5e70('0x41')]=_[_0x5e70('0x42')](_0x3752af[_0x5e70('0x3f')],_0x3752af[_0x5e70('0x3b')]);_0x3d38cf[_0x5e70('0x43')]=_[_0x5e70('0x42')](_0x3752af['model'],qs[_0x5e70('0x44')](_0x2a5152[_0x5e70('0x3b')][_0x5e70('0x44')]));_0x3d38cf[_0x5e70('0x43')]=_0x3d38cf[_0x5e70('0x43')]['length']?_0x3d38cf[_0x5e70('0x43')]:_0x3752af[_0x5e70('0x3f')];if(_0x2a5152[_0x5e70('0x3b')][_0x5e70('0x45')]){_0x3d38cf[_0x5e70('0x46')]=[{'all':!![]}];}_0x3d38cf=_[_0x5e70('0x2d')]({},_0x3d38cf,_0x2a5152[_0x5e70('0x47')]);return db[_0x5e70('0x33')][_0x5e70('0x48')](_0x3d38cf)[_0x5e70('0x16')](handleEntityNotFound(_0x941360,null))[_0x5e70('0x16')](respondWithResult(_0x941360,null))['catch'](handleError(_0x941360,null));};exports[_0x5e70('0x49')]=function(_0x4b6b11,_0xf90a3b){return db[_0x5e70('0x33')][_0x5e70('0x49')](_0x4b6b11[_0x5e70('0x2e')],{})[_0x5e70('0x16')](respondWithResult(_0xf90a3b,0xc9))[_0x5e70('0x1f')](handleError(_0xf90a3b,null));};exports[_0x5e70('0x4a')]=function(_0x32f3cd,_0x45ae50){if(_0x32f3cd['body']['id']){delete _0x32f3cd[_0x5e70('0x2e')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x32f3cd['params']['id']}})['then'](handleEntityNotFound(_0x45ae50,null))[_0x5e70('0x16')](saveUpdates(_0x32f3cd[_0x5e70('0x2e')],null))[_0x5e70('0x16')](respondWithResult(_0x45ae50,null))[_0x5e70('0x1f')](handleError(_0x45ae50,null));};exports['destroy']=function(_0x2e4f2a,_0x20f59b){return db[_0x5e70('0x33')][_0x5e70('0x48')]({'where':{'id':_0x2e4f2a[_0x5e70('0x3e')]['id']}})['then'](handleEntityNotFound(_0x20f59b,null))[_0x5e70('0x16')](removeEntity(_0x20f59b,null))[_0x5e70('0x1f')](handleError(_0x20f59b,null));};exports[_0x5e70('0x4b')]=function(_0x4b8848,_0xa73900){return db[_0x5e70('0x33')]['describe']()[_0x5e70('0x16')](respondWithResult(_0xa73900,null))['catch'](handleError(_0xa73900,null));};exports[_0x5e70('0x4c')]=function(_0xf73773,_0x3ab706){var _0x470019=_0xf73773['params']['id'];var _0x3dc4fe;var _0x5e4770;var _0x43339b;return db[_0x5e70('0x33')]['findOne']({'where':{'id':_0x470019}})[_0x5e70('0x16')](function(_0x4fb5c2){_0x3dc4fe=_0x4fb5c2;return db[_0x5e70('0x4d')]['findOne']({'where':{'id':_0x4fb5c2[_0x5e70('0x4e')]},'attributes':['id',_0x5e70('0x4f'),_0x5e70('0x50'),_0x5e70('0x51'),_0x5e70('0x52'),_0x5e70('0x53')],'raw':!![]});})[_0x5e70('0x16')](function(_0x4a8ad3){if(_0x4a8ad3&&_0x4a8ad3[_0x5e70('0x4f')]&&_0x4a8ad3[_0x5e70('0x50')]){_0x5e4770=_0x4a8ad3;var _0x38354d={'interaction':{'id':_0x470019},'agent':{'id':_0xf73773['user']['id'],'name':_0xf73773['user'][_0x5e70('0x2b')],'fullname':_0xf73773[_0x5e70('0x3c')][_0x5e70('0x54')],'email':_0xf73773[_0x5e70('0x3c')][_0x5e70('0x55')]},'contact':_0xf73773[_0x5e70('0x2e')][_0x5e70('0x2f')],'account':_0xf73773['body']['account']};var _0x5bdc5f={'rejectUnauthorized':![],'method':_0x5e70('0x56'),'url':_0x5e70('0x57'),'headers':{'X-APIKEY':_0x4a8ad3[_0x5e70('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xf73773['user'][_0x5e70('0x55')]],'buttons':null,'topic':_0x5e4770[_0x5e70('0x51')],'note':_[_0x5e70('0x58')](_0x5e4770['vidaooNote'])?null:getMustacheRender(_0x5e4770['vidaooNote'],_0x38354d),'metadata':null},'redirect':_0x5e70('0x59'),'json':!![]};try{if(!_[_0x5e70('0x58')](_0x5e4770[_0x5e70('0x53')])){var _0x262fb1=getMustacheRender(_0x5e4770[_0x5e70('0x53')],_0x38354d);var _0x54b575=JSON[_0x5e70('0x5a')](_0x262fb1);_0x5bdc5f['body'][_0x5e70('0x5b')]=_0x54b575;}}catch(_0x1fe2b5){throw new db[(_0x5e70('0x5c'))][(_0x5e70('0x5d'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5bdc5f);}else{throw new db['Sequelize'][(_0x5e70('0x5d'))](_0x5e70('0x5e'));}})[_0x5e70('0x16')](function(_0x53fe4f){_0x43339b=_0x53fe4f;if(_0x43339b['id']){var _0x17ef5b={'body':_0x43339b[_0x5e70('0x5f')],'ChatWebsiteId':_0x5e4770['id'],'ChatInteractionId':_0x3dc4fe['id'],'direction':_0x5e70('0x60'),'UserId':_0xf73773[_0x5e70('0x3c')]['id']};return db[_0x5e70('0x61')][_0x5e70('0x49')](_0x17ef5b,{});}else{throw new db[(_0x5e70('0x5c'))]['ValidationError'](_0x5e70('0x62'));}})['then'](function(){return _0x3dc4fe[_0x5e70('0x63')]({'vidaooSessionId':_0x43339b['id']});})[_0x5e70('0x16')](respondWithResult(_0x3ab706,null))[_0x5e70('0x1f')](handleError(_0x3ab706,null));};exports[_0x5e70('0x64')]=function(_0x362e76,_0x54511b){if(_0x362e76[_0x5e70('0x2e')]['id']){delete _0x362e76['body']['id'];}return db[_0x5e70('0x33')][_0x5e70('0x48')]({'where':{'id':_0x362e76['params']['id']},'include':[{'model':db[_0x5e70('0x65')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x54511b,null))[_0x5e70('0x16')](saveUpdates(_0x362e76[_0x5e70('0x2e')],null))['then'](respondWithResult(_0x54511b,null))[_0x5e70('0x1f')](handleError(_0x54511b,null));};exports[_0x5e70('0x66')]=function(_0x4794d5,_0x4360dd){if(_0x4794d5['body']['id']){delete _0x4794d5['body']['id'];}return db[_0x5e70('0x33')][_0x5e70('0x48')]({'where':{'id':_0x4794d5[_0x5e70('0x3e')]['id']}})['then'](function(_0x4cbbf6){if(!_0x4cbbf6){logger['error'](_0x5e70('0x67'),_0x5e70('0x66'),0x194,_0x5e70('0x68'));_0x4360dd[_0x5e70('0x20')](0x194);}else{if(_0x4cbbf6[_0x5e70('0x69')]){throw new db[(_0x5e70('0x5c'))]['ValidationError'](_0x5e70('0x6a'));}}return _0x4cbbf6;})[_0x5e70('0x16')](function(_0x3c8b7f){if(_0x3c8b7f){return _0x3c8b7f[_0x5e70('0x4a')]({'closed':_0x4794d5['body']['closed'],'disposition':_0x4794d5[_0x5e70('0x2e')][_0x5e70('0x6b')]})[_0x5e70('0x16')](function(_0x4e2a77){return _0x4e2a77;});}})[_0x5e70('0x16')](function(){return respondWithRpcPromise(_0x5e70('0x6c'),_0x5e70('0x66'),_0x4794d5[_0x5e70('0x2e')],client9004);})['then'](respondWithResult(_0x4360dd,null))[_0x5e70('0x1f')](handleError(_0x4360dd,null));};exports[_0x5e70('0x6d')]=function(_0x14f0e1,_0x4793cd){_0x14f0e1[_0x5e70('0x2e')][_0x5e70('0x2b')]=_0x14f0e1[_0x5e70('0x6e')][_0x5e70('0x6f')];_0x14f0e1['body'][_0x5e70('0x70')]=_0x14f0e1[_0x5e70('0x6e')][_0x5e70('0x71')];_0x14f0e1[_0x5e70('0x2e')][_0x5e70('0x36')]=_0x14f0e1['file'][_0x5e70('0x72')];return db[_0x5e70('0x73')][_0x5e70('0x49')](_0x14f0e1['body'])[_0x5e70('0x16')](respondWithResult(_0x4793cd,0xc9))[_0x5e70('0x1f')](handleError(_0x4793cd,null));};exports['attachmentDownload']=function(_0x36df4b,_0x431953){return db[_0x5e70('0x33')]['findOne']({'where':{'id':_0x36df4b[_0x5e70('0x3e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x431953,null))[_0x5e70('0x16')](function(_0x58d69b){if(_0x58d69b){if(_0x58d69b[_0x5e70('0x74')]){return _0x431953[_0x5e70('0x22')](0x193)[_0x5e70('0x23')]({'status':0x193,'message':_0x5e70('0x75')});}return db['Attachment']['findOne']({'where':{'id':_0x36df4b['query'][_0x5e70('0x76')]},'raw':!![]})[_0x5e70('0x16')](handleEntityNotFound(_0x431953,null));}})[_0x5e70('0x16')](function(_0x2e285b){if(_0x2e285b){var _0x2b6d7a=_0x2e285b[_0x5e70('0x77')]!==null;var _0x58f7a9=path[_0x5e70('0x78')](config[_0x5e70('0x79')],_0x5e70('0x7a'));if(_0x2b6d7a){_0x58f7a9=path[_0x5e70('0x78')](_0x58f7a9,'offline-chat/');}var _0x28b8f6=path['join'](_0x58f7a9,_0x2e285b[_0x5e70('0x70')]);return _0x431953[_0x5e70('0x7b')](_0x28b8f6);}})[_0x5e70('0x1f')](handleError(_0x431953,null));};exports['close']=function(_0xb5b02b,_0x2bf957){var _0x51cb08=null;var _0xa30494=null;var _0x3bf07c=null;if(_0xb5b02b[_0x5e70('0x2e')]['id']){delete _0xb5b02b[_0x5e70('0x2e')]['id'];}if(_0xb5b02b['body'][_0x5e70('0x7c')]){_0x3bf07c=path[_0x5e70('0x78')](config['root'],_0x5e70('0x7d'),util[_0x5e70('0x7e')](_0x5e70('0x7f'),Date['now']()));_0xb5b02b[_0x5e70('0x2e')][_0x5e70('0x80')]=_0x3bf07c;}return db['ChatInteraction']['find']({'where':{'id':_0xb5b02b[_0x5e70('0x3e')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x5e70('0x81'),'include':[{'model':db[_0x5e70('0x82')],'as':_0x5e70('0x82')}]}]})[_0x5e70('0x16')](handleEntityNotFound(_0x2bf957,null))[_0x5e70('0x16')](saveUpdates(_0xb5b02b[_0x5e70('0x2e')],null))['then'](function(_0xbe77dc){if(_0xbe77dc){_0x51cb08=_0xbe77dc;return db[_0x5e70('0x4d')][_0x5e70('0x48')]({'where':{'id':_0x51cb08[_0x5e70('0x4e')]}});}})[_0x5e70('0x16')](function(_0x18f0d4){if(_0x18f0d4){_0xa30494=_0x18f0d4;return db['CmContact'][_0x5e70('0x48')]({'where':{'id':_0x51cb08[_0x5e70('0x83')]}});}})['then'](function(_0x58a037){if(_0x58a037){if(_0x3bf07c){var _0x1e00f5=null;for(var _0x2327b8=0x1;_0x2327b8<_0x51cb08[_0x5e70('0x81')]['length'];++_0x2327b8){_0x1e00f5=_0x51cb08['Messages'][_0x2327b8];var _0x3a87bd=_0x1e00f5[_0x5e70('0x69')]?util[_0x5e70('0x7e')](_0x5e70('0x84'),_0xa30494['agentAlias'],_0x1e00f5[_0x5e70('0x69')]):'System';var _0x304388=_0xb5b02b['body']['customer']||util['format']('%s%d',_0x5e70('0x85'),_0x1e00f5['ContactId']);switch(_0xa30494['agentIdentifier']){case'website_alias':_0x3a87bd=_0x1e00f5[_0x5e70('0x69')]?util[_0x5e70('0x7e')]('%s%d',_0xa30494[_0x5e70('0x86')],_0x1e00f5[_0x5e70('0x69')]):_0x5e70('0x87');break;case _0x5e70('0x88'):_0x3a87bd=_0x1e00f5[_0x5e70('0x69')]?_0x1e00f5[_0x5e70('0x82')][_0x5e70('0x89')]||_0x1e00f5['User'][_0x5e70('0x54')]:_0x5e70('0x87');break;case _0x5e70('0x8a'):_0x3a87bd=_0x1e00f5[_0x5e70('0x69')]?_0x1e00f5[_0x5e70('0x82')][_0x5e70('0x54')]:_0x5e70('0x87');break;default:_0x3a87bd=_0x1e00f5[_0x5e70('0x69')]?util[_0x5e70('0x7e')]('%s%d',_0xa30494[_0x5e70('0x86')],_0x1e00f5['UserId']):'System';}var _0x5c3226=util['format'](_0x5e70('0x8b'),moment(_0x1e00f5[_0x5e70('0x8c')])[_0x5e70('0x7e')](_0x5e70('0x8d')),_0x1e00f5[_0x5e70('0x8e')]==='in'?_0x304388:_0x3a87bd,_0x1e00f5['body']);if(!_0x1e00f5['secret']){fs[_0x5e70('0x8f')](_0x3bf07c,_0x5c3226);}}return db[_0x5e70('0x90')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x5e70('0x91')],'as':_0x5e70('0x92'),'raw':!![],'include':[{'model':db[_0x5e70('0x93')],'as':_0x5e70('0x93'),'raw':!![]}]}]});}}})['then'](function(_0x3527c0){if(!_0x3527c0||!_0x3527c0['Smtp']||!_0xb5b02b[_0x5e70('0x2e')])return _0x51cb08;var _0xb59872=_0x3527c0[_0x5e70('0x94')]();return respondWithRpcPromise(_0x5e70('0x95'),'sendMail',{'account':_0xb59872,'message':{'from':util[_0x5e70('0x7e')](_0x5e70('0x96'),_0x3527c0[_0x5e70('0x2b')],_0x3527c0['email']||_0x3527c0[_0x5e70('0x92')][_0x5e70('0x3c')]),'to':_0xb5b02b[_0x5e70('0x2e')][_0x5e70('0x7c')],'subject':_0x5e70('0x97'),'text':util[_0x5e70('0x7e')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0xb5b02b[_0x5e70('0x2e')][_0x5e70('0x7c')]),'attachments':[{'path':_0x3bf07c}]}})[_0x5e70('0x16')](function(){return _0x51cb08;})['catch'](function(_0x487c5a){logger[_0x5e70('0x1b')](_0x487c5a);});})['then'](respondWithStatusCode(_0x2bf957,0xc8))[_0x5e70('0x1f')](handleError(_0x2bf957,null));};exports[_0x5e70('0x98')]=function(_0x3634e4,_0x2bd1e9){return db[_0x5e70('0x61')][_0x5e70('0x48')]({'where':{'id':_0x3634e4[_0x5e70('0x3e')]['id']}})[_0x5e70('0x16')](handleEntityNotFound(_0x2bd1e9,null))[_0x5e70('0x16')](function(_0x315362){if(_0x315362){return _0x315362[_0x5e70('0x98')](_0x3634e4['body']['ids'],_[_0x5e70('0x99')](_0x3634e4[_0x5e70('0x2e')],[_0x5e70('0x9a'),'id'])||{});}})[_0x5e70('0x16')](respondWithResult(_0x2bd1e9,null))['catch'](handleError(_0x2bd1e9,null));};exports[_0x5e70('0x9b')]=function(_0x3ade7c,_0x2bbb77){var _0x25108c={'raw':![],'where':{}};var _0x15af68={};var _0x4866b5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5e70('0x9c')]({'where':{'id':_0x3ade7c[_0x5e70('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2bbb77,null))[_0x5e70('0x16')](function(_0x47c592){if(_0x47c592){_0x15af68[_0x5e70('0x3f')]=_[_0x5e70('0x40')](db[_0x5e70('0x61')][_0x5e70('0x34')]);_0x15af68[_0x5e70('0x3b')]=_[_0x5e70('0x40')](_0x3ade7c[_0x5e70('0x3b')]);_0x15af68[_0x5e70('0x41')]=_[_0x5e70('0x42')](_0x15af68[_0x5e70('0x3f')],_0x15af68[_0x5e70('0x3b')]);_0x25108c[_0x5e70('0x43')]=_[_0x5e70('0x42')](_0x15af68[_0x5e70('0x3f')],qs[_0x5e70('0x44')](_0x3ade7c[_0x5e70('0x3b')][_0x5e70('0x44')]));_0x25108c[_0x5e70('0x43')]=_0x25108c[_0x5e70('0x43')][_0x5e70('0x9d')]?_0x25108c[_0x5e70('0x43')]:_0x15af68[_0x5e70('0x3f')];if(!_0x3ade7c[_0x5e70('0x3b')][_0x5e70('0x9e')](_0x5e70('0x9f'))){_0x25108c['limit']=qs['limit'](_0x3ade7c[_0x5e70('0x3b')]['limit']);_0x25108c[_0x5e70('0x24')]=qs['offset'](_0x3ade7c[_0x5e70('0x3b')][_0x5e70('0x24')]);}_0x25108c['order']=qs[_0x5e70('0xa0')](_0x3ade7c['query'][_0x5e70('0xa0')]);_0x25108c[_0x5e70('0xa1')]=qs[_0x5e70('0x41')](_[_0x5e70('0xa2')](_0x3ade7c['query'],_0x15af68[_0x5e70('0x41')]));_0x25108c[_0x5e70('0xa1')][_0x5e70('0xa3')]=_0x47c592['id'];if(_0x3ade7c['query'][_0x5e70('0xa4')]){_0x25108c[_0x5e70('0xa1')]=_[_0x5e70('0x2d')](_0x25108c[_0x5e70('0xa1')],{'$or':_[_0x5e70('0x32')](_0x25108c[_0x5e70('0x43')],function(_0x128fca){var _0xd4a57d={};_0xd4a57d[_0x128fca]={'$like':'%'+_0x3ade7c[_0x5e70('0x3b')]['filter']+'%'};return _0xd4a57d;})});}if(_0x3ade7c[_0x5e70('0x3b')]['$gte']){var _0x18a586=_0x3ade7c[_0x5e70('0x3b')][_0x5e70('0xa5')][_0x5e70('0xa6')](',');var _0x223e93={};_0x223e93[_0x18a586[0x0]]={'$gte':moment(_0x18a586[0x1])['format'](_0x5e70('0xa7'))};_0x25108c[_0x5e70('0xa1')]=_[_0x5e70('0x2d')](_0x25108c[_0x5e70('0xa1')],_0x223e93);}_0x25108c=_['merge']({},_0x25108c,_0x3ade7c[_0x5e70('0x47')]);return db['ChatMessage'][_0x5e70('0x26')]({'where':_0x25108c['where']})[_0x5e70('0x16')](function(_0x468cfb){_0x4866b5[_0x5e70('0x26')]=_0x468cfb;if(_0x3ade7c[_0x5e70('0x3b')][_0x5e70('0x45')]){_0x25108c[_0x5e70('0x46')]=[{'all':!![]}];}return db[_0x5e70('0x61')][_0x5e70('0x39')](_0x25108c);})['then'](function(_0x4e49cd){_0x4866b5[_0x5e70('0xa8')]=_0x4e49cd;return _0x4866b5;});}})[_0x5e70('0x16')](respondWithFilteredResult(_0x2bbb77,_0x25108c))[_0x5e70('0x1f')](handleError(_0x2bbb77,null));};exports[_0x5e70('0xa9')]=function(_0x58b017,_0x3748ea){var _0x3d1972={'where':{}},_0x1db6da={},_0x513213={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5e70('0x9c')]({'where':{'id':_0x58b017[_0x5e70('0x3e')]['id']}})[_0x5e70('0x16')](handleEntityNotFound(_0x3748ea,null))[_0x5e70('0x16')](function(_0x1c6093){if(_0x1c6093){_0x1db6da[_0x5e70('0x3f')]=_[_0x5e70('0x40')](db[_0x5e70('0x61')]['rawAttributes']);_0x1db6da['query']=_[_0x5e70('0x40')](_0x58b017[_0x5e70('0x3b')]);_0x1db6da[_0x5e70('0x41')]=_['intersection'](_0x1db6da['model'],_0x1db6da['query']);_0x3d1972[_0x5e70('0x43')]=_[_0x5e70('0x42')](_0x1db6da[_0x5e70('0x3f')],qs['fields'](_0x58b017['query'][_0x5e70('0x44')]));_0x3d1972[_0x5e70('0x43')]=_0x3d1972['attributes'][_0x5e70('0x9d')]?_0x3d1972[_0x5e70('0x43')]:_0x1db6da[_0x5e70('0x3f')];if(!_0x58b017[_0x5e70('0x3b')][_0x5e70('0x9e')](_0x5e70('0x9f'))){_0x3d1972[_0x5e70('0x27')]=qs[_0x5e70('0x27')](_0x58b017[_0x5e70('0x3b')][_0x5e70('0x27')]);_0x3d1972[_0x5e70('0x24')]=qs[_0x5e70('0x24')](_0x58b017[_0x5e70('0x3b')][_0x5e70('0x24')]);}_0x3d1972['order']=qs[_0x5e70('0xa0')](_0x58b017[_0x5e70('0x3b')][_0x5e70('0xa0')]);_0x3d1972[_0x5e70('0xa1')]=qs[_0x5e70('0x41')](_[_0x5e70('0xa2')](_0x58b017[_0x5e70('0x3b')],_0x1db6da[_0x5e70('0x41')]));_0x3d1972[_0x5e70('0xa1')][_0x5e70('0xa3')]=_0x1c6093['id'];if(_0x58b017[_0x5e70('0x3b')][_0x5e70('0xa4')]){_0x3d1972[_0x5e70('0xa1')]=_[_0x5e70('0x2d')](_0x3d1972[_0x5e70('0xa1')],{'$or':_[_0x5e70('0x32')](_0x3d1972[_0x5e70('0x43')],function(_0x2eed1e){var _0x913838={};_0x913838[_0x2eed1e]={'$like':'%'+_0x58b017[_0x5e70('0x3b')]['filter']+'%'};return _0x913838;})});}_0x3d1972[_0x5e70('0xa1')][_0x5e70('0xaa')]=![];if(_0x58b017['query']['id']){_0x3d1972[_0x5e70('0xa1')]['id']={'$gt':_0x58b017[_0x5e70('0x3b')]['id']};}_0x3d1972=_[_0x5e70('0x2d')]({},_0x3d1972,_0x58b017['options']);return db[_0x5e70('0x61')][_0x5e70('0x26')]({'where':_0x3d1972[_0x5e70('0xa1')]})['then'](function(_0x332ad1){_0x513213['count']=_0x332ad1;_0x3d1972[_0x5e70('0x46')]=[];if(_0x58b017[_0x5e70('0x3b')][_0x5e70('0xab')]){_0x3d1972[_0x5e70('0x46')]['push']({'model':db[_0x5e70('0x82')],'as':_0x5e70('0x82'),'attributes':['id','fullname',_0x5e70('0x89')]});}if(_0x58b017[_0x5e70('0x3b')]['includeAll']){_0x3d1972[_0x5e70('0x46')]=[{'all':!![]}];}return db[_0x5e70('0x61')]['findAll'](_0x3d1972);})[_0x5e70('0x16')](function(_0x23c128){_0x513213[_0x5e70('0xa8')]=_0x23c128;return _0x513213;});}})['then'](respondWithFilteredResult(_0x3748ea,_0x3d1972))[_0x5e70('0x1f')](handleError(_0x3748ea,null));};exports[_0x5e70('0xac')]=function(_0x14fcc1,_0x46f649){return db[_0x5e70('0x33')]['find']({'where':{'id':_0x14fcc1[_0x5e70('0x3e')]['id']}})[_0x5e70('0x16')](handleEntityNotFound(_0x46f649,null))[_0x5e70('0x16')](function(_0x260bce){if(_0x260bce){return _0x260bce[_0x5e70('0xad')](_0x14fcc1[_0x5e70('0x2e')][_0x5e70('0x9a')],_[_0x5e70('0x99')](_0x14fcc1[_0x5e70('0x2e')],[_0x5e70('0x9a'),'id'])||{})[_0x5e70('0xae')](function(){return db[_0x5e70('0xaf')]['findAll']({'attributes':['id',_0x5e70('0x2b'),_0x5e70('0xb0')],'where':{'id':_0x14fcc1[_0x5e70('0x2e')]['ids']}});})[_0x5e70('0x16')](function(_0x4b343e){socket[_0x5e70('0xb1')](_0x5e70('0xb2'),{'id':Number(_0x14fcc1['params']['id']),'tags':_0x4b343e||[]});return{'id':Number(_0x14fcc1['params']['id']),'tags':_0x4b343e||[]};});}})[_0x5e70('0x16')](respondWithResult(_0x46f649,null))[_0x5e70('0x1f')](handleError(_0x46f649,null));};exports[_0x5e70('0xb3')]=function(_0x1a72e7,_0x10c989){return db[_0x5e70('0x33')][_0x5e70('0x48')]({'where':{'id':_0x1a72e7[_0x5e70('0x3e')]['id']}})[_0x5e70('0x16')](handleEntityNotFound(_0x10c989,null))['then'](function(_0x4d2285){if(_0x4d2285){return _0x4d2285[_0x5e70('0xb3')](_0x1a72e7['query'][_0x5e70('0x9a')]);}})[_0x5e70('0x16')](respondWithStatusCode(_0x10c989,null))['catch'](handleError(_0x10c989,null));};exports[_0x5e70('0x7b')]=function(_0x2db7dd,_0x3b76f6){var _0x4e0017=moment()[_0x5e70('0xb4')]()[_0x5e70('0xb5')]();var _0x3be669=path[_0x5e70('0x78')](config[_0x5e70('0x79')],_0x5e70('0xb6'),_0x5e70('0xb7'),_0x5e70('0xb8'));var _0x404b31=path[_0x5e70('0x78')](config['root'],_0x5e70('0xb6'),'files',_0x5e70('0xb9'));var _0xb4a728=path[_0x5e70('0x78')](_0x3be669,_0x4e0017);var _0x372ceb=util[_0x5e70('0x7e')](_0x5e70('0xba'),_0x2db7dd[_0x5e70('0x3e')]['id'],_0x4e0017);var _0x51aad7=path['join'](_0x3be669,_0x372ceb);var _0x499ef3=[];_0x499ef3['push']({'model':db[_0x5e70('0x82')],'as':_0x5e70('0x82'),'attributes':['id',_0x5e70('0x54')],'raw':!![]});_0x499ef3[_0x5e70('0xbb')]({'model':db[_0x5e70('0x65')],'as':_0x5e70('0xbc'),'attributes':['id',_0x5e70('0xbd'),'lastName'],'raw':!![]});if(_0x2db7dd[_0x5e70('0x3b')][_0x5e70('0xb9')]){_0x499ef3['push']({'model':db[_0x5e70('0x73')],'as':_0x5e70('0x73'),'raw':!![]});}var _0x36c25f=[{'model':db[_0x5e70('0x61')],'as':_0x5e70('0x81'),'attributes':['id','body',_0x5e70('0x8c'),'direction',_0x5e70('0xaa'),'read'],'include':_0x499ef3}];_0x36c25f[_0x5e70('0xbb')]({'model':db[_0x5e70('0x4d')],'as':_0x5e70('0xbe'),'attributes':['id',_0x5e70('0x2b')]});_0x36c25f[_0x5e70('0xbb')]({'model':db[_0x5e70('0x82')],'as':_0x5e70('0xbf'),'attributes':['id',_0x5e70('0x54')]});return db[_0x5e70('0x33')][_0x5e70('0x48')]({'where':{'id':_0x2db7dd[_0x5e70('0x3e')]['id']},'include':_0x36c25f})['then'](handleEntityNotFound(_0x3b76f6,null))[_0x5e70('0x16')](function(_0x5e4390){if(_0x5e4390){var _0x1b1b3e=_0x5e4390[_0x5e70('0xc0')]({'plain':!![]});fs[_0x5e70('0xc1')](_0xb4a728);var _0x1a4dc8={'channel':_0x5e70('0xc2'),'account':_0x1b1b3e[_0x5e70('0xbe')][_0x5e70('0x2b')],'agent':_0x1b1b3e['Owner']?_0x1b1b3e[_0x5e70('0xbf')][_0x5e70('0x54')]:_0x5e70('0xc3'),'createdAt':moment(_0x1b1b3e[_0x5e70('0x8c')])[_0x5e70('0x7e')](_0x5e70('0xa7'))['toString'](),'closedAt':_0x1b1b3e[_0x5e70('0x74')]?moment(_0x1b1b3e['closedAt'])[_0x5e70('0x7e')](_0x5e70('0xa7'))[_0x5e70('0xb5')]():'','disposition':_0x1b1b3e['disposition'],'chatInfo':{'browser':_0x1b1b3e['browserName'],'os':_0x1b1b3e['osName'],'referer':_0x1b1b3e[_0x5e70('0xc4')],'customerIp':_0x1b1b3e['customerIp'],'customerPort':_0x1b1b3e[_0x5e70('0xc5')]?_0x1b1b3e[_0x5e70('0xc5')]:'N.A.'},'messages':_(_0x1b1b3e['Messages'])[_0x5e70('0xc6')]()['filter']({'secret':![]})['map'](function(_0x1c9b95){if(_0x1c9b95['Attachment']){var _0x36892e=path[_0x5e70('0x78')](_0x404b31,_0x1c9b95[_0x5e70('0x73')][_0x5e70('0x70')]);if(fs[_0x5e70('0xc7')](_0x36892e)){fs[_0x5e70('0xc8')](_0x36892e)[_0x5e70('0xc9')](fs[_0x5e70('0xca')](path['join'](_0xb4a728,_0x1c9b95['Attachment'][_0x5e70('0x70')])));}}return{'date':moment(_0x1c9b95[_0x5e70('0x8c')])[_0x5e70('0x7e')](_0x5e70('0xa7'))['toString'](),'sender':_0x1c9b95[_0x5e70('0x8e')]===_0x5e70('0x60')?_0x1c9b95[_0x5e70('0x82')]?_0x1c9b95[_0x5e70('0x82')][_0x5e70('0x54')]:_0x5e70('0x87'):_0x1c9b95[_0x5e70('0xbc')]['firstName']+(_0x1c9b95[_0x5e70('0xbc')]['lastName']?'\x20'+_0x1c9b95[_0x5e70('0xbc')][_0x5e70('0xcb')]:''),'body':_0x1c9b95[_0x5e70('0x73')]?_0x1c9b95['Attachment'][_0x5e70('0x70')]:_0x1c9b95[_0x5e70('0x2e')],'direction':_0x1c9b95[_0x5e70('0x8e')]===_0x5e70('0x60')?'A':'C','secret':_0x1c9b95[_0x5e70('0xaa')],'read':_0x1c9b95[_0x5e70('0xcc')],'attachment':_0x1c9b95[_0x5e70('0x73')]};})[_0x5e70('0xcd')]()};return ejs[_0x5e70('0xce')](path[_0x5e70('0x78')](config[_0x5e70('0x79')],_0x5e70('0xb6'),_0x5e70('0xcf'),_0x5e70('0xd0')),{'interaction':_0x1a4dc8})[_0x5e70('0x16')](function(_0x49c59b){var _0x2ce615=path['join'](_0xb4a728,_0x5e70('0xd1')+_0x1b1b3e['id']+'-'+_0x4e0017+_0x5e70('0xd2'));var _0x551668={'path':_0x2ce615,'channel':'Chat','interactionId':_0x1b1b3e['id']};return pdf[_0x5e70('0xd3')](_0x49c59b,_0x551668);})['then'](function(){return new Promise(function(_0xd6ac1e,_0x17b42a){zipdir(_0xb4a728,{'saveTo':_0x51aad7},function(_0x4f6ba5,_0x451280){if(_0x4f6ba5)return _0x17b42a(_0x4f6ba5);return _0xd6ac1e(_0x451280);});})['then'](function(){return new BPromise(function(_0x44e996,_0x4955f4){rimraf(_0xb4a728,function(_0x2eb5b0){if(_0x2eb5b0)_0x4955f4(_0x2eb5b0);return _0x44e996();});});})[_0x5e70('0x16')](function(){return _0x3b76f6['download'](_0x51aad7,_0x372ceb,function(_0x255283){if(_0x255283){logger[_0x5e70('0x1b')](_0x5e70('0xd4'),_0x255283);}else{fs[_0x5e70('0xd5')](_0x51aad7);}});});});}else{return _0x3b76f6[_0x5e70('0x20')](0xc8);}})[_0x5e70('0x1f')](handleError(_0x3b76f6,null));}; \ No newline at end of file +var _0xf826=['views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','stack','name','merge','body','interaction','account','index','map','ChatInteraction','type','key','findAll','chat','query','show','keys','filters','model','intersection','fields','attributes','length','includeAll','include','options','create','find','params','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','user','fullname','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','close','server/files/chat/upload/','format','now','pathTranscript','Messages','User','ContactId','%s%d','System','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','secret','appendFileSync','MailServerOut','CloudProvider','Smtp','SendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','rawAttributes','nolimit','order','sort','where','pick','ChatInteractionId','filter','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','hasOwnProperty','includeAgent','push','rows','addTags','setTags','spread','color','removeTags','unix','toString','server','files','tmp','firstName','lastName','direction','read','ChatWebsite','Owner','mkdirSync','Chat','createdAt','closedAt','osName','referer','customerIp','customerPort','N.A.','tail','pipe','createWriteStream','value','renderFile'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf826,0x1a6));var _0x6f82=function(_0x232e16,_0x1328d3){_0x232e16=_0x232e16-0x0;var _0x29719c=_0xf826[_0x232e16];return _0x29719c;};'use strict';var rimraf=require(_0x6f82('0x0'));var zipdir=require(_0x6f82('0x1'));var rp=require(_0x6f82('0x2'));var moment=require(_0x6f82('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6f82('0x4'));var util=require(_0x6f82('0x5'));var path=require(_0x6f82('0x6'));var ejs=require(_0x6f82('0x7'));var fs=require('fs');var _=require(_0x6f82('0x8'));var Redis=require(_0x6f82('0x9'));var interaction=require(_0x6f82('0xa'));var qs=require(_0x6f82('0xb'));var pdf=require(_0x6f82('0xc'));var logger=require('../../config/logger')('api');var config=require(_0x6f82('0xd'));var db=require('../../mysqldb')['db'];config[_0x6f82('0xe')]=_[_0x6f82('0xf')](config['redis'],{'host':_0x6f82('0x10'),'port':0x18eb});var socket=require(_0x6f82('0x11'))(new Redis(config[_0x6f82('0xe')]));require(_0x6f82('0x12'))[_0x6f82('0x13')](socket);var jayson=require(_0x6f82('0x14'));var client=jayson['client'][_0x6f82('0x15')]({'port':0x232b});var client9004=jayson[_0x6f82('0x16')][_0x6f82('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x709c,_0x25865c,_0x5afeb6,_0x1037e8){return new BPromise(function(_0x51a91a,_0x4f7b63){var _0x19d397=_0x1037e8||client;return _0x19d397[_0x6f82('0x17')](_0x709c,_0x5afeb6)[_0x6f82('0x18')](function(_0x747c46){logger[_0x6f82('0x19')](_0x6f82('0x1a'),_0x25865c,'request\x20sent');logger[_0x6f82('0x1b')](_0x6f82('0x1c'),_0x25865c,_0x6f82('0x1d'),JSON['stringify'](_0x747c46));if(_0x747c46[_0x6f82('0x1e')]){if(_0x747c46[_0x6f82('0x1e')][_0x6f82('0x1f')]===0x1f4){logger[_0x6f82('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x25865c,_0x747c46['error'][_0x6f82('0x20')]);return _0x4f7b63(_0x747c46[_0x6f82('0x1e')]['message']);}logger[_0x6f82('0x1e')](_0x6f82('0x1a'),_0x25865c,_0x747c46[_0x6f82('0x1e')][_0x6f82('0x20')]);return _0x51a91a(_0x747c46[_0x6f82('0x1e')]['message']);}else{logger[_0x6f82('0x19')](_0x6f82('0x1a'),_0x25865c,_0x6f82('0x1d'));_0x51a91a(_0x747c46[_0x6f82('0x21')][_0x6f82('0x20')]);}})[_0x6f82('0x22')](function(_0x6d6181){logger[_0x6f82('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x25865c,_0x6d6181);_0x4f7b63(_0x6d6181);});});}function respondWithStatusCode(_0x4b79a3,_0x2f267c){_0x2f267c=_0x2f267c||0xcc;return function(_0x2ae704){if(_0x2ae704){return _0x4b79a3[_0x6f82('0x23')](_0x2f267c);}return _0x4b79a3[_0x6f82('0x24')](_0x2f267c)['end']();};}function respondWithResult(_0x57c5ec,_0x53914e){_0x53914e=_0x53914e||0xc8;return function(_0x5a1903){if(_0x5a1903){return _0x57c5ec['status'](_0x53914e)[_0x6f82('0x25')](_0x5a1903);}};}function respondWithFilteredResult(_0xdbe5a2,_0x29764d){return function(_0x4b3dd6){if(_0x4b3dd6){var _0x11fed2=typeof _0x29764d['offset']===_0x6f82('0x26')&&typeof _0x29764d[_0x6f82('0x27')]==='undefined';var _0x453f14=_0x4b3dd6['count'];var _0x12c634=_0x11fed2?0x0:_0x29764d['offset'];var _0x5d861c=_0x11fed2?_0x4b3dd6[_0x6f82('0x28')]:_0x29764d[_0x6f82('0x29')]+_0x29764d[_0x6f82('0x27')];var _0x5d599b;if(_0x5d861c>=_0x453f14){_0x5d861c=_0x453f14;_0x5d599b=0xc8;}else{_0x5d599b=0xce;}_0xdbe5a2[_0x6f82('0x24')](_0x5d599b);return _0xdbe5a2[_0x6f82('0x2a')](_0x6f82('0x2b'),_0x12c634+'-'+_0x5d861c+'/'+_0x453f14)[_0x6f82('0x25')](_0x4b3dd6);}return null;};}function saveUpdates(_0x5577bb){return function(_0x1b94d2){if(_0x1b94d2){return _0x1b94d2[_0x6f82('0x2c')](_0x5577bb)[_0x6f82('0x18')](function(_0x509a8f){return _0x509a8f;});}return null;};}function removeEntity(_0x594162){return function(_0x359d52){if(_0x359d52){return _0x359d52[_0x6f82('0x2d')]()[_0x6f82('0x18')](function(){_0x594162[_0x6f82('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31389b){return function(_0x4f27e5){if(!_0x4f27e5){_0x31389b[_0x6f82('0x23')](0x194);}return _0x4f27e5;};}function handleError(_0x510cf7,_0x488eb8){_0x488eb8=_0x488eb8||0x1f4;return function(_0x43783e){logger[_0x6f82('0x1e')](_0x43783e[_0x6f82('0x2e')]);if(_0x43783e[_0x6f82('0x2f')]){delete _0x43783e['name'];}_0x510cf7[_0x6f82('0x24')](_0x488eb8)['send'](_0x43783e);};}function getMustacheRender(_0x365eec,_0xb493dc){return Mustache['render'](_0x365eec,_[_0x6f82('0x30')](_0xb493dc[_0x6f82('0x31')],{'contact':_0xb493dc['contact'],'message':_0xb493dc[_0x6f82('0x20')],'agent':_0xb493dc['agent'],'interaction':_0xb493dc[_0x6f82('0x32')],'account':_0xb493dc[_0x6f82('0x33')]}))||'';}exports[_0x6f82('0x34')]=function(_0x331d0d,_0x492e41){var _0x466bbd={};var _0x99bedd=_[_0x6f82('0x35')](db[_0x6f82('0x36')]['rawAttributes'],function(_0x241c2a){return{'name':_0x241c2a['fieldName'],'type':_0x241c2a[_0x6f82('0x37')][_0x6f82('0x38')]};});_0x466bbd=qs['getOptions'](_0x99bedd,_0x331d0d);return interaction[_0x6f82('0x39')](_0x6f82('0x3a'),_0x331d0d[_0x6f82('0x3b')],_0x331d0d['user'],_0x466bbd,_0x99bedd)['then'](respondWithFilteredResult(_0x492e41,_0x466bbd))[_0x6f82('0x22')](handleError(_0x492e41,null));};exports[_0x6f82('0x3c')]=function(_0x5d326c,_0x3be0b6){var _0x2e97a3={'raw':![],'where':{'id':_0x5d326c['params']['id']}},_0x14f558={};_0x14f558['model']=_['keys'](db[_0x6f82('0x36')]['rawAttributes']);_0x14f558['query']=_[_0x6f82('0x3d')](_0x5d326c[_0x6f82('0x3b')]);_0x14f558[_0x6f82('0x3e')]=_['intersection'](_0x14f558[_0x6f82('0x3f')],_0x14f558[_0x6f82('0x3b')]);_0x2e97a3['attributes']=_[_0x6f82('0x40')](_0x14f558[_0x6f82('0x3f')],qs[_0x6f82('0x41')](_0x5d326c[_0x6f82('0x3b')][_0x6f82('0x41')]));_0x2e97a3[_0x6f82('0x42')]=_0x2e97a3[_0x6f82('0x42')][_0x6f82('0x43')]?_0x2e97a3[_0x6f82('0x42')]:_0x14f558[_0x6f82('0x3f')];if(_0x5d326c[_0x6f82('0x3b')][_0x6f82('0x44')]){_0x2e97a3[_0x6f82('0x45')]=[{'all':!![]}];}_0x2e97a3=_[_0x6f82('0x30')]({},_0x2e97a3,_0x5d326c[_0x6f82('0x46')]);return db[_0x6f82('0x36')]['find'](_0x2e97a3)[_0x6f82('0x18')](handleEntityNotFound(_0x3be0b6,null))[_0x6f82('0x18')](respondWithResult(_0x3be0b6,null))['catch'](handleError(_0x3be0b6,null));};exports[_0x6f82('0x47')]=function(_0x3b6a2f,_0x420354){return db[_0x6f82('0x36')][_0x6f82('0x47')](_0x3b6a2f[_0x6f82('0x31')],{})['then'](respondWithResult(_0x420354,0xc9))[_0x6f82('0x22')](handleError(_0x420354,null));};exports[_0x6f82('0x2c')]=function(_0x16e6b8,_0x4f5bb3){if(_0x16e6b8[_0x6f82('0x31')]['id']){delete _0x16e6b8[_0x6f82('0x31')]['id'];}return db['ChatInteraction'][_0x6f82('0x48')]({'where':{'id':_0x16e6b8[_0x6f82('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f5bb3,null))['then'](saveUpdates(_0x16e6b8[_0x6f82('0x31')],null))[_0x6f82('0x18')](respondWithResult(_0x4f5bb3,null))[_0x6f82('0x22')](handleError(_0x4f5bb3,null));};exports['destroy']=function(_0x4706a1,_0x268a4b){return db[_0x6f82('0x36')][_0x6f82('0x48')]({'where':{'id':_0x4706a1[_0x6f82('0x49')]['id']}})['then'](handleEntityNotFound(_0x268a4b,null))['then'](removeEntity(_0x268a4b,null))['catch'](handleError(_0x268a4b,null));};exports[_0x6f82('0x4a')]=function(_0x15ef73,_0x37aa21){return db[_0x6f82('0x36')][_0x6f82('0x4a')]()[_0x6f82('0x18')](respondWithResult(_0x37aa21,null))[_0x6f82('0x22')](handleError(_0x37aa21,null));};exports[_0x6f82('0x4b')]=function(_0x404ba9,_0x5a7baf){var _0x1c05e7=_0x404ba9['params']['id'];var _0x325bbd;var _0x2da950;var _0x515b74;return db['ChatInteraction'][_0x6f82('0x4c')]({'where':{'id':_0x1c05e7}})[_0x6f82('0x18')](function(_0x173a06){_0x325bbd=_0x173a06;return db['ChatWebsite'][_0x6f82('0x4c')]({'where':{'id':_0x173a06[_0x6f82('0x4d')]},'attributes':['id',_0x6f82('0x4e'),'vidaooEscalation',_0x6f82('0x4f'),_0x6f82('0x50'),_0x6f82('0x51')],'raw':!![]});})[_0x6f82('0x18')](function(_0x23e293){if(_0x23e293&&_0x23e293[_0x6f82('0x4e')]&&_0x23e293[_0x6f82('0x52')]){_0x2da950=_0x23e293;var _0x2cae63={'interaction':{'id':_0x1c05e7},'agent':{'id':_0x404ba9[_0x6f82('0x53')]['id'],'name':_0x404ba9[_0x6f82('0x53')][_0x6f82('0x2f')],'fullname':_0x404ba9[_0x6f82('0x53')][_0x6f82('0x54')],'email':_0x404ba9[_0x6f82('0x53')]['email']},'contact':_0x404ba9[_0x6f82('0x31')][_0x6f82('0x55')],'account':_0x404ba9['body']['account']};var _0x177f70={'rejectUnauthorized':![],'method':_0x6f82('0x56'),'url':_0x6f82('0x57'),'headers':{'X-APIKEY':_0x23e293[_0x6f82('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x404ba9[_0x6f82('0x53')][_0x6f82('0x58')]],'buttons':null,'topic':_0x2da950['vidaooTopic'],'note':_[_0x6f82('0x59')](_0x2da950[_0x6f82('0x50')])?null:getMustacheRender(_0x2da950['vidaooNote'],_0x2cae63),'metadata':null},'redirect':_0x6f82('0x5a'),'json':!![]};try{if(!_[_0x6f82('0x59')](_0x2da950[_0x6f82('0x51')])){var _0x1d0bbf=getMustacheRender(_0x2da950[_0x6f82('0x51')],_0x2cae63);var _0x11f92e=JSON[_0x6f82('0x5b')](_0x1d0bbf);_0x177f70[_0x6f82('0x31')][_0x6f82('0x5c')]=_0x11f92e;}}catch(_0x59e76f){throw new db[(_0x6f82('0x5d'))][(_0x6f82('0x5e'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x177f70);}else{throw new db[(_0x6f82('0x5d'))][(_0x6f82('0x5e'))](_0x6f82('0x5f'));}})['then'](function(_0x490cad){_0x515b74=_0x490cad;if(_0x515b74['id']){var _0xf16e8c={'body':_0x515b74[_0x6f82('0x60')],'ChatWebsiteId':_0x2da950['id'],'ChatInteractionId':_0x325bbd['id'],'direction':_0x6f82('0x61'),'UserId':_0x404ba9[_0x6f82('0x53')]['id']};return db[_0x6f82('0x62')]['create'](_0xf16e8c,{});}else{throw new db['Sequelize'][(_0x6f82('0x5e'))](_0x6f82('0x63'));}})[_0x6f82('0x18')](function(){return _0x325bbd[_0x6f82('0x64')]({'vidaooSessionId':_0x515b74['id']});})['then'](respondWithResult(_0x5a7baf,null))[_0x6f82('0x22')](handleError(_0x5a7baf,null));};exports[_0x6f82('0x65')]=function(_0x2296f4,_0x54e0bf){if(_0x2296f4[_0x6f82('0x31')]['id']){delete _0x2296f4['body']['id'];}return db[_0x6f82('0x36')][_0x6f82('0x48')]({'where':{'id':_0x2296f4[_0x6f82('0x49')]['id']},'include':[{'model':db[_0x6f82('0x66')],'as':_0x6f82('0x67')}]})['then'](handleEntityNotFound(_0x54e0bf,null))[_0x6f82('0x18')](saveUpdates(_0x2296f4[_0x6f82('0x31')],null))['then'](respondWithResult(_0x54e0bf,null))[_0x6f82('0x22')](handleError(_0x54e0bf,null));};exports[_0x6f82('0x68')]=function(_0x315386,_0x4ba998){if(_0x315386[_0x6f82('0x31')]['id']){delete _0x315386['body']['id'];}return db[_0x6f82('0x36')][_0x6f82('0x48')]({'where':{'id':_0x315386[_0x6f82('0x49')]['id']}})[_0x6f82('0x18')](function(_0xa25368){if(!_0xa25368){logger[_0x6f82('0x1e')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x6f82('0x68'),0x194,_0x6f82('0x69'));_0x4ba998[_0x6f82('0x23')](0x194);}else{if(_0xa25368[_0x6f82('0x6a')]){throw new db['Sequelize'][(_0x6f82('0x5e'))](_0x6f82('0x6b'));}}return _0xa25368;})['then'](function(_0xfcc9fe){if(_0xfcc9fe){return _0xfcc9fe[_0x6f82('0x2c')]({'closed':_0x315386['body'][_0x6f82('0x6c')],'disposition':_0x315386[_0x6f82('0x31')][_0x6f82('0x6d')]})[_0x6f82('0x18')](function(_0xe1df78){return _0xe1df78;});}})['then'](function(){return respondWithRpcPromise(_0x6f82('0x6e'),'abandon',_0x315386[_0x6f82('0x31')],client9004);})['then'](respondWithResult(_0x4ba998,null))[_0x6f82('0x22')](handleError(_0x4ba998,null));};exports[_0x6f82('0x6f')]=function(_0x2393ec,_0x7435a9){_0x2393ec[_0x6f82('0x31')][_0x6f82('0x2f')]=_0x2393ec[_0x6f82('0x70')][_0x6f82('0x71')];_0x2393ec[_0x6f82('0x31')]['basename']=_0x2393ec[_0x6f82('0x70')][_0x6f82('0x72')];_0x2393ec[_0x6f82('0x31')][_0x6f82('0x37')]=_0x2393ec[_0x6f82('0x70')][_0x6f82('0x73')];return db[_0x6f82('0x74')][_0x6f82('0x47')](_0x2393ec[_0x6f82('0x31')])['then'](respondWithResult(_0x7435a9,0xc9))[_0x6f82('0x22')](handleError(_0x7435a9,null));};exports['attachmentDownload']=function(_0x5bfbed,_0x37b99e){return db[_0x6f82('0x36')]['findOne']({'where':{'id':_0x5bfbed['params']['id']},'raw':!![]})[_0x6f82('0x18')](handleEntityNotFound(_0x37b99e,null))['then'](function(_0x4893f7){if(_0x4893f7){if(_0x4893f7[_0x6f82('0x6c')]){return _0x37b99e['status'](0x193)[_0x6f82('0x25')]({'status':0x193,'message':_0x6f82('0x75')});}return db[_0x6f82('0x74')][_0x6f82('0x4c')]({'where':{'id':_0x5bfbed[_0x6f82('0x3b')][_0x6f82('0x76')]},'raw':!![]})[_0x6f82('0x18')](handleEntityNotFound(_0x37b99e,null));}})[_0x6f82('0x18')](function(_0x56caf3){if(_0x56caf3){var _0x363965=_0x56caf3[_0x6f82('0x77')]!==null;var _0x58bfd8=path['join'](config[_0x6f82('0x78')],_0x6f82('0x79'));if(_0x363965){_0x58bfd8=path[_0x6f82('0x7a')](_0x58bfd8,_0x6f82('0x7b'));}var _0x4dfeb2=path[_0x6f82('0x7a')](_0x58bfd8,_0x56caf3[_0x6f82('0x7c')]);return _0x37b99e[_0x6f82('0x7d')](_0x4dfeb2);}})['catch'](handleError(_0x37b99e,null));};exports[_0x6f82('0x7e')]=function(_0x37fa5e,_0x5eedee){var _0xe6e8fa=null;var _0x426184=null;var _0x4dde2b=null;if(_0x37fa5e['body']['id']){delete _0x37fa5e[_0x6f82('0x31')]['id'];}if(_0x37fa5e[_0x6f82('0x31')]['mailTranscript']){_0x4dde2b=path[_0x6f82('0x7a')](config[_0x6f82('0x78')],_0x6f82('0x7f'),util[_0x6f82('0x80')]('transcript-%s.txt',Date[_0x6f82('0x81')]()));_0x37fa5e[_0x6f82('0x31')][_0x6f82('0x82')]=_0x4dde2b;}return db[_0x6f82('0x36')][_0x6f82('0x48')]({'where':{'id':_0x37fa5e[_0x6f82('0x49')]['id']},'include':[{'model':db[_0x6f82('0x62')],'as':_0x6f82('0x83'),'include':[{'model':db['User'],'as':_0x6f82('0x84')}]}]})[_0x6f82('0x18')](handleEntityNotFound(_0x5eedee,null))[_0x6f82('0x18')](saveUpdates(_0x37fa5e[_0x6f82('0x31')],null))[_0x6f82('0x18')](function(_0x55af75){if(_0x55af75){_0xe6e8fa=_0x55af75;return db['ChatWebsite'][_0x6f82('0x48')]({'where':{'id':_0xe6e8fa[_0x6f82('0x4d')]}});}})[_0x6f82('0x18')](function(_0x2ea1f9){if(_0x2ea1f9){_0x426184=_0x2ea1f9;return db['CmContact'][_0x6f82('0x48')]({'where':{'id':_0xe6e8fa[_0x6f82('0x85')]}});}})[_0x6f82('0x18')](function(_0x140925){if(_0x140925){if(_0x4dde2b){var _0x2e972e=null;for(var _0x427fd1=0x1;_0x427fd1<_0xe6e8fa['Messages']['length'];++_0x427fd1){_0x2e972e=_0xe6e8fa[_0x6f82('0x83')][_0x427fd1];var _0x16b85c=_0x2e972e['UserId']?util[_0x6f82('0x80')](_0x6f82('0x86'),_0x426184['agentAlias'],_0x2e972e[_0x6f82('0x6a')]):_0x6f82('0x87');var _0x1ab00a=_0x37fa5e['body']['customer']||util[_0x6f82('0x80')]('%s%d',_0x6f82('0x88'),_0x2e972e[_0x6f82('0x85')]);switch(_0x426184[_0x6f82('0x89')]){case _0x6f82('0x8a'):_0x16b85c=_0x2e972e[_0x6f82('0x6a')]?util[_0x6f82('0x80')](_0x6f82('0x86'),_0x426184[_0x6f82('0x8b')],_0x2e972e[_0x6f82('0x6a')]):_0x6f82('0x87');break;case _0x6f82('0x8c'):_0x16b85c=_0x2e972e[_0x6f82('0x6a')]?_0x2e972e[_0x6f82('0x84')][_0x6f82('0x8d')]||_0x2e972e[_0x6f82('0x84')][_0x6f82('0x54')]:_0x6f82('0x87');break;case _0x6f82('0x8e'):_0x16b85c=_0x2e972e[_0x6f82('0x6a')]?_0x2e972e[_0x6f82('0x84')][_0x6f82('0x54')]:'System';break;default:_0x16b85c=_0x2e972e[_0x6f82('0x6a')]?util[_0x6f82('0x80')](_0x6f82('0x86'),_0x426184[_0x6f82('0x8b')],_0x2e972e['UserId']):_0x6f82('0x87');}var _0x5e79e2=util[_0x6f82('0x80')](_0x6f82('0x8f'),moment(_0x2e972e['createdAt'])[_0x6f82('0x80')]('MM/DD/YYYY\x20HH:mm:ss'),_0x2e972e['direction']==='in'?_0x1ab00a:_0x16b85c,_0x2e972e[_0x6f82('0x31')]);if(!_0x2e972e[_0x6f82('0x90')]){fs[_0x6f82('0x91')](_0x4dde2b,_0x5e79e2);}}return db['MailAccount'][_0x6f82('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0x6f82('0x92')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6f82('0x93'),'raw':!![]}]}]});}}})[_0x6f82('0x18')](function(_0x1cf7ef){if(!_0x1cf7ef||!_0x1cf7ef[_0x6f82('0x94')]||!_0x37fa5e[_0x6f82('0x31')])return _0xe6e8fa;var _0x330f1b=_0x1cf7ef['getSmtpOptions']();return respondWithRpcPromise(_0x6f82('0x95'),'sendMail',{'account':_0x330f1b,'message':{'from':util[_0x6f82('0x80')]('\x22%s\x22\x20<%s>',_0x1cf7ef[_0x6f82('0x2f')],_0x1cf7ef[_0x6f82('0x58')]||_0x1cf7ef[_0x6f82('0x94')][_0x6f82('0x53')]),'to':_0x37fa5e[_0x6f82('0x31')][_0x6f82('0x96')],'subject':_0x6f82('0x97'),'text':util[_0x6f82('0x80')](_0x6f82('0x98'),_0x37fa5e['body'][_0x6f82('0x96')]),'attachments':[{'path':_0x4dde2b}]}})[_0x6f82('0x18')](function(){return _0xe6e8fa;})[_0x6f82('0x22')](function(_0x3ab502){logger[_0x6f82('0x1e')](_0x3ab502);});})['then'](respondWithStatusCode(_0x5eedee,0xc8))[_0x6f82('0x22')](handleError(_0x5eedee,null));};exports[_0x6f82('0x99')]=function(_0x183232,_0x15e721){return db[_0x6f82('0x62')][_0x6f82('0x48')]({'where':{'id':_0x183232[_0x6f82('0x49')]['id']}})['then'](handleEntityNotFound(_0x15e721,null))[_0x6f82('0x18')](function(_0x2035e3){if(_0x2035e3){return _0x2035e3[_0x6f82('0x99')](_0x183232[_0x6f82('0x31')][_0x6f82('0x9a')],_[_0x6f82('0x9b')](_0x183232[_0x6f82('0x31')],[_0x6f82('0x9a'),'id'])||{});}})['then'](respondWithResult(_0x15e721,null))['catch'](handleError(_0x15e721,null));};exports[_0x6f82('0x9c')]=function(_0x2923e8,_0x4fbd2f){var _0x2d1af0={'raw':![],'where':{}};var _0x21f81c={};var _0x582013={'count':0x0,'rows':[]};return db[_0x6f82('0x36')][_0x6f82('0x4c')]({'where':{'id':_0x2923e8['params']['id']}})[_0x6f82('0x18')](handleEntityNotFound(_0x4fbd2f,null))[_0x6f82('0x18')](function(_0x269970){if(_0x269970){_0x21f81c[_0x6f82('0x3f')]=_[_0x6f82('0x3d')](db['ChatMessage'][_0x6f82('0x9d')]);_0x21f81c[_0x6f82('0x3b')]=_[_0x6f82('0x3d')](_0x2923e8[_0x6f82('0x3b')]);_0x21f81c[_0x6f82('0x3e')]=_[_0x6f82('0x40')](_0x21f81c[_0x6f82('0x3f')],_0x21f81c['query']);_0x2d1af0[_0x6f82('0x42')]=_['intersection'](_0x21f81c['model'],qs[_0x6f82('0x41')](_0x2923e8[_0x6f82('0x3b')][_0x6f82('0x41')]));_0x2d1af0[_0x6f82('0x42')]=_0x2d1af0[_0x6f82('0x42')][_0x6f82('0x43')]?_0x2d1af0[_0x6f82('0x42')]:_0x21f81c[_0x6f82('0x3f')];if(!_0x2923e8[_0x6f82('0x3b')]['hasOwnProperty'](_0x6f82('0x9e'))){_0x2d1af0[_0x6f82('0x27')]=qs[_0x6f82('0x27')](_0x2923e8[_0x6f82('0x3b')]['limit']);_0x2d1af0[_0x6f82('0x29')]=qs['offset'](_0x2923e8[_0x6f82('0x3b')][_0x6f82('0x29')]);}_0x2d1af0[_0x6f82('0x9f')]=qs[_0x6f82('0xa0')](_0x2923e8[_0x6f82('0x3b')][_0x6f82('0xa0')]);_0x2d1af0[_0x6f82('0xa1')]=qs[_0x6f82('0x3e')](_[_0x6f82('0xa2')](_0x2923e8[_0x6f82('0x3b')],_0x21f81c[_0x6f82('0x3e')]));_0x2d1af0[_0x6f82('0xa1')][_0x6f82('0xa3')]=_0x269970['id'];if(_0x2923e8[_0x6f82('0x3b')][_0x6f82('0xa4')]){_0x2d1af0[_0x6f82('0xa1')]=_[_0x6f82('0x30')](_0x2d1af0['where'],{'$or':_[_0x6f82('0x35')](_0x2d1af0[_0x6f82('0x42')],function(_0x4ce02b){var _0x4963ab={};_0x4963ab[_0x4ce02b]={'$like':'%'+_0x2923e8[_0x6f82('0x3b')][_0x6f82('0xa4')]+'%'};return _0x4963ab;})});}if(_0x2923e8[_0x6f82('0x3b')]['$gte']){var _0x3d8234=_0x2923e8[_0x6f82('0x3b')]['$gte'][_0x6f82('0xa5')](',');var _0x40429a={};_0x40429a[_0x3d8234[0x0]]={'$gte':moment(_0x3d8234[0x1])[_0x6f82('0x80')](_0x6f82('0xa6'))};_0x2d1af0['where']=_[_0x6f82('0x30')](_0x2d1af0[_0x6f82('0xa1')],_0x40429a);}_0x2d1af0=_[_0x6f82('0x30')]({},_0x2d1af0,_0x2923e8[_0x6f82('0x46')]);return db['ChatMessage'][_0x6f82('0x28')]({'where':_0x2d1af0[_0x6f82('0xa1')]})['then'](function(_0x4fa415){_0x582013[_0x6f82('0x28')]=_0x4fa415;if(_0x2923e8[_0x6f82('0x3b')][_0x6f82('0x44')]){_0x2d1af0['include']=[{'all':!![]}];}return db[_0x6f82('0x62')][_0x6f82('0x39')](_0x2d1af0);})['then'](function(_0x217bc6){_0x582013['rows']=_0x217bc6;return _0x582013;});}})['then'](respondWithFilteredResult(_0x4fbd2f,_0x2d1af0))[_0x6f82('0x22')](handleError(_0x4fbd2f,null));};exports[_0x6f82('0xa7')]=function(_0x14c8bb,_0x1b76a7){var _0x4b580f={'where':{}},_0x1cbe28={},_0xe57f7e={'count':0x0,'rows':[]};return db[_0x6f82('0x36')][_0x6f82('0x4c')]({'where':{'id':_0x14c8bb[_0x6f82('0x49')]['id']}})[_0x6f82('0x18')](handleEntityNotFound(_0x1b76a7,null))[_0x6f82('0x18')](function(_0x5a53e9){if(_0x5a53e9){_0x1cbe28['model']=_[_0x6f82('0x3d')](db[_0x6f82('0x62')][_0x6f82('0x9d')]);_0x1cbe28[_0x6f82('0x3b')]=_['keys'](_0x14c8bb['query']);_0x1cbe28[_0x6f82('0x3e')]=_[_0x6f82('0x40')](_0x1cbe28['model'],_0x1cbe28[_0x6f82('0x3b')]);_0x4b580f[_0x6f82('0x42')]=_[_0x6f82('0x40')](_0x1cbe28[_0x6f82('0x3f')],qs[_0x6f82('0x41')](_0x14c8bb[_0x6f82('0x3b')][_0x6f82('0x41')]));_0x4b580f['attributes']=_0x4b580f['attributes'][_0x6f82('0x43')]?_0x4b580f[_0x6f82('0x42')]:_0x1cbe28[_0x6f82('0x3f')];if(!_0x14c8bb[_0x6f82('0x3b')][_0x6f82('0xa8')](_0x6f82('0x9e'))){_0x4b580f['limit']=qs['limit'](_0x14c8bb[_0x6f82('0x3b')]['limit']);_0x4b580f[_0x6f82('0x29')]=qs[_0x6f82('0x29')](_0x14c8bb[_0x6f82('0x3b')][_0x6f82('0x29')]);}_0x4b580f[_0x6f82('0x9f')]=qs[_0x6f82('0xa0')](_0x14c8bb[_0x6f82('0x3b')][_0x6f82('0xa0')]);_0x4b580f[_0x6f82('0xa1')]=qs[_0x6f82('0x3e')](_[_0x6f82('0xa2')](_0x14c8bb[_0x6f82('0x3b')],_0x1cbe28[_0x6f82('0x3e')]));_0x4b580f[_0x6f82('0xa1')][_0x6f82('0xa3')]=_0x5a53e9['id'];if(_0x14c8bb[_0x6f82('0x3b')][_0x6f82('0xa4')]){_0x4b580f[_0x6f82('0xa1')]=_[_0x6f82('0x30')](_0x4b580f[_0x6f82('0xa1')],{'$or':_[_0x6f82('0x35')](_0x4b580f[_0x6f82('0x42')],function(_0x1c3267){var _0x24f6db={};_0x24f6db[_0x1c3267]={'$like':'%'+_0x14c8bb[_0x6f82('0x3b')][_0x6f82('0xa4')]+'%'};return _0x24f6db;})});}_0x4b580f[_0x6f82('0xa1')][_0x6f82('0x90')]=![];if(_0x14c8bb[_0x6f82('0x3b')]['id']){_0x4b580f['where']['id']={'$gt':_0x14c8bb[_0x6f82('0x3b')]['id']};}_0x4b580f=_[_0x6f82('0x30')]({},_0x4b580f,_0x14c8bb['options']);return db[_0x6f82('0x62')][_0x6f82('0x28')]({'where':_0x4b580f['where']})['then'](function(_0x468b8b){_0xe57f7e[_0x6f82('0x28')]=_0x468b8b;_0x4b580f[_0x6f82('0x45')]=[];if(_0x14c8bb[_0x6f82('0x3b')][_0x6f82('0xa9')]){_0x4b580f[_0x6f82('0x45')][_0x6f82('0xaa')]({'model':db['User'],'as':_0x6f82('0x84'),'attributes':['id',_0x6f82('0x54'),_0x6f82('0x8d')]});}if(_0x14c8bb[_0x6f82('0x3b')][_0x6f82('0x44')]){_0x4b580f['include']=[{'all':!![]}];}return db[_0x6f82('0x62')]['findAll'](_0x4b580f);})[_0x6f82('0x18')](function(_0x17e590){_0xe57f7e[_0x6f82('0xab')]=_0x17e590;return _0xe57f7e;});}})[_0x6f82('0x18')](respondWithFilteredResult(_0x1b76a7,_0x4b580f))[_0x6f82('0x22')](handleError(_0x1b76a7,null));};exports[_0x6f82('0xac')]=function(_0x49e4fd,_0x48b999){return db['ChatInteraction'][_0x6f82('0x48')]({'where':{'id':_0x49e4fd[_0x6f82('0x49')]['id']}})[_0x6f82('0x18')](handleEntityNotFound(_0x48b999,null))[_0x6f82('0x18')](function(_0x24df4c){if(_0x24df4c){return _0x24df4c[_0x6f82('0xad')](_0x49e4fd[_0x6f82('0x31')][_0x6f82('0x9a')],_[_0x6f82('0x9b')](_0x49e4fd[_0x6f82('0x31')],[_0x6f82('0x9a'),'id'])||{})[_0x6f82('0xae')](function(){return db['Tag'][_0x6f82('0x39')]({'attributes':['id',_0x6f82('0x2f'),_0x6f82('0xaf')],'where':{'id':_0x49e4fd[_0x6f82('0x31')]['ids']}});})['then'](function(_0x5c1e60){socket['emit']('chatInteractionTags:save',{'id':Number(_0x49e4fd[_0x6f82('0x49')]['id']),'tags':_0x5c1e60||[]});return{'id':Number(_0x49e4fd['params']['id']),'tags':_0x5c1e60||[]};});}})['then'](respondWithResult(_0x48b999,null))[_0x6f82('0x22')](handleError(_0x48b999,null));};exports[_0x6f82('0xb0')]=function(_0x3c58fa,_0x2aa76b){return db['ChatInteraction'][_0x6f82('0x48')]({'where':{'id':_0x3c58fa[_0x6f82('0x49')]['id']}})[_0x6f82('0x18')](handleEntityNotFound(_0x2aa76b,null))[_0x6f82('0x18')](function(_0x5c7967){if(_0x5c7967){return _0x5c7967[_0x6f82('0xb0')](_0x3c58fa[_0x6f82('0x3b')][_0x6f82('0x9a')]);}})[_0x6f82('0x18')](respondWithStatusCode(_0x2aa76b,null))[_0x6f82('0x22')](handleError(_0x2aa76b,null));};exports['download']=function(_0x5f4b02,_0x28debc){var _0x27c45b=moment()[_0x6f82('0xb1')]()[_0x6f82('0xb2')]();var _0x23b7ad=path[_0x6f82('0x7a')](config[_0x6f82('0x78')],_0x6f82('0xb3'),_0x6f82('0xb4'),_0x6f82('0xb5'));var _0x4c47f2=path[_0x6f82('0x7a')](config[_0x6f82('0x78')],_0x6f82('0xb3'),_0x6f82('0xb4'),'attachments');var _0x49d2dd=path[_0x6f82('0x7a')](_0x23b7ad,_0x27c45b);var _0x5bf729=util[_0x6f82('0x80')]('transcript-%d-%s.zip',_0x5f4b02[_0x6f82('0x49')]['id'],_0x27c45b);var _0x3b917b=path[_0x6f82('0x7a')](_0x23b7ad,_0x5bf729);var _0x4db060=[];_0x4db060['push']({'model':db[_0x6f82('0x84')],'as':_0x6f82('0x84'),'attributes':['id',_0x6f82('0x54')],'raw':!![]});_0x4db060['push']({'model':db[_0x6f82('0x66')],'as':_0x6f82('0x67'),'attributes':['id',_0x6f82('0xb6'),_0x6f82('0xb7')],'raw':!![]});if(_0x5f4b02[_0x6f82('0x3b')]['attachments']){_0x4db060[_0x6f82('0xaa')]({'model':db[_0x6f82('0x74')],'as':_0x6f82('0x74'),'raw':!![]});}var _0x269ae7=[{'model':db[_0x6f82('0x62')],'as':'Messages','attributes':['id',_0x6f82('0x31'),'createdAt',_0x6f82('0xb8'),_0x6f82('0x90'),_0x6f82('0xb9')],'include':_0x4db060}];_0x269ae7[_0x6f82('0xaa')]({'model':db[_0x6f82('0xba')],'as':'Account','attributes':['id',_0x6f82('0x2f')]});_0x269ae7['push']({'model':db[_0x6f82('0x84')],'as':_0x6f82('0xbb'),'attributes':['id',_0x6f82('0x54')]});return db['ChatInteraction']['find']({'where':{'id':_0x5f4b02[_0x6f82('0x49')]['id']},'include':_0x269ae7})['then'](handleEntityNotFound(_0x28debc,null))[_0x6f82('0x18')](function(_0x5d469c){if(_0x5d469c){var _0x3447a3=_0x5d469c['get']({'plain':!![]});fs[_0x6f82('0xbc')](_0x49d2dd);var _0x243505={'channel':_0x6f82('0xbd'),'account':_0x3447a3['Account'][_0x6f82('0x2f')],'agent':_0x3447a3[_0x6f82('0xbb')]?_0x3447a3[_0x6f82('0xbb')][_0x6f82('0x54')]:'N.A.','createdAt':moment(_0x3447a3[_0x6f82('0xbe')])[_0x6f82('0x80')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6f82('0xb2')](),'closedAt':_0x3447a3[_0x6f82('0x6c')]?moment(_0x3447a3[_0x6f82('0xbf')])['format'](_0x6f82('0xa6'))[_0x6f82('0xb2')]():'','disposition':_0x3447a3[_0x6f82('0x6d')],'chatInfo':{'browser':_0x3447a3['browserName'],'os':_0x3447a3[_0x6f82('0xc0')],'referer':_0x3447a3[_0x6f82('0xc1')],'customerIp':_0x3447a3[_0x6f82('0xc2')],'customerPort':_0x3447a3[_0x6f82('0xc3')]?_0x3447a3[_0x6f82('0xc3')]:_0x6f82('0xc4')},'messages':_(_0x3447a3[_0x6f82('0x83')])[_0x6f82('0xc5')]()[_0x6f82('0xa4')]({'secret':![]})['map'](function(_0x2e654c){if(_0x2e654c['Attachment']){var _0x1087d5=path[_0x6f82('0x7a')](_0x4c47f2,_0x2e654c[_0x6f82('0x74')]['basename']);if(fs['existsSync'](_0x1087d5)){fs['createReadStream'](_0x1087d5)[_0x6f82('0xc6')](fs[_0x6f82('0xc7')](path[_0x6f82('0x7a')](_0x49d2dd,_0x2e654c[_0x6f82('0x74')]['basename'])));}}return{'date':moment(_0x2e654c[_0x6f82('0xbe')])[_0x6f82('0x80')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x2e654c[_0x6f82('0xb8')]===_0x6f82('0x61')?_0x2e654c[_0x6f82('0x84')]?_0x2e654c[_0x6f82('0x84')][_0x6f82('0x54')]:_0x6f82('0x87'):_0x2e654c[_0x6f82('0x67')][_0x6f82('0xb6')]+(_0x2e654c[_0x6f82('0x67')][_0x6f82('0xb7')]?'\x20'+_0x2e654c[_0x6f82('0x67')][_0x6f82('0xb7')]:''),'body':_0x2e654c[_0x6f82('0x74')]?_0x2e654c['Attachment'][_0x6f82('0x7c')]:_0x2e654c[_0x6f82('0x31')],'direction':_0x2e654c['direction']===_0x6f82('0x61')?'A':'C','secret':_0x2e654c[_0x6f82('0x90')],'read':_0x2e654c[_0x6f82('0xb9')],'attachment':_0x2e654c[_0x6f82('0x74')]};})[_0x6f82('0xc8')]()};return ejs[_0x6f82('0xc9')](path[_0x6f82('0x7a')](config[_0x6f82('0x78')],_0x6f82('0xb3'),_0x6f82('0xca'),_0x6f82('0xcb')),{'interaction':_0x243505})[_0x6f82('0x18')](function(_0x61d3aa){var _0x1b2f21=path[_0x6f82('0x7a')](_0x49d2dd,_0x6f82('0xcc')+_0x3447a3['id']+'-'+_0x27c45b+_0x6f82('0xcd'));var _0x3317df={'path':_0x1b2f21,'channel':'Chat','interactionId':_0x3447a3['id']};return pdf[_0x6f82('0xce')](_0x61d3aa,_0x3317df);})[_0x6f82('0x18')](function(){return new Promise(function(_0x12cdde,_0x7c1325){zipdir(_0x49d2dd,{'saveTo':_0x3b917b},function(_0x49ac21,_0xd738e2){if(_0x49ac21)return _0x7c1325(_0x49ac21);return _0x12cdde(_0xd738e2);});})[_0x6f82('0x18')](function(){return new BPromise(function(_0x5696b0,_0x3d7a6a){rimraf(_0x49d2dd,function(_0x5d030d){if(_0x5d030d)_0x3d7a6a(_0x5d030d);return _0x5696b0();});});})[_0x6f82('0x18')](function(){return _0x28debc['download'](_0x3b917b,_0x5bf729,function(_0x47dbb2){if(_0x47dbb2){logger[_0x6f82('0x1e')]('err',_0x47dbb2);}else{fs[_0x6f82('0xcf')](_0x3b917b);}});});});}else{return _0x28debc[_0x6f82('0x23')](0xc8);}})[_0x6f82('0x22')](handleError(_0x28debc,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index df7f45b..808118a 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 _0x6c23=['ChatInteraction','ChatMessage','setMaxListeners','save','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x21a38e,_0x31404b){var _0x61dd7d=function(_0x105f79){while(--_0x105f79){_0x21a38e['push'](_0x21a38e['shift']());}};_0x61dd7d(++_0x31404b);}(_0x6c23,0x131));var _0x36c2=function(_0x37c840,_0x5d052a){_0x37c840=_0x37c840-0x0;var _0x975c36=_0x6c23[_0x37c840];return _0x975c36;};'use strict';var EventEmitter=require(_0x36c2('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x36c2('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x36c2('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x36c2('0x3')](0x0);var events={'afterCreate':_0x36c2('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3c6ea8){return function(_0x2f9129,_0x2606e9,_0x2cd54b){_0x2f9129[_0x36c2('0x5')]({'attributes':['id'],'raw':!![]})[_0x36c2('0x6')](function(_0x38e107){_0x2f9129['setDataValue'](_0x36c2('0x7'),_0x38e107[_0x36c2('0x8')](function(_0x6992b8){return{'id':_0x6992b8['id']};}));return ChatMessage[_0x36c2('0x9')]({'where':{'ChatInteractionId':_0x2f9129['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x99f706){_0x2f9129[_0x36c2('0xa')](_0x36c2('0xb'),_0x99f706[_0x36c2('0xc')]);ChatInteractionEvents[_0x36c2('0xd')](_0x3c6ea8+':'+_0x2f9129['id'],_0x2f9129);ChatInteractionEvents['emit'](_0x3c6ea8,_0x2f9129);_0x2cd54b(null);})[_0x36c2('0xe')](_0x2cd54b(null));};}for(var e in events){if(events[_0x36c2('0xf')](e)){var event=events[e];ChatInteraction[_0x36c2('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x770f=['setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','../../mysqldb','ChatInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x770f,0x7e));var _0xf770=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x770f[_0x38854e];return _0x3f8415;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xf770('0x0'))['db'][_0xf770('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf770('0x2')](0x0);var events={'afterCreate':_0xf770('0x3'),'afterUpdate':_0xf770('0x4'),'afterDestroy':_0xf770('0x5')};function emitEvent(_0x52f9b9){return function(_0x16e042,_0x91eb20,_0x4fe207){_0x16e042['getUsers']({'attributes':['id'],'raw':!![]})[_0xf770('0x6')](function(_0x4a9d77){_0x16e042[_0xf770('0x7')](_0xf770('0x8'),_0x4a9d77[_0xf770('0x9')](function(_0x3f909e){return{'id':_0x3f909e['id']};}));return ChatMessage[_0xf770('0xa')]({'where':{'ChatInteractionId':_0x16e042['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf770('0x6')](function(_0x2c1c57){_0x16e042[_0xf770('0x7')](_0xf770('0xb'),_0x2c1c57['length']);ChatInteractionEvents['emit'](_0x52f9b9+':'+_0x16e042['id'],_0x16e042);ChatInteractionEvents[_0xf770('0xc')](_0x52f9b9,_0x16e042);_0x4fe207(null);})[_0xf770('0xd')](_0x4fe207(null));};}for(var e in events){if(events[_0xf770('0xe')](e)){var event=events[e];ChatInteraction[_0xf770('0xf')](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 5969992..878e8dc 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 _0x2f99=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','closedAt','format','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2f99,0x133));var _0x92f9=function(_0x5b2008,_0x5121fe){_0x5b2008=_0x5b2008-0x0;var _0x1eb25a=_0x2f99[_0x5b2008];return _0x1eb25a;};'use strict';var _=require('lodash');var util=require(_0x92f9('0x0'));var logger=require(_0x92f9('0x1'))(_0x92f9('0x2'));var moment=require(_0x92f9('0x3'));var BPromise=require(_0x92f9('0x4'));var rp=require(_0x92f9('0x5'));var fs=require('fs');var path=require(_0x92f9('0x6'));var rimraf=require(_0x92f9('0x7'));var config=require(_0x92f9('0x8'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x224695,_0x155a6f){return _0x224695[_0x92f9('0x9')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x563566,_0x3cbaeb,_0x49caad){if(_0x563566['changed']('closed')){_0x563566[_0x92f9('0xa')]=moment()[_0x92f9('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x49caad(null,_0x563566);}},'charset':_0x92f9('0xc'),'collate':_0x92f9('0xd')});}; \ No newline at end of file +var _0x6238=['moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0xb2d0a3,_0x76c6b1){var _0x52f58c=function(_0x2ded29){while(--_0x2ded29){_0xb2d0a3['push'](_0xb2d0a3['shift']());}};_0x52f58c(++_0x76c6b1);}(_0x6238,0x8d));var _0x8623=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6238[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x8623('0x0'));var logger=require(_0x8623('0x1'))(_0x8623('0x2'));var moment=require(_0x8623('0x3'));var BPromise=require(_0x8623('0x4'));var rp=require(_0x8623('0x5'));var fs=require('fs');var path=require(_0x8623('0x6'));var rimraf=require(_0x8623('0x7'));var config=require('../../config/environment');var attributes=require(_0x8623('0x8'));module[_0x8623('0x9')]=function(_0x43b64f,_0x88d5c7){return _0x43b64f[_0x8623('0xa')]('ChatInteraction',attributes,{'tableName':_0x8623('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2140eb,_0x5c6a8c,_0x133833){if(_0x2140eb[_0x8623('0xc')](_0x8623('0xd'))){_0x2140eb[_0x8623('0xe')]=moment()['format'](_0x8623('0xf'));}_0x133833(null,_0x2140eb);}},'charset':_0x8623('0x10'),'collate':_0x8623('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index e4dfd8f..49797e2 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 _0x7ecd=['raw','options','limit','debug','AddTagsToChatInteraction','where','ids','omit','AddTags','stringify','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','UpdateChatInteraction','ChatInteraction','body'];(function(_0x5f425c,_0x2a7106){var _0x38ebb4=function(_0x1eba01){while(--_0x1eba01){_0x5f425c['push'](_0x5f425c['shift']());}};_0x38ebb4(++_0x2a7106);}(_0x7ecd,0x1eb));var _0xd7ec=function(_0x50b268,_0x47ba92){_0x50b268=_0x50b268-0x0;var _0x41577c=_0x7ecd[_0x50b268];return _0x41577c;};'use strict';var _=require(_0xd7ec('0x0'));var util=require(_0xd7ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7ec('0x2'));var db=require(_0xd7ec('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7ec('0x4'))('rpc');var config=require(_0xd7ec('0x5'));var jayson=require(_0xd7ec('0x6'));var client=jayson[_0xd7ec('0x7')][_0xd7ec('0x8')]({'port':0x232a});config[_0xd7ec('0x9')]=_[_0xd7ec('0xa')](config[_0xd7ec('0x9')],{'host':_0xd7ec('0xb'),'port':0x18eb});var socket=require(_0xd7ec('0xc'))(new Redis(config['redis']));require(_0xd7ec('0xd'))['register'](socket);function respondWithRpcPromise(_0x10a501,_0x37dd1a,_0x287db0){return new BPromise(function(_0x5be2b2,_0x144913){return client[_0xd7ec('0xe')](_0x10a501,_0x287db0)[_0xd7ec('0xf')](function(_0x5e6534){logger[_0xd7ec('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x37dd1a,_0xd7ec('0x11'));logger['debug'](_0xd7ec('0x12'),_0x37dd1a,_0xd7ec('0x11'),JSON['stringify'](_0x5e6534));if(_0x5e6534[_0xd7ec('0x13')]){if(_0x5e6534[_0xd7ec('0x13')][_0xd7ec('0x14')]===0x1f4){logger[_0xd7ec('0x13')](_0xd7ec('0x15'),_0x37dd1a,_0x5e6534['error'][_0xd7ec('0x16')]);return _0x144913(_0x5e6534[_0xd7ec('0x13')]['message']);}logger[_0xd7ec('0x13')](_0xd7ec('0x15'),_0x37dd1a,_0x5e6534[_0xd7ec('0x13')][_0xd7ec('0x16')]);return _0x5be2b2(_0x5e6534[_0xd7ec('0x13')][_0xd7ec('0x16')]);}else{logger[_0xd7ec('0x10')](_0xd7ec('0x15'),_0x37dd1a,'request\x20sent');_0x5be2b2(_0x5e6534['result']['message']);}})[_0xd7ec('0x17')](function(_0x4dbb02){logger[_0xd7ec('0x13')](_0xd7ec('0x15'),_0x37dd1a,_0x4dbb02);_0x144913(_0x4dbb02);});});}exports[_0xd7ec('0x18')]=function(_0x20e40b){var _0x324571=this;return new Promise(function(_0x4ac388,_0x3286b0){return db[_0xd7ec('0x19')]['update'](_0x20e40b[_0xd7ec('0x1a')],{'raw':_0x20e40b['options']?_0x20e40b['options'][_0xd7ec('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20e40b[_0xd7ec('0x1c')]?_0x20e40b[_0xd7ec('0x1c')]['where']||null:null,'attributes':_0x20e40b[_0xd7ec('0x1c')]?_0x20e40b[_0xd7ec('0x1c')]['attributes']||null:null,'limit':_0x20e40b[_0xd7ec('0x1c')]?_0x20e40b['options'][_0xd7ec('0x1d')]||null:null})['then'](function(_0x220169){logger[_0xd7ec('0x10')](_0xd7ec('0x18'),_0x20e40b);logger[_0xd7ec('0x1e')](_0xd7ec('0x18'),_0x20e40b,JSON['stringify'](_0x220169));_0x4ac388(_0x220169);})['catch'](function(_0x4d9b4f){logger[_0xd7ec('0x13')]('UpdateChatInteraction',_0x4d9b4f[_0xd7ec('0x16')],_0x20e40b);_0x3286b0(_0x324571[_0xd7ec('0x13')](0x1f4,_0x4d9b4f[_0xd7ec('0x16')]));});});};exports[_0xd7ec('0x1f')]=function(_0x211443){return new Promise(function(_0x33ebd5,_0x4bd123){return db['ChatInteraction']['find']({'where':_0x211443[_0xd7ec('0x1c')]?_0x211443[_0xd7ec('0x1c')][_0xd7ec('0x20')]||null:null})[_0xd7ec('0xf')](function(_0x52efad){if(_0x52efad){return _0x52efad['addTags'](_0x211443[_0xd7ec('0x1a')][_0xd7ec('0x21')],_[_0xd7ec('0x22')](_0x211443[_0xd7ec('0x1a')],['ids','id'])||{});}})['spread'](function(_0x5824b8){logger['info']('AddTags',_0x211443);logger[_0xd7ec('0x1e')](_0xd7ec('0x23'),_0x211443,JSON[_0xd7ec('0x24')](_0x5824b8));_0x33ebd5(_0x5824b8);})[_0xd7ec('0x17')](function(_0x2ed5fd){logger['error'](_0xd7ec('0x23'),_0x2ed5fd[_0xd7ec('0x16')],_0x211443);_0x4bd123(_this['error'](0x1f4,_0x2ed5fd[_0xd7ec('0x16')]));});});}; \ No newline at end of file +var _0x4d59=['http','redis','defaults','socket.io-emitter','./chatInteraction.socket','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','UpdateChatInteraction','ChatInteraction','update','body','raw','options','attributes','limit','AddTagsToChatInteraction','find','where','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x58f342,_0x10a137){var _0x41aecc=function(_0x13c5f0){while(--_0x13c5f0){_0x58f342['push'](_0x58f342['shift']());}};_0x41aecc(++_0x10a137);}(_0x4d59,0xf7));var _0x94d5=function(_0x3834e6,_0x3716eb){_0x3834e6=_0x3834e6-0x0;var _0x4d50e4=_0x4d59[_0x3834e6];return _0x4d50e4;};'use strict';var _=require(_0x94d5('0x0'));var util=require(_0x94d5('0x1'));var moment=require(_0x94d5('0x2'));var BPromise=require(_0x94d5('0x3'));var rs=require(_0x94d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94d5('0x5'))['db'];var utils=require(_0x94d5('0x6'));var logger=require(_0x94d5('0x7'))(_0x94d5('0x8'));var config=require(_0x94d5('0x9'));var jayson=require(_0x94d5('0xa'));var client=jayson['client'][_0x94d5('0xb')]({'port':0x232a});config[_0x94d5('0xc')]=_[_0x94d5('0xd')](config[_0x94d5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x94d5('0xe'))(new Redis(config[_0x94d5('0xc')]));require(_0x94d5('0xf'))['register'](socket);function respondWithRpcPromise(_0x314d2c,_0x566065,_0x1dd5e3){return new BPromise(function(_0x1fc133,_0x4c1be8){return client[_0x94d5('0x10')](_0x314d2c,_0x1dd5e3)[_0x94d5('0x11')](function(_0xcb2e70){logger[_0x94d5('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x566065,'request\x20sent');logger[_0x94d5('0x13')](_0x94d5('0x14'),_0x566065,_0x94d5('0x15'),JSON[_0x94d5('0x16')](_0xcb2e70));if(_0xcb2e70[_0x94d5('0x17')]){if(_0xcb2e70[_0x94d5('0x17')][_0x94d5('0x18')]===0x1f4){logger['error'](_0x94d5('0x19'),_0x566065,_0xcb2e70[_0x94d5('0x17')][_0x94d5('0x1a')]);return _0x4c1be8(_0xcb2e70['error'][_0x94d5('0x1a')]);}logger[_0x94d5('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x566065,_0xcb2e70[_0x94d5('0x17')]['message']);return _0x1fc133(_0xcb2e70['error'][_0x94d5('0x1a')]);}else{logger[_0x94d5('0x12')](_0x94d5('0x19'),_0x566065,'request\x20sent');_0x1fc133(_0xcb2e70['result']['message']);}})[_0x94d5('0x1b')](function(_0x1246c2){logger[_0x94d5('0x17')](_0x94d5('0x19'),_0x566065,_0x1246c2);_0x4c1be8(_0x1246c2);});});}exports[_0x94d5('0x1c')]=function(_0x3dba1b){var _0x3a7cba=this;return new Promise(function(_0x3a6663,_0x370aa4){return db[_0x94d5('0x1d')][_0x94d5('0x1e')](_0x3dba1b[_0x94d5('0x1f')],{'raw':_0x3dba1b['options']?_0x3dba1b['options'][_0x94d5('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dba1b[_0x94d5('0x21')]?_0x3dba1b['options']['where']||null:null,'attributes':_0x3dba1b[_0x94d5('0x21')]?_0x3dba1b['options'][_0x94d5('0x22')]||null:null,'limit':_0x3dba1b[_0x94d5('0x21')]?_0x3dba1b[_0x94d5('0x21')][_0x94d5('0x23')]||null:null})[_0x94d5('0x11')](function(_0x147fec){logger['info'](_0x94d5('0x1c'),_0x3dba1b);logger[_0x94d5('0x13')](_0x94d5('0x1c'),_0x3dba1b,JSON[_0x94d5('0x16')](_0x147fec));_0x3a6663(_0x147fec);})[_0x94d5('0x1b')](function(_0x365d9a){logger[_0x94d5('0x17')](_0x94d5('0x1c'),_0x365d9a[_0x94d5('0x1a')],_0x3dba1b);_0x370aa4(_0x3a7cba['error'](0x1f4,_0x365d9a[_0x94d5('0x1a')]));});});};exports[_0x94d5('0x24')]=function(_0x5c961a){return new Promise(function(_0xd99e6b,_0x30f27c){return db[_0x94d5('0x1d')][_0x94d5('0x25')]({'where':_0x5c961a[_0x94d5('0x21')]?_0x5c961a['options'][_0x94d5('0x26')]||null:null})[_0x94d5('0x11')](function(_0xeab39b){if(_0xeab39b){return _0xeab39b[_0x94d5('0x27')](_0x5c961a['body'][_0x94d5('0x28')],_['omit'](_0x5c961a['body'],[_0x94d5('0x28'),'id'])||{});}})[_0x94d5('0x29')](function(_0x5a5cad){logger[_0x94d5('0x12')](_0x94d5('0x2a'),_0x5c961a);logger[_0x94d5('0x13')](_0x94d5('0x2a'),_0x5c961a,JSON[_0x94d5('0x16')](_0x5a5cad));_0xd99e6b(_0x5a5cad);})[_0x94d5('0x1b')](function(_0x1b068e){logger['error'](_0x94d5('0x2a'),_0x1b068e['message'],_0x5c961a);_0x30f27c(_this[_0x94d5('0x17')](0x1f4,_0x1b068e[_0x94d5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d1ef32f..b6b91a2 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 _0xe1c3=['remove','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x2129df,_0x357045){var _0x1e09a8=function(_0x19a3b9){while(--_0x19a3b9){_0x2129df['push'](_0x2129df['shift']());}};_0x1e09a8(++_0x357045);}(_0xe1c3,0x1de));var _0x3e1c=function(_0x28b43d,_0x53eaaf){_0x28b43d=_0x28b43d-0x0;var _0x3083e8=_0xe1c3[_0x28b43d];return _0x3083e8;};'use strict';var ChatInteractionEvents=require(_0x3e1c('0x0'));var events=[_0x3e1c('0x1'),_0x3e1c('0x2'),'update'];function createListener(_0x4eada8,_0x240748){return function(_0x5e34f2){_0x240748[_0x3e1c('0x3')](_0x4eada8,_0x5e34f2);};}function removeListener(_0x234423,_0x5aca4f){return function(){ChatInteractionEvents[_0x3e1c('0x4')](_0x234423,_0x5aca4f);};}exports[_0x3e1c('0x5')]=function(_0x23fb17){for(var _0x11b92b=0x0,_0x26f5e6=events[_0x3e1c('0x6')];_0x11b92b<_0x26f5e6;_0x11b92b++){var _0x4c8285=events[_0x11b92b];var _0x438353=createListener(_0x3e1c('0x7')+_0x4c8285,_0x23fb17);ChatInteractionEvents['on'](_0x4c8285,_0x438353);}}; \ No newline at end of file +var _0x948d=['length','chatInteraction:','save','update','emit','removeListener','register'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x948d,0x1c9));var _0xd948=function(_0x1b8920,_0x22ddbe){_0x1b8920=_0x1b8920-0x0;var _0x687a5c=_0x948d[_0x1b8920];return _0x687a5c;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xd948('0x0'),'remove',_0xd948('0x1')];function createListener(_0x3744cb,_0x301371){return function(_0x591d3d){_0x301371[_0xd948('0x2')](_0x3744cb,_0x591d3d);};}function removeListener(_0x539c7f,_0x30676e){return function(){ChatInteractionEvents[_0xd948('0x3')](_0x539c7f,_0x30676e);};}exports[_0xd948('0x4')]=function(_0x85ca62){for(var _0x469aee=0x0,_0x3313d9=events[_0xd948('0x5')];_0x469aee<_0x3313d9;_0x469aee++){var _0x2da851=events[_0x469aee];var _0x2e26ba=createListener(_0xd948('0x6')+_0x2da851,_0x85ca62);ChatInteractionEvents['on'](_0x2da851,_0x2e26ba);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d48cc12..a1d7a54 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 _0x9c06=['delete','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMyMessages','download','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy'];(function(_0x2beabf,_0x1c98e5){var _0x5437d9=function(_0x461772){while(--_0x461772){_0x2beabf['push'](_0x2beabf['shift']());}};_0x5437d9(++_0x1c98e5);}(_0x9c06,0x107));var _0x69c0=function(_0x42d95e,_0x496c02){_0x42d95e=_0x42d95e-0x0;var _0x1c38c6=_0x9c06[_0x42d95e];return _0x1c38c6;};'use strict';var multer=require('multer');var util=require(_0x69c0('0x0'));var path=require(_0x69c0('0x1'));var timeout=require(_0x69c0('0x2'));var express=require(_0x69c0('0x3'));var router=express['Router']();var fs_extra=require(_0x69c0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x69c0('0x5'));var config=require('../../config/environment');var controller=require(_0x69c0('0x6'));router[_0x69c0('0x7')]('/',auth[_0x69c0('0x8')](),controller[_0x69c0('0x9')]);router[_0x69c0('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x69c0('0xa')]);router[_0x69c0('0x7')](_0x69c0('0xb'),auth[_0x69c0('0xc')](),controller[_0x69c0('0xd')]);router[_0x69c0('0x7')](_0x69c0('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x69c0('0xf')]);router[_0x69c0('0x7')](_0x69c0('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0x69c0('0x7')]('/:id/my_messages',auth[_0x69c0('0xc')](),controller[_0x69c0('0x11')]);router['get']('/:id/download',auth[_0x69c0('0x8')](),controller[_0x69c0('0x12')]);router[_0x69c0('0x13')]('/',auth[_0x69c0('0x8')](),controller['create']);router['post'](_0x69c0('0x14'),auth[_0x69c0('0x8')](),controller[_0x69c0('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x23570a,_0x2db4e5,_0xa973ed){_0xa973ed(null,path[_0x69c0('0x16')](config[_0x69c0('0x17')],_0x69c0('0x18')));},'filename':function(_0x10f47c,_0x2015bb,_0x17ae21){_0x17ae21(null,util[_0x69c0('0x19')](_0x69c0('0x1a'),Date[_0x69c0('0x1b')](),_0x2015bb[_0x69c0('0x1c')][_0x69c0('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x69c0('0x1e')](_0x69c0('0x1f')),controller[_0x69c0('0x20')]);router[_0x69c0('0x13')](_0x69c0('0x10'),auth[_0x69c0('0xc')](),controller[_0x69c0('0x21')]);router['post'](_0x69c0('0x22'),auth[_0x69c0('0x8')](),interaction[_0x69c0('0x23')]('chat',_0x69c0('0x24')),controller['addTags']);router[_0x69c0('0x25')](_0x69c0('0xb'),auth[_0x69c0('0x8')](),interaction[_0x69c0('0x23')](_0x69c0('0x26'),_0x69c0('0x27')),controller[_0x69c0('0x28')]);router[_0x69c0('0x25')](_0x69c0('0x29'),controller[_0x69c0('0x2a')]);router[_0x69c0('0x25')](_0x69c0('0x2b'),auth[_0x69c0('0xc')](),controller[_0x69c0('0x2c')]);router[_0x69c0('0x25')](_0x69c0('0x2d'),controller[_0x69c0('0x2e')]);router['delete'](_0x69c0('0xb'),auth[_0x69c0('0x8')](),interaction[_0x69c0('0x23')](_0x69c0('0x26'),_0x69c0('0x2f')),controller[_0x69c0('0x30')]);router[_0x69c0('0x31')](_0x69c0('0x22'),auth[_0x69c0('0x8')](),controller[_0x69c0('0x32')]);module[_0x69c0('0x33')]=router; \ No newline at end of file +var _0x5536=['chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','delete','chatinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','root','format','%s-%s','originalname','replace','/:id/attachment_upload','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put'];(function(_0x9e51d4,_0x21d976){var _0x29efb8=function(_0x41e09b){while(--_0x41e09b){_0x9e51d4['push'](_0x9e51d4['shift']());}};_0x29efb8(++_0x21d976);}(_0x5536,0xd6));var _0x6553=function(_0xaed81a,_0x193d9f){_0xaed81a=_0xaed81a-0x0;var _0x5e02f6=_0x5536[_0xaed81a];return _0x5e02f6;};'use strict';var multer=require('multer');var util=require(_0x6553('0x0'));var path=require(_0x6553('0x1'));var timeout=require(_0x6553('0x2'));var express=require(_0x6553('0x3'));var router=express['Router']();var fs_extra=require(_0x6553('0x4'));var auth=require(_0x6553('0x5'));var interaction=require(_0x6553('0x6'));var config=require(_0x6553('0x7'));var controller=require(_0x6553('0x8'));router[_0x6553('0x9')]('/',auth[_0x6553('0xa')](),controller[_0x6553('0xb')]);router['get'](_0x6553('0xc'),auth['isAuthenticated'](),controller[_0x6553('0xd')]);router[_0x6553('0x9')](_0x6553('0xe'),auth[_0x6553('0xf')](),controller[_0x6553('0x10')]);router[_0x6553('0x9')](_0x6553('0x11'),auth[_0x6553('0xf')](),controller[_0x6553('0x12')]);router[_0x6553('0x9')](_0x6553('0x13'),auth[_0x6553('0xa')](),controller[_0x6553('0x14')]);router[_0x6553('0x9')](_0x6553('0x15'),auth[_0x6553('0xf')](),controller[_0x6553('0x16')]);router[_0x6553('0x9')](_0x6553('0x17'),auth[_0x6553('0xa')](),controller['download']);router[_0x6553('0x18')]('/',auth[_0x6553('0xa')](),controller[_0x6553('0x19')]);router['post'](_0x6553('0x1a'),auth[_0x6553('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2335d9,_0x39cc1e,_0x349f30){_0x349f30(null,path['join'](config[_0x6553('0x1b')],'server/files/attachments/'));},'filename':function(_0x3b80b4,_0x507856,_0x18d70f){_0x18d70f(null,util[_0x6553('0x1c')](_0x6553('0x1d'),Date['now'](),_0x507856[_0x6553('0x1e')][_0x6553('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x6553('0x20'),upload['single'](_0x6553('0x21')),controller['attachmentUpload']);router[_0x6553('0x18')](_0x6553('0x13'),auth[_0x6553('0xf')](),controller[_0x6553('0x22')]);router[_0x6553('0x18')](_0x6553('0x23'),auth[_0x6553('0xa')](),interaction[_0x6553('0x24')](_0x6553('0x25'),_0x6553('0x26')),controller[_0x6553('0x27')]);router[_0x6553('0x28')](_0x6553('0xe'),auth[_0x6553('0xa')](),interaction['tracked'](_0x6553('0x25'),_0x6553('0x29')),controller[_0x6553('0x2a')]);router[_0x6553('0x28')](_0x6553('0x2b'),controller[_0x6553('0x2c')]);router['put'](_0x6553('0x2d'),auth[_0x6553('0xf')](),controller['abandon']);router[_0x6553('0x28')](_0x6553('0x2e'),controller['close']);router[_0x6553('0x2f')]('/:id',auth[_0x6553('0xa')](),interaction[_0x6553('0x24')](_0x6553('0x25'),_0x6553('0x30')),controller['destroy']);router[_0x6553('0x2f')](_0x6553('0x23'),auth[_0x6553('0xa')](),controller[_0x6553('0x31')]);module[_0x6553('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 12b6afd..618fbeb 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 _0x6e44=['BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x26f38c,_0x2021ad){var _0x124df8=function(_0x501adb){while(--_0x501adb){_0x26f38c['push'](_0x26f38c['shift']());}};_0x124df8(++_0x2021ad);}(_0x6e44,0xbf));var _0x46e4=function(_0x15f685,_0x39436d){_0x15f685=_0x15f685-0x0;var _0x171efd=_0x6e44[_0x15f685];return _0x171efd;};'use strict';var Sequelize=require(_0x46e4('0x0'));module[_0x46e4('0x1')]={'body':{'type':Sequelize[_0x46e4('0x2')](_0x46e4('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x46e4('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1ccf=['exports','INTEGER'];(function(_0x2cdd7b,_0x21ae5a){var _0xf8dcf8=function(_0x497663){while(--_0x497663){_0x2cdd7b['push'](_0x2cdd7b['shift']());}};_0xf8dcf8(++_0x21ae5a);}(_0x1ccf,0x1ba));var _0xf1cc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1ccf[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0xf1cc('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf1cc('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 434ead7..f0af5fd 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 _0x193c=['messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Agents','UserProfileResource','resourceId','push','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','filters','include','create','body','find','describe','get'];(function(_0x4bca54,_0x4750c0){var _0x478911=function(_0x2c498a){while(--_0x2c498a){_0x4bca54['push'](_0x4bca54['shift']());}};_0x478911(++_0x4750c0);}(_0x193c,0x1d3));var _0xc193=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x193c[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xc193('0x0'));var rimraf=require(_0xc193('0x1'));var zipdir=require(_0xc193('0x2'));var jsonpatch=require(_0xc193('0x3'));var rp=require(_0xc193('0x4'));var moment=require(_0xc193('0x5'));var BPromise=require(_0xc193('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc193('0x7'));var sox=require(_0xc193('0x8'));var csv=require(_0xc193('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc193('0xa'));var _=require(_0xc193('0xb'));var squel=require(_0xc193('0xc'));var crypto=require(_0xc193('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc193('0xe'));var toCsv=require(_0xc193('0x9'));var querystring=require(_0xc193('0xf'));var Papa=require(_0xc193('0x10'));var Redis=require('ioredis');var authService=require(_0xc193('0x11'));var qs=require(_0xc193('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc193('0x13'));var logger=require(_0xc193('0x14'))(_0xc193('0x15'));var utils=require(_0xc193('0x16'));var config=require(_0xc193('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc193('0x18'))['db'];config[_0xc193('0x19')]=_[_0xc193('0x1a')](config[_0xc193('0x19')],{'host':_0xc193('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc193('0x1c'))['register'](socket);function respondWithStatusCode(_0x21a12e,_0xaa7591){_0xaa7591=_0xaa7591||0xcc;return function(_0x734d9f){if(_0x734d9f){return _0x21a12e[_0xc193('0x1d')](_0xaa7591);}return _0x21a12e[_0xc193('0x1e')](_0xaa7591)[_0xc193('0x1f')]();};}function respondWithResult(_0x3edda6,_0x333875){_0x333875=_0x333875||0xc8;return function(_0x327451){if(_0x327451){return _0x3edda6[_0xc193('0x1e')](_0x333875)[_0xc193('0x20')](_0x327451);}};}function respondWithFilteredResult(_0x2e941f,_0x2f4e58){return function(_0x2876b1){if(_0x2876b1){var _0x3a3a36=typeof _0x2f4e58[_0xc193('0x21')]===_0xc193('0x22')&&typeof _0x2f4e58[_0xc193('0x23')]===_0xc193('0x22');var _0x4222fa=_0x2876b1['count'];var _0x540242=_0x3a3a36?0x0:_0x2f4e58[_0xc193('0x21')];var _0xcd5cc3=_0x3a3a36?_0x2876b1[_0xc193('0x24')]:_0x2f4e58[_0xc193('0x21')]+_0x2f4e58[_0xc193('0x23')];var _0x45b6cf;if(_0xcd5cc3>=_0x4222fa){_0xcd5cc3=_0x4222fa;_0x45b6cf=0xc8;}else{_0x45b6cf=0xce;}_0x2e941f[_0xc193('0x1e')](_0x45b6cf);return _0x2e941f[_0xc193('0x25')](_0xc193('0x26'),_0x540242+'-'+_0xcd5cc3+'/'+_0x4222fa)[_0xc193('0x20')](_0x2876b1);}return null;};}function patchUpdates(_0x17de7b){return function(_0x4c4474){try{jsonpatch[_0xc193('0x27')](_0x4c4474,_0x17de7b,!![]);}catch(_0x33a8c5){return BPromise[_0xc193('0x28')](_0x33a8c5);}return _0x4c4474['save']();};}function saveUpdates(_0x4643c2,_0x12fc74){return function(_0xd0c93c){if(_0xd0c93c){return _0xd0c93c[_0xc193('0x29')](_0x4643c2)[_0xc193('0x2a')](function(_0x572b50){return _0x572b50;});}return null;};}function removeEntity(_0x39924d,_0x584b1a){return function(_0x37e625){if(_0x37e625){return _0x37e625[_0xc193('0x2b')]()[_0xc193('0x2a')](function(){_0x39924d[_0xc193('0x1e')](0xcc)[_0xc193('0x1f')]();});}};}function handleEntityNotFound(_0x41f321,_0x3584af){return function(_0x3d2ed8){if(!_0x3d2ed8){_0x41f321[_0xc193('0x1d')](0x194);}return _0x3d2ed8;};}function handleError(_0x522dca,_0x558d04){_0x558d04=_0x558d04||0x1f4;return function(_0x10edbf){logger[_0xc193('0x2c')](_0x10edbf[_0xc193('0x2d')]);if(_0x10edbf['name']){delete _0x10edbf[_0xc193('0x2e')];}_0x522dca[_0xc193('0x1e')](_0x558d04)['send'](_0x10edbf);};}exports[_0xc193('0x2f')]=function(_0x16457f,_0x2407c9){var _0x4069a={},_0x2e3dbb={},_0x24d4d2={'count':0x0,'rows':[]};var _0x3debe1=_[_0xc193('0x30')](db[_0xc193('0x31')][_0xc193('0x32')],function(_0x16dd5f){return{'name':_0x16dd5f[_0xc193('0x33')],'type':_0x16dd5f[_0xc193('0x34')][_0xc193('0x35')]};});_0x2e3dbb['model']=_[_0xc193('0x30')](_0x3debe1,_0xc193('0x2e'));_0x2e3dbb['query']=_[_0xc193('0x36')](_0x16457f[_0xc193('0x37')]);_0x2e3dbb['filters']=_[_0xc193('0x38')](_0x2e3dbb[_0xc193('0x39')],_0x2e3dbb[_0xc193('0x37')]);_0x4069a[_0xc193('0x3a')]=_[_0xc193('0x38')](_0x2e3dbb[_0xc193('0x39')],qs[_0xc193('0x3b')](_0x16457f[_0xc193('0x37')][_0xc193('0x3b')]));_0x4069a['attributes']=_0x4069a[_0xc193('0x3a')][_0xc193('0x3c')]?_0x4069a['attributes']:_0x2e3dbb[_0xc193('0x39')];if(!_0x16457f[_0xc193('0x37')][_0xc193('0x3d')](_0xc193('0x3e'))){_0x4069a[_0xc193('0x23')]=qs[_0xc193('0x23')](_0x16457f['query']['limit']);_0x4069a[_0xc193('0x21')]=qs['offset'](_0x16457f['query']['offset']);}_0x4069a[_0xc193('0x3f')]=qs[_0xc193('0x40')](_0x16457f[_0xc193('0x37')][_0xc193('0x40')]);_0x4069a[_0xc193('0x41')]=qs['filters'](_[_0xc193('0x42')](_0x16457f[_0xc193('0x37')],_0x2e3dbb['filters']),_0x3debe1);if(_0x16457f[_0xc193('0x37')][_0xc193('0x43')]){_0x4069a[_0xc193('0x41')]=_[_0xc193('0x44')](_0x4069a[_0xc193('0x41')],{'$or':_['map'](_0x3debe1,function(_0x50401b){if(_0x50401b['type']!==_0xc193('0x45')){var _0x85fea9={};_0x85fea9[_0x50401b[_0xc193('0x2e')]]={'$like':'%'+_0x16457f[_0xc193('0x37')][_0xc193('0x43')]+'%'};return _0x85fea9;}})});}_0x4069a=_['merge']({},_0x4069a,_0x16457f[_0xc193('0x46')]);var _0xcd64a4={'where':_0x4069a[_0xc193('0x41')]};return db['ChatInternalMessage'][_0xc193('0x24')](_0xcd64a4)['then'](function(_0x5f5a54){_0x24d4d2[_0xc193('0x24')]=_0x5f5a54;if(_0x16457f[_0xc193('0x37')][_0xc193('0x47')]){_0x4069a['include']=[{'all':!![]}];}return db[_0xc193('0x31')][_0xc193('0x48')](_0x4069a);})[_0xc193('0x2a')](function(_0x56e592){_0x24d4d2['rows']=_0x56e592;return _0x24d4d2;})[_0xc193('0x2a')](respondWithFilteredResult(_0x2407c9,_0x4069a))[_0xc193('0x49')](handleError(_0x2407c9,null));};exports[_0xc193('0x4a')]=function(_0x3f1a5e,_0x379ad9){var _0x12c489={'raw':!![],'where':{'id':_0x3f1a5e[_0xc193('0x4b')]['id']}},_0x1b1817={};_0x1b1817[_0xc193('0x39')]=_[_0xc193('0x36')](db[_0xc193('0x31')][_0xc193('0x32')]);_0x1b1817[_0xc193('0x37')]=_['keys'](_0x3f1a5e[_0xc193('0x37')]);_0x1b1817[_0xc193('0x4c')]=_['intersection'](_0x1b1817['model'],_0x1b1817[_0xc193('0x37')]);_0x12c489[_0xc193('0x3a')]=_[_0xc193('0x38')](_0x1b1817[_0xc193('0x39')],qs[_0xc193('0x3b')](_0x3f1a5e[_0xc193('0x37')]['fields']));_0x12c489['attributes']=_0x12c489[_0xc193('0x3a')]['length']?_0x12c489['attributes']:_0x1b1817['model'];if(_0x3f1a5e['query'][_0xc193('0x47')]){_0x12c489[_0xc193('0x4d')]=[{'all':!![]}];}_0x12c489=_[_0xc193('0x44')]({},_0x12c489,_0x3f1a5e[_0xc193('0x46')]);return db['ChatInternalMessage']['find'](_0x12c489)[_0xc193('0x2a')](handleEntityNotFound(_0x379ad9,null))['then'](respondWithResult(_0x379ad9,null))[_0xc193('0x49')](handleError(_0x379ad9,null));};exports[_0xc193('0x4e')]=function(_0x4977a7,_0x3dbde7){return db[_0xc193('0x31')]['create'](_0x4977a7['body'],{})['then'](respondWithResult(_0x3dbde7,0xc9))[_0xc193('0x49')](handleError(_0x3dbde7,null));};exports[_0xc193('0x29')]=function(_0x4d8514,_0x129168){if(_0x4d8514[_0xc193('0x4f')]['id']){delete _0x4d8514[_0xc193('0x4f')]['id'];}return db[_0xc193('0x31')][_0xc193('0x50')]({'where':{'id':_0x4d8514[_0xc193('0x4b')]['id']}})[_0xc193('0x2a')](handleEntityNotFound(_0x129168,null))[_0xc193('0x2a')](saveUpdates(_0x4d8514[_0xc193('0x4f')],null))[_0xc193('0x2a')](respondWithResult(_0x129168,null))[_0xc193('0x49')](handleError(_0x129168,null));};exports[_0xc193('0x2b')]=function(_0x54b1ff,_0x309eff){return db[_0xc193('0x31')][_0xc193('0x50')]({'where':{'id':_0x54b1ff[_0xc193('0x4b')]['id']}})[_0xc193('0x2a')](handleEntityNotFound(_0x309eff,null))[_0xc193('0x2a')](removeEntity(_0x309eff,null))[_0xc193('0x49')](handleError(_0x309eff,null));};exports[_0xc193('0x51')]=function(_0x4d4235,_0x3575c3){return db[_0xc193('0x31')][_0xc193('0x51')]()[_0xc193('0x2a')](respondWithResult(_0x3575c3,null))[_0xc193('0x49')](handleError(_0x3575c3,null));};function wrapUser(_0x57d509){return function(_0xf31445){var _0x21e39d=_0x57d509[_0xc193('0x52')]({'plain':!![]});_0x21e39d[_0xc193('0x53')]=[];if(_0xf31445){_0x21e39d[_0xc193('0x54')]=_0xf31445[_0xc193('0x55')];_0x21e39d[_0xc193('0x56')]=_0xf31445;}else{_0x21e39d[_0xc193('0x54')]=moment(0x0)['format'](_0xc193('0x57'));_0x21e39d[_0xc193('0x56')]={};}return _0x21e39d;};}exports[_0xc193('0x58')]=function(_0x524ed4,_0x3b9720,_0x120f99){var _0x59f9d8=[];return db[_0xc193('0x59')]['findAll']({'where':{'role':[_0xc193('0x5a'),_0xc193('0x5b'),_0xc193('0x5c')]},'attributes':['id',_0xc193('0x5d'),_0xc193('0x2e'),_0xc193('0x5e'),_0xc193('0x5f'),'internal','online',_0xc193('0x60'),_0xc193('0x61'),_0xc193('0x62')],'order':qs[_0xc193('0x40')](_0xc193('0x63')),'include':[{'model':db[_0xc193('0x64')],'as':_0xc193('0x65'),'attributes':['id',_0xc193('0x2e'),_0xc193('0x34')],'through':{'attributes':[]}}]})[_0xc193('0x2a')](function(_0x51a661){if(_0x51a661){var _0x19448b=_0x524ed4[_0xc193('0x5c')]['get']({'plain':!![]});if(!_0x19448b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19448b[_0xc193('0x5e')]===_0xc193('0x5c')){return db['UserProfileSection'][_0xc193('0x50')]({'where':{'name':_0xc193('0x66'),'userProfileId':_0x19448b['userProfileId']},'raw':!![]})['then'](function(_0x338cd7){if(_0x338cd7){if(_0x338cd7['autoAssociation']===0x0){return db[_0xc193('0x67')][_0xc193('0x48')]({'where':{'sectionId':_0x338cd7['id']},'raw':!![]})['then'](function(_0xba5505){var _0x19e2fb=[];if(_['isEmpty'](_0xba5505)){_0x19e2fb=_[_0xc193('0x43')](_0x51a661,function(_0x54120a){if(_0x54120a[_0xc193('0x5e')]!==_0xc193('0x5a')){return _0x54120a;}});return _0x19e2fb;}else{for(var _0x1781fa=0x0;_0x1781fa<_0x51a661[_0xc193('0x3c')];_0x1781fa++){var _0xafea8=_0x51a661[_0x1781fa];if(_0xafea8[_0xc193('0x5e')]===_0xc193('0x5a')){var _0x490561=_['find'](_0xba5505,function(_0x3c56de){return _0x3c56de[_0xc193('0x68')]===_0xafea8['id'];});if(_0x490561)_0x19e2fb['push'](_0xafea8);}else{_0x19e2fb[_0xc193('0x69')](_0xafea8);}}return _0x19e2fb;}});}else{return _0x51a661;}}else{var _0x36b717=_['filter'](_0x51a661,function(_0x168fe0){if(_0x168fe0[_0xc193('0x5e')]!=='agent'){return _0x168fe0;}});return _0x36b717;}});}else{return _0x51a661;}}})[_0xc193('0x2a')](function(_0x3c886b){var _0xd6bcb6=[];if(_0x3c886b){_0x59f9d8=_0x3c886b;for(var _0x6d83aa=0x0;_0x6d83aa<_0x3c886b[_0xc193('0x3c')];_0x6d83aa+=0x1){_0x59f9d8[_0x6d83aa][_0xc193('0x53')]=[];_0xd6bcb6['push'](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x524ed4[_0xc193('0x5c')]['id'],_0x3c886b[_0x6d83aa]['id']],'ToId':[_0x524ed4[_0xc193('0x5c')]['id'],_0x3c886b[_0x6d83aa]['id']],'ChatGroupId':null},'attributes':['id',_0xc193('0x55'),_0xc193('0x6a'),_0xc193('0x6b'),'read',_0xc193('0x4f')],'order':qs[_0xc193('0x40')](_0xc193('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3c886b[_0x6d83aa])));}return BPromise[_0xc193('0x6d')](_0xd6bcb6);}return[];})['then'](function(_0x5d61f5){return{'rows':_0x5d61f5,'count':_0x5d61f5[_0xc193('0x3c')]};})['then'](respondWithResult(_0x3b9720,null))['catch'](handleError(_0x3b9720,null));}; \ No newline at end of file +var _0x66bf=['count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','ChatInternalMessage','rows','catch','rawAttributes','find','create','body','params','describe','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','type','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','length','resourceId','push','messages','FromId','ToId','-createdAt','all','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit'];(function(_0x4c6c66,_0x7764f5){var _0x1c7e6b=function(_0x4a60cc){while(--_0x4a60cc){_0x4c6c66['push'](_0x4c6c66['shift']());}};_0x1c7e6b(++_0x7764f5);}(_0x66bf,0x121));var _0xf66b=function(_0x5e6901,_0x5b28e6){_0x5e6901=_0x5e6901-0x0;var _0x46a109=_0x66bf[_0x5e6901];return _0x46a109;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf66b('0x0'));var zipdir=require(_0xf66b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf66b('0x2'));var BPromise=require(_0xf66b('0x3'));var Mustache=require('mustache');var util=require(_0xf66b('0x4'));var path=require(_0xf66b('0x5'));var sox=require(_0xf66b('0x6'));var csv=require('to-csv');var ejs=require(_0xf66b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf66b('0x8'));var squel=require(_0xf66b('0x9'));var crypto=require(_0xf66b('0xa'));var jsforce=require(_0xf66b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf66b('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf66b('0xd'));var as=require(_0xf66b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf66b('0xf'));var utils=require(_0xf66b('0x10'));var config=require(_0xf66b('0x11'));var licenseUtil=require(_0xf66b('0x12'));var db=require(_0xf66b('0x13'))['db'];config[_0xf66b('0x14')]=_[_0xf66b('0x15')](config['redis'],{'host':_0xf66b('0x16'),'port':0x18eb});var socket=require(_0xf66b('0x17'))(new Redis(config[_0xf66b('0x14')]));require(_0xf66b('0x18'))[_0xf66b('0x19')](socket);function respondWithStatusCode(_0x5dafd7,_0x49b3c2){_0x49b3c2=_0x49b3c2||0xcc;return function(_0x5b4689){if(_0x5b4689){return _0x5dafd7[_0xf66b('0x1a')](_0x49b3c2);}return _0x5dafd7[_0xf66b('0x1b')](_0x49b3c2)['end']();};}function respondWithResult(_0x12b4bc,_0x2f21ce){_0x2f21ce=_0x2f21ce||0xc8;return function(_0x5e9a99){if(_0x5e9a99){return _0x12b4bc[_0xf66b('0x1b')](_0x2f21ce)[_0xf66b('0x1c')](_0x5e9a99);}};}function respondWithFilteredResult(_0x148cb2,_0x2099a2){return function(_0x24be14){if(_0x24be14){var _0x48623b=typeof _0x2099a2[_0xf66b('0x1d')]===_0xf66b('0x1e')&&typeof _0x2099a2[_0xf66b('0x1f')]===_0xf66b('0x1e');var _0x2d2b64=_0x24be14[_0xf66b('0x20')];var _0x51d078=_0x48623b?0x0:_0x2099a2['offset'];var _0x5869dd=_0x48623b?_0x24be14[_0xf66b('0x20')]:_0x2099a2[_0xf66b('0x1d')]+_0x2099a2['limit'];var _0x344f4e;if(_0x5869dd>=_0x2d2b64){_0x5869dd=_0x2d2b64;_0x344f4e=0xc8;}else{_0x344f4e=0xce;}_0x148cb2['status'](_0x344f4e);return _0x148cb2[_0xf66b('0x21')](_0xf66b('0x22'),_0x51d078+'-'+_0x5869dd+'/'+_0x2d2b64)['json'](_0x24be14);}return null;};}function patchUpdates(_0x3243c6){return function(_0x190616){try{jsonpatch[_0xf66b('0x23')](_0x190616,_0x3243c6,!![]);}catch(_0x700063){return BPromise[_0xf66b('0x24')](_0x700063);}return _0x190616[_0xf66b('0x25')]();};}function saveUpdates(_0x1a27c4,_0x15dcd1){return function(_0x205368){if(_0x205368){return _0x205368['update'](_0x1a27c4)['then'](function(_0x13e0f1){return _0x13e0f1;});}return null;};}function removeEntity(_0x2f816d,_0x38d3ee){return function(_0x4936a6){if(_0x4936a6){return _0x4936a6[_0xf66b('0x26')]()[_0xf66b('0x27')](function(){_0x2f816d[_0xf66b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54b2c7,_0x5834c1){return function(_0x380255){if(!_0x380255){_0x54b2c7['sendStatus'](0x194);}return _0x380255;};}function handleError(_0xf813c0,_0xb25798){_0xb25798=_0xb25798||0x1f4;return function(_0x19584a){logger[_0xf66b('0x28')](_0x19584a[_0xf66b('0x29')]);if(_0x19584a[_0xf66b('0x2a')]){delete _0x19584a[_0xf66b('0x2a')];}_0xf813c0['status'](_0xb25798)[_0xf66b('0x2b')](_0x19584a);};}exports[_0xf66b('0x2c')]=function(_0x157363,_0x4affe6){var _0x3aeb57={},_0x456c1a={},_0x3dfb7a={'count':0x0,'rows':[]};var _0xf92eee=_[_0xf66b('0x2d')](db['ChatInternalMessage']['rawAttributes'],function(_0x5c7517){return{'name':_0x5c7517[_0xf66b('0x2e')],'type':_0x5c7517['type'][_0xf66b('0x2f')]};});_0x456c1a[_0xf66b('0x30')]=_['map'](_0xf92eee,_0xf66b('0x2a'));_0x456c1a[_0xf66b('0x31')]=_[_0xf66b('0x32')](_0x157363[_0xf66b('0x31')]);_0x456c1a[_0xf66b('0x33')]=_[_0xf66b('0x34')](_0x456c1a[_0xf66b('0x30')],_0x456c1a[_0xf66b('0x31')]);_0x3aeb57[_0xf66b('0x35')]=_[_0xf66b('0x34')](_0x456c1a['model'],qs[_0xf66b('0x36')](_0x157363['query'][_0xf66b('0x36')]));_0x3aeb57[_0xf66b('0x35')]=_0x3aeb57['attributes']['length']?_0x3aeb57[_0xf66b('0x35')]:_0x456c1a[_0xf66b('0x30')];if(!_0x157363[_0xf66b('0x31')][_0xf66b('0x37')](_0xf66b('0x38'))){_0x3aeb57[_0xf66b('0x1f')]=qs[_0xf66b('0x1f')](_0x157363[_0xf66b('0x31')][_0xf66b('0x1f')]);_0x3aeb57[_0xf66b('0x1d')]=qs['offset'](_0x157363[_0xf66b('0x31')]['offset']);}_0x3aeb57['order']=qs['sort'](_0x157363[_0xf66b('0x31')][_0xf66b('0x39')]);_0x3aeb57[_0xf66b('0x3a')]=qs[_0xf66b('0x33')](_['pick'](_0x157363['query'],_0x456c1a[_0xf66b('0x33')]),_0xf92eee);if(_0x157363[_0xf66b('0x31')]['filter']){_0x3aeb57[_0xf66b('0x3a')]=_[_0xf66b('0x3b')](_0x3aeb57[_0xf66b('0x3a')],{'$or':_['map'](_0xf92eee,function(_0x4b39a3){if(_0x4b39a3['type']!=='VIRTUAL'){var _0x2cefb8={};_0x2cefb8[_0x4b39a3[_0xf66b('0x2a')]]={'$like':'%'+_0x157363[_0xf66b('0x31')][_0xf66b('0x3c')]+'%'};return _0x2cefb8;}})});}_0x3aeb57=_[_0xf66b('0x3b')]({},_0x3aeb57,_0x157363[_0xf66b('0x3d')]);var _0x1b57e6={'where':_0x3aeb57['where']};return db['ChatInternalMessage'][_0xf66b('0x20')](_0x1b57e6)[_0xf66b('0x27')](function(_0x3a5530){_0x3dfb7a[_0xf66b('0x20')]=_0x3a5530;if(_0x157363['query'][_0xf66b('0x3e')]){_0x3aeb57[_0xf66b('0x3f')]=[{'all':!![]}];}return db[_0xf66b('0x40')]['findAll'](_0x3aeb57);})[_0xf66b('0x27')](function(_0x1ee692){_0x3dfb7a[_0xf66b('0x41')]=_0x1ee692;return _0x3dfb7a;})[_0xf66b('0x27')](respondWithFilteredResult(_0x4affe6,_0x3aeb57))[_0xf66b('0x42')](handleError(_0x4affe6,null));};exports['show']=function(_0x20194f,_0x52f4bf){var _0x1f0d9a={'raw':!![],'where':{'id':_0x20194f['params']['id']}},_0x295bc1={};_0x295bc1[_0xf66b('0x30')]=_[_0xf66b('0x32')](db[_0xf66b('0x40')][_0xf66b('0x43')]);_0x295bc1[_0xf66b('0x31')]=_[_0xf66b('0x32')](_0x20194f[_0xf66b('0x31')]);_0x295bc1[_0xf66b('0x33')]=_['intersection'](_0x295bc1['model'],_0x295bc1[_0xf66b('0x31')]);_0x1f0d9a[_0xf66b('0x35')]=_[_0xf66b('0x34')](_0x295bc1['model'],qs['fields'](_0x20194f['query']['fields']));_0x1f0d9a[_0xf66b('0x35')]=_0x1f0d9a[_0xf66b('0x35')]['length']?_0x1f0d9a[_0xf66b('0x35')]:_0x295bc1[_0xf66b('0x30')];if(_0x20194f[_0xf66b('0x31')][_0xf66b('0x3e')]){_0x1f0d9a['include']=[{'all':!![]}];}_0x1f0d9a=_[_0xf66b('0x3b')]({},_0x1f0d9a,_0x20194f['options']);return db[_0xf66b('0x40')][_0xf66b('0x44')](_0x1f0d9a)[_0xf66b('0x27')](handleEntityNotFound(_0x52f4bf,null))[_0xf66b('0x27')](respondWithResult(_0x52f4bf,null))['catch'](handleError(_0x52f4bf,null));};exports['create']=function(_0x474efc,_0x48d9f5){return db['ChatInternalMessage'][_0xf66b('0x45')](_0x474efc[_0xf66b('0x46')],{})['then'](respondWithResult(_0x48d9f5,0xc9))[_0xf66b('0x42')](handleError(_0x48d9f5,null));};exports['update']=function(_0x5d504a,_0x595c7c){if(_0x5d504a[_0xf66b('0x46')]['id']){delete _0x5d504a[_0xf66b('0x46')]['id'];}return db[_0xf66b('0x40')][_0xf66b('0x44')]({'where':{'id':_0x5d504a['params']['id']}})[_0xf66b('0x27')](handleEntityNotFound(_0x595c7c,null))[_0xf66b('0x27')](saveUpdates(_0x5d504a[_0xf66b('0x46')],null))[_0xf66b('0x27')](respondWithResult(_0x595c7c,null))['catch'](handleError(_0x595c7c,null));};exports['destroy']=function(_0x175829,_0x685f88){return db[_0xf66b('0x40')]['find']({'where':{'id':_0x175829[_0xf66b('0x47')]['id']}})[_0xf66b('0x27')](handleEntityNotFound(_0x685f88,null))[_0xf66b('0x27')](removeEntity(_0x685f88,null))[_0xf66b('0x42')](handleError(_0x685f88,null));};exports[_0xf66b('0x48')]=function(_0xff9a4f,_0x1540f1){return db[_0xf66b('0x40')][_0xf66b('0x48')]()['then'](respondWithResult(_0x1540f1,null))[_0xf66b('0x42')](handleError(_0x1540f1,null));};function wrapUser(_0x278d5c){return function(_0x2b1da3){var _0x20cf34=_0x278d5c['get']({'plain':!![]});_0x20cf34['messages']=[];if(_0x2b1da3){_0x20cf34[_0xf66b('0x49')]=_0x2b1da3[_0xf66b('0x4a')];_0x20cf34[_0xf66b('0x4b')]=_0x2b1da3;}else{_0x20cf34[_0xf66b('0x49')]=moment(0x0)[_0xf66b('0x4c')](_0xf66b('0x4d'));_0x20cf34[_0xf66b('0x4b')]={};}return _0x20cf34;};}exports[_0xf66b('0x4e')]=function(_0x3965f5,_0xd6f009,_0x431570){var _0x41006d=[];return db[_0xf66b('0x4f')]['findAll']({'where':{'role':[_0xf66b('0x50'),_0xf66b('0x51'),_0xf66b('0x52')]},'attributes':['id',_0xf66b('0x53'),_0xf66b('0x2a'),_0xf66b('0x54'),_0xf66b('0x55'),_0xf66b('0x56'),_0xf66b('0x57'),_0xf66b('0x58'),_0xf66b('0x59'),'showWebBar'],'order':qs[_0xf66b('0x39')](_0xf66b('0x5a')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0xf66b('0x2a'),_0xf66b('0x5b')],'through':{'attributes':[]}}]})[_0xf66b('0x27')](function(_0x5b1758){if(_0x5b1758){var _0x550219=_0x3965f5[_0xf66b('0x52')][_0xf66b('0x5c')]({'plain':!![]});if(!_0x550219)throw new Error(_0xf66b('0x5d'));if(_0x550219['role']===_0xf66b('0x52')){return db[_0xf66b('0x5e')][_0xf66b('0x44')]({'where':{'name':_0xf66b('0x5f'),'userProfileId':_0x550219[_0xf66b('0x60')]},'raw':!![]})[_0xf66b('0x27')](function(_0x445b40){if(_0x445b40){if(_0x445b40['autoAssociation']===0x0){return db[_0xf66b('0x61')]['findAll']({'where':{'sectionId':_0x445b40['id']},'raw':!![]})[_0xf66b('0x27')](function(_0x5894c5){var _0x538aa9=[];if(_[_0xf66b('0x62')](_0x5894c5)){_0x538aa9=_[_0xf66b('0x3c')](_0x5b1758,function(_0x4a20c5){if(_0x4a20c5['role']!==_0xf66b('0x50')){return _0x4a20c5;}});return _0x538aa9;}else{for(var _0x37a78c=0x0;_0x37a78c<_0x5b1758[_0xf66b('0x63')];_0x37a78c++){var _0x535977=_0x5b1758[_0x37a78c];if(_0x535977['role']===_0xf66b('0x50')){var _0x46ccf4=_[_0xf66b('0x44')](_0x5894c5,function(_0x2dbed1){return _0x2dbed1[_0xf66b('0x64')]===_0x535977['id'];});if(_0x46ccf4)_0x538aa9[_0xf66b('0x65')](_0x535977);}else{_0x538aa9[_0xf66b('0x65')](_0x535977);}}return _0x538aa9;}});}else{return _0x5b1758;}}else{var _0x3ce6ff=_[_0xf66b('0x3c')](_0x5b1758,function(_0x1c7c15){if(_0x1c7c15[_0xf66b('0x54')]!=='agent'){return _0x1c7c15;}});return _0x3ce6ff;}});}else{return _0x5b1758;}}})[_0xf66b('0x27')](function(_0x290e1e){var _0x34dd62=[];if(_0x290e1e){_0x41006d=_0x290e1e;for(var _0x4c1107=0x0;_0x4c1107<_0x290e1e[_0xf66b('0x63')];_0x4c1107+=0x1){_0x41006d[_0x4c1107][_0xf66b('0x66')]=[];_0x34dd62[_0xf66b('0x65')](db['ChatInternalMessage'][_0xf66b('0x44')]({'where':{'FromId':[_0x3965f5[_0xf66b('0x52')]['id'],_0x290e1e[_0x4c1107]['id']],'ToId':[_0x3965f5[_0xf66b('0x52')]['id'],_0x290e1e[_0x4c1107]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xf66b('0x67'),_0xf66b('0x68'),'read',_0xf66b('0x46')],'order':qs[_0xf66b('0x39')](_0xf66b('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf66b('0x27')](wrapUser(_0x290e1e[_0x4c1107])));}return BPromise[_0xf66b('0x6a')](_0x34dd62);}return[];})[_0xf66b('0x27')](function(_0x542ec6){return{'rows':_0x542ec6,'count':_0x542ec6[_0xf66b('0x63')]};})[_0xf66b('0x27')](respondWithResult(_0xd6f009,null))[_0xf66b('0x42')](handleError(_0xd6f009,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index fd12ef8..91061cd 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 _0x894b=['../../mysqldb','ChatInternalMessage','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x894b,0x104));var _0xb894=function(_0x3808b5,_0x5907a0){_0x3808b5=_0x3808b5-0x0;var _0x352c3d=_0x894b[_0x3808b5];return _0x352c3d;};'use strict';var EventEmitter=require(_0xb894('0x0'));var ChatInternalMessage=require(_0xb894('0x1'))['db'][_0xb894('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb894('0x3'),'afterUpdate':'update','afterDestroy':_0xb894('0x4')};function emitEvent(_0x395c60){return function(_0x17bb70,_0x4c9aee,_0x209205){ChatInternalMessageEvents[_0xb894('0x5')](_0x395c60+':'+_0x17bb70['id'],_0x17bb70);ChatInternalMessageEvents['emit'](_0x395c60,_0x17bb70);_0x209205(null);};}for(var e in events){if(events[_0xb894('0x6')](e)){var event=events[e];ChatInternalMessage[_0xb894('0x7')](e,emitEvent(event));}}module[_0xb894('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xa82c=['hasOwnProperty','hook','exports','events','ChatInternalMessage','setMaxListeners','save','remove','emit'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0xa82c,0x16b));var _0xca82=function(_0x3741f0,_0x5c8d89){_0x3741f0=_0x3741f0-0x0;var _0x591247=_0xa82c[_0x3741f0];return _0x591247;};'use strict';var EventEmitter=require(_0xca82('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xca82('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xca82('0x2')](0x0);var events={'afterCreate':_0xca82('0x3'),'afterUpdate':'update','afterDestroy':_0xca82('0x4')};function emitEvent(_0x455d33){return function(_0x4ef537,_0x3bdd67,_0x54a25f){ChatInternalMessageEvents['emit'](_0x455d33+':'+_0x4ef537['id'],_0x4ef537);ChatInternalMessageEvents[_0xca82('0x5')](_0x455d33,_0x4ef537);_0x54a25f(null);};}for(var e in events){if(events[_0xca82('0x6')](e)){var event=events[e];ChatInternalMessage[_0xca82('0x7')](e,emitEvent(event));}}module[_0xca82('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 1aadacf..1fbd7f7 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 _0x16a8=['exports','define','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x2aeb4b,_0x29d79d){var _0x16138d=function(_0xab860f){while(--_0xab860f){_0x2aeb4b['push'](_0x2aeb4b['shift']());}};_0x16138d(++_0x29d79d);}(_0x16a8,0x9e));var _0x816a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x16a8[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x816a('0x0'));var util=require(_0x816a('0x1'));var logger=require(_0x816a('0x2'))(_0x816a('0x3'));var moment=require('moment');var BPromise=require(_0x816a('0x4'));var rp=require(_0x816a('0x5'));var fs=require('fs');var path=require(_0x816a('0x6'));var rimraf=require(_0x816a('0x7'));var config=require(_0x816a('0x8'));var attributes=require(_0x816a('0x9'));module[_0x816a('0xa')]=function(_0x41f489,_0x57e3e7){return _0x41f489[_0x816a('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x816a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x816a('0xd')});}; \ No newline at end of file +var _0x47c5=['./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x44abe7,_0x14879e){var _0x13b01a=function(_0x10b615){while(--_0x10b615){_0x44abe7['push'](_0x44abe7['shift']());}};_0x13b01a(++_0x14879e);}(_0x47c5,0xf5));var _0x547c=function(_0x13ee11,_0x129ca5){_0x13ee11=_0x13ee11-0x0;var _0xfe3915=_0x47c5[_0x13ee11];return _0xfe3915;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x547c('0x0'))(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x547c('0x5'));var config=require(_0x547c('0x6'));var attributes=require(_0x547c('0x7'));module[_0x547c('0x8')]=function(_0x174bf6,_0x75d2ff){return _0x174bf6[_0x547c('0x9')](_0x547c('0xa'),attributes,{'tableName':_0x547c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x547c('0xc'),'collate':_0x547c('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3c08ff1..741f60e 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 _0x0baf=['rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x136cf2,_0xef8751){var _0x33f719=function(_0x5ac1af){while(--_0x5ac1af){_0x136cf2['push'](_0x136cf2['shift']());}};_0x33f719(++_0xef8751);}(_0x0baf,0x73));var _0xf0ba=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x0baf[_0x5e709a];return _0x57401a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf0ba('0x0'));var BPromise=require('bluebird');var rs=require(_0xf0ba('0x1'));var fs=require('fs');var Redis=require(_0xf0ba('0x2'));var db=require(_0xf0ba('0x3'))['db'];var utils=require(_0xf0ba('0x4'));var logger=require('../../config/logger')(_0xf0ba('0x5'));var config=require(_0xf0ba('0x6'));var jayson=require(_0xf0ba('0x7'));var client=jayson[_0xf0ba('0x8')]['http']({'port':0x232a});config['redis']=_[_0xf0ba('0x9')](config[_0xf0ba('0xa')],{'host':_0xf0ba('0xb'),'port':0x18eb});var socket=require(_0xf0ba('0xc'))(new Redis(config[_0xf0ba('0xa')]));require(_0xf0ba('0xd'))[_0xf0ba('0xe')](socket);function respondWithRpcPromise(_0x49fd08,_0x530204,_0x20dfa0){return new BPromise(function(_0x390740,_0x6a930b){return client[_0xf0ba('0xf')](_0x49fd08,_0x20dfa0)[_0xf0ba('0x10')](function(_0x4e5658){logger[_0xf0ba('0x11')](_0xf0ba('0x12'),_0x530204,_0xf0ba('0x13'));logger['debug'](_0xf0ba('0x14'),_0x530204,_0xf0ba('0x13'),JSON['stringify'](_0x4e5658));if(_0x4e5658[_0xf0ba('0x15')]){if(_0x4e5658['error']['code']===0x1f4){logger[_0xf0ba('0x15')](_0xf0ba('0x12'),_0x530204,_0x4e5658[_0xf0ba('0x15')][_0xf0ba('0x16')]);return _0x6a930b(_0x4e5658[_0xf0ba('0x15')][_0xf0ba('0x16')]);}logger[_0xf0ba('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x530204,_0x4e5658['error']['message']);return _0x390740(_0x4e5658['error'][_0xf0ba('0x16')]);}else{logger[_0xf0ba('0x11')](_0xf0ba('0x12'),_0x530204,'request\x20sent');_0x390740(_0x4e5658['result'][_0xf0ba('0x16')]);}})[_0xf0ba('0x17')](function(_0x394cd0){logger['error'](_0xf0ba('0x12'),_0x530204,_0x394cd0);_0x6a930b(_0x394cd0);});});} \ No newline at end of file +var _0x7610=['code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x312cdc,_0x5468d2){var _0x908678=function(_0x51c699){while(--_0x51c699){_0x312cdc['push'](_0x312cdc['shift']());}};_0x908678(++_0x5468d2);}(_0x7610,0x123));var _0x0761=function(_0x16adb1,_0x12ab49){_0x16adb1=_0x16adb1-0x0;var _0x4e6dec=_0x7610[_0x16adb1];return _0x4e6dec;};'use strict';var _=require(_0x0761('0x0'));var util=require(_0x0761('0x1'));var moment=require(_0x0761('0x2'));var BPromise=require(_0x0761('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0761('0x4'))['db'];var utils=require(_0x0761('0x5'));var logger=require('../../config/logger')(_0x0761('0x6'));var config=require(_0x0761('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0761('0x8')]['http']({'port':0x232a});config[_0x0761('0x9')]=_[_0x0761('0xa')](config['redis'],{'host':_0x0761('0xb'),'port':0x18eb});var socket=require(_0x0761('0xc'))(new Redis(config[_0x0761('0x9')]));require('./chatInternalMessage.socket')[_0x0761('0xd')](socket);function respondWithRpcPromise(_0x527e5e,_0x51ea13,_0x19b98c){return new BPromise(function(_0x14f021,_0x4fd8ed){return client[_0x0761('0xe')](_0x527e5e,_0x19b98c)['then'](function(_0x2b2d34){logger[_0x0761('0xf')](_0x0761('0x10'),_0x51ea13,_0x0761('0x11'));logger['debug'](_0x0761('0x12'),_0x51ea13,'request\x20sent',JSON[_0x0761('0x13')](_0x2b2d34));if(_0x2b2d34[_0x0761('0x14')]){if(_0x2b2d34[_0x0761('0x14')][_0x0761('0x15')]===0x1f4){logger[_0x0761('0x14')](_0x0761('0x10'),_0x51ea13,_0x2b2d34['error']['message']);return _0x4fd8ed(_0x2b2d34[_0x0761('0x14')][_0x0761('0x16')]);}logger['error'](_0x0761('0x10'),_0x51ea13,_0x2b2d34[_0x0761('0x14')][_0x0761('0x16')]);return _0x14f021(_0x2b2d34[_0x0761('0x14')][_0x0761('0x16')]);}else{logger[_0x0761('0xf')](_0x0761('0x10'),_0x51ea13,_0x0761('0x11'));_0x14f021(_0x2b2d34[_0x0761('0x17')]['message']);}})['catch'](function(_0x1273b5){logger[_0x0761('0x14')](_0x0761('0x10'),_0x51ea13,_0x1273b5);_0x4fd8ed(_0x1273b5);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4398aba..85d42a3 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 _0xa5e1=['./chatInternalMessage.events','save','remove','update','emit'];(function(_0x510e73,_0x44b617){var _0x54a077=function(_0x467b7c){while(--_0x467b7c){_0x510e73['push'](_0x510e73['shift']());}};_0x54a077(++_0x44b617);}(_0xa5e1,0xb4));var _0x1a5e=function(_0x2e0763,_0x37e6e4){_0x2e0763=_0x2e0763-0x0;var _0x189643=_0xa5e1[_0x2e0763];return _0x189643;};'use strict';var ChatInternalMessageEvents=require(_0x1a5e('0x0'));var events=[_0x1a5e('0x1'),_0x1a5e('0x2'),_0x1a5e('0x3')];function createListener(_0x1b783f,_0x4eca4f){return function(_0x27ede1){_0x4eca4f[_0x1a5e('0x4')](_0x1b783f,_0x27ede1);};}function removeListener(_0xab19e8,_0x5ed082){return function(){ChatInternalMessageEvents['removeListener'](_0xab19e8,_0x5ed082);};}exports['register']=function(_0x2aa967){for(var _0x84270e=0x0,_0x33beaa=events['length'];_0x84270e<_0x33beaa;_0x84270e++){var _0x2b3a24=events[_0x84270e];var _0x3d78b0=createListener('chatInternalMessage:'+_0x2b3a24,_0x2aa967);ChatInternalMessageEvents['on'](_0x2b3a24,_0x3d78b0);}}; \ No newline at end of file +var _0xc8df=['register','length','save','remove','update','emit'];(function(_0x2ba740,_0x62a305){var _0x358bda=function(_0x16cc07){while(--_0x16cc07){_0x2ba740['push'](_0x2ba740['shift']());}};_0x358bda(++_0x62a305);}(_0xc8df,0xb0));var _0xfc8d=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xc8df[_0x45783c];return _0x1161da;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xfc8d('0x0'),_0xfc8d('0x1'),_0xfc8d('0x2')];function createListener(_0x3f4159,_0x9df48d){return function(_0x536825){_0x9df48d[_0xfc8d('0x3')](_0x3f4159,_0x536825);};}function removeListener(_0x2f88d0,_0x2b6909){return function(){ChatInternalMessageEvents['removeListener'](_0x2f88d0,_0x2b6909);};}exports[_0xfc8d('0x4')]=function(_0x5b785d){for(var _0x3fada6=0x0,_0x20157c=events[_0xfc8d('0x5')];_0x3fada6<_0x20157c;_0x3fada6++){var _0x4b0c02=events[_0x3fada6];var _0x1514bc=createListener('chatInternalMessage:'+_0x4b0c02,_0x5b785d);ChatInternalMessageEvents['on'](_0x4b0c02,_0x1514bc);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 5117ff7..7f084a1 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 _0x392e=['update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','getUsers','/:id','show','post','create','put'];(function(_0x28aa42,_0x1db5dc){var _0x1a540b=function(_0x2a0c48){while(--_0x2a0c48){_0x28aa42['push'](_0x28aa42['shift']());}};_0x1a540b(++_0x1db5dc);}(_0x392e,0xeb));var _0xe392=function(_0x53659d,_0x2ff6a5){_0x53659d=_0x53659d-0x0;var _0x2d9165=_0x392e[_0x53659d];return _0x2d9165;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe392('0x0'));var express=require(_0xe392('0x1'));var router=express[_0xe392('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe392('0x3'));var interaction=require(_0xe392('0x4'));var config=require('../../config/environment');var controller=require(_0xe392('0x5'));router[_0xe392('0x6')]('/',auth[_0xe392('0x7')](),controller[_0xe392('0x8')]);router[_0xe392('0x6')](_0xe392('0x9'),auth[_0xe392('0x7')](),controller[_0xe392('0xa')]);router['get']('/users',auth[_0xe392('0x7')](),controller[_0xe392('0xb')]);router[_0xe392('0x6')](_0xe392('0xc'),auth[_0xe392('0x7')](),controller[_0xe392('0xd')]);router[_0xe392('0xe')]('/',auth[_0xe392('0x7')](),controller[_0xe392('0xf')]);router[_0xe392('0x10')](_0xe392('0xc'),controller[_0xe392('0x11')]);router[_0xe392('0x12')](_0xe392('0xc'),auth[_0xe392('0x7')](),controller[_0xe392('0x13')]);module[_0xe392('0x14')]=router; \ No newline at end of file +var _0x7efa=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show','post','create','delete','util'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7efa,0x103));var _0xa7ef=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7efa[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require('multer');var util=require(_0xa7ef('0x0'));var path=require(_0xa7ef('0x1'));var timeout=require(_0xa7ef('0x2'));var express=require(_0xa7ef('0x3'));var router=express[_0xa7ef('0x4')]();var fs_extra=require(_0xa7ef('0x5'));var auth=require(_0xa7ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa7ef('0x7'));var controller=require(_0xa7ef('0x8'));router[_0xa7ef('0x9')]('/',auth[_0xa7ef('0xa')](),controller[_0xa7ef('0xb')]);router[_0xa7ef('0x9')]('/describe',auth[_0xa7ef('0xa')](),controller[_0xa7ef('0xc')]);router['get'](_0xa7ef('0xd'),auth[_0xa7ef('0xa')](),controller[_0xa7ef('0xe')]);router[_0xa7ef('0x9')](_0xa7ef('0xf'),auth[_0xa7ef('0xa')](),controller[_0xa7ef('0x10')]);router[_0xa7ef('0x11')]('/',auth['isAuthenticated'](),controller[_0xa7ef('0x12')]);router['put'](_0xa7ef('0xf'),controller['update']);router[_0xa7ef('0x13')]('/:id',auth[_0xa7ef('0xa')](),controller['destroy']);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 c3e309d..1e138f4 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 _0x8eba=['exports','BOOLEAN','ENUM','out','STRING','TEXT','sequelize'];(function(_0x7fbe13,_0x444d90){var _0x1d6cf1=function(_0x1f32ec){while(--_0x1f32ec){_0x7fbe13['push'](_0x7fbe13['shift']());}};_0x1d6cf1(++_0x444d90);}(_0x8eba,0xc3));var _0xa8eb=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x8eba[_0x323d87];return _0x5e8f74;};'use strict';var Sequelize=require(_0xa8eb('0x0'));module[_0xa8eb('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa8eb('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa8eb('0x3')]('in',_0xa8eb('0x4')),'defaultValue':_0xa8eb('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa8eb('0x5')]},'providerResponse':{'type':Sequelize[_0xa8eb('0x6')]}}; \ No newline at end of file +var _0xb91a=['medium','BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0xb91a,0xe5));var _0xab91=function(_0x182c7c,_0x355a06){_0x182c7c=_0x182c7c-0x0;var _0x3ad022=_0xb91a[_0x182c7c];return _0x3ad022;};'use strict';var Sequelize=require('sequelize');module[_0xab91('0x0')]={'body':{'type':Sequelize[_0xab91('0x1')](_0xab91('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xab91('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xab91('0x4')]('in',_0xab91('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xab91('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6f57f0a..f7e432d 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 _0xe956=['redis','localhost','socket.io-emitter','jayson/promise','client','http','../../config/logger','chat-interactions','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','limit','count','offset','set','Content-Range','json','then','destroy','end','sendStatus','stack','name','send','map','ChatMessage','rawAttributes','fieldName','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','fields','include','create','body','update','find','describe','accept','chat','acceptMessage','reject','UserId','user','agent','get','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','parse','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0xe956,0xc4));var _0x6e95=function(_0x20ea6d,_0x154e66){_0x20ea6d=_0x20ea6d-0x0;var _0xe492ba=_0xe956[_0x20ea6d];return _0xe492ba;};'use strict';var util=require(_0x6e95('0x0'));var _=require(_0x6e95('0x1'));var Redis=require(_0x6e95('0x2'));var interactionService=require(_0x6e95('0x3'));var qs=require(_0x6e95('0x4'));var logger=require('../../config/logger')(_0x6e95('0x5'));var config=require(_0x6e95('0x6'));var db=require(_0x6e95('0x7'))['db'];config[_0x6e95('0x8')]=_['defaults'](config['redis'],{'host':_0x6e95('0x9'),'port':0x18eb});var socket=require(_0x6e95('0xa'))(new Redis(config[_0x6e95('0x8')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x6e95('0xb'));var client=jayson[_0x6e95('0xc')][_0x6e95('0xd')]({'port':0x232c});var client9002=jayson['client'][_0x6e95('0xd')]({'port':0x232a});var interaction_log=require(_0x6e95('0xe'))(_0x6e95('0xf'));function respondWithRpcPromise(_0x3a3460,_0xcd3d28,_0x61e789,_0x16bd53){return new Promise(function(_0x477b88,_0x142d76){var _0x35f990=_0x16bd53||client;return _0x35f990[_0x6e95('0x10')](_0x3a3460,_0x61e789)['then'](function(_0xc1bfdf){logger[_0x6e95('0x11')](_0x6e95('0x12'),_0xcd3d28,_0x6e95('0x13'));logger['debug'](_0x6e95('0x14'),_0xcd3d28,_0x6e95('0x13'),JSON[_0x6e95('0x15')](_0xc1bfdf));if(_0xc1bfdf[_0x6e95('0x16')]){if(_0xc1bfdf['error'][_0x6e95('0x17')]===0x1f4){logger[_0x6e95('0x16')]('ChatMessage,\x20%s,\x20%s',_0xcd3d28,_0xc1bfdf[_0x6e95('0x16')][_0x6e95('0x18')]);return _0x142d76(_0xc1bfdf['error'][_0x6e95('0x18')]);}logger[_0x6e95('0x16')](_0x6e95('0x12'),_0xcd3d28,_0xc1bfdf['error'][_0x6e95('0x18')]);return _0x477b88(_0xc1bfdf[_0x6e95('0x16')][_0x6e95('0x18')]);}else{logger[_0x6e95('0x11')](_0x6e95('0x12'),_0xcd3d28,'request\x20sent');_0x477b88(_0xc1bfdf['result'][_0x6e95('0x18')]);}})['catch'](function(_0x114635){logger[_0x6e95('0x16')](_0x6e95('0x12'),_0xcd3d28,_0x114635);_0x142d76(_0x114635);});});}function respondWithResult(_0x431ec3,_0x1e6276){_0x1e6276=_0x1e6276||0xc8;return function(_0x133075){if(_0x133075){return _0x431ec3[_0x6e95('0x19')](_0x1e6276)['json'](_0x133075);}};}function respondWithFilteredResult(_0x3843a1,_0x3901f0){return function(_0x1f96fb){if(_0x1f96fb){var _0x2699ff=typeof _0x3901f0['offset']==='undefined'&&typeof _0x3901f0[_0x6e95('0x1a')]==='undefined';var _0x221ede=_0x1f96fb[_0x6e95('0x1b')];var _0x3ceadd=_0x2699ff?0x0:_0x3901f0[_0x6e95('0x1c')];var _0x314d1a=_0x2699ff?_0x1f96fb[_0x6e95('0x1b')]:_0x3901f0[_0x6e95('0x1c')]+_0x3901f0[_0x6e95('0x1a')];var _0x31386b;if(_0x314d1a>=_0x221ede){_0x314d1a=_0x221ede;_0x31386b=0xc8;}else{_0x31386b=0xce;}_0x3843a1['status'](_0x31386b);return _0x3843a1[_0x6e95('0x1d')](_0x6e95('0x1e'),_0x3ceadd+'-'+_0x314d1a+'/'+_0x221ede)[_0x6e95('0x1f')](_0x1f96fb);}return null;};}function saveUpdates(_0x3cd549){return function(_0x468398){if(_0x468398){return _0x468398['update'](_0x3cd549)[_0x6e95('0x20')](function(_0x45cea1){return _0x45cea1;});}return null;};}function removeEntity(_0x5c8c7f){return function(_0x660d94){if(_0x660d94){return _0x660d94[_0x6e95('0x21')]()['then'](function(){_0x5c8c7f[_0x6e95('0x19')](0xcc)[_0x6e95('0x22')]();});}};}function handleEntityNotFound(_0x919b37){return function(_0xe46659){if(!_0xe46659){_0x919b37[_0x6e95('0x23')](0x194);}return _0xe46659;};}function handleError(_0x5be8bd,_0x3fa390){_0x3fa390=_0x3fa390||0x1f4;return function(_0x591b51){logger[_0x6e95('0x16')](_0x591b51[_0x6e95('0x24')]);if(_0x591b51[_0x6e95('0x25')]){delete _0x591b51[_0x6e95('0x25')];}_0x5be8bd['status'](_0x3fa390)[_0x6e95('0x26')](_0x591b51);};}exports['index']=function(_0x4506cd,_0x2c7559){var _0x5265ca={},_0x427f7e={},_0x24ba8f={'count':0x0,'rows':[]};var _0x43ea07=_[_0x6e95('0x27')](db[_0x6e95('0x28')][_0x6e95('0x29')],function(_0x568b5a){return{'name':_0x568b5a[_0x6e95('0x2a')],'type':_0x568b5a['type']['key']};});_0x427f7e[_0x6e95('0x2b')]=_['map'](_0x43ea07,_0x6e95('0x25'));_0x427f7e[_0x6e95('0x2c')]=_['keys'](_0x4506cd[_0x6e95('0x2c')]);_0x427f7e[_0x6e95('0x2d')]=_[_0x6e95('0x2e')](_0x427f7e['model'],_0x427f7e[_0x6e95('0x2c')]);_0x5265ca[_0x6e95('0x2f')]=_[_0x6e95('0x2e')](_0x427f7e[_0x6e95('0x2b')],qs['fields'](_0x4506cd[_0x6e95('0x2c')]['fields']));_0x5265ca['attributes']=_0x5265ca[_0x6e95('0x2f')][_0x6e95('0x30')]?_0x5265ca[_0x6e95('0x2f')]:_0x427f7e[_0x6e95('0x2b')];if(!_0x4506cd['query'][_0x6e95('0x31')]('nolimit')){_0x5265ca['limit']=qs['limit'](_0x4506cd['query'][_0x6e95('0x1a')]);_0x5265ca[_0x6e95('0x1c')]=qs[_0x6e95('0x1c')](_0x4506cd[_0x6e95('0x2c')][_0x6e95('0x1c')]);}_0x5265ca[_0x6e95('0x32')]=qs[_0x6e95('0x33')](_0x4506cd[_0x6e95('0x2c')]['sort']);_0x5265ca['where']=qs[_0x6e95('0x2d')](_['pick'](_0x4506cd[_0x6e95('0x2c')],_0x427f7e[_0x6e95('0x2d')]),_0x43ea07);if(_0x4506cd[_0x6e95('0x2c')][_0x6e95('0x34')]){_0x5265ca[_0x6e95('0x35')]=_[_0x6e95('0x36')](_0x5265ca[_0x6e95('0x35')],{'$or':_['map'](_0x43ea07,function(_0x5addd5){if(_0x5addd5[_0x6e95('0x37')]!==_0x6e95('0x38')){var _0x43e2fa={};_0x43e2fa[_0x5addd5[_0x6e95('0x25')]]={'$like':'%'+_0x4506cd[_0x6e95('0x2c')][_0x6e95('0x34')]+'%'};return _0x43e2fa;}})});}_0x5265ca=_[_0x6e95('0x36')]({},_0x5265ca,_0x4506cd[_0x6e95('0x39')]);var _0x5592ea={'where':_0x5265ca['where']};return db[_0x6e95('0x28')]['count'](_0x5592ea)['then'](function(_0x341f9c){_0x24ba8f[_0x6e95('0x1b')]=_0x341f9c;if(_0x4506cd[_0x6e95('0x2c')][_0x6e95('0x3a')]){_0x5265ca['include']=[{'all':!![]}];}return db[_0x6e95('0x28')][_0x6e95('0x3b')](_0x5265ca);})[_0x6e95('0x20')](function(_0x43c24a){_0x24ba8f[_0x6e95('0x3c')]=_0x43c24a;return _0x24ba8f;})[_0x6e95('0x20')](respondWithFilteredResult(_0x2c7559,_0x5265ca))[_0x6e95('0x3d')](handleError(_0x2c7559,null));};exports['show']=function(_0x5bcd4c,_0x66403b){var _0x39123c={'raw':!![],'where':{'id':_0x5bcd4c[_0x6e95('0x3e')]['id']}},_0x1fefb8={};_0x1fefb8[_0x6e95('0x2b')]=_['keys'](db[_0x6e95('0x28')][_0x6e95('0x29')]);_0x1fefb8[_0x6e95('0x2c')]=_['keys'](_0x5bcd4c[_0x6e95('0x2c')]);_0x1fefb8[_0x6e95('0x2d')]=_[_0x6e95('0x2e')](_0x1fefb8[_0x6e95('0x2b')],_0x1fefb8['query']);_0x39123c['attributes']=_['intersection'](_0x1fefb8['model'],qs[_0x6e95('0x3f')](_0x5bcd4c['query'][_0x6e95('0x3f')]));_0x39123c[_0x6e95('0x2f')]=_0x39123c[_0x6e95('0x2f')][_0x6e95('0x30')]?_0x39123c['attributes']:_0x1fefb8[_0x6e95('0x2b')];if(_0x5bcd4c[_0x6e95('0x2c')][_0x6e95('0x3a')]){_0x39123c[_0x6e95('0x40')]=[{'all':!![]}];}_0x39123c=_[_0x6e95('0x36')]({},_0x39123c,_0x5bcd4c[_0x6e95('0x39')]);return db[_0x6e95('0x28')]['find'](_0x39123c)[_0x6e95('0x20')](handleEntityNotFound(_0x66403b,null))[_0x6e95('0x20')](respondWithResult(_0x66403b,null))['catch'](handleError(_0x66403b,null));};exports[_0x6e95('0x41')]=function(_0x1caac3,_0x3aa371){return db[_0x6e95('0x28')][_0x6e95('0x41')](_0x1caac3[_0x6e95('0x42')],{})[_0x6e95('0x20')](respondWithResult(_0x3aa371,0xc9))[_0x6e95('0x3d')](handleError(_0x3aa371,null));};exports[_0x6e95('0x43')]=function(_0x296e3c,_0x40e3ff){if(_0x296e3c['body']['id']){delete _0x296e3c['body']['id'];}return db[_0x6e95('0x28')][_0x6e95('0x44')]({'where':{'id':_0x296e3c[_0x6e95('0x3e')]['id']}})[_0x6e95('0x20')](handleEntityNotFound(_0x40e3ff,null))[_0x6e95('0x20')](saveUpdates(_0x296e3c[_0x6e95('0x42')],null))['then'](respondWithResult(_0x40e3ff,null))[_0x6e95('0x3d')](handleError(_0x40e3ff,null));};exports[_0x6e95('0x21')]=function(_0x2ca5f9,_0x1a1fd1){return db['ChatMessage'][_0x6e95('0x44')]({'where':{'id':_0x2ca5f9[_0x6e95('0x3e')]['id']}})[_0x6e95('0x20')](handleEntityNotFound(_0x1a1fd1,null))['then'](removeEntity(_0x1a1fd1,null))[_0x6e95('0x3d')](handleError(_0x1a1fd1,null));};exports['describe']=function(_0x17e8e7,_0x2fb552){return db['ChatMessage'][_0x6e95('0x45')]()[_0x6e95('0x20')](respondWithResult(_0x2fb552,null))['catch'](handleError(_0x2fb552,null));};exports[_0x6e95('0x46')]=function(_0x13d25b,_0x47b478){var _0x2c4bda=_0x6e95('0x47');return interactionService[_0x6e95('0x48')](_0x13d25b,_0x2c4bda)[_0x6e95('0x20')](respondWithResult(_0x47b478,null))['catch'](handleError(_0x47b478,null));};exports[_0x6e95('0x49')]=function(_0x700b92,_0x3c46ff){var _0x58f10a={'agent':{},'channel':_0x6e95('0x47')};if(_0x700b92['body']['id']){delete _0x700b92['body']['id'];}_0x700b92[_0x6e95('0x42')][_0x6e95('0x4a')]=_0x700b92[_0x6e95('0x42')][_0x6e95('0x4a')]||_0x700b92[_0x6e95('0x4b')]['id'];_0x58f10a[_0x6e95('0x4c')]['id']=_0x700b92[_0x6e95('0x42')][_0x6e95('0x4a')];return db[_0x6e95('0x28')][_0x6e95('0x44')]({'where':{'id':_0x700b92[_0x6e95('0x3e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c46ff,null))['then'](function(_0x181a34){if(_0x181a34){_0x58f10a[_0x6e95('0x18')]=_0x181a34[_0x6e95('0x4d')]({'plain':!![]});return db[_0x6e95('0x4e')][_0x6e95('0x44')]({'where':{'id':_0x181a34['ChatInteractionId']}});}return null;})[_0x6e95('0x20')](handleEntityNotFound(_0x3c46ff,null))[_0x6e95('0x20')](function(_0x95e89c){if(_0x95e89c){_0x58f10a['interaction']=_0x95e89c[_0x6e95('0x4d')]({'plain':!![]});interaction_log[_0x6e95('0x11')](_0x6e95('0x4f'),_0x700b92['user']['id'],_0x700b92['user'][_0x6e95('0x25')],_0x700b92[_0x6e95('0x4b')][_0x6e95('0x50')],_0x58f10a[_0x6e95('0x51')]['id'],_0x700b92[_0x6e95('0x42')]?JSON[_0x6e95('0x15')](_0x700b92['body']):_0x6e95('0x52'));return respondWithRpcPromise(_0x6e95('0x53'),'rejectMessage',_0x58f10a);}return null;})[_0x6e95('0x20')](function(_0xa71126){var _0x7d74ac=_0x6e95('0x54')+_0xa71126[_0x6e95('0x18')]['ContactId'];return db['sequelize']['query'](_0x7d74ac,{'type':db[_0x6e95('0x55')][_0x6e95('0x56')][_0x6e95('0x57')],'raw':!![]})[_0x6e95('0x20')](function(_0xe9d5d2){return _0xe9d5d2;});})[_0x6e95('0x20')](function(_0x19b97e){if(_0x19b97e){_0x58f10a[_0x6e95('0x18')][_0x6e95('0x58')]=_0x19b97e[0x0];if(!_0x700b92['body']['UserId'])return;return db[_0x6e95('0x59')][_0x6e95('0x44')]({'where':{'id':_0x700b92[_0x6e95('0x42')][_0x6e95('0x4a')],'role':_0x6e95('0x4c')},'attributes':['id',_0x6e95('0x25'),_0x6e95('0x5a'),_0x6e95('0x5b'),_0x6e95('0x5c')],'raw':!![]});}return null;})[_0x6e95('0x20')](function(_0x5092fc){if(!_0x5092fc)return null;_0x58f10a['message'][_0x6e95('0x4c')]=_0x5092fc;return _0x58f10a;})[_0x6e95('0x20')](function(_0x2c4bde){if(_0x2c4bde){_0x2c4bde[_0x6e95('0x18')][_0x6e95('0x5d')]=util[_0x6e95('0x5e')](_0x6e95('0x5f'),_0x700b92[_0x6e95('0x4b')]['name']);_0x2c4bde['message'][_0x6e95('0x60')]=_0x58f10a['channel'];_0x2c4bde['message'][_0x6e95('0x61')]=_0x58f10a[_0x6e95('0x60')];_0x2c4bde[_0x6e95('0x18')][_0x6e95('0x62')]=_0x6e95('0x49');respondWithRpcPromise(_0x6e95('0x63'),_0x6e95('0x63'),{'event':_0x6e95('0x64'),'message':_[_0x6e95('0x36')](_0x58f10a[_0x6e95('0x18')],JSON[_0x6e95('0x65')](_0x58f10a['interaction']['formData']))},client9002);return _0x58f10a;}return null;})[_0x6e95('0x20')](respondWithResult(_0x3c46ff,null))[_0x6e95('0x3d')](handleError(_0x3c46ff,null));}; \ No newline at end of file +var _0xa6d4=['findAll','rows','show','params','find','create','body','describe','accept','chat','reject','UserId','user','agent','get','ChatInteraction','ChatInteractionId','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','parse','formData','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','chat-interactions','request','then','info','ChatMessage,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','ChatMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x575a31,_0x56336f){var _0x5d7dad=function(_0x2c8c09){while(--_0x2c8c09){_0x575a31['push'](_0x575a31['shift']());}};_0x5d7dad(++_0x56336f);}(_0xa6d4,0x101));var _0x4a6d=function(_0x26eba8,_0x3e5db7){_0x26eba8=_0x26eba8-0x0;var _0x19fa6e=_0xa6d4[_0x26eba8];return _0x19fa6e;};'use strict';var util=require(_0x4a6d('0x0'));var _=require(_0x4a6d('0x1'));var Redis=require(_0x4a6d('0x2'));var interactionService=require(_0x4a6d('0x3'));var qs=require(_0x4a6d('0x4'));var logger=require(_0x4a6d('0x5'))('api');var config=require('../../config/environment');var db=require(_0x4a6d('0x6'))['db'];config[_0x4a6d('0x7')]=_[_0x4a6d('0x8')](config[_0x4a6d('0x7')],{'host':_0x4a6d('0x9'),'port':0x18eb});var socket=require(_0x4a6d('0xa'))(new Redis(config[_0x4a6d('0x7')]));require(_0x4a6d('0xb'))[_0x4a6d('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4a6d('0xd')]['http']({'port':0x232c});var client9002=jayson[_0x4a6d('0xd')][_0x4a6d('0xe')]({'port':0x232a});var interaction_log=require(_0x4a6d('0x5'))(_0x4a6d('0xf'));function respondWithRpcPromise(_0x2f0d9f,_0x5b5edf,_0x3b7aef,_0x358671){return new Promise(function(_0x560c85,_0x4c1a8e){var _0x5a04a4=_0x358671||client;return _0x5a04a4[_0x4a6d('0x10')](_0x2f0d9f,_0x3b7aef)[_0x4a6d('0x11')](function(_0x498876){logger[_0x4a6d('0x12')](_0x4a6d('0x13'),_0x5b5edf,'request\x20sent');logger[_0x4a6d('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5b5edf,'request\x20sent',JSON[_0x4a6d('0x15')](_0x498876));if(_0x498876[_0x4a6d('0x16')]){if(_0x498876[_0x4a6d('0x16')][_0x4a6d('0x17')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5b5edf,_0x498876[_0x4a6d('0x16')][_0x4a6d('0x18')]);return _0x4c1a8e(_0x498876['error'][_0x4a6d('0x18')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x5b5edf,_0x498876[_0x4a6d('0x16')][_0x4a6d('0x18')]);return _0x560c85(_0x498876[_0x4a6d('0x16')][_0x4a6d('0x18')]);}else{logger[_0x4a6d('0x12')](_0x4a6d('0x13'),_0x5b5edf,'request\x20sent');_0x560c85(_0x498876[_0x4a6d('0x19')][_0x4a6d('0x18')]);}})[_0x4a6d('0x1a')](function(_0x34bc7d){logger[_0x4a6d('0x16')](_0x4a6d('0x13'),_0x5b5edf,_0x34bc7d);_0x4c1a8e(_0x34bc7d);});});}function respondWithResult(_0x39edf5,_0xebec82){_0xebec82=_0xebec82||0xc8;return function(_0x3537ff){if(_0x3537ff){return _0x39edf5[_0x4a6d('0x1b')](_0xebec82)[_0x4a6d('0x1c')](_0x3537ff);}};}function respondWithFilteredResult(_0x3afe1e,_0xcef94){return function(_0x23b8af){if(_0x23b8af){var _0x264bc5=typeof _0xcef94['offset']===_0x4a6d('0x1d')&&typeof _0xcef94['limit']==='undefined';var _0x35e132=_0x23b8af[_0x4a6d('0x1e')];var _0x3c8f66=_0x264bc5?0x0:_0xcef94[_0x4a6d('0x1f')];var _0x38d9bd=_0x264bc5?_0x23b8af[_0x4a6d('0x1e')]:_0xcef94['offset']+_0xcef94[_0x4a6d('0x20')];var _0x4f29cc;if(_0x38d9bd>=_0x35e132){_0x38d9bd=_0x35e132;_0x4f29cc=0xc8;}else{_0x4f29cc=0xce;}_0x3afe1e[_0x4a6d('0x1b')](_0x4f29cc);return _0x3afe1e[_0x4a6d('0x21')](_0x4a6d('0x22'),_0x3c8f66+'-'+_0x38d9bd+'/'+_0x35e132)[_0x4a6d('0x1c')](_0x23b8af);}return null;};}function saveUpdates(_0x3a6b6c){return function(_0x5bb6da){if(_0x5bb6da){return _0x5bb6da[_0x4a6d('0x23')](_0x3a6b6c)[_0x4a6d('0x11')](function(_0x254b92){return _0x254b92;});}return null;};}function removeEntity(_0x24abb4){return function(_0x4ea11e){if(_0x4ea11e){return _0x4ea11e[_0x4a6d('0x24')]()[_0x4a6d('0x11')](function(){_0x24abb4['status'](0xcc)[_0x4a6d('0x25')]();});}};}function handleEntityNotFound(_0x2a65e1){return function(_0x51fdeb){if(!_0x51fdeb){_0x2a65e1[_0x4a6d('0x26')](0x194);}return _0x51fdeb;};}function handleError(_0x462225,_0xaeaa7c){_0xaeaa7c=_0xaeaa7c||0x1f4;return function(_0x2e6fdc){logger[_0x4a6d('0x16')](_0x2e6fdc[_0x4a6d('0x27')]);if(_0x2e6fdc[_0x4a6d('0x28')]){delete _0x2e6fdc[_0x4a6d('0x28')];}_0x462225[_0x4a6d('0x1b')](_0xaeaa7c)[_0x4a6d('0x29')](_0x2e6fdc);};}exports['index']=function(_0x4d0740,_0x671273){var _0x5edef6={},_0x73ff6e={},_0x16f52f={'count':0x0,'rows':[]};var _0x308a3a=_[_0x4a6d('0x2a')](db[_0x4a6d('0x2b')][_0x4a6d('0x2c')],function(_0x23c76f){return{'name':_0x23c76f[_0x4a6d('0x2d')],'type':_0x23c76f['type'][_0x4a6d('0x2e')]};});_0x73ff6e[_0x4a6d('0x2f')]=_[_0x4a6d('0x2a')](_0x308a3a,_0x4a6d('0x28'));_0x73ff6e['query']=_[_0x4a6d('0x30')](_0x4d0740[_0x4a6d('0x31')]);_0x73ff6e[_0x4a6d('0x32')]=_[_0x4a6d('0x33')](_0x73ff6e['model'],_0x73ff6e[_0x4a6d('0x31')]);_0x5edef6['attributes']=_[_0x4a6d('0x33')](_0x73ff6e[_0x4a6d('0x2f')],qs[_0x4a6d('0x34')](_0x4d0740[_0x4a6d('0x31')][_0x4a6d('0x34')]));_0x5edef6[_0x4a6d('0x35')]=_0x5edef6[_0x4a6d('0x35')][_0x4a6d('0x36')]?_0x5edef6[_0x4a6d('0x35')]:_0x73ff6e[_0x4a6d('0x2f')];if(!_0x4d0740[_0x4a6d('0x31')][_0x4a6d('0x37')]('nolimit')){_0x5edef6['limit']=qs['limit'](_0x4d0740[_0x4a6d('0x31')][_0x4a6d('0x20')]);_0x5edef6['offset']=qs[_0x4a6d('0x1f')](_0x4d0740['query'][_0x4a6d('0x1f')]);}_0x5edef6[_0x4a6d('0x38')]=qs[_0x4a6d('0x39')](_0x4d0740[_0x4a6d('0x31')][_0x4a6d('0x39')]);_0x5edef6[_0x4a6d('0x3a')]=qs[_0x4a6d('0x32')](_[_0x4a6d('0x3b')](_0x4d0740[_0x4a6d('0x31')],_0x73ff6e[_0x4a6d('0x32')]),_0x308a3a);if(_0x4d0740[_0x4a6d('0x31')][_0x4a6d('0x3c')]){_0x5edef6[_0x4a6d('0x3a')]=_[_0x4a6d('0x3d')](_0x5edef6[_0x4a6d('0x3a')],{'$or':_[_0x4a6d('0x2a')](_0x308a3a,function(_0x4b4656){if(_0x4b4656[_0x4a6d('0x3e')]!==_0x4a6d('0x3f')){var _0x3cde5e={};_0x3cde5e[_0x4b4656[_0x4a6d('0x28')]]={'$like':'%'+_0x4d0740[_0x4a6d('0x31')][_0x4a6d('0x3c')]+'%'};return _0x3cde5e;}})});}_0x5edef6=_['merge']({},_0x5edef6,_0x4d0740[_0x4a6d('0x40')]);var _0x547827={'where':_0x5edef6[_0x4a6d('0x3a')]};return db['ChatMessage'][_0x4a6d('0x1e')](_0x547827)[_0x4a6d('0x11')](function(_0x53d100){_0x16f52f[_0x4a6d('0x1e')]=_0x53d100;if(_0x4d0740[_0x4a6d('0x31')][_0x4a6d('0x41')]){_0x5edef6[_0x4a6d('0x42')]=[{'all':!![]}];}return db[_0x4a6d('0x2b')][_0x4a6d('0x43')](_0x5edef6);})[_0x4a6d('0x11')](function(_0x4d6ba4){_0x16f52f[_0x4a6d('0x44')]=_0x4d6ba4;return _0x16f52f;})[_0x4a6d('0x11')](respondWithFilteredResult(_0x671273,_0x5edef6))[_0x4a6d('0x1a')](handleError(_0x671273,null));};exports[_0x4a6d('0x45')]=function(_0x133d7f,_0x274c10){var _0x5a3e58={'raw':!![],'where':{'id':_0x133d7f[_0x4a6d('0x46')]['id']}},_0x5bf88a={};_0x5bf88a[_0x4a6d('0x2f')]=_['keys'](db[_0x4a6d('0x2b')][_0x4a6d('0x2c')]);_0x5bf88a[_0x4a6d('0x31')]=_[_0x4a6d('0x30')](_0x133d7f[_0x4a6d('0x31')]);_0x5bf88a[_0x4a6d('0x32')]=_[_0x4a6d('0x33')](_0x5bf88a[_0x4a6d('0x2f')],_0x5bf88a[_0x4a6d('0x31')]);_0x5a3e58[_0x4a6d('0x35')]=_[_0x4a6d('0x33')](_0x5bf88a[_0x4a6d('0x2f')],qs[_0x4a6d('0x34')](_0x133d7f[_0x4a6d('0x31')][_0x4a6d('0x34')]));_0x5a3e58[_0x4a6d('0x35')]=_0x5a3e58[_0x4a6d('0x35')]['length']?_0x5a3e58['attributes']:_0x5bf88a['model'];if(_0x133d7f[_0x4a6d('0x31')][_0x4a6d('0x41')]){_0x5a3e58['include']=[{'all':!![]}];}_0x5a3e58=_[_0x4a6d('0x3d')]({},_0x5a3e58,_0x133d7f[_0x4a6d('0x40')]);return db[_0x4a6d('0x2b')][_0x4a6d('0x47')](_0x5a3e58)[_0x4a6d('0x11')](handleEntityNotFound(_0x274c10,null))['then'](respondWithResult(_0x274c10,null))[_0x4a6d('0x1a')](handleError(_0x274c10,null));};exports[_0x4a6d('0x48')]=function(_0x13a6c2,_0x4eeecd){return db[_0x4a6d('0x2b')][_0x4a6d('0x48')](_0x13a6c2['body'],{})[_0x4a6d('0x11')](respondWithResult(_0x4eeecd,0xc9))[_0x4a6d('0x1a')](handleError(_0x4eeecd,null));};exports[_0x4a6d('0x23')]=function(_0x3a2098,_0x3de169){if(_0x3a2098[_0x4a6d('0x49')]['id']){delete _0x3a2098['body']['id'];}return db['ChatMessage'][_0x4a6d('0x47')]({'where':{'id':_0x3a2098[_0x4a6d('0x46')]['id']}})['then'](handleEntityNotFound(_0x3de169,null))['then'](saveUpdates(_0x3a2098['body'],null))[_0x4a6d('0x11')](respondWithResult(_0x3de169,null))[_0x4a6d('0x1a')](handleError(_0x3de169,null));};exports[_0x4a6d('0x24')]=function(_0x63af58,_0xc3f141){return db[_0x4a6d('0x2b')][_0x4a6d('0x47')]({'where':{'id':_0x63af58[_0x4a6d('0x46')]['id']}})[_0x4a6d('0x11')](handleEntityNotFound(_0xc3f141,null))[_0x4a6d('0x11')](removeEntity(_0xc3f141,null))[_0x4a6d('0x1a')](handleError(_0xc3f141,null));};exports[_0x4a6d('0x4a')]=function(_0x258179,_0x3b5d51){return db[_0x4a6d('0x2b')][_0x4a6d('0x4a')]()['then'](respondWithResult(_0x3b5d51,null))[_0x4a6d('0x1a')](handleError(_0x3b5d51,null));};exports[_0x4a6d('0x4b')]=function(_0x53060a,_0x1a5854){var _0x1cbc62=_0x4a6d('0x4c');return interactionService['acceptMessage'](_0x53060a,_0x1cbc62)['then'](respondWithResult(_0x1a5854,null))[_0x4a6d('0x1a')](handleError(_0x1a5854,null));};exports[_0x4a6d('0x4d')]=function(_0xfb9e39,_0x347b7b){var _0x2e45c9={'agent':{},'channel':_0x4a6d('0x4c')};if(_0xfb9e39[_0x4a6d('0x49')]['id']){delete _0xfb9e39[_0x4a6d('0x49')]['id'];}_0xfb9e39[_0x4a6d('0x49')][_0x4a6d('0x4e')]=_0xfb9e39[_0x4a6d('0x49')][_0x4a6d('0x4e')]||_0xfb9e39[_0x4a6d('0x4f')]['id'];_0x2e45c9[_0x4a6d('0x50')]['id']=_0xfb9e39['body'][_0x4a6d('0x4e')];return db['ChatMessage'][_0x4a6d('0x47')]({'where':{'id':_0xfb9e39[_0x4a6d('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x347b7b,null))[_0x4a6d('0x11')](function(_0x43d6cd){if(_0x43d6cd){_0x2e45c9[_0x4a6d('0x18')]=_0x43d6cd[_0x4a6d('0x51')]({'plain':!![]});return db[_0x4a6d('0x52')][_0x4a6d('0x47')]({'where':{'id':_0x43d6cd[_0x4a6d('0x53')]}});}return null;})[_0x4a6d('0x11')](handleEntityNotFound(_0x347b7b,null))['then'](function(_0x1c1444){if(_0x1c1444){_0x2e45c9[_0x4a6d('0x54')]=_0x1c1444[_0x4a6d('0x51')]({'plain':!![]});interaction_log[_0x4a6d('0x12')](_0x4a6d('0x55'),_0xfb9e39['user']['id'],_0xfb9e39[_0x4a6d('0x4f')]['name'],_0xfb9e39[_0x4a6d('0x4f')][_0x4a6d('0x56')],_0x2e45c9[_0x4a6d('0x54')]['id'],_0xfb9e39[_0x4a6d('0x49')]?JSON['stringify'](_0xfb9e39['body']):_0x4a6d('0x57'));return respondWithRpcPromise(_0x4a6d('0x58'),_0x4a6d('0x59'),_0x2e45c9);}return null;})[_0x4a6d('0x11')](function(_0x2ca1b9){var _0x4ad7ce='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2ca1b9['message'][_0x4a6d('0x5a')];return db[_0x4a6d('0x5b')][_0x4a6d('0x31')](_0x4ad7ce,{'type':db[_0x4a6d('0x5c')][_0x4a6d('0x5d')][_0x4a6d('0x5e')],'raw':!![]})[_0x4a6d('0x11')](function(_0x4012c0){return _0x4012c0;});})[_0x4a6d('0x11')](function(_0x32980e){if(_0x32980e){_0x2e45c9[_0x4a6d('0x18')][_0x4a6d('0x5f')]=_0x32980e[0x0];if(!_0xfb9e39[_0x4a6d('0x49')][_0x4a6d('0x4e')])return;return db[_0x4a6d('0x60')]['find']({'where':{'id':_0xfb9e39[_0x4a6d('0x49')][_0x4a6d('0x4e')],'role':_0x4a6d('0x50')},'attributes':['id',_0x4a6d('0x28'),_0x4a6d('0x61'),'email',_0x4a6d('0x62')],'raw':!![]});}return null;})[_0x4a6d('0x11')](function(_0x236bc4){if(!_0x236bc4)return null;_0x2e45c9[_0x4a6d('0x18')][_0x4a6d('0x50')]=_0x236bc4;return _0x2e45c9;})[_0x4a6d('0x11')](function(_0x476cfe){if(_0x476cfe){_0x476cfe[_0x4a6d('0x18')][_0x4a6d('0x63')]=util[_0x4a6d('0x64')](_0x4a6d('0x65'),_0xfb9e39['user'][_0x4a6d('0x28')]);_0x476cfe[_0x4a6d('0x18')][_0x4a6d('0x66')]=_0x2e45c9[_0x4a6d('0x66')];_0x476cfe[_0x4a6d('0x18')][_0x4a6d('0x67')]=_0x2e45c9['channel'];_0x476cfe[_0x4a6d('0x18')]['event']='reject';respondWithRpcPromise(_0x4a6d('0x68'),_0x4a6d('0x68'),{'event':_0x4a6d('0x69'),'message':_[_0x4a6d('0x3d')](_0x2e45c9[_0x4a6d('0x18')],JSON[_0x4a6d('0x6a')](_0x2e45c9['interaction'][_0x4a6d('0x6b')]))},client9002);return _0x2e45c9;}return null;})['then'](respondWithResult(_0x347b7b,null))[_0x4a6d('0x1a')](handleError(_0x347b7b,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 957f3a0..bd791c6 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 _0xc236=['ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x28fbbf,_0x11f896){var _0x543af6=function(_0x27fa74){while(--_0x27fa74){_0x28fbbf['push'](_0x28fbbf['shift']());}};_0x543af6(++_0x11f896);}(_0xc236,0x12b));var _0x6c23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc236[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6c23('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x6c23('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6c23('0x2')](0x0);var events={'afterCreate':_0x6c23('0x3'),'afterUpdate':_0x6c23('0x4'),'afterDestroy':_0x6c23('0x5')};function emitEvent(_0x1cd6a0){return function(_0x5cf94f,_0x19b9fc,_0x4494c4){ChatMessageEvents[_0x6c23('0x6')](_0x1cd6a0+':'+_0x5cf94f['id'],_0x5cf94f);ChatMessageEvents['emit'](_0x1cd6a0,_0x5cf94f);_0x4494c4(null);};}for(var e in events){if(events[_0x6c23('0x7')](e)){var event=events[e];ChatMessage[_0x6c23('0x8')](e,emitEvent(event));}}module[_0x6c23('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x9b30=['hasOwnProperty','../../mysqldb','ChatMessage','setMaxListeners','remove','emit'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x9b30,0x8b));var _0x09b3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x9b30[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x09b3('0x0'))['db'][_0x09b3('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x09b3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x09b3('0x3')};function emitEvent(_0x119466){return function(_0x59fb17,_0x355e28,_0x1ba406){ChatMessageEvents[_0x09b3('0x4')](_0x119466+':'+_0x59fb17['id'],_0x59fb17);ChatMessageEvents['emit'](_0x119466,_0x59fb17);_0x1ba406(null);};}for(var e in events){if(events[_0x09b3('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 17ddeeb..a21c040 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 _0xcc92=['toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','get','direction'];(function(_0x21fb16,_0x2d7fb5){var _0x470ab7=function(_0x169d5c){while(--_0x169d5c){_0x21fb16['push'](_0x21fb16['shift']());}};_0x470ab7(++_0x2d7fb5);}(_0xcc92,0x141));var _0x2cc9=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0xcc92[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0x2cc9('0x0'));var util=require(_0x2cc9('0x1'));var logger=require(_0x2cc9('0x2'))('api');var moment=require(_0x2cc9('0x3'));var BPromise=require(_0x2cc9('0x4'));var rp=require(_0x2cc9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2cc9('0x6'));var attributes=require(_0x2cc9('0x7'));module['exports']=function(_0x2260b6,_0x5f3e9c){return _0x2260b6[_0x2cc9('0x8')](_0x2cc9('0x9'),attributes,{'tableName':_0x2cc9('0xa'),'paranoid':![],'indexes':[{'name':_0x2cc9('0xb'),'fields':['body'],'type':_0x2cc9('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e9d6e,_0x103a34,_0xeff44e){var _0x59c85c=_0x2260b6['models'];var _0x1e3624=_0x4e9d6e[_0x2cc9('0xd')]({'plain':!![]});if(_0x1e3624[_0x2cc9('0xe')][_0x2cc9('0xf')]()==='in'||_0x1e3624[_0x2cc9('0xe')][_0x2cc9('0xf')]()===_0x2cc9('0x10')&&!_0x1e3624[_0x2cc9('0x11')]&&!_[_0x2cc9('0x12')](_0x1e3624[_0x2cc9('0x13')])){_0x59c85c[_0x2cc9('0x14')][_0x2cc9('0x15')]({'where':{'id':_0x1e3624['ChatInteractionId']}})[_0x2cc9('0x16')](function(_0x45a3d4){if(_0x45a3d4){_0x45a3d4[_0x2cc9('0x17')]({'lastMsgAt':_0x1e3624[_0x2cc9('0x18')],'lastMsgDirection':_0x1e3624['direction'][_0x2cc9('0xf')]()});}})[_0x2cc9('0x19')](function(_0x3c380c){console[_0x2cc9('0x1a')](_0x3c380c);});}_0xeff44e();}},'charset':'utf8mb4','collate':_0x2cc9('0x1b')});}; \ No newline at end of file +var _0xd1d4=['util','api','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4cecf8,_0x522f97){var _0x311797=function(_0x243bcb){while(--_0x243bcb){_0x4cecf8['push'](_0x4cecf8['shift']());}};_0x311797(++_0x522f97);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd1d4[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x4d1d('0x0'));var util=require(_0x4d1d('0x1'));var logger=require('../../config/logger')(_0x4d1d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d1d('0x3'));var fs=require('fs');var path=require(_0x4d1d('0x4'));var rimraf=require(_0x4d1d('0x5'));var config=require(_0x4d1d('0x6'));var attributes=require(_0x4d1d('0x7'));module[_0x4d1d('0x8')]=function(_0x30466a,_0xb8a403){return _0x30466a[_0x4d1d('0x9')](_0x4d1d('0xa'),attributes,{'tableName':_0x4d1d('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x4d1d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x371de3,_0x52cbbf,_0x2053ab){var _0x33d8a7=_0x30466a[_0x4d1d('0xd')];var _0x248db3=_0x371de3[_0x4d1d('0xe')]({'plain':!![]});if(_0x248db3[_0x4d1d('0xf')][_0x4d1d('0x10')]()==='in'||_0x248db3[_0x4d1d('0xf')][_0x4d1d('0x10')]()===_0x4d1d('0x11')&&!_0x248db3[_0x4d1d('0x12')]&&!_[_0x4d1d('0x13')](_0x248db3[_0x4d1d('0x14')])){_0x33d8a7['ChatInteraction'][_0x4d1d('0x15')]({'where':{'id':_0x248db3[_0x4d1d('0x16')]}})[_0x4d1d('0x17')](function(_0x377ff7){if(_0x377ff7){_0x377ff7['update']({'lastMsgAt':_0x248db3['createdAt'],'lastMsgDirection':_0x248db3[_0x4d1d('0xf')][_0x4d1d('0x10')]()});}})[_0x4d1d('0x18')](function(_0x569809){console[_0x4d1d('0x19')](_0x569809);});}_0x2053ab();}},'charset':_0x4d1d('0x1a'),'collate':_0x4d1d('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 25636f3..63550c6 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 _0x0505=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','options','raw'];(function(_0x23dac3,_0x282874){var _0x5702cc=function(_0xcbf1c1){while(--_0xcbf1c1){_0x23dac3['push'](_0x23dac3['shift']());}};_0x5702cc(++_0x282874);}(_0x0505,0x13f));var _0x5050=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x0505[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5050('0x0'));var rs=require(_0x5050('0x1'));var fs=require('fs');var Redis=require(_0x5050('0x2'));var db=require(_0x5050('0x3'))['db'];var utils=require(_0x5050('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5050('0x5'));var jayson=require(_0x5050('0x6'));var client=jayson['client'][_0x5050('0x7')]({'port':0x232a});config['redis']=_[_0x5050('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5050('0x9'))(new Redis(config['redis']));require(_0x5050('0xa'))[_0x5050('0xb')](socket);function respondWithRpcPromise(_0x42307a,_0x53fe07,_0x3e91ac){return new BPromise(function(_0x3612a4,_0x792b1){return client[_0x5050('0xc')](_0x42307a,_0x3e91ac)[_0x5050('0xd')](function(_0x4301a9){logger[_0x5050('0xe')](_0x5050('0xf'),_0x53fe07,'request\x20sent');logger[_0x5050('0x10')](_0x5050('0x11'),_0x53fe07,_0x5050('0x12'),JSON[_0x5050('0x13')](_0x4301a9));if(_0x4301a9[_0x5050('0x14')]){if(_0x4301a9[_0x5050('0x14')][_0x5050('0x15')]===0x1f4){logger[_0x5050('0x14')](_0x5050('0xf'),_0x53fe07,_0x4301a9[_0x5050('0x14')]['message']);return _0x792b1(_0x4301a9['error'][_0x5050('0x16')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x53fe07,_0x4301a9['error'][_0x5050('0x16')]);return _0x3612a4(_0x4301a9['error']['message']);}else{logger[_0x5050('0xe')](_0x5050('0xf'),_0x53fe07,_0x5050('0x12'));_0x3612a4(_0x4301a9['result']['message']);}})[_0x5050('0x17')](function(_0xe7b615){logger[_0x5050('0x14')](_0x5050('0xf'),_0x53fe07,_0xe7b615);_0x792b1(_0xe7b615);});});}exports[_0x5050('0x18')]=function(_0x60911b){var _0x2adbf9=this;return new Promise(function(_0x476b9f,_0x253d1e){return db[_0x5050('0x19')][_0x5050('0x1a')](_0x60911b['body'],{'raw':_0x60911b[_0x5050('0x1b')]?_0x60911b[_0x5050('0x1b')][_0x5050('0x1c')]===undefined?!![]:![]:!![]})[_0x5050('0xd')](function(_0x919bc3){logger[_0x5050('0xe')](_0x5050('0x18'),_0x60911b);logger[_0x5050('0x10')]('CreateChatMessage',_0x60911b,JSON[_0x5050('0x13')](_0x919bc3));_0x476b9f(_0x919bc3);})['catch'](function(_0xf3a2f0){logger['error'](_0x5050('0x18'),_0xf3a2f0[_0x5050('0x16')],_0x60911b);_0x253d1e(_0x2adbf9['error'](0x1f4,_0xf3a2f0[_0x5050('0x16')]));});});}; \ No newline at end of file +var _0x7567=['ChatMessage','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage'];(function(_0x50dfa5,_0x2d0564){var _0x24331c=function(_0x588c76){while(--_0x588c76){_0x50dfa5['push'](_0x50dfa5['shift']());}};_0x24331c(++_0x2d0564);}(_0x7567,0x143));var _0x7756=function(_0x448855,_0x11578a){_0x448855=_0x448855-0x0;var _0x3c5264=_0x7567[_0x448855];return _0x3c5264;};'use strict';var _=require(_0x7756('0x0'));var util=require(_0x7756('0x1'));var moment=require(_0x7756('0x2'));var BPromise=require(_0x7756('0x3'));var rs=require(_0x7756('0x4'));var fs=require('fs');var Redis=require(_0x7756('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7756('0x6'));var logger=require(_0x7756('0x7'))(_0x7756('0x8'));var config=require(_0x7756('0x9'));var jayson=require(_0x7756('0xa'));var client=jayson['client'][_0x7756('0xb')]({'port':0x232a});config[_0x7756('0xc')]=_[_0x7756('0xd')](config[_0x7756('0xc')],{'host':_0x7756('0xe'),'port':0x18eb});var socket=require(_0x7756('0xf'))(new Redis(config[_0x7756('0xc')]));require(_0x7756('0x10'))['register'](socket);function respondWithRpcPromise(_0x58d891,_0x4f0081,_0x217251){return new BPromise(function(_0x59387c,_0x5ca726){return client[_0x7756('0x11')](_0x58d891,_0x217251)[_0x7756('0x12')](function(_0x23e939){logger[_0x7756('0x13')]('ChatMessage,\x20%s,\x20%s',_0x4f0081,_0x7756('0x14'));logger['debug'](_0x7756('0x15'),_0x4f0081,_0x7756('0x14'),JSON[_0x7756('0x16')](_0x23e939));if(_0x23e939[_0x7756('0x17')]){if(_0x23e939[_0x7756('0x17')]['code']===0x1f4){logger[_0x7756('0x17')](_0x7756('0x18'),_0x4f0081,_0x23e939[_0x7756('0x17')][_0x7756('0x19')]);return _0x5ca726(_0x23e939['error'][_0x7756('0x19')]);}logger[_0x7756('0x17')]('ChatMessage,\x20%s,\x20%s',_0x4f0081,_0x23e939[_0x7756('0x17')][_0x7756('0x19')]);return _0x59387c(_0x23e939[_0x7756('0x17')][_0x7756('0x19')]);}else{logger[_0x7756('0x13')](_0x7756('0x18'),_0x4f0081,'request\x20sent');_0x59387c(_0x23e939[_0x7756('0x1a')][_0x7756('0x19')]);}})[_0x7756('0x1b')](function(_0x10964a){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4f0081,_0x10964a);_0x5ca726(_0x10964a);});});}exports[_0x7756('0x1c')]=function(_0x430ecd){var _0x432776=this;return new Promise(function(_0x34937a,_0x3c1be5){return db[_0x7756('0x1d')][_0x7756('0x1e')](_0x430ecd['body'],{'raw':_0x430ecd[_0x7756('0x1f')]?_0x430ecd[_0x7756('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x7756('0x12')](function(_0x1ac55d){logger[_0x7756('0x13')]('CreateChatMessage',_0x430ecd);logger['debug'](_0x7756('0x1c'),_0x430ecd,JSON[_0x7756('0x16')](_0x1ac55d));_0x34937a(_0x1ac55d);})[_0x7756('0x1b')](function(_0x579cb7){logger[_0x7756('0x17')]('CreateChatMessage',_0x579cb7[_0x7756('0x19')],_0x430ecd);_0x3c1be5(_0x432776[_0x7756('0x17')](0x1f4,_0x579cb7[_0x7756('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 10113ea..63b0eca 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 _0x2e65=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x2e65,0x193));var _0x52e6=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x2e65[_0x2dd390];return _0x3afe47;};'use strict';var ChatMessageEvents=require(_0x52e6('0x0'));var events=[_0x52e6('0x1'),_0x52e6('0x2'),_0x52e6('0x3')];function createListener(_0xd7e693,_0x23aa21){return function(_0x1ab739){_0x23aa21[_0x52e6('0x4')](_0xd7e693,_0x1ab739);};}function removeListener(_0x47912f,_0x383919){return function(){ChatMessageEvents[_0x52e6('0x5')](_0x47912f,_0x383919);};}exports[_0x52e6('0x6')]=function(_0xe67caa){for(var _0x1cf6d2=0x0,_0x116651=events[_0x52e6('0x7')];_0x1cf6d2<_0x116651;_0x1cf6d2++){var _0x1401a3=events[_0x1cf6d2];var _0x27f270=createListener(_0x52e6('0x8')+_0x1401a3,_0xe67caa);ChatMessageEvents['on'](_0x1401a3,_0x27f270);}}; \ No newline at end of file +var _0xe009=['length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xe009,0x122));var _0x9e00=function(_0x147968,_0xeba403){_0x147968=_0x147968-0x0;var _0x5253e3=_0xe009[_0x147968];return _0x5253e3;};'use strict';var ChatMessageEvents=require(_0x9e00('0x0'));var events=[_0x9e00('0x1'),_0x9e00('0x2'),_0x9e00('0x3')];function createListener(_0x53b46a,_0x126adc){return function(_0x4b0d66){_0x126adc[_0x9e00('0x4')](_0x53b46a,_0x4b0d66);};}function removeListener(_0x24d136,_0x30f741){return function(){ChatMessageEvents[_0x9e00('0x5')](_0x24d136,_0x30f741);};}exports[_0x9e00('0x6')]=function(_0x467e35){for(var _0x32b4ee=0x0,_0x402bb0=events[_0x9e00('0x7')];_0x32b4ee<_0x402bb0;_0x32b4ee++){var _0x1eb956=events[_0x32b4ee];var _0x5da6a4=createListener(_0x9e00('0x8')+_0x1eb956,_0x467e35);ChatMessageEvents['on'](_0x1eb956,_0x5da6a4);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 8f2cfd1..c98d471 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 _0x7b17=['get','describe','/:id','tracked','chat','chatmessage:create','put','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','path','express','Router','../../components/auth/service','./chatMessage.controller','isAuthenticated','index'];(function(_0x378aca,_0x13e103){var _0x1b7b4b=function(_0xed42d6){while(--_0xed42d6){_0x378aca['push'](_0x378aca['shift']());}};_0x1b7b4b(++_0x13e103);}(_0x7b17,0x75));var _0x77b1=function(_0x3c97e3,_0x321677){_0x3c97e3=_0x3c97e3-0x0;var _0x9bb0ed=_0x7b17[_0x3c97e3];return _0x9bb0ed;};'use strict';var multer=require(_0x77b1('0x0'));var util=require(_0x77b1('0x1'));var path=require(_0x77b1('0x2'));var timeout=require('connect-timeout');var express=require(_0x77b1('0x3'));var router=express[_0x77b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x77b1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x77b1('0x6'));router['get']('/',auth[_0x77b1('0x7')](),controller[_0x77b1('0x8')]);router[_0x77b1('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x77b1('0xa')]);router['get'](_0x77b1('0xb'),auth[_0x77b1('0x7')](),controller['show']);router['post']('/',auth[_0x77b1('0x7')](),interaction[_0x77b1('0xc')](_0x77b1('0xd'),_0x77b1('0xe')),controller['create']);router['put']('/:id',controller['update']);router[_0x77b1('0xf')](_0x77b1('0x10'),auth[_0x77b1('0x7')](),controller['accept']);router['put'](_0x77b1('0x11'),auth[_0x77b1('0x7')](),controller[_0x77b1('0x12')]);router[_0x77b1('0x13')](_0x77b1('0xb'),auth[_0x77b1('0x7')](),controller[_0x77b1('0x14')]);module['exports']=router; \ No newline at end of file +var _0x592e=['../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','chat','chatmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service'];(function(_0x18fb3d,_0x2f0778){var _0x420061=function(_0x163aff){while(--_0x163aff){_0x18fb3d['push'](_0x18fb3d['shift']());}};_0x420061(++_0x2f0778);}(_0x592e,0x13f));var _0xe592=function(_0xe63142,_0xebe351){_0xe63142=_0xe63142-0x0;var _0x285167=_0x592e[_0xe63142];return _0x285167;};'use strict';var multer=require(_0xe592('0x0'));var util=require(_0xe592('0x1'));var path=require(_0xe592('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe592('0x3'));var auth=require(_0xe592('0x4'));var interaction=require(_0xe592('0x5'));var config=require('../../config/environment');var controller=require(_0xe592('0x6'));router[_0xe592('0x7')]('/',auth[_0xe592('0x8')](),controller[_0xe592('0x9')]);router[_0xe592('0x7')](_0xe592('0xa'),auth[_0xe592('0x8')](),controller[_0xe592('0xb')]);router[_0xe592('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe592('0xc')]);router[_0xe592('0xd')]('/',auth[_0xe592('0x8')](),interaction['tracked'](_0xe592('0xe'),_0xe592('0xf')),controller[_0xe592('0x10')]);router[_0xe592('0x11')](_0xe592('0x12'),controller[_0xe592('0x13')]);router[_0xe592('0x11')](_0xe592('0x14'),auth['isAuthenticated'](),controller[_0xe592('0x15')]);router[_0xe592('0x11')](_0xe592('0x16'),auth[_0xe592('0x8')](),controller[_0xe592('0x17')]);router[_0xe592('0x18')](_0xe592('0x12'),auth[_0xe592('0x8')](),controller[_0xe592('0x19')]);module[_0xe592('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 7b39354..31a6985 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(_0x4d1055,_0x3be1fd){var _0x56a5bd=function(_0x2068e2){while(--_0x2068e2){_0x4d1055['push'](_0x4d1055['shift']());}};_0x56a5bd(++_0x3be1fd);}(_0x2032,0xd9));var _0x2203=function(_0x4fc6d7,_0x518b57){_0x4fc6d7=_0x4fc6d7-0x0;var _0x3872c1=_0x2032[_0x4fc6d7];return _0x3872c1;};'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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x45da21,_0x45d703){var _0x311883=function(_0x2d66a1){while(--_0x2d66a1){_0x45da21['push'](_0x45da21['shift']());}};_0x311883(++_0x45d703);}(_0xdb28,0x106));var _0x8db2=function(_0x138738,_0x1fc0bd){_0x138738=_0x138738-0x0;var _0x5e5f33=_0xdb28[_0x138738];return _0x5e5f33;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 051de7e..a7c9ac2 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x7a54,0x106));var _0x47a5=function(_0x3238c2,_0x36f861){_0x3238c2=_0x3238c2-0x0;var _0x434f6c=_0x7a54[_0x3238c2];return _0x434f6c;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x7a54,0x106));var _0x47a5=function(_0x32a9b6,_0x19364b){_0x32a9b6=_0x32a9b6-0x0;var _0x47843f=_0x7a54[_0x32a9b6];return _0x47843f;};'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 a634d85..8c90ec6 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 _0x3c34=['save','update','emit','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x59a886,_0x5a0d2a){var _0x5e08c1=function(_0x4f9599){while(--_0x4f9599){_0x59a886['push'](_0x59a886['shift']());}};_0x5e08c1(++_0x5a0d2a);}(_0x3c34,0x14c));var _0x43c3=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x3c34[_0x5e36d1];return _0x950b9e;};'use strict';var EventEmitter=require(_0x43c3('0x0'));var ChatOfflineMessage=require(_0x43c3('0x1'))['db'][_0x43c3('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x43c3('0x3')](0x0);var events={'afterCreate':_0x43c3('0x4'),'afterUpdate':_0x43c3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x501de9){return function(_0x2bfbdf,_0x1eba56,_0x873867){ChatOfflineMessageEvents[_0x43c3('0x6')](_0x501de9+':'+_0x2bfbdf['id'],_0x2bfbdf);ChatOfflineMessageEvents[_0x43c3('0x6')](_0x501de9,_0x2bfbdf);_0x873867(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x43c3('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x339d=['ChatOfflineMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x55e43f,_0x34e018){var _0x5c0ec1=function(_0x4ce6c2){while(--_0x4ce6c2){_0x55e43f['push'](_0x55e43f['shift']());}};_0x5c0ec1(++_0x34e018);}(_0x339d,0x14c));var _0xd339=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x339d[_0x1a72f3];return _0x57ef47;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xd339('0x0'))['db'][_0xd339('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xd339('0x2')](0x0);var events={'afterCreate':_0xd339('0x3'),'afterUpdate':'update','afterDestroy':_0xd339('0x4')};function emitEvent(_0xf4d9bd){return function(_0xd0c398,_0x4202b6,_0x3a4180){ChatOfflineMessageEvents[_0xd339('0x5')](_0xf4d9bd+':'+_0xd0c398['id'],_0xd0c398);ChatOfflineMessageEvents[_0xd339('0x5')](_0xf4d9bd,_0xd0c398);_0x3a4180(null);};}for(var e in events){if(events[_0xd339('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xd339('0x7')](e,emitEvent(event));}}module[_0xd339('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 0c905bf..25642e0 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 _0x89ac=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x34eabc,_0x51d411){var _0x43e72f=function(_0x5619e8){while(--_0x5619e8){_0x34eabc['push'](_0x34eabc['shift']());}};_0x43e72f(++_0x51d411);}(_0x89ac,0x1d8));var _0xc89a=function(_0x89035f,_0x272512){_0x89035f=_0x89035f-0x0;var _0x13714e=_0x89ac[_0x89035f];return _0x13714e;};'use strict';var attributes=require(_0xc89a('0x0'));module[_0xc89a('0x1')]=function(_0x5ec22c){return _0x5ec22c[_0xc89a('0x2')](_0xc89a('0x3'),attributes,{'tableName':_0xc89a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc89a('0x5'),'collate':_0xc89a('0x6')});}; \ No newline at end of file +var _0xc650=['exports','define','ChatOfflineMessage','chat_offline_messages','./chatOfflineMessage.attributes'];(function(_0x3191ac,_0x4f2100){var _0x6bf386=function(_0x39dbfb){while(--_0x39dbfb){_0x3191ac['push'](_0x3191ac['shift']());}};_0x6bf386(++_0x4f2100);}(_0xc650,0xd1));var _0x0c65=function(_0x3bede6,_0x151683){_0x3bede6=_0x3bede6-0x0;var _0x71bd26=_0xc650[_0x3bede6];return _0x71bd26;};'use strict';var attributes=require(_0x0c65('0x0'));module[_0x0c65('0x1')]=function(_0x48caa3){return _0x48caa3[_0x0c65('0x2')](_0x0c65('0x3'),attributes,{'tableName':_0x0c65('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 8fac98d..a318051 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 _0x3c9a=['../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x38e27,_0x50a39e){var _0x3735cc=function(_0x37f48d){while(--_0x37f48d){_0x38e27['push'](_0x38e27['shift']());}};_0x3735cc(++_0x50a39e);}(_0x3c9a,0x13c));var _0xa3c9=function(_0x654286,_0x495873){_0x654286=_0x654286-0x0;var _0x5ed00a=_0x3c9a[_0x654286];return _0x5ed00a;};'use strict';var _=require(_0xa3c9('0x0'));var util=require(_0xa3c9('0x1'));var moment=require(_0xa3c9('0x2'));var BPromise=require(_0xa3c9('0x3'));var rs=require(_0xa3c9('0x4'));var fs=require('fs');var Redis=require(_0xa3c9('0x5'));var db=require(_0xa3c9('0x6'))['db'];var utils=require(_0xa3c9('0x7'));var logger=require('../../config/logger')(_0xa3c9('0x8'));var config=require(_0xa3c9('0x9'));var jayson=require(_0xa3c9('0xa'));var client=jayson[_0xa3c9('0xb')][_0xa3c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x163d4e,_0x44c89e,_0xb765f8){return new BPromise(function(_0x58b282,_0xd975c5){return client[_0xa3c9('0xd')](_0x163d4e,_0xb765f8)[_0xa3c9('0xe')](function(_0x21558d){logger[_0xa3c9('0xf')](_0xa3c9('0x10'),_0x44c89e,_0xa3c9('0x11'));logger[_0xa3c9('0x12')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x44c89e,'request\x20sent',JSON[_0xa3c9('0x13')](_0x21558d));if(_0x21558d[_0xa3c9('0x14')]){if(_0x21558d[_0xa3c9('0x14')][_0xa3c9('0x15')]===0x1f4){logger[_0xa3c9('0x14')](_0xa3c9('0x10'),_0x44c89e,_0x21558d[_0xa3c9('0x14')][_0xa3c9('0x16')]);return _0xd975c5(_0x21558d['error'][_0xa3c9('0x16')]);}logger[_0xa3c9('0x14')](_0xa3c9('0x10'),_0x44c89e,_0x21558d[_0xa3c9('0x14')]['message']);return _0x58b282(_0x21558d[_0xa3c9('0x14')][_0xa3c9('0x16')]);}else{logger[_0xa3c9('0xf')](_0xa3c9('0x10'),_0x44c89e,_0xa3c9('0x11'));_0x58b282(_0x21558d[_0xa3c9('0x17')][_0xa3c9('0x16')]);}})[_0xa3c9('0x18')](function(_0x5e8b94){logger[_0xa3c9('0x14')](_0xa3c9('0x10'),_0x44c89e,_0x5e8b94);_0xd975c5(_0x5e8b94);});});} \ No newline at end of file +var _0x7499=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b0324,_0x3b6c8b){var _0x2b6e2c=function(_0x4e2c74){while(--_0x4e2c74){_0x5b0324['push'](_0x5b0324['shift']());}};_0x2b6e2c(++_0x3b6c8b);}(_0x7499,0x162));var _0x9749=function(_0x192772,_0x100b16){_0x192772=_0x192772-0x0;var _0x2b50bd=_0x7499[_0x192772];return _0x2b50bd;};'use strict';var _=require(_0x9749('0x0'));var util=require(_0x9749('0x1'));var moment=require('moment');var BPromise=require(_0x9749('0x2'));var rs=require(_0x9749('0x3'));var fs=require('fs');var Redis=require(_0x9749('0x4'));var db=require(_0x9749('0x5'))['db'];var utils=require(_0x9749('0x6'));var logger=require(_0x9749('0x7'))(_0x9749('0x8'));var config=require('../../config/environment');var jayson=require(_0x9749('0x9'));var client=jayson[_0x9749('0xa')][_0x9749('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x111230,_0x3b3518,_0x46e895){return new BPromise(function(_0x523b4c,_0x35bba6){return client[_0x9749('0xc')](_0x111230,_0x46e895)[_0x9749('0xd')](function(_0x4a334b){logger[_0x9749('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3b3518,_0x9749('0xf'));logger[_0x9749('0x10')](_0x9749('0x11'),_0x3b3518,_0x9749('0xf'),JSON[_0x9749('0x12')](_0x4a334b));if(_0x4a334b['error']){if(_0x4a334b[_0x9749('0x13')][_0x9749('0x14')]===0x1f4){logger['error'](_0x9749('0x15'),_0x3b3518,_0x4a334b[_0x9749('0x13')][_0x9749('0x16')]);return _0x35bba6(_0x4a334b[_0x9749('0x13')][_0x9749('0x16')]);}logger[_0x9749('0x13')](_0x9749('0x15'),_0x3b3518,_0x4a334b[_0x9749('0x13')][_0x9749('0x16')]);return _0x523b4c(_0x4a334b[_0x9749('0x13')][_0x9749('0x16')]);}else{logger['info'](_0x9749('0x15'),_0x3b3518,'request\x20sent');_0x523b4c(_0x4a334b['result'][_0x9749('0x16')]);}})[_0x9749('0x17')](function(_0x11535b){logger[_0x9749('0x13')](_0x9749('0x15'),_0x3b3518,_0x11535b);_0x35bba6(_0x11535b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 55afa29..c978c9e 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 _0x68ce=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','/:id','delete','destroy','multer'];(function(_0x2e8327,_0x234b20){var _0x9f4f1f=function(_0x5eba82){while(--_0x5eba82){_0x2e8327['push'](_0x2e8327['shift']());}};_0x9f4f1f(++_0x234b20);}(_0x68ce,0x1d0));var _0xe68c=function(_0x1833dc,_0x121d9d){_0x1833dc=_0x1833dc-0x0;var _0x77da96=_0x68ce[_0x1833dc];return _0x77da96;};'use strict';var multer=require(_0xe68c('0x0'));var util=require(_0xe68c('0x1'));var path=require('path');var timeout=require(_0xe68c('0x2'));var express=require('express');var router=express[_0xe68c('0x3')]();var fs_extra=require(_0xe68c('0x4'));var auth=require(_0xe68c('0x5'));var interaction=require(_0xe68c('0x6'));var config=require(_0xe68c('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0xe68c('0x8')]('/',auth[_0xe68c('0x9')](),controller[_0xe68c('0xa')]);router[_0xe68c('0x8')]('/describe',auth[_0xe68c('0x9')](),controller['describe']);router[_0xe68c('0x8')]('/:id',auth[_0xe68c('0x9')](),controller['show']);router['post']('/',auth[_0xe68c('0x9')](),controller[_0xe68c('0xb')]);router['put'](_0xe68c('0xc'),auth[_0xe68c('0x9')](),controller['update']);router[_0xe68c('0xd')]('/:id',auth[_0xe68c('0x9')](),controller[_0xe68c('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc122=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x3f7b22,_0x175ded){var _0x368795=function(_0x5a4255){while(--_0x5a4255){_0x3f7b22['push'](_0x3f7b22['shift']());}};_0x368795(++_0x175ded);}(_0xc122,0xeb));var _0x2c12=function(_0x203a1d,_0x948ac6){_0x203a1d=_0x203a1d-0x0;var _0xbedaa0=_0xc122[_0x203a1d];return _0xbedaa0;};'use strict';var multer=require(_0x2c12('0x0'));var util=require(_0x2c12('0x1'));var path=require(_0x2c12('0x2'));var timeout=require(_0x2c12('0x3'));var express=require(_0x2c12('0x4'));var router=express[_0x2c12('0x5')]();var fs_extra=require(_0x2c12('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2c12('0x7'));var config=require('../../config/environment');var controller=require(_0x2c12('0x8'));router[_0x2c12('0x9')]('/',auth[_0x2c12('0xa')](),controller['index']);router[_0x2c12('0x9')](_0x2c12('0xb'),auth[_0x2c12('0xa')](),controller[_0x2c12('0xc')]);router[_0x2c12('0x9')](_0x2c12('0xd'),auth[_0x2c12('0xa')](),controller[_0x2c12('0xe')]);router[_0x2c12('0xf')]('/',auth[_0x2c12('0xa')](),controller[_0x2c12('0x10')]);router[_0x2c12('0x11')]('/:id',auth[_0x2c12('0xa')](),controller[_0x2c12('0x12')]);router[_0x2c12('0x13')]('/:id',auth[_0x2c12('0xa')](),controller['destroy']);module[_0x2c12('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 80ad4b2..2e13b69 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 _0x8fc1=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x2eade6,_0x312412){var _0x446fe3=function(_0x280ef2){while(--_0x280ef2){_0x2eade6['push'](_0x2eade6['shift']());}};_0x446fe3(++_0x312412);}(_0x8fc1,0x174));var _0x18fc=function(_0x9389fe,_0x1c7a89){_0x9389fe=_0x9389fe-0x0;var _0x265f78=_0x8fc1[_0x9389fe];return _0x265f78;};'use strict';var Sequelize=require(_0x18fc('0x0'));module[_0x18fc('0x1')]={'name':{'type':Sequelize[_0x18fc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x18fc('0x3')](_0x18fc('0x4'),_0x18fc('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x18fc('0x2')]},'timeout':{'type':Sequelize[_0x18fc('0x6')]}}; \ No newline at end of file +var _0x0a3a=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x5c130a,_0x3d930c){var _0x195975=function(_0x4414fd){while(--_0x4414fd){_0x5c130a['push'](_0x5c130a['shift']());}};_0x195975(++_0x3d930c);}(_0x0a3a,0x101));var _0xa0a3=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0x0a3a[_0x57cbfb];return _0x4cb933;};'use strict';var Sequelize=require(_0xa0a3('0x0'));module['exports']={'name':{'type':Sequelize[_0xa0a3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa0a3('0x2')](_0xa0a3('0x3'),_0xa0a3('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xa0a3('0x1')]},'timeout':{'type':Sequelize[_0xa0a3('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a9418ec..e18e94e 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 _0x6075=['body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','show','params','model','keys','ChatProactiveAction','query','filters','intersection','fields','attributes','includeAll','include','merge','find','create'];(function(_0x47b8ef,_0x557dd9){var _0x240c8d=function(_0x1ed5e9){while(--_0x1ed5e9){_0x47b8ef['push'](_0x47b8ef['shift']());}};_0x240c8d(++_0x557dd9);}(_0x6075,0x191));var _0x5607=function(_0x1e3bb6,_0x1fa8a8){_0x1e3bb6=_0x1e3bb6-0x0;var _0x36cdd5=_0x6075[_0x1e3bb6];return _0x36cdd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5607('0x0'));var zipdir=require(_0x5607('0x1'));var jsonpatch=require(_0x5607('0x2'));var rp=require(_0x5607('0x3'));var moment=require(_0x5607('0x4'));var BPromise=require(_0x5607('0x5'));var Mustache=require(_0x5607('0x6'));var util=require(_0x5607('0x7'));var path=require(_0x5607('0x8'));var sox=require('sox');var csv=require(_0x5607('0x9'));var ejs=require(_0x5607('0xa'));var fs=require('fs');var fs_extra=require(_0x5607('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5607('0xc'));var jsforce=require(_0x5607('0xd'));var deskjs=require(_0x5607('0xe'));var toCsv=require(_0x5607('0x9'));var querystring=require(_0x5607('0xf'));var Papa=require('papaparse');var Redis=require(_0x5607('0x10'));var authService=require(_0x5607('0x11'));var qs=require(_0x5607('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5607('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5607('0x14'));var config=require(_0x5607('0x15'));var licenseUtil=require(_0x5607('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c8013,_0x42a405){_0x42a405=_0x42a405||0xcc;return function(_0xc534bd){if(_0xc534bd){return _0x2c8013[_0x5607('0x17')](_0x42a405);}return _0x2c8013[_0x5607('0x18')](_0x42a405)[_0x5607('0x19')]();};}function respondWithResult(_0x138d74,_0x1c8cbc){_0x1c8cbc=_0x1c8cbc||0xc8;return function(_0x2daf4c){if(_0x2daf4c){return _0x138d74['status'](_0x1c8cbc)[_0x5607('0x1a')](_0x2daf4c);}};}function respondWithFilteredResult(_0x275c5d,_0xe3e004){return function(_0x505b12){if(_0x505b12){var _0x556397=typeof _0xe3e004[_0x5607('0x1b')]==='undefined'&&typeof _0xe3e004[_0x5607('0x1c')]===_0x5607('0x1d');var _0x1fa238=_0x505b12[_0x5607('0x1e')];var _0x3eaaa0=_0x556397?0x0:_0xe3e004[_0x5607('0x1b')];var _0x55689e=_0x556397?_0x505b12[_0x5607('0x1e')]:_0xe3e004['offset']+_0xe3e004[_0x5607('0x1c')];var _0x3e071b;if(_0x55689e>=_0x1fa238){_0x55689e=_0x1fa238;_0x3e071b=0xc8;}else{_0x3e071b=0xce;}_0x275c5d[_0x5607('0x18')](_0x3e071b);return _0x275c5d['set'](_0x5607('0x1f'),_0x3eaaa0+'-'+_0x55689e+'/'+_0x1fa238)[_0x5607('0x1a')](_0x505b12);}return null;};}function patchUpdates(_0x303089){return function(_0x4e66f0){try{jsonpatch[_0x5607('0x20')](_0x4e66f0,_0x303089,!![]);}catch(_0x2fdc13){return BPromise[_0x5607('0x21')](_0x2fdc13);}return _0x4e66f0['save']();};}function saveUpdates(_0x44f7a2,_0x4feb1c){return function(_0x49f918){if(_0x49f918){return _0x49f918[_0x5607('0x22')](_0x44f7a2)[_0x5607('0x23')](function(_0x32d30a){return _0x32d30a;});}return null;};}function removeEntity(_0x2d983f,_0x351c32){return function(_0x34df69){if(_0x34df69){return _0x34df69[_0x5607('0x24')]()[_0x5607('0x23')](function(){_0x2d983f[_0x5607('0x18')](0xcc)[_0x5607('0x19')]();});}};}function handleEntityNotFound(_0x593df7,_0x20ae60){return function(_0x27e144){if(!_0x27e144){_0x593df7['sendStatus'](0x194);}return _0x27e144;};}function handleError(_0xa83081,_0x14dd08){_0x14dd08=_0x14dd08||0x1f4;return function(_0xdb07c8){logger[_0x5607('0x25')](_0xdb07c8[_0x5607('0x26')]);if(_0xdb07c8[_0x5607('0x27')]){delete _0xdb07c8[_0x5607('0x27')];}_0xa83081[_0x5607('0x18')](_0x14dd08)['send'](_0xdb07c8);};}exports[_0x5607('0x28')]=function(_0x309ede,_0x51b7d5){var _0x5932ae={'raw':!![],'where':{'id':_0x309ede[_0x5607('0x29')]['id']}},_0x12f58f={};_0x12f58f[_0x5607('0x2a')]=_[_0x5607('0x2b')](db[_0x5607('0x2c')]['rawAttributes']);_0x12f58f[_0x5607('0x2d')]=_['keys'](_0x309ede[_0x5607('0x2d')]);_0x12f58f[_0x5607('0x2e')]=_[_0x5607('0x2f')](_0x12f58f['model'],_0x12f58f[_0x5607('0x2d')]);_0x5932ae['attributes']=_[_0x5607('0x2f')](_0x12f58f[_0x5607('0x2a')],qs[_0x5607('0x30')](_0x309ede[_0x5607('0x2d')][_0x5607('0x30')]));_0x5932ae['attributes']=_0x5932ae[_0x5607('0x31')]['length']?_0x5932ae[_0x5607('0x31')]:_0x12f58f[_0x5607('0x2a')];if(_0x309ede['query'][_0x5607('0x32')]){_0x5932ae[_0x5607('0x33')]=[{'all':!![]}];}_0x5932ae=_[_0x5607('0x34')]({},_0x5932ae,_0x309ede['options']);return db[_0x5607('0x2c')][_0x5607('0x35')](_0x5932ae)[_0x5607('0x23')](handleEntityNotFound(_0x51b7d5,null))[_0x5607('0x23')](respondWithResult(_0x51b7d5,null))['catch'](handleError(_0x51b7d5,null));};exports[_0x5607('0x36')]=function(_0x36bc31,_0x4f63ce){return db[_0x5607('0x2c')][_0x5607('0x36')](_0x36bc31[_0x5607('0x37')],{})['then'](respondWithResult(_0x4f63ce,0xc9))[_0x5607('0x38')](handleError(_0x4f63ce,null));};exports['update']=function(_0x2ed4c2,_0x287430){if(_0x2ed4c2[_0x5607('0x37')]['id']){delete _0x2ed4c2['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x2ed4c2[_0x5607('0x29')]['id']}})[_0x5607('0x23')](handleEntityNotFound(_0x287430,null))[_0x5607('0x23')](saveUpdates(_0x2ed4c2[_0x5607('0x37')],null))[_0x5607('0x23')](respondWithResult(_0x287430,null))[_0x5607('0x38')](handleError(_0x287430,null));};exports[_0x5607('0x24')]=function(_0x2fa6bc,_0x54cc53){return db[_0x5607('0x2c')][_0x5607('0x35')]({'where':{'id':_0x2fa6bc[_0x5607('0x29')]['id']}})[_0x5607('0x23')](handleEntityNotFound(_0x54cc53,null))['then'](removeEntity(_0x54cc53,null))[_0x5607('0x38')](handleError(_0x54cc53,null));}; \ No newline at end of file +var _0x0763=['query','fields','attributes','length','includeAll','include','merge','options','find','create','body','catch','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','params','model','ChatProactiveAction','rawAttributes','keys','intersection'];(function(_0x1ef320,_0x41ba4c){var _0x2514c3=function(_0x3baf46){while(--_0x3baf46){_0x1ef320['push'](_0x1ef320['shift']());}};_0x2514c3(++_0x41ba4c);}(_0x0763,0x87));var _0x3076=function(_0x5933fb,_0x9115ad){_0x5933fb=_0x5933fb-0x0;var _0x44d988=_0x0763[_0x5933fb];return _0x44d988;};'use strict';var emlformat=require(_0x3076('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3076('0x1'));var jsonpatch=require(_0x3076('0x2'));var rp=require('request-promise');var moment=require(_0x3076('0x3'));var BPromise=require(_0x3076('0x4'));var Mustache=require(_0x3076('0x5'));var util=require(_0x3076('0x6'));var path=require('path');var sox=require(_0x3076('0x7'));var csv=require(_0x3076('0x8'));var ejs=require(_0x3076('0x9'));var fs=require('fs');var fs_extra=require(_0x3076('0xa'));var _=require(_0x3076('0xb'));var squel=require(_0x3076('0xc'));var crypto=require(_0x3076('0xd'));var jsforce=require(_0x3076('0xe'));var deskjs=require(_0x3076('0xf'));var toCsv=require(_0x3076('0x8'));var querystring=require('querystring');var Papa=require(_0x3076('0x10'));var Redis=require(_0x3076('0x11'));var authService=require(_0x3076('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3076('0x13'));var logger=require(_0x3076('0x14'))(_0x3076('0x15'));var utils=require(_0x3076('0x16'));var config=require(_0x3076('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3076('0x18'))['db'];function respondWithStatusCode(_0x209fc0,_0x2fe9d1){_0x2fe9d1=_0x2fe9d1||0xcc;return function(_0xc917fd){if(_0xc917fd){return _0x209fc0[_0x3076('0x19')](_0x2fe9d1);}return _0x209fc0[_0x3076('0x1a')](_0x2fe9d1)[_0x3076('0x1b')]();};}function respondWithResult(_0x3a6f74,_0x54ff6a){_0x54ff6a=_0x54ff6a||0xc8;return function(_0x5542c7){if(_0x5542c7){return _0x3a6f74[_0x3076('0x1a')](_0x54ff6a)[_0x3076('0x1c')](_0x5542c7);}};}function respondWithFilteredResult(_0x3bc84d,_0x1b2256){return function(_0x5a2088){if(_0x5a2088){var _0x5bf9ec=typeof _0x1b2256[_0x3076('0x1d')]===_0x3076('0x1e')&&typeof _0x1b2256[_0x3076('0x1f')]===_0x3076('0x1e');var _0x3d56fe=_0x5a2088[_0x3076('0x20')];var _0x21c242=_0x5bf9ec?0x0:_0x1b2256[_0x3076('0x1d')];var _0x1880b8=_0x5bf9ec?_0x5a2088[_0x3076('0x20')]:_0x1b2256[_0x3076('0x1d')]+_0x1b2256[_0x3076('0x1f')];var _0x4e441d;if(_0x1880b8>=_0x3d56fe){_0x1880b8=_0x3d56fe;_0x4e441d=0xc8;}else{_0x4e441d=0xce;}_0x3bc84d[_0x3076('0x1a')](_0x4e441d);return _0x3bc84d[_0x3076('0x21')]('Content-Range',_0x21c242+'-'+_0x1880b8+'/'+_0x3d56fe)[_0x3076('0x1c')](_0x5a2088);}return null;};}function patchUpdates(_0x50f366){return function(_0x34c831){try{jsonpatch[_0x3076('0x22')](_0x34c831,_0x50f366,!![]);}catch(_0x1f8914){return BPromise['reject'](_0x1f8914);}return _0x34c831[_0x3076('0x23')]();};}function saveUpdates(_0x250cc4,_0x2398f4){return function(_0x9b4bec){if(_0x9b4bec){return _0x9b4bec[_0x3076('0x24')](_0x250cc4)[_0x3076('0x25')](function(_0x1a2131){return _0x1a2131;});}return null;};}function removeEntity(_0xa975bc,_0x195606){return function(_0x39a33c){if(_0x39a33c){return _0x39a33c['destroy']()[_0x3076('0x25')](function(){_0xa975bc['status'](0xcc)[_0x3076('0x1b')]();});}};}function handleEntityNotFound(_0x4f4bdc,_0x53b45d){return function(_0x41ecf4){if(!_0x41ecf4){_0x4f4bdc[_0x3076('0x19')](0x194);}return _0x41ecf4;};}function handleError(_0x2f0848,_0x1b169b){_0x1b169b=_0x1b169b||0x1f4;return function(_0x28d834){logger[_0x3076('0x26')](_0x28d834[_0x3076('0x27')]);if(_0x28d834[_0x3076('0x28')]){delete _0x28d834[_0x3076('0x28')];}_0x2f0848[_0x3076('0x1a')](_0x1b169b)[_0x3076('0x29')](_0x28d834);};}exports['show']=function(_0x181591,_0x45805e){var _0x32bdbd={'raw':!![],'where':{'id':_0x181591[_0x3076('0x2a')]['id']}},_0x5af88e={};_0x5af88e[_0x3076('0x2b')]=_['keys'](db[_0x3076('0x2c')][_0x3076('0x2d')]);_0x5af88e['query']=_[_0x3076('0x2e')](_0x181591['query']);_0x5af88e['filters']=_[_0x3076('0x2f')](_0x5af88e[_0x3076('0x2b')],_0x5af88e[_0x3076('0x30')]);_0x32bdbd['attributes']=_[_0x3076('0x2f')](_0x5af88e[_0x3076('0x2b')],qs[_0x3076('0x31')](_0x181591[_0x3076('0x30')]['fields']));_0x32bdbd[_0x3076('0x32')]=_0x32bdbd[_0x3076('0x32')][_0x3076('0x33')]?_0x32bdbd[_0x3076('0x32')]:_0x5af88e[_0x3076('0x2b')];if(_0x181591['query'][_0x3076('0x34')]){_0x32bdbd[_0x3076('0x35')]=[{'all':!![]}];}_0x32bdbd=_[_0x3076('0x36')]({},_0x32bdbd,_0x181591[_0x3076('0x37')]);return db[_0x3076('0x2c')][_0x3076('0x38')](_0x32bdbd)['then'](handleEntityNotFound(_0x45805e,null))[_0x3076('0x25')](respondWithResult(_0x45805e,null))['catch'](handleError(_0x45805e,null));};exports[_0x3076('0x39')]=function(_0x1d6b0b,_0x605784){return db[_0x3076('0x2c')][_0x3076('0x39')](_0x1d6b0b[_0x3076('0x3a')],{})[_0x3076('0x25')](respondWithResult(_0x605784,0xc9))[_0x3076('0x3b')](handleError(_0x605784,null));};exports[_0x3076('0x24')]=function(_0x2c912c,_0x2ea216){if(_0x2c912c[_0x3076('0x3a')]['id']){delete _0x2c912c[_0x3076('0x3a')]['id'];}return db[_0x3076('0x2c')][_0x3076('0x38')]({'where':{'id':_0x2c912c[_0x3076('0x2a')]['id']}})[_0x3076('0x25')](handleEntityNotFound(_0x2ea216,null))[_0x3076('0x25')](saveUpdates(_0x2c912c[_0x3076('0x3a')],null))[_0x3076('0x25')](respondWithResult(_0x2ea216,null))[_0x3076('0x3b')](handleError(_0x2ea216,null));};exports[_0x3076('0x3c')]=function(_0x431681,_0x852954){return db[_0x3076('0x2c')][_0x3076('0x38')]({'where':{'id':_0x431681[_0x3076('0x2a')]['id']}})['then'](handleEntityNotFound(_0x852954,null))[_0x3076('0x25')](removeEntity(_0x852954,null))[_0x3076('0x3b')](handleError(_0x852954,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 4153879..79865b7 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 _0xf135=['path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0xf135,0x1ab));var _0x5f13=function(_0xb0bfcc,_0x40074c){_0xb0bfcc=_0xb0bfcc-0x0;var _0x5589ca=_0xf135[_0xb0bfcc];return _0x5589ca;};'use strict';var _=require(_0x5f13('0x0'));var util=require(_0x5f13('0x1'));var logger=require(_0x5f13('0x2'))(_0x5f13('0x3'));var moment=require(_0x5f13('0x4'));var BPromise=require(_0x5f13('0x5'));var rp=require(_0x5f13('0x6'));var fs=require('fs');var path=require(_0x5f13('0x7'));var rimraf=require(_0x5f13('0x8'));var config=require('../../config/environment');var attributes=require(_0x5f13('0x9'));module[_0x5f13('0xa')]=function(_0x53c227,_0x1418da){return _0x53c227[_0x5f13('0xb')](_0x5f13('0xc'),attributes,{'tableName':_0x5f13('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33b9=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0x1ff28e,_0x57cea9){var _0xd7f912=function(_0x8af845){while(--_0x8af845){_0x1ff28e['push'](_0x1ff28e['shift']());}};_0xd7f912(++_0x57cea9);}(_0x33b9,0x176));var _0x933b=function(_0x5c0a9d,_0xa63c66){_0x5c0a9d=_0x5c0a9d-0x0;var _0x32511b=_0x33b9[_0x5c0a9d];return _0x32511b;};'use strict';var _=require('lodash');var util=require(_0x933b('0x0'));var logger=require(_0x933b('0x1'))('api');var moment=require(_0x933b('0x2'));var BPromise=require(_0x933b('0x3'));var rp=require(_0x933b('0x4'));var fs=require('fs');var path=require(_0x933b('0x5'));var rimraf=require('rimraf');var config=require(_0x933b('0x6'));var attributes=require(_0x933b('0x7'));module[_0x933b('0x8')]=function(_0x4bae66,_0x3460e0){return _0x4bae66['define'](_0x933b('0x9'),attributes,{'tableName':_0x933b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 9a2022e..731dd5b 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 _0x8034=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8034,0x116));var _0x4803=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8034[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x4803('0x0'));var util=require(_0x4803('0x1'));var moment=require(_0x4803('0x2'));var BPromise=require(_0x4803('0x3'));var rs=require(_0x4803('0x4'));var fs=require('fs');var Redis=require(_0x4803('0x5'));var db=require(_0x4803('0x6'))['db'];var utils=require(_0x4803('0x7'));var logger=require(_0x4803('0x8'))(_0x4803('0x9'));var config=require(_0x4803('0xa'));var jayson=require(_0x4803('0xb'));var client=jayson[_0x4803('0xc')][_0x4803('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x258c0b,_0x1de49a,_0x3acc1d){return new BPromise(function(_0x3ec4d4,_0x6e2c29){return client[_0x4803('0xe')](_0x258c0b,_0x3acc1d)[_0x4803('0xf')](function(_0x52feaf){logger[_0x4803('0x10')](_0x4803('0x11'),_0x1de49a,_0x4803('0x12'));logger[_0x4803('0x13')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1de49a,_0x4803('0x12'),JSON['stringify'](_0x52feaf));if(_0x52feaf[_0x4803('0x14')]){if(_0x52feaf['error'][_0x4803('0x15')]===0x1f4){logger[_0x4803('0x14')](_0x4803('0x11'),_0x1de49a,_0x52feaf['error']['message']);return _0x6e2c29(_0x52feaf[_0x4803('0x14')][_0x4803('0x16')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x1de49a,_0x52feaf[_0x4803('0x14')][_0x4803('0x16')]);return _0x3ec4d4(_0x52feaf['error']['message']);}else{logger[_0x4803('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x1de49a,_0x4803('0x12'));_0x3ec4d4(_0x52feaf[_0x4803('0x17')]['message']);}})[_0x4803('0x18')](function(_0x4d8826){logger[_0x4803('0x14')](_0x4803('0x11'),_0x1de49a,_0x4d8826);_0x6e2c29(_0x4d8826);});});} \ No newline at end of file +var _0xab2c=['info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x57fb34,_0xcea273){var _0x45c164=function(_0x2215e8){while(--_0x2215e8){_0x57fb34['push'](_0x57fb34['shift']());}};_0x45c164(++_0xcea273);}(_0xab2c,0xfa));var _0xcab2=function(_0x1e09a1,_0x1c14f9){_0x1e09a1=_0x1e09a1-0x0;var _0x24ac77=_0xab2c[_0x1e09a1];return _0x24ac77;};'use strict';var _=require(_0xcab2('0x0'));var util=require(_0xcab2('0x1'));var moment=require(_0xcab2('0x2'));var BPromise=require(_0xcab2('0x3'));var rs=require(_0xcab2('0x4'));var fs=require('fs');var Redis=require(_0xcab2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcab2('0x6'));var logger=require(_0xcab2('0x7'))(_0xcab2('0x8'));var config=require(_0xcab2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcab2('0xa')][_0xcab2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a18b4,_0x86d2a7,_0x3aaddb){return new BPromise(function(_0xa9992,_0x442fef){return client[_0xcab2('0xc')](_0x3a18b4,_0x3aaddb)[_0xcab2('0xd')](function(_0x275433){logger[_0xcab2('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x86d2a7,_0xcab2('0xf'));logger[_0xcab2('0x10')](_0xcab2('0x11'),_0x86d2a7,_0xcab2('0xf'),JSON[_0xcab2('0x12')](_0x275433));if(_0x275433[_0xcab2('0x13')]){if(_0x275433[_0xcab2('0x13')][_0xcab2('0x14')]===0x1f4){logger[_0xcab2('0x13')](_0xcab2('0x15'),_0x86d2a7,_0x275433[_0xcab2('0x13')][_0xcab2('0x16')]);return _0x442fef(_0x275433[_0xcab2('0x13')][_0xcab2('0x16')]);}logger[_0xcab2('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x86d2a7,_0x275433[_0xcab2('0x13')][_0xcab2('0x16')]);return _0xa9992(_0x275433[_0xcab2('0x13')][_0xcab2('0x16')]);}else{logger[_0xcab2('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x86d2a7,'request\x20sent');_0xa9992(_0x275433['result'][_0xcab2('0x16')]);}})[_0xcab2('0x17')](function(_0xe3492c){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x86d2a7,_0xe3492c);_0x442fef(_0xe3492c);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 1c00960..c7ca501 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 _0x2eb2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put','update','delete','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x2eb2[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x22eb('0x7')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xa')]);router[_0x22eb('0xb')]('/',auth[_0x22eb('0x9')](),controller[_0x22eb('0xc')]);router[_0x22eb('0xd')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xe')]);router[_0x22eb('0xf')]('/:id',auth[_0x22eb('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x71ab=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x71ab,0x64));var _0xb71a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x71ab[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0xa')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xf')]);router[_0xb71a('0x10')]('/:id',auth[_0xb71a('0xa')](),controller['destroy']);module[_0xb71a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index d5eddc2..0f233c3 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 _0x7412=['beepall','roundrobin','sequelize','exports','name','INTEGER','rrmemory'];(function(_0x581867,_0x6fc93f){var _0x523210=function(_0x4b0db8){while(--_0x4b0db8){_0x581867['push'](_0x581867['shift']());}};_0x523210(++_0x6fc93f);}(_0x7412,0xc6));var _0x2741=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x7412[_0x22b68a];return _0x1ac67a;};'use strict';var Sequelize=require(_0x2741('0x0'));module[_0x2741('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2741('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2741('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2741('0x4'),_0x2741('0x5'),_0x2741('0x6'))}}; \ No newline at end of file +var _0x0c29=['exports','name','STRING','rrmemory','beepall','roundrobin','sequelize'];(function(_0x20ae15,_0x2f9b11){var _0x45573b=function(_0x4b4c2d){while(--_0x4b4c2d){_0x20ae15['push'](_0x20ae15['shift']());}};_0x45573b(++_0x2f9b11);}(_0x0c29,0x164));var _0x90c2=function(_0x48326a,_0x8cfa0c){_0x48326a=_0x48326a-0x0;var _0x466709=_0x0c29[_0x48326a];return _0x466709;};'use strict';var Sequelize=require(_0x90c2('0x0'));module[_0x90c2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x90c2('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x90c2('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x90c2('0x4'),_0x90c2('0x5'),_0x90c2('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4f9fcb0..65607e4 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 _0xb1cf=['userChatQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','sendStatus','status','offset','undefined','limit','count','json','update','then','ChatQueues','UserProfileResource','destroy','error','name','index','map','rawAttributes','type','key','where','ChatQueue','include','rows','catch','params','keys','query','intersection','model','attributes','fields','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','filters','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','findOne','Team','addTeams','ids','findAll','User','Agents','online','interface','flatMap','transaction','each','findOrCreate','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','forEach','addAgents','omit','spread','emit'];(function(_0x1224a4,_0x4c8735){var _0x3a1d84=function(_0x2f9098){while(--_0x2f9098){_0x1224a4['push'](_0x1224a4['shift']());}};_0x3a1d84(++_0x4c8735);}(_0xb1cf,0x1da));var _0xfb1c=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0xb1cf[_0x31df6f];return _0x31e353;};'use strict';var BPromise=require(_0xfb1c('0x0'));var util=require(_0xfb1c('0x1'));var _=require(_0xfb1c('0x2'));var squel=require(_0xfb1c('0x3'));var Redis=require(_0xfb1c('0x4'));var qs=require(_0xfb1c('0x5'));var logger=require('../../config/logger')('api');var config=require(_0xfb1c('0x6'));var db=require('../../mysqldb')['db'];config[_0xfb1c('0x7')]=_[_0xfb1c('0x8')](config[_0xfb1c('0x7')],{'host':_0xfb1c('0x9'),'port':0x18eb});var socket=require(_0xfb1c('0xa'))(new Redis(config[_0xfb1c('0x7')]));require(_0xfb1c('0xb'))['register'](socket);function respondWithStatusCode(_0x4a8d66,_0x1ff2a1){_0x1ff2a1=_0x1ff2a1||0xcc;return function(_0x384f9b){if(_0x384f9b){return _0x4a8d66[_0xfb1c('0xc')](_0x1ff2a1);}return _0x4a8d66[_0xfb1c('0xd')](_0x1ff2a1)['end']();};}function respondWithResult(_0x1bc22a,_0x539cc7){_0x539cc7=_0x539cc7||0xc8;return function(_0x35e685){if(_0x35e685){return _0x1bc22a[_0xfb1c('0xd')](_0x539cc7)['json'](_0x35e685);}};}function respondWithFilteredResult(_0x4d5d96,_0xbf9d2c){return function(_0x34331e){if(_0x34331e){var _0x25f541=typeof _0xbf9d2c[_0xfb1c('0xe')]===_0xfb1c('0xf')&&typeof _0xbf9d2c[_0xfb1c('0x10')]==='undefined';var _0x213493=_0x34331e[_0xfb1c('0x11')];var _0x2bb7f1=_0x25f541?0x0:_0xbf9d2c[_0xfb1c('0xe')];var _0x283ec0=_0x25f541?_0x34331e[_0xfb1c('0x11')]:_0xbf9d2c['offset']+_0xbf9d2c[_0xfb1c('0x10')];var _0x4eae48;if(_0x283ec0>=_0x213493){_0x283ec0=_0x213493;_0x4eae48=0xc8;}else{_0x4eae48=0xce;}_0x4d5d96[_0xfb1c('0xd')](_0x4eae48);return _0x4d5d96['set']('Content-Range',_0x2bb7f1+'-'+_0x283ec0+'/'+_0x213493)[_0xfb1c('0x12')](_0x34331e);}return null;};}function saveUpdates(_0x24580b){return function(_0x783781){if(_0x783781){return _0x783781[_0xfb1c('0x13')](_0x24580b)[_0xfb1c('0x14')](function(_0x3c7162){return _0x3c7162;});}return null;};}function removeEntity(_0x3c6a82){return function(_0x4e01a0){if(_0x4e01a0){return _0x4e01a0['destroy']()[_0xfb1c('0x14')](function(){var _0x26aea8=_0x4e01a0['get']({'plain':!![]});var _0x58f3cf=_0xfb1c('0x15');return db[_0xfb1c('0x16')][_0xfb1c('0x17')]({'where':{'type':_0x58f3cf,'resourceId':_0x26aea8['id']}})[_0xfb1c('0x14')](function(){return _0x4e01a0;});})[_0xfb1c('0x14')](function(){_0x3c6a82[_0xfb1c('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13649c){return function(_0x5577b8){if(!_0x5577b8){_0x13649c[_0xfb1c('0xc')](0x194);}return _0x5577b8;};}function handleError(_0x47937d,_0x5d5b69){_0x5d5b69=_0x5d5b69||0x1f4;return function(_0x26b9de){logger[_0xfb1c('0x18')](_0x26b9de['stack']);if(_0x26b9de['name']){delete _0x26b9de[_0xfb1c('0x19')];}_0x47937d[_0xfb1c('0xd')](_0x5d5b69)['send'](_0x26b9de);};}exports[_0xfb1c('0x1a')]=function(_0x2a0ea9,_0x4727bf){var _0x1b32ed={};var _0x14b0ac={'count':0x0,'rows':[]};var _0x166527=_[_0xfb1c('0x1b')](db['ChatQueue'][_0xfb1c('0x1c')],function(_0x471217){return{'name':_0x471217['fieldName'],'type':_0x471217[_0xfb1c('0x1d')][_0xfb1c('0x1e')]};});_0x1b32ed=qs['getOptions'](_0x166527,_0x2a0ea9);var _0x9ef7bf={'where':_0x1b32ed[_0xfb1c('0x1f')]};return db[_0xfb1c('0x20')][_0xfb1c('0x11')](_0x9ef7bf)['then'](function(_0x404239){_0x14b0ac['count']=_0x404239;_0x1b32ed[_0xfb1c('0x21')]=qs['include'](_0x2a0ea9['query']);return db[_0xfb1c('0x20')]['findAll'](_0x1b32ed);})[_0xfb1c('0x14')](function(_0x5282d9){_0x14b0ac[_0xfb1c('0x22')]=_0x5282d9;return _0x14b0ac;})[_0xfb1c('0x14')](respondWithFilteredResult(_0x4727bf,_0x1b32ed))[_0xfb1c('0x23')](handleError(_0x4727bf,null));};exports['show']=function(_0x1f5943,_0x3c6588){var _0x5f5a67={'raw':!![],'where':{'id':_0x1f5943[_0xfb1c('0x24')]['id']}},_0x5f456d={};_0x5f456d['model']=_[_0xfb1c('0x25')](db[_0xfb1c('0x20')][_0xfb1c('0x1c')]);_0x5f456d[_0xfb1c('0x26')]=_[_0xfb1c('0x25')](_0x1f5943['query']);_0x5f456d['filters']=_[_0xfb1c('0x27')](_0x5f456d[_0xfb1c('0x28')],_0x5f456d['query']);_0x5f5a67[_0xfb1c('0x29')]=_[_0xfb1c('0x27')](_0x5f456d[_0xfb1c('0x28')],qs[_0xfb1c('0x2a')](_0x1f5943[_0xfb1c('0x26')]['fields']));_0x5f5a67[_0xfb1c('0x29')]=_0x5f5a67['attributes'][_0xfb1c('0x2b')]?_0x5f5a67[_0xfb1c('0x29')]:_0x5f456d[_0xfb1c('0x28')];if(_0x1f5943['query'][_0xfb1c('0x2c')]){_0x5f5a67[_0xfb1c('0x21')]=[{'all':!![]}];}_0x5f5a67=_['merge']({},_0x5f5a67,_0x1f5943['options']);return db[_0xfb1c('0x20')][_0xfb1c('0x2d')](_0x5f5a67)[_0xfb1c('0x14')](handleEntityNotFound(_0x3c6588,null))['then'](respondWithResult(_0x3c6588,null))['catch'](handleError(_0x3c6588,null));};exports[_0xfb1c('0x2e')]=function(_0x4201e7,_0x43dabc){return db[_0xfb1c('0x20')][_0xfb1c('0x2e')](_0x4201e7[_0xfb1c('0x2f')],{})['then'](function(_0x571111){var _0x10f836=_0x4201e7[_0xfb1c('0x30')][_0xfb1c('0x31')]({'plain':!![]});if(!_0x10f836)throw new Error(_0xfb1c('0x32'));if(_0x10f836[_0xfb1c('0x33')]==='user'){var _0x41bf42=_0x571111[_0xfb1c('0x31')]({'plain':!![]});var _0x5c82c3=_0xfb1c('0x15');return db['UserProfileSection']['find']({'where':{'name':_0x5c82c3,'userProfileId':_0x10f836[_0xfb1c('0x34')]},'raw':!![]})['then'](function(_0x193218){if(_0x193218&&_0x193218[_0xfb1c('0x35')]===0x0){return db[_0xfb1c('0x16')][_0xfb1c('0x2e')]({'name':_0x41bf42[_0xfb1c('0x19')],'resourceId':_0x41bf42['id'],'type':_0x193218['name'],'sectionId':_0x193218['id']},{})[_0xfb1c('0x14')](function(){return _0x571111;});}else{return _0x571111;}})['catch'](function(_0x28eb2b){logger[_0xfb1c('0x18')](_0xfb1c('0x36'),_0x28eb2b);throw _0x28eb2b;});}return _0x571111;})[_0xfb1c('0x14')](respondWithResult(_0x43dabc,0xc9))['catch'](handleError(_0x43dabc,null));};exports[_0xfb1c('0x13')]=function(_0xcaedcd,_0x2c5b0d){if(_0xcaedcd[_0xfb1c('0x2f')]['id']){delete _0xcaedcd['body']['id'];}return db[_0xfb1c('0x20')]['find']({'where':{'id':_0xcaedcd[_0xfb1c('0x24')]['id']}})[_0xfb1c('0x14')](handleEntityNotFound(_0x2c5b0d,null))[_0xfb1c('0x14')](saveUpdates(_0xcaedcd['body'],null))[_0xfb1c('0x14')](respondWithResult(_0x2c5b0d,null))[_0xfb1c('0x23')](handleError(_0x2c5b0d,null));};exports[_0xfb1c('0x17')]=function(_0x3e2301,_0x4f1e3b){return db[_0xfb1c('0x20')][_0xfb1c('0x2d')]({'where':{'id':_0x3e2301[_0xfb1c('0x24')]['id']}})[_0xfb1c('0x14')](handleEntityNotFound(_0x4f1e3b,null))[_0xfb1c('0x14')](removeEntity(_0x4f1e3b,null))[_0xfb1c('0x23')](handleError(_0x4f1e3b,null));};exports[_0xfb1c('0x37')]=function(_0x16b5fb,_0x15c69b){return db['ChatQueue']['describe']()['then'](respondWithResult(_0x15c69b,null))['catch'](handleError(_0x15c69b,null));};exports[_0xfb1c('0x38')]=function(_0x43ed1f,_0xe96732){var _0x1f9159={'raw':!![],'where':{}},_0x3ded0a={},_0x2caf7d;return db[_0xfb1c('0x20')]['findOne']({'where':{'id':_0x43ed1f['params']['id']}})[_0xfb1c('0x14')](handleEntityNotFound(_0xe96732,null))['then'](function(_0x3d6bde){if(_0x3d6bde){_0x2caf7d=_0x3d6bde[_0xfb1c('0x31')]({'plain':!![]});_0x3ded0a[_0xfb1c('0x28')]=_[_0xfb1c('0x25')](db[_0xfb1c('0x39')]['rawAttributes']);_0x3ded0a[_0xfb1c('0x26')]=_['keys'](_0x43ed1f[_0xfb1c('0x26')]);_0x3ded0a[_0xfb1c('0x3a')]=_[_0xfb1c('0x27')](_0x3ded0a[_0xfb1c('0x28')],_0x3ded0a['query']);_0x1f9159[_0xfb1c('0x29')]=_['intersection'](_0x3ded0a[_0xfb1c('0x28')],qs['fields'](_0x43ed1f['query']['fields']));_0x1f9159[_0xfb1c('0x29')]=_0x1f9159[_0xfb1c('0x29')][_0xfb1c('0x2b')]?_0x1f9159['attributes']:_0x3ded0a[_0xfb1c('0x28')];if(!_0x43ed1f['query'][_0xfb1c('0x3b')](_0xfb1c('0x3c'))){_0x1f9159[_0xfb1c('0x10')]=qs[_0xfb1c('0x10')](_0x43ed1f[_0xfb1c('0x26')][_0xfb1c('0x10')]);_0x1f9159['offset']=qs[_0xfb1c('0xe')](_0x43ed1f[_0xfb1c('0x26')]['offset']);}_0x1f9159[_0xfb1c('0x3d')]=qs[_0xfb1c('0x3e')](_0x43ed1f[_0xfb1c('0x26')][_0xfb1c('0x3e')]);_0x1f9159['where']=qs[_0xfb1c('0x3a')](_[_0xfb1c('0x3f')](_0x43ed1f[_0xfb1c('0x26')],_0x3ded0a[_0xfb1c('0x3a')]));_0x1f9159[_0xfb1c('0x1f')]['ChatQueueId']=_0x3d6bde['id'];if(_0x43ed1f[_0xfb1c('0x26')][_0xfb1c('0x40')]){_0x1f9159['where']=_['merge'](_0x1f9159['where'],{'$or':_[_0xfb1c('0x1b')](_0x1f9159[_0xfb1c('0x29')],function(_0x546320){var _0x45328c={};_0x45328c[_0x546320]={'$like':'%'+_0x43ed1f['query'][_0xfb1c('0x40')]+'%'};return _0x45328c;})});}_0x1f9159=_[_0xfb1c('0x41')]({},_0x1f9159,_0x43ed1f[_0xfb1c('0x42')]);return db[_0xfb1c('0x39')]['findAll'](_0x1f9159);}})[_0xfb1c('0x14')](function(_0x2e5785){if(_0x2e5785){return db['User'][_0xfb1c('0x43')]({'where':{'id':_['map'](_0x2e5785,_0xfb1c('0x44')),'role':_0xfb1c('0x45')},'attributes':['id',_0xfb1c('0x19'),_0xfb1c('0x46'),_0xfb1c('0x47'),_0xfb1c('0x48')]});}})[_0xfb1c('0x14')](function(_0x38a796){if(_0x38a796){return{'count':_0x38a796[_0xfb1c('0x11')],'rows':_['map'](_0x38a796['rows'],function(_0x52f5c0){return{'membername':_0x52f5c0[_0xfb1c('0x19')],'UserId':_0x52f5c0['id'],'queue_name':_0x2caf7d[_0xfb1c('0x19')],'ChatQueueId':_0x2caf7d['id'],'interface':util[_0xfb1c('0x49')](_0xfb1c('0x4a'),'SIP',_0x52f5c0['name']),'penalty':0x0,'paused':_0x52f5c0['chatPause'],'createdAt':_0x52f5c0[_0xfb1c('0x48')],'updatedAt':_0x52f5c0[_0xfb1c('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfb1c('0x14')](respondWithFilteredResult(_0xe96732,_0x1f9159))[_0xfb1c('0x23')](handleError(_0xe96732,null));};exports['getTeams']=function(_0x249894,_0x428665){var _0x2eba0b={};var _0x333d74={};var _0xe7eccb;var _0x421207;return db[_0xfb1c('0x20')][_0xfb1c('0x4b')]({'where':{'id':_0x249894[_0xfb1c('0x24')]['id']}})[_0xfb1c('0x14')](handleEntityNotFound(_0x428665,null))['then'](function(_0x1aabfe){if(_0x1aabfe){_0xe7eccb=_0x1aabfe;_0x333d74[_0xfb1c('0x28')]=_[_0xfb1c('0x25')](db[_0xfb1c('0x4c')][_0xfb1c('0x1c')]);_0x333d74[_0xfb1c('0x26')]=_[_0xfb1c('0x25')](_0x249894['query']);_0x333d74['filters']=_[_0xfb1c('0x27')](_0x333d74[_0xfb1c('0x28')],_0x333d74[_0xfb1c('0x26')]);_0x2eba0b[_0xfb1c('0x29')]=_[_0xfb1c('0x27')](_0x333d74['model'],qs[_0xfb1c('0x2a')](_0x249894[_0xfb1c('0x26')]['fields']));_0x2eba0b[_0xfb1c('0x29')]=_0x2eba0b[_0xfb1c('0x29')][_0xfb1c('0x2b')]?_0x2eba0b[_0xfb1c('0x29')]:_0x333d74[_0xfb1c('0x28')];_0x2eba0b[_0xfb1c('0x3d')]=qs['sort'](_0x249894[_0xfb1c('0x26')][_0xfb1c('0x3e')]);_0x2eba0b[_0xfb1c('0x1f')]=qs[_0xfb1c('0x3a')](_['pick'](_0x249894[_0xfb1c('0x26')],_0x333d74['filters']));if(_0x249894[_0xfb1c('0x26')][_0xfb1c('0x40')]){_0x2eba0b[_0xfb1c('0x1f')]=_[_0xfb1c('0x41')](_0x2eba0b['where'],{'$or':_[_0xfb1c('0x1b')](_0x2eba0b[_0xfb1c('0x29')],function(_0x17b3b4){var _0x4430d={};_0x4430d[_0x17b3b4]={'$like':'%'+_0x249894['query'][_0xfb1c('0x40')]+'%'};return _0x4430d;})});}_0x2eba0b=_[_0xfb1c('0x41')]({},_0x2eba0b,_0x249894[_0xfb1c('0x42')]);return _0xe7eccb['getTeams'](_0x2eba0b);}})[_0xfb1c('0x14')](function(_0x55995b){if(_0x55995b){_0x421207=_0x55995b['length'];if(!_0x249894[_0xfb1c('0x26')][_0xfb1c('0x3b')](_0xfb1c('0x3c'))){_0x2eba0b[_0xfb1c('0x10')]=qs[_0xfb1c('0x10')](_0x249894['query'][_0xfb1c('0x10')]);_0x2eba0b[_0xfb1c('0xe')]=qs[_0xfb1c('0xe')](_0x249894[_0xfb1c('0x26')]['offset']);}return _0xe7eccb['getTeams'](_0x2eba0b);}})[_0xfb1c('0x14')](function(_0x3712e4){if(_0x3712e4){return _0x3712e4?{'count':_0x421207,'rows':_0x3712e4}:null;}})[_0xfb1c('0x14')](respondWithResult(_0x428665,null))[_0xfb1c('0x23')](handleError(_0x428665,null));};exports[_0xfb1c('0x4d')]=function(_0x4f41a9,_0x3c849e){var _0x4d7dac=_0x4f41a9[_0xfb1c('0x2f')][_0xfb1c('0x4e')];return db['Team'][_0xfb1c('0x4f')]({'where':{'id':_0x4d7dac},'attributes':['id'],'include':[{'model':db[_0xfb1c('0x50')],'as':_0xfb1c('0x51'),'attributes':['id',_0xfb1c('0x19'),_0xfb1c('0x52'),'voicePause',_0xfb1c('0x53')],'raw':!![]}]})['then'](function(_0x543e71){if(_0x543e71){var _0x329517=_[_0xfb1c('0x54')](_0x543e71,function(_0x27594c){var _0x5aa868=_0x27594c['get']({'plain':!![]});return _0x5aa868['Agents'];});return db['ChatQueue'][_0xfb1c('0x2d')]({'where':{'id':_0x4f41a9[_0xfb1c('0x24')]['id']}})[_0xfb1c('0x14')](function(_0x48a76b){return db['sequelize'][_0xfb1c('0x55')](function(_0x59ab5f){return _0x48a76b[_0xfb1c('0x4d')](_0x4d7dac,{'transaction':_0x59ab5f})[_0xfb1c('0x14')](function(){return BPromise[_0xfb1c('0x56')](_0x329517,function(_0x273644){return db[_0xfb1c('0x39')][_0xfb1c('0x57')]({'where':{'UserId':_0x273644['id'],'ChatQueueId':_0x4f41a9[_0xfb1c('0x24')]['id']},'transaction':_0x59ab5f});});})['then'](function(){_0x329517['forEach'](function(_0x1ad08b){socket['emit'](_0xfb1c('0x58'),{'UserId':_0x1ad08b['id'],'ChatQueueId':_0x48a76b['id']});});});});});}})[_0xfb1c('0x14')](respondWithStatusCode(_0x3c849e,null))['catch'](handleError(_0x3c849e,null));};exports[_0xfb1c('0x59')]=function(_0x2765c1,_0x1403af){return db[_0xfb1c('0x4c')]['findAll']({'where':{'id':_0x2765c1[_0xfb1c('0x26')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfb1c('0x51'),'attributes':['id'],'raw':!![]}]})[_0xfb1c('0x14')](handleEntityNotFound(_0x1403af,null))[_0xfb1c('0x14')](function(_0x38f7bb){var _0x4afd6b=_[_0xfb1c('0x1b')](_0x38f7bb,'id');var _0x18be53=[];var _0xfd5b93=[];var _0x126370=squel[_0xfb1c('0x5a')]();_0x126370[_0xfb1c('0x5b')]('tq.TeamId')[_0xfb1c('0x5c')](_0xfb1c('0x5d'),'tq')['join'](_0xfb1c('0x5e'),'ut',_0xfb1c('0x5f'))[_0xfb1c('0x1f')](_0xfb1c('0x60'),_0x2765c1[_0xfb1c('0x24')]['id']);for(var _0x18b1ca=0x0;_0x18b1ca<_0x38f7bb[_0xfb1c('0x2b')];_0x18b1ca+=0x1){let _0x36cf63=_0x38f7bb[_0x18b1ca];for(var _0x1235c1=0x0;_0x1235c1<_0x36cf63[_0xfb1c('0x51')][_0xfb1c('0x2b')];_0x1235c1+=0x1){let _0x33061e=_0x36cf63['Agents'][_0x1235c1];var _0x288ace=_0x126370[_0xfb1c('0x61')]();_0x288ace[_0xfb1c('0x1f')](_0xfb1c('0x62'),_0x33061e['id']);_0xfd5b93[_0xfb1c('0x63')](db[_0xfb1c('0x64')][_0xfb1c('0x26')](_0x288ace[_0xfb1c('0x65')](),{'type':db[_0xfb1c('0x64')][_0xfb1c('0x66')][_0xfb1c('0x67')]})['then'](function(_0x171b52){if(_0x171b52[_0xfb1c('0x2b')]===0x1){return _0x33061e['id'];}else{var _0x615c60=_[_0xfb1c('0x68')](_[_0xfb1c('0x1b')](_0x171b52,_0xfb1c('0x69')),function(_0x413fdd){return _[_0xfb1c('0x6a')](_0x4afd6b,_0x413fdd);});if(_0x615c60){return _0x33061e['id'];}}}));}}return BPromise[_0xfb1c('0x6b')](_0xfd5b93)[_0xfb1c('0x14')](function(_0x28911f){_0x18be53=_(_0x18be53)[_0xfb1c('0x6c')](_0x28911f)['compact']()['value']();return db[_0xfb1c('0x20')][_0xfb1c('0x2d')]({'where':{'id':_0x2765c1[_0xfb1c('0x24')]['id']}})['then'](function(_0x58dd94){return db['sequelize'][_0xfb1c('0x55')](function(_0x4088e6){return _0x58dd94['removeTeams'](_0x2765c1[_0xfb1c('0x26')]['ids'],{'transaction':_0x4088e6})[_0xfb1c('0x14')](function(){if(!_[_0xfb1c('0x6d')](_0x18be53)){return _0x58dd94[_0xfb1c('0x6e')](_0x18be53,{'transaction':_0x4088e6});}})['then'](function(){_0x18be53[_0xfb1c('0x6f')](function(_0x1fd674){socket['emit']('userChatQueue:remove',{'UserId':_0x1fd674,'ChatQueueId':_0x58dd94['id']});});});});});});})[_0xfb1c('0x14')](respondWithStatusCode(_0x1403af,null))[_0xfb1c('0x23')](handleError(_0x1403af,null));};exports[_0xfb1c('0x70')]=function(_0x2d9f6d,_0x38689b){return db['ChatQueue'][_0xfb1c('0x2d')]({'where':{'id':_0x2d9f6d[_0xfb1c('0x24')]['id']}})['then'](handleEntityNotFound(_0x38689b,null))[_0xfb1c('0x14')](function(_0x48187c){if(_0x48187c){return _0x48187c[_0xfb1c('0x70')](_0x2d9f6d['body'][_0xfb1c('0x4e')],_[_0xfb1c('0x71')](_0x2d9f6d[_0xfb1c('0x2f')],['ids','id'])||{})[_0xfb1c('0x72')](function(_0x54768e){for(var _0x409ab6=0x0;_0x409ab6<_0x2d9f6d[_0xfb1c('0x2f')][_0xfb1c('0x4e')][_0xfb1c('0x2b')];_0x409ab6+=0x1){socket[_0xfb1c('0x73')]('userChatQueue:save',{'UserId':Number(_0x2d9f6d['body']['ids'][_0x409ab6]),'ChatQueueId':Number(_0x2d9f6d[_0xfb1c('0x24')]['id'])});}return _0x54768e;});}})['then'](respondWithResult(_0x38689b,null))[_0xfb1c('0x23')](handleError(_0x38689b,null));};exports[_0xfb1c('0x6e')]=function(_0x6fb7c7,_0x4df587){return db['ChatQueue']['find']({'where':{'id':_0x6fb7c7[_0xfb1c('0x24')]['id']}})[_0xfb1c('0x14')](handleEntityNotFound(_0x4df587,null))[_0xfb1c('0x14')](function(_0x453e6b){if(_0x453e6b){return _0x453e6b[_0xfb1c('0x6e')](_0x6fb7c7['query']['ids'])[_0xfb1c('0x14')](function(){if(_['isArray'](_0x6fb7c7['query']['ids'])){for(var _0x1e1f12=0x0;_0x1e1f12<_0x6fb7c7[_0xfb1c('0x26')][_0xfb1c('0x4e')]['length'];_0x1e1f12+=0x1){socket[_0xfb1c('0x73')](_0xfb1c('0x74'),{'UserId':Number(_0x6fb7c7['query'][_0xfb1c('0x4e')][_0x1e1f12]),'ChatQueueId':Number(_0x6fb7c7['params']['id'])});}}else{socket['emit'](_0xfb1c('0x74'),{'UserId':Number(_0x6fb7c7[_0xfb1c('0x26')]['ids']),'ChatQueueId':Number(_0x6fb7c7[_0xfb1c('0x24')]['id'])});}});}})['then'](respondWithStatusCode(_0x4df587,null))[_0xfb1c('0x23')](handleError(_0x4df587,null));};exports[_0xfb1c('0x75')]=function(_0x4cadaa,_0x9d9f95){var _0x864a56={};var _0x4a80e4={};var _0x43b434;var _0xa1a561;return db[_0xfb1c('0x20')][_0xfb1c('0x4b')]({'where':{'id':_0x4cadaa[_0xfb1c('0x24')]['id']}})[_0xfb1c('0x14')](handleEntityNotFound(_0x9d9f95,null))['then'](function(_0x3ede97){if(_0x3ede97){_0x43b434=_0x3ede97;_0x4a80e4['model']=_[_0xfb1c('0x25')](db[_0xfb1c('0x50')][_0xfb1c('0x1c')]);_0x4a80e4[_0xfb1c('0x26')]=_[_0xfb1c('0x25')](_0x4cadaa[_0xfb1c('0x26')]);_0x4a80e4['filters']=_[_0xfb1c('0x27')](_0x4a80e4[_0xfb1c('0x28')],_0x4a80e4[_0xfb1c('0x26')]);_0x864a56[_0xfb1c('0x29')]=_[_0xfb1c('0x27')](_0x4a80e4[_0xfb1c('0x28')],qs[_0xfb1c('0x2a')](_0x4cadaa['query']['fields']));_0x864a56[_0xfb1c('0x29')]=_0x864a56[_0xfb1c('0x29')][_0xfb1c('0x2b')]?_0x864a56[_0xfb1c('0x29')]:_0x4a80e4['model'];_0x864a56['order']=qs['sort'](_0x4cadaa[_0xfb1c('0x26')][_0xfb1c('0x3e')]);_0x864a56[_0xfb1c('0x1f')]=qs[_0xfb1c('0x3a')](_[_0xfb1c('0x3f')](_0x4cadaa['query'],_0x4a80e4[_0xfb1c('0x3a')]));if(_0x4cadaa['query'][_0xfb1c('0x40')]){_0x864a56[_0xfb1c('0x1f')]=_['merge'](_0x864a56['where'],{'$or':_['map'](_0x864a56[_0xfb1c('0x29')],function(_0x4929f3){var _0x25fd98={};_0x25fd98[_0x4929f3]={'$like':'%'+_0x4cadaa[_0xfb1c('0x26')][_0xfb1c('0x40')]+'%'};return _0x25fd98;})});}_0x864a56=_[_0xfb1c('0x41')]({},_0x864a56,_0x4cadaa[_0xfb1c('0x42')]);return _0x43b434[_0xfb1c('0x75')](_0x864a56);}})[_0xfb1c('0x14')](function(_0xdaf89f){if(_0xdaf89f){_0xa1a561=_0xdaf89f[_0xfb1c('0x2b')];if(!_0x4cadaa[_0xfb1c('0x26')][_0xfb1c('0x3b')](_0xfb1c('0x3c'))){_0x864a56['limit']=qs[_0xfb1c('0x10')](_0x4cadaa[_0xfb1c('0x26')][_0xfb1c('0x10')]);_0x864a56[_0xfb1c('0xe')]=qs[_0xfb1c('0xe')](_0x4cadaa[_0xfb1c('0x26')][_0xfb1c('0xe')]);}return _0x43b434[_0xfb1c('0x75')](_0x864a56);}})[_0xfb1c('0x14')](function(_0x309fb7){if(_0x309fb7){return _0x309fb7?{'count':_0xa1a561,'rows':_0x309fb7}:null;}})[_0xfb1c('0x14')](respondWithResult(_0x9d9f95,null))['catch'](handleError(_0x9d9f95,null));}; \ No newline at end of file +var _0x5ab1=['catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','find','create','user','role','ChatQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','keys','UserChatQueue','length','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','findOne','Team','order','options','getTeams','addTeams','ids','flatMap','Agents','transaction','each','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','get','error','stack','name','send','index','map','ChatQueue','fieldName','type','key','getOptions','where','include','query','findAll','rows'];(function(_0x20dbb9,_0x12ee9e){var _0x3513ad=function(_0x4b31df){while(--_0x4b31df){_0x20dbb9['push'](_0x20dbb9['shift']());}};_0x3513ad(++_0x12ee9e);}(_0x5ab1,0x1b5));var _0x15ab=function(_0x36a98e,_0x40578c){_0x36a98e=_0x36a98e-0x0;var _0x4ff372=_0x5ab1[_0x36a98e];return _0x4ff372;};'use strict';var BPromise=require(_0x15ab('0x0'));var util=require(_0x15ab('0x1'));var _=require(_0x15ab('0x2'));var squel=require('squel');var Redis=require(_0x15ab('0x3'));var qs=require(_0x15ab('0x4'));var logger=require(_0x15ab('0x5'))(_0x15ab('0x6'));var config=require('../../config/environment');var db=require(_0x15ab('0x7'))['db'];config[_0x15ab('0x8')]=_[_0x15ab('0x9')](config[_0x15ab('0x8')],{'host':_0x15ab('0xa'),'port':0x18eb});var socket=require(_0x15ab('0xb'))(new Redis(config[_0x15ab('0x8')]));require(_0x15ab('0xc'))[_0x15ab('0xd')](socket);function respondWithStatusCode(_0x323899,_0x530bf0){_0x530bf0=_0x530bf0||0xcc;return function(_0x479a36){if(_0x479a36){return _0x323899[_0x15ab('0xe')](_0x530bf0);}return _0x323899[_0x15ab('0xf')](_0x530bf0)[_0x15ab('0x10')]();};}function respondWithResult(_0x18cf5a,_0x2cfd54){_0x2cfd54=_0x2cfd54||0xc8;return function(_0x50fe0b){if(_0x50fe0b){return _0x18cf5a[_0x15ab('0xf')](_0x2cfd54)[_0x15ab('0x11')](_0x50fe0b);}};}function respondWithFilteredResult(_0x2dcaf4,_0x370b18){return function(_0x22b898){if(_0x22b898){var _0x5cbdf4=typeof _0x370b18[_0x15ab('0x12')]==='undefined'&&typeof _0x370b18[_0x15ab('0x13')]==='undefined';var _0x4b1b2f=_0x22b898[_0x15ab('0x14')];var _0xf07d37=_0x5cbdf4?0x0:_0x370b18['offset'];var _0x5b960a=_0x5cbdf4?_0x22b898[_0x15ab('0x14')]:_0x370b18[_0x15ab('0x12')]+_0x370b18[_0x15ab('0x13')];var _0x423102;if(_0x5b960a>=_0x4b1b2f){_0x5b960a=_0x4b1b2f;_0x423102=0xc8;}else{_0x423102=0xce;}_0x2dcaf4[_0x15ab('0xf')](_0x423102);return _0x2dcaf4[_0x15ab('0x15')](_0x15ab('0x16'),_0xf07d37+'-'+_0x5b960a+'/'+_0x4b1b2f)[_0x15ab('0x11')](_0x22b898);}return null;};}function saveUpdates(_0x210c2b){return function(_0x5cfe53){if(_0x5cfe53){return _0x5cfe53[_0x15ab('0x17')](_0x210c2b)[_0x15ab('0x18')](function(_0x4809f2){return _0x4809f2;});}return null;};}function removeEntity(_0x5448c6){return function(_0x47a47d){if(_0x47a47d){return _0x47a47d[_0x15ab('0x19')]()[_0x15ab('0x18')](function(){var _0x59af52=_0x47a47d[_0x15ab('0x1a')]({'plain':!![]});var _0x3e6ee8='ChatQueues';return db['UserProfileResource'][_0x15ab('0x19')]({'where':{'type':_0x3e6ee8,'resourceId':_0x59af52['id']}})[_0x15ab('0x18')](function(){return _0x47a47d;});})[_0x15ab('0x18')](function(){_0x5448c6[_0x15ab('0xf')](0xcc)[_0x15ab('0x10')]();});}};}function handleEntityNotFound(_0x4ad726){return function(_0x367b1e){if(!_0x367b1e){_0x4ad726[_0x15ab('0xe')](0x194);}return _0x367b1e;};}function handleError(_0x1bb98c,_0x4856a5){_0x4856a5=_0x4856a5||0x1f4;return function(_0x1c2037){logger[_0x15ab('0x1b')](_0x1c2037[_0x15ab('0x1c')]);if(_0x1c2037[_0x15ab('0x1d')]){delete _0x1c2037[_0x15ab('0x1d')];}_0x1bb98c[_0x15ab('0xf')](_0x4856a5)[_0x15ab('0x1e')](_0x1c2037);};}exports[_0x15ab('0x1f')]=function(_0x586675,_0xf00df3){var _0xf8acf6={};var _0x6712c3={'count':0x0,'rows':[]};var _0x88dd1e=_[_0x15ab('0x20')](db[_0x15ab('0x21')]['rawAttributes'],function(_0x51af40){return{'name':_0x51af40[_0x15ab('0x22')],'type':_0x51af40[_0x15ab('0x23')][_0x15ab('0x24')]};});_0xf8acf6=qs[_0x15ab('0x25')](_0x88dd1e,_0x586675);var _0x3cee5c={'where':_0xf8acf6[_0x15ab('0x26')]};return db[_0x15ab('0x21')][_0x15ab('0x14')](_0x3cee5c)[_0x15ab('0x18')](function(_0x28e9cc){_0x6712c3[_0x15ab('0x14')]=_0x28e9cc;_0xf8acf6[_0x15ab('0x27')]=qs[_0x15ab('0x27')](_0x586675[_0x15ab('0x28')]);return db[_0x15ab('0x21')][_0x15ab('0x29')](_0xf8acf6);})[_0x15ab('0x18')](function(_0xf6b55d){_0x6712c3[_0x15ab('0x2a')]=_0xf6b55d;return _0x6712c3;})[_0x15ab('0x18')](respondWithFilteredResult(_0xf00df3,_0xf8acf6))[_0x15ab('0x2b')](handleError(_0xf00df3,null));};exports[_0x15ab('0x2c')]=function(_0x525711,_0x550e86){var _0x3a28d0={'raw':!![],'where':{'id':_0x525711[_0x15ab('0x2d')]['id']}},_0x51105d={};_0x51105d[_0x15ab('0x2e')]=_['keys'](db[_0x15ab('0x21')][_0x15ab('0x2f')]);_0x51105d['query']=_['keys'](_0x525711[_0x15ab('0x28')]);_0x51105d[_0x15ab('0x30')]=_['intersection'](_0x51105d['model'],_0x51105d[_0x15ab('0x28')]);_0x3a28d0[_0x15ab('0x31')]=_[_0x15ab('0x32')](_0x51105d['model'],qs[_0x15ab('0x33')](_0x525711[_0x15ab('0x28')][_0x15ab('0x33')]));_0x3a28d0[_0x15ab('0x31')]=_0x3a28d0['attributes']['length']?_0x3a28d0[_0x15ab('0x31')]:_0x51105d['model'];if(_0x525711[_0x15ab('0x28')][_0x15ab('0x34')]){_0x3a28d0[_0x15ab('0x27')]=[{'all':!![]}];}_0x3a28d0=_[_0x15ab('0x35')]({},_0x3a28d0,_0x525711['options']);return db[_0x15ab('0x21')][_0x15ab('0x36')](_0x3a28d0)['then'](handleEntityNotFound(_0x550e86,null))['then'](respondWithResult(_0x550e86,null))['catch'](handleError(_0x550e86,null));};exports[_0x15ab('0x37')]=function(_0x4df538,_0x3dff2d){return db['ChatQueue']['create'](_0x4df538['body'],{})[_0x15ab('0x18')](function(_0x227e7d){var _0x5bc6cc=_0x4df538[_0x15ab('0x38')]['get']({'plain':!![]});if(!_0x5bc6cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bc6cc[_0x15ab('0x39')]===_0x15ab('0x38')){var _0x2fa2f6=_0x227e7d[_0x15ab('0x1a')]({'plain':!![]});var _0x44ade2=_0x15ab('0x3a');return db[_0x15ab('0x3b')][_0x15ab('0x36')]({'where':{'name':_0x44ade2,'userProfileId':_0x5bc6cc[_0x15ab('0x3c')]},'raw':!![]})[_0x15ab('0x18')](function(_0x39e090){if(_0x39e090&&_0x39e090['autoAssociation']===0x0){return db[_0x15ab('0x3d')]['create']({'name':_0x2fa2f6['name'],'resourceId':_0x2fa2f6['id'],'type':_0x39e090['name'],'sectionId':_0x39e090['id']},{})[_0x15ab('0x18')](function(){return _0x227e7d;});}else{return _0x227e7d;}})[_0x15ab('0x2b')](function(_0x62bd61){logger[_0x15ab('0x1b')](_0x15ab('0x3e'),_0x62bd61);throw _0x62bd61;});}return _0x227e7d;})[_0x15ab('0x18')](respondWithResult(_0x3dff2d,0xc9))[_0x15ab('0x2b')](handleError(_0x3dff2d,null));};exports[_0x15ab('0x17')]=function(_0x2778b4,_0x99aef0){if(_0x2778b4[_0x15ab('0x3f')]['id']){delete _0x2778b4[_0x15ab('0x3f')]['id'];}return db[_0x15ab('0x21')]['find']({'where':{'id':_0x2778b4[_0x15ab('0x2d')]['id']}})[_0x15ab('0x18')](handleEntityNotFound(_0x99aef0,null))[_0x15ab('0x18')](saveUpdates(_0x2778b4['body'],null))[_0x15ab('0x18')](respondWithResult(_0x99aef0,null))[_0x15ab('0x2b')](handleError(_0x99aef0,null));};exports[_0x15ab('0x19')]=function(_0x29643b,_0x127b6c){return db[_0x15ab('0x21')][_0x15ab('0x36')]({'where':{'id':_0x29643b['params']['id']}})['then'](handleEntityNotFound(_0x127b6c,null))[_0x15ab('0x18')](removeEntity(_0x127b6c,null))['catch'](handleError(_0x127b6c,null));};exports['describe']=function(_0x502b54,_0x39b749){return db[_0x15ab('0x21')]['describe']()[_0x15ab('0x18')](respondWithResult(_0x39b749,null))['catch'](handleError(_0x39b749,null));};exports['getMembers']=function(_0x4046a9,_0x344e7d){var _0x105f26={'raw':!![],'where':{}},_0x147b7e={},_0xff7542;return db[_0x15ab('0x21')]['findOne']({'where':{'id':_0x4046a9[_0x15ab('0x2d')]['id']}})['then'](handleEntityNotFound(_0x344e7d,null))[_0x15ab('0x18')](function(_0x308994){if(_0x308994){_0xff7542=_0x308994[_0x15ab('0x1a')]({'plain':!![]});_0x147b7e['model']=_[_0x15ab('0x40')](db[_0x15ab('0x41')]['rawAttributes']);_0x147b7e[_0x15ab('0x28')]=_[_0x15ab('0x40')](_0x4046a9[_0x15ab('0x28')]);_0x147b7e['filters']=_[_0x15ab('0x32')](_0x147b7e['model'],_0x147b7e[_0x15ab('0x28')]);_0x105f26['attributes']=_['intersection'](_0x147b7e[_0x15ab('0x2e')],qs['fields'](_0x4046a9[_0x15ab('0x28')][_0x15ab('0x33')]));_0x105f26[_0x15ab('0x31')]=_0x105f26[_0x15ab('0x31')][_0x15ab('0x42')]?_0x105f26[_0x15ab('0x31')]:_0x147b7e[_0x15ab('0x2e')];if(!_0x4046a9[_0x15ab('0x28')][_0x15ab('0x43')](_0x15ab('0x44'))){_0x105f26[_0x15ab('0x13')]=qs[_0x15ab('0x13')](_0x4046a9[_0x15ab('0x28')][_0x15ab('0x13')]);_0x105f26['offset']=qs['offset'](_0x4046a9[_0x15ab('0x28')][_0x15ab('0x12')]);}_0x105f26['order']=qs['sort'](_0x4046a9['query'][_0x15ab('0x45')]);_0x105f26[_0x15ab('0x26')]=qs[_0x15ab('0x30')](_[_0x15ab('0x46')](_0x4046a9[_0x15ab('0x28')],_0x147b7e[_0x15ab('0x30')]));_0x105f26[_0x15ab('0x26')][_0x15ab('0x47')]=_0x308994['id'];if(_0x4046a9[_0x15ab('0x28')][_0x15ab('0x48')]){_0x105f26[_0x15ab('0x26')]=_[_0x15ab('0x35')](_0x105f26['where'],{'$or':_[_0x15ab('0x20')](_0x105f26[_0x15ab('0x31')],function(_0x48d6f2){var _0x1893a8={};_0x1893a8[_0x48d6f2]={'$like':'%'+_0x4046a9[_0x15ab('0x28')][_0x15ab('0x48')]+'%'};return _0x1893a8;})});}_0x105f26=_[_0x15ab('0x35')]({},_0x105f26,_0x4046a9['options']);return db[_0x15ab('0x41')][_0x15ab('0x29')](_0x105f26);}})[_0x15ab('0x18')](function(_0x486c66){if(_0x486c66){return db[_0x15ab('0x49')][_0x15ab('0x4a')]({'where':{'id':_[_0x15ab('0x20')](_0x486c66,_0x15ab('0x4b')),'role':_0x15ab('0x4c')},'attributes':['id',_0x15ab('0x1d'),_0x15ab('0x4d'),_0x15ab('0x4e'),_0x15ab('0x4f')]});}})[_0x15ab('0x18')](function(_0x571f5d){if(_0x571f5d){return{'count':_0x571f5d[_0x15ab('0x14')],'rows':_[_0x15ab('0x20')](_0x571f5d[_0x15ab('0x2a')],function(_0x363107){return{'membername':_0x363107[_0x15ab('0x1d')],'UserId':_0x363107['id'],'queue_name':_0xff7542[_0x15ab('0x1d')],'ChatQueueId':_0xff7542['id'],'interface':util[_0x15ab('0x50')]('%s/%s','SIP',_0x363107[_0x15ab('0x1d')]),'penalty':0x0,'paused':_0x363107[_0x15ab('0x4d')],'createdAt':_0x363107[_0x15ab('0x4f')],'updatedAt':_0x363107[_0x15ab('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x15ab('0x18')](respondWithFilteredResult(_0x344e7d,_0x105f26))['catch'](handleError(_0x344e7d,null));};exports['getTeams']=function(_0x139f23,_0xda10c3){var _0x37ec84={};var _0x5e7a60={};var _0x7e8bb5;var _0x3c1456;return db[_0x15ab('0x21')][_0x15ab('0x51')]({'where':{'id':_0x139f23[_0x15ab('0x2d')]['id']}})[_0x15ab('0x18')](handleEntityNotFound(_0xda10c3,null))['then'](function(_0x1de636){if(_0x1de636){_0x7e8bb5=_0x1de636;_0x5e7a60[_0x15ab('0x2e')]=_[_0x15ab('0x40')](db[_0x15ab('0x52')][_0x15ab('0x2f')]);_0x5e7a60[_0x15ab('0x28')]=_[_0x15ab('0x40')](_0x139f23['query']);_0x5e7a60[_0x15ab('0x30')]=_['intersection'](_0x5e7a60[_0x15ab('0x2e')],_0x5e7a60['query']);_0x37ec84[_0x15ab('0x31')]=_['intersection'](_0x5e7a60[_0x15ab('0x2e')],qs[_0x15ab('0x33')](_0x139f23['query']['fields']));_0x37ec84[_0x15ab('0x31')]=_0x37ec84['attributes'][_0x15ab('0x42')]?_0x37ec84['attributes']:_0x5e7a60[_0x15ab('0x2e')];_0x37ec84[_0x15ab('0x53')]=qs['sort'](_0x139f23['query'][_0x15ab('0x45')]);_0x37ec84[_0x15ab('0x26')]=qs[_0x15ab('0x30')](_[_0x15ab('0x46')](_0x139f23[_0x15ab('0x28')],_0x5e7a60['filters']));if(_0x139f23[_0x15ab('0x28')][_0x15ab('0x48')]){_0x37ec84[_0x15ab('0x26')]=_['merge'](_0x37ec84['where'],{'$or':_['map'](_0x37ec84[_0x15ab('0x31')],function(_0x4e5cb9){var _0x3b75f8={};_0x3b75f8[_0x4e5cb9]={'$like':'%'+_0x139f23['query'][_0x15ab('0x48')]+'%'};return _0x3b75f8;})});}_0x37ec84=_[_0x15ab('0x35')]({},_0x37ec84,_0x139f23[_0x15ab('0x54')]);return _0x7e8bb5[_0x15ab('0x55')](_0x37ec84);}})[_0x15ab('0x18')](function(_0x178c08){if(_0x178c08){_0x3c1456=_0x178c08[_0x15ab('0x42')];if(!_0x139f23[_0x15ab('0x28')][_0x15ab('0x43')](_0x15ab('0x44'))){_0x37ec84[_0x15ab('0x13')]=qs[_0x15ab('0x13')](_0x139f23['query'][_0x15ab('0x13')]);_0x37ec84[_0x15ab('0x12')]=qs[_0x15ab('0x12')](_0x139f23[_0x15ab('0x28')][_0x15ab('0x12')]);}return _0x7e8bb5[_0x15ab('0x55')](_0x37ec84);}})[_0x15ab('0x18')](function(_0x40bd88){if(_0x40bd88){return _0x40bd88?{'count':_0x3c1456,'rows':_0x40bd88}:null;}})[_0x15ab('0x18')](respondWithResult(_0xda10c3,null))[_0x15ab('0x2b')](handleError(_0xda10c3,null));};exports[_0x15ab('0x56')]=function(_0x3dd8e5,_0x27834c){var _0x11e73f=_0x3dd8e5[_0x15ab('0x3f')][_0x15ab('0x57')];return db[_0x15ab('0x52')][_0x15ab('0x29')]({'where':{'id':_0x11e73f},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x15ab('0x1d'),'online','voicePause','interface'],'raw':!![]}]})[_0x15ab('0x18')](function(_0x51d0ab){if(_0x51d0ab){var _0x426f35=_[_0x15ab('0x58')](_0x51d0ab,function(_0x2664e7){var _0x491918=_0x2664e7[_0x15ab('0x1a')]({'plain':!![]});return _0x491918[_0x15ab('0x59')];});return db[_0x15ab('0x21')]['find']({'where':{'id':_0x3dd8e5['params']['id']}})[_0x15ab('0x18')](function(_0x139dea){return db['sequelize'][_0x15ab('0x5a')](function(_0x1c25df){return _0x139dea['addTeams'](_0x11e73f,{'transaction':_0x1c25df})['then'](function(){return BPromise[_0x15ab('0x5b')](_0x426f35,function(_0x5d12b7){return db[_0x15ab('0x41')]['findOrCreate']({'where':{'UserId':_0x5d12b7['id'],'ChatQueueId':_0x3dd8e5[_0x15ab('0x2d')]['id']},'transaction':_0x1c25df});});})[_0x15ab('0x18')](function(){_0x426f35['forEach'](function(_0x562be3){socket[_0x15ab('0x5c')](_0x15ab('0x5d'),{'UserId':_0x562be3['id'],'ChatQueueId':_0x139dea['id']});});});});});}})['then'](respondWithStatusCode(_0x27834c,null))['catch'](handleError(_0x27834c,null));};exports[_0x15ab('0x5e')]=function(_0x4bc824,_0x48f415){return db[_0x15ab('0x52')][_0x15ab('0x29')]({'where':{'id':_0x4bc824['query'][_0x15ab('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x15ab('0x59'),'attributes':['id'],'raw':!![]}]})[_0x15ab('0x18')](handleEntityNotFound(_0x48f415,null))['then'](function(_0x42c91a){var _0x42b624=_[_0x15ab('0x20')](_0x42c91a,'id');var _0x8d67bd=[];var _0x199399=[];var _0x3ebfcc=squel[_0x15ab('0x5f')]();_0x3ebfcc['field'](_0x15ab('0x60'))[_0x15ab('0x61')](_0x15ab('0x62'),'tq')[_0x15ab('0x63')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('ChatQueueId\x20=\x20?',_0x4bc824['params']['id']);for(var _0x223e8f=0x0;_0x223e8f<_0x42c91a[_0x15ab('0x42')];_0x223e8f+=0x1){let _0x33cf14=_0x42c91a[_0x223e8f];for(var _0x526a54=0x0;_0x526a54<_0x33cf14['Agents'][_0x15ab('0x42')];_0x526a54+=0x1){let _0x4ef52c=_0x33cf14[_0x15ab('0x59')][_0x526a54];var _0x48921c=_0x3ebfcc['clone']();_0x48921c[_0x15ab('0x26')](_0x15ab('0x64'),_0x4ef52c['id']);_0x199399[_0x15ab('0x65')](db[_0x15ab('0x66')][_0x15ab('0x28')](_0x48921c[_0x15ab('0x67')](),{'type':db['sequelize'][_0x15ab('0x68')][_0x15ab('0x69')]})[_0x15ab('0x18')](function(_0xeecd47){if(_0xeecd47[_0x15ab('0x42')]===0x1){return _0x4ef52c['id'];}else{var _0x67a1b1=_[_0x15ab('0x6a')](_[_0x15ab('0x20')](_0xeecd47,'TeamId'),function(_0x244b43){return _[_0x15ab('0x6b')](_0x42b624,_0x244b43);});if(_0x67a1b1){return _0x4ef52c['id'];}}}));}}return BPromise['all'](_0x199399)['then'](function(_0x498bf1){_0x8d67bd=_(_0x8d67bd)[_0x15ab('0x6c')](_0x498bf1)[_0x15ab('0x6d')]()[_0x15ab('0x6e')]();return db['ChatQueue'][_0x15ab('0x36')]({'where':{'id':_0x4bc824[_0x15ab('0x2d')]['id']}})[_0x15ab('0x18')](function(_0x586a13){return db[_0x15ab('0x66')][_0x15ab('0x5a')](function(_0x4f58c9){return _0x586a13[_0x15ab('0x5e')](_0x4bc824[_0x15ab('0x28')][_0x15ab('0x57')],{'transaction':_0x4f58c9})[_0x15ab('0x18')](function(){if(!_[_0x15ab('0x6f')](_0x8d67bd)){return _0x586a13[_0x15ab('0x70')](_0x8d67bd,{'transaction':_0x4f58c9});}})[_0x15ab('0x18')](function(){_0x8d67bd[_0x15ab('0x71')](function(_0x5aedf0){socket[_0x15ab('0x5c')](_0x15ab('0x72'),{'UserId':_0x5aedf0,'ChatQueueId':_0x586a13['id']});});});});});});})[_0x15ab('0x18')](respondWithStatusCode(_0x48f415,null))[_0x15ab('0x2b')](handleError(_0x48f415,null));};exports[_0x15ab('0x73')]=function(_0x435197,_0x1275b5){return db[_0x15ab('0x21')][_0x15ab('0x36')]({'where':{'id':_0x435197[_0x15ab('0x2d')]['id']}})[_0x15ab('0x18')](handleEntityNotFound(_0x1275b5,null))[_0x15ab('0x18')](function(_0x4142d3){if(_0x4142d3){return _0x4142d3[_0x15ab('0x73')](_0x435197[_0x15ab('0x3f')][_0x15ab('0x57')],_[_0x15ab('0x74')](_0x435197[_0x15ab('0x3f')],[_0x15ab('0x57'),'id'])||{})[_0x15ab('0x75')](function(_0x627df4){for(var _0x26792b=0x0;_0x26792b<_0x435197[_0x15ab('0x3f')][_0x15ab('0x57')][_0x15ab('0x42')];_0x26792b+=0x1){socket[_0x15ab('0x5c')](_0x15ab('0x5d'),{'UserId':Number(_0x435197[_0x15ab('0x3f')][_0x15ab('0x57')][_0x26792b]),'ChatQueueId':Number(_0x435197[_0x15ab('0x2d')]['id'])});}return _0x627df4;});}})[_0x15ab('0x18')](respondWithResult(_0x1275b5,null))['catch'](handleError(_0x1275b5,null));};exports[_0x15ab('0x70')]=function(_0x1d6f3e,_0x2d0e28){return db[_0x15ab('0x21')]['find']({'where':{'id':_0x1d6f3e['params']['id']}})[_0x15ab('0x18')](handleEntityNotFound(_0x2d0e28,null))[_0x15ab('0x18')](function(_0x2edf2c){if(_0x2edf2c){return _0x2edf2c['removeAgents'](_0x1d6f3e[_0x15ab('0x28')][_0x15ab('0x57')])[_0x15ab('0x18')](function(){if(_[_0x15ab('0x76')](_0x1d6f3e[_0x15ab('0x28')]['ids'])){for(var _0x1f9c4e=0x0;_0x1f9c4e<_0x1d6f3e['query'][_0x15ab('0x57')]['length'];_0x1f9c4e+=0x1){socket['emit'](_0x15ab('0x72'),{'UserId':Number(_0x1d6f3e[_0x15ab('0x28')]['ids'][_0x1f9c4e]),'ChatQueueId':Number(_0x1d6f3e[_0x15ab('0x2d')]['id'])});}}else{socket[_0x15ab('0x5c')](_0x15ab('0x72'),{'UserId':Number(_0x1d6f3e[_0x15ab('0x28')][_0x15ab('0x57')]),'ChatQueueId':Number(_0x1d6f3e['params']['id'])});}});}})[_0x15ab('0x18')](respondWithStatusCode(_0x2d0e28,null))['catch'](handleError(_0x2d0e28,null));};exports[_0x15ab('0x77')]=function(_0x4a6825,_0x46fac7){var _0x5eaf91={};var _0x2334f4={};var _0x53f53f;var _0x4c4bef;return db[_0x15ab('0x21')][_0x15ab('0x51')]({'where':{'id':_0x4a6825['params']['id']}})[_0x15ab('0x18')](handleEntityNotFound(_0x46fac7,null))[_0x15ab('0x18')](function(_0x5b448f){if(_0x5b448f){_0x53f53f=_0x5b448f;_0x2334f4[_0x15ab('0x2e')]=_[_0x15ab('0x40')](db['User'][_0x15ab('0x2f')]);_0x2334f4['query']=_[_0x15ab('0x40')](_0x4a6825[_0x15ab('0x28')]);_0x2334f4[_0x15ab('0x30')]=_[_0x15ab('0x32')](_0x2334f4['model'],_0x2334f4[_0x15ab('0x28')]);_0x5eaf91[_0x15ab('0x31')]=_[_0x15ab('0x32')](_0x2334f4[_0x15ab('0x2e')],qs[_0x15ab('0x33')](_0x4a6825['query'][_0x15ab('0x33')]));_0x5eaf91[_0x15ab('0x31')]=_0x5eaf91['attributes'][_0x15ab('0x42')]?_0x5eaf91[_0x15ab('0x31')]:_0x2334f4[_0x15ab('0x2e')];_0x5eaf91[_0x15ab('0x53')]=qs['sort'](_0x4a6825[_0x15ab('0x28')][_0x15ab('0x45')]);_0x5eaf91[_0x15ab('0x26')]=qs[_0x15ab('0x30')](_[_0x15ab('0x46')](_0x4a6825['query'],_0x2334f4['filters']));if(_0x4a6825['query'][_0x15ab('0x48')]){_0x5eaf91[_0x15ab('0x26')]=_[_0x15ab('0x35')](_0x5eaf91[_0x15ab('0x26')],{'$or':_[_0x15ab('0x20')](_0x5eaf91[_0x15ab('0x31')],function(_0x325398){var _0x5f30b2={};_0x5f30b2[_0x325398]={'$like':'%'+_0x4a6825[_0x15ab('0x28')][_0x15ab('0x48')]+'%'};return _0x5f30b2;})});}_0x5eaf91=_['merge']({},_0x5eaf91,_0x4a6825[_0x15ab('0x54')]);return _0x53f53f[_0x15ab('0x77')](_0x5eaf91);}})[_0x15ab('0x18')](function(_0x21375c){if(_0x21375c){_0x4c4bef=_0x21375c[_0x15ab('0x42')];if(!_0x4a6825[_0x15ab('0x28')][_0x15ab('0x43')](_0x15ab('0x44'))){_0x5eaf91[_0x15ab('0x13')]=qs[_0x15ab('0x13')](_0x4a6825[_0x15ab('0x28')][_0x15ab('0x13')]);_0x5eaf91[_0x15ab('0x12')]=qs[_0x15ab('0x12')](_0x4a6825[_0x15ab('0x28')][_0x15ab('0x12')]);}return _0x53f53f[_0x15ab('0x77')](_0x5eaf91);}})['then'](function(_0x26dcc4){if(_0x26dcc4){return _0x26dcc4?{'count':_0x4c4bef,'rows':_0x26dcc4}:null;}})[_0x15ab('0x18')](respondWithResult(_0x46fac7,null))['catch'](handleError(_0x46fac7,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index fb45ccc..1ed2d54 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 _0x5329=['../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5329,0xab));var _0x9532=function(_0x3854f6,_0x307471){_0x3854f6=_0x3854f6-0x0;var _0xe566a2=_0x5329[_0x3854f6];return _0xe566a2;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x9532('0x0'))['db'][_0x9532('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x9532('0x2')](0x0);var events={'afterCreate':_0x9532('0x3'),'afterUpdate':_0x9532('0x4'),'afterDestroy':_0x9532('0x5')};function emitEvent(_0xff50c4){return function(_0x5192a4,_0x344ada,_0x17744c){ChatQueueEvents[_0x9532('0x6')](_0xff50c4+':'+_0x5192a4['id'],_0x5192a4);ChatQueueEvents['emit'](_0xff50c4,_0x5192a4);_0x17744c(null);};}for(var e in events){if(events[_0x9532('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x9532('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xc0f7=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatQueue'];(function(_0x2daa63,_0x4a01d4){var _0x1afeba=function(_0x38b789){while(--_0x38b789){_0x2daa63['push'](_0x2daa63['shift']());}};_0x1afeba(++_0x4a01d4);}(_0xc0f7,0x9f));var _0x7c0f=function(_0x1233d2,_0x5a0246){_0x1233d2=_0x1233d2-0x0;var _0x93e5d0=_0xc0f7[_0x1233d2];return _0x93e5d0;};'use strict';var EventEmitter=require(_0x7c0f('0x0'));var ChatQueue=require(_0x7c0f('0x1'))['db'][_0x7c0f('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7c0f('0x3')](0x0);var events={'afterCreate':_0x7c0f('0x4'),'afterUpdate':'update','afterDestroy':_0x7c0f('0x5')};function emitEvent(_0x4fb15e){return function(_0x5e0275,_0x23d4c6,_0x1da53a){ChatQueueEvents[_0x7c0f('0x6')](_0x4fb15e+':'+_0x5e0275['id'],_0x5e0275);ChatQueueEvents[_0x7c0f('0x6')](_0x4fb15e,_0x5e0275);_0x1da53a(null);};}for(var e in events){if(events[_0x7c0f('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x7c0f('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 6183874..5b18ed7 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 _0xd854=['api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger'];(function(_0x3af129,_0x38e38a){var _0x50a010=function(_0x39cf50){while(--_0x39cf50){_0x3af129['push'](_0x3af129['shift']());}};_0x50a010(++_0x38e38a);}(_0xd854,0xf5));var _0x4d85=function(_0x2e268f,_0x51d1e5){_0x2e268f=_0x2e268f-0x0;var _0x3d1ced=_0xd854[_0x2e268f];return _0x3d1ced;};'use strict';var _=require(_0x4d85('0x0'));var util=require('util');var logger=require(_0x4d85('0x1'))(_0x4d85('0x2'));var moment=require(_0x4d85('0x3'));var BPromise=require(_0x4d85('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d85('0x5'));var rimraf=require(_0x4d85('0x6'));var config=require(_0x4d85('0x7'));var attributes=require(_0x4d85('0x8'));module[_0x4d85('0x9')]=function(_0x4c2ddf,_0x2cb8e4){return _0x4c2ddf[_0x4d85('0xa')](_0x4d85('0xb'),attributes,{'tableName':_0x4d85('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79d2=['../../config/environment','./chatQueue.attributes','define','ChatQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c7b40,_0x4aa210){var _0x2247e7=function(_0x4a8c20){while(--_0x4a8c20){_0x5c7b40['push'](_0x5c7b40['shift']());}};_0x2247e7(++_0x4aa210);}(_0x79d2,0x10c));var _0x279d=function(_0x53d9a7,_0x44c4a3){_0x53d9a7=_0x53d9a7-0x0;var _0x1c8958=_0x79d2[_0x53d9a7];return _0x1c8958;};'use strict';var _=require(_0x279d('0x0'));var util=require(_0x279d('0x1'));var logger=require(_0x279d('0x2'))(_0x279d('0x3'));var moment=require(_0x279d('0x4'));var BPromise=require(_0x279d('0x5'));var rp=require(_0x279d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x279d('0x7'));var attributes=require(_0x279d('0x8'));module['exports']=function(_0x115f94,_0x3e60f5){return _0x115f94[_0x279d('0x9')](_0x279d('0xa'),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 e8b68bc..07f06e6 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 _0x5a13=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','options','where','attributes','limit','include','model','map','ShowChatQueue','raw','util','moment'];(function(_0x5daa20,_0x45420c){var _0x4517ec=function(_0x3e944f){while(--_0x3e944f){_0x5daa20['push'](_0x5daa20['shift']());}};_0x4517ec(++_0x45420c);}(_0x5a13,0x92));var _0x35a1=function(_0x4f6f3d,_0x217c9b){_0x4f6f3d=_0x4f6f3d-0x0;var _0x7ff5ea=_0x5a13[_0x4f6f3d];return _0x7ff5ea;};'use strict';var _=require('lodash');var util=require(_0x35a1('0x0'));var moment=require(_0x35a1('0x1'));var BPromise=require(_0x35a1('0x2'));var rs=require(_0x35a1('0x3'));var fs=require('fs');var Redis=require(_0x35a1('0x4'));var db=require(_0x35a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x35a1('0x6'))('rpc');var config=require(_0x35a1('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x35a1('0x8')]=_[_0x35a1('0x9')](config[_0x35a1('0x8')],{'host':_0x35a1('0xa'),'port':0x18eb});var socket=require(_0x35a1('0xb'))(new Redis(config['redis']));require(_0x35a1('0xc'))[_0x35a1('0xd')](socket);function respondWithRpcPromise(_0x29f3f7,_0x3c4501,_0x10d627){return new BPromise(function(_0x2d9801,_0x38a711){return client[_0x35a1('0xe')](_0x29f3f7,_0x10d627)[_0x35a1('0xf')](function(_0x5ee208){logger[_0x35a1('0x10')](_0x35a1('0x11'),_0x3c4501,_0x35a1('0x12'));logger[_0x35a1('0x13')](_0x35a1('0x14'),_0x3c4501,'request\x20sent',JSON[_0x35a1('0x15')](_0x5ee208));if(_0x5ee208['error']){if(_0x5ee208[_0x35a1('0x16')][_0x35a1('0x17')]===0x1f4){logger['error'](_0x35a1('0x11'),_0x3c4501,_0x5ee208[_0x35a1('0x16')][_0x35a1('0x18')]);return _0x38a711(_0x5ee208[_0x35a1('0x16')]['message']);}logger[_0x35a1('0x16')](_0x35a1('0x11'),_0x3c4501,_0x5ee208[_0x35a1('0x16')][_0x35a1('0x18')]);return _0x2d9801(_0x5ee208['error'][_0x35a1('0x18')]);}else{logger[_0x35a1('0x10')]('ChatQueue,\x20%s,\x20%s',_0x3c4501,_0x35a1('0x12'));_0x2d9801(_0x5ee208[_0x35a1('0x19')]['message']);}})[_0x35a1('0x1a')](function(_0x11acfb){logger[_0x35a1('0x16')](_0x35a1('0x11'),_0x3c4501,_0x11acfb);_0x38a711(_0x11acfb);});});}exports[_0x35a1('0x1b')]=function(_0x5a324d){var _0xffc38=this;return new Promise(function(_0xcada3,_0x4b978e){return db['ChatQueue']['findAll']({'raw':_0x5a324d['options']?_0x5a324d[_0x35a1('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5a324d[_0x35a1('0x1c')]?_0x5a324d[_0x35a1('0x1c')][_0x35a1('0x1d')]||null:null,'attributes':_0x5a324d['options']?_0x5a324d[_0x35a1('0x1c')][_0x35a1('0x1e')]||null:null,'limit':_0x5a324d[_0x35a1('0x1c')]?_0x5a324d[_0x35a1('0x1c')][_0x35a1('0x1f')]||null:null,'include':_0x5a324d[_0x35a1('0x1c')]?_0x5a324d[_0x35a1('0x1c')][_0x35a1('0x20')]?_['map'](_0x5a324d[_0x35a1('0x1c')][_0x35a1('0x20')],function(_0x4e9a35){return{'model':db[_0x4e9a35[_0x35a1('0x21')]],'as':_0x4e9a35['as'],'attributes':_0x4e9a35[_0x35a1('0x1e')],'include':_0x4e9a35['include']?_[_0x35a1('0x22')](_0x4e9a35[_0x35a1('0x20')],function(_0x346d2e){return{'model':db[_0x346d2e[_0x35a1('0x21')]],'as':_0x346d2e['as'],'attributes':_0x346d2e[_0x35a1('0x1e')],'include':_0x346d2e[_0x35a1('0x20')]?_[_0x35a1('0x22')](_0x346d2e[_0x35a1('0x20')],function(_0x5f9764){return{'model':db[_0x5f9764['model']],'as':_0x5f9764['as'],'attributes':_0x5f9764[_0x35a1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x35a1('0xf')](function(_0x4d22b2){logger['info'](_0x35a1('0x1b'),_0x5a324d);logger[_0x35a1('0x13')](_0x35a1('0x1b'),_0x5a324d,JSON[_0x35a1('0x15')](_0x4d22b2));_0xcada3(_0x4d22b2);})[_0x35a1('0x1a')](function(_0x19be3d){logger[_0x35a1('0x16')](_0x35a1('0x1b'),_0x19be3d['message'],_0x5a324d);_0x4b978e(_0xffc38['error'](0x1f4,_0x19be3d[_0x35a1('0x18')]));});});};exports[_0x35a1('0x23')]=function(_0x4629c1){var _0x42ea25=this;return new Promise(function(_0x5d0ab5,_0x42e11e){return db['ChatQueue']['find']({'raw':_0x4629c1[_0x35a1('0x1c')]?_0x4629c1[_0x35a1('0x1c')][_0x35a1('0x24')]===undefined?!![]:![]:!![],'where':_0x4629c1['options']?_0x4629c1[_0x35a1('0x1c')][_0x35a1('0x1d')]||null:null,'attributes':_0x4629c1[_0x35a1('0x1c')]?_0x4629c1[_0x35a1('0x1c')][_0x35a1('0x1e')]||null:null,'include':_0x4629c1[_0x35a1('0x1c')]?_0x4629c1[_0x35a1('0x1c')][_0x35a1('0x20')]?_[_0x35a1('0x22')](_0x4629c1['options'][_0x35a1('0x20')],function(_0x202c2d){return{'model':db[_0x202c2d[_0x35a1('0x21')]],'as':_0x202c2d['as'],'attributes':_0x202c2d[_0x35a1('0x1e')],'include':_0x202c2d[_0x35a1('0x20')]?_[_0x35a1('0x22')](_0x202c2d[_0x35a1('0x20')],function(_0x3ec283){return{'model':db[_0x3ec283[_0x35a1('0x21')]],'as':_0x3ec283['as'],'attributes':_0x3ec283['attributes'],'include':_0x3ec283[_0x35a1('0x20')]?_['map'](_0x3ec283[_0x35a1('0x20')],function(_0xa5bfa3){return{'model':db[_0xa5bfa3[_0x35a1('0x21')]],'as':_0xa5bfa3['as'],'attributes':_0xa5bfa3[_0x35a1('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x461bbe){logger['info'](_0x35a1('0x23'),_0x4629c1);logger[_0x35a1('0x13')]('ShowChatQueue',_0x4629c1,JSON[_0x35a1('0x15')](_0x461bbe));_0x5d0ab5(_0x461bbe);})['catch'](function(_0xd14f9f){logger[_0x35a1('0x16')]('ShowChatQueue',_0xd14f9f['message'],_0x4629c1);_0x42e11e(_0x42ea25['error'](0x1f4,_0xd14f9f[_0x35a1('0x18')]));});});}; \ No newline at end of file +var _0x45d8=['stringify','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x3d53dd,_0x2fdac5){var _0xfa348a=function(_0x2479f8){while(--_0x2479f8){_0x3d53dd['push'](_0x3d53dd['shift']());}};_0xfa348a(++_0x2fdac5);}(_0x45d8,0x174));var _0x845d=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0x45d8[_0x383158];return _0x507985;};'use strict';var _=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var moment=require(_0x845d('0x2'));var BPromise=require(_0x845d('0x3'));var rs=require(_0x845d('0x4'));var fs=require('fs');var Redis=require(_0x845d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x845d('0x6'));var logger=require('../../config/logger')(_0x845d('0x7'));var config=require(_0x845d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x845d('0x9')]({'port':0x232a});config['redis']=_[_0x845d('0xa')](config[_0x845d('0xb')],{'host':_0x845d('0xc'),'port':0x18eb});var socket=require(_0x845d('0xd'))(new Redis(config[_0x845d('0xb')]));require(_0x845d('0xe'))['register'](socket);function respondWithRpcPromise(_0x209d2e,_0x234efb,_0x50b504){return new BPromise(function(_0x5d4128,_0x1a2afb){return client[_0x845d('0xf')](_0x209d2e,_0x50b504)[_0x845d('0x10')](function(_0x10deb0){logger[_0x845d('0x11')]('ChatQueue,\x20%s,\x20%s',_0x234efb,_0x845d('0x12'));logger[_0x845d('0x13')](_0x845d('0x14'),_0x234efb,_0x845d('0x12'),JSON['stringify'](_0x10deb0));if(_0x10deb0['error']){if(_0x10deb0[_0x845d('0x15')][_0x845d('0x16')]===0x1f4){logger[_0x845d('0x15')]('ChatQueue,\x20%s,\x20%s',_0x234efb,_0x10deb0[_0x845d('0x15')]['message']);return _0x1a2afb(_0x10deb0[_0x845d('0x15')]['message']);}logger[_0x845d('0x15')](_0x845d('0x17'),_0x234efb,_0x10deb0[_0x845d('0x15')][_0x845d('0x18')]);return _0x5d4128(_0x10deb0[_0x845d('0x15')]['message']);}else{logger['info'](_0x845d('0x17'),_0x234efb,_0x845d('0x12'));_0x5d4128(_0x10deb0[_0x845d('0x19')][_0x845d('0x18')]);}})[_0x845d('0x1a')](function(_0x523b63){logger[_0x845d('0x15')](_0x845d('0x17'),_0x234efb,_0x523b63);_0x1a2afb(_0x523b63);});});}exports[_0x845d('0x1b')]=function(_0x377998){var _0x4683e1=this;return new Promise(function(_0x4a500a,_0xe5768b){return db[_0x845d('0x1c')][_0x845d('0x1d')]({'raw':_0x377998[_0x845d('0x1e')]?_0x377998[_0x845d('0x1e')][_0x845d('0x1f')]===undefined?!![]:![]:!![],'where':_0x377998['options']?_0x377998[_0x845d('0x1e')][_0x845d('0x20')]||null:null,'attributes':_0x377998[_0x845d('0x1e')]?_0x377998['options'][_0x845d('0x21')]||null:null,'limit':_0x377998[_0x845d('0x1e')]?_0x377998[_0x845d('0x1e')][_0x845d('0x22')]||null:null,'include':_0x377998[_0x845d('0x1e')]?_0x377998['options'][_0x845d('0x23')]?_['map'](_0x377998[_0x845d('0x1e')][_0x845d('0x23')],function(_0x5716cd){return{'model':db[_0x5716cd['model']],'as':_0x5716cd['as'],'attributes':_0x5716cd[_0x845d('0x21')],'include':_0x5716cd[_0x845d('0x23')]?_[_0x845d('0x24')](_0x5716cd[_0x845d('0x23')],function(_0x1ea3a2){return{'model':db[_0x1ea3a2['model']],'as':_0x1ea3a2['as'],'attributes':_0x1ea3a2[_0x845d('0x21')],'include':_0x1ea3a2[_0x845d('0x23')]?_['map'](_0x1ea3a2['include'],function(_0x4c60c8){return{'model':db[_0x4c60c8[_0x845d('0x25')]],'as':_0x4c60c8['as'],'attributes':_0x4c60c8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f6d5b){logger[_0x845d('0x11')](_0x845d('0x1b'),_0x377998);logger['debug'](_0x845d('0x1b'),_0x377998,JSON[_0x845d('0x26')](_0x1f6d5b));_0x4a500a(_0x1f6d5b);})[_0x845d('0x1a')](function(_0x48e7a0){logger[_0x845d('0x15')]('GetChatQueue',_0x48e7a0[_0x845d('0x18')],_0x377998);_0xe5768b(_0x4683e1[_0x845d('0x15')](0x1f4,_0x48e7a0[_0x845d('0x18')]));});});};exports[_0x845d('0x27')]=function(_0x142c0f){var _0x546d77=this;return new Promise(function(_0x541de4,_0xf2e232){return db[_0x845d('0x1c')][_0x845d('0x28')]({'raw':_0x142c0f[_0x845d('0x1e')]?_0x142c0f['options']['raw']===undefined?!![]:![]:!![],'where':_0x142c0f[_0x845d('0x1e')]?_0x142c0f['options'][_0x845d('0x20')]||null:null,'attributes':_0x142c0f['options']?_0x142c0f[_0x845d('0x1e')][_0x845d('0x21')]||null:null,'include':_0x142c0f[_0x845d('0x1e')]?_0x142c0f['options'][_0x845d('0x23')]?_[_0x845d('0x24')](_0x142c0f['options'][_0x845d('0x23')],function(_0xcedad){return{'model':db[_0xcedad[_0x845d('0x25')]],'as':_0xcedad['as'],'attributes':_0xcedad[_0x845d('0x21')],'include':_0xcedad[_0x845d('0x23')]?_[_0x845d('0x24')](_0xcedad['include'],function(_0x2b87ce){return{'model':db[_0x2b87ce['model']],'as':_0x2b87ce['as'],'attributes':_0x2b87ce[_0x845d('0x21')],'include':_0x2b87ce[_0x845d('0x23')]?_[_0x845d('0x24')](_0x2b87ce[_0x845d('0x23')],function(_0x47c48f){return{'model':db[_0x47c48f[_0x845d('0x25')]],'as':_0x47c48f['as'],'attributes':_0x47c48f[_0x845d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x845d('0x10')](function(_0xd33156){logger[_0x845d('0x11')](_0x845d('0x27'),_0x142c0f);logger[_0x845d('0x13')]('ShowChatQueue',_0x142c0f,JSON['stringify'](_0xd33156));_0x541de4(_0xd33156);})[_0x845d('0x1a')](function(_0x534a2c){logger['error'](_0x845d('0x27'),_0x534a2c[_0x845d('0x18')],_0x142c0f);_0xf2e232(_0x546d77[_0x845d('0x15')](0x1f4,_0x534a2c[_0x845d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 62fff5f..41f418f 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(_0x334815,_0x46bf53){var _0x49e9ae=function(_0x5688d4){while(--_0x5688d4){_0x334815['push'](_0x334815['shift']());}};_0x49e9ae(++_0x46bf53);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1ed9bb,_0x123c72){_0x1ed9bb=_0x1ed9bb-0x0;var _0x27ce3e=_0x6f0d[_0x1ed9bb];return _0x27ce3e;};'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 _0x4ea3=['removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update','emit'];(function(_0x5c5cd2,_0x5033f3){var _0x1f78b3=function(_0x20efa6){while(--_0x20efa6){_0x5c5cd2['push'](_0x5c5cd2['shift']());}};_0x1f78b3(++_0x5033f3);}(_0x4ea3,0x70));var _0x34ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ea3[_0x14add3];return _0x4a174f;};'use strict';var ChatQueueEvents=require(_0x34ea('0x0'));var events=[_0x34ea('0x1'),_0x34ea('0x2'),_0x34ea('0x3')];function createListener(_0x588172,_0x374ec1){return function(_0x494b56){_0x374ec1[_0x34ea('0x4')](_0x588172,_0x494b56);};}function removeListener(_0x571f1b,_0x5e5a84){return function(){ChatQueueEvents[_0x34ea('0x5')](_0x571f1b,_0x5e5a84);};}exports[_0x34ea('0x6')]=function(_0x962596){for(var _0x123d48=0x0,_0x40434e=events[_0x34ea('0x7')];_0x123d48<_0x40434e;_0x123d48++){var _0x22b09e=events[_0x123d48];var _0x5bec7c=createListener(_0x34ea('0x8')+_0x22b09e,_0x962596);ChatQueueEvents['on'](_0x22b09e,_0x5bec7c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 92b7a04..9d2dece 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x3708f6,_0x57e46f){var _0x33d960=function(_0x4da776){while(--_0x4da776){_0x3708f6['push'](_0x3708f6['shift']());}};_0x33d960(++_0x57e46f);}(_0xe14b,0x93));var _0xbe14=function(_0x152e00,_0x37404b){_0x152e00=_0x152e00-0x0;var _0x3b4c1a=_0xe14b[_0x152e00];return _0x3b4c1a;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23e51b,_0x3da511){var _0x110999=function(_0x162ea0){while(--_0x162ea0){_0x23e51b['push'](_0x23e51b['shift']());}};_0x110999(++_0x3da511);}(_0x008c,0x188));var _0xc008=function(_0x291bc2,_0x580442){_0x291bc2=_0x291bc2-0x0;var _0xab139c=_0x008c[_0x291bc2];return _0xab139c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index e36615c..cc2711f 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 _0xe6f0=['exports','STRING','DATE'];(function(_0x3a209f,_0x116905){var _0x4eeb4f=function(_0x414387){while(--_0x414387){_0x3a209f['push'](_0x3a209f['shift']());}};_0x4eeb4f(++_0x116905);}(_0xe6f0,0x10e));var _0x0e6f=function(_0x18b86d,_0x45e41d){_0x18b86d=_0x18b86d-0x0;var _0x5b9f9d=_0xe6f0[_0x18b86d];return _0x5b9f9d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x0e6f('0x0')]={'uniqueid':{'type':Sequelize[_0x0e6f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x0e6f('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0e6f('0x2')]},'acceptAt':{'type':Sequelize[_0x0e6f('0x2')]},'exitAt':{'type':Sequelize[_0x0e6f('0x2')]},'reason':{'type':Sequelize[_0x0e6f('0x1')]}}; \ No newline at end of file +var _0x2122=['sequelize','exports','STRING','DATE','moment'];(function(_0xa9ffa5,_0x2d8774){var _0x4fc76a=function(_0x2ad13c){while(--_0x2ad13c){_0xa9ffa5['push'](_0xa9ffa5['shift']());}};_0x4fc76a(++_0x2d8774);}(_0x2122,0x167));var _0x2212=function(_0x253e49,_0x16549e){_0x253e49=_0x253e49-0x0;var _0x59b8aa=_0x2122[_0x253e49];return _0x59b8aa;};'use strict';var moment=require(_0x2212('0x0'));var Sequelize=require(_0x2212('0x1'));module[_0x2212('0x2')]={'uniqueid':{'type':Sequelize[_0x2212('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2212('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2212('0x4')]},'exitAt':{'type':Sequelize[_0x2212('0x4')]},'reason':{'type':Sequelize[_0x2212('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 69c6d6c..5a1608b 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 _0x103f=['rows','catch','show','params','intersection','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','index','ChatQueueReport','rawAttributes','fieldName','keys','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x203b79,_0x3662e0){var _0xfd2f50=function(_0x201f0d){while(--_0x201f0d){_0x203b79['push'](_0x203b79['shift']());}};_0xfd2f50(++_0x3662e0);}(_0x103f,0x13e));var _0xf103=function(_0x1d62bc,_0x49ba33){_0x1d62bc=_0x1d62bc-0x0;var _0x7e3156=_0x103f[_0x1d62bc];return _0x7e3156;};'use strict';var emlformat=require(_0xf103('0x0'));var rimraf=require(_0xf103('0x1'));var zipdir=require(_0xf103('0x2'));var jsonpatch=require(_0xf103('0x3'));var rp=require(_0xf103('0x4'));var moment=require(_0xf103('0x5'));var BPromise=require(_0xf103('0x6'));var Mustache=require(_0xf103('0x7'));var util=require(_0xf103('0x8'));var path=require(_0xf103('0x9'));var sox=require('sox');var csv=require(_0xf103('0xa'));var ejs=require(_0xf103('0xb'));var fs=require('fs');var fs_extra=require(_0xf103('0xc'));var _=require(_0xf103('0xd'));var squel=require(_0xf103('0xe'));var crypto=require(_0xf103('0xf'));var jsforce=require(_0xf103('0x10'));var deskjs=require(_0xf103('0x11'));var toCsv=require(_0xf103('0xa'));var querystring=require(_0xf103('0x12'));var Papa=require(_0xf103('0x13'));var Redis=require(_0xf103('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf103('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf103('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xf103('0x17'));var config=require(_0xf103('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf103('0x19'))['db'];function respondWithStatusCode(_0x568960,_0x5735d1){_0x5735d1=_0x5735d1||0xcc;return function(_0x4e7ec5){if(_0x4e7ec5){return _0x568960[_0xf103('0x1a')](_0x5735d1);}return _0x568960['status'](_0x5735d1)[_0xf103('0x1b')]();};}function respondWithResult(_0x1e8765,_0x55ec64){_0x55ec64=_0x55ec64||0xc8;return function(_0x189a41){if(_0x189a41){return _0x1e8765[_0xf103('0x1c')](_0x55ec64)['json'](_0x189a41);}};}function respondWithFilteredResult(_0x1de2a8,_0x299ddf){return function(_0x5bf405){if(_0x5bf405){var _0x13be78=typeof _0x299ddf['offset']==='undefined'&&typeof _0x299ddf[_0xf103('0x1d')]===_0xf103('0x1e');var _0x31e26e=_0x5bf405[_0xf103('0x1f')];var _0x1659fa=_0x13be78?0x0:_0x299ddf[_0xf103('0x20')];var _0x5a2e85=_0x13be78?_0x5bf405[_0xf103('0x1f')]:_0x299ddf[_0xf103('0x20')]+_0x299ddf['limit'];var _0x21ea69;if(_0x5a2e85>=_0x31e26e){_0x5a2e85=_0x31e26e;_0x21ea69=0xc8;}else{_0x21ea69=0xce;}_0x1de2a8[_0xf103('0x1c')](_0x21ea69);return _0x1de2a8[_0xf103('0x21')](_0xf103('0x22'),_0x1659fa+'-'+_0x5a2e85+'/'+_0x31e26e)[_0xf103('0x23')](_0x5bf405);}return null;};}function patchUpdates(_0x5d28e9){return function(_0x32aaa5){try{jsonpatch[_0xf103('0x24')](_0x32aaa5,_0x5d28e9,!![]);}catch(_0x467b15){return BPromise[_0xf103('0x25')](_0x467b15);}return _0x32aaa5[_0xf103('0x26')]();};}function saveUpdates(_0x319c49,_0x3607ce){return function(_0x111e83){if(_0x111e83){return _0x111e83['update'](_0x319c49)[_0xf103('0x27')](function(_0x4fab08){return _0x4fab08;});}return null;};}function removeEntity(_0x470479,_0x4d1752){return function(_0x3a8d9e){if(_0x3a8d9e){return _0x3a8d9e[_0xf103('0x28')]()[_0xf103('0x27')](function(){_0x470479[_0xf103('0x1c')](0xcc)[_0xf103('0x1b')]();});}};}function handleEntityNotFound(_0x297198,_0x23a122){return function(_0x259797){if(!_0x259797){_0x297198['sendStatus'](0x194);}return _0x259797;};}function handleError(_0x2c415a,_0x4bdc52){_0x4bdc52=_0x4bdc52||0x1f4;return function(_0x259fdc){logger['error'](_0x259fdc[_0xf103('0x29')]);if(_0x259fdc[_0xf103('0x2a')]){delete _0x259fdc[_0xf103('0x2a')];}_0x2c415a[_0xf103('0x1c')](_0x4bdc52)['send'](_0x259fdc);};}exports[_0xf103('0x2b')]=function(_0x1d3cdd,_0x14b6b7){var _0x5a1f81={},_0x4adf44={},_0x1b0a13={'count':0x0,'rows':[]};var _0x7ee263=_['map'](db[_0xf103('0x2c')][_0xf103('0x2d')],function(_0x2fab93){return{'name':_0x2fab93[_0xf103('0x2e')],'type':_0x2fab93['type']['key']};});_0x4adf44['model']=_['map'](_0x7ee263,_0xf103('0x2a'));_0x4adf44['query']=_[_0xf103('0x2f')](_0x1d3cdd[_0xf103('0x30')]);_0x4adf44[_0xf103('0x31')]=_['intersection'](_0x4adf44['model'],_0x4adf44[_0xf103('0x30')]);_0x5a1f81[_0xf103('0x32')]=_['intersection'](_0x4adf44[_0xf103('0x33')],qs[_0xf103('0x34')](_0x1d3cdd[_0xf103('0x30')][_0xf103('0x34')]));_0x5a1f81[_0xf103('0x32')]=_0x5a1f81[_0xf103('0x32')][_0xf103('0x35')]?_0x5a1f81[_0xf103('0x32')]:_0x4adf44[_0xf103('0x33')];if(!_0x1d3cdd[_0xf103('0x30')][_0xf103('0x36')](_0xf103('0x37'))){_0x5a1f81[_0xf103('0x1d')]=qs[_0xf103('0x1d')](_0x1d3cdd[_0xf103('0x30')][_0xf103('0x1d')]);_0x5a1f81[_0xf103('0x20')]=qs['offset'](_0x1d3cdd[_0xf103('0x30')][_0xf103('0x20')]);}_0x5a1f81[_0xf103('0x38')]=qs['sort'](_0x1d3cdd[_0xf103('0x30')]['sort']);_0x5a1f81['where']=qs[_0xf103('0x31')](_[_0xf103('0x39')](_0x1d3cdd[_0xf103('0x30')],_0x4adf44[_0xf103('0x31')]),_0x7ee263);if(_0x1d3cdd[_0xf103('0x30')][_0xf103('0x3a')]){_0x5a1f81[_0xf103('0x3b')]=_[_0xf103('0x3c')](_0x5a1f81[_0xf103('0x3b')],{'$or':_['map'](_0x7ee263,function(_0x3cd906){if(_0x3cd906[_0xf103('0x3d')]!==_0xf103('0x3e')){var _0x4a192c={};_0x4a192c[_0x3cd906[_0xf103('0x2a')]]={'$like':'%'+_0x1d3cdd[_0xf103('0x30')][_0xf103('0x3a')]+'%'};return _0x4a192c;}})});}_0x5a1f81=_['merge']({},_0x5a1f81,_0x1d3cdd[_0xf103('0x3f')]);var _0x7ff67a={'where':_0x5a1f81[_0xf103('0x3b')]};return db[_0xf103('0x2c')][_0xf103('0x1f')](_0x7ff67a)['then'](function(_0x4c22b2){_0x1b0a13[_0xf103('0x1f')]=_0x4c22b2;if(_0x1d3cdd[_0xf103('0x30')][_0xf103('0x40')]){_0x5a1f81[_0xf103('0x41')]=[{'all':!![]}];}return db[_0xf103('0x2c')][_0xf103('0x42')](_0x5a1f81);})[_0xf103('0x27')](function(_0x304ce2){_0x1b0a13[_0xf103('0x43')]=_0x304ce2;return _0x1b0a13;})[_0xf103('0x27')](respondWithFilteredResult(_0x14b6b7,_0x5a1f81))[_0xf103('0x44')](handleError(_0x14b6b7,null));};exports[_0xf103('0x45')]=function(_0x439cf4,_0x26df37){var _0x434a3a={'raw':!![],'where':{'id':_0x439cf4[_0xf103('0x46')]['id']}},_0x16ed02={};_0x16ed02['model']=_['keys'](db[_0xf103('0x2c')][_0xf103('0x2d')]);_0x16ed02['query']=_[_0xf103('0x2f')](_0x439cf4[_0xf103('0x30')]);_0x16ed02[_0xf103('0x31')]=_[_0xf103('0x47')](_0x16ed02[_0xf103('0x33')],_0x16ed02['query']);_0x434a3a[_0xf103('0x32')]=_[_0xf103('0x47')](_0x16ed02['model'],qs[_0xf103('0x34')](_0x439cf4[_0xf103('0x30')][_0xf103('0x34')]));_0x434a3a[_0xf103('0x32')]=_0x434a3a[_0xf103('0x32')]['length']?_0x434a3a['attributes']:_0x16ed02['model'];if(_0x439cf4['query'][_0xf103('0x40')]){_0x434a3a[_0xf103('0x41')]=[{'all':!![]}];}_0x434a3a=_[_0xf103('0x3c')]({},_0x434a3a,_0x439cf4[_0xf103('0x3f')]);return db[_0xf103('0x2c')][_0xf103('0x48')](_0x434a3a)[_0xf103('0x27')](handleEntityNotFound(_0x26df37,null))[_0xf103('0x27')](respondWithResult(_0x26df37,null))[_0xf103('0x44')](handleError(_0x26df37,null));};exports[_0xf103('0x49')]=function(_0x326562,_0x2f6cca){return db[_0xf103('0x2c')]['create'](_0x326562[_0xf103('0x4a')],{})[_0xf103('0x27')](respondWithResult(_0x2f6cca,0xc9))['catch'](handleError(_0x2f6cca,null));};exports[_0xf103('0x4b')]=function(_0x5209ac,_0x382217){if(_0x5209ac[_0xf103('0x4a')]['id']){delete _0x5209ac[_0xf103('0x4a')]['id'];}return db[_0xf103('0x2c')][_0xf103('0x48')]({'where':{'id':_0x5209ac['params']['id']}})[_0xf103('0x27')](handleEntityNotFound(_0x382217,null))['then'](saveUpdates(_0x5209ac[_0xf103('0x4a')],null))[_0xf103('0x27')](respondWithResult(_0x382217,null))['catch'](handleError(_0x382217,null));};exports['destroy']=function(_0x267e8f,_0x677aaf){return db[_0xf103('0x2c')][_0xf103('0x48')]({'where':{'id':_0x267e8f[_0xf103('0x46')]['id']}})['then'](handleEntityNotFound(_0x677aaf,null))[_0xf103('0x27')](removeEntity(_0x677aaf,null))[_0xf103('0x44')](handleError(_0x677aaf,null));};exports['describe']=function(_0x463494,_0x2a0e12){return db[_0xf103('0x2c')][_0xf103('0x4c')]()[_0xf103('0x27')](respondWithResult(_0x2a0e12,null))['catch'](handleError(_0x2a0e12,null));}; \ No newline at end of file +var _0xe635=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','status','error','stack','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv'];(function(_0x49818b,_0x11f5b9){var _0x58ec37=function(_0x56a59b){while(--_0x56a59b){_0x49818b['push'](_0x49818b['shift']());}};_0x58ec37(++_0x11f5b9);}(_0xe635,0x1be));var _0x5e63=function(_0x28e3d3,_0x54fb1b){_0x28e3d3=_0x28e3d3-0x0;var _0x257607=_0xe635[_0x28e3d3];return _0x257607;};'use strict';var emlformat=require(_0x5e63('0x0'));var rimraf=require(_0x5e63('0x1'));var zipdir=require(_0x5e63('0x2'));var jsonpatch=require(_0x5e63('0x3'));var rp=require(_0x5e63('0x4'));var moment=require(_0x5e63('0x5'));var BPromise=require(_0x5e63('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5e63('0x7'));var sox=require(_0x5e63('0x8'));var csv=require(_0x5e63('0x9'));var ejs=require(_0x5e63('0xa'));var fs=require('fs');var fs_extra=require(_0x5e63('0xb'));var _=require(_0x5e63('0xc'));var squel=require(_0x5e63('0xd'));var crypto=require(_0x5e63('0xe'));var jsforce=require(_0x5e63('0xf'));var deskjs=require(_0x5e63('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5e63('0x11'));var Papa=require(_0x5e63('0x12'));var Redis=require(_0x5e63('0x13'));var authService=require(_0x5e63('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5e63('0x15'));var hardwareService=require(_0x5e63('0x16'));var logger=require('../../config/logger')(_0x5e63('0x17'));var utils=require(_0x5e63('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5e63('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dcbf4,_0x23c833){_0x23c833=_0x23c833||0xcc;return function(_0x3bc901){if(_0x3bc901){return _0x1dcbf4[_0x5e63('0x1a')](_0x23c833);}return _0x1dcbf4['status'](_0x23c833)['end']();};}function respondWithResult(_0x560fee,_0x187e2e){_0x187e2e=_0x187e2e||0xc8;return function(_0x1fc0f8){if(_0x1fc0f8){return _0x560fee['status'](_0x187e2e)[_0x5e63('0x1b')](_0x1fc0f8);}};}function respondWithFilteredResult(_0x1f7149,_0x3c5d47){return function(_0x491e27){if(_0x491e27){var _0x42a714=typeof _0x3c5d47[_0x5e63('0x1c')]===_0x5e63('0x1d')&&typeof _0x3c5d47[_0x5e63('0x1e')]===_0x5e63('0x1d');var _0x578c68=_0x491e27[_0x5e63('0x1f')];var _0x42b370=_0x42a714?0x0:_0x3c5d47[_0x5e63('0x1c')];var _0xbdcef0=_0x42a714?_0x491e27[_0x5e63('0x1f')]:_0x3c5d47['offset']+_0x3c5d47[_0x5e63('0x1e')];var _0x566514;if(_0xbdcef0>=_0x578c68){_0xbdcef0=_0x578c68;_0x566514=0xc8;}else{_0x566514=0xce;}_0x1f7149['status'](_0x566514);return _0x1f7149[_0x5e63('0x20')](_0x5e63('0x21'),_0x42b370+'-'+_0xbdcef0+'/'+_0x578c68)[_0x5e63('0x1b')](_0x491e27);}return null;};}function patchUpdates(_0x2ba2f0){return function(_0x239d37){try{jsonpatch[_0x5e63('0x22')](_0x239d37,_0x2ba2f0,!![]);}catch(_0x464b76){return BPromise[_0x5e63('0x23')](_0x464b76);}return _0x239d37[_0x5e63('0x24')]();};}function saveUpdates(_0x3fdabb,_0x4c52f9){return function(_0x11c00f){if(_0x11c00f){return _0x11c00f['update'](_0x3fdabb)['then'](function(_0xeeff0e){return _0xeeff0e;});}return null;};}function removeEntity(_0x3ff002,_0x2d9387){return function(_0x9dc630){if(_0x9dc630){return _0x9dc630[_0x5e63('0x25')]()[_0x5e63('0x26')](function(){_0x3ff002[_0x5e63('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x275715,_0x58628a){return function(_0xeef6b7){if(!_0xeef6b7){_0x275715[_0x5e63('0x1a')](0x194);}return _0xeef6b7;};}function handleError(_0x5b468d,_0x3f9440){_0x3f9440=_0x3f9440||0x1f4;return function(_0x4fe1b3){logger[_0x5e63('0x28')](_0x4fe1b3[_0x5e63('0x29')]);if(_0x4fe1b3['name']){delete _0x4fe1b3['name'];}_0x5b468d[_0x5e63('0x27')](_0x3f9440)[_0x5e63('0x2a')](_0x4fe1b3);};}exports[_0x5e63('0x2b')]=function(_0x395bb2,_0x38da60){var _0x25c635={},_0x4b3e42={},_0x104694={'count':0x0,'rows':[]};var _0x56a105=_[_0x5e63('0x2c')](db[_0x5e63('0x2d')][_0x5e63('0x2e')],function(_0x2bd382){return{'name':_0x2bd382[_0x5e63('0x2f')],'type':_0x2bd382[_0x5e63('0x30')]['key']};});_0x4b3e42[_0x5e63('0x31')]=_[_0x5e63('0x2c')](_0x56a105,_0x5e63('0x32'));_0x4b3e42['query']=_[_0x5e63('0x33')](_0x395bb2[_0x5e63('0x34')]);_0x4b3e42[_0x5e63('0x35')]=_[_0x5e63('0x36')](_0x4b3e42['model'],_0x4b3e42['query']);_0x25c635['attributes']=_['intersection'](_0x4b3e42[_0x5e63('0x31')],qs[_0x5e63('0x37')](_0x395bb2[_0x5e63('0x34')]['fields']));_0x25c635[_0x5e63('0x38')]=_0x25c635[_0x5e63('0x38')]['length']?_0x25c635[_0x5e63('0x38')]:_0x4b3e42[_0x5e63('0x31')];if(!_0x395bb2[_0x5e63('0x34')][_0x5e63('0x39')]('nolimit')){_0x25c635[_0x5e63('0x1e')]=qs['limit'](_0x395bb2['query'][_0x5e63('0x1e')]);_0x25c635[_0x5e63('0x1c')]=qs[_0x5e63('0x1c')](_0x395bb2[_0x5e63('0x34')]['offset']);}_0x25c635[_0x5e63('0x3a')]=qs[_0x5e63('0x3b')](_0x395bb2[_0x5e63('0x34')][_0x5e63('0x3b')]);_0x25c635[_0x5e63('0x3c')]=qs[_0x5e63('0x35')](_[_0x5e63('0x3d')](_0x395bb2[_0x5e63('0x34')],_0x4b3e42['filters']),_0x56a105);if(_0x395bb2[_0x5e63('0x34')]['filter']){_0x25c635[_0x5e63('0x3c')]=_['merge'](_0x25c635[_0x5e63('0x3c')],{'$or':_[_0x5e63('0x2c')](_0x56a105,function(_0x5555fc){if(_0x5555fc[_0x5e63('0x30')]!==_0x5e63('0x3e')){var _0x14a660={};_0x14a660[_0x5555fc[_0x5e63('0x32')]]={'$like':'%'+_0x395bb2['query']['filter']+'%'};return _0x14a660;}})});}_0x25c635=_[_0x5e63('0x3f')]({},_0x25c635,_0x395bb2[_0x5e63('0x40')]);var _0x288ab1={'where':_0x25c635[_0x5e63('0x3c')]};return db['ChatQueueReport']['count'](_0x288ab1)['then'](function(_0x416f30){_0x104694[_0x5e63('0x1f')]=_0x416f30;if(_0x395bb2[_0x5e63('0x34')][_0x5e63('0x41')]){_0x25c635[_0x5e63('0x42')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x5e63('0x43')](_0x25c635);})[_0x5e63('0x26')](function(_0x51b36c){_0x104694[_0x5e63('0x44')]=_0x51b36c;return _0x104694;})['then'](respondWithFilteredResult(_0x38da60,_0x25c635))[_0x5e63('0x45')](handleError(_0x38da60,null));};exports['show']=function(_0x286266,_0x3c544c){var _0x14861f={'raw':!![],'where':{'id':_0x286266[_0x5e63('0x46')]['id']}},_0x4d1bf1={};_0x4d1bf1[_0x5e63('0x31')]=_[_0x5e63('0x33')](db[_0x5e63('0x2d')][_0x5e63('0x2e')]);_0x4d1bf1[_0x5e63('0x34')]=_['keys'](_0x286266[_0x5e63('0x34')]);_0x4d1bf1[_0x5e63('0x35')]=_[_0x5e63('0x36')](_0x4d1bf1[_0x5e63('0x31')],_0x4d1bf1[_0x5e63('0x34')]);_0x14861f['attributes']=_[_0x5e63('0x36')](_0x4d1bf1[_0x5e63('0x31')],qs['fields'](_0x286266['query'][_0x5e63('0x37')]));_0x14861f['attributes']=_0x14861f[_0x5e63('0x38')]['length']?_0x14861f['attributes']:_0x4d1bf1[_0x5e63('0x31')];if(_0x286266[_0x5e63('0x34')][_0x5e63('0x41')]){_0x14861f[_0x5e63('0x42')]=[{'all':!![]}];}_0x14861f=_[_0x5e63('0x3f')]({},_0x14861f,_0x286266[_0x5e63('0x40')]);return db[_0x5e63('0x2d')][_0x5e63('0x47')](_0x14861f)[_0x5e63('0x26')](handleEntityNotFound(_0x3c544c,null))[_0x5e63('0x26')](respondWithResult(_0x3c544c,null))[_0x5e63('0x45')](handleError(_0x3c544c,null));};exports[_0x5e63('0x48')]=function(_0x266493,_0x571e6d){return db[_0x5e63('0x2d')][_0x5e63('0x48')](_0x266493[_0x5e63('0x49')],{})[_0x5e63('0x26')](respondWithResult(_0x571e6d,0xc9))[_0x5e63('0x45')](handleError(_0x571e6d,null));};exports[_0x5e63('0x4a')]=function(_0x4aad13,_0x2968bd){if(_0x4aad13['body']['id']){delete _0x4aad13[_0x5e63('0x49')]['id'];}return db['ChatQueueReport'][_0x5e63('0x47')]({'where':{'id':_0x4aad13[_0x5e63('0x46')]['id']}})['then'](handleEntityNotFound(_0x2968bd,null))['then'](saveUpdates(_0x4aad13['body'],null))[_0x5e63('0x26')](respondWithResult(_0x2968bd,null))['catch'](handleError(_0x2968bd,null));};exports[_0x5e63('0x25')]=function(_0x4be837,_0x43001f){return db[_0x5e63('0x2d')][_0x5e63('0x47')]({'where':{'id':_0x4be837['params']['id']}})['then'](handleEntityNotFound(_0x43001f,null))[_0x5e63('0x26')](removeEntity(_0x43001f,null))['catch'](handleError(_0x43001f,null));};exports[_0x5e63('0x4b')]=function(_0x24426f,_0x82e226){return db['ChatQueueReport'][_0x5e63('0x4b')]()['then'](respondWithResult(_0x82e226,null))[_0x5e63('0x45')](handleError(_0x82e226,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2b8b162..97a6717 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x273bde,_0xe53b0){var _0x3401ac=function(_0x460f93){while(--_0x460f93){_0x273bde['push'](_0x273bde['shift']());}};_0x3401ac(++_0xe53b0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x261363,_0x57a4f0){var _0x153c76=function(_0x51ff0f){while(--_0x51ff0f){_0x261363['push'](_0x261363['shift']());}};_0x153c76(++_0x57a4f0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index f05591c..c16b466 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 _0xaf02=['ChatQueueReport,\x20%s,\x20%s','message','request\x20sent','result','catch','ChatQueueReport','create','body','options','raw','info','CreateChatQueueReport','UpdateChatQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','debug','stringify','error'];(function(_0x20d14c,_0x44fad9){var _0x324717=function(_0x1a4d6e){while(--_0x1a4d6e){_0x20d14c['push'](_0x20d14c['shift']());}};_0x324717(++_0x44fad9);}(_0xaf02,0x90));var _0x2af0=function(_0x4471d3,_0x53f1c5){_0x4471d3=_0x4471d3-0x0;var _0x403ca7=_0xaf02[_0x4471d3];return _0x403ca7;};'use strict';var _=require(_0x2af0('0x0'));var util=require(_0x2af0('0x1'));var moment=require('moment');var BPromise=require(_0x2af0('0x2'));var rs=require(_0x2af0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2af0('0x4'))['db'];var utils=require(_0x2af0('0x5'));var logger=require(_0x2af0('0x6'))(_0x2af0('0x7'));var config=require(_0x2af0('0x8'));var jayson=require(_0x2af0('0x9'));var client=jayson[_0x2af0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46fa24,_0x490d8e,_0x9afc16){return new BPromise(function(_0x3935e9,_0x29d049){return client[_0x2af0('0xb')](_0x46fa24,_0x9afc16)[_0x2af0('0xc')](function(_0x32dfee){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x490d8e,'request\x20sent');logger[_0x2af0('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x490d8e,'request\x20sent',JSON[_0x2af0('0xe')](_0x32dfee));if(_0x32dfee[_0x2af0('0xf')]){if(_0x32dfee[_0x2af0('0xf')]['code']===0x1f4){logger[_0x2af0('0xf')](_0x2af0('0x10'),_0x490d8e,_0x32dfee['error'][_0x2af0('0x11')]);return _0x29d049(_0x32dfee[_0x2af0('0xf')][_0x2af0('0x11')]);}logger[_0x2af0('0xf')](_0x2af0('0x10'),_0x490d8e,_0x32dfee[_0x2af0('0xf')]['message']);return _0x3935e9(_0x32dfee[_0x2af0('0xf')][_0x2af0('0x11')]);}else{logger['info'](_0x2af0('0x10'),_0x490d8e,_0x2af0('0x12'));_0x3935e9(_0x32dfee[_0x2af0('0x13')][_0x2af0('0x11')]);}})[_0x2af0('0x14')](function(_0x3e9a58){logger[_0x2af0('0xf')](_0x2af0('0x10'),_0x490d8e,_0x3e9a58);_0x29d049(_0x3e9a58);});});}exports['CreateChatQueueReport']=function(_0x4663b1){var _0x4330c2=this;return new Promise(function(_0xae7a9b,_0x205390){return db[_0x2af0('0x15')][_0x2af0('0x16')](_0x4663b1[_0x2af0('0x17')],{'raw':_0x4663b1[_0x2af0('0x18')]?_0x4663b1[_0x2af0('0x18')][_0x2af0('0x19')]===undefined?!![]:![]:!![]})[_0x2af0('0xc')](function(_0x4279f0){logger[_0x2af0('0x1a')](_0x2af0('0x1b'),_0x4663b1);logger['debug'](_0x2af0('0x1b'),_0x4663b1,JSON[_0x2af0('0xe')](_0x4279f0));_0xae7a9b(_0x4279f0);})[_0x2af0('0x14')](function(_0x2b25fb){logger['error'](_0x2af0('0x1b'),_0x2b25fb[_0x2af0('0x11')],_0x4663b1);_0x205390(_0x4330c2['error'](0x1f4,_0x2b25fb[_0x2af0('0x11')]));});});};exports[_0x2af0('0x1c')]=function(_0x40b175){var _0x2ff672=this;return new Promise(function(_0x47d9f9,_0x140fe7){return db['ChatQueueReport'][_0x2af0('0x1d')](_0x40b175[_0x2af0('0x17')],{'raw':_0x40b175[_0x2af0('0x18')]?_0x40b175[_0x2af0('0x18')][_0x2af0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40b175[_0x2af0('0x18')]?_0x40b175['options']['where']||null:null,'attributes':_0x40b175[_0x2af0('0x18')]?_0x40b175[_0x2af0('0x18')][_0x2af0('0x1e')]||null:null,'limit':_0x40b175[_0x2af0('0x18')]?_0x40b175['options'][_0x2af0('0x1f')]||null:null})[_0x2af0('0xc')](function(_0x1dc54f){logger[_0x2af0('0x1a')](_0x2af0('0x1c'),_0x40b175);logger[_0x2af0('0xd')](_0x2af0('0x1c'),_0x40b175,JSON[_0x2af0('0xe')](_0x1dc54f));_0x47d9f9(_0x1dc54f);})[_0x2af0('0x14')](function(_0x189131){logger[_0x2af0('0xf')](_0x2af0('0x1c'),_0x189131[_0x2af0('0x11')],_0x40b175);_0x140fe7(_0x2ff672['error'](0x1f4,_0x189131[_0x2af0('0x11')]));});});}; \ No newline at end of file +var _0xe404=['UpdateChatQueueReport','update','body','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','stringify'];(function(_0x165201,_0x27338d){var _0x12b17e=function(_0x29ff3b){while(--_0x29ff3b){_0x165201['push'](_0x165201['shift']());}};_0x12b17e(++_0x27338d);}(_0xe404,0x117));var _0x4e40=function(_0x2147b6,_0x5dfca3){_0x2147b6=_0x2147b6-0x0;var _0x497241=_0xe404[_0x2147b6];return _0x497241;};'use strict';var _=require(_0x4e40('0x0'));var util=require(_0x4e40('0x1'));var moment=require(_0x4e40('0x2'));var BPromise=require(_0x4e40('0x3'));var rs=require(_0x4e40('0x4'));var fs=require('fs');var Redis=require(_0x4e40('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4e40('0x6'))(_0x4e40('0x7'));var config=require(_0x4e40('0x8'));var jayson=require(_0x4e40('0x9'));var client=jayson[_0x4e40('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x450b68,_0x5cb646,_0x59d6d8){return new BPromise(function(_0x781196,_0xa7cf12){return client[_0x4e40('0xb')](_0x450b68,_0x59d6d8)[_0x4e40('0xc')](function(_0x1bfb5b){logger[_0x4e40('0xd')](_0x4e40('0xe'),_0x5cb646,'request\x20sent');logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5cb646,_0x4e40('0xf'),JSON['stringify'](_0x1bfb5b));if(_0x1bfb5b[_0x4e40('0x10')]){if(_0x1bfb5b[_0x4e40('0x10')][_0x4e40('0x11')]===0x1f4){logger[_0x4e40('0x10')](_0x4e40('0xe'),_0x5cb646,_0x1bfb5b[_0x4e40('0x10')][_0x4e40('0x12')]);return _0xa7cf12(_0x1bfb5b[_0x4e40('0x10')][_0x4e40('0x12')]);}logger[_0x4e40('0x10')](_0x4e40('0xe'),_0x5cb646,_0x1bfb5b[_0x4e40('0x10')][_0x4e40('0x12')]);return _0x781196(_0x1bfb5b[_0x4e40('0x10')][_0x4e40('0x12')]);}else{logger[_0x4e40('0xd')](_0x4e40('0xe'),_0x5cb646,_0x4e40('0xf'));_0x781196(_0x1bfb5b[_0x4e40('0x13')][_0x4e40('0x12')]);}})[_0x4e40('0x14')](function(_0x4921b6){logger[_0x4e40('0x10')](_0x4e40('0xe'),_0x5cb646,_0x4921b6);_0xa7cf12(_0x4921b6);});});}exports[_0x4e40('0x15')]=function(_0x157304){var _0x28193b=this;return new Promise(function(_0x4b4d1c,_0x32c42c){return db[_0x4e40('0x16')][_0x4e40('0x17')](_0x157304['body'],{'raw':_0x157304['options']?_0x157304[_0x4e40('0x18')][_0x4e40('0x19')]===undefined?!![]:![]:!![]})[_0x4e40('0xc')](function(_0x36dd5f){logger[_0x4e40('0xd')](_0x4e40('0x15'),_0x157304);logger['debug']('CreateChatQueueReport',_0x157304,JSON[_0x4e40('0x1a')](_0x36dd5f));_0x4b4d1c(_0x36dd5f);})[_0x4e40('0x14')](function(_0x42db96){logger['error'](_0x4e40('0x15'),_0x42db96[_0x4e40('0x12')],_0x157304);_0x32c42c(_0x28193b[_0x4e40('0x10')](0x1f4,_0x42db96[_0x4e40('0x12')]));});});};exports[_0x4e40('0x1b')]=function(_0x203edd){var _0x2f9699=this;return new Promise(function(_0x12d3a1,_0x4ca270){return db[_0x4e40('0x16')][_0x4e40('0x1c')](_0x203edd[_0x4e40('0x1d')],{'raw':_0x203edd[_0x4e40('0x18')]?_0x203edd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x203edd[_0x4e40('0x18')]?_0x203edd[_0x4e40('0x18')][_0x4e40('0x1e')]||null:null,'attributes':_0x203edd['options']?_0x203edd['options'][_0x4e40('0x1f')]||null:null,'limit':_0x203edd[_0x4e40('0x18')]?_0x203edd['options'][_0x4e40('0x20')]||null:null})[_0x4e40('0xc')](function(_0x4e9a4f){logger[_0x4e40('0xd')](_0x4e40('0x1b'),_0x203edd);logger[_0x4e40('0x21')](_0x4e40('0x1b'),_0x203edd,JSON[_0x4e40('0x1a')](_0x4e9a4f));_0x12d3a1(_0x4e9a4f);})[_0x4e40('0x14')](function(_0x238430){logger[_0x4e40('0x10')](_0x4e40('0x1b'),_0x238430[_0x4e40('0x12')],_0x203edd);_0x4ca270(_0x2f9699['error'](0x1f4,_0x238430[_0x4e40('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index ca01f1e..a95413d 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 _0x3f92=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','put','update','delete','destroy','exports','util','path'];(function(_0x1b7d0b,_0x4e5b15){var _0x20db16=function(_0x5d725c){while(--_0x5d725c){_0x1b7d0b['push'](_0x1b7d0b['shift']());}};_0x20db16(++_0x4e5b15);}(_0x3f92,0x116));var _0x23f9=function(_0x511497,_0x57ea9c){_0x511497=_0x511497-0x0;var _0x3c949a=_0x3f92[_0x511497];return _0x3c949a;};'use strict';var multer=require('multer');var util=require(_0x23f9('0x0'));var path=require(_0x23f9('0x1'));var timeout=require('connect-timeout');var express=require(_0x23f9('0x2'));var router=express[_0x23f9('0x3')]();var fs_extra=require(_0x23f9('0x4'));var auth=require(_0x23f9('0x5'));var interaction=require(_0x23f9('0x6'));var config=require(_0x23f9('0x7'));var controller=require(_0x23f9('0x8'));router[_0x23f9('0x9')]('/',auth[_0x23f9('0xa')](),controller['index']);router[_0x23f9('0x9')](_0x23f9('0xb'),auth['isAuthenticated'](),controller[_0x23f9('0xc')]);router['get']('/:id',auth[_0x23f9('0xa')](),controller[_0x23f9('0xd')]);router[_0x23f9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x23f9('0xf')]('/:id',auth[_0x23f9('0xa')](),controller[_0x23f9('0x10')]);router[_0x23f9('0x11')]('/:id',auth[_0x23f9('0xa')](),controller[_0x23f9('0x12')]);module[_0x23f9('0x13')]=router; \ No newline at end of file +var _0xd508=['./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','delete','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3161fd,_0x2a6c39){var _0x18f6a6=function(_0xad3c1e){while(--_0xad3c1e){_0x3161fd['push'](_0x3161fd['shift']());}};_0x18f6a6(++_0x2a6c39);}(_0xd508,0x77));var _0x8d50=function(_0x2fe51c,_0x5d55b5){_0x2fe51c=_0x2fe51c-0x0;var _0x1ddf0f=_0xd508[_0x2fe51c];return _0x1ddf0f;};'use strict';var multer=require(_0x8d50('0x0'));var util=require('util');var path=require(_0x8d50('0x1'));var timeout=require(_0x8d50('0x2'));var express=require(_0x8d50('0x3'));var router=express['Router']();var fs_extra=require(_0x8d50('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8d50('0x5'));var config=require(_0x8d50('0x6'));var controller=require(_0x8d50('0x7'));router[_0x8d50('0x8')]('/',auth[_0x8d50('0x9')](),controller[_0x8d50('0xa')]);router[_0x8d50('0x8')](_0x8d50('0xb'),auth[_0x8d50('0x9')](),controller[_0x8d50('0xc')]);router[_0x8d50('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8d50('0xd')]);router['post']('/',auth[_0x8d50('0x9')](),controller[_0x8d50('0xe')]);router[_0x8d50('0xf')](_0x8d50('0x10'),auth[_0x8d50('0x9')](),controller['update']);router[_0x8d50('0x11')]('/:id',auth[_0x8d50('0x9')](),controller['destroy']);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 66fe38b..6fb7a4e 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xed996a,_0x38a424){var _0x381be2=function(_0x441b70){while(--_0x441b70){_0xed996a['push'](_0xed996a['shift']());}};_0x381be2(++_0x38a424);}(_0x70e0,0x17b));var _0x070e=function(_0x2083bd,_0x554430){_0x2083bd=_0x2083bd-0x0;var _0x32a285=_0x70e0[_0x2083bd];return _0x32a285;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x9e72c8,_0x5ac1a9){var _0x1468b2=function(_0x2cac69){while(--_0x2cac69){_0x9e72c8['push'](_0x9e72c8['shift']());}};_0x1468b2(++_0x5ac1a9);}(_0x008c,0x188));var _0xc008=function(_0x494160,_0xadfa3f){_0x494160=_0x494160-0x0;var _0x5934b2=_0x008c[_0x494160];return _0x5934b2;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 8281865..b5ee1b3 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 _0xdee2=['set','Content-Range','apply','reject','update','then','destroy','error','name','send','ChatTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x5474bc,_0xabecb7){var _0x18e6b5=function(_0x40bcfc){while(--_0x40bcfc){_0x5474bc['push'](_0x5474bc['shift']());}};_0x18e6b5(++_0xabecb7);}(_0xdee2,0x1f4));var _0x2dee=function(_0x2a530f,_0x20a9f2){_0x2a530f=_0x2a530f-0x0;var _0xdeb772=_0xdee2[_0x2a530f];return _0xdeb772;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2dee('0x0'));var zipdir=require(_0x2dee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2dee('0x2'));var moment=require(_0x2dee('0x3'));var BPromise=require(_0x2dee('0x4'));var Mustache=require(_0x2dee('0x5'));var util=require(_0x2dee('0x6'));var path=require('path');var sox=require(_0x2dee('0x7'));var csv=require(_0x2dee('0x8'));var ejs=require(_0x2dee('0x9'));var fs=require('fs');var fs_extra=require(_0x2dee('0xa'));var _=require(_0x2dee('0xb'));var squel=require(_0x2dee('0xc'));var crypto=require(_0x2dee('0xd'));var jsforce=require(_0x2dee('0xe'));var deskjs=require(_0x2dee('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2dee('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2dee('0x11'));var qs=require(_0x2dee('0x12'));var as=require(_0x2dee('0x13'));var hardwareService=require(_0x2dee('0x14'));var logger=require(_0x2dee('0x15'))(_0x2dee('0x16'));var utils=require('../../config/utils');var config=require(_0x2dee('0x17'));var licenseUtil=require(_0x2dee('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a73a,_0x1c97fe){_0x1c97fe=_0x1c97fe||0xcc;return function(_0xcad7d){if(_0xcad7d){return _0x18a73a[_0x2dee('0x19')](_0x1c97fe);}return _0x18a73a[_0x2dee('0x1a')](_0x1c97fe)[_0x2dee('0x1b')]();};}function respondWithResult(_0x315b3d,_0x18931e){_0x18931e=_0x18931e||0xc8;return function(_0x28f3c4){if(_0x28f3c4){return _0x315b3d[_0x2dee('0x1a')](_0x18931e)['json'](_0x28f3c4);}};}function respondWithFilteredResult(_0x5068db,_0x15ca44){return function(_0x43bd23){if(_0x43bd23){var _0x49b2ae=typeof _0x15ca44[_0x2dee('0x1c')]===_0x2dee('0x1d')&&typeof _0x15ca44[_0x2dee('0x1e')]===_0x2dee('0x1d');var _0x4e06e9=_0x43bd23[_0x2dee('0x1f')];var _0x5e61aa=_0x49b2ae?0x0:_0x15ca44[_0x2dee('0x1c')];var _0x1f523d=_0x49b2ae?_0x43bd23[_0x2dee('0x1f')]:_0x15ca44[_0x2dee('0x1c')]+_0x15ca44[_0x2dee('0x1e')];var _0x38cc82;if(_0x1f523d>=_0x4e06e9){_0x1f523d=_0x4e06e9;_0x38cc82=0xc8;}else{_0x38cc82=0xce;}_0x5068db[_0x2dee('0x1a')](_0x38cc82);return _0x5068db[_0x2dee('0x20')](_0x2dee('0x21'),_0x5e61aa+'-'+_0x1f523d+'/'+_0x4e06e9)['json'](_0x43bd23);}return null;};}function patchUpdates(_0x43ee8b){return function(_0x3b153a){try{jsonpatch[_0x2dee('0x22')](_0x3b153a,_0x43ee8b,!![]);}catch(_0xbc3b05){return BPromise[_0x2dee('0x23')](_0xbc3b05);}return _0x3b153a['save']();};}function saveUpdates(_0x2c5c44,_0x18575c){return function(_0x566a13){if(_0x566a13){return _0x566a13[_0x2dee('0x24')](_0x2c5c44)[_0x2dee('0x25')](function(_0x475f59){return _0x475f59;});}return null;};}function removeEntity(_0x4c3118,_0x2e8685){return function(_0x5e9194){if(_0x5e9194){return _0x5e9194[_0x2dee('0x26')]()[_0x2dee('0x25')](function(){_0x4c3118[_0x2dee('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x523aa9,_0xcdf2f){return function(_0x3c19e5){if(!_0x3c19e5){_0x523aa9['sendStatus'](0x194);}return _0x3c19e5;};}function handleError(_0x5180e8,_0x1b1079){_0x1b1079=_0x1b1079||0x1f4;return function(_0x3dbff5){logger[_0x2dee('0x27')](_0x3dbff5['stack']);if(_0x3dbff5[_0x2dee('0x28')]){delete _0x3dbff5[_0x2dee('0x28')];}_0x5180e8[_0x2dee('0x1a')](_0x1b1079)[_0x2dee('0x29')](_0x3dbff5);};}exports['index']=function(_0x14b78b,_0xcc0e8a){var _0x249c45={},_0x459d7a={},_0x42960={'count':0x0,'rows':[]};var _0x399eeb=_['map'](db[_0x2dee('0x2a')]['rawAttributes'],function(_0x4e0ff1){return{'name':_0x4e0ff1[_0x2dee('0x2b')],'type':_0x4e0ff1[_0x2dee('0x2c')][_0x2dee('0x2d')]};});_0x459d7a[_0x2dee('0x2e')]=_['map'](_0x399eeb,_0x2dee('0x28'));_0x459d7a[_0x2dee('0x2f')]=_['keys'](_0x14b78b['query']);_0x459d7a[_0x2dee('0x30')]=_[_0x2dee('0x31')](_0x459d7a[_0x2dee('0x2e')],_0x459d7a[_0x2dee('0x2f')]);_0x249c45[_0x2dee('0x32')]=_['intersection'](_0x459d7a[_0x2dee('0x2e')],qs[_0x2dee('0x33')](_0x14b78b[_0x2dee('0x2f')][_0x2dee('0x33')]));_0x249c45[_0x2dee('0x32')]=_0x249c45[_0x2dee('0x32')][_0x2dee('0x34')]?_0x249c45[_0x2dee('0x32')]:_0x459d7a[_0x2dee('0x2e')];if(!_0x14b78b[_0x2dee('0x2f')][_0x2dee('0x35')](_0x2dee('0x36'))){_0x249c45['limit']=qs['limit'](_0x14b78b[_0x2dee('0x2f')][_0x2dee('0x1e')]);_0x249c45[_0x2dee('0x1c')]=qs['offset'](_0x14b78b[_0x2dee('0x2f')][_0x2dee('0x1c')]);}_0x249c45[_0x2dee('0x37')]=qs[_0x2dee('0x38')](_0x14b78b[_0x2dee('0x2f')][_0x2dee('0x38')]);_0x249c45['where']=qs[_0x2dee('0x30')](_[_0x2dee('0x39')](_0x14b78b[_0x2dee('0x2f')],_0x459d7a[_0x2dee('0x30')]),_0x399eeb);if(_0x14b78b['query'][_0x2dee('0x3a')]){_0x249c45[_0x2dee('0x3b')]=_[_0x2dee('0x3c')](_0x249c45[_0x2dee('0x3b')],{'$or':_[_0x2dee('0x3d')](_0x399eeb,function(_0x313a1d){if(_0x313a1d['type']!==_0x2dee('0x3e')){var _0x5113f5={};_0x5113f5[_0x313a1d[_0x2dee('0x28')]]={'$like':'%'+_0x14b78b[_0x2dee('0x2f')][_0x2dee('0x3a')]+'%'};return _0x5113f5;}})});}_0x249c45=_[_0x2dee('0x3c')]({},_0x249c45,_0x14b78b[_0x2dee('0x3f')]);var _0x1755a7={'where':_0x249c45[_0x2dee('0x3b')]};return db[_0x2dee('0x2a')]['count'](_0x1755a7)[_0x2dee('0x25')](function(_0x478673){_0x42960['count']=_0x478673;if(_0x14b78b[_0x2dee('0x2f')][_0x2dee('0x40')]){_0x249c45[_0x2dee('0x41')]=[{'all':!![]}];}return db[_0x2dee('0x2a')][_0x2dee('0x42')](_0x249c45);})[_0x2dee('0x25')](function(_0x4a0ea3){_0x42960[_0x2dee('0x43')]=_0x4a0ea3;return _0x42960;})[_0x2dee('0x25')](respondWithFilteredResult(_0xcc0e8a,_0x249c45))[_0x2dee('0x44')](handleError(_0xcc0e8a,null));};exports[_0x2dee('0x45')]=function(_0x2305ff,_0x47426f){var _0x54454c={'raw':!![],'where':{'id':_0x2305ff['params']['id']}},_0xf2e2f={};_0xf2e2f[_0x2dee('0x2e')]=_['keys'](db[_0x2dee('0x2a')]['rawAttributes']);_0xf2e2f[_0x2dee('0x2f')]=_[_0x2dee('0x46')](_0x2305ff[_0x2dee('0x2f')]);_0xf2e2f[_0x2dee('0x30')]=_[_0x2dee('0x31')](_0xf2e2f[_0x2dee('0x2e')],_0xf2e2f[_0x2dee('0x2f')]);_0x54454c['attributes']=_['intersection'](_0xf2e2f[_0x2dee('0x2e')],qs['fields'](_0x2305ff[_0x2dee('0x2f')]['fields']));_0x54454c[_0x2dee('0x32')]=_0x54454c[_0x2dee('0x32')][_0x2dee('0x34')]?_0x54454c[_0x2dee('0x32')]:_0xf2e2f[_0x2dee('0x2e')];if(_0x2305ff[_0x2dee('0x2f')][_0x2dee('0x40')]){_0x54454c[_0x2dee('0x41')]=[{'all':!![]}];}_0x54454c=_[_0x2dee('0x3c')]({},_0x54454c,_0x2305ff[_0x2dee('0x3f')]);return db['ChatTransferReport'][_0x2dee('0x47')](_0x54454c)[_0x2dee('0x25')](handleEntityNotFound(_0x47426f,null))[_0x2dee('0x25')](respondWithResult(_0x47426f,null))[_0x2dee('0x44')](handleError(_0x47426f,null));};exports[_0x2dee('0x48')]=function(_0x16a05e,_0xa36c9a){return db[_0x2dee('0x2a')]['create'](_0x16a05e[_0x2dee('0x49')],{})['then'](respondWithResult(_0xa36c9a,0xc9))[_0x2dee('0x44')](handleError(_0xa36c9a,null));};exports[_0x2dee('0x24')]=function(_0x3f6112,_0x370550){if(_0x3f6112['body']['id']){delete _0x3f6112[_0x2dee('0x49')]['id'];}return db['ChatTransferReport'][_0x2dee('0x47')]({'where':{'id':_0x3f6112[_0x2dee('0x4a')]['id']}})[_0x2dee('0x25')](handleEntityNotFound(_0x370550,null))[_0x2dee('0x25')](saveUpdates(_0x3f6112[_0x2dee('0x49')],null))[_0x2dee('0x25')](respondWithResult(_0x370550,null))[_0x2dee('0x44')](handleError(_0x370550,null));};exports[_0x2dee('0x26')]=function(_0xb78d56,_0xe1a1e){return db[_0x2dee('0x2a')]['find']({'where':{'id':_0xb78d56[_0x2dee('0x4a')]['id']}})[_0x2dee('0x25')](handleEntityNotFound(_0xe1a1e,null))[_0x2dee('0x25')](removeEntity(_0xe1a1e,null))[_0x2dee('0x44')](handleError(_0xe1a1e,null));};exports[_0x2dee('0x4b')]=function(_0x5e1c8e,_0x45dac1){return db[_0x2dee('0x2a')][_0x2dee('0x4b')]()[_0x2dee('0x25')](respondWithResult(_0x45dac1,null))[_0x2dee('0x44')](handleError(_0x45dac1,null));}; \ No newline at end of file +var _0x2fda=['map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','ChatTransferReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2fda,0xfb));var _0xa2fd=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2fda[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2fd('0x0'));var zipdir=require(_0xa2fd('0x1'));var jsonpatch=require(_0xa2fd('0x2'));var rp=require(_0xa2fd('0x3'));var moment=require('moment');var BPromise=require(_0xa2fd('0x4'));var Mustache=require(_0xa2fd('0x5'));var util=require(_0xa2fd('0x6'));var path=require(_0xa2fd('0x7'));var sox=require(_0xa2fd('0x8'));var csv=require('to-csv');var ejs=require(_0xa2fd('0x9'));var fs=require('fs');var fs_extra=require(_0xa2fd('0xa'));var _=require(_0xa2fd('0xb'));var squel=require(_0xa2fd('0xc'));var crypto=require('crypto');var jsforce=require(_0xa2fd('0xd'));var deskjs=require(_0xa2fd('0xe'));var toCsv=require(_0xa2fd('0xf'));var querystring=require(_0xa2fd('0x10'));var Papa=require(_0xa2fd('0x11'));var Redis=require('ioredis');var authService=require(_0xa2fd('0x12'));var qs=require(_0xa2fd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2fd('0x14'))(_0xa2fd('0x15'));var utils=require(_0xa2fd('0x16'));var config=require(_0xa2fd('0x17'));var licenseUtil=require(_0xa2fd('0x18'));var db=require(_0xa2fd('0x19'))['db'];function respondWithStatusCode(_0x323deb,_0x3a79b9){_0x3a79b9=_0x3a79b9||0xcc;return function(_0x1e4675){if(_0x1e4675){return _0x323deb[_0xa2fd('0x1a')](_0x3a79b9);}return _0x323deb[_0xa2fd('0x1b')](_0x3a79b9)['end']();};}function respondWithResult(_0x43f8c9,_0xa8cbd3){_0xa8cbd3=_0xa8cbd3||0xc8;return function(_0x147f2a){if(_0x147f2a){return _0x43f8c9[_0xa2fd('0x1b')](_0xa8cbd3)['json'](_0x147f2a);}};}function respondWithFilteredResult(_0x1026f4,_0x9ae164){return function(_0x3c6d59){if(_0x3c6d59){var _0x55dcc8=typeof _0x9ae164[_0xa2fd('0x1c')]===_0xa2fd('0x1d')&&typeof _0x9ae164[_0xa2fd('0x1e')]===_0xa2fd('0x1d');var _0x1d4d76=_0x3c6d59[_0xa2fd('0x1f')];var _0x12d317=_0x55dcc8?0x0:_0x9ae164[_0xa2fd('0x1c')];var _0x49601e=_0x55dcc8?_0x3c6d59[_0xa2fd('0x1f')]:_0x9ae164[_0xa2fd('0x1c')]+_0x9ae164[_0xa2fd('0x1e')];var _0x5b7e38;if(_0x49601e>=_0x1d4d76){_0x49601e=_0x1d4d76;_0x5b7e38=0xc8;}else{_0x5b7e38=0xce;}_0x1026f4[_0xa2fd('0x1b')](_0x5b7e38);return _0x1026f4[_0xa2fd('0x20')](_0xa2fd('0x21'),_0x12d317+'-'+_0x49601e+'/'+_0x1d4d76)[_0xa2fd('0x22')](_0x3c6d59);}return null;};}function patchUpdates(_0x2197b5){return function(_0x35b930){try{jsonpatch['apply'](_0x35b930,_0x2197b5,!![]);}catch(_0x536b57){return BPromise[_0xa2fd('0x23')](_0x536b57);}return _0x35b930[_0xa2fd('0x24')]();};}function saveUpdates(_0x1d09ee,_0x593a2e){return function(_0x5d564c){if(_0x5d564c){return _0x5d564c[_0xa2fd('0x25')](_0x1d09ee)['then'](function(_0xbfaba5){return _0xbfaba5;});}return null;};}function removeEntity(_0x2631c0,_0x274a75){return function(_0x549047){if(_0x549047){return _0x549047[_0xa2fd('0x26')]()[_0xa2fd('0x27')](function(){_0x2631c0[_0xa2fd('0x1b')](0xcc)[_0xa2fd('0x28')]();});}};}function handleEntityNotFound(_0x17eccf,_0x3d4682){return function(_0xdcf4df){if(!_0xdcf4df){_0x17eccf[_0xa2fd('0x1a')](0x194);}return _0xdcf4df;};}function handleError(_0x56e00d,_0x1dcfa1){_0x1dcfa1=_0x1dcfa1||0x1f4;return function(_0x23332a){logger[_0xa2fd('0x29')](_0x23332a[_0xa2fd('0x2a')]);if(_0x23332a[_0xa2fd('0x2b')]){delete _0x23332a['name'];}_0x56e00d[_0xa2fd('0x1b')](_0x1dcfa1)[_0xa2fd('0x2c')](_0x23332a);};}exports[_0xa2fd('0x2d')]=function(_0x301bdf,_0x8813ab){var _0x23777e={},_0x4cb228={},_0x2c3f56={'count':0x0,'rows':[]};var _0x8e9373=_['map'](db[_0xa2fd('0x2e')]['rawAttributes'],function(_0x56bb40){return{'name':_0x56bb40['fieldName'],'type':_0x56bb40[_0xa2fd('0x2f')][_0xa2fd('0x30')]};});_0x4cb228[_0xa2fd('0x31')]=_['map'](_0x8e9373,_0xa2fd('0x2b'));_0x4cb228[_0xa2fd('0x32')]=_[_0xa2fd('0x33')](_0x301bdf[_0xa2fd('0x32')]);_0x4cb228[_0xa2fd('0x34')]=_[_0xa2fd('0x35')](_0x4cb228[_0xa2fd('0x31')],_0x4cb228[_0xa2fd('0x32')]);_0x23777e[_0xa2fd('0x36')]=_['intersection'](_0x4cb228['model'],qs[_0xa2fd('0x37')](_0x301bdf[_0xa2fd('0x32')][_0xa2fd('0x37')]));_0x23777e[_0xa2fd('0x36')]=_0x23777e[_0xa2fd('0x36')][_0xa2fd('0x38')]?_0x23777e[_0xa2fd('0x36')]:_0x4cb228[_0xa2fd('0x31')];if(!_0x301bdf[_0xa2fd('0x32')][_0xa2fd('0x39')](_0xa2fd('0x3a'))){_0x23777e[_0xa2fd('0x1e')]=qs['limit'](_0x301bdf[_0xa2fd('0x32')][_0xa2fd('0x1e')]);_0x23777e[_0xa2fd('0x1c')]=qs[_0xa2fd('0x1c')](_0x301bdf[_0xa2fd('0x32')][_0xa2fd('0x1c')]);}_0x23777e[_0xa2fd('0x3b')]=qs[_0xa2fd('0x3c')](_0x301bdf[_0xa2fd('0x32')][_0xa2fd('0x3c')]);_0x23777e[_0xa2fd('0x3d')]=qs[_0xa2fd('0x34')](_[_0xa2fd('0x3e')](_0x301bdf[_0xa2fd('0x32')],_0x4cb228[_0xa2fd('0x34')]),_0x8e9373);if(_0x301bdf[_0xa2fd('0x32')][_0xa2fd('0x3f')]){_0x23777e['where']=_[_0xa2fd('0x40')](_0x23777e[_0xa2fd('0x3d')],{'$or':_[_0xa2fd('0x41')](_0x8e9373,function(_0xc735bd){if(_0xc735bd[_0xa2fd('0x2f')]!==_0xa2fd('0x42')){var _0x4dc528={};_0x4dc528[_0xc735bd[_0xa2fd('0x2b')]]={'$like':'%'+_0x301bdf[_0xa2fd('0x32')]['filter']+'%'};return _0x4dc528;}})});}_0x23777e=_['merge']({},_0x23777e,_0x301bdf[_0xa2fd('0x43')]);var _0x5170d3={'where':_0x23777e['where']};return db[_0xa2fd('0x2e')][_0xa2fd('0x1f')](_0x5170d3)[_0xa2fd('0x27')](function(_0x58d8f7){_0x2c3f56[_0xa2fd('0x1f')]=_0x58d8f7;if(_0x301bdf[_0xa2fd('0x32')][_0xa2fd('0x44')]){_0x23777e[_0xa2fd('0x45')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xa2fd('0x46')](_0x23777e);})['then'](function(_0x587730){_0x2c3f56[_0xa2fd('0x47')]=_0x587730;return _0x2c3f56;})['then'](respondWithFilteredResult(_0x8813ab,_0x23777e))[_0xa2fd('0x48')](handleError(_0x8813ab,null));};exports[_0xa2fd('0x49')]=function(_0x3a77db,_0x5573bb){var _0x5c6134={'raw':!![],'where':{'id':_0x3a77db[_0xa2fd('0x4a')]['id']}},_0x397400={};_0x397400[_0xa2fd('0x31')]=_[_0xa2fd('0x33')](db[_0xa2fd('0x2e')][_0xa2fd('0x4b')]);_0x397400[_0xa2fd('0x32')]=_['keys'](_0x3a77db[_0xa2fd('0x32')]);_0x397400[_0xa2fd('0x34')]=_[_0xa2fd('0x35')](_0x397400[_0xa2fd('0x31')],_0x397400[_0xa2fd('0x32')]);_0x5c6134[_0xa2fd('0x36')]=_[_0xa2fd('0x35')](_0x397400['model'],qs[_0xa2fd('0x37')](_0x3a77db[_0xa2fd('0x32')][_0xa2fd('0x37')]));_0x5c6134[_0xa2fd('0x36')]=_0x5c6134['attributes'][_0xa2fd('0x38')]?_0x5c6134[_0xa2fd('0x36')]:_0x397400[_0xa2fd('0x31')];if(_0x3a77db[_0xa2fd('0x32')][_0xa2fd('0x44')]){_0x5c6134['include']=[{'all':!![]}];}_0x5c6134=_['merge']({},_0x5c6134,_0x3a77db[_0xa2fd('0x43')]);return db[_0xa2fd('0x2e')][_0xa2fd('0x4c')](_0x5c6134)[_0xa2fd('0x27')](handleEntityNotFound(_0x5573bb,null))[_0xa2fd('0x27')](respondWithResult(_0x5573bb,null))['catch'](handleError(_0x5573bb,null));};exports['create']=function(_0x13eab1,_0x21c657){return db[_0xa2fd('0x2e')]['create'](_0x13eab1[_0xa2fd('0x4d')],{})[_0xa2fd('0x27')](respondWithResult(_0x21c657,0xc9))['catch'](handleError(_0x21c657,null));};exports[_0xa2fd('0x25')]=function(_0x376d7f,_0x17b17b){if(_0x376d7f[_0xa2fd('0x4d')]['id']){delete _0x376d7f[_0xa2fd('0x4d')]['id'];}return db['ChatTransferReport'][_0xa2fd('0x4c')]({'where':{'id':_0x376d7f['params']['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x17b17b,null))[_0xa2fd('0x27')](saveUpdates(_0x376d7f[_0xa2fd('0x4d')],null))[_0xa2fd('0x27')](respondWithResult(_0x17b17b,null))[_0xa2fd('0x48')](handleError(_0x17b17b,null));};exports[_0xa2fd('0x26')]=function(_0x1b54e3,_0x383a4e){return db[_0xa2fd('0x2e')][_0xa2fd('0x4c')]({'where':{'id':_0x1b54e3['params']['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x383a4e,null))['then'](removeEntity(_0x383a4e,null))[_0xa2fd('0x48')](handleError(_0x383a4e,null));};exports[_0xa2fd('0x4e')]=function(_0x6eda0b,_0x216bc1){return db[_0xa2fd('0x2e')][_0xa2fd('0x4e')]()[_0xa2fd('0x27')](respondWithResult(_0x216bc1,null))[_0xa2fd('0x48')](handleError(_0x216bc1,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 06c8ed1..1a716b6 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 _0x5b06=['uniqueid','util','../../config/logger','bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer'];(function(_0x3cff66,_0x222594){var _0x27e00a=function(_0x32b5eb){while(--_0x32b5eb){_0x3cff66['push'](_0x3cff66['shift']());}};_0x27e00a(++_0x222594);}(_0x5b06,0x161));var _0x65b0=function(_0x5d0504,_0x48a726){_0x5d0504=_0x5d0504-0x0;var _0x2c0435=_0x5b06[_0x5d0504];return _0x2c0435;};'use strict';var _=require('lodash');var util=require(_0x65b0('0x0'));var logger=require(_0x65b0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x65b0('0x2'));var rp=require(_0x65b0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x65b0('0x4'));var attributes=require(_0x65b0('0x5'));module[_0x65b0('0x6')]=function(_0x3f743c,_0x301e0e){return _0x3f743c[_0x65b0('0x7')](_0x65b0('0x8'),attributes,{'tableName':_0x65b0('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x65b0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2901=['path','rimraf','../../config/environment','define','ChatTransferReport','report_chat_transfer','uniqueid','../../config/logger','api','request-promise'];(function(_0x323eac,_0x2983d4){var _0x49cd05=function(_0x5975fa){while(--_0x5975fa){_0x323eac['push'](_0x323eac['shift']());}};_0x49cd05(++_0x2983d4);}(_0x2901,0x1a1));var _0x1290=function(_0x35396d,_0x4f6ac5){_0x35396d=_0x35396d-0x0;var _0x101733=_0x2901[_0x35396d];return _0x101733;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1290('0x0'))(_0x1290('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1290('0x2'));var fs=require('fs');var path=require(_0x1290('0x3'));var rimraf=require(_0x1290('0x4'));var config=require(_0x1290('0x5'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x4478a5,_0x11d32f){return _0x4478a5[_0x1290('0x6')](_0x1290('0x7'),attributes,{'tableName':_0x1290('0x8'),'paranoid':![],'indexes':[{'name':_0x1290('0x9'),'fields':[_0x1290('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5360eb9..8838eed 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 _0x9234=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x339f67,_0x3eef63){var _0x9d6b2=function(_0x260f5c){while(--_0x260f5c){_0x339f67['push'](_0x339f67['shift']());}};_0x9d6b2(++_0x3eef63);}(_0x9234,0x1d1));var _0x4923=function(_0x4a96d2,_0x689504){_0x4a96d2=_0x4a96d2-0x0;var _0x38af04=_0x9234[_0x4a96d2];return _0x38af04;};'use strict';var _=require(_0x4923('0x0'));var util=require(_0x4923('0x1'));var moment=require('moment');var BPromise=require(_0x4923('0x2'));var rs=require(_0x4923('0x3'));var fs=require('fs');var Redis=require(_0x4923('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4923('0x5'));var logger=require('../../config/logger')(_0x4923('0x6'));var config=require(_0x4923('0x7'));var jayson=require(_0x4923('0x8'));var client=jayson['client'][_0x4923('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x178b0e,_0x1b3c7d,_0x587420){return new BPromise(function(_0x3f5624,_0x4dbeb2){return client[_0x4923('0xa')](_0x178b0e,_0x587420)[_0x4923('0xb')](function(_0x31825b){logger[_0x4923('0xc')](_0x4923('0xd'),_0x1b3c7d,_0x4923('0xe'));logger['debug'](_0x4923('0xf'),_0x1b3c7d,_0x4923('0xe'),JSON[_0x4923('0x10')](_0x31825b));if(_0x31825b[_0x4923('0x11')]){if(_0x31825b[_0x4923('0x11')][_0x4923('0x12')]===0x1f4){logger[_0x4923('0x11')](_0x4923('0xd'),_0x1b3c7d,_0x31825b['error'][_0x4923('0x13')]);return _0x4dbeb2(_0x31825b[_0x4923('0x11')]['message']);}logger[_0x4923('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x1b3c7d,_0x31825b[_0x4923('0x11')][_0x4923('0x13')]);return _0x3f5624(_0x31825b[_0x4923('0x11')]['message']);}else{logger[_0x4923('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x1b3c7d,'request\x20sent');_0x3f5624(_0x31825b['result'][_0x4923('0x13')]);}})[_0x4923('0x14')](function(_0xac4714){logger[_0x4923('0x11')](_0x4923('0xd'),_0x1b3c7d,_0xac4714);_0x4dbeb2(_0xac4714);});});} \ No newline at end of file +var _0x171c=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x4fa1,_0xbe2f16){var _0x153b4c=function(_0x5d0743){while(--_0x5d0743){_0x4fa1['push'](_0x4fa1['shift']());}};_0x153b4c(++_0xbe2f16);}(_0x171c,0x96));var _0xc171=function(_0x2f3d22,_0x4d2d1b){_0x2f3d22=_0x2f3d22-0x0;var _0x2c61a7=_0x171c[_0x2f3d22];return _0x2c61a7;};'use strict';var _=require(_0xc171('0x0'));var util=require(_0xc171('0x1'));var moment=require('moment');var BPromise=require(_0xc171('0x2'));var rs=require(_0xc171('0x3'));var fs=require('fs');var Redis=require(_0xc171('0x4'));var db=require(_0xc171('0x5'))['db'];var utils=require(_0xc171('0x6'));var logger=require(_0xc171('0x7'))(_0xc171('0x8'));var config=require(_0xc171('0x9'));var jayson=require(_0xc171('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x488155,_0x3b6aa1,_0x10bc35){return new BPromise(function(_0x3ddfbc,_0x30b9da){return client['request'](_0x488155,_0x10bc35)[_0xc171('0xb')](function(_0x17ed3e){logger[_0xc171('0xc')](_0xc171('0xd'),_0x3b6aa1,_0xc171('0xe'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x3b6aa1,_0xc171('0xe'),JSON['stringify'](_0x17ed3e));if(_0x17ed3e[_0xc171('0xf')]){if(_0x17ed3e[_0xc171('0xf')]['code']===0x1f4){logger[_0xc171('0xf')](_0xc171('0xd'),_0x3b6aa1,_0x17ed3e[_0xc171('0xf')][_0xc171('0x10')]);return _0x30b9da(_0x17ed3e[_0xc171('0xf')]['message']);}logger[_0xc171('0xf')](_0xc171('0xd'),_0x3b6aa1,_0x17ed3e[_0xc171('0xf')][_0xc171('0x10')]);return _0x3ddfbc(_0x17ed3e['error']['message']);}else{logger[_0xc171('0xc')](_0xc171('0xd'),_0x3b6aa1,'request\x20sent');_0x3ddfbc(_0x17ed3e[_0xc171('0x11')][_0xc171('0x10')]);}})['catch'](function(_0x113916){logger[_0xc171('0xf')](_0xc171('0xd'),_0x3b6aa1,_0x113916);_0x30b9da(_0x113916);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 25e91fc..d9c3d48 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 _0x3121=['../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','show','create','/:id','update','delete','exports','util','path','fs-extra'];(function(_0x1b20b3,_0x3cc702){var _0x5a1d56=function(_0x4d568d){while(--_0x4d568d){_0x1b20b3['push'](_0x1b20b3['shift']());}};_0x5a1d56(++_0x3cc702);}(_0x3121,0x15d));var _0x1312=function(_0x2a028b,_0x285678){_0x2a028b=_0x2a028b-0x0;var _0x280443=_0x3121[_0x2a028b];return _0x280443;};'use strict';var multer=require('multer');var util=require(_0x1312('0x0'));var path=require(_0x1312('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1312('0x2'));var auth=require(_0x1312('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1312('0x4'));var controller=require(_0x1312('0x5'));router[_0x1312('0x6')]('/',auth[_0x1312('0x7')](),controller[_0x1312('0x8')]);router[_0x1312('0x6')](_0x1312('0x9'),auth[_0x1312('0x7')](),controller['describe']);router['get']('/:id',auth[_0x1312('0x7')](),controller[_0x1312('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1312('0xb')]);router['put'](_0x1312('0xc'),auth['isAuthenticated'](),controller[_0x1312('0xd')]);router[_0x1312('0xe')]('/:id',auth[_0x1312('0x7')](),controller['destroy']);module[_0x1312('0xf')]=router; \ No newline at end of file +var _0x5461=['path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','multer'];(function(_0x15f44b,_0x304221){var _0xa20138=function(_0x50892e){while(--_0x50892e){_0x15f44b['push'](_0x15f44b['shift']());}};_0xa20138(++_0x304221);}(_0x5461,0xa9));var _0x1546=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x5461[_0x65c50e];return _0x4573e7;};'use strict';var multer=require(_0x1546('0x0'));var util=require('util');var path=require(_0x1546('0x1'));var timeout=require('connect-timeout');var express=require(_0x1546('0x2'));var router=express[_0x1546('0x3')]();var fs_extra=require(_0x1546('0x4'));var auth=require(_0x1546('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x1546('0x6')]('/',auth[_0x1546('0x7')](),controller[_0x1546('0x8')]);router[_0x1546('0x6')](_0x1546('0x9'),auth[_0x1546('0x7')](),controller[_0x1546('0xa')]);router[_0x1546('0x6')](_0x1546('0xb'),auth[_0x1546('0x7')](),controller[_0x1546('0xc')]);router['post']('/',auth[_0x1546('0x7')](),controller[_0x1546('0xd')]);router[_0x1546('0xe')](_0x1546('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1546('0xf')](_0x1546('0xb'),auth[_0x1546('0x7')](),controller[_0x1546('0x10')]);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 851af29..f3bbba9 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 _0xe877=['Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','ENUM','star','TEXT','stringify','name','input','getDataValue','parse','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY'];(function(_0x930824,_0x5279ec){var _0x116006=function(_0x55ef0c){while(--_0x55ef0c){_0x930824['push'](_0x930824['shift']());}};_0x116006(++_0x5279ec);}(_0xe877,0x19f));var _0x7e87=function(_0x39f687,_0x1203e3){_0x39f687=_0x39f687-0x0;var _0x115075=_0xe877[_0x39f687];return _0x115075;};'use strict';var Sequelize=require(_0x7e87('0x0'));var rs=require('randomstring');module[_0x7e87('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x7e87('0x2')],'allowNull':![],'unique':_0x7e87('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x5')},'customerAlias':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x7e87('0x2')],'allowNull':![],'defaultValue':_0x7e87('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7e87('0x2')],'allowNull':![],'defaultValue':_0x7e87('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7e87('0x2')],'allowNull':![],'defaultValue':_0x7e87('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x7e87('0x2')],'allowNull':![],'defaultValue':_0x7e87('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7e87('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7e87('0x2')]},'animation':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x7e87('0xa'),_0x7e87('0xb')),'defaultValue':_0x7e87('0xa')},'header_online':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0xc')},'start_chat_button':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7e87('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x7e87('0xf')},'download_transcript':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7e87('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x7e87('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7e87('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x13')},'noteTitle':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7e87('0x15')},'closingMessage':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x16')},'closingMessageButton':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x17')},'ratingType':{'type':Sequelize[_0x7e87('0x18')](_0x7e87('0x19'),'thumb'),'defaultValue':_0x7e87('0x19')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7e87('0x1a')],'defaultValue':function(){return JSON[_0x7e87('0x1b')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x7e87('0x1c'),'type':'text','required':!![]},'props':{'title':_0x7e87('0x1c'),'helpText':''}},{'type':_0x7e87('0x1d'),'props':{'title':_0x7e87('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x7e87('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x7e87('0x1e')]('onlineForm')?JSON[_0x7e87('0x1f')](this['getDataValue'](_0x7e87('0x20'))):{};},'set':function(_0x46128a){return this['setDataValue'](_0x7e87('0x20'),JSON[_0x7e87('0x1b')](_0x46128a));}},'offlineForm':{'type':Sequelize[_0x7e87('0x1a')],'defaultValue':function(){return JSON[_0x7e87('0x1b')]({'items':[{'type':'input','props':{'title':_0x7e87('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x7e87('0x4'),'type':'email'},'variable':null},{'type':_0x7e87('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0x7e87('0x22'),'helpText':_0x7e87('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x7e87('0x1e')]('offlineForm')?JSON[_0x7e87('0x1f')](this[_0x7e87('0x1e')](_0x7e87('0x24'))):{};},'set':function(_0x54a8b0){return this[_0x7e87('0x25')](_0x7e87('0x24'),JSON['stringify'](_0x54a8b0));}},'token':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x7e87('0x2')]},'forwardOffline':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x7e87('0x26')},'waitingMessage':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x27')},'offlineMessageBody':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x7e87('0x2a')},'sendUnmanaged':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x7e87('0x1a')]},'showAgentAvatar':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7e87('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7e87('0x2b');}},'notificationSound':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x7e87('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x2d')},'verticalAlignment':{'type':Sequelize[_0x7e87('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x7e87('0x2')],'defaultValue':_0x7e87('0x2e')},'defaultTitle':{'type':Sequelize[_0x7e87('0x2')]},'customerAvatar':{'type':Sequelize[_0x7e87('0x1a')]},'showCustomerAvatar':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7e87('0x2')],'allowNull':![],'defaultValue':_0x7e87('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7e87('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7e87('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x7e87('0x30')},'systemAvatar':{'type':Sequelize[_0x7e87('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7e87('0x8')],'comment':_0x7e87('0x31')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5064a7){if(!_0x5064a7)this[_0x7e87('0x25')](_0x7e87('0x32'),null);this[_0x7e87('0x25')](_0x7e87('0x33'),_0x5064a7);}},'vidaooEscalation':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x7e87('0x2')]},'vidaooTopic':{'type':Sequelize[_0x7e87('0x2')],'allowNull':![],'defaultValue':_0x7e87('0x34')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x7e87('0x35');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x7e87('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x7e87('0x1a')]}}; \ No newline at end of file +var _0x65ce=['email','Agent','#011F6A','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','TEXT','stringify','name','text','input','onlineForm','parse','getDataValue','Comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','#fafafa','System','mandatoryDispositionPauseId','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING'];(function(_0x1d6a61,_0x177f8a){var _0x4f28ae=function(_0x22a8b1){while(--_0x22a8b1){_0x1d6a61['push'](_0x1d6a61['shift']());}};_0x4f28ae(++_0x177f8a);}(_0x65ce,0x185));var _0xe65c=function(_0x460bbf,_0x3d6053){_0x460bbf=_0x460bbf-0x0;var _0x1a65c1=_0x65ce[_0x460bbf];return _0x1a65c1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe65c('0x0'));module[_0xe65c('0x1')]={'name':{'type':Sequelize[_0xe65c('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xe65c('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xe65c('0x3')},'mapKeyOffline':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x3')},'key':{'type':Sequelize[_0xe65c('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xe65c('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe65c('0x2')],'allowNull':![],'defaultValue':_0xe65c('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xe65c('0x2')],'allowNull':![],'defaultValue':_0xe65c('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xe65c('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe65c('0x7')](_0xe65c('0x8'),_0xe65c('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0xa')},'start_chat_button':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xe65c('0xc')},'header_offline':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xe65c('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x12')},'noteTitle':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x13')},'placeholderMessage':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x14')},'closingMessage':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x15')},'closingMessageButton':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x16')},'ratingType':{'type':Sequelize[_0xe65c('0x7')](_0xe65c('0x17'),_0xe65c('0x18')),'defaultValue':_0xe65c('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xe65c('0x19')],'defaultValue':function(){return JSON[_0xe65c('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xe65c('0x1b'),'type':_0xe65c('0x1c'),'required':!![]},'props':{'title':_0xe65c('0x1b'),'helpText':''}},{'type':_0xe65c('0x1d'),'props':{'title':_0xe65c('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xe65c('0x3'),'type':_0xe65c('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xe65c('0x1e'))?JSON[_0xe65c('0x1f')](this[_0xe65c('0x20')](_0xe65c('0x1e'))):{};},'set':function(_0x45ab33){return this['setDataValue'](_0xe65c('0x1e'),JSON[_0xe65c('0x1a')](_0x45ab33));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xe65c('0x1a')]({'items':[{'type':_0xe65c('0x1d'),'props':{'title':_0xe65c('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xe65c('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0xe65c('0x21')},'props':{'title':_0xe65c('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xe65c('0x20')](_0xe65c('0x22'))?JSON[_0xe65c('0x1f')](this[_0xe65c('0x20')](_0xe65c('0x22'))):{};},'set':function(_0x3cab6a){return this[_0xe65c('0x23')](_0xe65c('0x22'),JSON[_0xe65c('0x1a')](_0x3cab6a));}},'token':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':function(){return rs[_0xe65c('0x24')]();}},'autoclose':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xe65c('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xe65c('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xe65c('0x25')},'waitingMessage':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x27')},'offlineMessageBody':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x28')},'skipUnmanaged':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x29')},'sendUnmanaged':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xe65c('0x19')]},'showAgentAvatar':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe65c('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe65c('0x19')],'defaultValue':function(){return _0xe65c('0x2a');}},'notificationSound':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe65c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x2b')},'verticalAlignment':{'type':Sequelize[_0xe65c('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':_0xe65c('0x2c')},'messagesAlignment':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xe65c('0x2')]},'customerAvatar':{'type':Sequelize[_0xe65c('0x19')]},'showCustomerAvatar':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe65c('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe65c('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe65c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe65c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xe65c('0x2e')},'systemAvatar':{'type':Sequelize[_0xe65c('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe65c('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x175bd8){if(!_0x175bd8)this['setDataValue'](_0xe65c('0x2f'),null);this['setDataValue']('mandatoryDisposition',_0x175bd8);}},'vidaooEscalation':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xe65c('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xe65c('0x2')],'defaultValue':function(){return _0xe65c('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xe65c('0x19')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xe65c('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xe65c('0x19')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1c0a9bb..33ffa19 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 _0xac31=['\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','params','describe','addDisposition','ChatWebsiteId','getDispositions','nolimit','Disposition','findAll','removeDispositions','CannedAnswer','getAnswers','findOne','hasOwnProperty','order','removeAnswers','ids','addLogo','file','filename','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','sitepic','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','customerAvatar','showCustomerAvatar','getSystemAvatar','Interval','resolve','ifTime','notify','chat','isNil','from','mapKey','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','CmList','List','Contacts','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','priority','asc','account','list','contact','headers','threadId','ChatInteraction','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','Start','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','basename','openNewInteraction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','Tag','color','tag','getSnippet','virtual','chatLicenseExceeded','server/files/chat/iframe.ejs','3.13.0','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','connection','remoteAddress','replace','labelText','textColor','textButtonColor','color_button','backgroundColor','IntervalId','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','User','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','api','../../config/environment','../../errors/api','APIBadRequestError','handleError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','undefined','limit','count','offset','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','end','sendStatus','stack','name','send','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','query','keys','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','includeAll','find','create','address','split','forEach','testWildcardValidity','trim'];(function(_0x81f000,_0x15df85){var _0x337aa2=function(_0x37f6a4){while(--_0x37f6a4){_0x81f000['push'](_0x81f000['shift']());}};_0x337aa2(++_0x15df85);}(_0xac31,0xca));var _0x1ac3=function(_0x16af45,_0x6508fb){_0x16af45=_0x16af45-0x0;var _0x3fbddb=_0xac31[_0x16af45];return _0x3fbddb;};'use strict';var Mustache=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var ejs=require(_0x1ac3('0x3'));var fs=require('fs');var fs_extra=require(_0x1ac3('0x4'));var _=require(_0x1ac3('0x5'));var querystring=require(_0x1ac3('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0x1ac3('0x7'));var jayson=require(_0x1ac3('0x8'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x1ac3('0x9'));var config=require(_0x1ac3('0xa'));var APIBadRequestError=require(_0x1ac3('0xb'))[_0x1ac3('0xc')];var APINotFoundError=require(_0x1ac3('0xb'))['APINotFoundError'];var APIOutOfIntervalError=require(_0x1ac3('0xb'))['APIOutOfIntervalError'];var APIHandleError=require(_0x1ac3('0xb'))[_0x1ac3('0xd')];var APIConflictError=require(_0x1ac3('0xb'))['APIConflictError'];var wildcardUtils=require(_0x1ac3('0xe'));var URL=require(_0x1ac3('0xf'))[_0x1ac3('0x10')];var db=require(_0x1ac3('0x11'))['db'];config[_0x1ac3('0x12')]=_[_0x1ac3('0x13')](config['redis'],{'host':_0x1ac3('0x14'),'port':0x18eb});var socket=require(_0x1ac3('0x15'))(new Redis(config[_0x1ac3('0x12')]));require(_0x1ac3('0x16'))['register'](socket);var client=jayson[_0x1ac3('0x17')][_0x1ac3('0x18')]({'port':0x232c});var client9002=jayson[_0x1ac3('0x17')][_0x1ac3('0x18')]({'port':0x232a});var client9003=jayson['client'][_0x1ac3('0x18')]({'port':0x232b});var client9001=jayson[_0x1ac3('0x17')]['http']({'port':0x2329});function respondWithRpcPromise(_0x29a7b3,_0x1f9641,_0x38b52a,_0x51f1e4){return new Promise(function(_0x2f14ca,_0x8590ce){var _0x23e6e9=_0x51f1e4||client;return _0x23e6e9['request'](_0x29a7b3,_0x38b52a)[_0x1ac3('0x19')](function(_0x58000f){logger[_0x1ac3('0x1a')](_0x1ac3('0x1b'),_0x1f9641,_0x1ac3('0x1c'));logger[_0x1ac3('0x1d')](_0x1ac3('0x1e'),_0x1f9641,'request\x20sent',JSON[_0x1ac3('0x1f')](_0x58000f));if(_0x58000f[_0x1ac3('0x20')]){if(_0x58000f[_0x1ac3('0x20')][_0x1ac3('0x21')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1f9641,_0x58000f[_0x1ac3('0x20')][_0x1ac3('0x22')]);return _0x8590ce(_0x58000f[_0x1ac3('0x20')][_0x1ac3('0x22')]);}logger[_0x1ac3('0x20')](_0x1ac3('0x1b'),_0x1f9641,_0x58000f[_0x1ac3('0x20')][_0x1ac3('0x22')]);return _0x2f14ca(_0x58000f[_0x1ac3('0x20')]['message']);}else{logger[_0x1ac3('0x1a')](_0x1ac3('0x1b'),_0x1f9641,'request\x20sent');_0x2f14ca(_0x58000f[_0x1ac3('0x23')][_0x1ac3('0x22')]);}})['catch'](function(_0xf9affb){logger[_0x1ac3('0x20')](_0x1ac3('0x1b'),_0x1f9641,_0xf9affb);_0x8590ce(_0xf9affb);});});}function respondWithStatusCode(_0x2dfdb7,_0x10db3d){_0x10db3d=_0x10db3d||0xcc;return function(_0x565a0f){if(_0x565a0f){return _0x2dfdb7['sendStatus'](_0x10db3d);}return _0x2dfdb7['status'](_0x10db3d)['end']();};}function respondWithResult(_0x52a1a5,_0x3ea482){_0x3ea482=_0x3ea482||0xc8;return function(_0x4b04fb){if(_0x4b04fb){return _0x52a1a5[_0x1ac3('0x24')](_0x3ea482)[_0x1ac3('0x25')](_0x4b04fb);}};}function respondWithFilteredResult(_0x4243e4,_0x435d6c){return function(_0x4b3d3c){if(_0x4b3d3c){var _0x61441d=typeof _0x435d6c['offset']===_0x1ac3('0x26')&&typeof _0x435d6c[_0x1ac3('0x27')]===_0x1ac3('0x26');var _0x1c5653=_0x4b3d3c[_0x1ac3('0x28')];var _0xc3f097=_0x61441d?0x0:_0x435d6c[_0x1ac3('0x29')];var _0x5351b2=_0x61441d?_0x4b3d3c[_0x1ac3('0x28')]:_0x435d6c[_0x1ac3('0x29')]+_0x435d6c[_0x1ac3('0x27')];var _0x47437c;if(_0x5351b2>=_0x1c5653){_0x5351b2=_0x1c5653;_0x47437c=0xc8;}else{_0x47437c=0xce;}_0x4243e4['status'](_0x47437c);return _0x4243e4[_0x1ac3('0x2a')](_0x1ac3('0x2b'),_0xc3f097+'-'+_0x5351b2+'/'+_0x1c5653)[_0x1ac3('0x25')](_0x4b3d3c);}return null;};}function saveUpdates(_0x294513){return function(_0x204d78){if(_0x204d78){return _0x204d78['update'](_0x294513)[_0x1ac3('0x19')](function(_0x760b65){return _0x760b65;});}return null;};}function removeEntity(_0x11987b){return function(_0x156ccd){if(_0x156ccd){return _0x156ccd[_0x1ac3('0x2c')]()[_0x1ac3('0x19')](function(){var _0x4c1283=_0x156ccd[_0x1ac3('0x2d')]({'plain':!![]});var _0x174a53=_0x1ac3('0x2e');return db[_0x1ac3('0x2f')]['destroy']({'where':{'type':_0x174a53,'resourceId':_0x4c1283['id']}})[_0x1ac3('0x19')](function(){return _0x156ccd;});})[_0x1ac3('0x19')](function(){_0x11987b[_0x1ac3('0x24')](0xcc)[_0x1ac3('0x30')]();});}};}function handleEntityNotFound(_0x31a932){return function(_0x170bb8){if(!_0x170bb8){_0x31a932[_0x1ac3('0x31')](0x194);}return _0x170bb8;};}function handleError(_0x277b7b,_0x30b815){_0x30b815=_0x30b815||0x1f4;return function(_0x5c29c1){logger[_0x1ac3('0x20')](_0x5c29c1[_0x1ac3('0x32')]);if(_0x5c29c1['name']){delete _0x5c29c1[_0x1ac3('0x33')];}_0x277b7b[_0x1ac3('0x24')](_0x30b815)[_0x1ac3('0x34')](_0x5c29c1);};}function createInteractionObject(_0x448fb5,_0x2e8494,_0x4b2217,_0x1c8bf5){var _0xa15199=require('user-agent-parser');var _0x17fc8a=new _0xa15199();var _0x49717b=_0x17fc8a[_0x1ac3('0x35')](_0x4b2217[_0x1ac3('0x36')])[_0x1ac3('0x37')]();var _0x1e2f5e=_0x2e8494[_0x1ac3('0x38')];if(_0x4b2217[_0x1ac3('0x39')]){_0x1e2f5e=_0x4b2217['cf-connecting-ip'];}else if(_0x4b2217[_0x1ac3('0x3a')]){_0x1e2f5e=_[_0x1ac3('0x3b')](_0x4b2217[_0x1ac3('0x3a')]['split'](','));}return{'ContactId':_0x1c8bf5['id'],'ChatWebsiteId':_0x448fb5,'from':(_0x1c8bf5[_0x1ac3('0x3c')]||'')+'\x20'+(_0x1c8bf5[_0x1ac3('0x3d')]||''),'customerIp':_0x1e2f5e,'customerPort':_0x4b2217['x-real-port']?_0x4b2217[_0x1ac3('0x3e')]:null,'referer':_0x2e8494[_0x1ac3('0x3f')],'browserName':_0x49717b[_0x1ac3('0x40')][_0x1ac3('0x33')]&&_0x49717b[_0x1ac3('0x40')][_0x1ac3('0x41')]?util[_0x1ac3('0x42')](_0x1ac3('0x43'),_0x49717b['browser'][_0x1ac3('0x33')],_0x49717b[_0x1ac3('0x40')][_0x1ac3('0x41')]):_0x1ac3('0x44'),'browserVersion':_0x49717b[_0x1ac3('0x40')][_0x1ac3('0x41')]||_0x1ac3('0x44'),'osName':util['format']('%s\x20%s',_0x49717b['os'][_0x1ac3('0x33')],_0x49717b['os'][_0x1ac3('0x41')]),'osVersion':_0x49717b['os']['version'],'deviceModel':_0x49717b[_0x1ac3('0x45')][_0x1ac3('0x46')]&&_0x49717b['device'][_0x1ac3('0x47')]?util['format'](_0x1ac3('0x48'),_0x49717b[_0x1ac3('0x45')][_0x1ac3('0x46')],_0x49717b[_0x1ac3('0x45')]['vendor'],_0x49717b[_0x1ac3('0x45')][_0x1ac3('0x49')]):null,'deviceVendor':_0x49717b[_0x1ac3('0x45')][_0x1ac3('0x47')],'deviceType':_0x49717b[_0x1ac3('0x45')]['type'],'formData':JSON[_0x1ac3('0x1f')](_0x2e8494)};}exports[_0x1ac3('0x4a')]=function(_0x13f09d,_0x2513f9){var _0x589434={'include':[{'model':db[_0x1ac3('0x4b')],'as':_0x1ac3('0x4c')}]},_0x16d56a={},_0x2b6195={'count':0x0,'rows':[]};var _0x47af4e=_[_0x1ac3('0x4d')](db[_0x1ac3('0x4e')][_0x1ac3('0x4f')],function(_0x522146){return{'name':_0x522146['fieldName'],'type':_0x522146[_0x1ac3('0x49')]['key']};});_0x16d56a[_0x1ac3('0x46')]=_[_0x1ac3('0x4d')](_0x47af4e,_0x1ac3('0x33'));_0x16d56a[_0x1ac3('0x50')]=_[_0x1ac3('0x51')](_0x13f09d[_0x1ac3('0x50')]);_0x16d56a[_0x1ac3('0x52')]=_['intersection'](_0x16d56a['model'],_0x16d56a[_0x1ac3('0x50')]);_0x589434[_0x1ac3('0x53')]=_[_0x1ac3('0x54')](_0x16d56a['model'],qs['fields'](_0x13f09d['query'][_0x1ac3('0x55')]));_0x589434[_0x1ac3('0x53')]=_0x589434['attributes'][_0x1ac3('0x56')]?_0x589434[_0x1ac3('0x53')]:_0x16d56a[_0x1ac3('0x46')];if(!_0x13f09d[_0x1ac3('0x50')]['hasOwnProperty']('nolimit')){_0x589434[_0x1ac3('0x27')]=qs[_0x1ac3('0x27')](_0x13f09d['query'][_0x1ac3('0x27')]);_0x589434['offset']=qs['offset'](_0x13f09d[_0x1ac3('0x50')][_0x1ac3('0x29')]);}_0x589434['order']=qs[_0x1ac3('0x57')](_0x13f09d['query'][_0x1ac3('0x57')]);_0x589434[_0x1ac3('0x58')]=qs[_0x1ac3('0x52')](_[_0x1ac3('0x59')](_0x13f09d[_0x1ac3('0x50')],_0x16d56a[_0x1ac3('0x52')]),_0x47af4e);if(_0x13f09d[_0x1ac3('0x50')][_0x1ac3('0x5a')]){_0x589434[_0x1ac3('0x58')]=_[_0x1ac3('0x5b')](_0x589434[_0x1ac3('0x58')],{'$or':_['map'](_0x47af4e,function(_0x5d6270){if(_0x5d6270[_0x1ac3('0x49')]!==_0x1ac3('0x5c')){var _0x3bf701={};_0x3bf701[_0x5d6270[_0x1ac3('0x33')]]={'$like':'%'+_0x13f09d[_0x1ac3('0x50')][_0x1ac3('0x5a')]+'%'};return _0x3bf701;}})});}_0x589434=_[_0x1ac3('0x5b')]({},_0x589434,_0x13f09d[_0x1ac3('0x5d')]);var _0xcf3bba={'where':_0x589434[_0x1ac3('0x58')]};return db['ChatWebsite'][_0x1ac3('0x28')](_0xcf3bba)[_0x1ac3('0x19')](function(_0x10a29d){_0x2b6195[_0x1ac3('0x28')]=_0x10a29d;if(_0x13f09d[_0x1ac3('0x50')]['includeAll']){_0x589434[_0x1ac3('0x5e')]=[{'all':!![]}];}return db[_0x1ac3('0x4e')]['findAll'](_0x589434);})['then'](function(_0x51af03){_0x2b6195[_0x1ac3('0x5f')]=_0x51af03;return _0x2b6195;})[_0x1ac3('0x19')](respondWithFilteredResult(_0x2513f9,_0x589434))[_0x1ac3('0x60')](handleError(_0x2513f9,null));};exports['show']=function(_0x3a5d23,_0x5d05dd){var _0x5035cf={'raw':![],'where':{'id':_0x3a5d23['params']['id']},'include':[{'model':db[_0x1ac3('0x4b')],'as':_0x1ac3('0x4c')}]},_0x52ef77={};_0x52ef77[_0x1ac3('0x46')]=_[_0x1ac3('0x51')](db[_0x1ac3('0x4e')]['rawAttributes']);_0x52ef77[_0x1ac3('0x50')]=_[_0x1ac3('0x51')](_0x3a5d23['query']);_0x52ef77[_0x1ac3('0x52')]=_[_0x1ac3('0x54')](_0x52ef77[_0x1ac3('0x46')],_0x52ef77[_0x1ac3('0x50')]);_0x5035cf[_0x1ac3('0x53')]=_['intersection'](_0x52ef77[_0x1ac3('0x46')],qs[_0x1ac3('0x55')](_0x3a5d23[_0x1ac3('0x50')][_0x1ac3('0x55')]));_0x5035cf['attributes']=_0x5035cf[_0x1ac3('0x53')][_0x1ac3('0x56')]?_0x5035cf[_0x1ac3('0x53')]:_0x52ef77[_0x1ac3('0x46')];if(_0x3a5d23[_0x1ac3('0x50')][_0x1ac3('0x61')]){_0x5035cf['include']=[{'all':!![]}];}_0x5035cf=_['merge']({},_0x5035cf,_0x3a5d23['options']);return db['ChatWebsite'][_0x1ac3('0x62')](_0x5035cf)['then'](handleEntityNotFound(_0x5d05dd,null))[_0x1ac3('0x19')](respondWithResult(_0x5d05dd,null))[_0x1ac3('0x60')](handleError(_0x5d05dd,null));};exports[_0x1ac3('0x63')]=function(_0x20fa43,_0x11f451){var _0xa2d2c=null;_0x20fa43['body'][_0x1ac3('0x64')][_0x1ac3('0x65')](',')[_0x1ac3('0x66')](_0x422b15=>{if(_0x422b15['trim']()!==''&&!wildcardUtils[_0x1ac3('0x67')](_0x422b15[_0x1ac3('0x68')]())){_0xa2d2c=new APIBadRequestError('\x22'+_0x422b15[_0x1ac3('0x68')]()+_0x1ac3('0x69'));}});if(_0xa2d2c){return handleError(_0x11f451,null)(_0xa2d2c);}return db[_0x1ac3('0x4e')]['create'](_0x20fa43[_0x1ac3('0x6a')],{})['then'](function(_0x4d6e52){var _0x402507=_0x20fa43[_0x1ac3('0x6b')][_0x1ac3('0x2d')]({'plain':!![]});if(!_0x402507)throw new Error(_0x1ac3('0x6c'));if(_0x402507[_0x1ac3('0x6d')]===_0x1ac3('0x6b')){var _0x3e8b55=_0x4d6e52[_0x1ac3('0x2d')]({'plain':!![]});var _0x419040='ChatWebsites';return db[_0x1ac3('0x6e')][_0x1ac3('0x62')]({'where':{'name':_0x419040,'userProfileId':_0x402507[_0x1ac3('0x6f')]},'raw':!![]})['then'](function(_0x256f8d){if(_0x256f8d&&_0x256f8d[_0x1ac3('0x70')]===0x0){return db[_0x1ac3('0x2f')][_0x1ac3('0x63')]({'name':_0x3e8b55[_0x1ac3('0x33')],'resourceId':_0x3e8b55['id'],'type':_0x256f8d[_0x1ac3('0x33')],'sectionId':_0x256f8d['id']},{})[_0x1ac3('0x19')](function(){return _0x4d6e52;});}else{return _0x4d6e52;}})[_0x1ac3('0x60')](function(_0x2edd17){logger[_0x1ac3('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2edd17);throw _0x2edd17;});}return _0x4d6e52;})[_0x1ac3('0x19')](respondWithResult(_0x11f451,0xc9))[_0x1ac3('0x60')](handleError(_0x11f451,null));};exports[_0x1ac3('0x71')]=function(_0x566ddc,_0xd53c2c){var _0x6a53c6=null;_0x566ddc[_0x1ac3('0x6a')][_0x1ac3('0x64')][_0x1ac3('0x65')](',')['forEach'](_0x4d9d77=>{if(_0x4d9d77['trim']()!==''&&!wildcardUtils[_0x1ac3('0x67')](_0x4d9d77['trim']())){_0x6a53c6=new APIBadRequestError('\x22'+_0x4d9d77[_0x1ac3('0x68')]()+_0x1ac3('0x69'));}});if(_0x6a53c6){return handleError(_0xd53c2c,null)(_0x6a53c6);}if(_0x566ddc[_0x1ac3('0x6a')]['id']){delete _0x566ddc['body']['id'];}return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'where':{'id':_0x566ddc[_0x1ac3('0x72')]['id']},'include':[{'model':db[_0x1ac3('0x4b')],'as':_0x1ac3('0x4c')}]})['then'](handleEntityNotFound(_0xd53c2c,null))['then'](saveUpdates(_0x566ddc[_0x1ac3('0x6a')],null))[_0x1ac3('0x19')](respondWithResult(_0xd53c2c,null))['catch'](handleError(_0xd53c2c,null));};exports[_0x1ac3('0x2c')]=function(_0x476863,_0x2a4316){return db['ChatWebsite'][_0x1ac3('0x62')]({'where':{'id':_0x476863[_0x1ac3('0x72')]['id']}})['then'](handleEntityNotFound(_0x2a4316,null))[_0x1ac3('0x19')](removeEntity(_0x2a4316,null))['catch'](handleError(_0x2a4316,null));};exports[_0x1ac3('0x73')]=function(_0x5c7c1c,_0x4cb532){return db[_0x1ac3('0x4e')][_0x1ac3('0x73')]()[_0x1ac3('0x19')](respondWithResult(_0x4cb532,null))[_0x1ac3('0x60')](handleError(_0x4cb532,null));};exports[_0x1ac3('0x74')]=function(_0x42e682,_0x367e9d){if(_0x42e682[_0x1ac3('0x6a')]['id']){delete _0x42e682[_0x1ac3('0x6a')]['id'];}return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'where':{'id':_0x42e682[_0x1ac3('0x72')]['id']}})['then'](handleEntityNotFound(_0x367e9d,null))['then'](function(_0x588726){if(_0x588726){_0x42e682[_0x1ac3('0x6a')][_0x1ac3('0x75')]=_0x588726['id'];return db['Disposition'][_0x1ac3('0x63')](_0x42e682[_0x1ac3('0x6a')]);}})[_0x1ac3('0x19')](respondWithResult(_0x367e9d,null))[_0x1ac3('0x60')](handleError(_0x367e9d,null));};exports[_0x1ac3('0x76')]=function(_0x5278ed,_0x24ab6e){var _0x50fe83={'raw':![],'where':{}};var _0x468f39={};var _0x57a3b0={'count':0x0,'rows':[]};return db[_0x1ac3('0x4e')]['findOne']({'where':{'id':_0x5278ed[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x24ab6e,null))[_0x1ac3('0x19')](function(_0x2d700f){if(_0x2d700f){_0x468f39[_0x1ac3('0x46')]=_['keys'](db['Disposition']['rawAttributes']);_0x468f39[_0x1ac3('0x50')]=_[_0x1ac3('0x51')](_0x5278ed[_0x1ac3('0x50')]);_0x468f39[_0x1ac3('0x52')]=_['intersection'](_0x468f39[_0x1ac3('0x46')],_0x468f39[_0x1ac3('0x50')]);_0x50fe83['attributes']=_[_0x1ac3('0x54')](_0x468f39['model'],qs[_0x1ac3('0x55')](_0x5278ed['query']['fields']));_0x50fe83['attributes']=_0x50fe83[_0x1ac3('0x53')][_0x1ac3('0x56')]?_0x50fe83[_0x1ac3('0x53')]:_0x468f39[_0x1ac3('0x46')];if(!_0x5278ed[_0x1ac3('0x50')]['hasOwnProperty'](_0x1ac3('0x77'))){_0x50fe83[_0x1ac3('0x27')]=qs[_0x1ac3('0x27')](_0x5278ed[_0x1ac3('0x50')]['limit']);_0x50fe83[_0x1ac3('0x29')]=qs[_0x1ac3('0x29')](_0x5278ed['query']['offset']);}_0x50fe83['order']=qs[_0x1ac3('0x57')](_0x5278ed[_0x1ac3('0x50')][_0x1ac3('0x57')]);_0x50fe83[_0x1ac3('0x58')]=qs['filters'](_[_0x1ac3('0x59')](_0x5278ed[_0x1ac3('0x50')],_0x468f39['filters']));_0x50fe83[_0x1ac3('0x58')][_0x1ac3('0x75')]=_0x2d700f['id'];if(_0x5278ed[_0x1ac3('0x50')][_0x1ac3('0x5a')]){_0x50fe83['where']=_[_0x1ac3('0x5b')](_0x50fe83[_0x1ac3('0x58')],{'$or':_[_0x1ac3('0x4d')](_0x50fe83[_0x1ac3('0x53')],function(_0x195dd5){var _0x592736={};_0x592736[_0x195dd5]={'$like':'%'+_0x5278ed[_0x1ac3('0x50')][_0x1ac3('0x5a')]+'%'};return _0x592736;})});}_0x50fe83=_['merge']({},_0x50fe83,_0x5278ed['options']);return db[_0x1ac3('0x78')][_0x1ac3('0x28')]({'where':_0x50fe83['where']})['then'](function(_0x88e53e){_0x57a3b0['count']=_0x88e53e;if(_0x5278ed[_0x1ac3('0x50')][_0x1ac3('0x61')]){_0x50fe83['include']=[{'all':!![]}];}return db['Disposition'][_0x1ac3('0x79')](_0x50fe83);})['then'](function(_0x45faf6){_0x57a3b0[_0x1ac3('0x5f')]=_0x45faf6;return _0x57a3b0;});}})[_0x1ac3('0x19')](respondWithFilteredResult(_0x24ab6e,_0x50fe83))[_0x1ac3('0x60')](handleError(_0x24ab6e,null));};exports[_0x1ac3('0x7a')]=function(_0xfbcc08,_0x9a48b8){return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'where':{'id':_0xfbcc08['params']['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x9a48b8,null))[_0x1ac3('0x19')](function(_0x532a9a){if(_0x532a9a){return _0x532a9a[_0x1ac3('0x7a')](_0xfbcc08[_0x1ac3('0x50')]['ids']);}})[_0x1ac3('0x19')](respondWithStatusCode(_0x9a48b8,null))['catch'](handleError(_0x9a48b8,null));};exports['addAnswer']=function(_0x31f1e7,_0x19a898){if(_0x31f1e7[_0x1ac3('0x6a')]['id']){delete _0x31f1e7['body']['id'];}return db['ChatWebsite'][_0x1ac3('0x62')]({'where':{'id':_0x31f1e7[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x19a898,null))[_0x1ac3('0x19')](function(_0x406738){if(_0x406738){_0x31f1e7[_0x1ac3('0x6a')][_0x1ac3('0x75')]=_0x406738['id'];return db[_0x1ac3('0x7b')][_0x1ac3('0x63')](_0x31f1e7[_0x1ac3('0x6a')]);}})[_0x1ac3('0x19')](respondWithResult(_0x19a898,null))[_0x1ac3('0x60')](handleError(_0x19a898,null));};exports[_0x1ac3('0x7c')]=function(_0x2a6657,_0x753ab8){var _0x46fdaa={'raw':![],'where':{}};var _0x26d623={};var _0xbb9f39={'count':0x0,'rows':[]};return db[_0x1ac3('0x4e')][_0x1ac3('0x7d')]({'where':{'id':_0x2a6657[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x753ab8,null))['then'](function(_0x461a00){if(_0x461a00){_0x26d623[_0x1ac3('0x46')]=_[_0x1ac3('0x51')](db[_0x1ac3('0x7b')][_0x1ac3('0x4f')]);_0x26d623[_0x1ac3('0x50')]=_['keys'](_0x2a6657['query']);_0x26d623[_0x1ac3('0x52')]=_[_0x1ac3('0x54')](_0x26d623[_0x1ac3('0x46')],_0x26d623[_0x1ac3('0x50')]);_0x46fdaa[_0x1ac3('0x53')]=_[_0x1ac3('0x54')](_0x26d623[_0x1ac3('0x46')],qs[_0x1ac3('0x55')](_0x2a6657[_0x1ac3('0x50')][_0x1ac3('0x55')]));_0x46fdaa[_0x1ac3('0x53')]=_0x46fdaa['attributes'][_0x1ac3('0x56')]?_0x46fdaa[_0x1ac3('0x53')]:_0x26d623[_0x1ac3('0x46')];if(!_0x2a6657['query'][_0x1ac3('0x7e')](_0x1ac3('0x77'))){_0x46fdaa['limit']=qs[_0x1ac3('0x27')](_0x2a6657[_0x1ac3('0x50')][_0x1ac3('0x27')]);_0x46fdaa[_0x1ac3('0x29')]=qs['offset'](_0x2a6657['query']['offset']);}_0x46fdaa[_0x1ac3('0x7f')]=qs[_0x1ac3('0x57')](_0x2a6657[_0x1ac3('0x50')][_0x1ac3('0x57')]);_0x46fdaa[_0x1ac3('0x58')]=qs['filters'](_[_0x1ac3('0x59')](_0x2a6657[_0x1ac3('0x50')],_0x26d623[_0x1ac3('0x52')]));_0x46fdaa['where'][_0x1ac3('0x75')]=_0x461a00['id'];if(_0x2a6657[_0x1ac3('0x50')][_0x1ac3('0x5a')]){_0x46fdaa[_0x1ac3('0x58')]=_[_0x1ac3('0x5b')](_0x46fdaa['where'],{'$or':_[_0x1ac3('0x4d')](_0x46fdaa[_0x1ac3('0x53')],function(_0x22422c){var _0x3fb464={};_0x3fb464[_0x22422c]={'$like':'%'+_0x2a6657['query']['filter']+'%'};return _0x3fb464;})});}_0x46fdaa=_[_0x1ac3('0x5b')]({},_0x46fdaa,_0x2a6657[_0x1ac3('0x5d')]);return db['CannedAnswer'][_0x1ac3('0x28')]({'where':_0x46fdaa[_0x1ac3('0x58')]})[_0x1ac3('0x19')](function(_0x424ed8){_0xbb9f39['count']=_0x424ed8;if(_0x2a6657[_0x1ac3('0x50')][_0x1ac3('0x61')]){_0x46fdaa[_0x1ac3('0x5e')]=[{'all':!![]}];}return db[_0x1ac3('0x7b')][_0x1ac3('0x79')](_0x46fdaa);})[_0x1ac3('0x19')](function(_0x11e2a1){_0xbb9f39['rows']=_0x11e2a1;return _0xbb9f39;});}})[_0x1ac3('0x19')](respondWithFilteredResult(_0x753ab8,_0x46fdaa))[_0x1ac3('0x60')](handleError(_0x753ab8,null));};exports[_0x1ac3('0x80')]=function(_0x3a9f4c,_0x41e04d){return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'where':{'id':_0x3a9f4c[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x41e04d,null))[_0x1ac3('0x19')](function(_0x45767b){if(_0x45767b){return _0x45767b[_0x1ac3('0x80')](_0x3a9f4c[_0x1ac3('0x50')][_0x1ac3('0x81')]);}})['then'](respondWithStatusCode(_0x41e04d,null))[_0x1ac3('0x60')](handleError(_0x41e04d,null));};exports[_0x1ac3('0x82')]=function(_0x1fba37,_0x1b50dc){_0x1fba37['body']['sitepic']=_0x1fba37[_0x1ac3('0x83')][_0x1ac3('0x84')];return db[_0x1ac3('0x4e')]['find']({'where':{'id':_0x1fba37['params']['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x1b50dc,null))[_0x1ac3('0x19')](saveUpdates(_0x1fba37[_0x1ac3('0x6a')],null))[_0x1ac3('0x19')](respondWithResult(_0x1b50dc,null))[_0x1ac3('0x60')](handleError(_0x1b50dc,null));};exports['addAvatar']=function(_0x223e07,_0x1a354a){_0x223e07[_0x1ac3('0x6a')][_0x1ac3('0x85')]=_0x223e07[_0x1ac3('0x83')][_0x1ac3('0x84')];return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'where':{'id':_0x223e07[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x1a354a,null))[_0x1ac3('0x19')](saveUpdates(_0x223e07['body'],null))[_0x1ac3('0x19')](respondWithResult(_0x1a354a,null))[_0x1ac3('0x60')](handleError(_0x1a354a,null));};exports[_0x1ac3('0x86')]=function(_0x53b8a3,_0x4d7f0c){_0x53b8a3[_0x1ac3('0x6a')]['customerAvatar']=_0x53b8a3[_0x1ac3('0x83')][_0x1ac3('0x84')];return db[_0x1ac3('0x4e')]['find']({'where':{'id':_0x53b8a3['params']['id']}})['then'](handleEntityNotFound(_0x4d7f0c,null))[_0x1ac3('0x19')](saveUpdates(_0x53b8a3[_0x1ac3('0x6a')],null))[_0x1ac3('0x19')](respondWithResult(_0x4d7f0c,null))[_0x1ac3('0x60')](handleError(_0x4d7f0c,null));};exports[_0x1ac3('0x87')]=function(_0x24e287,_0x35071c){_0x24e287[_0x1ac3('0x6a')][_0x1ac3('0x88')]=_0x24e287[_0x1ac3('0x83')][_0x1ac3('0x84')];return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'where':{'id':_0x24e287[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x35071c,null))[_0x1ac3('0x19')](saveUpdates(_0x24e287[_0x1ac3('0x6a')],null))[_0x1ac3('0x19')](respondWithResult(_0x35071c,null))['catch'](handleError(_0x35071c,null));};exports[_0x1ac3('0x89')]=function(_0x34b5dd,_0x218fb9){var _0x389b53=path[_0x1ac3('0x8a')](config['root'],_0x1ac3('0x8b'));var _0x32c91f={'where':{'id':_0x34b5dd['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x2e9309=![];return require(_0x1ac3('0x8c'))[_0x1ac3('0x8d')]()[_0x1ac3('0x19')](function(_0x1dddbf){if(_0x1dddbf){_0x2e9309=_0x1dddbf[_0x1ac3('0x8e')];}})[_0x1ac3('0x19')](function(){return db[_0x1ac3('0x4e')][_0x1ac3('0x62')](_0x32c91f);})[_0x1ac3('0x19')](handleEntityNotFound(_0x218fb9,null))[_0x1ac3('0x19')](function(_0x1b099a){if(_0x1b099a){if(!_['isNil'](_0x1b099a[_0x1ac3('0x8f')])){if(fs['existsSync'](path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],_0x1ac3('0x91'),_0x1b099a[_0x1ac3('0x8f')]))&&_0x2e9309){_0x389b53=path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],_0x1ac3('0x91'),_0x1b099a[_0x1ac3('0x8f')]);}}return _0x218fb9[_0x1ac3('0x92')](_0x389b53);}})['catch'](handleError(_0x218fb9,null));};exports['getAvatar']=function(_0x53f1a2,_0x1b27e2){var _0x226281=path[_0x1ac3('0x8a')](config['root'],_0x1ac3('0x93'));var _0x471582={'where':{'id':_0x53f1a2['params']['id']},'attributes':['id',_0x1ac3('0x85')],'raw':!![]};return db[_0x1ac3('0x4e')][_0x1ac3('0x62')](_0x471582)['then'](handleEntityNotFound(_0x1b27e2,null))[_0x1ac3('0x19')](function(_0x57fa85){if(_0x57fa85){if(!_['isNil'](_0x57fa85['agentAvatar'])){if(fs[_0x1ac3('0x94')](path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],_0x1ac3('0x95'),_0x57fa85[_0x1ac3('0x85')]))){_0x226281=path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],_0x1ac3('0x95'),_0x57fa85[_0x1ac3('0x85')]);}}return _0x1b27e2[_0x1ac3('0x92')](_0x226281);}})[_0x1ac3('0x60')](handleError(_0x1b27e2,null));};exports[_0x1ac3('0x96')]=function(_0x113a0e,_0x588753){var _0x5af8bc=path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],'server/files/images/avatars/customer_avatar.png');var _0x170209={'where':{'id':_0x113a0e[_0x1ac3('0x72')]['id']},'attributes':['id',_0x1ac3('0x97'),_0x1ac3('0x98')],'raw':!![]};return db[_0x1ac3('0x4e')][_0x1ac3('0x62')](_0x170209)[_0x1ac3('0x19')](handleEntityNotFound(_0x588753,null))[_0x1ac3('0x19')](function(_0x44c60e){if(_0x44c60e){if(!_['isNil'](_0x44c60e[_0x1ac3('0x97')])){if(fs[_0x1ac3('0x94')](path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],_0x1ac3('0x95'),_0x44c60e[_0x1ac3('0x97')]))&&_0x44c60e[_0x1ac3('0x98')]){_0x5af8bc=path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],'server/files/images/avatars/',_0x44c60e[_0x1ac3('0x97')]);}}return _0x588753['download'](_0x5af8bc);}})[_0x1ac3('0x60')](handleError(_0x588753,null));};exports[_0x1ac3('0x99')]=function(_0x4ecbaa,_0x32c876){var _0x45c00a=path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],'server/files/images/avatars/system_avatar.png');var _0xf1d28c={'where':{'id':_0x4ecbaa[_0x1ac3('0x72')]['id']},'attributes':['id',_0x1ac3('0x88')],'raw':!![]};return db[_0x1ac3('0x4e')][_0x1ac3('0x62')](_0xf1d28c)[_0x1ac3('0x19')](handleEntityNotFound(_0x32c876,null))[_0x1ac3('0x19')](function(_0x4d6d80){if(_0x4d6d80){if(!_['isNil'](_0x4d6d80['systemAvatar'])){if(fs['existsSync'](path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],_0x1ac3('0x95'),_0x4d6d80[_0x1ac3('0x88')]))){_0x45c00a=path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],_0x1ac3('0x95'),_0x4d6d80['systemAvatar']);}}return _0x32c876['download'](_0x45c00a);}})['catch'](handleError(_0x32c876,null));};function checkWebsiteInterval(_0x421671){var _0x3e292d=_0x421671[_0x1ac3('0x9a')];if(!_0x3e292d){return Promise[_0x1ac3('0x9b')](_0x421671);}var _0x45ea6f=_0x421671['timezone']||undefined;return _0x3e292d[_0x1ac3('0x9c')](_0x45ea6f)[_0x1ac3('0x19')](function(_0x13250b){if(!_0x13250b){throw new APIOutOfIntervalError();}return _0x421671;});}exports[_0x1ac3('0x9d')]=function(_0x38cbd0,_0x2211e0){var _0x24f2cd={'body':_0x38cbd0[_0x1ac3('0x6a')],'channel':_0x1ac3('0x9e')};var _0x43cba5=[];var _0x4c7764=[];var _0x398d45={};var _0x99b822=![];if(_0x38cbd0[_0x1ac3('0x6a')]['id']){delete _0x38cbd0['body']['id'];}if(_[_0x1ac3('0x9f')](_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xa0')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x1ac3('0x9f')](_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xa1')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_['isEmpty'](_0x38cbd0['body'][_0x1ac3('0x6a')])){throw new APIBadRequestError(_0x1ac3('0xa2'));}var _0x3f013f=_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0x38')]&&_0x38cbd0['body'][_0x1ac3('0x3f')];return db[_0x1ac3('0xa3')]['describe']()[_0x1ac3('0x19')](function(_0x2d1166){if(!_0x2d1166){throw new Error(_0x1ac3('0xa4'));}_0x43cba5=Object['keys'](_0x2d1166)[_0x1ac3('0x5a')](function(_0x1263ae){return![_0x1ac3('0xa5'),_0x1ac3('0xa6')][_0x1ac3('0xa7')](_0x1263ae);});_0x4c7764=Object[_0x1ac3('0x51')](_0x2d1166)[_0x1ac3('0x5a')](function(_0x2258b8){return!['createdAt','updatedAt',_0x1ac3('0xa8'),_0x1ac3('0xa9')]['includes'](_0x2258b8);});if(!_[_0x1ac3('0xa7')](_0x4c7764,_0x38cbd0['body'][_0x1ac3('0xa1')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x4c7764[_0x1ac3('0x8a')](',\x20'));}_0x398d45[_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xa1')]]=_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xa0')];})[_0x1ac3('0x19')](function(){return db[_0x1ac3('0x4e')]['find']({'where':{'id':_0x38cbd0[_0x1ac3('0x72')]['id']},'include':[{'model':db[_0x1ac3('0xaa')],'as':_0x1ac3('0xab'),'include':[{'model':db['CmContact'],'as':_0x1ac3('0xac'),'where':_0x398d45,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x1ac3('0xad')],'as':_0x1ac3('0xae')},{'model':db['Interval'],'as':_0x1ac3('0x9a'),'include':[{'model':db[_0x1ac3('0x9a')],'as':_0x1ac3('0xaf'),'attributes':['id',_0x1ac3('0xb0')],'raw':!![]}]}]});})['then'](function(_0x3b2d96){if(!_0x3b2d96){throw new APINotFoundError(util['format'](_0x1ac3('0xb1'),_0x38cbd0[_0x1ac3('0x72')]['id']));}if(_0x3f013f){return checkWebsiteInterval(_0x3b2d96);}return _0x3b2d96;})[_0x1ac3('0x19')](function(_0x16a2c6){_0x24f2cd['account']=_0x16a2c6;_0x24f2cd[_0x1ac3('0xb2')]=_['orderBy'](_0x16a2c6[_0x1ac3('0xae')],[_0x1ac3('0xb3')],[_0x1ac3('0xb4')]);if(_0x24f2cd[_0x1ac3('0xb5')]['Applications']){delete _0x24f2cd[_0x1ac3('0xb5')][_0x1ac3('0xae')];}_0x24f2cd[_0x1ac3('0xb6')]=_0x16a2c6[_0x1ac3('0xab')]||{'id':_0x16a2c6[_0x1ac3('0xa9')]};if(_0x24f2cd[_0x1ac3('0xb6')]&&_0x24f2cd['list'][_0x1ac3('0xac')][_0x1ac3('0x56')]){return _0x24f2cd['list'][_0x1ac3('0xac')][0x0];}var _0x51100d=_['defaults'](_0x38cbd0['body'],{'firstName':_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xa0')],'ListId':_0x16a2c6['ListId']});_0x51100d[_0x38cbd0['body'][_0x1ac3('0xa1')]]=_0x38cbd0[_0x1ac3('0x6a')]['from'];return db[_0x1ac3('0xa3')][_0x1ac3('0x63')](_0x51100d,{'fields':_0x43cba5,'raw':!![]});})[_0x1ac3('0x19')](function(_0x34a13d){_0x24f2cd[_0x1ac3('0xb7')]=_0x34a13d;var _0x58cff1=createInteractionObject(_0x38cbd0[_0x1ac3('0x72')]['id'],_0x38cbd0[_0x1ac3('0x6a')],_0x38cbd0[_0x1ac3('0xb8')],_0x34a13d);var _0x1dc63c={'ChatWebsiteId':_0x38cbd0[_0x1ac3('0x72')]['id']};if(_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xb9')]){_0x1dc63c[_0x1ac3('0xb9')]=_0x38cbd0[_0x1ac3('0x6a')]['threadId'];_0x1dc63c['closed']=![];return db[_0x1ac3('0xba')][_0x1ac3('0x62')]({'where':_0x1dc63c})['then'](function(_0x263b6a){var _0x242dad=_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0x38')]&&_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0x3f')];if(_0x263b6a){_0x99b822=!![];return _0x263b6a;}else if(!_0x242dad&&_0x263b6a&&_0x263b6a[_0x1ac3('0xbb')]){throw new APIConflictError(_0x1ac3('0xbc'));}_0x58cff1[_0x1ac3('0xb9')]=_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xb9')];_0x58cff1[_0x1ac3('0xbd')]=_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xbd')];return db[_0x1ac3('0xba')]['create'](_0x58cff1);});}_0x1dc63c[_0x1ac3('0xbe')]=_0x34a13d['id'];if(_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xbf')]&&_0x38cbd0['body'][_0x1ac3('0xbf')]['id']){_0x1dc63c['id']=_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xbf')]['id'];return db[_0x1ac3('0xba')][_0x1ac3('0x62')]({'where':_0x1dc63c})['then'](function(_0x2b988f){var _0x3dc636=_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0x38')]&&_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0x3f')];if(!_0x3dc636&&_0x2b988f&&_0x2b988f[_0x1ac3('0xbb')]){throw new APIConflictError(_0x1ac3('0xbc'));}else if(_0x2b988f){_0x99b822=!![];return _0x2b988f;}else{return db[_0x1ac3('0xba')][_0x1ac3('0x63')](_0x58cff1);}});}return db[_0x1ac3('0xba')]['create'](_0x58cff1);})['then'](function(_0x3381e7){if(!_0x99b822){return _0x3381e7;}var _0x4a3b9a={'from':(_0x24f2cd[_0x1ac3('0xb7')][_0x1ac3('0x3c')]||'')+'\x20'+(_0x24f2cd[_0x1ac3('0xb7')][_0x1ac3('0x3d')]||'')};if(_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xb9')]&&_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xc0')]&&_0x38cbd0['body'][_0x1ac3('0xb9')]!=_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xc0')]){_0x4a3b9a[_0x1ac3('0xb9')]=_0x38cbd0['body'][_0x1ac3('0xc0')];}return _0x3381e7[_0x1ac3('0x71')](_0x4a3b9a);})[_0x1ac3('0x19')](function(_0x15fc32){_0x24f2cd[_0x1ac3('0xbf')]=_0x15fc32[_0x1ac3('0x2d')]({'plain':!![]});_0x24f2cd[_0x1ac3('0xbf')]['created']=!_0x99b822;if(_0x24f2cd[_0x1ac3('0xbf')]['created']){if(_0x24f2cd['account'][_0x1ac3('0xc1')]){_0x24f2cd['applications'][_0x1ac3('0xc2')]({'id':0x0,'priority':_0x24f2cd[_0x1ac3('0xb2')][_0x1ac3('0x56')]+0x1,'app':_0x1ac3('0xc3'),'appdata':'unmanaged','interval':_0x1ac3('0xc4')});}}return db[_0x1ac3('0xc5')][_0x1ac3('0x63')]({'body':_0x38cbd0[_0x1ac3('0x6a')]['body'],'ChatWebsiteId':_0x38cbd0[_0x1ac3('0x72')]['id'],'ChatInteractionId':_0x15fc32['id'],'direction':'in','ContactId':_0x24f2cd[_0x1ac3('0xb7')]['id'],'AttachmentId':_0x38cbd0[_0x1ac3('0x6a')][_0x1ac3('0xc6')]});})[_0x1ac3('0x19')](function(_0x22bb76){_0x24f2cd['message']=_0x22bb76;if(!_0x24f2cd[_0x1ac3('0xbf')]['UserId']){return;}return db['User'][_0x1ac3('0x62')]({'attributes':['id','name'],'where':{'id':_0x24f2cd[_0x1ac3('0xbf')][_0x1ac3('0xc7')]}});})[_0x1ac3('0x19')](function(_0x252472){if(_0x252472){_0x24f2cd[_0x1ac3('0xb2')][_0x1ac3('0xc8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x252472[_0x1ac3('0x33')]+','+(_0x24f2cd['account'][_0x1ac3('0xc9')]||0xa),'interval':_0x1ac3('0xc4')});_0x24f2cd[_0x1ac3('0xca')]=!![];}if(!_0x24f2cd[_0x1ac3('0xbf')][_0x1ac3('0xcb')]){return;}return db[_0x1ac3('0xcc')][_0x1ac3('0x62')]({'attributes':['id',_0x1ac3('0x33')],'where':{'id':_0x24f2cd[_0x1ac3('0xbf')]['queueId']}});})[_0x1ac3('0x19')](function(_0x40d9cf){if(_0x40d9cf){_0x24f2cd['applications'][_0x1ac3('0xc8')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x40d9cf['name']+','+(_0x24f2cd[_0x1ac3('0xb5')][_0x1ac3('0xcd')]||0x12c),'interval':_0x1ac3('0xc4')});}return respondWithRpcPromise(_0x1ac3('0xce'),'startRouting',_0x24f2cd);})[_0x1ac3('0x19')](function(_0x227652){respondWithRpcPromise(_0x1ac3('0xcf'),_0x1ac3('0xcf'),{'event':_0x1ac3('0x9d'),'message':_0x227652},client9002);return _0x227652;})[_0x1ac3('0x19')](respondWithResult(_0x2211e0,null))[_0x1ac3('0x60')](APIHandleError(_0x2211e0));};exports[_0x1ac3('0xd0')]=function(_0x2a08d2,_0x3617fd){var _0x56f158,_0x4587a5,_0x41a670;var _0x1f9dee=[];var _0x383637={};var _0x45c73b=_0x2a08d2[_0x1ac3('0xd1')]||[];var _0x5eec53=[];var _0x5435ef;return db[_0x1ac3('0xa3')][_0x1ac3('0x73')]()['then'](function(_0x536090){if(!_0x536090){throw new db[(_0x1ac3('0xd2'))][(_0x1ac3('0xd3'))](_0x1ac3('0xd4'));}_0x1f9dee=_[_0x1ac3('0xd5')](_['keys'](_0x536090),[_0x1ac3('0xa5'),_0x1ac3('0xa6'),_0x1ac3('0xa8'),_0x1ac3('0xa9')]);if(_0x2a08d2[_0x1ac3('0x6a')]['id']){delete _0x2a08d2['body']['id'];}if(_[_0x1ac3('0x9f')](_0x2a08d2[_0x1ac3('0x6a')][_0x1ac3('0xa0')])){throw _0x3617fd[_0x1ac3('0x24')](0x1f4)[_0x1ac3('0x34')](new db[(_0x1ac3('0xd2'))][(_0x1ac3('0xd3'))](_0x1ac3('0xd6')));}if(_[_0x1ac3('0x9f')](_0x2a08d2[_0x1ac3('0x6a')][_0x1ac3('0x6a')])||_0x2a08d2[_0x1ac3('0x6a')]['body']===''){throw _0x3617fd[_0x1ac3('0x24')](0x1f4)[_0x1ac3('0x34')](new db[(_0x1ac3('0xd2'))][(_0x1ac3('0xd3'))](_0x1ac3('0xd7')));}if(_[_0x1ac3('0x9f')](_0x2a08d2[_0x1ac3('0x6a')][_0x1ac3('0xd8')])){throw _0x3617fd[_0x1ac3('0x24')](0x1f4)[_0x1ac3('0x34')](new db[(_0x1ac3('0xd2'))][(_0x1ac3('0xd3'))](_0x1ac3('0xd9')+_0x1f9dee));}if(!_[_0x1ac3('0xa7')](_0x1f9dee,_0x2a08d2['body'][_0x1ac3('0xd8')])){throw _0x3617fd['status'](0x1f4)[_0x1ac3('0x34')](new db[(_0x1ac3('0xd2'))][(_0x1ac3('0xd3'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f9dee));}_0x383637[_0x2a08d2[_0x1ac3('0x6a')][_0x1ac3('0xd8')]]=_0x2a08d2['body'][_0x1ac3('0xa0')];})[_0x1ac3('0x19')](function(){return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'where':{'id':_0x2a08d2[_0x1ac3('0x72')]['id']},'include':[{'model':db['CmList'],'as':_0x1ac3('0xab')},{'model':db['MailAccount'],'as':_0x1ac3('0xda')}]});})['then'](handleEntityNotFound(_0x3617fd,null))[_0x1ac3('0x19')](function(_0x1e721b){if(_0x1e721b&&_0x1e721b['List']){_0x4587a5=_0x1e721b;var _0x5180f8=_[_0x1ac3('0x13')](_0x2a08d2[_0x1ac3('0x6a')],{'firstName':_0x2a08d2['body']['from'],'phone':_0x2a08d2[_0x1ac3('0x6a')]['from'],'ListId':_0x1e721b[_0x1ac3('0xa9')]});_0x5180f8[_0x2a08d2[_0x1ac3('0x6a')]['mapKeyOffline']]=_0x2a08d2[_0x1ac3('0x6a')][_0x1ac3('0xa0')];return db[_0x1ac3('0xa3')][_0x1ac3('0xdb')]({'where':_0x383637,'defaults':_0x5180f8});}})[_0x1ac3('0xdc')](function(_0x4d2d5d){if(_0x4d2d5d){_0x41a670=_0x4d2d5d;var _0x42fd83=fs[_0x1ac3('0xdd')](path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],_0x1ac3('0xde')),_0x1ac3('0xdf'));var _0x5adf55=ejs[_0x1ac3('0xe0')](_0x42fd83,{'body':_[_0x1ac3('0xe1')](_0x2a08d2[_0x1ac3('0x6a')][_0x1ac3('0x6a')]),'bodyTitle':_0x4587a5[_0x1ac3('0xe2')]});return db[_0x1ac3('0xe3')][_0x1ac3('0x63')]({'body':_0x5adf55,'plainBody':htmlToText[_0x1ac3('0xe4')](_0x5adf55),'ContactId':_0x4d2d5d['id'],'ChatWebsiteId':_0x4587a5['id']});}})[_0x1ac3('0x19')](function(_0x13a32b){_0x5435ef=_0x13a32b;if(_0x45c73b[_0x1ac3('0x56')]){var _0x547357=_0x45c73b['map'](function(_0x7847bf){return{'name':_0x7847bf[_0x1ac3('0xe5')],'basename':_0x7847bf['filename'],'type':_0x7847bf[_0x1ac3('0xe6')],'ChatOfflineMessageId':_0x13a32b['id']};});_0x5eec53=_0x547357[_0x1ac3('0x4d')](_0x404710=>{var _0x1133a9={'filename':_0x404710[_0x1ac3('0x33')],'path':path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],_0x1ac3('0xe7'),_0x1ac3('0xd1'),_0x1ac3('0xe8'),'offline-chat',_0x404710[_0x1ac3('0xe9')])};return _0x1133a9;});if(!_0x4587a5[_0x1ac3('0xea')]){return db['sequelize']['transaction'](function(_0x51b78b){return db[_0x1ac3('0xeb')][_0x1ac3('0xec')](_0x547357,{'transaction':_0x51b78b});});}}})['then'](function(){if(_0x5435ef){_0x56f158=_0x5435ef;return db[_0x1ac3('0xda')][_0x1ac3('0x7d')]({'where':{'service':!![]},'include':[{'model':db[_0x1ac3('0xed')],'as':_0x1ac3('0xee'),'raw':!![],'include':[{'model':db[_0x1ac3('0xef')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x2b8ef5){if(_0x2b8ef5&&_0x2b8ef5['Smtp']&&_0x4587a5[_0x1ac3('0xf0')]&&_0x4587a5[_0x1ac3('0xf1')]){var _0x5bed59=_0x2b8ef5[_0x1ac3('0xf2')]();return respondWithRpcPromise(_0x1ac3('0xf3'),_0x1ac3('0xf4'),{'account':_0x5bed59,'message':{'from':util[_0x1ac3('0x42')](_0x1ac3('0xf5'),_0x2b8ef5[_0x1ac3('0x33')],_0x2b8ef5[_0x1ac3('0xf6')]||_0x2b8ef5[_0x1ac3('0xee')][_0x1ac3('0x6b')]),'to':_0x4587a5[_0x1ac3('0xf1')],'subject':_0x4587a5['offlineMessageSubject'],'html':_0x56f158[_0x1ac3('0x6a')],'attachments':_0x5eec53}},client9003)[_0x1ac3('0x19')](function(){return _0x56f158;})[_0x1ac3('0x60')](function(_0x5181a9){logger[_0x1ac3('0x20')](_0x5181a9);});}})[_0x1ac3('0x19')](function(){if(_0x4587a5&&_0x4587a5[_0x1ac3('0xea')]&&_0x4587a5[_0x1ac3('0xf7')]){var _0x409f22=[];if(_0x45c73b[_0x1ac3('0x56')]){_0x409f22=_0x45c73b['map'](function(_0x97e4ca){return{'name':_0x97e4ca[_0x1ac3('0xe5')],'basename':_0x97e4ca[_0x1ac3('0x84')],'type':_0x97e4ca[_0x1ac3('0xe6')],'ChatOfflineMessageId':_0x5435ef['id']};});}var _0x29ece7;if(!_['isNil'](_0x4587a5[_0x1ac3('0xf8')])){var _0x413433=_[_0x1ac3('0x4d')](_0x2a08d2[_0x1ac3('0x6a')],function(_0x433b63){return _0x433b63;});var _0x2f5088=_[_0x1ac3('0xf9')](_0x413433)[0x0];var _0x1068b7=_['mapValues'](_0x2f5088,function(_0x4cce26){return _0x4cce26;});_0x29ece7=_0x1068b7[0x1][_0x4587a5[_0x1ac3('0xf8')]];}var _0x481270={'from':_0x41a670[_0x1ac3('0xf6')],'firstName':_0x41a670[_0x1ac3('0x3c')],'lastName':_0x41a670[_0x1ac3('0x3d')],'mapKey':_0x1ac3('0xf6'),'message':{'from':_0x41a670[_0x1ac3('0xf6')],'to':_0x4587a5[_0x1ac3('0xda')][_0x1ac3('0xf6')],'cc':'','subject':_['isNil'](_0x29ece7)?_0x4587a5['offlineMessageSubject']:_0x29ece7,'messageId':'','sentAt':new Date(),'attach':_0x409f22['length'],'attachments':_0x409f22,'originChannel':'Chat','ChatWebsiteId':_0x4587a5['id'],'ChatOfflineMessageId':_0x56f158['id'],'originTo':_0x4587a5[_0x1ac3('0xda')]['email']},'body':_0x56f158[_0x1ac3('0x6a')]};var _0x5b70f9={'account':{'id':_0x4587a5[_0x1ac3('0xf7')]},'body':_0x481270,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x1ac3('0xfa'),_0x5b70f9,client9001)[_0x1ac3('0x19')](function(){return _0x56f158;})[_0x1ac3('0x60')](function(_0x46cc44){logger[_0x1ac3('0x20')](_0x46cc44);});}return;})['then'](function(){if(_0x56f158){return _0x56f158;}})[_0x1ac3('0x19')](respondWithResult(_0x3617fd,null))['catch'](function(){for(var _0x2dce91 of _0x45c73b){var _0x5c4582=path['join'](config[_0x1ac3('0x90')],_0x1ac3('0xe7'),'files',_0x1ac3('0xe8'),_0x1ac3('0xfb'),_0x2dce91[_0x1ac3('0x84')]);fs_extra[_0x1ac3('0xfc')](_0x5c4582)[_0x1ac3('0x60')](function(_0x35e1fe){logger[_0x1ac3('0x20')](_0x1ac3('0xfd'),_0x5c4582,_0x35e1fe);});}});};exports[_0x1ac3('0xfe')]=function(_0x363cef,_0x2d8843){return db[_0x1ac3('0xba')][_0x1ac3('0x62')]({'where':{'id':_0x363cef[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x2d8843,null))[_0x1ac3('0x19')](function(_0x50e977){if(_0x50e977){return _0x50e977[_0x1ac3('0xfe')](_0x363cef[_0x1ac3('0x6a')][_0x1ac3('0x81')],_[_0x1ac3('0xff')](_0x363cef[_0x1ac3('0x6a')],['ids','id'])||{});}})[_0x1ac3('0x19')](respondWithResult(_0x2d8843,null))[_0x1ac3('0x60')](handleError(_0x2d8843,null));};exports['getInteractions']=function(_0x305805,_0x10ffd4){var _0xcbc2a3={'raw':![],'where':{}};var _0x4a02e3={};var _0x59fa4e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1ac3('0x7d')]({'where':{'id':_0x305805[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x10ffd4,null))[_0x1ac3('0x19')](function(_0x689aa2){if(_0x689aa2){_0x4a02e3['model']=_['keys'](db[_0x1ac3('0xba')][_0x1ac3('0x4f')]);_0x4a02e3[_0x1ac3('0x50')]=_[_0x1ac3('0x51')](_0x305805[_0x1ac3('0x50')]);_0x4a02e3[_0x1ac3('0x52')]=_['intersection'](_0x4a02e3[_0x1ac3('0x46')],_0x4a02e3[_0x1ac3('0x50')]);_0xcbc2a3[_0x1ac3('0x53')]=_[_0x1ac3('0x54')](_0x4a02e3[_0x1ac3('0x46')],qs[_0x1ac3('0x55')](_0x305805['query'][_0x1ac3('0x55')]));_0xcbc2a3['attributes']=_0xcbc2a3[_0x1ac3('0x53')]['length']?_0xcbc2a3[_0x1ac3('0x53')]:_0x4a02e3[_0x1ac3('0x46')];if(!_0x305805['query'][_0x1ac3('0x7e')](_0x1ac3('0x77'))){_0xcbc2a3[_0x1ac3('0x27')]=qs['limit'](_0x305805['query'][_0x1ac3('0x27')]);_0xcbc2a3[_0x1ac3('0x29')]=qs[_0x1ac3('0x29')](_0x305805[_0x1ac3('0x50')][_0x1ac3('0x29')]);}_0xcbc2a3[_0x1ac3('0x7f')]=qs[_0x1ac3('0x57')](_0x305805[_0x1ac3('0x50')]['sort']);_0xcbc2a3[_0x1ac3('0x58')]=qs[_0x1ac3('0x52')](_[_0x1ac3('0x59')](_0x305805[_0x1ac3('0x50')],_0x4a02e3['filters']));_0xcbc2a3[_0x1ac3('0x58')]['ChatWebsiteId']=_0x689aa2['id'];if(_0x305805['query']['filter']){_0xcbc2a3[_0x1ac3('0x58')]=_[_0x1ac3('0x5b')](_0xcbc2a3[_0x1ac3('0x58')],{'$or':_[_0x1ac3('0x4d')](_0xcbc2a3['attributes'],function(_0x238ce4){var _0x4e0a18={};_0x4e0a18[_0x238ce4]={'$like':'%'+_0x305805[_0x1ac3('0x50')][_0x1ac3('0x5a')]+'%'};return _0x4e0a18;})});}_0xcbc2a3=_[_0x1ac3('0x5b')]({},_0xcbc2a3,_0x305805[_0x1ac3('0x5d')]);return db[_0x1ac3('0xba')]['count']({'where':_0xcbc2a3['where']})[_0x1ac3('0x19')](function(_0x3c2a20){_0x59fa4e[_0x1ac3('0x28')]=_0x3c2a20;if(_0x305805[_0x1ac3('0x50')]['includeAll']){_0xcbc2a3[_0x1ac3('0x5e')]=[{'model':db['CmContact'],'as':_0x1ac3('0x100'),'required':![]},{'model':db['User'],'as':_0x1ac3('0x101'),'attributes':[_0x1ac3('0x33'),_0x1ac3('0x102'),'internal'],'required':![]},{'model':db[_0x1ac3('0x103')],'as':'Tags','attributes':['id',_0x1ac3('0x33'),_0x1ac3('0x104')],'where':_0x305805[_0x1ac3('0x50')][_0x1ac3('0x105')]?{'id':_0x305805[_0x1ac3('0x50')][_0x1ac3('0x105')]}:undefined,'required':_0x305805[_0x1ac3('0x50')]['tag']?!![]:![]}];}return db[_0x1ac3('0xba')][_0x1ac3('0x79')](_0xcbc2a3);})[_0x1ac3('0x19')](function(_0x40adad){_0x59fa4e[_0x1ac3('0x5f')]=_0x40adad;return _0x59fa4e;});}})[_0x1ac3('0x19')](respondWithFilteredResult(_0x10ffd4,_0xcbc2a3))['catch'](handleError(_0x10ffd4,null));};exports[_0x1ac3('0x106')]=function(_0x3d0215,_0x33494b){var _0x1d710b=0x0;var _0x2cf9a5=0x0;var _0x421647=![];var _0x34dfec;var _0x593b7c;return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'where':{'id':_0x3d0215[_0x1ac3('0x72')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x1ac3('0x9a')],'as':_0x1ac3('0xaf'),'attributes':['id',_0x1ac3('0xb0')]}]}]})[_0x1ac3('0x19')](handleEntityNotFound(_0x33494b,null))[_0x1ac3('0x19')](function(_0x36732e){if(_0x36732e){_0x34dfec=_0x36732e;return _0x36732e['getProactiveActions']({'raw':!![]});}})[_0x1ac3('0x19')](function(_0x3b21f4){if(_0x34dfec){if(_0x3b21f4){_0x593b7c=_0x3b21f4;}}return require(_0x1ac3('0x8c'))[_0x1ac3('0x8d')]();})[_0x1ac3('0x19')](function(_0x3a4f72){if(_0x3a4f72){_0x2cf9a5=_0x3a4f72[_0x1ac3('0x107')];_0x421647=_0x3a4f72['custom'];}})[_0x1ac3('0x19')](function(){return db[_0x1ac3('0xba')]['count']({'where':{'closed':![]}});})[_0x1ac3('0x19')](function(_0x3e3def){_0x1d710b=_0x3e3def;if(_0x2cf9a5&&_0x3e3def>_0x2cf9a5){return db['License'][_0x1ac3('0x7d')]({'where':{'id':0x1}})[_0x1ac3('0x19')](function(_0x1e8e1e){if(_0x1e8e1e){_0x1e8e1e['increment'](_0x1ac3('0x108'));}});}})[_0x1ac3('0x19')](function(){var _0x440ba3=_0x34dfec[_0x1ac3('0x9a')];var _0x2fd9c3=_0x34dfec['timezone']||undefined;return _0x440ba3?_0x440ba3[_0x1ac3('0x9c')](_0x2fd9c3):!![];})[_0x1ac3('0x19')](function(_0x1772bb){var _0x25f8de=fs[_0x1ac3('0xdd')](path[_0x1ac3('0x8a')](config[_0x1ac3('0x90')],_0x1ac3('0x109')),_0x1ac3('0xdf'));var _0x194b94=_0x1ac3('0x10a');var _0x54dcef=![];var _0x2ea510,_0x55ef0f;if(_0x3d0215['headers']['referer']){_0x2ea510=new URL(_0x3d0215[_0x1ac3('0xb8')][_0x1ac3('0x3f')])[_0x1ac3('0x10b')];}else if(_0x3d0215[_0x1ac3('0xb8')][_0x1ac3('0x10b')]){_0x2ea510=new URL(_0x3d0215[_0x1ac3('0xb8')][_0x1ac3('0x10b')])[_0x1ac3('0x10b')];}else{_0x2ea510=_0x1ac3('0x10c');}_0x55ef0f=typeof _0x34dfec[_0x1ac3('0x64')][_0x1ac3('0x65')](',')[_0x1ac3('0x62')](function(_0x3262b9){return wildcardUtils[_0x1ac3('0x10d')](_0x3262b9,_0x2ea510);})!==_0x1ac3('0x26');var _0x1f88ae={'chatVersion':_0x194b94,'chatWebsiteAddressOrigin':_0x55ef0f?_0x2ea510:_0x34dfec[_0x1ac3('0x64')],'remote':_0x34dfec['remote'],'query':querystring[_0x1ac3('0x1f')](_[_0x1ac3('0x5b')](_0x34dfec[_0x1ac3('0x2d')]({'plain':!![]}),{'customerIp':_0x3d0215[_0x1ac3('0xb8')][_0x1ac3('0x3a')]||_0x3d0215[_0x1ac3('0xb8')][_0x1ac3('0x10e')]||_0x3d0215[_0x1ac3('0x10f')][_0x1ac3('0x110')]||_0x3d0215['ip'],'referer':_0x3d0215['headers'][_0x1ac3('0x3f')],'openedInteractions':_0x1d710b,'maxInteractions':_0x2cf9a5,'virtual':_0x421647[_0x1ac3('0x107')],'online':_0x1772bb,'custom':_0x421647,'address':_0x55ef0f?_0x2ea510:null}))[_0x1ac3('0x111')](/'/g,'\x5c\x27')};_0x33494b['send'](ejs[_0x1ac3('0xe0')](Mustache[_0x1ac3('0xe0')](_0x25f8de,_0x1f88ae),{'proactiveActions':_0x593b7c,'alignment':_0x34dfec['alignment'],'verticalAlignment':_0x34dfec['verticalAlignment'],'div_color':_0x34dfec[_0x1ac3('0x104')],'labelText':_0x34dfec[_0x1ac3('0x112')],'text_color':_0x34dfec[_0x1ac3('0x113')],'text_button_color':_0x34dfec[_0x1ac3('0x114')],'button_color':_0x34dfec[_0x1ac3('0x115')],'background_color':_0x34dfec[_0x1ac3('0x116')],'hideWhenOffline':_0x34dfec['hideWhenOffline'],'intervalId':_0x34dfec[_0x1ac3('0x117')],'isDevelopment':_0x54dcef,'chatVersion':_0x194b94}));})['catch'](handleError(_0x33494b,null));};exports['addApplications']=function(_0x56a48f,_0xd4a6b1){var _0x30c581=_0x56a48f['params']['id'];var _0xd47633=_0x56a48f[_0x1ac3('0x6a')];var _0x12bb2d=0xc8;var _0x16d03f=null;return db[_0x1ac3('0x118')]['transaction']({'isolationLevel':db[_0x1ac3('0x118')][_0x1ac3('0x119')][_0x1ac3('0x11a')][_0x1ac3('0x11b')]},function(_0x57d89f){return db['ChatWebsite'][_0x1ac3('0x7d')]({'where':{'id':_0x30c581},'transaction':_0x57d89f})[_0x1ac3('0x19')](function(_0x2ed699){if(_0x2ed699){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x30c581},'transaction':_0x57d89f})[_0x1ac3('0x19')](function(){var _0x53eff0=_['map'](_0xd47633,function(_0x456e15){_0x456e15['ChatWebsiteId']=_0x30c581;return _0x456e15;});return db[_0x1ac3('0xad')][_0x1ac3('0xec')](_0x53eff0,{'transaction':_0x57d89f});});}else{_0x12bb2d=0x194;_0x16d03f=[];}});})[_0x1ac3('0x19')](function(){if(_0x12bb2d!==0x194){return db[_0x1ac3('0xad')][_0x1ac3('0x11c')]({'where':{'ChatWebsiteId':_0x30c581},'order':_0x1ac3('0xb3')})[_0x1ac3('0x19')](function(_0xd90038){_0x16d03f=_0xd90038;});}})[_0x1ac3('0x60')](function(_0xca8344){_0x12bb2d=0x1f4;logger[_0x1ac3('0x20')](_0xca8344['stack']);if(_0xca8344[_0x1ac3('0x33')]){delete _0xca8344['name'];}_0x16d03f=_0xca8344;})[_0x1ac3('0x11d')](function(){if(_0x16d03f===null){_0xd4a6b1['sendStatus'](_0x12bb2d);}else{if(_0x12bb2d===0x1f4){_0xd4a6b1[_0x1ac3('0x24')](_0x12bb2d)[_0x1ac3('0x34')](_0x16d03f);}else{_0xd4a6b1[_0x1ac3('0x24')](_0x12bb2d)[_0x1ac3('0x25')](_0x16d03f);}}});};exports[_0x1ac3('0x11e')]=function(_0x2b890f,_0x576038){var _0x251dda={};var _0x39bbe9={};var _0x5b5e82;var _0x21f8d4;return db[_0x1ac3('0x4e')][_0x1ac3('0x7d')]({'where':{'id':_0x2b890f[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x576038,null))[_0x1ac3('0x19')](function(_0x2af72a){if(_0x2af72a){_0x5b5e82=_0x2af72a;_0x39bbe9[_0x1ac3('0x46')]=_['keys'](db[_0x1ac3('0xad')][_0x1ac3('0x4f')]);_0x39bbe9[_0x1ac3('0x50')]=_['keys'](_0x2b890f['query']);_0x39bbe9[_0x1ac3('0x52')]=_['intersection'](_0x39bbe9[_0x1ac3('0x46')],_0x39bbe9[_0x1ac3('0x50')]);_0x251dda[_0x1ac3('0x53')]=_[_0x1ac3('0x54')](_0x39bbe9[_0x1ac3('0x46')],qs['fields'](_0x2b890f[_0x1ac3('0x50')][_0x1ac3('0x55')]));_0x251dda[_0x1ac3('0x53')]=_0x251dda[_0x1ac3('0x53')][_0x1ac3('0x56')]?_0x251dda['attributes']:_0x39bbe9['model'];_0x251dda[_0x1ac3('0x7f')]=qs[_0x1ac3('0x57')](_0x2b890f[_0x1ac3('0x50')][_0x1ac3('0x57')]);_0x251dda['where']=qs[_0x1ac3('0x52')](_[_0x1ac3('0x59')](_0x2b890f[_0x1ac3('0x50')],_0x39bbe9['filters']));if(_0x2b890f[_0x1ac3('0x50')][_0x1ac3('0x5a')]){_0x251dda[_0x1ac3('0x58')]=_['merge'](_0x251dda['where'],{'$or':_[_0x1ac3('0x4d')](_0x251dda[_0x1ac3('0x53')],function(_0x4a3a6c){var _0x19fc86={};_0x19fc86[_0x4a3a6c]={'$like':'%'+_0x2b890f['query'][_0x1ac3('0x5a')]+'%'};return _0x19fc86;})});}_0x251dda=_[_0x1ac3('0x5b')]({},_0x251dda,_0x2b890f[_0x1ac3('0x5d')]);return _0x5b5e82[_0x1ac3('0x11e')](_0x251dda);}})[_0x1ac3('0x19')](function(_0x278e1e){if(_0x278e1e){_0x21f8d4=_0x278e1e['length'];if(!_0x2b890f['query'][_0x1ac3('0x7e')](_0x1ac3('0x77'))){_0x251dda[_0x1ac3('0x27')]=qs[_0x1ac3('0x27')](_0x2b890f[_0x1ac3('0x50')][_0x1ac3('0x27')]);_0x251dda[_0x1ac3('0x29')]=qs[_0x1ac3('0x29')](_0x2b890f[_0x1ac3('0x50')][_0x1ac3('0x29')]);}return _0x5b5e82[_0x1ac3('0x11e')](_0x251dda);}})[_0x1ac3('0x19')](function(_0x178f4e){if(_0x178f4e){return _0x178f4e?{'count':_0x21f8d4,'rows':_0x178f4e}:null;}})[_0x1ac3('0x19')](respondWithResult(_0x576038,null))[_0x1ac3('0x60')](handleError(_0x576038,null));};exports['addProactiveActions']=function(_0x47b1fb,_0x21c927){return db[_0x1ac3('0x11f')][_0x1ac3('0x62')]({'where':{'id':_0x47b1fb[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x21c927,null))[_0x1ac3('0x19')](function(_0xfe73ef){if(_0xfe73ef){return _0xfe73ef[_0x1ac3('0x120')](_0x47b1fb['body'][_0x1ac3('0x81')],_[_0x1ac3('0xff')](_0x47b1fb['body'],[_0x1ac3('0x81'),'id'])||{});}})[_0x1ac3('0x19')](respondWithResult(_0x21c927,null))[_0x1ac3('0x60')](handleError(_0x21c927,null));};exports[_0x1ac3('0x121')]=function(_0x843684,_0x54132b){var _0x1e9e85={};var _0x5953a3={};var _0x361e9f;var _0x50d9e9;return db['ChatWebsite'][_0x1ac3('0x7d')]({'where':{'id':_0x843684['params']['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x54132b,null))[_0x1ac3('0x19')](function(_0x38dee5){if(_0x38dee5){_0x361e9f=_0x38dee5;_0x5953a3[_0x1ac3('0x46')]=_[_0x1ac3('0x51')](db[_0x1ac3('0x122')][_0x1ac3('0x4f')]);_0x5953a3[_0x1ac3('0x50')]=_['keys'](_0x843684[_0x1ac3('0x50')]);_0x5953a3[_0x1ac3('0x52')]=_['intersection'](_0x5953a3[_0x1ac3('0x46')],_0x5953a3[_0x1ac3('0x50')]);_0x1e9e85[_0x1ac3('0x53')]=_[_0x1ac3('0x54')](_0x5953a3[_0x1ac3('0x46')],qs[_0x1ac3('0x55')](_0x843684['query'][_0x1ac3('0x55')]));_0x1e9e85['attributes']=_0x1e9e85[_0x1ac3('0x53')]['length']?_0x1e9e85[_0x1ac3('0x53')]:_0x5953a3['model'];_0x1e9e85[_0x1ac3('0x7f')]=qs[_0x1ac3('0x57')](_0x843684['query']['sort']);_0x1e9e85[_0x1ac3('0x58')]=qs[_0x1ac3('0x52')](_[_0x1ac3('0x59')](_0x843684[_0x1ac3('0x50')],_0x5953a3[_0x1ac3('0x52')]));if(_0x843684[_0x1ac3('0x50')][_0x1ac3('0x5a')]){_0x1e9e85[_0x1ac3('0x58')]=_[_0x1ac3('0x5b')](_0x1e9e85['where'],{'$or':_['map'](_0x1e9e85[_0x1ac3('0x53')],function(_0x153450){var _0x1607d1={};_0x1607d1[_0x153450]={'$like':'%'+_0x843684[_0x1ac3('0x50')]['filter']+'%'};return _0x1607d1;})});}_0x1e9e85=_[_0x1ac3('0x5b')]({},_0x1e9e85,_0x843684['options']);return _0x361e9f['getProactiveActions'](_0x1e9e85);}})[_0x1ac3('0x19')](function(_0x400ca1){if(_0x400ca1){_0x50d9e9=_0x400ca1['length'];if(!_0x843684[_0x1ac3('0x50')]['hasOwnProperty'](_0x1ac3('0x77'))){_0x1e9e85[_0x1ac3('0x27')]=qs[_0x1ac3('0x27')](_0x843684[_0x1ac3('0x50')][_0x1ac3('0x27')]);_0x1e9e85[_0x1ac3('0x29')]=qs['offset'](_0x843684[_0x1ac3('0x50')][_0x1ac3('0x29')]);}return _0x361e9f['getProactiveActions'](_0x1e9e85);}})[_0x1ac3('0x19')](function(_0x3b9715){if(_0x3b9715){return _0x3b9715?{'count':_0x50d9e9,'rows':_0x3b9715}:null;}})[_0x1ac3('0x19')](respondWithResult(_0x54132b,null))[_0x1ac3('0x60')](handleError(_0x54132b,null));};exports[_0x1ac3('0x123')]=function(_0x5aa22e,_0x321e10){var _0x10726d=_0x5aa22e['query'][_0x1ac3('0x124')]===_0x1ac3('0x125')?_0x1ac3('0x126'):_0x1ac3('0x127');return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'attributes':['id',_0x10726d],'where':{'id':_0x5aa22e[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x321e10,null))['then'](function(_0x4193e4){if(_0x4193e4){var _0x2a9db2=_0x4193e4[_0x10726d];var _0x5921a6=_0x2a9db2&&_0x2a9db2[_0x1ac3('0x128')]?_0x2a9db2['items']:[];_0x321e10[_0x1ac3('0x34')]({'fromKey':_['isNil'](_0x2a9db2[_0x1ac3('0x129')])?undefined:_0x2a9db2[_0x1ac3('0x129')],'count':_0x5921a6[_0x1ac3('0x56')],'rows':_0x5921a6});}})[_0x1ac3('0x60')](handleError(_0x321e10,null));};exports[_0x1ac3('0x12a')]=function(_0x1350e3,_0x3389e9){var _0xe11bd9={'raw':![],'where':{}};var _0x2cb37f={};var _0x1578d7={'count':0x0,'rows':[]};return db[_0x1ac3('0x4e')][_0x1ac3('0x7d')]({'where':{'id':_0x1350e3['params']['id']}})['then'](handleEntityNotFound(_0x3389e9,null))['then'](function(_0x12ce2a){if(_0x12ce2a){_0x2cb37f[_0x1ac3('0x46')]=_[_0x1ac3('0x51')](db[_0x1ac3('0xe3')][_0x1ac3('0x4f')]);_0x2cb37f[_0x1ac3('0x50')]=_[_0x1ac3('0x51')](_0x1350e3[_0x1ac3('0x50')]);_0x2cb37f['filters']=_['intersection'](_0x2cb37f[_0x1ac3('0x46')],_0x2cb37f[_0x1ac3('0x50')]);_0xe11bd9[_0x1ac3('0x53')]=_[_0x1ac3('0x54')](_0x2cb37f['model'],qs[_0x1ac3('0x55')](_0x1350e3['query'][_0x1ac3('0x55')]));_0xe11bd9[_0x1ac3('0x53')]=_0xe11bd9[_0x1ac3('0x53')][_0x1ac3('0x56')]?_0xe11bd9[_0x1ac3('0x53')]:_0x2cb37f['model'];if(!_0x1350e3[_0x1ac3('0x50')][_0x1ac3('0x7e')](_0x1ac3('0x77'))){_0xe11bd9[_0x1ac3('0x27')]=qs[_0x1ac3('0x27')](_0x1350e3[_0x1ac3('0x50')]['limit']);_0xe11bd9['offset']=qs[_0x1ac3('0x29')](_0x1350e3[_0x1ac3('0x50')]['offset']);}_0xe11bd9[_0x1ac3('0x7f')]=qs[_0x1ac3('0x57')](_0x1350e3[_0x1ac3('0x50')]['sort']);_0xe11bd9['where']=qs[_0x1ac3('0x52')](_[_0x1ac3('0x59')](_0x1350e3[_0x1ac3('0x50')],_0x2cb37f[_0x1ac3('0x52')]));_0xe11bd9[_0x1ac3('0x58')]['ChatWebsiteId']=_0x12ce2a['id'];if(_0x1350e3['query'][_0x1ac3('0x5a')]){_0xe11bd9[_0x1ac3('0x58')]=_[_0x1ac3('0x5b')](_0xe11bd9[_0x1ac3('0x58')],{'$or':_[_0x1ac3('0x4d')](_0xe11bd9[_0x1ac3('0x53')],function(_0x2358e2){var _0xff4802={};_0xff4802[_0x2358e2]={'$like':'%'+_0x1350e3['query'][_0x1ac3('0x5a')]+'%'};return _0xff4802;})});}_0xe11bd9=_['merge']({},_0xe11bd9,_0x1350e3['options']);return db[_0x1ac3('0xe3')][_0x1ac3('0x28')]({'where':_0xe11bd9[_0x1ac3('0x58')]})[_0x1ac3('0x19')](function(_0x34691d){_0x1578d7[_0x1ac3('0x28')]=_0x34691d;if(_0x1350e3['query'][_0x1ac3('0x61')]){_0xe11bd9['include']=[{'all':!![]}];}else{_0xe11bd9[_0x1ac3('0x5e')]=[{'model':db[_0x1ac3('0xa3')],'as':_0x1ac3('0x100'),'required':![]},{'model':db[_0x1ac3('0xeb')],'as':_0x1ac3('0x12b'),'required':![]}];}return db[_0x1ac3('0xe3')][_0x1ac3('0x79')](_0xe11bd9);})[_0x1ac3('0x19')](function(_0x30feef){_0x1578d7['rows']=_0x30feef;return _0x1578d7;});}})[_0x1ac3('0x19')](respondWithFilteredResult(_0x3389e9,_0xe11bd9))['catch'](handleError(_0x3389e9,null));};exports[_0x1ac3('0x12c')]=function(_0x515dbb,_0xb8cb1c){return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'where':{'id':_0x515dbb[_0x1ac3('0x72')]['id']}})['then'](handleEntityNotFound(_0xb8cb1c,null))[_0x1ac3('0x19')](function(_0xfbeb5f){if(_0xfbeb5f){return _0xfbeb5f[_0x1ac3('0x12c')](_0x515dbb['body'][_0x1ac3('0x81')],_['omit'](_0x515dbb[_0x1ac3('0x6a')],['ids','id'])||{})['spread'](function(_0x5171b9){for(var _0x4431bc=0x0;_0x4431bc<_0x515dbb[_0x1ac3('0x6a')][_0x1ac3('0x81')][_0x1ac3('0x56')];_0x4431bc+=0x1){socket[_0x1ac3('0x12d')](_0x1ac3('0x12e'),{'UserId':Number(_0x515dbb['body'][_0x1ac3('0x81')][_0x4431bc]),'ChatWebsiteId':Number(_0x515dbb[_0x1ac3('0x72')]['id'])});}return _0x5171b9;});}})[_0x1ac3('0x19')](respondWithResult(_0xb8cb1c,null))['catch'](handleError(_0xb8cb1c,null));};exports['removeAgents']=function(_0x2042d2,_0x2bc485){return db[_0x1ac3('0x4e')][_0x1ac3('0x62')]({'where':{'id':_0x2042d2[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x2bc485,null))['then'](function(_0x12f2c4){if(_0x12f2c4){return _0x12f2c4['removeAgents'](_0x2042d2[_0x1ac3('0x50')][_0x1ac3('0x81')])[_0x1ac3('0x19')](function(){if(_[_0x1ac3('0x12f')](_0x2042d2[_0x1ac3('0x50')]['ids'])){for(var _0x3629b3=0x0;_0x3629b3<_0x2042d2[_0x1ac3('0x50')][_0x1ac3('0x81')][_0x1ac3('0x56')];_0x3629b3+=0x1){socket[_0x1ac3('0x12d')](_0x1ac3('0x130'),{'UserId':Number(_0x2042d2['query'][_0x1ac3('0x81')][_0x3629b3]),'ChatWebsiteId':Number(_0x2042d2[_0x1ac3('0x72')]['id'])});}}else{socket[_0x1ac3('0x12d')](_0x1ac3('0x130'),{'UserId':Number(_0x2042d2['query'][_0x1ac3('0x81')]),'ChatWebsiteId':Number(_0x2042d2[_0x1ac3('0x72')]['id'])});}});}})['then'](respondWithStatusCode(_0x2bc485,null))[_0x1ac3('0x60')](handleError(_0x2bc485,null));};exports[_0x1ac3('0x131')]=function(_0x5c6f2f,_0x200853){var _0x16e33e={};var _0x93ba={};var _0x32a3e2;var _0x4c5ea3;return db[_0x1ac3('0x4e')][_0x1ac3('0x7d')]({'where':{'id':_0x5c6f2f[_0x1ac3('0x72')]['id']}})[_0x1ac3('0x19')](handleEntityNotFound(_0x200853,null))[_0x1ac3('0x19')](function(_0x5c2d79){if(_0x5c2d79){_0x32a3e2=_0x5c2d79;_0x93ba[_0x1ac3('0x46')]=_['keys'](db[_0x1ac3('0x132')]['rawAttributes']);_0x93ba[_0x1ac3('0x50')]=_['keys'](_0x5c6f2f[_0x1ac3('0x50')]);_0x93ba[_0x1ac3('0x52')]=_['intersection'](_0x93ba['model'],_0x93ba[_0x1ac3('0x50')]);_0x16e33e[_0x1ac3('0x53')]=_[_0x1ac3('0x54')](_0x93ba[_0x1ac3('0x46')],qs[_0x1ac3('0x55')](_0x5c6f2f['query'][_0x1ac3('0x55')]));_0x16e33e[_0x1ac3('0x53')]=_0x16e33e[_0x1ac3('0x53')]['length']?_0x16e33e[_0x1ac3('0x53')]:_0x93ba[_0x1ac3('0x46')];_0x16e33e['order']=qs['sort'](_0x5c6f2f['query'][_0x1ac3('0x57')]);_0x16e33e['where']=qs[_0x1ac3('0x52')](_[_0x1ac3('0x59')](_0x5c6f2f[_0x1ac3('0x50')],_0x93ba['filters']));if(_0x5c6f2f[_0x1ac3('0x50')][_0x1ac3('0x5a')]){_0x16e33e[_0x1ac3('0x58')]=_[_0x1ac3('0x5b')](_0x16e33e[_0x1ac3('0x58')],{'$or':_['map'](_0x16e33e[_0x1ac3('0x53')],function(_0x28d776){var _0x16e468={};_0x16e468[_0x28d776]={'$like':'%'+_0x5c6f2f[_0x1ac3('0x50')]['filter']+'%'};return _0x16e468;})});}_0x16e33e=_[_0x1ac3('0x5b')]({},_0x16e33e,_0x5c6f2f[_0x1ac3('0x5d')]);return _0x32a3e2[_0x1ac3('0x131')](_0x16e33e);}})[_0x1ac3('0x19')](function(_0x307e16){if(_0x307e16){_0x4c5ea3=_0x307e16[_0x1ac3('0x56')];if(!_0x5c6f2f[_0x1ac3('0x50')][_0x1ac3('0x7e')](_0x1ac3('0x77'))){_0x16e33e[_0x1ac3('0x27')]=qs[_0x1ac3('0x27')](_0x5c6f2f[_0x1ac3('0x50')]['limit']);_0x16e33e[_0x1ac3('0x29')]=qs['offset'](_0x5c6f2f[_0x1ac3('0x50')][_0x1ac3('0x29')]);}return _0x32a3e2[_0x1ac3('0x131')](_0x16e33e);}})['then'](function(_0x12238e){if(_0x12238e){return _0x12238e?{'count':_0x4c5ea3,'rows':_0x12238e}:null;}})[_0x1ac3('0x19')](respondWithResult(_0x200853,null))['catch'](handleError(_0x200853,null));}; \ No newline at end of file +var _0xee14=['userChatWebsite:remove','getAgents','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','api','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','url','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','get','ChatWebsites','UserProfileResource','name','send','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','%s\x20%s\x20%s','vendor','type','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','Pause','length','include','body','address','forEach','trim','testWildcardValidity','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','resolve','timezone','ifTime','notify','chat','from','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','Interval','interval','account','applications','priority','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','push','unmanaged','UserId','User','unshift','agent','*,*,*,*','queueId','ChatQueue','queue','Start','EventManager','offline','files','ValidationError','no\x20available\x20attributes','difference','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','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','originalname','mimetype','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','Smtp','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','server','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Intervals','getProactiveActions','getLicense','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.13.0','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','replace','alignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','spread','emit','removeAgents'];(function(_0x4b8e55,_0x13db4f){var _0x185f42=function(_0x136295){while(--_0x136295){_0x4b8e55['push'](_0x4b8e55['shift']());}};_0x185f42(++_0x13db4f);}(_0xee14,0x13a));var _0x4ee1=function(_0x3caa98,_0xbc584b){_0x3caa98=_0x3caa98-0x0;var _0x4b386f=_0xee14[_0x3caa98];return _0x4b386f;};'use strict';var Mustache=require('mustache');var util=require('util');var path=require(_0x4ee1('0x0'));var ejs=require(_0x4ee1('0x1'));var fs=require('fs');var fs_extra=require(_0x4ee1('0x2'));var _=require(_0x4ee1('0x3'));var querystring=require(_0x4ee1('0x4'));var htmlToText=require(_0x4ee1('0x5'));var Redis=require(_0x4ee1('0x6'));var jayson=require(_0x4ee1('0x7'));var qs=require(_0x4ee1('0x8'));var logger=require('../../config/logger')(_0x4ee1('0x9'));var config=require('../../config/environment');var APIBadRequestError=require(_0x4ee1('0xa'))[_0x4ee1('0xb')];var APINotFoundError=require(_0x4ee1('0xa'))[_0x4ee1('0xc')];var APIOutOfIntervalError=require(_0x4ee1('0xa'))[_0x4ee1('0xd')];var APIHandleError=require('../../errors/api')[_0x4ee1('0xe')];var APIConflictError=require(_0x4ee1('0xa'))['APIConflictError'];var wildcardUtils=require(_0x4ee1('0xf'));var URL=require(_0x4ee1('0x10'))[_0x4ee1('0x11')];var db=require(_0x4ee1('0x12'))['db'];config['redis']=_[_0x4ee1('0x13')](config[_0x4ee1('0x14')],{'host':_0x4ee1('0x15'),'port':0x18eb});var socket=require(_0x4ee1('0x16'))(new Redis(config[_0x4ee1('0x14')]));require(_0x4ee1('0x17'))['register'](socket);var client=jayson[_0x4ee1('0x18')][_0x4ee1('0x19')]({'port':0x232c});var client9002=jayson[_0x4ee1('0x18')][_0x4ee1('0x19')]({'port':0x232a});var client9003=jayson[_0x4ee1('0x18')][_0x4ee1('0x19')]({'port':0x232b});var client9001=jayson[_0x4ee1('0x18')][_0x4ee1('0x19')]({'port':0x2329});function respondWithRpcPromise(_0xb7eafd,_0x4e3490,_0x2f9194,_0x38008f){return new Promise(function(_0x34651b,_0x1b1e0e){var _0x123c5e=_0x38008f||client;return _0x123c5e[_0x4ee1('0x1a')](_0xb7eafd,_0x2f9194)[_0x4ee1('0x1b')](function(_0x2b8f0e){logger[_0x4ee1('0x1c')](_0x4ee1('0x1d'),_0x4e3490,_0x4ee1('0x1e'));logger['debug'](_0x4ee1('0x1f'),_0x4e3490,_0x4ee1('0x1e'),JSON[_0x4ee1('0x20')](_0x2b8f0e));if(_0x2b8f0e[_0x4ee1('0x21')]){if(_0x2b8f0e[_0x4ee1('0x21')][_0x4ee1('0x22')]===0x1f4){logger['error'](_0x4ee1('0x1d'),_0x4e3490,_0x2b8f0e[_0x4ee1('0x21')][_0x4ee1('0x23')]);return _0x1b1e0e(_0x2b8f0e[_0x4ee1('0x21')][_0x4ee1('0x23')]);}logger[_0x4ee1('0x21')](_0x4ee1('0x1d'),_0x4e3490,_0x2b8f0e[_0x4ee1('0x21')][_0x4ee1('0x23')]);return _0x34651b(_0x2b8f0e[_0x4ee1('0x21')]['message']);}else{logger['info'](_0x4ee1('0x1d'),_0x4e3490,_0x4ee1('0x1e'));_0x34651b(_0x2b8f0e[_0x4ee1('0x24')][_0x4ee1('0x23')]);}})[_0x4ee1('0x25')](function(_0x28efdc){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4e3490,_0x28efdc);_0x1b1e0e(_0x28efdc);});});}function respondWithStatusCode(_0x442c71,_0x28b7e1){_0x28b7e1=_0x28b7e1||0xcc;return function(_0x4d39dd){if(_0x4d39dd){return _0x442c71[_0x4ee1('0x26')](_0x28b7e1);}return _0x442c71[_0x4ee1('0x27')](_0x28b7e1)[_0x4ee1('0x28')]();};}function respondWithResult(_0x215949,_0x2d699c){_0x2d699c=_0x2d699c||0xc8;return function(_0x3c7b2a){if(_0x3c7b2a){return _0x215949[_0x4ee1('0x27')](_0x2d699c)['json'](_0x3c7b2a);}};}function respondWithFilteredResult(_0x1f7b74,_0x59029c){return function(_0x4746c2){if(_0x4746c2){var _0x4ec408=typeof _0x59029c[_0x4ee1('0x29')]===_0x4ee1('0x2a')&&typeof _0x59029c[_0x4ee1('0x2b')]===_0x4ee1('0x2a');var _0x19ba11=_0x4746c2['count'];var _0x1f7483=_0x4ec408?0x0:_0x59029c['offset'];var _0x121301=_0x4ec408?_0x4746c2[_0x4ee1('0x2c')]:_0x59029c[_0x4ee1('0x29')]+_0x59029c[_0x4ee1('0x2b')];var _0xac31e9;if(_0x121301>=_0x19ba11){_0x121301=_0x19ba11;_0xac31e9=0xc8;}else{_0xac31e9=0xce;}_0x1f7b74['status'](_0xac31e9);return _0x1f7b74[_0x4ee1('0x2d')](_0x4ee1('0x2e'),_0x1f7483+'-'+_0x121301+'/'+_0x19ba11)[_0x4ee1('0x2f')](_0x4746c2);}return null;};}function saveUpdates(_0x2e37a3){return function(_0x79f87c){if(_0x79f87c){return _0x79f87c[_0x4ee1('0x30')](_0x2e37a3)['then'](function(_0x4aa2b8){return _0x4aa2b8;});}return null;};}function removeEntity(_0x2260bd){return function(_0x54482b){if(_0x54482b){return _0x54482b[_0x4ee1('0x31')]()['then'](function(){var _0x963c2b=_0x54482b[_0x4ee1('0x32')]({'plain':!![]});var _0x264aed=_0x4ee1('0x33');return db[_0x4ee1('0x34')][_0x4ee1('0x31')]({'where':{'type':_0x264aed,'resourceId':_0x963c2b['id']}})[_0x4ee1('0x1b')](function(){return _0x54482b;});})[_0x4ee1('0x1b')](function(){_0x2260bd[_0x4ee1('0x27')](0xcc)[_0x4ee1('0x28')]();});}};}function handleEntityNotFound(_0x4445d0){return function(_0x1f3371){if(!_0x1f3371){_0x4445d0[_0x4ee1('0x26')](0x194);}return _0x1f3371;};}function handleError(_0x55ac4a,_0x463d90){_0x463d90=_0x463d90||0x1f4;return function(_0x3de40e){logger[_0x4ee1('0x21')](_0x3de40e['stack']);if(_0x3de40e['name']){delete _0x3de40e[_0x4ee1('0x35')];}_0x55ac4a[_0x4ee1('0x27')](_0x463d90)[_0x4ee1('0x36')](_0x3de40e);};}function createInteractionObject(_0x1f2b4b,_0x4b6892,_0x315ae0,_0x2ed16f){var _0x11721a=require(_0x4ee1('0x37'));var _0x2653c4=new _0x11721a();var _0x2445c2=_0x2653c4[_0x4ee1('0x38')](_0x315ae0[_0x4ee1('0x39')])['getResult']();var _0x3b346e=_0x4b6892[_0x4ee1('0x3a')];if(_0x315ae0[_0x4ee1('0x3b')]){_0x3b346e=_0x315ae0[_0x4ee1('0x3b')];}else if(_0x315ae0[_0x4ee1('0x3c')]){_0x3b346e=_[_0x4ee1('0x3d')](_0x315ae0['x-forwarded-for'][_0x4ee1('0x3e')](','));}return{'ContactId':_0x2ed16f['id'],'ChatWebsiteId':_0x1f2b4b,'from':(_0x2ed16f[_0x4ee1('0x3f')]||'')+'\x20'+(_0x2ed16f[_0x4ee1('0x40')]||''),'customerIp':_0x3b346e,'customerPort':_0x315ae0[_0x4ee1('0x41')]?_0x315ae0[_0x4ee1('0x41')]:null,'referer':_0x4b6892[_0x4ee1('0x42')],'browserName':_0x2445c2[_0x4ee1('0x43')][_0x4ee1('0x35')]&&_0x2445c2[_0x4ee1('0x43')][_0x4ee1('0x44')]?util[_0x4ee1('0x45')](_0x4ee1('0x46'),_0x2445c2[_0x4ee1('0x43')]['name'],_0x2445c2[_0x4ee1('0x43')][_0x4ee1('0x44')]):'unknown','browserVersion':_0x2445c2[_0x4ee1('0x43')]['version']||_0x4ee1('0x47'),'osName':util['format'](_0x4ee1('0x46'),_0x2445c2['os'][_0x4ee1('0x35')],_0x2445c2['os']['version']),'osVersion':_0x2445c2['os'][_0x4ee1('0x44')],'deviceModel':_0x2445c2[_0x4ee1('0x48')][_0x4ee1('0x49')]&&_0x2445c2[_0x4ee1('0x48')]['vendor']?util[_0x4ee1('0x45')](_0x4ee1('0x4a'),_0x2445c2[_0x4ee1('0x48')]['model'],_0x2445c2['device'][_0x4ee1('0x4b')],_0x2445c2[_0x4ee1('0x48')][_0x4ee1('0x4c')]):null,'deviceVendor':_0x2445c2[_0x4ee1('0x48')][_0x4ee1('0x4b')],'deviceType':_0x2445c2['device']['type'],'formData':JSON[_0x4ee1('0x20')](_0x4b6892)};}exports[_0x4ee1('0x4d')]=function(_0x8aaff9,_0x183b4a){var _0x5c5862={'include':[{'model':db['Pause'],'as':_0x4ee1('0x4e')}]},_0x3d6bf4={},_0x32cc34={'count':0x0,'rows':[]};var _0x16dc20=_[_0x4ee1('0x4f')](db[_0x4ee1('0x50')][_0x4ee1('0x51')],function(_0x154ec0){return{'name':_0x154ec0[_0x4ee1('0x52')],'type':_0x154ec0[_0x4ee1('0x4c')][_0x4ee1('0x53')]};});_0x3d6bf4['model']=_['map'](_0x16dc20,_0x4ee1('0x35'));_0x3d6bf4[_0x4ee1('0x54')]=_[_0x4ee1('0x55')](_0x8aaff9[_0x4ee1('0x54')]);_0x3d6bf4['filters']=_[_0x4ee1('0x56')](_0x3d6bf4[_0x4ee1('0x49')],_0x3d6bf4[_0x4ee1('0x54')]);_0x5c5862[_0x4ee1('0x57')]=_[_0x4ee1('0x56')](_0x3d6bf4['model'],qs[_0x4ee1('0x58')](_0x8aaff9[_0x4ee1('0x54')][_0x4ee1('0x58')]));_0x5c5862['attributes']=_0x5c5862[_0x4ee1('0x57')]['length']?_0x5c5862[_0x4ee1('0x57')]:_0x3d6bf4['model'];if(!_0x8aaff9[_0x4ee1('0x54')]['hasOwnProperty'](_0x4ee1('0x59'))){_0x5c5862['limit']=qs[_0x4ee1('0x2b')](_0x8aaff9[_0x4ee1('0x54')][_0x4ee1('0x2b')]);_0x5c5862['offset']=qs[_0x4ee1('0x29')](_0x8aaff9[_0x4ee1('0x54')][_0x4ee1('0x29')]);}_0x5c5862[_0x4ee1('0x5a')]=qs[_0x4ee1('0x5b')](_0x8aaff9[_0x4ee1('0x54')][_0x4ee1('0x5b')]);_0x5c5862['where']=qs['filters'](_[_0x4ee1('0x5c')](_0x8aaff9[_0x4ee1('0x54')],_0x3d6bf4[_0x4ee1('0x5d')]),_0x16dc20);if(_0x8aaff9[_0x4ee1('0x54')][_0x4ee1('0x5e')]){_0x5c5862[_0x4ee1('0x5f')]=_[_0x4ee1('0x60')](_0x5c5862[_0x4ee1('0x5f')],{'$or':_[_0x4ee1('0x4f')](_0x16dc20,function(_0x464136){if(_0x464136[_0x4ee1('0x4c')]!==_0x4ee1('0x61')){var _0x3c2e42={};_0x3c2e42[_0x464136['name']]={'$like':'%'+_0x8aaff9[_0x4ee1('0x54')]['filter']+'%'};return _0x3c2e42;}})});}_0x5c5862=_[_0x4ee1('0x60')]({},_0x5c5862,_0x8aaff9[_0x4ee1('0x62')]);var _0x59bbca={'where':_0x5c5862[_0x4ee1('0x5f')]};return db[_0x4ee1('0x50')]['count'](_0x59bbca)['then'](function(_0x130166){_0x32cc34['count']=_0x130166;if(_0x8aaff9[_0x4ee1('0x54')][_0x4ee1('0x63')]){_0x5c5862['include']=[{'all':!![]}];}return db[_0x4ee1('0x50')][_0x4ee1('0x64')](_0x5c5862);})[_0x4ee1('0x1b')](function(_0x44eb11){_0x32cc34[_0x4ee1('0x65')]=_0x44eb11;return _0x32cc34;})[_0x4ee1('0x1b')](respondWithFilteredResult(_0x183b4a,_0x5c5862))[_0x4ee1('0x25')](handleError(_0x183b4a,null));};exports['show']=function(_0x533a6b,_0x2fd331){var _0x39f7ff={'raw':![],'where':{'id':_0x533a6b[_0x4ee1('0x66')]['id']},'include':[{'model':db[_0x4ee1('0x67')],'as':_0x4ee1('0x4e')}]},_0x5e43b6={};_0x5e43b6['model']=_[_0x4ee1('0x55')](db['ChatWebsite'][_0x4ee1('0x51')]);_0x5e43b6['query']=_['keys'](_0x533a6b[_0x4ee1('0x54')]);_0x5e43b6[_0x4ee1('0x5d')]=_[_0x4ee1('0x56')](_0x5e43b6[_0x4ee1('0x49')],_0x5e43b6[_0x4ee1('0x54')]);_0x39f7ff['attributes']=_[_0x4ee1('0x56')](_0x5e43b6[_0x4ee1('0x49')],qs[_0x4ee1('0x58')](_0x533a6b['query'][_0x4ee1('0x58')]));_0x39f7ff[_0x4ee1('0x57')]=_0x39f7ff[_0x4ee1('0x57')][_0x4ee1('0x68')]?_0x39f7ff[_0x4ee1('0x57')]:_0x5e43b6[_0x4ee1('0x49')];if(_0x533a6b[_0x4ee1('0x54')][_0x4ee1('0x63')]){_0x39f7ff[_0x4ee1('0x69')]=[{'all':!![]}];}_0x39f7ff=_[_0x4ee1('0x60')]({},_0x39f7ff,_0x533a6b[_0x4ee1('0x62')]);return db[_0x4ee1('0x50')]['find'](_0x39f7ff)[_0x4ee1('0x1b')](handleEntityNotFound(_0x2fd331,null))['then'](respondWithResult(_0x2fd331,null))[_0x4ee1('0x25')](handleError(_0x2fd331,null));};exports['create']=function(_0x15834b,_0x473f04){var _0x190527=null;_0x15834b[_0x4ee1('0x6a')][_0x4ee1('0x6b')][_0x4ee1('0x3e')](',')[_0x4ee1('0x6c')](_0x447060=>{if(_0x447060[_0x4ee1('0x6d')]()!==''&&!wildcardUtils[_0x4ee1('0x6e')](_0x447060[_0x4ee1('0x6d')]())){_0x190527=new APIBadRequestError('\x22'+_0x447060[_0x4ee1('0x6d')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x190527){return handleError(_0x473f04,null)(_0x190527);}return db[_0x4ee1('0x50')][_0x4ee1('0x6f')](_0x15834b[_0x4ee1('0x6a')],{})['then'](function(_0x4ba745){var _0x40dac3=_0x15834b[_0x4ee1('0x70')]['get']({'plain':!![]});if(!_0x40dac3)throw new Error(_0x4ee1('0x71'));if(_0x40dac3[_0x4ee1('0x72')]===_0x4ee1('0x70')){var _0x216925=_0x4ba745[_0x4ee1('0x32')]({'plain':!![]});var _0x1e6d5d=_0x4ee1('0x33');return db[_0x4ee1('0x73')][_0x4ee1('0x74')]({'where':{'name':_0x1e6d5d,'userProfileId':_0x40dac3[_0x4ee1('0x75')]},'raw':!![]})['then'](function(_0x219153){if(_0x219153&&_0x219153[_0x4ee1('0x76')]===0x0){return db['UserProfileResource']['create']({'name':_0x216925[_0x4ee1('0x35')],'resourceId':_0x216925['id'],'type':_0x219153[_0x4ee1('0x35')],'sectionId':_0x219153['id']},{})[_0x4ee1('0x1b')](function(){return _0x4ba745;});}else{return _0x4ba745;}})[_0x4ee1('0x25')](function(_0x29a075){logger[_0x4ee1('0x21')](_0x4ee1('0x77'),_0x29a075);throw _0x29a075;});}return _0x4ba745;})['then'](respondWithResult(_0x473f04,0xc9))[_0x4ee1('0x25')](handleError(_0x473f04,null));};exports[_0x4ee1('0x30')]=function(_0x44af66,_0x43a775){var _0x463e55=null;_0x44af66['body'][_0x4ee1('0x6b')]['split'](',')[_0x4ee1('0x6c')](_0x29371c=>{if(_0x29371c['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x29371c[_0x4ee1('0x6d')]())){_0x463e55=new APIBadRequestError('\x22'+_0x29371c[_0x4ee1('0x6d')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x463e55){return handleError(_0x43a775,null)(_0x463e55);}if(_0x44af66[_0x4ee1('0x6a')]['id']){delete _0x44af66['body']['id'];}return db['ChatWebsite'][_0x4ee1('0x74')]({'where':{'id':_0x44af66[_0x4ee1('0x66')]['id']},'include':[{'model':db[_0x4ee1('0x67')],'as':_0x4ee1('0x4e')}]})[_0x4ee1('0x1b')](handleEntityNotFound(_0x43a775,null))[_0x4ee1('0x1b')](saveUpdates(_0x44af66['body'],null))[_0x4ee1('0x1b')](respondWithResult(_0x43a775,null))['catch'](handleError(_0x43a775,null));};exports['destroy']=function(_0x465e06,_0x2c1c65){return db[_0x4ee1('0x50')][_0x4ee1('0x74')]({'where':{'id':_0x465e06[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x2c1c65,null))[_0x4ee1('0x1b')](removeEntity(_0x2c1c65,null))[_0x4ee1('0x25')](handleError(_0x2c1c65,null));};exports['describe']=function(_0x163d45,_0x396f85){return db['ChatWebsite'][_0x4ee1('0x78')]()[_0x4ee1('0x1b')](respondWithResult(_0x396f85,null))[_0x4ee1('0x25')](handleError(_0x396f85,null));};exports[_0x4ee1('0x79')]=function(_0x22778e,_0x4657ee){if(_0x22778e[_0x4ee1('0x6a')]['id']){delete _0x22778e['body']['id'];}return db[_0x4ee1('0x50')]['find']({'where':{'id':_0x22778e[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x4657ee,null))[_0x4ee1('0x1b')](function(_0x35a719){if(_0x35a719){_0x22778e['body'][_0x4ee1('0x7a')]=_0x35a719['id'];return db[_0x4ee1('0x7b')][_0x4ee1('0x6f')](_0x22778e['body']);}})['then'](respondWithResult(_0x4657ee,null))[_0x4ee1('0x25')](handleError(_0x4657ee,null));};exports['getDispositions']=function(_0x3976a6,_0x229bc8){var _0x3f28b2={'raw':![],'where':{}};var _0x5690a9={};var _0x5aa865={'count':0x0,'rows':[]};return db[_0x4ee1('0x50')][_0x4ee1('0x7c')]({'where':{'id':_0x3976a6[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x229bc8,null))[_0x4ee1('0x1b')](function(_0x335c90){if(_0x335c90){_0x5690a9[_0x4ee1('0x49')]=_['keys'](db['Disposition']['rawAttributes']);_0x5690a9[_0x4ee1('0x54')]=_[_0x4ee1('0x55')](_0x3976a6[_0x4ee1('0x54')]);_0x5690a9[_0x4ee1('0x5d')]=_['intersection'](_0x5690a9[_0x4ee1('0x49')],_0x5690a9['query']);_0x3f28b2[_0x4ee1('0x57')]=_[_0x4ee1('0x56')](_0x5690a9[_0x4ee1('0x49')],qs[_0x4ee1('0x58')](_0x3976a6[_0x4ee1('0x54')][_0x4ee1('0x58')]));_0x3f28b2['attributes']=_0x3f28b2[_0x4ee1('0x57')][_0x4ee1('0x68')]?_0x3f28b2[_0x4ee1('0x57')]:_0x5690a9[_0x4ee1('0x49')];if(!_0x3976a6[_0x4ee1('0x54')][_0x4ee1('0x7d')](_0x4ee1('0x59'))){_0x3f28b2[_0x4ee1('0x2b')]=qs[_0x4ee1('0x2b')](_0x3976a6[_0x4ee1('0x54')][_0x4ee1('0x2b')]);_0x3f28b2['offset']=qs[_0x4ee1('0x29')](_0x3976a6[_0x4ee1('0x54')][_0x4ee1('0x29')]);}_0x3f28b2[_0x4ee1('0x5a')]=qs[_0x4ee1('0x5b')](_0x3976a6[_0x4ee1('0x54')][_0x4ee1('0x5b')]);_0x3f28b2[_0x4ee1('0x5f')]=qs[_0x4ee1('0x5d')](_[_0x4ee1('0x5c')](_0x3976a6[_0x4ee1('0x54')],_0x5690a9[_0x4ee1('0x5d')]));_0x3f28b2[_0x4ee1('0x5f')][_0x4ee1('0x7a')]=_0x335c90['id'];if(_0x3976a6[_0x4ee1('0x54')][_0x4ee1('0x5e')]){_0x3f28b2['where']=_[_0x4ee1('0x60')](_0x3f28b2[_0x4ee1('0x5f')],{'$or':_['map'](_0x3f28b2[_0x4ee1('0x57')],function(_0x1435f8){var _0x5eb977={};_0x5eb977[_0x1435f8]={'$like':'%'+_0x3976a6['query'][_0x4ee1('0x5e')]+'%'};return _0x5eb977;})});}_0x3f28b2=_['merge']({},_0x3f28b2,_0x3976a6[_0x4ee1('0x62')]);return db[_0x4ee1('0x7b')]['count']({'where':_0x3f28b2[_0x4ee1('0x5f')]})[_0x4ee1('0x1b')](function(_0x1dfb34){_0x5aa865[_0x4ee1('0x2c')]=_0x1dfb34;if(_0x3976a6['query'][_0x4ee1('0x63')]){_0x3f28b2[_0x4ee1('0x69')]=[{'all':!![]}];}return db[_0x4ee1('0x7b')][_0x4ee1('0x64')](_0x3f28b2);})[_0x4ee1('0x1b')](function(_0x4315e9){_0x5aa865[_0x4ee1('0x65')]=_0x4315e9;return _0x5aa865;});}})[_0x4ee1('0x1b')](respondWithFilteredResult(_0x229bc8,_0x3f28b2))['catch'](handleError(_0x229bc8,null));};exports[_0x4ee1('0x7e')]=function(_0x319fd8,_0x59c975){return db[_0x4ee1('0x50')]['find']({'where':{'id':_0x319fd8['params']['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x59c975,null))[_0x4ee1('0x1b')](function(_0x24a951){if(_0x24a951){return _0x24a951[_0x4ee1('0x7e')](_0x319fd8[_0x4ee1('0x54')][_0x4ee1('0x7f')]);}})['then'](respondWithStatusCode(_0x59c975,null))[_0x4ee1('0x25')](handleError(_0x59c975,null));};exports[_0x4ee1('0x80')]=function(_0x427e48,_0x17ae2d){if(_0x427e48[_0x4ee1('0x6a')]['id']){delete _0x427e48[_0x4ee1('0x6a')]['id'];}return db[_0x4ee1('0x50')][_0x4ee1('0x74')]({'where':{'id':_0x427e48['params']['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x17ae2d,null))[_0x4ee1('0x1b')](function(_0x2704ed){if(_0x2704ed){_0x427e48[_0x4ee1('0x6a')][_0x4ee1('0x7a')]=_0x2704ed['id'];return db['CannedAnswer'][_0x4ee1('0x6f')](_0x427e48['body']);}})[_0x4ee1('0x1b')](respondWithResult(_0x17ae2d,null))[_0x4ee1('0x25')](handleError(_0x17ae2d,null));};exports[_0x4ee1('0x81')]=function(_0x3bcd9b,_0x4977bf){var _0x2f3795={'raw':![],'where':{}};var _0x2eddce={};var _0x48146c={'count':0x0,'rows':[]};return db[_0x4ee1('0x50')]['findOne']({'where':{'id':_0x3bcd9b[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x4977bf,null))['then'](function(_0x5a2c17){if(_0x5a2c17){_0x2eddce[_0x4ee1('0x49')]=_[_0x4ee1('0x55')](db['CannedAnswer']['rawAttributes']);_0x2eddce['query']=_[_0x4ee1('0x55')](_0x3bcd9b['query']);_0x2eddce[_0x4ee1('0x5d')]=_[_0x4ee1('0x56')](_0x2eddce[_0x4ee1('0x49')],_0x2eddce[_0x4ee1('0x54')]);_0x2f3795['attributes']=_[_0x4ee1('0x56')](_0x2eddce[_0x4ee1('0x49')],qs['fields'](_0x3bcd9b[_0x4ee1('0x54')][_0x4ee1('0x58')]));_0x2f3795[_0x4ee1('0x57')]=_0x2f3795['attributes']['length']?_0x2f3795[_0x4ee1('0x57')]:_0x2eddce[_0x4ee1('0x49')];if(!_0x3bcd9b[_0x4ee1('0x54')][_0x4ee1('0x7d')](_0x4ee1('0x59'))){_0x2f3795[_0x4ee1('0x2b')]=qs[_0x4ee1('0x2b')](_0x3bcd9b[_0x4ee1('0x54')][_0x4ee1('0x2b')]);_0x2f3795[_0x4ee1('0x29')]=qs[_0x4ee1('0x29')](_0x3bcd9b[_0x4ee1('0x54')]['offset']);}_0x2f3795[_0x4ee1('0x5a')]=qs[_0x4ee1('0x5b')](_0x3bcd9b[_0x4ee1('0x54')][_0x4ee1('0x5b')]);_0x2f3795[_0x4ee1('0x5f')]=qs[_0x4ee1('0x5d')](_['pick'](_0x3bcd9b[_0x4ee1('0x54')],_0x2eddce['filters']));_0x2f3795[_0x4ee1('0x5f')]['ChatWebsiteId']=_0x5a2c17['id'];if(_0x3bcd9b[_0x4ee1('0x54')][_0x4ee1('0x5e')]){_0x2f3795[_0x4ee1('0x5f')]=_[_0x4ee1('0x60')](_0x2f3795[_0x4ee1('0x5f')],{'$or':_[_0x4ee1('0x4f')](_0x2f3795[_0x4ee1('0x57')],function(_0x323e2d){var _0x40d044={};_0x40d044[_0x323e2d]={'$like':'%'+_0x3bcd9b['query'][_0x4ee1('0x5e')]+'%'};return _0x40d044;})});}_0x2f3795=_[_0x4ee1('0x60')]({},_0x2f3795,_0x3bcd9b['options']);return db[_0x4ee1('0x82')][_0x4ee1('0x2c')]({'where':_0x2f3795[_0x4ee1('0x5f')]})[_0x4ee1('0x1b')](function(_0x3f2546){_0x48146c[_0x4ee1('0x2c')]=_0x3f2546;if(_0x3bcd9b[_0x4ee1('0x54')]['includeAll']){_0x2f3795[_0x4ee1('0x69')]=[{'all':!![]}];}return db[_0x4ee1('0x82')][_0x4ee1('0x64')](_0x2f3795);})['then'](function(_0x414aae){_0x48146c[_0x4ee1('0x65')]=_0x414aae;return _0x48146c;});}})[_0x4ee1('0x1b')](respondWithFilteredResult(_0x4977bf,_0x2f3795))['catch'](handleError(_0x4977bf,null));};exports['removeAnswers']=function(_0x16526e,_0x48d858){return db[_0x4ee1('0x50')][_0x4ee1('0x74')]({'where':{'id':_0x16526e[_0x4ee1('0x66')]['id']}})['then'](handleEntityNotFound(_0x48d858,null))[_0x4ee1('0x1b')](function(_0x44da18){if(_0x44da18){return _0x44da18[_0x4ee1('0x83')](_0x16526e[_0x4ee1('0x54')][_0x4ee1('0x7f')]);}})[_0x4ee1('0x1b')](respondWithStatusCode(_0x48d858,null))[_0x4ee1('0x25')](handleError(_0x48d858,null));};exports[_0x4ee1('0x84')]=function(_0x517ae9,_0x11cd98){_0x517ae9[_0x4ee1('0x6a')][_0x4ee1('0x85')]=_0x517ae9[_0x4ee1('0x86')][_0x4ee1('0x87')];return db[_0x4ee1('0x50')][_0x4ee1('0x74')]({'where':{'id':_0x517ae9['params']['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x11cd98,null))['then'](saveUpdates(_0x517ae9[_0x4ee1('0x6a')],null))['then'](respondWithResult(_0x11cd98,null))[_0x4ee1('0x25')](handleError(_0x11cd98,null));};exports[_0x4ee1('0x88')]=function(_0x3d9f81,_0x111632){_0x3d9f81['body']['agentAvatar']=_0x3d9f81[_0x4ee1('0x86')][_0x4ee1('0x87')];return db['ChatWebsite'][_0x4ee1('0x74')]({'where':{'id':_0x3d9f81[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x111632,null))['then'](saveUpdates(_0x3d9f81[_0x4ee1('0x6a')],null))[_0x4ee1('0x1b')](respondWithResult(_0x111632,null))[_0x4ee1('0x25')](handleError(_0x111632,null));};exports['addCustomerAvatar']=function(_0x153e69,_0x4ec743){_0x153e69[_0x4ee1('0x6a')]['customerAvatar']=_0x153e69[_0x4ee1('0x86')][_0x4ee1('0x87')];return db[_0x4ee1('0x50')][_0x4ee1('0x74')]({'where':{'id':_0x153e69[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x4ec743,null))[_0x4ee1('0x1b')](saveUpdates(_0x153e69['body'],null))[_0x4ee1('0x1b')](respondWithResult(_0x4ec743,null))[_0x4ee1('0x25')](handleError(_0x4ec743,null));};exports[_0x4ee1('0x89')]=function(_0x4301ae,_0x8a9d40){_0x4301ae[_0x4ee1('0x6a')]['systemAvatar']=_0x4301ae[_0x4ee1('0x86')][_0x4ee1('0x87')];return db['ChatWebsite'][_0x4ee1('0x74')]({'where':{'id':_0x4301ae[_0x4ee1('0x66')]['id']}})['then'](handleEntityNotFound(_0x8a9d40,null))[_0x4ee1('0x1b')](saveUpdates(_0x4301ae[_0x4ee1('0x6a')],null))[_0x4ee1('0x1b')](respondWithResult(_0x8a9d40,null))[_0x4ee1('0x25')](handleError(_0x8a9d40,null));};exports[_0x4ee1('0x8a')]=function(_0x3d0b47,_0x2f6412){var _0x7a50e9=path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],_0x4ee1('0x8d'));var _0x4f9079={'where':{'id':_0x3d0b47[_0x4ee1('0x66')]['id']},'attributes':['id',_0x4ee1('0x85')],'raw':!![]};var _0x3bfd9d=![];return require(_0x4ee1('0x8e'))['getLicense']()[_0x4ee1('0x1b')](function(_0x38595b){if(_0x38595b){_0x3bfd9d=_0x38595b[_0x4ee1('0x8f')];}})[_0x4ee1('0x1b')](function(){return db[_0x4ee1('0x50')][_0x4ee1('0x74')](_0x4f9079);})[_0x4ee1('0x1b')](handleEntityNotFound(_0x2f6412,null))[_0x4ee1('0x1b')](function(_0x347de3){if(_0x347de3){if(!_[_0x4ee1('0x90')](_0x347de3['sitepic'])){if(fs[_0x4ee1('0x91')](path['join'](config[_0x4ee1('0x8c')],_0x4ee1('0x92'),_0x347de3[_0x4ee1('0x85')]))&&_0x3bfd9d){_0x7a50e9=path['join'](config[_0x4ee1('0x8c')],_0x4ee1('0x92'),_0x347de3[_0x4ee1('0x85')]);}}return _0x2f6412[_0x4ee1('0x93')](_0x7a50e9);}})[_0x4ee1('0x25')](handleError(_0x2f6412,null));};exports[_0x4ee1('0x94')]=function(_0x3c937f,_0x5d0972){var _0x5e78f5=path[_0x4ee1('0x8b')](config['root'],_0x4ee1('0x95'));var _0xe3020c={'where':{'id':_0x3c937f[_0x4ee1('0x66')]['id']},'attributes':['id',_0x4ee1('0x96')],'raw':!![]};return db[_0x4ee1('0x50')][_0x4ee1('0x74')](_0xe3020c)[_0x4ee1('0x1b')](handleEntityNotFound(_0x5d0972,null))['then'](function(_0x2d3f99){if(_0x2d3f99){if(!_[_0x4ee1('0x90')](_0x2d3f99['agentAvatar'])){if(fs['existsSync'](path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],_0x4ee1('0x97'),_0x2d3f99[_0x4ee1('0x96')]))){_0x5e78f5=path['join'](config[_0x4ee1('0x8c')],_0x4ee1('0x97'),_0x2d3f99[_0x4ee1('0x96')]);}}return _0x5d0972['download'](_0x5e78f5);}})[_0x4ee1('0x25')](handleError(_0x5d0972,null));};exports[_0x4ee1('0x98')]=function(_0x355f76,_0xdc201b){var _0x21acbf=path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],_0x4ee1('0x99'));var _0x427dab={'where':{'id':_0x355f76[_0x4ee1('0x66')]['id']},'attributes':['id',_0x4ee1('0x9a'),_0x4ee1('0x9b')],'raw':!![]};return db['ChatWebsite'][_0x4ee1('0x74')](_0x427dab)[_0x4ee1('0x1b')](handleEntityNotFound(_0xdc201b,null))[_0x4ee1('0x1b')](function(_0x386fcd){if(_0x386fcd){if(!_[_0x4ee1('0x90')](_0x386fcd[_0x4ee1('0x9a')])){if(fs[_0x4ee1('0x91')](path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],_0x4ee1('0x97'),_0x386fcd['customerAvatar']))&&_0x386fcd[_0x4ee1('0x9b')]){_0x21acbf=path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],'server/files/images/avatars/',_0x386fcd[_0x4ee1('0x9a')]);}}return _0xdc201b['download'](_0x21acbf);}})[_0x4ee1('0x25')](handleError(_0xdc201b,null));};exports[_0x4ee1('0x9c')]=function(_0x23a60b,_0x46694f){var _0x1e399e=path[_0x4ee1('0x8b')](config['root'],_0x4ee1('0x9d'));var _0x3c4790={'where':{'id':_0x23a60b['params']['id']},'attributes':['id',_0x4ee1('0x9e')],'raw':!![]};return db[_0x4ee1('0x50')][_0x4ee1('0x74')](_0x3c4790)[_0x4ee1('0x1b')](handleEntityNotFound(_0x46694f,null))[_0x4ee1('0x1b')](function(_0x2ebf0c){if(_0x2ebf0c){if(!_[_0x4ee1('0x90')](_0x2ebf0c[_0x4ee1('0x9e')])){if(fs[_0x4ee1('0x91')](path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],_0x4ee1('0x97'),_0x2ebf0c[_0x4ee1('0x9e')]))){_0x1e399e=path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],_0x4ee1('0x97'),_0x2ebf0c[_0x4ee1('0x9e')]);}}return _0x46694f['download'](_0x1e399e);}})['catch'](handleError(_0x46694f,null));};function checkWebsiteInterval(_0x401071){var _0x6800a8=_0x401071['Interval'];if(!_0x6800a8){return Promise[_0x4ee1('0x9f')](_0x401071);}var _0x46995d=_0x401071[_0x4ee1('0xa0')]||undefined;return _0x6800a8[_0x4ee1('0xa1')](_0x46995d)[_0x4ee1('0x1b')](function(_0x381b0b){if(!_0x381b0b){throw new APIOutOfIntervalError();}return _0x401071;});}exports[_0x4ee1('0xa2')]=function(_0x1921db,_0x35db5f){var _0x5c555d={'body':_0x1921db[_0x4ee1('0x6a')],'channel':_0x4ee1('0xa3')};var _0x241582=[];var _0x1e0872=[];var _0xc7a96={};var _0x259e57=![];if(_0x1921db[_0x4ee1('0x6a')]['id']){delete _0x1921db['body']['id'];}if(_['isNil'](_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xa4')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x4ee1('0x90')](_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xa5')])){throw new APIBadRequestError(_0x4ee1('0xa6'));}if(_['isEmpty'](_0x1921db[_0x4ee1('0x6a')]['body'])){throw new APIBadRequestError(_0x4ee1('0xa7'));}var _0x5e74b2=_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0x3a')]&&_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0x42')];return db[_0x4ee1('0xa8')][_0x4ee1('0x78')]()[_0x4ee1('0x1b')](function(_0x1a0aad){if(!_0x1a0aad){throw new Error(_0x4ee1('0xa9'));}_0x241582=Object[_0x4ee1('0x55')](_0x1a0aad)['filter'](function(_0x639adf){return!['createdAt',_0x4ee1('0xaa')]['includes'](_0x639adf);});_0x1e0872=Object['keys'](_0x1a0aad)[_0x4ee1('0x5e')](function(_0x2ab951){return![_0x4ee1('0xab'),_0x4ee1('0xaa'),_0x4ee1('0xac'),_0x4ee1('0xad')][_0x4ee1('0xae')](_0x2ab951);});if(!_[_0x4ee1('0xae')](_0x1e0872,_0x1921db[_0x4ee1('0x6a')]['mapKey'])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x1e0872[_0x4ee1('0x8b')](',\x20'));}_0xc7a96[_0x1921db['body'][_0x4ee1('0xa5')]]=_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xa4')];})[_0x4ee1('0x1b')](function(){return db[_0x4ee1('0x50')][_0x4ee1('0x74')]({'where':{'id':_0x1921db[_0x4ee1('0x66')]['id']},'include':[{'model':db[_0x4ee1('0xaf')],'as':_0x4ee1('0xb0'),'include':[{'model':db[_0x4ee1('0xa8')],'as':_0x4ee1('0xb1'),'where':_0xc7a96,'limit':0x1,'order':[[_0x4ee1('0xaa'),_0x4ee1('0xb2')]]}]},{'model':db[_0x4ee1('0xb3')],'as':_0x4ee1('0xb4')},{'model':db['Interval'],'as':_0x4ee1('0xb5'),'include':[{'model':db[_0x4ee1('0xb5')],'as':'Intervals','attributes':['id',_0x4ee1('0xb6')],'raw':!![]}]}]});})[_0x4ee1('0x1b')](function(_0x57cfbc){if(!_0x57cfbc){throw new APINotFoundError(util[_0x4ee1('0x45')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x1921db[_0x4ee1('0x66')]['id']));}if(_0x5e74b2){return checkWebsiteInterval(_0x57cfbc);}return _0x57cfbc;})[_0x4ee1('0x1b')](function(_0x4cdf88){_0x5c555d[_0x4ee1('0xb7')]=_0x4cdf88;_0x5c555d[_0x4ee1('0xb8')]=_['orderBy'](_0x4cdf88['Applications'],[_0x4ee1('0xb9')],['asc']);if(_0x5c555d[_0x4ee1('0xb7')][_0x4ee1('0xb4')]){delete _0x5c555d[_0x4ee1('0xb7')][_0x4ee1('0xb4')];}_0x5c555d['list']=_0x4cdf88[_0x4ee1('0xb0')]||{'id':_0x4cdf88['ListId']};if(_0x5c555d[_0x4ee1('0xba')]&&_0x5c555d[_0x4ee1('0xba')][_0x4ee1('0xb1')]['length']){return _0x5c555d[_0x4ee1('0xba')][_0x4ee1('0xb1')][0x0];}var _0x2f70be=_[_0x4ee1('0x13')](_0x1921db[_0x4ee1('0x6a')],{'firstName':_0x1921db[_0x4ee1('0x6a')]['from'],'ListId':_0x4cdf88[_0x4ee1('0xad')]});_0x2f70be[_0x1921db[_0x4ee1('0x6a')]['mapKey']]=_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xa4')];return db['CmContact'][_0x4ee1('0x6f')](_0x2f70be,{'fields':_0x241582,'raw':!![]});})[_0x4ee1('0x1b')](function(_0x5eaaee){_0x5c555d[_0x4ee1('0xbb')]=_0x5eaaee;var _0x52634b=createInteractionObject(_0x1921db[_0x4ee1('0x66')]['id'],_0x1921db['body'],_0x1921db[_0x4ee1('0xbc')],_0x5eaaee);var _0x4824fc={'ChatWebsiteId':_0x1921db['params']['id']};if(_0x1921db['body']['threadId']){_0x4824fc[_0x4ee1('0xbd')]=_0x1921db['body'][_0x4ee1('0xbd')];_0x4824fc[_0x4ee1('0xbe')]=![];return db[_0x4ee1('0xbf')][_0x4ee1('0x74')]({'where':_0x4824fc})[_0x4ee1('0x1b')](function(_0x395220){var _0x11110d=_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0x3a')]&&_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0x42')];if(_0x395220){_0x259e57=!![];return _0x395220;}else if(!_0x11110d&&_0x395220&&_0x395220[_0x4ee1('0xbe')]){throw new APIConflictError(_0x4ee1('0xc0'));}_0x52634b[_0x4ee1('0xbd')]=_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xbd')];_0x52634b[_0x4ee1('0xc1')]=_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xc1')];return db[_0x4ee1('0xbf')][_0x4ee1('0x6f')](_0x52634b);});}_0x4824fc[_0x4ee1('0xc2')]=_0x5eaaee['id'];if(_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xc3')]&&_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xc3')]['id']){_0x4824fc['id']=_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xc3')]['id'];return db[_0x4ee1('0xbf')][_0x4ee1('0x74')]({'where':_0x4824fc})['then'](function(_0x5424a3){var _0x583eff=_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0x3a')]&&_0x1921db[_0x4ee1('0x6a')]['referer'];if(!_0x583eff&&_0x5424a3&&_0x5424a3[_0x4ee1('0xbe')]){throw new APIConflictError(_0x4ee1('0xc0'));}else if(_0x5424a3){_0x259e57=!![];return _0x5424a3;}else{return db[_0x4ee1('0xbf')][_0x4ee1('0x6f')](_0x52634b);}});}return db[_0x4ee1('0xbf')][_0x4ee1('0x6f')](_0x52634b);})[_0x4ee1('0x1b')](function(_0x3169ad){if(!_0x259e57){return _0x3169ad;}var _0x453b3f={'from':(_0x5c555d[_0x4ee1('0xbb')]['firstName']||'')+'\x20'+(_0x5c555d[_0x4ee1('0xbb')][_0x4ee1('0x40')]||'')};if(_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xbd')]&&_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xc4')]&&_0x1921db['body'][_0x4ee1('0xbd')]!=_0x1921db['body'][_0x4ee1('0xc4')]){_0x453b3f[_0x4ee1('0xbd')]=_0x1921db[_0x4ee1('0x6a')][_0x4ee1('0xc4')];}return _0x3169ad[_0x4ee1('0x30')](_0x453b3f);})['then'](function(_0x2eb073){_0x5c555d[_0x4ee1('0xc3')]=_0x2eb073[_0x4ee1('0x32')]({'plain':!![]});_0x5c555d[_0x4ee1('0xc3')][_0x4ee1('0xc5')]=!_0x259e57;if(_0x5c555d[_0x4ee1('0xc3')]['created']){if(_0x5c555d[_0x4ee1('0xb7')]['autoclose']){_0x5c555d[_0x4ee1('0xb8')][_0x4ee1('0xc6')]({'id':0x0,'priority':_0x5c555d['applications']['length']+0x1,'app':'close','appdata':_0x4ee1('0xc7'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x4ee1('0x6f')]({'body':_0x1921db[_0x4ee1('0x6a')]['body'],'ChatWebsiteId':_0x1921db[_0x4ee1('0x66')]['id'],'ChatInteractionId':_0x2eb073['id'],'direction':'in','ContactId':_0x5c555d[_0x4ee1('0xbb')]['id'],'AttachmentId':_0x1921db[_0x4ee1('0x6a')]['AttachmentId']});})[_0x4ee1('0x1b')](function(_0x37b6c0){_0x5c555d[_0x4ee1('0x23')]=_0x37b6c0;if(!_0x5c555d[_0x4ee1('0xc3')][_0x4ee1('0xc8')]){return;}return db[_0x4ee1('0xc9')][_0x4ee1('0x74')]({'attributes':['id','name'],'where':{'id':_0x5c555d[_0x4ee1('0xc3')][_0x4ee1('0xc8')]}});})['then'](function(_0x4f7067){if(_0x4f7067){_0x5c555d['applications'][_0x4ee1('0xca')]({'id':0x0,'priority':0x0,'app':_0x4ee1('0xcb'),'appdata':_0x4f7067[_0x4ee1('0x35')]+','+(_0x5c555d['account']['waitForTheAssignedAgent']||0xa),'interval':_0x4ee1('0xcc')});_0x5c555d['forcedOwnership']=!![];}if(!_0x5c555d[_0x4ee1('0xc3')][_0x4ee1('0xcd')]){return;}return db[_0x4ee1('0xce')]['find']({'attributes':['id',_0x4ee1('0x35')],'where':{'id':_0x5c555d[_0x4ee1('0xc3')]['queueId']}});})[_0x4ee1('0x1b')](function(_0x956035){if(_0x956035){_0x5c555d[_0x4ee1('0xb8')][_0x4ee1('0xca')]({'id':0x0,'priority':0x1,'app':_0x4ee1('0xcf'),'appdata':_0x956035[_0x4ee1('0x35')]+','+(_0x5c555d[_0x4ee1('0xb7')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4ee1('0xd0'),'startRouting',_0x5c555d);})[_0x4ee1('0x1b')](function(_0xbc69d3){respondWithRpcPromise(_0x4ee1('0xd1'),'EventManager',{'event':_0x4ee1('0xa2'),'message':_0xbc69d3},client9002);return _0xbc69d3;})[_0x4ee1('0x1b')](respondWithResult(_0x35db5f,null))[_0x4ee1('0x25')](APIHandleError(_0x35db5f));};exports[_0x4ee1('0xd2')]=function(_0xd08dc9,_0x4f258f){var _0x341e69,_0x527525,_0xf634c4;var _0x393fae=[];var _0x4b63a8={};var _0x26a657=_0xd08dc9[_0x4ee1('0xd3')]||[];var _0x2660b2=[];var _0x193cc6;return db['CmContact'][_0x4ee1('0x78')]()[_0x4ee1('0x1b')](function(_0x5bee69){if(!_0x5bee69){throw new db['Sequelize'][(_0x4ee1('0xd4'))](_0x4ee1('0xd5'));}_0x393fae=_[_0x4ee1('0xd6')](_[_0x4ee1('0x55')](_0x5bee69),[_0x4ee1('0xab'),_0x4ee1('0xaa'),_0x4ee1('0xac'),_0x4ee1('0xad')]);if(_0xd08dc9[_0x4ee1('0x6a')]['id']){delete _0xd08dc9['body']['id'];}if(_['isNil'](_0xd08dc9[_0x4ee1('0x6a')][_0x4ee1('0xa4')])){throw _0x4f258f[_0x4ee1('0x27')](0x1f4)[_0x4ee1('0x36')](new db[(_0x4ee1('0xd7'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x4ee1('0x90')](_0xd08dc9[_0x4ee1('0x6a')][_0x4ee1('0x6a')])||_0xd08dc9[_0x4ee1('0x6a')][_0x4ee1('0x6a')]===''){throw _0x4f258f[_0x4ee1('0x27')](0x1f4)[_0x4ee1('0x36')](new db[(_0x4ee1('0xd7'))]['ValidationError'](_0x4ee1('0xd8')));}if(_[_0x4ee1('0x90')](_0xd08dc9[_0x4ee1('0x6a')][_0x4ee1('0xd9')])){throw _0x4f258f['status'](0x1f4)[_0x4ee1('0x36')](new db[(_0x4ee1('0xd7'))][(_0x4ee1('0xd4'))](_0x4ee1('0xda')+_0x393fae));}if(!_['includes'](_0x393fae,_0xd08dc9[_0x4ee1('0x6a')][_0x4ee1('0xd9')])){throw _0x4f258f['status'](0x1f4)[_0x4ee1('0x36')](new db['Sequelize']['ValidationError'](_0x4ee1('0xdb')+_0x393fae));}_0x4b63a8[_0xd08dc9['body'][_0x4ee1('0xd9')]]=_0xd08dc9[_0x4ee1('0x6a')][_0x4ee1('0xa4')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0xd08dc9[_0x4ee1('0x66')]['id']},'include':[{'model':db[_0x4ee1('0xaf')],'as':_0x4ee1('0xb0')},{'model':db[_0x4ee1('0xdc')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x4f258f,null))[_0x4ee1('0x1b')](function(_0x22a8ed){if(_0x22a8ed&&_0x22a8ed[_0x4ee1('0xb0')]){_0x527525=_0x22a8ed;var _0x4a2cd2=_[_0x4ee1('0x13')](_0xd08dc9[_0x4ee1('0x6a')],{'firstName':_0xd08dc9[_0x4ee1('0x6a')][_0x4ee1('0xa4')],'phone':_0xd08dc9[_0x4ee1('0x6a')][_0x4ee1('0xa4')],'ListId':_0x22a8ed[_0x4ee1('0xad')]});_0x4a2cd2[_0xd08dc9[_0x4ee1('0x6a')][_0x4ee1('0xd9')]]=_0xd08dc9['body'][_0x4ee1('0xa4')];return db['CmContact'][_0x4ee1('0xdd')]({'where':_0x4b63a8,'defaults':_0x4a2cd2});}})['spread'](function(_0x11d28e){if(_0x11d28e){_0xf634c4=_0x11d28e;var _0x383cd5=fs[_0x4ee1('0xde')](path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],_0x4ee1('0xdf')),_0x4ee1('0xe0'));var _0x284743=ejs[_0x4ee1('0xe1')](_0x383cd5,{'body':_[_0x4ee1('0xe2')](_0xd08dc9[_0x4ee1('0x6a')][_0x4ee1('0x6a')]),'bodyTitle':_0x527525[_0x4ee1('0xe3')]});return db['ChatOfflineMessage']['create']({'body':_0x284743,'plainBody':htmlToText['fromString'](_0x284743),'ContactId':_0x11d28e['id'],'ChatWebsiteId':_0x527525['id']});}})[_0x4ee1('0x1b')](function(_0x1a1772){_0x193cc6=_0x1a1772;if(_0x26a657[_0x4ee1('0x68')]){var _0x3cc8f5=_0x26a657[_0x4ee1('0x4f')](function(_0x1e8038){return{'name':_0x1e8038[_0x4ee1('0xe4')],'basename':_0x1e8038['filename'],'type':_0x1e8038[_0x4ee1('0xe5')],'ChatOfflineMessageId':_0x1a1772['id']};});_0x2660b2=_0x3cc8f5['map'](_0x2d7c22=>{var _0x6c7209={'filename':_0x2d7c22[_0x4ee1('0x35')],'path':path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],'server',_0x4ee1('0xd3'),'attachments',_0x4ee1('0xe6'),_0x2d7c22[_0x4ee1('0xe7')])};return _0x6c7209;});if(!_0x527525['openNewInteraction']){return db[_0x4ee1('0xe8')][_0x4ee1('0xe9')](function(_0x19bee2){return db[_0x4ee1('0xea')][_0x4ee1('0xeb')](_0x3cc8f5,{'transaction':_0x19bee2});});}}})[_0x4ee1('0x1b')](function(){if(_0x193cc6){_0x341e69=_0x193cc6;return db['MailAccount'][_0x4ee1('0x7c')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x4ee1('0xec'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0x4ee1('0x1b')](function(_0x208fb9){if(_0x208fb9&&_0x208fb9['Smtp']&&_0x527525[_0x4ee1('0xed')]&&_0x527525['forwardOfflineAddress']){var _0x561bf2=_0x208fb9[_0x4ee1('0xee')]();return respondWithRpcPromise(_0x4ee1('0xef'),_0x4ee1('0xf0'),{'account':_0x561bf2,'message':{'from':util[_0x4ee1('0x45')](_0x4ee1('0xf1'),_0x208fb9[_0x4ee1('0x35')],_0x208fb9[_0x4ee1('0xf2')]||_0x208fb9[_0x4ee1('0xec')][_0x4ee1('0x70')]),'to':_0x527525[_0x4ee1('0xf3')],'subject':_0x527525[_0x4ee1('0xf4')],'html':_0x341e69[_0x4ee1('0x6a')],'attachments':_0x2660b2}},client9003)[_0x4ee1('0x1b')](function(){return _0x341e69;})[_0x4ee1('0x25')](function(_0x4728be){logger[_0x4ee1('0x21')](_0x4728be);});}})[_0x4ee1('0x1b')](function(){if(_0x527525&&_0x527525[_0x4ee1('0xf5')]&&_0x527525[_0x4ee1('0xf6')]){var _0xc6fa7f=[];if(_0x26a657['length']){_0xc6fa7f=_0x26a657['map'](function(_0x7d6d5e){return{'name':_0x7d6d5e[_0x4ee1('0xe4')],'basename':_0x7d6d5e[_0x4ee1('0x87')],'type':_0x7d6d5e[_0x4ee1('0xe5')],'ChatOfflineMessageId':_0x193cc6['id']};});}var _0x3812d1;if(!_['isNil'](_0x527525[_0x4ee1('0xf7')])){var _0x25f728=_[_0x4ee1('0x4f')](_0xd08dc9[_0x4ee1('0x6a')],function(_0x135cff){return _0x135cff;});var _0x5b9cc6=_['toPairsIn'](_0x25f728)[0x0];var _0x2640cb=_[_0x4ee1('0xf8')](_0x5b9cc6,function(_0x120951){return _0x120951;});_0x3812d1=_0x2640cb[0x1][_0x527525[_0x4ee1('0xf7')]];}var _0x1ecf31={'from':_0xf634c4[_0x4ee1('0xf2')],'firstName':_0xf634c4[_0x4ee1('0x3f')],'lastName':_0xf634c4['lastName'],'mapKey':_0x4ee1('0xf2'),'message':{'from':_0xf634c4['email'],'to':_0x527525[_0x4ee1('0xdc')]['email'],'cc':'','subject':_['isNil'](_0x3812d1)?_0x527525[_0x4ee1('0xf4')]:_0x3812d1,'messageId':'','sentAt':new Date(),'attach':_0xc6fa7f['length'],'attachments':_0xc6fa7f,'originChannel':_0x4ee1('0xf9'),'ChatWebsiteId':_0x527525['id'],'ChatOfflineMessageId':_0x341e69['id'],'originTo':_0x527525[_0x4ee1('0xdc')][_0x4ee1('0xf2')]},'body':_0x341e69['body']};var _0x2f57b8={'account':{'id':_0x527525[_0x4ee1('0xf6')]},'body':_0x1ecf31,'log':_0x4ee1('0xfa')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x2f57b8,client9001)[_0x4ee1('0x1b')](function(){return _0x341e69;})[_0x4ee1('0x25')](function(_0x2238c6){logger['error'](_0x2238c6);});}return;})[_0x4ee1('0x1b')](function(){if(_0x341e69){return _0x341e69;}})[_0x4ee1('0x1b')](respondWithResult(_0x4f258f,null))[_0x4ee1('0x25')](function(){for(var _0xe67279 of _0x26a657){var _0x3d6f0e=path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],_0x4ee1('0xfb'),_0x4ee1('0xd3'),_0x4ee1('0xfc'),'offline-chat',_0xe67279[_0x4ee1('0x87')]);fs_extra[_0x4ee1('0xfd')](_0x3d6f0e)[_0x4ee1('0x25')](function(_0x55fde2){logger[_0x4ee1('0x21')](_0x4ee1('0xfe'),_0x3d6f0e,_0x55fde2);});}});};exports[_0x4ee1('0xff')]=function(_0x4e598c,_0x20e099){return db['ChatInteraction'][_0x4ee1('0x74')]({'where':{'id':_0x4e598c[_0x4ee1('0x66')]['id']}})['then'](handleEntityNotFound(_0x20e099,null))['then'](function(_0x3b35d8){if(_0x3b35d8){return _0x3b35d8['addInteraction'](_0x4e598c[_0x4ee1('0x6a')][_0x4ee1('0x7f')],_[_0x4ee1('0x100')](_0x4e598c[_0x4ee1('0x6a')],[_0x4ee1('0x7f'),'id'])||{});}})[_0x4ee1('0x1b')](respondWithResult(_0x20e099,null))[_0x4ee1('0x25')](handleError(_0x20e099,null));};exports[_0x4ee1('0x101')]=function(_0xb62797,_0x265d1c){var _0x5deff2={'raw':![],'where':{}};var _0x19857a={};var _0x505fd7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4ee1('0x7c')]({'where':{'id':_0xb62797[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x265d1c,null))[_0x4ee1('0x1b')](function(_0x5ebd39){if(_0x5ebd39){_0x19857a['model']=_['keys'](db[_0x4ee1('0xbf')]['rawAttributes']);_0x19857a['query']=_[_0x4ee1('0x55')](_0xb62797[_0x4ee1('0x54')]);_0x19857a[_0x4ee1('0x5d')]=_[_0x4ee1('0x56')](_0x19857a['model'],_0x19857a[_0x4ee1('0x54')]);_0x5deff2['attributes']=_['intersection'](_0x19857a[_0x4ee1('0x49')],qs['fields'](_0xb62797['query'][_0x4ee1('0x58')]));_0x5deff2[_0x4ee1('0x57')]=_0x5deff2[_0x4ee1('0x57')][_0x4ee1('0x68')]?_0x5deff2[_0x4ee1('0x57')]:_0x19857a[_0x4ee1('0x49')];if(!_0xb62797[_0x4ee1('0x54')][_0x4ee1('0x7d')]('nolimit')){_0x5deff2[_0x4ee1('0x2b')]=qs['limit'](_0xb62797[_0x4ee1('0x54')][_0x4ee1('0x2b')]);_0x5deff2[_0x4ee1('0x29')]=qs[_0x4ee1('0x29')](_0xb62797[_0x4ee1('0x54')][_0x4ee1('0x29')]);}_0x5deff2[_0x4ee1('0x5a')]=qs[_0x4ee1('0x5b')](_0xb62797[_0x4ee1('0x54')][_0x4ee1('0x5b')]);_0x5deff2[_0x4ee1('0x5f')]=qs[_0x4ee1('0x5d')](_[_0x4ee1('0x5c')](_0xb62797[_0x4ee1('0x54')],_0x19857a['filters']));_0x5deff2[_0x4ee1('0x5f')][_0x4ee1('0x7a')]=_0x5ebd39['id'];if(_0xb62797['query'][_0x4ee1('0x5e')]){_0x5deff2[_0x4ee1('0x5f')]=_[_0x4ee1('0x60')](_0x5deff2[_0x4ee1('0x5f')],{'$or':_[_0x4ee1('0x4f')](_0x5deff2[_0x4ee1('0x57')],function(_0x20cd92){var _0x1185ca={};_0x1185ca[_0x20cd92]={'$like':'%'+_0xb62797[_0x4ee1('0x54')]['filter']+'%'};return _0x1185ca;})});}_0x5deff2=_[_0x4ee1('0x60')]({},_0x5deff2,_0xb62797[_0x4ee1('0x62')]);return db[_0x4ee1('0xbf')]['count']({'where':_0x5deff2[_0x4ee1('0x5f')]})[_0x4ee1('0x1b')](function(_0x355aae){_0x505fd7[_0x4ee1('0x2c')]=_0x355aae;if(_0xb62797[_0x4ee1('0x54')][_0x4ee1('0x63')]){_0x5deff2[_0x4ee1('0x69')]=[{'model':db['CmContact'],'as':_0x4ee1('0x102'),'required':![]},{'model':db[_0x4ee1('0xc9')],'as':_0x4ee1('0x103'),'attributes':[_0x4ee1('0x35'),_0x4ee1('0x104'),_0x4ee1('0x105')],'required':![]},{'model':db[_0x4ee1('0x106')],'as':'Tags','attributes':['id',_0x4ee1('0x35'),'color'],'where':_0xb62797['query']['tag']?{'id':_0xb62797[_0x4ee1('0x54')]['tag']}:undefined,'required':_0xb62797[_0x4ee1('0x54')]['tag']?!![]:![]}];}return db[_0x4ee1('0xbf')]['findAll'](_0x5deff2);})['then'](function(_0x128f36){_0x505fd7[_0x4ee1('0x65')]=_0x128f36;return _0x505fd7;});}})[_0x4ee1('0x1b')](respondWithFilteredResult(_0x265d1c,_0x5deff2))[_0x4ee1('0x25')](handleError(_0x265d1c,null));};exports['getSnippet']=function(_0x573cc2,_0x533d05){var _0x3abec4=0x0;var _0x2b0075=0x0;var _0x3adc79=![];var _0x2654b6;var _0x3a538f;return db['ChatWebsite'][_0x4ee1('0x74')]({'where':{'id':_0x573cc2['params']['id']},'include':[{'model':db[_0x4ee1('0xb5')],'as':_0x4ee1('0xb5'),'include':[{'model':db['Interval'],'as':_0x4ee1('0x107'),'attributes':['id',_0x4ee1('0xb6')]}]}]})[_0x4ee1('0x1b')](handleEntityNotFound(_0x533d05,null))[_0x4ee1('0x1b')](function(_0xe56709){if(_0xe56709){_0x2654b6=_0xe56709;return _0xe56709[_0x4ee1('0x108')]({'raw':!![]});}})['then'](function(_0x531a6b){if(_0x2654b6){if(_0x531a6b){_0x3a538f=_0x531a6b;}}return require('../../config/license/util')[_0x4ee1('0x109')]();})[_0x4ee1('0x1b')](function(_0x5771b1){if(_0x5771b1){_0x2b0075=_0x5771b1['virtual'];_0x3adc79=_0x5771b1[_0x4ee1('0x8f')];}})[_0x4ee1('0x1b')](function(){return db[_0x4ee1('0xbf')][_0x4ee1('0x2c')]({'where':{'closed':![]}});})['then'](function(_0x25f00e){_0x3abec4=_0x25f00e;if(_0x2b0075&&_0x25f00e>_0x2b0075){return db[_0x4ee1('0x10a')][_0x4ee1('0x7c')]({'where':{'id':0x1}})[_0x4ee1('0x1b')](function(_0xe52d37){if(_0xe52d37){_0xe52d37[_0x4ee1('0x10b')](_0x4ee1('0x10c'));}});}})[_0x4ee1('0x1b')](function(){var _0x3d4370=_0x2654b6[_0x4ee1('0xb5')];var _0x52f9f6=_0x2654b6['timezone']||undefined;return _0x3d4370?_0x3d4370[_0x4ee1('0xa1')](_0x52f9f6):!![];})[_0x4ee1('0x1b')](function(_0x2798bc){var _0x45badb=fs['readFileSync'](path[_0x4ee1('0x8b')](config[_0x4ee1('0x8c')],_0x4ee1('0x10d')),'utf8');var _0x303605=_0x4ee1('0x10e');var _0x40419d=![];var _0x4d7d01,_0x53aa81;if(_0x573cc2[_0x4ee1('0xbc')]['referer']){_0x4d7d01=new URL(_0x573cc2[_0x4ee1('0xbc')][_0x4ee1('0x42')])['origin'];}else if(_0x573cc2[_0x4ee1('0xbc')][_0x4ee1('0x10f')]){_0x4d7d01=new URL(_0x573cc2[_0x4ee1('0xbc')]['origin'])['origin'];}else{_0x4d7d01=_0x4ee1('0x110');}_0x53aa81=typeof _0x2654b6[_0x4ee1('0x6b')][_0x4ee1('0x3e')](',')[_0x4ee1('0x74')](function(_0x2a5b6d){return wildcardUtils[_0x4ee1('0x111')](_0x2a5b6d,_0x4d7d01);})!==_0x4ee1('0x2a');var _0x455774={'chatVersion':_0x303605,'chatWebsiteAddressOrigin':_0x53aa81?_0x4d7d01:_0x2654b6[_0x4ee1('0x6b')],'remote':_0x2654b6[_0x4ee1('0x112')],'query':querystring[_0x4ee1('0x20')](_[_0x4ee1('0x60')](_0x2654b6[_0x4ee1('0x32')]({'plain':!![]}),{'customerIp':_0x573cc2['headers'][_0x4ee1('0x3c')]||_0x573cc2[_0x4ee1('0xbc')][_0x4ee1('0x113')]||_0x573cc2[_0x4ee1('0x114')][_0x4ee1('0x115')]||_0x573cc2['ip'],'referer':_0x573cc2['headers'][_0x4ee1('0x42')],'openedInteractions':_0x3abec4,'maxInteractions':_0x2b0075,'virtual':_0x3adc79['virtual'],'online':_0x2798bc,'custom':_0x3adc79,'address':_0x53aa81?_0x4d7d01:null}))[_0x4ee1('0x116')](/'/g,'\x5c\x27')};_0x533d05[_0x4ee1('0x36')](ejs['render'](Mustache[_0x4ee1('0xe1')](_0x45badb,_0x455774),{'proactiveActions':_0x3a538f,'alignment':_0x2654b6[_0x4ee1('0x117')],'verticalAlignment':_0x2654b6['verticalAlignment'],'div_color':_0x2654b6[_0x4ee1('0x118')],'labelText':_0x2654b6[_0x4ee1('0x119')],'text_color':_0x2654b6[_0x4ee1('0x11a')],'text_button_color':_0x2654b6[_0x4ee1('0x11b')],'button_color':_0x2654b6[_0x4ee1('0x11c')],'background_color':_0x2654b6[_0x4ee1('0x11d')],'hideWhenOffline':_0x2654b6[_0x4ee1('0x11e')],'intervalId':_0x2654b6[_0x4ee1('0x11f')],'isDevelopment':_0x40419d,'chatVersion':_0x303605}));})[_0x4ee1('0x25')](handleError(_0x533d05,null));};exports[_0x4ee1('0x120')]=function(_0x1e1dd7,_0x5585a7){var _0x1dd24a=_0x1e1dd7[_0x4ee1('0x66')]['id'];var _0x3f2307=_0x1e1dd7[_0x4ee1('0x6a')];var _0x4e59ce=0xc8;var _0x47b557=null;return db[_0x4ee1('0xe8')][_0x4ee1('0xe9')]({'isolationLevel':db[_0x4ee1('0xe8')]['Transaction'][_0x4ee1('0x121')][_0x4ee1('0x122')]},function(_0x43baf4){return db['ChatWebsite'][_0x4ee1('0x7c')]({'where':{'id':_0x1dd24a},'transaction':_0x43baf4})[_0x4ee1('0x1b')](function(_0x299872){if(_0x299872){return db[_0x4ee1('0xb3')][_0x4ee1('0x31')]({'where':{'ChatWebsiteId':_0x1dd24a},'transaction':_0x43baf4})[_0x4ee1('0x1b')](function(){var _0x473044=_['map'](_0x3f2307,function(_0x2e9fbc){_0x2e9fbc['ChatWebsiteId']=_0x1dd24a;return _0x2e9fbc;});return db['ChatApplication'][_0x4ee1('0xeb')](_0x473044,{'transaction':_0x43baf4});});}else{_0x4e59ce=0x194;_0x47b557=[];}});})[_0x4ee1('0x1b')](function(){if(_0x4e59ce!==0x194){return db[_0x4ee1('0xb3')][_0x4ee1('0x123')]({'where':{'ChatWebsiteId':_0x1dd24a},'order':'priority'})[_0x4ee1('0x1b')](function(_0x9d4b85){_0x47b557=_0x9d4b85;});}})[_0x4ee1('0x25')](function(_0x209ba3){_0x4e59ce=0x1f4;logger[_0x4ee1('0x21')](_0x209ba3['stack']);if(_0x209ba3['name']){delete _0x209ba3[_0x4ee1('0x35')];}_0x47b557=_0x209ba3;})['finally'](function(){if(_0x47b557===null){_0x5585a7[_0x4ee1('0x26')](_0x4e59ce);}else{if(_0x4e59ce===0x1f4){_0x5585a7['status'](_0x4e59ce)[_0x4ee1('0x36')](_0x47b557);}else{_0x5585a7[_0x4ee1('0x27')](_0x4e59ce)[_0x4ee1('0x2f')](_0x47b557);}}});};exports[_0x4ee1('0x124')]=function(_0x25ac7b,_0x99b63c){var _0x531dca={};var _0x25bf05={};var _0x575ef2;var _0xeec531;return db[_0x4ee1('0x50')][_0x4ee1('0x7c')]({'where':{'id':_0x25ac7b[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x99b63c,null))[_0x4ee1('0x1b')](function(_0x467786){if(_0x467786){_0x575ef2=_0x467786;_0x25bf05['model']=_[_0x4ee1('0x55')](db[_0x4ee1('0xb3')][_0x4ee1('0x51')]);_0x25bf05['query']=_[_0x4ee1('0x55')](_0x25ac7b[_0x4ee1('0x54')]);_0x25bf05[_0x4ee1('0x5d')]=_[_0x4ee1('0x56')](_0x25bf05['model'],_0x25bf05[_0x4ee1('0x54')]);_0x531dca[_0x4ee1('0x57')]=_[_0x4ee1('0x56')](_0x25bf05[_0x4ee1('0x49')],qs[_0x4ee1('0x58')](_0x25ac7b['query'][_0x4ee1('0x58')]));_0x531dca['attributes']=_0x531dca[_0x4ee1('0x57')][_0x4ee1('0x68')]?_0x531dca[_0x4ee1('0x57')]:_0x25bf05[_0x4ee1('0x49')];_0x531dca[_0x4ee1('0x5a')]=qs[_0x4ee1('0x5b')](_0x25ac7b[_0x4ee1('0x54')][_0x4ee1('0x5b')]);_0x531dca[_0x4ee1('0x5f')]=qs['filters'](_[_0x4ee1('0x5c')](_0x25ac7b[_0x4ee1('0x54')],_0x25bf05[_0x4ee1('0x5d')]));if(_0x25ac7b[_0x4ee1('0x54')]['filter']){_0x531dca[_0x4ee1('0x5f')]=_[_0x4ee1('0x60')](_0x531dca[_0x4ee1('0x5f')],{'$or':_['map'](_0x531dca['attributes'],function(_0x16a2d2){var _0x48bfd6={};_0x48bfd6[_0x16a2d2]={'$like':'%'+_0x25ac7b[_0x4ee1('0x54')][_0x4ee1('0x5e')]+'%'};return _0x48bfd6;})});}_0x531dca=_[_0x4ee1('0x60')]({},_0x531dca,_0x25ac7b[_0x4ee1('0x62')]);return _0x575ef2[_0x4ee1('0x124')](_0x531dca);}})[_0x4ee1('0x1b')](function(_0x1cc229){if(_0x1cc229){_0xeec531=_0x1cc229[_0x4ee1('0x68')];if(!_0x25ac7b['query']['hasOwnProperty'](_0x4ee1('0x59'))){_0x531dca[_0x4ee1('0x2b')]=qs[_0x4ee1('0x2b')](_0x25ac7b[_0x4ee1('0x54')][_0x4ee1('0x2b')]);_0x531dca['offset']=qs[_0x4ee1('0x29')](_0x25ac7b[_0x4ee1('0x54')][_0x4ee1('0x29')]);}return _0x575ef2[_0x4ee1('0x124')](_0x531dca);}})[_0x4ee1('0x1b')](function(_0x11f348){if(_0x11f348){return _0x11f348?{'count':_0xeec531,'rows':_0x11f348}:null;}})[_0x4ee1('0x1b')](respondWithResult(_0x99b63c,null))[_0x4ee1('0x25')](handleError(_0x99b63c,null));};exports[_0x4ee1('0x125')]=function(_0x5cef8d,_0x452961){return db[_0x4ee1('0x126')][_0x4ee1('0x74')]({'where':{'id':_0x5cef8d['params']['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x452961,null))['then'](function(_0x30afa6){if(_0x30afa6){return _0x30afa6[_0x4ee1('0x125')](_0x5cef8d[_0x4ee1('0x6a')][_0x4ee1('0x7f')],_['omit'](_0x5cef8d[_0x4ee1('0x6a')],[_0x4ee1('0x7f'),'id'])||{});}})[_0x4ee1('0x1b')](respondWithResult(_0x452961,null))[_0x4ee1('0x25')](handleError(_0x452961,null));};exports[_0x4ee1('0x108')]=function(_0x861c76,_0x3f80ba){var _0x1e8d49={};var _0x595c90={};var _0x346d97;var _0xf36b32;return db[_0x4ee1('0x50')][_0x4ee1('0x7c')]({'where':{'id':_0x861c76[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x3f80ba,null))[_0x4ee1('0x1b')](function(_0x2201e2){if(_0x2201e2){_0x346d97=_0x2201e2;_0x595c90[_0x4ee1('0x49')]=_[_0x4ee1('0x55')](db[_0x4ee1('0x127')][_0x4ee1('0x51')]);_0x595c90['query']=_[_0x4ee1('0x55')](_0x861c76[_0x4ee1('0x54')]);_0x595c90['filters']=_['intersection'](_0x595c90[_0x4ee1('0x49')],_0x595c90[_0x4ee1('0x54')]);_0x1e8d49[_0x4ee1('0x57')]=_[_0x4ee1('0x56')](_0x595c90[_0x4ee1('0x49')],qs[_0x4ee1('0x58')](_0x861c76[_0x4ee1('0x54')]['fields']));_0x1e8d49[_0x4ee1('0x57')]=_0x1e8d49[_0x4ee1('0x57')][_0x4ee1('0x68')]?_0x1e8d49[_0x4ee1('0x57')]:_0x595c90[_0x4ee1('0x49')];_0x1e8d49[_0x4ee1('0x5a')]=qs[_0x4ee1('0x5b')](_0x861c76[_0x4ee1('0x54')]['sort']);_0x1e8d49[_0x4ee1('0x5f')]=qs[_0x4ee1('0x5d')](_[_0x4ee1('0x5c')](_0x861c76['query'],_0x595c90['filters']));if(_0x861c76['query'][_0x4ee1('0x5e')]){_0x1e8d49['where']=_[_0x4ee1('0x60')](_0x1e8d49['where'],{'$or':_[_0x4ee1('0x4f')](_0x1e8d49['attributes'],function(_0x330d3a){var _0x35da62={};_0x35da62[_0x330d3a]={'$like':'%'+_0x861c76[_0x4ee1('0x54')][_0x4ee1('0x5e')]+'%'};return _0x35da62;})});}_0x1e8d49=_[_0x4ee1('0x60')]({},_0x1e8d49,_0x861c76['options']);return _0x346d97['getProactiveActions'](_0x1e8d49);}})['then'](function(_0x5f0f5d){if(_0x5f0f5d){_0xf36b32=_0x5f0f5d['length'];if(!_0x861c76[_0x4ee1('0x54')]['hasOwnProperty'](_0x4ee1('0x59'))){_0x1e8d49[_0x4ee1('0x2b')]=qs[_0x4ee1('0x2b')](_0x861c76['query'][_0x4ee1('0x2b')]);_0x1e8d49[_0x4ee1('0x29')]=qs[_0x4ee1('0x29')](_0x861c76[_0x4ee1('0x54')][_0x4ee1('0x29')]);}return _0x346d97[_0x4ee1('0x108')](_0x1e8d49);}})['then'](function(_0x50860d){if(_0x50860d){return _0x50860d?{'count':_0xf36b32,'rows':_0x50860d}:null;}})[_0x4ee1('0x1b')](respondWithResult(_0x3f80ba,null))[_0x4ee1('0x25')](handleError(_0x3f80ba,null));};exports[_0x4ee1('0x128')]=function(_0x5217b2,_0x307be5){var _0x15030c=_0x5217b2[_0x4ee1('0x54')][_0x4ee1('0x129')]===_0x4ee1('0x12a')?_0x4ee1('0x12b'):_0x4ee1('0x12c');return db['ChatWebsite']['find']({'attributes':['id',_0x15030c],'where':{'id':_0x5217b2[_0x4ee1('0x66')]['id']}})['then'](handleEntityNotFound(_0x307be5,null))[_0x4ee1('0x1b')](function(_0x43b20a){if(_0x43b20a){var _0x122584=_0x43b20a[_0x15030c];var _0x437954=_0x122584&&_0x122584[_0x4ee1('0x12d')]?_0x122584[_0x4ee1('0x12d')]:[];_0x307be5[_0x4ee1('0x36')]({'fromKey':_[_0x4ee1('0x90')](_0x122584['fromKey'])?undefined:_0x122584[_0x4ee1('0x12e')],'count':_0x437954[_0x4ee1('0x68')],'rows':_0x437954});}})['catch'](handleError(_0x307be5,null));};exports[_0x4ee1('0x12f')]=function(_0x299b4,_0x62a888){var _0x442cff={'raw':![],'where':{}};var _0x2a3cf2={};var _0x54fe5f={'count':0x0,'rows':[]};return db[_0x4ee1('0x50')]['findOne']({'where':{'id':_0x299b4[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x62a888,null))[_0x4ee1('0x1b')](function(_0x410628){if(_0x410628){_0x2a3cf2[_0x4ee1('0x49')]=_[_0x4ee1('0x55')](db['ChatOfflineMessage'][_0x4ee1('0x51')]);_0x2a3cf2[_0x4ee1('0x54')]=_[_0x4ee1('0x55')](_0x299b4[_0x4ee1('0x54')]);_0x2a3cf2['filters']=_[_0x4ee1('0x56')](_0x2a3cf2[_0x4ee1('0x49')],_0x2a3cf2[_0x4ee1('0x54')]);_0x442cff['attributes']=_['intersection'](_0x2a3cf2[_0x4ee1('0x49')],qs[_0x4ee1('0x58')](_0x299b4['query'][_0x4ee1('0x58')]));_0x442cff[_0x4ee1('0x57')]=_0x442cff[_0x4ee1('0x57')]['length']?_0x442cff[_0x4ee1('0x57')]:_0x2a3cf2[_0x4ee1('0x49')];if(!_0x299b4[_0x4ee1('0x54')][_0x4ee1('0x7d')](_0x4ee1('0x59'))){_0x442cff[_0x4ee1('0x2b')]=qs[_0x4ee1('0x2b')](_0x299b4[_0x4ee1('0x54')][_0x4ee1('0x2b')]);_0x442cff['offset']=qs['offset'](_0x299b4['query'][_0x4ee1('0x29')]);}_0x442cff[_0x4ee1('0x5a')]=qs['sort'](_0x299b4[_0x4ee1('0x54')]['sort']);_0x442cff[_0x4ee1('0x5f')]=qs[_0x4ee1('0x5d')](_['pick'](_0x299b4['query'],_0x2a3cf2[_0x4ee1('0x5d')]));_0x442cff['where'][_0x4ee1('0x7a')]=_0x410628['id'];if(_0x299b4[_0x4ee1('0x54')][_0x4ee1('0x5e')]){_0x442cff[_0x4ee1('0x5f')]=_['merge'](_0x442cff[_0x4ee1('0x5f')],{'$or':_['map'](_0x442cff[_0x4ee1('0x57')],function(_0x38bb5e){var _0x377523={};_0x377523[_0x38bb5e]={'$like':'%'+_0x299b4[_0x4ee1('0x54')]['filter']+'%'};return _0x377523;})});}_0x442cff=_[_0x4ee1('0x60')]({},_0x442cff,_0x299b4[_0x4ee1('0x62')]);return db[_0x4ee1('0x130')][_0x4ee1('0x2c')]({'where':_0x442cff[_0x4ee1('0x5f')]})[_0x4ee1('0x1b')](function(_0x21c854){_0x54fe5f[_0x4ee1('0x2c')]=_0x21c854;if(_0x299b4['query'][_0x4ee1('0x63')]){_0x442cff[_0x4ee1('0x69')]=[{'all':!![]}];}else{_0x442cff[_0x4ee1('0x69')]=[{'model':db['CmContact'],'as':_0x4ee1('0x102'),'required':![]},{'model':db[_0x4ee1('0xea')],'as':_0x4ee1('0x131'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x442cff);})[_0x4ee1('0x1b')](function(_0x4a5ad6){_0x54fe5f[_0x4ee1('0x65')]=_0x4a5ad6;return _0x54fe5f;});}})[_0x4ee1('0x1b')](respondWithFilteredResult(_0x62a888,_0x442cff))[_0x4ee1('0x25')](handleError(_0x62a888,null));};exports[_0x4ee1('0x132')]=function(_0x817279,_0x228b46){return db[_0x4ee1('0x50')][_0x4ee1('0x74')]({'where':{'id':_0x817279[_0x4ee1('0x66')]['id']}})['then'](handleEntityNotFound(_0x228b46,null))['then'](function(_0x3ff1a7){if(_0x3ff1a7){return _0x3ff1a7[_0x4ee1('0x132')](_0x817279[_0x4ee1('0x6a')]['ids'],_[_0x4ee1('0x100')](_0x817279[_0x4ee1('0x6a')],[_0x4ee1('0x7f'),'id'])||{})[_0x4ee1('0x133')](function(_0x3e3912){for(var _0x4215b0=0x0;_0x4215b0<_0x817279[_0x4ee1('0x6a')][_0x4ee1('0x7f')][_0x4ee1('0x68')];_0x4215b0+=0x1){socket[_0x4ee1('0x134')]('userChatWebsite:save',{'UserId':Number(_0x817279[_0x4ee1('0x6a')][_0x4ee1('0x7f')][_0x4215b0]),'ChatWebsiteId':Number(_0x817279[_0x4ee1('0x66')]['id'])});}return _0x3e3912;});}})[_0x4ee1('0x1b')](respondWithResult(_0x228b46,null))['catch'](handleError(_0x228b46,null));};exports[_0x4ee1('0x135')]=function(_0x3c7e0e,_0x12de81){return db['ChatWebsite'][_0x4ee1('0x74')]({'where':{'id':_0x3c7e0e[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x12de81,null))[_0x4ee1('0x1b')](function(_0x47a2cf){if(_0x47a2cf){return _0x47a2cf[_0x4ee1('0x135')](_0x3c7e0e[_0x4ee1('0x54')][_0x4ee1('0x7f')])[_0x4ee1('0x1b')](function(){if(_['isArray'](_0x3c7e0e[_0x4ee1('0x54')][_0x4ee1('0x7f')])){for(var _0x1c7273=0x0;_0x1c7273<_0x3c7e0e['query'][_0x4ee1('0x7f')][_0x4ee1('0x68')];_0x1c7273+=0x1){socket['emit'](_0x4ee1('0x136'),{'UserId':Number(_0x3c7e0e[_0x4ee1('0x54')]['ids'][_0x1c7273]),'ChatWebsiteId':Number(_0x3c7e0e[_0x4ee1('0x66')]['id'])});}}else{socket[_0x4ee1('0x134')](_0x4ee1('0x136'),{'UserId':Number(_0x3c7e0e['query'][_0x4ee1('0x7f')]),'ChatWebsiteId':Number(_0x3c7e0e[_0x4ee1('0x66')]['id'])});}});}})[_0x4ee1('0x1b')](respondWithStatusCode(_0x12de81,null))[_0x4ee1('0x25')](handleError(_0x12de81,null));};exports[_0x4ee1('0x137')]=function(_0x48cd81,_0x29b302){var _0x50e85e={};var _0x202fe8={};var _0x3a7317;var _0x4dfd2e;return db['ChatWebsite'][_0x4ee1('0x7c')]({'where':{'id':_0x48cd81[_0x4ee1('0x66')]['id']}})[_0x4ee1('0x1b')](handleEntityNotFound(_0x29b302,null))[_0x4ee1('0x1b')](function(_0x8f615f){if(_0x8f615f){_0x3a7317=_0x8f615f;_0x202fe8[_0x4ee1('0x49')]=_[_0x4ee1('0x55')](db[_0x4ee1('0xc9')][_0x4ee1('0x51')]);_0x202fe8[_0x4ee1('0x54')]=_[_0x4ee1('0x55')](_0x48cd81['query']);_0x202fe8[_0x4ee1('0x5d')]=_['intersection'](_0x202fe8[_0x4ee1('0x49')],_0x202fe8[_0x4ee1('0x54')]);_0x50e85e[_0x4ee1('0x57')]=_[_0x4ee1('0x56')](_0x202fe8[_0x4ee1('0x49')],qs[_0x4ee1('0x58')](_0x48cd81[_0x4ee1('0x54')][_0x4ee1('0x58')]));_0x50e85e[_0x4ee1('0x57')]=_0x50e85e[_0x4ee1('0x57')][_0x4ee1('0x68')]?_0x50e85e[_0x4ee1('0x57')]:_0x202fe8[_0x4ee1('0x49')];_0x50e85e[_0x4ee1('0x5a')]=qs[_0x4ee1('0x5b')](_0x48cd81[_0x4ee1('0x54')]['sort']);_0x50e85e[_0x4ee1('0x5f')]=qs[_0x4ee1('0x5d')](_[_0x4ee1('0x5c')](_0x48cd81['query'],_0x202fe8[_0x4ee1('0x5d')]));if(_0x48cd81[_0x4ee1('0x54')]['filter']){_0x50e85e[_0x4ee1('0x5f')]=_[_0x4ee1('0x60')](_0x50e85e[_0x4ee1('0x5f')],{'$or':_[_0x4ee1('0x4f')](_0x50e85e[_0x4ee1('0x57')],function(_0x2c95ff){var _0x364845={};_0x364845[_0x2c95ff]={'$like':'%'+_0x48cd81[_0x4ee1('0x54')][_0x4ee1('0x5e')]+'%'};return _0x364845;})});}_0x50e85e=_[_0x4ee1('0x60')]({},_0x50e85e,_0x48cd81[_0x4ee1('0x62')]);return _0x3a7317[_0x4ee1('0x137')](_0x50e85e);}})['then'](function(_0x1b7163){if(_0x1b7163){_0x4dfd2e=_0x1b7163['length'];if(!_0x48cd81[_0x4ee1('0x54')]['hasOwnProperty'](_0x4ee1('0x59'))){_0x50e85e['limit']=qs[_0x4ee1('0x2b')](_0x48cd81['query'][_0x4ee1('0x2b')]);_0x50e85e[_0x4ee1('0x29')]=qs['offset'](_0x48cd81[_0x4ee1('0x54')]['offset']);}return _0x3a7317[_0x4ee1('0x137')](_0x50e85e);}})['then'](function(_0x10d3f0){if(_0x10d3f0){return _0x10d3f0?{'count':_0x4dfd2e,'rows':_0x10d3f0}:null;}})[_0x4ee1('0x1b')](respondWithResult(_0x29b302,null))[_0x4ee1('0x25')](handleError(_0x29b302,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 4a8f284..c07f97e 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 _0x6732=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2673('0x0'));var ChatWebsite=require(_0x2673('0x1'))['db'][_0x2673('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2673('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2673('0x4'),'afterDestroy':_0x2673('0x5')};function emitEvent(_0x5467cd){return function(_0xfef746,_0x3ac2c4,_0x5c7f5c){ChatWebsiteEvents['emit'](_0x5467cd+':'+_0xfef746['id'],_0xfef746);ChatWebsiteEvents[_0x2673('0x6')](_0x5467cd,_0xfef746);_0x5c7f5c(null);};}for(var e in events){if(events[_0x2673('0x7')](e)){var event=events[e];ChatWebsite[_0x2673('0x8')](e,emitEvent(event));}}module[_0x2673('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x383a=['emit','hasOwnProperty','hook','../../mysqldb','ChatWebsite','update'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x383a,0x1ad));var _0xa383=function(_0x2b1fa9,_0x2e6a4b){_0x2b1fa9=_0x2b1fa9-0x0;var _0x405640=_0x383a[_0x2b1fa9];return _0x405640;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xa383('0x0'))['db'][_0xa383('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa383('0x2'),'afterDestroy':'remove'};function emitEvent(_0x15f485){return function(_0x2d5b89,_0x86d0d9,_0x576c27){ChatWebsiteEvents['emit'](_0x15f485+':'+_0x2d5b89['id'],_0x2d5b89);ChatWebsiteEvents[_0xa383('0x3')](_0x15f485,_0x2d5b89);_0x576c27(null);};}for(var e in events){if(events[_0xa383('0x4')](e)){var event=events[e];ChatWebsite[_0xa383('0x5')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 200ef5c..e80699b 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 _0x78a6=['rimraf','./chatWebsite.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise'];(function(_0x33fc57,_0xdd2591){var _0xf701ca=function(_0x4a38b9){while(--_0x4a38b9){_0x33fc57['push'](_0x33fc57['shift']());}};_0xf701ca(++_0xdd2591);}(_0x78a6,0x163));var _0x678a=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x78a6[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x678a('0x0'));var util=require('util');var logger=require(_0x678a('0x1'))(_0x678a('0x2'));var moment=require(_0x678a('0x3'));var BPromise=require('bluebird');var rp=require(_0x678a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x678a('0x5'));var config=require('../../config/environment');var attributes=require(_0x678a('0x6'));module[_0x678a('0x7')]=function(_0x12d977,_0x3ae359){return _0x12d977[_0x678a('0x8')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33ff=['moment','bluebird','request-promise','rimraf','./chatWebsite.attributes','exports','define','chat_websites','lodash','util','../../config/logger','api'];(function(_0x97ab47,_0x5cdab2){var _0x2d291f=function(_0x14f4fd){while(--_0x14f4fd){_0x97ab47['push'](_0x97ab47['shift']());}};_0x2d291f(++_0x5cdab2);}(_0x33ff,0xb0));var _0xf33f=function(_0x3ee9b2,_0xa090bb){_0x3ee9b2=_0x3ee9b2-0x0;var _0x51ac3e=_0x33ff[_0x3ee9b2];return _0x51ac3e;};'use strict';var _=require(_0xf33f('0x0'));var util=require(_0xf33f('0x1'));var logger=require(_0xf33f('0x2'))(_0xf33f('0x3'));var moment=require(_0xf33f('0x4'));var BPromise=require(_0xf33f('0x5'));var rp=require(_0xf33f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf33f('0x7'));var config=require('../../config/environment');var attributes=require(_0xf33f('0x8'));module[_0xf33f('0x9')]=function(_0x1038fa,_0xaf76fc){return _0x1038fa[_0xf33f('0xa')]('ChatWebsite',attributes,{'tableName':_0xf33f('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 1726010..b9ae192 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 _0x6557=['request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x3a83df,_0x3a750f){var _0x3d0adb=function(_0x27a1b5){while(--_0x27a1b5){_0x3a83df['push'](_0x3a83df['shift']());}};_0x3d0adb(++_0x3a750f);}(_0x6557,0x12e));var _0x7655=function(_0xe72d8f,_0x1398c7){_0xe72d8f=_0xe72d8f-0x0;var _0x4add7d=_0x6557[_0xe72d8f];return _0x4add7d;};'use strict';var _=require(_0x7655('0x0'));var util=require(_0x7655('0x1'));var moment=require('moment');var BPromise=require(_0x7655('0x2'));var rs=require(_0x7655('0x3'));var fs=require('fs');var Redis=require(_0x7655('0x4'));var db=require(_0x7655('0x5'))['db'];var utils=require(_0x7655('0x6'));var logger=require(_0x7655('0x7'))(_0x7655('0x8'));var config=require(_0x7655('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7655('0xa')][_0x7655('0xb')]({'port':0x232a});config[_0x7655('0xc')]=_[_0x7655('0xd')](config[_0x7655('0xc')],{'host':_0x7655('0xe'),'port':0x18eb});var socket=require(_0x7655('0xf'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x7655('0x10')](socket);function respondWithRpcPromise(_0x5bbfc7,_0x4b7e9d,_0x2c1dc2){return new BPromise(function(_0x257564,_0x3efca2){return client['request'](_0x5bbfc7,_0x2c1dc2)[_0x7655('0x11')](function(_0x38955f){logger[_0x7655('0x12')](_0x7655('0x13'),_0x4b7e9d,'request\x20sent');logger[_0x7655('0x14')](_0x7655('0x15'),_0x4b7e9d,_0x7655('0x16'),JSON[_0x7655('0x17')](_0x38955f));if(_0x38955f['error']){if(_0x38955f[_0x7655('0x18')]['code']===0x1f4){logger[_0x7655('0x18')](_0x7655('0x13'),_0x4b7e9d,_0x38955f['error'][_0x7655('0x19')]);return _0x3efca2(_0x38955f[_0x7655('0x18')][_0x7655('0x19')]);}logger[_0x7655('0x18')](_0x7655('0x13'),_0x4b7e9d,_0x38955f['error'][_0x7655('0x19')]);return _0x257564(_0x38955f[_0x7655('0x18')][_0x7655('0x19')]);}else{logger[_0x7655('0x12')](_0x7655('0x13'),_0x4b7e9d,_0x7655('0x16'));_0x257564(_0x38955f[_0x7655('0x1a')][_0x7655('0x19')]);}})['catch'](function(_0x83594b){logger[_0x7655('0x18')](_0x7655('0x13'),_0x4b7e9d,_0x83594b);_0x3efca2(_0x83594b);});});} \ No newline at end of file +var _0xa42f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','ChatWebsite,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x58c7a6,_0x9336c9){var _0x51e95a=function(_0x3d4d7b){while(--_0x3d4d7b){_0x58c7a6['push'](_0x58c7a6['shift']());}};_0x51e95a(++_0x9336c9);}(_0xa42f,0x18b));var _0xfa42=function(_0x26401a,_0xbdff78){_0x26401a=_0x26401a-0x0;var _0x1f179c=_0xa42f[_0x26401a];return _0x1f179c;};'use strict';var _=require(_0xfa42('0x0'));var util=require(_0xfa42('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa42('0x2'));var db=require(_0xfa42('0x3'))['db'];var utils=require(_0xfa42('0x4'));var logger=require(_0xfa42('0x5'))(_0xfa42('0x6'));var config=require(_0xfa42('0x7'));var jayson=require(_0xfa42('0x8'));var client=jayson[_0xfa42('0x9')][_0xfa42('0xa')]({'port':0x232a});config[_0xfa42('0xb')]=_[_0xfa42('0xc')](config[_0xfa42('0xb')],{'host':_0xfa42('0xd'),'port':0x18eb});var socket=require(_0xfa42('0xe'))(new Redis(config[_0xfa42('0xb')]));require(_0xfa42('0xf'))[_0xfa42('0x10')](socket);function respondWithRpcPromise(_0x1e8a39,_0x233b9b,_0x3a8b9f){return new BPromise(function(_0x3315fb,_0x1e191c){return client['request'](_0x1e8a39,_0x3a8b9f)['then'](function(_0x1292b6){logger['info'](_0xfa42('0x11'),_0x233b9b,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x233b9b,'request\x20sent',JSON['stringify'](_0x1292b6));if(_0x1292b6[_0xfa42('0x12')]){if(_0x1292b6[_0xfa42('0x12')][_0xfa42('0x13')]===0x1f4){logger[_0xfa42('0x12')](_0xfa42('0x11'),_0x233b9b,_0x1292b6[_0xfa42('0x12')]['message']);return _0x1e191c(_0x1292b6[_0xfa42('0x12')][_0xfa42('0x14')]);}logger[_0xfa42('0x12')](_0xfa42('0x11'),_0x233b9b,_0x1292b6[_0xfa42('0x12')][_0xfa42('0x14')]);return _0x3315fb(_0x1292b6[_0xfa42('0x12')][_0xfa42('0x14')]);}else{logger[_0xfa42('0x15')](_0xfa42('0x11'),_0x233b9b,_0xfa42('0x16'));_0x3315fb(_0x1292b6[_0xfa42('0x17')][_0xfa42('0x14')]);}})[_0xfa42('0x18')](function(_0x14f42a){logger['error'](_0xfa42('0x11'),_0x233b9b,_0x14f42a);_0x1e191c(_0x14f42a);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index ecbe4da..09d7211 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 _0x3b1f=['length','chatWebsite:','save','remove','update','emit','register'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3b1f,0x11a));var _0xf3b1=function(_0xa65634,_0x3d436c){_0xa65634=_0xa65634-0x0;var _0x756716=_0x3b1f[_0xa65634];return _0x756716;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xf3b1('0x0'),_0xf3b1('0x1'),_0xf3b1('0x2')];function createListener(_0x27425d,_0x4d37a2){return function(_0x179928){_0x4d37a2[_0xf3b1('0x3')](_0x27425d,_0x179928);};}function removeListener(_0x266031,_0x2795d0){return function(){ChatWebsiteEvents['removeListener'](_0x266031,_0x2795d0);};}exports[_0xf3b1('0x4')]=function(_0x13374c){for(var _0x4fdf25=0x0,_0x7f59c7=events[_0xf3b1('0x5')];_0x4fdf25<_0x7f59c7;_0x4fdf25++){var _0x3b69ee=events[_0x4fdf25];var _0x47e280=createListener(_0xf3b1('0x6')+_0x3b69ee,_0x13374c);ChatWebsiteEvents['on'](_0x3b69ee,_0x47e280);}}; \ No newline at end of file +var _0x7d09=['removeListener','register','length','chatWebsite:','save','update','emit'];(function(_0x43b333,_0x1ffed4){var _0xea9fff=function(_0x13d523){while(--_0x13d523){_0x43b333['push'](_0x43b333['shift']());}};_0xea9fff(++_0x1ffed4);}(_0x7d09,0x154));var _0x97d0=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0x7d09[_0x3fe6df];return _0x372a0e;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x97d0('0x0'),'remove',_0x97d0('0x1')];function createListener(_0x5ae8c4,_0x2c36cf){return function(_0x167020){_0x2c36cf[_0x97d0('0x2')](_0x5ae8c4,_0x167020);};}function removeListener(_0x5c0b13,_0x2f2e2c){return function(){ChatWebsiteEvents[_0x97d0('0x3')](_0x5c0b13,_0x2f2e2c);};}exports[_0x97d0('0x4')]=function(_0xe01cdf){for(var _0x53a404=0x0,_0x3e978d=events[_0x97d0('0x5')];_0x53a404<_0x3e978d;_0x53a404++){var _0x36ba24=events[_0x53a404];var _0x17a332=createListener(_0x97d0('0x6')+_0x36ba24,_0xe01cdf);ChatWebsiteEvents['on'](_0x36ba24,_0x17a332);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index f45ab4f..871e05a 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3ed=['trim','([\x5cw]+)','exports','../../../utils/misc','escapeRegExp','URL','replace','localhost','test'];(function(_0x520b9f,_0x2be5aa){var _0xe5e7df=function(_0x2dacd0){while(--_0x2dacd0){_0x520b9f['push'](_0x520b9f['shift']());}};_0xe5e7df(++_0x2be5aa);}(_0xc3ed,0x111));var _0xdc3e=function(_0x175c40,_0x37f161){_0x175c40=_0x175c40-0x0;var _0x3feac9=_0xc3ed[_0x175c40];return _0x3feac9;};var escapeRegExp=require(_0xdc3e('0x0'))[_0xdc3e('0x1')];var URL=require('url')[_0xdc3e('0x2')];function testWildcardValidity(_0x44efb2){var _0x166afe=!![];try{new URL(_0x44efb2[_0xdc3e('0x3')]('*',_0xdc3e('0x4')));}catch(_0x55ffdd){_0x166afe=![];}return _0x166afe&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xdc3e('0x5')](_0x44efb2);}function testWebsiteWithWildcard(_0x5922b7,_0x9a9a96){var _0x27b691;var _0x3f6e1c=escapeRegExp(_0x5922b7[_0xdc3e('0x6')]()[_0xdc3e('0x3')](/\/$/,''))[_0xdc3e('0x3')]('\x5c*',_0xdc3e('0x7'));try{new URL(_0x5922b7[_0xdc3e('0x3')]('\x5c*',_0xdc3e('0x4')));_0x27b691=new RegExp(_0x3f6e1c)[_0xdc3e('0x5')](_0x9a9a96);}catch(_0x3becac){_0x27b691=![];}return _0x27b691;}module[_0xdc3e('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x3af5=['URL','localhost','replace','([\x5cw]+)','test','../../../utils/misc','escapeRegExp'];(function(_0x171d03,_0x3eebb0){var _0x5f0402=function(_0xf7dba1){while(--_0xf7dba1){_0x171d03['push'](_0x171d03['shift']());}};_0x5f0402(++_0x3eebb0);}(_0x3af5,0x1d3));var _0x53af=function(_0x1d5a32,_0x47974a){_0x1d5a32=_0x1d5a32-0x0;var _0x361ca0=_0x3af5[_0x1d5a32];return _0x361ca0;};var escapeRegExp=require(_0x53af('0x0'))[_0x53af('0x1')];var URL=require('url')[_0x53af('0x2')];function testWildcardValidity(_0x2a2a9){var _0x4ec541=!![];try{new URL(_0x2a2a9['replace']('*',_0x53af('0x3')));}catch(_0x500041){_0x4ec541=![];}return _0x4ec541&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x2a2a9);}function testWebsiteWithWildcard(_0x205be1,_0x11651b){var _0x4e0137;var _0xba7147=escapeRegExp(_0x205be1['trim']()[_0x53af('0x4')](/\/$/,''))[_0x53af('0x4')]('\x5c*',_0x53af('0x5'));try{new URL(_0x205be1[_0x53af('0x4')]('\x5c*',_0x53af('0x3')));_0x4e0137=new RegExp(_0xba7147)[_0x53af('0x6')](_0x11651b);}catch(_0x56751b){_0x4e0137=![];}return _0x4e0137;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index d266274..479d76e 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 _0xa711=['/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','create','addDisposition','post','diskStorage','root','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','join','format','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','addInteraction','addApplications','/:id/proactive_actions','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet'];(function(_0x3573b2,_0x37b3ec){var _0x2494a4=function(_0x5c705f){while(--_0x5c705f){_0x3573b2['push'](_0x3573b2['shift']());}};_0x2494a4(++_0x37b3ec);}(_0xa711,0x106));var _0x1a71=function(_0x208f45,_0x32a9db){_0x208f45=_0x208f45-0x0;var _0x1eb380=_0xa711[_0x208f45];return _0x1eb380;};'use strict';var multer=require(_0x1a71('0x0'));var util=require('util');var path=require(_0x1a71('0x1'));var timeout=require(_0x1a71('0x2'));var express=require(_0x1a71('0x3'));var router=express[_0x1a71('0x4')]();var fs_extra=require(_0x1a71('0x5'));var auth=require(_0x1a71('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1a71('0x7'));var controller=require('./chatWebsite.controller');router[_0x1a71('0x8')]('/',auth[_0x1a71('0x9')](),controller[_0x1a71('0xa')]);router['get'](_0x1a71('0xb'),auth[_0x1a71('0x9')](),controller[_0x1a71('0xc')]);router[_0x1a71('0x8')](_0x1a71('0xd'),auth[_0x1a71('0x9')](),controller[_0x1a71('0xe')]);router[_0x1a71('0x8')](_0x1a71('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x1a71('0x8')](_0x1a71('0x10'),auth[_0x1a71('0x9')](),controller[_0x1a71('0x11')]);router['get'](_0x1a71('0x12'),controller[_0x1a71('0x13')]);router[_0x1a71('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x1a71('0x8')](_0x1a71('0x14'),controller[_0x1a71('0x15')]);router[_0x1a71('0x8')](_0x1a71('0x16'),controller[_0x1a71('0x17')]);router[_0x1a71('0x8')]('/:id/interactions',auth[_0x1a71('0x9')](),controller[_0x1a71('0x18')]);router[_0x1a71('0x8')]('/:id/snippet',controller[_0x1a71('0x19')]);router[_0x1a71('0x8')](_0x1a71('0x1a'),auth[_0x1a71('0x9')](),controller[_0x1a71('0x1b')]);router[_0x1a71('0x8')]('/:id/proactive_actions',auth[_0x1a71('0x9')](),controller[_0x1a71('0x1c')]);router[_0x1a71('0x8')](_0x1a71('0x1d'),controller[_0x1a71('0x1e')]);router[_0x1a71('0x8')]('/:id/offline_messages',auth[_0x1a71('0x9')](),controller[_0x1a71('0x1f')]);router['get'](_0x1a71('0x20'),auth[_0x1a71('0x9')](),controller[_0x1a71('0x21')]);router['post']('/',auth[_0x1a71('0x9')](),controller[_0x1a71('0x22')]);router['post'](_0x1a71('0xf'),auth['isAuthenticated'](),controller[_0x1a71('0x23')]);router[_0x1a71('0x24')](_0x1a71('0x10'),auth[_0x1a71('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x1a71('0x25')]({'destination':function(_0x4a6630,_0x250f71,_0x26ebb3){_0x26ebb3(null,path['join'](config[_0x1a71('0x26')],_0x1a71('0x27')));},'filename':function(_0x12d9d3,_0x1c047b,_0x2f81a1){_0x2f81a1(null,util['format'](_0x1a71('0x28'),Date[_0x1a71('0x29')](),_0x1c047b[_0x1a71('0x2a')]));}})});router['post'](_0x1a71('0x12'),upload[_0x1a71('0x2b')](_0x1a71('0x2c')),controller[_0x1a71('0x2d')]);var upload=multer({'storage':multer[_0x1a71('0x25')]({'destination':function(_0x5ab9d5,_0x8921b4,_0x2887fb){_0x2887fb(null,path[_0x1a71('0x2e')](config[_0x1a71('0x26')],'server/files/images/avatars/'));},'filename':function(_0x1010e7,_0x13ecd9,_0x50eada){_0x50eada(null,util[_0x1a71('0x2f')](_0x1a71('0x28'),Date[_0x1a71('0x29')](),_0x13ecd9[_0x1a71('0x2a')]));}})});router['post']('/:id/avatar',upload[_0x1a71('0x2b')](_0x1a71('0x2c')),controller[_0x1a71('0x30')]);var upload=multer({'storage':multer[_0x1a71('0x25')]({'destination':function(_0x426126,_0x3dd5a2,_0x5810ca){_0x5810ca(null,path[_0x1a71('0x2e')](config[_0x1a71('0x26')],_0x1a71('0x31')));},'filename':function(_0x29bbbd,_0x293325,_0x139f43){_0x139f43(null,util[_0x1a71('0x2f')]('%s-%s',Date[_0x1a71('0x29')](),_0x293325[_0x1a71('0x2a')]));}})});router[_0x1a71('0x24')](_0x1a71('0x14'),upload[_0x1a71('0x2b')](_0x1a71('0x2c')),controller[_0x1a71('0x32')]);var upload=multer({'storage':multer[_0x1a71('0x25')]({'destination':function(_0x4c514d,_0x2d5b3b,_0xa9135){_0xa9135(null,path[_0x1a71('0x2e')](config[_0x1a71('0x26')],'server/files/images/avatars/'));},'filename':function(_0x2028ef,_0x49f264,_0x3ed8c4){_0x3ed8c4(null,util[_0x1a71('0x2f')](_0x1a71('0x28'),Date[_0x1a71('0x29')](),_0x49f264[_0x1a71('0x2a')]));}})});router['post'](_0x1a71('0x16'),upload['single'](_0x1a71('0x2c')),controller[_0x1a71('0x33')]);router[_0x1a71('0x24')](_0x1a71('0x34'),controller[_0x1a71('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x1a71('0x25')]({'destination':function(_0x1681f0,_0x312cba,_0x2f4144){const _0x3ab6ce=path['join'](config[_0x1a71('0x26')],_0x1a71('0x36'),_0x1a71('0x37'),_0x1a71('0x38'));fs_extra['ensureDir'](_0x3ab6ce,function(){_0x2f4144(null,_0x3ab6ce);});},'filename':function(_0x1942f0,_0x5287cb,_0x3c3b59){const _0x41a957=_0x5287cb[_0x1a71('0x2a')][_0x1a71('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x570f27=path[_0x1a71('0x3a')](_0x41a957);const _0x5ab215=Date[_0x1a71('0x29')]()+'-'+_0x41a957[_0x1a71('0x39')](_0x570f27,'')+_0x570f27;_0x3c3b59(null,_0x5ab215);}})});router['post'](_0x1a71('0x3b'),offlineUploadMulter[_0x1a71('0x3c')](),controller['offline']);router[_0x1a71('0x24')]('/:id/interactions',auth[_0x1a71('0x9')](),controller[_0x1a71('0x3d')]);router[_0x1a71('0x24')]('/:id/applications',auth[_0x1a71('0x9')](),controller[_0x1a71('0x3e')]);router[_0x1a71('0x24')](_0x1a71('0x3f'),auth[_0x1a71('0x9')](),controller['addProactiveActions']);router['post'](_0x1a71('0x20'),auth[_0x1a71('0x9')](),controller[_0x1a71('0x40')]);router[_0x1a71('0x41')](_0x1a71('0xd'),auth[_0x1a71('0x9')](),controller[_0x1a71('0x42')]);router['delete'](_0x1a71('0xd'),auth[_0x1a71('0x9')](),controller[_0x1a71('0x43')]);router[_0x1a71('0x44')](_0x1a71('0xf'),auth[_0x1a71('0x9')](),controller['removeDispositions']);router[_0x1a71('0x44')](_0x1a71('0x10'),auth[_0x1a71('0x9')](),controller[_0x1a71('0x45')]);router['delete'](_0x1a71('0x20'),auth[_0x1a71('0x9')](),controller[_0x1a71('0x46')]);module[_0x1a71('0x47')]=router; \ No newline at end of file +var _0xe40e=['/:id/interactions','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','addAvatar','server/files/images/avatars/','addCustomerAvatar','/:id/system_avatar','/:id/notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','/:id/users','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0xe40e,0x70));var _0xee40=function(_0x548f01,_0x98cc45){_0x548f01=_0x548f01-0x0;var _0x5719b0=_0xe40e[_0x548f01];return _0x5719b0;};'use strict';var multer=require('multer');var util=require(_0xee40('0x0'));var path=require(_0xee40('0x1'));var timeout=require(_0xee40('0x2'));var express=require(_0xee40('0x3'));var router=express[_0xee40('0x4')]();var fs_extra=require(_0xee40('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xee40('0x6'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0xee40('0x7')](),controller[_0xee40('0x8')]);router[_0xee40('0x9')](_0xee40('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xee40('0x7')](),controller[_0xee40('0xb')]);router[_0xee40('0x9')](_0xee40('0xc'),auth['isAuthenticated'](),controller[_0xee40('0xd')]);router[_0xee40('0x9')](_0xee40('0xe'),auth['isAuthenticated'](),controller[_0xee40('0xf')]);router[_0xee40('0x9')](_0xee40('0x10'),controller[_0xee40('0x11')]);router[_0xee40('0x9')](_0xee40('0x12'),controller['getAvatar']);router[_0xee40('0x9')](_0xee40('0x13'),controller[_0xee40('0x14')]);router['get']('/:id/system_avatar',controller[_0xee40('0x15')]);router[_0xee40('0x9')](_0xee40('0x16'),auth[_0xee40('0x7')](),controller['getInteractions']);router[_0xee40('0x9')]('/:id/snippet',controller[_0xee40('0x17')]);router[_0xee40('0x9')](_0xee40('0x18'),auth[_0xee40('0x7')](),controller[_0xee40('0x19')]);router[_0xee40('0x9')]('/:id/proactive_actions',auth[_0xee40('0x7')](),controller[_0xee40('0x1a')]);router[_0xee40('0x9')](_0xee40('0x1b'),controller[_0xee40('0x1c')]);router[_0xee40('0x9')]('/:id/offline_messages',auth[_0xee40('0x7')](),controller[_0xee40('0x1d')]);router[_0xee40('0x9')]('/:id/users',auth[_0xee40('0x7')](),controller['getAgents']);router[_0xee40('0x1e')]('/',auth[_0xee40('0x7')](),controller[_0xee40('0x1f')]);router['post'](_0xee40('0xc'),auth[_0xee40('0x7')](),controller['addDisposition']);router['post'](_0xee40('0xe'),auth['isAuthenticated'](),controller[_0xee40('0x20')]);var upload=multer({'storage':multer[_0xee40('0x21')]({'destination':function(_0x14919c,_0x237578,_0x5c5a5b){_0x5c5a5b(null,path[_0xee40('0x22')](config[_0xee40('0x23')],_0xee40('0x24')));},'filename':function(_0x5ace01,_0x13cf6f,_0x45d6fb){_0x45d6fb(null,util[_0xee40('0x25')](_0xee40('0x26'),Date[_0xee40('0x27')](),_0x13cf6f[_0xee40('0x28')]));}})});router['post']('/:id/logo',upload[_0xee40('0x29')](_0xee40('0x2a')),controller[_0xee40('0x2b')]);var upload=multer({'storage':multer[_0xee40('0x21')]({'destination':function(_0x3b9542,_0x26a347,_0x377ada){_0x377ada(null,path[_0xee40('0x22')](config[_0xee40('0x23')],'server/files/images/avatars/'));},'filename':function(_0x4b5424,_0x34b482,_0xb9f710){_0xb9f710(null,util['format'](_0xee40('0x26'),Date[_0xee40('0x27')](),_0x34b482[_0xee40('0x28')]));}})});router[_0xee40('0x1e')]('/:id/avatar',upload[_0xee40('0x29')](_0xee40('0x2a')),controller[_0xee40('0x2c')]);var upload=multer({'storage':multer[_0xee40('0x21')]({'destination':function(_0x1b3378,_0x541ec9,_0x5c4414){_0x5c4414(null,path[_0xee40('0x22')](config['root'],_0xee40('0x2d')));},'filename':function(_0xe364d5,_0x35e857,_0x4035ab){_0x4035ab(null,util[_0xee40('0x25')](_0xee40('0x26'),Date['now'](),_0x35e857[_0xee40('0x28')]));}})});router[_0xee40('0x1e')](_0xee40('0x13'),upload[_0xee40('0x29')](_0xee40('0x2a')),controller[_0xee40('0x2e')]);var upload=multer({'storage':multer[_0xee40('0x21')]({'destination':function(_0x4d0ebd,_0x5905a5,_0x8a2cc1){_0x8a2cc1(null,path[_0xee40('0x22')](config[_0xee40('0x23')],_0xee40('0x2d')));},'filename':function(_0xa15b29,_0x12e093,_0x44c8e6){_0x44c8e6(null,util[_0xee40('0x25')](_0xee40('0x26'),Date['now'](),_0x12e093[_0xee40('0x28')]));}})});router[_0xee40('0x1e')](_0xee40('0x2f'),upload[_0xee40('0x29')]('file'),controller['addSystemAvatar']);router[_0xee40('0x1e')](_0xee40('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xee40('0x21')]({'destination':function(_0x2a144c,_0x1ca18d,_0x65f93a){const _0x22901c=path[_0xee40('0x22')](config['root'],'server/files',_0xee40('0x31'),_0xee40('0x32'));fs_extra[_0xee40('0x33')](_0x22901c,function(){_0x65f93a(null,_0x22901c);});},'filename':function(_0x2ce305,_0x1d5820,_0x48de65){const _0x2e111c=_0x1d5820[_0xee40('0x28')][_0xee40('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x51e980=path[_0xee40('0x35')](_0x2e111c);const _0x14c9cb=Date[_0xee40('0x27')]()+'-'+_0x2e111c[_0xee40('0x34')](_0x51e980,'')+_0x51e980;_0x48de65(null,_0x14c9cb);}})});router[_0xee40('0x1e')](_0xee40('0x36'),offlineUploadMulter[_0xee40('0x37')](),controller[_0xee40('0x38')]);router[_0xee40('0x1e')](_0xee40('0x16'),auth[_0xee40('0x7')](),controller[_0xee40('0x39')]);router['post']('/:id/applications',auth[_0xee40('0x7')](),controller['addApplications']);router[_0xee40('0x1e')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xee40('0x3a')]);router['post'](_0xee40('0x3b'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xee40('0x3c'),auth[_0xee40('0x7')](),controller['update']);router[_0xee40('0x3d')]('/:id',auth[_0xee40('0x7')](),controller[_0xee40('0x3e')]);router[_0xee40('0x3d')](_0xee40('0xc'),auth['isAuthenticated'](),controller[_0xee40('0x3f')]);router[_0xee40('0x3d')](_0xee40('0xe'),auth[_0xee40('0x7')](),controller[_0xee40('0x40')]);router[_0xee40('0x3d')](_0xee40('0x3b'),auth[_0xee40('0x7')](),controller[_0xee40('0x41')]);module[_0xee40('0x42')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 4ce662f..dc288b1 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37dd=['Router','env','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','express','../components/auth/service','../config/environment'];(function(_0x3dd567,_0x276ca9){var _0x415024=function(_0x3ae159){while(--_0x3ae159){_0x3dd567['push'](_0x3dd567['shift']());}};_0x415024(++_0x276ca9);}(_0x37dd,0x1c0));var _0xd37d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x37dd[_0x3dd15e];return _0x231fd0;};var beaverLogger=require('beaver-logger/server');var express=require(_0xd37d('0x0'));var auth=require(_0xd37d('0x1'));var config=require(_0xd37d('0x2'));var router=express[_0xd37d('0x3')]();var isProduction=config[_0xd37d('0x4')]==='production'||![];function clientSideLogs(_0x2cc0d2,_0x3b2b7c,_0xcc5874){var _0x4f24a1=_0x2cc0d2['app']['get']('client-side-logger');if(!_0x4f24a1){throw new Error(_0xd37d('0x5'));}return beaverLogger[_0xd37d('0x6')]({'uri':_0xd37d('0x7'),'logger':_0x4f24a1,'enableCors':!isProduction})(_0x2cc0d2,_0x3b2b7c,_0xcc5874);}router[_0xd37d('0x8')](auth[_0xd37d('0x9')](),clientSideLogs);module[_0xd37d('0xa')]=router; \ No newline at end of file +var _0x4b9a=['express','../components/auth/service','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports'];(function(_0x2343d2,_0x6628bc){var _0x28a66e=function(_0x46beae){while(--_0x46beae){_0x2343d2['push'](_0x2343d2['shift']());}};_0x28a66e(++_0x6628bc);}(_0x4b9a,0x168));var _0xa4b9=function(_0x4b862d,_0x13b157){_0x4b862d=_0x4b862d-0x0;var _0x5e009d=_0x4b9a[_0x4b862d];return _0x5e009d;};var beaverLogger=require('beaver-logger/server');var express=require(_0xa4b9('0x0'));var auth=require(_0xa4b9('0x1'));var config=require('../config/environment');var router=express['Router']();var isProduction=config['env']===_0xa4b9('0x2')||![];function clientSideLogs(_0xbcd6a4,_0x516859,_0x1edf4a){var _0x3b6a02=_0xbcd6a4[_0xa4b9('0x3')]['get'](_0xa4b9('0x4'));if(!_0x3b6a02){throw new Error(_0xa4b9('0x5'));}return beaverLogger[_0xa4b9('0x6')]({'uri':'/client-logs','logger':_0x3b6a02,'enableCors':!isProduction})(_0xbcd6a4,_0x516859,_0x1edf4a);}router[_0xa4b9('0x7')](auth[_0xa4b9('0x8')](),clientSideLogs);module[_0xa4b9('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 04e334d..9027451 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 _0xc338=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x3b2eab,_0xb81b6){var _0x14ba2a=function(_0x59a817){while(--_0x59a817){_0x3b2eab['push'](_0x3b2eab['shift']());}};_0x14ba2a(++_0xb81b6);}(_0xc338,0x16d));var _0x8c33=function(_0x326241,_0x5120b4){_0x326241=_0x326241-0x0;var _0x4b05a=_0xc338[_0x326241];return _0x4b05a;};'use strict';var Sequelize=require(_0x8c33('0x0'));module[_0x8c33('0x1')]={'name':{'type':Sequelize[_0x8c33('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8c33('0x3')]('AmazonAWS',_0x8c33('0x4'),_0x8c33('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x8c33('0x3')](_0x8c33('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0x8c33('0x2')],'comment':_0x8c33('0x7')},'data2':{'type':Sequelize[_0x8c33('0x2')],'comment':_0x8c33('0x8')},'data3':{'type':Sequelize[_0x8c33('0x2')],'comment':_0x8c33('0x9')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x8c33('0xa')],'comment':_0x8c33('0xb')},'data6':{'type':Sequelize[_0x8c33('0xa')],'comment':_0x8c33('0xc')},'data7':{'type':Sequelize[_0x8c33('0xa')],'comment':_0x8c33('0xd')}}; \ No newline at end of file +var _0xac9e=['MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xac9e,0x1e6));var _0xeac9=function(_0x593111,_0x539f7d){_0x593111=_0x593111-0x0;var _0x3a7a1f=_0xac9e[_0x593111];return _0x3a7a1f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xeac9('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xeac9('0x1')](_0xeac9('0x2'),'Google',_0xeac9('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xeac9('0x4'),'Dynamics365')},'data1':{'type':Sequelize[_0xeac9('0x0')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xeac9('0x0')],'comment':_0xeac9('0x5')},'data3':{'type':Sequelize['STRING'],'comment':_0xeac9('0x6')},'data4':{'type':Sequelize[_0xeac9('0x0')],'comment':_0xeac9('0x7')},'data5':{'type':Sequelize[_0xeac9('0x8')],'comment':_0xeac9('0x9')},'data6':{'type':Sequelize[_0xeac9('0x8')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':_0xeac9('0xa')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 09ef5e3..7e8e1db 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 _0x9bdc=['nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','find','Name\x20parameter\x20not\x20specified','values','includes','body','join','encryptString','update','destroy','oauth2MicrosoftAuthorize','findOne','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','stringify','ioredis','../../components/parsers/qs','../../config/environment','api','defaults','redis','localhost','socket.io-emitter','end','status','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','error','name','send','padEnd','index','CloudProvider','rawAttributes','fieldName','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x18fbcc,_0x1ec91a){var _0x50c414=function(_0x2b44e4){while(--_0x2b44e4){_0x18fbcc['push'](_0x18fbcc['shift']());}};_0x50c414(++_0x1ec91a);}(_0x9bdc,0xe7));var _0xc9bd=function(_0xb94436,_0x4e3089){_0xb94436=_0xb94436-0x0;var _0x3c7dee=_0x9bdc[_0xb94436];return _0x3c7dee;};'use strict';var _=require('lodash');var Redis=require(_0xc9bd('0x0'));var qs=require(_0xc9bd('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0xc9bd('0x2'));var logger=require('../../config/logger')(_0xc9bd('0x3'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_[_0xc9bd('0x4')](config[_0xc9bd('0x5')],{'host':_0xc9bd('0x6'),'port':0x18eb});var socket=require(_0xc9bd('0x7'))(new Redis(config['redis']));var redis=new Redis(config[_0xc9bd('0x5')]);function respondWithStatusCode(_0x255338,_0x2d539e){_0x2d539e=_0x2d539e||0xcc;return function(_0x13a37f){if(_0x13a37f){return _0x255338['sendStatus'](_0x2d539e);}return _0x255338['status'](_0x2d539e)[_0xc9bd('0x8')]();};}function respondWithResult(_0x114d63,_0x22bf1d){_0x22bf1d=_0x22bf1d||0xc8;return function(_0xfcc61d){if(_0xfcc61d){return _0x114d63[_0xc9bd('0x9')](_0x22bf1d)[_0xc9bd('0xa')](_0xfcc61d);}};}function respondWithFilteredResult(_0x24b5ff,_0x30976e){return function(_0x5e6dcb){if(_0x5e6dcb){var _0x50864a=typeof _0x30976e[_0xc9bd('0xb')]===_0xc9bd('0xc')&&typeof _0x30976e[_0xc9bd('0xd')]===_0xc9bd('0xc');var _0x54731a=_0x5e6dcb[_0xc9bd('0xe')];var _0x131192=_0x50864a?0x0:_0x30976e['offset'];var _0xb0ded1=_0x50864a?_0x5e6dcb[_0xc9bd('0xe')]:_0x30976e[_0xc9bd('0xb')]+_0x30976e[_0xc9bd('0xd')];var _0x3a24c3;if(_0xb0ded1>=_0x54731a){_0xb0ded1=_0x54731a;_0x3a24c3=0xc8;}else{_0x3a24c3=0xce;}_0x24b5ff[_0xc9bd('0x9')](_0x3a24c3);return _0x24b5ff[_0xc9bd('0xf')](_0xc9bd('0x10'),_0x131192+'-'+_0xb0ded1+'/'+_0x54731a)[_0xc9bd('0xa')](_0x5e6dcb);}return null;};}function saveUpdates(_0x3d5728){return function(_0x146933){if(_0x146933){return _0x146933['update'](_0x3d5728)['then'](function(_0x211e28){return _0x211e28;});}return null;};}function removeEntity(_0x1b2429){return function(_0x2249d3){if(_0x2249d3){return _0x2249d3['destroy']()[_0xc9bd('0x11')](function(){_0x1b2429[_0xc9bd('0x9')](0xcc)[_0xc9bd('0x8')]();});}};}function handleEntityNotFound(_0xbb731){return function(_0x4697cd){if(!_0x4697cd){_0xbb731[_0xc9bd('0x12')](0x194);}return _0x4697cd;};}function handleError(_0x25f06a,_0x27e60d){_0x27e60d=_0x27e60d||0x1f4;return function(_0x9a35ba){logger[_0xc9bd('0x13')](_0x9a35ba['stack']);if(_0x9a35ba[_0xc9bd('0x14')]){delete _0x9a35ba[_0xc9bd('0x14')];}_0x25f06a['status'](_0x27e60d)[_0xc9bd('0x15')](_0x9a35ba);};}function maskClientSecret(_0x29f2be){return _[_0xc9bd('0x16')](_0x29f2be['slice'](0x0,0x3),0x14,'*');}exports[_0xc9bd('0x17')]=function(_0x8e02da,_0x419e90){var _0x335241={},_0x26283b={},_0x20c914={'count':0x0,'rows':[]};var _0x172a66=_['map'](db[_0xc9bd('0x18')][_0xc9bd('0x19')],function(_0xb14e60){return{'name':_0xb14e60[_0xc9bd('0x1a')],'type':_0xb14e60['type']['key']};});_0x26283b['model']=_[_0xc9bd('0x1b')](_0x172a66,'name');_0x26283b['query']=_['keys'](_0x8e02da[_0xc9bd('0x1c')]);_0x26283b[_0xc9bd('0x1d')]=_[_0xc9bd('0x1e')](_0x26283b[_0xc9bd('0x1f')],_0x26283b[_0xc9bd('0x1c')]);_0x335241[_0xc9bd('0x20')]=_[_0xc9bd('0x1e')](_0x26283b[_0xc9bd('0x1f')],qs[_0xc9bd('0x21')](_0x8e02da[_0xc9bd('0x1c')][_0xc9bd('0x21')]));_0x335241['attributes']=_0x335241[_0xc9bd('0x20')][_0xc9bd('0x22')]?_0x335241[_0xc9bd('0x20')]:_0x26283b[_0xc9bd('0x1f')];if(!_0x8e02da['query'][_0xc9bd('0x23')](_0xc9bd('0x24'))){_0x335241['limit']=qs[_0xc9bd('0xd')](_0x8e02da[_0xc9bd('0x1c')]['limit']);_0x335241[_0xc9bd('0xb')]=qs[_0xc9bd('0xb')](_0x8e02da[_0xc9bd('0x1c')][_0xc9bd('0xb')]);}_0x335241[_0xc9bd('0x25')]=qs[_0xc9bd('0x26')](_0x8e02da['query'][_0xc9bd('0x26')]);_0x335241['where']=qs[_0xc9bd('0x1d')](_['pick'](_0x8e02da['query'],_0x26283b[_0xc9bd('0x1d')]),_0x172a66);if(_0x8e02da['query'][_0xc9bd('0x27')]){_0x335241['where']=_[_0xc9bd('0x28')](_0x335241[_0xc9bd('0x29')],{'$or':_['map'](_0x172a66,function(_0x2a0775){if(_0x2a0775['type']!==_0xc9bd('0x2a')){var _0x2aaa59={};_0x2aaa59[_0x2a0775[_0xc9bd('0x14')]]={'$like':'%'+_0x8e02da[_0xc9bd('0x1c')][_0xc9bd('0x27')]+'%'};return _0x2aaa59;}})});}_0x335241=_['merge']({},_0x335241,_0x8e02da[_0xc9bd('0x2b')]);var _0x2bb8c1={'where':_0x335241[_0xc9bd('0x29')]};return db[_0xc9bd('0x18')][_0xc9bd('0xe')](_0x2bb8c1)['then'](function(_0x2ab679){_0x20c914[_0xc9bd('0xe')]=_0x2ab679;if(_0x8e02da[_0xc9bd('0x1c')][_0xc9bd('0x2c')]){_0x335241[_0xc9bd('0x2d')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x335241);})[_0xc9bd('0x11')](function(_0x59e374){_0x20c914['rows']=_[_0xc9bd('0x1b')](_0x59e374,function(_0x5dc530){if(_0x5dc530[_0xc9bd('0x2e')]===_0xc9bd('0x2f')){var _0x1de56a=encryptor[_0xc9bd('0x30')](_0x5dc530[_0xc9bd('0x31')]);_0x5dc530[_0xc9bd('0x31')]=maskClientSecret(_0x1de56a);}return _0x5dc530;});return _0x20c914;})['then'](respondWithFilteredResult(_0x419e90,_0x335241))[_0xc9bd('0x32')](handleError(_0x419e90,null));};exports[_0xc9bd('0x33')]=function(_0x43a038,_0x109c70){var _0x39ec78={'raw':!![],'where':{'id':_0x43a038[_0xc9bd('0x34')]['id']}},_0x382531={};_0x382531[_0xc9bd('0x1f')]=_[_0xc9bd('0x35')](db[_0xc9bd('0x18')]['rawAttributes']);_0x382531[_0xc9bd('0x1c')]=_[_0xc9bd('0x35')](_0x43a038[_0xc9bd('0x1c')]);_0x382531[_0xc9bd('0x1d')]=_[_0xc9bd('0x1e')](_0x382531[_0xc9bd('0x1f')],_0x382531[_0xc9bd('0x1c')]);_0x39ec78['attributes']=_[_0xc9bd('0x1e')](_0x382531[_0xc9bd('0x1f')],qs['fields'](_0x43a038[_0xc9bd('0x1c')][_0xc9bd('0x21')]));_0x39ec78[_0xc9bd('0x20')]=_0x39ec78['attributes'][_0xc9bd('0x22')]?_0x39ec78[_0xc9bd('0x20')]:_0x382531[_0xc9bd('0x1f')];if(_0x43a038['query'][_0xc9bd('0x2c')]){_0x39ec78['include']=[{'all':!![]}];}_0x39ec78=_['merge']({},_0x39ec78,_0x43a038[_0xc9bd('0x2b')]);return db[_0xc9bd('0x18')][_0xc9bd('0x36')](_0x39ec78)[_0xc9bd('0x11')](handleEntityNotFound(_0x109c70,null))[_0xc9bd('0x11')](function(_0x199229){if(_0x199229[_0xc9bd('0x2e')]===_0xc9bd('0x2f')){var _0x1a4f69=encryptor[_0xc9bd('0x30')](_0x199229['data3']);_0x199229[_0xc9bd('0x31')]=maskClientSecret(_0x1a4f69);}return _0x199229;})[_0xc9bd('0x11')](respondWithResult(_0x109c70,null))[_0xc9bd('0x32')](handleError(_0x109c70,null));};exports['create']=function(_0x1385e8,_0x350ac6){if(!_0x1385e8['body']['name'])throw new Error(_0xc9bd('0x37'));if(!_0x1385e8['body'][_0xc9bd('0x2e')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x3100fc=db[_0xc9bd('0x18')][_0xc9bd('0x19')][_0xc9bd('0x2e')][_0xc9bd('0x38')];if(!_0x3100fc[_0xc9bd('0x39')](_0x1385e8[_0xc9bd('0x3a')][_0xc9bd('0x2e')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x3100fc[_0xc9bd('0x3b')](',\x20'));if(_0x1385e8[_0xc9bd('0x3a')][_0xc9bd('0x2e')]==='MicrosoftAzure'&&_0x1385e8['body'][_0xc9bd('0x31')]){_0x1385e8[_0xc9bd('0x3a')][_0xc9bd('0x31')]=encryptor[_0xc9bd('0x3c')](_0x1385e8[_0xc9bd('0x3a')][_0xc9bd('0x31')]);}return db[_0xc9bd('0x18')]['create'](_0x1385e8['body'],{})['then'](respondWithResult(_0x350ac6,0xc9))[_0xc9bd('0x32')](handleError(_0x350ac6,null));};exports[_0xc9bd('0x3d')]=function(_0x4e8b7e,_0x102f98){if(_0x4e8b7e[_0xc9bd('0x3a')]['id']){delete _0x4e8b7e[_0xc9bd('0x3a')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x4e8b7e[_0xc9bd('0x34')]['id']}})[_0xc9bd('0x11')](handleEntityNotFound(_0x102f98,null))[_0xc9bd('0x11')](function(_0x5aca7f){if(_0x5aca7f[_0xc9bd('0x2e')]==='MicrosoftAzure'&&_0x4e8b7e[_0xc9bd('0x3a')][_0xc9bd('0x31')]){_0x4e8b7e[_0xc9bd('0x3a')][_0xc9bd('0x31')]=encryptor[_0xc9bd('0x3c')](_0x4e8b7e[_0xc9bd('0x3a')][_0xc9bd('0x31')]);}return _0x5aca7f;})['then'](saveUpdates(_0x4e8b7e[_0xc9bd('0x3a')],null))['then'](respondWithResult(_0x102f98,null))['catch'](handleError(_0x102f98,null));};exports[_0xc9bd('0x3e')]=function(_0x4c84d6,_0x3e793e){return db[_0xc9bd('0x18')][_0xc9bd('0x36')]({'where':{'id':_0x4c84d6[_0xc9bd('0x34')]['id']}})[_0xc9bd('0x11')](handleEntityNotFound(_0x3e793e,null))[_0xc9bd('0x11')](removeEntity(_0x3e793e,null))[_0xc9bd('0x32')](handleError(_0x3e793e,null));};exports[_0xc9bd('0x3f')]=function(_0x359608,_0x544de6){return db[_0xc9bd('0x18')][_0xc9bd('0x40')]({'where':{'id':_0x359608[_0xc9bd('0x34')]['id']},'raw':!![]})['then'](function(_0xbf4550){if(!_0xbf4550)return _0x544de6['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0xbf4550,_0x359608['user']['id'])};})['then'](respondWithResult(_0x544de6,null))[_0xc9bd('0x32')](handleError(_0x544de6,null));};exports[_0xc9bd('0x41')]=function(_0x4c368a,_0x17ea3d){var _0x2eb855=_0x4c368a['body'];var _0x375b3f;var _0x538a0f;if(_0x2eb855['error'])throw _0x2eb855;redis['get'](_0x2eb855[_0xc9bd('0x42')])['then'](function(_0x1fe63b){if(!_0x1fe63b)throw new Error(_0xc9bd('0x43'));_0x375b3f=JSON['parse'](_0x1fe63b);var _0x507af8=Buffer[_0xc9bd('0x44')](_0x2eb855[_0xc9bd('0x42')],_0xc9bd('0x45'))[_0xc9bd('0x46')](_0xc9bd('0x47'));_0x538a0f=JSON[_0xc9bd('0x48')](_0x507af8);if(!oauth[_0xc9bd('0x49')](_0x2eb855[_0xc9bd('0x4a')],_0x375b3f[_0xc9bd('0x4b')]))throw new Error(_0xc9bd('0x4c'));redis[_0xc9bd('0x4d')](_0x2eb855[_0xc9bd('0x42')]);return oauth['getOauth2MicrosoftAccessToken'](_0x2eb855[_0xc9bd('0x4e')],_0x375b3f);})[_0xc9bd('0x11')](function(_0x1e0aa1){_0x375b3f[_0xc9bd('0x4f')]=_0x1e0aa1[_0xc9bd('0x50')];_0x375b3f[_0xc9bd('0x51')]=_0x1e0aa1[_0xc9bd('0x52')];return db[_0xc9bd('0x18')][_0xc9bd('0x3d')]({'data5':_0x375b3f[_0xc9bd('0x4f')],'data6':_0x375b3f[_0xc9bd('0x51')]},{'where':{'id':_0x375b3f['id']}});})[_0xc9bd('0x11')](function(){oauth[_0xc9bd('0x53')](_0x375b3f);socket[_0xc9bd('0x54')](_0xc9bd('0x55'),{'id':_0x538a0f['id']});return;})[_0xc9bd('0x11')](respondWithStatusCode(_0x17ea3d,null))[_0xc9bd('0x32')](function(_0x557abf){if(_0x538a0f){socket[_0xc9bd('0x54')]('microsoftAuthorization:error',{'id':_0x538a0f['id']});}if(!_0x375b3f){logger[_0xc9bd('0x13')](_0xc9bd('0x56'),_0x557abf);return _0x17ea3d[_0xc9bd('0x9')](0x1f4)[_0xc9bd('0x15')](_0x557abf[_0xc9bd('0x57')]);}logger[_0xc9bd('0x13')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x375b3f['id'],JSON[_0xc9bd('0x58')](_0x557abf));});}; \ No newline at end of file +var _0x722a=['query','keys','filters','model','attributes','intersection','fields','length','sort','where','filter','merge','name','includeAll','rows','MicrosoftAzure','decryptString','data3','catch','params','options','find','service','create','Name\x20parameter\x20not\x20specified','body','values','join','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','error','stack','send','slice','index','map','CloudProvider','rawAttributes','fieldName','type'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x722a,0x135));var _0xa722=function(_0x431ad5,_0x38de4b){_0x431ad5=_0x431ad5-0x0;var _0x2fad1a=_0x722a[_0x431ad5];return _0x2fad1a;};'use strict';var _=require(_0xa722('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0xa722('0x1'))(_0xa722('0x2'));var db=require(_0xa722('0x3'))['db'];var oauth=require(_0xa722('0x4'));config[_0xa722('0x5')]=_[_0xa722('0x6')](config[_0xa722('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xa722('0x7'))(new Redis(config[_0xa722('0x5')]));var redis=new Redis(config[_0xa722('0x5')]);function respondWithStatusCode(_0x484453,_0x4f088b){_0x4f088b=_0x4f088b||0xcc;return function(_0x11daac){if(_0x11daac){return _0x484453[_0xa722('0x8')](_0x4f088b);}return _0x484453[_0xa722('0x9')](_0x4f088b)['end']();};}function respondWithResult(_0x2b33d1,_0x111e3d){_0x111e3d=_0x111e3d||0xc8;return function(_0x51b3d5){if(_0x51b3d5){return _0x2b33d1[_0xa722('0x9')](_0x111e3d)[_0xa722('0xa')](_0x51b3d5);}};}function respondWithFilteredResult(_0x267e3e,_0x51a71e){return function(_0x8dae81){if(_0x8dae81){var _0x18e3da=typeof _0x51a71e[_0xa722('0xb')]===_0xa722('0xc')&&typeof _0x51a71e['limit']===_0xa722('0xc');var _0x41a293=_0x8dae81[_0xa722('0xd')];var _0x81a3e1=_0x18e3da?0x0:_0x51a71e[_0xa722('0xb')];var _0x1d1889=_0x18e3da?_0x8dae81[_0xa722('0xd')]:_0x51a71e[_0xa722('0xb')]+_0x51a71e[_0xa722('0xe')];var _0x5422c6;if(_0x1d1889>=_0x41a293){_0x1d1889=_0x41a293;_0x5422c6=0xc8;}else{_0x5422c6=0xce;}_0x267e3e[_0xa722('0x9')](_0x5422c6);return _0x267e3e[_0xa722('0xf')](_0xa722('0x10'),_0x81a3e1+'-'+_0x1d1889+'/'+_0x41a293)[_0xa722('0xa')](_0x8dae81);}return null;};}function saveUpdates(_0xd37df6){return function(_0x383111){if(_0x383111){return _0x383111[_0xa722('0x11')](_0xd37df6)[_0xa722('0x12')](function(_0x376e57){return _0x376e57;});}return null;};}function removeEntity(_0x2df8d4){return function(_0x32c3f2){if(_0x32c3f2){return _0x32c3f2[_0xa722('0x13')]()[_0xa722('0x12')](function(){_0x2df8d4[_0xa722('0x9')](0xcc)[_0xa722('0x14')]();});}};}function handleEntityNotFound(_0x100d2f){return function(_0x675eb5){if(!_0x675eb5){_0x100d2f[_0xa722('0x8')](0x194);}return _0x675eb5;};}function handleError(_0x2d2c13,_0x40643c){_0x40643c=_0x40643c||0x1f4;return function(_0x3d8366){logger[_0xa722('0x15')](_0x3d8366[_0xa722('0x16')]);if(_0x3d8366['name']){delete _0x3d8366['name'];}_0x2d2c13[_0xa722('0x9')](_0x40643c)[_0xa722('0x17')](_0x3d8366);};}function maskClientSecret(_0xedb807){return _['padEnd'](_0xedb807[_0xa722('0x18')](0x0,0x3),0x14,'*');}exports[_0xa722('0x19')]=function(_0x5ee8ce,_0x4a8c27){var _0x2577a2={},_0x2309a9={},_0x1df111={'count':0x0,'rows':[]};var _0x8f17c6=_[_0xa722('0x1a')](db[_0xa722('0x1b')][_0xa722('0x1c')],function(_0x2501a9){return{'name':_0x2501a9[_0xa722('0x1d')],'type':_0x2501a9[_0xa722('0x1e')]['key']};});_0x2309a9['model']=_['map'](_0x8f17c6,'name');_0x2309a9[_0xa722('0x1f')]=_[_0xa722('0x20')](_0x5ee8ce[_0xa722('0x1f')]);_0x2309a9[_0xa722('0x21')]=_['intersection'](_0x2309a9[_0xa722('0x22')],_0x2309a9[_0xa722('0x1f')]);_0x2577a2[_0xa722('0x23')]=_[_0xa722('0x24')](_0x2309a9[_0xa722('0x22')],qs[_0xa722('0x25')](_0x5ee8ce[_0xa722('0x1f')][_0xa722('0x25')]));_0x2577a2[_0xa722('0x23')]=_0x2577a2[_0xa722('0x23')][_0xa722('0x26')]?_0x2577a2['attributes']:_0x2309a9[_0xa722('0x22')];if(!_0x5ee8ce[_0xa722('0x1f')]['hasOwnProperty']('nolimit')){_0x2577a2[_0xa722('0xe')]=qs['limit'](_0x5ee8ce[_0xa722('0x1f')][_0xa722('0xe')]);_0x2577a2['offset']=qs[_0xa722('0xb')](_0x5ee8ce[_0xa722('0x1f')]['offset']);}_0x2577a2['order']=qs['sort'](_0x5ee8ce[_0xa722('0x1f')][_0xa722('0x27')]);_0x2577a2[_0xa722('0x28')]=qs['filters'](_['pick'](_0x5ee8ce[_0xa722('0x1f')],_0x2309a9[_0xa722('0x21')]),_0x8f17c6);if(_0x5ee8ce['query'][_0xa722('0x29')]){_0x2577a2[_0xa722('0x28')]=_[_0xa722('0x2a')](_0x2577a2[_0xa722('0x28')],{'$or':_[_0xa722('0x1a')](_0x8f17c6,function(_0xadc720){if(_0xadc720[_0xa722('0x1e')]!=='VIRTUAL'){var _0x4349c9={};_0x4349c9[_0xadc720[_0xa722('0x2b')]]={'$like':'%'+_0x5ee8ce[_0xa722('0x1f')][_0xa722('0x29')]+'%'};return _0x4349c9;}})});}_0x2577a2=_[_0xa722('0x2a')]({},_0x2577a2,_0x5ee8ce['options']);var _0xbc1be={'where':_0x2577a2['where']};return db[_0xa722('0x1b')][_0xa722('0xd')](_0xbc1be)[_0xa722('0x12')](function(_0x276218){_0x1df111[_0xa722('0xd')]=_0x276218;if(_0x5ee8ce[_0xa722('0x1f')][_0xa722('0x2c')]){_0x2577a2['include']=[{'all':!![]}];}return db[_0xa722('0x1b')]['findAll'](_0x2577a2);})['then'](function(_0x5aceb7){_0x1df111[_0xa722('0x2d')]=_['map'](_0x5aceb7,function(_0x372b89){if(_0x372b89['service']===_0xa722('0x2e')){var _0x2a58bd=encryptor[_0xa722('0x2f')](_0x372b89[_0xa722('0x30')]);_0x372b89[_0xa722('0x30')]=maskClientSecret(_0x2a58bd);}return _0x372b89;});return _0x1df111;})['then'](respondWithFilteredResult(_0x4a8c27,_0x2577a2))[_0xa722('0x31')](handleError(_0x4a8c27,null));};exports['show']=function(_0x58e3d3,_0x5d2129){var _0x5b2fa8={'raw':!![],'where':{'id':_0x58e3d3[_0xa722('0x32')]['id']}},_0x1906cf={};_0x1906cf['model']=_[_0xa722('0x20')](db[_0xa722('0x1b')][_0xa722('0x1c')]);_0x1906cf[_0xa722('0x1f')]=_[_0xa722('0x20')](_0x58e3d3[_0xa722('0x1f')]);_0x1906cf[_0xa722('0x21')]=_[_0xa722('0x24')](_0x1906cf[_0xa722('0x22')],_0x1906cf['query']);_0x5b2fa8[_0xa722('0x23')]=_[_0xa722('0x24')](_0x1906cf['model'],qs[_0xa722('0x25')](_0x58e3d3['query'][_0xa722('0x25')]));_0x5b2fa8['attributes']=_0x5b2fa8[_0xa722('0x23')][_0xa722('0x26')]?_0x5b2fa8['attributes']:_0x1906cf[_0xa722('0x22')];if(_0x58e3d3[_0xa722('0x1f')][_0xa722('0x2c')]){_0x5b2fa8['include']=[{'all':!![]}];}_0x5b2fa8=_[_0xa722('0x2a')]({},_0x5b2fa8,_0x58e3d3[_0xa722('0x33')]);return db[_0xa722('0x1b')][_0xa722('0x34')](_0x5b2fa8)[_0xa722('0x12')](handleEntityNotFound(_0x5d2129,null))[_0xa722('0x12')](function(_0x23d56f){if(_0x23d56f[_0xa722('0x35')]==='MicrosoftAzure'){var _0x1ca56f=encryptor[_0xa722('0x2f')](_0x23d56f[_0xa722('0x30')]);_0x23d56f[_0xa722('0x30')]=maskClientSecret(_0x1ca56f);}return _0x23d56f;})['then'](respondWithResult(_0x5d2129,null))[_0xa722('0x31')](handleError(_0x5d2129,null));};exports[_0xa722('0x36')]=function(_0x7af41a,_0x127ac1){if(!_0x7af41a['body'][_0xa722('0x2b')])throw new Error(_0xa722('0x37'));if(!_0x7af41a[_0xa722('0x38')]['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x4b9c0b=db[_0xa722('0x1b')][_0xa722('0x1c')][_0xa722('0x35')][_0xa722('0x39')];if(!_0x4b9c0b['includes'](_0x7af41a[_0xa722('0x38')][_0xa722('0x35')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x4b9c0b[_0xa722('0x3a')](',\x20'));if(_0x7af41a[_0xa722('0x38')][_0xa722('0x35')]===_0xa722('0x2e')&&_0x7af41a['body'][_0xa722('0x30')]){_0x7af41a[_0xa722('0x38')][_0xa722('0x30')]=encryptor['encryptString'](_0x7af41a['body'][_0xa722('0x30')]);}return db[_0xa722('0x1b')][_0xa722('0x36')](_0x7af41a[_0xa722('0x38')],{})['then'](respondWithResult(_0x127ac1,0xc9))[_0xa722('0x31')](handleError(_0x127ac1,null));};exports[_0xa722('0x11')]=function(_0x11fadd,_0x2f5dce){if(_0x11fadd[_0xa722('0x38')]['id']){delete _0x11fadd[_0xa722('0x38')]['id'];}return db[_0xa722('0x1b')]['find']({'where':{'id':_0x11fadd['params']['id']}})[_0xa722('0x12')](handleEntityNotFound(_0x2f5dce,null))['then'](function(_0x5bda3e){if(_0x5bda3e[_0xa722('0x35')]===_0xa722('0x2e')&&_0x11fadd[_0xa722('0x38')][_0xa722('0x30')]){_0x11fadd[_0xa722('0x38')][_0xa722('0x30')]=encryptor['encryptString'](_0x11fadd['body']['data3']);}return _0x5bda3e;})[_0xa722('0x12')](saveUpdates(_0x11fadd['body'],null))[_0xa722('0x12')](respondWithResult(_0x2f5dce,null))[_0xa722('0x31')](handleError(_0x2f5dce,null));};exports[_0xa722('0x13')]=function(_0x581ad6,_0x2259e1){return db[_0xa722('0x1b')][_0xa722('0x34')]({'where':{'id':_0x581ad6[_0xa722('0x32')]['id']}})[_0xa722('0x12')](handleEntityNotFound(_0x2259e1,null))[_0xa722('0x12')](removeEntity(_0x2259e1,null))[_0xa722('0x31')](handleError(_0x2259e1,null));};exports[_0xa722('0x3b')]=function(_0x14ef14,_0x3c1442){return db[_0xa722('0x1b')][_0xa722('0x3c')]({'where':{'id':_0x14ef14['params']['id']},'raw':!![]})['then'](function(_0x4aacbe){if(!_0x4aacbe)return _0x3c1442[_0xa722('0x8')](0x194);return{'url':oauth[_0xa722('0x3d')](_0x4aacbe,_0x14ef14['user']['id'])};})['then'](respondWithResult(_0x3c1442,null))[_0xa722('0x31')](handleError(_0x3c1442,null));};exports[_0xa722('0x3e')]=function(_0x70b871,_0x1f620c){var _0x159555=_0x70b871[_0xa722('0x38')];var _0x4be7ef;var _0x129a9c;if(_0x159555[_0xa722('0x15')])throw _0x159555;redis[_0xa722('0x3f')](_0x159555[_0xa722('0x40')])[_0xa722('0x12')](function(_0x5961a2){if(!_0x5961a2)throw new Error(_0xa722('0x41'));_0x4be7ef=JSON[_0xa722('0x42')](_0x5961a2);var _0x49df3c=Buffer['from'](_0x159555[_0xa722('0x40')],_0xa722('0x43'))[_0xa722('0x44')](_0xa722('0x45'));_0x129a9c=JSON[_0xa722('0x42')](_0x49df3c);if(!oauth['isValidIdToken'](_0x159555[_0xa722('0x46')],_0x4be7ef[_0xa722('0x47')]))throw new Error(_0xa722('0x48'));redis[_0xa722('0x49')](_0x159555[_0xa722('0x40')]);return oauth[_0xa722('0x4a')](_0x159555[_0xa722('0x4b')],_0x4be7ef);})[_0xa722('0x12')](function(_0x22407a){_0x4be7ef[_0xa722('0x4c')]=_0x22407a[_0xa722('0x4d')];_0x4be7ef[_0xa722('0x4e')]=_0x22407a[_0xa722('0x4f')];return db[_0xa722('0x1b')]['update']({'data5':_0x4be7ef[_0xa722('0x4c')],'data6':_0x4be7ef[_0xa722('0x4e')]},{'where':{'id':_0x4be7ef['id']}});})[_0xa722('0x12')](function(){oauth[_0xa722('0x50')](_0x4be7ef);socket[_0xa722('0x51')]('microsoftAuthorization:success',{'id':_0x129a9c['id']});return;})[_0xa722('0x12')](respondWithStatusCode(_0x1f620c,null))[_0xa722('0x31')](function(_0x1e96d7){if(_0x129a9c){socket[_0xa722('0x51')](_0xa722('0x52'),{'id':_0x129a9c['id']});}if(!_0x4be7ef){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x1e96d7);return _0x1f620c[_0xa722('0x9')](0x1f4)[_0xa722('0x17')](_0x1e96d7['message']);}logger[_0xa722('0x15')](_0xa722('0x53'),_0x4be7ef['id'],JSON[_0xa722('0x54')](_0x1e96d7));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4bf332f..84e4e7a 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 _0x47ee=['path','rimraf','../../config/environment','exports','define','cloud_providers','lodash','util','api','moment','request-promise'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x47ee,0x74));var _0xe47e=function(_0xbb3aa6,_0x5549d3){_0xbb3aa6=_0xbb3aa6-0x0;var _0x21038a=_0x47ee[_0xbb3aa6];return _0x21038a;};'use strict';var _=require(_0xe47e('0x0'));var util=require(_0xe47e('0x1'));var logger=require('../../config/logger')(_0xe47e('0x2'));var moment=require(_0xe47e('0x3'));var BPromise=require('bluebird');var rp=require(_0xe47e('0x4'));var fs=require('fs');var path=require(_0xe47e('0x5'));var rimraf=require(_0xe47e('0x6'));var config=require(_0xe47e('0x7'));var attributes=require('./cloudProvider.attributes');module[_0xe47e('0x8')]=function(_0x51631a,_0x2c854b){return _0x51631a[_0xe47e('0x9')]('CloudProvider',attributes,{'tableName':_0xe47e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf54=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','util'];(function(_0x52a619,_0x35bf3e){var _0x2a78d5=function(_0xe884f0){while(--_0xe884f0){_0x52a619['push'](_0x52a619['shift']());}};_0x2a78d5(++_0x35bf3e);}(_0xbf54,0x1a3));var _0x4bf5=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xbf54[_0x99868f];return _0x27a71b;};'use strict';var _=require('lodash');var util=require(_0x4bf5('0x0'));var logger=require(_0x4bf5('0x1'))('api');var moment=require(_0x4bf5('0x2'));var BPromise=require(_0x4bf5('0x3'));var rp=require(_0x4bf5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4bf5('0x5'));var config=require(_0x4bf5('0x6'));var attributes=require(_0x4bf5('0x7'));module[_0x4bf5('0x8')]=function(_0x3cd75b,_0x43831e){return _0x3cd75b['define'](_0x4bf5('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index c29404a..f9697a1 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 _0xe3dd=['oauth2Claims','oauth2/','decode','payload','aud','audience','nonce','isAfter','unix','resolve','then','CloudProvider','findOne','refresh_token','decryptString','data3','POST','access_token','data6','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','openid','/authorize','/token','map','type','Dynamics365','data7','/.default','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','data2','code','id_token','stringify','base64','randomBytes','toString','client_id','data1','join','redirect_uri','data4','form_post','state','prompt','login','key','value'];(function(_0x2b5b63,_0x4cb9e9){var _0x1591b3=function(_0x126d92){while(--_0x126d92){_0x2b5b63['push'](_0x2b5b63['shift']());}};_0x1591b3(++_0x4cb9e9);}(_0xe3dd,0x6a));var _0xde3d=function(_0x544ec8,_0x543e34){_0x544ec8=_0x544ec8-0x0;var _0x2b95a7=_0xe3dd[_0x544ec8];return _0x2b95a7;};'use strict';var _=require('lodash');var crypto=require(_0xde3d('0x0'));var jwt=require(_0xde3d('0x1'));var moment=require(_0xde3d('0x2'));var Redis=require(_0xde3d('0x3'));var rp=require(_0xde3d('0x4'));var util=require(_0xde3d('0x5'));var encryptor=require(_0xde3d('0x6'));var config=require('../../config/environment');var logger=require(_0xde3d('0x7'))(_0xde3d('0x8'));var schedule=require(_0xde3d('0x9'));var db=require('../../mysqldb')['db'];config[_0xde3d('0xa')]=_['defaults'](config[_0xde3d('0xa')],{'host':_0xde3d('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xde3d('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xde3d('0xd'),_0xde3d('0xe'),_0xde3d('0xf'),'https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xde3d('0x10'),_0xde3d('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0xde3d('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0xde3d('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x328930){var _0xa04bab=_[_0xde3d('0x13')](AZURE_AUTH_SCOPES[_0x328930[_0xde3d('0x14')]]);if(_0x328930[_0xde3d('0x14')]===_0xde3d('0x15'))_0xa04bab['push'](_0x328930[_0xde3d('0x16')]+_0xde3d('0x17'));return _0xa04bab['join']('\x20');}function getAccessTokenScope(_0x3e2d5c){if(_0x3e2d5c['type']===_0xde3d('0x18'))return _0xde3d('0x19');if(_0x3e2d5c[_0xde3d('0x14')]===_0xde3d('0x15'))return _0x3e2d5c['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4f1e7c,_0x28d996){var _0x2d8c5a=MICROSOFT_AUTH_URL[_0xde3d('0x1a')](_0xde3d('0x1b'),_0x4f1e7c[_0xde3d('0x1c')]);var _0x2de1c6=[_0xde3d('0x1d'),_0xde3d('0x1e')];var _0x587814=Buffer['from'](JSON[_0xde3d('0x1f')]({'id':_0x28d996}))['toString'](_0xde3d('0x20'));var _0x172935=crypto[_0xde3d('0x21')](0x10)[_0xde3d('0x22')]('hex');var _0x393276=getAuthorizationScopes(_0x4f1e7c);var _0x4e0473=[{'key':_0xde3d('0x23'),'value':_0x4f1e7c[_0xde3d('0x24')]},{'key':'response_type','value':encodeURIComponent(_0x2de1c6[_0xde3d('0x25')]('\x20'))},{'key':_0xde3d('0x26'),'value':_0x4f1e7c[_0xde3d('0x27')]},{'key':'response_mode','value':_0xde3d('0x28')},{'key':'scope','value':encodeURIComponent(_0x393276)},{'key':_0xde3d('0x29'),'value':_0x587814},{'key':'nonce','value':_0x172935},{'key':_0xde3d('0x2a'),'value':_0xde3d('0x2b')}];var _0xf1405=_0x2d8c5a+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xde3d('0x13')](_0x4e0473,function(_0x47bb46){return _0x47bb46[_0xde3d('0x2c')]+'='+_0x47bb46[_0xde3d('0x2d')];})[_0xde3d('0x25')]('&');_0x4f1e7c[_0xde3d('0x2e')]={'issuer':_0x2d8c5a['replace'](_0xde3d('0x2f'),''),'audience':_0x4f1e7c[_0xde3d('0x24')],'state':_0x587814,'nonce':_0x172935};redis['set'](_0x587814,JSON[_0xde3d('0x1f')](_0x4f1e7c));return _0xf1405;}function isValidIdToken(_0x1e541b,_0x1c972b){try{var _0xcae7b4=jwt[_0xde3d('0x30')](_0x1e541b,{'complete':!![]});var _0x20943e=_0xcae7b4[_0xde3d('0x31')];if(_0x20943e['iss']!==_0x1c972b['issuer'])return![];if(_0x20943e[_0xde3d('0x32')]!==_0x1c972b[_0xde3d('0x33')])return![];if(_0x20943e['nonce']!==_0x1c972b[_0xde3d('0x34')])return![];if(moment()[_0xde3d('0x35')](moment[_0xde3d('0x36')](_0x20943e['exp'])))return![];return!![];}catch(_0x10e01e){throw _0x10e01e;}}function refreshOauth2MicrosoftAccessToken(_0x6b410){return Promise[_0xde3d('0x37')]()[_0xde3d('0x38')](function(){if(_0x6b410['data3'])return _0x6b410;return db[_0xde3d('0x39')][_0xde3d('0x3a')]({'where':{'id':_0x6b410['id']},'raw':!![]});})['then'](function(_0x351341){var _0x34880e={'grant_type':_0xde3d('0x3b'),'refresh_token':_0x351341['data6'],'scope':getAccessTokenScope(_0x351341),'redirect_uri':_0x351341[_0xde3d('0x27')],'client_id':_0x351341[_0xde3d('0x24')],'client_secret':encryptor[_0xde3d('0x3c')](_0x351341[_0xde3d('0x3d')])};var _0x1b561b={'method':_0xde3d('0x3e'),'uri':MICROSOFT_AUTH_URL['replace'](_0xde3d('0x1b'),_0x351341[_0xde3d('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x34880e,'json':!![]};return rp(_0x1b561b);})[_0xde3d('0x38')](function(_0x3024b0){_0x6b410['data5']=_0x3024b0[_0xde3d('0x3f')];_0x6b410[_0xde3d('0x40')]=_0x3024b0[_0xde3d('0x3b')];return db[_0xde3d('0x39')][_0xde3d('0x41')]({'data5':_0x6b410[_0xde3d('0x42')],'data6':_0x6b410[_0xde3d('0x40')]},{'where':{'id':_0x6b410['id']}});})['then'](function(){return _0x6b410;})[_0xde3d('0x43')](function(_0xe400ec){logger[_0xde3d('0x44')](_0xde3d('0x45'),_0x6b410['id'],_0xe400ec);});}function getOauth2MicrosoftAccessToken(_0x36e242,_0x6c6227){var _0x367ac9={'grant_type':'authorization_code','code':_0x36e242,'scope':getAccessTokenScope(_0x6c6227),'redirect_uri':_0x6c6227[_0xde3d('0x27')],'client_id':_0x6c6227[_0xde3d('0x24')],'client_secret':encryptor[_0xde3d('0x3c')](_0x6c6227[_0xde3d('0x3d')])};var _0x465d08={'method':_0xde3d('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xde3d('0x1a')]('{TENANT_ID}',_0x6c6227[_0xde3d('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x367ac9,'json':!![]};return rp(_0x465d08);}function startRefreshInterval(_0x2252d8){var _0x547889=schedule[_0xde3d('0x46')];if(_0x547889[_0x2252d8['id']])clearInterval(_0x547889[_0x2252d8['id']]);_0x547889[_0x2252d8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xde3d('0x47')](this,{'id':_0x2252d8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xde3d('0x46')]=_0x547889;}function startAllRefreshIntervals(){return db[_0xde3d('0x39')][_0xde3d('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xde3d('0x38')](function(_0x3b184e){var _0x55ec3b=_0x3b184e['map'](function(_0x479bae){return refreshOauth2MicrosoftAccessToken(_0x479bae)['then'](function(_0x53477e){startRefreshInterval(_0x53477e);});});return Promise[_0xde3d('0x49')](_0x55ec3b);})[_0xde3d('0x43')](function(_0x4b65b0){var _0x4ad6b6=_0x4b65b0?util[_0xde3d('0x4a')](_0x4b65b0,{'showHidden':![],'depth':null}):'';logger[_0xde3d('0x44')](_0xde3d('0x4b'),_0x4ad6b6);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xe9f0=['data1','response_type','form_post','scope','state','login','key','oauth2Claims','oauth2/','set','decode','payload','iss','aud','audience','nonce','unix','exp','resolve','then','CloudProvider','findOne','data6','decryptString','data3','POST','refresh_token','update','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data4','intervals','bind','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','moment','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','redis','defaults','localhost','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','from','stringify','toString','base64','randomBytes','hex','client_id'];(function(_0x330a92,_0x18e955){var _0xe1bf98=function(_0xb39f66){while(--_0xb39f66){_0x330a92['push'](_0x330a92['shift']());}};_0xe1bf98(++_0x18e955);}(_0xe9f0,0x71));var _0x0e9f=function(_0x12e7a4,_0x4b2da3){_0x12e7a4=_0x12e7a4-0x0;var _0x1a9701=_0xe9f0[_0x12e7a4];return _0x1a9701;};'use strict';var _=require('lodash');var crypto=require(_0x0e9f('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0x0e9f('0x1'));var Redis=require('ioredis');var rp=require('request-promise');var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0x0e9f('0x2'));var logger=require(_0x0e9f('0x3'))('api');var schedule=require(_0x0e9f('0x4'));var db=require('../../mysqldb')['db'];config[_0x0e9f('0x5')]=_[_0x0e9f('0x6')](config[_0x0e9f('0x5')],{'host':_0x0e9f('0x7'),'port':0x18eb});var redis=new Redis(config[_0x0e9f('0x5')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x0e9f('0x8'),_0x0e9f('0x9'),_0x0e9f('0xa'),_0x0e9f('0xb'),_0x0e9f('0xc'),'https://outlook.office.com/POP.AccessAsUser.All',_0x0e9f('0xd')],'Dynamics365':[_0x0e9f('0x8'),_0x0e9f('0xb')]};var MICROSOFT_AUTH_ENDPOINT=_0x0e9f('0xe');var MICROSOFT_TOKEN_ENDPOINT=_0x0e9f('0xf');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x44f01a){var _0x32017a=_[_0x0e9f('0x10')](AZURE_AUTH_SCOPES[_0x44f01a[_0x0e9f('0x11')]]);if(_0x44f01a['type']===_0x0e9f('0x12'))_0x32017a[_0x0e9f('0x13')](_0x44f01a[_0x0e9f('0x14')]+_0x0e9f('0x15'));return _0x32017a[_0x0e9f('0x16')]('\x20');}function getAccessTokenScope(_0x15cb31){if(_0x15cb31[_0x0e9f('0x11')]===_0x0e9f('0x17'))return _0x0e9f('0xc');if(_0x15cb31['type']===_0x0e9f('0x12'))return _0x15cb31[_0x0e9f('0x14')]+_0x0e9f('0x15');}function generateMicrosoftAuthorizationUrl(_0x55e3f0,_0x44e400){var _0x13353d=MICROSOFT_AUTH_URL[_0x0e9f('0x18')](_0x0e9f('0x19'),_0x55e3f0[_0x0e9f('0x1a')]);var _0x503872=[_0x0e9f('0x1b'),'id_token'];var _0x384e1e=Buffer[_0x0e9f('0x1c')](JSON[_0x0e9f('0x1d')]({'id':_0x44e400}))[_0x0e9f('0x1e')](_0x0e9f('0x1f'));var _0x490ce1=crypto[_0x0e9f('0x20')](0x10)['toString'](_0x0e9f('0x21'));var _0x5bc54c=getAuthorizationScopes(_0x55e3f0);var _0x399a09=[{'key':_0x0e9f('0x22'),'value':_0x55e3f0[_0x0e9f('0x23')]},{'key':_0x0e9f('0x24'),'value':encodeURIComponent(_0x503872[_0x0e9f('0x16')]('\x20'))},{'key':'redirect_uri','value':_0x55e3f0['data4']},{'key':'response_mode','value':_0x0e9f('0x25')},{'key':_0x0e9f('0x26'),'value':encodeURIComponent(_0x5bc54c)},{'key':_0x0e9f('0x27'),'value':_0x384e1e},{'key':'nonce','value':_0x490ce1},{'key':'prompt','value':_0x0e9f('0x28')}];var _0x4fe737=_0x13353d+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x0e9f('0x10')](_0x399a09,function(_0x3ff7d4){return _0x3ff7d4[_0x0e9f('0x29')]+'='+_0x3ff7d4['value'];})[_0x0e9f('0x16')]('&');_0x55e3f0[_0x0e9f('0x2a')]={'issuer':_0x13353d['replace'](_0x0e9f('0x2b'),''),'audience':_0x55e3f0[_0x0e9f('0x23')],'state':_0x384e1e,'nonce':_0x490ce1};redis[_0x0e9f('0x2c')](_0x384e1e,JSON[_0x0e9f('0x1d')](_0x55e3f0));return _0x4fe737;}function isValidIdToken(_0x597730,_0x4310d7){try{var _0x376c64=jwt[_0x0e9f('0x2d')](_0x597730,{'complete':!![]});var _0x532267=_0x376c64[_0x0e9f('0x2e')];if(_0x532267[_0x0e9f('0x2f')]!==_0x4310d7['issuer'])return![];if(_0x532267[_0x0e9f('0x30')]!==_0x4310d7[_0x0e9f('0x31')])return![];if(_0x532267[_0x0e9f('0x32')]!==_0x4310d7[_0x0e9f('0x32')])return![];if(moment()['isAfter'](moment[_0x0e9f('0x33')](_0x532267[_0x0e9f('0x34')])))return![];return!![];}catch(_0x593306){throw _0x593306;}}function refreshOauth2MicrosoftAccessToken(_0x4d454d){return Promise[_0x0e9f('0x35')]()[_0x0e9f('0x36')](function(){if(_0x4d454d['data3'])return _0x4d454d;return db[_0x0e9f('0x37')][_0x0e9f('0x38')]({'where':{'id':_0x4d454d['id']},'raw':!![]});})[_0x0e9f('0x36')](function(_0x567c2e){var _0x2ac43c={'grant_type':'refresh_token','refresh_token':_0x567c2e[_0x0e9f('0x39')],'scope':getAccessTokenScope(_0x567c2e),'redirect_uri':_0x567c2e['data4'],'client_id':_0x567c2e[_0x0e9f('0x23')],'client_secret':encryptor[_0x0e9f('0x3a')](_0x567c2e[_0x0e9f('0x3b')])};var _0x200ce5={'method':_0x0e9f('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x0e9f('0x18')](_0x0e9f('0x19'),_0x567c2e[_0x0e9f('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2ac43c,'json':!![]};return rp(_0x200ce5);})[_0x0e9f('0x36')](function(_0xc50bfb){_0x4d454d['data5']=_0xc50bfb['access_token'];_0x4d454d[_0x0e9f('0x39')]=_0xc50bfb[_0x0e9f('0x3d')];return db[_0x0e9f('0x37')][_0x0e9f('0x3e')]({'data5':_0x4d454d[_0x0e9f('0x3f')],'data6':_0x4d454d[_0x0e9f('0x39')]},{'where':{'id':_0x4d454d['id']}});})['then'](function(){return _0x4d454d;})['catch'](function(_0x30a066){logger[_0x0e9f('0x40')](_0x0e9f('0x41'),_0x4d454d['id'],_0x30a066);});}function getOauth2MicrosoftAccessToken(_0x1c932b,_0x359c48){var _0x5dad88={'grant_type':'authorization_code','code':_0x1c932b,'scope':getAccessTokenScope(_0x359c48),'redirect_uri':_0x359c48[_0x0e9f('0x42')],'client_id':_0x359c48[_0x0e9f('0x23')],'client_secret':encryptor[_0x0e9f('0x3a')](_0x359c48[_0x0e9f('0x3b')])};var _0x43e71b={'method':_0x0e9f('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x0e9f('0x18')](_0x0e9f('0x19'),_0x359c48['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5dad88,'json':!![]};return rp(_0x43e71b);}function startRefreshInterval(_0x461dc0){var _0x459125=schedule[_0x0e9f('0x43')];if(_0x459125[_0x461dc0['id']])clearInterval(_0x459125[_0x461dc0['id']]);_0x459125[_0x461dc0['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x0e9f('0x44')](this,{'id':_0x461dc0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x459125;}function startAllRefreshIntervals(){return db[_0x0e9f('0x37')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x0e9f('0x36')](function(_0x20e0fe){var _0x498581=_0x20e0fe['map'](function(_0x55882f){return refreshOauth2MicrosoftAccessToken(_0x55882f)[_0x0e9f('0x36')](function(_0xa0637e){startRefreshInterval(_0xa0637e);});});return Promise[_0x0e9f('0x45')](_0x498581);})[_0x0e9f('0x46')](function(_0x13e190){var _0x21286f=_0x13e190?util[_0x0e9f('0x47')](_0x13e190,{'showHidden':![],'depth':null}):'';logger[_0x0e9f('0x40')](_0x0e9f('0x48'),_0x21286f);});}module[_0x0e9f('0x49')]={'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 a03d1ad..7cd39a0 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 _0xf34f=['code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','stringify','error'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xf34f,0x64));var _0xff34=function(_0x1ff38f,_0x4ccdf8){_0x1ff38f=_0x1ff38f-0x0;var _0xf575ad=_0xf34f[_0x1ff38f];return _0xf575ad;};'use strict';var _=require(_0xff34('0x0'));var util=require('util');var moment=require(_0xff34('0x1'));var BPromise=require('bluebird');var rs=require(_0xff34('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff34('0x3'))['db'];var utils=require(_0xff34('0x4'));var logger=require(_0xff34('0x5'))('rpc');var config=require(_0xff34('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xff34('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444e6a,_0x5e6f92,_0x45036f){return new BPromise(function(_0x46d761,_0x5c1668){return client['request'](_0x444e6a,_0x45036f)[_0xff34('0x8')](function(_0xe76c05){logger[_0xff34('0x9')]('CloudProvider,\x20%s,\x20%s',_0x5e6f92,_0xff34('0xa'));logger[_0xff34('0xb')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5e6f92,_0xff34('0xa'),JSON[_0xff34('0xc')](_0xe76c05));if(_0xe76c05[_0xff34('0xd')]){if(_0xe76c05['error'][_0xff34('0xe')]===0x1f4){logger[_0xff34('0xd')](_0xff34('0xf'),_0x5e6f92,_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);return _0x5c1668(_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);}logger[_0xff34('0xd')](_0xff34('0xf'),_0x5e6f92,_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);return _0x46d761(_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);}else{logger[_0xff34('0x9')](_0xff34('0xf'),_0x5e6f92,_0xff34('0xa'));_0x46d761(_0xe76c05[_0xff34('0x11')][_0xff34('0x10')]);}})[_0xff34('0x12')](function(_0xf5e0ec){logger['error'](_0xff34('0xf'),_0x5e6f92,_0xf5e0ec);_0x5c1668(_0xf5e0ec);});});} \ No newline at end of file +var _0x235b=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info'];(function(_0xe090db,_0x3a8919){var _0x23f998=function(_0x22f84a){while(--_0x22f84a){_0xe090db['push'](_0xe090db['shift']());}};_0x23f998(++_0x3a8919);}(_0x235b,0x1ed));var _0xb235=function(_0x18cf19,_0x5cf12d){_0x18cf19=_0x18cf19-0x0;var _0x473383=_0x235b[_0x18cf19];return _0x473383;};'use strict';var _=require(_0xb235('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb235('0x1'));var rs=require(_0xb235('0x2'));var fs=require('fs');var Redis=require(_0xb235('0x3'));var db=require(_0xb235('0x4'))['db'];var utils=require(_0xb235('0x5'));var logger=require(_0xb235('0x6'))('rpc');var config=require(_0xb235('0x7'));var jayson=require(_0xb235('0x8'));var client=jayson[_0xb235('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12d0ae,_0x44559a,_0x2affe8){return new BPromise(function(_0x436d63,_0x3241b4){return client['request'](_0x12d0ae,_0x2affe8)['then'](function(_0xecf759){logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));logger[_0xb235('0xd')](_0xb235('0xe'),_0x44559a,_0xb235('0xc'),JSON[_0xb235('0xf')](_0xecf759));if(_0xecf759['error']){if(_0xecf759[_0xb235('0x10')][_0xb235('0x11')]===0x1f4){logger[_0xb235('0x10')]('CloudProvider,\x20%s,\x20%s',_0x44559a,_0xecf759[_0xb235('0x10')]['message']);return _0x3241b4(_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);}logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);return _0x436d63(_0xecf759[_0xb235('0x10')]['message']);}else{logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));_0x436d63(_0xecf759[_0xb235('0x13')][_0xb235('0x12')]);}})[_0xb235('0x14')](function(_0x16f044){logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0x16f044);_0x3241b4(_0x16f044);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 554559d..dbf227c 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x430494,_0xc6a09e){var _0x7a25a2=function(_0x91579e){while(--_0x91579e){_0x430494['push'](_0x430494['shift']());}};_0x7a25a2(++_0xc6a09e);}(_0x2ef3,0xba));var _0x32ef=function(_0x19e388,_0x53f579){_0x19e388=_0x19e388-0x0;var _0xc0b2=_0x2ef3[_0x19e388];return _0xc0b2;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x5c32f9,_0xdf7983){var _0x19cb04=function(_0x47fc9e){while(--_0x47fc9e){_0x5c32f9['push'](_0x5c32f9['shift']());}};_0x19cb04(++_0xdf7983);}(_0x2ef3,0xba));var _0x32ef=function(_0x3fd109,_0x38304){_0x3fd109=_0x3fd109-0x0;var _0x2b64bf=_0x2ef3[_0x3fd109];return _0x2b64bf;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 10ea859..8bc66e8 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 _0xb63f=['exports','name','STRING','sequelize'];(function(_0x561c10,_0xe9cb){var _0x1c5d24=function(_0x566e57){while(--_0x566e57){_0x561c10['push'](_0x561c10['shift']());}};_0x1c5d24(++_0xe9cb);}(_0xb63f,0x193));var _0xfb63=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0xb63f[_0x3c2166];return _0x30ccc3;};'use strict';var Sequelize=require(_0xfb63('0x0'));module[_0xfb63('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfb63('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfb63('0x3')]},'companyId':{'type':Sequelize[_0xfb63('0x3')]},'website':{'type':Sequelize[_0xfb63('0x3')]},'phone':{'type':Sequelize[_0xfb63('0x3')]},'fax':{'type':Sequelize[_0xfb63('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xfb63('0x3')]},'postalCode':{'type':Sequelize[_0xfb63('0x3')]},'city':{'type':Sequelize[_0xfb63('0x3')]},'country':{'type':Sequelize[_0xfb63('0x3')]},'email':{'type':Sequelize[_0xfb63('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xfb63('0x3')]},'sStreet':{'type':Sequelize[_0xfb63('0x3')]},'sPostalCode':{'type':Sequelize[_0xfb63('0x3')]},'sCity':{'type':Sequelize[_0xfb63('0x3')]},'sCountry':{'type':Sequelize[_0xfb63('0x3')]},'description':{'type':Sequelize[_0xfb63('0x3')]}}; \ No newline at end of file +var _0xad68=['STRING','name','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xad68,0x102));var _0x8ad6=function(_0x40fede,_0x203a11){_0x40fede=_0x40fede-0x0;var _0x482694=_0xad68[_0x40fede];return _0x482694;};'use strict';var Sequelize=require(_0x8ad6('0x0'));module[_0x8ad6('0x1')]={'name':{'type':Sequelize[_0x8ad6('0x2')],'unique':_0x8ad6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x8ad6('0x2')]},'website':{'type':Sequelize[_0x8ad6('0x2')]},'phone':{'type':Sequelize[_0x8ad6('0x2')]},'fax':{'type':Sequelize[_0x8ad6('0x2')]},'type':{'type':Sequelize[_0x8ad6('0x2')]},'street':{'type':Sequelize[_0x8ad6('0x2')]},'postalCode':{'type':Sequelize[_0x8ad6('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8ad6('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8ad6('0x2')]},'sCity':{'type':Sequelize[_0x8ad6('0x2')]},'sCountry':{'type':Sequelize[_0x8ad6('0x2')]},'description':{'type':Sequelize[_0x8ad6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b90bd2e..f008dec 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 _0xacee=['ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','CmCompany','filters','intersection','model','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','includeAll','include','findAll','rows','catch','keys','rawAttributes','options','find','create','body','Companies','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','params','omit','ids','findOne','CmContact','getContacts','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacee,0x1e9));var _0xeace=function(_0x21ace9,_0x5a5f59){_0x21ace9=_0x21ace9-0x0;var _0xcc4404=_0xacee[_0x21ace9];return _0xcc4404;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeace('0x0'));var zipdir=require(_0xeace('0x1'));var jsonpatch=require(_0xeace('0x2'));var rp=require('request-promise');var moment=require(_0xeace('0x3'));var BPromise=require(_0xeace('0x4'));var Mustache=require(_0xeace('0x5'));var util=require(_0xeace('0x6'));var path=require(_0xeace('0x7'));var sox=require(_0xeace('0x8'));var csv=require(_0xeace('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeace('0xa'));var squel=require('squel');var crypto=require(_0xeace('0xb'));var jsforce=require(_0xeace('0xc'));var deskjs=require(_0xeace('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeace('0xe'));var Papa=require('papaparse');var Redis=require(_0xeace('0xf'));var authService=require(_0xeace('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeace('0x11'))('api');var utils=require(_0xeace('0x12'));var config=require(_0xeace('0x13'));var licenseUtil=require(_0xeace('0x14'));var db=require(_0xeace('0x15'))['db'];function respondWithStatusCode(_0x1fc68f,_0x1353a0){_0x1353a0=_0x1353a0||0xcc;return function(_0x1ff912){if(_0x1ff912){return _0x1fc68f['sendStatus'](_0x1353a0);}return _0x1fc68f['status'](_0x1353a0)[_0xeace('0x16')]();};}function respondWithResult(_0x2acce4,_0x2da742){_0x2da742=_0x2da742||0xc8;return function(_0x98da51){if(_0x98da51){return _0x2acce4[_0xeace('0x17')](_0x2da742)[_0xeace('0x18')](_0x98da51);}};}function respondWithFilteredResult(_0x5543d0,_0x5dc451){return function(_0x379f6e){if(_0x379f6e){var _0x46a540=typeof _0x5dc451[_0xeace('0x19')]===_0xeace('0x1a')&&typeof _0x5dc451[_0xeace('0x1b')]===_0xeace('0x1a');var _0x303fd2=_0x379f6e[_0xeace('0x1c')];var _0x556829=_0x46a540?0x0:_0x5dc451[_0xeace('0x19')];var _0x4e5afc=_0x46a540?_0x379f6e[_0xeace('0x1c')]:_0x5dc451[_0xeace('0x19')]+_0x5dc451[_0xeace('0x1b')];var _0x90ad51;if(_0x4e5afc>=_0x303fd2){_0x4e5afc=_0x303fd2;_0x90ad51=0xc8;}else{_0x90ad51=0xce;}_0x5543d0[_0xeace('0x17')](_0x90ad51);return _0x5543d0[_0xeace('0x1d')](_0xeace('0x1e'),_0x556829+'-'+_0x4e5afc+'/'+_0x303fd2)['json'](_0x379f6e);}return null;};}function patchUpdates(_0x49a4e8){return function(_0x1cae49){try{jsonpatch[_0xeace('0x1f')](_0x1cae49,_0x49a4e8,!![]);}catch(_0x4e74a2){return BPromise['reject'](_0x4e74a2);}return _0x1cae49[_0xeace('0x20')]();};}function saveUpdates(_0x4a2766,_0x25357b){return function(_0xc9411d){if(_0xc9411d){return _0xc9411d[_0xeace('0x21')](_0x4a2766)[_0xeace('0x22')](function(_0x2fc842){return _0x2fc842;});}return null;};}function removeEntity(_0x391a3e,_0x386c6e){return function(_0x133b45){if(_0x133b45){return _0x133b45['destroy']()[_0xeace('0x22')](function(){var _0x24eee8=_0x133b45[_0xeace('0x23')]({'plain':!![]});var _0x6423b3='Companies';return db[_0xeace('0x24')][_0xeace('0x25')]({'where':{'type':_0x6423b3,'resourceId':_0x24eee8['id']}})[_0xeace('0x22')](function(){return _0x133b45;});})[_0xeace('0x22')](function(){_0x391a3e[_0xeace('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12e814,_0x499948){return function(_0x9b745f){if(!_0x9b745f){_0x12e814[_0xeace('0x26')](0x194);}return _0x9b745f;};}function handleError(_0x26b791,_0x22b047){_0x22b047=_0x22b047||0x1f4;return function(_0x312678){logger['error'](_0x312678[_0xeace('0x27')]);if(_0x312678[_0xeace('0x28')]){delete _0x312678[_0xeace('0x28')];}_0x26b791[_0xeace('0x17')](_0x22b047)[_0xeace('0x29')](_0x312678);};}exports[_0xeace('0x2a')]=function(_0x35a0ea,_0xaa2fcb){var _0x12bea5={},_0x33c0cc={},_0x5493da={'count':0x0,'rows':[]};return db[_0xeace('0x2b')]['describe']()[_0xeace('0x22')](function(_0x12bc1b){_0x33c0cc['model']=_['keys'](_0x12bc1b);_0x33c0cc['query']=_['keys'](_0x35a0ea['query']);_0x33c0cc[_0xeace('0x2c')]=_[_0xeace('0x2d')](_0x33c0cc[_0xeace('0x2e')],_0x33c0cc['query']);_0x12bea5['attributes']=_[_0xeace('0x2d')](_0x33c0cc['model'],qs[_0xeace('0x2f')](_0x35a0ea[_0xeace('0x30')][_0xeace('0x2f')]));_0x12bea5['attributes']=_0x12bea5[_0xeace('0x31')][_0xeace('0x32')]?_0x12bea5[_0xeace('0x31')]:_0x33c0cc[_0xeace('0x2e')];if(!_0x35a0ea['query'][_0xeace('0x33')](_0xeace('0x34'))){_0x12bea5['limit']=qs[_0xeace('0x1b')](_0x35a0ea[_0xeace('0x30')][_0xeace('0x1b')]);_0x12bea5['offset']=qs[_0xeace('0x19')](_0x35a0ea[_0xeace('0x30')][_0xeace('0x19')]);}_0x12bea5[_0xeace('0x35')]=qs['sort'](_0x35a0ea[_0xeace('0x30')][_0xeace('0x36')]);_0x12bea5['where']=qs[_0xeace('0x2c')](_[_0xeace('0x37')](_0x35a0ea['query'],_0x33c0cc['filters']),_0x12bc1b);if(_0x35a0ea[_0xeace('0x30')][_0xeace('0x38')]){_0x12bea5[_0xeace('0x39')]=_[_0xeace('0x3a')](_0x12bea5['where'],{'$or':_[_0xeace('0x3b')](_0x12bea5[_0xeace('0x31')],function(_0x3fad3f){var _0x1ca222={};_0x1ca222[_0x3fad3f]={'$like':'%'+_0x35a0ea[_0xeace('0x30')][_0xeace('0x38')]+'%'};return _0x1ca222;})});}_0x12bea5=_[_0xeace('0x3a')]({},_0x12bea5,_0x35a0ea['options']);var _0x36ddfb={'where':_0x12bea5[_0xeace('0x39')]};return db[_0xeace('0x2b')][_0xeace('0x1c')](_0x36ddfb)[_0xeace('0x22')](function(_0x108976){_0x5493da[_0xeace('0x1c')]=_0x108976;if(_0x35a0ea[_0xeace('0x30')][_0xeace('0x3c')]){_0x12bea5[_0xeace('0x3d')]=[{'all':!![]}];}return db[_0xeace('0x2b')][_0xeace('0x3e')](_0x12bea5);})[_0xeace('0x22')](function(_0x4ab8a5){_0x5493da[_0xeace('0x3f')]=_0x4ab8a5;return _0x5493da;})[_0xeace('0x22')](respondWithFilteredResult(_0xaa2fcb,_0x12bea5))['catch'](handleError(_0xaa2fcb,null));})[_0xeace('0x40')](handleError(_0xaa2fcb,null));};exports['show']=function(_0x23ae9d,_0xba93f6){var _0x260764={'raw':![],'where':{'id':_0x23ae9d['params']['id']}},_0x2a464c={};_0x2a464c[_0xeace('0x2e')]=_[_0xeace('0x41')](db[_0xeace('0x2b')][_0xeace('0x42')]);_0x2a464c[_0xeace('0x30')]=_['keys'](_0x23ae9d[_0xeace('0x30')]);_0x2a464c[_0xeace('0x2c')]=_['intersection'](_0x2a464c['model'],_0x2a464c[_0xeace('0x30')]);_0x260764[_0xeace('0x31')]=_['intersection'](_0x2a464c[_0xeace('0x2e')],qs[_0xeace('0x2f')](_0x23ae9d[_0xeace('0x30')][_0xeace('0x2f')]));_0x260764[_0xeace('0x31')]=_0x260764[_0xeace('0x31')]['length']?_0x260764['attributes']:_0x2a464c[_0xeace('0x2e')];if(_0x23ae9d[_0xeace('0x30')]['includeAll']){_0x260764[_0xeace('0x3d')]=[{'all':!![]}];}_0x260764=_[_0xeace('0x3a')]({},_0x260764,_0x23ae9d[_0xeace('0x43')]);return db[_0xeace('0x2b')][_0xeace('0x44')](_0x260764)[_0xeace('0x22')](handleEntityNotFound(_0xba93f6,null))['then'](respondWithResult(_0xba93f6,null))[_0xeace('0x40')](handleError(_0xba93f6,null));};exports[_0xeace('0x45')]=function(_0x29b8d1,_0xd35cc2){return db[_0xeace('0x2b')]['create'](_0x29b8d1[_0xeace('0x46')],{})['then'](function(_0x33c40c){var _0x1d2b7a=_0x29b8d1['user'][_0xeace('0x23')]({'plain':!![]});if(!_0x1d2b7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d2b7a['role']==='user'){var _0x1db994=_0x33c40c[_0xeace('0x23')]({'plain':!![]});var _0x545c13=_0xeace('0x47');return db[_0xeace('0x48')]['find']({'where':{'name':_0x545c13,'userProfileId':_0x1d2b7a['userProfileId']},'raw':!![]})[_0xeace('0x22')](function(_0x4f9fd9){if(_0x4f9fd9&&_0x4f9fd9[_0xeace('0x49')]===0x0){return db[_0xeace('0x24')][_0xeace('0x45')]({'name':_0x1db994['name'],'resourceId':_0x1db994['id'],'type':_0x4f9fd9[_0xeace('0x28')],'sectionId':_0x4f9fd9['id']},{})[_0xeace('0x22')](function(){return _0x33c40c;});}else{return _0x33c40c;}})['catch'](function(_0x5cc71b){logger[_0xeace('0x4a')](_0xeace('0x4b'),_0x5cc71b);throw _0x5cc71b;});}return _0x33c40c;})[_0xeace('0x22')](respondWithResult(_0xd35cc2,0xc9))[_0xeace('0x40')](handleError(_0xd35cc2,null));};exports[_0xeace('0x21')]=function(_0x3b2638,_0x35750c){if(_0x3b2638[_0xeace('0x46')]['id']){delete _0x3b2638[_0xeace('0x46')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x3b2638['params']['id']}})[_0xeace('0x22')](handleEntityNotFound(_0x35750c,null))[_0xeace('0x22')](saveUpdates(_0x3b2638[_0xeace('0x46')],null))[_0xeace('0x22')](respondWithResult(_0x35750c,null))[_0xeace('0x40')](handleError(_0x35750c,null));};exports[_0xeace('0x25')]=function(_0x28f2ec,_0x41a143){return db[_0xeace('0x2b')][_0xeace('0x44')]({'where':{'id':_0x28f2ec['params']['id']}})[_0xeace('0x22')](handleEntityNotFound(_0x41a143,null))[_0xeace('0x22')](removeEntity(_0x41a143,null))[_0xeace('0x40')](handleError(_0x41a143,null));};exports[_0xeace('0x4c')]=function(_0x1a765f,_0x153b4e){return db['CmCompany'][_0xeace('0x4c')]()[_0xeace('0x22')](respondWithResult(_0x153b4e,null))[_0xeace('0x40')](handleError(_0x153b4e,null));};exports[_0xeace('0x4d')]=function(_0x5a5272,_0x6b1b80,_0x1ee698){return db['CmContact'][_0xeace('0x44')]({'where':{'id':_0x5a5272[_0xeace('0x4e')]['id']}})['then'](handleEntityNotFound(_0x6b1b80,null))[_0xeace('0x22')](function(_0x196093){if(_0x196093){return _0x196093[_0xeace('0x4d')](_0x5a5272[_0xeace('0x46')]['ids'],_[_0xeace('0x4f')](_0x5a5272[_0xeace('0x46')],[_0xeace('0x50'),'id'])||{});}})[_0xeace('0x22')](respondWithResult(_0x6b1b80,null))['catch'](handleError(_0x6b1b80,null));};exports['getContacts']=function(_0x49440d,_0xacf3cf,_0x4ce599){var _0x1f0554={};var _0x559eb9={};var _0x25c3fa;var _0x286b7f;return db[_0xeace('0x2b')][_0xeace('0x51')]({'where':{'id':_0x49440d[_0xeace('0x4e')]['id']}})[_0xeace('0x22')](handleEntityNotFound(_0xacf3cf,null))[_0xeace('0x22')](function(_0x7150b5){if(_0x7150b5){_0x25c3fa=_0x7150b5;_0x559eb9[_0xeace('0x2e')]=_[_0xeace('0x41')](db[_0xeace('0x52')][_0xeace('0x42')]);_0x559eb9['query']=_[_0xeace('0x41')](_0x49440d[_0xeace('0x30')]);_0x559eb9[_0xeace('0x2c')]=_[_0xeace('0x2d')](_0x559eb9[_0xeace('0x2e')],_0x559eb9['query']);_0x1f0554[_0xeace('0x31')]=_[_0xeace('0x2d')](_0x559eb9['model'],qs[_0xeace('0x2f')](_0x49440d[_0xeace('0x30')][_0xeace('0x2f')]));_0x1f0554[_0xeace('0x31')]=_0x1f0554[_0xeace('0x31')][_0xeace('0x32')]?_0x1f0554[_0xeace('0x31')]:_0x559eb9[_0xeace('0x2e')];_0x1f0554[_0xeace('0x35')]=qs[_0xeace('0x36')](_0x49440d[_0xeace('0x30')][_0xeace('0x36')]);_0x1f0554[_0xeace('0x39')]=qs[_0xeace('0x2c')](_[_0xeace('0x37')](_0x49440d[_0xeace('0x30')],_0x559eb9[_0xeace('0x2c')]));if(_0x49440d[_0xeace('0x30')][_0xeace('0x38')]){_0x1f0554['where']=_[_0xeace('0x3a')](_0x1f0554['where'],{'$or':_[_0xeace('0x3b')](_0x1f0554['attributes'],function(_0x175e9d){var _0x7d45e5={};_0x7d45e5[_0x175e9d]={'$like':'%'+_0x49440d['query']['filter']+'%'};return _0x7d45e5;})});}_0x1f0554=_[_0xeace('0x3a')]({},_0x1f0554,_0x49440d[_0xeace('0x43')]);return _0x25c3fa[_0xeace('0x53')](_0x1f0554);}})[_0xeace('0x22')](function(_0x43c353){if(_0x43c353){_0x286b7f=_0x43c353[_0xeace('0x32')];if(!_0x49440d['query'][_0xeace('0x33')](_0xeace('0x34'))){_0x1f0554[_0xeace('0x1b')]=qs['limit'](_0x49440d[_0xeace('0x30')][_0xeace('0x1b')]);_0x1f0554[_0xeace('0x19')]=qs[_0xeace('0x19')](_0x49440d['query']['offset']);}return _0x25c3fa[_0xeace('0x53')](_0x1f0554);}})[_0xeace('0x22')](function(_0x4c76ed){if(_0x4c76ed){return _0x4c76ed?{'count':_0x286b7f,'rows':_0x4c76ed}:null;}})['then'](respondWithResult(_0xacf3cf,null))[_0xeace('0x40')](handleError(_0xacf3cf,null));}; \ No newline at end of file +var _0x11ac=['intersection','attributes','order','sort','where','filter','merge','include','findAll','rows','catch','show','params','fields','length','includeAll','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','CmContact','rawAttributes','pick','map','hasOwnProperty','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','Companies','end','error','name','send','index','CmCompany','describe','model','keys','query','filters'];(function(_0x22a8c4,_0x51c09a){var _0x104c6d=function(_0x4d4d3d){while(--_0x4d4d3d){_0x22a8c4['push'](_0x22a8c4['shift']());}};_0x104c6d(++_0x51c09a);}(_0x11ac,0xcc));var _0xc11a=function(_0x5ac600,_0x12f652){_0x5ac600=_0x5ac600-0x0;var _0x37e050=_0x11ac[_0x5ac600];return _0x37e050;};'use strict';var emlformat=require(_0xc11a('0x0'));var rimraf=require(_0xc11a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc11a('0x2'));var rp=require('request-promise');var moment=require(_0xc11a('0x3'));var BPromise=require(_0xc11a('0x4'));var Mustache=require(_0xc11a('0x5'));var util=require(_0xc11a('0x6'));var path=require('path');var sox=require(_0xc11a('0x7'));var csv=require(_0xc11a('0x8'));var ejs=require(_0xc11a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc11a('0xa'));var crypto=require(_0xc11a('0xb'));var jsforce=require(_0xc11a('0xc'));var deskjs=require(_0xc11a('0xd'));var toCsv=require(_0xc11a('0x8'));var querystring=require('querystring');var Papa=require(_0xc11a('0xe'));var Redis=require('ioredis');var authService=require(_0xc11a('0xf'));var qs=require(_0xc11a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc11a('0x11'));var logger=require(_0xc11a('0x12'))(_0xc11a('0x13'));var utils=require(_0xc11a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc11a('0x15'));var db=require(_0xc11a('0x16'))['db'];function respondWithStatusCode(_0x183ab4,_0x2c8aae){_0x2c8aae=_0x2c8aae||0xcc;return function(_0x3d3c1e){if(_0x3d3c1e){return _0x183ab4[_0xc11a('0x17')](_0x2c8aae);}return _0x183ab4['status'](_0x2c8aae)['end']();};}function respondWithResult(_0x926356,_0x3acc5c){_0x3acc5c=_0x3acc5c||0xc8;return function(_0x38a17d){if(_0x38a17d){return _0x926356[_0xc11a('0x18')](_0x3acc5c)[_0xc11a('0x19')](_0x38a17d);}};}function respondWithFilteredResult(_0x3b91b4,_0x230c57){return function(_0x351793){if(_0x351793){var _0x2a902b=typeof _0x230c57[_0xc11a('0x1a')]===_0xc11a('0x1b')&&typeof _0x230c57[_0xc11a('0x1c')]===_0xc11a('0x1b');var _0x5775aa=_0x351793[_0xc11a('0x1d')];var _0x32eff4=_0x2a902b?0x0:_0x230c57[_0xc11a('0x1a')];var _0x5196f6=_0x2a902b?_0x351793[_0xc11a('0x1d')]:_0x230c57['offset']+_0x230c57[_0xc11a('0x1c')];var _0x2cd49d;if(_0x5196f6>=_0x5775aa){_0x5196f6=_0x5775aa;_0x2cd49d=0xc8;}else{_0x2cd49d=0xce;}_0x3b91b4[_0xc11a('0x18')](_0x2cd49d);return _0x3b91b4[_0xc11a('0x1e')]('Content-Range',_0x32eff4+'-'+_0x5196f6+'/'+_0x5775aa)[_0xc11a('0x19')](_0x351793);}return null;};}function patchUpdates(_0x5caf02){return function(_0x2379de){try{jsonpatch['apply'](_0x2379de,_0x5caf02,!![]);}catch(_0x14a0d3){return BPromise[_0xc11a('0x1f')](_0x14a0d3);}return _0x2379de[_0xc11a('0x20')]();};}function saveUpdates(_0x32b3f0,_0x4abbc6){return function(_0x48d52a){if(_0x48d52a){return _0x48d52a[_0xc11a('0x21')](_0x32b3f0)[_0xc11a('0x22')](function(_0x4cdb48){return _0x4cdb48;});}return null;};}function removeEntity(_0x1ea22d,_0x4fbc45){return function(_0x33bb3b){if(_0x33bb3b){return _0x33bb3b[_0xc11a('0x23')]()[_0xc11a('0x22')](function(){var _0xdd5666=_0x33bb3b['get']({'plain':!![]});var _0x4ace4c=_0xc11a('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x4ace4c,'resourceId':_0xdd5666['id']}})[_0xc11a('0x22')](function(){return _0x33bb3b;});})[_0xc11a('0x22')](function(){_0x1ea22d[_0xc11a('0x18')](0xcc)[_0xc11a('0x25')]();});}};}function handleEntityNotFound(_0x34bbd8,_0x4377c3){return function(_0x557cdc){if(!_0x557cdc){_0x34bbd8[_0xc11a('0x17')](0x194);}return _0x557cdc;};}function handleError(_0x535e2f,_0x3093d9){_0x3093d9=_0x3093d9||0x1f4;return function(_0x47d988){logger[_0xc11a('0x26')](_0x47d988['stack']);if(_0x47d988[_0xc11a('0x27')]){delete _0x47d988[_0xc11a('0x27')];}_0x535e2f['status'](_0x3093d9)[_0xc11a('0x28')](_0x47d988);};}exports[_0xc11a('0x29')]=function(_0x2f717f,_0x1e32d7){var _0x740b43={},_0x5afcff={},_0x8cd072={'count':0x0,'rows':[]};return db[_0xc11a('0x2a')][_0xc11a('0x2b')]()[_0xc11a('0x22')](function(_0x3c37da){_0x5afcff[_0xc11a('0x2c')]=_[_0xc11a('0x2d')](_0x3c37da);_0x5afcff[_0xc11a('0x2e')]=_[_0xc11a('0x2d')](_0x2f717f[_0xc11a('0x2e')]);_0x5afcff[_0xc11a('0x2f')]=_['intersection'](_0x5afcff[_0xc11a('0x2c')],_0x5afcff[_0xc11a('0x2e')]);_0x740b43['attributes']=_[_0xc11a('0x30')](_0x5afcff[_0xc11a('0x2c')],qs['fields'](_0x2f717f['query']['fields']));_0x740b43[_0xc11a('0x31')]=_0x740b43[_0xc11a('0x31')]['length']?_0x740b43['attributes']:_0x5afcff[_0xc11a('0x2c')];if(!_0x2f717f['query']['hasOwnProperty']('nolimit')){_0x740b43[_0xc11a('0x1c')]=qs['limit'](_0x2f717f['query'][_0xc11a('0x1c')]);_0x740b43[_0xc11a('0x1a')]=qs[_0xc11a('0x1a')](_0x2f717f[_0xc11a('0x2e')][_0xc11a('0x1a')]);}_0x740b43[_0xc11a('0x32')]=qs['sort'](_0x2f717f[_0xc11a('0x2e')][_0xc11a('0x33')]);_0x740b43[_0xc11a('0x34')]=qs[_0xc11a('0x2f')](_['pick'](_0x2f717f[_0xc11a('0x2e')],_0x5afcff['filters']),_0x3c37da);if(_0x2f717f['query'][_0xc11a('0x35')]){_0x740b43[_0xc11a('0x34')]=_[_0xc11a('0x36')](_0x740b43[_0xc11a('0x34')],{'$or':_['map'](_0x740b43['attributes'],function(_0x300418){var _0x166973={};_0x166973[_0x300418]={'$like':'%'+_0x2f717f[_0xc11a('0x2e')][_0xc11a('0x35')]+'%'};return _0x166973;})});}_0x740b43=_[_0xc11a('0x36')]({},_0x740b43,_0x2f717f['options']);var _0x59f84f={'where':_0x740b43[_0xc11a('0x34')]};return db[_0xc11a('0x2a')][_0xc11a('0x1d')](_0x59f84f)[_0xc11a('0x22')](function(_0x68d1b4){_0x8cd072['count']=_0x68d1b4;if(_0x2f717f[_0xc11a('0x2e')]['includeAll']){_0x740b43[_0xc11a('0x37')]=[{'all':!![]}];}return db[_0xc11a('0x2a')][_0xc11a('0x38')](_0x740b43);})[_0xc11a('0x22')](function(_0x3bc813){_0x8cd072[_0xc11a('0x39')]=_0x3bc813;return _0x8cd072;})[_0xc11a('0x22')](respondWithFilteredResult(_0x1e32d7,_0x740b43))['catch'](handleError(_0x1e32d7,null));})[_0xc11a('0x3a')](handleError(_0x1e32d7,null));};exports[_0xc11a('0x3b')]=function(_0x2beae9,_0x10bd48){var _0x21a773={'raw':![],'where':{'id':_0x2beae9[_0xc11a('0x3c')]['id']}},_0x59c63b={};_0x59c63b['model']=_[_0xc11a('0x2d')](db[_0xc11a('0x2a')]['rawAttributes']);_0x59c63b[_0xc11a('0x2e')]=_['keys'](_0x2beae9['query']);_0x59c63b[_0xc11a('0x2f')]=_[_0xc11a('0x30')](_0x59c63b[_0xc11a('0x2c')],_0x59c63b[_0xc11a('0x2e')]);_0x21a773[_0xc11a('0x31')]=_[_0xc11a('0x30')](_0x59c63b[_0xc11a('0x2c')],qs['fields'](_0x2beae9['query'][_0xc11a('0x3d')]));_0x21a773[_0xc11a('0x31')]=_0x21a773[_0xc11a('0x31')][_0xc11a('0x3e')]?_0x21a773[_0xc11a('0x31')]:_0x59c63b[_0xc11a('0x2c')];if(_0x2beae9[_0xc11a('0x2e')][_0xc11a('0x3f')]){_0x21a773[_0xc11a('0x37')]=[{'all':!![]}];}_0x21a773=_[_0xc11a('0x36')]({},_0x21a773,_0x2beae9[_0xc11a('0x40')]);return db['CmCompany'][_0xc11a('0x41')](_0x21a773)[_0xc11a('0x22')](handleEntityNotFound(_0x10bd48,null))['then'](respondWithResult(_0x10bd48,null))[_0xc11a('0x3a')](handleError(_0x10bd48,null));};exports['create']=function(_0x58d902,_0xcee34c){return db[_0xc11a('0x2a')]['create'](_0x58d902[_0xc11a('0x42')],{})[_0xc11a('0x22')](function(_0x5792da){var _0x1a7f99=_0x58d902['user'][_0xc11a('0x43')]({'plain':!![]});if(!_0x1a7f99)throw new Error(_0xc11a('0x44'));if(_0x1a7f99['role']===_0xc11a('0x45')){var _0x3c85e3=_0x5792da[_0xc11a('0x43')]({'plain':!![]});var _0xcf1f33=_0xc11a('0x24');return db[_0xc11a('0x46')][_0xc11a('0x41')]({'where':{'name':_0xcf1f33,'userProfileId':_0x1a7f99[_0xc11a('0x47')]},'raw':!![]})[_0xc11a('0x22')](function(_0x3f9a99){if(_0x3f9a99&&_0x3f9a99[_0xc11a('0x48')]===0x0){return db['UserProfileResource'][_0xc11a('0x49')]({'name':_0x3c85e3['name'],'resourceId':_0x3c85e3['id'],'type':_0x3f9a99[_0xc11a('0x27')],'sectionId':_0x3f9a99['id']},{})[_0xc11a('0x22')](function(){return _0x5792da;});}else{return _0x5792da;}})[_0xc11a('0x3a')](function(_0x123071){logger['error'](_0xc11a('0x4a'),_0x123071);throw _0x123071;});}return _0x5792da;})['then'](respondWithResult(_0xcee34c,0xc9))[_0xc11a('0x3a')](handleError(_0xcee34c,null));};exports['update']=function(_0xd440db,_0x1be2de){if(_0xd440db[_0xc11a('0x42')]['id']){delete _0xd440db[_0xc11a('0x42')]['id'];}return db['CmCompany'][_0xc11a('0x41')]({'where':{'id':_0xd440db[_0xc11a('0x3c')]['id']}})[_0xc11a('0x22')](handleEntityNotFound(_0x1be2de,null))[_0xc11a('0x22')](saveUpdates(_0xd440db[_0xc11a('0x42')],null))[_0xc11a('0x22')](respondWithResult(_0x1be2de,null))[_0xc11a('0x3a')](handleError(_0x1be2de,null));};exports[_0xc11a('0x23')]=function(_0xfe71ef,_0x4a52b6){return db[_0xc11a('0x2a')][_0xc11a('0x41')]({'where':{'id':_0xfe71ef[_0xc11a('0x3c')]['id']}})[_0xc11a('0x22')](handleEntityNotFound(_0x4a52b6,null))['then'](removeEntity(_0x4a52b6,null))[_0xc11a('0x3a')](handleError(_0x4a52b6,null));};exports[_0xc11a('0x2b')]=function(_0x1565ea,_0x3afd3d){return db['CmCompany'][_0xc11a('0x2b')]()[_0xc11a('0x22')](respondWithResult(_0x3afd3d,null))[_0xc11a('0x3a')](handleError(_0x3afd3d,null));};exports[_0xc11a('0x4b')]=function(_0x495230,_0x3a467e,_0x499f43){return db['CmContact'][_0xc11a('0x41')]({'where':{'id':_0x495230[_0xc11a('0x3c')]['id']}})[_0xc11a('0x22')](handleEntityNotFound(_0x3a467e,null))['then'](function(_0x54ce8f){if(_0x54ce8f){return _0x54ce8f[_0xc11a('0x4b')](_0x495230[_0xc11a('0x42')][_0xc11a('0x4c')],_[_0xc11a('0x4d')](_0x495230[_0xc11a('0x42')],['ids','id'])||{});}})[_0xc11a('0x22')](respondWithResult(_0x3a467e,null))['catch'](handleError(_0x3a467e,null));};exports[_0xc11a('0x4e')]=function(_0x26fa2f,_0x5bc6e8,_0x48561e){var _0x519339={};var _0x2ff36b={};var _0x46944b;var _0x2d0ef6;return db['CmCompany']['findOne']({'where':{'id':_0x26fa2f['params']['id']}})[_0xc11a('0x22')](handleEntityNotFound(_0x5bc6e8,null))[_0xc11a('0x22')](function(_0x310672){if(_0x310672){_0x46944b=_0x310672;_0x2ff36b[_0xc11a('0x2c')]=_[_0xc11a('0x2d')](db[_0xc11a('0x4f')][_0xc11a('0x50')]);_0x2ff36b[_0xc11a('0x2e')]=_[_0xc11a('0x2d')](_0x26fa2f[_0xc11a('0x2e')]);_0x2ff36b[_0xc11a('0x2f')]=_[_0xc11a('0x30')](_0x2ff36b[_0xc11a('0x2c')],_0x2ff36b[_0xc11a('0x2e')]);_0x519339['attributes']=_[_0xc11a('0x30')](_0x2ff36b['model'],qs[_0xc11a('0x3d')](_0x26fa2f[_0xc11a('0x2e')][_0xc11a('0x3d')]));_0x519339['attributes']=_0x519339[_0xc11a('0x31')][_0xc11a('0x3e')]?_0x519339['attributes']:_0x2ff36b[_0xc11a('0x2c')];_0x519339[_0xc11a('0x32')]=qs['sort'](_0x26fa2f[_0xc11a('0x2e')]['sort']);_0x519339[_0xc11a('0x34')]=qs[_0xc11a('0x2f')](_[_0xc11a('0x51')](_0x26fa2f[_0xc11a('0x2e')],_0x2ff36b[_0xc11a('0x2f')]));if(_0x26fa2f[_0xc11a('0x2e')]['filter']){_0x519339['where']=_['merge'](_0x519339[_0xc11a('0x34')],{'$or':_[_0xc11a('0x52')](_0x519339[_0xc11a('0x31')],function(_0x1d1c37){var _0x3ef785={};_0x3ef785[_0x1d1c37]={'$like':'%'+_0x26fa2f[_0xc11a('0x2e')][_0xc11a('0x35')]+'%'};return _0x3ef785;})});}_0x519339=_[_0xc11a('0x36')]({},_0x519339,_0x26fa2f['options']);return _0x46944b[_0xc11a('0x4e')](_0x519339);}})[_0xc11a('0x22')](function(_0x4aae78){if(_0x4aae78){_0x2d0ef6=_0x4aae78[_0xc11a('0x3e')];if(!_0x26fa2f[_0xc11a('0x2e')][_0xc11a('0x53')]('nolimit')){_0x519339[_0xc11a('0x1c')]=qs[_0xc11a('0x1c')](_0x26fa2f[_0xc11a('0x2e')][_0xc11a('0x1c')]);_0x519339[_0xc11a('0x1a')]=qs[_0xc11a('0x1a')](_0x26fa2f[_0xc11a('0x2e')][_0xc11a('0x1a')]);}return _0x46944b[_0xc11a('0x4e')](_0x519339);}})['then'](function(_0x346b40){if(_0x346b40){return _0x346b40?{'count':_0x2d0ef6,'rows':_0x346b40}:null;}})['then'](respondWithResult(_0x5bc6e8,null))['catch'](handleError(_0x5bc6e8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index eff62ce..385a310 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 _0x4339=['cm_companies','lodash','util','../../config/logger','request-promise','path','rimraf','define','CmCompany'];(function(_0x5073e7,_0x23ce87){var _0x2cf716=function(_0x24a1f6){while(--_0x24a1f6){_0x5073e7['push'](_0x5073e7['shift']());}};_0x2cf716(++_0x23ce87);}(_0x4339,0x14e));var _0x9433=function(_0x34f9cf,_0x1eedfc){_0x34f9cf=_0x34f9cf-0x0;var _0x3fbcd3=_0x4339[_0x34f9cf];return _0x3fbcd3;};'use strict';var _=require(_0x9433('0x0'));var util=require(_0x9433('0x1'));var logger=require(_0x9433('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9433('0x3'));var fs=require('fs');var path=require(_0x9433('0x4'));var rimraf=require(_0x9433('0x5'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module['exports']=function(_0x8781a5,_0x1f67d6){return _0x8781a5[_0x9433('0x6')](_0x9433('0x7'),attributes,{'tableName':_0x9433('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa52=['../../config/environment','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e6875,_0x392cbf){var _0x1971af=function(_0x2345a0){while(--_0x2345a0){_0x3e6875['push'](_0x3e6875['shift']());}};_0x1971af(++_0x392cbf);}(_0xfa52,0xe5));var _0x2fa5=function(_0x3a2642,_0x28233f){_0x3a2642=_0x3a2642-0x0;var _0x5931fe=_0xfa52[_0x3a2642];return _0x5931fe;};'use strict';var _=require(_0x2fa5('0x0'));var util=require(_0x2fa5('0x1'));var logger=require(_0x2fa5('0x2'))(_0x2fa5('0x3'));var moment=require(_0x2fa5('0x4'));var BPromise=require(_0x2fa5('0x5'));var rp=require(_0x2fa5('0x6'));var fs=require('fs');var path=require(_0x2fa5('0x7'));var rimraf=require(_0x2fa5('0x8'));var config=require(_0x2fa5('0x9'));var attributes=require('./cmCompany.attributes');module[_0x2fa5('0xa')]=function(_0x1ce680,_0x55b078){return _0x1ce680[_0x2fa5('0xb')](_0x2fa5('0xc'),attributes,{'tableName':_0x2fa5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 3d23fc0..6f75b95 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 _0x8738=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','randomstring'];(function(_0x1f469a,_0x521f1f){var _0x5417dd=function(_0x120c6c){while(--_0x120c6c){_0x1f469a['push'](_0x1f469a['shift']());}};_0x5417dd(++_0x521f1f);}(_0x8738,0xc4));var _0x8873=function(_0x195e54,_0x1553ea){_0x195e54=_0x195e54-0x0;var _0x45abab=_0x8738[_0x195e54];return _0x45abab;};'use strict';var _=require(_0x8873('0x0'));var util=require(_0x8873('0x1'));var moment=require(_0x8873('0x2'));var BPromise=require('bluebird');var rs=require(_0x8873('0x3'));var fs=require('fs');var Redis=require(_0x8873('0x4'));var db=require(_0x8873('0x5'))['db'];var utils=require(_0x8873('0x6'));var logger=require(_0x8873('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8873('0x8')][_0x8873('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a7e4d,_0x3c4949,_0x56d7aa){return new BPromise(function(_0x1860ab,_0x5201b4){return client[_0x8873('0xa')](_0x5a7e4d,_0x56d7aa)[_0x8873('0xb')](function(_0x294840){logger[_0x8873('0xc')](_0x8873('0xd'),_0x3c4949,_0x8873('0xe'));logger[_0x8873('0xf')](_0x8873('0x10'),_0x3c4949,_0x8873('0xe'),JSON['stringify'](_0x294840));if(_0x294840[_0x8873('0x11')]){if(_0x294840[_0x8873('0x11')]['code']===0x1f4){logger[_0x8873('0x11')](_0x8873('0xd'),_0x3c4949,_0x294840[_0x8873('0x11')][_0x8873('0x12')]);return _0x5201b4(_0x294840[_0x8873('0x11')][_0x8873('0x12')]);}logger[_0x8873('0x11')]('CmCompany,\x20%s,\x20%s',_0x3c4949,_0x294840[_0x8873('0x11')][_0x8873('0x12')]);return _0x1860ab(_0x294840[_0x8873('0x11')][_0x8873('0x12')]);}else{logger[_0x8873('0xc')](_0x8873('0xd'),_0x3c4949,_0x8873('0xe'));_0x1860ab(_0x294840[_0x8873('0x13')][_0x8873('0x12')]);}})['catch'](function(_0x146790){logger[_0x8873('0x11')](_0x8873('0xd'),_0x3c4949,_0x146790);_0x5201b4(_0x146790);});});} \ No newline at end of file +var _0x829c=['jayson/promise','client','http','request','then','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2e56a6,_0x1ba53a){var _0xec744c=function(_0x4d62ff){while(--_0x4d62ff){_0x2e56a6['push'](_0x2e56a6['shift']());}};_0xec744c(++_0x1ba53a);}(_0x829c,0x184));var _0xc829=function(_0x590f7a,_0x52a408){_0x590f7a=_0x590f7a-0x0;var _0x232356=_0x829c[_0x590f7a];return _0x232356;};'use strict';var _=require(_0xc829('0x0'));var util=require(_0xc829('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc829('0x2'));var fs=require('fs');var Redis=require(_0xc829('0x3'));var db=require(_0xc829('0x4'))['db'];var utils=require(_0xc829('0x5'));var logger=require(_0xc829('0x6'))('rpc');var config=require(_0xc829('0x7'));var jayson=require(_0xc829('0x8'));var client=jayson[_0xc829('0x9')][_0xc829('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1673ff,_0x5c41f9,_0x2d8e73){return new BPromise(function(_0x13e3fd,_0x56753b){return client[_0xc829('0xb')](_0x1673ff,_0x2d8e73)[_0xc829('0xc')](function(_0x219f4b){logger['info']('CmCompany,\x20%s,\x20%s',_0x5c41f9,_0xc829('0xd'));logger[_0xc829('0xe')](_0xc829('0xf'),_0x5c41f9,'request\x20sent',JSON[_0xc829('0x10')](_0x219f4b));if(_0x219f4b[_0xc829('0x11')]){if(_0x219f4b['error'][_0xc829('0x12')]===0x1f4){logger[_0xc829('0x11')](_0xc829('0x13'),_0x5c41f9,_0x219f4b[_0xc829('0x11')][_0xc829('0x14')]);return _0x56753b(_0x219f4b[_0xc829('0x11')][_0xc829('0x14')]);}logger['error'](_0xc829('0x13'),_0x5c41f9,_0x219f4b[_0xc829('0x11')]['message']);return _0x13e3fd(_0x219f4b[_0xc829('0x11')]['message']);}else{logger[_0xc829('0x15')](_0xc829('0x13'),_0x5c41f9,'request\x20sent');_0x13e3fd(_0x219f4b['result'][_0xc829('0x14')]);}})['catch'](function(_0x277fd9){logger[_0xc829('0x11')](_0xc829('0x13'),_0x5c41f9,_0x277fd9);_0x56753b(_0x277fd9);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5b43e8b..da50e1c 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 _0x5c60=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/contacts','getContacts','post','create','update','delete','destroy','exports','util','path'];(function(_0x28d2ec,_0x48c60e){var _0x5ac7d3=function(_0x568a16){while(--_0x568a16){_0x28d2ec['push'](_0x28d2ec['shift']());}};_0x5ac7d3(++_0x48c60e);}(_0x5c60,0x19c));var _0x05c6=function(_0x1ec355,_0x312bb4){_0x1ec355=_0x1ec355-0x0;var _0x13fdd8=_0x5c60[_0x1ec355];return _0x13fdd8;};'use strict';var multer=require('multer');var util=require(_0x05c6('0x0'));var path=require(_0x05c6('0x1'));var timeout=require(_0x05c6('0x2'));var express=require(_0x05c6('0x3'));var router=express[_0x05c6('0x4')]();var fs_extra=require(_0x05c6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x05c6('0x6'));var config=require(_0x05c6('0x7'));var controller=require(_0x05c6('0x8'));router[_0x05c6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x05c6('0xa'),auth['isAuthenticated'](),controller[_0x05c6('0xb')]);router[_0x05c6('0x9')](_0x05c6('0xc'),auth[_0x05c6('0xd')](),controller[_0x05c6('0xe')]);router['get'](_0x05c6('0xf'),auth[_0x05c6('0xd')](),controller[_0x05c6('0x10')]);router[_0x05c6('0x11')]('/',auth['isAuthenticated'](),controller[_0x05c6('0x12')]);router[_0x05c6('0x11')](_0x05c6('0xf'),auth[_0x05c6('0xd')](),controller['addContacts']);router['put'](_0x05c6('0xc'),auth['isAuthenticated'](),controller[_0x05c6('0x13')]);router[_0x05c6('0x14')](_0x05c6('0xc'),auth['isAuthenticated'](),controller[_0x05c6('0x15')]);module[_0x05c6('0x16')]=router; \ No newline at end of file +var _0x07ac=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports'];(function(_0x4c29f9,_0x5bddd4){var _0x4e17b8=function(_0x12e055){while(--_0x12e055){_0x4c29f9['push'](_0x4c29f9['shift']());}};_0x4e17b8(++_0x5bddd4);}(_0x07ac,0x104));var _0xc07a=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x07ac[_0x220afa];return _0x1b79d1;};'use strict';var multer=require('multer');var util=require(_0xc07a('0x0'));var path=require(_0xc07a('0x1'));var timeout=require(_0xc07a('0x2'));var express=require(_0xc07a('0x3'));var router=express[_0xc07a('0x4')]();var fs_extra=require(_0xc07a('0x5'));var auth=require(_0xc07a('0x6'));var interaction=require(_0xc07a('0x7'));var config=require(_0xc07a('0x8'));var controller=require(_0xc07a('0x9'));router[_0xc07a('0xa')]('/',auth[_0xc07a('0xb')](),controller[_0xc07a('0xc')]);router[_0xc07a('0xa')]('/describe',auth[_0xc07a('0xb')](),controller[_0xc07a('0xd')]);router[_0xc07a('0xa')](_0xc07a('0xe'),auth[_0xc07a('0xb')](),controller[_0xc07a('0xf')]);router[_0xc07a('0xa')](_0xc07a('0x10'),auth['isAuthenticated'](),controller[_0xc07a('0x11')]);router[_0xc07a('0x12')]('/',auth[_0xc07a('0xb')](),controller[_0xc07a('0x13')]);router['post']('/:id/contacts',auth[_0xc07a('0xb')](),controller[_0xc07a('0x14')]);router[_0xc07a('0x15')](_0xc07a('0xe'),auth['isAuthenticated'](),controller[_0xc07a('0x16')]);router[_0xc07a('0x17')](_0xc07a('0xe'),auth['isAuthenticated'](),controller[_0xc07a('0x18')]);module[_0xc07a('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index fc009c9..711bd17 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 _0x04ff=['UNSIGNED','DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x44c82b,_0x5d25d9){var _0x57a90a=function(_0x49dd98){while(--_0x49dd98){_0x44c82b['push'](_0x44c82b['shift']());}};_0x57a90a(++_0x5d25d9);}(_0x04ff,0x193));var _0xf04f=function(_0x2e1ef2,_0xcc4033){_0x2e1ef2=_0x2e1ef2-0x0;var _0x1aa955=_0x04ff[_0x2e1ef2];return _0x1aa955;};'use strict';var _=require('lodash');var Sequelize=require(_0xf04f('0x0'));module[_0xf04f('0x1')]={'firstName':{'type':Sequelize[_0xf04f('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf04f('0x2')]},'street':{'type':Sequelize[_0xf04f('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf04f('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf04f('0x3')]},'phone':{'type':Sequelize[_0xf04f('0x2')]},'mobile':{'type':Sequelize[_0xf04f('0x2')]},'fax':{'type':Sequelize[_0xf04f('0x2')]},'email':{'type':Sequelize[_0xf04f('0x2')]},'url':{'type':Sequelize[_0xf04f('0x2')]},'facebook':{'type':Sequelize[_0xf04f('0x2')]},'fb_data':{'type':Sequelize[_0xf04f('0x2')]},'twitter':{'type':Sequelize[_0xf04f('0x2')]},'skype':{'type':Sequelize[_0xf04f('0x2')]},'teams':{'type':Sequelize[_0xf04f('0x2')]},'viber':{'type':Sequelize[_0xf04f('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xf04f('0x2')]},'UserId':{'type':Sequelize[_0xf04f('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xf04f('0x2')]},'priority':{'type':Sequelize[_0xf04f('0x4')](0x2)[_0xf04f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf04f('0x6')],'defaultValue':Sequelize[_0xf04f('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xf04f('0x4')]}}; \ No newline at end of file +var _0x1b5d=['NOW','INTEGER','sequelize','STRING','TEXT','UNSIGNED','DATE'];(function(_0x2adb1c,_0xf054a3){var _0xb1db14=function(_0x32a57a){while(--_0x32a57a){_0x2adb1c['push'](_0x2adb1c['shift']());}};_0xb1db14(++_0xf054a3);}(_0x1b5d,0x17c));var _0xd1b5=function(_0x243fda,_0x4047fb){_0x243fda=_0x243fda-0x0;var _0x2f1c94=_0x1b5d[_0x243fda];return _0x2f1c94;};'use strict';var _=require('lodash');var Sequelize=require(_0xd1b5('0x0'));module['exports']={'firstName':{'type':Sequelize[_0xd1b5('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd1b5('0x1')]},'street':{'type':Sequelize[_0xd1b5('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xd1b5('0x1')]},'country':{'type':Sequelize[_0xd1b5('0x1')]},'dateOfBirth':{'type':Sequelize[_0xd1b5('0x1')]},'description':{'type':Sequelize[_0xd1b5('0x2')]},'phone':{'type':Sequelize[_0xd1b5('0x1')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xd1b5('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xd1b5('0x1')]},'twitter':{'type':Sequelize[_0xd1b5('0x1')]},'skype':{'type':Sequelize[_0xd1b5('0x1')]},'teams':{'type':Sequelize[_0xd1b5('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xd1b5('0x1')]},'wechat':{'type':Sequelize[_0xd1b5('0x1')]},'telegram':{'type':Sequelize[_0xd1b5('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xd1b5('0x1')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xd1b5('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xd1b5('0x4')],'defaultValue':Sequelize[_0xd1b5('0x5')]},'dialTimezone':{'type':Sequelize[_0xd1b5('0x1')]},'utcOffset':{'type':Sequelize[_0xd1b5('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index db851bf..cdb51c7 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 _0xa02b=['source','destination','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','range','startCase','chat','Website','key','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Owner','reverse','value','slice','bluebird','util','path','squel','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','undefined','limit','offset','count','set','Content-Range','json','update','then','end','sendStatus','error','stack','name','send','index','describe','query','user','destroy','CmContact','find','params','catch','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','findAll','alias','custom','type','values','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','push','ListId','spread','contact','all','show','Tag','Tags','color','tag','CmContactHasItem','Phones','ContactItemType','sequelize','omit','format','$and','pickBy','map','cf_%d','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','text','getTags','findOne','rawAttributes','intersection','model','attributes','fields','order','sort','filters','pick','filter','options','nolimit','setTags','ids','items','item_types','ItemTypeId','description','phone','OrderBy','contact\x20phone\x20exists','CmHopperAdditionalPhone','PHONE','CmHopperId','ItemType','getAdditionalPhones','literal','`ItemType`.OrderBy','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','CompanyId','createReadStream','parse','file','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','child_process','fork','mail','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid'];(function(_0x400b64,_0x5eb1bf){var _0x1d615d=function(_0x57e8ac){while(--_0x57e8ac){_0x400b64['push'](_0x400b64['shift']());}};_0x1d615d(++_0x5eb1bf);}(_0xa02b,0x121));var _0xba02=function(_0x524234,_0x42161c){_0x524234=_0x524234-0x0;var _0x5bc9aa=_0xa02b[_0x524234];return _0x5bc9aa;};'use strict';var moment=require('moment');var BPromise=require(_0xba02('0x0'));var util=require(_0xba02('0x1'));var path=require(_0xba02('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xba02('0x3'));var Papa=require('papaparse');var Redis=require(_0xba02('0x4'));var contacts=require(_0xba02('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xba02('0x6'))(_0xba02('0x7'));var config=require(_0xba02('0x8'));var shared=require(_0xba02('0x9'));var db=require(_0xba02('0xa'))['db'];config[_0xba02('0xb')]=_[_0xba02('0xc')](config[_0xba02('0xb')],{'host':_0xba02('0xd'),'port':0x18eb});var socket=require(_0xba02('0xe'))(new Redis(config[_0xba02('0xb')]));require(_0xba02('0xf'))['register'](socket);function respondWithResult(_0x101a96,_0x14e823){_0x14e823=_0x14e823||0xc8;return function(_0x215709){if(_0x215709){return _0x101a96[_0xba02('0x10')](_0x14e823)['json'](_0x215709);}};}function respondWithFilteredResult(_0x485e17,_0x55c06b){return function(_0x3d414d){if(_0x3d414d){var _0x2ea4d9=typeof _0x55c06b['offset']===_0xba02('0x11')&&typeof _0x55c06b[_0xba02('0x12')]===_0xba02('0x11');var _0x135c2f=_0x3d414d['count'];var _0x5e904f=_0x2ea4d9?0x0:_0x55c06b[_0xba02('0x13')];var _0x6ef0ff=_0x2ea4d9?_0x3d414d[_0xba02('0x14')]:_0x55c06b[_0xba02('0x13')]+_0x55c06b[_0xba02('0x12')];var _0x4e89bc;if(_0x6ef0ff>=_0x135c2f){_0x6ef0ff=_0x135c2f;_0x4e89bc=0xc8;}else{_0x4e89bc=0xce;}_0x485e17['status'](_0x4e89bc);return _0x485e17[_0xba02('0x15')](_0xba02('0x16'),_0x5e904f+'-'+_0x6ef0ff+'/'+_0x135c2f)[_0xba02('0x17')](_0x3d414d);}return null;};}function saveUpdates(_0x231314){return function(_0x354c53){if(_0x354c53){return _0x354c53[_0xba02('0x18')](_0x231314)[_0xba02('0x19')](function(_0x3ae167){return _0x3ae167;});}return null;};}function removeEntity(_0xe0e21c){return function(_0x1ab8ee){if(_0x1ab8ee){return _0x1ab8ee['destroy']()[_0xba02('0x19')](function(){_0xe0e21c[_0xba02('0x10')](0xcc)[_0xba02('0x1a')]();});}};}function handleEntityNotFound(_0x30d80b){return function(_0x5c20d8){if(!_0x5c20d8){_0x30d80b[_0xba02('0x1b')](0x194);}return _0x5c20d8;};}function handleError(_0x576e7b,_0x5325ae){_0x5325ae=_0x5325ae||0x1f4;return function(_0x5e4784){logger[_0xba02('0x1c')](_0x5e4784[_0xba02('0x1d')]);if(_0x5e4784[_0xba02('0x1e')]){delete _0x5e4784[_0xba02('0x1e')];}_0x576e7b[_0xba02('0x10')](_0x5325ae)[_0xba02('0x1f')](_0x5e4784);};}exports[_0xba02('0x20')]=function(_0x5e0516,_0x30568c){var _0x2255cd={};return contacts[_0xba02('0x21')]()['then'](function(_0x5ad5a2){_0x2255cd=qs['getOptions'](_0x5ad5a2,_0x5e0516);return contacts['findAll'](_0x5e0516[_0xba02('0x22')],_0x5e0516[_0xba02('0x23')],_0x2255cd,_0x5ad5a2);})['then'](respondWithFilteredResult(_0x30568c,_0x2255cd))['catch'](handleError(_0x30568c,null));};exports[_0xba02('0x24')]=function(_0x26bd68,_0x54926e){return db[_0xba02('0x25')][_0xba02('0x26')]({'where':{'id':_0x26bd68[_0xba02('0x27')]['id']}})[_0xba02('0x19')](handleEntityNotFound(_0x54926e,null))['then'](removeEntity(_0x54926e,null))[_0xba02('0x28')](handleError(_0x54926e,null));};exports[_0xba02('0x21')]=function(_0x1feff5,_0x1e2786){return db[_0xba02('0x25')]['describe']()[_0xba02('0x19')](function(_0x2aa2c3){delete _0x2aa2c3[_0xba02('0x29')];for(var _0x48a363=0x0;_0x48a3630x0){return new Promise(function(_0xd5ebfa){var _0x51da36=[];for(var _0xda7b11=0x0;_0xda7b11<_0x384e19[_0xba02('0x2b')];_0xda7b11++){_0x51da36['push'](insertAdditionalPhones(_0x384e19[_0xda7b11][_0xba02('0x65')],_0x384e19[_0xda7b11][_0xba02('0x5e')]));}Promise[_0xba02('0x66')](_0x51da36)[_0xba02('0x19')](function(){_0xd5ebfa(0x1);});})['then'](function(){return{'success':_0x5c41b2,'failure':_0x28ebae,'duplicates':_0x1c6992};});}else{return{'success':_0x5c41b2,'failure':_0x28ebae,'duplicates':_0x1c6992};}}})[_0xba02('0x19')](respondWithResult(_0xc7318a,0xc9))[_0xba02('0x28')](handleError(_0xc7318a,null));};exports[_0xba02('0x67')]=function(_0x5bfe9,_0x5c1eba){var _0x182b02;return db['CmContact'][_0xba02('0x21')]()[_0xba02('0x19')](function(_0x27b304){return db[_0xba02('0x25')][_0xba02('0x26')]({'where':{'id':_0x5bfe9['params']['id']},'include':[{'model':db[_0xba02('0x68')],'as':_0xba02('0x69'),'attributes':['id',_0xba02('0x1e'),_0xba02('0x6a')],'required':_0x5bfe9[_0xba02('0x22')][_0xba02('0x6b')]?!![]:![]},{'model':db[_0xba02('0x6c')],'as':_0xba02('0x6d'),'where':{'CmContactId':_0x5bfe9['params']['id']},'required':![],'include':[{'model':db[_0xba02('0x6e')],'as':'ItemType'}]}],'order':[db[_0xba02('0x6f')]['literal']('Phones.OrderBy')],'attributes':_['keys'](_0x27b304)});})[_0xba02('0x19')](function(_0xf2f98b){if(!_[_0xba02('0x5a')](_0xf2f98b)){_0x182b02=_0xf2f98b[_0xba02('0x3c')]({'plain':!![]});var _0x198e1f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf2f98b&&_0xf2f98b[_0xba02('0x63')]){if(_0xf2f98b['ListId']){_0x198e1f[_0xba02('0x61')]['$and'][_0xba02('0x62')]({'ListId':{'$ne':_0xf2f98b['ListId']}});}}return db['CmCustomField'][_0xba02('0x32')](_0x198e1f);}})[_0xba02('0x19')](function(_0x4b3f2){if(!_[_0xba02('0x5a')](_0x4b3f2)){return _[_0xba02('0x70')](_0x182b02,_['map'](_0x4b3f2,function(_0x1c39b1){return util[_0xba02('0x71')]('cf_%d',_0x1c39b1['id']);}));}})[_0xba02('0x19')](handleEntityNotFound(_0x5c1eba,null))['then'](respondWithResult(_0x5c1eba,null))[_0xba02('0x28')](handleError(_0x5c1eba,null));};exports[_0xba02('0x18')]=function(_0x5f49f2,_0x477b56){var _0x5e056b;if(_0x5f49f2[_0xba02('0x3a')]['id']){delete _0x5f49f2[_0xba02('0x3a')]['id'];}if(!_['isNil'](_0x5f49f2[_0xba02('0x3a')]['dialTimezone'])){var _0x397757=_0x5f49f2[_0xba02('0x3a')]['dialTimezone'];if(!_[_0xba02('0x5a')](shared[_0xba02('0x5c')][_0x397757]))_0x5f49f2['body'][_0xba02('0x5d')]=shared['timezones'][_0x397757][_0xba02('0x5d')];}return db['CmContact'][_0xba02('0x26')]({'where':{'id':_0x5f49f2[_0xba02('0x27')]['id']}})[_0xba02('0x19')](handleEntityNotFound(_0x477b56,null))[_0xba02('0x19')](saveUpdates(_0x5f49f2[_0xba02('0x3a')],null))[_0xba02('0x19')](function(_0x1948c3){_0x5e056b=_0x1948c3;var _0x3ea976={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1948c3&&_0x1948c3[_0xba02('0x63')]){if(_0x1948c3[_0xba02('0x63')]){_0x3ea976[_0xba02('0x61')][_0xba02('0x72')][_0xba02('0x62')]({'ListId':{'$ne':_0x1948c3[_0xba02('0x63')]}});}}return db['CmCustomField'][_0xba02('0x32')](_0x3ea976);})[_0xba02('0x19')](function(_0x307958){if(_0x307958){return _[_0xba02('0x70')](_[_0xba02('0x73')](_0x5f49f2[_0xba02('0x3a')],function(_0x33defa,_0xf567e2){return _['startsWith'](_0xf567e2,_0xba02('0x2d'));}),_[_0xba02('0x74')](_0x307958,function(_0xa32e91){return util['format'](_0xba02('0x75'),_0xa32e91['id']);}));}})['then'](function(_0x6c5bd){if(_0x6c5bd&&!_[_0xba02('0x76')](_0x6c5bd)){var _0x32e543=squel[_0xba02('0x18')]()[_0xba02('0x77')](_0xba02('0x78'))['setFields'](_0x6c5bd)[_0xba02('0x61')](_0xba02('0x79'),_0x5f49f2['params']['id'])[_0xba02('0x7a')]();return db[_0xba02('0x6f')]['query'](_0x32e543[_0xba02('0x7b')],{'replacements':_0x32e543['values']});}})[_0xba02('0x19')](function(){if(_0x5f49f2[_0xba02('0x3a')]['phone']&&_0x5e056b){return db[_0xba02('0x41')][_0xba02('0x18')]({'phone':_0x5f49f2[_0xba02('0x3a')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x5e056b['id']}});}})[_0xba02('0x19')](function(){return _0x5e056b;})['then'](respondWithResult(_0x477b56,null))[_0xba02('0x28')](handleError(_0x477b56,null));};exports[_0xba02('0x7c')]=function(_0x58f371,_0x57fb5c){var _0x1097bb={};var _0x8a7702={};var _0x46e768;var _0x3f1a3b;return db['CmContact'][_0xba02('0x7d')]({'where':{'id':_0x58f371[_0xba02('0x27')]['id']}})[_0xba02('0x19')](handleEntityNotFound(_0x57fb5c,null))[_0xba02('0x19')](function(_0x17a9da){if(_0x17a9da){_0x46e768=_0x17a9da;_0x8a7702['model']=_[_0xba02('0x2a')](db['Tag'][_0xba02('0x7e')]);_0x8a7702['query']=_['keys'](_0x58f371[_0xba02('0x22')]);_0x8a7702['filters']=_[_0xba02('0x7f')](_0x8a7702[_0xba02('0x80')],_0x8a7702['query']);_0x1097bb[_0xba02('0x81')]=_['intersection'](_0x8a7702[_0xba02('0x80')],qs[_0xba02('0x82')](_0x58f371[_0xba02('0x22')][_0xba02('0x82')]));_0x1097bb[_0xba02('0x81')]=_0x1097bb['attributes'][_0xba02('0x2b')]?_0x1097bb['attributes']:_0x8a7702[_0xba02('0x80')];_0x1097bb[_0xba02('0x83')]=qs[_0xba02('0x84')](_0x58f371[_0xba02('0x22')][_0xba02('0x84')]);_0x1097bb[_0xba02('0x61')]=qs[_0xba02('0x85')](_[_0xba02('0x86')](_0x58f371[_0xba02('0x22')],_0x8a7702['filters']));if(_0x58f371[_0xba02('0x22')]['filter']){_0x1097bb[_0xba02('0x61')]=_[_0xba02('0x39')](_0x1097bb['where'],{'$or':_[_0xba02('0x74')](_0x1097bb['attributes'],function(_0x24ac8f){var _0x22a559={};_0x22a559[_0x24ac8f]={'$like':'%'+_0x58f371[_0xba02('0x22')][_0xba02('0x87')]+'%'};return _0x22a559;})});}_0x1097bb=_[_0xba02('0x39')]({},_0x1097bb,_0x58f371[_0xba02('0x88')]);return _0x46e768[_0xba02('0x7c')](_0x1097bb);}})[_0xba02('0x19')](function(_0x42482d){if(_0x42482d){_0x3f1a3b=_0x42482d['length'];if(!_0x58f371[_0xba02('0x22')][_0xba02('0x38')](_0xba02('0x89'))){_0x1097bb[_0xba02('0x12')]=qs[_0xba02('0x12')](_0x58f371[_0xba02('0x22')][_0xba02('0x12')]);_0x1097bb[_0xba02('0x13')]=qs['offset'](_0x58f371[_0xba02('0x22')][_0xba02('0x13')]);}return _0x46e768['getTags'](_0x1097bb);}})['then'](function(_0x1486af){if(_0x1486af){return _0x1486af?{'count':_0x3f1a3b,'rows':_0x1486af}:null;}})[_0xba02('0x19')](respondWithResult(_0x57fb5c,null))[_0xba02('0x28')](handleError(_0x57fb5c,null));};exports[_0xba02('0x8a')]=function(_0x3ac1ff,_0x102d1a){if(_0x3ac1ff[_0xba02('0x3a')]['id']){delete _0x3ac1ff[_0xba02('0x3a')]['id'];}return db[_0xba02('0x25')][_0xba02('0x7d')]({'where':{'id':_0x3ac1ff['params']['id']}})[_0xba02('0x19')](handleEntityNotFound(_0x102d1a,null))['then'](function(_0x4e216e){if(_0x4e216e){return _0x4e216e[_0xba02('0x8a')](_0x3ac1ff[_0xba02('0x3a')][_0xba02('0x8b')]||[]);}return null;})['then'](respondWithResult(_0x102d1a,null))['catch'](handleError(_0x102d1a,null));};exports['setAdditionalPhones']=function(_0x44ccb9,_0x519c1c){var _0x49d037=[];_0x49d037['push'](addAdditionalPhones(_0x44ccb9[_0xba02('0x3a')]));Promise[_0xba02('0x66')](_0x49d037)[_0xba02('0x19')](function(){_0x49d037=[];_0x49d037['push'](deleteCmHopperPhones(_0x44ccb9[_0xba02('0x3a')]['id']));_0x49d037['push'](addCmHopperPhones(_0x44ccb9[_0xba02('0x3a')]['id']));Promise[_0xba02('0x66')](_0x49d037)[_0xba02('0x19')](function(){return[0x1];})[_0xba02('0x19')](respondWithResult(_0x519c1c,null));});};function addAdditionalPhones(_0x556845){var _0x50a02f;return new Promise(function(_0x1eface){return db[_0xba02('0x6c')][_0xba02('0x24')]({'where':{'CmContactId':_0x556845['id']}})[_0xba02('0x19')](function(){db[_0xba02('0x6e')]['findAll']({'raw':!![],'attributes':['id','OrderBy']})[_0xba02('0x19')](function(_0x242cf7){var _0x498818=[];for(var _0x1c84f1=0x0;_0x1c84f1<_0x556845[_0xba02('0x8c')]['length'];_0x1c84f1++){var _0x12ab7d=_0x556845[_0xba02('0x8d')]?_[_0xba02('0x5a')](_0x556845[_0xba02('0x8d')][_0x1c84f1])?'':_0x556845[_0xba02('0x8d')][_0x1c84f1]:_0x556845['items'][_0x1c84f1][_0xba02('0x8e')]?_0x556845[_0xba02('0x8c')][_0x1c84f1]['ItemTypeId']:'';var _0x33817e=_[_0xba02('0x5a')](_0x556845[_0xba02('0x8c')][_0x1c84f1]['description'])?'':_0x556845['items'][_0x1c84f1][_0xba02('0x8f')];var _0xb8bbef=_0x12ab7d+':'+_0x556845['items'][_0x1c84f1][_0xba02('0x90')]+'§'+_0x33817e;if(_[_0xba02('0x5a')](_0x50a02f))_0x50a02f=_0xb8bbef;else _0x50a02f+=';'+_0xb8bbef;var _0x3aea4c=null;var _0x4739d7=null;if(_0x556845['item_types']){if(!_[_0xba02('0x5a')](_0x556845[_0xba02('0x8d')][_0x1c84f1])){_0x4739d7=_[_0xba02('0x26')](_0x242cf7,function(_0x49a125){return _0x49a125['id']===_0x556845[_0xba02('0x8d')][_0x1c84f1];});if(!_[_0xba02('0x5a')](_0x4739d7)){_0x3aea4c=_0x4739d7[_0xba02('0x91')];}}}else{if(!_[_0xba02('0x5a')](_0x556845[_0xba02('0x8c')][_0x1c84f1])){_0x4739d7=_[_0xba02('0x26')](_0x242cf7,function(_0x12d8ca){return _0x12d8ca['id']===_0x556845[_0xba02('0x8c')][_0x1c84f1][_0xba02('0x8e')];});if(!_['isNil'](_0x4739d7)){_0x3aea4c=_0x1c84f1;}}}if(_[_0xba02('0x5a')](_0x3aea4c)){_0x3aea4c=0x64;}_0x498818[_0xba02('0x62')](addAdditionalPhone(_0x556845['id'],_0x556845[_0xba02('0x8c')][_0x1c84f1][_0xba02('0x90')],_0x556845[_0xba02('0x8d')]?_[_0xba02('0x5a')](_0x556845['item_types'][_0x1c84f1])?null:_0x556845[_0xba02('0x8d')][_0x1c84f1]:_0x556845[_0xba02('0x8c')][_0x1c84f1][_0xba02('0x8e')]?_0x556845[_0xba02('0x8c')][_0x1c84f1][_0xba02('0x8e')]:null,_0x3aea4c,_0x33817e));}Promise[_0xba02('0x66')](_0x498818)['then'](function(){db['CmContact'][_0xba02('0x18')]({'AdditionalPhones':_0x50a02f},{'where':{'id':_0x556845['id']}})['then'](function(){_0x1eface(0x1);});});});});});}function addAdditionalPhone(_0x49bf81,_0xe215ab,_0x5e0a6a,_0x31eccd,_0x570f0a){return db[_0xba02('0x6c')][_0xba02('0x26')]({'where':{'CmContactId':_0x49bf81,'item':_0xe215ab}})[_0xba02('0x19')](function(_0x196507){if(_0x196507)logger[_0xba02('0x3f')](_0xba02('0x92'),_0x196507);else{db['CmContactHasItem'][_0xba02('0x44')]({'CmContactId':_0x49bf81,'item':_0xe215ab,'ItemTypeId':_0x5e0a6a,'OrderBy':_0x31eccd,'ItemClass':'PHONE','description':_0x570f0a});}});}function deleteCmHopperPhones(_0x1b7cb1){return new Promise(function(_0x3b7874){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1b7cb1}})[_0xba02('0x19')](function(_0x54ae54){db[_0xba02('0x93')]['destroy']({'where':{'CmHopperId':{'$in':_[_0xba02('0x74')](_0x54ae54,'id')}}});})[_0xba02('0x19')](function(){_0x3b7874(0x1);});});}function addCmHopperPhones(_0x3ea00d){return new Promise(function(_0x43e112){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3ea00d}})[_0xba02('0x19')](function(_0x5a4a42){var _0x53a936=[];_[_0xba02('0x74')](_0x5a4a42,function(_0x4d650b){_0x53a936['push'](createCmHopperPhone(_0x3ea00d,_0x4d650b['id']));});Promise[_0xba02('0x66')](_0x53a936)[_0xba02('0x19')](function(){_0x43e112(0x1);});});});}function createCmHopperPhone(_0xcfadd1,_0x1383b2){return new Promise(function(_0x269eb3){db[_0xba02('0x6c')][_0xba02('0x32')]({'raw':!![],'attributes':['item',_0xba02('0x91')],'where':{'CmContactId':_0xcfadd1,'ItemClass':_0xba02('0x94')},'include':[{'model':db[_0xba02('0x6e')],'attributes':[_0xba02('0x91')],'as':'ItemType'}],'order':[_0xba02('0x91'),db[_0xba02('0x6f')]['literal']('`ItemType`.OrderBy')]})['then'](function(_0x1ee3ea){var _0x552b57=0x1;var _0x469546=_['map'](_0x1ee3ea,function(_0x228ad3){_0x228ad3[_0xba02('0x95')]=_0x1383b2;_0x228ad3[_0xba02('0x90')]=_0x228ad3['item'];_0x228ad3[_0xba02('0x91')]=_0x552b57;delete _0x228ad3['ItemType.OrderBy'];_0x552b57=_0x552b57+0x1;return _0x228ad3;});return db[_0xba02('0x93')][_0xba02('0x5f')](_0x469546,{});})[_0xba02('0x19')](function(){_0x269eb3(0x1);});});}function insertAdditionalPhones(_0x4aa1e8,_0x22f062){return new Promise(function(_0x3f2101){var _0x5c5e99=[];for(var _0x13d7e3=0x0;_0x13d7e3<_0x22f062[_0xba02('0x2b')];_0x13d7e3++){var _0x4bd688=_0x22f062[_0x13d7e3];_0x5c5e99[_0xba02('0x62')](parseContactItemType(_0x4bd688));}Promise['all'](_0x5c5e99)['then'](function(){var _0x4e859d={'id':_0x4aa1e8['id'],'items':_0x22f062};return addAdditionalPhones(_0x4e859d)[_0xba02('0x19')](function(){return addCmHopperPhones(_0x4aa1e8['id']);});})[_0xba02('0x19')](function(){_0x3f2101(_0x4aa1e8);});});}function parseContactItemType(_0x1ba957){return new Promise(function(_0x31dd3a){if(_0x1ba957['hasOwnProperty'](_0xba02('0x8e'))){_0x31dd3a(_0x1ba957);}else{return db[_0xba02('0x6e')][_0xba02('0x26')]({'where':{'name':_0x1ba957[_0xba02('0x96')]}})[_0xba02('0x19')](function(_0x368837){if(_['isNil'](_0x368837))_0x1ba957[_0xba02('0x8e')]=null;else _0x1ba957[_0xba02('0x8e')]=_0x368837['id'];_0x31dd3a(_0x1ba957);});}});}exports[_0xba02('0x97')]=function(_0x12f4f5,_0x1e2d6c){return db[_0xba02('0x6c')][_0xba02('0x32')]({'raw':!![],'where':{'CmContactId':_0x12f4f5[_0xba02('0x27')]['id'],'ItemClass':_0xba02('0x94')},'include':[{'model':db[_0xba02('0x6e')],'as':_0xba02('0x96')}],'order':[[_0xba02('0x91')],[db[_0xba02('0x6f')][_0xba02('0x98')](_0xba02('0x99'))]]})[_0xba02('0x19')](function(_0x5b9c6b){return _0x5b9c6b;})[_0xba02('0x19')](respondWithResult(_0x1e2d6c,null))[_0xba02('0x28')](handleError(_0x1e2d6c,null));};exports['duplicateAdditionalPhones']=function(_0x417bd8,_0x4157d4){return db[_0xba02('0x6c')]['findAll']({'raw':!![],'where':{'CmContactId':_0x417bd8['body'][_0xba02('0x9a')]}})['then'](function(_0x34b89c){var _0x341c15=_['map'](_0x34b89c,function(_0x2846a4){_0x2846a4[_0xba02('0x9b')]=_0x417bd8['body'][_0xba02('0x9c')];return _0x2846a4;});return db['CmContactHasItem'][_0xba02('0x5f')](_0x341c15,{});})['then'](function(){return addCmHopperPhones(_0x417bd8[_0xba02('0x3a')][_0xba02('0x9c')]);})[_0xba02('0x19')](function(){return['ok'];})[_0xba02('0x19')](respondWithResult(_0x4157d4,null))['catch'](handleError(_0x4157d4,null));};exports[_0xba02('0x9d')]=function(_0xaae239,_0x4527f6){var _0x15c270=[];_0x15c270[_0xba02('0x62')](createCmHopperPhone(_0xaae239[_0xba02('0x3a')]['id'],_0xaae239[_0xba02('0x3a')][_0xba02('0x9e')]));Promise['all'](_0x15c270)[_0xba02('0x19')](function(){return[0x1];})[_0xba02('0x19')](respondWithResult(_0x4527f6,null));};exports[_0xba02('0x9f')]=function(_0x3581aa,_0x5aef0e){var _0x310174={'raw':![],'where':{}};var _0x269946={};var _0x5b1e37={'count':0x0,'rows':[]};return db['CmContact'][_0xba02('0x7d')]({'where':{'id':_0x3581aa[_0xba02('0x27')]['id']}})['then'](handleEntityNotFound(_0x5aef0e,null))[_0xba02('0x19')](function(_0x1718e6){if(_0x1718e6){_0x269946[_0xba02('0x80')]=_[_0xba02('0x2a')](db[_0xba02('0x41')][_0xba02('0x7e')]);_0x269946[_0xba02('0x22')]=_[_0xba02('0x2a')](_0x3581aa[_0xba02('0x22')]);_0x269946[_0xba02('0x85')]=_['intersection'](_0x269946[_0xba02('0x80')],_0x269946['query']);_0x310174[_0xba02('0x81')]=_[_0xba02('0x7f')](_0x269946[_0xba02('0x80')],qs[_0xba02('0x82')](_0x3581aa[_0xba02('0x22')][_0xba02('0x82')]));_0x310174[_0xba02('0x81')]=_0x310174[_0xba02('0x81')][_0xba02('0x2b')]?_0x310174[_0xba02('0x81')]:_0x269946[_0xba02('0x80')];if(!_0x3581aa[_0xba02('0x22')][_0xba02('0x38')](_0xba02('0x89'))){_0x310174['limit']=qs[_0xba02('0x12')](_0x3581aa['query'][_0xba02('0x12')]);_0x310174['offset']=qs['offset'](_0x3581aa['query'][_0xba02('0x13')]);}_0x310174[_0xba02('0x83')]=qs[_0xba02('0x84')](_0x3581aa[_0xba02('0x22')][_0xba02('0x84')]);_0x310174['where']=qs[_0xba02('0x85')](_[_0xba02('0x86')](_0x3581aa[_0xba02('0x22')],_0x269946[_0xba02('0x85')]));_0x310174[_0xba02('0x61')][_0xba02('0xa0')]=_0x1718e6['id'];if(_0x3581aa[_0xba02('0x22')][_0xba02('0x87')]){_0x310174[_0xba02('0x61')]=_[_0xba02('0x39')](_0x310174[_0xba02('0x61')],{'$or':_[_0xba02('0x74')](_0x310174[_0xba02('0x81')],function(_0x177c4e){var _0x377fe4={};_0x377fe4[_0x177c4e]={'$like':'%'+_0x3581aa[_0xba02('0x22')][_0xba02('0x87')]+'%'};return _0x377fe4;})});}_0x310174=_['merge']({},_0x310174,_0x3581aa[_0xba02('0x88')]);return db[_0xba02('0x41')][_0xba02('0x14')]({'where':_0x310174[_0xba02('0x61')]})[_0xba02('0x19')](function(_0x59174d){_0x5b1e37[_0xba02('0x14')]=_0x59174d;if(_0x3581aa['query'][_0xba02('0xa1')]){_0x310174[_0xba02('0xa2')]=[{'all':!![]}];}return db[_0xba02('0x41')]['findAll'](_0x310174);})['then'](function(_0x968d62){_0x5b1e37[_0xba02('0xa3')]=_0x968d62;return _0x5b1e37;});}})[_0xba02('0x19')](respondWithFilteredResult(_0x5aef0e,_0x310174))[_0xba02('0x28')](handleError(_0x5aef0e,null));};exports[_0xba02('0xa4')]=function(_0x1b37b4,_0x3c19c5){var _0x192007={'raw':!![],'where':{}};var _0x38f0b1={};var _0x585d39={'count':0x0,'rows':[]};return db[_0xba02('0x25')]['findOne']({'where':{'id':_0x1b37b4[_0xba02('0x27')]['id']}})[_0xba02('0x19')](handleEntityNotFound(_0x3c19c5,null))[_0xba02('0x19')](function(_0x4d13bd){if(_0x4d13bd){_0x38f0b1[_0xba02('0x80')]=_['keys'](db[_0xba02('0x4e')]['rawAttributes']);_0x38f0b1[_0xba02('0x22')]=_['keys'](_0x1b37b4[_0xba02('0x22')]);_0x38f0b1['filters']=_[_0xba02('0x7f')](_0x38f0b1[_0xba02('0x80')],_0x38f0b1[_0xba02('0x22')]);_0x192007[_0xba02('0x81')]=_[_0xba02('0x7f')](_0x38f0b1[_0xba02('0x80')],qs[_0xba02('0x82')](_0x1b37b4[_0xba02('0x22')][_0xba02('0x82')]));_0x192007[_0xba02('0x81')]=_0x192007[_0xba02('0x81')][_0xba02('0x2b')]?_0x192007[_0xba02('0x81')]:_0x38f0b1[_0xba02('0x80')];if(!_0x1b37b4[_0xba02('0x22')][_0xba02('0x38')](_0xba02('0x89'))){_0x192007[_0xba02('0x12')]=qs[_0xba02('0x12')](_0x1b37b4['query'][_0xba02('0x12')]);_0x192007[_0xba02('0x13')]=qs[_0xba02('0x13')](_0x1b37b4[_0xba02('0x22')][_0xba02('0x13')]);}_0x192007[_0xba02('0x83')]=qs[_0xba02('0x84')](_0x1b37b4[_0xba02('0x22')][_0xba02('0x84')]);_0x192007[_0xba02('0x61')]=qs[_0xba02('0x85')](_['pick'](_0x1b37b4[_0xba02('0x22')],_0x38f0b1[_0xba02('0x85')]));_0x192007[_0xba02('0x61')][_0xba02('0xa0')]=_0x4d13bd['id'];if(_0x1b37b4['query'][_0xba02('0x87')]){_0x192007[_0xba02('0x61')]=_[_0xba02('0x39')](_0x192007['where'],{'$or':_[_0xba02('0x74')](_0x192007['attributes'],function(_0x57e75a){var _0x4ff863={};_0x4ff863[_0x57e75a]={'$like':'%'+_0x1b37b4['query'][_0xba02('0x87')]+'%'};return _0x4ff863;})});}_0x192007=_[_0xba02('0x39')]({},_0x192007,_0x1b37b4[_0xba02('0x88')]);return db['CmHopperHistory'][_0xba02('0x14')]({'where':_0x192007[_0xba02('0x61')]})[_0xba02('0x19')](function(_0x2faa1d){_0x585d39['count']=_0x2faa1d;if(_0x1b37b4['query']['includeAll']){_0x192007[_0xba02('0xa2')]=[{'all':!![]}];}return db[_0xba02('0x4e')][_0xba02('0x32')](_0x192007);})[_0xba02('0x19')](function(_0x415359){_0x585d39['rows']=_0x415359;return _0x585d39;});}})['then'](respondWithFilteredResult(_0x3c19c5,_0x192007))[_0xba02('0x28')](handleError(_0x3c19c5,null));};exports[_0xba02('0xa5')]=function(_0x8a6755,_0x10e9e3){var _0x4a1099={'raw':!![],'where':{}};var _0x26eb19={};var _0x15ae75={'count':0x0,'rows':[]};return db[_0xba02('0x25')]['findOne']({'where':{'id':_0x8a6755[_0xba02('0x27')]['id']}})['then'](handleEntityNotFound(_0x10e9e3,null))[_0xba02('0x19')](function(_0x443624){if(_0x443624){_0x26eb19[_0xba02('0x80')]=_[_0xba02('0x2a')](db[_0xba02('0x4d')][_0xba02('0x7e')]);_0x26eb19[_0xba02('0x22')]=_[_0xba02('0x2a')](_0x8a6755[_0xba02('0x22')]);_0x26eb19[_0xba02('0x85')]=_[_0xba02('0x7f')](_0x26eb19['model'],_0x26eb19['query']);_0x4a1099[_0xba02('0x81')]=_[_0xba02('0x7f')](_0x26eb19['model'],qs[_0xba02('0x82')](_0x8a6755[_0xba02('0x22')][_0xba02('0x82')]));_0x4a1099[_0xba02('0x81')]=_0x4a1099[_0xba02('0x81')][_0xba02('0x2b')]?_0x4a1099[_0xba02('0x81')]:_0x26eb19[_0xba02('0x80')];if(!_0x8a6755[_0xba02('0x22')][_0xba02('0x38')](_0xba02('0x89'))){_0x4a1099['limit']=qs[_0xba02('0x12')](_0x8a6755['query'][_0xba02('0x12')]);_0x4a1099[_0xba02('0x13')]=qs[_0xba02('0x13')](_0x8a6755[_0xba02('0x22')][_0xba02('0x13')]);}_0x4a1099[_0xba02('0x83')]=qs[_0xba02('0x84')](_0x8a6755[_0xba02('0x22')][_0xba02('0x84')]);_0x4a1099[_0xba02('0x61')]=qs['filters'](_[_0xba02('0x86')](_0x8a6755[_0xba02('0x22')],_0x26eb19[_0xba02('0x85')]));_0x4a1099[_0xba02('0x61')][_0xba02('0xa0')]=_0x443624['id'];if(_0x8a6755[_0xba02('0x22')][_0xba02('0x87')]){_0x4a1099['where']=_[_0xba02('0x39')](_0x4a1099[_0xba02('0x61')],{'$or':_[_0xba02('0x74')](_0x4a1099[_0xba02('0x81')],function(_0x2ad05c){var _0xaf4673={};_0xaf4673[_0x2ad05c]={'$like':'%'+_0x8a6755['query'][_0xba02('0x87')]+'%'};return _0xaf4673;})});}_0x4a1099=_['merge']({},_0x4a1099,_0x8a6755[_0xba02('0x88')]);return db['CmHopperFinal'][_0xba02('0x14')]({'where':_0x4a1099[_0xba02('0x61')]})[_0xba02('0x19')](function(_0xe00793){_0x15ae75['count']=_0xe00793;if(_0x8a6755['query'][_0xba02('0xa1')]){_0x4a1099[_0xba02('0xa2')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xba02('0x32')](_0x4a1099);})[_0xba02('0x19')](function(_0x1e090a){_0x15ae75[_0xba02('0xa3')]=_0x1e090a;return _0x15ae75;});}})[_0xba02('0x19')](respondWithFilteredResult(_0x10e9e3,_0x4a1099))[_0xba02('0x28')](handleError(_0x10e9e3,null));};exports['getJscriptySessions']=function(_0x38df89,_0x24de07){var _0x3244a4={'raw':!![],'where':{}};var _0x59f6dd={};var _0x39d448={'count':0x0,'rows':[]};return db[_0xba02('0x25')][_0xba02('0x7d')]({'where':{'id':_0x38df89['params']['id']}})[_0xba02('0x19')](handleEntityNotFound(_0x24de07,null))[_0xba02('0x19')](function(_0x314656){if(_0x314656){_0x59f6dd[_0xba02('0x80')]=_[_0xba02('0x2a')](db[_0xba02('0x55')]['rawAttributes']);_0x59f6dd['query']=_[_0xba02('0x2a')](_0x38df89[_0xba02('0x22')]);_0x59f6dd[_0xba02('0x85')]=_[_0xba02('0x7f')](_0x59f6dd['model'],_0x59f6dd[_0xba02('0x22')]);_0x3244a4['attributes']=_[_0xba02('0x7f')](_0x59f6dd['model'],qs[_0xba02('0x82')](_0x38df89[_0xba02('0x22')][_0xba02('0x82')]));_0x3244a4[_0xba02('0x81')]=_0x3244a4[_0xba02('0x81')][_0xba02('0x2b')]?_0x3244a4['attributes']:_0x59f6dd[_0xba02('0x80')];if(!_0x38df89[_0xba02('0x22')][_0xba02('0x38')](_0xba02('0x89'))){_0x3244a4[_0xba02('0x12')]=qs[_0xba02('0x12')](_0x38df89['query'][_0xba02('0x12')]);_0x3244a4[_0xba02('0x13')]=qs[_0xba02('0x13')](_0x38df89[_0xba02('0x22')]['offset']);}_0x3244a4[_0xba02('0x83')]=qs[_0xba02('0x84')](_0x38df89['query']['sort']);_0x3244a4['where']=qs[_0xba02('0x85')](_['pick'](_0x38df89['query'],_0x59f6dd[_0xba02('0x85')]));_0x3244a4['where']['ContactId']=_0x314656['id'];if(_0x38df89[_0xba02('0x22')][_0xba02('0x87')]){_0x3244a4['where']=_['merge'](_0x3244a4['where'],{'$or':_['map'](_0x3244a4['attributes'],function(_0x2a210b){var _0x684f51={};_0x684f51[_0x2a210b]={'$like':'%'+_0x38df89[_0xba02('0x22')][_0xba02('0x87')]+'%'};return _0x684f51;})});}_0x3244a4=_['merge']({},_0x3244a4,_0x38df89[_0xba02('0x88')]);return db['JscriptySessionReport']['count']({'where':_0x3244a4[_0xba02('0x61')]})[_0xba02('0x19')](function(_0x63ce16){_0x39d448[_0xba02('0x14')]=_0x63ce16;if(_0x38df89[_0xba02('0x22')][_0xba02('0xa1')]){_0x3244a4[_0xba02('0xa2')]=[{'all':!![]}];}return db[_0xba02('0x55')][_0xba02('0x32')](_0x3244a4);})[_0xba02('0x19')](function(_0xc34e4d){_0x39d448[_0xba02('0xa3')]=_0xc34e4d;return _0x39d448;});}})[_0xba02('0x19')](respondWithFilteredResult(_0x24de07,_0x3244a4))[_0xba02('0x28')](handleError(_0x24de07,null));};exports[_0xba02('0xa6')]=function(_0x383050,_0x3a8c8c){try{if(!_0x383050[_0xba02('0x3a')][_0xba02('0x63')]){throw new Error(_0xba02('0xa7'));}if(!_0x383050['body'][_0xba02('0xa8')]){throw new Error(_0xba02('0xa9'));}if(!_0x383050[_0xba02('0x3a')][_0xba02('0xaa')]){throw new Error(_0xba02('0xab'));}if(!_0x383050[_0xba02('0x3a')][_0xba02('0xac')]){throw new Error(_0xba02('0xad'));}var _0xb29c5f=_0x383050['body'][_0xba02('0xa8')][_0xba02('0xae')](',');var _0x5edb60=_0x383050['body'][_0xba02('0xaa')][_0xba02('0xae')](',');if(!_0xb29c5f[_0xba02('0x2b')]||!_0x5edb60[_0xba02('0x2b')]||_0xb29c5f[_0xba02('0x2b')]!==_0x5edb60['length']){throw new Error(_0xba02('0xaf'));}_0x383050['body'][_0xba02('0x82')]=_[_0xba02('0xb0')](_0xb29c5f,_0x5edb60);if(!_0x383050[_0xba02('0x3a')]['fields'][_0xba02('0x90')]){throw new Error(_0xba02('0xb1'));}if(!_0x383050[_0xba02('0x3a')][_0xba02('0x82')][_0xba02('0xb2')]){throw new Error(_0xba02('0xb3'));}var _0x292f94=path[_0xba02('0x59')](config[_0xba02('0xb4')],_0xba02('0xb5'),_0x383050['file'][_0xba02('0xb6')]);fs[_0xba02('0xb7')](_0x292f94,parseInt(_0xba02('0xb8'),0x8));var _0x4d386a=require('child_process')['fork'](path[_0xba02('0x59')](__dirname,'../../components/import/cm/csv'),[_0x292f94,_0x383050[_0xba02('0x3a')][_0xba02('0xa8')],_0x383050[_0xba02('0x3a')]['binding_values'],_0x383050['body'][_0xba02('0x63')],_0x383050['body'][_0xba02('0xb9')],_0x383050[_0xba02('0x3a')][_0xba02('0x60')],_0x383050['body']['socket_timestamp']]);return _0x3a8c8c[_0xba02('0x10')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x4d386a['pid']});}catch(_0xc67eea){return _0x3a8c8c[_0xba02('0x10')](0x1f4)[_0xba02('0x1f')](_0xc67eea);}};exports['upload']=function(_0x5b989c,_0x490699){var _0x26a463=fs[_0xba02('0xba')](_0x5b989c['file'][_0xba02('0x2')]);Papa[_0xba02('0xbb')](_0x26a463,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x392ea9){return _0x490699[_0xba02('0x10')](0xc8)['json']({'file':_0x5b989c[_0xba02('0xbc')],'fields':_0x392ea9['meta'][_0xba02('0x82')]});}});};exports[_0xba02('0xbd')]=function(_0x458395,_0xc1ce67){return db[_0xba02('0xbe')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xba02('0xbf')}})[_0xba02('0x19')](function(_0x14518a){var _0x1bc659=![];if(!_0x458395[_0xba02('0x3a')]['ListId']){throw new Error(_0xba02('0xa7'));}if(!_0x458395[_0xba02('0x3a')][_0xba02('0xc0')][_0xba02('0x90')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x458395[_0xba02('0x3a')][_0xba02('0xc0')][_0xba02('0xb2')]){throw new Error(_0xba02('0xb3'));}if(!_0x458395[_0xba02('0x3a')]['socket_timestamp']){throw new Error(_0xba02('0xad'));}var _0x3479a1=require('child_process')['fork'](path[_0xba02('0x59')](__dirname,_0xba02('0xc1')),[_0x458395[_0xba02('0x27')]['id'],JSON[_0xba02('0xc2')](_0x458395[_0xba02('0x3a')]),JSON['stringify'](_0x14518a)]);_0x3479a1['on'](_0xba02('0xc3'),function(){_0x1bc659=!![];return _0xc1ce67[_0xba02('0x10')](0xc8)[_0xba02('0x17')]({'message':_0xba02('0xc4'),'pid':_0x3479a1[_0xba02('0xc5')]});});_0x3479a1['on'](_0xba02('0xc6'),function(_0x185277){if(_0x185277&&!_0x1bc659){return _0xc1ce67['status'](0x1f4)[_0xba02('0x17')]({'message':_0xba02('0xc7'),'pid':_0x3479a1[_0xba02('0xc5')]});}});})[_0xba02('0x28')](handleError(_0xc1ce67,null));};exports[_0xba02('0xc8')]=function(_0x12b27d,_0x187c9b){return db[_0xba02('0xbe')][_0xba02('0x32')]({'raw':!![],'attributes':['id'],'where':{'role':_0xba02('0xbf')}})[_0xba02('0x19')](function(_0x480288){var _0x55d61a=![];if(!_0x12b27d[_0xba02('0x3a')][_0xba02('0x63')]){throw new Error(_0xba02('0xa7'));}if(!_0x12b27d['body'][_0xba02('0xc0')]['phone']){throw new Error(_0xba02('0xb1'));}if(!_0x12b27d[_0xba02('0x3a')][_0xba02('0xc0')][_0xba02('0xb2')]){throw new Error(_0xba02('0xb3'));}if(!_0x12b27d[_0xba02('0x3a')][_0xba02('0xac')]){throw new Error(_0xba02('0xad'));}var _0x24f979=require(_0xba02('0xc9'))[_0xba02('0xca')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x12b27d[_0xba02('0x27')]['id'],JSON[_0xba02('0xc2')](_0x12b27d['body']),JSON[_0xba02('0xc2')](_0x480288)]);_0x24f979['on'](_0xba02('0xc3'),function(){_0x55d61a=!![];return _0x187c9b[_0xba02('0x10')](0xc8)[_0xba02('0x17')]({'message':_0xba02('0xc4'),'pid':_0x24f979['pid']});});_0x24f979['on']('exit',function(_0xd4974a){if(_0xd4974a&&!_0x55d61a){return _0x187c9b[_0xba02('0x10')](0x1f4)[_0xba02('0x17')]({'message':'error\x20child\x20process','pid':_0x24f979[_0xba02('0xc5')]});}});})[_0xba02('0x28')](handleError(_0x187c9b,null));};exports['getJourney']=function(_0x4496c1,_0x23fbf5){var _0x3b1cdf=[_0xba02('0xcb'),'chat','sms',_0xba02('0xcc'),_0xba02('0xcd'),_0xba02('0xce'),_0xba02('0xcf')];var _0xa67134={'offset':0x0,'order':qs[_0xba02('0x84')](_0xba02('0xd0'))},_0x4fa5e8={'count':0x0,'rows':[]};Promise[_0xba02('0xd1')]()[_0xba02('0x19')](function(){if(_0x4496c1[_0xba02('0x22')][_0xba02('0xd2')]){if(!_[_0xba02('0xd3')](_0x3b1cdf,_0x4496c1['query'][_0xba02('0xd2')][_0xba02('0xd4')]())){throw new Error(_0xba02('0xd5'));}_0x3b1cdf=[_0x4496c1[_0xba02('0x22')][_0xba02('0xd2')]['toLowerCase']()];}if(_0x4496c1['query']['range']){try{var _0x499cbb=JSON[_0xba02('0xbb')](_0x4496c1[_0xba02('0x22')]['range']);if(!moment(_0x499cbb[_0xba02('0x3b')])[_0xba02('0xd6')]()){throw new Error(_0xba02('0xd7'));}if(!moment(_0x499cbb['to'])[_0xba02('0xd6')]()){throw new Error(_0xba02('0xd8'));}}catch(_0x153d7e){throw new Error(_0xba02('0xd9'));}}if(!_0x4496c1['query'][_0xba02('0x38')](_0xba02('0x89'))){_0xa67134[_0xba02('0x12')]=qs[_0xba02('0x12')](_0x4496c1[_0xba02('0x22')][_0xba02('0x12')]||0xa);_0xa67134[_0xba02('0x13')]=qs[_0xba02('0x13')](_0x4496c1[_0xba02('0x22')][_0xba02('0x13')]);}var _0x234089=_0x3b1cdf[_0xba02('0x74')](function(_0x13215d){if(_0x13215d===_0xba02('0xcf')){var _0x268c22={'attributes':['id',_0xba02('0xda'),_0xba02('0x35'),_0xba02('0xdb'),_0xba02('0xdc'),_0xba02('0xdd'),'starttime',_0xba02('0xde'),_0xba02('0xdf'),_0xba02('0xe0'),_0xba02('0xe1'),_0xba02('0xe2'),_0xba02('0xe3'),_0xba02('0xe4'),_0xba02('0xe5')],'where':{'ContactId':_0x4496c1['params']['id']},'include':[{'model':db[_0xba02('0xbe')],'as':_0xba02('0xbe'),'attributes':['id',_0xba02('0x1e'),_0xba02('0xe6'),_0xba02('0x33')]}],'order':[['createdAt',_0xba02('0xe7')]]};if(_0x4496c1['query'][_0xba02('0xe8')]){_0x268c22[_0xba02('0x61')][_0xba02('0xe1')]={'$gte':_0x499cbb[_0xba02('0x3b')],'$lte':_0x499cbb['to']};}return db[_0xba02('0x50')]['findAndCountAll'](_0x268c22)['then'](function(_0x727343){_0x4fa5e8[_0xba02('0x14')]+=_0x727343['count'];return _['map'](_0x727343['rows'],function(_0x5f3881){var _0x155459=_0x5f3881[_0xba02('0x3c')]({'plain':!![]});_0x155459['channel']=_0x13215d;if(_0x155459[_0xba02('0xbe')]){_0x155459['User']={'id':_0x155459['User']['id'],'name':_0x155459['User'][_0xba02('0x1e')],'fullname':_0x155459['User'][_0xba02('0xe6')],'alias':_0x155459[_0xba02('0xbe')][_0xba02('0x33')]};}return _0x155459;});});}else{var _0x441f5e=_[_0xba02('0xe9')](_0x13215d)+(_0x13215d===_0xba02('0xea')?_0xba02('0xeb'):'Account');var _0x45f96d={'attributes':['id','closed','closedAt',_0xba02('0xe1'),_0xba02('0xe0'),'disposition','secondDisposition','thirdDisposition',_0xba02('0xe5'),_0x441f5e+'Id'],'where':{'ContactId':_0x4496c1[_0xba02('0x27')]['id']},'include':[{'model':db[_0x441f5e],'as':'Account','attributes':['id',_0xba02('0x1e'),_0xba02('0xec')]},{'model':db['User'],'as':'Owner','attributes':['id','name',_0xba02('0xe6')]},{'model':db[_0xba02('0x68')],'as':'Tags','attributes':['id','name',_0xba02('0x6a')],'through':{'attributes':[]}}],'order':[[_0xba02('0xe1'),_0xba02('0xe7')]]};if(_0x4496c1[_0xba02('0x22')][_0xba02('0xe8')]){_0x45f96d[_0xba02('0x61')][_0xba02('0xe1')]={'$gte':_0x499cbb['from'],'$lte':_0x499cbb['to']};}switch(_0x13215d){case _0xba02('0xea'):_0x45f96d[_0xba02('0x81')][_0xba02('0x62')](_0xba02('0xed'),_0xba02('0xee'),_0xba02('0xef'),_0xba02('0xf0'),_0xba02('0xf1'),_0xba02('0xf2'),_0xba02('0xf3'),_0xba02('0xf4'),_0xba02('0xf5'));break;case _0xba02('0xcb'):_0x45f96d[_0xba02('0x81')][_0xba02('0x62')](_0xba02('0xf6'),_0xba02('0xf7'));break;case _0xba02('0xcc'):_0x45f96d[_0xba02('0x81')][_0xba02('0x62')](_0xba02('0xf8'),_0xba02('0xf9'));break;}return db[_['startCase'](_0x13215d)+'Interaction']['findAndCountAll'](_0x45f96d)[_0xba02('0x19')](function(_0x86633){_0x4fa5e8[_0xba02('0x14')]+=_0x86633[_0xba02('0x14')];return _[_0xba02('0x74')](_0x86633[_0xba02('0xa3')],function(_0x42b9e1){var _0xdc71fe=_0x42b9e1[_0xba02('0x3c')]({'plain':!![]});_0xdc71fe[_0xba02('0xd2')]=_0x13215d;if(_0xdc71fe[_0xba02('0xfa')]){_0xdc71fe[_0xba02('0xfa')]={'id':_0xdc71fe[_0xba02('0xfa')]['id'],'name':_0xdc71fe[_0xba02('0xfa')][_0xba02('0x1e')],'fullname':_0xdc71fe[_0xba02('0xfa')][_0xba02('0xe6')]};}return _0xdc71fe;});});}});return Promise[_0xba02('0x66')](_0x234089);})['then'](function(_0x58482e){return _(_0x58482e)['flatten']()['sortBy'](_0xba02('0xe1'))[_0xba02('0xfb')]()[_0xba02('0xfc')]();})['then'](function(_0x5cde9f){_0x4fa5e8[_0xba02('0xa3')]=_0xa67134['limit']?_0x5cde9f[_0xba02('0xfd')](_0xa67134[_0xba02('0x13')],_0xa67134[_0xba02('0x13')]+_0xa67134[_0xba02('0x12')]):_0x5cde9f;return _0x4fa5e8;})[_0xba02('0x19')](respondWithFilteredResult(_0x23fbf5,_0xa67134))['catch'](handleError(_0x23fbf5,null));}; \ No newline at end of file +var _0x11e7=['limit','count','offset','Content-Range','destroy','sendStatus','error','stack','name','send','index','describe','then','getOptions','findAll','query','user','catch','find','params','CmContact','tags','keys','length','cf_','columnName','displayName','analytics','CmCustomField','custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','isArray','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','VoiceCallReport','ChatQueueReport','MailQueueReport','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','each','duplicates','$or','where','ListId','findOrCreate','spread','push','Tag','color','tag','CmContactHasItem','Phones','ItemType','sequelize','literal','Phones.OrderBy','$and','map','format','cf_%d','pickBy','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes','filters','attributes','intersection','fields','order','sort','filter','nolimit','setTags','ids','setAdditionalPhones','all','ContactItemType','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','bulkCreate','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','pick','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getHopperFinals','ContactId','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','../../components/import/cm/csv','CompanyId','json','createReadStream','parse','meta','import','User','binding','fork','../../components/import/cm/csv2','stringify','message','pid','exit','error\x20child\x20process','importUpdates','agent','child_process','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','getJourney','mail','chat','openchannel','fax','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','destination','callerid','starttime','endtime','duration','note','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','findAndCountAll','alias','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','key','Owner','Tags','createdAt','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','substatus','externalUrl','Interaction','flatten','sortBy','value','slice','bluebird','util','path','lodash','squel','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','./cmContact.socket','status'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x11e7,0x1e6));var _0x711e=function(_0x1eb7db,_0xefd783){_0x1eb7db=_0x1eb7db-0x0;var _0x4829f5=_0x11e7[_0x1eb7db];return _0x4829f5;};'use strict';var moment=require('moment');var BPromise=require(_0x711e('0x0'));var util=require(_0x711e('0x1'));var path=require(_0x711e('0x2'));var fs=require('fs');var _=require(_0x711e('0x3'));var squel=require(_0x711e('0x4'));var Papa=require(_0x711e('0x5'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x711e('0x6'));var logger=require(_0x711e('0x7'))(_0x711e('0x8'));var config=require(_0x711e('0x9'));var shared=require('../../config/environment/shared');var db=require(_0x711e('0xa'))['db'];config[_0x711e('0xb')]=_['defaults'](config[_0x711e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x711e('0xc'))['register'](socket);function respondWithResult(_0x424f17,_0x38fec4){_0x38fec4=_0x38fec4||0xc8;return function(_0x286701){if(_0x286701){return _0x424f17[_0x711e('0xd')](_0x38fec4)['json'](_0x286701);}};}function respondWithFilteredResult(_0x4d7946,_0x4dcd33){return function(_0x256d5e){if(_0x256d5e){var _0x1426ff=typeof _0x4dcd33['offset']==='undefined'&&typeof _0x4dcd33[_0x711e('0xe')]==='undefined';var _0x5f1764=_0x256d5e[_0x711e('0xf')];var _0x420d65=_0x1426ff?0x0:_0x4dcd33[_0x711e('0x10')];var _0x119324=_0x1426ff?_0x256d5e['count']:_0x4dcd33[_0x711e('0x10')]+_0x4dcd33[_0x711e('0xe')];var _0x1105c0;if(_0x119324>=_0x5f1764){_0x119324=_0x5f1764;_0x1105c0=0xc8;}else{_0x1105c0=0xce;}_0x4d7946[_0x711e('0xd')](_0x1105c0);return _0x4d7946['set'](_0x711e('0x11'),_0x420d65+'-'+_0x119324+'/'+_0x5f1764)['json'](_0x256d5e);}return null;};}function saveUpdates(_0x44f6fd){return function(_0x8fc435){if(_0x8fc435){return _0x8fc435['update'](_0x44f6fd)['then'](function(_0x264ed7){return _0x264ed7;});}return null;};}function removeEntity(_0xf79cc8){return function(_0x926d14){if(_0x926d14){return _0x926d14[_0x711e('0x12')]()['then'](function(){_0xf79cc8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0013){return function(_0x1f7ff2){if(!_0x1f7ff2){_0x4a0013[_0x711e('0x13')](0x194);}return _0x1f7ff2;};}function handleError(_0x5e65ea,_0x1a7aeb){_0x1a7aeb=_0x1a7aeb||0x1f4;return function(_0x2018ed){logger[_0x711e('0x14')](_0x2018ed[_0x711e('0x15')]);if(_0x2018ed[_0x711e('0x16')]){delete _0x2018ed[_0x711e('0x16')];}_0x5e65ea[_0x711e('0xd')](_0x1a7aeb)[_0x711e('0x17')](_0x2018ed);};}exports[_0x711e('0x18')]=function(_0x36f0cc,_0x3fc283){var _0x17fdfc={};return contacts[_0x711e('0x19')]()[_0x711e('0x1a')](function(_0x16f0c6){_0x17fdfc=qs[_0x711e('0x1b')](_0x16f0c6,_0x36f0cc);return contacts[_0x711e('0x1c')](_0x36f0cc[_0x711e('0x1d')],_0x36f0cc[_0x711e('0x1e')],_0x17fdfc,_0x16f0c6);})['then'](respondWithFilteredResult(_0x3fc283,_0x17fdfc))[_0x711e('0x1f')](handleError(_0x3fc283,null));};exports[_0x711e('0x12')]=function(_0x4d1150,_0x1cd535){return db['CmContact'][_0x711e('0x20')]({'where':{'id':_0x4d1150[_0x711e('0x21')]['id']}})[_0x711e('0x1a')](handleEntityNotFound(_0x1cd535,null))[_0x711e('0x1a')](removeEntity(_0x1cd535,null))[_0x711e('0x1f')](handleError(_0x1cd535,null));};exports[_0x711e('0x19')]=function(_0x26ebfa,_0x5ae029){return db[_0x711e('0x22')][_0x711e('0x19')]()[_0x711e('0x1a')](function(_0x4d6ac5){delete _0x4d6ac5[_0x711e('0x23')];for(var _0x4d170d=0x0;_0x4d170d0x0){return new Promise(function(_0x1a48e5){var _0x2cf073=[];for(var _0x56d4ce=0x0;_0x56d4ce<_0x1bfe1d['length'];_0x56d4ce++){_0x2cf073[_0x711e('0x59')](insertAdditionalPhones(_0x1bfe1d[_0x56d4ce]['contact'],_0x1bfe1d[_0x56d4ce][_0x711e('0x51')]));}Promise['all'](_0x2cf073)['then'](function(){_0x1a48e5(0x1);});})[_0x711e('0x1a')](function(){return{'success':_0x413b52,'failure':_0x271dae,'duplicates':_0x39a61a};});}else{return{'success':_0x413b52,'failure':_0x271dae,'duplicates':_0x39a61a};}}})[_0x711e('0x1a')](respondWithResult(_0x3d4857,0xc9))[_0x711e('0x1f')](handleError(_0x3d4857,null));};exports['show']=function(_0x46edf4,_0x3548dd){var _0x314855;return db[_0x711e('0x22')][_0x711e('0x19')]()[_0x711e('0x1a')](function(_0x1492d0){return db['CmContact'][_0x711e('0x20')]({'where':{'id':_0x46edf4[_0x711e('0x21')]['id']},'include':[{'model':db[_0x711e('0x5a')],'as':'Tags','attributes':['id',_0x711e('0x16'),_0x711e('0x5b')],'required':_0x46edf4[_0x711e('0x1d')][_0x711e('0x5c')]?!![]:![]},{'model':db[_0x711e('0x5d')],'as':_0x711e('0x5e'),'where':{'CmContactId':_0x46edf4[_0x711e('0x21')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x711e('0x5f')}]}],'order':[db[_0x711e('0x60')][_0x711e('0x61')](_0x711e('0x62'))],'attributes':_['keys'](_0x1492d0)});})[_0x711e('0x1a')](function(_0x3fb06b){if(!_['isNil'](_0x3fb06b)){_0x314855=_0x3fb06b[_0x711e('0x34')]({'plain':!![]});var _0x2451a3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3fb06b&&_0x3fb06b[_0x711e('0x56')]){if(_0x3fb06b[_0x711e('0x56')]){_0x2451a3[_0x711e('0x55')][_0x711e('0x63')][_0x711e('0x59')]({'ListId':{'$ne':_0x3fb06b[_0x711e('0x56')]}});}}return db[_0x711e('0x2a')]['findAll'](_0x2451a3);}})['then'](function(_0x23d75d){if(!_[_0x711e('0x4d')](_0x23d75d)){return _['omit'](_0x314855,_[_0x711e('0x64')](_0x23d75d,function(_0xe4f31b){return util[_0x711e('0x65')](_0x711e('0x66'),_0xe4f31b['id']);}));}})['then'](handleEntityNotFound(_0x3548dd,null))[_0x711e('0x1a')](respondWithResult(_0x3548dd,null))[_0x711e('0x1f')](handleError(_0x3548dd,null));};exports[_0x711e('0x3e')]=function(_0x1d1ad6,_0x50e08e){var _0x2fa41b;if(_0x1d1ad6[_0x711e('0x32')]['id']){delete _0x1d1ad6[_0x711e('0x32')]['id'];}if(!_[_0x711e('0x4d')](_0x1d1ad6[_0x711e('0x32')]['dialTimezone'])){var _0x38bd76=_0x1d1ad6['body']['dialTimezone'];if(!_[_0x711e('0x4d')](shared['timezones'][_0x38bd76]))_0x1d1ad6[_0x711e('0x32')]['utcOffset']=shared[_0x711e('0x4f')][_0x38bd76][_0x711e('0x50')];}return db[_0x711e('0x22')]['find']({'where':{'id':_0x1d1ad6[_0x711e('0x21')]['id']}})['then'](handleEntityNotFound(_0x50e08e,null))[_0x711e('0x1a')](saveUpdates(_0x1d1ad6[_0x711e('0x32')],null))[_0x711e('0x1a')](function(_0x1c48d9){_0x2fa41b=_0x1c48d9;var _0x3e92cd={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1c48d9&&_0x1c48d9[_0x711e('0x56')]){if(_0x1c48d9['ListId']){_0x3e92cd[_0x711e('0x55')]['$and']['push']({'ListId':{'$ne':_0x1c48d9['ListId']}});}}return db[_0x711e('0x2a')][_0x711e('0x1c')](_0x3e92cd);})[_0x711e('0x1a')](function(_0x27a7d9){if(_0x27a7d9){return _['omit'](_[_0x711e('0x67')](_0x1d1ad6[_0x711e('0x32')],function(_0x4463b8,_0x554615){return _['startsWith'](_0x554615,'cf_');}),_['map'](_0x27a7d9,function(_0x3d74d0){return util[_0x711e('0x65')]('cf_%d',_0x3d74d0['id']);}));}})[_0x711e('0x1a')](function(_0x678ea5){if(_0x678ea5&&!_[_0x711e('0x68')](_0x678ea5)){var _0x303b85=squel[_0x711e('0x3e')]()[_0x711e('0x69')](_0x711e('0x6a'))['setFields'](_0x678ea5)[_0x711e('0x55')](_0x711e('0x6b'),_0x1d1ad6[_0x711e('0x21')]['id'])[_0x711e('0x6c')]();return db[_0x711e('0x60')][_0x711e('0x1d')](_0x303b85[_0x711e('0x6d')],{'replacements':_0x303b85[_0x711e('0x2d')]});}})[_0x711e('0x1a')](function(){if(_0x1d1ad6['body'][_0x711e('0x6e')]&&_0x2fa41b){return db[_0x711e('0x38')][_0x711e('0x3e')]({'phone':_0x1d1ad6[_0x711e('0x32')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x2fa41b['id']}});}})[_0x711e('0x1a')](function(){return _0x2fa41b;})[_0x711e('0x1a')](respondWithResult(_0x50e08e,null))[_0x711e('0x1f')](handleError(_0x50e08e,null));};exports[_0x711e('0x6f')]=function(_0x16c0b0,_0x337865){var _0x44986c={};var _0x4dced2={};var _0x19d9cc;var _0x35a993;return db[_0x711e('0x22')][_0x711e('0x70')]({'where':{'id':_0x16c0b0['params']['id']}})[_0x711e('0x1a')](handleEntityNotFound(_0x337865,null))[_0x711e('0x1a')](function(_0x3de01e){if(_0x3de01e){_0x19d9cc=_0x3de01e;_0x4dced2[_0x711e('0x71')]=_[_0x711e('0x24')](db[_0x711e('0x5a')][_0x711e('0x72')]);_0x4dced2['query']=_[_0x711e('0x24')](_0x16c0b0['query']);_0x4dced2[_0x711e('0x73')]=_['intersection'](_0x4dced2[_0x711e('0x71')],_0x4dced2[_0x711e('0x1d')]);_0x44986c[_0x711e('0x74')]=_[_0x711e('0x75')](_0x4dced2[_0x711e('0x71')],qs[_0x711e('0x76')](_0x16c0b0[_0x711e('0x1d')][_0x711e('0x76')]));_0x44986c[_0x711e('0x74')]=_0x44986c[_0x711e('0x74')][_0x711e('0x25')]?_0x44986c[_0x711e('0x74')]:_0x4dced2[_0x711e('0x71')];_0x44986c[_0x711e('0x77')]=qs['sort'](_0x16c0b0[_0x711e('0x1d')][_0x711e('0x78')]);_0x44986c[_0x711e('0x55')]=qs[_0x711e('0x73')](_['pick'](_0x16c0b0[_0x711e('0x1d')],_0x4dced2[_0x711e('0x73')]));if(_0x16c0b0[_0x711e('0x1d')][_0x711e('0x79')]){_0x44986c[_0x711e('0x55')]=_[_0x711e('0x31')](_0x44986c['where'],{'$or':_['map'](_0x44986c[_0x711e('0x74')],function(_0x47548b){var _0x22b857={};_0x22b857[_0x47548b]={'$like':'%'+_0x16c0b0[_0x711e('0x1d')]['filter']+'%'};return _0x22b857;})});}_0x44986c=_['merge']({},_0x44986c,_0x16c0b0['options']);return _0x19d9cc[_0x711e('0x6f')](_0x44986c);}})[_0x711e('0x1a')](function(_0x2b6590){if(_0x2b6590){_0x35a993=_0x2b6590['length'];if(!_0x16c0b0['query'][_0x711e('0x30')](_0x711e('0x7a'))){_0x44986c[_0x711e('0xe')]=qs[_0x711e('0xe')](_0x16c0b0[_0x711e('0x1d')][_0x711e('0xe')]);_0x44986c[_0x711e('0x10')]=qs['offset'](_0x16c0b0[_0x711e('0x1d')][_0x711e('0x10')]);}return _0x19d9cc[_0x711e('0x6f')](_0x44986c);}})[_0x711e('0x1a')](function(_0x227fc2){if(_0x227fc2){return _0x227fc2?{'count':_0x35a993,'rows':_0x227fc2}:null;}})[_0x711e('0x1a')](respondWithResult(_0x337865,null))[_0x711e('0x1f')](handleError(_0x337865,null));};exports['setTags']=function(_0x3e5a39,_0x35f0bf){if(_0x3e5a39['body']['id']){delete _0x3e5a39['body']['id'];}return db[_0x711e('0x22')][_0x711e('0x70')]({'where':{'id':_0x3e5a39[_0x711e('0x21')]['id']}})['then'](handleEntityNotFound(_0x35f0bf,null))[_0x711e('0x1a')](function(_0x1ae1b0){if(_0x1ae1b0){return _0x1ae1b0[_0x711e('0x7b')](_0x3e5a39[_0x711e('0x32')][_0x711e('0x7c')]||[]);}return null;})['then'](respondWithResult(_0x35f0bf,null))[_0x711e('0x1f')](handleError(_0x35f0bf,null));};exports[_0x711e('0x7d')]=function(_0x19a88a,_0x84d81e){var _0x3e3b1a=[];_0x3e3b1a[_0x711e('0x59')](addAdditionalPhones(_0x19a88a[_0x711e('0x32')]));Promise[_0x711e('0x7e')](_0x3e3b1a)['then'](function(){_0x3e3b1a=[];_0x3e3b1a[_0x711e('0x59')](deleteCmHopperPhones(_0x19a88a['body']['id']));_0x3e3b1a['push'](addCmHopperPhones(_0x19a88a[_0x711e('0x32')]['id']));Promise[_0x711e('0x7e')](_0x3e3b1a)['then'](function(){return[0x1];})[_0x711e('0x1a')](respondWithResult(_0x84d81e,null));});};function addAdditionalPhones(_0x450646){var _0xb503e2;return new Promise(function(_0x38333f){return db['CmContactHasItem'][_0x711e('0x12')]({'where':{'CmContactId':_0x450646['id']}})['then'](function(){db[_0x711e('0x7f')][_0x711e('0x1c')]({'raw':!![],'attributes':['id',_0x711e('0x80')]})[_0x711e('0x1a')](function(_0x4e74bc){var _0x4ad9c0=[];for(var _0x2264f2=0x0;_0x2264f2<_0x450646['items'][_0x711e('0x25')];_0x2264f2++){var _0x2ffbab=_0x450646[_0x711e('0x81')]?_[_0x711e('0x4d')](_0x450646[_0x711e('0x81')][_0x2264f2])?'':_0x450646[_0x711e('0x81')][_0x2264f2]:_0x450646[_0x711e('0x82')][_0x2264f2][_0x711e('0x83')]?_0x450646['items'][_0x2264f2][_0x711e('0x83')]:'';var _0x530012=_['isNil'](_0x450646[_0x711e('0x82')][_0x2264f2][_0x711e('0x84')])?'':_0x450646[_0x711e('0x82')][_0x2264f2][_0x711e('0x84')];var _0x495378=_0x2ffbab+':'+_0x450646[_0x711e('0x82')][_0x2264f2][_0x711e('0x6e')]+'§'+_0x530012;if(_[_0x711e('0x4d')](_0xb503e2))_0xb503e2=_0x495378;else _0xb503e2+=';'+_0x495378;var _0x5c63ed=null;var _0x1badd8=null;if(_0x450646[_0x711e('0x81')]){if(!_[_0x711e('0x4d')](_0x450646[_0x711e('0x81')][_0x2264f2])){_0x1badd8=_[_0x711e('0x20')](_0x4e74bc,function(_0x346348){return _0x346348['id']===_0x450646['item_types'][_0x2264f2];});if(!_['isNil'](_0x1badd8)){_0x5c63ed=_0x1badd8[_0x711e('0x80')];}}}else{if(!_['isNil'](_0x450646[_0x711e('0x82')][_0x2264f2])){_0x1badd8=_[_0x711e('0x20')](_0x4e74bc,function(_0x10a5c8){return _0x10a5c8['id']===_0x450646[_0x711e('0x82')][_0x2264f2][_0x711e('0x83')];});if(!_['isNil'](_0x1badd8)){_0x5c63ed=_0x2264f2;}}}if(_['isNil'](_0x5c63ed)){_0x5c63ed=0x64;}_0x4ad9c0[_0x711e('0x59')](addAdditionalPhone(_0x450646['id'],_0x450646['items'][_0x2264f2][_0x711e('0x6e')],_0x450646['item_types']?_[_0x711e('0x4d')](_0x450646[_0x711e('0x81')][_0x2264f2])?null:_0x450646[_0x711e('0x81')][_0x2264f2]:_0x450646[_0x711e('0x82')][_0x2264f2]['ItemTypeId']?_0x450646[_0x711e('0x82')][_0x2264f2][_0x711e('0x83')]:null,_0x5c63ed,_0x530012));}Promise['all'](_0x4ad9c0)[_0x711e('0x1a')](function(){db[_0x711e('0x22')][_0x711e('0x3e')]({'AdditionalPhones':_0xb503e2},{'where':{'id':_0x450646['id']}})[_0x711e('0x1a')](function(){_0x38333f(0x1);});});});});});}function addAdditionalPhone(_0x571053,_0x23375e,_0x208f7d,_0xd9a0f4,_0x2a71f0){return db[_0x711e('0x5d')]['find']({'where':{'CmContactId':_0x571053,'item':_0x23375e}})[_0x711e('0x1a')](function(_0x2d8fac){if(_0x2d8fac)logger['info'](_0x711e('0x85'),_0x2d8fac);else{db['CmContactHasItem']['create']({'CmContactId':_0x571053,'item':_0x23375e,'ItemTypeId':_0x208f7d,'OrderBy':_0xd9a0f4,'ItemClass':_0x711e('0x86'),'description':_0x2a71f0});}});}function deleteCmHopperPhones(_0xdee7d0){return new Promise(function(_0x2cb4fb){return db['CmHopper'][_0x711e('0x1c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xdee7d0}})[_0x711e('0x1a')](function(_0x33ad7a){db['CmHopperAdditionalPhone'][_0x711e('0x12')]({'where':{'CmHopperId':{'$in':_[_0x711e('0x64')](_0x33ad7a,'id')}}});})['then'](function(){_0x2cb4fb(0x1);});});}function addCmHopperPhones(_0x5e2c62){return new Promise(function(_0x25bdc9){return db[_0x711e('0x38')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5e2c62}})[_0x711e('0x1a')](function(_0x52b659){var _0x5e0105=[];_['map'](_0x52b659,function(_0x23ccc0){_0x5e0105[_0x711e('0x59')](createCmHopperPhone(_0x5e2c62,_0x23ccc0['id']));});Promise['all'](_0x5e0105)[_0x711e('0x1a')](function(){_0x25bdc9(0x1);});});});}function createCmHopperPhone(_0x53b218,_0x4def02){return new Promise(function(_0x580bf2){db[_0x711e('0x5d')][_0x711e('0x1c')]({'raw':!![],'attributes':['item',_0x711e('0x80')],'where':{'CmContactId':_0x53b218,'ItemClass':_0x711e('0x86')},'include':[{'model':db[_0x711e('0x7f')],'attributes':['OrderBy'],'as':_0x711e('0x5f')}],'order':[_0x711e('0x80'),db['sequelize']['literal'](_0x711e('0x87'))]})[_0x711e('0x1a')](function(_0x56f8c6){var _0x1b5e51=0x1;var _0x419440=_[_0x711e('0x64')](_0x56f8c6,function(_0x5c3547){_0x5c3547[_0x711e('0x88')]=_0x4def02;_0x5c3547[_0x711e('0x6e')]=_0x5c3547[_0x711e('0x89')];_0x5c3547[_0x711e('0x80')]=_0x1b5e51;delete _0x5c3547[_0x711e('0x8a')];_0x1b5e51=_0x1b5e51+0x1;return _0x5c3547;});return db['CmHopperAdditionalPhone'][_0x711e('0x8b')](_0x419440,{});})[_0x711e('0x1a')](function(){_0x580bf2(0x1);});});}function insertAdditionalPhones(_0x3e2eda,_0x29d454){return new Promise(function(_0x4bc775){var _0x40f18f=[];for(var _0xcce63b=0x0;_0xcce63b<_0x29d454[_0x711e('0x25')];_0xcce63b++){var _0x35593e=_0x29d454[_0xcce63b];_0x40f18f['push'](parseContactItemType(_0x35593e));}Promise[_0x711e('0x7e')](_0x40f18f)[_0x711e('0x1a')](function(){var _0x5f2179={'id':_0x3e2eda['id'],'items':_0x29d454};return addAdditionalPhones(_0x5f2179)[_0x711e('0x1a')](function(){return addCmHopperPhones(_0x3e2eda['id']);});})[_0x711e('0x1a')](function(){_0x4bc775(_0x3e2eda);});});}function parseContactItemType(_0x3b3b4d){return new Promise(function(_0x1f13ef){if(_0x3b3b4d[_0x711e('0x30')](_0x711e('0x83'))){_0x1f13ef(_0x3b3b4d);}else{return db[_0x711e('0x7f')][_0x711e('0x20')]({'where':{'name':_0x3b3b4d[_0x711e('0x5f')]}})[_0x711e('0x1a')](function(_0x27176c){if(_[_0x711e('0x4d')](_0x27176c))_0x3b3b4d[_0x711e('0x83')]=null;else _0x3b3b4d[_0x711e('0x83')]=_0x27176c['id'];_0x1f13ef(_0x3b3b4d);});}});}exports[_0x711e('0x8c')]=function(_0x31cada,_0x31a72b){return db[_0x711e('0x5d')][_0x711e('0x1c')]({'raw':!![],'where':{'CmContactId':_0x31cada[_0x711e('0x21')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x711e('0x7f')],'as':_0x711e('0x5f')}],'order':[[_0x711e('0x80')],[db[_0x711e('0x60')][_0x711e('0x61')](_0x711e('0x87'))]]})['then'](function(_0x38ec56){return _0x38ec56;})[_0x711e('0x1a')](respondWithResult(_0x31a72b,null))[_0x711e('0x1f')](handleError(_0x31a72b,null));};exports['duplicateAdditionalPhones']=function(_0x2defba,_0x45f43e){return db[_0x711e('0x5d')][_0x711e('0x1c')]({'raw':!![],'where':{'CmContactId':_0x2defba[_0x711e('0x32')][_0x711e('0x8d')]}})[_0x711e('0x1a')](function(_0x8f85a3){var _0x49881e=_['map'](_0x8f85a3,function(_0x4b9cfe){_0x4b9cfe[_0x711e('0x8e')]=_0x2defba[_0x711e('0x32')][_0x711e('0x8f')];return _0x4b9cfe;});return db['CmContactHasItem'][_0x711e('0x8b')](_0x49881e,{});})[_0x711e('0x1a')](function(){return addCmHopperPhones(_0x2defba[_0x711e('0x32')][_0x711e('0x8f')]);})[_0x711e('0x1a')](function(){return['ok'];})[_0x711e('0x1a')](respondWithResult(_0x45f43e,null))[_0x711e('0x1f')](handleError(_0x45f43e,null));};exports[_0x711e('0x90')]=function(_0x2ab1b3,_0x5defe9){var _0x55c53b=[];_0x55c53b[_0x711e('0x59')](createCmHopperPhone(_0x2ab1b3['body']['id'],_0x2ab1b3[_0x711e('0x32')][_0x711e('0x91')]));Promise[_0x711e('0x7e')](_0x55c53b)['then'](function(){return[0x1];})[_0x711e('0x1a')](respondWithResult(_0x5defe9,null));};exports[_0x711e('0x92')]=function(_0x19809d,_0x5f3db9){var _0x3d1c6c={'raw':![],'where':{}};var _0x4bc209={};var _0x4fc85={'count':0x0,'rows':[]};return db[_0x711e('0x22')]['findOne']({'where':{'id':_0x19809d[_0x711e('0x21')]['id']}})[_0x711e('0x1a')](handleEntityNotFound(_0x5f3db9,null))[_0x711e('0x1a')](function(_0x52a945){if(_0x52a945){_0x4bc209[_0x711e('0x71')]=_['keys'](db['CmHopper']['rawAttributes']);_0x4bc209[_0x711e('0x1d')]=_[_0x711e('0x24')](_0x19809d['query']);_0x4bc209['filters']=_[_0x711e('0x75')](_0x4bc209[_0x711e('0x71')],_0x4bc209[_0x711e('0x1d')]);_0x3d1c6c[_0x711e('0x74')]=_[_0x711e('0x75')](_0x4bc209[_0x711e('0x71')],qs['fields'](_0x19809d[_0x711e('0x1d')][_0x711e('0x76')]));_0x3d1c6c[_0x711e('0x74')]=_0x3d1c6c[_0x711e('0x74')][_0x711e('0x25')]?_0x3d1c6c['attributes']:_0x4bc209[_0x711e('0x71')];if(!_0x19809d['query']['hasOwnProperty'](_0x711e('0x7a'))){_0x3d1c6c[_0x711e('0xe')]=qs[_0x711e('0xe')](_0x19809d[_0x711e('0x1d')][_0x711e('0xe')]);_0x3d1c6c[_0x711e('0x10')]=qs[_0x711e('0x10')](_0x19809d[_0x711e('0x1d')]['offset']);}_0x3d1c6c[_0x711e('0x77')]=qs[_0x711e('0x78')](_0x19809d[_0x711e('0x1d')][_0x711e('0x78')]);_0x3d1c6c[_0x711e('0x55')]=qs[_0x711e('0x73')](_[_0x711e('0x93')](_0x19809d[_0x711e('0x1d')],_0x4bc209[_0x711e('0x73')]));_0x3d1c6c['where']['ContactId']=_0x52a945['id'];if(_0x19809d['query']['filter']){_0x3d1c6c['where']=_[_0x711e('0x31')](_0x3d1c6c[_0x711e('0x55')],{'$or':_[_0x711e('0x64')](_0x3d1c6c['attributes'],function(_0x42390e){var _0xf0887={};_0xf0887[_0x42390e]={'$like':'%'+_0x19809d[_0x711e('0x1d')][_0x711e('0x79')]+'%'};return _0xf0887;})});}_0x3d1c6c=_['merge']({},_0x3d1c6c,_0x19809d[_0x711e('0x94')]);return db[_0x711e('0x38')][_0x711e('0xf')]({'where':_0x3d1c6c[_0x711e('0x55')]})[_0x711e('0x1a')](function(_0xb3a31b){_0x4fc85[_0x711e('0xf')]=_0xb3a31b;if(_0x19809d[_0x711e('0x1d')][_0x711e('0x95')]){_0x3d1c6c[_0x711e('0x96')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3d1c6c);})[_0x711e('0x1a')](function(_0x388413){_0x4fc85['rows']=_0x388413;return _0x4fc85;});}})[_0x711e('0x1a')](respondWithFilteredResult(_0x5f3db9,_0x3d1c6c))['catch'](handleError(_0x5f3db9,null));};exports[_0x711e('0x97')]=function(_0x53c2de,_0xfafa56){var _0x582242={'raw':!![],'where':{}};var _0x65b310={};var _0x3fbf25={'count':0x0,'rows':[]};return db[_0x711e('0x22')][_0x711e('0x70')]({'where':{'id':_0x53c2de[_0x711e('0x21')]['id']}})['then'](handleEntityNotFound(_0xfafa56,null))[_0x711e('0x1a')](function(_0x175963){if(_0x175963){_0x65b310[_0x711e('0x71')]=_[_0x711e('0x24')](db[_0x711e('0x98')]['rawAttributes']);_0x65b310[_0x711e('0x1d')]=_[_0x711e('0x24')](_0x53c2de[_0x711e('0x1d')]);_0x65b310[_0x711e('0x73')]=_['intersection'](_0x65b310['model'],_0x65b310[_0x711e('0x1d')]);_0x582242['attributes']=_[_0x711e('0x75')](_0x65b310[_0x711e('0x71')],qs[_0x711e('0x76')](_0x53c2de[_0x711e('0x1d')]['fields']));_0x582242[_0x711e('0x74')]=_0x582242['attributes'][_0x711e('0x25')]?_0x582242[_0x711e('0x74')]:_0x65b310[_0x711e('0x71')];if(!_0x53c2de['query'][_0x711e('0x30')]('nolimit')){_0x582242['limit']=qs[_0x711e('0xe')](_0x53c2de[_0x711e('0x1d')][_0x711e('0xe')]);_0x582242[_0x711e('0x10')]=qs['offset'](_0x53c2de[_0x711e('0x1d')][_0x711e('0x10')]);}_0x582242[_0x711e('0x77')]=qs[_0x711e('0x78')](_0x53c2de[_0x711e('0x1d')]['sort']);_0x582242[_0x711e('0x55')]=qs[_0x711e('0x73')](_[_0x711e('0x93')](_0x53c2de[_0x711e('0x1d')],_0x65b310[_0x711e('0x73')]));_0x582242['where']['ContactId']=_0x175963['id'];if(_0x53c2de[_0x711e('0x1d')][_0x711e('0x79')]){_0x582242[_0x711e('0x55')]=_[_0x711e('0x31')](_0x582242[_0x711e('0x55')],{'$or':_[_0x711e('0x64')](_0x582242[_0x711e('0x74')],function(_0x371be1){var _0x43f31b={};_0x43f31b[_0x371be1]={'$like':'%'+_0x53c2de[_0x711e('0x1d')][_0x711e('0x79')]+'%'};return _0x43f31b;})});}_0x582242=_['merge']({},_0x582242,_0x53c2de['options']);return db['CmHopperHistory'][_0x711e('0xf')]({'where':_0x582242[_0x711e('0x55')]})[_0x711e('0x1a')](function(_0x53df8d){_0x3fbf25[_0x711e('0xf')]=_0x53df8d;if(_0x53c2de[_0x711e('0x1d')][_0x711e('0x95')]){_0x582242[_0x711e('0x96')]=[{'all':!![]}];}return db[_0x711e('0x98')][_0x711e('0x1c')](_0x582242);})[_0x711e('0x1a')](function(_0x29a9bc){_0x3fbf25[_0x711e('0x99')]=_0x29a9bc;return _0x3fbf25;});}})[_0x711e('0x1a')](respondWithFilteredResult(_0xfafa56,_0x582242))[_0x711e('0x1f')](handleError(_0xfafa56,null));};exports[_0x711e('0x9a')]=function(_0x5b4d0c,_0x4e2bea){var _0x81ad52={'raw':!![],'where':{}};var _0x40adb7={};var _0x4eaa8a={'count':0x0,'rows':[]};return db[_0x711e('0x22')]['findOne']({'where':{'id':_0x5b4d0c[_0x711e('0x21')]['id']}})['then'](handleEntityNotFound(_0x4e2bea,null))[_0x711e('0x1a')](function(_0x567b0f){if(_0x567b0f){_0x40adb7[_0x711e('0x71')]=_[_0x711e('0x24')](db[_0x711e('0x47')]['rawAttributes']);_0x40adb7[_0x711e('0x1d')]=_[_0x711e('0x24')](_0x5b4d0c[_0x711e('0x1d')]);_0x40adb7[_0x711e('0x73')]=_[_0x711e('0x75')](_0x40adb7[_0x711e('0x71')],_0x40adb7[_0x711e('0x1d')]);_0x81ad52['attributes']=_[_0x711e('0x75')](_0x40adb7[_0x711e('0x71')],qs['fields'](_0x5b4d0c['query'][_0x711e('0x76')]));_0x81ad52['attributes']=_0x81ad52[_0x711e('0x74')][_0x711e('0x25')]?_0x81ad52[_0x711e('0x74')]:_0x40adb7['model'];if(!_0x5b4d0c[_0x711e('0x1d')][_0x711e('0x30')](_0x711e('0x7a'))){_0x81ad52[_0x711e('0xe')]=qs[_0x711e('0xe')](_0x5b4d0c[_0x711e('0x1d')][_0x711e('0xe')]);_0x81ad52[_0x711e('0x10')]=qs[_0x711e('0x10')](_0x5b4d0c['query'][_0x711e('0x10')]);}_0x81ad52[_0x711e('0x77')]=qs['sort'](_0x5b4d0c[_0x711e('0x1d')]['sort']);_0x81ad52[_0x711e('0x55')]=qs[_0x711e('0x73')](_[_0x711e('0x93')](_0x5b4d0c[_0x711e('0x1d')],_0x40adb7[_0x711e('0x73')]));_0x81ad52[_0x711e('0x55')][_0x711e('0x9b')]=_0x567b0f['id'];if(_0x5b4d0c[_0x711e('0x1d')][_0x711e('0x79')]){_0x81ad52['where']=_[_0x711e('0x31')](_0x81ad52[_0x711e('0x55')],{'$or':_[_0x711e('0x64')](_0x81ad52[_0x711e('0x74')],function(_0x26a4e8){var _0x500d84={};_0x500d84[_0x26a4e8]={'$like':'%'+_0x5b4d0c[_0x711e('0x1d')][_0x711e('0x79')]+'%'};return _0x500d84;})});}_0x81ad52=_['merge']({},_0x81ad52,_0x5b4d0c[_0x711e('0x94')]);return db[_0x711e('0x47')][_0x711e('0xf')]({'where':_0x81ad52['where']})[_0x711e('0x1a')](function(_0x22be50){_0x4eaa8a[_0x711e('0xf')]=_0x22be50;if(_0x5b4d0c[_0x711e('0x1d')][_0x711e('0x95')]){_0x81ad52[_0x711e('0x96')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x711e('0x1c')](_0x81ad52);})[_0x711e('0x1a')](function(_0x148885){_0x4eaa8a[_0x711e('0x99')]=_0x148885;return _0x4eaa8a;});}})[_0x711e('0x1a')](respondWithFilteredResult(_0x4e2bea,_0x81ad52))[_0x711e('0x1f')](handleError(_0x4e2bea,null));};exports[_0x711e('0x9c')]=function(_0x6aa404,_0x31892b){var _0x5a12a6={'raw':!![],'where':{}};var _0x5433c5={};var _0x111cb8={'count':0x0,'rows':[]};return db[_0x711e('0x22')][_0x711e('0x70')]({'where':{'id':_0x6aa404[_0x711e('0x21')]['id']}})['then'](handleEntityNotFound(_0x31892b,null))[_0x711e('0x1a')](function(_0x16b68e){if(_0x16b68e){_0x5433c5[_0x711e('0x71')]=_['keys'](db['JscriptySessionReport'][_0x711e('0x72')]);_0x5433c5['query']=_[_0x711e('0x24')](_0x6aa404['query']);_0x5433c5['filters']=_['intersection'](_0x5433c5[_0x711e('0x71')],_0x5433c5['query']);_0x5a12a6[_0x711e('0x74')]=_['intersection'](_0x5433c5[_0x711e('0x71')],qs[_0x711e('0x76')](_0x6aa404[_0x711e('0x1d')][_0x711e('0x76')]));_0x5a12a6[_0x711e('0x74')]=_0x5a12a6[_0x711e('0x74')][_0x711e('0x25')]?_0x5a12a6[_0x711e('0x74')]:_0x5433c5[_0x711e('0x71')];if(!_0x6aa404[_0x711e('0x1d')]['hasOwnProperty'](_0x711e('0x7a'))){_0x5a12a6[_0x711e('0xe')]=qs[_0x711e('0xe')](_0x6aa404[_0x711e('0x1d')]['limit']);_0x5a12a6[_0x711e('0x10')]=qs['offset'](_0x6aa404['query']['offset']);}_0x5a12a6[_0x711e('0x77')]=qs[_0x711e('0x78')](_0x6aa404[_0x711e('0x1d')][_0x711e('0x78')]);_0x5a12a6[_0x711e('0x55')]=qs['filters'](_[_0x711e('0x93')](_0x6aa404['query'],_0x5433c5[_0x711e('0x73')]));_0x5a12a6[_0x711e('0x55')][_0x711e('0x9b')]=_0x16b68e['id'];if(_0x6aa404[_0x711e('0x1d')][_0x711e('0x79')]){_0x5a12a6[_0x711e('0x55')]=_['merge'](_0x5a12a6['where'],{'$or':_[_0x711e('0x64')](_0x5a12a6['attributes'],function(_0x3db039){var _0x5b0641={};_0x5b0641[_0x3db039]={'$like':'%'+_0x6aa404['query'][_0x711e('0x79')]+'%'};return _0x5b0641;})});}_0x5a12a6=_[_0x711e('0x31')]({},_0x5a12a6,_0x6aa404[_0x711e('0x94')]);return db[_0x711e('0x9d')][_0x711e('0xf')]({'where':_0x5a12a6[_0x711e('0x55')]})[_0x711e('0x1a')](function(_0x46a0fa){_0x111cb8['count']=_0x46a0fa;if(_0x6aa404[_0x711e('0x1d')]['includeAll']){_0x5a12a6[_0x711e('0x96')]=[{'all':!![]}];}return db[_0x711e('0x9d')][_0x711e('0x1c')](_0x5a12a6);})[_0x711e('0x1a')](function(_0x94d64f){_0x111cb8[_0x711e('0x99')]=_0x94d64f;return _0x111cb8;});}})[_0x711e('0x1a')](respondWithFilteredResult(_0x31892b,_0x5a12a6))['catch'](handleError(_0x31892b,null));};exports[_0x711e('0x9e')]=function(_0x58e83d,_0x379f16){try{if(!_0x58e83d['body'][_0x711e('0x56')]){throw new Error(_0x711e('0x9f'));}if(!_0x58e83d['body'][_0x711e('0xa0')]){throw new Error(_0x711e('0xa1'));}if(!_0x58e83d[_0x711e('0x32')][_0x711e('0xa2')]){throw new Error(_0x711e('0xa3'));}if(!_0x58e83d[_0x711e('0x32')][_0x711e('0xa4')]){throw new Error(_0x711e('0xa5'));}var _0x3cae16=_0x58e83d['body'][_0x711e('0xa0')]['split'](',');var _0x1b84fc=_0x58e83d[_0x711e('0x32')]['binding_values'][_0x711e('0xa6')](',');if(!_0x3cae16[_0x711e('0x25')]||!_0x1b84fc[_0x711e('0x25')]||_0x3cae16[_0x711e('0x25')]!==_0x1b84fc[_0x711e('0x25')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x58e83d[_0x711e('0x32')][_0x711e('0x76')]=_[_0x711e('0xa7')](_0x3cae16,_0x1b84fc);if(!_0x58e83d[_0x711e('0x32')][_0x711e('0x76')][_0x711e('0x6e')]){throw new Error(_0x711e('0xa8'));}if(!_0x58e83d['body'][_0x711e('0x76')][_0x711e('0xa9')]){throw new Error(_0x711e('0xaa'));}var _0x2715a6=path[_0x711e('0x36')](config[_0x711e('0xab')],'server/files/tmp',_0x58e83d[_0x711e('0xac')][_0x711e('0xad')]);fs[_0x711e('0xae')](_0x2715a6,parseInt(_0x711e('0xaf'),0x8));var _0x14d140=require('child_process')['fork'](path[_0x711e('0x36')](__dirname,_0x711e('0xb0')),[_0x2715a6,_0x58e83d[_0x711e('0x32')][_0x711e('0xa0')],_0x58e83d[_0x711e('0x32')]['binding_values'],_0x58e83d[_0x711e('0x32')]['ListId'],_0x58e83d[_0x711e('0x32')][_0x711e('0xb1')],_0x58e83d[_0x711e('0x32')][_0x711e('0x53')],_0x58e83d[_0x711e('0x32')][_0x711e('0xa4')]]);return _0x379f16[_0x711e('0xd')](0xc8)[_0x711e('0xb2')]({'message':'File\x20uploaded\x20correctly!','pid':_0x14d140['pid']});}catch(_0x3ca055){return _0x379f16[_0x711e('0xd')](0x1f4)['send'](_0x3ca055);}};exports['upload']=function(_0x2af645,_0x298e5f){var _0x4dcd5a=fs[_0x711e('0xb3')](_0x2af645[_0x711e('0xac')][_0x711e('0x2')]);Papa[_0x711e('0xb4')](_0x4dcd5a,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2e86ec){return _0x298e5f[_0x711e('0xd')](0xc8)['json']({'file':_0x2af645[_0x711e('0xac')],'fields':_0x2e86ec[_0x711e('0xb5')]['fields']});}});};exports[_0x711e('0xb6')]=function(_0x1dfd46,_0x270148){return db[_0x711e('0xb7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x18a342){var _0x1c5849=![];if(!_0x1dfd46[_0x711e('0x32')]['ListId']){throw new Error(_0x711e('0x9f'));}if(!_0x1dfd46[_0x711e('0x32')][_0x711e('0xb8')]['phone']){throw new Error(_0x711e('0xa8'));}if(!_0x1dfd46[_0x711e('0x32')][_0x711e('0xb8')][_0x711e('0xa9')]){throw new Error(_0x711e('0xaa'));}if(!_0x1dfd46['body'][_0x711e('0xa4')]){throw new Error(_0x711e('0xa5'));}var _0x543374=require('child_process')[_0x711e('0xb9')](path[_0x711e('0x36')](__dirname,_0x711e('0xba')),[_0x1dfd46['params']['id'],JSON[_0x711e('0xbb')](_0x1dfd46[_0x711e('0x32')]),JSON[_0x711e('0xbb')](_0x18a342)]);_0x543374['on'](_0x711e('0xbc'),function(){_0x1c5849=!![];return _0x270148[_0x711e('0xd')](0xc8)[_0x711e('0xb2')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x543374[_0x711e('0xbd')]});});_0x543374['on'](_0x711e('0xbe'),function(_0x2b0f0d){if(_0x2b0f0d&&!_0x1c5849){return _0x270148['status'](0x1f4)['json']({'message':_0x711e('0xbf'),'pid':_0x543374['pid']});}});})[_0x711e('0x1f')](handleError(_0x270148,null));};exports[_0x711e('0xc0')]=function(_0x49ba21,_0x1c2e28){return db[_0x711e('0xb7')][_0x711e('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':_0x711e('0xc1')}})[_0x711e('0x1a')](function(_0x623fda){var _0x2ac158=![];if(!_0x49ba21[_0x711e('0x32')][_0x711e('0x56')]){throw new Error(_0x711e('0x9f'));}if(!_0x49ba21[_0x711e('0x32')][_0x711e('0xb8')]['phone']){throw new Error(_0x711e('0xa8'));}if(!_0x49ba21[_0x711e('0x32')][_0x711e('0xb8')][_0x711e('0xa9')]){throw new Error(_0x711e('0xaa'));}if(!_0x49ba21[_0x711e('0x32')][_0x711e('0xa4')]){throw new Error(_0x711e('0xa5'));}var _0x2eaf26=require(_0x711e('0xc2'))[_0x711e('0xb9')](path['join'](__dirname,_0x711e('0xc3')),[_0x49ba21[_0x711e('0x21')]['id'],JSON[_0x711e('0xbb')](_0x49ba21[_0x711e('0x32')]),JSON[_0x711e('0xbb')](_0x623fda)]);_0x2eaf26['on']('message',function(){_0x2ac158=!![];return _0x1c2e28[_0x711e('0xd')](0xc8)['json']({'message':_0x711e('0xc4'),'pid':_0x2eaf26['pid']});});_0x2eaf26['on']('exit',function(_0x52989a){if(_0x52989a&&!_0x2ac158){return _0x1c2e28[_0x711e('0xd')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x2eaf26[_0x711e('0xbd')]});}});})[_0x711e('0x1f')](handleError(_0x1c2e28,null));};exports[_0x711e('0xc5')]=function(_0x4aa92d,_0x15476c){var _0x5e284a=[_0x711e('0xc6'),_0x711e('0xc7'),'sms',_0x711e('0xc8'),_0x711e('0xc9'),'whatsapp',_0x711e('0xca')];var _0x27a3fb={'offset':0x0,'order':qs['sort']('-createdAt')},_0x3fbf46={'count':0x0,'rows':[]};Promise['resolve']()[_0x711e('0x1a')](function(){if(_0x4aa92d[_0x711e('0x1d')][_0x711e('0xcb')]){if(!_[_0x711e('0xcc')](_0x5e284a,_0x4aa92d[_0x711e('0x1d')][_0x711e('0xcb')][_0x711e('0xcd')]())){throw new Error(_0x711e('0xce'));}_0x5e284a=[_0x4aa92d[_0x711e('0x1d')][_0x711e('0xcb')][_0x711e('0xcd')]()];}if(_0x4aa92d['query'][_0x711e('0xcf')]){try{var _0x1b2873=JSON[_0x711e('0xb4')](_0x4aa92d[_0x711e('0x1d')][_0x711e('0xcf')]);if(!moment(_0x1b2873['from'])[_0x711e('0xd0')]()){throw new Error(_0x711e('0xd1'));}if(!moment(_0x1b2873['to'])['isValid']()){throw new Error(_0x711e('0xd2'));}}catch(_0x472246){throw new Error(_0x711e('0xd3'));}}if(!_0x4aa92d[_0x711e('0x1d')][_0x711e('0x30')](_0x711e('0x7a'))){_0x27a3fb['limit']=qs[_0x711e('0xe')](_0x4aa92d['query'][_0x711e('0xe')]||0xa);_0x27a3fb[_0x711e('0x10')]=qs[_0x711e('0x10')](_0x4aa92d[_0x711e('0x1d')]['offset']);}var _0xead829=_0x5e284a[_0x711e('0x64')](function(_0x26d349){if(_0x26d349===_0x711e('0xca')){var _0x1b1dac={'attributes':['id','uniqueid',_0x711e('0x2c'),'source',_0x711e('0xd4'),_0x711e('0xd5'),_0x711e('0xd6'),_0x711e('0xd7'),_0x711e('0xd8'),_0x711e('0xd9'),'createdAt','userDisposition',_0x711e('0xda'),_0x711e('0xdb'),_0x711e('0xdc')],'where':{'ContactId':_0x4aa92d['params']['id']},'include':[{'model':db['User'],'as':'User','attributes':['id','name',_0x711e('0xdd'),'alias']}],'order':[['createdAt',_0x711e('0xde')]]};if(_0x4aa92d[_0x711e('0x1d')][_0x711e('0xcf')]){_0x1b1dac[_0x711e('0x55')]['createdAt']={'$gte':_0x1b2873[_0x711e('0x33')],'$lte':_0x1b2873['to']};}return db[_0x711e('0x48')][_0x711e('0xdf')](_0x1b1dac)[_0x711e('0x1a')](function(_0x965422){_0x3fbf46[_0x711e('0xf')]+=_0x965422[_0x711e('0xf')];return _[_0x711e('0x64')](_0x965422[_0x711e('0x99')],function(_0x2151d8){var _0x1c15ea=_0x2151d8['get']({'plain':!![]});_0x1c15ea[_0x711e('0xcb')]=_0x26d349;if(_0x1c15ea[_0x711e('0xb7')]){_0x1c15ea[_0x711e('0xb7')]={'id':_0x1c15ea[_0x711e('0xb7')]['id'],'name':_0x1c15ea[_0x711e('0xb7')][_0x711e('0x16')],'fullname':_0x1c15ea[_0x711e('0xb7')]['fullname'],'alias':_0x1c15ea[_0x711e('0xb7')][_0x711e('0xe0')]};}return _0x1c15ea;});});}else{var _0x355020=_[_0x711e('0xe1')](_0x26d349)+(_0x26d349===_0x711e('0xc7')?_0x711e('0xe2'):_0x711e('0xe3'));var _0x2aabe9={'attributes':['id',_0x711e('0xe4'),_0x711e('0xe5'),'createdAt',_0x711e('0xd9'),_0x711e('0xe6'),_0x711e('0xe7'),'thirdDisposition','UserId',_0x355020+'Id'],'where':{'ContactId':_0x4aa92d[_0x711e('0x21')]['id']},'include':[{'model':db[_0x355020],'as':_0x711e('0xe3'),'attributes':['id','name',_0x711e('0xe8')]},{'model':db[_0x711e('0xb7')],'as':_0x711e('0xe9'),'attributes':['id',_0x711e('0x16'),_0x711e('0xdd')]},{'model':db['Tag'],'as':_0x711e('0xea'),'attributes':['id',_0x711e('0x16'),'color'],'through':{'attributes':[]}}],'order':[[_0x711e('0xeb'),_0x711e('0xde')]]};if(_0x4aa92d[_0x711e('0x1d')][_0x711e('0xcf')]){_0x2aabe9[_0x711e('0x55')][_0x711e('0xeb')]={'$gte':_0x1b2873['from'],'$lte':_0x1b2873['to']};}switch(_0x26d349){case _0x711e('0xc7'):_0x2aabe9[_0x711e('0x74')]['push'](_0x711e('0xec'),_0x711e('0xed'),_0x711e('0xee'),'deviceModel',_0x711e('0xef'),_0x711e('0xf0'),_0x711e('0xf1'),_0x711e('0xf2'),'referer');break;case _0x711e('0xc6'):_0x2aabe9[_0x711e('0x74')][_0x711e('0x59')]('subject',_0x711e('0xf3'));break;case'openchannel':_0x2aabe9[_0x711e('0x74')][_0x711e('0x59')](_0x711e('0xf4'),'threadId');break;}return db[_[_0x711e('0xe1')](_0x26d349)+_0x711e('0xf5')][_0x711e('0xdf')](_0x2aabe9)[_0x711e('0x1a')](function(_0xd91ac8){_0x3fbf46[_0x711e('0xf')]+=_0xd91ac8['count'];return _[_0x711e('0x64')](_0xd91ac8[_0x711e('0x99')],function(_0x40310b){var _0x34d6c0=_0x40310b['get']({'plain':!![]});_0x34d6c0[_0x711e('0xcb')]=_0x26d349;if(_0x34d6c0[_0x711e('0xe9')]){_0x34d6c0[_0x711e('0xe9')]={'id':_0x34d6c0[_0x711e('0xe9')]['id'],'name':_0x34d6c0[_0x711e('0xe9')]['name'],'fullname':_0x34d6c0[_0x711e('0xe9')][_0x711e('0xdd')]};}return _0x34d6c0;});});}});return Promise[_0x711e('0x7e')](_0xead829);})[_0x711e('0x1a')](function(_0x49da13){return _(_0x49da13)[_0x711e('0xf6')]()[_0x711e('0xf7')](_0x711e('0xeb'))['reverse']()[_0x711e('0xf8')]();})[_0x711e('0x1a')](function(_0x2da984){_0x3fbf46[_0x711e('0x99')]=_0x27a3fb[_0x711e('0xe')]?_0x2da984[_0x711e('0xf9')](_0x27a3fb[_0x711e('0x10')],_0x27a3fb['offset']+_0x27a3fb[_0x711e('0xe')]):_0x2da984;return _0x3fbf46;})[_0x711e('0x1a')](respondWithFilteredResult(_0x15476c,_0x27a3fb))[_0x711e('0x1f')](handleError(_0x15476c,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 3c467f3..2cb16ad 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e88=['emit','hasOwnProperty','../../mysqldb','CmContact','setMaxListeners','save','update','remove'];(function(_0x61691d,_0x286f15){var _0xf22e47=function(_0x32013c){while(--_0x32013c){_0x61691d['push'](_0x61691d['shift']());}};_0xf22e47(++_0x286f15);}(_0x2e88,0xf2));var _0x82e8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2e88[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x82e8('0x0'))['db'][_0x82e8('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x82e8('0x2')](0x0);var events={'afterCreate':_0x82e8('0x3'),'afterUpdate':_0x82e8('0x4'),'afterDestroy':_0x82e8('0x5')};function emitEvent(_0x3903cb){return function(_0x1b0270,_0x1de1ef,_0x4b18bb){CmContactEvents[_0x82e8('0x6')](_0x3903cb+':'+_0x1b0270['id'],_0x1b0270);CmContactEvents[_0x82e8('0x6')](_0x3903cb,_0x1b0270);_0x4b18bb(null);};}for(var e in events){if(events[_0x82e8('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x6b33=['emit','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x3dd2d6,_0x863be5){var _0x46084e=function(_0x208e4b){while(--_0x208e4b){_0x3dd2d6['push'](_0x3dd2d6['shift']());}};_0x46084e(++_0x863be5);}(_0x6b33,0x161));var _0x36b3=function(_0x4fd1df,_0x35b769){_0x4fd1df=_0x4fd1df-0x0;var _0x81821d=_0x6b33[_0x4fd1df];return _0x81821d;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x36b3('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x36b3('0x1')](0x0);var events={'afterCreate':_0x36b3('0x2'),'afterUpdate':_0x36b3('0x3'),'afterDestroy':'remove'};function emitEvent(_0x17a02a){return function(_0x5c2fcf,_0xaf92f9,_0xf9496c){CmContactEvents[_0x36b3('0x4')](_0x17a02a+':'+_0x5c2fcf['id'],_0x5c2fcf);CmContactEvents[_0x36b3('0x4')](_0x17a02a,_0x5c2fcf);_0xf9496c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x36b3('0x5')](e,emitEvent(event));}}module[_0x36b3('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c42df40..4319034 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe56a=['fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','catch','[cmContact][afterCreate]','message','isEmpty','destroy','ContactId','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','VoiceQueue','scheduledat','format','dialTimezone','resolve','findOne','then','isNil','timezones','utcOffset','add','YYYY-MM-DD\x20HH:mm:ss','phone','priority','callbackUniqueid','assign','CmHopper','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','create','dialCheckDuplicateType','always','findAll','outbound','CmList','Lists','ListId','map','all','Campaign','BlackLists','CmHopperBlack','exports','CmContact','cm_contacts','fti_cm_contacts','firstName'];(function(_0x51557b,_0x521c80){var _0x83171=function(_0x17bd85){while(--_0x17bd85){_0x51557b['push'](_0x51557b['shift']());}};_0x83171(++_0x521c80);}(_0xe56a,0x1c9));var _0xae56=function(_0x418a35,_0x44ba22){_0x418a35=_0x418a35-0x0;var _0x2da4b7=_0xe56a[_0x418a35];return _0x2da4b7;};'use strict';var _=require(_0xae56('0x0'));var util=require(_0xae56('0x1'));var logger=require(_0xae56('0x2'))(_0xae56('0x3'));var moment=require('moment');var shared=require(_0xae56('0x4'));var attributes=require(_0xae56('0x5'));function getTimezoneCallbackAt(_0x5c3790,_0x29c024,_0x3e6fc2,_0x200e97){var _0x34a441=_0x200e97?'Campaign':_0xae56('0x6');var _0x1bd33e=_0x3e6fc2[_0xae56('0x7')]?_0x3e6fc2[_0xae56('0x7')]:moment()[_0xae56('0x8')]('YYYY-MM-DD\x20HH:mm:ss');if(_['isNil'](_0x3e6fc2[_0xae56('0x9')])){return Promise[_0xae56('0xa')](_0x1bd33e);}return _0x5c3790[_0x34a441][_0xae56('0xb')]({'where':{'id':_0x29c024}})[_0xae56('0xc')](function(_0x371901){if(_[_0xae56('0xd')](_0x371901)||_[_0xae56('0xd')](_0x371901[_0xae56('0x9')])){return Promise['resolve'](_0x1bd33e);}var _0x32de10=shared[_0xae56('0xe')];var _0x1689c7=_0x32de10[_0x371901[_0xae56('0x9')]];var _0x137ba2=_0x32de10[_0x3e6fc2['dialTimezone']];if(_[_0xae56('0xd')](_0x1689c7)&&_['isNil'](_0x137ba2)){return Promise['resolve'](_0x1bd33e);}var _0x5b1014=_0x1689c7[_0xae56('0xf')]-_0x137ba2[_0xae56('0xf')];var _0x518391=_0x3e6fc2[_0xae56('0x7')]?_0x3e6fc2[_0xae56('0x7')]:moment();_0x1bd33e=moment(_0x518391)[_0xae56('0x10')](_0x5b1014,'minutes')[_0xae56('0x8')](_0xae56('0x11'));return Promise[_0xae56('0xa')](_0x1bd33e);});}function getNewHopperPayload(_0x3ad2d9){return{'phone':_0x3ad2d9[_0xae56('0x12')],'ContactId':_0x3ad2d9['id'],'ListId':_0x3ad2d9['ListId'],'scheduledat':_0x3ad2d9[_0xae56('0x7')]?_0x3ad2d9[_0xae56('0x7')]:moment()['format'](_0xae56('0x11')),'priority':_0x3ad2d9[_0xae56('0x13')]?_0x3ad2d9[_0xae56('0x13')]:0x2,'callback':_0x3ad2d9['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3ad2d9[_0xae56('0x14')]?_0x3ad2d9[_0xae56('0x14')]:undefined,'callbackat':_0x3ad2d9['callbackUniqueid']?moment()[_0xae56('0x8')](_0xae56('0x11')):undefined};}function handleAlwaysCheckDuplicate(_0x3a0be4,_0x5ee901,_0x31fcce,_0x24f8a1){var _0x384830={'phone':_0x31fcce[_0xae56('0x12')]};var _0x149d9f={'calleridnum':_0x31fcce[_0xae56('0x12')]};if(_0x24f8a1){Object['assign'](_0x384830,{'CampaignId':_0x5ee901['id']});Object['assign'](_0x149d9f,{'CampaignId':_0x5ee901['id']});}else{Object[_0xae56('0x15')](_0x384830,{'VoiceQueueId':_0x5ee901['id']});Object['assign'](_0x149d9f,{'VoiceQueueId':_0x5ee901['id']});}return _0x3a0be4[_0xae56('0x16')][_0xae56('0xb')]({'where':_0x384830})[_0xae56('0xc')](function(_0x2d5b75){if(_0x2d5b75){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x31fcce[_0xae56('0x12')]+_0xae56('0x17')+_0x5ee901['id']);}return _0x3a0be4[_0xae56('0x18')][_0xae56('0xb')]({'where':_0x149d9f});})[_0xae56('0xc')](function(_0x1043f5){if(_0x1043f5){throw new Error(_0xae56('0x19')+_0x31fcce[_0xae56('0x12')]+_0xae56('0x17')+_0x5ee901['id']);}var _0x551e72=getNewHopperPayload(_0x31fcce);if(_0x24f8a1){_0x551e72[_0xae56('0x1a')]=_0x5ee901['id'];}else{_0x551e72['VoiceQueueId']=_0x5ee901['id'];}return _0x3a0be4[_0xae56('0x16')]['create'](_0x551e72);});}function handleOnlyIfOpenCheckDuplicate(_0xe05f4f,_0x7eb3fe,_0x4a086d,_0xf53d8b){var _0x55ecf0={'phone':_0x4a086d[_0xae56('0x12')]};if(_0xf53d8b){Object[_0xae56('0x15')](_0x55ecf0,{'CampaignId':_0x7eb3fe['id']});}else{Object[_0xae56('0x15')](_0x55ecf0,{'VoiceQueueId':_0x7eb3fe['id']});}return _0xe05f4f[_0xae56('0x16')][_0xae56('0xb')]({'where':_0x55ecf0})[_0xae56('0xc')](function(_0x40ed5d){if(_0x40ed5d){throw new Error(_0xae56('0x1b')+_0x4a086d[_0xae56('0x12')]+_0xae56('0x17')+_0x7eb3fe['id']);}var _0x413c7f=getNewHopperPayload(_0x4a086d);if(_0xf53d8b){_0x413c7f[_0xae56('0x1a')]=_0x7eb3fe['id'];}else{_0x413c7f[_0xae56('0x1c')]=_0x7eb3fe['id'];}return _0xe05f4f['CmHopper'][_0xae56('0x1d')](_0x413c7f);});}function handleNeverCheckDuplicate(_0x302621,_0x34488b,_0x22a082){var _0x299075=getNewHopperPayload(_0x22a082);_0x299075[_0xae56('0x1c')]=_0x34488b['id'];return _0x302621[_0xae56('0x16')][_0xae56('0x1d')](_0x299075);}function handleCheckDuplicate(_0x4796f4,_0x2b4e72,_0x1cd388,_0x51d634){return getTimezoneCallbackAt(_0x4796f4,_0x2b4e72,_0x1cd388,_0x51d634)[_0xae56('0xc')](function(_0x499cbd){_0x1cd388[_0xae56('0x7')]=_0x499cbd;switch(_0x2b4e72[_0xae56('0x1e')]){case _0xae56('0x1f'):return handleAlwaysCheckDuplicate(_0x4796f4,_0x2b4e72,_0x1cd388,_0x51d634);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x4796f4,_0x2b4e72,_0x1cd388,_0x51d634);default:return handleNeverCheckDuplicate(_0x4796f4,_0x2b4e72,_0x1cd388);}});}function createHopperForVoiceQueues(_0x2a93cb,_0x3a7666){return _0x2a93cb[_0xae56('0x6')][_0xae56('0x20')]({'where':{'type':_0xae56('0x21')},'attributes':['id',_0xae56('0x1e'),_0xae56('0x9')],'include':[{'model':_0x2a93cb[_0xae56('0x22')],'as':_0xae56('0x23'),'where':{'id':_0x3a7666[_0xae56('0x24')]}}],'raw':!![]})['then'](function(_0xe7dca6){var _0x5d94f0=_0xe7dca6[_0xae56('0x25')](function(_0x1e04ad){return handleCheckDuplicate(_0x2a93cb,_0x1e04ad,_0x3a7666,![]);});return Promise[_0xae56('0x26')](_0x5d94f0);});}function createHopperForCampaigns(_0x1a96b6,_0x245bd){return _0x1a96b6[_0xae56('0x27')][_0xae56('0x20')]({'attributes':['id',_0xae56('0x1e'),_0xae56('0x9')],'include':[{'model':_0x1a96b6[_0xae56('0x22')],'as':_0xae56('0x23'),'where':{'id':_0x245bd[_0xae56('0x24')]}}],'raw':!![]})[_0xae56('0xc')](function(_0x1efca5){var _0x4ed741=_0x1efca5[_0xae56('0x25')](function(_0x3a1376){return handleCheckDuplicate(_0x1a96b6,_0x3a1376,_0x245bd,!![]);});return Promise[_0xae56('0x26')](_0x4ed741);});}function createHopperBlackForVoiceQueues(_0x35038b,_0x665e01){return _0x35038b[_0xae56('0x6')]['findAll']({'where':{'type':_0xae56('0x21')},'attributes':['id'],'include':[{'model':_0x35038b[_0xae56('0x22')],'as':_0xae56('0x28'),'where':{'id':_0x665e01[_0xae56('0x24')]}}],'raw':!![]})[_0xae56('0xc')](function(_0x3d29c0){var _0x357c82=_0x3d29c0[_0xae56('0x25')](function(_0x196c35){return _0x35038b[_0xae56('0x29')][_0xae56('0x1d')]({'phone':_0x665e01[_0xae56('0x12')],'ContactId':_0x665e01['id'],'ListId':_0x665e01['ListId'],'VoiceQueueId':_0x196c35['id']});});return Promise[_0xae56('0x26')](_0x357c82);});}function createHopperBlackForCampaigns(_0x21f142,_0x102490){return _0x21f142['Campaign'][_0xae56('0x20')]({'attributes':['id'],'include':[{'model':_0x21f142[_0xae56('0x22')],'as':_0xae56('0x28'),'where':{'id':_0x102490[_0xae56('0x24')]}}],'raw':!![]})[_0xae56('0xc')](function(_0x1bfec6){var _0x814d51=_0x1bfec6[_0xae56('0x25')](function(_0x2e01f5){return _0x21f142[_0xae56('0x29')]['create']({'phone':_0x102490[_0xae56('0x12')],'ContactId':_0x102490['id'],'ListId':_0x102490[_0xae56('0x24')],'CampaignId':_0x2e01f5['id']});});return Promise[_0xae56('0x26')](_0x814d51);});}module[_0xae56('0x2a')]=function(_0x4c9389){return _0x4c9389['define'](_0xae56('0x2b'),attributes,{'tableName':_0xae56('0x2c'),'paranoid':!![],'indexes':[{'name':_0xae56('0x12'),'fields':['phone']},{'name':_0xae56('0x2d'),'fields':[_0xae56('0x2e'),'lastName',_0xae56('0x12'),'mobile',_0xae56('0x2f'),_0xae56('0x30')],'type':_0xae56('0x31')}],'timestamps':!![],'charset':_0xae56('0x32'),'collate':_0xae56('0x33'),'hooks':{'afterCreate':function(_0x35ea0c,_0x352e54,_0x32f077){var _0x1881f8=_0x4c9389[_0xae56('0x34')];var _0x2c5a36=_0x35ea0c[_0xae56('0x35')]({'plain':!![]});if(!_0x2c5a36[_0xae56('0x24')]){logger[_0xae56('0x36')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x2c5a36['id']);return _0x32f077();}if(!_0x2c5a36[_0xae56('0x12')]){return _0x32f077();}return createHopperForVoiceQueues(_0x1881f8,_0x2c5a36)[_0xae56('0xc')](function(){return createHopperBlackForVoiceQueues(_0x1881f8,_0x2c5a36);})[_0xae56('0xc')](function(){return createHopperForCampaigns(_0x1881f8,_0x2c5a36);})[_0xae56('0xc')](function(){return createHopperBlackForCampaigns(_0x1881f8,_0x2c5a36);})[_0xae56('0xc')](function(){return _0x32f077();})[_0xae56('0x37')](function(_0x2e613f){logger[_0xae56('0x36')](_0xae56('0x38'),_0x2e613f[_0xae56('0x39')]);_0x32f077();});},'afterDestroy':function(_0xad6ee6,_0x15a870,_0x555b57){var _0x48f373=_0x4c9389[_0xae56('0x34')];var _0xccfea6=_0xad6ee6[_0xae56('0x35')]({'plain':!![]});return _0x48f373[_0xae56('0x16')][_0xae56('0x20')]({'raw':!![],'where':{'ListId':_0xccfea6[_0xae56('0x24')],'ContactId':_0xccfea6['id']}})['then'](function(_0x4a5ba7){if(!_[_0xae56('0x3a')](_0x4a5ba7)){var _0x2bc228=[];for(var _0x57e92b=0x0;_0x57e92b<_0x4a5ba7['length'];_0x57e92b+=0x1){var _0x1b4fbf=_0x48f373[_0xae56('0x16')][_0xae56('0x3b')]({'where':{'ListId':_0x4a5ba7[_0x57e92b][_0xae56('0x24')],'ContactId':_0x4a5ba7[_0x57e92b][_0xae56('0x3c')],'VoiceQueueId':_0x4a5ba7[_0x57e92b]['VoiceQueueId'],'CampaignId':_0x4a5ba7[_0x57e92b][_0xae56('0x1a')]}});_0x2bc228['push'](_0x1b4fbf);}return Promise[_0xae56('0x26')](_0x2bc228);}})[_0xae56('0xc')](function(_0x13b40a){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0xae56('0x3d')](_0x13b40a,{'showHidden':![],'depth':null}));_0x555b57();})['catch'](function(_0x526a68){logger[_0xae56('0x36')](_0xae56('0x3e'),util['inspect'](_0x526a68,{'showHidden':![],'depth':null}));_0x555b57(_0x526a68);});}}});}; \ No newline at end of file +var _0x3d49=['format','YYYY-MM-DD\x20HH:mm:ss','isNil','resolve','then','dialTimezone','timezones','add','minutes','phone','ListId','priority','callbackUniqueid','assign','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','CmHopper','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','create','dialCheckDuplicateType','outbound','CmList','map','findAll','Lists','all','CmHopperBlack','BlackLists','exports','define','CmContact','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','message','isEmpty','length','destroy','push','info','[CmContact][afterDestroy][Succesfull]','catch','inspect','../../config/logger','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat'];(function(_0x377b59,_0x1f167d){var _0x2cae54=function(_0x292df1){while(--_0x292df1){_0x377b59['push'](_0x377b59['shift']());}};_0x2cae54(++_0x1f167d);}(_0x3d49,0x1f1));var _0x93d4=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x3d49[_0x3598bb];return _0x13c837;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x93d4('0x0'))('api');var moment=require(_0x93d4('0x1'));var shared=require(_0x93d4('0x2'));var attributes=require(_0x93d4('0x3'));function getTimezoneCallbackAt(_0x4e37c1,_0x20aa66,_0x440f5c,_0x267ebf){var _0x56507d=_0x267ebf?_0x93d4('0x4'):_0x93d4('0x5');var _0x2316c1=_0x440f5c[_0x93d4('0x6')]?_0x440f5c['scheduledat']:moment()[_0x93d4('0x7')](_0x93d4('0x8'));if(_[_0x93d4('0x9')](_0x440f5c['dialTimezone'])){return Promise[_0x93d4('0xa')](_0x2316c1);}return _0x4e37c1[_0x56507d]['findOne']({'where':{'id':_0x20aa66}})[_0x93d4('0xb')](function(_0x198f09){if(_[_0x93d4('0x9')](_0x198f09)||_[_0x93d4('0x9')](_0x198f09[_0x93d4('0xc')])){return Promise[_0x93d4('0xa')](_0x2316c1);}var _0x56d462=shared[_0x93d4('0xd')];var _0x19455d=_0x56d462[_0x198f09[_0x93d4('0xc')]];var _0x10dd09=_0x56d462[_0x440f5c[_0x93d4('0xc')]];if(_[_0x93d4('0x9')](_0x19455d)&&_['isNil'](_0x10dd09)){return Promise[_0x93d4('0xa')](_0x2316c1);}var _0x37b48f=_0x19455d['utcOffset']-_0x10dd09['utcOffset'];var _0x1cf803=_0x440f5c[_0x93d4('0x6')]?_0x440f5c[_0x93d4('0x6')]:moment();_0x2316c1=moment(_0x1cf803)[_0x93d4('0xe')](_0x37b48f,_0x93d4('0xf'))[_0x93d4('0x7')]('YYYY-MM-DD\x20HH:mm:ss');return Promise[_0x93d4('0xa')](_0x2316c1);});}function getNewHopperPayload(_0x29b0a9){return{'phone':_0x29b0a9[_0x93d4('0x10')],'ContactId':_0x29b0a9['id'],'ListId':_0x29b0a9[_0x93d4('0x11')],'scheduledat':_0x29b0a9[_0x93d4('0x6')]?_0x29b0a9[_0x93d4('0x6')]:moment()[_0x93d4('0x7')](_0x93d4('0x8')),'priority':_0x29b0a9['priority']?_0x29b0a9[_0x93d4('0x12')]:0x2,'callback':_0x29b0a9['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x29b0a9[_0x93d4('0x13')]?_0x29b0a9[_0x93d4('0x13')]:undefined,'callbackat':_0x29b0a9['callbackUniqueid']?moment()['format'](_0x93d4('0x8')):undefined};}function handleAlwaysCheckDuplicate(_0xd6ff68,_0x1ed888,_0x10dbb4,_0x45f422){var _0x323dfe={'phone':_0x10dbb4[_0x93d4('0x10')]};var _0x4c5873={'calleridnum':_0x10dbb4[_0x93d4('0x10')]};if(_0x45f422){Object[_0x93d4('0x14')](_0x323dfe,{'CampaignId':_0x1ed888['id']});Object[_0x93d4('0x14')](_0x4c5873,{'CampaignId':_0x1ed888['id']});}else{Object['assign'](_0x323dfe,{'VoiceQueueId':_0x1ed888['id']});Object['assign'](_0x4c5873,{'VoiceQueueId':_0x1ed888['id']});}return _0xd6ff68['CmHopper'][_0x93d4('0x15')]({'where':_0x323dfe})[_0x93d4('0xb')](function(_0x34d07c){if(_0x34d07c){throw new Error(_0x93d4('0x16')+_0x10dbb4[_0x93d4('0x10')]+_0x93d4('0x17')+_0x1ed888['id']);}return _0xd6ff68[_0x93d4('0x18')][_0x93d4('0x15')]({'where':_0x4c5873});})[_0x93d4('0xb')](function(_0x43111c){if(_0x43111c){throw new Error(_0x93d4('0x19')+_0x10dbb4['phone']+_0x93d4('0x17')+_0x1ed888['id']);}var _0x4e2af4=getNewHopperPayload(_0x10dbb4);if(_0x45f422){_0x4e2af4[_0x93d4('0x1a')]=_0x1ed888['id'];}else{_0x4e2af4['VoiceQueueId']=_0x1ed888['id'];}return _0xd6ff68[_0x93d4('0x1b')]['create'](_0x4e2af4);});}function handleOnlyIfOpenCheckDuplicate(_0x3d9f61,_0x22c99b,_0xfa0686,_0x44602c){var _0x55b9ab={'phone':_0xfa0686[_0x93d4('0x10')]};if(_0x44602c){Object[_0x93d4('0x14')](_0x55b9ab,{'CampaignId':_0x22c99b['id']});}else{Object['assign'](_0x55b9ab,{'VoiceQueueId':_0x22c99b['id']});}return _0x3d9f61[_0x93d4('0x1b')][_0x93d4('0x15')]({'where':_0x55b9ab})[_0x93d4('0xb')](function(_0x393eae){if(_0x393eae){throw new Error(_0x93d4('0x1c')+_0xfa0686[_0x93d4('0x10')]+_0x93d4('0x17')+_0x22c99b['id']);}var _0x1c5607=getNewHopperPayload(_0xfa0686);if(_0x44602c){_0x1c5607[_0x93d4('0x1a')]=_0x22c99b['id'];}else{_0x1c5607[_0x93d4('0x1d')]=_0x22c99b['id'];}return _0x3d9f61[_0x93d4('0x1b')][_0x93d4('0x1e')](_0x1c5607);});}function handleNeverCheckDuplicate(_0x2be47a,_0x49f892,_0x1a4f2e){var _0x5b4c8a=getNewHopperPayload(_0x1a4f2e);_0x5b4c8a['VoiceQueueId']=_0x49f892['id'];return _0x2be47a[_0x93d4('0x1b')][_0x93d4('0x1e')](_0x5b4c8a);}function handleCheckDuplicate(_0xfd9dc5,_0x443510,_0x578c53,_0x574fae){return getTimezoneCallbackAt(_0xfd9dc5,_0x443510,_0x578c53,_0x574fae)[_0x93d4('0xb')](function(_0x126a26){_0x578c53['scheduledat']=_0x126a26;switch(_0x443510[_0x93d4('0x1f')]){case'always':return handleAlwaysCheckDuplicate(_0xfd9dc5,_0x443510,_0x578c53,_0x574fae);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0xfd9dc5,_0x443510,_0x578c53,_0x574fae);default:return handleNeverCheckDuplicate(_0xfd9dc5,_0x443510,_0x578c53);}});}function createHopperForVoiceQueues(_0x4e124a,_0x2e6db3){return _0x4e124a[_0x93d4('0x5')]['findAll']({'where':{'type':_0x93d4('0x20')},'attributes':['id','dialCheckDuplicateType',_0x93d4('0xc')],'include':[{'model':_0x4e124a[_0x93d4('0x21')],'as':'Lists','where':{'id':_0x2e6db3['ListId']}}],'raw':!![]})['then'](function(_0x1b41ca){var _0x5d57f2=_0x1b41ca[_0x93d4('0x22')](function(_0x43d62e){return handleCheckDuplicate(_0x4e124a,_0x43d62e,_0x2e6db3,![]);});return Promise['all'](_0x5d57f2);});}function createHopperForCampaigns(_0x2fdf13,_0x5328f7){return _0x2fdf13[_0x93d4('0x4')][_0x93d4('0x23')]({'attributes':['id',_0x93d4('0x1f'),_0x93d4('0xc')],'include':[{'model':_0x2fdf13['CmList'],'as':_0x93d4('0x24'),'where':{'id':_0x5328f7[_0x93d4('0x11')]}}],'raw':!![]})[_0x93d4('0xb')](function(_0x502495){var _0x51362f=_0x502495[_0x93d4('0x22')](function(_0x2cbdde){return handleCheckDuplicate(_0x2fdf13,_0x2cbdde,_0x5328f7,!![]);});return Promise[_0x93d4('0x25')](_0x51362f);});}function createHopperBlackForVoiceQueues(_0x49eeb0,_0x17ea25){return _0x49eeb0[_0x93d4('0x5')][_0x93d4('0x23')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x49eeb0['CmList'],'as':'BlackLists','where':{'id':_0x17ea25[_0x93d4('0x11')]}}],'raw':!![]})['then'](function(_0x24b379){var _0x26c738=_0x24b379['map'](function(_0x5e0e5f){return _0x49eeb0[_0x93d4('0x26')][_0x93d4('0x1e')]({'phone':_0x17ea25['phone'],'ContactId':_0x17ea25['id'],'ListId':_0x17ea25['ListId'],'VoiceQueueId':_0x5e0e5f['id']});});return Promise[_0x93d4('0x25')](_0x26c738);});}function createHopperBlackForCampaigns(_0xc5713c,_0x3ff105){return _0xc5713c[_0x93d4('0x4')]['findAll']({'attributes':['id'],'include':[{'model':_0xc5713c[_0x93d4('0x21')],'as':_0x93d4('0x27'),'where':{'id':_0x3ff105[_0x93d4('0x11')]}}],'raw':!![]})[_0x93d4('0xb')](function(_0xc0af83){var _0x3f2446=_0xc0af83[_0x93d4('0x22')](function(_0x4443f5){return _0xc5713c['CmHopperBlack'][_0x93d4('0x1e')]({'phone':_0x3ff105[_0x93d4('0x10')],'ContactId':_0x3ff105['id'],'ListId':_0x3ff105[_0x93d4('0x11')],'CampaignId':_0x4443f5['id']});});return Promise[_0x93d4('0x25')](_0x3f2446);});}module[_0x93d4('0x28')]=function(_0x2f9dee){return _0x2f9dee[_0x93d4('0x29')](_0x93d4('0x2a'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0x93d4('0x10')]},{'name':_0x93d4('0x2b'),'fields':[_0x93d4('0x2c'),_0x93d4('0x2d'),'phone','mobile',_0x93d4('0x2e'),_0x93d4('0x2f')],'type':_0x93d4('0x30')}],'timestamps':!![],'charset':_0x93d4('0x31'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x5ae2de,_0xb9b2c6,_0x35ef43){var _0x494242=_0x2f9dee[_0x93d4('0x32')];var _0x7425b3=_0x5ae2de[_0x93d4('0x33')]({'plain':!![]});if(!_0x7425b3[_0x93d4('0x11')]){logger[_0x93d4('0x34')](_0x93d4('0x35')+_0x7425b3['id']);return _0x35ef43();}if(!_0x7425b3['phone']){return _0x35ef43();}return createHopperForVoiceQueues(_0x494242,_0x7425b3)[_0x93d4('0xb')](function(){return createHopperBlackForVoiceQueues(_0x494242,_0x7425b3);})[_0x93d4('0xb')](function(){return createHopperForCampaigns(_0x494242,_0x7425b3);})[_0x93d4('0xb')](function(){return createHopperBlackForCampaigns(_0x494242,_0x7425b3);})[_0x93d4('0xb')](function(){return _0x35ef43();})['catch'](function(_0x49f67d){logger['error']('[cmContact][afterCreate]',_0x49f67d[_0x93d4('0x36')]);_0x35ef43();});},'afterDestroy':function(_0x469d4b,_0x199a54,_0x59eaf9){var _0x3a0997=_0x2f9dee[_0x93d4('0x32')];var _0x562fe4=_0x469d4b['get']({'plain':!![]});return _0x3a0997['CmHopper'][_0x93d4('0x23')]({'raw':!![],'where':{'ListId':_0x562fe4[_0x93d4('0x11')],'ContactId':_0x562fe4['id']}})[_0x93d4('0xb')](function(_0x55735e){if(!_[_0x93d4('0x37')](_0x55735e)){var _0x36a43b=[];for(var _0x1152af=0x0;_0x1152af<_0x55735e[_0x93d4('0x38')];_0x1152af+=0x1){var _0x2d0819=_0x3a0997[_0x93d4('0x1b')][_0x93d4('0x39')]({'where':{'ListId':_0x55735e[_0x1152af][_0x93d4('0x11')],'ContactId':_0x55735e[_0x1152af]['ContactId'],'VoiceQueueId':_0x55735e[_0x1152af]['VoiceQueueId'],'CampaignId':_0x55735e[_0x1152af][_0x93d4('0x1a')]}});_0x36a43b[_0x93d4('0x3a')](_0x2d0819);}return Promise['all'](_0x36a43b);}})[_0x93d4('0xb')](function(_0x2804ed){logger[_0x93d4('0x3b')](_0x93d4('0x3c'),util['inspect'](_0x2804ed,{'showHidden':![],'depth':null}));_0x59eaf9();})[_0x93d4('0x3d')](function(_0x389881){logger[_0x93d4('0x34')]('[CmContact][afterDestroy][Error]',util[_0x93d4('0x3e')](_0x389881,{'showHidden':![],'depth':null}));_0x59eaf9(_0x389881);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 32ec8e7..4484eaa 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x16b137,_0x3466ea){var _0x86a4ea=function(_0x11b9ce){while(--_0x11b9ce){_0x16b137['push'](_0x16b137['shift']());}};_0x86a4ea(++_0x3466ea);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x36dcf0,_0x5166c0){var _0x4a2e57=function(_0x3c5dac){while(--_0x3c5dac){_0x36dcf0['push'](_0x36dcf0['shift']());}};_0x4a2e57(++_0x5166c0);}(_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'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 9503bde..18571d7 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ff4=['PHONE','STRING','INTEGER'];(function(_0x2da286,_0x8494e9){var _0x22fa41=function(_0x40903c){while(--_0x40903c){_0x2da286['push'](_0x2da286['shift']());}};_0x22fa41(++_0x8494e9);}(_0x9ff4,0x196));var _0x49ff=function(_0x43159f,_0x48ec77){_0x43159f=_0x43159f-0x0;var _0x312a5f=_0x9ff4[_0x43159f];return _0x312a5f;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x49ff('0x0')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x49ff('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x49ff('0x0')],'defaultValue':_0x49ff('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x49ff('0x0')],'defaultValue':null}}; \ No newline at end of file +var _0x9181=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x9181,0x182));var _0x1918=function(_0x2aa302,_0x4e31a2){_0x2aa302=_0x2aa302-0x0;var _0x499963=_0x9181[_0x2aa302];return _0x499963;};'use strict';var Sequelize=require(_0x1918('0x0'));module[_0x1918('0x1')]={'CmContactId':{'type':Sequelize[_0x1918('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1918('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1918('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x1918('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x1918('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index fc6ef5f..ea3ddaa 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fd6=['body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','CmContactHasItems','destroy','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x0fd6,0x13d));var _0x60fd=function(_0x579751,_0x594258){_0x579751=_0x579751-0x0;var _0x558daf=_0x0fd6[_0x579751];return _0x558daf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60fd('0x0'));var zipdir=require(_0x60fd('0x1'));var jsonpatch=require(_0x60fd('0x2'));var rp=require(_0x60fd('0x3'));var moment=require(_0x60fd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x60fd('0x5'));var path=require(_0x60fd('0x6'));var sox=require(_0x60fd('0x7'));var csv=require(_0x60fd('0x8'));var ejs=require(_0x60fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x60fd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x60fd('0xb'));var toCsv=require(_0x60fd('0x8'));var querystring=require(_0x60fd('0xc'));var Papa=require(_0x60fd('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x60fd('0xe'));var as=require(_0x60fd('0xf'));var hardwareService=require(_0x60fd('0x10'));var logger=require(_0x60fd('0x11'))(_0x60fd('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x123e8a,_0x2496cc){_0x2496cc=_0x2496cc||0xcc;return function(_0x43c54f){if(_0x43c54f){return _0x123e8a[_0x60fd('0x13')](_0x2496cc);}return _0x123e8a['status'](_0x2496cc)[_0x60fd('0x14')]();};}function respondWithResult(_0x3196e6,_0x3f151c){_0x3f151c=_0x3f151c||0xc8;return function(_0x495494){if(_0x495494){return _0x3196e6[_0x60fd('0x15')](_0x3f151c)[_0x60fd('0x16')](_0x495494);}};}function respondWithFilteredResult(_0x32f67b,_0x282986){return function(_0x40671d){if(_0x40671d){var _0x3d22d4=typeof _0x282986[_0x60fd('0x17')]==='undefined'&&typeof _0x282986['limit']===_0x60fd('0x18');var _0x276f11=_0x40671d['count'];var _0x2d37e4=_0x3d22d4?0x0:_0x282986[_0x60fd('0x17')];var _0x3b21b2=_0x3d22d4?_0x40671d[_0x60fd('0x19')]:_0x282986[_0x60fd('0x17')]+_0x282986[_0x60fd('0x1a')];var _0x19c276;if(_0x3b21b2>=_0x276f11){_0x3b21b2=_0x276f11;_0x19c276=0xc8;}else{_0x19c276=0xce;}_0x32f67b[_0x60fd('0x15')](_0x19c276);return _0x32f67b[_0x60fd('0x1b')](_0x60fd('0x1c'),_0x2d37e4+'-'+_0x3b21b2+'/'+_0x276f11)[_0x60fd('0x16')](_0x40671d);}return null;};}function patchUpdates(_0x7a38b6){return function(_0x49205e){try{jsonpatch[_0x60fd('0x1d')](_0x49205e,_0x7a38b6,!![]);}catch(_0x4182ac){return BPromise[_0x60fd('0x1e')](_0x4182ac);}return _0x49205e[_0x60fd('0x1f')]();};}function saveUpdates(_0x38e042,_0x3ddcc3){return function(_0xbfd136){if(_0xbfd136){return _0xbfd136[_0x60fd('0x20')](_0x38e042)['then'](function(_0x131914){return _0x131914;});}return null;};}function removeEntity(_0x4ce50c,_0x4a65d4){return function(_0x5ee970){if(_0x5ee970){return _0x5ee970['destroy']()[_0x60fd('0x21')](function(){var _0x5a0775=_0x5ee970[_0x60fd('0x22')]({'plain':!![]});var _0x162972=_0x60fd('0x23');return db['UserProfileResource'][_0x60fd('0x24')]({'where':{'type':_0x162972,'resourceId':_0x5a0775['id']}})['then'](function(){return _0x5ee970;});})[_0x60fd('0x21')](function(){_0x4ce50c['status'](0xcc)[_0x60fd('0x14')]();});}};}function handleEntityNotFound(_0x17e9a8,_0xb1cf9e){return function(_0x44b0b2){if(!_0x44b0b2){_0x17e9a8[_0x60fd('0x13')](0x194);}return _0x44b0b2;};}function handleError(_0x32aa95,_0x25e407){_0x25e407=_0x25e407||0x1f4;return function(_0x31961f){logger['error'](_0x31961f[_0x60fd('0x25')]);if(_0x31961f[_0x60fd('0x26')]){delete _0x31961f[_0x60fd('0x26')];}_0x32aa95[_0x60fd('0x15')](_0x25e407)[_0x60fd('0x27')](_0x31961f);};}exports[_0x60fd('0x28')]=function(_0x2e7fd6,_0x2f822e){var _0x43372a={},_0x3c1773={},_0xc6df7b={'count':0x0,'rows':[]};var _0x5efcb6=_[_0x60fd('0x29')](db[_0x60fd('0x2a')][_0x60fd('0x2b')],function(_0x11dec9){return{'name':_0x11dec9[_0x60fd('0x2c')],'type':_0x11dec9[_0x60fd('0x2d')][_0x60fd('0x2e')]};});_0x3c1773[_0x60fd('0x2f')]=_['map'](_0x5efcb6,_0x60fd('0x26'));_0x3c1773[_0x60fd('0x30')]=_[_0x60fd('0x31')](_0x2e7fd6[_0x60fd('0x30')]);_0x3c1773[_0x60fd('0x32')]=_['intersection'](_0x3c1773[_0x60fd('0x2f')],_0x3c1773[_0x60fd('0x30')]);_0x43372a['attributes']=_[_0x60fd('0x33')](_0x3c1773[_0x60fd('0x2f')],qs[_0x60fd('0x34')](_0x2e7fd6[_0x60fd('0x30')][_0x60fd('0x34')]));_0x43372a['attributes']=_0x43372a[_0x60fd('0x35')][_0x60fd('0x36')]?_0x43372a[_0x60fd('0x35')]:_0x3c1773[_0x60fd('0x2f')];if(!_0x2e7fd6[_0x60fd('0x30')][_0x60fd('0x37')](_0x60fd('0x38'))){_0x43372a[_0x60fd('0x1a')]=qs[_0x60fd('0x1a')](_0x2e7fd6[_0x60fd('0x30')][_0x60fd('0x1a')]);_0x43372a[_0x60fd('0x17')]=qs[_0x60fd('0x17')](_0x2e7fd6[_0x60fd('0x30')][_0x60fd('0x17')]);}_0x43372a['order']=qs[_0x60fd('0x39')](_0x2e7fd6['query'][_0x60fd('0x39')]);_0x43372a[_0x60fd('0x3a')]=qs[_0x60fd('0x32')](_[_0x60fd('0x3b')](_0x2e7fd6[_0x60fd('0x30')],_0x3c1773['filters']),_0x5efcb6);if(_0x2e7fd6['query'][_0x60fd('0x3c')]){_0x43372a[_0x60fd('0x3a')]=_['merge'](_0x43372a[_0x60fd('0x3a')],{'$or':_[_0x60fd('0x29')](_0x5efcb6,function(_0x3954dd){if(_0x3954dd[_0x60fd('0x2d')]!=='VIRTUAL'){var _0x5921b6={};_0x5921b6[_0x3954dd['name']]={'$like':'%'+_0x2e7fd6['query']['filter']+'%'};return _0x5921b6;}})});}_0x43372a=_[_0x60fd('0x3d')]({},_0x43372a,_0x2e7fd6[_0x60fd('0x3e')]);var _0x24e1bd={'where':_0x43372a[_0x60fd('0x3a')]};return db[_0x60fd('0x2a')][_0x60fd('0x19')](_0x24e1bd)[_0x60fd('0x21')](function(_0xe749c){_0xc6df7b[_0x60fd('0x19')]=_0xe749c;if(_0x2e7fd6[_0x60fd('0x30')][_0x60fd('0x3f')]){_0x43372a[_0x60fd('0x40')]=[{'all':!![]}];}return db[_0x60fd('0x2a')][_0x60fd('0x41')](_0x43372a);})['then'](function(_0x201265){_0xc6df7b[_0x60fd('0x42')]=_0x201265;return _0xc6df7b;})[_0x60fd('0x21')](respondWithFilteredResult(_0x2f822e,_0x43372a))[_0x60fd('0x43')](handleError(_0x2f822e,null));};exports[_0x60fd('0x44')]=function(_0x45b553,_0x5b40c0){var _0x24bebd={'raw':!![],'where':{'id':_0x45b553[_0x60fd('0x45')]['id']}},_0xd4e762={};_0xd4e762['model']=_[_0x60fd('0x31')](db[_0x60fd('0x2a')][_0x60fd('0x2b')]);_0xd4e762[_0x60fd('0x30')]=_['keys'](_0x45b553['query']);_0xd4e762[_0x60fd('0x32')]=_['intersection'](_0xd4e762['model'],_0xd4e762['query']);_0x24bebd[_0x60fd('0x35')]=_[_0x60fd('0x33')](_0xd4e762[_0x60fd('0x2f')],qs[_0x60fd('0x34')](_0x45b553[_0x60fd('0x30')][_0x60fd('0x34')]));_0x24bebd[_0x60fd('0x35')]=_0x24bebd['attributes'][_0x60fd('0x36')]?_0x24bebd[_0x60fd('0x35')]:_0xd4e762[_0x60fd('0x2f')];if(_0x45b553[_0x60fd('0x30')][_0x60fd('0x3f')]){_0x24bebd['include']=[{'all':!![]}];}_0x24bebd=_[_0x60fd('0x3d')]({},_0x24bebd,_0x45b553[_0x60fd('0x3e')]);return db[_0x60fd('0x2a')][_0x60fd('0x46')](_0x24bebd)[_0x60fd('0x21')](handleEntityNotFound(_0x5b40c0,null))[_0x60fd('0x21')](respondWithResult(_0x5b40c0,null))[_0x60fd('0x43')](handleError(_0x5b40c0,null));};exports[_0x60fd('0x47')]=function(_0x3fc652,_0x29bf66){return db[_0x60fd('0x2a')][_0x60fd('0x47')](_0x3fc652['body'],{})['then'](function(_0x5a1060){var _0x5caf8c=_0x3fc652[_0x60fd('0x48')][_0x60fd('0x22')]({'plain':!![]});if(!_0x5caf8c)throw new Error(_0x60fd('0x49'));if(_0x5caf8c['role']===_0x60fd('0x48')){var _0xbc84ee=_0x5a1060[_0x60fd('0x22')]({'plain':!![]});var _0x513b72=_0x60fd('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x513b72,'userProfileId':_0x5caf8c['userProfileId']},'raw':!![]})['then'](function(_0x3848e2){if(_0x3848e2&&_0x3848e2[_0x60fd('0x4a')]===0x0){return db[_0x60fd('0x4b')][_0x60fd('0x47')]({'name':_0xbc84ee[_0x60fd('0x26')],'resourceId':_0xbc84ee['id'],'type':_0x3848e2[_0x60fd('0x26')],'sectionId':_0x3848e2['id']},{})['then'](function(){return _0x5a1060;});}else{return _0x5a1060;}})[_0x60fd('0x43')](function(_0x4d27d6){logger[_0x60fd('0x4c')](_0x60fd('0x4d'),_0x4d27d6);throw _0x4d27d6;});}return _0x5a1060;})['then'](respondWithResult(_0x29bf66,0xc9))[_0x60fd('0x43')](handleError(_0x29bf66,null));};exports['update']=function(_0x47a63f,_0x4e5f06){if(_0x47a63f['body']['id']){delete _0x47a63f[_0x60fd('0x4e')]['id'];}return db[_0x60fd('0x2a')]['find']({'where':{'id':_0x47a63f[_0x60fd('0x45')]['id']}})[_0x60fd('0x21')](handleEntityNotFound(_0x4e5f06,null))[_0x60fd('0x21')](saveUpdates(_0x47a63f[_0x60fd('0x4e')],null))[_0x60fd('0x21')](respondWithResult(_0x4e5f06,null))['catch'](handleError(_0x4e5f06,null));};exports[_0x60fd('0x24')]=function(_0x3325e0,_0x412432){return db[_0x60fd('0x2a')][_0x60fd('0x46')]({'where':{'id':_0x3325e0[_0x60fd('0x45')]['id']}})[_0x60fd('0x21')](handleEntityNotFound(_0x412432,null))[_0x60fd('0x21')](removeEntity(_0x412432,null))[_0x60fd('0x43')](handleError(_0x412432,null));}; \ No newline at end of file +var _0xc458=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','get','CmContactHasItems','UserProfileResource','destroy','then','end','error','stack','name','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmContactHasItem','includeAll','findAll','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0xc458,0xe9));var _0x8c45=function(_0x2b2c1c,_0x2408c6){_0x2b2c1c=_0x2b2c1c-0x0;var _0x460cab=_0xc458[_0x2b2c1c];return _0x460cab;};'use strict';var emlformat=require(_0x8c45('0x0'));var rimraf=require(_0x8c45('0x1'));var zipdir=require(_0x8c45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c45('0x3'));var BPromise=require(_0x8c45('0x4'));var Mustache=require(_0x8c45('0x5'));var util=require(_0x8c45('0x6'));var path=require(_0x8c45('0x7'));var sox=require(_0x8c45('0x8'));var csv=require(_0x8c45('0x9'));var ejs=require(_0x8c45('0xa'));var fs=require('fs');var fs_extra=require(_0x8c45('0xb'));var _=require('lodash');var squel=require(_0x8c45('0xc'));var crypto=require(_0x8c45('0xd'));var jsforce=require(_0x8c45('0xe'));var deskjs=require(_0x8c45('0xf'));var toCsv=require(_0x8c45('0x9'));var querystring=require(_0x8c45('0x10'));var Papa=require(_0x8c45('0x11'));var Redis=require(_0x8c45('0x12'));var authService=require(_0x8c45('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8c45('0x14'));var hardwareService=require(_0x8c45('0x15'));var logger=require(_0x8c45('0x16'))(_0x8c45('0x17'));var utils=require(_0x8c45('0x18'));var config=require(_0x8c45('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c45('0x1a'))['db'];function respondWithStatusCode(_0x242540,_0xea8092){_0xea8092=_0xea8092||0xcc;return function(_0xf16b77){if(_0xf16b77){return _0x242540[_0x8c45('0x1b')](_0xea8092);}return _0x242540[_0x8c45('0x1c')](_0xea8092)['end']();};}function respondWithResult(_0xafec96,_0x4a9567){_0x4a9567=_0x4a9567||0xc8;return function(_0x49a0e2){if(_0x49a0e2){return _0xafec96['status'](_0x4a9567)[_0x8c45('0x1d')](_0x49a0e2);}};}function respondWithFilteredResult(_0x221cec,_0x7618d1){return function(_0x414ed8){if(_0x414ed8){var _0x4cb5c3=typeof _0x7618d1[_0x8c45('0x1e')]===_0x8c45('0x1f')&&typeof _0x7618d1[_0x8c45('0x20')]===_0x8c45('0x1f');var _0x2f976a=_0x414ed8['count'];var _0xe8c003=_0x4cb5c3?0x0:_0x7618d1[_0x8c45('0x1e')];var _0x25c47f=_0x4cb5c3?_0x414ed8[_0x8c45('0x21')]:_0x7618d1[_0x8c45('0x1e')]+_0x7618d1[_0x8c45('0x20')];var _0x1ed3b9;if(_0x25c47f>=_0x2f976a){_0x25c47f=_0x2f976a;_0x1ed3b9=0xc8;}else{_0x1ed3b9=0xce;}_0x221cec[_0x8c45('0x1c')](_0x1ed3b9);return _0x221cec['set'](_0x8c45('0x22'),_0xe8c003+'-'+_0x25c47f+'/'+_0x2f976a)['json'](_0x414ed8);}return null;};}function patchUpdates(_0x5ea47f){return function(_0x5df54b){try{jsonpatch[_0x8c45('0x23')](_0x5df54b,_0x5ea47f,!![]);}catch(_0x35bb49){return BPromise['reject'](_0x35bb49);}return _0x5df54b[_0x8c45('0x24')]();};}function saveUpdates(_0x47290b,_0x1332d9){return function(_0x3da20d){if(_0x3da20d){return _0x3da20d[_0x8c45('0x25')](_0x47290b)['then'](function(_0x46cbe8){return _0x46cbe8;});}return null;};}function removeEntity(_0x4cfc6a,_0x48437c){return function(_0x51d555){if(_0x51d555){return _0x51d555['destroy']()['then'](function(){var _0x4b4ec7=_0x51d555[_0x8c45('0x26')]({'plain':!![]});var _0x1825b6=_0x8c45('0x27');return db[_0x8c45('0x28')][_0x8c45('0x29')]({'where':{'type':_0x1825b6,'resourceId':_0x4b4ec7['id']}})[_0x8c45('0x2a')](function(){return _0x51d555;});})[_0x8c45('0x2a')](function(){_0x4cfc6a[_0x8c45('0x1c')](0xcc)[_0x8c45('0x2b')]();});}};}function handleEntityNotFound(_0x2e67d8,_0x323c1f){return function(_0x28ff4d){if(!_0x28ff4d){_0x2e67d8[_0x8c45('0x1b')](0x194);}return _0x28ff4d;};}function handleError(_0x3b0a8b,_0xe2cd1f){_0xe2cd1f=_0xe2cd1f||0x1f4;return function(_0x3c7699){logger[_0x8c45('0x2c')](_0x3c7699[_0x8c45('0x2d')]);if(_0x3c7699[_0x8c45('0x2e')]){delete _0x3c7699[_0x8c45('0x2e')];}_0x3b0a8b['status'](_0xe2cd1f)['send'](_0x3c7699);};}exports[_0x8c45('0x2f')]=function(_0x252f9a,_0x21a072){var _0x9f310d={},_0xa92869={},_0x304f15={'count':0x0,'rows':[]};var _0x1ac990=_[_0x8c45('0x30')](db['CmContactHasItem']['rawAttributes'],function(_0x2ecd3e){return{'name':_0x2ecd3e[_0x8c45('0x31')],'type':_0x2ecd3e[_0x8c45('0x32')][_0x8c45('0x33')]};});_0xa92869[_0x8c45('0x34')]=_[_0x8c45('0x30')](_0x1ac990,'name');_0xa92869[_0x8c45('0x35')]=_[_0x8c45('0x36')](_0x252f9a[_0x8c45('0x35')]);_0xa92869['filters']=_[_0x8c45('0x37')](_0xa92869[_0x8c45('0x34')],_0xa92869['query']);_0x9f310d[_0x8c45('0x38')]=_[_0x8c45('0x37')](_0xa92869[_0x8c45('0x34')],qs[_0x8c45('0x39')](_0x252f9a[_0x8c45('0x35')][_0x8c45('0x39')]));_0x9f310d[_0x8c45('0x38')]=_0x9f310d[_0x8c45('0x38')]['length']?_0x9f310d[_0x8c45('0x38')]:_0xa92869[_0x8c45('0x34')];if(!_0x252f9a[_0x8c45('0x35')][_0x8c45('0x3a')](_0x8c45('0x3b'))){_0x9f310d[_0x8c45('0x20')]=qs[_0x8c45('0x20')](_0x252f9a[_0x8c45('0x35')][_0x8c45('0x20')]);_0x9f310d[_0x8c45('0x1e')]=qs[_0x8c45('0x1e')](_0x252f9a[_0x8c45('0x35')]['offset']);}_0x9f310d['order']=qs[_0x8c45('0x3c')](_0x252f9a[_0x8c45('0x35')][_0x8c45('0x3c')]);_0x9f310d[_0x8c45('0x3d')]=qs[_0x8c45('0x3e')](_[_0x8c45('0x3f')](_0x252f9a[_0x8c45('0x35')],_0xa92869['filters']),_0x1ac990);if(_0x252f9a['query'][_0x8c45('0x40')]){_0x9f310d[_0x8c45('0x3d')]=_[_0x8c45('0x41')](_0x9f310d['where'],{'$or':_[_0x8c45('0x30')](_0x1ac990,function(_0x4957dd){if(_0x4957dd[_0x8c45('0x32')]!==_0x8c45('0x42')){var _0x3c00e2={};_0x3c00e2[_0x4957dd[_0x8c45('0x2e')]]={'$like':'%'+_0x252f9a[_0x8c45('0x35')]['filter']+'%'};return _0x3c00e2;}})});}_0x9f310d=_['merge']({},_0x9f310d,_0x252f9a[_0x8c45('0x43')]);var _0x3b6b90={'where':_0x9f310d[_0x8c45('0x3d')]};return db[_0x8c45('0x44')][_0x8c45('0x21')](_0x3b6b90)[_0x8c45('0x2a')](function(_0x53f0ec){_0x304f15[_0x8c45('0x21')]=_0x53f0ec;if(_0x252f9a[_0x8c45('0x35')][_0x8c45('0x45')]){_0x9f310d['include']=[{'all':!![]}];}return db[_0x8c45('0x44')][_0x8c45('0x46')](_0x9f310d);})[_0x8c45('0x2a')](function(_0x3804d3){_0x304f15['rows']=_0x3804d3;return _0x304f15;})['then'](respondWithFilteredResult(_0x21a072,_0x9f310d))['catch'](handleError(_0x21a072,null));};exports[_0x8c45('0x47')]=function(_0x561333,_0x4448eb){var _0x256c61={'raw':!![],'where':{'id':_0x561333['params']['id']}},_0xe3595f={};_0xe3595f['model']=_['keys'](db[_0x8c45('0x44')]['rawAttributes']);_0xe3595f['query']=_[_0x8c45('0x36')](_0x561333[_0x8c45('0x35')]);_0xe3595f['filters']=_['intersection'](_0xe3595f[_0x8c45('0x34')],_0xe3595f['query']);_0x256c61['attributes']=_[_0x8c45('0x37')](_0xe3595f[_0x8c45('0x34')],qs[_0x8c45('0x39')](_0x561333[_0x8c45('0x35')][_0x8c45('0x39')]));_0x256c61[_0x8c45('0x38')]=_0x256c61[_0x8c45('0x38')]['length']?_0x256c61[_0x8c45('0x38')]:_0xe3595f[_0x8c45('0x34')];if(_0x561333[_0x8c45('0x35')][_0x8c45('0x45')]){_0x256c61[_0x8c45('0x48')]=[{'all':!![]}];}_0x256c61=_[_0x8c45('0x41')]({},_0x256c61,_0x561333[_0x8c45('0x43')]);return db['CmContactHasItem'][_0x8c45('0x49')](_0x256c61)[_0x8c45('0x2a')](handleEntityNotFound(_0x4448eb,null))['then'](respondWithResult(_0x4448eb,null))[_0x8c45('0x4a')](handleError(_0x4448eb,null));};exports[_0x8c45('0x4b')]=function(_0x77443d,_0x220186){return db[_0x8c45('0x44')]['create'](_0x77443d[_0x8c45('0x4c')],{})[_0x8c45('0x2a')](function(_0x54ad46){var _0x231d05=_0x77443d[_0x8c45('0x4d')][_0x8c45('0x26')]({'plain':!![]});if(!_0x231d05)throw new Error(_0x8c45('0x4e'));if(_0x231d05[_0x8c45('0x4f')]===_0x8c45('0x4d')){var _0x4c13d0=_0x54ad46[_0x8c45('0x26')]({'plain':!![]});var _0x12ab80='CmContactHasItems';return db[_0x8c45('0x50')][_0x8c45('0x49')]({'where':{'name':_0x12ab80,'userProfileId':_0x231d05[_0x8c45('0x51')]},'raw':!![]})[_0x8c45('0x2a')](function(_0x109315){if(_0x109315&&_0x109315[_0x8c45('0x52')]===0x0){return db[_0x8c45('0x28')]['create']({'name':_0x4c13d0[_0x8c45('0x2e')],'resourceId':_0x4c13d0['id'],'type':_0x109315['name'],'sectionId':_0x109315['id']},{})[_0x8c45('0x2a')](function(){return _0x54ad46;});}else{return _0x54ad46;}})['catch'](function(_0x2db27f){logger[_0x8c45('0x2c')](_0x8c45('0x53'),_0x2db27f);throw _0x2db27f;});}return _0x54ad46;})[_0x8c45('0x2a')](respondWithResult(_0x220186,0xc9))['catch'](handleError(_0x220186,null));};exports[_0x8c45('0x25')]=function(_0x57f16f,_0x51f9d6){if(_0x57f16f['body']['id']){delete _0x57f16f[_0x8c45('0x4c')]['id'];}return db[_0x8c45('0x44')][_0x8c45('0x49')]({'where':{'id':_0x57f16f[_0x8c45('0x54')]['id']}})[_0x8c45('0x2a')](handleEntityNotFound(_0x51f9d6,null))[_0x8c45('0x2a')](saveUpdates(_0x57f16f['body'],null))[_0x8c45('0x2a')](respondWithResult(_0x51f9d6,null))[_0x8c45('0x4a')](handleError(_0x51f9d6,null));};exports[_0x8c45('0x29')]=function(_0x5416de,_0xe0fe82){return db['CmContactHasItem'][_0x8c45('0x49')]({'where':{'id':_0x5416de[_0x8c45('0x54')]['id']}})[_0x8c45('0x2a')](handleEntityNotFound(_0xe0fe82,null))[_0x8c45('0x2a')](removeEntity(_0xe0fe82,null))['catch'](handleError(_0xe0fe82,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index db98969..10833d6 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cf2=['cm_contact_has_items','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','CmContactHasItem'];(function(_0x232d09,_0x30a518){var _0x454385=function(_0x3a5fdd){while(--_0x3a5fdd){_0x232d09['push'](_0x232d09['shift']());}};_0x454385(++_0x30a518);}(_0x0cf2,0x1a3));var _0x20cf=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x0cf2[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x20cf('0x0'));var util=require(_0x20cf('0x1'));var logger=require(_0x20cf('0x2'))(_0x20cf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x20cf('0x4'));var fs=require('fs');var path=require(_0x20cf('0x5'));var rimraf=require('rimraf');var config=require(_0x20cf('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0x20cf('0x7')]=function(_0x1b254d,_0x25e386){return _0x1b254d[_0x20cf('0x8')](_0x20cf('0x9'),attributes,{'tableName':_0x20cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1a1=['../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2672bb,_0x2820b4){var _0xe5cf8c=function(_0x284467){while(--_0x284467){_0x2672bb['push'](_0x2672bb['shift']());}};_0xe5cf8c(++_0x2820b4);}(_0xf1a1,0x1f3));var _0x1f1a=function(_0x25f805,_0x59caf3){_0x25f805=_0x25f805-0x0;var _0xf6628f=_0xf1a1[_0x25f805];return _0xf6628f;};'use strict';var _=require(_0x1f1a('0x0'));var util=require(_0x1f1a('0x1'));var logger=require(_0x1f1a('0x2'))('api');var moment=require(_0x1f1a('0x3'));var BPromise=require(_0x1f1a('0x4'));var rp=require(_0x1f1a('0x5'));var fs=require('fs');var path=require(_0x1f1a('0x6'));var rimraf=require(_0x1f1a('0x7'));var config=require(_0x1f1a('0x8'));var attributes=require(_0x1f1a('0x9'));module['exports']=function(_0x1a7e60,_0x2e8aae){return _0x1a7e60[_0x1f1a('0xa')](_0x1f1a('0xb'),attributes,{'tableName':_0x1f1a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 2ee5ab8..358dfce 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bbd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0x1bbd,0xba));var _0xd1bb=function(_0x15bb00,_0x1a722b){_0x15bb00=_0x15bb00-0x0;var _0x5e7768=_0x1bbd[_0x15bb00];return _0x5e7768;};'use strict';var _=require(_0xd1bb('0x0'));var util=require(_0xd1bb('0x1'));var moment=require(_0xd1bb('0x2'));var BPromise=require(_0xd1bb('0x3'));var rs=require(_0xd1bb('0x4'));var fs=require('fs');var Redis=require(_0xd1bb('0x5'));var db=require(_0xd1bb('0x6'))['db'];var utils=require(_0xd1bb('0x7'));var logger=require(_0xd1bb('0x8'))(_0xd1bb('0x9'));var config=require(_0xd1bb('0xa'));var jayson=require(_0xd1bb('0xb'));var client=jayson[_0xd1bb('0xc')][_0xd1bb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345b5a,_0x46194e,_0x33649c){return new BPromise(function(_0x3330f0,_0xf79ff3){return client['request'](_0x345b5a,_0x33649c)[_0xd1bb('0xe')](function(_0x5cc364){logger['info'](_0xd1bb('0xf'),_0x46194e,_0xd1bb('0x10'));logger['debug'](_0xd1bb('0x11'),_0x46194e,_0xd1bb('0x10'),JSON['stringify'](_0x5cc364));if(_0x5cc364[_0xd1bb('0x12')]){if(_0x5cc364[_0xd1bb('0x12')][_0xd1bb('0x13')]===0x1f4){logger[_0xd1bb('0x12')](_0xd1bb('0xf'),_0x46194e,_0x5cc364['error']['message']);return _0xf79ff3(_0x5cc364['error'][_0xd1bb('0x14')]);}logger[_0xd1bb('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x46194e,_0x5cc364[_0xd1bb('0x12')][_0xd1bb('0x14')]);return _0x3330f0(_0x5cc364['error'][_0xd1bb('0x14')]);}else{logger[_0xd1bb('0x15')](_0xd1bb('0xf'),_0x46194e,_0xd1bb('0x10'));_0x3330f0(_0x5cc364[_0xd1bb('0x16')][_0xd1bb('0x14')]);}})[_0xd1bb('0x17')](function(_0x174bd4){logger[_0xd1bb('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x46194e,_0x174bd4);_0xf79ff3(_0x174bd4);});});} \ No newline at end of file +var _0x9a7f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x219ef9,_0x5a4baa){var _0x4e7634=function(_0x465565){while(--_0x465565){_0x219ef9['push'](_0x219ef9['shift']());}};_0x4e7634(++_0x5a4baa);}(_0x9a7f,0x157));var _0xf9a7=function(_0x3386a6,_0x474678){_0x3386a6=_0x3386a6-0x0;var _0x362b74=_0x9a7f[_0x3386a6];return _0x362b74;};'use strict';var _=require(_0xf9a7('0x0'));var util=require('util');var moment=require(_0xf9a7('0x1'));var BPromise=require(_0xf9a7('0x2'));var rs=require(_0xf9a7('0x3'));var fs=require('fs');var Redis=require(_0xf9a7('0x4'));var db=require(_0xf9a7('0x5'))['db'];var utils=require(_0xf9a7('0x6'));var logger=require(_0xf9a7('0x7'))(_0xf9a7('0x8'));var config=require(_0xf9a7('0x9'));var jayson=require(_0xf9a7('0xa'));var client=jayson[_0xf9a7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31152a,_0x4c7488,_0x3c4793){return new BPromise(function(_0xdde540,_0x49659e){return client[_0xf9a7('0xc')](_0x31152a,_0x3c4793)['then'](function(_0x43d76f){logger[_0xf9a7('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x4c7488,_0xf9a7('0xe'));logger[_0xf9a7('0xf')](_0xf9a7('0x10'),_0x4c7488,_0xf9a7('0xe'),JSON['stringify'](_0x43d76f));if(_0x43d76f[_0xf9a7('0x11')]){if(_0x43d76f['error'][_0xf9a7('0x12')]===0x1f4){logger['error'](_0xf9a7('0x13'),_0x4c7488,_0x43d76f[_0xf9a7('0x11')]['message']);return _0x49659e(_0x43d76f['error'][_0xf9a7('0x14')]);}logger['error'](_0xf9a7('0x13'),_0x4c7488,_0x43d76f[_0xf9a7('0x11')][_0xf9a7('0x14')]);return _0xdde540(_0x43d76f['error'][_0xf9a7('0x14')]);}else{logger[_0xf9a7('0xd')](_0xf9a7('0x13'),_0x4c7488,_0xf9a7('0xe'));_0xdde540(_0x43d76f[_0xf9a7('0x15')][_0xf9a7('0x14')]);}})[_0xf9a7('0x16')](function(_0x356e29){logger[_0xf9a7('0x11')](_0xf9a7('0x13'),_0x4c7488,_0x356e29);_0x49659e(_0x356e29);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 55acfd1..d1e61bf 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x542d=['fs-extra','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x171926,_0x151a03){var _0x159629=function(_0x119554){while(--_0x119554){_0x171926['push'](_0x171926['shift']());}};_0x159629(++_0x151a03);}(_0x542d,0xf7));var _0xd542=function(_0x1742aa,_0x4f0f28){_0x1742aa=_0x1742aa-0x0;var _0xc3f673=_0x542d[_0x1742aa];return _0xc3f673;};'use strict';var multer=require(_0xd542('0x0'));var util=require(_0xd542('0x1'));var path=require(_0xd542('0x2'));var timeout=require(_0xd542('0x3'));var express=require('express');var router=express[_0xd542('0x4')]();var fs_extra=require(_0xd542('0x5'));var auth=require(_0xd542('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd542('0x7'));var controller=require(_0xd542('0x8'));router[_0xd542('0x9')]('/',auth[_0xd542('0xa')](),controller[_0xd542('0xb')]);router[_0xd542('0x9')](_0xd542('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd542('0xd')]('/',auth[_0xd542('0xa')](),controller[_0xd542('0xe')]);router[_0xd542('0xf')](_0xd542('0xc'),auth[_0xd542('0xa')](),controller['update']);router[_0xd542('0x10')](_0xd542('0xc'),auth[_0xd542('0xa')](),controller['destroy']);module[_0xd542('0x11')]=router; \ No newline at end of file +var _0xbe07=['fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xbe07,0xf7));var _0x7be0=function(_0x3e09c2,_0x5e3e4f){_0x3e09c2=_0x3e09c2-0x0;var _0x23a5c6=_0xbe07[_0x3e09c2];return _0x23a5c6;};'use strict';var multer=require(_0x7be0('0x0'));var util=require(_0x7be0('0x1'));var path=require(_0x7be0('0x2'));var timeout=require('connect-timeout');var express=require(_0x7be0('0x3'));var router=express[_0x7be0('0x4')]();var fs_extra=require(_0x7be0('0x5'));var auth=require(_0x7be0('0x6'));var interaction=require(_0x7be0('0x7'));var config=require('../../config/environment');var controller=require(_0x7be0('0x8'));router[_0x7be0('0x9')]('/',auth['isAuthenticated'](),controller[_0x7be0('0xa')]);router[_0x7be0('0x9')]('/:id',auth[_0x7be0('0xb')](),controller[_0x7be0('0xc')]);router[_0x7be0('0xd')]('/',auth[_0x7be0('0xb')](),controller[_0x7be0('0xe')]);router[_0x7be0('0xf')](_0x7be0('0x10'),auth['isAuthenticated'](),controller[_0x7be0('0x11')]);router[_0x7be0('0x12')](_0x7be0('0x10'),auth['isAuthenticated'](),controller[_0x7be0('0x13')]);module[_0x7be0('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a7ed6a0..1773438 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 _0x0f82=['parse','values','isArray','BOOLEAN','voice','exports','VIRTUAL','getDataValue','setDataValue','alias','name','STRING','TEXT','long','select'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f82,0x6e));var _0x20f8=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0x0f82[_0x1c5142];return _0x1268cb;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x20f8('0x0')]={'name':{'type':Sequelize[_0x20f8('0x1')],'get':function(_0x1fc659){return this[_0x20f8('0x2')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x470c8c){this[_0x20f8('0x3')](_0x20f8('0x4'),_0x470c8c?_0x470c8c:this[_0x20f8('0x2')](_0x20f8('0x5')));}},'type':{'type':Sequelize[_0x20f8('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x20f8('0x7')](_0x20f8('0x8')),'get':function(){if(this[_0x20f8('0x2')]('type')===_0x20f8('0x9')){return JSON[_0x20f8('0xa')](this[_0x20f8('0x2')](_0x20f8('0xb')));}else{return this[_0x20f8('0x2')](_0x20f8('0xb'));}},'set':function(_0x330850){if(Array[_0x20f8('0xc')](_0x330850)){this[_0x20f8('0x3')](_0x20f8('0xb'),JSON['stringify'](_0x330850));}else{this[_0x20f8('0x3')](_0x20f8('0xb'),_0x330850);}}},'required':{'type':Sequelize[_0x20f8('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x20f8('0xe'))}}; \ No newline at end of file +var _0x7956=['alias','STRING','name','TEXT','long','type','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x288a35,_0x5ee161){var _0x3ca532=function(_0x441ff2){while(--_0x441ff2){_0x288a35['push'](_0x288a35['shift']());}};_0x3ca532(++_0x5ee161);}(_0x7956,0x12b));var _0x6795=function(_0x2b5a2f,_0x120e88){_0x2b5a2f=_0x2b5a2f-0x0;var _0x5998bc=_0x7956[_0x2b5a2f];return _0x5998bc;};'use strict';var Sequelize=require(_0x6795('0x0'));var _=require(_0x6795('0x1'));module[_0x6795('0x2')]={'name':{'type':Sequelize[_0x6795('0x3')],'get':function(_0x53e284){return this[_0x6795('0x4')](_0x6795('0x5'));}},'alias':{'type':Sequelize[_0x6795('0x6')],'allowNull':![],'set':function(_0x4b394f){this['setDataValue'](_0x6795('0x5'),_0x4b394f?_0x4b394f:this[_0x6795('0x4')](_0x6795('0x7')));}},'type':{'type':Sequelize[_0x6795('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x6795('0x8')](_0x6795('0x9')),'get':function(){if(this[_0x6795('0x4')](_0x6795('0xa'))==='select'){return JSON[_0x6795('0xb')](this[_0x6795('0x4')](_0x6795('0xc')));}else{return this[_0x6795('0x4')]('values');}},'set':function(_0x10e286){if(Array[_0x6795('0xd')](_0x10e286)){this[_0x6795('0xe')]('values',JSON[_0x6795('0xf')](_0x10e286));}else{this['setDataValue'](_0x6795('0xc'),_0x10e286);}}},'required':{'type':Sequelize[_0x6795('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6795('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6795('0x11')](_0x6795('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 1d52853..e18e086 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 _0xdfc9=['sequelize','transaction','Sequelize','TEXT','text','type','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','update','then','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','include','rows','catch','params','includeAll','find','body','destroy','create'];(function(_0x5875c7,_0x4106d7){var _0x4dc3df=function(_0x202967){while(--_0x202967){_0x5875c7['push'](_0x5875c7['shift']());}};_0x4dc3df(++_0x4106d7);}(_0xdfc9,0x1b3));var _0x9dfc=function(_0x1e5cc0,_0x5260ec){_0x1e5cc0=_0x1e5cc0-0x0;var _0x3b6f1b=_0xdfc9[_0x1e5cc0];return _0x3b6f1b;};'use strict';var emlformat=require(_0x9dfc('0x0'));var rimraf=require(_0x9dfc('0x1'));var zipdir=require(_0x9dfc('0x2'));var jsonpatch=require(_0x9dfc('0x3'));var rp=require(_0x9dfc('0x4'));var moment=require(_0x9dfc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9dfc('0x6'));var util=require(_0x9dfc('0x7'));var path=require(_0x9dfc('0x8'));var sox=require(_0x9dfc('0x9'));var csv=require('to-csv');var ejs=require(_0x9dfc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9dfc('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9dfc('0xc'));var toCsv=require(_0x9dfc('0xd'));var querystring=require('querystring');var Papa=require(_0x9dfc('0xe'));var Redis=require(_0x9dfc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9dfc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dfc('0x11'));var logger=require(_0x9dfc('0x12'))(_0x9dfc('0x13'));var utils=require(_0x9dfc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9dfc('0x15'));var db=require(_0x9dfc('0x16'))['db'];function respondWithStatusCode(_0x27a08a,_0x33603a){_0x33603a=_0x33603a||0xcc;return function(_0x5c4d07){if(_0x5c4d07){return _0x27a08a[_0x9dfc('0x17')](_0x33603a);}return _0x27a08a['status'](_0x33603a)[_0x9dfc('0x18')]();};}function respondWithResult(_0x41bff3,_0x5ce858){_0x5ce858=_0x5ce858||0xc8;return function(_0x5aab89){if(_0x5aab89){return _0x41bff3[_0x9dfc('0x19')](_0x5ce858)[_0x9dfc('0x1a')](_0x5aab89);}};}function respondWithFilteredResult(_0x3291af,_0x4e29e2){return function(_0x227217){if(_0x227217){var _0x32a9a5=typeof _0x4e29e2[_0x9dfc('0x1b')]===_0x9dfc('0x1c')&&typeof _0x4e29e2[_0x9dfc('0x1d')]===_0x9dfc('0x1c');var _0xc69e9a=_0x227217['count'];var _0xc1e614=_0x32a9a5?0x0:_0x4e29e2[_0x9dfc('0x1b')];var _0x3e7b9a=_0x32a9a5?_0x227217['count']:_0x4e29e2[_0x9dfc('0x1b')]+_0x4e29e2['limit'];var _0x4c4ed4;if(_0x3e7b9a>=_0xc69e9a){_0x3e7b9a=_0xc69e9a;_0x4c4ed4=0xc8;}else{_0x4c4ed4=0xce;}_0x3291af[_0x9dfc('0x19')](_0x4c4ed4);return _0x3291af[_0x9dfc('0x1e')](_0x9dfc('0x1f'),_0xc1e614+'-'+_0x3e7b9a+'/'+_0xc69e9a)[_0x9dfc('0x1a')](_0x227217);}return null;};}function patchUpdates(_0x37d301){return function(_0x3d9fb0){try{jsonpatch['apply'](_0x3d9fb0,_0x37d301,!![]);}catch(_0x107c54){return BPromise['reject'](_0x107c54);}return _0x3d9fb0['save']();};}function saveUpdates(_0x232692,_0xbe162){return function(_0x50b524){if(_0x50b524){return _0x50b524[_0x9dfc('0x20')](_0x232692)[_0x9dfc('0x21')](function(_0x564532){return _0x564532;});}return null;};}function removeEntity(_0x3f7105,_0x321028){return function(_0x5ca051){if(_0x5ca051){return _0x5ca051['destroy']()[_0x9dfc('0x21')](function(){_0x3f7105[_0x9dfc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x588444,_0x54b61a){return function(_0xb6d491){if(!_0xb6d491){_0x588444[_0x9dfc('0x17')](0x194);}return _0xb6d491;};}function handleError(_0xce59aa,_0x5c6655){_0x5c6655=_0x5c6655||0x1f4;return function(_0x45773a){logger[_0x9dfc('0x22')](_0x45773a[_0x9dfc('0x23')]);if(_0x45773a[_0x9dfc('0x24')]){delete _0x45773a[_0x9dfc('0x24')];}_0xce59aa[_0x9dfc('0x19')](_0x5c6655)[_0x9dfc('0x25')](_0x45773a);};}exports['index']=function(_0x5ca4ad,_0x3b5ae5){var _0x3e0694={},_0x181a4b={},_0x2a2527={'count':0x0,'rows':[]};var _0x215303=_[_0x9dfc('0x26')](db[_0x9dfc('0x27')][_0x9dfc('0x28')],function(_0x297fe7){return{'name':_0x297fe7[_0x9dfc('0x29')],'type':_0x297fe7['type']['key']};});_0x181a4b[_0x9dfc('0x2a')]=_[_0x9dfc('0x2b')](_[_0x9dfc('0x26')](_0x215303,_0x9dfc('0x24')),[_0x9dfc('0x24')]);_0x181a4b[_0x9dfc('0x2c')]=_[_0x9dfc('0x2d')](_0x5ca4ad[_0x9dfc('0x2c')]);_0x181a4b[_0x9dfc('0x2e')]=_[_0x9dfc('0x2f')](_0x181a4b['model'],_0x181a4b[_0x9dfc('0x2c')]);_0x3e0694[_0x9dfc('0x30')]=_['intersection'](_0x181a4b[_0x9dfc('0x2a')],qs['fields'](_0x5ca4ad[_0x9dfc('0x2c')][_0x9dfc('0x31')]));_0x3e0694['attributes']=_0x3e0694[_0x9dfc('0x30')][_0x9dfc('0x32')]?_0x3e0694['attributes']:_0x181a4b['model'];if(!_0x5ca4ad[_0x9dfc('0x2c')][_0x9dfc('0x33')](_0x9dfc('0x34'))){_0x3e0694['limit']=qs['limit'](_0x5ca4ad[_0x9dfc('0x2c')][_0x9dfc('0x1d')]);_0x3e0694[_0x9dfc('0x1b')]=qs[_0x9dfc('0x1b')](_0x5ca4ad[_0x9dfc('0x2c')][_0x9dfc('0x1b')]);}_0x3e0694[_0x9dfc('0x35')]=qs['sort'](_0x5ca4ad[_0x9dfc('0x2c')][_0x9dfc('0x36')]);_0x3e0694[_0x9dfc('0x37')]=qs[_0x9dfc('0x2e')](_['pick'](_0x5ca4ad[_0x9dfc('0x2c')],_0x181a4b[_0x9dfc('0x2e')]),_0x215303);if(_0x5ca4ad[_0x9dfc('0x2c')][_0x9dfc('0x38')]){_0x3e0694[_0x9dfc('0x37')]=_[_0x9dfc('0x39')](_0x3e0694[_0x9dfc('0x37')],{'$or':_[_0x9dfc('0x26')](_0x215303,function(_0x488b56){if(_0x488b56['type']!=='VIRTUAL'){var _0x1a453d={};_0x1a453d[_0x488b56[_0x9dfc('0x24')]]={'$like':'%'+_0x5ca4ad[_0x9dfc('0x2c')][_0x9dfc('0x38')]+'%'};return _0x1a453d;}})});}_0x3e0694=_[_0x9dfc('0x39')]({},_0x3e0694,_0x5ca4ad[_0x9dfc('0x3a')]);var _0x4e37f4={'where':_0x3e0694[_0x9dfc('0x37')]};return db['CmCustomField'][_0x9dfc('0x3b')](_0x4e37f4)[_0x9dfc('0x21')](function(_0x54f52f){_0x2a2527[_0x9dfc('0x3b')]=_0x54f52f;if(_0x5ca4ad['query']['includeAll']){_0x3e0694[_0x9dfc('0x3c')]=[{'all':!![]}];}return db[_0x9dfc('0x27')]['findAll'](_0x3e0694);})[_0x9dfc('0x21')](function(_0x3bebd0){_0x2a2527[_0x9dfc('0x3d')]=_0x3bebd0;return _0x2a2527;})['then'](respondWithFilteredResult(_0x3b5ae5,_0x3e0694))[_0x9dfc('0x3e')](handleError(_0x3b5ae5,null));};exports['show']=function(_0x5eb0a6,_0x368c4d){var _0x2fc49c={'raw':!![],'where':{'id':_0x5eb0a6[_0x9dfc('0x3f')]['id']}},_0x8c0bb5={};_0x8c0bb5[_0x9dfc('0x2a')]=_[_0x9dfc('0x2d')](db[_0x9dfc('0x27')][_0x9dfc('0x28')]);_0x8c0bb5[_0x9dfc('0x2c')]=_[_0x9dfc('0x2d')](_0x5eb0a6[_0x9dfc('0x2c')]);_0x8c0bb5[_0x9dfc('0x2e')]=_['intersection'](_0x8c0bb5[_0x9dfc('0x2a')],_0x8c0bb5[_0x9dfc('0x2c')]);_0x2fc49c[_0x9dfc('0x30')]=_[_0x9dfc('0x2f')](_0x8c0bb5[_0x9dfc('0x2a')],qs[_0x9dfc('0x31')](_0x5eb0a6[_0x9dfc('0x2c')][_0x9dfc('0x31')]));_0x2fc49c['attributes']=_0x2fc49c['attributes'][_0x9dfc('0x32')]?_0x2fc49c[_0x9dfc('0x30')]:_0x8c0bb5['model'];if(_0x5eb0a6['query'][_0x9dfc('0x40')]){_0x2fc49c[_0x9dfc('0x3c')]=[{'all':!![]}];}_0x2fc49c=_[_0x9dfc('0x39')]({},_0x2fc49c,_0x5eb0a6[_0x9dfc('0x3a')]);return db[_0x9dfc('0x27')][_0x9dfc('0x41')](_0x2fc49c)[_0x9dfc('0x21')](handleEntityNotFound(_0x368c4d,null))['then'](respondWithResult(_0x368c4d,null))['catch'](handleError(_0x368c4d,null));};exports[_0x9dfc('0x20')]=function(_0x31b70b,_0x40d859){if(_0x31b70b[_0x9dfc('0x42')]['id']){delete _0x31b70b[_0x9dfc('0x42')]['id'];}return db[_0x9dfc('0x27')][_0x9dfc('0x41')]({'where':{'id':_0x31b70b[_0x9dfc('0x3f')]['id']}})[_0x9dfc('0x21')](handleEntityNotFound(_0x40d859,null))['then'](saveUpdates(_0x31b70b[_0x9dfc('0x42')],null))[_0x9dfc('0x21')](respondWithResult(_0x40d859,null))['catch'](handleError(_0x40d859,null));};exports[_0x9dfc('0x43')]=function(_0x14bfde,_0x1c8d2b){return db[_0x9dfc('0x27')][_0x9dfc('0x41')]({'where':{'id':_0x14bfde[_0x9dfc('0x3f')]['id']}})[_0x9dfc('0x21')](handleEntityNotFound(_0x1c8d2b,null))[_0x9dfc('0x21')](removeEntity(_0x1c8d2b,null))[_0x9dfc('0x3e')](handleError(_0x1c8d2b,null));};exports[_0x9dfc('0x44')]=function(_0x1f08d0,_0x30b40c){var _0xe123cf;return db[_0x9dfc('0x45')][_0x9dfc('0x46')](function(_0x354ac6){return db[_0x9dfc('0x27')][_0x9dfc('0x44')](_0x1f08d0['body'],{'transaction':_0x354ac6})[_0x9dfc('0x21')](function(_0xcdb343){_0xe123cf=_0xcdb343;var _0x3c6599={'type':db[_0x9dfc('0x47')][_0x9dfc('0x48')],'transaction':_0x354ac6};switch(_0x1f08d0['body']['type']){case _0x9dfc('0x49'):_0x3c6599[_0x9dfc('0x4a')]=db[_0x9dfc('0x47')]['TEXT'];break;case _0x9dfc('0x4b'):_0x3c6599[_0x9dfc('0x4a')]=db[_0x9dfc('0x47')][_0x9dfc('0x4c')];break;case'switch':_0x3c6599[_0x9dfc('0x4a')]=db[_0x9dfc('0x47')][_0x9dfc('0x4d')];_0x3c6599[_0x9dfc('0x4e')]=![];break;default:}return db[_0x9dfc('0x45')][_0x9dfc('0x4f')][_0x9dfc('0x50')](_0x9dfc('0x51'),util[_0x9dfc('0x52')](_0x9dfc('0x53'),_0xe123cf['id']),_0x3c6599);})[_0x9dfc('0x21')](function(){return _0xe123cf;});})[_0x9dfc('0x21')](respondWithResult(_0x30b40c,0xc9))[_0x9dfc('0x3e')](handleError(_0x30b40c,null));}; \ No newline at end of file +var _0x62c0=['destroy','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','differenceBy','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','body','find','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','update'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0x62c0,0xdb));var _0x062c=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x62c0[_0x1f36bb];return _0xaf97fa;};'use strict';var emlformat=require(_0x062c('0x0'));var rimraf=require(_0x062c('0x1'));var zipdir=require(_0x062c('0x2'));var jsonpatch=require(_0x062c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x062c('0x4'));var util=require('util');var path=require(_0x062c('0x5'));var sox=require(_0x062c('0x6'));var csv=require(_0x062c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x062c('0x8'));var _=require(_0x062c('0x9'));var squel=require('squel');var crypto=require(_0x062c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x062c('0xb'));var toCsv=require(_0x062c('0x7'));var querystring=require(_0x062c('0xc'));var Papa=require(_0x062c('0xd'));var Redis=require(_0x062c('0xe'));var authService=require(_0x062c('0xf'));var qs=require(_0x062c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x062c('0x11'));var logger=require(_0x062c('0x12'))(_0x062c('0x13'));var utils=require(_0x062c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x062c('0x15'))['db'];function respondWithStatusCode(_0x19473b,_0x291f9e){_0x291f9e=_0x291f9e||0xcc;return function(_0x590977){if(_0x590977){return _0x19473b[_0x062c('0x16')](_0x291f9e);}return _0x19473b['status'](_0x291f9e)[_0x062c('0x17')]();};}function respondWithResult(_0x1b9a50,_0x3d72bc){_0x3d72bc=_0x3d72bc||0xc8;return function(_0x163a1d){if(_0x163a1d){return _0x1b9a50[_0x062c('0x18')](_0x3d72bc)[_0x062c('0x19')](_0x163a1d);}};}function respondWithFilteredResult(_0x5aa09f,_0x264e92){return function(_0x26f419){if(_0x26f419){var _0x4b9c53=typeof _0x264e92['offset']===_0x062c('0x1a')&&typeof _0x264e92[_0x062c('0x1b')]===_0x062c('0x1a');var _0x663ea3=_0x26f419[_0x062c('0x1c')];var _0x1640fe=_0x4b9c53?0x0:_0x264e92[_0x062c('0x1d')];var _0x3652c4=_0x4b9c53?_0x26f419[_0x062c('0x1c')]:_0x264e92[_0x062c('0x1d')]+_0x264e92['limit'];var _0x4d6bad;if(_0x3652c4>=_0x663ea3){_0x3652c4=_0x663ea3;_0x4d6bad=0xc8;}else{_0x4d6bad=0xce;}_0x5aa09f[_0x062c('0x18')](_0x4d6bad);return _0x5aa09f['set'](_0x062c('0x1e'),_0x1640fe+'-'+_0x3652c4+'/'+_0x663ea3)[_0x062c('0x19')](_0x26f419);}return null;};}function patchUpdates(_0x7a0dce){return function(_0x5061bf){try{jsonpatch['apply'](_0x5061bf,_0x7a0dce,!![]);}catch(_0xc50c9d){return BPromise[_0x062c('0x1f')](_0xc50c9d);}return _0x5061bf['save']();};}function saveUpdates(_0xd992e2,_0x286938){return function(_0x230040){if(_0x230040){return _0x230040[_0x062c('0x20')](_0xd992e2)['then'](function(_0x17c200){return _0x17c200;});}return null;};}function removeEntity(_0x4178e2,_0x1ea375){return function(_0x3b7b89){if(_0x3b7b89){return _0x3b7b89[_0x062c('0x21')]()[_0x062c('0x22')](function(){_0x4178e2['status'](0xcc)[_0x062c('0x17')]();});}};}function handleEntityNotFound(_0xc71f0b,_0x2edc23){return function(_0x574afa){if(!_0x574afa){_0xc71f0b[_0x062c('0x16')](0x194);}return _0x574afa;};}function handleError(_0x120f40,_0x4e208c){_0x4e208c=_0x4e208c||0x1f4;return function(_0x4518b1){logger[_0x062c('0x23')](_0x4518b1[_0x062c('0x24')]);if(_0x4518b1['name']){delete _0x4518b1[_0x062c('0x25')];}_0x120f40['status'](_0x4e208c)[_0x062c('0x26')](_0x4518b1);};}exports[_0x062c('0x27')]=function(_0xa36b16,_0x537b08){var _0x4a648e={},_0x337551={},_0x3caadf={'count':0x0,'rows':[]};var _0x4f504d=_[_0x062c('0x28')](db[_0x062c('0x29')][_0x062c('0x2a')],function(_0x3dbae7){return{'name':_0x3dbae7['fieldName'],'type':_0x3dbae7[_0x062c('0x2b')][_0x062c('0x2c')]};});_0x337551['model']=_[_0x062c('0x2d')](_['map'](_0x4f504d,_0x062c('0x25')),[_0x062c('0x25')]);_0x337551[_0x062c('0x2e')]=_[_0x062c('0x2f')](_0xa36b16[_0x062c('0x2e')]);_0x337551['filters']=_[_0x062c('0x30')](_0x337551['model'],_0x337551[_0x062c('0x2e')]);_0x4a648e['attributes']=_[_0x062c('0x30')](_0x337551[_0x062c('0x31')],qs[_0x062c('0x32')](_0xa36b16[_0x062c('0x2e')][_0x062c('0x32')]));_0x4a648e['attributes']=_0x4a648e[_0x062c('0x33')][_0x062c('0x34')]?_0x4a648e['attributes']:_0x337551[_0x062c('0x31')];if(!_0xa36b16[_0x062c('0x2e')]['hasOwnProperty']('nolimit')){_0x4a648e['limit']=qs[_0x062c('0x1b')](_0xa36b16['query'][_0x062c('0x1b')]);_0x4a648e['offset']=qs['offset'](_0xa36b16[_0x062c('0x2e')][_0x062c('0x1d')]);}_0x4a648e[_0x062c('0x35')]=qs[_0x062c('0x36')](_0xa36b16[_0x062c('0x2e')][_0x062c('0x36')]);_0x4a648e[_0x062c('0x37')]=qs[_0x062c('0x38')](_[_0x062c('0x39')](_0xa36b16[_0x062c('0x2e')],_0x337551['filters']),_0x4f504d);if(_0xa36b16[_0x062c('0x2e')][_0x062c('0x3a')]){_0x4a648e['where']=_[_0x062c('0x3b')](_0x4a648e['where'],{'$or':_['map'](_0x4f504d,function(_0x4f0a85){if(_0x4f0a85[_0x062c('0x2b')]!==_0x062c('0x3c')){var _0x3c2d33={};_0x3c2d33[_0x4f0a85[_0x062c('0x25')]]={'$like':'%'+_0xa36b16[_0x062c('0x2e')][_0x062c('0x3a')]+'%'};return _0x3c2d33;}})});}_0x4a648e=_[_0x062c('0x3b')]({},_0x4a648e,_0xa36b16[_0x062c('0x3d')]);var _0xac67ab={'where':_0x4a648e['where']};return db[_0x062c('0x29')][_0x062c('0x1c')](_0xac67ab)[_0x062c('0x22')](function(_0x536df5){_0x3caadf[_0x062c('0x1c')]=_0x536df5;if(_0xa36b16[_0x062c('0x2e')][_0x062c('0x3e')]){_0x4a648e[_0x062c('0x3f')]=[{'all':!![]}];}return db['CmCustomField'][_0x062c('0x40')](_0x4a648e);})[_0x062c('0x22')](function(_0x38e400){_0x3caadf[_0x062c('0x41')]=_0x38e400;return _0x3caadf;})[_0x062c('0x22')](respondWithFilteredResult(_0x537b08,_0x4a648e))[_0x062c('0x42')](handleError(_0x537b08,null));};exports[_0x062c('0x43')]=function(_0x1b50b8,_0x580651){var _0x3aa252={'raw':!![],'where':{'id':_0x1b50b8['params']['id']}},_0x5869bf={};_0x5869bf[_0x062c('0x31')]=_['keys'](db['CmCustomField'][_0x062c('0x2a')]);_0x5869bf[_0x062c('0x2e')]=_['keys'](_0x1b50b8[_0x062c('0x2e')]);_0x5869bf[_0x062c('0x38')]=_[_0x062c('0x30')](_0x5869bf[_0x062c('0x31')],_0x5869bf['query']);_0x3aa252[_0x062c('0x33')]=_[_0x062c('0x30')](_0x5869bf[_0x062c('0x31')],qs[_0x062c('0x32')](_0x1b50b8[_0x062c('0x2e')]['fields']));_0x3aa252[_0x062c('0x33')]=_0x3aa252[_0x062c('0x33')][_0x062c('0x34')]?_0x3aa252[_0x062c('0x33')]:_0x5869bf['model'];if(_0x1b50b8['query'][_0x062c('0x3e')]){_0x3aa252[_0x062c('0x3f')]=[{'all':!![]}];}_0x3aa252=_[_0x062c('0x3b')]({},_0x3aa252,_0x1b50b8[_0x062c('0x3d')]);return db[_0x062c('0x29')]['find'](_0x3aa252)[_0x062c('0x22')](handleEntityNotFound(_0x580651,null))[_0x062c('0x22')](respondWithResult(_0x580651,null))[_0x062c('0x42')](handleError(_0x580651,null));};exports[_0x062c('0x20')]=function(_0x58a42d,_0x21eabf){if(_0x58a42d['body']['id']){delete _0x58a42d[_0x062c('0x44')]['id'];}return db['CmCustomField'][_0x062c('0x45')]({'where':{'id':_0x58a42d[_0x062c('0x46')]['id']}})[_0x062c('0x22')](handleEntityNotFound(_0x21eabf,null))[_0x062c('0x22')](saveUpdates(_0x58a42d['body'],null))[_0x062c('0x22')](respondWithResult(_0x21eabf,null))['catch'](handleError(_0x21eabf,null));};exports[_0x062c('0x21')]=function(_0x1e4588,_0x56eb08){return db['CmCustomField'][_0x062c('0x45')]({'where':{'id':_0x1e4588[_0x062c('0x46')]['id']}})[_0x062c('0x22')](handleEntityNotFound(_0x56eb08,null))[_0x062c('0x22')](removeEntity(_0x56eb08,null))[_0x062c('0x42')](handleError(_0x56eb08,null));};exports[_0x062c('0x47')]=function(_0x5a382e,_0x31cb8b){var _0x301966;return db[_0x062c('0x48')][_0x062c('0x49')](function(_0x50f2a4){return db['CmCustomField'][_0x062c('0x47')](_0x5a382e[_0x062c('0x44')],{'transaction':_0x50f2a4})[_0x062c('0x22')](function(_0x222f14){_0x301966=_0x222f14;var _0x3a6868={'type':db[_0x062c('0x4a')][_0x062c('0x4b')],'transaction':_0x50f2a4};switch(_0x5a382e[_0x062c('0x44')][_0x062c('0x2b')]){case _0x062c('0x4c'):_0x3a6868[_0x062c('0x2b')]=db[_0x062c('0x4a')][_0x062c('0x4b')];break;case _0x062c('0x4d'):_0x3a6868[_0x062c('0x2b')]=db[_0x062c('0x4a')][_0x062c('0x4e')];break;case _0x062c('0x4f'):_0x3a6868[_0x062c('0x2b')]=db[_0x062c('0x4a')][_0x062c('0x50')];_0x3a6868['defaultValue']=![];break;default:}return db[_0x062c('0x48')]['queryInterface'][_0x062c('0x51')]('cm_contacts',util[_0x062c('0x52')](_0x062c('0x53'),_0x301966['id']),_0x3a6868);})[_0x062c('0x22')](function(){return _0x301966;});})['then'](respondWithResult(_0x31cb8b,0xc9))[_0x062c('0x42')](handleError(_0x31cb8b,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 1b00b57..3d751ea 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 _0xe5eb=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','CmCustomField'];(function(_0x526abf,_0x2393c8){var _0x5babef=function(_0x2dc4a5){while(--_0x2dc4a5){_0x526abf['push'](_0x526abf['shift']());}};_0x5babef(++_0x2393c8);}(_0xe5eb,0x18c));var _0xbe5e=function(_0x4cec21,_0x3d6fb4){_0x4cec21=_0x4cec21-0x0;var _0x30f1ef=_0xe5eb[_0x4cec21];return _0x30f1ef;};'use strict';var _=require('lodash');var util=require(_0xbe5e('0x0'));var logger=require(_0xbe5e('0x1'))(_0xbe5e('0x2'));var moment=require(_0xbe5e('0x3'));var BPromise=require(_0xbe5e('0x4'));var rp=require(_0xbe5e('0x5'));var fs=require('fs');var path=require(_0xbe5e('0x6'));var rimraf=require(_0xbe5e('0x7'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xbe5e('0x8')]=function(_0x2d1cba,_0x38453e){return _0x2d1cba[_0xbe5e('0x9')](_0xbe5e('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe638=['path','../../config/environment','./cmCustomField.attributes','CmCustomField','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xe638,0x18a));var _0x8e63=function(_0x35a7c9,_0x2304c8){_0x35a7c9=_0x35a7c9-0x0;var _0x10bc23=_0xe638[_0x35a7c9];return _0x10bc23;};'use strict';var _=require('lodash');var util=require(_0x8e63('0x0'));var logger=require(_0x8e63('0x1'))(_0x8e63('0x2'));var moment=require(_0x8e63('0x3'));var BPromise=require(_0x8e63('0x4'));var rp=require(_0x8e63('0x5'));var fs=require('fs');var path=require(_0x8e63('0x6'));var rimraf=require('rimraf');var config=require(_0x8e63('0x7'));var attributes=require(_0x8e63('0x8'));module['exports']=function(_0x24b345,_0x5403f2){return _0x24b345['define'](_0x8e63('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 d81b072..0314e12 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 _0x2635=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x1f0bb3,_0x4b03b1){var _0x1f234a=function(_0x2ef92e){while(--_0x2ef92e){_0x1f0bb3['push'](_0x1f0bb3['shift']());}};_0x1f234a(++_0x4b03b1);}(_0x2635,0x126));var _0x5263=function(_0x185e1d,_0x2c1087){_0x185e1d=_0x185e1d-0x0;var _0x7bd73c=_0x2635[_0x185e1d];return _0x7bd73c;};'use strict';var _=require(_0x5263('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5263('0x1'));var rs=require(_0x5263('0x2'));var fs=require('fs');var Redis=require(_0x5263('0x3'));var db=require(_0x5263('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5263('0x5'))(_0x5263('0x6'));var config=require(_0x5263('0x7'));var jayson=require(_0x5263('0x8'));var client=jayson[_0x5263('0x9')][_0x5263('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x367e41,_0x5d3a02,_0x3eded2){return new BPromise(function(_0x3d0ce3,_0x464f2d){return client[_0x5263('0xb')](_0x367e41,_0x3eded2)[_0x5263('0xc')](function(_0x9b6f5f){logger['info'](_0x5263('0xd'),_0x5d3a02,_0x5263('0xe'));logger[_0x5263('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5d3a02,_0x5263('0xe'),JSON[_0x5263('0x10')](_0x9b6f5f));if(_0x9b6f5f['error']){if(_0x9b6f5f['error']['code']===0x1f4){logger['error'](_0x5263('0xd'),_0x5d3a02,_0x9b6f5f[_0x5263('0x11')]['message']);return _0x464f2d(_0x9b6f5f['error']['message']);}logger[_0x5263('0x11')](_0x5263('0xd'),_0x5d3a02,_0x9b6f5f['error'][_0x5263('0x12')]);return _0x3d0ce3(_0x9b6f5f[_0x5263('0x11')][_0x5263('0x12')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x5d3a02,'request\x20sent');_0x3d0ce3(_0x9b6f5f[_0x5263('0x13')][_0x5263('0x12')]);}})[_0x5263('0x14')](function(_0x1001c6){logger[_0x5263('0x11')](_0x5263('0xd'),_0x5d3a02,_0x1001c6);_0x464f2d(_0x1001c6);});});} \ No newline at end of file +var _0xb9c5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xb9c5,0x12b));var _0x5b9c=function(_0xa9fc52,_0x3a4d72){_0xa9fc52=_0xa9fc52-0x0;var _0x511e54=_0xb9c5[_0xa9fc52];return _0x511e54;};'use strict';var _=require(_0x5b9c('0x0'));var util=require(_0x5b9c('0x1'));var moment=require(_0x5b9c('0x2'));var BPromise=require(_0x5b9c('0x3'));var rs=require(_0x5b9c('0x4'));var fs=require('fs');var Redis=require(_0x5b9c('0x5'));var db=require(_0x5b9c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b9c('0x7'))('rpc');var config=require(_0x5b9c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b9c('0x9')][_0x5b9c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c96db,_0x2b55c6,_0x1512e7){return new BPromise(function(_0x437b6f,_0x39079e){return client['request'](_0x2c96db,_0x1512e7)[_0x5b9c('0xb')](function(_0xf1a4ce){logger['info']('CmCustomField,\x20%s,\x20%s',_0x2b55c6,_0x5b9c('0xc'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2b55c6,'request\x20sent',JSON[_0x5b9c('0xd')](_0xf1a4ce));if(_0xf1a4ce[_0x5b9c('0xe')]){if(_0xf1a4ce[_0x5b9c('0xe')][_0x5b9c('0xf')]===0x1f4){logger[_0x5b9c('0xe')](_0x5b9c('0x10'),_0x2b55c6,_0xf1a4ce['error'][_0x5b9c('0x11')]);return _0x39079e(_0xf1a4ce[_0x5b9c('0xe')][_0x5b9c('0x11')]);}logger[_0x5b9c('0xe')]('CmCustomField,\x20%s,\x20%s',_0x2b55c6,_0xf1a4ce[_0x5b9c('0xe')][_0x5b9c('0x11')]);return _0x437b6f(_0xf1a4ce[_0x5b9c('0xe')]['message']);}else{logger[_0x5b9c('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2b55c6,_0x5b9c('0xc'));_0x437b6f(_0xf1a4ce[_0x5b9c('0x13')][_0x5b9c('0x11')]);}})['catch'](function(_0x5e7a41){logger[_0x5b9c('0xe')](_0x5b9c('0x10'),_0x2b55c6,_0x5e7a41);_0x39079e(_0x5e7a41);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 9de6371..c5f47f2 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 _0x5e6a=['./cmCustomField.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57e56a,_0x319a5a){var _0x11bdf1=function(_0x1dce21){while(--_0x1dce21){_0x57e56a['push'](_0x57e56a['shift']());}};_0x11bdf1(++_0x319a5a);}(_0x5e6a,0x1e5));var _0xa5e6=function(_0x120fdb,_0x586aa3){_0x120fdb=_0x120fdb-0x0;var _0xc2f5ba=_0x5e6a[_0x120fdb];return _0xc2f5ba;};'use strict';var multer=require(_0xa5e6('0x0'));var util=require('util');var path=require(_0xa5e6('0x1'));var timeout=require(_0xa5e6('0x2'));var express=require(_0xa5e6('0x3'));var router=express[_0xa5e6('0x4')]();var fs_extra=require(_0xa5e6('0x5'));var auth=require(_0xa5e6('0x6'));var interaction=require(_0xa5e6('0x7'));var config=require(_0xa5e6('0x8'));var controller=require(_0xa5e6('0x9'));router[_0xa5e6('0xa')]('/',auth[_0xa5e6('0xb')](),controller['index']);router[_0xa5e6('0xa')]('/:id',auth[_0xa5e6('0xb')](),controller[_0xa5e6('0xc')]);router[_0xa5e6('0xd')]('/',auth[_0xa5e6('0xb')](),controller[_0xa5e6('0xe')]);router[_0xa5e6('0xf')](_0xa5e6('0x10'),auth[_0xa5e6('0xb')](),controller[_0xa5e6('0x11')]);router['delete'](_0xa5e6('0x10'),auth['isAuthenticated'](),controller[_0xa5e6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1e92=['./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e92,0x1df));var _0x21e9=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x1e92[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x21e9('0x0'));var util=require('util');var path=require(_0x21e9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21e9('0x2')]();var fs_extra=require(_0x21e9('0x3'));var auth=require(_0x21e9('0x4'));var interaction=require(_0x21e9('0x5'));var config=require(_0x21e9('0x6'));var controller=require(_0x21e9('0x7'));router[_0x21e9('0x8')]('/',auth[_0x21e9('0x9')](),controller[_0x21e9('0xa')]);router[_0x21e9('0x8')](_0x21e9('0xb'),auth[_0x21e9('0x9')](),controller['show']);router[_0x21e9('0xc')]('/',auth[_0x21e9('0x9')](),controller[_0x21e9('0xd')]);router[_0x21e9('0xe')]('/:id',auth[_0x21e9('0x9')](),controller['update']);router[_0x21e9('0xf')](_0x21e9('0xb'),auth[_0x21e9('0x9')](),controller[_0x21e9('0x10')]);module[_0x21e9('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7a8c911..51b20bd 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 _0xf2c6=['format','INTEGER','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0xde9484,_0x5ba41d){var _0x3a20a9=function(_0x139bca){while(--_0x139bca){_0xde9484['push'](_0xde9484['shift']());}};_0x3a20a9(++_0x5ba41d);}(_0xf2c6,0x73));var _0x6f2c=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xf2c6[_0x4bc65f];return _0x44f85f;};'use strict';var moment=require('moment');var Sequelize=require(_0x6f2c('0x0'));module[_0x6f2c('0x1')]={'phone':{'type':Sequelize[_0x6f2c('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x6f2c('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6f2c('0x4')],'defaultValue':moment()[_0x6f2c('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f2c('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6f2c('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6f2c('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6f2c('0x4')]},'priority':{'type':Sequelize[_0x6f2c('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6f2c('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x6f2c('0x6')],'unique':_0x6f2c('0x7')},'UserId':{'type':Sequelize[_0x6f2c('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x6f2c('0x6')],'unique':_0x6f2c('0x7')},'CampaignId':{'type':Sequelize[_0x6f2c('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x6f2c('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6f2c('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6f2c('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6f2c('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6f2c('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6f2c('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6f2c('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9ce5=['INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4849da,_0x5b4bf2){var _0x594c19=function(_0x490105){while(--_0x490105){_0x4849da['push'](_0x4849da['shift']());}};_0x594c19(++_0x5b4bf2);}(_0x9ce5,0x98));var _0x59ce=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x9ce5[_0x16db8b];return _0x5ba017;};'use strict';var moment=require(_0x59ce('0x0'));var Sequelize=require(_0x59ce('0x1'));module[_0x59ce('0x2')]={'phone':{'type':Sequelize[_0x59ce('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x59ce('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x59ce('0x5')],'defaultValue':moment()[_0x59ce('0x6')](_0x59ce('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x59ce('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x59ce('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x59ce('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x59ce('0x5')]},'priority':{'type':Sequelize[_0x59ce('0x8')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x59ce('0x8')],'unique':_0x59ce('0x9')},'ListId':{'type':Sequelize[_0x59ce('0x8')],'unique':_0x59ce('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x59ce('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x59ce('0x8')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x59ce('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x59ce('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x59ce('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x59ce('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x59ce('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x59ce('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x59ce('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index cf26c43..387bf28 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 _0x3baf=['then','sendStatus','stack','name','send','index','CmHopper','rawAttributes','type','key','model','map','query','keys','filters','concat','$gt','$gte','$lte','$ne','$between','$notBetween','$notIn','$like','$notLike','$notILike','$contains','$contained','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','create','body','find','describe','destroy','params','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','transaction','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','recallme','UPDATE','getOpenContacts','preview','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','limit','count','offset','set','Content-Range','update'];(function(_0x598de7,_0x5306e4){var _0xbc3668=function(_0x4392bc){while(--_0x4392bc){_0x598de7['push'](_0x598de7['shift']());}};_0xbc3668(++_0x5306e4);}(_0x3baf,0xf7));var _0xf3ba=function(_0x2dbbf2,_0x34c336){_0x2dbbf2=_0x2dbbf2-0x0;var _0x2b40ce=_0x3baf[_0x2dbbf2];return _0x2b40ce;};'use strict';var moment=require(_0xf3ba('0x0'));var _=require(_0xf3ba('0x1'));var qs=require(_0xf3ba('0x2'));var logger=require(_0xf3ba('0x3'))(_0xf3ba('0x4'));var shared=require(_0xf3ba('0x5'));var db=require(_0xf3ba('0x6'))['db'];function respondWithResult(_0x306bdd,_0x3e6058){_0x3e6058=_0x3e6058||0xc8;return function(_0x1ae6e6){if(_0x1ae6e6){return _0x306bdd[_0xf3ba('0x7')](_0x3e6058)[_0xf3ba('0x8')](_0x1ae6e6);}};}function respondWithFilteredResult(_0x475268,_0x2e6df2){return function(_0x1284b7){if(_0x1284b7){var _0x4de144=typeof _0x2e6df2['offset']==='undefined'&&typeof _0x2e6df2[_0xf3ba('0x9')]==='undefined';var _0x346f5b=_0x1284b7[_0xf3ba('0xa')];var _0x3ae5fb=_0x4de144?0x0:_0x2e6df2[_0xf3ba('0xb')];var _0x3a5714=_0x4de144?_0x1284b7[_0xf3ba('0xa')]:_0x2e6df2[_0xf3ba('0xb')]+_0x2e6df2[_0xf3ba('0x9')];var _0x32ecd1;if(_0x3a5714>=_0x346f5b){_0x3a5714=_0x346f5b;_0x32ecd1=0xc8;}else{_0x32ecd1=0xce;}_0x475268[_0xf3ba('0x7')](_0x32ecd1);return _0x475268[_0xf3ba('0xc')](_0xf3ba('0xd'),_0x3ae5fb+'-'+_0x3a5714+'/'+_0x346f5b)[_0xf3ba('0x8')](_0x1284b7);}return null;};}function saveUpdates(_0x85939e,_0x26cefe){return function(_0x17673a){if(_0x17673a){return _0x17673a[_0xf3ba('0xe')](_0x85939e)[_0xf3ba('0xf')](function(_0x505b8d){return _0x505b8d;});}return null;};}function handleEntityNotFound(_0x327675,_0x56816b){return function(_0x815037){if(!_0x815037){_0x327675[_0xf3ba('0x10')](0x194);}return _0x815037;};}function handleError(_0x4717be,_0x1e2969){_0x1e2969=_0x1e2969||0x1f4;return function(_0x235c8a){logger['error'](_0x235c8a[_0xf3ba('0x11')]);if(_0x235c8a[_0xf3ba('0x12')]){delete _0x235c8a[_0xf3ba('0x12')];}_0x4717be['status'](_0x1e2969)[_0xf3ba('0x13')](_0x235c8a);};}exports[_0xf3ba('0x14')]=function(_0x430d64,_0x44de40){var _0x4d3c0a={},_0x1e18ed={},_0x3b0d9e={'count':0x0,'rows':[]};var _0x4e601c=_['map'](db[_0xf3ba('0x15')][_0xf3ba('0x16')],function(_0x854fc4){return{'name':_0x854fc4['fieldName'],'type':_0x854fc4[_0xf3ba('0x17')][_0xf3ba('0x18')]};});_0x1e18ed[_0xf3ba('0x19')]=_[_0xf3ba('0x1a')](_0x4e601c,_0xf3ba('0x12'));_0x1e18ed[_0xf3ba('0x1b')]=_[_0xf3ba('0x1c')](_0x430d64['query']);_0x1e18ed['filters']=_['intersection'](_0x1e18ed[_0xf3ba('0x19')],_0x1e18ed[_0xf3ba('0x1b')]);_0x1e18ed[_0xf3ba('0x1d')]=_[_0xf3ba('0x1e')](_0x1e18ed[_0xf3ba('0x1d')],['$and','$or',_0xf3ba('0x1f'),_0xf3ba('0x20'),'$lt',_0xf3ba('0x21'),_0xf3ba('0x22'),'$eq','$not',_0xf3ba('0x23'),_0xf3ba('0x24'),'$in',_0xf3ba('0x25'),_0xf3ba('0x26'),_0xf3ba('0x27'),'$iLike',_0xf3ba('0x28'),'$like','$overlap',_0xf3ba('0x29'),_0xf3ba('0x2a'),'$any']);_0x4d3c0a[_0xf3ba('0x2b')]=_[_0xf3ba('0x2c')](_0x1e18ed['model'],qs['fields'](_0x430d64['query'][_0xf3ba('0x2d')]));_0x4d3c0a[_0xf3ba('0x2b')]=_0x4d3c0a['attributes'][_0xf3ba('0x2e')]?_0x4d3c0a['attributes']:_0x1e18ed['model'];if(!_0x430d64[_0xf3ba('0x1b')][_0xf3ba('0x2f')](_0xf3ba('0x30'))){_0x4d3c0a[_0xf3ba('0x9')]=qs[_0xf3ba('0x9')](_0x430d64[_0xf3ba('0x1b')]['limit']);_0x4d3c0a[_0xf3ba('0xb')]=qs['offset'](_0x430d64[_0xf3ba('0x1b')][_0xf3ba('0xb')]);}_0x4d3c0a['order']=qs[_0xf3ba('0x31')](_0x430d64[_0xf3ba('0x1b')][_0xf3ba('0x31')]);_0x4d3c0a[_0xf3ba('0x32')]=qs['filters'](_[_0xf3ba('0x33')](_0x430d64['query'],_0x1e18ed['filters']),_0x4e601c);if(_0x430d64['query'][_0xf3ba('0x34')]){_0x4d3c0a[_0xf3ba('0x32')]=_[_0xf3ba('0x35')](_0x4d3c0a[_0xf3ba('0x32')],{'$or':_[_0xf3ba('0x1a')](_0x4e601c,function(_0x55b29b){if(_0x55b29b[_0xf3ba('0x17')]!=='VIRTUAL'){var _0x3a927e={};_0x3a927e[_0x55b29b['name']]={'$like':'%'+_0x430d64[_0xf3ba('0x1b')][_0xf3ba('0x34')]+'%'};return _0x3a927e;}})});}_0x4d3c0a=_[_0xf3ba('0x35')]({},_0x4d3c0a,_0x430d64[_0xf3ba('0x36')]);var _0x55d9be={'where':_0x4d3c0a[_0xf3ba('0x32')]};return db[_0xf3ba('0x15')]['count'](_0x55d9be)[_0xf3ba('0xf')](function(_0x2405e5){_0x3b0d9e[_0xf3ba('0xa')]=_0x2405e5;if(_0x430d64[_0xf3ba('0x1b')][_0xf3ba('0x37')]){_0x4d3c0a[_0xf3ba('0x38')]=[{'all':!![]}];}return db[_0xf3ba('0x15')]['findAll'](_0x4d3c0a);})[_0xf3ba('0xf')](function(_0x527092){_0x3b0d9e[_0xf3ba('0x39')]=_0x527092;return _0x3b0d9e;})['then'](respondWithFilteredResult(_0x44de40,_0x4d3c0a))[_0xf3ba('0x3a')](handleError(_0x44de40,null));};exports[_0xf3ba('0x3b')]=function(_0x1251b1,_0x39bbea){var _0x2cbfca={'raw':!![],'where':{'id':_0x1251b1['params']['id']}},_0x5f3dcc={};_0x5f3dcc[_0xf3ba('0x19')]=_[_0xf3ba('0x1c')](db[_0xf3ba('0x15')][_0xf3ba('0x16')]);_0x5f3dcc[_0xf3ba('0x1b')]=_[_0xf3ba('0x1c')](_0x1251b1['query']);_0x5f3dcc[_0xf3ba('0x1d')]=_['intersection'](_0x5f3dcc[_0xf3ba('0x19')],_0x5f3dcc[_0xf3ba('0x1b')]);_0x2cbfca[_0xf3ba('0x2b')]=_[_0xf3ba('0x2c')](_0x5f3dcc[_0xf3ba('0x19')],qs[_0xf3ba('0x2d')](_0x1251b1[_0xf3ba('0x1b')][_0xf3ba('0x2d')]));_0x2cbfca['attributes']=_0x2cbfca[_0xf3ba('0x2b')][_0xf3ba('0x2e')]?_0x2cbfca[_0xf3ba('0x2b')]:_0x5f3dcc[_0xf3ba('0x19')];if(_0x1251b1[_0xf3ba('0x1b')][_0xf3ba('0x37')]){_0x2cbfca[_0xf3ba('0x38')]=[{'all':!![]}];}_0x2cbfca=_['merge']({},_0x2cbfca,_0x1251b1[_0xf3ba('0x36')]);return db[_0xf3ba('0x15')]['find'](_0x2cbfca)[_0xf3ba('0xf')](handleEntityNotFound(_0x39bbea,null))[_0xf3ba('0xf')](respondWithResult(_0x39bbea,null))[_0xf3ba('0x3a')](handleError(_0x39bbea,null));};exports[_0xf3ba('0x3c')]=function(_0x3c454e,_0x6a0ca0){return db[_0xf3ba('0x15')][_0xf3ba('0x3c')](_0x3c454e[_0xf3ba('0x3d')],{})[_0xf3ba('0xf')](respondWithResult(_0x6a0ca0,0xc9))[_0xf3ba('0x3a')](handleError(_0x6a0ca0,null));};exports[_0xf3ba('0xe')]=function(_0x40c152,_0x422655){if(_0x40c152[_0xf3ba('0x3d')]['id']){delete _0x40c152[_0xf3ba('0x3d')]['id'];}return db[_0xf3ba('0x15')][_0xf3ba('0x3e')]({'where':{'id':_0x40c152['params']['id']}})[_0xf3ba('0xf')](handleEntityNotFound(_0x422655,null))[_0xf3ba('0xf')](saveUpdates(_0x40c152['body'],null))[_0xf3ba('0xf')](respondWithResult(_0x422655,null))[_0xf3ba('0x3a')](handleError(_0x422655,null));};exports[_0xf3ba('0x3f')]=function(_0x36f476,_0x52ef61){return db['CmHopper'][_0xf3ba('0x3f')]()[_0xf3ba('0xf')](respondWithResult(_0x52ef61,null))[_0xf3ba('0x3a')](handleError(_0x52ef61,null));};exports[_0xf3ba('0x40')]=function(_0x502483,_0x2d3a0d){var _0xdc71c8;var _0x221050=_0x502483['params']['id'];return db[_0xf3ba('0x15')][_0xf3ba('0x3e')]({'where':{'id':_0x502483[_0xf3ba('0x41')]['id']}})[_0xf3ba('0xf')](handleEntityNotFound(_0x2d3a0d,null))[_0xf3ba('0xf')](function(_0xaaf8b){if(_0xaaf8b){return _0xaaf8b[_0xf3ba('0x40')]()[_0xf3ba('0xf')](function(_0x4620c0){return _0x4620c0;});}})[_0xf3ba('0xf')](function(_0x534426){_0xdc71c8=_0x534426;if(_0x534426){if(_0x534426[_0xf3ba('0x42')]||_0x534426[_0xf3ba('0x43')]){return db[_0x534426[_0xf3ba('0x42')]?_0xf3ba('0x44'):'Campaign'][_0xf3ba('0x3e')]({'where':{'id':_0x534426['VoiceQueueId']?_0x534426['VoiceQueueId']:_0x534426[_0xf3ba('0x43')]},'attributes':['id',_0xf3ba('0x12')],'raw':!![]});}}})[_0xf3ba('0xf')](function(_0x1fc9e6){var _0x410cf6={};if(_0x1fc9e6){_[_0xf3ba('0x35')](_0x410cf6,_[_0xf3ba('0x45')](_0xdc71c8[_0xf3ba('0x46')],['createdAt',_0xf3ba('0x47'),'id']));_0x410cf6[_0xf3ba('0x48')]=0x15;_0x410cf6[_0xf3ba('0x49')]=_0xf3ba('0x4a');_0x410cf6['campaign']=_0x1fc9e6['name'];_0x410cf6[_0xf3ba('0x4b')]=_0x502483[_0xf3ba('0x4c')][_0xf3ba('0x12')];_0x410cf6[_0xf3ba('0x4d')]=_0x502483[_0xf3ba('0x4c')]['id'];_0x410cf6['deleted']=!![];_0x410cf6[_0xf3ba('0x4e')]=moment()['format'](_0xf3ba('0x4f'));_0x410cf6['calleridnum']=_0xdc71c8[_0xf3ba('0x50')];_0x410cf6['campaigntype']=_0xdc71c8[_0xf3ba('0x42')]?_0xf3ba('0x51'):_0xf3ba('0x52');return db[_0xf3ba('0x53')][_0xf3ba('0x3e')]({'where':{'id':_0x410cf6['ContactId']},'attributes':[_0xf3ba('0x54'),_0xf3ba('0x55')]})[_0xf3ba('0xf')](function(_0x494f83){if(!_[_0xf3ba('0x56')](_0x2d3a0d)&&!_['isNil'](_0x494f83[_0xf3ba('0x54')])){_0x410cf6[_0xf3ba('0x57')]=_0x494f83[_0xf3ba('0x54')];if(!_[_0xf3ba('0x56')](_0x494f83[_0xf3ba('0x55')])){_0x410cf6[_0xf3ba('0x57')]+='\x20'+_0x494f83[_0xf3ba('0x55')];}}})[_0xf3ba('0x58')](function(){return db[_0xf3ba('0x59')][_0xf3ba('0x3c')](_0x410cf6);});}})[_0xf3ba('0xf')](function(_0x4f731d){return db[_0xf3ba('0x5a')]['destroy']({'where':{'CmHopperId':_0x221050}});})[_0xf3ba('0xf')](function(){return _0x2d3a0d[_0xf3ba('0x7')](0xcc)[_0xf3ba('0x5b')]();})[_0xf3ba('0x3a')](handleError(_0x2d3a0d,null));};exports['getPreview']=function(_0x26fd3e,_0x307a22){var _0x437458=[];return db[_0xf3ba('0x53')][_0xf3ba('0x3f')]()[_0xf3ba('0xf')](function(_0x3cd4fc){_0x437458=_[_0xf3ba('0x1c')](_0x3cd4fc);return _0x26fd3e[_0xf3ba('0x4c')][_0xf3ba('0x5c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0xf3ba('0xf')](function(_0x172eb7){if(_0x172eb7&&_0x172eb7[_0xf3ba('0x2e')]){return db['sequelize'][_0xf3ba('0x5d')](function(_0x5797a5){var _0x102adb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf3ba('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x172eb7,'id')},'$or':[{'UserId':null},{'UserId':_0x26fd3e[_0xf3ba('0x4c')]['id']}]};var _0x522e55={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x172eb7)[_0xf3ba('0x34')](['dialPreviewAutoRecallMe',0x0])[_0xf3ba('0x1a')]('id')[_0xf3ba('0x5f')]()},'$or':[{'UserId':null},{'UserId':_0x26fd3e[_0xf3ba('0x4c')]['id']}]};var _0x44b33f={'$or':[_0x102adb,_0x522e55]};var _0x540228=[];if(_0x26fd3e[_0xf3ba('0x3d')]['direction']&&_0x26fd3e['body'][_0xf3ba('0x60')]===_0xf3ba('0x61')){if(!_[_0xf3ba('0x62')](_0x26fd3e[_0xf3ba('0x3d')][_0xf3ba('0x63')])){_0x44b33f['id']={'$in':_0x26fd3e[_0xf3ba('0x3d')]['hopperIds']};}_0x540228=[[_0xf3ba('0x64'),_0xf3ba('0x65')],[_0xf3ba('0x66'),_0x172eb7[0x0]['dialOrderByScheduledAt']===_0xf3ba('0x65')?_0xf3ba('0x67'):_0xf3ba('0x65')],db[_0xf3ba('0x68')]['literal'](_0xf3ba('0x69')),['id',_0xf3ba('0x67')]];}else{if(!_[_0xf3ba('0x62')](_0x26fd3e[_0xf3ba('0x3d')][_0xf3ba('0x63')])){_0x44b33f['id']={'$notIn':_0x26fd3e['body'][_0xf3ba('0x63')]};}_0x540228=[[_0xf3ba('0x64'),_0xf3ba('0x67')],[_0xf3ba('0x66'),_0x172eb7[0x0][_0xf3ba('0x6a')]],db[_0xf3ba('0x68')][_0xf3ba('0x6b')](_0xf3ba('0x6c')),['id',_0xf3ba('0x65')]];}return db[_0xf3ba('0x15')][_0xf3ba('0x6d')]({'attributes':['id',_0xf3ba('0x6e'),_0xf3ba('0x50'),'recallme'],'where':_0x44b33f,'order':_0x540228,'transaction':_0x5797a5,'lock':_0x5797a5[_0xf3ba('0x6f')]['UPDATE'],'include':[{'model':db[_0xf3ba('0x53')],'as':_0xf3ba('0x70'),'attributes':_0x437458,'include':[{'model':db[_0xf3ba('0x71')],'as':_0xf3ba('0x72'),'attributes':['id',_0xf3ba('0x12')]}]},{'model':db[_0xf3ba('0x73')],'as':_0xf3ba('0x74'),'attributes':['id',_0xf3ba('0x12')]},{'model':db['VoiceQueue'],'as':_0xf3ba('0x75'),'attributes':['id',_0xf3ba('0x12'),_0xf3ba('0x76')]}]})['then'](function(_0x3e1c39){if(_0x3e1c39){return _0x3e1c39[_0xf3ba('0xe')]({'UserId':_0x26fd3e[_0xf3ba('0x4c')]['id']},{'transaction':_0x5797a5});}});});}})[_0xf3ba('0xf')](handleEntityNotFound(_0x307a22,null))[_0xf3ba('0xf')](respondWithResult(_0x307a22,null))[_0xf3ba('0x3a')](handleError(_0x307a22,null));};exports[_0xf3ba('0x77')]=function(_0x3b1d98,_0x3d966b,_0x4b4267){var _0x588ef2=[];var _0x1060e4=_0x3b1d98[_0xf3ba('0x41')]['id'];var _0x4ce3fc=_0x3b1d98[_0xf3ba('0x4c')]['id'];return db['CmContact'][_0xf3ba('0x3f')]()['then'](function(_0x409f1f){_0x588ef2=_[_0xf3ba('0x1c')](_0x409f1f);return db['sequelize'][_0xf3ba('0x5d')](function(_0x57e5a6){const _0x1105d2={'id':_0x1060e4};return db[_0xf3ba('0x15')][_0xf3ba('0x6d')]({'attributes':['id',_0xf3ba('0x6e'),_0xf3ba('0x78')],'where':_0x1105d2,'transaction':_0x57e5a6,'lock':_0x57e5a6[_0xf3ba('0x6f')][_0xf3ba('0x79')],'include':[{'model':db[_0xf3ba('0x53')],'as':_0xf3ba('0x70'),'attributes':_0x588ef2,'include':[{'model':db['CmCompany'],'as':_0xf3ba('0x72'),'attributes':['id',_0xf3ba('0x12')]}]},{'model':db[_0xf3ba('0x73')],'as':_0xf3ba('0x74'),'attributes':['id',_0xf3ba('0x12')]},{'model':db[_0xf3ba('0x44')],'as':'Queue','attributes':['id',_0xf3ba('0x12'),_0xf3ba('0x76')]}]})[_0xf3ba('0xf')](function(_0x521341){if(_0x521341){return _0x521341[_0xf3ba('0xe')]({'UserId':_0x4ce3fc},{'transaction':_0x57e5a6});}});});})[_0xf3ba('0xf')](handleEntityNotFound(_0x3d966b,null))[_0xf3ba('0xf')](respondWithResult(_0x3d966b,null))[_0xf3ba('0x3a')](handleError(_0x3d966b,null));};exports[_0xf3ba('0x7a')]=function(_0x388170,_0x5b3aef){return _0x388170[_0xf3ba('0x4c')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xf3ba('0x7b')},'attributes':['id'],'raw':!![]})[_0xf3ba('0xf')](function(_0x5c488f){if(_0x5c488f&&_0x5c488f['length']){return db[_0xf3ba('0x15')][_0xf3ba('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf3ba('0x5e')](_0xf3ba('0x4f'))},'VoiceQueueId':{'$in':_[_0xf3ba('0x1a')](_0x5c488f,'id')},'$or':[{'UserId':null},{'UserId':_0x388170[_0xf3ba('0x4c')]['id']}]}});}return 0x0;})[_0xf3ba('0xf')](function(_0x5e78c2){if(!_[_0xf3ba('0x56')](_0x5e78c2)&&_[_0xf3ba('0x7c')](_0x5e78c2)){return _0x5b3aef['status'](0xc8)[_0xf3ba('0x8')]({'contacts':_0x5e78c2});}else{logger[_0xf3ba('0x7d')](_0xf3ba('0x7e'),_0xf3ba('0x7a'),0x194,_0xf3ba('0x7f'));_0x5b3aef[_0xf3ba('0x10')](0x194);}})[_0xf3ba('0x3a')](handleError(_0x5b3aef,null));};exports[_0xf3ba('0x80')]=function(_0x499ac3,_0x504e6a){var _0x5626a1=shared[_0xf3ba('0x81')];var _0x299fab=[];_['map'](_0x5626a1,function(_0x591fb1){_0x299fab['push']({'id':_0x591fb1[_0xf3ba('0x12')],'name':_0x591fb1[_0xf3ba('0x12')],'utcOffset':_0x591fb1['utcOffset']});});return _0x504e6a[_0xf3ba('0x7')](0xc8)[_0xf3ba('0x8')]({'tz':_0x299fab});};exports[_0xf3ba('0x82')]=function(_0x3de094,_0x41eb6b){var _0x2cd284=shared[_0xf3ba('0x81')];var _0x3bc463={};if(!_[_0xf3ba('0x56')](_0x2cd284[_0x3de094['body']['id']]))_0x3bc463=_0x2cd284[_0x3de094[_0xf3ba('0x3d')]['id']];return _0x41eb6b[_0xf3ba('0x7')](0xc8)[_0xf3ba('0x8')](_0x3bc463);}; \ No newline at end of file +var _0x8a28=['set','Content-Range','update','then','error','stack','name','send','index','map','CmHopper','fieldName','model','query','keys','filters','intersection','concat','$or','$gt','$lte','$ne','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','destroy','VoiceQueueId','CampaignId','omit','dataValues','updatedAt','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','literal','DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','dialActive','getPreviewRecall','findOne','recallme','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','push','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset'];(function(_0x39a98f,_0x4553ca){var _0x3ca81d=function(_0x41e9c8){while(--_0x41e9c8){_0x39a98f['push'](_0x39a98f['shift']());}};_0x3ca81d(++_0x4553ca);}(_0x8a28,0xfd));var _0x88a2=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x8a28[_0x55e08b];return _0xd1a7ff;};'use strict';var moment=require(_0x88a2('0x0'));var _=require(_0x88a2('0x1'));var qs=require(_0x88a2('0x2'));var logger=require(_0x88a2('0x3'))(_0x88a2('0x4'));var shared=require(_0x88a2('0x5'));var db=require(_0x88a2('0x6'))['db'];function respondWithResult(_0x3fc89d,_0x5d5b92){_0x5d5b92=_0x5d5b92||0xc8;return function(_0x2f482e){if(_0x2f482e){return _0x3fc89d[_0x88a2('0x7')](_0x5d5b92)[_0x88a2('0x8')](_0x2f482e);}};}function respondWithFilteredResult(_0x438e32,_0x29ce92){return function(_0x5cb591){if(_0x5cb591){var _0x1629ea=typeof _0x29ce92['offset']===_0x88a2('0x9')&&typeof _0x29ce92[_0x88a2('0xa')]===_0x88a2('0x9');var _0xdbb322=_0x5cb591[_0x88a2('0xb')];var _0x2d0fce=_0x1629ea?0x0:_0x29ce92[_0x88a2('0xc')];var _0x306a59=_0x1629ea?_0x5cb591[_0x88a2('0xb')]:_0x29ce92['offset']+_0x29ce92['limit'];var _0x854332;if(_0x306a59>=_0xdbb322){_0x306a59=_0xdbb322;_0x854332=0xc8;}else{_0x854332=0xce;}_0x438e32[_0x88a2('0x7')](_0x854332);return _0x438e32[_0x88a2('0xd')](_0x88a2('0xe'),_0x2d0fce+'-'+_0x306a59+'/'+_0xdbb322)[_0x88a2('0x8')](_0x5cb591);}return null;};}function saveUpdates(_0x4887fc,_0x210a52){return function(_0x1a4056){if(_0x1a4056){return _0x1a4056[_0x88a2('0xf')](_0x4887fc)[_0x88a2('0x10')](function(_0x5093c0){return _0x5093c0;});}return null;};}function handleEntityNotFound(_0x923706,_0x407ef0){return function(_0x3b83ce){if(!_0x3b83ce){_0x923706['sendStatus'](0x194);}return _0x3b83ce;};}function handleError(_0x34f19e,_0x207b12){_0x207b12=_0x207b12||0x1f4;return function(_0x462b7b){logger[_0x88a2('0x11')](_0x462b7b[_0x88a2('0x12')]);if(_0x462b7b[_0x88a2('0x13')]){delete _0x462b7b[_0x88a2('0x13')];}_0x34f19e[_0x88a2('0x7')](_0x207b12)[_0x88a2('0x14')](_0x462b7b);};}exports[_0x88a2('0x15')]=function(_0x235b75,_0x3c030e){var _0x188f6a={},_0x29dc1b={},_0x34d34a={'count':0x0,'rows':[]};var _0x162b5f=_[_0x88a2('0x16')](db[_0x88a2('0x17')]['rawAttributes'],function(_0x190aac){return{'name':_0x190aac[_0x88a2('0x18')],'type':_0x190aac['type']['key']};});_0x29dc1b[_0x88a2('0x19')]=_[_0x88a2('0x16')](_0x162b5f,_0x88a2('0x13'));_0x29dc1b[_0x88a2('0x1a')]=_[_0x88a2('0x1b')](_0x235b75['query']);_0x29dc1b[_0x88a2('0x1c')]=_[_0x88a2('0x1d')](_0x29dc1b[_0x88a2('0x19')],_0x29dc1b[_0x88a2('0x1a')]);_0x29dc1b['filters']=_[_0x88a2('0x1e')](_0x29dc1b['filters'],['$and',_0x88a2('0x1f'),_0x88a2('0x20'),'$gte','$lt',_0x88a2('0x21'),_0x88a2('0x22'),'$eq',_0x88a2('0x23'),_0x88a2('0x24'),_0x88a2('0x25'),_0x88a2('0x26'),'$notIn',_0x88a2('0x27'),'$notLike',_0x88a2('0x28'),_0x88a2('0x29'),_0x88a2('0x27'),'$overlap',_0x88a2('0x2a'),_0x88a2('0x2b'),'$any']);_0x188f6a[_0x88a2('0x2c')]=_[_0x88a2('0x1d')](_0x29dc1b['model'],qs['fields'](_0x235b75[_0x88a2('0x1a')][_0x88a2('0x2d')]));_0x188f6a[_0x88a2('0x2c')]=_0x188f6a[_0x88a2('0x2c')][_0x88a2('0x2e')]?_0x188f6a[_0x88a2('0x2c')]:_0x29dc1b['model'];if(!_0x235b75[_0x88a2('0x1a')][_0x88a2('0x2f')](_0x88a2('0x30'))){_0x188f6a[_0x88a2('0xa')]=qs[_0x88a2('0xa')](_0x235b75[_0x88a2('0x1a')][_0x88a2('0xa')]);_0x188f6a[_0x88a2('0xc')]=qs[_0x88a2('0xc')](_0x235b75[_0x88a2('0x1a')]['offset']);}_0x188f6a['order']=qs[_0x88a2('0x31')](_0x235b75[_0x88a2('0x1a')][_0x88a2('0x31')]);_0x188f6a['where']=qs[_0x88a2('0x1c')](_[_0x88a2('0x32')](_0x235b75['query'],_0x29dc1b[_0x88a2('0x1c')]),_0x162b5f);if(_0x235b75[_0x88a2('0x1a')][_0x88a2('0x33')]){_0x188f6a['where']=_['merge'](_0x188f6a[_0x88a2('0x34')],{'$or':_[_0x88a2('0x16')](_0x162b5f,function(_0x4cb19f){if(_0x4cb19f[_0x88a2('0x35')]!==_0x88a2('0x36')){var _0x327a80={};_0x327a80[_0x4cb19f[_0x88a2('0x13')]]={'$like':'%'+_0x235b75[_0x88a2('0x1a')][_0x88a2('0x33')]+'%'};return _0x327a80;}})});}_0x188f6a=_[_0x88a2('0x37')]({},_0x188f6a,_0x235b75[_0x88a2('0x38')]);var _0x4fdacc={'where':_0x188f6a[_0x88a2('0x34')]};return db[_0x88a2('0x17')]['count'](_0x4fdacc)[_0x88a2('0x10')](function(_0x38cc76){_0x34d34a[_0x88a2('0xb')]=_0x38cc76;if(_0x235b75[_0x88a2('0x1a')][_0x88a2('0x39')]){_0x188f6a[_0x88a2('0x3a')]=[{'all':!![]}];}return db[_0x88a2('0x17')][_0x88a2('0x3b')](_0x188f6a);})[_0x88a2('0x10')](function(_0x1fa0c6){_0x34d34a[_0x88a2('0x3c')]=_0x1fa0c6;return _0x34d34a;})[_0x88a2('0x10')](respondWithFilteredResult(_0x3c030e,_0x188f6a))[_0x88a2('0x3d')](handleError(_0x3c030e,null));};exports[_0x88a2('0x3e')]=function(_0x42b8f7,_0xb21338){var _0x1496d9={'raw':!![],'where':{'id':_0x42b8f7[_0x88a2('0x3f')]['id']}},_0x23cdc2={};_0x23cdc2[_0x88a2('0x19')]=_[_0x88a2('0x1b')](db[_0x88a2('0x17')][_0x88a2('0x40')]);_0x23cdc2[_0x88a2('0x1a')]=_[_0x88a2('0x1b')](_0x42b8f7['query']);_0x23cdc2['filters']=_[_0x88a2('0x1d')](_0x23cdc2[_0x88a2('0x19')],_0x23cdc2['query']);_0x1496d9[_0x88a2('0x2c')]=_[_0x88a2('0x1d')](_0x23cdc2[_0x88a2('0x19')],qs[_0x88a2('0x2d')](_0x42b8f7[_0x88a2('0x1a')][_0x88a2('0x2d')]));_0x1496d9['attributes']=_0x1496d9[_0x88a2('0x2c')][_0x88a2('0x2e')]?_0x1496d9[_0x88a2('0x2c')]:_0x23cdc2['model'];if(_0x42b8f7[_0x88a2('0x1a')][_0x88a2('0x39')]){_0x1496d9[_0x88a2('0x3a')]=[{'all':!![]}];}_0x1496d9=_[_0x88a2('0x37')]({},_0x1496d9,_0x42b8f7['options']);return db[_0x88a2('0x17')][_0x88a2('0x41')](_0x1496d9)[_0x88a2('0x10')](handleEntityNotFound(_0xb21338,null))[_0x88a2('0x10')](respondWithResult(_0xb21338,null))[_0x88a2('0x3d')](handleError(_0xb21338,null));};exports[_0x88a2('0x42')]=function(_0x682411,_0x363475){return db[_0x88a2('0x17')][_0x88a2('0x42')](_0x682411[_0x88a2('0x43')],{})[_0x88a2('0x10')](respondWithResult(_0x363475,0xc9))[_0x88a2('0x3d')](handleError(_0x363475,null));};exports[_0x88a2('0xf')]=function(_0xe8d957,_0x9ef5ac){if(_0xe8d957[_0x88a2('0x43')]['id']){delete _0xe8d957[_0x88a2('0x43')]['id'];}return db[_0x88a2('0x17')][_0x88a2('0x41')]({'where':{'id':_0xe8d957['params']['id']}})[_0x88a2('0x10')](handleEntityNotFound(_0x9ef5ac,null))['then'](saveUpdates(_0xe8d957[_0x88a2('0x43')],null))['then'](respondWithResult(_0x9ef5ac,null))[_0x88a2('0x3d')](handleError(_0x9ef5ac,null));};exports[_0x88a2('0x44')]=function(_0x1c5e6b,_0x37319d){return db[_0x88a2('0x17')][_0x88a2('0x44')]()[_0x88a2('0x10')](respondWithResult(_0x37319d,null))[_0x88a2('0x3d')](handleError(_0x37319d,null));};exports['destroy']=function(_0x1d773c,_0x1cc256){var _0x5b1f66;var _0x341e08=_0x1d773c['params']['id'];return db[_0x88a2('0x17')]['find']({'where':{'id':_0x1d773c[_0x88a2('0x3f')]['id']}})[_0x88a2('0x10')](handleEntityNotFound(_0x1cc256,null))[_0x88a2('0x10')](function(_0x18dae2){if(_0x18dae2){return _0x18dae2[_0x88a2('0x45')]()[_0x88a2('0x10')](function(_0x39bffe){return _0x39bffe;});}})[_0x88a2('0x10')](function(_0x2cf43b){_0x5b1f66=_0x2cf43b;if(_0x2cf43b){if(_0x2cf43b[_0x88a2('0x46')]||_0x2cf43b[_0x88a2('0x47')]){return db[_0x2cf43b[_0x88a2('0x46')]?'VoiceQueue':'Campaign'][_0x88a2('0x41')]({'where':{'id':_0x2cf43b[_0x88a2('0x46')]?_0x2cf43b[_0x88a2('0x46')]:_0x2cf43b[_0x88a2('0x47')]},'attributes':['id',_0x88a2('0x13')],'raw':!![]});}}})['then'](function(_0x2bc03d){var _0x4793ee={};if(_0x2bc03d){_['merge'](_0x4793ee,_[_0x88a2('0x48')](_0x5b1f66[_0x88a2('0x49')],['createdAt',_0x88a2('0x4a'),'id']));_0x4793ee['state']=0x15;_0x4793ee[_0x88a2('0x4b')]=_0x88a2('0x4c');_0x4793ee[_0x88a2('0x4d')]=_0x2bc03d[_0x88a2('0x13')];_0x4793ee[_0x88a2('0x4e')]=_0x1d773c[_0x88a2('0x4f')]['name'];_0x4793ee[_0x88a2('0x50')]=_0x1d773c[_0x88a2('0x4f')]['id'];_0x4793ee[_0x88a2('0x4c')]=!![];_0x4793ee['deletedat']=moment()[_0x88a2('0x51')](_0x88a2('0x52'));_0x4793ee['calleridnum']=_0x5b1f66[_0x88a2('0x53')];_0x4793ee[_0x88a2('0x54')]=_0x5b1f66['VoiceQueueId']?'queue':_0x88a2('0x55');return db[_0x88a2('0x56')]['find']({'where':{'id':_0x4793ee[_0x88a2('0x57')]},'attributes':[_0x88a2('0x58'),_0x88a2('0x59')]})[_0x88a2('0x10')](function(_0xa62fec){if(!_[_0x88a2('0x5a')](_0x1cc256)&&!_[_0x88a2('0x5a')](_0xa62fec['firstName'])){_0x4793ee[_0x88a2('0x5b')]=_0xa62fec[_0x88a2('0x58')];if(!_[_0x88a2('0x5a')](_0xa62fec['lastName'])){_0x4793ee['calleridname']+='\x20'+_0xa62fec['lastName'];}}})[_0x88a2('0x5c')](function(){return db[_0x88a2('0x5d')][_0x88a2('0x42')](_0x4793ee);});}})['then'](function(_0x3aba26){return db[_0x88a2('0x5e')][_0x88a2('0x45')]({'where':{'CmHopperId':_0x341e08}});})[_0x88a2('0x10')](function(){return _0x1cc256[_0x88a2('0x7')](0xcc)[_0x88a2('0x5f')]();})['catch'](handleError(_0x1cc256,null));};exports['getPreview']=function(_0x29371a,_0x5599d1){var _0x4d4411=[];return db[_0x88a2('0x56')][_0x88a2('0x44')]()[_0x88a2('0x10')](function(_0x291f1f){_0x4d4411=_[_0x88a2('0x1b')](_0x291f1f);return _0x29371a['user']['getVoiceQueues']({'where':{'type':_0x88a2('0x60'),'dialActive':!![],'dialMethod':_0x88a2('0x61')},'attributes':['id',_0x88a2('0x62'),_0x88a2('0x63')],'raw':!![]});})[_0x88a2('0x10')](function(_0xb99aaa){if(_0xb99aaa&&_0xb99aaa[_0x88a2('0x2e')]){return db[_0x88a2('0x64')][_0x88a2('0x65')](function(_0x485489){var _0x541172={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x88a2('0x51')](_0x88a2('0x52'))},'VoiceQueueId':{'$in':_['map'](_0xb99aaa,'id')},'$or':[{'UserId':null},{'UserId':_0x29371a['user']['id']}]};var _0x5e538c={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xb99aaa)[_0x88a2('0x33')]([_0x88a2('0x63'),0x0])[_0x88a2('0x16')]('id')[_0x88a2('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x29371a['user']['id']}]};var _0x203e60={'$or':[_0x541172,_0x5e538c]};var _0x3b76bf=[];if(_0x29371a[_0x88a2('0x43')][_0x88a2('0x67')]&&_0x29371a[_0x88a2('0x43')][_0x88a2('0x67')]===_0x88a2('0x68')){if(!_['isEmpty'](_0x29371a['body'][_0x88a2('0x69')])){_0x203e60['id']={'$in':_0x29371a['body']['hopperIds']};}_0x3b76bf=[[_0x88a2('0x6a'),_0x88a2('0x6b')],[_0x88a2('0x6c'),_0xb99aaa[0x0][_0x88a2('0x62')]===_0x88a2('0x6b')?'DESC':_0x88a2('0x6b')],db['sequelize'][_0x88a2('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x88a2('0x6e')]];}else{if(!_['isEmpty'](_0x29371a[_0x88a2('0x43')][_0x88a2('0x69')])){_0x203e60['id']={'$notIn':_0x29371a[_0x88a2('0x43')][_0x88a2('0x69')]};}_0x3b76bf=[[_0x88a2('0x6a'),_0x88a2('0x6e')],[_0x88a2('0x6c'),_0xb99aaa[0x0][_0x88a2('0x62')]],db[_0x88a2('0x64')][_0x88a2('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x88a2('0x6b')]];}return db[_0x88a2('0x17')]['findOne']({'attributes':['id',_0x88a2('0x6f'),'phone','recallme'],'where':_0x203e60,'order':_0x3b76bf,'transaction':_0x485489,'lock':_0x485489[_0x88a2('0x70')][_0x88a2('0x71')],'include':[{'model':db[_0x88a2('0x56')],'as':_0x88a2('0x72'),'attributes':_0x4d4411,'include':[{'model':db[_0x88a2('0x73')],'as':_0x88a2('0x74'),'attributes':['id','name']}]},{'model':db[_0x88a2('0x75')],'as':_0x88a2('0x76'),'attributes':['id',_0x88a2('0x13')]},{'model':db[_0x88a2('0x77')],'as':'Queue','attributes':['id','name',_0x88a2('0x78')]}]})[_0x88a2('0x10')](function(_0x585409){if(_0x585409){return _0x585409[_0x88a2('0xf')]({'UserId':_0x29371a[_0x88a2('0x4f')]['id']},{'transaction':_0x485489});}});});}})[_0x88a2('0x10')](handleEntityNotFound(_0x5599d1,null))[_0x88a2('0x10')](respondWithResult(_0x5599d1,null))['catch'](handleError(_0x5599d1,null));};exports[_0x88a2('0x79')]=function(_0x14c831,_0x1db40c,_0x1350b2){var _0x54b65d=[];var _0x3c8f98=_0x14c831['params']['id'];var _0x149f0e=_0x14c831[_0x88a2('0x4f')]['id'];return db[_0x88a2('0x56')]['describe']()[_0x88a2('0x10')](function(_0x381ea4){_0x54b65d=_['keys'](_0x381ea4);return db[_0x88a2('0x64')][_0x88a2('0x65')](function(_0x1bf412){const _0xf9f243={'id':_0x3c8f98};return db[_0x88a2('0x17')][_0x88a2('0x7a')]({'attributes':['id',_0x88a2('0x6f'),_0x88a2('0x7b')],'where':_0xf9f243,'transaction':_0x1bf412,'lock':_0x1bf412['LOCK'][_0x88a2('0x71')],'include':[{'model':db[_0x88a2('0x56')],'as':_0x88a2('0x72'),'attributes':_0x54b65d,'include':[{'model':db[_0x88a2('0x73')],'as':'Company','attributes':['id',_0x88a2('0x13')]}]},{'model':db[_0x88a2('0x75')],'as':_0x88a2('0x76'),'attributes':['id',_0x88a2('0x13')]},{'model':db[_0x88a2('0x77')],'as':_0x88a2('0x7c'),'attributes':['id',_0x88a2('0x13'),_0x88a2('0x78')]}]})[_0x88a2('0x10')](function(_0xcb1375){if(_0xcb1375){return _0xcb1375['update']({'UserId':_0x149f0e},{'transaction':_0x1bf412});}});});})[_0x88a2('0x10')](handleEntityNotFound(_0x1db40c,null))[_0x88a2('0x10')](respondWithResult(_0x1db40c,null))[_0x88a2('0x3d')](handleError(_0x1db40c,null));};exports[_0x88a2('0x7d')]=function(_0x9d26d1,_0xc3c2f2){return _0x9d26d1[_0x88a2('0x4f')]['getVoiceQueues']({'where':{'type':_0x88a2('0x60'),'dialActive':!![],'dialMethod':_0x88a2('0x61')},'attributes':['id'],'raw':!![]})['then'](function(_0x1f1824){if(_0x1f1824&&_0x1f1824[_0x88a2('0x2e')]){return db['CmHopper'][_0x88a2('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x88a2('0x51')](_0x88a2('0x52'))},'VoiceQueueId':{'$in':_[_0x88a2('0x16')](_0x1f1824,'id')},'$or':[{'UserId':null},{'UserId':_0x9d26d1[_0x88a2('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x5abf8c){if(!_['isNil'](_0x5abf8c)&&_[_0x88a2('0x7e')](_0x5abf8c)){return _0xc3c2f2[_0x88a2('0x7')](0xc8)[_0x88a2('0x8')]({'contacts':_0x5abf8c});}else{logger[_0x88a2('0x11')](_0x88a2('0x7f'),_0x88a2('0x7d'),0x194,_0x88a2('0x80'));_0xc3c2f2['sendStatus'](0x194);}})[_0x88a2('0x3d')](handleError(_0xc3c2f2,null));};exports['getTimezones']=function(_0x912355,_0x5abbd9){var _0x1430ef=shared['timezones'];var _0x526b5a=[];_[_0x88a2('0x16')](_0x1430ef,function(_0x4d9afd){_0x526b5a[_0x88a2('0x81')]({'id':_0x4d9afd['name'],'name':_0x4d9afd[_0x88a2('0x13')],'utcOffset':_0x4d9afd[_0x88a2('0x82')]});});return _0x5abbd9[_0x88a2('0x7')](0xc8)['json']({'tz':_0x526b5a});};exports[_0x88a2('0x83')]=function(_0x4612b5,_0x5212aa){var _0x392317=shared[_0x88a2('0x84')];var _0x24c54a={};if(!_[_0x88a2('0x5a')](_0x392317[_0x4612b5['body']['id']]))_0x24c54a=_0x392317[_0x4612b5[_0x88a2('0x43')]['id']];return _0x5212aa[_0x88a2('0x7')](0xc8)['json'](_0x24c54a);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 26a0215..d86d8dd 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 _0x2bd8=['CmHopper','cm_hopper','scheduledat','phone','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define'];(function(_0x4034c2,_0x43feaa){var _0x1594a2=function(_0x4a7246){while(--_0x4a7246){_0x4034c2['push'](_0x4034c2['shift']());}};_0x1594a2(++_0x43feaa);}(_0x2bd8,0x130));var _0x82bd=function(_0x1beb5b,_0x4f15e5){_0x1beb5b=_0x1beb5b-0x0;var _0x5a3ae0=_0x2bd8[_0x1beb5b];return _0x5a3ae0;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[{'name':_0x82bd('0xd'),'fields':['scheduledat']},{'name':_0x82bd('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x53ec,0x192));var _0xc53e=function(_0x425af8,_0x366c35){_0x425af8=_0x425af8-0x0;var _0x5c2eb1=_0x53ec[_0x425af8];return _0x5c2eb1;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 68000f3..042e87d 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 _0xe110=['LOCK','all','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','Agent','CmList','List','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopper','debug','catch','error','message','ShowCmHopper','find','info','stringify','body','then','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','transaction','UPDATE','keys','User','name','voicePause','length','UserId','push','update','includes','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe110,0xaf));var _0x0e11=function(_0x55a286,_0x5ada6f){_0x55a286=_0x55a286-0x0;var _0x40009f=_0xe110[_0x55a286];return _0x40009f;};'use strict';var _=require(_0x0e11('0x0'));var util=require('util');var moment=require(_0x0e11('0x1'));var BPromise=require(_0x0e11('0x2'));var db=require(_0x0e11('0x3'))['db'];var logger=require(_0x0e11('0x4'))(_0x0e11('0x5'));exports['GetCmHopper']=function(_0x321724){var _0x1b087f=this;return new Promise(function(_0x588616,_0x48ca6e){return db[_0x0e11('0x6')][_0x0e11('0x7')]({'raw':_0x321724[_0x0e11('0x8')]?_0x321724['options'][_0x0e11('0x9')]===undefined?!![]:![]:!![],'where':_0x321724[_0x0e11('0x8')]?_0x321724[_0x0e11('0x8')][_0x0e11('0xa')]||null:null,'attributes':_0x321724[_0x0e11('0x8')]?_0x321724['options'][_0x0e11('0xb')]||null:null,'limit':_0x321724[_0x0e11('0x8')]?_0x321724[_0x0e11('0x8')][_0x0e11('0xc')]||null:null,'include':_0x321724[_0x0e11('0x8')]?_0x321724['options'][_0x0e11('0xd')]?_[_0x0e11('0xe')](_0x321724[_0x0e11('0x8')][_0x0e11('0xd')],function(_0x434da5){return{'model':db[_0x434da5[_0x0e11('0xf')]],'as':_0x434da5['as'],'attributes':_0x434da5['attributes'],'include':_0x434da5[_0x0e11('0xd')]?_['map'](_0x434da5[_0x0e11('0xd')],function(_0x784f32){return{'model':db[_0x784f32[_0x0e11('0xf')]],'as':_0x784f32['as'],'attributes':_0x784f32['attributes'],'include':_0x784f32[_0x0e11('0xd')]?_[_0x0e11('0xe')](_0x784f32['include'],function(_0x37ce7d){return{'model':db[_0x37ce7d[_0x0e11('0xf')]],'as':_0x37ce7d['as'],'attributes':_0x37ce7d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x103f59){logger['info'](_0x0e11('0x10'),_0x321724);logger[_0x0e11('0x11')](_0x0e11('0x10'),_0x321724,JSON['stringify'](_0x103f59));_0x588616(_0x103f59);})[_0x0e11('0x12')](function(_0x55b9ed){logger[_0x0e11('0x13')]('GetCmHopper',_0x55b9ed['message'],_0x321724);_0x48ca6e(_0x1b087f[_0x0e11('0x13')](0x1f4,_0x55b9ed[_0x0e11('0x14')]));});});};exports[_0x0e11('0x15')]=function(_0x2161d8){var _0x5669dd=this;return new Promise(function(_0xc85ab5,_0x462d44){return db['CmHopper'][_0x0e11('0x16')]({'raw':_0x2161d8[_0x0e11('0x8')]?_0x2161d8[_0x0e11('0x8')][_0x0e11('0x9')]===undefined?!![]:![]:!![],'where':_0x2161d8[_0x0e11('0x8')]?_0x2161d8[_0x0e11('0x8')][_0x0e11('0xa')]||null:null,'attributes':_0x2161d8[_0x0e11('0x8')]?_0x2161d8[_0x0e11('0x8')][_0x0e11('0xb')]||null:null,'include':_0x2161d8[_0x0e11('0x8')]?_0x2161d8['options']['include']?_[_0x0e11('0xe')](_0x2161d8[_0x0e11('0x8')][_0x0e11('0xd')],function(_0x2f3194){return{'model':db[_0x2f3194[_0x0e11('0xf')]],'as':_0x2f3194['as'],'attributes':_0x2f3194['attributes'],'include':_0x2f3194['include']?_['map'](_0x2f3194['include'],function(_0x1b413d){return{'model':db[_0x1b413d[_0x0e11('0xf')]],'as':_0x1b413d['as'],'attributes':_0x1b413d[_0x0e11('0xb')],'include':_0x1b413d[_0x0e11('0xd')]?_[_0x0e11('0xe')](_0x1b413d[_0x0e11('0xd')],function(_0x1561f1){return{'model':db[_0x1561f1['model']],'as':_0x1561f1['as'],'attributes':_0x1561f1[_0x0e11('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa82610){logger[_0x0e11('0x17')](_0x0e11('0x15'),_0x2161d8);logger[_0x0e11('0x11')](_0x0e11('0x15'),_0x2161d8,JSON[_0x0e11('0x18')](_0xa82610));_0xc85ab5(_0xa82610);})[_0x0e11('0x12')](function(_0x3adcbd){logger['error'](_0x0e11('0x15'),_0x3adcbd['message'],_0x2161d8);_0x462d44(_0x5669dd[_0x0e11('0x13')](0x1f4,_0x3adcbd[_0x0e11('0x14')]));});});};exports['CreateCmHopper']=function(_0x4e0659){var _0x51c1c7=this;return new Promise(function(_0x1deabd,_0x1a597b){return db[_0x0e11('0x6')]['create'](_0x4e0659[_0x0e11('0x19')],{'raw':_0x4e0659[_0x0e11('0x8')]?_0x4e0659[_0x0e11('0x8')][_0x0e11('0x9')]===undefined?!![]:![]:!![]})[_0x0e11('0x1a')](function(_0x2bbcd2){logger[_0x0e11('0x17')](_0x0e11('0x1b'),_0x4e0659);logger[_0x0e11('0x11')]('CreateCmHopper',_0x4e0659,JSON[_0x0e11('0x18')](_0x2bbcd2));_0x1deabd(_0x2bbcd2);})[_0x0e11('0x12')](function(_0x454661){logger[_0x0e11('0x13')](_0x0e11('0x1b'),_0x454661['message'],_0x4e0659);_0x1a597b(_0x51c1c7[_0x0e11('0x13')](0x1f4,_0x454661[_0x0e11('0x14')]));});});};exports[_0x0e11('0x1c')]=function(_0x34e5d0){var _0x3ae34d=this;return new Promise(function(_0x4e69c2,_0x58c535){return db[_0x0e11('0x6')]['update'](_0x34e5d0[_0x0e11('0x19')],{'raw':_0x34e5d0[_0x0e11('0x8')]?_0x34e5d0[_0x0e11('0x8')][_0x0e11('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34e5d0[_0x0e11('0x8')]?_0x34e5d0[_0x0e11('0x8')]['where']||null:null,'attributes':_0x34e5d0[_0x0e11('0x8')]?_0x34e5d0[_0x0e11('0x8')][_0x0e11('0xb')]||null:null,'limit':_0x34e5d0[_0x0e11('0x8')]?_0x34e5d0[_0x0e11('0x8')][_0x0e11('0xc')]||null:null})[_0x0e11('0x1a')](function(_0x4c3512){logger[_0x0e11('0x17')]('UpdateCmHopper',_0x34e5d0);logger[_0x0e11('0x17')](_0x0e11('0x1d'),JSON['stringify'](_0x34e5d0[_0x0e11('0x8')][_0x0e11('0xa')]),_0x34e5d0[_0x0e11('0x19')][_0x0e11('0x1e')]);logger[_0x0e11('0x11')](_0x0e11('0x1c'),_0x34e5d0,JSON[_0x0e11('0x18')](_0x4c3512));_0x4e69c2(_0x4c3512);})[_0x0e11('0x12')](function(_0x205dfe){logger['error']('UpdateCmHopper',_0x205dfe['message'],_0x34e5d0);_0x58c535(_0x3ae34d[_0x0e11('0x13')](0x1f4,_0x205dfe[_0x0e11('0x14')]));});});};exports[_0x0e11('0x1f')]=function(_0x11ba60){var _0x35e9c8=this;return new Promise(function(_0xabd26a,_0x236cbb){return db[_0x0e11('0x6')][_0x0e11('0x20')]({'where':_0x11ba60['options']?_0x11ba60[_0x0e11('0x8')]['where']||null:null})[_0x0e11('0x1a')](function(_0x10676e){logger[_0x0e11('0x17')]('DestroyCmHopper',_0x11ba60);logger[_0x0e11('0x11')](_0x0e11('0x1f'),_0x11ba60,JSON[_0x0e11('0x18')](_0x10676e));_0xabd26a(_0x10676e);})[_0x0e11('0x12')](function(_0x28cf85){logger['error']('DestroyCmHopper',_0x28cf85['message'],_0x11ba60);_0x236cbb(_0x35e9c8[_0x0e11('0x13')](0x1f4,_0x28cf85[_0x0e11('0x14')]));});});};exports['GetContactDialer']=function(_0x187636){var _0x77f115=this;return new Promise(function(_0x11fab6,_0x37c5b0){return db[_0x0e11('0x21')][_0x0e11('0x22')]()[_0x0e11('0x1a')](function(_0xadf7da){return db['sequelize'][_0x0e11('0x23')](function(_0x3b3685){return db[_0x0e11('0x6')]['findAll']({'where':_0x187636[_0x0e11('0x8')]?_0x187636['options'][_0x0e11('0xa')]||null:null,'attributes':_0x187636[_0x0e11('0x8')]?_0x187636[_0x0e11('0x8')][_0x0e11('0xb')]||null:null,'limit':_0x187636['options']?_0x187636[_0x0e11('0x8')]['limit']||null:null,'order':_0x187636['options']?_0x187636[_0x0e11('0x8')]['order']||null:null,'transaction':_0x3b3685,'lock':_0x3b3685['LOCK'][_0x0e11('0x24')],'include':[{'model':db[_0x0e11('0x21')],'as':'Contact','attributes':_[_0x0e11('0x25')](_0xadf7da)},{'model':db[_0x0e11('0x26')],'as':'Agent','attributes':['id',_0x0e11('0x27'),_0x0e11('0x28')]}]})[_0x0e11('0x1a')](function(_0x4b972f){var _0x1525c1=[];var _0x22a61b=[];for(var _0x32d2b2=0x0;_0x32d2b2<_0x4b972f[_0x0e11('0x29')];_0x32d2b2+=0x1){var _0xfce636=_0x4b972f[_0x32d2b2][_0x0e11('0x2a')];if(_0xfce636===null){_0x1525c1[_0x0e11('0x2b')](_0x4b972f[_0x32d2b2][_0x0e11('0x2c')](_0x187636['body'],{'transaction':_0x3b3685}));}else if(!_0x22a61b[_0x0e11('0x2d')](_0xfce636)){_0x22a61b[_0x0e11('0x2b')](_0xfce636);_0x1525c1[_0x0e11('0x2b')](_0x4b972f[_0x32d2b2]['update'](_0x187636[_0x0e11('0x19')],{'transaction':_0x3b3685}));}}return BPromise['all'](_0x1525c1);});})[_0x0e11('0x1a')](function(_0x3c49b0){logger[_0x0e11('0x17')](_0x0e11('0x2e'),_0x187636);if(_0x3c49b0[_0x0e11('0x29')]>0x0){logger[_0x0e11('0x17')](_0x0e11('0x2f'),_0x3c49b0[0x0][_0x0e11('0x30')]['id'],_0x3c49b0[0x0][_0x0e11('0x30')][_0x0e11('0x31')],_0x3c49b0[0x0]['dataValues'][_0x0e11('0x1e')]);}logger[_0x0e11('0x11')](_0x0e11('0x2e'),_0x187636,JSON[_0x0e11('0x18')](_0x3c49b0));_0x11fab6(_0x3c49b0);})[_0x0e11('0x12')](function(_0x27af85){logger['error'](_0x0e11('0x2e'),_0x27af85[_0x0e11('0x14')],_0x187636);_0x37c5b0(_0x77f115[_0x0e11('0x13')](0x1f4,_0x27af85[_0x0e11('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x43eb86){var _0x104d79=this;return new Promise(function(_0x386c63,_0x33d2d7){return db[_0x0e11('0x32')]['transaction'](function(_0x3f3c53){return db[_0x0e11('0x33')]['create'](_0x43eb86[_0x0e11('0x19')],{'raw':_0x43eb86[_0x0e11('0x8')]?_0x43eb86['options'][_0x0e11('0x9')]===undefined?!![]:![]:!![],'transaction':_0x3f3c53})[_0x0e11('0x1a')](function(){logger[_0x0e11('0x17')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x0e11('0x18')](_0x43eb86[_0x0e11('0x8')]['where']),_0x43eb86['options'][_0x0e11('0xa')][_0x0e11('0x1e')]);return db['CmHopper']['destroy']({'where':_0x43eb86[_0x0e11('0x8')]?_0x43eb86[_0x0e11('0x8')]['where']||null:null,'transaction':_0x3f3c53});});})[_0x0e11('0x1a')](function(_0x59f8f3){logger['info']('MoveContactManagedDialer',_0x43eb86);logger['debug']('MoveContactManagedDialer',_0x43eb86,JSON[_0x0e11('0x18')](_0x59f8f3));_0x386c63(_0x59f8f3);})[_0x0e11('0x12')](function(_0x1c144c){logger[_0x0e11('0x13')]('MoveContactManagedDialer',_0x1c144c[_0x0e11('0x14')],_0x43eb86);_0x33d2d7(_0x104d79[_0x0e11('0x13')](0x1f4,_0x1c144c[_0x0e11('0x14')]));});});};exports[_0x0e11('0x34')]=function(_0x1da7fc){var _0x19b7b2=this;return new Promise(function(_0x2e050c,_0x4aef1b){return db['CmHopper']['findAll']({'raw':_0x1da7fc[_0x0e11('0x8')]?_0x1da7fc[_0x0e11('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x1da7fc[_0x0e11('0x8')]?_0x1da7fc['options'][_0x0e11('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0x0e11('0x35'),db['sequelize']['fn']('IF',db[_0x0e11('0x32')][_0x0e11('0x36')](_0x0e11('0x37')+util[_0x0e11('0x38')]('\x22%s\x22',moment()[_0x0e11('0x38')](_0x0e11('0x39')))+_0x0e11('0x3a')))),_0x0e11('0x3b')]]})[_0x0e11('0x1a')](function(_0x472d18){logger[_0x0e11('0x17')](_0x0e11('0x34'),_0x1da7fc);logger['debug']('CountReScheduled',_0x1da7fc,JSON[_0x0e11('0x18')](_0x472d18));_0x2e050c(_0x472d18);})[_0x0e11('0x12')](function(_0x53c2a8){logger[_0x0e11('0x13')](_0x0e11('0x34'),_0x53c2a8[_0x0e11('0x14')],_0x1da7fc);_0x4aef1b(_0x19b7b2[_0x0e11('0x13')](0x1f4,_0x53c2a8[_0x0e11('0x14')]));});});};exports[_0x0e11('0x3c')]=function(_0x3602ff){var _0x37d1a9=this;return new Promise(function(_0x3dba3b,_0x194141){return db['CmContact'][_0x0e11('0x22')]()[_0x0e11('0x1a')](function(){return db['sequelize'][_0x0e11('0x23')](function(_0x451cf5){return db[_0x0e11('0x6')][_0x0e11('0x7')]({'where':_0x3602ff['options']?_0x3602ff['options'][_0x0e11('0xa')]||null:null,'attributes':_0x3602ff[_0x0e11('0x8')]?_0x3602ff[_0x0e11('0x8')][_0x0e11('0xb')]||null:null,'limit':0x1,'order':_0x3602ff[_0x0e11('0x8')]?_0x3602ff['options'][_0x0e11('0x3d')]||null:null,'group':db[_0x0e11('0x6')][_0x0e11('0x2a')],'transaction':_0x451cf5,'lock':_0x451cf5[_0x0e11('0x3e')][_0x0e11('0x24')],'include':_0x3602ff['options']?_0x3602ff['options'][_0x0e11('0xd')]?_['map'](_0x3602ff['options']['include'],function(_0x22214d){return{'model':db[_0x22214d['model']],'as':_0x22214d['as'],'attributes':_0x22214d[_0x0e11('0xb')],'include':_0x22214d[_0x0e11('0xd')]?_[_0x0e11('0xe')](_0x22214d['include'],function(_0x2f315a){return{'model':db[_0x2f315a['model']],'as':_0x2f315a['as'],'attributes':_0x2f315a[_0x0e11('0xb')],'include':_0x2f315a[_0x0e11('0xd')]?_[_0x0e11('0xe')](_0x2f315a['include'],function(_0x500b02){return{'model':db[_0x500b02[_0x0e11('0xf')]],'as':_0x500b02['as'],'attributes':_0x500b02[_0x0e11('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f5732){var _0x336dda=[];for(var _0x2542e3=0x0;_0x2542e3<_0x2f5732[_0x0e11('0x29')];_0x2542e3+=0x1){_0x336dda['push'](_0x2f5732[_0x2542e3][_0x0e11('0x2c')](_0x3602ff[_0x0e11('0x19')],{'transaction':_0x451cf5}));}return BPromise[_0x0e11('0x3f')](_0x336dda);});})[_0x0e11('0x1a')](function(_0x5da6d9){logger[_0x0e11('0x17')](_0x0e11('0x3c'),_0x3602ff);logger[_0x0e11('0x11')](_0x0e11('0x3c'),_0x3602ff,JSON[_0x0e11('0x18')](_0x5da6d9));_0x3dba3b(_0x5da6d9);})[_0x0e11('0x12')](function(_0x4876b8){logger[_0x0e11('0x13')](_0x0e11('0x3c'),_0x4876b8['message'],_0x3602ff);_0x194141(_0x37d1a9[_0x0e11('0x13')](0x1f4,_0x4876b8['message']));});});});};exports[_0x0e11('0x40')]=function(_0x3ea5a2){var _0x305c24=this;return new Promise(function(_0x2ae0c1,_0x2c95eb){db[_0x0e11('0x21')]['describe']()[_0x0e11('0x1a')](function(_0x11101e){return db['CmHopper'][_0x0e11('0x7')]({'raw':_0x3ea5a2[_0x0e11('0x8')]?_0x3ea5a2[_0x0e11('0x8')][_0x0e11('0x9')]===undefined?!![]:![]:!![],'where':_0x3ea5a2[_0x0e11('0x8')]?_0x3ea5a2['options']['where']||null:null,'attributes':_0x3ea5a2[_0x0e11('0x8')]?_0x3ea5a2[_0x0e11('0x8')][_0x0e11('0xb')]||null:null,'limit':_0x3ea5a2[_0x0e11('0x8')]?_0x3ea5a2[_0x0e11('0x8')][_0x0e11('0xc')]||null:null,'include':_0x3ea5a2[_0x0e11('0x8')]?_0x3ea5a2['options'][_0x0e11('0xd')]?_[_0x0e11('0xe')](_0x3ea5a2[_0x0e11('0x8')][_0x0e11('0xd')],function(_0x2bf69a){return{'model':db[_0x2bf69a[_0x0e11('0xf')]],'as':_0x2bf69a['as'],'attributes':_0x2bf69a['as']==='Contact'?_[_0x0e11('0x25')](_0x11101e):_0x2bf69a[_0x0e11('0xb')],'include':_0x2bf69a[_0x0e11('0xd')]?_['map'](_0x2bf69a[_0x0e11('0xd')],function(_0x2d15e0){return{'model':db[_0x2d15e0[_0x0e11('0xf')]],'as':_0x2d15e0['as'],'attributes':_0x2d15e0[_0x0e11('0xb')],'include':_0x2d15e0[_0x0e11('0xd')]?_['map'](_0x2d15e0['include'],function(_0x3cb56d){return{'model':db[_0x3cb56d['model']],'as':_0x3cb56d['as'],'attributes':_0x3cb56d[_0x0e11('0xb')]};}):[]};}):[]};}):[]:[]})[_0x0e11('0x1a')](function(_0x5b4e23){logger[_0x0e11('0x17')](_0x0e11('0x10'),_0x3ea5a2);logger[_0x0e11('0x11')]('GetCmHopper',_0x3ea5a2,JSON['stringify'](_0x5b4e23));_0x2ae0c1(_0x5b4e23);})['catch'](function(_0x2165a2){logger['error'](_0x0e11('0x10'),_0x2165a2['message'],_0x3ea5a2);_0x2c95eb(_0x305c24[_0x0e11('0x13')](0x1f4,_0x2165a2[_0x0e11('0x14')]));});});});};exports[_0x0e11('0x41')]=function(_0x12df62){var _0x8ddebb=this;return new Promise(function(_0xa71326,_0x46caca){return db['CmContact'][_0x0e11('0x42')]({'raw':!![],'where':{'phone':_0x12df62[_0x0e11('0x8')][_0x0e11('0xa')][_0x0e11('0x43')]},'attributes':['id',_0x0e11('0x44')],'order':[['id','DESC']]})['then'](function(_0x2d5840){logger[_0x0e11('0x17')]('getContactByPhone',_0x12df62);logger[_0x0e11('0x11')](_0x0e11('0x45'),_0x12df62,JSON[_0x0e11('0x18')](_0x2d5840));_0xa71326(_0x2d5840);})['catch'](function(_0x19a1ff){logger[_0x0e11('0x13')]('getContactByPhone',_0x19a1ff[_0x0e11('0x14')],_0x12df62);_0x46caca(_0x8ddebb[_0x0e11('0x13')](0x1f4,_0x19a1ff[_0x0e11('0x14')]));});});};exports[_0x0e11('0x46')]=function(_0xf45bcc){var _0x376ac6=this;return new Promise(function(_0x3cfa75,_0x1f7c1d){return db[_0x0e11('0x32')]['transaction'](function(_0x1d0772){var _0x3ba06e=_0xf45bcc[_0x0e11('0x8')]&&_0xf45bcc[_0x0e11('0x8')][_0x0e11('0xa')]?_0xf45bcc['options']['where']:{};return db[_0x0e11('0x6')]['update'](_0xf45bcc[_0x0e11('0x19')],{'where':_0x3ba06e,'transaction':_0x1d0772})[_0x0e11('0x1a')](function(_0x31be87){logger['info']('ResetActiveCalls',_0xf45bcc);logger[_0x0e11('0x11')](_0x0e11('0x46'),_0xf45bcc,JSON[_0x0e11('0x18')](_0x31be87));_0x3cfa75(_0x31be87);})[_0x0e11('0x12')](function(_0x574b44){logger[_0x0e11('0x13')](_0x0e11('0x46'),_0x574b44['message'],_0xf45bcc);_0x1f7c1d(_0x376ac6[_0x0e11('0x13')](0x1f4,_0x574b44[_0x0e11('0x14')]));});});});};exports[_0x0e11('0x47')]=function(_0x5140ef){var _0x3c2145=this;var _0x5e4fcc=_0x5140ef[_0x0e11('0x19')]['where']['voiceQueueIds'];var _0x3050b7=_0x5140ef[_0x0e11('0x19')]['where'][_0x0e11('0x48')];var _0x8a8bca=_0x5140ef[_0x0e11('0x19')][_0x0e11('0xa')][_0x0e11('0x49')];return new Promise(function(_0x3a519e,_0x432fdc){return db[_0x0e11('0x6')][_0x0e11('0x7')]({'where':{'voiceQueueId':{'$in':_0x5e4fcc},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x0e11('0x36')](_0x0e11('0x4a')+_0x3050b7+_0x0e11('0x4b')),'$gt':db[_0x0e11('0x32')][_0x0e11('0x36')]('NOW()')}},'UserId':{'$in':_0x8a8bca}},'include':[{'model':db[_0x0e11('0x21')],'as':'Contact'},{'model':db[_0x0e11('0x26')],'as':_0x0e11('0x4c'),'attributes':['id',_0x0e11('0x27'),_0x0e11('0x28')]},{'model':db[_0x0e11('0x4d')],'as':_0x0e11('0x4e')}]})[_0x0e11('0x1a')](function(_0x575b3e){if(_0x575b3e[_0x0e11('0x29')]>0x0){return db[_0x0e11('0x32')][_0x0e11('0x23')](function(_0xc84606){return db['CmHopper'][_0x0e11('0x2c')]({'recallmeNotifiedDate':db[_0x0e11('0x32')][_0x0e11('0x36')]('NOW()')},{'where':{'id':{'$in':_[_0x0e11('0xe')](_0x575b3e,'id')}},'transaction':_0xc84606})[_0x0e11('0x1a')](function(){_0x3a519e(_0x575b3e);})[_0x0e11('0x12')](function(_0x1df12a){logger[_0x0e11('0x13')](_0x0e11('0x47'),_0x1df12a[_0x0e11('0x14')],_0x5140ef);_0x432fdc(_0x3c2145[_0x0e11('0x13')](0x1f4,_0x1df12a['message']));});})['catch'](function(_0x1539fb){logger['error'](_0x0e11('0x47'),_0x1539fb['message'],_0x5140ef);_0x432fdc(_0x3c2145[_0x0e11('0x13')](0x1f4,_0x1539fb[_0x0e11('0x14')]));});}else{_0x3a519e(_0x575b3e);}});});}; \ No newline at end of file +var _0xbf57=['\x20MINUTE','name','CmList','List','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','error','message','ShowCmHopper','find','stringify','CreateCmHopper','create','body','catch','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetContactByPhone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20'];(function(_0x23743c,_0x40bbc6){var _0x4b8fd0=function(_0x48a8cc){while(--_0x48a8cc){_0x23743c['push'](_0x23743c['shift']());}};_0x4b8fd0(++_0x40bbc6);}(_0xbf57,0xf4));var _0x7bf5=function(_0x277c37,_0x4c92ba){_0x277c37=_0x277c37-0x0;var _0x1ac05d=_0xbf57[_0x277c37];return _0x1ac05d;};'use strict';var _=require(_0x7bf5('0x0'));var util=require('util');var moment=require(_0x7bf5('0x1'));var BPromise=require(_0x7bf5('0x2'));var db=require(_0x7bf5('0x3'))['db'];var logger=require(_0x7bf5('0x4'))(_0x7bf5('0x5'));exports[_0x7bf5('0x6')]=function(_0x4f5e9b){var _0x6658e1=this;return new Promise(function(_0x31384c,_0x36e693){return db[_0x7bf5('0x7')][_0x7bf5('0x8')]({'raw':_0x4f5e9b['options']?_0x4f5e9b[_0x7bf5('0x9')][_0x7bf5('0xa')]===undefined?!![]:![]:!![],'where':_0x4f5e9b[_0x7bf5('0x9')]?_0x4f5e9b[_0x7bf5('0x9')][_0x7bf5('0xb')]||null:null,'attributes':_0x4f5e9b['options']?_0x4f5e9b[_0x7bf5('0x9')][_0x7bf5('0xc')]||null:null,'limit':_0x4f5e9b[_0x7bf5('0x9')]?_0x4f5e9b[_0x7bf5('0x9')][_0x7bf5('0xd')]||null:null,'include':_0x4f5e9b[_0x7bf5('0x9')]?_0x4f5e9b['options'][_0x7bf5('0xe')]?_[_0x7bf5('0xf')](_0x4f5e9b['options']['include'],function(_0x5da1a7){return{'model':db[_0x5da1a7[_0x7bf5('0x10')]],'as':_0x5da1a7['as'],'attributes':_0x5da1a7[_0x7bf5('0xc')],'include':_0x5da1a7[_0x7bf5('0xe')]?_[_0x7bf5('0xf')](_0x5da1a7[_0x7bf5('0xe')],function(_0x1e495c){return{'model':db[_0x1e495c[_0x7bf5('0x10')]],'as':_0x1e495c['as'],'attributes':_0x1e495c[_0x7bf5('0xc')],'include':_0x1e495c['include']?_[_0x7bf5('0xf')](_0x1e495c[_0x7bf5('0xe')],function(_0x11f2ed){return{'model':db[_0x11f2ed['model']],'as':_0x11f2ed['as'],'attributes':_0x11f2ed[_0x7bf5('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7bf5('0x11')](function(_0x40ae4c){logger[_0x7bf5('0x12')](_0x7bf5('0x6'),_0x4f5e9b);logger[_0x7bf5('0x13')](_0x7bf5('0x6'),_0x4f5e9b,JSON['stringify'](_0x40ae4c));_0x31384c(_0x40ae4c);})['catch'](function(_0x40ca41){logger[_0x7bf5('0x14')](_0x7bf5('0x6'),_0x40ca41[_0x7bf5('0x15')],_0x4f5e9b);_0x36e693(_0x6658e1[_0x7bf5('0x14')](0x1f4,_0x40ca41['message']));});});};exports[_0x7bf5('0x16')]=function(_0x1e6dea){var _0x2f572f=this;return new Promise(function(_0x2e0e0d,_0x30a1b7){return db[_0x7bf5('0x7')][_0x7bf5('0x17')]({'raw':_0x1e6dea[_0x7bf5('0x9')]?_0x1e6dea[_0x7bf5('0x9')][_0x7bf5('0xa')]===undefined?!![]:![]:!![],'where':_0x1e6dea[_0x7bf5('0x9')]?_0x1e6dea['options'][_0x7bf5('0xb')]||null:null,'attributes':_0x1e6dea[_0x7bf5('0x9')]?_0x1e6dea[_0x7bf5('0x9')][_0x7bf5('0xc')]||null:null,'include':_0x1e6dea[_0x7bf5('0x9')]?_0x1e6dea['options']['include']?_[_0x7bf5('0xf')](_0x1e6dea[_0x7bf5('0x9')]['include'],function(_0xcf378c){return{'model':db[_0xcf378c[_0x7bf5('0x10')]],'as':_0xcf378c['as'],'attributes':_0xcf378c[_0x7bf5('0xc')],'include':_0xcf378c[_0x7bf5('0xe')]?_[_0x7bf5('0xf')](_0xcf378c['include'],function(_0x5d1a3c){return{'model':db[_0x5d1a3c[_0x7bf5('0x10')]],'as':_0x5d1a3c['as'],'attributes':_0x5d1a3c[_0x7bf5('0xc')],'include':_0x5d1a3c[_0x7bf5('0xe')]?_[_0x7bf5('0xf')](_0x5d1a3c[_0x7bf5('0xe')],function(_0x1aefcd){return{'model':db[_0x1aefcd[_0x7bf5('0x10')]],'as':_0x1aefcd['as'],'attributes':_0x1aefcd[_0x7bf5('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7bf5('0x11')](function(_0x7aa5b9){logger[_0x7bf5('0x12')](_0x7bf5('0x16'),_0x1e6dea);logger['debug'](_0x7bf5('0x16'),_0x1e6dea,JSON[_0x7bf5('0x18')](_0x7aa5b9));_0x2e0e0d(_0x7aa5b9);})['catch'](function(_0x4b50a3){logger[_0x7bf5('0x14')](_0x7bf5('0x16'),_0x4b50a3[_0x7bf5('0x15')],_0x1e6dea);_0x30a1b7(_0x2f572f[_0x7bf5('0x14')](0x1f4,_0x4b50a3['message']));});});};exports[_0x7bf5('0x19')]=function(_0x4879e0){var _0x2a17f0=this;return new Promise(function(_0x22b323,_0x3c8bac){return db[_0x7bf5('0x7')][_0x7bf5('0x1a')](_0x4879e0[_0x7bf5('0x1b')],{'raw':_0x4879e0[_0x7bf5('0x9')]?_0x4879e0[_0x7bf5('0x9')][_0x7bf5('0xa')]===undefined?!![]:![]:!![]})[_0x7bf5('0x11')](function(_0x3724b6){logger[_0x7bf5('0x12')](_0x7bf5('0x19'),_0x4879e0);logger[_0x7bf5('0x13')](_0x7bf5('0x19'),_0x4879e0,JSON[_0x7bf5('0x18')](_0x3724b6));_0x22b323(_0x3724b6);})[_0x7bf5('0x1c')](function(_0x75524a){logger[_0x7bf5('0x14')]('CreateCmHopper',_0x75524a[_0x7bf5('0x15')],_0x4879e0);_0x3c8bac(_0x2a17f0[_0x7bf5('0x14')](0x1f4,_0x75524a[_0x7bf5('0x15')]));});});};exports[_0x7bf5('0x1d')]=function(_0xc3224a){var _0x4773fc=this;return new Promise(function(_0x122fd9,_0x1a05ab){return db[_0x7bf5('0x7')][_0x7bf5('0x1e')](_0xc3224a[_0x7bf5('0x1b')],{'raw':_0xc3224a[_0x7bf5('0x9')]?_0xc3224a[_0x7bf5('0x9')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc3224a['options']?_0xc3224a['options'][_0x7bf5('0xb')]||null:null,'attributes':_0xc3224a[_0x7bf5('0x9')]?_0xc3224a[_0x7bf5('0x9')]['attributes']||null:null,'limit':_0xc3224a['options']?_0xc3224a[_0x7bf5('0x9')][_0x7bf5('0xd')]||null:null})['then'](function(_0x3c1cbd){logger[_0x7bf5('0x12')](_0x7bf5('0x1d'),_0xc3224a);logger[_0x7bf5('0x12')](_0x7bf5('0x1f'),JSON[_0x7bf5('0x18')](_0xc3224a[_0x7bf5('0x9')]['where']),_0xc3224a['body'][_0x7bf5('0x20')]);logger[_0x7bf5('0x13')](_0x7bf5('0x1d'),_0xc3224a,JSON[_0x7bf5('0x18')](_0x3c1cbd));_0x122fd9(_0x3c1cbd);})[_0x7bf5('0x1c')](function(_0x4e1c3b){logger[_0x7bf5('0x14')]('UpdateCmHopper',_0x4e1c3b[_0x7bf5('0x15')],_0xc3224a);_0x1a05ab(_0x4773fc['error'](0x1f4,_0x4e1c3b['message']));});});};exports[_0x7bf5('0x21')]=function(_0x42fd4f){var _0x2fe135=this;return new Promise(function(_0x17f4ad,_0x1b46c6){return db[_0x7bf5('0x7')][_0x7bf5('0x22')]({'where':_0x42fd4f[_0x7bf5('0x9')]?_0x42fd4f[_0x7bf5('0x9')][_0x7bf5('0xb')]||null:null})[_0x7bf5('0x11')](function(_0x55e1e3){logger[_0x7bf5('0x12')](_0x7bf5('0x21'),_0x42fd4f);logger[_0x7bf5('0x13')](_0x7bf5('0x21'),_0x42fd4f,JSON['stringify'](_0x55e1e3));_0x17f4ad(_0x55e1e3);})[_0x7bf5('0x1c')](function(_0x4fdeef){logger['error'](_0x7bf5('0x21'),_0x4fdeef[_0x7bf5('0x15')],_0x42fd4f);_0x1b46c6(_0x2fe135[_0x7bf5('0x14')](0x1f4,_0x4fdeef[_0x7bf5('0x15')]));});});};exports[_0x7bf5('0x23')]=function(_0x27bff5){var _0xd237e8=this;return new Promise(function(_0x52bc99,_0x4fe204){return db[_0x7bf5('0x24')][_0x7bf5('0x25')]()['then'](function(_0x1c3eab){return db[_0x7bf5('0x26')][_0x7bf5('0x27')](function(_0xcee87d){return db['CmHopper'][_0x7bf5('0x8')]({'where':_0x27bff5[_0x7bf5('0x9')]?_0x27bff5[_0x7bf5('0x9')]['where']||null:null,'attributes':_0x27bff5[_0x7bf5('0x9')]?_0x27bff5['options']['attributes']||null:null,'limit':_0x27bff5[_0x7bf5('0x9')]?_0x27bff5[_0x7bf5('0x9')][_0x7bf5('0xd')]||null:null,'order':_0x27bff5[_0x7bf5('0x9')]?_0x27bff5[_0x7bf5('0x9')][_0x7bf5('0x28')]||null:null,'transaction':_0xcee87d,'lock':_0xcee87d[_0x7bf5('0x29')][_0x7bf5('0x2a')],'include':[{'model':db[_0x7bf5('0x24')],'as':_0x7bf5('0x2b'),'attributes':_[_0x7bf5('0x2c')](_0x1c3eab)},{'model':db[_0x7bf5('0x2d')],'as':_0x7bf5('0x2e'),'attributes':['id','name',_0x7bf5('0x2f')]}]})['then'](function(_0x2bb57d){var _0x5c086c=[];var _0x26bb5a=[];for(var _0x17f3bf=0x0;_0x17f3bf<_0x2bb57d[_0x7bf5('0x30')];_0x17f3bf+=0x1){var _0x38633e=_0x2bb57d[_0x17f3bf][_0x7bf5('0x31')];if(_0x38633e===null){_0x5c086c[_0x7bf5('0x32')](_0x2bb57d[_0x17f3bf][_0x7bf5('0x1e')](_0x27bff5[_0x7bf5('0x1b')],{'transaction':_0xcee87d}));}else if(!_0x26bb5a[_0x7bf5('0x33')](_0x38633e)){_0x26bb5a['push'](_0x38633e);_0x5c086c['push'](_0x2bb57d[_0x17f3bf][_0x7bf5('0x1e')](_0x27bff5[_0x7bf5('0x1b')],{'transaction':_0xcee87d}));}}return BPromise[_0x7bf5('0x34')](_0x5c086c);});})[_0x7bf5('0x11')](function(_0xb1b439){logger[_0x7bf5('0x12')]('GetContactDialer',_0x27bff5);if(_0xb1b439['length']>0x0){logger['info'](_0x7bf5('0x35'),_0xb1b439[0x0][_0x7bf5('0x36')]['id'],_0xb1b439[0x0][_0x7bf5('0x36')]['ContactId'],_0xb1b439[0x0]['dataValues']['active']);}logger['debug'](_0x7bf5('0x23'),_0x27bff5,JSON[_0x7bf5('0x18')](_0xb1b439));_0x52bc99(_0xb1b439);})[_0x7bf5('0x1c')](function(_0x1e9dc8){logger[_0x7bf5('0x14')]('GetContactDialer',_0x1e9dc8[_0x7bf5('0x15')],_0x27bff5);_0x4fe204(_0xd237e8[_0x7bf5('0x14')](0x1f4,_0x1e9dc8[_0x7bf5('0x15')]));});});});};exports[_0x7bf5('0x37')]=function(_0x6a02c4){var _0x30892e=this;return new Promise(function(_0x43bc60,_0x4e6613){return db['sequelize'][_0x7bf5('0x27')](function(_0x5c439a){return db[_0x7bf5('0x38')][_0x7bf5('0x1a')](_0x6a02c4[_0x7bf5('0x1b')],{'raw':_0x6a02c4['options']?_0x6a02c4[_0x7bf5('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0x5c439a})[_0x7bf5('0x11')](function(){logger[_0x7bf5('0x12')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x7bf5('0x18')](_0x6a02c4['options'][_0x7bf5('0xb')]),_0x6a02c4['options']['where'][_0x7bf5('0x20')]);return db[_0x7bf5('0x7')]['destroy']({'where':_0x6a02c4[_0x7bf5('0x9')]?_0x6a02c4[_0x7bf5('0x9')]['where']||null:null,'transaction':_0x5c439a});});})['then'](function(_0x4b88f0){logger[_0x7bf5('0x12')]('MoveContactManagedDialer',_0x6a02c4);logger[_0x7bf5('0x13')](_0x7bf5('0x37'),_0x6a02c4,JSON['stringify'](_0x4b88f0));_0x43bc60(_0x4b88f0);})[_0x7bf5('0x1c')](function(_0x191312){logger[_0x7bf5('0x14')](_0x7bf5('0x37'),_0x191312[_0x7bf5('0x15')],_0x6a02c4);_0x4e6613(_0x30892e[_0x7bf5('0x14')](0x1f4,_0x191312[_0x7bf5('0x15')]));});});};exports[_0x7bf5('0x39')]=function(_0x31ee60){var _0x436835=this;return new Promise(function(_0x49b4d5,_0x4aceec){return db[_0x7bf5('0x7')][_0x7bf5('0x8')]({'raw':_0x31ee60[_0x7bf5('0x9')]?_0x31ee60[_0x7bf5('0x9')][_0x7bf5('0xa')]===undefined?!![]:![]:!![],'where':_0x31ee60[_0x7bf5('0x9')]?_0x31ee60[_0x7bf5('0x9')][_0x7bf5('0xb')]||null:null,'attributes':[[db[_0x7bf5('0x26')]['fn'](_0x7bf5('0x3a'),db[_0x7bf5('0x26')]['fn']('IF',db[_0x7bf5('0x26')]['literal'](_0x7bf5('0x3b')+util[_0x7bf5('0x3c')](_0x7bf5('0x3d'),moment()[_0x7bf5('0x3c')](_0x7bf5('0x3e')))+_0x7bf5('0x3f')))),'contactsRescheduled']]})[_0x7bf5('0x11')](function(_0x49158f){logger['info'](_0x7bf5('0x39'),_0x31ee60);logger[_0x7bf5('0x13')]('CountReScheduled',_0x31ee60,JSON[_0x7bf5('0x18')](_0x49158f));_0x49b4d5(_0x49158f);})[_0x7bf5('0x1c')](function(_0xd5ead5){logger[_0x7bf5('0x14')](_0x7bf5('0x39'),_0xd5ead5[_0x7bf5('0x15')],_0x31ee60);_0x4aceec(_0x436835[_0x7bf5('0x14')](0x1f4,_0xd5ead5[_0x7bf5('0x15')]));});});};exports[_0x7bf5('0x40')]=function(_0x4b75ae){var _0x134718=this;return new Promise(function(_0x1a77dc,_0x389074){return db[_0x7bf5('0x24')][_0x7bf5('0x25')]()[_0x7bf5('0x11')](function(){return db[_0x7bf5('0x26')][_0x7bf5('0x27')](function(_0xf18726){return db['CmHopper'][_0x7bf5('0x8')]({'where':_0x4b75ae[_0x7bf5('0x9')]?_0x4b75ae[_0x7bf5('0x9')][_0x7bf5('0xb')]||null:null,'attributes':_0x4b75ae['options']?_0x4b75ae['options'][_0x7bf5('0xc')]||null:null,'limit':0x1,'order':_0x4b75ae['options']?_0x4b75ae['options']['order']||null:null,'group':db[_0x7bf5('0x7')][_0x7bf5('0x31')],'transaction':_0xf18726,'lock':_0xf18726[_0x7bf5('0x29')][_0x7bf5('0x2a')],'include':_0x4b75ae[_0x7bf5('0x9')]?_0x4b75ae[_0x7bf5('0x9')][_0x7bf5('0xe')]?_[_0x7bf5('0xf')](_0x4b75ae[_0x7bf5('0x9')]['include'],function(_0x548de8){return{'model':db[_0x548de8[_0x7bf5('0x10')]],'as':_0x548de8['as'],'attributes':_0x548de8['attributes'],'include':_0x548de8[_0x7bf5('0xe')]?_['map'](_0x548de8[_0x7bf5('0xe')],function(_0x818cd8){return{'model':db[_0x818cd8[_0x7bf5('0x10')]],'as':_0x818cd8['as'],'attributes':_0x818cd8[_0x7bf5('0xc')],'include':_0x818cd8['include']?_[_0x7bf5('0xf')](_0x818cd8[_0x7bf5('0xe')],function(_0x585385){return{'model':db[_0x585385[_0x7bf5('0x10')]],'as':_0x585385['as'],'attributes':_0x585385[_0x7bf5('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d63c0){var _0x56f334=[];for(var _0x10ce2a=0x0;_0x10ce2a<_0x2d63c0['length'];_0x10ce2a+=0x1){_0x56f334[_0x7bf5('0x32')](_0x2d63c0[_0x10ce2a][_0x7bf5('0x1e')](_0x4b75ae['body'],{'transaction':_0xf18726}));}return BPromise[_0x7bf5('0x34')](_0x56f334);});})['then'](function(_0x255e60){logger[_0x7bf5('0x12')](_0x7bf5('0x40'),_0x4b75ae);logger[_0x7bf5('0x13')](_0x7bf5('0x40'),_0x4b75ae,JSON[_0x7bf5('0x18')](_0x255e60));_0x1a77dc(_0x255e60);})['catch'](function(_0x21d717){logger['error'](_0x7bf5('0x40'),_0x21d717[_0x7bf5('0x15')],_0x4b75ae);_0x389074(_0x134718[_0x7bf5('0x14')](0x1f4,_0x21d717[_0x7bf5('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x4f22bc){var _0x1af1da=this;return new Promise(function(_0x2b3a90,_0x50ac43){db[_0x7bf5('0x24')]['describe']()[_0x7bf5('0x11')](function(_0xa45539){return db[_0x7bf5('0x7')]['findAll']({'raw':_0x4f22bc[_0x7bf5('0x9')]?_0x4f22bc['options'][_0x7bf5('0xa')]===undefined?!![]:![]:!![],'where':_0x4f22bc[_0x7bf5('0x9')]?_0x4f22bc[_0x7bf5('0x9')][_0x7bf5('0xb')]||null:null,'attributes':_0x4f22bc[_0x7bf5('0x9')]?_0x4f22bc[_0x7bf5('0x9')]['attributes']||null:null,'limit':_0x4f22bc['options']?_0x4f22bc['options'][_0x7bf5('0xd')]||null:null,'include':_0x4f22bc[_0x7bf5('0x9')]?_0x4f22bc[_0x7bf5('0x9')][_0x7bf5('0xe')]?_[_0x7bf5('0xf')](_0x4f22bc[_0x7bf5('0x9')]['include'],function(_0x439f87){return{'model':db[_0x439f87[_0x7bf5('0x10')]],'as':_0x439f87['as'],'attributes':_0x439f87['as']===_0x7bf5('0x2b')?_[_0x7bf5('0x2c')](_0xa45539):_0x439f87[_0x7bf5('0xc')],'include':_0x439f87['include']?_[_0x7bf5('0xf')](_0x439f87['include'],function(_0x3d0cbb){return{'model':db[_0x3d0cbb[_0x7bf5('0x10')]],'as':_0x3d0cbb['as'],'attributes':_0x3d0cbb['attributes'],'include':_0x3d0cbb[_0x7bf5('0xe')]?_[_0x7bf5('0xf')](_0x3d0cbb[_0x7bf5('0xe')],function(_0x2744da){return{'model':db[_0x2744da[_0x7bf5('0x10')]],'as':_0x2744da['as'],'attributes':_0x2744da[_0x7bf5('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcc694d){logger['info']('GetCmHopper',_0x4f22bc);logger[_0x7bf5('0x13')](_0x7bf5('0x6'),_0x4f22bc,JSON['stringify'](_0xcc694d));_0x2b3a90(_0xcc694d);})['catch'](function(_0x5e6cdf){logger['error'](_0x7bf5('0x6'),_0x5e6cdf['message'],_0x4f22bc);_0x50ac43(_0x1af1da['error'](0x1f4,_0x5e6cdf[_0x7bf5('0x15')]));});});});};exports[_0x7bf5('0x41')]=function(_0x3bf1f4){var _0x132b2a=this;return new Promise(function(_0x71260b,_0x1c5fc0){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x3bf1f4[_0x7bf5('0x9')][_0x7bf5('0xb')]['phone']},'attributes':['id',_0x7bf5('0x42')],'order':[['id',_0x7bf5('0x43')]]})['then'](function(_0x544763){logger[_0x7bf5('0x12')](_0x7bf5('0x44'),_0x3bf1f4);logger['debug'](_0x7bf5('0x44'),_0x3bf1f4,JSON['stringify'](_0x544763));_0x71260b(_0x544763);})[_0x7bf5('0x1c')](function(_0x5e6b1f){logger['error'](_0x7bf5('0x44'),_0x5e6b1f[_0x7bf5('0x15')],_0x3bf1f4);_0x1c5fc0(_0x132b2a[_0x7bf5('0x14')](0x1f4,_0x5e6b1f[_0x7bf5('0x15')]));});});};exports[_0x7bf5('0x45')]=function(_0x3f58d3){var _0x715337=this;return new Promise(function(_0x404557,_0x4c422e){return db[_0x7bf5('0x26')]['transaction'](function(_0x5554e0){var _0x362f7e=_0x3f58d3[_0x7bf5('0x9')]&&_0x3f58d3[_0x7bf5('0x9')][_0x7bf5('0xb')]?_0x3f58d3[_0x7bf5('0x9')][_0x7bf5('0xb')]:{};return db[_0x7bf5('0x7')][_0x7bf5('0x1e')](_0x3f58d3[_0x7bf5('0x1b')],{'where':_0x362f7e,'transaction':_0x5554e0})['then'](function(_0x49906f){logger[_0x7bf5('0x12')](_0x7bf5('0x45'),_0x3f58d3);logger[_0x7bf5('0x13')](_0x7bf5('0x45'),_0x3f58d3,JSON[_0x7bf5('0x18')](_0x49906f));_0x404557(_0x49906f);})[_0x7bf5('0x1c')](function(_0x22fbc5){logger[_0x7bf5('0x14')]('ResetActiveCalls',_0x22fbc5[_0x7bf5('0x15')],_0x3f58d3);_0x4c422e(_0x715337['error'](0x1f4,_0x22fbc5['message']));});});});};exports[_0x7bf5('0x46')]=function(_0x1f2529){var _0xea128f=this;var _0xa73a08=_0x1f2529[_0x7bf5('0x1b')]['where'][_0x7bf5('0x47')];var _0x346d3c=_0x1f2529[_0x7bf5('0x1b')][_0x7bf5('0xb')][_0x7bf5('0x48')];var _0x12ffae=_0x1f2529[_0x7bf5('0x1b')][_0x7bf5('0xb')][_0x7bf5('0x49')];return new Promise(function(_0x25b20e,_0x517194){return db[_0x7bf5('0x7')][_0x7bf5('0x8')]({'where':{'voiceQueueId':{'$in':_0xa73a08},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x7bf5('0x4a')](_0x7bf5('0x4b')+_0x346d3c+_0x7bf5('0x4c')),'$gt':db[_0x7bf5('0x26')]['literal']('NOW()')}},'UserId':{'$in':_0x12ffae}},'include':[{'model':db[_0x7bf5('0x24')],'as':_0x7bf5('0x2b')},{'model':db[_0x7bf5('0x2d')],'as':_0x7bf5('0x2e'),'attributes':['id',_0x7bf5('0x4d'),_0x7bf5('0x2f')]},{'model':db[_0x7bf5('0x4e')],'as':_0x7bf5('0x4f')}]})['then'](function(_0x4bdf71){if(_0x4bdf71[_0x7bf5('0x30')]>0x0){return db['sequelize'][_0x7bf5('0x27')](function(_0x4bf894){return db[_0x7bf5('0x7')]['update']({'recallmeNotifiedDate':db[_0x7bf5('0x26')][_0x7bf5('0x4a')]('NOW()')},{'where':{'id':{'$in':_['map'](_0x4bdf71,'id')}},'transaction':_0x4bf894})['then'](function(){_0x25b20e(_0x4bdf71);})['catch'](function(_0x4bcae4){logger[_0x7bf5('0x14')](_0x7bf5('0x46'),_0x4bcae4[_0x7bf5('0x15')],_0x1f2529);_0x517194(_0xea128f[_0x7bf5('0x14')](0x1f4,_0x4bcae4[_0x7bf5('0x15')]));});})[_0x7bf5('0x1c')](function(_0x2c1a7e){logger['error'](_0x7bf5('0x46'),_0x2c1a7e[_0x7bf5('0x15')],_0x1f2529);_0x517194(_0xea128f[_0x7bf5('0x14')](0x1f4,_0x2c1a7e[_0x7bf5('0x15')]));});}else{_0x25b20e(_0x4bdf71);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 3848084..9bed5bb 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 _0x1d72=['./cmHopper.controller','get','isAuthenticated','index','getOpenContacts','/:id','show','post','create','/preview','getPreview','/timezone','put','update','exports','express','Router','../../components/auth/service'];(function(_0x303256,_0x3a33f7){var _0x5f4a3f=function(_0x5bc939){while(--_0x5bc939){_0x303256['push'](_0x303256['shift']());}};_0x5f4a3f(++_0x3a33f7);}(_0x1d72,0x1d1));var _0x21d7=function(_0x5f511b,_0x48cc3e){_0x5f511b=_0x5f511b-0x0;var _0x5def07=_0x1d72[_0x5f511b];return _0x5def07;};'use strict';var express=require(_0x21d7('0x0'));var router=express[_0x21d7('0x1')]();var auth=require(_0x21d7('0x2'));var controller=require(_0x21d7('0x3'));router[_0x21d7('0x4')]('/',auth[_0x21d7('0x5')](),controller[_0x21d7('0x6')]);router[_0x21d7('0x4')]('/describe',auth[_0x21d7('0x5')](),controller['describe']);router[_0x21d7('0x4')]('/opencontacts',auth['isAuthenticated'](),controller[_0x21d7('0x7')]);router[_0x21d7('0x4')]('/timezones',auth[_0x21d7('0x5')](),controller['getTimezones']);router['get'](_0x21d7('0x8'),auth['isAuthenticated'](),controller[_0x21d7('0x9')]);router[_0x21d7('0x4')]('/:id/previewrecall',auth[_0x21d7('0x5')](),controller['getPreviewRecall']);router[_0x21d7('0xa')]('/',auth[_0x21d7('0x5')](),controller[_0x21d7('0xb')]);router[_0x21d7('0xa')](_0x21d7('0xc'),auth[_0x21d7('0x5')](),controller[_0x21d7('0xd')]);router[_0x21d7('0xa')](_0x21d7('0xe'),auth[_0x21d7('0x5')](),controller['getTimezone']);router[_0x21d7('0xf')](_0x21d7('0x8'),auth[_0x21d7('0x5')](),controller[_0x21d7('0x10')]);router['delete'](_0x21d7('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x21d7('0x11')]=router; \ No newline at end of file +var _0xa2c3=['delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','getPreviewRecall','create','/preview','getPreview','post','getTimezone','/:id'];(function(_0x5349cc,_0x56ad31){var _0x43a2e3=function(_0x5cb2e0){while(--_0x5cb2e0){_0x5349cc['push'](_0x5349cc['shift']());}};_0x43a2e3(++_0x56ad31);}(_0xa2c3,0xab));var _0x3a2c=function(_0x308bc6,_0x564ec7){_0x308bc6=_0x308bc6-0x0;var _0x422fcf=_0xa2c3[_0x308bc6];return _0x422fcf;};'use strict';var express=require(_0x3a2c('0x0'));var router=express[_0x3a2c('0x1')]();var auth=require(_0x3a2c('0x2'));var controller=require(_0x3a2c('0x3'));router[_0x3a2c('0x4')]('/',auth[_0x3a2c('0x5')](),controller[_0x3a2c('0x6')]);router[_0x3a2c('0x4')](_0x3a2c('0x7'),auth['isAuthenticated'](),controller[_0x3a2c('0x8')]);router['get'](_0x3a2c('0x9'),auth[_0x3a2c('0x5')](),controller[_0x3a2c('0xa')]);router['get'](_0x3a2c('0xb'),auth['isAuthenticated'](),controller[_0x3a2c('0xc')]);router[_0x3a2c('0x4')]('/:id',auth[_0x3a2c('0x5')](),controller[_0x3a2c('0xd')]);router['get']('/:id/previewrecall',auth[_0x3a2c('0x5')](),controller[_0x3a2c('0xe')]);router['post']('/',auth[_0x3a2c('0x5')](),controller[_0x3a2c('0xf')]);router['post'](_0x3a2c('0x10'),auth['isAuthenticated'](),controller[_0x3a2c('0x11')]);router[_0x3a2c('0x12')]('/timezone',auth[_0x3a2c('0x5')](),controller[_0x3a2c('0x13')]);router['put'](_0x3a2c('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x3a2c('0x15')](_0x3a2c('0x14'),auth[_0x3a2c('0x5')](),controller[_0x3a2c('0x16')]);module[_0x3a2c('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index b7f7b7f..290c583 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe06a=['STRING','format','moment','exports','INTEGER'];(function(_0xb328fb,_0x2c62f2){var _0x1965c3=function(_0x38421a){while(--_0x38421a){_0xb328fb['push'](_0xb328fb['shift']());}};_0x1965c3(++_0x2c62f2);}(_0xe06a,0xde));var _0xae06=function(_0x1c3662,_0x57930c){_0x1c3662=_0x1c3662-0x0;var _0x226c39=_0xe06a[_0x1c3662];return _0x226c39;};'use strict';var moment=require(_0xae06('0x0'));var Sequelize=require('sequelize');module[_0xae06('0x1')]={'CmHopperId':{'type':Sequelize[_0xae06('0x2')]},'phone':{'type':Sequelize[_0xae06('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xae06('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xae06('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xae06('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xae06('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xae06('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xae06('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xae06('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xae06('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa807=['exports','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x558892,_0x5d614b){var _0x10799e=function(_0x1bfae3){while(--_0x1bfae3){_0x558892['push'](_0x558892['shift']());}};_0x10799e(++_0x5d614b);}(_0xa807,0x67));var _0x7a80=function(_0x5e7ebd,_0x311197){_0x5e7ebd=_0x5e7ebd-0x0;var _0x35f6d2=_0xa807[_0x5e7ebd];return _0x35f6d2;};'use strict';var moment=require(_0x7a80('0x0'));var Sequelize=require(_0x7a80('0x1'));module[_0x7a80('0x2')]={'CmHopperId':{'type':Sequelize[_0x7a80('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7a80('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x7a80('0x4')],'defaultValue':moment()[_0x7a80('0x5')](_0x7a80('0x6'))},'countbusyretry':{'type':Sequelize[_0x7a80('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7a80('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x7a80('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7a80('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7a80('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7a80('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 6d09435..9e623e5 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2ad=['pick','filter','merge','VIRTUAL','name','options','CmHopperAdditionalPhone','includeAll','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','then','error','stack','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x295606,_0x357f6d){var _0x5caa4d=function(_0x313416){while(--_0x313416){_0x295606['push'](_0x295606['shift']());}};_0x5caa4d(++_0x357f6d);}(_0xe2ad,0x1c5));var _0xde2a=function(_0x59250f,_0x13a768){_0x59250f=_0x59250f-0x0;var _0x48818d=_0xe2ad[_0x59250f];return _0x48818d;};'use strict';var emlformat=require(_0xde2a('0x0'));var rimraf=require(_0xde2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde2a('0x2'));var rp=require(_0xde2a('0x3'));var moment=require(_0xde2a('0x4'));var BPromise=require(_0xde2a('0x5'));var Mustache=require(_0xde2a('0x6'));var util=require(_0xde2a('0x7'));var path=require('path');var sox=require(_0xde2a('0x8'));var csv=require(_0xde2a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde2a('0xa'));var _=require(_0xde2a('0xb'));var squel=require(_0xde2a('0xc'));var crypto=require(_0xde2a('0xd'));var jsforce=require(_0xde2a('0xe'));var deskjs=require(_0xde2a('0xf'));var toCsv=require(_0xde2a('0x9'));var querystring=require('querystring');var Papa=require(_0xde2a('0x10'));var Redis=require(_0xde2a('0x11'));var authService=require(_0xde2a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde2a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde2a('0x14'))(_0xde2a('0x15'));var utils=require(_0xde2a('0x16'));var config=require(_0xde2a('0x17'));var licenseUtil=require(_0xde2a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x492efe,_0x4e0ba3){_0x4e0ba3=_0x4e0ba3||0xcc;return function(_0x589236){if(_0x589236){return _0x492efe[_0xde2a('0x19')](_0x4e0ba3);}return _0x492efe[_0xde2a('0x1a')](_0x4e0ba3)[_0xde2a('0x1b')]();};}function respondWithResult(_0xb43155,_0x1ed753){_0x1ed753=_0x1ed753||0xc8;return function(_0x27dd7f){if(_0x27dd7f){return _0xb43155[_0xde2a('0x1a')](_0x1ed753)[_0xde2a('0x1c')](_0x27dd7f);}};}function respondWithFilteredResult(_0x25b127,_0x491eb5){return function(_0x3abce8){if(_0x3abce8){var _0x30cb70=typeof _0x491eb5[_0xde2a('0x1d')]==='undefined'&&typeof _0x491eb5[_0xde2a('0x1e')]===_0xde2a('0x1f');var _0x4dc912=_0x3abce8[_0xde2a('0x20')];var _0x4ca675=_0x30cb70?0x0:_0x491eb5['offset'];var _0x45dd2d=_0x30cb70?_0x3abce8[_0xde2a('0x20')]:_0x491eb5['offset']+_0x491eb5[_0xde2a('0x1e')];var _0x50b015;if(_0x45dd2d>=_0x4dc912){_0x45dd2d=_0x4dc912;_0x50b015=0xc8;}else{_0x50b015=0xce;}_0x25b127['status'](_0x50b015);return _0x25b127[_0xde2a('0x21')](_0xde2a('0x22'),_0x4ca675+'-'+_0x45dd2d+'/'+_0x4dc912)[_0xde2a('0x1c')](_0x3abce8);}return null;};}function patchUpdates(_0x28af26){return function(_0x25ee60){try{jsonpatch[_0xde2a('0x23')](_0x25ee60,_0x28af26,!![]);}catch(_0x5d6b9e){return BPromise[_0xde2a('0x24')](_0x5d6b9e);}return _0x25ee60[_0xde2a('0x25')]();};}function saveUpdates(_0x3bd6b6,_0xf05c60){return function(_0x1760b2){if(_0x1760b2){return _0x1760b2['update'](_0x3bd6b6)['then'](function(_0x463f89){return _0x463f89;});}return null;};}function removeEntity(_0x756232,_0x49cbb2){return function(_0x464b07){if(_0x464b07){return _0x464b07[_0xde2a('0x26')]()['then'](function(){var _0x20554f=_0x464b07[_0xde2a('0x27')]({'plain':!![]});var _0x42831e='CmHopperAdditionalPhones';return db[_0xde2a('0x28')][_0xde2a('0x26')]({'where':{'type':_0x42831e,'resourceId':_0x20554f['id']}})[_0xde2a('0x29')](function(){return _0x464b07;});})[_0xde2a('0x29')](function(){_0x756232[_0xde2a('0x1a')](0xcc)[_0xde2a('0x1b')]();});}};}function handleEntityNotFound(_0x2aacc6,_0x5a688a){return function(_0x36aa71){if(!_0x36aa71){_0x2aacc6['sendStatus'](0x194);}return _0x36aa71;};}function handleError(_0x1fe5db,_0x195b5b){_0x195b5b=_0x195b5b||0x1f4;return function(_0x589c2d){logger[_0xde2a('0x2a')](_0x589c2d[_0xde2a('0x2b')]);if(_0x589c2d['name']){delete _0x589c2d['name'];}_0x1fe5db[_0xde2a('0x1a')](_0x195b5b)[_0xde2a('0x2c')](_0x589c2d);};}exports[_0xde2a('0x2d')]=function(_0x49dfac,_0x443614){var _0x33b3fa={},_0x110ca7={},_0x3d5a86={'count':0x0,'rows':[]};var _0x27d940=_[_0xde2a('0x2e')](db['CmHopperAdditionalPhone'][_0xde2a('0x2f')],function(_0x1d4d1b){return{'name':_0x1d4d1b['fieldName'],'type':_0x1d4d1b[_0xde2a('0x30')][_0xde2a('0x31')]};});_0x110ca7[_0xde2a('0x32')]=_[_0xde2a('0x2e')](_0x27d940,'name');_0x110ca7[_0xde2a('0x33')]=_[_0xde2a('0x34')](_0x49dfac[_0xde2a('0x33')]);_0x110ca7[_0xde2a('0x35')]=_[_0xde2a('0x36')](_0x110ca7['model'],_0x110ca7[_0xde2a('0x33')]);_0x33b3fa[_0xde2a('0x37')]=_[_0xde2a('0x36')](_0x110ca7[_0xde2a('0x32')],qs['fields'](_0x49dfac[_0xde2a('0x33')][_0xde2a('0x38')]));_0x33b3fa[_0xde2a('0x37')]=_0x33b3fa[_0xde2a('0x37')][_0xde2a('0x39')]?_0x33b3fa[_0xde2a('0x37')]:_0x110ca7[_0xde2a('0x32')];if(!_0x49dfac['query'][_0xde2a('0x3a')](_0xde2a('0x3b'))){_0x33b3fa[_0xde2a('0x1e')]=qs[_0xde2a('0x1e')](_0x49dfac[_0xde2a('0x33')][_0xde2a('0x1e')]);_0x33b3fa['offset']=qs[_0xde2a('0x1d')](_0x49dfac['query'][_0xde2a('0x1d')]);}_0x33b3fa[_0xde2a('0x3c')]=qs[_0xde2a('0x3d')](_0x49dfac[_0xde2a('0x33')][_0xde2a('0x3d')]);_0x33b3fa[_0xde2a('0x3e')]=qs['filters'](_[_0xde2a('0x3f')](_0x49dfac[_0xde2a('0x33')],_0x110ca7[_0xde2a('0x35')]),_0x27d940);if(_0x49dfac[_0xde2a('0x33')][_0xde2a('0x40')]){_0x33b3fa[_0xde2a('0x3e')]=_[_0xde2a('0x41')](_0x33b3fa['where'],{'$or':_[_0xde2a('0x2e')](_0x27d940,function(_0x50c118){if(_0x50c118['type']!==_0xde2a('0x42')){var _0x481b58={};_0x481b58[_0x50c118[_0xde2a('0x43')]]={'$like':'%'+_0x49dfac[_0xde2a('0x33')][_0xde2a('0x40')]+'%'};return _0x481b58;}})});}_0x33b3fa=_[_0xde2a('0x41')]({},_0x33b3fa,_0x49dfac[_0xde2a('0x44')]);var _0x4bba26={'where':_0x33b3fa[_0xde2a('0x3e')]};return db[_0xde2a('0x45')]['count'](_0x4bba26)['then'](function(_0x4e2f96){_0x3d5a86[_0xde2a('0x20')]=_0x4e2f96;if(_0x49dfac[_0xde2a('0x33')][_0xde2a('0x46')]){_0x33b3fa['include']=[{'all':!![]}];}return db[_0xde2a('0x45')][_0xde2a('0x47')](_0x33b3fa);})['then'](function(_0xff2833){_0x3d5a86[_0xde2a('0x48')]=_0xff2833;return _0x3d5a86;})['then'](respondWithFilteredResult(_0x443614,_0x33b3fa))[_0xde2a('0x49')](handleError(_0x443614,null));};exports[_0xde2a('0x4a')]=function(_0x308de4,_0x1fd998){var _0x231b96={'raw':!![],'where':{'id':_0x308de4[_0xde2a('0x4b')]['id']}},_0x17ba9a={};_0x17ba9a[_0xde2a('0x32')]=_[_0xde2a('0x34')](db[_0xde2a('0x45')][_0xde2a('0x2f')]);_0x17ba9a[_0xde2a('0x33')]=_[_0xde2a('0x34')](_0x308de4[_0xde2a('0x33')]);_0x17ba9a[_0xde2a('0x35')]=_[_0xde2a('0x36')](_0x17ba9a[_0xde2a('0x32')],_0x17ba9a[_0xde2a('0x33')]);_0x231b96[_0xde2a('0x37')]=_['intersection'](_0x17ba9a[_0xde2a('0x32')],qs[_0xde2a('0x38')](_0x308de4[_0xde2a('0x33')][_0xde2a('0x38')]));_0x231b96[_0xde2a('0x37')]=_0x231b96[_0xde2a('0x37')]['length']?_0x231b96[_0xde2a('0x37')]:_0x17ba9a[_0xde2a('0x32')];if(_0x308de4['query'][_0xde2a('0x46')]){_0x231b96['include']=[{'all':!![]}];}_0x231b96=_[_0xde2a('0x41')]({},_0x231b96,_0x308de4['options']);return db[_0xde2a('0x45')][_0xde2a('0x4c')](_0x231b96)[_0xde2a('0x29')](handleEntityNotFound(_0x1fd998,null))['then'](respondWithResult(_0x1fd998,null))[_0xde2a('0x49')](handleError(_0x1fd998,null));};exports[_0xde2a('0x4d')]=function(_0x5ccdef,_0xd82ecd){return db['CmHopperAdditionalPhone']['create'](_0x5ccdef[_0xde2a('0x4e')],{})['then'](function(_0x223ab5){var _0x5c284e=_0x5ccdef[_0xde2a('0x4f')][_0xde2a('0x27')]({'plain':!![]});if(!_0x5c284e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c284e[_0xde2a('0x50')]===_0xde2a('0x4f')){var _0x3cd207=_0x223ab5['get']({'plain':!![]});var _0x4c8f73='CmHopperAdditionalPhones';return db[_0xde2a('0x51')][_0xde2a('0x4c')]({'where':{'name':_0x4c8f73,'userProfileId':_0x5c284e[_0xde2a('0x52')]},'raw':!![]})[_0xde2a('0x29')](function(_0x2db17c){if(_0x2db17c&&_0x2db17c[_0xde2a('0x53')]===0x0){return db[_0xde2a('0x28')][_0xde2a('0x4d')]({'name':_0x3cd207[_0xde2a('0x43')],'resourceId':_0x3cd207['id'],'type':_0x2db17c[_0xde2a('0x43')],'sectionId':_0x2db17c['id']},{})['then'](function(){return _0x223ab5;});}else{return _0x223ab5;}})[_0xde2a('0x49')](function(_0x2ca7c6){logger[_0xde2a('0x2a')](_0xde2a('0x54'),_0x2ca7c6);throw _0x2ca7c6;});}return _0x223ab5;})[_0xde2a('0x29')](respondWithResult(_0xd82ecd,0xc9))[_0xde2a('0x49')](handleError(_0xd82ecd,null));};exports[_0xde2a('0x55')]=function(_0x42d67c,_0x1707ee){if(_0x42d67c[_0xde2a('0x4e')]['id']){delete _0x42d67c[_0xde2a('0x4e')]['id'];}return db[_0xde2a('0x45')][_0xde2a('0x4c')]({'where':{'id':_0x42d67c['params']['id']}})[_0xde2a('0x29')](handleEntityNotFound(_0x1707ee,null))['then'](saveUpdates(_0x42d67c['body'],null))['then'](respondWithResult(_0x1707ee,null))[_0xde2a('0x49')](handleError(_0x1707ee,null));};exports[_0xde2a('0x26')]=function(_0x578e52,_0x256edf){return db[_0xde2a('0x45')][_0xde2a('0x4c')]({'where':{'id':_0x578e52[_0xde2a('0x4b')]['id']}})[_0xde2a('0x29')](handleEntityNotFound(_0x256edf,null))['then'](removeEntity(_0x256edf,null))['catch'](handleError(_0x256edf,null));}; \ No newline at end of file +var _0x632d=['error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','rows','show','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','CmHopperAdditionalPhones','UserProfileResource','then','end'];(function(_0x25244a,_0x4ff907){var _0x4bf1f5=function(_0x144f77){while(--_0x144f77){_0x25244a['push'](_0x25244a['shift']());}};_0x4bf1f5(++_0x4ff907);}(_0x632d,0xd2));var _0xd632=function(_0x552352,_0x51e3b0){_0x552352=_0x552352-0x0;var _0x1e0d71=_0x632d[_0x552352];return _0x1e0d71;};'use strict';var emlformat=require(_0xd632('0x0'));var rimraf=require(_0xd632('0x1'));var zipdir=require(_0xd632('0x2'));var jsonpatch=require(_0xd632('0x3'));var rp=require('request-promise');var moment=require(_0xd632('0x4'));var BPromise=require(_0xd632('0x5'));var Mustache=require(_0xd632('0x6'));var util=require(_0xd632('0x7'));var path=require(_0xd632('0x8'));var sox=require(_0xd632('0x9'));var csv=require(_0xd632('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd632('0xb'));var _=require(_0xd632('0xc'));var squel=require(_0xd632('0xd'));var crypto=require(_0xd632('0xe'));var jsforce=require(_0xd632('0xf'));var deskjs=require(_0xd632('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd632('0x11'));var Redis=require('ioredis');var authService=require(_0xd632('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd632('0x13'));var hardwareService=require(_0xd632('0x14'));var logger=require('../../config/logger')(_0xd632('0x15'));var utils=require('../../config/utils');var config=require(_0xd632('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd632('0x17'))['db'];function respondWithStatusCode(_0xd7f271,_0x170588){_0x170588=_0x170588||0xcc;return function(_0x39f1fb){if(_0x39f1fb){return _0xd7f271[_0xd632('0x18')](_0x170588);}return _0xd7f271[_0xd632('0x19')](_0x170588)['end']();};}function respondWithResult(_0x40726b,_0x4f4a0f){_0x4f4a0f=_0x4f4a0f||0xc8;return function(_0x2318fd){if(_0x2318fd){return _0x40726b[_0xd632('0x19')](_0x4f4a0f)[_0xd632('0x1a')](_0x2318fd);}};}function respondWithFilteredResult(_0x17b17d,_0x1d3af3){return function(_0x3a13c5){if(_0x3a13c5){var _0x16504a=typeof _0x1d3af3[_0xd632('0x1b')]===_0xd632('0x1c')&&typeof _0x1d3af3[_0xd632('0x1d')]===_0xd632('0x1c');var _0x219fb5=_0x3a13c5[_0xd632('0x1e')];var _0x3b1445=_0x16504a?0x0:_0x1d3af3['offset'];var _0xe28506=_0x16504a?_0x3a13c5[_0xd632('0x1e')]:_0x1d3af3[_0xd632('0x1b')]+_0x1d3af3[_0xd632('0x1d')];var _0x39d32f;if(_0xe28506>=_0x219fb5){_0xe28506=_0x219fb5;_0x39d32f=0xc8;}else{_0x39d32f=0xce;}_0x17b17d[_0xd632('0x19')](_0x39d32f);return _0x17b17d[_0xd632('0x1f')](_0xd632('0x20'),_0x3b1445+'-'+_0xe28506+'/'+_0x219fb5)[_0xd632('0x1a')](_0x3a13c5);}return null;};}function patchUpdates(_0x5b6843){return function(_0x3033d6){try{jsonpatch[_0xd632('0x21')](_0x3033d6,_0x5b6843,!![]);}catch(_0x9cfae3){return BPromise[_0xd632('0x22')](_0x9cfae3);}return _0x3033d6[_0xd632('0x23')]();};}function saveUpdates(_0x495d96,_0x3fb550){return function(_0x2fab6b){if(_0x2fab6b){return _0x2fab6b['update'](_0x495d96)['then'](function(_0x328ca1){return _0x328ca1;});}return null;};}function removeEntity(_0x7356c3,_0x627c86){return function(_0x453906){if(_0x453906){return _0x453906[_0xd632('0x24')]()['then'](function(){var _0x32c8a9=_0x453906[_0xd632('0x25')]({'plain':!![]});var _0x4a8549=_0xd632('0x26');return db[_0xd632('0x27')][_0xd632('0x24')]({'where':{'type':_0x4a8549,'resourceId':_0x32c8a9['id']}})[_0xd632('0x28')](function(){return _0x453906;});})[_0xd632('0x28')](function(){_0x7356c3[_0xd632('0x19')](0xcc)[_0xd632('0x29')]();});}};}function handleEntityNotFound(_0x48b37c,_0x26dfd8){return function(_0x113733){if(!_0x113733){_0x48b37c[_0xd632('0x18')](0x194);}return _0x113733;};}function handleError(_0x65e656,_0x2948e5){_0x2948e5=_0x2948e5||0x1f4;return function(_0x1ee48d){logger[_0xd632('0x2a')](_0x1ee48d[_0xd632('0x2b')]);if(_0x1ee48d[_0xd632('0x2c')]){delete _0x1ee48d[_0xd632('0x2c')];}_0x65e656[_0xd632('0x19')](_0x2948e5)[_0xd632('0x2d')](_0x1ee48d);};}exports['index']=function(_0x2c0c91,_0x3b8d7d){var _0x206247={},_0x18aad9={},_0x96a1a3={'count':0x0,'rows':[]};var _0x24d5ba=_[_0xd632('0x2e')](db[_0xd632('0x2f')][_0xd632('0x30')],function(_0x494445){return{'name':_0x494445[_0xd632('0x31')],'type':_0x494445[_0xd632('0x32')][_0xd632('0x33')]};});_0x18aad9[_0xd632('0x34')]=_[_0xd632('0x2e')](_0x24d5ba,_0xd632('0x2c'));_0x18aad9[_0xd632('0x35')]=_[_0xd632('0x36')](_0x2c0c91[_0xd632('0x35')]);_0x18aad9[_0xd632('0x37')]=_[_0xd632('0x38')](_0x18aad9['model'],_0x18aad9[_0xd632('0x35')]);_0x206247[_0xd632('0x39')]=_[_0xd632('0x38')](_0x18aad9[_0xd632('0x34')],qs['fields'](_0x2c0c91[_0xd632('0x35')][_0xd632('0x3a')]));_0x206247[_0xd632('0x39')]=_0x206247[_0xd632('0x39')][_0xd632('0x3b')]?_0x206247['attributes']:_0x18aad9['model'];if(!_0x2c0c91['query'][_0xd632('0x3c')]('nolimit')){_0x206247['limit']=qs['limit'](_0x2c0c91[_0xd632('0x35')]['limit']);_0x206247['offset']=qs['offset'](_0x2c0c91[_0xd632('0x35')][_0xd632('0x1b')]);}_0x206247[_0xd632('0x3d')]=qs[_0xd632('0x3e')](_0x2c0c91[_0xd632('0x35')][_0xd632('0x3e')]);_0x206247[_0xd632('0x3f')]=qs[_0xd632('0x37')](_[_0xd632('0x40')](_0x2c0c91[_0xd632('0x35')],_0x18aad9[_0xd632('0x37')]),_0x24d5ba);if(_0x2c0c91[_0xd632('0x35')][_0xd632('0x41')]){_0x206247[_0xd632('0x3f')]=_['merge'](_0x206247[_0xd632('0x3f')],{'$or':_[_0xd632('0x2e')](_0x24d5ba,function(_0x411395){if(_0x411395['type']!==_0xd632('0x42')){var _0x3ef778={};_0x3ef778[_0x411395[_0xd632('0x2c')]]={'$like':'%'+_0x2c0c91[_0xd632('0x35')][_0xd632('0x41')]+'%'};return _0x3ef778;}})});}_0x206247=_['merge']({},_0x206247,_0x2c0c91[_0xd632('0x43')]);var _0x611dd5={'where':_0x206247[_0xd632('0x3f')]};return db[_0xd632('0x2f')][_0xd632('0x1e')](_0x611dd5)[_0xd632('0x28')](function(_0x45464b){_0x96a1a3[_0xd632('0x1e')]=_0x45464b;if(_0x2c0c91[_0xd632('0x35')][_0xd632('0x44')]){_0x206247['include']=[{'all':!![]}];}return db[_0xd632('0x2f')]['findAll'](_0x206247);})['then'](function(_0x4d4738){_0x96a1a3[_0xd632('0x45')]=_0x4d4738;return _0x96a1a3;})[_0xd632('0x28')](respondWithFilteredResult(_0x3b8d7d,_0x206247))['catch'](handleError(_0x3b8d7d,null));};exports[_0xd632('0x46')]=function(_0x26a4bf,_0x3bf17f){var _0x4727c8={'raw':!![],'where':{'id':_0x26a4bf['params']['id']}},_0x4a0993={};_0x4a0993[_0xd632('0x34')]=_['keys'](db['CmHopperAdditionalPhone'][_0xd632('0x30')]);_0x4a0993[_0xd632('0x35')]=_['keys'](_0x26a4bf[_0xd632('0x35')]);_0x4a0993[_0xd632('0x37')]=_[_0xd632('0x38')](_0x4a0993[_0xd632('0x34')],_0x4a0993[_0xd632('0x35')]);_0x4727c8[_0xd632('0x39')]=_[_0xd632('0x38')](_0x4a0993[_0xd632('0x34')],qs[_0xd632('0x3a')](_0x26a4bf[_0xd632('0x35')][_0xd632('0x3a')]));_0x4727c8['attributes']=_0x4727c8[_0xd632('0x39')][_0xd632('0x3b')]?_0x4727c8[_0xd632('0x39')]:_0x4a0993[_0xd632('0x34')];if(_0x26a4bf[_0xd632('0x35')][_0xd632('0x44')]){_0x4727c8[_0xd632('0x47')]=[{'all':!![]}];}_0x4727c8=_['merge']({},_0x4727c8,_0x26a4bf[_0xd632('0x43')]);return db[_0xd632('0x2f')][_0xd632('0x48')](_0x4727c8)['then'](handleEntityNotFound(_0x3bf17f,null))[_0xd632('0x28')](respondWithResult(_0x3bf17f,null))[_0xd632('0x49')](handleError(_0x3bf17f,null));};exports[_0xd632('0x4a')]=function(_0x16677d,_0x4fde5){return db['CmHopperAdditionalPhone']['create'](_0x16677d[_0xd632('0x4b')],{})[_0xd632('0x28')](function(_0x2d54b9){var _0x43e85c=_0x16677d['user'][_0xd632('0x25')]({'plain':!![]});if(!_0x43e85c)throw new Error(_0xd632('0x4c'));if(_0x43e85c[_0xd632('0x4d')]==='user'){var _0x3fdcc0=_0x2d54b9['get']({'plain':!![]});var _0x32e8a0=_0xd632('0x26');return db[_0xd632('0x4e')][_0xd632('0x48')]({'where':{'name':_0x32e8a0,'userProfileId':_0x43e85c[_0xd632('0x4f')]},'raw':!![]})[_0xd632('0x28')](function(_0x55dee1){if(_0x55dee1&&_0x55dee1[_0xd632('0x50')]===0x0){return db[_0xd632('0x27')][_0xd632('0x4a')]({'name':_0x3fdcc0[_0xd632('0x2c')],'resourceId':_0x3fdcc0['id'],'type':_0x55dee1[_0xd632('0x2c')],'sectionId':_0x55dee1['id']},{})[_0xd632('0x28')](function(){return _0x2d54b9;});}else{return _0x2d54b9;}})['catch'](function(_0x5b8a40){logger[_0xd632('0x2a')](_0xd632('0x51'),_0x5b8a40);throw _0x5b8a40;});}return _0x2d54b9;})[_0xd632('0x28')](respondWithResult(_0x4fde5,0xc9))[_0xd632('0x49')](handleError(_0x4fde5,null));};exports[_0xd632('0x52')]=function(_0x290d1e,_0x167153){if(_0x290d1e['body']['id']){delete _0x290d1e[_0xd632('0x4b')]['id'];}return db[_0xd632('0x2f')][_0xd632('0x48')]({'where':{'id':_0x290d1e[_0xd632('0x53')]['id']}})[_0xd632('0x28')](handleEntityNotFound(_0x167153,null))['then'](saveUpdates(_0x290d1e[_0xd632('0x4b')],null))[_0xd632('0x28')](respondWithResult(_0x167153,null))[_0xd632('0x49')](handleError(_0x167153,null));};exports[_0xd632('0x24')]=function(_0x32ccab,_0x2bf2f9){return db[_0xd632('0x2f')]['find']({'where':{'id':_0x32ccab[_0xd632('0x53')]['id']}})[_0xd632('0x28')](handleEntityNotFound(_0x2bf2f9,null))[_0xd632('0x28')](removeEntity(_0x2bf2f9,null))[_0xd632('0x49')](handleError(_0x2bf2f9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 66de76e..bd440ea 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58cc=['cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x58cc,0xa6));var _0xc58c=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0x58cc[_0x43b08];return _0x5e05f4;};'use strict';var _=require(_0xc58c('0x0'));var util=require(_0xc58c('0x1'));var logger=require(_0xc58c('0x2'))(_0xc58c('0x3'));var moment=require(_0xc58c('0x4'));var BPromise=require(_0xc58c('0x5'));var rp=require(_0xc58c('0x6'));var fs=require('fs');var path=require(_0xc58c('0x7'));var rimraf=require(_0xc58c('0x8'));var config=require(_0xc58c('0x9'));var attributes=require(_0xc58c('0xa'));module[_0xc58c('0xb')]=function(_0x462cb0,_0x57f749){return _0x462cb0[_0xc58c('0xc')](_0xc58c('0xd'),attributes,{'tableName':_0xc58c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66cd=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperAdditionalPhone','lodash'];(function(_0x20c137,_0x4c2afd){var _0x31309b=function(_0x454340){while(--_0x454340){_0x20c137['push'](_0x20c137['shift']());}};_0x31309b(++_0x4c2afd);}(_0x66cd,0xa4));var _0xd66c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x66cd[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xd66c('0x0'));var util=require(_0xd66c('0x1'));var logger=require(_0xd66c('0x2'))(_0xd66c('0x3'));var moment=require('moment');var BPromise=require(_0xd66c('0x4'));var rp=require(_0xd66c('0x5'));var fs=require('fs');var path=require(_0xd66c('0x6'));var rimraf=require(_0xd66c('0x7'));var config=require(_0xd66c('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xd66c('0x9')]=function(_0x43b318,_0x142583){return _0x43b318['define'](_0xd66c('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 99cefa3..f0397ca 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22ca=['countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','CmHopperAdditionalPhone','countnoanswerretry','countmachineretry','dialGlobalMaxRetry','waitTime','isNil','scheduledat','add','minutes','updatedAt','createdAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry'];(function(_0x3e6cc0,_0x415a26){var _0x300aa8=function(_0x5ac62d){while(--_0x5ac62d){_0x3e6cc0['push'](_0x3e6cc0['shift']());}};_0x300aa8(++_0x415a26);}(_0x22ca,0xb1));var _0xa22c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x22ca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa22c('0x0'));var util=require(_0xa22c('0x1'));var moment=require(_0xa22c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa22c('0x3'));var db=require(_0xa22c('0x4'))['db'];var utils=require(_0xa22c('0x5'));var logger=require(_0xa22c('0x6'))(_0xa22c('0x7'));var config=require(_0xa22c('0x8'));var jayson=require(_0xa22c('0x9'));var client=jayson[_0xa22c('0xa')][_0xa22c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b11b8,_0x3e9387,_0x1f2973){return new BPromise(function(_0x4c2af1,_0x3a2908){return client['request'](_0x1b11b8,_0x1f2973)[_0xa22c('0xc')](function(_0x5b7607){logger[_0xa22c('0xd')](_0xa22c('0xe'),_0x3e9387,'request\x20sent');logger[_0xa22c('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x3e9387,_0xa22c('0x10'),JSON[_0xa22c('0x11')](_0x5b7607));if(_0x5b7607[_0xa22c('0x12')]){if(_0x5b7607[_0xa22c('0x12')]['code']===0x1f4){logger['error'](_0xa22c('0xe'),_0x3e9387,_0x5b7607[_0xa22c('0x12')][_0xa22c('0x13')]);return _0x3a2908(_0x5b7607[_0xa22c('0x12')]['message']);}logger[_0xa22c('0x12')](_0xa22c('0xe'),_0x3e9387,_0x5b7607['error']['message']);return _0x4c2af1(_0x5b7607[_0xa22c('0x12')][_0xa22c('0x13')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3e9387,_0xa22c('0x10'));_0x4c2af1(_0x5b7607['result'][_0xa22c('0x13')]);}})[_0xa22c('0x14')](function(_0x529464){logger[_0xa22c('0x12')](_0xa22c('0xe'),_0x3e9387,_0x529464);_0x3a2908(_0x529464);});});}exports[_0xa22c('0x15')]=function(_0x1ca3e1){var _0x1656fb=this;return new Promise(function(_0x29d790,_0x52ca9a){return db[_0xa22c('0x16')][_0xa22c('0x17')]({'raw':!![],'where':{'ContactId':_0x1ca3e1['body']['ContactId'],'ListId':_0x1ca3e1[_0xa22c('0x18')][_0xa22c('0x19')],'VoiceQueueId':_0x1ca3e1[_0xa22c('0x18')][_0xa22c('0x1a')]===undefined?null:_0x1ca3e1[_0xa22c('0x18')][_0xa22c('0x1a')],'CampaignId':_0x1ca3e1[_0xa22c('0x18')][_0xa22c('0x1b')]===undefined?null:_0x1ca3e1['body'][_0xa22c('0x1b')]}})['then'](function(_0x33a53c){if(_0x33a53c!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x33a53c['id'],'OrderBy':{'$gt':_0x33a53c[_0xa22c('0x1c')]}},'order':[[_0xa22c('0x1c'),_0xa22c('0x1d')]]})[_0xa22c('0xc')](function(_0xbe3e3){var _0x4f04ff=0x0;if(_0xbe3e3){if(_0xbe3e3[_0xa22c('0x1e')]+_0xbe3e3[_0xa22c('0x1f')]+_0xbe3e3['countnoanswerretry']+_0xbe3e3[_0xa22c('0x20')]+_0xbe3e3[_0xa22c('0x21')]+_0xbe3e3[_0xa22c('0x22')]+_0xbe3e3['countmachineretry']+_0xbe3e3[_0xa22c('0x23')]<_0x1ca3e1[_0xa22c('0x24')]['dialGlobalMaxRetry'])_0x4f04ff=0x1;_0x29d790({'additional':_0x4f04ff});}else{return db[_0xa22c('0x25')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x33a53c['id']},'order':[[_0xa22c('0x1c'),_0xa22c('0x1d')]]})[_0xa22c('0xc')](function(_0x12d784){var _0x33dfbc=0x0;if(_0x12d784){if(_0x12d784['countbusyretry']+_0x12d784[_0xa22c('0x1f')]+_0x12d784[_0xa22c('0x26')]+_0x12d784['countnosuchnumberretry']+_0x12d784['countdropretry']+_0x12d784['countabandonedretry']+_0x12d784[_0xa22c('0x27')]+_0x12d784[_0xa22c('0x23')]<_0x1ca3e1[_0xa22c('0x24')][_0xa22c('0x28')])_0x33dfbc=0x1;_0x29d790({'additional':_0x33dfbc});}else{_0x29d790({'additional':0x0});}})[_0xa22c('0x14')](function(_0x13af8a){logger[_0xa22c('0x12')](_0xa22c('0x15'),_0x13af8a['message']);_0x52ca9a(_0x1656fb[_0xa22c('0x12')](0x1f4,_0x13af8a[_0xa22c('0x13')]));});}})['catch'](function(_0x39795b){logger[_0xa22c('0x12')](_0xa22c('0x15'),_0x39795b[_0xa22c('0x13')]);_0x52ca9a(_0x1656fb[_0xa22c('0x12')](0x1f4,_0x39795b['message']));});}else _0x29d790({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x3fcd8a){var _0x15b0d2=this;return new Promise(function(_0x856d17,_0x46fa66){return db[_0xa22c('0x16')][_0xa22c('0x17')]({'raw':!![],'where':{'ContactId':_0x3fcd8a[_0xa22c('0x18')]['ContactId'],'ListId':_0x3fcd8a[_0xa22c('0x18')][_0xa22c('0x19')],'VoiceQueueId':_0x3fcd8a[_0xa22c('0x18')][_0xa22c('0x1a')]===undefined?null:_0x3fcd8a['body'][_0xa22c('0x1a')],'CampaignId':_0x3fcd8a[_0xa22c('0x18')]['CampaignId']===undefined?null:_0x3fcd8a[_0xa22c('0x18')][_0xa22c('0x1b')]}})['then'](function(_0x286db0){if(_0x286db0!=null){return db[_0xa22c('0x25')][_0xa22c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x286db0['id'],'OrderBy':{'$gte':_0x286db0[_0xa22c('0x1c')]}},'order':[[_0xa22c('0x1c'),'ASC']]})[_0xa22c('0xc')](function(_0x4ae9dc){if(_0x4ae9dc)return activateAdditionalPhone(_0x286db0,_0x3fcd8a[_0xa22c('0x18')],_0x4ae9dc,_0x3fcd8a['duration'],_0x3fcd8a[_0xa22c('0x29')])[_0xa22c('0xc')](function(_0x420a95){_0x856d17(_0x420a95);});else{return db[_0xa22c('0x25')][_0xa22c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x286db0['id']},'order':[['OrderBy','ASC']]})[_0xa22c('0xc')](function(_0x223e0d){if(_0x223e0d)return activateAdditionalPhone(_0x286db0,_0x3fcd8a[_0xa22c('0x18')],_0x223e0d,_0x3fcd8a['duration'],_0x3fcd8a['waitTime'])[_0xa22c('0xc')](function(_0x35efa5){_0x856d17(_0x35efa5);});else{_0x856d17({'id':_0x286db0['id'],'phone':''});}})['catch'](function(_0xbf7d2a){logger[_0xa22c('0x12')]('VerifyAdditionalPhones',_0xbf7d2a[_0xa22c('0x13')]);_0x46fa66(_0x15b0d2[_0xa22c('0x12')](0x1f4,_0xbf7d2a[_0xa22c('0x13')]));});}})[_0xa22c('0x14')](function(_0x1c3f9d){logger['error'](_0xa22c('0x15'),_0x1c3f9d[_0xa22c('0x13')]);_0x46fa66(_0x15b0d2[_0xa22c('0x12')](0x1f4,_0x1c3f9d[_0xa22c('0x13')]));});}else _0x856d17(0x1);});});};function activateAdditionalPhone(_0x32e41b,_0x57d85d,_0x5e2765,_0x574cb3,_0x16a53a){return new Promise(function(_0x28a9d9,_0x31663d){var _0x2949a3;if(_[_0xa22c('0x2a')](_0x5e2765[_0xa22c('0x2b')])){_0x5e2765['scheduledat']=moment();}if(moment()>moment(_0x5e2765[_0xa22c('0x2b')])){_0x2949a3=moment()[_0xa22c('0x2c')](_0x16a53a||0x3,_0xa22c('0x2d'));}else{if(_0x5e2765[_0xa22c('0x1c')]==0x0){_0x2949a3=moment(_0x5e2765['scheduledat']);}else{_0x2949a3=moment()[_0xa22c('0x2c')](_0x16a53a||0x3,_0xa22c('0x2d'));}}if(_['isNil'](_0x2949a3)){_0x2949a3=moment()['add'](_0x16a53a||0x3,_0xa22c('0x2d'));}var _0x30b62a={'phone':_0x32e41b['phone'],'active':0x0,'OrderBy':_[_0xa22c('0x2a')](_0x32e41b[_0xa22c('0x1c')])?0x0:_0x32e41b['OrderBy'],'scheduledat':moment()[_0xa22c('0x2c')](_0x574cb3||0x1,_0xa22c('0x2d')),'countbusyretry':_0x57d85d[_0xa22c('0x1e')],'countcongestionretry':_0x57d85d[_0xa22c('0x1f')],'countnoanswerretry':_0x57d85d[_0xa22c('0x26')],'countnosuchnumberretry':_0x57d85d[_0xa22c('0x20')],'countdropretry':_0x57d85d[_0xa22c('0x21')],'countabandonedretry':_0x57d85d[_0xa22c('0x22')],'countmachineretry':_0x57d85d[_0xa22c('0x27')],'countagentrejectretry':_0x57d85d[_0xa22c('0x23')],'createdAt':_0x57d85d['createdAt'],'updatedAt':_0x57d85d[_0xa22c('0x2e')]};var _0x11ff8={'CmHopperId':_0x32e41b['id'],'phone':_0x5e2765['phone'],'active':0x0,'OrderBy':_[_0xa22c('0x2a')](_0x5e2765[_0xa22c('0x1c')])?0x0:_0x5e2765['OrderBy'],'scheduledat':_0x2949a3,'countbusyretry':_0x5e2765['countbusyretry'],'countcongestionretry':_0x5e2765['countcongestionretry'],'countnoanswerretry':_0x5e2765[_0xa22c('0x26')],'countnosuchnumberretry':_0x5e2765['countnosuchnumberretry'],'countdropretry':_0x5e2765[_0xa22c('0x21')],'countabandonedretry':_0x5e2765[_0xa22c('0x22')],'countmachineretry':_0x5e2765[_0xa22c('0x27')],'countagentrejectretry':_0x5e2765[_0xa22c('0x23')],'createdAt':_0x5e2765[_0xa22c('0x2f')],'updatedAt':_0x5e2765[_0xa22c('0x2e')]};return db[_0xa22c('0x30')]['transaction'](function(_0x9581b0){return db[_0xa22c('0x25')]['update'](_0x30b62a,{'where':{'id':_0x5e2765['id']}},{'transaction':_0x9581b0})[_0xa22c('0xc')](function(){return db[_0xa22c('0x16')][_0xa22c('0x31')](_0x11ff8,{'where':{'id':_0x32e41b['id']}},{'transaction':_0x9581b0});});})[_0xa22c('0xc')](function(_0x33faa0){_0x28a9d9({'id':_0x32e41b['id'],'phone':_0x5e2765['phone']});})[_0xa22c('0x14')](function(_0x3c16d0){logger['error'](_0xa22c('0x32'),_0x3c16d0[_0xa22c('0x13')]);_0x31663d({'error':_0x3c16d0[_0xa22c('0x13')]});});});}exports[_0xa22c('0x33')]=function(_0x4241f7){var _0x2165e6=this;return new Promise(function(_0x565227,_0x551709){return db['CmHopper'][_0xa22c('0x31')](_0x4241f7[_0xa22c('0x18')]['field'],{'where':{'id':_0x4241f7[_0xa22c('0x18')]['id']}})[_0xa22c('0xc')](function(_0x133eb6){_0x565227(_0x133eb6);})[_0xa22c('0x14')](function(_0x440cb9){logger[_0xa22c('0x12')](_0xa22c('0x33'),_0x440cb9[_0xa22c('0x13')]);_0x551709(_0x2165e6[_0xa22c('0x12')](0x1f4,_0x440cb9[_0xa22c('0x13')]));});});}; \ No newline at end of file +var _0x9165=['message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countdropretry','SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','add','phone','isNil','countbusyretry','countcongestionretry','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s'];(function(_0x13289a,_0x5ad531){var _0x2658a0=function(_0x5c9dfd){while(--_0x5c9dfd){_0x13289a['push'](_0x13289a['shift']());}};_0x2658a0(++_0x5ad531);}(_0x9165,0x17c));var _0x5916=function(_0xe3cbe0,_0x157ff1){_0xe3cbe0=_0xe3cbe0-0x0;var _0x15deb4=_0x9165[_0xe3cbe0];return _0x15deb4;};'use strict';var _=require(_0x5916('0x0'));var util=require('util');var moment=require(_0x5916('0x1'));var BPromise=require(_0x5916('0x2'));var rs=require(_0x5916('0x3'));var fs=require('fs');var Redis=require(_0x5916('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5916('0x5'));var logger=require('../../config/logger')(_0x5916('0x6'));var config=require('../../config/environment');var jayson=require(_0x5916('0x7'));var client=jayson[_0x5916('0x8')][_0x5916('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55ab88,_0xed07fd,_0x1ea4c6){return new BPromise(function(_0x1218b3,_0x1ec3d5){return client[_0x5916('0xa')](_0x55ab88,_0x1ea4c6)[_0x5916('0xb')](function(_0x26768e){logger[_0x5916('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xed07fd,_0x5916('0xd'));logger[_0x5916('0xe')](_0x5916('0xf'),_0xed07fd,'request\x20sent',JSON[_0x5916('0x10')](_0x26768e));if(_0x26768e[_0x5916('0x11')]){if(_0x26768e[_0x5916('0x11')]['code']===0x1f4){logger[_0x5916('0x11')](_0x5916('0x12'),_0xed07fd,_0x26768e[_0x5916('0x11')][_0x5916('0x13')]);return _0x1ec3d5(_0x26768e[_0x5916('0x11')][_0x5916('0x13')]);}logger[_0x5916('0x11')](_0x5916('0x12'),_0xed07fd,_0x26768e[_0x5916('0x11')][_0x5916('0x13')]);return _0x1218b3(_0x26768e['error'][_0x5916('0x13')]);}else{logger[_0x5916('0xc')](_0x5916('0x12'),_0xed07fd,_0x5916('0xd'));_0x1218b3(_0x26768e['result'][_0x5916('0x13')]);}})[_0x5916('0x14')](function(_0x16fc4f){logger[_0x5916('0x11')](_0x5916('0x12'),_0xed07fd,_0x16fc4f);_0x1ec3d5(_0x16fc4f);});});}exports[_0x5916('0x15')]=function(_0x2c3736){var _0xa65dd1=this;return new Promise(function(_0x2cab22,_0x40a7ca){return db[_0x5916('0x16')][_0x5916('0x17')]({'raw':!![],'where':{'ContactId':_0x2c3736[_0x5916('0x18')][_0x5916('0x19')],'ListId':_0x2c3736[_0x5916('0x18')][_0x5916('0x1a')],'VoiceQueueId':_0x2c3736['body']['VoiceQueueId']===undefined?null:_0x2c3736[_0x5916('0x18')][_0x5916('0x1b')],'CampaignId':_0x2c3736['body'][_0x5916('0x1c')]===undefined?null:_0x2c3736[_0x5916('0x18')][_0x5916('0x1c')]}})[_0x5916('0xb')](function(_0x3d8393){if(_0x3d8393!=null){return db[_0x5916('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3d8393['id'],'OrderBy':{'$gt':_0x3d8393[_0x5916('0x1e')]}},'order':[[_0x5916('0x1e'),_0x5916('0x1f')]]})[_0x5916('0xb')](function(_0x3a83da){var _0xcffd6c=0x0;if(_0x3a83da){if(_0x3a83da['countbusyretry']+_0x3a83da['countcongestionretry']+_0x3a83da[_0x5916('0x20')]+_0x3a83da[_0x5916('0x21')]+_0x3a83da['countdropretry']+_0x3a83da[_0x5916('0x22')]+_0x3a83da[_0x5916('0x23')]+_0x3a83da[_0x5916('0x24')]<_0x2c3736[_0x5916('0x25')][_0x5916('0x26')])_0xcffd6c=0x1;_0x2cab22({'additional':_0xcffd6c});}else{return db[_0x5916('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3d8393['id']},'order':[[_0x5916('0x1e'),'ASC']]})['then'](function(_0x57b486){var _0x4ce641=0x0;if(_0x57b486){if(_0x57b486['countbusyretry']+_0x57b486['countcongestionretry']+_0x57b486[_0x5916('0x20')]+_0x57b486[_0x5916('0x21')]+_0x57b486[_0x5916('0x27')]+_0x57b486['countabandonedretry']+_0x57b486[_0x5916('0x23')]+_0x57b486['countagentrejectretry']<_0x2c3736['entity']['dialGlobalMaxRetry'])_0x4ce641=0x1;_0x2cab22({'additional':_0x4ce641});}else{_0x2cab22({'additional':0x0});}})['catch'](function(_0x394f18){logger[_0x5916('0x11')]('VerifyAdditionalPhones',_0x394f18[_0x5916('0x13')]);_0x40a7ca(_0xa65dd1[_0x5916('0x11')](0x1f4,_0x394f18[_0x5916('0x13')]));});}})[_0x5916('0x14')](function(_0x16fc63){logger[_0x5916('0x11')](_0x5916('0x15'),_0x16fc63[_0x5916('0x13')]);_0x40a7ca(_0xa65dd1[_0x5916('0x11')](0x1f4,_0x16fc63[_0x5916('0x13')]));});}else _0x2cab22({'additional':0x0});});});};exports[_0x5916('0x28')]=function(_0x36d9ea){var _0x4a1a84=this;return new Promise(function(_0x320af6,_0x29183b){return db[_0x5916('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x36d9ea['body'][_0x5916('0x19')],'ListId':_0x36d9ea[_0x5916('0x18')][_0x5916('0x1a')],'VoiceQueueId':_0x36d9ea[_0x5916('0x18')][_0x5916('0x1b')]===undefined?null:_0x36d9ea[_0x5916('0x18')][_0x5916('0x1b')],'CampaignId':_0x36d9ea['body'][_0x5916('0x1c')]===undefined?null:_0x36d9ea['body'][_0x5916('0x1c')]}})['then'](function(_0x37cd84){if(_0x37cd84!=null){return db[_0x5916('0x1d')][_0x5916('0x17')]({'raw':!![],'where':{'CmHopperId':_0x37cd84['id'],'OrderBy':{'$gte':_0x37cd84[_0x5916('0x1e')]}},'order':[[_0x5916('0x1e'),_0x5916('0x1f')]]})[_0x5916('0xb')](function(_0x4e9699){if(_0x4e9699)return activateAdditionalPhone(_0x37cd84,_0x36d9ea['body'],_0x4e9699,_0x36d9ea[_0x5916('0x29')],_0x36d9ea[_0x5916('0x2a')])['then'](function(_0x20ccad){_0x320af6(_0x20ccad);});else{return db[_0x5916('0x1d')][_0x5916('0x17')]({'raw':!![],'where':{'CmHopperId':_0x37cd84['id']},'order':[[_0x5916('0x1e'),_0x5916('0x1f')]]})[_0x5916('0xb')](function(_0x49aee0){if(_0x49aee0)return activateAdditionalPhone(_0x37cd84,_0x36d9ea['body'],_0x49aee0,_0x36d9ea['duration'],_0x36d9ea[_0x5916('0x2a')])['then'](function(_0x38bf02){_0x320af6(_0x38bf02);});else{_0x320af6({'id':_0x37cd84['id'],'phone':''});}})['catch'](function(_0x249735){logger['error'](_0x5916('0x15'),_0x249735['message']);_0x29183b(_0x4a1a84[_0x5916('0x11')](0x1f4,_0x249735[_0x5916('0x13')]));});}})[_0x5916('0x14')](function(_0x3a2d0){logger[_0x5916('0x11')]('VerifyAdditionalPhones',_0x3a2d0[_0x5916('0x13')]);_0x29183b(_0x4a1a84[_0x5916('0x11')](0x1f4,_0x3a2d0[_0x5916('0x13')]));});}else _0x320af6(0x1);});});};function activateAdditionalPhone(_0x1e1a34,_0x1f547d,_0x2feb24,_0x377f13,_0x360b85){return new Promise(function(_0x1622f7,_0x5f21ae){var _0xc4630a;if(_['isNil'](_0x2feb24[_0x5916('0x2b')])){_0x2feb24['scheduledat']=moment();}if(moment()>moment(_0x2feb24['scheduledat'])){_0xc4630a=moment()['add'](_0x360b85||0x3,_0x5916('0x2c'));}else{if(_0x2feb24[_0x5916('0x1e')]==0x0){_0xc4630a=moment(_0x2feb24['scheduledat']);}else{_0xc4630a=moment()[_0x5916('0x2d')](_0x360b85||0x3,_0x5916('0x2c'));}}if(_['isNil'](_0xc4630a)){_0xc4630a=moment()[_0x5916('0x2d')](_0x360b85||0x3,'minutes');}var _0x482a44={'phone':_0x1e1a34[_0x5916('0x2e')],'active':0x0,'OrderBy':_[_0x5916('0x2f')](_0x1e1a34[_0x5916('0x1e')])?0x0:_0x1e1a34['OrderBy'],'scheduledat':moment()[_0x5916('0x2d')](_0x377f13||0x1,_0x5916('0x2c')),'countbusyretry':_0x1f547d[_0x5916('0x30')],'countcongestionretry':_0x1f547d[_0x5916('0x31')],'countnoanswerretry':_0x1f547d[_0x5916('0x20')],'countnosuchnumberretry':_0x1f547d[_0x5916('0x21')],'countdropretry':_0x1f547d['countdropretry'],'countabandonedretry':_0x1f547d[_0x5916('0x22')],'countmachineretry':_0x1f547d[_0x5916('0x23')],'countagentrejectretry':_0x1f547d['countagentrejectretry'],'createdAt':_0x1f547d[_0x5916('0x32')],'updatedAt':_0x1f547d[_0x5916('0x33')]};var _0x3f3393={'CmHopperId':_0x1e1a34['id'],'phone':_0x2feb24[_0x5916('0x2e')],'active':0x0,'OrderBy':_[_0x5916('0x2f')](_0x2feb24['OrderBy'])?0x0:_0x2feb24[_0x5916('0x1e')],'scheduledat':_0xc4630a,'countbusyretry':_0x2feb24[_0x5916('0x30')],'countcongestionretry':_0x2feb24[_0x5916('0x31')],'countnoanswerretry':_0x2feb24[_0x5916('0x20')],'countnosuchnumberretry':_0x2feb24['countnosuchnumberretry'],'countdropretry':_0x2feb24['countdropretry'],'countabandonedretry':_0x2feb24['countabandonedretry'],'countmachineretry':_0x2feb24[_0x5916('0x23')],'countagentrejectretry':_0x2feb24[_0x5916('0x24')],'createdAt':_0x2feb24[_0x5916('0x32')],'updatedAt':_0x2feb24[_0x5916('0x33')]};return db[_0x5916('0x34')]['transaction'](function(_0x3154d2){return db[_0x5916('0x1d')][_0x5916('0x35')](_0x482a44,{'where':{'id':_0x2feb24['id']}},{'transaction':_0x3154d2})[_0x5916('0xb')](function(){return db[_0x5916('0x16')][_0x5916('0x35')](_0x3f3393,{'where':{'id':_0x1e1a34['id']}},{'transaction':_0x3154d2});});})[_0x5916('0xb')](function(_0x5f44c0){_0x1622f7({'id':_0x1e1a34['id'],'phone':_0x2feb24['phone']});})['catch'](function(_0x31e629){logger[_0x5916('0x11')](_0x5916('0x36'),_0x31e629['message']);_0x5f21ae({'error':_0x31e629['message']});});});}exports[_0x5916('0x37')]=function(_0x46aa00){var _0x2297c0=this;return new Promise(function(_0x59e276,_0x52a0fb){return db['CmHopper'][_0x5916('0x35')](_0x46aa00[_0x5916('0x18')][_0x5916('0x38')],{'where':{'id':_0x46aa00['body']['id']}})['then'](function(_0x49aaac){_0x59e276(_0x49aaac);})[_0x5916('0x14')](function(_0x5708a4){logger['error'](_0x5916('0x37'),_0x5708a4[_0x5916('0x13')]);_0x52a0fb(_0x2297c0[_0x5916('0x11')](0x1f4,_0x5708a4[_0x5916('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 8c720e0..94a7cf0 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb84=['/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index'];(function(_0x3f89a7,_0x186a6f){var _0x7f7626=function(_0x2f53a2){while(--_0x2f53a2){_0x3f89a7['push'](_0x3f89a7['shift']());}};_0x7f7626(++_0x186a6f);}(_0xbb84,0x158));var _0x4bb8=function(_0x1f75f6,_0x3654e1){_0x1f75f6=_0x1f75f6-0x0;var _0x5c06c1=_0xbb84[_0x1f75f6];return _0x5c06c1;};'use strict';var multer=require(_0x4bb8('0x0'));var util=require(_0x4bb8('0x1'));var path=require(_0x4bb8('0x2'));var timeout=require(_0x4bb8('0x3'));var express=require('express');var router=express[_0x4bb8('0x4')]();var fs_extra=require(_0x4bb8('0x5'));var auth=require(_0x4bb8('0x6'));var interaction=require(_0x4bb8('0x7'));var config=require(_0x4bb8('0x8'));var controller=require(_0x4bb8('0x9'));router[_0x4bb8('0xa')]('/',auth[_0x4bb8('0xb')](),controller[_0x4bb8('0xc')]);router[_0x4bb8('0xa')](_0x4bb8('0xd'),auth[_0x4bb8('0xb')](),controller[_0x4bb8('0xe')]);router[_0x4bb8('0xf')]('/',auth[_0x4bb8('0xb')](),controller[_0x4bb8('0x10')]);router[_0x4bb8('0x11')](_0x4bb8('0xd'),auth[_0x4bb8('0xb')](),controller[_0x4bb8('0x12')]);router['delete'](_0x4bb8('0xd'),auth[_0x4bb8('0xb')](),controller[_0x4bb8('0x13')]);module[_0x4bb8('0x14')]=router; \ No newline at end of file +var _0x1f55=['create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post'];(function(_0x195207,_0x3ad531){var _0x141f91=function(_0x299f44){while(--_0x299f44){_0x195207['push'](_0x195207['shift']());}};_0x141f91(++_0x3ad531);}(_0x1f55,0x136));var _0x51f5=function(_0x3aea19,_0x1e243f){_0x3aea19=_0x3aea19-0x0;var _0x3845eb=_0x1f55[_0x3aea19];return _0x3845eb;};'use strict';var multer=require(_0x51f5('0x0'));var util=require(_0x51f5('0x1'));var path=require('path');var timeout=require(_0x51f5('0x2'));var express=require(_0x51f5('0x3'));var router=express[_0x51f5('0x4')]();var fs_extra=require(_0x51f5('0x5'));var auth=require(_0x51f5('0x6'));var interaction=require(_0x51f5('0x7'));var config=require(_0x51f5('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x51f5('0x9')]('/',auth[_0x51f5('0xa')](),controller[_0x51f5('0xb')]);router[_0x51f5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x51f5('0xc')]('/',auth[_0x51f5('0xa')](),controller[_0x51f5('0xd')]);router[_0x51f5('0xe')](_0x51f5('0xf'),auth[_0x51f5('0xa')](),controller[_0x51f5('0x10')]);router[_0x51f5('0x11')](_0x51f5('0xf'),auth[_0x51f5('0xa')](),controller['destroy']);module[_0x51f5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 9360afa..8643b48 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 _0xe4ce=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x5066c0,_0x3d3ec7){var _0x237475=function(_0x360e0f){while(--_0x360e0f){_0x5066c0['push'](_0x5066c0['shift']());}};_0x237475(++_0x3d3ec7);}(_0xe4ce,0x198));var _0xee4c=function(_0x86b13b,_0x4cce79){_0x86b13b=_0x86b13b-0x0;var _0x25be0f=_0xe4ce[_0x86b13b];return _0x25be0f;};'use strict';var moment=require(_0xee4c('0x0'));var Sequelize=require('sequelize');module[_0xee4c('0x1')]={'phone':{'type':Sequelize[_0xee4c('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xee4c('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xee4c('0x3')],'unique':_0xee4c('0x4')},'VoiceQueueId':{'type':Sequelize[_0xee4c('0x3')],'unique':_0xee4c('0x4')}}; \ No newline at end of file +var _0xfdcd=['STRING','contactListQueue','INTEGER','sequelize','exports'];(function(_0x28111f,_0x254934){var _0x5203e6=function(_0x2c639a){while(--_0x2c639a){_0x28111f['push'](_0x28111f['shift']());}};_0x5203e6(++_0x254934);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfdcd[_0x14add3];return _0x4a174f;};'use strict';var moment=require('moment');var Sequelize=require(_0xdfdc('0x0'));module[_0xdfdc('0x1')]={'phone':{'type':Sequelize[_0xdfdc('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xdfdc('0x3')},'ListId':{'type':Sequelize[_0xdfdc('0x4')],'unique':_0xdfdc('0x3')},'VoiceQueueId':{'type':Sequelize[_0xdfdc('0x4')],'unique':_0xdfdc('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b242ebb..be21f75 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 _0x9f5f=['querystring','papaparse','../../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','apply','update','then','destroy','error','name','send','map','CmHopperBlack','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','find','catch','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x585b75,_0x154856){var _0x412ff3=function(_0xd6a52f){while(--_0xd6a52f){_0x585b75['push'](_0x585b75['shift']());}};_0x412ff3(++_0x154856);}(_0x9f5f,0x197));var _0xf9f5=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x9f5f[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0xf9f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf9f5('0x1'));var jsonpatch=require(_0xf9f5('0x2'));var rp=require(_0xf9f5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf9f5('0x4'));var sox=require(_0xf9f5('0x5'));var csv=require('to-csv');var ejs=require(_0xf9f5('0x6'));var fs=require('fs');var fs_extra=require(_0xf9f5('0x7'));var _=require(_0xf9f5('0x8'));var squel=require(_0xf9f5('0x9'));var crypto=require('crypto');var jsforce=require(_0xf9f5('0xa'));var deskjs=require(_0xf9f5('0xb'));var toCsv=require(_0xf9f5('0xc'));var querystring=require(_0xf9f5('0xd'));var Papa=require(_0xf9f5('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf9f5('0xf'));var as=require(_0xf9f5('0x10'));var hardwareService=require(_0xf9f5('0x11'));var logger=require(_0xf9f5('0x12'))(_0xf9f5('0x13'));var utils=require(_0xf9f5('0x14'));var config=require(_0xf9f5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9f5('0x16'))['db'];function respondWithStatusCode(_0x365c72,_0x20bee0){_0x20bee0=_0x20bee0||0xcc;return function(_0x1a76ea){if(_0x1a76ea){return _0x365c72[_0xf9f5('0x17')](_0x20bee0);}return _0x365c72['status'](_0x20bee0)['end']();};}function respondWithResult(_0x540c96,_0x56d72f){_0x56d72f=_0x56d72f||0xc8;return function(_0x3fbaae){if(_0x3fbaae){return _0x540c96[_0xf9f5('0x18')](_0x56d72f)[_0xf9f5('0x19')](_0x3fbaae);}};}function respondWithFilteredResult(_0x411ee9,_0x26565e){return function(_0x4e017f){if(_0x4e017f){var _0xba90d6=typeof _0x26565e[_0xf9f5('0x1a')]===_0xf9f5('0x1b')&&typeof _0x26565e[_0xf9f5('0x1c')]===_0xf9f5('0x1b');var _0x4b812a=_0x4e017f['count'];var _0x1233af=_0xba90d6?0x0:_0x26565e[_0xf9f5('0x1a')];var _0x56ae55=_0xba90d6?_0x4e017f[_0xf9f5('0x1d')]:_0x26565e['offset']+_0x26565e[_0xf9f5('0x1c')];var _0x46e6f1;if(_0x56ae55>=_0x4b812a){_0x56ae55=_0x4b812a;_0x46e6f1=0xc8;}else{_0x46e6f1=0xce;}_0x411ee9[_0xf9f5('0x18')](_0x46e6f1);return _0x411ee9[_0xf9f5('0x1e')](_0xf9f5('0x1f'),_0x1233af+'-'+_0x56ae55+'/'+_0x4b812a)[_0xf9f5('0x19')](_0x4e017f);}return null;};}function patchUpdates(_0x1e1f9d){return function(_0x2ad643){try{jsonpatch[_0xf9f5('0x20')](_0x2ad643,_0x1e1f9d,!![]);}catch(_0x2267c4){return BPromise['reject'](_0x2267c4);}return _0x2ad643['save']();};}function saveUpdates(_0x530636,_0x268994){return function(_0x152277){if(_0x152277){return _0x152277[_0xf9f5('0x21')](_0x530636)[_0xf9f5('0x22')](function(_0x194ec3){return _0x194ec3;});}return null;};}function removeEntity(_0x277bc3,_0x5b2c99){return function(_0x14f32d){if(_0x14f32d){return _0x14f32d[_0xf9f5('0x23')]()[_0xf9f5('0x22')](function(){_0x277bc3[_0xf9f5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f9cd2,_0x109d32){return function(_0x7a429){if(!_0x7a429){_0x4f9cd2[_0xf9f5('0x17')](0x194);}return _0x7a429;};}function handleError(_0x245c1c,_0x95b750){_0x95b750=_0x95b750||0x1f4;return function(_0x123d10){logger[_0xf9f5('0x24')](_0x123d10['stack']);if(_0x123d10[_0xf9f5('0x25')]){delete _0x123d10[_0xf9f5('0x25')];}_0x245c1c[_0xf9f5('0x18')](_0x95b750)[_0xf9f5('0x26')](_0x123d10);};}exports['index']=function(_0x330886,_0x5ef848){var _0x4232ae={},_0x47f70d={},_0x55b046={'count':0x0,'rows':[]};var _0xd9cbe2=_[_0xf9f5('0x27')](db[_0xf9f5('0x28')]['rawAttributes'],function(_0x29a868){return{'name':_0x29a868['fieldName'],'type':_0x29a868[_0xf9f5('0x29')][_0xf9f5('0x2a')]};});_0x47f70d[_0xf9f5('0x2b')]=_['map'](_0xd9cbe2,_0xf9f5('0x25'));_0x47f70d[_0xf9f5('0x2c')]=_[_0xf9f5('0x2d')](_0x330886[_0xf9f5('0x2c')]);_0x47f70d[_0xf9f5('0x2e')]=_[_0xf9f5('0x2f')](_0x47f70d[_0xf9f5('0x2b')],_0x47f70d[_0xf9f5('0x2c')]);_0x4232ae['attributes']=_[_0xf9f5('0x2f')](_0x47f70d['model'],qs[_0xf9f5('0x30')](_0x330886['query']['fields']));_0x4232ae[_0xf9f5('0x31')]=_0x4232ae['attributes'][_0xf9f5('0x32')]?_0x4232ae[_0xf9f5('0x31')]:_0x47f70d[_0xf9f5('0x2b')];if(!_0x330886[_0xf9f5('0x2c')][_0xf9f5('0x33')](_0xf9f5('0x34'))){_0x4232ae[_0xf9f5('0x1c')]=qs[_0xf9f5('0x1c')](_0x330886[_0xf9f5('0x2c')]['limit']);_0x4232ae[_0xf9f5('0x1a')]=qs[_0xf9f5('0x1a')](_0x330886[_0xf9f5('0x2c')][_0xf9f5('0x1a')]);}_0x4232ae[_0xf9f5('0x35')]=qs[_0xf9f5('0x36')](_0x330886[_0xf9f5('0x2c')][_0xf9f5('0x36')]);_0x4232ae[_0xf9f5('0x37')]=qs['filters'](_[_0xf9f5('0x38')](_0x330886[_0xf9f5('0x2c')],_0x47f70d[_0xf9f5('0x2e')]),_0xd9cbe2);if(_0x330886['query']['filter']){_0x4232ae[_0xf9f5('0x37')]=_['merge'](_0x4232ae[_0xf9f5('0x37')],{'$or':_[_0xf9f5('0x27')](_0xd9cbe2,function(_0x172ba0){if(_0x172ba0['type']!==_0xf9f5('0x39')){var _0x216b57={};_0x216b57[_0x172ba0['name']]={'$like':'%'+_0x330886[_0xf9f5('0x2c')][_0xf9f5('0x3a')]+'%'};return _0x216b57;}})});}_0x4232ae=_['merge']({},_0x4232ae,_0x330886[_0xf9f5('0x3b')]);var _0x172995={'where':_0x4232ae[_0xf9f5('0x37')]};return db['CmHopperBlack'][_0xf9f5('0x1d')](_0x172995)[_0xf9f5('0x22')](function(_0xc2ae85){_0x55b046[_0xf9f5('0x1d')]=_0xc2ae85;if(_0x330886[_0xf9f5('0x2c')][_0xf9f5('0x3c')]){_0x4232ae[_0xf9f5('0x3d')]=[{'all':!![]}];}return db[_0xf9f5('0x28')]['findAll'](_0x4232ae);})[_0xf9f5('0x22')](function(_0x4d84a5){_0x55b046[_0xf9f5('0x3e')]=_0x4d84a5;return _0x55b046;})[_0xf9f5('0x22')](respondWithFilteredResult(_0x5ef848,_0x4232ae))['catch'](handleError(_0x5ef848,null));};exports[_0xf9f5('0x3f')]=function(_0x2de5c4,_0x4138cc){var _0x52e88c={'raw':!![],'where':{'id':_0x2de5c4[_0xf9f5('0x40')]['id']}},_0x13772b={};_0x13772b[_0xf9f5('0x2b')]=_[_0xf9f5('0x2d')](db[_0xf9f5('0x28')][_0xf9f5('0x41')]);_0x13772b['query']=_[_0xf9f5('0x2d')](_0x2de5c4['query']);_0x13772b[_0xf9f5('0x2e')]=_[_0xf9f5('0x2f')](_0x13772b['model'],_0x13772b[_0xf9f5('0x2c')]);_0x52e88c['attributes']=_[_0xf9f5('0x2f')](_0x13772b[_0xf9f5('0x2b')],qs[_0xf9f5('0x30')](_0x2de5c4[_0xf9f5('0x2c')]['fields']));_0x52e88c[_0xf9f5('0x31')]=_0x52e88c['attributes'][_0xf9f5('0x32')]?_0x52e88c[_0xf9f5('0x31')]:_0x13772b[_0xf9f5('0x2b')];if(_0x2de5c4['query'][_0xf9f5('0x3c')]){_0x52e88c['include']=[{'all':!![]}];}_0x52e88c=_['merge']({},_0x52e88c,_0x2de5c4[_0xf9f5('0x3b')]);return db['CmHopperBlack'][_0xf9f5('0x42')](_0x52e88c)[_0xf9f5('0x22')](handleEntityNotFound(_0x4138cc,null))[_0xf9f5('0x22')](respondWithResult(_0x4138cc,null))[_0xf9f5('0x43')](handleError(_0x4138cc,null));};exports[_0xf9f5('0x21')]=function(_0x232ae7,_0x12c656){if(_0x232ae7[_0xf9f5('0x44')]['id']){delete _0x232ae7[_0xf9f5('0x44')]['id'];}return db[_0xf9f5('0x28')][_0xf9f5('0x42')]({'where':{'id':_0x232ae7[_0xf9f5('0x40')]['id']}})[_0xf9f5('0x22')](handleEntityNotFound(_0x12c656,null))[_0xf9f5('0x22')](saveUpdates(_0x232ae7[_0xf9f5('0x44')],null))[_0xf9f5('0x22')](respondWithResult(_0x12c656,null))[_0xf9f5('0x43')](handleError(_0x12c656,null));};exports['destroy']=function(_0x543f2f,_0x26727c){return db[_0xf9f5('0x28')][_0xf9f5('0x42')]({'where':{'id':_0x543f2f[_0xf9f5('0x40')]['id']}})[_0xf9f5('0x22')](handleEntityNotFound(_0x26727c,null))[_0xf9f5('0x22')](removeEntity(_0x26727c,null))[_0xf9f5('0x43')](handleError(_0x26727c,null));};exports[_0xf9f5('0x45')]=function(_0x1edddc,_0x3d5e55){return db[_0xf9f5('0x28')][_0xf9f5('0x45')]()[_0xf9f5('0x22')](respondWithResult(_0x3d5e55,null))[_0xf9f5('0x43')](handleError(_0x3d5e55,null));}; \ No newline at end of file +var _0x3b43=['limit','count','set','json','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','attributes','model','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','CmHopperBlack','includeAll','findAll','rows','catch','show','params','length','include','find','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x92b9a5,_0x2e8c30){var _0x2596d9=function(_0x39dc2b){while(--_0x39dc2b){_0x92b9a5['push'](_0x92b9a5['shift']());}};_0x2596d9(++_0x2e8c30);}(_0x3b43,0xbd));var _0x33b4=function(_0x49ac60,_0x4ca16e){_0x49ac60=_0x49ac60-0x0;var _0x20c1ff=_0x3b43[_0x49ac60];return _0x20c1ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33b4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33b4('0x1'));var rp=require(_0x33b4('0x2'));var moment=require(_0x33b4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x33b4('0x4'));var util=require('util');var path=require(_0x33b4('0x5'));var sox=require('sox');var csv=require(_0x33b4('0x6'));var ejs=require(_0x33b4('0x7'));var fs=require('fs');var fs_extra=require(_0x33b4('0x8'));var _=require(_0x33b4('0x9'));var squel=require(_0x33b4('0xa'));var crypto=require(_0x33b4('0xb'));var jsforce=require(_0x33b4('0xc'));var deskjs=require(_0x33b4('0xd'));var toCsv=require(_0x33b4('0x6'));var querystring=require(_0x33b4('0xe'));var Papa=require('papaparse');var Redis=require(_0x33b4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x33b4('0x10'));var as=require(_0x33b4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33b4('0x12'))('api');var utils=require(_0x33b4('0x13'));var config=require(_0x33b4('0x14'));var licenseUtil=require(_0x33b4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7329f6,_0x217daf){_0x217daf=_0x217daf||0xcc;return function(_0x4520d1){if(_0x4520d1){return _0x7329f6[_0x33b4('0x16')](_0x217daf);}return _0x7329f6[_0x33b4('0x17')](_0x217daf)[_0x33b4('0x18')]();};}function respondWithResult(_0x3a59fc,_0xeaf18b){_0xeaf18b=_0xeaf18b||0xc8;return function(_0x449f7c){if(_0x449f7c){return _0x3a59fc[_0x33b4('0x17')](_0xeaf18b)['json'](_0x449f7c);}};}function respondWithFilteredResult(_0x2fe2e9,_0x4a6de2){return function(_0x15cf87){if(_0x15cf87){var _0x3effe4=typeof _0x4a6de2[_0x33b4('0x19')]===_0x33b4('0x1a')&&typeof _0x4a6de2[_0x33b4('0x1b')]===_0x33b4('0x1a');var _0x61c1dc=_0x15cf87[_0x33b4('0x1c')];var _0x573d2d=_0x3effe4?0x0:_0x4a6de2[_0x33b4('0x19')];var _0x26492e=_0x3effe4?_0x15cf87[_0x33b4('0x1c')]:_0x4a6de2[_0x33b4('0x19')]+_0x4a6de2[_0x33b4('0x1b')];var _0xb0a742;if(_0x26492e>=_0x61c1dc){_0x26492e=_0x61c1dc;_0xb0a742=0xc8;}else{_0xb0a742=0xce;}_0x2fe2e9[_0x33b4('0x17')](_0xb0a742);return _0x2fe2e9[_0x33b4('0x1d')]('Content-Range',_0x573d2d+'-'+_0x26492e+'/'+_0x61c1dc)[_0x33b4('0x1e')](_0x15cf87);}return null;};}function patchUpdates(_0x436aa7){return function(_0x3877db){try{jsonpatch[_0x33b4('0x1f')](_0x3877db,_0x436aa7,!![]);}catch(_0x54a930){return BPromise[_0x33b4('0x20')](_0x54a930);}return _0x3877db[_0x33b4('0x21')]();};}function saveUpdates(_0x441caa,_0x4bc1dc){return function(_0x419f7c){if(_0x419f7c){return _0x419f7c['update'](_0x441caa)['then'](function(_0x5b1398){return _0x5b1398;});}return null;};}function removeEntity(_0x490bce,_0x20aa06){return function(_0x32d637){if(_0x32d637){return _0x32d637['destroy']()[_0x33b4('0x22')](function(){_0x490bce[_0x33b4('0x17')](0xcc)[_0x33b4('0x18')]();});}};}function handleEntityNotFound(_0x29cbdf,_0x4becfe){return function(_0x2d4888){if(!_0x2d4888){_0x29cbdf[_0x33b4('0x16')](0x194);}return _0x2d4888;};}function handleError(_0x8b35e0,_0x481a2f){_0x481a2f=_0x481a2f||0x1f4;return function(_0xa6f1d3){logger['error'](_0xa6f1d3[_0x33b4('0x23')]);if(_0xa6f1d3[_0x33b4('0x24')]){delete _0xa6f1d3[_0x33b4('0x24')];}_0x8b35e0[_0x33b4('0x17')](_0x481a2f)[_0x33b4('0x25')](_0xa6f1d3);};}exports[_0x33b4('0x26')]=function(_0x34f831,_0x36463d){var _0x4f2869={},_0x22494c={},_0x1ce922={'count':0x0,'rows':[]};var _0x1045fd=_[_0x33b4('0x27')](db['CmHopperBlack'][_0x33b4('0x28')],function(_0xddb903){return{'name':_0xddb903[_0x33b4('0x29')],'type':_0xddb903[_0x33b4('0x2a')][_0x33b4('0x2b')]};});_0x22494c['model']=_[_0x33b4('0x27')](_0x1045fd,_0x33b4('0x24'));_0x22494c['query']=_[_0x33b4('0x2c')](_0x34f831['query']);_0x22494c[_0x33b4('0x2d')]=_[_0x33b4('0x2e')](_0x22494c['model'],_0x22494c['query']);_0x4f2869[_0x33b4('0x2f')]=_[_0x33b4('0x2e')](_0x22494c[_0x33b4('0x30')],qs[_0x33b4('0x31')](_0x34f831[_0x33b4('0x32')][_0x33b4('0x31')]));_0x4f2869[_0x33b4('0x2f')]=_0x4f2869[_0x33b4('0x2f')]['length']?_0x4f2869[_0x33b4('0x2f')]:_0x22494c[_0x33b4('0x30')];if(!_0x34f831[_0x33b4('0x32')][_0x33b4('0x33')](_0x33b4('0x34'))){_0x4f2869[_0x33b4('0x1b')]=qs[_0x33b4('0x1b')](_0x34f831[_0x33b4('0x32')][_0x33b4('0x1b')]);_0x4f2869[_0x33b4('0x19')]=qs[_0x33b4('0x19')](_0x34f831[_0x33b4('0x32')][_0x33b4('0x19')]);}_0x4f2869[_0x33b4('0x35')]=qs[_0x33b4('0x36')](_0x34f831[_0x33b4('0x32')]['sort']);_0x4f2869[_0x33b4('0x37')]=qs[_0x33b4('0x2d')](_[_0x33b4('0x38')](_0x34f831[_0x33b4('0x32')],_0x22494c['filters']),_0x1045fd);if(_0x34f831[_0x33b4('0x32')]['filter']){_0x4f2869['where']=_[_0x33b4('0x39')](_0x4f2869[_0x33b4('0x37')],{'$or':_[_0x33b4('0x27')](_0x1045fd,function(_0x1c7e9c){if(_0x1c7e9c['type']!==_0x33b4('0x3a')){var _0x4e7011={};_0x4e7011[_0x1c7e9c[_0x33b4('0x24')]]={'$like':'%'+_0x34f831['query']['filter']+'%'};return _0x4e7011;}})});}_0x4f2869=_[_0x33b4('0x39')]({},_0x4f2869,_0x34f831[_0x33b4('0x3b')]);var _0x1a4dcb={'where':_0x4f2869['where']};return db[_0x33b4('0x3c')][_0x33b4('0x1c')](_0x1a4dcb)[_0x33b4('0x22')](function(_0x3bb85f){_0x1ce922['count']=_0x3bb85f;if(_0x34f831[_0x33b4('0x32')][_0x33b4('0x3d')]){_0x4f2869['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x33b4('0x3e')](_0x4f2869);})[_0x33b4('0x22')](function(_0x101762){_0x1ce922[_0x33b4('0x3f')]=_0x101762;return _0x1ce922;})['then'](respondWithFilteredResult(_0x36463d,_0x4f2869))[_0x33b4('0x40')](handleError(_0x36463d,null));};exports[_0x33b4('0x41')]=function(_0x41f1e6,_0x11f8ee){var _0x4c3775={'raw':!![],'where':{'id':_0x41f1e6[_0x33b4('0x42')]['id']}},_0x2184bc={};_0x2184bc['model']=_[_0x33b4('0x2c')](db[_0x33b4('0x3c')][_0x33b4('0x28')]);_0x2184bc[_0x33b4('0x32')]=_['keys'](_0x41f1e6['query']);_0x2184bc[_0x33b4('0x2d')]=_[_0x33b4('0x2e')](_0x2184bc[_0x33b4('0x30')],_0x2184bc['query']);_0x4c3775[_0x33b4('0x2f')]=_[_0x33b4('0x2e')](_0x2184bc['model'],qs['fields'](_0x41f1e6[_0x33b4('0x32')][_0x33b4('0x31')]));_0x4c3775[_0x33b4('0x2f')]=_0x4c3775[_0x33b4('0x2f')][_0x33b4('0x43')]?_0x4c3775['attributes']:_0x2184bc[_0x33b4('0x30')];if(_0x41f1e6['query'][_0x33b4('0x3d')]){_0x4c3775[_0x33b4('0x44')]=[{'all':!![]}];}_0x4c3775=_[_0x33b4('0x39')]({},_0x4c3775,_0x41f1e6[_0x33b4('0x3b')]);return db['CmHopperBlack'][_0x33b4('0x45')](_0x4c3775)[_0x33b4('0x22')](handleEntityNotFound(_0x11f8ee,null))['then'](respondWithResult(_0x11f8ee,null))[_0x33b4('0x40')](handleError(_0x11f8ee,null));};exports['update']=function(_0x537826,_0x382670){if(_0x537826[_0x33b4('0x46')]['id']){delete _0x537826[_0x33b4('0x46')]['id'];}return db[_0x33b4('0x3c')][_0x33b4('0x45')]({'where':{'id':_0x537826[_0x33b4('0x42')]['id']}})[_0x33b4('0x22')](handleEntityNotFound(_0x382670,null))[_0x33b4('0x22')](saveUpdates(_0x537826[_0x33b4('0x46')],null))['then'](respondWithResult(_0x382670,null))[_0x33b4('0x40')](handleError(_0x382670,null));};exports['destroy']=function(_0x40dfb6,_0x166e5e){return db[_0x33b4('0x3c')][_0x33b4('0x45')]({'where':{'id':_0x40dfb6['params']['id']}})[_0x33b4('0x22')](handleEntityNotFound(_0x166e5e,null))[_0x33b4('0x22')](removeEntity(_0x166e5e,null))['catch'](handleError(_0x166e5e,null));};exports[_0x33b4('0x47')]=function(_0x518419,_0x45c86a){return db[_0x33b4('0x3c')][_0x33b4('0x47')]()[_0x33b4('0x22')](respondWithResult(_0x45c86a,null))[_0x33b4('0x40')](handleError(_0x45c86a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 39b9a3a..c76b124 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 _0x4c3a=['request-promise','path','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2fe8e1,_0x3552bf){var _0x89bd52=function(_0x357bfc){while(--_0x357bfc){_0x2fe8e1['push'](_0x2fe8e1['shift']());}};_0x89bd52(++_0x3552bf);}(_0x4c3a,0x104));var _0xa4c3=function(_0x239b5a,_0x56199a){_0x239b5a=_0x239b5a-0x0;var _0x5a701c=_0x4c3a[_0x239b5a];return _0x5a701c;};'use strict';var _=require(_0xa4c3('0x0'));var util=require(_0xa4c3('0x1'));var logger=require(_0xa4c3('0x2'))(_0xa4c3('0x3'));var moment=require(_0xa4c3('0x4'));var BPromise=require(_0xa4c3('0x5'));var rp=require(_0xa4c3('0x6'));var fs=require('fs');var path=require(_0xa4c3('0x7'));var rimraf=require(_0xa4c3('0x8'));var config=require(_0xa4c3('0x9'));var attributes=require('./cmHopperBlack.attributes');module[_0xa4c3('0xa')]=function(_0x5db759,_0x1504be){return _0x5db759[_0xa4c3('0xb')](_0xa4c3('0xc'),attributes,{'tableName':_0xa4c3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8d6=['define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xb8d6,0x9d));var _0x6b8d=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xb8d6[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x6b8d('0x0'));var util=require('util');var logger=require(_0x6b8d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6b8d('0x2'));var rp=require(_0x6b8d('0x3'));var fs=require('fs');var path=require(_0x6b8d('0x4'));var rimraf=require(_0x6b8d('0x5'));var config=require(_0x6b8d('0x6'));var attributes=require(_0x6b8d('0x7'));module['exports']=function(_0x5b0251,_0x12837d){return _0x5b0251[_0x6b8d('0x8')](_0x6b8d('0x9'),attributes,{'tableName':_0x6b8d('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 f4948b5..fb307c4 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 _0xf053=['request\x20sent','debug','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','GetCmHopperBlack','CmHopperBlack','options','where','limit','include','map','attributes','model','catch','UpdateCmHopperBlack','update','body','destroy','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf053,0x175));var _0x3f05=function(_0x1cb245,_0xe1867){_0x1cb245=_0x1cb245-0x0;var _0x39626a=_0xf053[_0x1cb245];return _0x39626a;};'use strict';var _=require('lodash');var util=require(_0x3f05('0x0'));var moment=require(_0x3f05('0x1'));var BPromise=require(_0x3f05('0x2'));var rs=require(_0x3f05('0x3'));var fs=require('fs');var Redis=require(_0x3f05('0x4'));var db=require(_0x3f05('0x5'))['db'];var utils=require(_0x3f05('0x6'));var logger=require('../../config/logger')(_0x3f05('0x7'));var config=require(_0x3f05('0x8'));var jayson=require(_0x3f05('0x9'));var client=jayson[_0x3f05('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10c27d,_0x287508,_0x122530){return new BPromise(function(_0x132668,_0x2b7c55){return client['request'](_0x10c27d,_0x122530)[_0x3f05('0xb')](function(_0x110d6d){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x287508,_0x3f05('0xc'));logger[_0x3f05('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x287508,_0x3f05('0xc'),JSON[_0x3f05('0xe')](_0x110d6d));if(_0x110d6d[_0x3f05('0xf')]){if(_0x110d6d[_0x3f05('0xf')][_0x3f05('0x10')]===0x1f4){logger[_0x3f05('0xf')](_0x3f05('0x11'),_0x287508,_0x110d6d[_0x3f05('0xf')][_0x3f05('0x12')]);return _0x2b7c55(_0x110d6d[_0x3f05('0xf')]['message']);}logger[_0x3f05('0xf')](_0x3f05('0x11'),_0x287508,_0x110d6d['error']['message']);return _0x132668(_0x110d6d[_0x3f05('0xf')][_0x3f05('0x12')]);}else{logger[_0x3f05('0x13')](_0x3f05('0x11'),_0x287508,_0x3f05('0xc'));_0x132668(_0x110d6d['result'][_0x3f05('0x12')]);}})['catch'](function(_0x42fcb1){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x287508,_0x42fcb1);_0x2b7c55(_0x42fcb1);});});}exports[_0x3f05('0x14')]=function(_0x351fe4){var _0x101be7=this;return new Promise(function(_0x2f79cf,_0x49f383){return db[_0x3f05('0x15')]['findAll']({'raw':_0x351fe4[_0x3f05('0x16')]?_0x351fe4[_0x3f05('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x351fe4[_0x3f05('0x16')]?_0x351fe4[_0x3f05('0x16')][_0x3f05('0x17')]||null:null,'attributes':_0x351fe4[_0x3f05('0x16')]?_0x351fe4[_0x3f05('0x16')]['attributes']||null:null,'limit':_0x351fe4[_0x3f05('0x16')]?_0x351fe4[_0x3f05('0x16')][_0x3f05('0x18')]||null:null,'include':_0x351fe4[_0x3f05('0x16')]?_0x351fe4[_0x3f05('0x16')][_0x3f05('0x19')]?_[_0x3f05('0x1a')](_0x351fe4[_0x3f05('0x16')][_0x3f05('0x19')],function(_0x3bee2c){return{'model':db[_0x3bee2c['model']],'as':_0x3bee2c['as'],'attributes':_0x3bee2c[_0x3f05('0x1b')],'include':_0x3bee2c['include']?_['map'](_0x3bee2c[_0x3f05('0x19')],function(_0x480ce7){return{'model':db[_0x480ce7[_0x3f05('0x1c')]],'as':_0x480ce7['as'],'attributes':_0x480ce7[_0x3f05('0x1b')],'include':_0x480ce7[_0x3f05('0x19')]?_['map'](_0x480ce7[_0x3f05('0x19')],function(_0x4251cc){return{'model':db[_0x4251cc[_0x3f05('0x1c')]],'as':_0x4251cc['as'],'attributes':_0x4251cc[_0x3f05('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3f05('0xb')](function(_0x1776dd){logger[_0x3f05('0x13')](_0x3f05('0x14'),_0x351fe4);logger[_0x3f05('0xd')]('GetCmHopperBlack',_0x351fe4,JSON[_0x3f05('0xe')](_0x1776dd));_0x2f79cf(_0x1776dd);})[_0x3f05('0x1d')](function(_0xd090d6){logger[_0x3f05('0xf')](_0x3f05('0x14'),_0xd090d6[_0x3f05('0x12')],_0x351fe4);_0x49f383(_0x101be7[_0x3f05('0xf')](0x1f4,_0xd090d6[_0x3f05('0x12')]));});});};exports[_0x3f05('0x1e')]=function(_0x34d180){var _0x5d21c6=this;return new Promise(function(_0x2f48c9,_0x3a5282){return db['CmHopperBlack'][_0x3f05('0x1f')](_0x34d180[_0x3f05('0x20')],{'raw':_0x34d180[_0x3f05('0x16')]?_0x34d180[_0x3f05('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d180['options']?_0x34d180[_0x3f05('0x16')][_0x3f05('0x17')]||null:null,'attributes':_0x34d180[_0x3f05('0x16')]?_0x34d180[_0x3f05('0x16')][_0x3f05('0x1b')]||null:null,'limit':_0x34d180['options']?_0x34d180[_0x3f05('0x16')][_0x3f05('0x18')]||null:null})[_0x3f05('0xb')](function(_0x1ed247){logger['info'](_0x3f05('0x1e'),_0x34d180);logger['debug'](_0x3f05('0x1e'),_0x34d180,JSON[_0x3f05('0xe')](_0x1ed247));_0x2f48c9(_0x1ed247);})[_0x3f05('0x1d')](function(_0x3831ef){logger[_0x3f05('0xf')](_0x3f05('0x1e'),_0x3831ef[_0x3f05('0x12')],_0x34d180);_0x3a5282(_0x5d21c6[_0x3f05('0xf')](0x1f4,_0x3831ef[_0x3f05('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x4c42dc){var _0x215a1d=this;return new Promise(function(_0x2a4ad9,_0x1eb881){return db[_0x3f05('0x15')][_0x3f05('0x21')]({'where':_0x4c42dc[_0x3f05('0x16')]?_0x4c42dc[_0x3f05('0x16')][_0x3f05('0x17')]||null:null})[_0x3f05('0xb')](function(_0x3b4f57){logger[_0x3f05('0x13')]('DestroyCmHopperBlack',_0x4c42dc);logger['debug'](_0x3f05('0x22'),_0x4c42dc,JSON[_0x3f05('0xe')](_0x3b4f57));_0x2a4ad9(_0x3b4f57);})[_0x3f05('0x1d')](function(_0x38ebb5){logger[_0x3f05('0xf')](_0x3f05('0x22'),_0x38ebb5[_0x3f05('0x12')],_0x4c42dc);_0x1eb881(_0x215a1d[_0x3f05('0xf')](0x1f4,_0x38ebb5[_0x3f05('0x12')]));});});}; \ No newline at end of file +var _0xa3b6=['update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','CmHopperBlack','findAll','raw','options','where','attributes','limit','include','model','GetCmHopperBlack'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa3b6,0x152));var _0x6a3b=function(_0x26308b,_0x3a22f7){_0x26308b=_0x26308b-0x0;var _0x351645=_0xa3b6[_0x26308b];return _0x351645;};'use strict';var _=require('lodash');var util=require(_0x6a3b('0x0'));var moment=require(_0x6a3b('0x1'));var BPromise=require(_0x6a3b('0x2'));var rs=require(_0x6a3b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a3b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6a3b('0x5'));var config=require(_0x6a3b('0x6'));var jayson=require(_0x6a3b('0x7'));var client=jayson[_0x6a3b('0x8')][_0x6a3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x284db0,_0x163664,_0xcd81cc){return new BPromise(function(_0xbe0d22,_0x2972f0){return client['request'](_0x284db0,_0xcd81cc)[_0x6a3b('0xa')](function(_0x5081d8){logger[_0x6a3b('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x163664,_0x6a3b('0xc'));logger[_0x6a3b('0xd')](_0x6a3b('0xe'),_0x163664,'request\x20sent',JSON[_0x6a3b('0xf')](_0x5081d8));if(_0x5081d8['error']){if(_0x5081d8[_0x6a3b('0x10')][_0x6a3b('0x11')]===0x1f4){logger['error'](_0x6a3b('0x12'),_0x163664,_0x5081d8[_0x6a3b('0x10')][_0x6a3b('0x13')]);return _0x2972f0(_0x5081d8[_0x6a3b('0x10')][_0x6a3b('0x13')]);}logger[_0x6a3b('0x10')](_0x6a3b('0x12'),_0x163664,_0x5081d8['error'][_0x6a3b('0x13')]);return _0xbe0d22(_0x5081d8[_0x6a3b('0x10')][_0x6a3b('0x13')]);}else{logger[_0x6a3b('0xb')](_0x6a3b('0x12'),_0x163664,_0x6a3b('0xc'));_0xbe0d22(_0x5081d8[_0x6a3b('0x14')][_0x6a3b('0x13')]);}})[_0x6a3b('0x15')](function(_0x1fb790){logger[_0x6a3b('0x10')](_0x6a3b('0x12'),_0x163664,_0x1fb790);_0x2972f0(_0x1fb790);});});}exports['GetCmHopperBlack']=function(_0x349f47){var _0x33aa67=this;return new Promise(function(_0x4a4f8b,_0x461f34){return db[_0x6a3b('0x16')][_0x6a3b('0x17')]({'raw':_0x349f47['options']?_0x349f47['options'][_0x6a3b('0x18')]===undefined?!![]:![]:!![],'where':_0x349f47[_0x6a3b('0x19')]?_0x349f47[_0x6a3b('0x19')][_0x6a3b('0x1a')]||null:null,'attributes':_0x349f47[_0x6a3b('0x19')]?_0x349f47['options'][_0x6a3b('0x1b')]||null:null,'limit':_0x349f47[_0x6a3b('0x19')]?_0x349f47[_0x6a3b('0x19')][_0x6a3b('0x1c')]||null:null,'include':_0x349f47[_0x6a3b('0x19')]?_0x349f47['options'][_0x6a3b('0x1d')]?_['map'](_0x349f47['options'][_0x6a3b('0x1d')],function(_0x2ed820){return{'model':db[_0x2ed820[_0x6a3b('0x1e')]],'as':_0x2ed820['as'],'attributes':_0x2ed820['attributes'],'include':_0x2ed820[_0x6a3b('0x1d')]?_['map'](_0x2ed820[_0x6a3b('0x1d')],function(_0x441955){return{'model':db[_0x441955[_0x6a3b('0x1e')]],'as':_0x441955['as'],'attributes':_0x441955['attributes'],'include':_0x441955[_0x6a3b('0x1d')]?_['map'](_0x441955[_0x6a3b('0x1d')],function(_0x567bd8){return{'model':db[_0x567bd8[_0x6a3b('0x1e')]],'as':_0x567bd8['as'],'attributes':_0x567bd8[_0x6a3b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6a3b('0xa')](function(_0x114f78){logger[_0x6a3b('0xb')](_0x6a3b('0x1f'),_0x349f47);logger[_0x6a3b('0xd')](_0x6a3b('0x1f'),_0x349f47,JSON[_0x6a3b('0xf')](_0x114f78));_0x4a4f8b(_0x114f78);})[_0x6a3b('0x15')](function(_0x353073){logger['error']('GetCmHopperBlack',_0x353073[_0x6a3b('0x13')],_0x349f47);_0x461f34(_0x33aa67[_0x6a3b('0x10')](0x1f4,_0x353073['message']));});});};exports['UpdateCmHopperBlack']=function(_0x967aba){var _0x29de30=this;return new Promise(function(_0x38796d,_0x41cb54){return db[_0x6a3b('0x16')][_0x6a3b('0x20')](_0x967aba[_0x6a3b('0x21')],{'raw':_0x967aba[_0x6a3b('0x19')]?_0x967aba[_0x6a3b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x967aba['options']?_0x967aba[_0x6a3b('0x19')]['where']||null:null,'attributes':_0x967aba[_0x6a3b('0x19')]?_0x967aba[_0x6a3b('0x19')][_0x6a3b('0x1b')]||null:null,'limit':_0x967aba['options']?_0x967aba[_0x6a3b('0x19')][_0x6a3b('0x1c')]||null:null})[_0x6a3b('0xa')](function(_0x4a2040){logger[_0x6a3b('0xb')](_0x6a3b('0x22'),_0x967aba);logger[_0x6a3b('0xd')](_0x6a3b('0x22'),_0x967aba,JSON['stringify'](_0x4a2040));_0x38796d(_0x4a2040);})['catch'](function(_0x206494){logger[_0x6a3b('0x10')]('UpdateCmHopperBlack',_0x206494[_0x6a3b('0x13')],_0x967aba);_0x41cb54(_0x29de30[_0x6a3b('0x10')](0x1f4,_0x206494[_0x6a3b('0x13')]));});});};exports[_0x6a3b('0x23')]=function(_0xe92d20){var _0x2acd18=this;return new Promise(function(_0x2149b0,_0x706dcd){return db[_0x6a3b('0x16')][_0x6a3b('0x24')]({'where':_0xe92d20[_0x6a3b('0x19')]?_0xe92d20['options']['where']||null:null})[_0x6a3b('0xa')](function(_0x15b148){logger[_0x6a3b('0xb')](_0x6a3b('0x23'),_0xe92d20);logger['debug'](_0x6a3b('0x23'),_0xe92d20,JSON[_0x6a3b('0xf')](_0x15b148));_0x2149b0(_0x15b148);})[_0x6a3b('0x15')](function(_0x315f1a){logger[_0x6a3b('0x10')](_0x6a3b('0x23'),_0x315f1a[_0x6a3b('0x13')],_0xe92d20);_0x706dcd(_0x2acd18[_0x6a3b('0x10')](0x1f4,_0x315f1a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d27b0ad..3b01507 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 _0x90b1=['index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x469296,_0x5eb183){var _0x2aacaf=function(_0x1f6a9c){while(--_0x1f6a9c){_0x469296['push'](_0x469296['shift']());}};_0x2aacaf(++_0x5eb183);}(_0x90b1,0x1bb));var _0x190b=function(_0x1f707f,_0xb97d26){_0x1f707f=_0x1f707f-0x0;var _0x30368b=_0x90b1[_0x1f707f];return _0x30368b;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x10')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller['destroy']);module[_0x190b('0x11')]=router; \ No newline at end of file +var _0x4819=['show','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','/describe','describe','get','/:id'];(function(_0x1be931,_0x5f2d83){var _0x5b9f0f=function(_0x4ae1d0){while(--_0x4ae1d0){_0x1be931['push'](_0x1be931['shift']());}};_0x5b9f0f(++_0x5f2d83);}(_0x4819,0xcd));var _0x9481=function(_0x5031c1,_0x310436){_0x5031c1=_0x5031c1-0x0;var _0x418bb6=_0x4819[_0x5031c1];return _0x418bb6;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get']('/',auth[_0x9481('0xa')](),controller['index']);router['get'](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);router[_0x9481('0x11')](_0x9481('0xe'),auth[_0x9481('0xa')](),controller[_0x9481('0x12')]);module[_0x9481('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index e6dc718..b9d9ba2 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 _0xd1d1=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x2559d5,_0x416901){var _0x40c2e9=function(_0x379f37){while(--_0x379f37){_0x2559d5['push'](_0x2559d5['shift']());}};_0x40c2e9(++_0x416901);}(_0xd1d1,0x1f4));var _0x1d1d=function(_0x56506a,_0xd761ab){_0x56506a=_0x56506a-0x0;var _0x3eaaf9=_0xd1d1[_0x56506a];return _0x3eaaf9;};'use strict';var Sequelize=require(_0x1d1d('0x0'));var moment=require(_0x1d1d('0x1'));module[_0x1d1d('0x2')]={'state':{'type':Sequelize[_0x1d1d('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x1d1d('0x4')]},'scheduledat':{'type':Sequelize[_0x1d1d('0x5')]},'countbusyretry':{'type':Sequelize[_0x1d1d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1d1d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1d1d('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1d1d('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x1d1d('0x4')]},'originatecalleridname':{'type':Sequelize[_0x1d1d('0x4')]},'calleridnum':{'type':Sequelize[_0x1d1d('0x4')]},'calleridname':{'type':Sequelize[_0x1d1d('0x4')]},'starttime':{'type':Sequelize[_0x1d1d('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x1d1d('0x5')]},'endtime':{'type':Sequelize[_0x1d1d('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1d1d('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1d1d('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1d1d('0x4')]},'campaign':{'type':Sequelize[_0x1d1d('0x4')]},'campaigntype':{'type':Sequelize[_0x1d1d('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x1d1d('0x4')]},'disposition':{'type':Sequelize[_0x1d1d('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x1d1d('0x5')],'set':function(_0x1075b2){var _0x1c23fa=this[_0x1d1d('0x6')](_0x1d1d('0x7'));if(_0x1c23fa&&_0x1075b2){this[_0x1d1d('0x8')](_0x1d1d('0x9'),moment(_0x1075b2)['diff'](moment(_0x1c23fa),_0x1d1d('0xa')));}}},'amd':{'type':Sequelize[_0x1d1d('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1d1d('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1d1d('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1d1d('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1d1d('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1d1d('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1d1d('0x5')]},'recallme':{'type':Sequelize[_0x1d1d('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1d1d('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x1d1d('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1d1d('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1d1d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1d1d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc2d5=['diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x4243d9,_0x7a32bd){var _0x1bab30=function(_0xba16f2){while(--_0xba16f2){_0x4243d9['push'](_0x4243d9['shift']());}};_0x1bab30(++_0x7a32bd);}(_0xc2d5,0x1f1));var _0x5c2d=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xc2d5[_0x1f1a97];return _0x29fc6a;};'use strict';var Sequelize=require(_0x5c2d('0x0'));var moment=require(_0x5c2d('0x1'));module[_0x5c2d('0x2')]={'state':{'type':Sequelize[_0x5c2d('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x5c2d('0x4')]},'scheduledat':{'type':Sequelize[_0x5c2d('0x5')]},'countbusyretry':{'type':Sequelize[_0x5c2d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5c2d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5c2d('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5c2d('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5c2d('0x5')]},'responsetime':{'type':Sequelize[_0x5c2d('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x5c2d('0x5')]},'endtime':{'type':Sequelize[_0x5c2d('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5c2d('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5c2d('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5c2d('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5c2d('0x4')]},'campaign':{'type':Sequelize[_0x5c2d('0x4')]},'campaigntype':{'type':Sequelize[_0x5c2d('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5c2d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5c2d('0x4')]},'dispositionat':{'type':Sequelize[_0x5c2d('0x5')],'set':function(_0xa65d07){var _0x3ee0ba=this[_0x5c2d('0x6')](_0x5c2d('0x7'));if(_0x3ee0ba&&_0xa65d07){this[_0x5c2d('0x8')](_0x5c2d('0x9'),moment(_0xa65d07)[_0x5c2d('0xa')](moment(_0x3ee0ba),_0x5c2d('0xb')));}}},'amd':{'type':Sequelize[_0x5c2d('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5c2d('0x5')]},'callback':{'type':Sequelize[_0x5c2d('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5c2d('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5c2d('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5c2d('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x5c2d('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x5c2d('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5c2d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5c2d('0x3')],'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 fc7259f..ff52f6f 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(_0x48bb02,_0x317b45){var _0xcd1b63=function(_0xc18de4){while(--_0xc18de4){_0x48bb02['push'](_0x48bb02['shift']());}};_0xcd1b63(++_0x317b45);}(_0x7c09,0x102));var _0x97c0=function(_0x434fa5,_0x416595){_0x434fa5=_0x434fa5-0x0;var _0x1bb504=_0x7c09[_0x434fa5];return _0x1bb504;};'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 _0xc2c7=['`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','calleridnum','state\x20=\x204','checkContactHopper','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','uniqueid','params','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal'];(function(_0x89a3fc,_0x48349e){var _0x2dfe51=function(_0x50f58c){while(--_0x50f58c){_0x89a3fc['push'](_0x89a3fc['shift']());}};_0x2dfe51(++_0x48349e);}(_0xc2c7,0x134));var _0x7c2c=function(_0x340f7a,_0x519dff){_0x340f7a=_0x340f7a-0x0;var _0xbe84be=_0xc2c7[_0x340f7a];return _0xbe84be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':!![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['CmHopperFinal'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['describe']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['describe']()['then'](respondWithResult(_0x3091bd,null))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x39d5af,_0x2b79d5){if(_0x39d5af['body']['uniqueid']){delete _0x39d5af['body'][_0x7c2c('0x48')];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'uniqueid':_0x39d5af[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x2b79d5,null))['then'](saveUpdates(_0x39d5af[_0x7c2c('0x4a')],null))[_0x7c2c('0x26')](respondWithResult(_0x2b79d5,null))['catch'](handleError(_0x2b79d5,null));};exports[_0x7c2c('0x4b')]=function(_0x56e09d,_0xfba6a7,_0x3806f4){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x56e09d['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x4d')))),_0x7c2c('0x4e')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x7c2c('0x53')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x54')))),'congestionContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x58')))),_0x7c2c('0x59')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7c2c('0x26')](handleEntityNotFound(_0xfba6a7,null))[_0x7c2c('0x26')](respondWithResult(_0xfba6a7,null))[_0x7c2c('0x45')](handleError(_0xfba6a7,null));};exports[_0x7c2c('0x5a')]=function(_0x44602a,_0x1ad537,_0x2d04da){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'CampaignId':_0x44602a['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x7c2c('0x4e')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x5b')))),'busyContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7c2c('0x54')))),_0x7c2c('0x5c')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5d')))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x58')))),'reCallContacts'],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5e')))),_0x7c2c('0x5f')]]})['then'](handleEntityNotFound(_0x1ad537,null))[_0x7c2c('0x26')](respondWithResult(_0x1ad537,null))['catch'](handleError(_0x1ad537,null));};exports[_0x7c2c('0x60')]=function(_0x2b597d,_0x20eb63,_0x56f737){return db[_0x7c2c('0x61')][_0x7c2c('0x47')]({'where':{'id':_0x2b597d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x20eb63,null))['then'](function(_0x158352){var _0x1e711e;if(_0x158352){_0x1e711e=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')](_0x7c2c('0x64'))[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),'ListId',_0x7c2c('0x69'),_0x7c2c('0x6a'),'updatedAt'],squel[_0x7c2c('0x6b')]()['field']('ANY_VALUE(calleridnum)',_0x7c2c('0x66'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),'scheduledAt')[_0x7c2c('0x6c')](_0x7c2c('0x6e'),_0x7c2c('0x68'))['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')](_0x7c2c('0x71'),'VoiceQueueId')[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),_0x7c2c('0x72'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2b597d[_0x7c2c('0x4a')][_0x7c2c('0x77')][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x66'))[_0x7c2c('0x73')](_0x7c2c('0x64'))['where'](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel['select']()[_0x7c2c('0x6c')]('calleridnum')[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')]('state\x20=\x204'))[_0x7c2c('0x7b')](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x1e711e);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x20eb63,null))[_0x7c2c('0x45')](handleError(_0x20eb63,null));};exports[_0x7c2c('0x7c')]=function(_0x2f249d,_0x136226,_0x354236){return db[_0x7c2c('0x7d')][_0x7c2c('0x47')]({'where':{'id':_0x2f249d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x136226,null))[_0x7c2c('0x26')](function(_0xb47bf0){var _0x4d0922;if(_0xb47bf0){_0x4d0922=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')]('cm_hopper')[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),_0x7c2c('0x70'),'CampaignId',_0x7c2c('0x6a'),_0x7c2c('0x72')],squel[_0x7c2c('0x6b')]()['field'](_0x7c2c('0x7e'),_0x7c2c('0x66'))[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x67'))['field'](_0x7c2c('0x6e'),'ContactId')['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')]('ANY_VALUE(CampaignId)',_0x7c2c('0x7f'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),'updatedAt')['from']('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2f249d[_0x7c2c('0x4a')]['state'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()['field']('phone')[_0x7c2c('0x73')](_0x7c2c('0x64'))[_0x7c2c('0x3d')](_0x7c2c('0x80'),_0x2f249d['params']['id'][_0x7c2c('0x78')]()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x81'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')]('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())['where'](_0x7c2c('0x82')))['group'](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x4d0922);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x136226,null))[_0x7c2c('0x45')](handleError(_0x136226,null));};exports[_0x7c2c('0x83')]=function(_0x309051,_0x3f8683,_0x1eeb00){return db[_0x7c2c('0x84')]['findOne']({'where':{'VoiceQueueId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x69')],'CampaignId':_0x309051[_0x7c2c('0x4a')]['CampaignId'],'ContactId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x68')]}})['then'](handleEntityNotFound(_0x3f8683,null))[_0x7c2c('0x26')](function(_0x511158){if(_0x511158){return _0x511158;}return null;})[_0x7c2c('0x26')](respondWithResult(_0x3f8683,null))['catch'](handleError(_0x3f8683,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2cb690d..3365862 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 _0x4862=['../../config/logger','api','moment','path','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x2f23e2,_0x52c4ff){var _0x445472=function(_0x540918){while(--_0x540918){_0x2f23e2['push'](_0x2f23e2['shift']());}};_0x445472(++_0x52c4ff);}(_0x4862,0x1df));var _0x2486=function(_0x2807ab,_0x5dcd85){_0x2807ab=_0x2807ab-0x0;var _0x5507b6=_0x4862[_0x2807ab];return _0x5507b6;};'use strict';var _=require(_0x2486('0x0'));var util=require(_0x2486('0x1'));var logger=require(_0x2486('0x2'))(_0x2486('0x3'));var moment=require(_0x2486('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2486('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2486('0x6'));module[_0x2486('0x7')]=function(_0x4c15b3,_0xb2f1c5){return _0x4c15b3[_0x2486('0x8')](_0x2486('0x9'),attributes,{'tableName':_0x2486('0xa'),'paranoid':![],'indexes':[{'name':_0x2486('0xb'),'fields':[_0x2486('0xb')]},{'name':_0x2486('0xc'),'fields':[_0x2486('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2cf=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x44a2cd,_0xe37a97){var _0x280601=function(_0x1f94be){while(--_0x1f94be){_0x44a2cd['push'](_0x44a2cd['shift']());}};_0x280601(++_0xe37a97);}(_0xc2cf,0x89));var _0xfc2c=function(_0x158f24,_0x44b868){_0x158f24=_0x158f24-0x0;var _0x4a4a46=_0xc2cf[_0x158f24];return _0x4a4a46;};'use strict';var _=require('lodash');var util=require(_0xfc2c('0x0'));var logger=require(_0xfc2c('0x1'))(_0xfc2c('0x2'));var moment=require(_0xfc2c('0x3'));var BPromise=require(_0xfc2c('0x4'));var rp=require(_0xfc2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc2c('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xfc2c('0x7')]=function(_0x581c54,_0x186fd0){return _0x581c54['define'](_0xfc2c('0x8'),attributes,{'tableName':_0xfc2c('0x9'),'paranoid':![],'indexes':[{'name':_0xfc2c('0xa'),'fields':[_0xfc2c('0xa')]},{'name':_0xfc2c('0xb'),'fields':[_0xfc2c('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 7e3b6a1..c8aa647 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x56c5f8,_0x1862e6){var _0x39d57f=function(_0x51b359){while(--_0x51b359){_0x56c5f8['push'](_0x56c5f8['shift']());}};_0x39d57f(++_0x1862e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x54f253,_0x13acb1){_0x54f253=_0x54f253-0x0;var _0x207e8d=_0xb10b[_0x54f253];return _0x207e8d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x2d85b5,_0x21e843){var _0x2306e0=function(_0x1774db){while(--_0x1774db){_0x2d85b5['push'](_0x2d85b5['shift']());}};_0x2306e0(++_0x21e843);}(_0x7a54,0x106));var _0x47a5=function(_0x281fff,_0x3d5250){_0x281fff=_0x281fff-0x0;var _0x14d771=_0x7a54[_0x281fff];return _0x14d771;};'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 549ac63..7980d53 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 _0x54c6=['isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index'];(function(_0x432872,_0x406c37){var _0x299794=function(_0x55229a){while(--_0x55229a){_0x432872['push'](_0x432872['shift']());}};_0x299794(++_0x406c37);}(_0x54c6,0x7b));var _0x654c=function(_0x3b3362,_0x202631){_0x3b3362=_0x3b3362-0x0;var _0x223f5b=_0x54c6[_0x3b3362];return _0x223f5b;};'use strict';var multer=require(_0x654c('0x0'));var util=require(_0x654c('0x1'));var path=require('path');var timeout=require(_0x654c('0x2'));var express=require(_0x654c('0x3'));var router=express[_0x654c('0x4')]();var fs_extra=require(_0x654c('0x5'));var auth=require(_0x654c('0x6'));var interaction=require(_0x654c('0x7'));var config=require(_0x654c('0x8'));var controller=require(_0x654c('0x9'));router[_0x654c('0xa')]('/',auth['isAuthenticated'](),controller[_0x654c('0xb')]);router[_0x654c('0xa')]('/describe',auth[_0x654c('0xc')](),controller['describe']);router[_0x654c('0xa')](_0x654c('0xd'),auth[_0x654c('0xc')](),controller[_0x654c('0xe')]);router[_0x654c('0xa')](_0x654c('0xf'),auth[_0x654c('0xc')](),controller[_0x654c('0x10')]);router[_0x654c('0xa')](_0x654c('0x11'),auth[_0x654c('0xc')](),controller[_0x654c('0x12')]);router['post'](_0x654c('0x13'),auth['isAuthenticated'](),controller[_0x654c('0x14')]);router[_0x654c('0x15')](_0x654c('0x16'),auth['isAuthenticated'](),controller[_0x654c('0x17')]);router['post'](_0x654c('0x18'),auth[_0x654c('0xc')](),controller[_0x654c('0x19')]);router[_0x654c('0x1a')](_0x654c('0xd'),auth[_0x654c('0xc')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x332c=['moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post'];(function(_0x3a1afa,_0x47e034){var _0x21416a=function(_0x49cb8d){while(--_0x49cb8d){_0x3a1afa['push'](_0x3a1afa['shift']());}};_0x21416a(++_0x47e034);}(_0x332c,0x11b));var _0xc332=function(_0x20cdae,_0x2255e4){_0x20cdae=_0x20cdae-0x0;var _0x26d802=_0x332c[_0x20cdae];return _0x26d802;};'use strict';var multer=require(_0xc332('0x0'));var util=require(_0xc332('0x1'));var path=require(_0xc332('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc332('0x3')]();var fs_extra=require(_0xc332('0x4'));var auth=require(_0xc332('0x5'));var interaction=require(_0xc332('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xc332('0x7')]('/',auth[_0xc332('0x8')](),controller['index']);router[_0xc332('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xc332('0x9')]);router[_0xc332('0x7')](_0xc332('0xa'),auth['isAuthenticated'](),controller[_0xc332('0xb')]);router[_0xc332('0x7')](_0xc332('0xc'),auth[_0xc332('0x8')](),controller[_0xc332('0xd')]);router['get']('/campaign/countAttributes/:id',auth[_0xc332('0x8')](),controller[_0xc332('0xe')]);router[_0xc332('0xf')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xc332('0x10')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xc332('0x8')](),controller[_0xc332('0x11')]);router[_0xc332('0xf')](_0xc332('0x12'),auth['isAuthenticated'](),controller[_0xc332('0x13')]);router[_0xc332('0x14')](_0xc332('0xa'),auth[_0xc332('0x8')](),controller[_0xc332('0x15')]);module[_0xc332('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 35039b4..6347a53 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 _0xc81d=['INTEGER','DATE','STRING','BOOLEAN','exports'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0xc81d,0x86));var _0xdc81=function(_0x31fb5a,_0x5d763d){_0x31fb5a=_0x31fb5a-0x0;var _0x3c836c=_0xc81d[_0x31fb5a];return _0x3c836c;};'use strict';var Sequelize=require('sequelize');module[_0xdc81('0x0')]={'state':{'type':Sequelize[_0xdc81('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xdc81('0x2')]},'countbusyretry':{'type':Sequelize[_0xdc81('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdc81('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdc81('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xdc81('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xdc81('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdc81('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdc81('0x2')]},'responsetime':{'type':Sequelize[_0xdc81('0x2')]},'answertime':{'type':Sequelize[_0xdc81('0x2')]},'droptime':{'type':Sequelize[_0xdc81('0x2')]},'endtime':{'type':Sequelize[_0xdc81('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdc81('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xdc81('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xdc81('0x3')]},'campaign':{'type':Sequelize[_0xdc81('0x3')]},'campaigntype':{'type':Sequelize[_0xdc81('0x3')]},'membername':{'type':Sequelize[_0xdc81('0x3')]},'reason':{'type':Sequelize[_0xdc81('0x3')]},'amd':{'type':Sequelize[_0xdc81('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xdc81('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xdc81('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdc81('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdc81('0x2')]},'recallme':{'type':Sequelize[_0xdc81('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xdc81('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xdc81('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdc81('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdc81('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdc81('0x3')]}}; \ No newline at end of file +var _0x41f6=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x10e594,_0x262366){var _0x281166=function(_0x31e60c){while(--_0x31e60c){_0x10e594['push'](_0x10e594['shift']());}};_0x281166(++_0x262366);}(_0x41f6,0x94));var _0x641f=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x41f6[_0x562f3b];return _0x1edd55;};'use strict';var Sequelize=require(_0x641f('0x0'));module['exports']={'state':{'type':Sequelize[_0x641f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x641f('0x2')]},'scheduledat':{'type':Sequelize[_0x641f('0x3')]},'countbusyretry':{'type':Sequelize[_0x641f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x641f('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x641f('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x641f('0x2')]},'originatecalleridname':{'type':Sequelize[_0x641f('0x2')]},'calleridnum':{'type':Sequelize[_0x641f('0x2')]},'calleridname':{'type':Sequelize[_0x641f('0x2')]},'starttime':{'type':Sequelize[_0x641f('0x3')]},'responsetime':{'type':Sequelize[_0x641f('0x3')]},'answertime':{'type':Sequelize[_0x641f('0x3')]},'droptime':{'type':Sequelize[_0x641f('0x3')]},'endtime':{'type':Sequelize[_0x641f('0x3')]},'ringtime':{'type':Sequelize[_0x641f('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x641f('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x641f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x641f('0x2')]},'campaign':{'type':Sequelize[_0x641f('0x2')]},'campaigntype':{'type':Sequelize[_0x641f('0x2')]},'membername':{'type':Sequelize[_0x641f('0x2')]},'reason':{'type':Sequelize[_0x641f('0x2')]},'amd':{'type':Sequelize[_0x641f('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x641f('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x641f('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x641f('0x3')]},'edited':{'type':Sequelize[_0x641f('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x641f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x641f('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x641f('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x641f('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c6646c1..2a011fb 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 _0x7b6a=['includeAll','include','findAll','rows','catch','show','params','find','create','describe','body','uniqueid','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','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x575ed1,_0x36af05){var _0x335dd5=function(_0x2ba21b){while(--_0x2ba21b){_0x575ed1['push'](_0x575ed1['shift']());}};_0x335dd5(++_0x36af05);}(_0x7b6a,0x1d4));var _0xa7b6=function(_0x4fa0c3,_0x54389c){_0x4fa0c3=_0x4fa0c3-0x0;var _0x28156f=_0x7b6a[_0x4fa0c3];return _0x28156f;};'use strict';var emlformat=require(_0xa7b6('0x0'));var rimraf=require(_0xa7b6('0x1'));var zipdir=require(_0xa7b6('0x2'));var jsonpatch=require(_0xa7b6('0x3'));var rp=require(_0xa7b6('0x4'));var moment=require(_0xa7b6('0x5'));var BPromise=require(_0xa7b6('0x6'));var Mustache=require(_0xa7b6('0x7'));var util=require(_0xa7b6('0x8'));var path=require(_0xa7b6('0x9'));var sox=require(_0xa7b6('0xa'));var csv=require(_0xa7b6('0xb'));var ejs=require(_0xa7b6('0xc'));var fs=require('fs');var fs_extra=require(_0xa7b6('0xd'));var _=require(_0xa7b6('0xe'));var squel=require(_0xa7b6('0xf'));var crypto=require(_0xa7b6('0x10'));var jsforce=require(_0xa7b6('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xa7b6('0xb'));var querystring=require('querystring');var Papa=require(_0xa7b6('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa7b6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7b6('0x14'))(_0xa7b6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa7b6('0x16'));var db=require(_0xa7b6('0x17'))['db'];function respondWithStatusCode(_0x27fdea,_0x182c83){_0x182c83=_0x182c83||0xcc;return function(_0xee61fc){if(_0xee61fc){return _0x27fdea[_0xa7b6('0x18')](_0x182c83);}return _0x27fdea[_0xa7b6('0x19')](_0x182c83)[_0xa7b6('0x1a')]();};}function respondWithResult(_0x3be82a,_0x4b85f8){_0x4b85f8=_0x4b85f8||0xc8;return function(_0x182bc1){if(_0x182bc1){return _0x3be82a[_0xa7b6('0x19')](_0x4b85f8)[_0xa7b6('0x1b')](_0x182bc1);}};}function respondWithFilteredResult(_0x24b0e6,_0x191a0a){return function(_0x596836){if(_0x596836){var _0x1169bb=typeof _0x191a0a[_0xa7b6('0x1c')]===_0xa7b6('0x1d')&&typeof _0x191a0a[_0xa7b6('0x1e')]==='undefined';var _0xe41474=_0x596836[_0xa7b6('0x1f')];var _0x41b812=_0x1169bb?0x0:_0x191a0a[_0xa7b6('0x1c')];var _0x2b8e00=_0x1169bb?_0x596836['count']:_0x191a0a[_0xa7b6('0x1c')]+_0x191a0a['limit'];var _0x483c65;if(_0x2b8e00>=_0xe41474){_0x2b8e00=_0xe41474;_0x483c65=0xc8;}else{_0x483c65=0xce;}_0x24b0e6[_0xa7b6('0x19')](_0x483c65);return _0x24b0e6[_0xa7b6('0x20')](_0xa7b6('0x21'),_0x41b812+'-'+_0x2b8e00+'/'+_0xe41474)[_0xa7b6('0x1b')](_0x596836);}return null;};}function patchUpdates(_0x44b6a3){return function(_0x4b8011){try{jsonpatch['apply'](_0x4b8011,_0x44b6a3,!![]);}catch(_0x35c64f){return BPromise[_0xa7b6('0x22')](_0x35c64f);}return _0x4b8011[_0xa7b6('0x23')]();};}function saveUpdates(_0x519fbc,_0x4c146e){return function(_0xd246a4){if(_0xd246a4){return _0xd246a4['update'](_0x519fbc)['then'](function(_0x2a65e2){return _0x2a65e2;});}return null;};}function removeEntity(_0x5912a7,_0x5d2ec6){return function(_0x1245b7){if(_0x1245b7){return _0x1245b7['destroy']()[_0xa7b6('0x24')](function(){_0x5912a7['status'](0xcc)[_0xa7b6('0x1a')]();});}};}function handleEntityNotFound(_0x6f356e,_0x3b2b34){return function(_0x5fa310){if(!_0x5fa310){_0x6f356e[_0xa7b6('0x18')](0x194);}return _0x5fa310;};}function handleError(_0x4068e7,_0x3a1705){_0x3a1705=_0x3a1705||0x1f4;return function(_0x53bec2){logger[_0xa7b6('0x25')](_0x53bec2['stack']);if(_0x53bec2[_0xa7b6('0x26')]){delete _0x53bec2[_0xa7b6('0x26')];}_0x4068e7['status'](_0x3a1705)[_0xa7b6('0x27')](_0x53bec2);};}exports[_0xa7b6('0x28')]=function(_0x5da649,_0xa0706){var _0x1cb21a={},_0x5eabdd={},_0x4a2c3f={'count':0x0,'rows':[]};var _0x5ebb5f=_[_0xa7b6('0x29')](db[_0xa7b6('0x2a')][_0xa7b6('0x2b')],function(_0x37e3b8){return{'name':_0x37e3b8[_0xa7b6('0x2c')],'type':_0x37e3b8[_0xa7b6('0x2d')][_0xa7b6('0x2e')]};});_0x5eabdd[_0xa7b6('0x2f')]=_[_0xa7b6('0x29')](_0x5ebb5f,_0xa7b6('0x26'));_0x5eabdd[_0xa7b6('0x30')]=_[_0xa7b6('0x31')](_0x5da649['query']);_0x5eabdd[_0xa7b6('0x32')]=_[_0xa7b6('0x33')](_0x5eabdd[_0xa7b6('0x2f')],_0x5eabdd[_0xa7b6('0x30')]);_0x1cb21a[_0xa7b6('0x34')]=_['intersection'](_0x5eabdd[_0xa7b6('0x2f')],qs[_0xa7b6('0x35')](_0x5da649['query']['fields']));_0x1cb21a['attributes']=_0x1cb21a[_0xa7b6('0x34')][_0xa7b6('0x36')]?_0x1cb21a[_0xa7b6('0x34')]:_0x5eabdd[_0xa7b6('0x2f')];if(!_0x5da649[_0xa7b6('0x30')][_0xa7b6('0x37')](_0xa7b6('0x38'))){_0x1cb21a['limit']=qs[_0xa7b6('0x1e')](_0x5da649[_0xa7b6('0x30')][_0xa7b6('0x1e')]);_0x1cb21a[_0xa7b6('0x1c')]=qs[_0xa7b6('0x1c')](_0x5da649[_0xa7b6('0x30')][_0xa7b6('0x1c')]);}_0x1cb21a[_0xa7b6('0x39')]=qs[_0xa7b6('0x3a')](_0x5da649['query'][_0xa7b6('0x3a')]);_0x1cb21a[_0xa7b6('0x3b')]=qs[_0xa7b6('0x32')](_[_0xa7b6('0x3c')](_0x5da649['query'],_0x5eabdd[_0xa7b6('0x32')]),_0x5ebb5f);if(_0x5da649[_0xa7b6('0x30')][_0xa7b6('0x3d')]){_0x1cb21a[_0xa7b6('0x3b')]=_['merge'](_0x1cb21a[_0xa7b6('0x3b')],{'$or':_[_0xa7b6('0x29')](_0x5ebb5f,function(_0x473ce6){if(_0x473ce6[_0xa7b6('0x2d')]!==_0xa7b6('0x3e')){var _0x1587b7={};_0x1587b7[_0x473ce6[_0xa7b6('0x26')]]={'$like':'%'+_0x5da649[_0xa7b6('0x30')][_0xa7b6('0x3d')]+'%'};return _0x1587b7;}})});}_0x1cb21a=_[_0xa7b6('0x3f')]({},_0x1cb21a,_0x5da649['options']);var _0x22dd6b={'where':_0x1cb21a[_0xa7b6('0x3b')]};return db['CmHopperHistory'][_0xa7b6('0x1f')](_0x22dd6b)[_0xa7b6('0x24')](function(_0x94a7f7){_0x4a2c3f['count']=_0x94a7f7;if(_0x5da649[_0xa7b6('0x30')][_0xa7b6('0x40')]){_0x1cb21a[_0xa7b6('0x41')]=[{'all':!![]}];}return db[_0xa7b6('0x2a')][_0xa7b6('0x42')](_0x1cb21a);})[_0xa7b6('0x24')](function(_0xd972b2){_0x4a2c3f[_0xa7b6('0x43')]=_0xd972b2;return _0x4a2c3f;})[_0xa7b6('0x24')](respondWithFilteredResult(_0xa0706,_0x1cb21a))[_0xa7b6('0x44')](handleError(_0xa0706,null));};exports[_0xa7b6('0x45')]=function(_0x89b82d,_0x4f5a88){var _0x16bd49={'raw':!![],'where':{'id':_0x89b82d[_0xa7b6('0x46')]['id']}},_0x448436={};_0x448436[_0xa7b6('0x2f')]=_[_0xa7b6('0x31')](db['CmHopperHistory'][_0xa7b6('0x2b')]);_0x448436[_0xa7b6('0x30')]=_[_0xa7b6('0x31')](_0x89b82d[_0xa7b6('0x30')]);_0x448436[_0xa7b6('0x32')]=_[_0xa7b6('0x33')](_0x448436[_0xa7b6('0x2f')],_0x448436['query']);_0x16bd49['attributes']=_[_0xa7b6('0x33')](_0x448436['model'],qs[_0xa7b6('0x35')](_0x89b82d[_0xa7b6('0x30')]['fields']));_0x16bd49[_0xa7b6('0x34')]=_0x16bd49[_0xa7b6('0x34')][_0xa7b6('0x36')]?_0x16bd49['attributes']:_0x448436['model'];if(_0x89b82d[_0xa7b6('0x30')][_0xa7b6('0x40')]){_0x16bd49['include']=[{'all':!![]}];}_0x16bd49=_[_0xa7b6('0x3f')]({},_0x16bd49,_0x89b82d['options']);return db['CmHopperHistory'][_0xa7b6('0x47')](_0x16bd49)[_0xa7b6('0x24')](handleEntityNotFound(_0x4f5a88,null))[_0xa7b6('0x24')](respondWithResult(_0x4f5a88,null))[_0xa7b6('0x44')](handleError(_0x4f5a88,null));};exports[_0xa7b6('0x48')]=function(_0x1abb44,_0x1c43fe){return db[_0xa7b6('0x2a')][_0xa7b6('0x48')](_0x1abb44['body'],{})[_0xa7b6('0x24')](respondWithResult(_0x1c43fe,0xc9))[_0xa7b6('0x44')](handleError(_0x1c43fe,null));};exports[_0xa7b6('0x49')]=function(_0x1dcabd,_0x46797d){return db[_0xa7b6('0x2a')][_0xa7b6('0x49')]()[_0xa7b6('0x24')](respondWithResult(_0x46797d,null))[_0xa7b6('0x44')](handleError(_0x46797d,null));};exports['update']=function(_0x36749b,_0xcd939){if(_0x36749b[_0xa7b6('0x4a')][_0xa7b6('0x4b')]){delete _0x36749b['body'][_0xa7b6('0x4b')];}return db['CmHopperHistory'][_0xa7b6('0x47')]({'where':{'uniqueid':_0x36749b[_0xa7b6('0x46')]['id']}})[_0xa7b6('0x24')](handleEntityNotFound(_0xcd939,null))[_0xa7b6('0x24')](saveUpdates(_0x36749b[_0xa7b6('0x4a')],null))[_0xa7b6('0x24')](respondWithResult(_0xcd939,null))[_0xa7b6('0x44')](handleError(_0xcd939,null));}; \ No newline at end of file +var _0x8228=['query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','include','catch','show','params','includeAll','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','stack','send','map','CmHopperHistory','rawAttributes','name'];(function(_0x339702,_0x465d98){var _0x55cc03=function(_0x570dad){while(--_0x570dad){_0x339702['push'](_0x339702['shift']());}};_0x55cc03(++_0x465d98);}(_0x8228,0x198));var _0x8822=function(_0x5e0540,_0x1c537b){_0x5e0540=_0x5e0540-0x0;var _0x5ed0ec=_0x8228[_0x5e0540];return _0x5ed0ec;};'use strict';var emlformat=require(_0x8822('0x0'));var rimraf=require(_0x8822('0x1'));var zipdir=require(_0x8822('0x2'));var jsonpatch=require(_0x8822('0x3'));var rp=require('request-promise');var moment=require(_0x8822('0x4'));var BPromise=require(_0x8822('0x5'));var Mustache=require(_0x8822('0x6'));var util=require('util');var path=require(_0x8822('0x7'));var sox=require(_0x8822('0x8'));var csv=require(_0x8822('0x9'));var ejs=require(_0x8822('0xa'));var fs=require('fs');var fs_extra=require(_0x8822('0xb'));var _=require('lodash');var squel=require(_0x8822('0xc'));var crypto=require(_0x8822('0xd'));var jsforce=require(_0x8822('0xe'));var deskjs=require(_0x8822('0xf'));var toCsv=require(_0x8822('0x9'));var querystring=require(_0x8822('0x10'));var Papa=require(_0x8822('0x11'));var Redis=require(_0x8822('0x12'));var authService=require(_0x8822('0x13'));var qs=require(_0x8822('0x14'));var as=require(_0x8822('0x15'));var hardwareService=require(_0x8822('0x16'));var logger=require(_0x8822('0x17'))(_0x8822('0x18'));var utils=require(_0x8822('0x19'));var config=require(_0x8822('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8822('0x1b'))['db'];function respondWithStatusCode(_0x2fb22d,_0x27450c){_0x27450c=_0x27450c||0xcc;return function(_0x2d4a62){if(_0x2d4a62){return _0x2fb22d[_0x8822('0x1c')](_0x27450c);}return _0x2fb22d['status'](_0x27450c)[_0x8822('0x1d')]();};}function respondWithResult(_0x2edd52,_0xb7c9b6){_0xb7c9b6=_0xb7c9b6||0xc8;return function(_0x4fab04){if(_0x4fab04){return _0x2edd52[_0x8822('0x1e')](_0xb7c9b6)['json'](_0x4fab04);}};}function respondWithFilteredResult(_0xd69a2d,_0x325d8c){return function(_0x19ea5f){if(_0x19ea5f){var _0x44fa34=typeof _0x325d8c[_0x8822('0x1f')]===_0x8822('0x20')&&typeof _0x325d8c[_0x8822('0x21')]===_0x8822('0x20');var _0x401382=_0x19ea5f[_0x8822('0x22')];var _0x111d62=_0x44fa34?0x0:_0x325d8c['offset'];var _0x58173c=_0x44fa34?_0x19ea5f[_0x8822('0x22')]:_0x325d8c['offset']+_0x325d8c['limit'];var _0x2ba35c;if(_0x58173c>=_0x401382){_0x58173c=_0x401382;_0x2ba35c=0xc8;}else{_0x2ba35c=0xce;}_0xd69a2d[_0x8822('0x1e')](_0x2ba35c);return _0xd69a2d[_0x8822('0x23')]('Content-Range',_0x111d62+'-'+_0x58173c+'/'+_0x401382)[_0x8822('0x24')](_0x19ea5f);}return null;};}function patchUpdates(_0x556d5a){return function(_0x3b9ee5){try{jsonpatch[_0x8822('0x25')](_0x3b9ee5,_0x556d5a,!![]);}catch(_0x1f8a56){return BPromise[_0x8822('0x26')](_0x1f8a56);}return _0x3b9ee5[_0x8822('0x27')]();};}function saveUpdates(_0x55ea83,_0x737348){return function(_0x96d243){if(_0x96d243){return _0x96d243[_0x8822('0x28')](_0x55ea83)['then'](function(_0x38212c){return _0x38212c;});}return null;};}function removeEntity(_0x2120a2,_0x47583c){return function(_0x21e2fd){if(_0x21e2fd){return _0x21e2fd['destroy']()[_0x8822('0x29')](function(){_0x2120a2[_0x8822('0x1e')](0xcc)[_0x8822('0x1d')]();});}};}function handleEntityNotFound(_0x43df2d,_0x2bc063){return function(_0x90a040){if(!_0x90a040){_0x43df2d[_0x8822('0x1c')](0x194);}return _0x90a040;};}function handleError(_0x20ed5f,_0x516e7b){_0x516e7b=_0x516e7b||0x1f4;return function(_0x5a7c1b){logger['error'](_0x5a7c1b[_0x8822('0x2a')]);if(_0x5a7c1b['name']){delete _0x5a7c1b['name'];}_0x20ed5f[_0x8822('0x1e')](_0x516e7b)[_0x8822('0x2b')](_0x5a7c1b);};}exports['index']=function(_0x2ef2fe,_0x4ab95f){var _0x41cee5={},_0x2a1a6b={},_0x5b1b4c={'count':0x0,'rows':[]};var _0x36fad9=_[_0x8822('0x2c')](db[_0x8822('0x2d')][_0x8822('0x2e')],function(_0x107741){return{'name':_0x107741['fieldName'],'type':_0x107741['type']['key']};});_0x2a1a6b['model']=_['map'](_0x36fad9,_0x8822('0x2f'));_0x2a1a6b[_0x8822('0x30')]=_[_0x8822('0x31')](_0x2ef2fe[_0x8822('0x30')]);_0x2a1a6b['filters']=_['intersection'](_0x2a1a6b['model'],_0x2a1a6b['query']);_0x41cee5['attributes']=_[_0x8822('0x32')](_0x2a1a6b[_0x8822('0x33')],qs[_0x8822('0x34')](_0x2ef2fe[_0x8822('0x30')][_0x8822('0x34')]));_0x41cee5[_0x8822('0x35')]=_0x41cee5[_0x8822('0x35')][_0x8822('0x36')]?_0x41cee5[_0x8822('0x35')]:_0x2a1a6b[_0x8822('0x33')];if(!_0x2ef2fe[_0x8822('0x30')]['hasOwnProperty'](_0x8822('0x37'))){_0x41cee5[_0x8822('0x21')]=qs[_0x8822('0x21')](_0x2ef2fe['query'][_0x8822('0x21')]);_0x41cee5['offset']=qs[_0x8822('0x1f')](_0x2ef2fe[_0x8822('0x30')][_0x8822('0x1f')]);}_0x41cee5[_0x8822('0x38')]=qs[_0x8822('0x39')](_0x2ef2fe[_0x8822('0x30')][_0x8822('0x39')]);_0x41cee5[_0x8822('0x3a')]=qs['filters'](_[_0x8822('0x3b')](_0x2ef2fe[_0x8822('0x30')],_0x2a1a6b[_0x8822('0x3c')]),_0x36fad9);if(_0x2ef2fe[_0x8822('0x30')][_0x8822('0x3d')]){_0x41cee5['where']=_['merge'](_0x41cee5[_0x8822('0x3a')],{'$or':_[_0x8822('0x2c')](_0x36fad9,function(_0x5073d5){if(_0x5073d5[_0x8822('0x3e')]!==_0x8822('0x3f')){var _0xad1409={};_0xad1409[_0x5073d5['name']]={'$like':'%'+_0x2ef2fe[_0x8822('0x30')]['filter']+'%'};return _0xad1409;}})});}_0x41cee5=_[_0x8822('0x40')]({},_0x41cee5,_0x2ef2fe[_0x8822('0x41')]);var _0x4bf166={'where':_0x41cee5['where']};return db[_0x8822('0x2d')][_0x8822('0x22')](_0x4bf166)[_0x8822('0x29')](function(_0x2fa7d8){_0x5b1b4c[_0x8822('0x22')]=_0x2fa7d8;if(_0x2ef2fe[_0x8822('0x30')]['includeAll']){_0x41cee5[_0x8822('0x42')]=[{'all':!![]}];}return db[_0x8822('0x2d')]['findAll'](_0x41cee5);})[_0x8822('0x29')](function(_0x5db470){_0x5b1b4c['rows']=_0x5db470;return _0x5b1b4c;})[_0x8822('0x29')](respondWithFilteredResult(_0x4ab95f,_0x41cee5))[_0x8822('0x43')](handleError(_0x4ab95f,null));};exports[_0x8822('0x44')]=function(_0x593cb4,_0x1bcd67){var _0x19a9fc={'raw':!![],'where':{'id':_0x593cb4[_0x8822('0x45')]['id']}},_0x5e5829={};_0x5e5829['model']=_['keys'](db[_0x8822('0x2d')][_0x8822('0x2e')]);_0x5e5829['query']=_[_0x8822('0x31')](_0x593cb4[_0x8822('0x30')]);_0x5e5829[_0x8822('0x3c')]=_[_0x8822('0x32')](_0x5e5829[_0x8822('0x33')],_0x5e5829[_0x8822('0x30')]);_0x19a9fc[_0x8822('0x35')]=_['intersection'](_0x5e5829[_0x8822('0x33')],qs['fields'](_0x593cb4['query'][_0x8822('0x34')]));_0x19a9fc['attributes']=_0x19a9fc[_0x8822('0x35')][_0x8822('0x36')]?_0x19a9fc[_0x8822('0x35')]:_0x5e5829[_0x8822('0x33')];if(_0x593cb4['query'][_0x8822('0x46')]){_0x19a9fc[_0x8822('0x42')]=[{'all':!![]}];}_0x19a9fc=_['merge']({},_0x19a9fc,_0x593cb4[_0x8822('0x41')]);return db['CmHopperHistory'][_0x8822('0x47')](_0x19a9fc)['then'](handleEntityNotFound(_0x1bcd67,null))[_0x8822('0x29')](respondWithResult(_0x1bcd67,null))[_0x8822('0x43')](handleError(_0x1bcd67,null));};exports['create']=function(_0xa73ad0,_0x1f4d1a){return db[_0x8822('0x2d')][_0x8822('0x48')](_0xa73ad0[_0x8822('0x49')],{})['then'](respondWithResult(_0x1f4d1a,0xc9))[_0x8822('0x43')](handleError(_0x1f4d1a,null));};exports[_0x8822('0x4a')]=function(_0x2f6567,_0x58b8e3){return db[_0x8822('0x2d')][_0x8822('0x4a')]()[_0x8822('0x29')](respondWithResult(_0x58b8e3,null))[_0x8822('0x43')](handleError(_0x58b8e3,null));};exports[_0x8822('0x28')]=function(_0x46c81f,_0x4cac2a){if(_0x46c81f[_0x8822('0x49')][_0x8822('0x4b')]){delete _0x46c81f[_0x8822('0x49')][_0x8822('0x4b')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x46c81f[_0x8822('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cac2a,null))[_0x8822('0x29')](saveUpdates(_0x46c81f[_0x8822('0x49')],null))['then'](respondWithResult(_0x4cac2a,null))[_0x8822('0x43')](handleError(_0x4cac2a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b498ffa..2efaf73 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 _0x1c77=['cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x24bbdc,_0x33a8d0){var _0x12b703=function(_0x27c860){while(--_0x27c860){_0x24bbdc['push'](_0x24bbdc['shift']());}};_0x12b703(++_0x33a8d0);}(_0x1c77,0xed));var _0x71c7=function(_0x2ac4af,_0x288c53){_0x2ac4af=_0x2ac4af-0x0;var _0x3a36df=_0x1c77[_0x2ac4af];return _0x3a36df;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var logger=require(_0x71c7('0x1'))(_0x71c7('0x2'));var moment=require(_0x71c7('0x3'));var BPromise=require(_0x71c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71c7('0x5'));var rimraf=require(_0x71c7('0x6'));var config=require(_0x71c7('0x7'));var attributes=require(_0x71c7('0x8'));module[_0x71c7('0x9')]=function(_0x1ee344,_0x2fb422){return _0x1ee344['define']('CmHopperHistory',attributes,{'tableName':_0x71c7('0xa'),'paranoid':![],'indexes':[{'name':_0x71c7('0xb'),'fields':[_0x71c7('0xb')]},{'name':_0x71c7('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3f9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','cm_hopper_history','endtime','uniqueid','lodash','util','api'];(function(_0x2cf907,_0x3b809){var _0x3dcd47=function(_0x5794c2){while(--_0x5794c2){_0x2cf907['push'](_0x2cf907['shift']());}};_0x3dcd47(++_0x3b809);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x4d9a92,_0x4d436c){_0x4d9a92=_0x4d9a92-0x0;var _0x1a2a12=_0xf3f9[_0x4d9a92];return _0x1a2a12;};'use strict';var _=require(_0x9f3f('0x0'));var util=require(_0x9f3f('0x1'));var logger=require('../../config/logger')(_0x9f3f('0x2'));var moment=require(_0x9f3f('0x3'));var BPromise=require(_0x9f3f('0x4'));var rp=require(_0x9f3f('0x5'));var fs=require('fs');var path=require(_0x9f3f('0x6'));var rimraf=require(_0x9f3f('0x7'));var config=require(_0x9f3f('0x8'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0xc4516a,_0x566b08){return _0xc4516a[_0x9f3f('0x9')]('CmHopperHistory',attributes,{'tableName':_0x9f3f('0xa'),'paranoid':![],'indexes':[{'name':_0x9f3f('0xb'),'fields':[_0x9f3f('0xb')]},{'name':'uniqueid','fields':[_0x9f3f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index dac2d4c..35c901a 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 _0x0c5d=['`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal'];(function(_0x1ec7a6,_0x58e4bf){var _0x34f0e4=function(_0x217ef9){while(--_0x217ef9){_0x1ec7a6['push'](_0x1ec7a6['shift']());}};_0x34f0e4(++_0x58e4bf);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x3e392e,_0x3a7296){_0x3e392e=_0x3e392e-0x0;var _0x2bd143=_0x0c5d[_0x3e392e];return _0x2bd143;};'use strict';var _=require(_0xd0c5('0x0'));var util=require(_0xd0c5('0x1'));var moment=require('moment');var BPromise=require(_0xd0c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0c5('0x3'));var db=require(_0xd0c5('0x4'))['db'];var utils=require(_0xd0c5('0x5'));var logger=require(_0xd0c5('0x6'))(_0xd0c5('0x7'));var config=require(_0xd0c5('0x8'));var jayson=require(_0xd0c5('0x9'));var client=jayson[_0xd0c5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ef2f6,_0x518801,_0x47f0f4){return new BPromise(function(_0x365e04,_0x4be307){return client['request'](_0x2ef2f6,_0x47f0f4)[_0xd0c5('0xb')](function(_0x227cb7){logger['info'](_0xd0c5('0xc'),_0x518801,_0xd0c5('0xd'));logger['debug'](_0xd0c5('0xe'),_0x518801,_0xd0c5('0xd'),JSON[_0xd0c5('0xf')](_0x227cb7));if(_0x227cb7[_0xd0c5('0x10')]){if(_0x227cb7[_0xd0c5('0x10')][_0xd0c5('0x11')]===0x1f4){logger[_0xd0c5('0x10')](_0xd0c5('0xc'),_0x518801,_0x227cb7[_0xd0c5('0x10')][_0xd0c5('0x12')]);return _0x4be307(_0x227cb7[_0xd0c5('0x10')][_0xd0c5('0x12')]);}logger['error'](_0xd0c5('0xc'),_0x518801,_0x227cb7[_0xd0c5('0x10')][_0xd0c5('0x12')]);return _0x365e04(_0x227cb7[_0xd0c5('0x10')]['message']);}else{logger[_0xd0c5('0x13')](_0xd0c5('0xc'),_0x518801,_0xd0c5('0xd'));_0x365e04(_0x227cb7[_0xd0c5('0x14')]['message']);}})[_0xd0c5('0x15')](function(_0x5809ba){logger[_0xd0c5('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x518801,_0x5809ba);_0x4be307(_0x5809ba);});});}exports[_0xd0c5('0x16')]=function(_0x692aeb){var _0x308296=this;return new Promise(function(_0x1cfe05,_0xfda75c){return db[_0xd0c5('0x17')][_0xd0c5('0x18')](_0x692aeb[_0xd0c5('0x19')],{'raw':_0x692aeb['options']?_0x692aeb[_0xd0c5('0x1a')][_0xd0c5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x835e8d){logger[_0xd0c5('0x13')](_0xd0c5('0x16'),_0x692aeb);logger[_0xd0c5('0x1c')](_0xd0c5('0x16'),_0x692aeb,JSON[_0xd0c5('0xf')](_0x835e8d));_0x1cfe05(_0x835e8d);})[_0xd0c5('0x15')](function(_0x49db81){logger['error'](_0xd0c5('0x16'),_0x49db81[_0xd0c5('0x12')],_0x692aeb);_0xfda75c(_0x308296[_0xd0c5('0x10')](0x1f4,_0x49db81[_0xd0c5('0x12')]));});});};exports['AvgHandleTime']=function(_0x185e33){var _0x54f42c=this;return new Promise(function(_0x54f188,_0x3ec4ee){return db[_0xd0c5('0x17')][_0xd0c5('0x1d')]({'raw':_0x185e33[_0xd0c5('0x1a')]?_0x185e33[_0xd0c5('0x1a')][_0xd0c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x185e33[_0xd0c5('0x1a')]?_0x185e33[_0xd0c5('0x1a')][_0xd0c5('0x1e')]||null:null,'attributes':[[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')][_0xd0c5('0x21')]('id')),_0xd0c5('0x22')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db['sequelize'][_0xd0c5('0x23')](_0xd0c5('0x24')))),_0xd0c5('0x25')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db[_0xd0c5('0x1f')]['literal'](_0xd0c5('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db[_0xd0c5('0x1f')][_0xd0c5('0x23')](_0xd0c5('0x27')))),_0xd0c5('0x28')],[db['sequelize']['fn']('AVG',db[_0xd0c5('0x1f')]['fn']('IF',db['sequelize'][_0xd0c5('0x23')](_0xd0c5('0x29')))),_0xd0c5('0x2a')],[db[_0xd0c5('0x1f')]['fn']('AVG',db[_0xd0c5('0x1f')]['fn']('IF',db[_0xd0c5('0x1f')]['literal'](_0xd0c5('0x2b')))),'predictiveIntervalAvgTalktime']]})[_0xd0c5('0xb')](function(_0x2bddff){logger[_0xd0c5('0x13')]('AvgHandleTime',_0x185e33);logger[_0xd0c5('0x1c')](_0xd0c5('0x2c'),_0x185e33,JSON[_0xd0c5('0xf')](_0x2bddff));_0x54f188(_0x2bddff);})[_0xd0c5('0x15')](function(_0x432d57){logger[_0xd0c5('0x10')](_0xd0c5('0x2c'),_0x432d57[_0xd0c5('0x12')],_0x185e33);_0x3ec4ee(_0x54f42c[_0xd0c5('0x10')](0x1f4,_0x432d57[_0xd0c5('0x12')]));});});};exports[_0xd0c5('0x2d')]=function(_0x7adacf){var _0x6dd239=this;return new Promise(function(_0x4d2c05,_0x4e3d0e){return db[_0xd0c5('0x17')]['findAll']({'raw':_0x7adacf[_0xd0c5('0x1a')]?_0x7adacf[_0xd0c5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x7adacf[_0xd0c5('0x1a')]?_0x7adacf[_0xd0c5('0x1a')]['where']||null:null,'attributes':[[_0xd0c5('0x2e'),_0xd0c5('0x2f')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db[_0xd0c5('0x1f')][_0xd0c5('0x23')](_0xd0c5('0x30')))),_0xd0c5('0x31')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db[_0xd0c5('0x1f')]['literal'](_0xd0c5('0x32')))),_0xd0c5('0x33')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xd0c5('0x24')))),_0xd0c5('0x34')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db['sequelize']['fn']('IF',db[_0xd0c5('0x1f')][_0xd0c5('0x23')](_0xd0c5('0x35')))),_0xd0c5('0x36')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db['sequelize'][_0xd0c5('0x23')](_0xd0c5('0x37')))),'outboundCongestionCallsDay'],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xd0c5('0x1f')]['fn']('COUNT',db[_0xd0c5('0x1f')]['fn']('IF',db['sequelize'][_0xd0c5('0x23')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xd0c5('0x38')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db[_0xd0c5('0x1f')]['literal'](_0xd0c5('0x39')))),_0xd0c5('0x3a')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db[_0xd0c5('0x1f')]['literal'](_0xd0c5('0x3b')))),_0xd0c5('0x3c')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db['sequelize']['fn']('IF',db[_0xd0c5('0x1f')][_0xd0c5('0x23')](_0xd0c5('0x3d')))),_0xd0c5('0x3e')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db[_0xd0c5('0x1f')][_0xd0c5('0x23')](_0xd0c5('0x3f')))),_0xd0c5('0x40')],[db[_0xd0c5('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd0c5('0x1f')][_0xd0c5('0x23')](_0xd0c5('0x41')))),_0xd0c5('0x42')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db['sequelize']['fn']('IF',db[_0xd0c5('0x1f')][_0xd0c5('0x23')](_0xd0c5('0x43')))),_0xd0c5('0x40')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db[_0xd0c5('0x1f')][_0xd0c5('0x23')](_0xd0c5('0x44')))),_0xd0c5('0x45')]],'group':[_0xd0c5('0x2e')]})[_0xd0c5('0xb')](function(_0x59cecb){logger[_0xd0c5('0x13')](_0xd0c5('0x2d'),_0x7adacf);logger['debug'](_0xd0c5('0x2d'),_0x7adacf,JSON['stringify'](_0x59cecb));_0x4d2c05(_0x59cecb);})['catch'](function(_0x34c5c5){logger[_0xd0c5('0x10')](_0xd0c5('0x2d'),_0x34c5c5[_0xd0c5('0x12')],_0x7adacf);_0x4e3d0e(_0x6dd239[_0xd0c5('0x10')](0x1f4,_0x34c5c5[_0xd0c5('0x12')]));});});};exports[_0xd0c5('0x46')]=function(_0x1924a4){var _0xb7a932=this;return new Promise(function(_0x2f0119,_0x1b25e0){return db[_0xd0c5('0x17')][_0xd0c5('0x1d')]({'raw':_0x1924a4[_0xd0c5('0x1a')]?_0x1924a4[_0xd0c5('0x1a')][_0xd0c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x1924a4[_0xd0c5('0x1a')]?_0x1924a4['options']['where']||null:null,'attributes':[[_0xd0c5('0x2e'),_0xd0c5('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xd0c5('0x1f')][_0xd0c5('0x21')]('id')),_0xd0c5('0x47')],[db[_0xd0c5('0x1f')]['fn'](_0xd0c5('0x20'),db[_0xd0c5('0x1f')]['fn']('IF',db[_0xd0c5('0x1f')][_0xd0c5('0x23')](_0xd0c5('0x24')))),'ivrAnswerCallsDay']],'group':[_0xd0c5('0x2e')]})[_0xd0c5('0xb')](function(_0x4ec681){logger[_0xd0c5('0x13')]('GetCampaignHopperHistory',_0x1924a4);logger[_0xd0c5('0x1c')]('GetCampaignHopperHistory',_0x1924a4,JSON[_0xd0c5('0xf')](_0x4ec681));_0x2f0119(_0x4ec681);})['catch'](function(_0x261e81){logger[_0xd0c5('0x10')](_0xd0c5('0x46'),_0x261e81[_0xd0c5('0x12')],_0x1924a4);_0x1b25e0(_0xb7a932[_0xd0c5('0x10')](0x1f4,_0x261e81[_0xd0c5('0x12')]));});});}; \ No newline at end of file +var _0xac4a=['COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','sequelize'];(function(_0x8557ff,_0x43d12d){var _0x520751=function(_0x108b0e){while(--_0x108b0e){_0x8557ff['push'](_0x8557ff['shift']());}};_0x520751(++_0x43d12d);}(_0xac4a,0x13f));var _0xaac4=function(_0xbec59d,_0x6f433d){_0xbec59d=_0xbec59d-0x0;var _0x308204=_0xac4a[_0xbec59d];return _0x308204;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});}exports[_0xaac4('0x15')]=function(_0x52085a){var _0x220630=this;return new Promise(function(_0x5b6fd6,_0x3ce35a){return db[_0xaac4('0x16')][_0xaac4('0x17')](_0x52085a[_0xaac4('0x18')],{'raw':_0x52085a[_0xaac4('0x19')]?_0x52085a[_0xaac4('0x19')][_0xaac4('0x1a')]===undefined?!![]:![]:!![]})[_0xaac4('0xa')](function(_0x4166ee){logger['info'](_0xaac4('0x15'),_0x52085a);logger['debug'](_0xaac4('0x15'),_0x52085a,JSON[_0xaac4('0xf')](_0x4166ee));_0x5b6fd6(_0x4166ee);})[_0xaac4('0x14')](function(_0x477b77){logger[_0xaac4('0x10')](_0xaac4('0x15'),_0x477b77['message'],_0x52085a);_0x3ce35a(_0x220630[_0xaac4('0x10')](0x1f4,_0x477b77[_0xaac4('0x12')]));});});};exports[_0xaac4('0x1b')]=function(_0x4f10ec){var _0x3dd059=this;return new Promise(function(_0x2dcc59,_0xb2577b){return db['CmHopperHistory'][_0xaac4('0x1c')]({'raw':_0x4f10ec['options']?_0x4f10ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f10ec['options']?_0x4f10ec[_0xaac4('0x19')][_0xaac4('0x1d')]||null:null,'attributes':[[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')][_0xaac4('0x20')]('id')),_0xaac4('0x21')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize'][_0xaac4('0x22')](_0xaac4('0x23')))),_0xaac4('0x24')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize'][_0xaac4('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0xaac4('0x25')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xaac4('0x26')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x27'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x28')))),_0xaac4('0x29')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x27'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x2a')))),_0xaac4('0x2b')]]})['then'](function(_0x5bad9f){logger[_0xaac4('0xb')](_0xaac4('0x1b'),_0x4f10ec);logger[_0xaac4('0xc')]('AvgHandleTime',_0x4f10ec,JSON[_0xaac4('0xf')](_0x5bad9f));_0x2dcc59(_0x5bad9f);})[_0xaac4('0x14')](function(_0x2cbf8d){logger[_0xaac4('0x10')](_0xaac4('0x1b'),_0x2cbf8d[_0xaac4('0x12')],_0x4f10ec);_0xb2577b(_0x3dd059[_0xaac4('0x10')](0x1f4,_0x2cbf8d['message']));});});};exports[_0xaac4('0x2c')]=function(_0x31ec51){var _0x1ffa56=this;return new Promise(function(_0x5d64a2,_0x36d84a){return db['CmHopperHistory']['findAll']({'raw':_0x31ec51[_0xaac4('0x19')]?_0x31ec51[_0xaac4('0x19')][_0xaac4('0x1a')]===undefined?!![]:![]:!![],'where':_0x31ec51['options']?_0x31ec51['options'][_0xaac4('0x1d')]||null:null,'attributes':[[_0xaac4('0x2d'),_0xaac4('0x2e')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xaac4('0x2f')))),_0xaac4('0x30')],[db['sequelize']['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x31')))),_0xaac4('0x32')],[db[_0xaac4('0x1e')]['fn']('COUNT',db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x23')))),'outboundAnswerCallsDay'],[db[_0xaac4('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x33')))),_0xaac4('0x34')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x35')))),_0xaac4('0x36')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db['sequelize']['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x37')))),'outboundDropCallsDayTimeout'],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x38')))),_0xaac4('0x39')],[db[_0xaac4('0x1e')]['fn']('COUNT',db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x3a')))),_0xaac4('0x3b')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x3c')))),_0xaac4('0x3d')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xaac4('0x3e')))),_0xaac4('0x3f')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db['sequelize']['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x40')))),_0xaac4('0x41')],[db['sequelize']['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0xaac4('0x42')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0xaac4('0x41')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize'][_0xaac4('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xaac4('0x43')]],'group':[_0xaac4('0x2d')]})[_0xaac4('0xa')](function(_0x3922a0){logger[_0xaac4('0xb')](_0xaac4('0x2c'),_0x31ec51);logger[_0xaac4('0xc')](_0xaac4('0x2c'),_0x31ec51,JSON[_0xaac4('0xf')](_0x3922a0));_0x5d64a2(_0x3922a0);})[_0xaac4('0x14')](function(_0x1a637e){logger[_0xaac4('0x10')](_0xaac4('0x2c'),_0x1a637e[_0xaac4('0x12')],_0x31ec51);_0x36d84a(_0x1ffa56['error'](0x1f4,_0x1a637e[_0xaac4('0x12')]));});});};exports[_0xaac4('0x44')]=function(_0x1f0e9f){var _0x1e6e0e=this;return new Promise(function(_0x3b39a1,_0x10e218){return db[_0xaac4('0x16')][_0xaac4('0x1c')]({'raw':_0x1f0e9f['options']?_0x1f0e9f[_0xaac4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f0e9f[_0xaac4('0x19')]?_0x1f0e9f['options'][_0xaac4('0x1d')]||null:null,'attributes':[['campaign','name'],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db['sequelize'][_0xaac4('0x20')]('id')),_0xaac4('0x45')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x23')))),'ivrAnswerCallsDay']],'group':[_0xaac4('0x2d')]})['then'](function(_0x4dcc7d){logger['info'](_0xaac4('0x44'),_0x1f0e9f);logger[_0xaac4('0xc')](_0xaac4('0x44'),_0x1f0e9f,JSON[_0xaac4('0xf')](_0x4dcc7d));_0x3b39a1(_0x4dcc7d);})['catch'](function(_0x372f96){logger[_0xaac4('0x10')](_0xaac4('0x44'),_0x372f96['message'],_0x1f0e9f);_0x10e218(_0x1e6e0e[_0xaac4('0x10')](0x1f4,_0x372f96[_0xaac4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9e8e5c4..616880a 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 _0x3e36=['post','/:id','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe'];(function(_0x32a8e9,_0x115962){var _0x3e7fdf=function(_0x45d004){while(--_0x45d004){_0x32a8e9['push'](_0x32a8e9['shift']());}};_0x3e7fdf(++_0x115962);}(_0x3e36,0x112));var _0x63e3=function(_0x3596f4,_0x182976){_0x3596f4=_0x3596f4-0x0;var _0x3c67e4=_0x3e36[_0x3596f4];return _0x3c67e4;};'use strict';var multer=require(_0x63e3('0x0'));var util=require(_0x63e3('0x1'));var path=require(_0x63e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x63e3('0x3'));var router=express[_0x63e3('0x4')]();var fs_extra=require(_0x63e3('0x5'));var auth=require(_0x63e3('0x6'));var interaction=require(_0x63e3('0x7'));var config=require(_0x63e3('0x8'));var controller=require(_0x63e3('0x9'));router[_0x63e3('0xa')]('/',auth[_0x63e3('0xb')](),controller[_0x63e3('0xc')]);router['get']('/describe',auth[_0x63e3('0xb')](),controller[_0x63e3('0xd')]);router['get']('/:id',auth[_0x63e3('0xb')](),controller['show']);router[_0x63e3('0xe')]('/',auth[_0x63e3('0xb')](),controller['create']);router['put'](_0x63e3('0xf'),auth[_0x63e3('0xb')](),controller[_0x63e3('0x10')]);module[_0x63e3('0x11')]=router; \ No newline at end of file +var _0x63c4=['isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x120f1d,_0x4dae03){var _0x3d51d6=function(_0xa27ce4){while(--_0xa27ce4){_0x120f1d['push'](_0x120f1d['shift']());}};_0x3d51d6(++_0x4dae03);}(_0x63c4,0x1ee));var _0x463c=function(_0x3eb3d5,_0x9c1246){_0x3eb3d5=_0x3eb3d5-0x0;var _0x1a728d=_0x63c4[_0x3eb3d5];return _0x1a728d;};'use strict';var multer=require(_0x463c('0x0'));var util=require(_0x463c('0x1'));var path=require(_0x463c('0x2'));var timeout=require(_0x463c('0x3'));var express=require(_0x463c('0x4'));var router=express[_0x463c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x463c('0x6'));var interaction=require(_0x463c('0x7'));var config=require(_0x463c('0x8'));var controller=require(_0x463c('0x9'));router['get']('/',auth[_0x463c('0xa')](),controller[_0x463c('0xb')]);router[_0x463c('0xc')](_0x463c('0xd'),auth[_0x463c('0xa')](),controller[_0x463c('0xe')]);router[_0x463c('0xc')](_0x463c('0xf'),auth[_0x463c('0xa')](),controller[_0x463c('0x10')]);router[_0x463c('0x11')]('/',auth[_0x463c('0xa')](),controller['create']);router[_0x463c('0x12')]('/:id',auth[_0x463c('0xa')](),controller[_0x463c('0x13')]);module[_0x463c('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index b309214..27c845c 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 _0x98a7=['STRING','name','sequelize','exports'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x98a7,0x9e));var _0x798a=function(_0x39006f,_0x3a7913){_0x39006f=_0x39006f-0x0;var _0x200ce9=_0x98a7[_0x39006f];return _0x200ce9;};'use strict';var Sequelize=require(_0x798a('0x0'));module[_0x798a('0x1')]={'name':{'type':Sequelize[_0x798a('0x2')],'unique':_0x798a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x798a('0x2')]},'dialPrefix':{'type':Sequelize[_0x798a('0x2')]}}; \ No newline at end of file +var _0xf2cf=['STRING','name','exports'];(function(_0x4a8db2,_0x3d9347){var _0x3b3e2c=function(_0x37fcd7){while(--_0x37fcd7){_0x4a8db2['push'](_0x4a8db2['shift']());}};_0x3b3e2c(++_0x3d9347);}(_0xf2cf,0xf5));var _0xff2c=function(_0x4fb4d6,_0x978dba){_0x4fb4d6=_0x4fb4d6-0x0;var _0x5447ce=_0xf2cf[_0x4fb4d6];return _0x5447ce;};'use strict';var Sequelize=require('sequelize');module[_0xff2c('0x0')]={'name':{'type':Sequelize[_0xff2c('0x1')],'unique':_0xff2c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xff2c('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 041543e..3942657 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 _0x083b=['query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','type','filter','options','includeAll','include','CmList','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','order','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','omit','success','push','dataValues','errors','message','getContacts','CustomFields','concat','format','cf_%d','getContactsCsv','ContactItemType','OrderBy','CmCustomField','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','cm_contact_has_items','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','removeAgents','userCmList:remove','getAgents','User','spread','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','get','Lists','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key'];(function(_0x4e23f9,_0x488ad1){var _0xba8e91=function(_0x5bdfdb){while(--_0x5bdfdb){_0x4e23f9['push'](_0x4e23f9['shift']());}};_0xba8e91(++_0x488ad1);}(_0x083b,0x1bd));var _0xb083=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x083b[_0x22eb96];return _0x5e1adf;};'use strict';var emlformat=require(_0xb083('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb083('0x1'));var jsonpatch=require(_0xb083('0x2'));var rp=require(_0xb083('0x3'));var moment=require(_0xb083('0x4'));var BPromise=require(_0xb083('0x5'));var Mustache=require(_0xb083('0x6'));var util=require(_0xb083('0x7'));var path=require(_0xb083('0x8'));var sox=require(_0xb083('0x9'));var csv=require('to-csv');var ejs=require(_0xb083('0xa'));var fs=require('fs');var fs_extra=require(_0xb083('0xb'));var _=require(_0xb083('0xc'));var squel=require(_0xb083('0xd'));var crypto=require(_0xb083('0xe'));var jsforce=require(_0xb083('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb083('0x10'));var querystring=require(_0xb083('0x11'));var Papa=require(_0xb083('0x12'));var Redis=require(_0xb083('0x13'));var authService=require(_0xb083('0x14'));var qs=require(_0xb083('0x15'));var as=require(_0xb083('0x16'));var hardwareService=require(_0xb083('0x17'));var logger=require(_0xb083('0x18'))(_0xb083('0x19'));var utils=require('../../config/utils');var config=require(_0xb083('0x1a'));var licenseUtil=require(_0xb083('0x1b'));var db=require(_0xb083('0x1c'))['db'];var csv_results;config[_0xb083('0x1d')]=_[_0xb083('0x1e')](config[_0xb083('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xb083('0x1f'))(new Redis(config[_0xb083('0x1d')]));require(_0xb083('0x20'))[_0xb083('0x21')](socket);function respondWithStatusCode(_0x332dcb,_0x102996){_0x102996=_0x102996||0xcc;return function(_0x43238d){if(_0x43238d){return _0x332dcb[_0xb083('0x22')](_0x102996);}return _0x332dcb['status'](_0x102996)[_0xb083('0x23')]();};}function respondWithResult(_0xfb9adb,_0x2d722e){_0x2d722e=_0x2d722e||0xc8;return function(_0x478ef4){if(_0x478ef4){return _0xfb9adb[_0xb083('0x24')](_0x2d722e)[_0xb083('0x25')](_0x478ef4);}};}function respondWithFilteredResult(_0x51bad6,_0x25507c){return function(_0x431132){if(_0x431132){var _0x56e436=typeof _0x25507c[_0xb083('0x26')]===_0xb083('0x27')&&typeof _0x25507c[_0xb083('0x28')]==='undefined';var _0x38d67d=_0x431132[_0xb083('0x29')];var _0x476c25=_0x56e436?0x0:_0x25507c[_0xb083('0x26')];var _0x50b7c3=_0x56e436?_0x431132['count']:_0x25507c[_0xb083('0x26')]+_0x25507c[_0xb083('0x28')];var _0x4848b4;if(_0x50b7c3>=_0x38d67d){_0x50b7c3=_0x38d67d;_0x4848b4=0xc8;}else{_0x4848b4=0xce;}_0x51bad6[_0xb083('0x24')](_0x4848b4);return _0x51bad6[_0xb083('0x2a')]('Content-Range',_0x476c25+'-'+_0x50b7c3+'/'+_0x38d67d)['json'](_0x431132);}return null;};}function patchUpdates(_0x18a1b6){return function(_0x4e6e8c){try{jsonpatch['apply'](_0x4e6e8c,_0x18a1b6,!![]);}catch(_0x56830c){return BPromise[_0xb083('0x2b')](_0x56830c);}return _0x4e6e8c[_0xb083('0x2c')]();};}function saveUpdates(_0x3933e2,_0x594244){return function(_0x4c5a0a){if(_0x4c5a0a){return _0x4c5a0a[_0xb083('0x2d')](_0x3933e2)[_0xb083('0x2e')](function(_0x365e96){return _0x365e96;});}return null;};}function removeEntity(_0x563afc,_0x99f0bc){return function(_0x484263){if(_0x484263){return _0x484263['destroy']()['then'](function(){var _0x57fa2a=_0x484263[_0xb083('0x2f')]({'plain':!![]});var _0x57ddfe=_0xb083('0x30');return db['UserProfileResource'][_0xb083('0x31')]({'where':{'type':_0x57ddfe,'resourceId':_0x57fa2a['id']}})[_0xb083('0x2e')](function(){return _0x484263;});})[_0xb083('0x2e')](function(){_0x563afc[_0xb083('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1600ce,_0x4f6ade){return function(_0x41f04a){if(!_0x41f04a){_0x1600ce['sendStatus'](0x194);}return _0x41f04a;};}function handleError(_0x5cb6e6,_0x56d359){_0x56d359=_0x56d359||0x1f4;return function(_0x51f31d){logger[_0xb083('0x32')](_0x51f31d[_0xb083('0x33')]);if(_0x51f31d['name']){delete _0x51f31d[_0xb083('0x34')];}_0x5cb6e6[_0xb083('0x24')](_0x56d359)[_0xb083('0x35')](_0x51f31d);};}exports[_0xb083('0x36')]=function(_0x5f03ff,_0x2ce5bf){var _0xbb5d6e={},_0x2295e3={},_0x28eea3={'count':0x0,'rows':[]};var _0x4763a9=_[_0xb083('0x37')](db['CmList'][_0xb083('0x38')],function(_0x436c4d){return{'name':_0x436c4d[_0xb083('0x39')],'type':_0x436c4d['type'][_0xb083('0x3a')]};});_0x2295e3['model']=_[_0xb083('0x37')](_0x4763a9,'name');_0x2295e3[_0xb083('0x3b')]=_[_0xb083('0x3c')](_0x5f03ff[_0xb083('0x3b')]);_0x2295e3[_0xb083('0x3d')]=_[_0xb083('0x3e')](_0x2295e3[_0xb083('0x3f')],_0x2295e3[_0xb083('0x3b')]);_0xbb5d6e[_0xb083('0x40')]=_[_0xb083('0x3e')](_0x2295e3[_0xb083('0x3f')],qs[_0xb083('0x41')](_0x5f03ff[_0xb083('0x3b')][_0xb083('0x41')]));_0xbb5d6e[_0xb083('0x40')]=_0xbb5d6e[_0xb083('0x40')]['length']?_0xbb5d6e['attributes']:_0x2295e3[_0xb083('0x3f')];if(!_0x5f03ff[_0xb083('0x3b')][_0xb083('0x42')](_0xb083('0x43'))){_0xbb5d6e[_0xb083('0x28')]=qs[_0xb083('0x28')](_0x5f03ff['query'][_0xb083('0x28')]);_0xbb5d6e[_0xb083('0x26')]=qs[_0xb083('0x26')](_0x5f03ff[_0xb083('0x3b')][_0xb083('0x26')]);}_0xbb5d6e['order']=qs['sort'](_0x5f03ff[_0xb083('0x3b')][_0xb083('0x44')]);_0xbb5d6e['where']=qs[_0xb083('0x3d')](_['pick'](_0x5f03ff['query'],_0x2295e3[_0xb083('0x3d')]),_0x4763a9);if(_0x5f03ff[_0xb083('0x3b')]['filter']){_0xbb5d6e[_0xb083('0x45')]=_[_0xb083('0x46')](_0xbb5d6e['where'],{'$or':_['map'](_0x4763a9,function(_0x4ad0d8){if(_0x4ad0d8[_0xb083('0x47')]!=='VIRTUAL'){var _0x355b39={};_0x355b39[_0x4ad0d8[_0xb083('0x34')]]={'$like':'%'+_0x5f03ff[_0xb083('0x3b')][_0xb083('0x48')]+'%'};return _0x355b39;}})});}_0xbb5d6e=_[_0xb083('0x46')]({},_0xbb5d6e,_0x5f03ff[_0xb083('0x49')]);var _0x252ac1={'where':_0xbb5d6e['where']};return db['CmList'][_0xb083('0x29')](_0x252ac1)['then'](function(_0x154e96){_0x28eea3[_0xb083('0x29')]=_0x154e96;if(_0x5f03ff[_0xb083('0x3b')][_0xb083('0x4a')]){_0xbb5d6e[_0xb083('0x4b')]=[{'all':!![]}];}return db[_0xb083('0x4c')][_0xb083('0x4d')](_0xbb5d6e);})[_0xb083('0x2e')](function(_0x1cc7eb){_0x28eea3[_0xb083('0x4e')]=_0x1cc7eb;return _0x28eea3;})['then'](respondWithFilteredResult(_0x2ce5bf,_0xbb5d6e))[_0xb083('0x4f')](handleError(_0x2ce5bf,null));};exports['show']=function(_0x3075f2,_0x4c56c6){var _0x2920cb={'raw':![],'where':{'id':_0x3075f2[_0xb083('0x50')]['id']}},_0x1ad36c={};_0x1ad36c[_0xb083('0x3f')]=_[_0xb083('0x3c')](db['CmList'][_0xb083('0x38')]);_0x1ad36c[_0xb083('0x3b')]=_[_0xb083('0x3c')](_0x3075f2['query']);_0x1ad36c[_0xb083('0x3d')]=_[_0xb083('0x3e')](_0x1ad36c['model'],_0x1ad36c[_0xb083('0x3b')]);_0x2920cb[_0xb083('0x40')]=_[_0xb083('0x3e')](_0x1ad36c[_0xb083('0x3f')],qs[_0xb083('0x41')](_0x3075f2[_0xb083('0x3b')][_0xb083('0x41')]));_0x2920cb[_0xb083('0x40')]=_0x2920cb[_0xb083('0x40')][_0xb083('0x51')]?_0x2920cb['attributes']:_0x1ad36c[_0xb083('0x3f')];if(_0x3075f2[_0xb083('0x3b')][_0xb083('0x4a')]){_0x2920cb[_0xb083('0x4b')]=[{'all':!![]}];}_0x2920cb=_[_0xb083('0x46')]({},_0x2920cb,_0x3075f2['options']);return db[_0xb083('0x4c')][_0xb083('0x52')](_0x2920cb)[_0xb083('0x2e')](handleEntityNotFound(_0x4c56c6,null))[_0xb083('0x2e')](respondWithResult(_0x4c56c6,null))['catch'](handleError(_0x4c56c6,null));};exports[_0xb083('0x53')]=function(_0xae7c50,_0x4d04d9){return db[_0xb083('0x4c')]['create'](_0xae7c50[_0xb083('0x54')],{})['then'](function(_0x36d009){var _0x7571e1=_0xae7c50[_0xb083('0x55')][_0xb083('0x2f')]({'plain':!![]});if(!_0x7571e1)throw new Error(_0xb083('0x56'));if(_0x7571e1[_0xb083('0x57')]===_0xb083('0x55')){var _0x2ad680=_0x36d009[_0xb083('0x2f')]({'plain':!![]});var _0x2de267=_0xb083('0x30');return db[_0xb083('0x58')]['find']({'where':{'name':_0x2de267,'userProfileId':_0x7571e1[_0xb083('0x59')]},'raw':!![]})['then'](function(_0x22f2a4){if(_0x22f2a4&&_0x22f2a4[_0xb083('0x5a')]===0x0){return db[_0xb083('0x5b')][_0xb083('0x53')]({'name':_0x2ad680[_0xb083('0x34')],'resourceId':_0x2ad680['id'],'type':_0x22f2a4[_0xb083('0x34')],'sectionId':_0x22f2a4['id']},{})['then'](function(){return _0x36d009;});}else{return _0x36d009;}})[_0xb083('0x4f')](function(_0x1cde39){logger[_0xb083('0x32')](_0xb083('0x5c'),_0x1cde39);throw _0x1cde39;});}return _0x36d009;})[_0xb083('0x2e')](respondWithResult(_0x4d04d9,0xc9))['catch'](handleError(_0x4d04d9,null));};exports[_0xb083('0x2d')]=function(_0x1f2083,_0x2db202){if(_0x1f2083[_0xb083('0x54')]['id']){delete _0x1f2083[_0xb083('0x54')]['id'];}return db['CmList'][_0xb083('0x52')]({'where':{'id':_0x1f2083[_0xb083('0x50')]['id']}})[_0xb083('0x2e')](handleEntityNotFound(_0x2db202,null))[_0xb083('0x2e')](saveUpdates(_0x1f2083[_0xb083('0x54')],null))['then'](respondWithResult(_0x2db202,null))[_0xb083('0x4f')](handleError(_0x2db202,null));};exports['destroy']=function(_0x3664db,_0x344e2d){return db[_0xb083('0x4c')][_0xb083('0x52')]({'where':{'id':_0x3664db[_0xb083('0x50')]['id']}})[_0xb083('0x2e')](handleEntityNotFound(_0x344e2d,null))[_0xb083('0x2e')](removeEntity(_0x344e2d,null))[_0xb083('0x4f')](handleError(_0x344e2d,null));};exports[_0xb083('0x5d')]=function(_0x1e4705,_0x1518c6){return db[_0xb083('0x4c')]['describe']()[_0xb083('0x2e')](respondWithResult(_0x1518c6,null))[_0xb083('0x4f')](handleError(_0x1518c6,null));};exports[_0xb083('0x5e')]=function(_0xa807c7,_0x1c0db6,_0x362ee6){if(_0xa807c7[_0xb083('0x54')]['id']){delete _0xa807c7[_0xb083('0x54')]['id'];}return db[_0xb083('0x4c')][_0xb083('0x52')]({'where':{'id':_0xa807c7['params']['id']}})[_0xb083('0x2e')](handleEntityNotFound(_0x1c0db6,null))[_0xb083('0x2e')](function(_0x420c02){if(_0x420c02){_0xa807c7[_0xb083('0x54')][_0xb083('0x5f')]=_0x420c02['id'];return db[_0xb083('0x60')][_0xb083('0x53')](_0xa807c7['body']);}})[_0xb083('0x2e')](respondWithResult(_0x1c0db6,null))[_0xb083('0x4f')](handleError(_0x1c0db6,null));};exports[_0xb083('0x61')]=function(_0xbb9584,_0x444098,_0x5d3c56){var _0xa92889={'raw':![],'where':{}};var _0x5526d2={};var _0x2ffdff={'count':0x0,'rows':[]};return db[_0xb083('0x4c')][_0xb083('0x62')]({'where':{'id':_0xbb9584['params']['id']}})[_0xb083('0x2e')](handleEntityNotFound(_0x444098,null))[_0xb083('0x2e')](function(_0x8cfb3d){if(_0x8cfb3d){_0x5526d2[_0xb083('0x3f')]=_['keys'](db[_0xb083('0x60')]['rawAttributes']);_0x5526d2['query']=_['keys'](_0xbb9584['query']);_0x5526d2['filters']=_[_0xb083('0x3e')](_0x5526d2[_0xb083('0x3f')],_0x5526d2['query']);_0xa92889[_0xb083('0x40')]=_[_0xb083('0x3e')](_0x5526d2[_0xb083('0x3f')],qs['fields'](_0xbb9584[_0xb083('0x3b')]['fields']));_0xa92889['attributes']=_0xa92889[_0xb083('0x40')]['length']?_0xa92889[_0xb083('0x40')]:_0x5526d2['model'];if(!_0xbb9584[_0xb083('0x3b')][_0xb083('0x42')](_0xb083('0x43'))){_0xa92889[_0xb083('0x28')]=qs[_0xb083('0x28')](_0xbb9584['query'][_0xb083('0x28')]);_0xa92889[_0xb083('0x26')]=qs['offset'](_0xbb9584['query'][_0xb083('0x26')]);}_0xa92889[_0xb083('0x63')]=qs[_0xb083('0x44')](_0xbb9584[_0xb083('0x3b')]['sort']);_0xa92889[_0xb083('0x45')]=qs[_0xb083('0x3d')](_[_0xb083('0x64')](_0xbb9584[_0xb083('0x3b')],_0x5526d2[_0xb083('0x3d')]));_0xa92889['where'][_0xb083('0x5f')]=_0x8cfb3d['id'];if(_0xbb9584[_0xb083('0x3b')][_0xb083('0x48')]){_0xa92889[_0xb083('0x45')]=_[_0xb083('0x46')](_0xa92889[_0xb083('0x45')],{'$or':_['map'](_0xa92889[_0xb083('0x40')],function(_0x4be79b){var _0x1ad17c={};_0x1ad17c[_0x4be79b]={'$like':'%'+_0xbb9584[_0xb083('0x3b')][_0xb083('0x48')]+'%'};return _0x1ad17c;})});}_0xa92889=_[_0xb083('0x46')]({},_0xa92889,_0xbb9584[_0xb083('0x49')]);return db[_0xb083('0x60')][_0xb083('0x29')]({'where':_0xa92889[_0xb083('0x45')]})[_0xb083('0x2e')](function(_0x571fec){_0x2ffdff['count']=_0x571fec;if(_0xbb9584[_0xb083('0x3b')]['includeAll']){_0xa92889['include']=[{'all':!![]}];}return db[_0xb083('0x60')]['findAll'](_0xa92889);})[_0xb083('0x2e')](function(_0x4fe318){_0x2ffdff[_0xb083('0x4e')]=_0x4fe318;return _0x2ffdff;});}})['then'](respondWithFilteredResult(_0x444098,_0xa92889))['catch'](handleError(_0x444098,null));};exports[_0xb083('0x65')]=function(_0x10c9c7,_0x50a73f,_0x103f5b){return db['CmList'][_0xb083('0x52')]({'where':{'id':_0x10c9c7[_0xb083('0x50')]['id']}})[_0xb083('0x2e')](handleEntityNotFound(_0x50a73f,null))[_0xb083('0x2e')](function(_0x31fd93){if(_0x31fd93){return _0x31fd93[_0xb083('0x65')](_0x10c9c7[_0xb083('0x3b')][_0xb083('0x66')]);}})[_0xb083('0x2e')](respondWithStatusCode(_0x50a73f,null))['catch'](handleError(_0x50a73f,null));};exports[_0xb083('0x67')]=function(_0x4e1d35,_0x39db03,_0x296850){return db['CmList'][_0xb083('0x52')]({'where':{'id':_0x4e1d35[_0xb083('0x50')]['id']}})['then'](handleEntityNotFound(_0x39db03,null))[_0xb083('0x2e')](function(_0x549de4){if(_0x549de4){var _0x2ca203=[];var _0xd39727={'success':[],'errors':[]};return db[_0xb083('0x68')][_0xb083('0x5d')]()[_0xb083('0x2e')](function(_0x14b119){if(_0x4e1d35[_0xb083('0x54')][_0xb083('0x69')]&&_['isArray'](_0x4e1d35[_0xb083('0x54')]['tags'])){if(_0x4e1d35[_0xb083('0x54')]['tags'][_0xb083('0x51')]){_0x4e1d35['body'][_0xb083('0x69')]=_0x4e1d35['body'][_0xb083('0x69')]['join'](';')+';';}else{_0x4e1d35[_0xb083('0x54')]['tags']=null;}}else{_0x4e1d35['body'][_0xb083('0x69')]=null;}if(_0x4e1d35['body']&&_[_0xb083('0x6a')](_0x4e1d35[_0xb083('0x54')])){for(var _0x4eca12=0x0;_0x4eca12<_0x4e1d35[_0xb083('0x54')][_0xb083('0x51')];_0x4eca12+=0x1){_0x4e1d35[_0xb083('0x54')][_0x4eca12][_0xb083('0x5f')]=_0x4e1d35[_0xb083('0x50')]['id'];_0x2ca203['push'](_0x4e1d35[_0xb083('0x54')][_0x4eca12]);}return BPromise[_0xb083('0x6b')](_0x2ca203,function(_0x50fd35){return db['CmContact'][_0xb083('0x53')](_[_0xb083('0x6c')](_0x50fd35,[_0xb083('0x66'),'id'])||{},{'fields':_[_0xb083('0x3c')](_0x14b119),'raw':!![]})['then'](function(_0x412111){_0xd39727[_0xb083('0x6d')][_0xb083('0x6e')](_0x412111[_0xb083('0x6f')]);})[_0xb083('0x4f')](function(_0xdffd32){_0xd39727[_0xb083('0x70')][_0xb083('0x6e')]({'data':_0x50fd35,'error':_0xdffd32[_0xb083('0x71')]});});})[_0xb083('0x2e')](function(_0x5f5956){return _0xd39727;})[_0xb083('0x4f')](function(_0x44a4e5){return _0x44a4e5;});}else{_0x39db03['status'](0x190)[_0xb083('0x25')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x39db03,null))['catch'](handleError(_0x39db03,null));};exports[_0xb083('0x72')]=function(_0x41ae67,_0x5b0a93,_0x314a60){var _0x2454dc;return db[_0xb083('0x4c')][_0xb083('0x52')]({'where':{'id':_0x41ae67[_0xb083('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xb083('0x73')}]})[_0xb083('0x2e')](handleEntityNotFound(_0x5b0a93,null))[_0xb083('0x2e')](function(_0x23b2b0){if(_0x23b2b0){_0x2454dc=_0x23b2b0;return db['CmContact']['rawAttributes'];}})[_0xb083('0x2e')](function(_0xe17ce5){if(_0xe17ce5){var _0x6729c1={};var _0x1832df={};_0x1832df['model']=_[_0xb083('0x74')](_[_0xb083('0x3c')](_0xe17ce5),_['map'](_0x2454dc[_0xb083('0x73')],function(_0x2f7503){return util[_0xb083('0x75')](_0xb083('0x76'),_0x2f7503['id']);}));_0x1832df[_0xb083('0x3b')]=_[_0xb083('0x3c')](_0x41ae67['query']);_0x1832df['filters']=_['intersection'](_0x1832df['model'],_0x1832df[_0xb083('0x3b')]);_0x6729c1[_0xb083('0x40')]=_[_0xb083('0x3e')](_0x1832df['model'],qs['fields'](_0x41ae67[_0xb083('0x3b')][_0xb083('0x41')]));_0x6729c1[_0xb083('0x40')]=_0x6729c1[_0xb083('0x40')][_0xb083('0x51')]?_0x6729c1['attributes']:_0x1832df[_0xb083('0x3f')];if(!_0x41ae67['query'][_0xb083('0x42')]('nolimit')){_0x6729c1[_0xb083('0x28')]=qs['limit'](_0x41ae67[_0xb083('0x3b')]['limit']);_0x6729c1[_0xb083('0x26')]=qs[_0xb083('0x26')](_0x41ae67[_0xb083('0x3b')]['offset']);}_0x6729c1[_0xb083('0x63')]=qs[_0xb083('0x44')](_0x41ae67[_0xb083('0x3b')][_0xb083('0x44')]);_0x6729c1['where']=qs[_0xb083('0x3d')](_['pick'](_0x41ae67[_0xb083('0x3b')],_0x1832df['filters']));_0x6729c1['raw']=!![];if(_0x41ae67['query'][_0xb083('0x48')]){_0x6729c1['where']=_[_0xb083('0x46')](_0x6729c1[_0xb083('0x45')],{'$or':_[_0xb083('0x37')](_0x6729c1[_0xb083('0x40')],function(_0x410d56){var _0x621e23={};_0x621e23[_0x410d56]={'$like':'%'+_0x41ae67[_0xb083('0x3b')]['filter']+'%'};return _0x621e23;})});}_0x6729c1=_[_0xb083('0x46')]({},_0x6729c1,_0x41ae67['options']);return _0x2454dc[_0xb083('0x72')](_0x6729c1);}})[_0xb083('0x2e')](respondWithResult(_0x5b0a93,null))[_0xb083('0x4f')](handleError(_0x5b0a93,null));};exports[_0xb083('0x77')]=function(_0x535125,_0x2468ca,_0x28497f){var _0x31825e;var _0x5c59c6;var _0x42cd45;var _0xfc37fd=_0x535125['params']['id'];csv_results=[];return db[_0xb083('0x78')][_0xb083('0x4d')]({'attributes':['id','name'],'raw':!![],'order':[_0xb083('0x79')]})[_0xb083('0x2e')](function(_0x32a63e){_0x31825e=_0x32a63e;var _0x444059=_[_0xb083('0x3c')](db[_0xb083('0x68')][_0xb083('0x38')]);return db[_0xb083('0x7a')][_0xb083('0x4d')]({'raw':!![],'attributes':['id','alias']})[_0xb083('0x2e')](function(_0x445b52){_0x5c59c6=_0x445b52;var _0x54e8c8=squel['select']()[_0xb083('0x41')](_0x444059)[_0xb083('0x7b')](_0xb083('0x7c'),'c')[_0xb083('0x45')](_0xb083('0x7d'),_0xfc37fd)['where'](_0xb083('0x7e'))[_0xb083('0x7f')]();for(var _0x539436=0x0;_0x539436<_0x5c59c6[_0xb083('0x51')];_0x539436++){_0x54e8c8[_0xb083('0x80')](_0xb083('0x81')+_0x5c59c6[_0x539436]['id'],_0xb083('0x82')+_0x5c59c6[_0x539436][_0xb083('0x83')]);}for(var _0x539436=0x0;_0x539436<_0x31825e[_0xb083('0x51')];_0x539436++){_0x54e8c8[_0xb083('0x80')](squel['select']()['field'](_0xb083('0x84'))[_0xb083('0x7b')]('cm_contact_has_items')[_0xb083('0x45')](_0xb083('0x85'),_0x31825e[_0x539436]['id'])['where'](_0xb083('0x86')),_0xb083('0x87')+_0x31825e[_0x539436][_0xb083('0x34')]);_0x54e8c8[_0xb083('0x80')](squel['select']()[_0xb083('0x80')]('description')[_0xb083('0x7b')](_0xb083('0x88'))['where'](_0xb083('0x85'),_0x31825e[_0x539436]['id'])[_0xb083('0x45')](_0xb083('0x86')),'description_additionalPhone_'+_0x31825e[_0x539436]['name']);}var _0x5832ec=[];_0x5832ec['push'](_0x54e8c8[_0xb083('0x89')]());BPromise[_0xb083('0x6b')](_0x5832ec,handleQuery)[_0xb083('0x2e')](function(_0xecbbc8){handleQuery(_0x54e8c8[_0xb083('0x89')]());var _0x51cc0c=csv_results[0x0];if(!_['isEmpty'](_0x51cc0c)){var _0x43a06a=toCsv(_0x51cc0c);var _0xc4ab56=Date[_0xb083('0x8a')]();fs[_0xb083('0x8b')](util[_0xb083('0x75')](_0xb083('0x8c'),_0xfc37fd,_0xc4ab56),_0x43a06a);_0x2468ca[_0xb083('0x8d')](_0xb083('0x8e'),_0xb083('0x8f')+util['format']('list_%d_%s.csv',_0xfc37fd,_0xc4ab56));_0x2468ca['setHeader'](_0xb083('0x90'),_0xb083('0x91'));return _0x2468ca['download'](util['format'](_0xb083('0x8c'),_0xfc37fd,_0xc4ab56));}else{return _0x2468ca['sendStatus'](0xcc);}});});});};exports[_0xb083('0x92')]=function(_0x35d988,_0x4c3eba,_0x29c9fb){var _0x34d5b0;delete _0x35d988[_0xb083('0x54')]['id'];return db[_0xb083('0x4c')][_0xb083('0x62')]({'where':{'id':_0x35d988[_0xb083('0x50')]['id']}})[_0xb083('0x2e')](handleEntityNotFound(_0x4c3eba,null))[_0xb083('0x2e')](function(_0x3bfc3c){if(_0x3bfc3c){return db[_0xb083('0x93')][_0xb083('0x94')](function(_0x4cab26){return db[_0xb083('0x7a')][_0xb083('0x53')](_0x35d988['body'],{'transaction':_0x4cab26})[_0xb083('0x2e')](function(_0x248f49){_0x34d5b0=_0x248f49;return _0x3bfc3c[_0xb083('0x95')](_0x248f49,{'transaction':_0x4cab26});})[_0xb083('0x2e')](function(){var _0x646810={'type':db[_0xb083('0x96')][_0xb083('0x97')],'transaction':_0x4cab26};switch(_0x35d988[_0xb083('0x54')][_0xb083('0x47')]){case _0xb083('0x98'):_0x646810['type']=db['Sequelize']['TEXT'];break;case'number':_0x646810[_0xb083('0x47')]=db['Sequelize'][_0xb083('0x99')];break;case _0xb083('0x9a'):_0x646810[_0xb083('0x47')]=db[_0xb083('0x96')][_0xb083('0x9b')];_0x646810[_0xb083('0x9c')]=![];break;default:}return db[_0xb083('0x93')][_0xb083('0x9d')]['addColumn']('cm_contacts',util[_0xb083('0x75')](_0xb083('0x9e'),_0x34d5b0['id']),_0x646810);})['then'](function(){return _0x34d5b0;});});}})['then'](respondWithResult(_0x4c3eba,null))[_0xb083('0x4f')](handleError(_0x4c3eba,null));};exports[_0xb083('0x9f')]=function(_0xc275c7,_0x3ce74e,_0x1e7db9){var _0x7c86a6={};var _0x17dfa4={};var _0xdd673d;var _0x2a1e56;return db[_0xb083('0x4c')][_0xb083('0x62')]({'where':{'id':_0xc275c7[_0xb083('0x50')]['id']}})[_0xb083('0x2e')](handleEntityNotFound(_0x3ce74e,null))[_0xb083('0x2e')](function(_0x45d9df){if(_0x45d9df){_0xdd673d=_0x45d9df;_0x17dfa4[_0xb083('0x3f')]=_[_0xb083('0x3c')](db['CmCustomField'][_0xb083('0x38')]);_0x17dfa4[_0xb083('0x3b')]=_[_0xb083('0x3c')](_0xc275c7[_0xb083('0x3b')]);_0x17dfa4[_0xb083('0x3d')]=_[_0xb083('0x3e')](_0x17dfa4['model'],_0x17dfa4['query']);_0x7c86a6[_0xb083('0x40')]=_[_0xb083('0x3e')](_0x17dfa4[_0xb083('0x3f')],qs[_0xb083('0x41')](_0xc275c7[_0xb083('0x3b')]['fields']));_0x7c86a6[_0xb083('0x40')]=_0x7c86a6[_0xb083('0x40')][_0xb083('0x51')]?_0x7c86a6['attributes']:_0x17dfa4['model'];_0x7c86a6[_0xb083('0x63')]=qs[_0xb083('0x44')](_0xc275c7[_0xb083('0x3b')][_0xb083('0x44')]);_0x7c86a6[_0xb083('0x45')]=qs[_0xb083('0x3d')](_['pick'](_0xc275c7[_0xb083('0x3b')],_0x17dfa4[_0xb083('0x3d')]));_0x7c86a6[_0xb083('0x45')]=_['merge'](_0x7c86a6[_0xb083('0x45')],{'$or':[{'ListId':_0x45d9df['id']},{'ListId':null}]});if(_0xc275c7[_0xb083('0x3b')][_0xb083('0x48')]){_0x7c86a6['where']=_[_0xb083('0x46')](_0x7c86a6[_0xb083('0x45')],{'$or':_[_0xb083('0x37')](_0x7c86a6[_0xb083('0x40')],function(_0x3329c3){var _0x2db97f={};_0x2db97f[_0x3329c3]={'$like':'%'+_0xc275c7[_0xb083('0x3b')][_0xb083('0x48')]+'%'};return _0x2db97f;})});}_0x7c86a6=_[_0xb083('0x46')]({},_0x7c86a6,_0xc275c7[_0xb083('0x49')]);return db[_0xb083('0x7a')][_0xb083('0xa0')](_0x7c86a6);}})[_0xb083('0x2e')](respondWithResult(_0x3ce74e,null))['catch'](handleError(_0x3ce74e,null));};exports['getGlobalCustomFields']=function(_0x57cc66,_0x350220){return db[_0xb083('0x7a')][_0xb083('0xa0')]({'where':{'ListId':null}})[_0xb083('0x2e')](handleEntityNotFound(_0x350220,null))[_0xb083('0x2e')](function(_0x128ab7){return _0x128ab7;})[_0xb083('0x2e')](respondWithResult(_0x350220,null))[_0xb083('0x4f')](handleError(_0x350220,null));};exports[_0xb083('0xa1')]=function(_0x3b244a,_0x4523a1,_0x3afaa1){return db[_0xb083('0x4c')]['find']({'where':{'id':_0x3b244a['params']['id']}})['then'](handleEntityNotFound(_0x4523a1,null))['then'](function(_0x3f5d62){if(_0x3f5d62){return _0x3f5d62['addAgents'](_0x3b244a[_0xb083('0x54')]['ids'],_[_0xb083('0x6c')](_0x3b244a[_0xb083('0x54')],[_0xb083('0x66'),'id'])||{})['spread'](function(_0xe1568e){for(var _0x53b0b1=0x0;_0x53b0b1<_0x3b244a[_0xb083('0x54')][_0xb083('0x66')][_0xb083('0x51')];_0x53b0b1+=0x1){socket[_0xb083('0xa2')]('userCmList:save',{'UserId':Number(_0x3b244a[_0xb083('0x54')][_0xb083('0x66')][_0x53b0b1]),'CmListId':Number(_0x3b244a[_0xb083('0x50')]['id'])});}return _0xe1568e;});}})['then'](respondWithResult(_0x4523a1,null))['catch'](handleError(_0x4523a1,null));};exports[_0xb083('0xa3')]=function(_0x9ed5fa,_0x4d324e,_0x443881){return db[_0xb083('0x4c')]['find']({'where':{'id':_0x9ed5fa[_0xb083('0x50')]['id']}})[_0xb083('0x2e')](handleEntityNotFound(_0x4d324e,null))[_0xb083('0x2e')](function(_0xef3066){if(_0xef3066){return _0xef3066[_0xb083('0xa3')](_0x9ed5fa[_0xb083('0x3b')][_0xb083('0x66')])[_0xb083('0x2e')](function(){if(_[_0xb083('0x6a')](_0x9ed5fa[_0xb083('0x3b')][_0xb083('0x66')])){for(var _0x34383d=0x0;_0x34383d<_0x9ed5fa[_0xb083('0x3b')][_0xb083('0x66')]['length'];_0x34383d+=0x1){socket['emit'](_0xb083('0xa4'),{'UserId':Number(_0x9ed5fa['query'][_0xb083('0x66')][_0x34383d]),'CmListId':Number(_0x9ed5fa[_0xb083('0x50')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x9ed5fa[_0xb083('0x3b')][_0xb083('0x66')]),'CmListId':Number(_0x9ed5fa[_0xb083('0x50')]['id'])});}});}})[_0xb083('0x2e')](respondWithStatusCode(_0x4d324e,null))['catch'](handleError(_0x4d324e,null));};exports[_0xb083('0xa5')]=function(_0x35a4e0,_0x540d50,_0x12d0f8){var _0x26c517={};var _0x211e24={};var _0x2c0999;var _0x29ef7f;return db[_0xb083('0x4c')][_0xb083('0x62')]({'where':{'id':_0x35a4e0[_0xb083('0x50')]['id']}})[_0xb083('0x2e')](handleEntityNotFound(_0x540d50,null))[_0xb083('0x2e')](function(_0x3423d6){if(_0x3423d6){_0x2c0999=_0x3423d6;_0x211e24[_0xb083('0x3f')]=_[_0xb083('0x3c')](db[_0xb083('0xa6')][_0xb083('0x38')]);_0x211e24[_0xb083('0x3b')]=_['keys'](_0x35a4e0[_0xb083('0x3b')]);_0x211e24[_0xb083('0x3d')]=_[_0xb083('0x3e')](_0x211e24[_0xb083('0x3f')],_0x211e24[_0xb083('0x3b')]);_0x26c517[_0xb083('0x40')]=_[_0xb083('0x3e')](_0x211e24[_0xb083('0x3f')],qs['fields'](_0x35a4e0[_0xb083('0x3b')][_0xb083('0x41')]));_0x26c517[_0xb083('0x40')]=_0x26c517['attributes']['length']?_0x26c517[_0xb083('0x40')]:_0x211e24['model'];_0x26c517['order']=qs[_0xb083('0x44')](_0x35a4e0[_0xb083('0x3b')]['sort']);_0x26c517[_0xb083('0x45')]=qs[_0xb083('0x3d')](_[_0xb083('0x64')](_0x35a4e0[_0xb083('0x3b')],_0x211e24[_0xb083('0x3d')]));if(_0x35a4e0['query'][_0xb083('0x48')]){_0x26c517[_0xb083('0x45')]=_[_0xb083('0x46')](_0x26c517[_0xb083('0x45')],{'$or':_['map'](_0x26c517[_0xb083('0x40')],function(_0x2d5458){var _0x12b451={};_0x12b451[_0x2d5458]={'$like':'%'+_0x35a4e0[_0xb083('0x3b')][_0xb083('0x48')]+'%'};return _0x12b451;})});}_0x26c517=_[_0xb083('0x46')]({},_0x26c517,_0x35a4e0[_0xb083('0x49')]);return _0x2c0999[_0xb083('0xa5')](_0x26c517);}})[_0xb083('0x2e')](function(_0x291bc4){if(_0x291bc4){_0x29ef7f=_0x291bc4['length'];if(!_0x35a4e0[_0xb083('0x3b')]['hasOwnProperty'](_0xb083('0x43'))){_0x26c517[_0xb083('0x28')]=qs['limit'](_0x35a4e0[_0xb083('0x3b')][_0xb083('0x28')]);_0x26c517[_0xb083('0x26')]=qs[_0xb083('0x26')](_0x35a4e0[_0xb083('0x3b')][_0xb083('0x26')]);}return _0x2c0999['getAgents'](_0x26c517);}})[_0xb083('0x2e')](function(_0x3dcfff){if(_0x3dcfff){return _0x3dcfff?{'count':_0x29ef7f,'rows':_0x3dcfff}:null;}})[_0xb083('0x2e')](respondWithResult(_0x540d50,null))['catch'](handleError(_0x540d50,null));};function handleQuery(_0x22e2c4){logger['info'](_0x22e2c4);return db[_0xb083('0x93')][_0xb083('0x3b')](_0x22e2c4)[_0xb083('0xa7')](function(_0x1ab11d){csv_results['push'](_0x1ab11d);})['catch'](function(_0x400d53){logger[_0xb083('0x32')](_0x400d53[_0xb083('0x71')]);});} \ No newline at end of file +var _0x5127=['socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','CmList','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','include','rows','catch','show','intersection','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','autoAssociation','body','params','describe','addDisposition','getDispositions','findOne','Disposition','length','ListId','removeDispositions','ids','addContacts','tags','isArray','push','CmContact','omit','dataValues','errors','message','getContacts','CmCustomField','CustomFields','format','raw','getContactsCsv','OrderBy','findAll','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','each','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis'];(function(_0x1b90e0,_0x128583){var _0x2a26c4=function(_0x2a6e35){while(--_0x2a6e35){_0x1b90e0['push'](_0x1b90e0['shift']());}};_0x2a26c4(++_0x128583);}(_0x5127,0x1ca));var _0x7512=function(_0x4c00ea,_0x1cf606){_0x4c00ea=_0x4c00ea-0x0;var _0x2754b6=_0x5127[_0x4c00ea];return _0x2754b6;};'use strict';var emlformat=require(_0x7512('0x0'));var rimraf=require(_0x7512('0x1'));var zipdir=require(_0x7512('0x2'));var jsonpatch=require(_0x7512('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7512('0x4'));var Mustache=require(_0x7512('0x5'));var util=require(_0x7512('0x6'));var path=require(_0x7512('0x7'));var sox=require(_0x7512('0x8'));var csv=require(_0x7512('0x9'));var ejs=require(_0x7512('0xa'));var fs=require('fs');var fs_extra=require(_0x7512('0xb'));var _=require(_0x7512('0xc'));var squel=require(_0x7512('0xd'));var crypto=require(_0x7512('0xe'));var jsforce=require(_0x7512('0xf'));var deskjs=require(_0x7512('0x10'));var toCsv=require(_0x7512('0x9'));var querystring=require(_0x7512('0x11'));var Papa=require(_0x7512('0x12'));var Redis=require('ioredis');var authService=require(_0x7512('0x13'));var qs=require(_0x7512('0x14'));var as=require(_0x7512('0x15'));var hardwareService=require(_0x7512('0x16'));var logger=require(_0x7512('0x17'))(_0x7512('0x18'));var utils=require(_0x7512('0x19'));var config=require(_0x7512('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0x7512('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7512('0x1c'))(new Redis(config[_0x7512('0x1b')]));require(_0x7512('0x1d'))['register'](socket);function respondWithStatusCode(_0x2b2d4e,_0x19a1f2){_0x19a1f2=_0x19a1f2||0xcc;return function(_0x24289a){if(_0x24289a){return _0x2b2d4e[_0x7512('0x1e')](_0x19a1f2);}return _0x2b2d4e[_0x7512('0x1f')](_0x19a1f2)[_0x7512('0x20')]();};}function respondWithResult(_0x33e1e9,_0x25795f){_0x25795f=_0x25795f||0xc8;return function(_0x40a172){if(_0x40a172){return _0x33e1e9[_0x7512('0x1f')](_0x25795f)[_0x7512('0x21')](_0x40a172);}};}function respondWithFilteredResult(_0x560742,_0x4c4f34){return function(_0x13a2dd){if(_0x13a2dd){var _0x29b207=typeof _0x4c4f34[_0x7512('0x22')]===_0x7512('0x23')&&typeof _0x4c4f34[_0x7512('0x24')]==='undefined';var _0x529c09=_0x13a2dd[_0x7512('0x25')];var _0x5e41d8=_0x29b207?0x0:_0x4c4f34[_0x7512('0x22')];var _0x1bac69=_0x29b207?_0x13a2dd['count']:_0x4c4f34[_0x7512('0x22')]+_0x4c4f34[_0x7512('0x24')];var _0x3aa215;if(_0x1bac69>=_0x529c09){_0x1bac69=_0x529c09;_0x3aa215=0xc8;}else{_0x3aa215=0xce;}_0x560742[_0x7512('0x1f')](_0x3aa215);return _0x560742[_0x7512('0x26')]('Content-Range',_0x5e41d8+'-'+_0x1bac69+'/'+_0x529c09)[_0x7512('0x21')](_0x13a2dd);}return null;};}function patchUpdates(_0x562aa0){return function(_0x39b7f6){try{jsonpatch[_0x7512('0x27')](_0x39b7f6,_0x562aa0,!![]);}catch(_0x3d933c){return BPromise[_0x7512('0x28')](_0x3d933c);}return _0x39b7f6[_0x7512('0x29')]();};}function saveUpdates(_0x430135,_0x341cb9){return function(_0x178127){if(_0x178127){return _0x178127[_0x7512('0x2a')](_0x430135)[_0x7512('0x2b')](function(_0xa95fa3){return _0xa95fa3;});}return null;};}function removeEntity(_0x2cfe42,_0x17f752){return function(_0x1c7834){if(_0x1c7834){return _0x1c7834[_0x7512('0x2c')]()[_0x7512('0x2b')](function(){var _0x321c99=_0x1c7834[_0x7512('0x2d')]({'plain':!![]});var _0x3fcf8b='Lists';return db[_0x7512('0x2e')]['destroy']({'where':{'type':_0x3fcf8b,'resourceId':_0x321c99['id']}})[_0x7512('0x2b')](function(){return _0x1c7834;});})[_0x7512('0x2b')](function(){_0x2cfe42[_0x7512('0x1f')](0xcc)[_0x7512('0x20')]();});}};}function handleEntityNotFound(_0x2bb7ab,_0x122122){return function(_0x3754d4){if(!_0x3754d4){_0x2bb7ab[_0x7512('0x1e')](0x194);}return _0x3754d4;};}function handleError(_0x26e13e,_0x5196af){_0x5196af=_0x5196af||0x1f4;return function(_0x543c91){logger[_0x7512('0x2f')](_0x543c91['stack']);if(_0x543c91[_0x7512('0x30')]){delete _0x543c91['name'];}_0x26e13e['status'](_0x5196af)['send'](_0x543c91);};}exports[_0x7512('0x31')]=function(_0x2dedc7,_0x52df1d){var _0x1a4305={},_0x2bc1b3={},_0x282f13={'count':0x0,'rows':[]};var _0x105b60=_[_0x7512('0x32')](db[_0x7512('0x33')][_0x7512('0x34')],function(_0x2802e8){return{'name':_0x2802e8[_0x7512('0x35')],'type':_0x2802e8['type']['key']};});_0x2bc1b3[_0x7512('0x36')]=_['map'](_0x105b60,'name');_0x2bc1b3[_0x7512('0x37')]=_[_0x7512('0x38')](_0x2dedc7['query']);_0x2bc1b3[_0x7512('0x39')]=_['intersection'](_0x2bc1b3[_0x7512('0x36')],_0x2bc1b3[_0x7512('0x37')]);_0x1a4305[_0x7512('0x3a')]=_['intersection'](_0x2bc1b3['model'],qs[_0x7512('0x3b')](_0x2dedc7[_0x7512('0x37')][_0x7512('0x3b')]));_0x1a4305[_0x7512('0x3a')]=_0x1a4305['attributes']['length']?_0x1a4305['attributes']:_0x2bc1b3[_0x7512('0x36')];if(!_0x2dedc7['query'][_0x7512('0x3c')](_0x7512('0x3d'))){_0x1a4305['limit']=qs['limit'](_0x2dedc7['query']['limit']);_0x1a4305[_0x7512('0x22')]=qs[_0x7512('0x22')](_0x2dedc7[_0x7512('0x37')]['offset']);}_0x1a4305[_0x7512('0x3e')]=qs[_0x7512('0x3f')](_0x2dedc7[_0x7512('0x37')][_0x7512('0x3f')]);_0x1a4305[_0x7512('0x40')]=qs[_0x7512('0x39')](_[_0x7512('0x41')](_0x2dedc7[_0x7512('0x37')],_0x2bc1b3[_0x7512('0x39')]),_0x105b60);if(_0x2dedc7[_0x7512('0x37')]['filter']){_0x1a4305['where']=_[_0x7512('0x42')](_0x1a4305['where'],{'$or':_[_0x7512('0x32')](_0x105b60,function(_0x36f64d){if(_0x36f64d[_0x7512('0x43')]!=='VIRTUAL'){var _0x46f9c4={};_0x46f9c4[_0x36f64d[_0x7512('0x30')]]={'$like':'%'+_0x2dedc7[_0x7512('0x37')][_0x7512('0x44')]+'%'};return _0x46f9c4;}})});}_0x1a4305=_[_0x7512('0x42')]({},_0x1a4305,_0x2dedc7[_0x7512('0x45')]);var _0x50b33d={'where':_0x1a4305[_0x7512('0x40')]};return db['CmList']['count'](_0x50b33d)[_0x7512('0x2b')](function(_0x5bab7b){_0x282f13[_0x7512('0x25')]=_0x5bab7b;if(_0x2dedc7[_0x7512('0x37')]['includeAll']){_0x1a4305[_0x7512('0x46')]=[{'all':!![]}];}return db[_0x7512('0x33')]['findAll'](_0x1a4305);})[_0x7512('0x2b')](function(_0x325372){_0x282f13[_0x7512('0x47')]=_0x325372;return _0x282f13;})['then'](respondWithFilteredResult(_0x52df1d,_0x1a4305))[_0x7512('0x48')](handleError(_0x52df1d,null));};exports[_0x7512('0x49')]=function(_0x270b67,_0x1f0e69){var _0x541a99={'raw':![],'where':{'id':_0x270b67['params']['id']}},_0xaff8ef={};_0xaff8ef[_0x7512('0x36')]=_[_0x7512('0x38')](db['CmList'][_0x7512('0x34')]);_0xaff8ef['query']=_[_0x7512('0x38')](_0x270b67[_0x7512('0x37')]);_0xaff8ef['filters']=_[_0x7512('0x4a')](_0xaff8ef[_0x7512('0x36')],_0xaff8ef[_0x7512('0x37')]);_0x541a99[_0x7512('0x3a')]=_[_0x7512('0x4a')](_0xaff8ef[_0x7512('0x36')],qs[_0x7512('0x3b')](_0x270b67[_0x7512('0x37')][_0x7512('0x3b')]));_0x541a99[_0x7512('0x3a')]=_0x541a99[_0x7512('0x3a')]['length']?_0x541a99[_0x7512('0x3a')]:_0xaff8ef[_0x7512('0x36')];if(_0x270b67[_0x7512('0x37')][_0x7512('0x4b')]){_0x541a99[_0x7512('0x46')]=[{'all':!![]}];}_0x541a99=_[_0x7512('0x42')]({},_0x541a99,_0x270b67[_0x7512('0x45')]);return db[_0x7512('0x33')][_0x7512('0x4c')](_0x541a99)[_0x7512('0x2b')](handleEntityNotFound(_0x1f0e69,null))['then'](respondWithResult(_0x1f0e69,null))[_0x7512('0x48')](handleError(_0x1f0e69,null));};exports[_0x7512('0x4d')]=function(_0x2b8178,_0x48f788){return db[_0x7512('0x33')][_0x7512('0x4d')](_0x2b8178['body'],{})[_0x7512('0x2b')](function(_0x32053d){var _0x5f5752=_0x2b8178[_0x7512('0x4e')]['get']({'plain':!![]});if(!_0x5f5752)throw new Error(_0x7512('0x4f'));if(_0x5f5752[_0x7512('0x50')]===_0x7512('0x4e')){var _0x434c4f=_0x32053d[_0x7512('0x2d')]({'plain':!![]});var _0x519b0c=_0x7512('0x51');return db[_0x7512('0x52')][_0x7512('0x4c')]({'where':{'name':_0x519b0c,'userProfileId':_0x5f5752['userProfileId']},'raw':!![]})['then'](function(_0x38ee31){if(_0x38ee31&&_0x38ee31[_0x7512('0x53')]===0x0){return db[_0x7512('0x2e')][_0x7512('0x4d')]({'name':_0x434c4f[_0x7512('0x30')],'resourceId':_0x434c4f['id'],'type':_0x38ee31[_0x7512('0x30')],'sectionId':_0x38ee31['id']},{})['then'](function(){return _0x32053d;});}else{return _0x32053d;}})[_0x7512('0x48')](function(_0x226a80){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x226a80);throw _0x226a80;});}return _0x32053d;})[_0x7512('0x2b')](respondWithResult(_0x48f788,0xc9))[_0x7512('0x48')](handleError(_0x48f788,null));};exports[_0x7512('0x2a')]=function(_0x3816ef,_0x2b74e7){if(_0x3816ef[_0x7512('0x54')]['id']){delete _0x3816ef[_0x7512('0x54')]['id'];}return db[_0x7512('0x33')][_0x7512('0x4c')]({'where':{'id':_0x3816ef['params']['id']}})[_0x7512('0x2b')](handleEntityNotFound(_0x2b74e7,null))[_0x7512('0x2b')](saveUpdates(_0x3816ef[_0x7512('0x54')],null))['then'](respondWithResult(_0x2b74e7,null))[_0x7512('0x48')](handleError(_0x2b74e7,null));};exports[_0x7512('0x2c')]=function(_0x2a0525,_0x478a44){return db[_0x7512('0x33')][_0x7512('0x4c')]({'where':{'id':_0x2a0525[_0x7512('0x55')]['id']}})['then'](handleEntityNotFound(_0x478a44,null))[_0x7512('0x2b')](removeEntity(_0x478a44,null))[_0x7512('0x48')](handleError(_0x478a44,null));};exports[_0x7512('0x56')]=function(_0x587487,_0x1f388e){return db[_0x7512('0x33')][_0x7512('0x56')]()['then'](respondWithResult(_0x1f388e,null))[_0x7512('0x48')](handleError(_0x1f388e,null));};exports[_0x7512('0x57')]=function(_0x2f1e6a,_0x1a5da1,_0x278d8e){if(_0x2f1e6a['body']['id']){delete _0x2f1e6a[_0x7512('0x54')]['id'];}return db[_0x7512('0x33')][_0x7512('0x4c')]({'where':{'id':_0x2f1e6a[_0x7512('0x55')]['id']}})['then'](handleEntityNotFound(_0x1a5da1,null))[_0x7512('0x2b')](function(_0x1f40e6){if(_0x1f40e6){_0x2f1e6a[_0x7512('0x54')]['ListId']=_0x1f40e6['id'];return db['Disposition'][_0x7512('0x4d')](_0x2f1e6a[_0x7512('0x54')]);}})[_0x7512('0x2b')](respondWithResult(_0x1a5da1,null))[_0x7512('0x48')](handleError(_0x1a5da1,null));};exports[_0x7512('0x58')]=function(_0x5924fb,_0x25f090,_0x3500e7){var _0x27092a={'raw':![],'where':{}};var _0x434d55={};var _0x14a989={'count':0x0,'rows':[]};return db[_0x7512('0x33')][_0x7512('0x59')]({'where':{'id':_0x5924fb['params']['id']}})[_0x7512('0x2b')](handleEntityNotFound(_0x25f090,null))[_0x7512('0x2b')](function(_0x30cfe9){if(_0x30cfe9){_0x434d55[_0x7512('0x36')]=_['keys'](db[_0x7512('0x5a')]['rawAttributes']);_0x434d55[_0x7512('0x37')]=_[_0x7512('0x38')](_0x5924fb['query']);_0x434d55[_0x7512('0x39')]=_['intersection'](_0x434d55[_0x7512('0x36')],_0x434d55[_0x7512('0x37')]);_0x27092a[_0x7512('0x3a')]=_['intersection'](_0x434d55[_0x7512('0x36')],qs[_0x7512('0x3b')](_0x5924fb['query'][_0x7512('0x3b')]));_0x27092a[_0x7512('0x3a')]=_0x27092a['attributes'][_0x7512('0x5b')]?_0x27092a[_0x7512('0x3a')]:_0x434d55[_0x7512('0x36')];if(!_0x5924fb[_0x7512('0x37')][_0x7512('0x3c')]('nolimit')){_0x27092a[_0x7512('0x24')]=qs[_0x7512('0x24')](_0x5924fb[_0x7512('0x37')][_0x7512('0x24')]);_0x27092a['offset']=qs[_0x7512('0x22')](_0x5924fb[_0x7512('0x37')][_0x7512('0x22')]);}_0x27092a[_0x7512('0x3e')]=qs['sort'](_0x5924fb[_0x7512('0x37')]['sort']);_0x27092a[_0x7512('0x40')]=qs['filters'](_[_0x7512('0x41')](_0x5924fb['query'],_0x434d55[_0x7512('0x39')]));_0x27092a[_0x7512('0x40')][_0x7512('0x5c')]=_0x30cfe9['id'];if(_0x5924fb['query']['filter']){_0x27092a[_0x7512('0x40')]=_['merge'](_0x27092a['where'],{'$or':_[_0x7512('0x32')](_0x27092a[_0x7512('0x3a')],function(_0xc544e7){var _0x4c8ec8={};_0x4c8ec8[_0xc544e7]={'$like':'%'+_0x5924fb['query'][_0x7512('0x44')]+'%'};return _0x4c8ec8;})});}_0x27092a=_[_0x7512('0x42')]({},_0x27092a,_0x5924fb[_0x7512('0x45')]);return db[_0x7512('0x5a')][_0x7512('0x25')]({'where':_0x27092a[_0x7512('0x40')]})['then'](function(_0x2f8f88){_0x14a989[_0x7512('0x25')]=_0x2f8f88;if(_0x5924fb[_0x7512('0x37')]['includeAll']){_0x27092a['include']=[{'all':!![]}];}return db[_0x7512('0x5a')]['findAll'](_0x27092a);})['then'](function(_0x2d56ed){_0x14a989['rows']=_0x2d56ed;return _0x14a989;});}})[_0x7512('0x2b')](respondWithFilteredResult(_0x25f090,_0x27092a))['catch'](handleError(_0x25f090,null));};exports[_0x7512('0x5d')]=function(_0x561de6,_0xe7b0cc,_0x2f4eeb){return db[_0x7512('0x33')][_0x7512('0x4c')]({'where':{'id':_0x561de6[_0x7512('0x55')]['id']}})['then'](handleEntityNotFound(_0xe7b0cc,null))[_0x7512('0x2b')](function(_0x578514){if(_0x578514){return _0x578514['removeDispositions'](_0x561de6[_0x7512('0x37')][_0x7512('0x5e')]);}})['then'](respondWithStatusCode(_0xe7b0cc,null))[_0x7512('0x48')](handleError(_0xe7b0cc,null));};exports[_0x7512('0x5f')]=function(_0x583caf,_0x30a262,_0x3d943c){return db[_0x7512('0x33')]['find']({'where':{'id':_0x583caf[_0x7512('0x55')]['id']}})['then'](handleEntityNotFound(_0x30a262,null))[_0x7512('0x2b')](function(_0x5b4c49){if(_0x5b4c49){var _0x30c909=[];var _0x5dd31b={'success':[],'errors':[]};return db['CmContact'][_0x7512('0x56')]()[_0x7512('0x2b')](function(_0x21f4fa){if(_0x583caf['body'][_0x7512('0x60')]&&_['isArray'](_0x583caf[_0x7512('0x54')][_0x7512('0x60')])){if(_0x583caf[_0x7512('0x54')][_0x7512('0x60')][_0x7512('0x5b')]){_0x583caf['body'][_0x7512('0x60')]=_0x583caf['body']['tags']['join'](';')+';';}else{_0x583caf['body'][_0x7512('0x60')]=null;}}else{_0x583caf[_0x7512('0x54')][_0x7512('0x60')]=null;}if(_0x583caf['body']&&_[_0x7512('0x61')](_0x583caf[_0x7512('0x54')])){for(var _0x477aeb=0x0;_0x477aeb<_0x583caf[_0x7512('0x54')][_0x7512('0x5b')];_0x477aeb+=0x1){_0x583caf[_0x7512('0x54')][_0x477aeb]['ListId']=_0x583caf[_0x7512('0x55')]['id'];_0x30c909[_0x7512('0x62')](_0x583caf[_0x7512('0x54')][_0x477aeb]);}return BPromise['each'](_0x30c909,function(_0xcb3301){return db[_0x7512('0x63')][_0x7512('0x4d')](_[_0x7512('0x64')](_0xcb3301,['ids','id'])||{},{'fields':_['keys'](_0x21f4fa),'raw':!![]})[_0x7512('0x2b')](function(_0x297031){_0x5dd31b['success']['push'](_0x297031[_0x7512('0x65')]);})['catch'](function(_0x1a5369){_0x5dd31b[_0x7512('0x66')]['push']({'data':_0xcb3301,'error':_0x1a5369[_0x7512('0x67')]});});})[_0x7512('0x2b')](function(_0x22e400){return _0x5dd31b;})[_0x7512('0x48')](function(_0x2d6337){return _0x2d6337;});}else{_0x30a262[_0x7512('0x1f')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x30a262,null))[_0x7512('0x48')](handleError(_0x30a262,null));};exports[_0x7512('0x68')]=function(_0x2f0d22,_0x418f82,_0x30df13){var _0x4a75c2;return db[_0x7512('0x33')][_0x7512('0x4c')]({'where':{'id':_0x2f0d22[_0x7512('0x55')]['id']},'include':[{'model':db[_0x7512('0x69')],'as':_0x7512('0x6a')}]})[_0x7512('0x2b')](handleEntityNotFound(_0x418f82,null))[_0x7512('0x2b')](function(_0x1c7d5b){if(_0x1c7d5b){_0x4a75c2=_0x1c7d5b;return db[_0x7512('0x63')][_0x7512('0x34')];}})['then'](function(_0x24f84c){if(_0x24f84c){var _0x11b943={};var _0x1d7767={};_0x1d7767[_0x7512('0x36')]=_['concat'](_[_0x7512('0x38')](_0x24f84c),_[_0x7512('0x32')](_0x4a75c2[_0x7512('0x6a')],function(_0x10da33){return util[_0x7512('0x6b')]('cf_%d',_0x10da33['id']);}));_0x1d7767[_0x7512('0x37')]=_['keys'](_0x2f0d22[_0x7512('0x37')]);_0x1d7767[_0x7512('0x39')]=_[_0x7512('0x4a')](_0x1d7767['model'],_0x1d7767[_0x7512('0x37')]);_0x11b943[_0x7512('0x3a')]=_['intersection'](_0x1d7767[_0x7512('0x36')],qs[_0x7512('0x3b')](_0x2f0d22[_0x7512('0x37')]['fields']));_0x11b943[_0x7512('0x3a')]=_0x11b943[_0x7512('0x3a')][_0x7512('0x5b')]?_0x11b943[_0x7512('0x3a')]:_0x1d7767[_0x7512('0x36')];if(!_0x2f0d22[_0x7512('0x37')][_0x7512('0x3c')](_0x7512('0x3d'))){_0x11b943[_0x7512('0x24')]=qs[_0x7512('0x24')](_0x2f0d22['query'][_0x7512('0x24')]);_0x11b943[_0x7512('0x22')]=qs[_0x7512('0x22')](_0x2f0d22[_0x7512('0x37')]['offset']);}_0x11b943[_0x7512('0x3e')]=qs[_0x7512('0x3f')](_0x2f0d22[_0x7512('0x37')][_0x7512('0x3f')]);_0x11b943[_0x7512('0x40')]=qs[_0x7512('0x39')](_[_0x7512('0x41')](_0x2f0d22[_0x7512('0x37')],_0x1d7767[_0x7512('0x39')]));_0x11b943[_0x7512('0x6c')]=!![];if(_0x2f0d22[_0x7512('0x37')][_0x7512('0x44')]){_0x11b943[_0x7512('0x40')]=_[_0x7512('0x42')](_0x11b943['where'],{'$or':_[_0x7512('0x32')](_0x11b943[_0x7512('0x3a')],function(_0x5e375f){var _0x2b6ff7={};_0x2b6ff7[_0x5e375f]={'$like':'%'+_0x2f0d22[_0x7512('0x37')][_0x7512('0x44')]+'%'};return _0x2b6ff7;})});}_0x11b943=_[_0x7512('0x42')]({},_0x11b943,_0x2f0d22[_0x7512('0x45')]);return _0x4a75c2[_0x7512('0x68')](_0x11b943);}})[_0x7512('0x2b')](respondWithResult(_0x418f82,null))[_0x7512('0x48')](handleError(_0x418f82,null));};exports[_0x7512('0x6d')]=function(_0x1e62e4,_0x2419c4,_0x5de5e6){var _0x40593e;var _0x196edd;var _0x323118;var _0x4e0b8b=_0x1e62e4['params']['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id','name'],'raw':!![],'order':[_0x7512('0x6e')]})[_0x7512('0x2b')](function(_0x485999){_0x40593e=_0x485999;var _0xa3fc75=_['keys'](db[_0x7512('0x63')][_0x7512('0x34')]);return db[_0x7512('0x69')][_0x7512('0x6f')]({'raw':!![],'attributes':['id',_0x7512('0x70')]})[_0x7512('0x2b')](function(_0x56c314){_0x196edd=_0x56c314;var _0x21ee96=squel['select']()[_0x7512('0x3b')](_0xa3fc75)[_0x7512('0x71')](_0x7512('0x72'),'c')[_0x7512('0x40')](_0x7512('0x73'),_0x4e0b8b)[_0x7512('0x40')](_0x7512('0x74'))[_0x7512('0x75')]();for(var _0x900a9e=0x0;_0x900a9e<_0x196edd['length'];_0x900a9e++){_0x21ee96[_0x7512('0x76')](_0x7512('0x77')+_0x196edd[_0x900a9e]['id'],_0x7512('0x78')+_0x196edd[_0x900a9e][_0x7512('0x70')]);}for(var _0x900a9e=0x0;_0x900a9e<_0x40593e['length'];_0x900a9e++){_0x21ee96[_0x7512('0x76')](squel[_0x7512('0x79')]()[_0x7512('0x76')](_0x7512('0x7a'))[_0x7512('0x71')](_0x7512('0x7b'))[_0x7512('0x40')](_0x7512('0x7c'),_0x40593e[_0x900a9e]['id'])['where'](_0x7512('0x7d')),_0x7512('0x7e')+_0x40593e[_0x900a9e][_0x7512('0x30')]);_0x21ee96['field'](squel[_0x7512('0x79')]()[_0x7512('0x76')](_0x7512('0x7f'))[_0x7512('0x71')](_0x7512('0x7b'))[_0x7512('0x40')](_0x7512('0x7c'),_0x40593e[_0x900a9e]['id'])[_0x7512('0x40')](_0x7512('0x7d')),'description_additionalPhone_'+_0x40593e[_0x900a9e]['name']);}var _0x50239a=[];_0x50239a[_0x7512('0x62')](_0x21ee96[_0x7512('0x80')]());BPromise[_0x7512('0x81')](_0x50239a,handleQuery)[_0x7512('0x2b')](function(_0x18495b){handleQuery(_0x21ee96['toString']());var _0x5ede1a=csv_results[0x0];if(!_[_0x7512('0x82')](_0x5ede1a)){var _0x3df531=toCsv(_0x5ede1a);var _0x33fbaa=Date['now']();fs['writeFileSync'](util[_0x7512('0x6b')](_0x7512('0x83'),_0x4e0b8b,_0x33fbaa),_0x3df531);_0x2419c4[_0x7512('0x84')](_0x7512('0x85'),_0x7512('0x86')+util[_0x7512('0x6b')](_0x7512('0x87'),_0x4e0b8b,_0x33fbaa));_0x2419c4[_0x7512('0x84')](_0x7512('0x88'),_0x7512('0x89'));return _0x2419c4[_0x7512('0x8a')](util[_0x7512('0x6b')](_0x7512('0x83'),_0x4e0b8b,_0x33fbaa));}else{return _0x2419c4[_0x7512('0x1e')](0xcc);}});});});};exports[_0x7512('0x8b')]=function(_0x29066b,_0x13aeb2,_0x1635a4){var _0x38f097;delete _0x29066b[_0x7512('0x54')]['id'];return db['CmList']['findOne']({'where':{'id':_0x29066b[_0x7512('0x55')]['id']}})[_0x7512('0x2b')](handleEntityNotFound(_0x13aeb2,null))['then'](function(_0x5e8ecd){if(_0x5e8ecd){return db[_0x7512('0x8c')]['transaction'](function(_0x3f2d6c){return db[_0x7512('0x69')][_0x7512('0x4d')](_0x29066b['body'],{'transaction':_0x3f2d6c})[_0x7512('0x2b')](function(_0xdd98f8){_0x38f097=_0xdd98f8;return _0x5e8ecd['addCustomFields'](_0xdd98f8,{'transaction':_0x3f2d6c});})['then'](function(){var _0x51a28c={'type':db[_0x7512('0x8d')][_0x7512('0x8e')],'transaction':_0x3f2d6c};switch(_0x29066b[_0x7512('0x54')][_0x7512('0x43')]){case _0x7512('0x8f'):_0x51a28c['type']=db[_0x7512('0x8d')][_0x7512('0x8e')];break;case _0x7512('0x90'):_0x51a28c[_0x7512('0x43')]=db['Sequelize'][_0x7512('0x91')];break;case _0x7512('0x92'):_0x51a28c[_0x7512('0x43')]=db[_0x7512('0x8d')][_0x7512('0x93')];_0x51a28c['defaultValue']=![];break;default:}return db['sequelize'][_0x7512('0x94')]['addColumn'](_0x7512('0x72'),util['format'](_0x7512('0x95'),_0x38f097['id']),_0x51a28c);})[_0x7512('0x2b')](function(){return _0x38f097;});});}})[_0x7512('0x2b')](respondWithResult(_0x13aeb2,null))[_0x7512('0x48')](handleError(_0x13aeb2,null));};exports[_0x7512('0x96')]=function(_0x5e0d2c,_0x3fa070,_0x11bcd1){var _0x7305f6={};var _0x2e273a={};var _0x2b2fd6;var _0x553138;return db['CmList'][_0x7512('0x59')]({'where':{'id':_0x5e0d2c[_0x7512('0x55')]['id']}})['then'](handleEntityNotFound(_0x3fa070,null))[_0x7512('0x2b')](function(_0x15cb00){if(_0x15cb00){_0x2b2fd6=_0x15cb00;_0x2e273a['model']=_['keys'](db[_0x7512('0x69')]['rawAttributes']);_0x2e273a[_0x7512('0x37')]=_[_0x7512('0x38')](_0x5e0d2c[_0x7512('0x37')]);_0x2e273a[_0x7512('0x39')]=_[_0x7512('0x4a')](_0x2e273a[_0x7512('0x36')],_0x2e273a['query']);_0x7305f6[_0x7512('0x3a')]=_['intersection'](_0x2e273a[_0x7512('0x36')],qs[_0x7512('0x3b')](_0x5e0d2c[_0x7512('0x37')][_0x7512('0x3b')]));_0x7305f6[_0x7512('0x3a')]=_0x7305f6['attributes'][_0x7512('0x5b')]?_0x7305f6[_0x7512('0x3a')]:_0x2e273a[_0x7512('0x36')];_0x7305f6[_0x7512('0x3e')]=qs[_0x7512('0x3f')](_0x5e0d2c[_0x7512('0x37')]['sort']);_0x7305f6[_0x7512('0x40')]=qs[_0x7512('0x39')](_[_0x7512('0x41')](_0x5e0d2c[_0x7512('0x37')],_0x2e273a[_0x7512('0x39')]));_0x7305f6[_0x7512('0x40')]=_['merge'](_0x7305f6['where'],{'$or':[{'ListId':_0x15cb00['id']},{'ListId':null}]});if(_0x5e0d2c[_0x7512('0x37')][_0x7512('0x44')]){_0x7305f6['where']=_[_0x7512('0x42')](_0x7305f6[_0x7512('0x40')],{'$or':_[_0x7512('0x32')](_0x7305f6['attributes'],function(_0x3da04a){var _0x22b483={};_0x22b483[_0x3da04a]={'$like':'%'+_0x5e0d2c[_0x7512('0x37')]['filter']+'%'};return _0x22b483;})});}_0x7305f6=_[_0x7512('0x42')]({},_0x7305f6,_0x5e0d2c[_0x7512('0x45')]);return db[_0x7512('0x69')]['findAndCountAll'](_0x7305f6);}})[_0x7512('0x2b')](respondWithResult(_0x3fa070,null))['catch'](handleError(_0x3fa070,null));};exports[_0x7512('0x97')]=function(_0x43324f,_0x33c5c0){return db[_0x7512('0x69')][_0x7512('0x98')]({'where':{'ListId':null}})[_0x7512('0x2b')](handleEntityNotFound(_0x33c5c0,null))['then'](function(_0x494168){return _0x494168;})[_0x7512('0x2b')](respondWithResult(_0x33c5c0,null))[_0x7512('0x48')](handleError(_0x33c5c0,null));};exports['addAgents']=function(_0x40013e,_0xa88c3f,_0x26b05d){return db[_0x7512('0x33')][_0x7512('0x4c')]({'where':{'id':_0x40013e[_0x7512('0x55')]['id']}})['then'](handleEntityNotFound(_0xa88c3f,null))[_0x7512('0x2b')](function(_0x433172){if(_0x433172){return _0x433172[_0x7512('0x99')](_0x40013e['body'][_0x7512('0x5e')],_[_0x7512('0x64')](_0x40013e[_0x7512('0x54')],[_0x7512('0x5e'),'id'])||{})[_0x7512('0x9a')](function(_0x1b56ba){for(var _0x4c8e2d=0x0;_0x4c8e2d<_0x40013e[_0x7512('0x54')][_0x7512('0x5e')][_0x7512('0x5b')];_0x4c8e2d+=0x1){socket['emit'](_0x7512('0x9b'),{'UserId':Number(_0x40013e[_0x7512('0x54')][_0x7512('0x5e')][_0x4c8e2d]),'CmListId':Number(_0x40013e[_0x7512('0x55')]['id'])});}return _0x1b56ba;});}})[_0x7512('0x2b')](respondWithResult(_0xa88c3f,null))['catch'](handleError(_0xa88c3f,null));};exports[_0x7512('0x9c')]=function(_0x56b1c0,_0x269e03,_0x20c73b){return db['CmList'][_0x7512('0x4c')]({'where':{'id':_0x56b1c0[_0x7512('0x55')]['id']}})[_0x7512('0x2b')](handleEntityNotFound(_0x269e03,null))['then'](function(_0x35e9f1){if(_0x35e9f1){return _0x35e9f1['removeAgents'](_0x56b1c0[_0x7512('0x37')][_0x7512('0x5e')])['then'](function(){if(_['isArray'](_0x56b1c0[_0x7512('0x37')][_0x7512('0x5e')])){for(var _0x3f314e=0x0;_0x3f314e<_0x56b1c0[_0x7512('0x37')][_0x7512('0x5e')][_0x7512('0x5b')];_0x3f314e+=0x1){socket[_0x7512('0x9d')](_0x7512('0x9e'),{'UserId':Number(_0x56b1c0[_0x7512('0x37')][_0x7512('0x5e')][_0x3f314e]),'CmListId':Number(_0x56b1c0[_0x7512('0x55')]['id'])});}}else{socket[_0x7512('0x9d')](_0x7512('0x9e'),{'UserId':Number(_0x56b1c0[_0x7512('0x37')][_0x7512('0x5e')]),'CmListId':Number(_0x56b1c0['params']['id'])});}});}})[_0x7512('0x2b')](respondWithStatusCode(_0x269e03,null))['catch'](handleError(_0x269e03,null));};exports[_0x7512('0x9f')]=function(_0x1cf8ef,_0x13fa5a,_0x41e394){var _0x48f5a7={};var _0x38a83f={};var _0x85ac2b;var _0x208b9d;return db[_0x7512('0x33')]['findOne']({'where':{'id':_0x1cf8ef[_0x7512('0x55')]['id']}})[_0x7512('0x2b')](handleEntityNotFound(_0x13fa5a,null))[_0x7512('0x2b')](function(_0x5b48fd){if(_0x5b48fd){_0x85ac2b=_0x5b48fd;_0x38a83f['model']=_[_0x7512('0x38')](db[_0x7512('0xa0')][_0x7512('0x34')]);_0x38a83f['query']=_[_0x7512('0x38')](_0x1cf8ef[_0x7512('0x37')]);_0x38a83f['filters']=_[_0x7512('0x4a')](_0x38a83f['model'],_0x38a83f['query']);_0x48f5a7[_0x7512('0x3a')]=_[_0x7512('0x4a')](_0x38a83f[_0x7512('0x36')],qs['fields'](_0x1cf8ef['query'][_0x7512('0x3b')]));_0x48f5a7['attributes']=_0x48f5a7[_0x7512('0x3a')][_0x7512('0x5b')]?_0x48f5a7[_0x7512('0x3a')]:_0x38a83f[_0x7512('0x36')];_0x48f5a7[_0x7512('0x3e')]=qs['sort'](_0x1cf8ef[_0x7512('0x37')][_0x7512('0x3f')]);_0x48f5a7[_0x7512('0x40')]=qs[_0x7512('0x39')](_['pick'](_0x1cf8ef['query'],_0x38a83f['filters']));if(_0x1cf8ef[_0x7512('0x37')][_0x7512('0x44')]){_0x48f5a7[_0x7512('0x40')]=_[_0x7512('0x42')](_0x48f5a7[_0x7512('0x40')],{'$or':_[_0x7512('0x32')](_0x48f5a7[_0x7512('0x3a')],function(_0x1040c6){var _0x3e7f54={};_0x3e7f54[_0x1040c6]={'$like':'%'+_0x1cf8ef['query'][_0x7512('0x44')]+'%'};return _0x3e7f54;})});}_0x48f5a7=_['merge']({},_0x48f5a7,_0x1cf8ef[_0x7512('0x45')]);return _0x85ac2b['getAgents'](_0x48f5a7);}})['then'](function(_0x1f150a){if(_0x1f150a){_0x208b9d=_0x1f150a[_0x7512('0x5b')];if(!_0x1cf8ef[_0x7512('0x37')][_0x7512('0x3c')]('nolimit')){_0x48f5a7[_0x7512('0x24')]=qs[_0x7512('0x24')](_0x1cf8ef[_0x7512('0x37')][_0x7512('0x24')]);_0x48f5a7['offset']=qs[_0x7512('0x22')](_0x1cf8ef[_0x7512('0x37')][_0x7512('0x22')]);}return _0x85ac2b[_0x7512('0x9f')](_0x48f5a7);}})[_0x7512('0x2b')](function(_0x10e60e){if(_0x10e60e){return _0x10e60e?{'count':_0x208b9d,'rows':_0x10e60e}:null;}})[_0x7512('0x2b')](respondWithResult(_0x13fa5a,null))[_0x7512('0x48')](handleError(_0x13fa5a,null));};function handleQuery(_0x42f736){logger[_0x7512('0xa1')](_0x42f736);return db[_0x7512('0x8c')]['query'](_0x42f736)[_0x7512('0x9a')](function(_0x2ec99b){csv_results[_0x7512('0x62')](_0x2ec99b);})[_0x7512('0x48')](function(_0x3472c5){logger[_0x7512('0x2f')](_0x3472c5['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f66984b..30d9bce 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(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x4f96ec,_0x203eec){var _0x52f867=function(_0x504b5b){while(--_0x504b5b){_0x4f96ec['push'](_0x4f96ec['shift']());}};_0x52f867(++_0x203eec);}(_0x814b,0x1a2));var _0xb814=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0x814b[_0x4d2263];return _0x24aba0;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4deb3f3..7852225 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 _0xd2ea=['cm_lists','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0x435150,_0x591cd9){var _0x13b3a4=function(_0x44eb28){while(--_0x44eb28){_0x435150['push'](_0x435150['shift']());}};_0x13b3a4(++_0x591cd9);}(_0xd2ea,0x15f));var _0xad2e=function(_0x51a9b6,_0x1fdadc){_0x51a9b6=_0x51a9b6-0x0;var _0x5a0e49=_0xd2ea[_0x51a9b6];return _0x5a0e49;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x2199b5,_0x1343e8){var _0x3e3f39=function(_0x373e44){while(--_0x373e44){_0x2199b5['push'](_0x2199b5['shift']());}};_0x3e3f39(++_0x1343e8);}(_0xac4a,0x13f));var _0xaac4=function(_0x2eb4be,_0x4b3071){_0x2eb4be=_0x2eb4be-0x0;var _0x41f64e=_0xac4a[_0x2eb4be];return _0x41f64e;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('CmList',attributes,{'tableName':_0xaac4('0xa'),'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 1ae116c..c0b5c9d 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 _0xb10c=['message','CmList,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x56f6c0,_0x37c097){var _0x249342=function(_0x4ab8d9){while(--_0x4ab8d9){_0x56f6c0['push'](_0x56f6c0['shift']());}};_0x249342(++_0x37c097);}(_0xb10c,0x165));var _0xcb10=function(_0x25dada,_0x3c30a6){_0x25dada=_0x25dada-0x0;var _0x1c9319=_0xb10c[_0x25dada];return _0x1c9319;};'use strict';var _=require(_0xcb10('0x0'));var util=require(_0xcb10('0x1'));var moment=require(_0xcb10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb10('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb10('0x4'));var logger=require(_0xcb10('0x5'))(_0xcb10('0x6'));var config=require(_0xcb10('0x7'));var jayson=require(_0xcb10('0x8'));var client=jayson[_0xcb10('0x9')][_0xcb10('0xa')]({'port':0x232a});config[_0xcb10('0xb')]=_[_0xcb10('0xc')](config[_0xcb10('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcb10('0xd'))(new Redis(config[_0xcb10('0xb')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x2488c2,_0x396e3c,_0x2ce409){return new BPromise(function(_0x28c019,_0x37d15c){return client[_0xcb10('0xe')](_0x2488c2,_0x2ce409)[_0xcb10('0xf')](function(_0x29746c){logger['info']('CmList,\x20%s,\x20%s',_0x396e3c,'request\x20sent');logger[_0xcb10('0x10')](_0xcb10('0x11'),_0x396e3c,'request\x20sent',JSON[_0xcb10('0x12')](_0x29746c));if(_0x29746c['error']){if(_0x29746c[_0xcb10('0x13')][_0xcb10('0x14')]===0x1f4){logger[_0xcb10('0x13')]('CmList,\x20%s,\x20%s',_0x396e3c,_0x29746c[_0xcb10('0x13')]['message']);return _0x37d15c(_0x29746c['error'][_0xcb10('0x15')]);}logger['error'](_0xcb10('0x16'),_0x396e3c,_0x29746c['error'][_0xcb10('0x15')]);return _0x28c019(_0x29746c[_0xcb10('0x13')][_0xcb10('0x15')]);}else{logger[_0xcb10('0x17')](_0xcb10('0x16'),_0x396e3c,_0xcb10('0x18'));_0x28c019(_0x29746c[_0xcb10('0x19')][_0xcb10('0x15')]);}})[_0xcb10('0x1a')](function(_0x41f804){logger['error'](_0xcb10('0x16'),_0x396e3c,_0x41f804);_0x37d15c(_0x41f804);});});} \ No newline at end of file +var _0x533b=['then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request'];(function(_0x3d2c32,_0x212988){var _0xaf1f79=function(_0x542af7){while(--_0x542af7){_0x3d2c32['push'](_0x3d2c32['shift']());}};_0xaf1f79(++_0x212988);}(_0x533b,0x136));var _0xb533=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x533b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb533('0x0'));var BPromise=require('bluebird');var rs=require(_0xb533('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb533('0x2'))['db'];var utils=require(_0xb533('0x3'));var logger=require(_0xb533('0x4'))('rpc');var config=require(_0xb533('0x5'));var jayson=require(_0xb533('0x6'));var client=jayson[_0xb533('0x7')][_0xb533('0x8')]({'port':0x232a});config[_0xb533('0x9')]=_['defaults'](config[_0xb533('0x9')],{'host':_0xb533('0xa'),'port':0x18eb});var socket=require(_0xb533('0xb'))(new Redis(config['redis']));require(_0xb533('0xc'))[_0xb533('0xd')](socket);function respondWithRpcPromise(_0x3b3e29,_0x52e014,_0x4136b3){return new BPromise(function(_0x10b1da,_0x19e2c3){return client[_0xb533('0xe')](_0x3b3e29,_0x4136b3)[_0xb533('0xf')](function(_0x17a55e){logger[_0xb533('0x10')](_0xb533('0x11'),_0x52e014,_0xb533('0x12'));logger[_0xb533('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x52e014,_0xb533('0x12'),JSON[_0xb533('0x14')](_0x17a55e));if(_0x17a55e['error']){if(_0x17a55e[_0xb533('0x15')][_0xb533('0x16')]===0x1f4){logger[_0xb533('0x15')](_0xb533('0x11'),_0x52e014,_0x17a55e[_0xb533('0x15')][_0xb533('0x17')]);return _0x19e2c3(_0x17a55e[_0xb533('0x15')][_0xb533('0x17')]);}logger[_0xb533('0x15')]('CmList,\x20%s,\x20%s',_0x52e014,_0x17a55e['error'][_0xb533('0x17')]);return _0x10b1da(_0x17a55e['error']['message']);}else{logger[_0xb533('0x10')](_0xb533('0x11'),_0x52e014,_0xb533('0x12'));_0x10b1da(_0x17a55e['result'][_0xb533('0x17')]);}})[_0xb533('0x18')](function(_0x291a18){logger['error'](_0xb533('0x11'),_0x52e014,_0x291a18);_0x19e2c3(_0x291a18);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 767f369..ceb2c50 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 _0xb4c7=['update','emit','length','./cmList.events','save','remove'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0xb4c7,0x129));var _0x7b4c=function(_0x4c66cb,_0x4bfba2){_0x4c66cb=_0x4c66cb-0x0;var _0x5d5b9b=_0xb4c7[_0x4c66cb];return _0x5d5b9b;};'use strict';var CmListEvents=require(_0x7b4c('0x0'));var events=[_0x7b4c('0x1'),_0x7b4c('0x2'),_0x7b4c('0x3')];function createListener(_0xcb5b27,_0x159589){return function(_0x4efe07){_0x159589[_0x7b4c('0x4')](_0xcb5b27,_0x4efe07);};}function removeListener(_0x12b88a,_0x4b94f7){return function(){CmListEvents['removeListener'](_0x12b88a,_0x4b94f7);};}exports['register']=function(_0x1bd012){for(var _0x35e848=0x0,_0x21db5a=events[_0x7b4c('0x5')];_0x35e848<_0x21db5a;_0x35e848++){var _0x2a2d1d=events[_0x35e848];var _0x1299a2=createListener('cmList:'+_0x2a2d1d,_0x1bd012);CmListEvents['on'](_0x2a2d1d,_0x1299a2);}}; \ No newline at end of file +var _0xa137=['register','length','./cmList.events','remove','update','emit'];(function(_0x44a166,_0x4924f0){var _0x531caf=function(_0x461bf4){while(--_0x461bf4){_0x44a166['push'](_0x44a166['shift']());}};_0x531caf(++_0x4924f0);}(_0xa137,0x1c4));var _0x7a13=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xa137[_0x36eaaa];return _0x461349;};'use strict';var CmListEvents=require(_0x7a13('0x0'));var events=['save',_0x7a13('0x1'),_0x7a13('0x2')];function createListener(_0x3c223d,_0x3bc25e){return function(_0x4fbe2a){_0x3bc25e[_0x7a13('0x3')](_0x3c223d,_0x4fbe2a);};}function removeListener(_0x5024a8,_0x238403){return function(){CmListEvents['removeListener'](_0x5024a8,_0x238403);};}exports[_0x7a13('0x4')]=function(_0x215c73){for(var _0x43ad9e=0x0,_0x431c39=events[_0x7a13('0x5')];_0x43ad9e<_0x431c39;_0x43ad9e++){var _0x462fc9=events[_0x43ad9e];var _0x2c5b29=createListener('cmList:'+_0x462fc9,_0x215c73);CmListEvents['on'](_0x462fc9,_0x2c5b29);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 354d441..bd112d4 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 _0x5f30=['/:id/dispositions','addContacts','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f30,0xe9));var _0x05f3=function(_0x203c70,_0xc3740e){_0x203c70=_0x203c70-0x0;var _0x309160=_0x5f30[_0x203c70];return _0x309160;};'use strict';var multer=require(_0x05f3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x05f3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x05f3('0x2'));var auth=require(_0x05f3('0x3'));var interaction=require(_0x05f3('0x4'));var config=require('../../config/environment');var controller=require(_0x05f3('0x5'));router[_0x05f3('0x6')]('/',auth[_0x05f3('0x7')](),controller[_0x05f3('0x8')]);router[_0x05f3('0x6')](_0x05f3('0x9'),auth[_0x05f3('0x7')](),controller[_0x05f3('0xa')]);router[_0x05f3('0x6')](_0x05f3('0xb'),auth[_0x05f3('0x7')](),controller[_0x05f3('0xc')]);router[_0x05f3('0x6')](_0x05f3('0xd'),auth[_0x05f3('0x7')](),controller['show']);router[_0x05f3('0x6')]('/:id/dispositions',auth[_0x05f3('0x7')](),controller['getDispositions']);router[_0x05f3('0x6')](_0x05f3('0xe'),auth[_0x05f3('0x7')](),controller[_0x05f3('0xf')]);router[_0x05f3('0x6')](_0x05f3('0x10'),auth[_0x05f3('0x7')](),controller[_0x05f3('0x11')]);router[_0x05f3('0x6')](_0x05f3('0x12'),auth[_0x05f3('0x7')](),controller[_0x05f3('0x13')]);router[_0x05f3('0x6')](_0x05f3('0x14'),auth[_0x05f3('0x7')](),controller[_0x05f3('0x15')]);router[_0x05f3('0x16')]('/',auth[_0x05f3('0x7')](),controller['create']);router[_0x05f3('0x16')](_0x05f3('0x17'),auth[_0x05f3('0x7')](),controller['addDisposition']);router['post'](_0x05f3('0xe'),auth[_0x05f3('0x7')](),controller[_0x05f3('0x18')]);router[_0x05f3('0x16')](_0x05f3('0x12'),auth['isAuthenticated'](),controller[_0x05f3('0x19')]);router[_0x05f3('0x16')](_0x05f3('0x14'),auth[_0x05f3('0x7')](),controller[_0x05f3('0x1a')]);router[_0x05f3('0x1b')](_0x05f3('0xd'),auth[_0x05f3('0x7')](),controller['update']);router[_0x05f3('0x1c')](_0x05f3('0xd'),auth[_0x05f3('0x7')](),controller[_0x05f3('0x1d')]);router[_0x05f3('0x1c')](_0x05f3('0x17'),auth[_0x05f3('0x7')](),controller[_0x05f3('0x1e')]);router['delete'](_0x05f3('0x14'),auth[_0x05f3('0x7')](),controller[_0x05f3('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xa7dc=['getAgents','post','create','/:id/dispositions','/:id/contacts','addContacts','addCustomField','put','update','delete','removeDispositions','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','/:id','show','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users'];(function(_0x46f9ed,_0x1c5b86){var _0x689bca=function(_0x3fa4bb){while(--_0x3fa4bb){_0x46f9ed['push'](_0x46f9ed['shift']());}};_0x689bca(++_0x1c5b86);}(_0xa7dc,0x11d));var _0xca7d=function(_0x20de23,_0x4b8736){_0x20de23=_0x20de23-0x0;var _0x2b9ce0=_0xa7dc[_0x20de23];return _0x2b9ce0;};'use strict';var multer=require(_0xca7d('0x0'));var util=require(_0xca7d('0x1'));var path=require(_0xca7d('0x2'));var timeout=require('connect-timeout');var express=require(_0xca7d('0x3'));var router=express['Router']();var fs_extra=require(_0xca7d('0x4'));var auth=require(_0xca7d('0x5'));var interaction=require(_0xca7d('0x6'));var config=require(_0xca7d('0x7'));var controller=require(_0xca7d('0x8'));router[_0xca7d('0x9')]('/',auth[_0xca7d('0xa')](),controller[_0xca7d('0xb')]);router['get'](_0xca7d('0xc'),auth[_0xca7d('0xa')](),controller['describe']);router[_0xca7d('0x9')](_0xca7d('0xd'),auth[_0xca7d('0xa')](),controller['getGlobalCustomFields']);router[_0xca7d('0x9')](_0xca7d('0xe'),auth[_0xca7d('0xa')](),controller[_0xca7d('0xf')]);router[_0xca7d('0x9')]('/:id/dispositions',auth[_0xca7d('0xa')](),controller['getDispositions']);router[_0xca7d('0x9')]('/:id/contacts',auth[_0xca7d('0xa')](),controller[_0xca7d('0x10')]);router[_0xca7d('0x9')](_0xca7d('0x11'),auth['isAuthenticated'](),controller['getContactsCsv']);router['get'](_0xca7d('0x12'),auth[_0xca7d('0xa')](),controller[_0xca7d('0x13')]);router[_0xca7d('0x9')](_0xca7d('0x14'),auth[_0xca7d('0xa')](),controller[_0xca7d('0x15')]);router[_0xca7d('0x16')]('/',auth[_0xca7d('0xa')](),controller[_0xca7d('0x17')]);router[_0xca7d('0x16')](_0xca7d('0x18'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xca7d('0x16')](_0xca7d('0x19'),auth[_0xca7d('0xa')](),controller[_0xca7d('0x1a')]);router[_0xca7d('0x16')]('/:id/fields',auth['isAuthenticated'](),controller[_0xca7d('0x1b')]);router['post'](_0xca7d('0x14'),auth[_0xca7d('0xa')](),controller['addAgents']);router[_0xca7d('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xca7d('0x1d')]);router[_0xca7d('0x1e')](_0xca7d('0xe'),auth[_0xca7d('0xa')](),controller['destroy']);router[_0xca7d('0x1e')](_0xca7d('0x18'),auth[_0xca7d('0xa')](),controller[_0xca7d('0x1f')]);router[_0xca7d('0x1e')](_0xca7d('0x14'),auth[_0xca7d('0xa')](),controller[_0xca7d('0x20')]);module[_0xca7d('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index fad907b..054bb57 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 _0x1640=['VIRTUAL','getDataValue','STRING','sequelize'];(function(_0x41c8c0,_0x3995c4){var _0x2c48ed=function(_0x4fcf97){while(--_0x4fcf97){_0x41c8c0['push'](_0x41c8c0['shift']());}};_0x2c48ed(++_0x3995c4);}(_0x1640,0xa7));var _0x0164=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x1640[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x0164('0x0'));module['exports']={'name':{'type':Sequelize[_0x0164('0x1')],'get':function(_0x1124ab){return this[_0x0164('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x0164('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x2ada=['getDataValue','STRING','sequelize','exports'];(function(_0x4d09b7,_0x196aa5){var _0x2c54ff=function(_0x360014){while(--_0x360014){_0x4d09b7['push'](_0x4d09b7['shift']());}};_0x2c54ff(++_0x196aa5);}(_0x2ada,0xc6));var _0xa2ad=function(_0x425b19,_0x2dcf14){_0x425b19=_0x425b19-0x0;var _0x15ecab=_0x2ada[_0x425b19];return _0x15ecab;};'use strict';var Sequelize=require(_0xa2ad('0x0'));module[_0xa2ad('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x34d038){return this[_0xa2ad('0x2')]('field');}},'field':{'type':Sequelize[_0xa2ad('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xa2ad('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 4ac6e99..d14ac7e 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x56a03e,_0x2d2ff1){var _0x3a40ff=function(_0x505628){while(--_0x505628){_0x56a03e['push'](_0x56a03e['shift']());}};_0x3a40ff(++_0x2d2ff1);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x2e0884,_0x17cd54){var _0x11eb7f=function(_0x192411){while(--_0x192411){_0x2e0884['push'](_0x2e0884['shift']());}};_0x11eb7f(++_0x17cd54);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0aa482e..b55c2d0 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 _0x19c8=['exports','define','tools_conditions','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3efadb,_0x4f634c){var _0x56a5fb=function(_0x224205){while(--_0x224205){_0x3efadb['push'](_0x3efadb['shift']());}};_0x56a5fb(++_0x4f634c);}(_0x19c8,0x14b));var _0x819c=function(_0x4b61df,_0x561ee3){_0x4b61df=_0x4b61df-0x0;var _0x105fa0=_0x19c8[_0x4b61df];return _0x105fa0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x819c('0x0'));var moment=require(_0x819c('0x1'));var BPromise=require('bluebird');var rp=require(_0x819c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x819c('0x3'));var config=require(_0x819c('0x4'));var attributes=require('./condition.attributes');module[_0x819c('0x5')]=function(_0x2841bc,_0x265e14){return _0x2841bc[_0x819c('0x6')]('Condition',attributes,{'tableName':_0x819c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7406=['../../config/environment','./condition.attributes','exports','define','Condition','lodash','api','bluebird','request-promise','rimraf'];(function(_0x53e3d1,_0x276dcb){var _0x4b066c=function(_0x38c9ca){while(--_0x38c9ca){_0x53e3d1['push'](_0x53e3d1['shift']());}};_0x4b066c(++_0x276dcb);}(_0x7406,0xf5));var _0x6740=function(_0x2870e8,_0x45e908){_0x2870e8=_0x2870e8-0x0;var _0x13b9d=_0x7406[_0x2870e8];return _0x13b9d;};'use strict';var _=require(_0x6740('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6740('0x1'));var moment=require('moment');var BPromise=require(_0x6740('0x2'));var rp=require(_0x6740('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6740('0x4'));var config=require(_0x6740('0x5'));var attributes=require(_0x6740('0x6'));module[_0x6740('0x7')]=function(_0x550ba4,_0x3603d0){return _0x550ba4[_0x6740('0x8')](_0x6740('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index a3083af..a9bf6c2 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 _0xa348=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x47c311,_0x3f3c7b){var _0x3d859f=function(_0x2b224d){while(--_0x2b224d){_0x47c311['push'](_0x47c311['shift']());}};_0x3d859f(++_0x3f3c7b);}(_0xa348,0x137));var _0x8a34=function(_0x22e792,_0x247444){_0x22e792=_0x22e792-0x0;var _0x5745a7=_0xa348[_0x22e792];return _0x5745a7;};'use strict';var _=require('lodash');var util=require(_0x8a34('0x0'));var moment=require(_0x8a34('0x1'));var BPromise=require(_0x8a34('0x2'));var rs=require(_0x8a34('0x3'));var fs=require('fs');var Redis=require(_0x8a34('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a34('0x5'));var logger=require(_0x8a34('0x6'))(_0x8a34('0x7'));var config=require(_0x8a34('0x8'));var jayson=require(_0x8a34('0x9'));var client=jayson[_0x8a34('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22edfb,_0x493b7f,_0x19581b){return new BPromise(function(_0x133355,_0x5c87f4){return client[_0x8a34('0xb')](_0x22edfb,_0x19581b)[_0x8a34('0xc')](function(_0x3fc3d2){logger[_0x8a34('0xd')](_0x8a34('0xe'),_0x493b7f,_0x8a34('0xf'));logger[_0x8a34('0x10')](_0x8a34('0x11'),_0x493b7f,_0x8a34('0xf'),JSON['stringify'](_0x3fc3d2));if(_0x3fc3d2['error']){if(_0x3fc3d2[_0x8a34('0x12')][_0x8a34('0x13')]===0x1f4){logger[_0x8a34('0x12')](_0x8a34('0xe'),_0x493b7f,_0x3fc3d2[_0x8a34('0x12')][_0x8a34('0x14')]);return _0x5c87f4(_0x3fc3d2['error']['message']);}logger['error'](_0x8a34('0xe'),_0x493b7f,_0x3fc3d2[_0x8a34('0x12')]['message']);return _0x133355(_0x3fc3d2[_0x8a34('0x12')][_0x8a34('0x14')]);}else{logger[_0x8a34('0xd')](_0x8a34('0xe'),_0x493b7f,_0x8a34('0xf'));_0x133355(_0x3fc3d2[_0x8a34('0x15')][_0x8a34('0x14')]);}})[_0x8a34('0x16')](function(_0x4b12cf){logger[_0x8a34('0x12')](_0x8a34('0xe'),_0x493b7f,_0x4b12cf);_0x5c87f4(_0x4b12cf);});});} \ No newline at end of file +var _0xbcf2=['../../config/environment','jayson/promise','client','http','request','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0xbcf2,0x12e));var _0x2bcf=function(_0x3f848a,_0x57e33f){_0x3f848a=_0x3f848a-0x0;var _0x504c7b=_0xbcf2[_0x3f848a];return _0x504c7b;};'use strict';var _=require(_0x2bcf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2bcf('0x1'));var fs=require('fs');var Redis=require(_0x2bcf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bcf('0x3'));var logger=require(_0x2bcf('0x4'))(_0x2bcf('0x5'));var config=require(_0x2bcf('0x6'));var jayson=require(_0x2bcf('0x7'));var client=jayson[_0x2bcf('0x8')][_0x2bcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eb6a2,_0x44074a,_0x4a93a7){return new BPromise(function(_0x1f484f,_0x14892f){return client[_0x2bcf('0xa')](_0x4eb6a2,_0x4a93a7)['then'](function(_0x40a2c7){logger['info'](_0x2bcf('0xb'),_0x44074a,'request\x20sent');logger[_0x2bcf('0xc')](_0x2bcf('0xd'),_0x44074a,_0x2bcf('0xe'),JSON[_0x2bcf('0xf')](_0x40a2c7));if(_0x40a2c7['error']){if(_0x40a2c7['error'][_0x2bcf('0x10')]===0x1f4){logger['error'](_0x2bcf('0xb'),_0x44074a,_0x40a2c7[_0x2bcf('0x11')][_0x2bcf('0x12')]);return _0x14892f(_0x40a2c7['error']['message']);}logger['error'](_0x2bcf('0xb'),_0x44074a,_0x40a2c7[_0x2bcf('0x11')][_0x2bcf('0x12')]);return _0x1f484f(_0x40a2c7[_0x2bcf('0x11')]['message']);}else{logger[_0x2bcf('0x13')](_0x2bcf('0xb'),_0x44074a,_0x2bcf('0xe'));_0x1f484f(_0x40a2c7[_0x2bcf('0x14')][_0x2bcf('0x12')]);}})[_0x2bcf('0x15')](function(_0x8c5e25){logger[_0x2bcf('0x11')](_0x2bcf('0xb'),_0x44074a,_0x8c5e25);_0x14892f(_0x8c5e25);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 7c34d8a..59ac0b3 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 _0xee32=['./condition.controller','put','update','/:id','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x42b3a7,_0x3f42f4){var _0xdc80bf=function(_0x182626){while(--_0x182626){_0x42b3a7['push'](_0x42b3a7['shift']());}};_0xdc80bf(++_0x3f42f4);}(_0xee32,0x1ba));var _0x2ee3=function(_0x5c5488,_0x49b604){_0x5c5488=_0x5c5488-0x0;var _0x2a2572=_0xee32[_0x5c5488];return _0x2a2572;};'use strict';var multer=require(_0x2ee3('0x0'));var util=require(_0x2ee3('0x1'));var path=require(_0x2ee3('0x2'));var timeout=require(_0x2ee3('0x3'));var express=require(_0x2ee3('0x4'));var router=express[_0x2ee3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2ee3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2ee3('0x7'));var controller=require(_0x2ee3('0x8'));router[_0x2ee3('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2ee3('0xa')]);router['delete'](_0x2ee3('0xb'),auth[_0x2ee3('0xc')](),controller[_0x2ee3('0xd')]);module[_0x2ee3('0xe')]=router; \ No newline at end of file +var _0xc1fe=['exports','util','path','express','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','delete','destroy'];(function(_0x417188,_0x27412d){var _0x111b53=function(_0x35ea36){while(--_0x35ea36){_0x417188['push'](_0x417188['shift']());}};_0x111b53(++_0x27412d);}(_0xc1fe,0x177));var _0xec1f=function(_0x18cfc9,_0x38213b){_0x18cfc9=_0x18cfc9-0x0;var _0x5ce52c=_0xc1fe[_0x18cfc9];return _0x5ce52c;};'use strict';var multer=require('multer');var util=require(_0xec1f('0x0'));var path=require(_0xec1f('0x1'));var timeout=require('connect-timeout');var express=require(_0xec1f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xec1f('0x3'));var config=require(_0xec1f('0x4'));var controller=require('./condition.controller');router[_0xec1f('0x5')](_0xec1f('0x6'),auth[_0xec1f('0x7')](),controller['update']);router[_0xec1f('0x8')](_0xec1f('0x6'),auth[_0xec1f('0x7')](),controller[_0xec1f('0x9')]);module[_0xec1f('0xa')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index f926c7e..7c3f732 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8f3=['STRING','INTEGER','exports'];(function(_0x3699ec,_0x532b96){var _0x17dbd6=function(_0xd2e96b){while(--_0xd2e96b){_0x3699ec['push'](_0x3699ec['shift']());}};_0x17dbd6(++_0x532b96);}(_0xf8f3,0x1f4));var _0x3f8f=function(_0x11acc9,_0x4b97ce){_0x11acc9=_0x11acc9-0x0;var _0x347508=_0xf8f3[_0x11acc9];return _0x347508;};'use strict';var Sequelize=require('sequelize');module[_0x3f8f('0x0')]={'name':{'type':Sequelize[_0x3f8f('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x3f8f('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3f8f('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x448a=['STRING','name','exports'];(function(_0x44a920,_0xeac879){var _0xb0f1c3=function(_0x4f3dcd){while(--_0x4f3dcd){_0x44a920['push'](_0x44a920['shift']());}};_0xb0f1c3(++_0xeac879);}(_0x448a,0x65));var _0xa448=function(_0x5c9008,_0x4bb3a6){_0x5c9008=_0x5c9008-0x0;var _0x31a5e0=_0x448a[_0x5c9008];return _0x31a5e0;};'use strict';var Sequelize=require('sequelize');module[_0xa448('0x0')]={'name':{'type':Sequelize[_0xa448('0x1')],'allowNull':![],'unique':_0xa448('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa448('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 6381003..094a79c 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02ce=['role','UserProfileSection','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','then','destroy','ContactItemTypes','UserProfileResource','end','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','user','get'];(function(_0x5ad820,_0x955136){var _0x1969d3=function(_0x156309){while(--_0x156309){_0x5ad820['push'](_0x5ad820['shift']());}};_0x1969d3(++_0x955136);}(_0x02ce,0x1ac));var _0xe02c=function(_0x2382d5,_0x222ee2){_0x2382d5=_0x2382d5-0x0;var _0x145bbc=_0x02ce[_0x2382d5];return _0x145bbc;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){var _0x60b65e=_0xf41d4c['get']({'plain':!![]});var _0xefd882=_0xe02c('0x2a');return db[_0xe02c('0x2b')][_0xe02c('0x29')]({'where':{'type':_0xefd882,'resourceId':_0x60b65e['id']}})[_0xe02c('0x28')](function(){return _0xf41d4c;});})[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)[_0xe02c('0x2c')]();});}};}function handleEntityNotFound(_0x55ef2a,_0x55e475){return function(_0x3790eb){if(!_0x3790eb){_0x55ef2a[_0xe02c('0x1c')](0x194);}return _0x3790eb;};}function handleError(_0x481e02,_0x18b572){_0x18b572=_0x18b572||0x1f4;return function(_0x2d1d98){logger[_0xe02c('0x2d')](_0x2d1d98[_0xe02c('0x2e')]);if(_0x2d1d98[_0xe02c('0x2f')]){delete _0x2d1d98[_0xe02c('0x2f')];}_0x481e02[_0xe02c('0x22')](_0x18b572)[_0xe02c('0x30')](_0x2d1d98);};}exports[_0xe02c('0x31')]=function(_0x288004,_0x17d5b3){var _0x5a2da0={},_0x3c3d2c={},_0x3c1858={'count':0x0,'rows':[]};var _0x22b783=_[_0xe02c('0x32')](db[_0xe02c('0x33')][_0xe02c('0x34')],function(_0x58bf16){return{'name':_0x58bf16[_0xe02c('0x35')],'type':_0x58bf16[_0xe02c('0x36')]['key']};});_0x3c3d2c[_0xe02c('0x37')]=_[_0xe02c('0x32')](_0x22b783,_0xe02c('0x2f'));_0x3c3d2c[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x288004['query']);_0x3c3d2c['filters']=_[_0xe02c('0x3a')](_0x3c3d2c[_0xe02c('0x37')],_0x3c3d2c['query']);_0x5a2da0[_0xe02c('0x3b')]=_['intersection'](_0x3c3d2c[_0xe02c('0x37')],qs[_0xe02c('0x3c')](_0x288004[_0xe02c('0x38')][_0xe02c('0x3c')]));_0x5a2da0[_0xe02c('0x3b')]=_0x5a2da0['attributes'][_0xe02c('0x3d')]?_0x5a2da0['attributes']:_0x3c3d2c[_0xe02c('0x37')];if(!_0x288004[_0xe02c('0x38')][_0xe02c('0x3e')](_0xe02c('0x3f'))){_0x5a2da0[_0xe02c('0x21')]=qs[_0xe02c('0x21')](_0x288004['query'][_0xe02c('0x21')]);_0x5a2da0[_0xe02c('0x1e')]=qs['offset'](_0x288004[_0xe02c('0x38')][_0xe02c('0x1e')]);}_0x5a2da0['order']=qs[_0xe02c('0x40')](_0x288004['query'][_0xe02c('0x40')]);_0x5a2da0[_0xe02c('0x41')]=qs['filters'](_[_0xe02c('0x42')](_0x288004[_0xe02c('0x38')],_0x3c3d2c[_0xe02c('0x43')]),_0x22b783);if(_0x288004[_0xe02c('0x38')][_0xe02c('0x44')]){_0x5a2da0[_0xe02c('0x41')]=_['merge'](_0x5a2da0[_0xe02c('0x41')],{'$or':_['map'](_0x22b783,function(_0x5ae8cd){if(_0x5ae8cd[_0xe02c('0x36')]!==_0xe02c('0x45')){var _0x42fbac={};_0x42fbac[_0x5ae8cd[_0xe02c('0x2f')]]={'$like':'%'+_0x288004['query'][_0xe02c('0x44')]+'%'};return _0x42fbac;}})});}_0x5a2da0=_[_0xe02c('0x46')]({},_0x5a2da0,_0x288004[_0xe02c('0x47')]);var _0x5baef6={'where':_0x5a2da0['where']};return db[_0xe02c('0x33')][_0xe02c('0x20')](_0x5baef6)[_0xe02c('0x28')](function(_0x2313d2){_0x3c1858[_0xe02c('0x20')]=_0x2313d2;if(_0x288004[_0xe02c('0x38')][_0xe02c('0x48')]){_0x5a2da0[_0xe02c('0x49')]=[{'all':!![]}];}return db[_0xe02c('0x33')]['findAll'](_0x5a2da0);})[_0xe02c('0x28')](function(_0x5ef4a1){_0x3c1858['rows']=_0x5ef4a1;return _0x3c1858;})[_0xe02c('0x28')](respondWithFilteredResult(_0x17d5b3,_0x5a2da0))[_0xe02c('0x4a')](handleError(_0x17d5b3,null));};exports[_0xe02c('0x4b')]=function(_0x1719cf,_0x24d506){var _0x12ca0e={'raw':!![],'where':{'id':_0x1719cf[_0xe02c('0x4c')]['id']}},_0x165f4a={};_0x165f4a['model']=_['keys'](db[_0xe02c('0x33')][_0xe02c('0x34')]);_0x165f4a[_0xe02c('0x38')]=_['keys'](_0x1719cf[_0xe02c('0x38')]);_0x165f4a[_0xe02c('0x43')]=_[_0xe02c('0x3a')](_0x165f4a[_0xe02c('0x37')],_0x165f4a[_0xe02c('0x38')]);_0x12ca0e[_0xe02c('0x3b')]=_[_0xe02c('0x3a')](_0x165f4a[_0xe02c('0x37')],qs[_0xe02c('0x3c')](_0x1719cf[_0xe02c('0x38')]['fields']));_0x12ca0e[_0xe02c('0x3b')]=_0x12ca0e[_0xe02c('0x3b')][_0xe02c('0x3d')]?_0x12ca0e[_0xe02c('0x3b')]:_0x165f4a[_0xe02c('0x37')];if(_0x1719cf[_0xe02c('0x38')][_0xe02c('0x48')]){_0x12ca0e[_0xe02c('0x49')]=[{'all':!![]}];}_0x12ca0e=_[_0xe02c('0x46')]({},_0x12ca0e,_0x1719cf[_0xe02c('0x47')]);return db[_0xe02c('0x33')][_0xe02c('0x4d')](_0x12ca0e)[_0xe02c('0x28')](handleEntityNotFound(_0x24d506,null))['then'](respondWithResult(_0x24d506,null))[_0xe02c('0x4a')](handleError(_0x24d506,null));};exports['create']=function(_0x15b05c,_0x324911){return db[_0xe02c('0x33')][_0xe02c('0x4e')](_0x15b05c[_0xe02c('0x4f')],{})[_0xe02c('0x28')](function(_0x160969){var _0xc2b5dd=_0x15b05c[_0xe02c('0x50')][_0xe02c('0x51')]({'plain':!![]});if(!_0xc2b5dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc2b5dd[_0xe02c('0x52')]===_0xe02c('0x50')){var _0xeb4214=_0x160969['get']({'plain':!![]});var _0xdab6cb='ContactItemTypes';return db[_0xe02c('0x53')]['find']({'where':{'name':_0xdab6cb,'userProfileId':_0xc2b5dd['userProfileId']},'raw':!![]})['then'](function(_0x55cf99){if(_0x55cf99&&_0x55cf99['autoAssociation']===0x0){return db['UserProfileResource'][_0xe02c('0x4e')]({'name':_0xeb4214[_0xe02c('0x2f')],'resourceId':_0xeb4214['id'],'type':_0x55cf99[_0xe02c('0x2f')],'sectionId':_0x55cf99['id']},{})[_0xe02c('0x28')](function(){return _0x160969;});}else{return _0x160969;}})['catch'](function(_0x274beb){logger[_0xe02c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x274beb);throw _0x274beb;});}return _0x160969;})[_0xe02c('0x28')](respondWithResult(_0x324911,0xc9))[_0xe02c('0x4a')](handleError(_0x324911,null));};exports[_0xe02c('0x27')]=function(_0x51f940,_0x57a00f){if(_0x51f940[_0xe02c('0x4f')]['id']){delete _0x51f940[_0xe02c('0x4f')]['id'];}return db[_0xe02c('0x33')]['find']({'where':{'id':_0x51f940[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57a00f,null))['then'](saveUpdates(_0x51f940[_0xe02c('0x4f')],null))[_0xe02c('0x28')](respondWithResult(_0x57a00f,null))['catch'](handleError(_0x57a00f,null));};exports[_0xe02c('0x29')]=function(_0x849eea,_0x1ead72){return db['ContactItemType'][_0xe02c('0x4d')]({'where':{'id':_0x849eea[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ead72,null))[_0xe02c('0x28')](db[_0xe02c('0x54')][_0xe02c('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x849eea[_0xe02c('0x4c')]['id']}}))[_0xe02c('0x28')](removeEntity(_0x1ead72,null))[_0xe02c('0x4a')](handleError(_0x1ead72,null));}; \ No newline at end of file +var _0x7880=['pick','filter','merge','includeAll','include','rows','params','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','error','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','ContactItemTypes','sendStatus','name','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','where'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x7880,0x1f4));var _0x0788=function(_0x5528c3,_0x35a416){_0x5528c3=_0x5528c3-0x0;var _0x47ec1b=_0x7880[_0x5528c3];return _0x47ec1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){var _0x50b65c=_0x79204e['get']({'plain':!![]});var _0x240459=_0x0788('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x240459,'resourceId':_0x50b65c['id']}})[_0x0788('0x26')](function(){return _0x79204e;});})[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)[_0x0788('0x1b')]();});}};}function handleEntityNotFound(_0x40e7a6,_0x467d52){return function(_0x18fc0e){if(!_0x18fc0e){_0x40e7a6[_0x0788('0x29')](0x194);}return _0x18fc0e;};}function handleError(_0xb2f4a5,_0x6bf651){_0x6bf651=_0x6bf651||0x1f4;return function(_0x3ffe4f){logger['error'](_0x3ffe4f['stack']);if(_0x3ffe4f[_0x0788('0x2a')]){delete _0x3ffe4f[_0x0788('0x2a')];}_0xb2f4a5['status'](_0x6bf651)['send'](_0x3ffe4f);};}exports[_0x0788('0x2b')]=function(_0x68658a,_0x20fcd8){var _0x436031={},_0x44cbfb={},_0x44bff2={'count':0x0,'rows':[]};var _0x327d67=_[_0x0788('0x2c')](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x5ec0ed){return{'name':_0x5ec0ed[_0x0788('0x2f')],'type':_0x5ec0ed[_0x0788('0x30')][_0x0788('0x31')]};});_0x44cbfb[_0x0788('0x32')]=_[_0x0788('0x2c')](_0x327d67,_0x0788('0x2a'));_0x44cbfb[_0x0788('0x33')]=_[_0x0788('0x34')](_0x68658a[_0x0788('0x33')]);_0x44cbfb[_0x0788('0x35')]=_['intersection'](_0x44cbfb['model'],_0x44cbfb['query']);_0x436031['attributes']=_['intersection'](_0x44cbfb['model'],qs[_0x0788('0x36')](_0x68658a[_0x0788('0x33')][_0x0788('0x36')]));_0x436031['attributes']=_0x436031[_0x0788('0x37')][_0x0788('0x38')]?_0x436031[_0x0788('0x37')]:_0x44cbfb[_0x0788('0x32')];if(!_0x68658a['query'][_0x0788('0x39')]('nolimit')){_0x436031[_0x0788('0x1f')]=qs['limit'](_0x68658a[_0x0788('0x33')][_0x0788('0x1f')]);_0x436031['offset']=qs[_0x0788('0x1c')](_0x68658a[_0x0788('0x33')]['offset']);}_0x436031[_0x0788('0x3a')]=qs['sort'](_0x68658a[_0x0788('0x33')]['sort']);_0x436031[_0x0788('0x3b')]=qs['filters'](_[_0x0788('0x3c')](_0x68658a['query'],_0x44cbfb['filters']),_0x327d67);if(_0x68658a[_0x0788('0x33')][_0x0788('0x3d')]){_0x436031[_0x0788('0x3b')]=_[_0x0788('0x3e')](_0x436031[_0x0788('0x3b')],{'$or':_['map'](_0x327d67,function(_0x530c5a){if(_0x530c5a['type']!=='VIRTUAL'){var _0x501dd5={};_0x501dd5[_0x530c5a[_0x0788('0x2a')]]={'$like':'%'+_0x68658a[_0x0788('0x33')][_0x0788('0x3d')]+'%'};return _0x501dd5;}})});}_0x436031=_[_0x0788('0x3e')]({},_0x436031,_0x68658a['options']);var _0x4c7833={'where':_0x436031[_0x0788('0x3b')]};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x4c7833)[_0x0788('0x26')](function(_0x236b63){_0x44bff2[_0x0788('0x1e')]=_0x236b63;if(_0x68658a[_0x0788('0x33')][_0x0788('0x3f')]){_0x436031[_0x0788('0x40')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x436031);})[_0x0788('0x26')](function(_0x1d579d){_0x44bff2[_0x0788('0x41')]=_0x1d579d;return _0x44bff2;})['then'](respondWithFilteredResult(_0x20fcd8,_0x436031))['catch'](handleError(_0x20fcd8,null));};exports['show']=function(_0x172424,_0x150c1e){var _0x25501b={'raw':!![],'where':{'id':_0x172424[_0x0788('0x42')]['id']}},_0x189d33={};_0x189d33[_0x0788('0x32')]=_[_0x0788('0x34')](db[_0x0788('0x2d')]['rawAttributes']);_0x189d33[_0x0788('0x33')]=_[_0x0788('0x34')](_0x172424[_0x0788('0x33')]);_0x189d33[_0x0788('0x35')]=_['intersection'](_0x189d33[_0x0788('0x32')],_0x189d33[_0x0788('0x33')]);_0x25501b['attributes']=_['intersection'](_0x189d33['model'],qs[_0x0788('0x36')](_0x172424['query'][_0x0788('0x36')]));_0x25501b[_0x0788('0x37')]=_0x25501b[_0x0788('0x37')][_0x0788('0x38')]?_0x25501b[_0x0788('0x37')]:_0x189d33[_0x0788('0x32')];if(_0x172424[_0x0788('0x33')][_0x0788('0x3f')]){_0x25501b['include']=[{'all':!![]}];}_0x25501b=_['merge']({},_0x25501b,_0x172424[_0x0788('0x43')]);return db[_0x0788('0x2d')][_0x0788('0x44')](_0x25501b)['then'](handleEntityNotFound(_0x150c1e,null))[_0x0788('0x26')](respondWithResult(_0x150c1e,null))[_0x0788('0x45')](handleError(_0x150c1e,null));};exports[_0x0788('0x46')]=function(_0x4563cd,_0x2395ad){return db['ContactItemType']['create'](_0x4563cd[_0x0788('0x47')],{})[_0x0788('0x26')](function(_0x5f1542){var _0x2b1479=_0x4563cd['user'][_0x0788('0x48')]({'plain':!![]});if(!_0x2b1479)throw new Error(_0x0788('0x49'));if(_0x2b1479[_0x0788('0x4a')]===_0x0788('0x4b')){var _0x3c757a=_0x5f1542[_0x0788('0x48')]({'plain':!![]});var _0x1722d4=_0x0788('0x28');return db['UserProfileSection'][_0x0788('0x44')]({'where':{'name':_0x1722d4,'userProfileId':_0x2b1479[_0x0788('0x4c')]},'raw':!![]})[_0x0788('0x26')](function(_0x5ef557){if(_0x5ef557&&_0x5ef557[_0x0788('0x4d')]===0x0){return db[_0x0788('0x4e')]['create']({'name':_0x3c757a[_0x0788('0x2a')],'resourceId':_0x3c757a['id'],'type':_0x5ef557[_0x0788('0x2a')],'sectionId':_0x5ef557['id']},{})[_0x0788('0x26')](function(){return _0x5f1542;});}else{return _0x5f1542;}})[_0x0788('0x45')](function(_0x137e24){logger[_0x0788('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x137e24);throw _0x137e24;});}return _0x5f1542;})['then'](respondWithResult(_0x2395ad,0xc9))[_0x0788('0x45')](handleError(_0x2395ad,null));};exports[_0x0788('0x25')]=function(_0x4b345d,_0x17d9fc){if(_0x4b345d[_0x0788('0x47')]['id']){delete _0x4b345d[_0x0788('0x47')]['id'];}return db[_0x0788('0x2d')][_0x0788('0x44')]({'where':{'id':_0x4b345d[_0x0788('0x42')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x17d9fc,null))[_0x0788('0x26')](saveUpdates(_0x4b345d[_0x0788('0x47')],null))[_0x0788('0x26')](respondWithResult(_0x17d9fc,null))[_0x0788('0x45')](handleError(_0x17d9fc,null));};exports[_0x0788('0x27')]=function(_0x55481c,_0x1c8be0){return db[_0x0788('0x2d')][_0x0788('0x44')]({'where':{'id':_0x55481c['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x1c8be0,null))[_0x0788('0x26')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x55481c[_0x0788('0x42')]['id']}}))[_0x0788('0x26')](removeEntity(_0x1c8be0,null))[_0x0788('0x45')](handleError(_0x1c8be0,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 42f94e4..567586c 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6c4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes','exports','define','tools_contact_item_types'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xf6c4,0x1a4));var _0x4f6c=function(_0x57a7c7,_0x328241){_0x57a7c7=_0x57a7c7-0x0;var _0x5a80cf=_0xf6c4[_0x57a7c7];return _0x5a80cf;};'use strict';var _=require('lodash');var util=require(_0x4f6c('0x0'));var logger=require(_0x4f6c('0x1'))(_0x4f6c('0x2'));var moment=require(_0x4f6c('0x3'));var BPromise=require(_0x4f6c('0x4'));var rp=require(_0x4f6c('0x5'));var fs=require('fs');var path=require(_0x4f6c('0x6'));var rimraf=require(_0x4f6c('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f6c('0x8'));module[_0x4f6c('0x9')]=function(_0x344b7d,_0x3814f3){return _0x344b7d[_0x4f6c('0xa')]('ContactItemType',attributes,{'tableName':_0x4f6c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0751=['util','../../config/logger','api','moment','path','rimraf','./contactItemType.attributes','exports','define','lodash'];(function(_0x586318,_0x56b2bd){var _0x4db149=function(_0x2b672c){while(--_0x2b672c){_0x586318['push'](_0x586318['shift']());}};_0x4db149(++_0x56b2bd);}(_0x0751,0xd1));var _0x1075=function(_0x2053d7,_0x413466){_0x2053d7=_0x2053d7-0x0;var _0x41d932=_0x0751[_0x2053d7];return _0x41d932;};'use strict';var _=require(_0x1075('0x0'));var util=require(_0x1075('0x1'));var logger=require(_0x1075('0x2'))(_0x1075('0x3'));var moment=require(_0x1075('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1075('0x5'));var rimraf=require(_0x1075('0x6'));var config=require('../../config/environment');var attributes=require(_0x1075('0x7'));module[_0x1075('0x8')]=function(_0x14ab3b,_0x4b4ae4){return _0x14ab3b[_0x1075('0x9')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 1ea7140..99ac347 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ec1=['code','message','result','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error'];(function(_0x2eb4d8,_0x16de45){var _0x3d1b75=function(_0x283551){while(--_0x283551){_0x2eb4d8['push'](_0x2eb4d8['shift']());}};_0x3d1b75(++_0x16de45);}(_0x9ec1,0xe7));var _0x19ec=function(_0xe551ca,_0x196d3c){_0xe551ca=_0xe551ca-0x0;var _0x11268d=_0x9ec1[_0xe551ca];return _0x11268d;};'use strict';var _=require(_0x19ec('0x0'));var util=require('util');var moment=require(_0x19ec('0x1'));var BPromise=require(_0x19ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19ec('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x19ec('0x4'))(_0x19ec('0x5'));var config=require(_0x19ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x19ec('0x7')][_0x19ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b3599,_0x14c33e,_0x54e2f1){return new BPromise(function(_0x2d1457,_0x494ea4){return client['request'](_0x4b3599,_0x54e2f1)[_0x19ec('0x9')](function(_0x2595fc){logger[_0x19ec('0xa')](_0x19ec('0xb'),_0x14c33e,_0x19ec('0xc'));logger[_0x19ec('0xd')](_0x19ec('0xe'),_0x14c33e,_0x19ec('0xc'),JSON['stringify'](_0x2595fc));if(_0x2595fc[_0x19ec('0xf')]){if(_0x2595fc['error'][_0x19ec('0x10')]===0x1f4){logger[_0x19ec('0xf')]('ContactItemType,\x20%s,\x20%s',_0x14c33e,_0x2595fc[_0x19ec('0xf')][_0x19ec('0x11')]);return _0x494ea4(_0x2595fc[_0x19ec('0xf')][_0x19ec('0x11')]);}logger[_0x19ec('0xf')](_0x19ec('0xb'),_0x14c33e,_0x2595fc[_0x19ec('0xf')][_0x19ec('0x11')]);return _0x2d1457(_0x2595fc[_0x19ec('0xf')][_0x19ec('0x11')]);}else{logger['info'](_0x19ec('0xb'),_0x14c33e,_0x19ec('0xc'));_0x2d1457(_0x2595fc[_0x19ec('0x12')][_0x19ec('0x11')]);}})['catch'](function(_0x27be27){logger[_0x19ec('0xf')](_0x19ec('0xb'),_0x14c33e,_0x27be27);_0x494ea4(_0x27be27);});});} \ No newline at end of file +var _0x9425=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9425,0x91));var _0x5942=function(_0x1b2d82,_0x452a39){_0x1b2d82=_0x1b2d82-0x0;var _0x4f3589=_0x9425[_0x1b2d82];return _0x4f3589;};'use strict';var _=require('lodash');var util=require(_0x5942('0x0'));var moment=require(_0x5942('0x1'));var BPromise=require(_0x5942('0x2'));var rs=require(_0x5942('0x3'));var fs=require('fs');var Redis=require(_0x5942('0x4'));var db=require(_0x5942('0x5'))['db'];var utils=require(_0x5942('0x6'));var logger=require('../../config/logger')(_0x5942('0x7'));var config=require(_0x5942('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5942('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x186758,_0x179b3b,_0x166d97){return new BPromise(function(_0xfc6e31,_0x4a9539){return client[_0x5942('0xa')](_0x186758,_0x166d97)[_0x5942('0xb')](function(_0x28ecd3){logger[_0x5942('0xc')](_0x5942('0xd'),_0x179b3b,_0x5942('0xe'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x179b3b,_0x5942('0xe'),JSON['stringify'](_0x28ecd3));if(_0x28ecd3[_0x5942('0xf')]){if(_0x28ecd3[_0x5942('0xf')][_0x5942('0x10')]===0x1f4){logger[_0x5942('0xf')](_0x5942('0xd'),_0x179b3b,_0x28ecd3[_0x5942('0xf')][_0x5942('0x11')]);return _0x4a9539(_0x28ecd3[_0x5942('0xf')]['message']);}logger['error'](_0x5942('0xd'),_0x179b3b,_0x28ecd3[_0x5942('0xf')]['message']);return _0xfc6e31(_0x28ecd3[_0x5942('0xf')][_0x5942('0x11')]);}else{logger[_0x5942('0xc')](_0x5942('0xd'),_0x179b3b,_0x5942('0xe'));_0xfc6e31(_0x28ecd3[_0x5942('0x12')][_0x5942('0x11')]);}})[_0x5942('0x13')](function(_0x5e205b){logger[_0x5942('0xf')](_0x5942('0xd'),_0x179b3b,_0x5e205b);_0x4a9539(_0x5e205b);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 94f3dd1..7217bc9 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54e2=['./contactItemType.controller','isAuthenticated','get','/:id','show','post','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x54e2,0x8a));var _0x254e=function(_0x847042,_0x29c519){_0x847042=_0x847042-0x0;var _0x1c7342=_0x54e2[_0x847042];return _0x1c7342;};'use strict';var multer=require(_0x254e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x254e('0x1'));var express=require(_0x254e('0x2'));var router=express['Router']();var fs_extra=require(_0x254e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x254e('0x4'));var config=require(_0x254e('0x5'));var controller=require(_0x254e('0x6'));router['get']('/',auth[_0x254e('0x7')](),controller['index']);router[_0x254e('0x8')](_0x254e('0x9'),auth[_0x254e('0x7')](),controller[_0x254e('0xa')]);router[_0x254e('0xb')]('/',auth[_0x254e('0x7')](),controller['create']);router['put']('/:id',auth[_0x254e('0x7')](),controller[_0x254e('0xc')]);router[_0x254e('0xd')](_0x254e('0x9'),auth[_0x254e('0x7')](),controller[_0x254e('0xe')]);module[_0x254e('0xf')]=router; \ No newline at end of file +var _0x02c9=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show'];(function(_0x498d42,_0x10924e){var _0x39824b=function(_0x564181){while(--_0x564181){_0x498d42['push'](_0x498d42['shift']());}};_0x39824b(++_0x10924e);}(_0x02c9,0xd6));var _0x902c=function(_0x58394f,_0x200b3d){_0x58394f=_0x58394f-0x0;var _0x1ba845=_0x02c9[_0x58394f];return _0x1ba845;};'use strict';var multer=require(_0x902c('0x0'));var util=require(_0x902c('0x1'));var path=require(_0x902c('0x2'));var timeout=require(_0x902c('0x3'));var express=require(_0x902c('0x4'));var router=express[_0x902c('0x5')]();var fs_extra=require(_0x902c('0x6'));var auth=require(_0x902c('0x7'));var interaction=require(_0x902c('0x8'));var config=require(_0x902c('0x9'));var controller=require(_0x902c('0xa'));router[_0x902c('0xb')]('/',auth[_0x902c('0xc')](),controller[_0x902c('0xd')]);router[_0x902c('0xb')](_0x902c('0xe'),auth[_0x902c('0xc')](),controller[_0x902c('0xf')]);router[_0x902c('0x10')]('/',auth[_0x902c('0xc')](),controller[_0x902c('0x11')]);router[_0x902c('0x12')]('/:id',auth[_0x902c('0xc')](),controller[_0x902c('0x13')]);router[_0x902c('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x902c('0x15')]);module[_0x902c('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 15030ed..2317151 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 _0x757a=['exports','STRING'];(function(_0x3b76b1,_0x482438){var _0x2b423e=function(_0xc251cc){while(--_0xc251cc){_0x3b76b1['push'](_0x3b76b1['shift']());}};_0x2b423e(++_0x482438);}(_0x757a,0xde));var _0xa757=function(_0xc7b96b,_0x2bd19e){_0xc7b96b=_0xc7b96b-0x0;var _0x3bf6dc=_0x757a[_0xc7b96b];return _0x3bf6dc;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x1c9ca4,_0x473faf){var _0x1109b6=function(_0x61b3da){while(--_0x61b3da){_0x1c9ca4['push'](_0x1c9ca4['shift']());}};_0x1109b6(++_0x473faf);}(_0xb10b,0x12a));var _0xbb10=function(_0x44540d,_0x361ed2){_0x44540d=_0x44540d-0x0;var _0x3cb1e3=_0xb10b[_0x44540d];return _0x3cb1e3;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 081c6e6..3ddd0b8 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 _0x3459=['attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrFaxAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','order','eml-format','rimraf','zip-dir','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Dashboard','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','params','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x3459,0x129));var _0x9345=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3459[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x9345('0x0'));var rimraf=require(_0x9345('0x1'));var zipdir=require(_0x9345('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9345('0x3'));var util=require(_0x9345('0x4'));var path=require(_0x9345('0x5'));var sox=require('sox');var csv=require(_0x9345('0x6'));var ejs=require(_0x9345('0x7'));var fs=require('fs');var fs_extra=require(_0x9345('0x8'));var _=require('lodash');var squel=require(_0x9345('0x9'));var crypto=require('crypto');var jsforce=require(_0x9345('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9345('0x6'));var querystring=require(_0x9345('0xb'));var Papa=require(_0x9345('0xc'));var Redis=require(_0x9345('0xd'));var authService=require(_0x9345('0xe'));var qs=require(_0x9345('0xf'));var as=require(_0x9345('0x10'));var hardwareService=require(_0x9345('0x11'));var logger=require(_0x9345('0x12'))(_0x9345('0x13'));var utils=require(_0x9345('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9345('0x15'))['db'];config['redis']=_['defaults'](config[_0x9345('0x16')],{'host':_0x9345('0x17'),'port':0x18eb});var socket=require(_0x9345('0x18'))(new Redis(config[_0x9345('0x16')]));require(_0x9345('0x19'))[_0x9345('0x1a')](socket);function respondWithStatusCode(_0x41f150,_0xc81dd9){_0xc81dd9=_0xc81dd9||0xcc;return function(_0x5125e1){if(_0x5125e1){return _0x41f150['sendStatus'](_0xc81dd9);}return _0x41f150[_0x9345('0x1b')](_0xc81dd9)[_0x9345('0x1c')]();};}function respondWithResult(_0x344793,_0x4e13c4){_0x4e13c4=_0x4e13c4||0xc8;return function(_0xbe64f4){if(_0xbe64f4){return _0x344793['status'](_0x4e13c4)[_0x9345('0x1d')](_0xbe64f4);}};}function respondWithFilteredResult(_0x4783fc,_0x24ffa4){return function(_0x21aaf9){if(_0x21aaf9){var _0x2738a8=typeof _0x24ffa4[_0x9345('0x1e')]===_0x9345('0x1f')&&typeof _0x24ffa4[_0x9345('0x20')]===_0x9345('0x1f');var _0x5b300a=_0x21aaf9[_0x9345('0x21')];var _0x56906d=_0x2738a8?0x0:_0x24ffa4[_0x9345('0x1e')];var _0x27092d=_0x2738a8?_0x21aaf9[_0x9345('0x21')]:_0x24ffa4['offset']+_0x24ffa4[_0x9345('0x20')];var _0x57a546;if(_0x27092d>=_0x5b300a){_0x27092d=_0x5b300a;_0x57a546=0xc8;}else{_0x57a546=0xce;}_0x4783fc[_0x9345('0x1b')](_0x57a546);return _0x4783fc[_0x9345('0x22')](_0x9345('0x23'),_0x56906d+'-'+_0x27092d+'/'+_0x5b300a)[_0x9345('0x1d')](_0x21aaf9);}return null;};}function patchUpdates(_0x423010){return function(_0x3fef43){try{jsonpatch[_0x9345('0x24')](_0x3fef43,_0x423010,!![]);}catch(_0x333107){return BPromise[_0x9345('0x25')](_0x333107);}return _0x3fef43[_0x9345('0x26')]();};}function saveUpdates(_0x66772e,_0x5d3449){return function(_0x1c4697){if(_0x1c4697){return _0x1c4697[_0x9345('0x27')](_0x66772e)['then'](function(_0x51c03f){return _0x51c03f;});}return null;};}function removeEntity(_0x3abd78,_0x54b9a8){return function(_0x198acc){if(_0x198acc){return _0x198acc[_0x9345('0x28')]()[_0x9345('0x29')](function(){var _0x4b046a=_0x198acc[_0x9345('0x2a')]({'plain':!![]});var _0xf3a891='CustomDashboards';return db[_0x9345('0x2b')][_0x9345('0x28')]({'where':{'type':_0xf3a891,'resourceId':_0x4b046a['id']}})[_0x9345('0x29')](function(){return _0x198acc;});})[_0x9345('0x29')](function(){_0x3abd78[_0x9345('0x1b')](0xcc)[_0x9345('0x1c')]();});}};}function handleEntityNotFound(_0x5702f7,_0x5a1175){return function(_0xe09584){if(!_0xe09584){_0x5702f7[_0x9345('0x2c')](0x194);}return _0xe09584;};}function handleError(_0x314197,_0x35ada6){_0x35ada6=_0x35ada6||0x1f4;return function(_0x96cb63){logger[_0x9345('0x2d')](_0x96cb63[_0x9345('0x2e')]);if(_0x96cb63[_0x9345('0x2f')]){delete _0x96cb63[_0x9345('0x2f')];}_0x314197[_0x9345('0x1b')](_0x35ada6)[_0x9345('0x30')](_0x96cb63);};}exports[_0x9345('0x31')]=function(_0x4e9319,_0xdea60e){var _0x10bf14={},_0x9039b9={},_0x55a87e={'count':0x0,'rows':[]};var _0x549fce=_[_0x9345('0x32')](db[_0x9345('0x33')]['rawAttributes'],function(_0x45548a){return{'name':_0x45548a[_0x9345('0x34')],'type':_0x45548a[_0x9345('0x35')][_0x9345('0x36')]};});_0x9039b9['model']=_[_0x9345('0x32')](_0x549fce,_0x9345('0x2f'));_0x9039b9[_0x9345('0x37')]=_[_0x9345('0x38')](_0x4e9319[_0x9345('0x37')]);_0x9039b9[_0x9345('0x39')]=_[_0x9345('0x3a')](_0x9039b9['model'],_0x9039b9['query']);_0x10bf14['attributes']=_['intersection'](_0x9039b9[_0x9345('0x3b')],qs[_0x9345('0x3c')](_0x4e9319['query']['fields']));_0x10bf14['attributes']=_0x10bf14[_0x9345('0x3d')][_0x9345('0x3e')]?_0x10bf14[_0x9345('0x3d')]:_0x9039b9['model'];if(!_0x4e9319[_0x9345('0x37')][_0x9345('0x3f')](_0x9345('0x40'))){_0x10bf14[_0x9345('0x20')]=qs[_0x9345('0x20')](_0x4e9319[_0x9345('0x37')][_0x9345('0x20')]);_0x10bf14[_0x9345('0x1e')]=qs[_0x9345('0x1e')](_0x4e9319[_0x9345('0x37')]['offset']);}_0x10bf14['order']=qs[_0x9345('0x41')](_0x4e9319['query'][_0x9345('0x41')]);_0x10bf14[_0x9345('0x42')]=qs[_0x9345('0x39')](_[_0x9345('0x43')](_0x4e9319[_0x9345('0x37')],_0x9039b9[_0x9345('0x39')]),_0x549fce);if(_0x4e9319['query'][_0x9345('0x44')]){_0x10bf14[_0x9345('0x42')]=_[_0x9345('0x45')](_0x10bf14[_0x9345('0x42')],{'$or':_[_0x9345('0x32')](_0x549fce,function(_0x3b22a9){if(_0x3b22a9[_0x9345('0x35')]!==_0x9345('0x46')){var _0x487df0={};_0x487df0[_0x3b22a9['name']]={'$like':'%'+_0x4e9319['query'][_0x9345('0x44')]+'%'};return _0x487df0;}})});}_0x10bf14=_[_0x9345('0x45')]({},_0x10bf14,_0x4e9319[_0x9345('0x47')]);var _0x42e913={'where':_0x10bf14['where']};return db[_0x9345('0x33')][_0x9345('0x21')](_0x42e913)[_0x9345('0x29')](function(_0x319136){_0x55a87e['count']=_0x319136;if(_0x4e9319[_0x9345('0x37')]['includeAll']){_0x10bf14['include']=[{'all':!![]}];}return db['Dashboard'][_0x9345('0x48')](_0x10bf14);})['then'](function(_0x19818c){_0x55a87e[_0x9345('0x49')]=_0x19818c;return _0x55a87e;})[_0x9345('0x29')](respondWithFilteredResult(_0xdea60e,_0x10bf14))[_0x9345('0x4a')](handleError(_0xdea60e,null));};exports[_0x9345('0x4b')]=function(_0xe2a2a1,_0x17a2be){var _0x46c038={'raw':![],'where':{'id':_0xe2a2a1['params']['id']}},_0x1ffdc1={};_0x1ffdc1[_0x9345('0x3b')]=_['keys'](db[_0x9345('0x33')][_0x9345('0x4c')]);_0x1ffdc1[_0x9345('0x37')]=_[_0x9345('0x38')](_0xe2a2a1[_0x9345('0x37')]);_0x1ffdc1[_0x9345('0x39')]=_['intersection'](_0x1ffdc1[_0x9345('0x3b')],_0x1ffdc1[_0x9345('0x37')]);_0x46c038[_0x9345('0x3d')]=_[_0x9345('0x3a')](_0x1ffdc1[_0x9345('0x3b')],qs[_0x9345('0x3c')](_0xe2a2a1[_0x9345('0x37')][_0x9345('0x3c')]));_0x46c038[_0x9345('0x3d')]=_0x46c038[_0x9345('0x3d')][_0x9345('0x3e')]?_0x46c038[_0x9345('0x3d')]:_0x1ffdc1[_0x9345('0x3b')];if(_0xe2a2a1[_0x9345('0x37')][_0x9345('0x4d')]){_0x46c038[_0x9345('0x4e')]=[{'all':!![]}];}_0x46c038=_[_0x9345('0x45')]({},_0x46c038,_0xe2a2a1[_0x9345('0x47')]);return db['Dashboard'][_0x9345('0x4f')](_0x46c038)['then'](handleEntityNotFound(_0x17a2be,null))['then'](respondWithResult(_0x17a2be,null))['catch'](handleError(_0x17a2be,null));};exports[_0x9345('0x50')]=function(_0x1c9bf5,_0x4d0c6f){return db[_0x9345('0x33')][_0x9345('0x50')](_0x1c9bf5[_0x9345('0x51')],{})[_0x9345('0x29')](function(_0x279b87){var _0x5b51d9=_0x1c9bf5['user'][_0x9345('0x2a')]({'plain':!![]});if(!_0x5b51d9)throw new Error(_0x9345('0x52'));if(_0x5b51d9[_0x9345('0x53')]==='user'){var _0x1d3ef7=_0x279b87['get']({'plain':!![]});var _0x5e436b=_0x9345('0x54');return db[_0x9345('0x55')][_0x9345('0x4f')]({'where':{'name':_0x5e436b,'userProfileId':_0x5b51d9[_0x9345('0x56')]},'raw':!![]})[_0x9345('0x29')](function(_0x4c4cf2){if(_0x4c4cf2&&_0x4c4cf2[_0x9345('0x57')]===0x0){return db[_0x9345('0x2b')][_0x9345('0x50')]({'name':_0x1d3ef7[_0x9345('0x2f')],'resourceId':_0x1d3ef7['id'],'type':_0x4c4cf2[_0x9345('0x2f')],'sectionId':_0x4c4cf2['id']},{})['then'](function(){return _0x279b87;});}else{return _0x279b87;}})[_0x9345('0x4a')](function(_0x5afaad){logger['error'](_0x9345('0x58'),_0x5afaad);throw _0x5afaad;});}return _0x279b87;})[_0x9345('0x29')](respondWithResult(_0x4d0c6f,0xc9))[_0x9345('0x4a')](handleError(_0x4d0c6f,null));};exports[_0x9345('0x59')]=function(_0x268d06,_0x387008){var _0x4a5e5f={'where':{'id':_0x268d06['params']['id']}},_0x3f2081={};_0x3f2081[_0x9345('0x3b')]=_[_0x9345('0x38')](db[_0x9345('0x33')][_0x9345('0x4c')]);_0x4a5e5f[_0x9345('0x3d')]=_[_0x9345('0x3a')](_0x3f2081['model'],qs[_0x9345('0x3c')](_0x268d06[_0x9345('0x37')][_0x9345('0x3c')]));_0x4a5e5f[_0x9345('0x3d')]=_0x4a5e5f[_0x9345('0x3d')]['length']?_0x4a5e5f['attributes']:_0x3f2081[_0x9345('0x3b')];if(_0x268d06[_0x9345('0x37')][_0x9345('0x4d')]){_0x4a5e5f[_0x9345('0x4e')]=[{'all':!![]}];}_0x4a5e5f=_[_0x9345('0x45')]({},_0x4a5e5f,_0x268d06['options']);return db[_0x9345('0x33')][_0x9345('0x4f')](_0x4a5e5f)['then'](handleEntityNotFound(_0x387008,null))[_0x9345('0x29')](function(_0x59bac9){if(_0x59bac9){var _0x1d8fdb=_0x59bac9[_0x9345('0x2a')]({'plain':!![]});_0x1d8fdb=qs[_0x9345('0x5a')](_0x1d8fdb,['id',_0x9345('0x5b'),'updatedAt']);_0x268d06[_0x9345('0x51')]=_[_0x9345('0x5a')](_0x268d06[_0x9345('0x51')],['id','createdAt',_0x9345('0x5c')]);return db['Dashboard']['create'](_[_0x9345('0x45')](_0x1d8fdb,_0x268d06[_0x9345('0x51')]),{'include':_0x268d06['query']['includeAll']?[{'all':!![]}]:undefined})[_0x9345('0x29')](function(_0x22bfde){var _0x189295=_0x268d06['user'][_0x9345('0x2a')]({'plain':!![]});if(!_0x189295)throw new Error(_0x9345('0x52'));if(_0x189295[_0x9345('0x53')]===_0x9345('0x5d')){var _0x4e77d8=_0x22bfde['get']({'plain':!![]});var _0x1e18a1=_0x9345('0x54');return db['UserProfileSection'][_0x9345('0x4f')]({'where':{'name':_0x1e18a1,'userProfileId':_0x189295[_0x9345('0x56')]},'raw':!![]})[_0x9345('0x29')](function(_0x4ae49b){if(_0x4ae49b&&_0x4ae49b[_0x9345('0x57')]===0x0){return db[_0x9345('0x2b')][_0x9345('0x50')]({'name':_0x4e77d8[_0x9345('0x2f')],'resourceId':_0x4e77d8['id'],'type':_0x4ae49b[_0x9345('0x2f')],'sectionId':_0x4ae49b['id']},{})[_0x9345('0x29')](function(){return _0x22bfde;});}else{return _0x22bfde;}})[_0x9345('0x4a')](function(_0xf7eeb0){logger[_0x9345('0x2d')](_0x9345('0x58'),_0xf7eeb0);throw _0xf7eeb0;});}return _0x22bfde;});}})[_0x9345('0x29')](respondWithResult(_0x387008,0xc9))[_0x9345('0x4a')](handleError(_0x387008,null));};exports['update']=function(_0x10f5a9,_0x3b07e2){if(_0x10f5a9['body']['id']){delete _0x10f5a9[_0x9345('0x51')]['id'];}return db['Dashboard'][_0x9345('0x4f')]({'where':{'id':_0x10f5a9[_0x9345('0x5e')]['id']}})[_0x9345('0x29')](handleEntityNotFound(_0x3b07e2,null))['then'](saveUpdates(_0x10f5a9[_0x9345('0x51')],null))[_0x9345('0x29')](respondWithResult(_0x3b07e2,null))[_0x9345('0x4a')](handleError(_0x3b07e2,null));};exports[_0x9345('0x28')]=function(_0x1db3d1,_0x500095){return db[_0x9345('0x33')][_0x9345('0x4f')]({'where':{'id':_0x1db3d1[_0x9345('0x5e')]['id']}})[_0x9345('0x29')](handleEntityNotFound(_0x500095,null))[_0x9345('0x29')](removeEntity(_0x500095,null))[_0x9345('0x4a')](handleError(_0x500095,null));};function widgetAttributes(_0x2c1405){try{switch(_0x2c1405[_0x9345('0x35')]){case _0x9345('0x5f'):return[{'name':_0x9345('0x60'),'value':_0x2c1405[_0x9345('0x60')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x0]?_0x2c1405['attrs'][0x0]['value']:undefined)||_0x9345('0x62')}];case _0x9345('0x63'):return[{'name':_0x9345('0x64'),'value':_0x2c1405[_0x9345('0x64')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x0]?_0x2c1405[_0x9345('0x61')][0x0][_0x9345('0x65')]:undefined)||''}];case _0x9345('0x66'):return[{'name':_0x9345('0x67'),'value':_0x2c1405[_0x9345('0x67')]||(_0x2c1405['attrs']&&_0x2c1405[_0x9345('0x61')][0x0]?_0x2c1405[_0x9345('0x61')][0x0]['value']:undefined)||_0x9345('0x68')},{'name':'attrTimezone','value':_0x2c1405['attrTimezone']||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x1]?_0x2c1405[_0x9345('0x61')][0x1][_0x9345('0x65')]:undefined)||'0.00'},{'name':_0x9345('0x69'),'value':_0x2c1405[_0x9345('0x69')]||(_0x2c1405['attrs']&&_0x2c1405[_0x9345('0x61')][0x2]?_0x2c1405[_0x9345('0x61')][0x2][_0x9345('0x65')]:undefined)||0xc}];case _0x9345('0x6a'):return[{'name':_0x9345('0x6b'),'value':_0x2c1405[_0x9345('0x6b')]||(_0x2c1405['attrs']&&_0x2c1405['attrs'][0x0]?_0x2c1405[_0x9345('0x61')][0x0][_0x9345('0x65')]:undefined)||_0x9345('0x6c')},{'name':_0x9345('0x6d'),'value':_0x2c1405['attrVoiceQueues']||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405['attrs'][0x1]?_0x2c1405[_0x9345('0x61')][0x1][_0x9345('0x65')]:undefined)||[]},{'name':'attrFontSize','value':_0x2c1405[_0x9345('0x69')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x2]?_0x2c1405[_0x9345('0x61')][0x2]['value']:undefined)||0x14},{'name':_0x9345('0x6e'),'value':_0x2c1405[_0x9345('0x6e')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x3]?_0x2c1405[_0x9345('0x61')][0x3][_0x9345('0x65')]:undefined)||_0x9345('0x6f')},{'name':_0x9345('0x70'),'value':_0x2c1405[_0x9345('0x70')]||(_0x2c1405['attrs']&&_0x2c1405[_0x9345('0x61')][0x4]?_0x2c1405[_0x9345('0x61')][0x4][_0x9345('0x65')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2c1405['attrFaxAccounts']||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x5]?_0x2c1405[_0x9345('0x61')][0x5]['value']:undefined)||''},{'name':_0x9345('0x71'),'value':_0x2c1405[_0x9345('0x71')]||(_0x2c1405['attrs']&&_0x2c1405[_0x9345('0x61')][0x6]?_0x2c1405['attrs'][0x6][_0x9345('0x65')]:undefined)||''},{'name':_0x9345('0x72'),'value':_0x2c1405[_0x9345('0x72')]||(_0x2c1405['attrs']&&_0x2c1405[_0x9345('0x61')][0x7]?_0x2c1405['attrs'][0x7][_0x9345('0x65')]:undefined)||''},{'name':_0x9345('0x73'),'value':_0x2c1405[_0x9345('0x73')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x8]?_0x2c1405[_0x9345('0x61')][0x8][_0x9345('0x65')]:undefined)||''},{'name':_0x9345('0x74'),'value':_0x2c1405[_0x9345('0x74')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x9]?_0x2c1405['attrs'][0x9][_0x9345('0x65')]:undefined)||''}];case _0x9345('0x75'):case _0x9345('0x76'):return[{'name':_0x9345('0x77'),'value':_0x2c1405[_0x9345('0x77')]||(_0x2c1405['attrs']&&_0x2c1405[_0x9345('0x61')][0x0]?_0x2c1405[_0x9345('0x61')][0x0]['value']:undefined)||_0x9345('0x6c')},{'name':_0x9345('0x78'),'value':_0x2c1405[_0x9345('0x78')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405['attrs'][0x1]?_0x2c1405[_0x9345('0x61')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2c1405['attrSerie3']||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x2]?_0x2c1405[_0x9345('0x61')][0x2][_0x9345('0x65')]:undefined)||null},{'name':_0x9345('0x6d'),'value':_0x2c1405[_0x9345('0x6d')]||(_0x2c1405['attrs']&&_0x2c1405['attrs'][0x3]?_0x2c1405[_0x9345('0x61')][0x3][_0x9345('0x65')]:undefined)||[]},{'name':'attrChannel','value':_0x2c1405[_0x9345('0x6e')]||(_0x2c1405['attrs']&&_0x2c1405[_0x9345('0x61')][0x4]?_0x2c1405['attrs'][0x4][_0x9345('0x65')]:undefined)||_0x9345('0x6f')},{'name':'attrEmailAccounts','value':_0x2c1405[_0x9345('0x70')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x5]?_0x2c1405[_0x9345('0x61')][0x5][_0x9345('0x65')]:undefined)||''},{'name':_0x9345('0x79'),'value':_0x2c1405['attrFaxAccounts']||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x6]?_0x2c1405[_0x9345('0x61')][0x6]['value']:undefined)||''},{'name':_0x9345('0x71'),'value':_0x2c1405[_0x9345('0x71')]||(_0x2c1405['attrs']&&_0x2c1405[_0x9345('0x61')][0x7]?_0x2c1405[_0x9345('0x61')][0x7]['value']:undefined)||''},{'name':_0x9345('0x72'),'value':_0x2c1405[_0x9345('0x72')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405['attrs'][0x8]?_0x2c1405[_0x9345('0x61')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2c1405[_0x9345('0x73')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0x9]?_0x2c1405['attrs'][0x9][_0x9345('0x65')]:undefined)||''},{'name':_0x9345('0x74'),'value':_0x2c1405['attrChatWebsites']||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405[_0x9345('0x61')][0xa]?_0x2c1405[_0x9345('0x61')][0xa]['value']:undefined)||''}];case _0x9345('0x7a'):return[{'name':'attrReport','type':_0x2c1405[_0x9345('0x7b')]||(_0x2c1405['attrs']&&_0x2c1405['attrs'][0x0]?_0x2c1405[_0x9345('0x61')][0x0][_0x9345('0x35')]:undefined)||null,'value':_0x2c1405[_0x9345('0x7c')]||(_0x2c1405['attrs']&&_0x2c1405[_0x9345('0x61')][0x0]?_0x2c1405[_0x9345('0x61')][0x0]['value']:undefined)||null},{'name':_0x9345('0x7d'),'value':_0x2c1405[_0x9345('0x7d')]||(_0x2c1405[_0x9345('0x61')]&&_0x2c1405['attrs'][0x1]?_0x2c1405[_0x9345('0x61')][0x1][_0x9345('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x128b75){logger[_0x9345('0x2d')](_0x9345('0x7e'),JSON[_0x9345('0x7f')](_0x128b75));return[];}}exports[_0x9345('0x80')]=function(_0x620d2e,_0x5e625e,_0x2f38af){if(_0x620d2e['body']['id']){delete _0x620d2e[_0x9345('0x51')]['id'];}return db['Dashboard'][_0x9345('0x4f')]({'where':{'id':_0x620d2e[_0x9345('0x5e')]['id']}})[_0x9345('0x29')](handleEntityNotFound(_0x5e625e,null))[_0x9345('0x29')](function(_0x58163d){if(_0x58163d){_0x620d2e[_0x9345('0x51')][_0x9345('0x81')]=_0x58163d['id'];_0x620d2e[_0x9345('0x51')][_0x9345('0x61')]=widgetAttributes(_0x620d2e[_0x9345('0x51')]);return db['DashboardItem'][_0x9345('0x50')](_0x620d2e[_0x9345('0x51')]);}})[_0x9345('0x29')](respondWithResult(_0x5e625e,null))[_0x9345('0x4a')](handleError(_0x5e625e,null));};exports[_0x9345('0x82')]=function(_0x3f1f39,_0x433277,_0x357aed){var _0x31be5c={};var _0x9d049b={};var _0x203b3a;var _0x1cdd05;return db[_0x9345('0x33')][_0x9345('0x83')]({'where':{'id':_0x3f1f39[_0x9345('0x5e')]['id']}})[_0x9345('0x29')](handleEntityNotFound(_0x433277,null))['then'](function(_0x141ec3){if(_0x141ec3){_0x203b3a=_0x141ec3;_0x9d049b[_0x9345('0x3b')]=_[_0x9345('0x38')](db[_0x9345('0x84')]['rawAttributes']);_0x9d049b[_0x9345('0x37')]=_[_0x9345('0x38')](_0x3f1f39['query']);_0x9d049b['filters']=_[_0x9345('0x3a')](_0x9d049b[_0x9345('0x3b')],_0x9d049b[_0x9345('0x37')]);_0x31be5c[_0x9345('0x3d')]=_['intersection'](_0x9d049b[_0x9345('0x3b')],qs[_0x9345('0x3c')](_0x3f1f39[_0x9345('0x37')][_0x9345('0x3c')]));_0x31be5c[_0x9345('0x3d')]=_0x31be5c[_0x9345('0x3d')]['length']?_0x31be5c[_0x9345('0x3d')]:_0x9d049b[_0x9345('0x3b')];_0x31be5c[_0x9345('0x85')]=qs['sort'](_0x3f1f39[_0x9345('0x37')]['sort']);_0x31be5c['where']=qs['filters'](_[_0x9345('0x43')](_0x3f1f39['query'],_0x9d049b[_0x9345('0x39')]));if(_0x3f1f39[_0x9345('0x37')][_0x9345('0x44')]){_0x31be5c[_0x9345('0x42')]=_[_0x9345('0x45')](_0x31be5c['where'],{'$or':_[_0x9345('0x32')](_0x31be5c[_0x9345('0x3d')],function(_0x5eee76){var _0x1f1bda={};_0x1f1bda[_0x5eee76]={'$like':'%'+_0x3f1f39['query']['filter']+'%'};return _0x1f1bda;})});}_0x31be5c=_[_0x9345('0x45')]({},_0x31be5c,_0x3f1f39[_0x9345('0x47')]);return _0x203b3a['getItems'](_0x31be5c);}})['then'](function(_0x12dfcb){if(_0x12dfcb){_0x1cdd05=_0x12dfcb['length'];if(!_0x3f1f39[_0x9345('0x37')][_0x9345('0x3f')]('nolimit')){_0x31be5c['limit']=qs['limit'](_0x3f1f39[_0x9345('0x37')][_0x9345('0x20')]);_0x31be5c[_0x9345('0x1e')]=qs[_0x9345('0x1e')](_0x3f1f39['query'][_0x9345('0x1e')]);}return _0x203b3a[_0x9345('0x82')](_0x31be5c);}})[_0x9345('0x29')](function(_0xc815a0){if(_0xc815a0){return _0xc815a0?{'count':_0x1cdd05,'rows':_0xc815a0}:null;}})[_0x9345('0x29')](respondWithResult(_0x433277,null))['catch'](handleError(_0x433277,null));}; \ No newline at end of file +var _0x9b5e=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','UserProfileResource','stack','name','send','index','map','Dashboard','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','error','clone','length','omit','createdAt','body','updatedAt','update','destroy','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','findOne','getItems','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x10eb4f,_0x356f91){var _0x4743ff=function(_0x2d0287){while(--_0x2d0287){_0x10eb4f['push'](_0x10eb4f['shift']());}};_0x4743ff(++_0x356f91);}(_0x9b5e,0x7a));var _0xe9b5=function(_0x400e4a,_0x29ef2d){_0x400e4a=_0x400e4a-0x0;var _0x4c1cae=_0x9b5e[_0x400e4a];return _0x4c1cae;};'use strict';var emlformat=require(_0xe9b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9b5('0x2'));var moment=require(_0xe9b5('0x3'));var BPromise=require(_0xe9b5('0x4'));var Mustache=require(_0xe9b5('0x5'));var util=require(_0xe9b5('0x6'));var path=require(_0xe9b5('0x7'));var sox=require(_0xe9b5('0x8'));var csv=require('to-csv');var ejs=require(_0xe9b5('0x9'));var fs=require('fs');var fs_extra=require(_0xe9b5('0xa'));var _=require(_0xe9b5('0xb'));var squel=require(_0xe9b5('0xc'));var crypto=require(_0xe9b5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe9b5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe9b5('0xf'));var Papa=require('papaparse');var Redis=require(_0xe9b5('0x10'));var authService=require(_0xe9b5('0x11'));var qs=require(_0xe9b5('0x12'));var as=require(_0xe9b5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9b5('0x14'))(_0xe9b5('0x15'));var utils=require(_0xe9b5('0x16'));var config=require(_0xe9b5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9b5('0x18'))['db'];config[_0xe9b5('0x19')]=_[_0xe9b5('0x1a')](config[_0xe9b5('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe9b5('0x1b'))(new Redis(config[_0xe9b5('0x19')]));require(_0xe9b5('0x1c'))[_0xe9b5('0x1d')](socket);function respondWithStatusCode(_0x4bc6a5,_0x4525e1){_0x4525e1=_0x4525e1||0xcc;return function(_0x7450cb){if(_0x7450cb){return _0x4bc6a5[_0xe9b5('0x1e')](_0x4525e1);}return _0x4bc6a5[_0xe9b5('0x1f')](_0x4525e1)[_0xe9b5('0x20')]();};}function respondWithResult(_0x348ebf,_0x53be67){_0x53be67=_0x53be67||0xc8;return function(_0x26db2e){if(_0x26db2e){return _0x348ebf[_0xe9b5('0x1f')](_0x53be67)['json'](_0x26db2e);}};}function respondWithFilteredResult(_0x561aa7,_0x40c8f0){return function(_0x18602c){if(_0x18602c){var _0x214a38=typeof _0x40c8f0[_0xe9b5('0x21')]===_0xe9b5('0x22')&&typeof _0x40c8f0[_0xe9b5('0x23')]==='undefined';var _0x146a02=_0x18602c[_0xe9b5('0x24')];var _0x24ff97=_0x214a38?0x0:_0x40c8f0[_0xe9b5('0x21')];var _0x392912=_0x214a38?_0x18602c[_0xe9b5('0x24')]:_0x40c8f0[_0xe9b5('0x21')]+_0x40c8f0['limit'];var _0x36ff16;if(_0x392912>=_0x146a02){_0x392912=_0x146a02;_0x36ff16=0xc8;}else{_0x36ff16=0xce;}_0x561aa7[_0xe9b5('0x1f')](_0x36ff16);return _0x561aa7[_0xe9b5('0x25')](_0xe9b5('0x26'),_0x24ff97+'-'+_0x392912+'/'+_0x146a02)[_0xe9b5('0x27')](_0x18602c);}return null;};}function patchUpdates(_0x55c249){return function(_0x26b384){try{jsonpatch[_0xe9b5('0x28')](_0x26b384,_0x55c249,!![]);}catch(_0x363ec2){return BPromise[_0xe9b5('0x29')](_0x363ec2);}return _0x26b384[_0xe9b5('0x2a')]();};}function saveUpdates(_0x49231b,_0x534424){return function(_0x2fe360){if(_0x2fe360){return _0x2fe360['update'](_0x49231b)[_0xe9b5('0x2b')](function(_0x2ccf9f){return _0x2ccf9f;});}return null;};}function removeEntity(_0x605dab,_0x20922d){return function(_0x5a2a18){if(_0x5a2a18){return _0x5a2a18['destroy']()['then'](function(){var _0x5a90a8=_0x5a2a18['get']({'plain':!![]});var _0xa06359='CustomDashboards';return db[_0xe9b5('0x2c')]['destroy']({'where':{'type':_0xa06359,'resourceId':_0x5a90a8['id']}})[_0xe9b5('0x2b')](function(){return _0x5a2a18;});})['then'](function(){_0x605dab[_0xe9b5('0x1f')](0xcc)[_0xe9b5('0x20')]();});}};}function handleEntityNotFound(_0x5f11d0,_0xa6013f){return function(_0x45df73){if(!_0x45df73){_0x5f11d0[_0xe9b5('0x1e')](0x194);}return _0x45df73;};}function handleError(_0x44c03a,_0x5f05e8){_0x5f05e8=_0x5f05e8||0x1f4;return function(_0x460b4f){logger['error'](_0x460b4f[_0xe9b5('0x2d')]);if(_0x460b4f[_0xe9b5('0x2e')]){delete _0x460b4f[_0xe9b5('0x2e')];}_0x44c03a[_0xe9b5('0x1f')](_0x5f05e8)[_0xe9b5('0x2f')](_0x460b4f);};}exports[_0xe9b5('0x30')]=function(_0x50d19e,_0x539a33){var _0x1e3922={},_0x279884={},_0x335898={'count':0x0,'rows':[]};var _0x2fcc0e=_[_0xe9b5('0x31')](db[_0xe9b5('0x32')]['rawAttributes'],function(_0x33afa4){return{'name':_0x33afa4['fieldName'],'type':_0x33afa4['type'][_0xe9b5('0x33')]};});_0x279884['model']=_[_0xe9b5('0x31')](_0x2fcc0e,_0xe9b5('0x2e'));_0x279884[_0xe9b5('0x34')]=_[_0xe9b5('0x35')](_0x50d19e[_0xe9b5('0x34')]);_0x279884[_0xe9b5('0x36')]=_[_0xe9b5('0x37')](_0x279884[_0xe9b5('0x38')],_0x279884[_0xe9b5('0x34')]);_0x1e3922['attributes']=_['intersection'](_0x279884[_0xe9b5('0x38')],qs[_0xe9b5('0x39')](_0x50d19e[_0xe9b5('0x34')][_0xe9b5('0x39')]));_0x1e3922[_0xe9b5('0x3a')]=_0x1e3922[_0xe9b5('0x3a')]['length']?_0x1e3922[_0xe9b5('0x3a')]:_0x279884['model'];if(!_0x50d19e[_0xe9b5('0x34')][_0xe9b5('0x3b')](_0xe9b5('0x3c'))){_0x1e3922['limit']=qs[_0xe9b5('0x23')](_0x50d19e['query'][_0xe9b5('0x23')]);_0x1e3922[_0xe9b5('0x21')]=qs[_0xe9b5('0x21')](_0x50d19e[_0xe9b5('0x34')]['offset']);}_0x1e3922['order']=qs[_0xe9b5('0x3d')](_0x50d19e[_0xe9b5('0x34')]['sort']);_0x1e3922[_0xe9b5('0x3e')]=qs['filters'](_['pick'](_0x50d19e[_0xe9b5('0x34')],_0x279884[_0xe9b5('0x36')]),_0x2fcc0e);if(_0x50d19e[_0xe9b5('0x34')][_0xe9b5('0x3f')]){_0x1e3922['where']=_[_0xe9b5('0x40')](_0x1e3922['where'],{'$or':_['map'](_0x2fcc0e,function(_0x4e1efb){if(_0x4e1efb[_0xe9b5('0x41')]!==_0xe9b5('0x42')){var _0x5b54d7={};_0x5b54d7[_0x4e1efb[_0xe9b5('0x2e')]]={'$like':'%'+_0x50d19e[_0xe9b5('0x34')][_0xe9b5('0x3f')]+'%'};return _0x5b54d7;}})});}_0x1e3922=_[_0xe9b5('0x40')]({},_0x1e3922,_0x50d19e[_0xe9b5('0x43')]);var _0x4e050c={'where':_0x1e3922[_0xe9b5('0x3e')]};return db[_0xe9b5('0x32')]['count'](_0x4e050c)[_0xe9b5('0x2b')](function(_0x353d77){_0x335898['count']=_0x353d77;if(_0x50d19e[_0xe9b5('0x34')][_0xe9b5('0x44')]){_0x1e3922['include']=[{'all':!![]}];}return db[_0xe9b5('0x32')][_0xe9b5('0x45')](_0x1e3922);})[_0xe9b5('0x2b')](function(_0xe36f02){_0x335898[_0xe9b5('0x46')]=_0xe36f02;return _0x335898;})[_0xe9b5('0x2b')](respondWithFilteredResult(_0x539a33,_0x1e3922))[_0xe9b5('0x47')](handleError(_0x539a33,null));};exports[_0xe9b5('0x48')]=function(_0x13cd73,_0x3f9944){var _0x405451={'raw':![],'where':{'id':_0x13cd73[_0xe9b5('0x49')]['id']}},_0x56de45={};_0x56de45[_0xe9b5('0x38')]=_[_0xe9b5('0x35')](db[_0xe9b5('0x32')][_0xe9b5('0x4a')]);_0x56de45[_0xe9b5('0x34')]=_[_0xe9b5('0x35')](_0x13cd73[_0xe9b5('0x34')]);_0x56de45[_0xe9b5('0x36')]=_['intersection'](_0x56de45[_0xe9b5('0x38')],_0x56de45[_0xe9b5('0x34')]);_0x405451[_0xe9b5('0x3a')]=_['intersection'](_0x56de45[_0xe9b5('0x38')],qs[_0xe9b5('0x39')](_0x13cd73[_0xe9b5('0x34')]['fields']));_0x405451[_0xe9b5('0x3a')]=_0x405451[_0xe9b5('0x3a')]['length']?_0x405451[_0xe9b5('0x3a')]:_0x56de45[_0xe9b5('0x38')];if(_0x13cd73[_0xe9b5('0x34')]['includeAll']){_0x405451[_0xe9b5('0x4b')]=[{'all':!![]}];}_0x405451=_[_0xe9b5('0x40')]({},_0x405451,_0x13cd73[_0xe9b5('0x43')]);return db[_0xe9b5('0x32')]['find'](_0x405451)[_0xe9b5('0x2b')](handleEntityNotFound(_0x3f9944,null))['then'](respondWithResult(_0x3f9944,null))[_0xe9b5('0x47')](handleError(_0x3f9944,null));};exports[_0xe9b5('0x4c')]=function(_0x204358,_0x3511b2){return db[_0xe9b5('0x32')]['create'](_0x204358['body'],{})[_0xe9b5('0x2b')](function(_0x592a1d){var _0x2abc95=_0x204358[_0xe9b5('0x4d')][_0xe9b5('0x4e')]({'plain':!![]});if(!_0x2abc95)throw new Error(_0xe9b5('0x4f'));if(_0x2abc95[_0xe9b5('0x50')]===_0xe9b5('0x4d')){var _0x193fed=_0x592a1d[_0xe9b5('0x4e')]({'plain':!![]});var _0x2123a4=_0xe9b5('0x51');return db[_0xe9b5('0x52')][_0xe9b5('0x53')]({'where':{'name':_0x2123a4,'userProfileId':_0x2abc95[_0xe9b5('0x54')]},'raw':!![]})['then'](function(_0x23eeac){if(_0x23eeac&&_0x23eeac[_0xe9b5('0x55')]===0x0){return db[_0xe9b5('0x2c')][_0xe9b5('0x4c')]({'name':_0x193fed[_0xe9b5('0x2e')],'resourceId':_0x193fed['id'],'type':_0x23eeac[_0xe9b5('0x2e')],'sectionId':_0x23eeac['id']},{})['then'](function(){return _0x592a1d;});}else{return _0x592a1d;}})[_0xe9b5('0x47')](function(_0x3d9dcc){logger[_0xe9b5('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d9dcc);throw _0x3d9dcc;});}return _0x592a1d;})[_0xe9b5('0x2b')](respondWithResult(_0x3511b2,0xc9))[_0xe9b5('0x47')](handleError(_0x3511b2,null));};exports[_0xe9b5('0x57')]=function(_0x4bd1be,_0x3e38a0){var _0x26c673={'where':{'id':_0x4bd1be[_0xe9b5('0x49')]['id']}},_0x2b224f={};_0x2b224f[_0xe9b5('0x38')]=_[_0xe9b5('0x35')](db[_0xe9b5('0x32')]['rawAttributes']);_0x26c673[_0xe9b5('0x3a')]=_[_0xe9b5('0x37')](_0x2b224f[_0xe9b5('0x38')],qs[_0xe9b5('0x39')](_0x4bd1be['query'][_0xe9b5('0x39')]));_0x26c673['attributes']=_0x26c673['attributes'][_0xe9b5('0x58')]?_0x26c673[_0xe9b5('0x3a')]:_0x2b224f[_0xe9b5('0x38')];if(_0x4bd1be[_0xe9b5('0x34')][_0xe9b5('0x44')]){_0x26c673[_0xe9b5('0x4b')]=[{'all':!![]}];}_0x26c673=_[_0xe9b5('0x40')]({},_0x26c673,_0x4bd1be['options']);return db[_0xe9b5('0x32')][_0xe9b5('0x53')](_0x26c673)[_0xe9b5('0x2b')](handleEntityNotFound(_0x3e38a0,null))[_0xe9b5('0x2b')](function(_0x16a824){if(_0x16a824){var _0x146cd7=_0x16a824['get']({'plain':!![]});_0x146cd7=qs[_0xe9b5('0x59')](_0x146cd7,['id',_0xe9b5('0x5a'),'updatedAt']);_0x4bd1be[_0xe9b5('0x5b')]=_[_0xe9b5('0x59')](_0x4bd1be[_0xe9b5('0x5b')],['id',_0xe9b5('0x5a'),_0xe9b5('0x5c')]);return db['Dashboard'][_0xe9b5('0x4c')](_[_0xe9b5('0x40')](_0x146cd7,_0x4bd1be[_0xe9b5('0x5b')]),{'include':_0x4bd1be[_0xe9b5('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0xe9b5('0x2b')](function(_0x32d57f){var _0x177d3b=_0x4bd1be['user'][_0xe9b5('0x4e')]({'plain':!![]});if(!_0x177d3b)throw new Error(_0xe9b5('0x4f'));if(_0x177d3b[_0xe9b5('0x50')]==='user'){var _0x2bcd49=_0x32d57f[_0xe9b5('0x4e')]({'plain':!![]});var _0x36ea3b=_0xe9b5('0x51');return db[_0xe9b5('0x52')]['find']({'where':{'name':_0x36ea3b,'userProfileId':_0x177d3b[_0xe9b5('0x54')]},'raw':!![]})[_0xe9b5('0x2b')](function(_0x2aa68e){if(_0x2aa68e&&_0x2aa68e[_0xe9b5('0x55')]===0x0){return db[_0xe9b5('0x2c')][_0xe9b5('0x4c')]({'name':_0x2bcd49['name'],'resourceId':_0x2bcd49['id'],'type':_0x2aa68e[_0xe9b5('0x2e')],'sectionId':_0x2aa68e['id']},{})['then'](function(){return _0x32d57f;});}else{return _0x32d57f;}})[_0xe9b5('0x47')](function(_0x2ef7f1){logger[_0xe9b5('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ef7f1);throw _0x2ef7f1;});}return _0x32d57f;});}})[_0xe9b5('0x2b')](respondWithResult(_0x3e38a0,0xc9))[_0xe9b5('0x47')](handleError(_0x3e38a0,null));};exports[_0xe9b5('0x5d')]=function(_0x518703,_0x5d6419){if(_0x518703[_0xe9b5('0x5b')]['id']){delete _0x518703[_0xe9b5('0x5b')]['id'];}return db['Dashboard'][_0xe9b5('0x53')]({'where':{'id':_0x518703[_0xe9b5('0x49')]['id']}})[_0xe9b5('0x2b')](handleEntityNotFound(_0x5d6419,null))[_0xe9b5('0x2b')](saveUpdates(_0x518703[_0xe9b5('0x5b')],null))['then'](respondWithResult(_0x5d6419,null))[_0xe9b5('0x47')](handleError(_0x5d6419,null));};exports[_0xe9b5('0x5e')]=function(_0x487b57,_0x110a5d){return db[_0xe9b5('0x32')][_0xe9b5('0x53')]({'where':{'id':_0x487b57[_0xe9b5('0x49')]['id']}})[_0xe9b5('0x2b')](handleEntityNotFound(_0x110a5d,null))[_0xe9b5('0x2b')](removeEntity(_0x110a5d,null))[_0xe9b5('0x47')](handleError(_0x110a5d,null));};function widgetAttributes(_0x1698b8){try{switch(_0x1698b8[_0xe9b5('0x41')]){case _0xe9b5('0x5f'):return[{'name':_0xe9b5('0x60'),'value':_0x1698b8[_0xe9b5('0x60')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x0]?_0x1698b8[_0xe9b5('0x61')][0x0][_0xe9b5('0x62')]:undefined)||_0xe9b5('0x63')}];case _0xe9b5('0x64'):return[{'name':_0xe9b5('0x65'),'value':_0x1698b8[_0xe9b5('0x65')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x0]?_0x1698b8[_0xe9b5('0x61')][0x0][_0xe9b5('0x62')]:undefined)||''}];case _0xe9b5('0x66'):return[{'name':'attrHourFormat','value':_0x1698b8[_0xe9b5('0x67')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x0]?_0x1698b8['attrs'][0x0][_0xe9b5('0x62')]:undefined)||_0xe9b5('0x68')},{'name':_0xe9b5('0x69'),'value':_0x1698b8[_0xe9b5('0x69')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x1]?_0x1698b8['attrs'][0x1][_0xe9b5('0x62')]:undefined)||_0xe9b5('0x6a')},{'name':_0xe9b5('0x6b'),'value':_0x1698b8[_0xe9b5('0x6b')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x2]?_0x1698b8[_0xe9b5('0x61')][0x2]['value']:undefined)||0xc}];case _0xe9b5('0x6c'):return[{'name':'attrMetric','value':_0x1698b8[_0xe9b5('0x6d')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x0]?_0x1698b8[_0xe9b5('0x61')][0x0][_0xe9b5('0x62')]:undefined)||_0xe9b5('0x6e')},{'name':'attrVoiceQueues','value':_0x1698b8[_0xe9b5('0x6f')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x1]?_0x1698b8[_0xe9b5('0x61')][0x1][_0xe9b5('0x62')]:undefined)||[]},{'name':_0xe9b5('0x6b'),'value':_0x1698b8['attrFontSize']||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x2]?_0x1698b8[_0xe9b5('0x61')][0x2][_0xe9b5('0x62')]:undefined)||0x14},{'name':'attrChannel','value':_0x1698b8[_0xe9b5('0x70')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x3]?_0x1698b8[_0xe9b5('0x61')][0x3][_0xe9b5('0x62')]:undefined)||'voice'},{'name':_0xe9b5('0x71'),'value':_0x1698b8[_0xe9b5('0x71')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x4]?_0x1698b8[_0xe9b5('0x61')][0x4][_0xe9b5('0x62')]:undefined)||''},{'name':_0xe9b5('0x72'),'value':_0x1698b8[_0xe9b5('0x72')]||(_0x1698b8['attrs']&&_0x1698b8[_0xe9b5('0x61')][0x5]?_0x1698b8[_0xe9b5('0x61')][0x5][_0xe9b5('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1698b8[_0xe9b5('0x73')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x6]?_0x1698b8[_0xe9b5('0x61')][0x6][_0xe9b5('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1698b8[_0xe9b5('0x74')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x7]?_0x1698b8[_0xe9b5('0x61')][0x7]['value']:undefined)||''},{'name':_0xe9b5('0x75'),'value':_0x1698b8[_0xe9b5('0x75')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x8]?_0x1698b8[_0xe9b5('0x61')][0x8][_0xe9b5('0x62')]:undefined)||''},{'name':_0xe9b5('0x76'),'value':_0x1698b8[_0xe9b5('0x76')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x9]?_0x1698b8[_0xe9b5('0x61')][0x9][_0xe9b5('0x62')]:undefined)||''}];case'multibar-chart':case _0xe9b5('0x77'):return[{'name':_0xe9b5('0x78'),'value':_0x1698b8[_0xe9b5('0x78')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x0]?_0x1698b8[_0xe9b5('0x61')][0x0]['value']:undefined)||_0xe9b5('0x6e')},{'name':_0xe9b5('0x79'),'value':_0x1698b8[_0xe9b5('0x79')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x1]?_0x1698b8[_0xe9b5('0x61')][0x1][_0xe9b5('0x62')]:undefined)||null},{'name':_0xe9b5('0x7a'),'value':_0x1698b8['attrSerie3']||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x2]?_0x1698b8[_0xe9b5('0x61')][0x2][_0xe9b5('0x62')]:undefined)||null},{'name':_0xe9b5('0x6f'),'value':_0x1698b8[_0xe9b5('0x6f')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x3]?_0x1698b8[_0xe9b5('0x61')][0x3]['value']:undefined)||[]},{'name':_0xe9b5('0x70'),'value':_0x1698b8[_0xe9b5('0x70')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x4]?_0x1698b8['attrs'][0x4][_0xe9b5('0x62')]:undefined)||'voice'},{'name':_0xe9b5('0x71'),'value':_0x1698b8['attrEmailAccounts']||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x5]?_0x1698b8[_0xe9b5('0x61')][0x5][_0xe9b5('0x62')]:undefined)||''},{'name':_0xe9b5('0x72'),'value':_0x1698b8[_0xe9b5('0x72')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x6]?_0x1698b8['attrs'][0x6]['value']:undefined)||''},{'name':_0xe9b5('0x73'),'value':_0x1698b8[_0xe9b5('0x73')]||(_0x1698b8['attrs']&&_0x1698b8[_0xe9b5('0x61')][0x7]?_0x1698b8['attrs'][0x7]['value']:undefined)||''},{'name':_0xe9b5('0x74'),'value':_0x1698b8[_0xe9b5('0x74')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x8]?_0x1698b8['attrs'][0x8][_0xe9b5('0x62')]:undefined)||''},{'name':_0xe9b5('0x75'),'value':_0x1698b8['attrWhatsappAccounts']||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x9]?_0x1698b8[_0xe9b5('0x61')][0x9][_0xe9b5('0x62')]:undefined)||''},{'name':_0xe9b5('0x76'),'value':_0x1698b8[_0xe9b5('0x76')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0xa]?_0x1698b8['attrs'][0xa][_0xe9b5('0x62')]:undefined)||''}];case _0xe9b5('0x7b'):return[{'name':'attrReport','type':_0x1698b8[_0xe9b5('0x7c')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x0]?_0x1698b8[_0xe9b5('0x61')][0x0]['type']:undefined)||null,'value':_0x1698b8['attrReport']||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x0]?_0x1698b8['attrs'][0x0][_0xe9b5('0x62')]:undefined)||null},{'name':_0xe9b5('0x7d'),'value':_0x1698b8[_0xe9b5('0x7d')]||(_0x1698b8['attrs']&&_0x1698b8[_0xe9b5('0x61')][0x1]?_0x1698b8[_0xe9b5('0x61')][0x1][_0xe9b5('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x547f27){logger[_0xe9b5('0x56')](_0xe9b5('0x7e'),JSON['stringify'](_0x547f27));return[];}}exports['addItem']=function(_0x1c3269,_0x3b0cfe,_0x7a32a0){if(_0x1c3269[_0xe9b5('0x5b')]['id']){delete _0x1c3269[_0xe9b5('0x5b')]['id'];}return db['Dashboard'][_0xe9b5('0x53')]({'where':{'id':_0x1c3269['params']['id']}})[_0xe9b5('0x2b')](handleEntityNotFound(_0x3b0cfe,null))[_0xe9b5('0x2b')](function(_0x4f01f1){if(_0x4f01f1){_0x1c3269[_0xe9b5('0x5b')][_0xe9b5('0x7f')]=_0x4f01f1['id'];_0x1c3269['body']['attrs']=widgetAttributes(_0x1c3269[_0xe9b5('0x5b')]);return db[_0xe9b5('0x80')]['create'](_0x1c3269['body']);}})['then'](respondWithResult(_0x3b0cfe,null))[_0xe9b5('0x47')](handleError(_0x3b0cfe,null));};exports['getItems']=function(_0x4ef933,_0x387495,_0x4ba596){var _0x333552={};var _0x1bab2e={};var _0x5c75c8;var _0x24b70f;return db['Dashboard'][_0xe9b5('0x81')]({'where':{'id':_0x4ef933[_0xe9b5('0x49')]['id']}})[_0xe9b5('0x2b')](handleEntityNotFound(_0x387495,null))[_0xe9b5('0x2b')](function(_0x3816f6){if(_0x3816f6){_0x5c75c8=_0x3816f6;_0x1bab2e[_0xe9b5('0x38')]=_[_0xe9b5('0x35')](db['DashboardItem'][_0xe9b5('0x4a')]);_0x1bab2e['query']=_['keys'](_0x4ef933['query']);_0x1bab2e[_0xe9b5('0x36')]=_[_0xe9b5('0x37')](_0x1bab2e[_0xe9b5('0x38')],_0x1bab2e['query']);_0x333552[_0xe9b5('0x3a')]=_[_0xe9b5('0x37')](_0x1bab2e[_0xe9b5('0x38')],qs['fields'](_0x4ef933[_0xe9b5('0x34')][_0xe9b5('0x39')]));_0x333552[_0xe9b5('0x3a')]=_0x333552[_0xe9b5('0x3a')][_0xe9b5('0x58')]?_0x333552[_0xe9b5('0x3a')]:_0x1bab2e[_0xe9b5('0x38')];_0x333552['order']=qs[_0xe9b5('0x3d')](_0x4ef933[_0xe9b5('0x34')]['sort']);_0x333552[_0xe9b5('0x3e')]=qs[_0xe9b5('0x36')](_['pick'](_0x4ef933[_0xe9b5('0x34')],_0x1bab2e[_0xe9b5('0x36')]));if(_0x4ef933['query']['filter']){_0x333552['where']=_[_0xe9b5('0x40')](_0x333552[_0xe9b5('0x3e')],{'$or':_[_0xe9b5('0x31')](_0x333552['attributes'],function(_0x304810){var _0x1834d7={};_0x1834d7[_0x304810]={'$like':'%'+_0x4ef933[_0xe9b5('0x34')][_0xe9b5('0x3f')]+'%'};return _0x1834d7;})});}_0x333552=_['merge']({},_0x333552,_0x4ef933[_0xe9b5('0x43')]);return _0x5c75c8[_0xe9b5('0x82')](_0x333552);}})['then'](function(_0x4a928f){if(_0x4a928f){_0x24b70f=_0x4a928f[_0xe9b5('0x58')];if(!_0x4ef933['query'][_0xe9b5('0x3b')]('nolimit')){_0x333552[_0xe9b5('0x23')]=qs[_0xe9b5('0x23')](_0x4ef933[_0xe9b5('0x34')][_0xe9b5('0x23')]);_0x333552[_0xe9b5('0x21')]=qs['offset'](_0x4ef933['query'][_0xe9b5('0x21')]);}return _0x5c75c8[_0xe9b5('0x82')](_0x333552);}})[_0xe9b5('0x2b')](function(_0x39323a){if(_0x39323a){return _0x39323a?{'count':_0x24b70f,'rows':_0x39323a}:null;}})[_0xe9b5('0x2b')](respondWithResult(_0x387495,null))[_0xe9b5('0x47')](handleError(_0x387495,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7a5ea9d..f423643 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 _0x5e9c=['hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x4975f7,_0x214267){var _0x360ad9=function(_0x1dc76b){while(--_0x1dc76b){_0x4975f7['push'](_0x4975f7['shift']());}};_0x360ad9(++_0x214267);}(_0x5e9c,0x17c));var _0xc5e9=function(_0x31b593,_0x527dca){_0x31b593=_0x31b593-0x0;var _0x3303d4=_0x5e9c[_0x31b593];return _0x3303d4;};'use strict';var EventEmitter=require(_0xc5e9('0x0'));var Dashboard=require(_0xc5e9('0x1'))['db'][_0xc5e9('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc5e9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc5e9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3a8759){return function(_0x13c7ab,_0x4bca36,_0x5dcc24){DashboardEvents[_0xc5e9('0x5')](_0x3a8759+':'+_0x13c7ab['id'],_0x13c7ab);DashboardEvents['emit'](_0x3a8759,_0x13c7ab);_0x5dcc24(null);};}for(var e in events){if(events[_0xc5e9('0x6')](e)){var event=events[e];Dashboard[_0xc5e9('0x7')](e,emitEvent(event));}}module[_0xc5e9('0x8')]=DashboardEvents; \ No newline at end of file +var _0xf40b=['emit','hasOwnProperty','hook','exports','events','Dashboard','save','update','remove'];(function(_0x55dba3,_0x1ddc09){var _0x1dccc6=function(_0x182d8e){while(--_0x182d8e){_0x55dba3['push'](_0x55dba3['shift']());}};_0x1dccc6(++_0x1ddc09);}(_0xf40b,0xf7));var _0xbf40=function(_0x3480f2,_0x4947fa){_0x3480f2=_0x3480f2-0x0;var _0x1e4899=_0xf40b[_0x3480f2];return _0x1e4899;};'use strict';var EventEmitter=require(_0xbf40('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xbf40('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbf40('0x2'),'afterUpdate':_0xbf40('0x3'),'afterDestroy':_0xbf40('0x4')};function emitEvent(_0xad530b){return function(_0x2fec70,_0x110ef0,_0x40bce7){DashboardEvents['emit'](_0xad530b+':'+_0x2fec70['id'],_0x2fec70);DashboardEvents[_0xbf40('0x5')](_0xad530b,_0x2fec70);_0x40bce7(null);};}for(var e in events){if(events[_0xbf40('0x6')](e)){var event=events[e];Dashboard[_0xbf40('0x7')](e,emitEvent(event));}}module[_0xbf40('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 fe0fce9..1fbcdbc 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 _0x0999=['exports','define','dashboards','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0xfb37d9,_0x5f531c){var _0x123958=function(_0x5f3f0b){while(--_0x5f3f0b){_0xfb37d9['push'](_0xfb37d9['shift']());}};_0x123958(++_0x5f531c);}(_0x0999,0x85));var _0x9099=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0x0999[_0x1a37e3];return _0x4db78a;};'use strict';var _=require('lodash');var util=require(_0x9099('0x0'));var logger=require(_0x9099('0x1'))(_0x9099('0x2'));var moment=require(_0x9099('0x3'));var BPromise=require(_0x9099('0x4'));var rp=require(_0x9099('0x5'));var fs=require('fs');var path=require(_0x9099('0x6'));var rimraf=require(_0x9099('0x7'));var config=require(_0x9099('0x8'));var attributes=require(_0x9099('0x9'));module[_0x9099('0xa')]=function(_0x5da5ba,_0x8c032d){return _0x5da5ba[_0x9099('0xb')]('Dashboard',attributes,{'tableName':_0x9099('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8eb=['request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','util','api','moment','bluebird'];(function(_0x483899,_0x1634d3){var _0x59f80c=function(_0x34ba1d){while(--_0x34ba1d){_0x483899['push'](_0x483899['shift']());}};_0x59f80c(++_0x1634d3);}(_0xb8eb,0xac));var _0xbb8e=function(_0x47b6ea,_0x8f346){_0x47b6ea=_0x47b6ea-0x0;var _0x2408d7=_0xb8eb[_0x47b6ea];return _0x2408d7;};'use strict';var _=require('lodash');var util=require(_0xbb8e('0x0'));var logger=require('../../config/logger')(_0xbb8e('0x1'));var moment=require(_0xbb8e('0x2'));var BPromise=require(_0xbb8e('0x3'));var rp=require(_0xbb8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb8e('0x5'));var config=require(_0xbb8e('0x6'));var attributes=require(_0xbb8e('0x7'));module[_0xbb8e('0x8')]=function(_0x41dbb7,_0x3dc2d7){return _0x41dbb7[_0xbb8e('0x9')](_0xbb8e('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 8b12cff..608ea5a 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 _0x68d7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1889bd,_0x587313){var _0x5d1b4b=function(_0x4d651f){while(--_0x4d651f){_0x1889bd['push'](_0x1889bd['shift']());}};_0x5d1b4b(++_0x587313);}(_0x68d7,0x1bb));var _0x768d=function(_0x4191c1,_0x53eb43){_0x4191c1=_0x4191c1-0x0;var _0x4c4239=_0x68d7[_0x4191c1];return _0x4c4239;};'use strict';var _=require('lodash');var util=require(_0x768d('0x0'));var moment=require(_0x768d('0x1'));var BPromise=require(_0x768d('0x2'));var rs=require(_0x768d('0x3'));var fs=require('fs');var Redis=require(_0x768d('0x4'));var db=require(_0x768d('0x5'))['db'];var utils=require(_0x768d('0x6'));var logger=require(_0x768d('0x7'))(_0x768d('0x8'));var config=require(_0x768d('0x9'));var jayson=require(_0x768d('0xa'));var client=jayson['client'][_0x768d('0xb')]({'port':0x232a});config[_0x768d('0xc')]=_[_0x768d('0xd')](config[_0x768d('0xc')],{'host':_0x768d('0xe'),'port':0x18eb});var socket=require(_0x768d('0xf'))(new Redis(config[_0x768d('0xc')]));require('./dashboard.socket')[_0x768d('0x10')](socket);function respondWithRpcPromise(_0x45d697,_0x2c7b36,_0x506ca5){return new BPromise(function(_0x390abf,_0x44773a){return client['request'](_0x45d697,_0x506ca5)[_0x768d('0x11')](function(_0x59e0f2){logger[_0x768d('0x12')](_0x768d('0x13'),_0x2c7b36,_0x768d('0x14'));logger[_0x768d('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x2c7b36,_0x768d('0x14'),JSON[_0x768d('0x16')](_0x59e0f2));if(_0x59e0f2['error']){if(_0x59e0f2[_0x768d('0x17')][_0x768d('0x18')]===0x1f4){logger['error'](_0x768d('0x13'),_0x2c7b36,_0x59e0f2[_0x768d('0x17')][_0x768d('0x19')]);return _0x44773a(_0x59e0f2[_0x768d('0x17')][_0x768d('0x19')]);}logger['error'](_0x768d('0x13'),_0x2c7b36,_0x59e0f2[_0x768d('0x17')][_0x768d('0x19')]);return _0x390abf(_0x59e0f2[_0x768d('0x17')][_0x768d('0x19')]);}else{logger[_0x768d('0x12')](_0x768d('0x13'),_0x2c7b36,'request\x20sent');_0x390abf(_0x59e0f2[_0x768d('0x1a')][_0x768d('0x19')]);}})[_0x768d('0x1b')](function(_0x411b00){logger['error'](_0x768d('0x13'),_0x2c7b36,_0x411b00);_0x44773a(_0x411b00);});});} \ No newline at end of file +var _0x0ff9=['http','redis','localhost','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0x0ff9,0x1ee));var _0x90ff=function(_0x55009a,_0x5a3b03){_0x55009a=_0x55009a-0x0;var _0x34a083=_0x0ff9[_0x55009a];return _0x34a083;};'use strict';var _=require(_0x90ff('0x0'));var util=require(_0x90ff('0x1'));var moment=require(_0x90ff('0x2'));var BPromise=require(_0x90ff('0x3'));var rs=require(_0x90ff('0x4'));var fs=require('fs');var Redis=require(_0x90ff('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x90ff('0x6'))(_0x90ff('0x7'));var config=require(_0x90ff('0x8'));var jayson=require(_0x90ff('0x9'));var client=jayson['client'][_0x90ff('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x90ff('0xb')],{'host':_0x90ff('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90ff('0xb')]));require(_0x90ff('0xd'))[_0x90ff('0xe')](socket);function respondWithRpcPromise(_0x4764bc,_0xa8f9a0,_0x3eb445){return new BPromise(function(_0x2ebaf3,_0x4c5f9e){return client[_0x90ff('0xf')](_0x4764bc,_0x3eb445)[_0x90ff('0x10')](function(_0x104d31){logger['info'](_0x90ff('0x11'),_0xa8f9a0,_0x90ff('0x12'));logger[_0x90ff('0x13')](_0x90ff('0x14'),_0xa8f9a0,_0x90ff('0x12'),JSON[_0x90ff('0x15')](_0x104d31));if(_0x104d31['error']){if(_0x104d31[_0x90ff('0x16')][_0x90ff('0x17')]===0x1f4){logger[_0x90ff('0x16')](_0x90ff('0x11'),_0xa8f9a0,_0x104d31['error']['message']);return _0x4c5f9e(_0x104d31[_0x90ff('0x16')]['message']);}logger['error'](_0x90ff('0x11'),_0xa8f9a0,_0x104d31[_0x90ff('0x16')][_0x90ff('0x18')]);return _0x2ebaf3(_0x104d31['error']['message']);}else{logger[_0x90ff('0x19')](_0x90ff('0x11'),_0xa8f9a0,'request\x20sent');_0x2ebaf3(_0x104d31[_0x90ff('0x1a')]['message']);}})[_0x90ff('0x1b')](function(_0x57d308){logger[_0x90ff('0x16')](_0x90ff('0x11'),_0xa8f9a0,_0x57d308);_0x4c5f9e(_0x57d308);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 20a0d8a..e6890c7 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 _0x323b=['./dashboard.events','save','remove','emit','removeListener','register','length','dashboard:'];(function(_0x1de54e,_0x229069){var _0x2bd0b0=function(_0x2e47c6){while(--_0x2e47c6){_0x1de54e['push'](_0x1de54e['shift']());}};_0x2bd0b0(++_0x229069);}(_0x323b,0x70));var _0xb323=function(_0x1f3fd7,_0x2fb420){_0x1f3fd7=_0x1f3fd7-0x0;var _0x36dd73=_0x323b[_0x1f3fd7];return _0x36dd73;};'use strict';var DashboardEvents=require(_0xb323('0x0'));var events=[_0xb323('0x1'),_0xb323('0x2'),'update'];function createListener(_0x328184,_0x3dbde8){return function(_0x4da8d3){_0x3dbde8[_0xb323('0x3')](_0x328184,_0x4da8d3);};}function removeListener(_0x3c459f,_0x15d056){return function(){DashboardEvents[_0xb323('0x4')](_0x3c459f,_0x15d056);};}exports[_0xb323('0x5')]=function(_0x243fe9){for(var _0xec8409=0x0,_0x520625=events[_0xb323('0x6')];_0xec8409<_0x520625;_0xec8409++){var _0x246c13=events[_0xec8409];var _0x493b43=createListener(_0xb323('0x7')+_0x246c13,_0x243fe9);DashboardEvents['on'](_0x246c13,_0x493b43);}}; \ No newline at end of file +var _0x78c7=['update','emit','removeListener','register','dashboard:','./dashboard.events','save','remove'];(function(_0x43daad,_0x133758){var _0x530c70=function(_0x382f18){while(--_0x382f18){_0x43daad['push'](_0x43daad['shift']());}};_0x530c70(++_0x133758);}(_0x78c7,0x19d));var _0x778c=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x78c7[_0x3ea913];return _0x2b4f28;};'use strict';var DashboardEvents=require(_0x778c('0x0'));var events=[_0x778c('0x1'),_0x778c('0x2'),_0x778c('0x3')];function createListener(_0x28b26c,_0x2598ff){return function(_0x283ce8){_0x2598ff[_0x778c('0x4')](_0x28b26c,_0x283ce8);};}function removeListener(_0x301fb5,_0x2149a6){return function(){DashboardEvents[_0x778c('0x5')](_0x301fb5,_0x2149a6);};}exports[_0x778c('0x6')]=function(_0x4e3c9e){for(var _0xc0d262=0x0,_0xd7bb3a=events['length'];_0xc0d262<_0xd7bb3a;_0xc0d262++){var _0x49c66b=events[_0xc0d262];var _0x218385=createListener(_0x778c('0x7')+_0x49c66b,_0x4e3c9e);DashboardEvents['on'](_0x49c66b,_0x218385);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ea8810b..2a240cb 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 _0x63a9=['./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','/:id/clone','put','destroy','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63a9,0x1ce));var _0x963a=function(_0x3328ca,_0x119f79){_0x3328ca=_0x3328ca-0x0;var _0x5a2869=_0x63a9[_0x3328ca];return _0x5a2869;};'use strict';var multer=require(_0x963a('0x0'));var util=require(_0x963a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x963a('0x2')]();var fs_extra=require(_0x963a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x963a('0x4'));var config=require(_0x963a('0x5'));var controller=require(_0x963a('0x6'));router[_0x963a('0x7')]('/',auth[_0x963a('0x8')](),controller[_0x963a('0x9')]);router[_0x963a('0x7')](_0x963a('0xa'),auth[_0x963a('0x8')](),controller[_0x963a('0xb')]);router[_0x963a('0x7')](_0x963a('0xc'),auth[_0x963a('0x8')](),controller[_0x963a('0xd')]);router['post']('/',auth[_0x963a('0x8')](),controller['create']);router[_0x963a('0xe')](_0x963a('0xf'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x963a('0xc'),auth['isAuthenticated'](),controller['addItem']);router[_0x963a('0x10')](_0x963a('0xa'),auth[_0x963a('0x8')](),controller['update']);router['delete'](_0x963a('0xa'),auth[_0x963a('0x8')](),controller[_0x963a('0x11')]);module['exports']=router; \ No newline at end of file +var _0xeb1f=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','isAuthenticated','show','/:id/items','getItems','post','/:id/clone','addItem','put'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0xeb1f,0x69));var _0xfeb1=function(_0x275679,_0x364fac){_0x275679=_0x275679-0x0;var _0x7b8635=_0xeb1f[_0x275679];return _0x7b8635;};'use strict';var multer=require(_0xfeb1('0x0'));var util=require(_0xfeb1('0x1'));var path=require(_0xfeb1('0x2'));var timeout=require(_0xfeb1('0x3'));var express=require('express');var router=express[_0xfeb1('0x4')]();var fs_extra=require(_0xfeb1('0x5'));var auth=require(_0xfeb1('0x6'));var interaction=require(_0xfeb1('0x7'));var config=require(_0xfeb1('0x8'));var controller=require(_0xfeb1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xfeb1('0xa')]);router[_0xfeb1('0xb')]('/:id',auth[_0xfeb1('0xc')](),controller[_0xfeb1('0xd')]);router[_0xfeb1('0xb')](_0xfeb1('0xe'),auth[_0xfeb1('0xc')](),controller[_0xfeb1('0xf')]);router[_0xfeb1('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xfeb1('0x11'),auth[_0xfeb1('0xc')](),controller['clone']);router[_0xfeb1('0x10')](_0xfeb1('0xe'),auth[_0xfeb1('0xc')](),controller[_0xfeb1('0x12')]);router[_0xfeb1('0x13')](_0xfeb1('0x14'),auth[_0xfeb1('0xc')](),controller[_0xfeb1('0x15')]);router[_0xfeb1('0x16')](_0xfeb1('0x14'),auth[_0xfeb1('0xc')](),controller[_0xfeb1('0x17')]);module[_0xfeb1('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 2df9a05..e550a3f 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 _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x350fdb,_0x170b3c){var _0x266c49=function(_0x2cb32b){while(--_0x2cb32b){_0x350fdb['push'](_0x350fdb['shift']());}};_0x266c49(++_0x170b3c);}(_0x6f47,0xc7));var _0x76f4=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x6f47[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x33af=['attrs','setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse'];(function(_0xb33373,_0x9af59b){var _0x19fa63=function(_0x2e5879){while(--_0x2e5879){_0xb33373['push'](_0xb33373['shift']());}};_0x19fa63(++_0x9af59b);}(_0x33af,0xec));var _0xf33a=function(_0x4d9403,_0x33c5f0){_0x4d9403=_0x4d9403-0x0;var _0x5eef11=_0x33af[_0x4d9403];return _0x5eef11;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xf33a('0x0'));var _=require('lodash');module[_0xf33a('0x1')]={'title':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf33a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf33a('0x3')](_0xf33a('0x4')),'get':function(){try{return JSON[_0xf33a('0x5')](this['getDataValue'](_0xf33a('0x6')));}catch(_0x44cfa5){return[];}},'set':function(_0x583e54){try{this[_0xf33a('0x7')](_0xf33a('0x6'),JSON[_0xf33a('0x8')](_0x583e54));}catch(_0x2f3730){this[_0xf33a('0x7')](_0xf33a('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf33a('0x9')]},'col':{'type':Sequelize[_0xf33a('0x9')]},'background':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![],'defaultValue':_0xf33a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf33a('0x2')]},'titleFontSize':{'type':Sequelize[_0xf33a('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index f18bef5..5b64fc3 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 _0x7278=['stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','merge','options','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error'];(function(_0x4124e3,_0x4af20c){var _0x2b9d71=function(_0x1370cb){while(--_0x1370cb){_0x4124e3['push'](_0x4124e3['shift']());}};_0x2b9d71(++_0x4af20c);}(_0x7278,0x161));var _0x8727=function(_0x86adbe,_0x4f03d4){_0x86adbe=_0x86adbe-0x0;var _0x1b5164=_0x7278[_0x86adbe];return _0x1b5164;};'use strict';var emlformat=require(_0x8727('0x0'));var rimraf=require(_0x8727('0x1'));var zipdir=require(_0x8727('0x2'));var jsonpatch=require(_0x8727('0x3'));var rp=require(_0x8727('0x4'));var moment=require('moment');var BPromise=require(_0x8727('0x5'));var Mustache=require(_0x8727('0x6'));var util=require(_0x8727('0x7'));var path=require(_0x8727('0x8'));var sox=require(_0x8727('0x9'));var csv=require(_0x8727('0xa'));var ejs=require(_0x8727('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8727('0xc'));var squel=require(_0x8727('0xd'));var crypto=require(_0x8727('0xe'));var jsforce=require(_0x8727('0xf'));var deskjs=require(_0x8727('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8727('0x11'));var authService=require(_0x8727('0x12'));var qs=require(_0x8727('0x13'));var as=require(_0x8727('0x14'));var hardwareService=require(_0x8727('0x15'));var logger=require(_0x8727('0x16'))(_0x8727('0x17'));var utils=require(_0x8727('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8727('0x19'));var db=require(_0x8727('0x1a'))['db'];config[_0x8727('0x1b')]=_['defaults'](config[_0x8727('0x1b')],{'host':_0x8727('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8727('0x1b')]));require(_0x8727('0x1d'))[_0x8727('0x1e')](socket);function respondWithStatusCode(_0x2185e5,_0x2ea789){_0x2ea789=_0x2ea789||0xcc;return function(_0x3d84db){if(_0x3d84db){return _0x2185e5[_0x8727('0x1f')](_0x2ea789);}return _0x2185e5[_0x8727('0x20')](_0x2ea789)[_0x8727('0x21')]();};}function respondWithResult(_0x88857c,_0x4842a0){_0x4842a0=_0x4842a0||0xc8;return function(_0x17baba){if(_0x17baba){return _0x88857c[_0x8727('0x20')](_0x4842a0)[_0x8727('0x22')](_0x17baba);}};}function respondWithFilteredResult(_0x2f6e1d,_0x112f04){return function(_0xba0af5){if(_0xba0af5){var _0x533e6d=typeof _0x112f04['offset']===_0x8727('0x23')&&typeof _0x112f04['limit']===_0x8727('0x23');var _0xfd266f=_0xba0af5[_0x8727('0x24')];var _0x22e6c9=_0x533e6d?0x0:_0x112f04[_0x8727('0x25')];var _0x537aaf=_0x533e6d?_0xba0af5[_0x8727('0x24')]:_0x112f04[_0x8727('0x25')]+_0x112f04[_0x8727('0x26')];var _0x1d78df;if(_0x537aaf>=_0xfd266f){_0x537aaf=_0xfd266f;_0x1d78df=0xc8;}else{_0x1d78df=0xce;}_0x2f6e1d[_0x8727('0x20')](_0x1d78df);return _0x2f6e1d[_0x8727('0x27')](_0x8727('0x28'),_0x22e6c9+'-'+_0x537aaf+'/'+_0xfd266f)[_0x8727('0x22')](_0xba0af5);}return null;};}function patchUpdates(_0x117f58){return function(_0x56ffd5){try{jsonpatch[_0x8727('0x29')](_0x56ffd5,_0x117f58,!![]);}catch(_0x1a69d5){return BPromise['reject'](_0x1a69d5);}return _0x56ffd5[_0x8727('0x2a')]();};}function saveUpdates(_0x3d3592,_0x4c468d){return function(_0x5adefe){if(_0x5adefe){return _0x5adefe[_0x8727('0x2b')](_0x3d3592)[_0x8727('0x2c')](function(_0x15e8bf){return _0x15e8bf;});}return null;};}function removeEntity(_0x5de6fa,_0x98261b){return function(_0x4cacf2){if(_0x4cacf2){return _0x4cacf2[_0x8727('0x2d')]()[_0x8727('0x2c')](function(){_0x5de6fa[_0x8727('0x20')](0xcc)[_0x8727('0x21')]();});}};}function handleEntityNotFound(_0x262f36,_0xd92f77){return function(_0x5d03f2){if(!_0x5d03f2){_0x262f36[_0x8727('0x1f')](0x194);}return _0x5d03f2;};}function handleError(_0x307055,_0x54034d){_0x54034d=_0x54034d||0x1f4;return function(_0x23325f){logger[_0x8727('0x2e')](_0x23325f[_0x8727('0x2f')]);if(_0x23325f[_0x8727('0x30')]){delete _0x23325f[_0x8727('0x30')];}_0x307055[_0x8727('0x20')](_0x54034d)['send'](_0x23325f);};}exports[_0x8727('0x31')]=function(_0x563201,_0x34c58e){var _0x47e9f9={'raw':![],'where':{'id':_0x563201[_0x8727('0x32')]['id']}},_0x44ed83={};_0x44ed83[_0x8727('0x33')]=_[_0x8727('0x34')](db[_0x8727('0x35')][_0x8727('0x36')]);_0x44ed83[_0x8727('0x37')]=_['keys'](_0x563201[_0x8727('0x37')]);_0x44ed83[_0x8727('0x38')]=_[_0x8727('0x39')](_0x44ed83[_0x8727('0x33')],_0x44ed83[_0x8727('0x37')]);_0x47e9f9[_0x8727('0x3a')]=_[_0x8727('0x39')](_0x44ed83[_0x8727('0x33')],qs[_0x8727('0x3b')](_0x563201[_0x8727('0x37')][_0x8727('0x3b')]));_0x47e9f9[_0x8727('0x3a')]=_0x47e9f9['attributes']['length']?_0x47e9f9[_0x8727('0x3a')]:_0x44ed83[_0x8727('0x33')];if(_0x563201[_0x8727('0x37')][_0x8727('0x3c')]){_0x47e9f9['include']=[{'all':!![]}];}_0x47e9f9=_[_0x8727('0x3d')]({},_0x47e9f9,_0x563201[_0x8727('0x3e')]);return db[_0x8727('0x35')][_0x8727('0x3f')](_0x47e9f9)[_0x8727('0x2c')](handleEntityNotFound(_0x34c58e,null))['then'](respondWithResult(_0x34c58e,null))[_0x8727('0x40')](handleError(_0x34c58e,null));};exports[_0x8727('0x2d')]=function(_0x8e9de8,_0x1b0e88){return db[_0x8727('0x35')][_0x8727('0x3f')]({'where':{'id':_0x8e9de8[_0x8727('0x32')]['id']}})[_0x8727('0x2c')](handleEntityNotFound(_0x1b0e88,null))[_0x8727('0x2c')](removeEntity(_0x1b0e88,null))[_0x8727('0x40')](handleError(_0x1b0e88,null));};function widgetAttributes(_0x396f12){try{switch(_0x396f12[_0x8727('0x41')]){case'iframe':return[{'name':_0x8727('0x42'),'value':_0x396f12[_0x8727('0x42')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x0]?_0x396f12[_0x8727('0x43')][0x0][_0x8727('0x44')]:undefined)||_0x8727('0x45')}];case _0x8727('0x46'):return[{'name':_0x8727('0x47'),'value':_0x396f12[_0x8727('0x47')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x0]?_0x396f12[_0x8727('0x43')][0x0][_0x8727('0x44')]:undefined)||''}];case'clock':return[{'name':_0x8727('0x48'),'value':_0x396f12[_0x8727('0x48')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12['attrs'][0x0]?_0x396f12[_0x8727('0x43')][0x0][_0x8727('0x44')]:undefined)||_0x8727('0x49')},{'name':_0x8727('0x4a'),'value':_0x396f12['attrTimezone']||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x1]?_0x396f12[_0x8727('0x43')][0x1][_0x8727('0x44')]:undefined)||_0x8727('0x4b')},{'name':_0x8727('0x4c'),'value':_0x396f12[_0x8727('0x4c')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x2]?_0x396f12[_0x8727('0x43')][0x2]['value']:undefined)||0xc}];case _0x8727('0x4d'):return[{'name':_0x8727('0x4e'),'value':_0x396f12[_0x8727('0x4e')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x0]?_0x396f12['attrs'][0x0][_0x8727('0x44')]:undefined)||_0x8727('0x4f')},{'name':_0x8727('0x50'),'value':_0x396f12['attrVoiceQueues']||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x1]?_0x396f12[_0x8727('0x43')][0x1][_0x8727('0x44')]:undefined)||[]},{'name':_0x8727('0x4c'),'value':_0x396f12[_0x8727('0x4c')]||(_0x396f12['attrs']&&_0x396f12[_0x8727('0x43')][0x2]?_0x396f12[_0x8727('0x43')][0x2][_0x8727('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x396f12[_0x8727('0x51')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x3]?_0x396f12[_0x8727('0x43')][0x3][_0x8727('0x44')]:undefined)||_0x8727('0x52')},{'name':_0x8727('0x53'),'value':_0x396f12['attrEmailAccounts']||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x4]?_0x396f12[_0x8727('0x43')][0x4][_0x8727('0x44')]:undefined)||''},{'name':_0x8727('0x54'),'value':_0x396f12[_0x8727('0x54')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12['attrs'][0x5]?_0x396f12[_0x8727('0x43')][0x5][_0x8727('0x44')]:undefined)||''},{'name':_0x8727('0x55'),'value':_0x396f12['attrSmsAccounts']||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x6]?_0x396f12[_0x8727('0x43')][0x6][_0x8727('0x44')]:undefined)||''},{'name':_0x8727('0x56'),'value':_0x396f12[_0x8727('0x56')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12['attrs'][0x7]?_0x396f12[_0x8727('0x43')][0x7]['value']:undefined)||''},{'name':_0x8727('0x57'),'value':_0x396f12[_0x8727('0x57')]||(_0x396f12['attrs']&&_0x396f12[_0x8727('0x43')][0x8]?_0x396f12[_0x8727('0x43')][0x8][_0x8727('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x396f12['attrChatWebsites']||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x9]?_0x396f12[_0x8727('0x43')][0x9]['value']:undefined)||''}];case _0x8727('0x58'):case _0x8727('0x59'):return[{'name':_0x8727('0x5a'),'value':_0x396f12[_0x8727('0x5a')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x0]?_0x396f12[_0x8727('0x43')][0x0][_0x8727('0x44')]:undefined)||'total'},{'name':_0x8727('0x5b'),'value':_0x396f12[_0x8727('0x5b')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x1]?_0x396f12['attrs'][0x1][_0x8727('0x44')]:undefined)||null},{'name':_0x8727('0x5c'),'value':_0x396f12[_0x8727('0x5c')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x2]?_0x396f12[_0x8727('0x43')][0x2][_0x8727('0x44')]:undefined)||null},{'name':_0x8727('0x50'),'value':_0x396f12['attrVoiceQueues']||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x3]?_0x396f12[_0x8727('0x43')][0x3]['value']:undefined)||[]},{'name':_0x8727('0x51'),'value':_0x396f12['attrChannel']||(_0x396f12[_0x8727('0x43')]&&_0x396f12['attrs'][0x4]?_0x396f12[_0x8727('0x43')][0x4][_0x8727('0x44')]:undefined)||'voice'},{'name':_0x8727('0x53'),'value':_0x396f12[_0x8727('0x53')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12['attrs'][0x5]?_0x396f12['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x396f12[_0x8727('0x54')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x6]?_0x396f12[_0x8727('0x43')][0x6][_0x8727('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x396f12['attrSmsAccounts']||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x7]?_0x396f12[_0x8727('0x43')][0x7][_0x8727('0x44')]:undefined)||''},{'name':_0x8727('0x56'),'value':_0x396f12[_0x8727('0x56')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x8]?_0x396f12[_0x8727('0x43')][0x8][_0x8727('0x44')]:undefined)||''},{'name':_0x8727('0x57'),'value':_0x396f12[_0x8727('0x57')]||(_0x396f12['attrs']&&_0x396f12[_0x8727('0x43')][0x9]?_0x396f12[_0x8727('0x43')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x396f12['attrChatWebsites']||(_0x396f12['attrs']&&_0x396f12[_0x8727('0x43')][0xa]?_0x396f12[_0x8727('0x43')][0xa]['value']:undefined)||''}];case _0x8727('0x5d'):return[{'name':_0x8727('0x5e'),'type':_0x396f12[_0x8727('0x5f')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x0]?_0x396f12['attrs'][0x0][_0x8727('0x41')]:undefined)||null,'value':_0x396f12[_0x8727('0x5e')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12[_0x8727('0x43')][0x0]?_0x396f12[_0x8727('0x43')][0x0][_0x8727('0x44')]:undefined)||null},{'name':_0x8727('0x60'),'value':_0x396f12[_0x8727('0x60')]||(_0x396f12[_0x8727('0x43')]&&_0x396f12['attrs'][0x1]?_0x396f12[_0x8727('0x43')][0x1][_0x8727('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x221597){logger['error'](_0x8727('0x61'),JSON['stringify'](_0x221597));return[];}}exports[_0x8727('0x62')]=function(_0x1e8cba,_0xb8e231){if(_0x1e8cba[_0x8727('0x63')]){_0x1e8cba[_0x8727('0x63')]['attrs']=widgetAttributes(_0x1e8cba['body']);}return db[_0x8727('0x35')][_0x8727('0x62')](_0x1e8cba[_0x8727('0x63')],{})[_0x8727('0x2c')](respondWithResult(_0xb8e231,0xc9))[_0x8727('0x40')](handleError(_0xb8e231,null));};exports['update']=function(_0x29da1c,_0x56a275){if(_0x29da1c[_0x8727('0x63')]['id']){delete _0x29da1c['body']['id'];}_0x29da1c['body'][_0x8727('0x43')]=widgetAttributes(_0x29da1c[_0x8727('0x63')]);return db[_0x8727('0x35')][_0x8727('0x3f')]({'where':{'id':_0x29da1c[_0x8727('0x32')]['id']}})['then'](handleEntityNotFound(_0x56a275,null))['then'](saveUpdates(_0x29da1c[_0x8727('0x63')],null))[_0x8727('0x2c')](respondWithResult(_0x56a275,null))['catch'](handleError(_0x56a275,null));}; \ No newline at end of file +var _0xdd68=['create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','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','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify'];(function(_0x9d9343,_0x494c83){var _0x2abcd2=function(_0x101a63){while(--_0x101a63){_0x9d9343['push'](_0x9d9343['shift']());}};_0x2abcd2(++_0x494c83);}(_0xdd68,0x196));var _0x8dd6=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0xdd68[_0x53f964];return _0x17be6c;};'use strict';var emlformat=require(_0x8dd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8dd6('0x1'));var jsonpatch=require(_0x8dd6('0x2'));var rp=require(_0x8dd6('0x3'));var moment=require(_0x8dd6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8dd6('0x5'));var util=require(_0x8dd6('0x6'));var path=require('path');var sox=require(_0x8dd6('0x7'));var csv=require(_0x8dd6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8dd6('0x9'));var _=require('lodash');var squel=require(_0x8dd6('0xa'));var crypto=require('crypto');var jsforce=require(_0x8dd6('0xb'));var deskjs=require(_0x8dd6('0xc'));var toCsv=require(_0x8dd6('0x8'));var querystring=require('querystring');var Papa=require(_0x8dd6('0xd'));var Redis=require(_0x8dd6('0xe'));var authService=require(_0x8dd6('0xf'));var qs=require(_0x8dd6('0x10'));var as=require(_0x8dd6('0x11'));var hardwareService=require(_0x8dd6('0x12'));var logger=require(_0x8dd6('0x13'))(_0x8dd6('0x14'));var utils=require(_0x8dd6('0x15'));var config=require(_0x8dd6('0x16'));var licenseUtil=require(_0x8dd6('0x17'));var db=require(_0x8dd6('0x18'))['db'];config[_0x8dd6('0x19')]=_['defaults'](config[_0x8dd6('0x19')],{'host':_0x8dd6('0x1a'),'port':0x18eb});var socket=require(_0x8dd6('0x1b'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x8dd6('0x1c')](socket);function respondWithStatusCode(_0x4c8ff4,_0x4f8fdd){_0x4f8fdd=_0x4f8fdd||0xcc;return function(_0x26658c){if(_0x26658c){return _0x4c8ff4[_0x8dd6('0x1d')](_0x4f8fdd);}return _0x4c8ff4[_0x8dd6('0x1e')](_0x4f8fdd)[_0x8dd6('0x1f')]();};}function respondWithResult(_0x124e1d,_0x45902a){_0x45902a=_0x45902a||0xc8;return function(_0x31e123){if(_0x31e123){return _0x124e1d[_0x8dd6('0x1e')](_0x45902a)[_0x8dd6('0x20')](_0x31e123);}};}function respondWithFilteredResult(_0x5496cc,_0xa9e2bd){return function(_0x1f910a){if(_0x1f910a){var _0x267d23=typeof _0xa9e2bd[_0x8dd6('0x21')]===_0x8dd6('0x22')&&typeof _0xa9e2bd[_0x8dd6('0x23')]===_0x8dd6('0x22');var _0x40f9eb=_0x1f910a['count'];var _0xa363b6=_0x267d23?0x0:_0xa9e2bd[_0x8dd6('0x21')];var _0x54b996=_0x267d23?_0x1f910a[_0x8dd6('0x24')]:_0xa9e2bd[_0x8dd6('0x21')]+_0xa9e2bd[_0x8dd6('0x23')];var _0x2c67e8;if(_0x54b996>=_0x40f9eb){_0x54b996=_0x40f9eb;_0x2c67e8=0xc8;}else{_0x2c67e8=0xce;}_0x5496cc['status'](_0x2c67e8);return _0x5496cc['set']('Content-Range',_0xa363b6+'-'+_0x54b996+'/'+_0x40f9eb)[_0x8dd6('0x20')](_0x1f910a);}return null;};}function patchUpdates(_0xe6b099){return function(_0x5701d3){try{jsonpatch[_0x8dd6('0x25')](_0x5701d3,_0xe6b099,!![]);}catch(_0x31b588){return BPromise[_0x8dd6('0x26')](_0x31b588);}return _0x5701d3[_0x8dd6('0x27')]();};}function saveUpdates(_0x3a4c9f,_0x4ca230){return function(_0x3f29bc){if(_0x3f29bc){return _0x3f29bc[_0x8dd6('0x28')](_0x3a4c9f)['then'](function(_0x50f513){return _0x50f513;});}return null;};}function removeEntity(_0x1784a9,_0xeeda3){return function(_0x47c113){if(_0x47c113){return _0x47c113[_0x8dd6('0x29')]()[_0x8dd6('0x2a')](function(){_0x1784a9[_0x8dd6('0x1e')](0xcc)[_0x8dd6('0x1f')]();});}};}function handleEntityNotFound(_0x35f35d,_0x5b77f2){return function(_0x46d855){if(!_0x46d855){_0x35f35d[_0x8dd6('0x1d')](0x194);}return _0x46d855;};}function handleError(_0x5cbdb5,_0x4bdeaa){_0x4bdeaa=_0x4bdeaa||0x1f4;return function(_0x25eba7){logger[_0x8dd6('0x2b')](_0x25eba7[_0x8dd6('0x2c')]);if(_0x25eba7[_0x8dd6('0x2d')]){delete _0x25eba7[_0x8dd6('0x2d')];}_0x5cbdb5[_0x8dd6('0x1e')](_0x4bdeaa)[_0x8dd6('0x2e')](_0x25eba7);};}exports[_0x8dd6('0x2f')]=function(_0x35d45e,_0x35c9ae){var _0x15a0f6={'raw':![],'where':{'id':_0x35d45e[_0x8dd6('0x30')]['id']}},_0x3592d7={};_0x3592d7[_0x8dd6('0x31')]=_[_0x8dd6('0x32')](db[_0x8dd6('0x33')][_0x8dd6('0x34')]);_0x3592d7[_0x8dd6('0x35')]=_[_0x8dd6('0x32')](_0x35d45e[_0x8dd6('0x35')]);_0x3592d7[_0x8dd6('0x36')]=_[_0x8dd6('0x37')](_0x3592d7['model'],_0x3592d7[_0x8dd6('0x35')]);_0x15a0f6[_0x8dd6('0x38')]=_[_0x8dd6('0x37')](_0x3592d7[_0x8dd6('0x31')],qs['fields'](_0x35d45e[_0x8dd6('0x35')]['fields']));_0x15a0f6['attributes']=_0x15a0f6[_0x8dd6('0x38')][_0x8dd6('0x39')]?_0x15a0f6['attributes']:_0x3592d7[_0x8dd6('0x31')];if(_0x35d45e[_0x8dd6('0x35')][_0x8dd6('0x3a')]){_0x15a0f6[_0x8dd6('0x3b')]=[{'all':!![]}];}_0x15a0f6=_[_0x8dd6('0x3c')]({},_0x15a0f6,_0x35d45e['options']);return db[_0x8dd6('0x33')][_0x8dd6('0x3d')](_0x15a0f6)[_0x8dd6('0x2a')](handleEntityNotFound(_0x35c9ae,null))[_0x8dd6('0x2a')](respondWithResult(_0x35c9ae,null))[_0x8dd6('0x3e')](handleError(_0x35c9ae,null));};exports[_0x8dd6('0x29')]=function(_0x2f12e7,_0x533e2d){return db[_0x8dd6('0x33')][_0x8dd6('0x3d')]({'where':{'id':_0x2f12e7[_0x8dd6('0x30')]['id']}})[_0x8dd6('0x2a')](handleEntityNotFound(_0x533e2d,null))[_0x8dd6('0x2a')](removeEntity(_0x533e2d,null))[_0x8dd6('0x3e')](handleError(_0x533e2d,null));};function widgetAttributes(_0x4b5ea7){try{switch(_0x4b5ea7[_0x8dd6('0x3f')]){case _0x8dd6('0x40'):return[{'name':_0x8dd6('0x41'),'value':_0x4b5ea7[_0x8dd6('0x41')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x0]?_0x4b5ea7[_0x8dd6('0x42')][0x0]['value']:undefined)||_0x8dd6('0x43')}];case _0x8dd6('0x44'):return[{'name':_0x8dd6('0x45'),'value':_0x4b5ea7['attrPath']||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7['attrs'][0x0]?_0x4b5ea7[_0x8dd6('0x42')][0x0][_0x8dd6('0x46')]:undefined)||''}];case _0x8dd6('0x47'):return[{'name':_0x8dd6('0x48'),'value':_0x4b5ea7['attrHourFormat']||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x0]?_0x4b5ea7[_0x8dd6('0x42')][0x0][_0x8dd6('0x46')]:undefined)||_0x8dd6('0x49')},{'name':_0x8dd6('0x4a'),'value':_0x4b5ea7[_0x8dd6('0x4a')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x1]?_0x4b5ea7['attrs'][0x1][_0x8dd6('0x46')]:undefined)||_0x8dd6('0x4b')},{'name':_0x8dd6('0x4c'),'value':_0x4b5ea7[_0x8dd6('0x4c')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x2]?_0x4b5ea7[_0x8dd6('0x42')][0x2][_0x8dd6('0x46')]:undefined)||0xc}];case _0x8dd6('0x4d'):return[{'name':_0x8dd6('0x4e'),'value':_0x4b5ea7['attrMetric']||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7['attrs'][0x0]?_0x4b5ea7[_0x8dd6('0x42')][0x0][_0x8dd6('0x46')]:undefined)||'total'},{'name':_0x8dd6('0x4f'),'value':_0x4b5ea7[_0x8dd6('0x4f')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x1]?_0x4b5ea7[_0x8dd6('0x42')][0x1][_0x8dd6('0x46')]:undefined)||[]},{'name':'attrFontSize','value':_0x4b5ea7[_0x8dd6('0x4c')]||(_0x4b5ea7['attrs']&&_0x4b5ea7[_0x8dd6('0x42')][0x2]?_0x4b5ea7[_0x8dd6('0x42')][0x2]['value']:undefined)||0x14},{'name':_0x8dd6('0x50'),'value':_0x4b5ea7['attrChannel']||(_0x4b5ea7['attrs']&&_0x4b5ea7[_0x8dd6('0x42')][0x3]?_0x4b5ea7['attrs'][0x3][_0x8dd6('0x46')]:undefined)||_0x8dd6('0x51')},{'name':_0x8dd6('0x52'),'value':_0x4b5ea7[_0x8dd6('0x52')]||(_0x4b5ea7['attrs']&&_0x4b5ea7[_0x8dd6('0x42')][0x4]?_0x4b5ea7[_0x8dd6('0x42')][0x4][_0x8dd6('0x46')]:undefined)||''},{'name':_0x8dd6('0x53'),'value':_0x4b5ea7[_0x8dd6('0x53')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x5]?_0x4b5ea7[_0x8dd6('0x42')][0x5]['value']:undefined)||''},{'name':_0x8dd6('0x54'),'value':_0x4b5ea7[_0x8dd6('0x54')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7['attrs'][0x6]?_0x4b5ea7['attrs'][0x6][_0x8dd6('0x46')]:undefined)||''},{'name':_0x8dd6('0x55'),'value':_0x4b5ea7[_0x8dd6('0x55')]||(_0x4b5ea7['attrs']&&_0x4b5ea7[_0x8dd6('0x42')][0x7]?_0x4b5ea7[_0x8dd6('0x42')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4b5ea7['attrWhatsappAccounts']||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7['attrs'][0x8]?_0x4b5ea7[_0x8dd6('0x42')][0x8]['value']:undefined)||''},{'name':_0x8dd6('0x56'),'value':_0x4b5ea7[_0x8dd6('0x56')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7['attrs'][0x9]?_0x4b5ea7[_0x8dd6('0x42')][0x9][_0x8dd6('0x46')]:undefined)||''}];case _0x8dd6('0x57'):case _0x8dd6('0x58'):return[{'name':_0x8dd6('0x59'),'value':_0x4b5ea7[_0x8dd6('0x59')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x0]?_0x4b5ea7[_0x8dd6('0x42')][0x0][_0x8dd6('0x46')]:undefined)||_0x8dd6('0x5a')},{'name':'attrSerie2','value':_0x4b5ea7[_0x8dd6('0x5b')]||(_0x4b5ea7['attrs']&&_0x4b5ea7[_0x8dd6('0x42')][0x1]?_0x4b5ea7[_0x8dd6('0x42')][0x1][_0x8dd6('0x46')]:undefined)||null},{'name':'attrSerie3','value':_0x4b5ea7['attrSerie3']||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x2]?_0x4b5ea7[_0x8dd6('0x42')][0x2][_0x8dd6('0x46')]:undefined)||null},{'name':_0x8dd6('0x4f'),'value':_0x4b5ea7[_0x8dd6('0x4f')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x3]?_0x4b5ea7[_0x8dd6('0x42')][0x3]['value']:undefined)||[]},{'name':_0x8dd6('0x50'),'value':_0x4b5ea7[_0x8dd6('0x50')]||(_0x4b5ea7['attrs']&&_0x4b5ea7['attrs'][0x4]?_0x4b5ea7['attrs'][0x4]['value']:undefined)||_0x8dd6('0x51')},{'name':_0x8dd6('0x52'),'value':_0x4b5ea7[_0x8dd6('0x52')]||(_0x4b5ea7['attrs']&&_0x4b5ea7[_0x8dd6('0x42')][0x5]?_0x4b5ea7[_0x8dd6('0x42')][0x5][_0x8dd6('0x46')]:undefined)||''},{'name':_0x8dd6('0x53'),'value':_0x4b5ea7[_0x8dd6('0x53')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7['attrs'][0x6]?_0x4b5ea7['attrs'][0x6][_0x8dd6('0x46')]:undefined)||''},{'name':_0x8dd6('0x54'),'value':_0x4b5ea7[_0x8dd6('0x54')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7['attrs'][0x7]?_0x4b5ea7[_0x8dd6('0x42')][0x7]['value']:undefined)||''},{'name':_0x8dd6('0x55'),'value':_0x4b5ea7['attrOpenchannelAccounts']||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7['attrs'][0x8]?_0x4b5ea7['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4b5ea7[_0x8dd6('0x5c')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x9]?_0x4b5ea7['attrs'][0x9][_0x8dd6('0x46')]:undefined)||''},{'name':_0x8dd6('0x56'),'value':_0x4b5ea7['attrChatWebsites']||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0xa]?_0x4b5ea7[_0x8dd6('0x42')][0xa][_0x8dd6('0x46')]:undefined)||''}];case _0x8dd6('0x5d'):return[{'name':_0x8dd6('0x5e'),'type':_0x4b5ea7[_0x8dd6('0x5f')]||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x0]?_0x4b5ea7[_0x8dd6('0x42')][0x0][_0x8dd6('0x3f')]:undefined)||null,'value':_0x4b5ea7['attrReport']||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7[_0x8dd6('0x42')][0x0]?_0x4b5ea7[_0x8dd6('0x42')][0x0]['value']:undefined)||null},{'name':_0x8dd6('0x60'),'value':_0x4b5ea7['attrRefresh']||(_0x4b5ea7[_0x8dd6('0x42')]&&_0x4b5ea7['attrs'][0x1]?_0x4b5ea7[_0x8dd6('0x42')][0x1][_0x8dd6('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x57f0a8){logger[_0x8dd6('0x2b')](_0x8dd6('0x61'),JSON[_0x8dd6('0x62')](_0x57f0a8));return[];}}exports[_0x8dd6('0x63')]=function(_0xe36673,_0x15d6b4){if(_0xe36673['body']){_0xe36673[_0x8dd6('0x64')]['attrs']=widgetAttributes(_0xe36673['body']);}return db[_0x8dd6('0x33')][_0x8dd6('0x63')](_0xe36673[_0x8dd6('0x64')],{})[_0x8dd6('0x2a')](respondWithResult(_0x15d6b4,0xc9))[_0x8dd6('0x3e')](handleError(_0x15d6b4,null));};exports[_0x8dd6('0x28')]=function(_0x31e53e,_0x5022b5){if(_0x31e53e[_0x8dd6('0x64')]['id']){delete _0x31e53e[_0x8dd6('0x64')]['id'];}_0x31e53e[_0x8dd6('0x64')]['attrs']=widgetAttributes(_0x31e53e['body']);return db['DashboardItem'][_0x8dd6('0x3d')]({'where':{'id':_0x31e53e[_0x8dd6('0x30')]['id']}})[_0x8dd6('0x2a')](handleEntityNotFound(_0x5022b5,null))[_0x8dd6('0x2a')](saveUpdates(_0x31e53e['body'],null))[_0x8dd6('0x2a')](respondWithResult(_0x5022b5,null))[_0x8dd6('0x3e')](handleError(_0x5022b5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 2dd4231..76b16b3 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 _0x1c4c=['save','update','remove','emit','hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x1c4c,0x129));var _0xc1c4=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0x1c4c[_0x297c55];return _0x120389;};'use strict';var EventEmitter=require(_0xc1c4('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xc1c4('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc1c4('0x2')](0x0);var events={'afterCreate':_0xc1c4('0x3'),'afterUpdate':_0xc1c4('0x4'),'afterDestroy':_0xc1c4('0x5')};function emitEvent(_0x44e8ef){return function(_0xc3cc43,_0x9e3a37,_0x419c56){DashboardItemEvents[_0xc1c4('0x6')](_0x44e8ef+':'+_0xc3cc43['id'],_0xc3cc43);DashboardItemEvents[_0xc1c4('0x6')](_0x44e8ef,_0xc3cc43);_0x419c56(null);};}for(var e in events){if(events[_0xc1c4('0x7')](e)){var event=events[e];DashboardItem[_0xc1c4('0x8')](e,emitEvent(event));}}module[_0xc1c4('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x2503=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x17a37a,_0xb6196b){var _0x58a907=function(_0x3fa67f){while(--_0x3fa67f){_0x17a37a['push'](_0x17a37a['shift']());}};_0x58a907(++_0xb6196b);}(_0x2503,0xd1));var _0x3250=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2503[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3250('0x0'));var DashboardItem=require(_0x3250('0x1'))['db'][_0x3250('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3250('0x3')](0x0);var events={'afterCreate':_0x3250('0x4'),'afterUpdate':_0x3250('0x5'),'afterDestroy':_0x3250('0x6')};function emitEvent(_0x143d37){return function(_0x10b660,_0x5c29f4,_0x33301d){DashboardItemEvents[_0x3250('0x7')](_0x143d37+':'+_0x10b660['id'],_0x10b660);DashboardItemEvents[_0x3250('0x7')](_0x143d37,_0x10b660);_0x33301d(null);};}for(var e in events){if(events[_0x3250('0x8')](e)){var event=events[e];DashboardItem[_0x3250('0x9')](e,emitEvent(event));}}module[_0x3250('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5cc88d3..ca6b30c 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 _0x0d62=['DashboardItem','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports'];(function(_0x3a1890,_0x244466){var _0x44009e=function(_0x3bc459){while(--_0x3bc459){_0x3a1890['push'](_0x3a1890['shift']());}};_0x44009e(++_0x244466);}(_0x0d62,0x10f));var _0x20d6=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0x0d62[_0x2e7f96];return _0x315277;};'use strict';var _=require('lodash');var util=require(_0x20d6('0x0'));var logger=require(_0x20d6('0x1'))('api');var moment=require(_0x20d6('0x2'));var BPromise=require(_0x20d6('0x3'));var rp=require(_0x20d6('0x4'));var fs=require('fs');var path=require(_0x20d6('0x5'));var rimraf=require(_0x20d6('0x6'));var config=require('../../config/environment');var attributes=require(_0x20d6('0x7'));module[_0x20d6('0x8')]=function(_0x43e94b,_0x37fc73){return _0x43e94b['define'](_0x20d6('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bfe=['../../config/environment','./dashboardItem.attributes','exports','DashboardItem','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3f3198,_0x3fd244){var _0xb22b59=function(_0x4769a0){while(--_0x4769a0){_0x3f3198['push'](_0x3f3198['shift']());}};_0xb22b59(++_0x3fd244);}(_0x8bfe,0x1a6));var _0xe8bf=function(_0x406ae7,_0x12181b){_0x406ae7=_0x406ae7-0x0;var _0x5a5b9d=_0x8bfe[_0x406ae7];return _0x5a5b9d;};'use strict';var _=require(_0xe8bf('0x0'));var util=require(_0xe8bf('0x1'));var logger=require(_0xe8bf('0x2'))('api');var moment=require(_0xe8bf('0x3'));var BPromise=require(_0xe8bf('0x4'));var rp=require(_0xe8bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe8bf('0x6'));var config=require(_0xe8bf('0x7'));var attributes=require(_0xe8bf('0x8'));module[_0xe8bf('0x9')]=function(_0x4c7fff,_0x34a933){return _0x4c7fff['define'](_0xe8bf('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 1c0c13e..755232f 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 _0xa4a6=['request\x20sent','debug','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s'];(function(_0x416f8e,_0x382960){var _0x56313a=function(_0x56dec3){while(--_0x56dec3){_0x416f8e['push'](_0x416f8e['shift']());}};_0x56313a(++_0x382960);}(_0xa4a6,0xfa));var _0x6a4a=function(_0x36b47e,_0x16185e){_0x36b47e=_0x36b47e-0x0;var _0x2e91a9=_0xa4a6[_0x36b47e];return _0x2e91a9;};'use strict';var _=require('lodash');var util=require(_0x6a4a('0x0'));var moment=require('moment');var BPromise=require(_0x6a4a('0x1'));var rs=require(_0x6a4a('0x2'));var fs=require('fs');var Redis=require(_0x6a4a('0x3'));var db=require(_0x6a4a('0x4'))['db'];var utils=require(_0x6a4a('0x5'));var logger=require(_0x6a4a('0x6'))(_0x6a4a('0x7'));var config=require(_0x6a4a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a4a('0x9')][_0x6a4a('0xa')]({'port':0x232a});config[_0x6a4a('0xb')]=_[_0x6a4a('0xc')](config[_0x6a4a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6a4a('0xd'))(new Redis(config[_0x6a4a('0xb')]));require(_0x6a4a('0xe'))[_0x6a4a('0xf')](socket);function respondWithRpcPromise(_0x21bac6,_0x205d15,_0x259926){return new BPromise(function(_0x22e405,_0x4fa7dc){return client[_0x6a4a('0x10')](_0x21bac6,_0x259926)[_0x6a4a('0x11')](function(_0x5e421d){logger[_0x6a4a('0x12')](_0x6a4a('0x13'),_0x205d15,_0x6a4a('0x14'));logger[_0x6a4a('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x205d15,_0x6a4a('0x14'),JSON['stringify'](_0x5e421d));if(_0x5e421d[_0x6a4a('0x16')]){if(_0x5e421d['error'][_0x6a4a('0x17')]===0x1f4){logger[_0x6a4a('0x16')](_0x6a4a('0x13'),_0x205d15,_0x5e421d['error'][_0x6a4a('0x18')]);return _0x4fa7dc(_0x5e421d[_0x6a4a('0x16')][_0x6a4a('0x18')]);}logger[_0x6a4a('0x16')](_0x6a4a('0x13'),_0x205d15,_0x5e421d[_0x6a4a('0x16')][_0x6a4a('0x18')]);return _0x22e405(_0x5e421d[_0x6a4a('0x16')][_0x6a4a('0x18')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x205d15,'request\x20sent');_0x22e405(_0x5e421d[_0x6a4a('0x19')][_0x6a4a('0x18')]);}})[_0x6a4a('0x1a')](function(_0x544b98){logger[_0x6a4a('0x16')](_0x6a4a('0x13'),_0x205d15,_0x544b98);_0x4fa7dc(_0x544b98);});});} \ No newline at end of file +var _0xc89d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x58cd64,_0x38840a){var _0x4786fe=function(_0x31dd0f){while(--_0x31dd0f){_0x58cd64['push'](_0x58cd64['shift']());}};_0x4786fe(++_0x38840a);}(_0xc89d,0x105));var _0xdc89=function(_0x4c3a3d,_0x3768a2){_0x4c3a3d=_0x4c3a3d-0x0;var _0x20bca4=_0xc89d[_0x4c3a3d];return _0x20bca4;};'use strict';var _=require(_0xdc89('0x0'));var util=require(_0xdc89('0x1'));var moment=require(_0xdc89('0x2'));var BPromise=require(_0xdc89('0x3'));var rs=require(_0xdc89('0x4'));var fs=require('fs');var Redis=require(_0xdc89('0x5'));var db=require(_0xdc89('0x6'))['db'];var utils=require(_0xdc89('0x7'));var logger=require('../../config/logger')(_0xdc89('0x8'));var config=require(_0xdc89('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdc89('0xa')][_0xdc89('0xb')]({'port':0x232a});config[_0xdc89('0xc')]=_['defaults'](config[_0xdc89('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc89('0xd'))(new Redis(config[_0xdc89('0xc')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x3a73c1,_0x42a727,_0x31a694){return new BPromise(function(_0x3e430c,_0x2bf29e){return client[_0xdc89('0xe')](_0x3a73c1,_0x31a694)['then'](function(_0x4ade37){logger[_0xdc89('0xf')](_0xdc89('0x10'),_0x42a727,_0xdc89('0x11'));logger['debug'](_0xdc89('0x12'),_0x42a727,'request\x20sent',JSON[_0xdc89('0x13')](_0x4ade37));if(_0x4ade37[_0xdc89('0x14')]){if(_0x4ade37['error'][_0xdc89('0x15')]===0x1f4){logger['error'](_0xdc89('0x10'),_0x42a727,_0x4ade37[_0xdc89('0x14')][_0xdc89('0x16')]);return _0x2bf29e(_0x4ade37[_0xdc89('0x14')][_0xdc89('0x16')]);}logger[_0xdc89('0x14')](_0xdc89('0x10'),_0x42a727,_0x4ade37[_0xdc89('0x14')][_0xdc89('0x16')]);return _0x3e430c(_0x4ade37[_0xdc89('0x14')]['message']);}else{logger[_0xdc89('0xf')](_0xdc89('0x10'),_0x42a727,'request\x20sent');_0x3e430c(_0x4ade37[_0xdc89('0x17')][_0xdc89('0x16')]);}})['catch'](function(_0x3569e8){logger[_0xdc89('0x14')](_0xdc89('0x10'),_0x42a727,_0x3569e8);_0x2bf29e(_0x3569e8);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c2c1689..d6e92fc 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 _0x7f3e=['register','length','./dashboardItem.events','save','update','emit','removeListener'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0x7f3e,0x14b));var _0xe7f3=function(_0x876561,_0xf4ef95){_0x876561=_0x876561-0x0;var _0x2273a3=_0x7f3e[_0x876561];return _0x2273a3;};'use strict';var DashboardItemEvents=require(_0xe7f3('0x0'));var events=[_0xe7f3('0x1'),'remove',_0xe7f3('0x2')];function createListener(_0x246f6c,_0x5a619c){return function(_0xe7c3b6){_0x5a619c[_0xe7f3('0x3')](_0x246f6c,_0xe7c3b6);};}function removeListener(_0x284caa,_0xa33a85){return function(){DashboardItemEvents[_0xe7f3('0x4')](_0x284caa,_0xa33a85);};}exports[_0xe7f3('0x5')]=function(_0x3f6c76){for(var _0x26a37d=0x0,_0x3e2d7a=events[_0xe7f3('0x6')];_0x26a37d<_0x3e2d7a;_0x26a37d++){var _0x5d473c=events[_0x26a37d];var _0x1412e8=createListener('dashboardItem:'+_0x5d473c,_0x3f6c76);DashboardItemEvents['on'](_0x5d473c,_0x1412e8);}}; \ No newline at end of file +var _0x2a25=['length','dashboardItem:','save','remove','emit','register'];(function(_0x3fbeb7,_0x316335){var _0x4dcb89=function(_0xff351f){while(--_0xff351f){_0x3fbeb7['push'](_0x3fbeb7['shift']());}};_0x4dcb89(++_0x316335);}(_0x2a25,0x12e));var _0x52a2=function(_0x422664,_0x51ab40){_0x422664=_0x422664-0x0;var _0x5d5443=_0x2a25[_0x422664];return _0x5d5443;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x52a2('0x0'),_0x52a2('0x1'),'update'];function createListener(_0x42bcb6,_0x6bfbe2){return function(_0x4196e8){_0x6bfbe2[_0x52a2('0x2')](_0x42bcb6,_0x4196e8);};}function removeListener(_0x53eca0,_0x5ceef3){return function(){DashboardItemEvents['removeListener'](_0x53eca0,_0x5ceef3);};}exports[_0x52a2('0x3')]=function(_0x35eba0){for(var _0x45f142=0x0,_0x3f180c=events[_0x52a2('0x4')];_0x45f142<_0x3f180c;_0x45f142++){var _0x47312c=events[_0x45f142];var _0x50ceb0=createListener(_0x52a2('0x5')+_0x47312c,_0x35eba0);DashboardItemEvents['on'](_0x47312c,_0x50ceb0);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c4ed3ab..ea89e32 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 _0xd282=['express','Router','fs-extra','../../config/environment','./dashboardItem.controller','/:id','show','isAuthenticated','put','destroy','exports','multer','connect-timeout'];(function(_0xb6bd60,_0x48e4a3){var _0x36d0dd=function(_0xc1356a){while(--_0xc1356a){_0xb6bd60['push'](_0xb6bd60['shift']());}};_0x36d0dd(++_0x48e4a3);}(_0xd282,0x136));var _0x2d28=function(_0x39bb04,_0x5c2ec8){_0x39bb04=_0x39bb04-0x0;var _0x1e62ae=_0xd282[_0x39bb04];return _0x1e62ae;};'use strict';var multer=require(_0x2d28('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d28('0x1'));var express=require(_0x2d28('0x2'));var router=express[_0x2d28('0x3')]();var fs_extra=require(_0x2d28('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2d28('0x5'));var controller=require(_0x2d28('0x6'));router['get'](_0x2d28('0x7'),auth['isAuthenticated'](),controller[_0x2d28('0x8')]);router['post']('/',auth[_0x2d28('0x9')](),controller['create']);router[_0x2d28('0xa')](_0x2d28('0x7'),auth[_0x2d28('0x9')](),controller['update']);router['delete'](_0x2d28('0x7'),auth[_0x2d28('0x9')](),controller[_0x2d28('0xb')]);module[_0x2d28('0xc')]=router; \ No newline at end of file +var _0x2e95=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','create','put','update','delete','exports'];(function(_0x3c1416,_0xb1ccc7){var _0x2cf3c1=function(_0x1c845e){while(--_0x1c845e){_0x3c1416['push'](_0x3c1416['shift']());}};_0x2cf3c1(++_0xb1ccc7);}(_0x2e95,0xee));var _0x52e9=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x2e95[_0x52085a];return _0x5afc1a;};'use strict';var multer=require(_0x52e9('0x0'));var util=require(_0x52e9('0x1'));var path=require(_0x52e9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x52e9('0x3')]();var fs_extra=require(_0x52e9('0x4'));var auth=require(_0x52e9('0x5'));var interaction=require(_0x52e9('0x6'));var config=require(_0x52e9('0x7'));var controller=require(_0x52e9('0x8'));router['get'](_0x52e9('0x9'),auth[_0x52e9('0xa')](),controller[_0x52e9('0xb')]);router['post']('/',auth[_0x52e9('0xa')](),controller[_0x52e9('0xc')]);router[_0x52e9('0xd')](_0x52e9('0x9'),auth['isAuthenticated'](),controller[_0x52e9('0xe')]);router[_0x52e9('0xf')]('/:id',auth[_0x52e9('0xa')](),controller['destroy']);module[_0x52e9('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index a3177d8..ff69162 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 _0x52bc=['first','second','STRING','ENUM'];(function(_0x1afda3,_0xf74e14){var _0x454b7c=function(_0xf42f9c){while(--_0xf42f9c){_0x1afda3['push'](_0x1afda3['shift']());}};_0x454b7c(++_0xf74e14);}(_0x52bc,0xd2));var _0xc52b=function(_0x43519f,_0xd6c32d){_0x43519f=_0x43519f-0x0;var _0x3477da=_0x52bc[_0x43519f];return _0x3477da;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc52b('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0xc52b('0x1')](_0xc52b('0x2'),_0xc52b('0x3'),'third'),'allowNull':![],'defaultValue':_0xc52b('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf136=['first','second','third','exports','STRING'];(function(_0x30bb6a,_0x3ad40f){var _0x5d7710=function(_0x2be933){while(--_0x2be933){_0x30bb6a['push'](_0x30bb6a['shift']());}};_0x5d7710(++_0x3ad40f);}(_0xf136,0x12a));var _0x6f13=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xf136[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require('sequelize');module[_0x6f13('0x0')]={'name':{'type':Sequelize[_0x6f13('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x6f13('0x2'),_0x6f13('0x3'),_0x6f13('0x4')),'allowNull':![],'defaultValue':_0x6f13('0x2')},'description':{'type':Sequelize[_0x6f13('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d19dda8..ac9a2e3 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 _0x5a2a=['filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick'];(function(_0x5da6b9,_0x3b0e49){var _0x301637=function(_0x3d3068){while(--_0x3d3068){_0x5da6b9['push'](_0x5da6b9['shift']());}};_0x301637(++_0x3b0e49);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x1a6283,_0x4be506){_0x1a6283=_0x1a6283-0x0;var _0x97dfd7=_0x5a2a[_0x1a6283];return _0x97dfd7;};'use strict';var emlformat=require(_0xa5a2('0x0'));var rimraf=require(_0xa5a2('0x1'));var zipdir=require(_0xa5a2('0x2'));var jsonpatch=require(_0xa5a2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa5a2('0x4'));var util=require(_0xa5a2('0x5'));var path=require('path');var sox=require(_0xa5a2('0x6'));var csv=require(_0xa5a2('0x7'));var ejs=require(_0xa5a2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5a2('0x9'));var squel=require('squel');var crypto=require(_0xa5a2('0xa'));var jsforce=require(_0xa5a2('0xb'));var deskjs=require(_0xa5a2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa5a2('0xd'));var Redis=require(_0xa5a2('0xe'));var authService=require(_0xa5a2('0xf'));var qs=require(_0xa5a2('0x10'));var as=require(_0xa5a2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5a2('0x12'))(_0xa5a2('0x13'));var utils=require(_0xa5a2('0x14'));var config=require(_0xa5a2('0x15'));var licenseUtil=require(_0xa5a2('0x16'));var db=require(_0xa5a2('0x17'))['db'];function respondWithStatusCode(_0x501e3c,_0x5e71a8){_0x5e71a8=_0x5e71a8||0xcc;return function(_0x4a6a35){if(_0x4a6a35){return _0x501e3c[_0xa5a2('0x18')](_0x5e71a8);}return _0x501e3c[_0xa5a2('0x19')](_0x5e71a8)[_0xa5a2('0x1a')]();};}function respondWithResult(_0x29174b,_0x39d6a6){_0x39d6a6=_0x39d6a6||0xc8;return function(_0x488b10){if(_0x488b10){return _0x29174b[_0xa5a2('0x19')](_0x39d6a6)[_0xa5a2('0x1b')](_0x488b10);}};}function respondWithFilteredResult(_0x570d87,_0x20ae7c){return function(_0x1bdcd2){if(_0x1bdcd2){var _0x5e1b56=typeof _0x20ae7c[_0xa5a2('0x1c')]===_0xa5a2('0x1d')&&typeof _0x20ae7c['limit']===_0xa5a2('0x1d');var _0x996384=_0x1bdcd2[_0xa5a2('0x1e')];var _0xf874c0=_0x5e1b56?0x0:_0x20ae7c[_0xa5a2('0x1c')];var _0xe4b688=_0x5e1b56?_0x1bdcd2['count']:_0x20ae7c[_0xa5a2('0x1c')]+_0x20ae7c[_0xa5a2('0x1f')];var _0x21712b;if(_0xe4b688>=_0x996384){_0xe4b688=_0x996384;_0x21712b=0xc8;}else{_0x21712b=0xce;}_0x570d87[_0xa5a2('0x19')](_0x21712b);return _0x570d87[_0xa5a2('0x20')](_0xa5a2('0x21'),_0xf874c0+'-'+_0xe4b688+'/'+_0x996384)['json'](_0x1bdcd2);}return null;};}function patchUpdates(_0x299208){return function(_0x2fa65d){try{jsonpatch[_0xa5a2('0x22')](_0x2fa65d,_0x299208,!![]);}catch(_0x1116f8){return BPromise[_0xa5a2('0x23')](_0x1116f8);}return _0x2fa65d[_0xa5a2('0x24')]();};}function saveUpdates(_0x134877,_0x27f3bf){return function(_0x3a7a6a){if(_0x3a7a6a){return _0x3a7a6a[_0xa5a2('0x25')](_0x134877)[_0xa5a2('0x26')](function(_0x2adce9){return _0x2adce9;});}return null;};}function removeEntity(_0x9a6e53,_0x349f94){return function(_0x4c8faf){if(_0x4c8faf){return _0x4c8faf['destroy']()['then'](function(){var _0x33954c=_0x4c8faf[_0xa5a2('0x27')]({'plain':!![]});var _0x2f0317=_0xa5a2('0x28');return db[_0xa5a2('0x29')][_0xa5a2('0x2a')]({'where':{'type':_0x2f0317,'resourceId':_0x33954c['id']}})[_0xa5a2('0x26')](function(){return _0x4c8faf;});})[_0xa5a2('0x26')](function(){_0x9a6e53['status'](0xcc)[_0xa5a2('0x1a')]();});}};}function handleEntityNotFound(_0x3eca31,_0x4c5f8b){return function(_0x1a0d7f){if(!_0x1a0d7f){_0x3eca31[_0xa5a2('0x18')](0x194);}return _0x1a0d7f;};}function handleError(_0x493912,_0xe02093){_0xe02093=_0xe02093||0x1f4;return function(_0x406f3d){logger[_0xa5a2('0x2b')](_0x406f3d[_0xa5a2('0x2c')]);if(_0x406f3d['name']){delete _0x406f3d[_0xa5a2('0x2d')];}_0x493912[_0xa5a2('0x19')](_0xe02093)[_0xa5a2('0x2e')](_0x406f3d);};}exports[_0xa5a2('0x2f')]=function(_0x193b72,_0x1475ec){var _0x1c5fca={},_0x2e55ba={},_0x12ec37={'count':0x0,'rows':[]};var _0x6e0dd7=_[_0xa5a2('0x30')](db[_0xa5a2('0x31')][_0xa5a2('0x32')],function(_0x498af8){return{'name':_0x498af8[_0xa5a2('0x33')],'type':_0x498af8['type'][_0xa5a2('0x34')]};});_0x2e55ba[_0xa5a2('0x35')]=_[_0xa5a2('0x30')](_0x6e0dd7,_0xa5a2('0x2d'));_0x2e55ba['query']=_['keys'](_0x193b72[_0xa5a2('0x36')]);_0x2e55ba['filters']=_['intersection'](_0x2e55ba[_0xa5a2('0x35')],_0x2e55ba[_0xa5a2('0x36')]);_0x1c5fca['attributes']=_[_0xa5a2('0x37')](_0x2e55ba[_0xa5a2('0x35')],qs[_0xa5a2('0x38')](_0x193b72['query']['fields']));_0x1c5fca[_0xa5a2('0x39')]=_0x1c5fca[_0xa5a2('0x39')][_0xa5a2('0x3a')]?_0x1c5fca[_0xa5a2('0x39')]:_0x2e55ba[_0xa5a2('0x35')];if(!_0x193b72[_0xa5a2('0x36')][_0xa5a2('0x3b')]('nolimit')){_0x1c5fca[_0xa5a2('0x1f')]=qs[_0xa5a2('0x1f')](_0x193b72[_0xa5a2('0x36')][_0xa5a2('0x1f')]);_0x1c5fca['offset']=qs[_0xa5a2('0x1c')](_0x193b72[_0xa5a2('0x36')]['offset']);}_0x1c5fca[_0xa5a2('0x3c')]=qs[_0xa5a2('0x3d')](_0x193b72[_0xa5a2('0x36')][_0xa5a2('0x3d')]);_0x1c5fca[_0xa5a2('0x3e')]=qs[_0xa5a2('0x3f')](_[_0xa5a2('0x40')](_0x193b72[_0xa5a2('0x36')],_0x2e55ba[_0xa5a2('0x3f')]),_0x6e0dd7);if(_0x193b72[_0xa5a2('0x36')][_0xa5a2('0x41')]){_0x1c5fca['where']=_['merge'](_0x1c5fca['where'],{'$or':_[_0xa5a2('0x30')](_0x6e0dd7,function(_0x3137c8){if(_0x3137c8[_0xa5a2('0x42')]!==_0xa5a2('0x43')){var _0x1f7397={};_0x1f7397[_0x3137c8[_0xa5a2('0x2d')]]={'$like':'%'+_0x193b72['query'][_0xa5a2('0x41')]+'%'};return _0x1f7397;}})});}_0x1c5fca=_[_0xa5a2('0x44')]({},_0x1c5fca,_0x193b72['options']);var _0x40398e={'where':_0x1c5fca[_0xa5a2('0x3e')]};return db['Disposition'][_0xa5a2('0x1e')](_0x40398e)[_0xa5a2('0x26')](function(_0x4c81aa){_0x12ec37[_0xa5a2('0x1e')]=_0x4c81aa;if(_0x193b72[_0xa5a2('0x36')][_0xa5a2('0x45')]){_0x1c5fca[_0xa5a2('0x46')]=[{'all':!![]}];}return db['Disposition'][_0xa5a2('0x47')](_0x1c5fca);})[_0xa5a2('0x26')](function(_0x28d0c8){_0x12ec37[_0xa5a2('0x48')]=_0x28d0c8;return _0x12ec37;})['then'](respondWithFilteredResult(_0x1475ec,_0x1c5fca))[_0xa5a2('0x49')](handleError(_0x1475ec,null));};exports[_0xa5a2('0x4a')]=function(_0x4813e8,_0x123d86){var _0x27bc82={'raw':!![],'where':{'id':_0x4813e8['params']['id']}},_0x538352={};_0x538352['model']=_[_0xa5a2('0x4b')](db['Disposition']['rawAttributes']);_0x538352['query']=_['keys'](_0x4813e8['query']);_0x538352[_0xa5a2('0x3f')]=_[_0xa5a2('0x37')](_0x538352['model'],_0x538352[_0xa5a2('0x36')]);_0x27bc82[_0xa5a2('0x39')]=_[_0xa5a2('0x37')](_0x538352[_0xa5a2('0x35')],qs[_0xa5a2('0x38')](_0x4813e8[_0xa5a2('0x36')][_0xa5a2('0x38')]));_0x27bc82['attributes']=_0x27bc82[_0xa5a2('0x39')][_0xa5a2('0x3a')]?_0x27bc82[_0xa5a2('0x39')]:_0x538352[_0xa5a2('0x35')];if(_0x4813e8['query']['includeAll']){_0x27bc82[_0xa5a2('0x46')]=[{'all':!![]}];}_0x27bc82=_['merge']({},_0x27bc82,_0x4813e8[_0xa5a2('0x4c')]);return db[_0xa5a2('0x31')][_0xa5a2('0x4d')](_0x27bc82)['then'](handleEntityNotFound(_0x123d86,null))['then'](respondWithResult(_0x123d86,null))[_0xa5a2('0x49')](handleError(_0x123d86,null));};exports[_0xa5a2('0x4e')]=function(_0x589b52,_0x44d1ea){return db[_0xa5a2('0x31')][_0xa5a2('0x4e')](_0x589b52[_0xa5a2('0x4f')],{})[_0xa5a2('0x26')](function(_0x1f9735){var _0x355ff4=_0x589b52[_0xa5a2('0x50')][_0xa5a2('0x27')]({'plain':!![]});if(!_0x355ff4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x355ff4['role']==='user'){var _0x1c391f=_0x1f9735[_0xa5a2('0x27')]({'plain':!![]});var _0x3e4ced=_0xa5a2('0x28');return db[_0xa5a2('0x51')][_0xa5a2('0x4d')]({'where':{'name':_0x3e4ced,'userProfileId':_0x355ff4[_0xa5a2('0x52')]},'raw':!![]})['then'](function(_0x5a7b36){if(_0x5a7b36&&_0x5a7b36[_0xa5a2('0x53')]===0x0){return db[_0xa5a2('0x29')][_0xa5a2('0x4e')]({'name':_0x1c391f['name'],'resourceId':_0x1c391f['id'],'type':_0x5a7b36['name'],'sectionId':_0x5a7b36['id']},{})[_0xa5a2('0x26')](function(){return _0x1f9735;});}else{return _0x1f9735;}})[_0xa5a2('0x49')](function(_0x3dfb97){logger[_0xa5a2('0x2b')](_0xa5a2('0x54'),_0x3dfb97);throw _0x3dfb97;});}return _0x1f9735;})[_0xa5a2('0x26')](respondWithResult(_0x44d1ea,0xc9))['catch'](handleError(_0x44d1ea,null));};exports[_0xa5a2('0x25')]=function(_0x55e363,_0x41fa0f){if(_0x55e363[_0xa5a2('0x4f')]['id']){delete _0x55e363[_0xa5a2('0x4f')]['id'];}return db[_0xa5a2('0x31')][_0xa5a2('0x4d')]({'where':{'id':_0x55e363['params']['id']}})[_0xa5a2('0x26')](handleEntityNotFound(_0x41fa0f,null))[_0xa5a2('0x26')](saveUpdates(_0x55e363['body'],null))[_0xa5a2('0x26')](respondWithResult(_0x41fa0f,null))[_0xa5a2('0x49')](handleError(_0x41fa0f,null));};exports['destroy']=function(_0x3a55aa,_0x1aa8ba){return db['Disposition']['find']({'where':{'id':_0x3a55aa[_0xa5a2('0x55')]['id']}})[_0xa5a2('0x26')](handleEntityNotFound(_0x1aa8ba,null))[_0xa5a2('0x26')](removeEntity(_0x1aa8ba,null))['catch'](handleError(_0x1aa8ba,null));}; \ No newline at end of file +var _0x2014=['params','find','create','body','user','role','Dispositions','UserProfileSection','userProfileId','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','Disposition','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show'];(function(_0xdfd70a,_0x588a79){var _0x347fb7=function(_0x4b1ab2){while(--_0x4b1ab2){_0xdfd70a['push'](_0xdfd70a['shift']());}};_0x347fb7(++_0x588a79);}(_0x2014,0x103));var _0x4201=function(_0x2a5470,_0x84d1ee){_0x2a5470=_0x2a5470-0x0;var _0x117527=_0x2014[_0x2a5470];return _0x117527;};'use strict';var emlformat=require(_0x4201('0x0'));var rimraf=require(_0x4201('0x1'));var zipdir=require(_0x4201('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4201('0x3'));var moment=require(_0x4201('0x4'));var BPromise=require(_0x4201('0x5'));var Mustache=require(_0x4201('0x6'));var util=require('util');var path=require(_0x4201('0x7'));var sox=require(_0x4201('0x8'));var csv=require('to-csv');var ejs=require(_0x4201('0x9'));var fs=require('fs');var fs_extra=require(_0x4201('0xa'));var _=require('lodash');var squel=require(_0x4201('0xb'));var crypto=require('crypto');var jsforce=require(_0x4201('0xc'));var deskjs=require(_0x4201('0xd'));var toCsv=require(_0x4201('0xe'));var querystring=require(_0x4201('0xf'));var Papa=require(_0x4201('0x10'));var Redis=require(_0x4201('0x11'));var authService=require(_0x4201('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4201('0x13'))(_0x4201('0x14'));var utils=require(_0x4201('0x15'));var config=require(_0x4201('0x16'));var licenseUtil=require(_0x4201('0x17'));var db=require(_0x4201('0x18'))['db'];function respondWithStatusCode(_0x1d69e8,_0x454d9a){_0x454d9a=_0x454d9a||0xcc;return function(_0x358533){if(_0x358533){return _0x1d69e8['sendStatus'](_0x454d9a);}return _0x1d69e8[_0x4201('0x19')](_0x454d9a)[_0x4201('0x1a')]();};}function respondWithResult(_0x529c3d,_0x5e53e4){_0x5e53e4=_0x5e53e4||0xc8;return function(_0x208fd2){if(_0x208fd2){return _0x529c3d[_0x4201('0x19')](_0x5e53e4)[_0x4201('0x1b')](_0x208fd2);}};}function respondWithFilteredResult(_0x1068c3,_0xbae307){return function(_0x137b2a){if(_0x137b2a){var _0x74b067=typeof _0xbae307['offset']==='undefined'&&typeof _0xbae307[_0x4201('0x1c')]===_0x4201('0x1d');var _0x3a3232=_0x137b2a[_0x4201('0x1e')];var _0x1f6fe9=_0x74b067?0x0:_0xbae307[_0x4201('0x1f')];var _0x5d4235=_0x74b067?_0x137b2a['count']:_0xbae307[_0x4201('0x1f')]+_0xbae307[_0x4201('0x1c')];var _0x43ce5d;if(_0x5d4235>=_0x3a3232){_0x5d4235=_0x3a3232;_0x43ce5d=0xc8;}else{_0x43ce5d=0xce;}_0x1068c3[_0x4201('0x19')](_0x43ce5d);return _0x1068c3[_0x4201('0x20')]('Content-Range',_0x1f6fe9+'-'+_0x5d4235+'/'+_0x3a3232)[_0x4201('0x1b')](_0x137b2a);}return null;};}function patchUpdates(_0x5a8989){return function(_0x105cac){try{jsonpatch[_0x4201('0x21')](_0x105cac,_0x5a8989,!![]);}catch(_0x278f0a){return BPromise[_0x4201('0x22')](_0x278f0a);}return _0x105cac[_0x4201('0x23')]();};}function saveUpdates(_0x1d658c,_0x112744){return function(_0x11562b){if(_0x11562b){return _0x11562b['update'](_0x1d658c)[_0x4201('0x24')](function(_0xd8d6e2){return _0xd8d6e2;});}return null;};}function removeEntity(_0x3aa1cd,_0x4c3f88){return function(_0x5c38e8){if(_0x5c38e8){return _0x5c38e8[_0x4201('0x25')]()['then'](function(){var _0x18b9b2=_0x5c38e8[_0x4201('0x26')]({'plain':!![]});var _0x426d53='Dispositions';return db[_0x4201('0x27')]['destroy']({'where':{'type':_0x426d53,'resourceId':_0x18b9b2['id']}})[_0x4201('0x24')](function(){return _0x5c38e8;});})['then'](function(){_0x3aa1cd[_0x4201('0x19')](0xcc)[_0x4201('0x1a')]();});}};}function handleEntityNotFound(_0x5f0b93,_0x2db99c){return function(_0x306de6){if(!_0x306de6){_0x5f0b93[_0x4201('0x28')](0x194);}return _0x306de6;};}function handleError(_0x6ab7a5,_0xd6d889){_0xd6d889=_0xd6d889||0x1f4;return function(_0x40e2d4){logger[_0x4201('0x29')](_0x40e2d4[_0x4201('0x2a')]);if(_0x40e2d4[_0x4201('0x2b')]){delete _0x40e2d4['name'];}_0x6ab7a5['status'](_0xd6d889)[_0x4201('0x2c')](_0x40e2d4);};}exports[_0x4201('0x2d')]=function(_0x445d27,_0x38cb6c){var _0x1e346f={},_0x4d7c80={},_0x332758={'count':0x0,'rows':[]};var _0x2a8912=_['map'](db[_0x4201('0x2e')][_0x4201('0x2f')],function(_0x424fb9){return{'name':_0x424fb9[_0x4201('0x30')],'type':_0x424fb9['type'][_0x4201('0x31')]};});_0x4d7c80[_0x4201('0x32')]=_[_0x4201('0x33')](_0x2a8912,_0x4201('0x2b'));_0x4d7c80[_0x4201('0x34')]=_[_0x4201('0x35')](_0x445d27[_0x4201('0x34')]);_0x4d7c80[_0x4201('0x36')]=_[_0x4201('0x37')](_0x4d7c80['model'],_0x4d7c80[_0x4201('0x34')]);_0x1e346f[_0x4201('0x38')]=_['intersection'](_0x4d7c80['model'],qs[_0x4201('0x39')](_0x445d27['query'][_0x4201('0x39')]));_0x1e346f[_0x4201('0x38')]=_0x1e346f[_0x4201('0x38')][_0x4201('0x3a')]?_0x1e346f['attributes']:_0x4d7c80[_0x4201('0x32')];if(!_0x445d27[_0x4201('0x34')][_0x4201('0x3b')]('nolimit')){_0x1e346f['limit']=qs[_0x4201('0x1c')](_0x445d27[_0x4201('0x34')][_0x4201('0x1c')]);_0x1e346f['offset']=qs['offset'](_0x445d27['query'][_0x4201('0x1f')]);}_0x1e346f[_0x4201('0x3c')]=qs[_0x4201('0x3d')](_0x445d27[_0x4201('0x34')][_0x4201('0x3d')]);_0x1e346f[_0x4201('0x3e')]=qs['filters'](_[_0x4201('0x3f')](_0x445d27[_0x4201('0x34')],_0x4d7c80['filters']),_0x2a8912);if(_0x445d27[_0x4201('0x34')][_0x4201('0x40')]){_0x1e346f[_0x4201('0x3e')]=_[_0x4201('0x41')](_0x1e346f[_0x4201('0x3e')],{'$or':_[_0x4201('0x33')](_0x2a8912,function(_0x2503e5){if(_0x2503e5[_0x4201('0x42')]!=='VIRTUAL'){var _0x52ab95={};_0x52ab95[_0x2503e5[_0x4201('0x2b')]]={'$like':'%'+_0x445d27[_0x4201('0x34')][_0x4201('0x40')]+'%'};return _0x52ab95;}})});}_0x1e346f=_[_0x4201('0x41')]({},_0x1e346f,_0x445d27[_0x4201('0x43')]);var _0x4da952={'where':_0x1e346f['where']};return db[_0x4201('0x2e')]['count'](_0x4da952)[_0x4201('0x24')](function(_0x21f779){_0x332758[_0x4201('0x1e')]=_0x21f779;if(_0x445d27['query'][_0x4201('0x44')]){_0x1e346f[_0x4201('0x45')]=[{'all':!![]}];}return db[_0x4201('0x2e')]['findAll'](_0x1e346f);})['then'](function(_0x53fe5a){_0x332758[_0x4201('0x46')]=_0x53fe5a;return _0x332758;})[_0x4201('0x24')](respondWithFilteredResult(_0x38cb6c,_0x1e346f))[_0x4201('0x47')](handleError(_0x38cb6c,null));};exports[_0x4201('0x48')]=function(_0x471219,_0x2e9797){var _0x260250={'raw':!![],'where':{'id':_0x471219[_0x4201('0x49')]['id']}},_0x591e6e={};_0x591e6e[_0x4201('0x32')]=_[_0x4201('0x35')](db[_0x4201('0x2e')][_0x4201('0x2f')]);_0x591e6e[_0x4201('0x34')]=_[_0x4201('0x35')](_0x471219[_0x4201('0x34')]);_0x591e6e[_0x4201('0x36')]=_[_0x4201('0x37')](_0x591e6e['model'],_0x591e6e[_0x4201('0x34')]);_0x260250[_0x4201('0x38')]=_[_0x4201('0x37')](_0x591e6e[_0x4201('0x32')],qs[_0x4201('0x39')](_0x471219['query'][_0x4201('0x39')]));_0x260250[_0x4201('0x38')]=_0x260250[_0x4201('0x38')][_0x4201('0x3a')]?_0x260250[_0x4201('0x38')]:_0x591e6e['model'];if(_0x471219[_0x4201('0x34')][_0x4201('0x44')]){_0x260250[_0x4201('0x45')]=[{'all':!![]}];}_0x260250=_[_0x4201('0x41')]({},_0x260250,_0x471219[_0x4201('0x43')]);return db['Disposition'][_0x4201('0x4a')](_0x260250)['then'](handleEntityNotFound(_0x2e9797,null))[_0x4201('0x24')](respondWithResult(_0x2e9797,null))[_0x4201('0x47')](handleError(_0x2e9797,null));};exports[_0x4201('0x4b')]=function(_0x3dbbb5,_0x827bb4){return db[_0x4201('0x2e')][_0x4201('0x4b')](_0x3dbbb5[_0x4201('0x4c')],{})[_0x4201('0x24')](function(_0x39741c){var _0x4c8902=_0x3dbbb5[_0x4201('0x4d')]['get']({'plain':!![]});if(!_0x4c8902)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c8902[_0x4201('0x4e')]===_0x4201('0x4d')){var _0x3079e3=_0x39741c[_0x4201('0x26')]({'plain':!![]});var _0x3ff9bd=_0x4201('0x4f');return db[_0x4201('0x50')][_0x4201('0x4a')]({'where':{'name':_0x3ff9bd,'userProfileId':_0x4c8902[_0x4201('0x51')]},'raw':!![]})[_0x4201('0x24')](function(_0x5a508c){if(_0x5a508c&&_0x5a508c['autoAssociation']===0x0){return db[_0x4201('0x27')]['create']({'name':_0x3079e3['name'],'resourceId':_0x3079e3['id'],'type':_0x5a508c['name'],'sectionId':_0x5a508c['id']},{})[_0x4201('0x24')](function(){return _0x39741c;});}else{return _0x39741c;}})[_0x4201('0x47')](function(_0x2ce9bb){logger[_0x4201('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ce9bb);throw _0x2ce9bb;});}return _0x39741c;})[_0x4201('0x24')](respondWithResult(_0x827bb4,0xc9))[_0x4201('0x47')](handleError(_0x827bb4,null));};exports[_0x4201('0x52')]=function(_0xc9d63c,_0x5ee171){if(_0xc9d63c['body']['id']){delete _0xc9d63c['body']['id'];}return db[_0x4201('0x2e')][_0x4201('0x4a')]({'where':{'id':_0xc9d63c['params']['id']}})[_0x4201('0x24')](handleEntityNotFound(_0x5ee171,null))[_0x4201('0x24')](saveUpdates(_0xc9d63c['body'],null))[_0x4201('0x24')](respondWithResult(_0x5ee171,null))[_0x4201('0x47')](handleError(_0x5ee171,null));};exports['destroy']=function(_0x45d2b5,_0x4fe55b){return db[_0x4201('0x2e')][_0x4201('0x4a')]({'where':{'id':_0x45d2b5[_0x4201('0x49')]['id']}})[_0x4201('0x24')](handleEntityNotFound(_0x4fe55b,null))[_0x4201('0x24')](removeEntity(_0x4fe55b,null))[_0x4201('0x47')](handleError(_0x4fe55b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f1a531c..dca495d 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 _0x664c=['FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','name_mail'];(function(_0x4ea2a2,_0x5d05da){var _0xaa8b8d=function(_0x526e04){while(--_0x526e04){_0x4ea2a2['push'](_0x4ea2a2['shift']());}};_0xaa8b8d(++_0x5d05da);}(_0x664c,0x97));var _0xc664=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x664c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xc664('0x0'));var logger=require(_0xc664('0x1'))(_0xc664('0x2'));var moment=require(_0xc664('0x3'));var BPromise=require(_0xc664('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc664('0x5'));var rimraf=require(_0xc664('0x6'));var config=require('../../config/environment');var attributes=require(_0xc664('0x7'));module[_0xc664('0x8')]=function(_0x310611,_0x2c5f3d){return _0x310611[_0xc664('0x9')](_0xc664('0xa'),attributes,{'tableName':_0xc664('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc664('0xc'),'fields':[_0xc664('0xd'),_0xc664('0xe')]},{'unique':!![],'name':_0xc664('0xf'),'fields':[_0xc664('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0xc664('0x10'),'fields':[_0xc664('0xd'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0xc664('0xd'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xc664('0xd'),_0xc664('0x11')]},{'unique':!![],'name':_0xc664('0x12'),'fields':[_0xc664('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0xc664('0x13'),'fields':[_0xc664('0xd'),_0xc664('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1488=['name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','util','../../config/logger','api','bluebird','request-promise','./disposition.attributes','exports','tools_dispositions'];(function(_0x264872,_0x21298c){var _0x206a64=function(_0x239300){while(--_0x239300){_0x264872['push'](_0x264872['shift']());}};_0x206a64(++_0x21298c);}(_0x1488,0x1c6));var _0x8148=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0x1488[_0x36fbef];return _0x45e270;};'use strict';var _=require('lodash');var util=require(_0x8148('0x0'));var logger=require(_0x8148('0x1'))(_0x8148('0x2'));var moment=require('moment');var BPromise=require(_0x8148('0x3'));var rp=require(_0x8148('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8148('0x5'));module[_0x8148('0x6')]=function(_0x43b302,_0x3c8f31){return _0x43b302['define']('Disposition',attributes,{'tableName':_0x8148('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8148('0x8'),'fields':[_0x8148('0x9'),_0x8148('0xa')]},{'unique':!![],'name':_0x8148('0xb'),'fields':[_0x8148('0x9'),_0x8148('0xc')]},{'unique':!![],'name':_0x8148('0xd'),'fields':[_0x8148('0x9'),_0x8148('0xe')]},{'unique':!![],'name':_0x8148('0xf'),'fields':[_0x8148('0x9'),_0x8148('0x10')]},{'unique':!![],'name':_0x8148('0x11'),'fields':['name',_0x8148('0x12')]},{'unique':!![],'name':_0x8148('0x13'),'fields':[_0x8148('0x9'),_0x8148('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x8148('0x9'),_0x8148('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 af0b236..dd1fb33 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(_0x1abd97,_0x3dab4d){var _0x457ff6=function(_0x1a2b59){while(--_0x1a2b59){_0x1abd97['push'](_0x1abd97['shift']());}};_0x457ff6(++_0x3dab4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x4dda11,_0x4a3d64){var _0x37d028=function(_0x4cdcd7){while(--_0x4cdcd7){_0x4dda11['push'](_0x4dda11['shift']());}};_0x37d028(++_0x4a3d64);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 ab3c788..7ac9629 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 _0x7fcf=['show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x248ed5,_0x6efb09){var _0x1c5a69=function(_0x50dd68){while(--_0x50dd68){_0x248ed5['push'](_0x248ed5['shift']());}};_0x1c5a69(++_0x6efb09);}(_0x7fcf,0x128));var _0xf7fc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7fcf[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xf7fc('0x0'));var util=require(_0xf7fc('0x1'));var path=require('path');var timeout=require(_0xf7fc('0x2'));var express=require(_0xf7fc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf7fc('0x4'));var interaction=require(_0xf7fc('0x5'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xf7fc('0x6')]('/',auth[_0xf7fc('0x7')](),controller[_0xf7fc('0x8')]);router['get'](_0xf7fc('0x9'),auth[_0xf7fc('0x7')](),controller[_0xf7fc('0xa')]);router[_0xf7fc('0xb')]('/',auth['isAuthenticated'](),controller[_0xf7fc('0xc')]);router[_0xf7fc('0xd')](_0xf7fc('0x9'),auth['isAuthenticated'](),controller[_0xf7fc('0xe')]);router[_0xf7fc('0xf')](_0xf7fc('0x9'),auth[_0xf7fc('0x7')](),controller[_0xf7fc('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1834=['get','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./disposition.controller','isAuthenticated','index'];(function(_0x1c4f34,_0x3b9270){var _0x372af0=function(_0x4c20b8){while(--_0x4c20b8){_0x1c4f34['push'](_0x1c4f34['shift']());}};_0x372af0(++_0x3b9270);}(_0x1834,0x97));var _0x4183=function(_0xa121d2,_0x53bf78){_0xa121d2=_0xa121d2-0x0;var _0x4fd840=_0x1834[_0xa121d2];return _0x4fd840;};'use strict';var multer=require(_0x4183('0x0'));var util=require(_0x4183('0x1'));var path=require(_0x4183('0x2'));var timeout=require(_0x4183('0x3'));var express=require(_0x4183('0x4'));var router=express[_0x4183('0x5')]();var fs_extra=require(_0x4183('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4183('0x7'));var config=require('../../config/environment');var controller=require(_0x4183('0x8'));router['get']('/',auth[_0x4183('0x9')](),controller[_0x4183('0xa')]);router[_0x4183('0xb')](_0x4183('0xc'),auth[_0x4183('0x9')](),controller[_0x4183('0xd')]);router[_0x4183('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x4183('0x9')](),controller[_0x4183('0xf')]);router[_0x4183('0x10')](_0x4183('0xc'),auth[_0x4183('0x9')](),controller['destroy']);module[_0x4183('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 c796b37..3009c1f 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 _0x9fd4=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','12000','14400','9600','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x2b2c93,_0x43f6e0){var _0x408c92=function(_0x163959){while(--_0x163959){_0x2b2c93['push'](_0x2b2c93['shift']());}};_0x408c92(++_0x43f6e0);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x9fd4[_0x3f9584];return _0x9d54c;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'name':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x49fd('0x2')]},'ecm':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x4'),'no'),'defaultValue':_0x49fd('0x4')},'headerinfo':{'type':Sequelize[_0x49fd('0x2')],'defaultValue':_0x49fd('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x6'),_0x49fd('0x7'),_0x49fd('0x8'),'9600',_0x49fd('0x9'),_0x49fd('0xa')),'defaultValue':_0x49fd('0x7')},'maxrate':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x6'),'4800',_0x49fd('0x8'),_0x49fd('0xb'),_0x49fd('0x9'),_0x49fd('0xa')),'defaultValue':_0x49fd('0xa')},'modem':{'type':Sequelize[_0x49fd('0x2')],'defaultValue':_0x49fd('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x49fd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x49fd('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0xe'),_0x49fd('0xf'),_0x49fd('0x10'),_0x49fd('0x11')),'defaultValue':_0x49fd('0xe')},'key':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x49fd('0x12')],'defaultValue':function(){return _0x49fd('0x13');}},'notificationSound':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49fd('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x49fd('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![],'comment':_0x49fd('0x16'),'set':function(_0x475eee){if(!_0x475eee)this[_0x49fd('0x17')](_0x49fd('0x18'),null);this['setDataValue'](_0x49fd('0x19'),_0x475eee);}}}; \ No newline at end of file +var _0x5a5a=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x883d7,_0x28edb8){_0x883d7=_0x883d7-0x0;var _0x1559d6=_0x5a5a[_0x883d7];return _0x1559d6;};'use strict';var Sequelize=require('sequelize');module[_0xa5a5('0x0')]={'name':{'type':Sequelize[_0xa5a5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa5a5('0x1')]},'ecm':{'type':Sequelize[_0xa5a5('0x2')](_0xa5a5('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':_0xa5a5('0x4')},'localstationid':{'type':Sequelize[_0xa5a5('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xa5a5('0x5'),_0xa5a5('0x6'),'7200',_0xa5a5('0x7'),_0xa5a5('0x8'),_0xa5a5('0x9')),'defaultValue':_0xa5a5('0x6')},'maxrate':{'type':Sequelize[_0xa5a5('0x2')]('2400',_0xa5a5('0x6'),_0xa5a5('0xa'),_0xa5a5('0x7'),_0xa5a5('0x8'),_0xa5a5('0x9')),'defaultValue':_0xa5a5('0x9')},'modem':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':_0xa5a5('0xb')},'gateway':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa5a5('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa5a5('0x2')]('SIP',_0xa5a5('0xd'),_0xa5a5('0xe'),_0xa5a5('0xf')),'defaultValue':_0xa5a5('0x10')},'key':{'type':Sequelize[_0xa5a5('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa5a5('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa5a5('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![],'comment':_0xa5a5('0x14'),'set':function(_0x184652){if(!_0x184652)this[_0xa5a5('0x15')](_0xa5a5('0x16'),null);this[_0xa5a5('0x15')]('mandatoryDisposition',_0x184652);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ccdb212..f6e10d9 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 _0x2d27=['limit','count','offset','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','stack','name','index','mandatoryDispositionPause','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','findAll','show','params','Pause','keys','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','Disposition','getDispositions','findOne','FaxAccountId','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','send','getApplications','context','from-voip-provider','system','description','priority','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','transaction','VoiceExtension','updateAccountApplications','createdAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','updatedAt','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','out','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined'];(function(_0x6e1c0d,_0x29b425){var _0x5c3ac4=function(_0x82b35f){while(--_0x82b35f){_0x6e1c0d['push'](_0x6e1c0d['shift']());}};_0x5c3ac4(++_0x29b425);}(_0x2d27,0x15d));var _0x72d2=function(_0x5651ef,_0x4fd99a){_0x5651ef=_0x5651ef-0x0;var _0x392fba=_0x2d27[_0x5651ef];return _0x392fba;};'use strict';var emlformat=require(_0x72d2('0x0'));var rimraf=require(_0x72d2('0x1'));var zipdir=require(_0x72d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x72d2('0x3'));var moment=require(_0x72d2('0x4'));var BPromise=require(_0x72d2('0x5'));var Mustache=require(_0x72d2('0x6'));var util=require('util');var path=require(_0x72d2('0x7'));var sox=require(_0x72d2('0x8'));var csv=require(_0x72d2('0x9'));var ejs=require(_0x72d2('0xa'));var fs=require('fs');var fs_extra=require(_0x72d2('0xb'));var _=require(_0x72d2('0xc'));var squel=require(_0x72d2('0xd'));var crypto=require(_0x72d2('0xe'));var jsforce=require(_0x72d2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x72d2('0x10'));var Papa=require(_0x72d2('0x11'));var Redis=require(_0x72d2('0x12'));var authService=require(_0x72d2('0x13'));var qs=require(_0x72d2('0x14'));var as=require(_0x72d2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72d2('0x16'))(_0x72d2('0x17'));var utils=require(_0x72d2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x72d2('0x19'))['db'];config[_0x72d2('0x1a')]=_[_0x72d2('0x1b')](config[_0x72d2('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x72d2('0x1c'))(new Redis(config['redis']));require(_0x72d2('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x72d2('0x1e')][_0x72d2('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f3fa2,_0x20b549,_0x4dcd7a,_0x1ff805){return new BPromise(function(_0x38000b,_0xc2a141){var _0x4335c1=_0x1ff805||client;return _0x4335c1['request'](_0x3f3fa2,_0x4dcd7a)[_0x72d2('0x20')](function(_0x3e35c6){logger[_0x72d2('0x21')](_0x72d2('0x22'),_0x20b549,_0x72d2('0x23'));logger[_0x72d2('0x24')](_0x72d2('0x25'),_0x20b549,_0x72d2('0x23'),JSON[_0x72d2('0x26')](_0x3e35c6));if(_0x3e35c6[_0x72d2('0x27')]){if(_0x3e35c6[_0x72d2('0x27')][_0x72d2('0x28')]===0x1f4){logger['error'](_0x72d2('0x22'),_0x20b549,_0x3e35c6[_0x72d2('0x27')][_0x72d2('0x29')]);return _0xc2a141(_0x3e35c6[_0x72d2('0x27')]['message']);}logger[_0x72d2('0x27')]('FaxAccount,\x20%s,\x20%s',_0x20b549,_0x3e35c6[_0x72d2('0x27')]['message']);return _0x38000b(_0x3e35c6[_0x72d2('0x27')][_0x72d2('0x29')]);}else{logger[_0x72d2('0x21')]('FaxAccount,\x20%s,\x20%s',_0x20b549,_0x72d2('0x23'));_0x38000b(_0x3e35c6[_0x72d2('0x2a')][_0x72d2('0x29')]);}})[_0x72d2('0x2b')](function(_0x3a150f){logger[_0x72d2('0x27')](_0x72d2('0x22'),_0x20b549,_0x3a150f);_0xc2a141(_0x3a150f);});});}function respondWithStatusCode(_0x23060a,_0x15e945){_0x15e945=_0x15e945||0xcc;return function(_0x139bdc){if(_0x139bdc){return _0x23060a[_0x72d2('0x2c')](_0x15e945);}return _0x23060a['status'](_0x15e945)[_0x72d2('0x2d')]();};}function respondWithResult(_0xb2b53,_0xaad456){_0xaad456=_0xaad456||0xc8;return function(_0x69694a){if(_0x69694a){return _0xb2b53[_0x72d2('0x2e')](_0xaad456)[_0x72d2('0x2f')](_0x69694a);}};}function respondWithFilteredResult(_0x3dd5ab,_0x21b011){return function(_0x387716){if(_0x387716){var _0x51559d=typeof _0x21b011['offset']===_0x72d2('0x30')&&typeof _0x21b011[_0x72d2('0x31')]===_0x72d2('0x30');var _0x520b46=_0x387716[_0x72d2('0x32')];var _0x256aea=_0x51559d?0x0:_0x21b011[_0x72d2('0x33')];var _0x5e8bcc=_0x51559d?_0x387716['count']:_0x21b011[_0x72d2('0x33')]+_0x21b011[_0x72d2('0x31')];var _0x147f35;if(_0x5e8bcc>=_0x520b46){_0x5e8bcc=_0x520b46;_0x147f35=0xc8;}else{_0x147f35=0xce;}_0x3dd5ab[_0x72d2('0x2e')](_0x147f35);return _0x3dd5ab[_0x72d2('0x34')](_0x72d2('0x35'),_0x256aea+'-'+_0x5e8bcc+'/'+_0x520b46)[_0x72d2('0x2f')](_0x387716);}return null;};}function patchUpdates(_0x33b167){return function(_0x10a94f){try{jsonpatch['apply'](_0x10a94f,_0x33b167,!![]);}catch(_0x528820){return BPromise[_0x72d2('0x36')](_0x528820);}return _0x10a94f[_0x72d2('0x37')]();};}function saveUpdates(_0x1a8a3d,_0x11dda8){return function(_0x45e167){if(_0x45e167){return _0x45e167[_0x72d2('0x38')](_0x1a8a3d)[_0x72d2('0x20')](function(_0x42e938){return _0x42e938;});}return null;};}function removeEntity(_0x57bca9,_0x1fe7bd){return function(_0x5cd4aa){if(_0x5cd4aa){return _0x5cd4aa[_0x72d2('0x39')]()[_0x72d2('0x20')](function(){var _0x2300ed=_0x5cd4aa[_0x72d2('0x3a')]({'plain':!![]});var _0x492aea=_0x72d2('0x3b');return db['UserProfileResource'][_0x72d2('0x39')]({'where':{'type':_0x492aea,'resourceId':_0x2300ed['id']}})[_0x72d2('0x20')](function(){return _0x5cd4aa;});})[_0x72d2('0x20')](function(){_0x57bca9[_0x72d2('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22e6d6,_0x3a9694){return function(_0x3c5174){if(!_0x3c5174){_0x22e6d6[_0x72d2('0x2c')](0x194);}return _0x3c5174;};}function handleError(_0x471ff2,_0x5cc876){_0x5cc876=_0x5cc876||0x1f4;return function(_0x45376a){logger[_0x72d2('0x27')](_0x45376a[_0x72d2('0x3c')]);if(_0x45376a[_0x72d2('0x3d')]){delete _0x45376a[_0x72d2('0x3d')];}_0x471ff2[_0x72d2('0x2e')](_0x5cc876)['send'](_0x45376a);};}exports[_0x72d2('0x3e')]=function(_0x22d730,_0x3750b4){var _0x310d7d={'include':[{'model':db['Pause'],'as':_0x72d2('0x3f')}]},_0x35c75e={},_0x26756a={'count':0x0,'rows':[]};var _0x53d2bf=_[_0x72d2('0x40')](db['FaxAccount'][_0x72d2('0x41')],function(_0x583aec){return{'name':_0x583aec['fieldName'],'type':_0x583aec[_0x72d2('0x42')][_0x72d2('0x43')]};});_0x35c75e['model']=_[_0x72d2('0x40')](_0x53d2bf,_0x72d2('0x3d'));_0x35c75e[_0x72d2('0x44')]=_['keys'](_0x22d730[_0x72d2('0x44')]);_0x35c75e[_0x72d2('0x45')]=_[_0x72d2('0x46')](_0x35c75e[_0x72d2('0x47')],_0x35c75e['query']);_0x310d7d[_0x72d2('0x48')]=_[_0x72d2('0x46')](_0x35c75e['model'],qs['fields'](_0x22d730[_0x72d2('0x44')][_0x72d2('0x49')]));_0x310d7d['attributes']=_0x310d7d[_0x72d2('0x48')][_0x72d2('0x4a')]?_0x310d7d[_0x72d2('0x48')]:_0x35c75e[_0x72d2('0x47')];if(!_0x22d730[_0x72d2('0x44')][_0x72d2('0x4b')](_0x72d2('0x4c'))){_0x310d7d[_0x72d2('0x31')]=qs[_0x72d2('0x31')](_0x22d730[_0x72d2('0x44')][_0x72d2('0x31')]);_0x310d7d[_0x72d2('0x33')]=qs[_0x72d2('0x33')](_0x22d730[_0x72d2('0x44')]['offset']);}_0x310d7d[_0x72d2('0x4d')]=qs[_0x72d2('0x4e')](_0x22d730[_0x72d2('0x44')]['sort']);_0x310d7d[_0x72d2('0x4f')]=qs[_0x72d2('0x45')](_[_0x72d2('0x50')](_0x22d730[_0x72d2('0x44')],_0x35c75e[_0x72d2('0x45')]),_0x53d2bf);if(_0x22d730['query'][_0x72d2('0x51')]){_0x310d7d[_0x72d2('0x4f')]=_[_0x72d2('0x52')](_0x310d7d[_0x72d2('0x4f')],{'$or':_[_0x72d2('0x40')](_0x53d2bf,function(_0x3f1562){if(_0x3f1562['type']!==_0x72d2('0x53')){var _0x56f91b={};_0x56f91b[_0x3f1562['name']]={'$like':'%'+_0x22d730[_0x72d2('0x44')]['filter']+'%'};return _0x56f91b;}})});}_0x310d7d=_['merge']({},_0x310d7d,_0x22d730[_0x72d2('0x54')]);var _0x55d98e={'where':_0x310d7d['where']};return db[_0x72d2('0x55')]['count'](_0x55d98e)[_0x72d2('0x20')](function(_0x598f3c){_0x26756a[_0x72d2('0x32')]=_0x598f3c;if(_0x22d730[_0x72d2('0x44')][_0x72d2('0x56')]){_0x310d7d[_0x72d2('0x57')]=[{'all':!![]}];}return db[_0x72d2('0x55')][_0x72d2('0x58')](_0x310d7d);})[_0x72d2('0x20')](function(_0x267664){_0x26756a['rows']=_0x267664;return _0x26756a;})[_0x72d2('0x20')](respondWithFilteredResult(_0x3750b4,_0x310d7d))[_0x72d2('0x2b')](handleError(_0x3750b4,null));};exports[_0x72d2('0x59')]=function(_0x564801,_0x12d2f0){var _0x2995fb={'raw':![],'where':{'id':_0x564801[_0x72d2('0x5a')]['id']},'include':[{'model':db[_0x72d2('0x5b')],'as':_0x72d2('0x3f')}]},_0x99fa6f={};_0x99fa6f['model']=_[_0x72d2('0x5c')](db['FaxAccount'][_0x72d2('0x41')]);_0x99fa6f[_0x72d2('0x44')]=_[_0x72d2('0x5c')](_0x564801[_0x72d2('0x44')]);_0x99fa6f[_0x72d2('0x45')]=_[_0x72d2('0x46')](_0x99fa6f['model'],_0x99fa6f[_0x72d2('0x44')]);_0x2995fb[_0x72d2('0x48')]=_[_0x72d2('0x46')](_0x99fa6f[_0x72d2('0x47')],qs['fields'](_0x564801[_0x72d2('0x44')][_0x72d2('0x49')]));_0x2995fb[_0x72d2('0x48')]=_0x2995fb[_0x72d2('0x48')][_0x72d2('0x4a')]?_0x2995fb[_0x72d2('0x48')]:_0x99fa6f['model'];if(_0x564801['query'][_0x72d2('0x56')]){_0x2995fb[_0x72d2('0x57')]=[{'all':!![]}];}_0x2995fb=_[_0x72d2('0x52')]({},_0x2995fb,_0x564801['options']);return db[_0x72d2('0x55')]['find'](_0x2995fb)[_0x72d2('0x20')](handleEntityNotFound(_0x12d2f0,null))['then'](respondWithResult(_0x12d2f0,null))['catch'](handleError(_0x12d2f0,null));};exports[_0x72d2('0x5d')]=function(_0x269b41,_0x2fa28a){return db['FaxAccount'][_0x72d2('0x5d')](_0x269b41['body'],{})['then'](function(_0x1e196d){var _0x5e75fc=_0x269b41['user'][_0x72d2('0x3a')]({'plain':!![]});if(!_0x5e75fc)throw new Error(_0x72d2('0x5e'));if(_0x5e75fc[_0x72d2('0x5f')]===_0x72d2('0x60')){var _0x1a031=_0x1e196d[_0x72d2('0x3a')]({'plain':!![]});var _0x4eb970=_0x72d2('0x3b');return db[_0x72d2('0x61')]['find']({'where':{'name':_0x4eb970,'userProfileId':_0x5e75fc['userProfileId']},'raw':!![]})[_0x72d2('0x20')](function(_0x46ce72){if(_0x46ce72&&_0x46ce72[_0x72d2('0x62')]===0x0){return db[_0x72d2('0x63')][_0x72d2('0x5d')]({'name':_0x1a031[_0x72d2('0x3d')],'resourceId':_0x1a031['id'],'type':_0x46ce72[_0x72d2('0x3d')],'sectionId':_0x46ce72['id']},{})[_0x72d2('0x20')](function(){return _0x1e196d;});}else{return _0x1e196d;}})[_0x72d2('0x2b')](function(_0x5a2baf){logger[_0x72d2('0x27')](_0x72d2('0x64'),_0x5a2baf);throw _0x5a2baf;});}return _0x1e196d;})[_0x72d2('0x20')](respondWithResult(_0x2fa28a,0xc9))['catch'](handleError(_0x2fa28a,null));};exports['update']=function(_0x3ba649,_0x2d8782){if(_0x3ba649[_0x72d2('0x65')]['id']){delete _0x3ba649[_0x72d2('0x65')]['id'];}return db[_0x72d2('0x55')][_0x72d2('0x66')]({'where':{'id':_0x3ba649[_0x72d2('0x5a')]['id']},'include':[{'model':db[_0x72d2('0x5b')],'as':_0x72d2('0x3f')}]})[_0x72d2('0x20')](handleEntityNotFound(_0x2d8782,null))['then'](saveUpdates(_0x3ba649[_0x72d2('0x65')],null))[_0x72d2('0x20')](respondWithResult(_0x2d8782,null))['catch'](handleError(_0x2d8782,null));};exports['destroy']=function(_0x481730,_0x210d77){return db[_0x72d2('0x55')]['find']({'where':{'id':_0x481730[_0x72d2('0x5a')]['id']}})['then'](handleEntityNotFound(_0x210d77,null))[_0x72d2('0x20')](removeEntity(_0x210d77,null))[_0x72d2('0x2b')](handleError(_0x210d77,null));};exports['describe']=function(_0x28e40f,_0x3c355a){return db[_0x72d2('0x55')][_0x72d2('0x67')]()['then'](respondWithResult(_0x3c355a,null))[_0x72d2('0x2b')](handleError(_0x3c355a,null));};exports['addDisposition']=function(_0x16ac5a,_0x5789e6,_0x43e570){if(_0x16ac5a[_0x72d2('0x65')]['id']){delete _0x16ac5a[_0x72d2('0x65')]['id'];}return db[_0x72d2('0x55')][_0x72d2('0x66')]({'where':{'id':_0x16ac5a[_0x72d2('0x5a')]['id']}})[_0x72d2('0x20')](handleEntityNotFound(_0x5789e6,null))['then'](function(_0x1e1c06){if(_0x1e1c06){_0x16ac5a[_0x72d2('0x65')]['FaxAccountId']=_0x1e1c06['id'];return db[_0x72d2('0x68')]['create'](_0x16ac5a[_0x72d2('0x65')]);}})[_0x72d2('0x20')](respondWithResult(_0x5789e6,null))[_0x72d2('0x2b')](handleError(_0x5789e6,null));};exports[_0x72d2('0x69')]=function(_0x541b19,_0x551edc,_0x55241d){var _0x596833={'raw':![],'where':{}};var _0x127c31={};var _0x489711={'count':0x0,'rows':[]};return db[_0x72d2('0x55')][_0x72d2('0x6a')]({'where':{'id':_0x541b19['params']['id']}})[_0x72d2('0x20')](handleEntityNotFound(_0x551edc,null))[_0x72d2('0x20')](function(_0x529063){if(_0x529063){_0x127c31[_0x72d2('0x47')]=_['keys'](db['Disposition'][_0x72d2('0x41')]);_0x127c31[_0x72d2('0x44')]=_[_0x72d2('0x5c')](_0x541b19[_0x72d2('0x44')]);_0x127c31['filters']=_[_0x72d2('0x46')](_0x127c31['model'],_0x127c31[_0x72d2('0x44')]);_0x596833['attributes']=_['intersection'](_0x127c31[_0x72d2('0x47')],qs[_0x72d2('0x49')](_0x541b19[_0x72d2('0x44')][_0x72d2('0x49')]));_0x596833[_0x72d2('0x48')]=_0x596833[_0x72d2('0x48')]['length']?_0x596833['attributes']:_0x127c31['model'];if(!_0x541b19['query'][_0x72d2('0x4b')](_0x72d2('0x4c'))){_0x596833[_0x72d2('0x31')]=qs[_0x72d2('0x31')](_0x541b19['query'][_0x72d2('0x31')]);_0x596833['offset']=qs[_0x72d2('0x33')](_0x541b19[_0x72d2('0x44')][_0x72d2('0x33')]);}_0x596833[_0x72d2('0x4d')]=qs[_0x72d2('0x4e')](_0x541b19[_0x72d2('0x44')][_0x72d2('0x4e')]);_0x596833['where']=qs['filters'](_[_0x72d2('0x50')](_0x541b19[_0x72d2('0x44')],_0x127c31[_0x72d2('0x45')]));_0x596833[_0x72d2('0x4f')][_0x72d2('0x6b')]=_0x529063['id'];if(_0x541b19[_0x72d2('0x44')][_0x72d2('0x51')]){_0x596833['where']=_['merge'](_0x596833[_0x72d2('0x4f')],{'$or':_[_0x72d2('0x40')](_0x596833[_0x72d2('0x48')],function(_0x26107d){var _0x4cd0f1={};_0x4cd0f1[_0x26107d]={'$like':'%'+_0x541b19['query'][_0x72d2('0x51')]+'%'};return _0x4cd0f1;})});}_0x596833=_[_0x72d2('0x52')]({},_0x596833,_0x541b19['options']);return db['Disposition']['count']({'where':_0x596833[_0x72d2('0x4f')]})['then'](function(_0x10508e){_0x489711[_0x72d2('0x32')]=_0x10508e;if(_0x541b19[_0x72d2('0x44')][_0x72d2('0x56')]){_0x596833[_0x72d2('0x57')]=[{'all':!![]}];}return db[_0x72d2('0x68')][_0x72d2('0x58')](_0x596833);})[_0x72d2('0x20')](function(_0x2d820b){_0x489711[_0x72d2('0x6c')]=_0x2d820b;return _0x489711;});}})['then'](respondWithFilteredResult(_0x551edc,_0x596833))[_0x72d2('0x2b')](handleError(_0x551edc,null));};exports[_0x72d2('0x6d')]=function(_0x178bbf,_0x1dc5e8,_0x28fea8){return db[_0x72d2('0x55')]['find']({'where':{'id':_0x178bbf[_0x72d2('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1dc5e8,null))['then'](function(_0x3b794b){if(_0x3b794b){return _0x3b794b['removeDispositions'](_0x178bbf[_0x72d2('0x44')][_0x72d2('0x6e')]);}})[_0x72d2('0x20')](respondWithStatusCode(_0x1dc5e8,null))[_0x72d2('0x2b')](handleError(_0x1dc5e8,null));};exports[_0x72d2('0x6f')]=function(_0x3b244a,_0x189a5a,_0x47650f){if(_0x3b244a[_0x72d2('0x65')]['id']){delete _0x3b244a[_0x72d2('0x65')]['id'];}return db['FaxAccount'][_0x72d2('0x66')]({'where':{'id':_0x3b244a[_0x72d2('0x5a')]['id']}})[_0x72d2('0x20')](handleEntityNotFound(_0x189a5a,null))['then'](function(_0x105d02){if(_0x105d02){_0x3b244a[_0x72d2('0x65')][_0x72d2('0x6b')]=_0x105d02['id'];return db['CannedAnswer'][_0x72d2('0x5d')](_0x3b244a[_0x72d2('0x65')]);}})[_0x72d2('0x20')](respondWithResult(_0x189a5a,null))[_0x72d2('0x2b')](handleError(_0x189a5a,null));};exports[_0x72d2('0x70')]=function(_0x332a81,_0x43914f,_0x5e2064){var _0x1b049d={'raw':![],'where':{}};var _0x2e25ab={};var _0x5065b8={'count':0x0,'rows':[]};return db[_0x72d2('0x55')][_0x72d2('0x6a')]({'where':{'id':_0x332a81[_0x72d2('0x5a')]['id']}})['then'](handleEntityNotFound(_0x43914f,null))[_0x72d2('0x20')](function(_0x1f74d7){if(_0x1f74d7){_0x2e25ab[_0x72d2('0x47')]=_[_0x72d2('0x5c')](db[_0x72d2('0x71')][_0x72d2('0x41')]);_0x2e25ab[_0x72d2('0x44')]=_['keys'](_0x332a81[_0x72d2('0x44')]);_0x2e25ab[_0x72d2('0x45')]=_[_0x72d2('0x46')](_0x2e25ab[_0x72d2('0x47')],_0x2e25ab['query']);_0x1b049d[_0x72d2('0x48')]=_['intersection'](_0x2e25ab[_0x72d2('0x47')],qs[_0x72d2('0x49')](_0x332a81[_0x72d2('0x44')][_0x72d2('0x49')]));_0x1b049d[_0x72d2('0x48')]=_0x1b049d['attributes'][_0x72d2('0x4a')]?_0x1b049d['attributes']:_0x2e25ab[_0x72d2('0x47')];if(!_0x332a81['query'][_0x72d2('0x4b')](_0x72d2('0x4c'))){_0x1b049d[_0x72d2('0x31')]=qs['limit'](_0x332a81[_0x72d2('0x44')][_0x72d2('0x31')]);_0x1b049d[_0x72d2('0x33')]=qs[_0x72d2('0x33')](_0x332a81[_0x72d2('0x44')][_0x72d2('0x33')]);}_0x1b049d[_0x72d2('0x4d')]=qs[_0x72d2('0x4e')](_0x332a81[_0x72d2('0x44')][_0x72d2('0x4e')]);_0x1b049d['where']=qs[_0x72d2('0x45')](_['pick'](_0x332a81[_0x72d2('0x44')],_0x2e25ab[_0x72d2('0x45')]));_0x1b049d['where'][_0x72d2('0x6b')]=_0x1f74d7['id'];if(_0x332a81[_0x72d2('0x44')][_0x72d2('0x51')]){_0x1b049d[_0x72d2('0x4f')]=_[_0x72d2('0x52')](_0x1b049d['where'],{'$or':_[_0x72d2('0x40')](_0x1b049d[_0x72d2('0x48')],function(_0x554468){var _0x4f5880={};_0x4f5880[_0x554468]={'$like':'%'+_0x332a81['query'][_0x72d2('0x51')]+'%'};return _0x4f5880;})});}_0x1b049d=_['merge']({},_0x1b049d,_0x332a81['options']);return db[_0x72d2('0x71')][_0x72d2('0x32')]({'where':_0x1b049d[_0x72d2('0x4f')]})[_0x72d2('0x20')](function(_0x901695){_0x5065b8[_0x72d2('0x32')]=_0x901695;if(_0x332a81[_0x72d2('0x44')][_0x72d2('0x56')]){_0x1b049d[_0x72d2('0x57')]=[{'all':!![]}];}return db[_0x72d2('0x71')]['findAll'](_0x1b049d);})[_0x72d2('0x20')](function(_0x198618){_0x5065b8[_0x72d2('0x6c')]=_0x198618;return _0x5065b8;});}})[_0x72d2('0x20')](respondWithFilteredResult(_0x43914f,_0x1b049d))[_0x72d2('0x2b')](handleError(_0x43914f,null));};exports[_0x72d2('0x72')]=function(_0x3f6692,_0x1e79ac,_0xbe2b21){return db[_0x72d2('0x55')][_0x72d2('0x66')]({'where':{'id':_0x3f6692['params']['id']}})[_0x72d2('0x20')](handleEntityNotFound(_0x1e79ac,null))['then'](function(_0x8cabc2){if(_0x8cabc2){return _0x8cabc2[_0x72d2('0x72')](_0x3f6692[_0x72d2('0x44')][_0x72d2('0x6e')]);}})[_0x72d2('0x20')](respondWithStatusCode(_0x1e79ac,null))[_0x72d2('0x2b')](handleError(_0x1e79ac,null));};exports[_0x72d2('0x73')]=function(_0x5c0b78,_0x55689f,_0x10807c){return db[_0x72d2('0x74')][_0x72d2('0x66')]({'where':{'id':_0x5c0b78['params']['id']}})[_0x72d2('0x20')](handleEntityNotFound(_0x55689f,null))[_0x72d2('0x20')](function(_0x27e0f2){if(_0x27e0f2){return _0x27e0f2[_0x72d2('0x73')](_0x5c0b78[_0x72d2('0x65')][_0x72d2('0x6e')],_[_0x72d2('0x75')](_0x5c0b78['body'],[_0x72d2('0x6e'),'id'])||{});}})[_0x72d2('0x20')](respondWithResult(_0x55689f,null))[_0x72d2('0x2b')](handleError(_0x55689f,null));};exports[_0x72d2('0x76')]=function(_0x12304c,_0x491c25,_0x1e9265){var _0x4e9526={'raw':![],'where':{}};var _0x13e962={};var _0x134e00={'count':0x0,'rows':[]};return db[_0x72d2('0x55')]['findOne']({'where':{'id':_0x12304c[_0x72d2('0x5a')]['id']}})['then'](handleEntityNotFound(_0x491c25,null))[_0x72d2('0x20')](function(_0xec1518){if(_0xec1518){_0x13e962[_0x72d2('0x47')]=_['keys'](db[_0x72d2('0x74')]['rawAttributes']);_0x13e962[_0x72d2('0x44')]=_[_0x72d2('0x5c')](_0x12304c[_0x72d2('0x44')]);_0x13e962[_0x72d2('0x45')]=_['intersection'](_0x13e962[_0x72d2('0x47')],_0x13e962[_0x72d2('0x44')]);_0x4e9526[_0x72d2('0x48')]=_[_0x72d2('0x46')](_0x13e962[_0x72d2('0x47')],qs[_0x72d2('0x49')](_0x12304c[_0x72d2('0x44')][_0x72d2('0x49')]));_0x4e9526[_0x72d2('0x48')]=_0x4e9526[_0x72d2('0x48')]['length']?_0x4e9526['attributes']:_0x13e962['model'];if(!_0x12304c['query'][_0x72d2('0x4b')](_0x72d2('0x4c'))){_0x4e9526['limit']=qs[_0x72d2('0x31')](_0x12304c[_0x72d2('0x44')]['limit']);_0x4e9526[_0x72d2('0x33')]=qs[_0x72d2('0x33')](_0x12304c[_0x72d2('0x44')][_0x72d2('0x33')]);}_0x4e9526['order']=qs[_0x72d2('0x4e')](_0x12304c[_0x72d2('0x44')][_0x72d2('0x4e')]);_0x4e9526[_0x72d2('0x4f')]=qs[_0x72d2('0x45')](_['pick'](_0x12304c[_0x72d2('0x44')],_0x13e962[_0x72d2('0x45')]));_0x4e9526[_0x72d2('0x4f')][_0x72d2('0x6b')]=_0xec1518['id'];if(_0x12304c[_0x72d2('0x44')][_0x72d2('0x51')]){_0x4e9526[_0x72d2('0x4f')]=_[_0x72d2('0x52')](_0x4e9526[_0x72d2('0x4f')],{'$or':_['map'](_0x4e9526[_0x72d2('0x48')],function(_0x595dcf){var _0x203a91={};_0x203a91[_0x595dcf]={'$like':'%'+_0x12304c[_0x72d2('0x44')][_0x72d2('0x51')]+'%'};return _0x203a91;})});}_0x4e9526=_[_0x72d2('0x52')]({},_0x4e9526,_0x12304c[_0x72d2('0x54')]);return db[_0x72d2('0x74')][_0x72d2('0x32')]({'where':_0x4e9526[_0x72d2('0x4f')]})['then'](function(_0x2be696){_0x134e00[_0x72d2('0x32')]=_0x2be696;if(_0x12304c[_0x72d2('0x44')][_0x72d2('0x56')]){_0x4e9526['include']=[{'model':db[_0x72d2('0x77')],'as':_0x72d2('0x78'),'required':![]},{'model':db[_0x72d2('0x79')],'as':_0x72d2('0x7a'),'attributes':['name',_0x72d2('0x7b'),_0x72d2('0x7c')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x72d2('0x3d'),_0x72d2('0x7d')],'where':_0x12304c[_0x72d2('0x44')][_0x72d2('0x7e')]?{'id':_0x12304c[_0x72d2('0x44')][_0x72d2('0x7e')]}:undefined,'required':_0x12304c[_0x72d2('0x44')][_0x72d2('0x7e')]?!![]:![]}];}return db[_0x72d2('0x74')][_0x72d2('0x58')](_0x4e9526);})[_0x72d2('0x20')](function(_0x3e560a){_0x134e00[_0x72d2('0x6c')]=_0x3e560a;return _0x134e00;});}})[_0x72d2('0x20')](respondWithFilteredResult(_0x491c25,_0x4e9526))['catch'](handleError(_0x491c25,null));};exports[_0x72d2('0x7f')]=function(_0x225465,_0x35b0ef){var _0x120465=_0x225465[_0x72d2('0x5a')]['id'];var _0x52686d=_0x225465[_0x72d2('0x65')];var _0x2691f0=0xc8;var _0x11b010=null;return db[_0x72d2('0x80')]['transaction']({'isolationLevel':db[_0x72d2('0x80')][_0x72d2('0x81')][_0x72d2('0x82')]['READ_COMMITTED']},function(_0x4a0248){return db['FaxAccount'][_0x72d2('0x6a')]({'where':{'id':_0x120465},'transaction':_0x4a0248})[_0x72d2('0x20')](function(_0x255ed4){if(_0x255ed4){return db[_0x72d2('0x83')][_0x72d2('0x39')]({'where':{'FaxAccountId':_0x120465},'transaction':_0x4a0248})[_0x72d2('0x20')](function(){var _0x42b835=_[_0x72d2('0x40')](_0x52686d,function(_0x10e77d){_0x10e77d[_0x72d2('0x6b')]=_0x120465;return _0x10e77d;});return db[_0x72d2('0x83')][_0x72d2('0x84')](_0x42b835,{'transaction':_0x4a0248});});}else{_0x2691f0=0x194;_0x11b010=[];}});})[_0x72d2('0x20')](function(){if(_0x2691f0!==0x194){return db[_0x72d2('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x120465},'order':'priority'})[_0x72d2('0x20')](function(_0x55ce40){_0x11b010=_0x55ce40;});}})['catch'](function(_0x4f1b3e){_0x2691f0=0x1f4;logger[_0x72d2('0x27')](_0x4f1b3e[_0x72d2('0x3c')]);if(_0x4f1b3e['name']){delete _0x4f1b3e[_0x72d2('0x3d')];}_0x11b010=_0x4f1b3e;})['finally'](function(){if(_0x11b010===null){_0x35b0ef[_0x72d2('0x2c')](_0x2691f0);}else{if(_0x2691f0===0x1f4){_0x35b0ef[_0x72d2('0x2e')](_0x2691f0)[_0x72d2('0x85')](_0x11b010);}else{_0x35b0ef[_0x72d2('0x2e')](_0x2691f0)[_0x72d2('0x2f')](_0x11b010);}}});};exports[_0x72d2('0x86')]=function(_0x405cdf,_0x2ad045,_0x3331d8){var _0x44b5af={};var _0xc12093={};var _0x224a2b;var _0x211a94;return db[_0x72d2('0x55')][_0x72d2('0x6a')]({'where':{'id':_0x405cdf[_0x72d2('0x5a')]['id']}})[_0x72d2('0x20')](handleEntityNotFound(_0x2ad045,null))['then'](function(_0x128d25){if(_0x128d25){_0x224a2b=_0x128d25;_0xc12093[_0x72d2('0x47')]=_[_0x72d2('0x5c')](db[_0x72d2('0x83')][_0x72d2('0x41')]);_0xc12093[_0x72d2('0x44')]=_[_0x72d2('0x5c')](_0x405cdf[_0x72d2('0x44')]);_0xc12093[_0x72d2('0x45')]=_[_0x72d2('0x46')](_0xc12093[_0x72d2('0x47')],_0xc12093[_0x72d2('0x44')]);_0x44b5af['attributes']=_[_0x72d2('0x46')](_0xc12093[_0x72d2('0x47')],qs['fields'](_0x405cdf[_0x72d2('0x44')]['fields']));_0x44b5af[_0x72d2('0x48')]=_0x44b5af[_0x72d2('0x48')][_0x72d2('0x4a')]?_0x44b5af[_0x72d2('0x48')]:_0xc12093[_0x72d2('0x47')];_0x44b5af[_0x72d2('0x4d')]=qs['sort'](_0x405cdf[_0x72d2('0x44')][_0x72d2('0x4e')]);_0x44b5af[_0x72d2('0x4f')]=qs[_0x72d2('0x45')](_[_0x72d2('0x50')](_0x405cdf[_0x72d2('0x44')],_0xc12093[_0x72d2('0x45')]));if(_0x405cdf['query']['filter']){_0x44b5af['where']=_['merge'](_0x44b5af[_0x72d2('0x4f')],{'$or':_[_0x72d2('0x40')](_0x44b5af['attributes'],function(_0xff72a4){var _0x6aa169={};_0x6aa169[_0xff72a4]={'$like':'%'+_0x405cdf[_0x72d2('0x44')][_0x72d2('0x51')]+'%'};return _0x6aa169;})});}_0x44b5af=_[_0x72d2('0x52')]({},_0x44b5af,_0x405cdf['options']);return _0x224a2b['getApplications'](_0x44b5af);}})[_0x72d2('0x20')](function(_0x582bd8){if(_0x582bd8){_0x211a94=_0x582bd8[_0x72d2('0x4a')];if(!_0x405cdf['query']['hasOwnProperty'](_0x72d2('0x4c'))){_0x44b5af[_0x72d2('0x31')]=qs[_0x72d2('0x31')](_0x405cdf[_0x72d2('0x44')]['limit']);_0x44b5af[_0x72d2('0x33')]=qs[_0x72d2('0x33')](_0x405cdf['query'][_0x72d2('0x33')]);}return _0x224a2b['getApplications'](_0x44b5af);}})[_0x72d2('0x20')](function(_0x5e5de5){if(_0x5e5de5){return _0x5e5de5?{'count':_0x211a94,'rows':_0x5e5de5}:null;}})[_0x72d2('0x20')](respondWithResult(_0x2ad045,null))[_0x72d2('0x2b')](handleError(_0x2ad045,null));};function Extension(_0x14a4e7,_0xbad2a7,_0x3c14af,_0x379a72){this[_0x72d2('0x87')]=_0x72d2('0x88');this['exten']=_0x14a4e7['localstationid'];this['app']=_0x379a72;this[_0x72d2('0x42')]=_0x72d2('0x89');this[_0x72d2('0x8a')]='Fax\x20Extension';this[_0x72d2('0x6b')]=_0x14a4e7['id'];this[_0x72d2('0x8b')]=_0xbad2a7;this[_0x72d2('0x8c')]=_0x3c14af;}function createExtensionsReciveFax(_0x434e83){var _0x25593e=0x1;var _0x45b52b=[];_0x45b52b['push'](new Extension(_0x434e83,_0x25593e,'',_0x72d2('0x8d')));_0x25593e+=0x1;_0x45b52b[_0x72d2('0x8e')](new Extension(_0x434e83,_0x25593e,_0x72d2('0x8f'),_0x72d2('0x90')));_0x25593e+=0x1;for(var _0x4c0b80 in _0x434e83){if(_0x434e83[_0x72d2('0x4b')](_0x4c0b80)&&(_0x4c0b80===_0x72d2('0x91')||_0x4c0b80===_0x72d2('0x92')||_0x4c0b80===_0x72d2('0x93')||_0x4c0b80===_0x72d2('0x94')||_0x4c0b80===_0x72d2('0x95')||_0x4c0b80===_0x72d2('0x96')||_0x4c0b80===_0x72d2('0x97')||_0x4c0b80===_0x72d2('0x98')||_0x4c0b80==='t38timeout')){_0x45b52b[_0x72d2('0x8e')](new Extension(_0x434e83,_0x25593e,_0x72d2('0x99')+_0x4c0b80+')='+_0x434e83[_0x4c0b80],_0x72d2('0x90')));_0x25593e+=0x1;}}_0x45b52b['push'](new Extension(_0x434e83,_0x25593e,'6','Wait'));_0x25593e+=0x1;_0x45b52b[_0x72d2('0x8e')](new Extension(_0x434e83,_0x25593e,_0x72d2('0x9a'),_0x72d2('0x9b')));_0x25593e=0x0;return _0x45b52b;}exports['addAccountApplications']=function(_0x3d11dc,_0x295ea0,_0x2ea3de){var _0x3b320f;return db[_0x72d2('0x80')][_0x72d2('0x9c')](function(_0x8c63e6){return db[_0x72d2('0x55')]['create'](_0x3d11dc[_0x72d2('0x65')],{'transaction':_0x8c63e6})[_0x72d2('0x20')](function(_0x50427c){_0x3b320f=_0x50427c[_0x72d2('0x3a')]({'plain':!![]});return db[_0x72d2('0x9d')]['bulkCreate'](createExtensionsReciveFax(_0x3b320f),{'transaction':_0x8c63e6});});})[_0x72d2('0x20')](function(){return _0x3b320f;})[_0x72d2('0x20')](respondWithResult(_0x295ea0,null))[_0x72d2('0x2b')](handleError(_0x295ea0,null));};exports[_0x72d2('0x9e')]=function(_0x33c596,_0x3c6224,_0x2ab291){var _0x27dbab;return db[_0x72d2('0x80')][_0x72d2('0x9c')](function(_0x465f20){return db['FaxAccount'][_0x72d2('0x38')](_0x33c596[_0x72d2('0x65')],{'where':{'id':_0x33c596['body']['id']},'transaction':_0x465f20})[_0x72d2('0x20')](function(_0x1c5e9f){return db[_0x72d2('0x9d')][_0x72d2('0x39')]({'where':{'FaxAccountId':_0x33c596[_0x72d2('0x65')]['id']},'transaction':_0x465f20})[_0x72d2('0x20')](function(_0x3ab383){return db[_0x72d2('0x9d')][_0x72d2('0x84')](createExtensionsReciveFax(_[_0x72d2('0x75')](_0x33c596[_0x72d2('0x65')],['tech',_0x72d2('0x43'),_0x72d2('0x9f'),'updatedAt',_0x72d2('0xa0'),_0x72d2('0xa1')])),{'transaction':_0x465f20});});});})[_0x72d2('0x20')](function(){return db['FaxAccount'][_0x72d2('0xa2')](_0x33c596['body']['id']);})['then'](respondWithResult(_0x3c6224,null))[_0x72d2('0x2b')](handleError(_0x3c6224,null));};exports[_0x72d2('0xa3')]=function(_0x2eaa6e,_0x1655e7,_0x2f7786){var _0x58447c={'raw':!![],'where':{}};var _0x304f43={};var _0x59690a={'count':0x0,'rows':[]};return db['FaxAccount'][_0x72d2('0x6a')]({'where':{'id':_0x2eaa6e[_0x72d2('0x5a')]['id']}})[_0x72d2('0x20')](handleEntityNotFound(_0x1655e7,null))['then'](function(_0x2ed6da){if(_0x2ed6da){_0x304f43[_0x72d2('0x47')]=_[_0x72d2('0x5c')](db['FaxMessage']['rawAttributes']);_0x304f43[_0x72d2('0x44')]=_[_0x72d2('0x5c')](_0x2eaa6e['query']);_0x304f43[_0x72d2('0x45')]=_[_0x72d2('0x46')](_0x304f43[_0x72d2('0x47')],_0x304f43[_0x72d2('0x44')]);_0x58447c[_0x72d2('0x48')]=_[_0x72d2('0x46')](_0x304f43['model'],qs[_0x72d2('0x49')](_0x2eaa6e[_0x72d2('0x44')]['fields']));_0x58447c[_0x72d2('0x48')]=_0x58447c[_0x72d2('0x48')][_0x72d2('0x4a')]?_0x58447c['attributes']:_0x304f43[_0x72d2('0x47')];if(!_0x2eaa6e['query'][_0x72d2('0x4b')](_0x72d2('0x4c'))){_0x58447c[_0x72d2('0x31')]=qs[_0x72d2('0x31')](_0x2eaa6e[_0x72d2('0x44')][_0x72d2('0x31')]);_0x58447c[_0x72d2('0x33')]=qs[_0x72d2('0x33')](_0x2eaa6e[_0x72d2('0x44')][_0x72d2('0x33')]);}_0x58447c[_0x72d2('0x4d')]=qs['sort'](_0x2eaa6e['query']['sort']);_0x58447c[_0x72d2('0x4f')]=qs[_0x72d2('0x45')](_[_0x72d2('0x50')](_0x2eaa6e[_0x72d2('0x44')],_0x304f43[_0x72d2('0x45')]));_0x58447c[_0x72d2('0x4f')][_0x72d2('0x6b')]=_0x2ed6da['id'];if(_0x2eaa6e['query'][_0x72d2('0x51')]){_0x58447c[_0x72d2('0x4f')]=_['merge'](_0x58447c[_0x72d2('0x4f')],{'$or':_[_0x72d2('0x40')](_0x58447c['attributes'],function(_0x3d896d){var _0x542bef={};_0x542bef[_0x3d896d]={'$like':'%'+_0x2eaa6e[_0x72d2('0x44')]['filter']+'%'};return _0x542bef;})});}if(_0x2eaa6e[_0x72d2('0x44')][_0x72d2('0xa4')]){var _0x3ac45a=_0x2eaa6e[_0x72d2('0x44')][_0x72d2('0xa4')][_0x72d2('0xa5')](',');var _0x1e654c={};_0x1e654c[_0x3ac45a[0x0]]={'$gte':moment(_0x3ac45a[0x1])[_0x72d2('0xa6')](_0x72d2('0xa7'))};_0x58447c[_0x72d2('0x4f')]=_['merge'](_0x58447c[_0x72d2('0x4f')],_0x1e654c);}_0x58447c=_[_0x72d2('0x52')]({},_0x58447c,_0x2eaa6e['options']);return db[_0x72d2('0xa8')]['count']({'where':_0x58447c['where']})[_0x72d2('0x20')](function(_0x4aae0b){_0x59690a[_0x72d2('0x32')]=_0x4aae0b;if(_0x2eaa6e[_0x72d2('0x44')][_0x72d2('0x56')]){_0x58447c[_0x72d2('0x57')]=[{'all':!![]}];}return db[_0x72d2('0xa8')][_0x72d2('0x58')](_0x58447c);})[_0x72d2('0x20')](function(_0x1182aa){_0x59690a[_0x72d2('0x6c')]=_0x1182aa;return _0x59690a;});}})['then'](respondWithFilteredResult(_0x1655e7,_0x58447c))[_0x72d2('0x2b')](handleError(_0x1655e7,null));};exports[_0x72d2('0x85')]=function(_0x1b8fe0,_0x445be7,_0x1cf9cb){var _0x2ff20c,_0x3136f8={},_0x1ab99b;if(_0x1b8fe0[_0x72d2('0x65')]['to']){_0x1ab99b=_0x1b8fe0[_0x72d2('0x65')]['to'][0x0];}return db[_0x72d2('0x55')][_0x72d2('0x66')]({'where':{'id':_0x1b8fe0[_0x72d2('0x5a')]['id']},'include':[{'model':db[_0x72d2('0xa9')],'as':_0x72d2('0xaa'),'include':[{'model':db[_0x72d2('0x77')],'as':'Contacts','where':{'fax':_0x1ab99b},'limit':0x1,'order':[[_0x72d2('0xab'),'DESC']]}]}]})[_0x72d2('0x20')](handleEntityNotFound(_0x445be7,null))[_0x72d2('0x20')](function(_0x214925){_0x2ff20c=_0x214925;if(_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xac')]&&_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xac')][_0x72d2('0x4a')]){for(var _0x122104=0x0;_0x122104<_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xac')][_0x72d2('0x4a')];_0x122104+=0x1){_0x1b8fe0['body'][_0x72d2('0xac')][_0x122104]={'filename':_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xac')][_0x122104][_0x72d2('0x3d')],'id':_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xac')][_0x122104]['id'],'path':path[_0x72d2('0xad')](config[_0x72d2('0xae')],'server/files/attachments',_0x1b8fe0['body'][_0x72d2('0xac')][_0x122104][_0x72d2('0xaf')])};}}return respondWithRpcPromise(_0x72d2('0xb0'),_0x72d2('0xb0'),{'FaxAccountId':_[_0x72d2('0xb1')](_0x1b8fe0[_0x72d2('0x5a')]['id'])?undefined:_0x1b8fe0[_0x72d2('0x5a')]['id'],'path':_['isNil'](_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xac')][0x0][_0x72d2('0x7')])?undefined:_0x1b8fe0['body'][_0x72d2('0xac')][0x0][_0x72d2('0x7')],'fax':_[_0x72d2('0xb1')](_0x1b8fe0[_0x72d2('0x65')]['to'][0x0])?undefined:_0x1b8fe0[_0x72d2('0x65')]['to'][0x0]},client9002);})[_0x72d2('0x20')](function(){if(_0x2ff20c){if(_[_0x72d2('0xb1')](_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xb2')])){_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xb2')]=util['format'](_0x72d2('0xb3'),_0x2ff20c[_0x72d2('0x3d')],_0x2ff20c[_0x72d2('0xb4')]);}if(_0x2ff20c[_0x72d2('0xaa')]){if(_0x2ff20c[_0x72d2('0xaa')][_0x72d2('0xb5')][_0x72d2('0x4a')]){return _0x2ff20c[_0x72d2('0xaa')][_0x72d2('0xb5')][0x0];}else{return db[_0x72d2('0x77')][_0x72d2('0x5d')](_[_0x72d2('0x1b')](_0x1b8fe0['body'],{'firstName':_0x1b8fe0[_0x72d2('0x65')]['to'][0x0],'phone':_0x1b8fe0[_0x72d2('0x65')]['to'][0x0],'fax':_0x1b8fe0['body']['to'][0x0],'ListId':_0x2ff20c[_0x72d2('0xa1')]}));}}else{throw new Error(_0x72d2('0xb6'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x208a0d){if(_0x208a0d){return db[_0x72d2('0x74')][_0x72d2('0x66')]({'where':{'ContactId':_0x208a0d['id'],'closed':![],'FaxAccountId':_0x2ff20c['id']}})['then'](function(_0x256e96){if(_0x256e96){return[_0x256e96,![]];}return db['FaxInteraction'][_0x72d2('0x5d')]({'UserId':_0x1b8fe0[_0x72d2('0x60')]['id'],'ContactId':_0x208a0d['id'],'FaxAccountId':_0x2ff20c['id'],'fax':_0x1b8fe0[_0x72d2('0x65')]['to'][0x0],'firstMsgDirection':_0x72d2('0xb7'),'Messages':[_[_0x72d2('0x52')](_0x1b8fe0[_0x72d2('0x65')],{'read':![],'body':_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xac')][0x0][_0x72d2('0xb8')],'FaxAccountId':_0x2ff20c['id'],'UserId':_0x1b8fe0[_0x72d2('0x60')]['id'],'ContactId':_0x208a0d['id'],'AttachmentId':_0x1b8fe0['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x72d2('0xa8')],'as':'Messages'}]})[_0x72d2('0x20')](function(_0x2f6521){return[_0x2f6521,!![]];});});}else{throw new Error(_0x72d2('0xb9'));}})['spread'](function(_0x4f9e3b,_0x3ae3bd){if(_0x3ae3bd){return _0x4f9e3b;}return db[_0x72d2('0xa8')][_0x72d2('0x5d')]({'direction':_0x72d2('0xb7'),'read':![],'body':_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xac')][0x0]['filename'],'FaxAccountId':_0x2ff20c['id'],'FaxInteractionId':_0x4f9e3b['id'],'UserId':_0x1b8fe0[_0x72d2('0x60')]['id'],'ContactId':_0x4f9e3b[_0x72d2('0xba')],'AttachmentId':_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xac')][0x0]['id']})[_0x72d2('0x20')](function(_0x7652cf){_0x4f9e3b[_0x72d2('0xbb')][_0x72d2('0xbc')]=[];_0x4f9e3b[_0x72d2('0xbb')][_0x72d2('0xbc')][_0x72d2('0x8e')](_0x7652cf[_0x72d2('0xbb')]);return _0x4f9e3b;});})['then'](function(_0x297c71){respondWithRpcPromise('SendFax',_0x72d2('0xbd'),{'FaxAccountId':_[_0x72d2('0xb1')](_0x1b8fe0['params']['id'])?undefined:_0x1b8fe0[_0x72d2('0x5a')]['id'],'path':_['isNil'](_0x1b8fe0[_0x72d2('0x65')]['attachments'][0x0][_0x72d2('0x7')])?undefined:_0x1b8fe0[_0x72d2('0x65')]['attachments'][0x0][_0x72d2('0x7')],'fax':_['isNil'](_0x1b8fe0[_0x72d2('0x65')]['to'][0x0])?undefined:_0x1b8fe0[_0x72d2('0x65')]['to'][0x0],'AttachmentId':_0x1b8fe0[_0x72d2('0x65')][_0x72d2('0xac')][0x0]['id']},client9002)['then'](function(_0x566a54){logger[_0x72d2('0x21')](_0x72d2('0xbe'),_0x566a54);})['catch'](function(_0x1b112a){logger[_0x72d2('0x21')](_0x72d2('0xbe'),_0x1b112a);});return _0x297c71;})['then'](respondWithResult(_0x445be7,null))[_0x72d2('0x2b')](handleError(_0x445be7,null));};exports[_0x72d2('0xbf')]=function(_0x950e62,_0x310445,_0x3ceea9){return db['FaxAccount'][_0x72d2('0x66')]({'where':{'id':_0x950e62[_0x72d2('0x5a')]['id']}})[_0x72d2('0x20')](handleEntityNotFound(_0x310445,null))[_0x72d2('0x20')](function(_0x533a2a){if(_0x533a2a){return _0x533a2a[_0x72d2('0xbf')](_0x950e62[_0x72d2('0x65')][_0x72d2('0x6e')],_[_0x72d2('0x75')](_0x950e62['body'],[_0x72d2('0x6e'),'id'])||{})[_0x72d2('0xc0')](function(_0x31c04a){for(var _0x14eccb=0x0;_0x14eccb<_0x950e62['body'][_0x72d2('0x6e')][_0x72d2('0x4a')];_0x14eccb+=0x1){socket['emit'](_0x72d2('0xc1'),{'UserId':Number(_0x950e62[_0x72d2('0x65')][_0x72d2('0x6e')][_0x14eccb]),'FaxAccountId':Number(_0x950e62[_0x72d2('0x5a')]['id'])});}return _0x31c04a;});}})[_0x72d2('0x20')](respondWithResult(_0x310445,null))['catch'](handleError(_0x310445,null));};exports[_0x72d2('0xc2')]=function(_0x52d522,_0x569c20,_0x41c213){return db['FaxAccount'][_0x72d2('0x66')]({'where':{'id':_0x52d522['params']['id']}})['then'](handleEntityNotFound(_0x569c20,null))[_0x72d2('0x20')](function(_0x4a26f3){if(_0x4a26f3){return _0x4a26f3['removeAgents'](_0x52d522[_0x72d2('0x44')]['ids'])[_0x72d2('0x20')](function(){if(_[_0x72d2('0xc3')](_0x52d522['query']['ids'])){for(var _0xc2dacb=0x0;_0xc2dacb<_0x52d522[_0x72d2('0x44')][_0x72d2('0x6e')][_0x72d2('0x4a')];_0xc2dacb+=0x1){socket[_0x72d2('0xc4')](_0x72d2('0xc5'),{'UserId':Number(_0x52d522[_0x72d2('0x44')][_0x72d2('0x6e')][_0xc2dacb]),'FaxAccountId':Number(_0x52d522[_0x72d2('0x5a')]['id'])});}}else{socket[_0x72d2('0xc4')](_0x72d2('0xc5'),{'UserId':Number(_0x52d522['query'][_0x72d2('0x6e')]),'FaxAccountId':Number(_0x52d522[_0x72d2('0x5a')]['id'])});}});}})[_0x72d2('0x20')](respondWithStatusCode(_0x569c20,null))[_0x72d2('0x2b')](handleError(_0x569c20,null));};exports['getAgents']=function(_0x296830,_0x3c0477,_0x1d243d){var _0x244949={};var _0x4c26df={};var _0x4a4d8e;var _0x58045a;return db[_0x72d2('0x55')][_0x72d2('0x6a')]({'where':{'id':_0x296830[_0x72d2('0x5a')]['id']}})[_0x72d2('0x20')](handleEntityNotFound(_0x3c0477,null))[_0x72d2('0x20')](function(_0x31bedc){if(_0x31bedc){_0x4a4d8e=_0x31bedc;_0x4c26df[_0x72d2('0x47')]=_[_0x72d2('0x5c')](db[_0x72d2('0x79')][_0x72d2('0x41')]);_0x4c26df[_0x72d2('0x44')]=_['keys'](_0x296830['query']);_0x4c26df['filters']=_[_0x72d2('0x46')](_0x4c26df[_0x72d2('0x47')],_0x4c26df[_0x72d2('0x44')]);_0x244949[_0x72d2('0x48')]=_[_0x72d2('0x46')](_0x4c26df[_0x72d2('0x47')],qs['fields'](_0x296830[_0x72d2('0x44')][_0x72d2('0x49')]));_0x244949[_0x72d2('0x48')]=_0x244949[_0x72d2('0x48')][_0x72d2('0x4a')]?_0x244949[_0x72d2('0x48')]:_0x4c26df[_0x72d2('0x47')];_0x244949[_0x72d2('0x4d')]=qs[_0x72d2('0x4e')](_0x296830[_0x72d2('0x44')][_0x72d2('0x4e')]);_0x244949[_0x72d2('0x4f')]=qs['filters'](_[_0x72d2('0x50')](_0x296830[_0x72d2('0x44')],_0x4c26df[_0x72d2('0x45')]));if(_0x296830[_0x72d2('0x44')][_0x72d2('0x51')]){_0x244949[_0x72d2('0x4f')]=_[_0x72d2('0x52')](_0x244949[_0x72d2('0x4f')],{'$or':_[_0x72d2('0x40')](_0x244949[_0x72d2('0x48')],function(_0x40d807){var _0x26128c={};_0x26128c[_0x40d807]={'$like':'%'+_0x296830[_0x72d2('0x44')]['filter']+'%'};return _0x26128c;})});}_0x244949=_[_0x72d2('0x52')]({},_0x244949,_0x296830[_0x72d2('0x54')]);return _0x4a4d8e[_0x72d2('0xc6')](_0x244949);}})[_0x72d2('0x20')](function(_0x26f9fa){if(_0x26f9fa){_0x58045a=_0x26f9fa[_0x72d2('0x4a')];if(!_0x296830[_0x72d2('0x44')]['hasOwnProperty'](_0x72d2('0x4c'))){_0x244949[_0x72d2('0x31')]=qs[_0x72d2('0x31')](_0x296830[_0x72d2('0x44')][_0x72d2('0x31')]);_0x244949[_0x72d2('0x33')]=qs[_0x72d2('0x33')](_0x296830[_0x72d2('0x44')][_0x72d2('0x33')]);}return _0x4a4d8e[_0x72d2('0xc6')](_0x244949);}})[_0x72d2('0x20')](function(_0x42e6d8){if(_0x42e6d8){return _0x42e6d8?{'count':_0x58045a,'rows':_0x42e6d8}:null;}})[_0x72d2('0x20')](respondWithResult(_0x3c0477,null))[_0x72d2('0x2b')](handleError(_0x3c0477,null));}; \ No newline at end of file +var _0xc3b8=['sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','pick','removeDispositions','ids','addAnswer','getAnswers','nolimit','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','bulkCreate','updateAccountApplications','key','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','http','client','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order'];(function(_0x24780e,_0x214237){var _0x1eeba2=function(_0x3bfbda){while(--_0x3bfbda){_0x24780e['push'](_0x24780e['shift']());}};_0x1eeba2(++_0x214237);}(_0xc3b8,0x143));var _0x8c3b=function(_0x1daf63,_0x2f7c1a){_0x1daf63=_0x1daf63-0x0;var _0xf4822a=_0xc3b8[_0x1daf63];return _0xf4822a;};'use strict';var emlformat=require(_0x8c3b('0x0'));var rimraf=require(_0x8c3b('0x1'));var zipdir=require(_0x8c3b('0x2'));var jsonpatch=require(_0x8c3b('0x3'));var rp=require('request-promise');var moment=require(_0x8c3b('0x4'));var BPromise=require(_0x8c3b('0x5'));var Mustache=require(_0x8c3b('0x6'));var util=require('util');var path=require(_0x8c3b('0x7'));var sox=require('sox');var csv=require(_0x8c3b('0x8'));var ejs=require(_0x8c3b('0x9'));var fs=require('fs');var fs_extra=require(_0x8c3b('0xa'));var _=require('lodash');var squel=require(_0x8c3b('0xb'));var crypto=require(_0x8c3b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8c3b('0xd'));var toCsv=require(_0x8c3b('0x8'));var querystring=require(_0x8c3b('0xe'));var Papa=require(_0x8c3b('0xf'));var Redis=require(_0x8c3b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8c3b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c3b('0x12'))('api');var utils=require(_0x8c3b('0x13'));var config=require(_0x8c3b('0x14'));var licenseUtil=require(_0x8c3b('0x15'));var db=require(_0x8c3b('0x16'))['db'];config['redis']=_[_0x8c3b('0x17')](config[_0x8c3b('0x18')],{'host':_0x8c3b('0x19'),'port':0x18eb});var socket=require(_0x8c3b('0x1a'))(new Redis(config[_0x8c3b('0x18')]));require(_0x8c3b('0x1b'))[_0x8c3b('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8c3b('0x1d')]({'port':0x232c});var client9002=jayson[_0x8c3b('0x1e')][_0x8c3b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x157ad1,_0x29b6e1,_0x5deca2,_0xbae865){return new BPromise(function(_0xba3b3,_0x5950ae){var _0x21ae62=_0xbae865||client;return _0x21ae62['request'](_0x157ad1,_0x5deca2)[_0x8c3b('0x1f')](function(_0xe1b8c0){logger[_0x8c3b('0x20')](_0x8c3b('0x21'),_0x29b6e1,_0x8c3b('0x22'));logger[_0x8c3b('0x23')](_0x8c3b('0x24'),_0x29b6e1,_0x8c3b('0x22'),JSON['stringify'](_0xe1b8c0));if(_0xe1b8c0[_0x8c3b('0x25')]){if(_0xe1b8c0[_0x8c3b('0x25')][_0x8c3b('0x26')]===0x1f4){logger[_0x8c3b('0x25')](_0x8c3b('0x21'),_0x29b6e1,_0xe1b8c0[_0x8c3b('0x25')][_0x8c3b('0x27')]);return _0x5950ae(_0xe1b8c0['error'][_0x8c3b('0x27')]);}logger[_0x8c3b('0x25')](_0x8c3b('0x21'),_0x29b6e1,_0xe1b8c0[_0x8c3b('0x25')]['message']);return _0xba3b3(_0xe1b8c0['error'][_0x8c3b('0x27')]);}else{logger[_0x8c3b('0x20')](_0x8c3b('0x21'),_0x29b6e1,_0x8c3b('0x22'));_0xba3b3(_0xe1b8c0[_0x8c3b('0x28')][_0x8c3b('0x27')]);}})[_0x8c3b('0x29')](function(_0x1d1054){logger[_0x8c3b('0x25')](_0x8c3b('0x21'),_0x29b6e1,_0x1d1054);_0x5950ae(_0x1d1054);});});}function respondWithStatusCode(_0x530587,_0x1c25f6){_0x1c25f6=_0x1c25f6||0xcc;return function(_0x62b135){if(_0x62b135){return _0x530587['sendStatus'](_0x1c25f6);}return _0x530587['status'](_0x1c25f6)[_0x8c3b('0x2a')]();};}function respondWithResult(_0x203137,_0x2c7506){_0x2c7506=_0x2c7506||0xc8;return function(_0x29fb67){if(_0x29fb67){return _0x203137[_0x8c3b('0x2b')](_0x2c7506)[_0x8c3b('0x2c')](_0x29fb67);}};}function respondWithFilteredResult(_0x359d91,_0x3f84a9){return function(_0x52eb8d){if(_0x52eb8d){var _0x547bd3=typeof _0x3f84a9[_0x8c3b('0x2d')]===_0x8c3b('0x2e')&&typeof _0x3f84a9['limit']===_0x8c3b('0x2e');var _0x4758ed=_0x52eb8d['count'];var _0x5a393e=_0x547bd3?0x0:_0x3f84a9['offset'];var _0x3e2fba=_0x547bd3?_0x52eb8d[_0x8c3b('0x2f')]:_0x3f84a9[_0x8c3b('0x2d')]+_0x3f84a9[_0x8c3b('0x30')];var _0x2a2669;if(_0x3e2fba>=_0x4758ed){_0x3e2fba=_0x4758ed;_0x2a2669=0xc8;}else{_0x2a2669=0xce;}_0x359d91['status'](_0x2a2669);return _0x359d91['set'](_0x8c3b('0x31'),_0x5a393e+'-'+_0x3e2fba+'/'+_0x4758ed)[_0x8c3b('0x2c')](_0x52eb8d);}return null;};}function patchUpdates(_0xe464f9){return function(_0x30fcd1){try{jsonpatch[_0x8c3b('0x32')](_0x30fcd1,_0xe464f9,!![]);}catch(_0x5d74ec){return BPromise[_0x8c3b('0x33')](_0x5d74ec);}return _0x30fcd1['save']();};}function saveUpdates(_0xb914e6,_0x422b38){return function(_0x2c651f){if(_0x2c651f){return _0x2c651f[_0x8c3b('0x34')](_0xb914e6)[_0x8c3b('0x1f')](function(_0x4933be){return _0x4933be;});}return null;};}function removeEntity(_0x20a80c,_0x40bb3b){return function(_0x45e993){if(_0x45e993){return _0x45e993[_0x8c3b('0x35')]()[_0x8c3b('0x1f')](function(){var _0x16f1b1=_0x45e993[_0x8c3b('0x36')]({'plain':!![]});var _0x4c44e2='FaxAccounts';return db[_0x8c3b('0x37')][_0x8c3b('0x35')]({'where':{'type':_0x4c44e2,'resourceId':_0x16f1b1['id']}})['then'](function(){return _0x45e993;});})['then'](function(){_0x20a80c['status'](0xcc)[_0x8c3b('0x2a')]();});}};}function handleEntityNotFound(_0x100ba2,_0x3d2cc6){return function(_0x35f048){if(!_0x35f048){_0x100ba2[_0x8c3b('0x38')](0x194);}return _0x35f048;};}function handleError(_0x57fdc8,_0x511142){_0x511142=_0x511142||0x1f4;return function(_0x4eb6e6){logger['error'](_0x4eb6e6[_0x8c3b('0x39')]);if(_0x4eb6e6[_0x8c3b('0x3a')]){delete _0x4eb6e6[_0x8c3b('0x3a')];}_0x57fdc8[_0x8c3b('0x2b')](_0x511142)[_0x8c3b('0x3b')](_0x4eb6e6);};}exports['index']=function(_0x41b97a,_0x34e9d8){var _0x5e02dd={'include':[{'model':db[_0x8c3b('0x3c')],'as':_0x8c3b('0x3d')}]},_0x2e1ace={},_0x5eb269={'count':0x0,'rows':[]};var _0x252f06=_[_0x8c3b('0x3e')](db[_0x8c3b('0x3f')][_0x8c3b('0x40')],function(_0x185964){return{'name':_0x185964['fieldName'],'type':_0x185964[_0x8c3b('0x41')]['key']};});_0x2e1ace['model']=_[_0x8c3b('0x3e')](_0x252f06,_0x8c3b('0x3a'));_0x2e1ace['query']=_[_0x8c3b('0x42')](_0x41b97a[_0x8c3b('0x43')]);_0x2e1ace['filters']=_[_0x8c3b('0x44')](_0x2e1ace[_0x8c3b('0x45')],_0x2e1ace[_0x8c3b('0x43')]);_0x5e02dd[_0x8c3b('0x46')]=_[_0x8c3b('0x44')](_0x2e1ace['model'],qs[_0x8c3b('0x47')](_0x41b97a[_0x8c3b('0x43')][_0x8c3b('0x47')]));_0x5e02dd[_0x8c3b('0x46')]=_0x5e02dd[_0x8c3b('0x46')][_0x8c3b('0x48')]?_0x5e02dd[_0x8c3b('0x46')]:_0x2e1ace[_0x8c3b('0x45')];if(!_0x41b97a['query'][_0x8c3b('0x49')]('nolimit')){_0x5e02dd[_0x8c3b('0x30')]=qs[_0x8c3b('0x30')](_0x41b97a['query']['limit']);_0x5e02dd['offset']=qs[_0x8c3b('0x2d')](_0x41b97a[_0x8c3b('0x43')]['offset']);}_0x5e02dd[_0x8c3b('0x4a')]=qs[_0x8c3b('0x4b')](_0x41b97a[_0x8c3b('0x43')][_0x8c3b('0x4b')]);_0x5e02dd[_0x8c3b('0x4c')]=qs[_0x8c3b('0x4d')](_['pick'](_0x41b97a[_0x8c3b('0x43')],_0x2e1ace[_0x8c3b('0x4d')]),_0x252f06);if(_0x41b97a[_0x8c3b('0x43')][_0x8c3b('0x4e')]){_0x5e02dd['where']=_[_0x8c3b('0x4f')](_0x5e02dd[_0x8c3b('0x4c')],{'$or':_[_0x8c3b('0x3e')](_0x252f06,function(_0x17c3f7){if(_0x17c3f7[_0x8c3b('0x41')]!==_0x8c3b('0x50')){var _0x3d62c6={};_0x3d62c6[_0x17c3f7[_0x8c3b('0x3a')]]={'$like':'%'+_0x41b97a[_0x8c3b('0x43')][_0x8c3b('0x4e')]+'%'};return _0x3d62c6;}})});}_0x5e02dd=_[_0x8c3b('0x4f')]({},_0x5e02dd,_0x41b97a['options']);var _0x595b13={'where':_0x5e02dd[_0x8c3b('0x4c')]};return db['FaxAccount'][_0x8c3b('0x2f')](_0x595b13)[_0x8c3b('0x1f')](function(_0x1626a5){_0x5eb269[_0x8c3b('0x2f')]=_0x1626a5;if(_0x41b97a[_0x8c3b('0x43')][_0x8c3b('0x51')]){_0x5e02dd[_0x8c3b('0x52')]=[{'all':!![]}];}return db['FaxAccount'][_0x8c3b('0x53')](_0x5e02dd);})[_0x8c3b('0x1f')](function(_0x4d1cc0){_0x5eb269[_0x8c3b('0x54')]=_0x4d1cc0;return _0x5eb269;})[_0x8c3b('0x1f')](respondWithFilteredResult(_0x34e9d8,_0x5e02dd))[_0x8c3b('0x29')](handleError(_0x34e9d8,null));};exports[_0x8c3b('0x55')]=function(_0x56bfe7,_0x2b5550){var _0x84e83b={'raw':![],'where':{'id':_0x56bfe7[_0x8c3b('0x56')]['id']},'include':[{'model':db[_0x8c3b('0x3c')],'as':_0x8c3b('0x3d')}]},_0x1df227={};_0x1df227['model']=_[_0x8c3b('0x42')](db[_0x8c3b('0x3f')]['rawAttributes']);_0x1df227[_0x8c3b('0x43')]=_['keys'](_0x56bfe7[_0x8c3b('0x43')]);_0x1df227[_0x8c3b('0x4d')]=_[_0x8c3b('0x44')](_0x1df227[_0x8c3b('0x45')],_0x1df227[_0x8c3b('0x43')]);_0x84e83b['attributes']=_[_0x8c3b('0x44')](_0x1df227['model'],qs[_0x8c3b('0x47')](_0x56bfe7[_0x8c3b('0x43')][_0x8c3b('0x47')]));_0x84e83b[_0x8c3b('0x46')]=_0x84e83b[_0x8c3b('0x46')][_0x8c3b('0x48')]?_0x84e83b['attributes']:_0x1df227[_0x8c3b('0x45')];if(_0x56bfe7['query'][_0x8c3b('0x51')]){_0x84e83b[_0x8c3b('0x52')]=[{'all':!![]}];}_0x84e83b=_[_0x8c3b('0x4f')]({},_0x84e83b,_0x56bfe7[_0x8c3b('0x57')]);return db[_0x8c3b('0x3f')][_0x8c3b('0x58')](_0x84e83b)[_0x8c3b('0x1f')](handleEntityNotFound(_0x2b5550,null))[_0x8c3b('0x1f')](respondWithResult(_0x2b5550,null))[_0x8c3b('0x29')](handleError(_0x2b5550,null));};exports['create']=function(_0x2f9431,_0x3b8997){return db['FaxAccount'][_0x8c3b('0x59')](_0x2f9431[_0x8c3b('0x5a')],{})[_0x8c3b('0x1f')](function(_0x30a4e5){var _0x16d517=_0x2f9431[_0x8c3b('0x5b')][_0x8c3b('0x36')]({'plain':!![]});if(!_0x16d517)throw new Error(_0x8c3b('0x5c'));if(_0x16d517[_0x8c3b('0x5d')]===_0x8c3b('0x5b')){var _0x429f65=_0x30a4e5[_0x8c3b('0x36')]({'plain':!![]});var _0x408f52='FaxAccounts';return db[_0x8c3b('0x5e')][_0x8c3b('0x58')]({'where':{'name':_0x408f52,'userProfileId':_0x16d517[_0x8c3b('0x5f')]},'raw':!![]})[_0x8c3b('0x1f')](function(_0x3f3b6d){if(_0x3f3b6d&&_0x3f3b6d[_0x8c3b('0x60')]===0x0){return db[_0x8c3b('0x37')]['create']({'name':_0x429f65[_0x8c3b('0x3a')],'resourceId':_0x429f65['id'],'type':_0x3f3b6d[_0x8c3b('0x3a')],'sectionId':_0x3f3b6d['id']},{})[_0x8c3b('0x1f')](function(){return _0x30a4e5;});}else{return _0x30a4e5;}})[_0x8c3b('0x29')](function(_0x106324){logger[_0x8c3b('0x25')](_0x8c3b('0x61'),_0x106324);throw _0x106324;});}return _0x30a4e5;})[_0x8c3b('0x1f')](respondWithResult(_0x3b8997,0xc9))[_0x8c3b('0x29')](handleError(_0x3b8997,null));};exports['update']=function(_0x11348c,_0x503fc){if(_0x11348c[_0x8c3b('0x5a')]['id']){delete _0x11348c[_0x8c3b('0x5a')]['id'];}return db[_0x8c3b('0x3f')][_0x8c3b('0x58')]({'where':{'id':_0x11348c['params']['id']},'include':[{'model':db[_0x8c3b('0x3c')],'as':_0x8c3b('0x3d')}]})[_0x8c3b('0x1f')](handleEntityNotFound(_0x503fc,null))[_0x8c3b('0x1f')](saveUpdates(_0x11348c[_0x8c3b('0x5a')],null))[_0x8c3b('0x1f')](respondWithResult(_0x503fc,null))[_0x8c3b('0x29')](handleError(_0x503fc,null));};exports[_0x8c3b('0x35')]=function(_0x612e9d,_0x48a858){return db['FaxAccount'][_0x8c3b('0x58')]({'where':{'id':_0x612e9d['params']['id']}})[_0x8c3b('0x1f')](handleEntityNotFound(_0x48a858,null))[_0x8c3b('0x1f')](removeEntity(_0x48a858,null))['catch'](handleError(_0x48a858,null));};exports[_0x8c3b('0x62')]=function(_0xfee124,_0xeb9e12){return db[_0x8c3b('0x3f')]['describe']()['then'](respondWithResult(_0xeb9e12,null))[_0x8c3b('0x29')](handleError(_0xeb9e12,null));};exports[_0x8c3b('0x63')]=function(_0x2b084f,_0x3f2e0f,_0x18f296){if(_0x2b084f[_0x8c3b('0x5a')]['id']){delete _0x2b084f[_0x8c3b('0x5a')]['id'];}return db[_0x8c3b('0x3f')][_0x8c3b('0x58')]({'where':{'id':_0x2b084f[_0x8c3b('0x56')]['id']}})[_0x8c3b('0x1f')](handleEntityNotFound(_0x3f2e0f,null))[_0x8c3b('0x1f')](function(_0x2be6c2){if(_0x2be6c2){_0x2b084f[_0x8c3b('0x5a')][_0x8c3b('0x64')]=_0x2be6c2['id'];return db[_0x8c3b('0x65')][_0x8c3b('0x59')](_0x2b084f[_0x8c3b('0x5a')]);}})[_0x8c3b('0x1f')](respondWithResult(_0x3f2e0f,null))[_0x8c3b('0x29')](handleError(_0x3f2e0f,null));};exports['getDispositions']=function(_0x5dd9b5,_0x155e87,_0x3d0453){var _0xd87c32={'raw':![],'where':{}};var _0x3a30cc={};var _0x4295ff={'count':0x0,'rows':[]};return db[_0x8c3b('0x3f')][_0x8c3b('0x66')]({'where':{'id':_0x5dd9b5[_0x8c3b('0x56')]['id']}})[_0x8c3b('0x1f')](handleEntityNotFound(_0x155e87,null))[_0x8c3b('0x1f')](function(_0x2d5c5c){if(_0x2d5c5c){_0x3a30cc[_0x8c3b('0x45')]=_['keys'](db['Disposition']['rawAttributes']);_0x3a30cc['query']=_[_0x8c3b('0x42')](_0x5dd9b5['query']);_0x3a30cc[_0x8c3b('0x4d')]=_['intersection'](_0x3a30cc[_0x8c3b('0x45')],_0x3a30cc[_0x8c3b('0x43')]);_0xd87c32[_0x8c3b('0x46')]=_[_0x8c3b('0x44')](_0x3a30cc[_0x8c3b('0x45')],qs[_0x8c3b('0x47')](_0x5dd9b5[_0x8c3b('0x43')][_0x8c3b('0x47')]));_0xd87c32[_0x8c3b('0x46')]=_0xd87c32[_0x8c3b('0x46')][_0x8c3b('0x48')]?_0xd87c32[_0x8c3b('0x46')]:_0x3a30cc[_0x8c3b('0x45')];if(!_0x5dd9b5['query'][_0x8c3b('0x49')]('nolimit')){_0xd87c32[_0x8c3b('0x30')]=qs[_0x8c3b('0x30')](_0x5dd9b5['query']['limit']);_0xd87c32[_0x8c3b('0x2d')]=qs[_0x8c3b('0x2d')](_0x5dd9b5[_0x8c3b('0x43')][_0x8c3b('0x2d')]);}_0xd87c32['order']=qs['sort'](_0x5dd9b5[_0x8c3b('0x43')][_0x8c3b('0x4b')]);_0xd87c32[_0x8c3b('0x4c')]=qs['filters'](_[_0x8c3b('0x67')](_0x5dd9b5['query'],_0x3a30cc[_0x8c3b('0x4d')]));_0xd87c32[_0x8c3b('0x4c')][_0x8c3b('0x64')]=_0x2d5c5c['id'];if(_0x5dd9b5[_0x8c3b('0x43')]['filter']){_0xd87c32[_0x8c3b('0x4c')]=_[_0x8c3b('0x4f')](_0xd87c32['where'],{'$or':_[_0x8c3b('0x3e')](_0xd87c32[_0x8c3b('0x46')],function(_0x1af53c){var _0x10387e={};_0x10387e[_0x1af53c]={'$like':'%'+_0x5dd9b5[_0x8c3b('0x43')][_0x8c3b('0x4e')]+'%'};return _0x10387e;})});}_0xd87c32=_['merge']({},_0xd87c32,_0x5dd9b5[_0x8c3b('0x57')]);return db[_0x8c3b('0x65')][_0x8c3b('0x2f')]({'where':_0xd87c32[_0x8c3b('0x4c')]})[_0x8c3b('0x1f')](function(_0x1c7813){_0x4295ff[_0x8c3b('0x2f')]=_0x1c7813;if(_0x5dd9b5[_0x8c3b('0x43')][_0x8c3b('0x51')]){_0xd87c32['include']=[{'all':!![]}];}return db[_0x8c3b('0x65')]['findAll'](_0xd87c32);})[_0x8c3b('0x1f')](function(_0x288f2b){_0x4295ff[_0x8c3b('0x54')]=_0x288f2b;return _0x4295ff;});}})['then'](respondWithFilteredResult(_0x155e87,_0xd87c32))[_0x8c3b('0x29')](handleError(_0x155e87,null));};exports[_0x8c3b('0x68')]=function(_0x3652d3,_0x4071d9,_0x5941f0){return db[_0x8c3b('0x3f')]['find']({'where':{'id':_0x3652d3[_0x8c3b('0x56')]['id']}})[_0x8c3b('0x1f')](handleEntityNotFound(_0x4071d9,null))[_0x8c3b('0x1f')](function(_0x5a9789){if(_0x5a9789){return _0x5a9789[_0x8c3b('0x68')](_0x3652d3[_0x8c3b('0x43')][_0x8c3b('0x69')]);}})[_0x8c3b('0x1f')](respondWithStatusCode(_0x4071d9,null))[_0x8c3b('0x29')](handleError(_0x4071d9,null));};exports[_0x8c3b('0x6a')]=function(_0x1dcc76,_0x47ca0d,_0x17f9bd){if(_0x1dcc76[_0x8c3b('0x5a')]['id']){delete _0x1dcc76[_0x8c3b('0x5a')]['id'];}return db['FaxAccount'][_0x8c3b('0x58')]({'where':{'id':_0x1dcc76[_0x8c3b('0x56')]['id']}})[_0x8c3b('0x1f')](handleEntityNotFound(_0x47ca0d,null))[_0x8c3b('0x1f')](function(_0x39aba2){if(_0x39aba2){_0x1dcc76[_0x8c3b('0x5a')][_0x8c3b('0x64')]=_0x39aba2['id'];return db['CannedAnswer'][_0x8c3b('0x59')](_0x1dcc76['body']);}})[_0x8c3b('0x1f')](respondWithResult(_0x47ca0d,null))[_0x8c3b('0x29')](handleError(_0x47ca0d,null));};exports[_0x8c3b('0x6b')]=function(_0x462dff,_0x1e1b58,_0x1aab0f){var _0x5d5656={'raw':![],'where':{}};var _0x43b3f9={};var _0x572f3c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8c3b('0x66')]({'where':{'id':_0x462dff[_0x8c3b('0x56')]['id']}})['then'](handleEntityNotFound(_0x1e1b58,null))[_0x8c3b('0x1f')](function(_0x13e88d){if(_0x13e88d){_0x43b3f9[_0x8c3b('0x45')]=_[_0x8c3b('0x42')](db['CannedAnswer'][_0x8c3b('0x40')]);_0x43b3f9[_0x8c3b('0x43')]=_[_0x8c3b('0x42')](_0x462dff[_0x8c3b('0x43')]);_0x43b3f9[_0x8c3b('0x4d')]=_[_0x8c3b('0x44')](_0x43b3f9[_0x8c3b('0x45')],_0x43b3f9[_0x8c3b('0x43')]);_0x5d5656[_0x8c3b('0x46')]=_[_0x8c3b('0x44')](_0x43b3f9[_0x8c3b('0x45')],qs['fields'](_0x462dff['query'][_0x8c3b('0x47')]));_0x5d5656[_0x8c3b('0x46')]=_0x5d5656[_0x8c3b('0x46')][_0x8c3b('0x48')]?_0x5d5656[_0x8c3b('0x46')]:_0x43b3f9[_0x8c3b('0x45')];if(!_0x462dff[_0x8c3b('0x43')]['hasOwnProperty'](_0x8c3b('0x6c'))){_0x5d5656[_0x8c3b('0x30')]=qs[_0x8c3b('0x30')](_0x462dff['query'][_0x8c3b('0x30')]);_0x5d5656[_0x8c3b('0x2d')]=qs[_0x8c3b('0x2d')](_0x462dff[_0x8c3b('0x43')][_0x8c3b('0x2d')]);}_0x5d5656[_0x8c3b('0x4a')]=qs[_0x8c3b('0x4b')](_0x462dff[_0x8c3b('0x43')][_0x8c3b('0x4b')]);_0x5d5656['where']=qs[_0x8c3b('0x4d')](_[_0x8c3b('0x67')](_0x462dff[_0x8c3b('0x43')],_0x43b3f9[_0x8c3b('0x4d')]));_0x5d5656[_0x8c3b('0x4c')][_0x8c3b('0x64')]=_0x13e88d['id'];if(_0x462dff[_0x8c3b('0x43')][_0x8c3b('0x4e')]){_0x5d5656[_0x8c3b('0x4c')]=_[_0x8c3b('0x4f')](_0x5d5656[_0x8c3b('0x4c')],{'$or':_[_0x8c3b('0x3e')](_0x5d5656[_0x8c3b('0x46')],function(_0x2170f1){var _0x2960f1={};_0x2960f1[_0x2170f1]={'$like':'%'+_0x462dff['query'][_0x8c3b('0x4e')]+'%'};return _0x2960f1;})});}_0x5d5656=_[_0x8c3b('0x4f')]({},_0x5d5656,_0x462dff[_0x8c3b('0x57')]);return db[_0x8c3b('0x6d')]['count']({'where':_0x5d5656['where']})[_0x8c3b('0x1f')](function(_0x34761a){_0x572f3c[_0x8c3b('0x2f')]=_0x34761a;if(_0x462dff[_0x8c3b('0x43')][_0x8c3b('0x51')]){_0x5d5656[_0x8c3b('0x52')]=[{'all':!![]}];}return db[_0x8c3b('0x6d')]['findAll'](_0x5d5656);})[_0x8c3b('0x1f')](function(_0x5d8a01){_0x572f3c[_0x8c3b('0x54')]=_0x5d8a01;return _0x572f3c;});}})[_0x8c3b('0x1f')](respondWithFilteredResult(_0x1e1b58,_0x5d5656))[_0x8c3b('0x29')](handleError(_0x1e1b58,null));};exports[_0x8c3b('0x6e')]=function(_0x5a55ad,_0x14596b,_0x870761){return db[_0x8c3b('0x3f')][_0x8c3b('0x58')]({'where':{'id':_0x5a55ad[_0x8c3b('0x56')]['id']}})[_0x8c3b('0x1f')](handleEntityNotFound(_0x14596b,null))[_0x8c3b('0x1f')](function(_0x1d5cc7){if(_0x1d5cc7){return _0x1d5cc7[_0x8c3b('0x6e')](_0x5a55ad[_0x8c3b('0x43')][_0x8c3b('0x69')]);}})[_0x8c3b('0x1f')](respondWithStatusCode(_0x14596b,null))['catch'](handleError(_0x14596b,null));};exports[_0x8c3b('0x6f')]=function(_0x17c911,_0x4397f7,_0x419607){return db[_0x8c3b('0x70')][_0x8c3b('0x58')]({'where':{'id':_0x17c911['params']['id']}})[_0x8c3b('0x1f')](handleEntityNotFound(_0x4397f7,null))[_0x8c3b('0x1f')](function(_0x4cb3cb){if(_0x4cb3cb){return _0x4cb3cb[_0x8c3b('0x6f')](_0x17c911['body'][_0x8c3b('0x69')],_[_0x8c3b('0x71')](_0x17c911['body'],[_0x8c3b('0x69'),'id'])||{});}})[_0x8c3b('0x1f')](respondWithResult(_0x4397f7,null))[_0x8c3b('0x29')](handleError(_0x4397f7,null));};exports[_0x8c3b('0x72')]=function(_0x2d8c9c,_0x5f3258,_0x4fc60d){var _0x26ff49={'raw':![],'where':{}};var _0x4dde55={};var _0x4b4f51={'count':0x0,'rows':[]};return db[_0x8c3b('0x3f')]['findOne']({'where':{'id':_0x2d8c9c[_0x8c3b('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3258,null))[_0x8c3b('0x1f')](function(_0x23f9f7){if(_0x23f9f7){_0x4dde55[_0x8c3b('0x45')]=_['keys'](db['FaxInteraction'][_0x8c3b('0x40')]);_0x4dde55['query']=_[_0x8c3b('0x42')](_0x2d8c9c['query']);_0x4dde55[_0x8c3b('0x4d')]=_[_0x8c3b('0x44')](_0x4dde55['model'],_0x4dde55['query']);_0x26ff49[_0x8c3b('0x46')]=_[_0x8c3b('0x44')](_0x4dde55[_0x8c3b('0x45')],qs['fields'](_0x2d8c9c['query'][_0x8c3b('0x47')]));_0x26ff49[_0x8c3b('0x46')]=_0x26ff49[_0x8c3b('0x46')][_0x8c3b('0x48')]?_0x26ff49[_0x8c3b('0x46')]:_0x4dde55[_0x8c3b('0x45')];if(!_0x2d8c9c[_0x8c3b('0x43')][_0x8c3b('0x49')]('nolimit')){_0x26ff49[_0x8c3b('0x30')]=qs[_0x8c3b('0x30')](_0x2d8c9c[_0x8c3b('0x43')]['limit']);_0x26ff49[_0x8c3b('0x2d')]=qs[_0x8c3b('0x2d')](_0x2d8c9c['query']['offset']);}_0x26ff49[_0x8c3b('0x4a')]=qs[_0x8c3b('0x4b')](_0x2d8c9c[_0x8c3b('0x43')][_0x8c3b('0x4b')]);_0x26ff49[_0x8c3b('0x4c')]=qs['filters'](_['pick'](_0x2d8c9c[_0x8c3b('0x43')],_0x4dde55['filters']));_0x26ff49[_0x8c3b('0x4c')][_0x8c3b('0x64')]=_0x23f9f7['id'];if(_0x2d8c9c[_0x8c3b('0x43')][_0x8c3b('0x4e')]){_0x26ff49['where']=_[_0x8c3b('0x4f')](_0x26ff49[_0x8c3b('0x4c')],{'$or':_['map'](_0x26ff49[_0x8c3b('0x46')],function(_0x9dc66d){var _0x439db8={};_0x439db8[_0x9dc66d]={'$like':'%'+_0x2d8c9c[_0x8c3b('0x43')]['filter']+'%'};return _0x439db8;})});}_0x26ff49=_['merge']({},_0x26ff49,_0x2d8c9c['options']);return db[_0x8c3b('0x70')][_0x8c3b('0x2f')]({'where':_0x26ff49[_0x8c3b('0x4c')]})[_0x8c3b('0x1f')](function(_0x2e7603){_0x4b4f51[_0x8c3b('0x2f')]=_0x2e7603;if(_0x2d8c9c['query'][_0x8c3b('0x51')]){_0x26ff49[_0x8c3b('0x52')]=[{'model':db[_0x8c3b('0x73')],'as':_0x8c3b('0x74'),'required':![]},{'model':db[_0x8c3b('0x75')],'as':'Owner','attributes':[_0x8c3b('0x3a'),_0x8c3b('0x76'),_0x8c3b('0x77')],'required':![]},{'model':db['Tag'],'as':_0x8c3b('0x78'),'attributes':['id',_0x8c3b('0x3a'),_0x8c3b('0x79')],'where':_0x2d8c9c[_0x8c3b('0x43')]['tag']?{'id':_0x2d8c9c[_0x8c3b('0x43')][_0x8c3b('0x7a')]}:undefined,'required':_0x2d8c9c[_0x8c3b('0x43')][_0x8c3b('0x7a')]?!![]:![]}];}return db[_0x8c3b('0x70')][_0x8c3b('0x53')](_0x26ff49);})[_0x8c3b('0x1f')](function(_0x26054b){_0x4b4f51[_0x8c3b('0x54')]=_0x26054b;return _0x4b4f51;});}})[_0x8c3b('0x1f')](respondWithFilteredResult(_0x5f3258,_0x26ff49))[_0x8c3b('0x29')](handleError(_0x5f3258,null));};exports[_0x8c3b('0x7b')]=function(_0x32583b,_0xf393db){var _0x36ccac=_0x32583b[_0x8c3b('0x56')]['id'];var _0x40b8e7=_0x32583b[_0x8c3b('0x5a')];var _0x50453c=0xc8;var _0xd68b88=null;return db[_0x8c3b('0x7c')]['transaction']({'isolationLevel':db['sequelize'][_0x8c3b('0x7d')][_0x8c3b('0x7e')][_0x8c3b('0x7f')]},function(_0x50dffa){return db[_0x8c3b('0x3f')][_0x8c3b('0x66')]({'where':{'id':_0x36ccac},'transaction':_0x50dffa})['then'](function(_0x3061d5){if(_0x3061d5){return db[_0x8c3b('0x80')][_0x8c3b('0x35')]({'where':{'FaxAccountId':_0x36ccac},'transaction':_0x50dffa})[_0x8c3b('0x1f')](function(){var _0x1189e1=_[_0x8c3b('0x3e')](_0x40b8e7,function(_0x4350d6){_0x4350d6['FaxAccountId']=_0x36ccac;return _0x4350d6;});return db[_0x8c3b('0x80')]['bulkCreate'](_0x1189e1,{'transaction':_0x50dffa});});}else{_0x50453c=0x194;_0xd68b88=[];}});})[_0x8c3b('0x1f')](function(){if(_0x50453c!==0x194){return db[_0x8c3b('0x80')][_0x8c3b('0x81')]({'where':{'FaxAccountId':_0x36ccac},'order':_0x8c3b('0x82')})[_0x8c3b('0x1f')](function(_0x30c860){_0xd68b88=_0x30c860;});}})[_0x8c3b('0x29')](function(_0x981dca){_0x50453c=0x1f4;logger[_0x8c3b('0x25')](_0x981dca[_0x8c3b('0x39')]);if(_0x981dca[_0x8c3b('0x3a')]){delete _0x981dca['name'];}_0xd68b88=_0x981dca;})[_0x8c3b('0x83')](function(){if(_0xd68b88===null){_0xf393db[_0x8c3b('0x38')](_0x50453c);}else{if(_0x50453c===0x1f4){_0xf393db[_0x8c3b('0x2b')](_0x50453c)[_0x8c3b('0x3b')](_0xd68b88);}else{_0xf393db[_0x8c3b('0x2b')](_0x50453c)[_0x8c3b('0x2c')](_0xd68b88);}}});};exports[_0x8c3b('0x84')]=function(_0x36d157,_0x340487,_0x14d616){var _0x52f558={};var _0x1040f4={};var _0x2d29dd;var _0x365482;return db[_0x8c3b('0x3f')]['findOne']({'where':{'id':_0x36d157['params']['id']}})[_0x8c3b('0x1f')](handleEntityNotFound(_0x340487,null))[_0x8c3b('0x1f')](function(_0x3eefd5){if(_0x3eefd5){_0x2d29dd=_0x3eefd5;_0x1040f4[_0x8c3b('0x45')]=_[_0x8c3b('0x42')](db[_0x8c3b('0x80')]['rawAttributes']);_0x1040f4[_0x8c3b('0x43')]=_[_0x8c3b('0x42')](_0x36d157[_0x8c3b('0x43')]);_0x1040f4[_0x8c3b('0x4d')]=_[_0x8c3b('0x44')](_0x1040f4[_0x8c3b('0x45')],_0x1040f4[_0x8c3b('0x43')]);_0x52f558[_0x8c3b('0x46')]=_[_0x8c3b('0x44')](_0x1040f4[_0x8c3b('0x45')],qs[_0x8c3b('0x47')](_0x36d157[_0x8c3b('0x43')][_0x8c3b('0x47')]));_0x52f558[_0x8c3b('0x46')]=_0x52f558[_0x8c3b('0x46')][_0x8c3b('0x48')]?_0x52f558[_0x8c3b('0x46')]:_0x1040f4['model'];_0x52f558[_0x8c3b('0x4a')]=qs['sort'](_0x36d157[_0x8c3b('0x43')]['sort']);_0x52f558[_0x8c3b('0x4c')]=qs[_0x8c3b('0x4d')](_[_0x8c3b('0x67')](_0x36d157[_0x8c3b('0x43')],_0x1040f4[_0x8c3b('0x4d')]));if(_0x36d157[_0x8c3b('0x43')][_0x8c3b('0x4e')]){_0x52f558[_0x8c3b('0x4c')]=_[_0x8c3b('0x4f')](_0x52f558[_0x8c3b('0x4c')],{'$or':_[_0x8c3b('0x3e')](_0x52f558[_0x8c3b('0x46')],function(_0xb2940){var _0x18a7c3={};_0x18a7c3[_0xb2940]={'$like':'%'+_0x36d157[_0x8c3b('0x43')][_0x8c3b('0x4e')]+'%'};return _0x18a7c3;})});}_0x52f558=_[_0x8c3b('0x4f')]({},_0x52f558,_0x36d157[_0x8c3b('0x57')]);return _0x2d29dd['getApplications'](_0x52f558);}})[_0x8c3b('0x1f')](function(_0x29ae31){if(_0x29ae31){_0x365482=_0x29ae31['length'];if(!_0x36d157[_0x8c3b('0x43')][_0x8c3b('0x49')]('nolimit')){_0x52f558['limit']=qs[_0x8c3b('0x30')](_0x36d157[_0x8c3b('0x43')][_0x8c3b('0x30')]);_0x52f558['offset']=qs[_0x8c3b('0x2d')](_0x36d157['query'][_0x8c3b('0x2d')]);}return _0x2d29dd[_0x8c3b('0x84')](_0x52f558);}})[_0x8c3b('0x1f')](function(_0x46ddb9){if(_0x46ddb9){return _0x46ddb9?{'count':_0x365482,'rows':_0x46ddb9}:null;}})[_0x8c3b('0x1f')](respondWithResult(_0x340487,null))[_0x8c3b('0x29')](handleError(_0x340487,null));};function Extension(_0x5a669e,_0x5349c6,_0x58f673,_0x4692ff){this[_0x8c3b('0x85')]=_0x8c3b('0x86');this[_0x8c3b('0x87')]=_0x5a669e[_0x8c3b('0x88')];this[_0x8c3b('0x89')]=_0x4692ff;this['type']=_0x8c3b('0x8a');this['description']=_0x8c3b('0x8b');this[_0x8c3b('0x64')]=_0x5a669e['id'];this[_0x8c3b('0x82')]=_0x5349c6;this[_0x8c3b('0x8c')]=_0x58f673;}function createExtensionsReciveFax(_0x2d57b3){var _0x436221=0x1;var _0x40b707=[];_0x40b707[_0x8c3b('0x8d')](new Extension(_0x2d57b3,_0x436221,'',_0x8c3b('0x8e')));_0x436221+=0x1;_0x40b707['push'](new Extension(_0x2d57b3,_0x436221,_0x8c3b('0x8f'),_0x8c3b('0x90')));_0x436221+=0x1;for(var _0x49d444 in _0x2d57b3){if(_0x2d57b3[_0x8c3b('0x49')](_0x49d444)&&(_0x49d444==='ecm'||_0x49d444==='localstationid'||_0x49d444==='gateway'||_0x49d444===_0x8c3b('0x91')||_0x49d444===_0x8c3b('0x92')||_0x49d444===_0x8c3b('0x93')||_0x49d444===_0x8c3b('0x94')||_0x49d444===_0x8c3b('0x95')||_0x49d444===_0x8c3b('0x96'))){_0x40b707[_0x8c3b('0x8d')](new Extension(_0x2d57b3,_0x436221,_0x8c3b('0x97')+_0x49d444+')='+_0x2d57b3[_0x49d444],_0x8c3b('0x90')));_0x436221+=0x1;}}_0x40b707[_0x8c3b('0x8d')](new Extension(_0x2d57b3,_0x436221,'6',_0x8c3b('0x98')));_0x436221+=0x1;_0x40b707[_0x8c3b('0x8d')](new Extension(_0x2d57b3,_0x436221,'/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',_0x8c3b('0x99')));_0x436221=0x0;return _0x40b707;}exports[_0x8c3b('0x9a')]=function(_0x31cd96,_0x2a57b8,_0x3a5565){var _0x3d7d95;return db[_0x8c3b('0x7c')][_0x8c3b('0x9b')](function(_0x24624f){return db[_0x8c3b('0x3f')][_0x8c3b('0x59')](_0x31cd96[_0x8c3b('0x5a')],{'transaction':_0x24624f})['then'](function(_0x55f937){_0x3d7d95=_0x55f937[_0x8c3b('0x36')]({'plain':!![]});return db[_0x8c3b('0x9c')][_0x8c3b('0x9d')](createExtensionsReciveFax(_0x3d7d95),{'transaction':_0x24624f});});})[_0x8c3b('0x1f')](function(){return _0x3d7d95;})[_0x8c3b('0x1f')](respondWithResult(_0x2a57b8,null))[_0x8c3b('0x29')](handleError(_0x2a57b8,null));};exports[_0x8c3b('0x9e')]=function(_0x462dd0,_0x3b5760,_0x193450){var _0x5cfce4;return db[_0x8c3b('0x7c')]['transaction'](function(_0x425592){return db[_0x8c3b('0x3f')][_0x8c3b('0x34')](_0x462dd0[_0x8c3b('0x5a')],{'where':{'id':_0x462dd0[_0x8c3b('0x5a')]['id']},'transaction':_0x425592})[_0x8c3b('0x1f')](function(_0x2e1697){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x462dd0['body']['id']},'transaction':_0x425592})[_0x8c3b('0x1f')](function(_0x24f785){return db[_0x8c3b('0x9c')]['bulkCreate'](createExtensionsReciveFax(_[_0x8c3b('0x71')](_0x462dd0['body'],['tech',_0x8c3b('0x9f'),_0x8c3b('0xa0'),_0x8c3b('0xa1'),_0x8c3b('0xa2'),_0x8c3b('0xa3')])),{'transaction':_0x425592});});});})[_0x8c3b('0x1f')](function(){return db[_0x8c3b('0x3f')]['findById'](_0x462dd0[_0x8c3b('0x5a')]['id']);})[_0x8c3b('0x1f')](respondWithResult(_0x3b5760,null))[_0x8c3b('0x29')](handleError(_0x3b5760,null));};exports[_0x8c3b('0xa4')]=function(_0x196a5d,_0x46146c,_0xcfc967){var _0x3a0f52={'raw':!![],'where':{}};var _0x222b77={};var _0x796e5b={'count':0x0,'rows':[]};return db[_0x8c3b('0x3f')][_0x8c3b('0x66')]({'where':{'id':_0x196a5d['params']['id']}})['then'](handleEntityNotFound(_0x46146c,null))[_0x8c3b('0x1f')](function(_0x2ea4dd){if(_0x2ea4dd){_0x222b77['model']=_['keys'](db[_0x8c3b('0xa5')]['rawAttributes']);_0x222b77[_0x8c3b('0x43')]=_[_0x8c3b('0x42')](_0x196a5d['query']);_0x222b77['filters']=_[_0x8c3b('0x44')](_0x222b77[_0x8c3b('0x45')],_0x222b77[_0x8c3b('0x43')]);_0x3a0f52['attributes']=_[_0x8c3b('0x44')](_0x222b77['model'],qs[_0x8c3b('0x47')](_0x196a5d[_0x8c3b('0x43')]['fields']));_0x3a0f52['attributes']=_0x3a0f52[_0x8c3b('0x46')]['length']?_0x3a0f52[_0x8c3b('0x46')]:_0x222b77[_0x8c3b('0x45')];if(!_0x196a5d[_0x8c3b('0x43')][_0x8c3b('0x49')](_0x8c3b('0x6c'))){_0x3a0f52[_0x8c3b('0x30')]=qs['limit'](_0x196a5d[_0x8c3b('0x43')]['limit']);_0x3a0f52['offset']=qs[_0x8c3b('0x2d')](_0x196a5d[_0x8c3b('0x43')][_0x8c3b('0x2d')]);}_0x3a0f52[_0x8c3b('0x4a')]=qs[_0x8c3b('0x4b')](_0x196a5d[_0x8c3b('0x43')][_0x8c3b('0x4b')]);_0x3a0f52[_0x8c3b('0x4c')]=qs[_0x8c3b('0x4d')](_[_0x8c3b('0x67')](_0x196a5d[_0x8c3b('0x43')],_0x222b77[_0x8c3b('0x4d')]));_0x3a0f52[_0x8c3b('0x4c')][_0x8c3b('0x64')]=_0x2ea4dd['id'];if(_0x196a5d[_0x8c3b('0x43')]['filter']){_0x3a0f52['where']=_['merge'](_0x3a0f52[_0x8c3b('0x4c')],{'$or':_[_0x8c3b('0x3e')](_0x3a0f52[_0x8c3b('0x46')],function(_0x42788d){var _0x26e3f2={};_0x26e3f2[_0x42788d]={'$like':'%'+_0x196a5d['query'][_0x8c3b('0x4e')]+'%'};return _0x26e3f2;})});}if(_0x196a5d['query'][_0x8c3b('0xa6')]){var _0x497096=_0x196a5d['query'][_0x8c3b('0xa6')][_0x8c3b('0xa7')](',');var _0x4bd6d5={};_0x4bd6d5[_0x497096[0x0]]={'$gte':moment(_0x497096[0x1])[_0x8c3b('0xa8')](_0x8c3b('0xa9'))};_0x3a0f52[_0x8c3b('0x4c')]=_[_0x8c3b('0x4f')](_0x3a0f52[_0x8c3b('0x4c')],_0x4bd6d5);}_0x3a0f52=_[_0x8c3b('0x4f')]({},_0x3a0f52,_0x196a5d[_0x8c3b('0x57')]);return db[_0x8c3b('0xa5')]['count']({'where':_0x3a0f52[_0x8c3b('0x4c')]})['then'](function(_0x13fc56){_0x796e5b[_0x8c3b('0x2f')]=_0x13fc56;if(_0x196a5d[_0x8c3b('0x43')][_0x8c3b('0x51')]){_0x3a0f52[_0x8c3b('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0x8c3b('0x53')](_0x3a0f52);})['then'](function(_0x30a52f){_0x796e5b['rows']=_0x30a52f;return _0x796e5b;});}})[_0x8c3b('0x1f')](respondWithFilteredResult(_0x46146c,_0x3a0f52))[_0x8c3b('0x29')](handleError(_0x46146c,null));};exports['send']=function(_0x1f6e12,_0x1374da,_0x357ebc){var _0x22781e,_0x4ec0bb={},_0x5402aa;if(_0x1f6e12['body']['to']){_0x5402aa=_0x1f6e12[_0x8c3b('0x5a')]['to'][0x0];}return db[_0x8c3b('0x3f')][_0x8c3b('0x58')]({'where':{'id':_0x1f6e12['params']['id']},'include':[{'model':db[_0x8c3b('0xaa')],'as':_0x8c3b('0xab'),'include':[{'model':db[_0x8c3b('0x73')],'as':_0x8c3b('0xac'),'where':{'fax':_0x5402aa},'limit':0x1,'order':[[_0x8c3b('0xa1'),'DESC']]}]}]})[_0x8c3b('0x1f')](handleEntityNotFound(_0x1374da,null))[_0x8c3b('0x1f')](function(_0x3e6bc3){_0x22781e=_0x3e6bc3;if(_0x1f6e12['body'][_0x8c3b('0xad')]&&_0x1f6e12[_0x8c3b('0x5a')]['attachments'][_0x8c3b('0x48')]){for(var _0x460c7e=0x0;_0x460c7e<_0x1f6e12['body'][_0x8c3b('0xad')][_0x8c3b('0x48')];_0x460c7e+=0x1){_0x1f6e12[_0x8c3b('0x5a')]['attachments'][_0x460c7e]={'filename':_0x1f6e12[_0x8c3b('0x5a')][_0x8c3b('0xad')][_0x460c7e][_0x8c3b('0x3a')],'id':_0x1f6e12[_0x8c3b('0x5a')]['attachments'][_0x460c7e]['id'],'path':path[_0x8c3b('0xae')](config['root'],_0x8c3b('0xaf'),_0x1f6e12['body'][_0x8c3b('0xad')][_0x460c7e][_0x8c3b('0xb0')])};}}return respondWithRpcPromise(_0x8c3b('0xb1'),'CheckAfterSend',{'FaxAccountId':_[_0x8c3b('0xb2')](_0x1f6e12['params']['id'])?undefined:_0x1f6e12[_0x8c3b('0x56')]['id'],'path':_[_0x8c3b('0xb2')](_0x1f6e12[_0x8c3b('0x5a')][_0x8c3b('0xad')][0x0][_0x8c3b('0x7')])?undefined:_0x1f6e12[_0x8c3b('0x5a')][_0x8c3b('0xad')][0x0][_0x8c3b('0x7')],'fax':_['isNil'](_0x1f6e12['body']['to'][0x0])?undefined:_0x1f6e12[_0x8c3b('0x5a')]['to'][0x0]},client9002);})[_0x8c3b('0x1f')](function(){if(_0x22781e){if(_[_0x8c3b('0xb2')](_0x1f6e12['body'][_0x8c3b('0xb3')])){_0x1f6e12[_0x8c3b('0x5a')][_0x8c3b('0xb3')]=util[_0x8c3b('0xa8')](_0x8c3b('0xb4'),_0x22781e[_0x8c3b('0x3a')],_0x22781e[_0x8c3b('0xb5')]);}if(_0x22781e[_0x8c3b('0xab')]){if(_0x22781e[_0x8c3b('0xab')]['Contacts'][_0x8c3b('0x48')]){return _0x22781e[_0x8c3b('0xab')][_0x8c3b('0xac')][0x0];}else{return db[_0x8c3b('0x73')][_0x8c3b('0x59')](_[_0x8c3b('0x17')](_0x1f6e12['body'],{'firstName':_0x1f6e12['body']['to'][0x0],'phone':_0x1f6e12[_0x8c3b('0x5a')]['to'][0x0],'fax':_0x1f6e12[_0x8c3b('0x5a')]['to'][0x0],'ListId':_0x22781e[_0x8c3b('0xa3')]}));}}else{throw new Error(_0x8c3b('0xb6'));}}else{throw new Error(_0x8c3b('0xb7'));}})['then'](function(_0x583c78){if(_0x583c78){return db['FaxInteraction']['find']({'where':{'ContactId':_0x583c78['id'],'closed':![],'FaxAccountId':_0x22781e['id']}})[_0x8c3b('0x1f')](function(_0x4deaff){if(_0x4deaff){return[_0x4deaff,![]];}return db[_0x8c3b('0x70')][_0x8c3b('0x59')]({'UserId':_0x1f6e12[_0x8c3b('0x5b')]['id'],'ContactId':_0x583c78['id'],'FaxAccountId':_0x22781e['id'],'fax':_0x1f6e12[_0x8c3b('0x5a')]['to'][0x0],'firstMsgDirection':_0x8c3b('0xb8'),'Messages':[_['merge'](_0x1f6e12[_0x8c3b('0x5a')],{'read':![],'body':_0x1f6e12[_0x8c3b('0x5a')][_0x8c3b('0xad')][0x0][_0x8c3b('0xb9')],'FaxAccountId':_0x22781e['id'],'UserId':_0x1f6e12['user']['id'],'ContactId':_0x583c78['id'],'AttachmentId':_0x1f6e12[_0x8c3b('0x5a')][_0x8c3b('0xad')][0x0]['id']})]},{'include':[{'model':db[_0x8c3b('0xa5')],'as':'Messages'}]})['then'](function(_0x3f9ca9){return[_0x3f9ca9,!![]];});});}else{throw new Error(_0x8c3b('0xba'));}})['spread'](function(_0x3a8726,_0x353b8d){if(_0x353b8d){return _0x3a8726;}return db[_0x8c3b('0xa5')][_0x8c3b('0x59')]({'direction':'out','read':![],'body':_0x1f6e12['body'][_0x8c3b('0xad')][0x0][_0x8c3b('0xb9')],'FaxAccountId':_0x22781e['id'],'FaxInteractionId':_0x3a8726['id'],'UserId':_0x1f6e12['user']['id'],'ContactId':_0x3a8726[_0x8c3b('0xbb')],'AttachmentId':_0x1f6e12[_0x8c3b('0x5a')][_0x8c3b('0xad')][0x0]['id']})[_0x8c3b('0x1f')](function(_0x3516a2){_0x3a8726[_0x8c3b('0xbc')][_0x8c3b('0xbd')]=[];_0x3a8726[_0x8c3b('0xbc')][_0x8c3b('0xbd')][_0x8c3b('0x8d')](_0x3516a2[_0x8c3b('0xbc')]);return _0x3a8726;});})[_0x8c3b('0x1f')](function(_0x569af4){respondWithRpcPromise(_0x8c3b('0xbe'),_0x8c3b('0xbe'),{'FaxAccountId':_['isNil'](_0x1f6e12[_0x8c3b('0x56')]['id'])?undefined:_0x1f6e12[_0x8c3b('0x56')]['id'],'path':_['isNil'](_0x1f6e12[_0x8c3b('0x5a')][_0x8c3b('0xad')][0x0][_0x8c3b('0x7')])?undefined:_0x1f6e12['body'][_0x8c3b('0xad')][0x0][_0x8c3b('0x7')],'fax':_['isNil'](_0x1f6e12[_0x8c3b('0x5a')]['to'][0x0])?undefined:_0x1f6e12['body']['to'][0x0],'AttachmentId':_0x1f6e12[_0x8c3b('0x5a')][_0x8c3b('0xad')][0x0]['id']},client9002)['then'](function(_0x4a5a86){logger[_0x8c3b('0x20')](_0x8c3b('0xbf'),_0x4a5a86);})[_0x8c3b('0x29')](function(_0xaa60bd){logger[_0x8c3b('0x20')](_0x8c3b('0xbf'),_0xaa60bd);});return _0x569af4;})[_0x8c3b('0x1f')](respondWithResult(_0x1374da,null))['catch'](handleError(_0x1374da,null));};exports[_0x8c3b('0xc0')]=function(_0x1668db,_0x32f0e1,_0x2d50c0){return db[_0x8c3b('0x3f')][_0x8c3b('0x58')]({'where':{'id':_0x1668db['params']['id']}})['then'](handleEntityNotFound(_0x32f0e1,null))[_0x8c3b('0x1f')](function(_0x1a3058){if(_0x1a3058){return _0x1a3058['addAgents'](_0x1668db['body'][_0x8c3b('0x69')],_['omit'](_0x1668db[_0x8c3b('0x5a')],[_0x8c3b('0x69'),'id'])||{})[_0x8c3b('0xc1')](function(_0x3b822b){for(var _0x4d6968=0x0;_0x4d6968<_0x1668db[_0x8c3b('0x5a')][_0x8c3b('0x69')][_0x8c3b('0x48')];_0x4d6968+=0x1){socket[_0x8c3b('0xc2')]('userFaxAccount:save',{'UserId':Number(_0x1668db[_0x8c3b('0x5a')]['ids'][_0x4d6968]),'FaxAccountId':Number(_0x1668db['params']['id'])});}return _0x3b822b;});}})[_0x8c3b('0x1f')](respondWithResult(_0x32f0e1,null))[_0x8c3b('0x29')](handleError(_0x32f0e1,null));};exports[_0x8c3b('0xc3')]=function(_0x334971,_0x2c2677,_0x278375){return db[_0x8c3b('0x3f')][_0x8c3b('0x58')]({'where':{'id':_0x334971[_0x8c3b('0x56')]['id']}})[_0x8c3b('0x1f')](handleEntityNotFound(_0x2c2677,null))['then'](function(_0x10e4e0){if(_0x10e4e0){return _0x10e4e0[_0x8c3b('0xc3')](_0x334971[_0x8c3b('0x43')]['ids'])[_0x8c3b('0x1f')](function(){if(_[_0x8c3b('0xc4')](_0x334971[_0x8c3b('0x43')]['ids'])){for(var _0x4dff5f=0x0;_0x4dff5f<_0x334971[_0x8c3b('0x43')]['ids']['length'];_0x4dff5f+=0x1){socket[_0x8c3b('0xc2')](_0x8c3b('0xc5'),{'UserId':Number(_0x334971[_0x8c3b('0x43')][_0x8c3b('0x69')][_0x4dff5f]),'FaxAccountId':Number(_0x334971[_0x8c3b('0x56')]['id'])});}}else{socket[_0x8c3b('0xc2')](_0x8c3b('0xc5'),{'UserId':Number(_0x334971[_0x8c3b('0x43')][_0x8c3b('0x69')]),'FaxAccountId':Number(_0x334971[_0x8c3b('0x56')]['id'])});}});}})[_0x8c3b('0x1f')](respondWithStatusCode(_0x2c2677,null))[_0x8c3b('0x29')](handleError(_0x2c2677,null));};exports['getAgents']=function(_0x5aafc8,_0x1eb2fc,_0x2659f3){var _0x56d06a={};var _0x334fe2={};var _0x2968f3;var _0x451ce9;return db['FaxAccount'][_0x8c3b('0x66')]({'where':{'id':_0x5aafc8['params']['id']}})[_0x8c3b('0x1f')](handleEntityNotFound(_0x1eb2fc,null))[_0x8c3b('0x1f')](function(_0x260f02){if(_0x260f02){_0x2968f3=_0x260f02;_0x334fe2[_0x8c3b('0x45')]=_[_0x8c3b('0x42')](db['User']['rawAttributes']);_0x334fe2[_0x8c3b('0x43')]=_[_0x8c3b('0x42')](_0x5aafc8[_0x8c3b('0x43')]);_0x334fe2['filters']=_[_0x8c3b('0x44')](_0x334fe2['model'],_0x334fe2['query']);_0x56d06a['attributes']=_['intersection'](_0x334fe2[_0x8c3b('0x45')],qs['fields'](_0x5aafc8[_0x8c3b('0x43')][_0x8c3b('0x47')]));_0x56d06a['attributes']=_0x56d06a[_0x8c3b('0x46')][_0x8c3b('0x48')]?_0x56d06a[_0x8c3b('0x46')]:_0x334fe2[_0x8c3b('0x45')];_0x56d06a['order']=qs[_0x8c3b('0x4b')](_0x5aafc8[_0x8c3b('0x43')][_0x8c3b('0x4b')]);_0x56d06a[_0x8c3b('0x4c')]=qs[_0x8c3b('0x4d')](_[_0x8c3b('0x67')](_0x5aafc8['query'],_0x334fe2['filters']));if(_0x5aafc8[_0x8c3b('0x43')][_0x8c3b('0x4e')]){_0x56d06a[_0x8c3b('0x4c')]=_[_0x8c3b('0x4f')](_0x56d06a[_0x8c3b('0x4c')],{'$or':_['map'](_0x56d06a[_0x8c3b('0x46')],function(_0x33eb49){var _0x4ebeac={};_0x4ebeac[_0x33eb49]={'$like':'%'+_0x5aafc8['query'][_0x8c3b('0x4e')]+'%'};return _0x4ebeac;})});}_0x56d06a=_[_0x8c3b('0x4f')]({},_0x56d06a,_0x5aafc8['options']);return _0x2968f3[_0x8c3b('0xc6')](_0x56d06a);}})[_0x8c3b('0x1f')](function(_0x5b4444){if(_0x5b4444){_0x451ce9=_0x5b4444[_0x8c3b('0x48')];if(!_0x5aafc8['query'][_0x8c3b('0x49')]('nolimit')){_0x56d06a['limit']=qs[_0x8c3b('0x30')](_0x5aafc8[_0x8c3b('0x43')][_0x8c3b('0x30')]);_0x56d06a['offset']=qs[_0x8c3b('0x2d')](_0x5aafc8[_0x8c3b('0x43')][_0x8c3b('0x2d')]);}return _0x2968f3[_0x8c3b('0xc6')](_0x56d06a);}})[_0x8c3b('0x1f')](function(_0x51792e){if(_0x51792e){return _0x51792e?{'count':_0x451ce9,'rows':_0x51792e}:null;}})['then'](respondWithResult(_0x1eb2fc,null))[_0x8c3b('0x29')](handleError(_0x1eb2fc,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4aad50f..e767003 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 _0xb9f4=['exports','events','FaxAccount','setMaxListeners','update','remove','hasOwnProperty','hook'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xb9f4,0x101));var _0x4b9f=function(_0x493942,_0x3a4701){_0x493942=_0x493942-0x0;var _0x2ce004=_0xb9f4[_0x493942];return _0x2ce004;};'use strict';var EventEmitter=require(_0x4b9f('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x4b9f('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4b9f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4b9f('0x3'),'afterDestroy':_0x4b9f('0x4')};function emitEvent(_0x210a90){return function(_0xb818c8,_0x17e7d8,_0x3d02ab){FaxAccountEvents['emit'](_0x210a90+':'+_0xb818c8['id'],_0xb818c8);FaxAccountEvents['emit'](_0x210a90,_0xb818c8);_0x3d02ab(null);};}for(var e in events){if(events[_0x4b9f('0x5')](e)){var event=events[e];FaxAccount[_0x4b9f('0x6')](e,emitEvent(event));}}module[_0x4b9f('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x2dcf=['setMaxListeners','update','remove','emit','exports','events','FaxAccount'];(function(_0x1097d8,_0x3e6aee){var _0x4968ad=function(_0x3649db){while(--_0x3649db){_0x1097d8['push'](_0x1097d8['shift']());}};_0x4968ad(++_0x3e6aee);}(_0x2dcf,0x1b0));var _0xf2dc=function(_0x4ca43b,_0xa6e25b){_0x4ca43b=_0x4ca43b-0x0;var _0x545dcd=_0x2dcf[_0x4ca43b];return _0x545dcd;};'use strict';var EventEmitter=require(_0xf2dc('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xf2dc('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf2dc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf2dc('0x3'),'afterDestroy':_0xf2dc('0x4')};function emitEvent(_0x5af0f6){return function(_0x352dd9,_0x1215fb,_0x50e25f){FaxAccountEvents[_0xf2dc('0x5')](_0x5af0f6+':'+_0x352dd9['id'],_0x352dd9);FaxAccountEvents[_0xf2dc('0x5')](_0x5af0f6,_0x352dd9);_0x50e25f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xf2dc('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 4919df6..d5ec054 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 _0x6a7e=['../../config/environment','./faxAccount.attributes','exports','fax_accounts','lodash','util','../../config/logger','bluebird','path'];(function(_0x110be6,_0x257cea){var _0x3ec167=function(_0x1d5ed1){while(--_0x1d5ed1){_0x110be6['push'](_0x110be6['shift']());}};_0x3ec167(++_0x257cea);}(_0x6a7e,0x112));var _0xe6a7=function(_0x13b8d6,_0x539373){_0x13b8d6=_0x13b8d6-0x0;var _0x137f49=_0x6a7e[_0x13b8d6];return _0x137f49;};'use strict';var _=require(_0xe6a7('0x0'));var util=require(_0xe6a7('0x1'));var logger=require(_0xe6a7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe6a7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6a7('0x4'));var rimraf=require('rimraf');var config=require(_0xe6a7('0x5'));var attributes=require(_0xe6a7('0x6'));module[_0xe6a7('0x7')]=function(_0x1708b4,_0x30c4be){return _0x1708b4['define']('FaxAccount',attributes,{'tableName':_0xe6a7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd40b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','lodash','util'];(function(_0x163154,_0xa14a47){var _0x1cb69c=function(_0x1be420){while(--_0x1be420){_0x163154['push'](_0x163154['shift']());}};_0x1cb69c(++_0xa14a47);}(_0xd40b,0x1b8));var _0xbd40=function(_0x94f0ff,_0x1c010d){_0x94f0ff=_0x94f0ff-0x0;var _0x2b91de=_0xd40b[_0x94f0ff];return _0x2b91de;};'use strict';var _=require(_0xbd40('0x0'));var util=require(_0xbd40('0x1'));var logger=require(_0xbd40('0x2'))(_0xbd40('0x3'));var moment=require(_0xbd40('0x4'));var BPromise=require(_0xbd40('0x5'));var rp=require(_0xbd40('0x6'));var fs=require('fs');var path=require(_0xbd40('0x7'));var rimraf=require(_0xbd40('0x8'));var config=require(_0xbd40('0x9'));var attributes=require(_0xbd40('0xa'));module[_0xbd40('0xb')]=function(_0x8f5353,_0x2fdac3){return _0x8f5353[_0xbd40('0xc')]('FaxAccount',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 5462e86..c70a106 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 _0x8151=['orderBy','priority','asc','ListId','contact','FaxInteraction','Contact\x20not\x20found','spread','push','length','close','created','interaction','FaxMessage','create','AttachmentId','UserId','User','name','unshift','*,*,*,*','FaxQueue','queueId','Start','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','defaults','redis','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','options','attributes','limit','include','map','model','debug','body','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','CmContact','Contacts','FaxApplication','Applications','get','applications','list'];(function(_0x3f167d,_0x4eb6b0){var _0x57981f=function(_0x230b62){while(--_0x230b62){_0x3f167d['push'](_0x3f167d['shift']());}};_0x57981f(++_0x4eb6b0);}(_0x8151,0x6c));var _0x1815=function(_0x2c7900,_0x44f3b6){_0x2c7900=_0x2c7900-0x0;var _0x35c02f=_0x8151[_0x2c7900];return _0x35c02f;};'use strict';var _=require('lodash');var util=require(_0x1815('0x0'));var moment=require(_0x1815('0x1'));var BPromise=require('bluebird');var rs=require(_0x1815('0x2'));var fs=require('fs');var Redis=require(_0x1815('0x3'));var db=require(_0x1815('0x4'))['db'];var utils=require(_0x1815('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1815('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1815('0x7')]({'port':0x232c});config['redis']=_[_0x1815('0x8')](config[_0x1815('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1815('0xa'))(new Redis(config[_0x1815('0x9')]));require(_0x1815('0xb'))['register'](socket);function respondWithRpcPromise(_0x1cfcdd,_0x2b14f8,_0x562f2b){return new BPromise(function(_0x97bdde,_0x1869e4){return client[_0x1815('0xc')](_0x1cfcdd,_0x562f2b)[_0x1815('0xd')](function(_0x2b6f3b){logger[_0x1815('0xe')](_0x1815('0xf'),_0x2b14f8,_0x1815('0x10'));logger['debug'](_0x1815('0x11'),_0x2b14f8,_0x1815('0x10'),JSON[_0x1815('0x12')](_0x2b6f3b));if(_0x2b6f3b[_0x1815('0x13')]){if(_0x2b6f3b[_0x1815('0x13')][_0x1815('0x14')]===0x1f4){logger[_0x1815('0x13')](_0x1815('0xf'),_0x2b14f8,_0x2b6f3b[_0x1815('0x13')][_0x1815('0x15')]);return _0x1869e4(_0x2b6f3b[_0x1815('0x13')][_0x1815('0x15')]);}logger['error'](_0x1815('0xf'),_0x2b14f8,_0x2b6f3b[_0x1815('0x13')]['message']);return _0x97bdde(_0x2b6f3b['error'][_0x1815('0x15')]);}else{logger[_0x1815('0xe')]('FaxAccount,\x20%s,\x20%s',_0x2b14f8,_0x1815('0x10'));_0x97bdde(_0x2b6f3b[_0x1815('0x16')][_0x1815('0x15')]);}})['catch'](function(_0x39ee48){logger[_0x1815('0x13')](_0x1815('0xf'),_0x2b14f8,_0x39ee48);_0x1869e4(_0x39ee48);});});}exports[_0x1815('0x17')]=function(_0x281752){var _0x4fc2c0=this;return new Promise(function(_0x3de391,_0x47e565){return db['FaxAccount']['findAll']({'raw':_0x281752[_0x1815('0x18')]?_0x281752[_0x1815('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x281752['options']?_0x281752[_0x1815('0x18')]['where']||null:null,'attributes':_0x281752[_0x1815('0x18')]?_0x281752[_0x1815('0x18')][_0x1815('0x19')]||null:null,'limit':_0x281752[_0x1815('0x18')]?_0x281752[_0x1815('0x18')][_0x1815('0x1a')]||null:null,'include':_0x281752[_0x1815('0x18')]?_0x281752[_0x1815('0x18')][_0x1815('0x1b')]?_[_0x1815('0x1c')](_0x281752[_0x1815('0x18')][_0x1815('0x1b')],function(_0x3290df){return{'model':db[_0x3290df[_0x1815('0x1d')]],'as':_0x3290df['as'],'attributes':_0x3290df['attributes'],'include':_0x3290df[_0x1815('0x1b')]?_[_0x1815('0x1c')](_0x3290df[_0x1815('0x1b')],function(_0x335943){return{'model':db[_0x335943[_0x1815('0x1d')]],'as':_0x335943['as'],'attributes':_0x335943[_0x1815('0x19')],'include':_0x335943[_0x1815('0x1b')]?_[_0x1815('0x1c')](_0x335943[_0x1815('0x1b')],function(_0x3aa121){return{'model':db[_0x3aa121[_0x1815('0x1d')]],'as':_0x3aa121['as'],'attributes':_0x3aa121[_0x1815('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bd7ca){logger[_0x1815('0xe')]('GetFaxAccount',_0x281752);logger[_0x1815('0x1e')]('GetFaxAccount',_0x281752,JSON[_0x1815('0x12')](_0x4bd7ca));_0x3de391(_0x4bd7ca);})['catch'](function(_0x889153){logger[_0x1815('0x13')]('GetFaxAccount',_0x889153[_0x1815('0x15')],_0x281752);_0x47e565(_0x4fc2c0[_0x1815('0x13')](0x1f4,_0x889153[_0x1815('0x15')]));});});};exports['NotifyFaxAccount']=function(_0x27b5fc,_0x53dd38,_0x41c80c){var _0x52fcd3=this;return new Promise(function(_0x45d2e6,_0x1f9ad8){var _0x254103={'body':_0x27b5fc[_0x1815('0x1f')],'channel':_0x1815('0x20')};var _0x58ed42=[];var _0x3bc898=[];var _0xae3d41={};return db['CmContact']['describe']()[_0x1815('0xd')](function(_0xa37cdc){if(!_0xa37cdc){throw new db[(_0x1815('0x21'))][(_0x1815('0x22'))](_0x1815('0x23'));}_0x58ed42=_[_0x1815('0x24')](_[_0x1815('0x25')](_0xa37cdc),[_0x1815('0x26'),_0x1815('0x27')]);_0x3bc898=_[_0x1815('0x24')](_[_0x1815('0x25')](_0xa37cdc),[_0x1815('0x26'),_0x1815('0x27'),_0x1815('0x28'),'ListId']);if(_0x27b5fc[_0x1815('0x1f')]['id']){delete _0x27b5fc[_0x1815('0x1f')]['id'];}if(_[_0x1815('0x29')](_0x27b5fc['body'][_0x1815('0x2a')])){throw new db['Sequelize'][(_0x1815('0x22'))](_0x1815('0x2b'));}if(_[_0x1815('0x29')](_0x27b5fc[_0x1815('0x1f')][_0x1815('0x1f')])||_0x27b5fc[_0x1815('0x1f')]['body']===''){throw new db['Sequelize'][(_0x1815('0x22'))](_0x1815('0x2c'));}if(_[_0x1815('0x29')](_0x27b5fc[_0x1815('0x1f')][_0x1815('0x2d')])){throw new db[(_0x1815('0x21'))][(_0x1815('0x22'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3bc898);}if(!_[_0x1815('0x2e')](_0x3bc898,_0x27b5fc[_0x1815('0x1f')]['mapKey'])){throw new db[(_0x1815('0x21'))][(_0x1815('0x22'))](_0x1815('0x2f')+_0x3bc898);}_0xae3d41[_0x27b5fc[_0x1815('0x1f')][_0x1815('0x2d')]]=_0x27b5fc[_0x1815('0x1f')]['from'];})[_0x1815('0xd')](function(){return db['FaxAccount'][_0x1815('0x30')]({'where':{'id':_0x27b5fc[_0x1815('0x31')]['id']},'include':[{'model':db['CmList'],'as':_0x1815('0x32'),'include':[{'model':db[_0x1815('0x33')],'as':_0x1815('0x34'),'where':_0xae3d41,'limit':0x1,'order':[[_0x1815('0x27'),'DESC']]}]},{'model':db[_0x1815('0x35')],'as':_0x1815('0x36')}]});})['then'](function(_0x58f7c2){if(_0x58f7c2&&_0x58f7c2['List']){var _0x351339=_0x58f7c2[_0x1815('0x37')]({'plain':!![]});_0x254103[_0x1815('0x31')]=_0x351339;_0x254103[_0x1815('0x38')]=_0x351339['Applications'];_0x254103[_0x1815('0x39')]=_0x351339[_0x1815('0x32')];_0x254103['applications']=_[_0x1815('0x3a')](_0x254103[_0x1815('0x38')],[_0x1815('0x3b')],[_0x1815('0x3c')]);if(_0x254103[_0x1815('0x31')][_0x1815('0x36')]){delete _0x254103[_0x1815('0x31')][_0x1815('0x36')];}if(_0x254103[_0x1815('0x31')]['List']&&_0x254103[_0x1815('0x31')][_0x1815('0x32')][_0x1815('0x34')]['length']){return _0x254103['account']['List'][_0x1815('0x34')][0x0];}var _0x1d7443=_[_0x1815('0x8')](_0x27b5fc[_0x1815('0x1f')],{'firstName':_0x27b5fc[_0x1815('0x1f')][_0x1815('0x2a')],'ListId':_0x351339[_0x1815('0x3d')]});_0x1d7443[_0x27b5fc[_0x1815('0x1f')]['mapKey']]=_0x27b5fc[_0x1815('0x1f')][_0x1815('0x2a')];return db['CmContact']['create'](_0x1d7443,{'fields':_0x58ed42,'raw':!![]});}})[_0x1815('0xd')](function(_0xaa8457){_0x254103[_0x1815('0x3e')]=_0xaa8457;if(_0xaa8457){var _0x113ebf={'ContactId':_0xaa8457['id'],'FaxAccountId':_0x27b5fc[_0x1815('0x31')]['id'],'fax':_0xaa8457['fax']};return db['FaxInteraction'][_0x1815('0x30')]({'where':{'ContactId':_0xaa8457['id'],'closed':![],'FaxAccountId':_0x27b5fc[_0x1815('0x31')]['id']}})[_0x1815('0xd')](function(_0x44d0b4){if(_0x44d0b4){return[_0x44d0b4,![]];}return db[_0x1815('0x3f')]['create'](_0x113ebf)[_0x1815('0xd')](function(_0x4deb29){return[_0x4deb29,!![]];});});}else{throw new Error(_0x1815('0x40'));}})[_0x1815('0x41')](function(_0x4ee044,_0x45a8d6){var _0x3a1b27=_0x4ee044[_0x1815('0x37')]({'plain':!![]});if(_0x45a8d6){if(_0x254103['account']['autoclose']){_0x254103[_0x1815('0x38')][_0x1815('0x42')]({'id':0x0,'priority':_0x254103['applications'][_0x1815('0x43')]+0x1,'app':_0x1815('0x44'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x3a1b27[_0x1815('0x45')]=!![];}else{_0x3a1b27[_0x1815('0x45')]=![];}_0x254103[_0x1815('0x46')]=_0x3a1b27;return db[_0x1815('0x47')][_0x1815('0x48')]({'body':_0x27b5fc[_0x1815('0x1f')][_0x1815('0x1f')],'FaxAccountId':_0x27b5fc[_0x1815('0x31')]['id'],'FaxInteractionId':_0x4ee044['id'],'direction':'in','ContactId':_0x4ee044['ContactId'],'AttachmentId':_0x27b5fc['body'][_0x1815('0x49')]});})[_0x1815('0xd')](function(_0x1e4f41){_0x254103[_0x1815('0x15')]=_0x1e4f41;if(!_0x254103[_0x1815('0x46')][_0x1815('0x4a')])return;return db[_0x1815('0x4b')][_0x1815('0x30')]({'attributes':['id',_0x1815('0x4c')],'where':{'id':_0x254103[_0x1815('0x46')][_0x1815('0x4a')]}});})[_0x1815('0xd')](function(_0xb81d54){if(_0xb81d54){_0x254103[_0x1815('0x38')][_0x1815('0x4d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xb81d54[_0x1815('0x4c')]+','+(_0x254103[_0x1815('0x31')]['waitForTheAssignedAgent']||0xa),'interval':_0x1815('0x4e')});}if(!_0x254103['interaction']['queueId'])return;return db[_0x1815('0x4f')][_0x1815('0x30')]({'attributes':['id','name'],'where':{'id':_0x254103[_0x1815('0x46')][_0x1815('0x50')]}});})[_0x1815('0xd')](function(_0x77099e){if(_0x77099e){_0x254103['applications'][_0x1815('0x4d')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x77099e[_0x1815('0x4c')]+','+(_0x254103['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x1815('0x4e')});}return respondWithRpcPromise(_0x1815('0x51'),'startRouting',_0x254103);})[_0x1815('0xd')](function(_0x3fe610){_0x45d2e6(_0x3fe610);})[_0x1815('0x52')](function(_0x448fa6){_0x1f9ad8(_0x52fcd3[_0x1815('0x13')](0x1f4,_0x448fa6[_0x1815('0x15')]));});});}; \ No newline at end of file +var _0xe014=['orderBy','priority','asc','account','length','create','FaxInteraction','spread','autoclose','push','close','*,*,*,*','created','interaction','ContactId','AttachmentId','find','UserId','name','queueId','unshift','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','NotifyFaxAccount','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','Contacts','FaxApplication','Applications','get','applications','list','List'];(function(_0x372c3e,_0x4ebb70){var _0x4b5b54=function(_0x1f4e7d){while(--_0x1f4e7d){_0x372c3e['push'](_0x372c3e['shift']());}};_0x4b5b54(++_0x4ebb70);}(_0xe014,0x122));var _0x4e01=function(_0x2a293d,_0x18e752){_0x2a293d=_0x2a293d-0x0;var _0x3b435b=_0xe014[_0x2a293d];return _0x3b435b;};'use strict';var _=require(_0x4e01('0x0'));var util=require(_0x4e01('0x1'));var moment=require(_0x4e01('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e01('0x3'));var fs=require('fs');var Redis=require(_0x4e01('0x4'));var db=require(_0x4e01('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e01('0x6'))('rpc');var config=require(_0x4e01('0x7'));var jayson=require(_0x4e01('0x8'));var client=jayson[_0x4e01('0x9')]['http']({'port':0x232c});config[_0x4e01('0xa')]=_[_0x4e01('0xb')](config[_0x4e01('0xa')],{'host':_0x4e01('0xc'),'port':0x18eb});var socket=require(_0x4e01('0xd'))(new Redis(config[_0x4e01('0xa')]));require(_0x4e01('0xe'))['register'](socket);function respondWithRpcPromise(_0x935ae7,_0x43dc8b,_0x2ace76){return new BPromise(function(_0x5c41e6,_0x14b655){return client[_0x4e01('0xf')](_0x935ae7,_0x2ace76)[_0x4e01('0x10')](function(_0x3e92cc){logger[_0x4e01('0x11')](_0x4e01('0x12'),_0x43dc8b,_0x4e01('0x13'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x43dc8b,_0x4e01('0x13'),JSON[_0x4e01('0x14')](_0x3e92cc));if(_0x3e92cc[_0x4e01('0x15')]){if(_0x3e92cc['error'][_0x4e01('0x16')]===0x1f4){logger[_0x4e01('0x15')](_0x4e01('0x12'),_0x43dc8b,_0x3e92cc[_0x4e01('0x15')][_0x4e01('0x17')]);return _0x14b655(_0x3e92cc[_0x4e01('0x15')]['message']);}logger['error'](_0x4e01('0x12'),_0x43dc8b,_0x3e92cc[_0x4e01('0x15')][_0x4e01('0x17')]);return _0x5c41e6(_0x3e92cc[_0x4e01('0x15')][_0x4e01('0x17')]);}else{logger['info'](_0x4e01('0x12'),_0x43dc8b,_0x4e01('0x13'));_0x5c41e6(_0x3e92cc[_0x4e01('0x18')][_0x4e01('0x17')]);}})[_0x4e01('0x19')](function(_0x134bc9){logger['error'](_0x4e01('0x12'),_0x43dc8b,_0x134bc9);_0x14b655(_0x134bc9);});});}exports[_0x4e01('0x1a')]=function(_0x16fc96){var _0x3b0598=this;return new Promise(function(_0x2701e0,_0x48f05a){return db[_0x4e01('0x1b')][_0x4e01('0x1c')]({'raw':_0x16fc96[_0x4e01('0x1d')]?_0x16fc96[_0x4e01('0x1d')][_0x4e01('0x1e')]===undefined?!![]:![]:!![],'where':_0x16fc96[_0x4e01('0x1d')]?_0x16fc96[_0x4e01('0x1d')][_0x4e01('0x1f')]||null:null,'attributes':_0x16fc96[_0x4e01('0x1d')]?_0x16fc96['options'][_0x4e01('0x20')]||null:null,'limit':_0x16fc96[_0x4e01('0x1d')]?_0x16fc96[_0x4e01('0x1d')][_0x4e01('0x21')]||null:null,'include':_0x16fc96[_0x4e01('0x1d')]?_0x16fc96[_0x4e01('0x1d')][_0x4e01('0x22')]?_[_0x4e01('0x23')](_0x16fc96[_0x4e01('0x1d')]['include'],function(_0x530263){return{'model':db[_0x530263[_0x4e01('0x24')]],'as':_0x530263['as'],'attributes':_0x530263['attributes'],'include':_0x530263[_0x4e01('0x22')]?_['map'](_0x530263[_0x4e01('0x22')],function(_0x7996b8){return{'model':db[_0x7996b8[_0x4e01('0x24')]],'as':_0x7996b8['as'],'attributes':_0x7996b8[_0x4e01('0x20')],'include':_0x7996b8[_0x4e01('0x22')]?_[_0x4e01('0x23')](_0x7996b8[_0x4e01('0x22')],function(_0x3d4e38){return{'model':db[_0x3d4e38[_0x4e01('0x24')]],'as':_0x3d4e38['as'],'attributes':_0x3d4e38[_0x4e01('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4e01('0x10')](function(_0x515385){logger[_0x4e01('0x11')](_0x4e01('0x1a'),_0x16fc96);logger[_0x4e01('0x25')]('GetFaxAccount',_0x16fc96,JSON[_0x4e01('0x14')](_0x515385));_0x2701e0(_0x515385);})[_0x4e01('0x19')](function(_0x191827){logger['error'](_0x4e01('0x1a'),_0x191827[_0x4e01('0x17')],_0x16fc96);_0x48f05a(_0x3b0598['error'](0x1f4,_0x191827[_0x4e01('0x17')]));});});};exports[_0x4e01('0x26')]=function(_0x3e1b6d,_0x5d33fb,_0x2c56ee){var _0xf99527=this;return new Promise(function(_0x1b39ad,_0x2edab1){var _0x417547={'body':_0x3e1b6d['body'],'channel':_0x4e01('0x27')};var _0x250abe=[];var _0x5512c3=[];var _0x23f03c={};return db[_0x4e01('0x28')][_0x4e01('0x29')]()['then'](function(_0xc93bb7){if(!_0xc93bb7){throw new db['Sequelize'][(_0x4e01('0x2a'))](_0x4e01('0x2b'));}_0x250abe=_[_0x4e01('0x2c')](_[_0x4e01('0x2d')](_0xc93bb7),[_0x4e01('0x2e'),_0x4e01('0x2f')]);_0x5512c3=_[_0x4e01('0x2c')](_['keys'](_0xc93bb7),[_0x4e01('0x2e'),'updatedAt',_0x4e01('0x30'),_0x4e01('0x31')]);if(_0x3e1b6d['body']['id']){delete _0x3e1b6d[_0x4e01('0x32')]['id'];}if(_[_0x4e01('0x33')](_0x3e1b6d[_0x4e01('0x32')]['from'])){throw new db[(_0x4e01('0x34'))][(_0x4e01('0x2a'))](_0x4e01('0x35'));}if(_[_0x4e01('0x33')](_0x3e1b6d[_0x4e01('0x32')]['body'])||_0x3e1b6d[_0x4e01('0x32')][_0x4e01('0x32')]===''){throw new db[(_0x4e01('0x34'))][(_0x4e01('0x2a'))](_0x4e01('0x36'));}if(_[_0x4e01('0x33')](_0x3e1b6d['body']['mapKey'])){throw new db[(_0x4e01('0x34'))][(_0x4e01('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5512c3);}if(!_[_0x4e01('0x37')](_0x5512c3,_0x3e1b6d[_0x4e01('0x32')]['mapKey'])){throw new db[(_0x4e01('0x34'))][(_0x4e01('0x2a'))](_0x4e01('0x38')+_0x5512c3);}_0x23f03c[_0x3e1b6d[_0x4e01('0x32')][_0x4e01('0x39')]]=_0x3e1b6d[_0x4e01('0x32')][_0x4e01('0x3a')];})['then'](function(){return db[_0x4e01('0x1b')]['find']({'where':{'id':_0x3e1b6d['account']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4e01('0x28')],'as':_0x4e01('0x3b'),'where':_0x23f03c,'limit':0x1,'order':[[_0x4e01('0x2f'),'DESC']]}]},{'model':db[_0x4e01('0x3c')],'as':_0x4e01('0x3d')}]});})[_0x4e01('0x10')](function(_0x2eb9d8){if(_0x2eb9d8&&_0x2eb9d8['List']){var _0x30a3cf=_0x2eb9d8[_0x4e01('0x3e')]({'plain':!![]});_0x417547['account']=_0x30a3cf;_0x417547[_0x4e01('0x3f')]=_0x30a3cf[_0x4e01('0x3d')];_0x417547[_0x4e01('0x40')]=_0x30a3cf[_0x4e01('0x41')];_0x417547[_0x4e01('0x3f')]=_[_0x4e01('0x42')](_0x417547['applications'],[_0x4e01('0x43')],[_0x4e01('0x44')]);if(_0x417547[_0x4e01('0x45')][_0x4e01('0x3d')]){delete _0x417547['account']['Applications'];}if(_0x417547[_0x4e01('0x45')][_0x4e01('0x41')]&&_0x417547[_0x4e01('0x45')]['List'][_0x4e01('0x3b')][_0x4e01('0x46')]){return _0x417547[_0x4e01('0x45')][_0x4e01('0x41')][_0x4e01('0x3b')][0x0];}var _0x3c22d6=_[_0x4e01('0xb')](_0x3e1b6d[_0x4e01('0x32')],{'firstName':_0x3e1b6d[_0x4e01('0x32')][_0x4e01('0x3a')],'ListId':_0x30a3cf[_0x4e01('0x31')]});_0x3c22d6[_0x3e1b6d[_0x4e01('0x32')][_0x4e01('0x39')]]=_0x3e1b6d['body']['from'];return db[_0x4e01('0x28')][_0x4e01('0x47')](_0x3c22d6,{'fields':_0x250abe,'raw':!![]});}})['then'](function(_0x2bf3aa){_0x417547['contact']=_0x2bf3aa;if(_0x2bf3aa){var _0x30ce66={'ContactId':_0x2bf3aa['id'],'FaxAccountId':_0x3e1b6d[_0x4e01('0x45')]['id'],'fax':_0x2bf3aa[_0x4e01('0x27')]};return db[_0x4e01('0x48')]['find']({'where':{'ContactId':_0x2bf3aa['id'],'closed':![],'FaxAccountId':_0x3e1b6d['account']['id']}})[_0x4e01('0x10')](function(_0x40bc16){if(_0x40bc16){return[_0x40bc16,![]];}return db[_0x4e01('0x48')][_0x4e01('0x47')](_0x30ce66)[_0x4e01('0x10')](function(_0x1bcc37){return[_0x1bcc37,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4e01('0x49')](function(_0x42730c,_0x1e10e0){var _0x148bfe=_0x42730c['get']({'plain':!![]});if(_0x1e10e0){if(_0x417547['account'][_0x4e01('0x4a')]){_0x417547[_0x4e01('0x3f')][_0x4e01('0x4b')]({'id':0x0,'priority':_0x417547[_0x4e01('0x3f')][_0x4e01('0x46')]+0x1,'app':_0x4e01('0x4c'),'appdata':'unmanaged','interval':_0x4e01('0x4d')});}_0x148bfe['created']=!![];}else{_0x148bfe[_0x4e01('0x4e')]=![];}_0x417547[_0x4e01('0x4f')]=_0x148bfe;return db['FaxMessage'][_0x4e01('0x47')]({'body':_0x3e1b6d[_0x4e01('0x32')][_0x4e01('0x32')],'FaxAccountId':_0x3e1b6d[_0x4e01('0x45')]['id'],'FaxInteractionId':_0x42730c['id'],'direction':'in','ContactId':_0x42730c[_0x4e01('0x50')],'AttachmentId':_0x3e1b6d['body'][_0x4e01('0x51')]});})[_0x4e01('0x10')](function(_0x377b67){_0x417547[_0x4e01('0x17')]=_0x377b67;if(!_0x417547['interaction']['UserId'])return;return db['User'][_0x4e01('0x52')]({'attributes':['id','name'],'where':{'id':_0x417547[_0x4e01('0x4f')][_0x4e01('0x53')]}});})['then'](function(_0xef06cd){if(_0xef06cd){_0x417547[_0x4e01('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xef06cd[_0x4e01('0x54')]+','+(_0x417547[_0x4e01('0x45')]['waitForTheAssignedAgent']||0xa),'interval':_0x4e01('0x4d')});}if(!_0x417547[_0x4e01('0x4f')][_0x4e01('0x55')])return;return db['FaxQueue'][_0x4e01('0x52')]({'attributes':['id',_0x4e01('0x54')],'where':{'id':_0x417547[_0x4e01('0x4f')][_0x4e01('0x55')]}});})[_0x4e01('0x10')](function(_0x3741a9){if(_0x3741a9){_0x417547[_0x4e01('0x3f')][_0x4e01('0x56')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3741a9[_0x4e01('0x54')]+','+(_0x417547[_0x4e01('0x45')]['waitForTheAssignedQueue']||0x12c),'interval':_0x4e01('0x4d')});}return respondWithRpcPromise(_0x4e01('0x57'),_0x4e01('0x58'),_0x417547);})['then'](function(_0x38544a){_0x1b39ad(_0x38544a);})[_0x4e01('0x19')](function(_0x3e5a65){_0x2edab1(_0xf99527[_0x4e01('0x15')](0x1f4,_0x3e5a65[_0x4e01('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index d5118bf..5608361 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 _0x8de7=['length','faxAccount:','save','update','register'];(function(_0x762990,_0x4baccc){var _0x561f91=function(_0x1d9823){while(--_0x1d9823){_0x762990['push'](_0x762990['shift']());}};_0x561f91(++_0x4baccc);}(_0x8de7,0x1bf));var _0x78de=function(_0x2a4951,_0x541110){_0x2a4951=_0x2a4951-0x0;var _0x241eff=_0x8de7[_0x2a4951];return _0x241eff;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x78de('0x0'),'remove',_0x78de('0x1')];function createListener(_0x2b6c0d,_0x1367cc){return function(_0xe2a773){_0x1367cc['emit'](_0x2b6c0d,_0xe2a773);};}function removeListener(_0x4d070d,_0x156767){return function(){FaxAccountEvents['removeListener'](_0x4d070d,_0x156767);};}exports[_0x78de('0x2')]=function(_0x4211e7){for(var _0x19f61f=0x0,_0x1d61e4=events[_0x78de('0x3')];_0x19f61f<_0x1d61e4;_0x19f61f++){var _0x1c1ca9=events[_0x19f61f];var _0x5536c8=createListener(_0x78de('0x4')+_0x1c1ca9,_0x4211e7);FaxAccountEvents['on'](_0x1c1ca9,_0x5536c8);}}; \ No newline at end of file +var _0x6f47=['removeListener','register','faxAccount:','./faxAccount.events','save','remove','emit'];(function(_0xb8baa9,_0x3fcc6a){var _0x464bd0=function(_0x3db1c6){while(--_0x3db1c6){_0xb8baa9['push'](_0xb8baa9['shift']());}};_0x464bd0(++_0x3fcc6a);}(_0x6f47,0x106));var _0x76f4=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x6f47[_0x42bc91];return _0x3f5507;};'use strict';var FaxAccountEvents=require(_0x76f4('0x0'));var events=[_0x76f4('0x1'),_0x76f4('0x2'),'update'];function createListener(_0x48e8cc,_0x73fce){return function(_0x1c025f){_0x73fce[_0x76f4('0x3')](_0x48e8cc,_0x1c025f);};}function removeListener(_0x9807d,_0x5243f7){return function(){FaxAccountEvents[_0x76f4('0x4')](_0x9807d,_0x5243f7);};}exports[_0x76f4('0x5')]=function(_0x4cced5){for(var _0x1c87f7=0x0,_0x4a2f68=events['length'];_0x1c87f7<_0x4a2f68;_0x1c87f7++){var _0x30fad4=events[_0x1c87f7];var _0x52067b=createListener(_0x76f4('0x6')+_0x30fad4,_0x4cced5);FaxAccountEvents['on'](_0x30fad4,_0x52067b);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index fc92099..6d83914 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 _0xcab0=['updateAccountApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getAgents','post','create','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcab0,0x8c));var _0x0cab=function(_0x17ef3e,_0x15039f){_0x17ef3e=_0x17ef3e-0x0;var _0x3dc942=_0xcab0[_0x17ef3e];return _0x3dc942;};'use strict';var multer=require(_0x0cab('0x0'));var util=require(_0x0cab('0x1'));var path=require('path');var timeout=require(_0x0cab('0x2'));var express=require(_0x0cab('0x3'));var router=express['Router']();var fs_extra=require(_0x0cab('0x4'));var auth=require(_0x0cab('0x5'));var interaction=require(_0x0cab('0x6'));var config=require(_0x0cab('0x7'));var controller=require('./faxAccount.controller');router[_0x0cab('0x8')]('/',auth[_0x0cab('0x9')](),controller[_0x0cab('0xa')]);router[_0x0cab('0x8')](_0x0cab('0xb'),auth[_0x0cab('0x9')](),controller[_0x0cab('0xc')]);router[_0x0cab('0x8')](_0x0cab('0xd'),auth[_0x0cab('0x9')](),controller[_0x0cab('0xe')]);router[_0x0cab('0x8')](_0x0cab('0xf'),auth['isAuthenticated'](),controller[_0x0cab('0x10')]);router[_0x0cab('0x8')](_0x0cab('0x11'),auth[_0x0cab('0x9')](),controller[_0x0cab('0x12')]);router[_0x0cab('0x8')](_0x0cab('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x0cab('0x14'),auth[_0x0cab('0x9')](),controller[_0x0cab('0x15')]);router[_0x0cab('0x8')](_0x0cab('0x16'),auth[_0x0cab('0x9')](),controller['getMessages']);router[_0x0cab('0x8')]('/:id/users',auth[_0x0cab('0x9')](),controller[_0x0cab('0x17')]);router[_0x0cab('0x18')]('/',auth[_0x0cab('0x9')](),controller[_0x0cab('0x19')]);router[_0x0cab('0x18')]('/:id/dispositions',auth[_0x0cab('0x9')](),controller['addDisposition']);router['post'](_0x0cab('0x11'),auth[_0x0cab('0x9')](),controller[_0x0cab('0x1a')]);router['post'](_0x0cab('0x13'),auth[_0x0cab('0x9')](),controller[_0x0cab('0x1b')]);router['post'](_0x0cab('0x14'),auth[_0x0cab('0x9')](),controller[_0x0cab('0x1c')]);router[_0x0cab('0x18')](_0x0cab('0x1d'),auth[_0x0cab('0x9')](),controller[_0x0cab('0x1e')]);router[_0x0cab('0x18')](_0x0cab('0x1f'),auth['isAuthenticated'](),controller[_0x0cab('0x20')]);router[_0x0cab('0x18')](_0x0cab('0x21'),auth[_0x0cab('0x9')](),controller[_0x0cab('0x22')]);router[_0x0cab('0x18')](_0x0cab('0x23'),auth['isAuthenticated'](),controller[_0x0cab('0x24')]);router[_0x0cab('0x25')](_0x0cab('0xd'),auth[_0x0cab('0x9')](),controller[_0x0cab('0x26')]);router[_0x0cab('0x27')]('/:id',auth[_0x0cab('0x9')](),controller[_0x0cab('0x28')]);router['delete'](_0x0cab('0xf'),auth[_0x0cab('0x9')](),controller[_0x0cab('0x29')]);router['delete'](_0x0cab('0x11'),auth[_0x0cab('0x9')](),controller['removeAnswers']);router[_0x0cab('0x27')](_0x0cab('0x23'),auth['isAuthenticated'](),controller[_0x0cab('0x2a')]);module['exports']=router; \ No newline at end of file +var _0x52be=['/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','create','post','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions'];(function(_0x5aea5f,_0x52f8f9){var _0x1ffbf=function(_0x4cc621){while(--_0x4cc621){_0x5aea5f['push'](_0x5aea5f['shift']());}};_0x1ffbf(++_0x52f8f9);}(_0x52be,0x1db));var _0xe52b=function(_0x54a8d3,_0x12b8b7){_0x54a8d3=_0x54a8d3-0x0;var _0x5eec0e=_0x52be[_0x54a8d3];return _0x5eec0e;};'use strict';var multer=require(_0xe52b('0x0'));var util=require('util');var path=require(_0xe52b('0x1'));var timeout=require(_0xe52b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe52b('0x3'));var interaction=require(_0xe52b('0x4'));var config=require(_0xe52b('0x5'));var controller=require(_0xe52b('0x6'));router[_0xe52b('0x7')]('/',auth[_0xe52b('0x8')](),controller[_0xe52b('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe52b('0xa')]);router[_0xe52b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe52b('0x7')](_0xe52b('0xb'),auth['isAuthenticated'](),controller[_0xe52b('0xc')]);router['get'](_0xe52b('0xd'),auth[_0xe52b('0x8')](),controller[_0xe52b('0xe')]);router[_0xe52b('0x7')](_0xe52b('0xf'),auth[_0xe52b('0x8')](),controller[_0xe52b('0x10')]);router[_0xe52b('0x7')](_0xe52b('0x11'),auth[_0xe52b('0x8')](),controller[_0xe52b('0x12')]);router[_0xe52b('0x7')](_0xe52b('0x13'),auth[_0xe52b('0x8')](),controller[_0xe52b('0x14')]);router[_0xe52b('0x7')](_0xe52b('0x15'),auth['isAuthenticated'](),controller[_0xe52b('0x16')]);router['post']('/',auth[_0xe52b('0x8')](),controller[_0xe52b('0x17')]);router[_0xe52b('0x18')](_0xe52b('0xb'),auth[_0xe52b('0x8')](),controller['addDisposition']);router[_0xe52b('0x18')]('/:id/canned_answers',auth[_0xe52b('0x8')](),controller['addAnswer']);router[_0xe52b('0x18')](_0xe52b('0xf'),auth[_0xe52b('0x8')](),controller[_0xe52b('0x19')]);router['post'](_0xe52b('0x11'),auth[_0xe52b('0x8')](),controller[_0xe52b('0x1a')]);router[_0xe52b('0x18')]('/addaccountapplications',auth[_0xe52b('0x8')](),controller[_0xe52b('0x1b')]);router['post'](_0xe52b('0x1c'),auth[_0xe52b('0x8')](),controller['updateAccountApplications']);router[_0xe52b('0x18')](_0xe52b('0x1d'),auth['isAuthenticated'](),controller[_0xe52b('0x1e')]);router[_0xe52b('0x18')](_0xe52b('0x15'),auth[_0xe52b('0x8')](),controller[_0xe52b('0x1f')]);router[_0xe52b('0x20')]('/:id',auth['isAuthenticated'](),controller[_0xe52b('0x21')]);router[_0xe52b('0x22')](_0xe52b('0x23'),auth[_0xe52b('0x8')](),controller[_0xe52b('0x24')]);router['delete'](_0xe52b('0xb'),auth['isAuthenticated'](),controller[_0xe52b('0x25')]);router[_0xe52b('0x22')]('/:id/canned_answers',auth[_0xe52b('0x8')](),controller[_0xe52b('0x26')]);router['delete'](_0xe52b('0x15'),auth[_0xe52b('0x8')](),controller[_0xe52b('0x27')]);module[_0xe52b('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c8ca0d7..5b5cca4 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 _0x0b73=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x0b73,0xba));var _0x30b7=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x0b73[_0xb24a3e];return _0x4038d7;};'use strict';var Sequelize=require(_0x30b7('0x0'));module['exports']={'priority':{'type':Sequelize[_0x30b7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x30b7('0x2')],'allowNull':![],'defaultValue':_0x30b7('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x30b7('0x2')],'defaultValue':_0x30b7('0x4')}}; \ No newline at end of file +var _0x61fc=['*,*,*,*','sequelize','exports','STRING'];(function(_0x1ea02b,_0x1d88fc){var _0x5dc711=function(_0x576f12){while(--_0x576f12){_0x1ea02b['push'](_0x1ea02b['shift']());}};_0x5dc711(++_0x1d88fc);}(_0x61fc,0x1a5));var _0xc61f=function(_0x4493e6,_0xc3d640){_0x4493e6=_0x4493e6-0x0;var _0x56a366=_0x61fc[_0x4493e6];return _0x56a366;};'use strict';var Sequelize=require(_0xc61f('0x0'));module[_0xc61f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc61f('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc61f('0x2')]},'interval':{'type':Sequelize[_0xc61f('0x2')],'defaultValue':_0xc61f('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c92a24c..4a07390 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 _0xc0c0=['where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x5acd18,_0x4f2136){var _0x239693=function(_0x347d41){while(--_0x347d41){_0x5acd18['push'](_0x5acd18['shift']());}};_0x239693(++_0x4f2136);}(_0xc0c0,0x174));var _0x0c0c=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xc0c0[_0xda464c];return _0x19e222;};'use strict';var emlformat=require(_0x0c0c('0x0'));var rimraf=require(_0x0c0c('0x1'));var zipdir=require(_0x0c0c('0x2'));var jsonpatch=require(_0x0c0c('0x3'));var rp=require('request-promise');var moment=require(_0x0c0c('0x4'));var BPromise=require(_0x0c0c('0x5'));var Mustache=require(_0x0c0c('0x6'));var util=require('util');var path=require(_0x0c0c('0x7'));var sox=require(_0x0c0c('0x8'));var csv=require('to-csv');var ejs=require(_0x0c0c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c0c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0c0c('0xb'));var deskjs=require(_0x0c0c('0xc'));var toCsv=require(_0x0c0c('0xd'));var querystring=require(_0x0c0c('0xe'));var Papa=require('papaparse');var Redis=require(_0x0c0c('0xf'));var authService=require(_0x0c0c('0x10'));var qs=require(_0x0c0c('0x11'));var as=require(_0x0c0c('0x12'));var hardwareService=require(_0x0c0c('0x13'));var logger=require(_0x0c0c('0x14'))(_0x0c0c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c0c('0x16'))['db'];function respondWithStatusCode(_0x535877,_0x1d84d0){_0x1d84d0=_0x1d84d0||0xcc;return function(_0x17e191){if(_0x17e191){return _0x535877[_0x0c0c('0x17')](_0x1d84d0);}return _0x535877[_0x0c0c('0x18')](_0x1d84d0)[_0x0c0c('0x19')]();};}function respondWithResult(_0x1603e4,_0x3335b3){_0x3335b3=_0x3335b3||0xc8;return function(_0x555e79){if(_0x555e79){return _0x1603e4[_0x0c0c('0x18')](_0x3335b3)[_0x0c0c('0x1a')](_0x555e79);}};}function respondWithFilteredResult(_0x10519f,_0x24fa50){return function(_0x43672b){if(_0x43672b){var _0x406d1c=typeof _0x24fa50[_0x0c0c('0x1b')]==='undefined'&&typeof _0x24fa50[_0x0c0c('0x1c')]===_0x0c0c('0x1d');var _0x53f78d=_0x43672b[_0x0c0c('0x1e')];var _0x148944=_0x406d1c?0x0:_0x24fa50['offset'];var _0x398ef5=_0x406d1c?_0x43672b[_0x0c0c('0x1e')]:_0x24fa50[_0x0c0c('0x1b')]+_0x24fa50[_0x0c0c('0x1c')];var _0x189cac;if(_0x398ef5>=_0x53f78d){_0x398ef5=_0x53f78d;_0x189cac=0xc8;}else{_0x189cac=0xce;}_0x10519f[_0x0c0c('0x18')](_0x189cac);return _0x10519f[_0x0c0c('0x1f')](_0x0c0c('0x20'),_0x148944+'-'+_0x398ef5+'/'+_0x53f78d)['json'](_0x43672b);}return null;};}function patchUpdates(_0x2a8789){return function(_0x387bcd){try{jsonpatch['apply'](_0x387bcd,_0x2a8789,!![]);}catch(_0x4e2705){return BPromise['reject'](_0x4e2705);}return _0x387bcd['save']();};}function saveUpdates(_0xb7efef,_0x5eda6d){return function(_0x258917){if(_0x258917){return _0x258917['update'](_0xb7efef)[_0x0c0c('0x21')](function(_0x39a402){return _0x39a402;});}return null;};}function removeEntity(_0x5cbe4c,_0x5c06d4){return function(_0x4b4129){if(_0x4b4129){return _0x4b4129[_0x0c0c('0x22')]()[_0x0c0c('0x21')](function(){_0x5cbe4c[_0x0c0c('0x18')](0xcc)[_0x0c0c('0x19')]();});}};}function handleEntityNotFound(_0x50df3a,_0x1423f1){return function(_0x384e0d){if(!_0x384e0d){_0x50df3a[_0x0c0c('0x17')](0x194);}return _0x384e0d;};}function handleError(_0x2265af,_0x276dc7){_0x276dc7=_0x276dc7||0x1f4;return function(_0x3a7f71){logger[_0x0c0c('0x23')](_0x3a7f71[_0x0c0c('0x24')]);if(_0x3a7f71[_0x0c0c('0x25')]){delete _0x3a7f71['name'];}_0x2265af[_0x0c0c('0x18')](_0x276dc7)[_0x0c0c('0x26')](_0x3a7f71);};}exports[_0x0c0c('0x27')]=function(_0x15cc63,_0x2b4791){var _0x354c85={},_0x50d897={},_0x399953={'count':0x0,'rows':[]};var _0x4d71e0=_['map'](db[_0x0c0c('0x28')][_0x0c0c('0x29')],function(_0x235378){return{'name':_0x235378['fieldName'],'type':_0x235378[_0x0c0c('0x2a')][_0x0c0c('0x2b')]};});_0x50d897[_0x0c0c('0x2c')]=_['map'](_0x4d71e0,_0x0c0c('0x25'));_0x50d897[_0x0c0c('0x2d')]=_[_0x0c0c('0x2e')](_0x15cc63['query']);_0x50d897[_0x0c0c('0x2f')]=_['intersection'](_0x50d897['model'],_0x50d897[_0x0c0c('0x2d')]);_0x354c85[_0x0c0c('0x30')]=_[_0x0c0c('0x31')](_0x50d897['model'],qs[_0x0c0c('0x32')](_0x15cc63['query']['fields']));_0x354c85[_0x0c0c('0x30')]=_0x354c85['attributes'][_0x0c0c('0x33')]?_0x354c85['attributes']:_0x50d897[_0x0c0c('0x2c')];if(!_0x15cc63[_0x0c0c('0x2d')][_0x0c0c('0x34')](_0x0c0c('0x35'))){_0x354c85['limit']=qs[_0x0c0c('0x1c')](_0x15cc63[_0x0c0c('0x2d')][_0x0c0c('0x1c')]);_0x354c85[_0x0c0c('0x1b')]=qs[_0x0c0c('0x1b')](_0x15cc63['query'][_0x0c0c('0x1b')]);}_0x354c85['order']=qs['sort'](_0x15cc63[_0x0c0c('0x2d')]['sort']);_0x354c85[_0x0c0c('0x36')]=qs['filters'](_[_0x0c0c('0x37')](_0x15cc63[_0x0c0c('0x2d')],_0x50d897[_0x0c0c('0x2f')]),_0x4d71e0);if(_0x15cc63['query'][_0x0c0c('0x38')]){_0x354c85[_0x0c0c('0x36')]=_[_0x0c0c('0x39')](_0x354c85[_0x0c0c('0x36')],{'$or':_[_0x0c0c('0x3a')](_0x4d71e0,function(_0x568238){if(_0x568238[_0x0c0c('0x2a')]!==_0x0c0c('0x3b')){var _0x4a915c={};_0x4a915c[_0x568238[_0x0c0c('0x25')]]={'$like':'%'+_0x15cc63[_0x0c0c('0x2d')]['filter']+'%'};return _0x4a915c;}})});}_0x354c85=_[_0x0c0c('0x39')]({},_0x354c85,_0x15cc63[_0x0c0c('0x3c')]);var _0x202a09={'where':_0x354c85[_0x0c0c('0x36')]};return db['FaxApplication']['count'](_0x202a09)[_0x0c0c('0x21')](function(_0x1e94db){_0x399953['count']=_0x1e94db;if(_0x15cc63[_0x0c0c('0x2d')]['includeAll']){_0x354c85[_0x0c0c('0x3d')]=[{'all':!![]}];}return db[_0x0c0c('0x28')]['findAll'](_0x354c85);})[_0x0c0c('0x21')](function(_0x52a88d){_0x399953[_0x0c0c('0x3e')]=_0x52a88d;return _0x399953;})[_0x0c0c('0x21')](respondWithFilteredResult(_0x2b4791,_0x354c85))[_0x0c0c('0x3f')](handleError(_0x2b4791,null));};exports[_0x0c0c('0x40')]=function(_0x123aa0,_0x3fb437){var _0x141f46={'raw':!![],'where':{'id':_0x123aa0[_0x0c0c('0x41')]['id']}},_0x29e072={};_0x29e072[_0x0c0c('0x2c')]=_[_0x0c0c('0x2e')](db[_0x0c0c('0x28')][_0x0c0c('0x29')]);_0x29e072[_0x0c0c('0x2d')]=_[_0x0c0c('0x2e')](_0x123aa0[_0x0c0c('0x2d')]);_0x29e072[_0x0c0c('0x2f')]=_[_0x0c0c('0x31')](_0x29e072['model'],_0x29e072[_0x0c0c('0x2d')]);_0x141f46['attributes']=_[_0x0c0c('0x31')](_0x29e072['model'],qs['fields'](_0x123aa0[_0x0c0c('0x2d')]['fields']));_0x141f46[_0x0c0c('0x30')]=_0x141f46[_0x0c0c('0x30')][_0x0c0c('0x33')]?_0x141f46[_0x0c0c('0x30')]:_0x29e072[_0x0c0c('0x2c')];if(_0x123aa0[_0x0c0c('0x2d')][_0x0c0c('0x42')]){_0x141f46[_0x0c0c('0x3d')]=[{'all':!![]}];}_0x141f46=_[_0x0c0c('0x39')]({},_0x141f46,_0x123aa0[_0x0c0c('0x3c')]);return db[_0x0c0c('0x28')][_0x0c0c('0x43')](_0x141f46)['then'](handleEntityNotFound(_0x3fb437,null))[_0x0c0c('0x21')](respondWithResult(_0x3fb437,null))[_0x0c0c('0x3f')](handleError(_0x3fb437,null));};exports['create']=function(_0x14fd81,_0x4beb25){return db[_0x0c0c('0x28')][_0x0c0c('0x44')](_0x14fd81[_0x0c0c('0x45')],{})[_0x0c0c('0x21')](respondWithResult(_0x4beb25,0xc9))['catch'](handleError(_0x4beb25,null));};exports[_0x0c0c('0x46')]=function(_0x568216,_0x1e711b){if(_0x568216[_0x0c0c('0x45')]['id']){delete _0x568216[_0x0c0c('0x45')]['id'];}return db[_0x0c0c('0x28')]['find']({'where':{'id':_0x568216[_0x0c0c('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e711b,null))[_0x0c0c('0x21')](saveUpdates(_0x568216[_0x0c0c('0x45')],null))[_0x0c0c('0x21')](respondWithResult(_0x1e711b,null))[_0x0c0c('0x3f')](handleError(_0x1e711b,null));};exports['destroy']=function(_0x13bd19,_0x3b9ce4){return db['FaxApplication'][_0x0c0c('0x43')]({'where':{'id':_0x13bd19[_0x0c0c('0x41')]['id']}})[_0x0c0c('0x21')](handleEntityNotFound(_0x3b9ce4,null))['then'](removeEntity(_0x3b9ce4,null))[_0x0c0c('0x3f')](handleError(_0x3b9ce4,null));}; \ No newline at end of file +var _0x63f2=['name','send','index','map','FaxApplication','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','rimraf','fast-json-patch','mustache','util','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','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x79e7e2,_0xef97c7){var _0x2b9f81=function(_0x4e677e){while(--_0x4e677e){_0x79e7e2['push'](_0x79e7e2['shift']());}};_0x2b9f81(++_0xef97c7);}(_0x63f2,0x6b));var _0x263f=function(_0x28473b,_0x2011ad){_0x28473b=_0x28473b-0x0;var _0x460c92=_0x63f2[_0x28473b];return _0x460c92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x263f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x263f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x263f('0x2'));var util=require(_0x263f('0x3'));var path=require('path');var sox=require(_0x263f('0x4'));var csv=require(_0x263f('0x5'));var ejs=require(_0x263f('0x6'));var fs=require('fs');var fs_extra=require(_0x263f('0x7'));var _=require(_0x263f('0x8'));var squel=require(_0x263f('0x9'));var crypto=require(_0x263f('0xa'));var jsforce=require(_0x263f('0xb'));var deskjs=require(_0x263f('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x263f('0xd'));var Redis=require('ioredis');var authService=require(_0x263f('0xe'));var qs=require(_0x263f('0xf'));var as=require(_0x263f('0x10'));var hardwareService=require(_0x263f('0x11'));var logger=require('../../config/logger')(_0x263f('0x12'));var utils=require(_0x263f('0x13'));var config=require(_0x263f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x263f('0x15'))['db'];function respondWithStatusCode(_0x555349,_0xd253ed){_0xd253ed=_0xd253ed||0xcc;return function(_0x1d5aba){if(_0x1d5aba){return _0x555349['sendStatus'](_0xd253ed);}return _0x555349[_0x263f('0x16')](_0xd253ed)[_0x263f('0x17')]();};}function respondWithResult(_0x4369a6,_0x86480){_0x86480=_0x86480||0xc8;return function(_0x5ad073){if(_0x5ad073){return _0x4369a6[_0x263f('0x16')](_0x86480)[_0x263f('0x18')](_0x5ad073);}};}function respondWithFilteredResult(_0x5235e9,_0x1a064c){return function(_0x49e954){if(_0x49e954){var _0x483826=typeof _0x1a064c[_0x263f('0x19')]===_0x263f('0x1a')&&typeof _0x1a064c[_0x263f('0x1b')]===_0x263f('0x1a');var _0x1a2d52=_0x49e954[_0x263f('0x1c')];var _0x45385e=_0x483826?0x0:_0x1a064c[_0x263f('0x19')];var _0x105b76=_0x483826?_0x49e954[_0x263f('0x1c')]:_0x1a064c[_0x263f('0x19')]+_0x1a064c[_0x263f('0x1b')];var _0x54805d;if(_0x105b76>=_0x1a2d52){_0x105b76=_0x1a2d52;_0x54805d=0xc8;}else{_0x54805d=0xce;}_0x5235e9['status'](_0x54805d);return _0x5235e9[_0x263f('0x1d')](_0x263f('0x1e'),_0x45385e+'-'+_0x105b76+'/'+_0x1a2d52)[_0x263f('0x18')](_0x49e954);}return null;};}function patchUpdates(_0x59e9bd){return function(_0xdf0067){try{jsonpatch[_0x263f('0x1f')](_0xdf0067,_0x59e9bd,!![]);}catch(_0x24a11a){return BPromise[_0x263f('0x20')](_0x24a11a);}return _0xdf0067[_0x263f('0x21')]();};}function saveUpdates(_0x165e17,_0x2366f1){return function(_0x2927e7){if(_0x2927e7){return _0x2927e7[_0x263f('0x22')](_0x165e17)[_0x263f('0x23')](function(_0x209381){return _0x209381;});}return null;};}function removeEntity(_0x1f7c74,_0x595134){return function(_0x1c2153){if(_0x1c2153){return _0x1c2153[_0x263f('0x24')]()[_0x263f('0x23')](function(){_0x1f7c74['status'](0xcc)[_0x263f('0x17')]();});}};}function handleEntityNotFound(_0x30f6a4,_0x7b9a7){return function(_0x480b67){if(!_0x480b67){_0x30f6a4['sendStatus'](0x194);}return _0x480b67;};}function handleError(_0x2d007c,_0x4108b7){_0x4108b7=_0x4108b7||0x1f4;return function(_0x257f62){logger[_0x263f('0x25')](_0x257f62[_0x263f('0x26')]);if(_0x257f62[_0x263f('0x27')]){delete _0x257f62[_0x263f('0x27')];}_0x2d007c[_0x263f('0x16')](_0x4108b7)[_0x263f('0x28')](_0x257f62);};}exports[_0x263f('0x29')]=function(_0x55ee25,_0x4762be){var _0x4f5196={},_0x3e8489={},_0x2082d5={'count':0x0,'rows':[]};var _0xecd9d6=_[_0x263f('0x2a')](db[_0x263f('0x2b')]['rawAttributes'],function(_0x1b96e4){return{'name':_0x1b96e4[_0x263f('0x2c')],'type':_0x1b96e4['type'][_0x263f('0x2d')]};});_0x3e8489[_0x263f('0x2e')]=_[_0x263f('0x2a')](_0xecd9d6,_0x263f('0x27'));_0x3e8489['query']=_[_0x263f('0x2f')](_0x55ee25[_0x263f('0x30')]);_0x3e8489['filters']=_[_0x263f('0x31')](_0x3e8489[_0x263f('0x2e')],_0x3e8489[_0x263f('0x30')]);_0x4f5196[_0x263f('0x32')]=_[_0x263f('0x31')](_0x3e8489[_0x263f('0x2e')],qs[_0x263f('0x33')](_0x55ee25['query']['fields']));_0x4f5196[_0x263f('0x32')]=_0x4f5196[_0x263f('0x32')][_0x263f('0x34')]?_0x4f5196['attributes']:_0x3e8489[_0x263f('0x2e')];if(!_0x55ee25['query'][_0x263f('0x35')](_0x263f('0x36'))){_0x4f5196[_0x263f('0x1b')]=qs[_0x263f('0x1b')](_0x55ee25[_0x263f('0x30')][_0x263f('0x1b')]);_0x4f5196[_0x263f('0x19')]=qs[_0x263f('0x19')](_0x55ee25[_0x263f('0x30')][_0x263f('0x19')]);}_0x4f5196[_0x263f('0x37')]=qs[_0x263f('0x38')](_0x55ee25[_0x263f('0x30')][_0x263f('0x38')]);_0x4f5196[_0x263f('0x39')]=qs[_0x263f('0x3a')](_[_0x263f('0x3b')](_0x55ee25[_0x263f('0x30')],_0x3e8489[_0x263f('0x3a')]),_0xecd9d6);if(_0x55ee25['query'][_0x263f('0x3c')]){_0x4f5196[_0x263f('0x39')]=_[_0x263f('0x3d')](_0x4f5196[_0x263f('0x39')],{'$or':_[_0x263f('0x2a')](_0xecd9d6,function(_0x24cd64){if(_0x24cd64['type']!==_0x263f('0x3e')){var _0xb7237f={};_0xb7237f[_0x24cd64['name']]={'$like':'%'+_0x55ee25[_0x263f('0x30')][_0x263f('0x3c')]+'%'};return _0xb7237f;}})});}_0x4f5196=_[_0x263f('0x3d')]({},_0x4f5196,_0x55ee25[_0x263f('0x3f')]);var _0x2bcf7a={'where':_0x4f5196[_0x263f('0x39')]};return db[_0x263f('0x2b')][_0x263f('0x1c')](_0x2bcf7a)['then'](function(_0x10930e){_0x2082d5['count']=_0x10930e;if(_0x55ee25[_0x263f('0x30')][_0x263f('0x40')]){_0x4f5196[_0x263f('0x41')]=[{'all':!![]}];}return db[_0x263f('0x2b')][_0x263f('0x42')](_0x4f5196);})[_0x263f('0x23')](function(_0x58427b){_0x2082d5[_0x263f('0x43')]=_0x58427b;return _0x2082d5;})[_0x263f('0x23')](respondWithFilteredResult(_0x4762be,_0x4f5196))[_0x263f('0x44')](handleError(_0x4762be,null));};exports[_0x263f('0x45')]=function(_0x3b1c44,_0x1ca8a5){var _0x909f83={'raw':!![],'where':{'id':_0x3b1c44[_0x263f('0x46')]['id']}},_0x207d97={};_0x207d97[_0x263f('0x2e')]=_[_0x263f('0x2f')](db[_0x263f('0x2b')]['rawAttributes']);_0x207d97['query']=_['keys'](_0x3b1c44[_0x263f('0x30')]);_0x207d97[_0x263f('0x3a')]=_[_0x263f('0x31')](_0x207d97['model'],_0x207d97[_0x263f('0x30')]);_0x909f83[_0x263f('0x32')]=_[_0x263f('0x31')](_0x207d97[_0x263f('0x2e')],qs[_0x263f('0x33')](_0x3b1c44[_0x263f('0x30')][_0x263f('0x33')]));_0x909f83[_0x263f('0x32')]=_0x909f83[_0x263f('0x32')]['length']?_0x909f83['attributes']:_0x207d97['model'];if(_0x3b1c44[_0x263f('0x30')]['includeAll']){_0x909f83['include']=[{'all':!![]}];}_0x909f83=_[_0x263f('0x3d')]({},_0x909f83,_0x3b1c44[_0x263f('0x3f')]);return db[_0x263f('0x2b')][_0x263f('0x47')](_0x909f83)[_0x263f('0x23')](handleEntityNotFound(_0x1ca8a5,null))[_0x263f('0x23')](respondWithResult(_0x1ca8a5,null))[_0x263f('0x44')](handleError(_0x1ca8a5,null));};exports['create']=function(_0xaa97b9,_0x495fd1){return db['FaxApplication']['create'](_0xaa97b9[_0x263f('0x48')],{})['then'](respondWithResult(_0x495fd1,0xc9))[_0x263f('0x44')](handleError(_0x495fd1,null));};exports['update']=function(_0x4affb2,_0x5c389b){if(_0x4affb2[_0x263f('0x48')]['id']){delete _0x4affb2[_0x263f('0x48')]['id'];}return db[_0x263f('0x2b')][_0x263f('0x47')]({'where':{'id':_0x4affb2['params']['id']}})[_0x263f('0x23')](handleEntityNotFound(_0x5c389b,null))[_0x263f('0x23')](saveUpdates(_0x4affb2[_0x263f('0x48')],null))[_0x263f('0x23')](respondWithResult(_0x5c389b,null))['catch'](handleError(_0x5c389b,null));};exports[_0x263f('0x24')]=function(_0x6487f0,_0x3616f6){return db[_0x263f('0x2b')]['find']({'where':{'id':_0x6487f0[_0x263f('0x46')]['id']}})[_0x263f('0x23')](handleEntityNotFound(_0x3616f6,null))[_0x263f('0x23')](removeEntity(_0x3616f6,null))[_0x263f('0x44')](handleError(_0x3616f6,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index bd1bdbf..dd42a76 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 _0x2bba=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x2bba,0xbd));var _0xa2bb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2bba[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa2bb('0x0'));var util=require(_0xa2bb('0x1'));var logger=require(_0xa2bb('0x2'))(_0xa2bb('0x3'));var moment=require(_0xa2bb('0x4'));var BPromise=require(_0xa2bb('0x5'));var rp=require(_0xa2bb('0x6'));var fs=require('fs');var path=require(_0xa2bb('0x7'));var rimraf=require(_0xa2bb('0x8'));var config=require(_0xa2bb('0x9'));var attributes=require(_0xa2bb('0xa'));module[_0xa2bb('0xb')]=function(_0xffbfd3,_0x3b08b3){return _0xffbfd3[_0xa2bb('0xc')](_0xa2bb('0xd'),attributes,{'tableName':_0xa2bb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa2bb('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa232=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x2e311b,_0x457f3d){var _0x5f45b6=function(_0x141ed7){while(--_0x141ed7){_0x2e311b['push'](_0x2e311b['shift']());}};_0x5f45b6(++_0x457f3d);}(_0xa232,0x1c5));var _0x2a23=function(_0x95a626,_0x42a215){_0x95a626=_0x95a626-0x0;var _0x244929=_0xa232[_0x95a626];return _0x244929;};'use strict';var _=require('lodash');var util=require(_0x2a23('0x0'));var logger=require(_0x2a23('0x1'))(_0x2a23('0x2'));var moment=require(_0x2a23('0x3'));var BPromise=require(_0x2a23('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a23('0x5'));var rimraf=require(_0x2a23('0x6'));var config=require(_0x2a23('0x7'));var attributes=require('./faxApplication.attributes');module[_0x2a23('0x8')]=function(_0x5dcafe,_0x66c8a){return _0x5dcafe[_0x2a23('0x9')](_0x2a23('0xa'),attributes,{'tableName':_0x2a23('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2a23('0xc'),'collate':_0x2a23('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f759bae..bce21b7 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 _0x00a3=['body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxApplication','update'];(function(_0x4ccf74,_0x145073){var _0x1242f1=function(_0x1d03c9){while(--_0x1d03c9){_0x4ccf74['push'](_0x4ccf74['shift']());}};_0x1242f1(++_0x145073);}(_0x00a3,0x87));var _0x300a=function(_0x4b39a2,_0x2464c4){_0x4b39a2=_0x4b39a2-0x0;var _0x15d4ea=_0x00a3[_0x4b39a2];return _0x15d4ea;};'use strict';var _=require(_0x300a('0x0'));var util=require(_0x300a('0x1'));var moment=require(_0x300a('0x2'));var BPromise=require(_0x300a('0x3'));var rs=require(_0x300a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300a('0x5'))['db'];var utils=require(_0x300a('0x6'));var logger=require('../../config/logger')(_0x300a('0x7'));var config=require(_0x300a('0x8'));var jayson=require(_0x300a('0x9'));var client=jayson[_0x300a('0xa')][_0x300a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x190ae4,_0x5d6894,_0x1958d9){return new BPromise(function(_0x11cb53,_0xa9835e){return client['request'](_0x190ae4,_0x1958d9)[_0x300a('0xc')](function(_0x134ad3){logger['info'](_0x300a('0xd'),_0x5d6894,_0x300a('0xe'));logger['debug'](_0x300a('0xf'),_0x5d6894,'request\x20sent',JSON[_0x300a('0x10')](_0x134ad3));if(_0x134ad3[_0x300a('0x11')]){if(_0x134ad3[_0x300a('0x11')][_0x300a('0x12')]===0x1f4){logger[_0x300a('0x11')](_0x300a('0xd'),_0x5d6894,_0x134ad3[_0x300a('0x11')]['message']);return _0xa9835e(_0x134ad3[_0x300a('0x11')][_0x300a('0x13')]);}logger[_0x300a('0x11')](_0x300a('0xd'),_0x5d6894,_0x134ad3['error'][_0x300a('0x13')]);return _0x11cb53(_0x134ad3[_0x300a('0x11')][_0x300a('0x13')]);}else{logger[_0x300a('0x14')]('FaxApplication,\x20%s,\x20%s',_0x5d6894,_0x300a('0xe'));_0x11cb53(_0x134ad3[_0x300a('0x15')][_0x300a('0x13')]);}})[_0x300a('0x16')](function(_0x3c018e){logger[_0x300a('0x11')](_0x300a('0xd'),_0x5d6894,_0x3c018e);_0xa9835e(_0x3c018e);});});}exports['UpdateFaxApplication']=function(_0xabd6a){var _0x43c10b=this;return new Promise(function(_0x349928,_0x5f1921){return db[_0x300a('0x17')][_0x300a('0x18')](_0xabd6a[_0x300a('0x19')],{'raw':_0xabd6a['options']?_0xabd6a[_0x300a('0x1a')][_0x300a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xabd6a[_0x300a('0x1a')]?_0xabd6a['options'][_0x300a('0x1c')]||null:null,'attributes':_0xabd6a[_0x300a('0x1a')]?_0xabd6a[_0x300a('0x1a')][_0x300a('0x1d')]||null:null,'limit':_0xabd6a[_0x300a('0x1a')]?_0xabd6a[_0x300a('0x1a')][_0x300a('0x1e')]||null:null})['then'](function(_0x3f0807){logger[_0x300a('0x14')](_0x300a('0x1f'),_0xabd6a);logger['debug'](_0x300a('0x1f'),_0xabd6a,JSON['stringify'](_0x3f0807));_0x349928(_0x3f0807);})[_0x300a('0x16')](function(_0x325fb1){logger[_0x300a('0x11')](_0x300a('0x1f'),_0x325fb1[_0x300a('0x13')],_0xabd6a);_0x5f1921(_0x43c10b[_0x300a('0x11')](0x1f4,_0x325fb1['message']));});});}; \ No newline at end of file +var _0x3464=['error','code','message','result','FaxApplication','options','raw','where','attributes','limit','UpdateFaxApplication','debug','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x50a10e,_0x38ab0b){var _0x4942e4=function(_0x1411d8){while(--_0x1411d8){_0x50a10e['push'](_0x50a10e['shift']());}};_0x4942e4(++_0x38ab0b);}(_0x3464,0x16e));var _0x4346=function(_0x186704,_0x4b16ac){_0x186704=_0x186704-0x0;var _0x1cfd92=_0x3464[_0x186704];return _0x1cfd92;};'use strict';var _=require(_0x4346('0x0'));var util=require(_0x4346('0x1'));var moment=require(_0x4346('0x2'));var BPromise=require(_0x4346('0x3'));var rs=require(_0x4346('0x4'));var fs=require('fs');var Redis=require(_0x4346('0x5'));var db=require(_0x4346('0x6'))['db'];var utils=require(_0x4346('0x7'));var logger=require(_0x4346('0x8'))(_0x4346('0x9'));var config=require(_0x4346('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4346('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x243c58,_0x367718,_0x1d06d4){return new BPromise(function(_0x2e2f80,_0x4fc76a){return client[_0x4346('0xc')](_0x243c58,_0x1d06d4)[_0x4346('0xd')](function(_0x3114fe){logger[_0x4346('0xe')](_0x4346('0xf'),_0x367718,_0x4346('0x10'));logger['debug'](_0x4346('0x11'),_0x367718,_0x4346('0x10'),JSON['stringify'](_0x3114fe));if(_0x3114fe[_0x4346('0x12')]){if(_0x3114fe[_0x4346('0x12')][_0x4346('0x13')]===0x1f4){logger[_0x4346('0x12')]('FaxApplication,\x20%s,\x20%s',_0x367718,_0x3114fe['error'][_0x4346('0x14')]);return _0x4fc76a(_0x3114fe[_0x4346('0x12')][_0x4346('0x14')]);}logger[_0x4346('0x12')](_0x4346('0xf'),_0x367718,_0x3114fe[_0x4346('0x12')][_0x4346('0x14')]);return _0x2e2f80(_0x3114fe[_0x4346('0x12')][_0x4346('0x14')]);}else{logger[_0x4346('0xe')](_0x4346('0xf'),_0x367718,_0x4346('0x10'));_0x2e2f80(_0x3114fe[_0x4346('0x15')]['message']);}})['catch'](function(_0x151ab7){logger[_0x4346('0x12')](_0x4346('0xf'),_0x367718,_0x151ab7);_0x4fc76a(_0x151ab7);});});}exports['UpdateFaxApplication']=function(_0x213aca){var _0x59ebc9=this;return new Promise(function(_0x3301ef,_0x54a61d){return db[_0x4346('0x16')]['update'](_0x213aca['body'],{'raw':_0x213aca[_0x4346('0x17')]?_0x213aca[_0x4346('0x17')][_0x4346('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x213aca['options']?_0x213aca['options'][_0x4346('0x19')]||null:null,'attributes':_0x213aca[_0x4346('0x17')]?_0x213aca[_0x4346('0x17')][_0x4346('0x1a')]||null:null,'limit':_0x213aca[_0x4346('0x17')]?_0x213aca[_0x4346('0x17')][_0x4346('0x1b')]||null:null})[_0x4346('0xd')](function(_0x46a01b){logger[_0x4346('0xe')](_0x4346('0x1c'),_0x213aca);logger[_0x4346('0x1d')](_0x4346('0x1c'),_0x213aca,JSON[_0x4346('0x1e')](_0x46a01b));_0x3301ef(_0x46a01b);})[_0x4346('0x1f')](function(_0x3da5c5){logger[_0x4346('0x12')](_0x4346('0x1c'),_0x3da5c5[_0x4346('0x14')],_0x213aca);_0x54a61d(_0x59ebc9[_0x4346('0x12')](0x1f4,_0x3da5c5[_0x4346('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 272253c..a3c96fc 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 _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x564805,_0x4a3cdb){_0x564805=_0x564805-0x0;var _0x5ce027=_0x9ffd[_0x564805];return _0x5ce027;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0x7708=['multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','delete','destroy'];(function(_0x4fdbc1,_0x5067e0){var _0x2261e7=function(_0x2032f4){while(--_0x2032f4){_0x4fdbc1['push'](_0x4fdbc1['shift']());}};_0x2261e7(++_0x5067e0);}(_0x7708,0x188));var _0x8770=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x7708[_0x5400b];return _0x36a39b;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./faxApplication.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0xa')]('/',auth[_0x8770('0x8')](),controller['create']);router[_0x8770('0xb')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller['update']);router[_0x8770('0xc')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4a05394..b64f400 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 _0x323f=['out','INTEGER','exports','DATE','STRING','ENUM'];(function(_0x11c9a4,_0x27be7e){var _0xe7ff5a=function(_0x31bce6){while(--_0x31bce6){_0x11c9a4['push'](_0x11c9a4['shift']());}};_0xe7ff5a(++_0x27be7e);}(_0x323f,0x1ee));var _0xf323=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x323f[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0xf323('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf323('0x1')]},'disposition':{'type':Sequelize[_0xf323('0x2')]},'secondDisposition':{'type':Sequelize[_0xf323('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf323('0x2')]},'note':{'type':Sequelize[_0xf323('0x2')]},'read1stAt':{'type':Sequelize[_0xf323('0x1')]},'fax':{'type':Sequelize[_0xf323('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf323('0x3')]('in',_0xf323('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf323('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf323('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xf323('0x5')]}}; \ No newline at end of file +var _0xda2d=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda2d,0x102));var _0xdda2=function(_0x5c7999,_0x25b0fb){_0x5c7999=_0x5c7999-0x0;var _0x33651f=_0xda2d[_0x5c7999];return _0x33651f;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'closed':{'type':Sequelize[_0xdda2('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdda2('0x2')]},'disposition':{'type':Sequelize[_0xdda2('0x3')]},'secondDisposition':{'type':Sequelize[_0xdda2('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xdda2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdda2('0x4')]('in',_0xdda2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdda2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xdda2('0x4')]('in',_0xdda2('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xdda2('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index bdba488..a4c77e7 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 _0x66f9=['FaxInteractionId','filter','$gte','format','setTags','omit','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','resolve','log','err','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','then','destroy','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','params','keys','filters','intersection','model','fields','length','attributes','includeAll','include','merge','options','find','create','body','update','addMessage','ids','getMessages','FaxMessage','hasOwnProperty','order','sort','where','pick'];(function(_0x168361,_0x36737b){var _0x4dbb95=function(_0x4054f5){while(--_0x4054f5){_0x168361['push'](_0x168361['shift']());}};_0x4dbb95(++_0x36737b);}(_0x66f9,0x1b9));var _0x966f=function(_0x439f7a,_0x567542){_0x439f7a=_0x439f7a-0x0;var _0x50c58a=_0x66f9[_0x439f7a];return _0x50c58a;};'use strict';var rimraf=require(_0x966f('0x0'));var zipdir=require('zip-dir');var moment=require(_0x966f('0x1'));var BPromise=require(_0x966f('0x2'));var util=require(_0x966f('0x3'));var path=require(_0x966f('0x4'));var fs=require('fs');var _=require(_0x966f('0x5'));var Redis=require(_0x966f('0x6'));var interaction=require(_0x966f('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x966f('0x8'))(_0x966f('0x9'));var config=require(_0x966f('0xa'));var db=require(_0x966f('0xb'))['db'];config[_0x966f('0xc')]=_[_0x966f('0xd')](config['redis'],{'host':_0x966f('0xe'),'port':0x18eb});var socket=require(_0x966f('0xf'))(new Redis(config[_0x966f('0xc')]));require(_0x966f('0x10'))[_0x966f('0x11')](socket);function respondWithStatusCode(_0x36c4af,_0xe00f4c){_0xe00f4c=_0xe00f4c||0xcc;return function(_0x337873){if(_0x337873){return _0x36c4af[_0x966f('0x12')](_0xe00f4c);}return _0x36c4af[_0x966f('0x13')](_0xe00f4c)[_0x966f('0x14')]();};}function respondWithResult(_0x56cec5,_0x1edf50){_0x1edf50=_0x1edf50||0xc8;return function(_0x1fcabb){if(_0x1fcabb){return _0x56cec5[_0x966f('0x13')](_0x1edf50)[_0x966f('0x15')](_0x1fcabb);}};}function respondWithFilteredResult(_0x450432,_0x21f95d){return function(_0x6dc492){if(_0x6dc492){var _0x502640=typeof _0x21f95d[_0x966f('0x16')]==='undefined'&&typeof _0x21f95d[_0x966f('0x17')]===_0x966f('0x18');var _0x299251=_0x6dc492[_0x966f('0x19')];var _0x5f20d7=_0x502640?0x0:_0x21f95d['offset'];var _0x1f3e6a=_0x502640?_0x6dc492['count']:_0x21f95d['offset']+_0x21f95d[_0x966f('0x17')];var _0x26ebd1;if(_0x1f3e6a>=_0x299251){_0x1f3e6a=_0x299251;_0x26ebd1=0xc8;}else{_0x26ebd1=0xce;}_0x450432[_0x966f('0x13')](_0x26ebd1);return _0x450432[_0x966f('0x1a')]('Content-Range',_0x5f20d7+'-'+_0x1f3e6a+'/'+_0x299251)[_0x966f('0x15')](_0x6dc492);}return null;};}function saveUpdates(_0x27fc76){return function(_0x318906){if(_0x318906){return _0x318906['update'](_0x27fc76)[_0x966f('0x1b')](function(_0x55570a){return _0x55570a;});}return null;};}function removeEntity(_0x4feec7){return function(_0x1eb7f7){if(_0x1eb7f7){return _0x1eb7f7[_0x966f('0x1c')]()[_0x966f('0x1b')](function(){_0x4feec7['status'](0xcc)[_0x966f('0x14')]();});}};}function handleEntityNotFound(_0x58fee4){return function(_0x28405b){if(!_0x28405b){_0x58fee4['sendStatus'](0x194);}return _0x28405b;};}function handleError(_0x3776e3,_0x331607){_0x331607=_0x331607||0x1f4;return function(_0x55b9cd){logger['error'](_0x55b9cd[_0x966f('0x1d')]);if(_0x55b9cd[_0x966f('0x1e')]){delete _0x55b9cd[_0x966f('0x1e')];}_0x3776e3[_0x966f('0x13')](_0x331607)[_0x966f('0x1f')](_0x55b9cd);};}exports[_0x966f('0x20')]=function(_0x1fe2ae,_0x3b92a9){var _0x435de={};var _0x13b6f8=_[_0x966f('0x21')](db[_0x966f('0x22')][_0x966f('0x23')],function(_0x28a162){return{'name':_0x28a162[_0x966f('0x24')],'type':_0x28a162[_0x966f('0x25')][_0x966f('0x26')]};});_0x435de=qs[_0x966f('0x27')](_0x13b6f8,_0x1fe2ae);return interaction[_0x966f('0x28')]('fax',_0x1fe2ae[_0x966f('0x29')],_0x1fe2ae[_0x966f('0x2a')],_0x435de,_0x13b6f8)[_0x966f('0x1b')](respondWithFilteredResult(_0x3b92a9,_0x435de))[_0x966f('0x2b')](handleError(_0x3b92a9,null));};exports['show']=function(_0x373768,_0x214727){var _0x1dd42e={'raw':![],'where':{'id':_0x373768[_0x966f('0x2c')]['id']}},_0x4d72ac={};_0x4d72ac['model']=_[_0x966f('0x2d')](db[_0x966f('0x22')][_0x966f('0x23')]);_0x4d72ac[_0x966f('0x29')]=_[_0x966f('0x2d')](_0x373768[_0x966f('0x29')]);_0x4d72ac[_0x966f('0x2e')]=_['intersection'](_0x4d72ac['model'],_0x4d72ac['query']);_0x1dd42e['attributes']=_[_0x966f('0x2f')](_0x4d72ac[_0x966f('0x30')],qs[_0x966f('0x31')](_0x373768[_0x966f('0x29')][_0x966f('0x31')]));_0x1dd42e['attributes']=_0x1dd42e['attributes'][_0x966f('0x32')]?_0x1dd42e[_0x966f('0x33')]:_0x4d72ac['model'];if(_0x373768[_0x966f('0x29')][_0x966f('0x34')]){_0x1dd42e[_0x966f('0x35')]=[{'all':!![]}];}_0x1dd42e=_[_0x966f('0x36')]({},_0x1dd42e,_0x373768[_0x966f('0x37')]);return db['FaxInteraction'][_0x966f('0x38')](_0x1dd42e)[_0x966f('0x1b')](handleEntityNotFound(_0x214727,null))['then'](respondWithResult(_0x214727,null))[_0x966f('0x2b')](handleError(_0x214727,null));};exports[_0x966f('0x39')]=function(_0x532588,_0x5ce225){return db[_0x966f('0x22')][_0x966f('0x39')](_0x532588[_0x966f('0x3a')],{})['then'](respondWithResult(_0x5ce225,0xc9))[_0x966f('0x2b')](handleError(_0x5ce225,null));};exports[_0x966f('0x3b')]=function(_0x50c425,_0x34937c){if(_0x50c425['body']['id']){delete _0x50c425[_0x966f('0x3a')]['id'];}return db['FaxInteraction'][_0x966f('0x38')]({'where':{'id':_0x50c425[_0x966f('0x2c')]['id']}})[_0x966f('0x1b')](handleEntityNotFound(_0x34937c,null))[_0x966f('0x1b')](saveUpdates(_0x50c425['body'],null))['then'](respondWithResult(_0x34937c,null))['catch'](handleError(_0x34937c,null));};exports[_0x966f('0x1c')]=function(_0x171d48,_0x1b2495){return db[_0x966f('0x22')][_0x966f('0x38')]({'where':{'id':_0x171d48['params']['id']}})[_0x966f('0x1b')](handleEntityNotFound(_0x1b2495,null))[_0x966f('0x1b')](removeEntity(_0x1b2495,null))[_0x966f('0x2b')](handleError(_0x1b2495,null));};exports['describe']=function(_0x82adc2,_0x301002){return db['FaxInteraction']['describe']()[_0x966f('0x1b')](respondWithResult(_0x301002,null))['catch'](handleError(_0x301002,null));};exports[_0x966f('0x3c')]=function(_0x59233d,_0x4720f8){return db['FaxMessage'][_0x966f('0x38')]({'where':{'id':_0x59233d[_0x966f('0x2c')]['id']}})[_0x966f('0x1b')](handleEntityNotFound(_0x4720f8,null))[_0x966f('0x1b')](function(_0x2be9e2){if(_0x2be9e2){return _0x2be9e2[_0x966f('0x3c')](_0x59233d[_0x966f('0x3a')][_0x966f('0x3d')],_['omit'](_0x59233d[_0x966f('0x3a')],[_0x966f('0x3d'),'id'])||{});}})[_0x966f('0x1b')](respondWithResult(_0x4720f8,null))[_0x966f('0x2b')](handleError(_0x4720f8,null));};exports[_0x966f('0x3e')]=function(_0x48babd,_0x56686f){var _0x5ed82c={'raw':![],'where':{}};var _0x5c09e5={};var _0x128e5c={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x48babd[_0x966f('0x2c')]['id']}})[_0x966f('0x1b')](handleEntityNotFound(_0x56686f,null))[_0x966f('0x1b')](function(_0x28f447){if(_0x28f447){_0x5c09e5[_0x966f('0x30')]=_[_0x966f('0x2d')](db[_0x966f('0x3f')][_0x966f('0x23')]);_0x5c09e5[_0x966f('0x29')]=_[_0x966f('0x2d')](_0x48babd[_0x966f('0x29')]);_0x5c09e5[_0x966f('0x2e')]=_['intersection'](_0x5c09e5[_0x966f('0x30')],_0x5c09e5[_0x966f('0x29')]);_0x5ed82c[_0x966f('0x33')]=_['intersection'](_0x5c09e5[_0x966f('0x30')],qs[_0x966f('0x31')](_0x48babd['query'][_0x966f('0x31')]));_0x5ed82c['attributes']=_0x5ed82c['attributes']['length']?_0x5ed82c[_0x966f('0x33')]:_0x5c09e5[_0x966f('0x30')];if(!_0x48babd[_0x966f('0x29')][_0x966f('0x40')]('nolimit')){_0x5ed82c[_0x966f('0x17')]=qs['limit'](_0x48babd['query'][_0x966f('0x17')]);_0x5ed82c[_0x966f('0x16')]=qs[_0x966f('0x16')](_0x48babd[_0x966f('0x29')][_0x966f('0x16')]);}_0x5ed82c[_0x966f('0x41')]=qs['sort'](_0x48babd[_0x966f('0x29')][_0x966f('0x42')]);_0x5ed82c[_0x966f('0x43')]=qs['filters'](_[_0x966f('0x44')](_0x48babd[_0x966f('0x29')],_0x5c09e5['filters']));_0x5ed82c[_0x966f('0x43')][_0x966f('0x45')]=_0x28f447['id'];if(_0x48babd[_0x966f('0x29')][_0x966f('0x46')]){_0x5ed82c[_0x966f('0x43')]=_[_0x966f('0x36')](_0x5ed82c[_0x966f('0x43')],{'$or':_[_0x966f('0x21')](_0x5ed82c[_0x966f('0x33')],function(_0x2fdb1a){var _0x2b0238={};_0x2b0238[_0x2fdb1a]={'$like':'%'+_0x48babd[_0x966f('0x29')]['filter']+'%'};return _0x2b0238;})});}if(_0x48babd['query'][_0x966f('0x47')]){var _0x3f3ef4=_0x48babd[_0x966f('0x29')][_0x966f('0x47')]['split'](',');var _0x4f290f={};_0x4f290f[_0x3f3ef4[0x0]]={'$gte':moment(_0x3f3ef4[0x1])[_0x966f('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5ed82c[_0x966f('0x43')]=_['merge'](_0x5ed82c['where'],_0x4f290f);}_0x5ed82c=_[_0x966f('0x36')]({},_0x5ed82c,_0x48babd['options']);return db[_0x966f('0x3f')][_0x966f('0x19')]({'where':_0x5ed82c['where']})[_0x966f('0x1b')](function(_0x12c929){_0x128e5c[_0x966f('0x19')]=_0x12c929;if(_0x48babd[_0x966f('0x29')][_0x966f('0x34')]){_0x5ed82c['include']=[{'all':!![]}];}return db[_0x966f('0x3f')][_0x966f('0x28')](_0x5ed82c);})['then'](function(_0x3272ff){_0x128e5c['rows']=_0x3272ff;return _0x128e5c;});}})['then'](respondWithFilteredResult(_0x56686f,_0x5ed82c))[_0x966f('0x2b')](handleError(_0x56686f,null));};exports['addTags']=function(_0x34aefb,_0x45e87f){return db[_0x966f('0x22')]['find']({'where':{'id':_0x34aefb[_0x966f('0x2c')]['id']}})[_0x966f('0x1b')](handleEntityNotFound(_0x45e87f,null))['then'](function(_0x3cdbbb){if(_0x3cdbbb){return _0x3cdbbb[_0x966f('0x49')](_0x34aefb[_0x966f('0x3a')][_0x966f('0x3d')],_[_0x966f('0x4a')](_0x34aefb['body'],[_0x966f('0x3d'),'id'])||{})['spread'](function(){return db[_0x966f('0x4b')]['findAll']({'attributes':['id',_0x966f('0x1e'),_0x966f('0x4c')],'where':{'id':_0x34aefb[_0x966f('0x3a')][_0x966f('0x3d')]}});})[_0x966f('0x1b')](function(_0xbf16ef){socket[_0x966f('0x4d')](_0x966f('0x4e'),{'id':Number(_0x34aefb[_0x966f('0x2c')]['id']),'tags':_0xbf16ef||[]});return{'id':Number(_0x34aefb[_0x966f('0x2c')]['id']),'tags':_0xbf16ef||[]};});}})[_0x966f('0x1b')](respondWithResult(_0x45e87f,null))[_0x966f('0x2b')](handleError(_0x45e87f,null));};exports['removeTags']=function(_0x3b4e6c,_0x1bbf71){return db['FaxInteraction'][_0x966f('0x38')]({'where':{'id':_0x3b4e6c[_0x966f('0x2c')]['id']}})[_0x966f('0x1b')](handleEntityNotFound(_0x1bbf71,null))['then'](function(_0x11de1d){if(_0x11de1d){return _0x11de1d[_0x966f('0x4f')](_0x3b4e6c[_0x966f('0x29')][_0x966f('0x3d')]);}})['then'](respondWithStatusCode(_0x1bbf71,null))['catch'](handleError(_0x1bbf71,null));};exports[_0x966f('0x50')]=function(_0x4ba216,_0x5f0fab){var _0x1a9d7d=moment()[_0x966f('0x51')]()[_0x966f('0x52')]();var _0x3b7ac6=path[_0x966f('0x53')](config[_0x966f('0x54')],_0x966f('0x55'),_0x966f('0x56'),_0x966f('0x57'));var _0x10a8cf=path[_0x966f('0x53')](config[_0x966f('0x54')],_0x966f('0x55'),_0x966f('0x56'),'attachments');var _0x3fdc5c=path['join'](_0x3b7ac6,_0x1a9d7d);var _0x39193a=util[_0x966f('0x48')](_0x966f('0x58'),_0x4ba216[_0x966f('0x2c')]['id'],_0x1a9d7d);var _0x146488=path['join'](_0x3b7ac6,_0x39193a);var _0x3b0142=[];_0x3b0142[_0x966f('0x59')]({'model':db['Attachment'],'as':_0x966f('0x5a'),'raw':!![]});var _0x2e7bbd=[{'model':db['FaxMessage'],'as':_0x966f('0x5b'),'attributes':['id',_0x966f('0x3a'),_0x966f('0x5c')],'include':_0x3b0142}];return db[_0x966f('0x22')]['find']({'where':{'id':_0x4ba216[_0x966f('0x2c')]['id']},'include':_0x2e7bbd})[_0x966f('0x1b')](handleEntityNotFound(_0x5f0fab,null))['then'](function(_0x62f7d3){if(_0x62f7d3&&_0x62f7d3[_0x966f('0x5b')]){var _0xa0e3d1=_0x62f7d3[_0x966f('0x5d')]({'plain':!![]});fs[_0x966f('0x5e')](_0x3fdc5c);for(var _0x5899d0=0x0;_0x5899d0<_0xa0e3d1[_0x966f('0x5b')][_0x966f('0x32')];_0x5899d0++){var _0x55688e=_0xa0e3d1[_0x966f('0x5b')][_0x5899d0]['Attachment'];if(_0x55688e){var _0x30fd06=path[_0x966f('0x53')](_0x10a8cf,_0x55688e[_0x966f('0x5f')]);if(fs[_0x966f('0x60')](_0x30fd06)){fs[_0x966f('0x61')](_0x30fd06)[_0x966f('0x62')](fs['createWriteStream'](path['join'](_0x3fdc5c,_0x55688e[_0x966f('0x5f')])));}}}return BPromise[_0x966f('0x63')]()[_0x966f('0x1b')](function(){return new BPromise(function(_0x15ba51,_0x2e9517){zipdir(_0x3fdc5c,{'saveTo':_0x146488},function(_0x482fd5,_0x1a502e){if(_0x482fd5)return _0x2e9517(_0x482fd5);return _0x15ba51(_0x1a502e);});})[_0x966f('0x1b')](function(){return new BPromise(function(_0x3d0c26,_0x3c458c){rimraf(_0x3fdc5c,function(_0x57f6aa){if(_0x57f6aa)_0x3c458c(_0x57f6aa);return _0x3d0c26();});});})['then'](function(){return _0x5f0fab[_0x966f('0x50')](_0x146488,_0x39193a,function(_0x99e185){if(_0x99e185){console[_0x966f('0x64')](_0x966f('0x65'),_0x99e185);}else{fs['unlinkSync'](_0x146488);}});});});}else{return _0x5f0fab[_0x966f('0x12')](0xc8);}})[_0x966f('0x2b')](handleError(_0x5f0fab,null));}; \ No newline at end of file +var _0x7cc2=['log','err','unlinkSync','rimraf','bluebird','util','path','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','then','destroy','error','stack','name','index','map','FaxInteraction','rawAttributes','fieldName','type','findAll','fax','query','user','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','params','describe','addMessage','FaxMessage','ids','findOne','hasOwnProperty','order','sort','where','pick','FaxInteractionId','merge','filter','$gte','split','format','rows','setTags','omit','spread','color','emit','faxInteractionTags:save','removeTags','download','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve'];(function(_0x4bc16b,_0x3f816c){var _0x3469d1=function(_0x338b2c){while(--_0x338b2c){_0x4bc16b['push'](_0x4bc16b['shift']());}};_0x3469d1(++_0x3f816c);}(_0x7cc2,0x69));var _0x27cc=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x7cc2[_0x19b3f9];return _0x18c3f6;};'use strict';var rimraf=require(_0x27cc('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x27cc('0x1'));var util=require(_0x27cc('0x2'));var path=require(_0x27cc('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x27cc('0x4'));var logger=require('../../config/logger')(_0x27cc('0x5'));var config=require(_0x27cc('0x6'));var db=require(_0x27cc('0x7'))['db'];config['redis']=_[_0x27cc('0x8')](config[_0x27cc('0x9')],{'host':_0x27cc('0xa'),'port':0x18eb});var socket=require(_0x27cc('0xb'))(new Redis(config[_0x27cc('0x9')]));require(_0x27cc('0xc'))[_0x27cc('0xd')](socket);function respondWithStatusCode(_0x14d57b,_0x1e651f){_0x1e651f=_0x1e651f||0xcc;return function(_0x254835){if(_0x254835){return _0x14d57b[_0x27cc('0xe')](_0x1e651f);}return _0x14d57b[_0x27cc('0xf')](_0x1e651f)[_0x27cc('0x10')]();};}function respondWithResult(_0x5c3dae,_0x62fafc){_0x62fafc=_0x62fafc||0xc8;return function(_0x4dc02c){if(_0x4dc02c){return _0x5c3dae['status'](_0x62fafc)[_0x27cc('0x11')](_0x4dc02c);}};}function respondWithFilteredResult(_0x28e0d8,_0x39b0af){return function(_0x5c0a4a){if(_0x5c0a4a){var _0x99799f=typeof _0x39b0af[_0x27cc('0x12')]==='undefined'&&typeof _0x39b0af[_0x27cc('0x13')]===_0x27cc('0x14');var _0x460eb9=_0x5c0a4a[_0x27cc('0x15')];var _0xaf75ab=_0x99799f?0x0:_0x39b0af[_0x27cc('0x12')];var _0x597da8=_0x99799f?_0x5c0a4a['count']:_0x39b0af[_0x27cc('0x12')]+_0x39b0af['limit'];var _0x1eff21;if(_0x597da8>=_0x460eb9){_0x597da8=_0x460eb9;_0x1eff21=0xc8;}else{_0x1eff21=0xce;}_0x28e0d8[_0x27cc('0xf')](_0x1eff21);return _0x28e0d8[_0x27cc('0x16')]('Content-Range',_0xaf75ab+'-'+_0x597da8+'/'+_0x460eb9)['json'](_0x5c0a4a);}return null;};}function saveUpdates(_0x42353e){return function(_0x2e49a5){if(_0x2e49a5){return _0x2e49a5['update'](_0x42353e)[_0x27cc('0x17')](function(_0x597c2b){return _0x597c2b;});}return null;};}function removeEntity(_0x113293){return function(_0x1fb58b){if(_0x1fb58b){return _0x1fb58b[_0x27cc('0x18')]()[_0x27cc('0x17')](function(){_0x113293['status'](0xcc)[_0x27cc('0x10')]();});}};}function handleEntityNotFound(_0x4cfbd2){return function(_0x2ac69c){if(!_0x2ac69c){_0x4cfbd2[_0x27cc('0xe')](0x194);}return _0x2ac69c;};}function handleError(_0x573fd4,_0x21c047){_0x21c047=_0x21c047||0x1f4;return function(_0x292190){logger[_0x27cc('0x19')](_0x292190[_0x27cc('0x1a')]);if(_0x292190[_0x27cc('0x1b')]){delete _0x292190[_0x27cc('0x1b')];}_0x573fd4[_0x27cc('0xf')](_0x21c047)['send'](_0x292190);};}exports[_0x27cc('0x1c')]=function(_0x4d044b,_0x2ce550){var _0x10fdde={};var _0xc4bb7e=_[_0x27cc('0x1d')](db[_0x27cc('0x1e')][_0x27cc('0x1f')],function(_0x15d9c2){return{'name':_0x15d9c2[_0x27cc('0x20')],'type':_0x15d9c2[_0x27cc('0x21')]['key']};});_0x10fdde=qs['getOptions'](_0xc4bb7e,_0x4d044b);return interaction[_0x27cc('0x22')](_0x27cc('0x23'),_0x4d044b[_0x27cc('0x24')],_0x4d044b[_0x27cc('0x25')],_0x10fdde,_0xc4bb7e)[_0x27cc('0x17')](respondWithFilteredResult(_0x2ce550,_0x10fdde))[_0x27cc('0x26')](handleError(_0x2ce550,null));};exports[_0x27cc('0x27')]=function(_0x437be1,_0x35407f){var _0x38ae54={'raw':![],'where':{'id':_0x437be1['params']['id']}},_0x298b21={};_0x298b21[_0x27cc('0x28')]=_[_0x27cc('0x29')](db[_0x27cc('0x1e')][_0x27cc('0x1f')]);_0x298b21['query']=_[_0x27cc('0x29')](_0x437be1[_0x27cc('0x24')]);_0x298b21[_0x27cc('0x2a')]=_[_0x27cc('0x2b')](_0x298b21[_0x27cc('0x28')],_0x298b21['query']);_0x38ae54[_0x27cc('0x2c')]=_[_0x27cc('0x2b')](_0x298b21[_0x27cc('0x28')],qs[_0x27cc('0x2d')](_0x437be1['query'][_0x27cc('0x2d')]));_0x38ae54[_0x27cc('0x2c')]=_0x38ae54[_0x27cc('0x2c')][_0x27cc('0x2e')]?_0x38ae54[_0x27cc('0x2c')]:_0x298b21[_0x27cc('0x28')];if(_0x437be1[_0x27cc('0x24')][_0x27cc('0x2f')]){_0x38ae54[_0x27cc('0x30')]=[{'all':!![]}];}_0x38ae54=_['merge']({},_0x38ae54,_0x437be1[_0x27cc('0x31')]);return db[_0x27cc('0x1e')][_0x27cc('0x32')](_0x38ae54)[_0x27cc('0x17')](handleEntityNotFound(_0x35407f,null))[_0x27cc('0x17')](respondWithResult(_0x35407f,null))[_0x27cc('0x26')](handleError(_0x35407f,null));};exports[_0x27cc('0x33')]=function(_0x12a4fc,_0xafb203){return db[_0x27cc('0x1e')][_0x27cc('0x33')](_0x12a4fc[_0x27cc('0x34')],{})['then'](respondWithResult(_0xafb203,0xc9))[_0x27cc('0x26')](handleError(_0xafb203,null));};exports['update']=function(_0x3dae01,_0x4ca8f0){if(_0x3dae01[_0x27cc('0x34')]['id']){delete _0x3dae01[_0x27cc('0x34')]['id'];}return db[_0x27cc('0x1e')][_0x27cc('0x32')]({'where':{'id':_0x3dae01[_0x27cc('0x35')]['id']}})[_0x27cc('0x17')](handleEntityNotFound(_0x4ca8f0,null))[_0x27cc('0x17')](saveUpdates(_0x3dae01[_0x27cc('0x34')],null))[_0x27cc('0x17')](respondWithResult(_0x4ca8f0,null))[_0x27cc('0x26')](handleError(_0x4ca8f0,null));};exports[_0x27cc('0x18')]=function(_0x304f6e,_0x17e616){return db[_0x27cc('0x1e')]['find']({'where':{'id':_0x304f6e[_0x27cc('0x35')]['id']}})[_0x27cc('0x17')](handleEntityNotFound(_0x17e616,null))[_0x27cc('0x17')](removeEntity(_0x17e616,null))['catch'](handleError(_0x17e616,null));};exports['describe']=function(_0x5b38f1,_0x308603){return db[_0x27cc('0x1e')][_0x27cc('0x36')]()[_0x27cc('0x17')](respondWithResult(_0x308603,null))[_0x27cc('0x26')](handleError(_0x308603,null));};exports[_0x27cc('0x37')]=function(_0x5af5d9,_0x4cfd8c){return db[_0x27cc('0x38')][_0x27cc('0x32')]({'where':{'id':_0x5af5d9[_0x27cc('0x35')]['id']}})[_0x27cc('0x17')](handleEntityNotFound(_0x4cfd8c,null))[_0x27cc('0x17')](function(_0x4904bf){if(_0x4904bf){return _0x4904bf[_0x27cc('0x37')](_0x5af5d9[_0x27cc('0x34')][_0x27cc('0x39')],_['omit'](_0x5af5d9['body'],[_0x27cc('0x39'),'id'])||{});}})['then'](respondWithResult(_0x4cfd8c,null))[_0x27cc('0x26')](handleError(_0x4cfd8c,null));};exports['getMessages']=function(_0x167206,_0x45c46e){var _0x2f71d6={'raw':![],'where':{}};var _0x325c34={};var _0x5938f3={'count':0x0,'rows':[]};return db[_0x27cc('0x1e')][_0x27cc('0x3a')]({'where':{'id':_0x167206['params']['id']}})[_0x27cc('0x17')](handleEntityNotFound(_0x45c46e,null))[_0x27cc('0x17')](function(_0x3849e7){if(_0x3849e7){_0x325c34[_0x27cc('0x28')]=_[_0x27cc('0x29')](db['FaxMessage'][_0x27cc('0x1f')]);_0x325c34[_0x27cc('0x24')]=_[_0x27cc('0x29')](_0x167206['query']);_0x325c34[_0x27cc('0x2a')]=_[_0x27cc('0x2b')](_0x325c34[_0x27cc('0x28')],_0x325c34[_0x27cc('0x24')]);_0x2f71d6[_0x27cc('0x2c')]=_['intersection'](_0x325c34[_0x27cc('0x28')],qs[_0x27cc('0x2d')](_0x167206[_0x27cc('0x24')][_0x27cc('0x2d')]));_0x2f71d6[_0x27cc('0x2c')]=_0x2f71d6['attributes'][_0x27cc('0x2e')]?_0x2f71d6['attributes']:_0x325c34['model'];if(!_0x167206[_0x27cc('0x24')][_0x27cc('0x3b')]('nolimit')){_0x2f71d6[_0x27cc('0x13')]=qs[_0x27cc('0x13')](_0x167206[_0x27cc('0x24')][_0x27cc('0x13')]);_0x2f71d6['offset']=qs[_0x27cc('0x12')](_0x167206[_0x27cc('0x24')]['offset']);}_0x2f71d6[_0x27cc('0x3c')]=qs[_0x27cc('0x3d')](_0x167206['query']['sort']);_0x2f71d6[_0x27cc('0x3e')]=qs[_0x27cc('0x2a')](_[_0x27cc('0x3f')](_0x167206[_0x27cc('0x24')],_0x325c34[_0x27cc('0x2a')]));_0x2f71d6[_0x27cc('0x3e')][_0x27cc('0x40')]=_0x3849e7['id'];if(_0x167206['query']['filter']){_0x2f71d6['where']=_[_0x27cc('0x41')](_0x2f71d6[_0x27cc('0x3e')],{'$or':_[_0x27cc('0x1d')](_0x2f71d6[_0x27cc('0x2c')],function(_0x20b517){var _0x3e66bd={};_0x3e66bd[_0x20b517]={'$like':'%'+_0x167206[_0x27cc('0x24')][_0x27cc('0x42')]+'%'};return _0x3e66bd;})});}if(_0x167206[_0x27cc('0x24')]['$gte']){var _0x4b9bb9=_0x167206[_0x27cc('0x24')][_0x27cc('0x43')][_0x27cc('0x44')](',');var _0x5cf4d2={};_0x5cf4d2[_0x4b9bb9[0x0]]={'$gte':moment(_0x4b9bb9[0x1])[_0x27cc('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f71d6[_0x27cc('0x3e')]=_[_0x27cc('0x41')](_0x2f71d6[_0x27cc('0x3e')],_0x5cf4d2);}_0x2f71d6=_[_0x27cc('0x41')]({},_0x2f71d6,_0x167206['options']);return db[_0x27cc('0x38')]['count']({'where':_0x2f71d6[_0x27cc('0x3e')]})[_0x27cc('0x17')](function(_0x1165ab){_0x5938f3[_0x27cc('0x15')]=_0x1165ab;if(_0x167206[_0x27cc('0x24')][_0x27cc('0x2f')]){_0x2f71d6['include']=[{'all':!![]}];}return db[_0x27cc('0x38')]['findAll'](_0x2f71d6);})[_0x27cc('0x17')](function(_0x47c3bf){_0x5938f3[_0x27cc('0x46')]=_0x47c3bf;return _0x5938f3;});}})[_0x27cc('0x17')](respondWithFilteredResult(_0x45c46e,_0x2f71d6))[_0x27cc('0x26')](handleError(_0x45c46e,null));};exports['addTags']=function(_0xecd1d2,_0x3ed9c1){return db[_0x27cc('0x1e')][_0x27cc('0x32')]({'where':{'id':_0xecd1d2[_0x27cc('0x35')]['id']}})['then'](handleEntityNotFound(_0x3ed9c1,null))[_0x27cc('0x17')](function(_0x53dc70){if(_0x53dc70){return _0x53dc70[_0x27cc('0x47')](_0xecd1d2[_0x27cc('0x34')][_0x27cc('0x39')],_[_0x27cc('0x48')](_0xecd1d2[_0x27cc('0x34')],[_0x27cc('0x39'),'id'])||{})[_0x27cc('0x49')](function(){return db['Tag'][_0x27cc('0x22')]({'attributes':['id','name',_0x27cc('0x4a')],'where':{'id':_0xecd1d2['body'][_0x27cc('0x39')]}});})['then'](function(_0xe31119){socket[_0x27cc('0x4b')](_0x27cc('0x4c'),{'id':Number(_0xecd1d2[_0x27cc('0x35')]['id']),'tags':_0xe31119||[]});return{'id':Number(_0xecd1d2['params']['id']),'tags':_0xe31119||[]};});}})[_0x27cc('0x17')](respondWithResult(_0x3ed9c1,null))[_0x27cc('0x26')](handleError(_0x3ed9c1,null));};exports[_0x27cc('0x4d')]=function(_0x298792,_0x543ee6){return db[_0x27cc('0x1e')][_0x27cc('0x32')]({'where':{'id':_0x298792[_0x27cc('0x35')]['id']}})[_0x27cc('0x17')](handleEntityNotFound(_0x543ee6,null))[_0x27cc('0x17')](function(_0x1f0956){if(_0x1f0956){return _0x1f0956[_0x27cc('0x4d')](_0x298792[_0x27cc('0x24')][_0x27cc('0x39')]);}})['then'](respondWithStatusCode(_0x543ee6,null))[_0x27cc('0x26')](handleError(_0x543ee6,null));};exports[_0x27cc('0x4e')]=function(_0x3198ef,_0x82ae5e){var _0xd927a7=moment()['unix']()[_0x27cc('0x4f')]();var _0x452c35=path[_0x27cc('0x50')](config['root'],_0x27cc('0x51'),_0x27cc('0x52'),_0x27cc('0x53'));var _0x2d75fc=path[_0x27cc('0x50')](config[_0x27cc('0x54')],_0x27cc('0x51'),_0x27cc('0x52'),_0x27cc('0x55'));var _0x531e23=path[_0x27cc('0x50')](_0x452c35,_0xd927a7);var _0x44a98d=util[_0x27cc('0x45')](_0x27cc('0x56'),_0x3198ef[_0x27cc('0x35')]['id'],_0xd927a7);var _0x2677ae=path[_0x27cc('0x50')](_0x452c35,_0x44a98d);var _0x25e352=[];_0x25e352[_0x27cc('0x57')]({'model':db[_0x27cc('0x58')],'as':_0x27cc('0x58'),'raw':!![]});var _0x40f6e4=[{'model':db[_0x27cc('0x38')],'as':_0x27cc('0x59'),'attributes':['id',_0x27cc('0x34'),_0x27cc('0x5a')],'include':_0x25e352}];return db[_0x27cc('0x1e')][_0x27cc('0x32')]({'where':{'id':_0x3198ef[_0x27cc('0x35')]['id']},'include':_0x40f6e4})[_0x27cc('0x17')](handleEntityNotFound(_0x82ae5e,null))[_0x27cc('0x17')](function(_0x1ae4f4){if(_0x1ae4f4&&_0x1ae4f4[_0x27cc('0x59')]){var _0x50ebd1=_0x1ae4f4[_0x27cc('0x5b')]({'plain':!![]});fs[_0x27cc('0x5c')](_0x531e23);for(var _0x4a729d=0x0;_0x4a729d<_0x50ebd1[_0x27cc('0x59')]['length'];_0x4a729d++){var _0x45c21b=_0x50ebd1['Messages'][_0x4a729d][_0x27cc('0x58')];if(_0x45c21b){var _0x3ec90f=path['join'](_0x2d75fc,_0x45c21b[_0x27cc('0x5d')]);if(fs[_0x27cc('0x5e')](_0x3ec90f)){fs[_0x27cc('0x5f')](_0x3ec90f)[_0x27cc('0x60')](fs[_0x27cc('0x61')](path[_0x27cc('0x50')](_0x531e23,_0x45c21b['basename'])));}}}return BPromise[_0x27cc('0x62')]()[_0x27cc('0x17')](function(){return new BPromise(function(_0x95fc1b,_0x497c2f){zipdir(_0x531e23,{'saveTo':_0x2677ae},function(_0x41dcff,_0x355ba3){if(_0x41dcff)return _0x497c2f(_0x41dcff);return _0x95fc1b(_0x355ba3);});})['then'](function(){return new BPromise(function(_0x49bef9,_0x53665b){rimraf(_0x531e23,function(_0xf7c2f9){if(_0xf7c2f9)_0x53665b(_0xf7c2f9);return _0x49bef9();});});})['then'](function(){return _0x82ae5e['download'](_0x2677ae,_0x44a98d,function(_0x1f20bd){if(_0x1f20bd){console[_0x27cc('0x63')](_0x27cc('0x64'),_0x1f20bd);}else{fs[_0x27cc('0x65')](_0x2677ae);}});});});}else{return _0x82ae5e[_0x27cc('0xe')](0xc8);}})['catch'](handleError(_0x82ae5e,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index bb3a6e9..1d9d01f 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 _0x1dc9=['setDataValue','unreadMessages','emit','catch','hook','exports','events','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1dc9,0x1d1));var _0x91dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dc9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x91dc('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x91dc('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x91dc('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x91dc('0x3')](0x0);var events={'afterCreate':_0x91dc('0x4'),'afterUpdate':_0x91dc('0x5'),'afterDestroy':_0x91dc('0x6')};function emitEvent(_0x19417d){return function(_0x4e2e91,_0x54a42d,_0x169d53){_0x4e2e91[_0x91dc('0x7')]({'attributes':['id'],'raw':!![]})[_0x91dc('0x8')](function(_0xca7cfa){_0x4e2e91['setDataValue']('Users',_0xca7cfa[_0x91dc('0x9')](function(_0x57d20b){return{'id':_0x57d20b['id']};}));return FaxMessage[_0x91dc('0xa')]({'where':{'FaxInteractionId':_0x4e2e91['id'],'direction':'in','read':![]},'raw':!![]});})[_0x91dc('0x8')](function(_0x4ea128){_0x4e2e91[_0x91dc('0xb')](_0x91dc('0xc'),_0x4ea128['length']);FaxInteractionEvents['emit'](_0x19417d+':'+_0x4e2e91['id'],_0x4e2e91);FaxInteractionEvents[_0x91dc('0xd')](_0x19417d,_0x4e2e91);_0x169d53(null);})[_0x91dc('0xe')](_0x169d53(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x91dc('0xf')](e,emitEvent(event));}}module[_0x91dc('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xa297=['remove','getUsers','then','setDataValue','map','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','save','update'];(function(_0x445b7e,_0x3ea85f){var _0x17d997=function(_0x805f31){while(--_0x805f31){_0x445b7e['push'](_0x445b7e['shift']());}};_0x17d997(++_0x3ea85f);}(_0xa297,0x145));var _0x7a29=function(_0x252be8,_0x21ac26){_0x252be8=_0x252be8-0x0;var _0x59fb46=_0xa297[_0x252be8];return _0x59fb46;};'use strict';var EventEmitter=require(_0x7a29('0x0'));var FaxInteraction=require(_0x7a29('0x1'))['db'][_0x7a29('0x2')];var FaxMessage=require(_0x7a29('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a29('0x3'),'afterUpdate':_0x7a29('0x4'),'afterDestroy':_0x7a29('0x5')};function emitEvent(_0x1ba34c){return function(_0x374007,_0x44d826,_0x1f2594){_0x374007[_0x7a29('0x6')]({'attributes':['id'],'raw':!![]})[_0x7a29('0x7')](function(_0xe8430){_0x374007[_0x7a29('0x8')]('Users',_0xe8430[_0x7a29('0x9')](function(_0x16f0f4){return{'id':_0x16f0f4['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x374007['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7a29('0x7')](function(_0x4f34ac){_0x374007[_0x7a29('0x8')](_0x7a29('0xa'),_0x4f34ac['length']);FaxInteractionEvents[_0x7a29('0xb')](_0x1ba34c+':'+_0x374007['id'],_0x374007);FaxInteractionEvents[_0x7a29('0xb')](_0x1ba34c,_0x374007);_0x1f2594(null);})[_0x7a29('0xc')](_0x1f2594(null));};}for(var e in events){if(events[_0x7a29('0xd')](e)){var event=events[e];FaxInteraction[_0x7a29('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 00c5ff0..fa231e2 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 _0xec18=['rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xec18,0x12a));var _0x8ec1=function(_0xf7bed8,_0x4a62fd){_0xf7bed8=_0xf7bed8-0x0;var _0x4eb0eb=_0xec18[_0xf7bed8];return _0x4eb0eb;};'use strict';var _=require('lodash');var util=require(_0x8ec1('0x0'));var logger=require(_0x8ec1('0x1'))(_0x8ec1('0x2'));var moment=require('moment');var BPromise=require(_0x8ec1('0x3'));var rp=require(_0x8ec1('0x4'));var fs=require('fs');var path=require(_0x8ec1('0x5'));var rimraf=require(_0x8ec1('0x6'));var config=require(_0x8ec1('0x7'));var attributes=require(_0x8ec1('0x8'));module[_0x8ec1('0x9')]=function(_0x5b2b75,_0x8fdcda){return _0x5b2b75[_0x8ec1('0xa')](_0x8ec1('0xb'),attributes,{'tableName':_0x8ec1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a2df5,_0x4a0b3d,_0x247543){if(_0x5a2df5[_0x8ec1('0xd')](_0x8ec1('0xe'))){_0x5a2df5['closedAt']=moment()['format'](_0x8ec1('0xf'));}_0x247543(null,_0x5a2df5);}}});}; \ No newline at end of file +var _0x0424=['./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','path'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x0424,0x159));var _0x4042=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x0424[_0x235f49];return _0x551139;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d11bf,_0x509772,_0x280cd6){if(_0x5d11bf[_0x4042('0xa')](_0x4042('0xb'))){_0x5d11bf['closedAt']=moment()[_0x4042('0xc')](_0x4042('0xd'));}_0x280cd6(null,_0x5d11bf);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index fe07bfd..9e13102 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 _0x745b=['find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','then','info','stringify','AddTagsToFaxInteraction'];(function(_0x5c06fe,_0x12193a){var _0xf8ec9a=function(_0x3a7026){while(--_0x3a7026){_0x5c06fe['push'](_0x5c06fe['shift']());}};_0xf8ec9a(++_0x12193a);}(_0x745b,0xbe));var _0xb745=function(_0x568b84,_0x444209){_0x568b84=_0x568b84-0x0;var _0x3c1093=_0x745b[_0x568b84];return _0x3c1093;};'use strict';var _=require(_0xb745('0x0'));var util=require(_0xb745('0x1'));var moment=require(_0xb745('0x2'));var BPromise=require(_0xb745('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb745('0x4'));var db=require(_0xb745('0x5'))['db'];var utils=require(_0xb745('0x6'));var logger=require(_0xb745('0x7'))(_0xb745('0x8'));var config=require(_0xb745('0x9'));var jayson=require(_0xb745('0xa'));var client=jayson[_0xb745('0xb')][_0xb745('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb745('0xd'),'port':0x18eb});var socket=require(_0xb745('0xe'))(new Redis(config[_0xb745('0xf')]));require(_0xb745('0x10'))[_0xb745('0x11')](socket);function respondWithRpcPromise(_0x4d8e12,_0x6bb27d,_0x4dab49){return new BPromise(function(_0x5b6045,_0x49a0ef){return client[_0xb745('0x12')](_0x4d8e12,_0x4dab49)['then'](function(_0x5905a7){logger['info'](_0xb745('0x13'),_0x6bb27d,_0xb745('0x14'));logger[_0xb745('0x15')](_0xb745('0x16'),_0x6bb27d,'request\x20sent',JSON['stringify'](_0x5905a7));if(_0x5905a7[_0xb745('0x17')]){if(_0x5905a7[_0xb745('0x17')][_0xb745('0x18')]===0x1f4){logger[_0xb745('0x17')](_0xb745('0x13'),_0x6bb27d,_0x5905a7['error']['message']);return _0x49a0ef(_0x5905a7[_0xb745('0x17')]['message']);}logger[_0xb745('0x17')](_0xb745('0x13'),_0x6bb27d,_0x5905a7[_0xb745('0x17')][_0xb745('0x19')]);return _0x5b6045(_0x5905a7[_0xb745('0x17')][_0xb745('0x19')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x6bb27d,_0xb745('0x14'));_0x5b6045(_0x5905a7[_0xb745('0x1a')][_0xb745('0x19')]);}})[_0xb745('0x1b')](function(_0xea39db){logger[_0xb745('0x17')](_0xb745('0x13'),_0x6bb27d,_0xea39db);_0x49a0ef(_0xea39db);});});}exports[_0xb745('0x1c')]=function(_0x5599b2){var _0x3f4572=this;return new Promise(function(_0x296cad,_0x58cd4d){return db[_0xb745('0x1d')][_0xb745('0x1e')](_0x5599b2[_0xb745('0x1f')],{'raw':_0x5599b2[_0xb745('0x20')]?_0x5599b2[_0xb745('0x20')][_0xb745('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5599b2[_0xb745('0x20')]?_0x5599b2[_0xb745('0x20')][_0xb745('0x22')]||null:null,'attributes':_0x5599b2[_0xb745('0x20')]?_0x5599b2[_0xb745('0x20')][_0xb745('0x23')]||null:null,'limit':_0x5599b2[_0xb745('0x20')]?_0x5599b2[_0xb745('0x20')]['limit']||null:null})[_0xb745('0x24')](function(_0x532db1){logger[_0xb745('0x25')](_0xb745('0x1c'),_0x5599b2);logger[_0xb745('0x15')]('UpdateFaxInteraction',_0x5599b2,JSON[_0xb745('0x26')](_0x532db1));_0x296cad(_0x532db1);})['catch'](function(_0x84b38a){logger[_0xb745('0x17')](_0xb745('0x1c'),_0x84b38a['message'],_0x5599b2);_0x58cd4d(_0x3f4572[_0xb745('0x17')](0x1f4,_0x84b38a[_0xb745('0x19')]));});});};exports[_0xb745('0x27')]=function(_0x449fb5){return new Promise(function(_0x5736bd,_0x5c1515){return db[_0xb745('0x1d')][_0xb745('0x28')]({'where':_0x449fb5[_0xb745('0x20')]?_0x449fb5[_0xb745('0x20')][_0xb745('0x22')]||null:null})[_0xb745('0x24')](function(_0x38d4f5){if(_0x38d4f5){return _0x38d4f5[_0xb745('0x29')](_0x449fb5[_0xb745('0x1f')][_0xb745('0x2a')],_[_0xb745('0x2b')](_0x449fb5['body'],[_0xb745('0x2a'),'id'])||{});}})[_0xb745('0x2c')](function(_0x22cdd9){logger[_0xb745('0x25')](_0xb745('0x2d'),_0x449fb5);logger['debug'](_0xb745('0x2d'),_0x449fb5,JSON[_0xb745('0x26')](_0x22cdd9));_0x5736bd(_0x22cdd9);})[_0xb745('0x1b')](function(_0x5d8ba4){logger[_0xb745('0x17')]('AddTags',_0x5d8ba4[_0xb745('0x19')],_0x449fb5);_0x5c1515(_this[_0xb745('0x17')](0x1f4,_0x5d8ba4[_0xb745('0x19')]));});});}; \ No newline at end of file +var _0xc58b=['code','message','result','catch','FaxInteraction','update','options','where','attributes','UpdateFaxInteraction','AddTagsToFaxInteraction','find','then','addTags','body','ids','omit','spread','AddTags','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x57aafb,_0x54d8dd){var _0x498b26=function(_0x4c9f7d){while(--_0x4c9f7d){_0x57aafb['push'](_0x57aafb['shift']());}};_0x498b26(++_0x54d8dd);}(_0xc58b,0x89));var _0xbc58=function(_0x605672,_0x23156e){_0x605672=_0x605672-0x0;var _0x34d875=_0xc58b[_0x605672];return _0x34d875;};'use strict';var _=require(_0xbc58('0x0'));var util=require(_0xbc58('0x1'));var moment=require('moment');var BPromise=require(_0xbc58('0x2'));var rs=require(_0xbc58('0x3'));var fs=require('fs');var Redis=require(_0xbc58('0x4'));var db=require(_0xbc58('0x5'))['db'];var utils=require(_0xbc58('0x6'));var logger=require(_0xbc58('0x7'))(_0xbc58('0x8'));var config=require(_0xbc58('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbc58('0xa')]({'port':0x232a});config[_0xbc58('0xb')]=_['defaults'](config[_0xbc58('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc58('0xb')]));require('./faxInteraction.socket')[_0xbc58('0xc')](socket);function respondWithRpcPromise(_0x2758b6,_0x2b5574,_0x2b0b16){return new BPromise(function(_0x584b9a,_0x12b9c5){return client[_0xbc58('0xd')](_0x2758b6,_0x2b0b16)['then'](function(_0x4f075d){logger[_0xbc58('0xe')](_0xbc58('0xf'),_0x2b5574,_0xbc58('0x10'));logger[_0xbc58('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2b5574,_0xbc58('0x10'),JSON['stringify'](_0x4f075d));if(_0x4f075d[_0xbc58('0x12')]){if(_0x4f075d[_0xbc58('0x12')][_0xbc58('0x13')]===0x1f4){logger[_0xbc58('0x12')](_0xbc58('0xf'),_0x2b5574,_0x4f075d[_0xbc58('0x12')]['message']);return _0x12b9c5(_0x4f075d['error']['message']);}logger[_0xbc58('0x12')](_0xbc58('0xf'),_0x2b5574,_0x4f075d[_0xbc58('0x12')][_0xbc58('0x14')]);return _0x584b9a(_0x4f075d[_0xbc58('0x12')][_0xbc58('0x14')]);}else{logger['info'](_0xbc58('0xf'),_0x2b5574,_0xbc58('0x10'));_0x584b9a(_0x4f075d[_0xbc58('0x15')]['message']);}})[_0xbc58('0x16')](function(_0x59f2cd){logger['error'](_0xbc58('0xf'),_0x2b5574,_0x59f2cd);_0x12b9c5(_0x59f2cd);});});}exports['UpdateFaxInteraction']=function(_0x51f162){var _0x4954cd=this;return new Promise(function(_0x49371c,_0x57e80d){return db[_0xbc58('0x17')][_0xbc58('0x18')](_0x51f162['body'],{'raw':_0x51f162[_0xbc58('0x19')]?_0x51f162[_0xbc58('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51f162[_0xbc58('0x19')]?_0x51f162['options'][_0xbc58('0x1a')]||null:null,'attributes':_0x51f162[_0xbc58('0x19')]?_0x51f162[_0xbc58('0x19')][_0xbc58('0x1b')]||null:null,'limit':_0x51f162[_0xbc58('0x19')]?_0x51f162['options']['limit']||null:null})['then'](function(_0x1c2328){logger['info'](_0xbc58('0x1c'),_0x51f162);logger[_0xbc58('0x11')](_0xbc58('0x1c'),_0x51f162,JSON['stringify'](_0x1c2328));_0x49371c(_0x1c2328);})[_0xbc58('0x16')](function(_0x1d18ba){logger[_0xbc58('0x12')](_0xbc58('0x1c'),_0x1d18ba['message'],_0x51f162);_0x57e80d(_0x4954cd[_0xbc58('0x12')](0x1f4,_0x1d18ba[_0xbc58('0x14')]));});});};exports[_0xbc58('0x1d')]=function(_0x2a35fc){return new Promise(function(_0x28685e,_0x1cd91a){return db[_0xbc58('0x17')][_0xbc58('0x1e')]({'where':_0x2a35fc[_0xbc58('0x19')]?_0x2a35fc[_0xbc58('0x19')][_0xbc58('0x1a')]||null:null})[_0xbc58('0x1f')](function(_0x5b0355){if(_0x5b0355){return _0x5b0355[_0xbc58('0x20')](_0x2a35fc[_0xbc58('0x21')][_0xbc58('0x22')],_[_0xbc58('0x23')](_0x2a35fc[_0xbc58('0x21')],[_0xbc58('0x22'),'id'])||{});}})[_0xbc58('0x24')](function(_0x53d22f){logger[_0xbc58('0xe')](_0xbc58('0x25'),_0x2a35fc);logger['debug'](_0xbc58('0x25'),_0x2a35fc,JSON[_0xbc58('0x26')](_0x53d22f));_0x28685e(_0x53d22f);})[_0xbc58('0x16')](function(_0x5ce22c){logger[_0xbc58('0x12')](_0xbc58('0x25'),_0x5ce22c[_0xbc58('0x14')],_0x2a35fc);_0x1cd91a(_this[_0xbc58('0x12')](0x1f4,_0x5ce22c[_0xbc58('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 009dae2..f4fd4df 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 _0x0c6d=['faxInteraction:','./faxInteraction.events','remove','update','emit','removeListener','register'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0x0c6d,0x182));var _0xd0c6=function(_0x2c7923,_0x224701){_0x2c7923=_0x2c7923-0x0;var _0x4d30c1=_0x0c6d[_0x2c7923];return _0x4d30c1;};'use strict';var FaxInteractionEvents=require(_0xd0c6('0x0'));var events=['save',_0xd0c6('0x1'),_0xd0c6('0x2')];function createListener(_0xbd1398,_0x1831d6){return function(_0x3bac30){_0x1831d6[_0xd0c6('0x3')](_0xbd1398,_0x3bac30);};}function removeListener(_0x22d79f,_0x4c356f){return function(){FaxInteractionEvents[_0xd0c6('0x4')](_0x22d79f,_0x4c356f);};}exports[_0xd0c6('0x5')]=function(_0x4fb676){for(var _0xc0bb82=0x0,_0x16fc0c=events['length'];_0xc0bb82<_0x16fc0c;_0xc0bb82++){var _0x1cb730=events[_0xc0bb82];var _0x3b958d=createListener(_0xd0c6('0x6')+_0x1cb730,_0x4fb676);FaxInteractionEvents['on'](_0x1cb730,_0x3b958d);}}; \ No newline at end of file +var _0x91d4=['register','length','faxInteraction:','./faxInteraction.events','save','update','removeListener'];(function(_0x5aa184,_0x1293d9){var _0x5c785d=function(_0x17b6b8){while(--_0x17b6b8){_0x5aa184['push'](_0x5aa184['shift']());}};_0x5c785d(++_0x1293d9);}(_0x91d4,0x73));var _0x491d=function(_0x4ec216,_0xa8ac4d){_0x4ec216=_0x4ec216-0x0;var _0x24d4d5=_0x91d4[_0x4ec216];return _0x24d4d5;};'use strict';var FaxInteractionEvents=require(_0x491d('0x0'));var events=[_0x491d('0x1'),'remove',_0x491d('0x2')];function createListener(_0x301121,_0x1cade6){return function(_0x5bfcac){_0x1cade6['emit'](_0x301121,_0x5bfcac);};}function removeListener(_0x26ac17,_0x87a13f){return function(){FaxInteractionEvents[_0x491d('0x3')](_0x26ac17,_0x87a13f);};}exports[_0x491d('0x4')]=function(_0xc033c3){for(var _0x304a6e=0x0,_0x597137=events[_0x491d('0x5')];_0x304a6e<_0x597137;_0x304a6e++){var _0x583ebb=events[_0x304a6e];var _0xbadeb9=createListener(_0x491d('0x6')+_0x583ebb,_0xc033c3);FaxInteractionEvents['on'](_0x583ebb,_0xbadeb9);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e0e2072..e68f856 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 _0x4ed0=['faxinteraction:update','destroy','delete','/:id/tags','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','tracked','faxinteraction:addtags','put','fax'];(function(_0x953701,_0x5d2bf2){var _0x5a2c8f=function(_0xe8a01){while(--_0xe8a01){_0x953701['push'](_0x953701['shift']());}};_0x5a2c8f(++_0x5d2bf2);}(_0x4ed0,0x79));var _0x04ed=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4ed0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x04ed('0x0'));var util=require('util');var path=require(_0x04ed('0x1'));var timeout=require('connect-timeout');var express=require(_0x04ed('0x2'));var router=express[_0x04ed('0x3')]();var fs_extra=require(_0x04ed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x04ed('0x5'));var config=require(_0x04ed('0x6'));var controller=require('./faxInteraction.controller');router[_0x04ed('0x7')]('/',auth[_0x04ed('0x8')](),controller[_0x04ed('0x9')]);router[_0x04ed('0x7')](_0x04ed('0xa'),auth[_0x04ed('0x8')](),controller[_0x04ed('0xb')]);router[_0x04ed('0x7')](_0x04ed('0xc'),auth[_0x04ed('0x8')](),controller[_0x04ed('0xd')]);router[_0x04ed('0x7')](_0x04ed('0xe'),auth[_0x04ed('0x8')](),controller['getMessages']);router[_0x04ed('0x7')](_0x04ed('0xf'),auth[_0x04ed('0x8')](),controller[_0x04ed('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x04ed('0x11')]);router[_0x04ed('0x12')]('/:id/messages',auth[_0x04ed('0x8')](),controller[_0x04ed('0x13')]);router[_0x04ed('0x12')]('/:id/tags',auth[_0x04ed('0x8')](),interaction[_0x04ed('0x14')]('fax',_0x04ed('0x15')),controller['addTags']);router[_0x04ed('0x16')](_0x04ed('0xc'),auth[_0x04ed('0x8')](),interaction[_0x04ed('0x14')](_0x04ed('0x17'),_0x04ed('0x18')),controller['update']);router['delete'](_0x04ed('0xc'),auth[_0x04ed('0x8')](),interaction[_0x04ed('0x14')]('fax','faxinteraction:destroy'),controller[_0x04ed('0x19')]);router[_0x04ed('0x1a')](_0x04ed('0x1b'),auth[_0x04ed('0x8')](),controller['removeTags']);module[_0x04ed('0x1c')]=router; \ No newline at end of file +var _0x8c85=['/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','describe','show'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x8c85,0x9d));var _0x58c8=function(_0x516581,_0x150e0c){_0x516581=_0x516581-0x0;var _0x34818e=_0x8c85[_0x516581];return _0x34818e;};'use strict';var multer=require(_0x58c8('0x0'));var util=require('util');var path=require(_0x58c8('0x1'));var timeout=require(_0x58c8('0x2'));var express=require(_0x58c8('0x3'));var router=express[_0x58c8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x58c8('0x5'));var interaction=require(_0x58c8('0x6'));var config=require(_0x58c8('0x7'));var controller=require(_0x58c8('0x8'));router[_0x58c8('0x9')]('/',auth['isAuthenticated'](),controller[_0x58c8('0xa')]);router[_0x58c8('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x58c8('0xb')]);router[_0x58c8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x58c8('0xc')]);router[_0x58c8('0x9')](_0x58c8('0xd'),auth[_0x58c8('0xe')](),controller[_0x58c8('0xf')]);router[_0x58c8('0x9')](_0x58c8('0x10'),auth[_0x58c8('0xe')](),controller[_0x58c8('0x11')]);router[_0x58c8('0x12')]('/',auth['isAuthenticated'](),controller[_0x58c8('0x13')]);router[_0x58c8('0x12')](_0x58c8('0xd'),auth['isAuthenticated'](),controller[_0x58c8('0x14')]);router['post'](_0x58c8('0x15'),auth[_0x58c8('0xe')](),interaction[_0x58c8('0x16')](_0x58c8('0x17'),_0x58c8('0x18')),controller[_0x58c8('0x19')]);router['put'](_0x58c8('0x1a'),auth['isAuthenticated'](),interaction['tracked'](_0x58c8('0x17'),_0x58c8('0x1b')),controller[_0x58c8('0x1c')]);router[_0x58c8('0x1d')]('/:id',auth[_0x58c8('0xe')](),interaction[_0x58c8('0x16')](_0x58c8('0x17'),_0x58c8('0x1e')),controller[_0x58c8('0x1f')]);router[_0x58c8('0x1d')](_0x58c8('0x15'),auth[_0x58c8('0xe')](),controller[_0x58c8('0x20')]);module[_0x58c8('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 40ff5d7..681e71d 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 _0xc73e=['BOOLEAN','TEXT','DATE','sequelize','exports','medium'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xc73e,0x1e9));var _0xec73=function(_0x37350d,_0x50d222){_0x37350d=_0x37350d-0x0;var _0x7ee2ba=_0xc73e[_0x37350d];return _0x7ee2ba;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'body':{'type':Sequelize['TEXT'](_0xec73('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xec73('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xec73('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0xec73('0x5')]}}; \ No newline at end of file +var _0x48ea=['sequelize','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x3216f5,_0xe32e8a){var _0x17035a=function(_0x5f28cd){while(--_0x5f28cd){_0x3216f5['push'](_0x3216f5['shift']());}};_0x17035a(++_0xe32e8a);}(_0x48ea,0x9c));var _0xa48e=function(_0x3ba92f,_0x4f1af6){_0x3ba92f=_0x3ba92f-0x0;var _0x282bc1=_0x48ea[_0x3ba92f];return _0x282bc1;};'use strict';var Sequelize=require(_0xa48e('0x0'));module['exports']={'body':{'type':Sequelize[_0xa48e('0x1')](_0xa48e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa48e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa48e('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xa48e('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 12ab527..c746008 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 _0x6a5a=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','include','body','find','describe','accept','sms','acceptMessage','fax','UserId','user','agent','params','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','format','SIP/%s','channel','motionChannel','reject','EventManager','rejectmessage','create','CmContact','findOne','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','util','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','socket.io-emitter','./faxMessage.socket','jayson/promise','client','fax-interactions','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','map','FaxMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1da736,_0x59db5e){var _0x5d19cc=function(_0x18e69e){while(--_0x18e69e){_0x1da736['push'](_0x1da736['shift']());}};_0x5d19cc(++_0x59db5e);}(_0x6a5a,0x11c));var _0xa6a5=function(_0x2ae0d7,_0x830c8f){_0x2ae0d7=_0x2ae0d7-0x0;var _0x12bb57=_0x6a5a[_0x2ae0d7];return _0x12bb57;};'use strict';var util=require(_0xa6a5('0x0'));var path=require('path');var _=require('lodash');var Redis=require('ioredis');var interactionService=require('../../components/interaction/service');var qs=require(_0xa6a5('0x1'));var logger=require(_0xa6a5('0x2'))('api');var config=require(_0xa6a5('0x3'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa6a5('0x4')](config[_0xa6a5('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xa6a5('0x6'))(new Redis(config['redis']));require(_0xa6a5('0x7'))['register'](socket);var jayson=require(_0xa6a5('0x8'));var client=jayson[_0xa6a5('0x9')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require(_0xa6a5('0x2'))(_0xa6a5('0xa'));function respondWithRpcPromise(_0x121e97,_0x478806,_0x456d4e,_0x3c28bc){return new Promise(function(_0x27768e,_0xfb880d){var _0x5c4017=_0x3c28bc||client;return _0x5c4017[_0xa6a5('0xb')](_0x121e97,_0x456d4e)['then'](function(_0x3c8bd6){logger['info'](_0xa6a5('0xc'),_0x478806,_0xa6a5('0xd'));logger[_0xa6a5('0xe')](_0xa6a5('0xf'),_0x478806,_0xa6a5('0xd'),JSON[_0xa6a5('0x10')](_0x3c8bd6));if(_0x3c8bd6['error']){if(_0x3c8bd6[_0xa6a5('0x11')][_0xa6a5('0x12')]===0x1f4){logger[_0xa6a5('0x11')](_0xa6a5('0xc'),_0x478806,_0x3c8bd6['error'][_0xa6a5('0x13')]);return _0xfb880d(_0x3c8bd6[_0xa6a5('0x11')][_0xa6a5('0x13')]);}logger[_0xa6a5('0x11')](_0xa6a5('0xc'),_0x478806,_0x3c8bd6['error'][_0xa6a5('0x13')]);return _0x27768e(_0x3c8bd6['error']['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x478806,_0xa6a5('0xd'));_0x27768e(_0x3c8bd6[_0xa6a5('0x14')][_0xa6a5('0x13')]);}})[_0xa6a5('0x15')](function(_0x208cdd){logger[_0xa6a5('0x11')](_0xa6a5('0xc'),_0x478806,_0x208cdd);_0xfb880d(_0x208cdd);});});}function respondWithResult(_0x482132,_0x2197f6){_0x2197f6=_0x2197f6||0xc8;return function(_0x58525e){if(_0x58525e){return _0x482132[_0xa6a5('0x16')](_0x2197f6)[_0xa6a5('0x17')](_0x58525e);}};}function respondWithFilteredResult(_0x22ba0d,_0x40d7c5){return function(_0x376504){if(_0x376504){var _0x2fc761=typeof _0x40d7c5[_0xa6a5('0x18')]===_0xa6a5('0x19')&&typeof _0x40d7c5['limit']==='undefined';var _0x50f67a=_0x376504['count'];var _0x5ce740=_0x2fc761?0x0:_0x40d7c5[_0xa6a5('0x18')];var _0x55ff5c=_0x2fc761?_0x376504[_0xa6a5('0x1a')]:_0x40d7c5[_0xa6a5('0x18')]+_0x40d7c5[_0xa6a5('0x1b')];var _0x493a72;if(_0x55ff5c>=_0x50f67a){_0x55ff5c=_0x50f67a;_0x493a72=0xc8;}else{_0x493a72=0xce;}_0x22ba0d['status'](_0x493a72);return _0x22ba0d[_0xa6a5('0x1c')](_0xa6a5('0x1d'),_0x5ce740+'-'+_0x55ff5c+'/'+_0x50f67a)[_0xa6a5('0x17')](_0x376504);}return null;};}function saveUpdates(_0x78deec){return function(_0x1dc53f){if(_0x1dc53f){return _0x1dc53f[_0xa6a5('0x1e')](_0x78deec)[_0xa6a5('0x1f')](function(_0x16f1b3){return _0x16f1b3;});}return null;};}function removeEntity(_0x36a64c){return function(_0x1d2d4b){if(_0x1d2d4b){return _0x1d2d4b[_0xa6a5('0x20')]()[_0xa6a5('0x1f')](function(){_0x36a64c[_0xa6a5('0x16')](0xcc)[_0xa6a5('0x21')]();});}};}function handleEntityNotFound(_0x39381e){return function(_0x2fbe34){if(!_0x2fbe34){_0x39381e[_0xa6a5('0x22')](0x194);}return _0x2fbe34;};}function handleError(_0x158416,_0x1a4e06){_0x1a4e06=_0x1a4e06||0x1f4;return function(_0x53bda5){logger['error'](_0x53bda5[_0xa6a5('0x23')]);if(_0x53bda5[_0xa6a5('0x24')]){delete _0x53bda5['name'];}_0x158416[_0xa6a5('0x16')](_0x1a4e06)['send'](_0x53bda5);};}exports['index']=function(_0x17c906,_0x1cb91e){var _0x346f5a={},_0xc9bdf5={},_0x47bf7d={'count':0x0,'rows':[]};var _0x1ddb1d=_[_0xa6a5('0x25')](db[_0xa6a5('0x26')][_0xa6a5('0x27')],function(_0x44e9de){return{'name':_0x44e9de['fieldName'],'type':_0x44e9de[_0xa6a5('0x28')][_0xa6a5('0x29')]};});_0xc9bdf5[_0xa6a5('0x2a')]=_[_0xa6a5('0x25')](_0x1ddb1d,_0xa6a5('0x24'));_0xc9bdf5[_0xa6a5('0x2b')]=_[_0xa6a5('0x2c')](_0x17c906[_0xa6a5('0x2b')]);_0xc9bdf5[_0xa6a5('0x2d')]=_[_0xa6a5('0x2e')](_0xc9bdf5[_0xa6a5('0x2a')],_0xc9bdf5['query']);_0x346f5a[_0xa6a5('0x2f')]=_[_0xa6a5('0x2e')](_0xc9bdf5[_0xa6a5('0x2a')],qs[_0xa6a5('0x30')](_0x17c906[_0xa6a5('0x2b')][_0xa6a5('0x30')]));_0x346f5a[_0xa6a5('0x2f')]=_0x346f5a['attributes']['length']?_0x346f5a[_0xa6a5('0x2f')]:_0xc9bdf5[_0xa6a5('0x2a')];if(!_0x17c906['query']['hasOwnProperty'](_0xa6a5('0x31'))){_0x346f5a['limit']=qs[_0xa6a5('0x1b')](_0x17c906[_0xa6a5('0x2b')][_0xa6a5('0x1b')]);_0x346f5a['offset']=qs[_0xa6a5('0x18')](_0x17c906[_0xa6a5('0x2b')][_0xa6a5('0x18')]);}_0x346f5a[_0xa6a5('0x32')]=qs[_0xa6a5('0x33')](_0x17c906[_0xa6a5('0x2b')][_0xa6a5('0x33')]);_0x346f5a[_0xa6a5('0x34')]=qs[_0xa6a5('0x2d')](_['pick'](_0x17c906[_0xa6a5('0x2b')],_0xc9bdf5['filters']),_0x1ddb1d);if(_0x17c906[_0xa6a5('0x2b')][_0xa6a5('0x35')]){_0x346f5a[_0xa6a5('0x34')]=_[_0xa6a5('0x36')](_0x346f5a[_0xa6a5('0x34')],{'$or':_['map'](_0x1ddb1d,function(_0x4785cd){if(_0x4785cd[_0xa6a5('0x28')]!==_0xa6a5('0x37')){var _0x14765f={};_0x14765f[_0x4785cd['name']]={'$like':'%'+_0x17c906[_0xa6a5('0x2b')]['filter']+'%'};return _0x14765f;}})});}_0x346f5a=_['merge']({},_0x346f5a,_0x17c906[_0xa6a5('0x38')]);var _0x30a7e3={'where':_0x346f5a[_0xa6a5('0x34')]};return db['FaxMessage'][_0xa6a5('0x1a')](_0x30a7e3)['then'](function(_0x2bf5b8){_0x47bf7d['count']=_0x2bf5b8;if(_0x17c906['query'][_0xa6a5('0x39')]){_0x346f5a['include']=[{'all':!![]}];}return db[_0xa6a5('0x26')]['findAll'](_0x346f5a);})[_0xa6a5('0x1f')](function(_0x2c047c){_0x47bf7d[_0xa6a5('0x3a')]=_0x2c047c;return _0x47bf7d;})[_0xa6a5('0x1f')](respondWithFilteredResult(_0x1cb91e,_0x346f5a))[_0xa6a5('0x15')](handleError(_0x1cb91e,null));};exports[_0xa6a5('0x3b')]=function(_0x4a651b,_0x2b83cc){var _0x5bd2d4={'raw':!![],'where':{'id':_0x4a651b['params']['id']}},_0x2dfcab={};_0x2dfcab['model']=_['keys'](db[_0xa6a5('0x26')][_0xa6a5('0x27')]);_0x2dfcab[_0xa6a5('0x2b')]=_[_0xa6a5('0x2c')](_0x4a651b[_0xa6a5('0x2b')]);_0x2dfcab[_0xa6a5('0x2d')]=_[_0xa6a5('0x2e')](_0x2dfcab[_0xa6a5('0x2a')],_0x2dfcab[_0xa6a5('0x2b')]);_0x5bd2d4[_0xa6a5('0x2f')]=_[_0xa6a5('0x2e')](_0x2dfcab['model'],qs['fields'](_0x4a651b[_0xa6a5('0x2b')][_0xa6a5('0x30')]));_0x5bd2d4[_0xa6a5('0x2f')]=_0x5bd2d4['attributes']['length']?_0x5bd2d4[_0xa6a5('0x2f')]:_0x2dfcab[_0xa6a5('0x2a')];if(_0x4a651b[_0xa6a5('0x2b')][_0xa6a5('0x39')]){_0x5bd2d4[_0xa6a5('0x3c')]=[{'all':!![]}];}_0x5bd2d4=_[_0xa6a5('0x36')]({},_0x5bd2d4,_0x4a651b['options']);return db[_0xa6a5('0x26')]['find'](_0x5bd2d4)[_0xa6a5('0x1f')](handleEntityNotFound(_0x2b83cc,null))['then'](respondWithResult(_0x2b83cc,null))[_0xa6a5('0x15')](handleError(_0x2b83cc,null));};exports['update']=function(_0x248bc3,_0x28dfa2){if(_0x248bc3[_0xa6a5('0x3d')]['id']){delete _0x248bc3[_0xa6a5('0x3d')]['id'];}return db[_0xa6a5('0x26')]['find']({'where':{'id':_0x248bc3['params']['id']}})[_0xa6a5('0x1f')](handleEntityNotFound(_0x28dfa2,null))['then'](saveUpdates(_0x248bc3[_0xa6a5('0x3d')],null))[_0xa6a5('0x1f')](respondWithResult(_0x28dfa2,null))[_0xa6a5('0x15')](handleError(_0x28dfa2,null));};exports[_0xa6a5('0x20')]=function(_0x198007,_0x5f462e){return db[_0xa6a5('0x26')][_0xa6a5('0x3e')]({'where':{'id':_0x198007['params']['id']}})[_0xa6a5('0x1f')](handleEntityNotFound(_0x5f462e,null))[_0xa6a5('0x1f')](removeEntity(_0x5f462e,null))['catch'](handleError(_0x5f462e,null));};exports['describe']=function(_0x207554,_0x4cf50a){return db[_0xa6a5('0x26')][_0xa6a5('0x3f')]()[_0xa6a5('0x1f')](respondWithResult(_0x4cf50a,null))['catch'](handleError(_0x4cf50a,null));};exports[_0xa6a5('0x40')]=function(_0x365cdb,_0xd3a711){var _0x4ec807=_0xa6a5('0x41');return interactionService[_0xa6a5('0x42')](_0x365cdb,_0x4ec807)[_0xa6a5('0x1f')](respondWithResult(_0xd3a711,null))[_0xa6a5('0x15')](handleError(_0xd3a711,null));};exports[_0xa6a5('0x40')]=function(_0x5259b9,_0x2b8c91){var _0x573375=_0xa6a5('0x43');return interactionService[_0xa6a5('0x42')](_0x5259b9,_0x573375)['then'](respondWithResult(_0x2b8c91,null))[_0xa6a5('0x15')](handleError(_0x2b8c91,null));};exports['reject']=function(_0xd38296,_0x4e859e){var _0x170b52={'agent':{},'channel':_0xa6a5('0x43')};if(_0xd38296[_0xa6a5('0x3d')]['id']){delete _0xd38296['body']['id'];}_0xd38296[_0xa6a5('0x3d')][_0xa6a5('0x44')]=_0xd38296[_0xa6a5('0x3d')][_0xa6a5('0x44')]||_0xd38296[_0xa6a5('0x45')]['id'];_0x170b52[_0xa6a5('0x46')]['id']=_0xd38296[_0xa6a5('0x3d')][_0xa6a5('0x44')];return db[_0xa6a5('0x26')][_0xa6a5('0x3e')]({'where':{'id':_0xd38296[_0xa6a5('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4e859e,null))[_0xa6a5('0x1f')](function(_0x3b85fe){if(_0x3b85fe){_0x170b52[_0xa6a5('0x13')]=_0x3b85fe[_0xa6a5('0x48')]({'plain':!![]});return db[_0xa6a5('0x49')][_0xa6a5('0x3e')]({'where':{'id':_0x3b85fe[_0xa6a5('0x4a')]}});}return null;})[_0xa6a5('0x1f')](handleEntityNotFound(_0x4e859e,null))[_0xa6a5('0x1f')](function(_0x50c165){if(_0x50c165){_0x170b52[_0xa6a5('0x4b')]=_0x50c165[_0xa6a5('0x48')]({'plain':!![]});interaction_log['info'](_0xa6a5('0x4c'),_0xd38296[_0xa6a5('0x45')]['id'],_0xd38296[_0xa6a5('0x45')][_0xa6a5('0x24')],_0xd38296[_0xa6a5('0x45')][_0xa6a5('0x4d')],_0x170b52['interaction']['id'],_0xd38296[_0xa6a5('0x3d')]?JSON[_0xa6a5('0x10')](_0xd38296[_0xa6a5('0x3d')]):_0xa6a5('0x4e'));return respondWithRpcPromise(_0xa6a5('0x4f'),_0xa6a5('0x50'),_0x170b52);}return null;})[_0xa6a5('0x1f')](function(_0x58e05c){var _0x45cb52=_0xa6a5('0x51')+_0x58e05c[_0xa6a5('0x13')][_0xa6a5('0x52')];return db[_0xa6a5('0x53')][_0xa6a5('0x2b')](_0x45cb52,{'type':db['Sequelize'][_0xa6a5('0x54')][_0xa6a5('0x55')],'raw':!![]})[_0xa6a5('0x1f')](function(_0x496116){return _0x496116;});})[_0xa6a5('0x1f')](function(_0x3b1eb4){if(_0x3b1eb4){_0x170b52[_0xa6a5('0x13')][_0xa6a5('0x56')]=_0x3b1eb4[0x0];if(!_0xd38296[_0xa6a5('0x3d')][_0xa6a5('0x44')])return;return db[_0xa6a5('0x57')][_0xa6a5('0x3e')]({'where':{'id':_0xd38296[_0xa6a5('0x3d')]['UserId'],'role':_0xa6a5('0x46')},'attributes':['id','name',_0xa6a5('0x58'),_0xa6a5('0x59'),'internal'],'raw':!![]});}return null;})[_0xa6a5('0x1f')](function(_0x5f2b84){if(!_0x5f2b84)return null;_0x170b52[_0xa6a5('0x13')][_0xa6a5('0x46')]=_0x5f2b84;return _0x170b52;})[_0xa6a5('0x1f')](function(_0x182f4d){if(_0x182f4d){_0x182f4d[_0xa6a5('0x13')][_0xa6a5('0x5a')]=util[_0xa6a5('0x5b')](_0xa6a5('0x5c'),_0xd38296[_0xa6a5('0x45')][_0xa6a5('0x24')]);_0x182f4d[_0xa6a5('0x13')][_0xa6a5('0x5d')]=_0x170b52[_0xa6a5('0x5d')];_0x182f4d[_0xa6a5('0x13')][_0xa6a5('0x5e')]=_0x170b52[_0xa6a5('0x5d')];_0x182f4d[_0xa6a5('0x13')]['event']=_0xa6a5('0x5f');respondWithRpcPromise(_0xa6a5('0x60'),_0xa6a5('0x60'),{'event':_0xa6a5('0x61'),'message':_0x182f4d[_0xa6a5('0x13')]},client9002);return _0x170b52;}return null;})[_0xa6a5('0x1f')](respondWithResult(_0x4e859e,null))[_0xa6a5('0x15')](handleError(_0x4e859e,null));};exports[_0xa6a5('0x62')]=function(_0x2643d5,_0x1fe4d4){var _0x3c5607;return db['FaxMessage'][_0xa6a5('0x62')](_0x2643d5[_0xa6a5('0x3d')],{})[_0xa6a5('0x1f')](function(_0xf6b1ab){_0x3c5607=_0xf6b1ab;return db[_0xa6a5('0x63')][_0xa6a5('0x64')]({'where':{'id':_0x3c5607[_0xa6a5('0x52')]}});})['then'](function(_0x2caed8){if(_[_0xa6a5('0x65')](_0x2caed8)){return;}else{_0x3c5607['fax']=_0x2caed8[_0xa6a5('0x43')];return db[_0xa6a5('0x66')][_0xa6a5('0x64')]({'where':{'id':_0x3c5607['AttachmentId']}});}})[_0xa6a5('0x1f')](function(_0x49b8ac){return respondWithRpcPromise(_0xa6a5('0x67'),_0xa6a5('0x67'),{'FaxAccountId':_[_0xa6a5('0x65')](_0x2643d5[_0xa6a5('0x3d')])?undefined:_0x2643d5[_0xa6a5('0x3d')][_0xa6a5('0x68')],'path':_['isNil'](_0x49b8ac)?undefined:util[_0xa6a5('0x5b')](_0xa6a5('0x69'),_0x49b8ac[_0xa6a5('0x6a')]),'fax':_[_0xa6a5('0x65')](_0x3c5607[_0xa6a5('0x43')])?undefined:_0x3c5607['fax'],'AttachmentId':_0x3c5607['AttachmentId']},client9002);})[_0xa6a5('0x1f')](respondWithResult(_0x1fe4d4,0xc9))['catch'](handleError(_0x1fe4d4,null));};exports['download']=function(_0x56ddf5,_0x353ba6){var _0x217bc8=path[_0xa6a5('0x6b')](config[_0xa6a5('0x6c')],_0xa6a5('0x6d'),'files',_0xa6a5('0x6e'));return db[_0xa6a5('0x26')]['find']({'where':{'id':_0x56ddf5['params']['id']},'include':[{'model':db[_0xa6a5('0x66')],'as':_0xa6a5('0x66')}]})['then'](handleEntityNotFound(_0x353ba6,null))['then'](function(_0x34c858){if(_0x34c858){return _0x353ba6['download'](path[_0xa6a5('0x6b')](_0x217bc8,_0x34c858['Attachment']['basename']));}})[_0xa6a5('0x15')](handleError(_0x353ba6,null));}; \ No newline at end of file +var _0x068a=['length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','options','update','body','find','describe','accept','acceptMessage','fax','reject','UserId','user','agent','get','FaxInteraction','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','event','EventManager','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','isNil','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','util','path','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','redis','defaults','./faxMessage.socket','jayson/promise','client','http','../../config/logger','fax-interactions','request','then','info','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','sendStatus','stack','name','send','index','map','FaxMessage','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x4fe328,_0x5e456d){var _0x11a53b=function(_0x42f8cb){while(--_0x42f8cb){_0x4fe328['push'](_0x4fe328['shift']());}};_0x11a53b(++_0x5e456d);}(_0x068a,0xb8));var _0xa068=function(_0x265f40,_0xaff858){_0x265f40=_0x265f40-0x0;var _0x372a11=_0x068a[_0x265f40];return _0x372a11;};'use strict';var util=require(_0xa068('0x0'));var path=require(_0xa068('0x1'));var _=require('lodash');var Redis=require(_0xa068('0x2'));var interactionService=require(_0xa068('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa068('0x4'));var config=require(_0xa068('0x5'));var db=require(_0xa068('0x6'))['db'];config[_0xa068('0x7')]=_[_0xa068('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa068('0x7')]));require(_0xa068('0x9'))['register'](socket);var jayson=require(_0xa068('0xa'));var client=jayson[_0xa068('0xb')]['http']({'port':0x232c});var client9002=jayson[_0xa068('0xb')][_0xa068('0xc')]({'port':0x232a});var interaction_log=require(_0xa068('0xd'))(_0xa068('0xe'));function respondWithRpcPromise(_0x37e0d4,_0x5ac44e,_0x2648a8,_0x1a53e2){return new Promise(function(_0x91e4a6,_0x3e2294){var _0x49d19c=_0x1a53e2||client;return _0x49d19c[_0xa068('0xf')](_0x37e0d4,_0x2648a8)[_0xa068('0x10')](function(_0x19592f){logger[_0xa068('0x11')](_0xa068('0x12'),_0x5ac44e,'request\x20sent');logger['debug'](_0xa068('0x13'),_0x5ac44e,_0xa068('0x14'),JSON[_0xa068('0x15')](_0x19592f));if(_0x19592f[_0xa068('0x16')]){if(_0x19592f['error'][_0xa068('0x17')]===0x1f4){logger[_0xa068('0x16')](_0xa068('0x12'),_0x5ac44e,_0x19592f[_0xa068('0x16')][_0xa068('0x18')]);return _0x3e2294(_0x19592f[_0xa068('0x16')][_0xa068('0x18')]);}logger[_0xa068('0x16')](_0xa068('0x12'),_0x5ac44e,_0x19592f[_0xa068('0x16')][_0xa068('0x18')]);return _0x91e4a6(_0x19592f['error'][_0xa068('0x18')]);}else{logger[_0xa068('0x11')](_0xa068('0x12'),_0x5ac44e,_0xa068('0x14'));_0x91e4a6(_0x19592f[_0xa068('0x19')]['message']);}})[_0xa068('0x1a')](function(_0x511949){logger[_0xa068('0x16')](_0xa068('0x12'),_0x5ac44e,_0x511949);_0x3e2294(_0x511949);});});}function respondWithResult(_0x3d9f6a,_0xc71630){_0xc71630=_0xc71630||0xc8;return function(_0x6321eb){if(_0x6321eb){return _0x3d9f6a[_0xa068('0x1b')](_0xc71630)[_0xa068('0x1c')](_0x6321eb);}};}function respondWithFilteredResult(_0x3885fb,_0x3510bd){return function(_0x43631a){if(_0x43631a){var _0x15e18a=typeof _0x3510bd[_0xa068('0x1d')]===_0xa068('0x1e')&&typeof _0x3510bd[_0xa068('0x1f')]===_0xa068('0x1e');var _0x5c6d06=_0x43631a['count'];var _0x4973a4=_0x15e18a?0x0:_0x3510bd[_0xa068('0x1d')];var _0x3813ad=_0x15e18a?_0x43631a[_0xa068('0x20')]:_0x3510bd[_0xa068('0x1d')]+_0x3510bd['limit'];var _0x44f580;if(_0x3813ad>=_0x5c6d06){_0x3813ad=_0x5c6d06;_0x44f580=0xc8;}else{_0x44f580=0xce;}_0x3885fb[_0xa068('0x1b')](_0x44f580);return _0x3885fb[_0xa068('0x21')](_0xa068('0x22'),_0x4973a4+'-'+_0x3813ad+'/'+_0x5c6d06)[_0xa068('0x1c')](_0x43631a);}return null;};}function saveUpdates(_0x8332c6){return function(_0x179847){if(_0x179847){return _0x179847['update'](_0x8332c6)[_0xa068('0x10')](function(_0x4476d4){return _0x4476d4;});}return null;};}function removeEntity(_0x52af00){return function(_0x1ed163){if(_0x1ed163){return _0x1ed163[_0xa068('0x23')]()[_0xa068('0x10')](function(){_0x52af00[_0xa068('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c3218){return function(_0x4a54cc){if(!_0x4a54cc){_0x4c3218[_0xa068('0x24')](0x194);}return _0x4a54cc;};}function handleError(_0x43a398,_0x2a4ef3){_0x2a4ef3=_0x2a4ef3||0x1f4;return function(_0x473646){logger[_0xa068('0x16')](_0x473646[_0xa068('0x25')]);if(_0x473646['name']){delete _0x473646[_0xa068('0x26')];}_0x43a398[_0xa068('0x1b')](_0x2a4ef3)[_0xa068('0x27')](_0x473646);};}exports[_0xa068('0x28')]=function(_0x599ea2,_0x56c40d){var _0x2ce908={},_0xaa7c23={},_0x4cb842={'count':0x0,'rows':[]};var _0x5e4b0d=_[_0xa068('0x29')](db[_0xa068('0x2a')]['rawAttributes'],function(_0x157bdc){return{'name':_0x157bdc[_0xa068('0x2b')],'type':_0x157bdc[_0xa068('0x2c')]['key']};});_0xaa7c23[_0xa068('0x2d')]=_[_0xa068('0x29')](_0x5e4b0d,_0xa068('0x26'));_0xaa7c23[_0xa068('0x2e')]=_[_0xa068('0x2f')](_0x599ea2['query']);_0xaa7c23[_0xa068('0x30')]=_[_0xa068('0x31')](_0xaa7c23[_0xa068('0x2d')],_0xaa7c23[_0xa068('0x2e')]);_0x2ce908[_0xa068('0x32')]=_[_0xa068('0x31')](_0xaa7c23['model'],qs[_0xa068('0x33')](_0x599ea2['query'][_0xa068('0x33')]));_0x2ce908[_0xa068('0x32')]=_0x2ce908[_0xa068('0x32')][_0xa068('0x34')]?_0x2ce908[_0xa068('0x32')]:_0xaa7c23[_0xa068('0x2d')];if(!_0x599ea2[_0xa068('0x2e')][_0xa068('0x35')](_0xa068('0x36'))){_0x2ce908['limit']=qs[_0xa068('0x1f')](_0x599ea2['query'][_0xa068('0x1f')]);_0x2ce908[_0xa068('0x1d')]=qs['offset'](_0x599ea2[_0xa068('0x2e')][_0xa068('0x1d')]);}_0x2ce908[_0xa068('0x37')]=qs['sort'](_0x599ea2[_0xa068('0x2e')]['sort']);_0x2ce908[_0xa068('0x38')]=qs[_0xa068('0x30')](_[_0xa068('0x39')](_0x599ea2[_0xa068('0x2e')],_0xaa7c23['filters']),_0x5e4b0d);if(_0x599ea2[_0xa068('0x2e')]['filter']){_0x2ce908[_0xa068('0x38')]=_[_0xa068('0x3a')](_0x2ce908[_0xa068('0x38')],{'$or':_[_0xa068('0x29')](_0x5e4b0d,function(_0x360323){if(_0x360323['type']!==_0xa068('0x3b')){var _0x2ae5f2={};_0x2ae5f2[_0x360323[_0xa068('0x26')]]={'$like':'%'+_0x599ea2[_0xa068('0x2e')]['filter']+'%'};return _0x2ae5f2;}})});}_0x2ce908=_[_0xa068('0x3a')]({},_0x2ce908,_0x599ea2['options']);var _0x3e83c7={'where':_0x2ce908[_0xa068('0x38')]};return db[_0xa068('0x2a')][_0xa068('0x20')](_0x3e83c7)[_0xa068('0x10')](function(_0x4d2725){_0x4cb842[_0xa068('0x20')]=_0x4d2725;if(_0x599ea2[_0xa068('0x2e')][_0xa068('0x3c')]){_0x2ce908[_0xa068('0x3d')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x2ce908);})['then'](function(_0x5a0fcc){_0x4cb842[_0xa068('0x3e')]=_0x5a0fcc;return _0x4cb842;})[_0xa068('0x10')](respondWithFilteredResult(_0x56c40d,_0x2ce908))['catch'](handleError(_0x56c40d,null));};exports[_0xa068('0x3f')]=function(_0x39f8ed,_0x4237e9){var _0x52746b={'raw':!![],'where':{'id':_0x39f8ed[_0xa068('0x40')]['id']}},_0x1a54f7={};_0x1a54f7['model']=_[_0xa068('0x2f')](db[_0xa068('0x2a')][_0xa068('0x41')]);_0x1a54f7[_0xa068('0x2e')]=_['keys'](_0x39f8ed[_0xa068('0x2e')]);_0x1a54f7[_0xa068('0x30')]=_['intersection'](_0x1a54f7[_0xa068('0x2d')],_0x1a54f7[_0xa068('0x2e')]);_0x52746b[_0xa068('0x32')]=_[_0xa068('0x31')](_0x1a54f7[_0xa068('0x2d')],qs['fields'](_0x39f8ed[_0xa068('0x2e')][_0xa068('0x33')]));_0x52746b[_0xa068('0x32')]=_0x52746b['attributes'][_0xa068('0x34')]?_0x52746b[_0xa068('0x32')]:_0x1a54f7[_0xa068('0x2d')];if(_0x39f8ed[_0xa068('0x2e')][_0xa068('0x3c')]){_0x52746b[_0xa068('0x3d')]=[{'all':!![]}];}_0x52746b=_[_0xa068('0x3a')]({},_0x52746b,_0x39f8ed[_0xa068('0x42')]);return db[_0xa068('0x2a')]['find'](_0x52746b)[_0xa068('0x10')](handleEntityNotFound(_0x4237e9,null))[_0xa068('0x10')](respondWithResult(_0x4237e9,null))[_0xa068('0x1a')](handleError(_0x4237e9,null));};exports[_0xa068('0x43')]=function(_0x76a8af,_0x39a2c7){if(_0x76a8af['body']['id']){delete _0x76a8af[_0xa068('0x44')]['id'];}return db['FaxMessage'][_0xa068('0x45')]({'where':{'id':_0x76a8af[_0xa068('0x40')]['id']}})['then'](handleEntityNotFound(_0x39a2c7,null))[_0xa068('0x10')](saveUpdates(_0x76a8af[_0xa068('0x44')],null))[_0xa068('0x10')](respondWithResult(_0x39a2c7,null))[_0xa068('0x1a')](handleError(_0x39a2c7,null));};exports[_0xa068('0x23')]=function(_0x8c387,_0x379680){return db[_0xa068('0x2a')][_0xa068('0x45')]({'where':{'id':_0x8c387[_0xa068('0x40')]['id']}})[_0xa068('0x10')](handleEntityNotFound(_0x379680,null))[_0xa068('0x10')](removeEntity(_0x379680,null))[_0xa068('0x1a')](handleError(_0x379680,null));};exports[_0xa068('0x46')]=function(_0x490a38,_0x7d4c75){return db['FaxMessage'][_0xa068('0x46')]()[_0xa068('0x10')](respondWithResult(_0x7d4c75,null))[_0xa068('0x1a')](handleError(_0x7d4c75,null));};exports[_0xa068('0x47')]=function(_0x309e2,_0x1e754b){var _0x434078='sms';return interactionService[_0xa068('0x48')](_0x309e2,_0x434078)[_0xa068('0x10')](respondWithResult(_0x1e754b,null))[_0xa068('0x1a')](handleError(_0x1e754b,null));};exports[_0xa068('0x47')]=function(_0x2b7a4a,_0x513b1d){var _0x23a9e1=_0xa068('0x49');return interactionService[_0xa068('0x48')](_0x2b7a4a,_0x23a9e1)['then'](respondWithResult(_0x513b1d,null))[_0xa068('0x1a')](handleError(_0x513b1d,null));};exports[_0xa068('0x4a')]=function(_0x3cd9b4,_0x1b45c6){var _0x429c41={'agent':{},'channel':_0xa068('0x49')};if(_0x3cd9b4[_0xa068('0x44')]['id']){delete _0x3cd9b4[_0xa068('0x44')]['id'];}_0x3cd9b4[_0xa068('0x44')][_0xa068('0x4b')]=_0x3cd9b4['body']['UserId']||_0x3cd9b4[_0xa068('0x4c')]['id'];_0x429c41[_0xa068('0x4d')]['id']=_0x3cd9b4[_0xa068('0x44')]['UserId'];return db[_0xa068('0x2a')]['find']({'where':{'id':_0x3cd9b4[_0xa068('0x40')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1b45c6,null))[_0xa068('0x10')](function(_0x2f53f2){if(_0x2f53f2){_0x429c41['message']=_0x2f53f2[_0xa068('0x4e')]({'plain':!![]});return db[_0xa068('0x4f')]['find']({'where':{'id':_0x2f53f2['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1b45c6,null))[_0xa068('0x10')](function(_0x1e05b3){if(_0x1e05b3){_0x429c41[_0xa068('0x50')]=_0x1e05b3['get']({'plain':!![]});interaction_log[_0xa068('0x11')](_0xa068('0x51'),_0x3cd9b4[_0xa068('0x4c')]['id'],_0x3cd9b4[_0xa068('0x4c')][_0xa068('0x26')],_0x3cd9b4[_0xa068('0x4c')]['role'],_0x429c41[_0xa068('0x50')]['id'],_0x3cd9b4[_0xa068('0x44')]?JSON['stringify'](_0x3cd9b4[_0xa068('0x44')]):_0xa068('0x52'));return respondWithRpcPromise(_0xa068('0x53'),_0xa068('0x54'),_0x429c41);}return null;})[_0xa068('0x10')](function(_0x37f70a){var _0x4b6b9d=_0xa068('0x55')+_0x37f70a[_0xa068('0x18')][_0xa068('0x56')];return db[_0xa068('0x57')]['query'](_0x4b6b9d,{'type':db[_0xa068('0x58')][_0xa068('0x59')][_0xa068('0x5a')],'raw':!![]})[_0xa068('0x10')](function(_0x3759c1){return _0x3759c1;});})[_0xa068('0x10')](function(_0x1f077d){if(_0x1f077d){_0x429c41[_0xa068('0x18')][_0xa068('0x5b')]=_0x1f077d[0x0];if(!_0x3cd9b4[_0xa068('0x44')][_0xa068('0x4b')])return;return db[_0xa068('0x5c')][_0xa068('0x45')]({'where':{'id':_0x3cd9b4[_0xa068('0x44')][_0xa068('0x4b')],'role':'agent'},'attributes':['id',_0xa068('0x26'),_0xa068('0x5d'),_0xa068('0x5e'),_0xa068('0x5f')],'raw':!![]});}return null;})[_0xa068('0x10')](function(_0x874615){if(!_0x874615)return null;_0x429c41[_0xa068('0x18')][_0xa068('0x4d')]=_0x874615;return _0x429c41;})[_0xa068('0x10')](function(_0xb4b40){if(_0xb4b40){_0xb4b40[_0xa068('0x18')][_0xa068('0x60')]=util[_0xa068('0x61')](_0xa068('0x62'),_0x3cd9b4['user'][_0xa068('0x26')]);_0xb4b40[_0xa068('0x18')]['channel']=_0x429c41[_0xa068('0x63')];_0xb4b40[_0xa068('0x18')]['motionChannel']=_0x429c41[_0xa068('0x63')];_0xb4b40[_0xa068('0x18')][_0xa068('0x64')]='reject';respondWithRpcPromise(_0xa068('0x65'),_0xa068('0x65'),{'event':'rejectmessage','message':_0xb4b40[_0xa068('0x18')]},client9002);return _0x429c41;}return null;})[_0xa068('0x10')](respondWithResult(_0x1b45c6,null))[_0xa068('0x1a')](handleError(_0x1b45c6,null));};exports['create']=function(_0x54c0d9,_0x1126a6){var _0x1e28c4;return db[_0xa068('0x2a')][_0xa068('0x66')](_0x54c0d9['body'],{})[_0xa068('0x10')](function(_0x1d6bc3){_0x1e28c4=_0x1d6bc3;return db[_0xa068('0x67')][_0xa068('0x68')]({'where':{'id':_0x1e28c4[_0xa068('0x56')]}});})[_0xa068('0x10')](function(_0x38cd25){if(_['isNil'](_0x38cd25)){return;}else{_0x1e28c4[_0xa068('0x49')]=_0x38cd25[_0xa068('0x49')];return db[_0xa068('0x69')][_0xa068('0x68')]({'where':{'id':_0x1e28c4[_0xa068('0x6a')]}});}})['then'](function(_0x5cec92){return respondWithRpcPromise(_0xa068('0x6b'),_0xa068('0x6b'),{'FaxAccountId':_['isNil'](_0x54c0d9[_0xa068('0x44')])?undefined:_0x54c0d9[_0xa068('0x44')][_0xa068('0x6c')],'path':_[_0xa068('0x6d')](_0x5cec92)?undefined:util[_0xa068('0x61')](_0xa068('0x6e'),_0x5cec92[_0xa068('0x6f')]),'fax':_[_0xa068('0x6d')](_0x1e28c4[_0xa068('0x49')])?undefined:_0x1e28c4['fax'],'AttachmentId':_0x1e28c4['AttachmentId']},client9002);})[_0xa068('0x10')](respondWithResult(_0x1126a6,0xc9))['catch'](handleError(_0x1126a6,null));};exports[_0xa068('0x70')]=function(_0x5db68d,_0x153453){var _0x361fcc=path[_0xa068('0x71')](config[_0xa068('0x72')],_0xa068('0x73'),_0xa068('0x74'),_0xa068('0x75'));return db[_0xa068('0x2a')][_0xa068('0x45')]({'where':{'id':_0x5db68d[_0xa068('0x40')]['id']},'include':[{'model':db[_0xa068('0x69')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x153453,null))[_0xa068('0x10')](function(_0x427258){if(_0x427258){return _0x153453[_0xa068('0x70')](path['join'](_0x361fcc,_0x427258[_0xa068('0x69')]['basename']));}})[_0xa068('0x1a')](handleError(_0x153453,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 5e10e44..7fd0e6d 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 _0x4279=['update','remove','emit','hook','exports','../../mysqldb','FaxMessage','save'];(function(_0x21f7d4,_0x3fb9df){var _0x143fa7=function(_0x4ace03){while(--_0x4ace03){_0x21f7d4['push'](_0x21f7d4['shift']());}};_0x143fa7(++_0x3fb9df);}(_0x4279,0x8d));var _0x9427=function(_0x80dc42,_0x483a38){_0x80dc42=_0x80dc42-0x0;var _0x118dc3=_0x4279[_0x80dc42];return _0x118dc3;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x9427('0x0'))['db'][_0x9427('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9427('0x2'),'afterUpdate':_0x9427('0x3'),'afterDestroy':_0x9427('0x4')};function emitEvent(_0x32d94e){return function(_0x54cdfb,_0x426911,_0x57f12b){FaxMessageEvents[_0x9427('0x5')](_0x32d94e+':'+_0x54cdfb['id'],_0x54cdfb);FaxMessageEvents[_0x9427('0x5')](_0x32d94e,_0x54cdfb);_0x57f12b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x9427('0x6')](e,emitEvent(event));}}module[_0x9427('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x4975=['FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0x4975,0x86));var _0x5497=function(_0x66f4db,_0x30d78f){_0x66f4db=_0x66f4db-0x0;var _0x160794=_0x4975[_0x66f4db];return _0x160794;};'use strict';var EventEmitter=require(_0x5497('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x5497('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5497('0x2')](0x0);var events={'afterCreate':_0x5497('0x3'),'afterUpdate':_0x5497('0x4'),'afterDestroy':_0x5497('0x5')};function emitEvent(_0x235986){return function(_0x14cecb,_0xeb31af,_0xbb1888){FaxMessageEvents[_0x5497('0x6')](_0x235986+':'+_0x14cecb['id'],_0x14cecb);FaxMessageEvents['emit'](_0x235986,_0x14cecb);_0xbb1888(null);};}for(var e in events){if(events[_0x5497('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x5497('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 127da92..de4fe12 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 _0x61c5=['createdAt','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','FaxInteraction','FaxInteractionId','update'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0x61c5,0x9f));var _0x561c=function(_0x16f547,_0xd09ffb){_0x16f547=_0x16f547-0x0;var _0x45d807=_0x61c5[_0x16f547];return _0x45d807;};'use strict';var _=require(_0x561c('0x0'));var util=require('util');var logger=require(_0x561c('0x1'))(_0x561c('0x2'));var moment=require(_0x561c('0x3'));var BPromise=require('bluebird');var rp=require(_0x561c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x561c('0x5'));var config=require(_0x561c('0x6'));var attributes=require(_0x561c('0x7'));module[_0x561c('0x8')]=function(_0x28c88e,_0xaf3ffe){return _0x28c88e[_0x561c('0x9')]('FaxMessage',attributes,{'tableName':_0x561c('0xa'),'paranoid':![],'indexes':[{'name':_0x561c('0xb'),'fields':[_0x561c('0xc')],'type':_0x561c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38799c,_0x4ec8c4,_0x1ab184){var _0x321bfa=_0x28c88e[_0x561c('0xe')];var _0x15a307=_0x38799c[_0x561c('0xf')]({'plain':!![]});if(_0x15a307[_0x561c('0x10')][_0x561c('0x11')]()==='in'||_0x15a307[_0x561c('0x10')][_0x561c('0x11')]()===_0x561c('0x12')&&!_0x15a307[_0x561c('0x13')]&&!_['isNil'](_0x15a307['UserId'])){_0x321bfa[_0x561c('0x14')]['findOne']({'where':{'id':_0x15a307[_0x561c('0x15')]}})['then'](function(_0x4b795e){if(_0x4b795e){_0x4b795e[_0x561c('0x16')]({'lastMsgAt':_0x15a307[_0x561c('0x17')],'lastMsgDirection':_0x15a307[_0x561c('0x10')][_0x561c('0x11')]()});}})[_0x561c('0x18')](function(_0x218af8){console['error'](_0x218af8);});}_0x1ab184();}},'charset':'utf8mb4','collate':_0x561c('0x19')});}; \ No newline at end of file +var _0xd352=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update'];(function(_0x27b8c2,_0x3cf73a){var _0x22445c=function(_0x55ae2f){while(--_0x55ae2f){_0x27b8c2['push'](_0x27b8c2['shift']());}};_0x22445c(++_0x3cf73a);}(_0xd352,0x6f));var _0x2d35=function(_0x3a95ea,_0xd128f8){_0x3a95ea=_0x3a95ea-0x0;var _0x5b9e26=_0xd352[_0x3a95ea];return _0x5b9e26;};'use strict';var _=require(_0x2d35('0x0'));var util=require('util');var logger=require(_0x2d35('0x1'))(_0x2d35('0x2'));var moment=require(_0x2d35('0x3'));var BPromise=require('bluebird');var rp=require(_0x2d35('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d35('0x5'));var config=require(_0x2d35('0x6'));var attributes=require(_0x2d35('0x7'));module[_0x2d35('0x8')]=function(_0x138e38,_0x397297){return _0x138e38[_0x2d35('0x9')](_0x2d35('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x2d35('0xb'),'fields':['body'],'type':_0x2d35('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x65f834,_0x16a313,_0x1ea5cb){var _0x53d4e5=_0x138e38[_0x2d35('0xd')];var _0x47890c=_0x65f834['get']({'plain':!![]});if(_0x47890c[_0x2d35('0xe')][_0x2d35('0xf')]()==='in'||_0x47890c[_0x2d35('0xe')][_0x2d35('0xf')]()===_0x2d35('0x10')&&!_0x47890c['secret']&&!_[_0x2d35('0x11')](_0x47890c[_0x2d35('0x12')])){_0x53d4e5[_0x2d35('0x13')][_0x2d35('0x14')]({'where':{'id':_0x47890c[_0x2d35('0x15')]}})[_0x2d35('0x16')](function(_0xd1bf55){if(_0xd1bf55){_0xd1bf55[_0x2d35('0x17')]({'lastMsgAt':_0x47890c['createdAt'],'lastMsgDirection':_0x47890c[_0x2d35('0xe')]['toLowerCase']()});}})[_0x2d35('0x18')](function(_0x59b0e6){console['error'](_0x59b0e6);});}_0x1ea5cb();}},'charset':_0x2d35('0x19'),'collate':_0x2d35('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 21dff01..0c60f0e 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 _0x5fd1=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','raw','catch','UpdateFaxMessage','options','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fd1,0x155));var _0x15fd=function(_0x4b695a,_0x4f392d){_0x4b695a=_0x4b695a-0x0;var _0x1174cf=_0x5fd1[_0x4b695a];return _0x1174cf;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});config[_0x15fd('0xa')]=_[_0x15fd('0xb')](config['redis'],{'host':_0x15fd('0xc'),'port':0x18eb});var socket=require(_0x15fd('0xd'))(new Redis(config[_0x15fd('0xa')]));require('./faxMessage.socket')[_0x15fd('0xe')](socket);function respondWithRpcPromise(_0x5c9c63,_0x3dfdbb,_0x250457){return new BPromise(function(_0x4c226a,_0x4883fd){return client['request'](_0x5c9c63,_0x250457)[_0x15fd('0xf')](function(_0x2a4d55){logger[_0x15fd('0x10')](_0x15fd('0x11'),_0x3dfdbb,_0x15fd('0x12'));logger[_0x15fd('0x13')](_0x15fd('0x14'),_0x3dfdbb,_0x15fd('0x12'),JSON[_0x15fd('0x15')](_0x2a4d55));if(_0x2a4d55['error']){if(_0x2a4d55['error']['code']===0x1f4){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);return _0x4883fd(_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);}logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55['error']['message']);return _0x4c226a(_0x2a4d55[_0x15fd('0x16')]['message']);}else{logger[_0x15fd('0x10')]('FaxMessage,\x20%s,\x20%s',_0x3dfdbb,_0x15fd('0x12'));_0x4c226a(_0x2a4d55[_0x15fd('0x18')][_0x15fd('0x17')]);}})['catch'](function(_0x367c36){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x367c36);_0x4883fd(_0x367c36);});});}exports[_0x15fd('0x19')]=function(_0x2fb919){var _0x36a90e=this;return new Promise(function(_0x3761db,_0x2f46f1){return db[_0x15fd('0x1a')][_0x15fd('0x1b')](_0x2fb919[_0x15fd('0x1c')],{'raw':_0x2fb919['options']?_0x2fb919['options'][_0x15fd('0x1d')]===undefined?!![]:![]:!![]})[_0x15fd('0xf')](function(_0x252a1c){logger[_0x15fd('0x10')](_0x15fd('0x19'),_0x2fb919);logger[_0x15fd('0x13')](_0x15fd('0x19'),_0x2fb919,JSON['stringify'](_0x252a1c));_0x3761db(_0x252a1c);})[_0x15fd('0x1e')](function(_0x2d19ac){logger[_0x15fd('0x16')]('CreateFaxMessage',_0x2d19ac[_0x15fd('0x17')],_0x2fb919);_0x2f46f1(_0x36a90e['error'](0x1f4,_0x2d19ac[_0x15fd('0x17')]));});});};exports[_0x15fd('0x1f')]=function(_0x21601d){var _0x4c9708=this;return new Promise(function(_0x16b87c,_0x1cbf2c){return db[_0x15fd('0x1a')]['update'](_0x21601d[_0x15fd('0x1c')],{'raw':_0x21601d['options']?_0x21601d[_0x15fd('0x20')][_0x15fd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x21')]||null:null,'attributes':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x22')]||null:null,'limit':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x23')]||null:null})['then'](function(_0x47c22c){logger[_0x15fd('0x10')]('UpdateFaxMessage',_0x21601d);logger[_0x15fd('0x13')](_0x15fd('0x1f'),_0x21601d,JSON['stringify'](_0x47c22c));_0x16b87c(_0x47c22c);})[_0x15fd('0x1e')](function(_0x197d15){logger['error'](_0x15fd('0x1f'),_0x197d15[_0x15fd('0x17')],_0x21601d);_0x1cbf2c(_0x4c9708[_0x15fd('0x16')](0x1f4,_0x197d15[_0x15fd('0x17')]));});});}; \ No newline at end of file +var _0x81bd=['debug','request\x20sent','stringify','error','message','result','catch','CreateFaxMessage','create','body','options','raw','FaxMessage','update','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0x4373b7,_0x1ee426){var _0x1622da=function(_0x295a47){while(--_0x295a47){_0x4373b7['push'](_0x4373b7['shift']());}};_0x1622da(++_0x1ee426);}(_0x81bd,0x7c));var _0xd81b=function(_0x144725,_0x2ad835){_0x144725=_0x144725-0x0;var _0x516c96=_0x81bd[_0x144725];return _0x516c96;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});config[_0xd81b('0xc')]=_['defaults'](config['redis'],{'host':_0xd81b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0xc')]));require(_0xd81b('0xe'))[_0xd81b('0xf')](socket);function respondWithRpcPromise(_0x86dab6,_0x17fba4,_0x1ff60f){return new BPromise(function(_0x4391be,_0x17e09f){return client[_0xd81b('0x10')](_0x86dab6,_0x1ff60f)[_0xd81b('0x11')](function(_0x215b92){logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,'request\x20sent');logger[_0xd81b('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17fba4,_0xd81b('0x15'),JSON[_0xd81b('0x16')](_0x215b92));if(_0x215b92['error']){if(_0x215b92[_0xd81b('0x17')]['code']===0x1f4){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);return _0x17e09f(_0x215b92[_0xd81b('0x17')]['message']);}logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92['error'][_0xd81b('0x18')]);return _0x4391be(_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);}else{logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,_0xd81b('0x15'));_0x4391be(_0x215b92[_0xd81b('0x19')][_0xd81b('0x18')]);}})[_0xd81b('0x1a')](function(_0x285164){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x285164);_0x17e09f(_0x285164);});});}exports[_0xd81b('0x1b')]=function(_0x3518f0){var _0x156894=this;return new Promise(function(_0x4f8c0b,_0x5f101a){return db['FaxMessage'][_0xd81b('0x1c')](_0x3518f0[_0xd81b('0x1d')],{'raw':_0x3518f0[_0xd81b('0x1e')]?_0x3518f0['options'][_0xd81b('0x1f')]===undefined?!![]:![]:!![]})[_0xd81b('0x11')](function(_0x542ee2){logger[_0xd81b('0x12')](_0xd81b('0x1b'),_0x3518f0);logger[_0xd81b('0x14')](_0xd81b('0x1b'),_0x3518f0,JSON[_0xd81b('0x16')](_0x542ee2));_0x4f8c0b(_0x542ee2);})[_0xd81b('0x1a')](function(_0x255011){logger[_0xd81b('0x17')](_0xd81b('0x1b'),_0x255011[_0xd81b('0x18')],_0x3518f0);_0x5f101a(_0x156894[_0xd81b('0x17')](0x1f4,_0x255011[_0xd81b('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x28768f){var _0x99dbc9=this;return new Promise(function(_0xe3637a,_0x31b9fd){return db[_0xd81b('0x20')][_0xd81b('0x21')](_0x28768f[_0xd81b('0x1d')],{'raw':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28768f[_0xd81b('0x1e')]?_0x28768f['options']['where']||null:null,'attributes':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['attributes']||null:null,'limit':_0x28768f['options']?_0x28768f[_0xd81b('0x1e')][_0xd81b('0x22')]||null:null})[_0xd81b('0x11')](function(_0x289f54){logger[_0xd81b('0x12')](_0xd81b('0x23'),_0x28768f);logger['debug'](_0xd81b('0x23'),_0x28768f,JSON[_0xd81b('0x16')](_0x289f54));_0xe3637a(_0x289f54);})['catch'](function(_0x56d80b){logger[_0xd81b('0x17')](_0xd81b('0x23'),_0x56d80b['message'],_0x28768f);_0x31b9fd(_0x99dbc9['error'](0x1f4,_0x56d80b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index d64a2f2..1f27ade 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 _0xd5f2=['./faxMessage.events','remove','update','emit','removeListener','register','length','faxMessage:'];(function(_0x4548d5,_0x50239a){var _0x10fb5b=function(_0x42da19){while(--_0x42da19){_0x4548d5['push'](_0x4548d5['shift']());}};_0x10fb5b(++_0x50239a);}(_0xd5f2,0x1c0));var _0x2d5f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd5f2[_0x27af45];return _0x18df21;};'use strict';var FaxMessageEvents=require(_0x2d5f('0x0'));var events=['save',_0x2d5f('0x1'),_0x2d5f('0x2')];function createListener(_0x491723,_0x516374){return function(_0x212ea0){_0x516374[_0x2d5f('0x3')](_0x491723,_0x212ea0);};}function removeListener(_0x847295,_0x24bc67){return function(){FaxMessageEvents[_0x2d5f('0x4')](_0x847295,_0x24bc67);};}exports[_0x2d5f('0x5')]=function(_0x3af396){for(var _0x565a82=0x0,_0x403a70=events[_0x2d5f('0x6')];_0x565a82<_0x403a70;_0x565a82++){var _0x265fbc=events[_0x565a82];var _0x22538a=createListener(_0x2d5f('0x7')+_0x265fbc,_0x3af396);FaxMessageEvents['on'](_0x265fbc,_0x22538a);}}; \ No newline at end of file +var _0xa634=['save','remove','emit','removeListener','length','faxMessage:','./faxMessage.events'];(function(_0x210eab,_0x31c14b){var _0x19df0a=function(_0x191cda){while(--_0x191cda){_0x210eab['push'](_0x210eab['shift']());}};_0x19df0a(++_0x31c14b);}(_0xa634,0x133));var _0x4a63=function(_0x50860e,_0x21eccf){_0x50860e=_0x50860e-0x0;var _0x446ae2=_0xa634[_0x50860e];return _0x446ae2;};'use strict';var FaxMessageEvents=require(_0x4a63('0x0'));var events=[_0x4a63('0x1'),_0x4a63('0x2'),'update'];function createListener(_0x535996,_0x1bb23b){return function(_0x39b8e0){_0x1bb23b[_0x4a63('0x3')](_0x535996,_0x39b8e0);};}function removeListener(_0x491109,_0x15745e){return function(){FaxMessageEvents[_0x4a63('0x4')](_0x491109,_0x15745e);};}exports['register']=function(_0x72937e){for(var _0x3d79de=0x0,_0x4f9c20=events[_0x4a63('0x5')];_0x3d79de<_0x4f9c20;_0x3d79de++){var _0x61e0b9=events[_0x3d79de];var _0x2078b6=createListener(_0x4a63('0x6')+_0x61e0b9,_0x72937e);FaxMessageEvents['on'](_0x61e0b9,_0x2078b6);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index bb41739..44f99bc 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 _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/download','download','tracked','fax','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x4d14ab,_0x13c60b){var _0x32f445=function(_0x4db030){while(--_0x4db030){_0x4d14ab['push'](_0x4d14ab['shift']());}};_0x32f445(++_0x13c60b);}(_0x13f6,0x124));var _0x613f=function(_0x157c7c,_0x1a90df){_0x157c7c=_0x157c7c-0x0;var _0x111947=_0x13f6[_0x157c7c];return _0x111947;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['post']('/',auth[_0x613f('0x8')](),interaction[_0x613f('0xf')](_0x613f('0x10'),'faxmessage:create'),controller[_0x613f('0x11')]);router[_0x613f('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x613f('0x12')](_0x613f('0x13'),auth[_0x613f('0x8')](),controller[_0x613f('0x14')]);router[_0x613f('0x12')](_0x613f('0x15'),auth[_0x613f('0x8')](),controller[_0x613f('0x16')]);router[_0x613f('0x17')](_0x613f('0xb'),auth['isAuthenticated'](),controller[_0x613f('0x18')]);module['exports']=router; \ No newline at end of file +var _0x0102=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','exports','util','path','connect-timeout','express','./faxMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x0102,0x186));var _0x2010=function(_0x34d688,_0x54c450){_0x34d688=_0x34d688-0x0;var _0x41daed=_0x0102[_0x34d688];return _0x41daed;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),interaction[_0x2010('0xe')](_0x2010('0xf'),_0x2010('0x10')),controller[_0x2010('0x11')]);router[_0x2010('0x12')](_0x2010('0x13'),auth[_0x2010('0x6')](),controller[_0x2010('0x14')]);router['put']('/:id/accept',auth[_0x2010('0x6')](),controller[_0x2010('0x15')]);router[_0x2010('0x12')](_0x2010('0x16'),auth[_0x2010('0x6')](),controller[_0x2010('0x17')]);router['delete'](_0x2010('0x13'),auth[_0x2010('0x6')](),controller['destroy']);module[_0x2010('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index b6f0526..9d782c0 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 _0x5ae0=['INTEGER','rrmemory','beepall','exports','STRING'];(function(_0x3c7999,_0x36868d){var _0x4723b4=function(_0x1cdd19){while(--_0x1cdd19){_0x3c7999['push'](_0x3c7999['shift']());}};_0x4723b4(++_0x36868d);}(_0x5ae0,0xf8));var _0x05ae=function(_0x471e63,_0x31f283){_0x471e63=_0x471e63-0x0;var _0x106fd2=_0x5ae0[_0x471e63];return _0x106fd2;};'use strict';var Sequelize=require('sequelize');module[_0x05ae('0x0')]={'name':{'type':Sequelize[_0x05ae('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x05ae('0x1')]},'timeout':{'type':Sequelize[_0x05ae('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x05ae('0x3'),_0x05ae('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc4f6=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','name','STRING'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0xc4f6,0x64));var _0x6c4f=function(_0x2dbac7,_0x1ae5f7){_0x2dbac7=_0x2dbac7-0x0;var _0x39dfd8=_0xc4f6[_0x2dbac7];return _0x39dfd8;};'use strict';var Sequelize=require(_0x6c4f('0x0'));module[_0x6c4f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6c4f('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6c4f('0x3')]},'timeout':{'type':Sequelize[_0x6c4f('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6c4f('0x5')](_0x6c4f('0x6'),_0x6c4f('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 53b43ab..bbac98e 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 _0xfcbe=['keys','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','params','UserFaxQueue','rawAttributes','filters','nolimit','order','sort','pick','filter','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','updatedAt','getTeams','hasOwnProperty','addTeams','ids','User','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','Team','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','./faxQueue.socket','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','then','get','FaxQueues','UserProfileResource','sendStatus','error','stack','name','map','FaxQueue','fieldName','type','key','getOptions','where','count','include','query','findAll','rows','catch','show','model'];(function(_0x5f06f7,_0x662011){var _0x102cb9=function(_0x1b713e){while(--_0x1b713e){_0x5f06f7['push'](_0x5f06f7['shift']());}};_0x102cb9(++_0x662011);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x547cbf,_0x8c0f45){_0x547cbf=_0x547cbf-0x0;var _0x1de5ee=_0xfcbe[_0x547cbf];return _0x1de5ee;};'use strict';var BPromise=require('bluebird');var util=require(_0xefcb('0x0'));var _=require(_0xefcb('0x1'));var squel=require(_0xefcb('0x2'));var Redis=require(_0xefcb('0x3'));var qs=require(_0xefcb('0x4'));var logger=require(_0xefcb('0x5'))('api');var config=require(_0xefcb('0x6'));var db=require(_0xefcb('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xefcb('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xefcb('0x9'))['register'](socket);function respondWithStatusCode(_0x100aa1,_0x145119){_0x145119=_0x145119||0xcc;return function(_0x1a7a60){if(_0x1a7a60){return _0x100aa1['sendStatus'](_0x145119);}return _0x100aa1[_0xefcb('0xa')](_0x145119)[_0xefcb('0xb')]();};}function respondWithResult(_0x527170,_0x533ee5){_0x533ee5=_0x533ee5||0xc8;return function(_0x326270){if(_0x326270){return _0x527170[_0xefcb('0xa')](_0x533ee5)[_0xefcb('0xc')](_0x326270);}};}function respondWithFilteredResult(_0x3f9204,_0xe0d606){return function(_0x247dcd){if(_0x247dcd){var _0x47d4e1=typeof _0xe0d606[_0xefcb('0xd')]===_0xefcb('0xe')&&typeof _0xe0d606[_0xefcb('0xf')]===_0xefcb('0xe');var _0x3bfbb3=_0x247dcd['count'];var _0x585355=_0x47d4e1?0x0:_0xe0d606[_0xefcb('0xd')];var _0xd13e37=_0x47d4e1?_0x247dcd['count']:_0xe0d606[_0xefcb('0xd')]+_0xe0d606['limit'];var _0x3946ef;if(_0xd13e37>=_0x3bfbb3){_0xd13e37=_0x3bfbb3;_0x3946ef=0xc8;}else{_0x3946ef=0xce;}_0x3f9204['status'](_0x3946ef);return _0x3f9204[_0xefcb('0x10')](_0xefcb('0x11'),_0x585355+'-'+_0xd13e37+'/'+_0x3bfbb3)[_0xefcb('0xc')](_0x247dcd);}return null;};}function saveUpdates(_0x187f0f){return function(_0x2602c4){if(_0x2602c4){return _0x2602c4[_0xefcb('0x12')](_0x187f0f)['then'](function(_0x15fbec){return _0x15fbec;});}return null;};}function removeEntity(_0x8de41a){return function(_0xe922c7){if(_0xe922c7){return _0xe922c7[_0xefcb('0x13')]()[_0xefcb('0x14')](function(){var _0x2baf5e=_0xe922c7[_0xefcb('0x15')]({'plain':!![]});var _0x4f94e9=_0xefcb('0x16');return db[_0xefcb('0x17')]['destroy']({'where':{'type':_0x4f94e9,'resourceId':_0x2baf5e['id']}})[_0xefcb('0x14')](function(){return _0xe922c7;});})[_0xefcb('0x14')](function(){_0x8de41a[_0xefcb('0xa')](0xcc)[_0xefcb('0xb')]();});}};}function handleEntityNotFound(_0x45f49b){return function(_0x4e13c0){if(!_0x4e13c0){_0x45f49b[_0xefcb('0x18')](0x194);}return _0x4e13c0;};}function handleError(_0x33641c,_0x2ab79d){_0x2ab79d=_0x2ab79d||0x1f4;return function(_0x2444cf){logger[_0xefcb('0x19')](_0x2444cf[_0xefcb('0x1a')]);if(_0x2444cf[_0xefcb('0x1b')]){delete _0x2444cf[_0xefcb('0x1b')];}_0x33641c['status'](_0x2ab79d)['send'](_0x2444cf);};}exports['index']=function(_0x104212,_0x38a583){var _0x457ff6={};var _0x1717b7={'count':0x0,'rows':[]};var _0x20f51f=_[_0xefcb('0x1c')](db[_0xefcb('0x1d')]['rawAttributes'],function(_0x3029d1){return{'name':_0x3029d1[_0xefcb('0x1e')],'type':_0x3029d1[_0xefcb('0x1f')][_0xefcb('0x20')]};});_0x457ff6=qs[_0xefcb('0x21')](_0x20f51f,_0x104212);var _0x18f3be={'where':_0x457ff6[_0xefcb('0x22')]};return db[_0xefcb('0x1d')][_0xefcb('0x23')](_0x18f3be)[_0xefcb('0x14')](function(_0x124546){_0x1717b7[_0xefcb('0x23')]=_0x124546;_0x457ff6[_0xefcb('0x24')]=qs[_0xefcb('0x24')](_0x104212[_0xefcb('0x25')]);return db['FaxQueue'][_0xefcb('0x26')](_0x457ff6);})[_0xefcb('0x14')](function(_0x296427){_0x1717b7[_0xefcb('0x27')]=_0x296427;return _0x1717b7;})[_0xefcb('0x14')](respondWithFilteredResult(_0x38a583,_0x457ff6))[_0xefcb('0x28')](handleError(_0x38a583,null));};exports[_0xefcb('0x29')]=function(_0x5a436c,_0x4f2e1e){var _0x350385={'raw':!![],'where':{'id':_0x5a436c['params']['id']}},_0x423589={};_0x423589[_0xefcb('0x2a')]=_[_0xefcb('0x2b')](db[_0xefcb('0x1d')]['rawAttributes']);_0x423589[_0xefcb('0x25')]=_[_0xefcb('0x2b')](_0x5a436c[_0xefcb('0x25')]);_0x423589['filters']=_['intersection'](_0x423589['model'],_0x423589['query']);_0x350385[_0xefcb('0x2c')]=_[_0xefcb('0x2d')](_0x423589[_0xefcb('0x2a')],qs[_0xefcb('0x2e')](_0x5a436c[_0xefcb('0x25')][_0xefcb('0x2e')]));_0x350385[_0xefcb('0x2c')]=_0x350385[_0xefcb('0x2c')][_0xefcb('0x2f')]?_0x350385[_0xefcb('0x2c')]:_0x423589[_0xefcb('0x2a')];if(_0x5a436c[_0xefcb('0x25')][_0xefcb('0x30')]){_0x350385[_0xefcb('0x24')]=[{'all':!![]}];}_0x350385=_[_0xefcb('0x31')]({},_0x350385,_0x5a436c[_0xefcb('0x32')]);return db['FaxQueue'][_0xefcb('0x33')](_0x350385)[_0xefcb('0x14')](handleEntityNotFound(_0x4f2e1e,null))[_0xefcb('0x14')](respondWithResult(_0x4f2e1e,null))[_0xefcb('0x28')](handleError(_0x4f2e1e,null));};exports['create']=function(_0x3ed88c,_0x5e5b5a){return db[_0xefcb('0x1d')][_0xefcb('0x34')](_0x3ed88c[_0xefcb('0x35')],{})[_0xefcb('0x14')](function(_0x489066){var _0x167dac=_0x3ed88c[_0xefcb('0x36')][_0xefcb('0x15')]({'plain':!![]});if(!_0x167dac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x167dac[_0xefcb('0x37')]===_0xefcb('0x36')){var _0x692595=_0x489066['get']({'plain':!![]});var _0x4d9550=_0xefcb('0x16');return db['UserProfileSection']['find']({'where':{'name':_0x4d9550,'userProfileId':_0x167dac[_0xefcb('0x38')]},'raw':!![]})[_0xefcb('0x14')](function(_0x2b354a){if(_0x2b354a&&_0x2b354a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x692595[_0xefcb('0x1b')],'resourceId':_0x692595['id'],'type':_0x2b354a[_0xefcb('0x1b')],'sectionId':_0x2b354a['id']},{})['then'](function(){return _0x489066;});}else{return _0x489066;}})[_0xefcb('0x28')](function(_0x5ae48d){logger[_0xefcb('0x19')](_0xefcb('0x39'),_0x5ae48d);throw _0x5ae48d;});}return _0x489066;})[_0xefcb('0x14')](respondWithResult(_0x5e5b5a,0xc9))[_0xefcb('0x28')](handleError(_0x5e5b5a,null));};exports[_0xefcb('0x12')]=function(_0x5619d1,_0x594207){if(_0x5619d1[_0xefcb('0x35')]['id']){delete _0x5619d1[_0xefcb('0x35')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x5619d1['params']['id']}})[_0xefcb('0x14')](handleEntityNotFound(_0x594207,null))[_0xefcb('0x14')](saveUpdates(_0x5619d1['body'],null))[_0xefcb('0x14')](respondWithResult(_0x594207,null))['catch'](handleError(_0x594207,null));};exports[_0xefcb('0x13')]=function(_0x17502f,_0x1a4f90){return db[_0xefcb('0x1d')][_0xefcb('0x33')]({'where':{'id':_0x17502f['params']['id']}})[_0xefcb('0x14')](handleEntityNotFound(_0x1a4f90,null))['then'](removeEntity(_0x1a4f90,null))[_0xefcb('0x28')](handleError(_0x1a4f90,null));};exports['describe']=function(_0x355fac,_0x4d489b){return db[_0xefcb('0x1d')]['describe']()[_0xefcb('0x14')](respondWithResult(_0x4d489b,null))[_0xefcb('0x28')](handleError(_0x4d489b,null));};exports[_0xefcb('0x3a')]=function(_0x109a96,_0x14cd8b){var _0x443a93={'raw':!![],'where':{}},_0x4b0735={},_0x2ead1;return db['FaxQueue'][_0xefcb('0x3b')]({'where':{'id':_0x109a96[_0xefcb('0x3c')]['id']}})[_0xefcb('0x14')](handleEntityNotFound(_0x14cd8b,null))[_0xefcb('0x14')](function(_0x3a313f){if(_0x3a313f){_0x2ead1=_0x3a313f[_0xefcb('0x15')]({'plain':!![]});_0x4b0735['model']=_[_0xefcb('0x2b')](db[_0xefcb('0x3d')][_0xefcb('0x3e')]);_0x4b0735['query']=_['keys'](_0x109a96[_0xefcb('0x25')]);_0x4b0735[_0xefcb('0x3f')]=_['intersection'](_0x4b0735[_0xefcb('0x2a')],_0x4b0735[_0xefcb('0x25')]);_0x443a93[_0xefcb('0x2c')]=_[_0xefcb('0x2d')](_0x4b0735[_0xefcb('0x2a')],qs[_0xefcb('0x2e')](_0x109a96['query'][_0xefcb('0x2e')]));_0x443a93[_0xefcb('0x2c')]=_0x443a93[_0xefcb('0x2c')][_0xefcb('0x2f')]?_0x443a93[_0xefcb('0x2c')]:_0x4b0735[_0xefcb('0x2a')];if(!_0x109a96[_0xefcb('0x25')]['hasOwnProperty'](_0xefcb('0x40'))){_0x443a93[_0xefcb('0xf')]=qs[_0xefcb('0xf')](_0x109a96[_0xefcb('0x25')][_0xefcb('0xf')]);_0x443a93[_0xefcb('0xd')]=qs[_0xefcb('0xd')](_0x109a96[_0xefcb('0x25')][_0xefcb('0xd')]);}_0x443a93[_0xefcb('0x41')]=qs[_0xefcb('0x42')](_0x109a96[_0xefcb('0x25')][_0xefcb('0x42')]);_0x443a93[_0xefcb('0x22')]=qs[_0xefcb('0x3f')](_[_0xefcb('0x43')](_0x109a96['query'],_0x4b0735[_0xefcb('0x3f')]));_0x443a93[_0xefcb('0x22')]['FaxQueueId']=_0x3a313f['id'];if(_0x109a96[_0xefcb('0x25')][_0xefcb('0x44')]){_0x443a93[_0xefcb('0x22')]=_['merge'](_0x443a93['where'],{'$or':_[_0xefcb('0x1c')](_0x443a93[_0xefcb('0x2c')],function(_0x31fc24){var _0x3f607d={};_0x3f607d[_0x31fc24]={'$like':'%'+_0x109a96['query'][_0xefcb('0x44')]+'%'};return _0x3f607d;})});}_0x443a93=_[_0xefcb('0x31')]({},_0x443a93,_0x109a96[_0xefcb('0x32')]);return db[_0xefcb('0x3d')][_0xefcb('0x26')](_0x443a93);}})[_0xefcb('0x14')](function(_0x471405){if(_0x471405){return db['User'][_0xefcb('0x45')]({'where':{'id':_[_0xefcb('0x1c')](_0x471405,_0xefcb('0x46')),'role':_0xefcb('0x47')},'attributes':['id','name',_0xefcb('0x48'),'updatedAt',_0xefcb('0x49')]});}})[_0xefcb('0x14')](function(_0x7812da){if(_0x7812da){return{'count':_0x7812da[_0xefcb('0x23')],'rows':_[_0xefcb('0x1c')](_0x7812da[_0xefcb('0x27')],function(_0x50a3f5){return{'membername':_0x50a3f5[_0xefcb('0x1b')],'UserId':_0x50a3f5['id'],'queue_name':_0x2ead1[_0xefcb('0x1b')],'FaxQueueId':_0x2ead1['id'],'interface':util[_0xefcb('0x4a')](_0xefcb('0x4b'),'SIP',_0x50a3f5[_0xefcb('0x1b')]),'penalty':0x0,'paused':_0x50a3f5[_0xefcb('0x48')],'createdAt':_0x50a3f5[_0xefcb('0x49')],'updatedAt':_0x50a3f5[_0xefcb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14cd8b,_0x443a93))['catch'](handleError(_0x14cd8b,null));};exports[_0xefcb('0x4d')]=function(_0x375a71,_0x154c0e){var _0x22a189={};var _0x33a2f6={};var _0x15ec6e;var _0x47f964;return db[_0xefcb('0x1d')]['findOne']({'where':{'id':_0x375a71[_0xefcb('0x3c')]['id']}})[_0xefcb('0x14')](handleEntityNotFound(_0x154c0e,null))['then'](function(_0x9d9ec8){if(_0x9d9ec8){_0x15ec6e=_0x9d9ec8;_0x33a2f6[_0xefcb('0x2a')]=_[_0xefcb('0x2b')](db['Team'][_0xefcb('0x3e')]);_0x33a2f6[_0xefcb('0x25')]=_[_0xefcb('0x2b')](_0x375a71[_0xefcb('0x25')]);_0x33a2f6[_0xefcb('0x3f')]=_[_0xefcb('0x2d')](_0x33a2f6[_0xefcb('0x2a')],_0x33a2f6[_0xefcb('0x25')]);_0x22a189[_0xefcb('0x2c')]=_[_0xefcb('0x2d')](_0x33a2f6['model'],qs[_0xefcb('0x2e')](_0x375a71[_0xefcb('0x25')][_0xefcb('0x2e')]));_0x22a189[_0xefcb('0x2c')]=_0x22a189[_0xefcb('0x2c')][_0xefcb('0x2f')]?_0x22a189[_0xefcb('0x2c')]:_0x33a2f6[_0xefcb('0x2a')];_0x22a189[_0xefcb('0x41')]=qs['sort'](_0x375a71[_0xefcb('0x25')][_0xefcb('0x42')]);_0x22a189[_0xefcb('0x22')]=qs[_0xefcb('0x3f')](_[_0xefcb('0x43')](_0x375a71[_0xefcb('0x25')],_0x33a2f6[_0xefcb('0x3f')]));if(_0x375a71['query']['filter']){_0x22a189[_0xefcb('0x22')]=_[_0xefcb('0x31')](_0x22a189['where'],{'$or':_[_0xefcb('0x1c')](_0x22a189[_0xefcb('0x2c')],function(_0x1f606f){var _0x1ed015={};_0x1ed015[_0x1f606f]={'$like':'%'+_0x375a71['query'][_0xefcb('0x44')]+'%'};return _0x1ed015;})});}_0x22a189=_[_0xefcb('0x31')]({},_0x22a189,_0x375a71[_0xefcb('0x32')]);return _0x15ec6e[_0xefcb('0x4d')](_0x22a189);}})[_0xefcb('0x14')](function(_0x1db7e0){if(_0x1db7e0){_0x47f964=_0x1db7e0[_0xefcb('0x2f')];if(!_0x375a71[_0xefcb('0x25')][_0xefcb('0x4e')]('nolimit')){_0x22a189[_0xefcb('0xf')]=qs[_0xefcb('0xf')](_0x375a71[_0xefcb('0x25')][_0xefcb('0xf')]);_0x22a189['offset']=qs[_0xefcb('0xd')](_0x375a71[_0xefcb('0x25')][_0xefcb('0xd')]);}return _0x15ec6e[_0xefcb('0x4d')](_0x22a189);}})['then'](function(_0x221f27){if(_0x221f27){return _0x221f27?{'count':_0x47f964,'rows':_0x221f27}:null;}})[_0xefcb('0x14')](respondWithResult(_0x154c0e,null))[_0xefcb('0x28')](handleError(_0x154c0e,null));};exports[_0xefcb('0x4f')]=function(_0x390db0,_0x39e8ed){var _0x4dc40c=_0x390db0[_0xefcb('0x35')][_0xefcb('0x50')];return db['Team'][_0xefcb('0x26')]({'where':{'id':_0x4dc40c},'attributes':['id'],'include':[{'model':db[_0xefcb('0x51')],'as':_0xefcb('0x52'),'attributes':['id',_0xefcb('0x1b'),'online',_0xefcb('0x53'),_0xefcb('0x54')],'raw':!![]}]})[_0xefcb('0x14')](function(_0x22ecf4){if(_0x22ecf4){var _0x5059bf=_['flatMap'](_0x22ecf4,function(_0x3b379c){var _0x46f2a6=_0x3b379c[_0xefcb('0x15')]({'plain':!![]});return _0x46f2a6[_0xefcb('0x52')];});return db[_0xefcb('0x1d')]['find']({'where':{'id':_0x390db0[_0xefcb('0x3c')]['id']}})[_0xefcb('0x14')](function(_0x14ee37){return db[_0xefcb('0x55')][_0xefcb('0x56')](function(_0x27de26){return _0x14ee37[_0xefcb('0x4f')](_0x4dc40c,{'transaction':_0x27de26})[_0xefcb('0x14')](function(){return BPromise[_0xefcb('0x57')](_0x5059bf,function(_0x3b71f4){return db['UserFaxQueue'][_0xefcb('0x58')]({'where':{'UserId':_0x3b71f4['id'],'FaxQueueId':_0x390db0[_0xefcb('0x3c')]['id']},'transaction':_0x27de26});});})[_0xefcb('0x14')](function(){_0x5059bf[_0xefcb('0x59')](function(_0x2363f5){socket[_0xefcb('0x5a')](_0xefcb('0x5b'),{'UserId':_0x2363f5['id'],'FaxQueueId':_0x14ee37['id']});});});});});}})['then'](respondWithStatusCode(_0x39e8ed,null))[_0xefcb('0x28')](handleError(_0x39e8ed,null));};exports['removeTeams']=function(_0x200290,_0x4ce85f){return db[_0xefcb('0x5c')]['findAll']({'where':{'id':_0x200290['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xefcb('0x51')],'as':_0xefcb('0x52'),'attributes':['id'],'raw':!![]}]})[_0xefcb('0x14')](handleEntityNotFound(_0x4ce85f,null))[_0xefcb('0x14')](function(_0xa874ae){var _0x96ed29=_[_0xefcb('0x1c')](_0xa874ae,'id');var _0x4bbb51=[];var _0x2297dc=[];var _0x5a959b=squel[_0xefcb('0x5d')]();_0x5a959b[_0xefcb('0x5e')]('tq.TeamId')[_0xefcb('0x5f')]('team_has_fax_queues','tq')[_0xefcb('0x60')](_0xefcb('0x61'),'ut',_0xefcb('0x62'))[_0xefcb('0x22')](_0xefcb('0x63'),_0x200290[_0xefcb('0x3c')]['id']);for(var _0x45671a=0x0;_0x45671a<_0xa874ae[_0xefcb('0x2f')];_0x45671a+=0x1){let _0x152ca6=_0xa874ae[_0x45671a];for(var _0x48f825=0x0;_0x48f825<_0x152ca6[_0xefcb('0x52')]['length'];_0x48f825+=0x1){let _0x553004=_0x152ca6['Agents'][_0x48f825];var _0x26181b=_0x5a959b[_0xefcb('0x64')]();_0x26181b['where'](_0xefcb('0x65'),_0x553004['id']);_0x2297dc['push'](db[_0xefcb('0x55')][_0xefcb('0x25')](_0x26181b[_0xefcb('0x66')](),{'type':db[_0xefcb('0x55')][_0xefcb('0x67')][_0xefcb('0x68')]})[_0xefcb('0x14')](function(_0x222aa3){if(_0x222aa3['length']===0x1){return _0x553004['id'];}else{var _0x4c34fd=_[_0xefcb('0x69')](_[_0xefcb('0x1c')](_0x222aa3,_0xefcb('0x6a')),function(_0x17f4a4){return _[_0xefcb('0x6b')](_0x96ed29,_0x17f4a4);});if(_0x4c34fd){return _0x553004['id'];}}}));}}return BPromise['all'](_0x2297dc)[_0xefcb('0x14')](function(_0xe06e35){_0x4bbb51=_(_0x4bbb51)[_0xefcb('0x6c')](_0xe06e35)[_0xefcb('0x6d')]()[_0xefcb('0x6e')]();return db['FaxQueue']['find']({'where':{'id':_0x200290[_0xefcb('0x3c')]['id']}})[_0xefcb('0x14')](function(_0x338e1f){return db[_0xefcb('0x55')][_0xefcb('0x56')](function(_0x5e707f){return _0x338e1f[_0xefcb('0x6f')](_0x200290[_0xefcb('0x25')]['ids'],{'transaction':_0x5e707f})[_0xefcb('0x14')](function(){if(!_[_0xefcb('0x70')](_0x4bbb51)){return _0x338e1f['removeAgents'](_0x4bbb51,{'transaction':_0x5e707f});}})[_0xefcb('0x14')](function(){_0x4bbb51['forEach'](function(_0x17ac13){socket[_0xefcb('0x5a')]('userFaxQueue:remove',{'UserId':_0x17ac13,'FaxQueueId':_0x338e1f['id']});});});});});});})[_0xefcb('0x14')](respondWithStatusCode(_0x4ce85f,null))['catch'](handleError(_0x4ce85f,null));};exports[_0xefcb('0x71')]=function(_0xe330a3,_0x16ce94){return db[_0xefcb('0x1d')][_0xefcb('0x33')]({'where':{'id':_0xe330a3[_0xefcb('0x3c')]['id']}})['then'](handleEntityNotFound(_0x16ce94,null))[_0xefcb('0x14')](function(_0x375582){if(_0x375582){return _0x375582['addAgents'](_0xe330a3[_0xefcb('0x35')][_0xefcb('0x50')],_[_0xefcb('0x72')](_0xe330a3[_0xefcb('0x35')],[_0xefcb('0x50'),'id'])||{})[_0xefcb('0x73')](function(_0x42a89a){for(var _0x151362=0x0;_0x151362<_0xe330a3[_0xefcb('0x35')][_0xefcb('0x50')][_0xefcb('0x2f')];_0x151362+=0x1){socket[_0xefcb('0x5a')](_0xefcb('0x5b'),{'UserId':Number(_0xe330a3[_0xefcb('0x35')]['ids'][_0x151362]),'FaxQueueId':Number(_0xe330a3[_0xefcb('0x3c')]['id'])});}return _0x42a89a;});}})['then'](respondWithResult(_0x16ce94,null))['catch'](handleError(_0x16ce94,null));};exports['removeAgents']=function(_0xbbbfa9,_0x58d88b){return db[_0xefcb('0x1d')][_0xefcb('0x33')]({'where':{'id':_0xbbbfa9[_0xefcb('0x3c')]['id']}})[_0xefcb('0x14')](handleEntityNotFound(_0x58d88b,null))[_0xefcb('0x14')](function(_0x5ace87){if(_0x5ace87){return _0x5ace87['removeAgents'](_0xbbbfa9[_0xefcb('0x25')][_0xefcb('0x50')])[_0xefcb('0x14')](function(){if(_[_0xefcb('0x74')](_0xbbbfa9[_0xefcb('0x25')][_0xefcb('0x50')])){for(var _0x3540ca=0x0;_0x3540ca<_0xbbbfa9[_0xefcb('0x25')][_0xefcb('0x50')]['length'];_0x3540ca+=0x1){socket[_0xefcb('0x5a')](_0xefcb('0x75'),{'UserId':Number(_0xbbbfa9[_0xefcb('0x25')][_0xefcb('0x50')][_0x3540ca]),'FaxQueueId':Number(_0xbbbfa9[_0xefcb('0x3c')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0xbbbfa9['query'][_0xefcb('0x50')]),'FaxQueueId':Number(_0xbbbfa9[_0xefcb('0x3c')]['id'])});}});}})[_0xefcb('0x14')](respondWithStatusCode(_0x58d88b,null))[_0xefcb('0x28')](handleError(_0x58d88b,null));};exports[_0xefcb('0x76')]=function(_0x5051b6,_0x399767){var _0x4dad3f={};var _0x4e0062={};var _0x281ff1;var _0x19a244;return db[_0xefcb('0x1d')][_0xefcb('0x3b')]({'where':{'id':_0x5051b6[_0xefcb('0x3c')]['id']}})['then'](handleEntityNotFound(_0x399767,null))[_0xefcb('0x14')](function(_0x452758){if(_0x452758){_0x281ff1=_0x452758;_0x4e0062[_0xefcb('0x2a')]=_[_0xefcb('0x2b')](db[_0xefcb('0x51')][_0xefcb('0x3e')]);_0x4e0062[_0xefcb('0x25')]=_['keys'](_0x5051b6[_0xefcb('0x25')]);_0x4e0062['filters']=_[_0xefcb('0x2d')](_0x4e0062[_0xefcb('0x2a')],_0x4e0062[_0xefcb('0x25')]);_0x4dad3f[_0xefcb('0x2c')]=_['intersection'](_0x4e0062[_0xefcb('0x2a')],qs[_0xefcb('0x2e')](_0x5051b6[_0xefcb('0x25')][_0xefcb('0x2e')]));_0x4dad3f[_0xefcb('0x2c')]=_0x4dad3f[_0xefcb('0x2c')][_0xefcb('0x2f')]?_0x4dad3f[_0xefcb('0x2c')]:_0x4e0062['model'];_0x4dad3f[_0xefcb('0x41')]=qs[_0xefcb('0x42')](_0x5051b6['query'][_0xefcb('0x42')]);_0x4dad3f[_0xefcb('0x22')]=qs[_0xefcb('0x3f')](_[_0xefcb('0x43')](_0x5051b6[_0xefcb('0x25')],_0x4e0062[_0xefcb('0x3f')]));if(_0x5051b6['query'][_0xefcb('0x44')]){_0x4dad3f['where']=_[_0xefcb('0x31')](_0x4dad3f[_0xefcb('0x22')],{'$or':_['map'](_0x4dad3f['attributes'],function(_0x4c3ceb){var _0x51b8fe={};_0x51b8fe[_0x4c3ceb]={'$like':'%'+_0x5051b6['query'][_0xefcb('0x44')]+'%'};return _0x51b8fe;})});}_0x4dad3f=_[_0xefcb('0x31')]({},_0x4dad3f,_0x5051b6[_0xefcb('0x32')]);return _0x281ff1[_0xefcb('0x76')](_0x4dad3f);}})['then'](function(_0xf015c9){if(_0xf015c9){_0x19a244=_0xf015c9[_0xefcb('0x2f')];if(!_0x5051b6['query'][_0xefcb('0x4e')]('nolimit')){_0x4dad3f[_0xefcb('0xf')]=qs[_0xefcb('0xf')](_0x5051b6[_0xefcb('0x25')][_0xefcb('0xf')]);_0x4dad3f[_0xefcb('0xd')]=qs[_0xefcb('0xd')](_0x5051b6['query']['offset']);}return _0x281ff1['getAgents'](_0x4dad3f);}})['then'](function(_0x4f2e99){if(_0x4f2e99){return _0x4f2e99?{'count':_0x19a244,'rows':_0x4f2e99}:null;}})[_0xefcb('0x14')](respondWithResult(_0x399767,null))[_0xefcb('0x28')](handleError(_0x399767,null));}; \ No newline at end of file +var _0x199c=['../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','include','query','FaxQueue','findAll','rows','catch','params','keys','filters','intersection','model','fields','attributes','length','includeAll','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','hasOwnProperty','nolimit','order','sort','pick','filter','options','UserFaxQueue','findAndCountAll','map','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','addTeams','forEach','emit','userFaxQueue:save','removeTeams','select','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','body','omit','spread','isArray','getAgents','lodash','squel','ioredis','../../components/parsers/qs'];(function(_0x12dafa,_0x51ce5){var _0x1f3784=function(_0xcdae68){while(--_0xcdae68){_0x12dafa['push'](_0x12dafa['shift']());}};_0x1f3784(++_0x51ce5);}(_0x199c,0x1d8));var _0xc199=function(_0x5901cb,_0x33f8aa){_0x5901cb=_0x5901cb-0x0;var _0x4ba75f=_0x199c[_0x5901cb];return _0x4ba75f;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xc199('0x0'));var squel=require(_0xc199('0x1'));var Redis=require(_0xc199('0x2'));var qs=require(_0xc199('0x3'));var logger=require(_0xc199('0x4'))(_0xc199('0x5'));var config=require(_0xc199('0x6'));var db=require(_0xc199('0x7'))['db'];config['redis']=_[_0xc199('0x8')](config[_0xc199('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc199('0x9')]));require(_0xc199('0xa'))[_0xc199('0xb')](socket);function respondWithStatusCode(_0x2619ea,_0x157717){_0x157717=_0x157717||0xcc;return function(_0x171ac1){if(_0x171ac1){return _0x2619ea[_0xc199('0xc')](_0x157717);}return _0x2619ea[_0xc199('0xd')](_0x157717)['end']();};}function respondWithResult(_0x30b717,_0x20a57d){_0x20a57d=_0x20a57d||0xc8;return function(_0x921e09){if(_0x921e09){return _0x30b717[_0xc199('0xd')](_0x20a57d)[_0xc199('0xe')](_0x921e09);}};}function respondWithFilteredResult(_0x368292,_0x509ab5){return function(_0x43524f){if(_0x43524f){var _0x13ab06=typeof _0x509ab5[_0xc199('0xf')]===_0xc199('0x10')&&typeof _0x509ab5[_0xc199('0x11')]==='undefined';var _0xa5bfc2=_0x43524f[_0xc199('0x12')];var _0x67c1ed=_0x13ab06?0x0:_0x509ab5[_0xc199('0xf')];var _0x427698=_0x13ab06?_0x43524f['count']:_0x509ab5['offset']+_0x509ab5[_0xc199('0x11')];var _0x5a8e99;if(_0x427698>=_0xa5bfc2){_0x427698=_0xa5bfc2;_0x5a8e99=0xc8;}else{_0x5a8e99=0xce;}_0x368292[_0xc199('0xd')](_0x5a8e99);return _0x368292[_0xc199('0x13')]('Content-Range',_0x67c1ed+'-'+_0x427698+'/'+_0xa5bfc2)[_0xc199('0xe')](_0x43524f);}return null;};}function saveUpdates(_0x4f268d){return function(_0x8464ec){if(_0x8464ec){return _0x8464ec[_0xc199('0x14')](_0x4f268d)[_0xc199('0x15')](function(_0x6e8d4c){return _0x6e8d4c;});}return null;};}function removeEntity(_0x34c3cf){return function(_0x40de74){if(_0x40de74){return _0x40de74[_0xc199('0x16')]()[_0xc199('0x15')](function(){var _0x2c953f=_0x40de74[_0xc199('0x17')]({'plain':!![]});var _0x153098='FaxQueues';return db[_0xc199('0x18')][_0xc199('0x16')]({'where':{'type':_0x153098,'resourceId':_0x2c953f['id']}})[_0xc199('0x15')](function(){return _0x40de74;});})[_0xc199('0x15')](function(){_0x34c3cf['status'](0xcc)[_0xc199('0x19')]();});}};}function handleEntityNotFound(_0x1adf1f){return function(_0x381c94){if(!_0x381c94){_0x1adf1f[_0xc199('0xc')](0x194);}return _0x381c94;};}function handleError(_0x45873f,_0x5c34e8){_0x5c34e8=_0x5c34e8||0x1f4;return function(_0x4dad27){logger['error'](_0x4dad27[_0xc199('0x1a')]);if(_0x4dad27['name']){delete _0x4dad27[_0xc199('0x1b')];}_0x45873f['status'](_0x5c34e8)[_0xc199('0x1c')](_0x4dad27);};}exports[_0xc199('0x1d')]=function(_0x4e0306,_0x2d184d){var _0x838760={};var _0x507f71={'count':0x0,'rows':[]};var _0x1c6703=_['map'](db['FaxQueue'][_0xc199('0x1e')],function(_0x4494b5){return{'name':_0x4494b5[_0xc199('0x1f')],'type':_0x4494b5['type'][_0xc199('0x20')]};});_0x838760=qs[_0xc199('0x21')](_0x1c6703,_0x4e0306);var _0x5bd0bc={'where':_0x838760[_0xc199('0x22')]};return db['FaxQueue'][_0xc199('0x12')](_0x5bd0bc)['then'](function(_0x437e9e){_0x507f71[_0xc199('0x12')]=_0x437e9e;_0x838760[_0xc199('0x23')]=qs[_0xc199('0x23')](_0x4e0306[_0xc199('0x24')]);return db[_0xc199('0x25')][_0xc199('0x26')](_0x838760);})[_0xc199('0x15')](function(_0x57a3e2){_0x507f71[_0xc199('0x27')]=_0x57a3e2;return _0x507f71;})[_0xc199('0x15')](respondWithFilteredResult(_0x2d184d,_0x838760))[_0xc199('0x28')](handleError(_0x2d184d,null));};exports['show']=function(_0x457ebc,_0x50f0d3){var _0x53dc1f={'raw':!![],'where':{'id':_0x457ebc[_0xc199('0x29')]['id']}},_0x16f739={};_0x16f739['model']=_[_0xc199('0x2a')](db['FaxQueue']['rawAttributes']);_0x16f739[_0xc199('0x24')]=_['keys'](_0x457ebc[_0xc199('0x24')]);_0x16f739[_0xc199('0x2b')]=_[_0xc199('0x2c')](_0x16f739[_0xc199('0x2d')],_0x16f739[_0xc199('0x24')]);_0x53dc1f['attributes']=_['intersection'](_0x16f739['model'],qs[_0xc199('0x2e')](_0x457ebc['query'][_0xc199('0x2e')]));_0x53dc1f[_0xc199('0x2f')]=_0x53dc1f[_0xc199('0x2f')][_0xc199('0x30')]?_0x53dc1f[_0xc199('0x2f')]:_0x16f739[_0xc199('0x2d')];if(_0x457ebc[_0xc199('0x24')][_0xc199('0x31')]){_0x53dc1f[_0xc199('0x23')]=[{'all':!![]}];}_0x53dc1f=_[_0xc199('0x32')]({},_0x53dc1f,_0x457ebc['options']);return db['FaxQueue'][_0xc199('0x33')](_0x53dc1f)[_0xc199('0x15')](handleEntityNotFound(_0x50f0d3,null))[_0xc199('0x15')](respondWithResult(_0x50f0d3,null))[_0xc199('0x28')](handleError(_0x50f0d3,null));};exports[_0xc199('0x34')]=function(_0x171800,_0x3966d0){return db[_0xc199('0x25')]['create'](_0x171800['body'],{})['then'](function(_0x2e50a1){var _0x253811=_0x171800[_0xc199('0x35')]['get']({'plain':!![]});if(!_0x253811)throw new Error(_0xc199('0x36'));if(_0x253811[_0xc199('0x37')]==='user'){var _0x3a66e9=_0x2e50a1[_0xc199('0x17')]({'plain':!![]});var _0x316766=_0xc199('0x38');return db['UserProfileSection'][_0xc199('0x33')]({'where':{'name':_0x316766,'userProfileId':_0x253811[_0xc199('0x39')]},'raw':!![]})[_0xc199('0x15')](function(_0x3b93d5){if(_0x3b93d5&&_0x3b93d5[_0xc199('0x3a')]===0x0){return db[_0xc199('0x18')][_0xc199('0x34')]({'name':_0x3a66e9['name'],'resourceId':_0x3a66e9['id'],'type':_0x3b93d5['name'],'sectionId':_0x3b93d5['id']},{})['then'](function(){return _0x2e50a1;});}else{return _0x2e50a1;}})[_0xc199('0x28')](function(_0x2e45d2){logger[_0xc199('0x3b')](_0xc199('0x3c'),_0x2e45d2);throw _0x2e45d2;});}return _0x2e50a1;})[_0xc199('0x15')](respondWithResult(_0x3966d0,0xc9))['catch'](handleError(_0x3966d0,null));};exports['update']=function(_0xb682a3,_0x3fbfd6){if(_0xb682a3['body']['id']){delete _0xb682a3['body']['id'];}return db[_0xc199('0x25')][_0xc199('0x33')]({'where':{'id':_0xb682a3['params']['id']}})[_0xc199('0x15')](handleEntityNotFound(_0x3fbfd6,null))[_0xc199('0x15')](saveUpdates(_0xb682a3['body'],null))[_0xc199('0x15')](respondWithResult(_0x3fbfd6,null))[_0xc199('0x28')](handleError(_0x3fbfd6,null));};exports[_0xc199('0x16')]=function(_0x55341c,_0x209ff2){return db[_0xc199('0x25')][_0xc199('0x33')]({'where':{'id':_0x55341c['params']['id']}})[_0xc199('0x15')](handleEntityNotFound(_0x209ff2,null))[_0xc199('0x15')](removeEntity(_0x209ff2,null))[_0xc199('0x28')](handleError(_0x209ff2,null));};exports['describe']=function(_0x3337b5,_0xc290cc){return db['FaxQueue'][_0xc199('0x3d')]()[_0xc199('0x15')](respondWithResult(_0xc290cc,null))[_0xc199('0x28')](handleError(_0xc290cc,null));};exports['getMembers']=function(_0x5cf201,_0x40cd7e){var _0x1a6238={'raw':!![],'where':{}},_0x54c0a8={},_0x3910a4;return db[_0xc199('0x25')]['findOne']({'where':{'id':_0x5cf201[_0xc199('0x29')]['id']}})[_0xc199('0x15')](handleEntityNotFound(_0x40cd7e,null))['then'](function(_0x10f418){if(_0x10f418){_0x3910a4=_0x10f418[_0xc199('0x17')]({'plain':!![]});_0x54c0a8[_0xc199('0x2d')]=_[_0xc199('0x2a')](db['UserFaxQueue'][_0xc199('0x1e')]);_0x54c0a8[_0xc199('0x24')]=_[_0xc199('0x2a')](_0x5cf201[_0xc199('0x24')]);_0x54c0a8['filters']=_[_0xc199('0x2c')](_0x54c0a8['model'],_0x54c0a8['query']);_0x1a6238[_0xc199('0x2f')]=_[_0xc199('0x2c')](_0x54c0a8[_0xc199('0x2d')],qs[_0xc199('0x2e')](_0x5cf201[_0xc199('0x24')][_0xc199('0x2e')]));_0x1a6238[_0xc199('0x2f')]=_0x1a6238[_0xc199('0x2f')]['length']?_0x1a6238['attributes']:_0x54c0a8[_0xc199('0x2d')];if(!_0x5cf201[_0xc199('0x24')][_0xc199('0x3e')](_0xc199('0x3f'))){_0x1a6238[_0xc199('0x11')]=qs[_0xc199('0x11')](_0x5cf201[_0xc199('0x24')][_0xc199('0x11')]);_0x1a6238[_0xc199('0xf')]=qs[_0xc199('0xf')](_0x5cf201[_0xc199('0x24')][_0xc199('0xf')]);}_0x1a6238[_0xc199('0x40')]=qs[_0xc199('0x41')](_0x5cf201[_0xc199('0x24')][_0xc199('0x41')]);_0x1a6238[_0xc199('0x22')]=qs[_0xc199('0x2b')](_[_0xc199('0x42')](_0x5cf201[_0xc199('0x24')],_0x54c0a8['filters']));_0x1a6238[_0xc199('0x22')]['FaxQueueId']=_0x10f418['id'];if(_0x5cf201[_0xc199('0x24')][_0xc199('0x43')]){_0x1a6238['where']=_[_0xc199('0x32')](_0x1a6238[_0xc199('0x22')],{'$or':_['map'](_0x1a6238[_0xc199('0x2f')],function(_0x14a94){var _0x1442ad={};_0x1442ad[_0x14a94]={'$like':'%'+_0x5cf201[_0xc199('0x24')]['filter']+'%'};return _0x1442ad;})});}_0x1a6238=_[_0xc199('0x32')]({},_0x1a6238,_0x5cf201[_0xc199('0x44')]);return db[_0xc199('0x45')]['findAll'](_0x1a6238);}})['then'](function(_0x50a3c3){if(_0x50a3c3){return db['User'][_0xc199('0x46')]({'where':{'id':_[_0xc199('0x47')](_0x50a3c3,_0xc199('0x48')),'role':_0xc199('0x49')},'attributes':['id','name',_0xc199('0x4a'),_0xc199('0x4b'),_0xc199('0x4c')]});}})[_0xc199('0x15')](function(_0x5e856e){if(_0x5e856e){return{'count':_0x5e856e[_0xc199('0x12')],'rows':_[_0xc199('0x47')](_0x5e856e[_0xc199('0x27')],function(_0x43c1be){return{'membername':_0x43c1be[_0xc199('0x1b')],'UserId':_0x43c1be['id'],'queue_name':_0x3910a4['name'],'FaxQueueId':_0x3910a4['id'],'interface':util['format'](_0xc199('0x4d'),_0xc199('0x4e'),_0x43c1be[_0xc199('0x1b')]),'penalty':0x0,'paused':_0x43c1be[_0xc199('0x4a')],'createdAt':_0x43c1be[_0xc199('0x4c')],'updatedAt':_0x43c1be[_0xc199('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc199('0x15')](respondWithFilteredResult(_0x40cd7e,_0x1a6238))[_0xc199('0x28')](handleError(_0x40cd7e,null));};exports[_0xc199('0x4f')]=function(_0x368670,_0x5c1fd5){var _0x56ad5c={};var _0xcc9488={};var _0x5f19b3;var _0x5aa803;return db['FaxQueue'][_0xc199('0x50')]({'where':{'id':_0x368670[_0xc199('0x29')]['id']}})[_0xc199('0x15')](handleEntityNotFound(_0x5c1fd5,null))['then'](function(_0x329ea9){if(_0x329ea9){_0x5f19b3=_0x329ea9;_0xcc9488[_0xc199('0x2d')]=_[_0xc199('0x2a')](db[_0xc199('0x51')][_0xc199('0x1e')]);_0xcc9488['query']=_[_0xc199('0x2a')](_0x368670[_0xc199('0x24')]);_0xcc9488[_0xc199('0x2b')]=_[_0xc199('0x2c')](_0xcc9488[_0xc199('0x2d')],_0xcc9488[_0xc199('0x24')]);_0x56ad5c['attributes']=_['intersection'](_0xcc9488[_0xc199('0x2d')],qs['fields'](_0x368670[_0xc199('0x24')][_0xc199('0x2e')]));_0x56ad5c[_0xc199('0x2f')]=_0x56ad5c[_0xc199('0x2f')][_0xc199('0x30')]?_0x56ad5c[_0xc199('0x2f')]:_0xcc9488[_0xc199('0x2d')];_0x56ad5c[_0xc199('0x40')]=qs[_0xc199('0x41')](_0x368670[_0xc199('0x24')]['sort']);_0x56ad5c[_0xc199('0x22')]=qs['filters'](_[_0xc199('0x42')](_0x368670[_0xc199('0x24')],_0xcc9488['filters']));if(_0x368670[_0xc199('0x24')][_0xc199('0x43')]){_0x56ad5c['where']=_['merge'](_0x56ad5c['where'],{'$or':_['map'](_0x56ad5c['attributes'],function(_0x2f5fee){var _0x10cb7f={};_0x10cb7f[_0x2f5fee]={'$like':'%'+_0x368670[_0xc199('0x24')][_0xc199('0x43')]+'%'};return _0x10cb7f;})});}_0x56ad5c=_[_0xc199('0x32')]({},_0x56ad5c,_0x368670[_0xc199('0x44')]);return _0x5f19b3[_0xc199('0x4f')](_0x56ad5c);}})['then'](function(_0x43c8b2){if(_0x43c8b2){_0x5aa803=_0x43c8b2[_0xc199('0x30')];if(!_0x368670['query'][_0xc199('0x3e')](_0xc199('0x3f'))){_0x56ad5c[_0xc199('0x11')]=qs[_0xc199('0x11')](_0x368670[_0xc199('0x24')]['limit']);_0x56ad5c[_0xc199('0xf')]=qs['offset'](_0x368670[_0xc199('0x24')]['offset']);}return _0x5f19b3[_0xc199('0x4f')](_0x56ad5c);}})[_0xc199('0x15')](function(_0x55f930){if(_0x55f930){return _0x55f930?{'count':_0x5aa803,'rows':_0x55f930}:null;}})[_0xc199('0x15')](respondWithResult(_0x5c1fd5,null))[_0xc199('0x28')](handleError(_0x5c1fd5,null));};exports['addTeams']=function(_0x23cdb2,_0x5e6da3){var _0x489858=_0x23cdb2['body'][_0xc199('0x52')];return db[_0xc199('0x51')]['findAll']({'where':{'id':_0x489858},'attributes':['id'],'include':[{'model':db[_0xc199('0x53')],'as':'Agents','attributes':['id','name',_0xc199('0x54'),_0xc199('0x55'),_0xc199('0x56')],'raw':!![]}]})[_0xc199('0x15')](function(_0x28c8a7){if(_0x28c8a7){var _0x57ef7e=_[_0xc199('0x57')](_0x28c8a7,function(_0x11adc0){var _0x24d62b=_0x11adc0[_0xc199('0x17')]({'plain':!![]});return _0x24d62b[_0xc199('0x58')];});return db[_0xc199('0x25')][_0xc199('0x33')]({'where':{'id':_0x23cdb2[_0xc199('0x29')]['id']}})[_0xc199('0x15')](function(_0x56cca6){return db[_0xc199('0x59')]['transaction'](function(_0x788b4b){return _0x56cca6[_0xc199('0x5a')](_0x489858,{'transaction':_0x788b4b})['then'](function(){return BPromise['each'](_0x57ef7e,function(_0x50a026){return db[_0xc199('0x45')]['findOrCreate']({'where':{'UserId':_0x50a026['id'],'FaxQueueId':_0x23cdb2[_0xc199('0x29')]['id']},'transaction':_0x788b4b});});})[_0xc199('0x15')](function(){_0x57ef7e[_0xc199('0x5b')](function(_0xbb6145){socket[_0xc199('0x5c')](_0xc199('0x5d'),{'UserId':_0xbb6145['id'],'FaxQueueId':_0x56cca6['id']});});});});});}})['then'](respondWithStatusCode(_0x5e6da3,null))[_0xc199('0x28')](handleError(_0x5e6da3,null));};exports[_0xc199('0x5e')]=function(_0x23c35c,_0x2fc66e){return db[_0xc199('0x51')][_0xc199('0x26')]({'where':{'id':_0x23c35c[_0xc199('0x24')][_0xc199('0x52')]},'attributes':['id'],'include':[{'model':db[_0xc199('0x53')],'as':_0xc199('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2fc66e,null))[_0xc199('0x15')](function(_0x56c1ec){var _0x251259=_['map'](_0x56c1ec,'id');var _0x494449=[];var _0xf8731c=[];var _0x5d43c8=squel[_0xc199('0x5f')]();_0x5d43c8['field']('tq.TeamId')[_0xc199('0x60')]('team_has_fax_queues','tq')[_0xc199('0x61')]('user_has_teams','ut',_0xc199('0x62'))[_0xc199('0x22')](_0xc199('0x63'),_0x23c35c[_0xc199('0x29')]['id']);for(var _0x356b79=0x0;_0x356b79<_0x56c1ec[_0xc199('0x30')];_0x356b79+=0x1){let _0x467b1f=_0x56c1ec[_0x356b79];for(var _0x37cdbd=0x0;_0x37cdbd<_0x467b1f[_0xc199('0x58')][_0xc199('0x30')];_0x37cdbd+=0x1){let _0x53bf32=_0x467b1f[_0xc199('0x58')][_0x37cdbd];var _0x40a4ce=_0x5d43c8[_0xc199('0x64')]();_0x40a4ce[_0xc199('0x22')](_0xc199('0x65'),_0x53bf32['id']);_0xf8731c['push'](db[_0xc199('0x59')][_0xc199('0x24')](_0x40a4ce[_0xc199('0x66')](),{'type':db[_0xc199('0x59')]['QueryTypes'][_0xc199('0x67')]})[_0xc199('0x15')](function(_0x4e4012){if(_0x4e4012[_0xc199('0x30')]===0x1){return _0x53bf32['id'];}else{var _0x24c877=_[_0xc199('0x68')](_[_0xc199('0x47')](_0x4e4012,_0xc199('0x69')),function(_0x25e79b){return _['includes'](_0x251259,_0x25e79b);});if(_0x24c877){return _0x53bf32['id'];}}}));}}return BPromise[_0xc199('0x6a')](_0xf8731c)[_0xc199('0x15')](function(_0x5312f1){_0x494449=_(_0x494449)[_0xc199('0x6b')](_0x5312f1)[_0xc199('0x6c')]()['value']();return db['FaxQueue'][_0xc199('0x33')]({'where':{'id':_0x23c35c[_0xc199('0x29')]['id']}})[_0xc199('0x15')](function(_0x3b9534){return db[_0xc199('0x59')][_0xc199('0x6d')](function(_0x2c0ef3){return _0x3b9534[_0xc199('0x5e')](_0x23c35c[_0xc199('0x24')][_0xc199('0x52')],{'transaction':_0x2c0ef3})[_0xc199('0x15')](function(){if(!_[_0xc199('0x6e')](_0x494449)){return _0x3b9534[_0xc199('0x6f')](_0x494449,{'transaction':_0x2c0ef3});}})[_0xc199('0x15')](function(){_0x494449[_0xc199('0x5b')](function(_0x25bc1e){socket[_0xc199('0x5c')](_0xc199('0x70'),{'UserId':_0x25bc1e,'FaxQueueId':_0x3b9534['id']});});});});});});})['then'](respondWithStatusCode(_0x2fc66e,null))[_0xc199('0x28')](handleError(_0x2fc66e,null));};exports[_0xc199('0x71')]=function(_0x53a763,_0x5cd41c){return db[_0xc199('0x25')][_0xc199('0x33')]({'where':{'id':_0x53a763[_0xc199('0x29')]['id']}})[_0xc199('0x15')](handleEntityNotFound(_0x5cd41c,null))[_0xc199('0x15')](function(_0x15d5be){if(_0x15d5be){return _0x15d5be['addAgents'](_0x53a763[_0xc199('0x72')][_0xc199('0x52')],_[_0xc199('0x73')](_0x53a763[_0xc199('0x72')],['ids','id'])||{})[_0xc199('0x74')](function(_0x17471f){for(var _0x584f5a=0x0;_0x584f5a<_0x53a763[_0xc199('0x72')][_0xc199('0x52')][_0xc199('0x30')];_0x584f5a+=0x1){socket[_0xc199('0x5c')]('userFaxQueue:save',{'UserId':Number(_0x53a763[_0xc199('0x72')][_0xc199('0x52')][_0x584f5a]),'FaxQueueId':Number(_0x53a763['params']['id'])});}return _0x17471f;});}})['then'](respondWithResult(_0x5cd41c,null))[_0xc199('0x28')](handleError(_0x5cd41c,null));};exports[_0xc199('0x6f')]=function(_0x22d5f0,_0x415b54){return db[_0xc199('0x25')][_0xc199('0x33')]({'where':{'id':_0x22d5f0[_0xc199('0x29')]['id']}})['then'](handleEntityNotFound(_0x415b54,null))[_0xc199('0x15')](function(_0x2d5f00){if(_0x2d5f00){return _0x2d5f00['removeAgents'](_0x22d5f0[_0xc199('0x24')][_0xc199('0x52')])['then'](function(){if(_[_0xc199('0x75')](_0x22d5f0['query'][_0xc199('0x52')])){for(var _0x5f081b=0x0;_0x5f081b<_0x22d5f0[_0xc199('0x24')]['ids'][_0xc199('0x30')];_0x5f081b+=0x1){socket[_0xc199('0x5c')]('userFaxQueue:remove',{'UserId':Number(_0x22d5f0[_0xc199('0x24')]['ids'][_0x5f081b]),'FaxQueueId':Number(_0x22d5f0[_0xc199('0x29')]['id'])});}}else{socket['emit'](_0xc199('0x70'),{'UserId':Number(_0x22d5f0[_0xc199('0x24')][_0xc199('0x52')]),'FaxQueueId':Number(_0x22d5f0['params']['id'])});}});}})[_0xc199('0x15')](respondWithStatusCode(_0x415b54,null))[_0xc199('0x28')](handleError(_0x415b54,null));};exports[_0xc199('0x76')]=function(_0x49eb1f,_0x417137){var _0x39fdb4={};var _0x370b9d={};var _0x91d93;var _0x5b9b24;return db[_0xc199('0x25')]['findOne']({'where':{'id':_0x49eb1f[_0xc199('0x29')]['id']}})[_0xc199('0x15')](handleEntityNotFound(_0x417137,null))['then'](function(_0x5bb505){if(_0x5bb505){_0x91d93=_0x5bb505;_0x370b9d[_0xc199('0x2d')]=_['keys'](db['User'][_0xc199('0x1e')]);_0x370b9d[_0xc199('0x24')]=_['keys'](_0x49eb1f[_0xc199('0x24')]);_0x370b9d[_0xc199('0x2b')]=_[_0xc199('0x2c')](_0x370b9d[_0xc199('0x2d')],_0x370b9d[_0xc199('0x24')]);_0x39fdb4[_0xc199('0x2f')]=_[_0xc199('0x2c')](_0x370b9d['model'],qs[_0xc199('0x2e')](_0x49eb1f[_0xc199('0x24')][_0xc199('0x2e')]));_0x39fdb4[_0xc199('0x2f')]=_0x39fdb4['attributes'][_0xc199('0x30')]?_0x39fdb4[_0xc199('0x2f')]:_0x370b9d[_0xc199('0x2d')];_0x39fdb4[_0xc199('0x40')]=qs['sort'](_0x49eb1f[_0xc199('0x24')]['sort']);_0x39fdb4[_0xc199('0x22')]=qs['filters'](_[_0xc199('0x42')](_0x49eb1f[_0xc199('0x24')],_0x370b9d['filters']));if(_0x49eb1f[_0xc199('0x24')][_0xc199('0x43')]){_0x39fdb4['where']=_[_0xc199('0x32')](_0x39fdb4[_0xc199('0x22')],{'$or':_[_0xc199('0x47')](_0x39fdb4['attributes'],function(_0x149bcf){var _0x4307fb={};_0x4307fb[_0x149bcf]={'$like':'%'+_0x49eb1f[_0xc199('0x24')][_0xc199('0x43')]+'%'};return _0x4307fb;})});}_0x39fdb4=_[_0xc199('0x32')]({},_0x39fdb4,_0x49eb1f['options']);return _0x91d93[_0xc199('0x76')](_0x39fdb4);}})[_0xc199('0x15')](function(_0x1f9eee){if(_0x1f9eee){_0x5b9b24=_0x1f9eee[_0xc199('0x30')];if(!_0x49eb1f['query']['hasOwnProperty'](_0xc199('0x3f'))){_0x39fdb4[_0xc199('0x11')]=qs['limit'](_0x49eb1f[_0xc199('0x24')][_0xc199('0x11')]);_0x39fdb4[_0xc199('0xf')]=qs['offset'](_0x49eb1f[_0xc199('0x24')][_0xc199('0xf')]);}return _0x91d93['getAgents'](_0x39fdb4);}})[_0xc199('0x15')](function(_0x407d4c){if(_0x407d4c){return _0x407d4c?{'count':_0x5b9b24,'rows':_0x407d4c}:null;}})[_0xc199('0x15')](respondWithResult(_0x417137,null))['catch'](handleError(_0x417137,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7bbcc7c..0986ff8 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 _0x5685=['exports','../../mysqldb','FaxQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x46186b,_0x35ba23){var _0x3568bc=function(_0x5f42af){while(--_0x5f42af){_0x46186b['push'](_0x46186b['shift']());}};_0x3568bc(++_0x35ba23);}(_0x5685,0x172));var _0x5568=function(_0x34bc5e,_0x538eb4){_0x34bc5e=_0x34bc5e-0x0;var _0x3e6969=_0x5685[_0x34bc5e];return _0x3e6969;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x5568('0x0'))['db'][_0x5568('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5568('0x2'),'afterUpdate':_0x5568('0x3'),'afterDestroy':_0x5568('0x4')};function emitEvent(_0x116707){return function(_0x53f272,_0x1f8df7,_0x3de51d){FaxQueueEvents[_0x5568('0x5')](_0x116707+':'+_0x53f272['id'],_0x53f272);FaxQueueEvents['emit'](_0x116707,_0x53f272);_0x3de51d(null);};}for(var e in events){if(events[_0x5568('0x6')](e)){var event=events[e];FaxQueue[_0x5568('0x7')](e,emitEvent(event));}}module[_0x5568('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x6fb7=['remove','emit','hasOwnProperty','hook','exports','events','FaxQueue','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6fb7,0x1be));var _0x76fb=function(_0x5e21da,_0x2b5e0f){_0x5e21da=_0x5e21da-0x0;var _0x7a3be6=_0x6fb7[_0x5e21da];return _0x7a3be6;};'use strict';var EventEmitter=require(_0x76fb('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x76fb('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x76fb('0x2'),'afterUpdate':_0x76fb('0x3'),'afterDestroy':_0x76fb('0x4')};function emitEvent(_0x34a1cd){return function(_0x5ee496,_0x21fa0f,_0x30a672){FaxQueueEvents['emit'](_0x34a1cd+':'+_0x5ee496['id'],_0x5ee496);FaxQueueEvents[_0x76fb('0x5')](_0x34a1cd,_0x5ee496);_0x30a672(null);};}for(var e in events){if(events[_0x76fb('0x6')](e)){var event=events[e];FaxQueue[_0x76fb('0x7')](e,emitEvent(event));}}module[_0x76fb('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 a915183..391d40e 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 _0x4dca=['define','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0x4dca,0x188));var _0xa4dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4dca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa4dc('0x0'));var util=require(_0xa4dc('0x1'));var logger=require(_0xa4dc('0x2'))(_0xa4dc('0x3'));var moment=require(_0xa4dc('0x4'));var BPromise=require(_0xa4dc('0x5'));var rp=require(_0xa4dc('0x6'));var fs=require('fs');var path=require(_0xa4dc('0x7'));var rimraf=require(_0xa4dc('0x8'));var config=require(_0xa4dc('0x9'));var attributes=require('./faxQueue.attributes');module[_0xa4dc('0xa')]=function(_0x156fba,_0x54015b){return _0x156fba[_0xa4dc('0xb')](_0xa4dc('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa37=['request-promise','path','rimraf','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x162ccc,_0x2efff8){var _0x48321b=function(_0x57df91){while(--_0x57df91){_0x162ccc['push'](_0x162ccc['shift']());}};_0x48321b(++_0x2efff8);}(_0xaa37,0xbe));var _0x7aa3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xaa37[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var logger=require(_0x7aa3('0x2'))(_0x7aa3('0x3'));var moment=require(_0x7aa3('0x4'));var BPromise=require(_0x7aa3('0x5'));var rp=require(_0x7aa3('0x6'));var fs=require('fs');var path=require(_0x7aa3('0x7'));var rimraf=require(_0x7aa3('0x8'));var config=require('../../config/environment');var attributes=require(_0x7aa3('0x9'));module[_0x7aa3('0xa')]=function(_0x4e4833,_0x339d21){return _0x4e4833[_0x7aa3('0xb')](_0x7aa3('0xc'),attributes,{'tableName':_0x7aa3('0xd'),'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 e38cb80..337ebb2 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 _0x762d=['GetFaxQueue','ShowFaxQueue','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxQueue.socket','request','then','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueue,\x20%s,\x20%s','result','catch','FaxQueue','findAll','options','where','attributes','limit','map','include','model','info'];(function(_0x167fbb,_0x3e69b0){var _0x200b2b=function(_0x538dfa){while(--_0x538dfa){_0x167fbb['push'](_0x167fbb['shift']());}};_0x200b2b(++_0x3e69b0);}(_0x762d,0xfe));var _0xd762=function(_0x41055b,_0x50f71b){_0x41055b=_0x41055b-0x0;var _0x54b11c=_0x762d[_0x41055b];return _0x54b11c;};'use strict';var _=require(_0xd762('0x0'));var util=require(_0xd762('0x1'));var moment=require('moment');var BPromise=require(_0xd762('0x2'));var rs=require(_0xd762('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd762('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xd762('0x5'));var jayson=require(_0xd762('0x6'));var client=jayson['client'][_0xd762('0x7')]({'port':0x232a});config[_0xd762('0x8')]=_[_0xd762('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd762('0xa'))(new Redis(config[_0xd762('0x8')]));require(_0xd762('0xb'))['register'](socket);function respondWithRpcPromise(_0xf8f8d3,_0x5d9a38,_0x2efcce){return new BPromise(function(_0x576079,_0x4abeab){return client[_0xd762('0xc')](_0xf8f8d3,_0x2efcce)[_0xd762('0xd')](function(_0x246eef){logger['info']('FaxQueue,\x20%s,\x20%s',_0x5d9a38,_0xd762('0xe'));logger[_0xd762('0xf')](_0xd762('0x10'),_0x5d9a38,_0xd762('0xe'),JSON[_0xd762('0x11')](_0x246eef));if(_0x246eef[_0xd762('0x12')]){if(_0x246eef['error'][_0xd762('0x13')]===0x1f4){logger[_0xd762('0x12')]('FaxQueue,\x20%s,\x20%s',_0x5d9a38,_0x246eef[_0xd762('0x12')][_0xd762('0x14')]);return _0x4abeab(_0x246eef[_0xd762('0x12')][_0xd762('0x14')]);}logger[_0xd762('0x12')]('FaxQueue,\x20%s,\x20%s',_0x5d9a38,_0x246eef['error']['message']);return _0x576079(_0x246eef['error']['message']);}else{logger['info'](_0xd762('0x15'),_0x5d9a38,_0xd762('0xe'));_0x576079(_0x246eef[_0xd762('0x16')][_0xd762('0x14')]);}})[_0xd762('0x17')](function(_0x29dce4){logger[_0xd762('0x12')](_0xd762('0x15'),_0x5d9a38,_0x29dce4);_0x4abeab(_0x29dce4);});});}exports['GetFaxQueue']=function(_0x10550c){var _0x45a664=this;return new Promise(function(_0x214018,_0x49db09){return db[_0xd762('0x18')][_0xd762('0x19')]({'raw':_0x10550c[_0xd762('0x1a')]?_0x10550c[_0xd762('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x10550c['options']?_0x10550c['options'][_0xd762('0x1b')]||null:null,'attributes':_0x10550c[_0xd762('0x1a')]?_0x10550c[_0xd762('0x1a')][_0xd762('0x1c')]||null:null,'limit':_0x10550c[_0xd762('0x1a')]?_0x10550c[_0xd762('0x1a')][_0xd762('0x1d')]||null:null,'include':_0x10550c[_0xd762('0x1a')]?_0x10550c[_0xd762('0x1a')]['include']?_[_0xd762('0x1e')](_0x10550c[_0xd762('0x1a')][_0xd762('0x1f')],function(_0xe3cb5a){return{'model':db[_0xe3cb5a[_0xd762('0x20')]],'as':_0xe3cb5a['as'],'attributes':_0xe3cb5a[_0xd762('0x1c')],'include':_0xe3cb5a[_0xd762('0x1f')]?_['map'](_0xe3cb5a[_0xd762('0x1f')],function(_0x4d9347){return{'model':db[_0x4d9347[_0xd762('0x20')]],'as':_0x4d9347['as'],'attributes':_0x4d9347['attributes'],'include':_0x4d9347['include']?_[_0xd762('0x1e')](_0x4d9347[_0xd762('0x1f')],function(_0xff70cc){return{'model':db[_0xff70cc[_0xd762('0x20')]],'as':_0xff70cc['as'],'attributes':_0xff70cc[_0xd762('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcf9672){logger[_0xd762('0x21')](_0xd762('0x22'),_0x10550c);logger[_0xd762('0xf')]('GetFaxQueue',_0x10550c,JSON[_0xd762('0x11')](_0xcf9672));_0x214018(_0xcf9672);})[_0xd762('0x17')](function(_0x32166a){logger['error'](_0xd762('0x22'),_0x32166a[_0xd762('0x14')],_0x10550c);_0x49db09(_0x45a664[_0xd762('0x12')](0x1f4,_0x32166a[_0xd762('0x14')]));});});};exports['ShowFaxQueue']=function(_0x295caa){var _0x38704f=this;return new Promise(function(_0x356b3e,_0x431246){return db[_0xd762('0x18')]['find']({'raw':_0x295caa[_0xd762('0x1a')]?_0x295caa[_0xd762('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x295caa[_0xd762('0x1a')]?_0x295caa[_0xd762('0x1a')][_0xd762('0x1b')]||null:null,'attributes':_0x295caa[_0xd762('0x1a')]?_0x295caa[_0xd762('0x1a')]['attributes']||null:null,'include':_0x295caa[_0xd762('0x1a')]?_0x295caa['options'][_0xd762('0x1f')]?_['map'](_0x295caa[_0xd762('0x1a')][_0xd762('0x1f')],function(_0x251175){return{'model':db[_0x251175[_0xd762('0x20')]],'as':_0x251175['as'],'attributes':_0x251175[_0xd762('0x1c')],'include':_0x251175[_0xd762('0x1f')]?_['map'](_0x251175[_0xd762('0x1f')],function(_0x3df0a8){return{'model':db[_0x3df0a8['model']],'as':_0x3df0a8['as'],'attributes':_0x3df0a8[_0xd762('0x1c')],'include':_0x3df0a8['include']?_[_0xd762('0x1e')](_0x3df0a8[_0xd762('0x1f')],function(_0xef55dd){return{'model':db[_0xef55dd[_0xd762('0x20')]],'as':_0xef55dd['as'],'attributes':_0xef55dd[_0xd762('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd762('0xd')](function(_0x17be89){logger['info'](_0xd762('0x23'),_0x295caa);logger[_0xd762('0xf')]('ShowFaxQueue',_0x295caa,JSON[_0xd762('0x11')](_0x17be89));_0x356b3e(_0x17be89);})['catch'](function(_0x342e8d){logger['error'](_0xd762('0x23'),_0x342e8d[_0xd762('0x14')],_0x295caa);_0x431246(_0x38704f['error'](0x1f4,_0x342e8d[_0xd762('0x14')]));});});}; \ No newline at end of file +var _0x035c=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetFaxQueue','ShowFaxQueue'];(function(_0x178910,_0x4e669d){var _0x333363=function(_0x4e2e17){while(--_0x4e2e17){_0x178910['push'](_0x178910['shift']());}};_0x333363(++_0x4e669d);}(_0x035c,0xf7));var _0xc035=function(_0x361b82,_0x2cde48){_0x361b82=_0x361b82-0x0;var _0x1e12a8=_0x035c[_0x361b82];return _0x1e12a8;};'use strict';var _=require(_0xc035('0x0'));var util=require(_0xc035('0x1'));var moment=require(_0xc035('0x2'));var BPromise=require(_0xc035('0x3'));var rs=require(_0xc035('0x4'));var fs=require('fs');var Redis=require(_0xc035('0x5'));var db=require(_0xc035('0x6'))['db'];var utils=require(_0xc035('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc035('0x8'));var jayson=require(_0xc035('0x9'));var client=jayson[_0xc035('0xa')][_0xc035('0xb')]({'port':0x232a});config[_0xc035('0xc')]=_[_0xc035('0xd')](config[_0xc035('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc035('0xe'))(new Redis(config[_0xc035('0xc')]));require(_0xc035('0xf'))['register'](socket);function respondWithRpcPromise(_0x2d07c0,_0x3767c7,_0x5cb395){return new BPromise(function(_0x25c2cd,_0x95acd3){return client[_0xc035('0x10')](_0x2d07c0,_0x5cb395)['then'](function(_0x3627b9){logger['info'](_0xc035('0x11'),_0x3767c7,_0xc035('0x12'));logger[_0xc035('0x13')](_0xc035('0x14'),_0x3767c7,'request\x20sent',JSON[_0xc035('0x15')](_0x3627b9));if(_0x3627b9[_0xc035('0x16')]){if(_0x3627b9['error'][_0xc035('0x17')]===0x1f4){logger['error'](_0xc035('0x11'),_0x3767c7,_0x3627b9[_0xc035('0x16')][_0xc035('0x18')]);return _0x95acd3(_0x3627b9[_0xc035('0x16')]['message']);}logger[_0xc035('0x16')]('FaxQueue,\x20%s,\x20%s',_0x3767c7,_0x3627b9[_0xc035('0x16')][_0xc035('0x18')]);return _0x25c2cd(_0x3627b9[_0xc035('0x16')]['message']);}else{logger[_0xc035('0x19')](_0xc035('0x11'),_0x3767c7,_0xc035('0x12'));_0x25c2cd(_0x3627b9['result'][_0xc035('0x18')]);}})[_0xc035('0x1a')](function(_0x403ffb){logger['error']('FaxQueue,\x20%s,\x20%s',_0x3767c7,_0x403ffb);_0x95acd3(_0x403ffb);});});}exports['GetFaxQueue']=function(_0x222ba9){var _0x5f3411=this;return new Promise(function(_0x11e0f1,_0x2708ab){return db[_0xc035('0x1b')][_0xc035('0x1c')]({'raw':_0x222ba9[_0xc035('0x1d')]?_0x222ba9[_0xc035('0x1d')][_0xc035('0x1e')]===undefined?!![]:![]:!![],'where':_0x222ba9['options']?_0x222ba9[_0xc035('0x1d')][_0xc035('0x1f')]||null:null,'attributes':_0x222ba9[_0xc035('0x1d')]?_0x222ba9[_0xc035('0x1d')][_0xc035('0x20')]||null:null,'limit':_0x222ba9[_0xc035('0x1d')]?_0x222ba9[_0xc035('0x1d')][_0xc035('0x21')]||null:null,'include':_0x222ba9['options']?_0x222ba9[_0xc035('0x1d')][_0xc035('0x22')]?_[_0xc035('0x23')](_0x222ba9[_0xc035('0x1d')][_0xc035('0x22')],function(_0x5d3df6){return{'model':db[_0x5d3df6['model']],'as':_0x5d3df6['as'],'attributes':_0x5d3df6[_0xc035('0x20')],'include':_0x5d3df6['include']?_['map'](_0x5d3df6[_0xc035('0x22')],function(_0x4ff682){return{'model':db[_0x4ff682[_0xc035('0x24')]],'as':_0x4ff682['as'],'attributes':_0x4ff682[_0xc035('0x20')],'include':_0x4ff682[_0xc035('0x22')]?_[_0xc035('0x23')](_0x4ff682['include'],function(_0x77d3d8){return{'model':db[_0x77d3d8[_0xc035('0x24')]],'as':_0x77d3d8['as'],'attributes':_0x77d3d8[_0xc035('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc035('0x25')](function(_0x1c4a7c){logger['info']('GetFaxQueue',_0x222ba9);logger[_0xc035('0x13')](_0xc035('0x26'),_0x222ba9,JSON[_0xc035('0x15')](_0x1c4a7c));_0x11e0f1(_0x1c4a7c);})[_0xc035('0x1a')](function(_0x1fdbf7){logger['error']('GetFaxQueue',_0x1fdbf7[_0xc035('0x18')],_0x222ba9);_0x2708ab(_0x5f3411['error'](0x1f4,_0x1fdbf7[_0xc035('0x18')]));});});};exports[_0xc035('0x27')]=function(_0x5380dc){var _0x3b1b8c=this;return new Promise(function(_0x289db7,_0x3fb5a1){return db[_0xc035('0x1b')][_0xc035('0x28')]({'raw':_0x5380dc[_0xc035('0x1d')]?_0x5380dc[_0xc035('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5380dc[_0xc035('0x1d')]?_0x5380dc['options'][_0xc035('0x1f')]||null:null,'attributes':_0x5380dc[_0xc035('0x1d')]?_0x5380dc[_0xc035('0x1d')][_0xc035('0x20')]||null:null,'include':_0x5380dc[_0xc035('0x1d')]?_0x5380dc[_0xc035('0x1d')][_0xc035('0x22')]?_[_0xc035('0x23')](_0x5380dc[_0xc035('0x1d')][_0xc035('0x22')],function(_0x12df7f){return{'model':db[_0x12df7f['model']],'as':_0x12df7f['as'],'attributes':_0x12df7f[_0xc035('0x20')],'include':_0x12df7f[_0xc035('0x22')]?_[_0xc035('0x23')](_0x12df7f['include'],function(_0x8fc03){return{'model':db[_0x8fc03[_0xc035('0x24')]],'as':_0x8fc03['as'],'attributes':_0x8fc03[_0xc035('0x20')],'include':_0x8fc03[_0xc035('0x22')]?_[_0xc035('0x23')](_0x8fc03[_0xc035('0x22')],function(_0x4ee6fd){return{'model':db[_0x4ee6fd[_0xc035('0x24')]],'as':_0x4ee6fd['as'],'attributes':_0x4ee6fd[_0xc035('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc035('0x25')](function(_0x64ebe9){logger[_0xc035('0x19')](_0xc035('0x27'),_0x5380dc);logger[_0xc035('0x13')]('ShowFaxQueue',_0x5380dc,JSON[_0xc035('0x15')](_0x64ebe9));_0x289db7(_0x64ebe9);})[_0xc035('0x1a')](function(_0x385106){logger[_0xc035('0x16')]('ShowFaxQueue',_0x385106[_0xc035('0x18')],_0x5380dc);_0x3fb5a1(_0x3b1b8c[_0xc035('0x16')](0x1f4,_0x385106[_0xc035('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 2c91115..103b4ee 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 _0x9fba=['./faxQueue.events','remove','update','removeListener','register','length','faxQueue:'];(function(_0x3374b0,_0x3cc015){var _0x11fac4=function(_0x2c05ca){while(--_0x2c05ca){_0x3374b0['push'](_0x3374b0['shift']());}};_0x11fac4(++_0x3cc015);}(_0x9fba,0x11f));var _0xa9fb=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9fba[_0x1969a7];return _0x3d665f;};'use strict';var FaxQueueEvents=require(_0xa9fb('0x0'));var events=['save',_0xa9fb('0x1'),_0xa9fb('0x2')];function createListener(_0x1fd9bb,_0x56c84a){return function(_0x1d4df6){_0x56c84a['emit'](_0x1fd9bb,_0x1d4df6);};}function removeListener(_0x5d444d,_0x320352){return function(){FaxQueueEvents[_0xa9fb('0x3')](_0x5d444d,_0x320352);};}exports[_0xa9fb('0x4')]=function(_0x3b4548){for(var _0xb8df13=0x0,_0xb5b4cd=events[_0xa9fb('0x5')];_0xb8df13<_0xb5b4cd;_0xb8df13++){var _0x506447=events[_0xb8df13];var _0x339669=createListener(_0xa9fb('0x6')+_0x506447,_0x3b4548);FaxQueueEvents['on'](_0x506447,_0x339669);}}; \ No newline at end of file +var _0x3dff=['emit','removeListener','register','faxQueue:','update'];(function(_0x5e3022,_0x5ef1ae){var _0x1dd4b7=function(_0x133843){while(--_0x133843){_0x5e3022['push'](_0x5e3022['shift']());}};_0x1dd4b7(++_0x5ef1ae);}(_0x3dff,0x1bc));var _0xf3df=function(_0x34886d,_0x3fe6e4){_0x34886d=_0x34886d-0x0;var _0x530479=_0x3dff[_0x34886d];return _0x530479;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save','remove',_0xf3df('0x0')];function createListener(_0x5d64fe,_0x25b168){return function(_0x11c3c0){_0x25b168[_0xf3df('0x1')](_0x5d64fe,_0x11c3c0);};}function removeListener(_0xd428c,_0x21df56){return function(){FaxQueueEvents[_0xf3df('0x2')](_0xd428c,_0x21df56);};}exports[_0xf3df('0x3')]=function(_0x1a6860){for(var _0x422d4a=0x0,_0x2779b8=events['length'];_0x422d4a<_0x2779b8;_0x422d4a++){var _0x5ee88b=events[_0x422d4a];var _0x13577e=createListener(_0xf3df('0x4')+_0x5ee88b,_0x1a6860);FaxQueueEvents['on'](_0x5ee88b,_0x13577e);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index f51cebf..186da87 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 _0xed1c=['/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams'];(function(_0xb457ef,_0x1a94a4){var _0x35cca5=function(_0x425078){while(--_0x425078){_0xb457ef['push'](_0xb457ef['shift']());}};_0x35cca5(++_0x1a94a4);}(_0xed1c,0xe4));var _0xced1=function(_0x27750a,_0x299a13){_0x27750a=_0x27750a-0x0;var _0x33fc00=_0xed1c[_0x27750a];return _0x33fc00;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0x6')]('/:id/members',auth[_0xced1('0x7')](),controller['getMembers']);router[_0xced1('0x6')](_0xced1('0xd'),auth[_0xced1('0x7')](),controller[_0xced1('0xe')]);router[_0xced1('0x6')](_0xced1('0xf'),auth[_0xced1('0x7')](),controller['getAgents']);router[_0xced1('0x10')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x11')]);router[_0xced1('0x10')]('/:id/teams',auth[_0xced1('0x7')](),controller[_0xced1('0x12')]);router['post'](_0xced1('0xf'),auth[_0xced1('0x7')](),controller[_0xced1('0x13')]);router[_0xced1('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xced1('0x15')]);router[_0xced1('0x16')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0x17')]);router[_0xced1('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0xced1('0x18')]);router[_0xced1('0x16')](_0xced1('0xf'),auth['isAuthenticated'](),controller[_0xced1('0x19')]);module[_0xced1('0x1a')]=router; \ No newline at end of file +var _0x6365=['../../config/environment','get','isAuthenticated','index','describe','show','/:id/members','getTeams','/:id/users','getAgents','create','/:id/teams','addAgents','put','/:id','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa7c498,_0x364c53){var _0x2de04a=function(_0x545436){while(--_0x545436){_0xa7c498['push'](_0xa7c498['shift']());}};_0x2de04a(++_0x364c53);}(_0x6365,0x148));var _0x5636=function(_0x1343bd,_0x35ab14){_0x1343bd=_0x1343bd-0x0;var _0x54f37f=_0x6365[_0x1343bd];return _0x54f37f;};'use strict';var multer=require(_0x5636('0x0'));var util=require(_0x5636('0x1'));var path=require(_0x5636('0x2'));var timeout=require(_0x5636('0x3'));var express=require('express');var router=express[_0x5636('0x4')]();var fs_extra=require(_0x5636('0x5'));var auth=require(_0x5636('0x6'));var interaction=require(_0x5636('0x7'));var config=require(_0x5636('0x8'));var controller=require('./faxQueue.controller');router[_0x5636('0x9')]('/',auth[_0x5636('0xa')](),controller[_0x5636('0xb')]);router[_0x5636('0x9')]('/describe',auth[_0x5636('0xa')](),controller[_0x5636('0xc')]);router['get']('/:id',auth[_0x5636('0xa')](),controller[_0x5636('0xd')]);router[_0x5636('0x9')](_0x5636('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x5636('0x9')]('/:id/teams',auth[_0x5636('0xa')](),controller[_0x5636('0xf')]);router[_0x5636('0x9')](_0x5636('0x10'),auth[_0x5636('0xa')](),controller[_0x5636('0x11')]);router['post']('/',auth[_0x5636('0xa')](),controller[_0x5636('0x12')]);router['post'](_0x5636('0x13'),auth[_0x5636('0xa')](),controller['addTeams']);router['post'](_0x5636('0x10'),auth[_0x5636('0xa')](),controller[_0x5636('0x14')]);router[_0x5636('0x15')](_0x5636('0x16'),auth['isAuthenticated'](),controller[_0x5636('0x17')]);router['delete']('/:id',auth[_0x5636('0xa')](),controller[_0x5636('0x18')]);router[_0x5636('0x19')](_0x5636('0x13'),auth[_0x5636('0xa')](),controller[_0x5636('0x1a')]);router[_0x5636('0x19')](_0x5636('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x5636('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 1411226..daafdc6 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 _0x4512=['STRING','DATE','sequelize','exports'];(function(_0x471ab2,_0x34229e){var _0x5875b4=function(_0x3aca4a){while(--_0x3aca4a){_0x471ab2['push'](_0x471ab2['shift']());}};_0x5875b4(++_0x34229e);}(_0x4512,0xa2));var _0x2451=function(_0xca41dc,_0x22936e){_0xca41dc=_0xca41dc-0x0;var _0x3e125c=_0x4512[_0xca41dc];return _0x3e125c;};'use strict';var moment=require('moment');var Sequelize=require(_0x2451('0x0'));module[_0x2451('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2451('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2451('0x3')]},'acceptAt':{'type':Sequelize[_0x2451('0x3')]},'exitAt':{'type':Sequelize[_0x2451('0x3')]},'reason':{'type':Sequelize[_0x2451('0x2')]}}; \ No newline at end of file +var _0xf5e8=['moment','sequelize','exports','STRING','DATE'];(function(_0x31771b,_0x4b46b2){var _0x39a868=function(_0x278962){while(--_0x278962){_0x31771b['push'](_0x31771b['shift']());}};_0x39a868(++_0x4b46b2);}(_0xf5e8,0xfa));var _0x8f5e=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0xf5e8[_0x324e86];return _0x592846;};'use strict';var moment=require(_0x8f5e('0x0'));var Sequelize=require(_0x8f5e('0x1'));module[_0x8f5e('0x2')]={'uniqueid':{'type':Sequelize[_0x8f5e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8f5e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8f5e('0x4')]},'acceptAt':{'type':Sequelize[_0x8f5e('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8f5e('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index dfb85cd..31304a8 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 _0x9434=['includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','map','FaxQueueReport','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x15df7f,_0x318875){var _0x2cb715=function(_0x10fb5f){while(--_0x10fb5f){_0x15df7f['push'](_0x15df7f['shift']());}};_0x2cb715(++_0x318875);}(_0x9434,0x168));var _0x4943=function(_0x506f06,_0x58f9b4){_0x506f06=_0x506f06-0x0;var _0x17222a=_0x9434[_0x506f06];return _0x17222a;};'use strict';var emlformat=require(_0x4943('0x0'));var rimraf=require(_0x4943('0x1'));var zipdir=require(_0x4943('0x2'));var jsonpatch=require(_0x4943('0x3'));var rp=require(_0x4943('0x4'));var moment=require(_0x4943('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4943('0x6'));var util=require(_0x4943('0x7'));var path=require('path');var sox=require(_0x4943('0x8'));var csv=require(_0x4943('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4943('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4943('0xb'));var jsforce=require(_0x4943('0xc'));var deskjs=require(_0x4943('0xd'));var toCsv=require(_0x4943('0x9'));var querystring=require(_0x4943('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4943('0xf'));var qs=require(_0x4943('0x10'));var as=require(_0x4943('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4943('0x12'))(_0x4943('0x13'));var utils=require('../../config/utils');var config=require(_0x4943('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x943461,_0x1e95be){_0x1e95be=_0x1e95be||0xcc;return function(_0x33fd73){if(_0x33fd73){return _0x943461[_0x4943('0x15')](_0x1e95be);}return _0x943461[_0x4943('0x16')](_0x1e95be)[_0x4943('0x17')]();};}function respondWithResult(_0x4077f1,_0x524c8a){_0x524c8a=_0x524c8a||0xc8;return function(_0x902712){if(_0x902712){return _0x4077f1[_0x4943('0x16')](_0x524c8a)[_0x4943('0x18')](_0x902712);}};}function respondWithFilteredResult(_0x13d758,_0x37c843){return function(_0x39b4e3){if(_0x39b4e3){var _0x4b075e=typeof _0x37c843[_0x4943('0x19')]===_0x4943('0x1a')&&typeof _0x37c843[_0x4943('0x1b')]==='undefined';var _0x53377c=_0x39b4e3[_0x4943('0x1c')];var _0x4cba96=_0x4b075e?0x0:_0x37c843[_0x4943('0x19')];var _0x33b2d0=_0x4b075e?_0x39b4e3['count']:_0x37c843[_0x4943('0x19')]+_0x37c843[_0x4943('0x1b')];var _0x38749b;if(_0x33b2d0>=_0x53377c){_0x33b2d0=_0x53377c;_0x38749b=0xc8;}else{_0x38749b=0xce;}_0x13d758['status'](_0x38749b);return _0x13d758[_0x4943('0x1d')]('Content-Range',_0x4cba96+'-'+_0x33b2d0+'/'+_0x53377c)[_0x4943('0x18')](_0x39b4e3);}return null;};}function patchUpdates(_0x52fa3b){return function(_0x258079){try{jsonpatch[_0x4943('0x1e')](_0x258079,_0x52fa3b,!![]);}catch(_0x278569){return BPromise[_0x4943('0x1f')](_0x278569);}return _0x258079['save']();};}function saveUpdates(_0x1ceb6f,_0x205eb2){return function(_0x34e322){if(_0x34e322){return _0x34e322[_0x4943('0x20')](_0x1ceb6f)[_0x4943('0x21')](function(_0xd88a73){return _0xd88a73;});}return null;};}function removeEntity(_0x793d18,_0x340077){return function(_0x5dd061){if(_0x5dd061){return _0x5dd061['destroy']()[_0x4943('0x21')](function(){_0x793d18[_0x4943('0x16')](0xcc)[_0x4943('0x17')]();});}};}function handleEntityNotFound(_0x5d8cbe,_0x41f98d){return function(_0xd49582){if(!_0xd49582){_0x5d8cbe['sendStatus'](0x194);}return _0xd49582;};}function handleError(_0x8a63cb,_0x1499c7){_0x1499c7=_0x1499c7||0x1f4;return function(_0x43cbfe){logger[_0x4943('0x22')](_0x43cbfe[_0x4943('0x23')]);if(_0x43cbfe[_0x4943('0x24')]){delete _0x43cbfe[_0x4943('0x24')];}_0x8a63cb[_0x4943('0x16')](_0x1499c7)[_0x4943('0x25')](_0x43cbfe);};}exports[_0x4943('0x26')]=function(_0x170e78,_0x3b733f){var _0xa71fec={},_0x83bbd8={},_0x38b0a0={'count':0x0,'rows':[]};var _0x1cbb1e=_[_0x4943('0x27')](db[_0x4943('0x28')]['rawAttributes'],function(_0x43b11f){return{'name':_0x43b11f['fieldName'],'type':_0x43b11f[_0x4943('0x29')][_0x4943('0x2a')]};});_0x83bbd8[_0x4943('0x2b')]=_[_0x4943('0x27')](_0x1cbb1e,_0x4943('0x24'));_0x83bbd8[_0x4943('0x2c')]=_[_0x4943('0x2d')](_0x170e78[_0x4943('0x2c')]);_0x83bbd8['filters']=_[_0x4943('0x2e')](_0x83bbd8[_0x4943('0x2b')],_0x83bbd8['query']);_0xa71fec[_0x4943('0x2f')]=_[_0x4943('0x2e')](_0x83bbd8['model'],qs[_0x4943('0x30')](_0x170e78[_0x4943('0x2c')][_0x4943('0x30')]));_0xa71fec['attributes']=_0xa71fec[_0x4943('0x2f')][_0x4943('0x31')]?_0xa71fec[_0x4943('0x2f')]:_0x83bbd8[_0x4943('0x2b')];if(!_0x170e78[_0x4943('0x2c')]['hasOwnProperty'](_0x4943('0x32'))){_0xa71fec[_0x4943('0x1b')]=qs[_0x4943('0x1b')](_0x170e78[_0x4943('0x2c')][_0x4943('0x1b')]);_0xa71fec[_0x4943('0x19')]=qs[_0x4943('0x19')](_0x170e78[_0x4943('0x2c')][_0x4943('0x19')]);}_0xa71fec[_0x4943('0x33')]=qs[_0x4943('0x34')](_0x170e78['query'][_0x4943('0x34')]);_0xa71fec[_0x4943('0x35')]=qs[_0x4943('0x36')](_[_0x4943('0x37')](_0x170e78[_0x4943('0x2c')],_0x83bbd8['filters']),_0x1cbb1e);if(_0x170e78['query']['filter']){_0xa71fec[_0x4943('0x35')]=_[_0x4943('0x38')](_0xa71fec['where'],{'$or':_[_0x4943('0x27')](_0x1cbb1e,function(_0x4e970c){if(_0x4e970c[_0x4943('0x29')]!==_0x4943('0x39')){var _0x2fb5a7={};_0x2fb5a7[_0x4e970c[_0x4943('0x24')]]={'$like':'%'+_0x170e78[_0x4943('0x2c')][_0x4943('0x3a')]+'%'};return _0x2fb5a7;}})});}_0xa71fec=_[_0x4943('0x38')]({},_0xa71fec,_0x170e78[_0x4943('0x3b')]);var _0x41eaff={'where':_0xa71fec[_0x4943('0x35')]};return db[_0x4943('0x28')][_0x4943('0x1c')](_0x41eaff)[_0x4943('0x21')](function(_0x1b78bc){_0x38b0a0[_0x4943('0x1c')]=_0x1b78bc;if(_0x170e78[_0x4943('0x2c')][_0x4943('0x3c')]){_0xa71fec[_0x4943('0x3d')]=[{'all':!![]}];}return db[_0x4943('0x28')][_0x4943('0x3e')](_0xa71fec);})[_0x4943('0x21')](function(_0x11ee4a){_0x38b0a0[_0x4943('0x3f')]=_0x11ee4a;return _0x38b0a0;})[_0x4943('0x21')](respondWithFilteredResult(_0x3b733f,_0xa71fec))[_0x4943('0x40')](handleError(_0x3b733f,null));};exports[_0x4943('0x41')]=function(_0xe27ab,_0x5c4702){var _0x11a362={'raw':!![],'where':{'id':_0xe27ab['params']['id']}},_0x147179={};_0x147179['model']=_[_0x4943('0x2d')](db['FaxQueueReport'][_0x4943('0x42')]);_0x147179['query']=_[_0x4943('0x2d')](_0xe27ab['query']);_0x147179[_0x4943('0x36')]=_['intersection'](_0x147179[_0x4943('0x2b')],_0x147179[_0x4943('0x2c')]);_0x11a362[_0x4943('0x2f')]=_['intersection'](_0x147179['model'],qs[_0x4943('0x30')](_0xe27ab['query'][_0x4943('0x30')]));_0x11a362['attributes']=_0x11a362[_0x4943('0x2f')][_0x4943('0x31')]?_0x11a362[_0x4943('0x2f')]:_0x147179[_0x4943('0x2b')];if(_0xe27ab['query']['includeAll']){_0x11a362[_0x4943('0x3d')]=[{'all':!![]}];}_0x11a362=_['merge']({},_0x11a362,_0xe27ab['options']);return db[_0x4943('0x28')][_0x4943('0x43')](_0x11a362)[_0x4943('0x21')](handleEntityNotFound(_0x5c4702,null))[_0x4943('0x21')](respondWithResult(_0x5c4702,null))[_0x4943('0x40')](handleError(_0x5c4702,null));};exports[_0x4943('0x44')]=function(_0x2c0287,_0x5c8e07){return db[_0x4943('0x28')][_0x4943('0x44')](_0x2c0287['body'],{})[_0x4943('0x21')](respondWithResult(_0x5c8e07,0xc9))[_0x4943('0x40')](handleError(_0x5c8e07,null));};exports[_0x4943('0x20')]=function(_0x4d1a31,_0x350f55){if(_0x4d1a31[_0x4943('0x45')]['id']){delete _0x4d1a31['body']['id'];}return db[_0x4943('0x28')][_0x4943('0x43')]({'where':{'id':_0x4d1a31['params']['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x350f55,null))[_0x4943('0x21')](saveUpdates(_0x4d1a31[_0x4943('0x45')],null))['then'](respondWithResult(_0x350f55,null))[_0x4943('0x40')](handleError(_0x350f55,null));};exports['destroy']=function(_0x51636a,_0x1f4f57){return db[_0x4943('0x28')][_0x4943('0x43')]({'where':{'id':_0x51636a['params']['id']}})['then'](handleEntityNotFound(_0x1f4f57,null))['then'](removeEntity(_0x1f4f57,null))[_0x4943('0x40')](handleError(_0x1f4f57,null));};exports['describe']=function(_0x5ca090,_0x88b338){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x88b338,null))[_0x4943('0x40')](handleError(_0x88b338,null));}; \ No newline at end of file +var _0xa98d=['merge','includeAll','findAll','rows','show','params','options','find','create','body','update','catch','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa98d,0xa3));var _0xda98=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa98d[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xda98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda98('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda98('0x2'));var moment=require(_0xda98('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xda98('0x4'));var util=require(_0xda98('0x5'));var path=require(_0xda98('0x6'));var sox=require('sox');var csv=require(_0xda98('0x7'));var ejs=require(_0xda98('0x8'));var fs=require('fs');var fs_extra=require(_0xda98('0x9'));var _=require(_0xda98('0xa'));var squel=require(_0xda98('0xb'));var crypto=require(_0xda98('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xda98('0xd'));var toCsv=require('to-csv');var querystring=require(_0xda98('0xe'));var Papa=require(_0xda98('0xf'));var Redis=require('ioredis');var authService=require(_0xda98('0x10'));var qs=require(_0xda98('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda98('0x12'));var logger=require(_0xda98('0x13'))(_0xda98('0x14'));var utils=require('../../config/utils');var config=require(_0xda98('0x15'));var licenseUtil=require(_0xda98('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbe0f39,_0xc737b2){_0xc737b2=_0xc737b2||0xcc;return function(_0x440794){if(_0x440794){return _0xbe0f39[_0xda98('0x17')](_0xc737b2);}return _0xbe0f39[_0xda98('0x18')](_0xc737b2)[_0xda98('0x19')]();};}function respondWithResult(_0x46214d,_0x578dc9){_0x578dc9=_0x578dc9||0xc8;return function(_0x5c29f1){if(_0x5c29f1){return _0x46214d[_0xda98('0x18')](_0x578dc9)[_0xda98('0x1a')](_0x5c29f1);}};}function respondWithFilteredResult(_0x28c180,_0x5b04cb){return function(_0x44dd82){if(_0x44dd82){var _0xcc4fdb=typeof _0x5b04cb[_0xda98('0x1b')]===_0xda98('0x1c')&&typeof _0x5b04cb['limit']===_0xda98('0x1c');var _0x41cdb0=_0x44dd82[_0xda98('0x1d')];var _0x273e10=_0xcc4fdb?0x0:_0x5b04cb[_0xda98('0x1b')];var _0x51bb58=_0xcc4fdb?_0x44dd82[_0xda98('0x1d')]:_0x5b04cb[_0xda98('0x1b')]+_0x5b04cb[_0xda98('0x1e')];var _0x485654;if(_0x51bb58>=_0x41cdb0){_0x51bb58=_0x41cdb0;_0x485654=0xc8;}else{_0x485654=0xce;}_0x28c180['status'](_0x485654);return _0x28c180[_0xda98('0x1f')](_0xda98('0x20'),_0x273e10+'-'+_0x51bb58+'/'+_0x41cdb0)[_0xda98('0x1a')](_0x44dd82);}return null;};}function patchUpdates(_0x528c3e){return function(_0x12d759){try{jsonpatch[_0xda98('0x21')](_0x12d759,_0x528c3e,!![]);}catch(_0x401674){return BPromise[_0xda98('0x22')](_0x401674);}return _0x12d759[_0xda98('0x23')]();};}function saveUpdates(_0xad236e,_0x170bb7){return function(_0x51dc7e){if(_0x51dc7e){return _0x51dc7e['update'](_0xad236e)['then'](function(_0x578521){return _0x578521;});}return null;};}function removeEntity(_0x450714,_0x1a5390){return function(_0x46b4af){if(_0x46b4af){return _0x46b4af[_0xda98('0x24')]()[_0xda98('0x25')](function(){_0x450714['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de0ce,_0x52e920){return function(_0x265f20){if(!_0x265f20){_0x3de0ce['sendStatus'](0x194);}return _0x265f20;};}function handleError(_0x260fb6,_0x397343){_0x397343=_0x397343||0x1f4;return function(_0x2fad69){logger['error'](_0x2fad69[_0xda98('0x26')]);if(_0x2fad69[_0xda98('0x27')]){delete _0x2fad69['name'];}_0x260fb6[_0xda98('0x18')](_0x397343)[_0xda98('0x28')](_0x2fad69);};}exports['index']=function(_0x591be7,_0x312f53){var _0x3ddd61={},_0x3c0be3={},_0x21eb8c={'count':0x0,'rows':[]};var _0x49334c=_[_0xda98('0x29')](db[_0xda98('0x2a')][_0xda98('0x2b')],function(_0x24d5c1){return{'name':_0x24d5c1[_0xda98('0x2c')],'type':_0x24d5c1[_0xda98('0x2d')][_0xda98('0x2e')]};});_0x3c0be3[_0xda98('0x2f')]=_['map'](_0x49334c,_0xda98('0x27'));_0x3c0be3[_0xda98('0x30')]=_[_0xda98('0x31')](_0x591be7[_0xda98('0x30')]);_0x3c0be3[_0xda98('0x32')]=_[_0xda98('0x33')](_0x3c0be3[_0xda98('0x2f')],_0x3c0be3[_0xda98('0x30')]);_0x3ddd61[_0xda98('0x34')]=_[_0xda98('0x33')](_0x3c0be3[_0xda98('0x2f')],qs[_0xda98('0x35')](_0x591be7['query'][_0xda98('0x35')]));_0x3ddd61[_0xda98('0x34')]=_0x3ddd61[_0xda98('0x34')][_0xda98('0x36')]?_0x3ddd61['attributes']:_0x3c0be3[_0xda98('0x2f')];if(!_0x591be7[_0xda98('0x30')][_0xda98('0x37')](_0xda98('0x38'))){_0x3ddd61['limit']=qs[_0xda98('0x1e')](_0x591be7[_0xda98('0x30')][_0xda98('0x1e')]);_0x3ddd61['offset']=qs[_0xda98('0x1b')](_0x591be7['query']['offset']);}_0x3ddd61[_0xda98('0x39')]=qs['sort'](_0x591be7['query']['sort']);_0x3ddd61[_0xda98('0x3a')]=qs['filters'](_[_0xda98('0x3b')](_0x591be7['query'],_0x3c0be3[_0xda98('0x32')]),_0x49334c);if(_0x591be7[_0xda98('0x30')][_0xda98('0x3c')]){_0x3ddd61[_0xda98('0x3a')]=_['merge'](_0x3ddd61['where'],{'$or':_['map'](_0x49334c,function(_0x317ebd){if(_0x317ebd['type']!==_0xda98('0x3d')){var _0x3aa9ae={};_0x3aa9ae[_0x317ebd['name']]={'$like':'%'+_0x591be7[_0xda98('0x30')]['filter']+'%'};return _0x3aa9ae;}})});}_0x3ddd61=_[_0xda98('0x3e')]({},_0x3ddd61,_0x591be7['options']);var _0x56da1b={'where':_0x3ddd61[_0xda98('0x3a')]};return db[_0xda98('0x2a')][_0xda98('0x1d')](_0x56da1b)[_0xda98('0x25')](function(_0x123191){_0x21eb8c['count']=_0x123191;if(_0x591be7[_0xda98('0x30')][_0xda98('0x3f')]){_0x3ddd61['include']=[{'all':!![]}];}return db[_0xda98('0x2a')][_0xda98('0x40')](_0x3ddd61);})[_0xda98('0x25')](function(_0x1f0f0d){_0x21eb8c[_0xda98('0x41')]=_0x1f0f0d;return _0x21eb8c;})[_0xda98('0x25')](respondWithFilteredResult(_0x312f53,_0x3ddd61))['catch'](handleError(_0x312f53,null));};exports[_0xda98('0x42')]=function(_0x2eab38,_0xc0a259){var _0x136e46={'raw':!![],'where':{'id':_0x2eab38[_0xda98('0x43')]['id']}},_0x1577cf={};_0x1577cf[_0xda98('0x2f')]=_[_0xda98('0x31')](db[_0xda98('0x2a')][_0xda98('0x2b')]);_0x1577cf[_0xda98('0x30')]=_[_0xda98('0x31')](_0x2eab38[_0xda98('0x30')]);_0x1577cf[_0xda98('0x32')]=_[_0xda98('0x33')](_0x1577cf['model'],_0x1577cf['query']);_0x136e46[_0xda98('0x34')]=_[_0xda98('0x33')](_0x1577cf['model'],qs[_0xda98('0x35')](_0x2eab38['query'][_0xda98('0x35')]));_0x136e46['attributes']=_0x136e46[_0xda98('0x34')][_0xda98('0x36')]?_0x136e46['attributes']:_0x1577cf['model'];if(_0x2eab38[_0xda98('0x30')][_0xda98('0x3f')]){_0x136e46['include']=[{'all':!![]}];}_0x136e46=_['merge']({},_0x136e46,_0x2eab38[_0xda98('0x44')]);return db['FaxQueueReport'][_0xda98('0x45')](_0x136e46)['then'](handleEntityNotFound(_0xc0a259,null))[_0xda98('0x25')](respondWithResult(_0xc0a259,null))['catch'](handleError(_0xc0a259,null));};exports[_0xda98('0x46')]=function(_0x5aab8c,_0x506647){return db['FaxQueueReport'][_0xda98('0x46')](_0x5aab8c[_0xda98('0x47')],{})['then'](respondWithResult(_0x506647,0xc9))['catch'](handleError(_0x506647,null));};exports[_0xda98('0x48')]=function(_0x49c48c,_0x1a977b){if(_0x49c48c[_0xda98('0x47')]['id']){delete _0x49c48c['body']['id'];}return db[_0xda98('0x2a')][_0xda98('0x45')]({'where':{'id':_0x49c48c[_0xda98('0x43')]['id']}})[_0xda98('0x25')](handleEntityNotFound(_0x1a977b,null))[_0xda98('0x25')](saveUpdates(_0x49c48c[_0xda98('0x47')],null))[_0xda98('0x25')](respondWithResult(_0x1a977b,null))['catch'](handleError(_0x1a977b,null));};exports['destroy']=function(_0x489b7a,_0x4a2e69){return db[_0xda98('0x2a')][_0xda98('0x45')]({'where':{'id':_0x489b7a[_0xda98('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a2e69,null))['then'](removeEntity(_0x4a2e69,null))[_0xda98('0x49')](handleError(_0x4a2e69,null));};exports['describe']=function(_0xa43d9e,_0x81ab24){return db[_0xda98('0x2a')][_0xda98('0x4a')]()[_0xda98('0x25')](respondWithResult(_0x81ab24,null))[_0xda98('0x49')](handleError(_0x81ab24,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1dd7f2a..3dd7d76 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x2548ab,_0x9b125a){var _0x3fcbee=function(_0x53fdf2){while(--_0x53fdf2){_0x2548ab['push'](_0x2548ab['shift']());}};_0x3fcbee(++_0x9b125a);}(_0xf494,0x1c6));var _0x4f49=function(_0x127bab,_0x5f4482){_0x127bab=_0x127bab-0x0;var _0x21ccef=_0xf494[_0x127bab];return _0x21ccef;};'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 +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x3a9edf,_0x134845){var _0x191697=function(_0x3d5ed9){while(--_0x3d5ed9){_0x3a9edf['push'](_0x3a9edf['shift']());}};_0x191697(++_0x134845);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc4aa[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 87681f0..e16d043 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 _0xffb8=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','UpdateFaxQueueReport','raw','where','attributes','limit','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x1fb8f1,_0x47597f){var _0x337a30=function(_0x3cb2cd){while(--_0x3cb2cd){_0x1fb8f1['push'](_0x1fb8f1['shift']());}};_0x337a30(++_0x47597f);}(_0xffb8,0x1a0));var _0x8ffb=function(_0x5ec2ea,_0x92b71e){_0x5ec2ea=_0x5ec2ea-0x0;var _0x4aa323=_0xffb8[_0x5ec2ea];return _0x4aa323;};'use strict';var _=require(_0x8ffb('0x0'));var util=require(_0x8ffb('0x1'));var moment=require(_0x8ffb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ffb('0x3'));var db=require(_0x8ffb('0x4'))['db'];var utils=require(_0x8ffb('0x5'));var logger=require(_0x8ffb('0x6'))('rpc');var config=require(_0x8ffb('0x7'));var jayson=require(_0x8ffb('0x8'));var client=jayson[_0x8ffb('0x9')][_0x8ffb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2778ed,_0x583bc2,_0x48d0f4){return new BPromise(function(_0x50d1e7,_0x8bf2d2){return client['request'](_0x2778ed,_0x48d0f4)[_0x8ffb('0xb')](function(_0x4746ef){logger[_0x8ffb('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x583bc2,'request\x20sent');logger[_0x8ffb('0xd')](_0x8ffb('0xe'),_0x583bc2,_0x8ffb('0xf'),JSON['stringify'](_0x4746ef));if(_0x4746ef['error']){if(_0x4746ef[_0x8ffb('0x10')][_0x8ffb('0x11')]===0x1f4){logger[_0x8ffb('0x10')](_0x8ffb('0x12'),_0x583bc2,_0x4746ef[_0x8ffb('0x10')][_0x8ffb('0x13')]);return _0x8bf2d2(_0x4746ef[_0x8ffb('0x10')]['message']);}logger['error'](_0x8ffb('0x12'),_0x583bc2,_0x4746ef[_0x8ffb('0x10')]['message']);return _0x50d1e7(_0x4746ef[_0x8ffb('0x10')][_0x8ffb('0x13')]);}else{logger[_0x8ffb('0xc')](_0x8ffb('0x12'),_0x583bc2,_0x8ffb('0xf'));_0x50d1e7(_0x4746ef[_0x8ffb('0x14')][_0x8ffb('0x13')]);}})[_0x8ffb('0x15')](function(_0x5a053e){logger[_0x8ffb('0x10')](_0x8ffb('0x12'),_0x583bc2,_0x5a053e);_0x8bf2d2(_0x5a053e);});});}exports[_0x8ffb('0x16')]=function(_0x2cfa97){var _0x4bc52a=this;return new Promise(function(_0x23e2f1,_0xba852e){return db[_0x8ffb('0x17')][_0x8ffb('0x18')](_0x2cfa97[_0x8ffb('0x19')],{'raw':_0x2cfa97['options']?_0x2cfa97[_0x8ffb('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8ffb('0xb')](function(_0x295a10){logger['info'](_0x8ffb('0x16'),_0x2cfa97);logger['debug'](_0x8ffb('0x16'),_0x2cfa97,JSON['stringify'](_0x295a10));_0x23e2f1(_0x295a10);})[_0x8ffb('0x15')](function(_0x16f193){logger[_0x8ffb('0x10')](_0x8ffb('0x16'),_0x16f193[_0x8ffb('0x13')],_0x2cfa97);_0xba852e(_0x4bc52a[_0x8ffb('0x10')](0x1f4,_0x16f193[_0x8ffb('0x13')]));});});};exports[_0x8ffb('0x1b')]=function(_0x22527a){var _0x5d2d9f=this;return new Promise(function(_0x2ab640,_0x414c08){return db['FaxQueueReport']['update'](_0x22527a[_0x8ffb('0x19')],{'raw':_0x22527a[_0x8ffb('0x1a')]?_0x22527a[_0x8ffb('0x1a')][_0x8ffb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22527a[_0x8ffb('0x1a')]?_0x22527a[_0x8ffb('0x1a')][_0x8ffb('0x1d')]||null:null,'attributes':_0x22527a[_0x8ffb('0x1a')]?_0x22527a[_0x8ffb('0x1a')][_0x8ffb('0x1e')]||null:null,'limit':_0x22527a[_0x8ffb('0x1a')]?_0x22527a[_0x8ffb('0x1a')][_0x8ffb('0x1f')]||null:null})[_0x8ffb('0xb')](function(_0x5d4144){logger['info'](_0x8ffb('0x1b'),_0x22527a);logger['debug'](_0x8ffb('0x1b'),_0x22527a,JSON[_0x8ffb('0x20')](_0x5d4144));_0x2ab640(_0x5d4144);})['catch'](function(_0x5dbc8d){logger['error']('UpdateFaxQueueReport',_0x5dbc8d[_0x8ffb('0x13')],_0x22527a);_0x414c08(_0x5d2d9f['error'](0x1f4,_0x5dbc8d['message']));});});}; \ No newline at end of file +var _0x2083=['jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateFaxQueueReport','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','where','attributes','limit','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x2083,0x1e9));var _0x3208=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x2083[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0x3208('0x0'));var moment=require('moment');var BPromise=require(_0x3208('0x1'));var rs=require(_0x3208('0x2'));var fs=require('fs');var Redis=require(_0x3208('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3208('0x4'));var logger=require('../../config/logger')(_0x3208('0x5'));var config=require(_0x3208('0x6'));var jayson=require(_0x3208('0x7'));var client=jayson[_0x3208('0x8')][_0x3208('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54274,_0x328e7a,_0x30e892){return new BPromise(function(_0x17bfb8,_0x1445bc){return client[_0x3208('0xa')](_0x54274,_0x30e892)[_0x3208('0xb')](function(_0x1da041){logger[_0x3208('0xc')](_0x3208('0xd'),_0x328e7a,'request\x20sent');logger[_0x3208('0xe')](_0x3208('0xf'),_0x328e7a,'request\x20sent',JSON[_0x3208('0x10')](_0x1da041));if(_0x1da041['error']){if(_0x1da041[_0x3208('0x11')]['code']===0x1f4){logger['error'](_0x3208('0xd'),_0x328e7a,_0x1da041['error'][_0x3208('0x12')]);return _0x1445bc(_0x1da041['error']['message']);}logger[_0x3208('0x11')](_0x3208('0xd'),_0x328e7a,_0x1da041['error'][_0x3208('0x12')]);return _0x17bfb8(_0x1da041[_0x3208('0x11')][_0x3208('0x12')]);}else{logger[_0x3208('0xc')](_0x3208('0xd'),_0x328e7a,_0x3208('0x13'));_0x17bfb8(_0x1da041[_0x3208('0x14')][_0x3208('0x12')]);}})[_0x3208('0x15')](function(_0x1e2ec6){logger['error'](_0x3208('0xd'),_0x328e7a,_0x1e2ec6);_0x1445bc(_0x1e2ec6);});});}exports[_0x3208('0x16')]=function(_0x33a715){var _0x4ca31f=this;return new Promise(function(_0x4e48e8,_0x5f52e9){return db['FaxQueueReport']['create'](_0x33a715[_0x3208('0x17')],{'raw':_0x33a715[_0x3208('0x18')]?_0x33a715[_0x3208('0x18')][_0x3208('0x19')]===undefined?!![]:![]:!![]})[_0x3208('0xb')](function(_0x42815a){logger[_0x3208('0xc')](_0x3208('0x16'),_0x33a715);logger['debug'](_0x3208('0x16'),_0x33a715,JSON[_0x3208('0x10')](_0x42815a));_0x4e48e8(_0x42815a);})[_0x3208('0x15')](function(_0x4ec68d){logger[_0x3208('0x11')](_0x3208('0x16'),_0x4ec68d[_0x3208('0x12')],_0x33a715);_0x5f52e9(_0x4ca31f[_0x3208('0x11')](0x1f4,_0x4ec68d[_0x3208('0x12')]));});});};exports[_0x3208('0x1a')]=function(_0x41e282){var _0x36656b=this;return new Promise(function(_0x168ba0,_0x4115de){return db[_0x3208('0x1b')]['update'](_0x41e282[_0x3208('0x17')],{'raw':_0x41e282[_0x3208('0x18')]?_0x41e282[_0x3208('0x18')][_0x3208('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41e282[_0x3208('0x18')]?_0x41e282[_0x3208('0x18')][_0x3208('0x1c')]||null:null,'attributes':_0x41e282[_0x3208('0x18')]?_0x41e282[_0x3208('0x18')][_0x3208('0x1d')]||null:null,'limit':_0x41e282['options']?_0x41e282['options'][_0x3208('0x1e')]||null:null})[_0x3208('0xb')](function(_0x4f3e2d){logger[_0x3208('0xc')]('UpdateFaxQueueReport',_0x41e282);logger[_0x3208('0xe')]('UpdateFaxQueueReport',_0x41e282,JSON[_0x3208('0x10')](_0x4f3e2d));_0x168ba0(_0x4f3e2d);})[_0x3208('0x15')](function(_0x2ea021){logger['error'](_0x3208('0x1a'),_0x2ea021[_0x3208('0x12')],_0x41e282);_0x4115de(_0x36656b[_0x3208('0x11')](0x1f4,_0x2ea021[_0x3208('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c920619..d04d84d 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 _0x9052=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/:id','post','update','delete','destroy'];(function(_0x91bc47,_0xccf385){var _0x47895f=function(_0x525d67){while(--_0x525d67){_0x91bc47['push'](_0x91bc47['shift']());}};_0x47895f(++_0xccf385);}(_0x9052,0x144));var _0x2905=function(_0x10e63b,_0x4e84e2){_0x10e63b=_0x10e63b-0x0;var _0x3bef68=_0x9052[_0x10e63b];return _0x3bef68;};'use strict';var multer=require(_0x2905('0x0'));var util=require(_0x2905('0x1'));var path=require(_0x2905('0x2'));var timeout=require(_0x2905('0x3'));var express=require(_0x2905('0x4'));var router=express[_0x2905('0x5')]();var fs_extra=require(_0x2905('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2905('0x7'));var controller=require(_0x2905('0x8'));router[_0x2905('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x2905('0xa')](),controller['describe']);router[_0x2905('0x9')](_0x2905('0xb'),auth[_0x2905('0xa')](),controller['show']);router[_0x2905('0xc')]('/',auth[_0x2905('0xa')](),controller['create']);router['put'](_0x2905('0xb'),auth[_0x2905('0xa')](),controller[_0x2905('0xd')]);router[_0x2905('0xe')](_0x2905('0xb'),auth[_0x2905('0xa')](),controller[_0x2905('0xf')]);module[_0x2905('0x10')]=router; \ No newline at end of file +var _0xc073=['Router','fs-extra','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','express'];(function(_0x156b4a,_0x236e4c){var _0x8ada68=function(_0x4389f3){while(--_0x4389f3){_0x156b4a['push'](_0x156b4a['shift']());}};_0x8ada68(++_0x236e4c);}(_0xc073,0x1dd));var _0x3c07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc073[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3c07('0x0'));var util=require('util');var path=require(_0x3c07('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c07('0x2'));var router=express[_0x3c07('0x3')]();var fs_extra=require(_0x3c07('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3c07('0x5'));var controller=require(_0x3c07('0x6'));router[_0x3c07('0x7')]('/',auth[_0x3c07('0x8')](),controller[_0x3c07('0x9')]);router['get'](_0x3c07('0xa'),auth[_0x3c07('0x8')](),controller[_0x3c07('0xb')]);router['get'](_0x3c07('0xc'),auth[_0x3c07('0x8')](),controller[_0x3c07('0xd')]);router[_0x3c07('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3c07('0xf')]('/:id',auth[_0x3c07('0x8')](),controller[_0x3c07('0x10')]);router[_0x3c07('0x11')](_0x3c07('0xc'),auth[_0x3c07('0x8')](),controller[_0x3c07('0x12')]);module[_0x3c07('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 2b26a02..4228372 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5422f3,_0x3095b9){var _0x1c1221=function(_0x238410){while(--_0x238410){_0x5422f3['push'](_0x5422f3['shift']());}};_0x1c1221(++_0x3095b9);}(_0x00bb,0x1d8));var _0xb00b=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x00bb[_0x30ae5e];return _0x1f2e93;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index cdd6c8b..687886f 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 _0x5b23=['create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','FaxTransferReport','includeAll','findAll','rows','params','include','find','catch'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5b23,0x170));var _0x35b2=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0x5b23[_0x2962b4];return _0x411b7d;};'use strict';var emlformat=require(_0x35b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x35b2('0x1'));var jsonpatch=require(_0x35b2('0x2'));var rp=require('request-promise');var moment=require(_0x35b2('0x3'));var BPromise=require(_0x35b2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x35b2('0x5'));var csv=require(_0x35b2('0x6'));var ejs=require(_0x35b2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35b2('0x8'));var squel=require(_0x35b2('0x9'));var crypto=require(_0x35b2('0xa'));var jsforce=require(_0x35b2('0xb'));var deskjs=require(_0x35b2('0xc'));var toCsv=require(_0x35b2('0x6'));var querystring=require(_0x35b2('0xd'));var Papa=require(_0x35b2('0xe'));var Redis=require(_0x35b2('0xf'));var authService=require(_0x35b2('0x10'));var qs=require(_0x35b2('0x11'));var as=require(_0x35b2('0x12'));var hardwareService=require(_0x35b2('0x13'));var logger=require(_0x35b2('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x35b2('0x15'));var licenseUtil=require(_0x35b2('0x16'));var db=require(_0x35b2('0x17'))['db'];function respondWithStatusCode(_0x9df668,_0x1498fc){_0x1498fc=_0x1498fc||0xcc;return function(_0x26f6c8){if(_0x26f6c8){return _0x9df668[_0x35b2('0x18')](_0x1498fc);}return _0x9df668[_0x35b2('0x19')](_0x1498fc)[_0x35b2('0x1a')]();};}function respondWithResult(_0xa4666c,_0x1d911b){_0x1d911b=_0x1d911b||0xc8;return function(_0x197c89){if(_0x197c89){return _0xa4666c['status'](_0x1d911b)[_0x35b2('0x1b')](_0x197c89);}};}function respondWithFilteredResult(_0x20a13b,_0x11394b){return function(_0xb742b8){if(_0xb742b8){var _0x3575b6=typeof _0x11394b[_0x35b2('0x1c')]==='undefined'&&typeof _0x11394b[_0x35b2('0x1d')]===_0x35b2('0x1e');var _0x3e2d69=_0xb742b8[_0x35b2('0x1f')];var _0x1f812a=_0x3575b6?0x0:_0x11394b[_0x35b2('0x1c')];var _0x4ee262=_0x3575b6?_0xb742b8['count']:_0x11394b[_0x35b2('0x1c')]+_0x11394b['limit'];var _0x4d9df4;if(_0x4ee262>=_0x3e2d69){_0x4ee262=_0x3e2d69;_0x4d9df4=0xc8;}else{_0x4d9df4=0xce;}_0x20a13b['status'](_0x4d9df4);return _0x20a13b[_0x35b2('0x20')](_0x35b2('0x21'),_0x1f812a+'-'+_0x4ee262+'/'+_0x3e2d69)['json'](_0xb742b8);}return null;};}function patchUpdates(_0x17534f){return function(_0x445e17){try{jsonpatch['apply'](_0x445e17,_0x17534f,!![]);}catch(_0x56034c){return BPromise[_0x35b2('0x22')](_0x56034c);}return _0x445e17[_0x35b2('0x23')]();};}function saveUpdates(_0x1f5fad,_0x1b5630){return function(_0x45e43d){if(_0x45e43d){return _0x45e43d['update'](_0x1f5fad)[_0x35b2('0x24')](function(_0x23f5d3){return _0x23f5d3;});}return null;};}function removeEntity(_0x3a69ab,_0x52a474){return function(_0x5bb2eb){if(_0x5bb2eb){return _0x5bb2eb['destroy']()[_0x35b2('0x24')](function(){_0x3a69ab[_0x35b2('0x19')](0xcc)[_0x35b2('0x1a')]();});}};}function handleEntityNotFound(_0x4172d6,_0x23feec){return function(_0x41452b){if(!_0x41452b){_0x4172d6[_0x35b2('0x18')](0x194);}return _0x41452b;};}function handleError(_0xb4a5ee,_0x14901b){_0x14901b=_0x14901b||0x1f4;return function(_0x5602f2){logger[_0x35b2('0x25')](_0x5602f2[_0x35b2('0x26')]);if(_0x5602f2[_0x35b2('0x27')]){delete _0x5602f2['name'];}_0xb4a5ee['status'](_0x14901b)[_0x35b2('0x28')](_0x5602f2);};}exports[_0x35b2('0x29')]=function(_0x38e9ad,_0x72c915){var _0xf33901={},_0xa5e040={},_0xa751c1={'count':0x0,'rows':[]};var _0x4bd84b=_[_0x35b2('0x2a')](db['FaxTransferReport'][_0x35b2('0x2b')],function(_0x20ddf1){return{'name':_0x20ddf1['fieldName'],'type':_0x20ddf1[_0x35b2('0x2c')]['key']};});_0xa5e040[_0x35b2('0x2d')]=_[_0x35b2('0x2a')](_0x4bd84b,_0x35b2('0x27'));_0xa5e040[_0x35b2('0x2e')]=_[_0x35b2('0x2f')](_0x38e9ad[_0x35b2('0x2e')]);_0xa5e040[_0x35b2('0x30')]=_[_0x35b2('0x31')](_0xa5e040[_0x35b2('0x2d')],_0xa5e040[_0x35b2('0x2e')]);_0xf33901[_0x35b2('0x32')]=_[_0x35b2('0x31')](_0xa5e040[_0x35b2('0x2d')],qs['fields'](_0x38e9ad[_0x35b2('0x2e')][_0x35b2('0x33')]));_0xf33901[_0x35b2('0x32')]=_0xf33901['attributes'][_0x35b2('0x34')]?_0xf33901['attributes']:_0xa5e040['model'];if(!_0x38e9ad[_0x35b2('0x2e')][_0x35b2('0x35')](_0x35b2('0x36'))){_0xf33901[_0x35b2('0x1d')]=qs[_0x35b2('0x1d')](_0x38e9ad['query']['limit']);_0xf33901['offset']=qs[_0x35b2('0x1c')](_0x38e9ad[_0x35b2('0x2e')][_0x35b2('0x1c')]);}_0xf33901[_0x35b2('0x37')]=qs['sort'](_0x38e9ad[_0x35b2('0x2e')][_0x35b2('0x38')]);_0xf33901[_0x35b2('0x39')]=qs['filters'](_[_0x35b2('0x3a')](_0x38e9ad[_0x35b2('0x2e')],_0xa5e040[_0x35b2('0x30')]),_0x4bd84b);if(_0x38e9ad[_0x35b2('0x2e')]['filter']){_0xf33901[_0x35b2('0x39')]=_[_0x35b2('0x3b')](_0xf33901[_0x35b2('0x39')],{'$or':_['map'](_0x4bd84b,function(_0x5cb929){if(_0x5cb929['type']!=='VIRTUAL'){var _0x1f106c={};_0x1f106c[_0x5cb929[_0x35b2('0x27')]]={'$like':'%'+_0x38e9ad[_0x35b2('0x2e')][_0x35b2('0x3c')]+'%'};return _0x1f106c;}})});}_0xf33901=_['merge']({},_0xf33901,_0x38e9ad[_0x35b2('0x3d')]);var _0x56ae43={'where':_0xf33901[_0x35b2('0x39')]};return db[_0x35b2('0x3e')][_0x35b2('0x1f')](_0x56ae43)[_0x35b2('0x24')](function(_0x342da3){_0xa751c1[_0x35b2('0x1f')]=_0x342da3;if(_0x38e9ad['query'][_0x35b2('0x3f')]){_0xf33901['include']=[{'all':!![]}];}return db[_0x35b2('0x3e')][_0x35b2('0x40')](_0xf33901);})[_0x35b2('0x24')](function(_0x4b2e70){_0xa751c1[_0x35b2('0x41')]=_0x4b2e70;return _0xa751c1;})[_0x35b2('0x24')](respondWithFilteredResult(_0x72c915,_0xf33901))['catch'](handleError(_0x72c915,null));};exports['show']=function(_0x236cfc,_0x1b657a){var _0x4b4036={'raw':!![],'where':{'id':_0x236cfc[_0x35b2('0x42')]['id']}},_0x20b73f={};_0x20b73f['model']=_['keys'](db[_0x35b2('0x3e')][_0x35b2('0x2b')]);_0x20b73f[_0x35b2('0x2e')]=_[_0x35b2('0x2f')](_0x236cfc['query']);_0x20b73f[_0x35b2('0x30')]=_[_0x35b2('0x31')](_0x20b73f[_0x35b2('0x2d')],_0x20b73f[_0x35b2('0x2e')]);_0x4b4036[_0x35b2('0x32')]=_['intersection'](_0x20b73f['model'],qs[_0x35b2('0x33')](_0x236cfc[_0x35b2('0x2e')][_0x35b2('0x33')]));_0x4b4036['attributes']=_0x4b4036[_0x35b2('0x32')][_0x35b2('0x34')]?_0x4b4036['attributes']:_0x20b73f[_0x35b2('0x2d')];if(_0x236cfc['query'][_0x35b2('0x3f')]){_0x4b4036[_0x35b2('0x43')]=[{'all':!![]}];}_0x4b4036=_[_0x35b2('0x3b')]({},_0x4b4036,_0x236cfc[_0x35b2('0x3d')]);return db[_0x35b2('0x3e')][_0x35b2('0x44')](_0x4b4036)[_0x35b2('0x24')](handleEntityNotFound(_0x1b657a,null))[_0x35b2('0x24')](respondWithResult(_0x1b657a,null))[_0x35b2('0x45')](handleError(_0x1b657a,null));};exports['create']=function(_0xd37b43,_0x2fbba3){return db['FaxTransferReport'][_0x35b2('0x46')](_0xd37b43[_0x35b2('0x47')],{})['then'](respondWithResult(_0x2fbba3,0xc9))['catch'](handleError(_0x2fbba3,null));};exports['update']=function(_0x4ee1f1,_0x4f8b83){if(_0x4ee1f1['body']['id']){delete _0x4ee1f1[_0x35b2('0x47')]['id'];}return db['FaxTransferReport'][_0x35b2('0x44')]({'where':{'id':_0x4ee1f1[_0x35b2('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f8b83,null))['then'](saveUpdates(_0x4ee1f1[_0x35b2('0x47')],null))['then'](respondWithResult(_0x4f8b83,null))['catch'](handleError(_0x4f8b83,null));};exports['destroy']=function(_0x5f019e,_0x12ea99){return db[_0x35b2('0x3e')][_0x35b2('0x44')]({'where':{'id':_0x5f019e[_0x35b2('0x42')]['id']}})[_0x35b2('0x24')](handleEntityNotFound(_0x12ea99,null))[_0x35b2('0x24')](removeEntity(_0x12ea99,null))[_0x35b2('0x45')](handleError(_0x12ea99,null));};exports[_0x35b2('0x48')]=function(_0x122b06,_0x178de5){return db[_0x35b2('0x3e')][_0x35b2('0x48')]()[_0x35b2('0x24')](respondWithResult(_0x178de5,null))['catch'](handleError(_0x178de5,null));}; \ No newline at end of file +var _0x26b4=['fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','stack','name','index','FaxTransferReport','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','update','params','describe','eml-format'];(function(_0x1cc8bd,_0x24f641){var _0x2d89a2=function(_0x2aece5){while(--_0x2aece5){_0x1cc8bd['push'](_0x1cc8bd['shift']());}};_0x2d89a2(++_0x24f641);}(_0x26b4,0x153));var _0x426b=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x26b4[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0x426b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x426b('0x1'));var rp=require('request-promise');var moment=require(_0x426b('0x2'));var BPromise=require(_0x426b('0x3'));var Mustache=require(_0x426b('0x4'));var util=require(_0x426b('0x5'));var path=require(_0x426b('0x6'));var sox=require('sox');var csv=require(_0x426b('0x7'));var ejs=require(_0x426b('0x8'));var fs=require('fs');var fs_extra=require(_0x426b('0x9'));var _=require(_0x426b('0xa'));var squel=require(_0x426b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x426b('0x7'));var querystring=require(_0x426b('0xc'));var Papa=require(_0x426b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x426b('0xe'));var as=require(_0x426b('0xf'));var hardwareService=require(_0x426b('0x10'));var logger=require(_0x426b('0x11'))(_0x426b('0x12'));var utils=require(_0x426b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x426b('0x14'));var db=require(_0x426b('0x15'))['db'];function respondWithStatusCode(_0x5afabf,_0x3f4bab){_0x3f4bab=_0x3f4bab||0xcc;return function(_0x55865f){if(_0x55865f){return _0x5afabf['sendStatus'](_0x3f4bab);}return _0x5afabf[_0x426b('0x16')](_0x3f4bab)[_0x426b('0x17')]();};}function respondWithResult(_0x2f9ad9,_0x95e194){_0x95e194=_0x95e194||0xc8;return function(_0x53fe97){if(_0x53fe97){return _0x2f9ad9[_0x426b('0x16')](_0x95e194)[_0x426b('0x18')](_0x53fe97);}};}function respondWithFilteredResult(_0x596961,_0x128f9f){return function(_0x503019){if(_0x503019){var _0x5114ad=typeof _0x128f9f[_0x426b('0x19')]===_0x426b('0x1a')&&typeof _0x128f9f[_0x426b('0x1b')]===_0x426b('0x1a');var _0x5728ef=_0x503019[_0x426b('0x1c')];var _0x91ebed=_0x5114ad?0x0:_0x128f9f['offset'];var _0x5f5b4b=_0x5114ad?_0x503019[_0x426b('0x1c')]:_0x128f9f[_0x426b('0x19')]+_0x128f9f['limit'];var _0x8232f1;if(_0x5f5b4b>=_0x5728ef){_0x5f5b4b=_0x5728ef;_0x8232f1=0xc8;}else{_0x8232f1=0xce;}_0x596961[_0x426b('0x16')](_0x8232f1);return _0x596961[_0x426b('0x1d')](_0x426b('0x1e'),_0x91ebed+'-'+_0x5f5b4b+'/'+_0x5728ef)['json'](_0x503019);}return null;};}function patchUpdates(_0x2a71b2){return function(_0x159335){try{jsonpatch[_0x426b('0x1f')](_0x159335,_0x2a71b2,!![]);}catch(_0x1f909c){return BPromise[_0x426b('0x20')](_0x1f909c);}return _0x159335['save']();};}function saveUpdates(_0x5c3b08,_0x238900){return function(_0x10249a){if(_0x10249a){return _0x10249a['update'](_0x5c3b08)['then'](function(_0x3bb215){return _0x3bb215;});}return null;};}function removeEntity(_0x4c1325,_0x4bab5b){return function(_0x117544){if(_0x117544){return _0x117544[_0x426b('0x21')]()[_0x426b('0x22')](function(){_0x4c1325[_0x426b('0x16')](0xcc)[_0x426b('0x17')]();});}};}function handleEntityNotFound(_0x153ec6,_0x292dc0){return function(_0x1709ce){if(!_0x1709ce){_0x153ec6['sendStatus'](0x194);}return _0x1709ce;};}function handleError(_0x27f22d,_0x1fb132){_0x1fb132=_0x1fb132||0x1f4;return function(_0x7c8e70){logger['error'](_0x7c8e70[_0x426b('0x23')]);if(_0x7c8e70[_0x426b('0x24')]){delete _0x7c8e70[_0x426b('0x24')];}_0x27f22d[_0x426b('0x16')](_0x1fb132)['send'](_0x7c8e70);};}exports[_0x426b('0x25')]=function(_0x4ee2aa,_0x202678){var _0xe5bf9e={},_0x4c31ac={},_0x11fc42={'count':0x0,'rows':[]};var _0x527091=_['map'](db[_0x426b('0x26')]['rawAttributes'],function(_0x1017c8){return{'name':_0x1017c8['fieldName'],'type':_0x1017c8[_0x426b('0x27')][_0x426b('0x28')]};});_0x4c31ac[_0x426b('0x29')]=_['map'](_0x527091,_0x426b('0x24'));_0x4c31ac[_0x426b('0x2a')]=_[_0x426b('0x2b')](_0x4ee2aa[_0x426b('0x2a')]);_0x4c31ac['filters']=_[_0x426b('0x2c')](_0x4c31ac[_0x426b('0x29')],_0x4c31ac[_0x426b('0x2a')]);_0xe5bf9e[_0x426b('0x2d')]=_[_0x426b('0x2c')](_0x4c31ac[_0x426b('0x29')],qs[_0x426b('0x2e')](_0x4ee2aa[_0x426b('0x2a')]['fields']));_0xe5bf9e['attributes']=_0xe5bf9e['attributes'][_0x426b('0x2f')]?_0xe5bf9e[_0x426b('0x2d')]:_0x4c31ac[_0x426b('0x29')];if(!_0x4ee2aa[_0x426b('0x2a')]['hasOwnProperty'](_0x426b('0x30'))){_0xe5bf9e[_0x426b('0x1b')]=qs[_0x426b('0x1b')](_0x4ee2aa[_0x426b('0x2a')][_0x426b('0x1b')]);_0xe5bf9e[_0x426b('0x19')]=qs[_0x426b('0x19')](_0x4ee2aa[_0x426b('0x2a')][_0x426b('0x19')]);}_0xe5bf9e['order']=qs[_0x426b('0x31')](_0x4ee2aa[_0x426b('0x2a')][_0x426b('0x31')]);_0xe5bf9e[_0x426b('0x32')]=qs[_0x426b('0x33')](_['pick'](_0x4ee2aa['query'],_0x4c31ac[_0x426b('0x33')]),_0x527091);if(_0x4ee2aa['query'][_0x426b('0x34')]){_0xe5bf9e[_0x426b('0x32')]=_[_0x426b('0x35')](_0xe5bf9e[_0x426b('0x32')],{'$or':_['map'](_0x527091,function(_0x56abe6){if(_0x56abe6['type']!==_0x426b('0x36')){var _0x507517={};_0x507517[_0x56abe6[_0x426b('0x24')]]={'$like':'%'+_0x4ee2aa[_0x426b('0x2a')][_0x426b('0x34')]+'%'};return _0x507517;}})});}_0xe5bf9e=_['merge']({},_0xe5bf9e,_0x4ee2aa[_0x426b('0x37')]);var _0x483280={'where':_0xe5bf9e[_0x426b('0x32')]};return db[_0x426b('0x26')][_0x426b('0x1c')](_0x483280)[_0x426b('0x22')](function(_0x3e70df){_0x11fc42[_0x426b('0x1c')]=_0x3e70df;if(_0x4ee2aa[_0x426b('0x2a')][_0x426b('0x38')]){_0xe5bf9e[_0x426b('0x39')]=[{'all':!![]}];}return db[_0x426b('0x26')][_0x426b('0x3a')](_0xe5bf9e);})[_0x426b('0x22')](function(_0x4c097a){_0x11fc42['rows']=_0x4c097a;return _0x11fc42;})[_0x426b('0x22')](respondWithFilteredResult(_0x202678,_0xe5bf9e))[_0x426b('0x3b')](handleError(_0x202678,null));};exports[_0x426b('0x3c')]=function(_0xf3d1e2,_0x5e08c9){var _0x598cf3={'raw':!![],'where':{'id':_0xf3d1e2['params']['id']}},_0x5bf5ba={};_0x5bf5ba['model']=_[_0x426b('0x2b')](db[_0x426b('0x26')][_0x426b('0x3d')]);_0x5bf5ba[_0x426b('0x2a')]=_['keys'](_0xf3d1e2[_0x426b('0x2a')]);_0x5bf5ba[_0x426b('0x33')]=_[_0x426b('0x2c')](_0x5bf5ba['model'],_0x5bf5ba[_0x426b('0x2a')]);_0x598cf3[_0x426b('0x2d')]=_[_0x426b('0x2c')](_0x5bf5ba[_0x426b('0x29')],qs[_0x426b('0x2e')](_0xf3d1e2[_0x426b('0x2a')][_0x426b('0x2e')]));_0x598cf3['attributes']=_0x598cf3['attributes'][_0x426b('0x2f')]?_0x598cf3[_0x426b('0x2d')]:_0x5bf5ba[_0x426b('0x29')];if(_0xf3d1e2[_0x426b('0x2a')][_0x426b('0x38')]){_0x598cf3[_0x426b('0x39')]=[{'all':!![]}];}_0x598cf3=_[_0x426b('0x35')]({},_0x598cf3,_0xf3d1e2[_0x426b('0x37')]);return db[_0x426b('0x26')][_0x426b('0x3e')](_0x598cf3)[_0x426b('0x22')](handleEntityNotFound(_0x5e08c9,null))['then'](respondWithResult(_0x5e08c9,null))['catch'](handleError(_0x5e08c9,null));};exports['create']=function(_0x34a6f1,_0x4cc8d3){return db[_0x426b('0x26')][_0x426b('0x3f')](_0x34a6f1[_0x426b('0x40')],{})[_0x426b('0x22')](respondWithResult(_0x4cc8d3,0xc9))[_0x426b('0x3b')](handleError(_0x4cc8d3,null));};exports[_0x426b('0x41')]=function(_0x2ea2a5,_0x253ce8){if(_0x2ea2a5[_0x426b('0x40')]['id']){delete _0x2ea2a5[_0x426b('0x40')]['id'];}return db['FaxTransferReport'][_0x426b('0x3e')]({'where':{'id':_0x2ea2a5[_0x426b('0x42')]['id']}})['then'](handleEntityNotFound(_0x253ce8,null))[_0x426b('0x22')](saveUpdates(_0x2ea2a5[_0x426b('0x40')],null))[_0x426b('0x22')](respondWithResult(_0x253ce8,null))['catch'](handleError(_0x253ce8,null));};exports[_0x426b('0x21')]=function(_0x4c8d54,_0x28923d){return db[_0x426b('0x26')]['find']({'where':{'id':_0x4c8d54[_0x426b('0x42')]['id']}})[_0x426b('0x22')](handleEntityNotFound(_0x28923d,null))[_0x426b('0x22')](removeEntity(_0x28923d,null))['catch'](handleError(_0x28923d,null));};exports['describe']=function(_0x2de5bd,_0x1ea64a){return db[_0x426b('0x26')][_0x426b('0x43')]()['then'](respondWithResult(_0x1ea64a,null))[_0x426b('0x3b')](handleError(_0x1ea64a,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 991ce86..aa930cd 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 _0x9e3a=['FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0x9e3a,0x179));var _0xa9e3=function(_0x223103,_0xb5b190){_0x223103=_0x223103-0x0;var _0x228f4c=_0x9e3a[_0x223103];return _0x228f4c;};'use strict';var _=require(_0xa9e3('0x0'));var util=require(_0xa9e3('0x1'));var logger=require(_0xa9e3('0x2'))(_0xa9e3('0x3'));var moment=require(_0xa9e3('0x4'));var BPromise=require(_0xa9e3('0x5'));var rp=require(_0xa9e3('0x6'));var fs=require('fs');var path=require(_0xa9e3('0x7'));var rimraf=require(_0xa9e3('0x8'));var config=require(_0xa9e3('0x9'));var attributes=require(_0xa9e3('0xa'));module[_0xa9e3('0xb')]=function(_0x587536,_0x5f4909){return _0x587536[_0xa9e3('0xc')](_0xa9e3('0xd'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xa9e3('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc859=['report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xc859,0x17b));var _0x9c85=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xc859[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0x9c85('0x0'));var logger=require(_0x9c85('0x1'))(_0x9c85('0x2'));var moment=require(_0x9c85('0x3'));var BPromise=require(_0x9c85('0x4'));var rp=require(_0x9c85('0x5'));var fs=require('fs');var path=require(_0x9c85('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9c85('0x7'));module[_0x9c85('0x8')]=function(_0x355518,_0x35c7af){return _0x355518[_0x9c85('0x9')](_0x9c85('0xa'),attributes,{'tableName':_0x9c85('0xb'),'paranoid':![],'indexes':[{'name':_0x9c85('0xc'),'fields':[_0x9c85('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0d036dd..3b1c0de 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 _0x89fa=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1bc4bf,_0x1be6f3){var _0x3feb6c=function(_0x21cbc4){while(--_0x21cbc4){_0x1bc4bf['push'](_0x1bc4bf['shift']());}};_0x3feb6c(++_0x1be6f3);}(_0x89fa,0x125));var _0xa89f=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0x89fa[_0x5bb4e8];return _0x2a86f2;};'use strict';var _=require(_0xa89f('0x0'));var util=require(_0xa89f('0x1'));var moment=require(_0xa89f('0x2'));var BPromise=require(_0xa89f('0x3'));var rs=require(_0xa89f('0x4'));var fs=require('fs');var Redis=require(_0xa89f('0x5'));var db=require(_0xa89f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa89f('0x7'))(_0xa89f('0x8'));var config=require(_0xa89f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa89f('0xa')][_0xa89f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x688ec3,_0x219370,_0x16fd16){return new BPromise(function(_0x4703f3,_0x442fd1){return client[_0xa89f('0xc')](_0x688ec3,_0x16fd16)[_0xa89f('0xd')](function(_0x251540){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x219370,_0xa89f('0xe'));logger['debug'](_0xa89f('0xf'),_0x219370,'request\x20sent',JSON[_0xa89f('0x10')](_0x251540));if(_0x251540['error']){if(_0x251540['error'][_0xa89f('0x11')]===0x1f4){logger[_0xa89f('0x12')](_0xa89f('0x13'),_0x219370,_0x251540[_0xa89f('0x12')][_0xa89f('0x14')]);return _0x442fd1(_0x251540['error'][_0xa89f('0x14')]);}logger['error'](_0xa89f('0x13'),_0x219370,_0x251540[_0xa89f('0x12')][_0xa89f('0x14')]);return _0x4703f3(_0x251540[_0xa89f('0x12')][_0xa89f('0x14')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x219370,_0xa89f('0xe'));_0x4703f3(_0x251540[_0xa89f('0x15')][_0xa89f('0x14')]);}})[_0xa89f('0x16')](function(_0x590877){logger[_0xa89f('0x12')](_0xa89f('0x13'),_0x219370,_0x590877);_0x442fd1(_0x590877);});});} \ No newline at end of file +var _0x82d3=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x49d185,_0x372692){var _0x5b3627=function(_0x1e6a1c){while(--_0x1e6a1c){_0x49d185['push'](_0x49d185['shift']());}};_0x5b3627(++_0x372692);}(_0x82d3,0x166));var _0x382d=function(_0x257e48,_0x161ac3){_0x257e48=_0x257e48-0x0;var _0x101fc9=_0x82d3[_0x257e48];return _0x101fc9;};'use strict';var _=require(_0x382d('0x0'));var util=require(_0x382d('0x1'));var moment=require(_0x382d('0x2'));var BPromise=require(_0x382d('0x3'));var rs=require(_0x382d('0x4'));var fs=require('fs');var Redis=require(_0x382d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x382d('0x6'))(_0x382d('0x7'));var config=require(_0x382d('0x8'));var jayson=require(_0x382d('0x9'));var client=jayson[_0x382d('0xa')][_0x382d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16c2c1,_0x527ac6,_0x51d014){return new BPromise(function(_0x141e53,_0x26902d){return client[_0x382d('0xc')](_0x16c2c1,_0x51d014)[_0x382d('0xd')](function(_0x21c840){logger['info'](_0x382d('0xe'),_0x527ac6,_0x382d('0xf'));logger['debug'](_0x382d('0x10'),_0x527ac6,_0x382d('0xf'),JSON[_0x382d('0x11')](_0x21c840));if(_0x21c840[_0x382d('0x12')]){if(_0x21c840['error']['code']===0x1f4){logger[_0x382d('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x527ac6,_0x21c840[_0x382d('0x12')][_0x382d('0x13')]);return _0x26902d(_0x21c840['error'][_0x382d('0x13')]);}logger[_0x382d('0x12')](_0x382d('0xe'),_0x527ac6,_0x21c840['error'][_0x382d('0x13')]);return _0x141e53(_0x21c840[_0x382d('0x12')][_0x382d('0x13')]);}else{logger['info'](_0x382d('0xe'),_0x527ac6,'request\x20sent');_0x141e53(_0x21c840[_0x382d('0x14')]['message']);}})['catch'](function(_0x36330c){logger[_0x382d('0x12')](_0x382d('0xe'),_0x527ac6,_0x36330c);_0x26902d(_0x36330c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 81076bf..d4ef727 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 _0x0d8e=['isAuthenticated','/describe','describe','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxTransferReport.controller','get'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0x0d8e,0xbd));var _0xe0d8=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x0d8e[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xe0d8('0x0'));var util=require(_0xe0d8('0x1'));var path=require(_0xe0d8('0x2'));var timeout=require(_0xe0d8('0x3'));var express=require(_0xe0d8('0x4'));var router=express[_0xe0d8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe0d8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe0d8('0x7'));router[_0xe0d8('0x8')]('/',auth[_0xe0d8('0x9')](),controller['index']);router[_0xe0d8('0x8')](_0xe0d8('0xa'),auth[_0xe0d8('0x9')](),controller[_0xe0d8('0xb')]);router[_0xe0d8('0x8')](_0xe0d8('0xc'),auth[_0xe0d8('0x9')](),controller[_0xe0d8('0xd')]);router['post']('/',auth[_0xe0d8('0x9')](),controller[_0xe0d8('0xe')]);router['put'](_0xe0d8('0xc'),auth[_0xe0d8('0x9')](),controller['update']);router[_0xe0d8('0xf')](_0xe0d8('0xc'),auth[_0xe0d8('0x9')](),controller[_0xe0d8('0x10')]);module[_0xe0d8('0x11')]=router; \ No newline at end of file +var _0x3552=['post','create','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x45495d,_0x2b43cd){var _0x4b7f6f=function(_0x94dbe7){while(--_0x94dbe7){_0x45495d['push'](_0x45495d['shift']());}};_0x4b7f6f(++_0x2b43cd);}(_0x3552,0x77));var _0x2355=function(_0x3868eb,_0x30b9f6){_0x3868eb=_0x3868eb-0x0;var _0x2c80f1=_0x3552[_0x3868eb];return _0x2c80f1;};'use strict';var multer=require(_0x2355('0x0'));var util=require(_0x2355('0x1'));var path=require('path');var timeout=require(_0x2355('0x2'));var express=require(_0x2355('0x3'));var router=express[_0x2355('0x4')]();var fs_extra=require(_0x2355('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2355('0x6'));var config=require(_0x2355('0x7'));var controller=require('./faxTransferReport.controller');router[_0x2355('0x8')]('/',auth[_0x2355('0x9')](),controller[_0x2355('0xa')]);router[_0x2355('0x8')]('/describe',auth[_0x2355('0x9')](),controller[_0x2355('0xb')]);router[_0x2355('0x8')](_0x2355('0xc'),auth[_0x2355('0x9')](),controller[_0x2355('0xd')]);router[_0x2355('0xe')]('/',auth[_0x2355('0x9')](),controller[_0x2355('0xf')]);router[_0x2355('0x10')](_0x2355('0xc'),auth[_0x2355('0x9')](),controller['update']);router[_0x2355('0x11')](_0x2355('0xc'),auth[_0x2355('0x9')](),controller[_0x2355('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 840cdd7..7e76780 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 _0xcbd9=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','/:id','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xcbd9,0xc2));var _0x9cbd=function(_0xf070b8,_0x422cb5){_0xf070b8=_0xf070b8-0x0;var _0x13d884=_0xcbd9[_0xf070b8];return _0x13d884;};'use strict';var multer=require('multer');var util=require(_0x9cbd('0x0'));var path=require(_0x9cbd('0x1'));var timeout=require(_0x9cbd('0x2'));var express=require(_0x9cbd('0x3'));var router=express[_0x9cbd('0x4')]();var fs_extra=require(_0x9cbd('0x5'));var auth=require(_0x9cbd('0x6'));var interaction=require(_0x9cbd('0x7'));var config=require(_0x9cbd('0x8'));var controller=require(_0x9cbd('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9cbd('0xa')](_0x9cbd('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9cbd('0xa')](_0x9cbd('0xc'),auth[_0x9cbd('0xd')](),controller[_0x9cbd('0xe')]);router[_0x9cbd('0xa')](_0x9cbd('0xf'),auth[_0x9cbd('0xd')](),controller[_0x9cbd('0x10')]);router[_0x9cbd('0x11')]('/',auth['isAuthenticated'](),controller[_0x9cbd('0x12')]);router[_0x9cbd('0x11')](_0x9cbd('0xc'),auth[_0x9cbd('0xd')](),controller[_0x9cbd('0x13')]);router[_0x9cbd('0x14')](_0x9cbd('0xb'),auth[_0x9cbd('0xd')](),controller[_0x9cbd('0x15')]);router[_0x9cbd('0x16')](_0x9cbd('0xb'),auth[_0x9cbd('0xd')](),controller[_0x9cbd('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc139=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getFields','post','update','delete','destroy'];(function(_0x52da6d,_0x636cfc){var _0x45954b=function(_0x6b8f02){while(--_0x6b8f02){_0x52da6d['push'](_0x52da6d['shift']());}};_0x45954b(++_0x636cfc);}(_0xc139,0x1b9));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9c13('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9c13('0x1'));var express=require(_0x9c13('0x2'));var router=express[_0x9c13('0x3')]();var fs_extra=require(_0x9c13('0x4'));var auth=require(_0x9c13('0x5'));var interaction=require(_0x9c13('0x6'));var config=require(_0x9c13('0x7'));var controller=require(_0x9c13('0x8'));router[_0x9c13('0x9')]('/',auth[_0x9c13('0xa')](),controller[_0x9c13('0xb')]);router[_0x9c13('0x9')](_0x9c13('0xc'),auth[_0x9c13('0xa')](),controller['show']);router[_0x9c13('0x9')](_0x9c13('0xd'),auth[_0x9c13('0xa')](),controller['getConfigurations']);router[_0x9c13('0x9')]('/:id/fields',auth[_0x9c13('0xa')](),controller[_0x9c13('0xe')]);router[_0x9c13('0xf')]('/',auth[_0x9c13('0xa')](),controller['create']);router[_0x9c13('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x9c13('0xc'),auth['isAuthenticated'](),controller[_0x9c13('0x10')]);router[_0x9c13('0x11')](_0x9c13('0xc'),auth['isAuthenticated'](),controller[_0x9c13('0x12')]);module[_0x9c13('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 7a8cd18..6bd43c0 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 _0x93cc=['basic','newTab','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x93cc,0x129));var _0xc93c=function(_0x1249a2,_0x13d176){_0x1249a2=_0x1249a2-0x0;var _0x40de35=_0x93cc[_0x1249a2];return _0x40de35;};'use strict';var Sequelize=require(_0xc93c('0x0'));module[_0xc93c('0x1')]={'name':{'type':Sequelize[_0xc93c('0x2')]},'description':{'type':Sequelize[_0xc93c('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xc93c('0x3')](_0xc93c('0x4')),'defaultValue':_0xc93c('0x4')},'password':{'type':Sequelize[_0xc93c('0x2')]},'consumerKey':{'type':Sequelize[_0xc93c('0x2')]},'consumerSecret':{'type':Sequelize[_0xc93c('0x2')]},'token':{'type':Sequelize[_0xc93c('0x2')]},'tokenSecret':{'type':Sequelize[_0xc93c('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc93c('0x3')]('integrationTab',_0xc93c('0x5')),'defaultValue':_0xc93c('0x6')}}; \ No newline at end of file +var _0xe655=['newTab','STRING','basic','ENUM','integrationTab'];(function(_0xa452c4,_0x1ee154){var _0x5b9bbc=function(_0x4b679e){while(--_0x4b679e){_0xa452c4['push'](_0xa452c4['shift']());}};_0x5b9bbc(++_0x1ee154);}(_0xe655,0x1e1));var _0x5e65=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe655[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5e65('0x0')]},'description':{'type':Sequelize[_0x5e65('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5e65('0x0')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x5e65('0x1')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x5e65('0x0')]},'consumerSecret':{'type':Sequelize[_0x5e65('0x0')]},'token':{'type':Sequelize[_0x5e65('0x0')]},'tokenSecret':{'type':Sequelize[_0x5e65('0x0')]},'serverUrl':{'type':Sequelize[_0x5e65('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x5e65('0x2')](_0x5e65('0x3'),_0x5e65('0x4')),'defaultValue':_0x5e65('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7b7bdc9..6266110 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 _0x261f=['moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','DeskAccount','type','key','model','filters','query','attributes','intersection','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','getConfigurations','findOne','rawAttributes','order','hasOwnProperty','nolimit','AccountId','getSubjects','Descriptions','getDescriptions','channel','DeskConfiguration','DeskField','Subjects','getFields','priority','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x261f,0x16c));var _0xf261=function(_0xa29d43,_0x28870d){_0xa29d43=_0xa29d43-0x0;var _0x4ce7ec=_0x261f[_0xa29d43];return _0x4ce7ec;};'use strict';var emlformat=require(_0xf261('0x0'));var rimraf=require(_0xf261('0x1'));var zipdir=require(_0xf261('0x2'));var jsonpatch=require(_0xf261('0x3'));var rp=require(_0xf261('0x4'));var moment=require(_0xf261('0x5'));var BPromise=require(_0xf261('0x6'));var Mustache=require(_0xf261('0x7'));var util=require(_0xf261('0x8'));var path=require(_0xf261('0x9'));var sox=require(_0xf261('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf261('0xb'));var _=require(_0xf261('0xc'));var squel=require(_0xf261('0xd'));var crypto=require(_0xf261('0xe'));var jsforce=require(_0xf261('0xf'));var deskjs=require(_0xf261('0x10'));var toCsv=require(_0xf261('0x11'));var querystring=require('querystring');var Papa=require(_0xf261('0x12'));var Redis=require(_0xf261('0x13'));var authService=require(_0xf261('0x14'));var qs=require(_0xf261('0x15'));var as=require(_0xf261('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf261('0x17'))(_0xf261('0x18'));var utils=require(_0xf261('0x19'));var config=require(_0xf261('0x1a'));var licenseUtil=require(_0xf261('0x1b'));var db=require(_0xf261('0x1c'))['db'];var integrations=require(_0xf261('0x1d'));function respondWithStatusCode(_0xd44e61,_0x281c06){_0x281c06=_0x281c06||0xcc;return function(_0x4ad0cd){if(_0x4ad0cd){return _0xd44e61[_0xf261('0x1e')](_0x281c06);}return _0xd44e61[_0xf261('0x1f')](_0x281c06)[_0xf261('0x20')]();};}function respondWithResult(_0x346e49,_0x58883c){_0x58883c=_0x58883c||0xc8;return function(_0x1a0310){if(_0x1a0310){return _0x346e49['status'](_0x58883c)[_0xf261('0x21')](_0x1a0310);}};}function respondWithFilteredResult(_0x937ac6,_0x1e7bca){return function(_0xb541a2){if(_0xb541a2){var _0xbbd804=typeof _0x1e7bca['offset']===_0xf261('0x22')&&typeof _0x1e7bca['limit']===_0xf261('0x22');var _0x438808=_0xb541a2[_0xf261('0x23')];var _0x2549c8=_0xbbd804?0x0:_0x1e7bca[_0xf261('0x24')];var _0x4d7ed6=_0xbbd804?_0xb541a2[_0xf261('0x23')]:_0x1e7bca[_0xf261('0x24')]+_0x1e7bca[_0xf261('0x25')];var _0x15d1e0;if(_0x4d7ed6>=_0x438808){_0x4d7ed6=_0x438808;_0x15d1e0=0xc8;}else{_0x15d1e0=0xce;}_0x937ac6[_0xf261('0x1f')](_0x15d1e0);return _0x937ac6[_0xf261('0x26')]('Content-Range',_0x2549c8+'-'+_0x4d7ed6+'/'+_0x438808)[_0xf261('0x21')](_0xb541a2);}return null;};}function patchUpdates(_0x483d70){return function(_0x569ea1){try{jsonpatch[_0xf261('0x27')](_0x569ea1,_0x483d70,!![]);}catch(_0x2e4e20){return BPromise[_0xf261('0x28')](_0x2e4e20);}return _0x569ea1[_0xf261('0x29')]();};}function saveUpdates(_0x1a3c23,_0xbb37b){return function(_0x523c1a){if(_0x523c1a){return _0x523c1a[_0xf261('0x2a')](_0x1a3c23)[_0xf261('0x2b')](function(_0x482993){return _0x482993;});}return null;};}function removeEntity(_0x53c8ad,_0x183b9a){return function(_0x29f6aa){if(_0x29f6aa){return _0x29f6aa[_0xf261('0x2c')]()[_0xf261('0x2b')](function(){_0x53c8ad[_0xf261('0x1f')](0xcc)[_0xf261('0x20')]();});}};}function handleEntityNotFound(_0x1d402c,_0x29335d){return function(_0x1f961b){if(!_0x1f961b){_0x1d402c['sendStatus'](0x194);}return _0x1f961b;};}function handleError(_0x542cc1,_0x22e0c1){_0x22e0c1=_0x22e0c1||0x1f4;return function(_0x33992c){logger[_0xf261('0x2d')](_0x33992c[_0xf261('0x2e')]);if(_0x33992c[_0xf261('0x2f')]){delete _0x33992c[_0xf261('0x2f')];}_0x542cc1[_0xf261('0x1f')](_0x22e0c1)[_0xf261('0x30')](_0x33992c);};}exports['index']=function(_0x32d303,_0x3552ec){var _0x54b07a={},_0x3a60a8={},_0x2a7710={'count':0x0,'rows':[]};var _0x20e2f6=_[_0xf261('0x31')](db[_0xf261('0x32')]['rawAttributes'],function(_0x2a25d1){return{'name':_0x2a25d1['fieldName'],'type':_0x2a25d1[_0xf261('0x33')][_0xf261('0x34')]};});_0x3a60a8[_0xf261('0x35')]=_[_0xf261('0x31')](_0x20e2f6,_0xf261('0x2f'));_0x3a60a8['query']=_['keys'](_0x32d303['query']);_0x3a60a8[_0xf261('0x36')]=_['intersection'](_0x3a60a8['model'],_0x3a60a8[_0xf261('0x37')]);_0x54b07a[_0xf261('0x38')]=_[_0xf261('0x39')](_0x3a60a8['model'],qs[_0xf261('0x3a')](_0x32d303[_0xf261('0x37')][_0xf261('0x3a')]));_0x54b07a['attributes']=_0x54b07a[_0xf261('0x38')][_0xf261('0x3b')]?_0x54b07a[_0xf261('0x38')]:_0x3a60a8['model'];if(!_0x32d303[_0xf261('0x37')]['hasOwnProperty']('nolimit')){_0x54b07a[_0xf261('0x25')]=qs[_0xf261('0x25')](_0x32d303['query'][_0xf261('0x25')]);_0x54b07a[_0xf261('0x24')]=qs[_0xf261('0x24')](_0x32d303[_0xf261('0x37')][_0xf261('0x24')]);}_0x54b07a['order']=qs[_0xf261('0x3c')](_0x32d303[_0xf261('0x37')][_0xf261('0x3c')]);_0x54b07a[_0xf261('0x3d')]=qs[_0xf261('0x36')](_[_0xf261('0x3e')](_0x32d303[_0xf261('0x37')],_0x3a60a8[_0xf261('0x36')]),_0x20e2f6);if(_0x32d303[_0xf261('0x37')][_0xf261('0x3f')]){_0x54b07a['where']=_[_0xf261('0x40')](_0x54b07a['where'],{'$or':_[_0xf261('0x31')](_0x20e2f6,function(_0x49a533){if(_0x49a533['type']!==_0xf261('0x41')){var _0x2f0364={};_0x2f0364[_0x49a533[_0xf261('0x2f')]]={'$like':'%'+_0x32d303[_0xf261('0x37')][_0xf261('0x3f')]+'%'};return _0x2f0364;}})});}_0x54b07a=_[_0xf261('0x40')]({},_0x54b07a,_0x32d303[_0xf261('0x42')]);var _0x471c96={'where':_0x54b07a['where']};return db[_0xf261('0x32')][_0xf261('0x23')](_0x471c96)[_0xf261('0x2b')](function(_0x4e4c35){_0x2a7710[_0xf261('0x23')]=_0x4e4c35;if(_0x32d303[_0xf261('0x37')][_0xf261('0x43')]){_0x54b07a['include']=[{'all':!![]}];}return db[_0xf261('0x32')][_0xf261('0x44')](_0x54b07a);})['then'](function(_0x580dd2){_0x2a7710[_0xf261('0x45')]=_0x580dd2;return _0x2a7710;})[_0xf261('0x2b')](respondWithFilteredResult(_0x3552ec,_0x54b07a))[_0xf261('0x46')](handleError(_0x3552ec,null));};exports['show']=function(_0x117b98,_0x3b3320){var _0x55cb55={'raw':![],'where':{'id':_0x117b98[_0xf261('0x47')]['id']}},_0x82b83c={};_0x82b83c[_0xf261('0x35')]=_['keys'](db[_0xf261('0x32')]['rawAttributes']);_0x82b83c[_0xf261('0x37')]=_[_0xf261('0x48')](_0x117b98['query']);_0x82b83c[_0xf261('0x36')]=_[_0xf261('0x39')](_0x82b83c[_0xf261('0x35')],_0x82b83c[_0xf261('0x37')]);_0x55cb55[_0xf261('0x38')]=_[_0xf261('0x39')](_0x82b83c['model'],qs[_0xf261('0x3a')](_0x117b98[_0xf261('0x37')]['fields']));_0x55cb55['attributes']=_0x55cb55['attributes'][_0xf261('0x3b')]?_0x55cb55[_0xf261('0x38')]:_0x82b83c[_0xf261('0x35')];if(_0x117b98[_0xf261('0x37')][_0xf261('0x43')]){_0x55cb55[_0xf261('0x49')]=[{'all':!![]}];}_0x55cb55=_['merge']({},_0x55cb55,_0x117b98['options']);return db[_0xf261('0x32')][_0xf261('0x4a')](_0x55cb55)[_0xf261('0x2b')](handleEntityNotFound(_0x3b3320,null))[_0xf261('0x2b')](respondWithResult(_0x3b3320,null))['catch'](handleError(_0x3b3320,null));};exports[_0xf261('0x4b')]=function(_0x391d2f,_0x1f2995){return db[_0xf261('0x32')][_0xf261('0x4b')](_0x391d2f[_0xf261('0x4c')],{})[_0xf261('0x2b')](respondWithResult(_0x1f2995,0xc9))[_0xf261('0x46')](handleError(_0x1f2995,null));};exports[_0xf261('0x2a')]=function(_0x6db107,_0x4a4f7e){if(_0x6db107[_0xf261('0x4c')]['id']){delete _0x6db107[_0xf261('0x4c')]['id'];}return db[_0xf261('0x32')]['find']({'where':{'id':_0x6db107['params']['id']}})[_0xf261('0x2b')](handleEntityNotFound(_0x4a4f7e,null))[_0xf261('0x2b')](saveUpdates(_0x6db107[_0xf261('0x4c')],null))[_0xf261('0x2b')](respondWithResult(_0x4a4f7e,null))[_0xf261('0x46')](handleError(_0x4a4f7e,null));};exports['destroy']=function(_0x157c60,_0x46c72c){return db[_0xf261('0x32')][_0xf261('0x4a')]({'where':{'id':_0x157c60[_0xf261('0x47')]['id']}})[_0xf261('0x2b')](handleEntityNotFound(_0x46c72c,null))[_0xf261('0x2b')](removeEntity(_0x46c72c,null))[_0xf261('0x46')](handleError(_0x46c72c,null));};exports[_0xf261('0x4d')]=function(_0x2ae079,_0x390cc2,_0x13dd1f){var _0x54b457={};var _0x4cb060={};var _0x18c6bc;var _0x309912;return db[_0xf261('0x32')][_0xf261('0x4e')]({'where':{'id':_0x2ae079[_0xf261('0x47')]['id']}})[_0xf261('0x2b')](handleEntityNotFound(_0x390cc2,null))[_0xf261('0x2b')](function(_0x4f54a4){if(_0x4f54a4){_0x18c6bc=_0x4f54a4;_0x4cb060[_0xf261('0x35')]=_[_0xf261('0x48')](db['DeskConfiguration'][_0xf261('0x4f')]);_0x4cb060['query']=_[_0xf261('0x48')](_0x2ae079[_0xf261('0x37')]);_0x4cb060[_0xf261('0x36')]=_[_0xf261('0x39')](_0x4cb060[_0xf261('0x35')],_0x4cb060['query']);_0x54b457['attributes']=_[_0xf261('0x39')](_0x4cb060[_0xf261('0x35')],qs[_0xf261('0x3a')](_0x2ae079[_0xf261('0x37')]['fields']));_0x54b457[_0xf261('0x38')]=_0x54b457[_0xf261('0x38')]['length']?_0x54b457[_0xf261('0x38')]:_0x4cb060['model'];_0x54b457[_0xf261('0x50')]=qs[_0xf261('0x3c')](_0x2ae079['query'][_0xf261('0x3c')]);_0x54b457[_0xf261('0x3d')]=qs[_0xf261('0x36')](_['pick'](_0x2ae079['query'],_0x4cb060[_0xf261('0x36')]));if(_0x2ae079['query'][_0xf261('0x3f')]){_0x54b457[_0xf261('0x3d')]=_[_0xf261('0x40')](_0x54b457[_0xf261('0x3d')],{'$or':_[_0xf261('0x31')](_0x54b457['attributes'],function(_0x3c8b76){var _0x85e204={};_0x85e204[_0x3c8b76]={'$like':'%'+_0x2ae079['query'][_0xf261('0x3f')]+'%'};return _0x85e204;})});}_0x54b457=_[_0xf261('0x40')]({},_0x54b457,_0x2ae079[_0xf261('0x42')]);return _0x18c6bc[_0xf261('0x4d')](_0x54b457);}})[_0xf261('0x2b')](function(_0x28f0e8){if(_0x28f0e8){_0x309912=_0x28f0e8['length'];if(!_0x2ae079[_0xf261('0x37')][_0xf261('0x51')](_0xf261('0x52'))){_0x54b457[_0xf261('0x25')]=qs[_0xf261('0x25')](_0x2ae079[_0xf261('0x37')][_0xf261('0x25')]);_0x54b457[_0xf261('0x24')]=qs[_0xf261('0x24')](_0x2ae079[_0xf261('0x37')][_0xf261('0x24')]);}return _0x18c6bc[_0xf261('0x4d')](_0x54b457);}})[_0xf261('0x2b')](function(_0x47c354){if(_0x47c354){return _0x47c354?{'count':_0x309912,'rows':_0x47c354}:null;}})[_0xf261('0x2b')](respondWithResult(_0x390cc2,null))['catch'](handleError(_0x390cc2,null));};exports['addConfiguration']=function(_0x1853c0,_0xd5dd65,_0x555bf5){if(_0x1853c0[_0xf261('0x4c')]['id']){delete _0x1853c0[_0xf261('0x4c')]['id'];}return db[_0xf261('0x32')][_0xf261('0x4e')]({'where':{'id':_0x1853c0[_0xf261('0x47')]['id']}})[_0xf261('0x2b')](handleEntityNotFound(_0xd5dd65,null))[_0xf261('0x2b')](function(_0x29ca97){if(_0x29ca97){_0x1853c0[_0xf261('0x4c')][_0xf261('0x53')]=_0x29ca97['id'];_0x1853c0[_0xf261('0x4c')]['Subjects']=integrations[_0xf261('0x54')](_0x1853c0[_0xf261('0x4c')]['channel'],_0x1853c0[_0xf261('0x4c')][_0xf261('0x33')]);_0x1853c0['body'][_0xf261('0x55')]=integrations[_0xf261('0x56')](_0x1853c0[_0xf261('0x4c')][_0xf261('0x57')],_0x1853c0[_0xf261('0x4c')]['type']);return db[_0xf261('0x58')][_0xf261('0x4b')](_0x1853c0[_0xf261('0x4c')],{'include':[{'model':db[_0xf261('0x59')],'as':_0xf261('0x5a')},{'model':db['DeskField'],'as':_0xf261('0x55')}]});}return null;})['then'](respondWithResult(_0xd5dd65,null))[_0xf261('0x46')](handleError(_0xd5dd65,null));};exports[_0xf261('0x5b')]=function(_0x5537e9,_0x167134,_0x3e1ed6){var _0x3e662d=[{'name':'priority','label':_0xf261('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 _0x3eadba='';return db[_0xf261('0x32')][_0xf261('0x4e')]({'where':{'id':_0x5537e9['params']['id']},'attributes':['id','remoteUri','authType',_0xf261('0x5d'),_0xf261('0x5e'),_0xf261('0x5f'),_0xf261('0x60'),_0xf261('0x61'),_0xf261('0x62')]})[_0xf261('0x2b')](handleEntityNotFound(_0x167134,null))[_0xf261('0x2b')](function(_0x174555){if(_0x174555){_0x3eadba=_0x174555[_0xf261('0x63')];var _0x13e629=_0x3eadba[_0xf261('0x64')](-0x1);if(_0x13e629==='/'){_0x3eadba=_0x3eadba[_0xf261('0x65')](0x0,_0x3eadba[_0xf261('0x66')](_0x13e629));}var _0x842f64={'method':'GET','uri':util[_0xf261('0x67')](_0xf261('0x68'),_0x3eadba),'headers':{'Content-Type':_0xf261('0x69'),'Accept':'application/json'},'json':!![]};if(_0x174555[_0xf261('0x6a')]===_0xf261('0x6b')){_0x842f64[_0xf261('0x6c')][_0xf261('0x6d')]=util[_0xf261('0x67')](_0xf261('0x6e'),new Buffer(util[_0xf261('0x67')](_0xf261('0x6f'),_0x174555[_0xf261('0x5d')],_0x174555[_0xf261('0x5e')]))[_0xf261('0x70')](_0xf261('0x71')));}return rp(_0x842f64)['then'](function(_0x1ee01b){return _0x3e662d[_0xf261('0x72')](_['map'](_0x1ee01b[_0xf261('0x73')][_0xf261('0x74')],function(_0x52aa4d){return{'id':_0x52aa4d[_0xf261('0x2f')],'name':_0x52aa4d[_0xf261('0x2f')],'type':_0x52aa4d['type'],'active':_0x52aa4d[_0xf261('0x75')],'label':_0x52aa4d[_0xf261('0x76')],'custom':!![]};}));});}})[_0xf261('0x2b')](function(_0x14489c){return{'count':_0x14489c[_0xf261('0x3b')],'rows':_0x14489c};})[_0xf261('0x2b')](respondWithResult(_0x167134,null))['catch'](function(_0x473a4b){var _0x3d9bdc=_0x5537e9[_0xf261('0x37')]['test']?0x1f4:_0x473a4b[_0xf261('0x77')]||0x1f4;logger[_0xf261('0x2d')](_0xf261('0x78'),'getFields',_0x3d9bdc,JSON[_0xf261('0x79')](_0x473a4b));delete _0x473a4b['name'];if(_0x3d9bdc===0x191){_0x3d9bdc=0x190;}_0x167134['status'](_0x3d9bdc)['send'](_0x5537e9[_0xf261('0x37')]['test']?{'message':_0xf261('0x7a'),'statusCode':_0x473a4b[_0xf261('0x77')]}:_0x473a4b);});}; \ No newline at end of file +var _0x679a=['status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','create','body','findOne','getConfigurations','addConfiguration','Subjects','getSubjects','channel','DeskField','getFields','priority','authType','username','password','tokenSecret','remoteUri','slice','GET','application/json','headers','Authorization','format','Basic\x20%s','toString','concat','entries','label','test','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end'];(function(_0x1595ff,_0x238718){var _0x571b9d=function(_0x403228){while(--_0x403228){_0x1595ff['push'](_0x1595ff['shift']());}};_0x571b9d(++_0x238718);}(_0x679a,0x11b));var _0xa679=function(_0x4487b2,_0x432f6b){_0x4487b2=_0x4487b2-0x0;var _0x5b33a1=_0x679a[_0x4487b2];return _0x5b33a1;};'use strict';var emlformat=require(_0xa679('0x0'));var rimraf=require(_0xa679('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa679('0x2'));var rp=require(_0xa679('0x3'));var moment=require(_0xa679('0x4'));var BPromise=require(_0xa679('0x5'));var Mustache=require(_0xa679('0x6'));var util=require(_0xa679('0x7'));var path=require(_0xa679('0x8'));var sox=require(_0xa679('0x9'));var csv=require(_0xa679('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa679('0xb'));var crypto=require(_0xa679('0xc'));var jsforce=require(_0xa679('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa679('0xa'));var querystring=require(_0xa679('0xe'));var Papa=require(_0xa679('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa679('0x10'));var as=require(_0xa679('0x11'));var hardwareService=require(_0xa679('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa679('0x13'));var config=require(_0xa679('0x14'));var licenseUtil=require(_0xa679('0x15'));var db=require(_0xa679('0x16'))['db'];var integrations=require(_0xa679('0x17'));function respondWithStatusCode(_0x41dfd2,_0x34a246){_0x34a246=_0x34a246||0xcc;return function(_0x2ea954){if(_0x2ea954){return _0x41dfd2[_0xa679('0x18')](_0x34a246);}return _0x41dfd2['status'](_0x34a246)[_0xa679('0x19')]();};}function respondWithResult(_0x23ea08,_0x4f9322){_0x4f9322=_0x4f9322||0xc8;return function(_0x2308d0){if(_0x2308d0){return _0x23ea08[_0xa679('0x1a')](_0x4f9322)[_0xa679('0x1b')](_0x2308d0);}};}function respondWithFilteredResult(_0x37da42,_0x2d9a1f){return function(_0x389147){if(_0x389147){var _0x11d817=typeof _0x2d9a1f['offset']===_0xa679('0x1c')&&typeof _0x2d9a1f[_0xa679('0x1d')]==='undefined';var _0x4853e5=_0x389147[_0xa679('0x1e')];var _0x1f16cf=_0x11d817?0x0:_0x2d9a1f[_0xa679('0x1f')];var _0x2435f2=_0x11d817?_0x389147['count']:_0x2d9a1f['offset']+_0x2d9a1f[_0xa679('0x1d')];var _0x448873;if(_0x2435f2>=_0x4853e5){_0x2435f2=_0x4853e5;_0x448873=0xc8;}else{_0x448873=0xce;}_0x37da42[_0xa679('0x1a')](_0x448873);return _0x37da42[_0xa679('0x20')](_0xa679('0x21'),_0x1f16cf+'-'+_0x2435f2+'/'+_0x4853e5)[_0xa679('0x1b')](_0x389147);}return null;};}function patchUpdates(_0x30caa8){return function(_0x3b0019){try{jsonpatch[_0xa679('0x22')](_0x3b0019,_0x30caa8,!![]);}catch(_0x148176){return BPromise[_0xa679('0x23')](_0x148176);}return _0x3b0019[_0xa679('0x24')]();};}function saveUpdates(_0x575eb3,_0x22ab81){return function(_0x5794d6){if(_0x5794d6){return _0x5794d6['update'](_0x575eb3)['then'](function(_0x117457){return _0x117457;});}return null;};}function removeEntity(_0x1d1a40,_0x58c9ad){return function(_0x5613c1){if(_0x5613c1){return _0x5613c1[_0xa679('0x25')]()[_0xa679('0x26')](function(){_0x1d1a40['status'](0xcc)[_0xa679('0x19')]();});}};}function handleEntityNotFound(_0x24c28f,_0x5c0ee8){return function(_0x468a6e){if(!_0x468a6e){_0x24c28f[_0xa679('0x18')](0x194);}return _0x468a6e;};}function handleError(_0x58e073,_0x57ed72){_0x57ed72=_0x57ed72||0x1f4;return function(_0x3dfea0){logger[_0xa679('0x27')](_0x3dfea0[_0xa679('0x28')]);if(_0x3dfea0[_0xa679('0x29')]){delete _0x3dfea0[_0xa679('0x29')];}_0x58e073[_0xa679('0x1a')](_0x57ed72)[_0xa679('0x2a')](_0x3dfea0);};}exports[_0xa679('0x2b')]=function(_0x104e05,_0x2fb03c){var _0x5969cb={},_0x16a9b9={},_0x1fe19d={'count':0x0,'rows':[]};var _0xf4305d=_[_0xa679('0x2c')](db[_0xa679('0x2d')][_0xa679('0x2e')],function(_0x41bfc6){return{'name':_0x41bfc6[_0xa679('0x2f')],'type':_0x41bfc6[_0xa679('0x30')][_0xa679('0x31')]};});_0x16a9b9[_0xa679('0x32')]=_[_0xa679('0x2c')](_0xf4305d,'name');_0x16a9b9[_0xa679('0x33')]=_['keys'](_0x104e05[_0xa679('0x33')]);_0x16a9b9[_0xa679('0x34')]=_[_0xa679('0x35')](_0x16a9b9[_0xa679('0x32')],_0x16a9b9[_0xa679('0x33')]);_0x5969cb[_0xa679('0x36')]=_[_0xa679('0x35')](_0x16a9b9[_0xa679('0x32')],qs['fields'](_0x104e05['query'][_0xa679('0x37')]));_0x5969cb[_0xa679('0x36')]=_0x5969cb[_0xa679('0x36')][_0xa679('0x38')]?_0x5969cb[_0xa679('0x36')]:_0x16a9b9[_0xa679('0x32')];if(!_0x104e05[_0xa679('0x33')]['hasOwnProperty'](_0xa679('0x39'))){_0x5969cb[_0xa679('0x1d')]=qs[_0xa679('0x1d')](_0x104e05['query']['limit']);_0x5969cb[_0xa679('0x1f')]=qs['offset'](_0x104e05[_0xa679('0x33')][_0xa679('0x1f')]);}_0x5969cb[_0xa679('0x3a')]=qs[_0xa679('0x3b')](_0x104e05['query'][_0xa679('0x3b')]);_0x5969cb[_0xa679('0x3c')]=qs[_0xa679('0x34')](_[_0xa679('0x3d')](_0x104e05[_0xa679('0x33')],_0x16a9b9[_0xa679('0x34')]),_0xf4305d);if(_0x104e05[_0xa679('0x33')][_0xa679('0x3e')]){_0x5969cb['where']=_[_0xa679('0x3f')](_0x5969cb[_0xa679('0x3c')],{'$or':_[_0xa679('0x2c')](_0xf4305d,function(_0x107223){if(_0x107223[_0xa679('0x30')]!==_0xa679('0x40')){var _0x1c35a2={};_0x1c35a2[_0x107223['name']]={'$like':'%'+_0x104e05[_0xa679('0x33')][_0xa679('0x3e')]+'%'};return _0x1c35a2;}})});}_0x5969cb=_[_0xa679('0x3f')]({},_0x5969cb,_0x104e05[_0xa679('0x41')]);var _0x54c755={'where':_0x5969cb[_0xa679('0x3c')]};return db[_0xa679('0x2d')][_0xa679('0x1e')](_0x54c755)[_0xa679('0x26')](function(_0x2705ce){_0x1fe19d[_0xa679('0x1e')]=_0x2705ce;if(_0x104e05['query']['includeAll']){_0x5969cb['include']=[{'all':!![]}];}return db[_0xa679('0x2d')][_0xa679('0x42')](_0x5969cb);})[_0xa679('0x26')](function(_0x36da5c){_0x1fe19d[_0xa679('0x43')]=_0x36da5c;return _0x1fe19d;})[_0xa679('0x26')](respondWithFilteredResult(_0x2fb03c,_0x5969cb))[_0xa679('0x44')](handleError(_0x2fb03c,null));};exports[_0xa679('0x45')]=function(_0x14772b,_0x3abda5){var _0x2456fc={'raw':![],'where':{'id':_0x14772b[_0xa679('0x46')]['id']}},_0x56af17={};_0x56af17[_0xa679('0x32')]=_[_0xa679('0x47')](db['DeskAccount']['rawAttributes']);_0x56af17[_0xa679('0x33')]=_[_0xa679('0x47')](_0x14772b[_0xa679('0x33')]);_0x56af17[_0xa679('0x34')]=_[_0xa679('0x35')](_0x56af17[_0xa679('0x32')],_0x56af17[_0xa679('0x33')]);_0x2456fc['attributes']=_[_0xa679('0x35')](_0x56af17[_0xa679('0x32')],qs[_0xa679('0x37')](_0x14772b['query'][_0xa679('0x37')]));_0x2456fc[_0xa679('0x36')]=_0x2456fc[_0xa679('0x36')]['length']?_0x2456fc[_0xa679('0x36')]:_0x56af17[_0xa679('0x32')];if(_0x14772b['query'][_0xa679('0x48')]){_0x2456fc['include']=[{'all':!![]}];}_0x2456fc=_['merge']({},_0x2456fc,_0x14772b[_0xa679('0x41')]);return db[_0xa679('0x2d')]['find'](_0x2456fc)[_0xa679('0x26')](handleEntityNotFound(_0x3abda5,null))['then'](respondWithResult(_0x3abda5,null))[_0xa679('0x44')](handleError(_0x3abda5,null));};exports['create']=function(_0xc8a90,_0x594ca8){return db[_0xa679('0x2d')][_0xa679('0x49')](_0xc8a90[_0xa679('0x4a')],{})[_0xa679('0x26')](respondWithResult(_0x594ca8,0xc9))[_0xa679('0x44')](handleError(_0x594ca8,null));};exports['update']=function(_0x15a061,_0x12f827){if(_0x15a061[_0xa679('0x4a')]['id']){delete _0x15a061['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x15a061[_0xa679('0x46')]['id']}})[_0xa679('0x26')](handleEntityNotFound(_0x12f827,null))[_0xa679('0x26')](saveUpdates(_0x15a061[_0xa679('0x4a')],null))['then'](respondWithResult(_0x12f827,null))[_0xa679('0x44')](handleError(_0x12f827,null));};exports[_0xa679('0x25')]=function(_0x3a0a27,_0x3effe9){return db[_0xa679('0x2d')]['find']({'where':{'id':_0x3a0a27[_0xa679('0x46')]['id']}})[_0xa679('0x26')](handleEntityNotFound(_0x3effe9,null))[_0xa679('0x26')](removeEntity(_0x3effe9,null))[_0xa679('0x44')](handleError(_0x3effe9,null));};exports['getConfigurations']=function(_0x4e2018,_0x341a09,_0x5ee0f5){var _0x2f2bef={};var _0x21ebe2={};var _0x6a40fa;var _0x5ccec7;return db[_0xa679('0x2d')][_0xa679('0x4b')]({'where':{'id':_0x4e2018[_0xa679('0x46')]['id']}})['then'](handleEntityNotFound(_0x341a09,null))[_0xa679('0x26')](function(_0x9f3822){if(_0x9f3822){_0x6a40fa=_0x9f3822;_0x21ebe2[_0xa679('0x32')]=_[_0xa679('0x47')](db['DeskConfiguration'][_0xa679('0x2e')]);_0x21ebe2['query']=_['keys'](_0x4e2018[_0xa679('0x33')]);_0x21ebe2[_0xa679('0x34')]=_['intersection'](_0x21ebe2[_0xa679('0x32')],_0x21ebe2['query']);_0x2f2bef['attributes']=_[_0xa679('0x35')](_0x21ebe2['model'],qs[_0xa679('0x37')](_0x4e2018[_0xa679('0x33')][_0xa679('0x37')]));_0x2f2bef[_0xa679('0x36')]=_0x2f2bef[_0xa679('0x36')]['length']?_0x2f2bef[_0xa679('0x36')]:_0x21ebe2['model'];_0x2f2bef[_0xa679('0x3a')]=qs[_0xa679('0x3b')](_0x4e2018[_0xa679('0x33')][_0xa679('0x3b')]);_0x2f2bef[_0xa679('0x3c')]=qs[_0xa679('0x34')](_[_0xa679('0x3d')](_0x4e2018[_0xa679('0x33')],_0x21ebe2[_0xa679('0x34')]));if(_0x4e2018['query'][_0xa679('0x3e')]){_0x2f2bef[_0xa679('0x3c')]=_['merge'](_0x2f2bef[_0xa679('0x3c')],{'$or':_[_0xa679('0x2c')](_0x2f2bef[_0xa679('0x36')],function(_0x5cea4f){var _0x3c765f={};_0x3c765f[_0x5cea4f]={'$like':'%'+_0x4e2018['query']['filter']+'%'};return _0x3c765f;})});}_0x2f2bef=_[_0xa679('0x3f')]({},_0x2f2bef,_0x4e2018[_0xa679('0x41')]);return _0x6a40fa['getConfigurations'](_0x2f2bef);}})[_0xa679('0x26')](function(_0x118c50){if(_0x118c50){_0x5ccec7=_0x118c50[_0xa679('0x38')];if(!_0x4e2018[_0xa679('0x33')]['hasOwnProperty'](_0xa679('0x39'))){_0x2f2bef[_0xa679('0x1d')]=qs[_0xa679('0x1d')](_0x4e2018[_0xa679('0x33')][_0xa679('0x1d')]);_0x2f2bef['offset']=qs[_0xa679('0x1f')](_0x4e2018['query'][_0xa679('0x1f')]);}return _0x6a40fa[_0xa679('0x4c')](_0x2f2bef);}})[_0xa679('0x26')](function(_0xbf906f){if(_0xbf906f){return _0xbf906f?{'count':_0x5ccec7,'rows':_0xbf906f}:null;}})[_0xa679('0x26')](respondWithResult(_0x341a09,null))['catch'](handleError(_0x341a09,null));};exports[_0xa679('0x4d')]=function(_0x593a87,_0x15ca4b,_0x78d2a9){if(_0x593a87[_0xa679('0x4a')]['id']){delete _0x593a87[_0xa679('0x4a')]['id'];}return db[_0xa679('0x2d')]['findOne']({'where':{'id':_0x593a87[_0xa679('0x46')]['id']}})['then'](handleEntityNotFound(_0x15ca4b,null))[_0xa679('0x26')](function(_0x3d9f10){if(_0x3d9f10){_0x593a87[_0xa679('0x4a')]['AccountId']=_0x3d9f10['id'];_0x593a87[_0xa679('0x4a')][_0xa679('0x4e')]=integrations[_0xa679('0x4f')](_0x593a87[_0xa679('0x4a')][_0xa679('0x50')],_0x593a87[_0xa679('0x4a')][_0xa679('0x30')]);_0x593a87[_0xa679('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x593a87[_0xa679('0x4a')]['channel'],_0x593a87[_0xa679('0x4a')]['type']);return db['DeskConfiguration'][_0xa679('0x49')](_0x593a87[_0xa679('0x4a')],{'include':[{'model':db['DeskField'],'as':_0xa679('0x4e')},{'model':db[_0xa679('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x15ca4b,null))[_0xa679('0x44')](handleError(_0x15ca4b,null));};exports[_0xa679('0x52')]=function(_0x1ea010,_0x255c8c,_0x1aefb3){var _0x2c60e2=[{'name':_0xa679('0x53'),'label':_0xa679('0x53'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4c709b='';return db[_0xa679('0x2d')][_0xa679('0x4b')]({'where':{'id':_0x1ea010[_0xa679('0x46')]['id']},'attributes':['id','remoteUri',_0xa679('0x54'),_0xa679('0x55'),_0xa679('0x56'),'consumerKey','consumerSecret','token',_0xa679('0x57')]})[_0xa679('0x26')](handleEntityNotFound(_0x255c8c,null))[_0xa679('0x26')](function(_0x4e40cb){if(_0x4e40cb){_0x4c709b=_0x4e40cb[_0xa679('0x58')];var _0x3b9707=_0x4c709b[_0xa679('0x59')](-0x1);if(_0x3b9707==='/'){_0x4c709b=_0x4c709b['substring'](0x0,_0x4c709b['lastIndexOf'](_0x3b9707));}var _0x5527d7={'method':_0xa679('0x5a'),'uri':util['format']('%s/custom_fields',_0x4c709b),'headers':{'Content-Type':_0xa679('0x5b'),'Accept':_0xa679('0x5b')},'json':!![]};if(_0x4e40cb['authType']==='basic'){_0x5527d7[_0xa679('0x5c')][_0xa679('0x5d')]=util[_0xa679('0x5e')](_0xa679('0x5f'),new Buffer(util['format']('%s:%s',_0x4e40cb['username'],_0x4e40cb['password']))[_0xa679('0x60')]('base64'));}return rp(_0x5527d7)[_0xa679('0x26')](function(_0x2f70e3){return _0x2c60e2[_0xa679('0x61')](_['map'](_0x2f70e3['_embedded'][_0xa679('0x62')],function(_0x32e94a){return{'id':_0x32e94a[_0xa679('0x29')],'name':_0x32e94a['name'],'type':_0x32e94a[_0xa679('0x30')],'active':_0x32e94a['active'],'label':_0x32e94a[_0xa679('0x63')],'custom':!![]};}));});}})[_0xa679('0x26')](function(_0x5c7112){return{'count':_0x5c7112[_0xa679('0x38')],'rows':_0x5c7112};})['then'](respondWithResult(_0x255c8c,null))[_0xa679('0x44')](function(_0x2169bd){var _0x4fa130=_0x1ea010['query'][_0xa679('0x64')]?0x1f4:_0x2169bd['statusCode']||0x1f4;logger[_0xa679('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xa679('0x52'),_0x4fa130,JSON['stringify'](_0x2169bd));delete _0x2169bd[_0xa679('0x29')];if(_0x4fa130===0x191){_0x4fa130=0x190;}_0x255c8c[_0xa679('0x1a')](_0x4fa130)[_0xa679('0x2a')](_0x1ea010['query'][_0xa679('0x64')]?{'message':_0xa679('0x65'),'statusCode':_0x2169bd[_0xa679('0x66')]}:_0x2169bd);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 92c13f3..7973371 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 _0xffaa=['define','DeskAccount','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x33efcc,_0x2ebf86){var _0x2e9f19=function(_0x44d9e4){while(--_0x44d9e4){_0x33efcc['push'](_0x33efcc['shift']());}};_0x2e9f19(++_0x2ebf86);}(_0xffaa,0x6e));var _0xaffa=function(_0x6e1277,_0x470849){_0x6e1277=_0x6e1277-0x0;var _0x193cd1=_0xffaa[_0x6e1277];return _0x193cd1;};'use strict';var _=require('lodash');var util=require(_0xaffa('0x0'));var logger=require(_0xaffa('0x1'))(_0xaffa('0x2'));var moment=require('moment');var BPromise=require(_0xaffa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaffa('0x4'));var rimraf=require(_0xaffa('0x5'));var config=require(_0xaffa('0x6'));var attributes=require(_0xaffa('0x7'));var integrations=require(_0xaffa('0x8'));module[_0xaffa('0x9')]=function(_0x60366,_0x437b2a){return _0x60366[_0xaffa('0xa')](_0xaffa('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa351=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a397d,_0x5bab1f){var _0x316571=function(_0xa6d65a){while(--_0xa6d65a){_0x4a397d['push'](_0x4a397d['shift']());}};_0x316571(++_0x5bab1f);}(_0xa351,0xa9));var _0x1a35=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa351[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1a35('0x0'));var util=require(_0x1a35('0x1'));var logger=require(_0x1a35('0x2'))(_0x1a35('0x3'));var moment=require(_0x1a35('0x4'));var BPromise=require(_0x1a35('0x5'));var rp=require(_0x1a35('0x6'));var fs=require('fs');var path=require(_0x1a35('0x7'));var rimraf=require(_0x1a35('0x8'));var config=require(_0x1a35('0x9'));var attributes=require(_0x1a35('0xa'));var integrations=require(_0x1a35('0xb'));module[_0x1a35('0xc')]=function(_0x49b040,_0x1df56d){return _0x49b040[_0x1a35('0xd')](_0x1a35('0xe'),attributes,{'tableName':_0x1a35('0xf'),'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 5b7ba92..3d887ad 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 _0x4057=['GetDeskAccount','DeskAccount','options','where','attributes','limit','include','map','model','catch','ShowDeskAccount','find','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x48d2f2,_0x3af336){var _0x3affe8=function(_0x4c11cd){while(--_0x4c11cd){_0x48d2f2['push'](_0x48d2f2['shift']());}};_0x3affe8(++_0x3af336);}(_0x4057,0x70));var _0x7405=function(_0x302f55,_0x31872f){_0x302f55=_0x302f55-0x0;var _0x55ca94=_0x4057[_0x302f55];return _0x55ca94;};'use strict';var _=require('lodash');var util=require(_0x7405('0x0'));var moment=require('moment');var BPromise=require(_0x7405('0x1'));var rs=require(_0x7405('0x2'));var fs=require('fs');var Redis=require(_0x7405('0x3'));var db=require(_0x7405('0x4'))['db'];var utils=require(_0x7405('0x5'));var logger=require(_0x7405('0x6'))(_0x7405('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7405('0x8')][_0x7405('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46d6a7,_0x5d8962,_0x442074){return new BPromise(function(_0x509dd3,_0x55f6e7){return client['request'](_0x46d6a7,_0x442074)[_0x7405('0xa')](function(_0x37e012){logger[_0x7405('0xb')](_0x7405('0xc'),_0x5d8962,_0x7405('0xd'));logger[_0x7405('0xe')](_0x7405('0xf'),_0x5d8962,_0x7405('0xd'),JSON[_0x7405('0x10')](_0x37e012));if(_0x37e012[_0x7405('0x11')]){if(_0x37e012[_0x7405('0x11')][_0x7405('0x12')]===0x1f4){logger['error'](_0x7405('0xc'),_0x5d8962,_0x37e012['error'][_0x7405('0x13')]);return _0x55f6e7(_0x37e012[_0x7405('0x11')][_0x7405('0x13')]);}logger[_0x7405('0x11')]('DeskAccount,\x20%s,\x20%s',_0x5d8962,_0x37e012['error'][_0x7405('0x13')]);return _0x509dd3(_0x37e012[_0x7405('0x11')]['message']);}else{logger[_0x7405('0xb')](_0x7405('0xc'),_0x5d8962,_0x7405('0xd'));_0x509dd3(_0x37e012['result']['message']);}})['catch'](function(_0x2df732){logger[_0x7405('0x11')](_0x7405('0xc'),_0x5d8962,_0x2df732);_0x55f6e7(_0x2df732);});});}exports[_0x7405('0x14')]=function(_0x3ebf83){var _0x5da357=this;return new Promise(function(_0xd82919,_0x3c3306){return db[_0x7405('0x15')]['findAll']({'raw':_0x3ebf83[_0x7405('0x16')]?_0x3ebf83[_0x7405('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3ebf83[_0x7405('0x16')]?_0x3ebf83[_0x7405('0x16')][_0x7405('0x17')]||null:null,'attributes':_0x3ebf83[_0x7405('0x16')]?_0x3ebf83[_0x7405('0x16')][_0x7405('0x18')]||null:null,'limit':_0x3ebf83[_0x7405('0x16')]?_0x3ebf83['options'][_0x7405('0x19')]||null:null,'include':_0x3ebf83[_0x7405('0x16')]?_0x3ebf83[_0x7405('0x16')][_0x7405('0x1a')]?_[_0x7405('0x1b')](_0x3ebf83[_0x7405('0x16')][_0x7405('0x1a')],function(_0x1f7e43){return{'model':db[_0x1f7e43[_0x7405('0x1c')]],'as':_0x1f7e43['as'],'attributes':_0x1f7e43[_0x7405('0x18')],'include':_0x1f7e43[_0x7405('0x1a')]?_['map'](_0x1f7e43[_0x7405('0x1a')],function(_0x130363){return{'model':db[_0x130363[_0x7405('0x1c')]],'as':_0x130363['as'],'attributes':_0x130363[_0x7405('0x18')],'include':_0x130363[_0x7405('0x1a')]?_[_0x7405('0x1b')](_0x130363[_0x7405('0x1a')],function(_0x33b1b3){return{'model':db[_0x33b1b3[_0x7405('0x1c')]],'as':_0x33b1b3['as'],'attributes':_0x33b1b3[_0x7405('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7405('0xa')](function(_0xfd2e9b){logger[_0x7405('0xb')](_0x7405('0x14'),_0x3ebf83);logger['debug']('GetDeskAccount',_0x3ebf83,JSON[_0x7405('0x10')](_0xfd2e9b));_0xd82919(_0xfd2e9b);})[_0x7405('0x1d')](function(_0x20e88a){logger[_0x7405('0x11')]('GetDeskAccount',_0x20e88a[_0x7405('0x13')],_0x3ebf83);_0x3c3306(_0x5da357[_0x7405('0x11')](0x1f4,_0x20e88a[_0x7405('0x13')]));});});};exports[_0x7405('0x1e')]=function(_0x1db109){var _0x595955=this;return new Promise(function(_0x4eff35,_0x544373){return db['DeskAccount'][_0x7405('0x1f')]({'raw':_0x1db109[_0x7405('0x16')]?_0x1db109[_0x7405('0x16')][_0x7405('0x20')]===undefined?!![]:![]:!![],'where':_0x1db109[_0x7405('0x16')]?_0x1db109[_0x7405('0x16')][_0x7405('0x17')]||null:null,'attributes':_0x1db109[_0x7405('0x16')]?_0x1db109[_0x7405('0x16')][_0x7405('0x18')]||null:null,'include':_0x1db109['options']?_0x1db109[_0x7405('0x16')][_0x7405('0x1a')]?_[_0x7405('0x1b')](_0x1db109[_0x7405('0x16')][_0x7405('0x1a')],function(_0x1a0052){return{'model':db[_0x1a0052[_0x7405('0x1c')]],'as':_0x1a0052['as'],'attributes':_0x1a0052[_0x7405('0x18')],'include':_0x1a0052['include']?_['map'](_0x1a0052['include'],function(_0x15453a){return{'model':db[_0x15453a[_0x7405('0x1c')]],'as':_0x15453a['as'],'attributes':_0x15453a['attributes'],'include':_0x15453a[_0x7405('0x1a')]?_[_0x7405('0x1b')](_0x15453a[_0x7405('0x1a')],function(_0x16162e){return{'model':db[_0x16162e[_0x7405('0x1c')]],'as':_0x16162e['as'],'attributes':_0x16162e[_0x7405('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7405('0xa')](function(_0x4c758c){logger['info'](_0x7405('0x1e'),_0x1db109);logger['debug'](_0x7405('0x1e'),_0x1db109,JSON[_0x7405('0x10')](_0x4c758c));_0x4eff35(_0x4c758c);})[_0x7405('0x1d')](function(_0x1411b1){logger[_0x7405('0x11')]('ShowDeskAccount',_0x1411b1[_0x7405('0x13')],_0x1db109);_0x544373(_0x595955['error'](0x1f4,_0x1411b1[_0x7405('0x13')]));});});}; \ No newline at end of file +var _0x17db=['jayson/promise','client','http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','DeskAccount','findAll','options','raw','limit','map','include','model','attributes','GetDeskAccount','ShowDeskAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x44b533,_0x221c8d){var _0x42325b=function(_0x309350){while(--_0x309350){_0x44b533['push'](_0x44b533['shift']());}};_0x42325b(++_0x221c8d);}(_0x17db,0x179));var _0xb17d=function(_0x153bea,_0x25672c){_0x153bea=_0x153bea-0x0;var _0x312d1d=_0x17db[_0x153bea];return _0x312d1d;};'use strict';var _=require(_0xb17d('0x0'));var util=require(_0xb17d('0x1'));var moment=require('moment');var BPromise=require(_0xb17d('0x2'));var rs=require(_0xb17d('0x3'));var fs=require('fs');var Redis=require(_0xb17d('0x4'));var db=require(_0xb17d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb17d('0x6'))('rpc');var config=require(_0xb17d('0x7'));var jayson=require(_0xb17d('0x8'));var client=jayson[_0xb17d('0x9')][_0xb17d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf71d,_0x414c2f,_0x11199c){return new BPromise(function(_0x48c8c4,_0x39a7ae){return client['request'](_0x2bf71d,_0x11199c)[_0xb17d('0xb')](function(_0x11b29b){logger[_0xb17d('0xc')]('DeskAccount,\x20%s,\x20%s',_0x414c2f,_0xb17d('0xd'));logger[_0xb17d('0xe')](_0xb17d('0xf'),_0x414c2f,'request\x20sent',JSON[_0xb17d('0x10')](_0x11b29b));if(_0x11b29b['error']){if(_0x11b29b[_0xb17d('0x11')][_0xb17d('0x12')]===0x1f4){logger[_0xb17d('0x11')](_0xb17d('0x13'),_0x414c2f,_0x11b29b[_0xb17d('0x11')][_0xb17d('0x14')]);return _0x39a7ae(_0x11b29b[_0xb17d('0x11')][_0xb17d('0x14')]);}logger[_0xb17d('0x11')](_0xb17d('0x13'),_0x414c2f,_0x11b29b['error'][_0xb17d('0x14')]);return _0x48c8c4(_0x11b29b[_0xb17d('0x11')][_0xb17d('0x14')]);}else{logger[_0xb17d('0xc')](_0xb17d('0x13'),_0x414c2f,_0xb17d('0xd'));_0x48c8c4(_0x11b29b['result'][_0xb17d('0x14')]);}})[_0xb17d('0x15')](function(_0x4425e1){logger[_0xb17d('0x11')]('DeskAccount,\x20%s,\x20%s',_0x414c2f,_0x4425e1);_0x39a7ae(_0x4425e1);});});}exports['GetDeskAccount']=function(_0x26d422){var _0x4ecafd=this;return new Promise(function(_0x1585dd,_0x131ce0){return db[_0xb17d('0x16')][_0xb17d('0x17')]({'raw':_0x26d422['options']?_0x26d422[_0xb17d('0x18')][_0xb17d('0x19')]===undefined?!![]:![]:!![],'where':_0x26d422[_0xb17d('0x18')]?_0x26d422[_0xb17d('0x18')]['where']||null:null,'attributes':_0x26d422[_0xb17d('0x18')]?_0x26d422[_0xb17d('0x18')]['attributes']||null:null,'limit':_0x26d422[_0xb17d('0x18')]?_0x26d422[_0xb17d('0x18')][_0xb17d('0x1a')]||null:null,'include':_0x26d422[_0xb17d('0x18')]?_0x26d422[_0xb17d('0x18')]['include']?_[_0xb17d('0x1b')](_0x26d422[_0xb17d('0x18')][_0xb17d('0x1c')],function(_0x160799){return{'model':db[_0x160799[_0xb17d('0x1d')]],'as':_0x160799['as'],'attributes':_0x160799[_0xb17d('0x1e')],'include':_0x160799[_0xb17d('0x1c')]?_[_0xb17d('0x1b')](_0x160799[_0xb17d('0x1c')],function(_0x3e23a4){return{'model':db[_0x3e23a4[_0xb17d('0x1d')]],'as':_0x3e23a4['as'],'attributes':_0x3e23a4[_0xb17d('0x1e')],'include':_0x3e23a4[_0xb17d('0x1c')]?_[_0xb17d('0x1b')](_0x3e23a4[_0xb17d('0x1c')],function(_0x200246){return{'model':db[_0x200246[_0xb17d('0x1d')]],'as':_0x200246['as'],'attributes':_0x200246[_0xb17d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb17d('0xb')](function(_0x54925b){logger[_0xb17d('0xc')](_0xb17d('0x1f'),_0x26d422);logger[_0xb17d('0xe')](_0xb17d('0x1f'),_0x26d422,JSON[_0xb17d('0x10')](_0x54925b));_0x1585dd(_0x54925b);})[_0xb17d('0x15')](function(_0x10d8de){logger[_0xb17d('0x11')](_0xb17d('0x1f'),_0x10d8de['message'],_0x26d422);_0x131ce0(_0x4ecafd[_0xb17d('0x11')](0x1f4,_0x10d8de[_0xb17d('0x14')]));});});};exports[_0xb17d('0x20')]=function(_0x45b3c0){var _0x348960=this;return new Promise(function(_0x135841,_0x2d3e5e){return db['DeskAccount'][_0xb17d('0x21')]({'raw':_0x45b3c0[_0xb17d('0x18')]?_0x45b3c0['options'][_0xb17d('0x19')]===undefined?!![]:![]:!![],'where':_0x45b3c0[_0xb17d('0x18')]?_0x45b3c0[_0xb17d('0x18')][_0xb17d('0x22')]||null:null,'attributes':_0x45b3c0[_0xb17d('0x18')]?_0x45b3c0[_0xb17d('0x18')][_0xb17d('0x1e')]||null:null,'include':_0x45b3c0[_0xb17d('0x18')]?_0x45b3c0['options'][_0xb17d('0x1c')]?_[_0xb17d('0x1b')](_0x45b3c0['options'][_0xb17d('0x1c')],function(_0x2984b9){return{'model':db[_0x2984b9[_0xb17d('0x1d')]],'as':_0x2984b9['as'],'attributes':_0x2984b9[_0xb17d('0x1e')],'include':_0x2984b9[_0xb17d('0x1c')]?_['map'](_0x2984b9['include'],function(_0xae4387){return{'model':db[_0xae4387[_0xb17d('0x1d')]],'as':_0xae4387['as'],'attributes':_0xae4387[_0xb17d('0x1e')],'include':_0xae4387['include']?_[_0xb17d('0x1b')](_0xae4387[_0xb17d('0x1c')],function(_0x2c4c7f){return{'model':db[_0x2c4c7f[_0xb17d('0x1d')]],'as':_0x2c4c7f['as'],'attributes':_0x2c4c7f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb17d('0xb')](function(_0x4ff4fd){logger['info'](_0xb17d('0x20'),_0x45b3c0);logger[_0xb17d('0xe')]('ShowDeskAccount',_0x45b3c0,JSON['stringify'](_0x4ff4fd));_0x135841(_0x4ff4fd);})[_0xb17d('0x15')](function(_0x2de3a4){logger['error'](_0xb17d('0x20'),_0x2de3a4[_0xb17d('0x14')],_0x45b3c0);_0x2d3e5e(_0x348960[_0xb17d('0x11')](0x1f4,_0x2de3a4[_0xb17d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 42cee16..b0694ef 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x244499,_0xc82d12){var _0x277307=function(_0x1c3fa4){while(--_0x1c3fa4){_0x244499['push'](_0x244499['shift']());}};_0x277307(++_0xc82d12);}(_0x008c,0x188));var _0xc008=function(_0x2f21c6,_0x51de35){_0x2f21c6=_0x2f21c6-0x0;var _0x32cbd5=_0x008c[_0x2f21c6];return _0x32cbd5;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x5fe69a,_0x5484f5){var _0x3f1aee=function(_0x54387f){while(--_0x54387f){_0x5fe69a['push'](_0x5fe69a['shift']());}};_0x3f1aee(++_0x5484f5);}(_0x55ca,0x126));var _0xa55c=function(_0x43bc0e,_0x18864e){_0x43bc0e=_0x43bc0e-0x0;var _0x5b4081=_0x55ca[_0x43bc0e];return _0x5b4081;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d32eeb6..d728359 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 _0x6879=['sequelize','exports','STRING'];(function(_0x25178d,_0x1df59d){var _0x19b8d8=function(_0x36c0c3){while(--_0x36c0c3){_0x25178d['push'](_0x25178d['shift']());}};_0x19b8d8(++_0x1df59d);}(_0x6879,0x1e0));var _0x9687=function(_0x4c4edf,_0x27d7d4){_0x4c4edf=_0x4c4edf-0x0;var _0x18f501=_0x6879[_0x4c4edf];return _0x18f501;};'use strict';var Sequelize=require(_0x9687('0x0'));module[_0x9687('0x1')]={'name':{'type':Sequelize[_0x9687('0x2')]},'description':{'type':Sequelize[_0x9687('0x2')]}}; \ No newline at end of file +var _0xeff7=['STRING','exports'];(function(_0x5afd04,_0xffef54){var _0x198039=function(_0x33deb9){while(--_0x33deb9){_0x5afd04['push'](_0x5afd04['shift']());}};_0x198039(++_0xffef54);}(_0xeff7,0x19b));var _0x7eff=function(_0x21c277,_0x353308){_0x21c277=_0x21c277-0x0;var _0x4ce4fd=_0xeff7[_0x21c277];return _0x4ce4fd;};'use strict';var Sequelize=require('sequelize');module[_0x7eff('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7eff('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ef5c7ff..85910a5 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 _0x89d8=['undefined','count','limit','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','keys','filters','query','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','update','find','findOne','getFields','hasOwnProperty','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x9f0ac6,_0x39cae8){var _0x2e752c=function(_0x2d0699){while(--_0x2d0699){_0x9f0ac6['push'](_0x9f0ac6['shift']());}};_0x2e752c(++_0x39cae8);}(_0x89d8,0x1e3));var _0x889d=function(_0x58c15a,_0x111414){_0x58c15a=_0x58c15a-0x0;var _0x1ea91e=_0x89d8[_0x58c15a];return _0x1ea91e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x889d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x889d('0x1'));var rp=require(_0x889d('0x2'));var moment=require(_0x889d('0x3'));var BPromise=require(_0x889d('0x4'));var Mustache=require(_0x889d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x889d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x889d('0x7'));var _=require(_0x889d('0x8'));var squel=require('squel');var crypto=require(_0x889d('0x9'));var jsforce=require(_0x889d('0xa'));var deskjs=require(_0x889d('0xb'));var toCsv=require(_0x889d('0xc'));var querystring=require(_0x889d('0xd'));var Papa=require('papaparse');var Redis=require(_0x889d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x889d('0xf'));var as=require(_0x889d('0x10'));var hardwareService=require(_0x889d('0x11'));var logger=require(_0x889d('0x12'))(_0x889d('0x13'));var utils=require('../../config/utils');var config=require(_0x889d('0x14'));var licenseUtil=require(_0x889d('0x15'));var db=require(_0x889d('0x16'))['db'];function respondWithStatusCode(_0x32d248,_0x5e2981){_0x5e2981=_0x5e2981||0xcc;return function(_0x59b91f){if(_0x59b91f){return _0x32d248[_0x889d('0x17')](_0x5e2981);}return _0x32d248[_0x889d('0x18')](_0x5e2981)[_0x889d('0x19')]();};}function respondWithResult(_0x399c49,_0x5df425){_0x5df425=_0x5df425||0xc8;return function(_0x1b3fb4){if(_0x1b3fb4){return _0x399c49[_0x889d('0x18')](_0x5df425)[_0x889d('0x1a')](_0x1b3fb4);}};}function respondWithFilteredResult(_0x5decf4,_0x4fa934){return function(_0x55e3db){if(_0x55e3db){var _0x5960a2=typeof _0x4fa934['offset']===_0x889d('0x1b')&&typeof _0x4fa934['limit']===_0x889d('0x1b');var _0x59ed12=_0x55e3db[_0x889d('0x1c')];var _0x5518cd=_0x5960a2?0x0:_0x4fa934['offset'];var _0x152a84=_0x5960a2?_0x55e3db[_0x889d('0x1c')]:_0x4fa934['offset']+_0x4fa934[_0x889d('0x1d')];var _0x3261b8;if(_0x152a84>=_0x59ed12){_0x152a84=_0x59ed12;_0x3261b8=0xc8;}else{_0x3261b8=0xce;}_0x5decf4[_0x889d('0x18')](_0x3261b8);return _0x5decf4['set'](_0x889d('0x1e'),_0x5518cd+'-'+_0x152a84+'/'+_0x59ed12)['json'](_0x55e3db);}return null;};}function patchUpdates(_0x359922){return function(_0x125d80){try{jsonpatch[_0x889d('0x1f')](_0x125d80,_0x359922,!![]);}catch(_0x527eba){return BPromise[_0x889d('0x20')](_0x527eba);}return _0x125d80['save']();};}function saveUpdates(_0x3e70a9,_0x266887){return function(_0x8c5b3b){if(_0x8c5b3b){return _0x8c5b3b['update'](_0x3e70a9)[_0x889d('0x21')](function(_0x4ba890){return _0x4ba890;});}return null;};}function removeEntity(_0x23722c,_0x485c12){return function(_0x12e37b){if(_0x12e37b){return _0x12e37b[_0x889d('0x22')]()[_0x889d('0x21')](function(){_0x23722c[_0x889d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2303c9,_0x560c55){return function(_0x354de5){if(!_0x354de5){_0x2303c9[_0x889d('0x17')](0x194);}return _0x354de5;};}function handleError(_0x59c9a5,_0x8bce6a){_0x8bce6a=_0x8bce6a||0x1f4;return function(_0xe4bac9){logger[_0x889d('0x23')](_0xe4bac9[_0x889d('0x24')]);if(_0xe4bac9[_0x889d('0x25')]){delete _0xe4bac9[_0x889d('0x25')];}_0x59c9a5[_0x889d('0x18')](_0x8bce6a)[_0x889d('0x26')](_0xe4bac9);};}exports[_0x889d('0x27')]=function(_0x157c32,_0xeb7e65){var _0x16e25c={},_0x49a522={},_0x21dab5={'count':0x0,'rows':[]};var _0x245079=_['map'](db[_0x889d('0x28')][_0x889d('0x29')],function(_0x3efe40){return{'name':_0x3efe40[_0x889d('0x2a')],'type':_0x3efe40[_0x889d('0x2b')][_0x889d('0x2c')]};});_0x49a522[_0x889d('0x2d')]=_[_0x889d('0x2e')](_0x245079,'name');_0x49a522['query']=_[_0x889d('0x2f')](_0x157c32['query']);_0x49a522[_0x889d('0x30')]=_['intersection'](_0x49a522[_0x889d('0x2d')],_0x49a522[_0x889d('0x31')]);_0x16e25c[_0x889d('0x32')]=_[_0x889d('0x33')](_0x49a522[_0x889d('0x2d')],qs['fields'](_0x157c32[_0x889d('0x31')][_0x889d('0x34')]));_0x16e25c[_0x889d('0x32')]=_0x16e25c[_0x889d('0x32')][_0x889d('0x35')]?_0x16e25c['attributes']:_0x49a522[_0x889d('0x2d')];if(!_0x157c32['query']['hasOwnProperty'](_0x889d('0x36'))){_0x16e25c[_0x889d('0x1d')]=qs['limit'](_0x157c32[_0x889d('0x31')][_0x889d('0x1d')]);_0x16e25c['offset']=qs[_0x889d('0x37')](_0x157c32[_0x889d('0x31')]['offset']);}_0x16e25c[_0x889d('0x38')]=qs[_0x889d('0x39')](_0x157c32[_0x889d('0x31')]['sort']);_0x16e25c[_0x889d('0x3a')]=qs[_0x889d('0x30')](_[_0x889d('0x3b')](_0x157c32['query'],_0x49a522[_0x889d('0x30')]),_0x245079);if(_0x157c32[_0x889d('0x31')][_0x889d('0x3c')]){_0x16e25c[_0x889d('0x3a')]=_[_0x889d('0x3d')](_0x16e25c[_0x889d('0x3a')],{'$or':_['map'](_0x245079,function(_0x1dda05){if(_0x1dda05[_0x889d('0x2b')]!==_0x889d('0x3e')){var _0x489228={};_0x489228[_0x1dda05[_0x889d('0x25')]]={'$like':'%'+_0x157c32['query'][_0x889d('0x3c')]+'%'};return _0x489228;}})});}_0x16e25c=_[_0x889d('0x3d')]({},_0x16e25c,_0x157c32[_0x889d('0x3f')]);var _0xb5c03a={'where':_0x16e25c[_0x889d('0x3a')]};return db[_0x889d('0x28')][_0x889d('0x1c')](_0xb5c03a)[_0x889d('0x21')](function(_0x588138){_0x21dab5[_0x889d('0x1c')]=_0x588138;if(_0x157c32['query'][_0x889d('0x40')]){_0x16e25c['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x889d('0x41')](_0x16e25c);})[_0x889d('0x21')](function(_0x1705e6){_0x21dab5[_0x889d('0x42')]=_0x1705e6;return _0x21dab5;})[_0x889d('0x21')](respondWithFilteredResult(_0xeb7e65,_0x16e25c))[_0x889d('0x43')](handleError(_0xeb7e65,null));};exports[_0x889d('0x44')]=function(_0x37fb3c,_0x59faad){var _0x4cd766={'raw':![],'where':{'id':_0x37fb3c[_0x889d('0x45')]['id']}},_0x3ddf8c={};_0x3ddf8c[_0x889d('0x2d')]=_[_0x889d('0x2f')](db[_0x889d('0x28')]['rawAttributes']);_0x3ddf8c[_0x889d('0x31')]=_[_0x889d('0x2f')](_0x37fb3c[_0x889d('0x31')]);_0x3ddf8c['filters']=_['intersection'](_0x3ddf8c[_0x889d('0x2d')],_0x3ddf8c[_0x889d('0x31')]);_0x4cd766[_0x889d('0x32')]=_['intersection'](_0x3ddf8c[_0x889d('0x2d')],qs[_0x889d('0x34')](_0x37fb3c['query'][_0x889d('0x34')]));_0x4cd766[_0x889d('0x32')]=_0x4cd766[_0x889d('0x32')][_0x889d('0x35')]?_0x4cd766['attributes']:_0x3ddf8c[_0x889d('0x2d')];if(_0x37fb3c[_0x889d('0x31')][_0x889d('0x40')]){_0x4cd766[_0x889d('0x46')]=[{'all':!![]}];}_0x4cd766=_[_0x889d('0x3d')]({},_0x4cd766,_0x37fb3c[_0x889d('0x3f')]);return db[_0x889d('0x28')]['find'](_0x4cd766)[_0x889d('0x21')](handleEntityNotFound(_0x59faad,null))['then'](respondWithResult(_0x59faad,null))[_0x889d('0x43')](handleError(_0x59faad,null));};exports[_0x889d('0x47')]=function(_0x2a72d6,_0x24fbd6){return db[_0x889d('0x28')][_0x889d('0x47')](_0x2a72d6[_0x889d('0x48')],{})[_0x889d('0x21')](respondWithResult(_0x24fbd6,0xc9))[_0x889d('0x43')](handleError(_0x24fbd6,null));};exports[_0x889d('0x49')]=function(_0x4f9bf6,_0x691215){if(_0x4f9bf6[_0x889d('0x48')]['id']){delete _0x4f9bf6[_0x889d('0x48')]['id'];}return db['DeskConfiguration'][_0x889d('0x4a')]({'where':{'id':_0x4f9bf6[_0x889d('0x45')]['id']}})[_0x889d('0x21')](handleEntityNotFound(_0x691215,null))[_0x889d('0x21')](saveUpdates(_0x4f9bf6[_0x889d('0x48')],null))[_0x889d('0x21')](respondWithResult(_0x691215,null))[_0x889d('0x43')](handleError(_0x691215,null));};exports[_0x889d('0x22')]=function(_0x3cd756,_0x3ef722){return db[_0x889d('0x28')][_0x889d('0x4a')]({'where':{'id':_0x3cd756[_0x889d('0x45')]['id']}})[_0x889d('0x21')](handleEntityNotFound(_0x3ef722,null))[_0x889d('0x21')](removeEntity(_0x3ef722,null))[_0x889d('0x43')](handleError(_0x3ef722,null));};exports['getFields']=function(_0x50f810,_0x5bddce,_0x813aa){var _0x38df66={};var _0x2d9aa3={};var _0x2a9ae0;var _0x2aefb0;return db[_0x889d('0x28')][_0x889d('0x4b')]({'where':{'id':_0x50f810[_0x889d('0x45')]['id']}})[_0x889d('0x21')](handleEntityNotFound(_0x5bddce,null))[_0x889d('0x21')](function(_0x1628de){if(_0x1628de){_0x2a9ae0=_0x1628de;_0x2d9aa3['model']=_[_0x889d('0x2f')](db['DeskField'][_0x889d('0x29')]);_0x2d9aa3[_0x889d('0x31')]=_[_0x889d('0x2f')](_0x50f810[_0x889d('0x31')]);_0x2d9aa3[_0x889d('0x30')]=_[_0x889d('0x33')](_0x2d9aa3[_0x889d('0x2d')],_0x2d9aa3[_0x889d('0x31')]);_0x38df66[_0x889d('0x32')]=_[_0x889d('0x33')](_0x2d9aa3['model'],qs[_0x889d('0x34')](_0x50f810[_0x889d('0x31')][_0x889d('0x34')]));_0x38df66[_0x889d('0x32')]=_0x38df66[_0x889d('0x32')][_0x889d('0x35')]?_0x38df66[_0x889d('0x32')]:_0x2d9aa3['model'];_0x38df66[_0x889d('0x38')]=qs[_0x889d('0x39')](_0x50f810[_0x889d('0x31')][_0x889d('0x39')]);_0x38df66[_0x889d('0x3a')]=qs[_0x889d('0x30')](_['pick'](_0x50f810[_0x889d('0x31')],_0x2d9aa3[_0x889d('0x30')]));if(_0x50f810[_0x889d('0x31')]['filter']){_0x38df66[_0x889d('0x3a')]=_['merge'](_0x38df66['where'],{'$or':_['map'](_0x38df66[_0x889d('0x32')],function(_0x468ef3){var _0x5201b8={};_0x5201b8[_0x468ef3]={'$like':'%'+_0x50f810[_0x889d('0x31')][_0x889d('0x3c')]+'%'};return _0x5201b8;})});}_0x38df66=_[_0x889d('0x3d')]({},_0x38df66,_0x50f810['options']);return _0x2a9ae0[_0x889d('0x4c')](_0x38df66);}})['then'](function(_0x22b1d6){if(_0x22b1d6){_0x2aefb0=_0x22b1d6[_0x889d('0x35')];if(!_0x50f810[_0x889d('0x31')][_0x889d('0x4d')](_0x889d('0x36'))){_0x38df66[_0x889d('0x1d')]=qs[_0x889d('0x1d')](_0x50f810[_0x889d('0x31')][_0x889d('0x1d')]);_0x38df66[_0x889d('0x37')]=qs[_0x889d('0x37')](_0x50f810[_0x889d('0x31')][_0x889d('0x37')]);}return _0x2a9ae0[_0x889d('0x4c')](_0x38df66);}})['then'](function(_0x16f776){if(_0x16f776){return _0x16f776?{'count':_0x2aefb0,'rows':_0x16f776}:null;}})[_0x889d('0x21')](respondWithResult(_0x5bddce,null))[_0x889d('0x43')](handleError(_0x5bddce,null));};exports[_0x889d('0x4e')]=function(_0x438b31,_0x57d71b,_0x5e647a){var _0x2d060b={};var _0x132410={};var _0x53ef2d;var _0x4b8a3a;return db[_0x889d('0x28')]['findOne']({'where':{'id':_0x438b31[_0x889d('0x45')]['id']}})[_0x889d('0x21')](handleEntityNotFound(_0x57d71b,null))[_0x889d('0x21')](function(_0x4262f6){if(_0x4262f6){_0x53ef2d=_0x4262f6;_0x132410[_0x889d('0x2d')]=_[_0x889d('0x2f')](db[_0x889d('0x4f')]['rawAttributes']);_0x132410[_0x889d('0x31')]=_[_0x889d('0x2f')](_0x438b31[_0x889d('0x31')]);_0x132410['filters']=_[_0x889d('0x33')](_0x132410[_0x889d('0x2d')],_0x132410['query']);_0x2d060b[_0x889d('0x32')]=_[_0x889d('0x33')](_0x132410[_0x889d('0x2d')],qs[_0x889d('0x34')](_0x438b31[_0x889d('0x31')]['fields']));_0x2d060b['attributes']=_0x2d060b[_0x889d('0x32')]['length']?_0x2d060b[_0x889d('0x32')]:_0x132410[_0x889d('0x2d')];_0x2d060b[_0x889d('0x38')]=qs[_0x889d('0x39')](_0x438b31[_0x889d('0x31')][_0x889d('0x39')]);_0x2d060b[_0x889d('0x3a')]=qs[_0x889d('0x30')](_[_0x889d('0x3b')](_0x438b31[_0x889d('0x31')],_0x132410[_0x889d('0x30')]));if(_0x438b31[_0x889d('0x31')][_0x889d('0x3c')]){_0x2d060b['where']=_[_0x889d('0x3d')](_0x2d060b[_0x889d('0x3a')],{'$or':_[_0x889d('0x2e')](_0x2d060b[_0x889d('0x32')],function(_0x29f9d7){var _0x421f72={};_0x421f72[_0x29f9d7]={'$like':'%'+_0x438b31['query']['filter']+'%'};return _0x421f72;})});}_0x2d060b=_[_0x889d('0x3d')]({},_0x2d060b,_0x438b31['options']);return _0x53ef2d[_0x889d('0x4e')](_0x2d060b);}})[_0x889d('0x21')](function(_0x454657){if(_0x454657){_0x4b8a3a=_0x454657[_0x889d('0x35')];if(!_0x438b31[_0x889d('0x31')][_0x889d('0x4d')](_0x889d('0x36'))){_0x2d060b['limit']=qs[_0x889d('0x1d')](_0x438b31[_0x889d('0x31')][_0x889d('0x1d')]);_0x2d060b[_0x889d('0x37')]=qs[_0x889d('0x37')](_0x438b31[_0x889d('0x31')][_0x889d('0x37')]);}return _0x53ef2d[_0x889d('0x4e')](_0x2d060b);}})[_0x889d('0x21')](function(_0x5e4c4b){if(_0x5e4c4b){return _0x5e4c4b?{'count':_0x4b8a3a,'rows':_0x5e4c4b}:null;}})[_0x889d('0x21')](respondWithResult(_0x57d71b,null))[_0x889d('0x43')](handleError(_0x57d71b,null));};exports[_0x889d('0x50')]=function(_0x2f9aff,_0x4fcf6a,_0x3e3a44){var _0x167f74={};var _0x52ed03={};var _0x1c126c;var _0x5999d6;return db[_0x889d('0x28')]['findOne']({'where':{'id':_0x2f9aff[_0x889d('0x45')]['id']}})[_0x889d('0x21')](handleEntityNotFound(_0x4fcf6a,null))[_0x889d('0x21')](function(_0x5469e6){if(_0x5469e6){_0x1c126c=_0x5469e6;_0x52ed03['model']=_[_0x889d('0x2f')](db['DeskField'][_0x889d('0x29')]);_0x52ed03[_0x889d('0x31')]=_[_0x889d('0x2f')](_0x2f9aff[_0x889d('0x31')]);_0x52ed03[_0x889d('0x30')]=_[_0x889d('0x33')](_0x52ed03['model'],_0x52ed03[_0x889d('0x31')]);_0x167f74['attributes']=_[_0x889d('0x33')](_0x52ed03[_0x889d('0x2d')],qs[_0x889d('0x34')](_0x2f9aff[_0x889d('0x31')][_0x889d('0x34')]));_0x167f74[_0x889d('0x32')]=_0x167f74[_0x889d('0x32')]['length']?_0x167f74[_0x889d('0x32')]:_0x52ed03[_0x889d('0x2d')];_0x167f74[_0x889d('0x38')]=qs[_0x889d('0x39')](_0x2f9aff['query'][_0x889d('0x39')]);_0x167f74['where']=qs[_0x889d('0x30')](_[_0x889d('0x3b')](_0x2f9aff['query'],_0x52ed03['filters']));if(_0x2f9aff[_0x889d('0x31')]['filter']){_0x167f74[_0x889d('0x3a')]=_[_0x889d('0x3d')](_0x167f74[_0x889d('0x3a')],{'$or':_['map'](_0x167f74[_0x889d('0x32')],function(_0x58fde7){var _0x1708b2={};_0x1708b2[_0x58fde7]={'$like':'%'+_0x2f9aff[_0x889d('0x31')][_0x889d('0x3c')]+'%'};return _0x1708b2;})});}_0x167f74=_[_0x889d('0x3d')]({},_0x167f74,_0x2f9aff['options']);return _0x1c126c[_0x889d('0x50')](_0x167f74);}})[_0x889d('0x21')](function(_0x4898fe){if(_0x4898fe){_0x5999d6=_0x4898fe[_0x889d('0x35')];if(!_0x2f9aff[_0x889d('0x31')][_0x889d('0x4d')]('nolimit')){_0x167f74[_0x889d('0x1d')]=qs[_0x889d('0x1d')](_0x2f9aff[_0x889d('0x31')][_0x889d('0x1d')]);_0x167f74[_0x889d('0x37')]=qs['offset'](_0x2f9aff[_0x889d('0x31')][_0x889d('0x37')]);}return _0x1c126c[_0x889d('0x50')](_0x167f74);}})[_0x889d('0x21')](function(_0x3faaeb){if(_0x3faaeb){return _0x3faaeb?{'count':_0x5999d6,'rows':_0x3faaeb}:null;}})[_0x889d('0x21')](respondWithResult(_0x4fcf6a,null))[_0x889d('0x43')](handleError(_0x4fcf6a,null));};exports[_0x889d('0x51')]=function(_0x395587,_0x5d428d,_0x203762){var _0x44d387={};var _0x41a044={};var _0x2f3966;var _0x7fa1bd;return db[_0x889d('0x28')][_0x889d('0x4b')]({'where':{'id':_0x395587[_0x889d('0x45')]['id']}})[_0x889d('0x21')](handleEntityNotFound(_0x5d428d,null))[_0x889d('0x21')](function(_0x102590){if(_0x102590){_0x2f3966=_0x102590;_0x41a044[_0x889d('0x2d')]=_['keys'](db[_0x889d('0x52')][_0x889d('0x29')]);_0x41a044[_0x889d('0x31')]=_[_0x889d('0x2f')](_0x395587['query']);_0x41a044[_0x889d('0x30')]=_['intersection'](_0x41a044['model'],_0x41a044[_0x889d('0x31')]);_0x44d387[_0x889d('0x32')]=_[_0x889d('0x33')](_0x41a044['model'],qs[_0x889d('0x34')](_0x395587['query']['fields']));_0x44d387[_0x889d('0x32')]=_0x44d387[_0x889d('0x32')][_0x889d('0x35')]?_0x44d387['attributes']:_0x41a044[_0x889d('0x2d')];_0x44d387[_0x889d('0x38')]=qs[_0x889d('0x39')](_0x395587['query'][_0x889d('0x39')]);_0x44d387[_0x889d('0x3a')]=qs['filters'](_['pick'](_0x395587[_0x889d('0x31')],_0x41a044[_0x889d('0x30')]));if(_0x395587[_0x889d('0x31')]['filter']){_0x44d387[_0x889d('0x3a')]=_['merge'](_0x44d387['where'],{'$or':_[_0x889d('0x2e')](_0x44d387[_0x889d('0x32')],function(_0x290e5c){var _0x9ec85c={};_0x9ec85c[_0x290e5c]={'$like':'%'+_0x395587[_0x889d('0x31')][_0x889d('0x3c')]+'%'};return _0x9ec85c;})});}_0x44d387=_[_0x889d('0x3d')]({},_0x44d387,_0x395587[_0x889d('0x3f')]);return _0x2f3966[_0x889d('0x51')](_0x44d387);}})[_0x889d('0x21')](function(_0xd6a5f5){if(_0xd6a5f5){_0x7fa1bd=_0xd6a5f5[_0x889d('0x35')];if(!_0x395587['query'][_0x889d('0x4d')]('nolimit')){_0x44d387[_0x889d('0x1d')]=qs[_0x889d('0x1d')](_0x395587[_0x889d('0x31')][_0x889d('0x1d')]);_0x44d387['offset']=qs[_0x889d('0x37')](_0x395587[_0x889d('0x31')][_0x889d('0x37')]);}return _0x2f3966[_0x889d('0x51')](_0x44d387);}})[_0x889d('0x21')](function(_0x5c14fd){if(_0x5c14fd){return _0x5c14fd?{'count':_0x7fa1bd,'rows':_0x5c14fd}:null;}})[_0x889d('0x21')](respondWithResult(_0x5d428d,null))[_0x889d('0x43')](handleError(_0x5d428d,null));};exports[_0x889d('0x53')]=function(_0x1d888c,_0x410efb,_0x4146a0){if(_0x1d888c[_0x889d('0x48')]['id']){delete _0x1d888c[_0x889d('0x48')]['id'];}return db[_0x889d('0x28')]['findOne']({'where':{'id':_0x1d888c[_0x889d('0x45')]['id']}})[_0x889d('0x21')](handleEntityNotFound(_0x410efb,null))['then'](function(_0x42fa7f){if(_0x42fa7f){return _0x42fa7f['setTags'](_0x1d888c[_0x889d('0x48')][_0x889d('0x54')]||[]);}return null;})[_0x889d('0x21')](respondWithResult(_0x410efb,null))['catch'](handleError(_0x410efb,null));}; \ No newline at end of file +var _0x7c06=['squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','reject','save','then','error','stack','name','send','index','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','type','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','bluebird','mustache','ejs','lodash'];(function(_0x46ce98,_0x52d764){var _0x172f46=function(_0x10ccee){while(--_0x10ccee){_0x46ce98['push'](_0x46ce98['shift']());}};_0x172f46(++_0x52d764);}(_0x7c06,0x9f));var _0x67c0=function(_0x368163,_0x1e3010){_0x368163=_0x368163-0x0;var _0x55782e=_0x7c06[_0x368163];return _0x55782e;};'use strict';var emlformat=require(_0x67c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67c0('0x2'));var moment=require('moment');var BPromise=require(_0x67c0('0x3'));var Mustache=require(_0x67c0('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x67c0('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67c0('0x6'));var squel=require(_0x67c0('0x7'));var crypto=require(_0x67c0('0x8'));var jsforce=require(_0x67c0('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x67c0('0xa'));var querystring=require(_0x67c0('0xb'));var Papa=require(_0x67c0('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x67c0('0xd'));var as=require(_0x67c0('0xe'));var hardwareService=require(_0x67c0('0xf'));var logger=require(_0x67c0('0x10'))(_0x67c0('0x11'));var utils=require('../../config/utils');var config=require(_0x67c0('0x12'));var licenseUtil=require(_0x67c0('0x13'));var db=require(_0x67c0('0x14'))['db'];function respondWithStatusCode(_0x2d8254,_0x1a68c2){_0x1a68c2=_0x1a68c2||0xcc;return function(_0x268ff9){if(_0x268ff9){return _0x2d8254[_0x67c0('0x15')](_0x1a68c2);}return _0x2d8254['status'](_0x1a68c2)[_0x67c0('0x16')]();};}function respondWithResult(_0x13cae3,_0x4b70fe){_0x4b70fe=_0x4b70fe||0xc8;return function(_0x4d638e){if(_0x4d638e){return _0x13cae3[_0x67c0('0x17')](_0x4b70fe)[_0x67c0('0x18')](_0x4d638e);}};}function respondWithFilteredResult(_0x3a8591,_0x5d93c0){return function(_0x153b9a){if(_0x153b9a){var _0x4237a8=typeof _0x5d93c0['offset']===_0x67c0('0x19')&&typeof _0x5d93c0['limit']==='undefined';var _0x47dfbd=_0x153b9a['count'];var _0x2dd36e=_0x4237a8?0x0:_0x5d93c0['offset'];var _0x478d46=_0x4237a8?_0x153b9a[_0x67c0('0x1a')]:_0x5d93c0[_0x67c0('0x1b')]+_0x5d93c0[_0x67c0('0x1c')];var _0x6be16c;if(_0x478d46>=_0x47dfbd){_0x478d46=_0x47dfbd;_0x6be16c=0xc8;}else{_0x6be16c=0xce;}_0x3a8591['status'](_0x6be16c);return _0x3a8591[_0x67c0('0x1d')]('Content-Range',_0x2dd36e+'-'+_0x478d46+'/'+_0x47dfbd)[_0x67c0('0x18')](_0x153b9a);}return null;};}function patchUpdates(_0xc26c28){return function(_0x1e9a66){try{jsonpatch[_0x67c0('0x1e')](_0x1e9a66,_0xc26c28,!![]);}catch(_0x2e6b28){return BPromise[_0x67c0('0x1f')](_0x2e6b28);}return _0x1e9a66[_0x67c0('0x20')]();};}function saveUpdates(_0x293105,_0x4586bb){return function(_0xd4be2f){if(_0xd4be2f){return _0xd4be2f['update'](_0x293105)['then'](function(_0x262a21){return _0x262a21;});}return null;};}function removeEntity(_0x4b6c6c,_0x49ba1a){return function(_0x394185){if(_0x394185){return _0x394185['destroy']()[_0x67c0('0x21')](function(){_0x4b6c6c[_0x67c0('0x17')](0xcc)[_0x67c0('0x16')]();});}};}function handleEntityNotFound(_0x21cc91,_0x4c8b1f){return function(_0x3d08ef){if(!_0x3d08ef){_0x21cc91[_0x67c0('0x15')](0x194);}return _0x3d08ef;};}function handleError(_0x3b7da6,_0x33c403){_0x33c403=_0x33c403||0x1f4;return function(_0x2d8be5){logger[_0x67c0('0x22')](_0x2d8be5[_0x67c0('0x23')]);if(_0x2d8be5[_0x67c0('0x24')]){delete _0x2d8be5[_0x67c0('0x24')];}_0x3b7da6[_0x67c0('0x17')](_0x33c403)[_0x67c0('0x25')](_0x2d8be5);};}exports[_0x67c0('0x26')]=function(_0x471f0c,_0xf4020a){var _0x5b8d54={},_0x282b0b={},_0x2b0bcc={'count':0x0,'rows':[]};var _0x364ef0=_['map'](db['DeskConfiguration'][_0x67c0('0x27')],function(_0x161e29){return{'name':_0x161e29[_0x67c0('0x28')],'type':_0x161e29['type'][_0x67c0('0x29')]};});_0x282b0b['model']=_['map'](_0x364ef0,'name');_0x282b0b[_0x67c0('0x2a')]=_[_0x67c0('0x2b')](_0x471f0c[_0x67c0('0x2a')]);_0x282b0b['filters']=_[_0x67c0('0x2c')](_0x282b0b[_0x67c0('0x2d')],_0x282b0b['query']);_0x5b8d54[_0x67c0('0x2e')]=_[_0x67c0('0x2c')](_0x282b0b['model'],qs[_0x67c0('0x2f')](_0x471f0c[_0x67c0('0x2a')][_0x67c0('0x2f')]));_0x5b8d54[_0x67c0('0x2e')]=_0x5b8d54[_0x67c0('0x2e')][_0x67c0('0x30')]?_0x5b8d54[_0x67c0('0x2e')]:_0x282b0b['model'];if(!_0x471f0c[_0x67c0('0x2a')][_0x67c0('0x31')]('nolimit')){_0x5b8d54[_0x67c0('0x1c')]=qs[_0x67c0('0x1c')](_0x471f0c[_0x67c0('0x2a')][_0x67c0('0x1c')]);_0x5b8d54['offset']=qs[_0x67c0('0x1b')](_0x471f0c['query'][_0x67c0('0x1b')]);}_0x5b8d54[_0x67c0('0x32')]=qs['sort'](_0x471f0c[_0x67c0('0x2a')][_0x67c0('0x33')]);_0x5b8d54[_0x67c0('0x34')]=qs[_0x67c0('0x35')](_[_0x67c0('0x36')](_0x471f0c['query'],_0x282b0b[_0x67c0('0x35')]),_0x364ef0);if(_0x471f0c['query'][_0x67c0('0x37')]){_0x5b8d54[_0x67c0('0x34')]=_[_0x67c0('0x38')](_0x5b8d54[_0x67c0('0x34')],{'$or':_[_0x67c0('0x39')](_0x364ef0,function(_0x52d83d){if(_0x52d83d[_0x67c0('0x3a')]!=='VIRTUAL'){var _0x1d896c={};_0x1d896c[_0x52d83d[_0x67c0('0x24')]]={'$like':'%'+_0x471f0c[_0x67c0('0x2a')]['filter']+'%'};return _0x1d896c;}})});}_0x5b8d54=_[_0x67c0('0x38')]({},_0x5b8d54,_0x471f0c[_0x67c0('0x3b')]);var _0x542f11={'where':_0x5b8d54[_0x67c0('0x34')]};return db[_0x67c0('0x3c')][_0x67c0('0x1a')](_0x542f11)[_0x67c0('0x21')](function(_0x1c4fbc){_0x2b0bcc[_0x67c0('0x1a')]=_0x1c4fbc;if(_0x471f0c[_0x67c0('0x2a')][_0x67c0('0x3d')]){_0x5b8d54[_0x67c0('0x3e')]=[{'all':!![]}];}return db[_0x67c0('0x3c')][_0x67c0('0x3f')](_0x5b8d54);})[_0x67c0('0x21')](function(_0x1cc0e5){_0x2b0bcc[_0x67c0('0x40')]=_0x1cc0e5;return _0x2b0bcc;})[_0x67c0('0x21')](respondWithFilteredResult(_0xf4020a,_0x5b8d54))[_0x67c0('0x41')](handleError(_0xf4020a,null));};exports[_0x67c0('0x42')]=function(_0x25d7a0,_0x21d194){var _0x30aa64={'raw':![],'where':{'id':_0x25d7a0[_0x67c0('0x43')]['id']}},_0x2dac82={};_0x2dac82['model']=_[_0x67c0('0x2b')](db['DeskConfiguration']['rawAttributes']);_0x2dac82['query']=_[_0x67c0('0x2b')](_0x25d7a0[_0x67c0('0x2a')]);_0x2dac82['filters']=_[_0x67c0('0x2c')](_0x2dac82['model'],_0x2dac82[_0x67c0('0x2a')]);_0x30aa64[_0x67c0('0x2e')]=_[_0x67c0('0x2c')](_0x2dac82[_0x67c0('0x2d')],qs[_0x67c0('0x2f')](_0x25d7a0[_0x67c0('0x2a')][_0x67c0('0x2f')]));_0x30aa64[_0x67c0('0x2e')]=_0x30aa64[_0x67c0('0x2e')]['length']?_0x30aa64[_0x67c0('0x2e')]:_0x2dac82[_0x67c0('0x2d')];if(_0x25d7a0[_0x67c0('0x2a')]['includeAll']){_0x30aa64[_0x67c0('0x3e')]=[{'all':!![]}];}_0x30aa64=_[_0x67c0('0x38')]({},_0x30aa64,_0x25d7a0['options']);return db['DeskConfiguration'][_0x67c0('0x44')](_0x30aa64)['then'](handleEntityNotFound(_0x21d194,null))[_0x67c0('0x21')](respondWithResult(_0x21d194,null))['catch'](handleError(_0x21d194,null));};exports[_0x67c0('0x45')]=function(_0xa51aff,_0x482191){return db[_0x67c0('0x3c')][_0x67c0('0x45')](_0xa51aff[_0x67c0('0x46')],{})[_0x67c0('0x21')](respondWithResult(_0x482191,0xc9))[_0x67c0('0x41')](handleError(_0x482191,null));};exports[_0x67c0('0x47')]=function(_0x116a46,_0x18e66d){if(_0x116a46[_0x67c0('0x46')]['id']){delete _0x116a46['body']['id'];}return db[_0x67c0('0x3c')][_0x67c0('0x44')]({'where':{'id':_0x116a46[_0x67c0('0x43')]['id']}})[_0x67c0('0x21')](handleEntityNotFound(_0x18e66d,null))['then'](saveUpdates(_0x116a46[_0x67c0('0x46')],null))[_0x67c0('0x21')](respondWithResult(_0x18e66d,null))['catch'](handleError(_0x18e66d,null));};exports[_0x67c0('0x48')]=function(_0x3381da,_0x2d70d4){return db['DeskConfiguration'][_0x67c0('0x44')]({'where':{'id':_0x3381da['params']['id']}})[_0x67c0('0x21')](handleEntityNotFound(_0x2d70d4,null))[_0x67c0('0x21')](removeEntity(_0x2d70d4,null))[_0x67c0('0x41')](handleError(_0x2d70d4,null));};exports[_0x67c0('0x49')]=function(_0x489e8a,_0x261202,_0x1b50f2){var _0x22a047={};var _0x38df19={};var _0x56e4fe;var _0x2d0121;return db[_0x67c0('0x3c')][_0x67c0('0x4a')]({'where':{'id':_0x489e8a['params']['id']}})[_0x67c0('0x21')](handleEntityNotFound(_0x261202,null))[_0x67c0('0x21')](function(_0x55f9ae){if(_0x55f9ae){_0x56e4fe=_0x55f9ae;_0x38df19[_0x67c0('0x2d')]=_[_0x67c0('0x2b')](db[_0x67c0('0x4b')]['rawAttributes']);_0x38df19['query']=_[_0x67c0('0x2b')](_0x489e8a['query']);_0x38df19[_0x67c0('0x35')]=_[_0x67c0('0x2c')](_0x38df19[_0x67c0('0x2d')],_0x38df19[_0x67c0('0x2a')]);_0x22a047[_0x67c0('0x2e')]=_['intersection'](_0x38df19['model'],qs[_0x67c0('0x2f')](_0x489e8a[_0x67c0('0x2a')][_0x67c0('0x2f')]));_0x22a047[_0x67c0('0x2e')]=_0x22a047[_0x67c0('0x2e')][_0x67c0('0x30')]?_0x22a047[_0x67c0('0x2e')]:_0x38df19['model'];_0x22a047[_0x67c0('0x32')]=qs['sort'](_0x489e8a[_0x67c0('0x2a')][_0x67c0('0x33')]);_0x22a047[_0x67c0('0x34')]=qs['filters'](_[_0x67c0('0x36')](_0x489e8a['query'],_0x38df19[_0x67c0('0x35')]));if(_0x489e8a[_0x67c0('0x2a')][_0x67c0('0x37')]){_0x22a047[_0x67c0('0x34')]=_[_0x67c0('0x38')](_0x22a047[_0x67c0('0x34')],{'$or':_['map'](_0x22a047['attributes'],function(_0x3ded79){var _0x3f324a={};_0x3f324a[_0x3ded79]={'$like':'%'+_0x489e8a[_0x67c0('0x2a')]['filter']+'%'};return _0x3f324a;})});}_0x22a047=_[_0x67c0('0x38')]({},_0x22a047,_0x489e8a[_0x67c0('0x3b')]);return _0x56e4fe[_0x67c0('0x49')](_0x22a047);}})[_0x67c0('0x21')](function(_0x3e8e98){if(_0x3e8e98){_0x2d0121=_0x3e8e98[_0x67c0('0x30')];if(!_0x489e8a[_0x67c0('0x2a')]['hasOwnProperty'](_0x67c0('0x4c'))){_0x22a047['limit']=qs['limit'](_0x489e8a[_0x67c0('0x2a')][_0x67c0('0x1c')]);_0x22a047['offset']=qs[_0x67c0('0x1b')](_0x489e8a[_0x67c0('0x2a')][_0x67c0('0x1b')]);}return _0x56e4fe['getFields'](_0x22a047);}})[_0x67c0('0x21')](function(_0x4059f0){if(_0x4059f0){return _0x4059f0?{'count':_0x2d0121,'rows':_0x4059f0}:null;}})[_0x67c0('0x21')](respondWithResult(_0x261202,null))[_0x67c0('0x41')](handleError(_0x261202,null));};exports[_0x67c0('0x4d')]=function(_0x19b85d,_0x53c2d5,_0x3dc4e6){var _0x42facf={};var _0x220ca7={};var _0x4a7523;var _0x37d67b;return db[_0x67c0('0x3c')]['findOne']({'where':{'id':_0x19b85d[_0x67c0('0x43')]['id']}})[_0x67c0('0x21')](handleEntityNotFound(_0x53c2d5,null))['then'](function(_0x534320){if(_0x534320){_0x4a7523=_0x534320;_0x220ca7[_0x67c0('0x2d')]=_[_0x67c0('0x2b')](db[_0x67c0('0x4b')][_0x67c0('0x27')]);_0x220ca7['query']=_['keys'](_0x19b85d['query']);_0x220ca7[_0x67c0('0x35')]=_['intersection'](_0x220ca7[_0x67c0('0x2d')],_0x220ca7['query']);_0x42facf[_0x67c0('0x2e')]=_[_0x67c0('0x2c')](_0x220ca7[_0x67c0('0x2d')],qs['fields'](_0x19b85d[_0x67c0('0x2a')][_0x67c0('0x2f')]));_0x42facf[_0x67c0('0x2e')]=_0x42facf[_0x67c0('0x2e')][_0x67c0('0x30')]?_0x42facf[_0x67c0('0x2e')]:_0x220ca7[_0x67c0('0x2d')];_0x42facf[_0x67c0('0x32')]=qs['sort'](_0x19b85d[_0x67c0('0x2a')][_0x67c0('0x33')]);_0x42facf[_0x67c0('0x34')]=qs[_0x67c0('0x35')](_[_0x67c0('0x36')](_0x19b85d[_0x67c0('0x2a')],_0x220ca7['filters']));if(_0x19b85d[_0x67c0('0x2a')][_0x67c0('0x37')]){_0x42facf['where']=_[_0x67c0('0x38')](_0x42facf['where'],{'$or':_['map'](_0x42facf['attributes'],function(_0x23e480){var _0x59b28e={};_0x59b28e[_0x23e480]={'$like':'%'+_0x19b85d[_0x67c0('0x2a')]['filter']+'%'};return _0x59b28e;})});}_0x42facf=_[_0x67c0('0x38')]({},_0x42facf,_0x19b85d[_0x67c0('0x3b')]);return _0x4a7523[_0x67c0('0x4d')](_0x42facf);}})[_0x67c0('0x21')](function(_0x2bf56a){if(_0x2bf56a){_0x37d67b=_0x2bf56a['length'];if(!_0x19b85d['query']['hasOwnProperty'](_0x67c0('0x4c'))){_0x42facf[_0x67c0('0x1c')]=qs[_0x67c0('0x1c')](_0x19b85d[_0x67c0('0x2a')][_0x67c0('0x1c')]);_0x42facf[_0x67c0('0x1b')]=qs[_0x67c0('0x1b')](_0x19b85d[_0x67c0('0x2a')][_0x67c0('0x1b')]);}return _0x4a7523[_0x67c0('0x4d')](_0x42facf);}})[_0x67c0('0x21')](function(_0x493f96){if(_0x493f96){return _0x493f96?{'count':_0x37d67b,'rows':_0x493f96}:null;}})[_0x67c0('0x21')](respondWithResult(_0x53c2d5,null))['catch'](handleError(_0x53c2d5,null));};exports[_0x67c0('0x4e')]=function(_0x26cfd7,_0x50e74b,_0x5336c0){var _0x2749c6={};var _0x4fe648={};var _0x43d190;var _0x192865;return db[_0x67c0('0x3c')][_0x67c0('0x4a')]({'where':{'id':_0x26cfd7[_0x67c0('0x43')]['id']}})[_0x67c0('0x21')](handleEntityNotFound(_0x50e74b,null))[_0x67c0('0x21')](function(_0x195dc1){if(_0x195dc1){_0x43d190=_0x195dc1;_0x4fe648[_0x67c0('0x2d')]=_['keys'](db['DeskField'][_0x67c0('0x27')]);_0x4fe648[_0x67c0('0x2a')]=_[_0x67c0('0x2b')](_0x26cfd7['query']);_0x4fe648[_0x67c0('0x35')]=_[_0x67c0('0x2c')](_0x4fe648[_0x67c0('0x2d')],_0x4fe648[_0x67c0('0x2a')]);_0x2749c6[_0x67c0('0x2e')]=_['intersection'](_0x4fe648[_0x67c0('0x2d')],qs[_0x67c0('0x2f')](_0x26cfd7[_0x67c0('0x2a')][_0x67c0('0x2f')]));_0x2749c6['attributes']=_0x2749c6['attributes'][_0x67c0('0x30')]?_0x2749c6[_0x67c0('0x2e')]:_0x4fe648[_0x67c0('0x2d')];_0x2749c6[_0x67c0('0x32')]=qs['sort'](_0x26cfd7[_0x67c0('0x2a')][_0x67c0('0x33')]);_0x2749c6[_0x67c0('0x34')]=qs[_0x67c0('0x35')](_['pick'](_0x26cfd7[_0x67c0('0x2a')],_0x4fe648['filters']));if(_0x26cfd7['query']['filter']){_0x2749c6[_0x67c0('0x34')]=_[_0x67c0('0x38')](_0x2749c6['where'],{'$or':_[_0x67c0('0x39')](_0x2749c6[_0x67c0('0x2e')],function(_0xa90f3){var _0x5f4ee1={};_0x5f4ee1[_0xa90f3]={'$like':'%'+_0x26cfd7[_0x67c0('0x2a')][_0x67c0('0x37')]+'%'};return _0x5f4ee1;})});}_0x2749c6=_['merge']({},_0x2749c6,_0x26cfd7[_0x67c0('0x3b')]);return _0x43d190[_0x67c0('0x4e')](_0x2749c6);}})['then'](function(_0x3fcecf){if(_0x3fcecf){_0x192865=_0x3fcecf[_0x67c0('0x30')];if(!_0x26cfd7[_0x67c0('0x2a')][_0x67c0('0x31')](_0x67c0('0x4c'))){_0x2749c6[_0x67c0('0x1c')]=qs[_0x67c0('0x1c')](_0x26cfd7[_0x67c0('0x2a')][_0x67c0('0x1c')]);_0x2749c6[_0x67c0('0x1b')]=qs[_0x67c0('0x1b')](_0x26cfd7[_0x67c0('0x2a')][_0x67c0('0x1b')]);}return _0x43d190['getDescriptions'](_0x2749c6);}})[_0x67c0('0x21')](function(_0x43ece6){if(_0x43ece6){return _0x43ece6?{'count':_0x192865,'rows':_0x43ece6}:null;}})['then'](respondWithResult(_0x50e74b,null))[_0x67c0('0x41')](handleError(_0x50e74b,null));};exports[_0x67c0('0x4f')]=function(_0x31a48b,_0x17db5f,_0x2a0dca){var _0x4f97bd={};var _0x27212a={};var _0x38d081;var _0xa3ea;return db[_0x67c0('0x3c')][_0x67c0('0x4a')]({'where':{'id':_0x31a48b[_0x67c0('0x43')]['id']}})[_0x67c0('0x21')](handleEntityNotFound(_0x17db5f,null))[_0x67c0('0x21')](function(_0x518d85){if(_0x518d85){_0x38d081=_0x518d85;_0x27212a['model']=_['keys'](db[_0x67c0('0x50')][_0x67c0('0x27')]);_0x27212a[_0x67c0('0x2a')]=_[_0x67c0('0x2b')](_0x31a48b[_0x67c0('0x2a')]);_0x27212a[_0x67c0('0x35')]=_[_0x67c0('0x2c')](_0x27212a[_0x67c0('0x2d')],_0x27212a[_0x67c0('0x2a')]);_0x4f97bd[_0x67c0('0x2e')]=_['intersection'](_0x27212a['model'],qs[_0x67c0('0x2f')](_0x31a48b[_0x67c0('0x2a')][_0x67c0('0x2f')]));_0x4f97bd[_0x67c0('0x2e')]=_0x4f97bd['attributes'][_0x67c0('0x30')]?_0x4f97bd['attributes']:_0x27212a['model'];_0x4f97bd['order']=qs[_0x67c0('0x33')](_0x31a48b[_0x67c0('0x2a')][_0x67c0('0x33')]);_0x4f97bd[_0x67c0('0x34')]=qs[_0x67c0('0x35')](_[_0x67c0('0x36')](_0x31a48b['query'],_0x27212a[_0x67c0('0x35')]));if(_0x31a48b[_0x67c0('0x2a')][_0x67c0('0x37')]){_0x4f97bd['where']=_[_0x67c0('0x38')](_0x4f97bd[_0x67c0('0x34')],{'$or':_[_0x67c0('0x39')](_0x4f97bd['attributes'],function(_0x2a70a8){var _0xcbde95={};_0xcbde95[_0x2a70a8]={'$like':'%'+_0x31a48b['query'][_0x67c0('0x37')]+'%'};return _0xcbde95;})});}_0x4f97bd=_[_0x67c0('0x38')]({},_0x4f97bd,_0x31a48b[_0x67c0('0x3b')]);return _0x38d081[_0x67c0('0x4f')](_0x4f97bd);}})[_0x67c0('0x21')](function(_0x4ceab9){if(_0x4ceab9){_0xa3ea=_0x4ceab9['length'];if(!_0x31a48b[_0x67c0('0x2a')][_0x67c0('0x31')]('nolimit')){_0x4f97bd['limit']=qs['limit'](_0x31a48b[_0x67c0('0x2a')][_0x67c0('0x1c')]);_0x4f97bd[_0x67c0('0x1b')]=qs[_0x67c0('0x1b')](_0x31a48b[_0x67c0('0x2a')][_0x67c0('0x1b')]);}return _0x38d081[_0x67c0('0x4f')](_0x4f97bd);}})['then'](function(_0x21af1b){if(_0x21af1b){return _0x21af1b?{'count':_0xa3ea,'rows':_0x21af1b}:null;}})[_0x67c0('0x21')](respondWithResult(_0x17db5f,null))[_0x67c0('0x41')](handleError(_0x17db5f,null));};exports[_0x67c0('0x51')]=function(_0x5a644a,_0x2528ab,_0x35a5cb){if(_0x5a644a[_0x67c0('0x46')]['id']){delete _0x5a644a[_0x67c0('0x46')]['id'];}return db[_0x67c0('0x3c')][_0x67c0('0x4a')]({'where':{'id':_0x5a644a[_0x67c0('0x43')]['id']}})['then'](handleEntityNotFound(_0x2528ab,null))[_0x67c0('0x21')](function(_0x5bd5e8){if(_0x5bd5e8){return _0x5bd5e8[_0x67c0('0x51')](_0x5a644a[_0x67c0('0x46')][_0x67c0('0x52')]||[]);}return null;})['then'](respondWithResult(_0x2528ab,null))[_0x67c0('0x41')](handleError(_0x2528ab,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8579b6b..294d18a 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 _0xe191=['rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b4771,_0x5bcbc4){var _0xd4a7f1=function(_0x4c1d35){while(--_0x4c1d35){_0x4b4771['push'](_0x4b4771['shift']());}};_0xd4a7f1(++_0x5bcbc4);}(_0xe191,0x13e));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e19('0x0'));var util=require(_0x1e19('0x1'));var logger=require(_0x1e19('0x2'))(_0x1e19('0x3'));var moment=require(_0x1e19('0x4'));var BPromise=require(_0x1e19('0x5'));var rp=require(_0x1e19('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e19('0x7'));var config=require(_0x1e19('0x8'));var attributes=require(_0x1e19('0x9'));module[_0x1e19('0xa')]=function(_0x582aa4,_0x201672){return _0x582aa4[_0x1e19('0xb')]('DeskConfiguration',attributes,{'tableName':_0x1e19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1420=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations'];(function(_0x4cec4b,_0x15ba54){var _0x16b04a=function(_0x11e0bc){while(--_0x11e0bc){_0x4cec4b['push'](_0x4cec4b['shift']());}};_0x16b04a(++_0x15ba54);}(_0x1420,0x138));var _0x0142=function(_0x13eb22,_0x252e48){_0x13eb22=_0x13eb22-0x0;var _0x246c3f=_0x1420[_0x13eb22];return _0x246c3f;};'use strict';var _=require(_0x0142('0x0'));var util=require('util');var logger=require(_0x0142('0x1'))(_0x0142('0x2'));var moment=require(_0x0142('0x3'));var BPromise=require(_0x0142('0x4'));var rp=require(_0x0142('0x5'));var fs=require('fs');var path=require(_0x0142('0x6'));var rimraf=require(_0x0142('0x7'));var config=require(_0x0142('0x8'));var attributes=require(_0x0142('0x9'));module[_0x0142('0xa')]=function(_0x42bbea,_0x5ddaf3){return _0x42bbea[_0x0142('0xb')]('DeskConfiguration',attributes,{'tableName':_0x0142('0xc'),'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 df6996e..a450586 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 _0xd6bc=['randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1e6951,_0x4d39ee){var _0x235723=function(_0x41180e){while(--_0x41180e){_0x1e6951['push'](_0x1e6951['shift']());}};_0x235723(++_0x4d39ee);}(_0xd6bc,0x1a0));var _0xcd6b=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xd6bc[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xcd6b('0x0'));var util=require(_0xcd6b('0x1'));var moment=require(_0xcd6b('0x2'));var BPromise=require(_0xcd6b('0x3'));var rs=require(_0xcd6b('0x4'));var fs=require('fs');var Redis=require(_0xcd6b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd6b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcd6b('0x7'));var client=jayson[_0xcd6b('0x8')][_0xcd6b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x108abd,_0x35822a,_0x2f1ab0){return new BPromise(function(_0x306f0d,_0x3a2111){return client[_0xcd6b('0xa')](_0x108abd,_0x2f1ab0)['then'](function(_0x4f32e7){logger['info'](_0xcd6b('0xb'),_0x35822a,_0xcd6b('0xc'));logger['debug'](_0xcd6b('0xd'),_0x35822a,'request\x20sent',JSON[_0xcd6b('0xe')](_0x4f32e7));if(_0x4f32e7['error']){if(_0x4f32e7[_0xcd6b('0xf')][_0xcd6b('0x10')]===0x1f4){logger[_0xcd6b('0xf')](_0xcd6b('0xb'),_0x35822a,_0x4f32e7['error']['message']);return _0x3a2111(_0x4f32e7['error'][_0xcd6b('0x11')]);}logger[_0xcd6b('0xf')](_0xcd6b('0xb'),_0x35822a,_0x4f32e7[_0xcd6b('0xf')]['message']);return _0x306f0d(_0x4f32e7[_0xcd6b('0xf')][_0xcd6b('0x11')]);}else{logger['info'](_0xcd6b('0xb'),_0x35822a,_0xcd6b('0xc'));_0x306f0d(_0x4f32e7[_0xcd6b('0x12')][_0xcd6b('0x11')]);}})[_0xcd6b('0x13')](function(_0xdc016f){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x35822a,_0xdc016f);_0x3a2111(_0xdc016f);});});} \ No newline at end of file +var _0x6000=['request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x40bfc2,_0x538e26){var _0x14d1db=function(_0x3c46bc){while(--_0x3c46bc){_0x40bfc2['push'](_0x40bfc2['shift']());}};_0x14d1db(++_0x538e26);}(_0x6000,0x17c));var _0x0600=function(_0x161c3f,_0x35c2bb){_0x161c3f=_0x161c3f-0x0;var _0x1c27bb=_0x6000[_0x161c3f];return _0x1c27bb;};'use strict';var _=require(_0x0600('0x0'));var util=require(_0x0600('0x1'));var moment=require(_0x0600('0x2'));var BPromise=require(_0x0600('0x3'));var rs=require(_0x0600('0x4'));var fs=require('fs');var Redis=require(_0x0600('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0600('0x6'));var logger=require(_0x0600('0x7'))('rpc');var config=require(_0x0600('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0600('0x9')][_0x0600('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89927a,_0x559495,_0x45e348){return new BPromise(function(_0x5730b2,_0x15b6d2){return client[_0x0600('0xb')](_0x89927a,_0x45e348)[_0x0600('0xc')](function(_0xacb924){logger[_0x0600('0xd')](_0x0600('0xe'),_0x559495,_0x0600('0xf'));logger[_0x0600('0x10')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x559495,_0x0600('0xf'),JSON[_0x0600('0x11')](_0xacb924));if(_0xacb924['error']){if(_0xacb924[_0x0600('0x12')][_0x0600('0x13')]===0x1f4){logger[_0x0600('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x559495,_0xacb924[_0x0600('0x12')]['message']);return _0x15b6d2(_0xacb924[_0x0600('0x12')][_0x0600('0x14')]);}logger[_0x0600('0x12')](_0x0600('0xe'),_0x559495,_0xacb924[_0x0600('0x12')]['message']);return _0x5730b2(_0xacb924[_0x0600('0x12')][_0x0600('0x14')]);}else{logger['info'](_0x0600('0xe'),_0x559495,_0x0600('0xf'));_0x5730b2(_0xacb924[_0x0600('0x15')][_0x0600('0x14')]);}})[_0x0600('0x16')](function(_0x31ced0){logger[_0x0600('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x559495,_0x31ced0);_0x15b6d2(_0x31ced0);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index c94e550..afa8d45 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 _0x6802=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','put'];(function(_0x1d0678,_0x30d5d7){var _0x358b35=function(_0x51b260){while(--_0x51b260){_0x1d0678['push'](_0x1d0678['shift']());}};_0x358b35(++_0x30d5d7);}(_0x6802,0x123));var _0x2680=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x6802[_0x257642];return _0x3d813b;};'use strict';var multer=require(_0x2680('0x0'));var util=require(_0x2680('0x1'));var path=require(_0x2680('0x2'));var timeout=require('connect-timeout');var express=require(_0x2680('0x3'));var router=express[_0x2680('0x4')]();var fs_extra=require(_0x2680('0x5'));var auth=require(_0x2680('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2680('0x7'));var controller=require(_0x2680('0x8'));router[_0x2680('0x9')]('/',auth[_0x2680('0xa')](),controller['index']);router[_0x2680('0x9')](_0x2680('0xb'),auth[_0x2680('0xa')](),controller[_0x2680('0xc')]);router[_0x2680('0xd')]('/',auth[_0x2680('0xa')](),controller['create']);router[_0x2680('0xe')]('/:id',auth[_0x2680('0xa')](),controller[_0x2680('0xf')]);router[_0x2680('0x10')](_0x2680('0xb'),auth[_0x2680('0xa')](),controller[_0x2680('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa33a=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x4f2311,_0x55eb10){var _0x58efa8=function(_0x3af91e){while(--_0x3af91e){_0x4f2311['push'](_0x4f2311['shift']());}};_0x58efa8(++_0x55eb10);}(_0xa33a,0xd0));var _0xaa33=function(_0x6fa0ae,_0x1d8109){_0x6fa0ae=_0x6fa0ae-0x0;var _0x38884e=_0xa33a[_0x6fa0ae];return _0x38884e;};'use strict';var multer=require(_0xaa33('0x0'));var util=require(_0xaa33('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaa33('0x2'));var router=express[_0xaa33('0x3')]();var fs_extra=require(_0xaa33('0x4'));var auth=require(_0xaa33('0x5'));var interaction=require(_0xaa33('0x6'));var config=require(_0xaa33('0x7'));var controller=require('./intDeskField.controller');router[_0xaa33('0x8')]('/',auth[_0xaa33('0x9')](),controller[_0xaa33('0xa')]);router['get'](_0xaa33('0xb'),auth['isAuthenticated'](),controller[_0xaa33('0xc')]);router[_0xaa33('0xd')]('/',auth[_0xaa33('0x9')](),controller['create']);router[_0xaa33('0xe')](_0xaa33('0xb'),auth[_0xaa33('0x9')](),controller[_0xaa33('0xf')]);router[_0xaa33('0x10')](_0xaa33('0xb'),auth[_0xaa33('0x9')](),controller[_0xaa33('0x11')]);module[_0xaa33('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index fedb9cd..8f06c39 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 _0x149f=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x149f,0x1ef));var _0xf149=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x149f[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require(_0xf149('0x0'));module['exports']={'type':{'type':Sequelize[_0xf149('0x1')](_0xf149('0x2'),_0xf149('0x3'),_0xf149('0x4'),_0xf149('0x5'),_0xf149('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf149('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf149('0x1')](_0xf149('0x2'),_0xf149('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xf149('0x7')]},'idField':{'type':Sequelize[_0xf149('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf149('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf149('0x7')]}}; \ No newline at end of file +var _0x7284=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x6f65ae,_0x797e){var _0x3f635e=function(_0x353dea){while(--_0x353dea){_0x6f65ae['push'](_0x6f65ae['shift']());}};_0x3f635e(++_0x797e);}(_0x7284,0x17e));var _0x4728=function(_0x2bb0af,_0x574d91){_0x2bb0af=_0x2bb0af-0x0;var _0x48422d=_0x7284[_0x2bb0af];return _0x48422d;};'use strict';var Sequelize=require(_0x4728('0x0'));module[_0x4728('0x1')]={'type':{'type':Sequelize[_0x4728('0x2')]('string',_0x4728('0x3'),_0x4728('0x4'),_0x4728('0x5'),_0x4728('0x6')),'defaultValue':_0x4728('0x7')},'content':{'type':Sequelize[_0x4728('0x8')]},'key':{'type':Sequelize[_0x4728('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x4728('0x3'),_0x4728('0x4'))},'keyContent':{'type':Sequelize[_0x4728('0x8')]},'idField':{'type':Sequelize[_0x4728('0x8')]},'nameField':{'type':Sequelize[_0x4728('0x8')]},'customField':{'type':Sequelize[_0x4728('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4728('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index a106ad0..57f4c33 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 _0xfbff=['fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','DeskField','rawAttributes'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xfbff,0x156));var _0xffbf=function(_0x1d3791,_0x51c613){_0x1d3791=_0x1d3791-0x0;var _0x40fbf5=_0xfbff[_0x1d3791];return _0x40fbf5;};'use strict';var emlformat=require(_0xffbf('0x0'));var rimraf=require(_0xffbf('0x1'));var zipdir=require(_0xffbf('0x2'));var jsonpatch=require(_0xffbf('0x3'));var rp=require(_0xffbf('0x4'));var moment=require(_0xffbf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xffbf('0x6'));var path=require(_0xffbf('0x7'));var sox=require(_0xffbf('0x8'));var csv=require(_0xffbf('0x9'));var ejs=require(_0xffbf('0xa'));var fs=require('fs');var fs_extra=require(_0xffbf('0xb'));var _=require(_0xffbf('0xc'));var squel=require(_0xffbf('0xd'));var crypto=require(_0xffbf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xffbf('0xf'));var toCsv=require('to-csv');var querystring=require(_0xffbf('0x10'));var Papa=require(_0xffbf('0x11'));var Redis=require(_0xffbf('0x12'));var authService=require(_0xffbf('0x13'));var qs=require(_0xffbf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffbf('0x15'));var logger=require(_0xffbf('0x16'))(_0xffbf('0x17'));var utils=require(_0xffbf('0x18'));var config=require(_0xffbf('0x19'));var licenseUtil=require(_0xffbf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2be9e9,_0x38da0b){_0x38da0b=_0x38da0b||0xcc;return function(_0x3e8f0f){if(_0x3e8f0f){return _0x2be9e9[_0xffbf('0x1b')](_0x38da0b);}return _0x2be9e9['status'](_0x38da0b)[_0xffbf('0x1c')]();};}function respondWithResult(_0x2801b0,_0x4b1f3d){_0x4b1f3d=_0x4b1f3d||0xc8;return function(_0x354ff9){if(_0x354ff9){return _0x2801b0[_0xffbf('0x1d')](_0x4b1f3d)[_0xffbf('0x1e')](_0x354ff9);}};}function respondWithFilteredResult(_0x345ae7,_0x23f0ca){return function(_0x132200){if(_0x132200){var _0x11f679=typeof _0x23f0ca[_0xffbf('0x1f')]===_0xffbf('0x20')&&typeof _0x23f0ca[_0xffbf('0x21')]===_0xffbf('0x20');var _0x175ec9=_0x132200[_0xffbf('0x22')];var _0x30a8c1=_0x11f679?0x0:_0x23f0ca[_0xffbf('0x1f')];var _0x8f2182=_0x11f679?_0x132200[_0xffbf('0x22')]:_0x23f0ca[_0xffbf('0x1f')]+_0x23f0ca[_0xffbf('0x21')];var _0x29574b;if(_0x8f2182>=_0x175ec9){_0x8f2182=_0x175ec9;_0x29574b=0xc8;}else{_0x29574b=0xce;}_0x345ae7[_0xffbf('0x1d')](_0x29574b);return _0x345ae7[_0xffbf('0x23')](_0xffbf('0x24'),_0x30a8c1+'-'+_0x8f2182+'/'+_0x175ec9)[_0xffbf('0x1e')](_0x132200);}return null;};}function patchUpdates(_0x1124c4){return function(_0x33cf6d){try{jsonpatch['apply'](_0x33cf6d,_0x1124c4,!![]);}catch(_0x5b82ff){return BPromise[_0xffbf('0x25')](_0x5b82ff);}return _0x33cf6d[_0xffbf('0x26')]();};}function saveUpdates(_0xa200b,_0x275db1){return function(_0x495834){if(_0x495834){return _0x495834[_0xffbf('0x27')](_0xa200b)[_0xffbf('0x28')](function(_0x24401f){return _0x24401f;});}return null;};}function removeEntity(_0x3ede1f,_0x33ea52){return function(_0x310ba8){if(_0x310ba8){return _0x310ba8[_0xffbf('0x29')]()['then'](function(){_0x3ede1f['status'](0xcc)[_0xffbf('0x1c')]();});}};}function handleEntityNotFound(_0x198260,_0x581190){return function(_0xba55ab){if(!_0xba55ab){_0x198260[_0xffbf('0x1b')](0x194);}return _0xba55ab;};}function handleError(_0x33eb1a,_0x1bab6b){_0x1bab6b=_0x1bab6b||0x1f4;return function(_0x98301){logger[_0xffbf('0x2a')](_0x98301[_0xffbf('0x2b')]);if(_0x98301[_0xffbf('0x2c')]){delete _0x98301[_0xffbf('0x2c')];}_0x33eb1a[_0xffbf('0x1d')](_0x1bab6b)['send'](_0x98301);};}exports[_0xffbf('0x2d')]=function(_0x581dd6,_0x580b16){var _0x215a36={},_0x3b9657={},_0x40640d={'count':0x0,'rows':[]};var _0x53df97=_['map'](db[_0xffbf('0x2e')][_0xffbf('0x2f')],function(_0x38bd54){return{'name':_0x38bd54[_0xffbf('0x30')],'type':_0x38bd54[_0xffbf('0x31')]['key']};});_0x3b9657[_0xffbf('0x32')]=_[_0xffbf('0x33')](_0x53df97,_0xffbf('0x2c'));_0x3b9657['query']=_[_0xffbf('0x34')](_0x581dd6[_0xffbf('0x35')]);_0x3b9657[_0xffbf('0x36')]=_['intersection'](_0x3b9657['model'],_0x3b9657[_0xffbf('0x35')]);_0x215a36[_0xffbf('0x37')]=_[_0xffbf('0x38')](_0x3b9657[_0xffbf('0x32')],qs['fields'](_0x581dd6[_0xffbf('0x35')][_0xffbf('0x39')]));_0x215a36[_0xffbf('0x37')]=_0x215a36['attributes'][_0xffbf('0x3a')]?_0x215a36[_0xffbf('0x37')]:_0x3b9657['model'];if(!_0x581dd6[_0xffbf('0x35')][_0xffbf('0x3b')](_0xffbf('0x3c'))){_0x215a36[_0xffbf('0x21')]=qs[_0xffbf('0x21')](_0x581dd6[_0xffbf('0x35')][_0xffbf('0x21')]);_0x215a36['offset']=qs['offset'](_0x581dd6[_0xffbf('0x35')][_0xffbf('0x1f')]);}_0x215a36[_0xffbf('0x3d')]=qs['sort'](_0x581dd6[_0xffbf('0x35')][_0xffbf('0x3e')]);_0x215a36[_0xffbf('0x3f')]=qs[_0xffbf('0x36')](_[_0xffbf('0x40')](_0x581dd6[_0xffbf('0x35')],_0x3b9657[_0xffbf('0x36')]),_0x53df97);if(_0x581dd6['query']['filter']){_0x215a36[_0xffbf('0x3f')]=_[_0xffbf('0x41')](_0x215a36['where'],{'$or':_['map'](_0x53df97,function(_0x1cbfad){if(_0x1cbfad[_0xffbf('0x31')]!==_0xffbf('0x42')){var _0x501f69={};_0x501f69[_0x1cbfad['name']]={'$like':'%'+_0x581dd6[_0xffbf('0x35')][_0xffbf('0x43')]+'%'};return _0x501f69;}})});}_0x215a36=_[_0xffbf('0x41')]({},_0x215a36,_0x581dd6[_0xffbf('0x44')]);var _0x319ac8={'where':_0x215a36[_0xffbf('0x3f')]};return db[_0xffbf('0x2e')]['count'](_0x319ac8)[_0xffbf('0x28')](function(_0x116669){_0x40640d[_0xffbf('0x22')]=_0x116669;if(_0x581dd6['query'][_0xffbf('0x45')]){_0x215a36[_0xffbf('0x46')]=[{'all':!![]}];}return db[_0xffbf('0x2e')]['findAll'](_0x215a36);})[_0xffbf('0x28')](function(_0x2c4714){_0x40640d[_0xffbf('0x47')]=_0x2c4714;return _0x40640d;})[_0xffbf('0x28')](respondWithFilteredResult(_0x580b16,_0x215a36))[_0xffbf('0x48')](handleError(_0x580b16,null));};exports[_0xffbf('0x49')]=function(_0x577061,_0x1ceec7){var _0x35813c={'raw':!![],'where':{'id':_0x577061[_0xffbf('0x4a')]['id']}},_0x34233b={};_0x34233b[_0xffbf('0x32')]=_[_0xffbf('0x34')](db[_0xffbf('0x2e')][_0xffbf('0x2f')]);_0x34233b[_0xffbf('0x35')]=_[_0xffbf('0x34')](_0x577061[_0xffbf('0x35')]);_0x34233b['filters']=_[_0xffbf('0x38')](_0x34233b['model'],_0x34233b[_0xffbf('0x35')]);_0x35813c[_0xffbf('0x37')]=_['intersection'](_0x34233b[_0xffbf('0x32')],qs[_0xffbf('0x39')](_0x577061[_0xffbf('0x35')][_0xffbf('0x39')]));_0x35813c[_0xffbf('0x37')]=_0x35813c['attributes'][_0xffbf('0x3a')]?_0x35813c[_0xffbf('0x37')]:_0x34233b[_0xffbf('0x32')];if(_0x577061['query'][_0xffbf('0x45')]){_0x35813c[_0xffbf('0x46')]=[{'all':!![]}];}_0x35813c=_[_0xffbf('0x41')]({},_0x35813c,_0x577061['options']);return db[_0xffbf('0x2e')][_0xffbf('0x4b')](_0x35813c)['then'](handleEntityNotFound(_0x1ceec7,null))[_0xffbf('0x28')](respondWithResult(_0x1ceec7,null))[_0xffbf('0x48')](handleError(_0x1ceec7,null));};exports[_0xffbf('0x4c')]=function(_0x40ee8b,_0x29a8c3){return db['DeskField']['create'](_0x40ee8b[_0xffbf('0x4d')],{})[_0xffbf('0x28')](respondWithResult(_0x29a8c3,0xc9))['catch'](handleError(_0x29a8c3,null));};exports['update']=function(_0x56ce96,_0x3afc57){if(_0x56ce96[_0xffbf('0x4d')]['id']){delete _0x56ce96[_0xffbf('0x4d')]['id'];}return db[_0xffbf('0x2e')]['find']({'where':{'id':_0x56ce96[_0xffbf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3afc57,null))[_0xffbf('0x28')](saveUpdates(_0x56ce96[_0xffbf('0x4d')],null))[_0xffbf('0x28')](respondWithResult(_0x3afc57,null))[_0xffbf('0x48')](handleError(_0x3afc57,null));};exports[_0xffbf('0x29')]=function(_0xf3b89b,_0x46c180){return db[_0xffbf('0x2e')][_0xffbf('0x4b')]({'where':{'id':_0xf3b89b[_0xffbf('0x4a')]['id']}})[_0xffbf('0x28')](handleEntityNotFound(_0x46c180,null))[_0xffbf('0x28')](removeEntity(_0x46c180,null))[_0xffbf('0x48')](handleError(_0x46c180,null));}; \ No newline at end of file +var _0x99d2=['status','end','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x99d2,0xcd));var _0x299d=function(_0x5c600d,_0xd62865){_0x5c600d=_0x5c600d-0x0;var _0x4bb107=_0x99d2[_0x5c600d];return _0x4bb107;};'use strict';var emlformat=require(_0x299d('0x0'));var rimraf=require(_0x299d('0x1'));var zipdir=require(_0x299d('0x2'));var jsonpatch=require(_0x299d('0x3'));var rp=require(_0x299d('0x4'));var moment=require(_0x299d('0x5'));var BPromise=require(_0x299d('0x6'));var Mustache=require(_0x299d('0x7'));var util=require(_0x299d('0x8'));var path=require(_0x299d('0x9'));var sox=require(_0x299d('0xa'));var csv=require(_0x299d('0xb'));var ejs=require(_0x299d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x299d('0xd'));var crypto=require('crypto');var jsforce=require(_0x299d('0xe'));var deskjs=require(_0x299d('0xf'));var toCsv=require(_0x299d('0xb'));var querystring=require(_0x299d('0x10'));var Papa=require(_0x299d('0x11'));var Redis=require(_0x299d('0x12'));var authService=require(_0x299d('0x13'));var qs=require(_0x299d('0x14'));var as=require(_0x299d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x299d('0x16'))(_0x299d('0x17'));var utils=require(_0x299d('0x18'));var config=require(_0x299d('0x19'));var licenseUtil=require(_0x299d('0x1a'));var db=require(_0x299d('0x1b'))['db'];function respondWithStatusCode(_0xa73a3d,_0x205015){_0x205015=_0x205015||0xcc;return function(_0x2e7349){if(_0x2e7349){return _0xa73a3d[_0x299d('0x1c')](_0x205015);}return _0xa73a3d[_0x299d('0x1d')](_0x205015)[_0x299d('0x1e')]();};}function respondWithResult(_0xcd2b4b,_0x550c1e){_0x550c1e=_0x550c1e||0xc8;return function(_0x564448){if(_0x564448){return _0xcd2b4b[_0x299d('0x1d')](_0x550c1e)['json'](_0x564448);}};}function respondWithFilteredResult(_0x31a2c6,_0x3d4d8b){return function(_0x1b583b){if(_0x1b583b){var _0x266828=typeof _0x3d4d8b['offset']===_0x299d('0x1f')&&typeof _0x3d4d8b[_0x299d('0x20')]===_0x299d('0x1f');var _0xeeb079=_0x1b583b[_0x299d('0x21')];var _0x4610cd=_0x266828?0x0:_0x3d4d8b['offset'];var _0x2d1f62=_0x266828?_0x1b583b[_0x299d('0x21')]:_0x3d4d8b['offset']+_0x3d4d8b[_0x299d('0x20')];var _0x1d8b8b;if(_0x2d1f62>=_0xeeb079){_0x2d1f62=_0xeeb079;_0x1d8b8b=0xc8;}else{_0x1d8b8b=0xce;}_0x31a2c6[_0x299d('0x1d')](_0x1d8b8b);return _0x31a2c6[_0x299d('0x22')](_0x299d('0x23'),_0x4610cd+'-'+_0x2d1f62+'/'+_0xeeb079)[_0x299d('0x24')](_0x1b583b);}return null;};}function patchUpdates(_0x5b6895){return function(_0xa4912a){try{jsonpatch[_0x299d('0x25')](_0xa4912a,_0x5b6895,!![]);}catch(_0x165367){return BPromise['reject'](_0x165367);}return _0xa4912a[_0x299d('0x26')]();};}function saveUpdates(_0x3bf61c,_0x5b556c){return function(_0xfd06e5){if(_0xfd06e5){return _0xfd06e5[_0x299d('0x27')](_0x3bf61c)['then'](function(_0x501521){return _0x501521;});}return null;};}function removeEntity(_0xf7eb09,_0x1813e9){return function(_0x1e447c){if(_0x1e447c){return _0x1e447c[_0x299d('0x28')]()[_0x299d('0x29')](function(){_0xf7eb09[_0x299d('0x1d')](0xcc)[_0x299d('0x1e')]();});}};}function handleEntityNotFound(_0x471662,_0x53104e){return function(_0x5beef8){if(!_0x5beef8){_0x471662[_0x299d('0x1c')](0x194);}return _0x5beef8;};}function handleError(_0x1aae61,_0x5b575f){_0x5b575f=_0x5b575f||0x1f4;return function(_0xf6115d){logger[_0x299d('0x2a')](_0xf6115d[_0x299d('0x2b')]);if(_0xf6115d[_0x299d('0x2c')]){delete _0xf6115d[_0x299d('0x2c')];}_0x1aae61[_0x299d('0x1d')](_0x5b575f)['send'](_0xf6115d);};}exports['index']=function(_0x19cd7e,_0x4ce9d4){var _0x45e766={},_0x37355b={},_0x535b67={'count':0x0,'rows':[]};var _0x23071e=_[_0x299d('0x2d')](db[_0x299d('0x2e')][_0x299d('0x2f')],function(_0x3c86f6){return{'name':_0x3c86f6[_0x299d('0x30')],'type':_0x3c86f6[_0x299d('0x31')][_0x299d('0x32')]};});_0x37355b[_0x299d('0x33')]=_[_0x299d('0x2d')](_0x23071e,'name');_0x37355b[_0x299d('0x34')]=_[_0x299d('0x35')](_0x19cd7e[_0x299d('0x34')]);_0x37355b[_0x299d('0x36')]=_[_0x299d('0x37')](_0x37355b['model'],_0x37355b['query']);_0x45e766[_0x299d('0x38')]=_[_0x299d('0x37')](_0x37355b[_0x299d('0x33')],qs[_0x299d('0x39')](_0x19cd7e[_0x299d('0x34')][_0x299d('0x39')]));_0x45e766['attributes']=_0x45e766[_0x299d('0x38')][_0x299d('0x3a')]?_0x45e766[_0x299d('0x38')]:_0x37355b[_0x299d('0x33')];if(!_0x19cd7e[_0x299d('0x34')]['hasOwnProperty'](_0x299d('0x3b'))){_0x45e766[_0x299d('0x20')]=qs['limit'](_0x19cd7e[_0x299d('0x34')][_0x299d('0x20')]);_0x45e766['offset']=qs['offset'](_0x19cd7e[_0x299d('0x34')]['offset']);}_0x45e766[_0x299d('0x3c')]=qs['sort'](_0x19cd7e['query'][_0x299d('0x3d')]);_0x45e766[_0x299d('0x3e')]=qs['filters'](_[_0x299d('0x3f')](_0x19cd7e[_0x299d('0x34')],_0x37355b[_0x299d('0x36')]),_0x23071e);if(_0x19cd7e[_0x299d('0x34')][_0x299d('0x40')]){_0x45e766['where']=_[_0x299d('0x41')](_0x45e766[_0x299d('0x3e')],{'$or':_[_0x299d('0x2d')](_0x23071e,function(_0x5b767b){if(_0x5b767b['type']!==_0x299d('0x42')){var _0x186df2={};_0x186df2[_0x5b767b[_0x299d('0x2c')]]={'$like':'%'+_0x19cd7e['query'][_0x299d('0x40')]+'%'};return _0x186df2;}})});}_0x45e766=_[_0x299d('0x41')]({},_0x45e766,_0x19cd7e[_0x299d('0x43')]);var _0x44a61e={'where':_0x45e766[_0x299d('0x3e')]};return db[_0x299d('0x2e')][_0x299d('0x21')](_0x44a61e)[_0x299d('0x29')](function(_0x4060d0){_0x535b67[_0x299d('0x21')]=_0x4060d0;if(_0x19cd7e['query'][_0x299d('0x44')]){_0x45e766['include']=[{'all':!![]}];}return db[_0x299d('0x2e')][_0x299d('0x45')](_0x45e766);})['then'](function(_0x113e7c){_0x535b67[_0x299d('0x46')]=_0x113e7c;return _0x535b67;})[_0x299d('0x29')](respondWithFilteredResult(_0x4ce9d4,_0x45e766))[_0x299d('0x47')](handleError(_0x4ce9d4,null));};exports[_0x299d('0x48')]=function(_0x25ae44,_0x243f9f){var _0x5ef5e5={'raw':!![],'where':{'id':_0x25ae44['params']['id']}},_0x3e6ac3={};_0x3e6ac3[_0x299d('0x33')]=_[_0x299d('0x35')](db[_0x299d('0x2e')][_0x299d('0x2f')]);_0x3e6ac3[_0x299d('0x34')]=_[_0x299d('0x35')](_0x25ae44['query']);_0x3e6ac3[_0x299d('0x36')]=_['intersection'](_0x3e6ac3[_0x299d('0x33')],_0x3e6ac3[_0x299d('0x34')]);_0x5ef5e5[_0x299d('0x38')]=_[_0x299d('0x37')](_0x3e6ac3[_0x299d('0x33')],qs['fields'](_0x25ae44[_0x299d('0x34')][_0x299d('0x39')]));_0x5ef5e5['attributes']=_0x5ef5e5[_0x299d('0x38')]['length']?_0x5ef5e5['attributes']:_0x3e6ac3['model'];if(_0x25ae44[_0x299d('0x34')][_0x299d('0x44')]){_0x5ef5e5[_0x299d('0x49')]=[{'all':!![]}];}_0x5ef5e5=_['merge']({},_0x5ef5e5,_0x25ae44[_0x299d('0x43')]);return db[_0x299d('0x2e')][_0x299d('0x4a')](_0x5ef5e5)[_0x299d('0x29')](handleEntityNotFound(_0x243f9f,null))[_0x299d('0x29')](respondWithResult(_0x243f9f,null))[_0x299d('0x47')](handleError(_0x243f9f,null));};exports[_0x299d('0x4b')]=function(_0x2bae8d,_0x4164e3){return db['DeskField'][_0x299d('0x4b')](_0x2bae8d[_0x299d('0x4c')],{})[_0x299d('0x29')](respondWithResult(_0x4164e3,0xc9))[_0x299d('0x47')](handleError(_0x4164e3,null));};exports[_0x299d('0x27')]=function(_0x4c154c,_0x1604f8){if(_0x4c154c[_0x299d('0x4c')]['id']){delete _0x4c154c[_0x299d('0x4c')]['id'];}return db[_0x299d('0x2e')][_0x299d('0x4a')]({'where':{'id':_0x4c154c[_0x299d('0x4d')]['id']}})[_0x299d('0x29')](handleEntityNotFound(_0x1604f8,null))[_0x299d('0x29')](saveUpdates(_0x4c154c[_0x299d('0x4c')],null))['then'](respondWithResult(_0x1604f8,null))['catch'](handleError(_0x1604f8,null));};exports['destroy']=function(_0x2cb2ed,_0x33220a){return db[_0x299d('0x2e')][_0x299d('0x4a')]({'where':{'id':_0x2cb2ed[_0x299d('0x4d')]['id']}})[_0x299d('0x29')](handleEntityNotFound(_0x33220a,null))[_0x299d('0x29')](removeEntity(_0x33220a,null))['catch'](handleError(_0x33220a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 5063cf8..d1b497e 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 _0xc586=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util'];(function(_0x21cf80,_0x1fb0a1){var _0x5c6bed=function(_0x3492c3){while(--_0x3492c3){_0x21cf80['push'](_0x21cf80['shift']());}};_0x5c6bed(++_0x1fb0a1);}(_0xc586,0xde));var _0x6c58=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc586[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x6c58('0x0'));var util=require(_0x6c58('0x1'));var logger=require(_0x6c58('0x2'))('api');var moment=require(_0x6c58('0x3'));var BPromise=require(_0x6c58('0x4'));var rp=require(_0x6c58('0x5'));var fs=require('fs');var path=require(_0x6c58('0x6'));var rimraf=require(_0x6c58('0x7'));var config=require('../../config/environment');var attributes=require(_0x6c58('0x8'));module[_0x6c58('0x9')]=function(_0x34a1cb,_0xa6b00a){return _0x34a1cb['define'](_0x6c58('0xa'),attributes,{'tableName':_0x6c58('0xb'),'paranoid':![],'indexes':[{'name':_0x6c58('0xc'),'fields':['idField',_0x6c58('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb155=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','lodash','../../config/logger','api'];(function(_0xe3025,_0x686182){var _0x592d0b=function(_0x4d249f){while(--_0x4d249f){_0xe3025['push'](_0xe3025['shift']());}};_0x592d0b(++_0x686182);}(_0xb155,0x1cb));var _0x5b15=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xb155[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x5b15('0x0'));var util=require('util');var logger=require(_0x5b15('0x1'))(_0x5b15('0x2'));var moment=require('moment');var BPromise=require(_0x5b15('0x3'));var rp=require(_0x5b15('0x4'));var fs=require('fs');var path=require(_0x5b15('0x5'));var rimraf=require(_0x5b15('0x6'));var config=require(_0x5b15('0x7'));var attributes=require(_0x5b15('0x8'));module[_0x5b15('0x9')]=function(_0x2aaf04,_0x532cfd){return _0x2aaf04[_0x5b15('0xa')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'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 2f08c26..5ca6027 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 _0x08c4=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x17b7b8,_0x37fe64){var _0x3a4a4f=function(_0x2b782a){while(--_0x2b782a){_0x17b7b8['push'](_0x17b7b8['shift']());}};_0x3a4a4f(++_0x37fe64);}(_0x08c4,0x10a));var _0x408c=function(_0x55c280,_0x54cce3){_0x55c280=_0x55c280-0x0;var _0x3b9eff=_0x08c4[_0x55c280];return _0x3b9eff;};'use strict';var _=require(_0x408c('0x0'));var util=require(_0x408c('0x1'));var moment=require(_0x408c('0x2'));var BPromise=require(_0x408c('0x3'));var rs=require(_0x408c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x408c('0x5'))['db'];var utils=require(_0x408c('0x6'));var logger=require(_0x408c('0x7'))(_0x408c('0x8'));var config=require(_0x408c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x408c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ce67f,_0x2e795a,_0xc8ac6f){return new BPromise(function(_0xb8718,_0x4c627e){return client[_0x408c('0xb')](_0x2ce67f,_0xc8ac6f)['then'](function(_0x4ab086){logger[_0x408c('0xc')](_0x408c('0xd'),_0x2e795a,_0x408c('0xe'));logger[_0x408c('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2e795a,_0x408c('0xe'),JSON[_0x408c('0x10')](_0x4ab086));if(_0x4ab086[_0x408c('0x11')]){if(_0x4ab086[_0x408c('0x11')][_0x408c('0x12')]===0x1f4){logger[_0x408c('0x11')]('DeskField,\x20%s,\x20%s',_0x2e795a,_0x4ab086['error'][_0x408c('0x13')]);return _0x4c627e(_0x4ab086['error'][_0x408c('0x13')]);}logger[_0x408c('0x11')](_0x408c('0xd'),_0x2e795a,_0x4ab086[_0x408c('0x11')][_0x408c('0x13')]);return _0xb8718(_0x4ab086[_0x408c('0x11')][_0x408c('0x13')]);}else{logger[_0x408c('0xc')](_0x408c('0xd'),_0x2e795a,_0x408c('0xe'));_0xb8718(_0x4ab086[_0x408c('0x14')][_0x408c('0x13')]);}})[_0x408c('0x15')](function(_0x34efe8){logger['error'](_0x408c('0xd'),_0x2e795a,_0x34efe8);_0x4c627e(_0x34efe8);});});} \ No newline at end of file +var _0xdeae=['error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6bec87,_0x5a2483){var _0x58b56d=function(_0x5d1cf5){while(--_0x5d1cf5){_0x6bec87['push'](_0x6bec87['shift']());}};_0x58b56d(++_0x5a2483);}(_0xdeae,0x18d));var _0xedea=function(_0x123f2b,_0x46c143){_0x123f2b=_0x123f2b-0x0;var _0x3e1efd=_0xdeae[_0x123f2b];return _0x3e1efd;};'use strict';var _=require(_0xedea('0x0'));var util=require(_0xedea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xedea('0x2'));var fs=require('fs');var Redis=require(_0xedea('0x3'));var db=require(_0xedea('0x4'))['db'];var utils=require(_0xedea('0x5'));var logger=require(_0xedea('0x6'))('rpc');var config=require(_0xedea('0x7'));var jayson=require(_0xedea('0x8'));var client=jayson[_0xedea('0x9')][_0xedea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44026d,_0x4b4944,_0x20848f){return new BPromise(function(_0x87b8a6,_0x32e6fb){return client['request'](_0x44026d,_0x20848f)[_0xedea('0xb')](function(_0x55c4bc){logger['info'](_0xedea('0xc'),_0x4b4944,_0xedea('0xd'));logger[_0xedea('0xe')](_0xedea('0xf'),_0x4b4944,_0xedea('0xd'),JSON[_0xedea('0x10')](_0x55c4bc));if(_0x55c4bc[_0xedea('0x11')]){if(_0x55c4bc[_0xedea('0x11')][_0xedea('0x12')]===0x1f4){logger['error'](_0xedea('0xc'),_0x4b4944,_0x55c4bc[_0xedea('0x11')][_0xedea('0x13')]);return _0x32e6fb(_0x55c4bc[_0xedea('0x11')][_0xedea('0x13')]);}logger[_0xedea('0x11')]('DeskField,\x20%s,\x20%s',_0x4b4944,_0x55c4bc[_0xedea('0x11')]['message']);return _0x87b8a6(_0x55c4bc[_0xedea('0x11')][_0xedea('0x13')]);}else{logger[_0xedea('0x14')]('DeskField,\x20%s,\x20%s',_0x4b4944,_0xedea('0xd'));_0x87b8a6(_0x55c4bc[_0xedea('0x15')][_0xedea('0x13')]);}})[_0xedea('0x16')](function(_0x5b4a6b){logger[_0xedea('0x11')]('DeskField,\x20%s,\x20%s',_0x4b4944,_0x5b4a6b);_0x32e6fb(_0x5b4a6b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 028b5a2..37b1f93 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 _0xb87e=['/:id','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put'];(function(_0x4e5cd0,_0x357a23){var _0x1120f4=function(_0x5076c5){while(--_0x5076c5){_0x4e5cd0['push'](_0x4e5cd0['shift']());}};_0x1120f4(++_0x357a23);}(_0xb87e,0x1a2));var _0xeb87=function(_0x5592c1,_0x48b7a4){_0x5592c1=_0x5592c1-0x0;var _0x87bb5b=_0xb87e[_0x5592c1];return _0x87bb5b;};'use strict';var multer=require(_0xeb87('0x0'));var util=require('util');var path=require(_0xeb87('0x1'));var timeout=require('connect-timeout');var express=require(_0xeb87('0x2'));var router=express[_0xeb87('0x3')]();var fs_extra=require(_0xeb87('0x4'));var auth=require(_0xeb87('0x5'));var interaction=require(_0xeb87('0x6'));var config=require(_0xeb87('0x7'));var controller=require(_0xeb87('0x8'));router[_0xeb87('0x9')]('/',auth[_0xeb87('0xa')](),controller[_0xeb87('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xeb87('0x9')]('/:id/configurations',auth[_0xeb87('0xa')](),controller[_0xeb87('0xc')]);router['get'](_0xeb87('0xd'),auth[_0xeb87('0xa')](),controller['getFields']);router[_0xeb87('0xe')]('/',auth[_0xeb87('0xa')](),controller[_0xeb87('0xf')]);router[_0xeb87('0xe')](_0xeb87('0x10'),auth['isAuthenticated'](),controller[_0xeb87('0x11')]);router[_0xeb87('0x12')](_0xeb87('0x13'),auth[_0xeb87('0xa')](),controller[_0xeb87('0x14')]);router[_0xeb87('0x15')]('/:id',auth[_0xeb87('0xa')](),controller['destroy']);module[_0xeb87('0x16')]=router; \ No newline at end of file +var _0x22e8=['post','addConfiguration','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x36d037,_0x56bde5){var _0x1815a7=function(_0x3cc8b5){while(--_0x3cc8b5){_0x36d037['push'](_0x36d037['shift']());}};_0x1815a7(++_0x56bde5);}(_0x22e8,0x69));var _0x822e=function(_0x1df8b7,_0x4732b7){_0x1df8b7=_0x1df8b7-0x0;var _0x5c919c=_0x22e8[_0x1df8b7];return _0x5c919c;};'use strict';var multer=require('multer');var util=require(_0x822e('0x0'));var path=require('path');var timeout=require(_0x822e('0x1'));var express=require(_0x822e('0x2'));var router=express['Router']();var fs_extra=require(_0x822e('0x3'));var auth=require(_0x822e('0x4'));var interaction=require(_0x822e('0x5'));var config=require(_0x822e('0x6'));var controller=require(_0x822e('0x7'));router[_0x822e('0x8')]('/',auth[_0x822e('0x9')](),controller['index']);router[_0x822e('0x8')](_0x822e('0xa'),auth[_0x822e('0x9')](),controller['show']);router['get'](_0x822e('0xb'),auth[_0x822e('0x9')](),controller[_0x822e('0xc')]);router[_0x822e('0x8')](_0x822e('0xd'),auth[_0x822e('0x9')](),controller[_0x822e('0xe')]);router['post']('/',auth[_0x822e('0x9')](),controller['create']);router[_0x822e('0xf')](_0x822e('0xb'),auth[_0x822e('0x9')](),controller[_0x822e('0x10')]);router['put'](_0x822e('0xa'),auth[_0x822e('0x9')](),controller[_0x822e('0x11')]);router[_0x822e('0x12')](_0x822e('0xa'),auth[_0x822e('0x9')](),controller['destroy']);module[_0x822e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6d5299d..ea2f2ea 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 _0x12e9=['STRING','BOOLEAN'];(function(_0x5393ad,_0x8fa4dd){var _0x3a5518=function(_0x512172){while(--_0x512172){_0x5393ad['push'](_0x5393ad['shift']());}};_0x3a5518(++_0x8fa4dd);}(_0x12e9,0x66));var _0x912e=function(_0x2380b2,_0xb9902c){_0x2380b2=_0x2380b2-0x0;var _0xf7abff=_0x12e9[_0x2380b2];return _0xf7abff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x912e('0x0')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x912e('0x0')]},'remoteUri':{'type':Sequelize[_0x912e('0x0')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x912e('0x0')]},'clientSecret':{'type':Sequelize[_0x912e('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x912e('0x0')]},'modernAuthentication':{'type':Sequelize[_0x912e('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x15c6=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2fccfa,_0x443d7a){var _0x3c4faa=function(_0x439058){while(--_0x439058){_0x2fccfa['push'](_0x2fccfa['shift']());}};_0x3c4faa(++_0x443d7a);}(_0x15c6,0x1cd));var _0x615c=function(_0x7ff50b,_0x399dc0){_0x7ff50b=_0x7ff50b-0x0;var _0x43e570=_0x15c6[_0x7ff50b];return _0x43e570;};'use strict';var Sequelize=require(_0x615c('0x0'));module[_0x615c('0x1')]={'name':{'type':Sequelize[_0x615c('0x2')]},'username':{'type':Sequelize[_0x615c('0x2')]},'password':{'type':Sequelize[_0x615c('0x2')]},'remoteUri':{'type':Sequelize[_0x615c('0x2')]},'tenantId':{'type':Sequelize[_0x615c('0x2')]},'clientId':{'type':Sequelize[_0x615c('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x615c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 3c61c01..8969e54 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 _0xc139=['msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','findOne','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data7','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','forEach','@odata.type','push','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','UserLocalizedLabel','Label','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','undefined','offset','count','limit','status','json','update','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','destroy','getConfigurations','Dynamics365Configuration','order','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','Subjects','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','exchangerate','firstresponsebykpiidname','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xc139,0x10d));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x9c13('0x0'));var qs=require(_0x9c13('0x1'));var logger=require(_0x9c13('0x2'))(_0x9c13('0x3'));var db=require(_0x9c13('0x4'))['db'];var integrations=require(_0x9c13('0x5'));function respondWithResult(_0x4c676c,_0x566722){_0x566722=_0x566722||0xc8;return function(_0x8c42c3){if(_0x8c42c3){return _0x4c676c['status'](_0x566722)['json'](_0x8c42c3);}};}function respondWithFilteredResult(_0x6b12d6,_0x1cb0ec){return function(_0x40bd76){if(_0x40bd76){var _0x221ca9=typeof _0x1cb0ec['offset']==='undefined'&&typeof _0x1cb0ec['limit']===_0x9c13('0x6');var _0x4921e9=_0x40bd76['count'];var _0x2c1a07=_0x221ca9?0x0:_0x1cb0ec[_0x9c13('0x7')];var _0x8eb4ce=_0x221ca9?_0x40bd76[_0x9c13('0x8')]:_0x1cb0ec[_0x9c13('0x7')]+_0x1cb0ec[_0x9c13('0x9')];var _0x3985d2;if(_0x8eb4ce>=_0x4921e9){_0x8eb4ce=_0x4921e9;_0x3985d2=0xc8;}else{_0x3985d2=0xce;}_0x6b12d6[_0x9c13('0xa')](_0x3985d2);return _0x6b12d6['set']('Content-Range',_0x2c1a07+'-'+_0x8eb4ce+'/'+_0x4921e9)[_0x9c13('0xb')](_0x40bd76);}return null;};}function saveUpdates(_0x134b15){return function(_0x56edfe){if(_0x56edfe){return _0x56edfe[_0x9c13('0xc')](_0x134b15)[_0x9c13('0xd')](function(_0x411699){return _0x411699;});}return null;};}function removeEntity(_0x555a00){return function(_0x14a619){if(_0x14a619){return _0x14a619['destroy']()['then'](function(){_0x555a00[_0x9c13('0xa')](0xcc)[_0x9c13('0xe')]();});}};}function handleEntityNotFound(_0x2587f0){return function(_0x393dda){if(!_0x393dda){_0x2587f0[_0x9c13('0xf')](0x194);}return _0x393dda;};}function handleError(_0x21ff59,_0x53b907){_0x53b907=_0x53b907||0x1f4;return function(_0x11db71){logger[_0x9c13('0x10')](_0x11db71[_0x9c13('0x11')]);if(_0x11db71[_0x9c13('0x12')]){delete _0x11db71[_0x9c13('0x12')];}_0x21ff59[_0x9c13('0xa')](_0x53b907)[_0x9c13('0x13')](_0x11db71);};}exports[_0x9c13('0x14')]=function(_0x4505fa,_0x4ef88f){var _0x28a375={},_0x56a597={},_0x131aca={'count':0x0,'rows':[]};var _0x5cdb70=_[_0x9c13('0x15')](db[_0x9c13('0x16')]['rawAttributes'],function(_0x1d40af){return{'name':_0x1d40af['fieldName'],'type':_0x1d40af[_0x9c13('0x17')][_0x9c13('0x18')]};});_0x56a597['model']=_[_0x9c13('0x15')](_0x5cdb70,_0x9c13('0x12'));_0x56a597['query']=_['keys'](_0x4505fa[_0x9c13('0x19')]);_0x56a597[_0x9c13('0x1a')]=_['intersection'](_0x56a597[_0x9c13('0x1b')],_0x56a597[_0x9c13('0x19')]);_0x28a375[_0x9c13('0x1c')]=_[_0x9c13('0x1d')](_0x56a597[_0x9c13('0x1b')],qs[_0x9c13('0x1e')](_0x4505fa[_0x9c13('0x19')]['fields']));_0x28a375[_0x9c13('0x1c')]=_0x28a375[_0x9c13('0x1c')][_0x9c13('0x1f')]?_0x28a375[_0x9c13('0x1c')]:_0x56a597[_0x9c13('0x1b')];if(!_0x4505fa[_0x9c13('0x19')][_0x9c13('0x20')](_0x9c13('0x21'))){_0x28a375[_0x9c13('0x9')]=qs[_0x9c13('0x9')](_0x4505fa[_0x9c13('0x19')][_0x9c13('0x9')]);_0x28a375[_0x9c13('0x7')]=qs[_0x9c13('0x7')](_0x4505fa[_0x9c13('0x19')][_0x9c13('0x7')]);}_0x28a375['order']=qs[_0x9c13('0x22')](_0x4505fa[_0x9c13('0x19')][_0x9c13('0x22')]);_0x28a375[_0x9c13('0x23')]=qs['filters'](_[_0x9c13('0x24')](_0x4505fa[_0x9c13('0x19')],_0x56a597['filters']),_0x5cdb70);if(_0x4505fa[_0x9c13('0x19')]['filter']){_0x28a375[_0x9c13('0x23')]=_['merge'](_0x28a375[_0x9c13('0x23')],{'$or':_['map'](_0x5cdb70,function(_0x359a6a){if(_0x359a6a[_0x9c13('0x17')]!=='VIRTUAL'){var _0x2c92cf={};_0x2c92cf[_0x359a6a[_0x9c13('0x12')]]={'$like':'%'+_0x4505fa[_0x9c13('0x19')][_0x9c13('0x25')]+'%'};return _0x2c92cf;}})});}_0x28a375=_[_0x9c13('0x26')]({},_0x28a375,_0x4505fa[_0x9c13('0x27')]);var _0x57cbc1={'where':_0x28a375[_0x9c13('0x23')]};return db[_0x9c13('0x16')][_0x9c13('0x8')](_0x57cbc1)[_0x9c13('0xd')](function(_0x864b6b){_0x131aca['count']=_0x864b6b;if(_0x4505fa[_0x9c13('0x19')][_0x9c13('0x28')]){_0x28a375[_0x9c13('0x29')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x9c13('0x2a')](_0x28a375);})[_0x9c13('0xd')](function(_0x1a7138){_0x131aca['rows']=_0x1a7138;return _0x131aca;})[_0x9c13('0xd')](respondWithFilteredResult(_0x4ef88f,_0x28a375))[_0x9c13('0x2b')](handleError(_0x4ef88f,null));};exports[_0x9c13('0x2c')]=function(_0x4c9ede,_0x5734bb){var _0x23d95c={'raw':![],'where':{'id':_0x4c9ede[_0x9c13('0x2d')]['id']}},_0x33336d={};_0x33336d[_0x9c13('0x1b')]=_[_0x9c13('0x2e')](db[_0x9c13('0x16')][_0x9c13('0x2f')]);_0x33336d[_0x9c13('0x19')]=_[_0x9c13('0x2e')](_0x4c9ede[_0x9c13('0x19')]);_0x33336d[_0x9c13('0x1a')]=_[_0x9c13('0x1d')](_0x33336d[_0x9c13('0x1b')],_0x33336d['query']);_0x23d95c[_0x9c13('0x1c')]=_[_0x9c13('0x1d')](_0x33336d['model'],qs[_0x9c13('0x1e')](_0x4c9ede[_0x9c13('0x19')]['fields']));_0x23d95c['attributes']=_0x23d95c['attributes'][_0x9c13('0x1f')]?_0x23d95c[_0x9c13('0x1c')]:_0x33336d[_0x9c13('0x1b')];if(_0x4c9ede[_0x9c13('0x19')][_0x9c13('0x28')]){_0x23d95c[_0x9c13('0x29')]=[{'all':!![]}];}_0x23d95c=_['merge']({},_0x23d95c,_0x4c9ede['options']);return db[_0x9c13('0x16')][_0x9c13('0x30')](_0x23d95c)[_0x9c13('0xd')](handleEntityNotFound(_0x5734bb,null))[_0x9c13('0xd')](respondWithResult(_0x5734bb,null))['catch'](handleError(_0x5734bb,null));};exports[_0x9c13('0x31')]=function(_0x36cae6,_0x521023){return db[_0x9c13('0x16')][_0x9c13('0x31')](_0x36cae6['body'],{})['then'](respondWithResult(_0x521023,0xc9))['catch'](handleError(_0x521023,null));};exports['update']=function(_0x3b6758,_0x28cbfc){if(_0x3b6758['body']['id']){delete _0x3b6758['body']['id'];}return db[_0x9c13('0x16')][_0x9c13('0x30')]({'where':{'id':_0x3b6758['params']['id']}})[_0x9c13('0xd')](handleEntityNotFound(_0x28cbfc,null))['then'](saveUpdates(_0x3b6758[_0x9c13('0x32')],null))['then'](respondWithResult(_0x28cbfc,null))[_0x9c13('0x2b')](handleError(_0x28cbfc,null));};exports[_0x9c13('0x33')]=function(_0x2fa280,_0x535c5f){return db['Dynamics365Account']['find']({'where':{'id':_0x2fa280[_0x9c13('0x2d')]['id']}})[_0x9c13('0xd')](handleEntityNotFound(_0x535c5f,null))[_0x9c13('0xd')](removeEntity(_0x535c5f,null))[_0x9c13('0x2b')](handleError(_0x535c5f,null));};exports[_0x9c13('0x34')]=function(_0x28a939,_0xd301bd){var _0x2f801b={};var _0x2f5e57={};var _0x18da88;var _0xfb62dc;return db[_0x9c13('0x16')]['findOne']({'where':{'id':_0x28a939[_0x9c13('0x2d')]['id']}})['then'](handleEntityNotFound(_0xd301bd,null))[_0x9c13('0xd')](function(_0x151181){if(_0x151181){_0x18da88=_0x151181;_0x2f5e57[_0x9c13('0x1b')]=_[_0x9c13('0x2e')](db[_0x9c13('0x35')]['rawAttributes']);_0x2f5e57[_0x9c13('0x19')]=_[_0x9c13('0x2e')](_0x28a939[_0x9c13('0x19')]);_0x2f5e57['filters']=_[_0x9c13('0x1d')](_0x2f5e57[_0x9c13('0x1b')],_0x2f5e57[_0x9c13('0x19')]);_0x2f801b[_0x9c13('0x1c')]=_[_0x9c13('0x1d')](_0x2f5e57[_0x9c13('0x1b')],qs['fields'](_0x28a939[_0x9c13('0x19')][_0x9c13('0x1e')]));_0x2f801b[_0x9c13('0x1c')]=_0x2f801b[_0x9c13('0x1c')][_0x9c13('0x1f')]?_0x2f801b['attributes']:_0x2f5e57[_0x9c13('0x1b')];_0x2f801b[_0x9c13('0x36')]=qs['sort'](_0x28a939[_0x9c13('0x19')]['sort']);_0x2f801b['where']=qs[_0x9c13('0x1a')](_[_0x9c13('0x24')](_0x28a939[_0x9c13('0x19')],_0x2f5e57[_0x9c13('0x1a')]));if(_0x28a939[_0x9c13('0x19')][_0x9c13('0x25')]){_0x2f801b['where']=_[_0x9c13('0x26')](_0x2f801b['where'],{'$or':_[_0x9c13('0x15')](_0x2f801b['attributes'],function(_0x2ebe65){var _0x2b0fab={};_0x2b0fab[_0x2ebe65]={'$like':'%'+_0x28a939[_0x9c13('0x19')][_0x9c13('0x25')]+'%'};return _0x2b0fab;})});}_0x2f801b=_[_0x9c13('0x26')]({},_0x2f801b,_0x28a939[_0x9c13('0x27')]);return _0x18da88[_0x9c13('0x34')](_0x2f801b);}})['then'](function(_0x3d0c75){if(_0x3d0c75){_0xfb62dc=_0x3d0c75[_0x9c13('0x1f')];if(!_0x28a939[_0x9c13('0x19')][_0x9c13('0x20')](_0x9c13('0x21'))){_0x2f801b[_0x9c13('0x9')]=qs['limit'](_0x28a939[_0x9c13('0x19')][_0x9c13('0x9')]);_0x2f801b[_0x9c13('0x7')]=qs[_0x9c13('0x7')](_0x28a939[_0x9c13('0x19')][_0x9c13('0x7')]);}return _0x18da88[_0x9c13('0x34')](_0x2f801b);}})[_0x9c13('0xd')](function(_0x3d63ca){if(_0x3d63ca){return _0x3d63ca?{'count':_0xfb62dc,'rows':_0x3d63ca}:null;}})[_0x9c13('0xd')](respondWithResult(_0xd301bd,null))[_0x9c13('0x2b')](handleError(_0xd301bd,null));};exports[_0x9c13('0x37')]=function(_0x2c67e0,_0x3838df){if(_0x2c67e0[_0x9c13('0x32')]['id']){delete _0x2c67e0[_0x9c13('0x32')]['id'];}return db[_0x9c13('0x16')]['findOne']({'where':{'id':_0x2c67e0[_0x9c13('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3838df,null))[_0x9c13('0xd')](function(_0x3b8788){if(_0x3b8788){_0x2c67e0[_0x9c13('0x32')][_0x9c13('0x38')]=_0x3b8788['id'];_0x2c67e0[_0x9c13('0x32')]['Subjects']=integrations[_0x9c13('0x39')](_0x2c67e0[_0x9c13('0x32')]['channel'],_0x2c67e0[_0x9c13('0x32')]['type']);_0x2c67e0[_0x9c13('0x32')][_0x9c13('0x3a')]=integrations[_0x9c13('0x3b')](_0x2c67e0[_0x9c13('0x32')]['channel'],_0x2c67e0[_0x9c13('0x32')][_0x9c13('0x17')]);return db[_0x9c13('0x35')][_0x9c13('0x31')](_0x2c67e0[_0x9c13('0x32')],{'include':[{'model':db['Dynamics365Field'],'as':_0x9c13('0x3c')},{'model':db[_0x9c13('0x3d')],'as':_0x9c13('0x3a')}]});}return null;})['then'](respondWithResult(_0x3838df,null))[_0x9c13('0x2b')](handleError(_0x3838df,null));};function sanitizeRemoteUri(_0x2a82d1){var _0x4c6079=_0x2a82d1[_0x9c13('0x3e')](-0x1);if(_0x4c6079==='/')return _0x2a82d1[_0x9c13('0x3f')](0x0,_0x2a82d1[_0x9c13('0x40')](_0x4c6079));return _0x2a82d1;}function getWebApiUrl(_0x1e1ade){return util[_0x9c13('0x41')](_0x9c13('0x42'),_0x1e1ade);}exports['getFields']=function(_0x188ffb,_0xee9034){var _0x498712=_0x188ffb['query'][_0x9c13('0x43')];var _0xb996d0=_0x498712===_0x9c13('0x44')?_0x9c13('0x45'):_0x9c13('0x46');var _0x3fca98='';var _0x304a12='';var _0x440bb2='';var _0x15857d='';var _0xa33ee0='';var _0x8511b8='';var _0x370dcc='';var _0x1404f4='';var _0x1b99bb=[_0x9c13('0x47'),'description',_0x9c13('0x48'),_0x9c13('0x49'),_0x9c13('0x4a'),_0x9c13('0x4b'),_0x9c13('0x4c'),_0x9c13('0x4d'),_0x9c13('0x4e'),_0x9c13('0x4f')];var _0x1e74f0=[_0x9c13('0x50'),_0x9c13('0x51'),_0x9c13('0x52'),'billedserviceunits',_0x9c13('0x53'),'contactidyominame',_0x9c13('0x54'),_0x9c13('0x55'),_0x9c13('0x56'),_0x9c13('0x57'),_0x9c13('0x58'),_0x9c13('0x59'),_0x9c13('0x5a'),_0x9c13('0x5b'),_0x9c13('0x5c'),_0x9c13('0x5d'),_0x9c13('0x5e'),'customeridyominame',_0x9c13('0x5f'),'entitlementidname',_0x9c13('0x60'),'entityimage_url','escalatedon',_0x9c13('0x61'),_0x9c13('0x62'),'followupby','importsequencenumber',_0x9c13('0x63'),_0x9c13('0x64'),_0x9c13('0x65'),_0x9c13('0x66'),_0x9c13('0x67'),_0x9c13('0x68'),'modifiedbyname','modifiedbyyominame',_0x9c13('0x69'),_0x9c13('0x6a'),_0x9c13('0x6b'),_0x9c13('0x6c'),_0x9c13('0x6d'),_0x9c13('0x6e'),_0x9c13('0x6f'),_0x9c13('0x70'),_0x9c13('0x71'),_0x9c13('0x72'),_0x9c13('0x73'),_0x9c13('0x74'),'primarycontactidname',_0x9c13('0x75'),_0x9c13('0x76'),_0x9c13('0x77'),_0x9c13('0x78'),_0x9c13('0x79'),'resolvebykpiidname','responseby',_0x9c13('0x7a'),_0x9c13('0x7b'),_0x9c13('0x7c'),_0x9c13('0x7d'),_0x9c13('0x7e'),_0x9c13('0x7f'),_0x9c13('0x80'),'statuscode',_0x9c13('0x81'),'ticketnumber','timezoneruleversionnumber',_0x9c13('0x82'),'traversedpath',_0x9c13('0x83'),_0x9c13('0x84')];var _0x480cca=_0x1b99bb[_0x9c13('0x85')](_0x1e74f0);return db[_0x9c13('0x16')][_0x9c13('0x86')]({'where':{'id':_0x188ffb[_0x9c13('0x2d')]['id']},'attributes':['id',_0x9c13('0x87'),_0x9c13('0x88'),_0x9c13('0x89'),_0x9c13('0x8a'),_0x9c13('0x8b'),_0x9c13('0x8c'),_0x9c13('0x8d')],'include':[{'model':db[_0x9c13('0x8e')],'as':_0x9c13('0x8e'),'attributes':['id','data5',_0x9c13('0x8f')]}]})['then'](handleEntityNotFound(_0xee9034,null))['then'](function(_0x3cc952){if(_0x3cc952){if(_0x3cc952['modernAuthentication']){_0x3cc952['access_token']=_0x3cc952[_0x9c13('0x8e')]['data5'];_0x1404f4=sanitizeRemoteUri(_0x3cc952[_0x9c13('0x8e')][_0x9c13('0x8f')]);_0x370dcc=getWebApiUrl(_0x1404f4);return _0x3cc952;}_0x1404f4=sanitizeRemoteUri(_0x3cc952[_0x9c13('0x89')]);_0x370dcc=getWebApiUrl(_0x1404f4);var _0x527148={'method':'POST','uri':_0x9c13('0x90')+_0x3cc952[_0x9c13('0x8a')]+_0x9c13('0x91'),'form':{'client_id':_0x3cc952[_0x9c13('0x8b')],'resource':_0x1404f4,'username':_0x3cc952[_0x9c13('0x87')],'password':_0x3cc952['password'],'grant_type':_0x9c13('0x88'),'client_secret':_0x3cc952['clientSecret']},'json':!![]};return rp(_0x527148);}})['then'](function(_0x300966){_0x8511b8=_0x300966[_0x9c13('0x92')];var _0x8970d0={'method':_0x9c13('0x93'),'uri':encodeURI(_0x370dcc+_0x9c13('0x94')+_0xb996d0+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x8511b8,'If-None-Match':null,'OData-Version':_0x9c13('0x95')},'json':!![]};return rp(_0x8970d0);})['then'](function(_0x483682){var _0x455bff=_0x483682[_0x9c13('0x96')][0x0];var _0x30c433=_0x455bff[_0x9c13('0x97')];var _0x3dfb56={'method':_0x9c13('0x93'),'uri':_0x370dcc+_0x9c13('0x98')+_0x30c433+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x9c13('0x99')+_0x8511b8,'If-None-Match':null,'OData-Version':_0x9c13('0x95')},'json':!![]};return rp(_0x3dfb56);})[_0x9c13('0xd')](function(_0xa372c5){_0x3fca98=_0xa372c5;_0x304a12=_0x3fca98[_0x9c13('0x9a')];_0x304a12=_[_0x9c13('0x9b')](_0x304a12,function(_0x30ad1b){return!_0x480cca[_0x9c13('0x9c')](_0x30ad1b['LogicalName']);});var _0x3dccfe=[];var _0x5294a9=[];_0x304a12[_0x9c13('0x9d')](function(_0x3cc6d7){if(_0x3cc6d7['@odata.type']){var _0x4d77b9=_0x3cc6d7[_0x9c13('0x9e')][_0x9c13('0x3f')](_0x3cc6d7[_0x9c13('0x9e')]['lastIndexOf']('.')+0x1);if(_0x4d77b9==='PicklistAttributeMetadata'){_0x3dccfe[_0x9c13('0x9f')](getSelectList(_0x370dcc,_0x498712,_0x5294a9,_0x3fca98[_0x9c13('0x97')],_0x3cc6d7['MetadataId'],_0x8511b8));}}});return Promise['all'](_0x3dccfe);})[_0x9c13('0xd')](function(_0x2f5106){_0x440bb2=_0x2f5106[0x0];var _0x15d5f7=[];var _0x239311=[];_0x304a12[_0x9c13('0x9d')](function(_0xabc3d3){if(!_[_0x9c13('0xa0')](_0xabc3d3[_0x9c13('0x9e')])){var _0x28f5dc=_0xabc3d3[_0x9c13('0x9e')][_0x9c13('0x3f')](_0xabc3d3[_0x9c13('0x9e')][_0x9c13('0x40')]('.')+0x1);if(_0x28f5dc===_0x9c13('0xa1')){_0x15d5f7['push'](getBooleanList(_0x370dcc,_0x498712,_0x239311,_0x3fca98[_0x9c13('0x97')],_0xabc3d3[_0x9c13('0x97')],_0x8511b8));}}});return Promise[_0x9c13('0xa2')](_0x15d5f7);})['then'](function(_0x6087d){_0x15857d=_0x6087d[0x0];var _0x5eb9c0=[];var _0xcafd25=[];_0x304a12[_0x9c13('0x9d')](function(_0x221872){if(_0x221872[_0x9c13('0x9e')]){var _0x55dfe0=_0x221872['@odata.type'][_0x9c13('0x3f')](_0x221872[_0x9c13('0x9e')][_0x9c13('0x40')]('.')+0x1);if(_0x55dfe0===_0x9c13('0xa3')||_0x55dfe0===_0x9c13('0xa4')||_0x55dfe0===_0x9c13('0xa5')||_0x55dfe0===_0x9c13('0xa6')||_0x55dfe0==='MemoAttributeMetadata'||_0x55dfe0===_0x9c13('0xa7')||_0x55dfe0===_0x9c13('0xa8')||_0x55dfe0===_0x9c13('0xa9')||_0x55dfe0==='StateAttributeMetadata'||_0x55dfe0===_0x9c13('0xaa')){_0x5eb9c0['push'](getInputList(_0x370dcc,_0x498712,_0x55dfe0,_0xcafd25,_0x3fca98[_0x9c13('0x97')],_0x221872[_0x9c13('0x97')],_0x8511b8));}}});return Promise[_0x9c13('0xa2')](_0x5eb9c0);})[_0x9c13('0xd')](function(_0xf5a4b6){_0xa33ee0=_0xf5a4b6[0x0];var _0x2a4959=_0x440bb2[_0x9c13('0x85')](_0x15857d)[_0x9c13('0x85')](_0xa33ee0);var _0xa0ff02={'count':_0x2a4959['length'],'rows':_0x2a4959};return _0xa0ff02;})[_0x9c13('0xd')](respondWithResult(_0xee9034,null))[_0x9c13('0x2b')](function(_0x4724f9){var _0x6885b6=_0x188ffb[_0x9c13('0x19')][_0x9c13('0xab')]?0x1f4:_0x4724f9[_0x9c13('0xac')]||0x1f4;logger[_0x9c13('0x10')](_0x4724f9[_0x9c13('0x11')]);delete _0x4724f9[_0x9c13('0x12')];if(_0x6885b6===0x191){_0x6885b6=0x190;}_0xee9034[_0x9c13('0xa')](_0x6885b6)[_0x9c13('0x13')](_0x188ffb[_0x9c13('0x19')][_0x9c13('0xab')]?{'message':_0x9c13('0xad'),'statusCode':_0x4724f9['statusCode']}:_0x4724f9);});};function getSelectList(_0xcdf06d,_0x2e60e0,_0x2e5f7b,_0x3ea187,_0x37ac5d,_0x29024e){var _0xa5adcc={'method':_0x9c13('0x93'),'uri':_0xcdf06d+_0x9c13('0x98')+_0x3ea187+_0x9c13('0xae')+_0x37ac5d+_0x9c13('0xaf')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x9c13('0x99')+_0x29024e,'If-None-Match':null,'OData-Version':_0x9c13('0x95')},'json':!![]};return rp(_0xa5adcc)[_0x9c13('0xd')](function(_0x2f9d1f){var _0x34da5b=[];var _0x49dd5b=_0x2f9d1f['OptionSet'][_0x9c13('0xb0')];_0x49dd5b[_0x9c13('0x9d')](function(_0x4cd48b){_0x34da5b['push']({'name':_0x4cd48b['Label'][_0x9c13('0xb1')][_0x9c13('0xb2')],'value':String(_0x4cd48b['Value'])});});var _0xe843da={'id':_0x2e60e0+'_'+_0x2f9d1f[_0x9c13('0xb3')],'name':_0x2f9d1f['DisplayName'][_0x9c13('0xb1')][_0x9c13('0xb2')],'custom':![],'options':_0x34da5b};_0x2e5f7b[_0x9c13('0x9f')](_0xe843da);return _0x2e5f7b;});}function getBooleanList(_0x59dc8d,_0x30fa9a,_0x3a3946,_0x5c3d11,_0xc9c80a,_0x280a6b){var _0x9a91ae={'method':'GET','uri':_0x59dc8d+_0x9c13('0x98')+_0x5c3d11+')/Attributes('+_0xc9c80a+_0x9c13('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x280a6b,'If-None-Match':null,'OData-Version':_0x9c13('0x95')},'json':!![]};return rp(_0x9a91ae)[_0x9c13('0xd')](function(_0x784b7f){var _0x559d7e=[];_0x559d7e['push']({'name':_0x784b7f[_0x9c13('0xb5')][_0x9c13('0xb6')][_0x9c13('0xb2')][_0x9c13('0xb1')]['Label'],'value':_0x9c13('0xb7')},{'name':_0x784b7f[_0x9c13('0xb5')][_0x9c13('0xb8')][_0x9c13('0xb2')]['UserLocalizedLabel']['Label'],'value':_0x9c13('0xb9')});var _0x509af0={'id':_0x30fa9a+'_'+_0x784b7f[_0x9c13('0xb3')],'name':_0x784b7f['DisplayName'][_0x9c13('0xb1')][_0x9c13('0xb2')],'custom':![],'options':_0x559d7e};_0x3a3946[_0x9c13('0x9f')](_0x509af0);return _0x3a3946;});}function getInputList(_0x290ebc,_0x1af040,_0x5e96ee,_0x1fec54,_0x4047de,_0x1aa022,_0x50a47d){var _0x4e9218={'method':_0x9c13('0x93'),'uri':_0x290ebc+_0x9c13('0x98')+_0x4047de+_0x9c13('0xae')+_0x1aa022+_0x9c13('0xba')+_0x5e96ee+_0x9c13('0xbb'),'headers':{'Authorization':_0x9c13('0x99')+_0x50a47d,'If-None-Match':null,'OData-Version':_0x9c13('0x95')},'json':!![]};return rp(_0x4e9218)[_0x9c13('0xd')](function(_0x54adc3){var _0x58efd7={'id':_0x1af040+'_'+_0x54adc3[_0x9c13('0xb3')],'name':_0x54adc3[_0x9c13('0xbc')][_0x9c13('0xb1')]?_0x54adc3['DisplayName'][_0x9c13('0xb1')]['Label']:_0x54adc3['LogicalName'],'custom':![],'options':[]};_0x1fec54[_0x9c13('0x9f')](_0x58efd7);return _0x1fec54;});} \ No newline at end of file +var _0x6b36=['DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','error','stack','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','destroy','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','lastIndexOf','format','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','subject','phonenumber','phonecall_activity_parties','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','access_token','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','substring','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value'];(function(_0x3b9d5f,_0x2e9039){var _0x39924e=function(_0x5752ee){while(--_0x5752ee){_0x3b9d5f['push'](_0x3b9d5f['shift']());}};_0x39924e(++_0x2e9039);}(_0x6b36,0xbf));var _0x66b3=function(_0x511c25,_0x15530f){_0x511c25=_0x511c25-0x0;var _0x25ebb6=_0x6b36[_0x511c25];return _0x25ebb6;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x66b3('0x0'))(_0x66b3('0x1'));var db=require(_0x66b3('0x2'))['db'];var integrations=require(_0x66b3('0x3'));function respondWithResult(_0x319c71,_0x374bb3){_0x374bb3=_0x374bb3||0xc8;return function(_0x974005){if(_0x974005){return _0x319c71[_0x66b3('0x4')](_0x374bb3)['json'](_0x974005);}};}function respondWithFilteredResult(_0x51de4c,_0x2442fc){return function(_0x22356d){if(_0x22356d){var _0x41b771=typeof _0x2442fc[_0x66b3('0x5')]===_0x66b3('0x6')&&typeof _0x2442fc[_0x66b3('0x7')]===_0x66b3('0x6');var _0x21012d=_0x22356d['count'];var _0x45071d=_0x41b771?0x0:_0x2442fc[_0x66b3('0x5')];var _0x120a74=_0x41b771?_0x22356d[_0x66b3('0x8')]:_0x2442fc['offset']+_0x2442fc['limit'];var _0x1b113a;if(_0x120a74>=_0x21012d){_0x120a74=_0x21012d;_0x1b113a=0xc8;}else{_0x1b113a=0xce;}_0x51de4c[_0x66b3('0x4')](_0x1b113a);return _0x51de4c[_0x66b3('0x9')](_0x66b3('0xa'),_0x45071d+'-'+_0x120a74+'/'+_0x21012d)['json'](_0x22356d);}return null;};}function saveUpdates(_0x46473b){return function(_0x103983){if(_0x103983){return _0x103983[_0x66b3('0xb')](_0x46473b)[_0x66b3('0xc')](function(_0x4f735a){return _0x4f735a;});}return null;};}function removeEntity(_0x236f98){return function(_0x7e5122){if(_0x7e5122){return _0x7e5122['destroy']()[_0x66b3('0xc')](function(){_0x236f98[_0x66b3('0x4')](0xcc)[_0x66b3('0xd')]();});}};}function handleEntityNotFound(_0x39ee2c){return function(_0x40c805){if(!_0x40c805){_0x39ee2c[_0x66b3('0xe')](0x194);}return _0x40c805;};}function handleError(_0x3de77e,_0x27a4a5){_0x27a4a5=_0x27a4a5||0x1f4;return function(_0x125dbe){logger[_0x66b3('0xf')](_0x125dbe[_0x66b3('0x10')]);if(_0x125dbe['name']){delete _0x125dbe['name'];}_0x3de77e[_0x66b3('0x4')](_0x27a4a5)[_0x66b3('0x11')](_0x125dbe);};}exports[_0x66b3('0x12')]=function(_0x149be4,_0x359edc){var _0xdb3fd={},_0x343945={},_0x1aeace={'count':0x0,'rows':[]};var _0x5cdf5a=_[_0x66b3('0x13')](db[_0x66b3('0x14')][_0x66b3('0x15')],function(_0x379942){return{'name':_0x379942[_0x66b3('0x16')],'type':_0x379942[_0x66b3('0x17')]['key']};});_0x343945['model']=_['map'](_0x5cdf5a,'name');_0x343945[_0x66b3('0x18')]=_['keys'](_0x149be4[_0x66b3('0x18')]);_0x343945[_0x66b3('0x19')]=_[_0x66b3('0x1a')](_0x343945['model'],_0x343945[_0x66b3('0x18')]);_0xdb3fd[_0x66b3('0x1b')]=_[_0x66b3('0x1a')](_0x343945[_0x66b3('0x1c')],qs[_0x66b3('0x1d')](_0x149be4[_0x66b3('0x18')][_0x66b3('0x1d')]));_0xdb3fd[_0x66b3('0x1b')]=_0xdb3fd[_0x66b3('0x1b')]['length']?_0xdb3fd['attributes']:_0x343945[_0x66b3('0x1c')];if(!_0x149be4[_0x66b3('0x18')][_0x66b3('0x1e')]('nolimit')){_0xdb3fd[_0x66b3('0x7')]=qs[_0x66b3('0x7')](_0x149be4['query'][_0x66b3('0x7')]);_0xdb3fd[_0x66b3('0x5')]=qs[_0x66b3('0x5')](_0x149be4['query'][_0x66b3('0x5')]);}_0xdb3fd[_0x66b3('0x1f')]=qs['sort'](_0x149be4[_0x66b3('0x18')][_0x66b3('0x20')]);_0xdb3fd[_0x66b3('0x21')]=qs['filters'](_[_0x66b3('0x22')](_0x149be4['query'],_0x343945[_0x66b3('0x19')]),_0x5cdf5a);if(_0x149be4[_0x66b3('0x18')][_0x66b3('0x23')]){_0xdb3fd[_0x66b3('0x21')]=_[_0x66b3('0x24')](_0xdb3fd[_0x66b3('0x21')],{'$or':_[_0x66b3('0x13')](_0x5cdf5a,function(_0x4e07d4){if(_0x4e07d4[_0x66b3('0x17')]!==_0x66b3('0x25')){var _0x2aa5f9={};_0x2aa5f9[_0x4e07d4[_0x66b3('0x26')]]={'$like':'%'+_0x149be4[_0x66b3('0x18')][_0x66b3('0x23')]+'%'};return _0x2aa5f9;}})});}_0xdb3fd=_[_0x66b3('0x24')]({},_0xdb3fd,_0x149be4[_0x66b3('0x27')]);var _0x1c27e8={'where':_0xdb3fd[_0x66b3('0x21')]};return db[_0x66b3('0x14')][_0x66b3('0x8')](_0x1c27e8)[_0x66b3('0xc')](function(_0x22aacc){_0x1aeace[_0x66b3('0x8')]=_0x22aacc;if(_0x149be4[_0x66b3('0x18')][_0x66b3('0x28')]){_0xdb3fd[_0x66b3('0x29')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x66b3('0x2a')](_0xdb3fd);})[_0x66b3('0xc')](function(_0x23e185){_0x1aeace[_0x66b3('0x2b')]=_0x23e185;return _0x1aeace;})[_0x66b3('0xc')](respondWithFilteredResult(_0x359edc,_0xdb3fd))[_0x66b3('0x2c')](handleError(_0x359edc,null));};exports[_0x66b3('0x2d')]=function(_0x5dec9d,_0x48541f){var _0xe76d93={'raw':![],'where':{'id':_0x5dec9d['params']['id']}},_0x3375db={};_0x3375db[_0x66b3('0x1c')]=_[_0x66b3('0x2e')](db[_0x66b3('0x14')][_0x66b3('0x15')]);_0x3375db['query']=_[_0x66b3('0x2e')](_0x5dec9d[_0x66b3('0x18')]);_0x3375db[_0x66b3('0x19')]=_['intersection'](_0x3375db[_0x66b3('0x1c')],_0x3375db[_0x66b3('0x18')]);_0xe76d93['attributes']=_['intersection'](_0x3375db['model'],qs['fields'](_0x5dec9d[_0x66b3('0x18')][_0x66b3('0x1d')]));_0xe76d93[_0x66b3('0x1b')]=_0xe76d93['attributes'][_0x66b3('0x2f')]?_0xe76d93[_0x66b3('0x1b')]:_0x3375db[_0x66b3('0x1c')];if(_0x5dec9d['query'][_0x66b3('0x28')]){_0xe76d93[_0x66b3('0x29')]=[{'all':!![]}];}_0xe76d93=_[_0x66b3('0x24')]({},_0xe76d93,_0x5dec9d[_0x66b3('0x27')]);return db[_0x66b3('0x14')][_0x66b3('0x30')](_0xe76d93)[_0x66b3('0xc')](handleEntityNotFound(_0x48541f,null))[_0x66b3('0xc')](respondWithResult(_0x48541f,null))[_0x66b3('0x2c')](handleError(_0x48541f,null));};exports[_0x66b3('0x31')]=function(_0x2d38c0,_0x447de0){return db[_0x66b3('0x14')][_0x66b3('0x31')](_0x2d38c0[_0x66b3('0x32')],{})[_0x66b3('0xc')](respondWithResult(_0x447de0,0xc9))['catch'](handleError(_0x447de0,null));};exports[_0x66b3('0xb')]=function(_0x1fd477,_0x1dba06){if(_0x1fd477['body']['id']){delete _0x1fd477[_0x66b3('0x32')]['id'];}return db['Dynamics365Account'][_0x66b3('0x30')]({'where':{'id':_0x1fd477[_0x66b3('0x33')]['id']}})[_0x66b3('0xc')](handleEntityNotFound(_0x1dba06,null))['then'](saveUpdates(_0x1fd477['body'],null))['then'](respondWithResult(_0x1dba06,null))[_0x66b3('0x2c')](handleError(_0x1dba06,null));};exports[_0x66b3('0x34')]=function(_0x12d417,_0x319f06){return db['Dynamics365Account']['find']({'where':{'id':_0x12d417[_0x66b3('0x33')]['id']}})[_0x66b3('0xc')](handleEntityNotFound(_0x319f06,null))['then'](removeEntity(_0x319f06,null))[_0x66b3('0x2c')](handleError(_0x319f06,null));};exports[_0x66b3('0x35')]=function(_0x5a595d,_0x38e777){var _0x1e06c6={};var _0x5fef6a={};var _0x16478e;var _0x2003b0;return db[_0x66b3('0x14')][_0x66b3('0x36')]({'where':{'id':_0x5a595d[_0x66b3('0x33')]['id']}})[_0x66b3('0xc')](handleEntityNotFound(_0x38e777,null))[_0x66b3('0xc')](function(_0x3e9a8f){if(_0x3e9a8f){_0x16478e=_0x3e9a8f;_0x5fef6a[_0x66b3('0x1c')]=_[_0x66b3('0x2e')](db[_0x66b3('0x37')]['rawAttributes']);_0x5fef6a[_0x66b3('0x18')]=_[_0x66b3('0x2e')](_0x5a595d[_0x66b3('0x18')]);_0x5fef6a['filters']=_[_0x66b3('0x1a')](_0x5fef6a['model'],_0x5fef6a['query']);_0x1e06c6[_0x66b3('0x1b')]=_[_0x66b3('0x1a')](_0x5fef6a[_0x66b3('0x1c')],qs[_0x66b3('0x1d')](_0x5a595d[_0x66b3('0x18')]['fields']));_0x1e06c6[_0x66b3('0x1b')]=_0x1e06c6['attributes']['length']?_0x1e06c6['attributes']:_0x5fef6a[_0x66b3('0x1c')];_0x1e06c6[_0x66b3('0x1f')]=qs[_0x66b3('0x20')](_0x5a595d[_0x66b3('0x18')][_0x66b3('0x20')]);_0x1e06c6[_0x66b3('0x21')]=qs[_0x66b3('0x19')](_['pick'](_0x5a595d[_0x66b3('0x18')],_0x5fef6a[_0x66b3('0x19')]));if(_0x5a595d[_0x66b3('0x18')]['filter']){_0x1e06c6[_0x66b3('0x21')]=_['merge'](_0x1e06c6[_0x66b3('0x21')],{'$or':_['map'](_0x1e06c6[_0x66b3('0x1b')],function(_0x3271cb){var _0x44a38d={};_0x44a38d[_0x3271cb]={'$like':'%'+_0x5a595d[_0x66b3('0x18')][_0x66b3('0x23')]+'%'};return _0x44a38d;})});}_0x1e06c6=_[_0x66b3('0x24')]({},_0x1e06c6,_0x5a595d[_0x66b3('0x27')]);return _0x16478e[_0x66b3('0x35')](_0x1e06c6);}})[_0x66b3('0xc')](function(_0x4b54d3){if(_0x4b54d3){_0x2003b0=_0x4b54d3['length'];if(!_0x5a595d[_0x66b3('0x18')][_0x66b3('0x1e')](_0x66b3('0x38'))){_0x1e06c6['limit']=qs[_0x66b3('0x7')](_0x5a595d[_0x66b3('0x18')][_0x66b3('0x7')]);_0x1e06c6[_0x66b3('0x5')]=qs[_0x66b3('0x5')](_0x5a595d['query'][_0x66b3('0x5')]);}return _0x16478e[_0x66b3('0x35')](_0x1e06c6);}})[_0x66b3('0xc')](function(_0x34f7e3){if(_0x34f7e3){return _0x34f7e3?{'count':_0x2003b0,'rows':_0x34f7e3}:null;}})[_0x66b3('0xc')](respondWithResult(_0x38e777,null))['catch'](handleError(_0x38e777,null));};exports[_0x66b3('0x39')]=function(_0x58915f,_0x1f12cb){if(_0x58915f[_0x66b3('0x32')]['id']){delete _0x58915f[_0x66b3('0x32')]['id'];}return db[_0x66b3('0x14')][_0x66b3('0x36')]({'where':{'id':_0x58915f[_0x66b3('0x33')]['id']}})[_0x66b3('0xc')](handleEntityNotFound(_0x1f12cb,null))[_0x66b3('0xc')](function(_0x54af73){if(_0x54af73){_0x58915f[_0x66b3('0x32')]['AccountId']=_0x54af73['id'];_0x58915f[_0x66b3('0x32')][_0x66b3('0x3a')]=integrations[_0x66b3('0x3b')](_0x58915f[_0x66b3('0x32')][_0x66b3('0x3c')],_0x58915f[_0x66b3('0x32')][_0x66b3('0x17')]);_0x58915f[_0x66b3('0x32')][_0x66b3('0x3d')]=integrations['getDescriptions'](_0x58915f['body']['channel'],_0x58915f[_0x66b3('0x32')]['type']);return db['Dynamics365Configuration']['create'](_0x58915f['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x66b3('0x3e')],'as':_0x66b3('0x3d')}]});}return null;})[_0x66b3('0xc')](respondWithResult(_0x1f12cb,null))[_0x66b3('0x2c')](handleError(_0x1f12cb,null));};function sanitizeRemoteUri(_0x4ed20f){var _0x5e0141=_0x4ed20f[_0x66b3('0x3f')](-0x1);if(_0x5e0141==='/')return _0x4ed20f['substring'](0x0,_0x4ed20f[_0x66b3('0x40')](_0x5e0141));return _0x4ed20f;}function getWebApiUrl(_0x189c24){return util[_0x66b3('0x41')]('%s/api/data/v9.0/',_0x189c24);}exports[_0x66b3('0x42')]=function(_0x101904,_0x130a73){var _0x5a7822=_0x101904['query'][_0x66b3('0x43')];var _0xd19f51=_0x5a7822==='incident'?_0x66b3('0x44'):_0x66b3('0x45');var _0x2838e3='';var _0xf05db2='';var _0x5381b4='';var _0x223293='';var _0x25ecef='';var _0xaf9280='';var _0x3d6a45='';var _0x117213='';var _0x4e43a9=[_0x66b3('0x46'),'description',_0x66b3('0x47'),_0x66b3('0x48'),'caseorigincode',_0x66b3('0x49'),_0x66b3('0x4a'),'regardingobjectid','directioncode',_0x66b3('0x4b')];var _0x394c3b=['accountidname','accountidyominame',_0x66b3('0x4c'),'billedserviceunits',_0x66b3('0x4d'),_0x66b3('0x4e'),_0x66b3('0x4f'),_0x66b3('0x50'),_0x66b3('0x51'),_0x66b3('0x52'),'createdbyname',_0x66b3('0x53'),_0x66b3('0x54'),_0x66b3('0x55'),_0x66b3('0x56'),_0x66b3('0x57'),'customeridtype',_0x66b3('0x58'),'emailaddress',_0x66b3('0x59'),_0x66b3('0x5a'),'entityimage_url','escalatedon',_0x66b3('0x5b'),_0x66b3('0x5c'),_0x66b3('0x5d'),'importsequencenumber',_0x66b3('0x5e'),'kbarticleidname',_0x66b3('0x5f'),_0x66b3('0x60'),'modifiedbyexternalpartyname',_0x66b3('0x61'),_0x66b3('0x62'),_0x66b3('0x63'),'modifiedon',_0x66b3('0x64'),_0x66b3('0x65'),_0x66b3('0x66'),_0x66b3('0x67'),'numberofchildincidents',_0x66b3('0x68'),_0x66b3('0x69'),_0x66b3('0x6a'),_0x66b3('0x6b'),_0x66b3('0x6c'),_0x66b3('0x6d'),'primarycontactidname','primarycontactidyominame','prioritycodename','productidname',_0x66b3('0x6e'),'resolveby',_0x66b3('0x6f'),_0x66b3('0x70'),'responsiblecontactidname',_0x66b3('0x71'),_0x66b3('0x72'),'slainvokedidname',_0x66b3('0x73'),_0x66b3('0x74'),_0x66b3('0x75'),_0x66b3('0x76'),_0x66b3('0x77'),'ticketnumber','timezoneruleversionnumber',_0x66b3('0x78'),_0x66b3('0x79'),_0x66b3('0x7a'),_0x66b3('0x7b')];var _0x138c0c=_0x4e43a9[_0x66b3('0x7c')](_0x394c3b);return db[_0x66b3('0x14')]['findOne']({'where':{'id':_0x101904[_0x66b3('0x33')]['id']},'attributes':['id','username',_0x66b3('0x7d'),'remoteUri',_0x66b3('0x7e'),_0x66b3('0x7f'),'clientSecret',_0x66b3('0x80')],'include':[{'model':db[_0x66b3('0x81')],'as':_0x66b3('0x81'),'attributes':['id',_0x66b3('0x82'),_0x66b3('0x83')]}]})[_0x66b3('0xc')](handleEntityNotFound(_0x130a73,null))['then'](function(_0x431d9f){if(_0x431d9f){if(_0x431d9f[_0x66b3('0x80')]){_0x431d9f[_0x66b3('0x84')]=_0x431d9f[_0x66b3('0x81')][_0x66b3('0x82')];_0x117213=sanitizeRemoteUri(_0x431d9f[_0x66b3('0x81')]['data7']);_0x3d6a45=getWebApiUrl(_0x117213);return _0x431d9f;}_0x117213=sanitizeRemoteUri(_0x431d9f[_0x66b3('0x85')]);_0x3d6a45=getWebApiUrl(_0x117213);var _0x1fdfc7={'method':_0x66b3('0x86'),'uri':_0x66b3('0x87')+_0x431d9f[_0x66b3('0x7e')]+_0x66b3('0x88'),'form':{'client_id':_0x431d9f['clientId'],'resource':_0x117213,'username':_0x431d9f[_0x66b3('0x89')],'password':_0x431d9f['password'],'grant_type':_0x66b3('0x7d'),'client_secret':_0x431d9f['clientSecret']},'json':!![]};return rp(_0x1fdfc7);}})[_0x66b3('0xc')](function(_0x5e2ffa){_0xaf9280=_0x5e2ffa[_0x66b3('0x84')];var _0x153cc5={'method':_0x66b3('0x8a'),'uri':encodeURI(_0x3d6a45+_0x66b3('0x8b')+_0xd19f51+'\x27'),'headers':{'Authorization':_0x66b3('0x8c')+_0xaf9280,'If-None-Match':null,'OData-Version':_0x66b3('0x8d')},'json':!![]};return rp(_0x153cc5);})[_0x66b3('0xc')](function(_0x54f27a){var _0x4d065f=_0x54f27a[_0x66b3('0x8e')][0x0];var _0x50ccd5=_0x4d065f[_0x66b3('0x8f')];var _0x1daebe={'method':'GET','uri':_0x3d6a45+_0x66b3('0x90')+_0x50ccd5+_0x66b3('0x91'),'headers':{'Authorization':_0x66b3('0x8c')+_0xaf9280,'If-None-Match':null,'OData-Version':_0x66b3('0x8d')},'json':!![]};return rp(_0x1daebe);})['then'](function(_0x2ef03f){_0x2838e3=_0x2ef03f;_0xf05db2=_0x2838e3[_0x66b3('0x92')];_0xf05db2=_['remove'](_0xf05db2,function(_0x51c634){return!_0x138c0c[_0x66b3('0x93')](_0x51c634[_0x66b3('0x94')]);});var _0x582d29=[];var _0x557eda=[];_0xf05db2[_0x66b3('0x95')](function(_0xf0accf){if(_0xf0accf[_0x66b3('0x96')]){var _0x357e77=_0xf0accf[_0x66b3('0x96')]['substring'](_0xf0accf[_0x66b3('0x96')][_0x66b3('0x40')]('.')+0x1);if(_0x357e77===_0x66b3('0x97')){_0x582d29[_0x66b3('0x98')](getSelectList(_0x3d6a45,_0x5a7822,_0x557eda,_0x2838e3[_0x66b3('0x8f')],_0xf0accf['MetadataId'],_0xaf9280));}}});return Promise[_0x66b3('0x99')](_0x582d29);})[_0x66b3('0xc')](function(_0xb795b7){_0x5381b4=_0xb795b7[0x0];var _0x2772df=[];var _0x307ddc=[];_0xf05db2['forEach'](function(_0x15d5f6){if(!_[_0x66b3('0x9a')](_0x15d5f6['@odata.type'])){var _0x64ec83=_0x15d5f6[_0x66b3('0x96')][_0x66b3('0x9b')](_0x15d5f6['@odata.type'][_0x66b3('0x40')]('.')+0x1);if(_0x64ec83===_0x66b3('0x9c')){_0x2772df[_0x66b3('0x98')](getBooleanList(_0x3d6a45,_0x5a7822,_0x307ddc,_0x2838e3[_0x66b3('0x8f')],_0x15d5f6[_0x66b3('0x8f')],_0xaf9280));}}});return Promise[_0x66b3('0x99')](_0x2772df);})['then'](function(_0x559090){_0x223293=_0x559090[0x0];var _0x56426d=[];var _0x4a2366=[];_0xf05db2['forEach'](function(_0xc08bcd){if(_0xc08bcd[_0x66b3('0x96')]){var _0x49d1a4=_0xc08bcd[_0x66b3('0x96')][_0x66b3('0x9b')](_0xc08bcd[_0x66b3('0x96')][_0x66b3('0x40')]('.')+0x1);if(_0x49d1a4===_0x66b3('0x9d')||_0x49d1a4===_0x66b3('0x9e')||_0x49d1a4===_0x66b3('0x9f')||_0x49d1a4===_0x66b3('0xa0')||_0x49d1a4===_0x66b3('0xa1')||_0x49d1a4===_0x66b3('0xa2')||_0x49d1a4===_0x66b3('0xa3')||_0x49d1a4===_0x66b3('0xa4')||_0x49d1a4===_0x66b3('0xa5')||_0x49d1a4===_0x66b3('0xa6')){_0x56426d[_0x66b3('0x98')](getInputList(_0x3d6a45,_0x5a7822,_0x49d1a4,_0x4a2366,_0x2838e3[_0x66b3('0x8f')],_0xc08bcd[_0x66b3('0x8f')],_0xaf9280));}}});return Promise[_0x66b3('0x99')](_0x56426d);})[_0x66b3('0xc')](function(_0x41127a){_0x25ecef=_0x41127a[0x0];var _0x44c675=_0x5381b4[_0x66b3('0x7c')](_0x223293)['concat'](_0x25ecef);var _0x9dbdcb={'count':_0x44c675['length'],'rows':_0x44c675};return _0x9dbdcb;})[_0x66b3('0xc')](respondWithResult(_0x130a73,null))[_0x66b3('0x2c')](function(_0x3275f8){var _0x366584=_0x101904[_0x66b3('0x18')][_0x66b3('0xa7')]?0x1f4:_0x3275f8['statusCode']||0x1f4;logger[_0x66b3('0xf')](_0x3275f8[_0x66b3('0x10')]);delete _0x3275f8['name'];if(_0x366584===0x191){_0x366584=0x190;}_0x130a73['status'](_0x366584)[_0x66b3('0x11')](_0x101904['query'][_0x66b3('0xa7')]?{'message':_0x66b3('0xa8'),'statusCode':_0x3275f8[_0x66b3('0xa9')]}:_0x3275f8);});};function getSelectList(_0x6488f5,_0x3fb94e,_0x4cc6c2,_0x48ddaf,_0x43b16a,_0x5d7996){var _0xb52f48={'method':'GET','uri':_0x6488f5+_0x66b3('0x90')+_0x48ddaf+_0x66b3('0xaa')+_0x43b16a+_0x66b3('0xab')+_0x66b3('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x5d7996,'If-None-Match':null,'OData-Version':_0x66b3('0x8d')},'json':!![]};return rp(_0xb52f48)['then'](function(_0x4fda9a){var _0x258eb0=[];var _0xb87dee=_0x4fda9a[_0x66b3('0xad')]['Options'];_0xb87dee[_0x66b3('0x95')](function(_0x49cd74){_0x258eb0['push']({'name':_0x49cd74[_0x66b3('0xae')][_0x66b3('0xaf')][_0x66b3('0xae')],'value':String(_0x49cd74[_0x66b3('0xb0')])});});var _0x4b7e2d={'id':_0x3fb94e+'_'+_0x4fda9a[_0x66b3('0x94')],'name':_0x4fda9a[_0x66b3('0xb1')][_0x66b3('0xaf')]['Label'],'custom':![],'options':_0x258eb0};_0x4cc6c2[_0x66b3('0x98')](_0x4b7e2d);return _0x4cc6c2;});}function getBooleanList(_0x575371,_0x4ccfa7,_0x25875a,_0xd8971f,_0x4280e7,_0x510b99){var _0x7d1696={'method':_0x66b3('0x8a'),'uri':_0x575371+_0x66b3('0x90')+_0xd8971f+_0x66b3('0xaa')+_0x4280e7+_0x66b3('0xb2'),'headers':{'Authorization':_0x66b3('0x8c')+_0x510b99,'If-None-Match':null,'OData-Version':_0x66b3('0x8d')},'json':!![]};return rp(_0x7d1696)[_0x66b3('0xc')](function(_0x137402){var _0x8d8af2=[];_0x8d8af2['push']({'name':_0x137402['OptionSet'][_0x66b3('0xb3')][_0x66b3('0xae')][_0x66b3('0xaf')]['Label'],'value':_0x66b3('0xb4')},{'name':_0x137402[_0x66b3('0xad')]['FalseOption']['Label'][_0x66b3('0xaf')][_0x66b3('0xae')],'value':_0x66b3('0xb5')});var _0x47a4dd={'id':_0x4ccfa7+'_'+_0x137402[_0x66b3('0x94')],'name':_0x137402[_0x66b3('0xb1')][_0x66b3('0xaf')][_0x66b3('0xae')],'custom':![],'options':_0x8d8af2};_0x25875a['push'](_0x47a4dd);return _0x25875a;});}function getInputList(_0x27eb99,_0x126dd5,_0x1d8abe,_0x41cdcd,_0x326a77,_0x46e2d1,_0x420543){var _0x41179c={'method':_0x66b3('0x8a'),'uri':_0x27eb99+'EntityDefinitions('+_0x326a77+_0x66b3('0xaa')+_0x46e2d1+_0x66b3('0xb6')+_0x1d8abe+_0x66b3('0xb7'),'headers':{'Authorization':_0x66b3('0x8c')+_0x420543,'If-None-Match':null,'OData-Version':_0x66b3('0x8d')},'json':!![]};return rp(_0x41179c)[_0x66b3('0xc')](function(_0x350588){var _0x32dd0d={'id':_0x126dd5+'_'+_0x350588[_0x66b3('0x94')],'name':_0x350588[_0x66b3('0xb1')][_0x66b3('0xaf')]?_0x350588['DisplayName']['UserLocalizedLabel'][_0x66b3('0xae')]:_0x350588['LogicalName'],'custom':![],'options':[]};_0x41cdcd[_0x66b3('0x98')](_0x32dd0d);return _0x41cdcd;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b720417..4294c47 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1f750e,_0x162e24){var _0x121018=function(_0x3427f7){while(--_0x3427f7){_0x1f750e['push'](_0x1f750e['shift']());}};_0x121018(++_0x162e24);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x50c24f,_0x274ded){var _0x3d48b8=function(_0x2c8bcb){while(--_0x2c8bcb){_0x50c24f['push'](_0x50c24f['shift']());}};_0x3d48b8(++_0x274ded);}(_0xe706,0xa3));var _0x6e70=function(_0xfcbf57,_0x4b05fd){_0xfcbf57=_0xfcbf57-0x0;var _0x1078fa=_0xe706[_0xfcbf57];return _0x1078fa;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index f21095e..ee93ce5 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 _0xab8f=['Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account','stringify','catch','ShowDynamics365Account','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x519582,_0x2260a2){var _0x1c8454=function(_0xe34f7a){while(--_0xe34f7a){_0x519582['push'](_0x519582['shift']());}};_0x1c8454(++_0x2260a2);}(_0xab8f,0x1cf));var _0xfab8=function(_0x56dcc6,_0x280f40){_0x56dcc6=_0x56dcc6-0x0;var _0x1fac71=_0xab8f[_0x56dcc6];return _0x1fac71;};'use strict';var _=require(_0xfab8('0x0'));var util=require(_0xfab8('0x1'));var moment=require(_0xfab8('0x2'));var BPromise=require(_0xfab8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfab8('0x4'));var logger=require(_0xfab8('0x5'))(_0xfab8('0x6'));var config=require(_0xfab8('0x7'));var jayson=require(_0xfab8('0x8'));var client=jayson[_0xfab8('0x9')][_0xfab8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1480bd,_0x370836,_0x426df8){return new BPromise(function(_0x5df55c,_0x6bf46c){return client['request'](_0x1480bd,_0x426df8)[_0xfab8('0xb')](function(_0x2192b7){logger[_0xfab8('0xc')](_0xfab8('0xd'),_0x370836,_0xfab8('0xe'));logger[_0xfab8('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x370836,_0xfab8('0xe'),JSON['stringify'](_0x2192b7));if(_0x2192b7[_0xfab8('0x10')]){if(_0x2192b7[_0xfab8('0x10')][_0xfab8('0x11')]===0x1f4){logger[_0xfab8('0x10')](_0xfab8('0xd'),_0x370836,_0x2192b7[_0xfab8('0x10')][_0xfab8('0x12')]);return _0x6bf46c(_0x2192b7[_0xfab8('0x10')][_0xfab8('0x12')]);}logger[_0xfab8('0x10')](_0xfab8('0xd'),_0x370836,_0x2192b7[_0xfab8('0x10')][_0xfab8('0x12')]);return _0x5df55c(_0x2192b7[_0xfab8('0x10')][_0xfab8('0x12')]);}else{logger[_0xfab8('0xc')](_0xfab8('0xd'),_0x370836,_0xfab8('0xe'));_0x5df55c(_0x2192b7[_0xfab8('0x13')][_0xfab8('0x12')]);}})['catch'](function(_0x43a5c0){logger[_0xfab8('0x10')](_0xfab8('0xd'),_0x370836,_0x43a5c0);_0x6bf46c(_0x43a5c0);});});}exports['GetDynamics365Account']=function(_0x56bfa8){var _0x19e9c3=this;return new Promise(function(_0x4d503d,_0x1de15){return db[_0xfab8('0x14')][_0xfab8('0x15')]({'raw':_0x56bfa8[_0xfab8('0x16')]?_0x56bfa8[_0xfab8('0x16')][_0xfab8('0x17')]===undefined?!![]:![]:!![],'where':_0x56bfa8[_0xfab8('0x16')]?_0x56bfa8[_0xfab8('0x16')][_0xfab8('0x18')]||null:null,'attributes':_0x56bfa8[_0xfab8('0x16')]?_0x56bfa8[_0xfab8('0x16')][_0xfab8('0x19')]||null:null,'limit':_0x56bfa8[_0xfab8('0x16')]?_0x56bfa8[_0xfab8('0x16')][_0xfab8('0x1a')]||null:null,'include':_0x56bfa8['options']?_0x56bfa8[_0xfab8('0x16')][_0xfab8('0x1b')]?_[_0xfab8('0x1c')](_0x56bfa8[_0xfab8('0x16')]['include'],function(_0x4958f7){return{'model':db[_0x4958f7['model']],'as':_0x4958f7['as'],'attributes':_0x4958f7[_0xfab8('0x19')],'include':_0x4958f7[_0xfab8('0x1b')]?_[_0xfab8('0x1c')](_0x4958f7[_0xfab8('0x1b')],function(_0x1baf7f){return{'model':db[_0x1baf7f[_0xfab8('0x1d')]],'as':_0x1baf7f['as'],'attributes':_0x1baf7f['attributes'],'include':_0x1baf7f[_0xfab8('0x1b')]?_[_0xfab8('0x1c')](_0x1baf7f[_0xfab8('0x1b')],function(_0x5be928){return{'model':db[_0x5be928[_0xfab8('0x1d')]],'as':_0x5be928['as'],'attributes':_0x5be928[_0xfab8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfab8('0xb')](function(_0x2851c2){logger[_0xfab8('0xc')](_0xfab8('0x1e'),_0x56bfa8);logger[_0xfab8('0xf')](_0xfab8('0x1e'),_0x56bfa8,JSON[_0xfab8('0x1f')](_0x2851c2));_0x4d503d(_0x2851c2);})[_0xfab8('0x20')](function(_0x553a1e){logger[_0xfab8('0x10')]('GetDynamics365Account',_0x553a1e[_0xfab8('0x12')],_0x56bfa8);_0x1de15(_0x19e9c3[_0xfab8('0x10')](0x1f4,_0x553a1e['message']));});});};exports['ShowDynamics365Account']=function(_0x1175c7){var _0x3ada9d=this;return new Promise(function(_0x11b495,_0x16cb3c){return db['Dynamics365Account']['find']({'raw':_0x1175c7[_0xfab8('0x16')]?_0x1175c7[_0xfab8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1175c7['options']?_0x1175c7[_0xfab8('0x16')]['where']||null:null,'attributes':_0x1175c7[_0xfab8('0x16')]?_0x1175c7[_0xfab8('0x16')][_0xfab8('0x19')]||null:null,'include':_0x1175c7[_0xfab8('0x16')]?_0x1175c7[_0xfab8('0x16')][_0xfab8('0x1b')]?_[_0xfab8('0x1c')](_0x1175c7[_0xfab8('0x16')][_0xfab8('0x1b')],function(_0x56b038){return{'model':db[_0x56b038[_0xfab8('0x1d')]],'as':_0x56b038['as'],'attributes':_0x56b038['attributes'],'include':_0x56b038['include']?_['map'](_0x56b038['include'],function(_0x368c76){return{'model':db[_0x368c76[_0xfab8('0x1d')]],'as':_0x368c76['as'],'attributes':_0x368c76[_0xfab8('0x19')],'include':_0x368c76['include']?_[_0xfab8('0x1c')](_0x368c76[_0xfab8('0x1b')],function(_0x3c71e4){return{'model':db[_0x3c71e4[_0xfab8('0x1d')]],'as':_0x3c71e4['as'],'attributes':_0x3c71e4[_0xfab8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfab8('0xb')](function(_0x2ea099){logger['info'](_0xfab8('0x21'),_0x1175c7);logger['debug']('ShowDynamics365Account',_0x1175c7,JSON['stringify'](_0x2ea099));_0x11b495(_0x2ea099);})[_0xfab8('0x20')](function(_0x2989b8){logger[_0xfab8('0x10')](_0xfab8('0x21'),_0x2989b8[_0xfab8('0x12')],_0x1175c7);_0x16cb3c(_0x3ada9d[_0xfab8('0x10')](0x1f4,_0x2989b8[_0xfab8('0x12')]));});});}; \ No newline at end of file +var _0x6807=['model','info','ShowDynamics365Account','Dynamics365Account','raw','catch','lodash','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','findAll','options','where','attributes','limit','include','map'];(function(_0x163d85,_0x19c77b){var _0x48f8c6=function(_0x368ca7){while(--_0x368ca7){_0x163d85['push'](_0x163d85['shift']());}};_0x48f8c6(++_0x19c77b);}(_0x6807,0xed));var _0x7680=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x6807[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x7680('0x0'));var util=require('util');var moment=require(_0x7680('0x1'));var BPromise=require(_0x7680('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7680('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7680('0x4'));var jayson=require(_0x7680('0x5'));var client=jayson[_0x7680('0x6')][_0x7680('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5522f4,_0xb1a7de,_0x3ff316){return new BPromise(function(_0x421659,_0x46a261){return client[_0x7680('0x8')](_0x5522f4,_0x3ff316)[_0x7680('0x9')](function(_0x5de218){logger['info'](_0x7680('0xa'),_0xb1a7de,_0x7680('0xb'));logger[_0x7680('0xc')](_0x7680('0xd'),_0xb1a7de,_0x7680('0xb'),JSON[_0x7680('0xe')](_0x5de218));if(_0x5de218['error']){if(_0x5de218[_0x7680('0xf')][_0x7680('0x10')]===0x1f4){logger[_0x7680('0xf')](_0x7680('0xa'),_0xb1a7de,_0x5de218[_0x7680('0xf')]['message']);return _0x46a261(_0x5de218['error'][_0x7680('0x11')]);}logger[_0x7680('0xf')](_0x7680('0xa'),_0xb1a7de,_0x5de218[_0x7680('0xf')]['message']);return _0x421659(_0x5de218[_0x7680('0xf')]['message']);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0xb1a7de,'request\x20sent');_0x421659(_0x5de218[_0x7680('0x12')][_0x7680('0x11')]);}})['catch'](function(_0x2d25c6){logger[_0x7680('0xf')](_0x7680('0xa'),_0xb1a7de,_0x2d25c6);_0x46a261(_0x2d25c6);});});}exports[_0x7680('0x13')]=function(_0x123546){var _0x51bb9a=this;return new Promise(function(_0x1209bd,_0x1638f4){return db['Dynamics365Account'][_0x7680('0x14')]({'raw':_0x123546['options']?_0x123546[_0x7680('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x123546['options']?_0x123546[_0x7680('0x15')][_0x7680('0x16')]||null:null,'attributes':_0x123546[_0x7680('0x15')]?_0x123546[_0x7680('0x15')][_0x7680('0x17')]||null:null,'limit':_0x123546[_0x7680('0x15')]?_0x123546[_0x7680('0x15')][_0x7680('0x18')]||null:null,'include':_0x123546['options']?_0x123546['options'][_0x7680('0x19')]?_[_0x7680('0x1a')](_0x123546[_0x7680('0x15')][_0x7680('0x19')],function(_0x2c5c15){return{'model':db[_0x2c5c15['model']],'as':_0x2c5c15['as'],'attributes':_0x2c5c15[_0x7680('0x17')],'include':_0x2c5c15[_0x7680('0x19')]?_['map'](_0x2c5c15[_0x7680('0x19')],function(_0x5f0d36){return{'model':db[_0x5f0d36[_0x7680('0x1b')]],'as':_0x5f0d36['as'],'attributes':_0x5f0d36[_0x7680('0x17')],'include':_0x5f0d36[_0x7680('0x19')]?_['map'](_0x5f0d36[_0x7680('0x19')],function(_0x22e955){return{'model':db[_0x22e955[_0x7680('0x1b')]],'as':_0x22e955['as'],'attributes':_0x22e955[_0x7680('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7680('0x9')](function(_0x1b67ca){logger[_0x7680('0x1c')](_0x7680('0x13'),_0x123546);logger[_0x7680('0xc')]('GetDynamics365Account',_0x123546,JSON[_0x7680('0xe')](_0x1b67ca));_0x1209bd(_0x1b67ca);})['catch'](function(_0x4ed746){logger[_0x7680('0xf')](_0x7680('0x13'),_0x4ed746[_0x7680('0x11')],_0x123546);_0x1638f4(_0x51bb9a[_0x7680('0xf')](0x1f4,_0x4ed746[_0x7680('0x11')]));});});};exports[_0x7680('0x1d')]=function(_0x4020f0){var _0x3117d8=this;return new Promise(function(_0x245351,_0x3ed487){return db[_0x7680('0x1e')]['find']({'raw':_0x4020f0[_0x7680('0x15')]?_0x4020f0[_0x7680('0x15')][_0x7680('0x1f')]===undefined?!![]:![]:!![],'where':_0x4020f0[_0x7680('0x15')]?_0x4020f0['options'][_0x7680('0x16')]||null:null,'attributes':_0x4020f0[_0x7680('0x15')]?_0x4020f0[_0x7680('0x15')][_0x7680('0x17')]||null:null,'include':_0x4020f0[_0x7680('0x15')]?_0x4020f0['options'][_0x7680('0x19')]?_[_0x7680('0x1a')](_0x4020f0['options'][_0x7680('0x19')],function(_0x3e93a6){return{'model':db[_0x3e93a6[_0x7680('0x1b')]],'as':_0x3e93a6['as'],'attributes':_0x3e93a6['attributes'],'include':_0x3e93a6['include']?_['map'](_0x3e93a6['include'],function(_0x20749e){return{'model':db[_0x20749e[_0x7680('0x1b')]],'as':_0x20749e['as'],'attributes':_0x20749e[_0x7680('0x17')],'include':_0x20749e[_0x7680('0x19')]?_['map'](_0x20749e[_0x7680('0x19')],function(_0x5b67c5){return{'model':db[_0x5b67c5['model']],'as':_0x5b67c5['as'],'attributes':_0x5b67c5[_0x7680('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7680('0x9')](function(_0x5b15a0){logger[_0x7680('0x1c')]('ShowDynamics365Account',_0x4020f0);logger['debug']('ShowDynamics365Account',_0x4020f0,JSON[_0x7680('0xe')](_0x5b15a0));_0x245351(_0x5b15a0);})[_0x7680('0x20')](function(_0x48a760){logger['error']('ShowDynamics365Account',_0x48a760['message'],_0x4020f0);_0x3ed487(_0x3117d8[_0x7680('0xf')](0x1f4,_0x48a760[_0x7680('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 269b00e..e2516ba 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 _0xdd6e=['put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdd6e,0xa5));var _0xedd6=function(_0x20e94e,_0x1b3006){_0x20e94e=_0x20e94e-0x0;var _0x3dcae9=_0xdd6e[_0x20e94e];return _0x3dcae9;};'use strict';var multer=require(_0xedd6('0x0'));var util=require(_0xedd6('0x1'));var path=require(_0xedd6('0x2'));var timeout=require(_0xedd6('0x3'));var express=require('express');var router=express[_0xedd6('0x4')]();var fs_extra=require(_0xedd6('0x5'));var auth=require(_0xedd6('0x6'));var interaction=require(_0xedd6('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0xedd6('0x8')](),controller[_0xedd6('0x9')]);router['get'](_0xedd6('0xa'),auth[_0xedd6('0x8')](),controller[_0xedd6('0xb')]);router[_0xedd6('0xc')](_0xedd6('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xedd6('0xc')](_0xedd6('0xe'),auth['isAuthenticated'](),controller[_0xedd6('0xf')]);router[_0xedd6('0xc')](_0xedd6('0x10'),auth[_0xedd6('0x8')](),controller['getDescriptions']);router[_0xedd6('0x11')]('/',auth['isAuthenticated'](),controller[_0xedd6('0x12')]);router[_0xedd6('0x13')](_0xedd6('0xa'),auth[_0xedd6('0x8')](),controller['update']);router[_0xedd6('0x14')](_0xedd6('0xa'),auth[_0xedd6('0x8')](),controller[_0xedd6('0x15')]);module[_0xedd6('0x16')]=router; \ No newline at end of file +var _0x9c1d=['show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id'];(function(_0x54e881,_0x512b42){var _0xa98ef7=function(_0x581f96){while(--_0x581f96){_0x54e881['push'](_0x54e881['shift']());}};_0xa98ef7(++_0x512b42);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x2ec820,_0x499df9){_0x2ec820=_0x2ec820-0x0;var _0x4c0aa9=_0x9c1d[_0x2ec820];return _0x4c0aa9;};'use strict';var multer=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var path=require(_0xd9c1('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9c1('0x3'));var router=express[_0xd9c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd9c1('0x5'));var interaction=require(_0xd9c1('0x6'));var config=require('../../config/environment');var controller=require(_0xd9c1('0x7'));router[_0xd9c1('0x8')]('/',auth[_0xd9c1('0x9')](),controller[_0xd9c1('0xa')]);router[_0xd9c1('0x8')](_0xd9c1('0xb'),auth[_0xd9c1('0x9')](),controller[_0xd9c1('0xc')]);router[_0xd9c1('0x8')]('/:id/fields',auth[_0xd9c1('0x9')](),controller[_0xd9c1('0xd')]);router[_0xd9c1('0x8')](_0xd9c1('0xe'),auth[_0xd9c1('0x9')](),controller[_0xd9c1('0xf')]);router[_0xd9c1('0x8')]('/:id/descriptions',auth[_0xd9c1('0x9')](),controller[_0xd9c1('0x10')]);router[_0xd9c1('0x11')]('/',auth['isAuthenticated'](),controller[_0xd9c1('0x12')]);router['put'](_0xd9c1('0xb'),auth[_0xd9c1('0x9')](),controller[_0xd9c1('0x13')]);router[_0xd9c1('0x14')](_0xd9c1('0xb'),auth[_0xd9c1('0x9')](),controller[_0xd9c1('0x15')]);module[_0xd9c1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 9b7bd68..75a80dd 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 _0xcfc4=['sequelize','exports','STRING','phonecall','ENUM','contact','nothing','BOOLEAN'];(function(_0x4fa301,_0x3edb8a){var _0x356ed8=function(_0x924f0b){while(--_0x924f0b){_0x4fa301['push'](_0x4fa301['shift']());}};_0x356ed8(++_0x3edb8a);}(_0xcfc4,0xc8));var _0x4cfc=function(_0x2373ea,_0x537e14){_0x2373ea=_0x2373ea-0x0;var _0x4ef1f1=_0xcfc4[_0x2373ea];return _0x4ef1f1;};'use strict';var Sequelize=require(_0x4cfc('0x0'));module[_0x4cfc('0x1')]={'name':{'type':Sequelize[_0x4cfc('0x2')]},'description':{'type':Sequelize[_0x4cfc('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x4cfc('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x4cfc('0x4')](_0x4cfc('0x5'),_0x4cfc('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x4cfc('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5a4a=['ENUM','incident','phonecall','nothing','contact','sequelize','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5a4a,0x178));var _0xa5a4=function(_0x25dc63,_0x2d45e8){_0x25dc63=_0x25dc63-0x0;var _0x7857c8=_0x5a4a[_0x25dc63];return _0x7857c8;};'use strict';var Sequelize=require(_0xa5a4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa5a4('0x1')]},'ticketType':{'type':Sequelize[_0xa5a4('0x2')](_0xa5a4('0x3'),_0xa5a4('0x4')),'defaultValue':_0xa5a4('0x3')},'moduleCreate':{'type':Sequelize[_0xa5a4('0x2')]('contact',_0xa5a4('0x5')),'defaultValue':_0xa5a4('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa5a4('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 991bd4c..2ec4a4a 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 _0x3d65=['stack','name','Dynamics365Configuration','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','show','params','keys','include','find','create','update','body','getFields','findOne','Dynamics365Field','order','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','destroy','then'];(function(_0x48a9bd,_0x4c29fa){var _0x2c7b50=function(_0x1ba736){while(--_0x1ba736){_0x48a9bd['push'](_0x48a9bd['shift']());}};_0x2c7b50(++_0x4c29fa);}(_0x3d65,0x112));var _0x53d6=function(_0x2d1ff6,_0x182530){_0x2d1ff6=_0x2d1ff6-0x0;var _0x2f1298=_0x3d65[_0x2d1ff6];return _0x2f1298;};'use strict';var emlformat=require(_0x53d6('0x0'));var rimraf=require(_0x53d6('0x1'));var zipdir=require(_0x53d6('0x2'));var jsonpatch=require(_0x53d6('0x3'));var rp=require(_0x53d6('0x4'));var moment=require(_0x53d6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x53d6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x53d6('0x7'));var csv=require(_0x53d6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53d6('0x9'));var _=require(_0x53d6('0xa'));var squel=require(_0x53d6('0xb'));var crypto=require('crypto');var jsforce=require(_0x53d6('0xc'));var deskjs=require(_0x53d6('0xd'));var toCsv=require(_0x53d6('0x8'));var querystring=require(_0x53d6('0xe'));var Papa=require('papaparse');var Redis=require(_0x53d6('0xf'));var authService=require(_0x53d6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x53d6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53d6('0x12'))(_0x53d6('0x13'));var utils=require(_0x53d6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x53d6('0x15'));var db=require(_0x53d6('0x16'))['db'];function respondWithStatusCode(_0x1f3c07,_0x111c55){_0x111c55=_0x111c55||0xcc;return function(_0x56dbd7){if(_0x56dbd7){return _0x1f3c07[_0x53d6('0x17')](_0x111c55);}return _0x1f3c07[_0x53d6('0x18')](_0x111c55)[_0x53d6('0x19')]();};}function respondWithResult(_0x2a455b,_0x9e3e7f){_0x9e3e7f=_0x9e3e7f||0xc8;return function(_0x34cbd9){if(_0x34cbd9){return _0x2a455b[_0x53d6('0x18')](_0x9e3e7f)[_0x53d6('0x1a')](_0x34cbd9);}};}function respondWithFilteredResult(_0x238488,_0x2dcead){return function(_0x2283c5){if(_0x2283c5){var _0x26fd84=typeof _0x2dcead['offset']==='undefined'&&typeof _0x2dcead[_0x53d6('0x1b')]===_0x53d6('0x1c');var _0x33255b=_0x2283c5['count'];var _0x311645=_0x26fd84?0x0:_0x2dcead[_0x53d6('0x1d')];var _0x4b950d=_0x26fd84?_0x2283c5[_0x53d6('0x1e')]:_0x2dcead[_0x53d6('0x1d')]+_0x2dcead[_0x53d6('0x1b')];var _0x216e1e;if(_0x4b950d>=_0x33255b){_0x4b950d=_0x33255b;_0x216e1e=0xc8;}else{_0x216e1e=0xce;}_0x238488[_0x53d6('0x18')](_0x216e1e);return _0x238488[_0x53d6('0x1f')](_0x53d6('0x20'),_0x311645+'-'+_0x4b950d+'/'+_0x33255b)[_0x53d6('0x1a')](_0x2283c5);}return null;};}function patchUpdates(_0x102adf){return function(_0x3ae266){try{jsonpatch[_0x53d6('0x21')](_0x3ae266,_0x102adf,!![]);}catch(_0xdaaac8){return BPromise[_0x53d6('0x22')](_0xdaaac8);}return _0x3ae266[_0x53d6('0x23')]();};}function saveUpdates(_0x396889,_0xd9e81f){return function(_0x2d1715){if(_0x2d1715){return _0x2d1715['update'](_0x396889)['then'](function(_0x5cfb2a){return _0x5cfb2a;});}return null;};}function removeEntity(_0x250618,_0x4c9467){return function(_0x1a2fc9){if(_0x1a2fc9){return _0x1a2fc9[_0x53d6('0x24')]()[_0x53d6('0x25')](function(){_0x250618[_0x53d6('0x18')](0xcc)[_0x53d6('0x19')]();});}};}function handleEntityNotFound(_0x36a23e,_0x262634){return function(_0x99a0a4){if(!_0x99a0a4){_0x36a23e[_0x53d6('0x17')](0x194);}return _0x99a0a4;};}function handleError(_0xd3ea8,_0x5ad167){_0x5ad167=_0x5ad167||0x1f4;return function(_0x5ad75){logger['error'](_0x5ad75[_0x53d6('0x26')]);if(_0x5ad75[_0x53d6('0x27')]){delete _0x5ad75[_0x53d6('0x27')];}_0xd3ea8[_0x53d6('0x18')](_0x5ad167)['send'](_0x5ad75);};}exports['index']=function(_0x467efa,_0x26946b){var _0x305ca6={},_0x3c6f2b={},_0x25cc0c={'count':0x0,'rows':[]};var _0x4ba70f=_['map'](db[_0x53d6('0x28')][_0x53d6('0x29')],function(_0x1f12be){return{'name':_0x1f12be[_0x53d6('0x2a')],'type':_0x1f12be[_0x53d6('0x2b')]['key']};});_0x3c6f2b[_0x53d6('0x2c')]=_[_0x53d6('0x2d')](_0x4ba70f,_0x53d6('0x27'));_0x3c6f2b[_0x53d6('0x2e')]=_['keys'](_0x467efa[_0x53d6('0x2e')]);_0x3c6f2b[_0x53d6('0x2f')]=_[_0x53d6('0x30')](_0x3c6f2b[_0x53d6('0x2c')],_0x3c6f2b[_0x53d6('0x2e')]);_0x305ca6[_0x53d6('0x31')]=_[_0x53d6('0x30')](_0x3c6f2b[_0x53d6('0x2c')],qs['fields'](_0x467efa['query'][_0x53d6('0x32')]));_0x305ca6['attributes']=_0x305ca6[_0x53d6('0x31')][_0x53d6('0x33')]?_0x305ca6['attributes']:_0x3c6f2b[_0x53d6('0x2c')];if(!_0x467efa[_0x53d6('0x2e')]['hasOwnProperty']('nolimit')){_0x305ca6[_0x53d6('0x1b')]=qs[_0x53d6('0x1b')](_0x467efa[_0x53d6('0x2e')][_0x53d6('0x1b')]);_0x305ca6[_0x53d6('0x1d')]=qs[_0x53d6('0x1d')](_0x467efa['query'][_0x53d6('0x1d')]);}_0x305ca6['order']=qs[_0x53d6('0x34')](_0x467efa[_0x53d6('0x2e')][_0x53d6('0x34')]);_0x305ca6['where']=qs[_0x53d6('0x2f')](_[_0x53d6('0x35')](_0x467efa[_0x53d6('0x2e')],_0x3c6f2b[_0x53d6('0x2f')]),_0x4ba70f);if(_0x467efa[_0x53d6('0x2e')][_0x53d6('0x36')]){_0x305ca6['where']=_[_0x53d6('0x37')](_0x305ca6[_0x53d6('0x38')],{'$or':_[_0x53d6('0x2d')](_0x4ba70f,function(_0x11411f){if(_0x11411f['type']!==_0x53d6('0x39')){var _0xceea={};_0xceea[_0x11411f[_0x53d6('0x27')]]={'$like':'%'+_0x467efa[_0x53d6('0x2e')][_0x53d6('0x36')]+'%'};return _0xceea;}})});}_0x305ca6=_[_0x53d6('0x37')]({},_0x305ca6,_0x467efa[_0x53d6('0x3a')]);var _0x772930={'where':_0x305ca6[_0x53d6('0x38')]};return db[_0x53d6('0x28')][_0x53d6('0x1e')](_0x772930)[_0x53d6('0x25')](function(_0x1569aa){_0x25cc0c[_0x53d6('0x1e')]=_0x1569aa;if(_0x467efa[_0x53d6('0x2e')]['includeAll']){_0x305ca6['include']=[{'all':!![]}];}return db[_0x53d6('0x28')][_0x53d6('0x3b')](_0x305ca6);})[_0x53d6('0x25')](function(_0x2b2a57){_0x25cc0c[_0x53d6('0x3c')]=_0x2b2a57;return _0x25cc0c;})['then'](respondWithFilteredResult(_0x26946b,_0x305ca6))[_0x53d6('0x3d')](handleError(_0x26946b,null));};exports[_0x53d6('0x3e')]=function(_0x105fcb,_0x21c110){var _0x38934e={'raw':![],'where':{'id':_0x105fcb[_0x53d6('0x3f')]['id']}},_0x2d0d8d={};_0x2d0d8d[_0x53d6('0x2c')]=_[_0x53d6('0x40')](db['Dynamics365Configuration']['rawAttributes']);_0x2d0d8d['query']=_[_0x53d6('0x40')](_0x105fcb[_0x53d6('0x2e')]);_0x2d0d8d[_0x53d6('0x2f')]=_[_0x53d6('0x30')](_0x2d0d8d[_0x53d6('0x2c')],_0x2d0d8d[_0x53d6('0x2e')]);_0x38934e[_0x53d6('0x31')]=_['intersection'](_0x2d0d8d[_0x53d6('0x2c')],qs[_0x53d6('0x32')](_0x105fcb['query'][_0x53d6('0x32')]));_0x38934e[_0x53d6('0x31')]=_0x38934e[_0x53d6('0x31')][_0x53d6('0x33')]?_0x38934e['attributes']:_0x2d0d8d[_0x53d6('0x2c')];if(_0x105fcb[_0x53d6('0x2e')]['includeAll']){_0x38934e[_0x53d6('0x41')]=[{'all':!![]}];}_0x38934e=_[_0x53d6('0x37')]({},_0x38934e,_0x105fcb[_0x53d6('0x3a')]);return db['Dynamics365Configuration'][_0x53d6('0x42')](_0x38934e)['then'](handleEntityNotFound(_0x21c110,null))[_0x53d6('0x25')](respondWithResult(_0x21c110,null))[_0x53d6('0x3d')](handleError(_0x21c110,null));};exports[_0x53d6('0x43')]=function(_0x59f45b,_0x31c760){return db[_0x53d6('0x28')][_0x53d6('0x43')](_0x59f45b['body'],{})[_0x53d6('0x25')](respondWithResult(_0x31c760,0xc9))[_0x53d6('0x3d')](handleError(_0x31c760,null));};exports[_0x53d6('0x44')]=function(_0x17e1aa,_0x3f25c){if(_0x17e1aa[_0x53d6('0x45')]['id']){delete _0x17e1aa['body']['id'];}return db[_0x53d6('0x28')][_0x53d6('0x42')]({'where':{'id':_0x17e1aa[_0x53d6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3f25c,null))['then'](saveUpdates(_0x17e1aa[_0x53d6('0x45')],null))[_0x53d6('0x25')](respondWithResult(_0x3f25c,null))[_0x53d6('0x3d')](handleError(_0x3f25c,null));};exports[_0x53d6('0x24')]=function(_0x64dea3,_0x3de7d7){return db[_0x53d6('0x28')]['find']({'where':{'id':_0x64dea3[_0x53d6('0x3f')]['id']}})[_0x53d6('0x25')](handleEntityNotFound(_0x3de7d7,null))['then'](removeEntity(_0x3de7d7,null))['catch'](handleError(_0x3de7d7,null));};exports[_0x53d6('0x46')]=function(_0xdbbc59,_0x271464,_0x474e6e){var _0x523abb={};var _0x194447={};var _0x5e6f30;var _0x2b8b8a;return db[_0x53d6('0x28')][_0x53d6('0x47')]({'where':{'id':_0xdbbc59[_0x53d6('0x3f')]['id']}})[_0x53d6('0x25')](handleEntityNotFound(_0x271464,null))[_0x53d6('0x25')](function(_0xba8003){if(_0xba8003){_0x5e6f30=_0xba8003;_0x194447[_0x53d6('0x2c')]=_[_0x53d6('0x40')](db[_0x53d6('0x48')][_0x53d6('0x29')]);_0x194447[_0x53d6('0x2e')]=_[_0x53d6('0x40')](_0xdbbc59['query']);_0x194447[_0x53d6('0x2f')]=_[_0x53d6('0x30')](_0x194447[_0x53d6('0x2c')],_0x194447['query']);_0x523abb[_0x53d6('0x31')]=_[_0x53d6('0x30')](_0x194447[_0x53d6('0x2c')],qs[_0x53d6('0x32')](_0xdbbc59[_0x53d6('0x2e')][_0x53d6('0x32')]));_0x523abb[_0x53d6('0x31')]=_0x523abb[_0x53d6('0x31')][_0x53d6('0x33')]?_0x523abb['attributes']:_0x194447[_0x53d6('0x2c')];_0x523abb[_0x53d6('0x49')]=qs[_0x53d6('0x34')](_0xdbbc59[_0x53d6('0x2e')][_0x53d6('0x34')]);_0x523abb[_0x53d6('0x38')]=qs[_0x53d6('0x2f')](_[_0x53d6('0x35')](_0xdbbc59['query'],_0x194447[_0x53d6('0x2f')]));if(_0xdbbc59[_0x53d6('0x2e')][_0x53d6('0x36')]){_0x523abb[_0x53d6('0x38')]=_['merge'](_0x523abb['where'],{'$or':_[_0x53d6('0x2d')](_0x523abb[_0x53d6('0x31')],function(_0x54fd6f){var _0x4d358f={};_0x4d358f[_0x54fd6f]={'$like':'%'+_0xdbbc59['query'][_0x53d6('0x36')]+'%'};return _0x4d358f;})});}_0x523abb=_[_0x53d6('0x37')]({},_0x523abb,_0xdbbc59['options']);return _0x5e6f30['getFields'](_0x523abb);}})[_0x53d6('0x25')](function(_0x1cec32){if(_0x1cec32){_0x2b8b8a=_0x1cec32[_0x53d6('0x33')];if(!_0xdbbc59[_0x53d6('0x2e')]['hasOwnProperty'](_0x53d6('0x4a'))){_0x523abb['limit']=qs[_0x53d6('0x1b')](_0xdbbc59[_0x53d6('0x2e')]['limit']);_0x523abb[_0x53d6('0x1d')]=qs['offset'](_0xdbbc59[_0x53d6('0x2e')][_0x53d6('0x1d')]);}return _0x5e6f30[_0x53d6('0x46')](_0x523abb);}})[_0x53d6('0x25')](function(_0x43e475){if(_0x43e475){return _0x43e475?{'count':_0x2b8b8a,'rows':_0x43e475}:null;}})[_0x53d6('0x25')](respondWithResult(_0x271464,null))[_0x53d6('0x3d')](handleError(_0x271464,null));};exports[_0x53d6('0x4b')]=function(_0x100aa8,_0x385465,_0x55c4e1){var _0x30daf2={};var _0x336da2={};var _0x47449d;var _0x50be95;return db[_0x53d6('0x28')][_0x53d6('0x47')]({'where':{'id':_0x100aa8['params']['id']}})['then'](handleEntityNotFound(_0x385465,null))[_0x53d6('0x25')](function(_0x47721a){if(_0x47721a){_0x47449d=_0x47721a;_0x336da2['model']=_[_0x53d6('0x40')](db[_0x53d6('0x48')][_0x53d6('0x29')]);_0x336da2[_0x53d6('0x2e')]=_[_0x53d6('0x40')](_0x100aa8[_0x53d6('0x2e')]);_0x336da2[_0x53d6('0x2f')]=_[_0x53d6('0x30')](_0x336da2['model'],_0x336da2[_0x53d6('0x2e')]);_0x30daf2[_0x53d6('0x31')]=_[_0x53d6('0x30')](_0x336da2[_0x53d6('0x2c')],qs[_0x53d6('0x32')](_0x100aa8[_0x53d6('0x2e')]['fields']));_0x30daf2[_0x53d6('0x31')]=_0x30daf2[_0x53d6('0x31')][_0x53d6('0x33')]?_0x30daf2['attributes']:_0x336da2[_0x53d6('0x2c')];_0x30daf2[_0x53d6('0x49')]=qs[_0x53d6('0x34')](_0x100aa8[_0x53d6('0x2e')][_0x53d6('0x34')]);_0x30daf2[_0x53d6('0x38')]=qs['filters'](_[_0x53d6('0x35')](_0x100aa8['query'],_0x336da2['filters']));if(_0x100aa8[_0x53d6('0x2e')][_0x53d6('0x36')]){_0x30daf2['where']=_[_0x53d6('0x37')](_0x30daf2['where'],{'$or':_[_0x53d6('0x2d')](_0x30daf2['attributes'],function(_0x1a86da){var _0x8e0f84={};_0x8e0f84[_0x1a86da]={'$like':'%'+_0x100aa8[_0x53d6('0x2e')][_0x53d6('0x36')]+'%'};return _0x8e0f84;})});}_0x30daf2=_['merge']({},_0x30daf2,_0x100aa8[_0x53d6('0x3a')]);return _0x47449d[_0x53d6('0x4b')](_0x30daf2);}})[_0x53d6('0x25')](function(_0x3a37c2){if(_0x3a37c2){_0x50be95=_0x3a37c2['length'];if(!_0x100aa8[_0x53d6('0x2e')][_0x53d6('0x4c')](_0x53d6('0x4a'))){_0x30daf2[_0x53d6('0x1b')]=qs[_0x53d6('0x1b')](_0x100aa8[_0x53d6('0x2e')][_0x53d6('0x1b')]);_0x30daf2['offset']=qs[_0x53d6('0x1d')](_0x100aa8['query']['offset']);}return _0x47449d[_0x53d6('0x4b')](_0x30daf2);}})[_0x53d6('0x25')](function(_0x2df754){if(_0x2df754){return _0x2df754?{'count':_0x50be95,'rows':_0x2df754}:null;}})['then'](respondWithResult(_0x385465,null))['catch'](handleError(_0x385465,null));};exports['getDescriptions']=function(_0x280022,_0x56bba3,_0x3c5295){var _0x12131a={};var _0x2b0340={};var _0x2b1b5b;var _0x32aeef;return db[_0x53d6('0x28')][_0x53d6('0x47')]({'where':{'id':_0x280022[_0x53d6('0x3f')]['id']}})[_0x53d6('0x25')](handleEntityNotFound(_0x56bba3,null))['then'](function(_0x573bfe){if(_0x573bfe){_0x2b1b5b=_0x573bfe;_0x2b0340['model']=_[_0x53d6('0x40')](db[_0x53d6('0x48')][_0x53d6('0x29')]);_0x2b0340[_0x53d6('0x2e')]=_['keys'](_0x280022[_0x53d6('0x2e')]);_0x2b0340[_0x53d6('0x2f')]=_[_0x53d6('0x30')](_0x2b0340['model'],_0x2b0340['query']);_0x12131a['attributes']=_[_0x53d6('0x30')](_0x2b0340[_0x53d6('0x2c')],qs[_0x53d6('0x32')](_0x280022[_0x53d6('0x2e')][_0x53d6('0x32')]));_0x12131a[_0x53d6('0x31')]=_0x12131a[_0x53d6('0x31')][_0x53d6('0x33')]?_0x12131a[_0x53d6('0x31')]:_0x2b0340[_0x53d6('0x2c')];_0x12131a[_0x53d6('0x49')]=qs[_0x53d6('0x34')](_0x280022[_0x53d6('0x2e')][_0x53d6('0x34')]);_0x12131a[_0x53d6('0x38')]=qs[_0x53d6('0x2f')](_['pick'](_0x280022[_0x53d6('0x2e')],_0x2b0340[_0x53d6('0x2f')]));if(_0x280022['query'][_0x53d6('0x36')]){_0x12131a[_0x53d6('0x38')]=_['merge'](_0x12131a[_0x53d6('0x38')],{'$or':_[_0x53d6('0x2d')](_0x12131a['attributes'],function(_0x2feea5){var _0x237892={};_0x237892[_0x2feea5]={'$like':'%'+_0x280022[_0x53d6('0x2e')][_0x53d6('0x36')]+'%'};return _0x237892;})});}_0x12131a=_['merge']({},_0x12131a,_0x280022[_0x53d6('0x3a')]);return _0x2b1b5b[_0x53d6('0x4d')](_0x12131a);}})[_0x53d6('0x25')](function(_0x3bdc41){if(_0x3bdc41){_0x32aeef=_0x3bdc41[_0x53d6('0x33')];if(!_0x280022[_0x53d6('0x2e')][_0x53d6('0x4c')]('nolimit')){_0x12131a[_0x53d6('0x1b')]=qs['limit'](_0x280022['query'][_0x53d6('0x1b')]);_0x12131a['offset']=qs['offset'](_0x280022[_0x53d6('0x2e')]['offset']);}return _0x2b1b5b[_0x53d6('0x4d')](_0x12131a);}})[_0x53d6('0x25')](function(_0x51b211){if(_0x51b211){return _0x51b211?{'count':_0x32aeef,'rows':_0x51b211}:null;}})[_0x53d6('0x25')](respondWithResult(_0x56bba3,null))[_0x53d6('0x3d')](handleError(_0x56bba3,null));}; \ No newline at end of file +var _0xad19=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','apply','reject','save','update','destroy','then','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','merge','find','create','body','params','getFields','findOne','Dynamics365Field','rawAttributes','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0xad19,0x16f));var _0x9ad1=function(_0x5f544a,_0x3589e6){_0x5f544a=_0x5f544a-0x0;var _0x29ad42=_0xad19[_0x5f544a];return _0x29ad42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ad1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ad1('0x1'));var rp=require(_0x9ad1('0x2'));var moment=require(_0x9ad1('0x3'));var BPromise=require(_0x9ad1('0x4'));var Mustache=require(_0x9ad1('0x5'));var util=require('util');var path=require(_0x9ad1('0x6'));var sox=require(_0x9ad1('0x7'));var csv=require(_0x9ad1('0x8'));var ejs=require(_0x9ad1('0x9'));var fs=require('fs');var fs_extra=require(_0x9ad1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ad1('0xb'));var deskjs=require(_0x9ad1('0xc'));var toCsv=require(_0x9ad1('0x8'));var querystring=require(_0x9ad1('0xd'));var Papa=require(_0x9ad1('0xe'));var Redis=require(_0x9ad1('0xf'));var authService=require(_0x9ad1('0x10'));var qs=require(_0x9ad1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ad1('0x12'));var logger=require(_0x9ad1('0x13'))(_0x9ad1('0x14'));var utils=require('../../config/utils');var config=require(_0x9ad1('0x15'));var licenseUtil=require(_0x9ad1('0x16'));var db=require(_0x9ad1('0x17'))['db'];function respondWithStatusCode(_0x4bf2f3,_0x1790d6){_0x1790d6=_0x1790d6||0xcc;return function(_0x1f5428){if(_0x1f5428){return _0x4bf2f3[_0x9ad1('0x18')](_0x1790d6);}return _0x4bf2f3[_0x9ad1('0x19')](_0x1790d6)[_0x9ad1('0x1a')]();};}function respondWithResult(_0x4936d1,_0xf397d7){_0xf397d7=_0xf397d7||0xc8;return function(_0x39d176){if(_0x39d176){return _0x4936d1[_0x9ad1('0x19')](_0xf397d7)['json'](_0x39d176);}};}function respondWithFilteredResult(_0x4ecc44,_0x1373d3){return function(_0x45378f){if(_0x45378f){var _0x432e87=typeof _0x1373d3['offset']==='undefined'&&typeof _0x1373d3['limit']===_0x9ad1('0x1b');var _0x123284=_0x45378f[_0x9ad1('0x1c')];var _0x3810ba=_0x432e87?0x0:_0x1373d3[_0x9ad1('0x1d')];var _0x5d71fb=_0x432e87?_0x45378f[_0x9ad1('0x1c')]:_0x1373d3[_0x9ad1('0x1d')]+_0x1373d3[_0x9ad1('0x1e')];var _0x15cb16;if(_0x5d71fb>=_0x123284){_0x5d71fb=_0x123284;_0x15cb16=0xc8;}else{_0x15cb16=0xce;}_0x4ecc44[_0x9ad1('0x19')](_0x15cb16);return _0x4ecc44['set']('Content-Range',_0x3810ba+'-'+_0x5d71fb+'/'+_0x123284)['json'](_0x45378f);}return null;};}function patchUpdates(_0x562217){return function(_0x41b75a){try{jsonpatch[_0x9ad1('0x1f')](_0x41b75a,_0x562217,!![]);}catch(_0x3369d8){return BPromise[_0x9ad1('0x20')](_0x3369d8);}return _0x41b75a[_0x9ad1('0x21')]();};}function saveUpdates(_0x3f3142,_0x4bb0fd){return function(_0x1c9001){if(_0x1c9001){return _0x1c9001[_0x9ad1('0x22')](_0x3f3142)['then'](function(_0x179011){return _0x179011;});}return null;};}function removeEntity(_0x12f08c,_0x7066ab){return function(_0x6ee896){if(_0x6ee896){return _0x6ee896[_0x9ad1('0x23')]()[_0x9ad1('0x24')](function(){_0x12f08c['status'](0xcc)[_0x9ad1('0x1a')]();});}};}function handleEntityNotFound(_0x5a8412,_0x66fcf8){return function(_0x36a236){if(!_0x36a236){_0x5a8412[_0x9ad1('0x18')](0x194);}return _0x36a236;};}function handleError(_0x31d074,_0x4c0a4d){_0x4c0a4d=_0x4c0a4d||0x1f4;return function(_0xfce772){logger['error'](_0xfce772['stack']);if(_0xfce772[_0x9ad1('0x25')]){delete _0xfce772[_0x9ad1('0x25')];}_0x31d074[_0x9ad1('0x19')](_0x4c0a4d)[_0x9ad1('0x26')](_0xfce772);};}exports[_0x9ad1('0x27')]=function(_0x5f96c2,_0x342ce9){var _0x19382e={},_0x3ffd21={},_0x7c3c23={'count':0x0,'rows':[]};var _0x24a6ab=_[_0x9ad1('0x28')](db[_0x9ad1('0x29')]['rawAttributes'],function(_0x2d8840){return{'name':_0x2d8840[_0x9ad1('0x2a')],'type':_0x2d8840[_0x9ad1('0x2b')][_0x9ad1('0x2c')]};});_0x3ffd21[_0x9ad1('0x2d')]=_[_0x9ad1('0x28')](_0x24a6ab,'name');_0x3ffd21['query']=_[_0x9ad1('0x2e')](_0x5f96c2[_0x9ad1('0x2f')]);_0x3ffd21[_0x9ad1('0x30')]=_[_0x9ad1('0x31')](_0x3ffd21[_0x9ad1('0x2d')],_0x3ffd21[_0x9ad1('0x2f')]);_0x19382e[_0x9ad1('0x32')]=_[_0x9ad1('0x31')](_0x3ffd21[_0x9ad1('0x2d')],qs[_0x9ad1('0x33')](_0x5f96c2[_0x9ad1('0x2f')][_0x9ad1('0x33')]));_0x19382e[_0x9ad1('0x32')]=_0x19382e[_0x9ad1('0x32')][_0x9ad1('0x34')]?_0x19382e[_0x9ad1('0x32')]:_0x3ffd21[_0x9ad1('0x2d')];if(!_0x5f96c2[_0x9ad1('0x2f')][_0x9ad1('0x35')](_0x9ad1('0x36'))){_0x19382e[_0x9ad1('0x1e')]=qs[_0x9ad1('0x1e')](_0x5f96c2[_0x9ad1('0x2f')][_0x9ad1('0x1e')]);_0x19382e[_0x9ad1('0x1d')]=qs[_0x9ad1('0x1d')](_0x5f96c2[_0x9ad1('0x2f')][_0x9ad1('0x1d')]);}_0x19382e[_0x9ad1('0x37')]=qs[_0x9ad1('0x38')](_0x5f96c2[_0x9ad1('0x2f')][_0x9ad1('0x38')]);_0x19382e[_0x9ad1('0x39')]=qs[_0x9ad1('0x30')](_[_0x9ad1('0x3a')](_0x5f96c2[_0x9ad1('0x2f')],_0x3ffd21[_0x9ad1('0x30')]),_0x24a6ab);if(_0x5f96c2['query'][_0x9ad1('0x3b')]){_0x19382e['where']=_['merge'](_0x19382e[_0x9ad1('0x39')],{'$or':_['map'](_0x24a6ab,function(_0x4b75a9){if(_0x4b75a9[_0x9ad1('0x2b')]!==_0x9ad1('0x3c')){var _0x3c28a0={};_0x3c28a0[_0x4b75a9[_0x9ad1('0x25')]]={'$like':'%'+_0x5f96c2[_0x9ad1('0x2f')][_0x9ad1('0x3b')]+'%'};return _0x3c28a0;}})});}_0x19382e=_['merge']({},_0x19382e,_0x5f96c2[_0x9ad1('0x3d')]);var _0x5276f3={'where':_0x19382e[_0x9ad1('0x39')]};return db[_0x9ad1('0x29')]['count'](_0x5276f3)[_0x9ad1('0x24')](function(_0x1754fd){_0x7c3c23[_0x9ad1('0x1c')]=_0x1754fd;if(_0x5f96c2[_0x9ad1('0x2f')]['includeAll']){_0x19382e[_0x9ad1('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x9ad1('0x3f')](_0x19382e);})['then'](function(_0x420ac7){_0x7c3c23['rows']=_0x420ac7;return _0x7c3c23;})[_0x9ad1('0x24')](respondWithFilteredResult(_0x342ce9,_0x19382e))[_0x9ad1('0x40')](handleError(_0x342ce9,null));};exports['show']=function(_0x1e33d0,_0x2439e6){var _0x172688={'raw':![],'where':{'id':_0x1e33d0['params']['id']}},_0x34a80f={};_0x34a80f[_0x9ad1('0x2d')]=_[_0x9ad1('0x2e')](db[_0x9ad1('0x29')]['rawAttributes']);_0x34a80f['query']=_[_0x9ad1('0x2e')](_0x1e33d0[_0x9ad1('0x2f')]);_0x34a80f['filters']=_[_0x9ad1('0x31')](_0x34a80f[_0x9ad1('0x2d')],_0x34a80f['query']);_0x172688[_0x9ad1('0x32')]=_[_0x9ad1('0x31')](_0x34a80f['model'],qs[_0x9ad1('0x33')](_0x1e33d0[_0x9ad1('0x2f')][_0x9ad1('0x33')]));_0x172688[_0x9ad1('0x32')]=_0x172688[_0x9ad1('0x32')][_0x9ad1('0x34')]?_0x172688[_0x9ad1('0x32')]:_0x34a80f[_0x9ad1('0x2d')];if(_0x1e33d0[_0x9ad1('0x2f')]['includeAll']){_0x172688[_0x9ad1('0x3e')]=[{'all':!![]}];}_0x172688=_[_0x9ad1('0x41')]({},_0x172688,_0x1e33d0[_0x9ad1('0x3d')]);return db[_0x9ad1('0x29')][_0x9ad1('0x42')](_0x172688)[_0x9ad1('0x24')](handleEntityNotFound(_0x2439e6,null))[_0x9ad1('0x24')](respondWithResult(_0x2439e6,null))[_0x9ad1('0x40')](handleError(_0x2439e6,null));};exports[_0x9ad1('0x43')]=function(_0x39f0a7,_0x25ab9c){return db[_0x9ad1('0x29')][_0x9ad1('0x43')](_0x39f0a7['body'],{})['then'](respondWithResult(_0x25ab9c,0xc9))['catch'](handleError(_0x25ab9c,null));};exports[_0x9ad1('0x22')]=function(_0x58af13,_0x5e8130){if(_0x58af13[_0x9ad1('0x44')]['id']){delete _0x58af13[_0x9ad1('0x44')]['id'];}return db[_0x9ad1('0x29')][_0x9ad1('0x42')]({'where':{'id':_0x58af13[_0x9ad1('0x45')]['id']}})[_0x9ad1('0x24')](handleEntityNotFound(_0x5e8130,null))[_0x9ad1('0x24')](saveUpdates(_0x58af13['body'],null))[_0x9ad1('0x24')](respondWithResult(_0x5e8130,null))[_0x9ad1('0x40')](handleError(_0x5e8130,null));};exports['destroy']=function(_0x2d3050,_0x310d3e){return db[_0x9ad1('0x29')]['find']({'where':{'id':_0x2d3050[_0x9ad1('0x45')]['id']}})[_0x9ad1('0x24')](handleEntityNotFound(_0x310d3e,null))[_0x9ad1('0x24')](removeEntity(_0x310d3e,null))[_0x9ad1('0x40')](handleError(_0x310d3e,null));};exports[_0x9ad1('0x46')]=function(_0x39aa93,_0x3393d4,_0x4619db){var _0x4be68a={};var _0x17dc69={};var _0xa46ffe;var _0x581a74;return db['Dynamics365Configuration'][_0x9ad1('0x47')]({'where':{'id':_0x39aa93[_0x9ad1('0x45')]['id']}})[_0x9ad1('0x24')](handleEntityNotFound(_0x3393d4,null))[_0x9ad1('0x24')](function(_0x4f23db){if(_0x4f23db){_0xa46ffe=_0x4f23db;_0x17dc69[_0x9ad1('0x2d')]=_[_0x9ad1('0x2e')](db[_0x9ad1('0x48')][_0x9ad1('0x49')]);_0x17dc69[_0x9ad1('0x2f')]=_['keys'](_0x39aa93[_0x9ad1('0x2f')]);_0x17dc69[_0x9ad1('0x30')]=_[_0x9ad1('0x31')](_0x17dc69['model'],_0x17dc69[_0x9ad1('0x2f')]);_0x4be68a[_0x9ad1('0x32')]=_[_0x9ad1('0x31')](_0x17dc69[_0x9ad1('0x2d')],qs[_0x9ad1('0x33')](_0x39aa93[_0x9ad1('0x2f')][_0x9ad1('0x33')]));_0x4be68a[_0x9ad1('0x32')]=_0x4be68a[_0x9ad1('0x32')][_0x9ad1('0x34')]?_0x4be68a[_0x9ad1('0x32')]:_0x17dc69[_0x9ad1('0x2d')];_0x4be68a[_0x9ad1('0x37')]=qs[_0x9ad1('0x38')](_0x39aa93[_0x9ad1('0x2f')][_0x9ad1('0x38')]);_0x4be68a[_0x9ad1('0x39')]=qs[_0x9ad1('0x30')](_[_0x9ad1('0x3a')](_0x39aa93['query'],_0x17dc69[_0x9ad1('0x30')]));if(_0x39aa93[_0x9ad1('0x2f')]['filter']){_0x4be68a[_0x9ad1('0x39')]=_[_0x9ad1('0x41')](_0x4be68a[_0x9ad1('0x39')],{'$or':_['map'](_0x4be68a[_0x9ad1('0x32')],function(_0x50d068){var _0x4cc789={};_0x4cc789[_0x50d068]={'$like':'%'+_0x39aa93[_0x9ad1('0x2f')][_0x9ad1('0x3b')]+'%'};return _0x4cc789;})});}_0x4be68a=_[_0x9ad1('0x41')]({},_0x4be68a,_0x39aa93[_0x9ad1('0x3d')]);return _0xa46ffe[_0x9ad1('0x46')](_0x4be68a);}})[_0x9ad1('0x24')](function(_0x27393c){if(_0x27393c){_0x581a74=_0x27393c[_0x9ad1('0x34')];if(!_0x39aa93['query'][_0x9ad1('0x35')](_0x9ad1('0x36'))){_0x4be68a['limit']=qs['limit'](_0x39aa93[_0x9ad1('0x2f')]['limit']);_0x4be68a['offset']=qs['offset'](_0x39aa93[_0x9ad1('0x2f')]['offset']);}return _0xa46ffe['getFields'](_0x4be68a);}})['then'](function(_0x4c9f2c){if(_0x4c9f2c){return _0x4c9f2c?{'count':_0x581a74,'rows':_0x4c9f2c}:null;}})[_0x9ad1('0x24')](respondWithResult(_0x3393d4,null))[_0x9ad1('0x40')](handleError(_0x3393d4,null));};exports['getSubjects']=function(_0x32e02a,_0x18c18f,_0x54be6a){var _0xb19733={};var _0x45538f={};var _0x1bdccd;var _0x2ea4fd;return db['Dynamics365Configuration'][_0x9ad1('0x47')]({'where':{'id':_0x32e02a[_0x9ad1('0x45')]['id']}})[_0x9ad1('0x24')](handleEntityNotFound(_0x18c18f,null))[_0x9ad1('0x24')](function(_0x2c5b35){if(_0x2c5b35){_0x1bdccd=_0x2c5b35;_0x45538f[_0x9ad1('0x2d')]=_[_0x9ad1('0x2e')](db[_0x9ad1('0x48')][_0x9ad1('0x49')]);_0x45538f[_0x9ad1('0x2f')]=_['keys'](_0x32e02a[_0x9ad1('0x2f')]);_0x45538f[_0x9ad1('0x30')]=_[_0x9ad1('0x31')](_0x45538f['model'],_0x45538f[_0x9ad1('0x2f')]);_0xb19733[_0x9ad1('0x32')]=_[_0x9ad1('0x31')](_0x45538f['model'],qs[_0x9ad1('0x33')](_0x32e02a['query']['fields']));_0xb19733[_0x9ad1('0x32')]=_0xb19733[_0x9ad1('0x32')][_0x9ad1('0x34')]?_0xb19733[_0x9ad1('0x32')]:_0x45538f[_0x9ad1('0x2d')];_0xb19733[_0x9ad1('0x37')]=qs[_0x9ad1('0x38')](_0x32e02a[_0x9ad1('0x2f')][_0x9ad1('0x38')]);_0xb19733['where']=qs[_0x9ad1('0x30')](_[_0x9ad1('0x3a')](_0x32e02a[_0x9ad1('0x2f')],_0x45538f['filters']));if(_0x32e02a[_0x9ad1('0x2f')][_0x9ad1('0x3b')]){_0xb19733[_0x9ad1('0x39')]=_[_0x9ad1('0x41')](_0xb19733[_0x9ad1('0x39')],{'$or':_[_0x9ad1('0x28')](_0xb19733[_0x9ad1('0x32')],function(_0x5c1407){var _0x23f5e9={};_0x23f5e9[_0x5c1407]={'$like':'%'+_0x32e02a[_0x9ad1('0x2f')][_0x9ad1('0x3b')]+'%'};return _0x23f5e9;})});}_0xb19733=_[_0x9ad1('0x41')]({},_0xb19733,_0x32e02a[_0x9ad1('0x3d')]);return _0x1bdccd[_0x9ad1('0x4a')](_0xb19733);}})[_0x9ad1('0x24')](function(_0x4154a8){if(_0x4154a8){_0x2ea4fd=_0x4154a8[_0x9ad1('0x34')];if(!_0x32e02a[_0x9ad1('0x2f')][_0x9ad1('0x35')](_0x9ad1('0x36'))){_0xb19733[_0x9ad1('0x1e')]=qs[_0x9ad1('0x1e')](_0x32e02a['query'][_0x9ad1('0x1e')]);_0xb19733['offset']=qs[_0x9ad1('0x1d')](_0x32e02a[_0x9ad1('0x2f')]['offset']);}return _0x1bdccd[_0x9ad1('0x4a')](_0xb19733);}})[_0x9ad1('0x24')](function(_0x4eac72){if(_0x4eac72){return _0x4eac72?{'count':_0x2ea4fd,'rows':_0x4eac72}:null;}})[_0x9ad1('0x24')](respondWithResult(_0x18c18f,null))['catch'](handleError(_0x18c18f,null));};exports[_0x9ad1('0x4b')]=function(_0x4d028c,_0x2208e4,_0x4b69cc){var _0xee254a={};var _0x797070={};var _0x2249aa;var _0x1d3c74;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x4d028c[_0x9ad1('0x45')]['id']}})[_0x9ad1('0x24')](handleEntityNotFound(_0x2208e4,null))['then'](function(_0x249259){if(_0x249259){_0x2249aa=_0x249259;_0x797070[_0x9ad1('0x2d')]=_['keys'](db['Dynamics365Field'][_0x9ad1('0x49')]);_0x797070[_0x9ad1('0x2f')]=_[_0x9ad1('0x2e')](_0x4d028c['query']);_0x797070[_0x9ad1('0x30')]=_[_0x9ad1('0x31')](_0x797070[_0x9ad1('0x2d')],_0x797070['query']);_0xee254a[_0x9ad1('0x32')]=_[_0x9ad1('0x31')](_0x797070['model'],qs[_0x9ad1('0x33')](_0x4d028c[_0x9ad1('0x2f')][_0x9ad1('0x33')]));_0xee254a['attributes']=_0xee254a['attributes'][_0x9ad1('0x34')]?_0xee254a[_0x9ad1('0x32')]:_0x797070['model'];_0xee254a[_0x9ad1('0x37')]=qs[_0x9ad1('0x38')](_0x4d028c['query'][_0x9ad1('0x38')]);_0xee254a[_0x9ad1('0x39')]=qs[_0x9ad1('0x30')](_[_0x9ad1('0x3a')](_0x4d028c[_0x9ad1('0x2f')],_0x797070[_0x9ad1('0x30')]));if(_0x4d028c['query'][_0x9ad1('0x3b')]){_0xee254a[_0x9ad1('0x39')]=_[_0x9ad1('0x41')](_0xee254a['where'],{'$or':_[_0x9ad1('0x28')](_0xee254a['attributes'],function(_0x240790){var _0x5e54a8={};_0x5e54a8[_0x240790]={'$like':'%'+_0x4d028c[_0x9ad1('0x2f')]['filter']+'%'};return _0x5e54a8;})});}_0xee254a=_['merge']({},_0xee254a,_0x4d028c[_0x9ad1('0x3d')]);return _0x2249aa['getDescriptions'](_0xee254a);}})['then'](function(_0xacb051){if(_0xacb051){_0x1d3c74=_0xacb051[_0x9ad1('0x34')];if(!_0x4d028c['query'][_0x9ad1('0x35')](_0x9ad1('0x36'))){_0xee254a['limit']=qs['limit'](_0x4d028c[_0x9ad1('0x2f')][_0x9ad1('0x1e')]);_0xee254a['offset']=qs['offset'](_0x4d028c[_0x9ad1('0x2f')][_0x9ad1('0x1d')]);}return _0x2249aa[_0x9ad1('0x4b')](_0xee254a);}})[_0x9ad1('0x24')](function(_0x5b5550){if(_0x5b5550){return _0x5b5550?{'count':_0x1d3c74,'rows':_0x5b5550}:null;}})[_0x9ad1('0x24')](respondWithResult(_0x2208e4,null))[_0x9ad1('0x40')](handleError(_0x2208e4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 6f6b560..2f1372b 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 _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xe14d,0x1ee));var _0xde14=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe14d[_0x13e741];return _0x3f8bb3;};'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 +var _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x4e13f8,_0x5b6c97){var _0x1125e5=function(_0x4d22be){while(--_0x4d22be){_0x4e13f8['push'](_0x4e13f8['shift']());}};_0x1125e5(++_0x5b6c97);}(_0x84ab,0x12f));var _0xb84a=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x84ab[_0x59eefb];return _0x1a49e8;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 74a3768..6d4dbb8 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 _0xb3bd=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0xb3bd,0x94));var _0xdb3b=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0xb3bd[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0xdb3b('0x0'));var util=require(_0xdb3b('0x1'));var moment=require(_0xdb3b('0x2'));var BPromise=require(_0xdb3b('0x3'));var rs=require(_0xdb3b('0x4'));var fs=require('fs');var Redis=require(_0xdb3b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb3b('0x6'));var logger=require(_0xdb3b('0x7'))(_0xdb3b('0x8'));var config=require(_0xdb3b('0x9'));var jayson=require(_0xdb3b('0xa'));var client=jayson[_0xdb3b('0xb')][_0xdb3b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x186137,_0x15cb2e,_0x415d90){return new BPromise(function(_0x7af505,_0x5f197a){return client[_0xdb3b('0xd')](_0x186137,_0x415d90)['then'](function(_0x23a327){logger['info'](_0xdb3b('0xe'),_0x15cb2e,_0xdb3b('0xf'));logger[_0xdb3b('0x10')](_0xdb3b('0x11'),_0x15cb2e,_0xdb3b('0xf'),JSON[_0xdb3b('0x12')](_0x23a327));if(_0x23a327[_0xdb3b('0x13')]){if(_0x23a327[_0xdb3b('0x13')][_0xdb3b('0x14')]===0x1f4){logger[_0xdb3b('0x13')](_0xdb3b('0xe'),_0x15cb2e,_0x23a327[_0xdb3b('0x13')][_0xdb3b('0x15')]);return _0x5f197a(_0x23a327[_0xdb3b('0x13')]['message']);}logger[_0xdb3b('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x15cb2e,_0x23a327[_0xdb3b('0x13')][_0xdb3b('0x15')]);return _0x7af505(_0x23a327['error'][_0xdb3b('0x15')]);}else{logger[_0xdb3b('0x16')](_0xdb3b('0xe'),_0x15cb2e,_0xdb3b('0xf'));_0x7af505(_0x23a327[_0xdb3b('0x17')][_0xdb3b('0x15')]);}})['catch'](function(_0x968c98){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x15cb2e,_0x968c98);_0x5f197a(_0x968c98);});});} \ No newline at end of file +var _0xc35a=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x560bff,_0x415162){var _0x397fd7=function(_0x51d7dc){while(--_0x51d7dc){_0x560bff['push'](_0x560bff['shift']());}};_0x397fd7(++_0x415162);}(_0xc35a,0x1cf));var _0xac35=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc35a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xac35('0x0'));var util=require(_0xac35('0x1'));var moment=require(_0xac35('0x2'));var BPromise=require('bluebird');var rs=require(_0xac35('0x3'));var fs=require('fs');var Redis=require(_0xac35('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac35('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xac35('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xac35('0x7')][_0xac35('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x591387,_0x5aedfc,_0xa4ad22){return new BPromise(function(_0x3fae0c,_0x2cb3f7){return client[_0xac35('0x9')](_0x591387,_0xa4ad22)[_0xac35('0xa')](function(_0x10ac70){logger[_0xac35('0xb')](_0xac35('0xc'),_0x5aedfc,'request\x20sent');logger[_0xac35('0xd')](_0xac35('0xe'),_0x5aedfc,_0xac35('0xf'),JSON[_0xac35('0x10')](_0x10ac70));if(_0x10ac70['error']){if(_0x10ac70[_0xac35('0x11')][_0xac35('0x12')]===0x1f4){logger[_0xac35('0x11')](_0xac35('0xc'),_0x5aedfc,_0x10ac70[_0xac35('0x11')][_0xac35('0x13')]);return _0x2cb3f7(_0x10ac70[_0xac35('0x11')][_0xac35('0x13')]);}logger['error'](_0xac35('0xc'),_0x5aedfc,_0x10ac70[_0xac35('0x11')][_0xac35('0x13')]);return _0x3fae0c(_0x10ac70[_0xac35('0x11')][_0xac35('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5aedfc,'request\x20sent');_0x3fae0c(_0x10ac70[_0xac35('0x14')][_0xac35('0x13')]);}})[_0xac35('0x15')](function(_0x4dc90a){logger[_0xac35('0x11')](_0xac35('0xc'),_0x5aedfc,_0x4dc90a);_0x2cb3f7(_0x4dc90a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index c3c4064..c81e597 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 _0x769f=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0x769f,0x198));var _0xf769=function(_0x2ed811,_0x3cc02a){_0x2ed811=_0x2ed811-0x0;var _0x575f00=_0x769f[_0x2ed811];return _0x575f00;};'use strict';var multer=require('multer');var util=require(_0xf769('0x0'));var path=require(_0xf769('0x1'));var timeout=require('connect-timeout');var express=require(_0xf769('0x2'));var router=express['Router']();var fs_extra=require(_0xf769('0x3'));var auth=require(_0xf769('0x4'));var interaction=require(_0xf769('0x5'));var config=require('../../config/environment');var controller=require(_0xf769('0x6'));router[_0xf769('0x7')]('/',auth[_0xf769('0x8')](),controller[_0xf769('0x9')]);router[_0xf769('0x7')](_0xf769('0xa'),auth[_0xf769('0x8')](),controller[_0xf769('0xb')]);router[_0xf769('0xc')]('/',auth[_0xf769('0x8')](),controller[_0xf769('0xd')]);router['put'](_0xf769('0xa'),auth[_0xf769('0x8')](),controller[_0xf769('0xe')]);router[_0xf769('0xf')](_0xf769('0xa'),auth[_0xf769('0x8')](),controller[_0xf769('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4c90=['delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','/:id','update'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0x4c90,0x172));var _0x04c9=function(_0x1376d5,_0x78f6ed){_0x1376d5=_0x1376d5-0x0;var _0xc0b6a1=_0x4c90[_0x1376d5];return _0xc0b6a1;};'use strict';var multer=require(_0x04c9('0x0'));var util=require(_0x04c9('0x1'));var path=require('path');var timeout=require(_0x04c9('0x2'));var express=require(_0x04c9('0x3'));var router=express['Router']();var fs_extra=require(_0x04c9('0x4'));var auth=require(_0x04c9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x04c9('0x6'));var controller=require(_0x04c9('0x7'));router[_0x04c9('0x8')]('/',auth[_0x04c9('0x9')](),controller[_0x04c9('0xa')]);router[_0x04c9('0x8')]('/:id',auth[_0x04c9('0x9')](),controller[_0x04c9('0xb')]);router['post']('/',auth[_0x04c9('0x9')](),controller['create']);router['put'](_0x04c9('0xc'),auth['isAuthenticated'](),controller[_0x04c9('0xd')]);router[_0x04c9('0xe')](_0x04c9('0xc'),auth[_0x04c9('0x9')](),controller['destroy']);module[_0x04c9('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 87c958c..b211f02 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 _0x8236=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0x8236,0x107));var _0x6823=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x8236[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x6823('0x0'));module[_0x6823('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6823('0x2'),_0x6823('0x3'),_0x6823('0x4'),_0x6823('0x5'),_0x6823('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6823('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6823('0x2'),_0x6823('0x3'),_0x6823('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6823('0x7')]},'customField':{'type':Sequelize[_0x6823('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7bca=['STRING','BOOLEAN','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x7bca,0x134));var _0xa7bc=function(_0x1df9f4,_0x27c693){_0x1df9f4=_0x1df9f4-0x0;var _0x29f9c5=_0x7bca[_0x1df9f4];return _0x29f9c5;};'use strict';var Sequelize=require('sequelize');module[_0xa7bc('0x0')]={'type':{'type':Sequelize[_0xa7bc('0x1')]('string',_0xa7bc('0x2'),_0xa7bc('0x3'),_0xa7bc('0x4'),_0xa7bc('0x5')),'defaultValue':_0xa7bc('0x6')},'content':{'type':Sequelize[_0xa7bc('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa7bc('0x1')](_0xa7bc('0x6'),'variable',_0xa7bc('0x3'))},'keyContent':{'type':Sequelize[_0xa7bc('0x7')]},'idField':{'type':Sequelize[_0xa7bc('0x7')]},'nameField':{'type':Sequelize[_0xa7bc('0x7')]},'customField':{'type':Sequelize[_0xa7bc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa7bc('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 87ea2b4..cc26708 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 _0xb372=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','Dynamics365Field','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js'];(function(_0x5b4ec4,_0x1f9389){var _0x57ea65=function(_0x5f1a20){while(--_0x5f1a20){_0x5b4ec4['push'](_0x5b4ec4['shift']());}};_0x57ea65(++_0x1f9389);}(_0xb372,0x1dc));var _0x2b37=function(_0x4d947b,_0x2de916){_0x4d947b=_0x4d947b-0x0;var _0x263036=_0xb372[_0x4d947b];return _0x263036;};'use strict';var emlformat=require(_0x2b37('0x0'));var rimraf=require(_0x2b37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b37('0x2'));var rp=require(_0x2b37('0x3'));var moment=require(_0x2b37('0x4'));var BPromise=require(_0x2b37('0x5'));var Mustache=require(_0x2b37('0x6'));var util=require(_0x2b37('0x7'));var path=require('path');var sox=require(_0x2b37('0x8'));var csv=require(_0x2b37('0x9'));var ejs=require(_0x2b37('0xa'));var fs=require('fs');var fs_extra=require(_0x2b37('0xb'));var _=require(_0x2b37('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2b37('0xd'));var toCsv=require(_0x2b37('0x9'));var querystring=require(_0x2b37('0xe'));var Papa=require(_0x2b37('0xf'));var Redis=require('ioredis');var authService=require(_0x2b37('0x10'));var qs=require(_0x2b37('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b37('0x12'))(_0x2b37('0x13'));var utils=require(_0x2b37('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2b37('0x15'));var db=require(_0x2b37('0x16'))['db'];function respondWithStatusCode(_0x1441a7,_0x4d27f3){_0x4d27f3=_0x4d27f3||0xcc;return function(_0x5325e4){if(_0x5325e4){return _0x1441a7['sendStatus'](_0x4d27f3);}return _0x1441a7[_0x2b37('0x17')](_0x4d27f3)['end']();};}function respondWithResult(_0x8cc6ac,_0x2144ae){_0x2144ae=_0x2144ae||0xc8;return function(_0x4e377e){if(_0x4e377e){return _0x8cc6ac[_0x2b37('0x17')](_0x2144ae)[_0x2b37('0x18')](_0x4e377e);}};}function respondWithFilteredResult(_0x1f0b5a,_0x38b8cc){return function(_0x21fb6e){if(_0x21fb6e){var _0x547d9e=typeof _0x38b8cc[_0x2b37('0x19')]===_0x2b37('0x1a')&&typeof _0x38b8cc[_0x2b37('0x1b')]==='undefined';var _0x3d3cf5=_0x21fb6e[_0x2b37('0x1c')];var _0x21311f=_0x547d9e?0x0:_0x38b8cc[_0x2b37('0x19')];var _0x326268=_0x547d9e?_0x21fb6e['count']:_0x38b8cc[_0x2b37('0x19')]+_0x38b8cc[_0x2b37('0x1b')];var _0x20eab3;if(_0x326268>=_0x3d3cf5){_0x326268=_0x3d3cf5;_0x20eab3=0xc8;}else{_0x20eab3=0xce;}_0x1f0b5a[_0x2b37('0x17')](_0x20eab3);return _0x1f0b5a[_0x2b37('0x1d')](_0x2b37('0x1e'),_0x21311f+'-'+_0x326268+'/'+_0x3d3cf5)['json'](_0x21fb6e);}return null;};}function patchUpdates(_0x5c9086){return function(_0x3db40f){try{jsonpatch[_0x2b37('0x1f')](_0x3db40f,_0x5c9086,!![]);}catch(_0x14d224){return BPromise[_0x2b37('0x20')](_0x14d224);}return _0x3db40f[_0x2b37('0x21')]();};}function saveUpdates(_0x32e424,_0x437c12){return function(_0x3dac72){if(_0x3dac72){return _0x3dac72['update'](_0x32e424)[_0x2b37('0x22')](function(_0x365818){return _0x365818;});}return null;};}function removeEntity(_0x49398a,_0x2c63db){return function(_0x1f5e3c){if(_0x1f5e3c){return _0x1f5e3c['destroy']()[_0x2b37('0x22')](function(){_0x49398a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b1d5b,_0x34d2d3){return function(_0x510b10){if(!_0x510b10){_0x7b1d5b[_0x2b37('0x23')](0x194);}return _0x510b10;};}function handleError(_0x46233a,_0x477468){_0x477468=_0x477468||0x1f4;return function(_0x25af42){logger[_0x2b37('0x24')](_0x25af42['stack']);if(_0x25af42[_0x2b37('0x25')]){delete _0x25af42['name'];}_0x46233a[_0x2b37('0x17')](_0x477468)[_0x2b37('0x26')](_0x25af42);};}exports[_0x2b37('0x27')]=function(_0x302de4,_0x3d9412){var _0x4bd453={},_0x1aba11={},_0x1f48e0={'count':0x0,'rows':[]};var _0x186466=_[_0x2b37('0x28')](db[_0x2b37('0x29')]['rawAttributes'],function(_0x14ea59){return{'name':_0x14ea59[_0x2b37('0x2a')],'type':_0x14ea59[_0x2b37('0x2b')][_0x2b37('0x2c')]};});_0x1aba11[_0x2b37('0x2d')]=_['map'](_0x186466,_0x2b37('0x25'));_0x1aba11['query']=_[_0x2b37('0x2e')](_0x302de4[_0x2b37('0x2f')]);_0x1aba11[_0x2b37('0x30')]=_[_0x2b37('0x31')](_0x1aba11[_0x2b37('0x2d')],_0x1aba11['query']);_0x4bd453[_0x2b37('0x32')]=_['intersection'](_0x1aba11[_0x2b37('0x2d')],qs[_0x2b37('0x33')](_0x302de4['query'][_0x2b37('0x33')]));_0x4bd453[_0x2b37('0x32')]=_0x4bd453['attributes']['length']?_0x4bd453[_0x2b37('0x32')]:_0x1aba11[_0x2b37('0x2d')];if(!_0x302de4[_0x2b37('0x2f')]['hasOwnProperty'](_0x2b37('0x34'))){_0x4bd453[_0x2b37('0x1b')]=qs[_0x2b37('0x1b')](_0x302de4[_0x2b37('0x2f')][_0x2b37('0x1b')]);_0x4bd453[_0x2b37('0x19')]=qs[_0x2b37('0x19')](_0x302de4[_0x2b37('0x2f')]['offset']);}_0x4bd453[_0x2b37('0x35')]=qs[_0x2b37('0x36')](_0x302de4['query'][_0x2b37('0x36')]);_0x4bd453[_0x2b37('0x37')]=qs[_0x2b37('0x30')](_[_0x2b37('0x38')](_0x302de4[_0x2b37('0x2f')],_0x1aba11[_0x2b37('0x30')]),_0x186466);if(_0x302de4['query'][_0x2b37('0x39')]){_0x4bd453[_0x2b37('0x37')]=_[_0x2b37('0x3a')](_0x4bd453[_0x2b37('0x37')],{'$or':_[_0x2b37('0x28')](_0x186466,function(_0x2b0700){if(_0x2b0700[_0x2b37('0x2b')]!==_0x2b37('0x3b')){var _0x49779f={};_0x49779f[_0x2b0700['name']]={'$like':'%'+_0x302de4[_0x2b37('0x2f')]['filter']+'%'};return _0x49779f;}})});}_0x4bd453=_['merge']({},_0x4bd453,_0x302de4[_0x2b37('0x3c')]);var _0x3bbffa={'where':_0x4bd453[_0x2b37('0x37')]};return db[_0x2b37('0x29')][_0x2b37('0x1c')](_0x3bbffa)[_0x2b37('0x22')](function(_0x3e8e79){_0x1f48e0[_0x2b37('0x1c')]=_0x3e8e79;if(_0x302de4[_0x2b37('0x2f')][_0x2b37('0x3d')]){_0x4bd453[_0x2b37('0x3e')]=[{'all':!![]}];}return db[_0x2b37('0x29')]['findAll'](_0x4bd453);})['then'](function(_0x6957c2){_0x1f48e0['rows']=_0x6957c2;return _0x1f48e0;})[_0x2b37('0x22')](respondWithFilteredResult(_0x3d9412,_0x4bd453))[_0x2b37('0x3f')](handleError(_0x3d9412,null));};exports[_0x2b37('0x40')]=function(_0x122c85,_0x44f3c8){var _0xe41195={'raw':!![],'where':{'id':_0x122c85[_0x2b37('0x41')]['id']}},_0x3697ff={};_0x3697ff[_0x2b37('0x2d')]=_[_0x2b37('0x2e')](db[_0x2b37('0x29')]['rawAttributes']);_0x3697ff['query']=_[_0x2b37('0x2e')](_0x122c85['query']);_0x3697ff[_0x2b37('0x30')]=_[_0x2b37('0x31')](_0x3697ff[_0x2b37('0x2d')],_0x3697ff[_0x2b37('0x2f')]);_0xe41195[_0x2b37('0x32')]=_[_0x2b37('0x31')](_0x3697ff[_0x2b37('0x2d')],qs[_0x2b37('0x33')](_0x122c85[_0x2b37('0x2f')][_0x2b37('0x33')]));_0xe41195[_0x2b37('0x32')]=_0xe41195['attributes']['length']?_0xe41195[_0x2b37('0x32')]:_0x3697ff[_0x2b37('0x2d')];if(_0x122c85[_0x2b37('0x2f')]['includeAll']){_0xe41195[_0x2b37('0x3e')]=[{'all':!![]}];}_0xe41195=_[_0x2b37('0x3a')]({},_0xe41195,_0x122c85[_0x2b37('0x3c')]);return db[_0x2b37('0x29')][_0x2b37('0x42')](_0xe41195)[_0x2b37('0x22')](handleEntityNotFound(_0x44f3c8,null))[_0x2b37('0x22')](respondWithResult(_0x44f3c8,null))[_0x2b37('0x3f')](handleError(_0x44f3c8,null));};exports[_0x2b37('0x43')]=function(_0x37b05b,_0x1d2d4e){return db[_0x2b37('0x29')][_0x2b37('0x43')](_0x37b05b[_0x2b37('0x44')],{})[_0x2b37('0x22')](respondWithResult(_0x1d2d4e,0xc9))[_0x2b37('0x3f')](handleError(_0x1d2d4e,null));};exports['update']=function(_0x324e1e,_0x1c286b){if(_0x324e1e[_0x2b37('0x44')]['id']){delete _0x324e1e[_0x2b37('0x44')]['id'];}return db[_0x2b37('0x29')][_0x2b37('0x42')]({'where':{'id':_0x324e1e[_0x2b37('0x41')]['id']}})[_0x2b37('0x22')](handleEntityNotFound(_0x1c286b,null))[_0x2b37('0x22')](saveUpdates(_0x324e1e['body'],null))[_0x2b37('0x22')](respondWithResult(_0x1c286b,null))[_0x2b37('0x3f')](handleError(_0x1c286b,null));};exports[_0x2b37('0x45')]=function(_0x2bcfd1,_0x4e3e14){return db['Dynamics365Field'][_0x2b37('0x42')]({'where':{'id':_0x2bcfd1[_0x2b37('0x41')]['id']}})[_0x2b37('0x22')](handleEntityNotFound(_0x4e3e14,null))[_0x2b37('0x22')](removeEntity(_0x4e3e14,null))['catch'](handleError(_0x4e3e14,null));}; \ No newline at end of file +var _0xd23e=['update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','include','findAll','catch','show','options','create','body'];(function(_0x52ba2f,_0xa505a){var _0x1848d5=function(_0x5356a8){while(--_0x5356a8){_0x52ba2f['push'](_0x52ba2f['shift']());}};_0x1848d5(++_0xa505a);}(_0xd23e,0x1ab));var _0xed23=function(_0xa7d678,_0x3dfdff){_0xa7d678=_0xa7d678-0x0;var _0x5cc539=_0xd23e[_0xa7d678];return _0x5cc539;};'use strict';var emlformat=require(_0xed23('0x0'));var rimraf=require(_0xed23('0x1'));var zipdir=require(_0xed23('0x2'));var jsonpatch=require(_0xed23('0x3'));var rp=require(_0xed23('0x4'));var moment=require('moment');var BPromise=require(_0xed23('0x5'));var Mustache=require(_0xed23('0x6'));var util=require(_0xed23('0x7'));var path=require('path');var sox=require(_0xed23('0x8'));var csv=require(_0xed23('0x9'));var ejs=require(_0xed23('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed23('0xb'));var squel=require(_0xed23('0xc'));var crypto=require('crypto');var jsforce=require(_0xed23('0xd'));var deskjs=require(_0xed23('0xe'));var toCsv=require('to-csv');var querystring=require(_0xed23('0xf'));var Papa=require(_0xed23('0x10'));var Redis=require(_0xed23('0x11'));var authService=require(_0xed23('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xed23('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed23('0x14'));var utils=require(_0xed23('0x15'));var config=require(_0xed23('0x16'));var licenseUtil=require(_0xed23('0x17'));var db=require(_0xed23('0x18'))['db'];function respondWithStatusCode(_0x3e9a45,_0xc3f9f9){_0xc3f9f9=_0xc3f9f9||0xcc;return function(_0x516755){if(_0x516755){return _0x3e9a45[_0xed23('0x19')](_0xc3f9f9);}return _0x3e9a45[_0xed23('0x1a')](_0xc3f9f9)[_0xed23('0x1b')]();};}function respondWithResult(_0x104052,_0x257058){_0x257058=_0x257058||0xc8;return function(_0x5e8485){if(_0x5e8485){return _0x104052[_0xed23('0x1a')](_0x257058)[_0xed23('0x1c')](_0x5e8485);}};}function respondWithFilteredResult(_0x5cf681,_0x2dbc86){return function(_0x101682){if(_0x101682){var _0x1d691e=typeof _0x2dbc86[_0xed23('0x1d')]==='undefined'&&typeof _0x2dbc86[_0xed23('0x1e')]===_0xed23('0x1f');var _0x57ae3d=_0x101682[_0xed23('0x20')];var _0xb30438=_0x1d691e?0x0:_0x2dbc86[_0xed23('0x1d')];var _0x5b2745=_0x1d691e?_0x101682[_0xed23('0x20')]:_0x2dbc86[_0xed23('0x1d')]+_0x2dbc86[_0xed23('0x1e')];var _0x9aaee5;if(_0x5b2745>=_0x57ae3d){_0x5b2745=_0x57ae3d;_0x9aaee5=0xc8;}else{_0x9aaee5=0xce;}_0x5cf681[_0xed23('0x1a')](_0x9aaee5);return _0x5cf681[_0xed23('0x21')](_0xed23('0x22'),_0xb30438+'-'+_0x5b2745+'/'+_0x57ae3d)[_0xed23('0x1c')](_0x101682);}return null;};}function patchUpdates(_0x133d2f){return function(_0x5d6d16){try{jsonpatch['apply'](_0x5d6d16,_0x133d2f,!![]);}catch(_0x29dc4c){return BPromise['reject'](_0x29dc4c);}return _0x5d6d16[_0xed23('0x23')]();};}function saveUpdates(_0x5855f2,_0x2e95d3){return function(_0x208321){if(_0x208321){return _0x208321['update'](_0x5855f2)[_0xed23('0x24')](function(_0x432f4e){return _0x432f4e;});}return null;};}function removeEntity(_0x4b0701,_0x4480a5){return function(_0x2df4da){if(_0x2df4da){return _0x2df4da[_0xed23('0x25')]()[_0xed23('0x24')](function(){_0x4b0701[_0xed23('0x1a')](0xcc)[_0xed23('0x1b')]();});}};}function handleEntityNotFound(_0x371eff,_0xa5a3b9){return function(_0x2c09b9){if(!_0x2c09b9){_0x371eff[_0xed23('0x19')](0x194);}return _0x2c09b9;};}function handleError(_0x2fff6a,_0x22bd72){_0x22bd72=_0x22bd72||0x1f4;return function(_0xf8dfdb){logger['error'](_0xf8dfdb[_0xed23('0x26')]);if(_0xf8dfdb['name']){delete _0xf8dfdb[_0xed23('0x27')];}_0x2fff6a['status'](_0x22bd72)['send'](_0xf8dfdb);};}exports[_0xed23('0x28')]=function(_0x3d7ed8,_0x3f911f){var _0x254439={},_0x2ae0dd={},_0x4c5156={'count':0x0,'rows':[]};var _0x330038=_[_0xed23('0x29')](db[_0xed23('0x2a')][_0xed23('0x2b')],function(_0x49a9ec){return{'name':_0x49a9ec[_0xed23('0x2c')],'type':_0x49a9ec[_0xed23('0x2d')][_0xed23('0x2e')]};});_0x2ae0dd[_0xed23('0x2f')]=_[_0xed23('0x29')](_0x330038,'name');_0x2ae0dd[_0xed23('0x30')]=_[_0xed23('0x31')](_0x3d7ed8[_0xed23('0x30')]);_0x2ae0dd[_0xed23('0x32')]=_[_0xed23('0x33')](_0x2ae0dd[_0xed23('0x2f')],_0x2ae0dd[_0xed23('0x30')]);_0x254439[_0xed23('0x34')]=_[_0xed23('0x33')](_0x2ae0dd['model'],qs['fields'](_0x3d7ed8[_0xed23('0x30')][_0xed23('0x35')]));_0x254439[_0xed23('0x34')]=_0x254439['attributes'][_0xed23('0x36')]?_0x254439[_0xed23('0x34')]:_0x2ae0dd['model'];if(!_0x3d7ed8[_0xed23('0x30')][_0xed23('0x37')](_0xed23('0x38'))){_0x254439[_0xed23('0x1e')]=qs[_0xed23('0x1e')](_0x3d7ed8[_0xed23('0x30')][_0xed23('0x1e')]);_0x254439['offset']=qs[_0xed23('0x1d')](_0x3d7ed8['query'][_0xed23('0x1d')]);}_0x254439[_0xed23('0x39')]=qs['sort'](_0x3d7ed8[_0xed23('0x30')][_0xed23('0x3a')]);_0x254439[_0xed23('0x3b')]=qs[_0xed23('0x32')](_['pick'](_0x3d7ed8['query'],_0x2ae0dd[_0xed23('0x32')]),_0x330038);if(_0x3d7ed8[_0xed23('0x30')]['filter']){_0x254439['where']=_[_0xed23('0x3c')](_0x254439['where'],{'$or':_[_0xed23('0x29')](_0x330038,function(_0x5b961f){if(_0x5b961f[_0xed23('0x2d')]!=='VIRTUAL'){var _0x1f62c5={};_0x1f62c5[_0x5b961f[_0xed23('0x27')]]={'$like':'%'+_0x3d7ed8[_0xed23('0x30')][_0xed23('0x3d')]+'%'};return _0x1f62c5;}})});}_0x254439=_[_0xed23('0x3c')]({},_0x254439,_0x3d7ed8['options']);var _0x3e06ce={'where':_0x254439[_0xed23('0x3b')]};return db['Dynamics365Field'][_0xed23('0x20')](_0x3e06ce)[_0xed23('0x24')](function(_0x44413d){_0x4c5156[_0xed23('0x20')]=_0x44413d;if(_0x3d7ed8[_0xed23('0x30')][_0xed23('0x3e')]){_0x254439[_0xed23('0x3f')]=[{'all':!![]}];}return db[_0xed23('0x2a')][_0xed23('0x40')](_0x254439);})[_0xed23('0x24')](function(_0x3e5e77){_0x4c5156['rows']=_0x3e5e77;return _0x4c5156;})[_0xed23('0x24')](respondWithFilteredResult(_0x3f911f,_0x254439))[_0xed23('0x41')](handleError(_0x3f911f,null));};exports[_0xed23('0x42')]=function(_0x553fd3,_0x4c5fd6){var _0x4252e2={'raw':!![],'where':{'id':_0x553fd3['params']['id']}},_0xc00b9c={};_0xc00b9c[_0xed23('0x2f')]=_[_0xed23('0x31')](db[_0xed23('0x2a')]['rawAttributes']);_0xc00b9c[_0xed23('0x30')]=_[_0xed23('0x31')](_0x553fd3[_0xed23('0x30')]);_0xc00b9c[_0xed23('0x32')]=_[_0xed23('0x33')](_0xc00b9c[_0xed23('0x2f')],_0xc00b9c[_0xed23('0x30')]);_0x4252e2[_0xed23('0x34')]=_[_0xed23('0x33')](_0xc00b9c['model'],qs[_0xed23('0x35')](_0x553fd3['query']['fields']));_0x4252e2[_0xed23('0x34')]=_0x4252e2['attributes'][_0xed23('0x36')]?_0x4252e2['attributes']:_0xc00b9c['model'];if(_0x553fd3[_0xed23('0x30')][_0xed23('0x3e')]){_0x4252e2[_0xed23('0x3f')]=[{'all':!![]}];}_0x4252e2=_[_0xed23('0x3c')]({},_0x4252e2,_0x553fd3[_0xed23('0x43')]);return db['Dynamics365Field']['find'](_0x4252e2)['then'](handleEntityNotFound(_0x4c5fd6,null))['then'](respondWithResult(_0x4c5fd6,null))[_0xed23('0x41')](handleError(_0x4c5fd6,null));};exports['create']=function(_0x241549,_0xc33706){return db['Dynamics365Field'][_0xed23('0x44')](_0x241549[_0xed23('0x45')],{})[_0xed23('0x24')](respondWithResult(_0xc33706,0xc9))[_0xed23('0x41')](handleError(_0xc33706,null));};exports[_0xed23('0x46')]=function(_0x25c5ac,_0x19e1e0){if(_0x25c5ac['body']['id']){delete _0x25c5ac['body']['id'];}return db[_0xed23('0x2a')]['find']({'where':{'id':_0x25c5ac['params']['id']}})[_0xed23('0x24')](handleEntityNotFound(_0x19e1e0,null))[_0xed23('0x24')](saveUpdates(_0x25c5ac[_0xed23('0x45')],null))[_0xed23('0x24')](respondWithResult(_0x19e1e0,null))[_0xed23('0x41')](handleError(_0x19e1e0,null));};exports[_0xed23('0x25')]=function(_0xd03166,_0x595639){return db['Dynamics365Field']['find']({'where':{'id':_0xd03166['params']['id']}})[_0xed23('0x24')](handleEntityNotFound(_0x595639,null))[_0xed23('0x24')](removeEntity(_0x595639,null))[_0xed23('0x41')](handleError(_0x595639,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d5366ce..fa6a46f 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 _0x9630=['Dynamics365Field','idField','FieldId','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x12f9e3,_0x3fadc1){var _0x2de0c8=function(_0x31b5c5){while(--_0x31b5c5){_0x12f9e3['push'](_0x12f9e3['shift']());}};_0x2de0c8(++_0x3fadc1);}(_0x9630,0x123));var _0x0963=function(_0x2a6dd5,_0x4ce741){_0x2a6dd5=_0x2a6dd5-0x0;var _0x475ae9=_0x9630[_0x2a6dd5];return _0x475ae9;};'use strict';var _=require('lodash');var util=require(_0x0963('0x0'));var logger=require(_0x0963('0x1'))(_0x0963('0x2'));var moment=require(_0x0963('0x3'));var BPromise=require(_0x0963('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0963('0x5'));var config=require(_0x0963('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x0963('0x7')]=function(_0x1e16d3,_0x4c4486){return _0x1e16d3[_0x0963('0x8')](_0x0963('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x0963('0xa'),_0x0963('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf480=['Dynamics365Field','int_dynamics365_fields','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b259e,_0x5a0695){var _0x35b00f=function(_0x5fa310){while(--_0x5fa310){_0x2b259e['push'](_0x2b259e['shift']());}};_0x35b00f(++_0x5a0695);}(_0xf480,0x70));var _0x0f48=function(_0xf1b348,_0x301bce){_0xf1b348=_0xf1b348-0x0;var _0x4a1d8b=_0xf480[_0xf1b348];return _0x4a1d8b;};'use strict';var _=require('lodash');var util=require(_0x0f48('0x0'));var logger=require(_0x0f48('0x1'))('api');var moment=require(_0x0f48('0x2'));var BPromise=require(_0x0f48('0x3'));var rp=require(_0x0f48('0x4'));var fs=require('fs');var path=require(_0x0f48('0x5'));var rimraf=require(_0x0f48('0x6'));var config=require(_0x0f48('0x7'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x156844,_0x374a7c){return _0x156844['define'](_0x0f48('0x8'),attributes,{'tableName':_0x0f48('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x0f48('0xa'),_0x0f48('0xb')],'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 c312759..4668a8a 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 _0xd26d=['request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x222c33,_0x53d29a){var _0x75b81b=function(_0x5206b3){while(--_0x5206b3){_0x222c33['push'](_0x222c33['shift']());}};_0x75b81b(++_0x53d29a);}(_0xd26d,0xd3));var _0xdd26=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0xd26d[_0x545b71];return _0x26e587;};'use strict';var _=require('lodash');var util=require(_0xdd26('0x0'));var moment=require('moment');var BPromise=require(_0xdd26('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd26('0x2'))['db'];var utils=require(_0xdd26('0x3'));var logger=require(_0xdd26('0x4'))(_0xdd26('0x5'));var config=require(_0xdd26('0x6'));var jayson=require(_0xdd26('0x7'));var client=jayson['client'][_0xdd26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x580199,_0x39a076,_0x3382c7){return new BPromise(function(_0x4b4cdf,_0x35627c){return client[_0xdd26('0x9')](_0x580199,_0x3382c7)['then'](function(_0x6c7f1){logger[_0xdd26('0xa')](_0xdd26('0xb'),_0x39a076,_0xdd26('0xc'));logger[_0xdd26('0xd')](_0xdd26('0xe'),_0x39a076,_0xdd26('0xc'),JSON['stringify'](_0x6c7f1));if(_0x6c7f1['error']){if(_0x6c7f1[_0xdd26('0xf')][_0xdd26('0x10')]===0x1f4){logger[_0xdd26('0xf')](_0xdd26('0xb'),_0x39a076,_0x6c7f1['error'][_0xdd26('0x11')]);return _0x35627c(_0x6c7f1[_0xdd26('0xf')][_0xdd26('0x11')]);}logger['error'](_0xdd26('0xb'),_0x39a076,_0x6c7f1['error']['message']);return _0x4b4cdf(_0x6c7f1[_0xdd26('0xf')][_0xdd26('0x11')]);}else{logger[_0xdd26('0xa')](_0xdd26('0xb'),_0x39a076,_0xdd26('0xc'));_0x4b4cdf(_0x6c7f1[_0xdd26('0x12')][_0xdd26('0x11')]);}})[_0xdd26('0x13')](function(_0x3645f5){logger['error'](_0xdd26('0xb'),_0x39a076,_0x3645f5);_0x35627c(_0x3645f5);});});} \ No newline at end of file +var _0x9f49=['Dynamics365Field,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3c1e0a,_0x67361d){var _0x12e1c7=function(_0x465bee){while(--_0x465bee){_0x3c1e0a['push'](_0x3c1e0a['shift']());}};_0x12e1c7(++_0x67361d);}(_0x9f49,0x164));var _0x99f4=function(_0x588525,_0x13d18e){_0x588525=_0x588525-0x0;var _0x54cf75=_0x9f49[_0x588525];return _0x54cf75;};'use strict';var _=require('lodash');var util=require(_0x99f4('0x0'));var moment=require(_0x99f4('0x1'));var BPromise=require(_0x99f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99f4('0x3'));var db=require(_0x99f4('0x4'))['db'];var utils=require(_0x99f4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x99f4('0x6'));var jayson=require(_0x99f4('0x7'));var client=jayson[_0x99f4('0x8')][_0x99f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32aa4c,_0x422f64,_0x5c6606){return new BPromise(function(_0x155162,_0x136ba9){return client[_0x99f4('0xa')](_0x32aa4c,_0x5c6606)['then'](function(_0x2d80a9){logger[_0x99f4('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x422f64,'request\x20sent');logger[_0x99f4('0xc')](_0x99f4('0xd'),_0x422f64,_0x99f4('0xe'),JSON[_0x99f4('0xf')](_0x2d80a9));if(_0x2d80a9[_0x99f4('0x10')]){if(_0x2d80a9[_0x99f4('0x10')][_0x99f4('0x11')]===0x1f4){logger[_0x99f4('0x10')](_0x99f4('0x12'),_0x422f64,_0x2d80a9[_0x99f4('0x10')][_0x99f4('0x13')]);return _0x136ba9(_0x2d80a9[_0x99f4('0x10')][_0x99f4('0x13')]);}logger[_0x99f4('0x10')](_0x99f4('0x12'),_0x422f64,_0x2d80a9['error'][_0x99f4('0x13')]);return _0x155162(_0x2d80a9[_0x99f4('0x10')][_0x99f4('0x13')]);}else{logger[_0x99f4('0xb')](_0x99f4('0x12'),_0x422f64,_0x99f4('0xe'));_0x155162(_0x2d80a9[_0x99f4('0x14')][_0x99f4('0x13')]);}})[_0x99f4('0x15')](function(_0xb18fc){logger[_0x99f4('0x10')](_0x99f4('0x12'),_0x422f64,_0xb18fc);_0x136ba9(_0xb18fc);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5946d88..219ac0c 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 _0x1fc9=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','exports'];(function(_0x38bff4,_0x48920a){var _0x30f60c=function(_0x4bc5a2){while(--_0x4bc5a2){_0x38bff4['push'](_0x38bff4['shift']());}};_0x30f60c(++_0x48920a);}(_0x1fc9,0xc6));var _0x91fc=function(_0x2886aa,_0xbd9212){_0x2886aa=_0x2886aa-0x0;var _0x14c403=_0x1fc9[_0x2886aa];return _0x14c403;};'use strict';var multer=require(_0x91fc('0x0'));var util=require(_0x91fc('0x1'));var path=require(_0x91fc('0x2'));var timeout=require(_0x91fc('0x3'));var express=require('express');var router=express[_0x91fc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91fc('0x5'));var interaction=require(_0x91fc('0x6'));var config=require(_0x91fc('0x7'));var controller=require(_0x91fc('0x8'));router[_0x91fc('0x9')]('/',auth[_0x91fc('0xa')](),controller['index']);router[_0x91fc('0x9')](_0x91fc('0xb'),auth[_0x91fc('0xa')](),controller[_0x91fc('0xc')]);router[_0x91fc('0x9')]('/:id/configurations',auth[_0x91fc('0xa')](),controller['getConfigurations']);router[_0x91fc('0x9')]('/:id/fields',auth[_0x91fc('0xa')](),controller[_0x91fc('0xd')]);router[_0x91fc('0xe')]('/',auth[_0x91fc('0xa')](),controller[_0x91fc('0xf')]);router['post'](_0x91fc('0x10'),auth['isAuthenticated'](),controller[_0x91fc('0x11')]);router[_0x91fc('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x91fc('0x13')]);router[_0x91fc('0x14')](_0x91fc('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x91fc('0x15')]=router; \ No newline at end of file +var _0xa173=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','destroy'];(function(_0x1d0c7e,_0x40b36c){var _0x30cf02=function(_0x2c8b55){while(--_0x2c8b55){_0x1d0c7e['push'](_0x1d0c7e['shift']());}};_0x30cf02(++_0x40b36c);}(_0xa173,0x1c3));var _0x3a17=function(_0x34b5be,_0x25ac0c){_0x34b5be=_0x34b5be-0x0;var _0x219a40=_0xa173[_0x34b5be];return _0x219a40;};'use strict';var multer=require(_0x3a17('0x0'));var util=require(_0x3a17('0x1'));var path=require(_0x3a17('0x2'));var timeout=require(_0x3a17('0x3'));var express=require(_0x3a17('0x4'));var router=express['Router']();var fs_extra=require(_0x3a17('0x5'));var auth=require(_0x3a17('0x6'));var interaction=require(_0x3a17('0x7'));var config=require(_0x3a17('0x8'));var controller=require(_0x3a17('0x9'));router['get']('/',auth[_0x3a17('0xa')](),controller[_0x3a17('0xb')]);router[_0x3a17('0xc')](_0x3a17('0xd'),auth['isAuthenticated'](),controller[_0x3a17('0xe')]);router[_0x3a17('0xc')](_0x3a17('0xf'),auth[_0x3a17('0xa')](),controller[_0x3a17('0x10')]);router[_0x3a17('0xc')](_0x3a17('0x11'),auth[_0x3a17('0xa')](),controller['getFields']);router[_0x3a17('0x12')]('/',auth[_0x3a17('0xa')](),controller[_0x3a17('0x13')]);router[_0x3a17('0x12')](_0x3a17('0xf'),auth['isAuthenticated'](),controller[_0x3a17('0x14')]);router[_0x3a17('0x15')](_0x3a17('0xd'),auth[_0x3a17('0xa')](),controller[_0x3a17('0x16')]);router['delete']('/:id',auth[_0x3a17('0xa')](),controller[_0x3a17('0x17')]);module[_0x3a17('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 1b42133..8c62cfc 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 _0x5f66=['STRING','username','exports'];(function(_0x4c893b,_0x59e8f7){var _0x306d48=function(_0x426e86){while(--_0x426e86){_0x4c893b['push'](_0x4c893b['shift']());}};_0x306d48(++_0x59e8f7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x65f6('0x1')]},'username':{'type':Sequelize[_0x65f6('0x1')],'unique':_0x65f6('0x2')},'apiKey':{'type':Sequelize[_0x65f6('0x1')]},'remoteUri':{'type':Sequelize[_0x65f6('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x65f6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x236c=['remoteUri','sequelize','STRING','username'];(function(_0x1e79f2,_0x4f77a9){var _0xe7b6e9=function(_0x3c688f){while(--_0x3c688f){_0x1e79f2['push'](_0x1e79f2['shift']());}};_0xe7b6e9(++_0x4f77a9);}(_0x236c,0x155));var _0xc236=function(_0x169a7d,_0x2306c5){_0x169a7d=_0x169a7d-0x0;var _0x2a69a6=_0x236c[_0x169a7d];return _0x2a69a6;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')]},'description':{'type':Sequelize[_0xc236('0x1')]},'username':{'type':Sequelize[_0xc236('0x1')],'unique':_0xc236('0x2')},'apiKey':{'type':Sequelize[_0xc236('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc236('0x3')},'serverUrl':{'type':Sequelize[_0xc236('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index a4e0db0..c5775a4 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 _0x82b0=['priority','source','group','company','remove','default','custom_dropdown','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','destroy','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','update','body','FreshdeskConfiguration','getConfigurations','addConfiguration','findOne','getSubjects','channel','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','subject','agent','description'];(function(_0x1e772b,_0x4b70ae){var _0x22f4ca=function(_0x12f510){while(--_0x12f510){_0x1e772b['push'](_0x1e772b['shift']());}};_0x22f4ca(++_0x4b70ae);}(_0x82b0,0x81));var _0x082b=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0x82b0[_0xd13a88];return _0x1c993c;};'use strict';var emlformat=require(_0x082b('0x0'));var rimraf=require(_0x082b('0x1'));var zipdir=require(_0x082b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x082b('0x3'));var moment=require(_0x082b('0x4'));var BPromise=require(_0x082b('0x5'));var Mustache=require(_0x082b('0x6'));var util=require('util');var path=require(_0x082b('0x7'));var sox=require(_0x082b('0x8'));var csv=require(_0x082b('0x9'));var ejs=require(_0x082b('0xa'));var fs=require('fs');var fs_extra=require(_0x082b('0xb'));var _=require('lodash');var squel=require(_0x082b('0xc'));var crypto=require(_0x082b('0xd'));var jsforce=require(_0x082b('0xe'));var deskjs=require(_0x082b('0xf'));var toCsv=require(_0x082b('0x9'));var querystring=require(_0x082b('0x10'));var Papa=require(_0x082b('0x11'));var Redis=require(_0x082b('0x12'));var authService=require(_0x082b('0x13'));var qs=require(_0x082b('0x14'));var as=require(_0x082b('0x15'));var hardwareService=require(_0x082b('0x16'));var logger=require(_0x082b('0x17'))(_0x082b('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x082b('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1c1f9d,_0x324251){_0x324251=_0x324251||0xcc;return function(_0x535946){if(_0x535946){return _0x1c1f9d[_0x082b('0x1a')](_0x324251);}return _0x1c1f9d[_0x082b('0x1b')](_0x324251)[_0x082b('0x1c')]();};}function respondWithResult(_0x1f0c32,_0x40e206){_0x40e206=_0x40e206||0xc8;return function(_0x4d7ad9){if(_0x4d7ad9){return _0x1f0c32[_0x082b('0x1b')](_0x40e206)[_0x082b('0x1d')](_0x4d7ad9);}};}function respondWithFilteredResult(_0x49db08,_0x2c4f86){return function(_0x588d8a){if(_0x588d8a){var _0xb373c9=typeof _0x2c4f86[_0x082b('0x1e')]==='undefined'&&typeof _0x2c4f86[_0x082b('0x1f')]===_0x082b('0x20');var _0x2442d1=_0x588d8a[_0x082b('0x21')];var _0x4adfc6=_0xb373c9?0x0:_0x2c4f86[_0x082b('0x1e')];var _0x2d5cbc=_0xb373c9?_0x588d8a[_0x082b('0x21')]:_0x2c4f86[_0x082b('0x1e')]+_0x2c4f86[_0x082b('0x1f')];var _0x1f403a;if(_0x2d5cbc>=_0x2442d1){_0x2d5cbc=_0x2442d1;_0x1f403a=0xc8;}else{_0x1f403a=0xce;}_0x49db08[_0x082b('0x1b')](_0x1f403a);return _0x49db08[_0x082b('0x22')]('Content-Range',_0x4adfc6+'-'+_0x2d5cbc+'/'+_0x2442d1)[_0x082b('0x1d')](_0x588d8a);}return null;};}function patchUpdates(_0x2fffc3){return function(_0x36683e){try{jsonpatch['apply'](_0x36683e,_0x2fffc3,!![]);}catch(_0x3c0b03){return BPromise[_0x082b('0x23')](_0x3c0b03);}return _0x36683e[_0x082b('0x24')]();};}function saveUpdates(_0x56fbd2,_0x47c0d9){return function(_0x47454f){if(_0x47454f){return _0x47454f['update'](_0x56fbd2)['then'](function(_0x3ae657){return _0x3ae657;});}return null;};}function removeEntity(_0xaa7eb,_0x271340){return function(_0x376d0a){if(_0x376d0a){return _0x376d0a[_0x082b('0x25')]()['then'](function(){_0xaa7eb[_0x082b('0x1b')](0xcc)[_0x082b('0x1c')]();});}};}function handleEntityNotFound(_0x40d737,_0x1082bf){return function(_0x20d85b){if(!_0x20d85b){_0x40d737[_0x082b('0x1a')](0x194);}return _0x20d85b;};}function handleError(_0x1b6dfc,_0x4e30e8){_0x4e30e8=_0x4e30e8||0x1f4;return function(_0x20ff4a){logger['error'](_0x20ff4a[_0x082b('0x26')]);if(_0x20ff4a['name']){delete _0x20ff4a[_0x082b('0x27')];}_0x1b6dfc[_0x082b('0x1b')](_0x4e30e8)['send'](_0x20ff4a);};}exports[_0x082b('0x28')]=function(_0x4b172b,_0x228a5a){var _0x55d059={},_0x528e52={},_0x25dcaf={'count':0x0,'rows':[]};var _0x1f8ce4=_[_0x082b('0x29')](db[_0x082b('0x2a')][_0x082b('0x2b')],function(_0x3194d5){return{'name':_0x3194d5[_0x082b('0x2c')],'type':_0x3194d5[_0x082b('0x2d')][_0x082b('0x2e')]};});_0x528e52[_0x082b('0x2f')]=_[_0x082b('0x29')](_0x1f8ce4,'name');_0x528e52[_0x082b('0x30')]=_[_0x082b('0x31')](_0x4b172b[_0x082b('0x30')]);_0x528e52[_0x082b('0x32')]=_[_0x082b('0x33')](_0x528e52['model'],_0x528e52['query']);_0x55d059[_0x082b('0x34')]=_[_0x082b('0x33')](_0x528e52['model'],qs[_0x082b('0x35')](_0x4b172b[_0x082b('0x30')]['fields']));_0x55d059[_0x082b('0x34')]=_0x55d059['attributes'][_0x082b('0x36')]?_0x55d059[_0x082b('0x34')]:_0x528e52['model'];if(!_0x4b172b[_0x082b('0x30')][_0x082b('0x37')](_0x082b('0x38'))){_0x55d059[_0x082b('0x1f')]=qs[_0x082b('0x1f')](_0x4b172b['query'][_0x082b('0x1f')]);_0x55d059['offset']=qs[_0x082b('0x1e')](_0x4b172b[_0x082b('0x30')][_0x082b('0x1e')]);}_0x55d059[_0x082b('0x39')]=qs[_0x082b('0x3a')](_0x4b172b[_0x082b('0x30')][_0x082b('0x3a')]);_0x55d059[_0x082b('0x3b')]=qs['filters'](_[_0x082b('0x3c')](_0x4b172b[_0x082b('0x30')],_0x528e52['filters']),_0x1f8ce4);if(_0x4b172b[_0x082b('0x30')][_0x082b('0x3d')]){_0x55d059[_0x082b('0x3b')]=_[_0x082b('0x3e')](_0x55d059[_0x082b('0x3b')],{'$or':_[_0x082b('0x29')](_0x1f8ce4,function(_0xe01d7a){if(_0xe01d7a[_0x082b('0x2d')]!=='VIRTUAL'){var _0x31832d={};_0x31832d[_0xe01d7a[_0x082b('0x27')]]={'$like':'%'+_0x4b172b[_0x082b('0x30')][_0x082b('0x3d')]+'%'};return _0x31832d;}})});}_0x55d059=_['merge']({},_0x55d059,_0x4b172b[_0x082b('0x3f')]);var _0xa22d4e={'where':_0x55d059[_0x082b('0x3b')]};return db[_0x082b('0x2a')][_0x082b('0x21')](_0xa22d4e)['then'](function(_0x436e50){_0x25dcaf[_0x082b('0x21')]=_0x436e50;if(_0x4b172b['query'][_0x082b('0x40')]){_0x55d059[_0x082b('0x41')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x082b('0x42')](_0x55d059);})[_0x082b('0x43')](function(_0x22cea5){_0x25dcaf[_0x082b('0x44')]=_0x22cea5;return _0x25dcaf;})[_0x082b('0x43')](respondWithFilteredResult(_0x228a5a,_0x55d059))[_0x082b('0x45')](handleError(_0x228a5a,null));};exports[_0x082b('0x46')]=function(_0x2b9257,_0x26c958){var _0x5ed239={'raw':![],'where':{'id':_0x2b9257[_0x082b('0x47')]['id']}},_0xe8c120={};_0xe8c120[_0x082b('0x2f')]=_[_0x082b('0x31')](db['FreshdeskAccount'][_0x082b('0x2b')]);_0xe8c120[_0x082b('0x30')]=_[_0x082b('0x31')](_0x2b9257['query']);_0xe8c120[_0x082b('0x32')]=_[_0x082b('0x33')](_0xe8c120[_0x082b('0x2f')],_0xe8c120[_0x082b('0x30')]);_0x5ed239[_0x082b('0x34')]=_[_0x082b('0x33')](_0xe8c120['model'],qs[_0x082b('0x35')](_0x2b9257[_0x082b('0x30')][_0x082b('0x35')]));_0x5ed239[_0x082b('0x34')]=_0x5ed239[_0x082b('0x34')][_0x082b('0x36')]?_0x5ed239[_0x082b('0x34')]:_0xe8c120[_0x082b('0x2f')];if(_0x2b9257['query'][_0x082b('0x40')]){_0x5ed239[_0x082b('0x41')]=[{'all':!![]}];}_0x5ed239=_[_0x082b('0x3e')]({},_0x5ed239,_0x2b9257['options']);return db[_0x082b('0x2a')][_0x082b('0x48')](_0x5ed239)['then'](handleEntityNotFound(_0x26c958,null))[_0x082b('0x43')](respondWithResult(_0x26c958,null))['catch'](handleError(_0x26c958,null));};exports[_0x082b('0x49')]=function(_0x5d238e,_0x1f1b8f){return db['FreshdeskAccount'][_0x082b('0x49')](_0x5d238e['body'],{})[_0x082b('0x43')](respondWithResult(_0x1f1b8f,0xc9))['catch'](handleError(_0x1f1b8f,null));};exports[_0x082b('0x4a')]=function(_0x518f6b,_0x46d5b1){if(_0x518f6b[_0x082b('0x4b')]['id']){delete _0x518f6b[_0x082b('0x4b')]['id'];}return db[_0x082b('0x2a')][_0x082b('0x48')]({'where':{'id':_0x518f6b[_0x082b('0x47')]['id']}})[_0x082b('0x43')](handleEntityNotFound(_0x46d5b1,null))['then'](saveUpdates(_0x518f6b[_0x082b('0x4b')],null))[_0x082b('0x43')](respondWithResult(_0x46d5b1,null))[_0x082b('0x45')](handleError(_0x46d5b1,null));};exports['destroy']=function(_0x221b13,_0x41d21c){return db[_0x082b('0x2a')][_0x082b('0x48')]({'where':{'id':_0x221b13[_0x082b('0x47')]['id']}})[_0x082b('0x43')](handleEntityNotFound(_0x41d21c,null))[_0x082b('0x43')](removeEntity(_0x41d21c,null))['catch'](handleError(_0x41d21c,null));};exports['getConfigurations']=function(_0xbcbd1d,_0x4a484b,_0x28751c){var _0x39bcd1={};var _0x1e76a3={};var _0x53ebc1;var _0x4a48f8;return db['FreshdeskAccount']['findOne']({'where':{'id':_0xbcbd1d[_0x082b('0x47')]['id']}})[_0x082b('0x43')](handleEntityNotFound(_0x4a484b,null))['then'](function(_0x397f3d){if(_0x397f3d){_0x53ebc1=_0x397f3d;_0x1e76a3[_0x082b('0x2f')]=_[_0x082b('0x31')](db[_0x082b('0x4c')]['rawAttributes']);_0x1e76a3[_0x082b('0x30')]=_[_0x082b('0x31')](_0xbcbd1d[_0x082b('0x30')]);_0x1e76a3[_0x082b('0x32')]=_[_0x082b('0x33')](_0x1e76a3['model'],_0x1e76a3[_0x082b('0x30')]);_0x39bcd1[_0x082b('0x34')]=_['intersection'](_0x1e76a3[_0x082b('0x2f')],qs[_0x082b('0x35')](_0xbcbd1d['query'][_0x082b('0x35')]));_0x39bcd1['attributes']=_0x39bcd1[_0x082b('0x34')][_0x082b('0x36')]?_0x39bcd1['attributes']:_0x1e76a3[_0x082b('0x2f')];_0x39bcd1['order']=qs[_0x082b('0x3a')](_0xbcbd1d[_0x082b('0x30')]['sort']);_0x39bcd1['where']=qs['filters'](_[_0x082b('0x3c')](_0xbcbd1d[_0x082b('0x30')],_0x1e76a3[_0x082b('0x32')]));if(_0xbcbd1d[_0x082b('0x30')][_0x082b('0x3d')]){_0x39bcd1[_0x082b('0x3b')]=_[_0x082b('0x3e')](_0x39bcd1[_0x082b('0x3b')],{'$or':_['map'](_0x39bcd1[_0x082b('0x34')],function(_0x195328){var _0x5b3122={};_0x5b3122[_0x195328]={'$like':'%'+_0xbcbd1d[_0x082b('0x30')][_0x082b('0x3d')]+'%'};return _0x5b3122;})});}_0x39bcd1=_[_0x082b('0x3e')]({},_0x39bcd1,_0xbcbd1d[_0x082b('0x3f')]);return _0x53ebc1[_0x082b('0x4d')](_0x39bcd1);}})[_0x082b('0x43')](function(_0x76db84){if(_0x76db84){_0x4a48f8=_0x76db84['length'];if(!_0xbcbd1d[_0x082b('0x30')][_0x082b('0x37')]('nolimit')){_0x39bcd1[_0x082b('0x1f')]=qs[_0x082b('0x1f')](_0xbcbd1d['query']['limit']);_0x39bcd1[_0x082b('0x1e')]=qs[_0x082b('0x1e')](_0xbcbd1d[_0x082b('0x30')][_0x082b('0x1e')]);}return _0x53ebc1['getConfigurations'](_0x39bcd1);}})[_0x082b('0x43')](function(_0x24ac98){if(_0x24ac98){return _0x24ac98?{'count':_0x4a48f8,'rows':_0x24ac98}:null;}})['then'](respondWithResult(_0x4a484b,null))[_0x082b('0x45')](handleError(_0x4a484b,null));};exports[_0x082b('0x4e')]=function(_0x6c21f8,_0x36b87d,_0x49928b){if(_0x6c21f8[_0x082b('0x4b')]['id']){delete _0x6c21f8[_0x082b('0x4b')]['id'];}return db[_0x082b('0x2a')][_0x082b('0x4f')]({'where':{'id':_0x6c21f8[_0x082b('0x47')]['id']}})[_0x082b('0x43')](handleEntityNotFound(_0x36b87d,null))[_0x082b('0x43')](function(_0x80ae28){if(_0x80ae28){_0x6c21f8[_0x082b('0x4b')]['AccountId']=_0x80ae28['id'];_0x6c21f8[_0x082b('0x4b')]['Subjects']=integrations[_0x082b('0x50')](_0x6c21f8[_0x082b('0x4b')]['channel'],_0x6c21f8[_0x082b('0x4b')]['type']);_0x6c21f8['body']['Descriptions']=integrations['getDescriptions'](_0x6c21f8[_0x082b('0x4b')][_0x082b('0x51')],_0x6c21f8[_0x082b('0x4b')][_0x082b('0x2d')]);return db[_0x082b('0x4c')][_0x082b('0x49')](_0x6c21f8['body'],{'include':[{'model':db[_0x082b('0x52')],'as':_0x082b('0x53')},{'model':db['FreshdeskField'],'as':_0x082b('0x54')}]});}return null;})[_0x082b('0x43')](respondWithResult(_0x36b87d,null))[_0x082b('0x45')](handleError(_0x36b87d,null));};exports[_0x082b('0x55')]=function(_0x42619a,_0x16ae26,_0x358899){var _0x15a397='';return db[_0x082b('0x2a')][_0x082b('0x4f')]({'where':{'id':_0x42619a['params']['id']},'attributes':['id',_0x082b('0x56'),'apiKey']})[_0x082b('0x43')](handleEntityNotFound(_0x16ae26,null))[_0x082b('0x43')](function(_0x473686){if(_0x473686){_0x15a397=_0x473686[_0x082b('0x56')];var _0x7a6c6f=_0x15a397[_0x082b('0x57')](-0x1);if(_0x7a6c6f==='/'){_0x15a397=_0x15a397['substring'](0x0,_0x15a397[_0x082b('0x58')](_0x7a6c6f));}return rp({'method':_0x082b('0x59'),'uri':util[_0x082b('0x5a')](_0x082b('0x5b'),_0x15a397,_0x082b('0x5c')),'headers':{'Authorization':util[_0x082b('0x5a')](_0x082b('0x5d'),new Buffer(util['format'](_0x082b('0x5e'),_0x473686[_0x082b('0x5f')]))['toString']('base64'))},'json':!![]});}})[_0x082b('0x43')](function(_0x3f7ae7){if(_0x3f7ae7){var _0x57fcef=['requester',_0x082b('0x60'),_0x082b('0x61'),_0x082b('0x62'),_0x082b('0x1b'),_0x082b('0x63'),'group',_0x082b('0x64'),'ticket_type',_0x082b('0x65'),_0x082b('0x66')];_[_0x082b('0x67')](_0x3f7ae7,function(_0x3a3300){return _0x57fcef['includes'](_0x3a3300[_0x082b('0x27')])||!_0x3a3300[_0x082b('0x68')]&&_0x3a3300['type']!=='custom_text'&&_0x3a3300[_0x082b('0x2d')]!==_0x082b('0x69');});return{'count':_0x3f7ae7['length'],'rows':_['map'](_0x3f7ae7,function(_0x32f4cb){return{'id':_0x32f4cb[_0x082b('0x27')],'name':_0x32f4cb['label'],'custom':!_0x32f4cb[_0x082b('0x68')],'options':_0x32f4cb[_0x082b('0x6a')]?_[_0x082b('0x29')](_0x32f4cb[_0x082b('0x6a')],function(_0x2903b4){return{'name':_[_0x082b('0x6b')](_0x2903b4),'value':_0x2903b4};}):[]};})};}})[_0x082b('0x43')](respondWithResult(_0x16ae26,null))[_0x082b('0x45')](function(_0x3e872d){var _0x55d724=_0x42619a[_0x082b('0x30')][_0x082b('0x6c')]?0x1f4:_0x3e872d[_0x082b('0x6d')]||0x1f4;logger[_0x082b('0x6e')](_0x082b('0x6f'),_0x082b('0x55'),_0x55d724,JSON['stringify'](_0x3e872d));delete _0x3e872d[_0x082b('0x27')];if(_0x55d724===0x191){_0x55d724=0x190;}_0x16ae26[_0x082b('0x1b')](_0x55d724)[_0x082b('0x70')](_0x42619a[_0x082b('0x30')][_0x082b('0x6c')]?{'message':_0x082b('0x71'),'statusCode':_0x3e872d['statusCode']}:_0x3e872d);});}; \ No newline at end of file +var _0xc9c3=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','FreshdeskAccount','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','find','create','body','FreshdeskConfiguration','order','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','%s/%s','format','Basic\x20%s','%s:X','base64','requester','agent','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x85d103,_0x43ef8a){_0x85d103=_0x85d103-0x0;var _0x3e5bab=_0xc9c3[_0x85d103];return _0x3e5bab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c9c('0x0'));var zipdir=require(_0x3c9c('0x1'));var jsonpatch=require(_0x3c9c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3c9c('0x3'));var Mustache=require(_0x3c9c('0x4'));var util=require('util');var path=require(_0x3c9c('0x5'));var sox=require(_0x3c9c('0x6'));var csv=require(_0x3c9c('0x7'));var ejs=require(_0x3c9c('0x8'));var fs=require('fs');var fs_extra=require(_0x3c9c('0x9'));var _=require(_0x3c9c('0xa'));var squel=require(_0x3c9c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c9c('0xc'));var toCsv=require(_0x3c9c('0x7'));var querystring=require('querystring');var Papa=require(_0x3c9c('0xd'));var Redis=require(_0x3c9c('0xe'));var authService=require(_0x3c9c('0xf'));var qs=require(_0x3c9c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c9c('0x11'))(_0x3c9c('0x12'));var utils=require(_0x3c9c('0x13'));var config=require(_0x3c9c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4a092d,_0x6d0a1a){_0x6d0a1a=_0x6d0a1a||0xcc;return function(_0x2c7dd3){if(_0x2c7dd3){return _0x4a092d['sendStatus'](_0x6d0a1a);}return _0x4a092d[_0x3c9c('0x15')](_0x6d0a1a)['end']();};}function respondWithResult(_0x2de024,_0x12dd2d){_0x12dd2d=_0x12dd2d||0xc8;return function(_0x1def09){if(_0x1def09){return _0x2de024['status'](_0x12dd2d)[_0x3c9c('0x16')](_0x1def09);}};}function respondWithFilteredResult(_0x59fb0f,_0x3b9fef){return function(_0x4b9b7f){if(_0x4b9b7f){var _0x448319=typeof _0x3b9fef[_0x3c9c('0x17')]===_0x3c9c('0x18')&&typeof _0x3b9fef['limit']===_0x3c9c('0x18');var _0x4f0db4=_0x4b9b7f[_0x3c9c('0x19')];var _0xa3f509=_0x448319?0x0:_0x3b9fef[_0x3c9c('0x17')];var _0x44ba13=_0x448319?_0x4b9b7f[_0x3c9c('0x19')]:_0x3b9fef[_0x3c9c('0x17')]+_0x3b9fef[_0x3c9c('0x1a')];var _0x24ae87;if(_0x44ba13>=_0x4f0db4){_0x44ba13=_0x4f0db4;_0x24ae87=0xc8;}else{_0x24ae87=0xce;}_0x59fb0f[_0x3c9c('0x15')](_0x24ae87);return _0x59fb0f[_0x3c9c('0x1b')](_0x3c9c('0x1c'),_0xa3f509+'-'+_0x44ba13+'/'+_0x4f0db4)[_0x3c9c('0x16')](_0x4b9b7f);}return null;};}function patchUpdates(_0x4ec5b3){return function(_0x2d0f42){try{jsonpatch['apply'](_0x2d0f42,_0x4ec5b3,!![]);}catch(_0x4ea1a9){return BPromise[_0x3c9c('0x1d')](_0x4ea1a9);}return _0x2d0f42[_0x3c9c('0x1e')]();};}function saveUpdates(_0x281757,_0x564139){return function(_0x4fd36d){if(_0x4fd36d){return _0x4fd36d[_0x3c9c('0x1f')](_0x281757)['then'](function(_0x5a9ed3){return _0x5a9ed3;});}return null;};}function removeEntity(_0x219076,_0x32161b){return function(_0x589fbf){if(_0x589fbf){return _0x589fbf[_0x3c9c('0x20')]()[_0x3c9c('0x21')](function(){_0x219076[_0x3c9c('0x15')](0xcc)[_0x3c9c('0x22')]();});}};}function handleEntityNotFound(_0x43c18b,_0x335bb4){return function(_0x5b5aa5){if(!_0x5b5aa5){_0x43c18b[_0x3c9c('0x23')](0x194);}return _0x5b5aa5;};}function handleError(_0x599d1b,_0x52924e){_0x52924e=_0x52924e||0x1f4;return function(_0x2ea2dc){logger[_0x3c9c('0x24')](_0x2ea2dc[_0x3c9c('0x25')]);if(_0x2ea2dc[_0x3c9c('0x26')]){delete _0x2ea2dc[_0x3c9c('0x26')];}_0x599d1b[_0x3c9c('0x15')](_0x52924e)[_0x3c9c('0x27')](_0x2ea2dc);};}exports[_0x3c9c('0x28')]=function(_0x24e8d6,_0x52c9bb){var _0x10511f={},_0x2d2e90={},_0xf04bab={'count':0x0,'rows':[]};var _0x545cde=_['map'](db[_0x3c9c('0x29')][_0x3c9c('0x2a')],function(_0x7c6d8f){return{'name':_0x7c6d8f['fieldName'],'type':_0x7c6d8f[_0x3c9c('0x2b')][_0x3c9c('0x2c')]};});_0x2d2e90['model']=_[_0x3c9c('0x2d')](_0x545cde,_0x3c9c('0x26'));_0x2d2e90['query']=_[_0x3c9c('0x2e')](_0x24e8d6[_0x3c9c('0x2f')]);_0x2d2e90[_0x3c9c('0x30')]=_[_0x3c9c('0x31')](_0x2d2e90[_0x3c9c('0x32')],_0x2d2e90[_0x3c9c('0x2f')]);_0x10511f[_0x3c9c('0x33')]=_[_0x3c9c('0x31')](_0x2d2e90[_0x3c9c('0x32')],qs[_0x3c9c('0x34')](_0x24e8d6[_0x3c9c('0x2f')][_0x3c9c('0x34')]));_0x10511f[_0x3c9c('0x33')]=_0x10511f[_0x3c9c('0x33')][_0x3c9c('0x35')]?_0x10511f[_0x3c9c('0x33')]:_0x2d2e90[_0x3c9c('0x32')];if(!_0x24e8d6['query'][_0x3c9c('0x36')](_0x3c9c('0x37'))){_0x10511f[_0x3c9c('0x1a')]=qs[_0x3c9c('0x1a')](_0x24e8d6['query'][_0x3c9c('0x1a')]);_0x10511f[_0x3c9c('0x17')]=qs[_0x3c9c('0x17')](_0x24e8d6[_0x3c9c('0x2f')][_0x3c9c('0x17')]);}_0x10511f['order']=qs[_0x3c9c('0x38')](_0x24e8d6[_0x3c9c('0x2f')][_0x3c9c('0x38')]);_0x10511f[_0x3c9c('0x39')]=qs[_0x3c9c('0x30')](_[_0x3c9c('0x3a')](_0x24e8d6[_0x3c9c('0x2f')],_0x2d2e90['filters']),_0x545cde);if(_0x24e8d6[_0x3c9c('0x2f')][_0x3c9c('0x3b')]){_0x10511f[_0x3c9c('0x39')]=_[_0x3c9c('0x3c')](_0x10511f['where'],{'$or':_[_0x3c9c('0x2d')](_0x545cde,function(_0x55231a){if(_0x55231a[_0x3c9c('0x2b')]!=='VIRTUAL'){var _0x39aad0={};_0x39aad0[_0x55231a['name']]={'$like':'%'+_0x24e8d6[_0x3c9c('0x2f')]['filter']+'%'};return _0x39aad0;}})});}_0x10511f=_[_0x3c9c('0x3c')]({},_0x10511f,_0x24e8d6[_0x3c9c('0x3d')]);var _0x25ab0a={'where':_0x10511f[_0x3c9c('0x39')]};return db['FreshdeskAccount'][_0x3c9c('0x19')](_0x25ab0a)[_0x3c9c('0x21')](function(_0x5beec0){_0xf04bab[_0x3c9c('0x19')]=_0x5beec0;if(_0x24e8d6[_0x3c9c('0x2f')][_0x3c9c('0x3e')]){_0x10511f[_0x3c9c('0x3f')]=[{'all':!![]}];}return db[_0x3c9c('0x29')]['findAll'](_0x10511f);})['then'](function(_0x4e8e1c){_0xf04bab['rows']=_0x4e8e1c;return _0xf04bab;})[_0x3c9c('0x21')](respondWithFilteredResult(_0x52c9bb,_0x10511f))[_0x3c9c('0x40')](handleError(_0x52c9bb,null));};exports[_0x3c9c('0x41')]=function(_0x289c12,_0x511a1f){var _0x2a47c6={'raw':![],'where':{'id':_0x289c12[_0x3c9c('0x42')]['id']}},_0x4ba507={};_0x4ba507[_0x3c9c('0x32')]=_[_0x3c9c('0x2e')](db[_0x3c9c('0x29')][_0x3c9c('0x2a')]);_0x4ba507[_0x3c9c('0x2f')]=_['keys'](_0x289c12[_0x3c9c('0x2f')]);_0x4ba507[_0x3c9c('0x30')]=_[_0x3c9c('0x31')](_0x4ba507[_0x3c9c('0x32')],_0x4ba507[_0x3c9c('0x2f')]);_0x2a47c6[_0x3c9c('0x33')]=_[_0x3c9c('0x31')](_0x4ba507[_0x3c9c('0x32')],qs[_0x3c9c('0x34')](_0x289c12['query']['fields']));_0x2a47c6[_0x3c9c('0x33')]=_0x2a47c6[_0x3c9c('0x33')][_0x3c9c('0x35')]?_0x2a47c6[_0x3c9c('0x33')]:_0x4ba507['model'];if(_0x289c12[_0x3c9c('0x2f')][_0x3c9c('0x3e')]){_0x2a47c6[_0x3c9c('0x3f')]=[{'all':!![]}];}_0x2a47c6=_[_0x3c9c('0x3c')]({},_0x2a47c6,_0x289c12[_0x3c9c('0x3d')]);return db[_0x3c9c('0x29')][_0x3c9c('0x43')](_0x2a47c6)[_0x3c9c('0x21')](handleEntityNotFound(_0x511a1f,null))[_0x3c9c('0x21')](respondWithResult(_0x511a1f,null))[_0x3c9c('0x40')](handleError(_0x511a1f,null));};exports[_0x3c9c('0x44')]=function(_0xe5b0c7,_0x1c2991){return db['FreshdeskAccount'][_0x3c9c('0x44')](_0xe5b0c7['body'],{})[_0x3c9c('0x21')](respondWithResult(_0x1c2991,0xc9))['catch'](handleError(_0x1c2991,null));};exports['update']=function(_0x3d3f67,_0x513a61){if(_0x3d3f67[_0x3c9c('0x45')]['id']){delete _0x3d3f67[_0x3c9c('0x45')]['id'];}return db[_0x3c9c('0x29')][_0x3c9c('0x43')]({'where':{'id':_0x3d3f67[_0x3c9c('0x42')]['id']}})[_0x3c9c('0x21')](handleEntityNotFound(_0x513a61,null))[_0x3c9c('0x21')](saveUpdates(_0x3d3f67[_0x3c9c('0x45')],null))[_0x3c9c('0x21')](respondWithResult(_0x513a61,null))[_0x3c9c('0x40')](handleError(_0x513a61,null));};exports['destroy']=function(_0x2cd997,_0x65bf14){return db['FreshdeskAccount'][_0x3c9c('0x43')]({'where':{'id':_0x2cd997[_0x3c9c('0x42')]['id']}})[_0x3c9c('0x21')](handleEntityNotFound(_0x65bf14,null))[_0x3c9c('0x21')](removeEntity(_0x65bf14,null))[_0x3c9c('0x40')](handleError(_0x65bf14,null));};exports['getConfigurations']=function(_0x45d1eb,_0x1c79df,_0x22b6bd){var _0xdfebf4={};var _0x2e8e7c={};var _0x38b13c;var _0x2240e3;return db[_0x3c9c('0x29')]['findOne']({'where':{'id':_0x45d1eb[_0x3c9c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c79df,null))[_0x3c9c('0x21')](function(_0x32728c){if(_0x32728c){_0x38b13c=_0x32728c;_0x2e8e7c[_0x3c9c('0x32')]=_[_0x3c9c('0x2e')](db[_0x3c9c('0x46')][_0x3c9c('0x2a')]);_0x2e8e7c['query']=_[_0x3c9c('0x2e')](_0x45d1eb[_0x3c9c('0x2f')]);_0x2e8e7c[_0x3c9c('0x30')]=_[_0x3c9c('0x31')](_0x2e8e7c['model'],_0x2e8e7c[_0x3c9c('0x2f')]);_0xdfebf4[_0x3c9c('0x33')]=_[_0x3c9c('0x31')](_0x2e8e7c[_0x3c9c('0x32')],qs['fields'](_0x45d1eb[_0x3c9c('0x2f')][_0x3c9c('0x34')]));_0xdfebf4[_0x3c9c('0x33')]=_0xdfebf4[_0x3c9c('0x33')][_0x3c9c('0x35')]?_0xdfebf4[_0x3c9c('0x33')]:_0x2e8e7c[_0x3c9c('0x32')];_0xdfebf4[_0x3c9c('0x47')]=qs[_0x3c9c('0x38')](_0x45d1eb['query'][_0x3c9c('0x38')]);_0xdfebf4[_0x3c9c('0x39')]=qs['filters'](_[_0x3c9c('0x3a')](_0x45d1eb[_0x3c9c('0x2f')],_0x2e8e7c[_0x3c9c('0x30')]));if(_0x45d1eb[_0x3c9c('0x2f')][_0x3c9c('0x3b')]){_0xdfebf4['where']=_[_0x3c9c('0x3c')](_0xdfebf4[_0x3c9c('0x39')],{'$or':_[_0x3c9c('0x2d')](_0xdfebf4[_0x3c9c('0x33')],function(_0x45d210){var _0x5c6ed5={};_0x5c6ed5[_0x45d210]={'$like':'%'+_0x45d1eb['query'][_0x3c9c('0x3b')]+'%'};return _0x5c6ed5;})});}_0xdfebf4=_['merge']({},_0xdfebf4,_0x45d1eb[_0x3c9c('0x3d')]);return _0x38b13c[_0x3c9c('0x48')](_0xdfebf4);}})['then'](function(_0x539861){if(_0x539861){_0x2240e3=_0x539861[_0x3c9c('0x35')];if(!_0x45d1eb[_0x3c9c('0x2f')][_0x3c9c('0x36')]('nolimit')){_0xdfebf4[_0x3c9c('0x1a')]=qs[_0x3c9c('0x1a')](_0x45d1eb[_0x3c9c('0x2f')]['limit']);_0xdfebf4['offset']=qs[_0x3c9c('0x17')](_0x45d1eb['query']['offset']);}return _0x38b13c[_0x3c9c('0x48')](_0xdfebf4);}})['then'](function(_0x3977bf){if(_0x3977bf){return _0x3977bf?{'count':_0x2240e3,'rows':_0x3977bf}:null;}})[_0x3c9c('0x21')](respondWithResult(_0x1c79df,null))[_0x3c9c('0x40')](handleError(_0x1c79df,null));};exports[_0x3c9c('0x49')]=function(_0x475884,_0x4f87b7,_0x208716){if(_0x475884[_0x3c9c('0x45')]['id']){delete _0x475884[_0x3c9c('0x45')]['id'];}return db[_0x3c9c('0x29')][_0x3c9c('0x4a')]({'where':{'id':_0x475884['params']['id']}})[_0x3c9c('0x21')](handleEntityNotFound(_0x4f87b7,null))[_0x3c9c('0x21')](function(_0x1e8a87){if(_0x1e8a87){_0x475884['body'][_0x3c9c('0x4b')]=_0x1e8a87['id'];_0x475884[_0x3c9c('0x45')]['Subjects']=integrations[_0x3c9c('0x4c')](_0x475884['body'][_0x3c9c('0x4d')],_0x475884[_0x3c9c('0x45')]['type']);_0x475884[_0x3c9c('0x45')]['Descriptions']=integrations['getDescriptions'](_0x475884[_0x3c9c('0x45')][_0x3c9c('0x4d')],_0x475884['body']['type']);return db[_0x3c9c('0x46')][_0x3c9c('0x44')](_0x475884['body'],{'include':[{'model':db[_0x3c9c('0x4e')],'as':_0x3c9c('0x4f')},{'model':db[_0x3c9c('0x4e')],'as':_0x3c9c('0x50')}]});}return null;})[_0x3c9c('0x21')](respondWithResult(_0x4f87b7,null))[_0x3c9c('0x40')](handleError(_0x4f87b7,null));};exports[_0x3c9c('0x51')]=function(_0x13c09c,_0x16f5d5,_0x68efda){var _0x587037='';return db[_0x3c9c('0x29')][_0x3c9c('0x4a')]({'where':{'id':_0x13c09c['params']['id']},'attributes':['id',_0x3c9c('0x52'),_0x3c9c('0x53')]})['then'](handleEntityNotFound(_0x16f5d5,null))[_0x3c9c('0x21')](function(_0x4137dd){if(_0x4137dd){_0x587037=_0x4137dd[_0x3c9c('0x52')];var _0x1db869=_0x587037[_0x3c9c('0x54')](-0x1);if(_0x1db869==='/'){_0x587037=_0x587037[_0x3c9c('0x55')](0x0,_0x587037[_0x3c9c('0x56')](_0x1db869));}return rp({'method':'GET','uri':util['format'](_0x3c9c('0x57'),_0x587037,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x3c9c('0x58')](_0x3c9c('0x59'),new Buffer(util[_0x3c9c('0x58')](_0x3c9c('0x5a'),_0x4137dd[_0x3c9c('0x53')]))['toString'](_0x3c9c('0x5b')))},'json':!![]});}})[_0x3c9c('0x21')](function(_0x5cc9ba){if(_0x5cc9ba){var _0x2d2650=[_0x3c9c('0x5c'),'subject',_0x3c9c('0x5d'),'description',_0x3c9c('0x15'),'priority',_0x3c9c('0x5e'),_0x3c9c('0x5f'),_0x3c9c('0x60'),_0x3c9c('0x5e'),_0x3c9c('0x61')];_[_0x3c9c('0x62')](_0x5cc9ba,function(_0x208348){return _0x2d2650[_0x3c9c('0x63')](_0x208348['name'])||!_0x208348[_0x3c9c('0x64')]&&_0x208348[_0x3c9c('0x2b')]!==_0x3c9c('0x65')&&_0x208348['type']!==_0x3c9c('0x66');});return{'count':_0x5cc9ba[_0x3c9c('0x35')],'rows':_['map'](_0x5cc9ba,function(_0x4d9364){return{'id':_0x4d9364[_0x3c9c('0x26')],'name':_0x4d9364[_0x3c9c('0x67')],'custom':!_0x4d9364[_0x3c9c('0x64')],'options':_0x4d9364[_0x3c9c('0x68')]?_[_0x3c9c('0x2d')](_0x4d9364[_0x3c9c('0x68')],function(_0x3ef76e){return{'name':_[_0x3c9c('0x69')](_0x3ef76e),'value':_0x3ef76e};}):[]};})};}})[_0x3c9c('0x21')](respondWithResult(_0x16f5d5,null))['catch'](function(_0x55cb85){var _0x45e259=_0x13c09c[_0x3c9c('0x2f')][_0x3c9c('0x6a')]?0x1f4:_0x55cb85[_0x3c9c('0x6b')]||0x1f4;logger[_0x3c9c('0x24')](_0x3c9c('0x6c'),_0x3c9c('0x51'),_0x45e259,JSON[_0x3c9c('0x6d')](_0x55cb85));delete _0x55cb85['name'];if(_0x45e259===0x191){_0x45e259=0x190;}_0x16f5d5[_0x3c9c('0x15')](_0x45e259)[_0x3c9c('0x27')](_0x13c09c['query']['test']?{'message':_0x3c9c('0x6e'),'statusCode':_0x55cb85[_0x3c9c('0x6b')]}:_0x55cb85);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index d7b683f..e26d031 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 _0x40b1=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x547fa1,_0x3b4af9){var _0x658640=function(_0x120151){while(--_0x120151){_0x547fa1['push'](_0x547fa1['shift']());}};_0x658640(++_0x3b4af9);}(_0x40b1,0x137));var _0x140b=function(_0x351835,_0x576d5d){_0x351835=_0x351835-0x0;var _0x5ea3ac=_0x40b1[_0x351835];return _0x5ea3ac;};'use strict';var _=require(_0x140b('0x0'));var util=require(_0x140b('0x1'));var logger=require('../../config/logger')(_0x140b('0x2'));var moment=require(_0x140b('0x3'));var BPromise=require(_0x140b('0x4'));var rp=require(_0x140b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x140b('0x6'));var config=require(_0x140b('0x7'));var attributes=require(_0x140b('0x8'));var integrations=require(_0x140b('0x9'));module[_0x140b('0xa')]=function(_0x57261f,_0x5f0e97){return _0x57261f[_0x140b('0xb')](_0x140b('0xc'),attributes,{'tableName':_0x140b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8de=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xe8de,0x1e0));var _0xee8d=function(_0x21e3c4,_0x45f907){_0x21e3c4=_0x21e3c4-0x0;var _0x5ca376=_0xe8de[_0x21e3c4];return _0x5ca376;};'use strict';var _=require(_0xee8d('0x0'));var util=require('util');var logger=require(_0xee8d('0x1'))(_0xee8d('0x2'));var moment=require(_0xee8d('0x3'));var BPromise=require(_0xee8d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xee8d('0x5'));var config=require(_0xee8d('0x6'));var attributes=require(_0xee8d('0x7'));var integrations=require(_0xee8d('0x8'));module[_0xee8d('0x9')]=function(_0x596f3a,_0x35dc96){return _0x596f3a[_0xee8d('0xa')](_0xee8d('0xb'),attributes,{'tableName':_0xee8d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 2aceca4..24fceb5 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 _0x5a24=['where','attributes','limit','map','include','model','GetFreshdeskAccount','ShowFreshdeskAccount','then','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshdeskAccount','findAll','options','raw'];(function(_0x28e80a,_0x18760c){var _0x1ac3b3=function(_0x16b204){while(--_0x16b204){_0x28e80a['push'](_0x28e80a['shift']());}};_0x1ac3b3(++_0x18760c);}(_0x5a24,0x6f));var _0x45a2=function(_0x1bbb80,_0x15b8b7){_0x1bbb80=_0x1bbb80-0x0;var _0x2558e2=_0x5a24[_0x1bbb80];return _0x2558e2;};'use strict';var _=require(_0x45a2('0x0'));var util=require(_0x45a2('0x1'));var moment=require(_0x45a2('0x2'));var BPromise=require(_0x45a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x45a2('0x5'));var logger=require(_0x45a2('0x6'))('rpc');var config=require(_0x45a2('0x7'));var jayson=require(_0x45a2('0x8'));var client=jayson[_0x45a2('0x9')][_0x45a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2454cf,_0x177058,_0x2349ad){return new BPromise(function(_0x50d383,_0x28174a){return client['request'](_0x2454cf,_0x2349ad)['then'](function(_0x5f4d0c){logger[_0x45a2('0xb')](_0x45a2('0xc'),_0x177058,_0x45a2('0xd'));logger[_0x45a2('0xe')](_0x45a2('0xf'),_0x177058,_0x45a2('0xd'),JSON[_0x45a2('0x10')](_0x5f4d0c));if(_0x5f4d0c[_0x45a2('0x11')]){if(_0x5f4d0c['error']['code']===0x1f4){logger[_0x45a2('0x11')](_0x45a2('0xc'),_0x177058,_0x5f4d0c[_0x45a2('0x11')][_0x45a2('0x12')]);return _0x28174a(_0x5f4d0c[_0x45a2('0x11')]['message']);}logger[_0x45a2('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x177058,_0x5f4d0c[_0x45a2('0x11')][_0x45a2('0x12')]);return _0x50d383(_0x5f4d0c[_0x45a2('0x11')]['message']);}else{logger[_0x45a2('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x177058,_0x45a2('0xd'));_0x50d383(_0x5f4d0c[_0x45a2('0x13')][_0x45a2('0x12')]);}})[_0x45a2('0x14')](function(_0x5ab45d){logger[_0x45a2('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x177058,_0x5ab45d);_0x28174a(_0x5ab45d);});});}exports['GetFreshdeskAccount']=function(_0x5f522b){var _0x26a31b=this;return new Promise(function(_0x47518e,_0xcb86d5){return db[_0x45a2('0x15')][_0x45a2('0x16')]({'raw':_0x5f522b[_0x45a2('0x17')]?_0x5f522b[_0x45a2('0x17')][_0x45a2('0x18')]===undefined?!![]:![]:!![],'where':_0x5f522b['options']?_0x5f522b[_0x45a2('0x17')][_0x45a2('0x19')]||null:null,'attributes':_0x5f522b[_0x45a2('0x17')]?_0x5f522b['options'][_0x45a2('0x1a')]||null:null,'limit':_0x5f522b['options']?_0x5f522b[_0x45a2('0x17')][_0x45a2('0x1b')]||null:null,'include':_0x5f522b['options']?_0x5f522b[_0x45a2('0x17')]['include']?_[_0x45a2('0x1c')](_0x5f522b[_0x45a2('0x17')][_0x45a2('0x1d')],function(_0x1682d7){return{'model':db[_0x1682d7['model']],'as':_0x1682d7['as'],'attributes':_0x1682d7[_0x45a2('0x1a')],'include':_0x1682d7[_0x45a2('0x1d')]?_[_0x45a2('0x1c')](_0x1682d7['include'],function(_0x59c285){return{'model':db[_0x59c285[_0x45a2('0x1e')]],'as':_0x59c285['as'],'attributes':_0x59c285[_0x45a2('0x1a')],'include':_0x59c285[_0x45a2('0x1d')]?_[_0x45a2('0x1c')](_0x59c285[_0x45a2('0x1d')],function(_0x4401d4){return{'model':db[_0x4401d4[_0x45a2('0x1e')]],'as':_0x4401d4['as'],'attributes':_0x4401d4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x68c797){logger[_0x45a2('0xb')](_0x45a2('0x1f'),_0x5f522b);logger['debug'](_0x45a2('0x1f'),_0x5f522b,JSON['stringify'](_0x68c797));_0x47518e(_0x68c797);})[_0x45a2('0x14')](function(_0x1aad56){logger[_0x45a2('0x11')](_0x45a2('0x1f'),_0x1aad56[_0x45a2('0x12')],_0x5f522b);_0xcb86d5(_0x26a31b[_0x45a2('0x11')](0x1f4,_0x1aad56[_0x45a2('0x12')]));});});};exports[_0x45a2('0x20')]=function(_0xddc56b){var _0x3086da=this;return new Promise(function(_0x4e3188,_0x360c5e){return db[_0x45a2('0x15')]['find']({'raw':_0xddc56b['options']?_0xddc56b[_0x45a2('0x17')][_0x45a2('0x18')]===undefined?!![]:![]:!![],'where':_0xddc56b[_0x45a2('0x17')]?_0xddc56b[_0x45a2('0x17')][_0x45a2('0x19')]||null:null,'attributes':_0xddc56b['options']?_0xddc56b[_0x45a2('0x17')][_0x45a2('0x1a')]||null:null,'include':_0xddc56b[_0x45a2('0x17')]?_0xddc56b['options'][_0x45a2('0x1d')]?_[_0x45a2('0x1c')](_0xddc56b[_0x45a2('0x17')][_0x45a2('0x1d')],function(_0x2511cb){return{'model':db[_0x2511cb[_0x45a2('0x1e')]],'as':_0x2511cb['as'],'attributes':_0x2511cb['attributes'],'include':_0x2511cb[_0x45a2('0x1d')]?_['map'](_0x2511cb['include'],function(_0x3f050d){return{'model':db[_0x3f050d['model']],'as':_0x3f050d['as'],'attributes':_0x3f050d[_0x45a2('0x1a')],'include':_0x3f050d[_0x45a2('0x1d')]?_['map'](_0x3f050d[_0x45a2('0x1d')],function(_0x487aae){return{'model':db[_0x487aae[_0x45a2('0x1e')]],'as':_0x487aae['as'],'attributes':_0x487aae[_0x45a2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x45a2('0x21')](function(_0x4e9af2){logger[_0x45a2('0xb')](_0x45a2('0x20'),_0xddc56b);logger[_0x45a2('0xe')](_0x45a2('0x20'),_0xddc56b,JSON['stringify'](_0x4e9af2));_0x4e3188(_0x4e9af2);})[_0x45a2('0x14')](function(_0xb02ef0){logger[_0x45a2('0x11')](_0x45a2('0x20'),_0xb02ef0['message'],_0xddc56b);_0x360c5e(_0x3086da[_0x45a2('0x11')](0x1f4,_0xb02ef0[_0x45a2('0x12')]));});});}; \ No newline at end of file +var _0x169c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','find','where','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4cb267,_0x2cd957){var _0x4597b5=function(_0x1d9b36){while(--_0x1d9b36){_0x4cb267['push'](_0x4cb267['shift']());}};_0x4597b5(++_0x2cd957);}(_0x169c,0x1dc));var _0xc169=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x169c[_0x21f931];return _0x3f083c;};'use strict';var _=require(_0xc169('0x0'));var util=require(_0xc169('0x1'));var moment=require('moment');var BPromise=require(_0xc169('0x2'));var rs=require(_0xc169('0x3'));var fs=require('fs');var Redis=require(_0xc169('0x4'));var db=require(_0xc169('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc169('0x6'))(_0xc169('0x7'));var config=require(_0xc169('0x8'));var jayson=require(_0xc169('0x9'));var client=jayson[_0xc169('0xa')][_0xc169('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x199d05,_0x278d7a,_0x2c770d){return new BPromise(function(_0x49d809,_0x795885){return client[_0xc169('0xc')](_0x199d05,_0x2c770d)[_0xc169('0xd')](function(_0x2fd246){logger['info'](_0xc169('0xe'),_0x278d7a,_0xc169('0xf'));logger[_0xc169('0x10')](_0xc169('0x11'),_0x278d7a,_0xc169('0xf'),JSON['stringify'](_0x2fd246));if(_0x2fd246[_0xc169('0x12')]){if(_0x2fd246['error'][_0xc169('0x13')]===0x1f4){logger[_0xc169('0x12')](_0xc169('0xe'),_0x278d7a,_0x2fd246[_0xc169('0x12')][_0xc169('0x14')]);return _0x795885(_0x2fd246['error']['message']);}logger[_0xc169('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x278d7a,_0x2fd246[_0xc169('0x12')][_0xc169('0x14')]);return _0x49d809(_0x2fd246[_0xc169('0x12')]['message']);}else{logger[_0xc169('0x15')](_0xc169('0xe'),_0x278d7a,_0xc169('0xf'));_0x49d809(_0x2fd246['result']['message']);}})[_0xc169('0x16')](function(_0x2f5801){logger[_0xc169('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x278d7a,_0x2f5801);_0x795885(_0x2f5801);});});}exports[_0xc169('0x17')]=function(_0x59ce87){var _0x15d8a5=this;return new Promise(function(_0x605a9a,_0x8dbde5){return db[_0xc169('0x18')][_0xc169('0x19')]({'raw':_0x59ce87[_0xc169('0x1a')]?_0x59ce87['options'][_0xc169('0x1b')]===undefined?!![]:![]:!![],'where':_0x59ce87[_0xc169('0x1a')]?_0x59ce87[_0xc169('0x1a')]['where']||null:null,'attributes':_0x59ce87[_0xc169('0x1a')]?_0x59ce87['options']['attributes']||null:null,'limit':_0x59ce87[_0xc169('0x1a')]?_0x59ce87['options'][_0xc169('0x1c')]||null:null,'include':_0x59ce87['options']?_0x59ce87['options'][_0xc169('0x1d')]?_[_0xc169('0x1e')](_0x59ce87[_0xc169('0x1a')]['include'],function(_0x3d5c39){return{'model':db[_0x3d5c39[_0xc169('0x1f')]],'as':_0x3d5c39['as'],'attributes':_0x3d5c39[_0xc169('0x20')],'include':_0x3d5c39['include']?_[_0xc169('0x1e')](_0x3d5c39[_0xc169('0x1d')],function(_0x569a97){return{'model':db[_0x569a97[_0xc169('0x1f')]],'as':_0x569a97['as'],'attributes':_0x569a97[_0xc169('0x20')],'include':_0x569a97['include']?_[_0xc169('0x1e')](_0x569a97[_0xc169('0x1d')],function(_0x5328cb){return{'model':db[_0x5328cb[_0xc169('0x1f')]],'as':_0x5328cb['as'],'attributes':_0x5328cb[_0xc169('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29e92a){logger[_0xc169('0x15')](_0xc169('0x17'),_0x59ce87);logger[_0xc169('0x10')](_0xc169('0x17'),_0x59ce87,JSON[_0xc169('0x21')](_0x29e92a));_0x605a9a(_0x29e92a);})[_0xc169('0x16')](function(_0x32860e){logger[_0xc169('0x12')](_0xc169('0x17'),_0x32860e['message'],_0x59ce87);_0x8dbde5(_0x15d8a5[_0xc169('0x12')](0x1f4,_0x32860e[_0xc169('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x42634c){var _0x588bb9=this;return new Promise(function(_0x3ef427,_0x15350e){return db[_0xc169('0x18')][_0xc169('0x22')]({'raw':_0x42634c['options']?_0x42634c['options'][_0xc169('0x1b')]===undefined?!![]:![]:!![],'where':_0x42634c[_0xc169('0x1a')]?_0x42634c[_0xc169('0x1a')][_0xc169('0x23')]||null:null,'attributes':_0x42634c[_0xc169('0x1a')]?_0x42634c[_0xc169('0x1a')][_0xc169('0x20')]||null:null,'include':_0x42634c[_0xc169('0x1a')]?_0x42634c[_0xc169('0x1a')][_0xc169('0x1d')]?_[_0xc169('0x1e')](_0x42634c[_0xc169('0x1a')][_0xc169('0x1d')],function(_0x57b599){return{'model':db[_0x57b599[_0xc169('0x1f')]],'as':_0x57b599['as'],'attributes':_0x57b599[_0xc169('0x20')],'include':_0x57b599[_0xc169('0x1d')]?_[_0xc169('0x1e')](_0x57b599[_0xc169('0x1d')],function(_0x5c8fdb){return{'model':db[_0x5c8fdb[_0xc169('0x1f')]],'as':_0x5c8fdb['as'],'attributes':_0x5c8fdb[_0xc169('0x20')],'include':_0x5c8fdb[_0xc169('0x1d')]?_[_0xc169('0x1e')](_0x5c8fdb[_0xc169('0x1d')],function(_0x551879){return{'model':db[_0x551879[_0xc169('0x1f')]],'as':_0x551879['as'],'attributes':_0x551879[_0xc169('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc169('0xd')](function(_0x5263cc){logger['info']('ShowFreshdeskAccount',_0x42634c);logger[_0xc169('0x10')]('ShowFreshdeskAccount',_0x42634c,JSON[_0xc169('0x21')](_0x5263cc));_0x3ef427(_0x5263cc);})[_0xc169('0x16')](function(_0x363be3){logger[_0xc169('0x12')](_0xc169('0x24'),_0x363be3[_0xc169('0x14')],_0x42634c);_0x15350e(_0x588bb9[_0xc169('0x12')](0x1f4,_0x363be3[_0xc169('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a2a2ccd..8fd9a54 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 _0x247d=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x461abc,_0x5122c1){var _0x1a65cf=function(_0x2b9704){while(--_0x2b9704){_0x461abc['push'](_0x461abc['shift']());}};_0x1a65cf(++_0x5122c1);}(_0x247d,0x1b2));var _0xd247=function(_0x46162d,_0x37a103){_0x46162d=_0x46162d-0x0;var _0x38b233=_0x247d[_0x46162d];return _0x38b233;};'use strict';var multer=require(_0xd247('0x0'));var util=require('util');var path=require(_0xd247('0x1'));var timeout=require(_0xd247('0x2'));var express=require(_0xd247('0x3'));var router=express[_0xd247('0x4')]();var fs_extra=require(_0xd247('0x5'));var auth=require(_0xd247('0x6'));var interaction=require(_0xd247('0x7'));var config=require(_0xd247('0x8'));var controller=require(_0xd247('0x9'));router[_0xd247('0xa')]('/',auth[_0xd247('0xb')](),controller[_0xd247('0xc')]);router['get'](_0xd247('0xd'),auth[_0xd247('0xb')](),controller[_0xd247('0xe')]);router[_0xd247('0xa')](_0xd247('0xf'),auth[_0xd247('0xb')](),controller[_0xd247('0x10')]);router[_0xd247('0xa')](_0xd247('0x11'),auth[_0xd247('0xb')](),controller[_0xd247('0x12')]);router['get'](_0xd247('0x13'),auth['isAuthenticated'](),controller[_0xd247('0x14')]);router[_0xd247('0xa')]('/:id/tags',auth[_0xd247('0xb')](),controller[_0xd247('0x15')]);router[_0xd247('0x16')]('/',auth[_0xd247('0xb')](),controller[_0xd247('0x17')]);router[_0xd247('0x16')](_0xd247('0x18'),auth[_0xd247('0xb')](),controller['setTags']);router[_0xd247('0x19')](_0xd247('0xd'),auth['isAuthenticated'](),controller[_0xd247('0x1a')]);router[_0xd247('0x1b')](_0xd247('0xd'),auth[_0xd247('0xb')](),controller[_0xd247('0x1c')]);module[_0xd247('0x1d')]=router; \ No newline at end of file +var _0xbcda=['/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x45283b,_0xe68902){var _0x1b23f9=function(_0x34f4d9){while(--_0x34f4d9){_0x45283b['push'](_0x45283b['shift']());}};_0x1b23f9(++_0xe68902);}(_0xbcda,0xf8));var _0xabcd=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xbcda[_0x5e36d1];return _0x950b9e;};'use strict';var multer=require(_0xabcd('0x0'));var util=require('util');var path=require(_0xabcd('0x1'));var timeout=require(_0xabcd('0x2'));var express=require('express');var router=express[_0xabcd('0x3')]();var fs_extra=require(_0xabcd('0x4'));var auth=require(_0xabcd('0x5'));var interaction=require(_0xabcd('0x6'));var config=require('../../config/environment');var controller=require(_0xabcd('0x7'));router[_0xabcd('0x8')]('/',auth[_0xabcd('0x9')](),controller[_0xabcd('0xa')]);router['get'](_0xabcd('0xb'),auth[_0xabcd('0x9')](),controller['show']);router[_0xabcd('0x8')](_0xabcd('0xc'),auth[_0xabcd('0x9')](),controller[_0xabcd('0xd')]);router[_0xabcd('0x8')](_0xabcd('0xe'),auth[_0xabcd('0x9')](),controller[_0xabcd('0xf')]);router[_0xabcd('0x8')](_0xabcd('0x10'),auth['isAuthenticated'](),controller[_0xabcd('0x11')]);router['get']('/:id/tags',auth[_0xabcd('0x9')](),controller['getTags']);router['post']('/',auth[_0xabcd('0x9')](),controller['create']);router[_0xabcd('0x12')]('/:id/tags',auth[_0xabcd('0x9')](),controller['setTags']);router[_0xabcd('0x13')]('/:id',auth[_0xabcd('0x9')](),controller[_0xabcd('0x14')]);router[_0xabcd('0x15')](_0xabcd('0xb'),auth[_0xabcd('0x9')](),controller[_0xabcd('0x16')]);module[_0xabcd('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 2e8b433..0c57eab 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 _0x631a=['STRING','exports'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x631a,0x6f));var _0xa631=function(_0x319bce,_0x1facb2){_0x319bce=_0x319bce-0x0;var _0x3c6cd1=_0x631a[_0x319bce];return _0x3c6cd1;};'use strict';var Sequelize=require('sequelize');module[_0xa631('0x0')]={'name':{'type':Sequelize[_0xa631('0x1')]},'description':{'type':Sequelize[_0xa631('0x1')]}}; \ No newline at end of file +var _0x4a90=['sequelize','STRING'];(function(_0x5d6031,_0x1b0856){var _0x4b559f=function(_0x384f7b){while(--_0x384f7b){_0x5d6031['push'](_0x5d6031['shift']());}};_0x4b559f(++_0x1b0856);}(_0x4a90,0x120));var _0x04a9=function(_0x3ac7b6,_0x4c61cf){_0x3ac7b6=_0x3ac7b6-0x0;var _0x4197b2=_0x4a90[_0x3ac7b6];return _0x4197b2;};'use strict';var Sequelize=require(_0x04a9('0x0'));module['exports']={'name':{'type':Sequelize[_0x04a9('0x1')]},'description':{'type':Sequelize[_0x04a9('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7862097..3864485 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 _0x4a8b=['keys','find','create','catch','update','body','getFields','FreshdeskField','rawAttributes','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','reject','then','destroy','stack','name','index','map','FreshdeskConfiguration','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x1cb366,_0x4406fa){var _0x5b49c6=function(_0x25b987){while(--_0x25b987){_0x1cb366['push'](_0x1cb366['shift']());}};_0x5b49c6(++_0x4406fa);}(_0x4a8b,0x103));var _0xb4a8=function(_0x3bddc9,_0x2a40f0){_0x3bddc9=_0x3bddc9-0x0;var _0x3ac6dc=_0x4a8b[_0x3bddc9];return _0x3ac6dc;};'use strict';var emlformat=require(_0xb4a8('0x0'));var rimraf=require(_0xb4a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb4a8('0x2'));var rp=require(_0xb4a8('0x3'));var moment=require(_0xb4a8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb4a8('0x5'));var util=require(_0xb4a8('0x6'));var path=require(_0xb4a8('0x7'));var sox=require(_0xb4a8('0x8'));var csv=require(_0xb4a8('0x9'));var ejs=require(_0xb4a8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb4a8('0xb'));var squel=require(_0xb4a8('0xc'));var crypto=require(_0xb4a8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb4a8('0xe'));var toCsv=require(_0xb4a8('0x9'));var querystring=require(_0xb4a8('0xf'));var Papa=require(_0xb4a8('0x10'));var Redis=require('ioredis');var authService=require(_0xb4a8('0x11'));var qs=require(_0xb4a8('0x12'));var as=require(_0xb4a8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4a8('0x14'))(_0xb4a8('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb4a8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28d1c3,_0x47b4b1){_0x47b4b1=_0x47b4b1||0xcc;return function(_0x4f8cff){if(_0x4f8cff){return _0x28d1c3[_0xb4a8('0x17')](_0x47b4b1);}return _0x28d1c3[_0xb4a8('0x18')](_0x47b4b1)[_0xb4a8('0x19')]();};}function respondWithResult(_0x5ee805,_0x4fd49f){_0x4fd49f=_0x4fd49f||0xc8;return function(_0x26a72f){if(_0x26a72f){return _0x5ee805[_0xb4a8('0x18')](_0x4fd49f)[_0xb4a8('0x1a')](_0x26a72f);}};}function respondWithFilteredResult(_0x2ad7da,_0xfc5f0a){return function(_0x2412a3){if(_0x2412a3){var _0x485d49=typeof _0xfc5f0a[_0xb4a8('0x1b')]==='undefined'&&typeof _0xfc5f0a[_0xb4a8('0x1c')]==='undefined';var _0x2338d0=_0x2412a3[_0xb4a8('0x1d')];var _0x2e2ecc=_0x485d49?0x0:_0xfc5f0a[_0xb4a8('0x1b')];var _0x44c1e9=_0x485d49?_0x2412a3['count']:_0xfc5f0a[_0xb4a8('0x1b')]+_0xfc5f0a['limit'];var _0x4e9f02;if(_0x44c1e9>=_0x2338d0){_0x44c1e9=_0x2338d0;_0x4e9f02=0xc8;}else{_0x4e9f02=0xce;}_0x2ad7da['status'](_0x4e9f02);return _0x2ad7da[_0xb4a8('0x1e')]('Content-Range',_0x2e2ecc+'-'+_0x44c1e9+'/'+_0x2338d0)['json'](_0x2412a3);}return null;};}function patchUpdates(_0x208e28){return function(_0x5666bd){try{jsonpatch[_0xb4a8('0x1f')](_0x5666bd,_0x208e28,!![]);}catch(_0x106a46){return BPromise[_0xb4a8('0x20')](_0x106a46);}return _0x5666bd['save']();};}function saveUpdates(_0x427364,_0x1a5713){return function(_0x22e2fc){if(_0x22e2fc){return _0x22e2fc['update'](_0x427364)[_0xb4a8('0x21')](function(_0x57ee2b){return _0x57ee2b;});}return null;};}function removeEntity(_0x141d8f,_0x362899){return function(_0x3f02f4){if(_0x3f02f4){return _0x3f02f4[_0xb4a8('0x22')]()[_0xb4a8('0x21')](function(){_0x141d8f['status'](0xcc)[_0xb4a8('0x19')]();});}};}function handleEntityNotFound(_0x420329,_0x1a756d){return function(_0x506ce2){if(!_0x506ce2){_0x420329[_0xb4a8('0x17')](0x194);}return _0x506ce2;};}function handleError(_0x53f3d0,_0x4b10e9){_0x4b10e9=_0x4b10e9||0x1f4;return function(_0x56fb86){logger['error'](_0x56fb86[_0xb4a8('0x23')]);if(_0x56fb86[_0xb4a8('0x24')]){delete _0x56fb86[_0xb4a8('0x24')];}_0x53f3d0[_0xb4a8('0x18')](_0x4b10e9)['send'](_0x56fb86);};}exports[_0xb4a8('0x25')]=function(_0x3e6be2,_0x256b3d){var _0x4d7853={},_0x1355f7={},_0x671ed9={'count':0x0,'rows':[]};var _0x2a22c2=_[_0xb4a8('0x26')](db[_0xb4a8('0x27')]['rawAttributes'],function(_0x6fbf7c){return{'name':_0x6fbf7c[_0xb4a8('0x28')],'type':_0x6fbf7c['type'][_0xb4a8('0x29')]};});_0x1355f7[_0xb4a8('0x2a')]=_[_0xb4a8('0x26')](_0x2a22c2,_0xb4a8('0x24'));_0x1355f7['query']=_['keys'](_0x3e6be2[_0xb4a8('0x2b')]);_0x1355f7['filters']=_[_0xb4a8('0x2c')](_0x1355f7['model'],_0x1355f7[_0xb4a8('0x2b')]);_0x4d7853[_0xb4a8('0x2d')]=_['intersection'](_0x1355f7[_0xb4a8('0x2a')],qs[_0xb4a8('0x2e')](_0x3e6be2[_0xb4a8('0x2b')][_0xb4a8('0x2e')]));_0x4d7853[_0xb4a8('0x2d')]=_0x4d7853[_0xb4a8('0x2d')][_0xb4a8('0x2f')]?_0x4d7853['attributes']:_0x1355f7['model'];if(!_0x3e6be2['query'][_0xb4a8('0x30')](_0xb4a8('0x31'))){_0x4d7853[_0xb4a8('0x1c')]=qs[_0xb4a8('0x1c')](_0x3e6be2[_0xb4a8('0x2b')]['limit']);_0x4d7853['offset']=qs['offset'](_0x3e6be2['query'][_0xb4a8('0x1b')]);}_0x4d7853[_0xb4a8('0x32')]=qs[_0xb4a8('0x33')](_0x3e6be2[_0xb4a8('0x2b')][_0xb4a8('0x33')]);_0x4d7853[_0xb4a8('0x34')]=qs[_0xb4a8('0x35')](_[_0xb4a8('0x36')](_0x3e6be2['query'],_0x1355f7[_0xb4a8('0x35')]),_0x2a22c2);if(_0x3e6be2[_0xb4a8('0x2b')][_0xb4a8('0x37')]){_0x4d7853[_0xb4a8('0x34')]=_[_0xb4a8('0x38')](_0x4d7853[_0xb4a8('0x34')],{'$or':_[_0xb4a8('0x26')](_0x2a22c2,function(_0x313177){if(_0x313177[_0xb4a8('0x39')]!==_0xb4a8('0x3a')){var _0x58da22={};_0x58da22[_0x313177['name']]={'$like':'%'+_0x3e6be2[_0xb4a8('0x2b')]['filter']+'%'};return _0x58da22;}})});}_0x4d7853=_[_0xb4a8('0x38')]({},_0x4d7853,_0x3e6be2[_0xb4a8('0x3b')]);var _0xed2a42={'where':_0x4d7853[_0xb4a8('0x34')]};return db[_0xb4a8('0x27')][_0xb4a8('0x1d')](_0xed2a42)[_0xb4a8('0x21')](function(_0x31478d){_0x671ed9[_0xb4a8('0x1d')]=_0x31478d;if(_0x3e6be2[_0xb4a8('0x2b')][_0xb4a8('0x3c')]){_0x4d7853[_0xb4a8('0x3d')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xb4a8('0x3e')](_0x4d7853);})[_0xb4a8('0x21')](function(_0x188cbb){_0x671ed9[_0xb4a8('0x3f')]=_0x188cbb;return _0x671ed9;})['then'](respondWithFilteredResult(_0x256b3d,_0x4d7853))['catch'](handleError(_0x256b3d,null));};exports['show']=function(_0x41f3cd,_0xa1b316){var _0x1f05fb={'raw':![],'where':{'id':_0x41f3cd[_0xb4a8('0x40')]['id']}},_0x4d28e0={};_0x4d28e0[_0xb4a8('0x2a')]=_[_0xb4a8('0x41')](db[_0xb4a8('0x27')]['rawAttributes']);_0x4d28e0[_0xb4a8('0x2b')]=_[_0xb4a8('0x41')](_0x41f3cd[_0xb4a8('0x2b')]);_0x4d28e0['filters']=_[_0xb4a8('0x2c')](_0x4d28e0[_0xb4a8('0x2a')],_0x4d28e0[_0xb4a8('0x2b')]);_0x1f05fb[_0xb4a8('0x2d')]=_[_0xb4a8('0x2c')](_0x4d28e0[_0xb4a8('0x2a')],qs[_0xb4a8('0x2e')](_0x41f3cd['query']['fields']));_0x1f05fb['attributes']=_0x1f05fb[_0xb4a8('0x2d')][_0xb4a8('0x2f')]?_0x1f05fb['attributes']:_0x4d28e0[_0xb4a8('0x2a')];if(_0x41f3cd[_0xb4a8('0x2b')][_0xb4a8('0x3c')]){_0x1f05fb[_0xb4a8('0x3d')]=[{'all':!![]}];}_0x1f05fb=_[_0xb4a8('0x38')]({},_0x1f05fb,_0x41f3cd[_0xb4a8('0x3b')]);return db['FreshdeskConfiguration'][_0xb4a8('0x42')](_0x1f05fb)[_0xb4a8('0x21')](handleEntityNotFound(_0xa1b316,null))['then'](respondWithResult(_0xa1b316,null))['catch'](handleError(_0xa1b316,null));};exports[_0xb4a8('0x43')]=function(_0xfb981c,_0x17511b){return db[_0xb4a8('0x27')][_0xb4a8('0x43')](_0xfb981c['body'],{})[_0xb4a8('0x21')](respondWithResult(_0x17511b,0xc9))[_0xb4a8('0x44')](handleError(_0x17511b,null));};exports[_0xb4a8('0x45')]=function(_0x3986b9,_0x34d941){if(_0x3986b9[_0xb4a8('0x46')]['id']){delete _0x3986b9[_0xb4a8('0x46')]['id'];}return db[_0xb4a8('0x27')][_0xb4a8('0x42')]({'where':{'id':_0x3986b9['params']['id']}})[_0xb4a8('0x21')](handleEntityNotFound(_0x34d941,null))[_0xb4a8('0x21')](saveUpdates(_0x3986b9[_0xb4a8('0x46')],null))[_0xb4a8('0x21')](respondWithResult(_0x34d941,null))[_0xb4a8('0x44')](handleError(_0x34d941,null));};exports['destroy']=function(_0x56aa9f,_0x19ba05){return db[_0xb4a8('0x27')][_0xb4a8('0x42')]({'where':{'id':_0x56aa9f[_0xb4a8('0x40')]['id']}})[_0xb4a8('0x21')](handleEntityNotFound(_0x19ba05,null))['then'](removeEntity(_0x19ba05,null))[_0xb4a8('0x44')](handleError(_0x19ba05,null));};exports[_0xb4a8('0x47')]=function(_0x58a2b0,_0x27692f,_0x41a71a){var _0x2ed280={};var _0x354d48={};var _0x235514;var _0x3384df;return db[_0xb4a8('0x27')]['findOne']({'where':{'id':_0x58a2b0[_0xb4a8('0x40')]['id']}})['then'](handleEntityNotFound(_0x27692f,null))['then'](function(_0x29061f){if(_0x29061f){_0x235514=_0x29061f;_0x354d48[_0xb4a8('0x2a')]=_['keys'](db[_0xb4a8('0x48')][_0xb4a8('0x49')]);_0x354d48[_0xb4a8('0x2b')]=_[_0xb4a8('0x41')](_0x58a2b0['query']);_0x354d48[_0xb4a8('0x35')]=_[_0xb4a8('0x2c')](_0x354d48['model'],_0x354d48['query']);_0x2ed280[_0xb4a8('0x2d')]=_[_0xb4a8('0x2c')](_0x354d48[_0xb4a8('0x2a')],qs['fields'](_0x58a2b0[_0xb4a8('0x2b')]['fields']));_0x2ed280[_0xb4a8('0x2d')]=_0x2ed280[_0xb4a8('0x2d')]['length']?_0x2ed280[_0xb4a8('0x2d')]:_0x354d48['model'];_0x2ed280[_0xb4a8('0x32')]=qs[_0xb4a8('0x33')](_0x58a2b0[_0xb4a8('0x2b')][_0xb4a8('0x33')]);_0x2ed280[_0xb4a8('0x34')]=qs[_0xb4a8('0x35')](_[_0xb4a8('0x36')](_0x58a2b0[_0xb4a8('0x2b')],_0x354d48[_0xb4a8('0x35')]));if(_0x58a2b0['query'][_0xb4a8('0x37')]){_0x2ed280['where']=_[_0xb4a8('0x38')](_0x2ed280['where'],{'$or':_[_0xb4a8('0x26')](_0x2ed280['attributes'],function(_0x3c4ca2){var _0x5b003c={};_0x5b003c[_0x3c4ca2]={'$like':'%'+_0x58a2b0[_0xb4a8('0x2b')][_0xb4a8('0x37')]+'%'};return _0x5b003c;})});}_0x2ed280=_[_0xb4a8('0x38')]({},_0x2ed280,_0x58a2b0[_0xb4a8('0x3b')]);return _0x235514['getFields'](_0x2ed280);}})['then'](function(_0x1ebc1f){if(_0x1ebc1f){_0x3384df=_0x1ebc1f[_0xb4a8('0x2f')];if(!_0x58a2b0[_0xb4a8('0x2b')]['hasOwnProperty'](_0xb4a8('0x31'))){_0x2ed280[_0xb4a8('0x1c')]=qs[_0xb4a8('0x1c')](_0x58a2b0[_0xb4a8('0x2b')][_0xb4a8('0x1c')]);_0x2ed280[_0xb4a8('0x1b')]=qs[_0xb4a8('0x1b')](_0x58a2b0[_0xb4a8('0x2b')][_0xb4a8('0x1b')]);}return _0x235514[_0xb4a8('0x47')](_0x2ed280);}})[_0xb4a8('0x21')](function(_0x572a0b){if(_0x572a0b){return _0x572a0b?{'count':_0x3384df,'rows':_0x572a0b}:null;}})[_0xb4a8('0x21')](respondWithResult(_0x27692f,null))[_0xb4a8('0x44')](handleError(_0x27692f,null));};exports[_0xb4a8('0x4a')]=function(_0x3acf2b,_0x3cd826,_0x7f4a3d){var _0x482c93={};var _0x27294b={};var _0x58d1f2;var _0x406677;return db['FreshdeskConfiguration'][_0xb4a8('0x4b')]({'where':{'id':_0x3acf2b[_0xb4a8('0x40')]['id']}})[_0xb4a8('0x21')](handleEntityNotFound(_0x3cd826,null))[_0xb4a8('0x21')](function(_0x147a61){if(_0x147a61){_0x58d1f2=_0x147a61;_0x27294b[_0xb4a8('0x2a')]=_[_0xb4a8('0x41')](db[_0xb4a8('0x48')][_0xb4a8('0x49')]);_0x27294b[_0xb4a8('0x2b')]=_[_0xb4a8('0x41')](_0x3acf2b['query']);_0x27294b[_0xb4a8('0x35')]=_['intersection'](_0x27294b[_0xb4a8('0x2a')],_0x27294b[_0xb4a8('0x2b')]);_0x482c93['attributes']=_[_0xb4a8('0x2c')](_0x27294b[_0xb4a8('0x2a')],qs['fields'](_0x3acf2b[_0xb4a8('0x2b')][_0xb4a8('0x2e')]));_0x482c93[_0xb4a8('0x2d')]=_0x482c93[_0xb4a8('0x2d')][_0xb4a8('0x2f')]?_0x482c93['attributes']:_0x27294b[_0xb4a8('0x2a')];_0x482c93['order']=qs['sort'](_0x3acf2b['query'][_0xb4a8('0x33')]);_0x482c93[_0xb4a8('0x34')]=qs[_0xb4a8('0x35')](_[_0xb4a8('0x36')](_0x3acf2b[_0xb4a8('0x2b')],_0x27294b[_0xb4a8('0x35')]));if(_0x3acf2b[_0xb4a8('0x2b')][_0xb4a8('0x37')]){_0x482c93['where']=_[_0xb4a8('0x38')](_0x482c93['where'],{'$or':_[_0xb4a8('0x26')](_0x482c93['attributes'],function(_0x581541){var _0x3e2ebb={};_0x3e2ebb[_0x581541]={'$like':'%'+_0x3acf2b[_0xb4a8('0x2b')][_0xb4a8('0x37')]+'%'};return _0x3e2ebb;})});}_0x482c93=_[_0xb4a8('0x38')]({},_0x482c93,_0x3acf2b[_0xb4a8('0x3b')]);return _0x58d1f2['getSubjects'](_0x482c93);}})[_0xb4a8('0x21')](function(_0x474812){if(_0x474812){_0x406677=_0x474812[_0xb4a8('0x2f')];if(!_0x3acf2b[_0xb4a8('0x2b')][_0xb4a8('0x30')](_0xb4a8('0x31'))){_0x482c93[_0xb4a8('0x1c')]=qs[_0xb4a8('0x1c')](_0x3acf2b[_0xb4a8('0x2b')]['limit']);_0x482c93[_0xb4a8('0x1b')]=qs['offset'](_0x3acf2b[_0xb4a8('0x2b')][_0xb4a8('0x1b')]);}return _0x58d1f2['getSubjects'](_0x482c93);}})[_0xb4a8('0x21')](function(_0x293975){if(_0x293975){return _0x293975?{'count':_0x406677,'rows':_0x293975}:null;}})[_0xb4a8('0x21')](respondWithResult(_0x3cd826,null))[_0xb4a8('0x44')](handleError(_0x3cd826,null));};exports[_0xb4a8('0x4c')]=function(_0x2985f1,_0x5cca4c,_0x171462){var _0x4f61a1={};var _0xbefc18={};var _0xc851be;var _0xf024ba;return db[_0xb4a8('0x27')][_0xb4a8('0x4b')]({'where':{'id':_0x2985f1[_0xb4a8('0x40')]['id']}})[_0xb4a8('0x21')](handleEntityNotFound(_0x5cca4c,null))[_0xb4a8('0x21')](function(_0x1d027c){if(_0x1d027c){_0xc851be=_0x1d027c;_0xbefc18[_0xb4a8('0x2a')]=_['keys'](db[_0xb4a8('0x48')][_0xb4a8('0x49')]);_0xbefc18[_0xb4a8('0x2b')]=_[_0xb4a8('0x41')](_0x2985f1['query']);_0xbefc18[_0xb4a8('0x35')]=_[_0xb4a8('0x2c')](_0xbefc18[_0xb4a8('0x2a')],_0xbefc18[_0xb4a8('0x2b')]);_0x4f61a1['attributes']=_[_0xb4a8('0x2c')](_0xbefc18['model'],qs['fields'](_0x2985f1['query']['fields']));_0x4f61a1[_0xb4a8('0x2d')]=_0x4f61a1[_0xb4a8('0x2d')][_0xb4a8('0x2f')]?_0x4f61a1[_0xb4a8('0x2d')]:_0xbefc18[_0xb4a8('0x2a')];_0x4f61a1[_0xb4a8('0x32')]=qs[_0xb4a8('0x33')](_0x2985f1[_0xb4a8('0x2b')]['sort']);_0x4f61a1[_0xb4a8('0x34')]=qs['filters'](_[_0xb4a8('0x36')](_0x2985f1[_0xb4a8('0x2b')],_0xbefc18[_0xb4a8('0x35')]));if(_0x2985f1['query']['filter']){_0x4f61a1[_0xb4a8('0x34')]=_['merge'](_0x4f61a1[_0xb4a8('0x34')],{'$or':_[_0xb4a8('0x26')](_0x4f61a1[_0xb4a8('0x2d')],function(_0x3e0366){var _0x1691cc={};_0x1691cc[_0x3e0366]={'$like':'%'+_0x2985f1[_0xb4a8('0x2b')][_0xb4a8('0x37')]+'%'};return _0x1691cc;})});}_0x4f61a1=_['merge']({},_0x4f61a1,_0x2985f1[_0xb4a8('0x3b')]);return _0xc851be['getDescriptions'](_0x4f61a1);}})[_0xb4a8('0x21')](function(_0x3a1385){if(_0x3a1385){_0xf024ba=_0x3a1385[_0xb4a8('0x2f')];if(!_0x2985f1[_0xb4a8('0x2b')]['hasOwnProperty'](_0xb4a8('0x31'))){_0x4f61a1[_0xb4a8('0x1c')]=qs[_0xb4a8('0x1c')](_0x2985f1[_0xb4a8('0x2b')][_0xb4a8('0x1c')]);_0x4f61a1[_0xb4a8('0x1b')]=qs[_0xb4a8('0x1b')](_0x2985f1[_0xb4a8('0x2b')][_0xb4a8('0x1b')]);}return _0xc851be['getDescriptions'](_0x4f61a1);}})[_0xb4a8('0x21')](function(_0x2d6448){if(_0x2d6448){return _0x2d6448?{'count':_0xf024ba,'rows':_0x2d6448}:null;}})['then'](respondWithResult(_0x5cca4c,null))[_0xb4a8('0x44')](handleError(_0x5cca4c,null));};exports[_0xb4a8('0x4d')]=function(_0x3a286d,_0xc0881d,_0x3a8a44){var _0x36a7eb={};var _0x54e8da={};var _0x340751;var _0x45c122;return db['FreshdeskConfiguration'][_0xb4a8('0x4b')]({'where':{'id':_0x3a286d['params']['id']}})[_0xb4a8('0x21')](handleEntityNotFound(_0xc0881d,null))['then'](function(_0x435718){if(_0x435718){_0x340751=_0x435718;_0x54e8da[_0xb4a8('0x2a')]=_[_0xb4a8('0x41')](db[_0xb4a8('0x4e')]['rawAttributes']);_0x54e8da[_0xb4a8('0x2b')]=_['keys'](_0x3a286d[_0xb4a8('0x2b')]);_0x54e8da['filters']=_[_0xb4a8('0x2c')](_0x54e8da[_0xb4a8('0x2a')],_0x54e8da['query']);_0x36a7eb[_0xb4a8('0x2d')]=_[_0xb4a8('0x2c')](_0x54e8da[_0xb4a8('0x2a')],qs[_0xb4a8('0x2e')](_0x3a286d[_0xb4a8('0x2b')]['fields']));_0x36a7eb[_0xb4a8('0x2d')]=_0x36a7eb[_0xb4a8('0x2d')]['length']?_0x36a7eb['attributes']:_0x54e8da[_0xb4a8('0x2a')];_0x36a7eb[_0xb4a8('0x32')]=qs[_0xb4a8('0x33')](_0x3a286d[_0xb4a8('0x2b')][_0xb4a8('0x33')]);_0x36a7eb[_0xb4a8('0x34')]=qs[_0xb4a8('0x35')](_[_0xb4a8('0x36')](_0x3a286d[_0xb4a8('0x2b')],_0x54e8da[_0xb4a8('0x35')]));if(_0x3a286d['query'][_0xb4a8('0x37')]){_0x36a7eb[_0xb4a8('0x34')]=_[_0xb4a8('0x38')](_0x36a7eb[_0xb4a8('0x34')],{'$or':_[_0xb4a8('0x26')](_0x36a7eb['attributes'],function(_0x48df91){var _0xe9874d={};_0xe9874d[_0x48df91]={'$like':'%'+_0x3a286d[_0xb4a8('0x2b')][_0xb4a8('0x37')]+'%'};return _0xe9874d;})});}_0x36a7eb=_['merge']({},_0x36a7eb,_0x3a286d[_0xb4a8('0x3b')]);return _0x340751[_0xb4a8('0x4d')](_0x36a7eb);}})[_0xb4a8('0x21')](function(_0x45427a){if(_0x45427a){_0x45c122=_0x45427a[_0xb4a8('0x2f')];if(!_0x3a286d[_0xb4a8('0x2b')]['hasOwnProperty'](_0xb4a8('0x31'))){_0x36a7eb[_0xb4a8('0x1c')]=qs['limit'](_0x3a286d['query'][_0xb4a8('0x1c')]);_0x36a7eb[_0xb4a8('0x1b')]=qs[_0xb4a8('0x1b')](_0x3a286d['query'][_0xb4a8('0x1b')]);}return _0x340751['getTags'](_0x36a7eb);}})[_0xb4a8('0x21')](function(_0x5286a3){if(_0x5286a3){return _0x5286a3?{'count':_0x45c122,'rows':_0x5286a3}:null;}})[_0xb4a8('0x21')](respondWithResult(_0xc0881d,null))[_0xb4a8('0x44')](handleError(_0xc0881d,null));};exports[_0xb4a8('0x4f')]=function(_0x530ce5,_0x23af41,_0x3c6540){if(_0x530ce5[_0xb4a8('0x46')]['id']){delete _0x530ce5[_0xb4a8('0x46')]['id'];}return db[_0xb4a8('0x27')][_0xb4a8('0x4b')]({'where':{'id':_0x530ce5[_0xb4a8('0x40')]['id']}})[_0xb4a8('0x21')](handleEntityNotFound(_0x23af41,null))[_0xb4a8('0x21')](function(_0x5e3503){if(_0x5e3503){return _0x5e3503[_0xb4a8('0x4f')](_0x530ce5[_0xb4a8('0x46')][_0xb4a8('0x50')]||[]);}return null;})['then'](respondWithResult(_0x23af41,null))[_0xb4a8('0x44')](handleError(_0x23af41,null));}; \ No newline at end of file +var _0x0ccf=['bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2f8f0c,_0x3b7d3f){var _0x307c19=function(_0x49161b){while(--_0x49161b){_0x2f8f0c['push'](_0x2f8f0c['shift']());}};_0x307c19(++_0x3b7d3f);}(_0x0ccf,0xa2));var _0xf0cc=function(_0x16a0c2,_0x1a57f6){_0x16a0c2=_0x16a0c2-0x0;var _0x48808c=_0x0ccf[_0x16a0c2];return _0x48808c;};'use strict';var emlformat=require(_0xf0cc('0x0'));var rimraf=require(_0xf0cc('0x1'));var zipdir=require(_0xf0cc('0x2'));var jsonpatch=require(_0xf0cc('0x3'));var rp=require(_0xf0cc('0x4'));var moment=require(_0xf0cc('0x5'));var BPromise=require(_0xf0cc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf0cc('0x7'));var sox=require(_0xf0cc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0cc('0x9'));var _=require(_0xf0cc('0xa'));var squel=require(_0xf0cc('0xb'));var crypto=require(_0xf0cc('0xc'));var jsforce=require(_0xf0cc('0xd'));var deskjs=require(_0xf0cc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf0cc('0xf'));var Papa=require(_0xf0cc('0x10'));var Redis=require(_0xf0cc('0x11'));var authService=require(_0xf0cc('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0cc('0x13'))(_0xf0cc('0x14'));var utils=require(_0xf0cc('0x15'));var config=require(_0xf0cc('0x16'));var licenseUtil=require(_0xf0cc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x165a0b,_0xf77d9e){_0xf77d9e=_0xf77d9e||0xcc;return function(_0x50720a){if(_0x50720a){return _0x165a0b[_0xf0cc('0x18')](_0xf77d9e);}return _0x165a0b[_0xf0cc('0x19')](_0xf77d9e)[_0xf0cc('0x1a')]();};}function respondWithResult(_0x8a8346,_0x464240){_0x464240=_0x464240||0xc8;return function(_0x3b576b){if(_0x3b576b){return _0x8a8346[_0xf0cc('0x19')](_0x464240)[_0xf0cc('0x1b')](_0x3b576b);}};}function respondWithFilteredResult(_0x2def47,_0x25b570){return function(_0x46e468){if(_0x46e468){var _0xa848f4=typeof _0x25b570['offset']==='undefined'&&typeof _0x25b570[_0xf0cc('0x1c')]===_0xf0cc('0x1d');var _0x4e1d80=_0x46e468[_0xf0cc('0x1e')];var _0x4a4893=_0xa848f4?0x0:_0x25b570[_0xf0cc('0x1f')];var _0x342a77=_0xa848f4?_0x46e468[_0xf0cc('0x1e')]:_0x25b570['offset']+_0x25b570[_0xf0cc('0x1c')];var _0x17c501;if(_0x342a77>=_0x4e1d80){_0x342a77=_0x4e1d80;_0x17c501=0xc8;}else{_0x17c501=0xce;}_0x2def47['status'](_0x17c501);return _0x2def47[_0xf0cc('0x20')](_0xf0cc('0x21'),_0x4a4893+'-'+_0x342a77+'/'+_0x4e1d80)[_0xf0cc('0x1b')](_0x46e468);}return null;};}function patchUpdates(_0x4c9ea4){return function(_0x5467e1){try{jsonpatch[_0xf0cc('0x22')](_0x5467e1,_0x4c9ea4,!![]);}catch(_0x11b8b2){return BPromise[_0xf0cc('0x23')](_0x11b8b2);}return _0x5467e1[_0xf0cc('0x24')]();};}function saveUpdates(_0x41a218,_0x533b9d){return function(_0xc3e925){if(_0xc3e925){return _0xc3e925[_0xf0cc('0x25')](_0x41a218)[_0xf0cc('0x26')](function(_0x57e007){return _0x57e007;});}return null;};}function removeEntity(_0x323672,_0x2be269){return function(_0x42c40b){if(_0x42c40b){return _0x42c40b[_0xf0cc('0x27')]()['then'](function(){_0x323672[_0xf0cc('0x19')](0xcc)[_0xf0cc('0x1a')]();});}};}function handleEntityNotFound(_0x78eecb,_0x543d1e){return function(_0x49779f){if(!_0x49779f){_0x78eecb[_0xf0cc('0x18')](0x194);}return _0x49779f;};}function handleError(_0x565e8f,_0x3f0052){_0x3f0052=_0x3f0052||0x1f4;return function(_0xa86921){logger['error'](_0xa86921[_0xf0cc('0x28')]);if(_0xa86921[_0xf0cc('0x29')]){delete _0xa86921[_0xf0cc('0x29')];}_0x565e8f[_0xf0cc('0x19')](_0x3f0052)['send'](_0xa86921);};}exports['index']=function(_0x98665,_0x514a3e){var _0x54a3e7={},_0x168d80={},_0x25e305={'count':0x0,'rows':[]};var _0x40956c=_[_0xf0cc('0x2a')](db[_0xf0cc('0x2b')][_0xf0cc('0x2c')],function(_0x16ee4d){return{'name':_0x16ee4d[_0xf0cc('0x2d')],'type':_0x16ee4d[_0xf0cc('0x2e')][_0xf0cc('0x2f')]};});_0x168d80[_0xf0cc('0x30')]=_[_0xf0cc('0x2a')](_0x40956c,_0xf0cc('0x29'));_0x168d80['query']=_[_0xf0cc('0x31')](_0x98665['query']);_0x168d80[_0xf0cc('0x32')]=_[_0xf0cc('0x33')](_0x168d80[_0xf0cc('0x30')],_0x168d80[_0xf0cc('0x34')]);_0x54a3e7[_0xf0cc('0x35')]=_[_0xf0cc('0x33')](_0x168d80['model'],qs[_0xf0cc('0x36')](_0x98665[_0xf0cc('0x34')][_0xf0cc('0x36')]));_0x54a3e7[_0xf0cc('0x35')]=_0x54a3e7[_0xf0cc('0x35')][_0xf0cc('0x37')]?_0x54a3e7[_0xf0cc('0x35')]:_0x168d80['model'];if(!_0x98665[_0xf0cc('0x34')][_0xf0cc('0x38')](_0xf0cc('0x39'))){_0x54a3e7[_0xf0cc('0x1c')]=qs[_0xf0cc('0x1c')](_0x98665[_0xf0cc('0x34')][_0xf0cc('0x1c')]);_0x54a3e7[_0xf0cc('0x1f')]=qs[_0xf0cc('0x1f')](_0x98665[_0xf0cc('0x34')][_0xf0cc('0x1f')]);}_0x54a3e7[_0xf0cc('0x3a')]=qs[_0xf0cc('0x3b')](_0x98665['query'][_0xf0cc('0x3b')]);_0x54a3e7[_0xf0cc('0x3c')]=qs[_0xf0cc('0x32')](_[_0xf0cc('0x3d')](_0x98665[_0xf0cc('0x34')],_0x168d80[_0xf0cc('0x32')]),_0x40956c);if(_0x98665['query'][_0xf0cc('0x3e')]){_0x54a3e7[_0xf0cc('0x3c')]=_[_0xf0cc('0x3f')](_0x54a3e7[_0xf0cc('0x3c')],{'$or':_[_0xf0cc('0x2a')](_0x40956c,function(_0x273d11){if(_0x273d11[_0xf0cc('0x2e')]!==_0xf0cc('0x40')){var _0x5d165b={};_0x5d165b[_0x273d11[_0xf0cc('0x29')]]={'$like':'%'+_0x98665[_0xf0cc('0x34')]['filter']+'%'};return _0x5d165b;}})});}_0x54a3e7=_[_0xf0cc('0x3f')]({},_0x54a3e7,_0x98665[_0xf0cc('0x41')]);var _0x3fee7d={'where':_0x54a3e7[_0xf0cc('0x3c')]};return db[_0xf0cc('0x2b')][_0xf0cc('0x1e')](_0x3fee7d)[_0xf0cc('0x26')](function(_0x5a22aa){_0x25e305[_0xf0cc('0x1e')]=_0x5a22aa;if(_0x98665[_0xf0cc('0x34')]['includeAll']){_0x54a3e7[_0xf0cc('0x42')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xf0cc('0x43')](_0x54a3e7);})[_0xf0cc('0x26')](function(_0x48caf6){_0x25e305['rows']=_0x48caf6;return _0x25e305;})['then'](respondWithFilteredResult(_0x514a3e,_0x54a3e7))[_0xf0cc('0x44')](handleError(_0x514a3e,null));};exports[_0xf0cc('0x45')]=function(_0x187651,_0x5e6d13){var _0x39799d={'raw':![],'where':{'id':_0x187651[_0xf0cc('0x46')]['id']}},_0x2541ad={};_0x2541ad[_0xf0cc('0x30')]=_[_0xf0cc('0x31')](db[_0xf0cc('0x2b')][_0xf0cc('0x2c')]);_0x2541ad[_0xf0cc('0x34')]=_[_0xf0cc('0x31')](_0x187651[_0xf0cc('0x34')]);_0x2541ad[_0xf0cc('0x32')]=_[_0xf0cc('0x33')](_0x2541ad[_0xf0cc('0x30')],_0x2541ad['query']);_0x39799d[_0xf0cc('0x35')]=_[_0xf0cc('0x33')](_0x2541ad['model'],qs[_0xf0cc('0x36')](_0x187651[_0xf0cc('0x34')][_0xf0cc('0x36')]));_0x39799d[_0xf0cc('0x35')]=_0x39799d[_0xf0cc('0x35')]['length']?_0x39799d['attributes']:_0x2541ad[_0xf0cc('0x30')];if(_0x187651['query'][_0xf0cc('0x47')]){_0x39799d[_0xf0cc('0x42')]=[{'all':!![]}];}_0x39799d=_[_0xf0cc('0x3f')]({},_0x39799d,_0x187651[_0xf0cc('0x41')]);return db[_0xf0cc('0x2b')][_0xf0cc('0x48')](_0x39799d)[_0xf0cc('0x26')](handleEntityNotFound(_0x5e6d13,null))['then'](respondWithResult(_0x5e6d13,null))[_0xf0cc('0x44')](handleError(_0x5e6d13,null));};exports[_0xf0cc('0x49')]=function(_0x54a43f,_0x1f4236){return db[_0xf0cc('0x2b')][_0xf0cc('0x49')](_0x54a43f[_0xf0cc('0x4a')],{})[_0xf0cc('0x26')](respondWithResult(_0x1f4236,0xc9))[_0xf0cc('0x44')](handleError(_0x1f4236,null));};exports[_0xf0cc('0x25')]=function(_0x4ee684,_0x44875b){if(_0x4ee684[_0xf0cc('0x4a')]['id']){delete _0x4ee684[_0xf0cc('0x4a')]['id'];}return db[_0xf0cc('0x2b')][_0xf0cc('0x48')]({'where':{'id':_0x4ee684[_0xf0cc('0x46')]['id']}})[_0xf0cc('0x26')](handleEntityNotFound(_0x44875b,null))['then'](saveUpdates(_0x4ee684[_0xf0cc('0x4a')],null))[_0xf0cc('0x26')](respondWithResult(_0x44875b,null))[_0xf0cc('0x44')](handleError(_0x44875b,null));};exports['destroy']=function(_0x369ce8,_0x2b7ecc){return db[_0xf0cc('0x2b')][_0xf0cc('0x48')]({'where':{'id':_0x369ce8[_0xf0cc('0x46')]['id']}})[_0xf0cc('0x26')](handleEntityNotFound(_0x2b7ecc,null))[_0xf0cc('0x26')](removeEntity(_0x2b7ecc,null))['catch'](handleError(_0x2b7ecc,null));};exports['getFields']=function(_0x7a35fa,_0x1726d2,_0x1d71ac){var _0x189f39={};var _0x407a75={};var _0x2f3a85;var _0x13d14b;return db[_0xf0cc('0x2b')][_0xf0cc('0x4b')]({'where':{'id':_0x7a35fa['params']['id']}})[_0xf0cc('0x26')](handleEntityNotFound(_0x1726d2,null))[_0xf0cc('0x26')](function(_0x3111c8){if(_0x3111c8){_0x2f3a85=_0x3111c8;_0x407a75[_0xf0cc('0x30')]=_[_0xf0cc('0x31')](db[_0xf0cc('0x4c')]['rawAttributes']);_0x407a75[_0xf0cc('0x34')]=_[_0xf0cc('0x31')](_0x7a35fa[_0xf0cc('0x34')]);_0x407a75[_0xf0cc('0x32')]=_[_0xf0cc('0x33')](_0x407a75[_0xf0cc('0x30')],_0x407a75['query']);_0x189f39[_0xf0cc('0x35')]=_[_0xf0cc('0x33')](_0x407a75[_0xf0cc('0x30')],qs[_0xf0cc('0x36')](_0x7a35fa[_0xf0cc('0x34')][_0xf0cc('0x36')]));_0x189f39[_0xf0cc('0x35')]=_0x189f39[_0xf0cc('0x35')][_0xf0cc('0x37')]?_0x189f39['attributes']:_0x407a75[_0xf0cc('0x30')];_0x189f39[_0xf0cc('0x3a')]=qs[_0xf0cc('0x3b')](_0x7a35fa['query']['sort']);_0x189f39['where']=qs['filters'](_[_0xf0cc('0x3d')](_0x7a35fa[_0xf0cc('0x34')],_0x407a75['filters']));if(_0x7a35fa[_0xf0cc('0x34')][_0xf0cc('0x3e')]){_0x189f39[_0xf0cc('0x3c')]=_['merge'](_0x189f39['where'],{'$or':_[_0xf0cc('0x2a')](_0x189f39[_0xf0cc('0x35')],function(_0x54ed9b){var _0x416132={};_0x416132[_0x54ed9b]={'$like':'%'+_0x7a35fa[_0xf0cc('0x34')]['filter']+'%'};return _0x416132;})});}_0x189f39=_[_0xf0cc('0x3f')]({},_0x189f39,_0x7a35fa[_0xf0cc('0x41')]);return _0x2f3a85[_0xf0cc('0x4d')](_0x189f39);}})['then'](function(_0x5abd0a){if(_0x5abd0a){_0x13d14b=_0x5abd0a[_0xf0cc('0x37')];if(!_0x7a35fa[_0xf0cc('0x34')][_0xf0cc('0x38')](_0xf0cc('0x39'))){_0x189f39['limit']=qs[_0xf0cc('0x1c')](_0x7a35fa['query']['limit']);_0x189f39[_0xf0cc('0x1f')]=qs[_0xf0cc('0x1f')](_0x7a35fa[_0xf0cc('0x34')]['offset']);}return _0x2f3a85[_0xf0cc('0x4d')](_0x189f39);}})['then'](function(_0x1ad9a6){if(_0x1ad9a6){return _0x1ad9a6?{'count':_0x13d14b,'rows':_0x1ad9a6}:null;}})[_0xf0cc('0x26')](respondWithResult(_0x1726d2,null))[_0xf0cc('0x44')](handleError(_0x1726d2,null));};exports[_0xf0cc('0x4e')]=function(_0xcec29e,_0x3e05af,_0x29f8d8){var _0x21b888={};var _0x5d4236={};var _0x3cfdda;var _0x33ccb6;return db[_0xf0cc('0x2b')][_0xf0cc('0x4b')]({'where':{'id':_0xcec29e['params']['id']}})['then'](handleEntityNotFound(_0x3e05af,null))['then'](function(_0x433f0d){if(_0x433f0d){_0x3cfdda=_0x433f0d;_0x5d4236['model']=_[_0xf0cc('0x31')](db['FreshdeskField'][_0xf0cc('0x2c')]);_0x5d4236['query']=_[_0xf0cc('0x31')](_0xcec29e[_0xf0cc('0x34')]);_0x5d4236[_0xf0cc('0x32')]=_[_0xf0cc('0x33')](_0x5d4236[_0xf0cc('0x30')],_0x5d4236['query']);_0x21b888[_0xf0cc('0x35')]=_[_0xf0cc('0x33')](_0x5d4236['model'],qs['fields'](_0xcec29e[_0xf0cc('0x34')][_0xf0cc('0x36')]));_0x21b888[_0xf0cc('0x35')]=_0x21b888[_0xf0cc('0x35')][_0xf0cc('0x37')]?_0x21b888['attributes']:_0x5d4236[_0xf0cc('0x30')];_0x21b888[_0xf0cc('0x3a')]=qs[_0xf0cc('0x3b')](_0xcec29e[_0xf0cc('0x34')][_0xf0cc('0x3b')]);_0x21b888['where']=qs[_0xf0cc('0x32')](_[_0xf0cc('0x3d')](_0xcec29e['query'],_0x5d4236[_0xf0cc('0x32')]));if(_0xcec29e['query'][_0xf0cc('0x3e')]){_0x21b888['where']=_['merge'](_0x21b888[_0xf0cc('0x3c')],{'$or':_['map'](_0x21b888['attributes'],function(_0x5394dc){var _0x44106f={};_0x44106f[_0x5394dc]={'$like':'%'+_0xcec29e['query']['filter']+'%'};return _0x44106f;})});}_0x21b888=_[_0xf0cc('0x3f')]({},_0x21b888,_0xcec29e['options']);return _0x3cfdda[_0xf0cc('0x4e')](_0x21b888);}})[_0xf0cc('0x26')](function(_0x2256a1){if(_0x2256a1){_0x33ccb6=_0x2256a1['length'];if(!_0xcec29e['query']['hasOwnProperty'](_0xf0cc('0x39'))){_0x21b888[_0xf0cc('0x1c')]=qs['limit'](_0xcec29e[_0xf0cc('0x34')][_0xf0cc('0x1c')]);_0x21b888[_0xf0cc('0x1f')]=qs[_0xf0cc('0x1f')](_0xcec29e[_0xf0cc('0x34')][_0xf0cc('0x1f')]);}return _0x3cfdda[_0xf0cc('0x4e')](_0x21b888);}})[_0xf0cc('0x26')](function(_0x2d2c82){if(_0x2d2c82){return _0x2d2c82?{'count':_0x33ccb6,'rows':_0x2d2c82}:null;}})[_0xf0cc('0x26')](respondWithResult(_0x3e05af,null))[_0xf0cc('0x44')](handleError(_0x3e05af,null));};exports[_0xf0cc('0x4f')]=function(_0x3e2a2a,_0x3b4141,_0x27a4d2){var _0xf30b5c={};var _0x58f0d7={};var _0x2d4ffb;var _0x4c0c8d;return db[_0xf0cc('0x2b')]['findOne']({'where':{'id':_0x3e2a2a[_0xf0cc('0x46')]['id']}})[_0xf0cc('0x26')](handleEntityNotFound(_0x3b4141,null))['then'](function(_0x345f86){if(_0x345f86){_0x2d4ffb=_0x345f86;_0x58f0d7['model']=_['keys'](db[_0xf0cc('0x4c')][_0xf0cc('0x2c')]);_0x58f0d7['query']=_[_0xf0cc('0x31')](_0x3e2a2a[_0xf0cc('0x34')]);_0x58f0d7[_0xf0cc('0x32')]=_[_0xf0cc('0x33')](_0x58f0d7[_0xf0cc('0x30')],_0x58f0d7[_0xf0cc('0x34')]);_0xf30b5c[_0xf0cc('0x35')]=_[_0xf0cc('0x33')](_0x58f0d7[_0xf0cc('0x30')],qs[_0xf0cc('0x36')](_0x3e2a2a[_0xf0cc('0x34')][_0xf0cc('0x36')]));_0xf30b5c[_0xf0cc('0x35')]=_0xf30b5c[_0xf0cc('0x35')][_0xf0cc('0x37')]?_0xf30b5c[_0xf0cc('0x35')]:_0x58f0d7[_0xf0cc('0x30')];_0xf30b5c['order']=qs[_0xf0cc('0x3b')](_0x3e2a2a[_0xf0cc('0x34')][_0xf0cc('0x3b')]);_0xf30b5c['where']=qs[_0xf0cc('0x32')](_[_0xf0cc('0x3d')](_0x3e2a2a['query'],_0x58f0d7[_0xf0cc('0x32')]));if(_0x3e2a2a['query'][_0xf0cc('0x3e')]){_0xf30b5c[_0xf0cc('0x3c')]=_[_0xf0cc('0x3f')](_0xf30b5c[_0xf0cc('0x3c')],{'$or':_[_0xf0cc('0x2a')](_0xf30b5c[_0xf0cc('0x35')],function(_0x433806){var _0x34de50={};_0x34de50[_0x433806]={'$like':'%'+_0x3e2a2a[_0xf0cc('0x34')][_0xf0cc('0x3e')]+'%'};return _0x34de50;})});}_0xf30b5c=_['merge']({},_0xf30b5c,_0x3e2a2a[_0xf0cc('0x41')]);return _0x2d4ffb[_0xf0cc('0x4f')](_0xf30b5c);}})[_0xf0cc('0x26')](function(_0x2573cb){if(_0x2573cb){_0x4c0c8d=_0x2573cb['length'];if(!_0x3e2a2a[_0xf0cc('0x34')][_0xf0cc('0x38')]('nolimit')){_0xf30b5c[_0xf0cc('0x1c')]=qs['limit'](_0x3e2a2a['query'][_0xf0cc('0x1c')]);_0xf30b5c['offset']=qs[_0xf0cc('0x1f')](_0x3e2a2a[_0xf0cc('0x34')][_0xf0cc('0x1f')]);}return _0x2d4ffb[_0xf0cc('0x4f')](_0xf30b5c);}})[_0xf0cc('0x26')](function(_0xc35d67){if(_0xc35d67){return _0xc35d67?{'count':_0x4c0c8d,'rows':_0xc35d67}:null;}})[_0xf0cc('0x26')](respondWithResult(_0x3b4141,null))[_0xf0cc('0x44')](handleError(_0x3b4141,null));};exports['getTags']=function(_0x7cf89,_0x15f135,_0x4edadf){var _0x341251={};var _0x32b2ac={};var _0x21449d;var _0x1abc4c;return db[_0xf0cc('0x2b')]['findOne']({'where':{'id':_0x7cf89[_0xf0cc('0x46')]['id']}})[_0xf0cc('0x26')](handleEntityNotFound(_0x15f135,null))['then'](function(_0x40309f){if(_0x40309f){_0x21449d=_0x40309f;_0x32b2ac['model']=_['keys'](db[_0xf0cc('0x50')][_0xf0cc('0x2c')]);_0x32b2ac['query']=_[_0xf0cc('0x31')](_0x7cf89[_0xf0cc('0x34')]);_0x32b2ac['filters']=_[_0xf0cc('0x33')](_0x32b2ac['model'],_0x32b2ac[_0xf0cc('0x34')]);_0x341251[_0xf0cc('0x35')]=_['intersection'](_0x32b2ac[_0xf0cc('0x30')],qs[_0xf0cc('0x36')](_0x7cf89[_0xf0cc('0x34')][_0xf0cc('0x36')]));_0x341251['attributes']=_0x341251[_0xf0cc('0x35')][_0xf0cc('0x37')]?_0x341251[_0xf0cc('0x35')]:_0x32b2ac['model'];_0x341251[_0xf0cc('0x3a')]=qs[_0xf0cc('0x3b')](_0x7cf89['query'][_0xf0cc('0x3b')]);_0x341251[_0xf0cc('0x3c')]=qs[_0xf0cc('0x32')](_['pick'](_0x7cf89[_0xf0cc('0x34')],_0x32b2ac[_0xf0cc('0x32')]));if(_0x7cf89[_0xf0cc('0x34')][_0xf0cc('0x3e')]){_0x341251[_0xf0cc('0x3c')]=_[_0xf0cc('0x3f')](_0x341251[_0xf0cc('0x3c')],{'$or':_[_0xf0cc('0x2a')](_0x341251[_0xf0cc('0x35')],function(_0x1472e7){var _0x1c31bf={};_0x1c31bf[_0x1472e7]={'$like':'%'+_0x7cf89[_0xf0cc('0x34')]['filter']+'%'};return _0x1c31bf;})});}_0x341251=_[_0xf0cc('0x3f')]({},_0x341251,_0x7cf89['options']);return _0x21449d[_0xf0cc('0x51')](_0x341251);}})['then'](function(_0x438109){if(_0x438109){_0x1abc4c=_0x438109[_0xf0cc('0x37')];if(!_0x7cf89[_0xf0cc('0x34')][_0xf0cc('0x38')](_0xf0cc('0x39'))){_0x341251[_0xf0cc('0x1c')]=qs[_0xf0cc('0x1c')](_0x7cf89[_0xf0cc('0x34')]['limit']);_0x341251['offset']=qs[_0xf0cc('0x1f')](_0x7cf89[_0xf0cc('0x34')]['offset']);}return _0x21449d[_0xf0cc('0x51')](_0x341251);}})[_0xf0cc('0x26')](function(_0x5f0b8c){if(_0x5f0b8c){return _0x5f0b8c?{'count':_0x1abc4c,'rows':_0x5f0b8c}:null;}})['then'](respondWithResult(_0x15f135,null))[_0xf0cc('0x44')](handleError(_0x15f135,null));};exports[_0xf0cc('0x52')]=function(_0x484e70,_0x3060c0,_0x504cc2){if(_0x484e70[_0xf0cc('0x4a')]['id']){delete _0x484e70[_0xf0cc('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0xf0cc('0x4b')]({'where':{'id':_0x484e70[_0xf0cc('0x46')]['id']}})['then'](handleEntityNotFound(_0x3060c0,null))[_0xf0cc('0x26')](function(_0x62305a){if(_0x62305a){return _0x62305a[_0xf0cc('0x52')](_0x484e70[_0xf0cc('0x4a')][_0xf0cc('0x53')]||[]);}return null;})['then'](respondWithResult(_0x3060c0,null))[_0xf0cc('0x44')](handleError(_0x3060c0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a6603a8..00f5591 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 _0xd077=['lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x389392,_0x3dc496){var _0x2219f5=function(_0x36bec4){while(--_0x36bec4){_0x389392['push'](_0x389392['shift']());}};_0x2219f5(++_0x3dc496);}(_0xd077,0x134));var _0x7d07=function(_0x50709f,_0x471e8a){_0x50709f=_0x50709f-0x0;var _0x8cfd9=_0xd077[_0x50709f];return _0x8cfd9;};'use strict';var _=require(_0x7d07('0x0'));var util=require(_0x7d07('0x1'));var logger=require(_0x7d07('0x2'))(_0x7d07('0x3'));var moment=require('moment');var BPromise=require(_0x7d07('0x4'));var rp=require(_0x7d07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d07('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x7d07('0x7')]=function(_0x2b32c7,_0x30b6af){return _0x2b32c7[_0x7d07('0x8')](_0x7d07('0x9'),attributes,{'tableName':_0x7d07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2d4=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x328046,_0x5c5acb){var _0x312097=function(_0xf7ce2){while(--_0xf7ce2){_0x328046['push'](_0x328046['shift']());}};_0x312097(++_0x5c5acb);}(_0xe2d4,0x7b));var _0x4e2d=function(_0x2c238a,_0x14c580){_0x2c238a=_0x2c238a-0x0;var _0x1c13af=_0xe2d4[_0x2c238a];return _0x1c13af;};'use strict';var _=require(_0x4e2d('0x0'));var util=require(_0x4e2d('0x1'));var logger=require(_0x4e2d('0x2'))(_0x4e2d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e2d('0x4'));var fs=require('fs');var path=require(_0x4e2d('0x5'));var rimraf=require('rimraf');var config=require(_0x4e2d('0x6'));var attributes=require(_0x4e2d('0x7'));module[_0x4e2d('0x8')]=function(_0x3ff2b8,_0x1f042f){return _0x3ff2b8[_0x4e2d('0x9')](_0x4e2d('0xa'),attributes,{'tableName':_0x4e2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 4162fe2..941a21c 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 _0x7d46=['FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x58e389,_0x3ab426){var _0x1437df=function(_0x5cf920){while(--_0x5cf920){_0x58e389['push'](_0x58e389['shift']());}};_0x1437df(++_0x3ab426);}(_0x7d46,0x92));var _0x67d4=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x7d46[_0x4b03c9];return _0x161ba2;};'use strict';var _=require(_0x67d4('0x0'));var util=require(_0x67d4('0x1'));var moment=require(_0x67d4('0x2'));var BPromise=require(_0x67d4('0x3'));var rs=require(_0x67d4('0x4'));var fs=require('fs');var Redis=require(_0x67d4('0x5'));var db=require(_0x67d4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x67d4('0x7'))(_0x67d4('0x8'));var config=require(_0x67d4('0x9'));var jayson=require(_0x67d4('0xa'));var client=jayson[_0x67d4('0xb')][_0x67d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d1352,_0x1381c7,_0x56bdff){return new BPromise(function(_0x3d323d,_0x53f8e8){return client[_0x67d4('0xd')](_0x3d1352,_0x56bdff)['then'](function(_0xec6253){logger[_0x67d4('0xe')](_0x67d4('0xf'),_0x1381c7,'request\x20sent');logger[_0x67d4('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1381c7,_0x67d4('0x11'),JSON['stringify'](_0xec6253));if(_0xec6253[_0x67d4('0x12')]){if(_0xec6253[_0x67d4('0x12')][_0x67d4('0x13')]===0x1f4){logger[_0x67d4('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1381c7,_0xec6253[_0x67d4('0x12')]['message']);return _0x53f8e8(_0xec6253[_0x67d4('0x12')][_0x67d4('0x14')]);}logger[_0x67d4('0x12')](_0x67d4('0xf'),_0x1381c7,_0xec6253['error'][_0x67d4('0x14')]);return _0x3d323d(_0xec6253[_0x67d4('0x12')][_0x67d4('0x14')]);}else{logger[_0x67d4('0xe')](_0x67d4('0xf'),_0x1381c7,_0x67d4('0x11'));_0x3d323d(_0xec6253[_0x67d4('0x15')][_0x67d4('0x14')]);}})[_0x67d4('0x16')](function(_0x195948){logger[_0x67d4('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1381c7,_0x195948);_0x53f8e8(_0x195948);});});} \ No newline at end of file +var _0x407b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x407b,0x156));var _0xb407=function(_0x3be86b,_0x49e6e7){_0x3be86b=_0x3be86b-0x0;var _0xb75369=_0x407b[_0x3be86b];return _0xb75369;};'use strict';var _=require(_0xb407('0x0'));var util=require(_0xb407('0x1'));var moment=require('moment');var BPromise=require(_0xb407('0x2'));var rs=require(_0xb407('0x3'));var fs=require('fs');var Redis=require(_0xb407('0x4'));var db=require(_0xb407('0x5'))['db'];var utils=require(_0xb407('0x6'));var logger=require(_0xb407('0x7'))(_0xb407('0x8'));var config=require(_0xb407('0x9'));var jayson=require(_0xb407('0xa'));var client=jayson['client'][_0xb407('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4842c7,_0x37efe4,_0x24a9b6){return new BPromise(function(_0x4a663e,_0x44663e){return client[_0xb407('0xc')](_0x4842c7,_0x24a9b6)[_0xb407('0xd')](function(_0x3be949){logger[_0xb407('0xe')](_0xb407('0xf'),_0x37efe4,_0xb407('0x10'));logger[_0xb407('0x11')](_0xb407('0x12'),_0x37efe4,'request\x20sent',JSON['stringify'](_0x3be949));if(_0x3be949[_0xb407('0x13')]){if(_0x3be949[_0xb407('0x13')][_0xb407('0x14')]===0x1f4){logger[_0xb407('0x13')](_0xb407('0xf'),_0x37efe4,_0x3be949['error'][_0xb407('0x15')]);return _0x44663e(_0x3be949[_0xb407('0x13')][_0xb407('0x15')]);}logger[_0xb407('0x13')](_0xb407('0xf'),_0x37efe4,_0x3be949[_0xb407('0x13')][_0xb407('0x15')]);return _0x4a663e(_0x3be949['error']['message']);}else{logger[_0xb407('0xe')](_0xb407('0xf'),_0x37efe4,_0xb407('0x10'));_0x4a663e(_0x3be949[_0xb407('0x16')][_0xb407('0x15')]);}})['catch'](function(_0x4c78c9){logger[_0xb407('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x37efe4,_0x4c78c9);_0x44663e(_0x4c78c9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 0f700a3..bc36d62 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 _0x51d0=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','create'];(function(_0x259baf,_0x8574de){var _0x55d9c2=function(_0x4555d9){while(--_0x4555d9){_0x259baf['push'](_0x259baf['shift']());}};_0x55d9c2(++_0x8574de);}(_0x51d0,0x145));var _0x051d=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0x51d0[_0xd1c39b];return _0x58f5bc;};'use strict';var multer=require('multer');var util=require(_0x051d('0x0'));var path=require(_0x051d('0x1'));var timeout=require(_0x051d('0x2'));var express=require(_0x051d('0x3'));var router=express[_0x051d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x051d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x051d('0x6'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x051d('0x7')](),controller[_0x051d('0x8')]);router[_0x051d('0x9')](_0x051d('0xa'),auth[_0x051d('0x7')](),controller[_0x051d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x051d('0xc')]);router['put'](_0x051d('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x051d('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5a3a=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x416cea,_0x7d4ee0){var _0x43fdd4=function(_0xa19c32){while(--_0xa19c32){_0x416cea['push'](_0x416cea['shift']());}};_0x43fdd4(++_0x7d4ee0);}(_0x5a3a,0xa9));var _0xa5a3=function(_0x1ee995,_0x3ced5b){_0x1ee995=_0x1ee995-0x0;var _0x2a0a26=_0x5a3a[_0x1ee995];return _0x2a0a26;};'use strict';var multer=require(_0xa5a3('0x0'));var util=require(_0xa5a3('0x1'));var path=require(_0xa5a3('0x2'));var timeout=require(_0xa5a3('0x3'));var express=require('express');var router=express[_0xa5a3('0x4')]();var fs_extra=require(_0xa5a3('0x5'));var auth=require(_0xa5a3('0x6'));var interaction=require(_0xa5a3('0x7'));var config=require(_0xa5a3('0x8'));var controller=require(_0xa5a3('0x9'));router[_0xa5a3('0xa')]('/',auth[_0xa5a3('0xb')](),controller[_0xa5a3('0xc')]);router[_0xa5a3('0xa')](_0xa5a3('0xd'),auth[_0xa5a3('0xb')](),controller[_0xa5a3('0xe')]);router[_0xa5a3('0xf')]('/',auth['isAuthenticated'](),controller[_0xa5a3('0x10')]);router[_0xa5a3('0x11')](_0xa5a3('0xd'),auth['isAuthenticated'](),controller[_0xa5a3('0x12')]);router[_0xa5a3('0x13')](_0xa5a3('0xd'),auth['isAuthenticated'](),controller[_0xa5a3('0x14')]);module[_0xa5a3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4bf965a..f744b64 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 _0xb86c=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM','string'];(function(_0x507325,_0x53cd24){var _0x4e52a8=function(_0xbac48f){while(--_0xbac48f){_0x507325['push'](_0x507325['shift']());}};_0x4e52a8(++_0x53cd24);}(_0xb86c,0x102));var _0xcb86=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb86c[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0xcb86('0x0')]={'type':{'type':Sequelize[_0xcb86('0x1')](_0xcb86('0x2'),'variable',_0xcb86('0x3'),_0xcb86('0x4'),_0xcb86('0x5')),'defaultValue':_0xcb86('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcb86('0x6')]},'keyType':{'type':Sequelize[_0xcb86('0x1')](_0xcb86('0x2'),_0xcb86('0x7'),_0xcb86('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcb86('0x6')]},'customField':{'type':Sequelize[_0xcb86('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcb86('0x6')]}}; \ No newline at end of file +var _0x7716=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7716,0x132));var _0x6771=function(_0x49335f,_0x46042c){_0x49335f=_0x49335f-0x0;var _0x144233=_0x7716[_0x49335f];return _0x144233;};'use strict';var Sequelize=require(_0x6771('0x0'));module[_0x6771('0x1')]={'type':{'type':Sequelize[_0x6771('0x2')](_0x6771('0x3'),_0x6771('0x4'),_0x6771('0x5'),_0x6771('0x6'),_0x6771('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6771('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x6771('0x3'),_0x6771('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x6771('0x8')]},'idField':{'type':Sequelize[_0x6771('0x8')]},'nameField':{'type':Sequelize[_0x6771('0x8')]},'customField':{'type':Sequelize[_0x6771('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6771('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 28da21a..1be9066 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 _0x1b73=['include','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','stack','name','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll'];(function(_0x5518ac,_0x29a743){var _0x5c5ba4=function(_0x27a51f){while(--_0x27a51f){_0x5518ac['push'](_0x5518ac['shift']());}};_0x5c5ba4(++_0x29a743);}(_0x1b73,0x1d5));var _0x31b7=function(_0xb88fbd,_0x19443f){_0xb88fbd=_0xb88fbd-0x0;var _0x55ae32=_0x1b73[_0xb88fbd];return _0x55ae32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31b7('0x0'));var zipdir=require(_0x31b7('0x1'));var jsonpatch=require(_0x31b7('0x2'));var rp=require(_0x31b7('0x3'));var moment=require('moment');var BPromise=require(_0x31b7('0x4'));var Mustache=require('mustache');var util=require(_0x31b7('0x5'));var path=require(_0x31b7('0x6'));var sox=require('sox');var csv=require(_0x31b7('0x7'));var ejs=require(_0x31b7('0x8'));var fs=require('fs');var fs_extra=require(_0x31b7('0x9'));var _=require('lodash');var squel=require(_0x31b7('0xa'));var crypto=require(_0x31b7('0xb'));var jsforce=require(_0x31b7('0xc'));var deskjs=require(_0x31b7('0xd'));var toCsv=require(_0x31b7('0x7'));var querystring=require(_0x31b7('0xe'));var Papa=require(_0x31b7('0xf'));var Redis=require('ioredis');var authService=require(_0x31b7('0x10'));var qs=require(_0x31b7('0x11'));var as=require(_0x31b7('0x12'));var hardwareService=require(_0x31b7('0x13'));var logger=require(_0x31b7('0x14'))(_0x31b7('0x15'));var utils=require(_0x31b7('0x16'));var config=require(_0x31b7('0x17'));var licenseUtil=require(_0x31b7('0x18'));var db=require(_0x31b7('0x19'))['db'];function respondWithStatusCode(_0x492612,_0x32afeb){_0x32afeb=_0x32afeb||0xcc;return function(_0x55e1bb){if(_0x55e1bb){return _0x492612[_0x31b7('0x1a')](_0x32afeb);}return _0x492612[_0x31b7('0x1b')](_0x32afeb)[_0x31b7('0x1c')]();};}function respondWithResult(_0x1969d2,_0x7988e2){_0x7988e2=_0x7988e2||0xc8;return function(_0x34e917){if(_0x34e917){return _0x1969d2[_0x31b7('0x1b')](_0x7988e2)['json'](_0x34e917);}};}function respondWithFilteredResult(_0x1e93fb,_0x491c98){return function(_0x210f18){if(_0x210f18){var _0xf213c9=typeof _0x491c98['offset']===_0x31b7('0x1d')&&typeof _0x491c98[_0x31b7('0x1e')]===_0x31b7('0x1d');var _0x39eee9=_0x210f18[_0x31b7('0x1f')];var _0x5f3245=_0xf213c9?0x0:_0x491c98[_0x31b7('0x20')];var _0x437eba=_0xf213c9?_0x210f18[_0x31b7('0x1f')]:_0x491c98[_0x31b7('0x20')]+_0x491c98[_0x31b7('0x1e')];var _0x4b8ab1;if(_0x437eba>=_0x39eee9){_0x437eba=_0x39eee9;_0x4b8ab1=0xc8;}else{_0x4b8ab1=0xce;}_0x1e93fb[_0x31b7('0x1b')](_0x4b8ab1);return _0x1e93fb[_0x31b7('0x21')](_0x31b7('0x22'),_0x5f3245+'-'+_0x437eba+'/'+_0x39eee9)[_0x31b7('0x23')](_0x210f18);}return null;};}function patchUpdates(_0x5b56bc){return function(_0x892fe4){try{jsonpatch[_0x31b7('0x24')](_0x892fe4,_0x5b56bc,!![]);}catch(_0x424318){return BPromise[_0x31b7('0x25')](_0x424318);}return _0x892fe4['save']();};}function saveUpdates(_0x33dd04,_0x20cb03){return function(_0x250574){if(_0x250574){return _0x250574[_0x31b7('0x26')](_0x33dd04)[_0x31b7('0x27')](function(_0x2d24bf){return _0x2d24bf;});}return null;};}function removeEntity(_0x36492c,_0x20e5b0){return function(_0x3b0eff){if(_0x3b0eff){return _0x3b0eff['destroy']()[_0x31b7('0x27')](function(){_0x36492c[_0x31b7('0x1b')](0xcc)[_0x31b7('0x1c')]();});}};}function handleEntityNotFound(_0x2c993b,_0x4e5673){return function(_0xb8a998){if(!_0xb8a998){_0x2c993b['sendStatus'](0x194);}return _0xb8a998;};}function handleError(_0x3dd60d,_0x2da751){_0x2da751=_0x2da751||0x1f4;return function(_0x14b63f){logger[_0x31b7('0x28')](_0x14b63f[_0x31b7('0x29')]);if(_0x14b63f[_0x31b7('0x2a')]){delete _0x14b63f[_0x31b7('0x2a')];}_0x3dd60d[_0x31b7('0x1b')](_0x2da751)['send'](_0x14b63f);};}exports['index']=function(_0x503549,_0x46508a){var _0x39521d={},_0x2a7c54={},_0x4f5e1d={'count':0x0,'rows':[]};var _0x169238=_[_0x31b7('0x2b')](db[_0x31b7('0x2c')][_0x31b7('0x2d')],function(_0x58a87e){return{'name':_0x58a87e[_0x31b7('0x2e')],'type':_0x58a87e[_0x31b7('0x2f')]['key']};});_0x2a7c54['model']=_[_0x31b7('0x2b')](_0x169238,_0x31b7('0x2a'));_0x2a7c54[_0x31b7('0x30')]=_[_0x31b7('0x31')](_0x503549['query']);_0x2a7c54['filters']=_[_0x31b7('0x32')](_0x2a7c54[_0x31b7('0x33')],_0x2a7c54[_0x31b7('0x30')]);_0x39521d[_0x31b7('0x34')]=_[_0x31b7('0x32')](_0x2a7c54['model'],qs['fields'](_0x503549[_0x31b7('0x30')][_0x31b7('0x35')]));_0x39521d['attributes']=_0x39521d[_0x31b7('0x34')][_0x31b7('0x36')]?_0x39521d['attributes']:_0x2a7c54[_0x31b7('0x33')];if(!_0x503549[_0x31b7('0x30')][_0x31b7('0x37')](_0x31b7('0x38'))){_0x39521d[_0x31b7('0x1e')]=qs[_0x31b7('0x1e')](_0x503549[_0x31b7('0x30')][_0x31b7('0x1e')]);_0x39521d[_0x31b7('0x20')]=qs[_0x31b7('0x20')](_0x503549[_0x31b7('0x30')][_0x31b7('0x20')]);}_0x39521d[_0x31b7('0x39')]=qs['sort'](_0x503549['query'][_0x31b7('0x3a')]);_0x39521d[_0x31b7('0x3b')]=qs[_0x31b7('0x3c')](_[_0x31b7('0x3d')](_0x503549[_0x31b7('0x30')],_0x2a7c54[_0x31b7('0x3c')]),_0x169238);if(_0x503549[_0x31b7('0x30')][_0x31b7('0x3e')]){_0x39521d[_0x31b7('0x3b')]=_[_0x31b7('0x3f')](_0x39521d['where'],{'$or':_[_0x31b7('0x2b')](_0x169238,function(_0xfd4863){if(_0xfd4863[_0x31b7('0x2f')]!==_0x31b7('0x40')){var _0x5c9cec={};_0x5c9cec[_0xfd4863[_0x31b7('0x2a')]]={'$like':'%'+_0x503549[_0x31b7('0x30')]['filter']+'%'};return _0x5c9cec;}})});}_0x39521d=_[_0x31b7('0x3f')]({},_0x39521d,_0x503549['options']);var _0x587506={'where':_0x39521d[_0x31b7('0x3b')]};return db[_0x31b7('0x2c')][_0x31b7('0x1f')](_0x587506)[_0x31b7('0x27')](function(_0x3d0413){_0x4f5e1d['count']=_0x3d0413;if(_0x503549[_0x31b7('0x30')]['includeAll']){_0x39521d['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x31b7('0x41')](_0x39521d);})[_0x31b7('0x27')](function(_0x1527b3){_0x4f5e1d[_0x31b7('0x42')]=_0x1527b3;return _0x4f5e1d;})[_0x31b7('0x27')](respondWithFilteredResult(_0x46508a,_0x39521d))['catch'](handleError(_0x46508a,null));};exports[_0x31b7('0x43')]=function(_0x5d1f25,_0xef2b18){var _0x3caab0={'raw':!![],'where':{'id':_0x5d1f25[_0x31b7('0x44')]['id']}},_0x41c92e={};_0x41c92e['model']=_[_0x31b7('0x31')](db[_0x31b7('0x2c')][_0x31b7('0x2d')]);_0x41c92e['query']=_[_0x31b7('0x31')](_0x5d1f25['query']);_0x41c92e[_0x31b7('0x3c')]=_[_0x31b7('0x32')](_0x41c92e['model'],_0x41c92e[_0x31b7('0x30')]);_0x3caab0[_0x31b7('0x34')]=_[_0x31b7('0x32')](_0x41c92e[_0x31b7('0x33')],qs['fields'](_0x5d1f25[_0x31b7('0x30')]['fields']));_0x3caab0['attributes']=_0x3caab0[_0x31b7('0x34')][_0x31b7('0x36')]?_0x3caab0[_0x31b7('0x34')]:_0x41c92e[_0x31b7('0x33')];if(_0x5d1f25['query'][_0x31b7('0x45')]){_0x3caab0[_0x31b7('0x46')]=[{'all':!![]}];}_0x3caab0=_['merge']({},_0x3caab0,_0x5d1f25[_0x31b7('0x47')]);return db[_0x31b7('0x2c')][_0x31b7('0x48')](_0x3caab0)['then'](handleEntityNotFound(_0xef2b18,null))[_0x31b7('0x27')](respondWithResult(_0xef2b18,null))[_0x31b7('0x49')](handleError(_0xef2b18,null));};exports[_0x31b7('0x4a')]=function(_0x164115,_0x345059){return db[_0x31b7('0x2c')][_0x31b7('0x4a')](_0x164115[_0x31b7('0x4b')],{})['then'](respondWithResult(_0x345059,0xc9))[_0x31b7('0x49')](handleError(_0x345059,null));};exports['update']=function(_0x5a72ee,_0x22cc77){if(_0x5a72ee[_0x31b7('0x4b')]['id']){delete _0x5a72ee[_0x31b7('0x4b')]['id'];}return db[_0x31b7('0x2c')]['find']({'where':{'id':_0x5a72ee[_0x31b7('0x44')]['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x22cc77,null))[_0x31b7('0x27')](saveUpdates(_0x5a72ee['body'],null))[_0x31b7('0x27')](respondWithResult(_0x22cc77,null))[_0x31b7('0x49')](handleError(_0x22cc77,null));};exports[_0x31b7('0x4c')]=function(_0x3b5868,_0x2bf59c){return db[_0x31b7('0x2c')][_0x31b7('0x48')]({'where':{'id':_0x3b5868[_0x31b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2bf59c,null))['then'](removeEntity(_0x2bf59c,null))[_0x31b7('0x49')](handleError(_0x2bf59c,null));}; \ No newline at end of file +var _0x6c76=['pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshdeskField','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c76,0x184));var _0x66c7=function(_0x4948c6,_0x48607f){_0x4948c6=_0x4948c6-0x0;var _0x16f055=_0x6c76[_0x4948c6];return _0x16f055;};'use strict';var emlformat=require(_0x66c7('0x0'));var rimraf=require(_0x66c7('0x1'));var zipdir=require(_0x66c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66c7('0x5'));var path=require(_0x66c7('0x6'));var sox=require('sox');var csv=require(_0x66c7('0x7'));var ejs=require(_0x66c7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x7'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];function respondWithStatusCode(_0x5176a3,_0x18c309){_0x18c309=_0x18c309||0xcc;return function(_0x760e36){if(_0x760e36){return _0x5176a3[_0x66c7('0x17')](_0x18c309);}return _0x5176a3[_0x66c7('0x18')](_0x18c309)[_0x66c7('0x19')]();};}function respondWithResult(_0x1e91d1,_0x618bd7){_0x618bd7=_0x618bd7||0xc8;return function(_0xf3b04){if(_0xf3b04){return _0x1e91d1[_0x66c7('0x18')](_0x618bd7)['json'](_0xf3b04);}};}function respondWithFilteredResult(_0x110f6d,_0x4dd902){return function(_0x208010){if(_0x208010){var _0x39f951=typeof _0x4dd902[_0x66c7('0x1a')]===_0x66c7('0x1b')&&typeof _0x4dd902[_0x66c7('0x1c')]==='undefined';var _0x5cf913=_0x208010['count'];var _0x5129f6=_0x39f951?0x0:_0x4dd902[_0x66c7('0x1a')];var _0x19f29d=_0x39f951?_0x208010['count']:_0x4dd902['offset']+_0x4dd902[_0x66c7('0x1c')];var _0x9b65cf;if(_0x19f29d>=_0x5cf913){_0x19f29d=_0x5cf913;_0x9b65cf=0xc8;}else{_0x9b65cf=0xce;}_0x110f6d[_0x66c7('0x18')](_0x9b65cf);return _0x110f6d[_0x66c7('0x1d')]('Content-Range',_0x5129f6+'-'+_0x19f29d+'/'+_0x5cf913)['json'](_0x208010);}return null;};}function patchUpdates(_0x1853b2){return function(_0x237177){try{jsonpatch[_0x66c7('0x1e')](_0x237177,_0x1853b2,!![]);}catch(_0x1c43c4){return BPromise[_0x66c7('0x1f')](_0x1c43c4);}return _0x237177[_0x66c7('0x20')]();};}function saveUpdates(_0x4804cf,_0x4ddbd2){return function(_0x366e9b){if(_0x366e9b){return _0x366e9b['update'](_0x4804cf)[_0x66c7('0x21')](function(_0x8b96b1){return _0x8b96b1;});}return null;};}function removeEntity(_0x44bdef,_0x1fc9d3){return function(_0x5bfaf6){if(_0x5bfaf6){return _0x5bfaf6[_0x66c7('0x22')]()[_0x66c7('0x21')](function(){_0x44bdef['status'](0xcc)[_0x66c7('0x19')]();});}};}function handleEntityNotFound(_0x11a6b9,_0x2bb86d){return function(_0x2ef6a2){if(!_0x2ef6a2){_0x11a6b9[_0x66c7('0x17')](0x194);}return _0x2ef6a2;};}function handleError(_0x54d45d,_0x5bc4e6){_0x5bc4e6=_0x5bc4e6||0x1f4;return function(_0x4e514a){logger[_0x66c7('0x23')](_0x4e514a[_0x66c7('0x24')]);if(_0x4e514a['name']){delete _0x4e514a[_0x66c7('0x25')];}_0x54d45d[_0x66c7('0x18')](_0x5bc4e6)[_0x66c7('0x26')](_0x4e514a);};}exports[_0x66c7('0x27')]=function(_0x36a830,_0x27be81){var _0x570f0d={},_0xccefb2={},_0x2e2560={'count':0x0,'rows':[]};var _0xc4b2bf=_[_0x66c7('0x28')](db[_0x66c7('0x29')]['rawAttributes'],function(_0x263b48){return{'name':_0x263b48['fieldName'],'type':_0x263b48[_0x66c7('0x2a')]['key']};});_0xccefb2[_0x66c7('0x2b')]=_[_0x66c7('0x28')](_0xc4b2bf,_0x66c7('0x25'));_0xccefb2[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0x36a830[_0x66c7('0x2c')]);_0xccefb2['filters']=_['intersection'](_0xccefb2[_0x66c7('0x2b')],_0xccefb2[_0x66c7('0x2c')]);_0x570f0d[_0x66c7('0x2e')]=_[_0x66c7('0x2f')](_0xccefb2[_0x66c7('0x2b')],qs[_0x66c7('0x30')](_0x36a830[_0x66c7('0x2c')][_0x66c7('0x30')]));_0x570f0d[_0x66c7('0x2e')]=_0x570f0d[_0x66c7('0x2e')][_0x66c7('0x31')]?_0x570f0d[_0x66c7('0x2e')]:_0xccefb2['model'];if(!_0x36a830['query'][_0x66c7('0x32')](_0x66c7('0x33'))){_0x570f0d[_0x66c7('0x1c')]=qs[_0x66c7('0x1c')](_0x36a830[_0x66c7('0x2c')][_0x66c7('0x1c')]);_0x570f0d[_0x66c7('0x1a')]=qs['offset'](_0x36a830[_0x66c7('0x2c')][_0x66c7('0x1a')]);}_0x570f0d[_0x66c7('0x34')]=qs[_0x66c7('0x35')](_0x36a830[_0x66c7('0x2c')][_0x66c7('0x35')]);_0x570f0d[_0x66c7('0x36')]=qs[_0x66c7('0x37')](_[_0x66c7('0x38')](_0x36a830[_0x66c7('0x2c')],_0xccefb2[_0x66c7('0x37')]),_0xc4b2bf);if(_0x36a830['query']['filter']){_0x570f0d[_0x66c7('0x36')]=_[_0x66c7('0x39')](_0x570f0d[_0x66c7('0x36')],{'$or':_['map'](_0xc4b2bf,function(_0x4d46dd){if(_0x4d46dd[_0x66c7('0x2a')]!==_0x66c7('0x3a')){var _0x501771={};_0x501771[_0x4d46dd[_0x66c7('0x25')]]={'$like':'%'+_0x36a830[_0x66c7('0x2c')][_0x66c7('0x3b')]+'%'};return _0x501771;}})});}_0x570f0d=_['merge']({},_0x570f0d,_0x36a830[_0x66c7('0x3c')]);var _0x16b754={'where':_0x570f0d[_0x66c7('0x36')]};return db[_0x66c7('0x29')][_0x66c7('0x3d')](_0x16b754)[_0x66c7('0x21')](function(_0x21deb3){_0x2e2560[_0x66c7('0x3d')]=_0x21deb3;if(_0x36a830[_0x66c7('0x2c')]['includeAll']){_0x570f0d[_0x66c7('0x3e')]=[{'all':!![]}];}return db[_0x66c7('0x29')][_0x66c7('0x3f')](_0x570f0d);})[_0x66c7('0x21')](function(_0x3f169e){_0x2e2560[_0x66c7('0x40')]=_0x3f169e;return _0x2e2560;})[_0x66c7('0x21')](respondWithFilteredResult(_0x27be81,_0x570f0d))[_0x66c7('0x41')](handleError(_0x27be81,null));};exports[_0x66c7('0x42')]=function(_0x3d371a,_0x513317){var _0x5bb5fc={'raw':!![],'where':{'id':_0x3d371a[_0x66c7('0x43')]['id']}},_0x528f5c={};_0x528f5c[_0x66c7('0x2b')]=_['keys'](db['FreshdeskField'][_0x66c7('0x44')]);_0x528f5c[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0x3d371a[_0x66c7('0x2c')]);_0x528f5c[_0x66c7('0x37')]=_['intersection'](_0x528f5c[_0x66c7('0x2b')],_0x528f5c['query']);_0x5bb5fc['attributes']=_[_0x66c7('0x2f')](_0x528f5c[_0x66c7('0x2b')],qs[_0x66c7('0x30')](_0x3d371a[_0x66c7('0x2c')]['fields']));_0x5bb5fc['attributes']=_0x5bb5fc[_0x66c7('0x2e')]['length']?_0x5bb5fc['attributes']:_0x528f5c[_0x66c7('0x2b')];if(_0x3d371a[_0x66c7('0x2c')][_0x66c7('0x45')]){_0x5bb5fc[_0x66c7('0x3e')]=[{'all':!![]}];}_0x5bb5fc=_['merge']({},_0x5bb5fc,_0x3d371a[_0x66c7('0x3c')]);return db[_0x66c7('0x29')][_0x66c7('0x46')](_0x5bb5fc)['then'](handleEntityNotFound(_0x513317,null))[_0x66c7('0x21')](respondWithResult(_0x513317,null))[_0x66c7('0x41')](handleError(_0x513317,null));};exports[_0x66c7('0x47')]=function(_0x3c45cd,_0x1b78a6){return db[_0x66c7('0x29')][_0x66c7('0x47')](_0x3c45cd[_0x66c7('0x48')],{})['then'](respondWithResult(_0x1b78a6,0xc9))[_0x66c7('0x41')](handleError(_0x1b78a6,null));};exports[_0x66c7('0x49')]=function(_0x23d0eb,_0x1386a2){if(_0x23d0eb[_0x66c7('0x48')]['id']){delete _0x23d0eb[_0x66c7('0x48')]['id'];}return db[_0x66c7('0x29')][_0x66c7('0x46')]({'where':{'id':_0x23d0eb[_0x66c7('0x43')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x1386a2,null))[_0x66c7('0x21')](saveUpdates(_0x23d0eb[_0x66c7('0x48')],null))[_0x66c7('0x21')](respondWithResult(_0x1386a2,null))[_0x66c7('0x41')](handleError(_0x1386a2,null));};exports['destroy']=function(_0x43d4db,_0x225fb6){return db[_0x66c7('0x29')][_0x66c7('0x46')]({'where':{'id':_0x43d4db['params']['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x225fb6,null))[_0x66c7('0x21')](removeEntity(_0x225fb6,null))['catch'](handleError(_0x225fb6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 8c52c90..86e3bd6 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 _0xe42c=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports'];(function(_0x5636b4,_0x5caf31){var _0x3170c1=function(_0x5f323e){while(--_0x5f323e){_0x5636b4['push'](_0x5636b4['shift']());}};_0x3170c1(++_0x5caf31);}(_0xe42c,0x149));var _0xce42=function(_0x3f196c,_0x1361a1){_0x3f196c=_0x3f196c-0x0;var _0x2fd114=_0xe42c[_0x3f196c];return _0x2fd114;};'use strict';var _=require(_0xce42('0x0'));var util=require(_0xce42('0x1'));var logger=require(_0xce42('0x2'))(_0xce42('0x3'));var moment=require(_0xce42('0x4'));var BPromise=require(_0xce42('0x5'));var rp=require(_0xce42('0x6'));var fs=require('fs');var path=require(_0xce42('0x7'));var rimraf=require(_0xce42('0x8'));var config=require('../../config/environment');var attributes=require(_0xce42('0x9'));module[_0xce42('0xa')]=function(_0x1c727a,_0x2b25bf){return _0x1c727a[_0xce42('0xb')](_0xce42('0xc'),attributes,{'tableName':_0xce42('0xd'),'paranoid':![],'indexes':[{'name':_0xce42('0xe'),'fields':[_0xce42('0xf'),_0xce42('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdec1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','../../config/logger','api'];(function(_0x5333fd,_0x14dc9e){var _0x9bf35a=function(_0x3fe7dc){while(--_0x3fe7dc){_0x5333fd['push'](_0x5333fd['shift']());}};_0x9bf35a(++_0x14dc9e);}(_0xdec1,0x11d));var _0x1dec=function(_0x22ccd5,_0x5ac590){_0x22ccd5=_0x22ccd5-0x0;var _0x2c79ee=_0xdec1[_0x22ccd5];return _0x2c79ee;};'use strict';var _=require(_0x1dec('0x0'));var util=require('util');var logger=require(_0x1dec('0x1'))(_0x1dec('0x2'));var moment=require(_0x1dec('0x3'));var BPromise=require(_0x1dec('0x4'));var rp=require(_0x1dec('0x5'));var fs=require('fs');var path=require(_0x1dec('0x6'));var rimraf=require(_0x1dec('0x7'));var config=require(_0x1dec('0x8'));var attributes=require(_0x1dec('0x9'));module[_0x1dec('0xa')]=function(_0x8f8be1,_0x108f91){return _0x8f8be1[_0x1dec('0xb')](_0x1dec('0xc'),attributes,{'tableName':_0x1dec('0xd'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x1dec('0xe'),_0x1dec('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 9a569c0..1927e48 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 _0x54c3=['../../mysqldb','rpc','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','util','bluebird','randomstring'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0x54c3,0x140));var _0x354c=function(_0x288325,_0x26e4ff){_0x288325=_0x288325-0x0;var _0x3b9fd7=_0x54c3[_0x288325];return _0x3b9fd7;};'use strict';var _=require('lodash');var util=require(_0x354c('0x0'));var moment=require('moment');var BPromise=require(_0x354c('0x1'));var rs=require(_0x354c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x354c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x354c('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x354c('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27866b,_0x4c7a98,_0x1b2416){return new BPromise(function(_0x123a04,_0x5e252b){return client[_0x354c('0x6')](_0x27866b,_0x1b2416)[_0x354c('0x7')](function(_0x3c0236){logger[_0x354c('0x8')](_0x354c('0x9'),_0x4c7a98,_0x354c('0xa'));logger[_0x354c('0xb')](_0x354c('0xc'),_0x4c7a98,_0x354c('0xa'),JSON[_0x354c('0xd')](_0x3c0236));if(_0x3c0236['error']){if(_0x3c0236['error'][_0x354c('0xe')]===0x1f4){logger[_0x354c('0xf')](_0x354c('0x9'),_0x4c7a98,_0x3c0236[_0x354c('0xf')][_0x354c('0x10')]);return _0x5e252b(_0x3c0236['error'][_0x354c('0x10')]);}logger[_0x354c('0xf')](_0x354c('0x9'),_0x4c7a98,_0x3c0236[_0x354c('0xf')][_0x354c('0x10')]);return _0x123a04(_0x3c0236[_0x354c('0xf')]['message']);}else{logger[_0x354c('0x8')](_0x354c('0x9'),_0x4c7a98,_0x354c('0xa'));_0x123a04(_0x3c0236['result']['message']);}})['catch'](function(_0x97577e){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x4c7a98,_0x97577e);_0x5e252b(_0x97577e);});});} \ No newline at end of file +var _0x7bf4=['info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7bf4,0x135));var _0x47bf=function(_0x490817,_0x1fa2d9){_0x490817=_0x490817-0x0;var _0x5e1d8a=_0x7bf4[_0x490817];return _0x5e1d8a;};'use strict';var _=require('lodash');var util=require(_0x47bf('0x0'));var moment=require('moment');var BPromise=require(_0x47bf('0x1'));var rs=require(_0x47bf('0x2'));var fs=require('fs');var Redis=require(_0x47bf('0x3'));var db=require(_0x47bf('0x4'))['db'];var utils=require(_0x47bf('0x5'));var logger=require(_0x47bf('0x6'))(_0x47bf('0x7'));var config=require('../../config/environment');var jayson=require(_0x47bf('0x8'));var client=jayson[_0x47bf('0x9')][_0x47bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42b67e,_0x3ccec1,_0x54318c){return new BPromise(function(_0x3ad51e,_0x5a8938){return client[_0x47bf('0xb')](_0x42b67e,_0x54318c)[_0x47bf('0xc')](function(_0x2bc21f){logger[_0x47bf('0xd')](_0x47bf('0xe'),_0x3ccec1,'request\x20sent');logger[_0x47bf('0xf')](_0x47bf('0x10'),_0x3ccec1,_0x47bf('0x11'),JSON['stringify'](_0x2bc21f));if(_0x2bc21f['error']){if(_0x2bc21f[_0x47bf('0x12')][_0x47bf('0x13')]===0x1f4){logger['error'](_0x47bf('0xe'),_0x3ccec1,_0x2bc21f[_0x47bf('0x12')]['message']);return _0x5a8938(_0x2bc21f['error'][_0x47bf('0x14')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x3ccec1,_0x2bc21f[_0x47bf('0x12')][_0x47bf('0x14')]);return _0x3ad51e(_0x2bc21f['error']['message']);}else{logger[_0x47bf('0xd')](_0x47bf('0xe'),_0x3ccec1,_0x47bf('0x11'));_0x3ad51e(_0x2bc21f[_0x47bf('0x15')][_0x47bf('0x14')]);}})[_0x47bf('0x16')](function(_0x4c1fb3){logger[_0x47bf('0x12')](_0x47bf('0xe'),_0x3ccec1,_0x4c1fb3);_0x5a8938(_0x4c1fb3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index e336709..92fab43 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 _0x7af2=['getConfigurations','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x7af2,0x119));var _0x27af=function(_0x5e884a,_0x590e1e){_0x5e884a=_0x5e884a-0x0;var _0x111b9f=_0x7af2[_0x5e884a];return _0x111b9f;};'use strict';var multer=require('multer');var util=require(_0x27af('0x0'));var path=require(_0x27af('0x1'));var timeout=require(_0x27af('0x2'));var express=require(_0x27af('0x3'));var router=express['Router']();var fs_extra=require(_0x27af('0x4'));var auth=require(_0x27af('0x5'));var interaction=require(_0x27af('0x6'));var config=require(_0x27af('0x7'));var controller=require(_0x27af('0x8'));router[_0x27af('0x9')]('/',auth[_0x27af('0xa')](),controller[_0x27af('0xb')]);router[_0x27af('0x9')]('/:id',auth[_0x27af('0xa')](),controller[_0x27af('0xc')]);router[_0x27af('0x9')]('/:id/configurations',auth[_0x27af('0xa')](),controller[_0x27af('0xd')]);router[_0x27af('0x9')]('/:id/fields',auth[_0x27af('0xa')](),controller['getFields']);router['post']('/',auth[_0x27af('0xa')](),controller['create']);router['post'](_0x27af('0xe'),auth['isAuthenticated'](),controller[_0x27af('0xf')]);router['put'](_0x27af('0x10'),auth[_0x27af('0xa')](),controller[_0x27af('0x11')]);router[_0x27af('0x12')](_0x27af('0x10'),auth[_0x27af('0xa')](),controller[_0x27af('0x13')]);module[_0x27af('0x14')]=router; \ No newline at end of file +var _0xb62e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','show','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x5dcb41,_0x4ff6b4){var _0x480a5a=function(_0x396533){while(--_0x396533){_0x5dcb41['push'](_0x5dcb41['shift']());}};_0x480a5a(++_0x4ff6b4);}(_0xb62e,0x1de));var _0xeb62=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb62e[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')]('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x11')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),controller['addConfiguration']);router[_0xeb62('0x13')](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x15')]);router['delete'](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index c602bae..4b39e07 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 _0x28f2=['exports','STRING','remoteUri','sequelize'];(function(_0x2f62de,_0x5b93bd){var _0x352ae2=function(_0x4c0747){while(--_0x4c0747){_0x2f62de['push'](_0x2f62de['shift']());}};_0x352ae2(++_0x5b93bd);}(_0x28f2,0x193));var _0x228f=function(_0x3072b6,_0x1cfc2d){_0x3072b6=_0x3072b6-0x0;var _0xae29fc=_0x28f2[_0x3072b6];return _0xae29fc;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'name':{'type':Sequelize[_0x228f('0x2')]},'description':{'type':Sequelize[_0x228f('0x2')]},'username':{'type':Sequelize[_0x228f('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x228f('0x2')]},'remoteUri':{'type':Sequelize[_0x228f('0x2')],'unique':_0x228f('0x3')},'serverUrl':{'type':Sequelize[_0x228f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5fdc=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x5fdc,0x127));var _0xc5fd=function(_0x3abb01,_0x20fab4){_0x3abb01=_0x3abb01-0x0;var _0x4beef3=_0x5fdc[_0x3abb01];return _0x4beef3;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module[_0xc5fd('0x1')]={'name':{'type':Sequelize[_0xc5fd('0x2')]},'description':{'type':Sequelize[_0xc5fd('0x2')]},'username':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x3')},'apiKey':{'type':Sequelize[_0xc5fd('0x2')]},'remoteUri':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x4')},'serverUrl':{'type':Sequelize[_0xc5fd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e3c5eee..590ec6a 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 _0xba1b=['fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshsalesAccount','count','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','length','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','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','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x32b0b2,_0x45d645){var _0x2a6ce5=function(_0x131f89){while(--_0x131f89){_0x32b0b2['push'](_0x32b0b2['shift']());}};_0x2a6ce5(++_0x45d645);}(_0xba1b,0x172));var _0xbba1=function(_0x2a590b,_0x1d887d){_0x2a590b=_0x2a590b-0x0;var _0x1db45f=_0xba1b[_0x2a590b];return _0x1db45f;};'use strict';var emlformat=require(_0xbba1('0x0'));var rimraf=require(_0xbba1('0x1'));var zipdir=require(_0xbba1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbba1('0x3'));var moment=require(_0xbba1('0x4'));var BPromise=require(_0xbba1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbba1('0x6'));var sox=require('sox');var csv=require(_0xbba1('0x7'));var ejs=require(_0xbba1('0x8'));var fs=require('fs');var fs_extra=require(_0xbba1('0x9'));var _=require(_0xbba1('0xa'));var squel=require(_0xbba1('0xb'));var crypto=require('crypto');var jsforce=require(_0xbba1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbba1('0x7'));var querystring=require(_0xbba1('0xd'));var Papa=require('papaparse');var Redis=require(_0xbba1('0xe'));var authService=require(_0xbba1('0xf'));var qs=require(_0xbba1('0x10'));var as=require(_0xbba1('0x11'));var hardwareService=require(_0xbba1('0x12'));var logger=require(_0xbba1('0x13'))(_0xbba1('0x14'));var utils=require(_0xbba1('0x15'));var config=require(_0xbba1('0x16'));var licenseUtil=require(_0xbba1('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbba1('0x18'));function respondWithStatusCode(_0x23e995,_0x113947){_0x113947=_0x113947||0xcc;return function(_0xacf16c){if(_0xacf16c){return _0x23e995[_0xbba1('0x19')](_0x113947);}return _0x23e995['status'](_0x113947)[_0xbba1('0x1a')]();};}function respondWithResult(_0x41c175,_0x41ae6c){_0x41ae6c=_0x41ae6c||0xc8;return function(_0xf802ef){if(_0xf802ef){return _0x41c175['status'](_0x41ae6c)[_0xbba1('0x1b')](_0xf802ef);}};}function respondWithFilteredResult(_0x4740c3,_0xa4bbb8){return function(_0x3631f6){if(_0x3631f6){var _0x2c45d3=typeof _0xa4bbb8[_0xbba1('0x1c')]===_0xbba1('0x1d')&&typeof _0xa4bbb8['limit']===_0xbba1('0x1d');var _0x51ef3b=_0x3631f6['count'];var _0x1223b3=_0x2c45d3?0x0:_0xa4bbb8['offset'];var _0x566a37=_0x2c45d3?_0x3631f6['count']:_0xa4bbb8[_0xbba1('0x1c')]+_0xa4bbb8[_0xbba1('0x1e')];var _0x409cd0;if(_0x566a37>=_0x51ef3b){_0x566a37=_0x51ef3b;_0x409cd0=0xc8;}else{_0x409cd0=0xce;}_0x4740c3[_0xbba1('0x1f')](_0x409cd0);return _0x4740c3[_0xbba1('0x20')](_0xbba1('0x21'),_0x1223b3+'-'+_0x566a37+'/'+_0x51ef3b)[_0xbba1('0x1b')](_0x3631f6);}return null;};}function patchUpdates(_0x3b03e7){return function(_0xb2fbf0){try{jsonpatch[_0xbba1('0x22')](_0xb2fbf0,_0x3b03e7,!![]);}catch(_0x13855a){return BPromise[_0xbba1('0x23')](_0x13855a);}return _0xb2fbf0[_0xbba1('0x24')]();};}function saveUpdates(_0x2b1924,_0x5ad6ce){return function(_0x10798a){if(_0x10798a){return _0x10798a[_0xbba1('0x25')](_0x2b1924)[_0xbba1('0x26')](function(_0x22dc59){return _0x22dc59;});}return null;};}function removeEntity(_0x799591,_0x197ef6){return function(_0x1c2f2f){if(_0x1c2f2f){return _0x1c2f2f[_0xbba1('0x27')]()[_0xbba1('0x26')](function(){_0x799591[_0xbba1('0x1f')](0xcc)[_0xbba1('0x1a')]();});}};}function handleEntityNotFound(_0x5657b7,_0x1dde6b){return function(_0x53368e){if(!_0x53368e){_0x5657b7[_0xbba1('0x19')](0x194);}return _0x53368e;};}function handleError(_0x4e3dca,_0x4e409a){_0x4e409a=_0x4e409a||0x1f4;return function(_0x4986b1){logger[_0xbba1('0x28')](_0x4986b1[_0xbba1('0x29')]);if(_0x4986b1[_0xbba1('0x2a')]){delete _0x4986b1[_0xbba1('0x2a')];}_0x4e3dca[_0xbba1('0x1f')](_0x4e409a)[_0xbba1('0x2b')](_0x4986b1);};}exports['index']=function(_0x34a8ad,_0x17979a){var _0x299971={},_0x2c6169={},_0x212367={'count':0x0,'rows':[]};var _0x554d07=_['map'](db['FreshsalesAccount'][_0xbba1('0x2c')],function(_0x3a87c9){return{'name':_0x3a87c9[_0xbba1('0x2d')],'type':_0x3a87c9['type'][_0xbba1('0x2e')]};});_0x2c6169[_0xbba1('0x2f')]=_[_0xbba1('0x30')](_0x554d07,_0xbba1('0x2a'));_0x2c6169[_0xbba1('0x31')]=_[_0xbba1('0x32')](_0x34a8ad[_0xbba1('0x31')]);_0x2c6169[_0xbba1('0x33')]=_[_0xbba1('0x34')](_0x2c6169['model'],_0x2c6169['query']);_0x299971[_0xbba1('0x35')]=_[_0xbba1('0x34')](_0x2c6169['model'],qs[_0xbba1('0x36')](_0x34a8ad[_0xbba1('0x31')][_0xbba1('0x36')]));_0x299971[_0xbba1('0x35')]=_0x299971[_0xbba1('0x35')]['length']?_0x299971[_0xbba1('0x35')]:_0x2c6169[_0xbba1('0x2f')];if(!_0x34a8ad[_0xbba1('0x31')][_0xbba1('0x37')]('nolimit')){_0x299971[_0xbba1('0x1e')]=qs[_0xbba1('0x1e')](_0x34a8ad[_0xbba1('0x31')][_0xbba1('0x1e')]);_0x299971[_0xbba1('0x1c')]=qs[_0xbba1('0x1c')](_0x34a8ad['query'][_0xbba1('0x1c')]);}_0x299971[_0xbba1('0x38')]=qs['sort'](_0x34a8ad[_0xbba1('0x31')][_0xbba1('0x39')]);_0x299971[_0xbba1('0x3a')]=qs['filters'](_[_0xbba1('0x3b')](_0x34a8ad[_0xbba1('0x31')],_0x2c6169[_0xbba1('0x33')]),_0x554d07);if(_0x34a8ad[_0xbba1('0x31')][_0xbba1('0x3c')]){_0x299971['where']=_[_0xbba1('0x3d')](_0x299971[_0xbba1('0x3a')],{'$or':_[_0xbba1('0x30')](_0x554d07,function(_0x3aa902){if(_0x3aa902[_0xbba1('0x3e')]!==_0xbba1('0x3f')){var _0x5a554d={};_0x5a554d[_0x3aa902[_0xbba1('0x2a')]]={'$like':'%'+_0x34a8ad[_0xbba1('0x31')][_0xbba1('0x3c')]+'%'};return _0x5a554d;}})});}_0x299971=_['merge']({},_0x299971,_0x34a8ad[_0xbba1('0x40')]);var _0x4cf910={'where':_0x299971[_0xbba1('0x3a')]};return db[_0xbba1('0x41')][_0xbba1('0x42')](_0x4cf910)[_0xbba1('0x26')](function(_0x26d5cb){_0x212367['count']=_0x26d5cb;if(_0x34a8ad[_0xbba1('0x31')][_0xbba1('0x43')]){_0x299971[_0xbba1('0x44')]=[{'all':!![]}];}return db[_0xbba1('0x41')][_0xbba1('0x45')](_0x299971);})[_0xbba1('0x26')](function(_0x2033aa){_0x212367[_0xbba1('0x46')]=_0x2033aa;return _0x212367;})[_0xbba1('0x26')](respondWithFilteredResult(_0x17979a,_0x299971))[_0xbba1('0x47')](handleError(_0x17979a,null));};exports['show']=function(_0x4cb2c1,_0x11287d){var _0x2b72cd={'raw':![],'where':{'id':_0x4cb2c1[_0xbba1('0x48')]['id']}},_0x591b35={};_0x591b35[_0xbba1('0x2f')]=_['keys'](db[_0xbba1('0x41')][_0xbba1('0x2c')]);_0x591b35[_0xbba1('0x31')]=_[_0xbba1('0x32')](_0x4cb2c1[_0xbba1('0x31')]);_0x591b35[_0xbba1('0x33')]=_['intersection'](_0x591b35[_0xbba1('0x2f')],_0x591b35[_0xbba1('0x31')]);_0x2b72cd[_0xbba1('0x35')]=_[_0xbba1('0x34')](_0x591b35[_0xbba1('0x2f')],qs[_0xbba1('0x36')](_0x4cb2c1[_0xbba1('0x31')][_0xbba1('0x36')]));_0x2b72cd[_0xbba1('0x35')]=_0x2b72cd[_0xbba1('0x35')]['length']?_0x2b72cd[_0xbba1('0x35')]:_0x591b35[_0xbba1('0x2f')];if(_0x4cb2c1[_0xbba1('0x31')][_0xbba1('0x43')]){_0x2b72cd[_0xbba1('0x44')]=[{'all':!![]}];}_0x2b72cd=_['merge']({},_0x2b72cd,_0x4cb2c1[_0xbba1('0x40')]);return db['FreshsalesAccount'][_0xbba1('0x49')](_0x2b72cd)[_0xbba1('0x26')](handleEntityNotFound(_0x11287d,null))['then'](respondWithResult(_0x11287d,null))['catch'](handleError(_0x11287d,null));};exports[_0xbba1('0x4a')]=function(_0x33e0d9,_0x223774){return db[_0xbba1('0x41')][_0xbba1('0x4a')](_0x33e0d9['body'],{})[_0xbba1('0x26')](respondWithResult(_0x223774,0xc9))[_0xbba1('0x47')](handleError(_0x223774,null));};exports[_0xbba1('0x25')]=function(_0x51748a,_0x2910cd){if(_0x51748a[_0xbba1('0x4b')]['id']){delete _0x51748a[_0xbba1('0x4b')]['id'];}return db[_0xbba1('0x41')][_0xbba1('0x49')]({'where':{'id':_0x51748a['params']['id']}})[_0xbba1('0x26')](handleEntityNotFound(_0x2910cd,null))[_0xbba1('0x26')](saveUpdates(_0x51748a[_0xbba1('0x4b')],null))[_0xbba1('0x26')](respondWithResult(_0x2910cd,null))[_0xbba1('0x47')](handleError(_0x2910cd,null));};exports[_0xbba1('0x27')]=function(_0x288938,_0x2ddf2d){return db[_0xbba1('0x41')][_0xbba1('0x49')]({'where':{'id':_0x288938[_0xbba1('0x48')]['id']}})[_0xbba1('0x26')](handleEntityNotFound(_0x2ddf2d,null))['then'](removeEntity(_0x2ddf2d,null))['catch'](handleError(_0x2ddf2d,null));};exports[_0xbba1('0x4c')]=function(_0xed987,_0x4c8dae,_0x4fee80){var _0x2d3702={};var _0x5e28ad={};var _0x2d8e6d;var _0x472367;return db[_0xbba1('0x41')][_0xbba1('0x4d')]({'where':{'id':_0xed987['params']['id']}})[_0xbba1('0x26')](handleEntityNotFound(_0x4c8dae,null))['then'](function(_0x264cbb){if(_0x264cbb){_0x2d8e6d=_0x264cbb;_0x5e28ad[_0xbba1('0x2f')]=_[_0xbba1('0x32')](db['FreshsalesConfiguration'][_0xbba1('0x2c')]);_0x5e28ad[_0xbba1('0x31')]=_[_0xbba1('0x32')](_0xed987['query']);_0x5e28ad[_0xbba1('0x33')]=_['intersection'](_0x5e28ad[_0xbba1('0x2f')],_0x5e28ad[_0xbba1('0x31')]);_0x2d3702[_0xbba1('0x35')]=_['intersection'](_0x5e28ad[_0xbba1('0x2f')],qs[_0xbba1('0x36')](_0xed987['query']['fields']));_0x2d3702[_0xbba1('0x35')]=_0x2d3702[_0xbba1('0x35')][_0xbba1('0x4e')]?_0x2d3702[_0xbba1('0x35')]:_0x5e28ad['model'];_0x2d3702[_0xbba1('0x38')]=qs[_0xbba1('0x39')](_0xed987[_0xbba1('0x31')]['sort']);_0x2d3702[_0xbba1('0x3a')]=qs[_0xbba1('0x33')](_[_0xbba1('0x3b')](_0xed987[_0xbba1('0x31')],_0x5e28ad[_0xbba1('0x33')]));if(_0xed987[_0xbba1('0x31')][_0xbba1('0x3c')]){_0x2d3702[_0xbba1('0x3a')]=_['merge'](_0x2d3702['where'],{'$or':_[_0xbba1('0x30')](_0x2d3702[_0xbba1('0x35')],function(_0x1d1188){var _0x334c00={};_0x334c00[_0x1d1188]={'$like':'%'+_0xed987[_0xbba1('0x31')][_0xbba1('0x3c')]+'%'};return _0x334c00;})});}_0x2d3702=_[_0xbba1('0x3d')]({},_0x2d3702,_0xed987['options']);return _0x2d8e6d[_0xbba1('0x4c')](_0x2d3702);}})['then'](function(_0x3c5fc4){if(_0x3c5fc4){_0x472367=_0x3c5fc4['length'];if(!_0xed987['query']['hasOwnProperty'](_0xbba1('0x4f'))){_0x2d3702[_0xbba1('0x1e')]=qs[_0xbba1('0x1e')](_0xed987[_0xbba1('0x31')]['limit']);_0x2d3702[_0xbba1('0x1c')]=qs['offset'](_0xed987[_0xbba1('0x31')]['offset']);}return _0x2d8e6d[_0xbba1('0x4c')](_0x2d3702);}})[_0xbba1('0x26')](function(_0x3617cb){if(_0x3617cb){return _0x3617cb?{'count':_0x472367,'rows':_0x3617cb}:null;}})['then'](respondWithResult(_0x4c8dae,null))['catch'](handleError(_0x4c8dae,null));};exports[_0xbba1('0x50')]=function(_0x1ce7ac,_0x513868,_0x4ce47e){if(_0x1ce7ac[_0xbba1('0x4b')]['id']){delete _0x1ce7ac['body']['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x1ce7ac['params']['id']}})['then'](handleEntityNotFound(_0x513868,null))[_0xbba1('0x26')](function(_0x288abc){if(_0x288abc){_0x1ce7ac[_0xbba1('0x4b')][_0xbba1('0x51')]=_0x288abc['id'];_0x1ce7ac[_0xbba1('0x4b')][_0xbba1('0x52')]=integrations[_0xbba1('0x53')](_0x1ce7ac[_0xbba1('0x4b')]['channel'],_0x1ce7ac[_0xbba1('0x4b')][_0xbba1('0x3e')]);_0x1ce7ac[_0xbba1('0x4b')][_0xbba1('0x54')]=integrations[_0xbba1('0x55')](_0x1ce7ac[_0xbba1('0x4b')][_0xbba1('0x56')],_0x1ce7ac[_0xbba1('0x4b')][_0xbba1('0x3e')]);return db[_0xbba1('0x57')][_0xbba1('0x4a')](_0x1ce7ac[_0xbba1('0x4b')],{'include':[{'model':db[_0xbba1('0x58')],'as':_0xbba1('0x52')},{'model':db[_0xbba1('0x58')],'as':_0xbba1('0x54')}]});}return null;})[_0xbba1('0x26')](respondWithResult(_0x513868,null))[_0xbba1('0x47')](handleError(_0x513868,null));};exports[_0xbba1('0x59')]=function(_0x4cad11,_0x4830ef,_0x3d5418){var _0x50cf72='';var _0x3c98ae='';return db[_0xbba1('0x41')][_0xbba1('0x4d')]({'where':{'id':_0x4cad11[_0xbba1('0x48')]['id']},'attributes':['id',_0xbba1('0x5a'),_0xbba1('0x5b'),_0xbba1('0x5c')]})[_0xbba1('0x26')](handleEntityNotFound(_0x4830ef,null))[_0xbba1('0x26')](function(_0x34d7e5){if(_0x34d7e5){_0x3c98ae=_0x34d7e5['username'];_0x50cf72=_0x34d7e5[_0xbba1('0x5b')];var _0x24d03e=_0x34d7e5['remoteUri']['slice'](-0x1);if(_0x24d03e==='/'){_0x50cf72=_0x50cf72['substring'](0x0,_0x50cf72[_0xbba1('0x5d')](_0x24d03e));}return rp({'method':_0xbba1('0x5e'),'uri':util[_0xbba1('0x5f')](_0xbba1('0x60'),_0x50cf72,_0xbba1('0x61')),'headers':{'Authorization':_0xbba1('0x62')+_0x34d7e5[_0xbba1('0x5c')]},'json':!![]});}})[_0xbba1('0x26')](function(_0x1f8be0){if(_0x1f8be0){var _0x4c0e72=_0x1f8be0['users'];var _0x309e1a=![];var _0x727d53=null;for(_0x727d53=0x0;_0x727d53<_0x4c0e72[_0xbba1('0x4e')];_0x727d53++){if(_0x4c0e72[_0x727d53][_0xbba1('0x63')]===_0x3c98ae){_0x309e1a=!![];}}if(_0x309e1a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xbba1('0x64')});}}})[_0xbba1('0x26')](respondWithResult(_0x4830ef,null))[_0xbba1('0x47')](function(_0x42a496){var _0x89c277=_0x4cad11[_0xbba1('0x31')][_0xbba1('0x65')]?0x1f4:_0x42a496[_0xbba1('0x66')]||0x1f4;logger[_0xbba1('0x28')](_0xbba1('0x67'),_0xbba1('0x59'),_0x89c277,JSON[_0xbba1('0x68')](_0x42a496));delete _0x42a496[_0xbba1('0x2a')];if(_0x89c277===0x191){_0x89c277=0x190;}_0x4830ef['status'](_0x89c277)[_0xbba1('0x2b')](_0x4cad11[_0xbba1('0x31')][_0xbba1('0x65')]?{'message':_0xbba1('0x69'),'statusCode':_0x42a496['statusCode']}:_0x42a496);});}; \ No newline at end of file +var _0x51f9=['rows','catch','show','params','find','create','body','update','findOne','FreshsalesConfiguration','pick','nolimit','getConfigurations','addConfiguration','channel','Descriptions','FreshsalesField','remoteUri','apiKey','username','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','reject','destroy','then','sendStatus','error','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x51f9,0x15c));var _0x951f=function(_0x562362,_0x5d54f4){_0x562362=_0x562362-0x0;var _0x3a18ce=_0x51f9[_0x562362];return _0x3a18ce;};'use strict';var emlformat=require(_0x951f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x951f('0x1'));var jsonpatch=require(_0x951f('0x2'));var rp=require(_0x951f('0x3'));var moment=require(_0x951f('0x4'));var BPromise=require(_0x951f('0x5'));var Mustache=require(_0x951f('0x6'));var util=require(_0x951f('0x7'));var path=require(_0x951f('0x8'));var sox=require(_0x951f('0x9'));var csv=require(_0x951f('0xa'));var ejs=require(_0x951f('0xb'));var fs=require('fs');var fs_extra=require(_0x951f('0xc'));var _=require(_0x951f('0xd'));var squel=require(_0x951f('0xe'));var crypto=require(_0x951f('0xf'));var jsforce=require(_0x951f('0x10'));var deskjs=require(_0x951f('0x11'));var toCsv=require(_0x951f('0xa'));var querystring=require(_0x951f('0x12'));var Papa=require('papaparse');var Redis=require(_0x951f('0x13'));var authService=require(_0x951f('0x14'));var qs=require(_0x951f('0x15'));var as=require(_0x951f('0x16'));var hardwareService=require(_0x951f('0x17'));var logger=require(_0x951f('0x18'))(_0x951f('0x19'));var utils=require(_0x951f('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x951f('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x104b65,_0x712d85){_0x712d85=_0x712d85||0xcc;return function(_0x2bdb92){if(_0x2bdb92){return _0x104b65['sendStatus'](_0x712d85);}return _0x104b65['status'](_0x712d85)[_0x951f('0x1c')]();};}function respondWithResult(_0x5021bb,_0x46aec7){_0x46aec7=_0x46aec7||0xc8;return function(_0x37dd81){if(_0x37dd81){return _0x5021bb[_0x951f('0x1d')](_0x46aec7)[_0x951f('0x1e')](_0x37dd81);}};}function respondWithFilteredResult(_0x5a331e,_0x43007d){return function(_0x50a9dd){if(_0x50a9dd){var _0x333120=typeof _0x43007d[_0x951f('0x1f')]===_0x951f('0x20')&&typeof _0x43007d[_0x951f('0x21')]===_0x951f('0x20');var _0x3554d5=_0x50a9dd[_0x951f('0x22')];var _0x2a1436=_0x333120?0x0:_0x43007d[_0x951f('0x1f')];var _0x57f445=_0x333120?_0x50a9dd[_0x951f('0x22')]:_0x43007d[_0x951f('0x1f')]+_0x43007d['limit'];var _0x38f169;if(_0x57f445>=_0x3554d5){_0x57f445=_0x3554d5;_0x38f169=0xc8;}else{_0x38f169=0xce;}_0x5a331e[_0x951f('0x1d')](_0x38f169);return _0x5a331e['set'](_0x951f('0x23'),_0x2a1436+'-'+_0x57f445+'/'+_0x3554d5)[_0x951f('0x1e')](_0x50a9dd);}return null;};}function patchUpdates(_0x19a873){return function(_0x5a67d6){try{jsonpatch['apply'](_0x5a67d6,_0x19a873,!![]);}catch(_0x3c4ed5){return BPromise[_0x951f('0x24')](_0x3c4ed5);}return _0x5a67d6['save']();};}function saveUpdates(_0x59c4cc,_0xa25eab){return function(_0x1cd08f){if(_0x1cd08f){return _0x1cd08f['update'](_0x59c4cc)['then'](function(_0x49664c){return _0x49664c;});}return null;};}function removeEntity(_0x4a4844,_0x49ca1b){return function(_0x25f54d){if(_0x25f54d){return _0x25f54d[_0x951f('0x25')]()[_0x951f('0x26')](function(){_0x4a4844[_0x951f('0x1d')](0xcc)[_0x951f('0x1c')]();});}};}function handleEntityNotFound(_0x58ede5,_0xcff2f2){return function(_0x54ee2d){if(!_0x54ee2d){_0x58ede5[_0x951f('0x27')](0x194);}return _0x54ee2d;};}function handleError(_0x4349f0,_0x295990){_0x295990=_0x295990||0x1f4;return function(_0x2cbb13){logger[_0x951f('0x28')](_0x2cbb13['stack']);if(_0x2cbb13[_0x951f('0x29')]){delete _0x2cbb13[_0x951f('0x29')];}_0x4349f0[_0x951f('0x1d')](_0x295990)[_0x951f('0x2a')](_0x2cbb13);};}exports[_0x951f('0x2b')]=function(_0x5c5d6d,_0x188979){var _0x24d01d={},_0x18fc20={},_0x293abd={'count':0x0,'rows':[]};var _0x2daae2=_['map'](db[_0x951f('0x2c')][_0x951f('0x2d')],function(_0x17a6f4){return{'name':_0x17a6f4[_0x951f('0x2e')],'type':_0x17a6f4[_0x951f('0x2f')][_0x951f('0x30')]};});_0x18fc20[_0x951f('0x31')]=_[_0x951f('0x32')](_0x2daae2,_0x951f('0x29'));_0x18fc20['query']=_[_0x951f('0x33')](_0x5c5d6d['query']);_0x18fc20['filters']=_[_0x951f('0x34')](_0x18fc20['model'],_0x18fc20[_0x951f('0x35')]);_0x24d01d[_0x951f('0x36')]=_[_0x951f('0x34')](_0x18fc20[_0x951f('0x31')],qs[_0x951f('0x37')](_0x5c5d6d[_0x951f('0x35')][_0x951f('0x37')]));_0x24d01d[_0x951f('0x36')]=_0x24d01d['attributes'][_0x951f('0x38')]?_0x24d01d['attributes']:_0x18fc20['model'];if(!_0x5c5d6d[_0x951f('0x35')][_0x951f('0x39')]('nolimit')){_0x24d01d['limit']=qs[_0x951f('0x21')](_0x5c5d6d['query']['limit']);_0x24d01d[_0x951f('0x1f')]=qs[_0x951f('0x1f')](_0x5c5d6d[_0x951f('0x35')][_0x951f('0x1f')]);}_0x24d01d[_0x951f('0x3a')]=qs[_0x951f('0x3b')](_0x5c5d6d['query']['sort']);_0x24d01d[_0x951f('0x3c')]=qs[_0x951f('0x3d')](_['pick'](_0x5c5d6d[_0x951f('0x35')],_0x18fc20['filters']),_0x2daae2);if(_0x5c5d6d[_0x951f('0x35')][_0x951f('0x3e')]){_0x24d01d['where']=_[_0x951f('0x3f')](_0x24d01d[_0x951f('0x3c')],{'$or':_[_0x951f('0x32')](_0x2daae2,function(_0x6c4c97){if(_0x6c4c97[_0x951f('0x2f')]!=='VIRTUAL'){var _0x5a7058={};_0x5a7058[_0x6c4c97[_0x951f('0x29')]]={'$like':'%'+_0x5c5d6d[_0x951f('0x35')][_0x951f('0x3e')]+'%'};return _0x5a7058;}})});}_0x24d01d=_[_0x951f('0x3f')]({},_0x24d01d,_0x5c5d6d[_0x951f('0x40')]);var _0x4189c2={'where':_0x24d01d[_0x951f('0x3c')]};return db['FreshsalesAccount'][_0x951f('0x22')](_0x4189c2)['then'](function(_0x143a6b){_0x293abd[_0x951f('0x22')]=_0x143a6b;if(_0x5c5d6d['query'][_0x951f('0x41')]){_0x24d01d[_0x951f('0x42')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x951f('0x43')](_0x24d01d);})[_0x951f('0x26')](function(_0x41af90){_0x293abd[_0x951f('0x44')]=_0x41af90;return _0x293abd;})['then'](respondWithFilteredResult(_0x188979,_0x24d01d))[_0x951f('0x45')](handleError(_0x188979,null));};exports[_0x951f('0x46')]=function(_0x5cc4de,_0x5cab63){var _0x3e9f00={'raw':![],'where':{'id':_0x5cc4de[_0x951f('0x47')]['id']}},_0x3f44b0={};_0x3f44b0[_0x951f('0x31')]=_['keys'](db[_0x951f('0x2c')]['rawAttributes']);_0x3f44b0['query']=_[_0x951f('0x33')](_0x5cc4de[_0x951f('0x35')]);_0x3f44b0[_0x951f('0x3d')]=_[_0x951f('0x34')](_0x3f44b0[_0x951f('0x31')],_0x3f44b0['query']);_0x3e9f00[_0x951f('0x36')]=_[_0x951f('0x34')](_0x3f44b0[_0x951f('0x31')],qs[_0x951f('0x37')](_0x5cc4de[_0x951f('0x35')][_0x951f('0x37')]));_0x3e9f00['attributes']=_0x3e9f00[_0x951f('0x36')][_0x951f('0x38')]?_0x3e9f00[_0x951f('0x36')]:_0x3f44b0[_0x951f('0x31')];if(_0x5cc4de['query'][_0x951f('0x41')]){_0x3e9f00[_0x951f('0x42')]=[{'all':!![]}];}_0x3e9f00=_[_0x951f('0x3f')]({},_0x3e9f00,_0x5cc4de[_0x951f('0x40')]);return db[_0x951f('0x2c')][_0x951f('0x48')](_0x3e9f00)[_0x951f('0x26')](handleEntityNotFound(_0x5cab63,null))[_0x951f('0x26')](respondWithResult(_0x5cab63,null))['catch'](handleError(_0x5cab63,null));};exports[_0x951f('0x49')]=function(_0x4c6d6d,_0xeaebcb){return db['FreshsalesAccount']['create'](_0x4c6d6d[_0x951f('0x4a')],{})[_0x951f('0x26')](respondWithResult(_0xeaebcb,0xc9))['catch'](handleError(_0xeaebcb,null));};exports[_0x951f('0x4b')]=function(_0x31a311,_0x19addc){if(_0x31a311[_0x951f('0x4a')]['id']){delete _0x31a311[_0x951f('0x4a')]['id'];}return db['FreshsalesAccount'][_0x951f('0x48')]({'where':{'id':_0x31a311[_0x951f('0x47')]['id']}})['then'](handleEntityNotFound(_0x19addc,null))['then'](saveUpdates(_0x31a311[_0x951f('0x4a')],null))[_0x951f('0x26')](respondWithResult(_0x19addc,null))[_0x951f('0x45')](handleError(_0x19addc,null));};exports[_0x951f('0x25')]=function(_0x32692d,_0x2eab77){return db['FreshsalesAccount'][_0x951f('0x48')]({'where':{'id':_0x32692d['params']['id']}})['then'](handleEntityNotFound(_0x2eab77,null))[_0x951f('0x26')](removeEntity(_0x2eab77,null))[_0x951f('0x45')](handleError(_0x2eab77,null));};exports['getConfigurations']=function(_0x323316,_0x1c12ab,_0x3204c6){var _0x26af3a={};var _0x263ca6={};var _0x489728;var _0x742f1;return db[_0x951f('0x2c')][_0x951f('0x4c')]({'where':{'id':_0x323316[_0x951f('0x47')]['id']}})[_0x951f('0x26')](handleEntityNotFound(_0x1c12ab,null))[_0x951f('0x26')](function(_0x1bc2d6){if(_0x1bc2d6){_0x489728=_0x1bc2d6;_0x263ca6[_0x951f('0x31')]=_[_0x951f('0x33')](db[_0x951f('0x4d')][_0x951f('0x2d')]);_0x263ca6[_0x951f('0x35')]=_['keys'](_0x323316['query']);_0x263ca6[_0x951f('0x3d')]=_[_0x951f('0x34')](_0x263ca6[_0x951f('0x31')],_0x263ca6[_0x951f('0x35')]);_0x26af3a[_0x951f('0x36')]=_[_0x951f('0x34')](_0x263ca6[_0x951f('0x31')],qs[_0x951f('0x37')](_0x323316['query'][_0x951f('0x37')]));_0x26af3a[_0x951f('0x36')]=_0x26af3a['attributes'][_0x951f('0x38')]?_0x26af3a['attributes']:_0x263ca6[_0x951f('0x31')];_0x26af3a[_0x951f('0x3a')]=qs[_0x951f('0x3b')](_0x323316[_0x951f('0x35')][_0x951f('0x3b')]);_0x26af3a[_0x951f('0x3c')]=qs['filters'](_[_0x951f('0x4e')](_0x323316['query'],_0x263ca6[_0x951f('0x3d')]));if(_0x323316[_0x951f('0x35')]['filter']){_0x26af3a[_0x951f('0x3c')]=_[_0x951f('0x3f')](_0x26af3a[_0x951f('0x3c')],{'$or':_[_0x951f('0x32')](_0x26af3a[_0x951f('0x36')],function(_0x574c1a){var _0x48a45e={};_0x48a45e[_0x574c1a]={'$like':'%'+_0x323316[_0x951f('0x35')]['filter']+'%'};return _0x48a45e;})});}_0x26af3a=_[_0x951f('0x3f')]({},_0x26af3a,_0x323316[_0x951f('0x40')]);return _0x489728['getConfigurations'](_0x26af3a);}})[_0x951f('0x26')](function(_0x580197){if(_0x580197){_0x742f1=_0x580197[_0x951f('0x38')];if(!_0x323316['query'][_0x951f('0x39')](_0x951f('0x4f'))){_0x26af3a[_0x951f('0x21')]=qs[_0x951f('0x21')](_0x323316[_0x951f('0x35')][_0x951f('0x21')]);_0x26af3a[_0x951f('0x1f')]=qs['offset'](_0x323316[_0x951f('0x35')][_0x951f('0x1f')]);}return _0x489728[_0x951f('0x50')](_0x26af3a);}})[_0x951f('0x26')](function(_0x34622c){if(_0x34622c){return _0x34622c?{'count':_0x742f1,'rows':_0x34622c}:null;}})[_0x951f('0x26')](respondWithResult(_0x1c12ab,null))['catch'](handleError(_0x1c12ab,null));};exports[_0x951f('0x51')]=function(_0x25e4d1,_0x15b798,_0x1ce9d1){if(_0x25e4d1['body']['id']){delete _0x25e4d1[_0x951f('0x4a')]['id'];}return db[_0x951f('0x2c')][_0x951f('0x4c')]({'where':{'id':_0x25e4d1[_0x951f('0x47')]['id']}})[_0x951f('0x26')](handleEntityNotFound(_0x15b798,null))['then'](function(_0x15d6d3){if(_0x15d6d3){_0x25e4d1[_0x951f('0x4a')]['AccountId']=_0x15d6d3['id'];_0x25e4d1[_0x951f('0x4a')]['Subjects']=integrations['getSubjects'](_0x25e4d1[_0x951f('0x4a')][_0x951f('0x52')],_0x25e4d1[_0x951f('0x4a')][_0x951f('0x2f')]);_0x25e4d1[_0x951f('0x4a')][_0x951f('0x53')]=integrations['getDescriptions'](_0x25e4d1[_0x951f('0x4a')][_0x951f('0x52')],_0x25e4d1[_0x951f('0x4a')][_0x951f('0x2f')]);return db['FreshsalesConfiguration'][_0x951f('0x49')](_0x25e4d1[_0x951f('0x4a')],{'include':[{'model':db[_0x951f('0x54')],'as':'Subjects'},{'model':db[_0x951f('0x54')],'as':_0x951f('0x53')}]});}return null;})['then'](respondWithResult(_0x15b798,null))[_0x951f('0x45')](handleError(_0x15b798,null));};exports['getFields']=function(_0xe18f23,_0xdf8927,_0x2b5153){var _0x45a844='';var _0xe69edf='';return db[_0x951f('0x2c')]['findOne']({'where':{'id':_0xe18f23[_0x951f('0x47')]['id']},'attributes':['id','username',_0x951f('0x55'),_0x951f('0x56')]})[_0x951f('0x26')](handleEntityNotFound(_0xdf8927,null))['then'](function(_0x5639e9){if(_0x5639e9){_0xe69edf=_0x5639e9[_0x951f('0x57')];_0x45a844=_0x5639e9[_0x951f('0x55')];var _0x4bbe02=_0x5639e9[_0x951f('0x55')][_0x951f('0x58')](-0x1);if(_0x4bbe02==='/'){_0x45a844=_0x45a844[_0x951f('0x59')](0x0,_0x45a844[_0x951f('0x5a')](_0x4bbe02));}return rp({'method':_0x951f('0x5b'),'uri':util['format'](_0x951f('0x5c'),_0x45a844,_0x951f('0x5d')),'headers':{'Authorization':_0x951f('0x5e')+_0x5639e9[_0x951f('0x56')]},'json':!![]});}})[_0x951f('0x26')](function(_0x12c492){if(_0x12c492){var _0x2f85df=_0x12c492[_0x951f('0x5f')];var _0x589768=![];var _0x312254=null;for(_0x312254=0x0;_0x312254<_0x2f85df['length'];_0x312254++){if(_0x2f85df[_0x312254][_0x951f('0x60')]===_0xe69edf){_0x589768=!![];}}if(_0x589768){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x951f('0x61')});}}})[_0x951f('0x26')](respondWithResult(_0xdf8927,null))[_0x951f('0x45')](function(_0x1bfb8c){var _0xb4e333=_0xe18f23[_0x951f('0x35')][_0x951f('0x62')]?0x1f4:_0x1bfb8c['statusCode']||0x1f4;logger['error'](_0x951f('0x63'),_0x951f('0x64'),_0xb4e333,JSON[_0x951f('0x65')](_0x1bfb8c));delete _0x1bfb8c[_0x951f('0x29')];if(_0xb4e333===0x191){_0xb4e333=0x190;}_0xdf8927[_0x951f('0x1d')](_0xb4e333)[_0x951f('0x2a')](_0xe18f23[_0x951f('0x35')][_0x951f('0x62')]?{'message':_0x951f('0x66'),'statusCode':_0x1bfb8c[_0x951f('0x67')]}:_0x1bfb8c);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 49d2c96..8ee627d 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 _0xacf4=['define','FreshsalesAccount','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x1a88f4,_0x310292){var _0x51c918=function(_0x4aeaca){while(--_0x4aeaca){_0x1a88f4['push'](_0x1a88f4['shift']());}};_0x51c918(++_0x310292);}(_0xacf4,0xe7));var _0x4acf=function(_0x5ea2f9,_0x320917){_0x5ea2f9=_0x5ea2f9-0x0;var _0x36e586=_0xacf4[_0x5ea2f9];return _0x36e586;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));var integrations=require(_0x4acf('0x8'));module['exports']=function(_0x24bf24,_0x2ba08a){return _0x24bf24[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82c4=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','exports'];(function(_0x1e1b69,_0x240177){var _0x36b2a1=function(_0x2416af){while(--_0x2416af){_0x1e1b69['push'](_0x1e1b69['shift']());}};_0x36b2a1(++_0x240177);}(_0x82c4,0x1ca));var _0x482c=function(_0x5182be,_0x1a14af){_0x5182be=_0x5182be-0x0;var _0x355ea9=_0x82c4[_0x5182be];return _0x355ea9;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x482c('0x9')]=function(_0x5d7c76,_0xfdb92){return _0x5d7c76[_0x482c('0xa')](_0x482c('0xb'),attributes,{'tableName':_0x482c('0xc'),'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 d9cdca3..40588fb 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 _0x0424=['info','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','model','map','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4f4c7f,_0x191113){var _0x428a10=function(_0x315a50){while(--_0x315a50){_0x4f4c7f['push'](_0x4f4c7f['shift']());}};_0x428a10(++_0x191113);}(_0x0424,0x159));var _0x4042=function(_0x5377a1,_0x22e1e4){_0x5377a1=_0x5377a1-0x0;var _0x45ff6f=_0x0424[_0x5377a1];return _0x45ff6f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['findAll']({'raw':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x466077[_0x4042('0x17')]?_0x466077['options'][_0x4042('0x19')]||null:null,'attributes':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1a')]||null:null,'limit':_0x466077['options']?_0x466077[_0x4042('0x17')][_0x4042('0x1b')]||null:null,'include':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1c')]?_['map'](_0x466077[_0x4042('0x17')][_0x4042('0x1c')],function(_0x519f2c){return{'model':db[_0x519f2c[_0x4042('0x1d')]],'as':_0x519f2c['as'],'attributes':_0x519f2c['attributes'],'include':_0x519f2c[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x519f2c[_0x4042('0x1c')],function(_0x5d5c6d){return{'model':db[_0x5d5c6d[_0x4042('0x1d')]],'as':_0x5d5c6d['as'],'attributes':_0x5d5c6d[_0x4042('0x1a')],'include':_0x5d5c6d[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x5d5c6d[_0x4042('0x1c')],function(_0x52e575){return{'model':db[_0x52e575['model']],'as':_0x52e575['as'],'attributes':_0x52e575[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26542c){logger[_0x4042('0x12')](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('GetFreshsalesAccount',_0x466077,JSON[_0x4042('0xf')](_0x26542c));_0xe5c1ec(_0x26542c);})[_0x4042('0x14')](function(_0x4a6a6e){logger[_0x4042('0x10')](_0x4042('0x15'),_0x4a6a6e[_0x4042('0x11')],_0x466077);_0x4fe024(_0x4b02d4['error'](0x1f4,_0x4a6a6e['message']));});});};exports[_0x4042('0x1f')]=function(_0x43bd1c){var _0x59773f=this;return new Promise(function(_0x3e9304,_0xc42d70){return db[_0x4042('0x16')][_0x4042('0x20')]({'raw':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['where']||null:null,'attributes':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['attributes']||null:null,'include':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['include']?_[_0x4042('0x1e')](_0x43bd1c[_0x4042('0x17')][_0x4042('0x1c')],function(_0xaa7c99){return{'model':db[_0xaa7c99[_0x4042('0x1d')]],'as':_0xaa7c99['as'],'attributes':_0xaa7c99[_0x4042('0x1a')],'include':_0xaa7c99[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0xaa7c99[_0x4042('0x1c')],function(_0x37195b){return{'model':db[_0x37195b[_0x4042('0x1d')]],'as':_0x37195b['as'],'attributes':_0x37195b[_0x4042('0x1a')],'include':_0x37195b[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x37195b[_0x4042('0x1c')],function(_0x2b5f5e){return{'model':db[_0x2b5f5e[_0x4042('0x1d')]],'as':_0x2b5f5e['as'],'attributes':_0x2b5f5e[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26b7b0){logger[_0x4042('0x12')]('ShowFreshsalesAccount',_0x43bd1c);logger[_0x4042('0xd')](_0x4042('0x1f'),_0x43bd1c,JSON[_0x4042('0xf')](_0x26b7b0));_0x3e9304(_0x26b7b0);})[_0x4042('0x14')](function(_0x588932){logger[_0x4042('0x10')](_0x4042('0x1f'),_0x588932[_0x4042('0x11')],_0x43bd1c);_0xc42d70(_0x59773f[_0x4042('0x10')](0x1f4,_0x588932[_0x4042('0x11')]));});});}; \ No newline at end of file +var _0x81c6=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','ShowFreshsalesAccount','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x4c5773,_0x390f63){var _0x5de7b0=function(_0x327a4e){while(--_0x327a4e){_0x4c5773['push'](_0x4c5773['shift']());}};_0x5de7b0(++_0x390f63);}(_0x81c6,0x1d5));var _0x681c=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x81c6[_0x79b649];return _0x1af9b1;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});}exports[_0x681c('0x15')]=function(_0x42f506){var _0x4a9192=this;return new Promise(function(_0x42304f,_0x5b03fd){return db[_0x681c('0x16')][_0x681c('0x17')]({'raw':_0x42f506['options']?_0x42f506[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')]['attributes']||null:null,'limit':_0x42f506['options']?_0x42f506['options'][_0x681c('0x1a')]||null:null,'include':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x42f506[_0x681c('0x18')][_0x681c('0x1b')],function(_0x3d0297){return{'model':db[_0x3d0297[_0x681c('0x1d')]],'as':_0x3d0297['as'],'attributes':_0x3d0297[_0x681c('0x1e')],'include':_0x3d0297[_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x3d0297[_0x681c('0x1b')],function(_0x218410){return{'model':db[_0x218410[_0x681c('0x1d')]],'as':_0x218410['as'],'attributes':_0x218410[_0x681c('0x1e')],'include':_0x218410['include']?_[_0x681c('0x1c')](_0x218410['include'],function(_0x5f8d64){return{'model':db[_0x5f8d64['model']],'as':_0x5f8d64['as'],'attributes':_0x5f8d64['attributes']};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x17ea7c){logger[_0x681c('0x12')](_0x681c('0x15'),_0x42f506);logger['debug'](_0x681c('0x15'),_0x42f506,JSON[_0x681c('0xe')](_0x17ea7c));_0x42304f(_0x17ea7c);})[_0x681c('0x14')](function(_0x936fce){logger[_0x681c('0x10')](_0x681c('0x15'),_0x936fce[_0x681c('0x11')],_0x42f506);_0x5b03fd(_0x4a9192['error'](0x1f4,_0x936fce[_0x681c('0x11')]));});});};exports[_0x681c('0x1f')]=function(_0x2e783d){var _0x4af6aa=this;return new Promise(function(_0x385b14,_0x2179cd){return db[_0x681c('0x16')]['find']({'raw':_0x2e783d[_0x681c('0x18')]?_0x2e783d['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e783d[_0x681c('0x18')]?_0x2e783d[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x2e783d['options']?_0x2e783d[_0x681c('0x18')]['attributes']||null:null,'include':_0x2e783d[_0x681c('0x18')]?_0x2e783d['options']['include']?_['map'](_0x2e783d[_0x681c('0x18')][_0x681c('0x1b')],function(_0x5a349a){return{'model':db[_0x5a349a[_0x681c('0x1d')]],'as':_0x5a349a['as'],'attributes':_0x5a349a['attributes'],'include':_0x5a349a['include']?_[_0x681c('0x1c')](_0x5a349a['include'],function(_0x35991d){return{'model':db[_0x35991d[_0x681c('0x1d')]],'as':_0x35991d['as'],'attributes':_0x35991d[_0x681c('0x1e')],'include':_0x35991d['include']?_['map'](_0x35991d[_0x681c('0x1b')],function(_0x4545ff){return{'model':db[_0x4545ff['model']],'as':_0x4545ff['as'],'attributes':_0x4545ff[_0x681c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x302dab){logger['info'](_0x681c('0x1f'),_0x2e783d);logger[_0x681c('0xb')]('ShowFreshsalesAccount',_0x2e783d,JSON[_0x681c('0xe')](_0x302dab));_0x385b14(_0x302dab);})[_0x681c('0x14')](function(_0x83953c){logger[_0x681c('0x10')](_0x681c('0x1f'),_0x83953c['message'],_0x2e783d);_0x2179cd(_0x4af6aa['error'](0x1f4,_0x83953c[_0x681c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 259ddb5..dd4dbd8 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 _0x9677=['isAuthenticated','index','/:id','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x578d57,_0x3f3626){var _0x2e944a=function(_0x42a709){while(--_0x42a709){_0x578d57['push'](_0x578d57['shift']());}};_0x2e944a(++_0x3f3626);}(_0x9677,0x10a));var _0x7967=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0x9677[_0x1cb0b4];return _0x525b60;};'use strict';var multer=require(_0x7967('0x0'));var util=require(_0x7967('0x1'));var path=require(_0x7967('0x2'));var timeout=require(_0x7967('0x3'));var express=require(_0x7967('0x4'));var router=express[_0x7967('0x5')]();var fs_extra=require(_0x7967('0x6'));var auth=require(_0x7967('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7967('0x8'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x7967('0x9')]('/',auth[_0x7967('0xa')](),controller[_0x7967('0xb')]);router[_0x7967('0x9')](_0x7967('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7967('0x9')]('/:id/subjects',auth[_0x7967('0xa')](),controller[_0x7967('0xd')]);router[_0x7967('0x9')](_0x7967('0xe'),auth[_0x7967('0xa')](),controller[_0x7967('0xf')]);router[_0x7967('0x9')](_0x7967('0x10'),auth['isAuthenticated'](),controller[_0x7967('0x11')]);router[_0x7967('0x12')]('/',auth[_0x7967('0xa')](),controller[_0x7967('0x13')]);router[_0x7967('0x14')](_0x7967('0xc'),auth[_0x7967('0xa')](),controller['update']);router['delete'](_0x7967('0xc'),auth[_0x7967('0xa')](),controller[_0x7967('0x15')]);module[_0x7967('0x16')]=router; \ No newline at end of file +var _0x84c0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','/:id','show','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','/:id/fields','post','put','update','delete','exports','multer','util','path'];(function(_0x5062fe,_0x320aeb){var _0x5c311a=function(_0x20a3ae){while(--_0x20a3ae){_0x5062fe['push'](_0x5062fe['shift']());}};_0x5c311a(++_0x320aeb);}(_0x84c0,0xc3));var _0x084c=function(_0x165b85,_0x29922a){_0x165b85=_0x165b85-0x0;var _0x21f442=_0x84c0[_0x165b85];return _0x21f442;};'use strict';var multer=require(_0x084c('0x0'));var util=require(_0x084c('0x1'));var path=require(_0x084c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x084c('0x3')]();var fs_extra=require(_0x084c('0x4'));var auth=require(_0x084c('0x5'));var interaction=require(_0x084c('0x6'));var config=require(_0x084c('0x7'));var controller=require(_0x084c('0x8'));router[_0x084c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x084c('0x9')](_0x084c('0xa'),auth['isAuthenticated'](),controller[_0x084c('0xb')]);router[_0x084c('0x9')](_0x084c('0xc'),auth[_0x084c('0xd')](),controller[_0x084c('0xe')]);router[_0x084c('0x9')](_0x084c('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x084c('0x9')](_0x084c('0x10'),auth[_0x084c('0xd')](),controller['getFields']);router[_0x084c('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x084c('0x12')](_0x084c('0xa'),auth[_0x084c('0xd')](),controller[_0x084c('0x13')]);router[_0x084c('0x14')](_0x084c('0xa'),auth[_0x084c('0xd')](),controller['destroy']);module[_0x084c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7d173ae..b3c5078 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 _0x887a=['sequelize','exports','STRING'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x887a,0x87));var _0xa887=function(_0x530f38,_0x516868){_0x530f38=_0x530f38-0x0;var _0x568fd6=_0x887a[_0x530f38];return _0x568fd6;};'use strict';var Sequelize=require(_0xa887('0x0'));module[_0xa887('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa887('0x2')]}}; \ No newline at end of file +var _0xe54a=['STRING'];(function(_0x29e27e,_0x5eb221){var _0x202d9b=function(_0x4c06f1){while(--_0x4c06f1){_0x29e27e['push'](_0x29e27e['shift']());}};_0x202d9b(++_0x5eb221);}(_0xe54a,0x15a));var _0xae54=function(_0x417c88,_0x10fc87){_0x417c88=_0x417c88-0x0;var _0x43f316=_0xe54a[_0x417c88];return _0x43f316;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xae54('0x0')]},'description':{'type':Sequelize[_0xae54('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ca2ec8c..25f209f 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 _0x2963=['findAll','show','params','keys','merge','find','catch','create','body','findOne','FreshsalesField','filter','getSubjects','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','options','FreshsalesConfiguration','includeAll','include'];(function(_0x323642,_0x3141ff){var _0x5d6777=function(_0x4c5512){while(--_0x4c5512){_0x323642['push'](_0x323642['shift']());}};_0x5d6777(++_0x3141ff);}(_0x2963,0xff));var _0x3296=function(_0x33dc99,_0x618fb6){_0x33dc99=_0x33dc99-0x0;var _0x477750=_0x2963[_0x33dc99];return _0x477750;};'use strict';var emlformat=require(_0x3296('0x0'));var rimraf=require(_0x3296('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3296('0x2'));var rp=require(_0x3296('0x3'));var moment=require(_0x3296('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3296('0x5'));var path=require('path');var sox=require(_0x3296('0x6'));var csv=require('to-csv');var ejs=require(_0x3296('0x7'));var fs=require('fs');var fs_extra=require(_0x3296('0x8'));var _=require(_0x3296('0x9'));var squel=require(_0x3296('0xa'));var crypto=require(_0x3296('0xb'));var jsforce=require(_0x3296('0xc'));var deskjs=require(_0x3296('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3296('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3296('0xf'));var hardwareService=require(_0x3296('0x10'));var logger=require('../../config/logger')(_0x3296('0x11'));var utils=require(_0x3296('0x12'));var config=require(_0x3296('0x13'));var licenseUtil=require(_0x3296('0x14'));var db=require(_0x3296('0x15'))['db'];function respondWithStatusCode(_0x347094,_0x35786e){_0x35786e=_0x35786e||0xcc;return function(_0x5fa987){if(_0x5fa987){return _0x347094['sendStatus'](_0x35786e);}return _0x347094['status'](_0x35786e)[_0x3296('0x16')]();};}function respondWithResult(_0x32c2ff,_0x37494a){_0x37494a=_0x37494a||0xc8;return function(_0x4d815b){if(_0x4d815b){return _0x32c2ff[_0x3296('0x17')](_0x37494a)[_0x3296('0x18')](_0x4d815b);}};}function respondWithFilteredResult(_0x2f01c4,_0x35875e){return function(_0x48fb1f){if(_0x48fb1f){var _0x4b5acf=typeof _0x35875e['offset']===_0x3296('0x19')&&typeof _0x35875e['limit']===_0x3296('0x19');var _0x4c72ea=_0x48fb1f[_0x3296('0x1a')];var _0x4b67fd=_0x4b5acf?0x0:_0x35875e[_0x3296('0x1b')];var _0x4dae1f=_0x4b5acf?_0x48fb1f[_0x3296('0x1a')]:_0x35875e[_0x3296('0x1b')]+_0x35875e['limit'];var _0x285ff8;if(_0x4dae1f>=_0x4c72ea){_0x4dae1f=_0x4c72ea;_0x285ff8=0xc8;}else{_0x285ff8=0xce;}_0x2f01c4[_0x3296('0x17')](_0x285ff8);return _0x2f01c4['set'](_0x3296('0x1c'),_0x4b67fd+'-'+_0x4dae1f+'/'+_0x4c72ea)[_0x3296('0x18')](_0x48fb1f);}return null;};}function patchUpdates(_0x34fd02){return function(_0xc8afb8){try{jsonpatch[_0x3296('0x1d')](_0xc8afb8,_0x34fd02,!![]);}catch(_0x55f637){return BPromise[_0x3296('0x1e')](_0x55f637);}return _0xc8afb8[_0x3296('0x1f')]();};}function saveUpdates(_0x274592,_0x3fc52a){return function(_0x369900){if(_0x369900){return _0x369900[_0x3296('0x20')](_0x274592)['then'](function(_0x2564f0){return _0x2564f0;});}return null;};}function removeEntity(_0x1e9e4a,_0x21162f){return function(_0x3e1324){if(_0x3e1324){return _0x3e1324[_0x3296('0x21')]()[_0x3296('0x22')](function(){_0x1e9e4a['status'](0xcc)[_0x3296('0x16')]();});}};}function handleEntityNotFound(_0x2f3554,_0x2dd133){return function(_0x50a3f0){if(!_0x50a3f0){_0x2f3554[_0x3296('0x23')](0x194);}return _0x50a3f0;};}function handleError(_0x9d130,_0x2e7bf2){_0x2e7bf2=_0x2e7bf2||0x1f4;return function(_0x42bd18){logger[_0x3296('0x24')](_0x42bd18[_0x3296('0x25')]);if(_0x42bd18['name']){delete _0x42bd18[_0x3296('0x26')];}_0x9d130[_0x3296('0x17')](_0x2e7bf2)[_0x3296('0x27')](_0x42bd18);};}exports[_0x3296('0x28')]=function(_0x270389,_0x355bae){var _0xff0029={},_0x5dd0cd={},_0x5822e8={'count':0x0,'rows':[]};var _0x1d81eb=_[_0x3296('0x29')](db['FreshsalesConfiguration'][_0x3296('0x2a')],function(_0x12ff08){return{'name':_0x12ff08[_0x3296('0x2b')],'type':_0x12ff08[_0x3296('0x2c')][_0x3296('0x2d')]};});_0x5dd0cd['model']=_[_0x3296('0x29')](_0x1d81eb,_0x3296('0x26'));_0x5dd0cd['query']=_['keys'](_0x270389[_0x3296('0x2e')]);_0x5dd0cd[_0x3296('0x2f')]=_[_0x3296('0x30')](_0x5dd0cd[_0x3296('0x31')],_0x5dd0cd[_0x3296('0x2e')]);_0xff0029[_0x3296('0x32')]=_[_0x3296('0x30')](_0x5dd0cd[_0x3296('0x31')],qs['fields'](_0x270389[_0x3296('0x2e')][_0x3296('0x33')]));_0xff0029[_0x3296('0x32')]=_0xff0029[_0x3296('0x32')][_0x3296('0x34')]?_0xff0029[_0x3296('0x32')]:_0x5dd0cd[_0x3296('0x31')];if(!_0x270389['query'][_0x3296('0x35')](_0x3296('0x36'))){_0xff0029['limit']=qs[_0x3296('0x37')](_0x270389[_0x3296('0x2e')][_0x3296('0x37')]);_0xff0029[_0x3296('0x1b')]=qs[_0x3296('0x1b')](_0x270389['query'][_0x3296('0x1b')]);}_0xff0029[_0x3296('0x38')]=qs[_0x3296('0x39')](_0x270389[_0x3296('0x2e')][_0x3296('0x39')]);_0xff0029['where']=qs['filters'](_[_0x3296('0x3a')](_0x270389['query'],_0x5dd0cd[_0x3296('0x2f')]),_0x1d81eb);if(_0x270389[_0x3296('0x2e')]['filter']){_0xff0029[_0x3296('0x3b')]=_['merge'](_0xff0029[_0x3296('0x3b')],{'$or':_[_0x3296('0x29')](_0x1d81eb,function(_0x2bab1e){if(_0x2bab1e[_0x3296('0x2c')]!==_0x3296('0x3c')){var _0x125bd0={};_0x125bd0[_0x2bab1e[_0x3296('0x26')]]={'$like':'%'+_0x270389[_0x3296('0x2e')]['filter']+'%'};return _0x125bd0;}})});}_0xff0029=_['merge']({},_0xff0029,_0x270389[_0x3296('0x3d')]);var _0x54f033={'where':_0xff0029[_0x3296('0x3b')]};return db[_0x3296('0x3e')][_0x3296('0x1a')](_0x54f033)[_0x3296('0x22')](function(_0x1c1ffa){_0x5822e8['count']=_0x1c1ffa;if(_0x270389['query'][_0x3296('0x3f')]){_0xff0029[_0x3296('0x40')]=[{'all':!![]}];}return db[_0x3296('0x3e')][_0x3296('0x41')](_0xff0029);})[_0x3296('0x22')](function(_0xa2d368){_0x5822e8['rows']=_0xa2d368;return _0x5822e8;})[_0x3296('0x22')](respondWithFilteredResult(_0x355bae,_0xff0029))['catch'](handleError(_0x355bae,null));};exports[_0x3296('0x42')]=function(_0x3643d7,_0x4fce76){var _0x252aab={'raw':![],'where':{'id':_0x3643d7[_0x3296('0x43')]['id']}},_0x20755d={};_0x20755d['model']=_[_0x3296('0x44')](db[_0x3296('0x3e')]['rawAttributes']);_0x20755d[_0x3296('0x2e')]=_[_0x3296('0x44')](_0x3643d7[_0x3296('0x2e')]);_0x20755d[_0x3296('0x2f')]=_['intersection'](_0x20755d['model'],_0x20755d[_0x3296('0x2e')]);_0x252aab['attributes']=_[_0x3296('0x30')](_0x20755d[_0x3296('0x31')],qs[_0x3296('0x33')](_0x3643d7[_0x3296('0x2e')][_0x3296('0x33')]));_0x252aab[_0x3296('0x32')]=_0x252aab[_0x3296('0x32')][_0x3296('0x34')]?_0x252aab[_0x3296('0x32')]:_0x20755d[_0x3296('0x31')];if(_0x3643d7[_0x3296('0x2e')][_0x3296('0x3f')]){_0x252aab['include']=[{'all':!![]}];}_0x252aab=_[_0x3296('0x45')]({},_0x252aab,_0x3643d7['options']);return db[_0x3296('0x3e')][_0x3296('0x46')](_0x252aab)[_0x3296('0x22')](handleEntityNotFound(_0x4fce76,null))[_0x3296('0x22')](respondWithResult(_0x4fce76,null))[_0x3296('0x47')](handleError(_0x4fce76,null));};exports[_0x3296('0x48')]=function(_0x2ba27f,_0x44a86b){return db['FreshsalesConfiguration'][_0x3296('0x48')](_0x2ba27f[_0x3296('0x49')],{})[_0x3296('0x22')](respondWithResult(_0x44a86b,0xc9))[_0x3296('0x47')](handleError(_0x44a86b,null));};exports[_0x3296('0x20')]=function(_0x29059a,_0x583574){if(_0x29059a[_0x3296('0x49')]['id']){delete _0x29059a[_0x3296('0x49')]['id'];}return db[_0x3296('0x3e')][_0x3296('0x46')]({'where':{'id':_0x29059a[_0x3296('0x43')]['id']}})[_0x3296('0x22')](handleEntityNotFound(_0x583574,null))['then'](saveUpdates(_0x29059a['body'],null))['then'](respondWithResult(_0x583574,null))[_0x3296('0x47')](handleError(_0x583574,null));};exports['destroy']=function(_0x3ea442,_0x670997){return db[_0x3296('0x3e')][_0x3296('0x46')]({'where':{'id':_0x3ea442[_0x3296('0x43')]['id']}})[_0x3296('0x22')](handleEntityNotFound(_0x670997,null))[_0x3296('0x22')](removeEntity(_0x670997,null))[_0x3296('0x47')](handleError(_0x670997,null));};exports['getSubjects']=function(_0x234235,_0x1e58f0,_0x2b67b8){var _0x1ac9f8={};var _0x596038={};var _0x598ae7;var _0x3a2164;return db[_0x3296('0x3e')][_0x3296('0x4a')]({'where':{'id':_0x234235[_0x3296('0x43')]['id']}})[_0x3296('0x22')](handleEntityNotFound(_0x1e58f0,null))[_0x3296('0x22')](function(_0x4b5a2a){if(_0x4b5a2a){_0x598ae7=_0x4b5a2a;_0x596038[_0x3296('0x31')]=_[_0x3296('0x44')](db[_0x3296('0x4b')][_0x3296('0x2a')]);_0x596038['query']=_[_0x3296('0x44')](_0x234235[_0x3296('0x2e')]);_0x596038[_0x3296('0x2f')]=_[_0x3296('0x30')](_0x596038['model'],_0x596038[_0x3296('0x2e')]);_0x1ac9f8[_0x3296('0x32')]=_['intersection'](_0x596038['model'],qs[_0x3296('0x33')](_0x234235[_0x3296('0x2e')]['fields']));_0x1ac9f8['attributes']=_0x1ac9f8[_0x3296('0x32')]['length']?_0x1ac9f8[_0x3296('0x32')]:_0x596038[_0x3296('0x31')];_0x1ac9f8[_0x3296('0x38')]=qs[_0x3296('0x39')](_0x234235['query'][_0x3296('0x39')]);_0x1ac9f8[_0x3296('0x3b')]=qs['filters'](_['pick'](_0x234235[_0x3296('0x2e')],_0x596038['filters']));if(_0x234235[_0x3296('0x2e')][_0x3296('0x4c')]){_0x1ac9f8[_0x3296('0x3b')]=_[_0x3296('0x45')](_0x1ac9f8[_0x3296('0x3b')],{'$or':_[_0x3296('0x29')](_0x1ac9f8[_0x3296('0x32')],function(_0x597c75){var _0x15bd75={};_0x15bd75[_0x597c75]={'$like':'%'+_0x234235[_0x3296('0x2e')][_0x3296('0x4c')]+'%'};return _0x15bd75;})});}_0x1ac9f8=_[_0x3296('0x45')]({},_0x1ac9f8,_0x234235[_0x3296('0x3d')]);return _0x598ae7[_0x3296('0x4d')](_0x1ac9f8);}})['then'](function(_0x201927){if(_0x201927){_0x3a2164=_0x201927[_0x3296('0x34')];if(!_0x234235[_0x3296('0x2e')][_0x3296('0x35')](_0x3296('0x36'))){_0x1ac9f8[_0x3296('0x37')]=qs[_0x3296('0x37')](_0x234235[_0x3296('0x2e')][_0x3296('0x37')]);_0x1ac9f8[_0x3296('0x1b')]=qs[_0x3296('0x1b')](_0x234235[_0x3296('0x2e')][_0x3296('0x1b')]);}return _0x598ae7[_0x3296('0x4d')](_0x1ac9f8);}})[_0x3296('0x22')](function(_0x336e6d){if(_0x336e6d){return _0x336e6d?{'count':_0x3a2164,'rows':_0x336e6d}:null;}})['then'](respondWithResult(_0x1e58f0,null))[_0x3296('0x47')](handleError(_0x1e58f0,null));};exports[_0x3296('0x4e')]=function(_0x4e636f,_0x50a9fa,_0x2decab){var _0x3f49d7={};var _0x4909af={};var _0x53b32a;var _0x4c702f;return db['FreshsalesConfiguration'][_0x3296('0x4a')]({'where':{'id':_0x4e636f[_0x3296('0x43')]['id']}})[_0x3296('0x22')](handleEntityNotFound(_0x50a9fa,null))[_0x3296('0x22')](function(_0x5dc58f){if(_0x5dc58f){_0x53b32a=_0x5dc58f;_0x4909af[_0x3296('0x31')]=_[_0x3296('0x44')](db[_0x3296('0x4b')][_0x3296('0x2a')]);_0x4909af['query']=_[_0x3296('0x44')](_0x4e636f[_0x3296('0x2e')]);_0x4909af[_0x3296('0x2f')]=_[_0x3296('0x30')](_0x4909af['model'],_0x4909af[_0x3296('0x2e')]);_0x3f49d7[_0x3296('0x32')]=_[_0x3296('0x30')](_0x4909af[_0x3296('0x31')],qs['fields'](_0x4e636f[_0x3296('0x2e')]['fields']));_0x3f49d7[_0x3296('0x32')]=_0x3f49d7[_0x3296('0x32')][_0x3296('0x34')]?_0x3f49d7[_0x3296('0x32')]:_0x4909af[_0x3296('0x31')];_0x3f49d7[_0x3296('0x38')]=qs[_0x3296('0x39')](_0x4e636f[_0x3296('0x2e')][_0x3296('0x39')]);_0x3f49d7[_0x3296('0x3b')]=qs[_0x3296('0x2f')](_[_0x3296('0x3a')](_0x4e636f['query'],_0x4909af[_0x3296('0x2f')]));if(_0x4e636f[_0x3296('0x2e')][_0x3296('0x4c')]){_0x3f49d7[_0x3296('0x3b')]=_[_0x3296('0x45')](_0x3f49d7[_0x3296('0x3b')],{'$or':_[_0x3296('0x29')](_0x3f49d7['attributes'],function(_0x5b07f9){var _0x5549d0={};_0x5549d0[_0x5b07f9]={'$like':'%'+_0x4e636f[_0x3296('0x2e')][_0x3296('0x4c')]+'%'};return _0x5549d0;})});}_0x3f49d7=_[_0x3296('0x45')]({},_0x3f49d7,_0x4e636f['options']);return _0x53b32a[_0x3296('0x4e')](_0x3f49d7);}})[_0x3296('0x22')](function(_0x31067d){if(_0x31067d){_0x4c702f=_0x31067d[_0x3296('0x34')];if(!_0x4e636f[_0x3296('0x2e')][_0x3296('0x35')](_0x3296('0x36'))){_0x3f49d7['limit']=qs[_0x3296('0x37')](_0x4e636f[_0x3296('0x2e')][_0x3296('0x37')]);_0x3f49d7[_0x3296('0x1b')]=qs[_0x3296('0x1b')](_0x4e636f[_0x3296('0x2e')][_0x3296('0x1b')]);}return _0x53b32a[_0x3296('0x4e')](_0x3f49d7);}})[_0x3296('0x22')](function(_0xa25478){if(_0xa25478){return _0xa25478?{'count':_0x4c702f,'rows':_0xa25478}:null;}})[_0x3296('0x22')](respondWithResult(_0x50a9fa,null))[_0x3296('0x47')](handleError(_0x50a9fa,null));};exports[_0x3296('0x4f')]=function(_0x359c41,_0xebbcb7,_0x497a66){var _0x4b8e90={};var _0x321c76={};var _0x25ee8a;var _0x2afadc;return db[_0x3296('0x3e')][_0x3296('0x4a')]({'where':{'id':_0x359c41[_0x3296('0x43')]['id']}})[_0x3296('0x22')](handleEntityNotFound(_0xebbcb7,null))[_0x3296('0x22')](function(_0xc0a8ab){if(_0xc0a8ab){_0x25ee8a=_0xc0a8ab;_0x321c76['model']=_['keys'](db['FreshsalesField']['rawAttributes']);_0x321c76['query']=_[_0x3296('0x44')](_0x359c41['query']);_0x321c76[_0x3296('0x2f')]=_[_0x3296('0x30')](_0x321c76[_0x3296('0x31')],_0x321c76[_0x3296('0x2e')]);_0x4b8e90[_0x3296('0x32')]=_[_0x3296('0x30')](_0x321c76[_0x3296('0x31')],qs[_0x3296('0x33')](_0x359c41[_0x3296('0x2e')][_0x3296('0x33')]));_0x4b8e90['attributes']=_0x4b8e90['attributes'][_0x3296('0x34')]?_0x4b8e90[_0x3296('0x32')]:_0x321c76['model'];_0x4b8e90[_0x3296('0x38')]=qs[_0x3296('0x39')](_0x359c41[_0x3296('0x2e')]['sort']);_0x4b8e90[_0x3296('0x3b')]=qs[_0x3296('0x2f')](_[_0x3296('0x3a')](_0x359c41[_0x3296('0x2e')],_0x321c76[_0x3296('0x2f')]));if(_0x359c41['query'][_0x3296('0x4c')]){_0x4b8e90[_0x3296('0x3b')]=_[_0x3296('0x45')](_0x4b8e90[_0x3296('0x3b')],{'$or':_[_0x3296('0x29')](_0x4b8e90[_0x3296('0x32')],function(_0x2e1f92){var _0x379b02={};_0x379b02[_0x2e1f92]={'$like':'%'+_0x359c41[_0x3296('0x2e')][_0x3296('0x4c')]+'%'};return _0x379b02;})});}_0x4b8e90=_[_0x3296('0x45')]({},_0x4b8e90,_0x359c41[_0x3296('0x3d')]);return _0x25ee8a[_0x3296('0x4f')](_0x4b8e90);}})[_0x3296('0x22')](function(_0x193910){if(_0x193910){_0x2afadc=_0x193910[_0x3296('0x34')];if(!_0x359c41[_0x3296('0x2e')][_0x3296('0x35')](_0x3296('0x36'))){_0x4b8e90[_0x3296('0x37')]=qs[_0x3296('0x37')](_0x359c41[_0x3296('0x2e')][_0x3296('0x37')]);_0x4b8e90[_0x3296('0x1b')]=qs[_0x3296('0x1b')](_0x359c41['query']['offset']);}return _0x25ee8a[_0x3296('0x4f')](_0x4b8e90);}})['then'](function(_0x37ed64){if(_0x37ed64){return _0x37ed64?{'count':_0x2afadc,'rows':_0x37ed64}:null;}})['then'](respondWithResult(_0xebbcb7,null))[_0x3296('0x47')](handleError(_0xebbcb7,null));}; \ No newline at end of file +var _0xbc07=['type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','FreshsalesConfiguration','findAll','rows','catch','show','params','include','find','create','body','findOne','getSubjects','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbc07,0x75));var _0x7bc0=function(_0x27a205,_0x484d51){_0x27a205=_0x27a205-0x0;var _0x3867e1=_0xbc07[_0x27a205];return _0x3867e1;};'use strict';var emlformat=require(_0x7bc0('0x0'));var rimraf=require(_0x7bc0('0x1'));var zipdir=require(_0x7bc0('0x2'));var jsonpatch=require(_0x7bc0('0x3'));var rp=require(_0x7bc0('0x4'));var moment=require(_0x7bc0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7bc0('0x6'));var util=require(_0x7bc0('0x7'));var path=require(_0x7bc0('0x8'));var sox=require('sox');var csv=require(_0x7bc0('0x9'));var ejs=require(_0x7bc0('0xa'));var fs=require('fs');var fs_extra=require(_0x7bc0('0xb'));var _=require(_0x7bc0('0xc'));var squel=require(_0x7bc0('0xd'));var crypto=require(_0x7bc0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7bc0('0xf'));var toCsv=require(_0x7bc0('0x9'));var querystring=require('querystring');var Papa=require(_0x7bc0('0x10'));var Redis=require(_0x7bc0('0x11'));var authService=require(_0x7bc0('0x12'));var qs=require(_0x7bc0('0x13'));var as=require(_0x7bc0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bc0('0x15'))('api');var utils=require(_0x7bc0('0x16'));var config=require(_0x7bc0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a259,_0x3c2323){_0x3c2323=_0x3c2323||0xcc;return function(_0x281fd6){if(_0x281fd6){return _0x18a259[_0x7bc0('0x18')](_0x3c2323);}return _0x18a259[_0x7bc0('0x19')](_0x3c2323)['end']();};}function respondWithResult(_0x5c3010,_0x138c74){_0x138c74=_0x138c74||0xc8;return function(_0x49b2ee){if(_0x49b2ee){return _0x5c3010[_0x7bc0('0x19')](_0x138c74)['json'](_0x49b2ee);}};}function respondWithFilteredResult(_0x5707fb,_0x3d4837){return function(_0x348f39){if(_0x348f39){var _0x5eb7b4=typeof _0x3d4837[_0x7bc0('0x1a')]==='undefined'&&typeof _0x3d4837['limit']===_0x7bc0('0x1b');var _0x4c8549=_0x348f39[_0x7bc0('0x1c')];var _0x1b4859=_0x5eb7b4?0x0:_0x3d4837[_0x7bc0('0x1a')];var _0x1d8880=_0x5eb7b4?_0x348f39['count']:_0x3d4837[_0x7bc0('0x1a')]+_0x3d4837[_0x7bc0('0x1d')];var _0x578d1c;if(_0x1d8880>=_0x4c8549){_0x1d8880=_0x4c8549;_0x578d1c=0xc8;}else{_0x578d1c=0xce;}_0x5707fb[_0x7bc0('0x19')](_0x578d1c);return _0x5707fb[_0x7bc0('0x1e')](_0x7bc0('0x1f'),_0x1b4859+'-'+_0x1d8880+'/'+_0x4c8549)[_0x7bc0('0x20')](_0x348f39);}return null;};}function patchUpdates(_0x1d621b){return function(_0x1dd193){try{jsonpatch[_0x7bc0('0x21')](_0x1dd193,_0x1d621b,!![]);}catch(_0x43b1df){return BPromise[_0x7bc0('0x22')](_0x43b1df);}return _0x1dd193[_0x7bc0('0x23')]();};}function saveUpdates(_0xda5fc,_0xb2b1e2){return function(_0x160650){if(_0x160650){return _0x160650['update'](_0xda5fc)[_0x7bc0('0x24')](function(_0x260b67){return _0x260b67;});}return null;};}function removeEntity(_0x8578a4,_0x38759b){return function(_0x3d23bc){if(_0x3d23bc){return _0x3d23bc[_0x7bc0('0x25')]()[_0x7bc0('0x24')](function(){_0x8578a4[_0x7bc0('0x19')](0xcc)[_0x7bc0('0x26')]();});}};}function handleEntityNotFound(_0x26e02b,_0x39b647){return function(_0x21722f){if(!_0x21722f){_0x26e02b[_0x7bc0('0x18')](0x194);}return _0x21722f;};}function handleError(_0x18dd22,_0x4821cf){_0x4821cf=_0x4821cf||0x1f4;return function(_0x26b6d6){logger[_0x7bc0('0x27')](_0x26b6d6[_0x7bc0('0x28')]);if(_0x26b6d6[_0x7bc0('0x29')]){delete _0x26b6d6['name'];}_0x18dd22[_0x7bc0('0x19')](_0x4821cf)[_0x7bc0('0x2a')](_0x26b6d6);};}exports['index']=function(_0x5d51dd,_0x5624c2){var _0x595c2c={},_0x1c3fdb={},_0x3d2938={'count':0x0,'rows':[]};var _0x355a9a=_[_0x7bc0('0x2b')](db['FreshsalesConfiguration'][_0x7bc0('0x2c')],function(_0x1c2b1c){return{'name':_0x1c2b1c['fieldName'],'type':_0x1c2b1c[_0x7bc0('0x2d')][_0x7bc0('0x2e')]};});_0x1c3fdb[_0x7bc0('0x2f')]=_[_0x7bc0('0x2b')](_0x355a9a,_0x7bc0('0x29'));_0x1c3fdb[_0x7bc0('0x30')]=_[_0x7bc0('0x31')](_0x5d51dd[_0x7bc0('0x30')]);_0x1c3fdb[_0x7bc0('0x32')]=_['intersection'](_0x1c3fdb[_0x7bc0('0x2f')],_0x1c3fdb['query']);_0x595c2c['attributes']=_[_0x7bc0('0x33')](_0x1c3fdb[_0x7bc0('0x2f')],qs['fields'](_0x5d51dd[_0x7bc0('0x30')][_0x7bc0('0x34')]));_0x595c2c[_0x7bc0('0x35')]=_0x595c2c[_0x7bc0('0x35')][_0x7bc0('0x36')]?_0x595c2c['attributes']:_0x1c3fdb['model'];if(!_0x5d51dd[_0x7bc0('0x30')][_0x7bc0('0x37')](_0x7bc0('0x38'))){_0x595c2c[_0x7bc0('0x1d')]=qs[_0x7bc0('0x1d')](_0x5d51dd[_0x7bc0('0x30')][_0x7bc0('0x1d')]);_0x595c2c[_0x7bc0('0x1a')]=qs['offset'](_0x5d51dd[_0x7bc0('0x30')][_0x7bc0('0x1a')]);}_0x595c2c[_0x7bc0('0x39')]=qs[_0x7bc0('0x3a')](_0x5d51dd[_0x7bc0('0x30')][_0x7bc0('0x3a')]);_0x595c2c[_0x7bc0('0x3b')]=qs['filters'](_[_0x7bc0('0x3c')](_0x5d51dd[_0x7bc0('0x30')],_0x1c3fdb[_0x7bc0('0x32')]),_0x355a9a);if(_0x5d51dd[_0x7bc0('0x30')][_0x7bc0('0x3d')]){_0x595c2c[_0x7bc0('0x3b')]=_[_0x7bc0('0x3e')](_0x595c2c[_0x7bc0('0x3b')],{'$or':_['map'](_0x355a9a,function(_0x4cfe9e){if(_0x4cfe9e[_0x7bc0('0x2d')]!==_0x7bc0('0x3f')){var _0x1dc98a={};_0x1dc98a[_0x4cfe9e[_0x7bc0('0x29')]]={'$like':'%'+_0x5d51dd[_0x7bc0('0x30')][_0x7bc0('0x3d')]+'%'};return _0x1dc98a;}})});}_0x595c2c=_[_0x7bc0('0x3e')]({},_0x595c2c,_0x5d51dd[_0x7bc0('0x40')]);var _0x5b952f={'where':_0x595c2c['where']};return db['FreshsalesConfiguration'][_0x7bc0('0x1c')](_0x5b952f)[_0x7bc0('0x24')](function(_0x5f1d68){_0x3d2938[_0x7bc0('0x1c')]=_0x5f1d68;if(_0x5d51dd['query'][_0x7bc0('0x41')]){_0x595c2c['include']=[{'all':!![]}];}return db[_0x7bc0('0x42')][_0x7bc0('0x43')](_0x595c2c);})[_0x7bc0('0x24')](function(_0x3e8233){_0x3d2938[_0x7bc0('0x44')]=_0x3e8233;return _0x3d2938;})[_0x7bc0('0x24')](respondWithFilteredResult(_0x5624c2,_0x595c2c))[_0x7bc0('0x45')](handleError(_0x5624c2,null));};exports[_0x7bc0('0x46')]=function(_0x5c883e,_0x5d1a4b){var _0x493f12={'raw':![],'where':{'id':_0x5c883e[_0x7bc0('0x47')]['id']}},_0x5b1466={};_0x5b1466[_0x7bc0('0x2f')]=_[_0x7bc0('0x31')](db[_0x7bc0('0x42')][_0x7bc0('0x2c')]);_0x5b1466[_0x7bc0('0x30')]=_[_0x7bc0('0x31')](_0x5c883e['query']);_0x5b1466['filters']=_[_0x7bc0('0x33')](_0x5b1466[_0x7bc0('0x2f')],_0x5b1466[_0x7bc0('0x30')]);_0x493f12[_0x7bc0('0x35')]=_[_0x7bc0('0x33')](_0x5b1466[_0x7bc0('0x2f')],qs[_0x7bc0('0x34')](_0x5c883e[_0x7bc0('0x30')][_0x7bc0('0x34')]));_0x493f12['attributes']=_0x493f12[_0x7bc0('0x35')][_0x7bc0('0x36')]?_0x493f12[_0x7bc0('0x35')]:_0x5b1466[_0x7bc0('0x2f')];if(_0x5c883e[_0x7bc0('0x30')][_0x7bc0('0x41')]){_0x493f12[_0x7bc0('0x48')]=[{'all':!![]}];}_0x493f12=_[_0x7bc0('0x3e')]({},_0x493f12,_0x5c883e[_0x7bc0('0x40')]);return db['FreshsalesConfiguration'][_0x7bc0('0x49')](_0x493f12)[_0x7bc0('0x24')](handleEntityNotFound(_0x5d1a4b,null))[_0x7bc0('0x24')](respondWithResult(_0x5d1a4b,null))[_0x7bc0('0x45')](handleError(_0x5d1a4b,null));};exports[_0x7bc0('0x4a')]=function(_0x1d1898,_0x448e0e){return db[_0x7bc0('0x42')][_0x7bc0('0x4a')](_0x1d1898[_0x7bc0('0x4b')],{})[_0x7bc0('0x24')](respondWithResult(_0x448e0e,0xc9))[_0x7bc0('0x45')](handleError(_0x448e0e,null));};exports['update']=function(_0x1b44cb,_0x558aaa){if(_0x1b44cb[_0x7bc0('0x4b')]['id']){delete _0x1b44cb[_0x7bc0('0x4b')]['id'];}return db[_0x7bc0('0x42')][_0x7bc0('0x49')]({'where':{'id':_0x1b44cb[_0x7bc0('0x47')]['id']}})[_0x7bc0('0x24')](handleEntityNotFound(_0x558aaa,null))[_0x7bc0('0x24')](saveUpdates(_0x1b44cb[_0x7bc0('0x4b')],null))[_0x7bc0('0x24')](respondWithResult(_0x558aaa,null))['catch'](handleError(_0x558aaa,null));};exports['destroy']=function(_0x4305e1,_0x1a5963){return db[_0x7bc0('0x42')]['find']({'where':{'id':_0x4305e1['params']['id']}})[_0x7bc0('0x24')](handleEntityNotFound(_0x1a5963,null))[_0x7bc0('0x24')](removeEntity(_0x1a5963,null))[_0x7bc0('0x45')](handleError(_0x1a5963,null));};exports['getSubjects']=function(_0x597033,_0x1ec063,_0x20b449){var _0x42881e={};var _0x20280e={};var _0x256acb;var _0x5553f8;return db[_0x7bc0('0x42')][_0x7bc0('0x4c')]({'where':{'id':_0x597033[_0x7bc0('0x47')]['id']}})[_0x7bc0('0x24')](handleEntityNotFound(_0x1ec063,null))[_0x7bc0('0x24')](function(_0x1a08da){if(_0x1a08da){_0x256acb=_0x1a08da;_0x20280e[_0x7bc0('0x2f')]=_[_0x7bc0('0x31')](db['FreshsalesField'][_0x7bc0('0x2c')]);_0x20280e['query']=_[_0x7bc0('0x31')](_0x597033[_0x7bc0('0x30')]);_0x20280e[_0x7bc0('0x32')]=_[_0x7bc0('0x33')](_0x20280e[_0x7bc0('0x2f')],_0x20280e[_0x7bc0('0x30')]);_0x42881e[_0x7bc0('0x35')]=_[_0x7bc0('0x33')](_0x20280e[_0x7bc0('0x2f')],qs[_0x7bc0('0x34')](_0x597033[_0x7bc0('0x30')]['fields']));_0x42881e['attributes']=_0x42881e[_0x7bc0('0x35')][_0x7bc0('0x36')]?_0x42881e[_0x7bc0('0x35')]:_0x20280e[_0x7bc0('0x2f')];_0x42881e['order']=qs[_0x7bc0('0x3a')](_0x597033['query'][_0x7bc0('0x3a')]);_0x42881e[_0x7bc0('0x3b')]=qs[_0x7bc0('0x32')](_[_0x7bc0('0x3c')](_0x597033['query'],_0x20280e[_0x7bc0('0x32')]));if(_0x597033[_0x7bc0('0x30')][_0x7bc0('0x3d')]){_0x42881e[_0x7bc0('0x3b')]=_[_0x7bc0('0x3e')](_0x42881e[_0x7bc0('0x3b')],{'$or':_[_0x7bc0('0x2b')](_0x42881e[_0x7bc0('0x35')],function(_0x1c5907){var _0x2bb093={};_0x2bb093[_0x1c5907]={'$like':'%'+_0x597033[_0x7bc0('0x30')][_0x7bc0('0x3d')]+'%'};return _0x2bb093;})});}_0x42881e=_['merge']({},_0x42881e,_0x597033[_0x7bc0('0x40')]);return _0x256acb[_0x7bc0('0x4d')](_0x42881e);}})['then'](function(_0x26cce4){if(_0x26cce4){_0x5553f8=_0x26cce4['length'];if(!_0x597033[_0x7bc0('0x30')][_0x7bc0('0x37')](_0x7bc0('0x38'))){_0x42881e[_0x7bc0('0x1d')]=qs[_0x7bc0('0x1d')](_0x597033['query'][_0x7bc0('0x1d')]);_0x42881e[_0x7bc0('0x1a')]=qs[_0x7bc0('0x1a')](_0x597033[_0x7bc0('0x30')]['offset']);}return _0x256acb[_0x7bc0('0x4d')](_0x42881e);}})['then'](function(_0x5af996){if(_0x5af996){return _0x5af996?{'count':_0x5553f8,'rows':_0x5af996}:null;}})[_0x7bc0('0x24')](respondWithResult(_0x1ec063,null))[_0x7bc0('0x45')](handleError(_0x1ec063,null));};exports[_0x7bc0('0x4e')]=function(_0x5f4c6a,_0x39d888,_0x500b48){var _0x12563e={};var _0x45cfb7={};var _0x59d686;var _0x2ce1b0;return db['FreshsalesConfiguration'][_0x7bc0('0x4c')]({'where':{'id':_0x5f4c6a[_0x7bc0('0x47')]['id']}})[_0x7bc0('0x24')](handleEntityNotFound(_0x39d888,null))[_0x7bc0('0x24')](function(_0x592d91){if(_0x592d91){_0x59d686=_0x592d91;_0x45cfb7[_0x7bc0('0x2f')]=_['keys'](db[_0x7bc0('0x4f')][_0x7bc0('0x2c')]);_0x45cfb7[_0x7bc0('0x30')]=_[_0x7bc0('0x31')](_0x5f4c6a[_0x7bc0('0x30')]);_0x45cfb7[_0x7bc0('0x32')]=_[_0x7bc0('0x33')](_0x45cfb7['model'],_0x45cfb7[_0x7bc0('0x30')]);_0x12563e[_0x7bc0('0x35')]=_[_0x7bc0('0x33')](_0x45cfb7[_0x7bc0('0x2f')],qs[_0x7bc0('0x34')](_0x5f4c6a[_0x7bc0('0x30')]['fields']));_0x12563e[_0x7bc0('0x35')]=_0x12563e[_0x7bc0('0x35')]['length']?_0x12563e[_0x7bc0('0x35')]:_0x45cfb7[_0x7bc0('0x2f')];_0x12563e['order']=qs[_0x7bc0('0x3a')](_0x5f4c6a['query'][_0x7bc0('0x3a')]);_0x12563e[_0x7bc0('0x3b')]=qs[_0x7bc0('0x32')](_[_0x7bc0('0x3c')](_0x5f4c6a['query'],_0x45cfb7[_0x7bc0('0x32')]));if(_0x5f4c6a[_0x7bc0('0x30')][_0x7bc0('0x3d')]){_0x12563e[_0x7bc0('0x3b')]=_[_0x7bc0('0x3e')](_0x12563e[_0x7bc0('0x3b')],{'$or':_[_0x7bc0('0x2b')](_0x12563e[_0x7bc0('0x35')],function(_0x8ccc97){var _0x5dfcce={};_0x5dfcce[_0x8ccc97]={'$like':'%'+_0x5f4c6a['query'][_0x7bc0('0x3d')]+'%'};return _0x5dfcce;})});}_0x12563e=_[_0x7bc0('0x3e')]({},_0x12563e,_0x5f4c6a['options']);return _0x59d686[_0x7bc0('0x4e')](_0x12563e);}})['then'](function(_0x21b30b){if(_0x21b30b){_0x2ce1b0=_0x21b30b['length'];if(!_0x5f4c6a['query'][_0x7bc0('0x37')](_0x7bc0('0x38'))){_0x12563e['limit']=qs[_0x7bc0('0x1d')](_0x5f4c6a[_0x7bc0('0x30')]['limit']);_0x12563e[_0x7bc0('0x1a')]=qs[_0x7bc0('0x1a')](_0x5f4c6a[_0x7bc0('0x30')][_0x7bc0('0x1a')]);}return _0x59d686[_0x7bc0('0x4e')](_0x12563e);}})[_0x7bc0('0x24')](function(_0x5c7da9){if(_0x5c7da9){return _0x5c7da9?{'count':_0x2ce1b0,'rows':_0x5c7da9}:null;}})[_0x7bc0('0x24')](respondWithResult(_0x39d888,null))[_0x7bc0('0x45')](handleError(_0x39d888,null));};exports[_0x7bc0('0x50')]=function(_0x168e38,_0x5241d3,_0x2da436){var _0x384ab1={};var _0x4df7d5={};var _0x230c1f;var _0xf8e7dd;return db[_0x7bc0('0x42')][_0x7bc0('0x4c')]({'where':{'id':_0x168e38[_0x7bc0('0x47')]['id']}})[_0x7bc0('0x24')](handleEntityNotFound(_0x5241d3,null))[_0x7bc0('0x24')](function(_0x27c954){if(_0x27c954){_0x230c1f=_0x27c954;_0x4df7d5[_0x7bc0('0x2f')]=_[_0x7bc0('0x31')](db[_0x7bc0('0x4f')]['rawAttributes']);_0x4df7d5[_0x7bc0('0x30')]=_[_0x7bc0('0x31')](_0x168e38[_0x7bc0('0x30')]);_0x4df7d5[_0x7bc0('0x32')]=_[_0x7bc0('0x33')](_0x4df7d5[_0x7bc0('0x2f')],_0x4df7d5['query']);_0x384ab1['attributes']=_[_0x7bc0('0x33')](_0x4df7d5[_0x7bc0('0x2f')],qs['fields'](_0x168e38[_0x7bc0('0x30')][_0x7bc0('0x34')]));_0x384ab1[_0x7bc0('0x35')]=_0x384ab1[_0x7bc0('0x35')]['length']?_0x384ab1['attributes']:_0x4df7d5[_0x7bc0('0x2f')];_0x384ab1[_0x7bc0('0x39')]=qs[_0x7bc0('0x3a')](_0x168e38[_0x7bc0('0x30')][_0x7bc0('0x3a')]);_0x384ab1['where']=qs[_0x7bc0('0x32')](_[_0x7bc0('0x3c')](_0x168e38['query'],_0x4df7d5['filters']));if(_0x168e38[_0x7bc0('0x30')][_0x7bc0('0x3d')]){_0x384ab1[_0x7bc0('0x3b')]=_[_0x7bc0('0x3e')](_0x384ab1['where'],{'$or':_[_0x7bc0('0x2b')](_0x384ab1['attributes'],function(_0x262c7c){var _0x16f345={};_0x16f345[_0x262c7c]={'$like':'%'+_0x168e38[_0x7bc0('0x30')][_0x7bc0('0x3d')]+'%'};return _0x16f345;})});}_0x384ab1=_[_0x7bc0('0x3e')]({},_0x384ab1,_0x168e38[_0x7bc0('0x40')]);return _0x230c1f[_0x7bc0('0x50')](_0x384ab1);}})[_0x7bc0('0x24')](function(_0x37ef28){if(_0x37ef28){_0xf8e7dd=_0x37ef28['length'];if(!_0x168e38[_0x7bc0('0x30')][_0x7bc0('0x37')](_0x7bc0('0x38'))){_0x384ab1['limit']=qs[_0x7bc0('0x1d')](_0x168e38[_0x7bc0('0x30')]['limit']);_0x384ab1[_0x7bc0('0x1a')]=qs[_0x7bc0('0x1a')](_0x168e38['query'][_0x7bc0('0x1a')]);}return _0x230c1f[_0x7bc0('0x50')](_0x384ab1);}})[_0x7bc0('0x24')](function(_0x30f57f){if(_0x30f57f){return _0x30f57f?{'count':_0xf8e7dd,'rows':_0x30f57f}:null;}})[_0x7bc0('0x24')](respondWithResult(_0x5241d3,null))[_0x7bc0('0x45')](handleError(_0x5241d3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 09d4248..78ce99b 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 _0x6259=['exports','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x6259,0x1e4));var _0x9625=function(_0x594513,_0x5b51a0){_0x594513=_0x594513-0x0;var _0x1581e1=_0x6259[_0x594513];return _0x1581e1;};'use strict';var _=require(_0x9625('0x0'));var util=require(_0x9625('0x1'));var logger=require(_0x9625('0x2'))(_0x9625('0x3'));var moment=require(_0x9625('0x4'));var BPromise=require(_0x9625('0x5'));var rp=require(_0x9625('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9625('0x7'));var config=require(_0x9625('0x8'));var attributes=require(_0x9625('0x9'));module[_0x9625('0xa')]=function(_0x11a697,_0x167ce7){return _0x11a697[_0x9625('0xb')](_0x9625('0xc'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5601=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x32b048,_0x131649){var _0x2e5c0b=function(_0x10bf5a){while(--_0x10bf5a){_0x32b048['push'](_0x32b048['shift']());}};_0x2e5c0b(++_0x131649);}(_0x5601,0x1d6));var _0x1560=function(_0x589c63,_0x2ac369){_0x589c63=_0x589c63-0x0;var _0x11c392=_0x5601[_0x589c63];return _0x11c392;};'use strict';var _=require(_0x1560('0x0'));var util=require(_0x1560('0x1'));var logger=require(_0x1560('0x2'))(_0x1560('0x3'));var moment=require('moment');var BPromise=require(_0x1560('0x4'));var rp=require(_0x1560('0x5'));var fs=require('fs');var path=require(_0x1560('0x6'));var rimraf=require(_0x1560('0x7'));var config=require(_0x1560('0x8'));var attributes=require(_0x1560('0x9'));module[_0x1560('0xa')]=function(_0x4088ad,_0x330309){return _0x4088ad[_0x1560('0xb')](_0x1560('0xc'),attributes,{'tableName':_0x1560('0xd'),'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 5faf124..64ea749 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 _0x5f6d=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x10c3e7,_0x4e4748){var _0x3e55e4=function(_0x166ae5){while(--_0x166ae5){_0x10c3e7['push'](_0x10c3e7['shift']());}};_0x3e55e4(++_0x4e4748);}(_0x5f6d,0xd1));var _0xd5f6=function(_0x3b3d6c,_0x1052db){_0x3b3d6c=_0x3b3d6c-0x0;var _0x4fc644=_0x5f6d[_0x3b3d6c];return _0x4fc644;};'use strict';var _=require(_0xd5f6('0x0'));var util=require(_0xd5f6('0x1'));var moment=require(_0xd5f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5f6('0x4'))['db'];var utils=require(_0xd5f6('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd5f6('0x6'));var client=jayson['client'][_0xd5f6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x213db3,_0x27c586,_0x54a20c){return new BPromise(function(_0x393b91,_0x185bb9){return client['request'](_0x213db3,_0x54a20c)[_0xd5f6('0x8')](function(_0x977eb2){logger['info'](_0xd5f6('0x9'),_0x27c586,'request\x20sent');logger[_0xd5f6('0xa')](_0xd5f6('0xb'),_0x27c586,_0xd5f6('0xc'),JSON[_0xd5f6('0xd')](_0x977eb2));if(_0x977eb2[_0xd5f6('0xe')]){if(_0x977eb2[_0xd5f6('0xe')][_0xd5f6('0xf')]===0x1f4){logger['error'](_0xd5f6('0x9'),_0x27c586,_0x977eb2[_0xd5f6('0xe')][_0xd5f6('0x10')]);return _0x185bb9(_0x977eb2['error'][_0xd5f6('0x10')]);}logger[_0xd5f6('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x27c586,_0x977eb2[_0xd5f6('0xe')]['message']);return _0x393b91(_0x977eb2[_0xd5f6('0xe')][_0xd5f6('0x10')]);}else{logger[_0xd5f6('0x11')](_0xd5f6('0x9'),_0x27c586,_0xd5f6('0xc'));_0x393b91(_0x977eb2[_0xd5f6('0x12')][_0xd5f6('0x10')]);}})['catch'](function(_0x3b7ea0){logger['error'](_0xd5f6('0x9'),_0x27c586,_0x3b7ea0);_0x185bb9(_0x3b7ea0);});});} \ No newline at end of file +var _0xc9a3=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x11dea9,_0x5f1074){var _0x52d03d=function(_0xf853f4){while(--_0xf853f4){_0x11dea9['push'](_0x11dea9['shift']());}};_0x52d03d(++_0x5f1074);}(_0xc9a3,0x117));var _0x3c9a=function(_0x53ef2f,_0x577bb7){_0x53ef2f=_0x53ef2f-0x0;var _0x299302=_0xc9a3[_0x53ef2f];return _0x299302;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c9a('0x0'));var BPromise=require(_0x3c9a('0x1'));var rs=require(_0x3c9a('0x2'));var fs=require('fs');var Redis=require(_0x3c9a('0x3'));var db=require(_0x3c9a('0x4'))['db'];var utils=require(_0x3c9a('0x5'));var logger=require(_0x3c9a('0x6'))('rpc');var config=require(_0x3c9a('0x7'));var jayson=require(_0x3c9a('0x8'));var client=jayson[_0x3c9a('0x9')][_0x3c9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b567d,_0x321408,_0x204dfc){return new BPromise(function(_0x36f6cd,_0x1180d2){return client['request'](_0x1b567d,_0x204dfc)[_0x3c9a('0xb')](function(_0x9b90cd){logger[_0x3c9a('0xc')](_0x3c9a('0xd'),_0x321408,_0x3c9a('0xe'));logger[_0x3c9a('0xf')](_0x3c9a('0x10'),_0x321408,_0x3c9a('0xe'),JSON[_0x3c9a('0x11')](_0x9b90cd));if(_0x9b90cd[_0x3c9a('0x12')]){if(_0x9b90cd[_0x3c9a('0x12')][_0x3c9a('0x13')]===0x1f4){logger[_0x3c9a('0x12')](_0x3c9a('0xd'),_0x321408,_0x9b90cd[_0x3c9a('0x12')][_0x3c9a('0x14')]);return _0x1180d2(_0x9b90cd[_0x3c9a('0x12')][_0x3c9a('0x14')]);}logger[_0x3c9a('0x12')](_0x3c9a('0xd'),_0x321408,_0x9b90cd[_0x3c9a('0x12')][_0x3c9a('0x14')]);return _0x36f6cd(_0x9b90cd['error'][_0x3c9a('0x14')]);}else{logger['info'](_0x3c9a('0xd'),_0x321408,_0x3c9a('0xe'));_0x36f6cd(_0x9b90cd[_0x3c9a('0x15')][_0x3c9a('0x14')]);}})[_0x3c9a('0x16')](function(_0x25d29e){logger[_0x3c9a('0x12')](_0x3c9a('0xd'),_0x321408,_0x25d29e);_0x1180d2(_0x25d29e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 74a3623..dcd5b08 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 _0xdadd=['multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x2d08b9,_0x2fee02){var _0x34c713=function(_0x57defa){while(--_0x57defa){_0x2d08b9['push'](_0x2d08b9['shift']());}};_0x34c713(++_0x2fee02);}(_0xdadd,0x1c8));var _0xddad=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xdadd[_0x5cbf0e];return _0x1c76f8;};'use strict';var multer=require(_0xddad('0x0'));var util=require('util');var path=require(_0xddad('0x1'));var timeout=require('connect-timeout');var express=require(_0xddad('0x2'));var router=express[_0xddad('0x3')]();var fs_extra=require(_0xddad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xddad('0x5'));var config=require(_0xddad('0x6'));var controller=require(_0xddad('0x7'));router[_0xddad('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xddad('0x8')](_0xddad('0x9'),auth['isAuthenticated'](),controller[_0xddad('0xa')]);router[_0xddad('0xb')]('/',auth[_0xddad('0xc')](),controller[_0xddad('0xd')]);router[_0xddad('0xe')](_0xddad('0x9'),auth[_0xddad('0xc')](),controller[_0xddad('0xf')]);router[_0xddad('0x10')]('/:id',auth[_0xddad('0xc')](),controller[_0xddad('0x11')]);module[_0xddad('0x12')]=router; \ No newline at end of file +var _0x16d2=['./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x553aba,_0xcdbfe4){var _0x28dec4=function(_0x128e70){while(--_0x128e70){_0x553aba['push'](_0x553aba['shift']());}};_0x28dec4(++_0xcdbfe4);}(_0x16d2,0x123));var _0x216d=function(_0x471f7c,_0x59016f){_0x471f7c=_0x471f7c-0x0;var _0xb1336c=_0x16d2[_0x471f7c];return _0xb1336c;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['post']('/',auth[_0x216d('0xb')](),controller[_0x216d('0xf')]);router[_0x216d('0x10')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0x11')]);router['delete'](_0x216d('0xd'),auth['isAuthenticated'](),controller[_0x216d('0x12')]);module[_0x216d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 6f3219c..e52f4d5 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 _0x6e84=['STRING','sequelize','ENUM','string','variable','customVariable','picklist'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6e84,0x174));var _0x46e8=function(_0x13837f,_0xe850e0){_0x13837f=_0x13837f-0x0;var _0x26da0b=_0x6e84[_0x13837f];return _0x26da0b;};'use strict';var Sequelize=require(_0x46e8('0x0'));module['exports']={'type':{'type':Sequelize[_0x46e8('0x1')](_0x46e8('0x2'),_0x46e8('0x3'),_0x46e8('0x4'),'keyValue',_0x46e8('0x5')),'defaultValue':_0x46e8('0x2')},'content':{'type':Sequelize[_0x46e8('0x6')]},'key':{'type':Sequelize[_0x46e8('0x6')]},'keyType':{'type':Sequelize[_0x46e8('0x1')]('string',_0x46e8('0x3'),_0x46e8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x46e8('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x46e8('0x6')]}}; \ No newline at end of file +var _0x8da0=['ENUM','variable','customVariable','picklist','STRING','BOOLEAN','exports'];(function(_0x5a2c0f,_0x45a515){var _0x486e51=function(_0x176dae){while(--_0x176dae){_0x5a2c0f['push'](_0x5a2c0f['shift']());}};_0x486e51(++_0x45a515);}(_0x8da0,0x92));var _0x08da=function(_0x375ab3,_0x35f86e){_0x375ab3=_0x375ab3-0x0;var _0x33c886=_0x8da0[_0x375ab3];return _0x33c886;};'use strict';var Sequelize=require('sequelize');module[_0x08da('0x0')]={'type':{'type':Sequelize[_0x08da('0x1')]('string',_0x08da('0x2'),_0x08da('0x3'),'keyValue',_0x08da('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x08da('0x5')]},'key':{'type':Sequelize[_0x08da('0x5')]},'keyType':{'type':Sequelize[_0x08da('0x1')]('string',_0x08da('0x2'),_0x08da('0x3'))},'keyContent':{'type':Sequelize[_0x08da('0x5')]},'idField':{'type':Sequelize[_0x08da('0x5')]},'nameField':{'type':Sequelize[_0x08da('0x5')]},'customField':{'type':Sequelize[_0x08da('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x08da('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 480e7da..078b1a8 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 _0xd60e=['filter','where','merge','options','findAll','rows','catch','show','params','fields','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort'];(function(_0x550dee,_0xf10da7){var _0x177bb6=function(_0x4ac24f){while(--_0x4ac24f){_0x550dee['push'](_0x550dee['shift']());}};_0x177bb6(++_0xf10da7);}(_0xd60e,0xab));var _0xed60=function(_0x185c56,_0x1f874d){_0x185c56=_0x185c56-0x0;var _0x31eb44=_0xd60e[_0x185c56];return _0x31eb44;};'use strict';var emlformat=require(_0xed60('0x0'));var rimraf=require(_0xed60('0x1'));var zipdir=require(_0xed60('0x2'));var jsonpatch=require(_0xed60('0x3'));var rp=require(_0xed60('0x4'));var moment=require(_0xed60('0x5'));var BPromise=require(_0xed60('0x6'));var Mustache=require(_0xed60('0x7'));var util=require(_0xed60('0x8'));var path=require(_0xed60('0x9'));var sox=require('sox');var csv=require(_0xed60('0xa'));var ejs=require(_0xed60('0xb'));var fs=require('fs');var fs_extra=require(_0xed60('0xc'));var _=require(_0xed60('0xd'));var squel=require(_0xed60('0xe'));var crypto=require(_0xed60('0xf'));var jsforce=require(_0xed60('0x10'));var deskjs=require(_0xed60('0x11'));var toCsv=require(_0xed60('0xa'));var querystring=require(_0xed60('0x12'));var Papa=require(_0xed60('0x13'));var Redis=require(_0xed60('0x14'));var authService=require(_0xed60('0x15'));var qs=require(_0xed60('0x16'));var as=require(_0xed60('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed60('0x18'))(_0xed60('0x19'));var utils=require('../../config/utils');var config=require(_0xed60('0x1a'));var licenseUtil=require(_0xed60('0x1b'));var db=require(_0xed60('0x1c'))['db'];function respondWithStatusCode(_0x4394b7,_0x29a910){_0x29a910=_0x29a910||0xcc;return function(_0x3776c4){if(_0x3776c4){return _0x4394b7[_0xed60('0x1d')](_0x29a910);}return _0x4394b7[_0xed60('0x1e')](_0x29a910)[_0xed60('0x1f')]();};}function respondWithResult(_0x462ce2,_0x4a44ba){_0x4a44ba=_0x4a44ba||0xc8;return function(_0x584340){if(_0x584340){return _0x462ce2[_0xed60('0x1e')](_0x4a44ba)[_0xed60('0x20')](_0x584340);}};}function respondWithFilteredResult(_0x158ef6,_0x1f017c){return function(_0x215647){if(_0x215647){var _0x26a180=typeof _0x1f017c['offset']===_0xed60('0x21')&&typeof _0x1f017c[_0xed60('0x22')]===_0xed60('0x21');var _0x1c6c2f=_0x215647[_0xed60('0x23')];var _0x3b6861=_0x26a180?0x0:_0x1f017c[_0xed60('0x24')];var _0x2d28c8=_0x26a180?_0x215647[_0xed60('0x23')]:_0x1f017c[_0xed60('0x24')]+_0x1f017c[_0xed60('0x22')];var _0x53ed17;if(_0x2d28c8>=_0x1c6c2f){_0x2d28c8=_0x1c6c2f;_0x53ed17=0xc8;}else{_0x53ed17=0xce;}_0x158ef6['status'](_0x53ed17);return _0x158ef6[_0xed60('0x25')]('Content-Range',_0x3b6861+'-'+_0x2d28c8+'/'+_0x1c6c2f)[_0xed60('0x20')](_0x215647);}return null;};}function patchUpdates(_0x5aac70){return function(_0x17177b){try{jsonpatch[_0xed60('0x26')](_0x17177b,_0x5aac70,!![]);}catch(_0x4d2ba1){return BPromise['reject'](_0x4d2ba1);}return _0x17177b[_0xed60('0x27')]();};}function saveUpdates(_0x5cd460,_0x2e6235){return function(_0x47e61a){if(_0x47e61a){return _0x47e61a[_0xed60('0x28')](_0x5cd460)[_0xed60('0x29')](function(_0x4f6bec){return _0x4f6bec;});}return null;};}function removeEntity(_0x2306ae,_0x4b7bc7){return function(_0x40b249){if(_0x40b249){return _0x40b249[_0xed60('0x2a')]()[_0xed60('0x29')](function(){_0x2306ae['status'](0xcc)[_0xed60('0x1f')]();});}};}function handleEntityNotFound(_0x1502fe,_0x27719a){return function(_0x1f4599){if(!_0x1f4599){_0x1502fe[_0xed60('0x1d')](0x194);}return _0x1f4599;};}function handleError(_0x413f8f,_0x680b64){_0x680b64=_0x680b64||0x1f4;return function(_0x1f7ee6){logger[_0xed60('0x2b')](_0x1f7ee6[_0xed60('0x2c')]);if(_0x1f7ee6['name']){delete _0x1f7ee6[_0xed60('0x2d')];}_0x413f8f['status'](_0x680b64)[_0xed60('0x2e')](_0x1f7ee6);};}exports[_0xed60('0x2f')]=function(_0x26d436,_0x1d4da4){var _0x733070={},_0x466197={},_0x53a798={'count':0x0,'rows':[]};var _0x2589f0=_[_0xed60('0x30')](db[_0xed60('0x31')][_0xed60('0x32')],function(_0x5be2fc){return{'name':_0x5be2fc[_0xed60('0x33')],'type':_0x5be2fc[_0xed60('0x34')][_0xed60('0x35')]};});_0x466197[_0xed60('0x36')]=_[_0xed60('0x30')](_0x2589f0,_0xed60('0x2d'));_0x466197[_0xed60('0x37')]=_[_0xed60('0x38')](_0x26d436[_0xed60('0x37')]);_0x466197[_0xed60('0x39')]=_[_0xed60('0x3a')](_0x466197[_0xed60('0x36')],_0x466197[_0xed60('0x37')]);_0x733070[_0xed60('0x3b')]=_[_0xed60('0x3a')](_0x466197[_0xed60('0x36')],qs['fields'](_0x26d436[_0xed60('0x37')]['fields']));_0x733070[_0xed60('0x3b')]=_0x733070[_0xed60('0x3b')]['length']?_0x733070[_0xed60('0x3b')]:_0x466197[_0xed60('0x36')];if(!_0x26d436[_0xed60('0x37')][_0xed60('0x3c')](_0xed60('0x3d'))){_0x733070[_0xed60('0x22')]=qs['limit'](_0x26d436['query'][_0xed60('0x22')]);_0x733070['offset']=qs[_0xed60('0x24')](_0x26d436[_0xed60('0x37')][_0xed60('0x24')]);}_0x733070['order']=qs[_0xed60('0x3e')](_0x26d436[_0xed60('0x37')][_0xed60('0x3e')]);_0x733070['where']=qs[_0xed60('0x39')](_['pick'](_0x26d436[_0xed60('0x37')],_0x466197[_0xed60('0x39')]),_0x2589f0);if(_0x26d436['query'][_0xed60('0x3f')]){_0x733070[_0xed60('0x40')]=_[_0xed60('0x41')](_0x733070[_0xed60('0x40')],{'$or':_[_0xed60('0x30')](_0x2589f0,function(_0x241b66){if(_0x241b66[_0xed60('0x34')]!=='VIRTUAL'){var _0x4a30d9={};_0x4a30d9[_0x241b66[_0xed60('0x2d')]]={'$like':'%'+_0x26d436['query']['filter']+'%'};return _0x4a30d9;}})});}_0x733070=_[_0xed60('0x41')]({},_0x733070,_0x26d436[_0xed60('0x42')]);var _0xf256a={'where':_0x733070[_0xed60('0x40')]};return db[_0xed60('0x31')][_0xed60('0x23')](_0xf256a)['then'](function(_0x8772bc){_0x53a798[_0xed60('0x23')]=_0x8772bc;if(_0x26d436[_0xed60('0x37')]['includeAll']){_0x733070['include']=[{'all':!![]}];}return db[_0xed60('0x31')][_0xed60('0x43')](_0x733070);})[_0xed60('0x29')](function(_0x131ca2){_0x53a798[_0xed60('0x44')]=_0x131ca2;return _0x53a798;})[_0xed60('0x29')](respondWithFilteredResult(_0x1d4da4,_0x733070))[_0xed60('0x45')](handleError(_0x1d4da4,null));};exports[_0xed60('0x46')]=function(_0x52e76f,_0x59e3dc){var _0x58d32f={'raw':!![],'where':{'id':_0x52e76f[_0xed60('0x47')]['id']}},_0x35a96d={};_0x35a96d[_0xed60('0x36')]=_[_0xed60('0x38')](db[_0xed60('0x31')]['rawAttributes']);_0x35a96d['query']=_[_0xed60('0x38')](_0x52e76f[_0xed60('0x37')]);_0x35a96d['filters']=_['intersection'](_0x35a96d[_0xed60('0x36')],_0x35a96d[_0xed60('0x37')]);_0x58d32f[_0xed60('0x3b')]=_[_0xed60('0x3a')](_0x35a96d[_0xed60('0x36')],qs[_0xed60('0x48')](_0x52e76f[_0xed60('0x37')]['fields']));_0x58d32f['attributes']=_0x58d32f['attributes']['length']?_0x58d32f[_0xed60('0x3b')]:_0x35a96d[_0xed60('0x36')];if(_0x52e76f[_0xed60('0x37')][_0xed60('0x49')]){_0x58d32f[_0xed60('0x4a')]=[{'all':!![]}];}_0x58d32f=_['merge']({},_0x58d32f,_0x52e76f['options']);return db[_0xed60('0x31')][_0xed60('0x4b')](_0x58d32f)[_0xed60('0x29')](handleEntityNotFound(_0x59e3dc,null))[_0xed60('0x29')](respondWithResult(_0x59e3dc,null))[_0xed60('0x45')](handleError(_0x59e3dc,null));};exports[_0xed60('0x4c')]=function(_0x3172f3,_0x3c8b6d){return db['FreshsalesField'][_0xed60('0x4c')](_0x3172f3[_0xed60('0x4d')],{})[_0xed60('0x29')](respondWithResult(_0x3c8b6d,0xc9))[_0xed60('0x45')](handleError(_0x3c8b6d,null));};exports[_0xed60('0x28')]=function(_0x1ec224,_0x3462c5){if(_0x1ec224[_0xed60('0x4d')]['id']){delete _0x1ec224[_0xed60('0x4d')]['id'];}return db[_0xed60('0x31')][_0xed60('0x4b')]({'where':{'id':_0x1ec224['params']['id']}})[_0xed60('0x29')](handleEntityNotFound(_0x3462c5,null))['then'](saveUpdates(_0x1ec224[_0xed60('0x4d')],null))['then'](respondWithResult(_0x3462c5,null))[_0xed60('0x45')](handleError(_0x3462c5,null));};exports[_0xed60('0x2a')]=function(_0x50a9fa,_0x101ff8){return db[_0xed60('0x31')][_0xed60('0x4b')]({'where':{'id':_0x50a9fa[_0xed60('0x47')]['id']}})[_0xed60('0x29')](handleEntityNotFound(_0x101ff8,null))[_0xed60('0x29')](removeEntity(_0x101ff8,null))[_0xed60('0x45')](handleError(_0x101ff8,null));}; \ No newline at end of file +var _0x261b=['map','FreshsalesField','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','options','create','body','find','destroy','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','error','stack','name','send','index'];(function(_0x35b885,_0x37c742){var _0x4e03ad=function(_0x5d8dac){while(--_0x5d8dac){_0x35b885['push'](_0x35b885['shift']());}};_0x4e03ad(++_0x37c742);}(_0x261b,0xb5));var _0xb261=function(_0x17d3ef,_0xdb962f){_0x17d3ef=_0x17d3ef-0x0;var _0x3daabe=_0x261b[_0x17d3ef];return _0x3daabe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb261('0x0'));var zipdir=require(_0xb261('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb261('0x2'));var moment=require('moment');var BPromise=require(_0xb261('0x3'));var Mustache=require(_0xb261('0x4'));var util=require(_0xb261('0x5'));var path=require(_0xb261('0x6'));var sox=require(_0xb261('0x7'));var csv=require(_0xb261('0x8'));var ejs=require(_0xb261('0x9'));var fs=require('fs');var fs_extra=require(_0xb261('0xa'));var _=require(_0xb261('0xb'));var squel=require(_0xb261('0xc'));var crypto=require(_0xb261('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb261('0x8'));var querystring=require(_0xb261('0xe'));var Papa=require(_0xb261('0xf'));var Redis=require(_0xb261('0x10'));var authService=require(_0xb261('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb261('0x12'));var hardwareService=require(_0xb261('0x13'));var logger=require(_0xb261('0x14'))(_0xb261('0x15'));var utils=require(_0xb261('0x16'));var config=require(_0xb261('0x17'));var licenseUtil=require(_0xb261('0x18'));var db=require(_0xb261('0x19'))['db'];function respondWithStatusCode(_0x1589a3,_0x4364c3){_0x4364c3=_0x4364c3||0xcc;return function(_0x1e138d){if(_0x1e138d){return _0x1589a3[_0xb261('0x1a')](_0x4364c3);}return _0x1589a3[_0xb261('0x1b')](_0x4364c3)[_0xb261('0x1c')]();};}function respondWithResult(_0x5aaf3b,_0x2fff70){_0x2fff70=_0x2fff70||0xc8;return function(_0x44f77f){if(_0x44f77f){return _0x5aaf3b['status'](_0x2fff70)[_0xb261('0x1d')](_0x44f77f);}};}function respondWithFilteredResult(_0x42f7b5,_0x59116b){return function(_0x386c68){if(_0x386c68){var _0x393fe5=typeof _0x59116b[_0xb261('0x1e')]==='undefined'&&typeof _0x59116b[_0xb261('0x1f')]===_0xb261('0x20');var _0x5e4814=_0x386c68[_0xb261('0x21')];var _0x3915d1=_0x393fe5?0x0:_0x59116b['offset'];var _0x4a1b21=_0x393fe5?_0x386c68[_0xb261('0x21')]:_0x59116b['offset']+_0x59116b[_0xb261('0x1f')];var _0x26f9af;if(_0x4a1b21>=_0x5e4814){_0x4a1b21=_0x5e4814;_0x26f9af=0xc8;}else{_0x26f9af=0xce;}_0x42f7b5['status'](_0x26f9af);return _0x42f7b5['set'](_0xb261('0x22'),_0x3915d1+'-'+_0x4a1b21+'/'+_0x5e4814)[_0xb261('0x1d')](_0x386c68);}return null;};}function patchUpdates(_0x3fdfd4){return function(_0x2d104a){try{jsonpatch['apply'](_0x2d104a,_0x3fdfd4,!![]);}catch(_0x33f3ef){return BPromise['reject'](_0x33f3ef);}return _0x2d104a['save']();};}function saveUpdates(_0x5d0374,_0x1a823c){return function(_0x375ae8){if(_0x375ae8){return _0x375ae8['update'](_0x5d0374)['then'](function(_0x21baa7){return _0x21baa7;});}return null;};}function removeEntity(_0x73312,_0x153e29){return function(_0x335bdf){if(_0x335bdf){return _0x335bdf['destroy']()[_0xb261('0x23')](function(){_0x73312[_0xb261('0x1b')](0xcc)[_0xb261('0x1c')]();});}};}function handleEntityNotFound(_0x7444bf,_0x5e07ec){return function(_0x10c089){if(!_0x10c089){_0x7444bf[_0xb261('0x1a')](0x194);}return _0x10c089;};}function handleError(_0x47bb7c,_0x32456e){_0x32456e=_0x32456e||0x1f4;return function(_0x291dc6){logger[_0xb261('0x24')](_0x291dc6[_0xb261('0x25')]);if(_0x291dc6[_0xb261('0x26')]){delete _0x291dc6[_0xb261('0x26')];}_0x47bb7c['status'](_0x32456e)[_0xb261('0x27')](_0x291dc6);};}exports[_0xb261('0x28')]=function(_0x3cd681,_0x3f4337){var _0x5129e5={},_0x46f350={},_0x187fc1={'count':0x0,'rows':[]};var _0x5b45a1=_[_0xb261('0x29')](db[_0xb261('0x2a')][_0xb261('0x2b')],function(_0x149a58){return{'name':_0x149a58[_0xb261('0x2c')],'type':_0x149a58['type'][_0xb261('0x2d')]};});_0x46f350[_0xb261('0x2e')]=_[_0xb261('0x29')](_0x5b45a1,_0xb261('0x26'));_0x46f350['query']=_[_0xb261('0x2f')](_0x3cd681['query']);_0x46f350[_0xb261('0x30')]=_[_0xb261('0x31')](_0x46f350[_0xb261('0x2e')],_0x46f350[_0xb261('0x32')]);_0x5129e5[_0xb261('0x33')]=_[_0xb261('0x31')](_0x46f350[_0xb261('0x2e')],qs[_0xb261('0x34')](_0x3cd681[_0xb261('0x32')][_0xb261('0x34')]));_0x5129e5[_0xb261('0x33')]=_0x5129e5[_0xb261('0x33')][_0xb261('0x35')]?_0x5129e5[_0xb261('0x33')]:_0x46f350['model'];if(!_0x3cd681['query'][_0xb261('0x36')](_0xb261('0x37'))){_0x5129e5[_0xb261('0x1f')]=qs[_0xb261('0x1f')](_0x3cd681[_0xb261('0x32')][_0xb261('0x1f')]);_0x5129e5[_0xb261('0x1e')]=qs[_0xb261('0x1e')](_0x3cd681[_0xb261('0x32')][_0xb261('0x1e')]);}_0x5129e5['order']=qs[_0xb261('0x38')](_0x3cd681[_0xb261('0x32')][_0xb261('0x38')]);_0x5129e5[_0xb261('0x39')]=qs['filters'](_['pick'](_0x3cd681[_0xb261('0x32')],_0x46f350[_0xb261('0x30')]),_0x5b45a1);if(_0x3cd681['query']['filter']){_0x5129e5[_0xb261('0x39')]=_[_0xb261('0x3a')](_0x5129e5['where'],{'$or':_['map'](_0x5b45a1,function(_0xde53a3){if(_0xde53a3[_0xb261('0x3b')]!==_0xb261('0x3c')){var _0x345544={};_0x345544[_0xde53a3['name']]={'$like':'%'+_0x3cd681['query'][_0xb261('0x3d')]+'%'};return _0x345544;}})});}_0x5129e5=_['merge']({},_0x5129e5,_0x3cd681['options']);var _0xab6754={'where':_0x5129e5[_0xb261('0x39')]};return db['FreshsalesField']['count'](_0xab6754)[_0xb261('0x23')](function(_0xe2feca){_0x187fc1[_0xb261('0x21')]=_0xe2feca;if(_0x3cd681[_0xb261('0x32')][_0xb261('0x3e')]){_0x5129e5['include']=[{'all':!![]}];}return db[_0xb261('0x2a')][_0xb261('0x3f')](_0x5129e5);})[_0xb261('0x23')](function(_0x5650dd){_0x187fc1[_0xb261('0x40')]=_0x5650dd;return _0x187fc1;})[_0xb261('0x23')](respondWithFilteredResult(_0x3f4337,_0x5129e5))[_0xb261('0x41')](handleError(_0x3f4337,null));};exports[_0xb261('0x42')]=function(_0x54a3a0,_0x1a69de){var _0x7517b9={'raw':!![],'where':{'id':_0x54a3a0[_0xb261('0x43')]['id']}},_0x49cfbf={};_0x49cfbf[_0xb261('0x2e')]=_['keys'](db[_0xb261('0x2a')][_0xb261('0x2b')]);_0x49cfbf['query']=_[_0xb261('0x2f')](_0x54a3a0[_0xb261('0x32')]);_0x49cfbf[_0xb261('0x30')]=_[_0xb261('0x31')](_0x49cfbf['model'],_0x49cfbf[_0xb261('0x32')]);_0x7517b9['attributes']=_['intersection'](_0x49cfbf[_0xb261('0x2e')],qs['fields'](_0x54a3a0['query'][_0xb261('0x34')]));_0x7517b9[_0xb261('0x33')]=_0x7517b9['attributes'][_0xb261('0x35')]?_0x7517b9[_0xb261('0x33')]:_0x49cfbf[_0xb261('0x2e')];if(_0x54a3a0['query'][_0xb261('0x3e')]){_0x7517b9[_0xb261('0x44')]=[{'all':!![]}];}_0x7517b9=_[_0xb261('0x3a')]({},_0x7517b9,_0x54a3a0[_0xb261('0x45')]);return db[_0xb261('0x2a')]['find'](_0x7517b9)[_0xb261('0x23')](handleEntityNotFound(_0x1a69de,null))['then'](respondWithResult(_0x1a69de,null))[_0xb261('0x41')](handleError(_0x1a69de,null));};exports[_0xb261('0x46')]=function(_0x215f0b,_0x185d35){return db['FreshsalesField'][_0xb261('0x46')](_0x215f0b[_0xb261('0x47')],{})[_0xb261('0x23')](respondWithResult(_0x185d35,0xc9))['catch'](handleError(_0x185d35,null));};exports['update']=function(_0x374f3b,_0x164b22){if(_0x374f3b['body']['id']){delete _0x374f3b[_0xb261('0x47')]['id'];}return db['FreshsalesField'][_0xb261('0x48')]({'where':{'id':_0x374f3b[_0xb261('0x43')]['id']}})['then'](handleEntityNotFound(_0x164b22,null))['then'](saveUpdates(_0x374f3b[_0xb261('0x47')],null))[_0xb261('0x23')](respondWithResult(_0x164b22,null))[_0xb261('0x41')](handleError(_0x164b22,null));};exports[_0xb261('0x49')]=function(_0x35a4a4,_0x3e6579){return db[_0xb261('0x2a')][_0xb261('0x48')]({'where':{'id':_0x35a4a4[_0xb261('0x43')]['id']}})[_0xb261('0x23')](handleEntityNotFound(_0x3e6579,null))[_0xb261('0x23')](removeEntity(_0x3e6579,null))['catch'](handleError(_0x3e6579,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index b186879..b26eae1 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 _0xb846=['idField','FieldId','lodash','api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb846,0x1d0));var _0x6b84=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xb846[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x6b84('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b84('0x1'));var moment=require(_0x6b84('0x2'));var BPromise=require(_0x6b84('0x3'));var rp=require(_0x6b84('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b84('0x5'));var attributes=require(_0x6b84('0x6'));module[_0x6b84('0x7')]=function(_0x3448d0,_0x31856c){return _0x3448d0['define']('FreshsalesField',attributes,{'tableName':_0x6b84('0x8'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x6b84('0x9'),_0x6b84('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb01a=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','idField'];(function(_0x5e6ac6,_0x55e367){var _0x39d0eb=function(_0x5b8ccb){while(--_0x5b8ccb){_0x5e6ac6['push'](_0x5e6ac6['shift']());}};_0x39d0eb(++_0x55e367);}(_0xb01a,0x1a1));var _0xab01=function(_0x23bed6,_0x45f84f){_0x23bed6=_0x23bed6-0x0;var _0x1f9d5b=_0xb01a[_0x23bed6];return _0x1f9d5b;};'use strict';var _=require(_0xab01('0x0'));var util=require(_0xab01('0x1'));var logger=require(_0xab01('0x2'))(_0xab01('0x3'));var moment=require(_0xab01('0x4'));var BPromise=require(_0xab01('0x5'));var rp=require(_0xab01('0x6'));var fs=require('fs');var path=require(_0xab01('0x7'));var rimraf=require(_0xab01('0x8'));var config=require(_0xab01('0x9'));var attributes=require(_0xab01('0xa'));module[_0xab01('0xb')]=function(_0x22db85,_0x5d8dd9){return _0x22db85[_0xab01('0xc')](_0xab01('0xd'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xab01('0xe'),_0xab01('0xf')],'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 099b6ba..7b55ff6 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 _0x0295=['client','http','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3293d1,_0xdbdeb7){var _0x317c10=function(_0x3010e7){while(--_0x3010e7){_0x3293d1['push'](_0x3293d1['shift']());}};_0x317c10(++_0xdbdeb7);}(_0x0295,0x1f0));var _0x5029=function(_0x22d1ef,_0x4a5152){_0x22d1ef=_0x22d1ef-0x0;var _0x47c5a3=_0x0295[_0x22d1ef];return _0x47c5a3;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x5d58=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x52c3c3,_0x5af662){var _0x34389a=function(_0x58ea91){while(--_0x58ea91){_0x52c3c3['push'](_0x52c3c3['shift']());}};_0x34389a(++_0x5af662);}(_0x5d58,0x187));var _0x85d5=function(_0x3ef2b1,_0x5a9eef){_0x3ef2b1=_0x3ef2b1-0x0;var _0xaf18d3=_0x5d58[_0x3ef2b1];return _0xaf18d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x46e7b4,_0x5f47ec,_0x98c963){return new BPromise(function(_0x3fecca,_0x4ca293){return client[_0x85d5('0x7')](_0x46e7b4,_0x98c963)['then'](function(_0x1098be){logger[_0x85d5('0x8')](_0x85d5('0x9'),_0x5f47ec,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5f47ec,_0x85d5('0xa'),JSON[_0x85d5('0xb')](_0x1098be));if(_0x1098be[_0x85d5('0xc')]){if(_0x1098be[_0x85d5('0xc')][_0x85d5('0xd')]===0x1f4){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be['error']['message']);return _0x4ca293(_0x1098be['error'][_0x85d5('0xe')]);}logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);return _0x3fecca(_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);}else{logger['info'](_0x85d5('0x9'),_0x5f47ec,_0x85d5('0xa'));_0x3fecca(_0x1098be[_0x85d5('0xf')][_0x85d5('0xe')]);}})[_0x85d5('0x10')](function(_0x3dc83c){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x3dc83c);_0x4ca293(_0x3dc83c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 9a5636b..941e8ae 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(_0x5a00c6,_0x778bfd){var _0x27686f=function(_0x4a4e75){while(--_0x4a4e75){_0x5a00c6['push'](_0x5a00c6['shift']());}};_0x27686f(++_0x778bfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x1ee8eb,_0x141cf7){var _0x53b19c=function(_0x40496f){while(--_0x40496f){_0x1ee8eb['push'](_0x1ee8eb['shift']());}};_0x53b19c(++_0x141cf7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 3af69be..c1ba274 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 _0xd8d7=['sequelize','exports','STRING','ENUM','integrationTab','newTab'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x2742db,_0x58e00c){_0x2742db=_0x2742db-0x0;var _0x18659e=_0xd8d7[_0x2742db];return _0x18659e;};'use strict';var Sequelize=require(_0x7d8d('0x0'));module[_0x7d8d('0x1')]={'name':{'type':Sequelize[_0x7d8d('0x2')]},'description':{'type':Sequelize[_0x7d8d('0x2')]},'username':{'type':Sequelize[_0x7d8d('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7d8d('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7d8d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7d8d('0x3')](_0x7d8d('0x4'),_0x7d8d('0x5')),'defaultValue':_0x7d8d('0x4')}}; \ No newline at end of file +var _0x1189=['exports','STRING','username','integrationTab','newTab','sequelize'];(function(_0x1e3e8b,_0x40c5bd){var _0x536941=function(_0x1d85c7){while(--_0x1d85c7){_0x1e3e8b['push'](_0x1e3e8b['shift']());}};_0x536941(++_0x40c5bd);}(_0x1189,0x17f));var _0x9118=function(_0x2da8ee,_0x1ca983){_0x2da8ee=_0x2da8ee-0x0;var _0x14b3ce=_0x1189[_0x2da8ee];return _0x14b3ce;};'use strict';var Sequelize=require(_0x9118('0x0'));module[_0x9118('0x1')]={'name':{'type':Sequelize[_0x9118('0x2')]},'description':{'type':Sequelize[_0x9118('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9118('0x3')},'remoteUri':{'type':Sequelize[_0x9118('0x2')]},'password':{'type':Sequelize[_0x9118('0x2')]},'clientId':{'type':Sequelize[_0x9118('0x2')]},'clientSecret':{'type':Sequelize[_0x9118('0x2')]},'securityToken':{'type':Sequelize[_0x9118('0x2')]},'serverUrl':{'type':Sequelize[_0x9118('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9118('0x4'),_0x9118('0x5')),'defaultValue':_0x9118('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index cf8930f..a0928af 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 _0x9443=['OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','textarea','remove','includes','label','custom','picklistValues','boolean','True','true','False','test','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','update','then','error','name','send','index','map','SalesforceAccount','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','SalesforceConfiguration','rawAttributes','sort','getConfigurations','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','Connection','username','concat','isNil','ticketType','sobject','describe'];(function(_0x1ccc5b,_0x482686){var _0x392e11=function(_0x3ea298){while(--_0x3ea298){_0x1ccc5b['push'](_0x1ccc5b['shift']());}};_0x392e11(++_0x482686);}(_0x9443,0x160));var _0x3944=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x9443[_0x221b8c];return _0x3fab9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3944('0x0'));var zipdir=require(_0x3944('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3944('0x2'));var moment=require(_0x3944('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3944('0x4'));var util=require('util');var path=require(_0x3944('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3944('0x6'));var fs=require('fs');var fs_extra=require(_0x3944('0x7'));var _=require(_0x3944('0x8'));var squel=require(_0x3944('0x9'));var crypto=require(_0x3944('0xa'));var jsforce=require(_0x3944('0xb'));var deskjs=require(_0x3944('0xc'));var toCsv=require(_0x3944('0xd'));var querystring=require(_0x3944('0xe'));var Papa=require(_0x3944('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3944('0x10'));var logger=require(_0x3944('0x11'))(_0x3944('0x12'));var utils=require('../../config/utils');var config=require(_0x3944('0x13'));var licenseUtil=require(_0x3944('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3944('0x15'));function respondWithStatusCode(_0x3b289d,_0x476f58){_0x476f58=_0x476f58||0xcc;return function(_0x718a09){if(_0x718a09){return _0x3b289d[_0x3944('0x16')](_0x476f58);}return _0x3b289d[_0x3944('0x17')](_0x476f58)[_0x3944('0x18')]();};}function respondWithResult(_0x130114,_0x34f12c){_0x34f12c=_0x34f12c||0xc8;return function(_0xc673cc){if(_0xc673cc){return _0x130114['status'](_0x34f12c)[_0x3944('0x19')](_0xc673cc);}};}function respondWithFilteredResult(_0x4c8e23,_0x376d04){return function(_0x5dbfe6){if(_0x5dbfe6){var _0x267ea1=typeof _0x376d04[_0x3944('0x1a')]==='undefined'&&typeof _0x376d04[_0x3944('0x1b')]===_0x3944('0x1c');var _0x8efcec=_0x5dbfe6['count'];var _0x244175=_0x267ea1?0x0:_0x376d04['offset'];var _0x54a5ae=_0x267ea1?_0x5dbfe6[_0x3944('0x1d')]:_0x376d04[_0x3944('0x1a')]+_0x376d04[_0x3944('0x1b')];var _0x2b04e8;if(_0x54a5ae>=_0x8efcec){_0x54a5ae=_0x8efcec;_0x2b04e8=0xc8;}else{_0x2b04e8=0xce;}_0x4c8e23[_0x3944('0x17')](_0x2b04e8);return _0x4c8e23[_0x3944('0x1e')]('Content-Range',_0x244175+'-'+_0x54a5ae+'/'+_0x8efcec)[_0x3944('0x19')](_0x5dbfe6);}return null;};}function patchUpdates(_0x5152a1){return function(_0x393f65){try{jsonpatch['apply'](_0x393f65,_0x5152a1,!![]);}catch(_0x142126){return BPromise['reject'](_0x142126);}return _0x393f65['save']();};}function saveUpdates(_0x34a088,_0x5629d2){return function(_0x184c97){if(_0x184c97){return _0x184c97[_0x3944('0x1f')](_0x34a088)[_0x3944('0x20')](function(_0x464480){return _0x464480;});}return null;};}function removeEntity(_0x2cda46,_0x25806d){return function(_0x384b5e){if(_0x384b5e){return _0x384b5e['destroy']()[_0x3944('0x20')](function(){_0x2cda46[_0x3944('0x17')](0xcc)[_0x3944('0x18')]();});}};}function handleEntityNotFound(_0x20ffb8,_0xf72803){return function(_0x24c88e){if(!_0x24c88e){_0x20ffb8[_0x3944('0x16')](0x194);}return _0x24c88e;};}function handleError(_0x5153d3,_0x516cd0){_0x516cd0=_0x516cd0||0x1f4;return function(_0x39ae08){logger[_0x3944('0x21')](_0x39ae08['stack']);if(_0x39ae08[_0x3944('0x22')]){delete _0x39ae08[_0x3944('0x22')];}_0x5153d3['status'](_0x516cd0)[_0x3944('0x23')](_0x39ae08);};}exports[_0x3944('0x24')]=function(_0x23c6e6,_0x541800){var _0x28eb09={},_0x4a79b4={},_0x56de44={'count':0x0,'rows':[]};var _0x1adc71=_[_0x3944('0x25')](db[_0x3944('0x26')]['rawAttributes'],function(_0xc8f565){return{'name':_0xc8f565['fieldName'],'type':_0xc8f565[_0x3944('0x27')][_0x3944('0x28')]};});_0x4a79b4[_0x3944('0x29')]=_[_0x3944('0x25')](_0x1adc71,_0x3944('0x22'));_0x4a79b4[_0x3944('0x2a')]=_['keys'](_0x23c6e6[_0x3944('0x2a')]);_0x4a79b4[_0x3944('0x2b')]=_[_0x3944('0x2c')](_0x4a79b4[_0x3944('0x29')],_0x4a79b4[_0x3944('0x2a')]);_0x28eb09[_0x3944('0x2d')]=_[_0x3944('0x2c')](_0x4a79b4[_0x3944('0x29')],qs[_0x3944('0x2e')](_0x23c6e6[_0x3944('0x2a')][_0x3944('0x2e')]));_0x28eb09[_0x3944('0x2d')]=_0x28eb09[_0x3944('0x2d')][_0x3944('0x2f')]?_0x28eb09[_0x3944('0x2d')]:_0x4a79b4[_0x3944('0x29')];if(!_0x23c6e6[_0x3944('0x2a')][_0x3944('0x30')]('nolimit')){_0x28eb09['limit']=qs[_0x3944('0x1b')](_0x23c6e6[_0x3944('0x2a')][_0x3944('0x1b')]);_0x28eb09[_0x3944('0x1a')]=qs[_0x3944('0x1a')](_0x23c6e6[_0x3944('0x2a')][_0x3944('0x1a')]);}_0x28eb09[_0x3944('0x31')]=qs['sort'](_0x23c6e6['query']['sort']);_0x28eb09[_0x3944('0x32')]=qs[_0x3944('0x2b')](_[_0x3944('0x33')](_0x23c6e6[_0x3944('0x2a')],_0x4a79b4[_0x3944('0x2b')]),_0x1adc71);if(_0x23c6e6[_0x3944('0x2a')][_0x3944('0x34')]){_0x28eb09[_0x3944('0x32')]=_['merge'](_0x28eb09[_0x3944('0x32')],{'$or':_['map'](_0x1adc71,function(_0x1ae91a){if(_0x1ae91a[_0x3944('0x27')]!==_0x3944('0x35')){var _0xb04519={};_0xb04519[_0x1ae91a[_0x3944('0x22')]]={'$like':'%'+_0x23c6e6[_0x3944('0x2a')][_0x3944('0x34')]+'%'};return _0xb04519;}})});}_0x28eb09=_[_0x3944('0x36')]({},_0x28eb09,_0x23c6e6[_0x3944('0x37')]);var _0x53ee35={'where':_0x28eb09['where']};return db['SalesforceAccount'][_0x3944('0x1d')](_0x53ee35)[_0x3944('0x20')](function(_0x4dc99c){_0x56de44['count']=_0x4dc99c;if(_0x23c6e6[_0x3944('0x2a')]['includeAll']){_0x28eb09['include']=[{'all':!![]}];}return db[_0x3944('0x26')][_0x3944('0x38')](_0x28eb09);})[_0x3944('0x20')](function(_0x117ff0){_0x56de44[_0x3944('0x39')]=_0x117ff0;return _0x56de44;})[_0x3944('0x20')](respondWithFilteredResult(_0x541800,_0x28eb09))[_0x3944('0x3a')](handleError(_0x541800,null));};exports[_0x3944('0x3b')]=function(_0xfe92f1,_0x4538b6){var _0x4e8903={'raw':![],'where':{'id':_0xfe92f1[_0x3944('0x3c')]['id']}},_0x1a4a15={};_0x1a4a15['model']=_[_0x3944('0x3d')](db[_0x3944('0x26')]['rawAttributes']);_0x1a4a15[_0x3944('0x2a')]=_['keys'](_0xfe92f1[_0x3944('0x2a')]);_0x1a4a15[_0x3944('0x2b')]=_['intersection'](_0x1a4a15[_0x3944('0x29')],_0x1a4a15['query']);_0x4e8903['attributes']=_[_0x3944('0x2c')](_0x1a4a15['model'],qs[_0x3944('0x2e')](_0xfe92f1[_0x3944('0x2a')][_0x3944('0x2e')]));_0x4e8903['attributes']=_0x4e8903[_0x3944('0x2d')][_0x3944('0x2f')]?_0x4e8903[_0x3944('0x2d')]:_0x1a4a15[_0x3944('0x29')];if(_0xfe92f1[_0x3944('0x2a')][_0x3944('0x3e')]){_0x4e8903[_0x3944('0x3f')]=[{'all':!![]}];}_0x4e8903=_[_0x3944('0x36')]({},_0x4e8903,_0xfe92f1[_0x3944('0x37')]);return db[_0x3944('0x26')][_0x3944('0x40')](_0x4e8903)[_0x3944('0x20')](handleEntityNotFound(_0x4538b6,null))['then'](respondWithResult(_0x4538b6,null))['catch'](handleError(_0x4538b6,null));};exports[_0x3944('0x41')]=function(_0x128967,_0x16d03e){return db[_0x3944('0x26')][_0x3944('0x41')](_0x128967[_0x3944('0x42')],{})[_0x3944('0x20')](respondWithResult(_0x16d03e,0xc9))[_0x3944('0x3a')](handleError(_0x16d03e,null));};exports[_0x3944('0x1f')]=function(_0x35f6cd,_0x13e6a5){if(_0x35f6cd[_0x3944('0x42')]['id']){delete _0x35f6cd[_0x3944('0x42')]['id'];}return db[_0x3944('0x26')][_0x3944('0x40')]({'where':{'id':_0x35f6cd[_0x3944('0x3c')]['id']}})[_0x3944('0x20')](handleEntityNotFound(_0x13e6a5,null))[_0x3944('0x20')](saveUpdates(_0x35f6cd['body'],null))[_0x3944('0x20')](respondWithResult(_0x13e6a5,null))['catch'](handleError(_0x13e6a5,null));};exports['destroy']=function(_0x2ee619,_0x540204){return db[_0x3944('0x26')][_0x3944('0x40')]({'where':{'id':_0x2ee619['params']['id']}})['then'](handleEntityNotFound(_0x540204,null))['then'](removeEntity(_0x540204,null))['catch'](handleError(_0x540204,null));};exports['getConfigurations']=function(_0x23f988,_0x2aa719,_0x5b5865){var _0x557c61={};var _0x17eeea={};var _0x2870c6;var _0x176e2e;return db[_0x3944('0x26')]['findOne']({'where':{'id':_0x23f988['params']['id']}})[_0x3944('0x20')](handleEntityNotFound(_0x2aa719,null))[_0x3944('0x20')](function(_0x533696){if(_0x533696){_0x2870c6=_0x533696;_0x17eeea[_0x3944('0x29')]=_[_0x3944('0x3d')](db[_0x3944('0x43')][_0x3944('0x44')]);_0x17eeea['query']=_[_0x3944('0x3d')](_0x23f988['query']);_0x17eeea[_0x3944('0x2b')]=_['intersection'](_0x17eeea[_0x3944('0x29')],_0x17eeea[_0x3944('0x2a')]);_0x557c61[_0x3944('0x2d')]=_[_0x3944('0x2c')](_0x17eeea[_0x3944('0x29')],qs[_0x3944('0x2e')](_0x23f988[_0x3944('0x2a')][_0x3944('0x2e')]));_0x557c61[_0x3944('0x2d')]=_0x557c61[_0x3944('0x2d')][_0x3944('0x2f')]?_0x557c61[_0x3944('0x2d')]:_0x17eeea['model'];_0x557c61[_0x3944('0x31')]=qs[_0x3944('0x45')](_0x23f988['query'][_0x3944('0x45')]);_0x557c61[_0x3944('0x32')]=qs['filters'](_[_0x3944('0x33')](_0x23f988[_0x3944('0x2a')],_0x17eeea[_0x3944('0x2b')]));if(_0x23f988[_0x3944('0x2a')][_0x3944('0x34')]){_0x557c61[_0x3944('0x32')]=_[_0x3944('0x36')](_0x557c61[_0x3944('0x32')],{'$or':_[_0x3944('0x25')](_0x557c61[_0x3944('0x2d')],function(_0x3d4888){var _0x190a0c={};_0x190a0c[_0x3d4888]={'$like':'%'+_0x23f988['query']['filter']+'%'};return _0x190a0c;})});}_0x557c61=_[_0x3944('0x36')]({},_0x557c61,_0x23f988[_0x3944('0x37')]);return _0x2870c6[_0x3944('0x46')](_0x557c61);}})[_0x3944('0x20')](function(_0xa22c5f){if(_0xa22c5f){_0x176e2e=_0xa22c5f[_0x3944('0x2f')];if(!_0x23f988['query'][_0x3944('0x30')]('nolimit')){_0x557c61[_0x3944('0x1b')]=qs[_0x3944('0x1b')](_0x23f988[_0x3944('0x2a')][_0x3944('0x1b')]);_0x557c61[_0x3944('0x1a')]=qs[_0x3944('0x1a')](_0x23f988[_0x3944('0x2a')][_0x3944('0x1a')]);}return _0x2870c6[_0x3944('0x46')](_0x557c61);}})[_0x3944('0x20')](function(_0x3cd9cd){if(_0x3cd9cd){return _0x3cd9cd?{'count':_0x176e2e,'rows':_0x3cd9cd}:null;}})[_0x3944('0x20')](respondWithResult(_0x2aa719,null))[_0x3944('0x3a')](handleError(_0x2aa719,null));};exports[_0x3944('0x47')]=function(_0x497376,_0x1013cb,_0x5c59c4){if(_0x497376[_0x3944('0x42')]['id']){delete _0x497376[_0x3944('0x42')]['id'];}return db[_0x3944('0x26')][_0x3944('0x48')]({'where':{'id':_0x497376[_0x3944('0x3c')]['id']}})[_0x3944('0x20')](handleEntityNotFound(_0x1013cb,null))[_0x3944('0x20')](function(_0x2fabef){if(_0x2fabef){_0x497376['body']['AccountId']=_0x2fabef['id'];_0x497376[_0x3944('0x42')]['Subjects']=integrations[_0x3944('0x49')](_0x497376[_0x3944('0x42')][_0x3944('0x4a')],_0x497376['body'][_0x3944('0x27')]);_0x497376[_0x3944('0x42')][_0x3944('0x4b')]=integrations[_0x3944('0x4c')](_0x497376[_0x3944('0x42')][_0x3944('0x4a')],_0x497376['body'][_0x3944('0x27')]);return db['SalesforceConfiguration'][_0x3944('0x41')](_0x497376['body'],{'include':[{'model':db[_0x3944('0x4d')],'as':'Subjects'},{'model':db[_0x3944('0x4d')],'as':_0x3944('0x4b')}]});}return null;})[_0x3944('0x20')](respondWithResult(_0x1013cb,null))[_0x3944('0x3a')](handleError(_0x1013cb,null));};exports[_0x3944('0x4e')]=function(_0x15d5e7,_0x2551ba,_0x5a8056){var _0xf9846a;var _0x43646e='';var _0x455f2b=_0x3944('0x4f');return db[_0x3944('0x26')][_0x3944('0x48')]({'where':{'id':_0x15d5e7[_0x3944('0x3c')]['id']},'attributes':['id',_0x3944('0x50'),_0x3944('0x51'),_0x3944('0x52'),'username',_0x3944('0x53'),_0x3944('0x54')]})[_0x3944('0x20')](handleEntityNotFound(_0x2551ba,null))[_0x3944('0x20')](function(_0xe44cd3){if(_0xe44cd3){_0x43646e=_0xe44cd3['remoteUri'];var _0x18aeb1=_0x43646e['slice'](-0x1);if(_0x18aeb1==='/'){_0x43646e=_0x43646e['substring'](0x0,_0x43646e['lastIndexOf'](_0x18aeb1));}_0xf9846a=new jsforce[(_0x3944('0x55'))]({'oauth2':{'loginUrl':_0x43646e,'clientId':_0xe44cd3['clientId'],'clientSecret':_0xe44cd3['clientSecret']}});return _0xf9846a['login'](_0xe44cd3[_0x3944('0x56')],_0xe44cd3[_0x3944('0x53')][_0x3944('0x57')](_0xe44cd3[_0x3944('0x54')]));}})[_0x3944('0x20')](function(_0x209a4b){if(_0x209a4b){if(!_[_0x3944('0x58')](_0x15d5e7[_0x3944('0x2a')][_0x3944('0x59')])){_0x455f2b=_0x15d5e7[_0x3944('0x2a')][_0x3944('0x59')];}return _0xf9846a[_0x3944('0x5a')](_0x455f2b)[_0x3944('0x5b')]();}})[_0x3944('0x20')](function(_0x5fca85){var _0x30e4dc=[_0x3944('0x5c'),_0x3944('0x5d'),_0x3944('0x5e'),_0x3944('0x5f'),_0x3944('0x60'),'Description'];var _0x33808e=[_0x3944('0x61'),_0x3944('0x62'),'picklist','boolean','email',_0x3944('0x63'),'phone'];if(_0x5fca85){_[_0x3944('0x64')](_0x5fca85['fields'],function(_0x38d408){return _0x30e4dc[_0x3944('0x65')](_0x38d408[_0x3944('0x22')])||!_0x33808e[_0x3944('0x65')](_0x38d408[_0x3944('0x27')]);});return{'count':_0x5fca85[_0x3944('0x2e')][_0x3944('0x2f')],'rows':_[_0x3944('0x25')](_0x5fca85[_0x3944('0x2e')],function(_0x4b7c6a){return{'id':_0x4b7c6a['name'],'name':_0x4b7c6a[_0x3944('0x66')],'custom':_0x4b7c6a[_0x3944('0x67')],'options':_0x4b7c6a['picklistValues'][_0x3944('0x2f')]>0x0?_[_0x3944('0x25')](_0x4b7c6a[_0x3944('0x68')],function(_0x30fffe){return{'name':_0x30fffe[_0x3944('0x66')],'value':_0x30fffe['value']};}):_0x4b7c6a[_0x3944('0x27')]==_0x3944('0x69')?[{'name':_0x3944('0x6a'),'value':_0x3944('0x6b')},{'name':_0x3944('0x6c'),'value':'false'}]:[]};})};}})[_0x3944('0x20')](respondWithResult(_0x2551ba,null))['catch'](function(_0x48188e){var _0x555f7b=_0x15d5e7[_0x3944('0x2a')][_0x3944('0x6d')]?0x1f4:_0x48188e['statusCode']||0x1f4;logger[_0x3944('0x21')](_0x3944('0x6e'),_0x3944('0x4e'),_0x555f7b,JSON['stringify'](_0x48188e));delete _0x48188e[_0x3944('0x22')];if(_0x555f7b===0x191){_0x555f7b=0x190;}_0x2551ba[_0x3944('0x17')](_0x555f7b)[_0x3944('0x23')](_0x15d5e7[_0x3944('0x2a')][_0x3944('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x48188e['statusCode']}:_0x48188e);});}; \ No newline at end of file +var _0xce91=['create','body','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','remoteUri','clientId','username','substring','Connection','clientSecret','login','password','concat','securityToken','isNil','ticketType','describe','ActivityDate','Description','string','int','picklist','textarea','phone','remove','includes','label','custom','picklistValues','True','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','SalesforceAccount','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x83a430,_0x5de1c1){var _0x129f09=function(_0x6deaa4){while(--_0x6deaa4){_0x83a430['push'](_0x83a430['shift']());}};_0x129f09(++_0x5de1c1);}(_0xce91,0xac));var _0x1ce9=function(_0x39387d,_0x2ccf21){_0x39387d=_0x39387d-0x0;var _0x581c15=_0xce91[_0x39387d];return _0x581c15;};'use strict';var emlformat=require(_0x1ce9('0x0'));var rimraf=require(_0x1ce9('0x1'));var zipdir=require(_0x1ce9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1ce9('0x3'));var BPromise=require(_0x1ce9('0x4'));var Mustache=require(_0x1ce9('0x5'));var util=require(_0x1ce9('0x6'));var path=require(_0x1ce9('0x7'));var sox=require('sox');var csv=require(_0x1ce9('0x8'));var ejs=require(_0x1ce9('0x9'));var fs=require('fs');var fs_extra=require(_0x1ce9('0xa'));var _=require(_0x1ce9('0xb'));var squel=require(_0x1ce9('0xc'));var crypto=require(_0x1ce9('0xd'));var jsforce=require(_0x1ce9('0xe'));var deskjs=require(_0x1ce9('0xf'));var toCsv=require(_0x1ce9('0x8'));var querystring=require(_0x1ce9('0x10'));var Papa=require('papaparse');var Redis=require(_0x1ce9('0x11'));var authService=require(_0x1ce9('0x12'));var qs=require(_0x1ce9('0x13'));var as=require(_0x1ce9('0x14'));var hardwareService=require(_0x1ce9('0x15'));var logger=require(_0x1ce9('0x16'))(_0x1ce9('0x17'));var utils=require(_0x1ce9('0x18'));var config=require(_0x1ce9('0x19'));var licenseUtil=require(_0x1ce9('0x1a'));var db=require(_0x1ce9('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x960fc6,_0x2429c4){_0x2429c4=_0x2429c4||0xcc;return function(_0x47f57a){if(_0x47f57a){return _0x960fc6['sendStatus'](_0x2429c4);}return _0x960fc6[_0x1ce9('0x1c')](_0x2429c4)[_0x1ce9('0x1d')]();};}function respondWithResult(_0xfbabb2,_0x215da4){_0x215da4=_0x215da4||0xc8;return function(_0x213136){if(_0x213136){return _0xfbabb2[_0x1ce9('0x1c')](_0x215da4)[_0x1ce9('0x1e')](_0x213136);}};}function respondWithFilteredResult(_0x32a1b5,_0x4cbe2c){return function(_0x2631e4){if(_0x2631e4){var _0x1edd8e=typeof _0x4cbe2c[_0x1ce9('0x1f')]===_0x1ce9('0x20')&&typeof _0x4cbe2c['limit']===_0x1ce9('0x20');var _0x27ccb3=_0x2631e4[_0x1ce9('0x21')];var _0x3ba175=_0x1edd8e?0x0:_0x4cbe2c['offset'];var _0x1c0025=_0x1edd8e?_0x2631e4['count']:_0x4cbe2c[_0x1ce9('0x1f')]+_0x4cbe2c['limit'];var _0x5b845a;if(_0x1c0025>=_0x27ccb3){_0x1c0025=_0x27ccb3;_0x5b845a=0xc8;}else{_0x5b845a=0xce;}_0x32a1b5['status'](_0x5b845a);return _0x32a1b5[_0x1ce9('0x22')](_0x1ce9('0x23'),_0x3ba175+'-'+_0x1c0025+'/'+_0x27ccb3)[_0x1ce9('0x1e')](_0x2631e4);}return null;};}function patchUpdates(_0x2124da){return function(_0x79f614){try{jsonpatch[_0x1ce9('0x24')](_0x79f614,_0x2124da,!![]);}catch(_0x1a4f18){return BPromise[_0x1ce9('0x25')](_0x1a4f18);}return _0x79f614[_0x1ce9('0x26')]();};}function saveUpdates(_0x4bea14,_0x41ec6d){return function(_0x5e4b87){if(_0x5e4b87){return _0x5e4b87[_0x1ce9('0x27')](_0x4bea14)[_0x1ce9('0x28')](function(_0x363eb3){return _0x363eb3;});}return null;};}function removeEntity(_0x5eb8d5,_0x2e14d7){return function(_0x4cd675){if(_0x4cd675){return _0x4cd675[_0x1ce9('0x29')]()['then'](function(){_0x5eb8d5[_0x1ce9('0x1c')](0xcc)[_0x1ce9('0x1d')]();});}};}function handleEntityNotFound(_0x25c5cf,_0x33877f){return function(_0xc03d2a){if(!_0xc03d2a){_0x25c5cf[_0x1ce9('0x2a')](0x194);}return _0xc03d2a;};}function handleError(_0x17d0a2,_0x4100c8){_0x4100c8=_0x4100c8||0x1f4;return function(_0x42fd6a){logger['error'](_0x42fd6a[_0x1ce9('0x2b')]);if(_0x42fd6a[_0x1ce9('0x2c')]){delete _0x42fd6a[_0x1ce9('0x2c')];}_0x17d0a2[_0x1ce9('0x1c')](_0x4100c8)[_0x1ce9('0x2d')](_0x42fd6a);};}exports[_0x1ce9('0x2e')]=function(_0x4b7a49,_0x3659f1){var _0x48e39f={},_0x33161a={},_0x5c8048={'count':0x0,'rows':[]};var _0x3b00d5=_[_0x1ce9('0x2f')](db['SalesforceAccount'][_0x1ce9('0x30')],function(_0x296636){return{'name':_0x296636[_0x1ce9('0x31')],'type':_0x296636[_0x1ce9('0x32')]['key']};});_0x33161a[_0x1ce9('0x33')]=_[_0x1ce9('0x2f')](_0x3b00d5,'name');_0x33161a[_0x1ce9('0x34')]=_[_0x1ce9('0x35')](_0x4b7a49[_0x1ce9('0x34')]);_0x33161a[_0x1ce9('0x36')]=_[_0x1ce9('0x37')](_0x33161a['model'],_0x33161a[_0x1ce9('0x34')]);_0x48e39f[_0x1ce9('0x38')]=_[_0x1ce9('0x37')](_0x33161a[_0x1ce9('0x33')],qs[_0x1ce9('0x39')](_0x4b7a49[_0x1ce9('0x34')]['fields']));_0x48e39f[_0x1ce9('0x38')]=_0x48e39f[_0x1ce9('0x38')][_0x1ce9('0x3a')]?_0x48e39f[_0x1ce9('0x38')]:_0x33161a['model'];if(!_0x4b7a49[_0x1ce9('0x34')]['hasOwnProperty'](_0x1ce9('0x3b'))){_0x48e39f[_0x1ce9('0x3c')]=qs[_0x1ce9('0x3c')](_0x4b7a49['query'][_0x1ce9('0x3c')]);_0x48e39f['offset']=qs[_0x1ce9('0x1f')](_0x4b7a49[_0x1ce9('0x34')][_0x1ce9('0x1f')]);}_0x48e39f[_0x1ce9('0x3d')]=qs[_0x1ce9('0x3e')](_0x4b7a49['query'][_0x1ce9('0x3e')]);_0x48e39f[_0x1ce9('0x3f')]=qs[_0x1ce9('0x36')](_[_0x1ce9('0x40')](_0x4b7a49[_0x1ce9('0x34')],_0x33161a[_0x1ce9('0x36')]),_0x3b00d5);if(_0x4b7a49[_0x1ce9('0x34')][_0x1ce9('0x41')]){_0x48e39f['where']=_['merge'](_0x48e39f[_0x1ce9('0x3f')],{'$or':_[_0x1ce9('0x2f')](_0x3b00d5,function(_0x3153f8){if(_0x3153f8['type']!==_0x1ce9('0x42')){var _0x55fe92={};_0x55fe92[_0x3153f8['name']]={'$like':'%'+_0x4b7a49['query'][_0x1ce9('0x41')]+'%'};return _0x55fe92;}})});}_0x48e39f=_[_0x1ce9('0x43')]({},_0x48e39f,_0x4b7a49[_0x1ce9('0x44')]);var _0x135f84={'where':_0x48e39f[_0x1ce9('0x3f')]};return db[_0x1ce9('0x45')][_0x1ce9('0x21')](_0x135f84)['then'](function(_0x2f137a){_0x5c8048[_0x1ce9('0x21')]=_0x2f137a;if(_0x4b7a49[_0x1ce9('0x34')][_0x1ce9('0x46')]){_0x48e39f['include']=[{'all':!![]}];}return db[_0x1ce9('0x45')][_0x1ce9('0x47')](_0x48e39f);})[_0x1ce9('0x28')](function(_0x40d895){_0x5c8048[_0x1ce9('0x48')]=_0x40d895;return _0x5c8048;})[_0x1ce9('0x28')](respondWithFilteredResult(_0x3659f1,_0x48e39f))[_0x1ce9('0x49')](handleError(_0x3659f1,null));};exports[_0x1ce9('0x4a')]=function(_0x418911,_0xe88ccd){var _0x1b6309={'raw':![],'where':{'id':_0x418911[_0x1ce9('0x4b')]['id']}},_0x1cb7a5={};_0x1cb7a5[_0x1ce9('0x33')]=_['keys'](db[_0x1ce9('0x45')][_0x1ce9('0x30')]);_0x1cb7a5[_0x1ce9('0x34')]=_[_0x1ce9('0x35')](_0x418911['query']);_0x1cb7a5[_0x1ce9('0x36')]=_[_0x1ce9('0x37')](_0x1cb7a5[_0x1ce9('0x33')],_0x1cb7a5['query']);_0x1b6309[_0x1ce9('0x38')]=_[_0x1ce9('0x37')](_0x1cb7a5['model'],qs[_0x1ce9('0x39')](_0x418911[_0x1ce9('0x34')][_0x1ce9('0x39')]));_0x1b6309[_0x1ce9('0x38')]=_0x1b6309[_0x1ce9('0x38')][_0x1ce9('0x3a')]?_0x1b6309[_0x1ce9('0x38')]:_0x1cb7a5[_0x1ce9('0x33')];if(_0x418911['query'][_0x1ce9('0x46')]){_0x1b6309[_0x1ce9('0x4c')]=[{'all':!![]}];}_0x1b6309=_['merge']({},_0x1b6309,_0x418911[_0x1ce9('0x44')]);return db[_0x1ce9('0x45')][_0x1ce9('0x4d')](_0x1b6309)['then'](handleEntityNotFound(_0xe88ccd,null))[_0x1ce9('0x28')](respondWithResult(_0xe88ccd,null))[_0x1ce9('0x49')](handleError(_0xe88ccd,null));};exports[_0x1ce9('0x4e')]=function(_0x3f2b50,_0x103a73){return db['SalesforceAccount'][_0x1ce9('0x4e')](_0x3f2b50[_0x1ce9('0x4f')],{})[_0x1ce9('0x28')](respondWithResult(_0x103a73,0xc9))['catch'](handleError(_0x103a73,null));};exports[_0x1ce9('0x27')]=function(_0x4c85bc,_0x220cc1){if(_0x4c85bc[_0x1ce9('0x4f')]['id']){delete _0x4c85bc[_0x1ce9('0x4f')]['id'];}return db['SalesforceAccount'][_0x1ce9('0x4d')]({'where':{'id':_0x4c85bc[_0x1ce9('0x4b')]['id']}})[_0x1ce9('0x28')](handleEntityNotFound(_0x220cc1,null))['then'](saveUpdates(_0x4c85bc[_0x1ce9('0x4f')],null))[_0x1ce9('0x28')](respondWithResult(_0x220cc1,null))[_0x1ce9('0x49')](handleError(_0x220cc1,null));};exports[_0x1ce9('0x29')]=function(_0x54b1ea,_0xaab4e6){return db[_0x1ce9('0x45')][_0x1ce9('0x4d')]({'where':{'id':_0x54b1ea[_0x1ce9('0x4b')]['id']}})['then'](handleEntityNotFound(_0xaab4e6,null))[_0x1ce9('0x28')](removeEntity(_0xaab4e6,null))[_0x1ce9('0x49')](handleError(_0xaab4e6,null));};exports[_0x1ce9('0x50')]=function(_0x1d3427,_0x18ef0f,_0x3eee4f){var _0x4fdca6={};var _0x4c0674={};var _0x31023d;var _0x58eccd;return db[_0x1ce9('0x45')][_0x1ce9('0x51')]({'where':{'id':_0x1d3427[_0x1ce9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x18ef0f,null))[_0x1ce9('0x28')](function(_0x452027){if(_0x452027){_0x31023d=_0x452027;_0x4c0674[_0x1ce9('0x33')]=_[_0x1ce9('0x35')](db[_0x1ce9('0x52')][_0x1ce9('0x30')]);_0x4c0674['query']=_[_0x1ce9('0x35')](_0x1d3427[_0x1ce9('0x34')]);_0x4c0674[_0x1ce9('0x36')]=_[_0x1ce9('0x37')](_0x4c0674[_0x1ce9('0x33')],_0x4c0674[_0x1ce9('0x34')]);_0x4fdca6[_0x1ce9('0x38')]=_[_0x1ce9('0x37')](_0x4c0674[_0x1ce9('0x33')],qs[_0x1ce9('0x39')](_0x1d3427[_0x1ce9('0x34')][_0x1ce9('0x39')]));_0x4fdca6[_0x1ce9('0x38')]=_0x4fdca6[_0x1ce9('0x38')]['length']?_0x4fdca6['attributes']:_0x4c0674[_0x1ce9('0x33')];_0x4fdca6[_0x1ce9('0x3d')]=qs['sort'](_0x1d3427[_0x1ce9('0x34')][_0x1ce9('0x3e')]);_0x4fdca6[_0x1ce9('0x3f')]=qs[_0x1ce9('0x36')](_['pick'](_0x1d3427[_0x1ce9('0x34')],_0x4c0674[_0x1ce9('0x36')]));if(_0x1d3427[_0x1ce9('0x34')][_0x1ce9('0x41')]){_0x4fdca6[_0x1ce9('0x3f')]=_[_0x1ce9('0x43')](_0x4fdca6[_0x1ce9('0x3f')],{'$or':_[_0x1ce9('0x2f')](_0x4fdca6[_0x1ce9('0x38')],function(_0x51afec){var _0x5cebdf={};_0x5cebdf[_0x51afec]={'$like':'%'+_0x1d3427[_0x1ce9('0x34')][_0x1ce9('0x41')]+'%'};return _0x5cebdf;})});}_0x4fdca6=_[_0x1ce9('0x43')]({},_0x4fdca6,_0x1d3427[_0x1ce9('0x44')]);return _0x31023d['getConfigurations'](_0x4fdca6);}})[_0x1ce9('0x28')](function(_0x25a9de){if(_0x25a9de){_0x58eccd=_0x25a9de[_0x1ce9('0x3a')];if(!_0x1d3427[_0x1ce9('0x34')][_0x1ce9('0x53')](_0x1ce9('0x3b'))){_0x4fdca6[_0x1ce9('0x3c')]=qs[_0x1ce9('0x3c')](_0x1d3427[_0x1ce9('0x34')][_0x1ce9('0x3c')]);_0x4fdca6['offset']=qs[_0x1ce9('0x1f')](_0x1d3427[_0x1ce9('0x34')][_0x1ce9('0x1f')]);}return _0x31023d['getConfigurations'](_0x4fdca6);}})[_0x1ce9('0x28')](function(_0x524af9){if(_0x524af9){return _0x524af9?{'count':_0x58eccd,'rows':_0x524af9}:null;}})[_0x1ce9('0x28')](respondWithResult(_0x18ef0f,null))['catch'](handleError(_0x18ef0f,null));};exports[_0x1ce9('0x54')]=function(_0x51c920,_0x9ab2ad,_0x419b42){if(_0x51c920[_0x1ce9('0x4f')]['id']){delete _0x51c920[_0x1ce9('0x4f')]['id'];}return db[_0x1ce9('0x45')][_0x1ce9('0x51')]({'where':{'id':_0x51c920[_0x1ce9('0x4b')]['id']}})[_0x1ce9('0x28')](handleEntityNotFound(_0x9ab2ad,null))[_0x1ce9('0x28')](function(_0x584666){if(_0x584666){_0x51c920[_0x1ce9('0x4f')]['AccountId']=_0x584666['id'];_0x51c920[_0x1ce9('0x4f')]['Subjects']=integrations[_0x1ce9('0x55')](_0x51c920[_0x1ce9('0x4f')][_0x1ce9('0x56')],_0x51c920['body']['type']);_0x51c920[_0x1ce9('0x4f')][_0x1ce9('0x57')]=integrations[_0x1ce9('0x58')](_0x51c920[_0x1ce9('0x4f')][_0x1ce9('0x56')],_0x51c920['body'][_0x1ce9('0x32')]);return db[_0x1ce9('0x52')][_0x1ce9('0x4e')](_0x51c920[_0x1ce9('0x4f')],{'include':[{'model':db[_0x1ce9('0x59')],'as':_0x1ce9('0x5a')},{'model':db[_0x1ce9('0x59')],'as':_0x1ce9('0x57')}]});}return null;})[_0x1ce9('0x28')](respondWithResult(_0x9ab2ad,null))[_0x1ce9('0x49')](handleError(_0x9ab2ad,null));};exports[_0x1ce9('0x5b')]=function(_0x84e810,_0x2a6e18,_0xb7722d){var _0x51895a;var _0x2206b5='';var _0x3081ef='Task';return db[_0x1ce9('0x45')][_0x1ce9('0x51')]({'where':{'id':_0x84e810[_0x1ce9('0x4b')]['id']},'attributes':['id',_0x1ce9('0x5c'),_0x1ce9('0x5d'),'clientSecret',_0x1ce9('0x5e'),'password','securityToken']})['then'](handleEntityNotFound(_0x2a6e18,null))['then'](function(_0x7e9352){if(_0x7e9352){_0x2206b5=_0x7e9352[_0x1ce9('0x5c')];var _0x1defd1=_0x2206b5['slice'](-0x1);if(_0x1defd1==='/'){_0x2206b5=_0x2206b5[_0x1ce9('0x5f')](0x0,_0x2206b5['lastIndexOf'](_0x1defd1));}_0x51895a=new jsforce[(_0x1ce9('0x60'))]({'oauth2':{'loginUrl':_0x2206b5,'clientId':_0x7e9352['clientId'],'clientSecret':_0x7e9352[_0x1ce9('0x61')]}});return _0x51895a[_0x1ce9('0x62')](_0x7e9352['username'],_0x7e9352[_0x1ce9('0x63')][_0x1ce9('0x64')](_0x7e9352[_0x1ce9('0x65')]));}})[_0x1ce9('0x28')](function(_0x497910){if(_0x497910){if(!_[_0x1ce9('0x66')](_0x84e810[_0x1ce9('0x34')][_0x1ce9('0x67')])){_0x3081ef=_0x84e810[_0x1ce9('0x34')][_0x1ce9('0x67')];}return _0x51895a['sobject'](_0x3081ef)[_0x1ce9('0x68')]();}})[_0x1ce9('0x28')](function(_0x54378b){var _0x141e29=['OwnerId',_0x1ce9('0x69'),'IsReminderSet','IsRecurrence','Subject',_0x1ce9('0x6a')];var _0x5106eb=[_0x1ce9('0x6b'),_0x1ce9('0x6c'),_0x1ce9('0x6d'),'boolean','email',_0x1ce9('0x6e'),_0x1ce9('0x6f')];if(_0x54378b){_[_0x1ce9('0x70')](_0x54378b[_0x1ce9('0x39')],function(_0x4d500f){return _0x141e29[_0x1ce9('0x71')](_0x4d500f[_0x1ce9('0x2c')])||!_0x5106eb[_0x1ce9('0x71')](_0x4d500f['type']);});return{'count':_0x54378b['fields'][_0x1ce9('0x3a')],'rows':_['map'](_0x54378b[_0x1ce9('0x39')],function(_0xe0cd2b){return{'id':_0xe0cd2b[_0x1ce9('0x2c')],'name':_0xe0cd2b[_0x1ce9('0x72')],'custom':_0xe0cd2b[_0x1ce9('0x73')],'options':_0xe0cd2b[_0x1ce9('0x74')][_0x1ce9('0x3a')]>0x0?_[_0x1ce9('0x2f')](_0xe0cd2b['picklistValues'],function(_0x1a7ecb){return{'name':_0x1a7ecb[_0x1ce9('0x72')],'value':_0x1a7ecb['value']};}):_0xe0cd2b[_0x1ce9('0x32')]=='boolean'?[{'name':_0x1ce9('0x75'),'value':'true'},{'name':_0x1ce9('0x76'),'value':_0x1ce9('0x77')}]:[]};})};}})[_0x1ce9('0x28')](respondWithResult(_0x2a6e18,null))['catch'](function(_0x4f8910){var _0xd61e0e=_0x84e810[_0x1ce9('0x34')][_0x1ce9('0x78')]?0x1f4:_0x4f8910[_0x1ce9('0x79')]||0x1f4;logger[_0x1ce9('0x7a')](_0x1ce9('0x7b'),_0x1ce9('0x5b'),_0xd61e0e,JSON['stringify'](_0x4f8910));delete _0x4f8910['name'];if(_0xd61e0e===0x191){_0xd61e0e=0x190;}_0x2a6e18[_0x1ce9('0x1c')](_0xd61e0e)[_0x1ce9('0x2d')](_0x84e810[_0x1ce9('0x34')][_0x1ce9('0x78')]?{'message':_0x1ce9('0x7c'),'statusCode':_0x4f8910[_0x1ce9('0x79')]}:_0x4f8910);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 3f4cdd5..cd66d26 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 _0xd46e=['int_salesforce_accounts','lodash','moment','bluebird','request-promise','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x14df8d,_0x30ed7b){var _0x5c2d9a=function(_0x21b272){while(--_0x21b272){_0x14df8d['push'](_0x14df8d['shift']());}};_0x5c2d9a(++_0x30ed7b);}(_0xd46e,0x1a3));var _0xed46=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xd46e[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0xed46('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xed46('0x1'));var BPromise=require(_0xed46('0x2'));var rp=require(_0xed46('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed46('0x4'));var config=require('../../config/environment');var attributes=require(_0xed46('0x5'));var integrations=require(_0xed46('0x6'));module[_0xed46('0x7')]=function(_0x5a82ef,_0x3a517b){return _0x5a82ef[_0xed46('0x8')](_0xed46('0x9'),attributes,{'tableName':_0xed46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f40=['exports','define','SalesforceAccount','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x14cf7b,_0x65bee6){var _0x298739=function(_0x49e4be){while(--_0x49e4be){_0x14cf7b['push'](_0x14cf7b['shift']());}};_0x298739(++_0x65bee6);}(_0x5f40,0x148));var _0x05f4=function(_0x1547ae,_0x420144){_0x1547ae=_0x1547ae-0x0;var _0x286a19=_0x5f40[_0x1547ae];return _0x286a19;};'use strict';var _=require(_0x05f4('0x0'));var util=require(_0x05f4('0x1'));var logger=require(_0x05f4('0x2'))(_0x05f4('0x3'));var moment=require(_0x05f4('0x4'));var BPromise=require('bluebird');var rp=require(_0x05f4('0x5'));var fs=require('fs');var path=require(_0x05f4('0x6'));var rimraf=require(_0x05f4('0x7'));var config=require('../../config/environment');var attributes=require(_0x05f4('0x8'));var integrations=require(_0x05f4('0x9'));module[_0x05f4('0xa')]=function(_0x1123cc,_0x274112){return _0x1123cc[_0x05f4('0xb')](_0x05f4('0xc'),attributes,{'tableName':'int_salesforce_accounts','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 c893b8f..c78e7bf 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 _0x8935=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetSalesforceAccount','options','raw','where','limit','include','model','map','attributes','ShowSalesforceAccount','SalesforceAccount','find','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s'];(function(_0x2c0d5a,_0x11ea41){var _0x2fa8f9=function(_0x47f05b){while(--_0x47f05b){_0x2c0d5a['push'](_0x2c0d5a['shift']());}};_0x2fa8f9(++_0x11ea41);}(_0x8935,0xbe));var _0x5893=function(_0x4f9c08,_0x4d83df){_0x4f9c08=_0x4f9c08-0x0;var _0x4da7e5=_0x8935[_0x4f9c08];return _0x4da7e5;};'use strict';var _=require(_0x5893('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5893('0x1'));var rs=require(_0x5893('0x2'));var fs=require('fs');var Redis=require(_0x5893('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5893('0x4'));var logger=require(_0x5893('0x5'))('rpc');var config=require(_0x5893('0x6'));var jayson=require(_0x5893('0x7'));var client=jayson[_0x5893('0x8')][_0x5893('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14f20c,_0x36329b,_0x205af8){return new BPromise(function(_0x15adad,_0x3691fb){return client[_0x5893('0xa')](_0x14f20c,_0x205af8)[_0x5893('0xb')](function(_0x2627be){logger[_0x5893('0xc')](_0x5893('0xd'),_0x36329b,'request\x20sent');logger[_0x5893('0xe')](_0x5893('0xf'),_0x36329b,_0x5893('0x10'),JSON[_0x5893('0x11')](_0x2627be));if(_0x2627be[_0x5893('0x12')]){if(_0x2627be[_0x5893('0x12')][_0x5893('0x13')]===0x1f4){logger[_0x5893('0x12')](_0x5893('0xd'),_0x36329b,_0x2627be[_0x5893('0x12')][_0x5893('0x14')]);return _0x3691fb(_0x2627be[_0x5893('0x12')][_0x5893('0x14')]);}logger[_0x5893('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x36329b,_0x2627be[_0x5893('0x12')][_0x5893('0x14')]);return _0x15adad(_0x2627be[_0x5893('0x12')]['message']);}else{logger[_0x5893('0xc')](_0x5893('0xd'),_0x36329b,_0x5893('0x10'));_0x15adad(_0x2627be['result'][_0x5893('0x14')]);}})[_0x5893('0x15')](function(_0xd0bc36){logger[_0x5893('0x12')](_0x5893('0xd'),_0x36329b,_0xd0bc36);_0x3691fb(_0xd0bc36);});});}exports[_0x5893('0x16')]=function(_0x54b45d){var _0x5b8ae6=this;return new Promise(function(_0x57fe06,_0xf69dab){return db['SalesforceAccount']['findAll']({'raw':_0x54b45d[_0x5893('0x17')]?_0x54b45d['options'][_0x5893('0x18')]===undefined?!![]:![]:!![],'where':_0x54b45d[_0x5893('0x17')]?_0x54b45d[_0x5893('0x17')][_0x5893('0x19')]||null:null,'attributes':_0x54b45d['options']?_0x54b45d[_0x5893('0x17')]['attributes']||null:null,'limit':_0x54b45d[_0x5893('0x17')]?_0x54b45d[_0x5893('0x17')][_0x5893('0x1a')]||null:null,'include':_0x54b45d[_0x5893('0x17')]?_0x54b45d[_0x5893('0x17')][_0x5893('0x1b')]?_['map'](_0x54b45d[_0x5893('0x17')][_0x5893('0x1b')],function(_0x1877e9){return{'model':db[_0x1877e9[_0x5893('0x1c')]],'as':_0x1877e9['as'],'attributes':_0x1877e9['attributes'],'include':_0x1877e9['include']?_[_0x5893('0x1d')](_0x1877e9['include'],function(_0x26a76a){return{'model':db[_0x26a76a[_0x5893('0x1c')]],'as':_0x26a76a['as'],'attributes':_0x26a76a[_0x5893('0x1e')],'include':_0x26a76a[_0x5893('0x1b')]?_['map'](_0x26a76a[_0x5893('0x1b')],function(_0x1819fb){return{'model':db[_0x1819fb['model']],'as':_0x1819fb['as'],'attributes':_0x1819fb[_0x5893('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5893('0xb')](function(_0x57dab5){logger[_0x5893('0xc')](_0x5893('0x16'),_0x54b45d);logger[_0x5893('0xe')](_0x5893('0x16'),_0x54b45d,JSON[_0x5893('0x11')](_0x57dab5));_0x57fe06(_0x57dab5);})['catch'](function(_0x273d02){logger[_0x5893('0x12')]('GetSalesforceAccount',_0x273d02[_0x5893('0x14')],_0x54b45d);_0xf69dab(_0x5b8ae6[_0x5893('0x12')](0x1f4,_0x273d02['message']));});});};exports[_0x5893('0x1f')]=function(_0xcbb8e6){var _0x3c63e4=this;return new Promise(function(_0x2f1fea,_0x6b1ac){return db[_0x5893('0x20')][_0x5893('0x21')]({'raw':_0xcbb8e6[_0x5893('0x17')]?_0xcbb8e6['options']['raw']===undefined?!![]:![]:!![],'where':_0xcbb8e6[_0x5893('0x17')]?_0xcbb8e6['options'][_0x5893('0x19')]||null:null,'attributes':_0xcbb8e6[_0x5893('0x17')]?_0xcbb8e6[_0x5893('0x17')][_0x5893('0x1e')]||null:null,'include':_0xcbb8e6[_0x5893('0x17')]?_0xcbb8e6['options'][_0x5893('0x1b')]?_[_0x5893('0x1d')](_0xcbb8e6[_0x5893('0x17')][_0x5893('0x1b')],function(_0x10c7f5){return{'model':db[_0x10c7f5[_0x5893('0x1c')]],'as':_0x10c7f5['as'],'attributes':_0x10c7f5[_0x5893('0x1e')],'include':_0x10c7f5[_0x5893('0x1b')]?_[_0x5893('0x1d')](_0x10c7f5['include'],function(_0x53c0a4){return{'model':db[_0x53c0a4['model']],'as':_0x53c0a4['as'],'attributes':_0x53c0a4['attributes'],'include':_0x53c0a4[_0x5893('0x1b')]?_[_0x5893('0x1d')](_0x53c0a4[_0x5893('0x1b')],function(_0x371a43){return{'model':db[_0x371a43[_0x5893('0x1c')]],'as':_0x371a43['as'],'attributes':_0x371a43[_0x5893('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5893('0xb')](function(_0xd8c4bf){logger[_0x5893('0xc')](_0x5893('0x1f'),_0xcbb8e6);logger[_0x5893('0xe')](_0x5893('0x1f'),_0xcbb8e6,JSON[_0x5893('0x11')](_0xd8c4bf));_0x2f1fea(_0xd8c4bf);})[_0x5893('0x15')](function(_0x16c002){logger[_0x5893('0x12')](_0x5893('0x1f'),_0x16c002['message'],_0xcbb8e6);_0x6b1ac(_0x3c63e4[_0x5893('0x12')](0x1f4,_0x16c002[_0x5893('0x14')]));});});}; \ No newline at end of file +var _0x5885=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','include','map','model','ShowSalesforceAccount','find','where','util'];(function(_0x5e24ad,_0x54f201){var _0x496294=function(_0xe7e031){while(--_0xe7e031){_0x5e24ad['push'](_0x5e24ad['shift']());}};_0x496294(++_0x54f201);}(_0x5885,0x7f));var _0x5588=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5885[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x5588('0x0'));var moment=require('moment');var BPromise=require(_0x5588('0x1'));var rs=require(_0x5588('0x2'));var fs=require('fs');var Redis=require(_0x5588('0x3'));var db=require(_0x5588('0x4'))['db'];var utils=require(_0x5588('0x5'));var logger=require(_0x5588('0x6'))(_0x5588('0x7'));var config=require(_0x5588('0x8'));var jayson=require(_0x5588('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x591668,_0xf5f7ad,_0x15efdc){return new BPromise(function(_0x5a02f9,_0x1e496d){return client['request'](_0x591668,_0x15efdc)[_0x5588('0xa')](function(_0xddcb3){logger['info'](_0x5588('0xb'),_0xf5f7ad,_0x5588('0xc'));logger[_0x5588('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xf5f7ad,'request\x20sent',JSON[_0x5588('0xe')](_0xddcb3));if(_0xddcb3[_0x5588('0xf')]){if(_0xddcb3['error']['code']===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0xf5f7ad,_0xddcb3[_0x5588('0xf')][_0x5588('0x10')]);return _0x1e496d(_0xddcb3[_0x5588('0xf')][_0x5588('0x10')]);}logger[_0x5588('0xf')](_0x5588('0xb'),_0xf5f7ad,_0xddcb3[_0x5588('0xf')]['message']);return _0x5a02f9(_0xddcb3[_0x5588('0xf')]['message']);}else{logger[_0x5588('0x11')](_0x5588('0xb'),_0xf5f7ad,'request\x20sent');_0x5a02f9(_0xddcb3[_0x5588('0x12')][_0x5588('0x10')]);}})[_0x5588('0x13')](function(_0x511e27){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0xf5f7ad,_0x511e27);_0x1e496d(_0x511e27);});});}exports[_0x5588('0x14')]=function(_0x2826e0){var _0x4bad21=this;return new Promise(function(_0x50c1e4,_0x30c145){return db[_0x5588('0x15')][_0x5588('0x16')]({'raw':_0x2826e0['options']?_0x2826e0[_0x5588('0x17')][_0x5588('0x18')]===undefined?!![]:![]:!![],'where':_0x2826e0[_0x5588('0x17')]?_0x2826e0[_0x5588('0x17')]['where']||null:null,'attributes':_0x2826e0[_0x5588('0x17')]?_0x2826e0[_0x5588('0x17')][_0x5588('0x19')]||null:null,'limit':_0x2826e0[_0x5588('0x17')]?_0x2826e0[_0x5588('0x17')]['limit']||null:null,'include':_0x2826e0['options']?_0x2826e0[_0x5588('0x17')][_0x5588('0x1a')]?_[_0x5588('0x1b')](_0x2826e0[_0x5588('0x17')]['include'],function(_0x5d175d){return{'model':db[_0x5d175d[_0x5588('0x1c')]],'as':_0x5d175d['as'],'attributes':_0x5d175d[_0x5588('0x19')],'include':_0x5d175d[_0x5588('0x1a')]?_[_0x5588('0x1b')](_0x5d175d[_0x5588('0x1a')],function(_0x20ebdd){return{'model':db[_0x20ebdd[_0x5588('0x1c')]],'as':_0x20ebdd['as'],'attributes':_0x20ebdd[_0x5588('0x19')],'include':_0x20ebdd['include']?_[_0x5588('0x1b')](_0x20ebdd['include'],function(_0x63884a){return{'model':db[_0x63884a['model']],'as':_0x63884a['as'],'attributes':_0x63884a[_0x5588('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x149d4b){logger[_0x5588('0x11')](_0x5588('0x14'),_0x2826e0);logger[_0x5588('0xd')](_0x5588('0x14'),_0x2826e0,JSON[_0x5588('0xe')](_0x149d4b));_0x50c1e4(_0x149d4b);})['catch'](function(_0x12366e){logger[_0x5588('0xf')](_0x5588('0x14'),_0x12366e[_0x5588('0x10')],_0x2826e0);_0x30c145(_0x4bad21[_0x5588('0xf')](0x1f4,_0x12366e[_0x5588('0x10')]));});});};exports[_0x5588('0x1d')]=function(_0x10d90c){var _0x3a8282=this;return new Promise(function(_0x234f00,_0xd3319f){return db[_0x5588('0x15')][_0x5588('0x1e')]({'raw':_0x10d90c[_0x5588('0x17')]?_0x10d90c['options'][_0x5588('0x18')]===undefined?!![]:![]:!![],'where':_0x10d90c['options']?_0x10d90c['options'][_0x5588('0x1f')]||null:null,'attributes':_0x10d90c[_0x5588('0x17')]?_0x10d90c['options'][_0x5588('0x19')]||null:null,'include':_0x10d90c['options']?_0x10d90c[_0x5588('0x17')][_0x5588('0x1a')]?_[_0x5588('0x1b')](_0x10d90c[_0x5588('0x17')]['include'],function(_0x2bc839){return{'model':db[_0x2bc839['model']],'as':_0x2bc839['as'],'attributes':_0x2bc839[_0x5588('0x19')],'include':_0x2bc839[_0x5588('0x1a')]?_['map'](_0x2bc839[_0x5588('0x1a')],function(_0x1d1039){return{'model':db[_0x1d1039[_0x5588('0x1c')]],'as':_0x1d1039['as'],'attributes':_0x1d1039[_0x5588('0x19')],'include':_0x1d1039[_0x5588('0x1a')]?_['map'](_0x1d1039['include'],function(_0x4cb7c1){return{'model':db[_0x4cb7c1['model']],'as':_0x4cb7c1['as'],'attributes':_0x4cb7c1['attributes']};}):[]};}):[]};}):[]:[]})[_0x5588('0xa')](function(_0x2f23a0){logger[_0x5588('0x11')](_0x5588('0x1d'),_0x10d90c);logger[_0x5588('0xd')](_0x5588('0x1d'),_0x10d90c,JSON[_0x5588('0xe')](_0x2f23a0));_0x234f00(_0x2f23a0);})[_0x5588('0x13')](function(_0x131e7e){logger[_0x5588('0xf')](_0x5588('0x1d'),_0x131e7e['message'],_0x10d90c);_0xd3319f(_0x3a8282['error'](0x1f4,_0x131e7e[_0x5588('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 79d6aac..b7c761e 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xdb28,0x106));var _0x8db2=function(_0x36a2fa,_0x15e154){_0x36a2fa=_0x36a2fa-0x0;var _0x11524a=_0xdb28[_0x36a2fa];return _0x11524a;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _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(_0x18bca8,_0x117378){var _0x3c7ad8=function(_0x40cb3d){while(--_0x40cb3d){_0x18bca8['push'](_0x18bca8['shift']());}};_0x3c7ad8(++_0x117378);}(_0x2ef3,0xba));var _0x32ef=function(_0x3f2ff3,_0x4b8f7e){_0x3f2ff3=_0x3f2ff3-0x0;var _0x26ac3f=_0x2ef3[_0x3f2ff3];return _0x26ac3f;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index cf1aa7f..7352338 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 _0x7bc9=['Case','contact_lead','contact','lead','account_contact_lead','account','exports','STRING','ENUM','Task'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x7bc9,0x128));var _0x97bc=function(_0xfdaaca,_0x595d40){_0xfdaaca=_0xfdaaca-0x0;var _0x261f75=_0x7bc9[_0xfdaaca];return _0x261f75;};'use strict';var Sequelize=require('sequelize');module[_0x97bc('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x97bc('0x1')]},'ticketType':{'type':Sequelize[_0x97bc('0x2')](_0x97bc('0x3'),_0x97bc('0x4')),'defaultValue':_0x97bc('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x97bc('0x5'),_0x97bc('0x6'),_0x97bc('0x7'),_0x97bc('0x8'),_0x97bc('0x9')),'defaultValue':_0x97bc('0x5')},'moduleCreate':{'type':Sequelize[_0x97bc('0x2')]('nothing',_0x97bc('0x6'),_0x97bc('0x7'),'account'),'defaultValue':_0x97bc('0x7')},'leadId':{'type':Sequelize[_0x97bc('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x97bc('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x97bc('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x97bc('0x1')]}}; \ No newline at end of file +var _0x7cee=['contact','lead','account','exports','STRING','ENUM','Task','Case','account_contact_lead','nothing'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0x7cee,0x1c5));var _0xe7ce=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7cee[_0x9cd4c3];return _0x4c9025;};'use strict';var Sequelize=require('sequelize');module[_0xe7ce('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe7ce('0x1')]},'ticketType':{'type':Sequelize[_0xe7ce('0x2')](_0xe7ce('0x3'),_0xe7ce('0x4')),'defaultValue':_0xe7ce('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact','lead',_0xe7ce('0x5'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0xe7ce('0x6'),_0xe7ce('0x7'),_0xe7ce('0x8'),_0xe7ce('0x9')),'defaultValue':_0xe7ce('0x8')},'leadId':{'type':Sequelize[_0xe7ce('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xe7ce('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xe7ce('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index c7e3b34..9cf13e7 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 _0xa243=['options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter'];(function(_0x376df1,_0x472a11){var _0x383673=function(_0x145d5d){while(--_0x145d5d){_0x376df1['push'](_0x376df1['shift']());}};_0x383673(++_0x472a11);}(_0xa243,0x19d));var _0x3a24=function(_0x868e89,_0x5c0038){_0x868e89=_0x868e89-0x0;var _0x1da4cf=_0xa243[_0x868e89];return _0x1da4cf;};'use strict';var emlformat=require(_0x3a24('0x0'));var rimraf=require(_0x3a24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a24('0x2'));var rp=require(_0x3a24('0x3'));var moment=require('moment');var BPromise=require(_0x3a24('0x4'));var Mustache=require(_0x3a24('0x5'));var util=require('util');var path=require(_0x3a24('0x6'));var sox=require('sox');var csv=require(_0x3a24('0x7'));var ejs=require(_0x3a24('0x8'));var fs=require('fs');var fs_extra=require(_0x3a24('0x9'));var _=require('lodash');var squel=require(_0x3a24('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3a24('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3a24('0xc'));var Papa=require(_0x3a24('0xd'));var Redis=require('ioredis');var authService=require(_0x3a24('0xe'));var qs=require(_0x3a24('0xf'));var as=require(_0x3a24('0x10'));var hardwareService=require(_0x3a24('0x11'));var logger=require(_0x3a24('0x12'))(_0x3a24('0x13'));var utils=require(_0x3a24('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3a24('0x15'))['db'];function respondWithStatusCode(_0x404c4b,_0x32a367){_0x32a367=_0x32a367||0xcc;return function(_0x2964d7){if(_0x2964d7){return _0x404c4b[_0x3a24('0x16')](_0x32a367);}return _0x404c4b[_0x3a24('0x17')](_0x32a367)[_0x3a24('0x18')]();};}function respondWithResult(_0x5e0583,_0xbb03e4){_0xbb03e4=_0xbb03e4||0xc8;return function(_0x35a279){if(_0x35a279){return _0x5e0583[_0x3a24('0x17')](_0xbb03e4)[_0x3a24('0x19')](_0x35a279);}};}function respondWithFilteredResult(_0xd90629,_0x50e724){return function(_0x190dbd){if(_0x190dbd){var _0x1875e0=typeof _0x50e724[_0x3a24('0x1a')]===_0x3a24('0x1b')&&typeof _0x50e724[_0x3a24('0x1c')]===_0x3a24('0x1b');var _0x12557c=_0x190dbd[_0x3a24('0x1d')];var _0x1015ba=_0x1875e0?0x0:_0x50e724[_0x3a24('0x1a')];var _0x4e5cde=_0x1875e0?_0x190dbd[_0x3a24('0x1d')]:_0x50e724['offset']+_0x50e724[_0x3a24('0x1c')];var _0xb2da14;if(_0x4e5cde>=_0x12557c){_0x4e5cde=_0x12557c;_0xb2da14=0xc8;}else{_0xb2da14=0xce;}_0xd90629[_0x3a24('0x17')](_0xb2da14);return _0xd90629[_0x3a24('0x1e')](_0x3a24('0x1f'),_0x1015ba+'-'+_0x4e5cde+'/'+_0x12557c)[_0x3a24('0x19')](_0x190dbd);}return null;};}function patchUpdates(_0xf87ef1){return function(_0x455323){try{jsonpatch[_0x3a24('0x20')](_0x455323,_0xf87ef1,!![]);}catch(_0x3d02a8){return BPromise[_0x3a24('0x21')](_0x3d02a8);}return _0x455323[_0x3a24('0x22')]();};}function saveUpdates(_0x1900b1,_0x3930e9){return function(_0x90bb2a){if(_0x90bb2a){return _0x90bb2a[_0x3a24('0x23')](_0x1900b1)[_0x3a24('0x24')](function(_0x3b15db){return _0x3b15db;});}return null;};}function removeEntity(_0x4187d0,_0x3c06f7){return function(_0x390a54){if(_0x390a54){return _0x390a54['destroy']()[_0x3a24('0x24')](function(){_0x4187d0['status'](0xcc)[_0x3a24('0x18')]();});}};}function handleEntityNotFound(_0x4e9587,_0x3f8d7e){return function(_0x57853b){if(!_0x57853b){_0x4e9587[_0x3a24('0x16')](0x194);}return _0x57853b;};}function handleError(_0x56c761,_0x1400f0){_0x1400f0=_0x1400f0||0x1f4;return function(_0x395cd2){logger[_0x3a24('0x25')](_0x395cd2['stack']);if(_0x395cd2[_0x3a24('0x26')]){delete _0x395cd2[_0x3a24('0x26')];}_0x56c761['status'](_0x1400f0)[_0x3a24('0x27')](_0x395cd2);};}exports[_0x3a24('0x28')]=function(_0x29b356,_0x356a94){var _0x288e92={},_0xfc238e={},_0x592cb5={'count':0x0,'rows':[]};var _0x2ae5d4=_['map'](db[_0x3a24('0x29')][_0x3a24('0x2a')],function(_0x378571){return{'name':_0x378571[_0x3a24('0x2b')],'type':_0x378571[_0x3a24('0x2c')][_0x3a24('0x2d')]};});_0xfc238e[_0x3a24('0x2e')]=_[_0x3a24('0x2f')](_0x2ae5d4,'name');_0xfc238e[_0x3a24('0x30')]=_['keys'](_0x29b356[_0x3a24('0x30')]);_0xfc238e[_0x3a24('0x31')]=_[_0x3a24('0x32')](_0xfc238e[_0x3a24('0x2e')],_0xfc238e[_0x3a24('0x30')]);_0x288e92['attributes']=_[_0x3a24('0x32')](_0xfc238e[_0x3a24('0x2e')],qs[_0x3a24('0x33')](_0x29b356['query'][_0x3a24('0x33')]));_0x288e92['attributes']=_0x288e92[_0x3a24('0x34')][_0x3a24('0x35')]?_0x288e92[_0x3a24('0x34')]:_0xfc238e[_0x3a24('0x2e')];if(!_0x29b356[_0x3a24('0x30')][_0x3a24('0x36')](_0x3a24('0x37'))){_0x288e92[_0x3a24('0x1c')]=qs[_0x3a24('0x1c')](_0x29b356[_0x3a24('0x30')][_0x3a24('0x1c')]);_0x288e92[_0x3a24('0x1a')]=qs[_0x3a24('0x1a')](_0x29b356['query'][_0x3a24('0x1a')]);}_0x288e92['order']=qs[_0x3a24('0x38')](_0x29b356['query']['sort']);_0x288e92['where']=qs[_0x3a24('0x31')](_[_0x3a24('0x39')](_0x29b356[_0x3a24('0x30')],_0xfc238e[_0x3a24('0x31')]),_0x2ae5d4);if(_0x29b356[_0x3a24('0x30')]['filter']){_0x288e92[_0x3a24('0x3a')]=_[_0x3a24('0x3b')](_0x288e92[_0x3a24('0x3a')],{'$or':_[_0x3a24('0x2f')](_0x2ae5d4,function(_0x85cfa8){if(_0x85cfa8[_0x3a24('0x2c')]!=='VIRTUAL'){var _0x3a00e4={};_0x3a00e4[_0x85cfa8['name']]={'$like':'%'+_0x29b356[_0x3a24('0x30')][_0x3a24('0x3c')]+'%'};return _0x3a00e4;}})});}_0x288e92=_[_0x3a24('0x3b')]({},_0x288e92,_0x29b356[_0x3a24('0x3d')]);var _0xbcc6fb={'where':_0x288e92[_0x3a24('0x3a')]};return db['SalesforceConfiguration'][_0x3a24('0x1d')](_0xbcc6fb)[_0x3a24('0x24')](function(_0x2d3fe8){_0x592cb5[_0x3a24('0x1d')]=_0x2d3fe8;if(_0x29b356[_0x3a24('0x30')][_0x3a24('0x3e')]){_0x288e92[_0x3a24('0x3f')]=[{'all':!![]}];}return db[_0x3a24('0x29')][_0x3a24('0x40')](_0x288e92);})[_0x3a24('0x24')](function(_0xb29492){_0x592cb5['rows']=_0xb29492;return _0x592cb5;})['then'](respondWithFilteredResult(_0x356a94,_0x288e92))[_0x3a24('0x41')](handleError(_0x356a94,null));};exports[_0x3a24('0x42')]=function(_0x4f639c,_0x4fbf41){var _0x35cf5f={'raw':![],'where':{'id':_0x4f639c[_0x3a24('0x43')]['id']}},_0x2c0521={};_0x2c0521['model']=_[_0x3a24('0x44')](db[_0x3a24('0x29')][_0x3a24('0x2a')]);_0x2c0521[_0x3a24('0x30')]=_[_0x3a24('0x44')](_0x4f639c['query']);_0x2c0521[_0x3a24('0x31')]=_['intersection'](_0x2c0521[_0x3a24('0x2e')],_0x2c0521['query']);_0x35cf5f['attributes']=_[_0x3a24('0x32')](_0x2c0521['model'],qs[_0x3a24('0x33')](_0x4f639c[_0x3a24('0x30')]['fields']));_0x35cf5f['attributes']=_0x35cf5f[_0x3a24('0x34')]['length']?_0x35cf5f[_0x3a24('0x34')]:_0x2c0521[_0x3a24('0x2e')];if(_0x4f639c[_0x3a24('0x30')][_0x3a24('0x3e')]){_0x35cf5f['include']=[{'all':!![]}];}_0x35cf5f=_[_0x3a24('0x3b')]({},_0x35cf5f,_0x4f639c['options']);return db['SalesforceConfiguration'][_0x3a24('0x45')](_0x35cf5f)['then'](handleEntityNotFound(_0x4fbf41,null))[_0x3a24('0x24')](respondWithResult(_0x4fbf41,null))[_0x3a24('0x41')](handleError(_0x4fbf41,null));};exports[_0x3a24('0x46')]=function(_0x38b369,_0x33ea57){return db[_0x3a24('0x29')]['create'](_0x38b369[_0x3a24('0x47')],{})[_0x3a24('0x24')](respondWithResult(_0x33ea57,0xc9))[_0x3a24('0x41')](handleError(_0x33ea57,null));};exports['update']=function(_0x443fe3,_0x1181e6){if(_0x443fe3[_0x3a24('0x47')]['id']){delete _0x443fe3[_0x3a24('0x47')]['id'];}return db[_0x3a24('0x29')]['find']({'where':{'id':_0x443fe3['params']['id']}})['then'](handleEntityNotFound(_0x1181e6,null))[_0x3a24('0x24')](saveUpdates(_0x443fe3[_0x3a24('0x47')],null))['then'](respondWithResult(_0x1181e6,null))['catch'](handleError(_0x1181e6,null));};exports[_0x3a24('0x48')]=function(_0x5c6a50,_0x3d27d7){return db[_0x3a24('0x29')][_0x3a24('0x45')]({'where':{'id':_0x5c6a50['params']['id']}})[_0x3a24('0x24')](handleEntityNotFound(_0x3d27d7,null))[_0x3a24('0x24')](removeEntity(_0x3d27d7,null))['catch'](handleError(_0x3d27d7,null));};exports[_0x3a24('0x49')]=function(_0x543eba,_0x482f75,_0x3270cc){var _0x2ad7c5={};var _0x46ef41={};var _0x1397ca;var _0x57a6e9;return db[_0x3a24('0x29')][_0x3a24('0x4a')]({'where':{'id':_0x543eba[_0x3a24('0x43')]['id']}})[_0x3a24('0x24')](handleEntityNotFound(_0x482f75,null))['then'](function(_0xa24586){if(_0xa24586){_0x1397ca=_0xa24586;_0x46ef41['model']=_[_0x3a24('0x44')](db[_0x3a24('0x4b')][_0x3a24('0x2a')]);_0x46ef41['query']=_[_0x3a24('0x44')](_0x543eba[_0x3a24('0x30')]);_0x46ef41[_0x3a24('0x31')]=_['intersection'](_0x46ef41[_0x3a24('0x2e')],_0x46ef41['query']);_0x2ad7c5[_0x3a24('0x34')]=_[_0x3a24('0x32')](_0x46ef41['model'],qs['fields'](_0x543eba[_0x3a24('0x30')][_0x3a24('0x33')]));_0x2ad7c5[_0x3a24('0x34')]=_0x2ad7c5['attributes']['length']?_0x2ad7c5[_0x3a24('0x34')]:_0x46ef41[_0x3a24('0x2e')];_0x2ad7c5[_0x3a24('0x4c')]=qs[_0x3a24('0x38')](_0x543eba[_0x3a24('0x30')]['sort']);_0x2ad7c5[_0x3a24('0x3a')]=qs[_0x3a24('0x31')](_[_0x3a24('0x39')](_0x543eba['query'],_0x46ef41[_0x3a24('0x31')]));if(_0x543eba[_0x3a24('0x30')][_0x3a24('0x3c')]){_0x2ad7c5['where']=_['merge'](_0x2ad7c5[_0x3a24('0x3a')],{'$or':_[_0x3a24('0x2f')](_0x2ad7c5[_0x3a24('0x34')],function(_0x312a13){var _0x475e57={};_0x475e57[_0x312a13]={'$like':'%'+_0x543eba[_0x3a24('0x30')][_0x3a24('0x3c')]+'%'};return _0x475e57;})});}_0x2ad7c5=_[_0x3a24('0x3b')]({},_0x2ad7c5,_0x543eba[_0x3a24('0x3d')]);return _0x1397ca[_0x3a24('0x49')](_0x2ad7c5);}})[_0x3a24('0x24')](function(_0x58748e){if(_0x58748e){_0x57a6e9=_0x58748e['length'];if(!_0x543eba[_0x3a24('0x30')][_0x3a24('0x36')]('nolimit')){_0x2ad7c5[_0x3a24('0x1c')]=qs[_0x3a24('0x1c')](_0x543eba['query'][_0x3a24('0x1c')]);_0x2ad7c5[_0x3a24('0x1a')]=qs[_0x3a24('0x1a')](_0x543eba[_0x3a24('0x30')][_0x3a24('0x1a')]);}return _0x1397ca[_0x3a24('0x49')](_0x2ad7c5);}})[_0x3a24('0x24')](function(_0x674070){if(_0x674070){return _0x674070?{'count':_0x57a6e9,'rows':_0x674070}:null;}})[_0x3a24('0x24')](respondWithResult(_0x482f75,null))[_0x3a24('0x41')](handleError(_0x482f75,null));};exports[_0x3a24('0x4d')]=function(_0x8bfe9b,_0x2a1be1,_0x1c43b1){var _0x3521de={};var _0x2f8e03={};var _0xdfed32;var _0xdd59b0;return db[_0x3a24('0x29')][_0x3a24('0x4a')]({'where':{'id':_0x8bfe9b[_0x3a24('0x43')]['id']}})[_0x3a24('0x24')](handleEntityNotFound(_0x2a1be1,null))['then'](function(_0x2139db){if(_0x2139db){_0xdfed32=_0x2139db;_0x2f8e03[_0x3a24('0x2e')]=_[_0x3a24('0x44')](db[_0x3a24('0x4b')][_0x3a24('0x2a')]);_0x2f8e03[_0x3a24('0x30')]=_[_0x3a24('0x44')](_0x8bfe9b[_0x3a24('0x30')]);_0x2f8e03['filters']=_[_0x3a24('0x32')](_0x2f8e03[_0x3a24('0x2e')],_0x2f8e03[_0x3a24('0x30')]);_0x3521de[_0x3a24('0x34')]=_['intersection'](_0x2f8e03['model'],qs[_0x3a24('0x33')](_0x8bfe9b['query']['fields']));_0x3521de[_0x3a24('0x34')]=_0x3521de[_0x3a24('0x34')]['length']?_0x3521de[_0x3a24('0x34')]:_0x2f8e03[_0x3a24('0x2e')];_0x3521de[_0x3a24('0x4c')]=qs[_0x3a24('0x38')](_0x8bfe9b['query'][_0x3a24('0x38')]);_0x3521de[_0x3a24('0x3a')]=qs[_0x3a24('0x31')](_[_0x3a24('0x39')](_0x8bfe9b[_0x3a24('0x30')],_0x2f8e03['filters']));if(_0x8bfe9b['query'][_0x3a24('0x3c')]){_0x3521de[_0x3a24('0x3a')]=_[_0x3a24('0x3b')](_0x3521de[_0x3a24('0x3a')],{'$or':_[_0x3a24('0x2f')](_0x3521de[_0x3a24('0x34')],function(_0x41675c){var _0x30c9d0={};_0x30c9d0[_0x41675c]={'$like':'%'+_0x8bfe9b[_0x3a24('0x30')][_0x3a24('0x3c')]+'%'};return _0x30c9d0;})});}_0x3521de=_[_0x3a24('0x3b')]({},_0x3521de,_0x8bfe9b[_0x3a24('0x3d')]);return _0xdfed32[_0x3a24('0x4d')](_0x3521de);}})[_0x3a24('0x24')](function(_0x42b690){if(_0x42b690){_0xdd59b0=_0x42b690[_0x3a24('0x35')];if(!_0x8bfe9b[_0x3a24('0x30')][_0x3a24('0x36')]('nolimit')){_0x3521de[_0x3a24('0x1c')]=qs['limit'](_0x8bfe9b['query'][_0x3a24('0x1c')]);_0x3521de[_0x3a24('0x1a')]=qs[_0x3a24('0x1a')](_0x8bfe9b[_0x3a24('0x30')][_0x3a24('0x1a')]);}return _0xdfed32[_0x3a24('0x4d')](_0x3521de);}})[_0x3a24('0x24')](function(_0x4e7c3a){if(_0x4e7c3a){return _0x4e7c3a?{'count':_0xdd59b0,'rows':_0x4e7c3a}:null;}})[_0x3a24('0x24')](respondWithResult(_0x2a1be1,null))['catch'](handleError(_0x2a1be1,null));};exports[_0x3a24('0x4e')]=function(_0x3a7ef0,_0x515c03,_0x452678){var _0x3492b1={};var _0x29a4e5={};var _0x37a4c2;var _0x59c45c;return db[_0x3a24('0x29')][_0x3a24('0x4a')]({'where':{'id':_0x3a7ef0[_0x3a24('0x43')]['id']}})[_0x3a24('0x24')](handleEntityNotFound(_0x515c03,null))[_0x3a24('0x24')](function(_0x30dca4){if(_0x30dca4){_0x37a4c2=_0x30dca4;_0x29a4e5[_0x3a24('0x2e')]=_['keys'](db['SalesforceField'][_0x3a24('0x2a')]);_0x29a4e5[_0x3a24('0x30')]=_['keys'](_0x3a7ef0[_0x3a24('0x30')]);_0x29a4e5[_0x3a24('0x31')]=_['intersection'](_0x29a4e5['model'],_0x29a4e5['query']);_0x3492b1['attributes']=_[_0x3a24('0x32')](_0x29a4e5[_0x3a24('0x2e')],qs['fields'](_0x3a7ef0[_0x3a24('0x30')][_0x3a24('0x33')]));_0x3492b1[_0x3a24('0x34')]=_0x3492b1['attributes'][_0x3a24('0x35')]?_0x3492b1[_0x3a24('0x34')]:_0x29a4e5[_0x3a24('0x2e')];_0x3492b1[_0x3a24('0x4c')]=qs[_0x3a24('0x38')](_0x3a7ef0[_0x3a24('0x30')][_0x3a24('0x38')]);_0x3492b1['where']=qs[_0x3a24('0x31')](_['pick'](_0x3a7ef0[_0x3a24('0x30')],_0x29a4e5[_0x3a24('0x31')]));if(_0x3a7ef0['query'][_0x3a24('0x3c')]){_0x3492b1[_0x3a24('0x3a')]=_[_0x3a24('0x3b')](_0x3492b1[_0x3a24('0x3a')],{'$or':_[_0x3a24('0x2f')](_0x3492b1[_0x3a24('0x34')],function(_0x262313){var _0x206bdc={};_0x206bdc[_0x262313]={'$like':'%'+_0x3a7ef0[_0x3a24('0x30')][_0x3a24('0x3c')]+'%'};return _0x206bdc;})});}_0x3492b1=_[_0x3a24('0x3b')]({},_0x3492b1,_0x3a7ef0[_0x3a24('0x3d')]);return _0x37a4c2[_0x3a24('0x4e')](_0x3492b1);}})[_0x3a24('0x24')](function(_0x45af10){if(_0x45af10){_0x59c45c=_0x45af10['length'];if(!_0x3a7ef0[_0x3a24('0x30')][_0x3a24('0x36')](_0x3a24('0x37'))){_0x3492b1[_0x3a24('0x1c')]=qs[_0x3a24('0x1c')](_0x3a7ef0[_0x3a24('0x30')][_0x3a24('0x1c')]);_0x3492b1[_0x3a24('0x1a')]=qs[_0x3a24('0x1a')](_0x3a7ef0['query']['offset']);}return _0x37a4c2[_0x3a24('0x4e')](_0x3492b1);}})['then'](function(_0x37c6a1){if(_0x37c6a1){return _0x37c6a1?{'count':_0x59c45c,'rows':_0x37c6a1}:null;}})[_0x3a24('0x24')](respondWithResult(_0x515c03,null))[_0x3a24('0x41')](handleError(_0x515c03,null));}; \ No newline at end of file +var _0xb7a6=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','end','error','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','includeAll','include','SalesforceConfiguration','findAll','rows','params','find','catch','create','body','update','getFields','findOne','SalesforceField','rawAttributes','options','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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'];(function(_0x1107eb,_0x1087e3){var _0x2ecfb1=function(_0x5d9271){while(--_0x5d9271){_0x1107eb['push'](_0x1107eb['shift']());}};_0x2ecfb1(++_0x1087e3);}(_0xb7a6,0x189));var _0x6b7a=function(_0x3def5f,_0xb0d3ae){_0x3def5f=_0x3def5f-0x0;var _0x31668b=_0xb7a6[_0x3def5f];return _0x31668b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b7a('0x0'));var zipdir=require(_0x6b7a('0x1'));var jsonpatch=require(_0x6b7a('0x2'));var rp=require(_0x6b7a('0x3'));var moment=require(_0x6b7a('0x4'));var BPromise=require(_0x6b7a('0x5'));var Mustache=require(_0x6b7a('0x6'));var util=require(_0x6b7a('0x7'));var path=require(_0x6b7a('0x8'));var sox=require('sox');var csv=require(_0x6b7a('0x9'));var ejs=require(_0x6b7a('0xa'));var fs=require('fs');var fs_extra=require(_0x6b7a('0xb'));var _=require('lodash');var squel=require(_0x6b7a('0xc'));var crypto=require('crypto');var jsforce=require(_0x6b7a('0xd'));var deskjs=require(_0x6b7a('0xe'));var toCsv=require(_0x6b7a('0x9'));var querystring=require(_0x6b7a('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b7a('0x10'));var authService=require(_0x6b7a('0x11'));var qs=require(_0x6b7a('0x12'));var as=require(_0x6b7a('0x13'));var hardwareService=require(_0x6b7a('0x14'));var logger=require(_0x6b7a('0x15'))(_0x6b7a('0x16'));var utils=require(_0x6b7a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6b7a('0x18'));var db=require(_0x6b7a('0x19'))['db'];function respondWithStatusCode(_0x456270,_0x416ea3){_0x416ea3=_0x416ea3||0xcc;return function(_0x29662e){if(_0x29662e){return _0x456270[_0x6b7a('0x1a')](_0x416ea3);}return _0x456270[_0x6b7a('0x1b')](_0x416ea3)['end']();};}function respondWithResult(_0x2b0015,_0x4fc141){_0x4fc141=_0x4fc141||0xc8;return function(_0x48a97c){if(_0x48a97c){return _0x2b0015[_0x6b7a('0x1b')](_0x4fc141)[_0x6b7a('0x1c')](_0x48a97c);}};}function respondWithFilteredResult(_0xf16ba0,_0x766e39){return function(_0x52065a){if(_0x52065a){var _0x2cb977=typeof _0x766e39[_0x6b7a('0x1d')]===_0x6b7a('0x1e')&&typeof _0x766e39[_0x6b7a('0x1f')]===_0x6b7a('0x1e');var _0x2c2437=_0x52065a['count'];var _0x168351=_0x2cb977?0x0:_0x766e39[_0x6b7a('0x1d')];var _0xed6f91=_0x2cb977?_0x52065a[_0x6b7a('0x20')]:_0x766e39[_0x6b7a('0x1d')]+_0x766e39['limit'];var _0x787a91;if(_0xed6f91>=_0x2c2437){_0xed6f91=_0x2c2437;_0x787a91=0xc8;}else{_0x787a91=0xce;}_0xf16ba0[_0x6b7a('0x1b')](_0x787a91);return _0xf16ba0[_0x6b7a('0x21')]('Content-Range',_0x168351+'-'+_0xed6f91+'/'+_0x2c2437)[_0x6b7a('0x1c')](_0x52065a);}return null;};}function patchUpdates(_0x535ce0){return function(_0x5ce8ef){try{jsonpatch[_0x6b7a('0x22')](_0x5ce8ef,_0x535ce0,!![]);}catch(_0xf94ad4){return BPromise[_0x6b7a('0x23')](_0xf94ad4);}return _0x5ce8ef[_0x6b7a('0x24')]();};}function saveUpdates(_0x418786,_0x302aa9){return function(_0xc6059c){if(_0xc6059c){return _0xc6059c['update'](_0x418786)[_0x6b7a('0x25')](function(_0x31d2c1){return _0x31d2c1;});}return null;};}function removeEntity(_0x85337d,_0x4708f5){return function(_0x3e9dbe){if(_0x3e9dbe){return _0x3e9dbe['destroy']()[_0x6b7a('0x25')](function(){_0x85337d[_0x6b7a('0x1b')](0xcc)[_0x6b7a('0x26')]();});}};}function handleEntityNotFound(_0x3095d3,_0x2a7812){return function(_0x5584f0){if(!_0x5584f0){_0x3095d3[_0x6b7a('0x1a')](0x194);}return _0x5584f0;};}function handleError(_0x3512d5,_0x4d0148){_0x4d0148=_0x4d0148||0x1f4;return function(_0xecca4f){logger[_0x6b7a('0x27')](_0xecca4f[_0x6b7a('0x28')]);if(_0xecca4f[_0x6b7a('0x29')]){delete _0xecca4f[_0x6b7a('0x29')];}_0x3512d5[_0x6b7a('0x1b')](_0x4d0148)[_0x6b7a('0x2a')](_0xecca4f);};}exports[_0x6b7a('0x2b')]=function(_0x1d19eb,_0x3f3d85){var _0x4ce0bc={},_0x3d41a5={},_0x89d08e={'count':0x0,'rows':[]};var _0x224619=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x2de232){return{'name':_0x2de232[_0x6b7a('0x2c')],'type':_0x2de232[_0x6b7a('0x2d')][_0x6b7a('0x2e')]};});_0x3d41a5[_0x6b7a('0x2f')]=_['map'](_0x224619,_0x6b7a('0x29'));_0x3d41a5[_0x6b7a('0x30')]=_[_0x6b7a('0x31')](_0x1d19eb[_0x6b7a('0x30')]);_0x3d41a5[_0x6b7a('0x32')]=_[_0x6b7a('0x33')](_0x3d41a5['model'],_0x3d41a5[_0x6b7a('0x30')]);_0x4ce0bc[_0x6b7a('0x34')]=_[_0x6b7a('0x33')](_0x3d41a5[_0x6b7a('0x2f')],qs['fields'](_0x1d19eb[_0x6b7a('0x30')][_0x6b7a('0x35')]));_0x4ce0bc[_0x6b7a('0x34')]=_0x4ce0bc[_0x6b7a('0x34')][_0x6b7a('0x36')]?_0x4ce0bc[_0x6b7a('0x34')]:_0x3d41a5['model'];if(!_0x1d19eb[_0x6b7a('0x30')]['hasOwnProperty'](_0x6b7a('0x37'))){_0x4ce0bc[_0x6b7a('0x1f')]=qs[_0x6b7a('0x1f')](_0x1d19eb[_0x6b7a('0x30')][_0x6b7a('0x1f')]);_0x4ce0bc['offset']=qs[_0x6b7a('0x1d')](_0x1d19eb[_0x6b7a('0x30')]['offset']);}_0x4ce0bc[_0x6b7a('0x38')]=qs['sort'](_0x1d19eb[_0x6b7a('0x30')][_0x6b7a('0x39')]);_0x4ce0bc['where']=qs['filters'](_[_0x6b7a('0x3a')](_0x1d19eb[_0x6b7a('0x30')],_0x3d41a5[_0x6b7a('0x32')]),_0x224619);if(_0x1d19eb['query'][_0x6b7a('0x3b')]){_0x4ce0bc['where']=_[_0x6b7a('0x3c')](_0x4ce0bc[_0x6b7a('0x3d')],{'$or':_[_0x6b7a('0x3e')](_0x224619,function(_0x3b512d){if(_0x3b512d[_0x6b7a('0x2d')]!==_0x6b7a('0x3f')){var _0x54f3e3={};_0x54f3e3[_0x3b512d[_0x6b7a('0x29')]]={'$like':'%'+_0x1d19eb[_0x6b7a('0x30')][_0x6b7a('0x3b')]+'%'};return _0x54f3e3;}})});}_0x4ce0bc=_['merge']({},_0x4ce0bc,_0x1d19eb['options']);var _0x51cb20={'where':_0x4ce0bc[_0x6b7a('0x3d')]};return db['SalesforceConfiguration'][_0x6b7a('0x20')](_0x51cb20)['then'](function(_0x3c7aac){_0x89d08e[_0x6b7a('0x20')]=_0x3c7aac;if(_0x1d19eb['query'][_0x6b7a('0x40')]){_0x4ce0bc[_0x6b7a('0x41')]=[{'all':!![]}];}return db[_0x6b7a('0x42')][_0x6b7a('0x43')](_0x4ce0bc);})[_0x6b7a('0x25')](function(_0x44d4df){_0x89d08e[_0x6b7a('0x44')]=_0x44d4df;return _0x89d08e;})[_0x6b7a('0x25')](respondWithFilteredResult(_0x3f3d85,_0x4ce0bc))['catch'](handleError(_0x3f3d85,null));};exports['show']=function(_0x330c3f,_0x15f3e5){var _0x323e0a={'raw':![],'where':{'id':_0x330c3f[_0x6b7a('0x45')]['id']}},_0x1b22ff={};_0x1b22ff[_0x6b7a('0x2f')]=_[_0x6b7a('0x31')](db['SalesforceConfiguration']['rawAttributes']);_0x1b22ff[_0x6b7a('0x30')]=_[_0x6b7a('0x31')](_0x330c3f[_0x6b7a('0x30')]);_0x1b22ff[_0x6b7a('0x32')]=_[_0x6b7a('0x33')](_0x1b22ff['model'],_0x1b22ff[_0x6b7a('0x30')]);_0x323e0a[_0x6b7a('0x34')]=_[_0x6b7a('0x33')](_0x1b22ff['model'],qs['fields'](_0x330c3f[_0x6b7a('0x30')][_0x6b7a('0x35')]));_0x323e0a['attributes']=_0x323e0a['attributes']['length']?_0x323e0a['attributes']:_0x1b22ff[_0x6b7a('0x2f')];if(_0x330c3f[_0x6b7a('0x30')]['includeAll']){_0x323e0a['include']=[{'all':!![]}];}_0x323e0a=_[_0x6b7a('0x3c')]({},_0x323e0a,_0x330c3f['options']);return db[_0x6b7a('0x42')][_0x6b7a('0x46')](_0x323e0a)[_0x6b7a('0x25')](handleEntityNotFound(_0x15f3e5,null))[_0x6b7a('0x25')](respondWithResult(_0x15f3e5,null))[_0x6b7a('0x47')](handleError(_0x15f3e5,null));};exports[_0x6b7a('0x48')]=function(_0x26f8ef,_0x29983c){return db[_0x6b7a('0x42')][_0x6b7a('0x48')](_0x26f8ef[_0x6b7a('0x49')],{})['then'](respondWithResult(_0x29983c,0xc9))[_0x6b7a('0x47')](handleError(_0x29983c,null));};exports[_0x6b7a('0x4a')]=function(_0x32e9cc,_0x190761){if(_0x32e9cc[_0x6b7a('0x49')]['id']){delete _0x32e9cc[_0x6b7a('0x49')]['id'];}return db[_0x6b7a('0x42')]['find']({'where':{'id':_0x32e9cc[_0x6b7a('0x45')]['id']}})[_0x6b7a('0x25')](handleEntityNotFound(_0x190761,null))[_0x6b7a('0x25')](saveUpdates(_0x32e9cc[_0x6b7a('0x49')],null))[_0x6b7a('0x25')](respondWithResult(_0x190761,null))[_0x6b7a('0x47')](handleError(_0x190761,null));};exports['destroy']=function(_0x416d16,_0x5b7f8e){return db['SalesforceConfiguration']['find']({'where':{'id':_0x416d16['params']['id']}})[_0x6b7a('0x25')](handleEntityNotFound(_0x5b7f8e,null))[_0x6b7a('0x25')](removeEntity(_0x5b7f8e,null))[_0x6b7a('0x47')](handleError(_0x5b7f8e,null));};exports[_0x6b7a('0x4b')]=function(_0x16d8bd,_0x1a007c,_0x1db3dd){var _0x2fc908={};var _0x414efe={};var _0x158156;var _0x444b0b;return db[_0x6b7a('0x42')][_0x6b7a('0x4c')]({'where':{'id':_0x16d8bd[_0x6b7a('0x45')]['id']}})[_0x6b7a('0x25')](handleEntityNotFound(_0x1a007c,null))[_0x6b7a('0x25')](function(_0x56f50f){if(_0x56f50f){_0x158156=_0x56f50f;_0x414efe[_0x6b7a('0x2f')]=_[_0x6b7a('0x31')](db[_0x6b7a('0x4d')][_0x6b7a('0x4e')]);_0x414efe[_0x6b7a('0x30')]=_[_0x6b7a('0x31')](_0x16d8bd['query']);_0x414efe[_0x6b7a('0x32')]=_['intersection'](_0x414efe[_0x6b7a('0x2f')],_0x414efe[_0x6b7a('0x30')]);_0x2fc908[_0x6b7a('0x34')]=_[_0x6b7a('0x33')](_0x414efe[_0x6b7a('0x2f')],qs[_0x6b7a('0x35')](_0x16d8bd[_0x6b7a('0x30')][_0x6b7a('0x35')]));_0x2fc908['attributes']=_0x2fc908['attributes'][_0x6b7a('0x36')]?_0x2fc908[_0x6b7a('0x34')]:_0x414efe['model'];_0x2fc908[_0x6b7a('0x38')]=qs[_0x6b7a('0x39')](_0x16d8bd['query'][_0x6b7a('0x39')]);_0x2fc908[_0x6b7a('0x3d')]=qs[_0x6b7a('0x32')](_['pick'](_0x16d8bd[_0x6b7a('0x30')],_0x414efe[_0x6b7a('0x32')]));if(_0x16d8bd['query'][_0x6b7a('0x3b')]){_0x2fc908[_0x6b7a('0x3d')]=_[_0x6b7a('0x3c')](_0x2fc908[_0x6b7a('0x3d')],{'$or':_[_0x6b7a('0x3e')](_0x2fc908[_0x6b7a('0x34')],function(_0x32fb74){var _0x2bb737={};_0x2bb737[_0x32fb74]={'$like':'%'+_0x16d8bd[_0x6b7a('0x30')]['filter']+'%'};return _0x2bb737;})});}_0x2fc908=_['merge']({},_0x2fc908,_0x16d8bd[_0x6b7a('0x4f')]);return _0x158156[_0x6b7a('0x4b')](_0x2fc908);}})['then'](function(_0x590fa0){if(_0x590fa0){_0x444b0b=_0x590fa0[_0x6b7a('0x36')];if(!_0x16d8bd[_0x6b7a('0x30')][_0x6b7a('0x50')](_0x6b7a('0x37'))){_0x2fc908[_0x6b7a('0x1f')]=qs[_0x6b7a('0x1f')](_0x16d8bd[_0x6b7a('0x30')][_0x6b7a('0x1f')]);_0x2fc908[_0x6b7a('0x1d')]=qs[_0x6b7a('0x1d')](_0x16d8bd['query'][_0x6b7a('0x1d')]);}return _0x158156[_0x6b7a('0x4b')](_0x2fc908);}})[_0x6b7a('0x25')](function(_0x2b9fee){if(_0x2b9fee){return _0x2b9fee?{'count':_0x444b0b,'rows':_0x2b9fee}:null;}})['then'](respondWithResult(_0x1a007c,null))['catch'](handleError(_0x1a007c,null));};exports['getSubjects']=function(_0xf11dda,_0xcab1d1,_0x3f9ac6){var _0x5856ad={};var _0xbff041={};var _0x5e2680;var _0x383737;return db['SalesforceConfiguration'][_0x6b7a('0x4c')]({'where':{'id':_0xf11dda[_0x6b7a('0x45')]['id']}})[_0x6b7a('0x25')](handleEntityNotFound(_0xcab1d1,null))[_0x6b7a('0x25')](function(_0x1e7af2){if(_0x1e7af2){_0x5e2680=_0x1e7af2;_0xbff041['model']=_[_0x6b7a('0x31')](db[_0x6b7a('0x4d')]['rawAttributes']);_0xbff041[_0x6b7a('0x30')]=_[_0x6b7a('0x31')](_0xf11dda[_0x6b7a('0x30')]);_0xbff041[_0x6b7a('0x32')]=_[_0x6b7a('0x33')](_0xbff041[_0x6b7a('0x2f')],_0xbff041[_0x6b7a('0x30')]);_0x5856ad[_0x6b7a('0x34')]=_[_0x6b7a('0x33')](_0xbff041[_0x6b7a('0x2f')],qs['fields'](_0xf11dda[_0x6b7a('0x30')][_0x6b7a('0x35')]));_0x5856ad[_0x6b7a('0x34')]=_0x5856ad[_0x6b7a('0x34')][_0x6b7a('0x36')]?_0x5856ad[_0x6b7a('0x34')]:_0xbff041[_0x6b7a('0x2f')];_0x5856ad[_0x6b7a('0x38')]=qs[_0x6b7a('0x39')](_0xf11dda[_0x6b7a('0x30')][_0x6b7a('0x39')]);_0x5856ad['where']=qs[_0x6b7a('0x32')](_[_0x6b7a('0x3a')](_0xf11dda['query'],_0xbff041[_0x6b7a('0x32')]));if(_0xf11dda[_0x6b7a('0x30')][_0x6b7a('0x3b')]){_0x5856ad[_0x6b7a('0x3d')]=_['merge'](_0x5856ad['where'],{'$or':_[_0x6b7a('0x3e')](_0x5856ad[_0x6b7a('0x34')],function(_0x31f49b){var _0x1aad4a={};_0x1aad4a[_0x31f49b]={'$like':'%'+_0xf11dda[_0x6b7a('0x30')][_0x6b7a('0x3b')]+'%'};return _0x1aad4a;})});}_0x5856ad=_[_0x6b7a('0x3c')]({},_0x5856ad,_0xf11dda['options']);return _0x5e2680[_0x6b7a('0x51')](_0x5856ad);}})[_0x6b7a('0x25')](function(_0x12c6cd){if(_0x12c6cd){_0x383737=_0x12c6cd[_0x6b7a('0x36')];if(!_0xf11dda[_0x6b7a('0x30')][_0x6b7a('0x50')](_0x6b7a('0x37'))){_0x5856ad[_0x6b7a('0x1f')]=qs[_0x6b7a('0x1f')](_0xf11dda['query'][_0x6b7a('0x1f')]);_0x5856ad[_0x6b7a('0x1d')]=qs['offset'](_0xf11dda[_0x6b7a('0x30')][_0x6b7a('0x1d')]);}return _0x5e2680[_0x6b7a('0x51')](_0x5856ad);}})[_0x6b7a('0x25')](function(_0x45e08d){if(_0x45e08d){return _0x45e08d?{'count':_0x383737,'rows':_0x45e08d}:null;}})[_0x6b7a('0x25')](respondWithResult(_0xcab1d1,null))['catch'](handleError(_0xcab1d1,null));};exports[_0x6b7a('0x52')]=function(_0x40b7e5,_0x3f799a,_0x367b91){var _0x57c387={};var _0x4a679e={};var _0x58bc46;var _0x33ce25;return db[_0x6b7a('0x42')][_0x6b7a('0x4c')]({'where':{'id':_0x40b7e5[_0x6b7a('0x45')]['id']}})[_0x6b7a('0x25')](handleEntityNotFound(_0x3f799a,null))[_0x6b7a('0x25')](function(_0x5329a9){if(_0x5329a9){_0x58bc46=_0x5329a9;_0x4a679e[_0x6b7a('0x2f')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x4a679e['query']=_[_0x6b7a('0x31')](_0x40b7e5['query']);_0x4a679e['filters']=_['intersection'](_0x4a679e[_0x6b7a('0x2f')],_0x4a679e[_0x6b7a('0x30')]);_0x57c387[_0x6b7a('0x34')]=_[_0x6b7a('0x33')](_0x4a679e['model'],qs['fields'](_0x40b7e5[_0x6b7a('0x30')][_0x6b7a('0x35')]));_0x57c387[_0x6b7a('0x34')]=_0x57c387[_0x6b7a('0x34')][_0x6b7a('0x36')]?_0x57c387['attributes']:_0x4a679e['model'];_0x57c387['order']=qs[_0x6b7a('0x39')](_0x40b7e5[_0x6b7a('0x30')][_0x6b7a('0x39')]);_0x57c387[_0x6b7a('0x3d')]=qs[_0x6b7a('0x32')](_[_0x6b7a('0x3a')](_0x40b7e5[_0x6b7a('0x30')],_0x4a679e[_0x6b7a('0x32')]));if(_0x40b7e5['query'][_0x6b7a('0x3b')]){_0x57c387['where']=_[_0x6b7a('0x3c')](_0x57c387['where'],{'$or':_[_0x6b7a('0x3e')](_0x57c387[_0x6b7a('0x34')],function(_0x2b18f7){var _0x38bffe={};_0x38bffe[_0x2b18f7]={'$like':'%'+_0x40b7e5[_0x6b7a('0x30')][_0x6b7a('0x3b')]+'%'};return _0x38bffe;})});}_0x57c387=_[_0x6b7a('0x3c')]({},_0x57c387,_0x40b7e5['options']);return _0x58bc46[_0x6b7a('0x52')](_0x57c387);}})[_0x6b7a('0x25')](function(_0x4efdc7){if(_0x4efdc7){_0x33ce25=_0x4efdc7[_0x6b7a('0x36')];if(!_0x40b7e5['query'][_0x6b7a('0x50')](_0x6b7a('0x37'))){_0x57c387[_0x6b7a('0x1f')]=qs[_0x6b7a('0x1f')](_0x40b7e5[_0x6b7a('0x30')]['limit']);_0x57c387[_0x6b7a('0x1d')]=qs['offset'](_0x40b7e5[_0x6b7a('0x30')][_0x6b7a('0x1d')]);}return _0x58bc46['getDescriptions'](_0x57c387);}})[_0x6b7a('0x25')](function(_0x475090){if(_0x475090){return _0x475090?{'count':_0x33ce25,'rows':_0x475090}:null;}})[_0x6b7a('0x25')](respondWithResult(_0x3f799a,null))[_0x6b7a('0x47')](handleError(_0x3f799a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 26c3ddf..3c9330d 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 _0x9428=['SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSalesforceConfiguration.attributes','define'];(function(_0x139182,_0x343de4){var _0x4d0787=function(_0x7ef3aa){while(--_0x7ef3aa){_0x139182['push'](_0x139182['shift']());}};_0x4d0787(++_0x343de4);}(_0x9428,0x10a));var _0x8942=function(_0xd2e2ab,_0x2440cf){_0xd2e2ab=_0xd2e2ab-0x0;var _0x1703a2=_0x9428[_0xd2e2ab];return _0x1703a2;};'use strict';var _=require('lodash');var util=require(_0x8942('0x0'));var logger=require(_0x8942('0x1'))(_0x8942('0x2'));var moment=require(_0x8942('0x3'));var BPromise=require(_0x8942('0x4'));var rp=require(_0x8942('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8942('0x6'));var config=require('../../config/environment');var attributes=require(_0x8942('0x7'));module['exports']=function(_0x563f6d,_0x167cf3){return _0x563f6d[_0x8942('0x8')](_0x8942('0x9'),attributes,{'tableName':_0x8942('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1395=['define','SalesforceConfiguration','lodash','api','path','rimraf','../../config/environment','exports'];(function(_0x33b666,_0x520fd3){var _0x24fed4=function(_0x1954c3){while(--_0x1954c3){_0x33b666['push'](_0x33b666['shift']());}};_0x24fed4(++_0x520fd3);}(_0x1395,0x152));var _0x5139=function(_0x355220,_0x9175b6){_0x355220=_0x355220-0x0;var _0x157553=_0x1395[_0x355220];return _0x157553;};'use strict';var _=require(_0x5139('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5139('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5139('0x2'));var rimraf=require(_0x5139('0x3'));var config=require(_0x5139('0x4'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x5139('0x5')]=function(_0x16df94,_0x1922d0){return _0x16df94[_0x5139('0x6')](_0x5139('0x7'),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 2aa38b9..a8db4cb 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 _0x282f=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x282f,0xb2));var _0xf282=function(_0x32d1d1,_0xd33438){_0x32d1d1=_0x32d1d1-0x0;var _0x1c1fa4=_0x282f[_0x32d1d1];return _0x1c1fa4;};'use strict';var _=require('lodash');var util=require(_0xf282('0x0'));var moment=require(_0xf282('0x1'));var BPromise=require(_0xf282('0x2'));var rs=require(_0xf282('0x3'));var fs=require('fs');var Redis=require(_0xf282('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf282('0x5'));var logger=require(_0xf282('0x6'))(_0xf282('0x7'));var config=require(_0xf282('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf282('0x9')][_0xf282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5df95e,_0x4315e7,_0x2405f5){return new BPromise(function(_0x31cddb,_0x258bfd){return client[_0xf282('0xb')](_0x5df95e,_0x2405f5)['then'](function(_0x4164b7){logger[_0xf282('0xc')](_0xf282('0xd'),_0x4315e7,_0xf282('0xe'));logger[_0xf282('0xf')](_0xf282('0x10'),_0x4315e7,_0xf282('0xe'),JSON[_0xf282('0x11')](_0x4164b7));if(_0x4164b7[_0xf282('0x12')]){if(_0x4164b7[_0xf282('0x12')]['code']===0x1f4){logger[_0xf282('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4315e7,_0x4164b7[_0xf282('0x12')][_0xf282('0x13')]);return _0x258bfd(_0x4164b7[_0xf282('0x12')][_0xf282('0x13')]);}logger[_0xf282('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4315e7,_0x4164b7[_0xf282('0x12')][_0xf282('0x13')]);return _0x31cddb(_0x4164b7['error'][_0xf282('0x13')]);}else{logger[_0xf282('0xc')](_0xf282('0xd'),_0x4315e7,_0xf282('0xe'));_0x31cddb(_0x4164b7[_0xf282('0x14')][_0xf282('0x13')]);}})[_0xf282('0x15')](function(_0x388382){logger[_0xf282('0x12')](_0xf282('0xd'),_0x4315e7,_0x388382);_0x258bfd(_0x388382);});});} \ No newline at end of file +var _0x0ce8=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x37b000,_0x78fdff){var _0xd3b78a=function(_0x3ce7d4){while(--_0x3ce7d4){_0x37b000['push'](_0x37b000['shift']());}};_0xd3b78a(++_0x78fdff);}(_0x0ce8,0x183));var _0x80ce=function(_0x2903c4,_0x26ac14){_0x2903c4=_0x2903c4-0x0;var _0x2deaf1=_0x0ce8[_0x2903c4];return _0x2deaf1;};'use strict';var _=require(_0x80ce('0x0'));var util=require('util');var moment=require(_0x80ce('0x1'));var BPromise=require(_0x80ce('0x2'));var rs=require(_0x80ce('0x3'));var fs=require('fs');var Redis=require(_0x80ce('0x4'));var db=require(_0x80ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x80ce('0x6'));var config=require(_0x80ce('0x7'));var jayson=require(_0x80ce('0x8'));var client=jayson[_0x80ce('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x175a6e,_0x143d3d,_0x3a0f05){return new BPromise(function(_0x29601a,_0xca24e2){return client[_0x80ce('0xa')](_0x175a6e,_0x3a0f05)[_0x80ce('0xb')](function(_0x2aff20){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x143d3d,'request\x20sent');logger[_0x80ce('0xc')](_0x80ce('0xd'),_0x143d3d,_0x80ce('0xe'),JSON[_0x80ce('0xf')](_0x2aff20));if(_0x2aff20[_0x80ce('0x10')]){if(_0x2aff20[_0x80ce('0x10')][_0x80ce('0x11')]===0x1f4){logger['error'](_0x80ce('0x12'),_0x143d3d,_0x2aff20['error']['message']);return _0xca24e2(_0x2aff20[_0x80ce('0x10')][_0x80ce('0x13')]);}logger[_0x80ce('0x10')](_0x80ce('0x12'),_0x143d3d,_0x2aff20[_0x80ce('0x10')][_0x80ce('0x13')]);return _0x29601a(_0x2aff20[_0x80ce('0x10')]['message']);}else{logger[_0x80ce('0x14')](_0x80ce('0x12'),_0x143d3d,'request\x20sent');_0x29601a(_0x2aff20[_0x80ce('0x15')][_0x80ce('0x13')]);}})[_0x80ce('0x16')](function(_0x3b87aa){logger[_0x80ce('0x10')](_0x80ce('0x12'),_0x143d3d,_0x3b87aa);_0xca24e2(_0x3b87aa);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 61c453a..03bba14 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 _0x12c1=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','index','get','isAuthenticated','show','create','put','update','delete','/:id','destroy','exports'];(function(_0x41cf9f,_0x331776){var _0x31c491=function(_0x2799c5){while(--_0x2799c5){_0x41cf9f['push'](_0x41cf9f['shift']());}};_0x31c491(++_0x331776);}(_0x12c1,0x104));var _0x112c=function(_0x464dd3,_0x1c8ae4){_0x464dd3=_0x464dd3-0x0;var _0xf89f40=_0x12c1[_0x464dd3];return _0xf89f40;};'use strict';var multer=require(_0x112c('0x0'));var util=require(_0x112c('0x1'));var path=require(_0x112c('0x2'));var timeout=require(_0x112c('0x3'));var express=require(_0x112c('0x4'));var router=express['Router']();var fs_extra=require(_0x112c('0x5'));var auth=require(_0x112c('0x6'));var interaction=require(_0x112c('0x7'));var config=require('../../config/environment');var controller=require(_0x112c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x112c('0x9')]);router[_0x112c('0xa')]('/:id',auth[_0x112c('0xb')](),controller[_0x112c('0xc')]);router['post']('/',auth[_0x112c('0xb')](),controller[_0x112c('0xd')]);router[_0x112c('0xe')]('/:id',auth[_0x112c('0xb')](),controller[_0x112c('0xf')]);router[_0x112c('0x10')](_0x112c('0x11'),auth[_0x112c('0xb')](),controller[_0x112c('0x12')]);module[_0x112c('0x13')]=router; \ No newline at end of file +var _0x94e4=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x94e4,0x16b));var _0x494e=function(_0x1d7acb,_0x649f3d){_0x1d7acb=_0x1d7acb-0x0;var _0x106c0a=_0x94e4[_0x1d7acb];return _0x106c0a;};'use strict';var multer=require(_0x494e('0x0'));var util=require('util');var path=require(_0x494e('0x1'));var timeout=require(_0x494e('0x2'));var express=require(_0x494e('0x3'));var router=express[_0x494e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x494e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x494e('0x6'));var controller=require('./intSalesforceField.controller');router[_0x494e('0x7')]('/',auth[_0x494e('0x8')](),controller[_0x494e('0x9')]);router[_0x494e('0x7')](_0x494e('0xa'),auth[_0x494e('0x8')](),controller[_0x494e('0xb')]);router[_0x494e('0xc')]('/',auth[_0x494e('0x8')](),controller[_0x494e('0xd')]);router[_0x494e('0xe')](_0x494e('0xa'),auth[_0x494e('0x8')](),controller[_0x494e('0xf')]);router[_0x494e('0x10')](_0x494e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x494e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index db4e8f9..52609da 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 _0x336b=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x14f920,_0x4fdfce){var _0xc4afd5=function(_0xbee8ec){while(--_0xbee8ec){_0x14f920['push'](_0x14f920['shift']());}};_0xc4afd5(++_0x4fdfce);}(_0x336b,0x144));var _0xb336=function(_0x59d14b,_0x51526f){_0x59d14b=_0x59d14b-0x0;var _0x215d8f=_0x336b[_0x59d14b];return _0x215d8f;};'use strict';var Sequelize=require(_0xb336('0x0'));module[_0xb336('0x1')]={'type':{'type':Sequelize[_0xb336('0x2')](_0xb336('0x3'),_0xb336('0x4'),_0xb336('0x5'),_0xb336('0x6'),_0xb336('0x7')),'defaultValue':_0xb336('0x3')},'content':{'type':Sequelize[_0xb336('0x8')]},'key':{'type':Sequelize[_0xb336('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xb336('0x3'),_0xb336('0x4'),_0xb336('0x5'))},'keyContent':{'type':Sequelize[_0xb336('0x8')]},'idField':{'type':Sequelize[_0xb336('0x8')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2ac8=['variable','customVariable','keyValue','picklist','string','STRING','ENUM','sequelize','exports'];(function(_0x49d02c,_0x1ba201){var _0x448aef=function(_0x44dbce){while(--_0x44dbce){_0x49d02c['push'](_0x49d02c['shift']());}};_0x448aef(++_0x1ba201);}(_0x2ac8,0x127));var _0x82ac=function(_0xd59bb3,_0x56a066){_0xd59bb3=_0xd59bb3-0x0;var _0x21e821=_0x2ac8[_0xd59bb3];return _0x21e821;};'use strict';var Sequelize=require(_0x82ac('0x0'));module[_0x82ac('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x82ac('0x2'),_0x82ac('0x3'),_0x82ac('0x4'),_0x82ac('0x5')),'defaultValue':_0x82ac('0x6')},'content':{'type':Sequelize[_0x82ac('0x7')]},'key':{'type':Sequelize[_0x82ac('0x7')]},'keyType':{'type':Sequelize[_0x82ac('0x8')](_0x82ac('0x6'),_0x82ac('0x2'),_0x82ac('0x3'))},'keyContent':{'type':Sequelize[_0x82ac('0x7')]},'idField':{'type':Sequelize[_0x82ac('0x7')]},'variableName':{'type':Sequelize[_0x82ac('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 38d50a5..b01eceb 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 _0x0867=['set','apply','reject','save','update','destroy','then','end','error','stack','send','index','map','SalesforceField','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','json','undefined','limit','count','offset'];(function(_0x537501,_0x1509e4){var _0x54bfc2=function(_0x29bd68){while(--_0x29bd68){_0x537501['push'](_0x537501['shift']());}};_0x54bfc2(++_0x1509e4);}(_0x0867,0x10b));var _0x7086=function(_0x33429a,_0x4392e6){_0x33429a=_0x33429a-0x0;var _0x49acf6=_0x0867[_0x33429a];return _0x49acf6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7086('0x0'));var zipdir=require(_0x7086('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7086('0x2'));var Mustache=require(_0x7086('0x3'));var util=require(_0x7086('0x4'));var path=require(_0x7086('0x5'));var sox=require(_0x7086('0x6'));var csv=require(_0x7086('0x7'));var ejs=require(_0x7086('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7086('0x9'));var squel=require(_0x7086('0xa'));var crypto=require(_0x7086('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7086('0xc'));var toCsv=require(_0x7086('0x7'));var querystring=require(_0x7086('0xd'));var Papa=require(_0x7086('0xe'));var Redis=require(_0x7086('0xf'));var authService=require(_0x7086('0x10'));var qs=require(_0x7086('0x11'));var as=require(_0x7086('0x12'));var hardwareService=require(_0x7086('0x13'));var logger=require('../../config/logger')(_0x7086('0x14'));var utils=require(_0x7086('0x15'));var config=require(_0x7086('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28c5a6,_0x177c40){_0x177c40=_0x177c40||0xcc;return function(_0x584ef0){if(_0x584ef0){return _0x28c5a6['sendStatus'](_0x177c40);}return _0x28c5a6['status'](_0x177c40)['end']();};}function respondWithResult(_0x398fc7,_0x522639){_0x522639=_0x522639||0xc8;return function(_0x3fc7f2){if(_0x3fc7f2){return _0x398fc7[_0x7086('0x17')](_0x522639)[_0x7086('0x18')](_0x3fc7f2);}};}function respondWithFilteredResult(_0x4f05d0,_0xa830c){return function(_0x18d27b){if(_0x18d27b){var _0x44d053=typeof _0xa830c['offset']===_0x7086('0x19')&&typeof _0xa830c[_0x7086('0x1a')]===_0x7086('0x19');var _0xa11b62=_0x18d27b[_0x7086('0x1b')];var _0x555585=_0x44d053?0x0:_0xa830c[_0x7086('0x1c')];var _0x475f60=_0x44d053?_0x18d27b['count']:_0xa830c[_0x7086('0x1c')]+_0xa830c[_0x7086('0x1a')];var _0x1fd6e4;if(_0x475f60>=_0xa11b62){_0x475f60=_0xa11b62;_0x1fd6e4=0xc8;}else{_0x1fd6e4=0xce;}_0x4f05d0['status'](_0x1fd6e4);return _0x4f05d0[_0x7086('0x1d')]('Content-Range',_0x555585+'-'+_0x475f60+'/'+_0xa11b62)['json'](_0x18d27b);}return null;};}function patchUpdates(_0x266965){return function(_0x333af9){try{jsonpatch[_0x7086('0x1e')](_0x333af9,_0x266965,!![]);}catch(_0x4835a2){return BPromise[_0x7086('0x1f')](_0x4835a2);}return _0x333af9[_0x7086('0x20')]();};}function saveUpdates(_0x232767,_0x422914){return function(_0x54d7c7){if(_0x54d7c7){return _0x54d7c7[_0x7086('0x21')](_0x232767)['then'](function(_0x44d756){return _0x44d756;});}return null;};}function removeEntity(_0x5a4842,_0x5bc87c){return function(_0x1c3a09){if(_0x1c3a09){return _0x1c3a09[_0x7086('0x22')]()[_0x7086('0x23')](function(){_0x5a4842[_0x7086('0x17')](0xcc)[_0x7086('0x24')]();});}};}function handleEntityNotFound(_0x1fa46a,_0x3e3888){return function(_0x3d81c3){if(!_0x3d81c3){_0x1fa46a['sendStatus'](0x194);}return _0x3d81c3;};}function handleError(_0x88f048,_0x180293){_0x180293=_0x180293||0x1f4;return function(_0x418b13){logger[_0x7086('0x25')](_0x418b13[_0x7086('0x26')]);if(_0x418b13['name']){delete _0x418b13['name'];}_0x88f048[_0x7086('0x17')](_0x180293)[_0x7086('0x27')](_0x418b13);};}exports[_0x7086('0x28')]=function(_0x263ffe,_0x4adf01){var _0x43ebc3={},_0x45fc66={},_0x372064={'count':0x0,'rows':[]};var _0x123df0=_[_0x7086('0x29')](db[_0x7086('0x2a')][_0x7086('0x2b')],function(_0x53d25f){return{'name':_0x53d25f['fieldName'],'type':_0x53d25f[_0x7086('0x2c')][_0x7086('0x2d')]};});_0x45fc66[_0x7086('0x2e')]=_[_0x7086('0x29')](_0x123df0,_0x7086('0x2f'));_0x45fc66[_0x7086('0x30')]=_[_0x7086('0x31')](_0x263ffe[_0x7086('0x30')]);_0x45fc66[_0x7086('0x32')]=_[_0x7086('0x33')](_0x45fc66[_0x7086('0x2e')],_0x45fc66[_0x7086('0x30')]);_0x43ebc3[_0x7086('0x34')]=_[_0x7086('0x33')](_0x45fc66['model'],qs['fields'](_0x263ffe[_0x7086('0x30')][_0x7086('0x35')]));_0x43ebc3['attributes']=_0x43ebc3[_0x7086('0x34')]['length']?_0x43ebc3[_0x7086('0x34')]:_0x45fc66['model'];if(!_0x263ffe['query'][_0x7086('0x36')](_0x7086('0x37'))){_0x43ebc3[_0x7086('0x1a')]=qs[_0x7086('0x1a')](_0x263ffe[_0x7086('0x30')][_0x7086('0x1a')]);_0x43ebc3['offset']=qs[_0x7086('0x1c')](_0x263ffe['query'][_0x7086('0x1c')]);}_0x43ebc3['order']=qs[_0x7086('0x38')](_0x263ffe[_0x7086('0x30')][_0x7086('0x38')]);_0x43ebc3[_0x7086('0x39')]=qs[_0x7086('0x32')](_[_0x7086('0x3a')](_0x263ffe[_0x7086('0x30')],_0x45fc66[_0x7086('0x32')]),_0x123df0);if(_0x263ffe[_0x7086('0x30')]['filter']){_0x43ebc3[_0x7086('0x39')]=_['merge'](_0x43ebc3[_0x7086('0x39')],{'$or':_['map'](_0x123df0,function(_0xbf7d7){if(_0xbf7d7['type']!==_0x7086('0x3b')){var _0x522bd4={};_0x522bd4[_0xbf7d7['name']]={'$like':'%'+_0x263ffe[_0x7086('0x30')][_0x7086('0x3c')]+'%'};return _0x522bd4;}})});}_0x43ebc3=_[_0x7086('0x3d')]({},_0x43ebc3,_0x263ffe[_0x7086('0x3e')]);var _0x57ad99={'where':_0x43ebc3[_0x7086('0x39')]};return db[_0x7086('0x2a')][_0x7086('0x1b')](_0x57ad99)[_0x7086('0x23')](function(_0x401921){_0x372064[_0x7086('0x1b')]=_0x401921;if(_0x263ffe[_0x7086('0x30')][_0x7086('0x3f')]){_0x43ebc3[_0x7086('0x40')]=[{'all':!![]}];}return db[_0x7086('0x2a')][_0x7086('0x41')](_0x43ebc3);})['then'](function(_0x2d7139){_0x372064[_0x7086('0x42')]=_0x2d7139;return _0x372064;})[_0x7086('0x23')](respondWithFilteredResult(_0x4adf01,_0x43ebc3))[_0x7086('0x43')](handleError(_0x4adf01,null));};exports[_0x7086('0x44')]=function(_0x293ab8,_0x9b57d4){var _0x374469={'raw':!![],'where':{'id':_0x293ab8[_0x7086('0x45')]['id']}},_0x148936={};_0x148936['model']=_[_0x7086('0x31')](db[_0x7086('0x2a')][_0x7086('0x2b')]);_0x148936[_0x7086('0x30')]=_['keys'](_0x293ab8[_0x7086('0x30')]);_0x148936['filters']=_[_0x7086('0x33')](_0x148936[_0x7086('0x2e')],_0x148936[_0x7086('0x30')]);_0x374469['attributes']=_[_0x7086('0x33')](_0x148936[_0x7086('0x2e')],qs[_0x7086('0x35')](_0x293ab8[_0x7086('0x30')][_0x7086('0x35')]));_0x374469[_0x7086('0x34')]=_0x374469[_0x7086('0x34')][_0x7086('0x46')]?_0x374469[_0x7086('0x34')]:_0x148936[_0x7086('0x2e')];if(_0x293ab8[_0x7086('0x30')][_0x7086('0x3f')]){_0x374469[_0x7086('0x40')]=[{'all':!![]}];}_0x374469=_[_0x7086('0x3d')]({},_0x374469,_0x293ab8[_0x7086('0x3e')]);return db[_0x7086('0x2a')]['find'](_0x374469)[_0x7086('0x23')](handleEntityNotFound(_0x9b57d4,null))['then'](respondWithResult(_0x9b57d4,null))[_0x7086('0x43')](handleError(_0x9b57d4,null));};exports[_0x7086('0x47')]=function(_0x36229a,_0x4c4849){return db[_0x7086('0x2a')][_0x7086('0x47')](_0x36229a[_0x7086('0x48')],{})[_0x7086('0x23')](respondWithResult(_0x4c4849,0xc9))['catch'](handleError(_0x4c4849,null));};exports[_0x7086('0x21')]=function(_0x5cabf3,_0x4a3d67){if(_0x5cabf3[_0x7086('0x48')]['id']){delete _0x5cabf3['body']['id'];}return db[_0x7086('0x2a')][_0x7086('0x49')]({'where':{'id':_0x5cabf3[_0x7086('0x45')]['id']}})[_0x7086('0x23')](handleEntityNotFound(_0x4a3d67,null))[_0x7086('0x23')](saveUpdates(_0x5cabf3[_0x7086('0x48')],null))[_0x7086('0x23')](respondWithResult(_0x4a3d67,null))[_0x7086('0x43')](handleError(_0x4a3d67,null));};exports[_0x7086('0x22')]=function(_0x119dd4,_0x290dc9){return db['SalesforceField'][_0x7086('0x49')]({'where':{'id':_0x119dd4[_0x7086('0x45')]['id']}})[_0x7086('0x23')](handleEntityNotFound(_0x290dc9,null))['then'](removeEntity(_0x290dc9,null))['catch'](handleError(_0x290dc9,null));}; \ No newline at end of file +var _0xc7ce=['map','SalesforceField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','create','body','find','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index'];(function(_0x3c2bb5,_0x476b68){var _0x492c69=function(_0xeb283){while(--_0xeb283){_0x3c2bb5['push'](_0x3c2bb5['shift']());}};_0x492c69(++_0x476b68);}(_0xc7ce,0x18e));var _0xec7c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc7ce[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0xec7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec7c('0x1'));var jsonpatch=require(_0xec7c('0x2'));var rp=require(_0xec7c('0x3'));var moment=require(_0xec7c('0x4'));var BPromise=require(_0xec7c('0x5'));var Mustache=require(_0xec7c('0x6'));var util=require(_0xec7c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xec7c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec7c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xec7c('0x8'));var querystring=require(_0xec7c('0xa'));var Papa=require(_0xec7c('0xb'));var Redis=require('ioredis');var authService=require(_0xec7c('0xc'));var qs=require(_0xec7c('0xd'));var as=require(_0xec7c('0xe'));var hardwareService=require(_0xec7c('0xf'));var logger=require(_0xec7c('0x10'))(_0xec7c('0x11'));var utils=require(_0xec7c('0x12'));var config=require(_0xec7c('0x13'));var licenseUtil=require(_0xec7c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ed3b2,_0x4fe722){_0x4fe722=_0x4fe722||0xcc;return function(_0x3ef4e6){if(_0x3ef4e6){return _0x1ed3b2[_0xec7c('0x15')](_0x4fe722);}return _0x1ed3b2[_0xec7c('0x16')](_0x4fe722)[_0xec7c('0x17')]();};}function respondWithResult(_0xc4c8a2,_0x5bfb9e){_0x5bfb9e=_0x5bfb9e||0xc8;return function(_0x4ed5b9){if(_0x4ed5b9){return _0xc4c8a2[_0xec7c('0x16')](_0x5bfb9e)[_0xec7c('0x18')](_0x4ed5b9);}};}function respondWithFilteredResult(_0x13bf16,_0x2d85ed){return function(_0x325649){if(_0x325649){var _0x4e9704=typeof _0x2d85ed[_0xec7c('0x19')]==='undefined'&&typeof _0x2d85ed['limit']===_0xec7c('0x1a');var _0x3aaf29=_0x325649[_0xec7c('0x1b')];var _0x4d137e=_0x4e9704?0x0:_0x2d85ed['offset'];var _0x363805=_0x4e9704?_0x325649['count']:_0x2d85ed[_0xec7c('0x19')]+_0x2d85ed[_0xec7c('0x1c')];var _0x3e2508;if(_0x363805>=_0x3aaf29){_0x363805=_0x3aaf29;_0x3e2508=0xc8;}else{_0x3e2508=0xce;}_0x13bf16[_0xec7c('0x16')](_0x3e2508);return _0x13bf16[_0xec7c('0x1d')](_0xec7c('0x1e'),_0x4d137e+'-'+_0x363805+'/'+_0x3aaf29)[_0xec7c('0x18')](_0x325649);}return null;};}function patchUpdates(_0x317fd2){return function(_0x682138){try{jsonpatch[_0xec7c('0x1f')](_0x682138,_0x317fd2,!![]);}catch(_0x113dd5){return BPromise['reject'](_0x113dd5);}return _0x682138[_0xec7c('0x20')]();};}function saveUpdates(_0x1c7ab6,_0x380fae){return function(_0x41cc0e){if(_0x41cc0e){return _0x41cc0e[_0xec7c('0x21')](_0x1c7ab6)[_0xec7c('0x22')](function(_0x3acd4b){return _0x3acd4b;});}return null;};}function removeEntity(_0x322397,_0x4341a5){return function(_0x1f27b3){if(_0x1f27b3){return _0x1f27b3['destroy']()[_0xec7c('0x22')](function(){_0x322397[_0xec7c('0x16')](0xcc)[_0xec7c('0x17')]();});}};}function handleEntityNotFound(_0x548629,_0x12f71f){return function(_0x3415ac){if(!_0x3415ac){_0x548629[_0xec7c('0x15')](0x194);}return _0x3415ac;};}function handleError(_0x354503,_0x259815){_0x259815=_0x259815||0x1f4;return function(_0x2b3028){logger[_0xec7c('0x23')](_0x2b3028[_0xec7c('0x24')]);if(_0x2b3028[_0xec7c('0x25')]){delete _0x2b3028[_0xec7c('0x25')];}_0x354503['status'](_0x259815)[_0xec7c('0x26')](_0x2b3028);};}exports[_0xec7c('0x27')]=function(_0x35dbb8,_0x1262c6){var _0x403774={},_0x2026a5={},_0x3bcca0={'count':0x0,'rows':[]};var _0x4b9823=_[_0xec7c('0x28')](db[_0xec7c('0x29')][_0xec7c('0x2a')],function(_0x2bdccb){return{'name':_0x2bdccb['fieldName'],'type':_0x2bdccb[_0xec7c('0x2b')][_0xec7c('0x2c')]};});_0x2026a5[_0xec7c('0x2d')]=_[_0xec7c('0x28')](_0x4b9823,'name');_0x2026a5[_0xec7c('0x2e')]=_[_0xec7c('0x2f')](_0x35dbb8['query']);_0x2026a5[_0xec7c('0x30')]=_[_0xec7c('0x31')](_0x2026a5[_0xec7c('0x2d')],_0x2026a5[_0xec7c('0x2e')]);_0x403774[_0xec7c('0x32')]=_[_0xec7c('0x31')](_0x2026a5['model'],qs[_0xec7c('0x33')](_0x35dbb8[_0xec7c('0x2e')]['fields']));_0x403774[_0xec7c('0x32')]=_0x403774[_0xec7c('0x32')]['length']?_0x403774['attributes']:_0x2026a5[_0xec7c('0x2d')];if(!_0x35dbb8['query'][_0xec7c('0x34')](_0xec7c('0x35'))){_0x403774[_0xec7c('0x1c')]=qs['limit'](_0x35dbb8[_0xec7c('0x2e')]['limit']);_0x403774[_0xec7c('0x19')]=qs[_0xec7c('0x19')](_0x35dbb8[_0xec7c('0x2e')][_0xec7c('0x19')]);}_0x403774[_0xec7c('0x36')]=qs[_0xec7c('0x37')](_0x35dbb8['query'][_0xec7c('0x37')]);_0x403774['where']=qs['filters'](_[_0xec7c('0x38')](_0x35dbb8[_0xec7c('0x2e')],_0x2026a5[_0xec7c('0x30')]),_0x4b9823);if(_0x35dbb8[_0xec7c('0x2e')][_0xec7c('0x39')]){_0x403774[_0xec7c('0x3a')]=_[_0xec7c('0x3b')](_0x403774['where'],{'$or':_[_0xec7c('0x28')](_0x4b9823,function(_0x454054){if(_0x454054[_0xec7c('0x2b')]!==_0xec7c('0x3c')){var _0x49ff8c={};_0x49ff8c[_0x454054[_0xec7c('0x25')]]={'$like':'%'+_0x35dbb8[_0xec7c('0x2e')]['filter']+'%'};return _0x49ff8c;}})});}_0x403774=_['merge']({},_0x403774,_0x35dbb8[_0xec7c('0x3d')]);var _0x168177={'where':_0x403774['where']};return db['SalesforceField'][_0xec7c('0x1b')](_0x168177)['then'](function(_0x154c07){_0x3bcca0[_0xec7c('0x1b')]=_0x154c07;if(_0x35dbb8[_0xec7c('0x2e')][_0xec7c('0x3e')]){_0x403774[_0xec7c('0x3f')]=[{'all':!![]}];}return db[_0xec7c('0x29')][_0xec7c('0x40')](_0x403774);})[_0xec7c('0x22')](function(_0x3ce45e){_0x3bcca0['rows']=_0x3ce45e;return _0x3bcca0;})[_0xec7c('0x22')](respondWithFilteredResult(_0x1262c6,_0x403774))[_0xec7c('0x41')](handleError(_0x1262c6,null));};exports[_0xec7c('0x42')]=function(_0x4eaf2e,_0x28e3db){var _0xe61d5c={'raw':!![],'where':{'id':_0x4eaf2e['params']['id']}},_0x493295={};_0x493295['model']=_[_0xec7c('0x2f')](db['SalesforceField'][_0xec7c('0x2a')]);_0x493295[_0xec7c('0x2e')]=_[_0xec7c('0x2f')](_0x4eaf2e['query']);_0x493295[_0xec7c('0x30')]=_[_0xec7c('0x31')](_0x493295[_0xec7c('0x2d')],_0x493295[_0xec7c('0x2e')]);_0xe61d5c['attributes']=_[_0xec7c('0x31')](_0x493295[_0xec7c('0x2d')],qs['fields'](_0x4eaf2e[_0xec7c('0x2e')]['fields']));_0xe61d5c['attributes']=_0xe61d5c['attributes'][_0xec7c('0x43')]?_0xe61d5c['attributes']:_0x493295[_0xec7c('0x2d')];if(_0x4eaf2e[_0xec7c('0x2e')][_0xec7c('0x3e')]){_0xe61d5c[_0xec7c('0x3f')]=[{'all':!![]}];}_0xe61d5c=_[_0xec7c('0x3b')]({},_0xe61d5c,_0x4eaf2e['options']);return db[_0xec7c('0x29')]['find'](_0xe61d5c)[_0xec7c('0x22')](handleEntityNotFound(_0x28e3db,null))[_0xec7c('0x22')](respondWithResult(_0x28e3db,null))[_0xec7c('0x41')](handleError(_0x28e3db,null));};exports[_0xec7c('0x44')]=function(_0x346280,_0x1fd9e9){return db['SalesforceField'][_0xec7c('0x44')](_0x346280[_0xec7c('0x45')],{})[_0xec7c('0x22')](respondWithResult(_0x1fd9e9,0xc9))[_0xec7c('0x41')](handleError(_0x1fd9e9,null));};exports['update']=function(_0x241934,_0x2011e8){if(_0x241934[_0xec7c('0x45')]['id']){delete _0x241934[_0xec7c('0x45')]['id'];}return db['SalesforceField'][_0xec7c('0x46')]({'where':{'id':_0x241934['params']['id']}})[_0xec7c('0x22')](handleEntityNotFound(_0x2011e8,null))['then'](saveUpdates(_0x241934[_0xec7c('0x45')],null))[_0xec7c('0x22')](respondWithResult(_0x2011e8,null))[_0xec7c('0x41')](handleError(_0x2011e8,null));};exports[_0xec7c('0x47')]=function(_0x24d139,_0x257464){return db[_0xec7c('0x29')][_0xec7c('0x46')]({'where':{'id':_0x24d139[_0xec7c('0x48')]['id']}})['then'](handleEntityNotFound(_0x257464,null))['then'](removeEntity(_0x257464,null))[_0xec7c('0x41')](handleError(_0x257464,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 26de158..93ed80f 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 _0x964b=['bluebird','path','rimraf','../../config/environment','exports','define','SalesforceField','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x29f9af,_0x4f3d10){var _0x56e4a8=function(_0x2e2554){while(--_0x2e2554){_0x29f9af['push'](_0x29f9af['shift']());}};_0x56e4a8(++_0x4f3d10);}(_0x964b,0x1a9));var _0xb964=function(_0x15303a,_0x249d38){_0x15303a=_0x15303a-0x0;var _0x140468=_0x964b[_0x15303a];return _0x140468;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require(_0xb964('0x2'))('api');var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb964('0x5'));var rimraf=require(_0xb964('0x6'));var config=require(_0xb964('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0xb964('0x8')]=function(_0x53b14e,_0xa84d29){return _0x53b14e[_0xb964('0x9')](_0xb964('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xb964('0xb'),_0xb964('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0502=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x1621c5,_0x57c74c){var _0x55d62d=function(_0x1691f0){while(--_0x1691f0){_0x1621c5['push'](_0x1621c5['shift']());}};_0x55d62d(++_0x57c74c);}(_0x0502,0x78));var _0x2050=function(_0x27b8a1,_0x21a9c1){_0x27b8a1=_0x27b8a1-0x0;var _0x341fe5=_0x0502[_0x27b8a1];return _0x341fe5;};'use strict';var _=require(_0x2050('0x0'));var util=require(_0x2050('0x1'));var logger=require('../../config/logger')(_0x2050('0x2'));var moment=require(_0x2050('0x3'));var BPromise=require(_0x2050('0x4'));var rp=require(_0x2050('0x5'));var fs=require('fs');var path=require(_0x2050('0x6'));var rimraf=require(_0x2050('0x7'));var config=require(_0x2050('0x8'));var attributes=require(_0x2050('0x9'));module[_0x2050('0xa')]=function(_0x5596cf,_0x129688){return _0x5596cf[_0x2050('0xb')](_0x2050('0xc'),attributes,{'tableName':_0x2050('0xd'),'paranoid':![],'indexes':[{'name':_0x2050('0xe'),'fields':[_0x2050('0xf'),_0x2050('0x10')],'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 5297644..9f96076 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 _0xa24a=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x23f193,_0x4431fb){var _0x33cec5=function(_0x111c45){while(--_0x111c45){_0x23f193['push'](_0x23f193['shift']());}};_0x33cec5(++_0x4431fb);}(_0xa24a,0x10a));var _0xaa24=function(_0x3491a5,_0x4778f6){_0x3491a5=_0x3491a5-0x0;var _0x3816ad=_0xa24a[_0x3491a5];return _0x3816ad;};'use strict';var _=require(_0xaa24('0x0'));var util=require(_0xaa24('0x1'));var moment=require(_0xaa24('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa24('0x3'));var db=require(_0xaa24('0x4'))['db'];var utils=require(_0xaa24('0x5'));var logger=require(_0xaa24('0x6'))('rpc');var config=require(_0xaa24('0x7'));var jayson=require(_0xaa24('0x8'));var client=jayson[_0xaa24('0x9')][_0xaa24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30bd65,_0xd703d9,_0x3855c7){return new BPromise(function(_0x3333ba,_0x2bfb81){return client['request'](_0x30bd65,_0x3855c7)[_0xaa24('0xb')](function(_0x273e3f){logger[_0xaa24('0xc')](_0xaa24('0xd'),_0xd703d9,'request\x20sent');logger['debug'](_0xaa24('0xe'),_0xd703d9,'request\x20sent',JSON[_0xaa24('0xf')](_0x273e3f));if(_0x273e3f['error']){if(_0x273e3f[_0xaa24('0x10')][_0xaa24('0x11')]===0x1f4){logger['error'](_0xaa24('0xd'),_0xd703d9,_0x273e3f[_0xaa24('0x10')][_0xaa24('0x12')]);return _0x2bfb81(_0x273e3f[_0xaa24('0x10')]['message']);}logger[_0xaa24('0x10')]('SalesforceField,\x20%s,\x20%s',_0xd703d9,_0x273e3f[_0xaa24('0x10')][_0xaa24('0x12')]);return _0x3333ba(_0x273e3f[_0xaa24('0x10')][_0xaa24('0x12')]);}else{logger[_0xaa24('0xc')](_0xaa24('0xd'),_0xd703d9,_0xaa24('0x13'));_0x3333ba(_0x273e3f[_0xaa24('0x14')]['message']);}})[_0xaa24('0x15')](function(_0x3b1eab){logger[_0xaa24('0x10')](_0xaa24('0xd'),_0xd703d9,_0x3b1eab);_0x2bfb81(_0x3b1eab);});});} \ No newline at end of file +var _0x856c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util','moment'];(function(_0x4736f7,_0x165d90){var _0xdf638f=function(_0x38a5e3){while(--_0x38a5e3){_0x4736f7['push'](_0x4736f7['shift']());}};_0xdf638f(++_0x165d90);}(_0x856c,0xd5));var _0xc856=function(_0x474dc1,_0x45d7ed){_0x474dc1=_0x474dc1-0x0;var _0x6b6006=_0x856c[_0x474dc1];return _0x6b6006;};'use strict';var _=require(_0xc856('0x0'));var util=require(_0xc856('0x1'));var moment=require(_0xc856('0x2'));var BPromise=require(_0xc856('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc856('0x4'));var db=require(_0xc856('0x5'))['db'];var utils=require(_0xc856('0x6'));var logger=require(_0xc856('0x7'))('rpc');var config=require(_0xc856('0x8'));var jayson=require(_0xc856('0x9'));var client=jayson[_0xc856('0xa')][_0xc856('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5110cc,_0xd59a5f,_0x449099){return new BPromise(function(_0x35139f,_0x5139b1){return client[_0xc856('0xc')](_0x5110cc,_0x449099)[_0xc856('0xd')](function(_0x3fae1b){logger[_0xc856('0xe')](_0xc856('0xf'),_0xd59a5f,'request\x20sent');logger[_0xc856('0x10')](_0xc856('0x11'),_0xd59a5f,_0xc856('0x12'),JSON[_0xc856('0x13')](_0x3fae1b));if(_0x3fae1b['error']){if(_0x3fae1b['error'][_0xc856('0x14')]===0x1f4){logger[_0xc856('0x15')](_0xc856('0xf'),_0xd59a5f,_0x3fae1b[_0xc856('0x15')]['message']);return _0x5139b1(_0x3fae1b[_0xc856('0x15')][_0xc856('0x16')]);}logger['error'](_0xc856('0xf'),_0xd59a5f,_0x3fae1b[_0xc856('0x15')][_0xc856('0x16')]);return _0x35139f(_0x3fae1b[_0xc856('0x15')]['message']);}else{logger[_0xc856('0xe')](_0xc856('0xf'),_0xd59a5f,_0xc856('0x12'));_0x35139f(_0x3fae1b[_0xc856('0x17')]['message']);}})['catch'](function(_0x2946fc){logger[_0xc856('0x15')]('SalesforceField,\x20%s,\x20%s',_0xd59a5f,_0x2946fc);_0x5139b1(_0x2946fc);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index efa4269..a4606a5 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 _0x3438=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer'];(function(_0x74c0ae,_0x14f230){var _0x5f0d6c=function(_0x25551c){while(--_0x25551c){_0x74c0ae['push'](_0x74c0ae['shift']());}};_0x5f0d6c(++_0x14f230);}(_0x3438,0x141));var _0x8343=function(_0x5032b4,_0x1b8f0f){_0x5032b4=_0x5032b4-0x0;var _0x4566d9=_0x3438[_0x5032b4];return _0x4566d9;};'use strict';var multer=require(_0x8343('0x0'));var util=require('util');var path=require(_0x8343('0x1'));var timeout=require(_0x8343('0x2'));var express=require(_0x8343('0x3'));var router=express['Router']();var fs_extra=require(_0x8343('0x4'));var auth=require(_0x8343('0x5'));var interaction=require(_0x8343('0x6'));var config=require(_0x8343('0x7'));var controller=require(_0x8343('0x8'));router[_0x8343('0x9')]('/',auth[_0x8343('0xa')](),controller[_0x8343('0xb')]);router[_0x8343('0x9')](_0x8343('0xc'),auth[_0x8343('0xa')](),controller['show']);router[_0x8343('0x9')](_0x8343('0xd'),auth['isAuthenticated'](),controller[_0x8343('0xe')]);router[_0x8343('0x9')](_0x8343('0xf'),auth[_0x8343('0xa')](),controller[_0x8343('0x10')]);router[_0x8343('0x11')]('/',auth[_0x8343('0xa')](),controller[_0x8343('0x12')]);router[_0x8343('0x11')](_0x8343('0xd'),auth['isAuthenticated'](),controller[_0x8343('0x13')]);router[_0x8343('0x14')](_0x8343('0xc'),auth[_0x8343('0xa')](),controller['update']);router['delete']('/:id',auth[_0x8343('0xa')](),controller[_0x8343('0x15')]);module[_0x8343('0x16')]=router; \ No newline at end of file +var _0x48b2=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x2a9b76,_0x463d6e){var _0x38c1d7=function(_0x229442){while(--_0x229442){_0x2a9b76['push'](_0x2a9b76['shift']());}};_0x38c1d7(++_0x463d6e);}(_0x48b2,0x176));var _0x248b=function(_0x803653,_0x30931b){_0x803653=_0x803653-0x0;var _0x3a7dcb=_0x48b2[_0x803653];return _0x3a7dcb;};'use strict';var multer=require(_0x248b('0x0'));var util=require(_0x248b('0x1'));var path=require(_0x248b('0x2'));var timeout=require(_0x248b('0x3'));var express=require(_0x248b('0x4'));var router=express[_0x248b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x248b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x248b('0x7'));var controller=require(_0x248b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x248b('0x9')]);router['get'](_0x248b('0xa'),auth[_0x248b('0xb')](),controller[_0x248b('0xc')]);router[_0x248b('0xd')](_0x248b('0xe'),auth[_0x248b('0xb')](),controller['getConfigurations']);router['get'](_0x248b('0xf'),auth['isAuthenticated'](),controller[_0x248b('0x10')]);router[_0x248b('0x11')]('/',auth['isAuthenticated'](),controller[_0x248b('0x12')]);router[_0x248b('0x11')]('/:id/configurations',auth[_0x248b('0xb')](),controller[_0x248b('0x13')]);router[_0x248b('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x248b('0x15')]);router[_0x248b('0x16')](_0x248b('0xa'),auth[_0x248b('0xb')](),controller[_0x248b('0x17')]);module[_0x248b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8d6e562..5e9694d 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 _0xbe42=['username','remoteUri','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe42,0x11e));var _0x2be4=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xbe42[_0x184759];return _0xf26d5f;};'use strict';var Sequelize=require('sequelize');module[_0x2be4('0x0')]={'name':{'type':Sequelize[_0x2be4('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x2be4('0x2')},'password':{'type':Sequelize[_0x2be4('0x1')]},'email':{'type':Sequelize[_0x2be4('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2be4('0x3')},'serverUrl':{'type':Sequelize[_0x2be4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6456=['STRING','username','remoteUri','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6456,0x166));var _0x6645=function(_0x2980ea,_0x5ebb26){_0x2980ea=_0x2980ea-0x0;var _0x142815=_0x6456[_0x2980ea];return _0x142815;};'use strict';var Sequelize=require(_0x6645('0x0'));module[_0x6645('0x1')]={'name':{'type':Sequelize[_0x6645('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6645('0x2')],'unique':_0x6645('0x3')},'password':{'type':Sequelize[_0x6645('0x2')]},'email':{'type':Sequelize[_0x6645('0x2')]},'remoteUri':{'type':Sequelize[_0x6645('0x2')],'unique':_0x6645('0x4')},'serverUrl':{'type':Sequelize[_0x6645('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 1016fbc..db4cde8 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 _0x2267=['fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','ServicenowAccount','include','findAll','rows','catch','length','includeAll','merge','find','create','body','update','params','getConfigurations','filter','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','incident_state','severity','category','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','escalation','upon_approval','correlation_id','username','password','serverUrl','remoteUri','substring','format','%s/api/now/table/','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','ServiceNow\x20error:\x20','statusCode','send','test','Wrong\x20credentials','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','status','offset','limit','undefined','count','set','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes'];(function(_0x270461,_0x2c1f98){var _0x2ebf09=function(_0x2d891d){while(--_0x2d891d){_0x270461['push'](_0x270461['shift']());}};_0x2ebf09(++_0x2c1f98);}(_0x2267,0x8a));var _0x7226=function(_0x113c80,_0x2728de){_0x113c80=_0x113c80-0x0;var _0x1615dd=_0x2267[_0x113c80];return _0x1615dd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7226('0x0'));var jsonpatch=require(_0x7226('0x1'));var rp=require(_0x7226('0x2'));var moment=require('moment');var BPromise=require(_0x7226('0x3'));var Mustache=require('mustache');var util=require(_0x7226('0x4'));var path=require(_0x7226('0x5'));var sox=require('sox');var csv=require(_0x7226('0x6'));var ejs=require(_0x7226('0x7'));var fs=require('fs');var fs_extra=require(_0x7226('0x8'));var _=require(_0x7226('0x9'));var squel=require(_0x7226('0xa'));var crypto=require('crypto');var jsforce=require(_0x7226('0xb'));var deskjs=require(_0x7226('0xc'));var toCsv=require(_0x7226('0x6'));var querystring=require(_0x7226('0xd'));var Papa=require(_0x7226('0xe'));var Redis=require(_0x7226('0xf'));var authService=require(_0x7226('0x10'));var qs=require(_0x7226('0x11'));var as=require(_0x7226('0x12'));var hardwareService=require(_0x7226('0x13'));var logger=require(_0x7226('0x14'))(_0x7226('0x15'));var utils=require('../../config/utils');var config=require(_0x7226('0x16'));var licenseUtil=require(_0x7226('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7226('0x18'));function respondWithStatusCode(_0x516649,_0x20e388){_0x20e388=_0x20e388||0xcc;return function(_0x10b92f){if(_0x10b92f){return _0x516649['sendStatus'](_0x20e388);}return _0x516649['status'](_0x20e388)[_0x7226('0x19')]();};}function respondWithResult(_0x174be4,_0x23349b){_0x23349b=_0x23349b||0xc8;return function(_0x1936de){if(_0x1936de){return _0x174be4[_0x7226('0x1a')](_0x23349b)['json'](_0x1936de);}};}function respondWithFilteredResult(_0xb85744,_0x37189e){return function(_0x924673){if(_0x924673){var _0x30e0fd=typeof _0x37189e[_0x7226('0x1b')]==='undefined'&&typeof _0x37189e[_0x7226('0x1c')]===_0x7226('0x1d');var _0xc12599=_0x924673['count'];var _0x406d47=_0x30e0fd?0x0:_0x37189e[_0x7226('0x1b')];var _0x13182f=_0x30e0fd?_0x924673[_0x7226('0x1e')]:_0x37189e[_0x7226('0x1b')]+_0x37189e[_0x7226('0x1c')];var _0xf83fd2;if(_0x13182f>=_0xc12599){_0x13182f=_0xc12599;_0xf83fd2=0xc8;}else{_0xf83fd2=0xce;}_0xb85744[_0x7226('0x1a')](_0xf83fd2);return _0xb85744[_0x7226('0x1f')]('Content-Range',_0x406d47+'-'+_0x13182f+'/'+_0xc12599)[_0x7226('0x20')](_0x924673);}return null;};}function patchUpdates(_0x417a5f){return function(_0xdb38dd){try{jsonpatch[_0x7226('0x21')](_0xdb38dd,_0x417a5f,!![]);}catch(_0x30737c){return BPromise[_0x7226('0x22')](_0x30737c);}return _0xdb38dd[_0x7226('0x23')]();};}function saveUpdates(_0x2d9bd4,_0x335960){return function(_0x1534c7){if(_0x1534c7){return _0x1534c7['update'](_0x2d9bd4)[_0x7226('0x24')](function(_0x342635){return _0x342635;});}return null;};}function removeEntity(_0xf24d0c,_0x6f6e39){return function(_0x593652){if(_0x593652){return _0x593652[_0x7226('0x25')]()[_0x7226('0x24')](function(){_0xf24d0c[_0x7226('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a0c4,_0x61ebc1){return function(_0x3db99c){if(!_0x3db99c){_0x59a0c4[_0x7226('0x26')](0x194);}return _0x3db99c;};}function handleError(_0x3ffaba,_0x10add4){_0x10add4=_0x10add4||0x1f4;return function(_0x5f4990){logger[_0x7226('0x27')](_0x5f4990[_0x7226('0x28')]);if(_0x5f4990['name']){delete _0x5f4990[_0x7226('0x29')];}_0x3ffaba['status'](_0x10add4)['send'](_0x5f4990);};}exports[_0x7226('0x2a')]=function(_0x52e892,_0x5ec17e){var _0x373ab1={},_0x32c00a={},_0x5c07a4={'count':0x0,'rows':[]};var _0x364c79=_[_0x7226('0x2b')](db['ServicenowAccount'][_0x7226('0x2c')],function(_0x529b79){return{'name':_0x529b79[_0x7226('0x2d')],'type':_0x529b79[_0x7226('0x2e')][_0x7226('0x2f')]};});_0x32c00a['model']=_[_0x7226('0x2b')](_0x364c79,_0x7226('0x29'));_0x32c00a[_0x7226('0x30')]=_[_0x7226('0x31')](_0x52e892[_0x7226('0x30')]);_0x32c00a[_0x7226('0x32')]=_[_0x7226('0x33')](_0x32c00a[_0x7226('0x34')],_0x32c00a['query']);_0x373ab1[_0x7226('0x35')]=_['intersection'](_0x32c00a[_0x7226('0x34')],qs[_0x7226('0x36')](_0x52e892[_0x7226('0x30')][_0x7226('0x36')]));_0x373ab1[_0x7226('0x35')]=_0x373ab1[_0x7226('0x35')]['length']?_0x373ab1[_0x7226('0x35')]:_0x32c00a['model'];if(!_0x52e892[_0x7226('0x30')][_0x7226('0x37')](_0x7226('0x38'))){_0x373ab1[_0x7226('0x1c')]=qs[_0x7226('0x1c')](_0x52e892[_0x7226('0x30')]['limit']);_0x373ab1[_0x7226('0x1b')]=qs['offset'](_0x52e892[_0x7226('0x30')][_0x7226('0x1b')]);}_0x373ab1[_0x7226('0x39')]=qs['sort'](_0x52e892[_0x7226('0x30')][_0x7226('0x3a')]);_0x373ab1[_0x7226('0x3b')]=qs[_0x7226('0x32')](_[_0x7226('0x3c')](_0x52e892['query'],_0x32c00a[_0x7226('0x32')]),_0x364c79);if(_0x52e892[_0x7226('0x30')]['filter']){_0x373ab1[_0x7226('0x3b')]=_['merge'](_0x373ab1[_0x7226('0x3b')],{'$or':_[_0x7226('0x2b')](_0x364c79,function(_0x55bd25){if(_0x55bd25[_0x7226('0x2e')]!==_0x7226('0x3d')){var _0x4a4667={};_0x4a4667[_0x55bd25[_0x7226('0x29')]]={'$like':'%'+_0x52e892['query']['filter']+'%'};return _0x4a4667;}})});}_0x373ab1=_['merge']({},_0x373ab1,_0x52e892[_0x7226('0x3e')]);var _0x27f0de={'where':_0x373ab1['where']};return db[_0x7226('0x3f')][_0x7226('0x1e')](_0x27f0de)[_0x7226('0x24')](function(_0x4a38d8){_0x5c07a4[_0x7226('0x1e')]=_0x4a38d8;if(_0x52e892[_0x7226('0x30')]['includeAll']){_0x373ab1[_0x7226('0x40')]=[{'all':!![]}];}return db[_0x7226('0x3f')][_0x7226('0x41')](_0x373ab1);})[_0x7226('0x24')](function(_0x3c1e20){_0x5c07a4[_0x7226('0x42')]=_0x3c1e20;return _0x5c07a4;})['then'](respondWithFilteredResult(_0x5ec17e,_0x373ab1))[_0x7226('0x43')](handleError(_0x5ec17e,null));};exports['show']=function(_0x47dd7f,_0x15ef8f){var _0x29fee7={'raw':![],'where':{'id':_0x47dd7f['params']['id']}},_0x3cd626={};_0x3cd626[_0x7226('0x34')]=_[_0x7226('0x31')](db[_0x7226('0x3f')][_0x7226('0x2c')]);_0x3cd626[_0x7226('0x30')]=_[_0x7226('0x31')](_0x47dd7f[_0x7226('0x30')]);_0x3cd626['filters']=_[_0x7226('0x33')](_0x3cd626[_0x7226('0x34')],_0x3cd626[_0x7226('0x30')]);_0x29fee7[_0x7226('0x35')]=_[_0x7226('0x33')](_0x3cd626[_0x7226('0x34')],qs[_0x7226('0x36')](_0x47dd7f['query'][_0x7226('0x36')]));_0x29fee7[_0x7226('0x35')]=_0x29fee7[_0x7226('0x35')][_0x7226('0x44')]?_0x29fee7['attributes']:_0x3cd626['model'];if(_0x47dd7f[_0x7226('0x30')][_0x7226('0x45')]){_0x29fee7['include']=[{'all':!![]}];}_0x29fee7=_[_0x7226('0x46')]({},_0x29fee7,_0x47dd7f[_0x7226('0x3e')]);return db[_0x7226('0x3f')][_0x7226('0x47')](_0x29fee7)[_0x7226('0x24')](handleEntityNotFound(_0x15ef8f,null))[_0x7226('0x24')](respondWithResult(_0x15ef8f,null))[_0x7226('0x43')](handleError(_0x15ef8f,null));};exports['create']=function(_0x3ce400,_0x43fc5c){return db['ServicenowAccount'][_0x7226('0x48')](_0x3ce400[_0x7226('0x49')],{})[_0x7226('0x24')](respondWithResult(_0x43fc5c,0xc9))['catch'](handleError(_0x43fc5c,null));};exports[_0x7226('0x4a')]=function(_0x4d6a27,_0x5ee030){if(_0x4d6a27[_0x7226('0x49')]['id']){delete _0x4d6a27['body']['id'];}return db[_0x7226('0x3f')][_0x7226('0x47')]({'where':{'id':_0x4d6a27[_0x7226('0x4b')]['id']}})[_0x7226('0x24')](handleEntityNotFound(_0x5ee030,null))[_0x7226('0x24')](saveUpdates(_0x4d6a27[_0x7226('0x49')],null))['then'](respondWithResult(_0x5ee030,null))[_0x7226('0x43')](handleError(_0x5ee030,null));};exports[_0x7226('0x25')]=function(_0x54290d,_0x2c2d64){return db[_0x7226('0x3f')]['find']({'where':{'id':_0x54290d[_0x7226('0x4b')]['id']}})[_0x7226('0x24')](handleEntityNotFound(_0x2c2d64,null))[_0x7226('0x24')](removeEntity(_0x2c2d64,null))[_0x7226('0x43')](handleError(_0x2c2d64,null));};exports[_0x7226('0x4c')]=function(_0x72be7a,_0x1786f6,_0x9e3eca){var _0x5746b0={};var _0x2fc075={};var _0x51a6fb;var _0x281530;return db['ServicenowAccount']['findOne']({'where':{'id':_0x72be7a[_0x7226('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1786f6,null))['then'](function(_0x4f2b34){if(_0x4f2b34){_0x51a6fb=_0x4f2b34;_0x2fc075[_0x7226('0x34')]=_[_0x7226('0x31')](db['ServicenowConfiguration'][_0x7226('0x2c')]);_0x2fc075[_0x7226('0x30')]=_[_0x7226('0x31')](_0x72be7a[_0x7226('0x30')]);_0x2fc075[_0x7226('0x32')]=_[_0x7226('0x33')](_0x2fc075[_0x7226('0x34')],_0x2fc075[_0x7226('0x30')]);_0x5746b0[_0x7226('0x35')]=_[_0x7226('0x33')](_0x2fc075['model'],qs[_0x7226('0x36')](_0x72be7a['query'][_0x7226('0x36')]));_0x5746b0[_0x7226('0x35')]=_0x5746b0[_0x7226('0x35')]['length']?_0x5746b0['attributes']:_0x2fc075[_0x7226('0x34')];_0x5746b0[_0x7226('0x39')]=qs[_0x7226('0x3a')](_0x72be7a[_0x7226('0x30')][_0x7226('0x3a')]);_0x5746b0[_0x7226('0x3b')]=qs[_0x7226('0x32')](_['pick'](_0x72be7a[_0x7226('0x30')],_0x2fc075[_0x7226('0x32')]));if(_0x72be7a[_0x7226('0x30')][_0x7226('0x4d')]){_0x5746b0['where']=_['merge'](_0x5746b0['where'],{'$or':_['map'](_0x5746b0[_0x7226('0x35')],function(_0x1f4082){var _0x55d09e={};_0x55d09e[_0x1f4082]={'$like':'%'+_0x72be7a['query'][_0x7226('0x4d')]+'%'};return _0x55d09e;})});}_0x5746b0=_[_0x7226('0x46')]({},_0x5746b0,_0x72be7a[_0x7226('0x3e')]);return _0x51a6fb[_0x7226('0x4c')](_0x5746b0);}})[_0x7226('0x24')](function(_0x1feb58){if(_0x1feb58){_0x281530=_0x1feb58[_0x7226('0x44')];if(!_0x72be7a[_0x7226('0x30')][_0x7226('0x37')](_0x7226('0x38'))){_0x5746b0[_0x7226('0x1c')]=qs['limit'](_0x72be7a['query'][_0x7226('0x1c')]);_0x5746b0[_0x7226('0x1b')]=qs[_0x7226('0x1b')](_0x72be7a[_0x7226('0x30')][_0x7226('0x1b')]);}return _0x51a6fb[_0x7226('0x4c')](_0x5746b0);}})[_0x7226('0x24')](function(_0x4305d1){if(_0x4305d1){return _0x4305d1?{'count':_0x281530,'rows':_0x4305d1}:null;}})[_0x7226('0x24')](respondWithResult(_0x1786f6,null))['catch'](handleError(_0x1786f6,null));};exports[_0x7226('0x4e')]=function(_0x1a3dbe,_0x440507,_0x1174c2){if(_0x1a3dbe['body']['id']){delete _0x1a3dbe['body']['id'];}return db['ServicenowAccount'][_0x7226('0x4f')]({'where':{'id':_0x1a3dbe['params']['id']}})[_0x7226('0x24')](handleEntityNotFound(_0x440507,null))[_0x7226('0x24')](function(_0x5542cc){if(_0x5542cc){_0x1a3dbe[_0x7226('0x49')]['AccountId']=_0x5542cc['id'];_0x1a3dbe[_0x7226('0x49')]['Subjects']=integrations[_0x7226('0x50')](_0x1a3dbe[_0x7226('0x49')][_0x7226('0x51')],_0x1a3dbe[_0x7226('0x49')]['type']);_0x1a3dbe[_0x7226('0x49')][_0x7226('0x52')]=integrations[_0x7226('0x53')](_0x1a3dbe[_0x7226('0x49')][_0x7226('0x51')],_0x1a3dbe[_0x7226('0x49')][_0x7226('0x2e')]);return db[_0x7226('0x54')][_0x7226('0x48')](_0x1a3dbe[_0x7226('0x49')],{'include':[{'model':db['ServicenowField'],'as':_0x7226('0x55')},{'model':db['ServicenowField'],'as':_0x7226('0x52')}]});}return null;})[_0x7226('0x24')](respondWithResult(_0x440507,null))[_0x7226('0x43')](handleError(_0x440507,null));};exports[_0x7226('0x56')]=function(_0x595495,_0x3710bc,_0x39f6a2){var _0x50e20f=[_0x7226('0x57'),_0x7226('0x58'),_0x7226('0x59'),_0x7226('0x5a'),'close_code','notify',_0x7226('0x5b'),_0x7226('0x5c'),_0x7226('0x5d')];var _0x5d2ea3=['parent',_0x7226('0x57'),'caused_by',_0x7226('0x5e'),_0x7226('0x5f'),_0x7226('0x60'),_0x7226('0x61'),_0x7226('0x58'),_0x7226('0x62'),'number',_0x7226('0x63'),_0x7226('0x64'),_0x7226('0x65'),_0x7226('0x66'),_0x7226('0x67'),'sys_domain',_0x7226('0x68'),_0x7226('0x69'),'knowledge','order',_0x7226('0x6a'),_0x7226('0x6b'),_0x7226('0x6c'),'delivery_plan',_0x7226('0x6d'),_0x7226('0x6e'),_0x7226('0x6f'),_0x7226('0x70'),_0x7226('0x71'),_0x7226('0x72'),_0x7226('0x73'),'time_worked',_0x7226('0x74'),'opened_at',_0x7226('0x75'),_0x7226('0x76'),_0x7226('0x77'),_0x7226('0x78'),_0x7226('0x79'),_0x7226('0x7a'),'approval_set',_0x7226('0x5a'),'work_notes','short_description','close_code',_0x7226('0x7b'),_0x7226('0x7c'),'work_start',_0x7226('0x7d'),_0x7226('0x7e'),_0x7226('0x7f'),_0x7226('0x80'),'calendar_duration',_0x7226('0x81'),_0x7226('0x82'),_0x7226('0x83'),_0x7226('0x84'),_0x7226('0x85'),_0x7226('0x86'),_0x7226('0x87'),_0x7226('0x88'),_0x7226('0x89'),_0x7226('0x5b'),'urgency',_0x7226('0x8a'),_0x7226('0x8b'),_0x7226('0x8c'),_0x7226('0x8d'),'assigned_to',_0x7226('0x5c'),_0x7226('0x8e'),_0x7226('0x8f'),_0x7226('0x90'),_0x7226('0x91'),_0x7226('0x92'),'sys_mod_count',_0x7226('0x93'),'sys_tags',_0x7226('0x94'),_0x7226('0x95'),_0x7226('0x96'),'location',_0x7226('0x5d')];var _0x2357e3='';var _0x4fff42='';var _0x459af9=[];var _0x3e8694='';var _0x329481='';var _0x1b080b=[];var _0x370ae8='';var _0x462daa='';var _0x265d2a={};var _0x400f23='';return db[_0x7226('0x3f')][_0x7226('0x4f')]({'where':{'id':_0x595495[_0x7226('0x4b')]['id']},'attributes':['id',_0x7226('0x97'),_0x7226('0x98'),'email','remoteUri',_0x7226('0x99')]})[_0x7226('0x24')](handleEntityNotFound(_0x3710bc,null))[_0x7226('0x24')](function(_0xeba59c){if(_0xeba59c){_0x400f23=_0xeba59c[_0x7226('0x9a')];var _0x24c102=_0x400f23['slice'](-0x1);if(_0x24c102==='/'){_0x400f23=_0x400f23[_0x7226('0x9b')](0x0,_0x400f23['lastIndexOf'](_0x24c102));}_0x462daa=util[_0x7226('0x9c')]('%s/api/now/doc/table/schema/',_0x400f23);_0x370ae8=util[_0x7226('0x9c')](_0x7226('0x9d'),_0x400f23);_0x265d2a={'user':_0xeba59c[_0x7226('0x97')],'pass':_0xeba59c[_0x7226('0x98')]};var _0x58e636={'method':'GET','uri':_0x462daa+'incident?sysparm_display_value=all','auth':_0x265d2a,'json':!![]};return rp(_0x58e636);}})[_0x7226('0x24')](function(_0x7e4b6f){if(_0x7e4b6f[_0x7226('0x9e')][_0x7226('0x44')]>0x0){_0x2357e3=_0x7e4b6f[_0x7226('0x9e')];}console[_0x7226('0x9f')](_0x7226('0xa0'),_0x2357e3);_0x1b080b=[];_0x4fff42=Object[_0x7226('0xa1')]([],_0x2357e3);_[_0x7226('0xa2')](_0x4fff42,function(_0x22efea){return!_0x50e20f[_0x7226('0xa3')](_0x22efea['name']);});_0x4fff42[_0x7226('0xa4')](function(_0x13a7a1){var _0x57d1b3=createFieldObject(_0x370ae8,_0x265d2a,_0x13a7a1['internalType'],_0x13a7a1[_0x7226('0x29')],_0x13a7a1[_0x7226('0xa5')],![]);_0x1b080b[_0x7226('0xa6')](_0x57d1b3);});return Promise[_0x7226('0xa7')](_0x1b080b);})[_0x7226('0x24')](function(_0x35fb6a){_0x459af9=_0x35fb6a;_0x3e8694=Object[_0x7226('0xa1')]([],_0x2357e3);console[_0x7226('0x9f')](_0x7226('0xa8'),_0x2357e3);_[_0x7226('0xa2')](_0x3e8694,function(_0x25ec70){return _0x5d2ea3[_0x7226('0xa3')](_0x25ec70[_0x7226('0x29')]);});console[_0x7226('0x9f')](_0x7226('0xa9'),_0x3e8694);_0x1b080b=[];_0x3e8694[_0x7226('0xa4')](function(_0xba26da){var _0x317e72=createFieldObject(_0x370ae8,_0x265d2a,_0xba26da[_0x7226('0xaa')],_0xba26da['name'],_0xba26da['label'],!![]);_0x1b080b[_0x7226('0xa6')](_0x317e72);});return Promise['all'](_0x1b080b);})[_0x7226('0x24')](function(_0x54ceb8){_0x329481=_0x54ceb8;var _0xcb43c5=_0x459af9['concat'](_0x329481);return{'count':_0xcb43c5[_0x7226('0x44')],'rows':_0xcb43c5};})[_0x7226('0x24')](respondWithResult(_0x3710bc,null))[_0x7226('0x43')](function(_0x3ec4fb){console[_0x7226('0x9f')](_0x7226('0xab')+_0x3ec4fb);var _0xff0235=_0x595495['query']['test']?0x1f4:_0x3ec4fb[_0x7226('0xac')]||0x1f4;logger['error'](_0x3ec4fb[_0x7226('0x28')]);delete _0x3ec4fb[_0x7226('0x29')];if(_0xff0235===0x191){_0xff0235=0x190;}_0x3710bc['status'](_0xff0235)[_0x7226('0xad')](_0x595495[_0x7226('0x30')][_0x7226('0xae')]?{'message':_0x7226('0xaf'),'statusCode':_0x3ec4fb[_0x7226('0xac')]}:_0x3ec4fb);});};function createFieldObject(_0x3a5d70,_0x307b52,_0x2a9b2d,_0x5824e9,_0x2a95bf,_0x413a87){return new Promise(function(_0x3901b2,_0x24fc79){var _0x44547e={'id':_0x5824e9,'name':_0x2a95bf,'custom':_0x413a87};if(_0x2a9b2d==='boolean'){_0x44547e[_0x7226('0x3e')]=[{'name':'True','value':_0x7226('0xb0')},{'name':_0x7226('0xb1'),'value':_0x7226('0xb2')}];_0x3901b2(_0x44547e);}else{var _0x37827c={'method':_0x7226('0xb3'),'uri':_0x3a5d70+_0x7226('0xb4')+_0x5824e9,'auth':_0x307b52,'json':!![]};return rp(_0x37827c)[_0x7226('0x24')](function(_0x2efef8){var _0x51061f=[];if(_0x2efef8['result'][_0x7226('0x44')]>0x0){_0x2efef8[_0x7226('0x9e')][_0x7226('0xa4')](function(_0x314b8e){if(_0x314b8e[_0x7226('0xb5')]===_0x7226('0xb2')){var _0x5130ef={'name':_0x314b8e[_0x7226('0xa5')],'value':_0x314b8e[_0x7226('0xb6')]};_0x51061f['push'](_0x5130ef);}});}_0x44547e[_0x7226('0x3e')]=_0x51061f;if(_0x44547e[_0x7226('0x3e')][_0x7226('0x44')]>0x0){_0x3901b2(_0x44547e);}else{if(_0x413a87==![]){_0x3901b2();}else{_0x3901b2(_0x44547e);}}});}});} \ No newline at end of file +var _0x54ae=['getConfigurations','findOne','ServicenowConfiguration','options','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','sys_updated_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','priority','rfc','expected_start','opened_at','business_duration','group_list','reopened_time','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','remove','includes','forEach','internalType','push','assign','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','then','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','includeAll','catch','params','include','find','create','body','destroy'];(function(_0x7d2daa,_0x5e7cf2){var _0x56d6b9=function(_0x53217f){while(--_0x53217f){_0x7d2daa['push'](_0x7d2daa['shift']());}};_0x56d6b9(++_0x5e7cf2);}(_0x54ae,0x12e));var _0xe54a=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0x54ae[_0x402c8f];return _0x11e809;};'use strict';var emlformat=require(_0xe54a('0x0'));var rimraf=require(_0xe54a('0x1'));var zipdir=require(_0xe54a('0x2'));var jsonpatch=require(_0xe54a('0x3'));var rp=require(_0xe54a('0x4'));var moment=require(_0xe54a('0x5'));var BPromise=require(_0xe54a('0x6'));var Mustache=require(_0xe54a('0x7'));var util=require(_0xe54a('0x8'));var path=require('path');var sox=require(_0xe54a('0x9'));var csv=require(_0xe54a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe54a('0xb'));var _=require(_0xe54a('0xc'));var squel=require(_0xe54a('0xd'));var crypto=require(_0xe54a('0xe'));var jsforce=require(_0xe54a('0xf'));var deskjs=require(_0xe54a('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe54a('0x11'));var Redis=require(_0xe54a('0x12'));var authService=require(_0xe54a('0x13'));var qs=require(_0xe54a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe54a('0x15'));var logger=require(_0xe54a('0x16'))('api');var utils=require(_0xe54a('0x17'));var config=require(_0xe54a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xe54a('0x19'));function respondWithStatusCode(_0x4356b9,_0x4b9f85){_0x4b9f85=_0x4b9f85||0xcc;return function(_0x2031bd){if(_0x2031bd){return _0x4356b9[_0xe54a('0x1a')](_0x4b9f85);}return _0x4356b9[_0xe54a('0x1b')](_0x4b9f85)['end']();};}function respondWithResult(_0x1bd952,_0x4f9502){_0x4f9502=_0x4f9502||0xc8;return function(_0x419ca4){if(_0x419ca4){return _0x1bd952[_0xe54a('0x1b')](_0x4f9502)[_0xe54a('0x1c')](_0x419ca4);}};}function respondWithFilteredResult(_0x190f17,_0x5018d5){return function(_0x4fa106){if(_0x4fa106){var _0x1e73c9=typeof _0x5018d5[_0xe54a('0x1d')]==='undefined'&&typeof _0x5018d5[_0xe54a('0x1e')]==='undefined';var _0xab004d=_0x4fa106[_0xe54a('0x1f')];var _0x58e52d=_0x1e73c9?0x0:_0x5018d5[_0xe54a('0x1d')];var _0x262fa4=_0x1e73c9?_0x4fa106[_0xe54a('0x1f')]:_0x5018d5['offset']+_0x5018d5[_0xe54a('0x1e')];var _0x1531ad;if(_0x262fa4>=_0xab004d){_0x262fa4=_0xab004d;_0x1531ad=0xc8;}else{_0x1531ad=0xce;}_0x190f17['status'](_0x1531ad);return _0x190f17[_0xe54a('0x20')]('Content-Range',_0x58e52d+'-'+_0x262fa4+'/'+_0xab004d)[_0xe54a('0x1c')](_0x4fa106);}return null;};}function patchUpdates(_0x1c4939){return function(_0x47bef6){try{jsonpatch[_0xe54a('0x21')](_0x47bef6,_0x1c4939,!![]);}catch(_0x54bf3a){return BPromise[_0xe54a('0x22')](_0x54bf3a);}return _0x47bef6[_0xe54a('0x23')]();};}function saveUpdates(_0x2f6d4b,_0x784cd7){return function(_0x5e1b42){if(_0x5e1b42){return _0x5e1b42[_0xe54a('0x24')](_0x2f6d4b)[_0xe54a('0x25')](function(_0x179e36){return _0x179e36;});}return null;};}function removeEntity(_0x3b71d6,_0x89477f){return function(_0xf4b8eb){if(_0xf4b8eb){return _0xf4b8eb['destroy']()[_0xe54a('0x25')](function(){_0x3b71d6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8c35,_0x102d2a){return function(_0x3068e8){if(!_0x3068e8){_0x5e8c35[_0xe54a('0x1a')](0x194);}return _0x3068e8;};}function handleError(_0x144d36,_0x2c9f2e){_0x2c9f2e=_0x2c9f2e||0x1f4;return function(_0x42755b){logger['error'](_0x42755b[_0xe54a('0x26')]);if(_0x42755b[_0xe54a('0x27')]){delete _0x42755b['name'];}_0x144d36['status'](_0x2c9f2e)[_0xe54a('0x28')](_0x42755b);};}exports['index']=function(_0x5a16bb,_0x1bb772){var _0x48b1a0={},_0x505163={},_0x26aad9={'count':0x0,'rows':[]};var _0xbb8091=_[_0xe54a('0x29')](db[_0xe54a('0x2a')][_0xe54a('0x2b')],function(_0x28f889){return{'name':_0x28f889[_0xe54a('0x2c')],'type':_0x28f889['type'][_0xe54a('0x2d')]};});_0x505163[_0xe54a('0x2e')]=_[_0xe54a('0x29')](_0xbb8091,_0xe54a('0x27'));_0x505163[_0xe54a('0x2f')]=_[_0xe54a('0x30')](_0x5a16bb[_0xe54a('0x2f')]);_0x505163['filters']=_[_0xe54a('0x31')](_0x505163[_0xe54a('0x2e')],_0x505163[_0xe54a('0x2f')]);_0x48b1a0[_0xe54a('0x32')]=_[_0xe54a('0x31')](_0x505163[_0xe54a('0x2e')],qs[_0xe54a('0x33')](_0x5a16bb['query'][_0xe54a('0x33')]));_0x48b1a0[_0xe54a('0x32')]=_0x48b1a0[_0xe54a('0x32')][_0xe54a('0x34')]?_0x48b1a0[_0xe54a('0x32')]:_0x505163[_0xe54a('0x2e')];if(!_0x5a16bb['query'][_0xe54a('0x35')](_0xe54a('0x36'))){_0x48b1a0['limit']=qs['limit'](_0x5a16bb[_0xe54a('0x2f')]['limit']);_0x48b1a0['offset']=qs[_0xe54a('0x1d')](_0x5a16bb[_0xe54a('0x2f')][_0xe54a('0x1d')]);}_0x48b1a0[_0xe54a('0x37')]=qs['sort'](_0x5a16bb[_0xe54a('0x2f')][_0xe54a('0x38')]);_0x48b1a0['where']=qs[_0xe54a('0x39')](_[_0xe54a('0x3a')](_0x5a16bb[_0xe54a('0x2f')],_0x505163['filters']),_0xbb8091);if(_0x5a16bb[_0xe54a('0x2f')][_0xe54a('0x3b')]){_0x48b1a0[_0xe54a('0x3c')]=_['merge'](_0x48b1a0[_0xe54a('0x3c')],{'$or':_[_0xe54a('0x29')](_0xbb8091,function(_0x12c62e){if(_0x12c62e[_0xe54a('0x3d')]!==_0xe54a('0x3e')){var _0x1c5b95={};_0x1c5b95[_0x12c62e[_0xe54a('0x27')]]={'$like':'%'+_0x5a16bb[_0xe54a('0x2f')][_0xe54a('0x3b')]+'%'};return _0x1c5b95;}})});}_0x48b1a0=_[_0xe54a('0x3f')]({},_0x48b1a0,_0x5a16bb['options']);var _0x46f05a={'where':_0x48b1a0['where']};return db[_0xe54a('0x2a')][_0xe54a('0x1f')](_0x46f05a)[_0xe54a('0x25')](function(_0x244555){_0x26aad9['count']=_0x244555;if(_0x5a16bb[_0xe54a('0x2f')][_0xe54a('0x40')]){_0x48b1a0['include']=[{'all':!![]}];}return db[_0xe54a('0x2a')]['findAll'](_0x48b1a0);})['then'](function(_0x2384a8){_0x26aad9['rows']=_0x2384a8;return _0x26aad9;})['then'](respondWithFilteredResult(_0x1bb772,_0x48b1a0))[_0xe54a('0x41')](handleError(_0x1bb772,null));};exports['show']=function(_0x4dbeb1,_0x4b9ada){var _0x55d7a1={'raw':![],'where':{'id':_0x4dbeb1[_0xe54a('0x42')]['id']}},_0x41d881={};_0x41d881['model']=_[_0xe54a('0x30')](db['ServicenowAccount'][_0xe54a('0x2b')]);_0x41d881[_0xe54a('0x2f')]=_['keys'](_0x4dbeb1[_0xe54a('0x2f')]);_0x41d881[_0xe54a('0x39')]=_[_0xe54a('0x31')](_0x41d881['model'],_0x41d881[_0xe54a('0x2f')]);_0x55d7a1[_0xe54a('0x32')]=_[_0xe54a('0x31')](_0x41d881['model'],qs[_0xe54a('0x33')](_0x4dbeb1[_0xe54a('0x2f')][_0xe54a('0x33')]));_0x55d7a1['attributes']=_0x55d7a1[_0xe54a('0x32')][_0xe54a('0x34')]?_0x55d7a1[_0xe54a('0x32')]:_0x41d881[_0xe54a('0x2e')];if(_0x4dbeb1['query'][_0xe54a('0x40')]){_0x55d7a1[_0xe54a('0x43')]=[{'all':!![]}];}_0x55d7a1=_[_0xe54a('0x3f')]({},_0x55d7a1,_0x4dbeb1['options']);return db['ServicenowAccount'][_0xe54a('0x44')](_0x55d7a1)[_0xe54a('0x25')](handleEntityNotFound(_0x4b9ada,null))[_0xe54a('0x25')](respondWithResult(_0x4b9ada,null))['catch'](handleError(_0x4b9ada,null));};exports[_0xe54a('0x45')]=function(_0x382e0c,_0x2d3ee4){return db[_0xe54a('0x2a')][_0xe54a('0x45')](_0x382e0c['body'],{})[_0xe54a('0x25')](respondWithResult(_0x2d3ee4,0xc9))[_0xe54a('0x41')](handleError(_0x2d3ee4,null));};exports[_0xe54a('0x24')]=function(_0x44b07e,_0x321da5){if(_0x44b07e[_0xe54a('0x46')]['id']){delete _0x44b07e[_0xe54a('0x46')]['id'];}return db[_0xe54a('0x2a')][_0xe54a('0x44')]({'where':{'id':_0x44b07e[_0xe54a('0x42')]['id']}})[_0xe54a('0x25')](handleEntityNotFound(_0x321da5,null))[_0xe54a('0x25')](saveUpdates(_0x44b07e['body'],null))['then'](respondWithResult(_0x321da5,null))['catch'](handleError(_0x321da5,null));};exports[_0xe54a('0x47')]=function(_0x528d4,_0x5a503d){return db[_0xe54a('0x2a')][_0xe54a('0x44')]({'where':{'id':_0x528d4[_0xe54a('0x42')]['id']}})[_0xe54a('0x25')](handleEntityNotFound(_0x5a503d,null))['then'](removeEntity(_0x5a503d,null))['catch'](handleError(_0x5a503d,null));};exports[_0xe54a('0x48')]=function(_0x498702,_0x563631,_0x2a1077){var _0x4544e2={};var _0x4d7c06={};var _0x32d8d0;var _0x2d0228;return db['ServicenowAccount'][_0xe54a('0x49')]({'where':{'id':_0x498702[_0xe54a('0x42')]['id']}})[_0xe54a('0x25')](handleEntityNotFound(_0x563631,null))['then'](function(_0x1043a0){if(_0x1043a0){_0x32d8d0=_0x1043a0;_0x4d7c06['model']=_[_0xe54a('0x30')](db[_0xe54a('0x4a')][_0xe54a('0x2b')]);_0x4d7c06[_0xe54a('0x2f')]=_[_0xe54a('0x30')](_0x498702['query']);_0x4d7c06[_0xe54a('0x39')]=_[_0xe54a('0x31')](_0x4d7c06[_0xe54a('0x2e')],_0x4d7c06[_0xe54a('0x2f')]);_0x4544e2[_0xe54a('0x32')]=_['intersection'](_0x4d7c06[_0xe54a('0x2e')],qs[_0xe54a('0x33')](_0x498702[_0xe54a('0x2f')][_0xe54a('0x33')]));_0x4544e2[_0xe54a('0x32')]=_0x4544e2[_0xe54a('0x32')]['length']?_0x4544e2[_0xe54a('0x32')]:_0x4d7c06['model'];_0x4544e2[_0xe54a('0x37')]=qs[_0xe54a('0x38')](_0x498702['query'][_0xe54a('0x38')]);_0x4544e2[_0xe54a('0x3c')]=qs['filters'](_['pick'](_0x498702[_0xe54a('0x2f')],_0x4d7c06[_0xe54a('0x39')]));if(_0x498702['query'][_0xe54a('0x3b')]){_0x4544e2[_0xe54a('0x3c')]=_[_0xe54a('0x3f')](_0x4544e2[_0xe54a('0x3c')],{'$or':_['map'](_0x4544e2[_0xe54a('0x32')],function(_0x5685a1){var _0x546a6d={};_0x546a6d[_0x5685a1]={'$like':'%'+_0x498702[_0xe54a('0x2f')][_0xe54a('0x3b')]+'%'};return _0x546a6d;})});}_0x4544e2=_[_0xe54a('0x3f')]({},_0x4544e2,_0x498702[_0xe54a('0x4b')]);return _0x32d8d0['getConfigurations'](_0x4544e2);}})['then'](function(_0x1cef6b){if(_0x1cef6b){_0x2d0228=_0x1cef6b[_0xe54a('0x34')];if(!_0x498702[_0xe54a('0x2f')][_0xe54a('0x35')](_0xe54a('0x36'))){_0x4544e2[_0xe54a('0x1e')]=qs[_0xe54a('0x1e')](_0x498702['query'][_0xe54a('0x1e')]);_0x4544e2['offset']=qs['offset'](_0x498702[_0xe54a('0x2f')][_0xe54a('0x1d')]);}return _0x32d8d0['getConfigurations'](_0x4544e2);}})['then'](function(_0x555694){if(_0x555694){return _0x555694?{'count':_0x2d0228,'rows':_0x555694}:null;}})[_0xe54a('0x25')](respondWithResult(_0x563631,null))[_0xe54a('0x41')](handleError(_0x563631,null));};exports[_0xe54a('0x4c')]=function(_0x29b884,_0xb2f54d,_0x58c799){if(_0x29b884[_0xe54a('0x46')]['id']){delete _0x29b884[_0xe54a('0x46')]['id'];}return db[_0xe54a('0x2a')][_0xe54a('0x49')]({'where':{'id':_0x29b884[_0xe54a('0x42')]['id']}})['then'](handleEntityNotFound(_0xb2f54d,null))[_0xe54a('0x25')](function(_0x2e17f5){if(_0x2e17f5){_0x29b884['body']['AccountId']=_0x2e17f5['id'];_0x29b884['body'][_0xe54a('0x4d')]=integrations['getSubjects'](_0x29b884[_0xe54a('0x46')][_0xe54a('0x4e')],_0x29b884[_0xe54a('0x46')][_0xe54a('0x3d')]);_0x29b884[_0xe54a('0x46')][_0xe54a('0x4f')]=integrations[_0xe54a('0x50')](_0x29b884[_0xe54a('0x46')][_0xe54a('0x4e')],_0x29b884[_0xe54a('0x46')][_0xe54a('0x3d')]);return db[_0xe54a('0x4a')]['create'](_0x29b884[_0xe54a('0x46')],{'include':[{'model':db[_0xe54a('0x51')],'as':'Subjects'},{'model':db[_0xe54a('0x51')],'as':_0xe54a('0x4f')}]});}return null;})[_0xe54a('0x25')](respondWithResult(_0xb2f54d,null))['catch'](handleError(_0xb2f54d,null));};exports[_0xe54a('0x52')]=function(_0x2b1301,_0x3bbd23,_0x2cf93f){var _0x30f9a9=[_0xe54a('0x53'),'hold_reason',_0xe54a('0x54'),'subcategory','close_code',_0xe54a('0x55'),_0xe54a('0x56'),_0xe54a('0x57'),_0xe54a('0x58')];var _0x3c7eac=[_0xe54a('0x59'),_0xe54a('0x53'),_0xe54a('0x5a'),_0xe54a('0x5b'),_0xe54a('0x5c'),_0xe54a('0x5d'),_0xe54a('0x5e'),_0xe54a('0x5f'),_0xe54a('0x60'),_0xe54a('0x61'),'resolved_by',_0xe54a('0x62'),'opened_by',_0xe54a('0x63'),_0xe54a('0x64'),'sys_domain',_0xe54a('0x65'),_0xe54a('0x66'),'knowledge',_0xe54a('0x37'),_0xe54a('0x67'),_0xe54a('0x68'),_0xe54a('0x69'),_0xe54a('0x6a'),_0xe54a('0x6b'),_0xe54a('0x6c'),'work_notes_list','business_service',_0xe54a('0x6d'),'sys_domain_path',_0xe54a('0x6e'),'time_worked',_0xe54a('0x6f'),_0xe54a('0x70'),_0xe54a('0x71'),_0xe54a('0x72'),'work_end',_0xe54a('0x73'),'resolved_at',_0xe54a('0x74'),_0xe54a('0x75'),_0xe54a('0x76'),_0xe54a('0x77'),_0xe54a('0x78'),'close_code',_0xe54a('0x79'),_0xe54a('0x7a'),_0xe54a('0x7b'),'assignment_group','business_stc','additional_assignee_list',_0xe54a('0x7c'),_0xe54a('0x7d'),'notify',_0xe54a('0x7e'),_0xe54a('0x7f'),_0xe54a('0x80'),'follow_up',_0xe54a('0x81'),_0xe54a('0x82'),_0xe54a('0x83'),_0xe54a('0x84'),_0xe54a('0x56'),_0xe54a('0x85'),_0xe54a('0x86'),_0xe54a('0x87'),_0xe54a('0x88'),_0xe54a('0x89'),_0xe54a('0x8a'),_0xe54a('0x57'),_0xe54a('0x8b'),'sla_due','approval',_0xe54a('0x8c'),_0xe54a('0x8d'),_0xe54a('0x8e'),_0xe54a('0x8f'),_0xe54a('0x90'),_0xe54a('0x91'),_0xe54a('0x92'),_0xe54a('0x93'),_0xe54a('0x94'),'category'];var _0x569543='';var _0x49e2f1='';var _0x2ddf69=[];var _0x49aade='';var _0x3ad182='';var _0x3d4e86=[];var _0x1c6b8e='';var _0x2d05c2='';var _0x5ac14e={};var _0x4279e5='';return db[_0xe54a('0x2a')][_0xe54a('0x49')]({'where':{'id':_0x2b1301[_0xe54a('0x42')]['id']},'attributes':['id',_0xe54a('0x95'),_0xe54a('0x96'),_0xe54a('0x97'),_0xe54a('0x98'),'serverUrl']})[_0xe54a('0x25')](handleEntityNotFound(_0x3bbd23,null))['then'](function(_0x461a10){if(_0x461a10){_0x4279e5=_0x461a10['remoteUri'];var _0x155994=_0x4279e5[_0xe54a('0x99')](-0x1);if(_0x155994==='/'){_0x4279e5=_0x4279e5[_0xe54a('0x9a')](0x0,_0x4279e5[_0xe54a('0x9b')](_0x155994));}_0x2d05c2=util[_0xe54a('0x9c')](_0xe54a('0x9d'),_0x4279e5);_0x1c6b8e=util['format'](_0xe54a('0x9e'),_0x4279e5);_0x5ac14e={'user':_0x461a10[_0xe54a('0x95')],'pass':_0x461a10[_0xe54a('0x96')]};var _0x2cb7ed={'method':_0xe54a('0x9f'),'uri':_0x2d05c2+_0xe54a('0xa0'),'auth':_0x5ac14e,'json':!![]};return rp(_0x2cb7ed);}})[_0xe54a('0x25')](function(_0x29275c){if(_0x29275c[_0xe54a('0xa1')]['length']>0x0){_0x569543=_0x29275c['result'];}console['log'](_0xe54a('0xa2'),_0x569543);_0x3d4e86=[];_0x49e2f1=Object['assign']([],_0x569543);_[_0xe54a('0xa3')](_0x49e2f1,function(_0x1857ed){return!_0x30f9a9[_0xe54a('0xa4')](_0x1857ed[_0xe54a('0x27')]);});_0x49e2f1[_0xe54a('0xa5')](function(_0x2ee7c5){var _0x1820d7=createFieldObject(_0x1c6b8e,_0x5ac14e,_0x2ee7c5[_0xe54a('0xa6')],_0x2ee7c5[_0xe54a('0x27')],_0x2ee7c5['label'],![]);_0x3d4e86[_0xe54a('0xa7')](_0x1820d7);});return Promise['all'](_0x3d4e86);})[_0xe54a('0x25')](function(_0x4ff87e){_0x2ddf69=_0x4ff87e;_0x49aade=Object[_0xe54a('0xa8')]([],_0x569543);console[_0xe54a('0xa9')](_0xe54a('0xaa'),_0x569543);_[_0xe54a('0xa3')](_0x49aade,function(_0xcd2f46){return _0x3c7eac[_0xe54a('0xa4')](_0xcd2f46[_0xe54a('0x27')]);});console[_0xe54a('0xa9')](_0xe54a('0xab'),_0x49aade);_0x3d4e86=[];_0x49aade[_0xe54a('0xa5')](function(_0x4a446c){var _0x89f5c5=createFieldObject(_0x1c6b8e,_0x5ac14e,_0x4a446c[_0xe54a('0xa6')],_0x4a446c[_0xe54a('0x27')],_0x4a446c['label'],!![]);_0x3d4e86['push'](_0x89f5c5);});return Promise[_0xe54a('0xac')](_0x3d4e86);})['then'](function(_0x234931){_0x3ad182=_0x234931;var _0x20780b=_0x2ddf69[_0xe54a('0xad')](_0x3ad182);return{'count':_0x20780b[_0xe54a('0x34')],'rows':_0x20780b};})[_0xe54a('0x25')](respondWithResult(_0x3bbd23,null))['catch'](function(_0x189b0d){console[_0xe54a('0xa9')](_0xe54a('0xae')+_0x189b0d);var _0x13f3af=_0x2b1301['query'][_0xe54a('0xaf')]?0x1f4:_0x189b0d[_0xe54a('0xb0')]||0x1f4;logger[_0xe54a('0xb1')](_0x189b0d[_0xe54a('0x26')]);delete _0x189b0d[_0xe54a('0x27')];if(_0x13f3af===0x191){_0x13f3af=0x190;}_0x3bbd23[_0xe54a('0x1b')](_0x13f3af)[_0xe54a('0x28')](_0x2b1301[_0xe54a('0x2f')]['test']?{'message':_0xe54a('0xb2'),'statusCode':_0x189b0d[_0xe54a('0xb0')]}:_0x189b0d);});};function createFieldObject(_0x4cee37,_0x35718f,_0x1ca870,_0x5009c6,_0x541976,_0x34f7c0){return new Promise(function(_0x1aed7a,_0x438776){var _0x24186c={'id':_0x5009c6,'name':_0x541976,'custom':_0x34f7c0};if(_0x1ca870===_0xe54a('0xb3')){_0x24186c[_0xe54a('0x4b')]=[{'name':_0xe54a('0xb4'),'value':_0xe54a('0xb5')},{'name':_0xe54a('0xb6'),'value':_0xe54a('0xb7')}];_0x1aed7a(_0x24186c);}else{var _0x2783e6={'method':_0xe54a('0x9f'),'uri':_0x4cee37+_0xe54a('0xb8')+_0x5009c6,'auth':_0x35718f,'json':!![]};return rp(_0x2783e6)[_0xe54a('0x25')](function(_0x18e994){var _0x1b6f7c=[];if(_0x18e994[_0xe54a('0xa1')][_0xe54a('0x34')]>0x0){_0x18e994[_0xe54a('0xa1')][_0xe54a('0xa5')](function(_0x23dd72){if(_0x23dd72[_0xe54a('0xb9')]===_0xe54a('0xb7')){var _0x30afbf={'name':_0x23dd72['label'],'value':_0x23dd72[_0xe54a('0xba')]};_0x1b6f7c[_0xe54a('0xa7')](_0x30afbf);}});}_0x24186c[_0xe54a('0x4b')]=_0x1b6f7c;if(_0x24186c[_0xe54a('0x4b')]['length']>0x0){_0x1aed7a(_0x24186c);}else{if(_0x34f7c0==![]){_0x1aed7a();}else{_0x1aed7a(_0x24186c);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 70c174e..e34ce26 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 _0xe14b=['bluebird','path','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','moment'];(function(_0x4d2ce0,_0x5ce71a){var _0x545231=function(_0x56a932){while(--_0x56a932){_0x4d2ce0['push'](_0x4d2ce0['shift']());}};_0x545231(++_0x5ce71a);}(_0xe14b,0x93));var _0xbe14=function(_0x12df14,_0x3fdc62){_0x12df14=_0x12df14-0x0;var _0x5d62b2=_0xe14b[_0x12df14];return _0x5d62b2;};'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'));var integrations=require(_0xbe14('0x6'));module[_0xbe14('0x7')]=function(_0x1ff100,_0x1d9ade){return _0x1ff100[_0xbe14('0x8')](_0xbe14('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd8=['bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0x6bf368,_0x4154d6){var _0xea07a0=function(_0x577aea){while(--_0x577aea){_0x6bf368['push'](_0x6bf368['shift']());}};_0xea07a0(++_0x4154d6);}(_0x2bd8,0x130));var _0x82bd=function(_0x361745,_0x4901e1){_0x361745=_0x361745-0x0;var _0x3e48c4=_0x2bd8[_0x361745];return _0x3e48c4;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));var integrations=require(_0x82bd('0x9'));module[_0x82bd('0xa')]=function(_0x5ceb60,_0x19dbb1){return _0x5ceb60[_0x82bd('0xb')](_0x82bd('0xc'),attributes,{'tableName':_0x82bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index e2570d4..264adbe 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 _0xb733=['where','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','attributes','limit','map','model','include','then','GetServicenowAccount','ShowServicenowAccount','find','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb733,0xab));var _0x3b73=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb733[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x3b73('0x0'));var util=require('util');var moment=require(_0x3b73('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b73('0x2'));var db=require(_0x3b73('0x3'))['db'];var utils=require(_0x3b73('0x4'));var logger=require(_0x3b73('0x5'))(_0x3b73('0x6'));var config=require(_0x3b73('0x7'));var jayson=require(_0x3b73('0x8'));var client=jayson['client'][_0x3b73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x718acb,_0x782573,_0x3031a0){return new BPromise(function(_0x4f4a66,_0x228d3c){return client['request'](_0x718acb,_0x3031a0)['then'](function(_0x8ba479){logger[_0x3b73('0xa')](_0x3b73('0xb'),_0x782573,_0x3b73('0xc'));logger[_0x3b73('0xd')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x782573,_0x3b73('0xc'),JSON[_0x3b73('0xe')](_0x8ba479));if(_0x8ba479[_0x3b73('0xf')]){if(_0x8ba479[_0x3b73('0xf')][_0x3b73('0x10')]===0x1f4){logger[_0x3b73('0xf')](_0x3b73('0xb'),_0x782573,_0x8ba479[_0x3b73('0xf')][_0x3b73('0x11')]);return _0x228d3c(_0x8ba479['error'][_0x3b73('0x11')]);}logger[_0x3b73('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x782573,_0x8ba479[_0x3b73('0xf')][_0x3b73('0x11')]);return _0x4f4a66(_0x8ba479[_0x3b73('0xf')][_0x3b73('0x11')]);}else{logger[_0x3b73('0xa')](_0x3b73('0xb'),_0x782573,'request\x20sent');_0x4f4a66(_0x8ba479[_0x3b73('0x12')][_0x3b73('0x11')]);}})[_0x3b73('0x13')](function(_0x3159e5){logger[_0x3b73('0xf')](_0x3b73('0xb'),_0x782573,_0x3159e5);_0x228d3c(_0x3159e5);});});}exports['GetServicenowAccount']=function(_0x3b962c){var _0x4d3580=this;return new Promise(function(_0x4def8a,_0x4cbc7c){return db[_0x3b73('0x14')][_0x3b73('0x15')]({'raw':_0x3b962c[_0x3b73('0x16')]?_0x3b962c[_0x3b73('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3b962c[_0x3b73('0x16')]?_0x3b962c[_0x3b73('0x16')]['where']||null:null,'attributes':_0x3b962c['options']?_0x3b962c['options'][_0x3b73('0x17')]||null:null,'limit':_0x3b962c['options']?_0x3b962c[_0x3b73('0x16')][_0x3b73('0x18')]||null:null,'include':_0x3b962c[_0x3b73('0x16')]?_0x3b962c[_0x3b73('0x16')]['include']?_[_0x3b73('0x19')](_0x3b962c['options']['include'],function(_0x2d4b2d){return{'model':db[_0x2d4b2d[_0x3b73('0x1a')]],'as':_0x2d4b2d['as'],'attributes':_0x2d4b2d[_0x3b73('0x17')],'include':_0x2d4b2d[_0x3b73('0x1b')]?_[_0x3b73('0x19')](_0x2d4b2d[_0x3b73('0x1b')],function(_0x588221){return{'model':db[_0x588221[_0x3b73('0x1a')]],'as':_0x588221['as'],'attributes':_0x588221[_0x3b73('0x17')],'include':_0x588221['include']?_['map'](_0x588221[_0x3b73('0x1b')],function(_0x559da1){return{'model':db[_0x559da1['model']],'as':_0x559da1['as'],'attributes':_0x559da1[_0x3b73('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3b73('0x1c')](function(_0x2e9b85){logger[_0x3b73('0xa')](_0x3b73('0x1d'),_0x3b962c);logger[_0x3b73('0xd')](_0x3b73('0x1d'),_0x3b962c,JSON[_0x3b73('0xe')](_0x2e9b85));_0x4def8a(_0x2e9b85);})[_0x3b73('0x13')](function(_0x56da9e){logger[_0x3b73('0xf')]('GetServicenowAccount',_0x56da9e[_0x3b73('0x11')],_0x3b962c);_0x4cbc7c(_0x4d3580[_0x3b73('0xf')](0x1f4,_0x56da9e[_0x3b73('0x11')]));});});};exports[_0x3b73('0x1e')]=function(_0x3b6531){var _0x537b96=this;return new Promise(function(_0x5b9dd1,_0x39a76e){return db[_0x3b73('0x14')][_0x3b73('0x1f')]({'raw':_0x3b6531[_0x3b73('0x16')]?_0x3b6531[_0x3b73('0x16')][_0x3b73('0x20')]===undefined?!![]:![]:!![],'where':_0x3b6531[_0x3b73('0x16')]?_0x3b6531['options'][_0x3b73('0x21')]||null:null,'attributes':_0x3b6531['options']?_0x3b6531[_0x3b73('0x16')][_0x3b73('0x17')]||null:null,'include':_0x3b6531[_0x3b73('0x16')]?_0x3b6531[_0x3b73('0x16')][_0x3b73('0x1b')]?_['map'](_0x3b6531[_0x3b73('0x16')][_0x3b73('0x1b')],function(_0x34e049){return{'model':db[_0x34e049['model']],'as':_0x34e049['as'],'attributes':_0x34e049[_0x3b73('0x17')],'include':_0x34e049[_0x3b73('0x1b')]?_['map'](_0x34e049[_0x3b73('0x1b')],function(_0x3733bd){return{'model':db[_0x3733bd[_0x3b73('0x1a')]],'as':_0x3733bd['as'],'attributes':_0x3733bd[_0x3b73('0x17')],'include':_0x3733bd[_0x3b73('0x1b')]?_[_0x3b73('0x19')](_0x3733bd[_0x3b73('0x1b')],function(_0x1292f8){return{'model':db[_0x1292f8[_0x3b73('0x1a')]],'as':_0x1292f8['as'],'attributes':_0x1292f8[_0x3b73('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bb690){logger[_0x3b73('0xa')](_0x3b73('0x1e'),_0x3b6531);logger[_0x3b73('0xd')]('ShowServicenowAccount',_0x3b6531,JSON['stringify'](_0x1bb690));_0x5b9dd1(_0x1bb690);})[_0x3b73('0x13')](function(_0x2bf4b0){logger[_0x3b73('0xf')](_0x3b73('0x1e'),_0x2bf4b0[_0x3b73('0x11')],_0x3b6531);_0x39a76e(_0x537b96['error'](0x1f4,_0x2bf4b0[_0x3b73('0x11')]));});});}; \ No newline at end of file +var _0xc9a5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetServicenowAccount','findAll','raw','options','where','limit','include','map','model','attributes','then','ShowServicenowAccount','ServicenowAccount','find','stringify','lodash','moment','ioredis'];(function(_0x501b3c,_0xce4cda){var _0x3eabe9=function(_0x1dee81){while(--_0x1dee81){_0x501b3c['push'](_0x501b3c['shift']());}};_0x3eabe9(++_0xce4cda);}(_0xc9a5,0xac));var _0x5c9a=function(_0x1d1c1a,_0x46c099){_0x1d1c1a=_0x1d1c1a-0x0;var _0x4ea27b=_0xc9a5[_0x1d1c1a];return _0x4ea27b;};'use strict';var _=require(_0x5c9a('0x0'));var util=require('util');var moment=require(_0x5c9a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c9a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c9a('0x3'));var logger=require(_0x5c9a('0x4'))(_0x5c9a('0x5'));var config=require(_0x5c9a('0x6'));var jayson=require(_0x5c9a('0x7'));var client=jayson[_0x5c9a('0x8')][_0x5c9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd0ab94,_0x5c1730,_0x45fd8c){return new BPromise(function(_0x5bf97e,_0x5a4d95){return client[_0x5c9a('0xa')](_0xd0ab94,_0x45fd8c)['then'](function(_0x672a15){logger[_0x5c9a('0xb')](_0x5c9a('0xc'),_0x5c1730,_0x5c9a('0xd'));logger[_0x5c9a('0xe')](_0x5c9a('0xf'),_0x5c1730,_0x5c9a('0xd'),JSON['stringify'](_0x672a15));if(_0x672a15['error']){if(_0x672a15[_0x5c9a('0x10')][_0x5c9a('0x11')]===0x1f4){logger[_0x5c9a('0x10')](_0x5c9a('0xc'),_0x5c1730,_0x672a15[_0x5c9a('0x10')]['message']);return _0x5a4d95(_0x672a15[_0x5c9a('0x10')][_0x5c9a('0x12')]);}logger[_0x5c9a('0x10')](_0x5c9a('0xc'),_0x5c1730,_0x672a15[_0x5c9a('0x10')][_0x5c9a('0x12')]);return _0x5bf97e(_0x672a15[_0x5c9a('0x10')]['message']);}else{logger[_0x5c9a('0xb')](_0x5c9a('0xc'),_0x5c1730,_0x5c9a('0xd'));_0x5bf97e(_0x672a15['result'][_0x5c9a('0x12')]);}})[_0x5c9a('0x13')](function(_0x20bbe6){logger[_0x5c9a('0x10')](_0x5c9a('0xc'),_0x5c1730,_0x20bbe6);_0x5a4d95(_0x20bbe6);});});}exports[_0x5c9a('0x14')]=function(_0x4c6230){var _0x381de1=this;return new Promise(function(_0x31a44f,_0x1298a1){return db['ServicenowAccount'][_0x5c9a('0x15')]({'raw':_0x4c6230['options']?_0x4c6230['options'][_0x5c9a('0x16')]===undefined?!![]:![]:!![],'where':_0x4c6230[_0x5c9a('0x17')]?_0x4c6230[_0x5c9a('0x17')][_0x5c9a('0x18')]||null:null,'attributes':_0x4c6230['options']?_0x4c6230['options']['attributes']||null:null,'limit':_0x4c6230['options']?_0x4c6230[_0x5c9a('0x17')][_0x5c9a('0x19')]||null:null,'include':_0x4c6230[_0x5c9a('0x17')]?_0x4c6230[_0x5c9a('0x17')][_0x5c9a('0x1a')]?_[_0x5c9a('0x1b')](_0x4c6230[_0x5c9a('0x17')][_0x5c9a('0x1a')],function(_0x2d6e36){return{'model':db[_0x2d6e36[_0x5c9a('0x1c')]],'as':_0x2d6e36['as'],'attributes':_0x2d6e36[_0x5c9a('0x1d')],'include':_0x2d6e36[_0x5c9a('0x1a')]?_[_0x5c9a('0x1b')](_0x2d6e36[_0x5c9a('0x1a')],function(_0x1dd286){return{'model':db[_0x1dd286[_0x5c9a('0x1c')]],'as':_0x1dd286['as'],'attributes':_0x1dd286[_0x5c9a('0x1d')],'include':_0x1dd286[_0x5c9a('0x1a')]?_['map'](_0x1dd286[_0x5c9a('0x1a')],function(_0x3b9099){return{'model':db[_0x3b9099['model']],'as':_0x3b9099['as'],'attributes':_0x3b9099['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c9a('0x1e')](function(_0x37cb44){logger[_0x5c9a('0xb')](_0x5c9a('0x14'),_0x4c6230);logger[_0x5c9a('0xe')](_0x5c9a('0x14'),_0x4c6230,JSON['stringify'](_0x37cb44));_0x31a44f(_0x37cb44);})[_0x5c9a('0x13')](function(_0x168b7a){logger[_0x5c9a('0x10')](_0x5c9a('0x14'),_0x168b7a[_0x5c9a('0x12')],_0x4c6230);_0x1298a1(_0x381de1[_0x5c9a('0x10')](0x1f4,_0x168b7a['message']));});});};exports[_0x5c9a('0x1f')]=function(_0x16bd80){var _0x4e7fe5=this;return new Promise(function(_0x271d6e,_0x469b9c){return db[_0x5c9a('0x20')][_0x5c9a('0x21')]({'raw':_0x16bd80[_0x5c9a('0x17')]?_0x16bd80[_0x5c9a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x16bd80[_0x5c9a('0x17')]?_0x16bd80[_0x5c9a('0x17')][_0x5c9a('0x18')]||null:null,'attributes':_0x16bd80[_0x5c9a('0x17')]?_0x16bd80['options'][_0x5c9a('0x1d')]||null:null,'include':_0x16bd80[_0x5c9a('0x17')]?_0x16bd80['options'][_0x5c9a('0x1a')]?_[_0x5c9a('0x1b')](_0x16bd80[_0x5c9a('0x17')][_0x5c9a('0x1a')],function(_0x5e0e2b){return{'model':db[_0x5e0e2b[_0x5c9a('0x1c')]],'as':_0x5e0e2b['as'],'attributes':_0x5e0e2b[_0x5c9a('0x1d')],'include':_0x5e0e2b['include']?_[_0x5c9a('0x1b')](_0x5e0e2b[_0x5c9a('0x1a')],function(_0x402fda){return{'model':db[_0x402fda[_0x5c9a('0x1c')]],'as':_0x402fda['as'],'attributes':_0x402fda[_0x5c9a('0x1d')],'include':_0x402fda[_0x5c9a('0x1a')]?_[_0x5c9a('0x1b')](_0x402fda[_0x5c9a('0x1a')],function(_0x5ba718){return{'model':db[_0x5ba718[_0x5c9a('0x1c')]],'as':_0x5ba718['as'],'attributes':_0x5ba718[_0x5c9a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5c9a('0x1e')](function(_0x4fda69){logger[_0x5c9a('0xb')]('ShowServicenowAccount',_0x16bd80);logger[_0x5c9a('0xe')](_0x5c9a('0x1f'),_0x16bd80,JSON[_0x5c9a('0x22')](_0x4fda69));_0x271d6e(_0x4fda69);})[_0x5c9a('0x13')](function(_0x4ed4d8){logger[_0x5c9a('0x10')](_0x5c9a('0x1f'),_0x4ed4d8[_0x5c9a('0x12')],_0x16bd80);_0x469b9c(_0x4e7fe5[_0x5c9a('0x10')](0x1f4,_0x4ed4d8[_0x5c9a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ddd0eee..7e891b8 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 _0x37a8=['/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id/fields','getFields'];(function(_0x298b67,_0x235760){var _0x5cdd93=function(_0x1c4e5f){while(--_0x1c4e5f){_0x298b67['push'](_0x298b67['shift']());}};_0x5cdd93(++_0x235760);}(_0x37a8,0x171));var _0x837a=function(_0x3bf1d9,_0x45314a){_0x3bf1d9=_0x3bf1d9-0x0;var _0x36ea8d=_0x37a8[_0x3bf1d9];return _0x36ea8d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x837a('0x0'));var express=require(_0x837a('0x1'));var router=express[_0x837a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x837a('0x3'));var interaction=require(_0x837a('0x4'));var config=require(_0x837a('0x5'));var controller=require(_0x837a('0x6'));router[_0x837a('0x7')]('/',auth[_0x837a('0x8')](),controller['index']);router['get']('/:id',auth[_0x837a('0x8')](),controller['show']);router[_0x837a('0x7')](_0x837a('0x9'),auth[_0x837a('0x8')](),controller[_0x837a('0xa')]);router['get'](_0x837a('0xb'),auth[_0x837a('0x8')](),controller[_0x837a('0xc')]);router[_0x837a('0x7')](_0x837a('0xd'),auth[_0x837a('0x8')](),controller['getDescriptions']);router[_0x837a('0xe')]('/',auth[_0x837a('0x8')](),controller[_0x837a('0xf')]);router[_0x837a('0x10')](_0x837a('0x11'),auth[_0x837a('0x8')](),controller['update']);router[_0x837a('0x12')]('/:id',auth[_0x837a('0x8')](),controller['destroy']);module[_0x837a('0x13')]=router; \ No newline at end of file +var _0x1b85=['create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post'];(function(_0x332218,_0x127368){var _0x2c48cd=function(_0x16b74e){while(--_0x16b74e){_0x332218['push'](_0x332218['shift']());}};_0x2c48cd(++_0x127368);}(_0x1b85,0x1e0));var _0x51b8=function(_0x908eb6,_0x59199b){_0x908eb6=_0x908eb6-0x0;var _0x511a09=_0x1b85[_0x908eb6];return _0x511a09;};'use strict';var multer=require(_0x51b8('0x0'));var util=require(_0x51b8('0x1'));var path=require(_0x51b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x51b8('0x3'));var router=express[_0x51b8('0x4')]();var fs_extra=require(_0x51b8('0x5'));var auth=require(_0x51b8('0x6'));var interaction=require(_0x51b8('0x7'));var config=require('../../config/environment');var controller=require(_0x51b8('0x8'));router[_0x51b8('0x9')]('/',auth[_0x51b8('0xa')](),controller[_0x51b8('0xb')]);router[_0x51b8('0x9')](_0x51b8('0xc'),auth['isAuthenticated'](),controller[_0x51b8('0xd')]);router[_0x51b8('0x9')](_0x51b8('0xe'),auth['isAuthenticated'](),controller[_0x51b8('0xf')]);router[_0x51b8('0x9')](_0x51b8('0x10'),auth[_0x51b8('0xa')](),controller[_0x51b8('0x11')]);router[_0x51b8('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x51b8('0x12')]);router[_0x51b8('0x13')]('/',auth[_0x51b8('0xa')](),controller[_0x51b8('0x14')]);router['put'](_0x51b8('0xc'),auth['isAuthenticated'](),controller[_0x51b8('0x15')]);router[_0x51b8('0x16')](_0x51b8('0xc'),auth[_0x51b8('0xa')](),controller[_0x51b8('0x17')]);module[_0x51b8('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 38f981f..dac3ee1 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 _0x39c7=['STRING','exports'];(function(_0x33c3ef,_0x1b8fb9){var _0x1378f4=function(_0x13b10f){while(--_0x13b10f){_0x33c3ef['push'](_0x33c3ef['shift']());}};_0x1378f4(++_0x1b8fb9);}(_0x39c7,0x16f));var _0x739c=function(_0x25f8cb,_0x1a2e14){_0x25f8cb=_0x25f8cb-0x0;var _0x3afb8c=_0x39c7[_0x25f8cb];return _0x3afb8c;};'use strict';var Sequelize=require('sequelize');module[_0x739c('0x0')]={'name':{'type':Sequelize[_0x739c('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4736=['STRING','sequelize','exports'];(function(_0x102243,_0x2b4dde){var _0x1d302c=function(_0x50c1fb){while(--_0x50c1fb){_0x102243['push'](_0x102243['shift']());}};_0x1d302c(++_0x2b4dde);}(_0x4736,0x130));var _0x6473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4736[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6473('0x0'));module[_0x6473('0x1')]={'name':{'type':Sequelize[_0x6473('0x2')]},'description':{'type':Sequelize[_0x6473('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index b9697fa..5b6402f 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 _0x08e9=['stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','model','query','filters','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','intersection','includeAll','find','create','body','update','params','findOne','ServicenowField','order','getFields','getSubjects','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','end','sendStatus','error'];(function(_0x1b820f,_0x425eb4){var _0x423354=function(_0x3a8426){while(--_0x3a8426){_0x1b820f['push'](_0x1b820f['shift']());}};_0x423354(++_0x425eb4);}(_0x08e9,0x78));var _0x908e=function(_0xf135c1,_0x7a89bb){_0xf135c1=_0xf135c1-0x0;var _0x3a902c=_0x08e9[_0xf135c1];return _0x3a902c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x908e('0x0'));var zipdir=require(_0x908e('0x1'));var jsonpatch=require(_0x908e('0x2'));var rp=require(_0x908e('0x3'));var moment=require(_0x908e('0x4'));var BPromise=require(_0x908e('0x5'));var Mustache=require(_0x908e('0x6'));var util=require(_0x908e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x908e('0x8'));var ejs=require(_0x908e('0x9'));var fs=require('fs');var fs_extra=require(_0x908e('0xa'));var _=require(_0x908e('0xb'));var squel=require('squel');var crypto=require(_0x908e('0xc'));var jsforce=require(_0x908e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x908e('0xe'));var Papa=require('papaparse');var Redis=require(_0x908e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x908e('0x10'));var logger=require(_0x908e('0x11'))('api');var utils=require(_0x908e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x908e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551b09,_0x526dd2){_0x526dd2=_0x526dd2||0xcc;return function(_0x3b55f5){if(_0x3b55f5){return _0x551b09['sendStatus'](_0x526dd2);}return _0x551b09['status'](_0x526dd2)['end']();};}function respondWithResult(_0x29ab6b,_0x1830ae){_0x1830ae=_0x1830ae||0xc8;return function(_0xc7c69a){if(_0xc7c69a){return _0x29ab6b[_0x908e('0x14')](_0x1830ae)['json'](_0xc7c69a);}};}function respondWithFilteredResult(_0x14a9b2,_0x4540c1){return function(_0x22a4b9){if(_0x22a4b9){var _0x566088=typeof _0x4540c1[_0x908e('0x15')]===_0x908e('0x16')&&typeof _0x4540c1['limit']===_0x908e('0x16');var _0x1dae4b=_0x22a4b9[_0x908e('0x17')];var _0x4ce70b=_0x566088?0x0:_0x4540c1[_0x908e('0x15')];var _0x242171=_0x566088?_0x22a4b9[_0x908e('0x17')]:_0x4540c1[_0x908e('0x15')]+_0x4540c1[_0x908e('0x18')];var _0x35a6df;if(_0x242171>=_0x1dae4b){_0x242171=_0x1dae4b;_0x35a6df=0xc8;}else{_0x35a6df=0xce;}_0x14a9b2[_0x908e('0x14')](_0x35a6df);return _0x14a9b2[_0x908e('0x19')](_0x908e('0x1a'),_0x4ce70b+'-'+_0x242171+'/'+_0x1dae4b)['json'](_0x22a4b9);}return null;};}function patchUpdates(_0x1e84e6){return function(_0x10f50f){try{jsonpatch['apply'](_0x10f50f,_0x1e84e6,!![]);}catch(_0x536a25){return BPromise[_0x908e('0x1b')](_0x536a25);}return _0x10f50f[_0x908e('0x1c')]();};}function saveUpdates(_0x1554e0,_0x536e86){return function(_0x391fce){if(_0x391fce){return _0x391fce['update'](_0x1554e0)[_0x908e('0x1d')](function(_0x57dffc){return _0x57dffc;});}return null;};}function removeEntity(_0x58d49f,_0x5f4681){return function(_0x5611cc){if(_0x5611cc){return _0x5611cc[_0x908e('0x1e')]()['then'](function(){_0x58d49f[_0x908e('0x14')](0xcc)[_0x908e('0x1f')]();});}};}function handleEntityNotFound(_0x5096fd,_0x147842){return function(_0x4dd96e){if(!_0x4dd96e){_0x5096fd[_0x908e('0x20')](0x194);}return _0x4dd96e;};}function handleError(_0x1573c9,_0x2cfdb4){_0x2cfdb4=_0x2cfdb4||0x1f4;return function(_0x17b71d){logger[_0x908e('0x21')](_0x17b71d[_0x908e('0x22')]);if(_0x17b71d[_0x908e('0x23')]){delete _0x17b71d['name'];}_0x1573c9[_0x908e('0x14')](_0x2cfdb4)[_0x908e('0x24')](_0x17b71d);};}exports[_0x908e('0x25')]=function(_0x15bdc2,_0x3be7e3){var _0x409398={},_0x54c949={},_0x3f7684={'count':0x0,'rows':[]};var _0x88af2f=_[_0x908e('0x26')](db[_0x908e('0x27')][_0x908e('0x28')],function(_0x6ed831){return{'name':_0x6ed831[_0x908e('0x29')],'type':_0x6ed831['type']['key']};});_0x54c949[_0x908e('0x2a')]=_[_0x908e('0x26')](_0x88af2f,'name');_0x54c949['query']=_['keys'](_0x15bdc2[_0x908e('0x2b')]);_0x54c949[_0x908e('0x2c')]=_['intersection'](_0x54c949['model'],_0x54c949[_0x908e('0x2b')]);_0x409398['attributes']=_['intersection'](_0x54c949[_0x908e('0x2a')],qs['fields'](_0x15bdc2[_0x908e('0x2b')][_0x908e('0x2d')]));_0x409398[_0x908e('0x2e')]=_0x409398[_0x908e('0x2e')][_0x908e('0x2f')]?_0x409398[_0x908e('0x2e')]:_0x54c949[_0x908e('0x2a')];if(!_0x15bdc2[_0x908e('0x2b')]['hasOwnProperty'](_0x908e('0x30'))){_0x409398[_0x908e('0x18')]=qs['limit'](_0x15bdc2[_0x908e('0x2b')][_0x908e('0x18')]);_0x409398['offset']=qs[_0x908e('0x15')](_0x15bdc2[_0x908e('0x2b')]['offset']);}_0x409398['order']=qs[_0x908e('0x31')](_0x15bdc2[_0x908e('0x2b')][_0x908e('0x31')]);_0x409398[_0x908e('0x32')]=qs['filters'](_[_0x908e('0x33')](_0x15bdc2[_0x908e('0x2b')],_0x54c949[_0x908e('0x2c')]),_0x88af2f);if(_0x15bdc2[_0x908e('0x2b')][_0x908e('0x34')]){_0x409398[_0x908e('0x32')]=_[_0x908e('0x35')](_0x409398[_0x908e('0x32')],{'$or':_[_0x908e('0x26')](_0x88af2f,function(_0x4098e5){if(_0x4098e5[_0x908e('0x36')]!==_0x908e('0x37')){var _0x560863={};_0x560863[_0x4098e5['name']]={'$like':'%'+_0x15bdc2[_0x908e('0x2b')][_0x908e('0x34')]+'%'};return _0x560863;}})});}_0x409398=_['merge']({},_0x409398,_0x15bdc2[_0x908e('0x38')]);var _0xdcb2ce={'where':_0x409398[_0x908e('0x32')]};return db[_0x908e('0x27')][_0x908e('0x17')](_0xdcb2ce)['then'](function(_0x4ddee8){_0x3f7684[_0x908e('0x17')]=_0x4ddee8;if(_0x15bdc2[_0x908e('0x2b')]['includeAll']){_0x409398[_0x908e('0x39')]=[{'all':!![]}];}return db[_0x908e('0x27')][_0x908e('0x3a')](_0x409398);})[_0x908e('0x1d')](function(_0x380f04){_0x3f7684[_0x908e('0x3b')]=_0x380f04;return _0x3f7684;})[_0x908e('0x1d')](respondWithFilteredResult(_0x3be7e3,_0x409398))[_0x908e('0x3c')](handleError(_0x3be7e3,null));};exports[_0x908e('0x3d')]=function(_0x2cd759,_0x87581){var _0x36dba5={'raw':![],'where':{'id':_0x2cd759['params']['id']}},_0x7f7142={};_0x7f7142[_0x908e('0x2a')]=_[_0x908e('0x3e')](db['ServicenowConfiguration']['rawAttributes']);_0x7f7142[_0x908e('0x2b')]=_[_0x908e('0x3e')](_0x2cd759[_0x908e('0x2b')]);_0x7f7142[_0x908e('0x2c')]=_[_0x908e('0x3f')](_0x7f7142[_0x908e('0x2a')],_0x7f7142['query']);_0x36dba5['attributes']=_[_0x908e('0x3f')](_0x7f7142[_0x908e('0x2a')],qs[_0x908e('0x2d')](_0x2cd759[_0x908e('0x2b')]['fields']));_0x36dba5['attributes']=_0x36dba5[_0x908e('0x2e')][_0x908e('0x2f')]?_0x36dba5[_0x908e('0x2e')]:_0x7f7142[_0x908e('0x2a')];if(_0x2cd759[_0x908e('0x2b')][_0x908e('0x40')]){_0x36dba5[_0x908e('0x39')]=[{'all':!![]}];}_0x36dba5=_[_0x908e('0x35')]({},_0x36dba5,_0x2cd759['options']);return db[_0x908e('0x27')][_0x908e('0x41')](_0x36dba5)['then'](handleEntityNotFound(_0x87581,null))['then'](respondWithResult(_0x87581,null))[_0x908e('0x3c')](handleError(_0x87581,null));};exports[_0x908e('0x42')]=function(_0x5f115d,_0x3f3300){return db[_0x908e('0x27')]['create'](_0x5f115d[_0x908e('0x43')],{})[_0x908e('0x1d')](respondWithResult(_0x3f3300,0xc9))[_0x908e('0x3c')](handleError(_0x3f3300,null));};exports[_0x908e('0x44')]=function(_0x2c0420,_0x177f18){if(_0x2c0420['body']['id']){delete _0x2c0420[_0x908e('0x43')]['id'];}return db[_0x908e('0x27')][_0x908e('0x41')]({'where':{'id':_0x2c0420[_0x908e('0x45')]['id']}})[_0x908e('0x1d')](handleEntityNotFound(_0x177f18,null))[_0x908e('0x1d')](saveUpdates(_0x2c0420[_0x908e('0x43')],null))[_0x908e('0x1d')](respondWithResult(_0x177f18,null))[_0x908e('0x3c')](handleError(_0x177f18,null));};exports[_0x908e('0x1e')]=function(_0x524cd5,_0x3c22ca){return db[_0x908e('0x27')][_0x908e('0x41')]({'where':{'id':_0x524cd5[_0x908e('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c22ca,null))[_0x908e('0x1d')](removeEntity(_0x3c22ca,null))[_0x908e('0x3c')](handleError(_0x3c22ca,null));};exports['getFields']=function(_0x47c02d,_0x4d6bf0,_0x1893ae){var _0x4f456c={};var _0x3fd3e6={};var _0x4b4492;var _0x177532;return db['ServicenowConfiguration'][_0x908e('0x46')]({'where':{'id':_0x47c02d[_0x908e('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d6bf0,null))[_0x908e('0x1d')](function(_0x276074){if(_0x276074){_0x4b4492=_0x276074;_0x3fd3e6[_0x908e('0x2a')]=_['keys'](db[_0x908e('0x47')][_0x908e('0x28')]);_0x3fd3e6[_0x908e('0x2b')]=_[_0x908e('0x3e')](_0x47c02d[_0x908e('0x2b')]);_0x3fd3e6['filters']=_[_0x908e('0x3f')](_0x3fd3e6[_0x908e('0x2a')],_0x3fd3e6[_0x908e('0x2b')]);_0x4f456c[_0x908e('0x2e')]=_[_0x908e('0x3f')](_0x3fd3e6[_0x908e('0x2a')],qs['fields'](_0x47c02d['query'][_0x908e('0x2d')]));_0x4f456c[_0x908e('0x2e')]=_0x4f456c[_0x908e('0x2e')][_0x908e('0x2f')]?_0x4f456c[_0x908e('0x2e')]:_0x3fd3e6['model'];_0x4f456c[_0x908e('0x48')]=qs[_0x908e('0x31')](_0x47c02d[_0x908e('0x2b')]['sort']);_0x4f456c[_0x908e('0x32')]=qs[_0x908e('0x2c')](_[_0x908e('0x33')](_0x47c02d['query'],_0x3fd3e6[_0x908e('0x2c')]));if(_0x47c02d[_0x908e('0x2b')][_0x908e('0x34')]){_0x4f456c['where']=_[_0x908e('0x35')](_0x4f456c['where'],{'$or':_['map'](_0x4f456c[_0x908e('0x2e')],function(_0x4cc362){var _0x29a3f0={};_0x29a3f0[_0x4cc362]={'$like':'%'+_0x47c02d[_0x908e('0x2b')][_0x908e('0x34')]+'%'};return _0x29a3f0;})});}_0x4f456c=_[_0x908e('0x35')]({},_0x4f456c,_0x47c02d[_0x908e('0x38')]);return _0x4b4492[_0x908e('0x49')](_0x4f456c);}})[_0x908e('0x1d')](function(_0x5b0baf){if(_0x5b0baf){_0x177532=_0x5b0baf[_0x908e('0x2f')];if(!_0x47c02d[_0x908e('0x2b')]['hasOwnProperty'](_0x908e('0x30'))){_0x4f456c[_0x908e('0x18')]=qs[_0x908e('0x18')](_0x47c02d['query']['limit']);_0x4f456c['offset']=qs[_0x908e('0x15')](_0x47c02d[_0x908e('0x2b')][_0x908e('0x15')]);}return _0x4b4492['getFields'](_0x4f456c);}})['then'](function(_0x52ba91){if(_0x52ba91){return _0x52ba91?{'count':_0x177532,'rows':_0x52ba91}:null;}})['then'](respondWithResult(_0x4d6bf0,null))[_0x908e('0x3c')](handleError(_0x4d6bf0,null));};exports[_0x908e('0x4a')]=function(_0x944750,_0x39a72b,_0x3dc6ac){var _0x356492={};var _0x3ffe2b={};var _0x381959;var _0x1913d5;return db[_0x908e('0x27')][_0x908e('0x46')]({'where':{'id':_0x944750[_0x908e('0x45')]['id']}})['then'](handleEntityNotFound(_0x39a72b,null))[_0x908e('0x1d')](function(_0x1c00ad){if(_0x1c00ad){_0x381959=_0x1c00ad;_0x3ffe2b[_0x908e('0x2a')]=_[_0x908e('0x3e')](db[_0x908e('0x47')][_0x908e('0x28')]);_0x3ffe2b['query']=_[_0x908e('0x3e')](_0x944750[_0x908e('0x2b')]);_0x3ffe2b[_0x908e('0x2c')]=_[_0x908e('0x3f')](_0x3ffe2b[_0x908e('0x2a')],_0x3ffe2b['query']);_0x356492[_0x908e('0x2e')]=_['intersection'](_0x3ffe2b[_0x908e('0x2a')],qs[_0x908e('0x2d')](_0x944750[_0x908e('0x2b')]['fields']));_0x356492[_0x908e('0x2e')]=_0x356492[_0x908e('0x2e')][_0x908e('0x2f')]?_0x356492[_0x908e('0x2e')]:_0x3ffe2b[_0x908e('0x2a')];_0x356492[_0x908e('0x48')]=qs[_0x908e('0x31')](_0x944750['query'][_0x908e('0x31')]);_0x356492[_0x908e('0x32')]=qs[_0x908e('0x2c')](_[_0x908e('0x33')](_0x944750[_0x908e('0x2b')],_0x3ffe2b[_0x908e('0x2c')]));if(_0x944750['query'][_0x908e('0x34')]){_0x356492['where']=_['merge'](_0x356492['where'],{'$or':_['map'](_0x356492[_0x908e('0x2e')],function(_0x3322b3){var _0x63be24={};_0x63be24[_0x3322b3]={'$like':'%'+_0x944750[_0x908e('0x2b')][_0x908e('0x34')]+'%'};return _0x63be24;})});}_0x356492=_[_0x908e('0x35')]({},_0x356492,_0x944750[_0x908e('0x38')]);return _0x381959[_0x908e('0x4a')](_0x356492);}})[_0x908e('0x1d')](function(_0x5e4491){if(_0x5e4491){_0x1913d5=_0x5e4491[_0x908e('0x2f')];if(!_0x944750[_0x908e('0x2b')][_0x908e('0x4b')]('nolimit')){_0x356492['limit']=qs['limit'](_0x944750[_0x908e('0x2b')][_0x908e('0x18')]);_0x356492[_0x908e('0x15')]=qs[_0x908e('0x15')](_0x944750[_0x908e('0x2b')]['offset']);}return _0x381959[_0x908e('0x4a')](_0x356492);}})[_0x908e('0x1d')](function(_0x42aeb4){if(_0x42aeb4){return _0x42aeb4?{'count':_0x1913d5,'rows':_0x42aeb4}:null;}})[_0x908e('0x1d')](respondWithResult(_0x39a72b,null))['catch'](handleError(_0x39a72b,null));};exports[_0x908e('0x4c')]=function(_0x2b221a,_0x4d260c,_0x2c93ce){var _0x1a4c07={};var _0x262f02={};var _0x3d2347;var _0x1aede1;return db['ServicenowConfiguration'][_0x908e('0x46')]({'where':{'id':_0x2b221a[_0x908e('0x45')]['id']}})[_0x908e('0x1d')](handleEntityNotFound(_0x4d260c,null))[_0x908e('0x1d')](function(_0x10d500){if(_0x10d500){_0x3d2347=_0x10d500;_0x262f02['model']=_['keys'](db[_0x908e('0x47')][_0x908e('0x28')]);_0x262f02[_0x908e('0x2b')]=_[_0x908e('0x3e')](_0x2b221a[_0x908e('0x2b')]);_0x262f02[_0x908e('0x2c')]=_[_0x908e('0x3f')](_0x262f02[_0x908e('0x2a')],_0x262f02[_0x908e('0x2b')]);_0x1a4c07[_0x908e('0x2e')]=_[_0x908e('0x3f')](_0x262f02[_0x908e('0x2a')],qs[_0x908e('0x2d')](_0x2b221a[_0x908e('0x2b')][_0x908e('0x2d')]));_0x1a4c07[_0x908e('0x2e')]=_0x1a4c07[_0x908e('0x2e')][_0x908e('0x2f')]?_0x1a4c07[_0x908e('0x2e')]:_0x262f02[_0x908e('0x2a')];_0x1a4c07[_0x908e('0x48')]=qs[_0x908e('0x31')](_0x2b221a[_0x908e('0x2b')][_0x908e('0x31')]);_0x1a4c07[_0x908e('0x32')]=qs[_0x908e('0x2c')](_[_0x908e('0x33')](_0x2b221a[_0x908e('0x2b')],_0x262f02[_0x908e('0x2c')]));if(_0x2b221a[_0x908e('0x2b')]['filter']){_0x1a4c07['where']=_[_0x908e('0x35')](_0x1a4c07[_0x908e('0x32')],{'$or':_[_0x908e('0x26')](_0x1a4c07[_0x908e('0x2e')],function(_0x56d600){var _0x3d9d86={};_0x3d9d86[_0x56d600]={'$like':'%'+_0x2b221a[_0x908e('0x2b')][_0x908e('0x34')]+'%'};return _0x3d9d86;})});}_0x1a4c07=_[_0x908e('0x35')]({},_0x1a4c07,_0x2b221a[_0x908e('0x38')]);return _0x3d2347[_0x908e('0x4c')](_0x1a4c07);}})[_0x908e('0x1d')](function(_0xce27e1){if(_0xce27e1){_0x1aede1=_0xce27e1[_0x908e('0x2f')];if(!_0x2b221a[_0x908e('0x2b')][_0x908e('0x4b')](_0x908e('0x30'))){_0x1a4c07[_0x908e('0x18')]=qs['limit'](_0x2b221a['query'][_0x908e('0x18')]);_0x1a4c07[_0x908e('0x15')]=qs[_0x908e('0x15')](_0x2b221a[_0x908e('0x2b')][_0x908e('0x15')]);}return _0x3d2347[_0x908e('0x4c')](_0x1a4c07);}})['then'](function(_0x58c64a){if(_0x58c64a){return _0x58c64a?{'count':_0x1aede1,'rows':_0x58c64a}:null;}})['then'](respondWithResult(_0x4d260c,null))[_0x908e('0x3c')](handleError(_0x4d260c,null));}; \ No newline at end of file +var _0xd8a2=['ServicenowField','pick','getFields','getSubjects','order','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','include','findAll','catch','show','params','includeAll','find','create','body','findOne'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd8a2,0x187));var _0x2d8a=function(_0x257f78,_0x2e3afd){_0x257f78=_0x257f78-0x0;var _0x576648=_0xd8a2[_0x257f78];return _0x576648;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d8a('0x0'));var zipdir=require(_0x2d8a('0x1'));var jsonpatch=require(_0x2d8a('0x2'));var rp=require(_0x2d8a('0x3'));var moment=require(_0x2d8a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2d8a('0x5'));var util=require('util');var path=require(_0x2d8a('0x6'));var sox=require(_0x2d8a('0x7'));var csv=require(_0x2d8a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d8a('0x9'));var _=require(_0x2d8a('0xa'));var squel=require(_0x2d8a('0xb'));var crypto=require('crypto');var jsforce=require(_0x2d8a('0xc'));var deskjs=require(_0x2d8a('0xd'));var toCsv=require(_0x2d8a('0x8'));var querystring=require(_0x2d8a('0xe'));var Papa=require(_0x2d8a('0xf'));var Redis=require(_0x2d8a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2d8a('0x11'));var as=require(_0x2d8a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2d8a('0x13'));var config=require(_0x2d8a('0x14'));var licenseUtil=require(_0x2d8a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20cc13,_0x488641){_0x488641=_0x488641||0xcc;return function(_0xfb388d){if(_0xfb388d){return _0x20cc13['sendStatus'](_0x488641);}return _0x20cc13[_0x2d8a('0x16')](_0x488641)[_0x2d8a('0x17')]();};}function respondWithResult(_0x41a22a,_0x3a2591){_0x3a2591=_0x3a2591||0xc8;return function(_0x479d71){if(_0x479d71){return _0x41a22a[_0x2d8a('0x16')](_0x3a2591)['json'](_0x479d71);}};}function respondWithFilteredResult(_0x55f347,_0xd1252e){return function(_0x199ac2){if(_0x199ac2){var _0x2ab4b2=typeof _0xd1252e[_0x2d8a('0x18')]===_0x2d8a('0x19')&&typeof _0xd1252e[_0x2d8a('0x1a')]===_0x2d8a('0x19');var _0xc453ce=_0x199ac2[_0x2d8a('0x1b')];var _0x4100d3=_0x2ab4b2?0x0:_0xd1252e[_0x2d8a('0x18')];var _0x594510=_0x2ab4b2?_0x199ac2[_0x2d8a('0x1b')]:_0xd1252e[_0x2d8a('0x18')]+_0xd1252e['limit'];var _0x24264f;if(_0x594510>=_0xc453ce){_0x594510=_0xc453ce;_0x24264f=0xc8;}else{_0x24264f=0xce;}_0x55f347['status'](_0x24264f);return _0x55f347[_0x2d8a('0x1c')]('Content-Range',_0x4100d3+'-'+_0x594510+'/'+_0xc453ce)[_0x2d8a('0x1d')](_0x199ac2);}return null;};}function patchUpdates(_0x37d7f6){return function(_0x123718){try{jsonpatch['apply'](_0x123718,_0x37d7f6,!![]);}catch(_0x3a3d4d){return BPromise[_0x2d8a('0x1e')](_0x3a3d4d);}return _0x123718[_0x2d8a('0x1f')]();};}function saveUpdates(_0x110190,_0x21d4d0){return function(_0x1c48a9){if(_0x1c48a9){return _0x1c48a9[_0x2d8a('0x20')](_0x110190)[_0x2d8a('0x21')](function(_0x247458){return _0x247458;});}return null;};}function removeEntity(_0x706751,_0xeac323){return function(_0x371293){if(_0x371293){return _0x371293[_0x2d8a('0x22')]()[_0x2d8a('0x21')](function(){_0x706751[_0x2d8a('0x16')](0xcc)[_0x2d8a('0x17')]();});}};}function handleEntityNotFound(_0xbd8c58,_0x54c705){return function(_0x20738c){if(!_0x20738c){_0xbd8c58[_0x2d8a('0x23')](0x194);}return _0x20738c;};}function handleError(_0x4aec55,_0x32b8cf){_0x32b8cf=_0x32b8cf||0x1f4;return function(_0x51680c){logger[_0x2d8a('0x24')](_0x51680c[_0x2d8a('0x25')]);if(_0x51680c[_0x2d8a('0x26')]){delete _0x51680c[_0x2d8a('0x26')];}_0x4aec55['status'](_0x32b8cf)[_0x2d8a('0x27')](_0x51680c);};}exports[_0x2d8a('0x28')]=function(_0x1fa673,_0x568222){var _0x41de5f={},_0x111e5a={},_0xddcba8={'count':0x0,'rows':[]};var _0x5eeebb=_[_0x2d8a('0x29')](db[_0x2d8a('0x2a')][_0x2d8a('0x2b')],function(_0x398833){return{'name':_0x398833['fieldName'],'type':_0x398833[_0x2d8a('0x2c')][_0x2d8a('0x2d')]};});_0x111e5a[_0x2d8a('0x2e')]=_[_0x2d8a('0x29')](_0x5eeebb,'name');_0x111e5a[_0x2d8a('0x2f')]=_[_0x2d8a('0x30')](_0x1fa673[_0x2d8a('0x2f')]);_0x111e5a[_0x2d8a('0x31')]=_[_0x2d8a('0x32')](_0x111e5a[_0x2d8a('0x2e')],_0x111e5a['query']);_0x41de5f[_0x2d8a('0x33')]=_[_0x2d8a('0x32')](_0x111e5a['model'],qs[_0x2d8a('0x34')](_0x1fa673[_0x2d8a('0x2f')][_0x2d8a('0x34')]));_0x41de5f[_0x2d8a('0x33')]=_0x41de5f['attributes'][_0x2d8a('0x35')]?_0x41de5f[_0x2d8a('0x33')]:_0x111e5a[_0x2d8a('0x2e')];if(!_0x1fa673[_0x2d8a('0x2f')][_0x2d8a('0x36')](_0x2d8a('0x37'))){_0x41de5f[_0x2d8a('0x1a')]=qs[_0x2d8a('0x1a')](_0x1fa673[_0x2d8a('0x2f')]['limit']);_0x41de5f['offset']=qs[_0x2d8a('0x18')](_0x1fa673[_0x2d8a('0x2f')]['offset']);}_0x41de5f['order']=qs[_0x2d8a('0x38')](_0x1fa673[_0x2d8a('0x2f')][_0x2d8a('0x38')]);_0x41de5f['where']=qs['filters'](_['pick'](_0x1fa673['query'],_0x111e5a[_0x2d8a('0x31')]),_0x5eeebb);if(_0x1fa673[_0x2d8a('0x2f')][_0x2d8a('0x39')]){_0x41de5f['where']=_[_0x2d8a('0x3a')](_0x41de5f[_0x2d8a('0x3b')],{'$or':_[_0x2d8a('0x29')](_0x5eeebb,function(_0x30e94a){if(_0x30e94a[_0x2d8a('0x2c')]!=='VIRTUAL'){var _0x44b245={};_0x44b245[_0x30e94a[_0x2d8a('0x26')]]={'$like':'%'+_0x1fa673['query'][_0x2d8a('0x39')]+'%'};return _0x44b245;}})});}_0x41de5f=_['merge']({},_0x41de5f,_0x1fa673[_0x2d8a('0x3c')]);var _0x273751={'where':_0x41de5f[_0x2d8a('0x3b')]};return db['ServicenowConfiguration']['count'](_0x273751)['then'](function(_0x1daf52){_0xddcba8[_0x2d8a('0x1b')]=_0x1daf52;if(_0x1fa673[_0x2d8a('0x2f')]['includeAll']){_0x41de5f[_0x2d8a('0x3d')]=[{'all':!![]}];}return db[_0x2d8a('0x2a')][_0x2d8a('0x3e')](_0x41de5f);})[_0x2d8a('0x21')](function(_0x16def1){_0xddcba8['rows']=_0x16def1;return _0xddcba8;})['then'](respondWithFilteredResult(_0x568222,_0x41de5f))[_0x2d8a('0x3f')](handleError(_0x568222,null));};exports[_0x2d8a('0x40')]=function(_0x38de88,_0xbb902){var _0x4a6130={'raw':![],'where':{'id':_0x38de88[_0x2d8a('0x41')]['id']}},_0xdf48ad={};_0xdf48ad[_0x2d8a('0x2e')]=_[_0x2d8a('0x30')](db[_0x2d8a('0x2a')][_0x2d8a('0x2b')]);_0xdf48ad[_0x2d8a('0x2f')]=_[_0x2d8a('0x30')](_0x38de88['query']);_0xdf48ad[_0x2d8a('0x31')]=_[_0x2d8a('0x32')](_0xdf48ad[_0x2d8a('0x2e')],_0xdf48ad[_0x2d8a('0x2f')]);_0x4a6130[_0x2d8a('0x33')]=_[_0x2d8a('0x32')](_0xdf48ad[_0x2d8a('0x2e')],qs[_0x2d8a('0x34')](_0x38de88[_0x2d8a('0x2f')][_0x2d8a('0x34')]));_0x4a6130[_0x2d8a('0x33')]=_0x4a6130['attributes'][_0x2d8a('0x35')]?_0x4a6130[_0x2d8a('0x33')]:_0xdf48ad[_0x2d8a('0x2e')];if(_0x38de88[_0x2d8a('0x2f')][_0x2d8a('0x42')]){_0x4a6130[_0x2d8a('0x3d')]=[{'all':!![]}];}_0x4a6130=_[_0x2d8a('0x3a')]({},_0x4a6130,_0x38de88[_0x2d8a('0x3c')]);return db[_0x2d8a('0x2a')][_0x2d8a('0x43')](_0x4a6130)['then'](handleEntityNotFound(_0xbb902,null))['then'](respondWithResult(_0xbb902,null))[_0x2d8a('0x3f')](handleError(_0xbb902,null));};exports[_0x2d8a('0x44')]=function(_0x39eb22,_0x171f09){return db[_0x2d8a('0x2a')][_0x2d8a('0x44')](_0x39eb22[_0x2d8a('0x45')],{})[_0x2d8a('0x21')](respondWithResult(_0x171f09,0xc9))[_0x2d8a('0x3f')](handleError(_0x171f09,null));};exports[_0x2d8a('0x20')]=function(_0x5b0391,_0x2578b0){if(_0x5b0391[_0x2d8a('0x45')]['id']){delete _0x5b0391[_0x2d8a('0x45')]['id'];}return db[_0x2d8a('0x2a')][_0x2d8a('0x43')]({'where':{'id':_0x5b0391[_0x2d8a('0x41')]['id']}})[_0x2d8a('0x21')](handleEntityNotFound(_0x2578b0,null))[_0x2d8a('0x21')](saveUpdates(_0x5b0391['body'],null))['then'](respondWithResult(_0x2578b0,null))[_0x2d8a('0x3f')](handleError(_0x2578b0,null));};exports[_0x2d8a('0x22')]=function(_0x3debc3,_0x2b4ffe){return db[_0x2d8a('0x2a')][_0x2d8a('0x43')]({'where':{'id':_0x3debc3[_0x2d8a('0x41')]['id']}})[_0x2d8a('0x21')](handleEntityNotFound(_0x2b4ffe,null))[_0x2d8a('0x21')](removeEntity(_0x2b4ffe,null))[_0x2d8a('0x3f')](handleError(_0x2b4ffe,null));};exports['getFields']=function(_0x4f2740,_0x355cea,_0xa15e33){var _0x492194={};var _0x35fac8={};var _0x56ea8f;var _0x33b39f;return db[_0x2d8a('0x2a')][_0x2d8a('0x46')]({'where':{'id':_0x4f2740[_0x2d8a('0x41')]['id']}})[_0x2d8a('0x21')](handleEntityNotFound(_0x355cea,null))[_0x2d8a('0x21')](function(_0x57260f){if(_0x57260f){_0x56ea8f=_0x57260f;_0x35fac8[_0x2d8a('0x2e')]=_[_0x2d8a('0x30')](db[_0x2d8a('0x47')]['rawAttributes']);_0x35fac8[_0x2d8a('0x2f')]=_[_0x2d8a('0x30')](_0x4f2740[_0x2d8a('0x2f')]);_0x35fac8[_0x2d8a('0x31')]=_[_0x2d8a('0x32')](_0x35fac8[_0x2d8a('0x2e')],_0x35fac8[_0x2d8a('0x2f')]);_0x492194[_0x2d8a('0x33')]=_[_0x2d8a('0x32')](_0x35fac8[_0x2d8a('0x2e')],qs[_0x2d8a('0x34')](_0x4f2740[_0x2d8a('0x2f')][_0x2d8a('0x34')]));_0x492194[_0x2d8a('0x33')]=_0x492194[_0x2d8a('0x33')][_0x2d8a('0x35')]?_0x492194[_0x2d8a('0x33')]:_0x35fac8['model'];_0x492194['order']=qs[_0x2d8a('0x38')](_0x4f2740[_0x2d8a('0x2f')][_0x2d8a('0x38')]);_0x492194[_0x2d8a('0x3b')]=qs[_0x2d8a('0x31')](_[_0x2d8a('0x48')](_0x4f2740[_0x2d8a('0x2f')],_0x35fac8['filters']));if(_0x4f2740[_0x2d8a('0x2f')]['filter']){_0x492194[_0x2d8a('0x3b')]=_['merge'](_0x492194[_0x2d8a('0x3b')],{'$or':_['map'](_0x492194['attributes'],function(_0x529063){var _0x1b8535={};_0x1b8535[_0x529063]={'$like':'%'+_0x4f2740['query'][_0x2d8a('0x39')]+'%'};return _0x1b8535;})});}_0x492194=_['merge']({},_0x492194,_0x4f2740[_0x2d8a('0x3c')]);return _0x56ea8f['getFields'](_0x492194);}})[_0x2d8a('0x21')](function(_0x4984f3){if(_0x4984f3){_0x33b39f=_0x4984f3[_0x2d8a('0x35')];if(!_0x4f2740[_0x2d8a('0x2f')][_0x2d8a('0x36')](_0x2d8a('0x37'))){_0x492194[_0x2d8a('0x1a')]=qs['limit'](_0x4f2740[_0x2d8a('0x2f')][_0x2d8a('0x1a')]);_0x492194[_0x2d8a('0x18')]=qs[_0x2d8a('0x18')](_0x4f2740[_0x2d8a('0x2f')][_0x2d8a('0x18')]);}return _0x56ea8f[_0x2d8a('0x49')](_0x492194);}})[_0x2d8a('0x21')](function(_0x5205e4){if(_0x5205e4){return _0x5205e4?{'count':_0x33b39f,'rows':_0x5205e4}:null;}})[_0x2d8a('0x21')](respondWithResult(_0x355cea,null))[_0x2d8a('0x3f')](handleError(_0x355cea,null));};exports[_0x2d8a('0x4a')]=function(_0x30d97c,_0x2632b9,_0x28d139){var _0xb18c52={};var _0x1a227c={};var _0x399a39;var _0x458c33;return db[_0x2d8a('0x2a')][_0x2d8a('0x46')]({'where':{'id':_0x30d97c[_0x2d8a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2632b9,null))[_0x2d8a('0x21')](function(_0x83abe1){if(_0x83abe1){_0x399a39=_0x83abe1;_0x1a227c['model']=_[_0x2d8a('0x30')](db[_0x2d8a('0x47')][_0x2d8a('0x2b')]);_0x1a227c['query']=_[_0x2d8a('0x30')](_0x30d97c[_0x2d8a('0x2f')]);_0x1a227c['filters']=_[_0x2d8a('0x32')](_0x1a227c[_0x2d8a('0x2e')],_0x1a227c[_0x2d8a('0x2f')]);_0xb18c52[_0x2d8a('0x33')]=_[_0x2d8a('0x32')](_0x1a227c[_0x2d8a('0x2e')],qs['fields'](_0x30d97c[_0x2d8a('0x2f')][_0x2d8a('0x34')]));_0xb18c52[_0x2d8a('0x33')]=_0xb18c52['attributes']['length']?_0xb18c52[_0x2d8a('0x33')]:_0x1a227c[_0x2d8a('0x2e')];_0xb18c52[_0x2d8a('0x4b')]=qs['sort'](_0x30d97c[_0x2d8a('0x2f')]['sort']);_0xb18c52[_0x2d8a('0x3b')]=qs[_0x2d8a('0x31')](_[_0x2d8a('0x48')](_0x30d97c[_0x2d8a('0x2f')],_0x1a227c['filters']));if(_0x30d97c[_0x2d8a('0x2f')][_0x2d8a('0x39')]){_0xb18c52[_0x2d8a('0x3b')]=_['merge'](_0xb18c52[_0x2d8a('0x3b')],{'$or':_[_0x2d8a('0x29')](_0xb18c52[_0x2d8a('0x33')],function(_0x2df320){var _0x55467a={};_0x55467a[_0x2df320]={'$like':'%'+_0x30d97c['query'][_0x2d8a('0x39')]+'%'};return _0x55467a;})});}_0xb18c52=_[_0x2d8a('0x3a')]({},_0xb18c52,_0x30d97c[_0x2d8a('0x3c')]);return _0x399a39['getSubjects'](_0xb18c52);}})[_0x2d8a('0x21')](function(_0x31216b){if(_0x31216b){_0x458c33=_0x31216b[_0x2d8a('0x35')];if(!_0x30d97c[_0x2d8a('0x2f')][_0x2d8a('0x36')](_0x2d8a('0x37'))){_0xb18c52['limit']=qs['limit'](_0x30d97c[_0x2d8a('0x2f')][_0x2d8a('0x1a')]);_0xb18c52[_0x2d8a('0x18')]=qs[_0x2d8a('0x18')](_0x30d97c[_0x2d8a('0x2f')]['offset']);}return _0x399a39[_0x2d8a('0x4a')](_0xb18c52);}})['then'](function(_0x44e20b){if(_0x44e20b){return _0x44e20b?{'count':_0x458c33,'rows':_0x44e20b}:null;}})[_0x2d8a('0x21')](respondWithResult(_0x2632b9,null))['catch'](handleError(_0x2632b9,null));};exports[_0x2d8a('0x4c')]=function(_0x4abfa9,_0x279053,_0x422bed){var _0x326742={};var _0x22111d={};var _0x2f41d0;var _0x4b2b01;return db[_0x2d8a('0x2a')]['findOne']({'where':{'id':_0x4abfa9[_0x2d8a('0x41')]['id']}})[_0x2d8a('0x21')](handleEntityNotFound(_0x279053,null))[_0x2d8a('0x21')](function(_0x6d2268){if(_0x6d2268){_0x2f41d0=_0x6d2268;_0x22111d['model']=_[_0x2d8a('0x30')](db[_0x2d8a('0x47')][_0x2d8a('0x2b')]);_0x22111d[_0x2d8a('0x2f')]=_['keys'](_0x4abfa9[_0x2d8a('0x2f')]);_0x22111d['filters']=_[_0x2d8a('0x32')](_0x22111d[_0x2d8a('0x2e')],_0x22111d[_0x2d8a('0x2f')]);_0x326742[_0x2d8a('0x33')]=_[_0x2d8a('0x32')](_0x22111d[_0x2d8a('0x2e')],qs[_0x2d8a('0x34')](_0x4abfa9[_0x2d8a('0x2f')][_0x2d8a('0x34')]));_0x326742['attributes']=_0x326742[_0x2d8a('0x33')][_0x2d8a('0x35')]?_0x326742[_0x2d8a('0x33')]:_0x22111d[_0x2d8a('0x2e')];_0x326742['order']=qs['sort'](_0x4abfa9[_0x2d8a('0x2f')][_0x2d8a('0x38')]);_0x326742[_0x2d8a('0x3b')]=qs[_0x2d8a('0x31')](_[_0x2d8a('0x48')](_0x4abfa9[_0x2d8a('0x2f')],_0x22111d[_0x2d8a('0x31')]));if(_0x4abfa9[_0x2d8a('0x2f')][_0x2d8a('0x39')]){_0x326742[_0x2d8a('0x3b')]=_[_0x2d8a('0x3a')](_0x326742[_0x2d8a('0x3b')],{'$or':_['map'](_0x326742[_0x2d8a('0x33')],function(_0x2b5252){var _0x4f2d47={};_0x4f2d47[_0x2b5252]={'$like':'%'+_0x4abfa9['query']['filter']+'%'};return _0x4f2d47;})});}_0x326742=_[_0x2d8a('0x3a')]({},_0x326742,_0x4abfa9['options']);return _0x2f41d0[_0x2d8a('0x4c')](_0x326742);}})[_0x2d8a('0x21')](function(_0x82d50b){if(_0x82d50b){_0x4b2b01=_0x82d50b[_0x2d8a('0x35')];if(!_0x4abfa9['query'][_0x2d8a('0x36')](_0x2d8a('0x37'))){_0x326742['limit']=qs[_0x2d8a('0x1a')](_0x4abfa9['query']['limit']);_0x326742[_0x2d8a('0x18')]=qs[_0x2d8a('0x18')](_0x4abfa9[_0x2d8a('0x2f')][_0x2d8a('0x18')]);}return _0x2f41d0[_0x2d8a('0x4c')](_0x326742);}})['then'](function(_0x42f0d5){if(_0x42f0d5){return _0x42f0d5?{'count':_0x4b2b01,'rows':_0x42f0d5}:null;}})[_0x2d8a('0x21')](respondWithResult(_0x279053,null))[_0x2d8a('0x3f')](handleError(_0x279053,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 3a0bf7b..a1adecc 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 _0xd523=['exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd523,0x153));var _0x3d52=function(_0x5cc237,_0x5e1698){_0x5cc237=_0x5cc237-0x0;var _0x33f254=_0xd523[_0x5cc237];return _0x33f254;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var logger=require(_0x3d52('0x2'))(_0x3d52('0x3'));var moment=require('moment');var BPromise=require(_0x3d52('0x4'));var rp=require(_0x3d52('0x5'));var fs=require('fs');var path=require(_0x3d52('0x6'));var rimraf=require('rimraf');var config=require(_0x3d52('0x7'));var attributes=require(_0x3d52('0x8'));module[_0x3d52('0x9')]=function(_0x46a0e9,_0x580f82){return _0x46a0e9['define'](_0x3d52('0xa'),attributes,{'tableName':_0x3d52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf682=['path','rimraf','../../config/environment','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','api','request-promise'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xf682,0x12f));var _0x2f68=function(_0x84549f,_0x27639f){_0x84549f=_0x84549f-0x0;var _0x11c5f0=_0xf682[_0x84549f];return _0x11c5f0;};'use strict';var _=require(_0x2f68('0x0'));var util=require(_0x2f68('0x1'));var logger=require(_0x2f68('0x2'))(_0x2f68('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f68('0x4'));var fs=require('fs');var path=require(_0x2f68('0x5'));var rimraf=require(_0x2f68('0x6'));var config=require(_0x2f68('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x2f68('0x8')]=function(_0x46dd32,_0x6f92f6){return _0x46dd32[_0x2f68('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x2f68('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 343cfd7..9849c34 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 _0x21dc=['then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request'];(function(_0x1672fb,_0x5b2e99){var _0x533d81=function(_0x4a4297){while(--_0x4a4297){_0x1672fb['push'](_0x1672fb['shift']());}};_0x533d81(++_0x5b2e99);}(_0x21dc,0x170));var _0xc21d=function(_0x3039be,_0x388893){_0x3039be=_0x3039be-0x0;var _0x117d51=_0x21dc[_0x3039be];return _0x117d51;};'use strict';var _=require(_0xc21d('0x0'));var util=require(_0xc21d('0x1'));var moment=require(_0xc21d('0x2'));var BPromise=require(_0xc21d('0x3'));var rs=require(_0xc21d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc21d('0x5'))['db'];var utils=require(_0xc21d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc21d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc21d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x193e3a,_0x49cd82,_0x5d849f){return new BPromise(function(_0x4be453,_0x2239df){return client[_0xc21d('0x9')](_0x193e3a,_0x5d849f)[_0xc21d('0xa')](function(_0x14cf59){logger['info'](_0xc21d('0xb'),_0x49cd82,_0xc21d('0xc'));logger[_0xc21d('0xd')](_0xc21d('0xe'),_0x49cd82,_0xc21d('0xc'),JSON[_0xc21d('0xf')](_0x14cf59));if(_0x14cf59[_0xc21d('0x10')]){if(_0x14cf59[_0xc21d('0x10')]['code']===0x1f4){logger[_0xc21d('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49cd82,_0x14cf59['error'][_0xc21d('0x11')]);return _0x2239df(_0x14cf59['error'][_0xc21d('0x11')]);}logger['error'](_0xc21d('0xb'),_0x49cd82,_0x14cf59[_0xc21d('0x10')][_0xc21d('0x11')]);return _0x4be453(_0x14cf59['error']['message']);}else{logger[_0xc21d('0x12')](_0xc21d('0xb'),_0x49cd82,_0xc21d('0xc'));_0x4be453(_0x14cf59[_0xc21d('0x13')][_0xc21d('0x11')]);}})[_0xc21d('0x14')](function(_0x4e1dc4){logger[_0xc21d('0x10')](_0xc21d('0xb'),_0x49cd82,_0x4e1dc4);_0x2239df(_0x4e1dc4);});});} \ No newline at end of file +var _0xfd20=['result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0x1347af,_0x145cae){var _0x83fc6=function(_0x1f7a92){while(--_0x1f7a92){_0x1347af['push'](_0x1347af['shift']());}};_0x83fc6(++_0x145cae);}(_0xfd20,0x66));var _0x0fd2=function(_0x339485,_0x59cb2b){_0x339485=_0x339485-0x0;var _0x3450c3=_0xfd20[_0x339485];return _0x3450c3;};'use strict';var _=require('lodash');var util=require(_0x0fd2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fd2('0x1'));var fs=require('fs');var Redis=require(_0x0fd2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fd2('0x3'));var logger=require('../../config/logger')(_0x0fd2('0x4'));var config=require(_0x0fd2('0x5'));var jayson=require(_0x0fd2('0x6'));var client=jayson[_0x0fd2('0x7')][_0x0fd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d114c,_0x55467b,_0x32d460){return new BPromise(function(_0x15ba86,_0x24d6f4){return client[_0x0fd2('0x9')](_0x4d114c,_0x32d460)[_0x0fd2('0xa')](function(_0x195948){logger[_0x0fd2('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x55467b,_0x0fd2('0xc'));logger[_0x0fd2('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x55467b,_0x0fd2('0xc'),JSON['stringify'](_0x195948));if(_0x195948[_0x0fd2('0xe')]){if(_0x195948[_0x0fd2('0xe')][_0x0fd2('0xf')]===0x1f4){logger[_0x0fd2('0xe')](_0x0fd2('0x10'),_0x55467b,_0x195948[_0x0fd2('0xe')][_0x0fd2('0x11')]);return _0x24d6f4(_0x195948[_0x0fd2('0xe')]['message']);}logger['error'](_0x0fd2('0x10'),_0x55467b,_0x195948[_0x0fd2('0xe')][_0x0fd2('0x11')]);return _0x15ba86(_0x195948[_0x0fd2('0xe')]['message']);}else{logger[_0x0fd2('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x55467b,'request\x20sent');_0x15ba86(_0x195948[_0x0fd2('0x12')]['message']);}})[_0x0fd2('0x13')](function(_0x55e070){logger[_0x0fd2('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x55467b,_0x55e070);_0x24d6f4(_0x55e070);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 6006a04..581e043 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 _0x7119=['put','/:id','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','isAuthenticated','show','post','create'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0x7119,0x114));var _0x9711=function(_0x57532c,_0x2c75cf){_0x57532c=_0x57532c-0x0;var _0x5cb9a6=_0x7119[_0x57532c];return _0x5cb9a6;};'use strict';var multer=require('multer');var util=require(_0x9711('0x0'));var path=require('path');var timeout=require(_0x9711('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9711('0x2'));var auth=require(_0x9711('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9711('0x4'));var controller=require(_0x9711('0x5'));router[_0x9711('0x6')]('/',auth['isAuthenticated'](),controller[_0x9711('0x7')]);router['get']('/:id',auth[_0x9711('0x8')](),controller[_0x9711('0x9')]);router[_0x9711('0xa')]('/',auth['isAuthenticated'](),controller[_0x9711('0xb')]);router[_0x9711('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x9711('0xd'),auth[_0x9711('0x8')](),controller[_0x9711('0xe')]);module[_0x9711('0xf')]=router; \ No newline at end of file +var _0xfe0d=['./intServicenowField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x471d67,_0x5b3d04){var _0x3e81b0=function(_0x21ff39){while(--_0x21ff39){_0x471d67['push'](_0x471d67['shift']());}};_0x3e81b0(++_0x5b3d04);}(_0xfe0d,0xc0));var _0xdfe0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfe0d[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xdfe0('0x0'));var util=require('util');var path=require(_0xdfe0('0x1'));var timeout=require(_0xdfe0('0x2'));var express=require(_0xdfe0('0x3'));var router=express[_0xdfe0('0x4')]();var fs_extra=require(_0xdfe0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdfe0('0x6'));var config=require(_0xdfe0('0x7'));var controller=require(_0xdfe0('0x8'));router[_0xdfe0('0x9')]('/',auth[_0xdfe0('0xa')](),controller[_0xdfe0('0xb')]);router[_0xdfe0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdfe0('0xc')]);router[_0xdfe0('0xd')]('/',auth[_0xdfe0('0xa')](),controller[_0xdfe0('0xe')]);router[_0xdfe0('0xf')](_0xdfe0('0x10'),auth['isAuthenticated'](),controller[_0xdfe0('0x11')]);router[_0xdfe0('0x12')](_0xdfe0('0x10'),auth[_0xdfe0('0xa')](),controller[_0xdfe0('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 70aa858..92d5316 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 _0xe6e5=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0xe6e5,0x70));var _0x5e6e=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xe6e5[_0x56916d];return _0x2b7f1f;};'use strict';var Sequelize=require(_0x5e6e('0x0'));module[_0x5e6e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5e6e('0x2'),_0x5e6e('0x3'),_0x5e6e('0x4'),_0x5e6e('0x5'),_0x5e6e('0x6')),'defaultValue':_0x5e6e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5e6e('0x7')]},'keyType':{'type':Sequelize[_0x5e6e('0x8')](_0x5e6e('0x2'),_0x5e6e('0x3'),_0x5e6e('0x4'))},'keyContent':{'type':Sequelize[_0x5e6e('0x7')]},'idField':{'type':Sequelize[_0x5e6e('0x7')]},'nameField':{'type':Sequelize[_0x5e6e('0x7')]},'customField':{'type':Sequelize[_0x5e6e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5e6e('0x7')]}}; \ No newline at end of file +var _0xab79=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x116323,_0x4957b5){var _0x26706b=function(_0x2bfd82){while(--_0x2bfd82){_0x116323['push'](_0x116323['shift']());}};_0x26706b(++_0x4957b5);}(_0xab79,0xa1));var _0x9ab7=function(_0x4a59a4,_0x27e2f5){_0x4a59a4=_0x4a59a4-0x0;var _0x33d1d7=_0xab79[_0x4a59a4];return _0x33d1d7;};'use strict';var Sequelize=require('sequelize');module[_0x9ab7('0x0')]={'type':{'type':Sequelize[_0x9ab7('0x1')](_0x9ab7('0x2'),_0x9ab7('0x3'),_0x9ab7('0x4'),'keyValue','picklist'),'defaultValue':_0x9ab7('0x2')},'content':{'type':Sequelize[_0x9ab7('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9ab7('0x2'),_0x9ab7('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9ab7('0x5')]},'nameField':{'type':Sequelize[_0x9ab7('0x5')]},'customField':{'type':Sequelize[_0x9ab7('0x6')],'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 14204c1..cd98073 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 _0xa9cc=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','ServicenowField','rawAttributes','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','rows','catch','show','keys','include','options','find','create','body','params','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x20a95f,_0x55ccd0){var _0x37602a=function(_0xf3e72b){while(--_0xf3e72b){_0x20a95f['push'](_0x20a95f['shift']());}};_0x37602a(++_0x55ccd0);}(_0xa9cc,0x89));var _0xca9c=function(_0x3405fc,_0x1f3f11){_0x3405fc=_0x3405fc-0x0;var _0x365525=_0xa9cc[_0x3405fc];return _0x365525;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xca9c('0x0'));var rp=require(_0xca9c('0x1'));var moment=require(_0xca9c('0x2'));var BPromise=require(_0xca9c('0x3'));var Mustache=require(_0xca9c('0x4'));var util=require(_0xca9c('0x5'));var path=require(_0xca9c('0x6'));var sox=require(_0xca9c('0x7'));var csv=require(_0xca9c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca9c('0x9'));var _=require('lodash');var squel=require(_0xca9c('0xa'));var crypto=require(_0xca9c('0xb'));var jsforce=require(_0xca9c('0xc'));var deskjs=require(_0xca9c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xca9c('0xe'));var Papa=require(_0xca9c('0xf'));var Redis=require(_0xca9c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xca9c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca9c('0x12'));var logger=require(_0xca9c('0x13'))(_0xca9c('0x14'));var utils=require(_0xca9c('0x15'));var config=require(_0xca9c('0x16'));var licenseUtil=require(_0xca9c('0x17'));var db=require(_0xca9c('0x18'))['db'];function respondWithStatusCode(_0x4d2c76,_0x29403a){_0x29403a=_0x29403a||0xcc;return function(_0x2ea67a){if(_0x2ea67a){return _0x4d2c76['sendStatus'](_0x29403a);}return _0x4d2c76['status'](_0x29403a)[_0xca9c('0x19')]();};}function respondWithResult(_0x27e866,_0x693ea4){_0x693ea4=_0x693ea4||0xc8;return function(_0x3ccceb){if(_0x3ccceb){return _0x27e866['status'](_0x693ea4)[_0xca9c('0x1a')](_0x3ccceb);}};}function respondWithFilteredResult(_0x40501f,_0x2f8528){return function(_0x478dc1){if(_0x478dc1){var _0x2e02ba=typeof _0x2f8528[_0xca9c('0x1b')]===_0xca9c('0x1c')&&typeof _0x2f8528[_0xca9c('0x1d')]===_0xca9c('0x1c');var _0x1479d0=_0x478dc1[_0xca9c('0x1e')];var _0x190add=_0x2e02ba?0x0:_0x2f8528[_0xca9c('0x1b')];var _0x469b9d=_0x2e02ba?_0x478dc1[_0xca9c('0x1e')]:_0x2f8528['offset']+_0x2f8528[_0xca9c('0x1d')];var _0xd061a8;if(_0x469b9d>=_0x1479d0){_0x469b9d=_0x1479d0;_0xd061a8=0xc8;}else{_0xd061a8=0xce;}_0x40501f[_0xca9c('0x1f')](_0xd061a8);return _0x40501f[_0xca9c('0x20')](_0xca9c('0x21'),_0x190add+'-'+_0x469b9d+'/'+_0x1479d0)[_0xca9c('0x1a')](_0x478dc1);}return null;};}function patchUpdates(_0x1c9c27){return function(_0x4e10ee){try{jsonpatch[_0xca9c('0x22')](_0x4e10ee,_0x1c9c27,!![]);}catch(_0xa7960e){return BPromise[_0xca9c('0x23')](_0xa7960e);}return _0x4e10ee['save']();};}function saveUpdates(_0x264e6d,_0x53784e){return function(_0x21cef9){if(_0x21cef9){return _0x21cef9[_0xca9c('0x24')](_0x264e6d)[_0xca9c('0x25')](function(_0x20fe2c){return _0x20fe2c;});}return null;};}function removeEntity(_0x29ec33,_0x20f02e){return function(_0x310abd){if(_0x310abd){return _0x310abd['destroy']()[_0xca9c('0x25')](function(){_0x29ec33[_0xca9c('0x1f')](0xcc)[_0xca9c('0x19')]();});}};}function handleEntityNotFound(_0x431fcc,_0x315290){return function(_0x95fed3){if(!_0x95fed3){_0x431fcc[_0xca9c('0x26')](0x194);}return _0x95fed3;};}function handleError(_0xfa6235,_0x5afd4f){_0x5afd4f=_0x5afd4f||0x1f4;return function(_0x3c1a1b){logger[_0xca9c('0x27')](_0x3c1a1b[_0xca9c('0x28')]);if(_0x3c1a1b[_0xca9c('0x29')]){delete _0x3c1a1b[_0xca9c('0x29')];}_0xfa6235[_0xca9c('0x1f')](_0x5afd4f)[_0xca9c('0x2a')](_0x3c1a1b);};}exports[_0xca9c('0x2b')]=function(_0x418925,_0x449b7b){var _0x1b7c23={},_0x23a28d={},_0x266438={'count':0x0,'rows':[]};var _0x1e0c16=_[_0xca9c('0x2c')](db[_0xca9c('0x2d')][_0xca9c('0x2e')],function(_0x1d618e){return{'name':_0x1d618e['fieldName'],'type':_0x1d618e['type'][_0xca9c('0x2f')]};});_0x23a28d['model']=_[_0xca9c('0x2c')](_0x1e0c16,'name');_0x23a28d['query']=_['keys'](_0x418925[_0xca9c('0x30')]);_0x23a28d[_0xca9c('0x31')]=_['intersection'](_0x23a28d[_0xca9c('0x32')],_0x23a28d['query']);_0x1b7c23[_0xca9c('0x33')]=_[_0xca9c('0x34')](_0x23a28d['model'],qs['fields'](_0x418925[_0xca9c('0x30')][_0xca9c('0x35')]));_0x1b7c23[_0xca9c('0x33')]=_0x1b7c23['attributes'][_0xca9c('0x36')]?_0x1b7c23[_0xca9c('0x33')]:_0x23a28d[_0xca9c('0x32')];if(!_0x418925[_0xca9c('0x30')][_0xca9c('0x37')](_0xca9c('0x38'))){_0x1b7c23['limit']=qs[_0xca9c('0x1d')](_0x418925[_0xca9c('0x30')][_0xca9c('0x1d')]);_0x1b7c23[_0xca9c('0x1b')]=qs[_0xca9c('0x1b')](_0x418925[_0xca9c('0x30')][_0xca9c('0x1b')]);}_0x1b7c23[_0xca9c('0x39')]=qs[_0xca9c('0x3a')](_0x418925[_0xca9c('0x30')][_0xca9c('0x3a')]);_0x1b7c23[_0xca9c('0x3b')]=qs[_0xca9c('0x31')](_['pick'](_0x418925[_0xca9c('0x30')],_0x23a28d[_0xca9c('0x31')]),_0x1e0c16);if(_0x418925[_0xca9c('0x30')][_0xca9c('0x3c')]){_0x1b7c23[_0xca9c('0x3b')]=_[_0xca9c('0x3d')](_0x1b7c23[_0xca9c('0x3b')],{'$or':_[_0xca9c('0x2c')](_0x1e0c16,function(_0x168cfe){if(_0x168cfe[_0xca9c('0x3e')]!==_0xca9c('0x3f')){var _0x1777e7={};_0x1777e7[_0x168cfe['name']]={'$like':'%'+_0x418925['query']['filter']+'%'};return _0x1777e7;}})});}_0x1b7c23=_[_0xca9c('0x3d')]({},_0x1b7c23,_0x418925['options']);var _0x172d13={'where':_0x1b7c23[_0xca9c('0x3b')]};return db[_0xca9c('0x2d')][_0xca9c('0x1e')](_0x172d13)[_0xca9c('0x25')](function(_0x4af1fe){_0x266438[_0xca9c('0x1e')]=_0x4af1fe;if(_0x418925[_0xca9c('0x30')][_0xca9c('0x40')]){_0x1b7c23['include']=[{'all':!![]}];}return db[_0xca9c('0x2d')]['findAll'](_0x1b7c23);})[_0xca9c('0x25')](function(_0x1d165b){_0x266438[_0xca9c('0x41')]=_0x1d165b;return _0x266438;})[_0xca9c('0x25')](respondWithFilteredResult(_0x449b7b,_0x1b7c23))[_0xca9c('0x42')](handleError(_0x449b7b,null));};exports[_0xca9c('0x43')]=function(_0x32d967,_0x3b1a10){var _0xb3e95={'raw':!![],'where':{'id':_0x32d967['params']['id']}},_0x30f4e3={};_0x30f4e3[_0xca9c('0x32')]=_[_0xca9c('0x44')](db[_0xca9c('0x2d')]['rawAttributes']);_0x30f4e3[_0xca9c('0x30')]=_[_0xca9c('0x44')](_0x32d967[_0xca9c('0x30')]);_0x30f4e3['filters']=_['intersection'](_0x30f4e3[_0xca9c('0x32')],_0x30f4e3[_0xca9c('0x30')]);_0xb3e95[_0xca9c('0x33')]=_[_0xca9c('0x34')](_0x30f4e3[_0xca9c('0x32')],qs[_0xca9c('0x35')](_0x32d967[_0xca9c('0x30')][_0xca9c('0x35')]));_0xb3e95[_0xca9c('0x33')]=_0xb3e95['attributes'][_0xca9c('0x36')]?_0xb3e95[_0xca9c('0x33')]:_0x30f4e3[_0xca9c('0x32')];if(_0x32d967[_0xca9c('0x30')][_0xca9c('0x40')]){_0xb3e95[_0xca9c('0x45')]=[{'all':!![]}];}_0xb3e95=_[_0xca9c('0x3d')]({},_0xb3e95,_0x32d967[_0xca9c('0x46')]);return db[_0xca9c('0x2d')][_0xca9c('0x47')](_0xb3e95)[_0xca9c('0x25')](handleEntityNotFound(_0x3b1a10,null))[_0xca9c('0x25')](respondWithResult(_0x3b1a10,null))[_0xca9c('0x42')](handleError(_0x3b1a10,null));};exports[_0xca9c('0x48')]=function(_0x1a242d,_0x1dcf7e){return db[_0xca9c('0x2d')][_0xca9c('0x48')](_0x1a242d[_0xca9c('0x49')],{})[_0xca9c('0x25')](respondWithResult(_0x1dcf7e,0xc9))[_0xca9c('0x42')](handleError(_0x1dcf7e,null));};exports[_0xca9c('0x24')]=function(_0x242fd4,_0x3e06c8){if(_0x242fd4['body']['id']){delete _0x242fd4['body']['id'];}return db[_0xca9c('0x2d')]['find']({'where':{'id':_0x242fd4[_0xca9c('0x4a')]['id']}})[_0xca9c('0x25')](handleEntityNotFound(_0x3e06c8,null))['then'](saveUpdates(_0x242fd4[_0xca9c('0x49')],null))[_0xca9c('0x25')](respondWithResult(_0x3e06c8,null))[_0xca9c('0x42')](handleError(_0x3e06c8,null));};exports[_0xca9c('0x4b')]=function(_0x3feb68,_0x24fb02){return db[_0xca9c('0x2d')][_0xca9c('0x47')]({'where':{'id':_0x3feb68[_0xca9c('0x4a')]['id']}})[_0xca9c('0x25')](handleEntityNotFound(_0x24fb02,null))[_0xca9c('0x25')](removeEntity(_0x24fb02,null))[_0xca9c('0x42')](handleError(_0x24fb02,null));}; \ No newline at end of file +var _0xedb1=['ServicenowField','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','rows','catch','show','params','fields','include','options','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map'];(function(_0x18e686,_0x152bcc){var _0x2016de=function(_0x62dd90){while(--_0x62dd90){_0x18e686['push'](_0x18e686['shift']());}};_0x2016de(++_0x152bcc);}(_0xedb1,0x13b));var _0x1edb=function(_0x425111,_0x11f3d8){_0x425111=_0x425111-0x0;var _0x5206eb=_0xedb1[_0x425111];return _0x5206eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1edb('0x0'));var zipdir=require(_0x1edb('0x1'));var jsonpatch=require(_0x1edb('0x2'));var rp=require('request-promise');var moment=require(_0x1edb('0x3'));var BPromise=require(_0x1edb('0x4'));var Mustache=require(_0x1edb('0x5'));var util=require(_0x1edb('0x6'));var path=require(_0x1edb('0x7'));var sox=require(_0x1edb('0x8'));var csv=require(_0x1edb('0x9'));var ejs=require(_0x1edb('0xa'));var fs=require('fs');var fs_extra=require(_0x1edb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1edb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1edb('0x9'));var querystring=require(_0x1edb('0xd'));var Papa=require(_0x1edb('0xe'));var Redis=require(_0x1edb('0xf'));var authService=require(_0x1edb('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1edb('0x11'))(_0x1edb('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1edb('0x13'));var db=require(_0x1edb('0x14'))['db'];function respondWithStatusCode(_0x1f5ec3,_0xf574b0){_0xf574b0=_0xf574b0||0xcc;return function(_0x21eb0c){if(_0x21eb0c){return _0x1f5ec3[_0x1edb('0x15')](_0xf574b0);}return _0x1f5ec3[_0x1edb('0x16')](_0xf574b0)[_0x1edb('0x17')]();};}function respondWithResult(_0x46a4b6,_0x14472e){_0x14472e=_0x14472e||0xc8;return function(_0x119bcf){if(_0x119bcf){return _0x46a4b6[_0x1edb('0x16')](_0x14472e)[_0x1edb('0x18')](_0x119bcf);}};}function respondWithFilteredResult(_0x2dc8d3,_0x31a0f2){return function(_0x16d8c8){if(_0x16d8c8){var _0xa659d5=typeof _0x31a0f2[_0x1edb('0x19')]==='undefined'&&typeof _0x31a0f2[_0x1edb('0x1a')]==='undefined';var _0x1415b9=_0x16d8c8[_0x1edb('0x1b')];var _0x592055=_0xa659d5?0x0:_0x31a0f2['offset'];var _0xbd5bae=_0xa659d5?_0x16d8c8[_0x1edb('0x1b')]:_0x31a0f2[_0x1edb('0x19')]+_0x31a0f2[_0x1edb('0x1a')];var _0x5bc758;if(_0xbd5bae>=_0x1415b9){_0xbd5bae=_0x1415b9;_0x5bc758=0xc8;}else{_0x5bc758=0xce;}_0x2dc8d3[_0x1edb('0x16')](_0x5bc758);return _0x2dc8d3[_0x1edb('0x1c')](_0x1edb('0x1d'),_0x592055+'-'+_0xbd5bae+'/'+_0x1415b9)[_0x1edb('0x18')](_0x16d8c8);}return null;};}function patchUpdates(_0x45d50b){return function(_0x4848a4){try{jsonpatch[_0x1edb('0x1e')](_0x4848a4,_0x45d50b,!![]);}catch(_0x20ccaf){return BPromise['reject'](_0x20ccaf);}return _0x4848a4['save']();};}function saveUpdates(_0x5830bb,_0x6a52ae){return function(_0x38d533){if(_0x38d533){return _0x38d533[_0x1edb('0x1f')](_0x5830bb)[_0x1edb('0x20')](function(_0x5dbeb3){return _0x5dbeb3;});}return null;};}function removeEntity(_0x4adbe4,_0x54092a){return function(_0x17cb31){if(_0x17cb31){return _0x17cb31[_0x1edb('0x21')]()[_0x1edb('0x20')](function(){_0x4adbe4['status'](0xcc)[_0x1edb('0x17')]();});}};}function handleEntityNotFound(_0x17f1fd,_0x305479){return function(_0x1c426c){if(!_0x1c426c){_0x17f1fd['sendStatus'](0x194);}return _0x1c426c;};}function handleError(_0x47c9b2,_0x5dd831){_0x5dd831=_0x5dd831||0x1f4;return function(_0x1dc10d){logger[_0x1edb('0x22')](_0x1dc10d[_0x1edb('0x23')]);if(_0x1dc10d[_0x1edb('0x24')]){delete _0x1dc10d['name'];}_0x47c9b2[_0x1edb('0x16')](_0x5dd831)[_0x1edb('0x25')](_0x1dc10d);};}exports[_0x1edb('0x26')]=function(_0x2bea8a,_0x23d9b5){var _0x7e9cb4={},_0x5d513f={},_0x2e389b={'count':0x0,'rows':[]};var _0x56ef25=_[_0x1edb('0x27')](db[_0x1edb('0x28')]['rawAttributes'],function(_0xb7ae78){return{'name':_0xb7ae78[_0x1edb('0x29')],'type':_0xb7ae78['type'][_0x1edb('0x2a')]};});_0x5d513f[_0x1edb('0x2b')]=_[_0x1edb('0x27')](_0x56ef25,'name');_0x5d513f[_0x1edb('0x2c')]=_[_0x1edb('0x2d')](_0x2bea8a['query']);_0x5d513f[_0x1edb('0x2e')]=_[_0x1edb('0x2f')](_0x5d513f[_0x1edb('0x2b')],_0x5d513f[_0x1edb('0x2c')]);_0x7e9cb4[_0x1edb('0x30')]=_['intersection'](_0x5d513f['model'],qs['fields'](_0x2bea8a[_0x1edb('0x2c')]['fields']));_0x7e9cb4[_0x1edb('0x30')]=_0x7e9cb4['attributes'][_0x1edb('0x31')]?_0x7e9cb4[_0x1edb('0x30')]:_0x5d513f['model'];if(!_0x2bea8a['query'][_0x1edb('0x32')](_0x1edb('0x33'))){_0x7e9cb4[_0x1edb('0x1a')]=qs[_0x1edb('0x1a')](_0x2bea8a[_0x1edb('0x2c')][_0x1edb('0x1a')]);_0x7e9cb4['offset']=qs[_0x1edb('0x19')](_0x2bea8a[_0x1edb('0x2c')]['offset']);}_0x7e9cb4[_0x1edb('0x34')]=qs[_0x1edb('0x35')](_0x2bea8a[_0x1edb('0x2c')][_0x1edb('0x35')]);_0x7e9cb4[_0x1edb('0x36')]=qs[_0x1edb('0x2e')](_[_0x1edb('0x37')](_0x2bea8a['query'],_0x5d513f[_0x1edb('0x2e')]),_0x56ef25);if(_0x2bea8a[_0x1edb('0x2c')][_0x1edb('0x38')]){_0x7e9cb4['where']=_[_0x1edb('0x39')](_0x7e9cb4['where'],{'$or':_['map'](_0x56ef25,function(_0x162968){if(_0x162968[_0x1edb('0x3a')]!==_0x1edb('0x3b')){var _0x268ee9={};_0x268ee9[_0x162968[_0x1edb('0x24')]]={'$like':'%'+_0x2bea8a['query']['filter']+'%'};return _0x268ee9;}})});}_0x7e9cb4=_[_0x1edb('0x39')]({},_0x7e9cb4,_0x2bea8a['options']);var _0x29c719={'where':_0x7e9cb4['where']};return db['ServicenowField']['count'](_0x29c719)[_0x1edb('0x20')](function(_0x5dc681){_0x2e389b[_0x1edb('0x1b')]=_0x5dc681;if(_0x2bea8a['query'][_0x1edb('0x3c')]){_0x7e9cb4['include']=[{'all':!![]}];}return db[_0x1edb('0x28')]['findAll'](_0x7e9cb4);})['then'](function(_0x25850d){_0x2e389b[_0x1edb('0x3d')]=_0x25850d;return _0x2e389b;})[_0x1edb('0x20')](respondWithFilteredResult(_0x23d9b5,_0x7e9cb4))[_0x1edb('0x3e')](handleError(_0x23d9b5,null));};exports[_0x1edb('0x3f')]=function(_0x33844c,_0xd0d80c){var _0xacb36d={'raw':!![],'where':{'id':_0x33844c[_0x1edb('0x40')]['id']}},_0x6b0efc={};_0x6b0efc[_0x1edb('0x2b')]=_[_0x1edb('0x2d')](db['ServicenowField']['rawAttributes']);_0x6b0efc[_0x1edb('0x2c')]=_[_0x1edb('0x2d')](_0x33844c[_0x1edb('0x2c')]);_0x6b0efc['filters']=_[_0x1edb('0x2f')](_0x6b0efc['model'],_0x6b0efc[_0x1edb('0x2c')]);_0xacb36d[_0x1edb('0x30')]=_[_0x1edb('0x2f')](_0x6b0efc['model'],qs['fields'](_0x33844c['query'][_0x1edb('0x41')]));_0xacb36d['attributes']=_0xacb36d[_0x1edb('0x30')][_0x1edb('0x31')]?_0xacb36d[_0x1edb('0x30')]:_0x6b0efc[_0x1edb('0x2b')];if(_0x33844c['query'][_0x1edb('0x3c')]){_0xacb36d[_0x1edb('0x42')]=[{'all':!![]}];}_0xacb36d=_[_0x1edb('0x39')]({},_0xacb36d,_0x33844c[_0x1edb('0x43')]);return db['ServicenowField'][_0x1edb('0x44')](_0xacb36d)['then'](handleEntityNotFound(_0xd0d80c,null))[_0x1edb('0x20')](respondWithResult(_0xd0d80c,null))[_0x1edb('0x3e')](handleError(_0xd0d80c,null));};exports[_0x1edb('0x45')]=function(_0x69d9c8,_0x45d30a){return db[_0x1edb('0x28')]['create'](_0x69d9c8[_0x1edb('0x46')],{})[_0x1edb('0x20')](respondWithResult(_0x45d30a,0xc9))[_0x1edb('0x3e')](handleError(_0x45d30a,null));};exports['update']=function(_0x2705e1,_0x3f8149){if(_0x2705e1[_0x1edb('0x46')]['id']){delete _0x2705e1[_0x1edb('0x46')]['id'];}return db[_0x1edb('0x28')]['find']({'where':{'id':_0x2705e1[_0x1edb('0x40')]['id']}})[_0x1edb('0x20')](handleEntityNotFound(_0x3f8149,null))['then'](saveUpdates(_0x2705e1[_0x1edb('0x46')],null))[_0x1edb('0x20')](respondWithResult(_0x3f8149,null))[_0x1edb('0x3e')](handleError(_0x3f8149,null));};exports[_0x1edb('0x21')]=function(_0x4cfab9,_0x48a8b4){return db['ServicenowField'][_0x1edb('0x44')]({'where':{'id':_0x4cfab9[_0x1edb('0x40')]['id']}})[_0x1edb('0x20')](handleEntityNotFound(_0x48a8b4,null))[_0x1edb('0x20')](removeEntity(_0x48a8b4,null))['catch'](handleError(_0x48a8b4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index f2ebb5f..72ea576 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 _0x78dc=['int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x78dc,0x199));var _0xc78d=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0x78dc[_0x3ff2f9];return _0x3b0913;};'use strict';var _=require(_0xc78d('0x0'));var util=require('util');var logger=require(_0xc78d('0x1'))(_0xc78d('0x2'));var moment=require(_0xc78d('0x3'));var BPromise=require(_0xc78d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc78d('0x5'));var rimraf=require(_0xc78d('0x6'));var config=require(_0xc78d('0x7'));var attributes=require(_0xc78d('0x8'));module[_0xc78d('0x9')]=function(_0x2ebc33,_0xd55dc){return _0x2ebc33['define'](_0xc78d('0xa'),attributes,{'tableName':_0xc78d('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xc78d('0xc'),_0xc78d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa428=['moment','bluebird','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','api'];(function(_0x48a73e,_0x39f1ac){var _0x390c0b=function(_0x369beb){while(--_0x369beb){_0x48a73e['push'](_0x48a73e['shift']());}};_0x390c0b(++_0x39f1ac);}(_0xa428,0x185));var _0x8a42=function(_0x348be8,_0x5f2e09){_0x348be8=_0x348be8-0x0;var _0x52abd9=_0xa428[_0x348be8];return _0x52abd9;};'use strict';var _=require(_0x8a42('0x0'));var util=require(_0x8a42('0x1'));var logger=require('../../config/logger')(_0x8a42('0x2'));var moment=require(_0x8a42('0x3'));var BPromise=require(_0x8a42('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8a42('0x5'));var config=require(_0x8a42('0x6'));var attributes=require(_0x8a42('0x7'));module[_0x8a42('0x8')]=function(_0x11e1dc,_0x3d8829){return _0x11e1dc[_0x8a42('0x9')](_0x8a42('0xa'),attributes,{'tableName':_0x8a42('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x8a42('0xc'),_0x8a42('0xd')],'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 5f2d1b4..1a6ef01 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 _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x20b035,_0x33e530){_0x20b035=_0x20b035-0x0;var _0x26d5ec=_0xbdb7[_0x20b035];return _0x26d5ec;};'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);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1062e3,_0x49349e){var _0x92e616=function(_0x1ca4fe){while(--_0x1ca4fe){_0x1062e3['push'](_0x1062e3['shift']());}};_0x92e616(++_0x49349e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1c9428,_0x53c35f){_0x1c9428=_0x1c9428-0x0;var _0x56f37b=_0xf4eb[_0x1c9428];return _0x56f37b;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index d57b67f..8635708 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x141b5c,_0x5b1b7d){var _0x51e450=function(_0x18b954){while(--_0x18b954){_0x141b5c['push'](_0x141b5c['shift']());}};_0x51e450(++_0x5b1b7d);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2dbb29,_0x4d99b0){var _0x16a1bb=function(_0x25f111){while(--_0x25f111){_0x2dbb29['push'](_0x2dbb29['shift']());}};_0x16a1bb(++_0x4d99b0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index dd9cb5a..869ffe5 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(_0x4c4150,_0x10a89c){var _0x342e66=function(_0xb8aa43){while(--_0xb8aa43){_0x4c4150['push'](_0x4c4150['shift']());}};_0x342e66(++_0x10a89c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x4397e8,_0x44ebe4){var _0x11190a=function(_0x5aa805){while(--_0x5aa805){_0x4397e8['push'](_0x4397e8['shift']());}};_0x11190a(++_0x44ebe4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 bbef91e..4a15f30 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 _0x245e=['util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','limit','offset','set','Content-Range','apply','save','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','nolimit','order','sort','where','filters','pick','merge','filter','options','SugarcrmAccount','count','include','rows','show','params','keys','includeAll','find','catch','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','length','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','module_fields','remove','includes','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache'];(function(_0x2301a5,_0x5018a1){var _0x2caf9d=function(_0x49d674){while(--_0x49d674){_0x2301a5['push'](_0x2301a5['shift']());}};_0x2caf9d(++_0x5018a1);}(_0x245e,0x15f));var _0xe245=function(_0x1059dc,_0x4f3e5a){_0x1059dc=_0x1059dc-0x0;var _0x3e8bab=_0x245e[_0x1059dc];return _0x3e8bab;};'use strict';var emlformat=require(_0xe245('0x0'));var rimraf=require(_0xe245('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe245('0x2'));var rp=require(_0xe245('0x3'));var moment=require(_0xe245('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe245('0x5'));var util=require(_0xe245('0x6'));var path=require(_0xe245('0x7'));var sox=require('sox');var csv=require(_0xe245('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe245('0x9'));var _=require('lodash');var squel=require(_0xe245('0xa'));var crypto=require(_0xe245('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe245('0xc'));var toCsv=require(_0xe245('0x8'));var querystring=require(_0xe245('0xd'));var Papa=require(_0xe245('0xe'));var Redis=require(_0xe245('0xf'));var authService=require(_0xe245('0x10'));var qs=require(_0xe245('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe245('0x12'))(_0xe245('0x13'));var utils=require('../../config/utils');var config=require(_0xe245('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe245('0x15'))['db'];var integrations=require(_0xe245('0x16'));function respondWithStatusCode(_0x536a0,_0x11cba3){_0x11cba3=_0x11cba3||0xcc;return function(_0x2cd99d){if(_0x2cd99d){return _0x536a0['sendStatus'](_0x11cba3);}return _0x536a0[_0xe245('0x17')](_0x11cba3)['end']();};}function respondWithResult(_0x2149a4,_0x488c8d){_0x488c8d=_0x488c8d||0xc8;return function(_0x995ee1){if(_0x995ee1){return _0x2149a4[_0xe245('0x17')](_0x488c8d)[_0xe245('0x18')](_0x995ee1);}};}function respondWithFilteredResult(_0x2dbcf2,_0x543545){return function(_0x2e2588){if(_0x2e2588){var _0x29722f=typeof _0x543545['offset']==='undefined'&&typeof _0x543545[_0xe245('0x19')]==='undefined';var _0x5054b1=_0x2e2588['count'];var _0x4d9a69=_0x29722f?0x0:_0x543545['offset'];var _0x4e7370=_0x29722f?_0x2e2588['count']:_0x543545[_0xe245('0x1a')]+_0x543545['limit'];var _0x59a5dd;if(_0x4e7370>=_0x5054b1){_0x4e7370=_0x5054b1;_0x59a5dd=0xc8;}else{_0x59a5dd=0xce;}_0x2dbcf2['status'](_0x59a5dd);return _0x2dbcf2[_0xe245('0x1b')](_0xe245('0x1c'),_0x4d9a69+'-'+_0x4e7370+'/'+_0x5054b1)['json'](_0x2e2588);}return null;};}function patchUpdates(_0x234c44){return function(_0xcdb6f6){try{jsonpatch[_0xe245('0x1d')](_0xcdb6f6,_0x234c44,!![]);}catch(_0x5487b0){return BPromise['reject'](_0x5487b0);}return _0xcdb6f6[_0xe245('0x1e')]();};}function saveUpdates(_0x418c29,_0x299e6c){return function(_0xe2e764){if(_0xe2e764){return _0xe2e764['update'](_0x418c29)[_0xe245('0x1f')](function(_0x15c24f){return _0x15c24f;});}return null;};}function removeEntity(_0x4c54c1,_0x2bc638){return function(_0x562780){if(_0x562780){return _0x562780['destroy']()[_0xe245('0x1f')](function(){_0x4c54c1[_0xe245('0x17')](0xcc)[_0xe245('0x20')]();});}};}function handleEntityNotFound(_0x31321e,_0x15d3fb){return function(_0xb4bef7){if(!_0xb4bef7){_0x31321e[_0xe245('0x21')](0x194);}return _0xb4bef7;};}function handleError(_0x237a13,_0x128a71){_0x128a71=_0x128a71||0x1f4;return function(_0x390a16){logger[_0xe245('0x22')](_0x390a16[_0xe245('0x23')]);if(_0x390a16['name']){delete _0x390a16[_0xe245('0x24')];}_0x237a13['status'](_0x128a71)[_0xe245('0x25')](_0x390a16);};}exports[_0xe245('0x26')]=function(_0x1a7c68,_0x441274){var _0x527473={},_0x529a91={},_0x3dbfca={'count':0x0,'rows':[]};var _0x43e954=_[_0xe245('0x27')](db['SugarcrmAccount'][_0xe245('0x28')],function(_0x14a0cf){return{'name':_0x14a0cf[_0xe245('0x29')],'type':_0x14a0cf[_0xe245('0x2a')][_0xe245('0x2b')]};});_0x529a91['model']=_['map'](_0x43e954,_0xe245('0x24'));_0x529a91[_0xe245('0x2c')]=_['keys'](_0x1a7c68[_0xe245('0x2c')]);_0x529a91['filters']=_[_0xe245('0x2d')](_0x529a91[_0xe245('0x2e')],_0x529a91[_0xe245('0x2c')]);_0x527473['attributes']=_[_0xe245('0x2d')](_0x529a91[_0xe245('0x2e')],qs[_0xe245('0x2f')](_0x1a7c68[_0xe245('0x2c')]['fields']));_0x527473[_0xe245('0x30')]=_0x527473[_0xe245('0x30')]['length']?_0x527473[_0xe245('0x30')]:_0x529a91[_0xe245('0x2e')];if(!_0x1a7c68[_0xe245('0x2c')]['hasOwnProperty'](_0xe245('0x31'))){_0x527473[_0xe245('0x19')]=qs['limit'](_0x1a7c68['query'][_0xe245('0x19')]);_0x527473['offset']=qs['offset'](_0x1a7c68[_0xe245('0x2c')][_0xe245('0x1a')]);}_0x527473[_0xe245('0x32')]=qs[_0xe245('0x33')](_0x1a7c68[_0xe245('0x2c')][_0xe245('0x33')]);_0x527473[_0xe245('0x34')]=qs[_0xe245('0x35')](_[_0xe245('0x36')](_0x1a7c68[_0xe245('0x2c')],_0x529a91['filters']),_0x43e954);if(_0x1a7c68[_0xe245('0x2c')]['filter']){_0x527473[_0xe245('0x34')]=_[_0xe245('0x37')](_0x527473[_0xe245('0x34')],{'$or':_[_0xe245('0x27')](_0x43e954,function(_0x499357){if(_0x499357[_0xe245('0x2a')]!=='VIRTUAL'){var _0x1b7afb={};_0x1b7afb[_0x499357[_0xe245('0x24')]]={'$like':'%'+_0x1a7c68[_0xe245('0x2c')][_0xe245('0x38')]+'%'};return _0x1b7afb;}})});}_0x527473=_[_0xe245('0x37')]({},_0x527473,_0x1a7c68[_0xe245('0x39')]);var _0x8d0bc4={'where':_0x527473[_0xe245('0x34')]};return db[_0xe245('0x3a')]['count'](_0x8d0bc4)[_0xe245('0x1f')](function(_0x56470f){_0x3dbfca[_0xe245('0x3b')]=_0x56470f;if(_0x1a7c68[_0xe245('0x2c')]['includeAll']){_0x527473[_0xe245('0x3c')]=[{'all':!![]}];}return db[_0xe245('0x3a')]['findAll'](_0x527473);})[_0xe245('0x1f')](function(_0x508f24){_0x3dbfca[_0xe245('0x3d')]=_0x508f24;return _0x3dbfca;})[_0xe245('0x1f')](respondWithFilteredResult(_0x441274,_0x527473))['catch'](handleError(_0x441274,null));};exports[_0xe245('0x3e')]=function(_0x4bbc87,_0x31c68a){var _0x24c2a3={'raw':![],'where':{'id':_0x4bbc87[_0xe245('0x3f')]['id']}},_0x1e2967={};_0x1e2967[_0xe245('0x2e')]=_['keys'](db[_0xe245('0x3a')][_0xe245('0x28')]);_0x1e2967[_0xe245('0x2c')]=_[_0xe245('0x40')](_0x4bbc87[_0xe245('0x2c')]);_0x1e2967[_0xe245('0x35')]=_['intersection'](_0x1e2967[_0xe245('0x2e')],_0x1e2967['query']);_0x24c2a3[_0xe245('0x30')]=_[_0xe245('0x2d')](_0x1e2967[_0xe245('0x2e')],qs[_0xe245('0x2f')](_0x4bbc87['query'][_0xe245('0x2f')]));_0x24c2a3[_0xe245('0x30')]=_0x24c2a3[_0xe245('0x30')]['length']?_0x24c2a3['attributes']:_0x1e2967[_0xe245('0x2e')];if(_0x4bbc87['query'][_0xe245('0x41')]){_0x24c2a3[_0xe245('0x3c')]=[{'all':!![]}];}_0x24c2a3=_[_0xe245('0x37')]({},_0x24c2a3,_0x4bbc87[_0xe245('0x39')]);return db[_0xe245('0x3a')][_0xe245('0x42')](_0x24c2a3)['then'](handleEntityNotFound(_0x31c68a,null))[_0xe245('0x1f')](respondWithResult(_0x31c68a,null))[_0xe245('0x43')](handleError(_0x31c68a,null));};exports[_0xe245('0x44')]=function(_0x4129f7,_0x82b88d){return db[_0xe245('0x3a')][_0xe245('0x44')](_0x4129f7[_0xe245('0x45')],{})[_0xe245('0x1f')](respondWithResult(_0x82b88d,0xc9))['catch'](handleError(_0x82b88d,null));};exports[_0xe245('0x46')]=function(_0x5db1f6,_0x30782e){if(_0x5db1f6['body']['id']){delete _0x5db1f6[_0xe245('0x45')]['id'];}return db[_0xe245('0x3a')]['find']({'where':{'id':_0x5db1f6[_0xe245('0x3f')]['id']}})[_0xe245('0x1f')](handleEntityNotFound(_0x30782e,null))[_0xe245('0x1f')](saveUpdates(_0x5db1f6['body'],null))['then'](respondWithResult(_0x30782e,null))[_0xe245('0x43')](handleError(_0x30782e,null));};exports['destroy']=function(_0xda6935,_0x1cfa80){return db[_0xe245('0x3a')][_0xe245('0x42')]({'where':{'id':_0xda6935[_0xe245('0x3f')]['id']}})[_0xe245('0x1f')](handleEntityNotFound(_0x1cfa80,null))[_0xe245('0x1f')](removeEntity(_0x1cfa80,null))[_0xe245('0x43')](handleError(_0x1cfa80,null));};exports[_0xe245('0x47')]=function(_0x438a37,_0x376b9d,_0x4e0996){var _0x2a98eb={};var _0x59c3ca={};var _0x4fe673;var _0x46478b;return db[_0xe245('0x3a')][_0xe245('0x48')]({'where':{'id':_0x438a37[_0xe245('0x3f')]['id']}})[_0xe245('0x1f')](handleEntityNotFound(_0x376b9d,null))[_0xe245('0x1f')](function(_0x4a3ff5){if(_0x4a3ff5){_0x4fe673=_0x4a3ff5;_0x59c3ca[_0xe245('0x2e')]=_[_0xe245('0x40')](db[_0xe245('0x49')]['rawAttributes']);_0x59c3ca[_0xe245('0x2c')]=_['keys'](_0x438a37[_0xe245('0x2c')]);_0x59c3ca[_0xe245('0x35')]=_[_0xe245('0x2d')](_0x59c3ca[_0xe245('0x2e')],_0x59c3ca[_0xe245('0x2c')]);_0x2a98eb[_0xe245('0x30')]=_['intersection'](_0x59c3ca[_0xe245('0x2e')],qs['fields'](_0x438a37['query'][_0xe245('0x2f')]));_0x2a98eb[_0xe245('0x30')]=_0x2a98eb['attributes'][_0xe245('0x4a')]?_0x2a98eb[_0xe245('0x30')]:_0x59c3ca[_0xe245('0x2e')];_0x2a98eb[_0xe245('0x32')]=qs[_0xe245('0x33')](_0x438a37[_0xe245('0x2c')][_0xe245('0x33')]);_0x2a98eb[_0xe245('0x34')]=qs[_0xe245('0x35')](_[_0xe245('0x36')](_0x438a37[_0xe245('0x2c')],_0x59c3ca[_0xe245('0x35')]));if(_0x438a37[_0xe245('0x2c')][_0xe245('0x38')]){_0x2a98eb['where']=_['merge'](_0x2a98eb[_0xe245('0x34')],{'$or':_[_0xe245('0x27')](_0x2a98eb[_0xe245('0x30')],function(_0x233041){var _0x383887={};_0x383887[_0x233041]={'$like':'%'+_0x438a37[_0xe245('0x2c')][_0xe245('0x38')]+'%'};return _0x383887;})});}_0x2a98eb=_['merge']({},_0x2a98eb,_0x438a37[_0xe245('0x39')]);return _0x4fe673[_0xe245('0x47')](_0x2a98eb);}})[_0xe245('0x1f')](function(_0x474746){if(_0x474746){_0x46478b=_0x474746[_0xe245('0x4a')];if(!_0x438a37[_0xe245('0x2c')][_0xe245('0x4b')](_0xe245('0x31'))){_0x2a98eb[_0xe245('0x19')]=qs[_0xe245('0x19')](_0x438a37[_0xe245('0x2c')]['limit']);_0x2a98eb[_0xe245('0x1a')]=qs['offset'](_0x438a37[_0xe245('0x2c')][_0xe245('0x1a')]);}return _0x4fe673[_0xe245('0x47')](_0x2a98eb);}})[_0xe245('0x1f')](function(_0xa11200){if(_0xa11200){return _0xa11200?{'count':_0x46478b,'rows':_0xa11200}:null;}})[_0xe245('0x1f')](respondWithResult(_0x376b9d,null))[_0xe245('0x43')](handleError(_0x376b9d,null));};exports[_0xe245('0x4c')]=function(_0xe8d6d0,_0x2577fa,_0x80ec47){if(_0xe8d6d0[_0xe245('0x45')]['id']){delete _0xe8d6d0[_0xe245('0x45')]['id'];}return db[_0xe245('0x3a')][_0xe245('0x48')]({'where':{'id':_0xe8d6d0[_0xe245('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2577fa,null))['then'](function(_0x141efe){if(_0x141efe){_0xe8d6d0[_0xe245('0x45')][_0xe245('0x4d')]=_0x141efe['id'];_0xe8d6d0[_0xe245('0x45')][_0xe245('0x4e')]=integrations[_0xe245('0x4f')](_0xe8d6d0['body'][_0xe245('0x50')],_0xe8d6d0['body']['type']);_0xe8d6d0[_0xe245('0x45')][_0xe245('0x51')]=integrations[_0xe245('0x52')](_0xe8d6d0[_0xe245('0x45')][_0xe245('0x50')],_0xe8d6d0[_0xe245('0x45')]['type']);return db[_0xe245('0x49')]['create'](_0xe8d6d0[_0xe245('0x45')],{'include':[{'model':db[_0xe245('0x53')],'as':_0xe245('0x4e')},{'model':db[_0xe245('0x53')],'as':_0xe245('0x51')}]});}return null;})[_0xe245('0x1f')](respondWithResult(_0x2577fa,null))['catch'](handleError(_0x2577fa,null));};exports[_0xe245('0x54')]=function(_0x41accb,_0x29cbb5,_0x1f5ba3){var _0x3512='';var _0x710eb6=['id',_0xe245('0x24'),_0xe245('0x55'),_0xe245('0x56'),_0xe245('0x57'),'date_start',_0xe245('0x58'),_0xe245('0x59'),_0xe245('0x5a'),_0xe245('0x5b'),_0xe245('0x5c'),_0xe245('0x5d')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x41accb[_0xe245('0x3f')]['id']},'attributes':['id',_0xe245('0x5e'),_0xe245('0x5f'),_0xe245('0x60')]})[_0xe245('0x1f')](handleEntityNotFound(_0x29cbb5,null))[_0xe245('0x1f')](function(_0x5229fe){if(_0x5229fe){_0x3512=_0x5229fe[_0xe245('0x60')];var _0x11cd86=_0x3512[_0xe245('0x61')](-0x1);if(_0x11cd86==='/'){_0x3512=_0x3512['substring'](0x0,_0x3512[_0xe245('0x62')](_0x11cd86));}return rp({'method':_0xe245('0x63'),'uri':util['format'](_0xe245('0x64'),_0x3512,_0xe245('0x65')),'json':!![],'form':{'method':'login','input_type':_0xe245('0x66'),'response_type':_0xe245('0x66'),'rest_data':JSON[_0xe245('0x67')]({'user_auth':{'user_name':_0x5229fe['username'],'password':_0x5229fe[_0xe245('0x5f')],'encryption':_0xe245('0x68')},'application':_0xe245('0x69')})}});}})[_0xe245('0x1f')](function(_0x2cbba2){if(_0x2cbba2&&_0x2cbba2[_0xe245('0x24')]!==_0xe245('0x6a')&&_0x2cbba2[_0xe245('0x24')]!==_0xe245('0x6b')){return rp({'method':_0xe245('0x63'),'uri':util[_0xe245('0x6c')]('%s%s',_0x3512,_0xe245('0x65')),'json':!![],'form':{'method':_0xe245('0x6d'),'input_type':_0xe245('0x66'),'response_type':_0xe245('0x66'),'rest_data':JSON[_0xe245('0x67')]({'session':_0x2cbba2['id'],'module_name':'Calls'})}})[_0xe245('0x1f')](function(_0x8f0861){if(_0x8f0861){var _0xb60d28=_['values'](_0x8f0861[_0xe245('0x6e')]);_[_0xe245('0x6f')](_0xb60d28,function(_0x4b13d1){return _0x710eb6[_0xe245('0x70')](_0x4b13d1[_0xe245('0x24')]);});return{'count':_0xb60d28[_0xe245('0x4a')],'rows':_[_0xe245('0x27')](_0xb60d28,function(_0x2dca05){return{'id':_0x2dca05[_0xe245('0x24')],'name':_0x2dca05[_0xe245('0x71')],'custom':_['endsWith'](_0x2dca05['name'],'_c')?!![]:![],'options':_0x2dca05[_0xe245('0x39')]?_['map'](_['values'](_0x2dca05['options']),function(_0x164790){return{'name':_0x164790[_0xe245('0x72')],'value':_0x164790['name']};}):[]};})};}})[_0xe245('0x1f')](respondWithResult(_0x29cbb5,null))[_0xe245('0x43')](function(_0x5212d2){var _0x238bd4=_0x41accb[_0xe245('0x2c')][_0xe245('0x73')]?0x1f4:_0x5212d2[_0xe245('0x74')]||0x1f4;logger['error'](_0xe245('0x75'),'getFields',_0x238bd4,JSON[_0xe245('0x67')](_0x5212d2));delete _0x5212d2[_0xe245('0x24')];if(_0x238bd4===0x191){_0x238bd4=0x190;}_0x29cbb5[_0xe245('0x17')](_0x238bd4)[_0xe245('0x25')](_0x41accb[_0xe245('0x2c')][_0xe245('0x73')]?{'message':_0xe245('0x76'),'statusCode':_0x5212d2[_0xe245('0x74')]}:_0x5212d2);});}else{var _0x23e011=0x1f4;_0x29cbb5[_0xe245('0x17')](_0x23e011)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xea20=['pick','addConfiguration','AccountId','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_name','direction','findOne','username','password','remoteUri','slice','substring','lastIndexOf','%s%s','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','format','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','includes','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','index','SugarcrmAccount','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','update','params','getConfigurations','SugarcrmConfiguration'];(function(_0x4e6160,_0x415588){var _0xdc3dd0=function(_0x2b1114){while(--_0x2b1114){_0x4e6160['push'](_0x4e6160['shift']());}};_0xdc3dd0(++_0x415588);}(_0xea20,0x198));var _0x0ea2=function(_0x371931,_0x33e3cf){_0x371931=_0x371931-0x0;var _0x3fa6b0=_0xea20[_0x371931];return _0x3fa6b0;};'use strict';var emlformat=require(_0x0ea2('0x0'));var rimraf=require(_0x0ea2('0x1'));var zipdir=require(_0x0ea2('0x2'));var jsonpatch=require(_0x0ea2('0x3'));var rp=require(_0x0ea2('0x4'));var moment=require(_0x0ea2('0x5'));var BPromise=require(_0x0ea2('0x6'));var Mustache=require(_0x0ea2('0x7'));var util=require(_0x0ea2('0x8'));var path=require(_0x0ea2('0x9'));var sox=require(_0x0ea2('0xa'));var csv=require(_0x0ea2('0xb'));var ejs=require(_0x0ea2('0xc'));var fs=require('fs');var fs_extra=require(_0x0ea2('0xd'));var _=require(_0x0ea2('0xe'));var squel=require(_0x0ea2('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ea2('0x10'));var Redis=require(_0x0ea2('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ea2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0ea2('0x13'));var config=require(_0x0ea2('0x14'));var licenseUtil=require(_0x0ea2('0x15'));var db=require(_0x0ea2('0x16'))['db'];var integrations=require(_0x0ea2('0x17'));function respondWithStatusCode(_0xee22d,_0x127746){_0x127746=_0x127746||0xcc;return function(_0x1b1463){if(_0x1b1463){return _0xee22d[_0x0ea2('0x18')](_0x127746);}return _0xee22d[_0x0ea2('0x19')](_0x127746)[_0x0ea2('0x1a')]();};}function respondWithResult(_0x742355,_0x2057ad){_0x2057ad=_0x2057ad||0xc8;return function(_0x42eba0){if(_0x42eba0){return _0x742355[_0x0ea2('0x19')](_0x2057ad)[_0x0ea2('0x1b')](_0x42eba0);}};}function respondWithFilteredResult(_0x1044f7,_0x33f179){return function(_0x5e729d){if(_0x5e729d){var _0x22d8c9=typeof _0x33f179[_0x0ea2('0x1c')]===_0x0ea2('0x1d')&&typeof _0x33f179[_0x0ea2('0x1e')]==='undefined';var _0x5be0cb=_0x5e729d['count'];var _0x348a69=_0x22d8c9?0x0:_0x33f179[_0x0ea2('0x1c')];var _0x3e3b4c=_0x22d8c9?_0x5e729d[_0x0ea2('0x1f')]:_0x33f179['offset']+_0x33f179['limit'];var _0x5330eb;if(_0x3e3b4c>=_0x5be0cb){_0x3e3b4c=_0x5be0cb;_0x5330eb=0xc8;}else{_0x5330eb=0xce;}_0x1044f7['status'](_0x5330eb);return _0x1044f7[_0x0ea2('0x20')]('Content-Range',_0x348a69+'-'+_0x3e3b4c+'/'+_0x5be0cb)[_0x0ea2('0x1b')](_0x5e729d);}return null;};}function patchUpdates(_0x528f44){return function(_0x8ea230){try{jsonpatch[_0x0ea2('0x21')](_0x8ea230,_0x528f44,!![]);}catch(_0x52f558){return BPromise[_0x0ea2('0x22')](_0x52f558);}return _0x8ea230['save']();};}function saveUpdates(_0x578797,_0x3ff929){return function(_0x489c32){if(_0x489c32){return _0x489c32['update'](_0x578797)[_0x0ea2('0x23')](function(_0x1a66ac){return _0x1a66ac;});}return null;};}function removeEntity(_0x382ab9,_0x8e281b){return function(_0x14d609){if(_0x14d609){return _0x14d609[_0x0ea2('0x24')]()[_0x0ea2('0x23')](function(){_0x382ab9[_0x0ea2('0x19')](0xcc)[_0x0ea2('0x1a')]();});}};}function handleEntityNotFound(_0x249604,_0x5b9430){return function(_0x3f5f9d){if(!_0x3f5f9d){_0x249604[_0x0ea2('0x18')](0x194);}return _0x3f5f9d;};}function handleError(_0x103894,_0x83f76){_0x83f76=_0x83f76||0x1f4;return function(_0x33a4fb){logger[_0x0ea2('0x25')](_0x33a4fb[_0x0ea2('0x26')]);if(_0x33a4fb['name']){delete _0x33a4fb[_0x0ea2('0x27')];}_0x103894['status'](_0x83f76)[_0x0ea2('0x28')](_0x33a4fb);};}exports[_0x0ea2('0x29')]=function(_0x4dd970,_0x397ebe){var _0x15c38e={},_0x38bc6c={},_0x54c555={'count':0x0,'rows':[]};var _0x269a59=_['map'](db[_0x0ea2('0x2a')][_0x0ea2('0x2b')],function(_0x3cffda){return{'name':_0x3cffda['fieldName'],'type':_0x3cffda[_0x0ea2('0x2c')][_0x0ea2('0x2d')]};});_0x38bc6c[_0x0ea2('0x2e')]=_[_0x0ea2('0x2f')](_0x269a59,_0x0ea2('0x27'));_0x38bc6c[_0x0ea2('0x30')]=_['keys'](_0x4dd970[_0x0ea2('0x30')]);_0x38bc6c[_0x0ea2('0x31')]=_[_0x0ea2('0x32')](_0x38bc6c[_0x0ea2('0x2e')],_0x38bc6c[_0x0ea2('0x30')]);_0x15c38e['attributes']=_[_0x0ea2('0x32')](_0x38bc6c[_0x0ea2('0x2e')],qs[_0x0ea2('0x33')](_0x4dd970[_0x0ea2('0x30')][_0x0ea2('0x33')]));_0x15c38e[_0x0ea2('0x34')]=_0x15c38e['attributes']['length']?_0x15c38e['attributes']:_0x38bc6c[_0x0ea2('0x2e')];if(!_0x4dd970[_0x0ea2('0x30')][_0x0ea2('0x35')](_0x0ea2('0x36'))){_0x15c38e[_0x0ea2('0x1e')]=qs['limit'](_0x4dd970[_0x0ea2('0x30')][_0x0ea2('0x1e')]);_0x15c38e[_0x0ea2('0x1c')]=qs[_0x0ea2('0x1c')](_0x4dd970[_0x0ea2('0x30')][_0x0ea2('0x1c')]);}_0x15c38e[_0x0ea2('0x37')]=qs[_0x0ea2('0x38')](_0x4dd970[_0x0ea2('0x30')][_0x0ea2('0x38')]);_0x15c38e[_0x0ea2('0x39')]=qs['filters'](_['pick'](_0x4dd970['query'],_0x38bc6c[_0x0ea2('0x31')]),_0x269a59);if(_0x4dd970[_0x0ea2('0x30')]['filter']){_0x15c38e[_0x0ea2('0x39')]=_['merge'](_0x15c38e[_0x0ea2('0x39')],{'$or':_['map'](_0x269a59,function(_0x350a0f){if(_0x350a0f[_0x0ea2('0x2c')]!=='VIRTUAL'){var _0x202cc0={};_0x202cc0[_0x350a0f[_0x0ea2('0x27')]]={'$like':'%'+_0x4dd970[_0x0ea2('0x30')][_0x0ea2('0x3a')]+'%'};return _0x202cc0;}})});}_0x15c38e=_[_0x0ea2('0x3b')]({},_0x15c38e,_0x4dd970[_0x0ea2('0x3c')]);var _0x22ce24={'where':_0x15c38e[_0x0ea2('0x39')]};return db[_0x0ea2('0x2a')]['count'](_0x22ce24)[_0x0ea2('0x23')](function(_0x296844){_0x54c555[_0x0ea2('0x1f')]=_0x296844;if(_0x4dd970['query']['includeAll']){_0x15c38e[_0x0ea2('0x3d')]=[{'all':!![]}];}return db[_0x0ea2('0x2a')][_0x0ea2('0x3e')](_0x15c38e);})[_0x0ea2('0x23')](function(_0x361e88){_0x54c555[_0x0ea2('0x3f')]=_0x361e88;return _0x54c555;})[_0x0ea2('0x23')](respondWithFilteredResult(_0x397ebe,_0x15c38e))[_0x0ea2('0x40')](handleError(_0x397ebe,null));};exports[_0x0ea2('0x41')]=function(_0x3f6f90,_0x42c837){var _0x5f3457={'raw':![],'where':{'id':_0x3f6f90['params']['id']}},_0x1101b2={};_0x1101b2[_0x0ea2('0x2e')]=_['keys'](db[_0x0ea2('0x2a')][_0x0ea2('0x2b')]);_0x1101b2[_0x0ea2('0x30')]=_[_0x0ea2('0x42')](_0x3f6f90[_0x0ea2('0x30')]);_0x1101b2['filters']=_[_0x0ea2('0x32')](_0x1101b2[_0x0ea2('0x2e')],_0x1101b2[_0x0ea2('0x30')]);_0x5f3457[_0x0ea2('0x34')]=_[_0x0ea2('0x32')](_0x1101b2[_0x0ea2('0x2e')],qs[_0x0ea2('0x33')](_0x3f6f90[_0x0ea2('0x30')][_0x0ea2('0x33')]));_0x5f3457[_0x0ea2('0x34')]=_0x5f3457['attributes'][_0x0ea2('0x43')]?_0x5f3457[_0x0ea2('0x34')]:_0x1101b2[_0x0ea2('0x2e')];if(_0x3f6f90['query'][_0x0ea2('0x44')]){_0x5f3457[_0x0ea2('0x3d')]=[{'all':!![]}];}_0x5f3457=_[_0x0ea2('0x3b')]({},_0x5f3457,_0x3f6f90[_0x0ea2('0x3c')]);return db[_0x0ea2('0x2a')][_0x0ea2('0x45')](_0x5f3457)['then'](handleEntityNotFound(_0x42c837,null))[_0x0ea2('0x23')](respondWithResult(_0x42c837,null))[_0x0ea2('0x40')](handleError(_0x42c837,null));};exports[_0x0ea2('0x46')]=function(_0x779828,_0x2f388d){return db[_0x0ea2('0x2a')][_0x0ea2('0x46')](_0x779828[_0x0ea2('0x47')],{})['then'](respondWithResult(_0x2f388d,0xc9))['catch'](handleError(_0x2f388d,null));};exports[_0x0ea2('0x48')]=function(_0x493d5,_0x33159c){if(_0x493d5[_0x0ea2('0x47')]['id']){delete _0x493d5['body']['id'];}return db[_0x0ea2('0x2a')][_0x0ea2('0x45')]({'where':{'id':_0x493d5[_0x0ea2('0x49')]['id']}})[_0x0ea2('0x23')](handleEntityNotFound(_0x33159c,null))[_0x0ea2('0x23')](saveUpdates(_0x493d5[_0x0ea2('0x47')],null))[_0x0ea2('0x23')](respondWithResult(_0x33159c,null))['catch'](handleError(_0x33159c,null));};exports[_0x0ea2('0x24')]=function(_0x138017,_0x4e3449){return db[_0x0ea2('0x2a')][_0x0ea2('0x45')]({'where':{'id':_0x138017[_0x0ea2('0x49')]['id']}})[_0x0ea2('0x23')](handleEntityNotFound(_0x4e3449,null))[_0x0ea2('0x23')](removeEntity(_0x4e3449,null))[_0x0ea2('0x40')](handleError(_0x4e3449,null));};exports[_0x0ea2('0x4a')]=function(_0x3a6ddf,_0x5500d1,_0x39fbb8){var _0x453ca1={};var _0x4bcce4={};var _0x3e2dbd;var _0x4acb39;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x3a6ddf[_0x0ea2('0x49')]['id']}})[_0x0ea2('0x23')](handleEntityNotFound(_0x5500d1,null))[_0x0ea2('0x23')](function(_0x2a6cd6){if(_0x2a6cd6){_0x3e2dbd=_0x2a6cd6;_0x4bcce4[_0x0ea2('0x2e')]=_['keys'](db[_0x0ea2('0x4b')][_0x0ea2('0x2b')]);_0x4bcce4[_0x0ea2('0x30')]=_[_0x0ea2('0x42')](_0x3a6ddf[_0x0ea2('0x30')]);_0x4bcce4['filters']=_[_0x0ea2('0x32')](_0x4bcce4[_0x0ea2('0x2e')],_0x4bcce4['query']);_0x453ca1[_0x0ea2('0x34')]=_[_0x0ea2('0x32')](_0x4bcce4[_0x0ea2('0x2e')],qs['fields'](_0x3a6ddf[_0x0ea2('0x30')][_0x0ea2('0x33')]));_0x453ca1['attributes']=_0x453ca1[_0x0ea2('0x34')][_0x0ea2('0x43')]?_0x453ca1['attributes']:_0x4bcce4[_0x0ea2('0x2e')];_0x453ca1[_0x0ea2('0x37')]=qs[_0x0ea2('0x38')](_0x3a6ddf['query'][_0x0ea2('0x38')]);_0x453ca1[_0x0ea2('0x39')]=qs[_0x0ea2('0x31')](_[_0x0ea2('0x4c')](_0x3a6ddf[_0x0ea2('0x30')],_0x4bcce4[_0x0ea2('0x31')]));if(_0x3a6ddf[_0x0ea2('0x30')][_0x0ea2('0x3a')]){_0x453ca1[_0x0ea2('0x39')]=_['merge'](_0x453ca1['where'],{'$or':_[_0x0ea2('0x2f')](_0x453ca1[_0x0ea2('0x34')],function(_0x7c2033){var _0x23eeaa={};_0x23eeaa[_0x7c2033]={'$like':'%'+_0x3a6ddf['query']['filter']+'%'};return _0x23eeaa;})});}_0x453ca1=_[_0x0ea2('0x3b')]({},_0x453ca1,_0x3a6ddf[_0x0ea2('0x3c')]);return _0x3e2dbd[_0x0ea2('0x4a')](_0x453ca1);}})['then'](function(_0x20ba69){if(_0x20ba69){_0x4acb39=_0x20ba69['length'];if(!_0x3a6ddf[_0x0ea2('0x30')]['hasOwnProperty'](_0x0ea2('0x36'))){_0x453ca1[_0x0ea2('0x1e')]=qs[_0x0ea2('0x1e')](_0x3a6ddf[_0x0ea2('0x30')]['limit']);_0x453ca1[_0x0ea2('0x1c')]=qs[_0x0ea2('0x1c')](_0x3a6ddf['query'][_0x0ea2('0x1c')]);}return _0x3e2dbd[_0x0ea2('0x4a')](_0x453ca1);}})[_0x0ea2('0x23')](function(_0x50a84e){if(_0x50a84e){return _0x50a84e?{'count':_0x4acb39,'rows':_0x50a84e}:null;}})[_0x0ea2('0x23')](respondWithResult(_0x5500d1,null))[_0x0ea2('0x40')](handleError(_0x5500d1,null));};exports[_0x0ea2('0x4d')]=function(_0xc317e8,_0x59da76,_0x1462ce){if(_0xc317e8[_0x0ea2('0x47')]['id']){delete _0xc317e8['body']['id'];}return db[_0x0ea2('0x2a')]['findOne']({'where':{'id':_0xc317e8[_0x0ea2('0x49')]['id']}})['then'](handleEntityNotFound(_0x59da76,null))[_0x0ea2('0x23')](function(_0x4768dc){if(_0x4768dc){_0xc317e8['body'][_0x0ea2('0x4e')]=_0x4768dc['id'];_0xc317e8[_0x0ea2('0x47')]['Subjects']=integrations[_0x0ea2('0x4f')](_0xc317e8[_0x0ea2('0x47')][_0x0ea2('0x50')],_0xc317e8[_0x0ea2('0x47')][_0x0ea2('0x2c')]);_0xc317e8[_0x0ea2('0x47')]['Descriptions']=integrations[_0x0ea2('0x51')](_0xc317e8[_0x0ea2('0x47')][_0x0ea2('0x50')],_0xc317e8[_0x0ea2('0x47')][_0x0ea2('0x2c')]);return db['SugarcrmConfiguration'][_0x0ea2('0x46')](_0xc317e8[_0x0ea2('0x47')],{'include':[{'model':db[_0x0ea2('0x52')],'as':'Subjects'},{'model':db[_0x0ea2('0x52')],'as':_0x0ea2('0x53')}]});}return null;})[_0x0ea2('0x23')](respondWithResult(_0x59da76,null))[_0x0ea2('0x40')](handleError(_0x59da76,null));};exports[_0x0ea2('0x54')]=function(_0x3fdd24,_0x4aae49,_0x5dacb6){var _0x53602b='';var _0x143001=['id',_0x0ea2('0x27'),'assigned_user_id',_0x0ea2('0x55'),_0x0ea2('0x56'),_0x0ea2('0x57'),_0x0ea2('0x58'),_0x0ea2('0x59'),'parent_id','parent_type',_0x0ea2('0x5a'),_0x0ea2('0x5b')];return db[_0x0ea2('0x2a')][_0x0ea2('0x5c')]({'where':{'id':_0x3fdd24['params']['id']},'attributes':['id',_0x0ea2('0x5d'),_0x0ea2('0x5e'),_0x0ea2('0x5f')]})['then'](handleEntityNotFound(_0x4aae49,null))[_0x0ea2('0x23')](function(_0x3e744e){if(_0x3e744e){_0x53602b=_0x3e744e[_0x0ea2('0x5f')];var _0x15302d=_0x53602b[_0x0ea2('0x60')](-0x1);if(_0x15302d==='/'){_0x53602b=_0x53602b[_0x0ea2('0x61')](0x0,_0x53602b[_0x0ea2('0x62')](_0x15302d));}return rp({'method':'POST','uri':util['format'](_0x0ea2('0x63'),_0x53602b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x0ea2('0x64'),'response_type':_0x0ea2('0x64'),'rest_data':JSON[_0x0ea2('0x65')]({'user_auth':{'user_name':_0x3e744e[_0x0ea2('0x5d')],'password':_0x3e744e[_0x0ea2('0x5e')],'encryption':_0x0ea2('0x66')},'application':_0x0ea2('0x67')})}});}})[_0x0ea2('0x23')](function(_0x296580){if(_0x296580&&_0x296580[_0x0ea2('0x27')]!==_0x0ea2('0x68')&&_0x296580[_0x0ea2('0x27')]!==_0x0ea2('0x69')){return rp({'method':_0x0ea2('0x6a'),'uri':util[_0x0ea2('0x6b')](_0x0ea2('0x63'),_0x53602b,_0x0ea2('0x6c')),'json':!![],'form':{'method':_0x0ea2('0x6d'),'input_type':_0x0ea2('0x64'),'response_type':_0x0ea2('0x64'),'rest_data':JSON['stringify']({'session':_0x296580['id'],'module_name':'Calls'})}})[_0x0ea2('0x23')](function(_0x1bac57){if(_0x1bac57){var _0x535bb2=_[_0x0ea2('0x6e')](_0x1bac57[_0x0ea2('0x6f')]);_[_0x0ea2('0x70')](_0x535bb2,function(_0x3adb78){return _0x143001[_0x0ea2('0x71')](_0x3adb78['name']);});return{'count':_0x535bb2['length'],'rows':_[_0x0ea2('0x2f')](_0x535bb2,function(_0x9273ea){return{'id':_0x9273ea['name'],'name':_0x9273ea[_0x0ea2('0x72')],'custom':_[_0x0ea2('0x73')](_0x9273ea[_0x0ea2('0x27')],'_c')?!![]:![],'options':_0x9273ea[_0x0ea2('0x3c')]?_[_0x0ea2('0x2f')](_['values'](_0x9273ea[_0x0ea2('0x3c')]),function(_0x695e1d){return{'name':_0x695e1d[_0x0ea2('0x74')],'value':_0x695e1d[_0x0ea2('0x27')]};}):[]};})};}})[_0x0ea2('0x23')](respondWithResult(_0x4aae49,null))[_0x0ea2('0x40')](function(_0x5b3bc4){var _0x3bf83f=_0x3fdd24[_0x0ea2('0x30')][_0x0ea2('0x75')]?0x1f4:_0x5b3bc4['statusCode']||0x1f4;logger[_0x0ea2('0x25')](_0x0ea2('0x76'),_0x0ea2('0x54'),_0x3bf83f,JSON[_0x0ea2('0x65')](_0x5b3bc4));delete _0x5b3bc4[_0x0ea2('0x27')];if(_0x3bf83f===0x191){_0x3bf83f=0x190;}_0x4aae49[_0x0ea2('0x19')](_0x3bf83f)['send'](_0x3fdd24[_0x0ea2('0x30')]['test']?{'message':_0x0ea2('0x77'),'statusCode':_0x5b3bc4[_0x0ea2('0x78')]}:_0x5b3bc4);});}else{var _0x1e21e1=0x1f4;_0x4aae49[_0x0ea2('0x19')](_0x1e21e1)['send']({'message':_0x0ea2('0x77'),'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 a6f242b..f099737 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 _0x584e=['SugarcrmAccount','lodash','../../config/logger','api','moment','path','rimraf','./intSugarcrmAccount.attributes','define'];(function(_0x14f115,_0x5681a0){var _0x540040=function(_0x2dcf43){while(--_0x2dcf43){_0x14f115['push'](_0x14f115['shift']());}};_0x540040(++_0x5681a0);}(_0x584e,0xa3));var _0xe584=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0x584e[_0x4d2263];return _0x24aba0;};'use strict';var _=require(_0xe584('0x0'));var util=require('util');var logger=require(_0xe584('0x1'))(_0xe584('0x2'));var moment=require(_0xe584('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe584('0x4'));var rimraf=require(_0xe584('0x5'));var config=require('../../config/environment');var attributes=require(_0xe584('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3413d9,_0x5092ec){return _0x3413d9[_0xe584('0x7')](_0xe584('0x8'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x254e=['../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x254e,0x19c));var _0xe254=function(_0x24cd10,_0x20bd86){_0x24cd10=_0x24cd10-0x0;var _0x56f52f=_0x254e[_0x24cd10];return _0x56f52f;};'use strict';var _=require(_0xe254('0x0'));var util=require(_0xe254('0x1'));var logger=require(_0xe254('0x2'))('api');var moment=require(_0xe254('0x3'));var BPromise=require(_0xe254('0x4'));var rp=require(_0xe254('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe254('0x6'));var config=require(_0xe254('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xe254('0x8'));module[_0xe254('0x9')]=function(_0xa708d0,_0x544b46){return _0xa708d0[_0xe254('0xa')](_0xe254('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','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 da2b69c..ecd8e11 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 _0x68c3=['client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','options','attributes','limit','include','map','model','ShowSugarcrmAccount','find','where','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x68c3,0xcb));var _0x368c=function(_0xdd62e3,_0x257fe9){_0xdd62e3=_0xdd62e3-0x0;var _0x3e10b5=_0x68c3[_0xdd62e3];return _0x3e10b5;};'use strict';var _=require('lodash');var util=require(_0x368c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x368c('0x1'));var fs=require('fs');var Redis=require(_0x368c('0x2'));var db=require(_0x368c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x368c('0x4'))('rpc');var config=require(_0x368c('0x5'));var jayson=require(_0x368c('0x6'));var client=jayson[_0x368c('0x7')][_0x368c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x80aeeb,_0x338d14,_0x47dc98){return new BPromise(function(_0x568910,_0x138079){return client['request'](_0x80aeeb,_0x47dc98)[_0x368c('0x9')](function(_0x5db746){logger[_0x368c('0xa')](_0x368c('0xb'),_0x338d14,_0x368c('0xc'));logger[_0x368c('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x338d14,'request\x20sent',JSON[_0x368c('0xe')](_0x5db746));if(_0x5db746['error']){if(_0x5db746[_0x368c('0xf')][_0x368c('0x10')]===0x1f4){logger[_0x368c('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x338d14,_0x5db746['error'][_0x368c('0x11')]);return _0x138079(_0x5db746[_0x368c('0xf')][_0x368c('0x11')]);}logger[_0x368c('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x338d14,_0x5db746[_0x368c('0xf')][_0x368c('0x11')]);return _0x568910(_0x5db746[_0x368c('0xf')][_0x368c('0x11')]);}else{logger[_0x368c('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x338d14,'request\x20sent');_0x568910(_0x5db746['result'][_0x368c('0x11')]);}})[_0x368c('0x12')](function(_0x2dd758){logger[_0x368c('0xf')](_0x368c('0xb'),_0x338d14,_0x2dd758);_0x138079(_0x2dd758);});});}exports[_0x368c('0x13')]=function(_0x4b514f){var _0x2afae0=this;return new Promise(function(_0x314502,_0x3a3d5f){return db[_0x368c('0x14')]['findAll']({'raw':_0x4b514f['options']?_0x4b514f[_0x368c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4b514f['options']?_0x4b514f[_0x368c('0x15')]['where']||null:null,'attributes':_0x4b514f[_0x368c('0x15')]?_0x4b514f[_0x368c('0x15')][_0x368c('0x16')]||null:null,'limit':_0x4b514f[_0x368c('0x15')]?_0x4b514f[_0x368c('0x15')][_0x368c('0x17')]||null:null,'include':_0x4b514f[_0x368c('0x15')]?_0x4b514f[_0x368c('0x15')][_0x368c('0x18')]?_[_0x368c('0x19')](_0x4b514f[_0x368c('0x15')]['include'],function(_0x27f63a){return{'model':db[_0x27f63a[_0x368c('0x1a')]],'as':_0x27f63a['as'],'attributes':_0x27f63a['attributes'],'include':_0x27f63a[_0x368c('0x18')]?_[_0x368c('0x19')](_0x27f63a['include'],function(_0x1008b0){return{'model':db[_0x1008b0[_0x368c('0x1a')]],'as':_0x1008b0['as'],'attributes':_0x1008b0[_0x368c('0x16')],'include':_0x1008b0[_0x368c('0x18')]?_[_0x368c('0x19')](_0x1008b0['include'],function(_0x14323f){return{'model':db[_0x14323f[_0x368c('0x1a')]],'as':_0x14323f['as'],'attributes':_0x14323f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37ad93){logger[_0x368c('0xa')]('GetSugarcrmAccount',_0x4b514f);logger[_0x368c('0xd')]('GetSugarcrmAccount',_0x4b514f,JSON['stringify'](_0x37ad93));_0x314502(_0x37ad93);})[_0x368c('0x12')](function(_0x3d7e0e){logger['error'](_0x368c('0x13'),_0x3d7e0e[_0x368c('0x11')],_0x4b514f);_0x3a3d5f(_0x2afae0[_0x368c('0xf')](0x1f4,_0x3d7e0e[_0x368c('0x11')]));});});};exports[_0x368c('0x1b')]=function(_0x2953e1){var _0x750729=this;return new Promise(function(_0xd7a02b,_0x3d78a1){return db[_0x368c('0x14')][_0x368c('0x1c')]({'raw':_0x2953e1[_0x368c('0x15')]?_0x2953e1[_0x368c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2953e1[_0x368c('0x15')]?_0x2953e1[_0x368c('0x15')][_0x368c('0x1d')]||null:null,'attributes':_0x2953e1[_0x368c('0x15')]?_0x2953e1[_0x368c('0x15')][_0x368c('0x16')]||null:null,'include':_0x2953e1[_0x368c('0x15')]?_0x2953e1[_0x368c('0x15')]['include']?_[_0x368c('0x19')](_0x2953e1[_0x368c('0x15')][_0x368c('0x18')],function(_0x39bfd0){return{'model':db[_0x39bfd0[_0x368c('0x1a')]],'as':_0x39bfd0['as'],'attributes':_0x39bfd0['attributes'],'include':_0x39bfd0[_0x368c('0x18')]?_[_0x368c('0x19')](_0x39bfd0['include'],function(_0x512f5f){return{'model':db[_0x512f5f[_0x368c('0x1a')]],'as':_0x512f5f['as'],'attributes':_0x512f5f['attributes'],'include':_0x512f5f[_0x368c('0x18')]?_[_0x368c('0x19')](_0x512f5f['include'],function(_0x47e88d){return{'model':db[_0x47e88d[_0x368c('0x1a')]],'as':_0x47e88d['as'],'attributes':_0x47e88d[_0x368c('0x16')]};}):[]};}):[]};}):[]:[]})[_0x368c('0x9')](function(_0x5b6b0d){logger['info'](_0x368c('0x1b'),_0x2953e1);logger[_0x368c('0xd')](_0x368c('0x1b'),_0x2953e1,JSON[_0x368c('0xe')](_0x5b6b0d));_0xd7a02b(_0x5b6b0d);})[_0x368c('0x12')](function(_0x38fdfe){logger[_0x368c('0xf')](_0x368c('0x1b'),_0x38fdfe[_0x368c('0x11')],_0x2953e1);_0x3d78a1(_0x750729[_0x368c('0xf')](0x1f4,_0x38fdfe[_0x368c('0x11')]));});});}; \ No newline at end of file +var _0x4ca6=['info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5a0487,_0x19e120){var _0x48a159=function(_0x55c2c3){while(--_0x55c2c3){_0x5a0487['push'](_0x5a0487['shift']());}};_0x48a159(++_0x19e120);}(_0x4ca6,0x122));var _0x64ca=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0x4ca6[_0x5b26cb];return _0x563d12;};'use strict';var _=require(_0x64ca('0x0'));var util=require(_0x64ca('0x1'));var moment=require(_0x64ca('0x2'));var BPromise=require(_0x64ca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64ca('0x4'))['db'];var utils=require(_0x64ca('0x5'));var logger=require(_0x64ca('0x6'))(_0x64ca('0x7'));var config=require(_0x64ca('0x8'));var jayson=require(_0x64ca('0x9'));var client=jayson[_0x64ca('0xa')][_0x64ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e060e,_0x1fa62d,_0x369716){return new BPromise(function(_0x339f6f,_0x17c0ed){return client[_0x64ca('0xc')](_0x2e060e,_0x369716)[_0x64ca('0xd')](function(_0x43bfc2){logger[_0x64ca('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x1fa62d,'request\x20sent');logger[_0x64ca('0xf')](_0x64ca('0x10'),_0x1fa62d,_0x64ca('0x11'),JSON[_0x64ca('0x12')](_0x43bfc2));if(_0x43bfc2[_0x64ca('0x13')]){if(_0x43bfc2['error'][_0x64ca('0x14')]===0x1f4){logger[_0x64ca('0x13')](_0x64ca('0x15'),_0x1fa62d,_0x43bfc2[_0x64ca('0x13')][_0x64ca('0x16')]);return _0x17c0ed(_0x43bfc2[_0x64ca('0x13')][_0x64ca('0x16')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x1fa62d,_0x43bfc2[_0x64ca('0x13')][_0x64ca('0x16')]);return _0x339f6f(_0x43bfc2[_0x64ca('0x13')][_0x64ca('0x16')]);}else{logger[_0x64ca('0xe')](_0x64ca('0x15'),_0x1fa62d,_0x64ca('0x11'));_0x339f6f(_0x43bfc2[_0x64ca('0x17')][_0x64ca('0x16')]);}})[_0x64ca('0x18')](function(_0x39e138){logger['error'](_0x64ca('0x15'),_0x1fa62d,_0x39e138);_0x17c0ed(_0x39e138);});});}exports[_0x64ca('0x19')]=function(_0x1e045c){var _0x44ad62=this;return new Promise(function(_0xcbe98a,_0xfd6698){return db[_0x64ca('0x1a')][_0x64ca('0x1b')]({'raw':_0x1e045c[_0x64ca('0x1c')]?_0x1e045c[_0x64ca('0x1c')][_0x64ca('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e045c['options']?_0x1e045c[_0x64ca('0x1c')][_0x64ca('0x1e')]||null:null,'attributes':_0x1e045c[_0x64ca('0x1c')]?_0x1e045c[_0x64ca('0x1c')][_0x64ca('0x1f')]||null:null,'limit':_0x1e045c['options']?_0x1e045c[_0x64ca('0x1c')][_0x64ca('0x20')]||null:null,'include':_0x1e045c[_0x64ca('0x1c')]?_0x1e045c['options'][_0x64ca('0x21')]?_[_0x64ca('0x22')](_0x1e045c['options'][_0x64ca('0x21')],function(_0x228442){return{'model':db[_0x228442[_0x64ca('0x23')]],'as':_0x228442['as'],'attributes':_0x228442[_0x64ca('0x1f')],'include':_0x228442[_0x64ca('0x21')]?_['map'](_0x228442[_0x64ca('0x21')],function(_0x4c0beb){return{'model':db[_0x4c0beb[_0x64ca('0x23')]],'as':_0x4c0beb['as'],'attributes':_0x4c0beb[_0x64ca('0x1f')],'include':_0x4c0beb[_0x64ca('0x21')]?_[_0x64ca('0x22')](_0x4c0beb[_0x64ca('0x21')],function(_0x9d5298){return{'model':db[_0x9d5298[_0x64ca('0x23')]],'as':_0x9d5298['as'],'attributes':_0x9d5298['attributes']};}):[]};}):[]};}):[]:[]})[_0x64ca('0xd')](function(_0x252125){logger[_0x64ca('0xe')](_0x64ca('0x19'),_0x1e045c);logger[_0x64ca('0xf')]('GetSugarcrmAccount',_0x1e045c,JSON[_0x64ca('0x12')](_0x252125));_0xcbe98a(_0x252125);})[_0x64ca('0x18')](function(_0x36d7aa){logger['error'](_0x64ca('0x19'),_0x36d7aa[_0x64ca('0x16')],_0x1e045c);_0xfd6698(_0x44ad62[_0x64ca('0x13')](0x1f4,_0x36d7aa['message']));});});};exports[_0x64ca('0x24')]=function(_0x24519d){var _0x809789=this;return new Promise(function(_0x17ae3c,_0x18b615){return db['SugarcrmAccount'][_0x64ca('0x25')]({'raw':_0x24519d[_0x64ca('0x1c')]?_0x24519d[_0x64ca('0x1c')][_0x64ca('0x1d')]===undefined?!![]:![]:!![],'where':_0x24519d[_0x64ca('0x1c')]?_0x24519d[_0x64ca('0x1c')][_0x64ca('0x1e')]||null:null,'attributes':_0x24519d['options']?_0x24519d[_0x64ca('0x1c')]['attributes']||null:null,'include':_0x24519d[_0x64ca('0x1c')]?_0x24519d[_0x64ca('0x1c')][_0x64ca('0x21')]?_[_0x64ca('0x22')](_0x24519d[_0x64ca('0x1c')][_0x64ca('0x21')],function(_0x3f4c78){return{'model':db[_0x3f4c78[_0x64ca('0x23')]],'as':_0x3f4c78['as'],'attributes':_0x3f4c78['attributes'],'include':_0x3f4c78[_0x64ca('0x21')]?_[_0x64ca('0x22')](_0x3f4c78[_0x64ca('0x21')],function(_0x4199f3){return{'model':db[_0x4199f3[_0x64ca('0x23')]],'as':_0x4199f3['as'],'attributes':_0x4199f3[_0x64ca('0x1f')],'include':_0x4199f3[_0x64ca('0x21')]?_[_0x64ca('0x22')](_0x4199f3['include'],function(_0x454908){return{'model':db[_0x454908[_0x64ca('0x23')]],'as':_0x454908['as'],'attributes':_0x454908['attributes']};}):[]};}):[]};}):[]:[]})[_0x64ca('0xd')](function(_0x5a8ad3){logger[_0x64ca('0xe')](_0x64ca('0x24'),_0x24519d);logger[_0x64ca('0xf')]('ShowSugarcrmAccount',_0x24519d,JSON['stringify'](_0x5a8ad3));_0x17ae3c(_0x5a8ad3);})[_0x64ca('0x18')](function(_0xa8ae83){logger[_0x64ca('0x13')](_0x64ca('0x24'),_0xa8ae83[_0x64ca('0x16')],_0x24519d);_0x18b615(_0x809789[_0x64ca('0x13')](0x1f4,_0xa8ae83[_0x64ca('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 9d73c0d..ba5a44d 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 _0xed93=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','delete'];(function(_0xf7b612,_0x1b1f82){var _0x291cd7=function(_0x353add){while(--_0x353add){_0xf7b612['push'](_0xf7b612['shift']());}};_0x291cd7(++_0x1b1f82);}(_0xed93,0xa9));var _0x3ed9=function(_0x1aa310,_0x53e194){_0x1aa310=_0x1aa310-0x0;var _0x31bb1d=_0xed93[_0x1aa310];return _0x31bb1d;};'use strict';var multer=require('multer');var util=require(_0x3ed9('0x0'));var path=require('path');var timeout=require(_0x3ed9('0x1'));var express=require(_0x3ed9('0x2'));var router=express[_0x3ed9('0x3')]();var fs_extra=require(_0x3ed9('0x4'));var auth=require(_0x3ed9('0x5'));var interaction=require(_0x3ed9('0x6'));var config=require(_0x3ed9('0x7'));var controller=require(_0x3ed9('0x8'));router[_0x3ed9('0x9')]('/',auth[_0x3ed9('0xa')](),controller[_0x3ed9('0xb')]);router[_0x3ed9('0x9')](_0x3ed9('0xc'),auth[_0x3ed9('0xa')](),controller[_0x3ed9('0xd')]);router[_0x3ed9('0x9')](_0x3ed9('0xe'),auth['isAuthenticated'](),controller[_0x3ed9('0xf')]);router[_0x3ed9('0x9')](_0x3ed9('0x10'),auth[_0x3ed9('0xa')](),controller[_0x3ed9('0x11')]);router[_0x3ed9('0x9')](_0x3ed9('0x12'),auth[_0x3ed9('0xa')](),controller[_0x3ed9('0x13')]);router['post']('/',auth[_0x3ed9('0xa')](),controller[_0x3ed9('0x14')]);router[_0x3ed9('0x15')](_0x3ed9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3ed9('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3ed9('0x17')]=router; \ No newline at end of file +var _0x0d5d=['getSubjects','get','/:id/descriptions','getDescriptions','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects'];(function(_0x41cb69,_0x2fd672){var _0x3203de=function(_0x352fa0){while(--_0x352fa0){_0x41cb69['push'](_0x41cb69['shift']());}};_0x3203de(++_0x2fd672);}(_0x0d5d,0x1d6));var _0xd0d5=function(_0x5abf8b,_0x378bf9){_0x5abf8b=_0x5abf8b-0x0;var _0x59e96c=_0x0d5d[_0x5abf8b];return _0x59e96c;};'use strict';var multer=require(_0xd0d5('0x0'));var util=require(_0xd0d5('0x1'));var path=require(_0xd0d5('0x2'));var timeout=require(_0xd0d5('0x3'));var express=require(_0xd0d5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd0d5('0x5'));var interaction=require(_0xd0d5('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x8')]);router['get'](_0xd0d5('0x9'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0xa')]);router['get'](_0xd0d5('0xb'),auth[_0xd0d5('0x7')](),controller['getFields']);router['get'](_0xd0d5('0xc'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0xd')]);router[_0xd0d5('0xe')](_0xd0d5('0xf'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x10')]);router['post']('/',auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x11')]);router[_0xd0d5('0x12')](_0xd0d5('0x9'),auth[_0xd0d5('0x7')](),controller['update']);router[_0xd0d5('0x13')](_0xd0d5('0x9'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x14')]);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 0a534a8..a365931 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 _0xdaa4=['exports','STRING','sequelize'];(function(_0x6d4762,_0x4e4d52){var _0x104852=function(_0x42f02e){while(--_0x42f02e){_0x6d4762['push'](_0x6d4762['shift']());}};_0x104852(++_0x4e4d52);}(_0xdaa4,0xa4));var _0x4daa=function(_0x38fa40,_0x57ae80){_0x38fa40=_0x38fa40-0x0;var _0x1ef23f=_0xdaa4[_0x38fa40];return _0x1ef23f;};'use strict';var Sequelize=require(_0x4daa('0x0'));module[_0x4daa('0x1')]={'name':{'type':Sequelize[_0x4daa('0x2')]},'description':{'type':Sequelize[_0x4daa('0x2')]}}; \ No newline at end of file +var _0x30b0=['exports','STRING','sequelize'];(function(_0x653d7f,_0x4b9913){var _0x161752=function(_0x1a48f8){while(--_0x1a48f8){_0x653d7f['push'](_0x653d7f['shift']());}};_0x161752(++_0x4b9913);}(_0x30b0,0x15b));var _0x030b=function(_0x5d757c,_0x3bcb3d){_0x5d757c=_0x5d757c-0x0;var _0x44302f=_0x30b0[_0x5d757c];return _0x44302f;};'use strict';var Sequelize=require(_0x030b('0x0'));module[_0x030b('0x1')]={'name':{'type':Sequelize[_0x030b('0x2')]},'description':{'type':Sequelize[_0x030b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 61e86ba..58f22d2 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 _0xe0b1=['includeAll','options','catch','create','body','update','find','findOne','SugarcrmField','order','nolimit','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','index','SugarcrmConfiguration','rawAttributes','fieldName','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filters','filter','merge','map','type','include','findAll','rows','show','params'];(function(_0x126fc5,_0x4a86f4){var _0x3ba067=function(_0x884e3a){while(--_0x884e3a){_0x126fc5['push'](_0x126fc5['shift']());}};_0x3ba067(++_0x4a86f4);}(_0xe0b1,0x1e2));var _0x1e0b=function(_0x562faf,_0x102bcc){_0x562faf=_0x562faf-0x0;var _0x22c1f6=_0xe0b1[_0x562faf];return _0x22c1f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e0b('0x0'));var zipdir=require(_0x1e0b('0x1'));var jsonpatch=require(_0x1e0b('0x2'));var rp=require(_0x1e0b('0x3'));var moment=require(_0x1e0b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1e0b('0x5'));var path=require('path');var sox=require(_0x1e0b('0x6'));var csv=require(_0x1e0b('0x7'));var ejs=require(_0x1e0b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e0b('0x9'));var squel=require(_0x1e0b('0xa'));var crypto=require(_0x1e0b('0xb'));var jsforce=require(_0x1e0b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1e0b('0x7'));var querystring=require(_0x1e0b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e0b('0xe'));var as=require(_0x1e0b('0xf'));var hardwareService=require(_0x1e0b('0x10'));var logger=require('../../config/logger')(_0x1e0b('0x11'));var utils=require(_0x1e0b('0x12'));var config=require(_0x1e0b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e0b('0x14'))['db'];function respondWithStatusCode(_0x4cfd3a,_0x4cdc8a){_0x4cdc8a=_0x4cdc8a||0xcc;return function(_0x9a44d2){if(_0x9a44d2){return _0x4cfd3a['sendStatus'](_0x4cdc8a);}return _0x4cfd3a[_0x1e0b('0x15')](_0x4cdc8a)[_0x1e0b('0x16')]();};}function respondWithResult(_0x5f60c6,_0x18bc05){_0x18bc05=_0x18bc05||0xc8;return function(_0x5c996c){if(_0x5c996c){return _0x5f60c6['status'](_0x18bc05)[_0x1e0b('0x17')](_0x5c996c);}};}function respondWithFilteredResult(_0x5eecc6,_0xb4cfa2){return function(_0x44e03b){if(_0x44e03b){var _0xbce259=typeof _0xb4cfa2[_0x1e0b('0x18')]===_0x1e0b('0x19')&&typeof _0xb4cfa2['limit']===_0x1e0b('0x19');var _0x4bbaff=_0x44e03b[_0x1e0b('0x1a')];var _0x7e29a=_0xbce259?0x0:_0xb4cfa2[_0x1e0b('0x18')];var _0x18e9e0=_0xbce259?_0x44e03b[_0x1e0b('0x1a')]:_0xb4cfa2[_0x1e0b('0x18')]+_0xb4cfa2['limit'];var _0x1ddd9;if(_0x18e9e0>=_0x4bbaff){_0x18e9e0=_0x4bbaff;_0x1ddd9=0xc8;}else{_0x1ddd9=0xce;}_0x5eecc6['status'](_0x1ddd9);return _0x5eecc6[_0x1e0b('0x1b')](_0x1e0b('0x1c'),_0x7e29a+'-'+_0x18e9e0+'/'+_0x4bbaff)[_0x1e0b('0x17')](_0x44e03b);}return null;};}function patchUpdates(_0x218429){return function(_0x4036cf){try{jsonpatch[_0x1e0b('0x1d')](_0x4036cf,_0x218429,!![]);}catch(_0x35da09){return BPromise[_0x1e0b('0x1e')](_0x35da09);}return _0x4036cf[_0x1e0b('0x1f')]();};}function saveUpdates(_0x9a4e7f,_0x21703e){return function(_0xde8c85){if(_0xde8c85){return _0xde8c85['update'](_0x9a4e7f)[_0x1e0b('0x20')](function(_0x523ef3){return _0x523ef3;});}return null;};}function removeEntity(_0x440f65,_0x6c6d15){return function(_0x175a6c){if(_0x175a6c){return _0x175a6c[_0x1e0b('0x21')]()['then'](function(){_0x440f65['status'](0xcc)[_0x1e0b('0x16')]();});}};}function handleEntityNotFound(_0x3a66b6,_0x51ac96){return function(_0x47e22a){if(!_0x47e22a){_0x3a66b6['sendStatus'](0x194);}return _0x47e22a;};}function handleError(_0x333733,_0x304fb2){_0x304fb2=_0x304fb2||0x1f4;return function(_0x457f6a){logger[_0x1e0b('0x22')](_0x457f6a[_0x1e0b('0x23')]);if(_0x457f6a['name']){delete _0x457f6a['name'];}_0x333733[_0x1e0b('0x15')](_0x304fb2)[_0x1e0b('0x24')](_0x457f6a);};}exports[_0x1e0b('0x25')]=function(_0x1927a7,_0x4ddc03){var _0x193d5c={},_0x2d8d23={},_0x7d65e8={'count':0x0,'rows':[]};var _0x5eee1f=_['map'](db[_0x1e0b('0x26')][_0x1e0b('0x27')],function(_0x604874){return{'name':_0x604874[_0x1e0b('0x28')],'type':_0x604874['type']['key']};});_0x2d8d23[_0x1e0b('0x29')]=_['map'](_0x5eee1f,_0x1e0b('0x2a'));_0x2d8d23[_0x1e0b('0x2b')]=_[_0x1e0b('0x2c')](_0x1927a7[_0x1e0b('0x2b')]);_0x2d8d23['filters']=_[_0x1e0b('0x2d')](_0x2d8d23[_0x1e0b('0x29')],_0x2d8d23[_0x1e0b('0x2b')]);_0x193d5c[_0x1e0b('0x2e')]=_[_0x1e0b('0x2d')](_0x2d8d23[_0x1e0b('0x29')],qs[_0x1e0b('0x2f')](_0x1927a7[_0x1e0b('0x2b')][_0x1e0b('0x2f')]));_0x193d5c['attributes']=_0x193d5c[_0x1e0b('0x2e')][_0x1e0b('0x30')]?_0x193d5c[_0x1e0b('0x2e')]:_0x2d8d23[_0x1e0b('0x29')];if(!_0x1927a7[_0x1e0b('0x2b')][_0x1e0b('0x31')]('nolimit')){_0x193d5c[_0x1e0b('0x32')]=qs[_0x1e0b('0x32')](_0x1927a7[_0x1e0b('0x2b')][_0x1e0b('0x32')]);_0x193d5c[_0x1e0b('0x18')]=qs[_0x1e0b('0x18')](_0x1927a7[_0x1e0b('0x2b')][_0x1e0b('0x18')]);}_0x193d5c['order']=qs['sort'](_0x1927a7[_0x1e0b('0x2b')][_0x1e0b('0x33')]);_0x193d5c[_0x1e0b('0x34')]=qs['filters'](_[_0x1e0b('0x35')](_0x1927a7[_0x1e0b('0x2b')],_0x2d8d23[_0x1e0b('0x36')]),_0x5eee1f);if(_0x1927a7[_0x1e0b('0x2b')][_0x1e0b('0x37')]){_0x193d5c[_0x1e0b('0x34')]=_[_0x1e0b('0x38')](_0x193d5c[_0x1e0b('0x34')],{'$or':_[_0x1e0b('0x39')](_0x5eee1f,function(_0x2381f2){if(_0x2381f2[_0x1e0b('0x3a')]!=='VIRTUAL'){var _0x5d9c63={};_0x5d9c63[_0x2381f2[_0x1e0b('0x2a')]]={'$like':'%'+_0x1927a7[_0x1e0b('0x2b')]['filter']+'%'};return _0x5d9c63;}})});}_0x193d5c=_[_0x1e0b('0x38')]({},_0x193d5c,_0x1927a7['options']);var _0x32c0a5={'where':_0x193d5c[_0x1e0b('0x34')]};return db[_0x1e0b('0x26')]['count'](_0x32c0a5)[_0x1e0b('0x20')](function(_0x473b55){_0x7d65e8[_0x1e0b('0x1a')]=_0x473b55;if(_0x1927a7[_0x1e0b('0x2b')]['includeAll']){_0x193d5c[_0x1e0b('0x3b')]=[{'all':!![]}];}return db[_0x1e0b('0x26')][_0x1e0b('0x3c')](_0x193d5c);})[_0x1e0b('0x20')](function(_0x3d3677){_0x7d65e8[_0x1e0b('0x3d')]=_0x3d3677;return _0x7d65e8;})[_0x1e0b('0x20')](respondWithFilteredResult(_0x4ddc03,_0x193d5c))['catch'](handleError(_0x4ddc03,null));};exports[_0x1e0b('0x3e')]=function(_0x3ac90d,_0x3462e3){var _0x3c0848={'raw':![],'where':{'id':_0x3ac90d[_0x1e0b('0x3f')]['id']}},_0x1894cf={};_0x1894cf['model']=_['keys'](db[_0x1e0b('0x26')][_0x1e0b('0x27')]);_0x1894cf[_0x1e0b('0x2b')]=_['keys'](_0x3ac90d[_0x1e0b('0x2b')]);_0x1894cf[_0x1e0b('0x36')]=_[_0x1e0b('0x2d')](_0x1894cf[_0x1e0b('0x29')],_0x1894cf['query']);_0x3c0848[_0x1e0b('0x2e')]=_[_0x1e0b('0x2d')](_0x1894cf[_0x1e0b('0x29')],qs[_0x1e0b('0x2f')](_0x3ac90d['query'][_0x1e0b('0x2f')]));_0x3c0848[_0x1e0b('0x2e')]=_0x3c0848['attributes'][_0x1e0b('0x30')]?_0x3c0848['attributes']:_0x1894cf[_0x1e0b('0x29')];if(_0x3ac90d[_0x1e0b('0x2b')][_0x1e0b('0x40')]){_0x3c0848[_0x1e0b('0x3b')]=[{'all':!![]}];}_0x3c0848=_[_0x1e0b('0x38')]({},_0x3c0848,_0x3ac90d[_0x1e0b('0x41')]);return db[_0x1e0b('0x26')]['find'](_0x3c0848)['then'](handleEntityNotFound(_0x3462e3,null))[_0x1e0b('0x20')](respondWithResult(_0x3462e3,null))[_0x1e0b('0x42')](handleError(_0x3462e3,null));};exports[_0x1e0b('0x43')]=function(_0x45b956,_0x46d801){return db['SugarcrmConfiguration'][_0x1e0b('0x43')](_0x45b956[_0x1e0b('0x44')],{})[_0x1e0b('0x20')](respondWithResult(_0x46d801,0xc9))[_0x1e0b('0x42')](handleError(_0x46d801,null));};exports[_0x1e0b('0x45')]=function(_0x4b88c8,_0x49f7fe){if(_0x4b88c8[_0x1e0b('0x44')]['id']){delete _0x4b88c8['body']['id'];}return db[_0x1e0b('0x26')][_0x1e0b('0x46')]({'where':{'id':_0x4b88c8['params']['id']}})[_0x1e0b('0x20')](handleEntityNotFound(_0x49f7fe,null))[_0x1e0b('0x20')](saveUpdates(_0x4b88c8[_0x1e0b('0x44')],null))[_0x1e0b('0x20')](respondWithResult(_0x49f7fe,null))[_0x1e0b('0x42')](handleError(_0x49f7fe,null));};exports['destroy']=function(_0x4d59c2,_0x664d7e){return db[_0x1e0b('0x26')][_0x1e0b('0x46')]({'where':{'id':_0x4d59c2[_0x1e0b('0x3f')]['id']}})[_0x1e0b('0x20')](handleEntityNotFound(_0x664d7e,null))[_0x1e0b('0x20')](removeEntity(_0x664d7e,null))[_0x1e0b('0x42')](handleError(_0x664d7e,null));};exports['getFields']=function(_0x2c1011,_0x5176c5,_0x413774){var _0x44cc65={};var _0xad8d10={};var _0x365c3d;var _0x3a32db;return db[_0x1e0b('0x26')][_0x1e0b('0x47')]({'where':{'id':_0x2c1011[_0x1e0b('0x3f')]['id']}})[_0x1e0b('0x20')](handleEntityNotFound(_0x5176c5,null))['then'](function(_0x593b8a){if(_0x593b8a){_0x365c3d=_0x593b8a;_0xad8d10[_0x1e0b('0x29')]=_['keys'](db[_0x1e0b('0x48')][_0x1e0b('0x27')]);_0xad8d10[_0x1e0b('0x2b')]=_[_0x1e0b('0x2c')](_0x2c1011[_0x1e0b('0x2b')]);_0xad8d10['filters']=_[_0x1e0b('0x2d')](_0xad8d10['model'],_0xad8d10['query']);_0x44cc65[_0x1e0b('0x2e')]=_['intersection'](_0xad8d10[_0x1e0b('0x29')],qs[_0x1e0b('0x2f')](_0x2c1011['query']['fields']));_0x44cc65[_0x1e0b('0x2e')]=_0x44cc65[_0x1e0b('0x2e')][_0x1e0b('0x30')]?_0x44cc65[_0x1e0b('0x2e')]:_0xad8d10[_0x1e0b('0x29')];_0x44cc65[_0x1e0b('0x49')]=qs['sort'](_0x2c1011['query'][_0x1e0b('0x33')]);_0x44cc65[_0x1e0b('0x34')]=qs[_0x1e0b('0x36')](_['pick'](_0x2c1011[_0x1e0b('0x2b')],_0xad8d10[_0x1e0b('0x36')]));if(_0x2c1011[_0x1e0b('0x2b')][_0x1e0b('0x37')]){_0x44cc65[_0x1e0b('0x34')]=_['merge'](_0x44cc65[_0x1e0b('0x34')],{'$or':_['map'](_0x44cc65[_0x1e0b('0x2e')],function(_0x38be13){var _0x36cb3b={};_0x36cb3b[_0x38be13]={'$like':'%'+_0x2c1011['query'][_0x1e0b('0x37')]+'%'};return _0x36cb3b;})});}_0x44cc65=_[_0x1e0b('0x38')]({},_0x44cc65,_0x2c1011['options']);return _0x365c3d['getFields'](_0x44cc65);}})[_0x1e0b('0x20')](function(_0x381dd5){if(_0x381dd5){_0x3a32db=_0x381dd5[_0x1e0b('0x30')];if(!_0x2c1011[_0x1e0b('0x2b')][_0x1e0b('0x31')](_0x1e0b('0x4a'))){_0x44cc65['limit']=qs[_0x1e0b('0x32')](_0x2c1011[_0x1e0b('0x2b')][_0x1e0b('0x32')]);_0x44cc65[_0x1e0b('0x18')]=qs['offset'](_0x2c1011['query'][_0x1e0b('0x18')]);}return _0x365c3d[_0x1e0b('0x4b')](_0x44cc65);}})[_0x1e0b('0x20')](function(_0x111214){if(_0x111214){return _0x111214?{'count':_0x3a32db,'rows':_0x111214}:null;}})[_0x1e0b('0x20')](respondWithResult(_0x5176c5,null))['catch'](handleError(_0x5176c5,null));};exports[_0x1e0b('0x4c')]=function(_0x56a331,_0x4d7b00,_0x1fa391){var _0x38fb8d={};var _0x446a37={};var _0x3f49bc;var _0x35c776;return db['SugarcrmConfiguration'][_0x1e0b('0x47')]({'where':{'id':_0x56a331[_0x1e0b('0x3f')]['id']}})[_0x1e0b('0x20')](handleEntityNotFound(_0x4d7b00,null))['then'](function(_0x2fb540){if(_0x2fb540){_0x3f49bc=_0x2fb540;_0x446a37[_0x1e0b('0x29')]=_[_0x1e0b('0x2c')](db[_0x1e0b('0x48')][_0x1e0b('0x27')]);_0x446a37[_0x1e0b('0x2b')]=_[_0x1e0b('0x2c')](_0x56a331[_0x1e0b('0x2b')]);_0x446a37[_0x1e0b('0x36')]=_[_0x1e0b('0x2d')](_0x446a37[_0x1e0b('0x29')],_0x446a37[_0x1e0b('0x2b')]);_0x38fb8d[_0x1e0b('0x2e')]=_[_0x1e0b('0x2d')](_0x446a37[_0x1e0b('0x29')],qs[_0x1e0b('0x2f')](_0x56a331[_0x1e0b('0x2b')]['fields']));_0x38fb8d[_0x1e0b('0x2e')]=_0x38fb8d[_0x1e0b('0x2e')][_0x1e0b('0x30')]?_0x38fb8d['attributes']:_0x446a37[_0x1e0b('0x29')];_0x38fb8d[_0x1e0b('0x49')]=qs['sort'](_0x56a331[_0x1e0b('0x2b')][_0x1e0b('0x33')]);_0x38fb8d[_0x1e0b('0x34')]=qs[_0x1e0b('0x36')](_[_0x1e0b('0x35')](_0x56a331['query'],_0x446a37['filters']));if(_0x56a331[_0x1e0b('0x2b')][_0x1e0b('0x37')]){_0x38fb8d[_0x1e0b('0x34')]=_['merge'](_0x38fb8d[_0x1e0b('0x34')],{'$or':_['map'](_0x38fb8d[_0x1e0b('0x2e')],function(_0xa5ab1e){var _0xd7110={};_0xd7110[_0xa5ab1e]={'$like':'%'+_0x56a331[_0x1e0b('0x2b')][_0x1e0b('0x37')]+'%'};return _0xd7110;})});}_0x38fb8d=_['merge']({},_0x38fb8d,_0x56a331['options']);return _0x3f49bc['getSubjects'](_0x38fb8d);}})['then'](function(_0x5ac322){if(_0x5ac322){_0x35c776=_0x5ac322[_0x1e0b('0x30')];if(!_0x56a331[_0x1e0b('0x2b')][_0x1e0b('0x31')]('nolimit')){_0x38fb8d[_0x1e0b('0x32')]=qs['limit'](_0x56a331[_0x1e0b('0x2b')][_0x1e0b('0x32')]);_0x38fb8d[_0x1e0b('0x18')]=qs['offset'](_0x56a331[_0x1e0b('0x2b')][_0x1e0b('0x18')]);}return _0x3f49bc[_0x1e0b('0x4c')](_0x38fb8d);}})[_0x1e0b('0x20')](function(_0x2336b4){if(_0x2336b4){return _0x2336b4?{'count':_0x35c776,'rows':_0x2336b4}:null;}})[_0x1e0b('0x20')](respondWithResult(_0x4d7b00,null))[_0x1e0b('0x42')](handleError(_0x4d7b00,null));};exports[_0x1e0b('0x4d')]=function(_0x309641,_0x64ec05,_0xa8128c){var _0x2f229e={};var _0x343a74={};var _0x524a57;var _0x45ecfe;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x309641[_0x1e0b('0x3f')]['id']}})[_0x1e0b('0x20')](handleEntityNotFound(_0x64ec05,null))[_0x1e0b('0x20')](function(_0x5c6979){if(_0x5c6979){_0x524a57=_0x5c6979;_0x343a74['model']=_['keys'](db[_0x1e0b('0x48')][_0x1e0b('0x27')]);_0x343a74[_0x1e0b('0x2b')]=_[_0x1e0b('0x2c')](_0x309641[_0x1e0b('0x2b')]);_0x343a74['filters']=_[_0x1e0b('0x2d')](_0x343a74[_0x1e0b('0x29')],_0x343a74[_0x1e0b('0x2b')]);_0x2f229e[_0x1e0b('0x2e')]=_[_0x1e0b('0x2d')](_0x343a74[_0x1e0b('0x29')],qs[_0x1e0b('0x2f')](_0x309641[_0x1e0b('0x2b')][_0x1e0b('0x2f')]));_0x2f229e[_0x1e0b('0x2e')]=_0x2f229e[_0x1e0b('0x2e')]['length']?_0x2f229e[_0x1e0b('0x2e')]:_0x343a74[_0x1e0b('0x29')];_0x2f229e[_0x1e0b('0x49')]=qs[_0x1e0b('0x33')](_0x309641['query'][_0x1e0b('0x33')]);_0x2f229e[_0x1e0b('0x34')]=qs[_0x1e0b('0x36')](_[_0x1e0b('0x35')](_0x309641[_0x1e0b('0x2b')],_0x343a74[_0x1e0b('0x36')]));if(_0x309641['query'][_0x1e0b('0x37')]){_0x2f229e['where']=_[_0x1e0b('0x38')](_0x2f229e[_0x1e0b('0x34')],{'$or':_[_0x1e0b('0x39')](_0x2f229e[_0x1e0b('0x2e')],function(_0x32d04b){var _0x475079={};_0x475079[_0x32d04b]={'$like':'%'+_0x309641['query'][_0x1e0b('0x37')]+'%'};return _0x475079;})});}_0x2f229e=_[_0x1e0b('0x38')]({},_0x2f229e,_0x309641[_0x1e0b('0x41')]);return _0x524a57[_0x1e0b('0x4d')](_0x2f229e);}})[_0x1e0b('0x20')](function(_0x35d310){if(_0x35d310){_0x45ecfe=_0x35d310['length'];if(!_0x309641[_0x1e0b('0x2b')]['hasOwnProperty'](_0x1e0b('0x4a'))){_0x2f229e[_0x1e0b('0x32')]=qs['limit'](_0x309641[_0x1e0b('0x2b')][_0x1e0b('0x32')]);_0x2f229e[_0x1e0b('0x18')]=qs['offset'](_0x309641[_0x1e0b('0x2b')][_0x1e0b('0x18')]);}return _0x524a57['getDescriptions'](_0x2f229e);}})[_0x1e0b('0x20')](function(_0x5dda9d){if(_0x5dda9d){return _0x5dda9d?{'count':_0x45ecfe,'rows':_0x5dda9d}:null;}})[_0x1e0b('0x20')](respondWithResult(_0x64ec05,null))['catch'](handleError(_0x64ec05,null));}; \ No newline at end of file +var _0x40b8=['../../mysqldb','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','include','findAll','rows','show','params','options','find','catch','create','body','findOne','SugarcrmField','hasOwnProperty','getFields','getSubjects','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x4b2fa0,_0x5eae66){var _0x42db4d=function(_0x7affda){while(--_0x7affda){_0x4b2fa0['push'](_0x4b2fa0['shift']());}};_0x42db4d(++_0x5eae66);}(_0x40b8,0x12b));var _0x840b=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x40b8[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require(_0x840b('0x0'));var rimraf=require(_0x840b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x840b('0x2'));var rp=require(_0x840b('0x3'));var moment=require(_0x840b('0x4'));var BPromise=require(_0x840b('0x5'));var Mustache=require(_0x840b('0x6'));var util=require(_0x840b('0x7'));var path=require(_0x840b('0x8'));var sox=require(_0x840b('0x9'));var csv=require(_0x840b('0xa'));var ejs=require(_0x840b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x840b('0xc'));var squel=require('squel');var crypto=require(_0x840b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x840b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x840b('0xf'));var Papa=require(_0x840b('0x10'));var Redis=require(_0x840b('0x11'));var authService=require(_0x840b('0x12'));var qs=require(_0x840b('0x13'));var as=require(_0x840b('0x14'));var hardwareService=require(_0x840b('0x15'));var logger=require(_0x840b('0x16'))('api');var utils=require(_0x840b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x840b('0x18'));var db=require(_0x840b('0x19'))['db'];function respondWithStatusCode(_0x1f146a,_0x53e196){_0x53e196=_0x53e196||0xcc;return function(_0x2ca6f7){if(_0x2ca6f7){return _0x1f146a['sendStatus'](_0x53e196);}return _0x1f146a[_0x840b('0x1a')](_0x53e196)[_0x840b('0x1b')]();};}function respondWithResult(_0x5dc991,_0x5c629f){_0x5c629f=_0x5c629f||0xc8;return function(_0x358e76){if(_0x358e76){return _0x5dc991['status'](_0x5c629f)['json'](_0x358e76);}};}function respondWithFilteredResult(_0x326787,_0x57db48){return function(_0x25b2f6){if(_0x25b2f6){var _0x542e68=typeof _0x57db48['offset']===_0x840b('0x1c')&&typeof _0x57db48[_0x840b('0x1d')]===_0x840b('0x1c');var _0x499d13=_0x25b2f6['count'];var _0x1a1d4e=_0x542e68?0x0:_0x57db48[_0x840b('0x1e')];var _0x427810=_0x542e68?_0x25b2f6[_0x840b('0x1f')]:_0x57db48[_0x840b('0x1e')]+_0x57db48[_0x840b('0x1d')];var _0x36b85f;if(_0x427810>=_0x499d13){_0x427810=_0x499d13;_0x36b85f=0xc8;}else{_0x36b85f=0xce;}_0x326787['status'](_0x36b85f);return _0x326787['set'](_0x840b('0x20'),_0x1a1d4e+'-'+_0x427810+'/'+_0x499d13)[_0x840b('0x21')](_0x25b2f6);}return null;};}function patchUpdates(_0x478ebc){return function(_0x86ee96){try{jsonpatch[_0x840b('0x22')](_0x86ee96,_0x478ebc,!![]);}catch(_0x20b9a1){return BPromise[_0x840b('0x23')](_0x20b9a1);}return _0x86ee96[_0x840b('0x24')]();};}function saveUpdates(_0x2e09d6,_0x18aad5){return function(_0x58baa6){if(_0x58baa6){return _0x58baa6[_0x840b('0x25')](_0x2e09d6)[_0x840b('0x26')](function(_0x14eab3){return _0x14eab3;});}return null;};}function removeEntity(_0x30f7bc,_0x461c0f){return function(_0x35705f){if(_0x35705f){return _0x35705f[_0x840b('0x27')]()[_0x840b('0x26')](function(){_0x30f7bc[_0x840b('0x1a')](0xcc)[_0x840b('0x1b')]();});}};}function handleEntityNotFound(_0x4ec233,_0x34c2ee){return function(_0xd803b5){if(!_0xd803b5){_0x4ec233[_0x840b('0x28')](0x194);}return _0xd803b5;};}function handleError(_0x6c2c42,_0x4b0deb){_0x4b0deb=_0x4b0deb||0x1f4;return function(_0x4ac9e5){logger[_0x840b('0x29')](_0x4ac9e5[_0x840b('0x2a')]);if(_0x4ac9e5[_0x840b('0x2b')]){delete _0x4ac9e5[_0x840b('0x2b')];}_0x6c2c42[_0x840b('0x1a')](_0x4b0deb)[_0x840b('0x2c')](_0x4ac9e5);};}exports[_0x840b('0x2d')]=function(_0x5200d1,_0x20d6bb){var _0x3f78b1={},_0x535120={},_0x26e56a={'count':0x0,'rows':[]};var _0xa5a276=_[_0x840b('0x2e')](db[_0x840b('0x2f')][_0x840b('0x30')],function(_0x1b45cb){return{'name':_0x1b45cb['fieldName'],'type':_0x1b45cb['type']['key']};});_0x535120['model']=_[_0x840b('0x2e')](_0xa5a276,'name');_0x535120[_0x840b('0x31')]=_[_0x840b('0x32')](_0x5200d1[_0x840b('0x31')]);_0x535120[_0x840b('0x33')]=_[_0x840b('0x34')](_0x535120[_0x840b('0x35')],_0x535120['query']);_0x3f78b1[_0x840b('0x36')]=_[_0x840b('0x34')](_0x535120['model'],qs[_0x840b('0x37')](_0x5200d1['query'][_0x840b('0x37')]));_0x3f78b1[_0x840b('0x36')]=_0x3f78b1[_0x840b('0x36')][_0x840b('0x38')]?_0x3f78b1[_0x840b('0x36')]:_0x535120[_0x840b('0x35')];if(!_0x5200d1[_0x840b('0x31')]['hasOwnProperty'](_0x840b('0x39'))){_0x3f78b1[_0x840b('0x1d')]=qs[_0x840b('0x1d')](_0x5200d1[_0x840b('0x31')][_0x840b('0x1d')]);_0x3f78b1[_0x840b('0x1e')]=qs[_0x840b('0x1e')](_0x5200d1[_0x840b('0x31')][_0x840b('0x1e')]);}_0x3f78b1[_0x840b('0x3a')]=qs['sort'](_0x5200d1[_0x840b('0x31')][_0x840b('0x3b')]);_0x3f78b1['where']=qs[_0x840b('0x33')](_[_0x840b('0x3c')](_0x5200d1[_0x840b('0x31')],_0x535120[_0x840b('0x33')]),_0xa5a276);if(_0x5200d1[_0x840b('0x31')]['filter']){_0x3f78b1[_0x840b('0x3d')]=_[_0x840b('0x3e')](_0x3f78b1[_0x840b('0x3d')],{'$or':_[_0x840b('0x2e')](_0xa5a276,function(_0x2c75d7){if(_0x2c75d7[_0x840b('0x3f')]!==_0x840b('0x40')){var _0xbce4f5={};_0xbce4f5[_0x2c75d7['name']]={'$like':'%'+_0x5200d1['query'][_0x840b('0x41')]+'%'};return _0xbce4f5;}})});}_0x3f78b1=_[_0x840b('0x3e')]({},_0x3f78b1,_0x5200d1['options']);var _0x43bf3b={'where':_0x3f78b1['where']};return db[_0x840b('0x2f')][_0x840b('0x1f')](_0x43bf3b)[_0x840b('0x26')](function(_0x16d309){_0x26e56a[_0x840b('0x1f')]=_0x16d309;if(_0x5200d1[_0x840b('0x31')]['includeAll']){_0x3f78b1[_0x840b('0x42')]=[{'all':!![]}];}return db[_0x840b('0x2f')][_0x840b('0x43')](_0x3f78b1);})[_0x840b('0x26')](function(_0xb46ef4){_0x26e56a[_0x840b('0x44')]=_0xb46ef4;return _0x26e56a;})[_0x840b('0x26')](respondWithFilteredResult(_0x20d6bb,_0x3f78b1))['catch'](handleError(_0x20d6bb,null));};exports[_0x840b('0x45')]=function(_0x3e5e71,_0x343de5){var _0x369ca9={'raw':![],'where':{'id':_0x3e5e71[_0x840b('0x46')]['id']}},_0x1b0a32={};_0x1b0a32[_0x840b('0x35')]=_[_0x840b('0x32')](db[_0x840b('0x2f')][_0x840b('0x30')]);_0x1b0a32[_0x840b('0x31')]=_['keys'](_0x3e5e71['query']);_0x1b0a32[_0x840b('0x33')]=_['intersection'](_0x1b0a32[_0x840b('0x35')],_0x1b0a32[_0x840b('0x31')]);_0x369ca9[_0x840b('0x36')]=_['intersection'](_0x1b0a32[_0x840b('0x35')],qs['fields'](_0x3e5e71[_0x840b('0x31')][_0x840b('0x37')]));_0x369ca9[_0x840b('0x36')]=_0x369ca9[_0x840b('0x36')][_0x840b('0x38')]?_0x369ca9[_0x840b('0x36')]:_0x1b0a32[_0x840b('0x35')];if(_0x3e5e71[_0x840b('0x31')]['includeAll']){_0x369ca9[_0x840b('0x42')]=[{'all':!![]}];}_0x369ca9=_[_0x840b('0x3e')]({},_0x369ca9,_0x3e5e71[_0x840b('0x47')]);return db[_0x840b('0x2f')][_0x840b('0x48')](_0x369ca9)['then'](handleEntityNotFound(_0x343de5,null))[_0x840b('0x26')](respondWithResult(_0x343de5,null))[_0x840b('0x49')](handleError(_0x343de5,null));};exports[_0x840b('0x4a')]=function(_0x457cc7,_0xcc5172){return db['SugarcrmConfiguration']['create'](_0x457cc7[_0x840b('0x4b')],{})[_0x840b('0x26')](respondWithResult(_0xcc5172,0xc9))['catch'](handleError(_0xcc5172,null));};exports[_0x840b('0x25')]=function(_0x60058f,_0x2430db){if(_0x60058f[_0x840b('0x4b')]['id']){delete _0x60058f[_0x840b('0x4b')]['id'];}return db['SugarcrmConfiguration'][_0x840b('0x48')]({'where':{'id':_0x60058f[_0x840b('0x46')]['id']}})[_0x840b('0x26')](handleEntityNotFound(_0x2430db,null))['then'](saveUpdates(_0x60058f[_0x840b('0x4b')],null))[_0x840b('0x26')](respondWithResult(_0x2430db,null))[_0x840b('0x49')](handleError(_0x2430db,null));};exports[_0x840b('0x27')]=function(_0x1012b4,_0x1b3f64){return db[_0x840b('0x2f')]['find']({'where':{'id':_0x1012b4['params']['id']}})[_0x840b('0x26')](handleEntityNotFound(_0x1b3f64,null))[_0x840b('0x26')](removeEntity(_0x1b3f64,null))[_0x840b('0x49')](handleError(_0x1b3f64,null));};exports['getFields']=function(_0x585bc6,_0x57f57b,_0x407928){var _0x2b83eb={};var _0x2ea3f7={};var _0x554ccf;var _0x356500;return db[_0x840b('0x2f')][_0x840b('0x4c')]({'where':{'id':_0x585bc6['params']['id']}})[_0x840b('0x26')](handleEntityNotFound(_0x57f57b,null))[_0x840b('0x26')](function(_0xf21a13){if(_0xf21a13){_0x554ccf=_0xf21a13;_0x2ea3f7[_0x840b('0x35')]=_[_0x840b('0x32')](db[_0x840b('0x4d')][_0x840b('0x30')]);_0x2ea3f7['query']=_[_0x840b('0x32')](_0x585bc6[_0x840b('0x31')]);_0x2ea3f7[_0x840b('0x33')]=_[_0x840b('0x34')](_0x2ea3f7[_0x840b('0x35')],_0x2ea3f7[_0x840b('0x31')]);_0x2b83eb[_0x840b('0x36')]=_['intersection'](_0x2ea3f7[_0x840b('0x35')],qs[_0x840b('0x37')](_0x585bc6['query'][_0x840b('0x37')]));_0x2b83eb['attributes']=_0x2b83eb['attributes']['length']?_0x2b83eb[_0x840b('0x36')]:_0x2ea3f7[_0x840b('0x35')];_0x2b83eb[_0x840b('0x3a')]=qs[_0x840b('0x3b')](_0x585bc6[_0x840b('0x31')][_0x840b('0x3b')]);_0x2b83eb[_0x840b('0x3d')]=qs[_0x840b('0x33')](_['pick'](_0x585bc6[_0x840b('0x31')],_0x2ea3f7[_0x840b('0x33')]));if(_0x585bc6['query'][_0x840b('0x41')]){_0x2b83eb[_0x840b('0x3d')]=_['merge'](_0x2b83eb[_0x840b('0x3d')],{'$or':_[_0x840b('0x2e')](_0x2b83eb[_0x840b('0x36')],function(_0x49683e){var _0x4aebda={};_0x4aebda[_0x49683e]={'$like':'%'+_0x585bc6[_0x840b('0x31')]['filter']+'%'};return _0x4aebda;})});}_0x2b83eb=_[_0x840b('0x3e')]({},_0x2b83eb,_0x585bc6[_0x840b('0x47')]);return _0x554ccf['getFields'](_0x2b83eb);}})['then'](function(_0x280442){if(_0x280442){_0x356500=_0x280442[_0x840b('0x38')];if(!_0x585bc6[_0x840b('0x31')][_0x840b('0x4e')](_0x840b('0x39'))){_0x2b83eb['limit']=qs[_0x840b('0x1d')](_0x585bc6[_0x840b('0x31')][_0x840b('0x1d')]);_0x2b83eb[_0x840b('0x1e')]=qs[_0x840b('0x1e')](_0x585bc6[_0x840b('0x31')][_0x840b('0x1e')]);}return _0x554ccf[_0x840b('0x4f')](_0x2b83eb);}})[_0x840b('0x26')](function(_0xff3f40){if(_0xff3f40){return _0xff3f40?{'count':_0x356500,'rows':_0xff3f40}:null;}})[_0x840b('0x26')](respondWithResult(_0x57f57b,null))[_0x840b('0x49')](handleError(_0x57f57b,null));};exports['getSubjects']=function(_0x29301f,_0x505e5b,_0x7fa307){var _0x79d740={};var _0x1ff7ee={};var _0x55112a;var _0x2c0780;return db['SugarcrmConfiguration'][_0x840b('0x4c')]({'where':{'id':_0x29301f['params']['id']}})[_0x840b('0x26')](handleEntityNotFound(_0x505e5b,null))[_0x840b('0x26')](function(_0x496df8){if(_0x496df8){_0x55112a=_0x496df8;_0x1ff7ee[_0x840b('0x35')]=_[_0x840b('0x32')](db['SugarcrmField'][_0x840b('0x30')]);_0x1ff7ee['query']=_[_0x840b('0x32')](_0x29301f[_0x840b('0x31')]);_0x1ff7ee[_0x840b('0x33')]=_[_0x840b('0x34')](_0x1ff7ee[_0x840b('0x35')],_0x1ff7ee[_0x840b('0x31')]);_0x79d740['attributes']=_[_0x840b('0x34')](_0x1ff7ee[_0x840b('0x35')],qs['fields'](_0x29301f[_0x840b('0x31')][_0x840b('0x37')]));_0x79d740[_0x840b('0x36')]=_0x79d740[_0x840b('0x36')][_0x840b('0x38')]?_0x79d740[_0x840b('0x36')]:_0x1ff7ee[_0x840b('0x35')];_0x79d740[_0x840b('0x3a')]=qs[_0x840b('0x3b')](_0x29301f[_0x840b('0x31')][_0x840b('0x3b')]);_0x79d740[_0x840b('0x3d')]=qs[_0x840b('0x33')](_[_0x840b('0x3c')](_0x29301f['query'],_0x1ff7ee[_0x840b('0x33')]));if(_0x29301f[_0x840b('0x31')][_0x840b('0x41')]){_0x79d740['where']=_[_0x840b('0x3e')](_0x79d740[_0x840b('0x3d')],{'$or':_[_0x840b('0x2e')](_0x79d740[_0x840b('0x36')],function(_0x40c49a){var _0x18d8d6={};_0x18d8d6[_0x40c49a]={'$like':'%'+_0x29301f[_0x840b('0x31')][_0x840b('0x41')]+'%'};return _0x18d8d6;})});}_0x79d740=_[_0x840b('0x3e')]({},_0x79d740,_0x29301f[_0x840b('0x47')]);return _0x55112a['getSubjects'](_0x79d740);}})[_0x840b('0x26')](function(_0x1b391c){if(_0x1b391c){_0x2c0780=_0x1b391c[_0x840b('0x38')];if(!_0x29301f[_0x840b('0x31')]['hasOwnProperty'](_0x840b('0x39'))){_0x79d740[_0x840b('0x1d')]=qs['limit'](_0x29301f['query'][_0x840b('0x1d')]);_0x79d740[_0x840b('0x1e')]=qs[_0x840b('0x1e')](_0x29301f['query'][_0x840b('0x1e')]);}return _0x55112a[_0x840b('0x50')](_0x79d740);}})[_0x840b('0x26')](function(_0x177542){if(_0x177542){return _0x177542?{'count':_0x2c0780,'rows':_0x177542}:null;}})[_0x840b('0x26')](respondWithResult(_0x505e5b,null))[_0x840b('0x49')](handleError(_0x505e5b,null));};exports['getDescriptions']=function(_0x230352,_0xa3b2ad,_0x2b628b){var _0x120e66={};var _0xda4a42={};var _0x8aa7c1;var _0x90db39;return db['SugarcrmConfiguration'][_0x840b('0x4c')]({'where':{'id':_0x230352[_0x840b('0x46')]['id']}})[_0x840b('0x26')](handleEntityNotFound(_0xa3b2ad,null))[_0x840b('0x26')](function(_0x28edcf){if(_0x28edcf){_0x8aa7c1=_0x28edcf;_0xda4a42[_0x840b('0x35')]=_[_0x840b('0x32')](db['SugarcrmField'][_0x840b('0x30')]);_0xda4a42['query']=_[_0x840b('0x32')](_0x230352['query']);_0xda4a42[_0x840b('0x33')]=_[_0x840b('0x34')](_0xda4a42['model'],_0xda4a42[_0x840b('0x31')]);_0x120e66['attributes']=_[_0x840b('0x34')](_0xda4a42[_0x840b('0x35')],qs['fields'](_0x230352[_0x840b('0x31')][_0x840b('0x37')]));_0x120e66['attributes']=_0x120e66[_0x840b('0x36')][_0x840b('0x38')]?_0x120e66[_0x840b('0x36')]:_0xda4a42[_0x840b('0x35')];_0x120e66[_0x840b('0x3a')]=qs[_0x840b('0x3b')](_0x230352[_0x840b('0x31')][_0x840b('0x3b')]);_0x120e66[_0x840b('0x3d')]=qs[_0x840b('0x33')](_[_0x840b('0x3c')](_0x230352[_0x840b('0x31')],_0xda4a42['filters']));if(_0x230352[_0x840b('0x31')][_0x840b('0x41')]){_0x120e66[_0x840b('0x3d')]=_[_0x840b('0x3e')](_0x120e66[_0x840b('0x3d')],{'$or':_['map'](_0x120e66[_0x840b('0x36')],function(_0x5e1431){var _0x33f16f={};_0x33f16f[_0x5e1431]={'$like':'%'+_0x230352[_0x840b('0x31')][_0x840b('0x41')]+'%'};return _0x33f16f;})});}_0x120e66=_[_0x840b('0x3e')]({},_0x120e66,_0x230352[_0x840b('0x47')]);return _0x8aa7c1['getDescriptions'](_0x120e66);}})[_0x840b('0x26')](function(_0x37e725){if(_0x37e725){_0x90db39=_0x37e725[_0x840b('0x38')];if(!_0x230352[_0x840b('0x31')][_0x840b('0x4e')](_0x840b('0x39'))){_0x120e66[_0x840b('0x1d')]=qs[_0x840b('0x1d')](_0x230352[_0x840b('0x31')][_0x840b('0x1d')]);_0x120e66[_0x840b('0x1e')]=qs['offset'](_0x230352[_0x840b('0x31')][_0x840b('0x1e')]);}return _0x8aa7c1['getDescriptions'](_0x120e66);}})[_0x840b('0x26')](function(_0x560a55){if(_0x560a55){return _0x560a55?{'count':_0x90db39,'rows':_0x560a55}:null;}})['then'](respondWithResult(_0xa3b2ad,null))[_0x840b('0x49')](handleError(_0xa3b2ad,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6c2dcf2..d1f90d8 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 _0xdd4e=['path','rimraf','exports','SugarcrmConfiguration','util','../../config/logger','api','moment','bluebird'];(function(_0x43c9a5,_0x4c283e){var _0x2822ac=function(_0xe54ea0){while(--_0xe54ea0){_0x43c9a5['push'](_0x43c9a5['shift']());}};_0x2822ac(++_0x4c283e);}(_0xdd4e,0xdc));var _0xedd4=function(_0x5ad190,_0xd39c9e){_0x5ad190=_0x5ad190-0x0;var _0x518ed3=_0xdd4e[_0x5ad190];return _0x518ed3;};'use strict';var _=require('lodash');var util=require(_0xedd4('0x0'));var logger=require(_0xedd4('0x1'))(_0xedd4('0x2'));var moment=require(_0xedd4('0x3'));var BPromise=require(_0xedd4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xedd4('0x5'));var rimraf=require(_0xedd4('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xedd4('0x7')]=function(_0x3ca613,_0xddd4d9){return _0x3ca613['define'](_0xedd4('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b5c=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','bluebird','rimraf'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6b5c,0x19f));var _0xc6b5=function(_0x581f8e,_0x5617cb){_0x581f8e=_0x581f8e-0x0;var _0x18aec=_0x6b5c[_0x581f8e];return _0x18aec;};'use strict';var _=require(_0xc6b5('0x0'));var util=require(_0xc6b5('0x1'));var logger=require('../../config/logger')(_0xc6b5('0x2'));var moment=require('moment');var BPromise=require(_0xc6b5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc6b5('0x4'));var config=require(_0xc6b5('0x5'));var attributes=require(_0xc6b5('0x6'));module[_0xc6b5('0x7')]=function(_0x33abd7,_0x36cc37){return _0x33abd7['define'](_0xc6b5('0x8'),attributes,{'tableName':_0xc6b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 11c525e..f5dbcd0 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 _0x5f48=['catch','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result'];(function(_0x141e1a,_0x251027){var _0x22f1b8=function(_0x541a13){while(--_0x541a13){_0x141e1a['push'](_0x141e1a['shift']());}};_0x22f1b8(++_0x251027);}(_0x5f48,0xfd));var _0x85f4=function(_0x42cb4e,_0x20ff75){_0x42cb4e=_0x42cb4e-0x0;var _0x2f61f5=_0x5f48[_0x42cb4e];return _0x2f61f5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85f4('0x0'));var BPromise=require(_0x85f4('0x1'));var rs=require(_0x85f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x85f4('0x3'))(_0x85f4('0x4'));var config=require(_0x85f4('0x5'));var jayson=require(_0x85f4('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x499253,_0x13a78e,_0x116f25){return new BPromise(function(_0x28a253,_0x1fcf06){return client['request'](_0x499253,_0x116f25)[_0x85f4('0x7')](function(_0x55c639){logger['info'](_0x85f4('0x8'),_0x13a78e,'request\x20sent');logger[_0x85f4('0x9')](_0x85f4('0xa'),_0x13a78e,_0x85f4('0xb'),JSON[_0x85f4('0xc')](_0x55c639));if(_0x55c639['error']){if(_0x55c639['error'][_0x85f4('0xd')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x13a78e,_0x55c639[_0x85f4('0xe')]['message']);return _0x1fcf06(_0x55c639[_0x85f4('0xe')]['message']);}logger[_0x85f4('0xe')](_0x85f4('0x8'),_0x13a78e,_0x55c639['error'][_0x85f4('0xf')]);return _0x28a253(_0x55c639[_0x85f4('0xe')][_0x85f4('0xf')]);}else{logger['info'](_0x85f4('0x8'),_0x13a78e,_0x85f4('0xb'));_0x28a253(_0x55c639[_0x85f4('0x10')][_0x85f4('0xf')]);}})[_0x85f4('0x11')](function(_0x572db4){logger[_0x85f4('0xe')](_0x85f4('0x8'),_0x13a78e,_0x572db4);_0x1fcf06(_0x572db4);});});} \ No newline at end of file +var _0x8ef8=['http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x19b0cf,_0x1fcd3b){var _0x47b140=function(_0x116469){while(--_0x116469){_0x19b0cf['push'](_0x19b0cf['shift']());}};_0x47b140(++_0x1fcd3b);}(_0x8ef8,0x9c));var _0x88ef=function(_0x1fd529,_0x329238){_0x1fd529=_0x1fd529-0x0;var _0x501169=_0x8ef8[_0x1fd529];return _0x501169;};'use strict';var _=require(_0x88ef('0x0'));var util=require(_0x88ef('0x1'));var moment=require(_0x88ef('0x2'));var BPromise=require(_0x88ef('0x3'));var rs=require(_0x88ef('0x4'));var fs=require('fs');var Redis=require(_0x88ef('0x5'));var db=require(_0x88ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x88ef('0x7'))(_0x88ef('0x8'));var config=require(_0x88ef('0x9'));var jayson=require(_0x88ef('0xa'));var client=jayson[_0x88ef('0xb')][_0x88ef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13b382,_0x5f3200,_0x43b127){return new BPromise(function(_0x12d246,_0x471b90){return client[_0x88ef('0xd')](_0x13b382,_0x43b127)[_0x88ef('0xe')](function(_0x5229cb){logger[_0x88ef('0xf')](_0x88ef('0x10'),_0x5f3200,_0x88ef('0x11'));logger[_0x88ef('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5f3200,_0x88ef('0x11'),JSON[_0x88ef('0x13')](_0x5229cb));if(_0x5229cb[_0x88ef('0x14')]){if(_0x5229cb['error']['code']===0x1f4){logger[_0x88ef('0x14')](_0x88ef('0x10'),_0x5f3200,_0x5229cb[_0x88ef('0x14')][_0x88ef('0x15')]);return _0x471b90(_0x5229cb[_0x88ef('0x14')]['message']);}logger['error'](_0x88ef('0x10'),_0x5f3200,_0x5229cb[_0x88ef('0x14')][_0x88ef('0x15')]);return _0x12d246(_0x5229cb[_0x88ef('0x14')][_0x88ef('0x15')]);}else{logger[_0x88ef('0xf')](_0x88ef('0x10'),_0x5f3200,_0x88ef('0x11'));_0x12d246(_0x5229cb[_0x88ef('0x16')][_0x88ef('0x15')]);}})[_0x88ef('0x17')](function(_0x3ae88c){logger['error'](_0x88ef('0x10'),_0x5f3200,_0x3ae88c);_0x471b90(_0x3ae88c);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 185198e..287465f 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 _0xebb6=['get','/:id','isAuthenticated','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index'];(function(_0x346b35,_0x26fce9){var _0x80a306=function(_0x3c1c59){while(--_0x3c1c59){_0x346b35['push'](_0x346b35['shift']());}};_0x80a306(++_0x26fce9);}(_0xebb6,0x67));var _0x6ebb=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xebb6[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require('multer');var util=require(_0x6ebb('0x0'));var path=require(_0x6ebb('0x1'));var timeout=require(_0x6ebb('0x2'));var express=require(_0x6ebb('0x3'));var router=express[_0x6ebb('0x4')]();var fs_extra=require(_0x6ebb('0x5'));var auth=require(_0x6ebb('0x6'));var interaction=require(_0x6ebb('0x7'));var config=require(_0x6ebb('0x8'));var controller=require(_0x6ebb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6ebb('0xa')]);router[_0x6ebb('0xb')](_0x6ebb('0xc'),auth[_0x6ebb('0xd')](),controller['show']);router['post']('/',auth[_0x6ebb('0xd')](),controller[_0x6ebb('0xe')]);router[_0x6ebb('0xf')](_0x6ebb('0xc'),auth[_0x6ebb('0xd')](),controller[_0x6ebb('0x10')]);router[_0x6ebb('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6ebb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5521=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','util'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x5521,0x96));var _0x1552=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5521[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x1552('0x0'));var util=require(_0x1552('0x1'));var path=require(_0x1552('0x2'));var timeout=require(_0x1552('0x3'));var express=require(_0x1552('0x4'));var router=express[_0x1552('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1552('0x6'));var interaction=require(_0x1552('0x7'));var config=require(_0x1552('0x8'));var controller=require(_0x1552('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1552('0xa')]);router['get'](_0x1552('0xb'),auth[_0x1552('0xc')](),controller[_0x1552('0xd')]);router['post']('/',auth[_0x1552('0xc')](),controller[_0x1552('0xe')]);router[_0x1552('0xf')](_0x1552('0xb'),auth['isAuthenticated'](),controller[_0x1552('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1552('0x11')]);module[_0x1552('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5719a49..d116520 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 _0xc97a=['exports','ENUM','string','variable','picklist','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x3b1255,_0x3daf64){var _0x11da82=function(_0x8a8eaf){while(--_0x8a8eaf){_0x3b1255['push'](_0x3b1255['shift']());}};_0x11da82(++_0x3daf64);}(_0xc97a,0x1b8));var _0xac97=function(_0x1d4cf5,_0x2d48b3){_0x1d4cf5=_0x1d4cf5-0x0;var _0x411878=_0xc97a[_0x1d4cf5];return _0x411878;};'use strict';var Sequelize=require(_0xac97('0x0'));module[_0xac97('0x1')]={'type':{'type':Sequelize[_0xac97('0x2')](_0xac97('0x3'),_0xac97('0x4'),'customVariable','keyValue',_0xac97('0x5')),'defaultValue':_0xac97('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xac97('0x2')](_0xac97('0x3'),_0xac97('0x4'),_0xac97('0x6'))},'keyContent':{'type':Sequelize[_0xac97('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xac97('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xefda=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports'];(function(_0x2100ad,_0x301dc3){var _0x27432a=function(_0x266ab2){while(--_0x266ab2){_0x2100ad['push'](_0x2100ad['shift']());}};_0x27432a(++_0x301dc3);}(_0xefda,0xaa));var _0xaefd=function(_0x5d1ebc,_0x4833c7){_0x5d1ebc=_0x5d1ebc-0x0;var _0x65e322=_0xefda[_0x5d1ebc];return _0x65e322;};'use strict';var Sequelize=require('sequelize');module[_0xaefd('0x0')]={'type':{'type':Sequelize[_0xaefd('0x1')](_0xaefd('0x2'),_0xaefd('0x3'),_0xaefd('0x4'),_0xaefd('0x5'),_0xaefd('0x6')),'defaultValue':_0xaefd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xaefd('0x7')]},'keyType':{'type':Sequelize[_0xaefd('0x1')](_0xaefd('0x2'),_0xaefd('0x3'),_0xaefd('0x4'))},'keyContent':{'type':Sequelize[_0xaefd('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaefd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaefd('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0455479..638af5d 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 _0x67b4=['moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','keys','filters','intersection','query','attributes','model','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','rows','catch','show','params','fields','length','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1f0c6c,_0x1b6a08){var _0x4c1fad=function(_0x5c85e){while(--_0x5c85e){_0x1f0c6c['push'](_0x1f0c6c['shift']());}};_0x4c1fad(++_0x1b6a08);}(_0x67b4,0x168));var _0x467b=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x67b4[_0x8a969d];return _0x1d8dc7;};'use strict';var emlformat=require(_0x467b('0x0'));var rimraf=require(_0x467b('0x1'));var zipdir=require(_0x467b('0x2'));var jsonpatch=require(_0x467b('0x3'));var rp=require(_0x467b('0x4'));var moment=require(_0x467b('0x5'));var BPromise=require(_0x467b('0x6'));var Mustache=require(_0x467b('0x7'));var util=require(_0x467b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x467b('0x9'));var ejs=require(_0x467b('0xa'));var fs=require('fs');var fs_extra=require(_0x467b('0xb'));var _=require('lodash');var squel=require(_0x467b('0xc'));var crypto=require(_0x467b('0xd'));var jsforce=require(_0x467b('0xe'));var deskjs=require(_0x467b('0xf'));var toCsv=require(_0x467b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x467b('0x10'));var authService=require(_0x467b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x467b('0x12'));var hardwareService=require(_0x467b('0x13'));var logger=require(_0x467b('0x14'))('api');var utils=require(_0x467b('0x15'));var config=require(_0x467b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x467b('0x17'))['db'];function respondWithStatusCode(_0x50ea5f,_0x397379){_0x397379=_0x397379||0xcc;return function(_0x49f9e3){if(_0x49f9e3){return _0x50ea5f[_0x467b('0x18')](_0x397379);}return _0x50ea5f[_0x467b('0x19')](_0x397379)['end']();};}function respondWithResult(_0x23af2d,_0x1e7114){_0x1e7114=_0x1e7114||0xc8;return function(_0x2c55da){if(_0x2c55da){return _0x23af2d[_0x467b('0x19')](_0x1e7114)['json'](_0x2c55da);}};}function respondWithFilteredResult(_0xb6695f,_0x34eb6f){return function(_0x33896b){if(_0x33896b){var _0x3bb5ee=typeof _0x34eb6f[_0x467b('0x1a')]===_0x467b('0x1b')&&typeof _0x34eb6f[_0x467b('0x1c')]===_0x467b('0x1b');var _0x14c545=_0x33896b['count'];var _0x54cdf7=_0x3bb5ee?0x0:_0x34eb6f['offset'];var _0x1673c5=_0x3bb5ee?_0x33896b[_0x467b('0x1d')]:_0x34eb6f[_0x467b('0x1a')]+_0x34eb6f['limit'];var _0x353a9c;if(_0x1673c5>=_0x14c545){_0x1673c5=_0x14c545;_0x353a9c=0xc8;}else{_0x353a9c=0xce;}_0xb6695f['status'](_0x353a9c);return _0xb6695f[_0x467b('0x1e')](_0x467b('0x1f'),_0x54cdf7+'-'+_0x1673c5+'/'+_0x14c545)[_0x467b('0x20')](_0x33896b);}return null;};}function patchUpdates(_0x5a3688){return function(_0x1d53e6){try{jsonpatch[_0x467b('0x21')](_0x1d53e6,_0x5a3688,!![]);}catch(_0x5ec7a4){return BPromise[_0x467b('0x22')](_0x5ec7a4);}return _0x1d53e6[_0x467b('0x23')]();};}function saveUpdates(_0x1da0ff,_0x54d509){return function(_0x11502e){if(_0x11502e){return _0x11502e[_0x467b('0x24')](_0x1da0ff)[_0x467b('0x25')](function(_0x1de4e7){return _0x1de4e7;});}return null;};}function removeEntity(_0x36871c,_0xcf69d6){return function(_0x22491b){if(_0x22491b){return _0x22491b[_0x467b('0x26')]()['then'](function(){_0x36871c[_0x467b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd73b,_0x49df40){return function(_0x5d50d9){if(!_0x5d50d9){_0x2cd73b[_0x467b('0x18')](0x194);}return _0x5d50d9;};}function handleError(_0x21233c,_0x47fb90){_0x47fb90=_0x47fb90||0x1f4;return function(_0x680d15){logger['error'](_0x680d15[_0x467b('0x27')]);if(_0x680d15[_0x467b('0x28')]){delete _0x680d15['name'];}_0x21233c[_0x467b('0x19')](_0x47fb90)[_0x467b('0x29')](_0x680d15);};}exports[_0x467b('0x2a')]=function(_0x350f41,_0x2f448b){var _0xa91ffd={},_0x5e5286={},_0x11e052={'count':0x0,'rows':[]};var _0x2e04ed=_[_0x467b('0x2b')](db['SugarcrmField'][_0x467b('0x2c')],function(_0x46fb8e){return{'name':_0x46fb8e[_0x467b('0x2d')],'type':_0x46fb8e[_0x467b('0x2e')]['key']};});_0x5e5286['model']=_[_0x467b('0x2b')](_0x2e04ed,_0x467b('0x28'));_0x5e5286['query']=_[_0x467b('0x2f')](_0x350f41['query']);_0x5e5286[_0x467b('0x30')]=_[_0x467b('0x31')](_0x5e5286['model'],_0x5e5286[_0x467b('0x32')]);_0xa91ffd[_0x467b('0x33')]=_[_0x467b('0x31')](_0x5e5286['model'],qs['fields'](_0x350f41['query']['fields']));_0xa91ffd['attributes']=_0xa91ffd[_0x467b('0x33')]['length']?_0xa91ffd['attributes']:_0x5e5286[_0x467b('0x34')];if(!_0x350f41[_0x467b('0x32')][_0x467b('0x35')](_0x467b('0x36'))){_0xa91ffd['limit']=qs[_0x467b('0x1c')](_0x350f41[_0x467b('0x32')][_0x467b('0x1c')]);_0xa91ffd[_0x467b('0x1a')]=qs[_0x467b('0x1a')](_0x350f41['query'][_0x467b('0x1a')]);}_0xa91ffd[_0x467b('0x37')]=qs['sort'](_0x350f41[_0x467b('0x32')]['sort']);_0xa91ffd[_0x467b('0x38')]=qs[_0x467b('0x30')](_['pick'](_0x350f41[_0x467b('0x32')],_0x5e5286[_0x467b('0x30')]),_0x2e04ed);if(_0x350f41['query'][_0x467b('0x39')]){_0xa91ffd[_0x467b('0x38')]=_[_0x467b('0x3a')](_0xa91ffd[_0x467b('0x38')],{'$or':_[_0x467b('0x2b')](_0x2e04ed,function(_0x492141){if(_0x492141[_0x467b('0x2e')]!==_0x467b('0x3b')){var _0x2e5f06={};_0x2e5f06[_0x492141[_0x467b('0x28')]]={'$like':'%'+_0x350f41[_0x467b('0x32')][_0x467b('0x39')]+'%'};return _0x2e5f06;}})});}_0xa91ffd=_[_0x467b('0x3a')]({},_0xa91ffd,_0x350f41[_0x467b('0x3c')]);var _0x492242={'where':_0xa91ffd[_0x467b('0x38')]};return db[_0x467b('0x3d')][_0x467b('0x1d')](_0x492242)['then'](function(_0x9dac59){_0x11e052[_0x467b('0x1d')]=_0x9dac59;if(_0x350f41[_0x467b('0x32')][_0x467b('0x3e')]){_0xa91ffd[_0x467b('0x3f')]=[{'all':!![]}];}return db['SugarcrmField'][_0x467b('0x40')](_0xa91ffd);})[_0x467b('0x25')](function(_0x3185a4){_0x11e052[_0x467b('0x41')]=_0x3185a4;return _0x11e052;})[_0x467b('0x25')](respondWithFilteredResult(_0x2f448b,_0xa91ffd))[_0x467b('0x42')](handleError(_0x2f448b,null));};exports[_0x467b('0x43')]=function(_0x5f3e93,_0x5873af){var _0x3bfc3b={'raw':!![],'where':{'id':_0x5f3e93[_0x467b('0x44')]['id']}},_0x578941={};_0x578941[_0x467b('0x34')]=_[_0x467b('0x2f')](db['SugarcrmField'][_0x467b('0x2c')]);_0x578941[_0x467b('0x32')]=_['keys'](_0x5f3e93[_0x467b('0x32')]);_0x578941[_0x467b('0x30')]=_[_0x467b('0x31')](_0x578941[_0x467b('0x34')],_0x578941[_0x467b('0x32')]);_0x3bfc3b[_0x467b('0x33')]=_[_0x467b('0x31')](_0x578941['model'],qs[_0x467b('0x45')](_0x5f3e93['query'][_0x467b('0x45')]));_0x3bfc3b[_0x467b('0x33')]=_0x3bfc3b[_0x467b('0x33')][_0x467b('0x46')]?_0x3bfc3b[_0x467b('0x33')]:_0x578941[_0x467b('0x34')];if(_0x5f3e93['query']['includeAll']){_0x3bfc3b[_0x467b('0x3f')]=[{'all':!![]}];}_0x3bfc3b=_[_0x467b('0x3a')]({},_0x3bfc3b,_0x5f3e93[_0x467b('0x3c')]);return db[_0x467b('0x3d')][_0x467b('0x47')](_0x3bfc3b)[_0x467b('0x25')](handleEntityNotFound(_0x5873af,null))[_0x467b('0x25')](respondWithResult(_0x5873af,null))[_0x467b('0x42')](handleError(_0x5873af,null));};exports['create']=function(_0xa4f9d3,_0x15dbe3){return db[_0x467b('0x3d')]['create'](_0xa4f9d3['body'],{})[_0x467b('0x25')](respondWithResult(_0x15dbe3,0xc9))[_0x467b('0x42')](handleError(_0x15dbe3,null));};exports[_0x467b('0x24')]=function(_0x4079ea,_0x5597fe){if(_0x4079ea[_0x467b('0x48')]['id']){delete _0x4079ea[_0x467b('0x48')]['id'];}return db[_0x467b('0x3d')][_0x467b('0x47')]({'where':{'id':_0x4079ea['params']['id']}})[_0x467b('0x25')](handleEntityNotFound(_0x5597fe,null))[_0x467b('0x25')](saveUpdates(_0x4079ea[_0x467b('0x48')],null))[_0x467b('0x25')](respondWithResult(_0x5597fe,null))['catch'](handleError(_0x5597fe,null));};exports[_0x467b('0x26')]=function(_0x4e7a9b,_0x3035c8){return db[_0x467b('0x3d')][_0x467b('0x47')]({'where':{'id':_0x4e7a9b[_0x467b('0x44')]['id']}})[_0x467b('0x25')](handleEntityNotFound(_0x3035c8,null))[_0x467b('0x25')](removeEntity(_0x3035c8,null))['catch'](handleError(_0x3035c8,null));}; \ No newline at end of file +var _0xfb21=['merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','end','sendStatus','error','stack','send','index','map','SugarcrmField','rawAttributes','type','key','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xfb21,0x1bd));var _0x1fb2=function(_0x45b69e,_0x27174a){_0x45b69e=_0x45b69e-0x0;var _0x43042e=_0xfb21[_0x45b69e];return _0x43042e;};'use strict';var emlformat=require(_0x1fb2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1fb2('0x1'));var rp=require(_0x1fb2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fb2('0x3'));var util=require(_0x1fb2('0x4'));var path=require(_0x1fb2('0x5'));var sox=require(_0x1fb2('0x6'));var csv=require(_0x1fb2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fb2('0x8'));var _=require(_0x1fb2('0x9'));var squel=require(_0x1fb2('0xa'));var crypto=require(_0x1fb2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1fb2('0xc'));var toCsv=require(_0x1fb2('0x7'));var querystring=require(_0x1fb2('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1fb2('0xe'));var qs=require(_0x1fb2('0xf'));var as=require(_0x1fb2('0x10'));var hardwareService=require(_0x1fb2('0x11'));var logger=require('../../config/logger')(_0x1fb2('0x12'));var utils=require(_0x1fb2('0x13'));var config=require(_0x1fb2('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x129883,_0x4a5f46){_0x4a5f46=_0x4a5f46||0xcc;return function(_0x4591b1){if(_0x4591b1){return _0x129883['sendStatus'](_0x4a5f46);}return _0x129883[_0x1fb2('0x15')](_0x4a5f46)['end']();};}function respondWithResult(_0x354815,_0x2e5e1f){_0x2e5e1f=_0x2e5e1f||0xc8;return function(_0x284b49){if(_0x284b49){return _0x354815[_0x1fb2('0x15')](_0x2e5e1f)['json'](_0x284b49);}};}function respondWithFilteredResult(_0x48870f,_0x216068){return function(_0x43091e){if(_0x43091e){var _0x459136=typeof _0x216068['offset']===_0x1fb2('0x16')&&typeof _0x216068[_0x1fb2('0x17')]===_0x1fb2('0x16');var _0x3ef2b3=_0x43091e[_0x1fb2('0x18')];var _0x462253=_0x459136?0x0:_0x216068[_0x1fb2('0x19')];var _0x2b1f2d=_0x459136?_0x43091e['count']:_0x216068['offset']+_0x216068['limit'];var _0x1490af;if(_0x2b1f2d>=_0x3ef2b3){_0x2b1f2d=_0x3ef2b3;_0x1490af=0xc8;}else{_0x1490af=0xce;}_0x48870f[_0x1fb2('0x15')](_0x1490af);return _0x48870f[_0x1fb2('0x1a')](_0x1fb2('0x1b'),_0x462253+'-'+_0x2b1f2d+'/'+_0x3ef2b3)[_0x1fb2('0x1c')](_0x43091e);}return null;};}function patchUpdates(_0x5a7da1){return function(_0x4d9a64){try{jsonpatch[_0x1fb2('0x1d')](_0x4d9a64,_0x5a7da1,!![]);}catch(_0xd542f){return BPromise['reject'](_0xd542f);}return _0x4d9a64[_0x1fb2('0x1e')]();};}function saveUpdates(_0x52f302,_0x4042f6){return function(_0x25bb0f){if(_0x25bb0f){return _0x25bb0f[_0x1fb2('0x1f')](_0x52f302)[_0x1fb2('0x20')](function(_0x3c6edd){return _0x3c6edd;});}return null;};}function removeEntity(_0x41937b,_0x3a4386){return function(_0x1776ad){if(_0x1776ad){return _0x1776ad[_0x1fb2('0x21')]()[_0x1fb2('0x20')](function(){_0x41937b['status'](0xcc)[_0x1fb2('0x22')]();});}};}function handleEntityNotFound(_0x2cfe3c,_0x550e47){return function(_0x2b72af){if(!_0x2b72af){_0x2cfe3c[_0x1fb2('0x23')](0x194);}return _0x2b72af;};}function handleError(_0x657a20,_0x3276ab){_0x3276ab=_0x3276ab||0x1f4;return function(_0x3150d1){logger[_0x1fb2('0x24')](_0x3150d1[_0x1fb2('0x25')]);if(_0x3150d1['name']){delete _0x3150d1['name'];}_0x657a20[_0x1fb2('0x15')](_0x3276ab)[_0x1fb2('0x26')](_0x3150d1);};}exports[_0x1fb2('0x27')]=function(_0x3b22cd,_0x5ae262){var _0x5e0fc8={},_0x5e478b={},_0x19e8e3={'count':0x0,'rows':[]};var _0x440881=_[_0x1fb2('0x28')](db[_0x1fb2('0x29')][_0x1fb2('0x2a')],function(_0x51749c){return{'name':_0x51749c['fieldName'],'type':_0x51749c[_0x1fb2('0x2b')][_0x1fb2('0x2c')]};});_0x5e478b['model']=_[_0x1fb2('0x28')](_0x440881,_0x1fb2('0x2d'));_0x5e478b[_0x1fb2('0x2e')]=_[_0x1fb2('0x2f')](_0x3b22cd['query']);_0x5e478b[_0x1fb2('0x30')]=_[_0x1fb2('0x31')](_0x5e478b[_0x1fb2('0x32')],_0x5e478b[_0x1fb2('0x2e')]);_0x5e0fc8['attributes']=_[_0x1fb2('0x31')](_0x5e478b[_0x1fb2('0x32')],qs[_0x1fb2('0x33')](_0x3b22cd['query'][_0x1fb2('0x33')]));_0x5e0fc8[_0x1fb2('0x34')]=_0x5e0fc8['attributes']['length']?_0x5e0fc8[_0x1fb2('0x34')]:_0x5e478b[_0x1fb2('0x32')];if(!_0x3b22cd['query'][_0x1fb2('0x35')](_0x1fb2('0x36'))){_0x5e0fc8[_0x1fb2('0x17')]=qs[_0x1fb2('0x17')](_0x3b22cd[_0x1fb2('0x2e')][_0x1fb2('0x17')]);_0x5e0fc8['offset']=qs[_0x1fb2('0x19')](_0x3b22cd[_0x1fb2('0x2e')][_0x1fb2('0x19')]);}_0x5e0fc8['order']=qs[_0x1fb2('0x37')](_0x3b22cd[_0x1fb2('0x2e')][_0x1fb2('0x37')]);_0x5e0fc8['where']=qs[_0x1fb2('0x30')](_[_0x1fb2('0x38')](_0x3b22cd[_0x1fb2('0x2e')],_0x5e478b[_0x1fb2('0x30')]),_0x440881);if(_0x3b22cd[_0x1fb2('0x2e')][_0x1fb2('0x39')]){_0x5e0fc8[_0x1fb2('0x3a')]=_[_0x1fb2('0x3b')](_0x5e0fc8[_0x1fb2('0x3a')],{'$or':_[_0x1fb2('0x28')](_0x440881,function(_0x1ba990){if(_0x1ba990[_0x1fb2('0x2b')]!==_0x1fb2('0x3c')){var _0x41c885={};_0x41c885[_0x1ba990[_0x1fb2('0x2d')]]={'$like':'%'+_0x3b22cd[_0x1fb2('0x2e')][_0x1fb2('0x39')]+'%'};return _0x41c885;}})});}_0x5e0fc8=_[_0x1fb2('0x3b')]({},_0x5e0fc8,_0x3b22cd[_0x1fb2('0x3d')]);var _0x2c2f84={'where':_0x5e0fc8[_0x1fb2('0x3a')]};return db[_0x1fb2('0x29')][_0x1fb2('0x18')](_0x2c2f84)[_0x1fb2('0x20')](function(_0x4bc8a1){_0x19e8e3[_0x1fb2('0x18')]=_0x4bc8a1;if(_0x3b22cd[_0x1fb2('0x2e')][_0x1fb2('0x3e')]){_0x5e0fc8['include']=[{'all':!![]}];}return db[_0x1fb2('0x29')][_0x1fb2('0x3f')](_0x5e0fc8);})[_0x1fb2('0x20')](function(_0x428168){_0x19e8e3[_0x1fb2('0x40')]=_0x428168;return _0x19e8e3;})[_0x1fb2('0x20')](respondWithFilteredResult(_0x5ae262,_0x5e0fc8))[_0x1fb2('0x41')](handleError(_0x5ae262,null));};exports[_0x1fb2('0x42')]=function(_0x2858ef,_0x45960f){var _0x394ef8={'raw':!![],'where':{'id':_0x2858ef[_0x1fb2('0x43')]['id']}},_0x372dfc={};_0x372dfc[_0x1fb2('0x32')]=_['keys'](db[_0x1fb2('0x29')]['rawAttributes']);_0x372dfc[_0x1fb2('0x2e')]=_[_0x1fb2('0x2f')](_0x2858ef['query']);_0x372dfc[_0x1fb2('0x30')]=_[_0x1fb2('0x31')](_0x372dfc[_0x1fb2('0x32')],_0x372dfc['query']);_0x394ef8[_0x1fb2('0x34')]=_[_0x1fb2('0x31')](_0x372dfc[_0x1fb2('0x32')],qs['fields'](_0x2858ef['query']['fields']));_0x394ef8[_0x1fb2('0x34')]=_0x394ef8[_0x1fb2('0x34')][_0x1fb2('0x44')]?_0x394ef8['attributes']:_0x372dfc[_0x1fb2('0x32')];if(_0x2858ef['query']['includeAll']){_0x394ef8['include']=[{'all':!![]}];}_0x394ef8=_[_0x1fb2('0x3b')]({},_0x394ef8,_0x2858ef[_0x1fb2('0x3d')]);return db[_0x1fb2('0x29')][_0x1fb2('0x45')](_0x394ef8)[_0x1fb2('0x20')](handleEntityNotFound(_0x45960f,null))[_0x1fb2('0x20')](respondWithResult(_0x45960f,null))[_0x1fb2('0x41')](handleError(_0x45960f,null));};exports['create']=function(_0x3634b6,_0x1e0a10){return db[_0x1fb2('0x29')][_0x1fb2('0x46')](_0x3634b6[_0x1fb2('0x47')],{})['then'](respondWithResult(_0x1e0a10,0xc9))['catch'](handleError(_0x1e0a10,null));};exports[_0x1fb2('0x1f')]=function(_0x1eef8f,_0x4f4b18){if(_0x1eef8f[_0x1fb2('0x47')]['id']){delete _0x1eef8f['body']['id'];}return db[_0x1fb2('0x29')][_0x1fb2('0x45')]({'where':{'id':_0x1eef8f['params']['id']}})['then'](handleEntityNotFound(_0x4f4b18,null))[_0x1fb2('0x20')](saveUpdates(_0x1eef8f['body'],null))[_0x1fb2('0x20')](respondWithResult(_0x4f4b18,null))[_0x1fb2('0x41')](handleError(_0x4f4b18,null));};exports[_0x1fb2('0x21')]=function(_0x18e6a3,_0x56581d){return db[_0x1fb2('0x29')][_0x1fb2('0x45')]({'where':{'id':_0x18e6a3[_0x1fb2('0x43')]['id']}})[_0x1fb2('0x20')](handleEntityNotFound(_0x56581d,null))['then'](removeEntity(_0x56581d,null))[_0x1fb2('0x41')](handleError(_0x56581d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 5f11180..9e292ea 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 _0x2605=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x5da12c,_0xe25727){var _0x12a19d=function(_0x53025e){while(--_0x53025e){_0x5da12c['push'](_0x5da12c['shift']());}};_0x12a19d(++_0xe25727);}(_0x2605,0x100));var _0x5260=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x2605[_0x4099ee];return _0x1b7bfc;};'use strict';var _=require(_0x5260('0x0'));var util=require(_0x5260('0x1'));var logger=require(_0x5260('0x2'))(_0x5260('0x3'));var moment=require(_0x5260('0x4'));var BPromise=require(_0x5260('0x5'));var rp=require(_0x5260('0x6'));var fs=require('fs');var path=require(_0x5260('0x7'));var rimraf=require(_0x5260('0x8'));var config=require(_0x5260('0x9'));var attributes=require(_0x5260('0xa'));module[_0x5260('0xb')]=function(_0x5d02de,_0x517997){return _0x5d02de[_0x5260('0xc')]('SugarcrmField',attributes,{'tableName':_0x5260('0xd'),'paranoid':![],'indexes':[{'name':_0x5260('0xe'),'fields':[_0x5260('0xf'),_0x5260('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3828=['./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x33441b,_0x28cd0b){var _0x265585=function(_0x486bc8){while(--_0x486bc8){_0x33441b['push'](_0x33441b['shift']());}};_0x265585(++_0x28cd0b);}(_0x3828,0xcb));var _0x8382=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3828[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x8382('0x0'));var util=require(_0x8382('0x1'));var logger=require(_0x8382('0x2'))('api');var moment=require(_0x8382('0x3'));var BPromise=require('bluebird');var rp=require(_0x8382('0x4'));var fs=require('fs');var path=require(_0x8382('0x5'));var rimraf=require('rimraf');var config=require(_0x8382('0x6'));var attributes=require(_0x8382('0x7'));module[_0x8382('0x8')]=function(_0x439313,_0x2eb985){return _0x439313[_0x8382('0x9')](_0x8382('0xa'),attributes,{'tableName':_0x8382('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x8382('0xc'),_0x8382('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index d82d48a..a12ed01 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 _0x1c34=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x293fbe,_0x5f33a7){var _0x227160=function(_0x198149){while(--_0x198149){_0x293fbe['push'](_0x293fbe['shift']());}};_0x227160(++_0x5f33a7);}(_0x1c34,0x103));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41c3('0x0'));var util=require('util');var moment=require(_0x41c3('0x1'));var BPromise=require(_0x41c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41c3('0x3'));var db=require(_0x41c3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x41c3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x41c3('0x6'));var client=jayson[_0x41c3('0x7')][_0x41c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a74eb,_0x351f4b,_0x4f95b1){return new BPromise(function(_0x2c37a8,_0x153bbc){return client[_0x41c3('0x9')](_0x4a74eb,_0x4f95b1)[_0x41c3('0xa')](function(_0x349764){logger[_0x41c3('0xb')](_0x41c3('0xc'),_0x351f4b,_0x41c3('0xd'));logger[_0x41c3('0xe')](_0x41c3('0xf'),_0x351f4b,_0x41c3('0xd'),JSON['stringify'](_0x349764));if(_0x349764['error']){if(_0x349764[_0x41c3('0x10')]['code']===0x1f4){logger[_0x41c3('0x10')](_0x41c3('0xc'),_0x351f4b,_0x349764['error']['message']);return _0x153bbc(_0x349764[_0x41c3('0x10')][_0x41c3('0x11')]);}logger[_0x41c3('0x10')](_0x41c3('0xc'),_0x351f4b,_0x349764[_0x41c3('0x10')][_0x41c3('0x11')]);return _0x2c37a8(_0x349764[_0x41c3('0x10')][_0x41c3('0x11')]);}else{logger[_0x41c3('0xb')](_0x41c3('0xc'),_0x351f4b,'request\x20sent');_0x2c37a8(_0x349764[_0x41c3('0x12')][_0x41c3('0x11')]);}})[_0x41c3('0x13')](function(_0x5929e2){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x351f4b,_0x5929e2);_0x153bbc(_0x5929e2);});});} \ No newline at end of file +var _0xb0aa=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x128eee,_0x97cf4e){var _0x25d6ce=function(_0x1e52b1){while(--_0x1e52b1){_0x128eee['push'](_0x128eee['shift']());}};_0x25d6ce(++_0x97cf4e);}(_0xb0aa,0x18d));var _0xab0a=function(_0x3d7a2e,_0x19aa82){_0x3d7a2e=_0x3d7a2e-0x0;var _0x587dbe=_0xb0aa[_0x3d7a2e];return _0x587dbe;};'use strict';var _=require(_0xab0a('0x0'));var util=require(_0xab0a('0x1'));var moment=require(_0xab0a('0x2'));var BPromise=require(_0xab0a('0x3'));var rs=require(_0xab0a('0x4'));var fs=require('fs');var Redis=require(_0xab0a('0x5'));var db=require(_0xab0a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xab0a('0x7'))(_0xab0a('0x8'));var config=require(_0xab0a('0x9'));var jayson=require(_0xab0a('0xa'));var client=jayson['client'][_0xab0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13c3a4,_0x24e022,_0x17438f){return new BPromise(function(_0x5a6974,_0xc66f1){return client[_0xab0a('0xc')](_0x13c3a4,_0x17438f)['then'](function(_0x15f18a){logger[_0xab0a('0xd')](_0xab0a('0xe'),_0x24e022,'request\x20sent');logger['debug'](_0xab0a('0xf'),_0x24e022,_0xab0a('0x10'),JSON[_0xab0a('0x11')](_0x15f18a));if(_0x15f18a[_0xab0a('0x12')]){if(_0x15f18a[_0xab0a('0x12')][_0xab0a('0x13')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x24e022,_0x15f18a[_0xab0a('0x12')][_0xab0a('0x14')]);return _0xc66f1(_0x15f18a['error']['message']);}logger[_0xab0a('0x12')](_0xab0a('0xe'),_0x24e022,_0x15f18a[_0xab0a('0x12')][_0xab0a('0x14')]);return _0x5a6974(_0x15f18a[_0xab0a('0x12')][_0xab0a('0x14')]);}else{logger[_0xab0a('0xd')](_0xab0a('0xe'),_0x24e022,'request\x20sent');_0x5a6974(_0x15f18a[_0xab0a('0x15')][_0xab0a('0x14')]);}})['catch'](function(_0x2ef265){logger[_0xab0a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x24e022,_0x2ef265);_0xc66f1(_0x2ef265);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4964183..6ece600 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 _0xe644=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2451de,_0x3105b3){var _0x348603=function(_0xd56a2f){while(--_0xd56a2f){_0x2451de['push'](_0x2451de['shift']());}};_0x348603(++_0x3105b3);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var path=require(_0x4e64('0x2'));var timeout=require(_0x4e64('0x3'));var express=require(_0x4e64('0x4'));var router=express[_0x4e64('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4e64('0x6'));var interaction=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var controller=require(_0x4e64('0x9'));router[_0x4e64('0xa')]('/',auth[_0x4e64('0xb')](),controller['index']);router[_0x4e64('0xa')](_0x4e64('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4e64('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4e64('0xd')]);router[_0x4e64('0xa')](_0x4e64('0xe'),auth[_0x4e64('0xb')](),controller[_0x4e64('0xf')]);router[_0x4e64('0x10')]('/',auth['isAuthenticated'](),controller[_0x4e64('0x11')]);router[_0x4e64('0x10')]('/:id/configurations',auth[_0x4e64('0xb')](),controller['addConfiguration']);router['put'](_0x4e64('0xc'),auth['isAuthenticated'](),controller[_0x4e64('0x12')]);router[_0x4e64('0x13')](_0x4e64('0xc'),auth[_0x4e64('0xb')](),controller[_0x4e64('0x14')]);module[_0x4e64('0x15')]=router; \ No newline at end of file +var _0x897d=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','addConfiguration','put'];(function(_0xf86fe2,_0x3d7b94){var _0x364c21=function(_0x2ad705){while(--_0x2ad705){_0xf86fe2['push'](_0xf86fe2['shift']());}};_0x364c21(++_0x3d7b94);}(_0x897d,0x80));var _0xd897=function(_0x193624,_0x769aaa){_0x193624=_0x193624-0x0;var _0x31abc1=_0x897d[_0x193624];return _0x31abc1;};'use strict';var multer=require(_0xd897('0x0'));var util=require(_0xd897('0x1'));var path=require(_0xd897('0x2'));var timeout=require(_0xd897('0x3'));var express=require(_0xd897('0x4'));var router=express[_0xd897('0x5')]();var fs_extra=require(_0xd897('0x6'));var auth=require(_0xd897('0x7'));var interaction=require(_0xd897('0x8'));var config=require(_0xd897('0x9'));var controller=require(_0xd897('0xa'));router[_0xd897('0xb')]('/',auth[_0xd897('0xc')](),controller[_0xd897('0xd')]);router[_0xd897('0xb')](_0xd897('0xe'),auth[_0xd897('0xc')](),controller[_0xd897('0xf')]);router[_0xd897('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd897('0x10')]);router[_0xd897('0xb')]('/:id/fields',auth[_0xd897('0xc')](),controller[_0xd897('0x11')]);router[_0xd897('0x12')]('/',auth[_0xd897('0xc')](),controller[_0xd897('0x13')]);router[_0xd897('0x12')]('/:id/configurations',auth[_0xd897('0xc')](),controller[_0xd897('0x14')]);router[_0xd897('0x15')]('/:id',auth[_0xd897('0xc')](),controller[_0xd897('0x16')]);router['delete'](_0xd897('0xe'),auth[_0xd897('0xc')](),controller[_0xd897('0x17')]);module[_0xd897('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 6816bca..3d72b41 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 _0xbd25=['STRING','HelpDesk','sequelize'];(function(_0x22227a,_0x2422ae){var _0x108bbb=function(_0x58c4f3){while(--_0x58c4f3){_0x22227a['push'](_0x22227a['shift']());}};_0x108bbb(++_0x2422ae);}(_0xbd25,0x68));var _0x5bd2=function(_0x1982d6,_0x58e299){_0x1982d6=_0x1982d6-0x0;var _0x351e7=_0xbd25[_0x1982d6];return _0x351e7;};'use strict';var Sequelize=require(_0x5bd2('0x0'));module['exports']={'name':{'type':Sequelize[_0x5bd2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5bd2('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5bd2('0x1')],'allowNull':![],'defaultValue':_0x5bd2('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5bd2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xe0d3=['HelpDesk','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0d3,0xb1));var _0x3e0d=function(_0x228850,_0x4d46ca){_0x228850=_0x228850-0x0;var _0x4ebacf=_0xe0d3[_0x228850];return _0x4ebacf;};'use strict';var Sequelize=require(_0x3e0d('0x0'));module[_0x3e0d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3e0d('0x2')]},'username':{'type':Sequelize[_0x3e0d('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3e0d('0x2')],'allowNull':![],'defaultValue':_0x3e0d('0x3')},'remoteUri':{'type':Sequelize[_0x3e0d('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3e0d('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3e0d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 16d6438..8d980fd 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 _0x319a=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','destroy','then','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','body','getConfigurations','findOne','addConfiguration','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','create','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','success','POST','login','result','token','GET','sessionName','autogenerated','reference','owner','remove','label','startsWith','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0x319a,0x161));var _0xa319=function(_0x1eeff0,_0x2edef9){_0x1eeff0=_0x1eeff0-0x0;var _0x5f485e=_0x319a[_0x1eeff0];return _0x5f485e;};'use strict';var emlformat=require(_0xa319('0x0'));var rimraf=require(_0xa319('0x1'));var zipdir=require(_0xa319('0x2'));var jsonpatch=require(_0xa319('0x3'));var rp=require(_0xa319('0x4'));var moment=require(_0xa319('0x5'));var BPromise=require(_0xa319('0x6'));var Mustache=require(_0xa319('0x7'));var util=require(_0xa319('0x8'));var path=require(_0xa319('0x9'));var sox=require('sox');var csv=require(_0xa319('0xa'));var ejs=require(_0xa319('0xb'));var fs=require('fs');var fs_extra=require(_0xa319('0xc'));var _=require(_0xa319('0xd'));var squel=require('squel');var crypto=require(_0xa319('0xe'));var jsforce=require(_0xa319('0xf'));var deskjs=require(_0xa319('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa319('0x11'));var Papa=require(_0xa319('0x12'));var Redis=require('ioredis');var authService=require(_0xa319('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa319('0x14'));var hardwareService=require(_0xa319('0x15'));var logger=require(_0xa319('0x16'))('api');var utils=require(_0xa319('0x17'));var config=require(_0xa319('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa319('0x19'))['db'];var integrations=require(_0xa319('0x1a'));function respondWithStatusCode(_0x2c4e68,_0x16cdd3){_0x16cdd3=_0x16cdd3||0xcc;return function(_0xb88ddb){if(_0xb88ddb){return _0x2c4e68[_0xa319('0x1b')](_0x16cdd3);}return _0x2c4e68[_0xa319('0x1c')](_0x16cdd3)[_0xa319('0x1d')]();};}function respondWithResult(_0x15b6a4,_0x36467e){_0x36467e=_0x36467e||0xc8;return function(_0x3c4f62){if(_0x3c4f62){return _0x15b6a4[_0xa319('0x1c')](_0x36467e)['json'](_0x3c4f62);}};}function respondWithFilteredResult(_0x5e73ca,_0x10e304){return function(_0xc9acdc){if(_0xc9acdc){var _0x3aaead=typeof _0x10e304[_0xa319('0x1e')]===_0xa319('0x1f')&&typeof _0x10e304[_0xa319('0x20')]===_0xa319('0x1f');var _0x29e18d=_0xc9acdc[_0xa319('0x21')];var _0x3ac102=_0x3aaead?0x0:_0x10e304['offset'];var _0x115acc=_0x3aaead?_0xc9acdc[_0xa319('0x21')]:_0x10e304[_0xa319('0x1e')]+_0x10e304['limit'];var _0x365bba;if(_0x115acc>=_0x29e18d){_0x115acc=_0x29e18d;_0x365bba=0xc8;}else{_0x365bba=0xce;}_0x5e73ca[_0xa319('0x1c')](_0x365bba);return _0x5e73ca[_0xa319('0x22')]('Content-Range',_0x3ac102+'-'+_0x115acc+'/'+_0x29e18d)[_0xa319('0x23')](_0xc9acdc);}return null;};}function patchUpdates(_0x2ed950){return function(_0x4bfa70){try{jsonpatch[_0xa319('0x24')](_0x4bfa70,_0x2ed950,!![]);}catch(_0x4e65bc){return BPromise[_0xa319('0x25')](_0x4e65bc);}return _0x4bfa70['save']();};}function saveUpdates(_0x23d030,_0x2cb653){return function(_0x293ffd){if(_0x293ffd){return _0x293ffd[_0xa319('0x26')](_0x23d030)['then'](function(_0x477546){return _0x477546;});}return null;};}function removeEntity(_0x2e5d64,_0xbe3b11){return function(_0x36b212){if(_0x36b212){return _0x36b212[_0xa319('0x27')]()[_0xa319('0x28')](function(){_0x2e5d64[_0xa319('0x1c')](0xcc)[_0xa319('0x1d')]();});}};}function handleEntityNotFound(_0x137807,_0x53f8db){return function(_0x1fbb29){if(!_0x1fbb29){_0x137807[_0xa319('0x1b')](0x194);}return _0x1fbb29;};}function handleError(_0x1e6577,_0x379deb){_0x379deb=_0x379deb||0x1f4;return function(_0x414c48){logger[_0xa319('0x29')](_0x414c48[_0xa319('0x2a')]);if(_0x414c48[_0xa319('0x2b')]){delete _0x414c48['name'];}_0x1e6577[_0xa319('0x1c')](_0x379deb)[_0xa319('0x2c')](_0x414c48);};}exports['index']=function(_0x41ace3,_0x464414){var _0x138f72={},_0x226e24={},_0x3a83cd={'count':0x0,'rows':[]};var _0x406f8d=_[_0xa319('0x2d')](db[_0xa319('0x2e')][_0xa319('0x2f')],function(_0x4f0faa){return{'name':_0x4f0faa[_0xa319('0x30')],'type':_0x4f0faa[_0xa319('0x31')]['key']};});_0x226e24[_0xa319('0x32')]=_[_0xa319('0x2d')](_0x406f8d,'name');_0x226e24[_0xa319('0x33')]=_[_0xa319('0x34')](_0x41ace3['query']);_0x226e24[_0xa319('0x35')]=_[_0xa319('0x36')](_0x226e24[_0xa319('0x32')],_0x226e24[_0xa319('0x33')]);_0x138f72[_0xa319('0x37')]=_[_0xa319('0x36')](_0x226e24[_0xa319('0x32')],qs['fields'](_0x41ace3[_0xa319('0x33')][_0xa319('0x38')]));_0x138f72[_0xa319('0x37')]=_0x138f72[_0xa319('0x37')][_0xa319('0x39')]?_0x138f72[_0xa319('0x37')]:_0x226e24[_0xa319('0x32')];if(!_0x41ace3[_0xa319('0x33')][_0xa319('0x3a')](_0xa319('0x3b'))){_0x138f72[_0xa319('0x20')]=qs[_0xa319('0x20')](_0x41ace3[_0xa319('0x33')]['limit']);_0x138f72[_0xa319('0x1e')]=qs[_0xa319('0x1e')](_0x41ace3[_0xa319('0x33')][_0xa319('0x1e')]);}_0x138f72['order']=qs[_0xa319('0x3c')](_0x41ace3[_0xa319('0x33')]['sort']);_0x138f72['where']=qs['filters'](_[_0xa319('0x3d')](_0x41ace3['query'],_0x226e24['filters']),_0x406f8d);if(_0x41ace3[_0xa319('0x33')][_0xa319('0x3e')]){_0x138f72['where']=_[_0xa319('0x3f')](_0x138f72[_0xa319('0x40')],{'$or':_['map'](_0x406f8d,function(_0x138a8b){if(_0x138a8b[_0xa319('0x31')]!==_0xa319('0x41')){var _0x2d5dfc={};_0x2d5dfc[_0x138a8b['name']]={'$like':'%'+_0x41ace3['query'][_0xa319('0x3e')]+'%'};return _0x2d5dfc;}})});}_0x138f72=_['merge']({},_0x138f72,_0x41ace3[_0xa319('0x42')]);var _0xf90576={'where':_0x138f72['where']};return db['VtigerAccount']['count'](_0xf90576)[_0xa319('0x28')](function(_0x48278c){_0x3a83cd[_0xa319('0x21')]=_0x48278c;if(_0x41ace3[_0xa319('0x33')][_0xa319('0x43')]){_0x138f72['include']=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x138f72);})['then'](function(_0x2e980a){_0x3a83cd[_0xa319('0x44')]=_0x2e980a;return _0x3a83cd;})[_0xa319('0x28')](respondWithFilteredResult(_0x464414,_0x138f72))[_0xa319('0x45')](handleError(_0x464414,null));};exports[_0xa319('0x46')]=function(_0x176bcd,_0x4c1de8){var _0x39bf2a={'raw':![],'where':{'id':_0x176bcd[_0xa319('0x47')]['id']}},_0xd3fd2c={};_0xd3fd2c['model']=_[_0xa319('0x34')](db[_0xa319('0x2e')][_0xa319('0x2f')]);_0xd3fd2c[_0xa319('0x33')]=_[_0xa319('0x34')](_0x176bcd[_0xa319('0x33')]);_0xd3fd2c['filters']=_[_0xa319('0x36')](_0xd3fd2c[_0xa319('0x32')],_0xd3fd2c[_0xa319('0x33')]);_0x39bf2a[_0xa319('0x37')]=_[_0xa319('0x36')](_0xd3fd2c[_0xa319('0x32')],qs[_0xa319('0x38')](_0x176bcd[_0xa319('0x33')][_0xa319('0x38')]));_0x39bf2a[_0xa319('0x37')]=_0x39bf2a[_0xa319('0x37')][_0xa319('0x39')]?_0x39bf2a[_0xa319('0x37')]:_0xd3fd2c[_0xa319('0x32')];if(_0x176bcd[_0xa319('0x33')][_0xa319('0x43')]){_0x39bf2a[_0xa319('0x48')]=[{'all':!![]}];}_0x39bf2a=_['merge']({},_0x39bf2a,_0x176bcd[_0xa319('0x42')]);return db[_0xa319('0x2e')][_0xa319('0x49')](_0x39bf2a)[_0xa319('0x28')](handleEntityNotFound(_0x4c1de8,null))[_0xa319('0x28')](respondWithResult(_0x4c1de8,null))[_0xa319('0x45')](handleError(_0x4c1de8,null));};exports['create']=function(_0x581809,_0x4cfcb4){return db['VtigerAccount']['create'](_0x581809[_0xa319('0x4a')],{})['then'](respondWithResult(_0x4cfcb4,0xc9))['catch'](handleError(_0x4cfcb4,null));};exports[_0xa319('0x26')]=function(_0x27b9ea,_0x19b596){if(_0x27b9ea[_0xa319('0x4a')]['id']){delete _0x27b9ea[_0xa319('0x4a')]['id'];}return db[_0xa319('0x2e')]['find']({'where':{'id':_0x27b9ea[_0xa319('0x47')]['id']}})[_0xa319('0x28')](handleEntityNotFound(_0x19b596,null))['then'](saveUpdates(_0x27b9ea['body'],null))[_0xa319('0x28')](respondWithResult(_0x19b596,null))[_0xa319('0x45')](handleError(_0x19b596,null));};exports[_0xa319('0x27')]=function(_0x4a8a82,_0x374f49){return db[_0xa319('0x2e')]['find']({'where':{'id':_0x4a8a82[_0xa319('0x47')]['id']}})['then'](handleEntityNotFound(_0x374f49,null))[_0xa319('0x28')](removeEntity(_0x374f49,null))[_0xa319('0x45')](handleError(_0x374f49,null));};exports[_0xa319('0x4b')]=function(_0x447cf4,_0x500e70,_0x2c03c7){var _0x586e79={};var _0x258e9d={};var _0x391173;var _0x3bff73;return db['VtigerAccount'][_0xa319('0x4c')]({'where':{'id':_0x447cf4[_0xa319('0x47')]['id']}})[_0xa319('0x28')](handleEntityNotFound(_0x500e70,null))[_0xa319('0x28')](function(_0x57f3b2){if(_0x57f3b2){_0x391173=_0x57f3b2;_0x258e9d[_0xa319('0x32')]=_[_0xa319('0x34')](db['VtigerConfiguration'][_0xa319('0x2f')]);_0x258e9d[_0xa319('0x33')]=_['keys'](_0x447cf4[_0xa319('0x33')]);_0x258e9d[_0xa319('0x35')]=_[_0xa319('0x36')](_0x258e9d[_0xa319('0x32')],_0x258e9d[_0xa319('0x33')]);_0x586e79[_0xa319('0x37')]=_[_0xa319('0x36')](_0x258e9d[_0xa319('0x32')],qs['fields'](_0x447cf4[_0xa319('0x33')][_0xa319('0x38')]));_0x586e79[_0xa319('0x37')]=_0x586e79[_0xa319('0x37')][_0xa319('0x39')]?_0x586e79[_0xa319('0x37')]:_0x258e9d[_0xa319('0x32')];_0x586e79['order']=qs[_0xa319('0x3c')](_0x447cf4[_0xa319('0x33')][_0xa319('0x3c')]);_0x586e79['where']=qs[_0xa319('0x35')](_['pick'](_0x447cf4['query'],_0x258e9d[_0xa319('0x35')]));if(_0x447cf4[_0xa319('0x33')][_0xa319('0x3e')]){_0x586e79['where']=_['merge'](_0x586e79[_0xa319('0x40')],{'$or':_[_0xa319('0x2d')](_0x586e79[_0xa319('0x37')],function(_0x2ac70c){var _0x5f1154={};_0x5f1154[_0x2ac70c]={'$like':'%'+_0x447cf4['query'][_0xa319('0x3e')]+'%'};return _0x5f1154;})});}_0x586e79=_['merge']({},_0x586e79,_0x447cf4[_0xa319('0x42')]);return _0x391173[_0xa319('0x4b')](_0x586e79);}})[_0xa319('0x28')](function(_0x253ccd){if(_0x253ccd){_0x3bff73=_0x253ccd['length'];if(!_0x447cf4['query'][_0xa319('0x3a')](_0xa319('0x3b'))){_0x586e79['limit']=qs[_0xa319('0x20')](_0x447cf4[_0xa319('0x33')][_0xa319('0x20')]);_0x586e79[_0xa319('0x1e')]=qs[_0xa319('0x1e')](_0x447cf4[_0xa319('0x33')][_0xa319('0x1e')]);}return _0x391173[_0xa319('0x4b')](_0x586e79);}})['then'](function(_0x25beb3){if(_0x25beb3){return _0x25beb3?{'count':_0x3bff73,'rows':_0x25beb3}:null;}})[_0xa319('0x28')](respondWithResult(_0x500e70,null))['catch'](handleError(_0x500e70,null));};exports[_0xa319('0x4d')]=function(_0x316863,_0x31b53a,_0x20b5c4){if(_0x316863[_0xa319('0x4a')]['id']){delete _0x316863[_0xa319('0x4a')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x316863[_0xa319('0x47')]['id']}})['then'](handleEntityNotFound(_0x31b53a,null))[_0xa319('0x28')](function(_0x2db075){if(_0x2db075){_0x316863[_0xa319('0x4a')]['AccountId']=_0x2db075['id'];_0x316863['body'][_0xa319('0x4e')]=integrations['getSubjects'](_0x316863[_0xa319('0x4a')][_0xa319('0x4f')],_0x316863[_0xa319('0x4a')]['type']);_0x316863['body'][_0xa319('0x50')]=integrations[_0xa319('0x51')](_0x316863[_0xa319('0x4a')]['channel'],_0x316863[_0xa319('0x4a')][_0xa319('0x31')]);return db[_0xa319('0x52')][_0xa319('0x53')](_0x316863['body'],{'include':[{'model':db[_0xa319('0x54')],'as':'Subjects'},{'model':db[_0xa319('0x54')],'as':_0xa319('0x50')}]});}return null;})[_0xa319('0x28')](respondWithResult(_0x31b53a,null))[_0xa319('0x45')](handleError(_0x31b53a,null));};var md5=require(_0xa319('0x55'));exports[_0xa319('0x56')]=function(_0x4dd87a,_0x42cc9c,_0x284d2e){var _0x3e290d=null;var _0xb8a303=null;var _0x5d007e=null;var _0x229238=null;var _0x4b139a='';return db['VtigerAccount'][_0xa319('0x4c')]({'where':{'id':_0x4dd87a['params']['id']},'attributes':['id',_0xa319('0x2b'),_0xa319('0x57'),_0xa319('0x58'),_0xa319('0x59'),_0xa319('0x5a'),_0xa319('0x5b'),_0xa319('0x5c')]})[_0xa319('0x28')](handleEntityNotFound(_0x42cc9c,null))[_0xa319('0x28')](function(_0x2a1803){if(_0x2a1803){_0x3e290d=_0x2a1803[_0xa319('0x57')];_0xb8a303=_0x2a1803[_0xa319('0x5c')];_0x5d007e=_0x2a1803[_0xa319('0x59')];_0x4b139a=_0x2a1803[_0xa319('0x5a')];var _0x238567=_0x4b139a[_0xa319('0x5d')](-0x1);if(_0x238567==='/'){_0x4b139a=_0x4b139a[_0xa319('0x5e')](0x0,_0x4b139a[_0xa319('0x5f')](_0x238567));}_0x229238=util[_0xa319('0x60')]('%s/webservice.php',_0x4b139a);var _0x2180dc={'method':'GET','uri':_0x229238,'qs':{'operation':'getchallenge','username':_0x2a1803[_0xa319('0x57')]},'json':!![]};return rp(_0x2180dc);}})['then'](function(_0x5687b7){if(_0x5687b7[_0xa319('0x61')]){var _0x51d5cf={'method':_0xa319('0x62'),'uri':_0x229238,'form':{'operation':_0xa319('0x63'),'username':_0x3e290d,'accessKey':md5(_0x5687b7[_0xa319('0x64')][_0xa319('0x65')]+_0xb8a303)},'json':!![]};return rp(_0x51d5cf);}})[_0xa319('0x28')](function(_0x1f7b68){if(_0x1f7b68[_0xa319('0x61')]){var _0x44799e={'method':_0xa319('0x66'),'uri':_0x229238,'qs':{'operation':'describe','username':_0x3e290d,'sessionName':_0x1f7b68[_0xa319('0x64')][_0xa319('0x67')],'elementType':_0x5d007e},'json':!![]};return rp(_0x44799e);}})['then'](function(_0x4c6bff){if(_0x4c6bff['success']){var _0x4fdfdf=[_0xa319('0x68'),_0xa319('0x69'),_0xa319('0x6a')];_[_0xa319('0x6b')](_0x4c6bff[_0xa319('0x64')][_0xa319('0x38')],function(_0x5f196b){return _0x4fdfdf['includes'](_0x5f196b[_0xa319('0x31')][_0xa319('0x2b')]);});_[_0xa319('0x6b')](_0x4c6bff[_0xa319('0x64')]['fields'],function(_0x4d43ac){return _0x4d43ac['editable']==='false';});return{'count':_0x4c6bff[_0xa319('0x64')]['fields'][_0xa319('0x39')],'rows':_[_0xa319('0x2d')](_0x4c6bff[_0xa319('0x64')][_0xa319('0x38')],function(_0x383c41){return{'id':_0x383c41['name'],'name':_0x383c41[_0xa319('0x6c')],'custom':_[_0xa319('0x6d')](_0x383c41[_0xa319('0x2b')],'cf_')?!![]:![],'options':_0x383c41[_0xa319('0x31')][_0xa319('0x2b')]===_0xa319('0x6e')&&_0x383c41[_0xa319('0x31')][_0xa319('0x6f')][_0xa319('0x39')]>0x0?_[_0xa319('0x2d')](_0x383c41[_0xa319('0x31')]['picklistValues'],function(_0x4ea667){return{'name':_0x4ea667[_0xa319('0x6c')],'value':_0x4ea667[_0xa319('0x70')]};}):[]};})};}})[_0xa319('0x28')](respondWithResult(_0x42cc9c,null))[_0xa319('0x45')](function(_0x4abed3){console[_0xa319('0x71')]('vTiger\x20error:\x20'+_0x4abed3);var _0xc1b005=_0x4dd87a[_0xa319('0x33')][_0xa319('0x72')]?0x1f4:_0x4abed3[_0xa319('0x73')]||0x1f4;logger['error'](_0xa319('0x74'),_0xa319('0x56'),_0xc1b005,JSON[_0xa319('0x75')](_0x4abed3));delete _0x4abed3[_0xa319('0x2b')];if(_0xc1b005===0x191){_0xc1b005=0x190;}_0x42cc9c[_0xa319('0x1c')](_0xc1b005)[_0xa319('0x2c')](_0x4dd87a[_0xa319('0x33')]['test']?{'message':_0xa319('0x76'),'statusCode':_0x4abed3[_0xa319('0x73')]}:_0x4abed3);});}; \ No newline at end of file +var _0x9ce0=['end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','error','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','then','include','VtigerAccount','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','getConfigurations','VtigerConfiguration','order','addConfiguration','findOne','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','getchallenge','success','token','GET','sessionName','autogenerated','owner','remove','result','includes','editable','false','label','startsWith','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status'];(function(_0x3ed10c,_0x411c3f){var _0x4fb355=function(_0x3dd2f1){while(--_0x3dd2f1){_0x3ed10c['push'](_0x3ed10c['shift']());}};_0x4fb355(++_0x411c3f);}(_0x9ce0,0xce));var _0x09ce=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ce0[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x09ce('0x0'));var rimraf=require(_0x09ce('0x1'));var zipdir=require(_0x09ce('0x2'));var jsonpatch=require(_0x09ce('0x3'));var rp=require(_0x09ce('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x09ce('0x5'));var csv=require(_0x09ce('0x6'));var ejs=require(_0x09ce('0x7'));var fs=require('fs');var fs_extra=require(_0x09ce('0x8'));var _=require(_0x09ce('0x9'));var squel=require(_0x09ce('0xa'));var crypto=require('crypto');var jsforce=require(_0x09ce('0xb'));var deskjs=require(_0x09ce('0xc'));var toCsv=require('to-csv');var querystring=require(_0x09ce('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x09ce('0xe'));var as=require(_0x09ce('0xf'));var hardwareService=require(_0x09ce('0x10'));var logger=require('../../config/logger')(_0x09ce('0x11'));var utils=require('../../config/utils');var config=require(_0x09ce('0x12'));var licenseUtil=require(_0x09ce('0x13'));var db=require(_0x09ce('0x14'))['db'];var integrations=require(_0x09ce('0x15'));function respondWithStatusCode(_0x2313f2,_0x42f470){_0x42f470=_0x42f470||0xcc;return function(_0xee01c9){if(_0xee01c9){return _0x2313f2[_0x09ce('0x16')](_0x42f470);}return _0x2313f2[_0x09ce('0x17')](_0x42f470)[_0x09ce('0x18')]();};}function respondWithResult(_0x4064e4,_0x25ac4e){_0x25ac4e=_0x25ac4e||0xc8;return function(_0x4a76a6){if(_0x4a76a6){return _0x4064e4['status'](_0x25ac4e)['json'](_0x4a76a6);}};}function respondWithFilteredResult(_0x2ecf1b,_0x1b1f08){return function(_0x28324b){if(_0x28324b){var _0x35750f=typeof _0x1b1f08[_0x09ce('0x19')]===_0x09ce('0x1a')&&typeof _0x1b1f08[_0x09ce('0x1b')]==='undefined';var _0x5cd600=_0x28324b[_0x09ce('0x1c')];var _0x8b34d2=_0x35750f?0x0:_0x1b1f08['offset'];var _0x2d8a62=_0x35750f?_0x28324b[_0x09ce('0x1c')]:_0x1b1f08[_0x09ce('0x19')]+_0x1b1f08[_0x09ce('0x1b')];var _0xa6c4c5;if(_0x2d8a62>=_0x5cd600){_0x2d8a62=_0x5cd600;_0xa6c4c5=0xc8;}else{_0xa6c4c5=0xce;}_0x2ecf1b['status'](_0xa6c4c5);return _0x2ecf1b[_0x09ce('0x1d')](_0x09ce('0x1e'),_0x8b34d2+'-'+_0x2d8a62+'/'+_0x5cd600)[_0x09ce('0x1f')](_0x28324b);}return null;};}function patchUpdates(_0x507048){return function(_0x373b0e){try{jsonpatch['apply'](_0x373b0e,_0x507048,!![]);}catch(_0x118df0){return BPromise[_0x09ce('0x20')](_0x118df0);}return _0x373b0e[_0x09ce('0x21')]();};}function saveUpdates(_0x3c010b,_0x4cd0b8){return function(_0x47e78e){if(_0x47e78e){return _0x47e78e[_0x09ce('0x22')](_0x3c010b)['then'](function(_0x50ddbb){return _0x50ddbb;});}return null;};}function removeEntity(_0x2569c4,_0x180b27){return function(_0x46c21f){if(_0x46c21f){return _0x46c21f[_0x09ce('0x23')]()['then'](function(){_0x2569c4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a96e2,_0x3d75f3){return function(_0x25781c){if(!_0x25781c){_0x4a96e2['sendStatus'](0x194);}return _0x25781c;};}function handleError(_0x1dbba2,_0x57e3f6){_0x57e3f6=_0x57e3f6||0x1f4;return function(_0x4b4be2){logger[_0x09ce('0x24')](_0x4b4be2['stack']);if(_0x4b4be2[_0x09ce('0x25')]){delete _0x4b4be2[_0x09ce('0x25')];}_0x1dbba2[_0x09ce('0x17')](_0x57e3f6)[_0x09ce('0x26')](_0x4b4be2);};}exports[_0x09ce('0x27')]=function(_0x1c5e78,_0x4b1818){var _0x28c745={},_0x42f17c={},_0x10ffb2={'count':0x0,'rows':[]};var _0x23b4da=_[_0x09ce('0x28')](db['VtigerAccount']['rawAttributes'],function(_0x144ca4){return{'name':_0x144ca4[_0x09ce('0x29')],'type':_0x144ca4[_0x09ce('0x2a')][_0x09ce('0x2b')]};});_0x42f17c[_0x09ce('0x2c')]=_['map'](_0x23b4da,'name');_0x42f17c['query']=_[_0x09ce('0x2d')](_0x1c5e78[_0x09ce('0x2e')]);_0x42f17c[_0x09ce('0x2f')]=_[_0x09ce('0x30')](_0x42f17c[_0x09ce('0x2c')],_0x42f17c['query']);_0x28c745['attributes']=_[_0x09ce('0x30')](_0x42f17c['model'],qs[_0x09ce('0x31')](_0x1c5e78[_0x09ce('0x2e')][_0x09ce('0x31')]));_0x28c745[_0x09ce('0x32')]=_0x28c745[_0x09ce('0x32')][_0x09ce('0x33')]?_0x28c745[_0x09ce('0x32')]:_0x42f17c[_0x09ce('0x2c')];if(!_0x1c5e78[_0x09ce('0x2e')][_0x09ce('0x34')](_0x09ce('0x35'))){_0x28c745[_0x09ce('0x1b')]=qs[_0x09ce('0x1b')](_0x1c5e78[_0x09ce('0x2e')][_0x09ce('0x1b')]);_0x28c745[_0x09ce('0x19')]=qs[_0x09ce('0x19')](_0x1c5e78[_0x09ce('0x2e')][_0x09ce('0x19')]);}_0x28c745['order']=qs['sort'](_0x1c5e78[_0x09ce('0x2e')][_0x09ce('0x36')]);_0x28c745[_0x09ce('0x37')]=qs['filters'](_[_0x09ce('0x38')](_0x1c5e78['query'],_0x42f17c[_0x09ce('0x2f')]),_0x23b4da);if(_0x1c5e78[_0x09ce('0x2e')][_0x09ce('0x39')]){_0x28c745[_0x09ce('0x37')]=_['merge'](_0x28c745['where'],{'$or':_[_0x09ce('0x28')](_0x23b4da,function(_0x12927d){if(_0x12927d[_0x09ce('0x2a')]!=='VIRTUAL'){var _0x13bd41={};_0x13bd41[_0x12927d['name']]={'$like':'%'+_0x1c5e78[_0x09ce('0x2e')][_0x09ce('0x39')]+'%'};return _0x13bd41;}})});}_0x28c745=_[_0x09ce('0x3a')]({},_0x28c745,_0x1c5e78['options']);var _0x51240={'where':_0x28c745[_0x09ce('0x37')]};return db['VtigerAccount'][_0x09ce('0x1c')](_0x51240)[_0x09ce('0x3b')](function(_0x36e93c){_0x10ffb2[_0x09ce('0x1c')]=_0x36e93c;if(_0x1c5e78['query']['includeAll']){_0x28c745[_0x09ce('0x3c')]=[{'all':!![]}];}return db[_0x09ce('0x3d')]['findAll'](_0x28c745);})['then'](function(_0x565fb4){_0x10ffb2[_0x09ce('0x3e')]=_0x565fb4;return _0x10ffb2;})['then'](respondWithFilteredResult(_0x4b1818,_0x28c745))[_0x09ce('0x3f')](handleError(_0x4b1818,null));};exports[_0x09ce('0x40')]=function(_0x4f15f7,_0xd26e7f){var _0x19828c={'raw':![],'where':{'id':_0x4f15f7[_0x09ce('0x41')]['id']}},_0x5e4276={};_0x5e4276[_0x09ce('0x2c')]=_[_0x09ce('0x2d')](db[_0x09ce('0x3d')][_0x09ce('0x42')]);_0x5e4276[_0x09ce('0x2e')]=_[_0x09ce('0x2d')](_0x4f15f7['query']);_0x5e4276[_0x09ce('0x2f')]=_[_0x09ce('0x30')](_0x5e4276[_0x09ce('0x2c')],_0x5e4276['query']);_0x19828c[_0x09ce('0x32')]=_[_0x09ce('0x30')](_0x5e4276['model'],qs[_0x09ce('0x31')](_0x4f15f7['query'][_0x09ce('0x31')]));_0x19828c[_0x09ce('0x32')]=_0x19828c[_0x09ce('0x32')][_0x09ce('0x33')]?_0x19828c[_0x09ce('0x32')]:_0x5e4276[_0x09ce('0x2c')];if(_0x4f15f7['query'][_0x09ce('0x43')]){_0x19828c[_0x09ce('0x3c')]=[{'all':!![]}];}_0x19828c=_['merge']({},_0x19828c,_0x4f15f7[_0x09ce('0x44')]);return db[_0x09ce('0x3d')][_0x09ce('0x45')](_0x19828c)['then'](handleEntityNotFound(_0xd26e7f,null))[_0x09ce('0x3b')](respondWithResult(_0xd26e7f,null))[_0x09ce('0x3f')](handleError(_0xd26e7f,null));};exports[_0x09ce('0x46')]=function(_0x2bed63,_0x32af16){return db[_0x09ce('0x3d')][_0x09ce('0x46')](_0x2bed63[_0x09ce('0x47')],{})['then'](respondWithResult(_0x32af16,0xc9))['catch'](handleError(_0x32af16,null));};exports[_0x09ce('0x22')]=function(_0x2bbfef,_0x2f693d){if(_0x2bbfef['body']['id']){delete _0x2bbfef['body']['id'];}return db[_0x09ce('0x3d')]['find']({'where':{'id':_0x2bbfef['params']['id']}})[_0x09ce('0x3b')](handleEntityNotFound(_0x2f693d,null))[_0x09ce('0x3b')](saveUpdates(_0x2bbfef['body'],null))[_0x09ce('0x3b')](respondWithResult(_0x2f693d,null))[_0x09ce('0x3f')](handleError(_0x2f693d,null));};exports[_0x09ce('0x23')]=function(_0x15f833,_0x29ec17){return db['VtigerAccount']['find']({'where':{'id':_0x15f833[_0x09ce('0x41')]['id']}})['then'](handleEntityNotFound(_0x29ec17,null))['then'](removeEntity(_0x29ec17,null))[_0x09ce('0x3f')](handleError(_0x29ec17,null));};exports[_0x09ce('0x48')]=function(_0x10caa1,_0x5600ae,_0x1d1bb0){var _0x2b74eb={};var _0x30cffc={};var _0xf55f1d;var _0x3e1c78;return db[_0x09ce('0x3d')]['findOne']({'where':{'id':_0x10caa1[_0x09ce('0x41')]['id']}})[_0x09ce('0x3b')](handleEntityNotFound(_0x5600ae,null))[_0x09ce('0x3b')](function(_0x25ac9a){if(_0x25ac9a){_0xf55f1d=_0x25ac9a;_0x30cffc[_0x09ce('0x2c')]=_[_0x09ce('0x2d')](db[_0x09ce('0x49')][_0x09ce('0x42')]);_0x30cffc[_0x09ce('0x2e')]=_[_0x09ce('0x2d')](_0x10caa1[_0x09ce('0x2e')]);_0x30cffc['filters']=_[_0x09ce('0x30')](_0x30cffc[_0x09ce('0x2c')],_0x30cffc[_0x09ce('0x2e')]);_0x2b74eb[_0x09ce('0x32')]=_[_0x09ce('0x30')](_0x30cffc[_0x09ce('0x2c')],qs[_0x09ce('0x31')](_0x10caa1['query'][_0x09ce('0x31')]));_0x2b74eb[_0x09ce('0x32')]=_0x2b74eb['attributes'][_0x09ce('0x33')]?_0x2b74eb['attributes']:_0x30cffc[_0x09ce('0x2c')];_0x2b74eb[_0x09ce('0x4a')]=qs[_0x09ce('0x36')](_0x10caa1['query'][_0x09ce('0x36')]);_0x2b74eb[_0x09ce('0x37')]=qs[_0x09ce('0x2f')](_[_0x09ce('0x38')](_0x10caa1[_0x09ce('0x2e')],_0x30cffc[_0x09ce('0x2f')]));if(_0x10caa1['query'][_0x09ce('0x39')]){_0x2b74eb['where']=_[_0x09ce('0x3a')](_0x2b74eb[_0x09ce('0x37')],{'$or':_['map'](_0x2b74eb[_0x09ce('0x32')],function(_0x11c1c0){var _0x562780={};_0x562780[_0x11c1c0]={'$like':'%'+_0x10caa1[_0x09ce('0x2e')][_0x09ce('0x39')]+'%'};return _0x562780;})});}_0x2b74eb=_[_0x09ce('0x3a')]({},_0x2b74eb,_0x10caa1['options']);return _0xf55f1d[_0x09ce('0x48')](_0x2b74eb);}})[_0x09ce('0x3b')](function(_0x139d4e){if(_0x139d4e){_0x3e1c78=_0x139d4e[_0x09ce('0x33')];if(!_0x10caa1[_0x09ce('0x2e')]['hasOwnProperty'](_0x09ce('0x35'))){_0x2b74eb[_0x09ce('0x1b')]=qs[_0x09ce('0x1b')](_0x10caa1[_0x09ce('0x2e')][_0x09ce('0x1b')]);_0x2b74eb['offset']=qs['offset'](_0x10caa1[_0x09ce('0x2e')][_0x09ce('0x19')]);}return _0xf55f1d[_0x09ce('0x48')](_0x2b74eb);}})[_0x09ce('0x3b')](function(_0x5e72f0){if(_0x5e72f0){return _0x5e72f0?{'count':_0x3e1c78,'rows':_0x5e72f0}:null;}})['then'](respondWithResult(_0x5600ae,null))[_0x09ce('0x3f')](handleError(_0x5600ae,null));};exports[_0x09ce('0x4b')]=function(_0xbaf6ea,_0x514c34,_0x171928){if(_0xbaf6ea['body']['id']){delete _0xbaf6ea[_0x09ce('0x47')]['id'];}return db['VtigerAccount'][_0x09ce('0x4c')]({'where':{'id':_0xbaf6ea[_0x09ce('0x41')]['id']}})[_0x09ce('0x3b')](handleEntityNotFound(_0x514c34,null))[_0x09ce('0x3b')](function(_0x521051){if(_0x521051){_0xbaf6ea[_0x09ce('0x47')]['AccountId']=_0x521051['id'];_0xbaf6ea[_0x09ce('0x47')][_0x09ce('0x4d')]=integrations[_0x09ce('0x4e')](_0xbaf6ea[_0x09ce('0x47')][_0x09ce('0x4f')],_0xbaf6ea[_0x09ce('0x47')]['type']);_0xbaf6ea[_0x09ce('0x47')]['Descriptions']=integrations[_0x09ce('0x50')](_0xbaf6ea['body'][_0x09ce('0x4f')],_0xbaf6ea[_0x09ce('0x47')][_0x09ce('0x2a')]);return db[_0x09ce('0x49')][_0x09ce('0x46')](_0xbaf6ea[_0x09ce('0x47')],{'include':[{'model':db[_0x09ce('0x51')],'as':'Subjects'},{'model':db[_0x09ce('0x51')],'as':_0x09ce('0x52')}]});}return null;})['then'](respondWithResult(_0x514c34,null))[_0x09ce('0x3f')](handleError(_0x514c34,null));};var md5=require(_0x09ce('0x53'));exports[_0x09ce('0x54')]=function(_0x1a1578,_0x4fea9e,_0x2d8d86){var _0x5cc154=null;var _0x36d42b=null;var _0x4f318d=null;var _0x5db932=null;var _0x1a99d7='';return db[_0x09ce('0x3d')][_0x09ce('0x4c')]({'where':{'id':_0x1a1578[_0x09ce('0x41')]['id']},'attributes':['id',_0x09ce('0x25'),_0x09ce('0x55'),_0x09ce('0x56'),_0x09ce('0x57'),_0x09ce('0x58'),_0x09ce('0x59'),_0x09ce('0x5a')]})[_0x09ce('0x3b')](handleEntityNotFound(_0x4fea9e,null))[_0x09ce('0x3b')](function(_0x5abdaf){if(_0x5abdaf){_0x5cc154=_0x5abdaf[_0x09ce('0x55')];_0x36d42b=_0x5abdaf[_0x09ce('0x5a')];_0x4f318d=_0x5abdaf[_0x09ce('0x57')];_0x1a99d7=_0x5abdaf[_0x09ce('0x58')];var _0x566f28=_0x1a99d7[_0x09ce('0x5b')](-0x1);if(_0x566f28==='/'){_0x1a99d7=_0x1a99d7[_0x09ce('0x5c')](0x0,_0x1a99d7[_0x09ce('0x5d')](_0x566f28));}_0x5db932=util['format']('%s/webservice.php',_0x1a99d7);var _0x173507={'method':'GET','uri':_0x5db932,'qs':{'operation':_0x09ce('0x5e'),'username':_0x5abdaf[_0x09ce('0x55')]},'json':!![]};return rp(_0x173507);}})[_0x09ce('0x3b')](function(_0x2914e5){if(_0x2914e5[_0x09ce('0x5f')]){var _0x4d681f={'method':'POST','uri':_0x5db932,'form':{'operation':'login','username':_0x5cc154,'accessKey':md5(_0x2914e5['result'][_0x09ce('0x60')]+_0x36d42b)},'json':!![]};return rp(_0x4d681f);}})['then'](function(_0x45b4a6){if(_0x45b4a6['success']){var _0x2919d7={'method':_0x09ce('0x61'),'uri':_0x5db932,'qs':{'operation':'describe','username':_0x5cc154,'sessionName':_0x45b4a6['result'][_0x09ce('0x62')],'elementType':_0x4f318d},'json':!![]};return rp(_0x2919d7);}})[_0x09ce('0x3b')](function(_0xce6d3b){if(_0xce6d3b['success']){var _0x130a27=[_0x09ce('0x63'),'reference',_0x09ce('0x64')];_[_0x09ce('0x65')](_0xce6d3b[_0x09ce('0x66')]['fields'],function(_0x561fc5){return _0x130a27[_0x09ce('0x67')](_0x561fc5['type'][_0x09ce('0x25')]);});_[_0x09ce('0x65')](_0xce6d3b['result'][_0x09ce('0x31')],function(_0x139c58){return _0x139c58[_0x09ce('0x68')]===_0x09ce('0x69');});return{'count':_0xce6d3b['result'][_0x09ce('0x31')][_0x09ce('0x33')],'rows':_[_0x09ce('0x28')](_0xce6d3b[_0x09ce('0x66')][_0x09ce('0x31')],function(_0x1444a2){return{'id':_0x1444a2[_0x09ce('0x25')],'name':_0x1444a2[_0x09ce('0x6a')],'custom':_[_0x09ce('0x6b')](_0x1444a2[_0x09ce('0x25')],'cf_')?!![]:![],'options':_0x1444a2[_0x09ce('0x2a')][_0x09ce('0x25')]==='picklist'&&_0x1444a2[_0x09ce('0x2a')][_0x09ce('0x6c')]['length']>0x0?_[_0x09ce('0x28')](_0x1444a2[_0x09ce('0x2a')]['picklistValues'],function(_0x320c19){return{'name':_0x320c19[_0x09ce('0x6a')],'value':_0x320c19[_0x09ce('0x6d')]};}):[]};})};}})[_0x09ce('0x3b')](respondWithResult(_0x4fea9e,null))[_0x09ce('0x3f')](function(_0x168062){console[_0x09ce('0x6e')](_0x09ce('0x6f')+_0x168062);var _0x37ed24=_0x1a1578['query']['test']?0x1f4:_0x168062[_0x09ce('0x70')]||0x1f4;logger['error'](_0x09ce('0x71'),_0x09ce('0x54'),_0x37ed24,JSON['stringify'](_0x168062));delete _0x168062['name'];if(_0x37ed24===0x191){_0x37ed24=0x190;}_0x4fea9e[_0x09ce('0x17')](_0x37ed24)[_0x09ce('0x26')](_0x1a1578[_0x09ce('0x2e')][_0x09ce('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x168062['statusCode']}:_0x168062);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 20ceeb8..76e6b52 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 _0x3589=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x559983,_0x4d29c0){var _0x367f30=function(_0xd4aa37){while(--_0xd4aa37){_0x559983['push'](_0x559983['shift']());}};_0x367f30(++_0x4d29c0);}(_0x3589,0x94));var _0x9358=function(_0x5f4e8c,_0x4f2b92){_0x5f4e8c=_0x5f4e8c-0x0;var _0x388477=_0x3589[_0x5f4e8c];return _0x388477;};'use strict';var _=require(_0x9358('0x0'));var util=require('util');var logger=require(_0x9358('0x1'))('api');var moment=require(_0x9358('0x2'));var BPromise=require(_0x9358('0x3'));var rp=require(_0x9358('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9358('0x5'));var config=require(_0x9358('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x9358('0x7')]=function(_0x1fe100,_0x390ba6){return _0x1fe100[_0x9358('0x8')]('VtigerAccount',attributes,{'tableName':_0x9358('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cc7=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x56a987,_0x2c1ee5){var _0xf30558=function(_0x4043b0){while(--_0x4043b0){_0x56a987['push'](_0x56a987['shift']());}};_0xf30558(++_0x2c1ee5);}(_0x3cc7,0x137));var _0x73cc=function(_0x48f2b7,_0x40f214){_0x48f2b7=_0x48f2b7-0x0;var _0x54506f=_0x3cc7[_0x48f2b7];return _0x54506f;};'use strict';var _=require(_0x73cc('0x0'));var util=require(_0x73cc('0x1'));var logger=require('../../config/logger')(_0x73cc('0x2'));var moment=require(_0x73cc('0x3'));var BPromise=require(_0x73cc('0x4'));var rp=require(_0x73cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73cc('0x6'));var config=require(_0x73cc('0x7'));var attributes=require(_0x73cc('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x73cc('0x9')]=function(_0x59e8b3,_0x4d6cda){return _0x59e8b3[_0x73cc('0xa')](_0x73cc('0xb'),attributes,{'tableName':_0x73cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 8df4c50..290e6e4 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 _0x91a7=['VtigerAccount,\x20%s,\x20%s','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','ShowVtigerAccount','VtigerAccount','find','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x51d820,_0x3964b8){var _0x525170=function(_0x12e53){while(--_0x12e53){_0x51d820['push'](_0x51d820['shift']());}};_0x525170(++_0x3964b8);}(_0x91a7,0xe7));var _0x791a=function(_0x563c76,_0x7e07c1){_0x563c76=_0x563c76-0x0;var _0x40d641=_0x91a7[_0x563c76];return _0x40d641;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});}exports[_0x791a('0x13')]=function(_0x52941d){var _0x4a84ee=this;return new Promise(function(_0x588d00,_0x40f0d3){return db['VtigerAccount']['findAll']({'raw':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x15')]===undefined?!![]:![]:!![],'where':_0x52941d[_0x791a('0x14')]?_0x52941d['options'][_0x791a('0x16')]||null:null,'attributes':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x17')]||null:null,'limit':_0x52941d['options']?_0x52941d[_0x791a('0x14')][_0x791a('0x18')]||null:null,'include':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x52941d[_0x791a('0x14')][_0x791a('0x19')],function(_0x323c6a){return{'model':db[_0x323c6a[_0x791a('0x1b')]],'as':_0x323c6a['as'],'attributes':_0x323c6a[_0x791a('0x17')],'include':_0x323c6a['include']?_[_0x791a('0x1a')](_0x323c6a[_0x791a('0x19')],function(_0x380329){return{'model':db[_0x380329[_0x791a('0x1b')]],'as':_0x380329['as'],'attributes':_0x380329['attributes'],'include':_0x380329[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x380329['include'],function(_0xdfa84f){return{'model':db[_0xdfa84f[_0x791a('0x1b')]],'as':_0xdfa84f['as'],'attributes':_0xdfa84f[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29194d){logger[_0x791a('0xa')](_0x791a('0x13'),_0x52941d);logger[_0x791a('0xc')](_0x791a('0x13'),_0x52941d,JSON[_0x791a('0xd')](_0x29194d));_0x588d00(_0x29194d);})[_0x791a('0x12')](function(_0x889534){logger['error'](_0x791a('0x13'),_0x889534[_0x791a('0x10')],_0x52941d);_0x40f0d3(_0x4a84ee[_0x791a('0xe')](0x1f4,_0x889534['message']));});});};exports[_0x791a('0x1c')]=function(_0x5df656){var _0xc59f5e=this;return new Promise(function(_0x2e4ec8,_0xcde862){return db[_0x791a('0x1d')][_0x791a('0x1e')]({'raw':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x16')]||null:null,'attributes':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['attributes']||null:null,'include':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x5df656[_0x791a('0x14')]['include'],function(_0x305836){return{'model':db[_0x305836[_0x791a('0x1b')]],'as':_0x305836['as'],'attributes':_0x305836[_0x791a('0x17')],'include':_0x305836[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x305836['include'],function(_0xd5609){return{'model':db[_0xd5609['model']],'as':_0xd5609['as'],'attributes':_0xd5609[_0x791a('0x17')],'include':_0xd5609['include']?_['map'](_0xd5609[_0x791a('0x19')],function(_0x404530){return{'model':db[_0x404530[_0x791a('0x1b')]],'as':_0x404530['as'],'attributes':_0x404530[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})[_0x791a('0x9')](function(_0x3f46be){logger[_0x791a('0xa')]('ShowVtigerAccount',_0x5df656);logger[_0x791a('0xc')]('ShowVtigerAccount',_0x5df656,JSON[_0x791a('0xd')](_0x3f46be));_0x2e4ec8(_0x3f46be);})['catch'](function(_0x25e8cc){logger[_0x791a('0xe')]('ShowVtigerAccount',_0x25e8cc[_0x791a('0x10')],_0x5df656);_0xcde862(_0xc59f5e[_0x791a('0xe')](0x1f4,_0x25e8cc['message']));});});}; \ No newline at end of file +var _0x41bb=['../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVtigerAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowVtigerAccount','VtigerAccount','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1be71a,_0x33c184){var _0x1c51f8=function(_0x59171b){while(--_0x59171b){_0x1be71a['push'](_0x1be71a['shift']());}};_0x1c51f8(++_0x33c184);}(_0x41bb,0xc5));var _0xb41b=function(_0x3d5d14,_0x4c393f){_0x3d5d14=_0x3d5d14-0x0;var _0x1d848c=_0x41bb[_0x3d5d14];return _0x1d848c;};'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')]('VtigerAccount,\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['VtigerAccount'][_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')]('GetVtigerAccount',_0x26ef96[_0xb41b('0x12')],_0x47154d);_0x4b3580(_0x198783['error'](0x1f4,_0x26ef96[_0xb41b('0x12')]));});});};exports[_0xb41b('0x1f')]=function(_0x597a35){var _0x23a6ed=this;return new Promise(function(_0x4a95e7,_0x29da9f){return db[_0xb41b('0x20')]['find']({'raw':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x21')]||null:null,'attributes':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'include':_0x597a35[_0xb41b('0x17')]?_0x597a35['options'][_0xb41b('0x1b')]?_['map'](_0x597a35['options'][_0xb41b('0x1b')],function(_0x192ceb){return{'model':db[_0x192ceb[_0xb41b('0x1d')]],'as':_0x192ceb['as'],'attributes':_0x192ceb[_0xb41b('0x19')],'include':_0x192ceb[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x192ceb[_0xb41b('0x1b')],function(_0x197197){return{'model':db[_0x197197[_0xb41b('0x1d')]],'as':_0x197197['as'],'attributes':_0x197197[_0xb41b('0x19')],'include':_0x197197[_0xb41b('0x1b')]?_['map'](_0x197197[_0xb41b('0x1b')],function(_0x27990d){return{'model':db[_0x27990d[_0xb41b('0x1d')]],'as':_0x27990d['as'],'attributes':_0x27990d[_0xb41b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x10b3f6){logger['info']('ShowVtigerAccount',_0x597a35);logger[_0xb41b('0xf')](_0xb41b('0x1f'),_0x597a35,JSON['stringify'](_0x10b3f6));_0x4a95e7(_0x10b3f6);})[_0xb41b('0x14')](function(_0x47363e){logger[_0xb41b('0x10')](_0xb41b('0x1f'),_0x47363e[_0xb41b('0x12')],_0x597a35);_0x29da9f(_0x23a6ed['error'](0x1f4,_0x47363e[_0xb41b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a0b0525..dfa3bb5 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 _0xe4f3=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/fields','isAuthenticated','getFields'];(function(_0x53c996,_0x250a89){var _0xc253c9=function(_0x58060d){while(--_0x58060d){_0x53c996['push'](_0x53c996['shift']());}};_0xc253c9(++_0x250a89);}(_0xe4f3,0x1ea));var _0x3e4f=function(_0x428816,_0x2bcbac){_0x428816=_0x428816-0x0;var _0x1da2b9=_0xe4f3[_0x428816];return _0x1da2b9;};'use strict';var multer=require(_0x3e4f('0x0'));var util=require(_0x3e4f('0x1'));var path=require(_0x3e4f('0x2'));var timeout=require(_0x3e4f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e4f('0x4'));var auth=require(_0x3e4f('0x5'));var interaction=require(_0x3e4f('0x6'));var config=require(_0x3e4f('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0x3e4f('0x8')]('/',auth['isAuthenticated'](),controller[_0x3e4f('0x9')]);router[_0x3e4f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3e4f('0xa')]);router[_0x3e4f('0x8')](_0x3e4f('0xb'),auth[_0x3e4f('0xc')](),controller[_0x3e4f('0xd')]);router['get'](_0x3e4f('0xe'),auth[_0x3e4f('0xc')](),controller[_0x3e4f('0xf')]);router[_0x3e4f('0x8')](_0x3e4f('0x10'),auth[_0x3e4f('0xc')](),controller[_0x3e4f('0x11')]);router[_0x3e4f('0x12')]('/',auth['isAuthenticated'](),controller[_0x3e4f('0x13')]);router['put'](_0x3e4f('0x14'),auth[_0x3e4f('0xc')](),controller[_0x3e4f('0x15')]);router[_0x3e4f('0x16')](_0x3e4f('0x14'),auth[_0x3e4f('0xc')](),controller[_0x3e4f('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd31a=['show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xd31a,0x195));var _0xad31=function(_0x4e9c20,_0x6a10c3){_0x4e9c20=_0x4e9c20-0x0;var _0x27ff87=_0xd31a[_0x4e9c20];return _0x27ff87;};'use strict';var multer=require(_0xad31('0x0'));var util=require(_0xad31('0x1'));var path=require(_0xad31('0x2'));var timeout=require('connect-timeout');var express=require(_0xad31('0x3'));var router=express[_0xad31('0x4')]();var fs_extra=require(_0xad31('0x5'));var auth=require(_0xad31('0x6'));var interaction=require(_0xad31('0x7'));var config=require('../../config/environment');var controller=require(_0xad31('0x8'));router[_0xad31('0x9')]('/',auth[_0xad31('0xa')](),controller[_0xad31('0xb')]);router[_0xad31('0x9')](_0xad31('0xc'),auth[_0xad31('0xa')](),controller[_0xad31('0xd')]);router[_0xad31('0x9')](_0xad31('0xe'),auth[_0xad31('0xa')](),controller['getFields']);router[_0xad31('0x9')](_0xad31('0xf'),auth[_0xad31('0xa')](),controller[_0xad31('0x10')]);router['get'](_0xad31('0x11'),auth[_0xad31('0xa')](),controller[_0xad31('0x12')]);router[_0xad31('0x13')]('/',auth[_0xad31('0xa')](),controller[_0xad31('0x14')]);router['put'](_0xad31('0xc'),auth[_0xad31('0xa')](),controller[_0xad31('0x15')]);router['delete'](_0xad31('0xc'),auth[_0xad31('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 69510bf..99dfb68 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 _0x01e0=['STRING','sequelize','exports'];(function(_0x3bd9ef,_0x55024a){var _0x20485c=function(_0x154acc){while(--_0x154acc){_0x3bd9ef['push'](_0x3bd9ef['shift']());}};_0x20485c(++_0x55024a);}(_0x01e0,0x16c));var _0x001e=function(_0x2994ff,_0x49cfe9){_0x2994ff=_0x2994ff-0x0;var _0xff37c9=_0x01e0[_0x2994ff];return _0xff37c9;};'use strict';var Sequelize=require(_0x001e('0x0'));module[_0x001e('0x1')]={'name':{'type':Sequelize[_0x001e('0x2')]},'description':{'type':Sequelize[_0x001e('0x2')]}}; \ No newline at end of file +var _0x6951=['sequelize','exports','STRING'];(function(_0x47dceb,_0x551a37){var _0x3ca6d7=function(_0x771a37){while(--_0x771a37){_0x47dceb['push'](_0x47dceb['shift']());}};_0x3ca6d7(++_0x551a37);}(_0x6951,0x8a));var _0x1695=function(_0x3cf1cb,_0x575668){_0x3cf1cb=_0x3cf1cb-0x0;var _0x15fa73=_0x6951[_0x3cf1cb];return _0x15fa73;};'use strict';var Sequelize=require(_0x1695('0x0'));module[_0x1695('0x1')]={'name':{'type':Sequelize[_0x1695('0x2')]},'description':{'type':Sequelize[_0x1695('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index e222413..82c1f9b 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 _0xdf68=['filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','length','includeAll','create','body','find','destroy','VtigerField','rawAttributes','getFields','getSubjects','findOne','nolimit','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','name','index','map','VtigerConfiguration','fieldName','type','model','query'];(function(_0x7272bd,_0x295629){var _0x225dd2=function(_0x4ac735){while(--_0x4ac735){_0x7272bd['push'](_0x7272bd['shift']());}};_0x225dd2(++_0x295629);}(_0xdf68,0x15c));var _0x8df6=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0xdf68[_0x5c8827];return _0x50ffd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8df6('0x0'));var zipdir=require(_0x8df6('0x1'));var jsonpatch=require(_0x8df6('0x2'));var rp=require('request-promise');var moment=require(_0x8df6('0x3'));var BPromise=require(_0x8df6('0x4'));var Mustache=require(_0x8df6('0x5'));var util=require('util');var path=require(_0x8df6('0x6'));var sox=require(_0x8df6('0x7'));var csv=require(_0x8df6('0x8'));var ejs=require(_0x8df6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8df6('0xa'));var squel=require(_0x8df6('0xb'));var crypto=require(_0x8df6('0xc'));var jsforce=require(_0x8df6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8df6('0x8'));var querystring=require('querystring');var Papa=require(_0x8df6('0xe'));var Redis=require(_0x8df6('0xf'));var authService=require(_0x8df6('0x10'));var qs=require(_0x8df6('0x11'));var as=require(_0x8df6('0x12'));var hardwareService=require(_0x8df6('0x13'));var logger=require(_0x8df6('0x14'))('api');var utils=require(_0x8df6('0x15'));var config=require(_0x8df6('0x16'));var licenseUtil=require(_0x8df6('0x17'));var db=require(_0x8df6('0x18'))['db'];function respondWithStatusCode(_0x12c2ce,_0x4adf8e){_0x4adf8e=_0x4adf8e||0xcc;return function(_0x489085){if(_0x489085){return _0x12c2ce[_0x8df6('0x19')](_0x4adf8e);}return _0x12c2ce['status'](_0x4adf8e)[_0x8df6('0x1a')]();};}function respondWithResult(_0x3012b8,_0x5c7bae){_0x5c7bae=_0x5c7bae||0xc8;return function(_0x1fcd0e){if(_0x1fcd0e){return _0x3012b8[_0x8df6('0x1b')](_0x5c7bae)['json'](_0x1fcd0e);}};}function respondWithFilteredResult(_0x9b7b05,_0x148fcc){return function(_0x48078e){if(_0x48078e){var _0x7662c9=typeof _0x148fcc['offset']==='undefined'&&typeof _0x148fcc[_0x8df6('0x1c')]==='undefined';var _0x58ace5=_0x48078e[_0x8df6('0x1d')];var _0x44e1bd=_0x7662c9?0x0:_0x148fcc['offset'];var _0x518e5d=_0x7662c9?_0x48078e['count']:_0x148fcc[_0x8df6('0x1e')]+_0x148fcc['limit'];var _0x227905;if(_0x518e5d>=_0x58ace5){_0x518e5d=_0x58ace5;_0x227905=0xc8;}else{_0x227905=0xce;}_0x9b7b05['status'](_0x227905);return _0x9b7b05[_0x8df6('0x1f')](_0x8df6('0x20'),_0x44e1bd+'-'+_0x518e5d+'/'+_0x58ace5)[_0x8df6('0x21')](_0x48078e);}return null;};}function patchUpdates(_0x1ccf03){return function(_0x5ed43d){try{jsonpatch[_0x8df6('0x22')](_0x5ed43d,_0x1ccf03,!![]);}catch(_0x427244){return BPromise[_0x8df6('0x23')](_0x427244);}return _0x5ed43d['save']();};}function saveUpdates(_0x59bcf4,_0x240339){return function(_0x479f46){if(_0x479f46){return _0x479f46[_0x8df6('0x24')](_0x59bcf4)[_0x8df6('0x25')](function(_0x2cd71e){return _0x2cd71e;});}return null;};}function removeEntity(_0x63601c,_0x4a63b0){return function(_0x5157ee){if(_0x5157ee){return _0x5157ee['destroy']()['then'](function(){_0x63601c[_0x8df6('0x1b')](0xcc)[_0x8df6('0x1a')]();});}};}function handleEntityNotFound(_0x4212f7,_0x76bdf){return function(_0x2927a5){if(!_0x2927a5){_0x4212f7[_0x8df6('0x19')](0x194);}return _0x2927a5;};}function handleError(_0x5b1eea,_0x321a9d){_0x321a9d=_0x321a9d||0x1f4;return function(_0x224bbc){logger[_0x8df6('0x26')](_0x224bbc['stack']);if(_0x224bbc[_0x8df6('0x27')]){delete _0x224bbc[_0x8df6('0x27')];}_0x5b1eea[_0x8df6('0x1b')](_0x321a9d)['send'](_0x224bbc);};}exports[_0x8df6('0x28')]=function(_0x2d859c,_0x3f455e){var _0x5b11b8={},_0x556a9e={},_0x597488={'count':0x0,'rows':[]};var _0x1fc5f6=_[_0x8df6('0x29')](db[_0x8df6('0x2a')]['rawAttributes'],function(_0xaaddae){return{'name':_0xaaddae[_0x8df6('0x2b')],'type':_0xaaddae[_0x8df6('0x2c')]['key']};});_0x556a9e[_0x8df6('0x2d')]=_[_0x8df6('0x29')](_0x1fc5f6,_0x8df6('0x27'));_0x556a9e[_0x8df6('0x2e')]=_['keys'](_0x2d859c[_0x8df6('0x2e')]);_0x556a9e[_0x8df6('0x2f')]=_[_0x8df6('0x30')](_0x556a9e['model'],_0x556a9e[_0x8df6('0x2e')]);_0x5b11b8['attributes']=_[_0x8df6('0x30')](_0x556a9e[_0x8df6('0x2d')],qs[_0x8df6('0x31')](_0x2d859c['query'][_0x8df6('0x31')]));_0x5b11b8[_0x8df6('0x32')]=_0x5b11b8[_0x8df6('0x32')]['length']?_0x5b11b8[_0x8df6('0x32')]:_0x556a9e[_0x8df6('0x2d')];if(!_0x2d859c[_0x8df6('0x2e')][_0x8df6('0x33')]('nolimit')){_0x5b11b8[_0x8df6('0x1c')]=qs[_0x8df6('0x1c')](_0x2d859c['query']['limit']);_0x5b11b8['offset']=qs[_0x8df6('0x1e')](_0x2d859c[_0x8df6('0x2e')][_0x8df6('0x1e')]);}_0x5b11b8[_0x8df6('0x34')]=qs[_0x8df6('0x35')](_0x2d859c[_0x8df6('0x2e')][_0x8df6('0x35')]);_0x5b11b8['where']=qs[_0x8df6('0x2f')](_[_0x8df6('0x36')](_0x2d859c[_0x8df6('0x2e')],_0x556a9e[_0x8df6('0x2f')]),_0x1fc5f6);if(_0x2d859c[_0x8df6('0x2e')][_0x8df6('0x37')]){_0x5b11b8[_0x8df6('0x38')]=_[_0x8df6('0x39')](_0x5b11b8[_0x8df6('0x38')],{'$or':_[_0x8df6('0x29')](_0x1fc5f6,function(_0x34ea4d){if(_0x34ea4d['type']!==_0x8df6('0x3a')){var _0x500123={};_0x500123[_0x34ea4d[_0x8df6('0x27')]]={'$like':'%'+_0x2d859c['query'][_0x8df6('0x37')]+'%'};return _0x500123;}})});}_0x5b11b8=_[_0x8df6('0x39')]({},_0x5b11b8,_0x2d859c[_0x8df6('0x3b')]);var _0x479ee1={'where':_0x5b11b8[_0x8df6('0x38')]};return db[_0x8df6('0x2a')][_0x8df6('0x1d')](_0x479ee1)[_0x8df6('0x25')](function(_0x41cfd7){_0x597488[_0x8df6('0x1d')]=_0x41cfd7;if(_0x2d859c['query']['includeAll']){_0x5b11b8[_0x8df6('0x3c')]=[{'all':!![]}];}return db[_0x8df6('0x2a')][_0x8df6('0x3d')](_0x5b11b8);})[_0x8df6('0x25')](function(_0x3c1660){_0x597488['rows']=_0x3c1660;return _0x597488;})['then'](respondWithFilteredResult(_0x3f455e,_0x5b11b8))[_0x8df6('0x3e')](handleError(_0x3f455e,null));};exports[_0x8df6('0x3f')]=function(_0x454d49,_0x1d5a06){var _0x47a34d={'raw':![],'where':{'id':_0x454d49[_0x8df6('0x40')]['id']}},_0x2fe184={};_0x2fe184[_0x8df6('0x2d')]=_[_0x8df6('0x41')](db[_0x8df6('0x2a')]['rawAttributes']);_0x2fe184[_0x8df6('0x2e')]=_[_0x8df6('0x41')](_0x454d49['query']);_0x2fe184[_0x8df6('0x2f')]=_['intersection'](_0x2fe184['model'],_0x2fe184[_0x8df6('0x2e')]);_0x47a34d[_0x8df6('0x32')]=_[_0x8df6('0x30')](_0x2fe184[_0x8df6('0x2d')],qs[_0x8df6('0x31')](_0x454d49[_0x8df6('0x2e')][_0x8df6('0x31')]));_0x47a34d[_0x8df6('0x32')]=_0x47a34d['attributes'][_0x8df6('0x42')]?_0x47a34d[_0x8df6('0x32')]:_0x2fe184['model'];if(_0x454d49[_0x8df6('0x2e')][_0x8df6('0x43')]){_0x47a34d[_0x8df6('0x3c')]=[{'all':!![]}];}_0x47a34d=_[_0x8df6('0x39')]({},_0x47a34d,_0x454d49['options']);return db['VtigerConfiguration']['find'](_0x47a34d)[_0x8df6('0x25')](handleEntityNotFound(_0x1d5a06,null))[_0x8df6('0x25')](respondWithResult(_0x1d5a06,null))['catch'](handleError(_0x1d5a06,null));};exports[_0x8df6('0x44')]=function(_0x32a0cc,_0x53abee){return db[_0x8df6('0x2a')][_0x8df6('0x44')](_0x32a0cc[_0x8df6('0x45')],{})[_0x8df6('0x25')](respondWithResult(_0x53abee,0xc9))['catch'](handleError(_0x53abee,null));};exports['update']=function(_0x53563d,_0x29ed19){if(_0x53563d['body']['id']){delete _0x53563d[_0x8df6('0x45')]['id'];}return db[_0x8df6('0x2a')][_0x8df6('0x46')]({'where':{'id':_0x53563d[_0x8df6('0x40')]['id']}})[_0x8df6('0x25')](handleEntityNotFound(_0x29ed19,null))[_0x8df6('0x25')](saveUpdates(_0x53563d[_0x8df6('0x45')],null))[_0x8df6('0x25')](respondWithResult(_0x29ed19,null))[_0x8df6('0x3e')](handleError(_0x29ed19,null));};exports[_0x8df6('0x47')]=function(_0x42ab5f,_0x2f1331){return db['VtigerConfiguration'][_0x8df6('0x46')]({'where':{'id':_0x42ab5f[_0x8df6('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f1331,null))[_0x8df6('0x25')](removeEntity(_0x2f1331,null))['catch'](handleError(_0x2f1331,null));};exports['getFields']=function(_0x22c1d7,_0x1730d9,_0x264b7c){var _0x3b0563={};var _0x2495cd={};var _0x3301fa;var _0x144bb6;return db[_0x8df6('0x2a')]['findOne']({'where':{'id':_0x22c1d7[_0x8df6('0x40')]['id']}})['then'](handleEntityNotFound(_0x1730d9,null))[_0x8df6('0x25')](function(_0x14193a){if(_0x14193a){_0x3301fa=_0x14193a;_0x2495cd['model']=_[_0x8df6('0x41')](db[_0x8df6('0x48')][_0x8df6('0x49')]);_0x2495cd['query']=_[_0x8df6('0x41')](_0x22c1d7[_0x8df6('0x2e')]);_0x2495cd[_0x8df6('0x2f')]=_[_0x8df6('0x30')](_0x2495cd[_0x8df6('0x2d')],_0x2495cd[_0x8df6('0x2e')]);_0x3b0563['attributes']=_[_0x8df6('0x30')](_0x2495cd[_0x8df6('0x2d')],qs['fields'](_0x22c1d7[_0x8df6('0x2e')][_0x8df6('0x31')]));_0x3b0563['attributes']=_0x3b0563[_0x8df6('0x32')][_0x8df6('0x42')]?_0x3b0563[_0x8df6('0x32')]:_0x2495cd[_0x8df6('0x2d')];_0x3b0563[_0x8df6('0x34')]=qs[_0x8df6('0x35')](_0x22c1d7[_0x8df6('0x2e')][_0x8df6('0x35')]);_0x3b0563[_0x8df6('0x38')]=qs[_0x8df6('0x2f')](_[_0x8df6('0x36')](_0x22c1d7[_0x8df6('0x2e')],_0x2495cd[_0x8df6('0x2f')]));if(_0x22c1d7['query']['filter']){_0x3b0563[_0x8df6('0x38')]=_[_0x8df6('0x39')](_0x3b0563[_0x8df6('0x38')],{'$or':_['map'](_0x3b0563['attributes'],function(_0x5370a1){var _0x47d3ec={};_0x47d3ec[_0x5370a1]={'$like':'%'+_0x22c1d7['query'][_0x8df6('0x37')]+'%'};return _0x47d3ec;})});}_0x3b0563=_[_0x8df6('0x39')]({},_0x3b0563,_0x22c1d7[_0x8df6('0x3b')]);return _0x3301fa[_0x8df6('0x4a')](_0x3b0563);}})[_0x8df6('0x25')](function(_0x29ffde){if(_0x29ffde){_0x144bb6=_0x29ffde[_0x8df6('0x42')];if(!_0x22c1d7['query'][_0x8df6('0x33')]('nolimit')){_0x3b0563['limit']=qs[_0x8df6('0x1c')](_0x22c1d7['query'][_0x8df6('0x1c')]);_0x3b0563[_0x8df6('0x1e')]=qs[_0x8df6('0x1e')](_0x22c1d7['query']['offset']);}return _0x3301fa[_0x8df6('0x4a')](_0x3b0563);}})[_0x8df6('0x25')](function(_0x24be1f){if(_0x24be1f){return _0x24be1f?{'count':_0x144bb6,'rows':_0x24be1f}:null;}})[_0x8df6('0x25')](respondWithResult(_0x1730d9,null))[_0x8df6('0x3e')](handleError(_0x1730d9,null));};exports[_0x8df6('0x4b')]=function(_0x5600f5,_0x4e454a,_0x5c29e4){var _0x22536f={};var _0x26abb3={};var _0x4c9ccd;var _0x31476a;return db[_0x8df6('0x2a')][_0x8df6('0x4c')]({'where':{'id':_0x5600f5[_0x8df6('0x40')]['id']}})['then'](handleEntityNotFound(_0x4e454a,null))['then'](function(_0x4aebda){if(_0x4aebda){_0x4c9ccd=_0x4aebda;_0x26abb3[_0x8df6('0x2d')]=_['keys'](db[_0x8df6('0x48')][_0x8df6('0x49')]);_0x26abb3[_0x8df6('0x2e')]=_[_0x8df6('0x41')](_0x5600f5['query']);_0x26abb3[_0x8df6('0x2f')]=_[_0x8df6('0x30')](_0x26abb3[_0x8df6('0x2d')],_0x26abb3[_0x8df6('0x2e')]);_0x22536f[_0x8df6('0x32')]=_['intersection'](_0x26abb3[_0x8df6('0x2d')],qs[_0x8df6('0x31')](_0x5600f5[_0x8df6('0x2e')][_0x8df6('0x31')]));_0x22536f[_0x8df6('0x32')]=_0x22536f[_0x8df6('0x32')][_0x8df6('0x42')]?_0x22536f['attributes']:_0x26abb3[_0x8df6('0x2d')];_0x22536f[_0x8df6('0x34')]=qs[_0x8df6('0x35')](_0x5600f5[_0x8df6('0x2e')]['sort']);_0x22536f[_0x8df6('0x38')]=qs[_0x8df6('0x2f')](_[_0x8df6('0x36')](_0x5600f5[_0x8df6('0x2e')],_0x26abb3['filters']));if(_0x5600f5[_0x8df6('0x2e')][_0x8df6('0x37')]){_0x22536f[_0x8df6('0x38')]=_[_0x8df6('0x39')](_0x22536f[_0x8df6('0x38')],{'$or':_[_0x8df6('0x29')](_0x22536f[_0x8df6('0x32')],function(_0x188859){var _0x32879b={};_0x32879b[_0x188859]={'$like':'%'+_0x5600f5[_0x8df6('0x2e')]['filter']+'%'};return _0x32879b;})});}_0x22536f=_['merge']({},_0x22536f,_0x5600f5['options']);return _0x4c9ccd[_0x8df6('0x4b')](_0x22536f);}})[_0x8df6('0x25')](function(_0x5e9874){if(_0x5e9874){_0x31476a=_0x5e9874['length'];if(!_0x5600f5[_0x8df6('0x2e')][_0x8df6('0x33')](_0x8df6('0x4d'))){_0x22536f['limit']=qs[_0x8df6('0x1c')](_0x5600f5[_0x8df6('0x2e')][_0x8df6('0x1c')]);_0x22536f[_0x8df6('0x1e')]=qs[_0x8df6('0x1e')](_0x5600f5['query']['offset']);}return _0x4c9ccd[_0x8df6('0x4b')](_0x22536f);}})[_0x8df6('0x25')](function(_0x2a082b){if(_0x2a082b){return _0x2a082b?{'count':_0x31476a,'rows':_0x2a082b}:null;}})[_0x8df6('0x25')](respondWithResult(_0x4e454a,null))[_0x8df6('0x3e')](handleError(_0x4e454a,null));};exports[_0x8df6('0x4e')]=function(_0x28390f,_0x29eefc,_0x2e078e){var _0x4cb315={};var _0xf79df8={};var _0x190060;var _0x29bea7;return db[_0x8df6('0x2a')][_0x8df6('0x4c')]({'where':{'id':_0x28390f['params']['id']}})[_0x8df6('0x25')](handleEntityNotFound(_0x29eefc,null))[_0x8df6('0x25')](function(_0x21441b){if(_0x21441b){_0x190060=_0x21441b;_0xf79df8[_0x8df6('0x2d')]=_['keys'](db[_0x8df6('0x48')][_0x8df6('0x49')]);_0xf79df8[_0x8df6('0x2e')]=_['keys'](_0x28390f[_0x8df6('0x2e')]);_0xf79df8[_0x8df6('0x2f')]=_[_0x8df6('0x30')](_0xf79df8[_0x8df6('0x2d')],_0xf79df8[_0x8df6('0x2e')]);_0x4cb315[_0x8df6('0x32')]=_[_0x8df6('0x30')](_0xf79df8[_0x8df6('0x2d')],qs['fields'](_0x28390f[_0x8df6('0x2e')][_0x8df6('0x31')]));_0x4cb315[_0x8df6('0x32')]=_0x4cb315[_0x8df6('0x32')]['length']?_0x4cb315[_0x8df6('0x32')]:_0xf79df8['model'];_0x4cb315[_0x8df6('0x34')]=qs[_0x8df6('0x35')](_0x28390f[_0x8df6('0x2e')][_0x8df6('0x35')]);_0x4cb315[_0x8df6('0x38')]=qs[_0x8df6('0x2f')](_['pick'](_0x28390f[_0x8df6('0x2e')],_0xf79df8[_0x8df6('0x2f')]));if(_0x28390f[_0x8df6('0x2e')][_0x8df6('0x37')]){_0x4cb315[_0x8df6('0x38')]=_[_0x8df6('0x39')](_0x4cb315[_0x8df6('0x38')],{'$or':_[_0x8df6('0x29')](_0x4cb315[_0x8df6('0x32')],function(_0x3709f0){var _0x10ee4={};_0x10ee4[_0x3709f0]={'$like':'%'+_0x28390f[_0x8df6('0x2e')][_0x8df6('0x37')]+'%'};return _0x10ee4;})});}_0x4cb315=_[_0x8df6('0x39')]({},_0x4cb315,_0x28390f['options']);return _0x190060['getDescriptions'](_0x4cb315);}})[_0x8df6('0x25')](function(_0x293d76){if(_0x293d76){_0x29bea7=_0x293d76[_0x8df6('0x42')];if(!_0x28390f[_0x8df6('0x2e')][_0x8df6('0x33')]('nolimit')){_0x4cb315['limit']=qs[_0x8df6('0x1c')](_0x28390f[_0x8df6('0x2e')][_0x8df6('0x1c')]);_0x4cb315[_0x8df6('0x1e')]=qs['offset'](_0x28390f[_0x8df6('0x2e')][_0x8df6('0x1e')]);}return _0x190060[_0x8df6('0x4e')](_0x4cb315);}})[_0x8df6('0x25')](function(_0x7d5855){if(_0x7d5855){return _0x7d5855?{'count':_0x29bea7,'rows':_0x7d5855}:null;}})['then'](respondWithResult(_0x29eefc,null))[_0x8df6('0x3e')](handleError(_0x29eefc,null));}; \ No newline at end of file +var _0x79e3=['rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','update','body','getFields','findOne','VtigerField','order','filter','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','VtigerConfiguration'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x79e3,0x77));var _0x379e=function(_0x5569d0,_0x2d14f2){_0x5569d0=_0x5569d0-0x0;var _0x194bc7=_0x79e3[_0x5569d0];return _0x194bc7;};'use strict';var emlformat=require(_0x379e('0x0'));var rimraf=require(_0x379e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x379e('0x2'));var rp=require('request-promise');var moment=require(_0x379e('0x3'));var BPromise=require(_0x379e('0x4'));var Mustache=require(_0x379e('0x5'));var util=require(_0x379e('0x6'));var path=require(_0x379e('0x7'));var sox=require('sox');var csv=require(_0x379e('0x8'));var ejs=require(_0x379e('0x9'));var fs=require('fs');var fs_extra=require(_0x379e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x379e('0xb'));var jsforce=require(_0x379e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x379e('0x8'));var querystring=require(_0x379e('0xd'));var Papa=require(_0x379e('0xe'));var Redis=require('ioredis');var authService=require(_0x379e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x379e('0x10'));var hardwareService=require(_0x379e('0x11'));var logger=require(_0x379e('0x12'))(_0x379e('0x13'));var utils=require(_0x379e('0x14'));var config=require(_0x379e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a69bd,_0x30e572){_0x30e572=_0x30e572||0xcc;return function(_0x30f921){if(_0x30f921){return _0x5a69bd[_0x379e('0x16')](_0x30e572);}return _0x5a69bd['status'](_0x30e572)[_0x379e('0x17')]();};}function respondWithResult(_0x488c12,_0x5efa8c){_0x5efa8c=_0x5efa8c||0xc8;return function(_0x4bd45f){if(_0x4bd45f){return _0x488c12[_0x379e('0x18')](_0x5efa8c)['json'](_0x4bd45f);}};}function respondWithFilteredResult(_0x2e0e9a,_0x24b7f6){return function(_0x11b34f){if(_0x11b34f){var _0x2a7d53=typeof _0x24b7f6[_0x379e('0x19')]===_0x379e('0x1a')&&typeof _0x24b7f6['limit']==='undefined';var _0x153bcd=_0x11b34f[_0x379e('0x1b')];var _0x844a07=_0x2a7d53?0x0:_0x24b7f6[_0x379e('0x19')];var _0x5c20f9=_0x2a7d53?_0x11b34f[_0x379e('0x1b')]:_0x24b7f6['offset']+_0x24b7f6['limit'];var _0x3332a7;if(_0x5c20f9>=_0x153bcd){_0x5c20f9=_0x153bcd;_0x3332a7=0xc8;}else{_0x3332a7=0xce;}_0x2e0e9a[_0x379e('0x18')](_0x3332a7);return _0x2e0e9a[_0x379e('0x1c')](_0x379e('0x1d'),_0x844a07+'-'+_0x5c20f9+'/'+_0x153bcd)[_0x379e('0x1e')](_0x11b34f);}return null;};}function patchUpdates(_0x460c8a){return function(_0x2852b6){try{jsonpatch[_0x379e('0x1f')](_0x2852b6,_0x460c8a,!![]);}catch(_0x110994){return BPromise[_0x379e('0x20')](_0x110994);}return _0x2852b6[_0x379e('0x21')]();};}function saveUpdates(_0x1b7b06,_0x5eebed){return function(_0x187ad1){if(_0x187ad1){return _0x187ad1['update'](_0x1b7b06)[_0x379e('0x22')](function(_0x3637de){return _0x3637de;});}return null;};}function removeEntity(_0x48e0dc,_0xd6204a){return function(_0x7dbb4a){if(_0x7dbb4a){return _0x7dbb4a[_0x379e('0x23')]()[_0x379e('0x22')](function(){_0x48e0dc[_0x379e('0x18')](0xcc)[_0x379e('0x17')]();});}};}function handleEntityNotFound(_0x489dc2,_0x2a4dd6){return function(_0x5ae7b5){if(!_0x5ae7b5){_0x489dc2[_0x379e('0x16')](0x194);}return _0x5ae7b5;};}function handleError(_0x2c7add,_0x29df5c){_0x29df5c=_0x29df5c||0x1f4;return function(_0x3c5f06){logger[_0x379e('0x24')](_0x3c5f06[_0x379e('0x25')]);if(_0x3c5f06[_0x379e('0x26')]){delete _0x3c5f06['name'];}_0x2c7add['status'](_0x29df5c)[_0x379e('0x27')](_0x3c5f06);};}exports[_0x379e('0x28')]=function(_0x1c80db,_0x53f75d){var _0x2228e7={},_0x533c4b={},_0xcba0ec={'count':0x0,'rows':[]};var _0x31a1ae=_[_0x379e('0x29')](db[_0x379e('0x2a')][_0x379e('0x2b')],function(_0x2a6409){return{'name':_0x2a6409[_0x379e('0x2c')],'type':_0x2a6409[_0x379e('0x2d')][_0x379e('0x2e')]};});_0x533c4b[_0x379e('0x2f')]=_[_0x379e('0x29')](_0x31a1ae,_0x379e('0x26'));_0x533c4b[_0x379e('0x30')]=_[_0x379e('0x31')](_0x1c80db[_0x379e('0x30')]);_0x533c4b[_0x379e('0x32')]=_['intersection'](_0x533c4b[_0x379e('0x2f')],_0x533c4b['query']);_0x2228e7[_0x379e('0x33')]=_[_0x379e('0x34')](_0x533c4b['model'],qs['fields'](_0x1c80db[_0x379e('0x30')]['fields']));_0x2228e7[_0x379e('0x33')]=_0x2228e7['attributes'][_0x379e('0x35')]?_0x2228e7[_0x379e('0x33')]:_0x533c4b[_0x379e('0x2f')];if(!_0x1c80db[_0x379e('0x30')][_0x379e('0x36')](_0x379e('0x37'))){_0x2228e7[_0x379e('0x38')]=qs[_0x379e('0x38')](_0x1c80db[_0x379e('0x30')]['limit']);_0x2228e7['offset']=qs[_0x379e('0x19')](_0x1c80db[_0x379e('0x30')]['offset']);}_0x2228e7['order']=qs[_0x379e('0x39')](_0x1c80db[_0x379e('0x30')]['sort']);_0x2228e7[_0x379e('0x3a')]=qs[_0x379e('0x32')](_[_0x379e('0x3b')](_0x1c80db[_0x379e('0x30')],_0x533c4b[_0x379e('0x32')]),_0x31a1ae);if(_0x1c80db[_0x379e('0x30')]['filter']){_0x2228e7[_0x379e('0x3a')]=_[_0x379e('0x3c')](_0x2228e7[_0x379e('0x3a')],{'$or':_[_0x379e('0x29')](_0x31a1ae,function(_0x2d1803){if(_0x2d1803['type']!==_0x379e('0x3d')){var _0x370bd4={};_0x370bd4[_0x2d1803[_0x379e('0x26')]]={'$like':'%'+_0x1c80db[_0x379e('0x30')]['filter']+'%'};return _0x370bd4;}})});}_0x2228e7=_[_0x379e('0x3c')]({},_0x2228e7,_0x1c80db[_0x379e('0x3e')]);var _0x3d0da5={'where':_0x2228e7[_0x379e('0x3a')]};return db[_0x379e('0x2a')][_0x379e('0x1b')](_0x3d0da5)[_0x379e('0x22')](function(_0x4a5c92){_0xcba0ec['count']=_0x4a5c92;if(_0x1c80db['query'][_0x379e('0x3f')]){_0x2228e7[_0x379e('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x379e('0x41')](_0x2228e7);})['then'](function(_0x5ce85f){_0xcba0ec[_0x379e('0x42')]=_0x5ce85f;return _0xcba0ec;})[_0x379e('0x22')](respondWithFilteredResult(_0x53f75d,_0x2228e7))[_0x379e('0x43')](handleError(_0x53f75d,null));};exports[_0x379e('0x44')]=function(_0x110e8a,_0x226d8b){var _0x81f7ef={'raw':![],'where':{'id':_0x110e8a[_0x379e('0x45')]['id']}},_0xd2158f={};_0xd2158f[_0x379e('0x2f')]=_['keys'](db[_0x379e('0x2a')][_0x379e('0x2b')]);_0xd2158f[_0x379e('0x30')]=_[_0x379e('0x31')](_0x110e8a[_0x379e('0x30')]);_0xd2158f['filters']=_[_0x379e('0x34')](_0xd2158f['model'],_0xd2158f[_0x379e('0x30')]);_0x81f7ef[_0x379e('0x33')]=_[_0x379e('0x34')](_0xd2158f[_0x379e('0x2f')],qs[_0x379e('0x46')](_0x110e8a[_0x379e('0x30')][_0x379e('0x46')]));_0x81f7ef['attributes']=_0x81f7ef['attributes'][_0x379e('0x35')]?_0x81f7ef[_0x379e('0x33')]:_0xd2158f[_0x379e('0x2f')];if(_0x110e8a[_0x379e('0x30')][_0x379e('0x3f')]){_0x81f7ef[_0x379e('0x40')]=[{'all':!![]}];}_0x81f7ef=_[_0x379e('0x3c')]({},_0x81f7ef,_0x110e8a[_0x379e('0x3e')]);return db[_0x379e('0x2a')][_0x379e('0x47')](_0x81f7ef)[_0x379e('0x22')](handleEntityNotFound(_0x226d8b,null))['then'](respondWithResult(_0x226d8b,null))[_0x379e('0x43')](handleError(_0x226d8b,null));};exports['create']=function(_0x5430ca,_0x23e41f){return db['VtigerConfiguration']['create'](_0x5430ca['body'],{})[_0x379e('0x22')](respondWithResult(_0x23e41f,0xc9))[_0x379e('0x43')](handleError(_0x23e41f,null));};exports[_0x379e('0x48')]=function(_0x4c6dc2,_0x37021d){if(_0x4c6dc2[_0x379e('0x49')]['id']){delete _0x4c6dc2[_0x379e('0x49')]['id'];}return db[_0x379e('0x2a')][_0x379e('0x47')]({'where':{'id':_0x4c6dc2[_0x379e('0x45')]['id']}})['then'](handleEntityNotFound(_0x37021d,null))[_0x379e('0x22')](saveUpdates(_0x4c6dc2['body'],null))[_0x379e('0x22')](respondWithResult(_0x37021d,null))['catch'](handleError(_0x37021d,null));};exports[_0x379e('0x23')]=function(_0x36e20e,_0x519002){return db['VtigerConfiguration'][_0x379e('0x47')]({'where':{'id':_0x36e20e[_0x379e('0x45')]['id']}})['then'](handleEntityNotFound(_0x519002,null))[_0x379e('0x22')](removeEntity(_0x519002,null))['catch'](handleError(_0x519002,null));};exports[_0x379e('0x4a')]=function(_0x53da9,_0x13d996,_0x2ceccd){var _0x248452={};var _0x375442={};var _0x1a98c3;var _0x18c5d;return db[_0x379e('0x2a')][_0x379e('0x4b')]({'where':{'id':_0x53da9['params']['id']}})[_0x379e('0x22')](handleEntityNotFound(_0x13d996,null))['then'](function(_0x1dc4bb){if(_0x1dc4bb){_0x1a98c3=_0x1dc4bb;_0x375442[_0x379e('0x2f')]=_[_0x379e('0x31')](db[_0x379e('0x4c')][_0x379e('0x2b')]);_0x375442['query']=_[_0x379e('0x31')](_0x53da9[_0x379e('0x30')]);_0x375442[_0x379e('0x32')]=_[_0x379e('0x34')](_0x375442['model'],_0x375442['query']);_0x248452[_0x379e('0x33')]=_[_0x379e('0x34')](_0x375442[_0x379e('0x2f')],qs['fields'](_0x53da9[_0x379e('0x30')][_0x379e('0x46')]));_0x248452[_0x379e('0x33')]=_0x248452[_0x379e('0x33')]['length']?_0x248452[_0x379e('0x33')]:_0x375442[_0x379e('0x2f')];_0x248452[_0x379e('0x4d')]=qs[_0x379e('0x39')](_0x53da9[_0x379e('0x30')][_0x379e('0x39')]);_0x248452['where']=qs[_0x379e('0x32')](_[_0x379e('0x3b')](_0x53da9['query'],_0x375442[_0x379e('0x32')]));if(_0x53da9[_0x379e('0x30')]['filter']){_0x248452[_0x379e('0x3a')]=_['merge'](_0x248452[_0x379e('0x3a')],{'$or':_[_0x379e('0x29')](_0x248452[_0x379e('0x33')],function(_0x58eaee){var _0xa03ea2={};_0xa03ea2[_0x58eaee]={'$like':'%'+_0x53da9[_0x379e('0x30')][_0x379e('0x4e')]+'%'};return _0xa03ea2;})});}_0x248452=_[_0x379e('0x3c')]({},_0x248452,_0x53da9[_0x379e('0x3e')]);return _0x1a98c3['getFields'](_0x248452);}})[_0x379e('0x22')](function(_0x49a29e){if(_0x49a29e){_0x18c5d=_0x49a29e[_0x379e('0x35')];if(!_0x53da9['query'][_0x379e('0x36')](_0x379e('0x37'))){_0x248452[_0x379e('0x38')]=qs[_0x379e('0x38')](_0x53da9[_0x379e('0x30')]['limit']);_0x248452[_0x379e('0x19')]=qs['offset'](_0x53da9[_0x379e('0x30')][_0x379e('0x19')]);}return _0x1a98c3['getFields'](_0x248452);}})['then'](function(_0x1a17ac){if(_0x1a17ac){return _0x1a17ac?{'count':_0x18c5d,'rows':_0x1a17ac}:null;}})[_0x379e('0x22')](respondWithResult(_0x13d996,null))['catch'](handleError(_0x13d996,null));};exports['getSubjects']=function(_0x2d94c9,_0x26e3c3,_0x46e43a){var _0x2589b1={};var _0x3e4e1f={};var _0x87e162;var _0xc48c68;return db[_0x379e('0x2a')][_0x379e('0x4b')]({'where':{'id':_0x2d94c9['params']['id']}})[_0x379e('0x22')](handleEntityNotFound(_0x26e3c3,null))['then'](function(_0x2c91f4){if(_0x2c91f4){_0x87e162=_0x2c91f4;_0x3e4e1f['model']=_[_0x379e('0x31')](db[_0x379e('0x4c')][_0x379e('0x2b')]);_0x3e4e1f[_0x379e('0x30')]=_[_0x379e('0x31')](_0x2d94c9[_0x379e('0x30')]);_0x3e4e1f['filters']=_[_0x379e('0x34')](_0x3e4e1f['model'],_0x3e4e1f[_0x379e('0x30')]);_0x2589b1[_0x379e('0x33')]=_[_0x379e('0x34')](_0x3e4e1f[_0x379e('0x2f')],qs[_0x379e('0x46')](_0x2d94c9[_0x379e('0x30')][_0x379e('0x46')]));_0x2589b1['attributes']=_0x2589b1[_0x379e('0x33')][_0x379e('0x35')]?_0x2589b1[_0x379e('0x33')]:_0x3e4e1f[_0x379e('0x2f')];_0x2589b1[_0x379e('0x4d')]=qs[_0x379e('0x39')](_0x2d94c9[_0x379e('0x30')][_0x379e('0x39')]);_0x2589b1[_0x379e('0x3a')]=qs['filters'](_[_0x379e('0x3b')](_0x2d94c9[_0x379e('0x30')],_0x3e4e1f[_0x379e('0x32')]));if(_0x2d94c9[_0x379e('0x30')][_0x379e('0x4e')]){_0x2589b1['where']=_[_0x379e('0x3c')](_0x2589b1[_0x379e('0x3a')],{'$or':_[_0x379e('0x29')](_0x2589b1[_0x379e('0x33')],function(_0x584baa){var _0x424029={};_0x424029[_0x584baa]={'$like':'%'+_0x2d94c9[_0x379e('0x30')][_0x379e('0x4e')]+'%'};return _0x424029;})});}_0x2589b1=_[_0x379e('0x3c')]({},_0x2589b1,_0x2d94c9[_0x379e('0x3e')]);return _0x87e162[_0x379e('0x4f')](_0x2589b1);}})['then'](function(_0x1193be){if(_0x1193be){_0xc48c68=_0x1193be[_0x379e('0x35')];if(!_0x2d94c9[_0x379e('0x30')]['hasOwnProperty']('nolimit')){_0x2589b1[_0x379e('0x38')]=qs[_0x379e('0x38')](_0x2d94c9['query'][_0x379e('0x38')]);_0x2589b1['offset']=qs[_0x379e('0x19')](_0x2d94c9[_0x379e('0x30')]['offset']);}return _0x87e162[_0x379e('0x4f')](_0x2589b1);}})['then'](function(_0x5e8162){if(_0x5e8162){return _0x5e8162?{'count':_0xc48c68,'rows':_0x5e8162}:null;}})[_0x379e('0x22')](respondWithResult(_0x26e3c3,null))[_0x379e('0x43')](handleError(_0x26e3c3,null));};exports[_0x379e('0x50')]=function(_0x5f1d7b,_0x37b3ec,_0x21f70a){var _0x4b558a={};var _0x540ab4={};var _0x2c405f;var _0x5d39b2;return db[_0x379e('0x2a')][_0x379e('0x4b')]({'where':{'id':_0x5f1d7b[_0x379e('0x45')]['id']}})['then'](handleEntityNotFound(_0x37b3ec,null))[_0x379e('0x22')](function(_0x8c207e){if(_0x8c207e){_0x2c405f=_0x8c207e;_0x540ab4[_0x379e('0x2f')]=_[_0x379e('0x31')](db[_0x379e('0x4c')][_0x379e('0x2b')]);_0x540ab4['query']=_['keys'](_0x5f1d7b[_0x379e('0x30')]);_0x540ab4[_0x379e('0x32')]=_['intersection'](_0x540ab4[_0x379e('0x2f')],_0x540ab4[_0x379e('0x30')]);_0x4b558a[_0x379e('0x33')]=_[_0x379e('0x34')](_0x540ab4[_0x379e('0x2f')],qs[_0x379e('0x46')](_0x5f1d7b[_0x379e('0x30')][_0x379e('0x46')]));_0x4b558a[_0x379e('0x33')]=_0x4b558a[_0x379e('0x33')][_0x379e('0x35')]?_0x4b558a[_0x379e('0x33')]:_0x540ab4[_0x379e('0x2f')];_0x4b558a[_0x379e('0x4d')]=qs[_0x379e('0x39')](_0x5f1d7b['query'][_0x379e('0x39')]);_0x4b558a[_0x379e('0x3a')]=qs[_0x379e('0x32')](_[_0x379e('0x3b')](_0x5f1d7b['query'],_0x540ab4[_0x379e('0x32')]));if(_0x5f1d7b[_0x379e('0x30')][_0x379e('0x4e')]){_0x4b558a[_0x379e('0x3a')]=_[_0x379e('0x3c')](_0x4b558a[_0x379e('0x3a')],{'$or':_[_0x379e('0x29')](_0x4b558a[_0x379e('0x33')],function(_0x1c6779){var _0x55a227={};_0x55a227[_0x1c6779]={'$like':'%'+_0x5f1d7b[_0x379e('0x30')][_0x379e('0x4e')]+'%'};return _0x55a227;})});}_0x4b558a=_[_0x379e('0x3c')]({},_0x4b558a,_0x5f1d7b['options']);return _0x2c405f[_0x379e('0x50')](_0x4b558a);}})[_0x379e('0x22')](function(_0x2c3799){if(_0x2c3799){_0x5d39b2=_0x2c3799[_0x379e('0x35')];if(!_0x5f1d7b[_0x379e('0x30')][_0x379e('0x36')](_0x379e('0x37'))){_0x4b558a['limit']=qs[_0x379e('0x38')](_0x5f1d7b['query'][_0x379e('0x38')]);_0x4b558a[_0x379e('0x19')]=qs[_0x379e('0x19')](_0x5f1d7b[_0x379e('0x30')][_0x379e('0x19')]);}return _0x2c405f[_0x379e('0x50')](_0x4b558a);}})[_0x379e('0x22')](function(_0x190031){if(_0x190031){return _0x190031?{'count':_0x5d39b2,'rows':_0x190031}:null;}})[_0x379e('0x22')](respondWithResult(_0x37b3ec,null))[_0x379e('0x43')](handleError(_0x37b3ec,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7c94ecc..3918c54 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 _0x3d71=['VtigerConfiguration','int_vtiger_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x275ced,_0x181552){var _0x2449f1=function(_0x47117e){while(--_0x47117e){_0x275ced['push'](_0x275ced['shift']());}};_0x2449f1(++_0x181552);}(_0x3d71,0x19a));var _0x13d7=function(_0x29be44,_0x4f38b5){_0x29be44=_0x29be44-0x0;var _0x54394e=_0x3d71[_0x29be44];return _0x54394e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13d7('0x0'))(_0x13d7('0x1'));var moment=require(_0x13d7('0x2'));var BPromise=require(_0x13d7('0x3'));var rp=require(_0x13d7('0x4'));var fs=require('fs');var path=require(_0x13d7('0x5'));var rimraf=require(_0x13d7('0x6'));var config=require(_0x13d7('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x13d7('0x8')]=function(_0x123cd9,_0x1323b7){return _0x123cd9[_0x13d7('0x9')](_0x13d7('0xa'),attributes,{'tableName':_0x13d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c35=['api','moment','request-promise','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x4660c9,_0x5a5dc0){var _0x4d2de6=function(_0x23679c){while(--_0x23679c){_0x4660c9['push'](_0x4660c9['shift']());}};_0x4d2de6(++_0x5a5dc0);}(_0x1c35,0x1dd));var _0x51c3=function(_0x16ef84,_0xaea969){_0x16ef84=_0x16ef84-0x0;var _0x10bbaa=_0x1c35[_0x16ef84];return _0x10bbaa;};'use strict';var _=require(_0x51c3('0x0'));var util=require(_0x51c3('0x1'));var logger=require(_0x51c3('0x2'))(_0x51c3('0x3'));var moment=require(_0x51c3('0x4'));var BPromise=require('bluebird');var rp=require(_0x51c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51c3('0x6'));var config=require(_0x51c3('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x51c3('0x8')]=function(_0x53dced,_0x1d1e4b){return _0x53dced[_0x51c3('0x9')](_0x51c3('0xa'),attributes,{'tableName':_0x51c3('0xb'),'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 907f298..386e3a0 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 _0x7c2a=['error','code','message','catch','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2d5801,_0x526892){var _0x53e2e9=function(_0x357c22){while(--_0x357c22){_0x2d5801['push'](_0x2d5801['shift']());}};_0x53e2e9(++_0x526892);}(_0x7c2a,0x1e7));var _0xa7c2=function(_0x52c008,_0x4c3211){_0x52c008=_0x52c008-0x0;var _0x8e5986=_0x7c2a[_0x52c008];return _0x8e5986;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa7c2('0x0'));var BPromise=require('bluebird');var rs=require(_0xa7c2('0x1'));var fs=require('fs');var Redis=require(_0xa7c2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7c2('0x3'));var logger=require('../../config/logger')(_0xa7c2('0x4'));var config=require(_0xa7c2('0x5'));var jayson=require(_0xa7c2('0x6'));var client=jayson[_0xa7c2('0x7')][_0xa7c2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58366e,_0x1b2816,_0xe52ea2){return new BPromise(function(_0x11b5cc,_0x4dfa5a){return client[_0xa7c2('0x9')](_0x58366e,_0xe52ea2)[_0xa7c2('0xa')](function(_0x126ebb){logger[_0xa7c2('0xb')](_0xa7c2('0xc'),_0x1b2816,_0xa7c2('0xd'));logger[_0xa7c2('0xe')](_0xa7c2('0xf'),_0x1b2816,_0xa7c2('0xd'),JSON[_0xa7c2('0x10')](_0x126ebb));if(_0x126ebb[_0xa7c2('0x11')]){if(_0x126ebb[_0xa7c2('0x11')][_0xa7c2('0x12')]===0x1f4){logger[_0xa7c2('0x11')](_0xa7c2('0xc'),_0x1b2816,_0x126ebb['error']['message']);return _0x4dfa5a(_0x126ebb[_0xa7c2('0x11')][_0xa7c2('0x13')]);}logger[_0xa7c2('0x11')](_0xa7c2('0xc'),_0x1b2816,_0x126ebb[_0xa7c2('0x11')]['message']);return _0x11b5cc(_0x126ebb[_0xa7c2('0x11')][_0xa7c2('0x13')]);}else{logger['info'](_0xa7c2('0xc'),_0x1b2816,_0xa7c2('0xd'));_0x11b5cc(_0x126ebb['result'][_0xa7c2('0x13')]);}})[_0xa7c2('0x14')](function(_0x2ca648){logger[_0xa7c2('0x11')](_0xa7c2('0xc'),_0x1b2816,_0x2ca648);_0x4dfa5a(_0x2ca648);});});} \ No newline at end of file +var _0xba55=['../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','rpc'];(function(_0x3a4f03,_0x22b3f2){var _0x479e49=function(_0x4ac044){while(--_0x4ac044){_0x3a4f03['push'](_0x3a4f03['shift']());}};_0x479e49(++_0x22b3f2);}(_0xba55,0x162));var _0x5ba5=function(_0x3580e6,_0x14aa68){_0x3580e6=_0x3580e6-0x0;var _0x5b1924=_0xba55[_0x3580e6];return _0x5b1924;};'use strict';var _=require(_0x5ba5('0x0'));var util=require(_0x5ba5('0x1'));var moment=require(_0x5ba5('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ba5('0x3'));var fs=require('fs');var Redis=require(_0x5ba5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ba5('0x5'));var config=require(_0x5ba5('0x6'));var jayson=require(_0x5ba5('0x7'));var client=jayson[_0x5ba5('0x8')][_0x5ba5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7bfc01,_0x4ea3f4,_0x373873){return new BPromise(function(_0x1c2cab,_0x41bd49){return client['request'](_0x7bfc01,_0x373873)[_0x5ba5('0xa')](function(_0xb91cab){logger[_0x5ba5('0xb')](_0x5ba5('0xc'),_0x4ea3f4,'request\x20sent');logger['debug'](_0x5ba5('0xd'),_0x4ea3f4,_0x5ba5('0xe'),JSON[_0x5ba5('0xf')](_0xb91cab));if(_0xb91cab['error']){if(_0xb91cab[_0x5ba5('0x10')][_0x5ba5('0x11')]===0x1f4){logger[_0x5ba5('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x4ea3f4,_0xb91cab[_0x5ba5('0x10')][_0x5ba5('0x12')]);return _0x41bd49(_0xb91cab[_0x5ba5('0x10')][_0x5ba5('0x12')]);}logger[_0x5ba5('0x10')](_0x5ba5('0xc'),_0x4ea3f4,_0xb91cab[_0x5ba5('0x10')]['message']);return _0x1c2cab(_0xb91cab['error'][_0x5ba5('0x12')]);}else{logger[_0x5ba5('0xb')](_0x5ba5('0xc'),_0x4ea3f4,_0x5ba5('0xe'));_0x1c2cab(_0xb91cab['result'][_0x5ba5('0x12')]);}})[_0x5ba5('0x13')](function(_0x143118){logger['error'](_0x5ba5('0xc'),_0x4ea3f4,_0x143118);_0x41bd49(_0x143118);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 60cc2f3..a4b928d 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 _0x8ac7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x8ac7,0x177));var _0x78ac=function(_0x45a855,_0x1797a4){_0x45a855=_0x45a855-0x0;var _0x3adaf9=_0x8ac7[_0x45a855];return _0x3adaf9;};'use strict';var multer=require(_0x78ac('0x0'));var util=require(_0x78ac('0x1'));var path=require(_0x78ac('0x2'));var timeout=require(_0x78ac('0x3'));var express=require(_0x78ac('0x4'));var router=express[_0x78ac('0x5')]();var fs_extra=require(_0x78ac('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x78ac('0x7'));var config=require(_0x78ac('0x8'));var controller=require(_0x78ac('0x9'));router[_0x78ac('0xa')]('/',auth[_0x78ac('0xb')](),controller['index']);router[_0x78ac('0xa')](_0x78ac('0xc'),auth[_0x78ac('0xb')](),controller['show']);router[_0x78ac('0xd')]('/',auth['isAuthenticated'](),controller[_0x78ac('0xe')]);router[_0x78ac('0xf')](_0x78ac('0xc'),auth[_0x78ac('0xb')](),controller[_0x78ac('0x10')]);router[_0x78ac('0x11')](_0x78ac('0xc'),auth[_0x78ac('0xb')](),controller[_0x78ac('0x12')]);module['exports']=router; \ No newline at end of file +var _0xacc7=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','util'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xacc7,0xcb));var _0x7acc=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0xacc7[_0x37c8ef];return _0x5eaee9;};'use strict';var multer=require('multer');var util=require(_0x7acc('0x0'));var path=require(_0x7acc('0x1'));var timeout=require(_0x7acc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7acc('0x3'));var auth=require(_0x7acc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7acc('0x5'));var controller=require(_0x7acc('0x6'));router[_0x7acc('0x7')]('/',auth[_0x7acc('0x8')](),controller[_0x7acc('0x9')]);router['get'](_0x7acc('0xa'),auth[_0x7acc('0x8')](),controller[_0x7acc('0xb')]);router['post']('/',auth[_0x7acc('0x8')](),controller[_0x7acc('0xc')]);router[_0x7acc('0xd')](_0x7acc('0xa'),auth['isAuthenticated'](),controller[_0x7acc('0xe')]);router[_0x7acc('0xf')](_0x7acc('0xa'),auth[_0x7acc('0x8')](),controller[_0x7acc('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3e19d84..0206aa0 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 _0xcec5=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM'];(function(_0x255128,_0x399f4b){var _0x14a8e1=function(_0x3a1566){while(--_0x3a1566){_0x255128['push'](_0x255128['shift']());}};_0x14a8e1(++_0x399f4b);}(_0xcec5,0x1db));var _0x5cec=function(_0x197486,_0xb97ec){_0x197486=_0x197486-0x0;var _0x457225=_0xcec5[_0x197486];return _0x457225;};'use strict';var Sequelize=require('sequelize');module[_0x5cec('0x0')]={'type':{'type':Sequelize[_0x5cec('0x1')]('string',_0x5cec('0x2'),_0x5cec('0x3'),_0x5cec('0x4'),_0x5cec('0x5')),'defaultValue':_0x5cec('0x6')},'content':{'type':Sequelize[_0x5cec('0x7')]},'key':{'type':Sequelize[_0x5cec('0x7')]},'keyType':{'type':Sequelize[_0x5cec('0x1')]('string',_0x5cec('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x5cec('0x7')]},'idField':{'type':Sequelize[_0x5cec('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5cec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5cec('0x7')]}}; \ No newline at end of file +var _0xdd32=['STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable'];(function(_0x42c76c,_0x1dfd70){var _0x52d3a7=function(_0x59a155){while(--_0x59a155){_0x42c76c['push'](_0x42c76c['shift']());}};_0x52d3a7(++_0x1dfd70);}(_0xdd32,0x6c));var _0x2dd3=function(_0x1d280d,_0x465a6b){_0x1d280d=_0x1d280d-0x0;var _0x56bbec=_0xdd32[_0x1d280d];return _0x56bbec;};'use strict';var Sequelize=require(_0x2dd3('0x0'));module[_0x2dd3('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2dd3('0x2'),'variable',_0x2dd3('0x3'),'keyValue','picklist'),'defaultValue':_0x2dd3('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2dd3('0x4')]},'keyType':{'type':Sequelize[_0x2dd3('0x5')](_0x2dd3('0x2'),_0x2dd3('0x6'),_0x2dd3('0x3'))},'keyContent':{'type':Sequelize[_0x2dd3('0x4')]},'idField':{'type':Sequelize[_0x2dd3('0x4')]},'nameField':{'type':Sequelize[_0x2dd3('0x4')]},'customField':{'type':Sequelize[_0x2dd3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2dd3('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 0f1504f..e0e1b39 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 _0xf9f0=['reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','merge','options','VtigerField','includeAll','include','rows','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','json','apply'];(function(_0x1c3120,_0x198a70){var _0x2d6a5b=function(_0xd16844){while(--_0xd16844){_0x1c3120['push'](_0x1c3120['shift']());}};_0x2d6a5b(++_0x198a70);}(_0xf9f0,0x72));var _0x0f9f=function(_0x128cfe,_0x29c5da){_0x128cfe=_0x128cfe-0x0;var _0xbc51e3=_0xf9f0[_0x128cfe];return _0xbc51e3;};'use strict';var emlformat=require(_0x0f9f('0x0'));var rimraf=require(_0x0f9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f9f('0x2'));var rp=require(_0x0f9f('0x3'));var moment=require(_0x0f9f('0x4'));var BPromise=require(_0x0f9f('0x5'));var Mustache=require(_0x0f9f('0x6'));var util=require(_0x0f9f('0x7'));var path=require(_0x0f9f('0x8'));var sox=require(_0x0f9f('0x9'));var csv=require('to-csv');var ejs=require(_0x0f9f('0xa'));var fs=require('fs');var fs_extra=require(_0x0f9f('0xb'));var _=require(_0x0f9f('0xc'));var squel=require(_0x0f9f('0xd'));var crypto=require(_0x0f9f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0f9f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0f9f('0x10'));var Papa=require(_0x0f9f('0x11'));var Redis=require('ioredis');var authService=require(_0x0f9f('0x12'));var qs=require(_0x0f9f('0x13'));var as=require(_0x0f9f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0f9f('0x15'));var utils=require(_0x0f9f('0x16'));var config=require(_0x0f9f('0x17'));var licenseUtil=require(_0x0f9f('0x18'));var db=require(_0x0f9f('0x19'))['db'];function respondWithStatusCode(_0x302c16,_0x5b9bc1){_0x5b9bc1=_0x5b9bc1||0xcc;return function(_0x404de7){if(_0x404de7){return _0x302c16['sendStatus'](_0x5b9bc1);}return _0x302c16['status'](_0x5b9bc1)[_0x0f9f('0x1a')]();};}function respondWithResult(_0x5239f5,_0x38b549){_0x38b549=_0x38b549||0xc8;return function(_0x47aba7){if(_0x47aba7){return _0x5239f5[_0x0f9f('0x1b')](_0x38b549)['json'](_0x47aba7);}};}function respondWithFilteredResult(_0x265cce,_0x59e0fa){return function(_0x5bdf1b){if(_0x5bdf1b){var _0x23bce9=typeof _0x59e0fa[_0x0f9f('0x1c')]===_0x0f9f('0x1d')&&typeof _0x59e0fa[_0x0f9f('0x1e')]===_0x0f9f('0x1d');var _0x52b761=_0x5bdf1b[_0x0f9f('0x1f')];var _0x577da4=_0x23bce9?0x0:_0x59e0fa[_0x0f9f('0x1c')];var _0x5aa70a=_0x23bce9?_0x5bdf1b[_0x0f9f('0x1f')]:_0x59e0fa[_0x0f9f('0x1c')]+_0x59e0fa[_0x0f9f('0x1e')];var _0x2c69ec;if(_0x5aa70a>=_0x52b761){_0x5aa70a=_0x52b761;_0x2c69ec=0xc8;}else{_0x2c69ec=0xce;}_0x265cce[_0x0f9f('0x1b')](_0x2c69ec);return _0x265cce['set']('Content-Range',_0x577da4+'-'+_0x5aa70a+'/'+_0x52b761)[_0x0f9f('0x20')](_0x5bdf1b);}return null;};}function patchUpdates(_0x4ca627){return function(_0x45e09a){try{jsonpatch[_0x0f9f('0x21')](_0x45e09a,_0x4ca627,!![]);}catch(_0x5f5475){return BPromise[_0x0f9f('0x22')](_0x5f5475);}return _0x45e09a[_0x0f9f('0x23')]();};}function saveUpdates(_0x1d7d6c,_0x30be06){return function(_0x1bf1fa){if(_0x1bf1fa){return _0x1bf1fa[_0x0f9f('0x24')](_0x1d7d6c)[_0x0f9f('0x25')](function(_0x28d6c5){return _0x28d6c5;});}return null;};}function removeEntity(_0x3f9f3b,_0x26f926){return function(_0x251f68){if(_0x251f68){return _0x251f68[_0x0f9f('0x26')]()[_0x0f9f('0x25')](function(){_0x3f9f3b[_0x0f9f('0x1b')](0xcc)[_0x0f9f('0x1a')]();});}};}function handleEntityNotFound(_0x26896a,_0x1371c2){return function(_0x214b83){if(!_0x214b83){_0x26896a[_0x0f9f('0x27')](0x194);}return _0x214b83;};}function handleError(_0x77f615,_0x3cf83f){_0x3cf83f=_0x3cf83f||0x1f4;return function(_0x4a0d79){logger[_0x0f9f('0x28')](_0x4a0d79[_0x0f9f('0x29')]);if(_0x4a0d79[_0x0f9f('0x2a')]){delete _0x4a0d79['name'];}_0x77f615[_0x0f9f('0x1b')](_0x3cf83f)['send'](_0x4a0d79);};}exports[_0x0f9f('0x2b')]=function(_0x29af9f,_0xee3082){var _0x493ea8={},_0x5ab53b={},_0x409eda={'count':0x0,'rows':[]};var _0x322edf=_[_0x0f9f('0x2c')](db['VtigerField'][_0x0f9f('0x2d')],function(_0x217f6c){return{'name':_0x217f6c['fieldName'],'type':_0x217f6c['type'][_0x0f9f('0x2e')]};});_0x5ab53b[_0x0f9f('0x2f')]=_['map'](_0x322edf,'name');_0x5ab53b[_0x0f9f('0x30')]=_[_0x0f9f('0x31')](_0x29af9f[_0x0f9f('0x30')]);_0x5ab53b[_0x0f9f('0x32')]=_[_0x0f9f('0x33')](_0x5ab53b[_0x0f9f('0x2f')],_0x5ab53b[_0x0f9f('0x30')]);_0x493ea8[_0x0f9f('0x34')]=_[_0x0f9f('0x33')](_0x5ab53b['model'],qs[_0x0f9f('0x35')](_0x29af9f['query'][_0x0f9f('0x35')]));_0x493ea8['attributes']=_0x493ea8[_0x0f9f('0x34')][_0x0f9f('0x36')]?_0x493ea8[_0x0f9f('0x34')]:_0x5ab53b['model'];if(!_0x29af9f[_0x0f9f('0x30')]['hasOwnProperty'](_0x0f9f('0x37'))){_0x493ea8['limit']=qs['limit'](_0x29af9f[_0x0f9f('0x30')][_0x0f9f('0x1e')]);_0x493ea8[_0x0f9f('0x1c')]=qs[_0x0f9f('0x1c')](_0x29af9f[_0x0f9f('0x30')]['offset']);}_0x493ea8[_0x0f9f('0x38')]=qs[_0x0f9f('0x39')](_0x29af9f[_0x0f9f('0x30')][_0x0f9f('0x39')]);_0x493ea8[_0x0f9f('0x3a')]=qs['filters'](_[_0x0f9f('0x3b')](_0x29af9f[_0x0f9f('0x30')],_0x5ab53b[_0x0f9f('0x32')]),_0x322edf);if(_0x29af9f['query'][_0x0f9f('0x3c')]){_0x493ea8[_0x0f9f('0x3a')]=_['merge'](_0x493ea8['where'],{'$or':_[_0x0f9f('0x2c')](_0x322edf,function(_0xb178c6){if(_0xb178c6[_0x0f9f('0x3d')]!=='VIRTUAL'){var _0x537f84={};_0x537f84[_0xb178c6['name']]={'$like':'%'+_0x29af9f['query']['filter']+'%'};return _0x537f84;}})});}_0x493ea8=_[_0x0f9f('0x3e')]({},_0x493ea8,_0x29af9f[_0x0f9f('0x3f')]);var _0x30e749={'where':_0x493ea8[_0x0f9f('0x3a')]};return db[_0x0f9f('0x40')]['count'](_0x30e749)['then'](function(_0x129da7){_0x409eda[_0x0f9f('0x1f')]=_0x129da7;if(_0x29af9f['query'][_0x0f9f('0x41')]){_0x493ea8[_0x0f9f('0x42')]=[{'all':!![]}];}return db[_0x0f9f('0x40')]['findAll'](_0x493ea8);})[_0x0f9f('0x25')](function(_0x4d0694){_0x409eda[_0x0f9f('0x43')]=_0x4d0694;return _0x409eda;})[_0x0f9f('0x25')](respondWithFilteredResult(_0xee3082,_0x493ea8))['catch'](handleError(_0xee3082,null));};exports[_0x0f9f('0x44')]=function(_0x221f56,_0x126407){var _0x4cef44={'raw':!![],'where':{'id':_0x221f56[_0x0f9f('0x45')]['id']}},_0x50d03c={};_0x50d03c[_0x0f9f('0x2f')]=_[_0x0f9f('0x31')](db[_0x0f9f('0x40')][_0x0f9f('0x2d')]);_0x50d03c[_0x0f9f('0x30')]=_[_0x0f9f('0x31')](_0x221f56['query']);_0x50d03c['filters']=_[_0x0f9f('0x33')](_0x50d03c[_0x0f9f('0x2f')],_0x50d03c[_0x0f9f('0x30')]);_0x4cef44['attributes']=_[_0x0f9f('0x33')](_0x50d03c[_0x0f9f('0x2f')],qs[_0x0f9f('0x35')](_0x221f56[_0x0f9f('0x30')][_0x0f9f('0x35')]));_0x4cef44['attributes']=_0x4cef44[_0x0f9f('0x34')][_0x0f9f('0x36')]?_0x4cef44[_0x0f9f('0x34')]:_0x50d03c[_0x0f9f('0x2f')];if(_0x221f56['query'][_0x0f9f('0x41')]){_0x4cef44[_0x0f9f('0x42')]=[{'all':!![]}];}_0x4cef44=_['merge']({},_0x4cef44,_0x221f56[_0x0f9f('0x3f')]);return db[_0x0f9f('0x40')][_0x0f9f('0x46')](_0x4cef44)[_0x0f9f('0x25')](handleEntityNotFound(_0x126407,null))[_0x0f9f('0x25')](respondWithResult(_0x126407,null))[_0x0f9f('0x47')](handleError(_0x126407,null));};exports[_0x0f9f('0x48')]=function(_0x1c4d35,_0x31d731){return db[_0x0f9f('0x40')][_0x0f9f('0x48')](_0x1c4d35[_0x0f9f('0x49')],{})[_0x0f9f('0x25')](respondWithResult(_0x31d731,0xc9))['catch'](handleError(_0x31d731,null));};exports['update']=function(_0x4a0a13,_0x3592f1){if(_0x4a0a13['body']['id']){delete _0x4a0a13[_0x0f9f('0x49')]['id'];}return db[_0x0f9f('0x40')][_0x0f9f('0x46')]({'where':{'id':_0x4a0a13[_0x0f9f('0x45')]['id']}})[_0x0f9f('0x25')](handleEntityNotFound(_0x3592f1,null))['then'](saveUpdates(_0x4a0a13[_0x0f9f('0x49')],null))['then'](respondWithResult(_0x3592f1,null))[_0x0f9f('0x47')](handleError(_0x3592f1,null));};exports[_0x0f9f('0x26')]=function(_0x3db5fe,_0x310c8d){return db['VtigerField'][_0x0f9f('0x46')]({'where':{'id':_0x3db5fe[_0x0f9f('0x45')]['id']}})[_0x0f9f('0x25')](handleEntityNotFound(_0x310c8d,null))[_0x0f9f('0x25')](removeEntity(_0x310c8d,null))[_0x0f9f('0x47')](handleError(_0x310c8d,null));}; \ No newline at end of file +var _0x4daa=['fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','VtigerField','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','rows','catch','show','params','rawAttributes','length','include','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox'];(function(_0x595d9b,_0x256ca6){var _0x36a51f=function(_0x3d5000){while(--_0x3d5000){_0x595d9b['push'](_0x595d9b['shift']());}};_0x36a51f(++_0x256ca6);}(_0x4daa,0x8c));var _0xa4da=function(_0x13f5ac,_0x303066){_0x13f5ac=_0x13f5ac-0x0;var _0x163d97=_0x4daa[_0x13f5ac];return _0x163d97;};'use strict';var emlformat=require(_0xa4da('0x0'));var rimraf=require(_0xa4da('0x1'));var zipdir=require(_0xa4da('0x2'));var jsonpatch=require(_0xa4da('0x3'));var rp=require('request-promise');var moment=require(_0xa4da('0x4'));var BPromise=require(_0xa4da('0x5'));var Mustache=require('mustache');var util=require(_0xa4da('0x6'));var path=require('path');var sox=require(_0xa4da('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4da('0x8'));var _=require(_0xa4da('0x9'));var squel=require('squel');var crypto=require(_0xa4da('0xa'));var jsforce=require(_0xa4da('0xb'));var deskjs=require(_0xa4da('0xc'));var toCsv=require(_0xa4da('0xd'));var querystring=require(_0xa4da('0xe'));var Papa=require(_0xa4da('0xf'));var Redis=require(_0xa4da('0x10'));var authService=require(_0xa4da('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa4da('0x12'));var hardwareService=require(_0xa4da('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa4da('0x14'));var config=require(_0xa4da('0x15'));var licenseUtil=require(_0xa4da('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f4a9c,_0x4b732d){_0x4b732d=_0x4b732d||0xcc;return function(_0x5b21f1){if(_0x5b21f1){return _0x3f4a9c['sendStatus'](_0x4b732d);}return _0x3f4a9c['status'](_0x4b732d)[_0xa4da('0x17')]();};}function respondWithResult(_0x35fcd9,_0x1cf834){_0x1cf834=_0x1cf834||0xc8;return function(_0x1becd2){if(_0x1becd2){return _0x35fcd9[_0xa4da('0x18')](_0x1cf834)[_0xa4da('0x19')](_0x1becd2);}};}function respondWithFilteredResult(_0x457bbe,_0x44830f){return function(_0x56d46e){if(_0x56d46e){var _0x12bc78=typeof _0x44830f['offset']===_0xa4da('0x1a')&&typeof _0x44830f[_0xa4da('0x1b')]===_0xa4da('0x1a');var _0x274b58=_0x56d46e[_0xa4da('0x1c')];var _0x4b11aa=_0x12bc78?0x0:_0x44830f[_0xa4da('0x1d')];var _0x2d6456=_0x12bc78?_0x56d46e[_0xa4da('0x1c')]:_0x44830f[_0xa4da('0x1d')]+_0x44830f[_0xa4da('0x1b')];var _0x21d619;if(_0x2d6456>=_0x274b58){_0x2d6456=_0x274b58;_0x21d619=0xc8;}else{_0x21d619=0xce;}_0x457bbe['status'](_0x21d619);return _0x457bbe[_0xa4da('0x1e')](_0xa4da('0x1f'),_0x4b11aa+'-'+_0x2d6456+'/'+_0x274b58)['json'](_0x56d46e);}return null;};}function patchUpdates(_0x299f77){return function(_0x220b0f){try{jsonpatch['apply'](_0x220b0f,_0x299f77,!![]);}catch(_0x3e9a23){return BPromise[_0xa4da('0x20')](_0x3e9a23);}return _0x220b0f[_0xa4da('0x21')]();};}function saveUpdates(_0x5db264,_0x476d0b){return function(_0x26ea53){if(_0x26ea53){return _0x26ea53[_0xa4da('0x22')](_0x5db264)[_0xa4da('0x23')](function(_0x3c39aa){return _0x3c39aa;});}return null;};}function removeEntity(_0x5048bf,_0x483d2e){return function(_0x5d574c){if(_0x5d574c){return _0x5d574c[_0xa4da('0x24')]()[_0xa4da('0x23')](function(){_0x5048bf[_0xa4da('0x18')](0xcc)[_0xa4da('0x17')]();});}};}function handleEntityNotFound(_0xcdba80,_0x2641e9){return function(_0x584a16){if(!_0x584a16){_0xcdba80[_0xa4da('0x25')](0x194);}return _0x584a16;};}function handleError(_0x333aa6,_0x6fa27b){_0x6fa27b=_0x6fa27b||0x1f4;return function(_0x559d2c){logger[_0xa4da('0x26')](_0x559d2c[_0xa4da('0x27')]);if(_0x559d2c[_0xa4da('0x28')]){delete _0x559d2c[_0xa4da('0x28')];}_0x333aa6[_0xa4da('0x18')](_0x6fa27b)['send'](_0x559d2c);};}exports[_0xa4da('0x29')]=function(_0x55da7f,_0x57958d){var _0x46c9ec={},_0x33211a={},_0xe1a7b6={'count':0x0,'rows':[]};var _0x261559=_[_0xa4da('0x2a')](db[_0xa4da('0x2b')]['rawAttributes'],function(_0x1f7ed){return{'name':_0x1f7ed[_0xa4da('0x2c')],'type':_0x1f7ed['type'][_0xa4da('0x2d')]};});_0x33211a[_0xa4da('0x2e')]=_[_0xa4da('0x2a')](_0x261559,_0xa4da('0x28'));_0x33211a['query']=_[_0xa4da('0x2f')](_0x55da7f[_0xa4da('0x30')]);_0x33211a[_0xa4da('0x31')]=_['intersection'](_0x33211a[_0xa4da('0x2e')],_0x33211a[_0xa4da('0x30')]);_0x46c9ec[_0xa4da('0x32')]=_[_0xa4da('0x33')](_0x33211a[_0xa4da('0x2e')],qs[_0xa4da('0x34')](_0x55da7f[_0xa4da('0x30')][_0xa4da('0x34')]));_0x46c9ec[_0xa4da('0x32')]=_0x46c9ec[_0xa4da('0x32')]['length']?_0x46c9ec['attributes']:_0x33211a[_0xa4da('0x2e')];if(!_0x55da7f[_0xa4da('0x30')][_0xa4da('0x35')]('nolimit')){_0x46c9ec[_0xa4da('0x1b')]=qs[_0xa4da('0x1b')](_0x55da7f['query'][_0xa4da('0x1b')]);_0x46c9ec[_0xa4da('0x1d')]=qs[_0xa4da('0x1d')](_0x55da7f['query']['offset']);}_0x46c9ec[_0xa4da('0x36')]=qs[_0xa4da('0x37')](_0x55da7f[_0xa4da('0x30')][_0xa4da('0x37')]);_0x46c9ec[_0xa4da('0x38')]=qs[_0xa4da('0x31')](_[_0xa4da('0x39')](_0x55da7f[_0xa4da('0x30')],_0x33211a['filters']),_0x261559);if(_0x55da7f[_0xa4da('0x30')]['filter']){_0x46c9ec[_0xa4da('0x38')]=_['merge'](_0x46c9ec[_0xa4da('0x38')],{'$or':_[_0xa4da('0x2a')](_0x261559,function(_0x40ad4f){if(_0x40ad4f[_0xa4da('0x3a')]!==_0xa4da('0x3b')){var _0x217fed={};_0x217fed[_0x40ad4f[_0xa4da('0x28')]]={'$like':'%'+_0x55da7f[_0xa4da('0x30')][_0xa4da('0x3c')]+'%'};return _0x217fed;}})});}_0x46c9ec=_['merge']({},_0x46c9ec,_0x55da7f[_0xa4da('0x3d')]);var _0x47470d={'where':_0x46c9ec[_0xa4da('0x38')]};return db[_0xa4da('0x2b')]['count'](_0x47470d)['then'](function(_0x397706){_0xe1a7b6[_0xa4da('0x1c')]=_0x397706;if(_0x55da7f[_0xa4da('0x30')][_0xa4da('0x3e')]){_0x46c9ec['include']=[{'all':!![]}];}return db[_0xa4da('0x2b')]['findAll'](_0x46c9ec);})[_0xa4da('0x23')](function(_0x501cb5){_0xe1a7b6[_0xa4da('0x3f')]=_0x501cb5;return _0xe1a7b6;})[_0xa4da('0x23')](respondWithFilteredResult(_0x57958d,_0x46c9ec))[_0xa4da('0x40')](handleError(_0x57958d,null));};exports[_0xa4da('0x41')]=function(_0x2a079b,_0x402eec){var _0x56c9f2={'raw':!![],'where':{'id':_0x2a079b[_0xa4da('0x42')]['id']}},_0x589dce={};_0x589dce[_0xa4da('0x2e')]=_[_0xa4da('0x2f')](db[_0xa4da('0x2b')][_0xa4da('0x43')]);_0x589dce['query']=_[_0xa4da('0x2f')](_0x2a079b[_0xa4da('0x30')]);_0x589dce[_0xa4da('0x31')]=_[_0xa4da('0x33')](_0x589dce[_0xa4da('0x2e')],_0x589dce[_0xa4da('0x30')]);_0x56c9f2[_0xa4da('0x32')]=_[_0xa4da('0x33')](_0x589dce['model'],qs[_0xa4da('0x34')](_0x2a079b[_0xa4da('0x30')][_0xa4da('0x34')]));_0x56c9f2[_0xa4da('0x32')]=_0x56c9f2[_0xa4da('0x32')][_0xa4da('0x44')]?_0x56c9f2[_0xa4da('0x32')]:_0x589dce[_0xa4da('0x2e')];if(_0x2a079b[_0xa4da('0x30')][_0xa4da('0x3e')]){_0x56c9f2[_0xa4da('0x45')]=[{'all':!![]}];}_0x56c9f2=_[_0xa4da('0x46')]({},_0x56c9f2,_0x2a079b['options']);return db[_0xa4da('0x2b')][_0xa4da('0x47')](_0x56c9f2)[_0xa4da('0x23')](handleEntityNotFound(_0x402eec,null))['then'](respondWithResult(_0x402eec,null))[_0xa4da('0x40')](handleError(_0x402eec,null));};exports[_0xa4da('0x48')]=function(_0x5cd5ce,_0xe68a12){return db[_0xa4da('0x2b')][_0xa4da('0x48')](_0x5cd5ce['body'],{})[_0xa4da('0x23')](respondWithResult(_0xe68a12,0xc9))['catch'](handleError(_0xe68a12,null));};exports[_0xa4da('0x22')]=function(_0x309acd,_0x1c62f2){if(_0x309acd[_0xa4da('0x49')]['id']){delete _0x309acd[_0xa4da('0x49')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x309acd[_0xa4da('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c62f2,null))[_0xa4da('0x23')](saveUpdates(_0x309acd[_0xa4da('0x49')],null))[_0xa4da('0x23')](respondWithResult(_0x1c62f2,null))[_0xa4da('0x40')](handleError(_0x1c62f2,null));};exports['destroy']=function(_0x520033,_0x136842){return db[_0xa4da('0x2b')]['find']({'where':{'id':_0x520033[_0xa4da('0x42')]['id']}})['then'](handleEntityNotFound(_0x136842,null))[_0xa4da('0x23')](removeEntity(_0x136842,null))[_0xa4da('0x40')](handleError(_0x136842,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6056b26..f539d07 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 _0x21e9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x2f4e94,_0x4011ef){var _0x541c1e=function(_0x225349){while(--_0x225349){_0x2f4e94['push'](_0x2f4e94['shift']());}};_0x541c1e(++_0x4011ef);}(_0x21e9,0x157));var _0x921e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x21e9[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x921e('0x0'));var util=require(_0x921e('0x1'));var logger=require('../../config/logger')(_0x921e('0x2'));var moment=require(_0x921e('0x3'));var BPromise=require(_0x921e('0x4'));var rp=require(_0x921e('0x5'));var fs=require('fs');var path=require(_0x921e('0x6'));var rimraf=require(_0x921e('0x7'));var config=require(_0x921e('0x8'));var attributes=require('./intVtigerField.attributes');module[_0x921e('0x9')]=function(_0x426456,_0x272413){return _0x426456[_0x921e('0xa')](_0x921e('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x921e('0xc'),'fields':[_0x921e('0xd'),_0x921e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x754d=['./intVtigerField.attributes','exports','define','VtigerField','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x754d,0xd2));var _0xd754=function(_0x1c24cb,_0x584b42){_0x1c24cb=_0x1c24cb-0x0;var _0x5d40ca=_0x754d[_0x1c24cb];return _0x5d40ca;};'use strict';var _=require(_0xd754('0x0'));var util=require('util');var logger=require(_0xd754('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd754('0x2'));var rp=require(_0xd754('0x3'));var fs=require('fs');var path=require(_0xd754('0x4'));var rimraf=require('rimraf');var config=require(_0xd754('0x5'));var attributes=require(_0xd754('0x6'));module[_0xd754('0x7')]=function(_0xc0a94d,_0x19338b){return _0xc0a94d[_0xd754('0x8')](_0xd754('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xd754('0xa'),_0xd754('0xb')],'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 a7de3fc..5544a48 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 _0xdbdc=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','error','code','message','VtigerField,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xdbdc,0x169));var _0xcdbd=function(_0x4d8a7f,_0xaa9ffa){_0x4d8a7f=_0x4d8a7f-0x0;var _0x2eeb32=_0xdbdc[_0x4d8a7f];return _0x2eeb32;};'use strict';var _=require(_0xcdbd('0x0'));var util=require(_0xcdbd('0x1'));var moment=require(_0xcdbd('0x2'));var BPromise=require('bluebird');var rs=require(_0xcdbd('0x3'));var fs=require('fs');var Redis=require(_0xcdbd('0x4'));var db=require(_0xcdbd('0x5'))['db'];var utils=require(_0xcdbd('0x6'));var logger=require(_0xcdbd('0x7'))('rpc');var config=require(_0xcdbd('0x8'));var jayson=require(_0xcdbd('0x9'));var client=jayson[_0xcdbd('0xa')][_0xcdbd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28e501,_0x255d45,_0x640821){return new BPromise(function(_0x5406d7,_0x39ead4){return client[_0xcdbd('0xc')](_0x28e501,_0x640821)[_0xcdbd('0xd')](function(_0x140617){logger[_0xcdbd('0xe')]('VtigerField,\x20%s,\x20%s',_0x255d45,'request\x20sent');logger[_0xcdbd('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x255d45,'request\x20sent',JSON['stringify'](_0x140617));if(_0x140617[_0xcdbd('0x10')]){if(_0x140617[_0xcdbd('0x10')][_0xcdbd('0x11')]===0x1f4){logger[_0xcdbd('0x10')]('VtigerField,\x20%s,\x20%s',_0x255d45,_0x140617[_0xcdbd('0x10')][_0xcdbd('0x12')]);return _0x39ead4(_0x140617['error'][_0xcdbd('0x12')]);}logger[_0xcdbd('0x10')](_0xcdbd('0x13'),_0x255d45,_0x140617[_0xcdbd('0x10')][_0xcdbd('0x12')]);return _0x5406d7(_0x140617['error'][_0xcdbd('0x12')]);}else{logger[_0xcdbd('0xe')](_0xcdbd('0x13'),_0x255d45,_0xcdbd('0x14'));_0x5406d7(_0x140617[_0xcdbd('0x15')]['message']);}})[_0xcdbd('0x16')](function(_0x829a79){logger[_0xcdbd('0x10')](_0xcdbd('0x13'),_0x255d45,_0x829a79);_0x39ead4(_0x829a79);});});} \ No newline at end of file +var _0x2aa4=['then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xe37f58,_0x1a167b){var _0x4dfcef=function(_0x3395b8){while(--_0x3395b8){_0xe37f58['push'](_0xe37f58['shift']());}};_0x4dfcef(++_0x1a167b);}(_0x2aa4,0x1ae));var _0x42aa=function(_0x41a27c,_0x36da07){_0x41a27c=_0x41a27c-0x0;var _0x234aab=_0x2aa4[_0x41a27c];return _0x234aab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x42aa('0x0'));var BPromise=require('bluebird');var rs=require(_0x42aa('0x1'));var fs=require('fs');var Redis=require(_0x42aa('0x2'));var db=require(_0x42aa('0x3'))['db'];var utils=require(_0x42aa('0x4'));var logger=require(_0x42aa('0x5'))(_0x42aa('0x6'));var config=require(_0x42aa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x42aa('0x8')][_0x42aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11360c,_0x699560,_0x5bfb70){return new BPromise(function(_0x35cb91,_0x6e5bd6){return client['request'](_0x11360c,_0x5bfb70)[_0x42aa('0xa')](function(_0x3b1f5d){logger[_0x42aa('0xb')](_0x42aa('0xc'),_0x699560,'request\x20sent');logger[_0x42aa('0xd')](_0x42aa('0xe'),_0x699560,_0x42aa('0xf'),JSON[_0x42aa('0x10')](_0x3b1f5d));if(_0x3b1f5d[_0x42aa('0x11')]){if(_0x3b1f5d[_0x42aa('0x11')][_0x42aa('0x12')]===0x1f4){logger['error'](_0x42aa('0xc'),_0x699560,_0x3b1f5d[_0x42aa('0x11')]['message']);return _0x6e5bd6(_0x3b1f5d[_0x42aa('0x11')][_0x42aa('0x13')]);}logger[_0x42aa('0x11')](_0x42aa('0xc'),_0x699560,_0x3b1f5d['error'][_0x42aa('0x13')]);return _0x35cb91(_0x3b1f5d['error']['message']);}else{logger['info'](_0x42aa('0xc'),_0x699560,_0x42aa('0xf'));_0x35cb91(_0x3b1f5d[_0x42aa('0x14')][_0x42aa('0x13')]);}})[_0x42aa('0x15')](function(_0x1ea07d){logger['error'](_0x42aa('0xc'),_0x699560,_0x1ea07d);_0x6e5bd6(_0x1ea07d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index a723cd6..054a231 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 _0xada4=['../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','index','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x49445b,_0x69e25d){var _0x11279c=function(_0x42eed7){while(--_0x42eed7){_0x49445b['push'](_0x49445b['shift']());}};_0x11279c(++_0x69e25d);}(_0xada4,0x1bc));var _0x4ada=function(_0x1b397b,_0x23264f){_0x1b397b=_0x1b397b-0x0;var _0x26b4f4=_0xada4[_0x1b397b];return _0x26b4f4;};'use strict';var multer=require('multer');var util=require(_0x4ada('0x0'));var path=require(_0x4ada('0x1'));var timeout=require(_0x4ada('0x2'));var express=require(_0x4ada('0x3'));var router=express[_0x4ada('0x4')]();var fs_extra=require(_0x4ada('0x5'));var auth=require(_0x4ada('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4ada('0x7'));var controller=require(_0x4ada('0x8'));router[_0x4ada('0x9')]('/',auth['isAuthenticated'](),controller[_0x4ada('0xa')]);router[_0x4ada('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4ada('0xb')]);router['get'](_0x4ada('0xc'),auth[_0x4ada('0xd')](),controller[_0x4ada('0xe')]);router[_0x4ada('0x9')](_0x4ada('0xf'),auth[_0x4ada('0xd')](),controller[_0x4ada('0x10')]);router['post']('/',auth[_0x4ada('0xd')](),controller['create']);router[_0x4ada('0x11')](_0x4ada('0xc'),auth[_0x4ada('0xd')](),controller[_0x4ada('0x12')]);router[_0x4ada('0x13')](_0x4ada('0x14'),auth[_0x4ada('0xd')](),controller[_0x4ada('0x15')]);router[_0x4ada('0x16')](_0x4ada('0x14'),auth[_0x4ada('0xd')](),controller[_0x4ada('0x17')]);module[_0x4ada('0x18')]=router; \ No newline at end of file +var _0xb98d=['destroy','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','delete'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0xb98d,0x1c9));var _0xdb98=function(_0xc6d32b,_0x608367){_0xc6d32b=_0xc6d32b-0x0;var _0x5d773a=_0xb98d[_0xc6d32b];return _0x5d773a;};'use strict';var multer=require('multer');var util=require(_0xdb98('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdb98('0x1'));var router=express[_0xdb98('0x2')]();var fs_extra=require(_0xdb98('0x3'));var auth=require(_0xdb98('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdb98('0x5'));var controller=require('./intZendeskAccount.controller');router[_0xdb98('0x6')]('/',auth[_0xdb98('0x7')](),controller[_0xdb98('0x8')]);router[_0xdb98('0x6')](_0xdb98('0x9'),auth[_0xdb98('0x7')](),controller['show']);router[_0xdb98('0x6')](_0xdb98('0xa'),auth[_0xdb98('0x7')](),controller['getConfigurations']);router[_0xdb98('0x6')](_0xdb98('0xb'),auth[_0xdb98('0x7')](),controller[_0xdb98('0xc')]);router[_0xdb98('0xd')]('/',auth[_0xdb98('0x7')](),controller[_0xdb98('0xe')]);router[_0xdb98('0xd')]('/:id/configurations',auth[_0xdb98('0x7')](),controller[_0xdb98('0xf')]);router[_0xdb98('0x10')]('/:id',auth[_0xdb98('0x7')](),controller['update']);router[_0xdb98('0x11')]('/:id',auth[_0xdb98('0x7')](),controller[_0xdb98('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index ad8e940..d2e4210 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 _0x8458=['username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','STRING'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x8458,0x1a5));var _0x8845=function(_0x360aa2,_0x460823){_0x360aa2=_0x360aa2-0x0;var _0x1baaea=_0x8458[_0x360aa2];return _0x1baaea;};'use strict';var Sequelize=require(_0x8845('0x0'));module['exports']={'name':{'type':Sequelize[_0x8845('0x1')]},'description':{'type':Sequelize[_0x8845('0x1')]},'username':{'type':Sequelize[_0x8845('0x1')],'unique':_0x8845('0x2')},'password':{'type':Sequelize[_0x8845('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8845('0x1')],'unique':_0x8845('0x3')},'authType':{'type':Sequelize[_0x8845('0x4')](_0x8845('0x5'),_0x8845('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x8845('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8845('0x7'),_0x8845('0x8')),'defaultValue':_0x8845('0x7')}}; \ No newline at end of file +var _0x11c8=['password','token','ENUM','integrationTab','newTab','exports','STRING','username','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x11c8,0x19a));var _0x811c=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x11c8[_0x277107];return _0x1da046;};'use strict';var Sequelize=require('sequelize');module[_0x811c('0x0')]={'name':{'type':Sequelize[_0x811c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x811c('0x1')],'unique':_0x811c('0x2')},'password':{'type':Sequelize[_0x811c('0x1')]},'token':{'type':Sequelize[_0x811c('0x1')]},'remoteUri':{'type':Sequelize[_0x811c('0x1')],'unique':_0x811c('0x3')},'authType':{'type':Sequelize['ENUM'](_0x811c('0x4'),_0x811c('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x811c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x811c('0x6')](_0x811c('0x7'),_0x811c('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6864767..07508be 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 _0xf4eb=['includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields','stringify','send','Wrong\x20credentials','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','catch','show','params','find','create','body','getConfigurations','order','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskConfiguration','ZendeskField','findOne','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','token','ValidationError','description','assignee','remove','ticket_fields'];(function(_0x26b538,_0x154d6c){var _0x5e8bda=function(_0x57f32a){while(--_0x57f32a){_0x26b538['push'](_0x26b538['shift']());}};_0x5e8bda(++_0x154d6c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1ece1f,_0x2e4749){_0x1ece1f=_0x1ece1f-0x0;var _0x523e86=_0xf4eb[_0x1ece1f];return _0x523e86;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbf4e('0x13'));function respondWithStatusCode(_0x5a3035,_0x56d185){_0x56d185=_0x56d185||0xcc;return function(_0x209b25){if(_0x209b25){return _0x5a3035[_0xbf4e('0x14')](_0x56d185);}return _0x5a3035[_0xbf4e('0x15')](_0x56d185)[_0xbf4e('0x16')]();};}function respondWithResult(_0x3b74bd,_0x61bd54){_0x61bd54=_0x61bd54||0xc8;return function(_0x4984b4){if(_0x4984b4){return _0x3b74bd['status'](_0x61bd54)[_0xbf4e('0x17')](_0x4984b4);}};}function respondWithFilteredResult(_0x1735ae,_0x28fc6b){return function(_0x542909){if(_0x542909){var _0x14110b=typeof _0x28fc6b[_0xbf4e('0x18')]===_0xbf4e('0x19')&&typeof _0x28fc6b[_0xbf4e('0x1a')]==='undefined';var _0x247322=_0x542909['count'];var _0x5db03f=_0x14110b?0x0:_0x28fc6b['offset'];var _0x4f8762=_0x14110b?_0x542909[_0xbf4e('0x1b')]:_0x28fc6b[_0xbf4e('0x18')]+_0x28fc6b[_0xbf4e('0x1a')];var _0x4d9c2a;if(_0x4f8762>=_0x247322){_0x4f8762=_0x247322;_0x4d9c2a=0xc8;}else{_0x4d9c2a=0xce;}_0x1735ae['status'](_0x4d9c2a);return _0x1735ae[_0xbf4e('0x1c')](_0xbf4e('0x1d'),_0x5db03f+'-'+_0x4f8762+'/'+_0x247322)[_0xbf4e('0x17')](_0x542909);}return null;};}function patchUpdates(_0x3a875b){return function(_0x344727){try{jsonpatch[_0xbf4e('0x1e')](_0x344727,_0x3a875b,!![]);}catch(_0x415963){return BPromise[_0xbf4e('0x1f')](_0x415963);}return _0x344727[_0xbf4e('0x20')]();};}function saveUpdates(_0x376832,_0x30539b){return function(_0x59bd84){if(_0x59bd84){return _0x59bd84[_0xbf4e('0x21')](_0x376832)[_0xbf4e('0x22')](function(_0x51648c){return _0x51648c;});}return null;};}function removeEntity(_0x31e3f5,_0x30994d){return function(_0x114412){if(_0x114412){return _0x114412[_0xbf4e('0x23')]()[_0xbf4e('0x22')](function(){_0x31e3f5['status'](0xcc)[_0xbf4e('0x16')]();});}};}function handleEntityNotFound(_0x36688a,_0x3d6863){return function(_0x5766d4){if(!_0x5766d4){_0x36688a[_0xbf4e('0x14')](0x194);}return _0x5766d4;};}function handleError(_0x5e08b1,_0x5bcf71){_0x5bcf71=_0x5bcf71||0x1f4;return function(_0x2bfccf){logger['error'](_0x2bfccf[_0xbf4e('0x24')]);if(_0x2bfccf[_0xbf4e('0x25')]){delete _0x2bfccf[_0xbf4e('0x25')];}_0x5e08b1[_0xbf4e('0x15')](_0x5bcf71)['send'](_0x2bfccf);};}exports[_0xbf4e('0x26')]=function(_0x8e0ab5,_0x43879d){var _0x4cd4a1={},_0x681c3b={},_0x590c85={'count':0x0,'rows':[]};var _0x1dfa81=_[_0xbf4e('0x27')](db[_0xbf4e('0x28')]['rawAttributes'],function(_0x1d12e2){return{'name':_0x1d12e2[_0xbf4e('0x29')],'type':_0x1d12e2[_0xbf4e('0x2a')][_0xbf4e('0x2b')]};});_0x681c3b[_0xbf4e('0x2c')]=_[_0xbf4e('0x27')](_0x1dfa81,'name');_0x681c3b[_0xbf4e('0x2d')]=_[_0xbf4e('0x2e')](_0x8e0ab5['query']);_0x681c3b[_0xbf4e('0x2f')]=_[_0xbf4e('0x30')](_0x681c3b['model'],_0x681c3b[_0xbf4e('0x2d')]);_0x4cd4a1['attributes']=_[_0xbf4e('0x30')](_0x681c3b['model'],qs[_0xbf4e('0x31')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x31')]));_0x4cd4a1['attributes']=_0x4cd4a1[_0xbf4e('0x32')][_0xbf4e('0x33')]?_0x4cd4a1[_0xbf4e('0x32')]:_0x681c3b[_0xbf4e('0x2c')];if(!_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x34')]('nolimit')){_0x4cd4a1[_0xbf4e('0x1a')]=qs[_0xbf4e('0x1a')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x1a')]);_0x4cd4a1[_0xbf4e('0x18')]=qs['offset'](_0x8e0ab5['query']['offset']);}_0x4cd4a1['order']=qs[_0xbf4e('0x35')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x35')]);_0x4cd4a1[_0xbf4e('0x36')]=qs[_0xbf4e('0x2f')](_[_0xbf4e('0x37')](_0x8e0ab5[_0xbf4e('0x2d')],_0x681c3b[_0xbf4e('0x2f')]),_0x1dfa81);if(_0x8e0ab5[_0xbf4e('0x2d')]['filter']){_0x4cd4a1['where']=_[_0xbf4e('0x38')](_0x4cd4a1[_0xbf4e('0x36')],{'$or':_[_0xbf4e('0x27')](_0x1dfa81,function(_0x4ae676){if(_0x4ae676[_0xbf4e('0x2a')]!=='VIRTUAL'){var _0x370d90={};_0x370d90[_0x4ae676[_0xbf4e('0x25')]]={'$like':'%'+_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x39')]+'%'};return _0x370d90;}})});}_0x4cd4a1=_['merge']({},_0x4cd4a1,_0x8e0ab5[_0xbf4e('0x3a')]);var _0x78ab2d={'where':_0x4cd4a1[_0xbf4e('0x36')]};return db[_0xbf4e('0x28')]['count'](_0x78ab2d)[_0xbf4e('0x22')](function(_0x44e96b){_0x590c85[_0xbf4e('0x1b')]=_0x44e96b;if(_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x3b')]){_0x4cd4a1[_0xbf4e('0x3c')]=[{'all':!![]}];}return db[_0xbf4e('0x28')]['findAll'](_0x4cd4a1);})[_0xbf4e('0x22')](function(_0x7b3a94){_0x590c85['rows']=_0x7b3a94;return _0x590c85;})['then'](respondWithFilteredResult(_0x43879d,_0x4cd4a1))[_0xbf4e('0x3d')](handleError(_0x43879d,null));};exports[_0xbf4e('0x3e')]=function(_0x495e53,_0x5bfc4d){var _0x2b1bf4={'raw':![],'where':{'id':_0x495e53[_0xbf4e('0x3f')]['id']}},_0x150224={};_0x150224[_0xbf4e('0x2c')]=_[_0xbf4e('0x2e')](db[_0xbf4e('0x28')]['rawAttributes']);_0x150224[_0xbf4e('0x2d')]=_[_0xbf4e('0x2e')](_0x495e53['query']);_0x150224['filters']=_['intersection'](_0x150224['model'],_0x150224[_0xbf4e('0x2d')]);_0x2b1bf4['attributes']=_[_0xbf4e('0x30')](_0x150224[_0xbf4e('0x2c')],qs['fields'](_0x495e53['query'][_0xbf4e('0x31')]));_0x2b1bf4[_0xbf4e('0x32')]=_0x2b1bf4[_0xbf4e('0x32')][_0xbf4e('0x33')]?_0x2b1bf4[_0xbf4e('0x32')]:_0x150224['model'];if(_0x495e53[_0xbf4e('0x2d')][_0xbf4e('0x3b')]){_0x2b1bf4[_0xbf4e('0x3c')]=[{'all':!![]}];}_0x2b1bf4=_[_0xbf4e('0x38')]({},_0x2b1bf4,_0x495e53[_0xbf4e('0x3a')]);return db[_0xbf4e('0x28')][_0xbf4e('0x40')](_0x2b1bf4)[_0xbf4e('0x22')](handleEntityNotFound(_0x5bfc4d,null))['then'](respondWithResult(_0x5bfc4d,null))[_0xbf4e('0x3d')](handleError(_0x5bfc4d,null));};exports[_0xbf4e('0x41')]=function(_0x1833c1,_0x32bed6){return db[_0xbf4e('0x28')][_0xbf4e('0x41')](_0x1833c1[_0xbf4e('0x42')],{})[_0xbf4e('0x22')](respondWithResult(_0x32bed6,0xc9))[_0xbf4e('0x3d')](handleError(_0x32bed6,null));};exports[_0xbf4e('0x21')]=function(_0x2fdba9,_0x6fd78d){if(_0x2fdba9[_0xbf4e('0x42')]['id']){delete _0x2fdba9[_0xbf4e('0x42')]['id'];}return db[_0xbf4e('0x28')][_0xbf4e('0x40')]({'where':{'id':_0x2fdba9[_0xbf4e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x6fd78d,null))[_0xbf4e('0x22')](saveUpdates(_0x2fdba9[_0xbf4e('0x42')],null))[_0xbf4e('0x22')](respondWithResult(_0x6fd78d,null))['catch'](handleError(_0x6fd78d,null));};exports[_0xbf4e('0x23')]=function(_0x5ed838,_0x4a050e){return db[_0xbf4e('0x28')][_0xbf4e('0x40')]({'where':{'id':_0x5ed838['params']['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x4a050e,null))[_0xbf4e('0x22')](removeEntity(_0x4a050e,null))[_0xbf4e('0x3d')](handleError(_0x4a050e,null));};exports[_0xbf4e('0x43')]=function(_0x42eef6,_0x2ac2c8,_0x419969){var _0x1cdd8c={};var _0x3cd61b={};var _0xc058e1;var _0x271ad2;return db['ZendeskAccount']['findOne']({'where':{'id':_0x42eef6[_0xbf4e('0x3f')]['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x2ac2c8,null))[_0xbf4e('0x22')](function(_0x586f5d){if(_0x586f5d){_0xc058e1=_0x586f5d;_0x3cd61b[_0xbf4e('0x2c')]=_[_0xbf4e('0x2e')](db['ZendeskConfiguration']['rawAttributes']);_0x3cd61b[_0xbf4e('0x2d')]=_['keys'](_0x42eef6['query']);_0x3cd61b[_0xbf4e('0x2f')]=_[_0xbf4e('0x30')](_0x3cd61b[_0xbf4e('0x2c')],_0x3cd61b[_0xbf4e('0x2d')]);_0x1cdd8c[_0xbf4e('0x32')]=_['intersection'](_0x3cd61b[_0xbf4e('0x2c')],qs['fields'](_0x42eef6[_0xbf4e('0x2d')]['fields']));_0x1cdd8c[_0xbf4e('0x32')]=_0x1cdd8c['attributes'][_0xbf4e('0x33')]?_0x1cdd8c[_0xbf4e('0x32')]:_0x3cd61b[_0xbf4e('0x2c')];_0x1cdd8c[_0xbf4e('0x44')]=qs[_0xbf4e('0x35')](_0x42eef6['query']['sort']);_0x1cdd8c['where']=qs['filters'](_[_0xbf4e('0x37')](_0x42eef6[_0xbf4e('0x2d')],_0x3cd61b['filters']));if(_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x39')]){_0x1cdd8c[_0xbf4e('0x36')]=_[_0xbf4e('0x38')](_0x1cdd8c[_0xbf4e('0x36')],{'$or':_[_0xbf4e('0x27')](_0x1cdd8c[_0xbf4e('0x32')],function(_0x48682c){var _0x25c254={};_0x25c254[_0x48682c]={'$like':'%'+_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x39')]+'%'};return _0x25c254;})});}_0x1cdd8c=_['merge']({},_0x1cdd8c,_0x42eef6['options']);return _0xc058e1[_0xbf4e('0x43')](_0x1cdd8c);}})[_0xbf4e('0x22')](function(_0x2e8a62){if(_0x2e8a62){_0x271ad2=_0x2e8a62['length'];if(!_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x34')](_0xbf4e('0x45'))){_0x1cdd8c[_0xbf4e('0x1a')]=qs[_0xbf4e('0x1a')](_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x1a')]);_0x1cdd8c[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x18')]);}return _0xc058e1[_0xbf4e('0x43')](_0x1cdd8c);}})['then'](function(_0x21cbd2){if(_0x21cbd2){return _0x21cbd2?{'count':_0x271ad2,'rows':_0x21cbd2}:null;}})['then'](respondWithResult(_0x2ac2c8,null))[_0xbf4e('0x3d')](handleError(_0x2ac2c8,null));};exports[_0xbf4e('0x46')]=function(_0x400fa5,_0x180b13,_0x2080ec){if(_0x400fa5[_0xbf4e('0x42')]['id']){delete _0x400fa5[_0xbf4e('0x42')]['id'];}return db[_0xbf4e('0x28')]['findOne']({'where':{'id':_0x400fa5[_0xbf4e('0x3f')]['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x180b13,null))[_0xbf4e('0x22')](function(_0x33f9c4){if(_0x33f9c4){_0x400fa5[_0xbf4e('0x42')]['AccountId']=_0x33f9c4['id'];_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x47')]=integrations[_0xbf4e('0x48')](_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x49')],_0x400fa5[_0xbf4e('0x42')]['type']);_0x400fa5[_0xbf4e('0x42')]['Descriptions']=integrations[_0xbf4e('0x4a')](_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x49')],_0x400fa5[_0xbf4e('0x42')]['type']);return db[_0xbf4e('0x4b')]['create'](_0x400fa5['body'],{'include':[{'model':db[_0xbf4e('0x4c')],'as':_0xbf4e('0x47')},{'model':db[_0xbf4e('0x4c')],'as':'Descriptions'}]});}return null;})[_0xbf4e('0x22')](respondWithResult(_0x180b13,null))[_0xbf4e('0x3d')](handleError(_0x180b13,null));};exports['getFields']=function(_0x19c5b4,_0x42df5f,_0x4405b9){var _0x137224='';return db[_0xbf4e('0x28')][_0xbf4e('0x4d')]({'where':{'id':_0x19c5b4[_0xbf4e('0x3f')]['id']},'attributes':['id',_0xbf4e('0x4e'),_0xbf4e('0x4f'),'token',_0xbf4e('0x50'),_0xbf4e('0x51')]})[_0xbf4e('0x22')](handleEntityNotFound(_0x42df5f,null))[_0xbf4e('0x22')](function(_0x54f450){if(_0x54f450){_0x137224=_0x54f450[_0xbf4e('0x51')];var _0x667836=_0x137224[_0xbf4e('0x52')](-0x1);if(_0x667836==='/'){_0x137224=_0x137224[_0xbf4e('0x53')](0x0,_0x137224[_0xbf4e('0x54')](_0x667836));}var _0x3448f5={'method':_0xbf4e('0x55'),'uri':util[_0xbf4e('0x56')](_0xbf4e('0x57'),_0x137224,'ticket_fields'),'json':!![]};switch(_0x54f450[_0xbf4e('0x50')]){case'password':_0x3448f5[_0xbf4e('0x58')]={'Authorization':util[_0xbf4e('0x56')](_0xbf4e('0x59'),new Buffer(util[_0xbf4e('0x56')](_0xbf4e('0x5a'),_0x54f450['username'],_0x54f450[_0xbf4e('0x4f')]))[_0xbf4e('0x5b')](_0xbf4e('0x5c')))};break;case'token':_0x3448f5[_0xbf4e('0x58')]={'Authorization':util[_0xbf4e('0x56')](_0xbf4e('0x59'),new Buffer(util['format'](_0xbf4e('0x5d'),_0x54f450[_0xbf4e('0x4e')],_0x54f450[_0xbf4e('0x5e')]))[_0xbf4e('0x5b')](_0xbf4e('0x5c')))};break;default:throw new db['Sequelize'][(_0xbf4e('0x5f'))]('Unknown\x20authentication\x20type');}return rp(_0x3448f5);}})[_0xbf4e('0x22')](function(_0x504723){if(_0x504723){var _0x19a7e9=['subject',_0xbf4e('0x60'),'group',_0xbf4e('0x61')];_[_0xbf4e('0x62')](_0x504723[_0xbf4e('0x63')],function(_0x23de82){return _0x19a7e9[_0xbf4e('0x64')](_0x23de82[_0xbf4e('0x2a')]);});return{'count':_0x504723[_0xbf4e('0x63')]['length'],'rows':_[_0xbf4e('0x27')](_0x504723[_0xbf4e('0x63')],function(_0x2a242b){return{'id':_0x2a242b['id'],'name':_0x2a242b[_0xbf4e('0x65')]>0x7?_0x2a242b[_0xbf4e('0x66')]:_0x2a242b[_0xbf4e('0x2a')],'custom':_0x2a242b['position']>0x7?!![]:![],'options':_0x2a242b[_0xbf4e('0x67')]?_0x2a242b[_0xbf4e('0x67')]:_0x2a242b['custom_field_options']?_0x2a242b[_0xbf4e('0x68')]:[]};})};}})[_0xbf4e('0x22')](respondWithResult(_0x42df5f,null))[_0xbf4e('0x3d')](function(_0xb6d122){var _0x19ec7e=_0x19c5b4[_0xbf4e('0x2d')][_0xbf4e('0x69')]?0x1f4:_0xb6d122[_0xbf4e('0x6a')]||0x1f4;logger[_0xbf4e('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0xbf4e('0x6c'),_0x19ec7e,JSON[_0xbf4e('0x6d')](_0xb6d122));delete _0xb6d122[_0xbf4e('0x25')];if(_0x19ec7e===0x191){_0x19ec7e=0x190;}_0x42df5f['status'](_0x19ec7e)[_0xbf4e('0x6e')](_0x19c5b4[_0xbf4e('0x2d')]['test']?{'message':_0xbf4e('0x6f'),'statusCode':_0xb6d122[_0xbf4e('0x6a')]}:_0xb6d122);});}; \ No newline at end of file +var _0x2547=['Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','system_field_options','custom_field_options','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','ZendeskAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','create','catch','body','find','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','%s/token:%s'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x2547,0x1cd));var _0x7254=function(_0x51edde,_0x3407bd){_0x51edde=_0x51edde-0x0;var _0x58e667=_0x2547[_0x51edde];return _0x58e667;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16c08e,_0x2bfff8){_0x2bfff8=_0x2bfff8||0xcc;return function(_0x348d4e){if(_0x348d4e){return _0x16c08e[_0x7254('0x17')](_0x2bfff8);}return _0x16c08e[_0x7254('0x18')](_0x2bfff8)[_0x7254('0x19')]();};}function respondWithResult(_0x124192,_0x21cecc){_0x21cecc=_0x21cecc||0xc8;return function(_0x1625ea){if(_0x1625ea){return _0x124192[_0x7254('0x18')](_0x21cecc)[_0x7254('0x1a')](_0x1625ea);}};}function respondWithFilteredResult(_0x1ee5cb,_0x163c8c){return function(_0x535065){if(_0x535065){var _0x265293=typeof _0x163c8c[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x163c8c[_0x7254('0x1d')]===_0x7254('0x1c');var _0x1e4aff=_0x535065[_0x7254('0x1e')];var _0x5dd23b=_0x265293?0x0:_0x163c8c[_0x7254('0x1b')];var _0x2283b7=_0x265293?_0x535065[_0x7254('0x1e')]:_0x163c8c[_0x7254('0x1b')]+_0x163c8c[_0x7254('0x1d')];var _0x301f00;if(_0x2283b7>=_0x1e4aff){_0x2283b7=_0x1e4aff;_0x301f00=0xc8;}else{_0x301f00=0xce;}_0x1ee5cb[_0x7254('0x18')](_0x301f00);return _0x1ee5cb[_0x7254('0x1f')](_0x7254('0x20'),_0x5dd23b+'-'+_0x2283b7+'/'+_0x1e4aff)[_0x7254('0x1a')](_0x535065);}return null;};}function patchUpdates(_0x2594b8){return function(_0x24bc73){try{jsonpatch[_0x7254('0x21')](_0x24bc73,_0x2594b8,!![]);}catch(_0x41ef72){return BPromise[_0x7254('0x22')](_0x41ef72);}return _0x24bc73[_0x7254('0x23')]();};}function saveUpdates(_0x2bb2fe,_0x46c0a2){return function(_0x195fd2){if(_0x195fd2){return _0x195fd2[_0x7254('0x24')](_0x2bb2fe)[_0x7254('0x25')](function(_0x50c34b){return _0x50c34b;});}return null;};}function removeEntity(_0x493bfd,_0x136ea3){return function(_0xd91c1f){if(_0xd91c1f){return _0xd91c1f[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x493bfd[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x133aee,_0x5d6df5){return function(_0x133287){if(!_0x133287){_0x133aee[_0x7254('0x17')](0x194);}return _0x133287;};}function handleError(_0x2b4f46,_0x494cdb){_0x494cdb=_0x494cdb||0x1f4;return function(_0x3c22d0){logger['error'](_0x3c22d0[_0x7254('0x27')]);if(_0x3c22d0[_0x7254('0x28')]){delete _0x3c22d0['name'];}_0x2b4f46[_0x7254('0x18')](_0x494cdb)[_0x7254('0x29')](_0x3c22d0);};}exports['index']=function(_0x14cbea,_0x6c4927){var _0x37cb5c={},_0xb9198b={},_0x43bf02={'count':0x0,'rows':[]};var _0xfe02ea=_['map'](db[_0x7254('0x2a')][_0x7254('0x2b')],function(_0x5569be){return{'name':_0x5569be[_0x7254('0x2c')],'type':_0x5569be[_0x7254('0x2d')][_0x7254('0x2e')]};});_0xb9198b['model']=_[_0x7254('0x2f')](_0xfe02ea,_0x7254('0x28'));_0xb9198b[_0x7254('0x30')]=_[_0x7254('0x31')](_0x14cbea[_0x7254('0x30')]);_0xb9198b[_0x7254('0x32')]=_[_0x7254('0x33')](_0xb9198b['model'],_0xb9198b[_0x7254('0x30')]);_0x37cb5c['attributes']=_['intersection'](_0xb9198b[_0x7254('0x34')],qs[_0x7254('0x35')](_0x14cbea[_0x7254('0x30')][_0x7254('0x35')]));_0x37cb5c[_0x7254('0x36')]=_0x37cb5c[_0x7254('0x36')][_0x7254('0x37')]?_0x37cb5c[_0x7254('0x36')]:_0xb9198b[_0x7254('0x34')];if(!_0x14cbea[_0x7254('0x30')][_0x7254('0x38')](_0x7254('0x39'))){_0x37cb5c[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x14cbea['query'][_0x7254('0x1d')]);_0x37cb5c[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x14cbea[_0x7254('0x30')][_0x7254('0x1b')]);}_0x37cb5c['order']=qs[_0x7254('0x3a')](_0x14cbea['query'][_0x7254('0x3a')]);_0x37cb5c[_0x7254('0x3b')]=qs[_0x7254('0x32')](_[_0x7254('0x3c')](_0x14cbea[_0x7254('0x30')],_0xb9198b['filters']),_0xfe02ea);if(_0x14cbea[_0x7254('0x30')]['filter']){_0x37cb5c[_0x7254('0x3b')]=_[_0x7254('0x3d')](_0x37cb5c['where'],{'$or':_[_0x7254('0x2f')](_0xfe02ea,function(_0x3c5bf4){if(_0x3c5bf4[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x14b625={};_0x14b625[_0x3c5bf4[_0x7254('0x28')]]={'$like':'%'+_0x14cbea['query'][_0x7254('0x3f')]+'%'};return _0x14b625;}})});}_0x37cb5c=_[_0x7254('0x3d')]({},_0x37cb5c,_0x14cbea[_0x7254('0x40')]);var _0x4eca7a={'where':_0x37cb5c[_0x7254('0x3b')]};return db[_0x7254('0x2a')][_0x7254('0x1e')](_0x4eca7a)['then'](function(_0xc09711){_0x43bf02[_0x7254('0x1e')]=_0xc09711;if(_0x14cbea[_0x7254('0x30')][_0x7254('0x41')]){_0x37cb5c[_0x7254('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x37cb5c);})[_0x7254('0x25')](function(_0x17bc29){_0x43bf02[_0x7254('0x43')]=_0x17bc29;return _0x43bf02;})[_0x7254('0x25')](respondWithFilteredResult(_0x6c4927,_0x37cb5c))['catch'](handleError(_0x6c4927,null));};exports['show']=function(_0x29821a,_0x565cd8){var _0x2ae22e={'raw':![],'where':{'id':_0x29821a[_0x7254('0x44')]['id']}},_0x3187b0={};_0x3187b0[_0x7254('0x34')]=_['keys'](db['ZendeskAccount'][_0x7254('0x2b')]);_0x3187b0[_0x7254('0x30')]=_[_0x7254('0x31')](_0x29821a[_0x7254('0x30')]);_0x3187b0[_0x7254('0x32')]=_['intersection'](_0x3187b0['model'],_0x3187b0[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x36')]=_[_0x7254('0x33')](_0x3187b0['model'],qs[_0x7254('0x35')](_0x29821a[_0x7254('0x30')]['fields']));_0x2ae22e[_0x7254('0x36')]=_0x2ae22e[_0x7254('0x36')][_0x7254('0x37')]?_0x2ae22e[_0x7254('0x36')]:_0x3187b0['model'];if(_0x29821a[_0x7254('0x30')][_0x7254('0x41')]){_0x2ae22e['include']=[{'all':!![]}];}_0x2ae22e=_[_0x7254('0x3d')]({},_0x2ae22e,_0x29821a[_0x7254('0x40')]);return db[_0x7254('0x2a')]['find'](_0x2ae22e)[_0x7254('0x25')](handleEntityNotFound(_0x565cd8,null))[_0x7254('0x25')](respondWithResult(_0x565cd8,null))['catch'](handleError(_0x565cd8,null));};exports['create']=function(_0x10b32f,_0x54c792){return db[_0x7254('0x2a')][_0x7254('0x45')](_0x10b32f['body'],{})['then'](respondWithResult(_0x54c792,0xc9))[_0x7254('0x46')](handleError(_0x54c792,null));};exports[_0x7254('0x24')]=function(_0x38bcd5,_0x104d98){if(_0x38bcd5[_0x7254('0x47')]['id']){delete _0x38bcd5[_0x7254('0x47')]['id'];}return db['ZendeskAccount'][_0x7254('0x48')]({'where':{'id':_0x38bcd5['params']['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x104d98,null))[_0x7254('0x25')](saveUpdates(_0x38bcd5[_0x7254('0x47')],null))['then'](respondWithResult(_0x104d98,null))[_0x7254('0x46')](handleError(_0x104d98,null));};exports[_0x7254('0x26')]=function(_0x252758,_0x5b3b6e){return db[_0x7254('0x2a')][_0x7254('0x48')]({'where':{'id':_0x252758[_0x7254('0x44')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x5b3b6e,null))[_0x7254('0x25')](removeEntity(_0x5b3b6e,null))['catch'](handleError(_0x5b3b6e,null));};exports['getConfigurations']=function(_0x24c532,_0x2cb7cd,_0x441d23){var _0x10e1cb={};var _0x3b0002={};var _0x4c6838;var _0x5a44fb;return db[_0x7254('0x2a')][_0x7254('0x49')]({'where':{'id':_0x24c532[_0x7254('0x44')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x2cb7cd,null))['then'](function(_0xaf6d3d){if(_0xaf6d3d){_0x4c6838=_0xaf6d3d;_0x3b0002[_0x7254('0x34')]=_['keys'](db[_0x7254('0x4a')]['rawAttributes']);_0x3b0002[_0x7254('0x30')]=_['keys'](_0x24c532[_0x7254('0x30')]);_0x3b0002['filters']=_['intersection'](_0x3b0002[_0x7254('0x34')],_0x3b0002[_0x7254('0x30')]);_0x10e1cb[_0x7254('0x36')]=_[_0x7254('0x33')](_0x3b0002['model'],qs[_0x7254('0x35')](_0x24c532['query'][_0x7254('0x35')]));_0x10e1cb[_0x7254('0x36')]=_0x10e1cb[_0x7254('0x36')][_0x7254('0x37')]?_0x10e1cb[_0x7254('0x36')]:_0x3b0002[_0x7254('0x34')];_0x10e1cb['order']=qs[_0x7254('0x3a')](_0x24c532[_0x7254('0x30')][_0x7254('0x3a')]);_0x10e1cb[_0x7254('0x3b')]=qs[_0x7254('0x32')](_[_0x7254('0x3c')](_0x24c532['query'],_0x3b0002[_0x7254('0x32')]));if(_0x24c532[_0x7254('0x30')][_0x7254('0x3f')]){_0x10e1cb[_0x7254('0x3b')]=_[_0x7254('0x3d')](_0x10e1cb[_0x7254('0x3b')],{'$or':_[_0x7254('0x2f')](_0x10e1cb['attributes'],function(_0x5dd108){var _0xac4d0={};_0xac4d0[_0x5dd108]={'$like':'%'+_0x24c532['query']['filter']+'%'};return _0xac4d0;})});}_0x10e1cb=_[_0x7254('0x3d')]({},_0x10e1cb,_0x24c532[_0x7254('0x40')]);return _0x4c6838[_0x7254('0x4b')](_0x10e1cb);}})['then'](function(_0x1821f0){if(_0x1821f0){_0x5a44fb=_0x1821f0['length'];if(!_0x24c532[_0x7254('0x30')][_0x7254('0x38')](_0x7254('0x39'))){_0x10e1cb[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x24c532['query'][_0x7254('0x1d')]);_0x10e1cb[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x24c532[_0x7254('0x30')]['offset']);}return _0x4c6838['getConfigurations'](_0x10e1cb);}})[_0x7254('0x25')](function(_0x41355e){if(_0x41355e){return _0x41355e?{'count':_0x5a44fb,'rows':_0x41355e}:null;}})[_0x7254('0x25')](respondWithResult(_0x2cb7cd,null))[_0x7254('0x46')](handleError(_0x2cb7cd,null));};exports[_0x7254('0x4c')]=function(_0x1cf028,_0x464680,_0x38cba1){if(_0x1cf028[_0x7254('0x47')]['id']){delete _0x1cf028[_0x7254('0x47')]['id'];}return db[_0x7254('0x2a')][_0x7254('0x49')]({'where':{'id':_0x1cf028[_0x7254('0x44')]['id']}})['then'](handleEntityNotFound(_0x464680,null))[_0x7254('0x25')](function(_0x4716a2){if(_0x4716a2){_0x1cf028[_0x7254('0x47')]['AccountId']=_0x4716a2['id'];_0x1cf028[_0x7254('0x47')][_0x7254('0x4d')]=integrations[_0x7254('0x4e')](_0x1cf028[_0x7254('0x47')]['channel'],_0x1cf028[_0x7254('0x47')]['type']);_0x1cf028[_0x7254('0x47')][_0x7254('0x4f')]=integrations[_0x7254('0x50')](_0x1cf028[_0x7254('0x47')]['channel'],_0x1cf028[_0x7254('0x47')]['type']);return db[_0x7254('0x4a')]['create'](_0x1cf028[_0x7254('0x47')],{'include':[{'model':db[_0x7254('0x51')],'as':_0x7254('0x4d')},{'model':db[_0x7254('0x51')],'as':_0x7254('0x4f')}]});}return null;})[_0x7254('0x25')](respondWithResult(_0x464680,null))[_0x7254('0x46')](handleError(_0x464680,null));};exports[_0x7254('0x52')]=function(_0x4e07c6,_0x37562a,_0x57c0a0){var _0x12c36e='';return db[_0x7254('0x2a')][_0x7254('0x49')]({'where':{'id':_0x4e07c6[_0x7254('0x44')]['id']},'attributes':['id',_0x7254('0x53'),_0x7254('0x54'),_0x7254('0x55'),_0x7254('0x56'),'remoteUri']})[_0x7254('0x25')](handleEntityNotFound(_0x37562a,null))['then'](function(_0x231184){if(_0x231184){_0x12c36e=_0x231184[_0x7254('0x57')];var _0x2399ef=_0x12c36e[_0x7254('0x58')](-0x1);if(_0x2399ef==='/'){_0x12c36e=_0x12c36e[_0x7254('0x59')](0x0,_0x12c36e[_0x7254('0x5a')](_0x2399ef));}var _0xb65570={'method':_0x7254('0x5b'),'uri':util[_0x7254('0x5c')](_0x7254('0x5d'),_0x12c36e,_0x7254('0x5e')),'json':!![]};switch(_0x231184[_0x7254('0x56')]){case _0x7254('0x54'):_0xb65570[_0x7254('0x5f')]={'Authorization':util[_0x7254('0x5c')](_0x7254('0x60'),new Buffer(util[_0x7254('0x5c')]('%s:%s',_0x231184['username'],_0x231184[_0x7254('0x54')]))[_0x7254('0x61')]('base64'))};break;case'token':_0xb65570['headers']={'Authorization':util[_0x7254('0x5c')](_0x7254('0x60'),new Buffer(util[_0x7254('0x5c')](_0x7254('0x62'),_0x231184['username'],_0x231184[_0x7254('0x55')]))[_0x7254('0x61')]('base64'))};break;default:throw new db[(_0x7254('0x63'))][(_0x7254('0x64'))](_0x7254('0x65'));}return rp(_0xb65570);}})['then'](function(_0x4aa036){if(_0x4aa036){var _0x220066=[_0x7254('0x66'),'description',_0x7254('0x67'),_0x7254('0x68')];_[_0x7254('0x69')](_0x4aa036[_0x7254('0x5e')],function(_0x24fcb1){return _0x220066['includes'](_0x24fcb1[_0x7254('0x2d')]);});return{'count':_0x4aa036[_0x7254('0x5e')][_0x7254('0x37')],'rows':_['map'](_0x4aa036[_0x7254('0x5e')],function(_0x4cf18d){return{'id':_0x4cf18d['id'],'name':_0x4cf18d['position']>0x7?_0x4cf18d['title']:_0x4cf18d[_0x7254('0x2d')],'custom':_0x4cf18d['position']>0x7?!![]:![],'options':_0x4cf18d['system_field_options']?_0x4cf18d[_0x7254('0x6a')]:_0x4cf18d[_0x7254('0x6b')]?_0x4cf18d[_0x7254('0x6b')]:[]};})};}})['then'](respondWithResult(_0x37562a,null))[_0x7254('0x46')](function(_0x5a0c41){var _0x175379=_0x4e07c6[_0x7254('0x30')]['test']?0x1f4:_0x5a0c41[_0x7254('0x6c')]||0x1f4;logger[_0x7254('0x6d')](_0x7254('0x6e'),_0x7254('0x52'),_0x175379,JSON[_0x7254('0x6f')](_0x5a0c41));delete _0x5a0c41[_0x7254('0x28')];if(_0x175379===0x191){_0x175379=0x190;}_0x37562a[_0x7254('0x18')](_0x175379)['send'](_0x4e07c6[_0x7254('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5a0c41[_0x7254('0x6c')]}:_0x5a0c41);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1ce64f2..e3c5b0f 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 _0xb34f=['define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x43a5f6,_0x109266){var _0x1f4696=function(_0x2f9ca5){while(--_0x2f9ca5){_0x43a5f6['push'](_0x43a5f6['shift']());}};_0x1f4696(++_0x109266);}(_0xb34f,0x102));var _0xfb34=function(_0xc30893,_0x1fe502){_0xc30893=_0xc30893-0x0;var _0x3c9b36=_0xb34f[_0xc30893];return _0x3c9b36;};'use strict';var _=require('lodash');var util=require(_0xfb34('0x0'));var logger=require(_0xfb34('0x1'))(_0xfb34('0x2'));var moment=require(_0xfb34('0x3'));var BPromise=require(_0xfb34('0x4'));var rp=require(_0xfb34('0x5'));var fs=require('fs');var path=require(_0xfb34('0x6'));var rimraf=require(_0xfb34('0x7'));var config=require(_0xfb34('0x8'));var attributes=require(_0xfb34('0x9'));var integrations=require(_0xfb34('0xa'));module[_0xfb34('0xb')]=function(_0x30ca32,_0x316117){return _0x30ca32[_0xfb34('0xc')](_0xfb34('0xd'),attributes,{'tableName':_0xfb34('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80f4=['int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','ZendeskAccount'];(function(_0x1de071,_0x265dd2){var _0x4f08bc=function(_0x2682e4){while(--_0x2682e4){_0x1de071['push'](_0x1de071['shift']());}};_0x4f08bc(++_0x265dd2);}(_0x80f4,0xaa));var _0x480f=function(_0x2bb6dd,_0x252667){_0x2bb6dd=_0x2bb6dd-0x0;var _0x2a07dc=_0x80f4[_0x2bb6dd];return _0x2a07dc;};'use strict';var _=require(_0x480f('0x0'));var util=require(_0x480f('0x1'));var logger=require(_0x480f('0x2'))(_0x480f('0x3'));var moment=require(_0x480f('0x4'));var BPromise=require(_0x480f('0x5'));var rp=require(_0x480f('0x6'));var fs=require('fs');var path=require(_0x480f('0x7'));var rimraf=require(_0x480f('0x8'));var config=require(_0x480f('0x9'));var attributes=require(_0x480f('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x49cde5,_0x555afe){return _0x49cde5['define'](_0x480f('0xb'),attributes,{'tableName':_0x480f('0xc'),'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 4277e92..35a41a0 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 _0xd2a4=['http','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','ShowZendeskAccount','find','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a8f25,_0x20781f){var _0xf17419=function(_0x2cc1f8){while(--_0x2cc1f8){_0x4a8f25['push'](_0x4a8f25['shift']());}};_0xf17419(++_0x20781f);}(_0xd2a4,0x142));var _0x4d2a=function(_0x3e055f,_0x1dbfd2){_0x3e055f=_0x3e055f-0x0;var _0x392a0a=_0xd2a4[_0x3e055f];return _0x392a0a;};'use strict';var _=require(_0x4d2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4d2a('0x1'));var rs=require(_0x4d2a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d2a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d2a('0x4'));var config=require(_0x4d2a('0x5'));var jayson=require(_0x4d2a('0x6'));var client=jayson[_0x4d2a('0x7')][_0x4d2a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d43ef,_0x3f09da,_0x12c47b){return new BPromise(function(_0x425e11,_0x9ed399){return client[_0x4d2a('0x9')](_0x1d43ef,_0x12c47b)[_0x4d2a('0xa')](function(_0x19e70c){logger[_0x4d2a('0xb')](_0x4d2a('0xc'),_0x3f09da,'request\x20sent');logger['debug'](_0x4d2a('0xd'),_0x3f09da,_0x4d2a('0xe'),JSON['stringify'](_0x19e70c));if(_0x19e70c[_0x4d2a('0xf')]){if(_0x19e70c[_0x4d2a('0xf')][_0x4d2a('0x10')]===0x1f4){logger[_0x4d2a('0xf')](_0x4d2a('0xc'),_0x3f09da,_0x19e70c['error']['message']);return _0x9ed399(_0x19e70c['error'][_0x4d2a('0x11')]);}logger[_0x4d2a('0xf')](_0x4d2a('0xc'),_0x3f09da,_0x19e70c[_0x4d2a('0xf')][_0x4d2a('0x11')]);return _0x425e11(_0x19e70c[_0x4d2a('0xf')][_0x4d2a('0x11')]);}else{logger[_0x4d2a('0xb')](_0x4d2a('0xc'),_0x3f09da,_0x4d2a('0xe'));_0x425e11(_0x19e70c['result'][_0x4d2a('0x11')]);}})['catch'](function(_0x2dcc71){logger[_0x4d2a('0xf')](_0x4d2a('0xc'),_0x3f09da,_0x2dcc71);_0x9ed399(_0x2dcc71);});});}exports[_0x4d2a('0x12')]=function(_0x1d4396){var _0x2cc4bb=this;return new Promise(function(_0x5235db,_0x5e8b72){return db[_0x4d2a('0x13')][_0x4d2a('0x14')]({'raw':_0x1d4396[_0x4d2a('0x15')]?_0x1d4396[_0x4d2a('0x15')][_0x4d2a('0x16')]===undefined?!![]:![]:!![],'where':_0x1d4396['options']?_0x1d4396['options']['where']||null:null,'attributes':_0x1d4396[_0x4d2a('0x15')]?_0x1d4396[_0x4d2a('0x15')][_0x4d2a('0x17')]||null:null,'limit':_0x1d4396['options']?_0x1d4396[_0x4d2a('0x15')][_0x4d2a('0x18')]||null:null,'include':_0x1d4396[_0x4d2a('0x15')]?_0x1d4396['options'][_0x4d2a('0x19')]?_[_0x4d2a('0x1a')](_0x1d4396[_0x4d2a('0x15')]['include'],function(_0x6ed8ab){return{'model':db[_0x6ed8ab['model']],'as':_0x6ed8ab['as'],'attributes':_0x6ed8ab[_0x4d2a('0x17')],'include':_0x6ed8ab[_0x4d2a('0x19')]?_['map'](_0x6ed8ab[_0x4d2a('0x19')],function(_0xfc463){return{'model':db[_0xfc463['model']],'as':_0xfc463['as'],'attributes':_0xfc463[_0x4d2a('0x17')],'include':_0xfc463['include']?_[_0x4d2a('0x1a')](_0xfc463['include'],function(_0x8f9207){return{'model':db[_0x8f9207[_0x4d2a('0x1b')]],'as':_0x8f9207['as'],'attributes':_0x8f9207['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x543c7b){logger[_0x4d2a('0xb')]('GetZendeskAccount',_0x1d4396);logger[_0x4d2a('0x1c')](_0x4d2a('0x12'),_0x1d4396,JSON[_0x4d2a('0x1d')](_0x543c7b));_0x5235db(_0x543c7b);})['catch'](function(_0x140dcf){logger['error'](_0x4d2a('0x12'),_0x140dcf[_0x4d2a('0x11')],_0x1d4396);_0x5e8b72(_0x2cc4bb[_0x4d2a('0xf')](0x1f4,_0x140dcf['message']));});});};exports[_0x4d2a('0x1e')]=function(_0x534108){var _0x552b51=this;return new Promise(function(_0x7dd616,_0x4fbcb5){return db['ZendeskAccount'][_0x4d2a('0x1f')]({'raw':_0x534108[_0x4d2a('0x15')]?_0x534108['options'][_0x4d2a('0x16')]===undefined?!![]:![]:!![],'where':_0x534108[_0x4d2a('0x15')]?_0x534108['options']['where']||null:null,'attributes':_0x534108[_0x4d2a('0x15')]?_0x534108[_0x4d2a('0x15')][_0x4d2a('0x17')]||null:null,'include':_0x534108[_0x4d2a('0x15')]?_0x534108[_0x4d2a('0x15')][_0x4d2a('0x19')]?_[_0x4d2a('0x1a')](_0x534108['options'][_0x4d2a('0x19')],function(_0x2d725e){return{'model':db[_0x2d725e[_0x4d2a('0x1b')]],'as':_0x2d725e['as'],'attributes':_0x2d725e[_0x4d2a('0x17')],'include':_0x2d725e[_0x4d2a('0x19')]?_[_0x4d2a('0x1a')](_0x2d725e[_0x4d2a('0x19')],function(_0x4f4f81){return{'model':db[_0x4f4f81[_0x4d2a('0x1b')]],'as':_0x4f4f81['as'],'attributes':_0x4f4f81[_0x4d2a('0x17')],'include':_0x4f4f81['include']?_[_0x4d2a('0x1a')](_0x4f4f81['include'],function(_0x59e427){return{'model':db[_0x59e427[_0x4d2a('0x1b')]],'as':_0x59e427['as'],'attributes':_0x59e427['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d2a('0xa')](function(_0x144960){logger[_0x4d2a('0xb')]('ShowZendeskAccount',_0x534108);logger[_0x4d2a('0x1c')](_0x4d2a('0x1e'),_0x534108,JSON[_0x4d2a('0x1d')](_0x144960));_0x7dd616(_0x144960);})[_0x4d2a('0x20')](function(_0x438182){logger['error'](_0x4d2a('0x1e'),_0x438182['message'],_0x534108);_0x4fbcb5(_0x552b51[_0x4d2a('0xf')](0x1f4,_0x438182['message']));});});}; \ No newline at end of file +var _0x280b=['code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','model','attributes','map','ShowZendeskAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x56427c,_0x2135ea){var _0x37f0db=function(_0x3dae3f){while(--_0x3dae3f){_0x56427c['push'](_0x56427c['shift']());}};_0x37f0db(++_0x2135ea);}(_0x280b,0xc0));var _0xb280=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x280b[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xb280('0x0'));var util=require(_0xb280('0x1'));var moment=require(_0xb280('0x2'));var BPromise=require(_0xb280('0x3'));var rs=require(_0xb280('0x4'));var fs=require('fs');var Redis=require(_0xb280('0x5'));var db=require(_0xb280('0x6'))['db'];var utils=require(_0xb280('0x7'));var logger=require(_0xb280('0x8'))(_0xb280('0x9'));var config=require(_0xb280('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb280('0xb')][_0xb280('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x329681,_0x391ee4,_0x33dcbe){return new BPromise(function(_0x17fa97,_0x2f7cdb){return client['request'](_0x329681,_0x33dcbe)['then'](function(_0xb10a99){logger[_0xb280('0xd')](_0xb280('0xe'),_0x391ee4,'request\x20sent');logger[_0xb280('0xf')](_0xb280('0x10'),_0x391ee4,'request\x20sent',JSON['stringify'](_0xb10a99));if(_0xb10a99[_0xb280('0x11')]){if(_0xb10a99[_0xb280('0x11')][_0xb280('0x12')]===0x1f4){logger[_0xb280('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x391ee4,_0xb10a99[_0xb280('0x11')]['message']);return _0x2f7cdb(_0xb10a99['error'][_0xb280('0x13')]);}logger[_0xb280('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x391ee4,_0xb10a99['error'][_0xb280('0x13')]);return _0x17fa97(_0xb10a99[_0xb280('0x11')][_0xb280('0x13')]);}else{logger[_0xb280('0xd')](_0xb280('0xe'),_0x391ee4,'request\x20sent');_0x17fa97(_0xb10a99['result'][_0xb280('0x13')]);}})[_0xb280('0x14')](function(_0x3d7d22){logger[_0xb280('0x11')](_0xb280('0xe'),_0x391ee4,_0x3d7d22);_0x2f7cdb(_0x3d7d22);});});}exports[_0xb280('0x15')]=function(_0x127f1c){var _0x320c06=this;return new Promise(function(_0x4d9603,_0x2447b8){return db[_0xb280('0x16')][_0xb280('0x17')]({'raw':_0x127f1c['options']?_0x127f1c[_0xb280('0x18')][_0xb280('0x19')]===undefined?!![]:![]:!![],'where':_0x127f1c['options']?_0x127f1c[_0xb280('0x18')][_0xb280('0x1a')]||null:null,'attributes':_0x127f1c[_0xb280('0x18')]?_0x127f1c[_0xb280('0x18')]['attributes']||null:null,'limit':_0x127f1c[_0xb280('0x18')]?_0x127f1c[_0xb280('0x18')][_0xb280('0x1b')]||null:null,'include':_0x127f1c[_0xb280('0x18')]?_0x127f1c[_0xb280('0x18')][_0xb280('0x1c')]?_['map'](_0x127f1c[_0xb280('0x18')][_0xb280('0x1c')],function(_0x584b2b){return{'model':db[_0x584b2b[_0xb280('0x1d')]],'as':_0x584b2b['as'],'attributes':_0x584b2b[_0xb280('0x1e')],'include':_0x584b2b['include']?_[_0xb280('0x1f')](_0x584b2b[_0xb280('0x1c')],function(_0x389dfe){return{'model':db[_0x389dfe[_0xb280('0x1d')]],'as':_0x389dfe['as'],'attributes':_0x389dfe['attributes'],'include':_0x389dfe[_0xb280('0x1c')]?_[_0xb280('0x1f')](_0x389dfe[_0xb280('0x1c')],function(_0x400d15){return{'model':db[_0x400d15[_0xb280('0x1d')]],'as':_0x400d15['as'],'attributes':_0x400d15['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6f1a2c){logger[_0xb280('0xd')]('GetZendeskAccount',_0x127f1c);logger[_0xb280('0xf')](_0xb280('0x15'),_0x127f1c,JSON['stringify'](_0x6f1a2c));_0x4d9603(_0x6f1a2c);})[_0xb280('0x14')](function(_0x48246e){logger[_0xb280('0x11')]('GetZendeskAccount',_0x48246e['message'],_0x127f1c);_0x2447b8(_0x320c06[_0xb280('0x11')](0x1f4,_0x48246e[_0xb280('0x13')]));});});};exports[_0xb280('0x20')]=function(_0x36b0e6){var _0x94b72b=this;return new Promise(function(_0x54618e,_0x58ca55){return db[_0xb280('0x16')][_0xb280('0x21')]({'raw':_0x36b0e6[_0xb280('0x18')]?_0x36b0e6[_0xb280('0x18')][_0xb280('0x19')]===undefined?!![]:![]:!![],'where':_0x36b0e6[_0xb280('0x18')]?_0x36b0e6[_0xb280('0x18')][_0xb280('0x1a')]||null:null,'attributes':_0x36b0e6[_0xb280('0x18')]?_0x36b0e6[_0xb280('0x18')]['attributes']||null:null,'include':_0x36b0e6[_0xb280('0x18')]?_0x36b0e6[_0xb280('0x18')]['include']?_[_0xb280('0x1f')](_0x36b0e6[_0xb280('0x18')][_0xb280('0x1c')],function(_0x4f2127){return{'model':db[_0x4f2127[_0xb280('0x1d')]],'as':_0x4f2127['as'],'attributes':_0x4f2127[_0xb280('0x1e')],'include':_0x4f2127[_0xb280('0x1c')]?_[_0xb280('0x1f')](_0x4f2127[_0xb280('0x1c')],function(_0x2df0de){return{'model':db[_0x2df0de[_0xb280('0x1d')]],'as':_0x2df0de['as'],'attributes':_0x2df0de[_0xb280('0x1e')],'include':_0x2df0de[_0xb280('0x1c')]?_[_0xb280('0x1f')](_0x2df0de[_0xb280('0x1c')],function(_0x5c930f){return{'model':db[_0x5c930f[_0xb280('0x1d')]],'as':_0x5c930f['as'],'attributes':_0x5c930f[_0xb280('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35b390){logger[_0xb280('0xd')](_0xb280('0x20'),_0x36b0e6);logger[_0xb280('0xf')](_0xb280('0x20'),_0x36b0e6,JSON[_0xb280('0x22')](_0x35b390));_0x54618e(_0x35b390);})['catch'](function(_0x5c8928){logger[_0xb280('0x11')]('ShowZendeskAccount',_0x5c8928[_0xb280('0x13')],_0x36b0e6);_0x58ca55(_0x94b72b[_0xb280('0x11')](0x1f4,_0x5c8928[_0xb280('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d2386cc..a48ced2 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 _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x5db8f7,_0x5e239e){var _0x26d30c=function(_0x4c2bfc){while(--_0x4c2bfc){_0x5db8f7['push'](_0x5db8f7['shift']());}};_0x26d30c(++_0x5e239e);}(_0x91a7,0xe7));var _0x791a=function(_0x2e2fda,_0x455065){_0x2e2fda=_0x2e2fda-0x0;var _0xf52075=_0x91a7[_0x2e2fda];return _0xf52075;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file +var _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0xbdb7[_0x26cab7];return _0x31ba06;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('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 85d686f..7533b3b 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 _0x3657=['sequelize','STRING'];(function(_0x2d7958,_0x38bc76){var _0xe1779b=function(_0x7ab51f){while(--_0x7ab51f){_0x2d7958['push'](_0x2d7958['shift']());}};_0xe1779b(++_0x38bc76);}(_0x3657,0x124));var _0x7365=function(_0x53210a,_0x4a49f1){_0x53210a=_0x53210a-0x0;var _0x82411c=_0x3657[_0x53210a];return _0x82411c;};'use strict';var Sequelize=require(_0x7365('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7365('0x1')]}}; \ No newline at end of file +var _0xa5e5=['sequelize','exports','STRING'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0xa5e5,0xf9));var _0x5a5e=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xa5e5[_0x367a3d];return _0x460539;};'use strict';var Sequelize=require(_0x5a5e('0x0'));module[_0x5a5e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5a5e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 3048595..b7b1bb5 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 _0x7e2f=['undefined','count','status','reject','save','then','destroy','error','name','send','index','map','ZendeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','update','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','zip-dir','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset'];(function(_0x180440,_0x3777d8){var _0x151c31=function(_0x293aa2){while(--_0x293aa2){_0x180440['push'](_0x180440['shift']());}};_0x151c31(++_0x3777d8);}(_0x7e2f,0x15d));var _0xf7e2=function(_0x2c4cee,_0xed54d6){_0x2c4cee=_0x2c4cee-0x0;var _0x4cad54=_0x7e2f[_0x2c4cee];return _0x4cad54;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf7e2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7e2('0x1'));var moment=require(_0xf7e2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf7e2('0x3'));var util=require(_0xf7e2('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xf7e2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7e2('0x6'));var _=require(_0xf7e2('0x7'));var squel=require('squel');var crypto=require(_0xf7e2('0x8'));var jsforce=require(_0xf7e2('0x9'));var deskjs=require(_0xf7e2('0xa'));var toCsv=require(_0xf7e2('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf7e2('0xb'));var qs=require(_0xf7e2('0xc'));var as=require(_0xf7e2('0xd'));var hardwareService=require(_0xf7e2('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf7e2('0xf'));var licenseUtil=require(_0xf7e2('0x10'));var db=require(_0xf7e2('0x11'))['db'];function respondWithStatusCode(_0x372a3a,_0x2bb7ad){_0x2bb7ad=_0x2bb7ad||0xcc;return function(_0x47410d){if(_0x47410d){return _0x372a3a[_0xf7e2('0x12')](_0x2bb7ad);}return _0x372a3a['status'](_0x2bb7ad)[_0xf7e2('0x13')]();};}function respondWithResult(_0x4942a8,_0x4391c5){_0x4391c5=_0x4391c5||0xc8;return function(_0x990b3e){if(_0x990b3e){return _0x4942a8['status'](_0x4391c5)['json'](_0x990b3e);}};}function respondWithFilteredResult(_0x1d7ce5,_0x17d4f5){return function(_0x3651a0){if(_0x3651a0){var _0x3292fe=typeof _0x17d4f5[_0xf7e2('0x14')]===_0xf7e2('0x15')&&typeof _0x17d4f5['limit']===_0xf7e2('0x15');var _0x2e1a7e=_0x3651a0[_0xf7e2('0x16')];var _0x556ed0=_0x3292fe?0x0:_0x17d4f5[_0xf7e2('0x14')];var _0x373206=_0x3292fe?_0x3651a0[_0xf7e2('0x16')]:_0x17d4f5[_0xf7e2('0x14')]+_0x17d4f5['limit'];var _0xa61614;if(_0x373206>=_0x2e1a7e){_0x373206=_0x2e1a7e;_0xa61614=0xc8;}else{_0xa61614=0xce;}_0x1d7ce5[_0xf7e2('0x17')](_0xa61614);return _0x1d7ce5['set']('Content-Range',_0x556ed0+'-'+_0x373206+'/'+_0x2e1a7e)['json'](_0x3651a0);}return null;};}function patchUpdates(_0xa0dd22){return function(_0x5bcf8f){try{jsonpatch['apply'](_0x5bcf8f,_0xa0dd22,!![]);}catch(_0x8e10f9){return BPromise[_0xf7e2('0x18')](_0x8e10f9);}return _0x5bcf8f[_0xf7e2('0x19')]();};}function saveUpdates(_0x133291,_0x243b02){return function(_0x25ce06){if(_0x25ce06){return _0x25ce06['update'](_0x133291)[_0xf7e2('0x1a')](function(_0x2412cb){return _0x2412cb;});}return null;};}function removeEntity(_0x2a64e5,_0x1cb9c6){return function(_0x11a35a){if(_0x11a35a){return _0x11a35a[_0xf7e2('0x1b')]()[_0xf7e2('0x1a')](function(){_0x2a64e5[_0xf7e2('0x17')](0xcc)[_0xf7e2('0x13')]();});}};}function handleEntityNotFound(_0x4933ba,_0x47d563){return function(_0x26b9cc){if(!_0x26b9cc){_0x4933ba[_0xf7e2('0x12')](0x194);}return _0x26b9cc;};}function handleError(_0x131b57,_0x5d1057){_0x5d1057=_0x5d1057||0x1f4;return function(_0xa4e899){logger[_0xf7e2('0x1c')](_0xa4e899['stack']);if(_0xa4e899[_0xf7e2('0x1d')]){delete _0xa4e899[_0xf7e2('0x1d')];}_0x131b57[_0xf7e2('0x17')](_0x5d1057)[_0xf7e2('0x1e')](_0xa4e899);};}exports[_0xf7e2('0x1f')]=function(_0xd4b643,_0x529ed4){var _0x30791b={},_0x29b984={},_0x23517c={'count':0x0,'rows':[]};var _0x1fbae4=_[_0xf7e2('0x20')](db[_0xf7e2('0x21')]['rawAttributes'],function(_0x5dac52){return{'name':_0x5dac52[_0xf7e2('0x22')],'type':_0x5dac52[_0xf7e2('0x23')][_0xf7e2('0x24')]};});_0x29b984[_0xf7e2('0x25')]=_[_0xf7e2('0x20')](_0x1fbae4,_0xf7e2('0x1d'));_0x29b984[_0xf7e2('0x26')]=_[_0xf7e2('0x27')](_0xd4b643[_0xf7e2('0x26')]);_0x29b984[_0xf7e2('0x28')]=_[_0xf7e2('0x29')](_0x29b984[_0xf7e2('0x25')],_0x29b984['query']);_0x30791b[_0xf7e2('0x2a')]=_['intersection'](_0x29b984[_0xf7e2('0x25')],qs[_0xf7e2('0x2b')](_0xd4b643['query']['fields']));_0x30791b['attributes']=_0x30791b[_0xf7e2('0x2a')][_0xf7e2('0x2c')]?_0x30791b[_0xf7e2('0x2a')]:_0x29b984[_0xf7e2('0x25')];if(!_0xd4b643[_0xf7e2('0x26')]['hasOwnProperty'](_0xf7e2('0x2d'))){_0x30791b[_0xf7e2('0x2e')]=qs[_0xf7e2('0x2e')](_0xd4b643[_0xf7e2('0x26')][_0xf7e2('0x2e')]);_0x30791b[_0xf7e2('0x14')]=qs['offset'](_0xd4b643[_0xf7e2('0x26')][_0xf7e2('0x14')]);}_0x30791b[_0xf7e2('0x2f')]=qs[_0xf7e2('0x30')](_0xd4b643[_0xf7e2('0x26')][_0xf7e2('0x30')]);_0x30791b[_0xf7e2('0x31')]=qs[_0xf7e2('0x28')](_[_0xf7e2('0x32')](_0xd4b643[_0xf7e2('0x26')],_0x29b984[_0xf7e2('0x28')]),_0x1fbae4);if(_0xd4b643[_0xf7e2('0x26')][_0xf7e2('0x33')]){_0x30791b[_0xf7e2('0x31')]=_[_0xf7e2('0x34')](_0x30791b[_0xf7e2('0x31')],{'$or':_[_0xf7e2('0x20')](_0x1fbae4,function(_0x5ada9b){if(_0x5ada9b[_0xf7e2('0x23')]!==_0xf7e2('0x35')){var _0x174e90={};_0x174e90[_0x5ada9b['name']]={'$like':'%'+_0xd4b643[_0xf7e2('0x26')][_0xf7e2('0x33')]+'%'};return _0x174e90;}})});}_0x30791b=_[_0xf7e2('0x34')]({},_0x30791b,_0xd4b643[_0xf7e2('0x36')]);var _0x40d701={'where':_0x30791b[_0xf7e2('0x31')]};return db[_0xf7e2('0x21')][_0xf7e2('0x16')](_0x40d701)[_0xf7e2('0x1a')](function(_0x166879){_0x23517c[_0xf7e2('0x16')]=_0x166879;if(_0xd4b643[_0xf7e2('0x26')]['includeAll']){_0x30791b[_0xf7e2('0x37')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xf7e2('0x38')](_0x30791b);})[_0xf7e2('0x1a')](function(_0x1117e3){_0x23517c[_0xf7e2('0x39')]=_0x1117e3;return _0x23517c;})[_0xf7e2('0x1a')](respondWithFilteredResult(_0x529ed4,_0x30791b))[_0xf7e2('0x3a')](handleError(_0x529ed4,null));};exports['show']=function(_0x5f580e,_0x437714){var _0x42cc67={'raw':![],'where':{'id':_0x5f580e[_0xf7e2('0x3b')]['id']}},_0x4f529c={};_0x4f529c[_0xf7e2('0x25')]=_['keys'](db['ZendeskConfiguration'][_0xf7e2('0x3c')]);_0x4f529c[_0xf7e2('0x26')]=_[_0xf7e2('0x27')](_0x5f580e[_0xf7e2('0x26')]);_0x4f529c[_0xf7e2('0x28')]=_[_0xf7e2('0x29')](_0x4f529c[_0xf7e2('0x25')],_0x4f529c[_0xf7e2('0x26')]);_0x42cc67[_0xf7e2('0x2a')]=_['intersection'](_0x4f529c[_0xf7e2('0x25')],qs[_0xf7e2('0x2b')](_0x5f580e[_0xf7e2('0x26')][_0xf7e2('0x2b')]));_0x42cc67['attributes']=_0x42cc67[_0xf7e2('0x2a')][_0xf7e2('0x2c')]?_0x42cc67['attributes']:_0x4f529c['model'];if(_0x5f580e[_0xf7e2('0x26')][_0xf7e2('0x3d')]){_0x42cc67[_0xf7e2('0x37')]=[{'all':!![]}];}_0x42cc67=_[_0xf7e2('0x34')]({},_0x42cc67,_0x5f580e['options']);return db['ZendeskConfiguration'][_0xf7e2('0x3e')](_0x42cc67)[_0xf7e2('0x1a')](handleEntityNotFound(_0x437714,null))[_0xf7e2('0x1a')](respondWithResult(_0x437714,null))[_0xf7e2('0x3a')](handleError(_0x437714,null));};exports[_0xf7e2('0x3f')]=function(_0x50f07b,_0x10f6d5){return db[_0xf7e2('0x21')][_0xf7e2('0x3f')](_0x50f07b[_0xf7e2('0x40')],{})[_0xf7e2('0x1a')](respondWithResult(_0x10f6d5,0xc9))[_0xf7e2('0x3a')](handleError(_0x10f6d5,null));};exports[_0xf7e2('0x41')]=function(_0x5b8703,_0x5e8dd1){if(_0x5b8703['body']['id']){delete _0x5b8703[_0xf7e2('0x40')]['id'];}return db[_0xf7e2('0x21')][_0xf7e2('0x3e')]({'where':{'id':_0x5b8703[_0xf7e2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5e8dd1,null))[_0xf7e2('0x1a')](saveUpdates(_0x5b8703[_0xf7e2('0x40')],null))[_0xf7e2('0x1a')](respondWithResult(_0x5e8dd1,null))[_0xf7e2('0x3a')](handleError(_0x5e8dd1,null));};exports[_0xf7e2('0x1b')]=function(_0x57bf3d,_0x48ec9d){return db[_0xf7e2('0x21')][_0xf7e2('0x3e')]({'where':{'id':_0x57bf3d[_0xf7e2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x48ec9d,null))['then'](removeEntity(_0x48ec9d,null))['catch'](handleError(_0x48ec9d,null));};exports[_0xf7e2('0x42')]=function(_0x44dae4,_0x55ae9c,_0x1eb0b6){var _0x1f3a37={};var _0x4aa20c={};var _0x439024;var _0x8451de;return db[_0xf7e2('0x21')][_0xf7e2('0x43')]({'where':{'id':_0x44dae4[_0xf7e2('0x3b')]['id']}})[_0xf7e2('0x1a')](handleEntityNotFound(_0x55ae9c,null))[_0xf7e2('0x1a')](function(_0x42a8d1){if(_0x42a8d1){_0x439024=_0x42a8d1;_0x4aa20c[_0xf7e2('0x25')]=_[_0xf7e2('0x27')](db[_0xf7e2('0x44')][_0xf7e2('0x3c')]);_0x4aa20c[_0xf7e2('0x26')]=_['keys'](_0x44dae4[_0xf7e2('0x26')]);_0x4aa20c[_0xf7e2('0x28')]=_['intersection'](_0x4aa20c[_0xf7e2('0x25')],_0x4aa20c['query']);_0x1f3a37[_0xf7e2('0x2a')]=_[_0xf7e2('0x29')](_0x4aa20c[_0xf7e2('0x25')],qs[_0xf7e2('0x2b')](_0x44dae4['query'][_0xf7e2('0x2b')]));_0x1f3a37[_0xf7e2('0x2a')]=_0x1f3a37[_0xf7e2('0x2a')][_0xf7e2('0x2c')]?_0x1f3a37[_0xf7e2('0x2a')]:_0x4aa20c[_0xf7e2('0x25')];_0x1f3a37[_0xf7e2('0x2f')]=qs[_0xf7e2('0x30')](_0x44dae4['query'][_0xf7e2('0x30')]);_0x1f3a37[_0xf7e2('0x31')]=qs['filters'](_['pick'](_0x44dae4['query'],_0x4aa20c[_0xf7e2('0x28')]));if(_0x44dae4[_0xf7e2('0x26')][_0xf7e2('0x33')]){_0x1f3a37['where']=_[_0xf7e2('0x34')](_0x1f3a37[_0xf7e2('0x31')],{'$or':_[_0xf7e2('0x20')](_0x1f3a37[_0xf7e2('0x2a')],function(_0x43cf38){var _0x2d834e={};_0x2d834e[_0x43cf38]={'$like':'%'+_0x44dae4[_0xf7e2('0x26')][_0xf7e2('0x33')]+'%'};return _0x2d834e;})});}_0x1f3a37=_[_0xf7e2('0x34')]({},_0x1f3a37,_0x44dae4['options']);return _0x439024[_0xf7e2('0x42')](_0x1f3a37);}})[_0xf7e2('0x1a')](function(_0x50f735){if(_0x50f735){_0x8451de=_0x50f735[_0xf7e2('0x2c')];if(!_0x44dae4[_0xf7e2('0x26')][_0xf7e2('0x45')]('nolimit')){_0x1f3a37[_0xf7e2('0x2e')]=qs[_0xf7e2('0x2e')](_0x44dae4[_0xf7e2('0x26')][_0xf7e2('0x2e')]);_0x1f3a37[_0xf7e2('0x14')]=qs[_0xf7e2('0x14')](_0x44dae4[_0xf7e2('0x26')][_0xf7e2('0x14')]);}return _0x439024['getFields'](_0x1f3a37);}})['then'](function(_0x1a85d5){if(_0x1a85d5){return _0x1a85d5?{'count':_0x8451de,'rows':_0x1a85d5}:null;}})[_0xf7e2('0x1a')](respondWithResult(_0x55ae9c,null))[_0xf7e2('0x3a')](handleError(_0x55ae9c,null));};exports['getSubjects']=function(_0x36997f,_0xacb74e,_0x322b11){var _0x4781d3={};var _0x21bdf2={};var _0x4202fa;var _0x726cba;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x36997f[_0xf7e2('0x3b')]['id']}})[_0xf7e2('0x1a')](handleEntityNotFound(_0xacb74e,null))[_0xf7e2('0x1a')](function(_0x471f59){if(_0x471f59){_0x4202fa=_0x471f59;_0x21bdf2['model']=_['keys'](db['ZendeskField'][_0xf7e2('0x3c')]);_0x21bdf2[_0xf7e2('0x26')]=_[_0xf7e2('0x27')](_0x36997f['query']);_0x21bdf2['filters']=_[_0xf7e2('0x29')](_0x21bdf2[_0xf7e2('0x25')],_0x21bdf2[_0xf7e2('0x26')]);_0x4781d3[_0xf7e2('0x2a')]=_[_0xf7e2('0x29')](_0x21bdf2[_0xf7e2('0x25')],qs[_0xf7e2('0x2b')](_0x36997f[_0xf7e2('0x26')][_0xf7e2('0x2b')]));_0x4781d3['attributes']=_0x4781d3[_0xf7e2('0x2a')]['length']?_0x4781d3['attributes']:_0x21bdf2['model'];_0x4781d3[_0xf7e2('0x2f')]=qs[_0xf7e2('0x30')](_0x36997f[_0xf7e2('0x26')][_0xf7e2('0x30')]);_0x4781d3[_0xf7e2('0x31')]=qs[_0xf7e2('0x28')](_[_0xf7e2('0x32')](_0x36997f[_0xf7e2('0x26')],_0x21bdf2['filters']));if(_0x36997f[_0xf7e2('0x26')][_0xf7e2('0x33')]){_0x4781d3[_0xf7e2('0x31')]=_[_0xf7e2('0x34')](_0x4781d3[_0xf7e2('0x31')],{'$or':_[_0xf7e2('0x20')](_0x4781d3[_0xf7e2('0x2a')],function(_0x33552b){var _0x1addb7={};_0x1addb7[_0x33552b]={'$like':'%'+_0x36997f[_0xf7e2('0x26')][_0xf7e2('0x33')]+'%'};return _0x1addb7;})});}_0x4781d3=_[_0xf7e2('0x34')]({},_0x4781d3,_0x36997f[_0xf7e2('0x36')]);return _0x4202fa['getSubjects'](_0x4781d3);}})['then'](function(_0x16b655){if(_0x16b655){_0x726cba=_0x16b655[_0xf7e2('0x2c')];if(!_0x36997f['query'][_0xf7e2('0x45')](_0xf7e2('0x2d'))){_0x4781d3[_0xf7e2('0x2e')]=qs[_0xf7e2('0x2e')](_0x36997f[_0xf7e2('0x26')][_0xf7e2('0x2e')]);_0x4781d3['offset']=qs[_0xf7e2('0x14')](_0x36997f['query'][_0xf7e2('0x14')]);}return _0x4202fa[_0xf7e2('0x46')](_0x4781d3);}})[_0xf7e2('0x1a')](function(_0x54b6d3){if(_0x54b6d3){return _0x54b6d3?{'count':_0x726cba,'rows':_0x54b6d3}:null;}})[_0xf7e2('0x1a')](respondWithResult(_0xacb74e,null))[_0xf7e2('0x3a')](handleError(_0xacb74e,null));};exports[_0xf7e2('0x47')]=function(_0x5e4ab0,_0xd0a642,_0xcb8903){var _0x145753={};var _0x239bee={};var _0x4300f3;var _0x4be0cd;return db[_0xf7e2('0x21')]['findOne']({'where':{'id':_0x5e4ab0[_0xf7e2('0x3b')]['id']}})[_0xf7e2('0x1a')](handleEntityNotFound(_0xd0a642,null))[_0xf7e2('0x1a')](function(_0x1963f4){if(_0x1963f4){_0x4300f3=_0x1963f4;_0x239bee[_0xf7e2('0x25')]=_[_0xf7e2('0x27')](db['ZendeskField'][_0xf7e2('0x3c')]);_0x239bee[_0xf7e2('0x26')]=_[_0xf7e2('0x27')](_0x5e4ab0[_0xf7e2('0x26')]);_0x239bee[_0xf7e2('0x28')]=_[_0xf7e2('0x29')](_0x239bee[_0xf7e2('0x25')],_0x239bee[_0xf7e2('0x26')]);_0x145753['attributes']=_[_0xf7e2('0x29')](_0x239bee[_0xf7e2('0x25')],qs[_0xf7e2('0x2b')](_0x5e4ab0[_0xf7e2('0x26')][_0xf7e2('0x2b')]));_0x145753['attributes']=_0x145753[_0xf7e2('0x2a')]['length']?_0x145753[_0xf7e2('0x2a')]:_0x239bee[_0xf7e2('0x25')];_0x145753[_0xf7e2('0x2f')]=qs[_0xf7e2('0x30')](_0x5e4ab0[_0xf7e2('0x26')][_0xf7e2('0x30')]);_0x145753[_0xf7e2('0x31')]=qs['filters'](_[_0xf7e2('0x32')](_0x5e4ab0[_0xf7e2('0x26')],_0x239bee['filters']));if(_0x5e4ab0[_0xf7e2('0x26')][_0xf7e2('0x33')]){_0x145753['where']=_[_0xf7e2('0x34')](_0x145753[_0xf7e2('0x31')],{'$or':_[_0xf7e2('0x20')](_0x145753[_0xf7e2('0x2a')],function(_0x4d0891){var _0x52a481={};_0x52a481[_0x4d0891]={'$like':'%'+_0x5e4ab0[_0xf7e2('0x26')]['filter']+'%'};return _0x52a481;})});}_0x145753=_['merge']({},_0x145753,_0x5e4ab0[_0xf7e2('0x36')]);return _0x4300f3[_0xf7e2('0x47')](_0x145753);}})[_0xf7e2('0x1a')](function(_0xffdfb1){if(_0xffdfb1){_0x4be0cd=_0xffdfb1[_0xf7e2('0x2c')];if(!_0x5e4ab0[_0xf7e2('0x26')]['hasOwnProperty'](_0xf7e2('0x2d'))){_0x145753[_0xf7e2('0x2e')]=qs[_0xf7e2('0x2e')](_0x5e4ab0[_0xf7e2('0x26')]['limit']);_0x145753[_0xf7e2('0x14')]=qs[_0xf7e2('0x14')](_0x5e4ab0[_0xf7e2('0x26')][_0xf7e2('0x14')]);}return _0x4300f3['getDescriptions'](_0x145753);}})[_0xf7e2('0x1a')](function(_0x29795c){if(_0x29795c){return _0x29795c?{'count':_0x4be0cd,'rows':_0x29795c}:null;}})['then'](respondWithResult(_0xd0a642,null))[_0xf7e2('0x3a')](handleError(_0xd0a642,null));};exports[_0xf7e2('0x48')]=function(_0x3b7a11,_0x2cc3e2,_0x307778){var _0x1f574f={};var _0x416221={};var _0x53cf8e;var _0x19742;return db[_0xf7e2('0x21')][_0xf7e2('0x43')]({'where':{'id':_0x3b7a11[_0xf7e2('0x3b')]['id']}})[_0xf7e2('0x1a')](handleEntityNotFound(_0x2cc3e2,null))['then'](function(_0x43962e){if(_0x43962e){_0x53cf8e=_0x43962e;_0x416221[_0xf7e2('0x25')]=_['keys'](db[_0xf7e2('0x49')][_0xf7e2('0x3c')]);_0x416221[_0xf7e2('0x26')]=_[_0xf7e2('0x27')](_0x3b7a11[_0xf7e2('0x26')]);_0x416221['filters']=_[_0xf7e2('0x29')](_0x416221[_0xf7e2('0x25')],_0x416221['query']);_0x1f574f['attributes']=_['intersection'](_0x416221[_0xf7e2('0x25')],qs['fields'](_0x3b7a11[_0xf7e2('0x26')][_0xf7e2('0x2b')]));_0x1f574f[_0xf7e2('0x2a')]=_0x1f574f['attributes'][_0xf7e2('0x2c')]?_0x1f574f['attributes']:_0x416221['model'];_0x1f574f[_0xf7e2('0x2f')]=qs[_0xf7e2('0x30')](_0x3b7a11[_0xf7e2('0x26')][_0xf7e2('0x30')]);_0x1f574f[_0xf7e2('0x31')]=qs['filters'](_[_0xf7e2('0x32')](_0x3b7a11[_0xf7e2('0x26')],_0x416221[_0xf7e2('0x28')]));if(_0x3b7a11['query']['filter']){_0x1f574f[_0xf7e2('0x31')]=_['merge'](_0x1f574f[_0xf7e2('0x31')],{'$or':_[_0xf7e2('0x20')](_0x1f574f['attributes'],function(_0x438f45){var _0x2afd34={};_0x2afd34[_0x438f45]={'$like':'%'+_0x3b7a11[_0xf7e2('0x26')]['filter']+'%'};return _0x2afd34;})});}_0x1f574f=_[_0xf7e2('0x34')]({},_0x1f574f,_0x3b7a11['options']);return _0x53cf8e[_0xf7e2('0x48')](_0x1f574f);}})[_0xf7e2('0x1a')](function(_0x1100ad){if(_0x1100ad){_0x19742=_0x1100ad[_0xf7e2('0x2c')];if(!_0x3b7a11[_0xf7e2('0x26')]['hasOwnProperty'](_0xf7e2('0x2d'))){_0x1f574f['limit']=qs[_0xf7e2('0x2e')](_0x3b7a11[_0xf7e2('0x26')][_0xf7e2('0x2e')]);_0x1f574f[_0xf7e2('0x14')]=qs[_0xf7e2('0x14')](_0x3b7a11[_0xf7e2('0x26')][_0xf7e2('0x14')]);}return _0x53cf8e[_0xf7e2('0x48')](_0x1f574f);}})[_0xf7e2('0x1a')](function(_0x29542a){if(_0x29542a){return _0x29542a?{'count':_0x19742,'rows':_0x29542a}:null;}})[_0xf7e2('0x1a')](respondWithResult(_0x2cc3e2,null))['catch'](handleError(_0x2cc3e2,null));};exports['setTags']=function(_0x442dd8,_0x136377,_0x5ee186){if(_0x442dd8['body']['id']){delete _0x442dd8[_0xf7e2('0x40')]['id'];}return db[_0xf7e2('0x21')][_0xf7e2('0x43')]({'where':{'id':_0x442dd8[_0xf7e2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x136377,null))[_0xf7e2('0x1a')](function(_0x3be7fc){if(_0x3be7fc){return _0x3be7fc['setTags'](_0x442dd8[_0xf7e2('0x40')]['ids']||[]);}return null;})[_0xf7e2('0x1a')](respondWithResult(_0x136377,null))[_0xf7e2('0x3a')](handleError(_0x136377,null));}; \ No newline at end of file +var _0x3da7=['keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','ZendeskConfiguration','findAll','rows','params','includeAll','merge','find','catch','create','body','findOne','ZendeskField','getFields','length','nolimit','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query'];(function(_0x118a7d,_0xbaae7f){var _0x395545=function(_0x2fd715){while(--_0x2fd715){_0x118a7d['push'](_0x118a7d['shift']());}};_0x395545(++_0xbaae7f);}(_0x3da7,0xc3));var _0x73da=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x3da7[_0x88cd7b];return _0x56fcc8;};'use strict';var emlformat=require(_0x73da('0x0'));var rimraf=require(_0x73da('0x1'));var zipdir=require(_0x73da('0x2'));var jsonpatch=require(_0x73da('0x3'));var rp=require(_0x73da('0x4'));var moment=require(_0x73da('0x5'));var BPromise=require(_0x73da('0x6'));var Mustache=require('mustache');var util=require(_0x73da('0x7'));var path=require(_0x73da('0x8'));var sox=require(_0x73da('0x9'));var csv=require(_0x73da('0xa'));var ejs=require(_0x73da('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x73da('0xc'));var squel=require(_0x73da('0xd'));var crypto=require(_0x73da('0xe'));var jsforce=require(_0x73da('0xf'));var deskjs=require(_0x73da('0x10'));var toCsv=require(_0x73da('0xa'));var querystring=require(_0x73da('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x73da('0x12'));var as=require(_0x73da('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73da('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x73da('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x73da('0x16'))['db'];function respondWithStatusCode(_0x1ce774,_0x32bd31){_0x32bd31=_0x32bd31||0xcc;return function(_0x53bd7d){if(_0x53bd7d){return _0x1ce774['sendStatus'](_0x32bd31);}return _0x1ce774[_0x73da('0x17')](_0x32bd31)[_0x73da('0x18')]();};}function respondWithResult(_0x20b85c,_0x5e5294){_0x5e5294=_0x5e5294||0xc8;return function(_0x3f92b9){if(_0x3f92b9){return _0x20b85c[_0x73da('0x17')](_0x5e5294)['json'](_0x3f92b9);}};}function respondWithFilteredResult(_0x1a15c1,_0x12173c){return function(_0x25d3bc){if(_0x25d3bc){var _0x52be9d=typeof _0x12173c[_0x73da('0x19')]===_0x73da('0x1a')&&typeof _0x12173c[_0x73da('0x1b')]==='undefined';var _0xa1a34b=_0x25d3bc[_0x73da('0x1c')];var _0x9f90da=_0x52be9d?0x0:_0x12173c[_0x73da('0x19')];var _0x15e784=_0x52be9d?_0x25d3bc[_0x73da('0x1c')]:_0x12173c[_0x73da('0x19')]+_0x12173c['limit'];var _0x1e3275;if(_0x15e784>=_0xa1a34b){_0x15e784=_0xa1a34b;_0x1e3275=0xc8;}else{_0x1e3275=0xce;}_0x1a15c1[_0x73da('0x17')](_0x1e3275);return _0x1a15c1[_0x73da('0x1d')](_0x73da('0x1e'),_0x9f90da+'-'+_0x15e784+'/'+_0xa1a34b)[_0x73da('0x1f')](_0x25d3bc);}return null;};}function patchUpdates(_0x1da45a){return function(_0x2d672b){try{jsonpatch[_0x73da('0x20')](_0x2d672b,_0x1da45a,!![]);}catch(_0xc69d0d){return BPromise[_0x73da('0x21')](_0xc69d0d);}return _0x2d672b['save']();};}function saveUpdates(_0x4c9196,_0x58321a){return function(_0x6580d5){if(_0x6580d5){return _0x6580d5[_0x73da('0x22')](_0x4c9196)[_0x73da('0x23')](function(_0x194110){return _0x194110;});}return null;};}function removeEntity(_0x54c8e2,_0x37f6a6){return function(_0x13e327){if(_0x13e327){return _0x13e327[_0x73da('0x24')]()[_0x73da('0x23')](function(){_0x54c8e2[_0x73da('0x17')](0xcc)[_0x73da('0x18')]();});}};}function handleEntityNotFound(_0x2cda66,_0x36f4b8){return function(_0x38de6e){if(!_0x38de6e){_0x2cda66['sendStatus'](0x194);}return _0x38de6e;};}function handleError(_0x564b62,_0x3dfdb7){_0x3dfdb7=_0x3dfdb7||0x1f4;return function(_0x1a6052){logger[_0x73da('0x25')](_0x1a6052[_0x73da('0x26')]);if(_0x1a6052['name']){delete _0x1a6052[_0x73da('0x27')];}_0x564b62[_0x73da('0x17')](_0x3dfdb7)[_0x73da('0x28')](_0x1a6052);};}exports[_0x73da('0x29')]=function(_0x35c66a,_0x325967){var _0x8a106b={},_0x5fcf29={},_0x3238ee={'count':0x0,'rows':[]};var _0x14b1b9=_[_0x73da('0x2a')](db['ZendeskConfiguration'][_0x73da('0x2b')],function(_0x2c2d8e){return{'name':_0x2c2d8e[_0x73da('0x2c')],'type':_0x2c2d8e[_0x73da('0x2d')]['key']};});_0x5fcf29[_0x73da('0x2e')]=_['map'](_0x14b1b9,'name');_0x5fcf29[_0x73da('0x2f')]=_[_0x73da('0x30')](_0x35c66a[_0x73da('0x2f')]);_0x5fcf29[_0x73da('0x31')]=_[_0x73da('0x32')](_0x5fcf29[_0x73da('0x2e')],_0x5fcf29['query']);_0x8a106b[_0x73da('0x33')]=_['intersection'](_0x5fcf29['model'],qs['fields'](_0x35c66a[_0x73da('0x2f')][_0x73da('0x34')]));_0x8a106b[_0x73da('0x33')]=_0x8a106b['attributes']['length']?_0x8a106b['attributes']:_0x5fcf29['model'];if(!_0x35c66a[_0x73da('0x2f')][_0x73da('0x35')]('nolimit')){_0x8a106b[_0x73da('0x1b')]=qs[_0x73da('0x1b')](_0x35c66a['query'][_0x73da('0x1b')]);_0x8a106b[_0x73da('0x19')]=qs['offset'](_0x35c66a['query'][_0x73da('0x19')]);}_0x8a106b[_0x73da('0x36')]=qs[_0x73da('0x37')](_0x35c66a[_0x73da('0x2f')][_0x73da('0x37')]);_0x8a106b[_0x73da('0x38')]=qs[_0x73da('0x31')](_[_0x73da('0x39')](_0x35c66a[_0x73da('0x2f')],_0x5fcf29[_0x73da('0x31')]),_0x14b1b9);if(_0x35c66a['query'][_0x73da('0x3a')]){_0x8a106b[_0x73da('0x38')]=_['merge'](_0x8a106b['where'],{'$or':_[_0x73da('0x2a')](_0x14b1b9,function(_0x4d3480){if(_0x4d3480[_0x73da('0x2d')]!==_0x73da('0x3b')){var _0x48e623={};_0x48e623[_0x4d3480[_0x73da('0x27')]]={'$like':'%'+_0x35c66a['query'][_0x73da('0x3a')]+'%'};return _0x48e623;}})});}_0x8a106b=_['merge']({},_0x8a106b,_0x35c66a[_0x73da('0x3c')]);var _0x479e61={'where':_0x8a106b[_0x73da('0x38')]};return db['ZendeskConfiguration'][_0x73da('0x1c')](_0x479e61)[_0x73da('0x23')](function(_0x3e00df){_0x3238ee[_0x73da('0x1c')]=_0x3e00df;if(_0x35c66a[_0x73da('0x2f')]['includeAll']){_0x8a106b['include']=[{'all':!![]}];}return db[_0x73da('0x3d')][_0x73da('0x3e')](_0x8a106b);})[_0x73da('0x23')](function(_0x38e2cd){_0x3238ee[_0x73da('0x3f')]=_0x38e2cd;return _0x3238ee;})[_0x73da('0x23')](respondWithFilteredResult(_0x325967,_0x8a106b))['catch'](handleError(_0x325967,null));};exports['show']=function(_0x21d5c0,_0x50ce86){var _0x4356a8={'raw':![],'where':{'id':_0x21d5c0[_0x73da('0x40')]['id']}},_0x2ccc98={};_0x2ccc98[_0x73da('0x2e')]=_['keys'](db[_0x73da('0x3d')][_0x73da('0x2b')]);_0x2ccc98['query']=_[_0x73da('0x30')](_0x21d5c0[_0x73da('0x2f')]);_0x2ccc98[_0x73da('0x31')]=_[_0x73da('0x32')](_0x2ccc98[_0x73da('0x2e')],_0x2ccc98['query']);_0x4356a8[_0x73da('0x33')]=_[_0x73da('0x32')](_0x2ccc98[_0x73da('0x2e')],qs['fields'](_0x21d5c0[_0x73da('0x2f')][_0x73da('0x34')]));_0x4356a8['attributes']=_0x4356a8['attributes']['length']?_0x4356a8['attributes']:_0x2ccc98[_0x73da('0x2e')];if(_0x21d5c0[_0x73da('0x2f')][_0x73da('0x41')]){_0x4356a8['include']=[{'all':!![]}];}_0x4356a8=_[_0x73da('0x42')]({},_0x4356a8,_0x21d5c0[_0x73da('0x3c')]);return db['ZendeskConfiguration'][_0x73da('0x43')](_0x4356a8)[_0x73da('0x23')](handleEntityNotFound(_0x50ce86,null))['then'](respondWithResult(_0x50ce86,null))[_0x73da('0x44')](handleError(_0x50ce86,null));};exports[_0x73da('0x45')]=function(_0x54d6c0,_0x2ec00f){return db[_0x73da('0x3d')][_0x73da('0x45')](_0x54d6c0['body'],{})[_0x73da('0x23')](respondWithResult(_0x2ec00f,0xc9))['catch'](handleError(_0x2ec00f,null));};exports[_0x73da('0x22')]=function(_0x569c54,_0x428338){if(_0x569c54[_0x73da('0x46')]['id']){delete _0x569c54[_0x73da('0x46')]['id'];}return db[_0x73da('0x3d')]['find']({'where':{'id':_0x569c54[_0x73da('0x40')]['id']}})[_0x73da('0x23')](handleEntityNotFound(_0x428338,null))['then'](saveUpdates(_0x569c54[_0x73da('0x46')],null))[_0x73da('0x23')](respondWithResult(_0x428338,null))[_0x73da('0x44')](handleError(_0x428338,null));};exports[_0x73da('0x24')]=function(_0x53fe45,_0x57965f){return db[_0x73da('0x3d')][_0x73da('0x43')]({'where':{'id':_0x53fe45[_0x73da('0x40')]['id']}})[_0x73da('0x23')](handleEntityNotFound(_0x57965f,null))['then'](removeEntity(_0x57965f,null))[_0x73da('0x44')](handleError(_0x57965f,null));};exports['getFields']=function(_0x1d9baf,_0x6a5edc,_0x14fcc3){var _0x4f727f={};var _0x9b5bff={};var _0x49affe;var _0x506861;return db[_0x73da('0x3d')][_0x73da('0x47')]({'where':{'id':_0x1d9baf['params']['id']}})[_0x73da('0x23')](handleEntityNotFound(_0x6a5edc,null))['then'](function(_0x37bcf0){if(_0x37bcf0){_0x49affe=_0x37bcf0;_0x9b5bff[_0x73da('0x2e')]=_[_0x73da('0x30')](db[_0x73da('0x48')][_0x73da('0x2b')]);_0x9b5bff[_0x73da('0x2f')]=_[_0x73da('0x30')](_0x1d9baf[_0x73da('0x2f')]);_0x9b5bff[_0x73da('0x31')]=_[_0x73da('0x32')](_0x9b5bff[_0x73da('0x2e')],_0x9b5bff['query']);_0x4f727f[_0x73da('0x33')]=_[_0x73da('0x32')](_0x9b5bff[_0x73da('0x2e')],qs[_0x73da('0x34')](_0x1d9baf[_0x73da('0x2f')][_0x73da('0x34')]));_0x4f727f[_0x73da('0x33')]=_0x4f727f[_0x73da('0x33')]['length']?_0x4f727f[_0x73da('0x33')]:_0x9b5bff[_0x73da('0x2e')];_0x4f727f[_0x73da('0x36')]=qs[_0x73da('0x37')](_0x1d9baf[_0x73da('0x2f')]['sort']);_0x4f727f[_0x73da('0x38')]=qs[_0x73da('0x31')](_[_0x73da('0x39')](_0x1d9baf[_0x73da('0x2f')],_0x9b5bff[_0x73da('0x31')]));if(_0x1d9baf[_0x73da('0x2f')][_0x73da('0x3a')]){_0x4f727f[_0x73da('0x38')]=_[_0x73da('0x42')](_0x4f727f[_0x73da('0x38')],{'$or':_[_0x73da('0x2a')](_0x4f727f['attributes'],function(_0x1ee356){var _0xa6c666={};_0xa6c666[_0x1ee356]={'$like':'%'+_0x1d9baf['query'][_0x73da('0x3a')]+'%'};return _0xa6c666;})});}_0x4f727f=_[_0x73da('0x42')]({},_0x4f727f,_0x1d9baf[_0x73da('0x3c')]);return _0x49affe[_0x73da('0x49')](_0x4f727f);}})['then'](function(_0x3cec5d){if(_0x3cec5d){_0x506861=_0x3cec5d[_0x73da('0x4a')];if(!_0x1d9baf['query'][_0x73da('0x35')](_0x73da('0x4b'))){_0x4f727f['limit']=qs[_0x73da('0x1b')](_0x1d9baf[_0x73da('0x2f')]['limit']);_0x4f727f['offset']=qs['offset'](_0x1d9baf[_0x73da('0x2f')][_0x73da('0x19')]);}return _0x49affe[_0x73da('0x49')](_0x4f727f);}})['then'](function(_0x3e40d1){if(_0x3e40d1){return _0x3e40d1?{'count':_0x506861,'rows':_0x3e40d1}:null;}})['then'](respondWithResult(_0x6a5edc,null))[_0x73da('0x44')](handleError(_0x6a5edc,null));};exports[_0x73da('0x4c')]=function(_0x441898,_0x4f406a,_0x250d3a){var _0x40945b={};var _0x2d241d={};var _0xfabf2a;var _0xd6470f;return db[_0x73da('0x3d')][_0x73da('0x47')]({'where':{'id':_0x441898['params']['id']}})[_0x73da('0x23')](handleEntityNotFound(_0x4f406a,null))[_0x73da('0x23')](function(_0x225559){if(_0x225559){_0xfabf2a=_0x225559;_0x2d241d[_0x73da('0x2e')]=_[_0x73da('0x30')](db[_0x73da('0x48')][_0x73da('0x2b')]);_0x2d241d[_0x73da('0x2f')]=_[_0x73da('0x30')](_0x441898[_0x73da('0x2f')]);_0x2d241d[_0x73da('0x31')]=_[_0x73da('0x32')](_0x2d241d['model'],_0x2d241d['query']);_0x40945b[_0x73da('0x33')]=_[_0x73da('0x32')](_0x2d241d[_0x73da('0x2e')],qs[_0x73da('0x34')](_0x441898[_0x73da('0x2f')]['fields']));_0x40945b['attributes']=_0x40945b[_0x73da('0x33')][_0x73da('0x4a')]?_0x40945b[_0x73da('0x33')]:_0x2d241d[_0x73da('0x2e')];_0x40945b[_0x73da('0x36')]=qs[_0x73da('0x37')](_0x441898[_0x73da('0x2f')][_0x73da('0x37')]);_0x40945b[_0x73da('0x38')]=qs[_0x73da('0x31')](_[_0x73da('0x39')](_0x441898['query'],_0x2d241d[_0x73da('0x31')]));if(_0x441898[_0x73da('0x2f')][_0x73da('0x3a')]){_0x40945b[_0x73da('0x38')]=_['merge'](_0x40945b['where'],{'$or':_[_0x73da('0x2a')](_0x40945b[_0x73da('0x33')],function(_0x369afc){var _0x15b299={};_0x15b299[_0x369afc]={'$like':'%'+_0x441898[_0x73da('0x2f')][_0x73da('0x3a')]+'%'};return _0x15b299;})});}_0x40945b=_[_0x73da('0x42')]({},_0x40945b,_0x441898[_0x73da('0x3c')]);return _0xfabf2a[_0x73da('0x4c')](_0x40945b);}})[_0x73da('0x23')](function(_0x4b1fd7){if(_0x4b1fd7){_0xd6470f=_0x4b1fd7[_0x73da('0x4a')];if(!_0x441898[_0x73da('0x2f')][_0x73da('0x35')](_0x73da('0x4b'))){_0x40945b[_0x73da('0x1b')]=qs[_0x73da('0x1b')](_0x441898[_0x73da('0x2f')]['limit']);_0x40945b[_0x73da('0x19')]=qs[_0x73da('0x19')](_0x441898[_0x73da('0x2f')][_0x73da('0x19')]);}return _0xfabf2a[_0x73da('0x4c')](_0x40945b);}})[_0x73da('0x23')](function(_0x4edbe6){if(_0x4edbe6){return _0x4edbe6?{'count':_0xd6470f,'rows':_0x4edbe6}:null;}})['then'](respondWithResult(_0x4f406a,null))[_0x73da('0x44')](handleError(_0x4f406a,null));};exports[_0x73da('0x4d')]=function(_0x3201c9,_0x490b77,_0x1ca66e){var _0x229c11={};var _0x4b8656={};var _0x55553f;var _0x15c638;return db['ZendeskConfiguration'][_0x73da('0x47')]({'where':{'id':_0x3201c9[_0x73da('0x40')]['id']}})[_0x73da('0x23')](handleEntityNotFound(_0x490b77,null))[_0x73da('0x23')](function(_0x36a445){if(_0x36a445){_0x55553f=_0x36a445;_0x4b8656[_0x73da('0x2e')]=_[_0x73da('0x30')](db[_0x73da('0x48')][_0x73da('0x2b')]);_0x4b8656[_0x73da('0x2f')]=_[_0x73da('0x30')](_0x3201c9[_0x73da('0x2f')]);_0x4b8656[_0x73da('0x31')]=_[_0x73da('0x32')](_0x4b8656[_0x73da('0x2e')],_0x4b8656['query']);_0x229c11[_0x73da('0x33')]=_['intersection'](_0x4b8656[_0x73da('0x2e')],qs[_0x73da('0x34')](_0x3201c9[_0x73da('0x2f')][_0x73da('0x34')]));_0x229c11['attributes']=_0x229c11[_0x73da('0x33')][_0x73da('0x4a')]?_0x229c11[_0x73da('0x33')]:_0x4b8656['model'];_0x229c11[_0x73da('0x36')]=qs[_0x73da('0x37')](_0x3201c9[_0x73da('0x2f')][_0x73da('0x37')]);_0x229c11['where']=qs[_0x73da('0x31')](_[_0x73da('0x39')](_0x3201c9[_0x73da('0x2f')],_0x4b8656['filters']));if(_0x3201c9[_0x73da('0x2f')][_0x73da('0x3a')]){_0x229c11[_0x73da('0x38')]=_[_0x73da('0x42')](_0x229c11['where'],{'$or':_['map'](_0x229c11['attributes'],function(_0x5a95f7){var _0x1ce060={};_0x1ce060[_0x5a95f7]={'$like':'%'+_0x3201c9['query'][_0x73da('0x3a')]+'%'};return _0x1ce060;})});}_0x229c11=_[_0x73da('0x42')]({},_0x229c11,_0x3201c9['options']);return _0x55553f['getDescriptions'](_0x229c11);}})[_0x73da('0x23')](function(_0x13dae4){if(_0x13dae4){_0x15c638=_0x13dae4[_0x73da('0x4a')];if(!_0x3201c9[_0x73da('0x2f')][_0x73da('0x35')](_0x73da('0x4b'))){_0x229c11[_0x73da('0x1b')]=qs['limit'](_0x3201c9[_0x73da('0x2f')][_0x73da('0x1b')]);_0x229c11['offset']=qs[_0x73da('0x19')](_0x3201c9[_0x73da('0x2f')][_0x73da('0x19')]);}return _0x55553f[_0x73da('0x4d')](_0x229c11);}})['then'](function(_0x769417){if(_0x769417){return _0x769417?{'count':_0x15c638,'rows':_0x769417}:null;}})[_0x73da('0x23')](respondWithResult(_0x490b77,null))[_0x73da('0x44')](handleError(_0x490b77,null));};exports[_0x73da('0x4e')]=function(_0x20b1e4,_0x45ee94,_0xb7f325){var _0x43f70f={};var _0x3d670e={};var _0x27ffe6;var _0x3a9e15;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x20b1e4['params']['id']}})['then'](handleEntityNotFound(_0x45ee94,null))[_0x73da('0x23')](function(_0x58edde){if(_0x58edde){_0x27ffe6=_0x58edde;_0x3d670e['model']=_['keys'](db[_0x73da('0x4f')][_0x73da('0x2b')]);_0x3d670e[_0x73da('0x2f')]=_[_0x73da('0x30')](_0x20b1e4[_0x73da('0x2f')]);_0x3d670e[_0x73da('0x31')]=_['intersection'](_0x3d670e[_0x73da('0x2e')],_0x3d670e[_0x73da('0x2f')]);_0x43f70f[_0x73da('0x33')]=_['intersection'](_0x3d670e[_0x73da('0x2e')],qs[_0x73da('0x34')](_0x20b1e4['query'][_0x73da('0x34')]));_0x43f70f[_0x73da('0x33')]=_0x43f70f['attributes']['length']?_0x43f70f[_0x73da('0x33')]:_0x3d670e['model'];_0x43f70f[_0x73da('0x36')]=qs[_0x73da('0x37')](_0x20b1e4[_0x73da('0x2f')]['sort']);_0x43f70f[_0x73da('0x38')]=qs['filters'](_[_0x73da('0x39')](_0x20b1e4[_0x73da('0x2f')],_0x3d670e['filters']));if(_0x20b1e4['query']['filter']){_0x43f70f['where']=_['merge'](_0x43f70f[_0x73da('0x38')],{'$or':_[_0x73da('0x2a')](_0x43f70f[_0x73da('0x33')],function(_0x4ac0d3){var _0x388af8={};_0x388af8[_0x4ac0d3]={'$like':'%'+_0x20b1e4[_0x73da('0x2f')][_0x73da('0x3a')]+'%'};return _0x388af8;})});}_0x43f70f=_[_0x73da('0x42')]({},_0x43f70f,_0x20b1e4[_0x73da('0x3c')]);return _0x27ffe6[_0x73da('0x4e')](_0x43f70f);}})[_0x73da('0x23')](function(_0x117574){if(_0x117574){_0x3a9e15=_0x117574[_0x73da('0x4a')];if(!_0x20b1e4[_0x73da('0x2f')][_0x73da('0x35')]('nolimit')){_0x43f70f['limit']=qs[_0x73da('0x1b')](_0x20b1e4[_0x73da('0x2f')][_0x73da('0x1b')]);_0x43f70f[_0x73da('0x19')]=qs[_0x73da('0x19')](_0x20b1e4[_0x73da('0x2f')][_0x73da('0x19')]);}return _0x27ffe6[_0x73da('0x4e')](_0x43f70f);}})['then'](function(_0x403a88){if(_0x403a88){return _0x403a88?{'count':_0x3a9e15,'rows':_0x403a88}:null;}})[_0x73da('0x23')](respondWithResult(_0x45ee94,null))[_0x73da('0x44')](handleError(_0x45ee94,null));};exports['setTags']=function(_0x3ede34,_0x47a5e0,_0x4a58a6){if(_0x3ede34[_0x73da('0x46')]['id']){delete _0x3ede34[_0x73da('0x46')]['id'];}return db[_0x73da('0x3d')]['findOne']({'where':{'id':_0x3ede34[_0x73da('0x40')]['id']}})[_0x73da('0x23')](handleEntityNotFound(_0x47a5e0,null))['then'](function(_0x2ef3cf){if(_0x2ef3cf){return _0x2ef3cf['setTags'](_0x3ede34[_0x73da('0x46')][_0x73da('0x50')]||[]);}return null;})[_0x73da('0x23')](respondWithResult(_0x47a5e0,null))[_0x73da('0x44')](handleError(_0x47a5e0,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 923f6fb..39a9694 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 _0x77e6=['path','../../config/environment','./intZendeskConfiguration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2cba48,_0x72499){var _0x11db2e=function(_0x351e9a){while(--_0x351e9a){_0x2cba48['push'](_0x2cba48['shift']());}};_0x11db2e(++_0x72499);}(_0x77e6,0x1a6));var _0x677e=function(_0x413357,_0x1f4722){_0x413357=_0x413357-0x0;var _0x4faa5e=_0x77e6[_0x413357];return _0x4faa5e;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var logger=require(_0x677e('0x2'))(_0x677e('0x3'));var moment=require(_0x677e('0x4'));var BPromise=require(_0x677e('0x5'));var rp=require(_0x677e('0x6'));var fs=require('fs');var path=require(_0x677e('0x7'));var rimraf=require('rimraf');var config=require(_0x677e('0x8'));var attributes=require(_0x677e('0x9'));module['exports']=function(_0x18c5e1,_0x591b21){return _0x18c5e1[_0x677e('0xa')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea28=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c8044,_0x111241){var _0xecd075=function(_0x387cad){while(--_0x387cad){_0x4c8044['push'](_0x4c8044['shift']());}};_0xecd075(++_0x111241);}(_0xea28,0x13a));var _0x8ea2=function(_0x2e81ff,_0x12c760){_0x2e81ff=_0x2e81ff-0x0;var _0xd63d94=_0xea28[_0x2e81ff];return _0xd63d94;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'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 6c77528..fe6528b 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 _0x91be=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','util','moment'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x91be,0xee));var _0xe91b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x91be[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe91b('0x0'));var moment=require(_0xe91b('0x1'));var BPromise=require(_0xe91b('0x2'));var rs=require(_0xe91b('0x3'));var fs=require('fs');var Redis=require(_0xe91b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe91b('0x5'));var logger=require(_0xe91b('0x6'))(_0xe91b('0x7'));var config=require(_0xe91b('0x8'));var jayson=require(_0xe91b('0x9'));var client=jayson[_0xe91b('0xa')][_0xe91b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43769c,_0x5f36bf,_0x85e1e2){return new BPromise(function(_0x448dc7,_0x3fe2a4){return client[_0xe91b('0xc')](_0x43769c,_0x85e1e2)[_0xe91b('0xd')](function(_0x51f558){logger[_0xe91b('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5f36bf,_0xe91b('0xf'));logger[_0xe91b('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5f36bf,_0xe91b('0xf'),JSON[_0xe91b('0x11')](_0x51f558));if(_0x51f558[_0xe91b('0x12')]){if(_0x51f558['error'][_0xe91b('0x13')]===0x1f4){logger[_0xe91b('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5f36bf,_0x51f558[_0xe91b('0x12')][_0xe91b('0x14')]);return _0x3fe2a4(_0x51f558[_0xe91b('0x12')][_0xe91b('0x14')]);}logger[_0xe91b('0x12')](_0xe91b('0x15'),_0x5f36bf,_0x51f558[_0xe91b('0x12')][_0xe91b('0x14')]);return _0x448dc7(_0x51f558[_0xe91b('0x12')][_0xe91b('0x14')]);}else{logger[_0xe91b('0xe')](_0xe91b('0x15'),_0x5f36bf,_0xe91b('0xf'));_0x448dc7(_0x51f558[_0xe91b('0x16')][_0xe91b('0x14')]);}})[_0xe91b('0x17')](function(_0x11f5d0){logger[_0xe91b('0x12')](_0xe91b('0x15'),_0x5f36bf,_0x11f5d0);_0x3fe2a4(_0x11f5d0);});});} \ No newline at end of file +var _0x11cf=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x10f277,_0x50b2e9){var _0x576403=function(_0x200ba7){while(--_0x200ba7){_0x10f277['push'](_0x10f277['shift']());}};_0x576403(++_0x50b2e9);}(_0x11cf,0x17b));var _0xf11c=function(_0xd0e677,_0x42939d){_0xd0e677=_0xd0e677-0x0;var _0x18aeb9=_0x11cf[_0xd0e677];return _0x18aeb9;};'use strict';var _=require(_0xf11c('0x0'));var util=require(_0xf11c('0x1'));var moment=require(_0xf11c('0x2'));var BPromise=require('bluebird');var rs=require(_0xf11c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf11c('0x4'));var logger=require(_0xf11c('0x5'))(_0xf11c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf11c('0x7')][_0xf11c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56bc44,_0xe4edd5,_0x33e1cd){return new BPromise(function(_0x2384af,_0x96d55e){return client[_0xf11c('0x9')](_0x56bc44,_0x33e1cd)[_0xf11c('0xa')](function(_0x8e7077){logger[_0xf11c('0xb')](_0xf11c('0xc'),_0xe4edd5,'request\x20sent');logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0xe4edd5,_0xf11c('0xd'),JSON[_0xf11c('0xe')](_0x8e7077));if(_0x8e7077[_0xf11c('0xf')]){if(_0x8e7077[_0xf11c('0xf')][_0xf11c('0x10')]===0x1f4){logger[_0xf11c('0xf')](_0xf11c('0xc'),_0xe4edd5,_0x8e7077['error']['message']);return _0x96d55e(_0x8e7077['error'][_0xf11c('0x11')]);}logger[_0xf11c('0xf')](_0xf11c('0xc'),_0xe4edd5,_0x8e7077[_0xf11c('0xf')][_0xf11c('0x11')]);return _0x2384af(_0x8e7077[_0xf11c('0xf')][_0xf11c('0x11')]);}else{logger[_0xf11c('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0xe4edd5,_0xf11c('0xd'));_0x2384af(_0x8e7077['result'][_0xf11c('0x11')]);}})[_0xf11c('0x12')](function(_0x5bf7ff){logger[_0xf11c('0xf')](_0xf11c('0xc'),_0xe4edd5,_0x5bf7ff);_0x96d55e(_0x5bf7ff);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 75f0da9..e537f3e 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 _0xe8f9=['create','put','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post'];(function(_0x4051be,_0x4e30dc){var _0x10d8e5=function(_0x1ae1c2){while(--_0x1ae1c2){_0x4051be['push'](_0x4051be['shift']());}};_0x10d8e5(++_0x4e30dc);}(_0xe8f9,0x17f));var _0x9e8f=function(_0x2069bf,_0x5b3b1b){_0x2069bf=_0x2069bf-0x0;var _0x2b298c=_0xe8f9[_0x2069bf];return _0x2b298c;};'use strict';var multer=require('multer');var util=require(_0x9e8f('0x0'));var path=require(_0x9e8f('0x1'));var timeout=require(_0x9e8f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9e8f('0x3'));var auth=require(_0x9e8f('0x4'));var interaction=require(_0x9e8f('0x5'));var config=require(_0x9e8f('0x6'));var controller=require('./intZendeskField.controller');router[_0x9e8f('0x7')]('/',auth['isAuthenticated'](),controller[_0x9e8f('0x8')]);router[_0x9e8f('0x7')](_0x9e8f('0x9'),auth[_0x9e8f('0xa')](),controller[_0x9e8f('0xb')]);router[_0x9e8f('0xc')]('/',auth[_0x9e8f('0xa')](),controller[_0x9e8f('0xd')]);router[_0x9e8f('0xe')](_0x9e8f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x9e8f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9e8f('0x10')]);module[_0x9e8f('0x11')]=router; \ No newline at end of file +var _0x9dfa=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9dfa,0xfc));var _0xa9df=function(_0x32ad78,_0xa40984){_0x32ad78=_0x32ad78-0x0;var _0x21b488=_0x9dfa[_0x32ad78];return _0x21b488;};'use strict';var multer=require(_0xa9df('0x0'));var util=require(_0xa9df('0x1'));var path=require(_0xa9df('0x2'));var timeout=require(_0xa9df('0x3'));var express=require(_0xa9df('0x4'));var router=express[_0xa9df('0x5')]();var fs_extra=require(_0xa9df('0x6'));var auth=require(_0xa9df('0x7'));var interaction=require(_0xa9df('0x8'));var config=require(_0xa9df('0x9'));var controller=require(_0xa9df('0xa'));router[_0xa9df('0xb')]('/',auth[_0xa9df('0xc')](),controller[_0xa9df('0xd')]);router[_0xa9df('0xb')](_0xa9df('0xe'),auth['isAuthenticated'](),controller[_0xa9df('0xf')]);router[_0xa9df('0x10')]('/',auth[_0xa9df('0xc')](),controller['create']);router[_0xa9df('0x11')](_0xa9df('0xe'),auth[_0xa9df('0xc')](),controller[_0xa9df('0x12')]);router[_0xa9df('0x13')](_0xa9df('0xe'),auth[_0xa9df('0xc')](),controller[_0xa9df('0x14')]);module[_0xa9df('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 330c455..a8199ae 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 _0xafa9=['ENUM','string','variable','keyValue','STRING','BOOLEAN'];(function(_0x5b086e,_0x5eb6c0){var _0x3e2c2c=function(_0x1c5de7){while(--_0x1c5de7){_0x5b086e['push'](_0x5b086e['shift']());}};_0x3e2c2c(++_0x5eb6c0);}(_0xafa9,0x1b6));var _0x9afa=function(_0x16eb19,_0x58cea4){_0x16eb19=_0x16eb19-0x0;var _0x312a25=_0xafa9[_0x16eb19];return _0x312a25;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9afa('0x0')](_0x9afa('0x1'),_0x9afa('0x2'),'customVariable',_0x9afa('0x3'),'picklist'),'defaultValue':_0x9afa('0x1')},'content':{'type':Sequelize[_0x9afa('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9afa('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x9afa('0x4')]},'idField':{'type':Sequelize[_0x9afa('0x4')]},'nameField':{'type':Sequelize[_0x9afa('0x4')]},'customField':{'type':Sequelize[_0x9afa('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x72c9=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x21ecfe,_0x3789ba){var _0x2d7f73=function(_0x236e04){while(--_0x236e04){_0x21ecfe['push'](_0x21ecfe['shift']());}};_0x2d7f73(++_0x3789ba);}(_0x72c9,0xcd));var _0x972c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72c9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x972c('0x0')]={'type':{'type':Sequelize[_0x972c('0x1')](_0x972c('0x2'),_0x972c('0x3'),_0x972c('0x4'),_0x972c('0x5'),_0x972c('0x6')),'defaultValue':_0x972c('0x2')},'content':{'type':Sequelize[_0x972c('0x7')]},'key':{'type':Sequelize[_0x972c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x972c('0x2'),_0x972c('0x3'),_0x972c('0x4'))},'keyContent':{'type':Sequelize[_0x972c('0x7')]},'idField':{'type':Sequelize[_0x972c('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x972c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x972c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index c0ca3aa..cea13bc 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 _0xb99b=['length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','model','query','keys','intersection','fields','attributes'];(function(_0x411511,_0x13b21a){var _0xda7b33=function(_0x278e91){while(--_0x278e91){_0x411511['push'](_0x411511['shift']());}};_0xda7b33(++_0x13b21a);}(_0xb99b,0xa9));var _0xbb99=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb99b[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xbb99('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb99('0x1'));var jsonpatch=require(_0xbb99('0x2'));var rp=require('request-promise');var moment=require(_0xbb99('0x3'));var BPromise=require(_0xbb99('0x4'));var Mustache=require(_0xbb99('0x5'));var util=require(_0xbb99('0x6'));var path=require(_0xbb99('0x7'));var sox=require('sox');var csv=require(_0xbb99('0x8'));var ejs=require(_0xbb99('0x9'));var fs=require('fs');var fs_extra=require(_0xbb99('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbb99('0xb'));var jsforce=require(_0xbb99('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbb99('0x8'));var querystring=require('querystring');var Papa=require(_0xbb99('0xd'));var Redis=require(_0xbb99('0xe'));var authService=require(_0xbb99('0xf'));var qs=require(_0xbb99('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb99('0x11'));var logger=require(_0xbb99('0x12'))(_0xbb99('0x13'));var utils=require(_0xbb99('0x14'));var config=require(_0xbb99('0x15'));var licenseUtil=require(_0xbb99('0x16'));var db=require(_0xbb99('0x17'))['db'];function respondWithStatusCode(_0x482f94,_0x51db42){_0x51db42=_0x51db42||0xcc;return function(_0x3e5f67){if(_0x3e5f67){return _0x482f94[_0xbb99('0x18')](_0x51db42);}return _0x482f94[_0xbb99('0x19')](_0x51db42)[_0xbb99('0x1a')]();};}function respondWithResult(_0x231eeb,_0x5f4fcc){_0x5f4fcc=_0x5f4fcc||0xc8;return function(_0x7b2faa){if(_0x7b2faa){return _0x231eeb[_0xbb99('0x19')](_0x5f4fcc)[_0xbb99('0x1b')](_0x7b2faa);}};}function respondWithFilteredResult(_0x3fcfa5,_0x476615){return function(_0xde9808){if(_0xde9808){var _0x96dbe5=typeof _0x476615['offset']===_0xbb99('0x1c')&&typeof _0x476615['limit']===_0xbb99('0x1c');var _0x32f9e0=_0xde9808[_0xbb99('0x1d')];var _0xe4aebc=_0x96dbe5?0x0:_0x476615[_0xbb99('0x1e')];var _0x3392f8=_0x96dbe5?_0xde9808[_0xbb99('0x1d')]:_0x476615[_0xbb99('0x1e')]+_0x476615['limit'];var _0x47390b;if(_0x3392f8>=_0x32f9e0){_0x3392f8=_0x32f9e0;_0x47390b=0xc8;}else{_0x47390b=0xce;}_0x3fcfa5[_0xbb99('0x19')](_0x47390b);return _0x3fcfa5[_0xbb99('0x1f')](_0xbb99('0x20'),_0xe4aebc+'-'+_0x3392f8+'/'+_0x32f9e0)['json'](_0xde9808);}return null;};}function patchUpdates(_0x4e623f){return function(_0x1a3d82){try{jsonpatch['apply'](_0x1a3d82,_0x4e623f,!![]);}catch(_0x143978){return BPromise[_0xbb99('0x21')](_0x143978);}return _0x1a3d82[_0xbb99('0x22')]();};}function saveUpdates(_0x29b657,_0x1d4bc3){return function(_0x2b823a){if(_0x2b823a){return _0x2b823a[_0xbb99('0x23')](_0x29b657)[_0xbb99('0x24')](function(_0x3662ca){return _0x3662ca;});}return null;};}function removeEntity(_0x1b284d,_0x21a8f4){return function(_0x30bbca){if(_0x30bbca){return _0x30bbca[_0xbb99('0x25')]()[_0xbb99('0x24')](function(){_0x1b284d[_0xbb99('0x19')](0xcc)[_0xbb99('0x1a')]();});}};}function handleEntityNotFound(_0x514fd5,_0x487f0a){return function(_0x3e542b){if(!_0x3e542b){_0x514fd5[_0xbb99('0x18')](0x194);}return _0x3e542b;};}function handleError(_0x21e26a,_0xe002a6){_0xe002a6=_0xe002a6||0x1f4;return function(_0x3ebb6f){logger[_0xbb99('0x26')](_0x3ebb6f[_0xbb99('0x27')]);if(_0x3ebb6f[_0xbb99('0x28')]){delete _0x3ebb6f[_0xbb99('0x28')];}_0x21e26a[_0xbb99('0x19')](_0xe002a6)[_0xbb99('0x29')](_0x3ebb6f);};}exports[_0xbb99('0x2a')]=function(_0x5d5afd,_0x44fc62){var _0x19cae0={},_0x10d370={},_0x47ae71={'count':0x0,'rows':[]};var _0x3d954c=_[_0xbb99('0x2b')](db[_0xbb99('0x2c')][_0xbb99('0x2d')],function(_0xf25929){return{'name':_0xf25929['fieldName'],'type':_0xf25929[_0xbb99('0x2e')]['key']};});_0x10d370[_0xbb99('0x2f')]=_['map'](_0x3d954c,'name');_0x10d370[_0xbb99('0x30')]=_[_0xbb99('0x31')](_0x5d5afd[_0xbb99('0x30')]);_0x10d370['filters']=_['intersection'](_0x10d370[_0xbb99('0x2f')],_0x10d370['query']);_0x19cae0['attributes']=_[_0xbb99('0x32')](_0x10d370[_0xbb99('0x2f')],qs['fields'](_0x5d5afd[_0xbb99('0x30')][_0xbb99('0x33')]));_0x19cae0[_0xbb99('0x34')]=_0x19cae0[_0xbb99('0x34')][_0xbb99('0x35')]?_0x19cae0[_0xbb99('0x34')]:_0x10d370['model'];if(!_0x5d5afd[_0xbb99('0x30')][_0xbb99('0x36')](_0xbb99('0x37'))){_0x19cae0['limit']=qs['limit'](_0x5d5afd['query'][_0xbb99('0x38')]);_0x19cae0[_0xbb99('0x1e')]=qs['offset'](_0x5d5afd[_0xbb99('0x30')][_0xbb99('0x1e')]);}_0x19cae0[_0xbb99('0x39')]=qs[_0xbb99('0x3a')](_0x5d5afd[_0xbb99('0x30')][_0xbb99('0x3a')]);_0x19cae0[_0xbb99('0x3b')]=qs[_0xbb99('0x3c')](_['pick'](_0x5d5afd[_0xbb99('0x30')],_0x10d370[_0xbb99('0x3c')]),_0x3d954c);if(_0x5d5afd[_0xbb99('0x30')][_0xbb99('0x3d')]){_0x19cae0[_0xbb99('0x3b')]=_[_0xbb99('0x3e')](_0x19cae0[_0xbb99('0x3b')],{'$or':_[_0xbb99('0x2b')](_0x3d954c,function(_0x193090){if(_0x193090[_0xbb99('0x2e')]!=='VIRTUAL'){var _0x12d6cc={};_0x12d6cc[_0x193090[_0xbb99('0x28')]]={'$like':'%'+_0x5d5afd[_0xbb99('0x30')][_0xbb99('0x3d')]+'%'};return _0x12d6cc;}})});}_0x19cae0=_[_0xbb99('0x3e')]({},_0x19cae0,_0x5d5afd[_0xbb99('0x3f')]);var _0x530d49={'where':_0x19cae0[_0xbb99('0x3b')]};return db[_0xbb99('0x2c')]['count'](_0x530d49)[_0xbb99('0x24')](function(_0x5b8b57){_0x47ae71[_0xbb99('0x1d')]=_0x5b8b57;if(_0x5d5afd[_0xbb99('0x30')][_0xbb99('0x40')]){_0x19cae0[_0xbb99('0x41')]=[{'all':!![]}];}return db[_0xbb99('0x2c')][_0xbb99('0x42')](_0x19cae0);})[_0xbb99('0x24')](function(_0x1b8876){_0x47ae71[_0xbb99('0x43')]=_0x1b8876;return _0x47ae71;})[_0xbb99('0x24')](respondWithFilteredResult(_0x44fc62,_0x19cae0))[_0xbb99('0x44')](handleError(_0x44fc62,null));};exports[_0xbb99('0x45')]=function(_0x57e388,_0x17b5aa){var _0x398aa0={'raw':!![],'where':{'id':_0x57e388[_0xbb99('0x46')]['id']}},_0x20c76f={};_0x20c76f[_0xbb99('0x2f')]=_[_0xbb99('0x31')](db['ZendeskField']['rawAttributes']);_0x20c76f[_0xbb99('0x30')]=_[_0xbb99('0x31')](_0x57e388['query']);_0x20c76f[_0xbb99('0x3c')]=_[_0xbb99('0x32')](_0x20c76f[_0xbb99('0x2f')],_0x20c76f[_0xbb99('0x30')]);_0x398aa0['attributes']=_[_0xbb99('0x32')](_0x20c76f[_0xbb99('0x2f')],qs[_0xbb99('0x33')](_0x57e388['query'][_0xbb99('0x33')]));_0x398aa0['attributes']=_0x398aa0[_0xbb99('0x34')]['length']?_0x398aa0[_0xbb99('0x34')]:_0x20c76f[_0xbb99('0x2f')];if(_0x57e388[_0xbb99('0x30')]['includeAll']){_0x398aa0[_0xbb99('0x41')]=[{'all':!![]}];}_0x398aa0=_['merge']({},_0x398aa0,_0x57e388[_0xbb99('0x3f')]);return db[_0xbb99('0x2c')]['find'](_0x398aa0)[_0xbb99('0x24')](handleEntityNotFound(_0x17b5aa,null))['then'](respondWithResult(_0x17b5aa,null))[_0xbb99('0x44')](handleError(_0x17b5aa,null));};exports['create']=function(_0x3b2246,_0x1dac4d){return db[_0xbb99('0x2c')][_0xbb99('0x47')](_0x3b2246[_0xbb99('0x48')],{})[_0xbb99('0x24')](respondWithResult(_0x1dac4d,0xc9))[_0xbb99('0x44')](handleError(_0x1dac4d,null));};exports[_0xbb99('0x23')]=function(_0x532f26,_0x1e3d2a){if(_0x532f26[_0xbb99('0x48')]['id']){delete _0x532f26[_0xbb99('0x48')]['id'];}return db[_0xbb99('0x2c')][_0xbb99('0x49')]({'where':{'id':_0x532f26[_0xbb99('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e3d2a,null))[_0xbb99('0x24')](saveUpdates(_0x532f26['body'],null))['then'](respondWithResult(_0x1e3d2a,null))['catch'](handleError(_0x1e3d2a,null));};exports[_0xbb99('0x25')]=function(_0x27fce0,_0x399822){return db[_0xbb99('0x2c')]['find']({'where':{'id':_0x27fce0[_0xbb99('0x46')]['id']}})[_0xbb99('0x24')](handleEntityNotFound(_0x399822,null))[_0xbb99('0x24')](removeEntity(_0x399822,null))[_0xbb99('0x44')](handleError(_0x399822,null));}; \ No newline at end of file +var _0x93e7=['where','VIRTUAL','merge','options','ZendeskField','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','destroy','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x5a4607,_0x481a4a){var _0x30b49f=function(_0x2e4a84){while(--_0x2e4a84){_0x5a4607['push'](_0x5a4607['shift']());}};_0x30b49f(++_0x481a4a);}(_0x93e7,0x13a));var _0x793e=function(_0x21bad5,_0x23a39d){_0x21bad5=_0x21bad5-0x0;var _0x235106=_0x93e7[_0x21bad5];return _0x235106;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x793e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x793e('0x1'));var rp=require(_0x793e('0x2'));var moment=require('moment');var BPromise=require(_0x793e('0x3'));var Mustache=require('mustache');var util=require(_0x793e('0x4'));var path=require(_0x793e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x793e('0x6'));var fs=require('fs');var fs_extra=require(_0x793e('0x7'));var _=require(_0x793e('0x8'));var squel=require(_0x793e('0x9'));var crypto=require(_0x793e('0xa'));var jsforce=require(_0x793e('0xb'));var deskjs=require(_0x793e('0xc'));var toCsv=require(_0x793e('0xd'));var querystring=require('querystring');var Papa=require(_0x793e('0xe'));var Redis=require('ioredis');var authService=require(_0x793e('0xf'));var qs=require(_0x793e('0x10'));var as=require(_0x793e('0x11'));var hardwareService=require(_0x793e('0x12'));var logger=require(_0x793e('0x13'))(_0x793e('0x14'));var utils=require(_0x793e('0x15'));var config=require(_0x793e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x793e('0x17'))['db'];function respondWithStatusCode(_0x3383a0,_0x12ca7d){_0x12ca7d=_0x12ca7d||0xcc;return function(_0x3d6ab2){if(_0x3d6ab2){return _0x3383a0[_0x793e('0x18')](_0x12ca7d);}return _0x3383a0[_0x793e('0x19')](_0x12ca7d)['end']();};}function respondWithResult(_0x463fa9,_0x61d449){_0x61d449=_0x61d449||0xc8;return function(_0x174ed7){if(_0x174ed7){return _0x463fa9[_0x793e('0x19')](_0x61d449)[_0x793e('0x1a')](_0x174ed7);}};}function respondWithFilteredResult(_0x11dee7,_0x725a63){return function(_0x59bcae){if(_0x59bcae){var _0x23c77c=typeof _0x725a63[_0x793e('0x1b')]==='undefined'&&typeof _0x725a63[_0x793e('0x1c')]===_0x793e('0x1d');var _0x1cf658=_0x59bcae[_0x793e('0x1e')];var _0x4fe708=_0x23c77c?0x0:_0x725a63[_0x793e('0x1b')];var _0x25ddb6=_0x23c77c?_0x59bcae['count']:_0x725a63['offset']+_0x725a63[_0x793e('0x1c')];var _0x56626c;if(_0x25ddb6>=_0x1cf658){_0x25ddb6=_0x1cf658;_0x56626c=0xc8;}else{_0x56626c=0xce;}_0x11dee7[_0x793e('0x19')](_0x56626c);return _0x11dee7[_0x793e('0x1f')]('Content-Range',_0x4fe708+'-'+_0x25ddb6+'/'+_0x1cf658)['json'](_0x59bcae);}return null;};}function patchUpdates(_0x1f129e){return function(_0x65d60f){try{jsonpatch[_0x793e('0x20')](_0x65d60f,_0x1f129e,!![]);}catch(_0x36419f){return BPromise[_0x793e('0x21')](_0x36419f);}return _0x65d60f['save']();};}function saveUpdates(_0x24ca12,_0x5737a8){return function(_0x27406e){if(_0x27406e){return _0x27406e['update'](_0x24ca12)[_0x793e('0x22')](function(_0x2efb11){return _0x2efb11;});}return null;};}function removeEntity(_0x13b560,_0x2a49d7){return function(_0x596b86){if(_0x596b86){return _0x596b86['destroy']()[_0x793e('0x22')](function(){_0x13b560[_0x793e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25690c,_0x5102b4){return function(_0xb2361b){if(!_0xb2361b){_0x25690c[_0x793e('0x18')](0x194);}return _0xb2361b;};}function handleError(_0x595aaf,_0x23174a){_0x23174a=_0x23174a||0x1f4;return function(_0x256a96){logger[_0x793e('0x23')](_0x256a96[_0x793e('0x24')]);if(_0x256a96['name']){delete _0x256a96['name'];}_0x595aaf[_0x793e('0x19')](_0x23174a)[_0x793e('0x25')](_0x256a96);};}exports[_0x793e('0x26')]=function(_0x3f3b95,_0xd2c84){var _0x1e9345={},_0x1b6974={},_0x3321a0={'count':0x0,'rows':[]};var _0x3433ae=_[_0x793e('0x27')](db['ZendeskField'][_0x793e('0x28')],function(_0x46b71a){return{'name':_0x46b71a[_0x793e('0x29')],'type':_0x46b71a[_0x793e('0x2a')][_0x793e('0x2b')]};});_0x1b6974[_0x793e('0x2c')]=_['map'](_0x3433ae,'name');_0x1b6974[_0x793e('0x2d')]=_['keys'](_0x3f3b95[_0x793e('0x2d')]);_0x1b6974[_0x793e('0x2e')]=_[_0x793e('0x2f')](_0x1b6974['model'],_0x1b6974['query']);_0x1e9345[_0x793e('0x30')]=_[_0x793e('0x2f')](_0x1b6974['model'],qs[_0x793e('0x31')](_0x3f3b95['query'][_0x793e('0x31')]));_0x1e9345[_0x793e('0x30')]=_0x1e9345['attributes']['length']?_0x1e9345[_0x793e('0x30')]:_0x1b6974['model'];if(!_0x3f3b95[_0x793e('0x2d')][_0x793e('0x32')](_0x793e('0x33'))){_0x1e9345[_0x793e('0x1c')]=qs[_0x793e('0x1c')](_0x3f3b95[_0x793e('0x2d')]['limit']);_0x1e9345['offset']=qs[_0x793e('0x1b')](_0x3f3b95[_0x793e('0x2d')]['offset']);}_0x1e9345[_0x793e('0x34')]=qs['sort'](_0x3f3b95[_0x793e('0x2d')][_0x793e('0x35')]);_0x1e9345['where']=qs[_0x793e('0x2e')](_[_0x793e('0x36')](_0x3f3b95[_0x793e('0x2d')],_0x1b6974[_0x793e('0x2e')]),_0x3433ae);if(_0x3f3b95[_0x793e('0x2d')][_0x793e('0x37')]){_0x1e9345[_0x793e('0x38')]=_['merge'](_0x1e9345[_0x793e('0x38')],{'$or':_[_0x793e('0x27')](_0x3433ae,function(_0xb2dd19){if(_0xb2dd19[_0x793e('0x2a')]!==_0x793e('0x39')){var _0x36c7f5={};_0x36c7f5[_0xb2dd19['name']]={'$like':'%'+_0x3f3b95['query'][_0x793e('0x37')]+'%'};return _0x36c7f5;}})});}_0x1e9345=_[_0x793e('0x3a')]({},_0x1e9345,_0x3f3b95[_0x793e('0x3b')]);var _0x4bfd1d={'where':_0x1e9345[_0x793e('0x38')]};return db[_0x793e('0x3c')][_0x793e('0x1e')](_0x4bfd1d)[_0x793e('0x22')](function(_0x294b00){_0x3321a0[_0x793e('0x1e')]=_0x294b00;if(_0x3f3b95['query']['includeAll']){_0x1e9345[_0x793e('0x3d')]=[{'all':!![]}];}return db[_0x793e('0x3c')][_0x793e('0x3e')](_0x1e9345);})[_0x793e('0x22')](function(_0x527df5){_0x3321a0[_0x793e('0x3f')]=_0x527df5;return _0x3321a0;})[_0x793e('0x22')](respondWithFilteredResult(_0xd2c84,_0x1e9345))[_0x793e('0x40')](handleError(_0xd2c84,null));};exports[_0x793e('0x41')]=function(_0x1d6517,_0x56dd3f){var _0x1ab65f={'raw':!![],'where':{'id':_0x1d6517[_0x793e('0x42')]['id']}},_0xa65f87={};_0xa65f87[_0x793e('0x2c')]=_[_0x793e('0x43')](db[_0x793e('0x3c')][_0x793e('0x28')]);_0xa65f87[_0x793e('0x2d')]=_[_0x793e('0x43')](_0x1d6517[_0x793e('0x2d')]);_0xa65f87[_0x793e('0x2e')]=_['intersection'](_0xa65f87[_0x793e('0x2c')],_0xa65f87[_0x793e('0x2d')]);_0x1ab65f[_0x793e('0x30')]=_[_0x793e('0x2f')](_0xa65f87[_0x793e('0x2c')],qs['fields'](_0x1d6517['query']['fields']));_0x1ab65f[_0x793e('0x30')]=_0x1ab65f[_0x793e('0x30')][_0x793e('0x44')]?_0x1ab65f[_0x793e('0x30')]:_0xa65f87['model'];if(_0x1d6517[_0x793e('0x2d')][_0x793e('0x45')]){_0x1ab65f[_0x793e('0x3d')]=[{'all':!![]}];}_0x1ab65f=_[_0x793e('0x3a')]({},_0x1ab65f,_0x1d6517[_0x793e('0x3b')]);return db['ZendeskField'][_0x793e('0x46')](_0x1ab65f)[_0x793e('0x22')](handleEntityNotFound(_0x56dd3f,null))[_0x793e('0x22')](respondWithResult(_0x56dd3f,null))[_0x793e('0x40')](handleError(_0x56dd3f,null));};exports[_0x793e('0x47')]=function(_0x27aed0,_0x4aaaa5){return db[_0x793e('0x3c')][_0x793e('0x47')](_0x27aed0[_0x793e('0x48')],{})[_0x793e('0x22')](respondWithResult(_0x4aaaa5,0xc9))[_0x793e('0x40')](handleError(_0x4aaaa5,null));};exports['update']=function(_0xb5167d,_0x503d3e){if(_0xb5167d[_0x793e('0x48')]['id']){delete _0xb5167d['body']['id'];}return db['ZendeskField'][_0x793e('0x46')]({'where':{'id':_0xb5167d[_0x793e('0x42')]['id']}})[_0x793e('0x22')](handleEntityNotFound(_0x503d3e,null))['then'](saveUpdates(_0xb5167d[_0x793e('0x48')],null))[_0x793e('0x22')](respondWithResult(_0x503d3e,null))[_0x793e('0x40')](handleError(_0x503d3e,null));};exports[_0x793e('0x49')]=function(_0x45fe3b,_0x16ff95){return db[_0x793e('0x3c')][_0x793e('0x46')]({'where':{'id':_0x45fe3b['params']['id']}})[_0x793e('0x22')](handleEntityNotFound(_0x16ff95,null))[_0x793e('0x22')](removeEntity(_0x16ff95,null))['catch'](handleError(_0x16ff95,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 10559c6..ea649b3 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 _0xcb94=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x5463c2,_0x22c4cc){var _0x5a7da7=function(_0x4c16b5){while(--_0x4c16b5){_0x5463c2['push'](_0x5463c2['shift']());}};_0x5a7da7(++_0x22c4cc);}(_0xcb94,0x193));var _0x4cb9=function(_0x39a678,_0x2d38d6){_0x39a678=_0x39a678-0x0;var _0x1e968b=_0xcb94[_0x39a678];return _0x1e968b;};'use strict';var _=require(_0x4cb9('0x0'));var util=require('util');var logger=require(_0x4cb9('0x1'))(_0x4cb9('0x2'));var moment=require(_0x4cb9('0x3'));var BPromise=require(_0x4cb9('0x4'));var rp=require(_0x4cb9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cb9('0x6'));var config=require(_0x4cb9('0x7'));var attributes=require(_0x4cb9('0x8'));module['exports']=function(_0xd1aab6,_0x21d7d6){return _0xd1aab6[_0x4cb9('0x9')](_0x4cb9('0xa'),attributes,{'tableName':_0x4cb9('0xb'),'paranoid':![],'indexes':[{'name':_0x4cb9('0xc'),'fields':[_0x4cb9('0xd'),_0x4cb9('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x609e=['request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x609e,0x191));var _0xe609=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x609e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe609('0x0'));var util=require(_0xe609('0x1'));var logger=require(_0xe609('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe609('0x3'));var rp=require(_0xe609('0x4'));var fs=require('fs');var path=require(_0xe609('0x5'));var rimraf=require('rimraf');var config=require(_0xe609('0x6'));var attributes=require(_0xe609('0x7'));module[_0xe609('0x8')]=function(_0x2c4e29,_0x1092b0){return _0x2c4e29[_0xe609('0x9')](_0xe609('0xa'),attributes,{'tableName':_0xe609('0xb'),'paranoid':![],'indexes':[{'name':_0xe609('0xc'),'fields':[_0xe609('0xd'),_0xe609('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index c160e7c..563d358 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 _0x4abf=['debug','error','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x41fed9,_0x177598){var _0x29c435=function(_0x2a5932){while(--_0x2a5932){_0x41fed9['push'](_0x41fed9['shift']());}};_0x29c435(++_0x177598);}(_0x4abf,0x156));var _0xf4ab=function(_0xf32c6d,_0x372704){_0xf32c6d=_0xf32c6d-0x0;var _0x156c11=_0x4abf[_0xf32c6d];return _0x156c11;};'use strict';var _=require(_0xf4ab('0x0'));var util=require(_0xf4ab('0x1'));var moment=require(_0xf4ab('0x2'));var BPromise=require(_0xf4ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf4ab('0x5'))(_0xf4ab('0x6'));var config=require(_0xf4ab('0x7'));var jayson=require(_0xf4ab('0x8'));var client=jayson[_0xf4ab('0x9')][_0xf4ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23a4a3,_0x36c04f,_0x2226c8){return new BPromise(function(_0x5b4d99,_0x51275e){return client[_0xf4ab('0xb')](_0x23a4a3,_0x2226c8)[_0xf4ab('0xc')](function(_0x4323c8){logger[_0xf4ab('0xd')]('ZendeskField,\x20%s,\x20%s',_0x36c04f,_0xf4ab('0xe'));logger[_0xf4ab('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x36c04f,_0xf4ab('0xe'),JSON['stringify'](_0x4323c8));if(_0x4323c8[_0xf4ab('0x10')]){if(_0x4323c8[_0xf4ab('0x10')]['code']===0x1f4){logger[_0xf4ab('0x10')](_0xf4ab('0x11'),_0x36c04f,_0x4323c8[_0xf4ab('0x10')][_0xf4ab('0x12')]);return _0x51275e(_0x4323c8[_0xf4ab('0x10')]['message']);}logger[_0xf4ab('0x10')](_0xf4ab('0x11'),_0x36c04f,_0x4323c8['error'][_0xf4ab('0x12')]);return _0x5b4d99(_0x4323c8[_0xf4ab('0x10')]['message']);}else{logger[_0xf4ab('0xd')]('ZendeskField,\x20%s,\x20%s',_0x36c04f,_0xf4ab('0xe'));_0x5b4d99(_0x4323c8[_0xf4ab('0x13')][_0xf4ab('0x12')]);}})[_0xf4ab('0x14')](function(_0x33da49){logger[_0xf4ab('0x10')](_0xf4ab('0x11'),_0x36c04f,_0x33da49);_0x51275e(_0x33da49);});});} \ No newline at end of file +var _0xccb7=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','randomstring','ioredis'];(function(_0x405f59,_0x24a3a8){var _0x37f91a=function(_0x6c496){while(--_0x6c496){_0x405f59['push'](_0x405f59['shift']());}};_0x37f91a(++_0x24a3a8);}(_0xccb7,0x165));var _0x7ccb=function(_0x1779f3,_0x125053){_0x1779f3=_0x1779f3-0x0;var _0x5e3d0e=_0xccb7[_0x1779f3];return _0x5e3d0e;};'use strict';var _=require(_0x7ccb('0x0'));var util=require(_0x7ccb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7ccb('0x2'));var fs=require('fs');var Redis=require(_0x7ccb('0x3'));var db=require(_0x7ccb('0x4'))['db'];var utils=require(_0x7ccb('0x5'));var logger=require('../../config/logger')(_0x7ccb('0x6'));var config=require(_0x7ccb('0x7'));var jayson=require(_0x7ccb('0x8'));var client=jayson['client'][_0x7ccb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x232108,_0x5cbd6c,_0x4c27e0){return new BPromise(function(_0x1986a3,_0xa2c60a){return client[_0x7ccb('0xa')](_0x232108,_0x4c27e0)['then'](function(_0x21bbc7){logger[_0x7ccb('0xb')](_0x7ccb('0xc'),_0x5cbd6c,_0x7ccb('0xd'));logger[_0x7ccb('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5cbd6c,'request\x20sent',JSON[_0x7ccb('0xf')](_0x21bbc7));if(_0x21bbc7['error']){if(_0x21bbc7[_0x7ccb('0x10')]['code']===0x1f4){logger[_0x7ccb('0x10')](_0x7ccb('0xc'),_0x5cbd6c,_0x21bbc7[_0x7ccb('0x10')][_0x7ccb('0x11')]);return _0xa2c60a(_0x21bbc7[_0x7ccb('0x10')]['message']);}logger[_0x7ccb('0x10')](_0x7ccb('0xc'),_0x5cbd6c,_0x21bbc7[_0x7ccb('0x10')][_0x7ccb('0x11')]);return _0x1986a3(_0x21bbc7[_0x7ccb('0x10')]['message']);}else{logger[_0x7ccb('0xb')](_0x7ccb('0xc'),_0x5cbd6c,'request\x20sent');_0x1986a3(_0x21bbc7[_0x7ccb('0x12')][_0x7ccb('0x11')]);}})['catch'](function(_0x105c5f){logger[_0x7ccb('0x10')]('ZendeskField,\x20%s,\x20%s',_0x5cbd6c,_0x105c5f);_0xa2c60a(_0x105c5f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 18ce309..11adcfe 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 _0x484b=['../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x484b,0x104));var _0xb484=function(_0x57b366,_0x4a336d){_0x57b366=_0x57b366-0x0;var _0x5f6256=_0x484b[_0x57b366];return _0x5f6256;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb484('0x0'));var timeout=require(_0xb484('0x1'));var express=require(_0xb484('0x2'));var router=express['Router']();var fs_extra=require(_0xb484('0x3'));var auth=require(_0xb484('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb484('0x5'));var controller=require(_0xb484('0x6'));router[_0xb484('0x7')]('/',auth[_0xb484('0x8')](),controller['index']);router[_0xb484('0x7')]('/:id',auth[_0xb484('0x8')](),controller[_0xb484('0x9')]);router[_0xb484('0x7')](_0xb484('0xa'),auth[_0xb484('0x8')](),controller[_0xb484('0xb')]);router[_0xb484('0x7')](_0xb484('0xc'),auth[_0xb484('0x8')](),controller[_0xb484('0xd')]);router['post']('/',auth[_0xb484('0x8')](),controller['create']);router[_0xb484('0xe')](_0xb484('0xa'),auth[_0xb484('0x8')](),controller[_0xb484('0xf')]);router[_0xb484('0x10')](_0xb484('0x11'),auth['isAuthenticated'](),controller[_0xb484('0x12')]);router[_0xb484('0x13')](_0xb484('0x11'),auth[_0xb484('0x8')](),controller[_0xb484('0x14')]);module[_0xb484('0x15')]=router; \ No newline at end of file +var _0xa682=['get','isAuthenticated','index','/:id','show','/:id/fields','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./intZohoAccount.controller'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0xa682,0xb5));var _0x2a68=function(_0xf4f544,_0x1d0800){_0xf4f544=_0xf4f544-0x0;var _0x48217e=_0xa682[_0xf4f544];return _0x48217e;};'use strict';var multer=require(_0x2a68('0x0'));var util=require(_0x2a68('0x1'));var path=require(_0x2a68('0x2'));var timeout=require(_0x2a68('0x3'));var express=require(_0x2a68('0x4'));var router=express['Router']();var fs_extra=require(_0x2a68('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a68('0x6'));var controller=require(_0x2a68('0x7'));router[_0x2a68('0x8')]('/',auth[_0x2a68('0x9')](),controller[_0x2a68('0xa')]);router[_0x2a68('0x8')](_0x2a68('0xb'),auth['isAuthenticated'](),controller[_0x2a68('0xc')]);router[_0x2a68('0x8')]('/:id/configurations',auth[_0x2a68('0x9')](),controller['getConfigurations']);router[_0x2a68('0x8')](_0x2a68('0xd'),auth[_0x2a68('0x9')](),controller['getFields']);router['post']('/',auth[_0x2a68('0x9')](),controller[_0x2a68('0xe')]);router['post']('/:id/configurations',auth[_0x2a68('0x9')](),controller[_0x2a68('0xf')]);router[_0x2a68('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2a68('0x11')]);router[_0x2a68('0x12')](_0x2a68('0xb'),auth[_0x2a68('0x9')](),controller[_0x2a68('0x13')]);module[_0x2a68('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ec56e34..fb5f373 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 _0x0a9a=['STRING','exports'];(function(_0x5cb753,_0x2fbf20){var _0x100b84=function(_0x113ba9){while(--_0x113ba9){_0x5cb753['push'](_0x5cb753['shift']());}};_0x100b84(++_0x2fbf20);}(_0x0a9a,0x183));var _0xa0a9=function(_0x1b1226,_0x2fe800){_0x1b1226=_0x1b1226-0x0;var _0x124279=_0x0a9a[_0x1b1226];return _0x124279;};'use strict';var Sequelize=require('sequelize');module[_0xa0a9('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa0a9('0x1')]},'host':{'type':Sequelize[_0xa0a9('0x1')]},'zone':{'type':Sequelize[_0xa0a9('0x1')]},'clientId':{'type':Sequelize[_0xa0a9('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa0a9('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xa0a9('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING'];(function(_0x57dbce,_0x2a4604){var _0x2ab396=function(_0x321f80){while(--_0x321f80){_0x57dbce['push'](_0x57dbce['shift']());}};_0x2ab396(++_0x2a4604);}(_0x34e8,0x12c));var _0x834e=function(_0x2002ac,_0x3ffec5){_0x2002ac=_0x2002ac-0x0;var _0x540e5a=_0x34e8[_0x2002ac];return _0x540e5a;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')]},'description':{'type':Sequelize[_0x834e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x834e('0x2')]},'clientId':{'type':Sequelize[_0x834e('0x2')]},'clientSecret':{'type':Sequelize[_0x834e('0x2')]},'serverUrl':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x834e('0x2')]},'refreshToken':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 8672bd8..b7531e8 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 _0xe0b5=['zone','https://accounts.zoho.com','https://accounts.zoho.com.au','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','code','slice','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','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','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','ZohoAccount','findAll','rows','show','params','find','catch','create','body','update','destroy','getConfigurations','findOne','ZohoConfiguration','order','pick','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField'];(function(_0x3804cc,_0x5bb9f3){var _0x8cbf4a=function(_0x2214a7){while(--_0x2214a7){_0x3804cc['push'](_0x3804cc['shift']());}};_0x8cbf4a(++_0x5bb9f3);}(_0xe0b5,0x1b1));var _0x5e0b=function(_0x4d131c,_0x4e3490){_0x4d131c=_0x4d131c-0x0;var _0x3d7f06=_0xe0b5[_0x4d131c];return _0x3d7f06;};'use strict';var emlformat=require(_0x5e0b('0x0'));var rimraf=require(_0x5e0b('0x1'));var zipdir=require(_0x5e0b('0x2'));var jsonpatch=require(_0x5e0b('0x3'));var rp=require(_0x5e0b('0x4'));var moment=require(_0x5e0b('0x5'));var BPromise=require(_0x5e0b('0x6'));var Mustache=require(_0x5e0b('0x7'));var util=require(_0x5e0b('0x8'));var path=require('path');var sox=require(_0x5e0b('0x9'));var csv=require('to-csv');var ejs=require(_0x5e0b('0xa'));var fs=require('fs');var fs_extra=require(_0x5e0b('0xb'));var _=require(_0x5e0b('0xc'));var squel=require('squel');var crypto=require(_0x5e0b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5e0b('0xe'));var toCsv=require(_0x5e0b('0xf'));var querystring=require('querystring');var Papa=require(_0x5e0b('0x10'));var Redis=require(_0x5e0b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5e0b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e0b('0x13'));var logger=require(_0x5e0b('0x14'))(_0x5e0b('0x15'));var utils=require(_0x5e0b('0x16'));var config=require(_0x5e0b('0x17'));var licenseUtil=require(_0x5e0b('0x18'));var db=require(_0x5e0b('0x19'))['db'];var integrations=require(_0x5e0b('0x1a'));function respondWithStatusCode(_0x5e86c0,_0x2e46f5){_0x2e46f5=_0x2e46f5||0xcc;return function(_0x5f4842){if(_0x5f4842){return _0x5e86c0[_0x5e0b('0x1b')](_0x2e46f5);}return _0x5e86c0[_0x5e0b('0x1c')](_0x2e46f5)[_0x5e0b('0x1d')]();};}function respondWithResult(_0x16ed2b,_0x2719d9){_0x2719d9=_0x2719d9||0xc8;return function(_0x57e653){if(_0x57e653){return _0x16ed2b[_0x5e0b('0x1c')](_0x2719d9)[_0x5e0b('0x1e')](_0x57e653);}};}function respondWithFilteredResult(_0x52677f,_0x284e08){return function(_0x191c04){if(_0x191c04){var _0x158391=typeof _0x284e08[_0x5e0b('0x1f')]===_0x5e0b('0x20')&&typeof _0x284e08[_0x5e0b('0x21')]==='undefined';var _0x46810a=_0x191c04[_0x5e0b('0x22')];var _0x155e67=_0x158391?0x0:_0x284e08[_0x5e0b('0x1f')];var _0x25f7c0=_0x158391?_0x191c04[_0x5e0b('0x22')]:_0x284e08[_0x5e0b('0x1f')]+_0x284e08[_0x5e0b('0x21')];var _0x14e401;if(_0x25f7c0>=_0x46810a){_0x25f7c0=_0x46810a;_0x14e401=0xc8;}else{_0x14e401=0xce;}_0x52677f['status'](_0x14e401);return _0x52677f[_0x5e0b('0x23')](_0x5e0b('0x24'),_0x155e67+'-'+_0x25f7c0+'/'+_0x46810a)['json'](_0x191c04);}return null;};}function patchUpdates(_0x180155){return function(_0x45494a){try{jsonpatch[_0x5e0b('0x25')](_0x45494a,_0x180155,!![]);}catch(_0x3c52f0){return BPromise['reject'](_0x3c52f0);}return _0x45494a['save']();};}function saveUpdates(_0x2f134e,_0x477e7d){return function(_0x5dbb00){if(_0x5dbb00){return _0x5dbb00['update'](_0x2f134e)[_0x5e0b('0x26')](function(_0x54cb14){return _0x54cb14;});}return null;};}function removeEntity(_0xa9624f,_0x2836f2){return function(_0x46eff9){if(_0x46eff9){return _0x46eff9['destroy']()[_0x5e0b('0x26')](function(){_0xa9624f[_0x5e0b('0x1c')](0xcc)[_0x5e0b('0x1d')]();});}};}function handleEntityNotFound(_0x34ad25,_0xf76d30){return function(_0x33ad84){if(!_0x33ad84){_0x34ad25[_0x5e0b('0x1b')](0x194);}return _0x33ad84;};}function handleError(_0xb1b3ec,_0x1b964d){_0x1b964d=_0x1b964d||0x1f4;return function(_0x47fe4a){logger[_0x5e0b('0x27')](_0x47fe4a['stack']);if(_0x47fe4a[_0x5e0b('0x28')]){delete _0x47fe4a['name'];}_0xb1b3ec[_0x5e0b('0x1c')](_0x1b964d)['send'](_0x47fe4a);};}exports[_0x5e0b('0x29')]=function(_0x5c1691,_0x482f6d){var _0x34b6bc={},_0x4003b1={},_0x4ebe6d={'count':0x0,'rows':[]};var _0x3b41f7=_[_0x5e0b('0x2a')](db['ZohoAccount'][_0x5e0b('0x2b')],function(_0x4d4f66){return{'name':_0x4d4f66[_0x5e0b('0x2c')],'type':_0x4d4f66[_0x5e0b('0x2d')][_0x5e0b('0x2e')]};});_0x4003b1[_0x5e0b('0x2f')]=_[_0x5e0b('0x2a')](_0x3b41f7,_0x5e0b('0x28'));_0x4003b1[_0x5e0b('0x30')]=_[_0x5e0b('0x31')](_0x5c1691[_0x5e0b('0x30')]);_0x4003b1[_0x5e0b('0x32')]=_['intersection'](_0x4003b1[_0x5e0b('0x2f')],_0x4003b1[_0x5e0b('0x30')]);_0x34b6bc[_0x5e0b('0x33')]=_[_0x5e0b('0x34')](_0x4003b1['model'],qs[_0x5e0b('0x35')](_0x5c1691[_0x5e0b('0x30')][_0x5e0b('0x35')]));_0x34b6bc['attributes']=_0x34b6bc['attributes'][_0x5e0b('0x36')]?_0x34b6bc[_0x5e0b('0x33')]:_0x4003b1[_0x5e0b('0x2f')];if(!_0x5c1691[_0x5e0b('0x30')][_0x5e0b('0x37')](_0x5e0b('0x38'))){_0x34b6bc['limit']=qs[_0x5e0b('0x21')](_0x5c1691[_0x5e0b('0x30')]['limit']);_0x34b6bc[_0x5e0b('0x1f')]=qs[_0x5e0b('0x1f')](_0x5c1691[_0x5e0b('0x30')][_0x5e0b('0x1f')]);}_0x34b6bc['order']=qs['sort'](_0x5c1691['query'][_0x5e0b('0x39')]);_0x34b6bc['where']=qs[_0x5e0b('0x32')](_['pick'](_0x5c1691[_0x5e0b('0x30')],_0x4003b1[_0x5e0b('0x32')]),_0x3b41f7);if(_0x5c1691[_0x5e0b('0x30')][_0x5e0b('0x3a')]){_0x34b6bc['where']=_[_0x5e0b('0x3b')](_0x34b6bc[_0x5e0b('0x3c')],{'$or':_['map'](_0x3b41f7,function(_0x59a49b){if(_0x59a49b[_0x5e0b('0x2d')]!==_0x5e0b('0x3d')){var _0x31b7ca={};_0x31b7ca[_0x59a49b[_0x5e0b('0x28')]]={'$like':'%'+_0x5c1691[_0x5e0b('0x30')]['filter']+'%'};return _0x31b7ca;}})});}_0x34b6bc=_[_0x5e0b('0x3b')]({},_0x34b6bc,_0x5c1691[_0x5e0b('0x3e')]);var _0x259de6={'where':_0x34b6bc[_0x5e0b('0x3c')]};return db['ZohoAccount']['count'](_0x259de6)[_0x5e0b('0x26')](function(_0x4389ed){_0x4ebe6d['count']=_0x4389ed;if(_0x5c1691['query'][_0x5e0b('0x3f')]){_0x34b6bc[_0x5e0b('0x40')]=[{'all':!![]}];}return db[_0x5e0b('0x41')][_0x5e0b('0x42')](_0x34b6bc);})[_0x5e0b('0x26')](function(_0x2b085b){_0x4ebe6d[_0x5e0b('0x43')]=_0x2b085b;return _0x4ebe6d;})[_0x5e0b('0x26')](respondWithFilteredResult(_0x482f6d,_0x34b6bc))['catch'](handleError(_0x482f6d,null));};exports[_0x5e0b('0x44')]=function(_0x53971d,_0xb39f33){var _0x1d1b9e={'raw':![],'where':{'id':_0x53971d[_0x5e0b('0x45')]['id']}},_0x3c8fe2={};_0x3c8fe2[_0x5e0b('0x2f')]=_[_0x5e0b('0x31')](db[_0x5e0b('0x41')][_0x5e0b('0x2b')]);_0x3c8fe2[_0x5e0b('0x30')]=_['keys'](_0x53971d[_0x5e0b('0x30')]);_0x3c8fe2[_0x5e0b('0x32')]=_[_0x5e0b('0x34')](_0x3c8fe2['model'],_0x3c8fe2[_0x5e0b('0x30')]);_0x1d1b9e[_0x5e0b('0x33')]=_[_0x5e0b('0x34')](_0x3c8fe2[_0x5e0b('0x2f')],qs[_0x5e0b('0x35')](_0x53971d['query'][_0x5e0b('0x35')]));_0x1d1b9e[_0x5e0b('0x33')]=_0x1d1b9e[_0x5e0b('0x33')][_0x5e0b('0x36')]?_0x1d1b9e['attributes']:_0x3c8fe2[_0x5e0b('0x2f')];if(_0x53971d[_0x5e0b('0x30')]['includeAll']){_0x1d1b9e[_0x5e0b('0x40')]=[{'all':!![]}];}_0x1d1b9e=_['merge']({},_0x1d1b9e,_0x53971d['options']);return db[_0x5e0b('0x41')][_0x5e0b('0x46')](_0x1d1b9e)['then'](handleEntityNotFound(_0xb39f33,null))[_0x5e0b('0x26')](respondWithResult(_0xb39f33,null))[_0x5e0b('0x47')](handleError(_0xb39f33,null));};exports[_0x5e0b('0x48')]=function(_0x240e8c,_0xfd7440){return db[_0x5e0b('0x41')][_0x5e0b('0x48')](_0x240e8c[_0x5e0b('0x49')],{})[_0x5e0b('0x26')](respondWithResult(_0xfd7440,0xc9))[_0x5e0b('0x47')](handleError(_0xfd7440,null));};exports[_0x5e0b('0x4a')]=function(_0x3a6306,_0x3a1525){if(_0x3a6306[_0x5e0b('0x49')]['id']){delete _0x3a6306[_0x5e0b('0x49')]['id'];}return db[_0x5e0b('0x41')][_0x5e0b('0x46')]({'where':{'id':_0x3a6306[_0x5e0b('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a1525,null))['then'](saveUpdates(_0x3a6306[_0x5e0b('0x49')],null))['then'](respondWithResult(_0x3a1525,null))['catch'](handleError(_0x3a1525,null));};exports[_0x5e0b('0x4b')]=function(_0x4443ed,_0xf9fe31){return db['ZohoAccount'][_0x5e0b('0x46')]({'where':{'id':_0x4443ed[_0x5e0b('0x45')]['id']}})[_0x5e0b('0x26')](handleEntityNotFound(_0xf9fe31,null))[_0x5e0b('0x26')](removeEntity(_0xf9fe31,null))[_0x5e0b('0x47')](handleError(_0xf9fe31,null));};exports[_0x5e0b('0x4c')]=function(_0x59fbc3,_0x2084f0,_0x22972b){var _0x3ba702={};var _0xde0b01={};var _0x1aceff;var _0x407ffe;return db['ZohoAccount'][_0x5e0b('0x4d')]({'where':{'id':_0x59fbc3['params']['id']}})[_0x5e0b('0x26')](handleEntityNotFound(_0x2084f0,null))[_0x5e0b('0x26')](function(_0x14a620){if(_0x14a620){_0x1aceff=_0x14a620;_0xde0b01['model']=_[_0x5e0b('0x31')](db[_0x5e0b('0x4e')]['rawAttributes']);_0xde0b01[_0x5e0b('0x30')]=_['keys'](_0x59fbc3['query']);_0xde0b01[_0x5e0b('0x32')]=_[_0x5e0b('0x34')](_0xde0b01['model'],_0xde0b01[_0x5e0b('0x30')]);_0x3ba702[_0x5e0b('0x33')]=_[_0x5e0b('0x34')](_0xde0b01[_0x5e0b('0x2f')],qs[_0x5e0b('0x35')](_0x59fbc3[_0x5e0b('0x30')][_0x5e0b('0x35')]));_0x3ba702[_0x5e0b('0x33')]=_0x3ba702[_0x5e0b('0x33')][_0x5e0b('0x36')]?_0x3ba702[_0x5e0b('0x33')]:_0xde0b01[_0x5e0b('0x2f')];_0x3ba702[_0x5e0b('0x4f')]=qs[_0x5e0b('0x39')](_0x59fbc3[_0x5e0b('0x30')]['sort']);_0x3ba702[_0x5e0b('0x3c')]=qs[_0x5e0b('0x32')](_[_0x5e0b('0x50')](_0x59fbc3[_0x5e0b('0x30')],_0xde0b01['filters']));if(_0x59fbc3[_0x5e0b('0x30')][_0x5e0b('0x3a')]){_0x3ba702[_0x5e0b('0x3c')]=_[_0x5e0b('0x3b')](_0x3ba702[_0x5e0b('0x3c')],{'$or':_[_0x5e0b('0x2a')](_0x3ba702[_0x5e0b('0x33')],function(_0x1f31bc){var _0x4f7260={};_0x4f7260[_0x1f31bc]={'$like':'%'+_0x59fbc3[_0x5e0b('0x30')][_0x5e0b('0x3a')]+'%'};return _0x4f7260;})});}_0x3ba702=_[_0x5e0b('0x3b')]({},_0x3ba702,_0x59fbc3[_0x5e0b('0x3e')]);return _0x1aceff[_0x5e0b('0x4c')](_0x3ba702);}})[_0x5e0b('0x26')](function(_0x27bb59){if(_0x27bb59){_0x407ffe=_0x27bb59['length'];if(!_0x59fbc3[_0x5e0b('0x30')][_0x5e0b('0x37')](_0x5e0b('0x38'))){_0x3ba702[_0x5e0b('0x21')]=qs[_0x5e0b('0x21')](_0x59fbc3[_0x5e0b('0x30')][_0x5e0b('0x21')]);_0x3ba702['offset']=qs[_0x5e0b('0x1f')](_0x59fbc3['query'][_0x5e0b('0x1f')]);}return _0x1aceff[_0x5e0b('0x4c')](_0x3ba702);}})[_0x5e0b('0x26')](function(_0x2bd001){if(_0x2bd001){return _0x2bd001?{'count':_0x407ffe,'rows':_0x2bd001}:null;}})[_0x5e0b('0x26')](respondWithResult(_0x2084f0,null))['catch'](handleError(_0x2084f0,null));};exports['addConfiguration']=function(_0x1037fd,_0xdfedd2,_0x4f0e78){if(_0x1037fd['body']['id']){delete _0x1037fd[_0x5e0b('0x49')]['id'];}return db[_0x5e0b('0x41')][_0x5e0b('0x4d')]({'where':{'id':_0x1037fd[_0x5e0b('0x45')]['id']}})[_0x5e0b('0x26')](handleEntityNotFound(_0xdfedd2,null))[_0x5e0b('0x26')](function(_0x4b9828){if(_0x4b9828){_0x1037fd['body']['AccountId']=_0x4b9828['id'];_0x1037fd[_0x5e0b('0x49')][_0x5e0b('0x51')]=integrations[_0x5e0b('0x52')](_0x1037fd[_0x5e0b('0x49')][_0x5e0b('0x53')],_0x1037fd[_0x5e0b('0x49')][_0x5e0b('0x2d')]);_0x1037fd['body'][_0x5e0b('0x54')]=integrations[_0x5e0b('0x55')](_0x1037fd['body'][_0x5e0b('0x53')],_0x1037fd[_0x5e0b('0x49')][_0x5e0b('0x2d')]);return db['ZohoConfiguration']['create'](_0x1037fd['body'],{'include':[{'model':db[_0x5e0b('0x56')],'as':'Subjects'},{'model':db[_0x5e0b('0x56')],'as':_0x5e0b('0x54')}]});}return null;})[_0x5e0b('0x26')](respondWithResult(_0xdfedd2,null))[_0x5e0b('0x47')](handleError(_0xdfedd2,null));};function getAccessToken(_0x46c7f9){return new Promise(function(_0x55a140,_0x500908){var _0x3f0137;switch(_0x46c7f9[_0x5e0b('0x57')]){case'US':_0x3f0137=_0x5e0b('0x58');break;case'AU':_0x3f0137=_0x5e0b('0x59');break;case'EU':_0x3f0137='https://accounts.zoho.eu';break;case'IN':_0x3f0137='https://accounts.zoho.in';break;case'CN':_0x3f0137='https://accounts.zoho.com.cn';break;default:_0x3f0137='https://accounts.zoho.eu';break;}var _0x253313={'method':_0x5e0b('0x5a'),'uri':_0x3f0137+_0x5e0b('0x5b'),'qs':{'refresh_token':_0x46c7f9[_0x5e0b('0x5c')],'client_id':_0x46c7f9['clientId'],'client_secret':_0x46c7f9[_0x5e0b('0x5d')],'grant_type':_0x5e0b('0x5e')},'json':!![]};return rp(_0x253313)[_0x5e0b('0x26')](function(_0x333cf2){if(_0x333cf2[_0x5e0b('0x5f')]){_0x55a140(_0x333cf2[_0x5e0b('0x5f')]);}else{_0x500908(_0x5e0b('0x60'));}})[_0x5e0b('0x47')](function(_0x49bcca){_0x500908(_0x49bcca);});});}exports[_0x5e0b('0x61')]=function(_0x4ddde1,_0x45440c,_0x2659fe){var _0x124cc8,_0x370f2c,_0x2ab51f,_0x52bf0d,_0x3b1242;return db[_0x5e0b('0x41')][_0x5e0b('0x4d')]({'where':{'id':_0x4ddde1[_0x5e0b('0x45')]['id']},'attributes':['id',_0x5e0b('0x62'),_0x5e0b('0x57'),_0x5e0b('0x63'),_0x5e0b('0x5d'),_0x5e0b('0x64'),_0x5e0b('0x65'),_0x5e0b('0x5c')]})[_0x5e0b('0x26')](handleEntityNotFound(_0x45440c,null))['then'](function(_0x4953b7){_0x3b1242=_0x4953b7;_0x124cc8=_0x3b1242[_0x5e0b('0x62')];_0x370f2c=_0x124cc8==='zoho.eu'?'eu':'com';_0x2ab51f=_0x3b1242[_0x5e0b('0x64')];var _0x25fcc5=_0x2ab51f[_0x5e0b('0x66')](-0x1);if(_0x25fcc5==='/'||_0x25fcc5==='\x5c'||_0x25fcc5===':'){_0x2ab51f=_0x2ab51f[_0x5e0b('0x67')](0x0,_0x2ab51f[_0x5e0b('0x68')](_0x25fcc5));}if(!_0x3b1242['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x3b1242);})[_0x5e0b('0x26')](function(_0x2ac9e8){if(_0x2ac9e8){return rp({'method':_0x5e0b('0x69'),'uri':util['format'](_0x5e0b('0x6a'),_0x370f2c),'qs':{'module':_0x5e0b('0x6b')},'headers':{'Authorization':_0x5e0b('0x6c')+_0x2ac9e8},'json':!![]});}})[_0x5e0b('0x26')](function(_0x3af97a){if(_0x3af97a){if(_0x3af97a[_0x5e0b('0x6d')]&&_0x3af97a[_0x5e0b('0x6d')]['error']){throw new Error(_0x3af97a['response'][_0x5e0b('0x27')][_0x5e0b('0x6e')]);}var _0x44098c=[];var _0x48db3a=[];var _0x262375=[_0x5e0b('0x6f'),_0x5e0b('0x70'),'Description',_0x5e0b('0x71'),_0x5e0b('0x72'),'Call_Result',_0x5e0b('0x73'),_0x5e0b('0x74')];_0x48db3a=_[_0x5e0b('0x75')](_0x3af97a['fields'],function(_0x468144){return _0x262375[_0x5e0b('0x76')](_0x468144[_0x5e0b('0x77')]);});for(var _0x112515=0x0;_0x112515<_0x48db3a[_0x5e0b('0x36')];_0x112515++){if(_0x48db3a[_0x112515][_0x5e0b('0x78')]===![]){_0x44098c['push']({'id':_0x48db3a[_0x112515]['id'],'name':_0x48db3a[_0x112515][_0x5e0b('0x79')],'custom':_0x48db3a[_0x112515][_0x5e0b('0x7a')],'options':_0x48db3a[_0x112515][_0x5e0b('0x7b')]===_0x5e0b('0x7c')&&_0x48db3a[_0x112515][_0x5e0b('0x7d')][_0x5e0b('0x36')]>-0x1?_[_0x5e0b('0x2a')](_0x48db3a[_0x112515]['pick_list_values'],function(_0x300973){return{'name':_0x300973,'value':_0x300973};}):[]});}}return{'count':_0x44098c[_0x5e0b('0x36')],'rows':_0x44098c};}else{return{'count':0x0,'rows':[]};}})[_0x5e0b('0x26')](respondWithResult(_0x45440c,null))[_0x5e0b('0x47')](function(_0x214631){var _0x23a32d=_0x4ddde1['query'][_0x5e0b('0x7e')]?0x1f4:_0x214631[_0x5e0b('0x7f')]||0x1f4;logger[_0x5e0b('0x27')](_0x5e0b('0x80'),'getFields',_0x23a32d,JSON['stringify'](_0x214631));delete _0x214631['name'];if(_0x23a32d===0x191){_0x23a32d=0x190;}_0x45440c['status'](_0x23a32d)['send'](_0x4ddde1['query'][_0x5e0b('0x7e')]?{'message':_0x5e0b('0x81'),'statusCode':_0x214631[_0x5e0b('0x7f')]}:_0x214631);});}; \ No newline at end of file +var _0x3f97=['merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','sort','filter','length','hasOwnProperty','AccountId','Subjects','channel','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','clientSecret','serverUrl','code','zoho.eu','slice','lastIndexOf','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','includes','api_name','system_mandatory','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','map','ZohoAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','where','pick'];(function(_0x4730f3,_0x284ee0){var _0x573ccb=function(_0x1865bc){while(--_0x1865bc){_0x4730f3['push'](_0x4730f3['shift']());}};_0x573ccb(++_0x284ee0);}(_0x3f97,0xc1));var _0x73f9=function(_0x111012,_0x2d7f0c){_0x111012=_0x111012-0x0;var _0x32cadc=_0x3f97[_0x111012];return _0x32cadc;};'use strict';var emlformat=require(_0x73f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73f9('0x1'));var jsonpatch=require(_0x73f9('0x2'));var rp=require(_0x73f9('0x3'));var moment=require('moment');var BPromise=require(_0x73f9('0x4'));var Mustache=require('mustache');var util=require(_0x73f9('0x5'));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(_0x73f9('0x6'));var _=require(_0x73f9('0x7'));var squel=require(_0x73f9('0x8'));var crypto=require(_0x73f9('0x9'));var jsforce=require(_0x73f9('0xa'));var deskjs=require(_0x73f9('0xb'));var toCsv=require(_0x73f9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x73f9('0xd'));var as=require(_0x73f9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73f9('0xf'))(_0x73f9('0x10'));var utils=require(_0x73f9('0x11'));var config=require(_0x73f9('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x73f9('0x13'))['db'];var integrations=require(_0x73f9('0x14'));function respondWithStatusCode(_0x5f04f9,_0x2bc7c0){_0x2bc7c0=_0x2bc7c0||0xcc;return function(_0x41dd35){if(_0x41dd35){return _0x5f04f9[_0x73f9('0x15')](_0x2bc7c0);}return _0x5f04f9[_0x73f9('0x16')](_0x2bc7c0)[_0x73f9('0x17')]();};}function respondWithResult(_0x1a7896,_0x3fcddf){_0x3fcddf=_0x3fcddf||0xc8;return function(_0x2e749d){if(_0x2e749d){return _0x1a7896['status'](_0x3fcddf)[_0x73f9('0x18')](_0x2e749d);}};}function respondWithFilteredResult(_0x57f038,_0x3c2f4d){return function(_0x5f3600){if(_0x5f3600){var _0x1eac9b=typeof _0x3c2f4d[_0x73f9('0x19')]===_0x73f9('0x1a')&&typeof _0x3c2f4d[_0x73f9('0x1b')]===_0x73f9('0x1a');var _0x1affcf=_0x5f3600[_0x73f9('0x1c')];var _0x547a1c=_0x1eac9b?0x0:_0x3c2f4d['offset'];var _0x10ae5d=_0x1eac9b?_0x5f3600[_0x73f9('0x1c')]:_0x3c2f4d[_0x73f9('0x19')]+_0x3c2f4d[_0x73f9('0x1b')];var _0x4254f8;if(_0x10ae5d>=_0x1affcf){_0x10ae5d=_0x1affcf;_0x4254f8=0xc8;}else{_0x4254f8=0xce;}_0x57f038['status'](_0x4254f8);return _0x57f038[_0x73f9('0x1d')](_0x73f9('0x1e'),_0x547a1c+'-'+_0x10ae5d+'/'+_0x1affcf)[_0x73f9('0x18')](_0x5f3600);}return null;};}function patchUpdates(_0x1c24c8){return function(_0x5ab23a){try{jsonpatch[_0x73f9('0x1f')](_0x5ab23a,_0x1c24c8,!![]);}catch(_0xe4d270){return BPromise[_0x73f9('0x20')](_0xe4d270);}return _0x5ab23a[_0x73f9('0x21')]();};}function saveUpdates(_0x8206b8,_0x581877){return function(_0x3b359d){if(_0x3b359d){return _0x3b359d[_0x73f9('0x22')](_0x8206b8)['then'](function(_0x13ff92){return _0x13ff92;});}return null;};}function removeEntity(_0x363456,_0x231979){return function(_0x59c230){if(_0x59c230){return _0x59c230[_0x73f9('0x23')]()[_0x73f9('0x24')](function(){_0x363456['status'](0xcc)[_0x73f9('0x17')]();});}};}function handleEntityNotFound(_0x5e38c2,_0x253657){return function(_0x356a18){if(!_0x356a18){_0x5e38c2['sendStatus'](0x194);}return _0x356a18;};}function handleError(_0x5e25d0,_0x1e431f){_0x1e431f=_0x1e431f||0x1f4;return function(_0x4cc66b){logger[_0x73f9('0x25')](_0x4cc66b['stack']);if(_0x4cc66b[_0x73f9('0x26')]){delete _0x4cc66b[_0x73f9('0x26')];}_0x5e25d0['status'](_0x1e431f)['send'](_0x4cc66b);};}exports['index']=function(_0x3c3047,_0x3700ab){var _0x4f12b4={},_0x2f4b91={},_0x19c315={'count':0x0,'rows':[]};var _0x93c7fb=_[_0x73f9('0x27')](db[_0x73f9('0x28')][_0x73f9('0x29')],function(_0x1d36e1){return{'name':_0x1d36e1['fieldName'],'type':_0x1d36e1[_0x73f9('0x2a')][_0x73f9('0x2b')]};});_0x2f4b91[_0x73f9('0x2c')]=_[_0x73f9('0x27')](_0x93c7fb,_0x73f9('0x26'));_0x2f4b91['query']=_[_0x73f9('0x2d')](_0x3c3047[_0x73f9('0x2e')]);_0x2f4b91[_0x73f9('0x2f')]=_[_0x73f9('0x30')](_0x2f4b91[_0x73f9('0x2c')],_0x2f4b91[_0x73f9('0x2e')]);_0x4f12b4[_0x73f9('0x31')]=_[_0x73f9('0x30')](_0x2f4b91[_0x73f9('0x2c')],qs[_0x73f9('0x32')](_0x3c3047[_0x73f9('0x2e')][_0x73f9('0x32')]));_0x4f12b4['attributes']=_0x4f12b4[_0x73f9('0x31')]['length']?_0x4f12b4[_0x73f9('0x31')]:_0x2f4b91[_0x73f9('0x2c')];if(!_0x3c3047[_0x73f9('0x2e')]['hasOwnProperty'](_0x73f9('0x33'))){_0x4f12b4[_0x73f9('0x1b')]=qs[_0x73f9('0x1b')](_0x3c3047[_0x73f9('0x2e')]['limit']);_0x4f12b4[_0x73f9('0x19')]=qs[_0x73f9('0x19')](_0x3c3047['query']['offset']);}_0x4f12b4[_0x73f9('0x34')]=qs['sort'](_0x3c3047[_0x73f9('0x2e')]['sort']);_0x4f12b4[_0x73f9('0x35')]=qs['filters'](_[_0x73f9('0x36')](_0x3c3047[_0x73f9('0x2e')],_0x2f4b91[_0x73f9('0x2f')]),_0x93c7fb);if(_0x3c3047[_0x73f9('0x2e')]['filter']){_0x4f12b4[_0x73f9('0x35')]=_[_0x73f9('0x37')](_0x4f12b4[_0x73f9('0x35')],{'$or':_['map'](_0x93c7fb,function(_0x233b04){if(_0x233b04[_0x73f9('0x2a')]!==_0x73f9('0x38')){var _0x56089c={};_0x56089c[_0x233b04['name']]={'$like':'%'+_0x3c3047[_0x73f9('0x2e')]['filter']+'%'};return _0x56089c;}})});}_0x4f12b4=_[_0x73f9('0x37')]({},_0x4f12b4,_0x3c3047['options']);var _0x83a45f={'where':_0x4f12b4[_0x73f9('0x35')]};return db['ZohoAccount']['count'](_0x83a45f)[_0x73f9('0x24')](function(_0x3d93ac){_0x19c315['count']=_0x3d93ac;if(_0x3c3047[_0x73f9('0x2e')]['includeAll']){_0x4f12b4[_0x73f9('0x39')]=[{'all':!![]}];}return db['ZohoAccount'][_0x73f9('0x3a')](_0x4f12b4);})['then'](function(_0x9c816d){_0x19c315[_0x73f9('0x3b')]=_0x9c816d;return _0x19c315;})['then'](respondWithFilteredResult(_0x3700ab,_0x4f12b4))[_0x73f9('0x3c')](handleError(_0x3700ab,null));};exports[_0x73f9('0x3d')]=function(_0x4271af,_0x255e0e){var _0x3fe8a0={'raw':![],'where':{'id':_0x4271af[_0x73f9('0x3e')]['id']}},_0x154e05={};_0x154e05[_0x73f9('0x2c')]=_['keys'](db['ZohoAccount']['rawAttributes']);_0x154e05[_0x73f9('0x2e')]=_[_0x73f9('0x2d')](_0x4271af[_0x73f9('0x2e')]);_0x154e05[_0x73f9('0x2f')]=_[_0x73f9('0x30')](_0x154e05[_0x73f9('0x2c')],_0x154e05[_0x73f9('0x2e')]);_0x3fe8a0[_0x73f9('0x31')]=_['intersection'](_0x154e05[_0x73f9('0x2c')],qs[_0x73f9('0x32')](_0x4271af[_0x73f9('0x2e')][_0x73f9('0x32')]));_0x3fe8a0[_0x73f9('0x31')]=_0x3fe8a0[_0x73f9('0x31')]['length']?_0x3fe8a0[_0x73f9('0x31')]:_0x154e05[_0x73f9('0x2c')];if(_0x4271af[_0x73f9('0x2e')][_0x73f9('0x3f')]){_0x3fe8a0['include']=[{'all':!![]}];}_0x3fe8a0=_['merge']({},_0x3fe8a0,_0x4271af[_0x73f9('0x40')]);return db[_0x73f9('0x28')][_0x73f9('0x41')](_0x3fe8a0)[_0x73f9('0x24')](handleEntityNotFound(_0x255e0e,null))[_0x73f9('0x24')](respondWithResult(_0x255e0e,null))[_0x73f9('0x3c')](handleError(_0x255e0e,null));};exports[_0x73f9('0x42')]=function(_0x4d5146,_0x480d5d){return db['ZohoAccount'][_0x73f9('0x42')](_0x4d5146['body'],{})[_0x73f9('0x24')](respondWithResult(_0x480d5d,0xc9))[_0x73f9('0x3c')](handleError(_0x480d5d,null));};exports['update']=function(_0xce5a8d,_0xc423){if(_0xce5a8d[_0x73f9('0x43')]['id']){delete _0xce5a8d[_0x73f9('0x43')]['id'];}return db['ZohoAccount'][_0x73f9('0x41')]({'where':{'id':_0xce5a8d[_0x73f9('0x3e')]['id']}})[_0x73f9('0x24')](handleEntityNotFound(_0xc423,null))[_0x73f9('0x24')](saveUpdates(_0xce5a8d['body'],null))[_0x73f9('0x24')](respondWithResult(_0xc423,null))['catch'](handleError(_0xc423,null));};exports['destroy']=function(_0x349c0a,_0x50d9da){return db[_0x73f9('0x28')][_0x73f9('0x41')]({'where':{'id':_0x349c0a[_0x73f9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x50d9da,null))['then'](removeEntity(_0x50d9da,null))[_0x73f9('0x3c')](handleError(_0x50d9da,null));};exports[_0x73f9('0x44')]=function(_0x4a6c89,_0x4111f6,_0x28533b){var _0x71c1d0={};var _0x1ab3fa={};var _0x178f7b;var _0x4d0a73;return db['ZohoAccount'][_0x73f9('0x45')]({'where':{'id':_0x4a6c89[_0x73f9('0x3e')]['id']}})[_0x73f9('0x24')](handleEntityNotFound(_0x4111f6,null))[_0x73f9('0x24')](function(_0x29a539){if(_0x29a539){_0x178f7b=_0x29a539;_0x1ab3fa[_0x73f9('0x2c')]=_[_0x73f9('0x2d')](db[_0x73f9('0x46')][_0x73f9('0x29')]);_0x1ab3fa['query']=_[_0x73f9('0x2d')](_0x4a6c89[_0x73f9('0x2e')]);_0x1ab3fa[_0x73f9('0x2f')]=_['intersection'](_0x1ab3fa[_0x73f9('0x2c')],_0x1ab3fa[_0x73f9('0x2e')]);_0x71c1d0[_0x73f9('0x31')]=_['intersection'](_0x1ab3fa[_0x73f9('0x2c')],qs[_0x73f9('0x32')](_0x4a6c89[_0x73f9('0x2e')]['fields']));_0x71c1d0[_0x73f9('0x31')]=_0x71c1d0['attributes']['length']?_0x71c1d0['attributes']:_0x1ab3fa[_0x73f9('0x2c')];_0x71c1d0['order']=qs['sort'](_0x4a6c89['query'][_0x73f9('0x47')]);_0x71c1d0[_0x73f9('0x35')]=qs[_0x73f9('0x2f')](_[_0x73f9('0x36')](_0x4a6c89['query'],_0x1ab3fa[_0x73f9('0x2f')]));if(_0x4a6c89[_0x73f9('0x2e')][_0x73f9('0x48')]){_0x71c1d0['where']=_[_0x73f9('0x37')](_0x71c1d0[_0x73f9('0x35')],{'$or':_['map'](_0x71c1d0[_0x73f9('0x31')],function(_0x3d7bd4){var _0x27465a={};_0x27465a[_0x3d7bd4]={'$like':'%'+_0x4a6c89['query'][_0x73f9('0x48')]+'%'};return _0x27465a;})});}_0x71c1d0=_[_0x73f9('0x37')]({},_0x71c1d0,_0x4a6c89[_0x73f9('0x40')]);return _0x178f7b['getConfigurations'](_0x71c1d0);}})[_0x73f9('0x24')](function(_0x1cbf66){if(_0x1cbf66){_0x4d0a73=_0x1cbf66[_0x73f9('0x49')];if(!_0x4a6c89[_0x73f9('0x2e')][_0x73f9('0x4a')](_0x73f9('0x33'))){_0x71c1d0[_0x73f9('0x1b')]=qs[_0x73f9('0x1b')](_0x4a6c89[_0x73f9('0x2e')]['limit']);_0x71c1d0[_0x73f9('0x19')]=qs['offset'](_0x4a6c89[_0x73f9('0x2e')]['offset']);}return _0x178f7b[_0x73f9('0x44')](_0x71c1d0);}})[_0x73f9('0x24')](function(_0x497f0d){if(_0x497f0d){return _0x497f0d?{'count':_0x4d0a73,'rows':_0x497f0d}:null;}})[_0x73f9('0x24')](respondWithResult(_0x4111f6,null))[_0x73f9('0x3c')](handleError(_0x4111f6,null));};exports['addConfiguration']=function(_0x59384d,_0x5aa771,_0x10f810){if(_0x59384d[_0x73f9('0x43')]['id']){delete _0x59384d['body']['id'];}return db['ZohoAccount'][_0x73f9('0x45')]({'where':{'id':_0x59384d[_0x73f9('0x3e')]['id']}})[_0x73f9('0x24')](handleEntityNotFound(_0x5aa771,null))[_0x73f9('0x24')](function(_0x58f7fc){if(_0x58f7fc){_0x59384d['body'][_0x73f9('0x4b')]=_0x58f7fc['id'];_0x59384d['body'][_0x73f9('0x4c')]=integrations['getSubjects'](_0x59384d[_0x73f9('0x43')][_0x73f9('0x4d')],_0x59384d[_0x73f9('0x43')]['type']);_0x59384d[_0x73f9('0x43')]['Descriptions']=integrations[_0x73f9('0x4e')](_0x59384d[_0x73f9('0x43')][_0x73f9('0x4d')],_0x59384d[_0x73f9('0x43')][_0x73f9('0x2a')]);return db[_0x73f9('0x46')][_0x73f9('0x42')](_0x59384d['body'],{'include':[{'model':db[_0x73f9('0x4f')],'as':'Subjects'},{'model':db[_0x73f9('0x4f')],'as':'Descriptions'}]});}return null;})[_0x73f9('0x24')](respondWithResult(_0x5aa771,null))['catch'](handleError(_0x5aa771,null));};function getAccessToken(_0x4f9699){return new Promise(function(_0x305f4e,_0x1338a0){var _0x4c648d;switch(_0x4f9699['zone']){case'US':_0x4c648d=_0x73f9('0x50');break;case'AU':_0x4c648d=_0x73f9('0x51');break;case'EU':_0x4c648d=_0x73f9('0x52');break;case'IN':_0x4c648d=_0x73f9('0x53');break;case'CN':_0x4c648d=_0x73f9('0x54');break;default:_0x4c648d=_0x73f9('0x52');break;}var _0x5dd925={'method':'POST','uri':_0x4c648d+'/oauth/v2/token','qs':{'refresh_token':_0x4f9699[_0x73f9('0x55')],'client_id':_0x4f9699[_0x73f9('0x56')],'client_secret':_0x4f9699['clientSecret'],'grant_type':_0x73f9('0x57')},'json':!![]};return rp(_0x5dd925)[_0x73f9('0x24')](function(_0x42f53d){if(_0x42f53d[_0x73f9('0x58')]){_0x305f4e(_0x42f53d[_0x73f9('0x58')]);}else{_0x1338a0(_0x73f9('0x59'));}})['catch'](function(_0x2c9b57){_0x1338a0(_0x2c9b57);});});}exports[_0x73f9('0x5a')]=function(_0x5ce967,_0x21e377,_0x494a6e){var _0x2d96ea,_0x4ddee4,_0x18bf1a,_0x47e27d,_0x5adebb;return db[_0x73f9('0x28')][_0x73f9('0x45')]({'where':{'id':_0x5ce967[_0x73f9('0x3e')]['id']},'attributes':['id',_0x73f9('0x5b'),_0x73f9('0x5c'),_0x73f9('0x56'),_0x73f9('0x5d'),_0x73f9('0x5e'),_0x73f9('0x5f'),_0x73f9('0x55')]})[_0x73f9('0x24')](handleEntityNotFound(_0x21e377,null))[_0x73f9('0x24')](function(_0x281dad){_0x5adebb=_0x281dad;_0x2d96ea=_0x5adebb[_0x73f9('0x5b')];_0x4ddee4=_0x2d96ea===_0x73f9('0x60')?'eu':'com';_0x18bf1a=_0x5adebb[_0x73f9('0x5e')];var _0x153606=_0x18bf1a[_0x73f9('0x61')](-0x1);if(_0x153606==='/'||_0x153606==='\x5c'||_0x153606===':'){_0x18bf1a=_0x18bf1a['substring'](0x0,_0x18bf1a[_0x73f9('0x62')](_0x153606));}if(!_0x5adebb[_0x73f9('0x55')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5adebb);})['then'](function(_0x3a26d1){if(_0x3a26d1){return rp({'method':_0x73f9('0x63'),'uri':util[_0x73f9('0x64')](_0x73f9('0x65'),_0x4ddee4),'qs':{'module':'Calls'},'headers':{'Authorization':_0x73f9('0x66')+_0x3a26d1},'json':!![]});}})[_0x73f9('0x24')](function(_0x8d7501){if(_0x8d7501){if(_0x8d7501['response']&&_0x8d7501[_0x73f9('0x67')][_0x73f9('0x25')]){throw new Error(_0x8d7501[_0x73f9('0x67')]['error'][_0x73f9('0x68')]);}var _0x121e16=[];var _0x44a278=[];var _0x3c3d0f=[_0x73f9('0x69'),_0x73f9('0x6a'),_0x73f9('0x6b'),_0x73f9('0x6c'),_0x73f9('0x6d'),_0x73f9('0x6e'),_0x73f9('0x6f'),'Call_Type'];_0x44a278=_['remove'](_0x8d7501['fields'],function(_0x5c5fe0){return _0x3c3d0f[_0x73f9('0x70')](_0x5c5fe0[_0x73f9('0x71')]);});for(var _0x3f830f=0x0;_0x3f830f<_0x44a278['length'];_0x3f830f++){if(_0x44a278[_0x3f830f][_0x73f9('0x72')]===![]){_0x121e16['push']({'id':_0x44a278[_0x3f830f]['id'],'name':_0x44a278[_0x3f830f]['display_label'],'custom':_0x44a278[_0x3f830f][_0x73f9('0x73')],'options':_0x44a278[_0x3f830f][_0x73f9('0x74')]==='picklist'&&_0x44a278[_0x3f830f]['pick_list_values']['length']>-0x1?_['map'](_0x44a278[_0x3f830f][_0x73f9('0x75')],function(_0x2221da){return{'name':_0x2221da,'value':_0x2221da};}):[]});}}return{'count':_0x121e16[_0x73f9('0x49')],'rows':_0x121e16};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x21e377,null))[_0x73f9('0x3c')](function(_0x2d025e){var _0x3b37bd=_0x5ce967[_0x73f9('0x2e')][_0x73f9('0x76')]?0x1f4:_0x2d025e[_0x73f9('0x77')]||0x1f4;logger[_0x73f9('0x25')](_0x73f9('0x78'),_0x73f9('0x5a'),_0x3b37bd,JSON[_0x73f9('0x79')](_0x2d025e));delete _0x2d025e[_0x73f9('0x26')];if(_0x3b37bd===0x191){_0x3b37bd=0x190;}_0x21e377[_0x73f9('0x16')](_0x3b37bd)[_0x73f9('0x7a')](_0x5ce967['query'][_0x73f9('0x76')]?{'message':_0x73f9('0x7b'),'statusCode':_0x2d025e[_0x73f9('0x77')]}:_0x2d025e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6809364..caa3979 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 _0xb600=['host','slice','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','substring','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','catch','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code'];(function(_0x32be78,_0x48f7e9){var _0xf1d1d6=function(_0xadf31a){while(--_0xadf31a){_0x32be78['push'](_0x32be78['shift']());}};_0xf1d1d6(++_0x48f7e9);}(_0xb600,0x1a6));var _0x0b60=function(_0x1c3736,_0x34662d){_0x1c3736=_0x1c3736-0x0;var _0x2a3fd6=_0xb600[_0x1c3736];return _0x2a3fd6;};'use strict';var _=require(_0x0b60('0x0'));var util=require(_0x0b60('0x1'));var logger=require(_0x0b60('0x2'))(_0x0b60('0x3'));var moment=require('moment');var BPromise=require(_0x0b60('0x4'));var rp=require(_0x0b60('0x5'));var fs=require('fs');var path=require(_0x0b60('0x6'));var rimraf=require(_0x0b60('0x7'));var config=require('../../config/environment');var attributes=require(_0x0b60('0x8'));var integrations=require(_0x0b60('0x9'));module[_0x0b60('0xa')]=function(_0x2841ba,_0x5a337e){return _0x2841ba[_0x0b60('0xb')]('ZohoAccount',attributes,{'tableName':_0x0b60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x471a14,_0x345ef8,_0x197c32){if(_0x471a14[_0x0b60('0xd')]('zone')||_0x471a14['changed'](_0x0b60('0xe'))||_0x471a14[_0x0b60('0xd')](_0x0b60('0xf'))||_0x471a14[_0x0b60('0xd')](_0x0b60('0x10'))||_0x471a14['changed'](_0x0b60('0x11'))||_0x471a14[_0x0b60('0xd')](_0x0b60('0x12'))){var _0x5b0667,_0x1606b4;_0x5b0667=_0x471a14[_0x0b60('0xe')];var _0x1b1608=_0x5b0667[_0x0b60('0x13')](-0x1);if(_0x1b1608==='/'||_0x1b1608==='\x5c'||_0x1b1608===':'){_0x5b0667=_0x5b0667['substring'](0x0,_0x5b0667[_0x0b60('0x14')](_0x1b1608));}switch(_0x471a14[_0x0b60('0x15')]){case'US':_0x1606b4=_0x0b60('0x16');break;case'AU':_0x1606b4=_0x0b60('0x17');break;case'IN':_0x1606b4='https://accounts.zoho.in';break;case'CN':_0x1606b4='https://accounts.zoho.com.cn';break;default:_0x1606b4=_0x0b60('0x18');break;}var _0x34e242={'method':_0x0b60('0x19'),'uri':_0x1606b4+'/oauth/v2/token','form':{'grant_type':_0x0b60('0x1a'),'client_id':_0x471a14[_0x0b60('0xf')],'client_secret':_0x471a14[_0x0b60('0x10')],'redirect_uri':_0x471a14[_0x0b60('0xe')],'code':_0x471a14[_0x0b60('0x11')]},'headers':{'Content-Type':_0x0b60('0x1b')}};return rp(_0x34e242)[_0x0b60('0x1c')](function(_0x2bc0a9){var _0x3a32ab=JSON[_0x0b60('0x1d')](_0x2bc0a9);if(_0x3a32ab[_0x0b60('0x1e')]){_0x471a14['refreshToken']=_0x3a32ab[_0x0b60('0x1e')];logger[_0x0b60('0x1f')](util[_0x0b60('0x20')](_0x0b60('0x21'),_0x471a14['name'],_0x471a14['id']));}else{logger[_0x0b60('0x22')](util['format'](_0x0b60('0x23'),_0x471a14[_0x0b60('0x24')],_0x471a14['id']),util[_0x0b60('0x25')](_0x3a32ab,{'showHidden':![],'depth':null}));}return _0x197c32(null,_0x345ef8);})['catch'](function(_0x1c6c96){logger['error'](util[_0x0b60('0x20')](_0x0b60('0x23'),_0x471a14[_0x0b60('0x24')],_0x471a14['id']),util[_0x0b60('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x197c32(_0x1c6c96);});}else{return _0x197c32(null,_0x345ef8);}},'beforeUpdate':function(_0x4caded,_0x4f95ae,_0x564fda){if(_0x4caded['changed'](_0x0b60('0x15'))||_0x4caded[_0x0b60('0xd')](_0x0b60('0xe'))||_0x4caded[_0x0b60('0xd')]('clientId')||_0x4caded[_0x0b60('0xd')](_0x0b60('0x10'))||_0x4caded[_0x0b60('0xd')](_0x0b60('0x11'))||_0x4caded[_0x0b60('0xd')]('host')){var _0x2ea0e1,_0x58f96b;_0x2ea0e1=_0x4caded[_0x0b60('0xe')];var _0x6fa8e4=_0x2ea0e1[_0x0b60('0x13')](-0x1);if(_0x6fa8e4==='/'||_0x6fa8e4==='\x5c'||_0x6fa8e4===':'){_0x2ea0e1=_0x2ea0e1[_0x0b60('0x26')](0x0,_0x2ea0e1[_0x0b60('0x14')](_0x6fa8e4));}switch(_0x4caded['zone']){case'US':_0x58f96b=_0x0b60('0x16');break;case'AU':_0x58f96b=_0x0b60('0x17');break;case'IN':_0x58f96b=_0x0b60('0x27');break;case'CN':_0x58f96b=_0x0b60('0x28');break;default:_0x58f96b=_0x0b60('0x18');break;}var _0x2e5848={'method':_0x0b60('0x19'),'uri':_0x58f96b+_0x0b60('0x29'),'form':{'grant_type':_0x0b60('0x1a'),'client_id':_0x4caded[_0x0b60('0xf')],'client_secret':_0x4caded[_0x0b60('0x10')],'redirect_uri':_0x4caded[_0x0b60('0xe')],'code':_0x4caded[_0x0b60('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2e5848)[_0x0b60('0x1c')](function(_0xc1f239){var _0x36c023=JSON[_0x0b60('0x1d')](_0xc1f239);if(_0x36c023[_0x0b60('0x1e')]){_0x4caded[_0x0b60('0x2a')]=_0x36c023['refresh_token'];logger[_0x0b60('0x1f')](util[_0x0b60('0x20')](_0x0b60('0x21'),_0x4caded[_0x0b60('0x24')],_0x4caded['id']));}else{logger[_0x0b60('0x22')](util[_0x0b60('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4caded[_0x0b60('0x24')],_0x4caded['id']),util[_0x0b60('0x25')](_0x36c023,{'showHidden':![],'depth':null}));}return _0x564fda(null,_0x4f95ae);})[_0x0b60('0x2b')](function(_0x27706b){logger[_0x0b60('0x22')](util[_0x0b60('0x20')](_0x0b60('0x23'),_0x4caded[_0x0b60('0x24')],_0x4caded['id']),util[_0x0b60('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x564fda(_0x27706b);});}else{return _0x564fda(null,_0x4f95ae);}}}});}; \ No newline at end of file +var _0x984d=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','ZohoAccount','changed','zone','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','clientId','application/x-www-form-urlencoded','parse','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','serverUrl','substring','/oauth/v2/token','refreshToken','inspect','catch','lodash','util'];(function(_0x49b693,_0x3a3caf){var _0x381d2a=function(_0x1a42e0){while(--_0x1a42e0){_0x49b693['push'](_0x49b693['shift']());}};_0x381d2a(++_0x3a3caf);}(_0x984d,0xc6));var _0xd984=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x984d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd984('0x0'));var util=require(_0xd984('0x1'));var logger=require(_0xd984('0x2'))('api');var moment=require(_0xd984('0x3'));var BPromise=require(_0xd984('0x4'));var rp=require(_0xd984('0x5'));var fs=require('fs');var path=require(_0xd984('0x6'));var rimraf=require(_0xd984('0x7'));var config=require(_0xd984('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xd984('0x9'));module['exports']=function(_0x4b037c,_0x32c8be){return _0x4b037c[_0xd984('0xa')](_0xd984('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x117496,_0xa8d2ce,_0x3a0be2){if(_0x117496[_0xd984('0xc')](_0xd984('0xd'))||_0x117496[_0xd984('0xc')]('serverUrl')||_0x117496['changed']('clientId')||_0x117496['changed'](_0xd984('0xe'))||_0x117496[_0xd984('0xc')](_0xd984('0xf'))||_0x117496['changed'](_0xd984('0x10'))){var _0x23d8a9,_0x55e1f1;_0x23d8a9=_0x117496['serverUrl'];var _0xa6281b=_0x23d8a9[_0xd984('0x11')](-0x1);if(_0xa6281b==='/'||_0xa6281b==='\x5c'||_0xa6281b===':'){_0x23d8a9=_0x23d8a9['substring'](0x0,_0x23d8a9[_0xd984('0x12')](_0xa6281b));}switch(_0x117496[_0xd984('0xd')]){case'US':_0x55e1f1=_0xd984('0x13');break;case'AU':_0x55e1f1=_0xd984('0x14');break;case'IN':_0x55e1f1='https://accounts.zoho.in';break;case'CN':_0x55e1f1=_0xd984('0x15');break;default:_0x55e1f1=_0xd984('0x16');break;}var _0x121d80={'method':_0xd984('0x17'),'uri':_0x55e1f1+'/oauth/v2/token','form':{'grant_type':_0xd984('0x18'),'client_id':_0x117496[_0xd984('0x19')],'client_secret':_0x117496[_0xd984('0xe')],'redirect_uri':_0x117496['serverUrl'],'code':_0x117496[_0xd984('0xf')]},'headers':{'Content-Type':_0xd984('0x1a')}};return rp(_0x121d80)['then'](function(_0x4adbe2){var _0x4875a9=JSON[_0xd984('0x1b')](_0x4adbe2);if(_0x4875a9[_0xd984('0x1c')]){_0x117496['refreshToken']=_0x4875a9[_0xd984('0x1c')];logger['info'](util[_0xd984('0x1d')](_0xd984('0x1e'),_0x117496[_0xd984('0x1f')],_0x117496['id']));}else{logger[_0xd984('0x20')](util['format'](_0xd984('0x21'),_0x117496[_0xd984('0x1f')],_0x117496['id']),util['inspect'](_0x4875a9,{'showHidden':![],'depth':null}));}return _0x3a0be2(null,_0xa8d2ce);})['catch'](function(_0xb33ed){logger['error'](util[_0xd984('0x1d')](_0xd984('0x21'),_0x117496['name'],_0x117496['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3a0be2(_0xb33ed);});}else{return _0x3a0be2(null,_0xa8d2ce);}},'beforeUpdate':function(_0x590850,_0x3b7fb5,_0x381040){if(_0x590850[_0xd984('0xc')](_0xd984('0xd'))||_0x590850[_0xd984('0xc')](_0xd984('0x22'))||_0x590850['changed']('clientId')||_0x590850[_0xd984('0xc')]('clientSecret')||_0x590850[_0xd984('0xc')]('code')||_0x590850[_0xd984('0xc')]('host')){var _0x25fa26,_0x20ca56;_0x25fa26=_0x590850['serverUrl'];var _0x4546c2=_0x25fa26[_0xd984('0x11')](-0x1);if(_0x4546c2==='/'||_0x4546c2==='\x5c'||_0x4546c2===':'){_0x25fa26=_0x25fa26[_0xd984('0x23')](0x0,_0x25fa26[_0xd984('0x12')](_0x4546c2));}switch(_0x590850[_0xd984('0xd')]){case'US':_0x20ca56='https://accounts.zoho.com';break;case'AU':_0x20ca56=_0xd984('0x14');break;case'IN':_0x20ca56='https://accounts.zoho.in';break;case'CN':_0x20ca56='https://accounts.zoho.com.cn';break;default:_0x20ca56='https://accounts.zoho.eu';break;}var _0x41d4b4={'method':_0xd984('0x17'),'uri':_0x20ca56+_0xd984('0x24'),'form':{'grant_type':_0xd984('0x18'),'client_id':_0x590850[_0xd984('0x19')],'client_secret':_0x590850[_0xd984('0xe')],'redirect_uri':_0x590850[_0xd984('0x22')],'code':_0x590850[_0xd984('0xf')]},'headers':{'Content-Type':_0xd984('0x1a')}};return rp(_0x41d4b4)['then'](function(_0x5c0fcc){var _0x121722=JSON[_0xd984('0x1b')](_0x5c0fcc);if(_0x121722[_0xd984('0x1c')]){_0x590850[_0xd984('0x25')]=_0x121722[_0xd984('0x1c')];logger['info'](util[_0xd984('0x1d')](_0xd984('0x1e'),_0x590850[_0xd984('0x1f')],_0x590850['id']));}else{logger[_0xd984('0x20')](util[_0xd984('0x1d')](_0xd984('0x21'),_0x590850[_0xd984('0x1f')],_0x590850['id']),util[_0xd984('0x26')](_0x121722,{'showHidden':![],'depth':null}));}return _0x381040(null,_0x3b7fb5);})[_0xd984('0x27')](function(_0x3bdeda){logger[_0xd984('0x20')](util[_0xd984('0x1d')](_0xd984('0x21'),_0x590850['name'],_0x590850['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x381040(_0x3bdeda);});}else{return _0x381040(null,_0x3b7fb5);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 701f6b2..4e49f49 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 _0x72a1=['GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','find','ShowZohoAccount','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72a1,0x1ce));var _0x172a=function(_0x5b2b69,_0x4b278e){_0x5b2b69=_0x5b2b69-0x0;var _0x210a10=_0x72a1[_0x5b2b69];return _0x210a10;};'use strict';var _=require('lodash');var util=require(_0x172a('0x0'));var moment=require('moment');var BPromise=require(_0x172a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x172a('0x2'));var db=require(_0x172a('0x3'))['db'];var utils=require(_0x172a('0x4'));var logger=require('../../config/logger')(_0x172a('0x5'));var config=require('../../config/environment');var jayson=require(_0x172a('0x6'));var client=jayson['client'][_0x172a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4859e1,_0x15e050,_0x5bf691){return new BPromise(function(_0x1164c1,_0x3efa61){return client['request'](_0x4859e1,_0x5bf691)[_0x172a('0x8')](function(_0x4928a6){logger[_0x172a('0x9')](_0x172a('0xa'),_0x15e050,_0x172a('0xb'));logger['debug'](_0x172a('0xc'),_0x15e050,_0x172a('0xb'),JSON[_0x172a('0xd')](_0x4928a6));if(_0x4928a6[_0x172a('0xe')]){if(_0x4928a6[_0x172a('0xe')]['code']===0x1f4){logger[_0x172a('0xe')](_0x172a('0xa'),_0x15e050,_0x4928a6[_0x172a('0xe')][_0x172a('0xf')]);return _0x3efa61(_0x4928a6['error'][_0x172a('0xf')]);}logger[_0x172a('0xe')](_0x172a('0xa'),_0x15e050,_0x4928a6['error'][_0x172a('0xf')]);return _0x1164c1(_0x4928a6[_0x172a('0xe')][_0x172a('0xf')]);}else{logger[_0x172a('0x9')]('ZohoAccount,\x20%s,\x20%s',_0x15e050,_0x172a('0xb'));_0x1164c1(_0x4928a6[_0x172a('0x10')]['message']);}})[_0x172a('0x11')](function(_0x489d1c){logger[_0x172a('0xe')](_0x172a('0xa'),_0x15e050,_0x489d1c);_0x3efa61(_0x489d1c);});});}exports[_0x172a('0x12')]=function(_0x5ad6ec){var _0x159f29=this;return new Promise(function(_0x232c5b,_0x312bac){return db[_0x172a('0x13')][_0x172a('0x14')]({'raw':_0x5ad6ec[_0x172a('0x15')]?_0x5ad6ec[_0x172a('0x15')][_0x172a('0x16')]===undefined?!![]:![]:!![],'where':_0x5ad6ec['options']?_0x5ad6ec['options'][_0x172a('0x17')]||null:null,'attributes':_0x5ad6ec[_0x172a('0x15')]?_0x5ad6ec[_0x172a('0x15')][_0x172a('0x18')]||null:null,'limit':_0x5ad6ec[_0x172a('0x15')]?_0x5ad6ec[_0x172a('0x15')][_0x172a('0x19')]||null:null,'include':_0x5ad6ec[_0x172a('0x15')]?_0x5ad6ec['options']['include']?_[_0x172a('0x1a')](_0x5ad6ec[_0x172a('0x15')][_0x172a('0x1b')],function(_0x3fb66d){return{'model':db[_0x3fb66d['model']],'as':_0x3fb66d['as'],'attributes':_0x3fb66d['attributes'],'include':_0x3fb66d[_0x172a('0x1b')]?_[_0x172a('0x1a')](_0x3fb66d[_0x172a('0x1b')],function(_0x52a9df){return{'model':db[_0x52a9df['model']],'as':_0x52a9df['as'],'attributes':_0x52a9df['attributes'],'include':_0x52a9df[_0x172a('0x1b')]?_[_0x172a('0x1a')](_0x52a9df[_0x172a('0x1b')],function(_0x250bad){return{'model':db[_0x250bad[_0x172a('0x1c')]],'as':_0x250bad['as'],'attributes':_0x250bad[_0x172a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x172a('0x8')](function(_0xf6086){logger[_0x172a('0x9')](_0x172a('0x12'),_0x5ad6ec);logger[_0x172a('0x1d')](_0x172a('0x12'),_0x5ad6ec,JSON[_0x172a('0xd')](_0xf6086));_0x232c5b(_0xf6086);})[_0x172a('0x11')](function(_0x5c8699){logger[_0x172a('0xe')](_0x172a('0x12'),_0x5c8699[_0x172a('0xf')],_0x5ad6ec);_0x312bac(_0x159f29[_0x172a('0xe')](0x1f4,_0x5c8699['message']));});});};exports['ShowZohoAccount']=function(_0x585b09){var _0x473ca2=this;return new Promise(function(_0x876b16,_0x569e25){return db['ZohoAccount'][_0x172a('0x1e')]({'raw':_0x585b09[_0x172a('0x15')]?_0x585b09[_0x172a('0x15')][_0x172a('0x16')]===undefined?!![]:![]:!![],'where':_0x585b09[_0x172a('0x15')]?_0x585b09[_0x172a('0x15')][_0x172a('0x17')]||null:null,'attributes':_0x585b09[_0x172a('0x15')]?_0x585b09[_0x172a('0x15')][_0x172a('0x18')]||null:null,'include':_0x585b09[_0x172a('0x15')]?_0x585b09[_0x172a('0x15')][_0x172a('0x1b')]?_[_0x172a('0x1a')](_0x585b09[_0x172a('0x15')][_0x172a('0x1b')],function(_0x5a6fab){return{'model':db[_0x5a6fab['model']],'as':_0x5a6fab['as'],'attributes':_0x5a6fab[_0x172a('0x18')],'include':_0x5a6fab[_0x172a('0x1b')]?_[_0x172a('0x1a')](_0x5a6fab[_0x172a('0x1b')],function(_0x58ae27){return{'model':db[_0x58ae27[_0x172a('0x1c')]],'as':_0x58ae27['as'],'attributes':_0x58ae27[_0x172a('0x18')],'include':_0x58ae27[_0x172a('0x1b')]?_['map'](_0x58ae27['include'],function(_0x5a2d2b){return{'model':db[_0x5a2d2b[_0x172a('0x1c')]],'as':_0x5a2d2b['as'],'attributes':_0x5a2d2b[_0x172a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x172a('0x8')](function(_0x4e7fcf){logger[_0x172a('0x9')](_0x172a('0x1f'),_0x585b09);logger['debug'](_0x172a('0x1f'),_0x585b09,JSON[_0x172a('0xd')](_0x4e7fcf));_0x876b16(_0x4e7fcf);})[_0x172a('0x11')](function(_0xa00627){logger[_0x172a('0xe')]('ShowZohoAccount',_0xa00627[_0x172a('0xf')],_0x585b09);_0x569e25(_0x473ca2['error'](0x1f4,_0xa00627[_0x172a('0xf')]));});});}; \ No newline at end of file +var _0x672a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetZohoAccount','ZohoAccount','findAll','options','raw','where','limit','map','include','model','attributes','ShowZohoAccount','find','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1198a7,_0x58ca47){var _0x34e937=function(_0x38ee9b){while(--_0x38ee9b){_0x1198a7['push'](_0x1198a7['shift']());}};_0x34e937(++_0x58ca47);}(_0x672a,0x122));var _0xa672=function(_0x51a580,_0x27ce7a){_0x51a580=_0x51a580-0x0;var _0x34254e=_0x672a[_0x51a580];return _0x34254e;};'use strict';var _=require(_0xa672('0x0'));var util=require(_0xa672('0x1'));var moment=require(_0xa672('0x2'));var BPromise=require(_0xa672('0x3'));var rs=require(_0xa672('0x4'));var fs=require('fs');var Redis=require(_0xa672('0x5'));var db=require(_0xa672('0x6'))['db'];var utils=require(_0xa672('0x7'));var logger=require(_0xa672('0x8'))(_0xa672('0x9'));var config=require(_0xa672('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa672('0xb')][_0xa672('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a4797,_0x33dd0c,_0x13402c){return new BPromise(function(_0x3f18d8,_0x338516){return client[_0xa672('0xd')](_0x3a4797,_0x13402c)[_0xa672('0xe')](function(_0x370f20){logger[_0xa672('0xf')](_0xa672('0x10'),_0x33dd0c,_0xa672('0x11'));logger[_0xa672('0x12')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x33dd0c,_0xa672('0x11'),JSON[_0xa672('0x13')](_0x370f20));if(_0x370f20['error']){if(_0x370f20[_0xa672('0x14')][_0xa672('0x15')]===0x1f4){logger[_0xa672('0x14')](_0xa672('0x10'),_0x33dd0c,_0x370f20[_0xa672('0x14')][_0xa672('0x16')]);return _0x338516(_0x370f20[_0xa672('0x14')][_0xa672('0x16')]);}logger[_0xa672('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x33dd0c,_0x370f20[_0xa672('0x14')][_0xa672('0x16')]);return _0x3f18d8(_0x370f20['error']['message']);}else{logger[_0xa672('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x33dd0c,'request\x20sent');_0x3f18d8(_0x370f20['result'][_0xa672('0x16')]);}})['catch'](function(_0x5a98a4){logger[_0xa672('0x14')](_0xa672('0x10'),_0x33dd0c,_0x5a98a4);_0x338516(_0x5a98a4);});});}exports[_0xa672('0x17')]=function(_0xc5eeb3){var _0x929a34=this;return new Promise(function(_0x10dc1c,_0x213861){return db[_0xa672('0x18')][_0xa672('0x19')]({'raw':_0xc5eeb3[_0xa672('0x1a')]?_0xc5eeb3['options'][_0xa672('0x1b')]===undefined?!![]:![]:!![],'where':_0xc5eeb3[_0xa672('0x1a')]?_0xc5eeb3[_0xa672('0x1a')][_0xa672('0x1c')]||null:null,'attributes':_0xc5eeb3[_0xa672('0x1a')]?_0xc5eeb3[_0xa672('0x1a')]['attributes']||null:null,'limit':_0xc5eeb3[_0xa672('0x1a')]?_0xc5eeb3[_0xa672('0x1a')][_0xa672('0x1d')]||null:null,'include':_0xc5eeb3[_0xa672('0x1a')]?_0xc5eeb3[_0xa672('0x1a')]['include']?_[_0xa672('0x1e')](_0xc5eeb3[_0xa672('0x1a')][_0xa672('0x1f')],function(_0x47000f){return{'model':db[_0x47000f['model']],'as':_0x47000f['as'],'attributes':_0x47000f['attributes'],'include':_0x47000f[_0xa672('0x1f')]?_['map'](_0x47000f[_0xa672('0x1f')],function(_0x31f755){return{'model':db[_0x31f755[_0xa672('0x20')]],'as':_0x31f755['as'],'attributes':_0x31f755[_0xa672('0x21')],'include':_0x31f755[_0xa672('0x1f')]?_[_0xa672('0x1e')](_0x31f755['include'],function(_0x5388f1){return{'model':db[_0x5388f1[_0xa672('0x20')]],'as':_0x5388f1['as'],'attributes':_0x5388f1[_0xa672('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa672('0xe')](function(_0x5d3d6a){logger[_0xa672('0xf')](_0xa672('0x17'),_0xc5eeb3);logger['debug'](_0xa672('0x17'),_0xc5eeb3,JSON[_0xa672('0x13')](_0x5d3d6a));_0x10dc1c(_0x5d3d6a);})['catch'](function(_0x210c42){logger[_0xa672('0x14')](_0xa672('0x17'),_0x210c42[_0xa672('0x16')],_0xc5eeb3);_0x213861(_0x929a34[_0xa672('0x14')](0x1f4,_0x210c42[_0xa672('0x16')]));});});};exports[_0xa672('0x22')]=function(_0x1250eb){var _0x48ccf3=this;return new Promise(function(_0x89250e,_0x1bae9f){return db[_0xa672('0x18')][_0xa672('0x23')]({'raw':_0x1250eb[_0xa672('0x1a')]?_0x1250eb[_0xa672('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1250eb[_0xa672('0x1a')]?_0x1250eb['options'][_0xa672('0x1c')]||null:null,'attributes':_0x1250eb[_0xa672('0x1a')]?_0x1250eb[_0xa672('0x1a')][_0xa672('0x21')]||null:null,'include':_0x1250eb[_0xa672('0x1a')]?_0x1250eb['options']['include']?_['map'](_0x1250eb[_0xa672('0x1a')]['include'],function(_0x1720a9){return{'model':db[_0x1720a9[_0xa672('0x20')]],'as':_0x1720a9['as'],'attributes':_0x1720a9[_0xa672('0x21')],'include':_0x1720a9[_0xa672('0x1f')]?_['map'](_0x1720a9[_0xa672('0x1f')],function(_0x10f785){return{'model':db[_0x10f785[_0xa672('0x20')]],'as':_0x10f785['as'],'attributes':_0x10f785[_0xa672('0x21')],'include':_0x10f785['include']?_['map'](_0x10f785[_0xa672('0x1f')],function(_0x23165c){return{'model':db[_0x23165c[_0xa672('0x20')]],'as':_0x23165c['as'],'attributes':_0x23165c[_0xa672('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa672('0xe')](function(_0x38681b){logger['info'](_0xa672('0x22'),_0x1250eb);logger['debug'](_0xa672('0x22'),_0x1250eb,JSON[_0xa672('0x13')](_0x38681b));_0x89250e(_0x38681b);})[_0xa672('0x24')](function(_0x196cbd){logger[_0xa672('0x14')](_0xa672('0x22'),_0x196cbd['message'],_0x1250eb);_0x1bae9f(_0x48ccf3['error'](0x1f4,_0x196cbd[_0xa672('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 8ce4a3f..e38330f 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 _0x68c5=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x57d311,_0x1d4157){var _0x23ae1b=function(_0x17ad6c){while(--_0x17ad6c){_0x57d311['push'](_0x57d311['shift']());}};_0x23ae1b(++_0x1d4157);}(_0x68c5,0xc4));var _0x568c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x68c5[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x568c('0x0'));var util=require('util');var path=require(_0x568c('0x1'));var timeout=require(_0x568c('0x2'));var express=require(_0x568c('0x3'));var router=express[_0x568c('0x4')]();var fs_extra=require(_0x568c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x568c('0x6'));var controller=require(_0x568c('0x7'));router[_0x568c('0x8')]('/',auth[_0x568c('0x9')](),controller[_0x568c('0xa')]);router[_0x568c('0x8')](_0x568c('0xb'),auth[_0x568c('0x9')](),controller[_0x568c('0xc')]);router['get'](_0x568c('0xd'),auth[_0x568c('0x9')](),controller['getFields']);router[_0x568c('0x8')](_0x568c('0xe'),auth['isAuthenticated'](),controller[_0x568c('0xf')]);router[_0x568c('0x8')](_0x568c('0x10'),auth['isAuthenticated'](),controller[_0x568c('0x11')]);router[_0x568c('0x12')]('/',auth[_0x568c('0x9')](),controller[_0x568c('0x13')]);router[_0x568c('0x14')]('/:id',auth[_0x568c('0x9')](),controller[_0x568c('0x15')]);router[_0x568c('0x16')](_0x568c('0xb'),auth[_0x568c('0x9')](),controller[_0x568c('0x17')]);module['exports']=router; \ No newline at end of file +var _0x77b1=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','get'];(function(_0x5ca1e4,_0x71441c){var _0x3246b1=function(_0x5e3171){while(--_0x5e3171){_0x5ca1e4['push'](_0x5ca1e4['shift']());}};_0x3246b1(++_0x71441c);}(_0x77b1,0x1f0));var _0x177b=function(_0x307fb2,_0x56b243){_0x307fb2=_0x307fb2-0x0;var _0x6e7895=_0x77b1[_0x307fb2];return _0x6e7895;};'use strict';var multer=require(_0x177b('0x0'));var util=require(_0x177b('0x1'));var path=require('path');var timeout=require(_0x177b('0x2'));var express=require(_0x177b('0x3'));var router=express[_0x177b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x177b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x177b('0x6'));var controller=require(_0x177b('0x7'));router['get']('/',auth[_0x177b('0x8')](),controller['index']);router[_0x177b('0x9')](_0x177b('0xa'),auth['isAuthenticated'](),controller[_0x177b('0xb')]);router[_0x177b('0x9')](_0x177b('0xc'),auth['isAuthenticated'](),controller[_0x177b('0xd')]);router[_0x177b('0x9')](_0x177b('0xe'),auth['isAuthenticated'](),controller[_0x177b('0xf')]);router[_0x177b('0x9')](_0x177b('0x10'),auth[_0x177b('0x8')](),controller[_0x177b('0x11')]);router[_0x177b('0x12')]('/',auth[_0x177b('0x8')](),controller[_0x177b('0x13')]);router[_0x177b('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x177b('0xa'),auth['isAuthenticated'](),controller[_0x177b('0x15')]);module[_0x177b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 4afe012..f2c0d0e 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 _0x130f=['lead','contact','contact_lead','STRING','sequelize','ENUM'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x130f,0xbe));var _0xf130=function(_0x88fee3,_0x3a7ef6){_0x88fee3=_0x88fee3-0x0;var _0x678a2e=_0x130f[_0x88fee3];return _0x678a2e;};'use strict';var Sequelize=require(_0xf130('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xf130('0x1')](_0xf130('0x2'),_0xf130('0x3'),'nothing'),'defaultValue':_0xf130('0x2')},'moduleSearch':{'type':Sequelize[_0xf130('0x1')]('contact_lead',_0xf130('0x3'),'lead'),'defaultValue':_0xf130('0x4')},'description':{'type':Sequelize[_0xf130('0x5')]}}; \ No newline at end of file +var _0x2069=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x2069,0x130));var _0x9206=function(_0x132c4c,_0x459603){_0x132c4c=_0x132c4c-0x0;var _0x280778=_0x2069[_0x132c4c];return _0x280778;};'use strict';var Sequelize=require(_0x9206('0x0'));module[_0x9206('0x1')]={'name':{'type':Sequelize[_0x9206('0x2')]},'moduleCreate':{'type':Sequelize[_0x9206('0x3')](_0x9206('0x4'),_0x9206('0x5'),_0x9206('0x6')),'defaultValue':_0x9206('0x4')},'moduleSearch':{'type':Sequelize[_0x9206('0x3')](_0x9206('0x7'),_0x9206('0x5'),_0x9206('0x4')),'defaultValue':_0x9206('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index e4451bf..4005f71 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 _0xb216=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','create','body','find','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ZohoConfiguration','fieldName','type','key'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xb216,0x15d));var _0x6b21=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xb216[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b21('0x0'));var zipdir=require(_0x6b21('0x1'));var jsonpatch=require(_0x6b21('0x2'));var rp=require('request-promise');var moment=require(_0x6b21('0x3'));var BPromise=require(_0x6b21('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6b21('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b21('0x6'));var _=require(_0x6b21('0x7'));var squel=require(_0x6b21('0x8'));var crypto=require(_0x6b21('0x9'));var jsforce=require(_0x6b21('0xa'));var deskjs=require(_0x6b21('0xb'));var toCsv=require(_0x6b21('0xc'));var querystring=require('querystring');var Papa=require(_0x6b21('0xd'));var Redis=require(_0x6b21('0xe'));var authService=require(_0x6b21('0xf'));var qs=require(_0x6b21('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b21('0x11'));var logger=require(_0x6b21('0x12'))(_0x6b21('0x13'));var utils=require('../../config/utils');var config=require(_0x6b21('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b21('0x15'))['db'];function respondWithStatusCode(_0x5c1917,_0x25be65){_0x25be65=_0x25be65||0xcc;return function(_0x5ec936){if(_0x5ec936){return _0x5c1917[_0x6b21('0x16')](_0x25be65);}return _0x5c1917[_0x6b21('0x17')](_0x25be65)[_0x6b21('0x18')]();};}function respondWithResult(_0x28aef9,_0x1f8cc8){_0x1f8cc8=_0x1f8cc8||0xc8;return function(_0x379113){if(_0x379113){return _0x28aef9[_0x6b21('0x17')](_0x1f8cc8)[_0x6b21('0x19')](_0x379113);}};}function respondWithFilteredResult(_0x3b5697,_0xc27e3){return function(_0x242795){if(_0x242795){var _0x1117af=typeof _0xc27e3[_0x6b21('0x1a')]===_0x6b21('0x1b')&&typeof _0xc27e3[_0x6b21('0x1c')]==='undefined';var _0x3046e0=_0x242795[_0x6b21('0x1d')];var _0x344532=_0x1117af?0x0:_0xc27e3[_0x6b21('0x1a')];var _0x3b5f18=_0x1117af?_0x242795['count']:_0xc27e3[_0x6b21('0x1a')]+_0xc27e3[_0x6b21('0x1c')];var _0x95235b;if(_0x3b5f18>=_0x3046e0){_0x3b5f18=_0x3046e0;_0x95235b=0xc8;}else{_0x95235b=0xce;}_0x3b5697[_0x6b21('0x17')](_0x95235b);return _0x3b5697[_0x6b21('0x1e')](_0x6b21('0x1f'),_0x344532+'-'+_0x3b5f18+'/'+_0x3046e0)['json'](_0x242795);}return null;};}function patchUpdates(_0x31b234){return function(_0xe03457){try{jsonpatch[_0x6b21('0x20')](_0xe03457,_0x31b234,!![]);}catch(_0x5b266e){return BPromise[_0x6b21('0x21')](_0x5b266e);}return _0xe03457[_0x6b21('0x22')]();};}function saveUpdates(_0x4c2026,_0x3f1d4c){return function(_0x150a6e){if(_0x150a6e){return _0x150a6e[_0x6b21('0x23')](_0x4c2026)[_0x6b21('0x24')](function(_0x5c6f66){return _0x5c6f66;});}return null;};}function removeEntity(_0x3a1d9e,_0x10b20b){return function(_0x314e1a){if(_0x314e1a){return _0x314e1a[_0x6b21('0x25')]()[_0x6b21('0x24')](function(){_0x3a1d9e[_0x6b21('0x17')](0xcc)[_0x6b21('0x18')]();});}};}function handleEntityNotFound(_0x570b8c,_0x1cabd7){return function(_0x36e122){if(!_0x36e122){_0x570b8c['sendStatus'](0x194);}return _0x36e122;};}function handleError(_0x1bf54e,_0x564be1){_0x564be1=_0x564be1||0x1f4;return function(_0x347ac2){logger['error'](_0x347ac2[_0x6b21('0x26')]);if(_0x347ac2[_0x6b21('0x27')]){delete _0x347ac2[_0x6b21('0x27')];}_0x1bf54e[_0x6b21('0x17')](_0x564be1)['send'](_0x347ac2);};}exports[_0x6b21('0x28')]=function(_0x4d5b25,_0x5d3268){var _0x4e6b4b={},_0x2f158f={},_0x17e331={'count':0x0,'rows':[]};var _0x4f06ad=_[_0x6b21('0x29')](db[_0x6b21('0x2a')]['rawAttributes'],function(_0x3740e2){return{'name':_0x3740e2[_0x6b21('0x2b')],'type':_0x3740e2[_0x6b21('0x2c')][_0x6b21('0x2d')]};});_0x2f158f[_0x6b21('0x2e')]=_[_0x6b21('0x29')](_0x4f06ad,_0x6b21('0x27'));_0x2f158f[_0x6b21('0x2f')]=_[_0x6b21('0x30')](_0x4d5b25[_0x6b21('0x2f')]);_0x2f158f[_0x6b21('0x31')]=_[_0x6b21('0x32')](_0x2f158f[_0x6b21('0x2e')],_0x2f158f[_0x6b21('0x2f')]);_0x4e6b4b[_0x6b21('0x33')]=_['intersection'](_0x2f158f[_0x6b21('0x2e')],qs[_0x6b21('0x34')](_0x4d5b25[_0x6b21('0x2f')][_0x6b21('0x34')]));_0x4e6b4b[_0x6b21('0x33')]=_0x4e6b4b[_0x6b21('0x33')]['length']?_0x4e6b4b[_0x6b21('0x33')]:_0x2f158f[_0x6b21('0x2e')];if(!_0x4d5b25[_0x6b21('0x2f')][_0x6b21('0x35')](_0x6b21('0x36'))){_0x4e6b4b[_0x6b21('0x1c')]=qs['limit'](_0x4d5b25[_0x6b21('0x2f')]['limit']);_0x4e6b4b[_0x6b21('0x1a')]=qs[_0x6b21('0x1a')](_0x4d5b25[_0x6b21('0x2f')][_0x6b21('0x1a')]);}_0x4e6b4b[_0x6b21('0x37')]=qs[_0x6b21('0x38')](_0x4d5b25[_0x6b21('0x2f')][_0x6b21('0x38')]);_0x4e6b4b['where']=qs['filters'](_[_0x6b21('0x39')](_0x4d5b25[_0x6b21('0x2f')],_0x2f158f[_0x6b21('0x31')]),_0x4f06ad);if(_0x4d5b25[_0x6b21('0x2f')][_0x6b21('0x3a')]){_0x4e6b4b[_0x6b21('0x3b')]=_[_0x6b21('0x3c')](_0x4e6b4b[_0x6b21('0x3b')],{'$or':_[_0x6b21('0x29')](_0x4f06ad,function(_0x31355c){if(_0x31355c[_0x6b21('0x2c')]!==_0x6b21('0x3d')){var _0x4ab94f={};_0x4ab94f[_0x31355c[_0x6b21('0x27')]]={'$like':'%'+_0x4d5b25[_0x6b21('0x2f')]['filter']+'%'};return _0x4ab94f;}})});}_0x4e6b4b=_[_0x6b21('0x3c')]({},_0x4e6b4b,_0x4d5b25[_0x6b21('0x3e')]);var _0xeef57f={'where':_0x4e6b4b[_0x6b21('0x3b')]};return db[_0x6b21('0x2a')][_0x6b21('0x1d')](_0xeef57f)[_0x6b21('0x24')](function(_0x2da899){_0x17e331['count']=_0x2da899;if(_0x4d5b25[_0x6b21('0x2f')][_0x6b21('0x3f')]){_0x4e6b4b[_0x6b21('0x40')]=[{'all':!![]}];}return db[_0x6b21('0x2a')][_0x6b21('0x41')](_0x4e6b4b);})[_0x6b21('0x24')](function(_0x579f24){_0x17e331['rows']=_0x579f24;return _0x17e331;})['then'](respondWithFilteredResult(_0x5d3268,_0x4e6b4b))[_0x6b21('0x42')](handleError(_0x5d3268,null));};exports[_0x6b21('0x43')]=function(_0x48e368,_0x2fcf62){var _0x33c985={'raw':![],'where':{'id':_0x48e368[_0x6b21('0x44')]['id']}},_0x186434={};_0x186434['model']=_['keys'](db[_0x6b21('0x2a')][_0x6b21('0x45')]);_0x186434['query']=_[_0x6b21('0x30')](_0x48e368[_0x6b21('0x2f')]);_0x186434['filters']=_[_0x6b21('0x32')](_0x186434['model'],_0x186434[_0x6b21('0x2f')]);_0x33c985[_0x6b21('0x33')]=_['intersection'](_0x186434[_0x6b21('0x2e')],qs[_0x6b21('0x34')](_0x48e368[_0x6b21('0x2f')][_0x6b21('0x34')]));_0x33c985['attributes']=_0x33c985[_0x6b21('0x33')][_0x6b21('0x46')]?_0x33c985[_0x6b21('0x33')]:_0x186434[_0x6b21('0x2e')];if(_0x48e368[_0x6b21('0x2f')]['includeAll']){_0x33c985[_0x6b21('0x40')]=[{'all':!![]}];}_0x33c985=_[_0x6b21('0x3c')]({},_0x33c985,_0x48e368['options']);return db['ZohoConfiguration']['find'](_0x33c985)[_0x6b21('0x24')](handleEntityNotFound(_0x2fcf62,null))[_0x6b21('0x24')](respondWithResult(_0x2fcf62,null))['catch'](handleError(_0x2fcf62,null));};exports[_0x6b21('0x47')]=function(_0x292048,_0x88856d){return db[_0x6b21('0x2a')][_0x6b21('0x47')](_0x292048[_0x6b21('0x48')],{})[_0x6b21('0x24')](respondWithResult(_0x88856d,0xc9))[_0x6b21('0x42')](handleError(_0x88856d,null));};exports[_0x6b21('0x23')]=function(_0xadf1ee,_0x5e1d86){if(_0xadf1ee['body']['id']){delete _0xadf1ee[_0x6b21('0x48')]['id'];}return db['ZohoConfiguration'][_0x6b21('0x49')]({'where':{'id':_0xadf1ee[_0x6b21('0x44')]['id']}})[_0x6b21('0x24')](handleEntityNotFound(_0x5e1d86,null))[_0x6b21('0x24')](saveUpdates(_0xadf1ee['body'],null))[_0x6b21('0x24')](respondWithResult(_0x5e1d86,null))[_0x6b21('0x42')](handleError(_0x5e1d86,null));};exports[_0x6b21('0x25')]=function(_0x49ceb3,_0x181d17){return db[_0x6b21('0x2a')][_0x6b21('0x49')]({'where':{'id':_0x49ceb3['params']['id']}})[_0x6b21('0x24')](handleEntityNotFound(_0x181d17,null))[_0x6b21('0x24')](removeEntity(_0x181d17,null))['catch'](handleError(_0x181d17,null));};exports[_0x6b21('0x4a')]=function(_0x12be71,_0x33a8f0,_0x395fe4){var _0x56fd1e={};var _0x1fb1bd={};var _0x5aa8cf;var _0x1e511e;return db[_0x6b21('0x2a')][_0x6b21('0x4b')]({'where':{'id':_0x12be71[_0x6b21('0x44')]['id']}})[_0x6b21('0x24')](handleEntityNotFound(_0x33a8f0,null))[_0x6b21('0x24')](function(_0x268ed){if(_0x268ed){_0x5aa8cf=_0x268ed;_0x1fb1bd[_0x6b21('0x2e')]=_[_0x6b21('0x30')](db[_0x6b21('0x4c')][_0x6b21('0x45')]);_0x1fb1bd['query']=_['keys'](_0x12be71[_0x6b21('0x2f')]);_0x1fb1bd[_0x6b21('0x31')]=_[_0x6b21('0x32')](_0x1fb1bd[_0x6b21('0x2e')],_0x1fb1bd[_0x6b21('0x2f')]);_0x56fd1e[_0x6b21('0x33')]=_[_0x6b21('0x32')](_0x1fb1bd['model'],qs[_0x6b21('0x34')](_0x12be71[_0x6b21('0x2f')][_0x6b21('0x34')]));_0x56fd1e[_0x6b21('0x33')]=_0x56fd1e[_0x6b21('0x33')][_0x6b21('0x46')]?_0x56fd1e['attributes']:_0x1fb1bd[_0x6b21('0x2e')];_0x56fd1e[_0x6b21('0x37')]=qs[_0x6b21('0x38')](_0x12be71[_0x6b21('0x2f')][_0x6b21('0x38')]);_0x56fd1e[_0x6b21('0x3b')]=qs[_0x6b21('0x31')](_[_0x6b21('0x39')](_0x12be71['query'],_0x1fb1bd['filters']));if(_0x12be71[_0x6b21('0x2f')][_0x6b21('0x3a')]){_0x56fd1e[_0x6b21('0x3b')]=_['merge'](_0x56fd1e[_0x6b21('0x3b')],{'$or':_[_0x6b21('0x29')](_0x56fd1e[_0x6b21('0x33')],function(_0x13ee6b){var _0x4b6c09={};_0x4b6c09[_0x13ee6b]={'$like':'%'+_0x12be71['query'][_0x6b21('0x3a')]+'%'};return _0x4b6c09;})});}_0x56fd1e=_[_0x6b21('0x3c')]({},_0x56fd1e,_0x12be71[_0x6b21('0x3e')]);return _0x5aa8cf[_0x6b21('0x4a')](_0x56fd1e);}})['then'](function(_0x4a6d5c){if(_0x4a6d5c){_0x1e511e=_0x4a6d5c[_0x6b21('0x46')];if(!_0x12be71[_0x6b21('0x2f')][_0x6b21('0x35')](_0x6b21('0x36'))){_0x56fd1e[_0x6b21('0x1c')]=qs[_0x6b21('0x1c')](_0x12be71[_0x6b21('0x2f')][_0x6b21('0x1c')]);_0x56fd1e['offset']=qs['offset'](_0x12be71[_0x6b21('0x2f')][_0x6b21('0x1a')]);}return _0x5aa8cf[_0x6b21('0x4a')](_0x56fd1e);}})[_0x6b21('0x24')](function(_0xa5a7cb){if(_0xa5a7cb){return _0xa5a7cb?{'count':_0x1e511e,'rows':_0xa5a7cb}:null;}})[_0x6b21('0x24')](respondWithResult(_0x33a8f0,null))[_0x6b21('0x42')](handleError(_0x33a8f0,null));};exports[_0x6b21('0x4d')]=function(_0x5994f9,_0xd128af,_0xc4fac5){var _0x137c25={};var _0x2140a8={};var _0x16ab16;var _0x50fa35;return db['ZohoConfiguration'][_0x6b21('0x4b')]({'where':{'id':_0x5994f9[_0x6b21('0x44')]['id']}})[_0x6b21('0x24')](handleEntityNotFound(_0xd128af,null))[_0x6b21('0x24')](function(_0x1ae096){if(_0x1ae096){_0x16ab16=_0x1ae096;_0x2140a8[_0x6b21('0x2e')]=_['keys'](db[_0x6b21('0x4c')][_0x6b21('0x45')]);_0x2140a8[_0x6b21('0x2f')]=_[_0x6b21('0x30')](_0x5994f9['query']);_0x2140a8[_0x6b21('0x31')]=_[_0x6b21('0x32')](_0x2140a8[_0x6b21('0x2e')],_0x2140a8[_0x6b21('0x2f')]);_0x137c25[_0x6b21('0x33')]=_[_0x6b21('0x32')](_0x2140a8[_0x6b21('0x2e')],qs['fields'](_0x5994f9[_0x6b21('0x2f')][_0x6b21('0x34')]));_0x137c25[_0x6b21('0x33')]=_0x137c25[_0x6b21('0x33')][_0x6b21('0x46')]?_0x137c25['attributes']:_0x2140a8[_0x6b21('0x2e')];_0x137c25[_0x6b21('0x37')]=qs[_0x6b21('0x38')](_0x5994f9[_0x6b21('0x2f')][_0x6b21('0x38')]);_0x137c25[_0x6b21('0x3b')]=qs[_0x6b21('0x31')](_['pick'](_0x5994f9[_0x6b21('0x2f')],_0x2140a8[_0x6b21('0x31')]));if(_0x5994f9[_0x6b21('0x2f')][_0x6b21('0x3a')]){_0x137c25[_0x6b21('0x3b')]=_[_0x6b21('0x3c')](_0x137c25[_0x6b21('0x3b')],{'$or':_[_0x6b21('0x29')](_0x137c25[_0x6b21('0x33')],function(_0x597630){var _0x47982b={};_0x47982b[_0x597630]={'$like':'%'+_0x5994f9[_0x6b21('0x2f')][_0x6b21('0x3a')]+'%'};return _0x47982b;})});}_0x137c25=_[_0x6b21('0x3c')]({},_0x137c25,_0x5994f9[_0x6b21('0x3e')]);return _0x16ab16['getSubjects'](_0x137c25);}})[_0x6b21('0x24')](function(_0x375368){if(_0x375368){_0x50fa35=_0x375368[_0x6b21('0x46')];if(!_0x5994f9['query']['hasOwnProperty']('nolimit')){_0x137c25[_0x6b21('0x1c')]=qs[_0x6b21('0x1c')](_0x5994f9[_0x6b21('0x2f')][_0x6b21('0x1c')]);_0x137c25[_0x6b21('0x1a')]=qs[_0x6b21('0x1a')](_0x5994f9['query'][_0x6b21('0x1a')]);}return _0x16ab16[_0x6b21('0x4d')](_0x137c25);}})[_0x6b21('0x24')](function(_0x3bea4c){if(_0x3bea4c){return _0x3bea4c?{'count':_0x50fa35,'rows':_0x3bea4c}:null;}})['then'](respondWithResult(_0xd128af,null))['catch'](handleError(_0xd128af,null));};exports[_0x6b21('0x4e')]=function(_0x2684c2,_0x5ee96d,_0x1c556b){var _0x2d284b={};var _0x5e5306={};var _0x3e2fdb;var _0x33e11b;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x2684c2['params']['id']}})[_0x6b21('0x24')](handleEntityNotFound(_0x5ee96d,null))[_0x6b21('0x24')](function(_0xb86ce1){if(_0xb86ce1){_0x3e2fdb=_0xb86ce1;_0x5e5306[_0x6b21('0x2e')]=_['keys'](db['ZohoField'][_0x6b21('0x45')]);_0x5e5306['query']=_[_0x6b21('0x30')](_0x2684c2[_0x6b21('0x2f')]);_0x5e5306['filters']=_[_0x6b21('0x32')](_0x5e5306[_0x6b21('0x2e')],_0x5e5306['query']);_0x2d284b['attributes']=_[_0x6b21('0x32')](_0x5e5306['model'],qs[_0x6b21('0x34')](_0x2684c2[_0x6b21('0x2f')][_0x6b21('0x34')]));_0x2d284b['attributes']=_0x2d284b[_0x6b21('0x33')]['length']?_0x2d284b['attributes']:_0x5e5306[_0x6b21('0x2e')];_0x2d284b[_0x6b21('0x37')]=qs[_0x6b21('0x38')](_0x2684c2[_0x6b21('0x2f')]['sort']);_0x2d284b[_0x6b21('0x3b')]=qs[_0x6b21('0x31')](_[_0x6b21('0x39')](_0x2684c2['query'],_0x5e5306['filters']));if(_0x2684c2[_0x6b21('0x2f')][_0x6b21('0x3a')]){_0x2d284b[_0x6b21('0x3b')]=_[_0x6b21('0x3c')](_0x2d284b[_0x6b21('0x3b')],{'$or':_['map'](_0x2d284b[_0x6b21('0x33')],function(_0x2ad4af){var _0x194548={};_0x194548[_0x2ad4af]={'$like':'%'+_0x2684c2[_0x6b21('0x2f')][_0x6b21('0x3a')]+'%'};return _0x194548;})});}_0x2d284b=_[_0x6b21('0x3c')]({},_0x2d284b,_0x2684c2[_0x6b21('0x3e')]);return _0x3e2fdb['getDescriptions'](_0x2d284b);}})['then'](function(_0x1b6aa1){if(_0x1b6aa1){_0x33e11b=_0x1b6aa1[_0x6b21('0x46')];if(!_0x2684c2[_0x6b21('0x2f')][_0x6b21('0x35')](_0x6b21('0x36'))){_0x2d284b['limit']=qs[_0x6b21('0x1c')](_0x2684c2['query'][_0x6b21('0x1c')]);_0x2d284b[_0x6b21('0x1a')]=qs[_0x6b21('0x1a')](_0x2684c2['query'][_0x6b21('0x1a')]);}return _0x3e2fdb[_0x6b21('0x4e')](_0x2d284b);}})[_0x6b21('0x24')](function(_0xb6377d){if(_0xb6377d){return _0xb6377d?{'count':_0x33e11b,'rows':_0xb6377d}:null;}})['then'](respondWithResult(_0x5ee96d,null))[_0x6b21('0x42')](handleError(_0x5ee96d,null));}; \ No newline at end of file +var _0xf266=['sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','hasOwnProperty','getSubjects','order','getDescriptions','ZohoField','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x10453a,_0x18fdfd){var _0x42961d=function(_0x1e8f3a){while(--_0x1e8f3a){_0x10453a['push'](_0x10453a['shift']());}};_0x42961d(++_0x18fdfd);}(_0xf266,0x9d));var _0x6f26=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xf266[_0x3826ad];return _0x17b900;};'use strict';var emlformat=require(_0x6f26('0x0'));var rimraf=require(_0x6f26('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f26('0x2'));var rp=require(_0x6f26('0x3'));var moment=require(_0x6f26('0x4'));var BPromise=require(_0x6f26('0x5'));var Mustache=require(_0x6f26('0x6'));var util=require(_0x6f26('0x7'));var path=require(_0x6f26('0x8'));var sox=require(_0x6f26('0x9'));var csv=require(_0x6f26('0xa'));var ejs=require(_0x6f26('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6f26('0xc'));var crypto=require(_0x6f26('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6f26('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f26('0xf'));var Papa=require(_0x6f26('0x10'));var Redis=require(_0x6f26('0x11'));var authService=require(_0x6f26('0x12'));var qs=require(_0x6f26('0x13'));var as=require(_0x6f26('0x14'));var hardwareService=require(_0x6f26('0x15'));var logger=require(_0x6f26('0x16'))(_0x6f26('0x17'));var utils=require(_0x6f26('0x18'));var config=require(_0x6f26('0x19'));var licenseUtil=require(_0x6f26('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cc1e5,_0x98041e){_0x98041e=_0x98041e||0xcc;return function(_0x4acf2b){if(_0x4acf2b){return _0x4cc1e5[_0x6f26('0x1b')](_0x98041e);}return _0x4cc1e5[_0x6f26('0x1c')](_0x98041e)[_0x6f26('0x1d')]();};}function respondWithResult(_0x32302e,_0x412243){_0x412243=_0x412243||0xc8;return function(_0x13ef44){if(_0x13ef44){return _0x32302e[_0x6f26('0x1c')](_0x412243)['json'](_0x13ef44);}};}function respondWithFilteredResult(_0x3455c5,_0xdead1c){return function(_0x306fcd){if(_0x306fcd){var _0x46ec35=typeof _0xdead1c['offset']===_0x6f26('0x1e')&&typeof _0xdead1c[_0x6f26('0x1f')]==='undefined';var _0x597c59=_0x306fcd[_0x6f26('0x20')];var _0x1e277a=_0x46ec35?0x0:_0xdead1c[_0x6f26('0x21')];var _0x488b9a=_0x46ec35?_0x306fcd['count']:_0xdead1c[_0x6f26('0x21')]+_0xdead1c[_0x6f26('0x1f')];var _0x365f9c;if(_0x488b9a>=_0x597c59){_0x488b9a=_0x597c59;_0x365f9c=0xc8;}else{_0x365f9c=0xce;}_0x3455c5[_0x6f26('0x1c')](_0x365f9c);return _0x3455c5[_0x6f26('0x22')](_0x6f26('0x23'),_0x1e277a+'-'+_0x488b9a+'/'+_0x597c59)['json'](_0x306fcd);}return null;};}function patchUpdates(_0x155c41){return function(_0x1760f4){try{jsonpatch[_0x6f26('0x24')](_0x1760f4,_0x155c41,!![]);}catch(_0x362c41){return BPromise[_0x6f26('0x25')](_0x362c41);}return _0x1760f4['save']();};}function saveUpdates(_0x52bd2b,_0xde38b9){return function(_0x5a0c79){if(_0x5a0c79){return _0x5a0c79[_0x6f26('0x26')](_0x52bd2b)[_0x6f26('0x27')](function(_0x3b3a37){return _0x3b3a37;});}return null;};}function removeEntity(_0x2d717f,_0xb00767){return function(_0x273fbb){if(_0x273fbb){return _0x273fbb['destroy']()['then'](function(){_0x2d717f[_0x6f26('0x1c')](0xcc)[_0x6f26('0x1d')]();});}};}function handleEntityNotFound(_0x4557c6,_0x5e38bd){return function(_0x5d1c78){if(!_0x5d1c78){_0x4557c6[_0x6f26('0x1b')](0x194);}return _0x5d1c78;};}function handleError(_0x24aa9e,_0x39154b){_0x39154b=_0x39154b||0x1f4;return function(_0x25676e){logger[_0x6f26('0x28')](_0x25676e[_0x6f26('0x29')]);if(_0x25676e[_0x6f26('0x2a')]){delete _0x25676e[_0x6f26('0x2a')];}_0x24aa9e[_0x6f26('0x1c')](_0x39154b)[_0x6f26('0x2b')](_0x25676e);};}exports['index']=function(_0x56193b,_0x59a4c1){var _0x44ad18={},_0x26560d={},_0x3821f9={'count':0x0,'rows':[]};var _0x7959b3=_[_0x6f26('0x2c')](db[_0x6f26('0x2d')][_0x6f26('0x2e')],function(_0x3294f6){return{'name':_0x3294f6[_0x6f26('0x2f')],'type':_0x3294f6[_0x6f26('0x30')][_0x6f26('0x31')]};});_0x26560d[_0x6f26('0x32')]=_[_0x6f26('0x2c')](_0x7959b3,_0x6f26('0x2a'));_0x26560d[_0x6f26('0x33')]=_[_0x6f26('0x34')](_0x56193b[_0x6f26('0x33')]);_0x26560d[_0x6f26('0x35')]=_[_0x6f26('0x36')](_0x26560d[_0x6f26('0x32')],_0x26560d['query']);_0x44ad18['attributes']=_[_0x6f26('0x36')](_0x26560d[_0x6f26('0x32')],qs[_0x6f26('0x37')](_0x56193b[_0x6f26('0x33')][_0x6f26('0x37')]));_0x44ad18[_0x6f26('0x38')]=_0x44ad18[_0x6f26('0x38')][_0x6f26('0x39')]?_0x44ad18[_0x6f26('0x38')]:_0x26560d[_0x6f26('0x32')];if(!_0x56193b[_0x6f26('0x33')]['hasOwnProperty'](_0x6f26('0x3a'))){_0x44ad18[_0x6f26('0x1f')]=qs[_0x6f26('0x1f')](_0x56193b[_0x6f26('0x33')][_0x6f26('0x1f')]);_0x44ad18[_0x6f26('0x21')]=qs[_0x6f26('0x21')](_0x56193b[_0x6f26('0x33')]['offset']);}_0x44ad18['order']=qs[_0x6f26('0x3b')](_0x56193b[_0x6f26('0x33')][_0x6f26('0x3b')]);_0x44ad18['where']=qs[_0x6f26('0x35')](_[_0x6f26('0x3c')](_0x56193b[_0x6f26('0x33')],_0x26560d[_0x6f26('0x35')]),_0x7959b3);if(_0x56193b[_0x6f26('0x33')][_0x6f26('0x3d')]){_0x44ad18[_0x6f26('0x3e')]=_[_0x6f26('0x3f')](_0x44ad18[_0x6f26('0x3e')],{'$or':_[_0x6f26('0x2c')](_0x7959b3,function(_0x51005e){if(_0x51005e[_0x6f26('0x30')]!==_0x6f26('0x40')){var _0x4e5261={};_0x4e5261[_0x51005e[_0x6f26('0x2a')]]={'$like':'%'+_0x56193b[_0x6f26('0x33')][_0x6f26('0x3d')]+'%'};return _0x4e5261;}})});}_0x44ad18=_['merge']({},_0x44ad18,_0x56193b[_0x6f26('0x41')]);var _0x7971e0={'where':_0x44ad18[_0x6f26('0x3e')]};return db['ZohoConfiguration'][_0x6f26('0x20')](_0x7971e0)[_0x6f26('0x27')](function(_0x2f8284){_0x3821f9[_0x6f26('0x20')]=_0x2f8284;if(_0x56193b[_0x6f26('0x33')]['includeAll']){_0x44ad18[_0x6f26('0x42')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x6f26('0x43')](_0x44ad18);})['then'](function(_0x26a793){_0x3821f9[_0x6f26('0x44')]=_0x26a793;return _0x3821f9;})[_0x6f26('0x27')](respondWithFilteredResult(_0x59a4c1,_0x44ad18))[_0x6f26('0x45')](handleError(_0x59a4c1,null));};exports[_0x6f26('0x46')]=function(_0x2e4b18,_0x5a8095){var _0x2773a7={'raw':![],'where':{'id':_0x2e4b18[_0x6f26('0x47')]['id']}},_0x5d620e={};_0x5d620e['model']=_[_0x6f26('0x34')](db['ZohoConfiguration'][_0x6f26('0x2e')]);_0x5d620e[_0x6f26('0x33')]=_[_0x6f26('0x34')](_0x2e4b18[_0x6f26('0x33')]);_0x5d620e[_0x6f26('0x35')]=_[_0x6f26('0x36')](_0x5d620e[_0x6f26('0x32')],_0x5d620e['query']);_0x2773a7[_0x6f26('0x38')]=_[_0x6f26('0x36')](_0x5d620e[_0x6f26('0x32')],qs[_0x6f26('0x37')](_0x2e4b18[_0x6f26('0x33')][_0x6f26('0x37')]));_0x2773a7[_0x6f26('0x38')]=_0x2773a7[_0x6f26('0x38')][_0x6f26('0x39')]?_0x2773a7[_0x6f26('0x38')]:_0x5d620e[_0x6f26('0x32')];if(_0x2e4b18[_0x6f26('0x33')]['includeAll']){_0x2773a7[_0x6f26('0x42')]=[{'all':!![]}];}_0x2773a7=_[_0x6f26('0x3f')]({},_0x2773a7,_0x2e4b18[_0x6f26('0x41')]);return db[_0x6f26('0x2d')][_0x6f26('0x48')](_0x2773a7)['then'](handleEntityNotFound(_0x5a8095,null))['then'](respondWithResult(_0x5a8095,null))[_0x6f26('0x45')](handleError(_0x5a8095,null));};exports[_0x6f26('0x49')]=function(_0x2e6902,_0x502a58){return db[_0x6f26('0x2d')][_0x6f26('0x49')](_0x2e6902[_0x6f26('0x4a')],{})[_0x6f26('0x27')](respondWithResult(_0x502a58,0xc9))[_0x6f26('0x45')](handleError(_0x502a58,null));};exports[_0x6f26('0x26')]=function(_0x134cc8,_0x1213be){if(_0x134cc8['body']['id']){delete _0x134cc8['body']['id'];}return db[_0x6f26('0x2d')][_0x6f26('0x48')]({'where':{'id':_0x134cc8[_0x6f26('0x47')]['id']}})['then'](handleEntityNotFound(_0x1213be,null))[_0x6f26('0x27')](saveUpdates(_0x134cc8[_0x6f26('0x4a')],null))[_0x6f26('0x27')](respondWithResult(_0x1213be,null))[_0x6f26('0x45')](handleError(_0x1213be,null));};exports[_0x6f26('0x4b')]=function(_0x58cb87,_0x3c8a0b){return db[_0x6f26('0x2d')][_0x6f26('0x48')]({'where':{'id':_0x58cb87[_0x6f26('0x47')]['id']}})[_0x6f26('0x27')](handleEntityNotFound(_0x3c8a0b,null))[_0x6f26('0x27')](removeEntity(_0x3c8a0b,null))[_0x6f26('0x45')](handleError(_0x3c8a0b,null));};exports[_0x6f26('0x4c')]=function(_0xa5b33,_0x90f511,_0x4aef13){var _0x219cd2={};var _0x57a46e={};var _0x254c17;var _0x13cfbf;return db['ZohoConfiguration'][_0x6f26('0x4d')]({'where':{'id':_0xa5b33[_0x6f26('0x47')]['id']}})[_0x6f26('0x27')](handleEntityNotFound(_0x90f511,null))['then'](function(_0x230ed4){if(_0x230ed4){_0x254c17=_0x230ed4;_0x57a46e[_0x6f26('0x32')]=_['keys'](db['ZohoField'][_0x6f26('0x2e')]);_0x57a46e[_0x6f26('0x33')]=_[_0x6f26('0x34')](_0xa5b33['query']);_0x57a46e[_0x6f26('0x35')]=_[_0x6f26('0x36')](_0x57a46e['model'],_0x57a46e[_0x6f26('0x33')]);_0x219cd2[_0x6f26('0x38')]=_[_0x6f26('0x36')](_0x57a46e['model'],qs[_0x6f26('0x37')](_0xa5b33['query'][_0x6f26('0x37')]));_0x219cd2['attributes']=_0x219cd2[_0x6f26('0x38')]['length']?_0x219cd2[_0x6f26('0x38')]:_0x57a46e[_0x6f26('0x32')];_0x219cd2['order']=qs['sort'](_0xa5b33[_0x6f26('0x33')]['sort']);_0x219cd2[_0x6f26('0x3e')]=qs[_0x6f26('0x35')](_[_0x6f26('0x3c')](_0xa5b33['query'],_0x57a46e['filters']));if(_0xa5b33[_0x6f26('0x33')][_0x6f26('0x3d')]){_0x219cd2['where']=_['merge'](_0x219cd2[_0x6f26('0x3e')],{'$or':_[_0x6f26('0x2c')](_0x219cd2[_0x6f26('0x38')],function(_0x1ae356){var _0x4ff8e1={};_0x4ff8e1[_0x1ae356]={'$like':'%'+_0xa5b33[_0x6f26('0x33')]['filter']+'%'};return _0x4ff8e1;})});}_0x219cd2=_[_0x6f26('0x3f')]({},_0x219cd2,_0xa5b33[_0x6f26('0x41')]);return _0x254c17['getFields'](_0x219cd2);}})['then'](function(_0x190d4e){if(_0x190d4e){_0x13cfbf=_0x190d4e[_0x6f26('0x39')];if(!_0xa5b33[_0x6f26('0x33')][_0x6f26('0x4e')](_0x6f26('0x3a'))){_0x219cd2[_0x6f26('0x1f')]=qs[_0x6f26('0x1f')](_0xa5b33['query'][_0x6f26('0x1f')]);_0x219cd2['offset']=qs[_0x6f26('0x21')](_0xa5b33[_0x6f26('0x33')]['offset']);}return _0x254c17[_0x6f26('0x4c')](_0x219cd2);}})[_0x6f26('0x27')](function(_0x525047){if(_0x525047){return _0x525047?{'count':_0x13cfbf,'rows':_0x525047}:null;}})['then'](respondWithResult(_0x90f511,null))[_0x6f26('0x45')](handleError(_0x90f511,null));};exports[_0x6f26('0x4f')]=function(_0xd24744,_0x3ca95c,_0x4ae9a1){var _0x447ee5={};var _0x5ea1ac={};var _0x1ae8a9;var _0x12d5d4;return db['ZohoConfiguration'][_0x6f26('0x4d')]({'where':{'id':_0xd24744[_0x6f26('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ca95c,null))[_0x6f26('0x27')](function(_0xf0bc6a){if(_0xf0bc6a){_0x1ae8a9=_0xf0bc6a;_0x5ea1ac['model']=_[_0x6f26('0x34')](db['ZohoField']['rawAttributes']);_0x5ea1ac[_0x6f26('0x33')]=_[_0x6f26('0x34')](_0xd24744[_0x6f26('0x33')]);_0x5ea1ac[_0x6f26('0x35')]=_[_0x6f26('0x36')](_0x5ea1ac[_0x6f26('0x32')],_0x5ea1ac[_0x6f26('0x33')]);_0x447ee5[_0x6f26('0x38')]=_[_0x6f26('0x36')](_0x5ea1ac[_0x6f26('0x32')],qs[_0x6f26('0x37')](_0xd24744['query'][_0x6f26('0x37')]));_0x447ee5['attributes']=_0x447ee5[_0x6f26('0x38')][_0x6f26('0x39')]?_0x447ee5[_0x6f26('0x38')]:_0x5ea1ac['model'];_0x447ee5[_0x6f26('0x50')]=qs['sort'](_0xd24744['query'][_0x6f26('0x3b')]);_0x447ee5[_0x6f26('0x3e')]=qs[_0x6f26('0x35')](_[_0x6f26('0x3c')](_0xd24744[_0x6f26('0x33')],_0x5ea1ac['filters']));if(_0xd24744[_0x6f26('0x33')][_0x6f26('0x3d')]){_0x447ee5[_0x6f26('0x3e')]=_['merge'](_0x447ee5[_0x6f26('0x3e')],{'$or':_[_0x6f26('0x2c')](_0x447ee5[_0x6f26('0x38')],function(_0x76e9d1){var _0x48586b={};_0x48586b[_0x76e9d1]={'$like':'%'+_0xd24744[_0x6f26('0x33')]['filter']+'%'};return _0x48586b;})});}_0x447ee5=_['merge']({},_0x447ee5,_0xd24744[_0x6f26('0x41')]);return _0x1ae8a9[_0x6f26('0x4f')](_0x447ee5);}})[_0x6f26('0x27')](function(_0x2fbe53){if(_0x2fbe53){_0x12d5d4=_0x2fbe53[_0x6f26('0x39')];if(!_0xd24744['query']['hasOwnProperty'](_0x6f26('0x3a'))){_0x447ee5['limit']=qs[_0x6f26('0x1f')](_0xd24744[_0x6f26('0x33')][_0x6f26('0x1f')]);_0x447ee5[_0x6f26('0x21')]=qs['offset'](_0xd24744['query'][_0x6f26('0x21')]);}return _0x1ae8a9[_0x6f26('0x4f')](_0x447ee5);}})[_0x6f26('0x27')](function(_0x59fdbb){if(_0x59fdbb){return _0x59fdbb?{'count':_0x12d5d4,'rows':_0x59fdbb}:null;}})[_0x6f26('0x27')](respondWithResult(_0x3ca95c,null))[_0x6f26('0x45')](handleError(_0x3ca95c,null));};exports[_0x6f26('0x51')]=function(_0x530443,_0x3e7fee,_0x130ef0){var _0x4b4c24={};var _0x4dd413={};var _0x21736c;var _0x13fd8;return db[_0x6f26('0x2d')][_0x6f26('0x4d')]({'where':{'id':_0x530443[_0x6f26('0x47')]['id']}})[_0x6f26('0x27')](handleEntityNotFound(_0x3e7fee,null))[_0x6f26('0x27')](function(_0x115a72){if(_0x115a72){_0x21736c=_0x115a72;_0x4dd413[_0x6f26('0x32')]=_[_0x6f26('0x34')](db[_0x6f26('0x52')][_0x6f26('0x2e')]);_0x4dd413['query']=_['keys'](_0x530443['query']);_0x4dd413[_0x6f26('0x35')]=_[_0x6f26('0x36')](_0x4dd413[_0x6f26('0x32')],_0x4dd413['query']);_0x4b4c24['attributes']=_[_0x6f26('0x36')](_0x4dd413[_0x6f26('0x32')],qs['fields'](_0x530443['query'][_0x6f26('0x37')]));_0x4b4c24[_0x6f26('0x38')]=_0x4b4c24[_0x6f26('0x38')][_0x6f26('0x39')]?_0x4b4c24[_0x6f26('0x38')]:_0x4dd413[_0x6f26('0x32')];_0x4b4c24['order']=qs[_0x6f26('0x3b')](_0x530443['query'][_0x6f26('0x3b')]);_0x4b4c24[_0x6f26('0x3e')]=qs[_0x6f26('0x35')](_[_0x6f26('0x3c')](_0x530443[_0x6f26('0x33')],_0x4dd413['filters']));if(_0x530443[_0x6f26('0x33')][_0x6f26('0x3d')]){_0x4b4c24[_0x6f26('0x3e')]=_[_0x6f26('0x3f')](_0x4b4c24[_0x6f26('0x3e')],{'$or':_['map'](_0x4b4c24[_0x6f26('0x38')],function(_0x845f1f){var _0x464734={};_0x464734[_0x845f1f]={'$like':'%'+_0x530443[_0x6f26('0x33')][_0x6f26('0x3d')]+'%'};return _0x464734;})});}_0x4b4c24=_[_0x6f26('0x3f')]({},_0x4b4c24,_0x530443[_0x6f26('0x41')]);return _0x21736c[_0x6f26('0x51')](_0x4b4c24);}})[_0x6f26('0x27')](function(_0x39cb0d){if(_0x39cb0d){_0x13fd8=_0x39cb0d['length'];if(!_0x530443[_0x6f26('0x33')][_0x6f26('0x4e')](_0x6f26('0x3a'))){_0x4b4c24[_0x6f26('0x1f')]=qs[_0x6f26('0x1f')](_0x530443[_0x6f26('0x33')]['limit']);_0x4b4c24[_0x6f26('0x21')]=qs['offset'](_0x530443[_0x6f26('0x33')]['offset']);}return _0x21736c[_0x6f26('0x51')](_0x4b4c24);}})[_0x6f26('0x27')](function(_0x10ead4){if(_0x10ead4){return _0x10ead4?{'count':_0x13fd8,'rows':_0x10ead4}:null;}})[_0x6f26('0x27')](respondWithResult(_0x3e7fee,null))['catch'](handleError(_0x3e7fee,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index fb06b89..115f935 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 _0x21c1=['../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','lodash','../../config/logger','bluebird','request-promise'];(function(_0x3b1841,_0x26611f){var _0x275c83=function(_0x14f2b8){while(--_0x14f2b8){_0x3b1841['push'](_0x3b1841['shift']());}};_0x275c83(++_0x26611f);}(_0x21c1,0xbc));var _0x121c=function(_0x58aff7,_0x610e82){_0x58aff7=_0x58aff7-0x0;var _0x5759b6=_0x21c1[_0x58aff7];return _0x5759b6;};'use strict';var _=require(_0x121c('0x0'));var util=require('util');var logger=require(_0x121c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x121c('0x2'));var rp=require(_0x121c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x121c('0x4'));var attributes=require(_0x121c('0x5'));module['exports']=function(_0x1ddbea,_0x338452){return _0x1ddbea[_0x121c('0x6')](_0x121c('0x7'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7546=['ZohoConfiguration','int_zoho_configurations','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x32aa37,_0x190048){var _0x3039be=function(_0x1a95cc){while(--_0x1a95cc){_0x32aa37['push'](_0x32aa37['shift']());}};_0x3039be(++_0x190048);}(_0x7546,0x1ca));var _0x6754=function(_0x1f346a,_0x17a4ea){_0x1f346a=_0x1f346a-0x0;var _0x2916eb=_0x7546[_0x1f346a];return _0x2916eb;};'use strict';var _=require(_0x6754('0x0'));var util=require(_0x6754('0x1'));var logger=require('../../config/logger')(_0x6754('0x2'));var moment=require('moment');var BPromise=require(_0x6754('0x3'));var rp=require(_0x6754('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6754('0x5'));var config=require(_0x6754('0x6'));var attributes=require(_0x6754('0x7'));module[_0x6754('0x8')]=function(_0x1b19d9,_0x4b4695){return _0x1b19d9[_0x6754('0x9')](_0x6754('0xa'),attributes,{'tableName':_0x6754('0xb'),'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 071a7d2..502855f 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 _0xc624=['message','info','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x1b1408,_0x1a9736){var _0x377695=function(_0x339a6b){while(--_0x339a6b){_0x1b1408['push'](_0x1b1408['shift']());}};_0x377695(++_0x1a9736);}(_0xc624,0x101));var _0x4c62=function(_0x4f8c15,_0x1977ba){_0x4f8c15=_0x4f8c15-0x0;var _0x396f9f=_0xc624[_0x4f8c15];return _0x396f9f;};'use strict';var _=require(_0x4c62('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4c62('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c62('0x2'));var db=require(_0x4c62('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c62('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4c62('0x5'));var client=jayson['client'][_0x4c62('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3f4f08,_0x19b4ef,_0x240a48){return new BPromise(function(_0x92b50e,_0x39a990){return client[_0x4c62('0x7')](_0x3f4f08,_0x240a48)[_0x4c62('0x8')](function(_0x526d6f){logger['info'](_0x4c62('0x9'),_0x19b4ef,_0x4c62('0xa'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x19b4ef,_0x4c62('0xa'),JSON['stringify'](_0x526d6f));if(_0x526d6f[_0x4c62('0xb')]){if(_0x526d6f[_0x4c62('0xb')][_0x4c62('0xc')]===0x1f4){logger['error'](_0x4c62('0x9'),_0x19b4ef,_0x526d6f[_0x4c62('0xb')][_0x4c62('0xd')]);return _0x39a990(_0x526d6f[_0x4c62('0xb')]['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x19b4ef,_0x526d6f[_0x4c62('0xb')]['message']);return _0x92b50e(_0x526d6f[_0x4c62('0xb')]['message']);}else{logger[_0x4c62('0xe')](_0x4c62('0x9'),_0x19b4ef,_0x4c62('0xa'));_0x92b50e(_0x526d6f['result'][_0x4c62('0xd')]);}})['catch'](function(_0x24ca6d){logger[_0x4c62('0xb')](_0x4c62('0x9'),_0x19b4ef,_0x24ca6d);_0x39a990(_0x24ca6d);});});} \ No newline at end of file +var _0x8ebd=['debug','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','request\x20sent'];(function(_0x5f2284,_0x464f41){var _0x2e2965=function(_0x3c3116){while(--_0x3c3116){_0x5f2284['push'](_0x5f2284['shift']());}};_0x2e2965(++_0x464f41);}(_0x8ebd,0x182));var _0xd8eb=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8ebd[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xd8eb('0x0'));var util=require('util');var moment=require(_0xd8eb('0x1'));var BPromise=require(_0xd8eb('0x2'));var rs=require(_0xd8eb('0x3'));var fs=require('fs');var Redis=require(_0xd8eb('0x4'));var db=require(_0xd8eb('0x5'))['db'];var utils=require(_0xd8eb('0x6'));var logger=require(_0xd8eb('0x7'))(_0xd8eb('0x8'));var config=require(_0xd8eb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd8eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c6700,_0x335ab1,_0x830324){return new BPromise(function(_0x45e83c,_0x32cf28){return client['request'](_0x3c6700,_0x830324)[_0xd8eb('0xb')](function(_0x3c0d5e){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x335ab1,_0xd8eb('0xc'));logger[_0xd8eb('0xd')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x335ab1,_0xd8eb('0xc'),JSON[_0xd8eb('0xe')](_0x3c0d5e));if(_0x3c0d5e[_0xd8eb('0xf')]){if(_0x3c0d5e['error'][_0xd8eb('0x10')]===0x1f4){logger[_0xd8eb('0xf')](_0xd8eb('0x11'),_0x335ab1,_0x3c0d5e[_0xd8eb('0xf')]['message']);return _0x32cf28(_0x3c0d5e[_0xd8eb('0xf')][_0xd8eb('0x12')]);}logger[_0xd8eb('0xf')](_0xd8eb('0x11'),_0x335ab1,_0x3c0d5e[_0xd8eb('0xf')]['message']);return _0x45e83c(_0x3c0d5e[_0xd8eb('0xf')][_0xd8eb('0x12')]);}else{logger['info'](_0xd8eb('0x11'),_0x335ab1,'request\x20sent');_0x45e83c(_0x3c0d5e[_0xd8eb('0x13')][_0xd8eb('0x12')]);}})[_0xd8eb('0x14')](function(_0x12d952){logger[_0xd8eb('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x335ab1,_0x12d952);_0x32cf28(_0x12d952);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 49fbb49..26b368a 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 _0xac39=['update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x37faca,_0x572597){var _0x584068=function(_0x57605c){while(--_0x57605c){_0x37faca['push'](_0x37faca['shift']());}};_0x584068(++_0x572597);}(_0xac39,0x76));var _0x9ac3=function(_0x311c2a,_0x5b27be){_0x311c2a=_0x311c2a-0x0;var _0xad2961=_0xac39[_0x311c2a];return _0xad2961;};'use strict';var multer=require(_0x9ac3('0x0'));var util=require(_0x9ac3('0x1'));var path=require(_0x9ac3('0x2'));var timeout=require(_0x9ac3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9ac3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ac3('0x5'));var controller=require(_0x9ac3('0x6'));router[_0x9ac3('0x7')]('/',auth[_0x9ac3('0x8')](),controller[_0x9ac3('0x9')]);router[_0x9ac3('0x7')](_0x9ac3('0xa'),auth['isAuthenticated'](),controller[_0x9ac3('0xb')]);router[_0x9ac3('0xc')]('/',auth['isAuthenticated'](),controller[_0x9ac3('0xd')]);router[_0x9ac3('0xe')](_0x9ac3('0xa'),auth['isAuthenticated'](),controller[_0x9ac3('0xf')]);router[_0x9ac3('0x10')](_0x9ac3('0xa'),auth[_0x9ac3('0x8')](),controller[_0x9ac3('0x11')]);module[_0x9ac3('0x12')]=router; \ No newline at end of file +var _0xa15b=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','get','/:id'];(function(_0x4c0cd7,_0x39cae3){var _0x39d8b5=function(_0x1bf9c6){while(--_0x1bf9c6){_0x4c0cd7['push'](_0x4c0cd7['shift']());}};_0x39d8b5(++_0x39cae3);}(_0xa15b,0x1f4));var _0xba15=function(_0x3434d2,_0x591d10){_0x3434d2=_0x3434d2-0x0;var _0x2c6d16=_0xa15b[_0x3434d2];return _0x2c6d16;};'use strict';var multer=require(_0xba15('0x0'));var util=require(_0xba15('0x1'));var path=require(_0xba15('0x2'));var timeout=require(_0xba15('0x3'));var express=require(_0xba15('0x4'));var router=express[_0xba15('0x5')]();var fs_extra=require(_0xba15('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xba15('0x7'));var config=require(_0xba15('0x8'));var controller=require(_0xba15('0x9'));router['get']('/',auth[_0xba15('0xa')](),controller['index']);router[_0xba15('0xb')](_0xba15('0xc'),auth[_0xba15('0xa')](),controller['show']);router[_0xba15('0xd')]('/',auth[_0xba15('0xa')](),controller[_0xba15('0xe')]);router[_0xba15('0xf')]('/:id',auth[_0xba15('0xa')](),controller['update']);router[_0xba15('0x10')]('/:id',auth[_0xba15('0xa')](),controller[_0xba15('0x11')]);module[_0xba15('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 1c4acda..c3cc54c 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 _0x34f9=['sequelize','string','variable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0xb3b542,_0x28d1e9){var _0x2c2184=function(_0x5506ac){while(--_0x5506ac){_0xb3b542['push'](_0xb3b542['shift']());}};_0x2c2184(++_0x28d1e9);}(_0x34f9,0x178));var _0x934f=function(_0x419b25,_0x393a89){_0x419b25=_0x419b25-0x0;var _0x39d6e0=_0x34f9[_0x419b25];return _0x39d6e0;};'use strict';var Sequelize=require(_0x934f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x934f('0x1'),_0x934f('0x2'),'customVariable',_0x934f('0x3'),_0x934f('0x4')),'defaultValue':_0x934f('0x1')},'content':{'type':Sequelize[_0x934f('0x5')]},'key':{'type':Sequelize[_0x934f('0x5')]},'keyType':{'type':Sequelize[_0x934f('0x6')]('string',_0x934f('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x934f('0x5')]},'idField':{'type':Sequelize[_0x934f('0x5')]},'nameField':{'type':Sequelize[_0x934f('0x5')]},'customField':{'type':Sequelize[_0x934f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3616=['keyValue','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x3b1463,_0x33aeeb){var _0x14d55a=function(_0x157008){while(--_0x157008){_0x3b1463['push'](_0x3b1463['shift']());}};_0x14d55a(++_0x33aeeb);}(_0x3616,0x16a));var _0x6361=function(_0x12c92d,_0x13b787){_0x12c92d=_0x12c92d-0x0;var _0x5ed445=_0x3616[_0x12c92d];return _0x5ed445;};'use strict';var Sequelize=require(_0x6361('0x0'));module[_0x6361('0x1')]={'type':{'type':Sequelize[_0x6361('0x2')](_0x6361('0x3'),_0x6361('0x4'),_0x6361('0x5'),_0x6361('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x6361('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6361('0x3'),'variable',_0x6361('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6361('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6361('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 0d7ee0e..9986181 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 _0xd89e=['squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','error','stack','name','send','map','ZohoField','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','length','include','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x199bdf,_0xf7f21f){var _0x5ea815=function(_0x398f36){while(--_0x398f36){_0x199bdf['push'](_0x199bdf['shift']());}};_0x5ea815(++_0xf7f21f);}(_0xd89e,0x16b));var _0xed89=function(_0x4feecf,_0xb420d9){_0x4feecf=_0x4feecf-0x0;var _0x4b0af9=_0xd89e[_0x4feecf];return _0x4b0af9;};'use strict';var emlformat=require(_0xed89('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed89('0x1'));var rp=require(_0xed89('0x2'));var moment=require(_0xed89('0x3'));var BPromise=require(_0xed89('0x4'));var Mustache=require(_0xed89('0x5'));var util=require(_0xed89('0x6'));var path=require(_0xed89('0x7'));var sox=require(_0xed89('0x8'));var csv=require(_0xed89('0x9'));var ejs=require(_0xed89('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed89('0xb'));var squel=require(_0xed89('0xc'));var crypto=require(_0xed89('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed89('0xe'));var Papa=require(_0xed89('0xf'));var Redis=require(_0xed89('0x10'));var authService=require(_0xed89('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xed89('0x12'));var hardwareService=require(_0xed89('0x13'));var logger=require(_0xed89('0x14'))(_0xed89('0x15'));var utils=require(_0xed89('0x16'));var config=require(_0xed89('0x17'));var licenseUtil=require(_0xed89('0x18'));var db=require(_0xed89('0x19'))['db'];function respondWithStatusCode(_0x1a68c7,_0x28003a){_0x28003a=_0x28003a||0xcc;return function(_0x13d369){if(_0x13d369){return _0x1a68c7[_0xed89('0x1a')](_0x28003a);}return _0x1a68c7[_0xed89('0x1b')](_0x28003a)[_0xed89('0x1c')]();};}function respondWithResult(_0x3dfe51,_0x56b056){_0x56b056=_0x56b056||0xc8;return function(_0x182dbd){if(_0x182dbd){return _0x3dfe51[_0xed89('0x1b')](_0x56b056)['json'](_0x182dbd);}};}function respondWithFilteredResult(_0x590931,_0x48e9a8){return function(_0x2545ca){if(_0x2545ca){var _0x329e6a=typeof _0x48e9a8[_0xed89('0x1d')]===_0xed89('0x1e')&&typeof _0x48e9a8['limit']===_0xed89('0x1e');var _0x19f84c=_0x2545ca[_0xed89('0x1f')];var _0xb5b127=_0x329e6a?0x0:_0x48e9a8['offset'];var _0x6d9ce2=_0x329e6a?_0x2545ca['count']:_0x48e9a8[_0xed89('0x1d')]+_0x48e9a8[_0xed89('0x20')];var _0x4a214d;if(_0x6d9ce2>=_0x19f84c){_0x6d9ce2=_0x19f84c;_0x4a214d=0xc8;}else{_0x4a214d=0xce;}_0x590931[_0xed89('0x1b')](_0x4a214d);return _0x590931['set'](_0xed89('0x21'),_0xb5b127+'-'+_0x6d9ce2+'/'+_0x19f84c)['json'](_0x2545ca);}return null;};}function patchUpdates(_0x283790){return function(_0x18dba0){try{jsonpatch[_0xed89('0x22')](_0x18dba0,_0x283790,!![]);}catch(_0x51960a){return BPromise['reject'](_0x51960a);}return _0x18dba0[_0xed89('0x23')]();};}function saveUpdates(_0xeb5fb2,_0x138353){return function(_0x436235){if(_0x436235){return _0x436235['update'](_0xeb5fb2)[_0xed89('0x24')](function(_0x3ef4bf){return _0x3ef4bf;});}return null;};}function removeEntity(_0x17cae8,_0x8b8c78){return function(_0x490d54){if(_0x490d54){return _0x490d54[_0xed89('0x25')]()['then'](function(){_0x17cae8[_0xed89('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228d8f,_0x28ffe3){return function(_0x8209c8){if(!_0x8209c8){_0x228d8f[_0xed89('0x1a')](0x194);}return _0x8209c8;};}function handleError(_0x135c42,_0x232626){_0x232626=_0x232626||0x1f4;return function(_0x1a9fb0){logger[_0xed89('0x26')](_0x1a9fb0[_0xed89('0x27')]);if(_0x1a9fb0[_0xed89('0x28')]){delete _0x1a9fb0[_0xed89('0x28')];}_0x135c42[_0xed89('0x1b')](_0x232626)[_0xed89('0x29')](_0x1a9fb0);};}exports['index']=function(_0x31f087,_0x1c17f5){var _0x282854={},_0x22a464={},_0x15d48e={'count':0x0,'rows':[]};var _0xcafd27=_[_0xed89('0x2a')](db[_0xed89('0x2b')][_0xed89('0x2c')],function(_0x230803){return{'name':_0x230803['fieldName'],'type':_0x230803['type'][_0xed89('0x2d')]};});_0x22a464[_0xed89('0x2e')]=_['map'](_0xcafd27,'name');_0x22a464[_0xed89('0x2f')]=_['keys'](_0x31f087[_0xed89('0x2f')]);_0x22a464[_0xed89('0x30')]=_[_0xed89('0x31')](_0x22a464[_0xed89('0x2e')],_0x22a464['query']);_0x282854[_0xed89('0x32')]=_[_0xed89('0x31')](_0x22a464[_0xed89('0x2e')],qs[_0xed89('0x33')](_0x31f087[_0xed89('0x2f')][_0xed89('0x33')]));_0x282854[_0xed89('0x32')]=_0x282854[_0xed89('0x32')]['length']?_0x282854[_0xed89('0x32')]:_0x22a464['model'];if(!_0x31f087[_0xed89('0x2f')][_0xed89('0x34')](_0xed89('0x35'))){_0x282854[_0xed89('0x20')]=qs['limit'](_0x31f087[_0xed89('0x2f')][_0xed89('0x20')]);_0x282854['offset']=qs[_0xed89('0x1d')](_0x31f087[_0xed89('0x2f')][_0xed89('0x1d')]);}_0x282854[_0xed89('0x36')]=qs[_0xed89('0x37')](_0x31f087[_0xed89('0x2f')][_0xed89('0x37')]);_0x282854[_0xed89('0x38')]=qs[_0xed89('0x30')](_[_0xed89('0x39')](_0x31f087['query'],_0x22a464['filters']),_0xcafd27);if(_0x31f087[_0xed89('0x2f')][_0xed89('0x3a')]){_0x282854['where']=_[_0xed89('0x3b')](_0x282854[_0xed89('0x38')],{'$or':_[_0xed89('0x2a')](_0xcafd27,function(_0x2a898c){if(_0x2a898c[_0xed89('0x3c')]!==_0xed89('0x3d')){var _0x5e5866={};_0x5e5866[_0x2a898c[_0xed89('0x28')]]={'$like':'%'+_0x31f087['query'][_0xed89('0x3a')]+'%'};return _0x5e5866;}})});}_0x282854=_['merge']({},_0x282854,_0x31f087[_0xed89('0x3e')]);var _0xcc2000={'where':_0x282854['where']};return db[_0xed89('0x2b')][_0xed89('0x1f')](_0xcc2000)[_0xed89('0x24')](function(_0x3c7879){_0x15d48e[_0xed89('0x1f')]=_0x3c7879;if(_0x31f087[_0xed89('0x2f')][_0xed89('0x3f')]){_0x282854['include']=[{'all':!![]}];}return db[_0xed89('0x2b')][_0xed89('0x40')](_0x282854);})['then'](function(_0xef0512){_0x15d48e[_0xed89('0x41')]=_0xef0512;return _0x15d48e;})[_0xed89('0x24')](respondWithFilteredResult(_0x1c17f5,_0x282854))['catch'](handleError(_0x1c17f5,null));};exports[_0xed89('0x42')]=function(_0x4d1ab0,_0x28d688){var _0x1a338f={'raw':!![],'where':{'id':_0x4d1ab0[_0xed89('0x43')]['id']}},_0x423c27={};_0x423c27[_0xed89('0x2e')]=_[_0xed89('0x44')](db[_0xed89('0x2b')]['rawAttributes']);_0x423c27[_0xed89('0x2f')]=_[_0xed89('0x44')](_0x4d1ab0[_0xed89('0x2f')]);_0x423c27[_0xed89('0x30')]=_[_0xed89('0x31')](_0x423c27['model'],_0x423c27['query']);_0x1a338f[_0xed89('0x32')]=_['intersection'](_0x423c27['model'],qs[_0xed89('0x33')](_0x4d1ab0[_0xed89('0x2f')][_0xed89('0x33')]));_0x1a338f['attributes']=_0x1a338f['attributes'][_0xed89('0x45')]?_0x1a338f[_0xed89('0x32')]:_0x423c27['model'];if(_0x4d1ab0[_0xed89('0x2f')][_0xed89('0x3f')]){_0x1a338f[_0xed89('0x46')]=[{'all':!![]}];}_0x1a338f=_['merge']({},_0x1a338f,_0x4d1ab0[_0xed89('0x3e')]);return db[_0xed89('0x2b')][_0xed89('0x47')](_0x1a338f)[_0xed89('0x24')](handleEntityNotFound(_0x28d688,null))[_0xed89('0x24')](respondWithResult(_0x28d688,null))[_0xed89('0x48')](handleError(_0x28d688,null));};exports[_0xed89('0x49')]=function(_0x19813b,_0x2d1d93){return db['ZohoField']['create'](_0x19813b['body'],{})[_0xed89('0x24')](respondWithResult(_0x2d1d93,0xc9))['catch'](handleError(_0x2d1d93,null));};exports['update']=function(_0x25cace,_0x6591d0){if(_0x25cace['body']['id']){delete _0x25cace[_0xed89('0x4a')]['id'];}return db[_0xed89('0x2b')][_0xed89('0x47')]({'where':{'id':_0x25cace[_0xed89('0x43')]['id']}})['then'](handleEntityNotFound(_0x6591d0,null))[_0xed89('0x24')](saveUpdates(_0x25cace[_0xed89('0x4a')],null))['then'](respondWithResult(_0x6591d0,null))[_0xed89('0x48')](handleError(_0x6591d0,null));};exports[_0xed89('0x25')]=function(_0x4d9db4,_0x820d4e){return db[_0xed89('0x2b')][_0xed89('0x47')]({'where':{'id':_0x4d9db4['params']['id']}})['then'](handleEntityNotFound(_0x820d4e,null))[_0xed89('0x24')](removeEntity(_0x820d4e,null))[_0xed89('0x48')](handleError(_0x820d4e,null));}; \ No newline at end of file +var _0x53cf=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','type','keys','filters','model','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x53cf,0x8a));var _0xf53c=function(_0x4ea580,_0x506b90){_0x4ea580=_0x4ea580-0x0;var _0x1db420=_0x53cf[_0x4ea580];return _0x1db420;};'use strict';var emlformat=require(_0xf53c('0x0'));var rimraf=require(_0xf53c('0x1'));var zipdir=require(_0xf53c('0x2'));var jsonpatch=require(_0xf53c('0x3'));var rp=require('request-promise');var moment=require(_0xf53c('0x4'));var BPromise=require(_0xf53c('0x5'));var Mustache=require('mustache');var util=require(_0xf53c('0x6'));var path=require('path');var sox=require(_0xf53c('0x7'));var csv=require(_0xf53c('0x8'));var ejs=require(_0xf53c('0x9'));var fs=require('fs');var fs_extra=require(_0xf53c('0xa'));var _=require(_0xf53c('0xb'));var squel=require(_0xf53c('0xc'));var crypto=require(_0xf53c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf53c('0xe'));var toCsv=require(_0xf53c('0x8'));var querystring=require(_0xf53c('0xf'));var Papa=require(_0xf53c('0x10'));var Redis=require('ioredis');var authService=require(_0xf53c('0x11'));var qs=require(_0xf53c('0x12'));var as=require(_0xf53c('0x13'));var hardwareService=require(_0xf53c('0x14'));var logger=require(_0xf53c('0x15'))(_0xf53c('0x16'));var utils=require(_0xf53c('0x17'));var config=require(_0xf53c('0x18'));var licenseUtil=require(_0xf53c('0x19'));var db=require(_0xf53c('0x1a'))['db'];function respondWithStatusCode(_0x39c850,_0x4f60ea){_0x4f60ea=_0x4f60ea||0xcc;return function(_0xb9eb7a){if(_0xb9eb7a){return _0x39c850[_0xf53c('0x1b')](_0x4f60ea);}return _0x39c850[_0xf53c('0x1c')](_0x4f60ea)[_0xf53c('0x1d')]();};}function respondWithResult(_0x4b4a4b,_0x5acaf9){_0x5acaf9=_0x5acaf9||0xc8;return function(_0x2d3d15){if(_0x2d3d15){return _0x4b4a4b[_0xf53c('0x1c')](_0x5acaf9)[_0xf53c('0x1e')](_0x2d3d15);}};}function respondWithFilteredResult(_0x3986c8,_0x5704dd){return function(_0x129530){if(_0x129530){var _0x63c49f=typeof _0x5704dd[_0xf53c('0x1f')]===_0xf53c('0x20')&&typeof _0x5704dd[_0xf53c('0x21')]==='undefined';var _0x309914=_0x129530[_0xf53c('0x22')];var _0x1d0bad=_0x63c49f?0x0:_0x5704dd['offset'];var _0x454ac9=_0x63c49f?_0x129530[_0xf53c('0x22')]:_0x5704dd[_0xf53c('0x1f')]+_0x5704dd['limit'];var _0x1d7cc1;if(_0x454ac9>=_0x309914){_0x454ac9=_0x309914;_0x1d7cc1=0xc8;}else{_0x1d7cc1=0xce;}_0x3986c8['status'](_0x1d7cc1);return _0x3986c8[_0xf53c('0x23')](_0xf53c('0x24'),_0x1d0bad+'-'+_0x454ac9+'/'+_0x309914)[_0xf53c('0x1e')](_0x129530);}return null;};}function patchUpdates(_0x2099f8){return function(_0x45b2d9){try{jsonpatch['apply'](_0x45b2d9,_0x2099f8,!![]);}catch(_0x2aabcd){return BPromise[_0xf53c('0x25')](_0x2aabcd);}return _0x45b2d9[_0xf53c('0x26')]();};}function saveUpdates(_0x787ce3,_0x1af189){return function(_0xf77c39){if(_0xf77c39){return _0xf77c39['update'](_0x787ce3)[_0xf53c('0x27')](function(_0x3d5913){return _0x3d5913;});}return null;};}function removeEntity(_0x2e25f7,_0x446962){return function(_0x255c17){if(_0x255c17){return _0x255c17[_0xf53c('0x28')]()[_0xf53c('0x27')](function(){_0x2e25f7[_0xf53c('0x1c')](0xcc)[_0xf53c('0x1d')]();});}};}function handleEntityNotFound(_0x19c35c,_0x22ca8e){return function(_0x48faa4){if(!_0x48faa4){_0x19c35c['sendStatus'](0x194);}return _0x48faa4;};}function handleError(_0x4680c3,_0x1fc944){_0x1fc944=_0x1fc944||0x1f4;return function(_0x3ace5b){logger[_0xf53c('0x29')](_0x3ace5b[_0xf53c('0x2a')]);if(_0x3ace5b[_0xf53c('0x2b')]){delete _0x3ace5b[_0xf53c('0x2b')];}_0x4680c3[_0xf53c('0x1c')](_0x1fc944)[_0xf53c('0x2c')](_0x3ace5b);};}exports[_0xf53c('0x2d')]=function(_0x7b0cfa,_0x4987d3){var _0x8a5623={},_0x1d2cef={},_0x3213f4={'count':0x0,'rows':[]};var _0x5d1224=_[_0xf53c('0x2e')](db['ZohoField'][_0xf53c('0x2f')],function(_0x25de79){return{'name':_0x25de79['fieldName'],'type':_0x25de79[_0xf53c('0x30')]['key']};});_0x1d2cef['model']=_['map'](_0x5d1224,_0xf53c('0x2b'));_0x1d2cef['query']=_[_0xf53c('0x31')](_0x7b0cfa['query']);_0x1d2cef[_0xf53c('0x32')]=_['intersection'](_0x1d2cef[_0xf53c('0x33')],_0x1d2cef['query']);_0x8a5623['attributes']=_[_0xf53c('0x34')](_0x1d2cef['model'],qs['fields'](_0x7b0cfa[_0xf53c('0x35')][_0xf53c('0x36')]));_0x8a5623['attributes']=_0x8a5623[_0xf53c('0x37')][_0xf53c('0x38')]?_0x8a5623[_0xf53c('0x37')]:_0x1d2cef[_0xf53c('0x33')];if(!_0x7b0cfa[_0xf53c('0x35')][_0xf53c('0x39')](_0xf53c('0x3a'))){_0x8a5623[_0xf53c('0x21')]=qs[_0xf53c('0x21')](_0x7b0cfa['query'][_0xf53c('0x21')]);_0x8a5623['offset']=qs[_0xf53c('0x1f')](_0x7b0cfa[_0xf53c('0x35')]['offset']);}_0x8a5623[_0xf53c('0x3b')]=qs[_0xf53c('0x3c')](_0x7b0cfa[_0xf53c('0x35')][_0xf53c('0x3c')]);_0x8a5623[_0xf53c('0x3d')]=qs[_0xf53c('0x32')](_[_0xf53c('0x3e')](_0x7b0cfa[_0xf53c('0x35')],_0x1d2cef[_0xf53c('0x32')]),_0x5d1224);if(_0x7b0cfa[_0xf53c('0x35')][_0xf53c('0x3f')]){_0x8a5623[_0xf53c('0x3d')]=_['merge'](_0x8a5623[_0xf53c('0x3d')],{'$or':_[_0xf53c('0x2e')](_0x5d1224,function(_0x224aac){if(_0x224aac[_0xf53c('0x30')]!==_0xf53c('0x40')){var _0x212d31={};_0x212d31[_0x224aac[_0xf53c('0x2b')]]={'$like':'%'+_0x7b0cfa['query'][_0xf53c('0x3f')]+'%'};return _0x212d31;}})});}_0x8a5623=_['merge']({},_0x8a5623,_0x7b0cfa[_0xf53c('0x41')]);var _0xebea4b={'where':_0x8a5623['where']};return db[_0xf53c('0x42')][_0xf53c('0x22')](_0xebea4b)[_0xf53c('0x27')](function(_0x165962){_0x3213f4['count']=_0x165962;if(_0x7b0cfa[_0xf53c('0x35')][_0xf53c('0x43')]){_0x8a5623[_0xf53c('0x44')]=[{'all':!![]}];}return db[_0xf53c('0x42')][_0xf53c('0x45')](_0x8a5623);})[_0xf53c('0x27')](function(_0x245a62){_0x3213f4[_0xf53c('0x46')]=_0x245a62;return _0x3213f4;})[_0xf53c('0x27')](respondWithFilteredResult(_0x4987d3,_0x8a5623))[_0xf53c('0x47')](handleError(_0x4987d3,null));};exports[_0xf53c('0x48')]=function(_0x4f32b9,_0x3f14ee){var _0x6b4539={'raw':!![],'where':{'id':_0x4f32b9[_0xf53c('0x49')]['id']}},_0x22194c={};_0x22194c[_0xf53c('0x33')]=_['keys'](db[_0xf53c('0x42')][_0xf53c('0x2f')]);_0x22194c[_0xf53c('0x35')]=_['keys'](_0x4f32b9['query']);_0x22194c[_0xf53c('0x32')]=_[_0xf53c('0x34')](_0x22194c['model'],_0x22194c[_0xf53c('0x35')]);_0x6b4539[_0xf53c('0x37')]=_['intersection'](_0x22194c['model'],qs['fields'](_0x4f32b9['query'][_0xf53c('0x36')]));_0x6b4539[_0xf53c('0x37')]=_0x6b4539[_0xf53c('0x37')][_0xf53c('0x38')]?_0x6b4539[_0xf53c('0x37')]:_0x22194c['model'];if(_0x4f32b9[_0xf53c('0x35')][_0xf53c('0x43')]){_0x6b4539[_0xf53c('0x44')]=[{'all':!![]}];}_0x6b4539=_[_0xf53c('0x4a')]({},_0x6b4539,_0x4f32b9[_0xf53c('0x41')]);return db[_0xf53c('0x42')][_0xf53c('0x4b')](_0x6b4539)['then'](handleEntityNotFound(_0x3f14ee,null))[_0xf53c('0x27')](respondWithResult(_0x3f14ee,null))['catch'](handleError(_0x3f14ee,null));};exports['create']=function(_0x38c9db,_0x3a3923){return db['ZohoField'][_0xf53c('0x4c')](_0x38c9db[_0xf53c('0x4d')],{})[_0xf53c('0x27')](respondWithResult(_0x3a3923,0xc9))[_0xf53c('0x47')](handleError(_0x3a3923,null));};exports['update']=function(_0x5a76c7,_0x4a64b3){if(_0x5a76c7[_0xf53c('0x4d')]['id']){delete _0x5a76c7['body']['id'];}return db[_0xf53c('0x42')][_0xf53c('0x4b')]({'where':{'id':_0x5a76c7[_0xf53c('0x49')]['id']}})[_0xf53c('0x27')](handleEntityNotFound(_0x4a64b3,null))[_0xf53c('0x27')](saveUpdates(_0x5a76c7[_0xf53c('0x4d')],null))[_0xf53c('0x27')](respondWithResult(_0x4a64b3,null))[_0xf53c('0x47')](handleError(_0x4a64b3,null));};exports['destroy']=function(_0x495f2e,_0xea66b2){return db[_0xf53c('0x42')][_0xf53c('0x4b')]({'where':{'id':_0x495f2e['params']['id']}})[_0xf53c('0x27')](handleEntityNotFound(_0xea66b2,null))[_0xf53c('0x27')](removeEntity(_0xea66b2,null))[_0xf53c('0x47')](handleError(_0xea66b2,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a0d60ca..d6e0ba4 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 _0x5496=['moment','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x537501,_0x1509e4){var _0x54bfc2=function(_0x29bd68){while(--_0x29bd68){_0x537501['push'](_0x537501['shift']());}};_0x54bfc2(++_0x1509e4);}(_0x5496,0x175));var _0x6549=function(_0x6ee4b6,_0x85714a){_0x6ee4b6=_0x6ee4b6-0x0;var _0x52b2a5=_0x5496[_0x6ee4b6];return _0x52b2a5;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('ZohoField',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ace=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32bf34,_0x450065){var _0x4ed3ef=function(_0x4be04e){while(--_0x4be04e){_0x32bf34['push'](_0x32bf34['shift']());}};_0x4ed3ef(++_0x450065);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x57d3d9,_0x2d605b){_0x57d3d9=_0x57d3d9-0x0;var _0x46730c=_0x8ace[_0x57d3d9];return _0x46730c;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var logger=require(_0xe8ac('0x2'))(_0xe8ac('0x3'));var moment=require(_0xe8ac('0x4'));var BPromise=require(_0xe8ac('0x5'));var rp=require(_0xe8ac('0x6'));var fs=require('fs');var path=require(_0xe8ac('0x7'));var rimraf=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var attributes=require(_0xe8ac('0xa'));module[_0xe8ac('0xb')]=function(_0x170e14,_0x2b48ec){return _0x170e14['define'](_0xe8ac('0xc'),attributes,{'tableName':_0xe8ac('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xe8ac('0xe')],'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 fe3b350..225c12c 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 _0x3b19=['info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57f3bc,_0x1e1f46){var _0x14bec4=function(_0x1631c0){while(--_0x1631c0){_0x57f3bc['push'](_0x57f3bc['shift']());}};_0x14bec4(++_0x1e1f46);}(_0x3b19,0x19f));var _0x93b1=function(_0x2ce180,_0x5829ef){_0x2ce180=_0x2ce180-0x0;var _0x1e224e=_0x3b19[_0x2ce180];return _0x1e224e;};'use strict';var _=require(_0x93b1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x93b1('0x1'));var rs=require(_0x93b1('0x2'));var fs=require('fs');var Redis=require(_0x93b1('0x3'));var db=require(_0x93b1('0x4'))['db'];var utils=require(_0x93b1('0x5'));var logger=require('../../config/logger')(_0x93b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x93b1('0x7')][_0x93b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5229e8,_0x1b3c86,_0x2a92b0){return new BPromise(function(_0x56ec5e,_0xa25bd5){return client['request'](_0x5229e8,_0x2a92b0)[_0x93b1('0x9')](function(_0x27275e){logger['info'](_0x93b1('0xa'),_0x1b3c86,_0x93b1('0xb'));logger[_0x93b1('0xc')](_0x93b1('0xd'),_0x1b3c86,'request\x20sent',JSON[_0x93b1('0xe')](_0x27275e));if(_0x27275e[_0x93b1('0xf')]){if(_0x27275e[_0x93b1('0xf')][_0x93b1('0x10')]===0x1f4){logger[_0x93b1('0xf')](_0x93b1('0xa'),_0x1b3c86,_0x27275e[_0x93b1('0xf')]['message']);return _0xa25bd5(_0x27275e[_0x93b1('0xf')]['message']);}logger[_0x93b1('0xf')]('ZohoField,\x20%s,\x20%s',_0x1b3c86,_0x27275e[_0x93b1('0xf')]['message']);return _0x56ec5e(_0x27275e[_0x93b1('0xf')]['message']);}else{logger[_0x93b1('0x11')]('ZohoField,\x20%s,\x20%s',_0x1b3c86,'request\x20sent');_0x56ec5e(_0x27275e['result']['message']);}})['catch'](function(_0x1ecdd3){logger[_0x93b1('0xf')]('ZohoField,\x20%s,\x20%s',_0x1b3c86,_0x1ecdd3);_0xa25bd5(_0x1ecdd3);});});} \ No newline at end of file +var _0xa3b3=['info','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa3b3,0x1e5));var _0x3a3b=function(_0x5b29ef,_0x4000a6){_0x5b29ef=_0x5b29ef-0x0;var _0x1e13cd=_0xa3b3[_0x5b29ef];return _0x1e13cd;};'use strict';var _=require(_0x3a3b('0x0'));var util=require(_0x3a3b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a3b('0x2'));var db=require(_0x3a3b('0x3'))['db'];var utils=require(_0x3a3b('0x4'));var logger=require(_0x3a3b('0x5'))(_0x3a3b('0x6'));var config=require(_0x3a3b('0x7'));var jayson=require(_0x3a3b('0x8'));var client=jayson[_0x3a3b('0x9')][_0x3a3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x183890,_0x15c12b,_0x89f05c){return new BPromise(function(_0x2fdd2c,_0x35abf2){return client[_0x3a3b('0xb')](_0x183890,_0x89f05c)[_0x3a3b('0xc')](function(_0x3a6105){logger['info']('ZohoField,\x20%s,\x20%s',_0x15c12b,_0x3a3b('0xd'));logger[_0x3a3b('0xe')](_0x3a3b('0xf'),_0x15c12b,'request\x20sent',JSON[_0x3a3b('0x10')](_0x3a6105));if(_0x3a6105[_0x3a3b('0x11')]){if(_0x3a6105['error'][_0x3a3b('0x12')]===0x1f4){logger['error'](_0x3a3b('0x13'),_0x15c12b,_0x3a6105[_0x3a3b('0x11')][_0x3a3b('0x14')]);return _0x35abf2(_0x3a6105[_0x3a3b('0x11')][_0x3a3b('0x14')]);}logger[_0x3a3b('0x11')]('ZohoField,\x20%s,\x20%s',_0x15c12b,_0x3a6105[_0x3a3b('0x11')][_0x3a3b('0x14')]);return _0x2fdd2c(_0x3a6105[_0x3a3b('0x11')][_0x3a3b('0x14')]);}else{logger[_0x3a3b('0x15')](_0x3a3b('0x13'),_0x15c12b,_0x3a3b('0xd'));_0x2fdd2c(_0x3a6105['result'][_0x3a3b('0x14')]);}})[_0x3a3b('0x16')](function(_0x46e54c){logger['error'](_0x3a3b('0x13'),_0x15c12b,_0x46e54c);_0x35abf2(_0x46e54c);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index dcc2826..30b0c98 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4aea7e,_0x469432){var _0x27fb85=function(_0x5a0f86){while(--_0x5a0f86){_0x4aea7e['push'](_0x4aea7e['shift']());}};_0x27fb85(++_0x469432);}(_0xedd9,0xfc));var _0x9edd=function(_0x28a733,_0x20d00e){_0x28a733=_0x28a733-0x0;var _0x5bf803=_0xedd9[_0x28a733];return _0x5bf803;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x37990c,_0x56827c){var _0x12cb73=function(_0x989658){while(--_0x989658){_0x37990c['push'](_0x37990c['shift']());}};_0x12cb73(++_0x56827c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9ec84f4..42a5552 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 _0x6a14=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a14,0x13c));var _0x46a1=function(_0x4e43ca,_0x27c9ee){_0x4e43ca=_0x4e43ca-0x0;var _0x5c2582=_0x6a14[_0x4e43ca];return _0x5c2582;};'use strict';var Sequelize=require(_0x46a1('0x0'));module[_0x46a1('0x1')]={'name':{'type':Sequelize[_0x46a1('0x2')],'allowNull':![],'unique':_0x46a1('0x3')},'version':{'type':Sequelize[_0x46a1('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x46a1('0x2')],'defaultValue':_0x46a1('0x4')},'filename':{'type':Sequelize[_0x46a1('0x2')]},'path':{'type':Sequelize[_0x46a1('0x2')]},'type':{'type':Sequelize[_0x46a1('0x2')]},'size':{'type':Sequelize[_0x46a1('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x46a1('0x2')]},'state':{'type':Sequelize[_0x46a1('0x2')],'unique':_0x46a1('0x6')},'description':{'type':Sequelize[_0x46a1('0x2')]},'title':{'type':Sequelize[_0x46a1('0x2')]},'remoteUri':{'type':Sequelize[_0x46a1('0x2')]},'link':{'type':Sequelize[_0x46a1('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xd3b4=['INTEGER','BOOLEAN','state','sequelize','unique_name_and_version','STRING'];(function(_0xcd2a0a,_0x11cb95){var _0x3d707e=function(_0x3fb252){while(--_0x3fb252){_0xcd2a0a['push'](_0xcd2a0a['shift']());}};_0x3d707e(++_0x11cb95);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0x1553f9,_0x50d168){_0x1553f9=_0x1553f9-0x0;var _0x9961be=_0xd3b4[_0x1553f9];return _0x9961be;};'use strict';var Sequelize=require(_0x4d3b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4d3b('0x1')},'version':{'type':Sequelize[_0x4d3b('0x2')],'allowNull':![],'unique':_0x4d3b('0x1')},'main':{'type':Sequelize[_0x4d3b('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x4d3b('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d3b('0x2')]},'size':{'type':Sequelize[_0x4d3b('0x3')]},'active':{'type':Sequelize[_0x4d3b('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x4d3b('0x2')]},'logo':{'type':Sequelize[_0x4d3b('0x2')]},'state':{'type':Sequelize[_0x4d3b('0x2')],'unique':_0x4d3b('0x5')},'description':{'type':Sequelize[_0x4d3b('0x2')]},'title':{'type':Sequelize[_0x4d3b('0x2')]},'remoteUri':{'type':Sequelize[_0x4d3b('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ae1b2a3..e263170 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 _0x4137=['map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index'];(function(_0x588f0a,_0xf39bdc){var _0xb9185d=function(_0x1bc9e3){while(--_0x1bc9e3){_0x588f0a['push'](_0x588f0a['shift']());}};_0xb9185d(++_0xf39bdc);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['Integration'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['Integration']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));}; \ No newline at end of file +var _0x687b=['order','sort','where','filter','VIRTUAL','options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x1163c3,_0x3aedc6){var _0x7a7cb5=function(_0x2e4054){while(--_0x2e4054){_0x1163c3['push'](_0x1163c3['shift']());}};_0x7a7cb5(++_0x3aedc6);}(_0x687b,0x14a));var _0xb687=function(_0x1057cb,_0x7b8162){_0x1057cb=_0x1057cb-0x0;var _0x7fbf7e=_0x687b[_0x1057cb];return _0x7fbf7e;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['Integration'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['Integration']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b54ef6a..39c289d 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 _0x5e2a=['request-promise','path','rimraf','./integration.attributes','Integration','integrations','lodash','util','../../config/logger','api','moment'];(function(_0x23de94,_0x2391f1){var _0x37854c=function(_0x4e0b21){while(--_0x4e0b21){_0x23de94['push'](_0x23de94['shift']());}};_0x37854c(++_0x2391f1);}(_0x5e2a,0x171));var _0xa5e2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e2a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa5e2('0x0'));var util=require(_0xa5e2('0x1'));var logger=require(_0xa5e2('0x2'))(_0xa5e2('0x3'));var moment=require(_0xa5e2('0x4'));var BPromise=require('bluebird');var rp=require(_0xa5e2('0x5'));var fs=require('fs');var path=require(_0xa5e2('0x6'));var rimraf=require(_0xa5e2('0x7'));var config=require('../../config/environment');var attributes=require(_0xa5e2('0x8'));module['exports']=function(_0x1eee80,_0x2ff8ea){return _0x1eee80['define'](_0xa5e2('0x9'),attributes,{'tableName':_0xa5e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff17=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','integrations'];(function(_0x1bf748,_0x74d233){var _0x2c6432=function(_0x33d6ac){while(--_0x33d6ac){_0x1bf748['push'](_0x1bf748['shift']());}};_0x2c6432(++_0x74d233);}(_0xff17,0x6e));var _0x7ff1=function(_0x332693,_0x48ba40){_0x332693=_0x332693-0x0;var _0xbd9bbc=_0xff17[_0x332693];return _0xbd9bbc;};'use strict';var _=require(_0x7ff1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7ff1('0x1'));var BPromise=require(_0x7ff1('0x2'));var rp=require(_0x7ff1('0x3'));var fs=require('fs');var path=require(_0x7ff1('0x4'));var rimraf=require(_0x7ff1('0x5'));var config=require(_0x7ff1('0x6'));var attributes=require(_0x7ff1('0x7'));module[_0x7ff1('0x8')]=function(_0x48e228,_0x185c1a){return _0x48e228[_0x7ff1('0x9')]('Integration',attributes,{'tableName':_0x7ff1('0xa'),'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 d8743c4..c986d4c 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5813eb,_0x157c17){var _0x314c58=function(_0x45dcec){while(--_0x45dcec){_0x5813eb['push'](_0x5813eb['shift']());}};_0x314c58(++_0x157c17);}(_0xadb5,0xad));var _0x5adb=function(_0x2d8b6c,_0xe4a1b6){_0x2d8b6c=_0x2d8b6c-0x0;var _0xa4be25=_0xadb5[_0x2d8b6c];return _0xa4be25;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x13419e,_0x556c3b){var _0x324308=function(_0x345cc7){while(--_0x345cc7){_0x13419e['push'](_0x13419e['shift']());}};_0x324308(++_0x556c3b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 45dd72d..2f59e91 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x9f0e,0x116));var _0xe9f0=function(_0x477f6a,_0x307ed8){_0x477f6a=_0x477f6a-0x0;var _0x5c6f02=_0x9f0e[_0x477f6a];return _0x5c6f02;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1967=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0x1967,0x173));var _0x7196=function(_0x4f73fd,_0x253fb8){_0x4f73fd=_0x4f73fd-0x0;var _0x1d6c04=_0x1967[_0x4f73fd];return _0x1d6c04;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')]('/',auth[_0x7196('0xa')](),controller['create']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1e07acd..d8a8448 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 _0x363e=['BOOLEAN','TEXT','ENUM','SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x11ae74,_0x2e1747){var _0x1a582f=function(_0x52ac0e){while(--_0x52ac0e){_0x11ae74['push'](_0x11ae74['shift']());}};_0x1a582f(++_0x2e1747);}(_0x363e,0x113));var _0xe363=function(_0x37e8c5,_0x30361){_0x37e8c5=_0x37e8c5-0x0;var _0x346ba6=_0x363e[_0x37e8c5];return _0x346ba6;};'use strict';var Sequelize=require(_0xe363('0x0'));module[_0xe363('0x1')]={'integration':{'type':Sequelize[_0xe363('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xe363('0x2')]},'ticketId':{'type':Sequelize[_0xe363('0x2')]},'integrationId':{'type':Sequelize[_0xe363('0x3')]},'contacts':{'type':Sequelize[_0xe363('0x2')]},'uniqueid':{'type':Sequelize[_0xe363('0x2')]},'calleridnum':{'type':Sequelize[_0xe363('0x2')]},'calleridname':{'type':Sequelize[_0xe363('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xe363('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xe363('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xe363('0x3')]},'agentcomplete':{'type':Sequelize[_0xe363('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe363('0x4')]},'talktime':{'type':Sequelize[_0xe363('0x3')]},'agentacw':{'type':Sequelize[_0xe363('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe363('0x3')]},'reason':{'type':Sequelize[_0xe363('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xe363('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe363('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xe363('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe363('0x2')]},'channelstate':{'type':Sequelize[_0xe363('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe363('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe363('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe363('0x2')]},'accountcode':{'type':Sequelize[_0xe363('0x2')]},'context':{'type':Sequelize[_0xe363('0x2')]},'exten':{'type':Sequelize[_0xe363('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xe363('0x2')]},'destchannelstate':{'type':Sequelize[_0xe363('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe363('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xe363('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe363('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe363('0x2')]},'destlanguage':{'type':Sequelize[_0xe363('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe363('0x2')]},'destexten':{'type':Sequelize[_0xe363('0x2')]},'destpriority':{'type':Sequelize[_0xe363('0x2')]},'destuniqueid':{'type':Sequelize[_0xe363('0x2')]},'messageId':{'type':Sequelize[_0xe363('0x2')]},'inReplyTo':{'type':Sequelize[_0xe363('0x2')]},'subject':{'type':Sequelize[_0xe363('0x2')]},'from':{'type':Sequelize[_0xe363('0x2')]},'to':{'type':Sequelize[_0xe363('0x2')]},'cc':{'type':Sequelize[_0xe363('0x2')]},'attachment':{'type':Sequelize[_0xe363('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xe363('0x7')]('SENT',_0xe363('0x8'),'RECEIVED',_0xe363('0x9'))},'url':{'type':Sequelize[_0xe363('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xe363('0x3')]}}; \ No newline at end of file +var _0x53cf=['ENUM','SENT','RECEIVED','FAILED','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x53cf,0x1bd));var _0xf53c=function(_0x40f5fe,_0xb5a20){_0x40f5fe=_0x40f5fe-0x0;var _0xdb6822=_0x53cf[_0x40f5fe];return _0xdb6822;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0xf53c('0x0')]},'eventChannel':{'type':Sequelize[_0xf53c('0x0')]},'exitStatus':{'type':Sequelize[_0xf53c('0x0')]},'ticketId':{'type':Sequelize[_0xf53c('0x0')]},'integrationId':{'type':Sequelize[_0xf53c('0x1')]},'contacts':{'type':Sequelize[_0xf53c('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf53c('0x0')]},'queue':{'type':Sequelize[_0xf53c('0x0')]},'interface':{'type':Sequelize[_0xf53c('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xf53c('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf53c('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf53c('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf53c('0x1')]},'reason':{'type':Sequelize[_0xf53c('0x0')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf53c('0x2')]},'agentdump':{'type':Sequelize[_0xf53c('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf53c('0x2')]},'lastevent':{'type':Sequelize[_0xf53c('0x0')]},'channel':{'type':Sequelize[_0xf53c('0x0')]},'channelstate':{'type':Sequelize[_0xf53c('0x1')]},'channelstatedesc':{'type':Sequelize[_0xf53c('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf53c('0x0')]},'accountcode':{'type':Sequelize[_0xf53c('0x0')]},'context':{'type':Sequelize[_0xf53c('0x0')]},'exten':{'type':Sequelize[_0xf53c('0x0')]},'priority':{'type':Sequelize[_0xf53c('0x0')]},'destchannel':{'type':Sequelize[_0xf53c('0x0')]},'destchannelstate':{'type':Sequelize[_0xf53c('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0xf53c('0x0')]},'destcalleridnum':{'type':Sequelize[_0xf53c('0x0')]},'destcalleridname':{'type':Sequelize[_0xf53c('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xf53c('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xf53c('0x0')]},'destcontext':{'type':Sequelize[_0xf53c('0x0')]},'destexten':{'type':Sequelize[_0xf53c('0x0')]},'destpriority':{'type':Sequelize[_0xf53c('0x0')]},'destuniqueid':{'type':Sequelize[_0xf53c('0x0')]},'messageId':{'type':Sequelize[_0xf53c('0x0')]},'inReplyTo':{'type':Sequelize[_0xf53c('0x0')]},'subject':{'type':Sequelize[_0xf53c('0x0')]},'from':{'type':Sequelize[_0xf53c('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xf53c('0x0')]},'attachment':{'type':Sequelize[_0xf53c('0x4')]},'html':{'type':Sequelize[_0xf53c('0x4')]},'text':{'type':Sequelize[_0xf53c('0x4')]},'status':{'type':Sequelize[_0xf53c('0x5')](_0xf53c('0x6'),'SENDING',_0xf53c('0x7'),_0xf53c('0x8'))},'url':{'type':Sequelize[_0xf53c('0x0')]},'app':{'type':Sequelize[_0xf53c('0x0')]},'appdata':{'type':Sequelize[_0xf53c('0x0')]},'projectId':{'type':Sequelize[_0xf53c('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 337d2cf..f58cf4e 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 _0x5500=['keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','IntegrationReport','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','apply','reject','save','update','then','destroy','name','map','fieldName','type','key','model','query'];(function(_0x5af982,_0xf23606){var _0x7bd100=function(_0x1df1d3){while(--_0x1df1d3){_0x5af982['push'](_0x5af982['shift']());}};_0x7bd100(++_0xf23606);}(_0x5500,0xa8));var _0x0550=function(_0x56135f,_0x15c320){_0x56135f=_0x56135f-0x0;var _0x13d6ca=_0x5500[_0x56135f];return _0x13d6ca;};'use strict';var emlformat=require(_0x0550('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0550('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0550('0x2'));var moment=require(_0x0550('0x3'));var BPromise=require(_0x0550('0x4'));var Mustache=require(_0x0550('0x5'));var util=require(_0x0550('0x6'));var path=require('path');var sox=require(_0x0550('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0550('0x8'));var squel=require(_0x0550('0x9'));var crypto=require(_0x0550('0xa'));var jsforce=require(_0x0550('0xb'));var deskjs=require(_0x0550('0xc'));var toCsv=require(_0x0550('0xd'));var querystring=require(_0x0550('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0550('0xf'));var qs=require(_0x0550('0x10'));var as=require(_0x0550('0x11'));var hardwareService=require(_0x0550('0x12'));var logger=require(_0x0550('0x13'))(_0x0550('0x14'));var utils=require(_0x0550('0x15'));var config=require(_0x0550('0x16'));var licenseUtil=require(_0x0550('0x17'));var db=require(_0x0550('0x18'))['db'];function respondWithStatusCode(_0x457dd6,_0x13e33c){_0x13e33c=_0x13e33c||0xcc;return function(_0x7ff081){if(_0x7ff081){return _0x457dd6[_0x0550('0x19')](_0x13e33c);}return _0x457dd6[_0x0550('0x1a')](_0x13e33c)[_0x0550('0x1b')]();};}function respondWithResult(_0x2341b4,_0xf82f2d){_0xf82f2d=_0xf82f2d||0xc8;return function(_0xfb819){if(_0xfb819){return _0x2341b4[_0x0550('0x1a')](_0xf82f2d)['json'](_0xfb819);}};}function respondWithFilteredResult(_0x2a08a3,_0x5e9bb9){return function(_0x485269){if(_0x485269){var _0x544cbb=typeof _0x5e9bb9[_0x0550('0x1c')]==='undefined'&&typeof _0x5e9bb9[_0x0550('0x1d')]===_0x0550('0x1e');var _0x914d04=_0x485269[_0x0550('0x1f')];var _0x31b3f6=_0x544cbb?0x0:_0x5e9bb9[_0x0550('0x1c')];var _0x458e07=_0x544cbb?_0x485269[_0x0550('0x1f')]:_0x5e9bb9[_0x0550('0x1c')]+_0x5e9bb9['limit'];var _0x3da80b;if(_0x458e07>=_0x914d04){_0x458e07=_0x914d04;_0x3da80b=0xc8;}else{_0x3da80b=0xce;}_0x2a08a3['status'](_0x3da80b);return _0x2a08a3['set']('Content-Range',_0x31b3f6+'-'+_0x458e07+'/'+_0x914d04)['json'](_0x485269);}return null;};}function patchUpdates(_0x408073){return function(_0x481cef){try{jsonpatch[_0x0550('0x20')](_0x481cef,_0x408073,!![]);}catch(_0x467d2d){return BPromise[_0x0550('0x21')](_0x467d2d);}return _0x481cef[_0x0550('0x22')]();};}function saveUpdates(_0x3c47ac,_0x2725e3){return function(_0x278778){if(_0x278778){return _0x278778[_0x0550('0x23')](_0x3c47ac)[_0x0550('0x24')](function(_0x2e089b){return _0x2e089b;});}return null;};}function removeEntity(_0x28c6fb,_0x119b5d){return function(_0x5c2c91){if(_0x5c2c91){return _0x5c2c91[_0x0550('0x25')]()[_0x0550('0x24')](function(){_0x28c6fb[_0x0550('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e9931,_0x157a72){return function(_0x55116a){if(!_0x55116a){_0x1e9931[_0x0550('0x19')](0x194);}return _0x55116a;};}function handleError(_0x224e01,_0x2c8a76){_0x2c8a76=_0x2c8a76||0x1f4;return function(_0x50f10c){logger['error'](_0x50f10c['stack']);if(_0x50f10c[_0x0550('0x26')]){delete _0x50f10c[_0x0550('0x26')];}_0x224e01['status'](_0x2c8a76)['send'](_0x50f10c);};}exports['index']=function(_0x3aea33,_0x3d4e15){var _0x3c1b7d={},_0x724ede={},_0x142c41={'count':0x0,'rows':[]};var _0x34b047=_[_0x0550('0x27')](db['IntegrationReport']['rawAttributes'],function(_0x239a9d){return{'name':_0x239a9d[_0x0550('0x28')],'type':_0x239a9d[_0x0550('0x29')][_0x0550('0x2a')]};});_0x724ede[_0x0550('0x2b')]=_[_0x0550('0x27')](_0x34b047,_0x0550('0x26'));_0x724ede[_0x0550('0x2c')]=_[_0x0550('0x2d')](_0x3aea33[_0x0550('0x2c')]);_0x724ede['filters']=_[_0x0550('0x2e')](_0x724ede[_0x0550('0x2b')],_0x724ede['query']);_0x3c1b7d[_0x0550('0x2f')]=_[_0x0550('0x2e')](_0x724ede[_0x0550('0x2b')],qs[_0x0550('0x30')](_0x3aea33[_0x0550('0x2c')]['fields']));_0x3c1b7d[_0x0550('0x2f')]=_0x3c1b7d[_0x0550('0x2f')][_0x0550('0x31')]?_0x3c1b7d[_0x0550('0x2f')]:_0x724ede[_0x0550('0x2b')];if(!_0x3aea33[_0x0550('0x2c')]['hasOwnProperty'](_0x0550('0x32'))){_0x3c1b7d[_0x0550('0x1d')]=qs[_0x0550('0x1d')](_0x3aea33[_0x0550('0x2c')][_0x0550('0x1d')]);_0x3c1b7d['offset']=qs['offset'](_0x3aea33[_0x0550('0x2c')][_0x0550('0x1c')]);}_0x3c1b7d[_0x0550('0x33')]=qs[_0x0550('0x34')](_0x3aea33[_0x0550('0x2c')]['sort']);_0x3c1b7d[_0x0550('0x35')]=qs[_0x0550('0x36')](_[_0x0550('0x37')](_0x3aea33['query'],_0x724ede[_0x0550('0x36')]),_0x34b047);if(_0x3aea33[_0x0550('0x2c')]['filter']){_0x3c1b7d[_0x0550('0x35')]=_['merge'](_0x3c1b7d[_0x0550('0x35')],{'$or':_[_0x0550('0x27')](_0x34b047,function(_0x7af150){if(_0x7af150[_0x0550('0x29')]!==_0x0550('0x38')){var _0x13a746={};_0x13a746[_0x7af150[_0x0550('0x26')]]={'$like':'%'+_0x3aea33[_0x0550('0x2c')]['filter']+'%'};return _0x13a746;}})});}_0x3c1b7d=_[_0x0550('0x39')]({},_0x3c1b7d,_0x3aea33[_0x0550('0x3a')]);var _0x21cb6e={'where':_0x3c1b7d[_0x0550('0x35')]};return db[_0x0550('0x3b')][_0x0550('0x1f')](_0x21cb6e)[_0x0550('0x24')](function(_0x37ded9){_0x142c41['count']=_0x37ded9;if(_0x3aea33[_0x0550('0x2c')][_0x0550('0x3c')]){_0x3c1b7d[_0x0550('0x3d')]=[{'all':!![]}];}return db[_0x0550('0x3b')][_0x0550('0x3e')](_0x3c1b7d);})[_0x0550('0x24')](function(_0x4f0824){_0x142c41['rows']=_0x4f0824;return _0x142c41;})[_0x0550('0x24')](respondWithFilteredResult(_0x3d4e15,_0x3c1b7d))['catch'](handleError(_0x3d4e15,null));};exports[_0x0550('0x3f')]=function(_0x571d47,_0x38883b){var _0x1980f7={'raw':![],'where':{'id':_0x571d47[_0x0550('0x40')]['id']}},_0x1fe17d={};_0x1fe17d['model']=_[_0x0550('0x2d')](db[_0x0550('0x3b')][_0x0550('0x41')]);_0x1fe17d['query']=_[_0x0550('0x2d')](_0x571d47[_0x0550('0x2c')]);_0x1fe17d[_0x0550('0x36')]=_['intersection'](_0x1fe17d['model'],_0x1fe17d['query']);_0x1980f7['attributes']=_['intersection'](_0x1fe17d[_0x0550('0x2b')],qs[_0x0550('0x30')](_0x571d47[_0x0550('0x2c')][_0x0550('0x30')]));_0x1980f7['attributes']=_0x1980f7[_0x0550('0x2f')][_0x0550('0x31')]?_0x1980f7[_0x0550('0x2f')]:_0x1fe17d[_0x0550('0x2b')];if(_0x571d47[_0x0550('0x2c')][_0x0550('0x3c')]){_0x1980f7[_0x0550('0x3d')]=[{'all':!![]}];}_0x1980f7=_['merge']({},_0x1980f7,_0x571d47[_0x0550('0x3a')]);return db[_0x0550('0x3b')][_0x0550('0x42')](_0x1980f7)[_0x0550('0x24')](handleEntityNotFound(_0x38883b,null))[_0x0550('0x24')](respondWithResult(_0x38883b,null))[_0x0550('0x43')](handleError(_0x38883b,null));};exports['create']=function(_0x33bf33,_0x41bd2a){return db[_0x0550('0x3b')][_0x0550('0x44')](_0x33bf33[_0x0550('0x45')],{})[_0x0550('0x24')](respondWithResult(_0x41bd2a,0xc9))['catch'](handleError(_0x41bd2a,null));};exports['update']=function(_0x28f9eb,_0x4b8a70){if(_0x28f9eb['body']['id']){delete _0x28f9eb[_0x0550('0x45')]['id'];}return db[_0x0550('0x3b')]['find']({'where':{'id':_0x28f9eb[_0x0550('0x40')]['id']}})[_0x0550('0x24')](handleEntityNotFound(_0x4b8a70,null))['then'](saveUpdates(_0x28f9eb[_0x0550('0x45')],null))[_0x0550('0x24')](respondWithResult(_0x4b8a70,null))[_0x0550('0x43')](handleError(_0x4b8a70,null));};exports[_0x0550('0x25')]=function(_0x2d90c2,_0x6abc9f){return db[_0x0550('0x3b')]['find']({'where':{'id':_0x2d90c2[_0x0550('0x40')]['id']}})['then'](handleEntityNotFound(_0x6abc9f,null))[_0x0550('0x24')](removeEntity(_0x6abc9f,null))[_0x0550('0x43')](handleError(_0x6abc9f,null));};exports[_0x0550('0x46')]=function(_0x202289,_0x266cf0){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x266cf0,null))['catch'](handleError(_0x266cf0,null));}; \ No newline at end of file +var _0xf80a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','map','IntegrationReport','rawAttributes','type','model','query','intersection','fields','attributes','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x52aba4,_0x197aa3){var _0x48d5b0=function(_0x46b7ad){while(--_0x46b7ad){_0x52aba4['push'](_0x52aba4['shift']());}};_0x48d5b0(++_0x197aa3);}(_0xf80a,0x157));var _0xaf80=function(_0x1c4b09,_0x512bcf){_0x1c4b09=_0x1c4b09-0x0;var _0x58ea00=_0xf80a[_0x1c4b09];return _0x58ea00;};'use strict';var emlformat=require(_0xaf80('0x0'));var rimraf=require(_0xaf80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf80('0x2'));var rp=require(_0xaf80('0x3'));var moment=require(_0xaf80('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaf80('0x5'));var util=require('util');var path=require(_0xaf80('0x6'));var sox=require(_0xaf80('0x7'));var csv=require(_0xaf80('0x8'));var ejs=require(_0xaf80('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf80('0xa'));var squel=require(_0xaf80('0xb'));var crypto=require(_0xaf80('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaf80('0xd'));var toCsv=require(_0xaf80('0x8'));var querystring=require(_0xaf80('0xe'));var Papa=require(_0xaf80('0xf'));var Redis=require(_0xaf80('0x10'));var authService=require(_0xaf80('0x11'));var qs=require(_0xaf80('0x12'));var as=require(_0xaf80('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf80('0x14'))('api');var utils=require(_0xaf80('0x15'));var config=require(_0xaf80('0x16'));var licenseUtil=require(_0xaf80('0x17'));var db=require(_0xaf80('0x18'))['db'];function respondWithStatusCode(_0x2a92bf,_0x297228){_0x297228=_0x297228||0xcc;return function(_0xc1f136){if(_0xc1f136){return _0x2a92bf[_0xaf80('0x19')](_0x297228);}return _0x2a92bf[_0xaf80('0x1a')](_0x297228)[_0xaf80('0x1b')]();};}function respondWithResult(_0x236ff1,_0x265687){_0x265687=_0x265687||0xc8;return function(_0x4a01ea){if(_0x4a01ea){return _0x236ff1['status'](_0x265687)['json'](_0x4a01ea);}};}function respondWithFilteredResult(_0x303d25,_0x4f4b8e){return function(_0x1398c4){if(_0x1398c4){var _0x3a74c3=typeof _0x4f4b8e[_0xaf80('0x1c')]==='undefined'&&typeof _0x4f4b8e[_0xaf80('0x1d')]===_0xaf80('0x1e');var _0x2815f3=_0x1398c4['count'];var _0x523251=_0x3a74c3?0x0:_0x4f4b8e['offset'];var _0x42ada9=_0x3a74c3?_0x1398c4[_0xaf80('0x1f')]:_0x4f4b8e[_0xaf80('0x1c')]+_0x4f4b8e[_0xaf80('0x1d')];var _0x3da3ba;if(_0x42ada9>=_0x2815f3){_0x42ada9=_0x2815f3;_0x3da3ba=0xc8;}else{_0x3da3ba=0xce;}_0x303d25[_0xaf80('0x1a')](_0x3da3ba);return _0x303d25[_0xaf80('0x20')](_0xaf80('0x21'),_0x523251+'-'+_0x42ada9+'/'+_0x2815f3)[_0xaf80('0x22')](_0x1398c4);}return null;};}function patchUpdates(_0x18e9ff){return function(_0x273019){try{jsonpatch['apply'](_0x273019,_0x18e9ff,!![]);}catch(_0x415bfe){return BPromise[_0xaf80('0x23')](_0x415bfe);}return _0x273019[_0xaf80('0x24')]();};}function saveUpdates(_0x45c1d1,_0x4a7c31){return function(_0x5edd5c){if(_0x5edd5c){return _0x5edd5c[_0xaf80('0x25')](_0x45c1d1)[_0xaf80('0x26')](function(_0x439055){return _0x439055;});}return null;};}function removeEntity(_0x59ce81,_0x3ffa12){return function(_0x2a66bc){if(_0x2a66bc){return _0x2a66bc[_0xaf80('0x27')]()[_0xaf80('0x26')](function(){_0x59ce81[_0xaf80('0x1a')](0xcc)[_0xaf80('0x1b')]();});}};}function handleEntityNotFound(_0x30b5f6,_0xe935a3){return function(_0x5b668d){if(!_0x5b668d){_0x30b5f6[_0xaf80('0x19')](0x194);}return _0x5b668d;};}function handleError(_0x5ec106,_0x1ab759){_0x1ab759=_0x1ab759||0x1f4;return function(_0x325df6){logger[_0xaf80('0x28')](_0x325df6[_0xaf80('0x29')]);if(_0x325df6[_0xaf80('0x2a')]){delete _0x325df6['name'];}_0x5ec106[_0xaf80('0x1a')](_0x1ab759)[_0xaf80('0x2b')](_0x325df6);};}exports['index']=function(_0x1c6885,_0x3a9501){var _0x53b8e={},_0x262636={},_0x11f7a3={'count':0x0,'rows':[]};var _0x32ed63=_[_0xaf80('0x2c')](db[_0xaf80('0x2d')][_0xaf80('0x2e')],function(_0x22cca9){return{'name':_0x22cca9['fieldName'],'type':_0x22cca9[_0xaf80('0x2f')]['key']};});_0x262636[_0xaf80('0x30')]=_[_0xaf80('0x2c')](_0x32ed63,'name');_0x262636[_0xaf80('0x31')]=_['keys'](_0x1c6885[_0xaf80('0x31')]);_0x262636['filters']=_[_0xaf80('0x32')](_0x262636[_0xaf80('0x30')],_0x262636[_0xaf80('0x31')]);_0x53b8e['attributes']=_['intersection'](_0x262636[_0xaf80('0x30')],qs[_0xaf80('0x33')](_0x1c6885[_0xaf80('0x31')][_0xaf80('0x33')]));_0x53b8e[_0xaf80('0x34')]=_0x53b8e[_0xaf80('0x34')]['length']?_0x53b8e[_0xaf80('0x34')]:_0x262636[_0xaf80('0x30')];if(!_0x1c6885[_0xaf80('0x31')][_0xaf80('0x35')]('nolimit')){_0x53b8e[_0xaf80('0x1d')]=qs[_0xaf80('0x1d')](_0x1c6885[_0xaf80('0x31')][_0xaf80('0x1d')]);_0x53b8e[_0xaf80('0x1c')]=qs[_0xaf80('0x1c')](_0x1c6885[_0xaf80('0x31')][_0xaf80('0x1c')]);}_0x53b8e['order']=qs['sort'](_0x1c6885[_0xaf80('0x31')][_0xaf80('0x36')]);_0x53b8e[_0xaf80('0x37')]=qs[_0xaf80('0x38')](_['pick'](_0x1c6885[_0xaf80('0x31')],_0x262636[_0xaf80('0x38')]),_0x32ed63);if(_0x1c6885['query'][_0xaf80('0x39')]){_0x53b8e['where']=_[_0xaf80('0x3a')](_0x53b8e['where'],{'$or':_[_0xaf80('0x2c')](_0x32ed63,function(_0x253d76){if(_0x253d76['type']!==_0xaf80('0x3b')){var _0x1c52d0={};_0x1c52d0[_0x253d76['name']]={'$like':'%'+_0x1c6885['query'][_0xaf80('0x39')]+'%'};return _0x1c52d0;}})});}_0x53b8e=_[_0xaf80('0x3a')]({},_0x53b8e,_0x1c6885[_0xaf80('0x3c')]);var _0x3ddae9={'where':_0x53b8e[_0xaf80('0x37')]};return db[_0xaf80('0x2d')]['count'](_0x3ddae9)[_0xaf80('0x26')](function(_0x47a49c){_0x11f7a3['count']=_0x47a49c;if(_0x1c6885[_0xaf80('0x31')][_0xaf80('0x3d')]){_0x53b8e[_0xaf80('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0xaf80('0x3f')](_0x53b8e);})['then'](function(_0x583bf5){_0x11f7a3['rows']=_0x583bf5;return _0x11f7a3;})[_0xaf80('0x26')](respondWithFilteredResult(_0x3a9501,_0x53b8e))[_0xaf80('0x40')](handleError(_0x3a9501,null));};exports[_0xaf80('0x41')]=function(_0x37d492,_0x1a68d2){var _0x40b2e3={'raw':![],'where':{'id':_0x37d492[_0xaf80('0x42')]['id']}},_0x49d7da={};_0x49d7da[_0xaf80('0x30')]=_[_0xaf80('0x43')](db['IntegrationReport'][_0xaf80('0x2e')]);_0x49d7da[_0xaf80('0x31')]=_[_0xaf80('0x43')](_0x37d492[_0xaf80('0x31')]);_0x49d7da[_0xaf80('0x38')]=_[_0xaf80('0x32')](_0x49d7da[_0xaf80('0x30')],_0x49d7da[_0xaf80('0x31')]);_0x40b2e3['attributes']=_[_0xaf80('0x32')](_0x49d7da[_0xaf80('0x30')],qs[_0xaf80('0x33')](_0x37d492[_0xaf80('0x31')][_0xaf80('0x33')]));_0x40b2e3[_0xaf80('0x34')]=_0x40b2e3[_0xaf80('0x34')][_0xaf80('0x44')]?_0x40b2e3[_0xaf80('0x34')]:_0x49d7da[_0xaf80('0x30')];if(_0x37d492['query'][_0xaf80('0x3d')]){_0x40b2e3[_0xaf80('0x3e')]=[{'all':!![]}];}_0x40b2e3=_[_0xaf80('0x3a')]({},_0x40b2e3,_0x37d492[_0xaf80('0x3c')]);return db[_0xaf80('0x2d')][_0xaf80('0x45')](_0x40b2e3)[_0xaf80('0x26')](handleEntityNotFound(_0x1a68d2,null))[_0xaf80('0x26')](respondWithResult(_0x1a68d2,null))['catch'](handleError(_0x1a68d2,null));};exports[_0xaf80('0x46')]=function(_0x334f3f,_0x1e643d){return db[_0xaf80('0x2d')][_0xaf80('0x46')](_0x334f3f[_0xaf80('0x47')],{})[_0xaf80('0x26')](respondWithResult(_0x1e643d,0xc9))[_0xaf80('0x40')](handleError(_0x1e643d,null));};exports[_0xaf80('0x25')]=function(_0x5ec16c,_0x214290){if(_0x5ec16c[_0xaf80('0x47')]['id']){delete _0x5ec16c[_0xaf80('0x47')]['id'];}return db[_0xaf80('0x2d')][_0xaf80('0x45')]({'where':{'id':_0x5ec16c[_0xaf80('0x42')]['id']}})['then'](handleEntityNotFound(_0x214290,null))['then'](saveUpdates(_0x5ec16c[_0xaf80('0x47')],null))[_0xaf80('0x26')](respondWithResult(_0x214290,null))['catch'](handleError(_0x214290,null));};exports[_0xaf80('0x27')]=function(_0x5ab95e,_0x2aebfa){return db[_0xaf80('0x2d')][_0xaf80('0x45')]({'where':{'id':_0x5ab95e[_0xaf80('0x42')]['id']}})[_0xaf80('0x26')](handleEntityNotFound(_0x2aebfa,null))[_0xaf80('0x26')](removeEntity(_0x2aebfa,null))[_0xaf80('0x40')](handleError(_0x2aebfa,null));};exports['describe']=function(_0x4a8ea1,_0x45e1d9){return db[_0xaf80('0x2d')]['describe']()[_0xaf80('0x26')](respondWithResult(_0x45e1d9,null))[_0xaf80('0x40')](handleError(_0x45e1d9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0275a46..58c4ed1 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 _0x4252=['exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x3ed85f,_0x4dd215){var _0x5d3e2d=function(_0x40ca59){while(--_0x40ca59){_0x3ed85f['push'](_0x3ed85f['shift']());}};_0x5d3e2d(++_0x4dd215);}(_0x4252,0x15d));var _0x2425=function(_0x2af85d,_0x280d27){_0x2af85d=_0x2af85d-0x0;var _0x155684=_0x4252[_0x2af85d];return _0x155684;};'use strict';var _=require(_0x2425('0x0'));var util=require(_0x2425('0x1'));var logger=require(_0x2425('0x2'))(_0x2425('0x3'));var moment=require(_0x2425('0x4'));var BPromise=require(_0x2425('0x5'));var rp=require(_0x2425('0x6'));var fs=require('fs');var path=require(_0x2425('0x7'));var rimraf=require(_0x2425('0x8'));var config=require(_0x2425('0x9'));var attributes=require(_0x2425('0xa'));module[_0x2425('0xb')]=function(_0x38afe9,_0x2332c3){return _0x38afe9[_0x2425('0xc')](_0x2425('0xd'),attributes,{'tableName':_0x2425('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bf2=['moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api'];(function(_0x3c36eb,_0x3fc1dd){var _0x47fda3=function(_0x4f4d8e){while(--_0x4f4d8e){_0x3c36eb['push'](_0x3c36eb['shift']());}};_0x47fda3(++_0x3fc1dd);}(_0x9bf2,0xea));var _0x29bf=function(_0x222c55,_0x214b8f){_0x222c55=_0x222c55-0x0;var _0x4e89a4=_0x9bf2[_0x222c55];return _0x4e89a4;};'use strict';var _=require(_0x29bf('0x0'));var util=require(_0x29bf('0x1'));var logger=require(_0x29bf('0x2'))(_0x29bf('0x3'));var moment=require(_0x29bf('0x4'));var BPromise=require(_0x29bf('0x5'));var rp=require(_0x29bf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x29bf('0x7'));var config=require(_0x29bf('0x8'));var attributes=require(_0x29bf('0x9'));module[_0x29bf('0xa')]=function(_0x4720db,_0x1499b2){return _0x4720db[_0x29bf('0xb')](_0x29bf('0xc'),attributes,{'tableName':_0x29bf('0xd'),'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 84442ed..117a8b1 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5a9821,_0x4b7258){var _0x52b1d1=function(_0x3a8cab){while(--_0x3a8cab){_0x5a9821['push'](_0x5a9821['shift']());}};_0x52b1d1(++_0x4b7258);}(_0x326f,0xd1));var _0xf326=function(_0xc40ecb,_0x1bfb20){_0xc40ecb=_0xc40ecb-0x0;var _0x31f47e=_0x326f[_0xc40ecb];return _0x31f47e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x53ec,0x192));var _0xc53e=function(_0x131090,_0x4b5e43){_0x131090=_0x131090-0x0;var _0x1e10cf=_0x53ec[_0x131090];return _0x1e10cf;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 7fbb5b0..199b914 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 _0x07d7=['get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x07d7,0x85));var _0x707d=function(_0x238830,_0x545f75){_0x238830=_0x238830-0x0;var _0x5917f0=_0x07d7[_0x238830];return _0x5917f0;};'use strict';var multer=require(_0x707d('0x0'));var util=require(_0x707d('0x1'));var path=require(_0x707d('0x2'));var timeout=require(_0x707d('0x3'));var express=require(_0x707d('0x4'));var router=express[_0x707d('0x5')]();var fs_extra=require(_0x707d('0x6'));var auth=require(_0x707d('0x7'));var interaction=require(_0x707d('0x8'));var config=require(_0x707d('0x9'));var controller=require(_0x707d('0xa'));router[_0x707d('0xb')]('/',auth[_0x707d('0xc')](),controller[_0x707d('0xd')]);router[_0x707d('0xb')](_0x707d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x707d('0xb')](_0x707d('0xf'),auth[_0x707d('0xc')](),controller[_0x707d('0x10')]);router[_0x707d('0x11')]('/',auth['isAuthenticated'](),controller[_0x707d('0x12')]);router[_0x707d('0x11')](_0x707d('0xf'),auth['isAuthenticated'](),controller[_0x707d('0x13')]);router[_0x707d('0x11')](_0x707d('0x14'),auth['isAuthenticated'](),controller['addIntervals']);router['put'](_0x707d('0xe'),auth[_0x707d('0xc')](),controller[_0x707d('0x15')]);router['delete'](_0x707d('0xe'),auth['isAuthenticated'](),controller[_0x707d('0x16')]);module[_0x707d('0x17')]=router; \ No newline at end of file +var _0x9a96=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports'];(function(_0x541eb2,_0x5c40a2){var _0x31abe5=function(_0x19227a){while(--_0x19227a){_0x541eb2['push'](_0x541eb2['shift']());}};_0x31abe5(++_0x5c40a2);}(_0x9a96,0xd0));var _0x69a9=function(_0x117a74,_0x3f42eb){_0x117a74=_0x117a74-0x0;var _0x3b4f4d=_0x9a96[_0x117a74];return _0x3b4f4d;};'use strict';var multer=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var path=require(_0x69a9('0x2'));var timeout=require(_0x69a9('0x3'));var express=require(_0x69a9('0x4'));var router=express[_0x69a9('0x5')]();var fs_extra=require(_0x69a9('0x6'));var auth=require(_0x69a9('0x7'));var interaction=require(_0x69a9('0x8'));var config=require(_0x69a9('0x9'));var controller=require(_0x69a9('0xa'));router[_0x69a9('0xb')]('/',auth['isAuthenticated'](),controller[_0x69a9('0xc')]);router[_0x69a9('0xb')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller['show']);router[_0x69a9('0xb')](_0x69a9('0xf'),auth[_0x69a9('0xe')](),controller[_0x69a9('0x10')]);router[_0x69a9('0x11')]('/',auth[_0x69a9('0xe')](),controller[_0x69a9('0x12')]);router['post'](_0x69a9('0xf'),auth['isAuthenticated'](),controller[_0x69a9('0x13')]);router[_0x69a9('0x11')](_0x69a9('0x14'),auth['isAuthenticated'](),controller[_0x69a9('0x15')]);router[_0x69a9('0x16')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller[_0x69a9('0x17')]);router[_0x69a9('0x18')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller['destroy']);module[_0x69a9('0x19')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b10ae24..3d6f341 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 _0xfcea=['exports','sequelize'];(function(_0x17ef6b,_0x5b3fdc){var _0x86c5ef=function(_0x1ec864){while(--_0x1ec864){_0x17ef6b['push'](_0x17ef6b['shift']());}};_0x86c5ef(++_0x5b3fdc);}(_0xfcea,0x87));var _0xafce=function(_0x3131ae,_0x52ec27){_0x3131ae=_0x3131ae-0x0;var _0x458bf4=_0xfcea[_0x3131ae];return _0x458bf4;};'use strict';var Sequelize=require(_0xafce('0x0'));module[_0xafce('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x4a87=['sequelize','exports','STRING'];(function(_0x65d4f6,_0x40d851){var _0x22a1ce=function(_0x1d3902){while(--_0x1d3902){_0x65d4f6['push'](_0x65d4f6['shift']());}};_0x22a1ce(++_0x40d851);}(_0x4a87,0x13e));var _0x74a8=function(_0x141a7e,_0x4ce6bd){_0x141a7e=_0x141a7e-0x0;var _0x1e1d10=_0x4a87[_0x141a7e];return _0x1e1d10;};'use strict';var Sequelize=require(_0x74a8('0x0'));module[_0x74a8('0x1')]={'name':{'type':Sequelize[_0x74a8('0x2')]},'description':{'type':Sequelize[_0x74a8('0x2')]},'interval':{'type':Sequelize[_0x74a8('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 d4708ca..9f2e525 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 _0xe289=['Content-Range','update','then','get','UserProfileResource','error','stack','name','index','map','Interval','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','userProfileId','destroy','IntervalId','getIntervals','findOne','order','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','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','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','undefined','count','set'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xe289,0xe5));var _0x9e28=function(_0x3969c1,_0x522586){_0x3969c1=_0x3969c1-0x0;var _0x394313=_0xe289[_0x3969c1];return _0x394313;};'use strict';var emlformat=require(_0x9e28('0x0'));var rimraf=require(_0x9e28('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e28('0x2'));var rp=require(_0x9e28('0x3'));var moment=require(_0x9e28('0x4'));var BPromise=require(_0x9e28('0x5'));var Mustache=require(_0x9e28('0x6'));var util=require(_0x9e28('0x7'));var path=require(_0x9e28('0x8'));var sox=require(_0x9e28('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e28('0xa'));var _=require('lodash');var squel=require(_0x9e28('0xb'));var crypto=require(_0x9e28('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9e28('0xd'));var querystring=require(_0x9e28('0xe'));var Papa=require(_0x9e28('0xf'));var Redis=require(_0x9e28('0x10'));var authService=require(_0x9e28('0x11'));var qs=require(_0x9e28('0x12'));var as=require(_0x9e28('0x13'));var hardwareService=require(_0x9e28('0x14'));var logger=require(_0x9e28('0x15'))('api');var utils=require(_0x9e28('0x16'));var config=require(_0x9e28('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e28('0x18'))['db'];var extensions=require(_0x9e28('0x19'));function respondWithStatusCode(_0x435651,_0x5d7bae){_0x5d7bae=_0x5d7bae||0xcc;return function(_0x356ffa){if(_0x356ffa){return _0x435651[_0x9e28('0x1a')](_0x5d7bae);}return _0x435651[_0x9e28('0x1b')](_0x5d7bae)[_0x9e28('0x1c')]();};}function respondWithResult(_0x506b46,_0x563e4b){_0x563e4b=_0x563e4b||0xc8;return function(_0x2adaa8){if(_0x2adaa8){return _0x506b46['status'](_0x563e4b)[_0x9e28('0x1d')](_0x2adaa8);}};}function respondWithFilteredResult(_0x45e6b4,_0x46824c){return function(_0x16d61b){if(_0x16d61b){var _0x45a13b=typeof _0x46824c[_0x9e28('0x1e')]==='undefined'&&typeof _0x46824c[_0x9e28('0x1f')]===_0x9e28('0x20');var _0x1c5ea5=_0x16d61b[_0x9e28('0x21')];var _0xdd44f7=_0x45a13b?0x0:_0x46824c[_0x9e28('0x1e')];var _0x4d4411=_0x45a13b?_0x16d61b['count']:_0x46824c[_0x9e28('0x1e')]+_0x46824c[_0x9e28('0x1f')];var _0x34c201;if(_0x4d4411>=_0x1c5ea5){_0x4d4411=_0x1c5ea5;_0x34c201=0xc8;}else{_0x34c201=0xce;}_0x45e6b4[_0x9e28('0x1b')](_0x34c201);return _0x45e6b4[_0x9e28('0x22')](_0x9e28('0x23'),_0xdd44f7+'-'+_0x4d4411+'/'+_0x1c5ea5)[_0x9e28('0x1d')](_0x16d61b);}return null;};}function patchUpdates(_0x541e83){return function(_0x5757ed){try{jsonpatch['apply'](_0x5757ed,_0x541e83,!![]);}catch(_0x1caa35){return BPromise['reject'](_0x1caa35);}return _0x5757ed['save']();};}function saveUpdates(_0x158ca7,_0x4baed0){return function(_0x4e8978){if(_0x4e8978){return _0x4e8978[_0x9e28('0x24')](_0x158ca7)[_0x9e28('0x25')](function(_0x5865f4){return _0x5865f4;});}return null;};}function removeEntity(_0x5283e8,_0x43a1c2){return function(_0x81335c){if(_0x81335c){return _0x81335c['destroy']()[_0x9e28('0x25')](function(){var _0x244230=_0x81335c[_0x9e28('0x26')]({'plain':!![]});var _0x5e0839='Intervals';return db[_0x9e28('0x27')]['destroy']({'where':{'type':_0x5e0839,'resourceId':_0x244230['id']}})['then'](function(){return _0x81335c;});})[_0x9e28('0x25')](function(){_0x5283e8[_0x9e28('0x1b')](0xcc)[_0x9e28('0x1c')]();});}};}function handleEntityNotFound(_0x29ef6a,_0x205c62){return function(_0x3a6955){if(!_0x3a6955){_0x29ef6a['sendStatus'](0x194);}return _0x3a6955;};}function handleError(_0x442e1e,_0x5b925f){_0x5b925f=_0x5b925f||0x1f4;return function(_0x189ed7){logger[_0x9e28('0x28')](_0x189ed7[_0x9e28('0x29')]);if(_0x189ed7[_0x9e28('0x2a')]){delete _0x189ed7[_0x9e28('0x2a')];}_0x442e1e[_0x9e28('0x1b')](_0x5b925f)['send'](_0x189ed7);};}exports[_0x9e28('0x2b')]=function(_0x1ea8db,_0x5c09c1){var _0x166013={},_0x4c93bd={},_0x13b3b1={'count':0x0,'rows':[]};var _0x1edbb4=_[_0x9e28('0x2c')](db[_0x9e28('0x2d')][_0x9e28('0x2e')],function(_0x2680cf){return{'name':_0x2680cf[_0x9e28('0x2f')],'type':_0x2680cf[_0x9e28('0x30')]['key']};});_0x4c93bd[_0x9e28('0x31')]=_[_0x9e28('0x2c')](_0x1edbb4,_0x9e28('0x2a'));_0x4c93bd['query']=_[_0x9e28('0x32')](_0x1ea8db['query']);_0x4c93bd['filters']=_[_0x9e28('0x33')](_0x4c93bd['model'],_0x4c93bd[_0x9e28('0x34')]);_0x166013[_0x9e28('0x35')]=_[_0x9e28('0x33')](_0x4c93bd[_0x9e28('0x31')],qs[_0x9e28('0x36')](_0x1ea8db[_0x9e28('0x34')]['fields']));_0x166013[_0x9e28('0x35')]=_0x166013[_0x9e28('0x35')][_0x9e28('0x37')]?_0x166013[_0x9e28('0x35')]:_0x4c93bd[_0x9e28('0x31')];if(!_0x1ea8db['query']['hasOwnProperty'](_0x9e28('0x38'))){_0x166013['limit']=qs['limit'](_0x1ea8db['query'][_0x9e28('0x1f')]);_0x166013[_0x9e28('0x1e')]=qs[_0x9e28('0x1e')](_0x1ea8db['query'][_0x9e28('0x1e')]);}_0x166013['order']=qs[_0x9e28('0x39')](_0x1ea8db[_0x9e28('0x34')][_0x9e28('0x39')]);_0x166013['where']=qs[_0x9e28('0x3a')](_[_0x9e28('0x3b')](_0x1ea8db[_0x9e28('0x34')],_0x4c93bd[_0x9e28('0x3a')]),_0x1edbb4);if(_0x1ea8db['query'][_0x9e28('0x3c')]){_0x166013[_0x9e28('0x3d')]=_[_0x9e28('0x3e')](_0x166013[_0x9e28('0x3d')],{'$or':_[_0x9e28('0x2c')](_0x1edbb4,function(_0x5ebba9){if(_0x5ebba9[_0x9e28('0x30')]!=='VIRTUAL'){var _0x4061b1={};_0x4061b1[_0x5ebba9[_0x9e28('0x2a')]]={'$like':'%'+_0x1ea8db[_0x9e28('0x34')][_0x9e28('0x3c')]+'%'};return _0x4061b1;}})});}_0x166013=_[_0x9e28('0x3e')]({},_0x166013,_0x1ea8db['options']);var _0x18b963={'where':_0x166013[_0x9e28('0x3d')]};return db[_0x9e28('0x2d')][_0x9e28('0x21')](_0x18b963)['then'](function(_0x1738d1){_0x13b3b1[_0x9e28('0x21')]=_0x1738d1;if(_0x1ea8db[_0x9e28('0x34')][_0x9e28('0x3f')]){_0x166013[_0x9e28('0x40')]=[{'all':!![]}];}return db[_0x9e28('0x2d')][_0x9e28('0x41')](_0x166013);})['then'](function(_0x1fd23c){_0x13b3b1[_0x9e28('0x42')]=_0x1fd23c;return _0x13b3b1;})[_0x9e28('0x25')](respondWithFilteredResult(_0x5c09c1,_0x166013))[_0x9e28('0x43')](handleError(_0x5c09c1,null));};exports[_0x9e28('0x44')]=function(_0xaf4d4f,_0x140b8e){var _0x2b3161={'raw':!![],'where':{'id':_0xaf4d4f[_0x9e28('0x45')]['id']}},_0x582f98={};_0x582f98['model']=_[_0x9e28('0x32')](db[_0x9e28('0x2d')][_0x9e28('0x2e')]);_0x582f98[_0x9e28('0x34')]=_[_0x9e28('0x32')](_0xaf4d4f[_0x9e28('0x34')]);_0x582f98[_0x9e28('0x3a')]=_[_0x9e28('0x33')](_0x582f98['model'],_0x582f98['query']);_0x2b3161[_0x9e28('0x35')]=_[_0x9e28('0x33')](_0x582f98[_0x9e28('0x31')],qs['fields'](_0xaf4d4f[_0x9e28('0x34')][_0x9e28('0x36')]));_0x2b3161[_0x9e28('0x35')]=_0x2b3161[_0x9e28('0x35')][_0x9e28('0x37')]?_0x2b3161[_0x9e28('0x35')]:_0x582f98['model'];if(_0xaf4d4f['query'][_0x9e28('0x3f')]){_0x2b3161[_0x9e28('0x40')]=[{'all':!![]}];}_0x2b3161=_[_0x9e28('0x3e')]({},_0x2b3161,_0xaf4d4f[_0x9e28('0x46')]);return db[_0x9e28('0x2d')][_0x9e28('0x47')](_0x2b3161)['then'](handleEntityNotFound(_0x140b8e,null))[_0x9e28('0x25')](respondWithResult(_0x140b8e,null))[_0x9e28('0x43')](handleError(_0x140b8e,null));};exports['create']=function(_0x5cb3ad,_0x3c77c5){return db[_0x9e28('0x2d')][_0x9e28('0x48')](_0x5cb3ad[_0x9e28('0x49')],{})['then'](function(_0x9ed3d4){var _0x24a7b6=_0x5cb3ad[_0x9e28('0x4a')][_0x9e28('0x26')]({'plain':!![]});if(!_0x24a7b6)throw new Error(_0x9e28('0x4b'));if(_0x24a7b6[_0x9e28('0x4c')]==='user'){var _0xf65d42=_0x9ed3d4[_0x9e28('0x26')]({'plain':!![]});var _0x1d27a6=_0x9e28('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0x1d27a6,'userProfileId':_0x24a7b6[_0x9e28('0x4e')]},'raw':!![]})[_0x9e28('0x25')](function(_0x365ed7){if(_0x365ed7&&_0x365ed7['autoAssociation']===0x0){return db[_0x9e28('0x27')][_0x9e28('0x48')]({'name':_0xf65d42[_0x9e28('0x2a')],'resourceId':_0xf65d42['id'],'type':_0x365ed7[_0x9e28('0x2a')],'sectionId':_0x365ed7['id']},{})[_0x9e28('0x25')](function(){return _0x9ed3d4;});}else{return _0x9ed3d4;}})[_0x9e28('0x43')](function(_0x9f7788){logger[_0x9e28('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9f7788);throw _0x9f7788;});}return _0x9ed3d4;})[_0x9e28('0x25')](respondWithResult(_0x3c77c5,0xc9))[_0x9e28('0x43')](handleError(_0x3c77c5,null));};exports[_0x9e28('0x24')]=function(_0x259763,_0x7e97f9){if(_0x259763['body']['id']){delete _0x259763[_0x9e28('0x49')]['id'];}return db[_0x9e28('0x2d')][_0x9e28('0x47')]({'where':{'id':_0x259763[_0x9e28('0x45')]['id']}})[_0x9e28('0x25')](handleEntityNotFound(_0x7e97f9,null))[_0x9e28('0x25')](saveUpdates(_0x259763[_0x9e28('0x49')],null))['then'](respondWithResult(_0x7e97f9,null))[_0x9e28('0x43')](handleError(_0x7e97f9,null));};exports[_0x9e28('0x4f')]=function(_0x5f2779,_0x2e088f){return db[_0x9e28('0x2d')][_0x9e28('0x47')]({'where':{'id':_0x5f2779[_0x9e28('0x45')]['id']}})[_0x9e28('0x25')](handleEntityNotFound(_0x2e088f,null))[_0x9e28('0x25')](removeEntity(_0x2e088f,null))['catch'](handleError(_0x2e088f,null));};exports['addInterval']=function(_0x44286e,_0x371da0,_0x49fb00){if(_0x44286e[_0x9e28('0x49')]['id']){delete _0x44286e['body']['id'];}return db['Interval']['find']({'where':{'id':_0x44286e[_0x9e28('0x45')]['id']}})['then'](handleEntityNotFound(_0x371da0,null))['then'](function(_0x28f33f){if(_0x28f33f){_0x44286e['body'][_0x9e28('0x50')]=_0x28f33f['id'];return db[_0x9e28('0x2d')]['create'](_0x44286e[_0x9e28('0x49')]);}})['then'](respondWithResult(_0x371da0,null))[_0x9e28('0x43')](handleError(_0x371da0,null));};exports[_0x9e28('0x51')]=function(_0x27772a,_0x39a9e6,_0x5ba99c){var _0x927521={};var _0x351934={};var _0x1376d0;var _0x2d285c;return db[_0x9e28('0x2d')][_0x9e28('0x52')]({'where':{'id':_0x27772a[_0x9e28('0x45')]['id']}})[_0x9e28('0x25')](handleEntityNotFound(_0x39a9e6,null))[_0x9e28('0x25')](function(_0xbabe41){if(_0xbabe41){_0x1376d0=_0xbabe41;_0x351934['model']=_[_0x9e28('0x32')](db['Interval'][_0x9e28('0x2e')]);_0x351934[_0x9e28('0x34')]=_[_0x9e28('0x32')](_0x27772a[_0x9e28('0x34')]);_0x351934[_0x9e28('0x3a')]=_['intersection'](_0x351934[_0x9e28('0x31')],_0x351934[_0x9e28('0x34')]);_0x927521['attributes']=_[_0x9e28('0x33')](_0x351934[_0x9e28('0x31')],qs[_0x9e28('0x36')](_0x27772a[_0x9e28('0x34')][_0x9e28('0x36')]));_0x927521['attributes']=_0x927521[_0x9e28('0x35')][_0x9e28('0x37')]?_0x927521['attributes']:_0x351934[_0x9e28('0x31')];_0x927521[_0x9e28('0x53')]=qs[_0x9e28('0x39')](_0x27772a[_0x9e28('0x34')]['sort']);_0x927521[_0x9e28('0x3d')]=qs[_0x9e28('0x3a')](_['pick'](_0x27772a[_0x9e28('0x34')],_0x351934[_0x9e28('0x3a')]));if(_0x27772a[_0x9e28('0x34')]['filter']){_0x927521[_0x9e28('0x3d')]=_['merge'](_0x927521[_0x9e28('0x3d')],{'$or':_['map'](_0x927521[_0x9e28('0x35')],function(_0x360f40){var _0x5191f9={};_0x5191f9[_0x360f40]={'$like':'%'+_0x27772a[_0x9e28('0x34')][_0x9e28('0x3c')]+'%'};return _0x5191f9;})});}_0x927521=_[_0x9e28('0x3e')]({},_0x927521,_0x27772a[_0x9e28('0x46')]);return _0x1376d0[_0x9e28('0x51')](_0x927521);}})['then'](function(_0x583514){if(_0x583514){_0x2d285c=_0x583514[_0x9e28('0x37')];if(!_0x27772a['query']['hasOwnProperty'](_0x9e28('0x38'))){_0x927521[_0x9e28('0x1f')]=qs[_0x9e28('0x1f')](_0x27772a['query'][_0x9e28('0x1f')]);_0x927521[_0x9e28('0x1e')]=qs['offset'](_0x27772a['query'][_0x9e28('0x1e')]);}return _0x1376d0[_0x9e28('0x51')](_0x927521);}})[_0x9e28('0x25')](function(_0x234a9e){if(_0x234a9e){return _0x234a9e?{'count':_0x2d285c,'rows':_0x234a9e}:null;}})['then'](respondWithResult(_0x39a9e6,null))['catch'](handleError(_0x39a9e6,null));};exports[_0x9e28('0x54')]=function(_0x43a742,_0x4f2bee,_0x3bd3c0){return db[_0x9e28('0x2d')][_0x9e28('0x52')]({'where':{'id':_0x43a742['params']['id']}})[_0x9e28('0x25')](handleEntityNotFound(_0x4f2bee,null))[_0x9e28('0x25')](function(_0x3c2e5b){if(_0x3c2e5b){return db[_0x9e28('0x55')][_0x9e28('0x56')](function(_0x52f4a3){return db['Interval']['destroy']({'where':{'IntervalId':_0x43a742[_0x9e28('0x45')]['id']},'transaction':_0x52f4a3})[_0x9e28('0x25')](function(_0x6852f7){var _0x3d47b5=_[_0x9e28('0x2c')](_0x43a742['body'],function(_0x45f1d2){delete _0x45f1d2['id'];_0x45f1d2[_0x9e28('0x50')]=_0x43a742['params']['id'];return _0x45f1d2;});return db[_0x9e28('0x2d')][_0x9e28('0x57')](_0x3d47b5,{'transaction':_0x52f4a3});});})['then'](function(){return db[_0x9e28('0x2d')][_0x9e28('0x41')]({'where':{'IntervalId':_0x43a742[_0x9e28('0x45')]['id']}});});}})[_0x9e28('0x25')](respondWithResult(_0x4f2bee,null))[_0x9e28('0x43')](handleError(_0x4f2bee,null));}; \ No newline at end of file +var _0x1680=['../../components/extensions/rewrite','sendStatus','offset','limit','undefined','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','name','send','index','map','Interval','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2243f6,_0x25a647){var _0x3557f3=function(_0x846750){while(--_0x846750){_0x2243f6['push'](_0x2243f6['shift']());}};_0x3557f3(++_0x25a647);}(_0x1680,0x9d));var _0x0168=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x1680[_0x2d3ab3];return _0x321f9e;};'use strict';var emlformat=require(_0x0168('0x0'));var rimraf=require(_0x0168('0x1'));var zipdir=require(_0x0168('0x2'));var jsonpatch=require(_0x0168('0x3'));var rp=require(_0x0168('0x4'));var moment=require(_0x0168('0x5'));var BPromise=require(_0x0168('0x6'));var Mustache=require(_0x0168('0x7'));var util=require('util');var path=require(_0x0168('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0168('0x9'));var fs=require('fs');var fs_extra=require(_0x0168('0xa'));var _=require(_0x0168('0xb'));var squel=require(_0x0168('0xc'));var crypto=require(_0x0168('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0168('0xe'));var querystring=require('querystring');var Papa=require(_0x0168('0xf'));var Redis=require('ioredis');var authService=require(_0x0168('0x10'));var qs=require(_0x0168('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0168('0x12'));var utils=require(_0x0168('0x13'));var config=require(_0x0168('0x14'));var licenseUtil=require(_0x0168('0x15'));var db=require(_0x0168('0x16'))['db'];var extensions=require(_0x0168('0x17'));function respondWithStatusCode(_0x28d909,_0x53e3ee){_0x53e3ee=_0x53e3ee||0xcc;return function(_0x2a470a){if(_0x2a470a){return _0x28d909[_0x0168('0x18')](_0x53e3ee);}return _0x28d909['status'](_0x53e3ee)['end']();};}function respondWithResult(_0x1a36d2,_0x56705f){_0x56705f=_0x56705f||0xc8;return function(_0x451580){if(_0x451580){return _0x1a36d2['status'](_0x56705f)['json'](_0x451580);}};}function respondWithFilteredResult(_0x501b13,_0x117b7c){return function(_0x12113c){if(_0x12113c){var _0x1a027e=typeof _0x117b7c[_0x0168('0x19')]==='undefined'&&typeof _0x117b7c[_0x0168('0x1a')]===_0x0168('0x1b');var _0x1a3ab8=_0x12113c[_0x0168('0x1c')];var _0x1568b4=_0x1a027e?0x0:_0x117b7c[_0x0168('0x19')];var _0x55b887=_0x1a027e?_0x12113c[_0x0168('0x1c')]:_0x117b7c[_0x0168('0x19')]+_0x117b7c[_0x0168('0x1a')];var _0x441ae6;if(_0x55b887>=_0x1a3ab8){_0x55b887=_0x1a3ab8;_0x441ae6=0xc8;}else{_0x441ae6=0xce;}_0x501b13[_0x0168('0x1d')](_0x441ae6);return _0x501b13[_0x0168('0x1e')](_0x0168('0x1f'),_0x1568b4+'-'+_0x55b887+'/'+_0x1a3ab8)[_0x0168('0x20')](_0x12113c);}return null;};}function patchUpdates(_0x4b7c3e){return function(_0xaaaebe){try{jsonpatch[_0x0168('0x21')](_0xaaaebe,_0x4b7c3e,!![]);}catch(_0x42a2fe){return BPromise[_0x0168('0x22')](_0x42a2fe);}return _0xaaaebe[_0x0168('0x23')]();};}function saveUpdates(_0x55bd31,_0x21c477){return function(_0x2905d7){if(_0x2905d7){return _0x2905d7[_0x0168('0x24')](_0x55bd31)[_0x0168('0x25')](function(_0x52a7ff){return _0x52a7ff;});}return null;};}function removeEntity(_0x5b9994,_0x18eb34){return function(_0x1d9ed6){if(_0x1d9ed6){return _0x1d9ed6[_0x0168('0x26')]()[_0x0168('0x25')](function(){var _0x3e47fb=_0x1d9ed6[_0x0168('0x27')]({'plain':!![]});var _0x3dc0f5=_0x0168('0x28');return db[_0x0168('0x29')][_0x0168('0x26')]({'where':{'type':_0x3dc0f5,'resourceId':_0x3e47fb['id']}})['then'](function(){return _0x1d9ed6;});})['then'](function(){_0x5b9994[_0x0168('0x1d')](0xcc)[_0x0168('0x2a')]();});}};}function handleEntityNotFound(_0x52e55d,_0x52b58f){return function(_0x3721ac){if(!_0x3721ac){_0x52e55d['sendStatus'](0x194);}return _0x3721ac;};}function handleError(_0x58fc94,_0x4b7e13){_0x4b7e13=_0x4b7e13||0x1f4;return function(_0x5220ba){logger['error'](_0x5220ba['stack']);if(_0x5220ba[_0x0168('0x2b')]){delete _0x5220ba[_0x0168('0x2b')];}_0x58fc94[_0x0168('0x1d')](_0x4b7e13)[_0x0168('0x2c')](_0x5220ba);};}exports[_0x0168('0x2d')]=function(_0xc3753e,_0x5be225){var _0x3a9756={},_0x49186a={},_0x56d923={'count':0x0,'rows':[]};var _0x263173=_[_0x0168('0x2e')](db[_0x0168('0x2f')][_0x0168('0x30')],function(_0x429cb0){return{'name':_0x429cb0['fieldName'],'type':_0x429cb0[_0x0168('0x31')]['key']};});_0x49186a[_0x0168('0x32')]=_['map'](_0x263173,_0x0168('0x2b'));_0x49186a[_0x0168('0x33')]=_[_0x0168('0x34')](_0xc3753e[_0x0168('0x33')]);_0x49186a[_0x0168('0x35')]=_['intersection'](_0x49186a[_0x0168('0x32')],_0x49186a[_0x0168('0x33')]);_0x3a9756[_0x0168('0x36')]=_[_0x0168('0x37')](_0x49186a[_0x0168('0x32')],qs[_0x0168('0x38')](_0xc3753e[_0x0168('0x33')][_0x0168('0x38')]));_0x3a9756[_0x0168('0x36')]=_0x3a9756['attributes'][_0x0168('0x39')]?_0x3a9756[_0x0168('0x36')]:_0x49186a['model'];if(!_0xc3753e[_0x0168('0x33')][_0x0168('0x3a')](_0x0168('0x3b'))){_0x3a9756[_0x0168('0x1a')]=qs['limit'](_0xc3753e[_0x0168('0x33')]['limit']);_0x3a9756[_0x0168('0x19')]=qs[_0x0168('0x19')](_0xc3753e[_0x0168('0x33')][_0x0168('0x19')]);}_0x3a9756[_0x0168('0x3c')]=qs[_0x0168('0x3d')](_0xc3753e['query'][_0x0168('0x3d')]);_0x3a9756['where']=qs['filters'](_[_0x0168('0x3e')](_0xc3753e[_0x0168('0x33')],_0x49186a['filters']),_0x263173);if(_0xc3753e[_0x0168('0x33')][_0x0168('0x3f')]){_0x3a9756[_0x0168('0x40')]=_[_0x0168('0x41')](_0x3a9756[_0x0168('0x40')],{'$or':_[_0x0168('0x2e')](_0x263173,function(_0x376114){if(_0x376114[_0x0168('0x31')]!==_0x0168('0x42')){var _0x53ea04={};_0x53ea04[_0x376114[_0x0168('0x2b')]]={'$like':'%'+_0xc3753e['query'][_0x0168('0x3f')]+'%'};return _0x53ea04;}})});}_0x3a9756=_[_0x0168('0x41')]({},_0x3a9756,_0xc3753e['options']);var _0x4b98a8={'where':_0x3a9756[_0x0168('0x40')]};return db['Interval'][_0x0168('0x1c')](_0x4b98a8)[_0x0168('0x25')](function(_0x5ab985){_0x56d923[_0x0168('0x1c')]=_0x5ab985;if(_0xc3753e['query'][_0x0168('0x43')]){_0x3a9756[_0x0168('0x44')]=[{'all':!![]}];}return db[_0x0168('0x2f')][_0x0168('0x45')](_0x3a9756);})[_0x0168('0x25')](function(_0x16e696){_0x56d923[_0x0168('0x46')]=_0x16e696;return _0x56d923;})[_0x0168('0x25')](respondWithFilteredResult(_0x5be225,_0x3a9756))['catch'](handleError(_0x5be225,null));};exports['show']=function(_0x51ac4f,_0x1297ed){var _0x37ba22={'raw':!![],'where':{'id':_0x51ac4f['params']['id']}},_0x4e72fe={};_0x4e72fe[_0x0168('0x32')]=_[_0x0168('0x34')](db[_0x0168('0x2f')]['rawAttributes']);_0x4e72fe['query']=_[_0x0168('0x34')](_0x51ac4f['query']);_0x4e72fe[_0x0168('0x35')]=_[_0x0168('0x37')](_0x4e72fe['model'],_0x4e72fe[_0x0168('0x33')]);_0x37ba22[_0x0168('0x36')]=_[_0x0168('0x37')](_0x4e72fe['model'],qs['fields'](_0x51ac4f[_0x0168('0x33')][_0x0168('0x38')]));_0x37ba22[_0x0168('0x36')]=_0x37ba22[_0x0168('0x36')][_0x0168('0x39')]?_0x37ba22[_0x0168('0x36')]:_0x4e72fe[_0x0168('0x32')];if(_0x51ac4f['query'][_0x0168('0x43')]){_0x37ba22[_0x0168('0x44')]=[{'all':!![]}];}_0x37ba22=_[_0x0168('0x41')]({},_0x37ba22,_0x51ac4f[_0x0168('0x47')]);return db[_0x0168('0x2f')][_0x0168('0x48')](_0x37ba22)['then'](handleEntityNotFound(_0x1297ed,null))[_0x0168('0x25')](respondWithResult(_0x1297ed,null))[_0x0168('0x49')](handleError(_0x1297ed,null));};exports[_0x0168('0x4a')]=function(_0x35b97f,_0x2bc729){return db[_0x0168('0x2f')][_0x0168('0x4a')](_0x35b97f[_0x0168('0x4b')],{})[_0x0168('0x25')](function(_0x488fd6){var _0x4285ce=_0x35b97f[_0x0168('0x4c')]['get']({'plain':!![]});if(!_0x4285ce)throw new Error(_0x0168('0x4d'));if(_0x4285ce[_0x0168('0x4e')]==='user'){var _0x1ece4e=_0x488fd6[_0x0168('0x27')]({'plain':!![]});var _0x48322b='Intervals';return db[_0x0168('0x4f')]['find']({'where':{'name':_0x48322b,'userProfileId':_0x4285ce[_0x0168('0x50')]},'raw':!![]})[_0x0168('0x25')](function(_0x145aa3){if(_0x145aa3&&_0x145aa3['autoAssociation']===0x0){return db['UserProfileResource'][_0x0168('0x4a')]({'name':_0x1ece4e[_0x0168('0x2b')],'resourceId':_0x1ece4e['id'],'type':_0x145aa3[_0x0168('0x2b')],'sectionId':_0x145aa3['id']},{})[_0x0168('0x25')](function(){return _0x488fd6;});}else{return _0x488fd6;}})[_0x0168('0x49')](function(_0x4d9826){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d9826);throw _0x4d9826;});}return _0x488fd6;})[_0x0168('0x25')](respondWithResult(_0x2bc729,0xc9))[_0x0168('0x49')](handleError(_0x2bc729,null));};exports['update']=function(_0x4882f2,_0x56ff33){if(_0x4882f2[_0x0168('0x4b')]['id']){delete _0x4882f2[_0x0168('0x4b')]['id'];}return db['Interval'][_0x0168('0x48')]({'where':{'id':_0x4882f2[_0x0168('0x51')]['id']}})[_0x0168('0x25')](handleEntityNotFound(_0x56ff33,null))[_0x0168('0x25')](saveUpdates(_0x4882f2[_0x0168('0x4b')],null))[_0x0168('0x25')](respondWithResult(_0x56ff33,null))[_0x0168('0x49')](handleError(_0x56ff33,null));};exports['destroy']=function(_0x53637d,_0x151545){return db[_0x0168('0x2f')]['find']({'where':{'id':_0x53637d[_0x0168('0x51')]['id']}})[_0x0168('0x25')](handleEntityNotFound(_0x151545,null))[_0x0168('0x25')](removeEntity(_0x151545,null))[_0x0168('0x49')](handleError(_0x151545,null));};exports[_0x0168('0x52')]=function(_0x5902c9,_0x5e6082,_0x3c8bf5){if(_0x5902c9['body']['id']){delete _0x5902c9[_0x0168('0x4b')]['id'];}return db[_0x0168('0x2f')][_0x0168('0x48')]({'where':{'id':_0x5902c9[_0x0168('0x51')]['id']}})[_0x0168('0x25')](handleEntityNotFound(_0x5e6082,null))[_0x0168('0x25')](function(_0x400be1){if(_0x400be1){_0x5902c9[_0x0168('0x4b')][_0x0168('0x53')]=_0x400be1['id'];return db[_0x0168('0x2f')][_0x0168('0x4a')](_0x5902c9[_0x0168('0x4b')]);}})[_0x0168('0x25')](respondWithResult(_0x5e6082,null))[_0x0168('0x49')](handleError(_0x5e6082,null));};exports[_0x0168('0x54')]=function(_0x31afec,_0x56a66f,_0x273625){var _0x1bbdb2={};var _0x3497f8={};var _0x5bfa94;var _0x4dbdff;return db[_0x0168('0x2f')]['findOne']({'where':{'id':_0x31afec['params']['id']}})[_0x0168('0x25')](handleEntityNotFound(_0x56a66f,null))[_0x0168('0x25')](function(_0x15a84d){if(_0x15a84d){_0x5bfa94=_0x15a84d;_0x3497f8[_0x0168('0x32')]=_[_0x0168('0x34')](db[_0x0168('0x2f')][_0x0168('0x30')]);_0x3497f8[_0x0168('0x33')]=_[_0x0168('0x34')](_0x31afec['query']);_0x3497f8[_0x0168('0x35')]=_[_0x0168('0x37')](_0x3497f8[_0x0168('0x32')],_0x3497f8[_0x0168('0x33')]);_0x1bbdb2['attributes']=_[_0x0168('0x37')](_0x3497f8[_0x0168('0x32')],qs['fields'](_0x31afec[_0x0168('0x33')][_0x0168('0x38')]));_0x1bbdb2[_0x0168('0x36')]=_0x1bbdb2[_0x0168('0x36')][_0x0168('0x39')]?_0x1bbdb2[_0x0168('0x36')]:_0x3497f8[_0x0168('0x32')];_0x1bbdb2[_0x0168('0x3c')]=qs[_0x0168('0x3d')](_0x31afec[_0x0168('0x33')][_0x0168('0x3d')]);_0x1bbdb2[_0x0168('0x40')]=qs[_0x0168('0x35')](_[_0x0168('0x3e')](_0x31afec[_0x0168('0x33')],_0x3497f8[_0x0168('0x35')]));if(_0x31afec[_0x0168('0x33')][_0x0168('0x3f')]){_0x1bbdb2[_0x0168('0x40')]=_[_0x0168('0x41')](_0x1bbdb2[_0x0168('0x40')],{'$or':_['map'](_0x1bbdb2[_0x0168('0x36')],function(_0x53a6ae){var _0x119d1c={};_0x119d1c[_0x53a6ae]={'$like':'%'+_0x31afec[_0x0168('0x33')][_0x0168('0x3f')]+'%'};return _0x119d1c;})});}_0x1bbdb2=_[_0x0168('0x41')]({},_0x1bbdb2,_0x31afec[_0x0168('0x47')]);return _0x5bfa94[_0x0168('0x54')](_0x1bbdb2);}})['then'](function(_0x128176){if(_0x128176){_0x4dbdff=_0x128176[_0x0168('0x39')];if(!_0x31afec[_0x0168('0x33')][_0x0168('0x3a')]('nolimit')){_0x1bbdb2['limit']=qs[_0x0168('0x1a')](_0x31afec[_0x0168('0x33')][_0x0168('0x1a')]);_0x1bbdb2[_0x0168('0x19')]=qs[_0x0168('0x19')](_0x31afec[_0x0168('0x33')]['offset']);}return _0x5bfa94[_0x0168('0x54')](_0x1bbdb2);}})[_0x0168('0x25')](function(_0x5ee464){if(_0x5ee464){return _0x5ee464?{'count':_0x4dbdff,'rows':_0x5ee464}:null;}})[_0x0168('0x25')](respondWithResult(_0x56a66f,null))[_0x0168('0x49')](handleError(_0x56a66f,null));};exports[_0x0168('0x55')]=function(_0x400aee,_0x30023f,_0x25e38c){return db['Interval'][_0x0168('0x56')]({'where':{'id':_0x400aee[_0x0168('0x51')]['id']}})[_0x0168('0x25')](handleEntityNotFound(_0x30023f,null))[_0x0168('0x25')](function(_0x457ddc){if(_0x457ddc){return db[_0x0168('0x57')][_0x0168('0x58')](function(_0x2c4e70){return db[_0x0168('0x2f')][_0x0168('0x26')]({'where':{'IntervalId':_0x400aee[_0x0168('0x51')]['id']},'transaction':_0x2c4e70})['then'](function(_0x33b788){var _0x416a54=_[_0x0168('0x2e')](_0x400aee['body'],function(_0x281a6e){delete _0x281a6e['id'];_0x281a6e[_0x0168('0x53')]=_0x400aee[_0x0168('0x51')]['id'];return _0x281a6e;});return db[_0x0168('0x2f')][_0x0168('0x59')](_0x416a54,{'transaction':_0x2c4e70});});})[_0x0168('0x25')](function(){return db[_0x0168('0x2f')][_0x0168('0x45')]({'where':{'IntervalId':_0x400aee[_0x0168('0x51')]['id']}});});}})[_0x0168('0x25')](respondWithResult(_0x30023f,null))[_0x0168('0x49')](handleError(_0x30023f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6300309..31fda0e 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 _0xbaa0=['define','rewrite','string','getIntervals','all','map','ifTime','reduce','iftime'];(function(_0x23e9af,_0x29c52c){var _0x2c4f8b=function(_0x1beca1){while(--_0x1beca1){_0x23e9af['push'](_0x23e9af['shift']());}};_0x2c4f8b(++_0x29c52c);}(_0xbaa0,0x1dc));var _0x0baa=function(_0x33d9e3,_0x398dd1){_0x33d9e3=_0x33d9e3-0x0;var _0x2c0195=_0xbaa0[_0x33d9e3];return _0x2c0195;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')[_0x0baa('0x0')];module['exports']=function(_0x2f08db){return _0x2f08db[_0x0baa('0x1')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xb4b727){extensions['rewrite'](_0x2f08db,_0xb4b727);},'afterBulkCreate':function(_0xf73111,_0x230f2a,_0x402a63){_0x402a63();extensions[_0x0baa('0x2')](_0x2f08db,_0xf73111[0x0]);},'afterUpdate':function(_0xac26d){extensions[_0x0baa('0x2')](_0x2f08db,_0xac26d);},'afterDestroy':function(_0x244647){extensions[_0x0baa('0x2')](_0x2f08db,_0x244647);}},'instanceMethods':{'ifTime':function(_0x2ed7ff=undefined,_0x5c6b1f=new Date()){if(typeof this['interval']===_0x0baa('0x3')){return iftime(this['interval'],_0x2ed7ff,_0x5c6b1f);}else{return this[_0x0baa('0x4')]()['then'](function(_0x3ef167){return Promise[_0x0baa('0x5')](_0x3ef167[_0x0baa('0x6')](function(_0x705d8e){return _0x705d8e[_0x0baa('0x7')](_0x2ed7ff,_0x5c6b1f);}));})['then'](function(_0x41689e){return _0x41689e[_0x0baa('0x8')](function(_0x44e408,_0x54463a){return _0x44e408||_0x54463a;},![]);});}}}});}; \ No newline at end of file +var _0x7774=['reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime'];(function(_0x56b7ec,_0x201f38){var _0x5c7e4c=function(_0x36f45d){while(--_0x36f45d){_0x56b7ec['push'](_0x56b7ec['shift']());}};_0x5c7e4c(++_0x201f38);}(_0x7774,0x1d1));var _0x4777=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7774[_0x1035c1];return _0x308d67;};'use strict';var attributes=require(_0x4777('0x0'));var extensions=require(_0x4777('0x1'));var iftime=require(_0x4777('0x2'))['iftime'];module[_0x4777('0x3')]=function(_0x565958){return _0x565958[_0x4777('0x4')](_0x4777('0x5'),attributes,{'tableName':_0x4777('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc326bb){extensions[_0x4777('0x7')](_0x565958,_0xc326bb);},'afterBulkCreate':function(_0x273a24,_0x49ffa4,_0x2229a3){_0x2229a3();extensions['rewrite'](_0x565958,_0x273a24[0x0]);},'afterUpdate':function(_0x568b42){extensions[_0x4777('0x7')](_0x565958,_0x568b42);},'afterDestroy':function(_0x3dd64a){extensions[_0x4777('0x7')](_0x565958,_0x3dd64a);}},'instanceMethods':{'ifTime':function(_0x179a4b=undefined,_0x2f2de5=new Date()){if(typeof this[_0x4777('0x8')]===_0x4777('0x9')){return iftime(this['interval'],_0x179a4b,_0x2f2de5);}else{return this[_0x4777('0xa')]()[_0x4777('0xb')](function(_0x27bf19){return Promise[_0x4777('0xc')](_0x27bf19[_0x4777('0xd')](function(_0x20d520){return _0x20d520[_0x4777('0xe')](_0x179a4b,_0x2f2de5);}));})[_0x4777('0xb')](function(_0x3077af){return _0x3077af[_0x4777('0xf')](function(_0x519d3d,_0x4337d9){return _0x519d3d||_0x4337d9;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 348ef64..5d17559 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 _0x396a=['intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','join','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','reduce','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','GetInterval','stringify','catch','error','message','find','ShowInterval','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray'];(function(_0x4d6891,_0x50f19c){var _0x3b5bad=function(_0x1e9b5f){while(--_0x1e9b5f){_0x4d6891['push'](_0x4d6891['shift']());}};_0x3b5bad(++_0x50f19c);}(_0x396a,0x65));var _0xa396=function(_0x52a9d1,_0x59e1a2){_0x52a9d1=_0x52a9d1-0x0;var _0x1d063c=_0x396a[_0x52a9d1];return _0x1d063c;};'use strict';var _=require(_0xa396('0x0'));var util=require(_0xa396('0x1'));var db=require(_0xa396('0x2'))['db'];var iftime=require(_0xa396('0x3'))[_0xa396('0x4')];var logger=require(_0xa396('0x5'))('rpc');exports['GetInterval']=function(_0x294085){var _0x459bb3=this;return new Promise(function(_0x3a9c7e,_0xe7b4f3){return db[_0xa396('0x6')][_0xa396('0x7')]({'raw':_0x294085['options']?_0x294085[_0xa396('0x8')][_0xa396('0x9')]===undefined?!![]:![]:!![],'where':_0x294085['options']?_0x294085['options'][_0xa396('0xa')]||null:null,'attributes':_0x294085[_0xa396('0x8')]?_0x294085[_0xa396('0x8')][_0xa396('0xb')]||null:null,'limit':_0x294085['options']?_0x294085[_0xa396('0x8')][_0xa396('0xc')]||null:null,'include':_0x294085[_0xa396('0x8')]?_0x294085[_0xa396('0x8')][_0xa396('0xd')]?_[_0xa396('0xe')](_0x294085['options'][_0xa396('0xd')],function(_0x2cb8bb){return{'model':db[_0x2cb8bb['model']],'as':_0x2cb8bb['as'],'attributes':_0x2cb8bb[_0xa396('0xb')],'include':_0x2cb8bb[_0xa396('0xd')]?_[_0xa396('0xe')](_0x2cb8bb[_0xa396('0xd')],function(_0x1879b7){return{'model':db[_0x1879b7[_0xa396('0xf')]],'as':_0x1879b7['as'],'attributes':_0x1879b7['attributes'],'include':_0x1879b7[_0xa396('0xd')]?_[_0xa396('0xe')](_0x1879b7['include'],function(_0xbf9e2f){return{'model':db[_0xbf9e2f[_0xa396('0xf')]],'as':_0xbf9e2f['as'],'attributes':_0xbf9e2f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa396('0x10')](function(_0x257a62){logger[_0xa396('0x11')]('GetInterval',_0x294085);logger[_0xa396('0x12')](_0xa396('0x13'),_0x294085,JSON[_0xa396('0x14')](_0x257a62));_0x3a9c7e(_0x257a62);})[_0xa396('0x15')](function(_0x346c54){logger['error'](_0xa396('0x13'),_0x346c54['message'],_0x294085);_0xe7b4f3(_0x459bb3[_0xa396('0x16')](0x1f4,_0x346c54[_0xa396('0x17')]));});});};exports['ShowInterval']=function(_0x1a7f30){var _0x26a158=this;return new Promise(function(_0x1f23de,_0x158ed7){return db[_0xa396('0x6')][_0xa396('0x18')]({'raw':_0x1a7f30['options']?_0x1a7f30['options'][_0xa396('0x9')]===undefined?!![]:![]:!![],'where':_0x1a7f30['options']?_0x1a7f30[_0xa396('0x8')][_0xa396('0xa')]||null:null,'attributes':_0x1a7f30[_0xa396('0x8')]?_0x1a7f30[_0xa396('0x8')][_0xa396('0xb')]||null:null,'include':_0x1a7f30['options']?_0x1a7f30['options'][_0xa396('0xd')]?_[_0xa396('0xe')](_0x1a7f30[_0xa396('0x8')][_0xa396('0xd')],function(_0x131525){return{'model':db[_0x131525[_0xa396('0xf')]],'as':_0x131525['as'],'attributes':_0x131525[_0xa396('0xb')],'include':_0x131525[_0xa396('0xd')]?_[_0xa396('0xe')](_0x131525['include'],function(_0x427553){return{'model':db[_0x427553[_0xa396('0xf')]],'as':_0x427553['as'],'attributes':_0x427553[_0xa396('0xb')],'include':_0x427553['include']?_[_0xa396('0xe')](_0x427553['include'],function(_0x40ebb3){return{'model':db[_0x40ebb3['model']],'as':_0x40ebb3['as'],'attributes':_0x40ebb3[_0xa396('0xb')]};}):[]};}):[]};}):[]:[]})[_0xa396('0x10')](function(_0x3fd078){logger[_0xa396('0x11')](_0xa396('0x19'),_0x1a7f30);logger[_0xa396('0x12')](_0xa396('0x19'),_0x1a7f30,JSON[_0xa396('0x14')](_0x3fd078));_0x1f23de(_0x3fd078);})[_0xa396('0x15')](function(_0x5b5a04){logger[_0xa396('0x16')](_0xa396('0x19'),_0x5b5a04[_0xa396('0x17')],_0x1a7f30);_0x158ed7(_0x26a158[_0xa396('0x16')](0x1f4,_0x5b5a04[_0xa396('0x17')]));});});};function checkArrayOfIntervals(_0x22a6c0,_0x2cc302){var _0xf6d14e=[];return db[_0xa396('0x6')]['findAll']({'where':{'id':_0x22a6c0}})[_0xa396('0x10')](function(_0x5ef973){_0xf6d14e=_0x5ef973;return Promise['all'](_0xf6d14e[_0xa396('0xe')](function(_0x517525){return _0x517525['ifTime'](_0x2cc302);}));})[_0xa396('0x10')](function(_0x46deb6){var _0x4b1b62=_0x46deb6['reduce'](function(_0x3ed610,_0x201f29){return _0x3ed610||_0x201f29;},![]);logger['info'](util[_0xa396('0x1a')](_0xa396('0x1b'),_0xf6d14e[_0xa396('0xe')](function(_0x368758){return _0x368758[_0xa396('0x1c')];})['join'](',\x20'),_0xf6d14e[_0xa396('0xe')](function(_0x309a16){return _0x309a16['id'];})['join'](',\x20')));return _0x4b1b62;});}function checkSingleInterval(_0x1ba6cb,_0x58314a){return db[_0xa396('0x6')][_0xa396('0x1d')](_0x1ba6cb)[_0xa396('0x10')](function(_0x474130){if(_0x474130){logger[_0xa396('0x11')](util[_0xa396('0x1a')](_0xa396('0x1e'),_0x474130[_0xa396('0x1c')],_0x474130['id']));return _0x474130['ifTime'](_0x58314a);}});}exports[_0xa396('0x1f')]=function(_0x12cedd){var _0x133090=_0x12cedd[_0xa396('0x20')];var _0x454ce3=Array[_0xa396('0x21')](_0x12cedd[_0xa396('0x22')])?_0x12cedd[_0xa396('0x22')]:typeof _0x12cedd[_0xa396('0x22')]===_0xa396('0x23')?[_0x12cedd[_0xa396('0x22')]]:[];var _0x13aefc=_0x12cedd[_0xa396('0x24')]||undefined;var _0x52ea7e=![];if(_0x454ce3[_0xa396('0x25')]){logger['info'](util[_0xa396('0x1a')](_0xa396('0x26'),_0x454ce3[_0xa396('0x27')](';\x20')));}if(_0x13aefc){logger['info'](util['format'](_0xa396('0x28'),_0x13aefc));}logger[_0xa396('0x12')](_0xa396('0x29'),_0x52ea7e);logger[_0xa396('0x2a')](_0xa396('0x1f'),_0x12cedd);return Promise[_0xa396('0x2b')]()[_0xa396('0x10')](function(){if(Array[_0xa396('0x21')](_0x133090)){return checkArrayOfIntervals(_0x133090,_0x13aefc);}else if(_0x133090){return checkSingleInterval(_0x133090,_0x13aefc);}})['then'](function(_0x39d143){var _0x5babd9=_0x454ce3[_0xa396('0x2c')](function(_0x16b016,_0x293bca){return _0x16b016||iftime(_0x293bca,_0x13aefc);},![]);_0x52ea7e=_0x39d143||_0x5babd9;return _0x52ea7e;})[_0xa396('0x15')](function(_0x45292b){logger[_0xa396('0x16')](_0xa396('0x1f'),_0x12cedd,_0x45292b);throw this[_0xa396('0x16')](0x1f4,_0x45292b[_0xa396('0x17')]);});}; \ No newline at end of file +var _0xb08b=['options','raw','where','attributes','include','map','model','then','info','debug','catch','error','message','ShowInterval','Interval','find','stringify','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','findById','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','resolve','reduce','lodash','util','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll'];(function(_0x5d775f,_0x318ee5){var _0x50568e=function(_0xb2e0eb){while(--_0xb2e0eb){_0x5d775f['push'](_0x5d775f['shift']());}};_0x50568e(++_0x318ee5);}(_0xb08b,0x138));var _0xbb08=function(_0x1a06ce,_0x4d8f6a){_0x1a06ce=_0x1a06ce-0x0;var _0x2cad00=_0xb08b[_0x1a06ce];return _0x2cad00;};'use strict';var _=require(_0xbb08('0x0'));var util=require(_0xbb08('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0xbb08('0x2'))[_0xbb08('0x3')];var logger=require(_0xbb08('0x4'))(_0xbb08('0x5'));exports[_0xbb08('0x6')]=function(_0x559763){var _0x4dd4bb=this;return new Promise(function(_0x1d60c5,_0x28c198){return db['Interval'][_0xbb08('0x7')]({'raw':_0x559763[_0xbb08('0x8')]?_0x559763[_0xbb08('0x8')][_0xbb08('0x9')]===undefined?!![]:![]:!![],'where':_0x559763['options']?_0x559763[_0xbb08('0x8')][_0xbb08('0xa')]||null:null,'attributes':_0x559763[_0xbb08('0x8')]?_0x559763[_0xbb08('0x8')][_0xbb08('0xb')]||null:null,'limit':_0x559763[_0xbb08('0x8')]?_0x559763[_0xbb08('0x8')]['limit']||null:null,'include':_0x559763[_0xbb08('0x8')]?_0x559763['options'][_0xbb08('0xc')]?_[_0xbb08('0xd')](_0x559763['options']['include'],function(_0x213c4f){return{'model':db[_0x213c4f['model']],'as':_0x213c4f['as'],'attributes':_0x213c4f[_0xbb08('0xb')],'include':_0x213c4f[_0xbb08('0xc')]?_[_0xbb08('0xd')](_0x213c4f[_0xbb08('0xc')],function(_0x2d7f03){return{'model':db[_0x2d7f03[_0xbb08('0xe')]],'as':_0x2d7f03['as'],'attributes':_0x2d7f03[_0xbb08('0xb')],'include':_0x2d7f03[_0xbb08('0xc')]?_[_0xbb08('0xd')](_0x2d7f03[_0xbb08('0xc')],function(_0x4af0f3){return{'model':db[_0x4af0f3[_0xbb08('0xe')]],'as':_0x4af0f3['as'],'attributes':_0x4af0f3[_0xbb08('0xb')]};}):[]};}):[]};}):[]:[]})[_0xbb08('0xf')](function(_0x2980e5){logger[_0xbb08('0x10')](_0xbb08('0x6'),_0x559763);logger[_0xbb08('0x11')]('GetInterval',_0x559763,JSON['stringify'](_0x2980e5));_0x1d60c5(_0x2980e5);})[_0xbb08('0x12')](function(_0x3f1a29){logger[_0xbb08('0x13')](_0xbb08('0x6'),_0x3f1a29[_0xbb08('0x14')],_0x559763);_0x28c198(_0x4dd4bb[_0xbb08('0x13')](0x1f4,_0x3f1a29[_0xbb08('0x14')]));});});};exports[_0xbb08('0x15')]=function(_0x38145a){var _0x284123=this;return new Promise(function(_0x32c8ff,_0x22a5a1){return db[_0xbb08('0x16')][_0xbb08('0x17')]({'raw':_0x38145a['options']?_0x38145a[_0xbb08('0x8')][_0xbb08('0x9')]===undefined?!![]:![]:!![],'where':_0x38145a['options']?_0x38145a[_0xbb08('0x8')][_0xbb08('0xa')]||null:null,'attributes':_0x38145a['options']?_0x38145a[_0xbb08('0x8')][_0xbb08('0xb')]||null:null,'include':_0x38145a[_0xbb08('0x8')]?_0x38145a['options'][_0xbb08('0xc')]?_[_0xbb08('0xd')](_0x38145a[_0xbb08('0x8')][_0xbb08('0xc')],function(_0x59268e){return{'model':db[_0x59268e['model']],'as':_0x59268e['as'],'attributes':_0x59268e['attributes'],'include':_0x59268e[_0xbb08('0xc')]?_[_0xbb08('0xd')](_0x59268e[_0xbb08('0xc')],function(_0x36c728){return{'model':db[_0x36c728[_0xbb08('0xe')]],'as':_0x36c728['as'],'attributes':_0x36c728['attributes'],'include':_0x36c728[_0xbb08('0xc')]?_[_0xbb08('0xd')](_0x36c728['include'],function(_0x575e65){return{'model':db[_0x575e65[_0xbb08('0xe')]],'as':_0x575e65['as'],'attributes':_0x575e65[_0xbb08('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5001ca){logger[_0xbb08('0x10')](_0xbb08('0x15'),_0x38145a);logger[_0xbb08('0x11')]('ShowInterval',_0x38145a,JSON[_0xbb08('0x18')](_0x5001ca));_0x32c8ff(_0x5001ca);})[_0xbb08('0x12')](function(_0x16a46e){logger[_0xbb08('0x13')](_0xbb08('0x15'),_0x16a46e[_0xbb08('0x14')],_0x38145a);_0x22a5a1(_0x284123[_0xbb08('0x13')](0x1f4,_0x16a46e['message']));});});};function checkArrayOfIntervals(_0x5da917,_0x3c52e3){var _0xa8af90=[];return db[_0xbb08('0x16')]['findAll']({'where':{'id':_0x5da917}})['then'](function(_0x5bbe29){_0xa8af90=_0x5bbe29;return Promise['all'](_0xa8af90[_0xbb08('0xd')](function(_0x289a3d){return _0x289a3d[_0xbb08('0x19')](_0x3c52e3);}));})['then'](function(_0x4bd2b2){var _0x564b92=_0x4bd2b2['reduce'](function(_0x2f2af0,_0xf5be1f){return _0x2f2af0||_0xf5be1f;},![]);logger['info'](util[_0xbb08('0x1a')](_0xbb08('0x1b'),_0xa8af90[_0xbb08('0xd')](function(_0x1aaf91){return _0x1aaf91[_0xbb08('0x1c')];})['join'](',\x20'),_0xa8af90[_0xbb08('0xd')](function(_0xa9d9fa){return _0xa9d9fa['id'];})['join'](',\x20')));return _0x564b92;});}function checkSingleInterval(_0x42d7af,_0x17e9f8){return db[_0xbb08('0x16')][_0xbb08('0x1d')](_0x42d7af)[_0xbb08('0xf')](function(_0x29b62b){if(_0x29b62b){logger[_0xbb08('0x10')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x29b62b[_0xbb08('0x1c')],_0x29b62b['id']));return _0x29b62b[_0xbb08('0x19')](_0x17e9f8);}});}exports[_0xbb08('0x1e')]=function(_0x1ae6ac){var _0x2b741c=_0x1ae6ac[_0xbb08('0x1f')];var _0x202df1=Array[_0xbb08('0x20')](_0x1ae6ac['intervals'])?_0x1ae6ac[_0xbb08('0x21')]:typeof _0x1ae6ac[_0xbb08('0x21')]===_0xbb08('0x22')?[_0x1ae6ac['intervals']]:[];var _0x574d5=_0x1ae6ac[_0xbb08('0x23')]||undefined;var _0x3acd6f=![];if(_0x202df1[_0xbb08('0x24')]){logger['info'](util[_0xbb08('0x1a')](_0xbb08('0x25'),_0x202df1['join'](';\x20')));}if(_0x574d5){logger['info'](util[_0xbb08('0x1a')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x574d5));}logger[_0xbb08('0x11')]('Iftime',_0x3acd6f);logger['silly'](_0xbb08('0x1e'),_0x1ae6ac);return Promise[_0xbb08('0x26')]()[_0xbb08('0xf')](function(){if(Array[_0xbb08('0x20')](_0x2b741c)){return checkArrayOfIntervals(_0x2b741c,_0x574d5);}else if(_0x2b741c){return checkSingleInterval(_0x2b741c,_0x574d5);}})['then'](function(_0x4733fb){var _0x177e77=_0x202df1[_0xbb08('0x27')](function(_0x48c0d7,_0x443f57){return _0x48c0d7||iftime(_0x443f57,_0x574d5);},![]);_0x3acd6f=_0x4733fb||_0x177e77;return _0x3acd6f;})['catch'](function(_0x54648d){logger['error'](_0xbb08('0x1e'),_0x1ae6ac,_0x54648d);throw this[_0xbb08('0x13')](0x1f4,_0x54648d[_0xbb08('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 5288ac1..119013b 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x0b0e[_0x695b76];return _0x1dc21f;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0xa981e5,_0x64a6cf){var _0x2e4c23=function(_0x3cdc63){while(--_0x3cdc63){_0xa981e5['push'](_0xa981e5['shift']());}};_0x2e4c23(++_0x64a6cf);}(_0xdb28,0x106));var _0x8db2=function(_0x4d3220,_0x3347ff){_0x4d3220=_0x4d3220-0x0;var _0x4d84a0=_0xdb28[_0x4d3220];return _0x4d84a0;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 29e79ce..4a86206 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 _0x49ad=['Report','\x20from\x20','description','issuetype','customfield_11500','email','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','body','headers','connection','remoteAddress','socket','https','../../config/logger','api','support','key','summary'];(function(_0x1a5695,_0x247d03){var _0x9e2aa6=function(_0x280053){while(--_0x280053){_0x1a5695['push'](_0x1a5695['shift']());}};_0x9e2aa6(++_0x247d03);}(_0x49ad,0xa6));var _0xd49a=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x49ad[_0x4b174a];return _0x3cd7bf;};'use strict';var BPromise=require('bluebird');var https=require(_0xd49a('0x0'));var logger=require(_0xd49a('0x1'))(_0xd49a('0x2'));var USERNAME=_0xd49a('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x126909,_0x510fb3){var _0x52618d={'fields':{'project':{'key':_0x126909[_0xd49a('0x4')]||'MOTGUI'},'summary':(_0x126909[_0xd49a('0x5')]||_0xd49a('0x6'))+_0xd49a('0x7')+_0x126909['ip'],'description':_0x126909[_0xd49a('0x8')]||JSON['stringify'](_0x126909),'issuetype':{'name':_0x126909[_0xd49a('0x9')]||'Bug'}}};_0x52618d['fields'][_0xd49a('0xa')]=_0x126909[_0xd49a('0xb')];_0x52618d[_0xd49a('0xc')][_0xd49a('0xd')]=_0x126909['oldToken'];_0x52618d[_0xd49a('0xc')][_0xd49a('0xe')]=_0x126909[_0xd49a('0xf')];_0x52618d[_0xd49a('0xc')][_0xd49a('0x10')]=_0x126909[_0xd49a('0x11')];_0x52618d[_0xd49a('0xc')][_0xd49a('0x12')]=_0x126909['reason'];_0x52618d[_0xd49a('0xc')][_0xd49a('0x13')]=_0x126909['ip'];var _0x229e83={'host':_0xd49a('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xd49a('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xd49a('0x16'),'Authorization':_0xd49a('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xd49a('0x18')](_0xd49a('0x19'))}};var _0x4a5512=JSON['stringify'](_0x52618d);var _0x326458=https[_0xd49a('0x1a')](_0x229e83,function(_0x52ce03){_0x52ce03[_0xd49a('0x1b')](_0xd49a('0x1c'));var _0x4d4e8d='';_0x52ce03['on']('data',function(_0x2d7b5e){_0x4d4e8d+=_0x2d7b5e;});_0x52ce03['on']('end',function(){if(_0x510fb3){return _0x510fb3[_0xd49a('0x1d')](_0x52ce03[_0xd49a('0x1e')])[_0xd49a('0x1f')](JSON['parse'](_0x4d4e8d));}});});_0x326458['on'](_0xd49a('0x20'),function(_0x348018){if(_0x510fb3){return _0x510fb3['status'](0x1f4)[_0xd49a('0x1f')]({'errors':[{'message':_0xd49a('0x21'),'type':_0xd49a('0x22')}]});}});_0x326458[_0xd49a('0x23')](_0x4a5512);_0x326458[_0xd49a('0x24')]();}exports[_0xd49a('0x25')]=openIssue;exports['send']=function(_0x159c04,_0x572d2b){_0x159c04[_0xd49a('0x26')]['ip']=_0x159c04[_0xd49a('0x27')]['x-forwarded-for']||_0x159c04[_0xd49a('0x28')][_0xd49a('0x29')]||_0x159c04[_0xd49a('0x2a')][_0xd49a('0x29')]||_0x159c04[_0xd49a('0x28')]['socket']['remoteAddress'];return openIssue(_0x159c04['body'],_0x572d2b);}; \ No newline at end of file +var _0x160c=['headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','key','summary','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','setEncoding','data','statusCode','parse','error','json','api.jira','write','end','openIssue','send','body'];(function(_0x4a72eb,_0x353343){var _0x212aad=function(_0x2bb4ca){while(--_0x2bb4ca){_0x4a72eb['push'](_0x4a72eb['shift']());}};_0x212aad(++_0x353343);}(_0x160c,0xac));var _0xc160=function(_0xd9f016,_0x2eaff8){_0xd9f016=_0xd9f016-0x0;var _0x4fd6e2=_0x160c[_0xd9f016];return _0x4fd6e2;};'use strict';var BPromise=require(_0xc160('0x0'));var https=require(_0xc160('0x1'));var logger=require(_0xc160('0x2'))(_0xc160('0x3'));var USERNAME=_0xc160('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x472275,_0x4952bc){var _0xe25b9b={'fields':{'project':{'key':_0x472275[_0xc160('0x5')]||'MOTGUI'},'summary':(_0x472275[_0xc160('0x6')]||'Report')+_0xc160('0x7')+_0x472275['ip'],'description':_0x472275[_0xc160('0x8')]||JSON[_0xc160('0x9')](_0x472275),'issuetype':{'name':_0x472275[_0xc160('0xa')]||'Bug'}}};_0xe25b9b[_0xc160('0xb')][_0xc160('0xc')]=_0x472275[_0xc160('0xd')];_0xe25b9b[_0xc160('0xb')]['customfield_11501']=_0x472275['oldToken'];_0xe25b9b[_0xc160('0xb')][_0xc160('0xe')]=_0x472275[_0xc160('0xf')];_0xe25b9b[_0xc160('0xb')][_0xc160('0x10')]=_0x472275[_0xc160('0x11')];_0xe25b9b[_0xc160('0xb')][_0xc160('0x12')]=_0x472275[_0xc160('0x13')];_0xe25b9b[_0xc160('0xb')][_0xc160('0x14')]=_0x472275['ip'];var _0x15bc6c={'host':_0xc160('0x15'),'port':0x1bb,'path':_0xc160('0x16'),'method':_0xc160('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xc160('0x18'),'Authorization':_0xc160('0x19')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x4b1a5b=JSON[_0xc160('0x9')](_0xe25b9b);var _0x122206=https['request'](_0x15bc6c,function(_0x4bd858){_0x4bd858[_0xc160('0x1a')]('utf8');var _0x43783b='';_0x4bd858['on'](_0xc160('0x1b'),function(_0x59e27f){_0x43783b+=_0x59e27f;});_0x4bd858['on']('end',function(){if(_0x4952bc){return _0x4952bc['status'](_0x4bd858[_0xc160('0x1c')])['json'](JSON[_0xc160('0x1d')](_0x43783b));}});});_0x122206['on'](_0xc160('0x1e'),function(_0x5e68a1){if(_0x4952bc){return _0x4952bc['status'](0x1f4)[_0xc160('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xc160('0x20')}]});}});_0x122206[_0xc160('0x21')](_0x4b1a5b);_0x122206[_0xc160('0x22')]();}exports[_0xc160('0x23')]=openIssue;exports[_0xc160('0x24')]=function(_0x1d906e,_0x4aad19){_0x1d906e[_0xc160('0x25')]['ip']=_0x1d906e[_0xc160('0x26')]['x-forwarded-for']||_0x1d906e[_0xc160('0x27')][_0xc160('0x28')]||_0x1d906e[_0xc160('0x29')][_0xc160('0x28')]||_0x1d906e[_0xc160('0x27')][_0xc160('0x29')]['remoteAddress'];return openIssue(_0x1d906e['body'],_0x4aad19);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 0770c45..b8b7162 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 _0x3c81=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated'];(function(_0x1ce919,_0x1bbb96){var _0x34ec94=function(_0x3f7a6f){while(--_0x3f7a6f){_0x1ce919['push'](_0x1ce919['shift']());}};_0x34ec94(++_0x1bbb96);}(_0x3c81,0x102));var _0x13c8=function(_0xe4b4c,_0xae450){_0xe4b4c=_0xe4b4c-0x0;var _0x12948b=_0x3c81[_0xe4b4c];return _0x12948b;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0xd')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb821=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','Router','../../components/interaction/service'];(function(_0x353fb9,_0x3650a7){var _0x46b146=function(_0x534294){while(--_0x534294){_0x353fb9['push'](_0x353fb9['shift']());}};_0x46b146(++_0x3650a7);}(_0xb821,0xa7));var _0x1b82=function(_0x278151,_0x3b3656){_0x278151=_0x278151-0x0;var _0x18a1bf=_0xb821[_0x278151];return _0x18a1bf;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x6')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router['post']('/',auth[_0x1b82('0x9')](),controller[_0x1b82('0xd')]);router[_0x1b82('0xe')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xf')]);router[_0x1b82('0x10')](_0x1b82('0xb'),auth['isAuthenticated'](),controller[_0x1b82('0x11')]);module[_0x1b82('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index f40041c..bc80664 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x513218,_0x2cb5b3){_0x513218=_0x513218-0x0;var _0x5bb651=_0x7a54[_0x513218];return _0x5bb651;};'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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7a54,0x106));var _0x47a5=function(_0x49ae09,_0x277975){_0x49ae09=_0x49ae09-0x0;var _0x5bebae=_0x7a54[_0x49ae09];return _0x5bebae;};'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 8bdbfff..6855752 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 _0xa9b1=['where','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter'];(function(_0x527acd,_0x32b758){var _0x2c990f=function(_0x1eeb32){while(--_0x1eeb32){_0x527acd['push'](_0x527acd['shift']());}};_0x2c990f(++_0x32b758);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a9b('0x0'));var jsonpatch=require(_0x1a9b('0x1'));var rp=require(_0x1a9b('0x2'));var moment=require(_0x1a9b('0x3'));var BPromise=require(_0x1a9b('0x4'));var Mustache=require(_0x1a9b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1a9b('0x6'));var ejs=require(_0x1a9b('0x7'));var fs=require('fs');var fs_extra=require(_0x1a9b('0x8'));var _=require(_0x1a9b('0x9'));var squel=require(_0x1a9b('0xa'));var crypto=require(_0x1a9b('0xb'));var jsforce=require(_0x1a9b('0xc'));var deskjs=require(_0x1a9b('0xd'));var toCsv=require(_0x1a9b('0x6'));var querystring=require(_0x1a9b('0xe'));var Papa=require(_0x1a9b('0xf'));var Redis=require(_0x1a9b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a9b('0x11'));var hardwareService=require(_0x1a9b('0x12'));var logger=require(_0x1a9b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a9b('0x14'));var db=require(_0x1a9b('0x15'))['db'];function respondWithStatusCode(_0x2c75cf,_0x11bf7e){_0x11bf7e=_0x11bf7e||0xcc;return function(_0x2c3170){if(_0x2c3170){return _0x2c75cf[_0x1a9b('0x16')](_0x11bf7e);}return _0x2c75cf['status'](_0x11bf7e)[_0x1a9b('0x17')]();};}function respondWithResult(_0x34f082,_0x245883){_0x245883=_0x245883||0xc8;return function(_0x53c725){if(_0x53c725){return _0x34f082[_0x1a9b('0x18')](_0x245883)[_0x1a9b('0x19')](_0x53c725);}};}function respondWithFilteredResult(_0x55a00d,_0x2a7d72){return function(_0x57ca87){if(_0x57ca87){var _0x439acd=typeof _0x2a7d72[_0x1a9b('0x1a')]===_0x1a9b('0x1b')&&typeof _0x2a7d72[_0x1a9b('0x1c')]===_0x1a9b('0x1b');var _0x20b8dc=_0x57ca87[_0x1a9b('0x1d')];var _0x205a0d=_0x439acd?0x0:_0x2a7d72[_0x1a9b('0x1a')];var _0x1281c2=_0x439acd?_0x57ca87['count']:_0x2a7d72[_0x1a9b('0x1a')]+_0x2a7d72[_0x1a9b('0x1c')];var _0x3df7d2;if(_0x1281c2>=_0x20b8dc){_0x1281c2=_0x20b8dc;_0x3df7d2=0xc8;}else{_0x3df7d2=0xce;}_0x55a00d[_0x1a9b('0x18')](_0x3df7d2);return _0x55a00d['set'](_0x1a9b('0x1e'),_0x205a0d+'-'+_0x1281c2+'/'+_0x20b8dc)[_0x1a9b('0x19')](_0x57ca87);}return null;};}function patchUpdates(_0x4b3cd3){return function(_0x23e327){try{jsonpatch[_0x1a9b('0x1f')](_0x23e327,_0x4b3cd3,!![]);}catch(_0x44cebf){return BPromise[_0x1a9b('0x20')](_0x44cebf);}return _0x23e327[_0x1a9b('0x21')]();};}function saveUpdates(_0x590568,_0x189e78){return function(_0x17b1dd){if(_0x17b1dd){return _0x17b1dd[_0x1a9b('0x22')](_0x590568)[_0x1a9b('0x23')](function(_0x36391a){return _0x36391a;});}return null;};}function removeEntity(_0x2e42f1,_0x28f937){return function(_0x488a33){if(_0x488a33){return _0x488a33[_0x1a9b('0x24')]()['then'](function(){_0x2e42f1[_0x1a9b('0x18')](0xcc)[_0x1a9b('0x17')]();});}};}function handleEntityNotFound(_0xad6541,_0x4e7234){return function(_0x213841){if(!_0x213841){_0xad6541[_0x1a9b('0x16')](0x194);}return _0x213841;};}function handleError(_0x1521f4,_0x181331){_0x181331=_0x181331||0x1f4;return function(_0x18c9dd){logger[_0x1a9b('0x25')](_0x18c9dd['stack']);if(_0x18c9dd[_0x1a9b('0x26')]){delete _0x18c9dd[_0x1a9b('0x26')];}_0x1521f4['status'](_0x181331)[_0x1a9b('0x27')](_0x18c9dd);};}exports[_0x1a9b('0x28')]=function(_0x5d70dc,_0x5d7e8c){var _0x3f8e98={},_0x1d981e={},_0x5362b8={'count':0x0,'rows':[]};var _0x30278b=_[_0x1a9b('0x29')](db[_0x1a9b('0x2a')][_0x1a9b('0x2b')],function(_0x1a5085){return{'name':_0x1a5085[_0x1a9b('0x2c')],'type':_0x1a5085[_0x1a9b('0x2d')]['key']};});_0x1d981e[_0x1a9b('0x2e')]=_[_0x1a9b('0x29')](_0x30278b,_0x1a9b('0x26'));_0x1d981e[_0x1a9b('0x2f')]=_[_0x1a9b('0x30')](_0x5d70dc[_0x1a9b('0x2f')]);_0x1d981e[_0x1a9b('0x31')]=_[_0x1a9b('0x32')](_0x1d981e[_0x1a9b('0x2e')],_0x1d981e[_0x1a9b('0x2f')]);_0x3f8e98[_0x1a9b('0x33')]=_['intersection'](_0x1d981e['model'],qs[_0x1a9b('0x34')](_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x34')]));_0x3f8e98['attributes']=_0x3f8e98[_0x1a9b('0x33')]['length']?_0x3f8e98[_0x1a9b('0x33')]:_0x1d981e['model'];if(!_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x35')]('nolimit')){_0x3f8e98[_0x1a9b('0x1c')]=qs['limit'](_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x1c')]);_0x3f8e98[_0x1a9b('0x1a')]=qs[_0x1a9b('0x1a')](_0x5d70dc['query'][_0x1a9b('0x1a')]);}_0x3f8e98[_0x1a9b('0x36')]=qs[_0x1a9b('0x37')](_0x5d70dc['query'][_0x1a9b('0x37')]);_0x3f8e98['where']=qs['filters'](_[_0x1a9b('0x38')](_0x5d70dc[_0x1a9b('0x2f')],_0x1d981e[_0x1a9b('0x31')]),_0x30278b);if(_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x39')]){_0x3f8e98[_0x1a9b('0x3a')]=_[_0x1a9b('0x3b')](_0x3f8e98['where'],{'$or':_[_0x1a9b('0x29')](_0x30278b,function(_0x230fc6){if(_0x230fc6[_0x1a9b('0x2d')]!=='VIRTUAL'){var _0x466827={};_0x466827[_0x230fc6[_0x1a9b('0x26')]]={'$like':'%'+_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x39')]+'%'};return _0x466827;}})});}_0x3f8e98=_['merge']({},_0x3f8e98,_0x5d70dc['options']);var _0x10e80f={'where':_0x3f8e98[_0x1a9b('0x3a')]};return db[_0x1a9b('0x2a')]['count'](_0x10e80f)['then'](function(_0x2b9bcf){_0x5362b8[_0x1a9b('0x1d')]=_0x2b9bcf;if(_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x3c')]){_0x3f8e98[_0x1a9b('0x3d')]=[{'all':!![]}];}return db[_0x1a9b('0x2a')][_0x1a9b('0x3e')](_0x3f8e98);})['then'](function(_0x313921){_0x5362b8[_0x1a9b('0x3f')]=_0x313921;return _0x5362b8;})[_0x1a9b('0x23')](respondWithFilteredResult(_0x5d7e8c,_0x3f8e98))[_0x1a9b('0x40')](handleError(_0x5d7e8c,null));};exports[_0x1a9b('0x41')]=function(_0x1decb8,_0xb4cbf4){var _0x398db3={'raw':!![],'where':{'id':_0x1decb8[_0x1a9b('0x42')]['id']}},_0x35f6d8={};_0x35f6d8[_0x1a9b('0x2e')]=_[_0x1a9b('0x30')](db[_0x1a9b('0x2a')][_0x1a9b('0x2b')]);_0x35f6d8[_0x1a9b('0x2f')]=_[_0x1a9b('0x30')](_0x1decb8['query']);_0x35f6d8[_0x1a9b('0x31')]=_[_0x1a9b('0x32')](_0x35f6d8['model'],_0x35f6d8[_0x1a9b('0x2f')]);_0x398db3['attributes']=_['intersection'](_0x35f6d8[_0x1a9b('0x2e')],qs[_0x1a9b('0x34')](_0x1decb8[_0x1a9b('0x2f')][_0x1a9b('0x34')]));_0x398db3[_0x1a9b('0x33')]=_0x398db3[_0x1a9b('0x33')][_0x1a9b('0x43')]?_0x398db3['attributes']:_0x35f6d8[_0x1a9b('0x2e')];if(_0x1decb8[_0x1a9b('0x2f')][_0x1a9b('0x3c')]){_0x398db3[_0x1a9b('0x3d')]=[{'all':!![]}];}_0x398db3=_['merge']({},_0x398db3,_0x1decb8[_0x1a9b('0x44')]);return db[_0x1a9b('0x2a')][_0x1a9b('0x45')](_0x398db3)[_0x1a9b('0x23')](handleEntityNotFound(_0xb4cbf4,null))['then'](respondWithResult(_0xb4cbf4,null))[_0x1a9b('0x40')](handleError(_0xb4cbf4,null));};exports[_0x1a9b('0x46')]=function(_0x41e9fc,_0x1e93df){return db[_0x1a9b('0x2a')]['create'](_0x41e9fc['body'],{})[_0x1a9b('0x23')](respondWithResult(_0x1e93df,0xc9))[_0x1a9b('0x40')](handleError(_0x1e93df,null));};exports['update']=function(_0x52b06e,_0x252140){if(_0x52b06e[_0x1a9b('0x47')]['id']){delete _0x52b06e[_0x1a9b('0x47')]['id'];}return db['JscriptyAnswerReport'][_0x1a9b('0x45')]({'where':{'id':_0x52b06e[_0x1a9b('0x42')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x252140,null))[_0x1a9b('0x23')](saveUpdates(_0x52b06e[_0x1a9b('0x47')],null))[_0x1a9b('0x23')](respondWithResult(_0x252140,null))[_0x1a9b('0x40')](handleError(_0x252140,null));};exports['destroy']=function(_0x54b9ac,_0x5465d0){return db[_0x1a9b('0x2a')][_0x1a9b('0x45')]({'where':{'id':_0x54b9ac[_0x1a9b('0x42')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x5465d0,null))[_0x1a9b('0x23')](removeEntity(_0x5465d0,null))['catch'](handleError(_0x5465d0,null));};exports[_0x1a9b('0x48')]=function(_0x222bba,_0x3b1fdf){return db[_0x1a9b('0x2a')][_0x1a9b('0x48')]()[_0x1a9b('0x23')](respondWithResult(_0x3b1fdf,null))[_0x1a9b('0x40')](handleError(_0x3b1fdf,null));}; \ No newline at end of file +var _0x96aa=['attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','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','set','Content-Range','apply','reject','then','destroy','stack','name','send','map','JscriptyAnswerReport','fieldName','type','key','model','query','filters','intersection'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x96aa,0x67));var _0xa96a=function(_0x2b1abe,_0x60668b){_0x2b1abe=_0x2b1abe-0x0;var _0x5c5074=_0x96aa[_0x2b1abe];return _0x5c5074;};'use strict';var emlformat=require(_0xa96a('0x0'));var rimraf=require(_0xa96a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa96a('0x2'));var rp=require(_0xa96a('0x3'));var moment=require(_0xa96a('0x4'));var BPromise=require(_0xa96a('0x5'));var Mustache=require(_0xa96a('0x6'));var util=require('util');var path=require(_0xa96a('0x7'));var sox=require(_0xa96a('0x8'));var csv=require('to-csv');var ejs=require(_0xa96a('0x9'));var fs=require('fs');var fs_extra=require(_0xa96a('0xa'));var _=require(_0xa96a('0xb'));var squel=require(_0xa96a('0xc'));var crypto=require(_0xa96a('0xd'));var jsforce=require(_0xa96a('0xe'));var deskjs=require(_0xa96a('0xf'));var toCsv=require(_0xa96a('0x10'));var querystring=require(_0xa96a('0x11'));var Papa=require(_0xa96a('0x12'));var Redis=require(_0xa96a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa96a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa96a('0x15'));var logger=require(_0xa96a('0x16'))('api');var utils=require(_0xa96a('0x17'));var config=require(_0xa96a('0x18'));var licenseUtil=require(_0xa96a('0x19'));var db=require(_0xa96a('0x1a'))['db'];function respondWithStatusCode(_0x26267e,_0x3f0f9e){_0x3f0f9e=_0x3f0f9e||0xcc;return function(_0x225192){if(_0x225192){return _0x26267e[_0xa96a('0x1b')](_0x3f0f9e);}return _0x26267e[_0xa96a('0x1c')](_0x3f0f9e)[_0xa96a('0x1d')]();};}function respondWithResult(_0x431927,_0x3983ba){_0x3983ba=_0x3983ba||0xc8;return function(_0x4dc5a8){if(_0x4dc5a8){return _0x431927['status'](_0x3983ba)[_0xa96a('0x1e')](_0x4dc5a8);}};}function respondWithFilteredResult(_0x4f44b0,_0x14927b){return function(_0x5cd3f7){if(_0x5cd3f7){var _0x170e3d=typeof _0x14927b[_0xa96a('0x1f')]===_0xa96a('0x20')&&typeof _0x14927b[_0xa96a('0x21')]===_0xa96a('0x20');var _0x16257d=_0x5cd3f7['count'];var _0x8d32c0=_0x170e3d?0x0:_0x14927b[_0xa96a('0x1f')];var _0x48ca06=_0x170e3d?_0x5cd3f7[_0xa96a('0x22')]:_0x14927b[_0xa96a('0x1f')]+_0x14927b[_0xa96a('0x21')];var _0x2e8c75;if(_0x48ca06>=_0x16257d){_0x48ca06=_0x16257d;_0x2e8c75=0xc8;}else{_0x2e8c75=0xce;}_0x4f44b0[_0xa96a('0x1c')](_0x2e8c75);return _0x4f44b0[_0xa96a('0x23')](_0xa96a('0x24'),_0x8d32c0+'-'+_0x48ca06+'/'+_0x16257d)[_0xa96a('0x1e')](_0x5cd3f7);}return null;};}function patchUpdates(_0x3f41ad){return function(_0x5ee7ba){try{jsonpatch[_0xa96a('0x25')](_0x5ee7ba,_0x3f41ad,!![]);}catch(_0x5b7cbc){return BPromise[_0xa96a('0x26')](_0x5b7cbc);}return _0x5ee7ba['save']();};}function saveUpdates(_0x1572bd,_0x96a6b2){return function(_0x484ee7){if(_0x484ee7){return _0x484ee7['update'](_0x1572bd)[_0xa96a('0x27')](function(_0x33feeb){return _0x33feeb;});}return null;};}function removeEntity(_0x2c5db0,_0x2f2173){return function(_0x3eca00){if(_0x3eca00){return _0x3eca00[_0xa96a('0x28')]()['then'](function(){_0x2c5db0['status'](0xcc)[_0xa96a('0x1d')]();});}};}function handleEntityNotFound(_0x5916af,_0x36f3ae){return function(_0x44c4ee){if(!_0x44c4ee){_0x5916af[_0xa96a('0x1b')](0x194);}return _0x44c4ee;};}function handleError(_0x573ea7,_0x171450){_0x171450=_0x171450||0x1f4;return function(_0x485fb1){logger['error'](_0x485fb1[_0xa96a('0x29')]);if(_0x485fb1['name']){delete _0x485fb1[_0xa96a('0x2a')];}_0x573ea7[_0xa96a('0x1c')](_0x171450)[_0xa96a('0x2b')](_0x485fb1);};}exports['index']=function(_0x1bb965,_0x5256cb){var _0x55b8be={},_0x14c246={},_0x5576b9={'count':0x0,'rows':[]};var _0x585af1=_[_0xa96a('0x2c')](db[_0xa96a('0x2d')]['rawAttributes'],function(_0x34ef72){return{'name':_0x34ef72[_0xa96a('0x2e')],'type':_0x34ef72[_0xa96a('0x2f')][_0xa96a('0x30')]};});_0x14c246[_0xa96a('0x31')]=_['map'](_0x585af1,_0xa96a('0x2a'));_0x14c246[_0xa96a('0x32')]=_['keys'](_0x1bb965[_0xa96a('0x32')]);_0x14c246[_0xa96a('0x33')]=_[_0xa96a('0x34')](_0x14c246[_0xa96a('0x31')],_0x14c246[_0xa96a('0x32')]);_0x55b8be[_0xa96a('0x35')]=_[_0xa96a('0x34')](_0x14c246['model'],qs[_0xa96a('0x36')](_0x1bb965[_0xa96a('0x32')][_0xa96a('0x36')]));_0x55b8be[_0xa96a('0x35')]=_0x55b8be[_0xa96a('0x35')][_0xa96a('0x37')]?_0x55b8be['attributes']:_0x14c246['model'];if(!_0x1bb965['query']['hasOwnProperty'](_0xa96a('0x38'))){_0x55b8be[_0xa96a('0x21')]=qs[_0xa96a('0x21')](_0x1bb965[_0xa96a('0x32')][_0xa96a('0x21')]);_0x55b8be[_0xa96a('0x1f')]=qs[_0xa96a('0x1f')](_0x1bb965[_0xa96a('0x32')][_0xa96a('0x1f')]);}_0x55b8be[_0xa96a('0x39')]=qs[_0xa96a('0x3a')](_0x1bb965[_0xa96a('0x32')]['sort']);_0x55b8be['where']=qs[_0xa96a('0x33')](_[_0xa96a('0x3b')](_0x1bb965['query'],_0x14c246[_0xa96a('0x33')]),_0x585af1);if(_0x1bb965['query']['filter']){_0x55b8be[_0xa96a('0x3c')]=_[_0xa96a('0x3d')](_0x55b8be[_0xa96a('0x3c')],{'$or':_[_0xa96a('0x2c')](_0x585af1,function(_0x169acd){if(_0x169acd[_0xa96a('0x2f')]!==_0xa96a('0x3e')){var _0xbb2011={};_0xbb2011[_0x169acd[_0xa96a('0x2a')]]={'$like':'%'+_0x1bb965['query'][_0xa96a('0x3f')]+'%'};return _0xbb2011;}})});}_0x55b8be=_[_0xa96a('0x3d')]({},_0x55b8be,_0x1bb965[_0xa96a('0x40')]);var _0x5e4bf6={'where':_0x55b8be['where']};return db['JscriptyAnswerReport']['count'](_0x5e4bf6)[_0xa96a('0x27')](function(_0x2ee9d3){_0x5576b9['count']=_0x2ee9d3;if(_0x1bb965[_0xa96a('0x32')][_0xa96a('0x41')]){_0x55b8be[_0xa96a('0x42')]=[{'all':!![]}];}return db[_0xa96a('0x2d')][_0xa96a('0x43')](_0x55b8be);})[_0xa96a('0x27')](function(_0x4b66f5){_0x5576b9['rows']=_0x4b66f5;return _0x5576b9;})['then'](respondWithFilteredResult(_0x5256cb,_0x55b8be))[_0xa96a('0x44')](handleError(_0x5256cb,null));};exports[_0xa96a('0x45')]=function(_0x231ff2,_0x48cc46){var _0x101191={'raw':!![],'where':{'id':_0x231ff2[_0xa96a('0x46')]['id']}},_0x2edf92={};_0x2edf92['model']=_[_0xa96a('0x47')](db[_0xa96a('0x2d')][_0xa96a('0x48')]);_0x2edf92[_0xa96a('0x32')]=_[_0xa96a('0x47')](_0x231ff2[_0xa96a('0x32')]);_0x2edf92[_0xa96a('0x33')]=_['intersection'](_0x2edf92[_0xa96a('0x31')],_0x2edf92[_0xa96a('0x32')]);_0x101191['attributes']=_['intersection'](_0x2edf92[_0xa96a('0x31')],qs[_0xa96a('0x36')](_0x231ff2['query']['fields']));_0x101191[_0xa96a('0x35')]=_0x101191[_0xa96a('0x35')][_0xa96a('0x37')]?_0x101191[_0xa96a('0x35')]:_0x2edf92[_0xa96a('0x31')];if(_0x231ff2['query'][_0xa96a('0x41')]){_0x101191[_0xa96a('0x42')]=[{'all':!![]}];}_0x101191=_[_0xa96a('0x3d')]({},_0x101191,_0x231ff2['options']);return db['JscriptyAnswerReport'][_0xa96a('0x49')](_0x101191)[_0xa96a('0x27')](handleEntityNotFound(_0x48cc46,null))[_0xa96a('0x27')](respondWithResult(_0x48cc46,null))['catch'](handleError(_0x48cc46,null));};exports['create']=function(_0x1eea0f,_0x2bd9e2){return db[_0xa96a('0x2d')][_0xa96a('0x4a')](_0x1eea0f[_0xa96a('0x4b')],{})[_0xa96a('0x27')](respondWithResult(_0x2bd9e2,0xc9))[_0xa96a('0x44')](handleError(_0x2bd9e2,null));};exports[_0xa96a('0x4c')]=function(_0x193042,_0x2afe5b){if(_0x193042[_0xa96a('0x4b')]['id']){delete _0x193042[_0xa96a('0x4b')]['id'];}return db[_0xa96a('0x2d')][_0xa96a('0x49')]({'where':{'id':_0x193042[_0xa96a('0x46')]['id']}})['then'](handleEntityNotFound(_0x2afe5b,null))[_0xa96a('0x27')](saveUpdates(_0x193042['body'],null))['then'](respondWithResult(_0x2afe5b,null))[_0xa96a('0x44')](handleError(_0x2afe5b,null));};exports['destroy']=function(_0x4608fa,_0x195188){return db[_0xa96a('0x2d')][_0xa96a('0x49')]({'where':{'id':_0x4608fa[_0xa96a('0x46')]['id']}})[_0xa96a('0x27')](handleEntityNotFound(_0x195188,null))[_0xa96a('0x27')](removeEntity(_0x195188,null))[_0xa96a('0x44')](handleError(_0x195188,null));};exports[_0xa96a('0x4d')]=function(_0x285eca,_0x432a10){return db['JscriptyAnswerReport'][_0xa96a('0x4d')]()[_0xa96a('0x27')](respondWithResult(_0x432a10,null))['catch'](handleError(_0x432a10,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7174838..d703d93 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 _0x270c=['rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x484a1a,_0x3ffa1a){var _0x1bdc73=function(_0x1c3f2b){while(--_0x1c3f2b){_0x484a1a['push'](_0x484a1a['shift']());}};_0x1bdc73(++_0x3ffa1a);}(_0x270c,0x101));var _0xc270=function(_0x58130a,_0x1828c0){_0x58130a=_0x58130a-0x0;var _0x147674=_0x270c[_0x58130a];return _0x147674;};'use strict';var _=require(_0xc270('0x0'));var util=require('util');var logger=require(_0xc270('0x1'))(_0xc270('0x2'));var moment=require(_0xc270('0x3'));var BPromise=require(_0xc270('0x4'));var rp=require(_0xc270('0x5'));var fs=require('fs');var path=require(_0xc270('0x6'));var rimraf=require(_0xc270('0x7'));var config=require(_0xc270('0x8'));var attributes=require(_0xc270('0x9'));module['exports']=function(_0x21ccba,_0x2d1c99){return _0x21ccba[_0xc270('0xa')](_0xc270('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4fc=['moment','request-promise','path','rimraf','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api'];(function(_0x227de0,_0x5c9f52){var _0x21d1b0=function(_0x3d8d0f){while(--_0x3d8d0f){_0x227de0['push'](_0x227de0['shift']());}};_0x21d1b0(++_0x5c9f52);}(_0xc4fc,0x68));var _0xcc4f=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xc4fc[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xcc4f('0x0'));var util=require(_0xcc4f('0x1'));var logger=require(_0xcc4f('0x2'))(_0xcc4f('0x3'));var moment=require(_0xcc4f('0x4'));var BPromise=require('bluebird');var rp=require(_0xcc4f('0x5'));var fs=require('fs');var path=require(_0xcc4f('0x6'));var rimraf=require(_0xcc4f('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0xcc4f('0x8')]=function(_0x58fe17,_0x23af51){return _0x58fe17[_0xcc4f('0x9')](_0xcc4f('0xa'),attributes,{'tableName':_0xcc4f('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 d9f619e..bb5545c 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 _0x9a28=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x233539,_0x15b727){var _0xd58f86=function(_0x51e117){while(--_0x51e117){_0x233539['push'](_0x233539['shift']());}};_0xd58f86(++_0x15b727);}(_0x9a28,0x1e7));var _0x89a2=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x9a28[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x89a2('0x0'));var util=require(_0x89a2('0x1'));var moment=require(_0x89a2('0x2'));var BPromise=require(_0x89a2('0x3'));var rs=require(_0x89a2('0x4'));var fs=require('fs');var Redis=require(_0x89a2('0x5'));var db=require(_0x89a2('0x6'))['db'];var utils=require(_0x89a2('0x7'));var logger=require(_0x89a2('0x8'))('rpc');var config=require(_0x89a2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x89a2('0xa')][_0x89a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ea063,_0xe51aca,_0x37be07){return new BPromise(function(_0x3a6d3f,_0x545e28){return client[_0x89a2('0xc')](_0x1ea063,_0x37be07)[_0x89a2('0xd')](function(_0x461e4e){logger[_0x89a2('0xe')](_0x89a2('0xf'),_0xe51aca,_0x89a2('0x10'));logger['debug'](_0x89a2('0x11'),_0xe51aca,'request\x20sent',JSON[_0x89a2('0x12')](_0x461e4e));if(_0x461e4e[_0x89a2('0x13')]){if(_0x461e4e[_0x89a2('0x13')]['code']===0x1f4){logger[_0x89a2('0x13')](_0x89a2('0xf'),_0xe51aca,_0x461e4e[_0x89a2('0x13')]['message']);return _0x545e28(_0x461e4e[_0x89a2('0x13')][_0x89a2('0x14')]);}logger[_0x89a2('0x13')](_0x89a2('0xf'),_0xe51aca,_0x461e4e[_0x89a2('0x13')][_0x89a2('0x14')]);return _0x3a6d3f(_0x461e4e[_0x89a2('0x13')][_0x89a2('0x14')]);}else{logger[_0x89a2('0xe')](_0x89a2('0xf'),_0xe51aca,_0x89a2('0x10'));_0x3a6d3f(_0x461e4e['result'][_0x89a2('0x14')]);}})[_0x89a2('0x15')](function(_0x248030){logger[_0x89a2('0x13')](_0x89a2('0xf'),_0xe51aca,_0x248030);_0x545e28(_0x248030);});});} \ No newline at end of file +var _0x03b7=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x03b7,0x120));var _0x703b=function(_0x2032d2,_0x2cbb4c){_0x2032d2=_0x2032d2-0x0;var _0x43dec7=_0x03b7[_0x2032d2];return _0x43dec7;};'use strict';var _=require('lodash');var util=require(_0x703b('0x0'));var moment=require('moment');var BPromise=require(_0x703b('0x1'));var rs=require(_0x703b('0x2'));var fs=require('fs');var Redis=require(_0x703b('0x3'));var db=require(_0x703b('0x4'))['db'];var utils=require(_0x703b('0x5'));var logger=require(_0x703b('0x6'))(_0x703b('0x7'));var config=require(_0x703b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x703b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x349dd1,_0x164deb,_0xbbbec6){return new BPromise(function(_0x228ad7,_0x41ec88){return client[_0x703b('0xa')](_0x349dd1,_0xbbbec6)[_0x703b('0xb')](function(_0x351420){logger[_0x703b('0xc')](_0x703b('0xd'),_0x164deb,'request\x20sent');logger[_0x703b('0xe')](_0x703b('0xf'),_0x164deb,_0x703b('0x10'),JSON[_0x703b('0x11')](_0x351420));if(_0x351420[_0x703b('0x12')]){if(_0x351420['error']['code']===0x1f4){logger[_0x703b('0x12')](_0x703b('0xd'),_0x164deb,_0x351420[_0x703b('0x12')][_0x703b('0x13')]);return _0x41ec88(_0x351420[_0x703b('0x12')][_0x703b('0x13')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x164deb,_0x351420[_0x703b('0x12')][_0x703b('0x13')]);return _0x228ad7(_0x351420['error'][_0x703b('0x13')]);}else{logger[_0x703b('0xc')](_0x703b('0xd'),_0x164deb,'request\x20sent');_0x228ad7(_0x351420[_0x703b('0x14')][_0x703b('0x13')]);}})[_0x703b('0x15')](function(_0x50cc0b){logger[_0x703b('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x164deb,_0x50cc0b);_0x41ec88(_0x50cc0b);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 44dd7aa..4c7d1bc 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 _0x0a71=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','delete','exports','multer','util','connect-timeout'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x0a71,0x101));var _0x10a7=function(_0x31d749,_0xf74939){_0x31d749=_0x31d749-0x0;var _0x6d78a3=_0x0a71[_0x31d749];return _0x6d78a3;};'use strict';var multer=require(_0x10a7('0x0'));var util=require(_0x10a7('0x1'));var path=require('path');var timeout=require(_0x10a7('0x2'));var express=require(_0x10a7('0x3'));var router=express[_0x10a7('0x4')]();var fs_extra=require(_0x10a7('0x5'));var auth=require(_0x10a7('0x6'));var interaction=require(_0x10a7('0x7'));var config=require(_0x10a7('0x8'));var controller=require(_0x10a7('0x9'));router[_0x10a7('0xa')]('/',auth[_0x10a7('0xb')](),controller[_0x10a7('0xc')]);router[_0x10a7('0xa')](_0x10a7('0xd'),auth[_0x10a7('0xb')](),controller[_0x10a7('0xe')]);router[_0x10a7('0xa')]('/:id/sessions',auth[_0x10a7('0xb')](),controller[_0x10a7('0xf')]);router['get']('/:id/answers',auth[_0x10a7('0xb')](),controller[_0x10a7('0x10')]);router[_0x10a7('0xa')](_0x10a7('0x11'),auth[_0x10a7('0xb')](),timeout(_0x10a7('0x12')),controller[_0x10a7('0x13')]);router[_0x10a7('0x14')]('/',auth[_0x10a7('0xb')](),controller[_0x10a7('0x15')]);router[_0x10a7('0x14')]('/:id/clone',auth[_0x10a7('0xb')](),controller[_0x10a7('0x16')]);router[_0x10a7('0x17')](_0x10a7('0xd'),auth[_0x10a7('0xb')](),controller['update']);router[_0x10a7('0x18')](_0x10a7('0xd'),auth[_0x10a7('0xb')](),controller['destroy']);module[_0x10a7('0x19')]=router; \ No newline at end of file +var _0x2585=['show','get','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id'];(function(_0x325227,_0x18d193){var _0x1c9925=function(_0x5322d2){while(--_0x5322d2){_0x325227['push'](_0x325227['shift']());}};_0x1c9925(++_0x18d193);}(_0x2585,0x186));var _0x5258=function(_0x328c3e,_0x467faf){_0x328c3e=_0x328c3e-0x0;var _0x10d365=_0x2585[_0x328c3e];return _0x10d365;};'use strict';var multer=require('multer');var util=require(_0x5258('0x0'));var path=require(_0x5258('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5258('0x2')]();var fs_extra=require(_0x5258('0x3'));var auth=require(_0x5258('0x4'));var interaction=require(_0x5258('0x5'));var config=require(_0x5258('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x5258('0x7')](),controller[_0x5258('0x8')]);router['get'](_0x5258('0x9'),auth[_0x5258('0x7')](),controller[_0x5258('0xa')]);router[_0x5258('0xb')](_0x5258('0xc'),auth['isAuthenticated'](),controller[_0x5258('0xd')]);router[_0x5258('0xb')](_0x5258('0xe'),auth[_0x5258('0x7')](),controller[_0x5258('0xf')]);router[_0x5258('0xb')]('/:id/summary',auth[_0x5258('0x7')](),timeout(_0x5258('0x10')),controller[_0x5258('0x11')]);router[_0x5258('0x12')]('/',auth[_0x5258('0x7')](),controller[_0x5258('0x13')]);router[_0x5258('0x12')](_0x5258('0x14'),auth[_0x5258('0x7')](),controller['clone']);router[_0x5258('0x15')](_0x5258('0x9'),auth['isAuthenticated'](),controller[_0x5258('0x16')]);router[_0x5258('0x17')](_0x5258('0x9'),auth[_0x5258('0x7')](),controller['destroy']);module[_0x5258('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 3154144..57709fe 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 _0x8b3f=['name','STRING','TEXT','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','exports'];(function(_0x44976e,_0x311385){var _0x4852b2=function(_0xd57529){while(--_0xd57529){_0x44976e['push'](_0x44976e['shift']());}};_0x4852b2(++_0x311385);}(_0x8b3f,0x183));var _0xf8b3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b3f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xf8b3('0x0'));var _=require('lodash');var util=require(_0xf8b3('0x1'));module[_0xf8b3('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xf8b3('0x3')},'description':{'type':Sequelize[_0xf8b3('0x4')]},'formData':{'type':Sequelize[_0xf8b3('0x5')]('long'),'set':function(_0x4f1c05){if(_[_0xf8b3('0x6')](_0x4f1c05)){this[_0xf8b3('0x7')](_0xf8b3('0x8'),JSON[_0xf8b3('0x9')](_0x4f1c05));}else if(_[_0xf8b3('0xa')](_0x4f1c05)){this[_0xf8b3('0x7')]('formData',_0x4f1c05);}else{this['setDataValue']('formData',util[_0xf8b3('0xb')](_0xf8b3('0xc'),this[_0xf8b3('0xd')](_0xf8b3('0x3'))||'',this[_0xf8b3('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf8b3('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x40e6=['lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x40e6,0x1bf));var _0x640e=function(_0x4024bd,_0x164def){_0x4024bd=_0x4024bd-0x0;var _0x5cbe79=_0x40e6[_0x4024bd];return _0x5cbe79;};'use strict';var Sequelize=require(_0x640e('0x0'));var _=require(_0x640e('0x1'));var util=require(_0x640e('0x2'));module[_0x640e('0x3')]={'name':{'type':Sequelize[_0x640e('0x4')],'unique':_0x640e('0x5')},'description':{'type':Sequelize[_0x640e('0x4')]},'formData':{'type':Sequelize[_0x640e('0x6')](_0x640e('0x7')),'set':function(_0x3d6a2c){if(_[_0x640e('0x8')](_0x3d6a2c)){this[_0x640e('0x9')]('formData',JSON['stringify'](_0x3d6a2c));}else if(_[_0x640e('0xa')](_0x3d6a2c)){this[_0x640e('0x9')](_0x640e('0xb'),_0x3d6a2c);}else{this[_0x640e('0x9')](_0x640e('0xb'),util[_0x640e('0xc')](_0x640e('0xd'),this['getDataValue'](_0x640e('0x5'))||'',this[_0x640e('0xe')](_0x640e('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'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 d1bb319..ee199f1 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 _0x48ac=['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','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','then','get','destroy','end','error','stack','index','map','JscriptyProject','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','autoAssociation','clone','length','include','omit','body','createdAt','UserProfileResource','getSessions','findOne','nolimit','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','rimraf','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x15c451,_0x3b418d){var _0x37ff8=function(_0x471d51){while(--_0x471d51){_0x15c451['push'](_0x15c451['shift']());}};_0x37ff8(++_0x3b418d);}(_0x48ac,0xe0));var _0xc48a=function(_0x2a6b16,_0x47c33d){_0x2a6b16=_0x2a6b16-0x0;var _0x45b32c=_0x48ac[_0x2a6b16];return _0x45b32c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc48a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc48a('0x1'));var rp=require(_0xc48a('0x2'));var moment=require(_0xc48a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc48a('0x4'));var util=require(_0xc48a('0x5'));var path=require(_0xc48a('0x6'));var sox=require(_0xc48a('0x7'));var csv=require(_0xc48a('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(_0xc48a('0x9'));var jsforce=require(_0xc48a('0xa'));var deskjs=require(_0xc48a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc48a('0xc'));var Papa=require(_0xc48a('0xd'));var Redis=require(_0xc48a('0xe'));var authService=require(_0xc48a('0xf'));var qs=require(_0xc48a('0x10'));var as=require(_0xc48a('0x11'));var hardwareService=require(_0xc48a('0x12'));var logger=require(_0xc48a('0x13'))(_0xc48a('0x14'));var utils=require(_0xc48a('0x15'));var config=require(_0xc48a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc48a('0x17'))['db'];function respondWithStatusCode(_0x161274,_0x202ba9){_0x202ba9=_0x202ba9||0xcc;return function(_0x5580dd){if(_0x5580dd){return _0x161274[_0xc48a('0x18')](_0x202ba9);}return _0x161274[_0xc48a('0x19')](_0x202ba9)['end']();};}function respondWithResult(_0x2852b0,_0x250d63){_0x250d63=_0x250d63||0xc8;return function(_0x286f42){if(_0x286f42){return _0x2852b0['status'](_0x250d63)[_0xc48a('0x1a')](_0x286f42);}};}function respondWithFilteredResult(_0x70c92f,_0x37d5d2){return function(_0x50f232){if(_0x50f232){var _0x38abb3=typeof _0x37d5d2[_0xc48a('0x1b')]==='undefined'&&typeof _0x37d5d2['limit']===_0xc48a('0x1c');var _0x5c5291=_0x50f232[_0xc48a('0x1d')];var _0x29a1ad=_0x38abb3?0x0:_0x37d5d2[_0xc48a('0x1b')];var _0x462102=_0x38abb3?_0x50f232[_0xc48a('0x1d')]:_0x37d5d2[_0xc48a('0x1b')]+_0x37d5d2[_0xc48a('0x1e')];var _0x4e5f52;if(_0x462102>=_0x5c5291){_0x462102=_0x5c5291;_0x4e5f52=0xc8;}else{_0x4e5f52=0xce;}_0x70c92f[_0xc48a('0x19')](_0x4e5f52);return _0x70c92f[_0xc48a('0x1f')]('Content-Range',_0x29a1ad+'-'+_0x462102+'/'+_0x5c5291)[_0xc48a('0x1a')](_0x50f232);}return null;};}function patchUpdates(_0x4e6e15){return function(_0x2b7dfa){try{jsonpatch['apply'](_0x2b7dfa,_0x4e6e15,!![]);}catch(_0x303381){return BPromise[_0xc48a('0x20')](_0x303381);}return _0x2b7dfa[_0xc48a('0x21')]();};}function saveUpdates(_0x4f5a55,_0x2a3380){return function(_0x3e24f5){if(_0x3e24f5){return _0x3e24f5[_0xc48a('0x22')](_0x4f5a55)[_0xc48a('0x23')](function(_0x1bb0f3){return _0x1bb0f3;});}return null;};}function removeEntity(_0x3201bc,_0x112874){return function(_0x4bc55b){if(_0x4bc55b){return _0x4bc55b['destroy']()[_0xc48a('0x23')](function(){var _0x16d41a=_0x4bc55b[_0xc48a('0x24')]({'plain':!![]});var _0x1e3618='Projects';return db['UserProfileResource'][_0xc48a('0x25')]({'where':{'type':_0x1e3618,'resourceId':_0x16d41a['id']}})[_0xc48a('0x23')](function(){return _0x4bc55b;});})[_0xc48a('0x23')](function(){_0x3201bc['status'](0xcc)[_0xc48a('0x26')]();});}};}function handleEntityNotFound(_0x4077f7,_0x23aa60){return function(_0x281100){if(!_0x281100){_0x4077f7[_0xc48a('0x18')](0x194);}return _0x281100;};}function handleError(_0x163205,_0x1a2b28){_0x1a2b28=_0x1a2b28||0x1f4;return function(_0x335532){logger[_0xc48a('0x27')](_0x335532[_0xc48a('0x28')]);if(_0x335532['name']){delete _0x335532['name'];}_0x163205[_0xc48a('0x19')](_0x1a2b28)['send'](_0x335532);};}exports[_0xc48a('0x29')]=function(_0x10e450,_0x5ae94f){var _0x2f69c7={},_0x2ab3e1={},_0x22e62a={'count':0x0,'rows':[]};var _0x5c6d41=_[_0xc48a('0x2a')](db[_0xc48a('0x2b')]['rawAttributes'],function(_0x361d18){return{'name':_0x361d18[_0xc48a('0x2c')],'type':_0x361d18[_0xc48a('0x2d')][_0xc48a('0x2e')]};});_0x2ab3e1[_0xc48a('0x2f')]=_['map'](_0x5c6d41,_0xc48a('0x30'));_0x2ab3e1[_0xc48a('0x31')]=_[_0xc48a('0x32')](_0x10e450[_0xc48a('0x31')]);_0x2ab3e1[_0xc48a('0x33')]=_[_0xc48a('0x34')](_0x2ab3e1[_0xc48a('0x2f')],_0x2ab3e1[_0xc48a('0x31')]);_0x2f69c7['attributes']=_[_0xc48a('0x34')](_0x2ab3e1[_0xc48a('0x2f')],qs[_0xc48a('0x35')](_0x10e450[_0xc48a('0x31')][_0xc48a('0x35')]));_0x2f69c7[_0xc48a('0x36')]=_0x2f69c7[_0xc48a('0x36')]['length']?_0x2f69c7[_0xc48a('0x36')]:_0x2ab3e1[_0xc48a('0x2f')];if(!_0x10e450[_0xc48a('0x31')][_0xc48a('0x37')]('nolimit')){_0x2f69c7[_0xc48a('0x1e')]=qs[_0xc48a('0x1e')](_0x10e450['query'][_0xc48a('0x1e')]);_0x2f69c7['offset']=qs[_0xc48a('0x1b')](_0x10e450['query']['offset']);}_0x2f69c7[_0xc48a('0x38')]=qs[_0xc48a('0x39')](_0x10e450['query'][_0xc48a('0x39')]);_0x2f69c7[_0xc48a('0x3a')]=qs[_0xc48a('0x33')](_[_0xc48a('0x3b')](_0x10e450['query'],_0x2ab3e1[_0xc48a('0x33')]),_0x5c6d41);if(_0x10e450[_0xc48a('0x31')][_0xc48a('0x3c')]){_0x2f69c7[_0xc48a('0x3a')]=_['merge'](_0x2f69c7[_0xc48a('0x3a')],{'$or':_['map'](_0x5c6d41,function(_0x1ee566){if(_0x1ee566[_0xc48a('0x2d')]!==_0xc48a('0x3d')){var _0x17fe53={};_0x17fe53[_0x1ee566[_0xc48a('0x30')]]={'$like':'%'+_0x10e450[_0xc48a('0x31')]['filter']+'%'};return _0x17fe53;}})});}_0x2f69c7=_[_0xc48a('0x3e')]({},_0x2f69c7,_0x10e450[_0xc48a('0x3f')]);var _0x2aba02={'where':_0x2f69c7[_0xc48a('0x3a')]};return db[_0xc48a('0x2b')]['count'](_0x2aba02)[_0xc48a('0x23')](function(_0x2f0282){_0x22e62a[_0xc48a('0x1d')]=_0x2f0282;if(_0x10e450['query'][_0xc48a('0x40')]){_0x2f69c7['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xc48a('0x41')](_0x2f69c7);})[_0xc48a('0x23')](function(_0x32d7e3){_0x22e62a[_0xc48a('0x42')]=_0x32d7e3;return _0x22e62a;})[_0xc48a('0x23')](respondWithFilteredResult(_0x5ae94f,_0x2f69c7))[_0xc48a('0x43')](handleError(_0x5ae94f,null));};exports[_0xc48a('0x44')]=function(_0x55210d,_0x53d3ad){var _0x551c5a={'raw':![],'where':{'id':_0x55210d[_0xc48a('0x45')]['id']}},_0x1ccb0a={};_0x1ccb0a[_0xc48a('0x2f')]=_[_0xc48a('0x32')](db[_0xc48a('0x2b')][_0xc48a('0x46')]);_0x1ccb0a[_0xc48a('0x31')]=_[_0xc48a('0x32')](_0x55210d[_0xc48a('0x31')]);_0x1ccb0a[_0xc48a('0x33')]=_[_0xc48a('0x34')](_0x1ccb0a['model'],_0x1ccb0a[_0xc48a('0x31')]);_0x551c5a[_0xc48a('0x36')]=_[_0xc48a('0x34')](_0x1ccb0a[_0xc48a('0x2f')],qs[_0xc48a('0x35')](_0x55210d[_0xc48a('0x31')][_0xc48a('0x35')]));_0x551c5a[_0xc48a('0x36')]=_0x551c5a[_0xc48a('0x36')]['length']?_0x551c5a[_0xc48a('0x36')]:_0x1ccb0a[_0xc48a('0x2f')];if(_0x55210d[_0xc48a('0x31')][_0xc48a('0x40')]){_0x551c5a['include']=[{'all':!![]}];}_0x551c5a=_[_0xc48a('0x3e')]({},_0x551c5a,_0x55210d[_0xc48a('0x3f')]);return db['JscriptyProject'][_0xc48a('0x47')](_0x551c5a)[_0xc48a('0x23')](handleEntityNotFound(_0x53d3ad,null))[_0xc48a('0x23')](respondWithResult(_0x53d3ad,null))[_0xc48a('0x43')](handleError(_0x53d3ad,null));};exports['create']=function(_0xd256f3,_0xd0dc5){return db[_0xc48a('0x2b')][_0xc48a('0x48')](_0xd256f3['body'],{})['then'](function(_0x4f16e9){var _0xf47f5=_0xd256f3[_0xc48a('0x49')]['get']({'plain':!![]});if(!_0xf47f5)throw new Error(_0xc48a('0x4a'));if(_0xf47f5['role']===_0xc48a('0x49')){var _0x154d93=_0x4f16e9[_0xc48a('0x24')]({'plain':!![]});var _0x1a96d9=_0xc48a('0x4b');return db[_0xc48a('0x4c')][_0xc48a('0x47')]({'where':{'name':_0x1a96d9,'userProfileId':_0xf47f5[_0xc48a('0x4d')]},'raw':!![]})[_0xc48a('0x23')](function(_0x5ad03f){if(_0x5ad03f&&_0x5ad03f[_0xc48a('0x4e')]===0x0){return db['UserProfileResource'][_0xc48a('0x48')]({'name':_0x154d93[_0xc48a('0x30')],'resourceId':_0x154d93['id'],'type':_0x5ad03f[_0xc48a('0x30')],'sectionId':_0x5ad03f['id']},{})[_0xc48a('0x23')](function(){return _0x4f16e9;});}else{return _0x4f16e9;}})[_0xc48a('0x43')](function(_0x5bf6e8){logger[_0xc48a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf6e8);throw _0x5bf6e8;});}return _0x4f16e9;})[_0xc48a('0x23')](respondWithResult(_0xd0dc5,0xc9))[_0xc48a('0x43')](handleError(_0xd0dc5,null));};exports[_0xc48a('0x4f')]=function(_0x32c866,_0x188fd1){var _0x338977={'where':{'id':_0x32c866[_0xc48a('0x45')]['id']}},_0x4cc2c7={};_0x4cc2c7[_0xc48a('0x2f')]=_[_0xc48a('0x32')](db['JscriptyProject'][_0xc48a('0x46')]);_0x338977[_0xc48a('0x36')]=_[_0xc48a('0x34')](_0x4cc2c7['model'],qs[_0xc48a('0x35')](_0x32c866['query'][_0xc48a('0x35')]));_0x338977['attributes']=_0x338977[_0xc48a('0x36')][_0xc48a('0x50')]?_0x338977[_0xc48a('0x36')]:_0x4cc2c7[_0xc48a('0x2f')];if(_0x32c866[_0xc48a('0x31')][_0xc48a('0x40')]){_0x338977[_0xc48a('0x51')]=[{'all':!![]}];}_0x338977=_[_0xc48a('0x3e')]({},_0x338977,_0x32c866[_0xc48a('0x3f')]);return db['JscriptyProject']['find'](_0x338977)[_0xc48a('0x23')](handleEntityNotFound(_0x188fd1,null))['then'](function(_0x46d7bf){if(_0x46d7bf){var _0x38994c=_0x46d7bf[_0xc48a('0x24')]({'plain':!![]});_0x38994c=qs[_0xc48a('0x52')](_0x38994c,['id','createdAt','updatedAt']);_0x32c866[_0xc48a('0x53')]=_[_0xc48a('0x52')](_0x32c866[_0xc48a('0x53')],['id',_0xc48a('0x54'),'updatedAt']);return db[_0xc48a('0x2b')][_0xc48a('0x48')](_['merge'](_0x38994c,_0x32c866[_0xc48a('0x53')]),{'include':_0x32c866[_0xc48a('0x31')][_0xc48a('0x40')]?[{'all':!![]}]:undefined})[_0xc48a('0x23')](function(_0x322fbe){var _0x39f686=_0x32c866[_0xc48a('0x49')][_0xc48a('0x24')]({'plain':!![]});if(!_0x39f686)throw new Error(_0xc48a('0x4a'));if(_0x39f686['role']==='user'){var _0x40fba6=_0x322fbe[_0xc48a('0x24')]({'plain':!![]});var _0x440207=_0xc48a('0x4b');return db[_0xc48a('0x4c')][_0xc48a('0x47')]({'where':{'name':_0x440207,'userProfileId':_0x39f686[_0xc48a('0x4d')]},'raw':!![]})['then'](function(_0x44c357){if(_0x44c357&&_0x44c357[_0xc48a('0x4e')]===0x0){return db[_0xc48a('0x55')][_0xc48a('0x48')]({'name':_0x40fba6[_0xc48a('0x30')],'resourceId':_0x40fba6['id'],'type':_0x44c357[_0xc48a('0x30')],'sectionId':_0x44c357['id']},{})[_0xc48a('0x23')](function(){return _0x322fbe;});}else{return _0x322fbe;}})['catch'](function(_0x4142fe){logger[_0xc48a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4142fe);throw _0x4142fe;});}return _0x322fbe;});}})[_0xc48a('0x23')](respondWithResult(_0x188fd1,0xc9))[_0xc48a('0x43')](handleError(_0x188fd1,null));};exports[_0xc48a('0x22')]=function(_0x3620d2,_0x5d3d99){if(_0x3620d2[_0xc48a('0x53')]['id']){delete _0x3620d2[_0xc48a('0x53')]['id'];}return db[_0xc48a('0x2b')][_0xc48a('0x47')]({'where':{'id':_0x3620d2[_0xc48a('0x45')]['id']}})[_0xc48a('0x23')](handleEntityNotFound(_0x5d3d99,null))[_0xc48a('0x23')](saveUpdates(_0x3620d2['body'],null))[_0xc48a('0x23')](respondWithResult(_0x5d3d99,null))[_0xc48a('0x43')](handleError(_0x5d3d99,null));};exports[_0xc48a('0x25')]=function(_0x2b0dbd,_0x8ca726){return db['JscriptyProject'][_0xc48a('0x47')]({'where':{'id':_0x2b0dbd[_0xc48a('0x45')]['id']}})['then'](handleEntityNotFound(_0x8ca726,null))[_0xc48a('0x23')](removeEntity(_0x8ca726,null))['catch'](handleError(_0x8ca726,null));};exports[_0xc48a('0x56')]=function(_0x2cae30,_0x261de1,_0x11fb19){var _0x16d868={'raw':!![],'where':{}};var _0xc1f1da={};var _0x4b1755={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc48a('0x57')]({'where':{'id':_0x2cae30['params']['id']}})[_0xc48a('0x23')](handleEntityNotFound(_0x261de1,null))[_0xc48a('0x23')](function(_0x2d2f99){if(_0x2d2f99){_0xc1f1da[_0xc48a('0x2f')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0xc1f1da['query']=_['keys'](_0x2cae30[_0xc48a('0x31')]);_0xc1f1da['filters']=_[_0xc48a('0x34')](_0xc1f1da[_0xc48a('0x2f')],_0xc1f1da[_0xc48a('0x31')]);_0x16d868[_0xc48a('0x36')]=_[_0xc48a('0x34')](_0xc1f1da[_0xc48a('0x2f')],qs[_0xc48a('0x35')](_0x2cae30[_0xc48a('0x31')][_0xc48a('0x35')]));_0x16d868[_0xc48a('0x36')]=_0x16d868[_0xc48a('0x36')][_0xc48a('0x50')]?_0x16d868[_0xc48a('0x36')]:_0xc1f1da[_0xc48a('0x2f')];if(!_0x2cae30[_0xc48a('0x31')][_0xc48a('0x37')](_0xc48a('0x58'))){_0x16d868[_0xc48a('0x1e')]=qs[_0xc48a('0x1e')](_0x2cae30[_0xc48a('0x31')][_0xc48a('0x1e')]);_0x16d868[_0xc48a('0x1b')]=qs[_0xc48a('0x1b')](_0x2cae30[_0xc48a('0x31')][_0xc48a('0x1b')]);}_0x16d868['order']=qs['sort'](_0x2cae30[_0xc48a('0x31')][_0xc48a('0x39')]);_0x16d868['where']=qs[_0xc48a('0x33')](_['pick'](_0x2cae30[_0xc48a('0x31')],_0xc1f1da[_0xc48a('0x33')]));_0x16d868[_0xc48a('0x3a')][_0xc48a('0x59')]=_0x2d2f99['id'];if(_0x2cae30[_0xc48a('0x31')][_0xc48a('0x3c')]){_0x16d868[_0xc48a('0x3a')]=_[_0xc48a('0x3e')](_0x16d868['where'],{'$or':_[_0xc48a('0x2a')](_0x16d868['attributes'],function(_0x56da90){var _0x4db82e={};_0x4db82e[_0x56da90]={'$like':'%'+_0x2cae30['query'][_0xc48a('0x3c')]+'%'};return _0x4db82e;})});}_0x16d868=_[_0xc48a('0x3e')]({},_0x16d868,_0x2cae30[_0xc48a('0x3f')]);return db[_0xc48a('0x5a')][_0xc48a('0x1d')]({'where':_0x16d868[_0xc48a('0x3a')]})['then'](function(_0x5daf15){_0x4b1755[_0xc48a('0x1d')]=_0x5daf15;if(_0x2cae30[_0xc48a('0x31')][_0xc48a('0x40')]){_0x16d868[_0xc48a('0x51')]=[{'all':!![]}];}return db[_0xc48a('0x5a')]['findAll'](_0x16d868);})[_0xc48a('0x23')](function(_0x342a28){_0x4b1755[_0xc48a('0x42')]=_0x342a28;return _0x4b1755;});}})['then'](respondWithFilteredResult(_0x261de1,_0x16d868))[_0xc48a('0x43')](handleError(_0x261de1,null));};exports[_0xc48a('0x5b')]=function(_0x343f1f,_0x1acb61,_0x5e4574){var _0xc44596={'raw':!![],'where':{}};var _0x1bcc50={};var _0x26ac01={'count':0x0,'rows':[]};return db[_0xc48a('0x2b')][_0xc48a('0x57')]({'where':{'id':_0x343f1f[_0xc48a('0x45')]['id']}})[_0xc48a('0x23')](handleEntityNotFound(_0x1acb61,null))[_0xc48a('0x23')](function(_0x2bf847){if(_0x2bf847){_0x1bcc50[_0xc48a('0x2f')]=_[_0xc48a('0x32')](db[_0xc48a('0x5c')]['rawAttributes']);_0x1bcc50[_0xc48a('0x31')]=_['keys'](_0x343f1f[_0xc48a('0x31')]);_0x1bcc50[_0xc48a('0x33')]=_['intersection'](_0x1bcc50['model'],_0x1bcc50[_0xc48a('0x31')]);_0xc44596[_0xc48a('0x36')]=_['intersection'](_0x1bcc50[_0xc48a('0x2f')],qs[_0xc48a('0x35')](_0x343f1f[_0xc48a('0x31')][_0xc48a('0x35')]));_0xc44596[_0xc48a('0x36')]=_0xc44596['attributes'][_0xc48a('0x50')]?_0xc44596[_0xc48a('0x36')]:_0x1bcc50['model'];if(!_0x343f1f[_0xc48a('0x31')][_0xc48a('0x37')](_0xc48a('0x58'))){_0xc44596[_0xc48a('0x1e')]=qs[_0xc48a('0x1e')](_0x343f1f[_0xc48a('0x31')][_0xc48a('0x1e')]);_0xc44596['offset']=qs['offset'](_0x343f1f[_0xc48a('0x31')][_0xc48a('0x1b')]);}_0xc44596[_0xc48a('0x38')]=qs[_0xc48a('0x39')](_0x343f1f[_0xc48a('0x31')]['sort']);_0xc44596['where']=qs[_0xc48a('0x33')](_['pick'](_0x343f1f['query'],_0x1bcc50['filters']));_0xc44596['where']['ProjectId']=_0x2bf847['id'];if(_0x343f1f[_0xc48a('0x31')]['filter']){_0xc44596[_0xc48a('0x3a')]=_[_0xc48a('0x3e')](_0xc44596[_0xc48a('0x3a')],{'$or':_[_0xc48a('0x2a')](_0xc44596['attributes'],function(_0x27f8b9){var _0x5b9d60={};_0x5b9d60[_0x27f8b9]={'$like':'%'+_0x343f1f['query'][_0xc48a('0x3c')]+'%'};return _0x5b9d60;})});}_0xc44596=_[_0xc48a('0x3e')]({},_0xc44596,_0x343f1f[_0xc48a('0x3f')]);return db[_0xc48a('0x5c')][_0xc48a('0x1d')]({'where':_0xc44596[_0xc48a('0x3a')]})['then'](function(_0x290341){_0x26ac01[_0xc48a('0x1d')]=_0x290341;if(_0x343f1f['query'][_0xc48a('0x40')]){_0xc44596[_0xc48a('0x51')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0xc44596);})[_0xc48a('0x23')](function(_0x4e3f63){_0x26ac01[_0xc48a('0x42')]=_0x4e3f63;return _0x26ac01;});}})[_0xc48a('0x23')](respondWithFilteredResult(_0x1acb61,_0xc44596))[_0xc48a('0x43')](handleError(_0x1acb61,null));};function char(_0x55968c){return'number'===typeof _0x55968c?String[_0xc48a('0x5d')][_0xc48a('0x5e')](null,arguments):_0x55968c;}function needsEncapsulation(_0x2b0cce){return!!_0x2b0cce&&(_0x2b0cce[_0xc48a('0x5f')]()[_0xc48a('0x60')](char(0xd))>=0x0||_0x2b0cce['toString']()[_0xc48a('0x60')](char(0xa))>=0x0||_0x2b0cce[_0xc48a('0x5f')]()[_0xc48a('0x60')](char(0x2c))>=0x0||_0x2b0cce[_0xc48a('0x5f')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x17320e){var _0x4637b6=char(0x22),_0x3d1348='\x5c'+char(0x22),_0x5746ec=_0x17320e[_0xc48a('0x5f')]()[_0xc48a('0x61')](new RegExp(_0x4637b6,'g'),_0x3d1348);return _0x4637b6+_0x5746ec+_0x4637b6;}exports['getSummary']=function(_0x27e3e8,_0x78f98e,_0x34a1f7){var _0x42e034,_0x14b8a9;var _0x20bd64={'where':{'ProjectId':_0x27e3e8['params']['id']}};if(_0x27e3e8[_0xc48a('0x31')][_0xc48a('0x62')]){_0x20bd64['where'][_0xc48a('0x63')]=JSON['parse'](_0x27e3e8[_0xc48a('0x31')]['startTime']);}return db[_0xc48a('0x5a')][_0xc48a('0x41')](_0x20bd64)[_0xc48a('0x23')](handleEntityNotFound(_0x78f98e,null))['then'](function(_0x9ea599){if(_0x9ea599){_0x42e034=_0x9ea599;return db[_0xc48a('0x64')]['findAll']({'where':{'SessionId':{'$in':_[_0xc48a('0x2a')](_0x42e034,'id')},'ProjectId':_0x27e3e8[_0xc48a('0x45')]['id']},'order':_0xc48a('0x65')});}})['then'](handleEntityNotFound(_0x78f98e,null))[_0xc48a('0x23')](function(_0x5adb06){if(_0x5adb06){_0x14b8a9=_0x5adb06;var _0x4599eb={};for(var _0x2de414=0x0,_0x361da2=_0x14b8a9[_0xc48a('0x50')];_0x2de414<_0x361da2;_0x2de414++){if(!_0x4599eb['hasOwnProperty'](_0x14b8a9[_0x2de414][_0xc48a('0x66')])){_0x4599eb[_0x14b8a9[_0x2de414][_0xc48a('0x66')]]=needsEncapsulation(_0x14b8a9[_0x2de414][_0xc48a('0x67')])?encapsulate(_0x14b8a9[_0x2de414]['question']):_0x14b8a9[_0x2de414]['question'];}}var _0x12844b=[],_0x73c687={};for(var _0x36d98a=0x0,_0x5e0f33=_0x42e034[_0xc48a('0x50')];_0x36d98a<_0x5e0f33;_0x36d98a++){_0x73c687={'ProjectId':_0x27e3e8[_0xc48a('0x45')]['id'],'SessionId':_0x42e034[_0x36d98a]['id'],'StartTime':moment(_0x42e034[_0x36d98a][_0xc48a('0x63')])[_0xc48a('0x68')](_0xc48a('0x69'))};for(var _0x4b52ab=0x0,_0x3e21da=_0x14b8a9[_0xc48a('0x50')];_0x4b52ab<_0x3e21da;_0x4b52ab++){if(_0x14b8a9[_0x4b52ab]['SessionId']==_0x42e034[_0x36d98a]['id']&&_0x4599eb[_0xc48a('0x37')](_0x14b8a9[_0x4b52ab][_0xc48a('0x66')])){_0x73c687[_0x4599eb[_0x14b8a9[_0x4b52ab][_0xc48a('0x66')]]]=_0x14b8a9[_0x4b52ab][_0xc48a('0x6a')];}}for(var _0x59014e in _0x4599eb){if(!_0x73c687['hasOwnProperty'](_0x4599eb[_0x59014e])){_0x73c687[_0x4599eb[_0x59014e]]=null;}}_0x12844b[_0xc48a('0x6b')](_0x73c687);}return _0x12844b;}})['then'](function(_0xae3e2f){if(!_[_0xc48a('0x6c')](_0xae3e2f)){var _0x221a0d=toCsv(_0xae3e2f);var _0x21825c=Date['now']();fs[_0xc48a('0x6d')](util[_0xc48a('0x68')](_0xc48a('0x6e'),_0x27e3e8['params']['id'],_0x21825c),_0x221a0d);_0x78f98e[_0xc48a('0x6f')](_0xc48a('0x70'),'attachment;\x20filename='+util[_0xc48a('0x68')](_0xc48a('0x71'),_0x27e3e8[_0xc48a('0x45')]['id'],_0x21825c));_0x78f98e[_0xc48a('0x6f')]('Content-type',_0xc48a('0x72'));return _0x78f98e['download'](util[_0xc48a('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x27e3e8[_0xc48a('0x45')]['id'],_0x21825c));}else{return _0x78f98e['sendStatus'](0xcc);}})[_0xc48a('0x43')](handleError(_0x78f98e,null));}; \ No newline at end of file +var _0x5ed9=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','JscriptyProject','includeAll','include','rows','catch','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','params','options','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','order','findAll','fromCharCode','toString','indexOf','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','now','writeFileSync','Content-disposition','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','util'];(function(_0x5f0777,_0x759274){var _0x1fbcc9=function(_0x1d3b08){while(--_0x1d3b08){_0x5f0777['push'](_0x5f0777['shift']());}};_0x1fbcc9(++_0x759274);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5ed9[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require(_0x95ed('0x0'));var rimraf=require(_0x95ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ed('0x2'));var rp=require(_0x95ed('0x3'));var moment=require(_0x95ed('0x4'));var BPromise=require(_0x95ed('0x5'));var Mustache=require('mustache');var util=require(_0x95ed('0x6'));var path=require(_0x95ed('0x7'));var sox=require(_0x95ed('0x8'));var csv=require('to-csv');var ejs=require(_0x95ed('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95ed('0xa'));var squel=require(_0x95ed('0xb'));var crypto=require(_0x95ed('0xc'));var jsforce=require(_0x95ed('0xd'));var deskjs=require(_0x95ed('0xe'));var toCsv=require(_0x95ed('0xf'));var querystring=require('querystring');var Papa=require(_0x95ed('0x10'));var Redis=require(_0x95ed('0x11'));var authService=require(_0x95ed('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x95ed('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95ed('0x14'))(_0x95ed('0x15'));var utils=require(_0x95ed('0x16'));var config=require(_0x95ed('0x17'));var licenseUtil=require(_0x95ed('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e4571,_0x3da05b){_0x3da05b=_0x3da05b||0xcc;return function(_0x4236c1){if(_0x4236c1){return _0x5e4571['sendStatus'](_0x3da05b);}return _0x5e4571['status'](_0x3da05b)[_0x95ed('0x19')]();};}function respondWithResult(_0x11671d,_0x22211f){_0x22211f=_0x22211f||0xc8;return function(_0x3ebfda){if(_0x3ebfda){return _0x11671d['status'](_0x22211f)[_0x95ed('0x1a')](_0x3ebfda);}};}function respondWithFilteredResult(_0xd3fe73,_0x477b8f){return function(_0x597a04){if(_0x597a04){var _0x5fc6b5=typeof _0x477b8f['offset']===_0x95ed('0x1b')&&typeof _0x477b8f['limit']==='undefined';var _0x47f841=_0x597a04[_0x95ed('0x1c')];var _0x58fb9e=_0x5fc6b5?0x0:_0x477b8f[_0x95ed('0x1d')];var _0x1bc47c=_0x5fc6b5?_0x597a04['count']:_0x477b8f[_0x95ed('0x1d')]+_0x477b8f[_0x95ed('0x1e')];var _0x4432c9;if(_0x1bc47c>=_0x47f841){_0x1bc47c=_0x47f841;_0x4432c9=0xc8;}else{_0x4432c9=0xce;}_0xd3fe73[_0x95ed('0x1f')](_0x4432c9);return _0xd3fe73[_0x95ed('0x20')](_0x95ed('0x21'),_0x58fb9e+'-'+_0x1bc47c+'/'+_0x47f841)[_0x95ed('0x1a')](_0x597a04);}return null;};}function patchUpdates(_0x3e05cf){return function(_0x10823b){try{jsonpatch[_0x95ed('0x22')](_0x10823b,_0x3e05cf,!![]);}catch(_0x5887e3){return BPromise[_0x95ed('0x23')](_0x5887e3);}return _0x10823b[_0x95ed('0x24')]();};}function saveUpdates(_0x4e8a5d,_0x5d5afe){return function(_0x54c5ae){if(_0x54c5ae){return _0x54c5ae[_0x95ed('0x25')](_0x4e8a5d)[_0x95ed('0x26')](function(_0x31384c){return _0x31384c;});}return null;};}function removeEntity(_0x61d85e,_0x2c0824){return function(_0x19b664){if(_0x19b664){return _0x19b664[_0x95ed('0x27')]()[_0x95ed('0x26')](function(){var _0x146f74=_0x19b664[_0x95ed('0x28')]({'plain':!![]});var _0x3b298f=_0x95ed('0x29');return db[_0x95ed('0x2a')][_0x95ed('0x27')]({'where':{'type':_0x3b298f,'resourceId':_0x146f74['id']}})['then'](function(){return _0x19b664;});})[_0x95ed('0x26')](function(){_0x61d85e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f515d,_0x2d6df0){return function(_0x45e403){if(!_0x45e403){_0x2f515d[_0x95ed('0x2b')](0x194);}return _0x45e403;};}function handleError(_0x2d5042,_0x3a4ee8){_0x3a4ee8=_0x3a4ee8||0x1f4;return function(_0x88e102){logger[_0x95ed('0x2c')](_0x88e102[_0x95ed('0x2d')]);if(_0x88e102[_0x95ed('0x2e')]){delete _0x88e102[_0x95ed('0x2e')];}_0x2d5042[_0x95ed('0x1f')](_0x3a4ee8)['send'](_0x88e102);};}exports[_0x95ed('0x2f')]=function(_0xf73b6f,_0x53b1f4){var _0x28c738={},_0x5e0c25={},_0x5365ae={'count':0x0,'rows':[]};var _0x5d550a=_['map'](db['JscriptyProject'][_0x95ed('0x30')],function(_0x77f14b){return{'name':_0x77f14b[_0x95ed('0x31')],'type':_0x77f14b[_0x95ed('0x32')][_0x95ed('0x33')]};});_0x5e0c25[_0x95ed('0x34')]=_[_0x95ed('0x35')](_0x5d550a,'name');_0x5e0c25[_0x95ed('0x36')]=_[_0x95ed('0x37')](_0xf73b6f[_0x95ed('0x36')]);_0x5e0c25['filters']=_['intersection'](_0x5e0c25[_0x95ed('0x34')],_0x5e0c25['query']);_0x28c738['attributes']=_['intersection'](_0x5e0c25['model'],qs[_0x95ed('0x38')](_0xf73b6f['query'][_0x95ed('0x38')]));_0x28c738[_0x95ed('0x39')]=_0x28c738['attributes']['length']?_0x28c738['attributes']:_0x5e0c25['model'];if(!_0xf73b6f['query'][_0x95ed('0x3a')](_0x95ed('0x3b'))){_0x28c738[_0x95ed('0x1e')]=qs[_0x95ed('0x1e')](_0xf73b6f[_0x95ed('0x36')][_0x95ed('0x1e')]);_0x28c738['offset']=qs[_0x95ed('0x1d')](_0xf73b6f[_0x95ed('0x36')][_0x95ed('0x1d')]);}_0x28c738['order']=qs[_0x95ed('0x3c')](_0xf73b6f[_0x95ed('0x36')][_0x95ed('0x3c')]);_0x28c738[_0x95ed('0x3d')]=qs[_0x95ed('0x3e')](_[_0x95ed('0x3f')](_0xf73b6f[_0x95ed('0x36')],_0x5e0c25[_0x95ed('0x3e')]),_0x5d550a);if(_0xf73b6f['query']['filter']){_0x28c738['where']=_[_0x95ed('0x40')](_0x28c738[_0x95ed('0x3d')],{'$or':_[_0x95ed('0x35')](_0x5d550a,function(_0x2ab65e){if(_0x2ab65e[_0x95ed('0x32')]!==_0x95ed('0x41')){var _0x4b9e16={};_0x4b9e16[_0x2ab65e[_0x95ed('0x2e')]]={'$like':'%'+_0xf73b6f[_0x95ed('0x36')][_0x95ed('0x42')]+'%'};return _0x4b9e16;}})});}_0x28c738=_['merge']({},_0x28c738,_0xf73b6f['options']);var _0x284948={'where':_0x28c738[_0x95ed('0x3d')]};return db[_0x95ed('0x43')][_0x95ed('0x1c')](_0x284948)[_0x95ed('0x26')](function(_0x5c4c54){_0x5365ae['count']=_0x5c4c54;if(_0xf73b6f[_0x95ed('0x36')][_0x95ed('0x44')]){_0x28c738[_0x95ed('0x45')]=[{'all':!![]}];}return db[_0x95ed('0x43')]['findAll'](_0x28c738);})[_0x95ed('0x26')](function(_0x537c2b){_0x5365ae[_0x95ed('0x46')]=_0x537c2b;return _0x5365ae;})[_0x95ed('0x26')](respondWithFilteredResult(_0x53b1f4,_0x28c738))[_0x95ed('0x47')](handleError(_0x53b1f4,null));};exports['show']=function(_0x3c1477,_0x203579){var _0xaae315={'raw':![],'where':{'id':_0x3c1477['params']['id']}},_0x4ea3fd={};_0x4ea3fd[_0x95ed('0x34')]=_['keys'](db[_0x95ed('0x43')]['rawAttributes']);_0x4ea3fd[_0x95ed('0x36')]=_[_0x95ed('0x37')](_0x3c1477[_0x95ed('0x36')]);_0x4ea3fd[_0x95ed('0x3e')]=_[_0x95ed('0x48')](_0x4ea3fd['model'],_0x4ea3fd[_0x95ed('0x36')]);_0xaae315[_0x95ed('0x39')]=_[_0x95ed('0x48')](_0x4ea3fd['model'],qs[_0x95ed('0x38')](_0x3c1477['query'][_0x95ed('0x38')]));_0xaae315[_0x95ed('0x39')]=_0xaae315['attributes'][_0x95ed('0x49')]?_0xaae315[_0x95ed('0x39')]:_0x4ea3fd['model'];if(_0x3c1477['query'][_0x95ed('0x44')]){_0xaae315['include']=[{'all':!![]}];}_0xaae315=_[_0x95ed('0x40')]({},_0xaae315,_0x3c1477['options']);return db[_0x95ed('0x43')][_0x95ed('0x4a')](_0xaae315)[_0x95ed('0x26')](handleEntityNotFound(_0x203579,null))[_0x95ed('0x26')](respondWithResult(_0x203579,null))[_0x95ed('0x47')](handleError(_0x203579,null));};exports['create']=function(_0x373f2b,_0x2d0849){return db[_0x95ed('0x43')][_0x95ed('0x4b')](_0x373f2b[_0x95ed('0x4c')],{})[_0x95ed('0x26')](function(_0x25f27d){var _0x26cd04=_0x373f2b[_0x95ed('0x4d')][_0x95ed('0x28')]({'plain':!![]});if(!_0x26cd04)throw new Error(_0x95ed('0x4e'));if(_0x26cd04[_0x95ed('0x4f')]===_0x95ed('0x4d')){var _0x4dc496=_0x25f27d[_0x95ed('0x28')]({'plain':!![]});var _0x6b718e='Projects';return db[_0x95ed('0x50')]['find']({'where':{'name':_0x6b718e,'userProfileId':_0x26cd04[_0x95ed('0x51')]},'raw':!![]})[_0x95ed('0x26')](function(_0x198c7a){if(_0x198c7a&&_0x198c7a[_0x95ed('0x52')]===0x0){return db[_0x95ed('0x2a')][_0x95ed('0x4b')]({'name':_0x4dc496['name'],'resourceId':_0x4dc496['id'],'type':_0x198c7a['name'],'sectionId':_0x198c7a['id']},{})[_0x95ed('0x26')](function(){return _0x25f27d;});}else{return _0x25f27d;}})['catch'](function(_0x2fa867){logger[_0x95ed('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fa867);throw _0x2fa867;});}return _0x25f27d;})[_0x95ed('0x26')](respondWithResult(_0x2d0849,0xc9))[_0x95ed('0x47')](handleError(_0x2d0849,null));};exports[_0x95ed('0x53')]=function(_0x296f64,_0x5f4083){var _0x4a0b09={'where':{'id':_0x296f64[_0x95ed('0x54')]['id']}},_0x4c7642={};_0x4c7642[_0x95ed('0x34')]=_[_0x95ed('0x37')](db[_0x95ed('0x43')][_0x95ed('0x30')]);_0x4a0b09[_0x95ed('0x39')]=_['intersection'](_0x4c7642[_0x95ed('0x34')],qs[_0x95ed('0x38')](_0x296f64[_0x95ed('0x36')][_0x95ed('0x38')]));_0x4a0b09[_0x95ed('0x39')]=_0x4a0b09['attributes']['length']?_0x4a0b09[_0x95ed('0x39')]:_0x4c7642[_0x95ed('0x34')];if(_0x296f64['query']['includeAll']){_0x4a0b09[_0x95ed('0x45')]=[{'all':!![]}];}_0x4a0b09=_[_0x95ed('0x40')]({},_0x4a0b09,_0x296f64[_0x95ed('0x55')]);return db['JscriptyProject']['find'](_0x4a0b09)['then'](handleEntityNotFound(_0x5f4083,null))[_0x95ed('0x26')](function(_0x5f3cea){if(_0x5f3cea){var _0x1ce0f2=_0x5f3cea[_0x95ed('0x28')]({'plain':!![]});_0x1ce0f2=qs[_0x95ed('0x56')](_0x1ce0f2,['id','createdAt',_0x95ed('0x57')]);_0x296f64[_0x95ed('0x4c')]=_[_0x95ed('0x56')](_0x296f64[_0x95ed('0x4c')],['id',_0x95ed('0x58'),_0x95ed('0x57')]);return db[_0x95ed('0x43')]['create'](_[_0x95ed('0x40')](_0x1ce0f2,_0x296f64[_0x95ed('0x4c')]),{'include':_0x296f64[_0x95ed('0x36')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x368d6c){var _0x4f8b85=_0x296f64[_0x95ed('0x4d')][_0x95ed('0x28')]({'plain':!![]});if(!_0x4f8b85)throw new Error(_0x95ed('0x4e'));if(_0x4f8b85['role']==='user'){var _0x3649ff=_0x368d6c[_0x95ed('0x28')]({'plain':!![]});var _0x1419e7=_0x95ed('0x29');return db[_0x95ed('0x50')][_0x95ed('0x4a')]({'where':{'name':_0x1419e7,'userProfileId':_0x4f8b85[_0x95ed('0x51')]},'raw':!![]})[_0x95ed('0x26')](function(_0x236080){if(_0x236080&&_0x236080[_0x95ed('0x52')]===0x0){return db[_0x95ed('0x2a')][_0x95ed('0x4b')]({'name':_0x3649ff[_0x95ed('0x2e')],'resourceId':_0x3649ff['id'],'type':_0x236080['name'],'sectionId':_0x236080['id']},{})['then'](function(){return _0x368d6c;});}else{return _0x368d6c;}})[_0x95ed('0x47')](function(_0x4c8b52){logger[_0x95ed('0x2c')](_0x95ed('0x59'),_0x4c8b52);throw _0x4c8b52;});}return _0x368d6c;});}})[_0x95ed('0x26')](respondWithResult(_0x5f4083,0xc9))[_0x95ed('0x47')](handleError(_0x5f4083,null));};exports[_0x95ed('0x25')]=function(_0xe45240,_0x375e2f){if(_0xe45240[_0x95ed('0x4c')]['id']){delete _0xe45240[_0x95ed('0x4c')]['id'];}return db[_0x95ed('0x43')][_0x95ed('0x4a')]({'where':{'id':_0xe45240['params']['id']}})[_0x95ed('0x26')](handleEntityNotFound(_0x375e2f,null))[_0x95ed('0x26')](saveUpdates(_0xe45240[_0x95ed('0x4c')],null))[_0x95ed('0x26')](respondWithResult(_0x375e2f,null))[_0x95ed('0x47')](handleError(_0x375e2f,null));};exports[_0x95ed('0x27')]=function(_0x4679ad,_0x546ff6){return db['JscriptyProject']['find']({'where':{'id':_0x4679ad['params']['id']}})[_0x95ed('0x26')](handleEntityNotFound(_0x546ff6,null))[_0x95ed('0x26')](removeEntity(_0x546ff6,null))[_0x95ed('0x47')](handleError(_0x546ff6,null));};exports[_0x95ed('0x5a')]=function(_0x570a8f,_0x566bd7,_0x19e4f1){var _0x525dfb={'raw':!![],'where':{}};var _0x217615={};var _0x5b958b={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x95ed('0x5b')]({'where':{'id':_0x570a8f[_0x95ed('0x54')]['id']}})[_0x95ed('0x26')](handleEntityNotFound(_0x566bd7,null))[_0x95ed('0x26')](function(_0x2d4b1c){if(_0x2d4b1c){_0x217615[_0x95ed('0x34')]=_[_0x95ed('0x37')](db[_0x95ed('0x5c')][_0x95ed('0x30')]);_0x217615[_0x95ed('0x36')]=_[_0x95ed('0x37')](_0x570a8f[_0x95ed('0x36')]);_0x217615[_0x95ed('0x3e')]=_['intersection'](_0x217615[_0x95ed('0x34')],_0x217615[_0x95ed('0x36')]);_0x525dfb[_0x95ed('0x39')]=_[_0x95ed('0x48')](_0x217615[_0x95ed('0x34')],qs[_0x95ed('0x38')](_0x570a8f['query'][_0x95ed('0x38')]));_0x525dfb[_0x95ed('0x39')]=_0x525dfb[_0x95ed('0x39')]['length']?_0x525dfb[_0x95ed('0x39')]:_0x217615[_0x95ed('0x34')];if(!_0x570a8f[_0x95ed('0x36')][_0x95ed('0x3a')](_0x95ed('0x3b'))){_0x525dfb[_0x95ed('0x1e')]=qs['limit'](_0x570a8f[_0x95ed('0x36')]['limit']);_0x525dfb[_0x95ed('0x1d')]=qs[_0x95ed('0x1d')](_0x570a8f['query'][_0x95ed('0x1d')]);}_0x525dfb['order']=qs[_0x95ed('0x3c')](_0x570a8f['query']['sort']);_0x525dfb[_0x95ed('0x3d')]=qs[_0x95ed('0x3e')](_[_0x95ed('0x3f')](_0x570a8f[_0x95ed('0x36')],_0x217615[_0x95ed('0x3e')]));_0x525dfb[_0x95ed('0x3d')][_0x95ed('0x5d')]=_0x2d4b1c['id'];if(_0x570a8f[_0x95ed('0x36')][_0x95ed('0x42')]){_0x525dfb[_0x95ed('0x3d')]=_[_0x95ed('0x40')](_0x525dfb[_0x95ed('0x3d')],{'$or':_[_0x95ed('0x35')](_0x525dfb[_0x95ed('0x39')],function(_0x4dacef){var _0x2d623e={};_0x2d623e[_0x4dacef]={'$like':'%'+_0x570a8f['query']['filter']+'%'};return _0x2d623e;})});}_0x525dfb=_[_0x95ed('0x40')]({},_0x525dfb,_0x570a8f[_0x95ed('0x55')]);return db['JscriptySessionReport']['count']({'where':_0x525dfb[_0x95ed('0x3d')]})[_0x95ed('0x26')](function(_0x807f5b){_0x5b958b[_0x95ed('0x1c')]=_0x807f5b;if(_0x570a8f[_0x95ed('0x36')][_0x95ed('0x44')]){_0x525dfb['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x525dfb);})[_0x95ed('0x26')](function(_0x49c503){_0x5b958b['rows']=_0x49c503;return _0x5b958b;});}})[_0x95ed('0x26')](respondWithFilteredResult(_0x566bd7,_0x525dfb))[_0x95ed('0x47')](handleError(_0x566bd7,null));};exports[_0x95ed('0x5e')]=function(_0x237f55,_0xe39280,_0x292b0e){var _0x69fe2c={'raw':!![],'where':{}};var _0x3ffc4c={};var _0x44dc25={'count':0x0,'rows':[]};return db[_0x95ed('0x43')][_0x95ed('0x5b')]({'where':{'id':_0x237f55['params']['id']}})[_0x95ed('0x26')](handleEntityNotFound(_0xe39280,null))[_0x95ed('0x26')](function(_0x41ec06){if(_0x41ec06){_0x3ffc4c[_0x95ed('0x34')]=_[_0x95ed('0x37')](db[_0x95ed('0x5f')][_0x95ed('0x30')]);_0x3ffc4c[_0x95ed('0x36')]=_['keys'](_0x237f55[_0x95ed('0x36')]);_0x3ffc4c[_0x95ed('0x3e')]=_[_0x95ed('0x48')](_0x3ffc4c[_0x95ed('0x34')],_0x3ffc4c[_0x95ed('0x36')]);_0x69fe2c[_0x95ed('0x39')]=_[_0x95ed('0x48')](_0x3ffc4c[_0x95ed('0x34')],qs[_0x95ed('0x38')](_0x237f55[_0x95ed('0x36')][_0x95ed('0x38')]));_0x69fe2c['attributes']=_0x69fe2c[_0x95ed('0x39')][_0x95ed('0x49')]?_0x69fe2c[_0x95ed('0x39')]:_0x3ffc4c[_0x95ed('0x34')];if(!_0x237f55[_0x95ed('0x36')]['hasOwnProperty'](_0x95ed('0x3b'))){_0x69fe2c[_0x95ed('0x1e')]=qs[_0x95ed('0x1e')](_0x237f55[_0x95ed('0x36')][_0x95ed('0x1e')]);_0x69fe2c[_0x95ed('0x1d')]=qs[_0x95ed('0x1d')](_0x237f55[_0x95ed('0x36')][_0x95ed('0x1d')]);}_0x69fe2c[_0x95ed('0x60')]=qs['sort'](_0x237f55[_0x95ed('0x36')][_0x95ed('0x3c')]);_0x69fe2c[_0x95ed('0x3d')]=qs[_0x95ed('0x3e')](_[_0x95ed('0x3f')](_0x237f55[_0x95ed('0x36')],_0x3ffc4c[_0x95ed('0x3e')]));_0x69fe2c[_0x95ed('0x3d')][_0x95ed('0x5d')]=_0x41ec06['id'];if(_0x237f55[_0x95ed('0x36')][_0x95ed('0x42')]){_0x69fe2c[_0x95ed('0x3d')]=_['merge'](_0x69fe2c['where'],{'$or':_['map'](_0x69fe2c['attributes'],function(_0x4631b6){var _0x3ca3d5={};_0x3ca3d5[_0x4631b6]={'$like':'%'+_0x237f55['query']['filter']+'%'};return _0x3ca3d5;})});}_0x69fe2c=_[_0x95ed('0x40')]({},_0x69fe2c,_0x237f55[_0x95ed('0x55')]);return db[_0x95ed('0x5f')]['count']({'where':_0x69fe2c['where']})[_0x95ed('0x26')](function(_0x558f32){_0x44dc25['count']=_0x558f32;if(_0x237f55['query']['includeAll']){_0x69fe2c[_0x95ed('0x45')]=[{'all':!![]}];}return db[_0x95ed('0x5f')][_0x95ed('0x61')](_0x69fe2c);})[_0x95ed('0x26')](function(_0x2146b0){_0x44dc25['rows']=_0x2146b0;return _0x44dc25;});}})['then'](respondWithFilteredResult(_0xe39280,_0x69fe2c))['catch'](handleError(_0xe39280,null));};function char(_0x2ebb86){return'number'===typeof _0x2ebb86?String[_0x95ed('0x62')][_0x95ed('0x22')](null,arguments):_0x2ebb86;}function needsEncapsulation(_0x4ae1c9){return!!_0x4ae1c9&&(_0x4ae1c9[_0x95ed('0x63')]()[_0x95ed('0x64')](char(0xd))>=0x0||_0x4ae1c9[_0x95ed('0x63')]()[_0x95ed('0x64')](char(0xa))>=0x0||_0x4ae1c9[_0x95ed('0x63')]()[_0x95ed('0x64')](char(0x2c))>=0x0||_0x4ae1c9[_0x95ed('0x63')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x1f496e){var _0x2ad9a5=char(0x22),_0xd13ac6='\x5c'+char(0x22),_0x32ddca=_0x1f496e[_0x95ed('0x63')]()['replace'](new RegExp(_0x2ad9a5,'g'),_0xd13ac6);return _0x2ad9a5+_0x32ddca+_0x2ad9a5;}exports[_0x95ed('0x65')]=function(_0x4de4e2,_0x5ac297,_0x752b59){var _0x3ccdbc,_0x559250;var _0x3c0895={'where':{'ProjectId':_0x4de4e2[_0x95ed('0x54')]['id']}};if(_0x4de4e2[_0x95ed('0x36')]['startTime']){_0x3c0895['where'][_0x95ed('0x66')]=JSON[_0x95ed('0x67')](_0x4de4e2[_0x95ed('0x36')][_0x95ed('0x68')]);}return db['JscriptySessionReport'][_0x95ed('0x61')](_0x3c0895)[_0x95ed('0x26')](handleEntityNotFound(_0x5ac297,null))[_0x95ed('0x26')](function(_0x5bc52c){if(_0x5bc52c){_0x3ccdbc=_0x5bc52c;return db[_0x95ed('0x69')][_0x95ed('0x61')]({'where':{'SessionId':{'$in':_[_0x95ed('0x35')](_0x3ccdbc,'id')},'ProjectId':_0x4de4e2['params']['id']},'order':_0x95ed('0x6a')});}})[_0x95ed('0x26')](handleEntityNotFound(_0x5ac297,null))[_0x95ed('0x26')](function(_0x5ac32b){if(_0x5ac32b){_0x559250=_0x5ac32b;var _0x25201d={};for(var _0x2c3b98=0x0,_0x4a21bb=_0x559250[_0x95ed('0x49')];_0x2c3b98<_0x4a21bb;_0x2c3b98++){if(!_0x25201d['hasOwnProperty'](_0x559250[_0x2c3b98][_0x95ed('0x6b')])){_0x25201d[_0x559250[_0x2c3b98][_0x95ed('0x6b')]]=needsEncapsulation(_0x559250[_0x2c3b98][_0x95ed('0x6c')])?encapsulate(_0x559250[_0x2c3b98][_0x95ed('0x6c')]):_0x559250[_0x2c3b98][_0x95ed('0x6c')];}}var _0x34b0c4=[],_0x1afc3f={};for(var _0x5cbd70=0x0,_0x7c1456=_0x3ccdbc[_0x95ed('0x49')];_0x5cbd70<_0x7c1456;_0x5cbd70++){_0x1afc3f={'ProjectId':_0x4de4e2[_0x95ed('0x54')]['id'],'SessionId':_0x3ccdbc[_0x5cbd70]['id'],'StartTime':moment(_0x3ccdbc[_0x5cbd70][_0x95ed('0x66')])[_0x95ed('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x15e981=0x0,_0x4c38b2=_0x559250['length'];_0x15e981<_0x4c38b2;_0x15e981++){if(_0x559250[_0x15e981][_0x95ed('0x6e')]==_0x3ccdbc[_0x5cbd70]['id']&&_0x25201d[_0x95ed('0x3a')](_0x559250[_0x15e981][_0x95ed('0x6b')])){_0x1afc3f[_0x25201d[_0x559250[_0x15e981]['questionId']]]=_0x559250[_0x15e981][_0x95ed('0x6f')];}}for(var _0x1d5881 in _0x25201d){if(!_0x1afc3f[_0x95ed('0x3a')](_0x25201d[_0x1d5881])){_0x1afc3f[_0x25201d[_0x1d5881]]=null;}}_0x34b0c4[_0x95ed('0x70')](_0x1afc3f);}return _0x34b0c4;}})[_0x95ed('0x26')](function(_0x5ac026){if(!_[_0x95ed('0x71')](_0x5ac026)){var _0x21509e=toCsv(_0x5ac026);var _0x16f2dd=Date[_0x95ed('0x72')]();fs[_0x95ed('0x73')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4de4e2[_0x95ed('0x54')]['id'],_0x16f2dd),_0x21509e);_0x5ac297['setHeader'](_0x95ed('0x74'),_0x95ed('0x75')+util[_0x95ed('0x6d')](_0x95ed('0x76'),_0x4de4e2[_0x95ed('0x54')]['id'],_0x16f2dd));_0x5ac297[_0x95ed('0x77')](_0x95ed('0x78'),_0x95ed('0x79'));return _0x5ac297[_0x95ed('0x7a')](util[_0x95ed('0x6d')](_0x95ed('0x7b'),_0x4de4e2[_0x95ed('0x54')]['id'],_0x16f2dd));}else{return _0x5ac297[_0x95ed('0x2b')](0xcc);}})['catch'](handleError(_0x5ac297,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index bc2b7b6..d02d4ae 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 _0xbc8d=['moment','bluebird','path','rimraf','../../config/environment','exports','JscriptyProject','lodash','../../config/logger','api'];(function(_0x368fc3,_0x2b7c2c){var _0x1fa4b2=function(_0x50ff8c){while(--_0x50ff8c){_0x368fc3['push'](_0x368fc3['shift']());}};_0x1fa4b2(++_0x2b7c2c);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbc8('0x0'));var util=require('util');var logger=require(_0xdbc8('0x1'))(_0xdbc8('0x2'));var moment=require(_0xdbc8('0x3'));var BPromise=require(_0xdbc8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbc8('0x5'));var rimraf=require(_0xdbc8('0x6'));var config=require(_0xdbc8('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xdbc8('0x8')]=function(_0x10ede0,_0x3ee39d){return _0x10ede0['define'](_0xdbc8('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e0f=['exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptyProject.attributes'];(function(_0x3fffdb,_0x18964c){var _0x5a9235=function(_0x303b08){while(--_0x303b08){_0x3fffdb['push'](_0x3fffdb['shift']());}};_0x5a9235(++_0x18964c);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x280e2e,_0x1790e7){_0x280e2e=_0x280e2e-0x0;var _0x4283b4=_0x8e0f[_0x280e2e];return _0x4283b4;};'use strict';var _=require(_0xf8e0('0x0'));var util=require(_0xf8e0('0x1'));var logger=require(_0xf8e0('0x2'))(_0xf8e0('0x3'));var moment=require(_0xf8e0('0x4'));var BPromise=require(_0xf8e0('0x5'));var rp=require(_0xf8e0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e0('0x7'));var config=require('../../config/environment');var attributes=require(_0xf8e0('0x8'));module[_0xf8e0('0x9')]=function(_0x4f3b30,_0x2921b3){return _0x4f3b30[_0xf8e0('0xa')](_0xf8e0('0xb'),attributes,{'tableName':_0xf8e0('0xc'),'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 c8525e3..4e1b05f 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x6150e,_0x49fc04){var _0x4f354b=function(_0x5eede3){while(--_0x5eede3){_0x6150e['push'](_0x6150e['shift']());}};_0x4f354b(++_0x49fc04);}(_0xb43b,0x1b2));var _0xbb43=function(_0x364452,_0x3c08a7){_0x364452=_0x364452-0x0;var _0x311588=_0xb43b[_0x364452];return _0x311588;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +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(_0x295583,_0x4756aa){var _0x4c2ae6=function(_0xa20d19){while(--_0xa20d19){_0x295583['push'](_0x295583['shift']());}};_0x4c2ae6(++_0x4756aa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f906511..939fb30 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 _0xfddf=['/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3a05a7,_0x496a91){var _0x44c021=function(_0x18b4af){while(--_0x18b4af){_0x3a05a7['push'](_0x3a05a7['shift']());}};_0x44c021(++_0x496a91);}(_0xfddf,0x186));var _0xffdd=function(_0x53f46b,_0x5d7d04){_0x53f46b=_0x53f46b-0x0;var _0x7cee9f=_0xfddf[_0x53f46b];return _0x7cee9f;};'use strict';var multer=require(_0xffdd('0x0'));var util=require(_0xffdd('0x1'));var path=require(_0xffdd('0x2'));var timeout=require('connect-timeout');var express=require(_0xffdd('0x3'));var router=express['Router']();var fs_extra=require(_0xffdd('0x4'));var auth=require(_0xffdd('0x5'));var interaction=require(_0xffdd('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xffdd('0x7')]('/',auth[_0xffdd('0x8')](),controller[_0xffdd('0x9')]);router[_0xffdd('0x7')](_0xffdd('0xa'),auth[_0xffdd('0x8')](),controller[_0xffdd('0xb')]);router[_0xffdd('0x7')](_0xffdd('0xc'),auth[_0xffdd('0x8')](),controller[_0xffdd('0xd')]);router[_0xffdd('0xe')]('/',auth[_0xffdd('0x8')](),controller[_0xffdd('0xf')]);router[_0xffdd('0x10')](_0xffdd('0xc'),auth[_0xffdd('0x8')](),controller[_0xffdd('0x11')]);router[_0xffdd('0x12')](_0xffdd('0xc'),auth[_0xffdd('0x8')](),controller['destroy']);module[_0xffdd('0x13')]=router; \ No newline at end of file +var _0xe204=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xe204,0x11c));var _0x4e20=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe204[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x4e20('0x0'));var util=require(_0x4e20('0x1'));var path=require(_0x4e20('0x2'));var timeout=require(_0x4e20('0x3'));var express=require(_0x4e20('0x4'));var router=express[_0x4e20('0x5')]();var fs_extra=require(_0x4e20('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4e20('0x7'));var config=require(_0x4e20('0x8'));var controller=require(_0x4e20('0x9'));router[_0x4e20('0xa')]('/',auth[_0x4e20('0xb')](),controller[_0x4e20('0xc')]);router[_0x4e20('0xa')](_0x4e20('0xd'),auth[_0x4e20('0xb')](),controller['describe']);router['get']('/:id',auth[_0x4e20('0xb')](),controller[_0x4e20('0xe')]);router[_0x4e20('0xf')]('/',auth['isAuthenticated'](),controller[_0x4e20('0x10')]);router[_0x4e20('0x11')](_0x4e20('0x12'),auth[_0x4e20('0xb')](),controller[_0x4e20('0x13')]);router['delete'](_0x4e20('0x12'),auth[_0x4e20('0xb')](),controller[_0x4e20('0x14')]);module[_0x4e20('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index b861a35..195e5c8 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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x376f27,_0x11c228){_0x376f27=_0x376f27-0x0;var _0x23c1ec=_0x7a54[_0x376f27];return _0x23c1ec;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x502e81,_0x32282d){_0x502e81=_0x502e81-0x0;var _0x40a02d=_0x7a54[_0x502e81];return _0x40a02d;};'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 0380034..f9df3a8 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 _0x22e7=['offset','limit','undefined','status','set','Content-Range','apply','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json'];(function(_0x46ab2a,_0x1bf053){var _0x4bf22c=function(_0x4b5916){while(--_0x4b5916){_0x46ab2a['push'](_0x46ab2a['shift']());}};_0x4bf22c(++_0x1bf053);}(_0x22e7,0x159));var _0x722e=function(_0x269e59,_0x55bead){_0x269e59=_0x269e59-0x0;var _0x894073=_0x22e7[_0x269e59];return _0x894073;};'use strict';var emlformat=require(_0x722e('0x0'));var rimraf=require(_0x722e('0x1'));var zipdir=require(_0x722e('0x2'));var jsonpatch=require(_0x722e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x722e('0x4'));var Mustache=require(_0x722e('0x5'));var util=require('util');var path=require(_0x722e('0x6'));var sox=require('sox');var csv=require(_0x722e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x722e('0x8'));var squel=require(_0x722e('0x9'));var crypto=require(_0x722e('0xa'));var jsforce=require(_0x722e('0xb'));var deskjs=require(_0x722e('0xc'));var toCsv=require(_0x722e('0x7'));var querystring=require('querystring');var Papa=require(_0x722e('0xd'));var Redis=require(_0x722e('0xe'));var authService=require(_0x722e('0xf'));var qs=require(_0x722e('0x10'));var as=require(_0x722e('0x11'));var hardwareService=require(_0x722e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x722e('0x13'));var licenseUtil=require(_0x722e('0x14'));var db=require(_0x722e('0x15'))['db'];function respondWithStatusCode(_0x37e03f,_0x50045b){_0x50045b=_0x50045b||0xcc;return function(_0x4d8d19){if(_0x4d8d19){return _0x37e03f[_0x722e('0x16')](_0x50045b);}return _0x37e03f['status'](_0x50045b)[_0x722e('0x17')]();};}function respondWithResult(_0x34c9d7,_0x30091a){_0x30091a=_0x30091a||0xc8;return function(_0x52d694){if(_0x52d694){return _0x34c9d7['status'](_0x30091a)[_0x722e('0x18')](_0x52d694);}};}function respondWithFilteredResult(_0x1fe731,_0x38988f){return function(_0x197e74){if(_0x197e74){var _0x312229=typeof _0x38988f[_0x722e('0x19')]==='undefined'&&typeof _0x38988f[_0x722e('0x1a')]===_0x722e('0x1b');var _0x4dd77b=_0x197e74['count'];var _0x2da741=_0x312229?0x0:_0x38988f[_0x722e('0x19')];var _0x526e9f=_0x312229?_0x197e74['count']:_0x38988f[_0x722e('0x19')]+_0x38988f[_0x722e('0x1a')];var _0x1f9c9c;if(_0x526e9f>=_0x4dd77b){_0x526e9f=_0x4dd77b;_0x1f9c9c=0xc8;}else{_0x1f9c9c=0xce;}_0x1fe731[_0x722e('0x1c')](_0x1f9c9c);return _0x1fe731[_0x722e('0x1d')](_0x722e('0x1e'),_0x2da741+'-'+_0x526e9f+'/'+_0x4dd77b)[_0x722e('0x18')](_0x197e74);}return null;};}function patchUpdates(_0x304660){return function(_0x5d6fd3){try{jsonpatch[_0x722e('0x1f')](_0x5d6fd3,_0x304660,!![]);}catch(_0x22adbc){return BPromise['reject'](_0x22adbc);}return _0x5d6fd3['save']();};}function saveUpdates(_0x477f06,_0x409c43){return function(_0x5257f4){if(_0x5257f4){return _0x5257f4['update'](_0x477f06)['then'](function(_0x5712ba){return _0x5712ba;});}return null;};}function removeEntity(_0x624adc,_0x32c4d9){return function(_0x4ceb80){if(_0x4ceb80){return _0x4ceb80[_0x722e('0x20')]()[_0x722e('0x21')](function(){_0x624adc['status'](0xcc)[_0x722e('0x17')]();});}};}function handleEntityNotFound(_0x5485f0,_0x1aa5b3){return function(_0x4f45d7){if(!_0x4f45d7){_0x5485f0['sendStatus'](0x194);}return _0x4f45d7;};}function handleError(_0x113aec,_0x27d7b7){_0x27d7b7=_0x27d7b7||0x1f4;return function(_0x3c266d){logger[_0x722e('0x22')](_0x3c266d[_0x722e('0x23')]);if(_0x3c266d[_0x722e('0x24')]){delete _0x3c266d[_0x722e('0x24')];}_0x113aec[_0x722e('0x1c')](_0x27d7b7)[_0x722e('0x25')](_0x3c266d);};}exports[_0x722e('0x26')]=function(_0x59981b,_0xbcbfb5){var _0x54ca7e={},_0x364cf3={},_0x4ab581={'count':0x0,'rows':[]};var _0x26bceb=_[_0x722e('0x27')](db[_0x722e('0x28')]['rawAttributes'],function(_0x4c320e){return{'name':_0x4c320e[_0x722e('0x29')],'type':_0x4c320e[_0x722e('0x2a')][_0x722e('0x2b')]};});_0x364cf3[_0x722e('0x2c')]=_[_0x722e('0x27')](_0x26bceb,_0x722e('0x24'));_0x364cf3[_0x722e('0x2d')]=_[_0x722e('0x2e')](_0x59981b['query']);_0x364cf3[_0x722e('0x2f')]=_[_0x722e('0x30')](_0x364cf3[_0x722e('0x2c')],_0x364cf3['query']);_0x54ca7e[_0x722e('0x31')]=_[_0x722e('0x30')](_0x364cf3[_0x722e('0x2c')],qs[_0x722e('0x32')](_0x59981b[_0x722e('0x2d')][_0x722e('0x32')]));_0x54ca7e[_0x722e('0x31')]=_0x54ca7e['attributes'][_0x722e('0x33')]?_0x54ca7e[_0x722e('0x31')]:_0x364cf3[_0x722e('0x2c')];if(!_0x59981b[_0x722e('0x2d')]['hasOwnProperty'](_0x722e('0x34'))){_0x54ca7e[_0x722e('0x1a')]=qs[_0x722e('0x1a')](_0x59981b['query'][_0x722e('0x1a')]);_0x54ca7e[_0x722e('0x19')]=qs['offset'](_0x59981b['query'][_0x722e('0x19')]);}_0x54ca7e[_0x722e('0x35')]=qs[_0x722e('0x36')](_0x59981b[_0x722e('0x2d')][_0x722e('0x36')]);_0x54ca7e[_0x722e('0x37')]=qs[_0x722e('0x2f')](_[_0x722e('0x38')](_0x59981b[_0x722e('0x2d')],_0x364cf3[_0x722e('0x2f')]),_0x26bceb);if(_0x59981b[_0x722e('0x2d')][_0x722e('0x39')]){_0x54ca7e[_0x722e('0x37')]=_['merge'](_0x54ca7e[_0x722e('0x37')],{'$or':_[_0x722e('0x27')](_0x26bceb,function(_0x4894c1){if(_0x4894c1[_0x722e('0x2a')]!==_0x722e('0x3a')){var _0x430bdf={};_0x430bdf[_0x4894c1[_0x722e('0x24')]]={'$like':'%'+_0x59981b[_0x722e('0x2d')][_0x722e('0x39')]+'%'};return _0x430bdf;}})});}_0x54ca7e=_[_0x722e('0x3b')]({},_0x54ca7e,_0x59981b[_0x722e('0x3c')]);var _0x3a3695={'where':_0x54ca7e[_0x722e('0x37')]};return db[_0x722e('0x28')][_0x722e('0x3d')](_0x3a3695)[_0x722e('0x21')](function(_0x30fd81){_0x4ab581[_0x722e('0x3d')]=_0x30fd81;if(_0x59981b[_0x722e('0x2d')]['includeAll']){_0x54ca7e['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x722e('0x3e')](_0x54ca7e);})[_0x722e('0x21')](function(_0xedb3d7){_0x4ab581[_0x722e('0x3f')]=_0xedb3d7;return _0x4ab581;})[_0x722e('0x21')](respondWithFilteredResult(_0xbcbfb5,_0x54ca7e))[_0x722e('0x40')](handleError(_0xbcbfb5,null));};exports[_0x722e('0x41')]=function(_0xa03fc7,_0x7c84df){var _0x498885={'raw':!![],'where':{'id':_0xa03fc7[_0x722e('0x42')]['id']}},_0x111305={};_0x111305[_0x722e('0x2c')]=_[_0x722e('0x2e')](db['JscriptyQuestionReport'][_0x722e('0x43')]);_0x111305[_0x722e('0x2d')]=_[_0x722e('0x2e')](_0xa03fc7['query']);_0x111305[_0x722e('0x2f')]=_[_0x722e('0x30')](_0x111305['model'],_0x111305[_0x722e('0x2d')]);_0x498885['attributes']=_[_0x722e('0x30')](_0x111305[_0x722e('0x2c')],qs['fields'](_0xa03fc7[_0x722e('0x2d')]['fields']));_0x498885[_0x722e('0x31')]=_0x498885[_0x722e('0x31')][_0x722e('0x33')]?_0x498885[_0x722e('0x31')]:_0x111305[_0x722e('0x2c')];if(_0xa03fc7[_0x722e('0x2d')][_0x722e('0x44')]){_0x498885[_0x722e('0x45')]=[{'all':!![]}];}_0x498885=_[_0x722e('0x3b')]({},_0x498885,_0xa03fc7[_0x722e('0x3c')]);return db[_0x722e('0x28')][_0x722e('0x46')](_0x498885)[_0x722e('0x21')](handleEntityNotFound(_0x7c84df,null))['then'](respondWithResult(_0x7c84df,null))[_0x722e('0x40')](handleError(_0x7c84df,null));};exports['create']=function(_0x4d272e,_0x1b5bfa){return db[_0x722e('0x28')]['create'](_0x4d272e['body'],{})['then'](respondWithResult(_0x1b5bfa,0xc9))['catch'](handleError(_0x1b5bfa,null));};exports[_0x722e('0x47')]=function(_0x374a34,_0x4235e2){if(_0x374a34[_0x722e('0x48')]['id']){delete _0x374a34['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x374a34[_0x722e('0x42')]['id']}})[_0x722e('0x21')](handleEntityNotFound(_0x4235e2,null))['then'](saveUpdates(_0x374a34[_0x722e('0x48')],null))[_0x722e('0x21')](respondWithResult(_0x4235e2,null))[_0x722e('0x40')](handleError(_0x4235e2,null));};exports['destroy']=function(_0x929daa,_0x961ff1){return db['JscriptyQuestionReport'][_0x722e('0x46')]({'where':{'id':_0x929daa[_0x722e('0x42')]['id']}})[_0x722e('0x21')](handleEntityNotFound(_0x961ff1,null))[_0x722e('0x21')](removeEntity(_0x961ff1,null))[_0x722e('0x40')](handleError(_0x961ff1,null));};exports[_0x722e('0x49')]=function(_0x2a8b09,_0x2c3864){return db[_0x722e('0x28')][_0x722e('0x49')]()[_0x722e('0x21')](respondWithResult(_0x2c3864,null))['catch'](handleError(_0x2c3864,null));}; \ No newline at end of file +var _0xdf5d=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','JscriptyQuestionReport','fieldName','key','model','query','intersection'];(function(_0xbe774e,_0xea0754){var _0x23d981=function(_0x5f1c6b){while(--_0x5f1c6b){_0xbe774e['push'](_0xbe774e['shift']());}};_0x23d981(++_0xea0754);}(_0xdf5d,0x185));var _0xddf5=function(_0x570646,_0xe2f95e){_0x570646=_0x570646-0x0;var _0x4eaeaa=_0xdf5d[_0x570646];return _0x4eaeaa;};'use strict';var emlformat=require(_0xddf5('0x0'));var rimraf=require(_0xddf5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddf5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xddf5('0x3'));var Mustache=require(_0xddf5('0x4'));var util=require(_0xddf5('0x5'));var path=require(_0xddf5('0x6'));var sox=require(_0xddf5('0x7'));var csv=require(_0xddf5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddf5('0x9'));var _=require('lodash');var squel=require(_0xddf5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xddf5('0xb'));var toCsv=require(_0xddf5('0x8'));var querystring=require('querystring');var Papa=require(_0xddf5('0xc'));var Redis=require(_0xddf5('0xd'));var authService=require(_0xddf5('0xe'));var qs=require(_0xddf5('0xf'));var as=require(_0xddf5('0x10'));var hardwareService=require(_0xddf5('0x11'));var logger=require('../../config/logger')(_0xddf5('0x12'));var utils=require(_0xddf5('0x13'));var config=require(_0xddf5('0x14'));var licenseUtil=require(_0xddf5('0x15'));var db=require(_0xddf5('0x16'))['db'];function respondWithStatusCode(_0xbac372,_0x5e35fc){_0x5e35fc=_0x5e35fc||0xcc;return function(_0x10cdb1){if(_0x10cdb1){return _0xbac372[_0xddf5('0x17')](_0x5e35fc);}return _0xbac372[_0xddf5('0x18')](_0x5e35fc)['end']();};}function respondWithResult(_0x3ecc96,_0x2c4481){_0x2c4481=_0x2c4481||0xc8;return function(_0x512992){if(_0x512992){return _0x3ecc96['status'](_0x2c4481)[_0xddf5('0x19')](_0x512992);}};}function respondWithFilteredResult(_0x986b15,_0x5230f7){return function(_0x4435cd){if(_0x4435cd){var _0x360237=typeof _0x5230f7['offset']===_0xddf5('0x1a')&&typeof _0x5230f7[_0xddf5('0x1b')]===_0xddf5('0x1a');var _0x2f36b1=_0x4435cd[_0xddf5('0x1c')];var _0x3ce028=_0x360237?0x0:_0x5230f7[_0xddf5('0x1d')];var _0x2291a6=_0x360237?_0x4435cd[_0xddf5('0x1c')]:_0x5230f7[_0xddf5('0x1d')]+_0x5230f7[_0xddf5('0x1b')];var _0x1cbd46;if(_0x2291a6>=_0x2f36b1){_0x2291a6=_0x2f36b1;_0x1cbd46=0xc8;}else{_0x1cbd46=0xce;}_0x986b15[_0xddf5('0x18')](_0x1cbd46);return _0x986b15[_0xddf5('0x1e')](_0xddf5('0x1f'),_0x3ce028+'-'+_0x2291a6+'/'+_0x2f36b1)[_0xddf5('0x19')](_0x4435cd);}return null;};}function patchUpdates(_0x5549c0){return function(_0x2609b4){try{jsonpatch[_0xddf5('0x20')](_0x2609b4,_0x5549c0,!![]);}catch(_0x1b3cbf){return BPromise[_0xddf5('0x21')](_0x1b3cbf);}return _0x2609b4[_0xddf5('0x22')]();};}function saveUpdates(_0x4de1e8,_0x1bda22){return function(_0x80e7a7){if(_0x80e7a7){return _0x80e7a7[_0xddf5('0x23')](_0x4de1e8)['then'](function(_0x1cc188){return _0x1cc188;});}return null;};}function removeEntity(_0xe5bd61,_0x3f124a){return function(_0x3605ee){if(_0x3605ee){return _0x3605ee['destroy']()[_0xddf5('0x24')](function(){_0xe5bd61[_0xddf5('0x18')](0xcc)[_0xddf5('0x25')]();});}};}function handleEntityNotFound(_0xafa59f,_0x257a43){return function(_0x67620a){if(!_0x67620a){_0xafa59f[_0xddf5('0x17')](0x194);}return _0x67620a;};}function handleError(_0xddac79,_0x347cfa){_0x347cfa=_0x347cfa||0x1f4;return function(_0xc5fe5c){logger[_0xddf5('0x26')](_0xc5fe5c['stack']);if(_0xc5fe5c[_0xddf5('0x27')]){delete _0xc5fe5c['name'];}_0xddac79[_0xddf5('0x18')](_0x347cfa)[_0xddf5('0x28')](_0xc5fe5c);};}exports[_0xddf5('0x29')]=function(_0x38a44f,_0x369afe){var _0x5c4532={},_0xd2b71c={},_0x2d1c1a={'count':0x0,'rows':[]};var _0x1dcfbf=_[_0xddf5('0x2a')](db[_0xddf5('0x2b')]['rawAttributes'],function(_0x573b1b){return{'name':_0x573b1b[_0xddf5('0x2c')],'type':_0x573b1b['type'][_0xddf5('0x2d')]};});_0xd2b71c[_0xddf5('0x2e')]=_[_0xddf5('0x2a')](_0x1dcfbf,'name');_0xd2b71c['query']=_['keys'](_0x38a44f[_0xddf5('0x2f')]);_0xd2b71c['filters']=_[_0xddf5('0x30')](_0xd2b71c['model'],_0xd2b71c[_0xddf5('0x2f')]);_0x5c4532['attributes']=_[_0xddf5('0x30')](_0xd2b71c['model'],qs[_0xddf5('0x31')](_0x38a44f[_0xddf5('0x2f')][_0xddf5('0x31')]));_0x5c4532[_0xddf5('0x32')]=_0x5c4532[_0xddf5('0x32')][_0xddf5('0x33')]?_0x5c4532[_0xddf5('0x32')]:_0xd2b71c[_0xddf5('0x2e')];if(!_0x38a44f[_0xddf5('0x2f')][_0xddf5('0x34')](_0xddf5('0x35'))){_0x5c4532[_0xddf5('0x1b')]=qs[_0xddf5('0x1b')](_0x38a44f[_0xddf5('0x2f')][_0xddf5('0x1b')]);_0x5c4532['offset']=qs[_0xddf5('0x1d')](_0x38a44f[_0xddf5('0x2f')][_0xddf5('0x1d')]);}_0x5c4532[_0xddf5('0x36')]=qs[_0xddf5('0x37')](_0x38a44f['query'][_0xddf5('0x37')]);_0x5c4532[_0xddf5('0x38')]=qs['filters'](_['pick'](_0x38a44f[_0xddf5('0x2f')],_0xd2b71c[_0xddf5('0x39')]),_0x1dcfbf);if(_0x38a44f[_0xddf5('0x2f')][_0xddf5('0x3a')]){_0x5c4532[_0xddf5('0x38')]=_[_0xddf5('0x3b')](_0x5c4532[_0xddf5('0x38')],{'$or':_[_0xddf5('0x2a')](_0x1dcfbf,function(_0x356163){if(_0x356163[_0xddf5('0x3c')]!=='VIRTUAL'){var _0x1d01ca={};_0x1d01ca[_0x356163['name']]={'$like':'%'+_0x38a44f[_0xddf5('0x2f')][_0xddf5('0x3a')]+'%'};return _0x1d01ca;}})});}_0x5c4532=_[_0xddf5('0x3b')]({},_0x5c4532,_0x38a44f[_0xddf5('0x3d')]);var _0x42c66f={'where':_0x5c4532[_0xddf5('0x38')]};return db[_0xddf5('0x2b')][_0xddf5('0x1c')](_0x42c66f)['then'](function(_0x820233){_0x2d1c1a['count']=_0x820233;if(_0x38a44f[_0xddf5('0x2f')][_0xddf5('0x3e')]){_0x5c4532[_0xddf5('0x3f')]=[{'all':!![]}];}return db[_0xddf5('0x2b')][_0xddf5('0x40')](_0x5c4532);})[_0xddf5('0x24')](function(_0x4562ec){_0x2d1c1a[_0xddf5('0x41')]=_0x4562ec;return _0x2d1c1a;})[_0xddf5('0x24')](respondWithFilteredResult(_0x369afe,_0x5c4532))[_0xddf5('0x42')](handleError(_0x369afe,null));};exports['show']=function(_0x5d52ad,_0x58a09c){var _0x215dba={'raw':!![],'where':{'id':_0x5d52ad[_0xddf5('0x43')]['id']}},_0x527c71={};_0x527c71[_0xddf5('0x2e')]=_['keys'](db[_0xddf5('0x2b')]['rawAttributes']);_0x527c71[_0xddf5('0x2f')]=_[_0xddf5('0x44')](_0x5d52ad[_0xddf5('0x2f')]);_0x527c71['filters']=_[_0xddf5('0x30')](_0x527c71['model'],_0x527c71[_0xddf5('0x2f')]);_0x215dba[_0xddf5('0x32')]=_[_0xddf5('0x30')](_0x527c71['model'],qs[_0xddf5('0x31')](_0x5d52ad[_0xddf5('0x2f')][_0xddf5('0x31')]));_0x215dba[_0xddf5('0x32')]=_0x215dba['attributes'][_0xddf5('0x33')]?_0x215dba[_0xddf5('0x32')]:_0x527c71[_0xddf5('0x2e')];if(_0x5d52ad[_0xddf5('0x2f')][_0xddf5('0x3e')]){_0x215dba[_0xddf5('0x3f')]=[{'all':!![]}];}_0x215dba=_[_0xddf5('0x3b')]({},_0x215dba,_0x5d52ad['options']);return db[_0xddf5('0x2b')]['find'](_0x215dba)['then'](handleEntityNotFound(_0x58a09c,null))[_0xddf5('0x24')](respondWithResult(_0x58a09c,null))[_0xddf5('0x42')](handleError(_0x58a09c,null));};exports[_0xddf5('0x45')]=function(_0x396376,_0x1ea30b){return db[_0xddf5('0x2b')][_0xddf5('0x45')](_0x396376[_0xddf5('0x46')],{})['then'](respondWithResult(_0x1ea30b,0xc9))[_0xddf5('0x42')](handleError(_0x1ea30b,null));};exports['update']=function(_0x48d046,_0x4ab887){if(_0x48d046[_0xddf5('0x46')]['id']){delete _0x48d046[_0xddf5('0x46')]['id'];}return db[_0xddf5('0x2b')][_0xddf5('0x47')]({'where':{'id':_0x48d046['params']['id']}})[_0xddf5('0x24')](handleEntityNotFound(_0x4ab887,null))[_0xddf5('0x24')](saveUpdates(_0x48d046[_0xddf5('0x46')],null))['then'](respondWithResult(_0x4ab887,null))[_0xddf5('0x42')](handleError(_0x4ab887,null));};exports['destroy']=function(_0x1c680d,_0x42312e){return db[_0xddf5('0x2b')]['find']({'where':{'id':_0x1c680d[_0xddf5('0x43')]['id']}})[_0xddf5('0x24')](handleEntityNotFound(_0x42312e,null))[_0xddf5('0x24')](removeEntity(_0x42312e,null))[_0xddf5('0x42')](handleError(_0x42312e,null));};exports[_0xddf5('0x48')]=function(_0x57561f,_0x1b582e){return db['JscriptyQuestionReport'][_0xddf5('0x48')]()[_0xddf5('0x24')](respondWithResult(_0x1b582e,null))['catch'](handleError(_0x1b582e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index fc4a61b..64b3afd 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 _0xdf22=['moment','bluebird','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api'];(function(_0x1e4b30,_0xf19534){var _0x4639a2=function(_0xec0bf6){while(--_0xec0bf6){_0x1e4b30['push'](_0x1e4b30['shift']());}};_0x4639a2(++_0xf19534);}(_0xdf22,0xc9));var _0x2df2=function(_0x3eb0a2,_0x576d57){_0x3eb0a2=_0x3eb0a2-0x0;var _0x185a3b=_0xdf22[_0x3eb0a2];return _0x185a3b;};'use strict';var _=require(_0x2df2('0x0'));var util=require(_0x2df2('0x1'));var logger=require('../../config/logger')(_0x2df2('0x2'));var moment=require(_0x2df2('0x3'));var BPromise=require(_0x2df2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2df2('0x5'));var config=require(_0x2df2('0x6'));var attributes=require(_0x2df2('0x7'));module[_0x2df2('0x8')]=function(_0x5076be,_0xc2e0fd){return _0x5076be[_0x2df2('0x9')](_0x2df2('0xa'),attributes,{'tableName':_0x2df2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62b4=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x62b4,0x1e6));var _0x462b=function(_0x484f06,_0x36e4ac){_0x484f06=_0x484f06-0x0;var _0x332d44=_0x62b4[_0x484f06];return _0x332d44;};'use strict';var _=require(_0x462b('0x0'));var util=require(_0x462b('0x1'));var logger=require('../../config/logger')(_0x462b('0x2'));var moment=require(_0x462b('0x3'));var BPromise=require(_0x462b('0x4'));var rp=require(_0x462b('0x5'));var fs=require('fs');var path=require(_0x462b('0x6'));var rimraf=require(_0x462b('0x7'));var config=require(_0x462b('0x8'));var attributes=require(_0x462b('0x9'));module[_0x462b('0xa')]=function(_0x2dbafb,_0x8482da){return _0x2dbafb[_0x462b('0xb')](_0x462b('0xc'),attributes,{'tableName':_0x462b('0xd'),'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 2f01a16..67704e4 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 _0x9554=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird'];(function(_0x157067,_0x4424e5){var _0x549096=function(_0x2dce8d){while(--_0x2dce8d){_0x157067['push'](_0x157067['shift']());}};_0x549096(++_0x4424e5);}(_0x9554,0x1ca));var _0x4955=function(_0x458b3d,_0x348068){_0x458b3d=_0x458b3d-0x0;var _0x25d98e=_0x9554[_0x458b3d];return _0x25d98e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4955('0x0'));var BPromise=require(_0x4955('0x1'));var rs=require(_0x4955('0x2'));var fs=require('fs');var Redis=require(_0x4955('0x3'));var db=require(_0x4955('0x4'))['db'];var utils=require(_0x4955('0x5'));var logger=require(_0x4955('0x6'))(_0x4955('0x7'));var config=require(_0x4955('0x8'));var jayson=require(_0x4955('0x9'));var client=jayson[_0x4955('0xa')][_0x4955('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa0f03a,_0x5436f2,_0x39e698){return new BPromise(function(_0x19b912,_0x290dc4){return client[_0x4955('0xc')](_0xa0f03a,_0x39e698)[_0x4955('0xd')](function(_0x4ee779){logger[_0x4955('0xe')](_0x4955('0xf'),_0x5436f2,_0x4955('0x10'));logger['debug'](_0x4955('0x11'),_0x5436f2,'request\x20sent',JSON[_0x4955('0x12')](_0x4ee779));if(_0x4ee779[_0x4955('0x13')]){if(_0x4ee779[_0x4955('0x13')]['code']===0x1f4){logger['error'](_0x4955('0xf'),_0x5436f2,_0x4ee779[_0x4955('0x13')][_0x4955('0x14')]);return _0x290dc4(_0x4ee779[_0x4955('0x13')][_0x4955('0x14')]);}logger[_0x4955('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5436f2,_0x4ee779[_0x4955('0x13')][_0x4955('0x14')]);return _0x19b912(_0x4ee779['error'][_0x4955('0x14')]);}else{logger[_0x4955('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5436f2,_0x4955('0x10'));_0x19b912(_0x4ee779[_0x4955('0x15')][_0x4955('0x14')]);}})[_0x4955('0x16')](function(_0x41f24d){logger[_0x4955('0x13')](_0x4955('0xf'),_0x5436f2,_0x41f24d);_0x290dc4(_0x41f24d);});});} \ No newline at end of file +var _0x1f1f=['client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x2be6d9,_0xd31df5){var _0x45e38b=function(_0x1237b0){while(--_0x1237b0){_0x2be6d9['push'](_0x2be6d9['shift']());}};_0x45e38b(++_0xd31df5);}(_0x1f1f,0x1e6));var _0xf1f1=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x1f1f[_0x264545];return _0x114d10;};'use strict';var _=require('lodash');var util=require(_0xf1f1('0x0'));var moment=require(_0xf1f1('0x1'));var BPromise=require('bluebird');var rs=require(_0xf1f1('0x2'));var fs=require('fs');var Redis=require(_0xf1f1('0x3'));var db=require(_0xf1f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf1f1('0x5'))(_0xf1f1('0x6'));var config=require('../../config/environment');var jayson=require(_0xf1f1('0x7'));var client=jayson[_0xf1f1('0x8')][_0xf1f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1124a1,_0x2faedd,_0x5d64f6){return new BPromise(function(_0x5c1c02,_0x277244){return client[_0xf1f1('0xa')](_0x1124a1,_0x5d64f6)['then'](function(_0x2a6f3f){logger[_0xf1f1('0xb')](_0xf1f1('0xc'),_0x2faedd,_0xf1f1('0xd'));logger['debug'](_0xf1f1('0xe'),_0x2faedd,_0xf1f1('0xd'),JSON[_0xf1f1('0xf')](_0x2a6f3f));if(_0x2a6f3f['error']){if(_0x2a6f3f[_0xf1f1('0x10')][_0xf1f1('0x11')]===0x1f4){logger[_0xf1f1('0x10')](_0xf1f1('0xc'),_0x2faedd,_0x2a6f3f[_0xf1f1('0x10')]['message']);return _0x277244(_0x2a6f3f[_0xf1f1('0x10')][_0xf1f1('0x12')]);}logger['error'](_0xf1f1('0xc'),_0x2faedd,_0x2a6f3f[_0xf1f1('0x10')][_0xf1f1('0x12')]);return _0x5c1c02(_0x2a6f3f[_0xf1f1('0x10')][_0xf1f1('0x12')]);}else{logger[_0xf1f1('0xb')](_0xf1f1('0xc'),_0x2faedd,_0xf1f1('0xd'));_0x5c1c02(_0x2a6f3f['result'][_0xf1f1('0x12')]);}})['catch'](function(_0x3b9fb6){logger[_0xf1f1('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2faedd,_0x3b9fb6);_0x277244(_0x3b9fb6);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 08200e6..0ea3b1b 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 _0x02b6=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/questions','getQuestions','post','put','update','delete','multer','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x02b6,0x65));var _0x602b=function(_0x3ed506,_0x2502ae){_0x3ed506=_0x3ed506-0x0;var _0x2ec549=_0x02b6[_0x3ed506];return _0x2ec549;};'use strict';var multer=require(_0x602b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x602b('0x1'));var express=require(_0x602b('0x2'));var router=express[_0x602b('0x3')]();var fs_extra=require(_0x602b('0x4'));var auth=require(_0x602b('0x5'));var interaction=require(_0x602b('0x6'));var config=require('../../config/environment');var controller=require(_0x602b('0x7'));router['get']('/',auth[_0x602b('0x8')](),controller[_0x602b('0x9')]);router['get'](_0x602b('0xa'),auth[_0x602b('0x8')](),controller[_0x602b('0xb')]);router[_0x602b('0xc')](_0x602b('0xd'),auth[_0x602b('0x8')](),controller[_0x602b('0xe')]);router[_0x602b('0xc')](_0x602b('0xf'),auth[_0x602b('0x8')](),controller[_0x602b('0x10')]);router[_0x602b('0x11')]('/',auth[_0x602b('0x8')](),controller['create']);router[_0x602b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x602b('0x13')]);router[_0x602b('0x14')](_0x602b('0xd'),auth[_0x602b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9b54=['post','create','put','/:id','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id/questions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9b54,0x92));var _0x49b5=function(_0x49e532,_0x44a84b){_0x49e532=_0x49e532-0x0;var _0x29867c=_0x9b54[_0x49e532];return _0x29867c;};'use strict';var multer=require(_0x49b5('0x0'));var util=require('util');var path=require(_0x49b5('0x1'));var timeout=require(_0x49b5('0x2'));var express=require(_0x49b5('0x3'));var router=express[_0x49b5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x49b5('0x5'));var interaction=require(_0x49b5('0x6'));var config=require('../../config/environment');var controller=require(_0x49b5('0x7'));router[_0x49b5('0x8')]('/',auth[_0x49b5('0x9')](),controller[_0x49b5('0xa')]);router[_0x49b5('0x8')](_0x49b5('0xb'),auth[_0x49b5('0x9')](),controller[_0x49b5('0xc')]);router[_0x49b5('0x8')]('/:id',auth[_0x49b5('0x9')](),controller['show']);router['get'](_0x49b5('0xd'),auth[_0x49b5('0x9')](),controller['getQuestions']);router[_0x49b5('0xe')]('/',auth[_0x49b5('0x9')](),controller[_0x49b5('0xf')]);router[_0x49b5('0x10')](_0x49b5('0x11'),auth[_0x49b5('0x9')](),controller['update']);router[_0x49b5('0x12')](_0x49b5('0x11'),auth[_0x49b5('0x9')](),controller['destroy']);module[_0x49b5('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 c666f8a..937b32c 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 _0x68df=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x68df,0xcd));var _0xf68d=function(_0x40244d,_0x54cfeb){_0x40244d=_0x40244d-0x0;var _0x28917f=_0x68df[_0x40244d];return _0x28917f;};'use strict';var moment=require(_0xf68d('0x0'));var Sequelize=require(_0xf68d('0x1'));module[_0xf68d('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3a57b7){this[_0xf68d('0x3')](_0xf68d('0x4'),_0x3a57b7);this[_0xf68d('0x3')](_0xf68d('0x5'),moment()[_0xf68d('0x6')](_0xf68d('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xf68d('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf68d('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf68d('0x8')]},'calleridnum':{'type':Sequelize[_0xf68d('0x8')]},'completed':{'type':Sequelize[_0xf68d('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xc1db=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc1db,0x120));var _0xbc1d=function(_0x24dccb,_0x243cd2){_0x24dccb=_0x24dccb-0x0;var _0x3d63d3=_0xc1db[_0x24dccb];return _0x3d63d3;};'use strict';var moment=require(_0xbc1d('0x0'));var Sequelize=require('sequelize');module[_0xbc1d('0x1')]={'starttime':{'type':Sequelize[_0xbc1d('0x2')],'set':function(_0x46dc87){this[_0xbc1d('0x3')](_0xbc1d('0x4'),_0x46dc87);this['setDataValue'](_0xbc1d('0x5'),moment()[_0xbc1d('0x6')](_0xbc1d('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xbc1d('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbc1d('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xbc1d('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 56263bb..134a290 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 _0xd3e1=['fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','findOne','hasOwnProperty','nolimit','SessionId','filter','JscriptyQuestionReport','eml-format','rimraf','zip-dir','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','JscriptySessionReport','rawAttributes'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xd3e1,0x1a8));var _0x1d3e=function(_0x4bd29a,_0x1b88ff){_0x4bd29a=_0x4bd29a-0x0;var _0xdf0693=_0xd3e1[_0x4bd29a];return _0xdf0693;};'use strict';var emlformat=require(_0x1d3e('0x0'));var rimraf=require(_0x1d3e('0x1'));var zipdir=require(_0x1d3e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1d3e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1d3e('0x4'));var util=require(_0x1d3e('0x5'));var path=require(_0x1d3e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1d3e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d3e('0x8'));var squel=require('squel');var crypto=require(_0x1d3e('0x9'));var jsforce=require(_0x1d3e('0xa'));var deskjs=require(_0x1d3e('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d3e('0xc'));var Redis=require(_0x1d3e('0xd'));var authService=require(_0x1d3e('0xe'));var qs=require(_0x1d3e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d3e('0x10'));var logger=require(_0x1d3e('0x11'))(_0x1d3e('0x12'));var utils=require(_0x1d3e('0x13'));var config=require(_0x1d3e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1d3e('0x15'))['db'];function respondWithStatusCode(_0xa5b964,_0x351a76){_0x351a76=_0x351a76||0xcc;return function(_0x42a661){if(_0x42a661){return _0xa5b964['sendStatus'](_0x351a76);}return _0xa5b964['status'](_0x351a76)[_0x1d3e('0x16')]();};}function respondWithResult(_0x35814b,_0x473939){_0x473939=_0x473939||0xc8;return function(_0x27ba28){if(_0x27ba28){return _0x35814b[_0x1d3e('0x17')](_0x473939)['json'](_0x27ba28);}};}function respondWithFilteredResult(_0x42e3a9,_0x3093f9){return function(_0x4596b9){if(_0x4596b9){var _0x3c06d0=typeof _0x3093f9[_0x1d3e('0x18')]===_0x1d3e('0x19')&&typeof _0x3093f9[_0x1d3e('0x1a')]===_0x1d3e('0x19');var _0x2e543e=_0x4596b9[_0x1d3e('0x1b')];var _0x5cf24d=_0x3c06d0?0x0:_0x3093f9['offset'];var _0x3767f9=_0x3c06d0?_0x4596b9[_0x1d3e('0x1b')]:_0x3093f9[_0x1d3e('0x18')]+_0x3093f9[_0x1d3e('0x1a')];var _0x50ea2c;if(_0x3767f9>=_0x2e543e){_0x3767f9=_0x2e543e;_0x50ea2c=0xc8;}else{_0x50ea2c=0xce;}_0x42e3a9[_0x1d3e('0x17')](_0x50ea2c);return _0x42e3a9[_0x1d3e('0x1c')](_0x1d3e('0x1d'),_0x5cf24d+'-'+_0x3767f9+'/'+_0x2e543e)[_0x1d3e('0x1e')](_0x4596b9);}return null;};}function patchUpdates(_0x475ff8){return function(_0x413877){try{jsonpatch[_0x1d3e('0x1f')](_0x413877,_0x475ff8,!![]);}catch(_0x5f2256){return BPromise[_0x1d3e('0x20')](_0x5f2256);}return _0x413877[_0x1d3e('0x21')]();};}function saveUpdates(_0x128ab3,_0x261cd9){return function(_0x5c280e){if(_0x5c280e){return _0x5c280e[_0x1d3e('0x22')](_0x128ab3)[_0x1d3e('0x23')](function(_0x321b19){return _0x321b19;});}return null;};}function removeEntity(_0x3e3f6e,_0x5efa61){return function(_0x4afad5){if(_0x4afad5){return _0x4afad5[_0x1d3e('0x24')]()[_0x1d3e('0x23')](function(){_0x3e3f6e[_0x1d3e('0x17')](0xcc)[_0x1d3e('0x16')]();});}};}function handleEntityNotFound(_0x29b4d7,_0x3edda7){return function(_0x9a44ca){if(!_0x9a44ca){_0x29b4d7[_0x1d3e('0x25')](0x194);}return _0x9a44ca;};}function handleError(_0x1a76b7,_0x37f0b7){_0x37f0b7=_0x37f0b7||0x1f4;return function(_0x2ab0d7){logger['error'](_0x2ab0d7['stack']);if(_0x2ab0d7[_0x1d3e('0x26')]){delete _0x2ab0d7['name'];}_0x1a76b7[_0x1d3e('0x17')](_0x37f0b7)[_0x1d3e('0x27')](_0x2ab0d7);};}exports[_0x1d3e('0x28')]=function(_0x1a1426,_0x1dc1fb){var _0x1ae887={},_0x5d0bbd={},_0x36253c={'count':0x0,'rows':[]};var _0x173273=_[_0x1d3e('0x29')](db[_0x1d3e('0x2a')][_0x1d3e('0x2b')],function(_0x349c80){return{'name':_0x349c80[_0x1d3e('0x2c')],'type':_0x349c80[_0x1d3e('0x2d')][_0x1d3e('0x2e')]};});_0x5d0bbd['model']=_[_0x1d3e('0x29')](_0x173273,'name');_0x5d0bbd[_0x1d3e('0x2f')]=_[_0x1d3e('0x30')](_0x1a1426['query']);_0x5d0bbd[_0x1d3e('0x31')]=_[_0x1d3e('0x32')](_0x5d0bbd['model'],_0x5d0bbd[_0x1d3e('0x2f')]);_0x1ae887[_0x1d3e('0x33')]=_[_0x1d3e('0x32')](_0x5d0bbd[_0x1d3e('0x34')],qs[_0x1d3e('0x35')](_0x1a1426['query'][_0x1d3e('0x35')]));_0x1ae887[_0x1d3e('0x33')]=_0x1ae887[_0x1d3e('0x33')][_0x1d3e('0x36')]?_0x1ae887[_0x1d3e('0x33')]:_0x5d0bbd[_0x1d3e('0x34')];if(!_0x1a1426[_0x1d3e('0x2f')]['hasOwnProperty']('nolimit')){_0x1ae887[_0x1d3e('0x1a')]=qs[_0x1d3e('0x1a')](_0x1a1426[_0x1d3e('0x2f')][_0x1d3e('0x1a')]);_0x1ae887[_0x1d3e('0x18')]=qs['offset'](_0x1a1426[_0x1d3e('0x2f')][_0x1d3e('0x18')]);}_0x1ae887[_0x1d3e('0x37')]=qs['sort'](_0x1a1426['query'][_0x1d3e('0x38')]);_0x1ae887[_0x1d3e('0x39')]=qs[_0x1d3e('0x31')](_[_0x1d3e('0x3a')](_0x1a1426[_0x1d3e('0x2f')],_0x5d0bbd[_0x1d3e('0x31')]),_0x173273);if(_0x1a1426['query']['filter']){_0x1ae887[_0x1d3e('0x39')]=_[_0x1d3e('0x3b')](_0x1ae887[_0x1d3e('0x39')],{'$or':_[_0x1d3e('0x29')](_0x173273,function(_0x4f8b3c){if(_0x4f8b3c[_0x1d3e('0x2d')]!=='VIRTUAL'){var _0x2e67f4={};_0x2e67f4[_0x4f8b3c[_0x1d3e('0x26')]]={'$like':'%'+_0x1a1426[_0x1d3e('0x2f')]['filter']+'%'};return _0x2e67f4;}})});}_0x1ae887=_[_0x1d3e('0x3b')]({},_0x1ae887,_0x1a1426['options']);var _0x440b32={'where':_0x1ae887[_0x1d3e('0x39')]};return db[_0x1d3e('0x2a')][_0x1d3e('0x1b')](_0x440b32)[_0x1d3e('0x23')](function(_0x48783b){_0x36253c['count']=_0x48783b;if(_0x1a1426[_0x1d3e('0x2f')][_0x1d3e('0x3c')]){_0x1ae887[_0x1d3e('0x3d')]=[{'all':!![]}];}return db[_0x1d3e('0x2a')][_0x1d3e('0x3e')](_0x1ae887);})[_0x1d3e('0x23')](function(_0x40647c){_0x36253c[_0x1d3e('0x3f')]=_0x40647c;return _0x36253c;})[_0x1d3e('0x23')](respondWithFilteredResult(_0x1dc1fb,_0x1ae887))[_0x1d3e('0x40')](handleError(_0x1dc1fb,null));};exports[_0x1d3e('0x41')]=function(_0x54c64c,_0x7dd251){var _0x18503e={'raw':!![],'where':{'id':_0x54c64c[_0x1d3e('0x42')]['id']}},_0x28422e={};_0x28422e['model']=_[_0x1d3e('0x30')](db['JscriptySessionReport']['rawAttributes']);_0x28422e[_0x1d3e('0x2f')]=_[_0x1d3e('0x30')](_0x54c64c[_0x1d3e('0x2f')]);_0x28422e[_0x1d3e('0x31')]=_[_0x1d3e('0x32')](_0x28422e[_0x1d3e('0x34')],_0x28422e[_0x1d3e('0x2f')]);_0x18503e['attributes']=_[_0x1d3e('0x32')](_0x28422e[_0x1d3e('0x34')],qs[_0x1d3e('0x35')](_0x54c64c[_0x1d3e('0x2f')][_0x1d3e('0x35')]));_0x18503e['attributes']=_0x18503e[_0x1d3e('0x33')][_0x1d3e('0x36')]?_0x18503e[_0x1d3e('0x33')]:_0x28422e[_0x1d3e('0x34')];if(_0x54c64c[_0x1d3e('0x2f')][_0x1d3e('0x3c')]){_0x18503e[_0x1d3e('0x3d')]=[{'all':!![]}];}_0x18503e=_['merge']({},_0x18503e,_0x54c64c[_0x1d3e('0x43')]);return db[_0x1d3e('0x2a')]['find'](_0x18503e)[_0x1d3e('0x23')](handleEntityNotFound(_0x7dd251,null))[_0x1d3e('0x23')](respondWithResult(_0x7dd251,null))[_0x1d3e('0x40')](handleError(_0x7dd251,null));};exports[_0x1d3e('0x44')]=function(_0x496bc5,_0x3b44a2){return db[_0x1d3e('0x2a')][_0x1d3e('0x44')](_0x496bc5['body'],{})[_0x1d3e('0x23')](respondWithResult(_0x3b44a2,0xc9))[_0x1d3e('0x40')](handleError(_0x3b44a2,null));};exports[_0x1d3e('0x22')]=function(_0x34610e,_0x4a08c6){if(_0x34610e[_0x1d3e('0x45')]['id']){delete _0x34610e['body']['id'];}return db[_0x1d3e('0x2a')][_0x1d3e('0x46')]({'where':{'id':_0x34610e[_0x1d3e('0x42')]['id']}})['then'](handleEntityNotFound(_0x4a08c6,null))['then'](saveUpdates(_0x34610e['body'],null))[_0x1d3e('0x23')](respondWithResult(_0x4a08c6,null))[_0x1d3e('0x40')](handleError(_0x4a08c6,null));};exports[_0x1d3e('0x24')]=function(_0x471ef8,_0x1b1615){return db[_0x1d3e('0x2a')][_0x1d3e('0x46')]({'where':{'id':_0x471ef8[_0x1d3e('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b1615,null))[_0x1d3e('0x23')](removeEntity(_0x1b1615,null))['catch'](handleError(_0x1b1615,null));};exports['describe']=function(_0x39e6df,_0x169c9c){return db[_0x1d3e('0x2a')][_0x1d3e('0x47')]()[_0x1d3e('0x23')](respondWithResult(_0x169c9c,null))[_0x1d3e('0x40')](handleError(_0x169c9c,null));};exports['getQuestions']=function(_0x4318d8,_0x5687e2,_0x2f0f2a){var _0x314d2a={'raw':!![],'where':{}};var _0x4051c3={};var _0x3cb524={'count':0x0,'rows':[]};return db[_0x1d3e('0x2a')][_0x1d3e('0x48')]({'where':{'id':_0x4318d8[_0x1d3e('0x42')]['id']}})[_0x1d3e('0x23')](handleEntityNotFound(_0x5687e2,null))['then'](function(_0x3081fd){if(_0x3081fd){_0x4051c3[_0x1d3e('0x34')]=_[_0x1d3e('0x30')](db['JscriptyQuestionReport'][_0x1d3e('0x2b')]);_0x4051c3[_0x1d3e('0x2f')]=_[_0x1d3e('0x30')](_0x4318d8[_0x1d3e('0x2f')]);_0x4051c3[_0x1d3e('0x31')]=_['intersection'](_0x4051c3[_0x1d3e('0x34')],_0x4051c3['query']);_0x314d2a[_0x1d3e('0x33')]=_[_0x1d3e('0x32')](_0x4051c3[_0x1d3e('0x34')],qs[_0x1d3e('0x35')](_0x4318d8[_0x1d3e('0x2f')][_0x1d3e('0x35')]));_0x314d2a[_0x1d3e('0x33')]=_0x314d2a[_0x1d3e('0x33')][_0x1d3e('0x36')]?_0x314d2a[_0x1d3e('0x33')]:_0x4051c3[_0x1d3e('0x34')];if(!_0x4318d8[_0x1d3e('0x2f')][_0x1d3e('0x49')](_0x1d3e('0x4a'))){_0x314d2a[_0x1d3e('0x1a')]=qs[_0x1d3e('0x1a')](_0x4318d8[_0x1d3e('0x2f')]['limit']);_0x314d2a[_0x1d3e('0x18')]=qs[_0x1d3e('0x18')](_0x4318d8[_0x1d3e('0x2f')][_0x1d3e('0x18')]);}_0x314d2a[_0x1d3e('0x37')]=qs['sort'](_0x4318d8[_0x1d3e('0x2f')][_0x1d3e('0x38')]);_0x314d2a[_0x1d3e('0x39')]=qs['filters'](_[_0x1d3e('0x3a')](_0x4318d8[_0x1d3e('0x2f')],_0x4051c3['filters']));_0x314d2a['where'][_0x1d3e('0x4b')]=_0x3081fd['id'];if(_0x4318d8[_0x1d3e('0x2f')]['filter']){_0x314d2a[_0x1d3e('0x39')]=_[_0x1d3e('0x3b')](_0x314d2a[_0x1d3e('0x39')],{'$or':_['map'](_0x314d2a[_0x1d3e('0x33')],function(_0xc88c17){var _0x2ef7ca={};_0x2ef7ca[_0xc88c17]={'$like':'%'+_0x4318d8[_0x1d3e('0x2f')][_0x1d3e('0x4c')]+'%'};return _0x2ef7ca;})});}_0x314d2a=_[_0x1d3e('0x3b')]({},_0x314d2a,_0x4318d8[_0x1d3e('0x43')]);return db[_0x1d3e('0x4d')][_0x1d3e('0x1b')]({'where':_0x314d2a['where']})[_0x1d3e('0x23')](function(_0xb6241a){_0x3cb524[_0x1d3e('0x1b')]=_0xb6241a;if(_0x4318d8['query'][_0x1d3e('0x3c')]){_0x314d2a[_0x1d3e('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x1d3e('0x3e')](_0x314d2a);})['then'](function(_0xba4502){_0x3cb524[_0x1d3e('0x3f')]=_0xba4502;return _0x3cb524;});}})['then'](respondWithFilteredResult(_0x5687e2,_0x314d2a))['catch'](handleError(_0x5687e2,null));}; \ No newline at end of file +var _0x45fd=['JscriptySessionReport','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send'];(function(_0x4879e9,_0x22f2d3){var _0xf9cb2=function(_0x572fa2){while(--_0x572fa2){_0x4879e9['push'](_0x4879e9['shift']());}};_0xf9cb2(++_0x22f2d3);}(_0x45fd,0x70));var _0xd45f=function(_0x1ef41f,_0x1ac9c9){_0x1ef41f=_0x1ef41f-0x0;var _0x5943ab=_0x45fd[_0x1ef41f];return _0x5943ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd45f('0x0'));var zipdir=require(_0xd45f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd45f('0x2'));var moment=require('moment');var BPromise=require(_0xd45f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd45f('0x4'));var sox=require(_0xd45f('0x5'));var csv=require(_0xd45f('0x6'));var ejs=require(_0xd45f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd45f('0x8'));var squel=require(_0xd45f('0x9'));var crypto=require(_0xd45f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd45f('0xb'));var toCsv=require(_0xd45f('0x6'));var querystring=require(_0xd45f('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd45f('0xd'));var qs=require(_0xd45f('0xe'));var as=require(_0xd45f('0xf'));var hardwareService=require(_0xd45f('0x10'));var logger=require(_0xd45f('0x11'))(_0xd45f('0x12'));var utils=require(_0xd45f('0x13'));var config=require(_0xd45f('0x14'));var licenseUtil=require(_0xd45f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388c5b,_0x23d94f){_0x23d94f=_0x23d94f||0xcc;return function(_0x368184){if(_0x368184){return _0x388c5b[_0xd45f('0x16')](_0x23d94f);}return _0x388c5b[_0xd45f('0x17')](_0x23d94f)[_0xd45f('0x18')]();};}function respondWithResult(_0x912755,_0x251d56){_0x251d56=_0x251d56||0xc8;return function(_0x5acc51){if(_0x5acc51){return _0x912755['status'](_0x251d56)[_0xd45f('0x19')](_0x5acc51);}};}function respondWithFilteredResult(_0x518af2,_0x39cef4){return function(_0x55cf0){if(_0x55cf0){var _0x5c756a=typeof _0x39cef4[_0xd45f('0x1a')]===_0xd45f('0x1b')&&typeof _0x39cef4['limit']===_0xd45f('0x1b');var _0x1a3837=_0x55cf0['count'];var _0x23aa03=_0x5c756a?0x0:_0x39cef4[_0xd45f('0x1a')];var _0x55748c=_0x5c756a?_0x55cf0[_0xd45f('0x1c')]:_0x39cef4['offset']+_0x39cef4[_0xd45f('0x1d')];var _0x47798b;if(_0x55748c>=_0x1a3837){_0x55748c=_0x1a3837;_0x47798b=0xc8;}else{_0x47798b=0xce;}_0x518af2['status'](_0x47798b);return _0x518af2[_0xd45f('0x1e')](_0xd45f('0x1f'),_0x23aa03+'-'+_0x55748c+'/'+_0x1a3837)['json'](_0x55cf0);}return null;};}function patchUpdates(_0x59fc3d){return function(_0x24cabc){try{jsonpatch[_0xd45f('0x20')](_0x24cabc,_0x59fc3d,!![]);}catch(_0x88b714){return BPromise[_0xd45f('0x21')](_0x88b714);}return _0x24cabc[_0xd45f('0x22')]();};}function saveUpdates(_0x72ca82,_0x194dd9){return function(_0x1ac669){if(_0x1ac669){return _0x1ac669['update'](_0x72ca82)[_0xd45f('0x23')](function(_0x40a929){return _0x40a929;});}return null;};}function removeEntity(_0x593327,_0xb9d2a6){return function(_0x15bb8c){if(_0x15bb8c){return _0x15bb8c['destroy']()[_0xd45f('0x23')](function(){_0x593327[_0xd45f('0x17')](0xcc)[_0xd45f('0x18')]();});}};}function handleEntityNotFound(_0x4002b4,_0x285064){return function(_0x1ca4cb){if(!_0x1ca4cb){_0x4002b4['sendStatus'](0x194);}return _0x1ca4cb;};}function handleError(_0x5cc234,_0x408933){_0x408933=_0x408933||0x1f4;return function(_0x11b964){logger[_0xd45f('0x24')](_0x11b964[_0xd45f('0x25')]);if(_0x11b964[_0xd45f('0x26')]){delete _0x11b964[_0xd45f('0x26')];}_0x5cc234[_0xd45f('0x17')](_0x408933)[_0xd45f('0x27')](_0x11b964);};}exports['index']=function(_0x47249e,_0x491080){var _0x3162b0={},_0x57777c={},_0x15000f={'count':0x0,'rows':[]};var _0x1a951c=_['map'](db[_0xd45f('0x28')]['rawAttributes'],function(_0x319ae2){return{'name':_0x319ae2['fieldName'],'type':_0x319ae2[_0xd45f('0x29')]['key']};});_0x57777c[_0xd45f('0x2a')]=_[_0xd45f('0x2b')](_0x1a951c,_0xd45f('0x26'));_0x57777c['query']=_['keys'](_0x47249e[_0xd45f('0x2c')]);_0x57777c[_0xd45f('0x2d')]=_[_0xd45f('0x2e')](_0x57777c[_0xd45f('0x2a')],_0x57777c[_0xd45f('0x2c')]);_0x3162b0['attributes']=_[_0xd45f('0x2e')](_0x57777c[_0xd45f('0x2a')],qs['fields'](_0x47249e[_0xd45f('0x2c')][_0xd45f('0x2f')]));_0x3162b0[_0xd45f('0x30')]=_0x3162b0['attributes'][_0xd45f('0x31')]?_0x3162b0['attributes']:_0x57777c[_0xd45f('0x2a')];if(!_0x47249e[_0xd45f('0x2c')][_0xd45f('0x32')](_0xd45f('0x33'))){_0x3162b0['limit']=qs[_0xd45f('0x1d')](_0x47249e['query'][_0xd45f('0x1d')]);_0x3162b0[_0xd45f('0x1a')]=qs[_0xd45f('0x1a')](_0x47249e[_0xd45f('0x2c')][_0xd45f('0x1a')]);}_0x3162b0[_0xd45f('0x34')]=qs[_0xd45f('0x35')](_0x47249e[_0xd45f('0x2c')]['sort']);_0x3162b0[_0xd45f('0x36')]=qs['filters'](_['pick'](_0x47249e[_0xd45f('0x2c')],_0x57777c[_0xd45f('0x2d')]),_0x1a951c);if(_0x47249e[_0xd45f('0x2c')][_0xd45f('0x37')]){_0x3162b0['where']=_[_0xd45f('0x38')](_0x3162b0['where'],{'$or':_[_0xd45f('0x2b')](_0x1a951c,function(_0x311716){if(_0x311716[_0xd45f('0x29')]!==_0xd45f('0x39')){var _0x23d474={};_0x23d474[_0x311716[_0xd45f('0x26')]]={'$like':'%'+_0x47249e['query'][_0xd45f('0x37')]+'%'};return _0x23d474;}})});}_0x3162b0=_[_0xd45f('0x38')]({},_0x3162b0,_0x47249e[_0xd45f('0x3a')]);var _0x5afa5c={'where':_0x3162b0[_0xd45f('0x36')]};return db[_0xd45f('0x28')][_0xd45f('0x1c')](_0x5afa5c)['then'](function(_0x126f4b){_0x15000f[_0xd45f('0x1c')]=_0x126f4b;if(_0x47249e[_0xd45f('0x2c')][_0xd45f('0x3b')]){_0x3162b0[_0xd45f('0x3c')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xd45f('0x3d')](_0x3162b0);})[_0xd45f('0x23')](function(_0x90ef08){_0x15000f[_0xd45f('0x3e')]=_0x90ef08;return _0x15000f;})[_0xd45f('0x23')](respondWithFilteredResult(_0x491080,_0x3162b0))[_0xd45f('0x3f')](handleError(_0x491080,null));};exports['show']=function(_0x8ac1b7,_0xabdd9f){var _0x4bdc60={'raw':!![],'where':{'id':_0x8ac1b7[_0xd45f('0x40')]['id']}},_0x457a11={};_0x457a11[_0xd45f('0x2a')]=_[_0xd45f('0x41')](db[_0xd45f('0x28')]['rawAttributes']);_0x457a11[_0xd45f('0x2c')]=_['keys'](_0x8ac1b7['query']);_0x457a11[_0xd45f('0x2d')]=_[_0xd45f('0x2e')](_0x457a11[_0xd45f('0x2a')],_0x457a11['query']);_0x4bdc60[_0xd45f('0x30')]=_[_0xd45f('0x2e')](_0x457a11[_0xd45f('0x2a')],qs['fields'](_0x8ac1b7[_0xd45f('0x2c')][_0xd45f('0x2f')]));_0x4bdc60[_0xd45f('0x30')]=_0x4bdc60[_0xd45f('0x30')][_0xd45f('0x31')]?_0x4bdc60['attributes']:_0x457a11[_0xd45f('0x2a')];if(_0x8ac1b7[_0xd45f('0x2c')][_0xd45f('0x3b')]){_0x4bdc60[_0xd45f('0x3c')]=[{'all':!![]}];}_0x4bdc60=_[_0xd45f('0x38')]({},_0x4bdc60,_0x8ac1b7[_0xd45f('0x3a')]);return db[_0xd45f('0x28')][_0xd45f('0x42')](_0x4bdc60)[_0xd45f('0x23')](handleEntityNotFound(_0xabdd9f,null))[_0xd45f('0x23')](respondWithResult(_0xabdd9f,null))[_0xd45f('0x3f')](handleError(_0xabdd9f,null));};exports[_0xd45f('0x43')]=function(_0x174cc1,_0x2c9c88){return db[_0xd45f('0x28')][_0xd45f('0x43')](_0x174cc1['body'],{})[_0xd45f('0x23')](respondWithResult(_0x2c9c88,0xc9))[_0xd45f('0x3f')](handleError(_0x2c9c88,null));};exports[_0xd45f('0x44')]=function(_0x5b0e5c,_0x413c0f){if(_0x5b0e5c[_0xd45f('0x45')]['id']){delete _0x5b0e5c[_0xd45f('0x45')]['id'];}return db[_0xd45f('0x28')][_0xd45f('0x42')]({'where':{'id':_0x5b0e5c[_0xd45f('0x40')]['id']}})[_0xd45f('0x23')](handleEntityNotFound(_0x413c0f,null))[_0xd45f('0x23')](saveUpdates(_0x5b0e5c['body'],null))[_0xd45f('0x23')](respondWithResult(_0x413c0f,null))[_0xd45f('0x3f')](handleError(_0x413c0f,null));};exports[_0xd45f('0x46')]=function(_0x46cac8,_0x21f572){return db[_0xd45f('0x28')][_0xd45f('0x42')]({'where':{'id':_0x46cac8[_0xd45f('0x40')]['id']}})['then'](handleEntityNotFound(_0x21f572,null))['then'](removeEntity(_0x21f572,null))[_0xd45f('0x3f')](handleError(_0x21f572,null));};exports[_0xd45f('0x47')]=function(_0x237677,_0x9f48c8){return db[_0xd45f('0x28')]['describe']()['then'](respondWithResult(_0x9f48c8,null))[_0xd45f('0x3f')](handleError(_0x9f48c8,null));};exports[_0xd45f('0x48')]=function(_0x227e4f,_0x481d28,_0x4fbb41){var _0x34ebf7={'raw':!![],'where':{}};var _0x2c1172={};var _0x4b038a={'count':0x0,'rows':[]};return db[_0xd45f('0x28')][_0xd45f('0x49')]({'where':{'id':_0x227e4f[_0xd45f('0x40')]['id']}})[_0xd45f('0x23')](handleEntityNotFound(_0x481d28,null))[_0xd45f('0x23')](function(_0x51beee){if(_0x51beee){_0x2c1172['model']=_[_0xd45f('0x41')](db[_0xd45f('0x4a')]['rawAttributes']);_0x2c1172[_0xd45f('0x2c')]=_[_0xd45f('0x41')](_0x227e4f[_0xd45f('0x2c')]);_0x2c1172[_0xd45f('0x2d')]=_['intersection'](_0x2c1172[_0xd45f('0x2a')],_0x2c1172[_0xd45f('0x2c')]);_0x34ebf7[_0xd45f('0x30')]=_[_0xd45f('0x2e')](_0x2c1172['model'],qs[_0xd45f('0x2f')](_0x227e4f[_0xd45f('0x2c')][_0xd45f('0x2f')]));_0x34ebf7[_0xd45f('0x30')]=_0x34ebf7[_0xd45f('0x30')][_0xd45f('0x31')]?_0x34ebf7[_0xd45f('0x30')]:_0x2c1172['model'];if(!_0x227e4f['query'][_0xd45f('0x32')](_0xd45f('0x33'))){_0x34ebf7[_0xd45f('0x1d')]=qs[_0xd45f('0x1d')](_0x227e4f[_0xd45f('0x2c')]['limit']);_0x34ebf7[_0xd45f('0x1a')]=qs[_0xd45f('0x1a')](_0x227e4f['query'][_0xd45f('0x1a')]);}_0x34ebf7[_0xd45f('0x34')]=qs[_0xd45f('0x35')](_0x227e4f[_0xd45f('0x2c')][_0xd45f('0x35')]);_0x34ebf7[_0xd45f('0x36')]=qs['filters'](_['pick'](_0x227e4f['query'],_0x2c1172[_0xd45f('0x2d')]));_0x34ebf7['where'][_0xd45f('0x4b')]=_0x51beee['id'];if(_0x227e4f[_0xd45f('0x2c')][_0xd45f('0x37')]){_0x34ebf7[_0xd45f('0x36')]=_[_0xd45f('0x38')](_0x34ebf7['where'],{'$or':_['map'](_0x34ebf7[_0xd45f('0x30')],function(_0xc0e568){var _0x48549a={};_0x48549a[_0xc0e568]={'$like':'%'+_0x227e4f[_0xd45f('0x2c')]['filter']+'%'};return _0x48549a;})});}_0x34ebf7=_[_0xd45f('0x38')]({},_0x34ebf7,_0x227e4f[_0xd45f('0x3a')]);return db[_0xd45f('0x4a')][_0xd45f('0x1c')]({'where':_0x34ebf7[_0xd45f('0x36')]})[_0xd45f('0x23')](function(_0xf5bf9e){_0x4b038a[_0xd45f('0x1c')]=_0xf5bf9e;if(_0x227e4f['query'][_0xd45f('0x3b')]){_0x34ebf7[_0xd45f('0x3c')]=[{'all':!![]}];}return db[_0xd45f('0x4a')]['findAll'](_0x34ebf7);})[_0xd45f('0x23')](function(_0x2053e7){_0x4b038a[_0xd45f('0x3e')]=_0x2053e7;return _0x4b038a;});}})['then'](respondWithFilteredResult(_0x481d28,_0x34ebf7))[_0xd45f('0x3f')](handleError(_0x481d28,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index d9f94c7..ba75abc 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 _0xa6b0=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','moment','bluebird','request-promise'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x49431d,_0x4019e3){_0x49431d=_0x49431d-0x0;var _0x1b668a=_0xa6b0[_0x49431d];return _0x1b668a;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));module[_0x0a6b('0x8')]=function(_0x3dc2b0,_0x3b6967){return _0x3dc2b0[_0x0a6b('0x9')](_0x0a6b('0xa'),attributes,{'tableName':_0x0a6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions'];(function(_0x1649be,_0x2506f0){var _0x5e2f32=function(_0x42c2ae){while(--_0x42c2ae){_0x1649be['push'](_0x1649be['shift']());}};_0x5e2f32(++_0x2506f0);}(_0x2d72,0xa8));var _0x22d7=function(_0x468a01,_0x35a762){_0x468a01=_0x468a01-0x0;var _0x377cba=_0x2d72[_0x468a01];return _0x377cba;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'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 a7f9466..9397015 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 _0xffd6=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xffd6,0x97));var _0x6ffd=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xffd6[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});} \ No newline at end of file +var _0x4c60=['client','http','request','then','debug','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise'];(function(_0x264102,_0x5eee9e){var _0x27042d=function(_0x4426fc){while(--_0x4426fc){_0x264102['push'](_0x264102['shift']());}};_0x27042d(++_0x5eee9e);}(_0x4c60,0xc1));var _0x04c6=function(_0x1196e9,_0x4138a0){_0x1196e9=_0x1196e9-0x0;var _0x4c93eb=_0x4c60[_0x1196e9];return _0x4c93eb;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 08b7dc8..f47676e 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 _0x5665=['../../config/environment','./license.controller','get','index','put','isAuthenticated','/download_log_file','downloadLogFile','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x346385,_0x2673cd){var _0x8ded35=function(_0x3c2f0d){while(--_0x3c2f0d){_0x346385['push'](_0x346385['shift']());}};_0x8ded35(++_0x2673cd);}(_0x5665,0x9f));var _0x5566=function(_0x52dd0f,_0x54534a){_0x52dd0f=_0x52dd0f-0x0;var _0x1deb09=_0x5665[_0x52dd0f];return _0x1deb09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5566('0x0'));var timeout=require(_0x5566('0x1'));var express=require(_0x5566('0x2'));var router=express[_0x5566('0x3')]();var fs_extra=require(_0x5566('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5566('0x5'));var config=require(_0x5566('0x6'));var controller=require(_0x5566('0x7'));router[_0x5566('0x8')]('/',controller[_0x5566('0x9')]);router[_0x5566('0xa')]('/:id',auth[_0x5566('0xb')](),controller['update']);router['get'](_0x5566('0xc'),auth['isAuthenticated'](),controller[_0x5566('0xd')]);module[_0x5566('0xe')]=router; \ No newline at end of file +var _0x7866=['isAuthenticated','update','/download_log_file','downloadLogFile','util','express','Router','fs-extra','../../components/auth/service','./license.controller','index','put','/:id'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x7866,0x6c));var _0x6786=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7866[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require('multer');var util=require(_0x6786('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6786('0x1'));var router=express[_0x6786('0x2')]();var fs_extra=require(_0x6786('0x3'));var auth=require(_0x6786('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6786('0x5'));router['get']('/',controller[_0x6786('0x6')]);router[_0x6786('0x7')](_0x6786('0x8'),auth[_0x6786('0x9')](),controller[_0x6786('0xa')]);router['get'](_0x6786('0xb'),auth[_0x6786('0x9')](),controller[_0x6786('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index fc5279d..1f34c36 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 _0x439f=['exports','TEXT','STRING','INTEGER'];(function(_0x569d67,_0x39e483){var _0x314ee2=function(_0x160cbf){while(--_0x160cbf){_0x569d67['push'](_0x569d67['shift']());}};_0x314ee2(++_0x39e483);}(_0x439f,0x104));var _0xf439=function(_0x51821c,_0x2e39c5){_0x51821c=_0x51821c-0x0;var _0x20bde8=_0x439f[_0x51821c];return _0x20bde8;};'use strict';var Sequelize=require('sequelize');module[_0xf439('0x0')]={'license':{'type':Sequelize[_0xf439('0x1')]},'data1':{'type':Sequelize[_0xf439('0x2')]},'data2':{'type':Sequelize[_0xf439('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xf439('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x51a8=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x51a8,0x171));var _0x851a=function(_0x2c1c6e,_0x2b92c6){_0x2c1c6e=_0x2c1c6e-0x0;var _0x5651fa=_0x51a8[_0x2c1c6e];return _0x5651fa;};'use strict';var Sequelize=require(_0x851a('0x0'));module[_0x851a('0x1')]={'license':{'type':Sequelize[_0x851a('0x2')]},'data1':{'type':Sequelize[_0x851a('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x851a('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index d22db99..eaaccbb 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 _0x8afd=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','getLicense','catch','update','body','License','find','get','checkLicense','key','demo','downloadLogFile','license-info.log','/var','setHeader','Content-disposition','attachment;\x20filename=','set','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x24c947,_0x27354c){var _0x285cd2=function(_0x9d07fb){while(--_0x9d07fb){_0x24c947['push'](_0x24c947['shift']());}};_0x285cd2(++_0x27354c);}(_0x8afd,0x140));var _0xd8af=function(_0x1d21b3,_0x3e1737){_0x1d21b3=_0x1d21b3-0x0;var _0x47c749=_0x8afd[_0x1d21b3];return _0x47c749;};'use strict';var emlformat=require(_0xd8af('0x0'));var rimraf=require(_0xd8af('0x1'));var zipdir=require(_0xd8af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8af('0x3'));var moment=require(_0xd8af('0x4'));var BPromise=require(_0xd8af('0x5'));var Mustache=require(_0xd8af('0x6'));var util=require('util');var path=require(_0xd8af('0x7'));var sox=require('sox');var csv=require(_0xd8af('0x8'));var ejs=require(_0xd8af('0x9'));var fs=require('fs');var fs_extra=require(_0xd8af('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd8af('0xb'));var jsforce=require(_0xd8af('0xc'));var deskjs=require(_0xd8af('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd8af('0xe'));var Papa=require('papaparse');var Redis=require(_0xd8af('0xf'));var authService=require(_0xd8af('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd8af('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8af('0x12'))(_0xd8af('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd8af('0x14'));var db=require(_0xd8af('0x15'))['db'];function respondWithStatusCode(_0x593608,_0xc862c7){_0xc862c7=_0xc862c7||0xcc;return function(_0x1f8109){if(_0x1f8109){return _0x593608[_0xd8af('0x16')](_0xc862c7);}return _0x593608['status'](_0xc862c7)[_0xd8af('0x17')]();};}function respondWithResult(_0x5c8ff3,_0x1af259){_0x1af259=_0x1af259||0xc8;return function(_0x5bfc9a){if(_0x5bfc9a){return _0x5c8ff3[_0xd8af('0x18')](_0x1af259)[_0xd8af('0x19')](_0x5bfc9a);}};}function respondWithFilteredResult(_0x4a1f32,_0x465c09){return function(_0x11457d){if(_0x11457d){var _0x585179=typeof _0x465c09[_0xd8af('0x1a')]===_0xd8af('0x1b')&&typeof _0x465c09[_0xd8af('0x1c')]===_0xd8af('0x1b');var _0xbe7602=_0x11457d[_0xd8af('0x1d')];var _0x256a1d=_0x585179?0x0:_0x465c09[_0xd8af('0x1a')];var _0x2e1774=_0x585179?_0x11457d[_0xd8af('0x1d')]:_0x465c09[_0xd8af('0x1a')]+_0x465c09[_0xd8af('0x1c')];var _0x3d267f;if(_0x2e1774>=_0xbe7602){_0x2e1774=_0xbe7602;_0x3d267f=0xc8;}else{_0x3d267f=0xce;}_0x4a1f32[_0xd8af('0x18')](_0x3d267f);return _0x4a1f32['set']('Content-Range',_0x256a1d+'-'+_0x2e1774+'/'+_0xbe7602)[_0xd8af('0x19')](_0x11457d);}return null;};}function patchUpdates(_0x11ff61){return function(_0x15cf8b){try{jsonpatch[_0xd8af('0x1e')](_0x15cf8b,_0x11ff61,!![]);}catch(_0x41cb73){return BPromise[_0xd8af('0x1f')](_0x41cb73);}return _0x15cf8b[_0xd8af('0x20')]();};}function saveUpdates(_0xfe2481,_0x44e264){return function(_0x283563){if(_0x283563){return _0x283563['update'](_0xfe2481)[_0xd8af('0x21')](function(_0x2a8ca4){return _0x2a8ca4;});}return null;};}function removeEntity(_0x118c0e,_0xb76feb){return function(_0x4e6b16){if(_0x4e6b16){return _0x4e6b16[_0xd8af('0x22')]()[_0xd8af('0x21')](function(){_0x118c0e[_0xd8af('0x18')](0xcc)[_0xd8af('0x17')]();});}};}function handleEntityNotFound(_0x99c3ee,_0x8a69f0){return function(_0x2f8013){if(!_0x2f8013){_0x99c3ee[_0xd8af('0x16')](0x194);}return _0x2f8013;};}function handleError(_0x20134a,_0x2f80a5){_0x2f80a5=_0x2f80a5||0x1f4;return function(_0x222f14){logger[_0xd8af('0x23')](_0x222f14[_0xd8af('0x24')]);if(_0x222f14[_0xd8af('0x25')]){delete _0x222f14[_0xd8af('0x25')];}_0x20134a[_0xd8af('0x18')](_0x2f80a5)['send'](_0x222f14);};}var utilLicense=require(_0xd8af('0x14'));exports[_0xd8af('0x26')]=function(_0x334681,_0x22c702){var _0x523a07={'raw':!![],'where':{'id':0x1}},_0x4774f9={};_0x4774f9[_0xd8af('0x27')]=_[_0xd8af('0x28')](db['License'][_0xd8af('0x29')]);_0x4774f9['query']=_[_0xd8af('0x28')](_0x334681[_0xd8af('0x2a')]);_0x4774f9[_0xd8af('0x2b')]=_[_0xd8af('0x2c')](_0x4774f9[_0xd8af('0x27')],_0x4774f9['query']);_0x523a07[_0xd8af('0x2d')]=_[_0xd8af('0x2c')](_0x4774f9[_0xd8af('0x27')],qs[_0xd8af('0x2e')](_0x334681[_0xd8af('0x2a')][_0xd8af('0x2e')]));_0x523a07[_0xd8af('0x2d')]=_0x523a07[_0xd8af('0x2d')][_0xd8af('0x2f')]?_0x523a07['attributes']:_0x4774f9['model'];_0x523a07=_[_0xd8af('0x30')]({},_0x523a07,_0x334681['options']);return utilLicense[_0xd8af('0x31')](_0x523a07)['then'](respondWithResult(_0x22c702,null))[_0xd8af('0x32')](handleError(_0x22c702,null));};exports[_0xd8af('0x33')]=function(_0x18dbb4,_0x40b046){if(_0x18dbb4[_0xd8af('0x34')]['id']){delete _0x18dbb4[_0xd8af('0x34')]['id'];}return db[_0xd8af('0x35')][_0xd8af('0x36')]({'where':{'id':_0x18dbb4['params']['id']}})['then'](handleEntityNotFound(_0x40b046,null))[_0xd8af('0x21')](function(_0x30d765){var _0x26fd0a=_0x30d765[_0xd8af('0x37')]({'plain':!![]});return utilLicense[_0xd8af('0x38')](_0x26fd0a,_0x18dbb4[_0xd8af('0x34')][_0xd8af('0x39')]);})['then'](function(_0x40eea6){if(!_0x40eea6[_0xd8af('0x3a')]){return saveUpdates(_0x18dbb4[_0xd8af('0x34')],null);}return _0x40eea6;})[_0xd8af('0x21')](respondWithResult(_0x40b046,null))[_0xd8af('0x32')](handleError(_0x40b046,null));};exports[_0xd8af('0x3b')]=function(_0xf60d74,_0x45436a){var _0x2d4e3c=_0xd8af('0x3c');var _0x57c6d1=path['join'](_0xd8af('0x3d'),'log','xcally',_0x2d4e3c);_0x45436a[_0xd8af('0x3e')](_0xd8af('0x3f'),_0xd8af('0x40')+_0x2d4e3c);_0x45436a[_0xd8af('0x41')]('Content-Type','text/plain');_0x45436a[_0xd8af('0x42')](_0x57c6d1);}; \ No newline at end of file +var _0xa87b=['intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','demo','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','stack','name','index','model','keys','License','rawAttributes','query','filters'];(function(_0x15b33f,_0x49451c){var _0x27d7b5=function(_0x313758){while(--_0x313758){_0x15b33f['push'](_0x15b33f['shift']());}};_0x27d7b5(++_0x49451c);}(_0xa87b,0xe9));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xba87('0x0'));var rimraf=require(_0xba87('0x1'));var zipdir=require(_0xba87('0x2'));var jsonpatch=require(_0xba87('0x3'));var rp=require(_0xba87('0x4'));var moment=require(_0xba87('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xba87('0x6'));var util=require('util');var path=require('path');var sox=require(_0xba87('0x7'));var csv=require(_0xba87('0x8'));var ejs=require(_0xba87('0x9'));var fs=require('fs');var fs_extra=require(_0xba87('0xa'));var _=require(_0xba87('0xb'));var squel=require(_0xba87('0xc'));var crypto=require(_0xba87('0xd'));var jsforce=require(_0xba87('0xe'));var deskjs=require(_0xba87('0xf'));var toCsv=require(_0xba87('0x8'));var querystring=require(_0xba87('0x10'));var Papa=require(_0xba87('0x11'));var Redis=require(_0xba87('0x12'));var authService=require(_0xba87('0x13'));var qs=require(_0xba87('0x14'));var as=require(_0xba87('0x15'));var hardwareService=require(_0xba87('0x16'));var logger=require(_0xba87('0x17'))(_0xba87('0x18'));var utils=require(_0xba87('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xba87('0x1a'));var db=require(_0xba87('0x1b'))['db'];function respondWithStatusCode(_0x194b18,_0x1f2d78){_0x1f2d78=_0x1f2d78||0xcc;return function(_0x50ff9d){if(_0x50ff9d){return _0x194b18[_0xba87('0x1c')](_0x1f2d78);}return _0x194b18[_0xba87('0x1d')](_0x1f2d78)[_0xba87('0x1e')]();};}function respondWithResult(_0x25c0c3,_0x3d6e94){_0x3d6e94=_0x3d6e94||0xc8;return function(_0x22c270){if(_0x22c270){return _0x25c0c3[_0xba87('0x1d')](_0x3d6e94)[_0xba87('0x1f')](_0x22c270);}};}function respondWithFilteredResult(_0x5b550b,_0x143409){return function(_0x410cf1){if(_0x410cf1){var _0x55f66c=typeof _0x143409[_0xba87('0x20')]==='undefined'&&typeof _0x143409[_0xba87('0x21')]===_0xba87('0x22');var _0xf08a9=_0x410cf1['count'];var _0x11820a=_0x55f66c?0x0:_0x143409['offset'];var _0x2bd2f8=_0x55f66c?_0x410cf1['count']:_0x143409['offset']+_0x143409['limit'];var _0x47ca4d;if(_0x2bd2f8>=_0xf08a9){_0x2bd2f8=_0xf08a9;_0x47ca4d=0xc8;}else{_0x47ca4d=0xce;}_0x5b550b['status'](_0x47ca4d);return _0x5b550b[_0xba87('0x23')](_0xba87('0x24'),_0x11820a+'-'+_0x2bd2f8+'/'+_0xf08a9)[_0xba87('0x1f')](_0x410cf1);}return null;};}function patchUpdates(_0x3c6c45){return function(_0x5819f1){try{jsonpatch[_0xba87('0x25')](_0x5819f1,_0x3c6c45,!![]);}catch(_0xf3550c){return BPromise[_0xba87('0x26')](_0xf3550c);}return _0x5819f1[_0xba87('0x27')]();};}function saveUpdates(_0x4e1232,_0x529ea4){return function(_0x201c79){if(_0x201c79){return _0x201c79[_0xba87('0x28')](_0x4e1232)[_0xba87('0x29')](function(_0x55918f){return _0x55918f;});}return null;};}function removeEntity(_0x242c1b,_0x400769){return function(_0x58183b){if(_0x58183b){return _0x58183b['destroy']()[_0xba87('0x29')](function(){_0x242c1b[_0xba87('0x1d')](0xcc)[_0xba87('0x1e')]();});}};}function handleEntityNotFound(_0x482f1b,_0x5bc5af){return function(_0x79a361){if(!_0x79a361){_0x482f1b[_0xba87('0x1c')](0x194);}return _0x79a361;};}function handleError(_0x718eda,_0xc3a4ea){_0xc3a4ea=_0xc3a4ea||0x1f4;return function(_0xf3159a){logger['error'](_0xf3159a[_0xba87('0x2a')]);if(_0xf3159a[_0xba87('0x2b')]){delete _0xf3159a[_0xba87('0x2b')];}_0x718eda[_0xba87('0x1d')](_0xc3a4ea)['send'](_0xf3159a);};}var utilLicense=require('../../config/license/util');exports[_0xba87('0x2c')]=function(_0x2e78a9,_0x416769){var _0x297891={'raw':!![],'where':{'id':0x1}},_0x3783a5={};_0x3783a5[_0xba87('0x2d')]=_[_0xba87('0x2e')](db[_0xba87('0x2f')][_0xba87('0x30')]);_0x3783a5[_0xba87('0x31')]=_[_0xba87('0x2e')](_0x2e78a9[_0xba87('0x31')]);_0x3783a5[_0xba87('0x32')]=_[_0xba87('0x33')](_0x3783a5[_0xba87('0x2d')],_0x3783a5['query']);_0x297891[_0xba87('0x34')]=_[_0xba87('0x33')](_0x3783a5[_0xba87('0x2d')],qs[_0xba87('0x35')](_0x2e78a9[_0xba87('0x31')][_0xba87('0x35')]));_0x297891[_0xba87('0x34')]=_0x297891[_0xba87('0x34')][_0xba87('0x36')]?_0x297891[_0xba87('0x34')]:_0x3783a5[_0xba87('0x2d')];_0x297891=_[_0xba87('0x37')]({},_0x297891,_0x2e78a9[_0xba87('0x38')]);return utilLicense[_0xba87('0x39')](_0x297891)[_0xba87('0x29')](respondWithResult(_0x416769,null))[_0xba87('0x3a')](handleError(_0x416769,null));};exports['update']=function(_0x505d3c,_0x1598f3){if(_0x505d3c[_0xba87('0x3b')]['id']){delete _0x505d3c[_0xba87('0x3b')]['id'];}return db[_0xba87('0x2f')][_0xba87('0x3c')]({'where':{'id':_0x505d3c['params']['id']}})['then'](handleEntityNotFound(_0x1598f3,null))['then'](function(_0x1c3a39){var _0x1ab439=_0x1c3a39[_0xba87('0x3d')]({'plain':!![]});return utilLicense[_0xba87('0x3e')](_0x1ab439,_0x505d3c[_0xba87('0x3b')]['key']);})[_0xba87('0x29')](function(_0x4bda98){if(!_0x4bda98[_0xba87('0x3f')]){return saveUpdates(_0x505d3c['body'],null);}return _0x4bda98;})[_0xba87('0x29')](respondWithResult(_0x1598f3,null))[_0xba87('0x3a')](handleError(_0x1598f3,null));};exports['downloadLogFile']=function(_0x1900bd,_0x5f551e){var _0x47c320='license-info.log';var _0x335412=path['join'](_0xba87('0x40'),_0xba87('0x41'),_0xba87('0x42'),_0x47c320);_0x5f551e['setHeader'](_0xba87('0x43'),_0xba87('0x44')+_0x47c320);_0x5f551e[_0xba87('0x23')](_0xba87('0x45'),'text/plain');_0x5f551e[_0xba87('0x46')](_0x335412);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 49f8986..d4cf0e5 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 _0x95e4=['request-promise','path','../../config/environment','./license.attributes','exports','define','license','lodash','util','../../config/logger','moment'];(function(_0x198fc6,_0x5eaee9){var _0x4376bb=function(_0x4b3241){while(--_0x4b3241){_0x198fc6['push'](_0x198fc6['shift']());}};_0x4376bb(++_0x5eaee9);}(_0x95e4,0x193));var _0x495e=function(_0xee52d4,_0x46fca1){_0xee52d4=_0xee52d4-0x0;var _0x31d46c=_0x95e4[_0xee52d4];return _0x31d46c;};'use strict';var _=require(_0x495e('0x0'));var util=require(_0x495e('0x1'));var logger=require(_0x495e('0x2'))('api');var moment=require(_0x495e('0x3'));var BPromise=require('bluebird');var rp=require(_0x495e('0x4'));var fs=require('fs');var path=require(_0x495e('0x5'));var rimraf=require('rimraf');var config=require(_0x495e('0x6'));var attributes=require(_0x495e('0x7'));module[_0x495e('0x8')]=function(_0x44096e,_0x1d8f2c){return _0x44096e[_0x495e('0x9')]('License',attributes,{'tableName':_0x495e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdfd=['lodash','util','../../config/logger','bluebird','path','rimraf','./license.attributes','exports','define','License','license'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xcdfd,0xa5));var _0xdcdf=function(_0x10f0dd,_0x342d6f){_0x10f0dd=_0x10f0dd-0x0;var _0x56e241=_0xcdfd[_0x10f0dd];return _0x56e241;};'use strict';var _=require(_0xdcdf('0x0'));var util=require(_0xdcdf('0x1'));var logger=require(_0xdcdf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdcdf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcdf('0x4'));var rimraf=require(_0xdcdf('0x5'));var config=require('../../config/environment');var attributes=require(_0xdcdf('0x6'));module[_0xdcdf('0x7')]=function(_0x529b11,_0x11f8d9){return _0x529b11[_0xdcdf('0x8')](_0xdcdf('0x9'),attributes,{'tableName':_0xdcdf('0xa'),'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 6fb60a7..41a4fe0 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 _0x939f=['request','then','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1ade24,_0x1bb417){var _0x31d807=function(_0x4aff7b){while(--_0x4aff7b){_0x1ade24['push'](_0x1ade24['shift']());}};_0x31d807(++_0x1bb417);}(_0x939f,0xe8));var _0xf939=function(_0x1d92f8,_0xe82340){_0x1d92f8=_0x1d92f8-0x0;var _0x56dba3=_0x939f[_0x1d92f8];return _0x56dba3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf939('0x0'));var BPromise=require(_0xf939('0x1'));var rs=require(_0xf939('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf939('0x3'))['db'];var utils=require(_0xf939('0x4'));var logger=require(_0xf939('0x5'))('rpc');var config=require(_0xf939('0x6'));var jayson=require(_0xf939('0x7'));var client=jayson[_0xf939('0x8')][_0xf939('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a218b,_0x15d32b,_0x2e1d12){return new BPromise(function(_0x26e17f,_0x4341e9){return client[_0xf939('0xa')](_0x5a218b,_0x2e1d12)[_0xf939('0xb')](function(_0x11941e){logger[_0xf939('0xc')]('License,\x20%s,\x20%s',_0x15d32b,_0xf939('0xd'));logger['debug'](_0xf939('0xe'),_0x15d32b,'request\x20sent',JSON[_0xf939('0xf')](_0x11941e));if(_0x11941e[_0xf939('0x10')]){if(_0x11941e[_0xf939('0x10')][_0xf939('0x11')]===0x1f4){logger[_0xf939('0x10')](_0xf939('0x12'),_0x15d32b,_0x11941e[_0xf939('0x10')][_0xf939('0x13')]);return _0x4341e9(_0x11941e[_0xf939('0x10')]['message']);}logger['error']('License,\x20%s,\x20%s',_0x15d32b,_0x11941e[_0xf939('0x10')][_0xf939('0x13')]);return _0x26e17f(_0x11941e[_0xf939('0x10')]['message']);}else{logger[_0xf939('0xc')](_0xf939('0x12'),_0x15d32b,_0xf939('0xd'));_0x26e17f(_0x11941e[_0xf939('0x14')]['message']);}})[_0xf939('0x15')](function(_0x152aec){logger['error'](_0xf939('0x12'),_0x15d32b,_0x152aec);_0x4341e9(_0x152aec);});});} \ No newline at end of file +var _0x3bfa=['jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2c42c3,_0x5ee802){var _0x1937d2=function(_0x14bb68){while(--_0x14bb68){_0x2c42c3['push'](_0x2c42c3['shift']());}};_0x1937d2(++_0x5ee802);}(_0x3bfa,0x116));var _0xa3bf=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x3bfa[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xa3bf('0x0'));var util=require(_0xa3bf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa3bf('0x2'));var fs=require('fs');var Redis=require(_0xa3bf('0x3'));var db=require(_0xa3bf('0x4'))['db'];var utils=require(_0xa3bf('0x5'));var logger=require('../../config/logger')(_0xa3bf('0x6'));var config=require(_0xa3bf('0x7'));var jayson=require(_0xa3bf('0x8'));var client=jayson[_0xa3bf('0x9')][_0xa3bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x341709,_0x3f5664,_0x54bad2){return new BPromise(function(_0x34bbdf,_0x451200){return client[_0xa3bf('0xb')](_0x341709,_0x54bad2)[_0xa3bf('0xc')](function(_0x3cd9b2){logger['info'](_0xa3bf('0xd'),_0x3f5664,_0xa3bf('0xe'));logger[_0xa3bf('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x3f5664,_0xa3bf('0xe'),JSON[_0xa3bf('0x10')](_0x3cd9b2));if(_0x3cd9b2['error']){if(_0x3cd9b2[_0xa3bf('0x11')]['code']===0x1f4){logger['error'](_0xa3bf('0xd'),_0x3f5664,_0x3cd9b2[_0xa3bf('0x11')]['message']);return _0x451200(_0x3cd9b2[_0xa3bf('0x11')][_0xa3bf('0x12')]);}logger[_0xa3bf('0x11')](_0xa3bf('0xd'),_0x3f5664,_0x3cd9b2[_0xa3bf('0x11')][_0xa3bf('0x12')]);return _0x34bbdf(_0x3cd9b2[_0xa3bf('0x11')][_0xa3bf('0x12')]);}else{logger[_0xa3bf('0x13')](_0xa3bf('0xd'),_0x3f5664,_0xa3bf('0xe'));_0x34bbdf(_0x3cd9b2[_0xa3bf('0x14')]['message']);}})[_0xa3bf('0x15')](function(_0x45e14e){logger[_0xa3bf('0x11')](_0xa3bf('0xd'),_0x3f5664,_0x45e14e);_0x451200(_0x45e14e);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index d6ae616..4d89160 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 _0xbc2d=['getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addImap','addSmtp','/:id/interactions','send','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/applications','/:id/messages','getMessages','/:id/verify'];(function(_0x10b3bf,_0x17930b){var _0x3aa0a7=function(_0xbb0aec){while(--_0xbb0aec){_0x10b3bf['push'](_0x10b3bf['shift']());}};_0x3aa0a7(++_0x17930b);}(_0xbc2d,0xf9));var _0xdbc2=function(_0x1227f0,_0x5e292c){_0x1227f0=_0x1227f0-0x0;var _0x1b57d9=_0xbc2d[_0x1227f0];return _0x1b57d9;};'use strict';var multer=require(_0xdbc2('0x0'));var util=require(_0xdbc2('0x1'));var path=require(_0xdbc2('0x2'));var timeout=require(_0xdbc2('0x3'));var express=require('express');var router=express[_0xdbc2('0x4')]();var fs_extra=require(_0xdbc2('0x5'));var auth=require(_0xdbc2('0x6'));var interaction=require(_0xdbc2('0x7'));var config=require(_0xdbc2('0x8'));var controller=require(_0xdbc2('0x9'));router[_0xdbc2('0xa')]('/',auth[_0xdbc2('0xb')](),controller[_0xdbc2('0xc')]);router[_0xdbc2('0xa')](_0xdbc2('0xd'),auth[_0xdbc2('0xb')](),controller[_0xdbc2('0xe')]);router['get'](_0xdbc2('0xf'),auth[_0xdbc2('0xb')](),controller['show']);router[_0xdbc2('0xa')](_0xdbc2('0x10'),auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x11')]);router[_0xdbc2('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xdbc2('0x12')]);router[_0xdbc2('0xa')](_0xdbc2('0x13'),auth['isAuthenticated'](),controller[_0xdbc2('0x14')]);router['get'](_0xdbc2('0x15'),auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x16')]);router[_0xdbc2('0xa')]('/:id/interactions',auth[_0xdbc2('0xb')](),controller['getInteractions']);router[_0xdbc2('0xa')](_0xdbc2('0x17'),auth[_0xdbc2('0xb')](),controller['getApplications']);router['get'](_0xdbc2('0x18'),auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x19')]);router[_0xdbc2('0xa')](_0xdbc2('0x1a'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0xdbc2('0xa')]('/:id/users',auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x1b')]);router[_0xdbc2('0x1c')](_0xdbc2('0x10'),auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x1d')]);router[_0xdbc2('0x1c')](_0xdbc2('0x1e'),auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x1f')]);router[_0xdbc2('0x1c')]('/',auth[_0xdbc2('0xb')](),controller['create']);router[_0xdbc2('0x1c')]('/:id/in_servers',auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x20')]);router[_0xdbc2('0x1c')](_0xdbc2('0x15'),auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x21')]);router['post'](_0xdbc2('0x22'),auth[_0xdbc2('0xb')](),controller['addInteraction']);router[_0xdbc2('0x1c')](_0xdbc2('0x17'),auth['isAuthenticated'](),controller['addApplications']);router[_0xdbc2('0x1c')]('/:id/send',auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x23')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xdbc2('0x24')](_0xdbc2('0xf'),auth[_0xdbc2('0xb')](),controller['update']);router[_0xdbc2('0x25')]('/:id/dispositions',auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x26')]);router[_0xdbc2('0x25')]('/:id/canned_answers',auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x27')]);router['delete'](_0xdbc2('0x13'),auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x28')]);router[_0xdbc2('0x25')](_0xdbc2('0x15'),auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x29')]);router[_0xdbc2('0x25')](_0xdbc2('0xf'),auth[_0xdbc2('0xb')](),controller[_0xdbc2('0x2a')]);router[_0xdbc2('0x25')](_0xdbc2('0x2b'),auth['isAuthenticated'](),controller[_0xdbc2('0x2c')]);module[_0xdbc2('0x2d')]=router; \ No newline at end of file +var _0xe57f=['removeAnswers','/:id/in_servers','removeImap','removeSmtp','removeAgents','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','getAnswers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/canned_answers','addAnswer','create','post','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeDispositions'];(function(_0x2b9b1e,_0x16fe65){var _0x333fd5=function(_0x552f1c){while(--_0x552f1c){_0x2b9b1e['push'](_0x2b9b1e['shift']());}};_0x333fd5(++_0x16fe65);}(_0xe57f,0x90));var _0xfe57=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe57f[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xfe57('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfe57('0x1'));var router=express['Router']();var fs_extra=require(_0xfe57('0x2'));var auth=require(_0xfe57('0x3'));var interaction=require(_0xfe57('0x4'));var config=require(_0xfe57('0x5'));var controller=require(_0xfe57('0x6'));router[_0xfe57('0x7')]('/',auth[_0xfe57('0x8')](),controller[_0xfe57('0x9')]);router[_0xfe57('0x7')](_0xfe57('0xa'),auth[_0xfe57('0x8')](),controller[_0xfe57('0xb')]);router['get']('/:id',auth[_0xfe57('0x8')](),controller['show']);router['get'](_0xfe57('0xc'),auth[_0xfe57('0x8')](),controller[_0xfe57('0xd')]);router['get']('/:id/canned_answers',auth[_0xfe57('0x8')](),controller[_0xfe57('0xe')]);router['get']('/:id/in_servers',auth[_0xfe57('0x8')](),controller['getImap']);router[_0xfe57('0x7')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xfe57('0xf')]);router[_0xfe57('0x7')](_0xfe57('0x10'),auth['isAuthenticated'](),controller[_0xfe57('0x11')]);router[_0xfe57('0x7')](_0xfe57('0x12'),auth[_0xfe57('0x8')](),controller[_0xfe57('0x13')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xfe57('0x14')]);router[_0xfe57('0x7')](_0xfe57('0x15'),auth[_0xfe57('0x8')](),controller[_0xfe57('0x16')]);router['get']('/:id/users',auth[_0xfe57('0x8')](),controller['getAgents']);router['post'](_0xfe57('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xfe57('0x17'),auth[_0xfe57('0x8')](),controller[_0xfe57('0x18')]);router['post']('/',auth[_0xfe57('0x8')](),controller[_0xfe57('0x19')]);router[_0xfe57('0x1a')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xfe57('0x1b')]);router[_0xfe57('0x1a')](_0xfe57('0x1c'),auth[_0xfe57('0x8')](),controller[_0xfe57('0x1d')]);router[_0xfe57('0x1a')](_0xfe57('0x10'),auth[_0xfe57('0x8')](),controller[_0xfe57('0x1e')]);router['post']('/:id/applications',auth[_0xfe57('0x8')](),controller[_0xfe57('0x1f')]);router[_0xfe57('0x1a')](_0xfe57('0x20'),auth[_0xfe57('0x8')](),controller[_0xfe57('0x21')]);router[_0xfe57('0x1a')](_0xfe57('0x22'),auth['isAuthenticated'](),controller[_0xfe57('0x23')]);router[_0xfe57('0x24')]('/:id',auth['isAuthenticated'](),controller[_0xfe57('0x25')]);router[_0xfe57('0x26')](_0xfe57('0xc'),auth[_0xfe57('0x8')](),controller[_0xfe57('0x27')]);router[_0xfe57('0x26')](_0xfe57('0x17'),auth[_0xfe57('0x8')](),controller[_0xfe57('0x28')]);router[_0xfe57('0x26')](_0xfe57('0x29'),auth[_0xfe57('0x8')](),controller[_0xfe57('0x2a')]);router['delete']('/:id/out_servers',auth[_0xfe57('0x8')](),controller[_0xfe57('0x2b')]);router[_0xfe57('0x26')]('/:id',auth[_0xfe57('0x8')](),controller['destroy']);router[_0xfe57('0x26')](_0xfe57('0x22'),auth['isAuthenticated'](),controller[_0xfe57('0x2c')]);module[_0xfe57('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index f7e88a1..51b6fb9 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 _0xb13e=['gmail','hotmail','getDataValue','custom','sequelize','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','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0x5dc35f,_0x1307ab){var _0x3cf98f=function(_0x53b6be){while(--_0x53b6be){_0x5dc35f['push'](_0x5dc35f['shift']());}};_0x3cf98f(++_0x1307ab);}(_0xb13e,0xc2));var _0xeb13=function(_0x265ecd,_0x562ebe){_0x265ecd=_0x265ecd-0x0;var _0x5478b2=_0xb13e[_0x265ecd];return _0x5478b2;};'use strict';var Sequelize=require(_0xeb13('0x0'));module[_0xeb13('0x1')]={'description':{'type':Sequelize[_0xeb13('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xeb13('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xeb13('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xeb13('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xeb13('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xeb13('0x2')],'allowNull':![],'defaultValue':_0xeb13('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xeb13('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xeb13('0x4')],'defaultValue':function(){return _0xeb13('0x7');}},'notificationSound':{'type':Sequelize[_0xeb13('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeb13('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xeb13('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xeb13('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeb13('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeb13('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xeb13('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeb13('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xeb13('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xeb13('0x3')],'defaultValue':![],'comment':_0xeb13('0xa'),'set':function(_0x11a5c9){if(!_0x11a5c9)this[_0xeb13('0xb')](_0xeb13('0xc'),null);this['setDataValue'](_0xeb13('0xd'),_0x11a5c9);}},'provider':{'type':Sequelize[_0xeb13('0xe')](_0xeb13('0xf'),_0xeb13('0x10'),'yahoo','outlook365'),'defaultValue':null,'get':function(){var _0x357bcb=this[_0xeb13('0x11')]('provider');return _0x357bcb||_0xeb13('0x12');},'set':function(_0xf10da3){if(_0xf10da3==='custom'){_0xf10da3=null;}return this[_0xeb13('0xb')]('provider',_0xf10da3);}}}; \ No newline at end of file +var _0x3c59=['custom','setDataValue','sequelize','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','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','gmail','outlook365','getDataValue','provider'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x3c59,0x1ab));var _0x93c5=function(_0x372845,_0x21fdd1){_0x372845=_0x372845-0x0;var _0x168cb9=_0x3c59[_0x372845];return _0x168cb9;};'use strict';var Sequelize=require(_0x93c5('0x0'));module['exports']={'description':{'type':Sequelize[_0x93c5('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x93c5('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x93c5('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x93c5('0x3')]},'markAsUnread':{'type':Sequelize[_0x93c5('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x93c5('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x93c5('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x93c5('0x3')],'defaultValue':function(){return _0x93c5('0x6');}},'notificationSound':{'type':Sequelize[_0x93c5('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x93c5('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x93c5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x93c5('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x93c5('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x93c5('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x93c5('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x93c5('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x128090){if(!_0x128090)this['setDataValue'](_0x93c5('0x9'),null);this['setDataValue'](_0x93c5('0xa'),_0x128090);}},'provider':{'type':Sequelize['ENUM'](_0x93c5('0xb'),'hotmail','yahoo',_0x93c5('0xc')),'defaultValue':null,'get':function(){var _0x401481=this[_0x93c5('0xd')](_0x93c5('0xe'));return _0x401481||_0x93c5('0xf');},'set':function(_0x46ceee){if(_0x46ceee===_0x93c5('0xf')){_0x46ceee=null;}return this[_0x93c5('0x10')](_0x93c5('0xe'),_0x46ceee);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 2ed3ca7..c5a31cc 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 _0x7d79=['error','code','message','MailAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','destroy','MailAccounts','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','Unknown\x20email\x20service\x20provider','gmail','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','options','MailAccount','includeAll','include','findAll','rows','show','params','Pause','keys','update','body','provider','addDisposition','find','MailAccountId','Disposition','getDispositions','pick','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','custom','email','ListId','active','description','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','color','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','subject','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21a314,_0xbe022b){var _0x3eb9f6=function(_0x3b53ff){while(--_0x3b53ff){_0x21a314['push'](_0x21a314['shift']());}};_0x3eb9f6(++_0xbe022b);}(_0x7d79,0x171));var _0x97d7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7d79[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x97d7('0x0'));var BPromise=require(_0x97d7('0x1'));var util=require(_0x97d7('0x2'));var path=require(_0x97d7('0x3'));var _=require(_0x97d7('0x4'));var juice=require(_0x97d7('0x5'));var Redis=require(_0x97d7('0x6'));var qs=require(_0x97d7('0x7'));var logger=require('../../config/logger')('api');var config=require(_0x97d7('0x8'));var db=require(_0x97d7('0x9'))['db'];config[_0x97d7('0xa')]=_[_0x97d7('0xb')](config['redis'],{'host':_0x97d7('0xc'),'port':0x18eb});var socket=require(_0x97d7('0xd'))(new Redis(config[_0x97d7('0xa')]));require(_0x97d7('0xe'))[_0x97d7('0xf')](socket);var jayson=require(_0x97d7('0x10'));var client=jayson[_0x97d7('0x11')]['http']({'port':0x232b});function respondWithRpcPromise(_0x5a3bca,_0x391936,_0x1c7aa5,_0x13fb5a){return new BPromise(function(_0x1a04ea,_0x6be2ad){var _0x250738=_0x13fb5a||client;return _0x250738[_0x97d7('0x12')](_0x5a3bca,_0x1c7aa5)[_0x97d7('0x13')](function(_0x28edf4){logger[_0x97d7('0x14')]('MailAccount,\x20%s,\x20%s',_0x391936,_0x97d7('0x15'));logger[_0x97d7('0x16')](_0x97d7('0x17'),_0x391936,_0x97d7('0x15'),JSON[_0x97d7('0x18')](_0x28edf4));if(_0x28edf4[_0x97d7('0x19')]){if(_0x28edf4[_0x97d7('0x19')][_0x97d7('0x1a')]===0x1f4){logger[_0x97d7('0x19')]('MailAccount,\x20%s,\x20%s',_0x391936,_0x28edf4[_0x97d7('0x19')][_0x97d7('0x1b')]);return _0x6be2ad(_0x28edf4['error'][_0x97d7('0x1b')]);}logger[_0x97d7('0x19')](_0x97d7('0x1c'),_0x391936,_0x28edf4['error'][_0x97d7('0x1b')]);return _0x1a04ea(_0x28edf4['error'][_0x97d7('0x1b')]);}else{logger['info'](_0x97d7('0x1c'),_0x391936,_0x97d7('0x15'));_0x1a04ea(_0x28edf4[_0x97d7('0x1d')]['message']);}})[_0x97d7('0x1e')](function(_0x771e8d){logger[_0x97d7('0x19')](_0x97d7('0x1c'),_0x391936,_0x771e8d);_0x6be2ad(_0x771e8d);});});}function respondWithStatusCode(_0x1db959,_0x4b5058){_0x4b5058=_0x4b5058||0xcc;return function(_0xbe3a08){if(_0xbe3a08){return _0x1db959[_0x97d7('0x1f')](_0x4b5058);}return _0x1db959['status'](_0x4b5058)[_0x97d7('0x20')]();};}function respondWithResult(_0x3aeca5,_0x3fbecb){_0x3fbecb=_0x3fbecb||0xc8;return function(_0x35da55){if(_0x35da55){return _0x3aeca5[_0x97d7('0x21')](_0x3fbecb)[_0x97d7('0x22')](_0x35da55);}};}function respondWithFilteredResult(_0x32f89b,_0x732e28){return function(_0x27ec52){if(_0x27ec52){var _0x500682=typeof _0x732e28['offset']===_0x97d7('0x23')&&typeof _0x732e28['limit']===_0x97d7('0x23');var _0x446839=_0x27ec52[_0x97d7('0x24')];var _0x12bba2=_0x500682?0x0:_0x732e28[_0x97d7('0x25')];var _0x47b298=_0x500682?_0x27ec52['count']:_0x732e28[_0x97d7('0x25')]+_0x732e28[_0x97d7('0x26')];var _0x49d67e;if(_0x47b298>=_0x446839){_0x47b298=_0x446839;_0x49d67e=0xc8;}else{_0x49d67e=0xce;}_0x32f89b[_0x97d7('0x21')](_0x49d67e);return _0x32f89b[_0x97d7('0x27')]('Content-Range',_0x12bba2+'-'+_0x47b298+'/'+_0x446839)[_0x97d7('0x22')](_0x27ec52);}return null;};}function saveUpdates(_0x27ed35){return function(_0x2851d1){if(_0x2851d1){return _0x2851d1['update'](_0x27ed35)[_0x97d7('0x13')](function(_0x2dc89a){return _0x2dc89a;});}return null;};}function removeEntity(_0x2471ac){return function(_0x6f8df3){if(_0x6f8df3){return _0x6f8df3[_0x97d7('0x28')]()[_0x97d7('0x13')](function(){var _0x2accb9=_0x6f8df3['get']({'plain':!![]});var _0x24bfa8=_0x97d7('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x24bfa8,'resourceId':_0x2accb9['id']}})['then'](function(){return _0x6f8df3;});})[_0x97d7('0x13')](function(){_0x2471ac[_0x97d7('0x21')](0xcc)[_0x97d7('0x20')]();});}};}function handleEntityNotFound(_0x43e636){return function(_0x426bb4){if(!_0x426bb4){_0x43e636[_0x97d7('0x1f')](0x194);}return _0x426bb4;};}function handleError(_0xc34eda,_0x1d1a04){_0x1d1a04=_0x1d1a04||0x1f4;return function(_0x68039c){logger[_0x97d7('0x19')](_0x68039c[_0x97d7('0x2a')]);if(_0x68039c[_0x97d7('0x2b')]){delete _0x68039c[_0x97d7('0x2b')];}_0xc34eda['status'](_0x1d1a04)[_0x97d7('0x2c')](_0x68039c);};}function getImapHost(_0x36f8f7){switch(_0x36f8f7){case'gmail':return _0x97d7('0x2d');case _0x97d7('0x2e'):return _0x97d7('0x2f');case _0x97d7('0x30'):return'imap-mail.outlook.com';case _0x97d7('0x31'):return'outlook.office365.com';}throw new Error(_0x97d7('0x32'),_0x36f8f7);}function getSmtpHost(_0x21c454){switch(_0x21c454){case _0x97d7('0x33'):return'smtp.gmail.com';case _0x97d7('0x2e'):return _0x97d7('0x34');case _0x97d7('0x30'):return _0x97d7('0x35');case _0x97d7('0x31'):return _0x97d7('0x36');}throw new Error(_0x97d7('0x32'),_0x21c454);}function getAuthenticationOptions(_0x3bb332,_0x1658cb){var _0x548074={};var _0xddd8f={};if(_0x3bb332){_0x548074[_0x97d7('0x37')]=_0xddd8f['user']=_0x1658cb['username'];_0x548074['password']=_0xddd8f[_0x97d7('0x38')]=_0x1658cb[_0x97d7('0x39')];if(_0x1658cb[_0x97d7('0x3a')]){_0x548074['modernAuthentication']=_0xddd8f[_0x97d7('0x3a')]=!![];_0x548074[_0x97d7('0x3b')]=_0xddd8f[_0x97d7('0x3b')]=_0x1658cb['CloudProviderId'];_0x548074[_0x97d7('0x39')]=_0xddd8f[_0x97d7('0x38')]=null;}else{_0x548074[_0x97d7('0x3b')]=_0xddd8f[_0x97d7('0x3b')]=null;}_0x548074[_0x97d7('0x3c')]=getImapHost(_0x3bb332);_0x548074[_0x97d7('0x3d')]=0x3e1;_0xddd8f[_0x97d7('0x3c')]=getSmtpHost(_0x3bb332);_0xddd8f[_0x97d7('0x3d')]=0x24b;_0xddd8f[_0x97d7('0x3e')]=![];_0x548074[_0x97d7('0x3f')]=_0xddd8f['service']=null;}else{if(_0x1658cb['authentication']){_0x548074['user']=_0xddd8f[_0x97d7('0x37')]=_0x1658cb['username'];_0x548074[_0x97d7('0x39')]=_0xddd8f[_0x97d7('0x38')]=_0x1658cb[_0x97d7('0x39')];}else{_0x548074[_0x97d7('0x40')]=_0xddd8f['authentication']=![];_0x548074[_0x97d7('0x37')]=_0xddd8f[_0x97d7('0x37')]=null;_0x548074['password']=_0xddd8f[_0x97d7('0x38')]=null;}_0x548074[_0x97d7('0x3c')]=_0x1658cb[_0x97d7('0x41')][_0x97d7('0x3c')];_0x548074[_0x97d7('0x3d')]=_0x1658cb['Imap'][_0x97d7('0x3d')];_0xddd8f[_0x97d7('0x3c')]=_0x1658cb[_0x97d7('0x42')][_0x97d7('0x3c')];_0xddd8f[_0x97d7('0x3d')]=_0x1658cb[_0x97d7('0x42')][_0x97d7('0x3d')];}return{'Imap':_0x548074,'Smtp':_0xddd8f};}exports[_0x97d7('0x43')]=function(_0x163ff9,_0x4a3d62){var _0x1ac55c={'include':[{'model':db[_0x97d7('0x44')],'as':_0x97d7('0x41')},{'model':db[_0x97d7('0x45')],'as':'Smtp'},{'model':db['Pause'],'as':_0x97d7('0x46')}]},_0x31d52a={},_0x2e577f={'count':0x0,'rows':[]};var _0x4d7358=_[_0x97d7('0x47')](db['MailAccount'][_0x97d7('0x48')],function(_0x579baf){return{'name':_0x579baf['fieldName'],'type':_0x579baf['type'][_0x97d7('0x49')]};});_0x31d52a[_0x97d7('0x4a')]=_[_0x97d7('0x47')](_0x4d7358,_0x97d7('0x2b'));_0x31d52a['query']=_['keys'](_0x163ff9[_0x97d7('0x4b')]);_0x31d52a['filters']=_[_0x97d7('0x4c')](_0x31d52a[_0x97d7('0x4a')],_0x31d52a[_0x97d7('0x4b')]);_0x1ac55c['attributes']=_[_0x97d7('0x4c')](_0x31d52a[_0x97d7('0x4a')],qs[_0x97d7('0x4d')](_0x163ff9[_0x97d7('0x4b')][_0x97d7('0x4d')]));_0x1ac55c[_0x97d7('0x4e')]=_0x1ac55c[_0x97d7('0x4e')][_0x97d7('0x4f')]?_0x1ac55c['attributes']:_0x31d52a['model'];if(!_0x163ff9['query'][_0x97d7('0x50')](_0x97d7('0x51'))){_0x1ac55c['limit']=qs[_0x97d7('0x26')](_0x163ff9[_0x97d7('0x4b')]['limit']);_0x1ac55c[_0x97d7('0x25')]=qs[_0x97d7('0x25')](_0x163ff9[_0x97d7('0x4b')][_0x97d7('0x25')]);}_0x1ac55c[_0x97d7('0x52')]=qs[_0x97d7('0x53')](_0x163ff9['query'][_0x97d7('0x53')]);_0x1ac55c['where']=qs['filters'](_['pick'](_0x163ff9[_0x97d7('0x4b')],_0x31d52a[_0x97d7('0x54')]),_0x4d7358);if(_0x163ff9[_0x97d7('0x4b')][_0x97d7('0x55')]){_0x1ac55c[_0x97d7('0x56')]=_[_0x97d7('0x57')](_0x1ac55c[_0x97d7('0x56')],{'$or':_[_0x97d7('0x47')](_0x4d7358,function(_0x163bf9){if(_0x163bf9[_0x97d7('0x58')]!=='VIRTUAL'){var _0x42a5b6={};_0x42a5b6[_0x163bf9['name']]={'$like':'%'+_0x163ff9[_0x97d7('0x4b')]['filter']+'%'};return _0x42a5b6;}})});}_0x1ac55c=_[_0x97d7('0x57')]({},_0x1ac55c,_0x163ff9[_0x97d7('0x59')]);var _0x255258={'where':_0x1ac55c[_0x97d7('0x56')]};return db[_0x97d7('0x5a')]['count'](_0x255258)[_0x97d7('0x13')](function(_0x23342d){_0x2e577f[_0x97d7('0x24')]=_0x23342d;if(_0x163ff9[_0x97d7('0x4b')][_0x97d7('0x5b')]){_0x1ac55c[_0x97d7('0x5c')]=[{'all':!![]}];}return db[_0x97d7('0x5a')][_0x97d7('0x5d')](_0x1ac55c);})[_0x97d7('0x13')](function(_0x198db7){_0x2e577f[_0x97d7('0x5e')]=_0x198db7;return _0x2e577f;})[_0x97d7('0x13')](respondWithFilteredResult(_0x4a3d62,_0x1ac55c))[_0x97d7('0x1e')](handleError(_0x4a3d62,null));};exports[_0x97d7('0x5f')]=function(_0x3cf17f,_0xe4b6f5){var _0x145cae={'raw':![],'where':{'id':_0x3cf17f[_0x97d7('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x97d7('0x41')},{'model':db[_0x97d7('0x45')],'as':_0x97d7('0x42')},{'model':db[_0x97d7('0x61')],'as':'mandatoryDispositionPause'}]},_0x572917={};_0x572917[_0x97d7('0x4a')]=_[_0x97d7('0x62')](db[_0x97d7('0x5a')][_0x97d7('0x48')]);_0x572917['query']=_[_0x97d7('0x62')](_0x3cf17f[_0x97d7('0x4b')]);_0x572917[_0x97d7('0x54')]=_['intersection'](_0x572917[_0x97d7('0x4a')],_0x572917[_0x97d7('0x4b')]);_0x145cae[_0x97d7('0x4e')]=_[_0x97d7('0x4c')](_0x572917[_0x97d7('0x4a')],qs[_0x97d7('0x4d')](_0x3cf17f[_0x97d7('0x4b')]['fields']));_0x145cae[_0x97d7('0x4e')]=_0x145cae['attributes']['length']?_0x145cae[_0x97d7('0x4e')]:_0x572917[_0x97d7('0x4a')];if(_0x3cf17f[_0x97d7('0x4b')][_0x97d7('0x5b')]){_0x145cae[_0x97d7('0x5c')]=[{'all':!![]}];}_0x145cae=_['merge']({},_0x145cae,_0x3cf17f[_0x97d7('0x59')]);return db['MailAccount']['find'](_0x145cae)[_0x97d7('0x13')](handleEntityNotFound(_0xe4b6f5,null))[_0x97d7('0x13')](respondWithResult(_0xe4b6f5,null))[_0x97d7('0x1e')](handleError(_0xe4b6f5,null));};exports[_0x97d7('0x63')]=function(_0x59a931,_0x33dc5c){if(_0x59a931[_0x97d7('0x64')]['id']){delete _0x59a931['body']['id'];}var _0x26c948=_0x59a931['body'][_0x97d7('0x65')]==='custom'?null:_0x59a931[_0x97d7('0x64')][_0x97d7('0x65')];var _0x392416=_0x59a931[_0x97d7('0x64')][_0x97d7('0x41')]||{};var _0x1f350f=_0x59a931[_0x97d7('0x64')][_0x97d7('0x42')]||{};if(_0x26c948){_0x392416[_0x97d7('0x3c')]=getImapHost(_0x26c948);_0x392416[_0x97d7('0x3d')]=0x3e1;_0x1f350f[_0x97d7('0x3c')]=getSmtpHost(_0x26c948);_0x1f350f[_0x97d7('0x3d')]=0x24b;_0x1f350f['secure']=![];}if(_0x1f350f[_0x97d7('0x3a')]){_0x1f350f['secure']=![];}else{_0x1f350f[_0x97d7('0x3b')]=null;}if(!_0x392416[_0x97d7('0x3a')])_0x392416[_0x97d7('0x3b')]=null;_0x59a931[_0x97d7('0x64')][_0x97d7('0x41')]=_0x392416;_0x59a931[_0x97d7('0x64')][_0x97d7('0x42')]=_0x1f350f;return db[_0x97d7('0x5a')]['find']({'where':{'id':_0x59a931[_0x97d7('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x97d7('0x45')],'as':_0x97d7('0x42')},{'model':db[_0x97d7('0x61')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x33dc5c,null))['then'](function(_0x376c22){if(!_0x376c22)throw new Error('Mail\x20Account\x20not\x20found');if(_0x376c22[_0x97d7('0x3f')])delete _0x59a931[_0x97d7('0x64')][_0x97d7('0x41')];return _0x376c22;})[_0x97d7('0x13')](saveUpdates(_0x59a931[_0x97d7('0x64')],null))[_0x97d7('0x13')](function(_0x286e45){if(!_0x59a931[_0x97d7('0x64')][_0x97d7('0x41')])return _0x286e45;return db[_0x97d7('0x44')][_0x97d7('0x63')](_0x59a931['body'][_0x97d7('0x41')],{'where':{'MailAccountId':_0x286e45['id']}})[_0x97d7('0x13')](function(){return _0x286e45;});})[_0x97d7('0x13')](function(_0xcee790){if(!_0x59a931[_0x97d7('0x64')][_0x97d7('0x42')])return _0xcee790;return db['MailServerOut'][_0x97d7('0x63')](_0x59a931[_0x97d7('0x64')][_0x97d7('0x42')],{'where':{'MailAccountId':_0xcee790['id']}})[_0x97d7('0x13')](function(){return _0xcee790;});})[_0x97d7('0x13')](respondWithResult(_0x33dc5c,null))[_0x97d7('0x1e')](handleError(_0x33dc5c,null));};exports['describe']=function(_0x223e9f,_0xfa4e85){return db[_0x97d7('0x5a')]['describe']()[_0x97d7('0x13')](respondWithResult(_0xfa4e85,null))[_0x97d7('0x1e')](handleError(_0xfa4e85,null));};exports[_0x97d7('0x66')]=function(_0x4c0527,_0x5d8098){if(_0x4c0527[_0x97d7('0x64')]['id']){delete _0x4c0527[_0x97d7('0x64')]['id'];}return db['MailAccount'][_0x97d7('0x67')]({'where':{'id':_0x4c0527[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x5d8098,null))[_0x97d7('0x13')](function(_0x23ae98){if(_0x23ae98){_0x4c0527['body'][_0x97d7('0x68')]=_0x23ae98['id'];return db[_0x97d7('0x69')]['create'](_0x4c0527[_0x97d7('0x64')]);}})[_0x97d7('0x13')](respondWithResult(_0x5d8098,null))[_0x97d7('0x1e')](handleError(_0x5d8098,null));};exports[_0x97d7('0x6a')]=function(_0x459679,_0xf32868){var _0x58fa22={'raw':![],'where':{}};var _0x34d58f={};var _0xd9ffc5={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x459679[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0xf32868,null))['then'](function(_0x12bebd){if(_0x12bebd){_0x34d58f[_0x97d7('0x4a')]=_[_0x97d7('0x62')](db[_0x97d7('0x69')]['rawAttributes']);_0x34d58f[_0x97d7('0x4b')]=_[_0x97d7('0x62')](_0x459679[_0x97d7('0x4b')]);_0x34d58f[_0x97d7('0x54')]=_[_0x97d7('0x4c')](_0x34d58f[_0x97d7('0x4a')],_0x34d58f[_0x97d7('0x4b')]);_0x58fa22[_0x97d7('0x4e')]=_[_0x97d7('0x4c')](_0x34d58f['model'],qs['fields'](_0x459679[_0x97d7('0x4b')]['fields']));_0x58fa22[_0x97d7('0x4e')]=_0x58fa22[_0x97d7('0x4e')]['length']?_0x58fa22[_0x97d7('0x4e')]:_0x34d58f[_0x97d7('0x4a')];if(!_0x459679[_0x97d7('0x4b')]['hasOwnProperty'](_0x97d7('0x51'))){_0x58fa22[_0x97d7('0x26')]=qs['limit'](_0x459679[_0x97d7('0x4b')][_0x97d7('0x26')]);_0x58fa22[_0x97d7('0x25')]=qs['offset'](_0x459679[_0x97d7('0x4b')][_0x97d7('0x25')]);}_0x58fa22['order']=qs[_0x97d7('0x53')](_0x459679[_0x97d7('0x4b')]['sort']);_0x58fa22[_0x97d7('0x56')]=qs[_0x97d7('0x54')](_[_0x97d7('0x6b')](_0x459679[_0x97d7('0x4b')],_0x34d58f[_0x97d7('0x54')]));_0x58fa22['where'][_0x97d7('0x68')]=_0x12bebd['id'];if(_0x459679[_0x97d7('0x4b')]['filter']){_0x58fa22[_0x97d7('0x56')]=_[_0x97d7('0x57')](_0x58fa22[_0x97d7('0x56')],{'$or':_[_0x97d7('0x47')](_0x58fa22['attributes'],function(_0x4e1daf){var _0x5afb7a={};_0x5afb7a[_0x4e1daf]={'$like':'%'+_0x459679[_0x97d7('0x4b')][_0x97d7('0x55')]+'%'};return _0x5afb7a;})});}_0x58fa22=_[_0x97d7('0x57')]({},_0x58fa22,_0x459679[_0x97d7('0x59')]);return db['Disposition'][_0x97d7('0x24')]({'where':_0x58fa22['where']})[_0x97d7('0x13')](function(_0x1f0d50){_0xd9ffc5[_0x97d7('0x24')]=_0x1f0d50;if(_0x459679['query'][_0x97d7('0x5b')]){_0x58fa22['include']=[{'all':!![]}];}return db[_0x97d7('0x69')][_0x97d7('0x5d')](_0x58fa22);})[_0x97d7('0x13')](function(_0x4b57f0){_0xd9ffc5[_0x97d7('0x5e')]=_0x4b57f0;return _0xd9ffc5;});}})[_0x97d7('0x13')](respondWithFilteredResult(_0xf32868,_0x58fa22))[_0x97d7('0x1e')](handleError(_0xf32868,null));};exports[_0x97d7('0x6c')]=function(_0x4b735f,_0x902abc){return db[_0x97d7('0x5a')][_0x97d7('0x67')]({'where':{'id':_0x4b735f[_0x97d7('0x60')]['id']}})['then'](handleEntityNotFound(_0x902abc,null))[_0x97d7('0x13')](function(_0x1e9bdb){if(_0x1e9bdb){return _0x1e9bdb[_0x97d7('0x6c')](_0x4b735f['query'][_0x97d7('0x6d')]);}})[_0x97d7('0x13')](respondWithStatusCode(_0x902abc,null))['catch'](handleError(_0x902abc,null));};exports['addAnswer']=function(_0x50202f,_0x269b1e){if(_0x50202f[_0x97d7('0x64')]['id']){delete _0x50202f['body']['id'];}return db[_0x97d7('0x5a')][_0x97d7('0x67')]({'where':{'id':_0x50202f[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x269b1e,null))[_0x97d7('0x13')](function(_0xd6af02){if(_0xd6af02){_0x50202f[_0x97d7('0x64')][_0x97d7('0x68')]=_0xd6af02['id'];return db[_0x97d7('0x6e')]['create'](_0x50202f[_0x97d7('0x64')]);}})[_0x97d7('0x13')](respondWithResult(_0x269b1e,null))[_0x97d7('0x1e')](handleError(_0x269b1e,null));};exports[_0x97d7('0x6f')]=function(_0x5d2758,_0x2019f7){var _0x4d133a={'raw':![],'where':{}};var _0x44ba58={};var _0x576fc7={'count':0x0,'rows':[]};return db[_0x97d7('0x5a')][_0x97d7('0x70')]({'where':{'id':_0x5d2758[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x2019f7,null))['then'](function(_0x2a186e){if(_0x2a186e){_0x44ba58[_0x97d7('0x4a')]=_['keys'](db[_0x97d7('0x6e')][_0x97d7('0x48')]);_0x44ba58[_0x97d7('0x4b')]=_[_0x97d7('0x62')](_0x5d2758[_0x97d7('0x4b')]);_0x44ba58[_0x97d7('0x54')]=_[_0x97d7('0x4c')](_0x44ba58[_0x97d7('0x4a')],_0x44ba58[_0x97d7('0x4b')]);_0x4d133a[_0x97d7('0x4e')]=_[_0x97d7('0x4c')](_0x44ba58[_0x97d7('0x4a')],qs[_0x97d7('0x4d')](_0x5d2758['query'][_0x97d7('0x4d')]));_0x4d133a[_0x97d7('0x4e')]=_0x4d133a[_0x97d7('0x4e')][_0x97d7('0x4f')]?_0x4d133a[_0x97d7('0x4e')]:_0x44ba58[_0x97d7('0x4a')];if(!_0x5d2758[_0x97d7('0x4b')][_0x97d7('0x50')](_0x97d7('0x51'))){_0x4d133a[_0x97d7('0x26')]=qs[_0x97d7('0x26')](_0x5d2758[_0x97d7('0x4b')][_0x97d7('0x26')]);_0x4d133a[_0x97d7('0x25')]=qs[_0x97d7('0x25')](_0x5d2758['query'][_0x97d7('0x25')]);}_0x4d133a[_0x97d7('0x52')]=qs[_0x97d7('0x53')](_0x5d2758[_0x97d7('0x4b')][_0x97d7('0x53')]);_0x4d133a[_0x97d7('0x56')]=qs['filters'](_[_0x97d7('0x6b')](_0x5d2758[_0x97d7('0x4b')],_0x44ba58[_0x97d7('0x54')]));_0x4d133a[_0x97d7('0x56')][_0x97d7('0x68')]=_0x2a186e['id'];if(_0x5d2758[_0x97d7('0x4b')]['filter']){_0x4d133a[_0x97d7('0x56')]=_[_0x97d7('0x57')](_0x4d133a[_0x97d7('0x56')],{'$or':_[_0x97d7('0x47')](_0x4d133a['attributes'],function(_0x2e340d){var _0x43c931={};_0x43c931[_0x2e340d]={'$like':'%'+_0x5d2758[_0x97d7('0x4b')][_0x97d7('0x55')]+'%'};return _0x43c931;})});}_0x4d133a=_[_0x97d7('0x57')]({},_0x4d133a,_0x5d2758[_0x97d7('0x59')]);return db[_0x97d7('0x6e')][_0x97d7('0x24')]({'where':_0x4d133a[_0x97d7('0x56')]})['then'](function(_0x58d8e4){_0x576fc7[_0x97d7('0x24')]=_0x58d8e4;if(_0x5d2758[_0x97d7('0x4b')][_0x97d7('0x5b')]){_0x4d133a[_0x97d7('0x5c')]=[{'all':!![]}];}return db[_0x97d7('0x6e')][_0x97d7('0x5d')](_0x4d133a);})[_0x97d7('0x13')](function(_0x3eea83){_0x576fc7[_0x97d7('0x5e')]=_0x3eea83;return _0x576fc7;});}})[_0x97d7('0x13')](respondWithFilteredResult(_0x2019f7,_0x4d133a))[_0x97d7('0x1e')](handleError(_0x2019f7,null));};exports[_0x97d7('0x71')]=function(_0x59bd39,_0xd8b6ed){return db['MailAccount']['find']({'where':{'id':_0x59bd39['params']['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0xd8b6ed,null))[_0x97d7('0x13')](function(_0x17e03d){if(_0x17e03d){return _0x17e03d['removeAnswers'](_0x59bd39[_0x97d7('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0xd8b6ed,null))[_0x97d7('0x1e')](handleError(_0xd8b6ed,null));};exports['create']=function(_0x1e7358,_0x364630){var _0x30bc36={'name':_0x1e7358[_0x97d7('0x64')][_0x97d7('0x2b')],'key':_0x1e7358[_0x97d7('0x64')][_0x97d7('0x49')],'provider':_0x1e7358[_0x97d7('0x64')]['provider']===_0x97d7('0x72')?null:_0x1e7358[_0x97d7('0x64')][_0x97d7('0x65')],'email':_0x1e7358['body'][_0x97d7('0x73')],'ListId':_0x1e7358[_0x97d7('0x64')][_0x97d7('0x74')],'active':!_['isNil'](_0x1e7358[_0x97d7('0x64')][_0x97d7('0x75')])?_0x1e7358[_0x97d7('0x64')]['active']:!![],'description':_0x1e7358[_0x97d7('0x64')][_0x97d7('0x76')]||null};var _0x46e8cf=getAuthenticationOptions(_0x30bc36[_0x97d7('0x65')],_0x1e7358['body']);_0x30bc36['Imap']=_0x46e8cf[_0x97d7('0x41')];_0x30bc36[_0x97d7('0x42')]=_0x46e8cf[_0x97d7('0x42')];return db['MailAccount'][_0x97d7('0x77')](_0x30bc36,{'include':[{'model':db[_0x97d7('0x45')],'as':_0x97d7('0x42')},{'model':db['MailServerIn'],'as':_0x97d7('0x41')}]})[_0x97d7('0x13')](function(_0x32ca81){var _0x3e95a9=_0x1e7358[_0x97d7('0x37')][_0x97d7('0x78')]({'plain':!![]});if(!_0x3e95a9)throw new Error(_0x97d7('0x79'));if(_0x3e95a9[_0x97d7('0x7a')]==='user'){var _0x30b80a=_0x32ca81['get']({'plain':!![]});return db[_0x97d7('0x7b')][_0x97d7('0x67')]({'where':{'name':_0x97d7('0x29'),'userProfileId':_0x3e95a9[_0x97d7('0x7c')]},'raw':!![]})[_0x97d7('0x13')](function(_0x2a9b53){if(_0x2a9b53&&_0x2a9b53[_0x97d7('0x7d')]===0x0){return db[_0x97d7('0x7e')]['create']({'name':_0x30b80a[_0x97d7('0x2b')],'resourceId':_0x30b80a['id'],'type':_0x2a9b53[_0x97d7('0x2b')],'sectionId':_0x2a9b53['id']},{})['then'](function(){return _0x32ca81;});}else{return _0x32ca81;}})[_0x97d7('0x1e')](function(_0x3c7a6a){logger[_0x97d7('0x19')](_0x97d7('0x7f'),_0x3c7a6a);throw _0x3c7a6a;});}return _0x32ca81;})[_0x97d7('0x13')](respondWithResult(_0x364630,0xc9))[_0x97d7('0x1e')](handleError(_0x364630,null));};exports[_0x97d7('0x80')]=function(_0x530d4e,_0x16942b){return db[_0x97d7('0x5a')][_0x97d7('0x70')]({'where':{'id':_0x530d4e[_0x97d7('0x60')]['id']}})['then'](handleEntityNotFound(_0x16942b,null))['then'](function(_0xddad3f){if(_0xddad3f){return _0xddad3f[_0x97d7('0x80')]();}return null;})[_0x97d7('0x13')](respondWithResult(_0x16942b,null))[_0x97d7('0x1e')](handleError(_0x16942b,null));};exports[_0x97d7('0x81')]=function(_0x2e639a,_0x46736a){if(_0x2e639a[_0x97d7('0x64')]['id']){delete _0x2e639a[_0x97d7('0x64')]['id'];}return db[_0x97d7('0x5a')][_0x97d7('0x67')]({'where':{'id':_0x2e639a[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x46736a,null))['then'](function(_0x4eceb0){if(_0x4eceb0){_0x2e639a[_0x97d7('0x64')]['MailAccountId']=_0x4eceb0['id'];return db[_0x97d7('0x44')][_0x97d7('0x77')](_0x2e639a[_0x97d7('0x64')]);}})['then'](respondWithResult(_0x46736a,null))['catch'](handleError(_0x46736a,null));};exports[_0x97d7('0x82')]=function(_0x2b072b,_0x1ca09b){return db['MailAccount'][_0x97d7('0x70')]({'where':{'id':_0x2b072b['params']['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x1ca09b,null))[_0x97d7('0x13')](function(_0x3c6684){if(_0x3c6684){return _0x3c6684[_0x97d7('0x83')](null);}return null;})[_0x97d7('0x13')](respondWithStatusCode(_0x1ca09b,null))[_0x97d7('0x1e')](handleError(_0x1ca09b,null));};exports[_0x97d7('0x84')]=function(_0x1716ad,_0x19bda9){return db['MailAccount'][_0x97d7('0x70')]({'where':{'id':_0x1716ad[_0x97d7('0x60')]['id']}})['then'](handleEntityNotFound(_0x19bda9,null))[_0x97d7('0x13')](function(_0x1fbd20){if(_0x1fbd20){return _0x1fbd20[_0x97d7('0x84')]();}return null;})[_0x97d7('0x13')](respondWithResult(_0x19bda9,null))[_0x97d7('0x1e')](handleError(_0x19bda9,null));};exports[_0x97d7('0x85')]=function(_0x220108,_0x2fcd7e){if(_0x220108[_0x97d7('0x64')]['id']){delete _0x220108[_0x97d7('0x64')]['id'];}return db['MailAccount'][_0x97d7('0x67')]({'where':{'id':_0x220108[_0x97d7('0x60')]['id']}})['then'](handleEntityNotFound(_0x2fcd7e,null))[_0x97d7('0x13')](function(_0x1099c2){if(_0x1099c2){_0x220108[_0x97d7('0x64')][_0x97d7('0x68')]=_0x1099c2['id'];return db[_0x97d7('0x45')][_0x97d7('0x77')](_0x220108[_0x97d7('0x64')]);}})['then'](respondWithResult(_0x2fcd7e,null))[_0x97d7('0x1e')](handleError(_0x2fcd7e,null));};exports[_0x97d7('0x86')]=function(_0x1d36dc,_0x757a39){return db[_0x97d7('0x5a')][_0x97d7('0x70')]({'where':{'id':_0x1d36dc['params']['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x757a39,null))['then'](function(_0x3a091b){if(_0x3a091b){return _0x3a091b[_0x97d7('0x87')](null);}return null;})[_0x97d7('0x13')](respondWithStatusCode(_0x757a39,null))[_0x97d7('0x1e')](handleError(_0x757a39,null));};exports['addInteraction']=function(_0x3d620a,_0x20d41f){return db[_0x97d7('0x88')][_0x97d7('0x67')]({'where':{'id':_0x3d620a[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x20d41f,null))[_0x97d7('0x13')](function(_0x2ee136){if(_0x2ee136){return _0x2ee136[_0x97d7('0x89')](_0x3d620a[_0x97d7('0x64')][_0x97d7('0x6d')],_[_0x97d7('0x8a')](_0x3d620a['body'],[_0x97d7('0x6d'),'id'])||{});}})[_0x97d7('0x13')](respondWithResult(_0x20d41f,null))['catch'](handleError(_0x20d41f,null));};exports[_0x97d7('0x8b')]=function(_0x13b9ef,_0x1b77c7){var _0x2815a0={'raw':![],'where':{}};var _0x336c67={};var _0x1cfcb3={'count':0x0,'rows':[]};return db[_0x97d7('0x5a')][_0x97d7('0x70')]({'where':{'id':_0x13b9ef[_0x97d7('0x60')]['id']}})['then'](handleEntityNotFound(_0x1b77c7,null))[_0x97d7('0x13')](function(_0x5c1813){if(_0x5c1813){_0x336c67[_0x97d7('0x4a')]=_['keys'](db['MailInteraction'][_0x97d7('0x48')]);_0x336c67[_0x97d7('0x4b')]=_['keys'](_0x13b9ef[_0x97d7('0x4b')]);_0x336c67['filters']=_[_0x97d7('0x4c')](_0x336c67[_0x97d7('0x4a')],_0x336c67[_0x97d7('0x4b')]);_0x2815a0[_0x97d7('0x4e')]=_[_0x97d7('0x4c')](_0x336c67['model'],qs['fields'](_0x13b9ef[_0x97d7('0x4b')]['fields']));_0x2815a0[_0x97d7('0x4e')]=_0x2815a0[_0x97d7('0x4e')]['length']?_0x2815a0[_0x97d7('0x4e')]:_0x336c67[_0x97d7('0x4a')];if(!_0x13b9ef[_0x97d7('0x4b')]['hasOwnProperty'](_0x97d7('0x51'))){_0x2815a0[_0x97d7('0x26')]=qs[_0x97d7('0x26')](_0x13b9ef['query'][_0x97d7('0x26')]);_0x2815a0[_0x97d7('0x25')]=qs['offset'](_0x13b9ef[_0x97d7('0x4b')]['offset']);}_0x2815a0[_0x97d7('0x52')]=qs[_0x97d7('0x53')](_0x13b9ef[_0x97d7('0x4b')][_0x97d7('0x53')]);_0x2815a0[_0x97d7('0x56')]=qs['filters'](_['pick'](_0x13b9ef[_0x97d7('0x4b')],_0x336c67[_0x97d7('0x54')]));_0x2815a0[_0x97d7('0x56')][_0x97d7('0x68')]=_0x5c1813['id'];if(_0x13b9ef[_0x97d7('0x4b')][_0x97d7('0x55')]){_0x2815a0[_0x97d7('0x56')]=_[_0x97d7('0x57')](_0x2815a0[_0x97d7('0x56')],{'$or':_[_0x97d7('0x47')](_0x2815a0[_0x97d7('0x4e')],function(_0x2aaf00){var _0x3990ff={};_0x3990ff[_0x2aaf00]={'$like':'%'+_0x13b9ef[_0x97d7('0x4b')]['filter']+'%'};return _0x3990ff;})});}_0x2815a0=_['merge']({},_0x2815a0,_0x13b9ef['options']);return db['MailInteraction']['count']({'where':_0x2815a0['where']})['then'](function(_0x5e2ba8){_0x1cfcb3[_0x97d7('0x24')]=_0x5e2ba8;if(_0x13b9ef[_0x97d7('0x4b')][_0x97d7('0x5b')]){_0x2815a0[_0x97d7('0x5c')]=[{'model':db[_0x97d7('0x8c')],'as':_0x97d7('0x8d'),'required':![]},{'model':db[_0x97d7('0x8e')],'as':_0x97d7('0x8f'),'attributes':[_0x97d7('0x2b'),_0x97d7('0x90'),_0x97d7('0x91')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x97d7('0x2b'),_0x97d7('0x92')],'where':_0x13b9ef[_0x97d7('0x4b')][_0x97d7('0x93')]?{'id':_0x13b9ef[_0x97d7('0x4b')][_0x97d7('0x93')]}:undefined,'required':_0x13b9ef[_0x97d7('0x4b')]['tag']?!![]:![]}];}return db[_0x97d7('0x88')]['findAll'](_0x2815a0);})[_0x97d7('0x13')](function(_0x280157){_0x1cfcb3[_0x97d7('0x5e')]=_0x280157;return _0x1cfcb3;});}})[_0x97d7('0x13')](respondWithFilteredResult(_0x1b77c7,_0x2815a0))[_0x97d7('0x1e')](handleError(_0x1b77c7,null));};exports['addApplications']=function addApplications(_0x4f6fb6,_0x55ea90){var _0xa23787=_0x4f6fb6['params']['id'];var _0x4ec93e=_0x4f6fb6[_0x97d7('0x64')];var _0x592d68=0xc8;var _0x1f53ad=null;return db['sequelize'][_0x97d7('0x94')]({'isolationLevel':db[_0x97d7('0x95')][_0x97d7('0x96')][_0x97d7('0x97')][_0x97d7('0x98')]},function(_0x1624be){return db['MailAccount']['findOne']({'where':{'id':_0xa23787},'transaction':_0x1624be})[_0x97d7('0x13')](function(_0x2d5ff6){if(_0x2d5ff6){return db[_0x97d7('0x99')][_0x97d7('0x28')]({'where':{'MailAccountId':_0xa23787},'transaction':_0x1624be})[_0x97d7('0x13')](function(){var _0x2bfb9b=_[_0x97d7('0x47')](_0x4ec93e,function(_0x49aa5a){_0x49aa5a['MailAccountId']=_0xa23787;return _0x49aa5a;});return db[_0x97d7('0x99')][_0x97d7('0x9a')](_0x2bfb9b,{'transaction':_0x1624be});});}else{_0x592d68=0x194;_0x1f53ad=[];}});})[_0x97d7('0x13')](function(){if(_0x592d68!==0x194){return db[_0x97d7('0x99')][_0x97d7('0x9b')]({'where':{'MailAccountId':_0xa23787},'order':_0x97d7('0x9c')})[_0x97d7('0x13')](function(_0x410865){_0x1f53ad=_0x410865;});}})['catch'](function(_0x2f3f0){_0x592d68=0x1f4;logger[_0x97d7('0x19')](_0x2f3f0[_0x97d7('0x2a')]);if(_0x2f3f0[_0x97d7('0x2b')]){delete _0x2f3f0[_0x97d7('0x2b')];}_0x1f53ad=_0x2f3f0;})['finally'](function(){if(_0x1f53ad===null){_0x55ea90[_0x97d7('0x1f')](_0x592d68);}else{if(_0x592d68===0x1f4){_0x55ea90[_0x97d7('0x21')](_0x592d68)[_0x97d7('0x2c')](_0x1f53ad);}else{_0x55ea90['status'](_0x592d68)[_0x97d7('0x22')](_0x1f53ad);}}});};exports[_0x97d7('0x9d')]=function(_0x48bde0,_0x56d7d8){var _0x1a4c8a={};var _0xdad7e0={};var _0x4c1e19;var _0x7f7d39;return db[_0x97d7('0x5a')][_0x97d7('0x70')]({'where':{'id':_0x48bde0[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x56d7d8,null))['then'](function(_0x1b04b7){if(_0x1b04b7){_0x4c1e19=_0x1b04b7;_0xdad7e0[_0x97d7('0x4a')]=_[_0x97d7('0x62')](db['MailApplication'][_0x97d7('0x48')]);_0xdad7e0['query']=_[_0x97d7('0x62')](_0x48bde0['query']);_0xdad7e0[_0x97d7('0x54')]=_[_0x97d7('0x4c')](_0xdad7e0[_0x97d7('0x4a')],_0xdad7e0[_0x97d7('0x4b')]);_0x1a4c8a[_0x97d7('0x4e')]=_[_0x97d7('0x4c')](_0xdad7e0[_0x97d7('0x4a')],qs[_0x97d7('0x4d')](_0x48bde0[_0x97d7('0x4b')][_0x97d7('0x4d')]));_0x1a4c8a['attributes']=_0x1a4c8a[_0x97d7('0x4e')]['length']?_0x1a4c8a[_0x97d7('0x4e')]:_0xdad7e0[_0x97d7('0x4a')];_0x1a4c8a[_0x97d7('0x52')]=qs[_0x97d7('0x53')](_0x48bde0[_0x97d7('0x4b')][_0x97d7('0x53')]);_0x1a4c8a[_0x97d7('0x56')]=qs['filters'](_[_0x97d7('0x6b')](_0x48bde0[_0x97d7('0x4b')],_0xdad7e0[_0x97d7('0x54')]));if(_0x48bde0[_0x97d7('0x4b')][_0x97d7('0x55')]){_0x1a4c8a['where']=_['merge'](_0x1a4c8a[_0x97d7('0x56')],{'$or':_[_0x97d7('0x47')](_0x1a4c8a[_0x97d7('0x4e')],function(_0x33e83f){var _0x37e18e={};_0x37e18e[_0x33e83f]={'$like':'%'+_0x48bde0[_0x97d7('0x4b')][_0x97d7('0x55')]+'%'};return _0x37e18e;})});}_0x1a4c8a=_['merge']({},_0x1a4c8a,_0x48bde0[_0x97d7('0x59')]);return _0x4c1e19[_0x97d7('0x9d')](_0x1a4c8a);}})[_0x97d7('0x13')](function(_0x26cdc9){if(_0x26cdc9){_0x7f7d39=_0x26cdc9['length'];if(!_0x48bde0[_0x97d7('0x4b')][_0x97d7('0x50')](_0x97d7('0x51'))){_0x1a4c8a[_0x97d7('0x26')]=qs[_0x97d7('0x26')](_0x48bde0[_0x97d7('0x4b')][_0x97d7('0x26')]);_0x1a4c8a[_0x97d7('0x25')]=qs['offset'](_0x48bde0['query'][_0x97d7('0x25')]);}return _0x4c1e19[_0x97d7('0x9d')](_0x1a4c8a);}})[_0x97d7('0x13')](function(_0x613b85){if(_0x613b85){return _0x613b85?{'count':_0x7f7d39,'rows':_0x613b85}:null;}})['then'](respondWithResult(_0x56d7d8,null))[_0x97d7('0x1e')](handleError(_0x56d7d8,null));};exports[_0x97d7('0x9e')]=function(_0x574e02,_0x1410a2){var _0x3d7c2d={'raw':!![],'where':{}};var _0x458e55={};var _0x5bcbf6={'count':0x0,'rows':[]};return db[_0x97d7('0x5a')]['findOne']({'where':{'id':_0x574e02[_0x97d7('0x60')]['id']}})['then'](handleEntityNotFound(_0x1410a2,null))[_0x97d7('0x13')](function(_0x257332){if(_0x257332){_0x458e55['model']=_[_0x97d7('0x62')](db[_0x97d7('0x9f')]['rawAttributes']);_0x458e55[_0x97d7('0x4b')]=_[_0x97d7('0x62')](_0x574e02[_0x97d7('0x4b')]);_0x458e55['filters']=_[_0x97d7('0x4c')](_0x458e55[_0x97d7('0x4a')],_0x458e55[_0x97d7('0x4b')]);_0x3d7c2d['attributes']=_[_0x97d7('0x4c')](_0x458e55[_0x97d7('0x4a')],qs[_0x97d7('0x4d')](_0x574e02[_0x97d7('0x4b')][_0x97d7('0x4d')]));_0x3d7c2d[_0x97d7('0x4e')]=_0x3d7c2d[_0x97d7('0x4e')][_0x97d7('0x4f')]?_0x3d7c2d[_0x97d7('0x4e')]:_0x458e55[_0x97d7('0x4a')];if(!_0x574e02[_0x97d7('0x4b')][_0x97d7('0x50')](_0x97d7('0x51'))){_0x3d7c2d[_0x97d7('0x26')]=qs['limit'](_0x574e02[_0x97d7('0x4b')]['limit']);_0x3d7c2d[_0x97d7('0x25')]=qs['offset'](_0x574e02[_0x97d7('0x4b')][_0x97d7('0x25')]);}_0x3d7c2d[_0x97d7('0x52')]=qs['sort'](_0x574e02[_0x97d7('0x4b')][_0x97d7('0x53')]);_0x3d7c2d[_0x97d7('0x56')]=qs[_0x97d7('0x54')](_[_0x97d7('0x6b')](_0x574e02[_0x97d7('0x4b')],_0x458e55[_0x97d7('0x54')]));_0x3d7c2d[_0x97d7('0x56')][_0x97d7('0x68')]=_0x257332['id'];if(_0x574e02[_0x97d7('0x4b')]['filter']){_0x3d7c2d['where']=_['merge'](_0x3d7c2d[_0x97d7('0x56')],{'$or':_[_0x97d7('0x47')](_0x3d7c2d[_0x97d7('0x4e')],function(_0x544fea){var _0x162037={};_0x162037[_0x544fea]={'$like':'%'+_0x574e02[_0x97d7('0x4b')][_0x97d7('0x55')]+'%'};return _0x162037;})});}if(_0x574e02[_0x97d7('0x4b')][_0x97d7('0xa0')]){var _0x500a17=_0x574e02[_0x97d7('0x4b')][_0x97d7('0xa0')][_0x97d7('0xa1')](',');var _0x53c57c={};_0x53c57c[_0x500a17[0x0]]={'$gte':moment(_0x500a17[0x1])[_0x97d7('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3d7c2d[_0x97d7('0x56')]=_[_0x97d7('0x57')](_0x3d7c2d[_0x97d7('0x56')],_0x53c57c);}_0x3d7c2d=_['merge']({},_0x3d7c2d,_0x574e02[_0x97d7('0x59')]);return db[_0x97d7('0x9f')]['count']({'where':_0x3d7c2d[_0x97d7('0x56')]})[_0x97d7('0x13')](function(_0x1772aa){_0x5bcbf6[_0x97d7('0x24')]=_0x1772aa;if(_0x574e02[_0x97d7('0x4b')][_0x97d7('0x5b')]){_0x3d7c2d[_0x97d7('0x5c')]=[{'all':!![]}];}return db[_0x97d7('0x9f')][_0x97d7('0x5d')](_0x3d7c2d);})['then'](function(_0x2ac8ae){if(_0x574e02[_0x97d7('0x4b')][_0x97d7('0xa3')]==='true'){for(var _0x3ce4b7=0x0;_0x3ce4b7<_0x2ac8ae[_0x97d7('0x4f')];_0x3ce4b7++){_0x2ac8ae[_0x3ce4b7][_0x97d7('0x64')]=juice(_0x2ac8ae[_0x3ce4b7][_0x97d7('0x64')]);}}_0x5bcbf6[_0x97d7('0x5e')]=_0x2ac8ae;return _0x5bcbf6;});}})[_0x97d7('0x13')](respondWithFilteredResult(_0x1410a2,_0x3d7c2d))[_0x97d7('0x1e')](handleError(_0x1410a2,null));};exports[_0x97d7('0x2c')]=function(_0x17ede7,_0x1b816d){var _0x709274,_0xdeae9c={},_0x219505;if(_0x17ede7['body']['to']){_0x219505=_0x17ede7[_0x97d7('0x64')]['to'][_0x97d7('0xa1')](',')[0x0];}return db[_0x97d7('0x5a')][_0x97d7('0x67')]({'where':{'id':_0x17ede7[_0x97d7('0x60')]['id']},'include':[{'model':db[_0x97d7('0xa4')],'as':_0x97d7('0xa5'),'include':[{'model':db['CmContact'],'as':_0x97d7('0xa6'),'where':{'email':_0x219505},'limit':0x1,'order':[[_0x97d7('0xa7'),_0x97d7('0xa8')]]}]},{'model':db[_0x97d7('0x45')],'as':_0x97d7('0x42'),'raw':!![],'include':[{'model':db[_0x97d7('0xa9')],'as':'CloudProvider','raw':!![]}]}]})[_0x97d7('0x13')](handleEntityNotFound(_0x1b816d,null))[_0x97d7('0x13')](function(_0x54df23){if(!_0x54df23)return;_0x709274=_0x54df23;if(!_0x54df23[_0x97d7('0x42')])throw new Error(_0x97d7('0xaa'));if(_[_0x97d7('0xab')](_0x17ede7[_0x97d7('0x64')][_0x97d7('0xac')])){_0x17ede7[_0x97d7('0x64')][_0x97d7('0xac')]=util['format'](_0x97d7('0xad'),_0x54df23['name'],_0x54df23[_0x97d7('0x73')]||_0x54df23[_0x97d7('0x42')]['user']);}if(_0x17ede7['body'][_0x97d7('0xae')]&&_0x17ede7['body']['attachments'][_0x97d7('0x4f')]){for(var _0x227aca=0x0;_0x227aca<_0x17ede7[_0x97d7('0x64')]['attachments'][_0x97d7('0x4f')];_0x227aca+=0x1){_0x17ede7['body']['attachments'][_0x227aca]={'filename':_0x17ede7[_0x97d7('0x64')][_0x97d7('0xae')][_0x227aca]['name'],'path':path[_0x97d7('0xaf')](config['root'],_0x97d7('0xb0'),_0x17ede7['body'][_0x97d7('0xae')][_0x227aca][_0x97d7('0xb1')])};}}var _0x4fa63f=_0x54df23[_0x97d7('0xb2')]();return respondWithRpcPromise(_0x97d7('0xb3'),_0x97d7('0xb4'),{'account':_0x4fa63f,'message':_0x17ede7['body']});})[_0x97d7('0x13')](function(_0x8e713a){if(!_0x8e713a)return;_0xdeae9c=_0x8e713a;if(!_0x709274['List'])throw new Error(_0x97d7('0xb5'));if(_0x709274[_0x97d7('0xa5')][_0x97d7('0xa6')][_0x97d7('0x4f')])return _0x709274[_0x97d7('0xa5')][_0x97d7('0xa6')][0x0];return db[_0x97d7('0x8c')]['create'](_[_0x97d7('0xb')](_0x17ede7[_0x97d7('0x64')],{'firstName':_0x17ede7[_0x97d7('0x64')]['to'],'email':_0x17ede7[_0x97d7('0x64')]['to'],'phone':_0x17ede7[_0x97d7('0x64')]['to'],'ListId':_0x709274[_0x97d7('0x74')]}));})[_0x97d7('0x13')](function(_0x1e2d6a){if(!_0x1e2d6a)return;var _0x3a2966={'UserId':_0x17ede7[_0x97d7('0x37')]['id'],'ContactId':_0x1e2d6a['id'],'MailAccountId':_0x709274['id'],'inReplyTo':_0xdeae9c['messageId'],'to':_0x17ede7[_0x97d7('0x64')]['from'],'cc':_0x17ede7[_0x97d7('0x64')]['cc'],'subject':_0x17ede7[_0x97d7('0x64')][_0x97d7('0xb6')],'attach':_0x17ede7['body']['attach'],'firstMsgDirection':_0x97d7('0xb7'),'lastMsgAt':moment()[_0x97d7('0xa2')](_0x97d7('0xb8')),'lastMsgDirection':'out','Messages':[_[_0x97d7('0x57')](_0x17ede7[_0x97d7('0x64')],{'messageId':_0xdeae9c[_0x97d7('0xb9')],'sentAt':moment()['format'](_0x97d7('0xb8')),'read':!![],'MailAccountId':_0x709274['id'],'UserId':_0x17ede7[_0x97d7('0x37')]['id'],'ContactId':_0x1e2d6a['id']})]};if(_0x17ede7[_0x97d7('0x64')][_0x97d7('0xba')]){_0x3a2966=_[_0x97d7('0x57')](_0x3a2966,_0x17ede7[_0x97d7('0x64')][_0x97d7('0xba')]);}return db[_0x97d7('0x88')][_0x97d7('0x77')](_0x3a2966,{'include':[{'model':db[_0x97d7('0x9f')],'as':'Messages'}]});})['then'](respondWithResult(_0x1b816d,null))[_0x97d7('0x1e')](handleError(_0x1b816d,null));};exports[_0x97d7('0xbb')]=function(_0x3515b8,_0x5f292c){return db[_0x97d7('0x5a')]['find']({'where':{'id':_0x3515b8[_0x97d7('0x60')]['id']},'include':[{'model':db[_0x97d7('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x97d7('0xa9')],'as':_0x97d7('0xa9'),'raw':!![]}]}]})[_0x97d7('0x13')](handleEntityNotFound(_0x5f292c,null))[_0x97d7('0x13')](function(_0x3c0761){if(!_0x3c0761[_0x97d7('0x42')])return;var _0x4cbf97=_0x3c0761['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0x97d7('0xbb'),{'account':_0x4cbf97});})[_0x97d7('0x13')](respondWithResult(_0x5f292c,null))['catch'](handleError(_0x5f292c,null));};exports['destroy']=function(_0x3ac686,_0x20cec9){return db[_0x97d7('0x5a')][_0x97d7('0x67')]({'where':{'id':_0x3ac686[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x20cec9,null))[_0x97d7('0x13')](function(_0x4c6fda){if(_0x4c6fda&&_0x4c6fda[_0x97d7('0x3f')]){throw new db['Sequelize'][(_0x97d7('0xbc'))](_0x97d7('0xbd'));}return _0x4c6fda;})[_0x97d7('0x13')](removeEntity(_0x20cec9,null))[_0x97d7('0x1e')](handleError(_0x20cec9,null));};exports[_0x97d7('0xbe')]=function(_0x1b3ea4,_0x50038c){return db['MailAccount'][_0x97d7('0x67')]({'where':{'id':_0x1b3ea4[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x50038c,null))['then'](function(_0x3304e8){if(_0x3304e8){return _0x3304e8[_0x97d7('0xbe')](_0x1b3ea4[_0x97d7('0x64')][_0x97d7('0x6d')],_[_0x97d7('0x8a')](_0x1b3ea4[_0x97d7('0x64')],['ids','id'])||{})['spread'](function(_0x57c7a7){for(var _0x15d5a0=0x0;_0x15d5a0<_0x1b3ea4['body'][_0x97d7('0x6d')][_0x97d7('0x4f')];_0x15d5a0+=0x1){socket[_0x97d7('0xbf')](_0x97d7('0xc0'),{'UserId':Number(_0x1b3ea4[_0x97d7('0x64')]['ids'][_0x15d5a0]),'MailAccountId':Number(_0x1b3ea4[_0x97d7('0x60')]['id'])});}return _0x57c7a7;});}})['then'](respondWithResult(_0x50038c,null))[_0x97d7('0x1e')](handleError(_0x50038c,null));};exports[_0x97d7('0xc1')]=function(_0x1e7698,_0x1b7971){return db[_0x97d7('0x5a')][_0x97d7('0x67')]({'where':{'id':_0x1e7698[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x1b7971,null))[_0x97d7('0x13')](function(_0x47451f){if(_0x47451f){return _0x47451f[_0x97d7('0xc1')](_0x1e7698['query'][_0x97d7('0x6d')])[_0x97d7('0x13')](function(){if(_[_0x97d7('0xc2')](_0x1e7698[_0x97d7('0x4b')][_0x97d7('0x6d')])){for(var _0x3ba7b5=0x0;_0x3ba7b5<_0x1e7698[_0x97d7('0x4b')][_0x97d7('0x6d')]['length'];_0x3ba7b5+=0x1){socket[_0x97d7('0xbf')](_0x97d7('0xc3'),{'UserId':Number(_0x1e7698[_0x97d7('0x4b')][_0x97d7('0x6d')][_0x3ba7b5]),'MailAccountId':Number(_0x1e7698[_0x97d7('0x60')]['id'])});}}else{socket[_0x97d7('0xbf')](_0x97d7('0xc3'),{'UserId':Number(_0x1e7698[_0x97d7('0x4b')][_0x97d7('0x6d')]),'MailAccountId':Number(_0x1e7698[_0x97d7('0x60')]['id'])});}});}})[_0x97d7('0x13')](respondWithStatusCode(_0x1b7971,null))[_0x97d7('0x1e')](handleError(_0x1b7971,null));};exports[_0x97d7('0xc4')]=function(_0x35c753,_0x4ef40c){var _0x996788={};var _0x2abd06={};var _0x3ee4e5;var _0x1badb3;return db['MailAccount']['findOne']({'where':{'id':_0x35c753[_0x97d7('0x60')]['id']}})[_0x97d7('0x13')](handleEntityNotFound(_0x4ef40c,null))[_0x97d7('0x13')](function(_0xb92703){if(_0xb92703){_0x3ee4e5=_0xb92703;_0x2abd06[_0x97d7('0x4a')]=_[_0x97d7('0x62')](db[_0x97d7('0x8e')][_0x97d7('0x48')]);_0x2abd06[_0x97d7('0x4b')]=_['keys'](_0x35c753['query']);_0x2abd06['filters']=_[_0x97d7('0x4c')](_0x2abd06[_0x97d7('0x4a')],_0x2abd06[_0x97d7('0x4b')]);_0x996788['attributes']=_[_0x97d7('0x4c')](_0x2abd06[_0x97d7('0x4a')],qs[_0x97d7('0x4d')](_0x35c753[_0x97d7('0x4b')][_0x97d7('0x4d')]));_0x996788[_0x97d7('0x4e')]=_0x996788[_0x97d7('0x4e')][_0x97d7('0x4f')]?_0x996788[_0x97d7('0x4e')]:_0x2abd06['model'];_0x996788[_0x97d7('0x52')]=qs[_0x97d7('0x53')](_0x35c753[_0x97d7('0x4b')][_0x97d7('0x53')]);_0x996788[_0x97d7('0x56')]=qs['filters'](_[_0x97d7('0x6b')](_0x35c753[_0x97d7('0x4b')],_0x2abd06['filters']));if(_0x35c753[_0x97d7('0x4b')][_0x97d7('0x55')]){_0x996788['where']=_['merge'](_0x996788[_0x97d7('0x56')],{'$or':_['map'](_0x996788[_0x97d7('0x4e')],function(_0x554335){var _0x27c220={};_0x27c220[_0x554335]={'$like':'%'+_0x35c753[_0x97d7('0x4b')][_0x97d7('0x55')]+'%'};return _0x27c220;})});}_0x996788=_[_0x97d7('0x57')]({},_0x996788,_0x35c753[_0x97d7('0x59')]);return _0x3ee4e5['getAgents'](_0x996788);}})[_0x97d7('0x13')](function(_0x4d6d91){if(_0x4d6d91){_0x1badb3=_0x4d6d91['length'];if(!_0x35c753['query'][_0x97d7('0x50')]('nolimit')){_0x996788['limit']=qs[_0x97d7('0x26')](_0x35c753[_0x97d7('0x4b')]['limit']);_0x996788[_0x97d7('0x25')]=qs['offset'](_0x35c753[_0x97d7('0x4b')][_0x97d7('0x25')]);}return _0x3ee4e5[_0x97d7('0xc4')](_0x996788);}})['then'](function(_0x56563f){if(_0x56563f){return _0x56563f?{'count':_0x1badb3,'rows':_0x56563f}:null;}})[_0x97d7('0x13')](respondWithResult(_0x4ef40c,null))[_0x97d7('0x1e')](handleError(_0x4ef40c,null));}; \ No newline at end of file +var _0x4b6d=['inlineCss','true','split','CmList','List','Contacts','updatedAt','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','verifySmtp','CloudProvider','getSmtpOptions','VerifySmtp','Sequelize','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','get','MailAccounts','UserProfileResource','destroy','stack','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','pass','Imap','Smtp','index','MailServerIn','Pause','map','fieldName','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','MailAccount','includeAll','findAll','rows','params','mandatoryDispositionPause','rawAttributes','include','body','provider','custom','MailServerOut','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','findOne','removeDispositions','find','ids','MailAccountId','CannedAnswer','getAnswers','order','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','getImap','addImap','removeImap','getSmtp','removeSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','send','getApplications','MailMessage','$gte','format'];(function(_0x23454a,_0x54f1a7){var _0x226f1c=function(_0x519d30){while(--_0x519d30){_0x23454a['push'](_0x23454a['shift']());}};_0x226f1c(++_0x54f1a7);}(_0x4b6d,0x1a4));var _0xd4b6=function(_0x487c5c,_0x5cbf2f){_0x487c5c=_0x487c5c-0x0;var _0x60d144=_0x4b6d[_0x487c5c];return _0x60d144;};'use strict';var moment=require(_0xd4b6('0x0'));var BPromise=require(_0xd4b6('0x1'));var util=require(_0xd4b6('0x2'));var path=require(_0xd4b6('0x3'));var _=require('lodash');var juice=require('juice');var Redis=require(_0xd4b6('0x4'));var qs=require(_0xd4b6('0x5'));var logger=require(_0xd4b6('0x6'))(_0xd4b6('0x7'));var config=require(_0xd4b6('0x8'));var db=require(_0xd4b6('0x9'))['db'];config[_0xd4b6('0xa')]=_[_0xd4b6('0xb')](config['redis'],{'host':_0xd4b6('0xc'),'port':0x18eb});var socket=require(_0xd4b6('0xd'))(new Redis(config[_0xd4b6('0xa')]));require(_0xd4b6('0xe'))[_0xd4b6('0xf')](socket);var jayson=require(_0xd4b6('0x10'));var client=jayson[_0xd4b6('0x11')][_0xd4b6('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x8e8983,_0x3b801c,_0x3bd2ce,_0x2e8c74){return new BPromise(function(_0x5cae50,_0x258909){var _0x392862=_0x2e8c74||client;return _0x392862[_0xd4b6('0x13')](_0x8e8983,_0x3bd2ce)[_0xd4b6('0x14')](function(_0x1ccec7){logger[_0xd4b6('0x15')](_0xd4b6('0x16'),_0x3b801c,'request\x20sent');logger[_0xd4b6('0x17')](_0xd4b6('0x18'),_0x3b801c,'request\x20sent',JSON[_0xd4b6('0x19')](_0x1ccec7));if(_0x1ccec7['error']){if(_0x1ccec7[_0xd4b6('0x1a')][_0xd4b6('0x1b')]===0x1f4){logger['error'](_0xd4b6('0x16'),_0x3b801c,_0x1ccec7[_0xd4b6('0x1a')]['message']);return _0x258909(_0x1ccec7[_0xd4b6('0x1a')][_0xd4b6('0x1c')]);}logger[_0xd4b6('0x1a')]('MailAccount,\x20%s,\x20%s',_0x3b801c,_0x1ccec7['error'][_0xd4b6('0x1c')]);return _0x5cae50(_0x1ccec7[_0xd4b6('0x1a')][_0xd4b6('0x1c')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x3b801c,'request\x20sent');_0x5cae50(_0x1ccec7['result'][_0xd4b6('0x1c')]);}})[_0xd4b6('0x1d')](function(_0x1cdeff){logger[_0xd4b6('0x1a')]('MailAccount,\x20%s,\x20%s',_0x3b801c,_0x1cdeff);_0x258909(_0x1cdeff);});});}function respondWithStatusCode(_0x23443d,_0x242049){_0x242049=_0x242049||0xcc;return function(_0x11a86d){if(_0x11a86d){return _0x23443d[_0xd4b6('0x1e')](_0x242049);}return _0x23443d[_0xd4b6('0x1f')](_0x242049)[_0xd4b6('0x20')]();};}function respondWithResult(_0x456413,_0x30c39b){_0x30c39b=_0x30c39b||0xc8;return function(_0x23b35b){if(_0x23b35b){return _0x456413[_0xd4b6('0x1f')](_0x30c39b)[_0xd4b6('0x21')](_0x23b35b);}};}function respondWithFilteredResult(_0xc6db4e,_0x409220){return function(_0x19fbb5){if(_0x19fbb5){var _0x5760e6=typeof _0x409220[_0xd4b6('0x22')]===_0xd4b6('0x23')&&typeof _0x409220[_0xd4b6('0x24')]===_0xd4b6('0x23');var _0xbcafdf=_0x19fbb5['count'];var _0x4503a8=_0x5760e6?0x0:_0x409220[_0xd4b6('0x22')];var _0x450fe2=_0x5760e6?_0x19fbb5[_0xd4b6('0x25')]:_0x409220[_0xd4b6('0x22')]+_0x409220['limit'];var _0x242d11;if(_0x450fe2>=_0xbcafdf){_0x450fe2=_0xbcafdf;_0x242d11=0xc8;}else{_0x242d11=0xce;}_0xc6db4e['status'](_0x242d11);return _0xc6db4e[_0xd4b6('0x26')](_0xd4b6('0x27'),_0x4503a8+'-'+_0x450fe2+'/'+_0xbcafdf)[_0xd4b6('0x21')](_0x19fbb5);}return null;};}function saveUpdates(_0x1fbcdd){return function(_0x590376){if(_0x590376){return _0x590376[_0xd4b6('0x28')](_0x1fbcdd)[_0xd4b6('0x14')](function(_0x5c92d9){return _0x5c92d9;});}return null;};}function removeEntity(_0x4a7f9e){return function(_0xb27bc){if(_0xb27bc){return _0xb27bc['destroy']()[_0xd4b6('0x14')](function(){var _0x41bb1b=_0xb27bc[_0xd4b6('0x29')]({'plain':!![]});var _0x48a632=_0xd4b6('0x2a');return db[_0xd4b6('0x2b')][_0xd4b6('0x2c')]({'where':{'type':_0x48a632,'resourceId':_0x41bb1b['id']}})[_0xd4b6('0x14')](function(){return _0xb27bc;});})[_0xd4b6('0x14')](function(){_0x4a7f9e[_0xd4b6('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x478522){return function(_0x609c4b){if(!_0x609c4b){_0x478522[_0xd4b6('0x1e')](0x194);}return _0x609c4b;};}function handleError(_0x33bee9,_0x3064dc){_0x3064dc=_0x3064dc||0x1f4;return function(_0x2de7f9){logger[_0xd4b6('0x1a')](_0x2de7f9[_0xd4b6('0x2d')]);if(_0x2de7f9['name']){delete _0x2de7f9['name'];}_0x33bee9[_0xd4b6('0x1f')](_0x3064dc)['send'](_0x2de7f9);};}function getImapHost(_0x25afd8){switch(_0x25afd8){case _0xd4b6('0x2e'):return'imap.gmail.com';case _0xd4b6('0x2f'):return'imap.mail.yahoo.com';case _0xd4b6('0x30'):return _0xd4b6('0x31');case'outlook365':return _0xd4b6('0x32');}throw new Error(_0xd4b6('0x33'),_0x25afd8);}function getSmtpHost(_0x56473a){switch(_0x56473a){case _0xd4b6('0x2e'):return'smtp.gmail.com';case _0xd4b6('0x2f'):return _0xd4b6('0x34');case _0xd4b6('0x30'):return _0xd4b6('0x35');case'outlook365':return _0xd4b6('0x36');}throw new Error(_0xd4b6('0x33'),_0x56473a);}function getAuthenticationOptions(_0x492346,_0x1a4037){var _0x4118af={};var _0xf74da0={};if(_0x492346){_0x4118af[_0xd4b6('0x37')]=_0xf74da0['user']=_0x1a4037[_0xd4b6('0x38')];_0x4118af[_0xd4b6('0x39')]=_0xf74da0['pass']=_0x1a4037['password'];if(_0x1a4037['modernAuthentication']){_0x4118af[_0xd4b6('0x3a')]=_0xf74da0[_0xd4b6('0x3a')]=!![];_0x4118af['CloudProviderId']=_0xf74da0['CloudProviderId']=_0x1a4037[_0xd4b6('0x3b')];_0x4118af[_0xd4b6('0x39')]=_0xf74da0['pass']=null;}else{_0x4118af[_0xd4b6('0x3b')]=_0xf74da0[_0xd4b6('0x3b')]=null;}_0x4118af[_0xd4b6('0x3c')]=getImapHost(_0x492346);_0x4118af[_0xd4b6('0x3d')]=0x3e1;_0xf74da0[_0xd4b6('0x3c')]=getSmtpHost(_0x492346);_0xf74da0[_0xd4b6('0x3d')]=0x24b;_0xf74da0[_0xd4b6('0x3e')]=![];_0x4118af[_0xd4b6('0x3f')]=_0xf74da0[_0xd4b6('0x3f')]=null;}else{if(_0x1a4037['authentication']){_0x4118af[_0xd4b6('0x37')]=_0xf74da0['user']=_0x1a4037[_0xd4b6('0x38')];_0x4118af['password']=_0xf74da0['pass']=_0x1a4037[_0xd4b6('0x39')];}else{_0x4118af[_0xd4b6('0x40')]=_0xf74da0[_0xd4b6('0x40')]=![];_0x4118af[_0xd4b6('0x37')]=_0xf74da0[_0xd4b6('0x37')]=null;_0x4118af[_0xd4b6('0x39')]=_0xf74da0[_0xd4b6('0x41')]=null;}_0x4118af['host']=_0x1a4037[_0xd4b6('0x42')][_0xd4b6('0x3c')];_0x4118af['port']=_0x1a4037['Imap'][_0xd4b6('0x3d')];_0xf74da0[_0xd4b6('0x3c')]=_0x1a4037[_0xd4b6('0x43')][_0xd4b6('0x3c')];_0xf74da0[_0xd4b6('0x3d')]=_0x1a4037[_0xd4b6('0x43')][_0xd4b6('0x3d')];}return{'Imap':_0x4118af,'Smtp':_0xf74da0};}exports[_0xd4b6('0x44')]=function(_0x2cf0cb,_0x2a0a5c){var _0x1a3c91={'include':[{'model':db[_0xd4b6('0x45')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xd4b6('0x43')},{'model':db[_0xd4b6('0x46')],'as':'mandatoryDispositionPause'}]},_0x210c79={},_0x65c732={'count':0x0,'rows':[]};var _0x14cfeb=_[_0xd4b6('0x47')](db['MailAccount']['rawAttributes'],function(_0x2c62e8){return{'name':_0x2c62e8[_0xd4b6('0x48')],'type':_0x2c62e8['type']['key']};});_0x210c79[_0xd4b6('0x49')]=_[_0xd4b6('0x47')](_0x14cfeb,_0xd4b6('0x4a'));_0x210c79[_0xd4b6('0x4b')]=_[_0xd4b6('0x4c')](_0x2cf0cb[_0xd4b6('0x4b')]);_0x210c79['filters']=_['intersection'](_0x210c79[_0xd4b6('0x49')],_0x210c79[_0xd4b6('0x4b')]);_0x1a3c91[_0xd4b6('0x4d')]=_[_0xd4b6('0x4e')](_0x210c79[_0xd4b6('0x49')],qs[_0xd4b6('0x4f')](_0x2cf0cb[_0xd4b6('0x4b')]['fields']));_0x1a3c91['attributes']=_0x1a3c91[_0xd4b6('0x4d')][_0xd4b6('0x50')]?_0x1a3c91[_0xd4b6('0x4d')]:_0x210c79[_0xd4b6('0x49')];if(!_0x2cf0cb[_0xd4b6('0x4b')][_0xd4b6('0x51')](_0xd4b6('0x52'))){_0x1a3c91[_0xd4b6('0x24')]=qs[_0xd4b6('0x24')](_0x2cf0cb[_0xd4b6('0x4b')][_0xd4b6('0x24')]);_0x1a3c91[_0xd4b6('0x22')]=qs[_0xd4b6('0x22')](_0x2cf0cb[_0xd4b6('0x4b')][_0xd4b6('0x22')]);}_0x1a3c91['order']=qs[_0xd4b6('0x53')](_0x2cf0cb[_0xd4b6('0x4b')][_0xd4b6('0x53')]);_0x1a3c91[_0xd4b6('0x54')]=qs['filters'](_[_0xd4b6('0x55')](_0x2cf0cb['query'],_0x210c79[_0xd4b6('0x56')]),_0x14cfeb);if(_0x2cf0cb[_0xd4b6('0x4b')]['filter']){_0x1a3c91[_0xd4b6('0x54')]=_[_0xd4b6('0x57')](_0x1a3c91[_0xd4b6('0x54')],{'$or':_[_0xd4b6('0x47')](_0x14cfeb,function(_0x51000f){if(_0x51000f[_0xd4b6('0x58')]!==_0xd4b6('0x59')){var _0x2add24={};_0x2add24[_0x51000f['name']]={'$like':'%'+_0x2cf0cb[_0xd4b6('0x4b')][_0xd4b6('0x5a')]+'%'};return _0x2add24;}})});}_0x1a3c91=_[_0xd4b6('0x57')]({},_0x1a3c91,_0x2cf0cb[_0xd4b6('0x5b')]);var _0x1eaec3={'where':_0x1a3c91[_0xd4b6('0x54')]};return db[_0xd4b6('0x5c')]['count'](_0x1eaec3)['then'](function(_0x34ba08){_0x65c732[_0xd4b6('0x25')]=_0x34ba08;if(_0x2cf0cb[_0xd4b6('0x4b')][_0xd4b6('0x5d')]){_0x1a3c91['include']=[{'all':!![]}];}return db[_0xd4b6('0x5c')][_0xd4b6('0x5e')](_0x1a3c91);})['then'](function(_0x1e92cd){_0x65c732[_0xd4b6('0x5f')]=_0x1e92cd;return _0x65c732;})['then'](respondWithFilteredResult(_0x2a0a5c,_0x1a3c91))[_0xd4b6('0x1d')](handleError(_0x2a0a5c,null));};exports['show']=function(_0x2b1d1a,_0x18ceea){var _0x5d30ec={'raw':![],'where':{'id':_0x2b1d1a[_0xd4b6('0x60')]['id']},'include':[{'model':db[_0xd4b6('0x45')],'as':_0xd4b6('0x42')},{'model':db['MailServerOut'],'as':_0xd4b6('0x43')},{'model':db[_0xd4b6('0x46')],'as':_0xd4b6('0x61')}]},_0x31c814={};_0x31c814[_0xd4b6('0x49')]=_[_0xd4b6('0x4c')](db['MailAccount'][_0xd4b6('0x62')]);_0x31c814['query']=_[_0xd4b6('0x4c')](_0x2b1d1a[_0xd4b6('0x4b')]);_0x31c814[_0xd4b6('0x56')]=_[_0xd4b6('0x4e')](_0x31c814['model'],_0x31c814[_0xd4b6('0x4b')]);_0x5d30ec[_0xd4b6('0x4d')]=_[_0xd4b6('0x4e')](_0x31c814['model'],qs[_0xd4b6('0x4f')](_0x2b1d1a[_0xd4b6('0x4b')][_0xd4b6('0x4f')]));_0x5d30ec[_0xd4b6('0x4d')]=_0x5d30ec[_0xd4b6('0x4d')][_0xd4b6('0x50')]?_0x5d30ec[_0xd4b6('0x4d')]:_0x31c814[_0xd4b6('0x49')];if(_0x2b1d1a['query'][_0xd4b6('0x5d')]){_0x5d30ec[_0xd4b6('0x63')]=[{'all':!![]}];}_0x5d30ec=_[_0xd4b6('0x57')]({},_0x5d30ec,_0x2b1d1a[_0xd4b6('0x5b')]);return db[_0xd4b6('0x5c')]['find'](_0x5d30ec)['then'](handleEntityNotFound(_0x18ceea,null))[_0xd4b6('0x14')](respondWithResult(_0x18ceea,null))['catch'](handleError(_0x18ceea,null));};exports['update']=function(_0x5bc5f5,_0x19ae81){if(_0x5bc5f5[_0xd4b6('0x64')]['id']){delete _0x5bc5f5[_0xd4b6('0x64')]['id'];}var _0x138e7e=_0x5bc5f5[_0xd4b6('0x64')][_0xd4b6('0x65')]===_0xd4b6('0x66')?null:_0x5bc5f5[_0xd4b6('0x64')]['provider'];var _0x3c5029=_0x5bc5f5[_0xd4b6('0x64')]['Imap']||{};var _0x3f996b=_0x5bc5f5['body'][_0xd4b6('0x43')]||{};if(_0x138e7e){_0x3c5029[_0xd4b6('0x3c')]=getImapHost(_0x138e7e);_0x3c5029[_0xd4b6('0x3d')]=0x3e1;_0x3f996b['host']=getSmtpHost(_0x138e7e);_0x3f996b[_0xd4b6('0x3d')]=0x24b;_0x3f996b[_0xd4b6('0x3e')]=![];}if(_0x3f996b[_0xd4b6('0x3a')]){_0x3f996b['secure']=![];}else{_0x3f996b[_0xd4b6('0x3b')]=null;}if(!_0x3c5029[_0xd4b6('0x3a')])_0x3c5029[_0xd4b6('0x3b')]=null;_0x5bc5f5[_0xd4b6('0x64')][_0xd4b6('0x42')]=_0x3c5029;_0x5bc5f5[_0xd4b6('0x64')][_0xd4b6('0x43')]=_0x3f996b;return db['MailAccount']['find']({'where':{'id':_0x5bc5f5['params']['id']},'include':[{'model':db[_0xd4b6('0x45')],'as':_0xd4b6('0x42')},{'model':db[_0xd4b6('0x67')],'as':_0xd4b6('0x43')},{'model':db[_0xd4b6('0x46')],'as':_0xd4b6('0x61')}]})[_0xd4b6('0x14')](handleEntityNotFound(_0x19ae81,null))[_0xd4b6('0x14')](function(_0xeec4ed){if(!_0xeec4ed)throw new Error(_0xd4b6('0x68'));if(_0xeec4ed[_0xd4b6('0x3f')])delete _0x5bc5f5[_0xd4b6('0x64')][_0xd4b6('0x42')];return _0xeec4ed;})[_0xd4b6('0x14')](saveUpdates(_0x5bc5f5[_0xd4b6('0x64')],null))[_0xd4b6('0x14')](function(_0x4ed70d){if(!_0x5bc5f5['body']['Imap'])return _0x4ed70d;return db[_0xd4b6('0x45')][_0xd4b6('0x28')](_0x5bc5f5[_0xd4b6('0x64')][_0xd4b6('0x42')],{'where':{'MailAccountId':_0x4ed70d['id']}})[_0xd4b6('0x14')](function(){return _0x4ed70d;});})[_0xd4b6('0x14')](function(_0xd74d71){if(!_0x5bc5f5['body'][_0xd4b6('0x43')])return _0xd74d71;return db[_0xd4b6('0x67')][_0xd4b6('0x28')](_0x5bc5f5['body'][_0xd4b6('0x43')],{'where':{'MailAccountId':_0xd74d71['id']}})['then'](function(){return _0xd74d71;});})[_0xd4b6('0x14')](respondWithResult(_0x19ae81,null))[_0xd4b6('0x1d')](handleError(_0x19ae81,null));};exports[_0xd4b6('0x69')]=function(_0x4b900f,_0x576dad){return db['MailAccount'][_0xd4b6('0x69')]()[_0xd4b6('0x14')](respondWithResult(_0x576dad,null))[_0xd4b6('0x1d')](handleError(_0x576dad,null));};exports[_0xd4b6('0x6a')]=function(_0x5d552a,_0x2d4301){if(_0x5d552a[_0xd4b6('0x64')]['id']){delete _0x5d552a[_0xd4b6('0x64')]['id'];}return db[_0xd4b6('0x5c')]['find']({'where':{'id':_0x5d552a['params']['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x2d4301,null))[_0xd4b6('0x14')](function(_0x2de58f){if(_0x2de58f){_0x5d552a['body']['MailAccountId']=_0x2de58f['id'];return db[_0xd4b6('0x6b')][_0xd4b6('0x6c')](_0x5d552a[_0xd4b6('0x64')]);}})[_0xd4b6('0x14')](respondWithResult(_0x2d4301,null))[_0xd4b6('0x1d')](handleError(_0x2d4301,null));};exports[_0xd4b6('0x6d')]=function(_0xf2d480,_0x22340b){var _0x4317a9={'raw':![],'where':{}};var _0x59bc2d={};var _0x48af79={'count':0x0,'rows':[]};return db['MailAccount'][_0xd4b6('0x6e')]({'where':{'id':_0xf2d480['params']['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x22340b,null))[_0xd4b6('0x14')](function(_0x5c40e6){if(_0x5c40e6){_0x59bc2d[_0xd4b6('0x49')]=_['keys'](db[_0xd4b6('0x6b')][_0xd4b6('0x62')]);_0x59bc2d[_0xd4b6('0x4b')]=_[_0xd4b6('0x4c')](_0xf2d480[_0xd4b6('0x4b')]);_0x59bc2d[_0xd4b6('0x56')]=_['intersection'](_0x59bc2d[_0xd4b6('0x49')],_0x59bc2d[_0xd4b6('0x4b')]);_0x4317a9['attributes']=_['intersection'](_0x59bc2d['model'],qs[_0xd4b6('0x4f')](_0xf2d480[_0xd4b6('0x4b')][_0xd4b6('0x4f')]));_0x4317a9[_0xd4b6('0x4d')]=_0x4317a9[_0xd4b6('0x4d')]['length']?_0x4317a9['attributes']:_0x59bc2d[_0xd4b6('0x49')];if(!_0xf2d480[_0xd4b6('0x4b')][_0xd4b6('0x51')](_0xd4b6('0x52'))){_0x4317a9[_0xd4b6('0x24')]=qs['limit'](_0xf2d480[_0xd4b6('0x4b')]['limit']);_0x4317a9[_0xd4b6('0x22')]=qs[_0xd4b6('0x22')](_0xf2d480['query']['offset']);}_0x4317a9['order']=qs['sort'](_0xf2d480[_0xd4b6('0x4b')]['sort']);_0x4317a9['where']=qs[_0xd4b6('0x56')](_[_0xd4b6('0x55')](_0xf2d480[_0xd4b6('0x4b')],_0x59bc2d['filters']));_0x4317a9[_0xd4b6('0x54')]['MailAccountId']=_0x5c40e6['id'];if(_0xf2d480[_0xd4b6('0x4b')][_0xd4b6('0x5a')]){_0x4317a9[_0xd4b6('0x54')]=_['merge'](_0x4317a9[_0xd4b6('0x54')],{'$or':_['map'](_0x4317a9[_0xd4b6('0x4d')],function(_0x390ab4){var _0x342828={};_0x342828[_0x390ab4]={'$like':'%'+_0xf2d480['query'][_0xd4b6('0x5a')]+'%'};return _0x342828;})});}_0x4317a9=_[_0xd4b6('0x57')]({},_0x4317a9,_0xf2d480[_0xd4b6('0x5b')]);return db[_0xd4b6('0x6b')][_0xd4b6('0x25')]({'where':_0x4317a9[_0xd4b6('0x54')]})[_0xd4b6('0x14')](function(_0x10c950){_0x48af79[_0xd4b6('0x25')]=_0x10c950;if(_0xf2d480[_0xd4b6('0x4b')][_0xd4b6('0x5d')]){_0x4317a9[_0xd4b6('0x63')]=[{'all':!![]}];}return db['Disposition'][_0xd4b6('0x5e')](_0x4317a9);})[_0xd4b6('0x14')](function(_0x5e2b7d){_0x48af79[_0xd4b6('0x5f')]=_0x5e2b7d;return _0x48af79;});}})['then'](respondWithFilteredResult(_0x22340b,_0x4317a9))['catch'](handleError(_0x22340b,null));};exports[_0xd4b6('0x6f')]=function(_0x1ecbc9,_0x2f1549){return db[_0xd4b6('0x5c')][_0xd4b6('0x70')]({'where':{'id':_0x1ecbc9[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x2f1549,null))[_0xd4b6('0x14')](function(_0x5a96da){if(_0x5a96da){return _0x5a96da[_0xd4b6('0x6f')](_0x1ecbc9[_0xd4b6('0x4b')][_0xd4b6('0x71')]);}})[_0xd4b6('0x14')](respondWithStatusCode(_0x2f1549,null))[_0xd4b6('0x1d')](handleError(_0x2f1549,null));};exports['addAnswer']=function(_0x98736e,_0x8a1be8){if(_0x98736e[_0xd4b6('0x64')]['id']){delete _0x98736e['body']['id'];}return db[_0xd4b6('0x5c')][_0xd4b6('0x70')]({'where':{'id':_0x98736e[_0xd4b6('0x60')]['id']}})['then'](handleEntityNotFound(_0x8a1be8,null))[_0xd4b6('0x14')](function(_0x410cb5){if(_0x410cb5){_0x98736e[_0xd4b6('0x64')][_0xd4b6('0x72')]=_0x410cb5['id'];return db[_0xd4b6('0x73')][_0xd4b6('0x6c')](_0x98736e[_0xd4b6('0x64')]);}})[_0xd4b6('0x14')](respondWithResult(_0x8a1be8,null))[_0xd4b6('0x1d')](handleError(_0x8a1be8,null));};exports[_0xd4b6('0x74')]=function(_0x2c4fb1,_0x66e566){var _0x176422={'raw':![],'where':{}};var _0xfa8c7a={};var _0x85c4db={'count':0x0,'rows':[]};return db[_0xd4b6('0x5c')]['findOne']({'where':{'id':_0x2c4fb1[_0xd4b6('0x60')]['id']}})['then'](handleEntityNotFound(_0x66e566,null))['then'](function(_0x4c2042){if(_0x4c2042){_0xfa8c7a[_0xd4b6('0x49')]=_[_0xd4b6('0x4c')](db[_0xd4b6('0x73')]['rawAttributes']);_0xfa8c7a[_0xd4b6('0x4b')]=_[_0xd4b6('0x4c')](_0x2c4fb1[_0xd4b6('0x4b')]);_0xfa8c7a['filters']=_[_0xd4b6('0x4e')](_0xfa8c7a[_0xd4b6('0x49')],_0xfa8c7a[_0xd4b6('0x4b')]);_0x176422[_0xd4b6('0x4d')]=_[_0xd4b6('0x4e')](_0xfa8c7a[_0xd4b6('0x49')],qs[_0xd4b6('0x4f')](_0x2c4fb1[_0xd4b6('0x4b')][_0xd4b6('0x4f')]));_0x176422['attributes']=_0x176422[_0xd4b6('0x4d')][_0xd4b6('0x50')]?_0x176422['attributes']:_0xfa8c7a[_0xd4b6('0x49')];if(!_0x2c4fb1[_0xd4b6('0x4b')][_0xd4b6('0x51')](_0xd4b6('0x52'))){_0x176422[_0xd4b6('0x24')]=qs[_0xd4b6('0x24')](_0x2c4fb1[_0xd4b6('0x4b')][_0xd4b6('0x24')]);_0x176422[_0xd4b6('0x22')]=qs[_0xd4b6('0x22')](_0x2c4fb1[_0xd4b6('0x4b')][_0xd4b6('0x22')]);}_0x176422[_0xd4b6('0x75')]=qs[_0xd4b6('0x53')](_0x2c4fb1['query'][_0xd4b6('0x53')]);_0x176422[_0xd4b6('0x54')]=qs[_0xd4b6('0x56')](_[_0xd4b6('0x55')](_0x2c4fb1[_0xd4b6('0x4b')],_0xfa8c7a['filters']));_0x176422[_0xd4b6('0x54')]['MailAccountId']=_0x4c2042['id'];if(_0x2c4fb1[_0xd4b6('0x4b')][_0xd4b6('0x5a')]){_0x176422[_0xd4b6('0x54')]=_[_0xd4b6('0x57')](_0x176422['where'],{'$or':_['map'](_0x176422['attributes'],function(_0x2ea482){var _0x31825e={};_0x31825e[_0x2ea482]={'$like':'%'+_0x2c4fb1[_0xd4b6('0x4b')][_0xd4b6('0x5a')]+'%'};return _0x31825e;})});}_0x176422=_[_0xd4b6('0x57')]({},_0x176422,_0x2c4fb1[_0xd4b6('0x5b')]);return db[_0xd4b6('0x73')]['count']({'where':_0x176422['where']})[_0xd4b6('0x14')](function(_0x9eae0b){_0x85c4db['count']=_0x9eae0b;if(_0x2c4fb1['query'][_0xd4b6('0x5d')]){_0x176422[_0xd4b6('0x63')]=[{'all':!![]}];}return db[_0xd4b6('0x73')][_0xd4b6('0x5e')](_0x176422);})[_0xd4b6('0x14')](function(_0xc83347){_0x85c4db[_0xd4b6('0x5f')]=_0xc83347;return _0x85c4db;});}})[_0xd4b6('0x14')](respondWithFilteredResult(_0x66e566,_0x176422))[_0xd4b6('0x1d')](handleError(_0x66e566,null));};exports[_0xd4b6('0x76')]=function(_0xae8e3d,_0x416c77){return db[_0xd4b6('0x5c')][_0xd4b6('0x70')]({'where':{'id':_0xae8e3d[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x416c77,null))[_0xd4b6('0x14')](function(_0x354b51){if(_0x354b51){return _0x354b51[_0xd4b6('0x76')](_0xae8e3d['query'][_0xd4b6('0x71')]);}})['then'](respondWithStatusCode(_0x416c77,null))[_0xd4b6('0x1d')](handleError(_0x416c77,null));};exports['create']=function(_0x433f4a,_0x4e1601){var _0x421a03={'name':_0x433f4a[_0xd4b6('0x64')]['name'],'key':_0x433f4a[_0xd4b6('0x64')]['key'],'provider':_0x433f4a[_0xd4b6('0x64')]['provider']===_0xd4b6('0x66')?null:_0x433f4a['body'][_0xd4b6('0x65')],'email':_0x433f4a[_0xd4b6('0x64')][_0xd4b6('0x77')],'ListId':_0x433f4a[_0xd4b6('0x64')][_0xd4b6('0x78')],'active':!_[_0xd4b6('0x79')](_0x433f4a[_0xd4b6('0x64')][_0xd4b6('0x7a')])?_0x433f4a[_0xd4b6('0x64')][_0xd4b6('0x7a')]:!![],'description':_0x433f4a[_0xd4b6('0x64')][_0xd4b6('0x7b')]||null};var _0x544590=getAuthenticationOptions(_0x421a03[_0xd4b6('0x65')],_0x433f4a[_0xd4b6('0x64')]);_0x421a03[_0xd4b6('0x42')]=_0x544590['Imap'];_0x421a03[_0xd4b6('0x43')]=_0x544590[_0xd4b6('0x43')];return db[_0xd4b6('0x5c')][_0xd4b6('0x6c')](_0x421a03,{'include':[{'model':db['MailServerOut'],'as':_0xd4b6('0x43')},{'model':db[_0xd4b6('0x45')],'as':'Imap'}]})[_0xd4b6('0x14')](function(_0x52270f){var _0x2bf385=_0x433f4a['user'][_0xd4b6('0x29')]({'plain':!![]});if(!_0x2bf385)throw new Error(_0xd4b6('0x7c'));if(_0x2bf385[_0xd4b6('0x7d')]==='user'){var _0x5a31f1=_0x52270f['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xd4b6('0x2a'),'userProfileId':_0x2bf385[_0xd4b6('0x7e')]},'raw':!![]})[_0xd4b6('0x14')](function(_0x27baba){if(_0x27baba&&_0x27baba[_0xd4b6('0x7f')]===0x0){return db[_0xd4b6('0x2b')]['create']({'name':_0x5a31f1['name'],'resourceId':_0x5a31f1['id'],'type':_0x27baba[_0xd4b6('0x4a')],'sectionId':_0x27baba['id']},{})[_0xd4b6('0x14')](function(){return _0x52270f;});}else{return _0x52270f;}})[_0xd4b6('0x1d')](function(_0x502554){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x502554);throw _0x502554;});}return _0x52270f;})[_0xd4b6('0x14')](respondWithResult(_0x4e1601,0xc9))[_0xd4b6('0x1d')](handleError(_0x4e1601,null));};exports[_0xd4b6('0x80')]=function(_0x4e8645,_0x1426b0){return db['MailAccount'][_0xd4b6('0x6e')]({'where':{'id':_0x4e8645[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x1426b0,null))[_0xd4b6('0x14')](function(_0x4e8af1){if(_0x4e8af1){return _0x4e8af1[_0xd4b6('0x80')]();}return null;})[_0xd4b6('0x14')](respondWithResult(_0x1426b0,null))[_0xd4b6('0x1d')](handleError(_0x1426b0,null));};exports[_0xd4b6('0x81')]=function(_0x119b2a,_0x58b755){if(_0x119b2a[_0xd4b6('0x64')]['id']){delete _0x119b2a[_0xd4b6('0x64')]['id'];}return db[_0xd4b6('0x5c')][_0xd4b6('0x70')]({'where':{'id':_0x119b2a[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x58b755,null))[_0xd4b6('0x14')](function(_0x750fed){if(_0x750fed){_0x119b2a[_0xd4b6('0x64')][_0xd4b6('0x72')]=_0x750fed['id'];return db['MailServerIn'][_0xd4b6('0x6c')](_0x119b2a[_0xd4b6('0x64')]);}})[_0xd4b6('0x14')](respondWithResult(_0x58b755,null))['catch'](handleError(_0x58b755,null));};exports[_0xd4b6('0x82')]=function(_0x3773bc,_0x4dea0c){return db[_0xd4b6('0x5c')][_0xd4b6('0x6e')]({'where':{'id':_0x3773bc[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x4dea0c,null))[_0xd4b6('0x14')](function(_0x292377){if(_0x292377){return _0x292377['setImap'](null);}return null;})[_0xd4b6('0x14')](respondWithStatusCode(_0x4dea0c,null))[_0xd4b6('0x1d')](handleError(_0x4dea0c,null));};exports[_0xd4b6('0x83')]=function(_0x5b4e6e,_0x276e24){return db[_0xd4b6('0x5c')][_0xd4b6('0x6e')]({'where':{'id':_0x5b4e6e[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x276e24,null))[_0xd4b6('0x14')](function(_0x43cb91){if(_0x43cb91){return _0x43cb91['getSmtp']();}return null;})[_0xd4b6('0x14')](respondWithResult(_0x276e24,null))[_0xd4b6('0x1d')](handleError(_0x276e24,null));};exports['addSmtp']=function(_0xab114d,_0x14c38b){if(_0xab114d[_0xd4b6('0x64')]['id']){delete _0xab114d['body']['id'];}return db[_0xd4b6('0x5c')][_0xd4b6('0x70')]({'where':{'id':_0xab114d[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x14c38b,null))[_0xd4b6('0x14')](function(_0x28e22f){if(_0x28e22f){_0xab114d['body'][_0xd4b6('0x72')]=_0x28e22f['id'];return db[_0xd4b6('0x67')][_0xd4b6('0x6c')](_0xab114d[_0xd4b6('0x64')]);}})[_0xd4b6('0x14')](respondWithResult(_0x14c38b,null))[_0xd4b6('0x1d')](handleError(_0x14c38b,null));};exports[_0xd4b6('0x84')]=function(_0x2ce66e,_0x329978){return db[_0xd4b6('0x5c')][_0xd4b6('0x6e')]({'where':{'id':_0x2ce66e[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x329978,null))[_0xd4b6('0x14')](function(_0x5603af){if(_0x5603af){return _0x5603af['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x329978,null))[_0xd4b6('0x1d')](handleError(_0x329978,null));};exports[_0xd4b6('0x85')]=function(_0x55724f,_0x3384de){return db['MailInteraction'][_0xd4b6('0x70')]({'where':{'id':_0x55724f['params']['id']}})['then'](handleEntityNotFound(_0x3384de,null))['then'](function(_0xb53206){if(_0xb53206){return _0xb53206[_0xd4b6('0x85')](_0x55724f['body'][_0xd4b6('0x71')],_[_0xd4b6('0x86')](_0x55724f[_0xd4b6('0x64')],['ids','id'])||{});}})['then'](respondWithResult(_0x3384de,null))['catch'](handleError(_0x3384de,null));};exports[_0xd4b6('0x87')]=function(_0x4fa188,_0x36c4fd){var _0x3e528c={'raw':![],'where':{}};var _0x4b4d2c={};var _0x5ae5ae={'count':0x0,'rows':[]};return db[_0xd4b6('0x5c')]['findOne']({'where':{'id':_0x4fa188[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x36c4fd,null))[_0xd4b6('0x14')](function(_0x5724c8){if(_0x5724c8){_0x4b4d2c['model']=_[_0xd4b6('0x4c')](db[_0xd4b6('0x88')]['rawAttributes']);_0x4b4d2c['query']=_[_0xd4b6('0x4c')](_0x4fa188[_0xd4b6('0x4b')]);_0x4b4d2c[_0xd4b6('0x56')]=_[_0xd4b6('0x4e')](_0x4b4d2c['model'],_0x4b4d2c[_0xd4b6('0x4b')]);_0x3e528c['attributes']=_[_0xd4b6('0x4e')](_0x4b4d2c['model'],qs['fields'](_0x4fa188[_0xd4b6('0x4b')][_0xd4b6('0x4f')]));_0x3e528c[_0xd4b6('0x4d')]=_0x3e528c[_0xd4b6('0x4d')][_0xd4b6('0x50')]?_0x3e528c[_0xd4b6('0x4d')]:_0x4b4d2c[_0xd4b6('0x49')];if(!_0x4fa188[_0xd4b6('0x4b')][_0xd4b6('0x51')](_0xd4b6('0x52'))){_0x3e528c[_0xd4b6('0x24')]=qs[_0xd4b6('0x24')](_0x4fa188[_0xd4b6('0x4b')]['limit']);_0x3e528c[_0xd4b6('0x22')]=qs[_0xd4b6('0x22')](_0x4fa188[_0xd4b6('0x4b')][_0xd4b6('0x22')]);}_0x3e528c[_0xd4b6('0x75')]=qs['sort'](_0x4fa188[_0xd4b6('0x4b')][_0xd4b6('0x53')]);_0x3e528c[_0xd4b6('0x54')]=qs['filters'](_['pick'](_0x4fa188['query'],_0x4b4d2c[_0xd4b6('0x56')]));_0x3e528c[_0xd4b6('0x54')][_0xd4b6('0x72')]=_0x5724c8['id'];if(_0x4fa188[_0xd4b6('0x4b')]['filter']){_0x3e528c[_0xd4b6('0x54')]=_[_0xd4b6('0x57')](_0x3e528c['where'],{'$or':_[_0xd4b6('0x47')](_0x3e528c[_0xd4b6('0x4d')],function(_0x1c5af9){var _0x3a6b5c={};_0x3a6b5c[_0x1c5af9]={'$like':'%'+_0x4fa188[_0xd4b6('0x4b')][_0xd4b6('0x5a')]+'%'};return _0x3a6b5c;})});}_0x3e528c=_[_0xd4b6('0x57')]({},_0x3e528c,_0x4fa188['options']);return db[_0xd4b6('0x88')][_0xd4b6('0x25')]({'where':_0x3e528c[_0xd4b6('0x54')]})[_0xd4b6('0x14')](function(_0x3e5fa1){_0x5ae5ae[_0xd4b6('0x25')]=_0x3e5fa1;if(_0x4fa188[_0xd4b6('0x4b')][_0xd4b6('0x5d')]){_0x3e528c[_0xd4b6('0x63')]=[{'model':db[_0xd4b6('0x89')],'as':_0xd4b6('0x8a'),'required':![]},{'model':db[_0xd4b6('0x8b')],'as':_0xd4b6('0x8c'),'attributes':[_0xd4b6('0x4a'),_0xd4b6('0x8d'),'internal'],'required':![]},{'model':db[_0xd4b6('0x8e')],'as':_0xd4b6('0x8f'),'attributes':['id',_0xd4b6('0x4a'),'color'],'where':_0x4fa188[_0xd4b6('0x4b')]['tag']?{'id':_0x4fa188[_0xd4b6('0x4b')][_0xd4b6('0x90')]}:undefined,'required':_0x4fa188[_0xd4b6('0x4b')]['tag']?!![]:![]}];}return db[_0xd4b6('0x88')][_0xd4b6('0x5e')](_0x3e528c);})[_0xd4b6('0x14')](function(_0x25f8f6){_0x5ae5ae['rows']=_0x25f8f6;return _0x5ae5ae;});}})['then'](respondWithFilteredResult(_0x36c4fd,_0x3e528c))[_0xd4b6('0x1d')](handleError(_0x36c4fd,null));};exports[_0xd4b6('0x91')]=function addApplications(_0x3f4f31,_0x350e23){var _0x4806ad=_0x3f4f31[_0xd4b6('0x60')]['id'];var _0xd8d7fe=_0x3f4f31[_0xd4b6('0x64')];var _0x5e2a66=0xc8;var _0x46a30d=null;return db[_0xd4b6('0x92')][_0xd4b6('0x93')]({'isolationLevel':db[_0xd4b6('0x92')][_0xd4b6('0x94')]['ISOLATION_LEVELS'][_0xd4b6('0x95')]},function(_0x18d38a){return db[_0xd4b6('0x5c')][_0xd4b6('0x6e')]({'where':{'id':_0x4806ad},'transaction':_0x18d38a})['then'](function(_0x206c6e){if(_0x206c6e){return db[_0xd4b6('0x96')][_0xd4b6('0x2c')]({'where':{'MailAccountId':_0x4806ad},'transaction':_0x18d38a})[_0xd4b6('0x14')](function(){var _0x5e9f6f=_['map'](_0xd8d7fe,function(_0xe7141a){_0xe7141a[_0xd4b6('0x72')]=_0x4806ad;return _0xe7141a;});return db['MailApplication'][_0xd4b6('0x97')](_0x5e9f6f,{'transaction':_0x18d38a});});}else{_0x5e2a66=0x194;_0x46a30d=[];}});})[_0xd4b6('0x14')](function(){if(_0x5e2a66!==0x194){return db['MailApplication'][_0xd4b6('0x98')]({'where':{'MailAccountId':_0x4806ad},'order':'priority'})[_0xd4b6('0x14')](function(_0x2b8245){_0x46a30d=_0x2b8245;});}})[_0xd4b6('0x1d')](function(_0x492a91){_0x5e2a66=0x1f4;logger[_0xd4b6('0x1a')](_0x492a91['stack']);if(_0x492a91['name']){delete _0x492a91[_0xd4b6('0x4a')];}_0x46a30d=_0x492a91;})[_0xd4b6('0x99')](function(){if(_0x46a30d===null){_0x350e23[_0xd4b6('0x1e')](_0x5e2a66);}else{if(_0x5e2a66===0x1f4){_0x350e23['status'](_0x5e2a66)[_0xd4b6('0x9a')](_0x46a30d);}else{_0x350e23[_0xd4b6('0x1f')](_0x5e2a66)[_0xd4b6('0x21')](_0x46a30d);}}});};exports['getApplications']=function(_0x39ce39,_0x2a642d){var _0x2e56bd={};var _0x49d4b2={};var _0xfa738c;var _0x4e4de6;return db[_0xd4b6('0x5c')][_0xd4b6('0x6e')]({'where':{'id':_0x39ce39[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x2a642d,null))[_0xd4b6('0x14')](function(_0x4cf796){if(_0x4cf796){_0xfa738c=_0x4cf796;_0x49d4b2[_0xd4b6('0x49')]=_[_0xd4b6('0x4c')](db[_0xd4b6('0x96')][_0xd4b6('0x62')]);_0x49d4b2[_0xd4b6('0x4b')]=_['keys'](_0x39ce39[_0xd4b6('0x4b')]);_0x49d4b2['filters']=_[_0xd4b6('0x4e')](_0x49d4b2[_0xd4b6('0x49')],_0x49d4b2[_0xd4b6('0x4b')]);_0x2e56bd[_0xd4b6('0x4d')]=_[_0xd4b6('0x4e')](_0x49d4b2[_0xd4b6('0x49')],qs[_0xd4b6('0x4f')](_0x39ce39[_0xd4b6('0x4b')][_0xd4b6('0x4f')]));_0x2e56bd[_0xd4b6('0x4d')]=_0x2e56bd[_0xd4b6('0x4d')][_0xd4b6('0x50')]?_0x2e56bd[_0xd4b6('0x4d')]:_0x49d4b2['model'];_0x2e56bd[_0xd4b6('0x75')]=qs[_0xd4b6('0x53')](_0x39ce39[_0xd4b6('0x4b')]['sort']);_0x2e56bd[_0xd4b6('0x54')]=qs['filters'](_[_0xd4b6('0x55')](_0x39ce39[_0xd4b6('0x4b')],_0x49d4b2[_0xd4b6('0x56')]));if(_0x39ce39[_0xd4b6('0x4b')][_0xd4b6('0x5a')]){_0x2e56bd[_0xd4b6('0x54')]=_[_0xd4b6('0x57')](_0x2e56bd[_0xd4b6('0x54')],{'$or':_[_0xd4b6('0x47')](_0x2e56bd[_0xd4b6('0x4d')],function(_0x5dbb01){var _0x3f0d1e={};_0x3f0d1e[_0x5dbb01]={'$like':'%'+_0x39ce39[_0xd4b6('0x4b')][_0xd4b6('0x5a')]+'%'};return _0x3f0d1e;})});}_0x2e56bd=_[_0xd4b6('0x57')]({},_0x2e56bd,_0x39ce39[_0xd4b6('0x5b')]);return _0xfa738c[_0xd4b6('0x9b')](_0x2e56bd);}})[_0xd4b6('0x14')](function(_0x5c0724){if(_0x5c0724){_0x4e4de6=_0x5c0724[_0xd4b6('0x50')];if(!_0x39ce39[_0xd4b6('0x4b')][_0xd4b6('0x51')]('nolimit')){_0x2e56bd[_0xd4b6('0x24')]=qs[_0xd4b6('0x24')](_0x39ce39[_0xd4b6('0x4b')][_0xd4b6('0x24')]);_0x2e56bd[_0xd4b6('0x22')]=qs[_0xd4b6('0x22')](_0x39ce39[_0xd4b6('0x4b')]['offset']);}return _0xfa738c[_0xd4b6('0x9b')](_0x2e56bd);}})[_0xd4b6('0x14')](function(_0x2a26bb){if(_0x2a26bb){return _0x2a26bb?{'count':_0x4e4de6,'rows':_0x2a26bb}:null;}})[_0xd4b6('0x14')](respondWithResult(_0x2a642d,null))[_0xd4b6('0x1d')](handleError(_0x2a642d,null));};exports['getMessages']=function(_0x2a3529,_0x4fe315){var _0xa6815f={'raw':!![],'where':{}};var _0x129bbf={};var _0x2412dd={'count':0x0,'rows':[]};return db[_0xd4b6('0x5c')][_0xd4b6('0x6e')]({'where':{'id':_0x2a3529[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x4fe315,null))['then'](function(_0x58ed3c){if(_0x58ed3c){_0x129bbf[_0xd4b6('0x49')]=_[_0xd4b6('0x4c')](db[_0xd4b6('0x9c')][_0xd4b6('0x62')]);_0x129bbf['query']=_['keys'](_0x2a3529[_0xd4b6('0x4b')]);_0x129bbf[_0xd4b6('0x56')]=_[_0xd4b6('0x4e')](_0x129bbf[_0xd4b6('0x49')],_0x129bbf[_0xd4b6('0x4b')]);_0xa6815f[_0xd4b6('0x4d')]=_[_0xd4b6('0x4e')](_0x129bbf[_0xd4b6('0x49')],qs[_0xd4b6('0x4f')](_0x2a3529[_0xd4b6('0x4b')]['fields']));_0xa6815f[_0xd4b6('0x4d')]=_0xa6815f[_0xd4b6('0x4d')][_0xd4b6('0x50')]?_0xa6815f['attributes']:_0x129bbf[_0xd4b6('0x49')];if(!_0x2a3529[_0xd4b6('0x4b')]['hasOwnProperty'](_0xd4b6('0x52'))){_0xa6815f[_0xd4b6('0x24')]=qs[_0xd4b6('0x24')](_0x2a3529[_0xd4b6('0x4b')]['limit']);_0xa6815f[_0xd4b6('0x22')]=qs[_0xd4b6('0x22')](_0x2a3529['query'][_0xd4b6('0x22')]);}_0xa6815f[_0xd4b6('0x75')]=qs[_0xd4b6('0x53')](_0x2a3529[_0xd4b6('0x4b')][_0xd4b6('0x53')]);_0xa6815f['where']=qs['filters'](_[_0xd4b6('0x55')](_0x2a3529[_0xd4b6('0x4b')],_0x129bbf['filters']));_0xa6815f[_0xd4b6('0x54')][_0xd4b6('0x72')]=_0x58ed3c['id'];if(_0x2a3529[_0xd4b6('0x4b')]['filter']){_0xa6815f[_0xd4b6('0x54')]=_[_0xd4b6('0x57')](_0xa6815f[_0xd4b6('0x54')],{'$or':_[_0xd4b6('0x47')](_0xa6815f[_0xd4b6('0x4d')],function(_0x3d3af3){var _0x4e07d1={};_0x4e07d1[_0x3d3af3]={'$like':'%'+_0x2a3529['query'][_0xd4b6('0x5a')]+'%'};return _0x4e07d1;})});}if(_0x2a3529['query'][_0xd4b6('0x9d')]){var _0x559659=_0x2a3529[_0xd4b6('0x4b')][_0xd4b6('0x9d')]['split'](',');var _0x23057e={};_0x23057e[_0x559659[0x0]]={'$gte':moment(_0x559659[0x1])[_0xd4b6('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0xa6815f[_0xd4b6('0x54')]=_[_0xd4b6('0x57')](_0xa6815f[_0xd4b6('0x54')],_0x23057e);}_0xa6815f=_[_0xd4b6('0x57')]({},_0xa6815f,_0x2a3529[_0xd4b6('0x5b')]);return db['MailMessage'][_0xd4b6('0x25')]({'where':_0xa6815f[_0xd4b6('0x54')]})[_0xd4b6('0x14')](function(_0x5befc8){_0x2412dd['count']=_0x5befc8;if(_0x2a3529[_0xd4b6('0x4b')]['includeAll']){_0xa6815f[_0xd4b6('0x63')]=[{'all':!![]}];}return db['MailMessage'][_0xd4b6('0x5e')](_0xa6815f);})[_0xd4b6('0x14')](function(_0x293671){if(_0x2a3529['query'][_0xd4b6('0x9f')]===_0xd4b6('0xa0')){for(var _0x179711=0x0;_0x179711<_0x293671[_0xd4b6('0x50')];_0x179711++){_0x293671[_0x179711]['body']=juice(_0x293671[_0x179711][_0xd4b6('0x64')]);}}_0x2412dd[_0xd4b6('0x5f')]=_0x293671;return _0x2412dd;});}})[_0xd4b6('0x14')](respondWithFilteredResult(_0x4fe315,_0xa6815f))[_0xd4b6('0x1d')](handleError(_0x4fe315,null));};exports[_0xd4b6('0x9a')]=function(_0x4c2d32,_0x749f40){var _0x36eec1,_0x140395={},_0x4c8432;if(_0x4c2d32[_0xd4b6('0x64')]['to']){_0x4c8432=_0x4c2d32[_0xd4b6('0x64')]['to'][_0xd4b6('0xa1')](',')[0x0];}return db[_0xd4b6('0x5c')][_0xd4b6('0x70')]({'where':{'id':_0x4c2d32['params']['id']},'include':[{'model':db[_0xd4b6('0xa2')],'as':_0xd4b6('0xa3'),'include':[{'model':db[_0xd4b6('0x89')],'as':_0xd4b6('0xa4'),'where':{'email':_0x4c8432},'limit':0x1,'order':[[_0xd4b6('0xa5'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x749f40,null))[_0xd4b6('0x14')](function(_0x3f3f15){if(!_0x3f3f15)return;_0x36eec1=_0x3f3f15;if(!_0x3f3f15[_0xd4b6('0x43')])throw new Error(_0xd4b6('0xa6'));if(_[_0xd4b6('0x79')](_0x4c2d32[_0xd4b6('0x64')]['from'])){_0x4c2d32[_0xd4b6('0x64')][_0xd4b6('0xa7')]=util[_0xd4b6('0x9e')](_0xd4b6('0xa8'),_0x3f3f15[_0xd4b6('0x4a')],_0x3f3f15['email']||_0x3f3f15[_0xd4b6('0x43')][_0xd4b6('0x37')]);}if(_0x4c2d32[_0xd4b6('0x64')][_0xd4b6('0xa9')]&&_0x4c2d32[_0xd4b6('0x64')][_0xd4b6('0xa9')][_0xd4b6('0x50')]){for(var _0x37bbdd=0x0;_0x37bbdd<_0x4c2d32['body']['attachments'][_0xd4b6('0x50')];_0x37bbdd+=0x1){_0x4c2d32['body'][_0xd4b6('0xa9')][_0x37bbdd]={'filename':_0x4c2d32[_0xd4b6('0x64')][_0xd4b6('0xa9')][_0x37bbdd][_0xd4b6('0x4a')],'path':path[_0xd4b6('0xaa')](config['root'],_0xd4b6('0xab'),_0x4c2d32[_0xd4b6('0x64')][_0xd4b6('0xa9')][_0x37bbdd][_0xd4b6('0xac')])};}}var _0x555a17=_0x3f3f15['getSmtpOptions']();return respondWithRpcPromise(_0xd4b6('0xad'),_0xd4b6('0xae'),{'account':_0x555a17,'message':_0x4c2d32['body']});})['then'](function(_0x3b634f){if(!_0x3b634f)return;_0x140395=_0x3b634f;if(!_0x36eec1[_0xd4b6('0xa3')])throw new Error(_0xd4b6('0xaf'));if(_0x36eec1[_0xd4b6('0xa3')]['Contacts'][_0xd4b6('0x50')])return _0x36eec1[_0xd4b6('0xa3')][_0xd4b6('0xa4')][0x0];return db[_0xd4b6('0x89')][_0xd4b6('0x6c')](_['defaults'](_0x4c2d32[_0xd4b6('0x64')],{'firstName':_0x4c2d32[_0xd4b6('0x64')]['to'],'email':_0x4c2d32[_0xd4b6('0x64')]['to'],'phone':_0x4c2d32[_0xd4b6('0x64')]['to'],'ListId':_0x36eec1['ListId']}));})[_0xd4b6('0x14')](function(_0x3d36a5){if(!_0x3d36a5)return;var _0x375d02={'UserId':_0x4c2d32[_0xd4b6('0x37')]['id'],'ContactId':_0x3d36a5['id'],'MailAccountId':_0x36eec1['id'],'inReplyTo':_0x140395[_0xd4b6('0xb0')],'to':_0x4c2d32[_0xd4b6('0x64')]['from'],'cc':_0x4c2d32[_0xd4b6('0x64')]['cc'],'subject':_0x4c2d32[_0xd4b6('0x64')]['subject'],'attach':_0x4c2d32['body'][_0xd4b6('0xb1')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xd4b6('0x9e')](_0xd4b6('0xb2')),'lastMsgDirection':_0xd4b6('0xb3'),'Messages':[_['merge'](_0x4c2d32['body'],{'messageId':_0x140395[_0xd4b6('0xb0')],'sentAt':moment()[_0xd4b6('0x9e')](_0xd4b6('0xb2')),'read':!![],'MailAccountId':_0x36eec1['id'],'UserId':_0x4c2d32[_0xd4b6('0x37')]['id'],'ContactId':_0x3d36a5['id']})]};if(_0x4c2d32[_0xd4b6('0x64')][_0xd4b6('0xb4')]){_0x375d02=_[_0xd4b6('0x57')](_0x375d02,_0x4c2d32[_0xd4b6('0x64')]['Interaction']);}return db[_0xd4b6('0x88')]['create'](_0x375d02,{'include':[{'model':db[_0xd4b6('0x9c')],'as':'Messages'}]});})['then'](respondWithResult(_0x749f40,null))['catch'](handleError(_0x749f40,null));};exports[_0xd4b6('0xb5')]=function(_0x81f98e,_0xb1a9b9){return db[_0xd4b6('0x5c')][_0xd4b6('0x70')]({'where':{'id':_0x81f98e[_0xd4b6('0x60')]['id']},'include':[{'model':db[_0xd4b6('0x67')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xd4b6('0xb6')],'as':_0xd4b6('0xb6'),'raw':!![]}]}]})[_0xd4b6('0x14')](handleEntityNotFound(_0xb1a9b9,null))[_0xd4b6('0x14')](function(_0x3542da){if(!_0x3542da[_0xd4b6('0x43')])return;var _0x574189=_0x3542da[_0xd4b6('0xb7')]();return respondWithRpcPromise(_0xd4b6('0xb8'),_0xd4b6('0xb5'),{'account':_0x574189});})['then'](respondWithResult(_0xb1a9b9,null))[_0xd4b6('0x1d')](handleError(_0xb1a9b9,null));};exports[_0xd4b6('0x2c')]=function(_0x2bba48,_0xd6cb5b){return db[_0xd4b6('0x5c')][_0xd4b6('0x70')]({'where':{'id':_0x2bba48[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0xd6cb5b,null))[_0xd4b6('0x14')](function(_0x2db7fe){if(_0x2db7fe&&_0x2db7fe['service']){throw new db[(_0xd4b6('0xb9'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2db7fe;})[_0xd4b6('0x14')](removeEntity(_0xd6cb5b,null))[_0xd4b6('0x1d')](handleError(_0xd6cb5b,null));};exports[_0xd4b6('0xba')]=function(_0x47120f,_0x6930d7){return db['MailAccount'][_0xd4b6('0x70')]({'where':{'id':_0x47120f['params']['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x6930d7,null))[_0xd4b6('0x14')](function(_0xa8af08){if(_0xa8af08){return _0xa8af08[_0xd4b6('0xba')](_0x47120f[_0xd4b6('0x64')][_0xd4b6('0x71')],_[_0xd4b6('0x86')](_0x47120f[_0xd4b6('0x64')],[_0xd4b6('0x71'),'id'])||{})['spread'](function(_0x2cdc0e){for(var _0x5a1e08=0x0;_0x5a1e08<_0x47120f[_0xd4b6('0x64')][_0xd4b6('0x71')][_0xd4b6('0x50')];_0x5a1e08+=0x1){socket[_0xd4b6('0xbb')](_0xd4b6('0xbc'),{'UserId':Number(_0x47120f[_0xd4b6('0x64')][_0xd4b6('0x71')][_0x5a1e08]),'MailAccountId':Number(_0x47120f[_0xd4b6('0x60')]['id'])});}return _0x2cdc0e;});}})[_0xd4b6('0x14')](respondWithResult(_0x6930d7,null))[_0xd4b6('0x1d')](handleError(_0x6930d7,null));};exports[_0xd4b6('0xbd')]=function(_0x271d44,_0x5ce83f){return db[_0xd4b6('0x5c')][_0xd4b6('0x70')]({'where':{'id':_0x271d44[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x5ce83f,null))[_0xd4b6('0x14')](function(_0x576a80){if(_0x576a80){return _0x576a80[_0xd4b6('0xbd')](_0x271d44[_0xd4b6('0x4b')]['ids'])['then'](function(){if(_[_0xd4b6('0xbe')](_0x271d44[_0xd4b6('0x4b')][_0xd4b6('0x71')])){for(var _0x4ee03a=0x0;_0x4ee03a<_0x271d44[_0xd4b6('0x4b')][_0xd4b6('0x71')][_0xd4b6('0x50')];_0x4ee03a+=0x1){socket[_0xd4b6('0xbb')](_0xd4b6('0xbf'),{'UserId':Number(_0x271d44[_0xd4b6('0x4b')][_0xd4b6('0x71')][_0x4ee03a]),'MailAccountId':Number(_0x271d44[_0xd4b6('0x60')]['id'])});}}else{socket[_0xd4b6('0xbb')](_0xd4b6('0xbf'),{'UserId':Number(_0x271d44[_0xd4b6('0x4b')][_0xd4b6('0x71')]),'MailAccountId':Number(_0x271d44[_0xd4b6('0x60')]['id'])});}});}})[_0xd4b6('0x14')](respondWithStatusCode(_0x5ce83f,null))[_0xd4b6('0x1d')](handleError(_0x5ce83f,null));};exports['getAgents']=function(_0x3be7c3,_0x306c38){var _0x31aebc={};var _0x422603={};var _0x30b38a;var _0x3783c1;return db['MailAccount'][_0xd4b6('0x6e')]({'where':{'id':_0x3be7c3[_0xd4b6('0x60')]['id']}})[_0xd4b6('0x14')](handleEntityNotFound(_0x306c38,null))[_0xd4b6('0x14')](function(_0x241e15){if(_0x241e15){_0x30b38a=_0x241e15;_0x422603[_0xd4b6('0x49')]=_['keys'](db[_0xd4b6('0x8b')][_0xd4b6('0x62')]);_0x422603[_0xd4b6('0x4b')]=_[_0xd4b6('0x4c')](_0x3be7c3[_0xd4b6('0x4b')]);_0x422603[_0xd4b6('0x56')]=_[_0xd4b6('0x4e')](_0x422603[_0xd4b6('0x49')],_0x422603[_0xd4b6('0x4b')]);_0x31aebc[_0xd4b6('0x4d')]=_[_0xd4b6('0x4e')](_0x422603['model'],qs[_0xd4b6('0x4f')](_0x3be7c3['query']['fields']));_0x31aebc[_0xd4b6('0x4d')]=_0x31aebc[_0xd4b6('0x4d')]['length']?_0x31aebc[_0xd4b6('0x4d')]:_0x422603[_0xd4b6('0x49')];_0x31aebc[_0xd4b6('0x75')]=qs[_0xd4b6('0x53')](_0x3be7c3[_0xd4b6('0x4b')][_0xd4b6('0x53')]);_0x31aebc['where']=qs['filters'](_[_0xd4b6('0x55')](_0x3be7c3['query'],_0x422603[_0xd4b6('0x56')]));if(_0x3be7c3[_0xd4b6('0x4b')][_0xd4b6('0x5a')]){_0x31aebc[_0xd4b6('0x54')]=_[_0xd4b6('0x57')](_0x31aebc[_0xd4b6('0x54')],{'$or':_['map'](_0x31aebc['attributes'],function(_0x54274a){var _0x4dc7d6={};_0x4dc7d6[_0x54274a]={'$like':'%'+_0x3be7c3[_0xd4b6('0x4b')][_0xd4b6('0x5a')]+'%'};return _0x4dc7d6;})});}_0x31aebc=_[_0xd4b6('0x57')]({},_0x31aebc,_0x3be7c3[_0xd4b6('0x5b')]);return _0x30b38a['getAgents'](_0x31aebc);}})[_0xd4b6('0x14')](function(_0x598c8d){if(_0x598c8d){_0x3783c1=_0x598c8d[_0xd4b6('0x50')];if(!_0x3be7c3[_0xd4b6('0x4b')]['hasOwnProperty'](_0xd4b6('0x52'))){_0x31aebc[_0xd4b6('0x24')]=qs['limit'](_0x3be7c3['query'][_0xd4b6('0x24')]);_0x31aebc[_0xd4b6('0x22')]=qs[_0xd4b6('0x22')](_0x3be7c3['query'][_0xd4b6('0x22')]);}return _0x30b38a[_0xd4b6('0xc0')](_0x31aebc);}})[_0xd4b6('0x14')](function(_0x2b5304){if(_0x2b5304){return _0x2b5304?{'count':_0x3783c1,'rows':_0x2b5304}:null;}})[_0xd4b6('0x14')](respondWithResult(_0x306c38,null))[_0xd4b6('0x1d')](handleError(_0x306c38,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index d7f870a..d8cedac 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 _0x1335=['MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x233fce,_0x185d34){var _0x1499c1=function(_0x16ec05){while(--_0x16ec05){_0x233fce['push'](_0x233fce['shift']());}};_0x1499c1(++_0x185d34);}(_0x1335,0xe6));var _0x5133=function(_0x5bdeaf,_0x55c710){_0x5bdeaf=_0x5bdeaf-0x0;var _0x1805cf=_0x1335[_0x5bdeaf];return _0x1805cf;};'use strict';var EventEmitter=require(_0x5133('0x0'));var MailAccount=require(_0x5133('0x1'))['db'][_0x5133('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5133('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5133('0x4'),'afterDestroy':_0x5133('0x5')};function emitEvent(_0xeee5e5){return function(_0x357091,_0x33f5db,_0x9f5c53){MailAccountEvents['emit'](_0xeee5e5+':'+_0x357091['id'],_0x357091);MailAccountEvents[_0x5133('0x6')](_0xeee5e5,_0x357091);_0x9f5c53(null);};}for(var e in events){if(events[_0x5133('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x4ca4=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x4ca4,0x100));var _0x44ca=function(_0x338266,_0x56d9f9){_0x338266=_0x338266-0x0;var _0x27a17e=_0x4ca4[_0x338266];return _0x27a17e;};'use strict';var EventEmitter=require(_0x44ca('0x0'));var MailAccount=require(_0x44ca('0x1'))['db'][_0x44ca('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x44ca('0x3')](0x0);var events={'afterCreate':_0x44ca('0x4'),'afterUpdate':_0x44ca('0x5'),'afterDestroy':_0x44ca('0x6')};function emitEvent(_0x1b81d1){return function(_0x48981c,_0xe448af,_0x15e23d){MailAccountEvents[_0x44ca('0x7')](_0x1b81d1+':'+_0x48981c['id'],_0x48981c);MailAccountEvents[_0x44ca('0x7')](_0x1b81d1,_0x48981c);_0x15e23d(null);};}for(var e in events){if(events[_0x44ca('0x8')](e)){var event=events[e];MailAccount[_0x44ca('0x9')](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 20dc5ed..904c374 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 _0xd36c=['data5','pass','./mailAccount.attributes','exports','define','MailAccount','custom','service','provider','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','auth','user'];(function(_0x2e9c4f,_0x402103){var _0x317bb4=function(_0x3b76c7){while(--_0x3b76c7){_0x2e9c4f['push'](_0x2e9c4f['shift']());}};_0x317bb4(++_0x402103);}(_0xd36c,0x92));var _0xcd36=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0xd36c[_0x32b993];return _0x482780;};'use strict';var attributes=require(_0xcd36('0x0'));module[_0xcd36('0x1')]=function(_0xe7dd79){return _0xe7dd79[_0xcd36('0x2')](_0xcd36('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xec7a30=this;var _0x535ec7={'id':_0xec7a30['id'],'tls':{'rejectUnauthorized':![]}};if(_0xec7a30['provider']!==_0xcd36('0x4')){_0x535ec7[_0xcd36('0x5')]=_0xec7a30[_0xcd36('0x6')];}else{_0x535ec7[_0xcd36('0x7')]=_0xec7a30['Smtp'][_0xcd36('0x7')];_0x535ec7[_0xcd36('0x8')]=_0xec7a30[_0xcd36('0x9')][_0xcd36('0x8')];_0x535ec7[_0xcd36('0xa')]=_0xec7a30['Smtp'][_0xcd36('0xa')];}if(_0xec7a30[_0xcd36('0x9')][_0xcd36('0xb')]){if(_0xec7a30[_0xcd36('0x9')][_0xcd36('0xc')]){if(!_0xec7a30['Smtp'][_0xcd36('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x535ec7[_0xcd36('0xe')]={'type':'OAuth2','user':_0xec7a30[_0xcd36('0x9')][_0xcd36('0xf')],'accessToken':_0xec7a30[_0xcd36('0x9')][_0xcd36('0xd')][_0xcd36('0x10')]};}else{_0x535ec7[_0xcd36('0xe')]={'user':_0xec7a30['Smtp'][_0xcd36('0xf')],'pass':_0xec7a30[_0xcd36('0x9')][_0xcd36('0x11')]};}}return _0x535ec7;}}});}; \ No newline at end of file +var _0x42b8=['provider','custom','service','host','port','secure','Smtp','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x1933b1,_0x203e96){var _0x2c0bb8=function(_0x2dc5aa){while(--_0x2dc5aa){_0x1933b1['push'](_0x1933b1['shift']());}};_0x2c0bb8(++_0x203e96);}(_0x42b8,0x136));var _0x842b=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x42b8[_0x46e363];return _0x3fb059;};'use strict';var attributes=require(_0x842b('0x0'));module[_0x842b('0x1')]=function(_0x20836e){return _0x20836e[_0x842b('0x2')](_0x842b('0x3'),attributes,{'tableName':_0x842b('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x973e07=this;var _0x4ee762={'id':_0x973e07['id'],'tls':{'rejectUnauthorized':![]}};if(_0x973e07[_0x842b('0x5')]!==_0x842b('0x6')){_0x4ee762[_0x842b('0x7')]=_0x973e07[_0x842b('0x5')];}else{_0x4ee762['host']=_0x973e07['Smtp'][_0x842b('0x8')];_0x4ee762[_0x842b('0x9')]=_0x973e07['Smtp'][_0x842b('0x9')];_0x4ee762[_0x842b('0xa')]=_0x973e07[_0x842b('0xb')]['secure'];}if(_0x973e07['Smtp'][_0x842b('0xc')]){if(_0x973e07[_0x842b('0xb')][_0x842b('0xd')]){if(!_0x973e07[_0x842b('0xb')][_0x842b('0xe')])throw new Error(_0x842b('0xf'));_0x4ee762[_0x842b('0x10')]={'type':_0x842b('0x11'),'user':_0x973e07[_0x842b('0xb')][_0x842b('0x12')],'accessToken':_0x973e07[_0x842b('0xb')][_0x842b('0xe')][_0x842b('0x13')]};}else{_0x4ee762[_0x842b('0x10')]={'user':_0x973e07[_0x842b('0xb')][_0x842b('0x12')],'pass':_0x973e07[_0x842b('0xb')][_0x842b('0x14')]};}}return _0x4ee762;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f9c6985..31a0eaf 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 _0x24ca=['localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','attributes','limit','include','map','model','GetMailAccount','debug','ShowMailAccount','MailAccount','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','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','from','find','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','list','applications','orderBy','priority','asc','autoclose','push','length','close','create','List\x20not\x20found','contact','messageId','generate','attach','format','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','agent','*,*,*,*','MailQueue','queue','waitForTheAssignedQueue','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x24ca,0x1bc));var _0xa24c=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0x24ca[_0x254d9f];return _0x1eedb9;};'use strict';var _=require(_0xa24c('0x0'));var moment=require('moment');var BPromise=require(_0xa24c('0x1'));var rs=require(_0xa24c('0x2'));var Redis=require(_0xa24c('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xa24c('0x4'))(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var jayson=require(_0xa24c('0x7'));var client=jayson[_0xa24c('0x8')][_0xa24c('0x9')]({'port':0x232c});config[_0xa24c('0xa')]=_[_0xa24c('0xb')](config[_0xa24c('0xa')],{'host':_0xa24c('0xc'),'port':0x18eb});var socket=require(_0xa24c('0xd'))(new Redis(config['redis']));require(_0xa24c('0xe'))[_0xa24c('0xf')](socket);function respondWithRpcPromise(_0x2d645c,_0x5eac78,_0x399f32){return new BPromise(function(_0x325c6d,_0x288f76){return client[_0xa24c('0x10')](_0x2d645c,_0x399f32)[_0xa24c('0x11')](function(_0x43aa5a){logger[_0xa24c('0x12')](_0xa24c('0x13'),_0x5eac78,_0xa24c('0x14'));logger['debug'](_0xa24c('0x15'),_0x5eac78,_0xa24c('0x14'),JSON[_0xa24c('0x16')](_0x43aa5a));if(_0x43aa5a[_0xa24c('0x17')]){if(_0x43aa5a['error'][_0xa24c('0x18')]===0x1f4){logger[_0xa24c('0x17')](_0xa24c('0x13'),_0x5eac78,_0x43aa5a[_0xa24c('0x17')][_0xa24c('0x19')]);return _0x288f76(_0x43aa5a[_0xa24c('0x17')][_0xa24c('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x5eac78,_0x43aa5a[_0xa24c('0x17')][_0xa24c('0x19')]);return _0x325c6d(_0x43aa5a['error']['message']);}else{logger[_0xa24c('0x12')](_0xa24c('0x13'),_0x5eac78,'request\x20sent');_0x325c6d(_0x43aa5a[_0xa24c('0x1a')]['message']);}})[_0xa24c('0x1b')](function(_0x2a610a){logger[_0xa24c('0x17')](_0xa24c('0x13'),_0x5eac78,_0x2a610a);_0x288f76(_0x2a610a);});});}exports['GetMailAccount']=function(_0x16d363){var _0x18b7e0=this;return new Promise(function(_0x773f70,_0x4d4bab){return db['MailAccount']['findAll']({'raw':_0x16d363['options']?_0x16d363[_0xa24c('0x1c')][_0xa24c('0x1d')]===undefined?!![]:![]:!![],'where':_0x16d363[_0xa24c('0x1c')]?_0x16d363[_0xa24c('0x1c')]['where']||null:null,'attributes':_0x16d363[_0xa24c('0x1c')]?_0x16d363['options'][_0xa24c('0x1e')]||null:null,'limit':_0x16d363[_0xa24c('0x1c')]?_0x16d363['options'][_0xa24c('0x1f')]||null:null,'include':_0x16d363[_0xa24c('0x1c')]?_0x16d363[_0xa24c('0x1c')][_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x16d363['options'][_0xa24c('0x20')],function(_0x5cc9cb){return{'model':db[_0x5cc9cb[_0xa24c('0x22')]],'as':_0x5cc9cb['as'],'attributes':_0x5cc9cb[_0xa24c('0x1e')],'include':_0x5cc9cb[_0xa24c('0x20')]?_['map'](_0x5cc9cb[_0xa24c('0x20')],function(_0x31c4d9){return{'model':db[_0x31c4d9[_0xa24c('0x22')]],'as':_0x31c4d9['as'],'attributes':_0x31c4d9[_0xa24c('0x1e')],'include':_0x31c4d9[_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x31c4d9[_0xa24c('0x20')],function(_0x5b23f4){return{'model':db[_0x5b23f4[_0xa24c('0x22')]],'as':_0x5b23f4['as'],'attributes':_0x5b23f4[_0xa24c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa24c('0x11')](function(_0x12dbdc){logger['info'](_0xa24c('0x23'),_0x16d363);logger[_0xa24c('0x24')](_0xa24c('0x23'),_0x16d363,JSON['stringify'](_0x12dbdc));_0x773f70(_0x12dbdc);})[_0xa24c('0x1b')](function(_0x3dcb1b){logger[_0xa24c('0x17')]('GetMailAccount',_0x3dcb1b[_0xa24c('0x19')],_0x16d363);_0x4d4bab(_0x18b7e0['error'](0x1f4,_0x3dcb1b[_0xa24c('0x19')]));});});};exports[_0xa24c('0x25')]=function(_0x1a247b){var _0x5d025a=this;return new Promise(function(_0x1f52f8,_0x53f90){return db[_0xa24c('0x26')]['find']({'raw':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b['options'][_0xa24c('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b['options']['where']||null:null,'attributes':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b[_0xa24c('0x1c')][_0xa24c('0x1e')]||null:null,'include':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b[_0xa24c('0x1c')][_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x1a247b['options'][_0xa24c('0x20')],function(_0x3ea442){return{'model':db[_0x3ea442[_0xa24c('0x22')]],'as':_0x3ea442['as'],'attributes':_0x3ea442[_0xa24c('0x1e')],'include':_0x3ea442[_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x3ea442[_0xa24c('0x20')],function(_0x81d471){return{'model':db[_0x81d471[_0xa24c('0x22')]],'as':_0x81d471['as'],'attributes':_0x81d471[_0xa24c('0x1e')],'include':_0x81d471['include']?_[_0xa24c('0x21')](_0x81d471[_0xa24c('0x20')],function(_0x2b362d){return{'model':db[_0x2b362d[_0xa24c('0x22')]],'as':_0x2b362d['as'],'attributes':_0x2b362d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19a65f){if(_0x1a247b['options'][_0xa24c('0x27')]===!![])_0x19a65f[_0xa24c('0x28')](_0xa24c('0x29'),_0x19a65f[_0xa24c('0x2a')]());logger[_0xa24c('0x12')]('ShowMailAccount',_0x1a247b);logger['debug'](_0xa24c('0x25'),_0x1a247b,JSON[_0xa24c('0x16')](_0x19a65f));_0x1f52f8(_0x19a65f);})[_0xa24c('0x1b')](function(_0x213dc3){logger[_0xa24c('0x17')](_0xa24c('0x25'),_0x213dc3['message'],_0x1a247b);_0x53f90(_0x5d025a['error'](0x1f4,_0x213dc3[_0xa24c('0x19')]));});});};exports[_0xa24c('0x2b')]=function(_0x4037d6){var _0x2101f8=this;return new Promise(function(_0x43beff,_0x4c5b7e){var _0x171c51={'body':_0x4037d6[_0xa24c('0x2c')],'channel':'mail'};var _0x599627=_[_0xa24c('0x2d')](_[_0xa24c('0x2e')](db[_0xa24c('0x2f')]['rawAttributes']),['createdAt',_0xa24c('0x30'),_0xa24c('0x31'),_0xa24c('0x32')]);var _0x3ccc37=![];if(_0x4037d6[_0xa24c('0x2c')]['id']){delete _0x4037d6[_0xa24c('0x2c')]['id'];}if(_[_0xa24c('0x33')](_0x4037d6[_0xa24c('0x2c')]['from'])){return _0x4c5b7e(_0x2101f8['error'](0x1f4,_0xa24c('0x34')));}if(_[_0xa24c('0x33')](_0x4037d6[_0xa24c('0x2c')]['body'])||_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x2c')]===''){return _0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0xa24c('0x35')));}if(_[_0xa24c('0x33')](_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x36')])){return _0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0xa24c('0x37')+_0x599627));}if(!_[_0xa24c('0x38')](_0x599627,_0x4037d6['body'][_0xa24c('0x36')])){return _0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0xa24c('0x39')+_0x599627));}var _0x5aa2b2={};_0x5aa2b2[_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x36')]]=_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x3a')];return db[_0xa24c('0x26')][_0xa24c('0x3b')]({'where':{'id':_0x4037d6[_0xa24c('0x3c')]['id']},'include':[{'model':db[_0xa24c('0x3d')],'as':_0xa24c('0x3e'),'include':[{'model':db[_0xa24c('0x2f')],'as':_0xa24c('0x3f'),'where':_0x5aa2b2,'limit':0x1,'order':[['updatedAt',_0xa24c('0x40')]]}]},{'model':db[_0xa24c('0x41')],'as':_0xa24c('0x42')},{'model':db[_0xa24c('0x43')],'as':_0xa24c('0x44'),'include':[{'model':db[_0xa24c('0x45')],'as':_0xa24c('0x45')}]}]})[_0xa24c('0x11')](function(_0x184179){if(_0x184179&&_0x184179['List']){var _0x540da8=_0x184179[_0xa24c('0x46')]({'plain':!![]});_0x171c51['account']=_[_0xa24c('0x47')](_0x540da8,[_0xa24c('0x42'),'List']);_0x171c51[_0xa24c('0x3c')][_0xa24c('0x29')]=_0x184179[_0xa24c('0x2a')]();_0x171c51['applications']=_0x540da8['Applications'];_0x171c51[_0xa24c('0x48')]=_0x540da8['List'];_0x171c51[_0xa24c('0x49')]=_[_0xa24c('0x4a')](_0x171c51[_0xa24c('0x49')],[_0xa24c('0x4b')],[_0xa24c('0x4c')]);if(_0x171c51[_0xa24c('0x3c')]&&_0x171c51[_0xa24c('0x3c')][_0xa24c('0x4d')]){_0x171c51[_0xa24c('0x49')][_0xa24c('0x4e')]({'id':0x0,'priority':_0x171c51['applications'][_0xa24c('0x4f')]+0x1,'app':_0xa24c('0x50'),'appdata':_0xa24c('0x4d'),'interval':'*,*,*,*'});}if(_0x171c51['account']['Applications']){delete _0x171c51[_0xa24c('0x3c')]['Applications'];}if(_0x171c51[_0xa24c('0x3c')][_0xa24c('0x3e')]){delete _0x171c51['account'][_0xa24c('0x3e')];}if(_0x540da8[_0xa24c('0x3e')][_0xa24c('0x3f')][_0xa24c('0x4f')]){return _0x540da8[_0xa24c('0x3e')][_0xa24c('0x3f')][0x0];}var _0x3816f7=_[_0xa24c('0xb')](_0x4037d6['body'],{'firstName':_0x4037d6[_0xa24c('0x2c')]['from'],'ListId':_0x540da8['ListId']});_0x3816f7[_0x4037d6['body']['mapKey']]=_0x4037d6['body'][_0xa24c('0x3a')];return db['CmContact'][_0xa24c('0x51')](_0x3816f7);}else{throw new Error(_0xa24c('0x52'));}})[_0xa24c('0x11')](function(_0x1a5f17){_0x171c51[_0xa24c('0x53')]=_0x1a5f17;if(_0x1a5f17){if(!_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x54')]){_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x54')]=rs[_0xa24c('0x55')]()+'\x20'+_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x3a')];}var _0x5c3d11={'ContactId':_0x1a5f17['id'],'MailAccountId':_0x4037d6[_0xa24c('0x3c')]['id'],'inReplyTo':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x54')],'to':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x3a')],'cc':_0x4037d6['body']['message']['cc'],'subject':_0x4037d6[_0xa24c('0x2c')]['message']['subject'],'attach':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x56')],'lastMsgAt':moment()[_0xa24c('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa24c('0x3b')]({'where':{'closed':![],'MailAccountId':_0x4037d6['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xa24c('0x58'),'attributes':[_0xa24c('0x54')],'where':{'messageId':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x59')]}}]})[_0xa24c('0x11')](function(_0x5c3285){if(_0x5c3285){return[_0x5c3285,![]];}return db[_0xa24c('0x5a')][_0xa24c('0x51')](_0x5c3d11)[_0xa24c('0x11')](function(_0x4bee5c){return[_0x4bee5c,!![]];});});}else{throw new Error(_0xa24c('0x5b'));}})[_0xa24c('0x5c')](function(_0x21439a,_0x7aab6e){if(_0x21439a){_0x3ccc37=_0x7aab6e;if(!_0x7aab6e){return _0x21439a[_0xa24c('0x5d')]({'inReplyTo':_0x4037d6['body'][_0xa24c('0x19')][_0xa24c('0x54')],'to':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x3a')],'cc':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['cc'],'subject':_0x4037d6['body'][_0xa24c('0x19')][_0xa24c('0x5e')],'attach':_0x21439a['attach']?_0x21439a[_0xa24c('0x56')]:_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x56')],'substatus':null,'substatusAt':moment()[_0xa24c('0x57')](_0xa24c('0x5f')),'lastMsgAt':moment()[_0xa24c('0x57')](_0xa24c('0x5f')),'lastMsgDirection':'in'});}else{return _0x21439a;}}})[_0xa24c('0x11')](function(_0x32ddc3){_0x171c51['interaction']=_0x32ddc3[_0xa24c('0x46')]({'plain':!![]});_0x171c51[_0xa24c('0x60')][_0xa24c('0x61')]=_0x3ccc37;return db['MailMessage'][_0xa24c('0x51')]({'body':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x2c')],'MailAccountId':_0x4037d6['account']['id'],'MailInteractionId':_0x32ddc3['id'],'direction':'in','ContactId':_0x171c51[_0xa24c('0x53')]['id'],'messageId':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x54')],'from':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['from'],'to':_0x4037d6['body'][_0xa24c('0x19')]['to'],'cc':_0x4037d6['body'][_0xa24c('0x19')]['cc'],'subject':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x5e')],'attach':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x56')],'Attachments':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x62')],'originTo':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['originTo'],'originCc':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x63')],'bcc':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x64')],'ChatWebsiteId':_0x4037d6['body'][_0xa24c('0x19')][_0xa24c('0x65')]||null,'originChannel':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['originChannel']||_0xa24c('0x66'),'ChatOfflineMessageId':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x67')]||null},{'include':[{'model':db[_0xa24c('0x68')],'as':_0xa24c('0x69')}]});})[_0xa24c('0x11')](function(_0x8bd3fb){_0x171c51[_0xa24c('0x19')]=_0x8bd3fb;if(!_0x171c51[_0xa24c('0x60')][_0xa24c('0x6a')]){return;}return db['User'][_0xa24c('0x3b')]({'attributes':['id',_0xa24c('0x6b')],'where':{'id':_0x171c51[_0xa24c('0x60')][_0xa24c('0x6a')]}});})[_0xa24c('0x11')](function(_0x209b42){if(_0x209b42){_0x171c51[_0xa24c('0x49')][_0xa24c('0x6c')]({'id':0x0,'priority':0x0,'app':_0xa24c('0x6d'),'appdata':_0x209b42[_0xa24c('0x6b')]+','+(_0x171c51[_0xa24c('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0xa24c('0x6e')});}if(!_0x171c51[_0xa24c('0x60')]['queueId']){return;}return db[_0xa24c('0x6f')][_0xa24c('0x3b')]({'attributes':['id',_0xa24c('0x6b')],'where':{'id':_0x171c51['interaction']['queueId']}});})[_0xa24c('0x11')](function(_0x4c9b19){if(_0x4c9b19){_0x171c51['applications'][_0xa24c('0x6c')]({'id':0x0,'priority':0x1,'app':_0xa24c('0x70'),'appdata':_0x4c9b19[_0xa24c('0x6b')]+','+(_0x171c51[_0xa24c('0x3c')][_0xa24c('0x71')]||0x12c),'interval':_0xa24c('0x6e')});}return respondWithRpcPromise('Start','startRouting',_0x171c51);})['then'](function(_0x263dab){_0x43beff(_0x263dab);})['catch'](function(_0x53462e){_0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0x53462e[_0xa24c('0x19')]));});});}; \ No newline at end of file +var _0x2675=['originChannel','Email','Attachment','Attachments','UserId','User','name','unshift','agent','queueId','MailQueue','waitForTheAssignedQueue','Start','startRouting','lodash','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailAccount.socket','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','where','include','map','model','attributes','ShowMailAccount','find','raw','setDataValue','smtpOptions','getSmtpOptions','body','mail','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','CmContact','Applications','MailServerOut','CloudProvider','get','omit','applications','list','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','from','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','interaction','attachments','originTo','originCc'];(function(_0x4826dc,_0x4f5fde){var _0xb0dc35=function(_0x363d02){while(--_0x363d02){_0x4826dc['push'](_0x4826dc['shift']());}};_0xb0dc35(++_0x4f5fde);}(_0x2675,0x75));var _0x5267=function(_0x41b34e,_0xec8023){_0x41b34e=_0x41b34e-0x0;var _0x3bd7b7=_0x2675[_0x41b34e];return _0x3bd7b7;};'use strict';var _=require(_0x5267('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require(_0x5267('0x1'));var db=require(_0x5267('0x2'))['db'];var logger=require('../../config/logger')(_0x5267('0x3'));var config=require(_0x5267('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x5267('0x5')][_0x5267('0x6')]({'port':0x232c});config[_0x5267('0x7')]=_[_0x5267('0x8')](config[_0x5267('0x7')],{'host':_0x5267('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5267('0x7')]));require(_0x5267('0xa'))['register'](socket);function respondWithRpcPromise(_0x799fcc,_0x5d6645,_0x3ff4e9){return new BPromise(function(_0x207d47,_0x26e22b){return client['request'](_0x799fcc,_0x3ff4e9)[_0x5267('0xb')](function(_0x5060b3){logger[_0x5267('0xc')]('MailAccount,\x20%s,\x20%s',_0x5d6645,_0x5267('0xd'));logger[_0x5267('0xe')](_0x5267('0xf'),_0x5d6645,_0x5267('0xd'),JSON[_0x5267('0x10')](_0x5060b3));if(_0x5060b3[_0x5267('0x11')]){if(_0x5060b3[_0x5267('0x11')][_0x5267('0x12')]===0x1f4){logger[_0x5267('0x11')](_0x5267('0x13'),_0x5d6645,_0x5060b3[_0x5267('0x11')][_0x5267('0x14')]);return _0x26e22b(_0x5060b3[_0x5267('0x11')]['message']);}logger['error'](_0x5267('0x13'),_0x5d6645,_0x5060b3[_0x5267('0x11')][_0x5267('0x14')]);return _0x207d47(_0x5060b3[_0x5267('0x11')][_0x5267('0x14')]);}else{logger[_0x5267('0xc')](_0x5267('0x13'),_0x5d6645,_0x5267('0xd'));_0x207d47(_0x5060b3[_0x5267('0x15')][_0x5267('0x14')]);}})[_0x5267('0x16')](function(_0x1ab03){logger['error'](_0x5267('0x13'),_0x5d6645,_0x1ab03);_0x26e22b(_0x1ab03);});});}exports[_0x5267('0x17')]=function(_0x5069e8){var _0x20cb50=this;return new Promise(function(_0x56733e,_0x1cf835){return db[_0x5267('0x18')][_0x5267('0x19')]({'raw':_0x5069e8[_0x5267('0x1a')]?_0x5069e8[_0x5267('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5069e8[_0x5267('0x1a')]?_0x5069e8['options'][_0x5267('0x1b')]||null:null,'attributes':_0x5069e8[_0x5267('0x1a')]?_0x5069e8[_0x5267('0x1a')]['attributes']||null:null,'limit':_0x5069e8['options']?_0x5069e8['options']['limit']||null:null,'include':_0x5069e8['options']?_0x5069e8[_0x5267('0x1a')][_0x5267('0x1c')]?_[_0x5267('0x1d')](_0x5069e8[_0x5267('0x1a')][_0x5267('0x1c')],function(_0x40d1be){return{'model':db[_0x40d1be[_0x5267('0x1e')]],'as':_0x40d1be['as'],'attributes':_0x40d1be[_0x5267('0x1f')],'include':_0x40d1be[_0x5267('0x1c')]?_['map'](_0x40d1be['include'],function(_0x354111){return{'model':db[_0x354111[_0x5267('0x1e')]],'as':_0x354111['as'],'attributes':_0x354111['attributes'],'include':_0x354111[_0x5267('0x1c')]?_['map'](_0x354111['include'],function(_0x43e7e7){return{'model':db[_0x43e7e7[_0x5267('0x1e')]],'as':_0x43e7e7['as'],'attributes':_0x43e7e7[_0x5267('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5267('0xb')](function(_0x33c431){logger['info']('GetMailAccount',_0x5069e8);logger[_0x5267('0xe')](_0x5267('0x17'),_0x5069e8,JSON[_0x5267('0x10')](_0x33c431));_0x56733e(_0x33c431);})['catch'](function(_0x58d685){logger[_0x5267('0x11')](_0x5267('0x17'),_0x58d685[_0x5267('0x14')],_0x5069e8);_0x1cf835(_0x20cb50['error'](0x1f4,_0x58d685['message']));});});};exports[_0x5267('0x20')]=function(_0xc7691d){var _0x40cec1=this;return new Promise(function(_0x189ed7,_0x5bbb83){return db[_0x5267('0x18')][_0x5267('0x21')]({'raw':_0xc7691d[_0x5267('0x1a')]?_0xc7691d[_0x5267('0x1a')][_0x5267('0x22')]===undefined?!![]:![]:!![],'where':_0xc7691d[_0x5267('0x1a')]?_0xc7691d[_0x5267('0x1a')][_0x5267('0x1b')]||null:null,'attributes':_0xc7691d['options']?_0xc7691d['options'][_0x5267('0x1f')]||null:null,'include':_0xc7691d['options']?_0xc7691d[_0x5267('0x1a')][_0x5267('0x1c')]?_[_0x5267('0x1d')](_0xc7691d[_0x5267('0x1a')]['include'],function(_0x305863){return{'model':db[_0x305863[_0x5267('0x1e')]],'as':_0x305863['as'],'attributes':_0x305863[_0x5267('0x1f')],'include':_0x305863[_0x5267('0x1c')]?_[_0x5267('0x1d')](_0x305863[_0x5267('0x1c')],function(_0x1de80a){return{'model':db[_0x1de80a[_0x5267('0x1e')]],'as':_0x1de80a['as'],'attributes':_0x1de80a['attributes'],'include':_0x1de80a[_0x5267('0x1c')]?_['map'](_0x1de80a[_0x5267('0x1c')],function(_0x335c0e){return{'model':db[_0x335c0e[_0x5267('0x1e')]],'as':_0x335c0e['as'],'attributes':_0x335c0e[_0x5267('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5267('0xb')](function(_0x33ecd7){if(_0xc7691d[_0x5267('0x1a')]['smtp']===!![])_0x33ecd7[_0x5267('0x23')](_0x5267('0x24'),_0x33ecd7[_0x5267('0x25')]());logger[_0x5267('0xc')](_0x5267('0x20'),_0xc7691d);logger[_0x5267('0xe')](_0x5267('0x20'),_0xc7691d,JSON['stringify'](_0x33ecd7));_0x189ed7(_0x33ecd7);})[_0x5267('0x16')](function(_0x5ef02e){logger[_0x5267('0x11')]('ShowMailAccount',_0x5ef02e['message'],_0xc7691d);_0x5bbb83(_0x40cec1['error'](0x1f4,_0x5ef02e[_0x5267('0x14')]));});});};exports['NotifyMailAccount']=function(_0xf33688){var _0x146476=this;return new Promise(function(_0x3d4b19,_0x235982){var _0x552b81={'body':_0xf33688[_0x5267('0x26')],'channel':_0x5267('0x27')};var _0x588edf=_['difference'](_[_0x5267('0x28')](db['CmContact'][_0x5267('0x29')]),[_0x5267('0x2a'),_0x5267('0x2b'),_0x5267('0x2c'),_0x5267('0x2d')]);var _0x3012cb=![];if(_0xf33688[_0x5267('0x26')]['id']){delete _0xf33688['body']['id'];}if(_['isNil'](_0xf33688[_0x5267('0x26')]['from'])){return _0x235982(_0x146476[_0x5267('0x11')](0x1f4,_0x5267('0x2e')));}if(_['isNil'](_0xf33688[_0x5267('0x26')][_0x5267('0x26')])||_0xf33688[_0x5267('0x26')][_0x5267('0x26')]===''){return _0x235982(_0x146476[_0x5267('0x11')](0x1f4,_0x5267('0x2f')));}if(_[_0x5267('0x30')](_0xf33688[_0x5267('0x26')][_0x5267('0x31')])){return _0x235982(_0x146476['error'](0x1f4,_0x5267('0x32')+_0x588edf));}if(!_[_0x5267('0x33')](_0x588edf,_0xf33688[_0x5267('0x26')][_0x5267('0x31')])){return _0x235982(_0x146476[_0x5267('0x11')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x588edf));}var _0x3d15ac={};_0x3d15ac[_0xf33688['body'][_0x5267('0x31')]]=_0xf33688['body']['from'];return db[_0x5267('0x18')]['find']({'where':{'id':_0xf33688[_0x5267('0x34')]['id']},'include':[{'model':db[_0x5267('0x35')],'as':_0x5267('0x36'),'include':[{'model':db[_0x5267('0x37')],'as':'Contacts','where':_0x3d15ac,'limit':0x1,'order':[[_0x5267('0x2b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x5267('0x38')},{'model':db[_0x5267('0x39')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x5267('0x3a')}]}]})[_0x5267('0xb')](function(_0x3d2436){if(_0x3d2436&&_0x3d2436[_0x5267('0x36')]){var _0x1c2803=_0x3d2436[_0x5267('0x3b')]({'plain':!![]});_0x552b81[_0x5267('0x34')]=_[_0x5267('0x3c')](_0x1c2803,[_0x5267('0x38'),_0x5267('0x36')]);_0x552b81[_0x5267('0x34')][_0x5267('0x24')]=_0x3d2436[_0x5267('0x25')]();_0x552b81[_0x5267('0x3d')]=_0x1c2803['Applications'];_0x552b81[_0x5267('0x3e')]=_0x1c2803[_0x5267('0x36')];_0x552b81[_0x5267('0x3d')]=_['orderBy'](_0x552b81[_0x5267('0x3d')],[_0x5267('0x3f')],[_0x5267('0x40')]);if(_0x552b81[_0x5267('0x34')]&&_0x552b81[_0x5267('0x34')][_0x5267('0x41')]){_0x552b81['applications'][_0x5267('0x42')]({'id':0x0,'priority':_0x552b81['applications'][_0x5267('0x43')]+0x1,'app':_0x5267('0x44'),'appdata':_0x5267('0x41'),'interval':_0x5267('0x45')});}if(_0x552b81[_0x5267('0x34')][_0x5267('0x38')]){delete _0x552b81[_0x5267('0x34')]['Applications'];}if(_0x552b81['account'][_0x5267('0x36')]){delete _0x552b81[_0x5267('0x34')]['List'];}if(_0x1c2803[_0x5267('0x36')]['Contacts']['length']){return _0x1c2803[_0x5267('0x36')][_0x5267('0x46')][0x0];}var _0x1b11e4=_[_0x5267('0x8')](_0xf33688[_0x5267('0x26')],{'firstName':_0xf33688[_0x5267('0x26')][_0x5267('0x47')],'ListId':_0x1c2803[_0x5267('0x2d')]});_0x1b11e4[_0xf33688[_0x5267('0x26')][_0x5267('0x31')]]=_0xf33688['body'][_0x5267('0x47')];return db[_0x5267('0x37')][_0x5267('0x48')](_0x1b11e4);}else{throw new Error(_0x5267('0x49'));}})[_0x5267('0xb')](function(_0x34c205){_0x552b81['contact']=_0x34c205;if(_0x34c205){if(!_0xf33688[_0x5267('0x26')]['message'][_0x5267('0x4a')]){_0xf33688[_0x5267('0x26')][_0x5267('0x14')]['messageId']=rs[_0x5267('0x4b')]()+'\x20'+_0xf33688[_0x5267('0x26')][_0x5267('0x14')][_0x5267('0x47')];}var _0x316988={'ContactId':_0x34c205['id'],'MailAccountId':_0xf33688[_0x5267('0x34')]['id'],'inReplyTo':_0xf33688['body'][_0x5267('0x14')][_0x5267('0x4a')],'to':_0xf33688[_0x5267('0x26')][_0x5267('0x14')]['from'],'cc':_0xf33688['body'][_0x5267('0x14')]['cc'],'subject':_0xf33688['body'][_0x5267('0x14')][_0x5267('0x4c')],'attach':_0xf33688['body']['message'][_0x5267('0x4d')],'lastMsgAt':moment()[_0x5267('0x4e')](_0x5267('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x5267('0x21')]({'where':{'closed':![],'MailAccountId':_0xf33688[_0x5267('0x34')]['id']},'include':[{'model':db[_0x5267('0x50')],'as':_0x5267('0x51'),'attributes':['messageId'],'where':{'messageId':_0xf33688['body']['message'][_0x5267('0x52')]}}]})[_0x5267('0xb')](function(_0x45ee25){if(_0x45ee25){return[_0x45ee25,![]];}return db[_0x5267('0x53')][_0x5267('0x48')](_0x316988)[_0x5267('0xb')](function(_0x2a032a){return[_0x2a032a,!![]];});});}else{throw new Error(_0x5267('0x54'));}})['spread'](function(_0x1ddfad,_0x667b5d){if(_0x1ddfad){_0x3012cb=_0x667b5d;if(!_0x667b5d){return _0x1ddfad['update']({'inReplyTo':_0xf33688[_0x5267('0x26')][_0x5267('0x14')][_0x5267('0x4a')],'to':_0xf33688[_0x5267('0x26')][_0x5267('0x14')][_0x5267('0x47')],'cc':_0xf33688['body'][_0x5267('0x14')]['cc'],'subject':_0xf33688[_0x5267('0x26')][_0x5267('0x14')][_0x5267('0x4c')],'attach':_0x1ddfad[_0x5267('0x4d')]?_0x1ddfad[_0x5267('0x4d')]:_0xf33688['body'][_0x5267('0x14')][_0x5267('0x4d')],'substatus':null,'substatusAt':moment()[_0x5267('0x4e')](_0x5267('0x4f')),'lastMsgAt':moment()[_0x5267('0x4e')](_0x5267('0x4f')),'lastMsgDirection':'in'});}else{return _0x1ddfad;}}})['then'](function(_0x283423){_0x552b81[_0x5267('0x55')]=_0x283423[_0x5267('0x3b')]({'plain':!![]});_0x552b81[_0x5267('0x55')]['created']=_0x3012cb;return db['MailMessage']['create']({'body':_0xf33688[_0x5267('0x26')]['body'],'MailAccountId':_0xf33688[_0x5267('0x34')]['id'],'MailInteractionId':_0x283423['id'],'direction':'in','ContactId':_0x552b81['contact']['id'],'messageId':_0xf33688[_0x5267('0x26')][_0x5267('0x14')][_0x5267('0x4a')],'from':_0xf33688[_0x5267('0x26')][_0x5267('0x14')][_0x5267('0x47')],'to':_0xf33688[_0x5267('0x26')][_0x5267('0x14')]['to'],'cc':_0xf33688['body']['message']['cc'],'subject':_0xf33688['body'][_0x5267('0x14')][_0x5267('0x4c')],'attach':_0xf33688[_0x5267('0x26')][_0x5267('0x14')]['attach'],'Attachments':_0xf33688[_0x5267('0x26')][_0x5267('0x14')][_0x5267('0x56')],'originTo':_0xf33688[_0x5267('0x26')]['message'][_0x5267('0x57')],'originCc':_0xf33688[_0x5267('0x26')]['message'][_0x5267('0x58')],'bcc':_0xf33688[_0x5267('0x26')]['message']['bcc'],'ChatWebsiteId':_0xf33688[_0x5267('0x26')][_0x5267('0x14')]['ChatWebsiteId']||null,'originChannel':_0xf33688['body'][_0x5267('0x14')][_0x5267('0x59')]||_0x5267('0x5a'),'ChatOfflineMessageId':_0xf33688[_0x5267('0x26')][_0x5267('0x14')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x5267('0x5b')],'as':_0x5267('0x5c')}]});})['then'](function(_0x26c628){_0x552b81[_0x5267('0x14')]=_0x26c628;if(!_0x552b81[_0x5267('0x55')][_0x5267('0x5d')]){return;}return db[_0x5267('0x5e')][_0x5267('0x21')]({'attributes':['id',_0x5267('0x5f')],'where':{'id':_0x552b81[_0x5267('0x55')]['UserId']}});})['then'](function(_0x1ac20f){if(_0x1ac20f){_0x552b81[_0x5267('0x3d')][_0x5267('0x60')]({'id':0x0,'priority':0x0,'app':_0x5267('0x61'),'appdata':_0x1ac20f['name']+','+(_0x552b81[_0x5267('0x34')]['waitForTheAssignedAgent']||0xa),'interval':_0x5267('0x45')});}if(!_0x552b81[_0x5267('0x55')][_0x5267('0x62')]){return;}return db[_0x5267('0x63')]['find']({'attributes':['id','name'],'where':{'id':_0x552b81[_0x5267('0x55')][_0x5267('0x62')]}});})[_0x5267('0xb')](function(_0x360a1b){if(_0x360a1b){_0x552b81[_0x5267('0x3d')][_0x5267('0x60')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x360a1b[_0x5267('0x5f')]+','+(_0x552b81['account'][_0x5267('0x64')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5267('0x65'),_0x5267('0x66'),_0x552b81);})[_0x5267('0xb')](function(_0x87aa90){_0x3d4b19(_0x87aa90);})[_0x5267('0x16')](function(_0x1ccb6c){_0x235982(_0x146476[_0x5267('0x11')](0x1f4,_0x1ccb6c[_0x5267('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index e999c44..bda9c5b 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 _0x1d3a=['./mailAccount.events','save','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x1d3a,0xa2));var _0xa1d3=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x1d3a[_0x576170];return _0x397c70;};'use strict';var MailAccountEvents=require(_0xa1d3('0x0'));var events=[_0xa1d3('0x1'),_0xa1d3('0x2'),_0xa1d3('0x3')];function createListener(_0x3efed9,_0x2fc509){return function(_0x890797){_0x2fc509[_0xa1d3('0x4')](_0x3efed9,_0x890797);};}function removeListener(_0x3de76b,_0x34f7f1){return function(){MailAccountEvents[_0xa1d3('0x5')](_0x3de76b,_0x34f7f1);};}exports[_0xa1d3('0x6')]=function(_0x56b2b2){for(var _0x4cc9d0=0x0,_0x29195b=events[_0xa1d3('0x7')];_0x4cc9d0<_0x29195b;_0x4cc9d0++){var _0x59ac6c=events[_0x4cc9d0];var _0x534c61=createListener(_0xa1d3('0x8')+_0x59ac6c,_0x56b2b2);MailAccountEvents['on'](_0x59ac6c,_0x534c61);}}; \ No newline at end of file +var _0xedb7=['update','emit','removeListener','save'];(function(_0x5e8326,_0x22c220){var _0x4f34b3=function(_0x1afc10){while(--_0x1afc10){_0x5e8326['push'](_0x5e8326['shift']());}};_0x4f34b3(++_0x22c220);}(_0xedb7,0x8b));var _0x7edb=function(_0x5235d8,_0x24771d){_0x5235d8=_0x5235d8-0x0;var _0x183abd=_0xedb7[_0x5235d8];return _0x183abd;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x7edb('0x0'),'remove',_0x7edb('0x1')];function createListener(_0x789f80,_0x18de74){return function(_0x541e33){_0x18de74[_0x7edb('0x2')](_0x789f80,_0x541e33);};}function removeListener(_0x915072,_0x67e57b){return function(){MailAccountEvents[_0x7edb('0x3')](_0x915072,_0x67e57b);};}exports['register']=function(_0x260a2d){for(var _0x820746=0x0,_0x3ae32f=events['length'];_0x820746<_0x3ae32f;_0x820746++){var _0x33bacd=events[_0x820746];var _0x244dd9=createListener('mailAccount:'+_0x33bacd,_0x260a2d);MailAccountEvents['on'](_0x33bacd,_0x244dd9);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 6d48da8..18e2585 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 _0x17bd=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show'];(function(_0x1158f5,_0x209ea6){var _0x573e85=function(_0xd616fc){while(--_0xd616fc){_0x1158f5['push'](_0x1158f5['shift']());}};_0x573e85(++_0x209ea6);}(_0x17bd,0x1d2));var _0xd17b=function(_0x2adb6e,_0x58fea4){_0x2adb6e=_0x2adb6e-0x0;var _0x47a9ad=_0x17bd[_0x2adb6e];return _0x47a9ad;};'use strict';var multer=require(_0xd17b('0x0'));var util=require(_0xd17b('0x1'));var path=require(_0xd17b('0x2'));var timeout=require(_0xd17b('0x3'));var express=require(_0xd17b('0x4'));var router=express[_0xd17b('0x5')]();var fs_extra=require(_0xd17b('0x6'));var auth=require(_0xd17b('0x7'));var interaction=require(_0xd17b('0x8'));var config=require(_0xd17b('0x9'));var controller=require(_0xd17b('0xa'));router[_0xd17b('0xb')]('/:id',auth[_0xd17b('0xc')](),controller[_0xd17b('0xd')]);router[_0xd17b('0xe')](_0xd17b('0xf'),auth['isAuthenticated'](),controller[_0xd17b('0x10')]);router[_0xd17b('0x11')](_0xd17b('0xf'),auth[_0xd17b('0xc')](),controller[_0xd17b('0x12')]);module[_0xd17b('0x13')]=router; \ No newline at end of file +var _0xec70=['Router','fs-extra','../../config/environment','/:id','isAuthenticated','put','update','exports','multer','util','connect-timeout','express'];(function(_0x4d9bb4,_0x4440ca){var _0x22f370=function(_0x2e697f){while(--_0x2e697f){_0x4d9bb4['push'](_0x4d9bb4['shift']());}};_0x22f370(++_0x4440ca);}(_0xec70,0x98));var _0x0ec7=function(_0xa40290,_0x555ec3){_0xa40290=_0xa40290-0x0;var _0x43f35c=_0xec70[_0xa40290];return _0x43f35c;};'use strict';var multer=require(_0x0ec7('0x0'));var util=require(_0x0ec7('0x1'));var path=require('path');var timeout=require(_0x0ec7('0x2'));var express=require(_0x0ec7('0x3'));var router=express[_0x0ec7('0x4')]();var fs_extra=require(_0x0ec7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0ec7('0x6'));var controller=require('./mailApplication.controller');router['get'](_0x0ec7('0x7'),auth[_0x0ec7('0x8')](),controller['show']);router[_0x0ec7('0x9')](_0x0ec7('0x7'),auth['isAuthenticated'](),controller[_0x0ec7('0xa')]);router['delete'](_0x0ec7('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x0ec7('0xb')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 2b906a9..d1fc7dd 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 _0x1d36=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x45fee7,_0x5a8984){var _0x10da25=function(_0xa5e33a){while(--_0xa5e33a){_0x45fee7['push'](_0x45fee7['shift']());}};_0x10da25(++_0x5a8984);}(_0x1d36,0xb3));var _0x61d3=function(_0x7460f4,_0x42f7fa){_0x7460f4=_0x7460f4-0x0;var _0x48e269=_0x1d36[_0x7460f4];return _0x48e269;};'use strict';var Sequelize=require(_0x61d3('0x0'));module[_0x61d3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x61d3('0x2')],'allowNull':![],'defaultValue':_0x61d3('0x3')},'appdata':{'type':Sequelize[_0x61d3('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x61d3('0x2')],'defaultValue':_0x61d3('0x5')}}; \ No newline at end of file +var _0xca9e=['TEXT','sequelize','exports','STRING','noop'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xca9e,0x191));var _0xeca9=function(_0x22f56d,_0x5cf3b8){_0x22f56d=_0x22f56d-0x0;var _0x153a08=_0xca9e[_0x22f56d];return _0x153a08;};'use strict';var Sequelize=require(_0xeca9('0x0'));module[_0xeca9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xeca9('0x2')],'allowNull':![],'defaultValue':_0xeca9('0x3')},'appdata':{'type':Sequelize[_0xeca9('0x4')]()},'description':{'type':Sequelize[_0xeca9('0x2')]},'interval':{'type':Sequelize[_0xeca9('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 682a7b6..51daf8d 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 _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0xde8365,_0x186cda){var _0x36d584=function(_0xf2bf44){while(--_0xf2bf44){_0xde8365['push'](_0xde8365['shift']());}};_0x36d584(++_0x186cda);}(_0xb43b,0x1b2));var _0xbb43=function(_0x31831c,_0x575664){_0x31831c=_0x31831c-0x0;var _0x500b98=_0xb43b[_0x31831c];return _0x500b98;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x59d2e6,_0x19d61f){var _0x1791d1=function(_0x2586bc){while(--_0x2586bc){_0x59d2e6['push'](_0x59d2e6['shift']());}};_0x1791d1(++_0x19d61f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3bc634,_0x2d7304){_0x3bc634=_0x3bc634-0x0;var _0x534321=_0xf4eb[_0x3bc634];return _0x534321;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1ece0ba..b784e40 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 _0x200d=['../../config/environment','./mailApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','path','rimraf'];(function(_0x995d5c,_0x4ecc18){var _0x3bd0dd=function(_0x3cfa93){while(--_0x3cfa93){_0x995d5c['push'](_0x995d5c['shift']());}};_0x3bd0dd(++_0x4ecc18);}(_0x200d,0x12e));var _0xd200=function(_0x366e75,_0x533d1d){_0x366e75=_0x366e75-0x0;var _0x3b167b=_0x200d[_0x366e75];return _0x3b167b;};'use strict';var _=require('lodash');var util=require(_0xd200('0x0'));var logger=require('../../config/logger')(_0xd200('0x1'));var moment=require(_0xd200('0x2'));var BPromise=require('bluebird');var rp=require(_0xd200('0x3'));var fs=require('fs');var path=require(_0xd200('0x4'));var rimraf=require(_0xd200('0x5'));var config=require(_0xd200('0x6'));var attributes=require(_0xd200('0x7'));module[_0xd200('0x8')]=function(_0x247f3b,_0x1d3270){return _0x247f3b['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd200('0x9'),'collate':_0xd200('0xa')});}; \ No newline at end of file +var _0x39bb=['../../config/logger','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x312342,_0x48752d){var _0x397d67=function(_0x345572){while(--_0x345572){_0x312342['push'](_0x312342['shift']());}};_0x397d67(++_0x48752d);}(_0x39bb,0x107));var _0xb39b=function(_0x49c54c,_0x54a647){_0x49c54c=_0x49c54c-0x0;var _0x446225=_0x39bb[_0x49c54c];return _0x446225;};'use strict';var _=require(_0xb39b('0x0'));var util=require('util');var logger=require(_0xb39b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb39b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb39b('0x3'));var config=require(_0xb39b('0x4'));var attributes=require(_0xb39b('0x5'));module[_0xb39b('0x6')]=function(_0xe6f0b6,_0xd118c5){return _0xe6f0b6[_0xb39b('0x7')]('MailApplication',attributes,{'tableName':_0xb39b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb39b('0x9'),'collate':_0xb39b('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 631a7f7..68613a1 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 _0xd5ab=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','options','raw','attributes','limit','info','UpdateMailApplication','lodash','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd5ab,0x14e));var _0xbd5a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd5ab[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xbd5a('0x0'));var util=require('util');var moment=require(_0xbd5a('0x1'));var BPromise=require(_0xbd5a('0x2'));var rs=require(_0xbd5a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd5a('0x4'))['db'];var utils=require(_0xbd5a('0x5'));var logger=require('../../config/logger')(_0xbd5a('0x6'));var config=require(_0xbd5a('0x7'));var jayson=require(_0xbd5a('0x8'));var client=jayson[_0xbd5a('0x9')][_0xbd5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x319241,_0x2c225d,_0x55f0c6){return new BPromise(function(_0x465db7,_0x14982d){return client[_0xbd5a('0xb')](_0x319241,_0x55f0c6)[_0xbd5a('0xc')](function(_0x359178){logger['info']('MailApplication,\x20%s,\x20%s',_0x2c225d,_0xbd5a('0xd'));logger[_0xbd5a('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x2c225d,_0xbd5a('0xd'),JSON[_0xbd5a('0xf')](_0x359178));if(_0x359178[_0xbd5a('0x10')]){if(_0x359178[_0xbd5a('0x10')][_0xbd5a('0x11')]===0x1f4){logger['error'](_0xbd5a('0x12'),_0x2c225d,_0x359178[_0xbd5a('0x10')][_0xbd5a('0x13')]);return _0x14982d(_0x359178[_0xbd5a('0x10')][_0xbd5a('0x13')]);}logger[_0xbd5a('0x10')](_0xbd5a('0x12'),_0x2c225d,_0x359178[_0xbd5a('0x10')][_0xbd5a('0x13')]);return _0x465db7(_0x359178[_0xbd5a('0x10')][_0xbd5a('0x13')]);}else{logger['info'](_0xbd5a('0x12'),_0x2c225d,_0xbd5a('0xd'));_0x465db7(_0x359178[_0xbd5a('0x14')][_0xbd5a('0x13')]);}})[_0xbd5a('0x15')](function(_0xeadf90){logger[_0xbd5a('0x10')](_0xbd5a('0x12'),_0x2c225d,_0xeadf90);_0x14982d(_0xeadf90);});});}exports['UpdateMailApplication']=function(_0x3ec73a){var _0x4bc0be=this;return new Promise(function(_0x5b67f9,_0x127bcb){return db['MailApplication']['update'](_0x3ec73a['body'],{'raw':_0x3ec73a[_0xbd5a('0x16')]?_0x3ec73a[_0xbd5a('0x16')][_0xbd5a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ec73a[_0xbd5a('0x16')]?_0x3ec73a['options']['where']||null:null,'attributes':_0x3ec73a[_0xbd5a('0x16')]?_0x3ec73a[_0xbd5a('0x16')][_0xbd5a('0x18')]||null:null,'limit':_0x3ec73a[_0xbd5a('0x16')]?_0x3ec73a[_0xbd5a('0x16')][_0xbd5a('0x19')]||null:null})[_0xbd5a('0xc')](function(_0x2a4d38){logger[_0xbd5a('0x1a')](_0xbd5a('0x1b'),_0x3ec73a);logger[_0xbd5a('0xe')]('UpdateMailApplication',_0x3ec73a,JSON[_0xbd5a('0xf')](_0x2a4d38));_0x5b67f9(_0x2a4d38);})[_0xbd5a('0x15')](function(_0x250cc5){logger[_0xbd5a('0x10')](_0xbd5a('0x1b'),_0x250cc5[_0xbd5a('0x13')],_0x3ec73a);_0x127bcb(_0x4bc0be[_0xbd5a('0x10')](0x1f4,_0x250cc5[_0xbd5a('0x13')]));});});}; \ No newline at end of file +var _0xcbb5=['stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2cc041,_0x51d618){var _0x5aa667=function(_0x3e6ed3){while(--_0x3e6ed3){_0x2cc041['push'](_0x2cc041['shift']());}};_0x5aa667(++_0x51d618);}(_0xcbb5,0x141));var _0x5cbb=function(_0x48fd76,_0x4b9b6c){_0x48fd76=_0x48fd76-0x0;var _0x4b2b4e=_0xcbb5[_0x48fd76];return _0x4b2b4e;};'use strict';var _=require(_0x5cbb('0x0'));var util=require('util');var moment=require(_0x5cbb('0x1'));var BPromise=require('bluebird');var rs=require(_0x5cbb('0x2'));var fs=require('fs');var Redis=require(_0x5cbb('0x3'));var db=require(_0x5cbb('0x4'))['db'];var utils=require(_0x5cbb('0x5'));var logger=require(_0x5cbb('0x6'))(_0x5cbb('0x7'));var config=require(_0x5cbb('0x8'));var jayson=require(_0x5cbb('0x9'));var client=jayson[_0x5cbb('0xa')][_0x5cbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f4ba,_0x143856,_0xe1a27a){return new BPromise(function(_0x43565d,_0x19fbad){return client[_0x5cbb('0xc')](_0x31f4ba,_0xe1a27a)[_0x5cbb('0xd')](function(_0x3be79a){logger[_0x5cbb('0xe')](_0x5cbb('0xf'),_0x143856,_0x5cbb('0x10'));logger[_0x5cbb('0x11')](_0x5cbb('0x12'),_0x143856,'request\x20sent',JSON[_0x5cbb('0x13')](_0x3be79a));if(_0x3be79a[_0x5cbb('0x14')]){if(_0x3be79a[_0x5cbb('0x14')][_0x5cbb('0x15')]===0x1f4){logger[_0x5cbb('0x14')](_0x5cbb('0xf'),_0x143856,_0x3be79a['error'][_0x5cbb('0x16')]);return _0x19fbad(_0x3be79a['error'][_0x5cbb('0x16')]);}logger[_0x5cbb('0x14')](_0x5cbb('0xf'),_0x143856,_0x3be79a['error'][_0x5cbb('0x16')]);return _0x43565d(_0x3be79a[_0x5cbb('0x14')][_0x5cbb('0x16')]);}else{logger[_0x5cbb('0xe')]('MailApplication,\x20%s,\x20%s',_0x143856,_0x5cbb('0x10'));_0x43565d(_0x3be79a[_0x5cbb('0x17')][_0x5cbb('0x16')]);}})[_0x5cbb('0x18')](function(_0x383aa8){logger[_0x5cbb('0x14')](_0x5cbb('0xf'),_0x143856,_0x383aa8);_0x19fbad(_0x383aa8);});});}exports[_0x5cbb('0x19')]=function(_0x1280e8){var _0x42529d=this;return new Promise(function(_0x19b97e,_0x5345f5){return db[_0x5cbb('0x1a')][_0x5cbb('0x1b')](_0x1280e8[_0x5cbb('0x1c')],{'raw':_0x1280e8[_0x5cbb('0x1d')]?_0x1280e8[_0x5cbb('0x1d')][_0x5cbb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1280e8[_0x5cbb('0x1d')]?_0x1280e8[_0x5cbb('0x1d')][_0x5cbb('0x1f')]||null:null,'attributes':_0x1280e8[_0x5cbb('0x1d')]?_0x1280e8['options'][_0x5cbb('0x20')]||null:null,'limit':_0x1280e8[_0x5cbb('0x1d')]?_0x1280e8['options'][_0x5cbb('0x21')]||null:null})[_0x5cbb('0xd')](function(_0x5df1d1){logger[_0x5cbb('0xe')](_0x5cbb('0x19'),_0x1280e8);logger['debug'](_0x5cbb('0x19'),_0x1280e8,JSON[_0x5cbb('0x13')](_0x5df1d1));_0x19b97e(_0x5df1d1);})[_0x5cbb('0x18')](function(_0x2f8564){logger[_0x5cbb('0x14')](_0x5cbb('0x19'),_0x2f8564[_0x5cbb('0x16')],_0x1280e8);_0x5345f5(_0x42529d[_0x5cbb('0x14')](0x1f4,_0x2f8564[_0x5cbb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 600a13d..5bff021 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 _0x2707=['put','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags'];(function(_0x380fcb,_0x1cb004){var _0x5a1f7a=function(_0xc21658){while(--_0xc21658){_0x380fcb['push'](_0x380fcb['shift']());}};_0x5a1f7a(++_0x1cb004);}(_0x2707,0x114));var _0x7270=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x2707[_0x62c958];return _0x57ec61;};'use strict';var express=require(_0x7270('0x0'));var router=express[_0x7270('0x1')]();var auth=require(_0x7270('0x2'));var interaction=require(_0x7270('0x3'));var controller=require(_0x7270('0x4'));router[_0x7270('0x5')]('/',auth[_0x7270('0x6')](),controller[_0x7270('0x7')]);router[_0x7270('0x5')](_0x7270('0x8'),auth['isAuthenticated'](),controller[_0x7270('0x9')]);router['get'](_0x7270('0xa'),auth[_0x7270('0x6')](),controller['show']);router[_0x7270('0x5')](_0x7270('0xb'),auth['isAuthenticated'](),controller[_0x7270('0xc')]);router[_0x7270('0x5')](_0x7270('0xd'),auth[_0x7270('0x6')](),controller['download']);router['post']('/',auth[_0x7270('0x6')](),controller['create']);router[_0x7270('0xe')](_0x7270('0xb'),auth['isAuthenticated'](),controller[_0x7270('0xf')]);router['post'](_0x7270('0x10'),auth['isAuthenticated'](),interaction[_0x7270('0x11')](_0x7270('0x12'),_0x7270('0x13')),controller[_0x7270('0x14')]);router[_0x7270('0x15')](_0x7270('0xa'),auth[_0x7270('0x6')](),interaction[_0x7270('0x11')]('mail',_0x7270('0x16')),controller[_0x7270('0x17')]);router[_0x7270('0x18')](_0x7270('0xa'),auth[_0x7270('0x6')](),interaction[_0x7270('0x11')](_0x7270('0x12'),_0x7270('0x19')),controller['destroy']);router[_0x7270('0x18')](_0x7270('0x10'),auth[_0x7270('0x6')](),controller[_0x7270('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x6f1a=['isAuthenticated','/describe','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','/:id','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f1a,0x14d));var _0xa6f1=function(_0x13b3d,_0x4c02bd){_0x13b3d=_0x13b3d-0x0;var _0x5d9cd5=_0x6f1a[_0x13b3d];return _0x5d9cd5;};'use strict';var express=require(_0xa6f1('0x0'));var router=express[_0xa6f1('0x1')]();var auth=require(_0xa6f1('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xa6f1('0x3'));router[_0xa6f1('0x4')]('/',auth[_0xa6f1('0x5')](),controller['index']);router[_0xa6f1('0x4')](_0xa6f1('0x6'),auth['isAuthenticated'](),controller[_0xa6f1('0x7')]);router[_0xa6f1('0x4')]('/:id',auth[_0xa6f1('0x5')](),controller[_0xa6f1('0x8')]);router['get'](_0xa6f1('0x9'),auth[_0xa6f1('0x5')](),controller[_0xa6f1('0xa')]);router[_0xa6f1('0x4')]('/:id/download',auth[_0xa6f1('0x5')](),controller[_0xa6f1('0xb')]);router[_0xa6f1('0xc')]('/',auth['isAuthenticated'](),controller[_0xa6f1('0xd')]);router[_0xa6f1('0xc')](_0xa6f1('0x9'),auth[_0xa6f1('0x5')](),controller[_0xa6f1('0xe')]);router[_0xa6f1('0xc')](_0xa6f1('0xf'),auth[_0xa6f1('0x5')](),interaction[_0xa6f1('0x10')](_0xa6f1('0x11'),_0xa6f1('0x12')),controller[_0xa6f1('0x13')]);router[_0xa6f1('0x14')]('/:id',auth[_0xa6f1('0x5')](),interaction['tracked']('mail',_0xa6f1('0x15')),controller['update']);router[_0xa6f1('0x16')](_0xa6f1('0x17'),auth['isAuthenticated'](),interaction[_0xa6f1('0x10')](_0xa6f1('0x11'),'mailinteraction:destroy'),controller['destroy']);router[_0xa6f1('0x16')](_0xa6f1('0xf'),auth['isAuthenticated'](),controller[_0xa6f1('0x18')]);module[_0xa6f1('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 d72b32e..88f6c3d 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 _0x473c=['exports','BOOLEAN','DATE','STRING','TEXT','out','sequelize','iconv'];(function(_0x2dee27,_0x58a14e){var _0x24c440=function(_0x4352b3){while(--_0x4352b3){_0x2dee27['push'](_0x2dee27['shift']());}};_0x24c440(++_0x58a14e);}(_0x473c,0x8e));var _0xc473=function(_0x66d061,_0x54e5a6){_0x66d061=_0x66d061-0x0;var _0x2c4eed=_0x473c[_0x66d061];return _0x2c4eed;};'use strict';var Sequelize=require(_0xc473('0x0'));var iconv=require(_0xc473('0x1'));module[_0xc473('0x2')]={'closed':{'type':Sequelize[_0xc473('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc473('0x4')]},'disposition':{'type':Sequelize[_0xc473('0x5')]},'secondDisposition':{'type':Sequelize[_0xc473('0x5')]},'thirdDisposition':{'type':Sequelize[_0xc473('0x5')]},'note':{'type':Sequelize[_0xc473('0x5')]},'inReplyTo':{'type':Sequelize[_0xc473('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc473('0x6')]('long')},'subject':{'type':Sequelize[_0xc473('0x6')]()},'attach':{'type':Sequelize[_0xc473('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc473('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xc473('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc473('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc473('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc473('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9572=['exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','INTEGER','sequelize'];(function(_0x3aec4f,_0x2a1b94){var _0x13dc2b=function(_0x4f631a){while(--_0x4f631a){_0x3aec4f['push'](_0x3aec4f['shift']());}};_0x13dc2b(++_0x2a1b94);}(_0x9572,0x149));var _0x2957=function(_0x3814ca,_0x1136e5){_0x3814ca=_0x3814ca-0x0;var _0x2f511f=_0x9572[_0x3814ca];return _0x2f511f;};'use strict';var Sequelize=require(_0x2957('0x0'));var iconv=require('iconv');module[_0x2957('0x1')]={'closed':{'type':Sequelize[_0x2957('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2957('0x3')]},'disposition':{'type':Sequelize[_0x2957('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2957('0x4')]},'inReplyTo':{'type':Sequelize[_0x2957('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2957('0x5')](_0x2957('0x6'))},'subject':{'type':Sequelize[_0x2957('0x5')]()},'attach':{'type':Sequelize[_0x2957('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2957('0x3')]},'substatus':{'type':Sequelize[_0x2957('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x2957('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2957('0x7')]('in',_0x2957('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2957('0x7')]('in',_0x2957('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2957('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2957('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 278c535..6675c25 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 _0xec02=['addTags','setTags','spread','Tag','color','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','bcc','createdAt','get','from','missing.recipient@your.company.com','subject','headers','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','mail','user','catch','show','params','keys','query','filters','intersection','model','fields','attributes','length','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','nolimit','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','rows'];(function(_0x30a4cb,_0x446ab3){var _0x4f7b5e=function(_0x2a5ca5){while(--_0x2a5ca5){_0x30a4cb['push'](_0x30a4cb['shift']());}};_0x4f7b5e(++_0x446ab3);}(_0xec02,0x171));var _0x2ec0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec02[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2ec0('0x0'));var rimraf=require(_0x2ec0('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x2ec0('0x2'));var util=require('util');var path=require(_0x2ec0('0x3'));var fs=require('fs');var _=require(_0x2ec0('0x4'));var juice=require(_0x2ec0('0x5'));var Redis=require(_0x2ec0('0x6'));var interaction=require(_0x2ec0('0x7'));var qs=require(_0x2ec0('0x8'));var logger=require('../../config/logger')(_0x2ec0('0x9'));var config=require(_0x2ec0('0xa'));var db=require(_0x2ec0('0xb'))['db'];var htmlEntities=require('html-entities');config[_0x2ec0('0xc')]=_['defaults'](config[_0x2ec0('0xc')],{'host':_0x2ec0('0xd'),'port':0x18eb});var socket=require(_0x2ec0('0xe'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x2ec0('0xf')](socket);function respondWithStatusCode(_0x16a480,_0x400642){_0x400642=_0x400642||0xcc;return function(_0x48054c){if(_0x48054c){return _0x16a480['sendStatus'](_0x400642);}return _0x16a480['status'](_0x400642)[_0x2ec0('0x10')]();};}function respondWithResult(_0x2337c1,_0x2b1999){_0x2b1999=_0x2b1999||0xc8;return function(_0x12adbe){if(_0x12adbe){return _0x2337c1[_0x2ec0('0x11')](_0x2b1999)[_0x2ec0('0x12')](_0x12adbe);}};}function respondWithFilteredResult(_0x3e60b1,_0x4aa629){return function(_0x1e6c9d){if(_0x1e6c9d){var _0x19c1ce=typeof _0x4aa629[_0x2ec0('0x13')]===_0x2ec0('0x14')&&typeof _0x4aa629[_0x2ec0('0x15')]===_0x2ec0('0x14');var _0x3dd336=_0x1e6c9d[_0x2ec0('0x16')];var _0x4ba0d5=_0x19c1ce?0x0:_0x4aa629[_0x2ec0('0x13')];var _0xeb4d52=_0x19c1ce?_0x1e6c9d[_0x2ec0('0x16')]:_0x4aa629[_0x2ec0('0x13')]+_0x4aa629[_0x2ec0('0x15')];var _0x575fed;if(_0xeb4d52>=_0x3dd336){_0xeb4d52=_0x3dd336;_0x575fed=0xc8;}else{_0x575fed=0xce;}_0x3e60b1['status'](_0x575fed);return _0x3e60b1[_0x2ec0('0x17')](_0x2ec0('0x18'),_0x4ba0d5+'-'+_0xeb4d52+'/'+_0x3dd336)[_0x2ec0('0x12')](_0x1e6c9d);}return null;};}function saveUpdates(_0x3b8c35){return function(_0x10cca9){if(_0x10cca9){return _0x10cca9[_0x2ec0('0x19')](_0x3b8c35)['then'](function(_0x2681ba){return _0x2681ba;});}return null;};}function removeEntity(_0x11d2e8){return function(_0x5b1f59){if(_0x5b1f59){return _0x5b1f59[_0x2ec0('0x1a')]()[_0x2ec0('0x1b')](function(){_0x11d2e8[_0x2ec0('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f0b6e){return function(_0x70f356){if(!_0x70f356){_0x1f0b6e[_0x2ec0('0x1c')](0x194);}return _0x70f356;};}function handleError(_0x371dce,_0x9fcf7e){_0x9fcf7e=_0x9fcf7e||0x1f4;return function(_0x335558){logger[_0x2ec0('0x1d')](_0x335558[_0x2ec0('0x1e')]);if(_0x335558[_0x2ec0('0x1f')]){delete _0x335558[_0x2ec0('0x1f')];}_0x371dce[_0x2ec0('0x11')](_0x9fcf7e)[_0x2ec0('0x20')](_0x335558);};}exports['index']=function(_0x5f1692,_0x201ddd){var _0x4ea701={};var _0x34666c=_[_0x2ec0('0x21')](db[_0x2ec0('0x22')][_0x2ec0('0x23')],function(_0x1d1a91){return{'name':_0x1d1a91[_0x2ec0('0x24')],'type':_0x1d1a91[_0x2ec0('0x25')][_0x2ec0('0x26')]};});_0x4ea701=qs[_0x2ec0('0x27')](_0x34666c,_0x5f1692);return interaction['findAll'](_0x2ec0('0x28'),_0x5f1692['query'],_0x5f1692[_0x2ec0('0x29')],_0x4ea701,_0x34666c)[_0x2ec0('0x1b')](respondWithFilteredResult(_0x201ddd,_0x4ea701))[_0x2ec0('0x2a')](handleError(_0x201ddd,null));};exports[_0x2ec0('0x2b')]=function(_0x4410b5,_0xfea717){var _0x327407={'raw':![],'where':{'id':_0x4410b5[_0x2ec0('0x2c')]['id']}},_0x156536={};_0x156536['model']=_[_0x2ec0('0x2d')](db[_0x2ec0('0x22')]['rawAttributes']);_0x156536['query']=_[_0x2ec0('0x2d')](_0x4410b5[_0x2ec0('0x2e')]);_0x156536[_0x2ec0('0x2f')]=_[_0x2ec0('0x30')](_0x156536['model'],_0x156536['query']);_0x327407['attributes']=_[_0x2ec0('0x30')](_0x156536[_0x2ec0('0x31')],qs[_0x2ec0('0x32')](_0x4410b5[_0x2ec0('0x2e')][_0x2ec0('0x32')]));_0x327407[_0x2ec0('0x33')]=_0x327407[_0x2ec0('0x33')][_0x2ec0('0x34')]?_0x327407[_0x2ec0('0x33')]:_0x156536[_0x2ec0('0x31')];if(_0x4410b5['query']['includeAll']){_0x327407[_0x2ec0('0x35')]=[{'all':!![]}];}_0x327407=_[_0x2ec0('0x36')]({},_0x327407,_0x4410b5[_0x2ec0('0x37')]);return db[_0x2ec0('0x22')][_0x2ec0('0x38')](_0x327407)[_0x2ec0('0x1b')](handleEntityNotFound(_0xfea717,null))['then'](respondWithResult(_0xfea717,null))[_0x2ec0('0x2a')](handleError(_0xfea717,null));};exports[_0x2ec0('0x39')]=function(_0x2fa5b1,_0x252840){return db[_0x2ec0('0x22')][_0x2ec0('0x39')](_0x2fa5b1[_0x2ec0('0x3a')],{})[_0x2ec0('0x1b')](respondWithResult(_0x252840,0xc9))['catch'](handleError(_0x252840,null));};exports['update']=function(_0x26e487,_0x41bac1){if(_0x26e487[_0x2ec0('0x3a')]['id']){delete _0x26e487[_0x2ec0('0x3a')]['id'];}return db[_0x2ec0('0x22')][_0x2ec0('0x38')]({'where':{'id':_0x26e487['params']['id']}})[_0x2ec0('0x1b')](handleEntityNotFound(_0x41bac1,null))['then'](saveUpdates(_0x26e487[_0x2ec0('0x3a')],null))['then'](respondWithResult(_0x41bac1,null))[_0x2ec0('0x2a')](handleError(_0x41bac1,null));};exports[_0x2ec0('0x1a')]=function(_0x14f552,_0x30da56){return db[_0x2ec0('0x22')][_0x2ec0('0x38')]({'where':{'id':_0x14f552[_0x2ec0('0x2c')]['id']}})[_0x2ec0('0x1b')](handleEntityNotFound(_0x30da56,null))[_0x2ec0('0x1b')](removeEntity(_0x30da56,null))[_0x2ec0('0x2a')](handleError(_0x30da56,null));};exports[_0x2ec0('0x3b')]=function(_0x22227a,_0x26cf49){return db[_0x2ec0('0x22')][_0x2ec0('0x3b')]()[_0x2ec0('0x1b')](respondWithResult(_0x26cf49,null))[_0x2ec0('0x2a')](handleError(_0x26cf49,null));};exports[_0x2ec0('0x3c')]=function(_0x423752,_0x3acdbe){return db['MailMessage'][_0x2ec0('0x38')]({'where':{'id':_0x423752[_0x2ec0('0x2c')]['id']}})[_0x2ec0('0x1b')](handleEntityNotFound(_0x3acdbe,null))['then'](function(_0x424c06){if(_0x424c06){return _0x424c06[_0x2ec0('0x3c')](_0x423752[_0x2ec0('0x3a')][_0x2ec0('0x3d')],_[_0x2ec0('0x3e')](_0x423752[_0x2ec0('0x3a')],[_0x2ec0('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x3acdbe,null))[_0x2ec0('0x2a')](handleError(_0x3acdbe,null));};exports[_0x2ec0('0x3f')]=function(_0x13bb16,_0x35acda){var _0x3d5553={'raw':![],'where':{}};var _0x4262ea={};var _0x13558f={'count':0x0,'rows':[]};return db[_0x2ec0('0x22')][_0x2ec0('0x40')]({'where':{'id':_0x13bb16['params']['id']}})[_0x2ec0('0x1b')](handleEntityNotFound(_0x35acda,null))['then'](function(_0x22eb3a){if(_0x22eb3a){_0x4262ea['model']=_[_0x2ec0('0x2d')](db[_0x2ec0('0x41')][_0x2ec0('0x23')]);_0x4262ea[_0x2ec0('0x2e')]=_[_0x2ec0('0x2d')](_0x13bb16[_0x2ec0('0x2e')]);_0x4262ea[_0x2ec0('0x2f')]=_[_0x2ec0('0x30')](_0x4262ea['model'],_0x4262ea[_0x2ec0('0x2e')]);_0x3d5553[_0x2ec0('0x33')]=_[_0x2ec0('0x30')](_0x4262ea[_0x2ec0('0x31')],qs[_0x2ec0('0x32')](_0x13bb16[_0x2ec0('0x2e')][_0x2ec0('0x32')]));_0x3d5553['attributes']=_0x3d5553['attributes'][_0x2ec0('0x34')]?_0x3d5553[_0x2ec0('0x33')]:_0x4262ea[_0x2ec0('0x31')];if(!_0x13bb16['query']['hasOwnProperty'](_0x2ec0('0x42'))){_0x3d5553[_0x2ec0('0x15')]=qs[_0x2ec0('0x15')](_0x13bb16['query'][_0x2ec0('0x15')]);_0x3d5553[_0x2ec0('0x13')]=qs[_0x2ec0('0x13')](_0x13bb16[_0x2ec0('0x2e')][_0x2ec0('0x13')]);}_0x3d5553[_0x2ec0('0x43')]=qs[_0x2ec0('0x44')](_0x13bb16[_0x2ec0('0x2e')][_0x2ec0('0x44')]);_0x3d5553[_0x2ec0('0x45')]=qs[_0x2ec0('0x2f')](_[_0x2ec0('0x46')](_0x13bb16[_0x2ec0('0x2e')],_0x4262ea[_0x2ec0('0x2f')]));_0x3d5553[_0x2ec0('0x45')]['MailInteractionId']=_0x22eb3a['id'];if(_0x13bb16[_0x2ec0('0x2e')][_0x2ec0('0x47')]){_0x3d5553[_0x2ec0('0x45')]=_['merge'](_0x3d5553[_0x2ec0('0x45')],{'$or':_['map'](_0x3d5553[_0x2ec0('0x33')],function(_0x5de560){var _0x1eed17={};_0x1eed17[_0x5de560]={'$like':'%'+_0x13bb16[_0x2ec0('0x2e')][_0x2ec0('0x47')]+'%'};return _0x1eed17;})});}if(_0x13bb16[_0x2ec0('0x2e')][_0x2ec0('0x48')]){var _0xfe04f6=_0x13bb16[_0x2ec0('0x2e')][_0x2ec0('0x48')]['split'](',');var _0x425527={};_0x425527[_0xfe04f6[0x0]]={'$gte':moment(_0xfe04f6[0x1])[_0x2ec0('0x49')](_0x2ec0('0x4a'))};_0x3d5553[_0x2ec0('0x45')]=_[_0x2ec0('0x36')](_0x3d5553[_0x2ec0('0x45')],_0x425527);}_0x3d5553=_['merge']({},_0x3d5553,_0x13bb16[_0x2ec0('0x37')]);return db['MailMessage']['count']({'where':_0x3d5553[_0x2ec0('0x45')]})[_0x2ec0('0x1b')](function(_0x1ef570){_0x13558f['count']=_0x1ef570;if(_0x13bb16[_0x2ec0('0x2e')][_0x2ec0('0x4b')]){_0x3d5553[_0x2ec0('0x35')]=[{'all':!![]}];}return db[_0x2ec0('0x41')][_0x2ec0('0x4c')](_0x3d5553);})[_0x2ec0('0x1b')](function(_0x3bbbae){if(_0x13bb16[_0x2ec0('0x2e')][_0x2ec0('0x4d')]==='true'){for(var _0x1ae9ae=0x0;_0x1ae9ae<_0x3bbbae[_0x2ec0('0x34')];_0x1ae9ae++){_0x3bbbae[_0x1ae9ae][_0x2ec0('0x3a')]=juice(_0x3bbbae[_0x1ae9ae][_0x2ec0('0x3a')]);}}_0x13558f[_0x2ec0('0x4e')]=_0x3bbbae;return _0x13558f;});}})[_0x2ec0('0x1b')](respondWithFilteredResult(_0x35acda,_0x3d5553))[_0x2ec0('0x2a')](handleError(_0x35acda,null));};exports[_0x2ec0('0x4f')]=function(_0x6f972d,_0x4e80f4){return db[_0x2ec0('0x22')][_0x2ec0('0x38')]({'where':{'id':_0x6f972d[_0x2ec0('0x2c')]['id']}})[_0x2ec0('0x1b')](handleEntityNotFound(_0x4e80f4,null))[_0x2ec0('0x1b')](function(_0x1926da){if(_0x1926da){return _0x1926da[_0x2ec0('0x50')](_0x6f972d['body'][_0x2ec0('0x3d')],_[_0x2ec0('0x3e')](_0x6f972d[_0x2ec0('0x3a')],['ids','id'])||{})[_0x2ec0('0x51')](function(){return db[_0x2ec0('0x52')][_0x2ec0('0x4c')]({'attributes':['id','name',_0x2ec0('0x53')],'where':{'id':_0x6f972d[_0x2ec0('0x3a')][_0x2ec0('0x3d')]}});})[_0x2ec0('0x1b')](function(_0xedc1d6){socket['emit']('mailInteractionTags:save',{'id':Number(_0x6f972d[_0x2ec0('0x2c')]['id']),'tags':_0xedc1d6||[]});return{'id':Number(_0x6f972d['params']['id']),'tags':_0xedc1d6||[]};});}})[_0x2ec0('0x1b')](respondWithResult(_0x4e80f4,null))['catch'](handleError(_0x4e80f4,null));};exports[_0x2ec0('0x54')]=function(_0x13ceda,_0x8be02f){return db[_0x2ec0('0x22')][_0x2ec0('0x38')]({'where':{'id':_0x13ceda['params']['id']}})['then'](handleEntityNotFound(_0x8be02f,null))['then'](function(_0x55bdc6){if(_0x55bdc6){return _0x55bdc6[_0x2ec0('0x54')](_0x13ceda['query'][_0x2ec0('0x3d')]);}})[_0x2ec0('0x1b')](respondWithStatusCode(_0x8be02f,null))[_0x2ec0('0x2a')](handleError(_0x8be02f,null));};exports[_0x2ec0('0x55')]=function(_0x45fb4c,_0x13fad3){var _0x111881=moment()[_0x2ec0('0x56')]()[_0x2ec0('0x57')]();var _0x4c7369=path[_0x2ec0('0x58')](config[_0x2ec0('0x59')],_0x2ec0('0x5a'),_0x2ec0('0x5b'),'tmp');var _0x2ff205=path[_0x2ec0('0x58')](config[_0x2ec0('0x59')],_0x2ec0('0x5a'),_0x2ec0('0x5b'),_0x2ec0('0x5c'));var _0x1092fd=path[_0x2ec0('0x58')](_0x4c7369,_0x111881);var _0x27d38b=util[_0x2ec0('0x49')](_0x2ec0('0x5d'),_0x45fb4c['params']['id'],_0x111881);var _0x5b298c=path['join'](_0x4c7369,_0x27d38b);var _0x1adfc3=[];if(_0x45fb4c[_0x2ec0('0x2e')][_0x2ec0('0x5c')]){_0x1adfc3[_0x2ec0('0x5e')]({'model':db[_0x2ec0('0x5f')],'as':_0x2ec0('0x60'),'raw':!![]});}var _0x40f647=[{'model':db[_0x2ec0('0x41')],'as':_0x2ec0('0x61'),'attributes':['id','body','from','to','cc',_0x2ec0('0x62'),'subject',_0x2ec0('0x63')],'where':{'secret':![]},'order':qs[_0x2ec0('0x44')]('id'),'include':_0x1adfc3}];return db[_0x2ec0('0x22')][_0x2ec0('0x38')]({'where':{'id':_0x45fb4c[_0x2ec0('0x2c')]['id']},'include':_0x40f647})['then'](handleEntityNotFound(_0x13fad3,null))[_0x2ec0('0x1b')](function(_0x24edc8){if(_0x24edc8&&_0x24edc8['Messages']){var _0x1c35c1=_0x24edc8[_0x2ec0('0x64')]({'plain':!![]});fs['mkdirSync'](_0x1092fd);return BPromise['each'](_0x1c35c1[_0x2ec0('0x61')],function(_0x1d2ea1,_0x282c4a){var _0x52c17e={'from':_0x1d2ea1[_0x2ec0('0x65')],'to':_0x1d2ea1['to']||_0x2ec0('0x66'),'subject':_0x1d2ea1[_0x2ec0('0x67')],'html':htmlEntities['decode'](_0x1d2ea1[_0x2ec0('0x3a')]),'headers':{'Date':moment(_0x1d2ea1[_0x2ec0('0x63')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1d2ea1['cc']){_0x52c17e[_0x2ec0('0x68')]['Cc']=_0x1d2ea1['cc'];}if(_0x1d2ea1[_0x2ec0('0x62')]){_0x52c17e['headers'][_0x2ec0('0x69')]=_0x1d2ea1[_0x2ec0('0x62')];}return new BPromise(function(_0xa9ca2f,_0x221e78){if(_0x1d2ea1[_0x2ec0('0x60')]){for(var _0x5548b5=0x0;_0x5548b5<_0x1d2ea1[_0x2ec0('0x60')][_0x2ec0('0x34')];_0x5548b5++){var _0x2de906=_0x1d2ea1[_0x2ec0('0x60')][_0x5548b5];var _0x4d926b=path[_0x2ec0('0x58')](_0x2ff205,_0x2de906[_0x2ec0('0x6a')]);if(fs['existsSync'](_0x4d926b)){_0x52c17e[_0x2ec0('0x5c')][_0x2ec0('0x5e')]({'name':_0x2de906[_0x2ec0('0x1f')],'contentType':_0x2de906['type'],'data':fs[_0x2ec0('0x6b')](_0x4d926b)});}}}emlformat[_0x2ec0('0x6c')](_0x52c17e,function(_0xf3ba47,_0xef8dc4){if(_0xf3ba47)return _0x221e78(_0xf3ba47);fs[_0x2ec0('0x6d')](path[_0x2ec0('0x58')](_0x1092fd,util[_0x2ec0('0x49')](_0x2ec0('0x6e'),_0x282c4a)),_0xef8dc4);return _0xa9ca2f(_0xef8dc4);});});})[_0x2ec0('0x1b')](function(){return new BPromise(function(_0x3da59b,_0x7132e9){zipdir(_0x1092fd,{'saveTo':_0x5b298c},function(_0x2c91f4,_0x25b187){if(_0x2c91f4)return _0x7132e9(_0x2c91f4);return _0x3da59b(_0x25b187);});})['then'](function(){return new BPromise(function(_0x638aa8,_0x5efddd){rimraf(_0x1092fd,function(_0x172d1b){if(_0x172d1b)_0x5efddd(_0x172d1b);return _0x638aa8();});});})[_0x2ec0('0x1b')](function(){return _0x13fad3[_0x2ec0('0x55')](_0x5b298c,_0x27d38b,function(_0x52a94e){if(!_0x52a94e)fs[_0x2ec0('0x6f')](_0x5b298c);});});});}else{return _0x13fad3[_0x2ec0('0x1c')](0xc8);}})[_0x2ec0('0x2a')](handleError(_0x13fad3,null));}; \ No newline at end of file +var _0x5804=['query','user','catch','show','rawAttributes','filters','intersection','model','fields','attributes','length','includeAll','include','merge','create','body','update','find','params','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','keys','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','split','format','true','rows','addTags','setTags','spread','Tag','emit','removeTags','download','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','from','bcc','subject','createdAt','Messages','get','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','bluebird','path','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','send','index','map','MailInteraction','fieldName','type','findAll','mail'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5804,0x196));var _0x4580=function(_0x49579b,_0x528f4e){_0x49579b=_0x49579b-0x0;var _0x1a2d45=_0x5804[_0x49579b];return _0x1a2d45;};'use strict';var emlformat=require(_0x4580('0x0'));var rimraf=require(_0x4580('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x4580('0x2'));var util=require('util');var path=require(_0x4580('0x3'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0x4580('0x4'));var interaction=require(_0x4580('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x4580('0x6'))(_0x4580('0x7'));var config=require(_0x4580('0x8'));var db=require(_0x4580('0x9'))['db'];var htmlEntities=require(_0x4580('0xa'));config[_0x4580('0xb')]=_[_0x4580('0xc')](config[_0x4580('0xb')],{'host':_0x4580('0xd'),'port':0x18eb});var socket=require(_0x4580('0xe'))(new Redis(config[_0x4580('0xb')]));require(_0x4580('0xf'))[_0x4580('0x10')](socket);function respondWithStatusCode(_0x1bda78,_0x2d32d6){_0x2d32d6=_0x2d32d6||0xcc;return function(_0x500c22){if(_0x500c22){return _0x1bda78[_0x4580('0x11')](_0x2d32d6);}return _0x1bda78[_0x4580('0x12')](_0x2d32d6)[_0x4580('0x13')]();};}function respondWithResult(_0x428061,_0x2cbaea){_0x2cbaea=_0x2cbaea||0xc8;return function(_0x446773){if(_0x446773){return _0x428061[_0x4580('0x12')](_0x2cbaea)['json'](_0x446773);}};}function respondWithFilteredResult(_0x408cb4,_0x271044){return function(_0x1067d3){if(_0x1067d3){var _0x50d18d=typeof _0x271044[_0x4580('0x14')]===_0x4580('0x15')&&typeof _0x271044[_0x4580('0x16')]===_0x4580('0x15');var _0x5e4cae=_0x1067d3[_0x4580('0x17')];var _0x1a2eb4=_0x50d18d?0x0:_0x271044[_0x4580('0x14')];var _0x36859f=_0x50d18d?_0x1067d3['count']:_0x271044['offset']+_0x271044[_0x4580('0x16')];var _0x197284;if(_0x36859f>=_0x5e4cae){_0x36859f=_0x5e4cae;_0x197284=0xc8;}else{_0x197284=0xce;}_0x408cb4[_0x4580('0x12')](_0x197284);return _0x408cb4[_0x4580('0x18')](_0x4580('0x19'),_0x1a2eb4+'-'+_0x36859f+'/'+_0x5e4cae)['json'](_0x1067d3);}return null;};}function saveUpdates(_0x11aa1a){return function(_0xe352a0){if(_0xe352a0){return _0xe352a0['update'](_0x11aa1a)[_0x4580('0x1a')](function(_0x1fc822){return _0x1fc822;});}return null;};}function removeEntity(_0x29296){return function(_0x5bbe62){if(_0x5bbe62){return _0x5bbe62['destroy']()['then'](function(){_0x29296[_0x4580('0x12')](0xcc)[_0x4580('0x13')]();});}};}function handleEntityNotFound(_0x50a5e3){return function(_0x30dd7d){if(!_0x30dd7d){_0x50a5e3[_0x4580('0x11')](0x194);}return _0x30dd7d;};}function handleError(_0x22dd7a,_0x41344a){_0x41344a=_0x41344a||0x1f4;return function(_0x5d3c70){logger[_0x4580('0x1b')](_0x5d3c70[_0x4580('0x1c')]);if(_0x5d3c70[_0x4580('0x1d')]){delete _0x5d3c70['name'];}_0x22dd7a[_0x4580('0x12')](_0x41344a)[_0x4580('0x1e')](_0x5d3c70);};}exports[_0x4580('0x1f')]=function(_0x6a38b0,_0x4a30a0){var _0x4d5650={};var _0x460a44=_[_0x4580('0x20')](db[_0x4580('0x21')]['rawAttributes'],function(_0xe12a20){return{'name':_0xe12a20[_0x4580('0x22')],'type':_0xe12a20[_0x4580('0x23')]['key']};});_0x4d5650=qs['getOptions'](_0x460a44,_0x6a38b0);return interaction[_0x4580('0x24')](_0x4580('0x25'),_0x6a38b0[_0x4580('0x26')],_0x6a38b0[_0x4580('0x27')],_0x4d5650,_0x460a44)[_0x4580('0x1a')](respondWithFilteredResult(_0x4a30a0,_0x4d5650))[_0x4580('0x28')](handleError(_0x4a30a0,null));};exports[_0x4580('0x29')]=function(_0x5a8585,_0x104f00){var _0xbc9608={'raw':![],'where':{'id':_0x5a8585['params']['id']}},_0x2ef388={};_0x2ef388['model']=_['keys'](db['MailInteraction'][_0x4580('0x2a')]);_0x2ef388['query']=_['keys'](_0x5a8585[_0x4580('0x26')]);_0x2ef388[_0x4580('0x2b')]=_[_0x4580('0x2c')](_0x2ef388['model'],_0x2ef388['query']);_0xbc9608['attributes']=_[_0x4580('0x2c')](_0x2ef388[_0x4580('0x2d')],qs[_0x4580('0x2e')](_0x5a8585[_0x4580('0x26')][_0x4580('0x2e')]));_0xbc9608[_0x4580('0x2f')]=_0xbc9608['attributes'][_0x4580('0x30')]?_0xbc9608['attributes']:_0x2ef388[_0x4580('0x2d')];if(_0x5a8585[_0x4580('0x26')][_0x4580('0x31')]){_0xbc9608[_0x4580('0x32')]=[{'all':!![]}];}_0xbc9608=_[_0x4580('0x33')]({},_0xbc9608,_0x5a8585['options']);return db[_0x4580('0x21')]['find'](_0xbc9608)[_0x4580('0x1a')](handleEntityNotFound(_0x104f00,null))[_0x4580('0x1a')](respondWithResult(_0x104f00,null))[_0x4580('0x28')](handleError(_0x104f00,null));};exports[_0x4580('0x34')]=function(_0xcd4888,_0x18c7f5){return db[_0x4580('0x21')][_0x4580('0x34')](_0xcd4888[_0x4580('0x35')],{})[_0x4580('0x1a')](respondWithResult(_0x18c7f5,0xc9))['catch'](handleError(_0x18c7f5,null));};exports[_0x4580('0x36')]=function(_0x3f7f36,_0x4dd647){if(_0x3f7f36[_0x4580('0x35')]['id']){delete _0x3f7f36[_0x4580('0x35')]['id'];}return db[_0x4580('0x21')][_0x4580('0x37')]({'where':{'id':_0x3f7f36[_0x4580('0x38')]['id']}})[_0x4580('0x1a')](handleEntityNotFound(_0x4dd647,null))[_0x4580('0x1a')](saveUpdates(_0x3f7f36[_0x4580('0x35')],null))['then'](respondWithResult(_0x4dd647,null))[_0x4580('0x28')](handleError(_0x4dd647,null));};exports[_0x4580('0x39')]=function(_0x1d4210,_0x52dbfb){return db[_0x4580('0x21')][_0x4580('0x37')]({'where':{'id':_0x1d4210[_0x4580('0x38')]['id']}})[_0x4580('0x1a')](handleEntityNotFound(_0x52dbfb,null))[_0x4580('0x1a')](removeEntity(_0x52dbfb,null))[_0x4580('0x28')](handleError(_0x52dbfb,null));};exports[_0x4580('0x3a')]=function(_0x54656e,_0x2330d7){return db[_0x4580('0x21')][_0x4580('0x3a')]()[_0x4580('0x1a')](respondWithResult(_0x2330d7,null))[_0x4580('0x28')](handleError(_0x2330d7,null));};exports[_0x4580('0x3b')]=function(_0x2427f2,_0x444857){return db[_0x4580('0x3c')][_0x4580('0x37')]({'where':{'id':_0x2427f2[_0x4580('0x38')]['id']}})[_0x4580('0x1a')](handleEntityNotFound(_0x444857,null))[_0x4580('0x1a')](function(_0x1a39ad){if(_0x1a39ad){return _0x1a39ad[_0x4580('0x3b')](_0x2427f2['body'][_0x4580('0x3d')],_[_0x4580('0x3e')](_0x2427f2[_0x4580('0x35')],[_0x4580('0x3d'),'id'])||{});}})[_0x4580('0x1a')](respondWithResult(_0x444857,null))['catch'](handleError(_0x444857,null));};exports[_0x4580('0x3f')]=function(_0x311a35,_0x7ac481){var _0xcda0f5={'raw':![],'where':{}};var _0x25a0ef={};var _0x2abc21={'count':0x0,'rows':[]};return db['MailInteraction'][_0x4580('0x40')]({'where':{'id':_0x311a35['params']['id']}})[_0x4580('0x1a')](handleEntityNotFound(_0x7ac481,null))[_0x4580('0x1a')](function(_0x3192a9){if(_0x3192a9){_0x25a0ef[_0x4580('0x2d')]=_[_0x4580('0x41')](db[_0x4580('0x3c')][_0x4580('0x2a')]);_0x25a0ef[_0x4580('0x26')]=_[_0x4580('0x41')](_0x311a35['query']);_0x25a0ef[_0x4580('0x2b')]=_['intersection'](_0x25a0ef['model'],_0x25a0ef[_0x4580('0x26')]);_0xcda0f5['attributes']=_[_0x4580('0x2c')](_0x25a0ef[_0x4580('0x2d')],qs[_0x4580('0x2e')](_0x311a35[_0x4580('0x26')]['fields']));_0xcda0f5[_0x4580('0x2f')]=_0xcda0f5[_0x4580('0x2f')][_0x4580('0x30')]?_0xcda0f5[_0x4580('0x2f')]:_0x25a0ef['model'];if(!_0x311a35['query'][_0x4580('0x42')](_0x4580('0x43'))){_0xcda0f5[_0x4580('0x16')]=qs['limit'](_0x311a35[_0x4580('0x26')][_0x4580('0x16')]);_0xcda0f5[_0x4580('0x14')]=qs[_0x4580('0x14')](_0x311a35[_0x4580('0x26')]['offset']);}_0xcda0f5['order']=qs['sort'](_0x311a35[_0x4580('0x26')][_0x4580('0x44')]);_0xcda0f5[_0x4580('0x45')]=qs[_0x4580('0x2b')](_[_0x4580('0x46')](_0x311a35[_0x4580('0x26')],_0x25a0ef[_0x4580('0x2b')]));_0xcda0f5[_0x4580('0x45')][_0x4580('0x47')]=_0x3192a9['id'];if(_0x311a35['query'][_0x4580('0x48')]){_0xcda0f5[_0x4580('0x45')]=_[_0x4580('0x33')](_0xcda0f5['where'],{'$or':_[_0x4580('0x20')](_0xcda0f5['attributes'],function(_0x8f92a0){var _0x53b078={};_0x53b078[_0x8f92a0]={'$like':'%'+_0x311a35['query'][_0x4580('0x48')]+'%'};return _0x53b078;})});}if(_0x311a35[_0x4580('0x26')][_0x4580('0x49')]){var _0x129dfd=_0x311a35[_0x4580('0x26')][_0x4580('0x49')][_0x4580('0x4a')](',');var _0xc90e3b={};_0xc90e3b[_0x129dfd[0x0]]={'$gte':moment(_0x129dfd[0x1])[_0x4580('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')};_0xcda0f5[_0x4580('0x45')]=_[_0x4580('0x33')](_0xcda0f5['where'],_0xc90e3b);}_0xcda0f5=_['merge']({},_0xcda0f5,_0x311a35['options']);return db['MailMessage'][_0x4580('0x17')]({'where':_0xcda0f5['where']})['then'](function(_0x10d955){_0x2abc21[_0x4580('0x17')]=_0x10d955;if(_0x311a35[_0x4580('0x26')][_0x4580('0x31')]){_0xcda0f5[_0x4580('0x32')]=[{'all':!![]}];}return db[_0x4580('0x3c')][_0x4580('0x24')](_0xcda0f5);})[_0x4580('0x1a')](function(_0x23f257){if(_0x311a35[_0x4580('0x26')]['inlineCss']===_0x4580('0x4c')){for(var _0x10e7b7=0x0;_0x10e7b7<_0x23f257[_0x4580('0x30')];_0x10e7b7++){_0x23f257[_0x10e7b7][_0x4580('0x35')]=juice(_0x23f257[_0x10e7b7][_0x4580('0x35')]);}}_0x2abc21[_0x4580('0x4d')]=_0x23f257;return _0x2abc21;});}})['then'](respondWithFilteredResult(_0x7ac481,_0xcda0f5))['catch'](handleError(_0x7ac481,null));};exports[_0x4580('0x4e')]=function(_0x419725,_0x5560cf){return db[_0x4580('0x21')][_0x4580('0x37')]({'where':{'id':_0x419725[_0x4580('0x38')]['id']}})[_0x4580('0x1a')](handleEntityNotFound(_0x5560cf,null))[_0x4580('0x1a')](function(_0xb70b37){if(_0xb70b37){return _0xb70b37[_0x4580('0x4f')](_0x419725['body'][_0x4580('0x3d')],_['omit'](_0x419725[_0x4580('0x35')],[_0x4580('0x3d'),'id'])||{})[_0x4580('0x50')](function(){return db[_0x4580('0x51')][_0x4580('0x24')]({'attributes':['id','name','color'],'where':{'id':_0x419725['body']['ids']}});})[_0x4580('0x1a')](function(_0x1bfb24){socket[_0x4580('0x52')]('mailInteractionTags:save',{'id':Number(_0x419725[_0x4580('0x38')]['id']),'tags':_0x1bfb24||[]});return{'id':Number(_0x419725[_0x4580('0x38')]['id']),'tags':_0x1bfb24||[]};});}})[_0x4580('0x1a')](respondWithResult(_0x5560cf,null))['catch'](handleError(_0x5560cf,null));};exports[_0x4580('0x53')]=function(_0x3c82f4,_0xdf044e){return db['MailInteraction'][_0x4580('0x37')]({'where':{'id':_0x3c82f4[_0x4580('0x38')]['id']}})[_0x4580('0x1a')](handleEntityNotFound(_0xdf044e,null))[_0x4580('0x1a')](function(_0x32c743){if(_0x32c743){return _0x32c743[_0x4580('0x53')](_0x3c82f4[_0x4580('0x26')][_0x4580('0x3d')]);}})[_0x4580('0x1a')](respondWithStatusCode(_0xdf044e,null))[_0x4580('0x28')](handleError(_0xdf044e,null));};exports[_0x4580('0x54')]=function(_0x25bbff,_0x52b956){var _0x373637=moment()['unix']()[_0x4580('0x55')]();var _0x2103c9=path[_0x4580('0x56')](config['root'],_0x4580('0x57'),_0x4580('0x58'),_0x4580('0x59'));var _0x3607a9=path[_0x4580('0x56')](config[_0x4580('0x5a')],_0x4580('0x57'),'files',_0x4580('0x5b'));var _0x150c14=path[_0x4580('0x56')](_0x2103c9,_0x373637);var _0x5bd701=util['format'](_0x4580('0x5c'),_0x25bbff[_0x4580('0x38')]['id'],_0x373637);var _0x4a1106=path[_0x4580('0x56')](_0x2103c9,_0x5bd701);var _0xc9d7e7=[];if(_0x25bbff[_0x4580('0x26')][_0x4580('0x5b')]){_0xc9d7e7[_0x4580('0x5d')]({'model':db[_0x4580('0x5e')],'as':_0x4580('0x5f'),'raw':!![]});}var _0x56fa4e=[{'model':db[_0x4580('0x3c')],'as':'Messages','attributes':['id',_0x4580('0x35'),_0x4580('0x60'),'to','cc',_0x4580('0x61'),_0x4580('0x62'),_0x4580('0x63')],'where':{'secret':![]},'order':qs[_0x4580('0x44')]('id'),'include':_0xc9d7e7}];return db[_0x4580('0x21')]['find']({'where':{'id':_0x25bbff[_0x4580('0x38')]['id']},'include':_0x56fa4e})[_0x4580('0x1a')](handleEntityNotFound(_0x52b956,null))[_0x4580('0x1a')](function(_0xc139d5){if(_0xc139d5&&_0xc139d5[_0x4580('0x64')]){var _0x3b2af7=_0xc139d5[_0x4580('0x65')]({'plain':!![]});fs['mkdirSync'](_0x150c14);return BPromise[_0x4580('0x66')](_0x3b2af7[_0x4580('0x64')],function(_0x40d137,_0x36b044){var _0x4306e7={'from':_0x40d137[_0x4580('0x60')],'to':_0x40d137['to']||_0x4580('0x67'),'subject':_0x40d137[_0x4580('0x62')],'html':htmlEntities[_0x4580('0x68')](_0x40d137[_0x4580('0x35')]),'headers':{'Date':moment(_0x40d137[_0x4580('0x63')])[_0x4580('0x4b')](_0x4580('0x69'))},'attachments':[]};if(_0x40d137['cc']){_0x4306e7['headers']['Cc']=_0x40d137['cc'];}if(_0x40d137[_0x4580('0x61')]){_0x4306e7[_0x4580('0x6a')]['Bcc']=_0x40d137[_0x4580('0x61')];}return new BPromise(function(_0x282c8d,_0x49ee34){if(_0x40d137[_0x4580('0x5f')]){for(var _0x431a83=0x0;_0x431a83<_0x40d137[_0x4580('0x5f')][_0x4580('0x30')];_0x431a83++){var _0x265b26=_0x40d137[_0x4580('0x5f')][_0x431a83];var _0x1ff137=path[_0x4580('0x56')](_0x3607a9,_0x265b26['basename']);if(fs[_0x4580('0x6b')](_0x1ff137)){_0x4306e7[_0x4580('0x5b')]['push']({'name':_0x265b26[_0x4580('0x1d')],'contentType':_0x265b26[_0x4580('0x23')],'data':fs['readFileSync'](_0x1ff137)});}}}emlformat['build'](_0x4306e7,function(_0x44cad2,_0x40f302){if(_0x44cad2)return _0x49ee34(_0x44cad2);fs[_0x4580('0x6c')](path['join'](_0x150c14,util[_0x4580('0x4b')](_0x4580('0x6d'),_0x36b044)),_0x40f302);return _0x282c8d(_0x40f302);});});})[_0x4580('0x1a')](function(){return new BPromise(function(_0x36f203,_0x1f283a){zipdir(_0x150c14,{'saveTo':_0x4a1106},function(_0x4853de,_0x2792dd){if(_0x4853de)return _0x1f283a(_0x4853de);return _0x36f203(_0x2792dd);});})[_0x4580('0x1a')](function(){return new BPromise(function(_0x1c41d7,_0x1660b0){rimraf(_0x150c14,function(_0x46ac6e){if(_0x46ac6e)_0x1660b0(_0x46ac6e);return _0x1c41d7();});});})[_0x4580('0x1a')](function(){return _0x52b956[_0x4580('0x54')](_0x4a1106,_0x5bd701,function(_0xd929ef){if(!_0xd929ef)fs[_0x4580('0x6e')](_0x4a1106);});});});}else{return _0x52b956['sendStatus'](0xc8);}})['catch'](handleError(_0x52b956,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 4d30f25..a869332 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 _0x8120=['length','emit','hasOwnProperty','exports','../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0xd9818f,_0x130fc7){var _0x71c08c=function(_0x42f25b){while(--_0x42f25b){_0xd9818f['push'](_0xd9818f['shift']());}};_0x71c08c(++_0x130fc7);}(_0x8120,0x124));var _0x0812=function(_0x57d58c,_0x37bd6b){_0x57d58c=_0x57d58c-0x0;var _0x225523=_0x8120[_0x57d58c];return _0x225523;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x0812('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x0812('0x0'))['db'][_0x0812('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0812('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0812('0x3'),'afterDestroy':_0x0812('0x4')};function emitEvent(_0x1fe1ec){return function(_0x3427ff,_0x231c46,_0xe930c2){_0x3427ff[_0x0812('0x5')]({'attributes':['id'],'raw':!![]})[_0x0812('0x6')](function(_0x13f79d){_0x3427ff[_0x0812('0x7')](_0x0812('0x8'),_0x13f79d[_0x0812('0x9')](function(_0x58b792){return{'id':_0x58b792['id']};}));return MailMessage[_0x0812('0xa')]({'where':{'MailInteractionId':_0x3427ff['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0812('0x6')](function(_0x21162e){_0x3427ff['setDataValue'](_0x0812('0xb'),_0x21162e[_0x0812('0xc')]);MailInteractionEvents['emit'](_0x1fe1ec+':'+_0x3427ff['id'],_0x3427ff);MailInteractionEvents[_0x0812('0xd')](_0x1fe1ec,_0x3427ff);_0xe930c2(null);})['catch'](_0xe930c2(null));};}for(var e in events){if(events[_0x0812('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x0812('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x9512=['hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0x9512,0x1ac));var _0x2951=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x9512[_0xf73c09];return _0xa8923c;};'use strict';var EventEmitter=require(_0x2951('0x0'));var MailInteraction=require(_0x2951('0x1'))['db'][_0x2951('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x2951('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x2951('0x4')](0x0);var events={'afterCreate':_0x2951('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45f9d6){return function(_0x18223c,_0x31bc9b,_0x4448b3){_0x18223c[_0x2951('0x6')]({'attributes':['id'],'raw':!![]})[_0x2951('0x7')](function(_0x3e1207){_0x18223c[_0x2951('0x8')]('Users',_0x3e1207[_0x2951('0x9')](function(_0x28c7f5){return{'id':_0x28c7f5['id']};}));return MailMessage[_0x2951('0xa')]({'where':{'MailInteractionId':_0x18223c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2951('0x7')](function(_0x31771e){_0x18223c[_0x2951('0x8')](_0x2951('0xb'),_0x31771e['length']);MailInteractionEvents[_0x2951('0xc')](_0x45f9d6+':'+_0x18223c['id'],_0x18223c);MailInteractionEvents[_0x2951('0xc')](_0x45f9d6,_0x18223c);_0x4448b3(null);})[_0x2951('0xd')](_0x4448b3(null));};}for(var e in events){if(events[_0x2951('0xe')](e)){var event=events[e];MailInteraction[_0x2951('0xf')](e,emitEvent(event));}}module[_0x2951('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 262e92e..af04073 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 _0xfc36=['exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatus','changed','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','rimraf','../../config/environment','./mailInteraction.attributes'];(function(_0x4e3dee,_0x14973d){var _0x35aabd=function(_0x557c0f){while(--_0x557c0f){_0x4e3dee['push'](_0x4e3dee['shift']());}};_0x35aabd(++_0x14973d);}(_0xfc36,0xfd));var _0x6fc3=function(_0xd13182,_0x306b72){_0xd13182=_0xd13182-0x0;var _0x4855a7=_0xfc36[_0xd13182];return _0x4855a7;};'use strict';var _=require(_0x6fc3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6fc3('0x1'));var moment=require(_0x6fc3('0x2'));var BPromise=require(_0x6fc3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6fc3('0x4'));var config=require(_0x6fc3('0x5'));var attributes=require(_0x6fc3('0x6'));module[_0x6fc3('0x7')]=function(_0x37a2ba,_0x53b368){return _0x37a2ba[_0x6fc3('0x8')]('MailInteraction',attributes,{'tableName':_0x6fc3('0x9'),'paranoid':![],'indexes':[{'name':_0x6fc3('0xa'),'fields':[_0x6fc3('0xb'),'to'],'type':_0x6fc3('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2bb940,_0x51014d,_0x3675da){if(_0x2bb940['substatus']){_0x2bb940[_0x6fc3('0xd')]=moment()[_0x6fc3('0xe')](_0x6fc3('0xf'));}if(_0x2bb940[_0x6fc3('0x10')]){_0x2bb940[_0x6fc3('0x11')]=moment()['format'](_0x6fc3('0xf'));}_0x3675da(null,_0x51014d);},'beforeUpdate':function(_0x1921a2,_0x13b662,_0x2a2196){if(_0x1921a2['changed'](_0x6fc3('0x12'))){_0x1921a2[_0x6fc3('0xd')]=_0x1921a2[_0x6fc3('0x12')]?moment()[_0x6fc3('0xe')](_0x6fc3('0xf')):null;}if(_0x1921a2[_0x6fc3('0x13')](_0x6fc3('0x10'))){_0x1921a2[_0x6fc3('0x11')]=moment()[_0x6fc3('0xe')](_0x6fc3('0xf'));_0x1921a2[_0x6fc3('0x12')]=null;_0x1921a2[_0x6fc3('0xd')]=null;}_0x2a2196(null,_0x1921a2);},'afterUpdate':function(_0x59dd76,_0x216fa8,_0x2957a1){var _0x5e5d9e=_0x37a2ba['models'];var _0xf3efd=_0x59dd76[_0x6fc3('0x14')]({'plain':!![]});if(_0xf3efd[_0x6fc3('0x10')]){return _0x5e5d9e[_0x6fc3('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xf3efd['id']}})[_0x6fc3('0x16')](function(){_0x2957a1();})[_0x6fc3('0x17')](function(_0x2697f3){_0x2957a1(_0x2697f3);});}else{_0x2957a1();}}},'charset':_0x6fc3('0x18'),'collate':_0x6fc3('0x19')});}; \ No newline at end of file +var _0x09d9=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','fti_mail_interactions','subject','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','substatus','changed','closedAt','models','MailMessage','update','then','catch'];(function(_0x4c685e,_0x2bae7c){var _0x13f24a=function(_0x57d9e2){while(--_0x57d9e2){_0x4c685e['push'](_0x4c685e['shift']());}};_0x13f24a(++_0x2bae7c);}(_0x09d9,0x1ab));var _0x909d=function(_0x55ba56,_0x19a08d){_0x55ba56=_0x55ba56-0x0;var _0x47bd94=_0x09d9[_0x55ba56];return _0x47bd94;};'use strict';var _=require(_0x909d('0x0'));var util=require('util');var logger=require(_0x909d('0x1'))(_0x909d('0x2'));var moment=require(_0x909d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x909d('0x4'));var config=require(_0x909d('0x5'));var attributes=require(_0x909d('0x6'));module['exports']=function(_0x207b72,_0x3a38b4){return _0x207b72[_0x909d('0x7')](_0x909d('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x909d('0x9'),'fields':[_0x909d('0xa'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5cfcdf,_0x14fb75,_0x530169){if(_0x5cfcdf['substatus']){_0x5cfcdf[_0x909d('0xb')]=moment()[_0x909d('0xc')](_0x909d('0xd'));}if(_0x5cfcdf[_0x909d('0xe')]){_0x5cfcdf['closedAt']=moment()[_0x909d('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x530169(null,_0x14fb75);},'beforeUpdate':function(_0x465e9e,_0x571b19,_0x23e4be){if(_0x465e9e['changed'](_0x909d('0xf'))){_0x465e9e[_0x909d('0xb')]=_0x465e9e[_0x909d('0xf')]?moment()[_0x909d('0xc')](_0x909d('0xd')):null;}if(_0x465e9e[_0x909d('0x10')](_0x909d('0xe'))){_0x465e9e[_0x909d('0x11')]=moment()['format'](_0x909d('0xd'));_0x465e9e[_0x909d('0xf')]=null;_0x465e9e[_0x909d('0xb')]=null;}_0x23e4be(null,_0x465e9e);},'afterUpdate':function(_0x4f09df,_0x272090,_0x14b6ac){var _0x97efba=_0x207b72[_0x909d('0x12')];var _0x222a66=_0x4f09df['get']({'plain':!![]});if(_0x222a66[_0x909d('0xe')]){return _0x97efba[_0x909d('0x13')][_0x909d('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x222a66['id']}})[_0x909d('0x15')](function(){_0x14b6ac();})[_0x909d('0x16')](function(_0x3cebcf){_0x14b6ac(_0x3cebcf);});}else{_0x14b6ac();}}},'charset':_0x909d('0x17'),'collate':_0x909d('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 51205fe..5a48ca2 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 _0x9775=['update','body','options','where','limit','stringify','catch','AddTagsToMailInteraction','find','addTags','omit','ids','spread','AddTags','util','randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','code','error','message','result','UpdateMailInteraction','MailInteraction'];(function(_0x5d8987,_0x14d054){var _0x2997eb=function(_0x56f92a){while(--_0x56f92a){_0x5d8987['push'](_0x5d8987['shift']());}};_0x2997eb(++_0x14d054);}(_0x9775,0x16d));var _0x5977=function(_0xb174fc,_0x12c8e4){_0xb174fc=_0xb174fc-0x0;var _0x15af14=_0x9775[_0xb174fc];return _0x15af14;};'use strict';var _=require('lodash');var util=require(_0x5977('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5977('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5977('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5977('0x3'));var config=require(_0x5977('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x5977('0x5')][_0x5977('0x6')]({'port':0x232a});config[_0x5977('0x7')]=_[_0x5977('0x8')](config[_0x5977('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x5977('0x9'))(new Redis(config[_0x5977('0x7')]));require(_0x5977('0xa'))[_0x5977('0xb')](socket);function respondWithRpcPromise(_0x1ee51c,_0x453184,_0x120831){return new BPromise(function(_0x41b6aa,_0x338ba7){return client[_0x5977('0xc')](_0x1ee51c,_0x120831)[_0x5977('0xd')](function(_0x123679){logger[_0x5977('0xe')](_0x5977('0xf'),_0x453184,_0x5977('0x10'));logger[_0x5977('0x11')](_0x5977('0x12'),_0x453184,_0x5977('0x10'),JSON['stringify'](_0x123679));if(_0x123679['error']){if(_0x123679['error'][_0x5977('0x13')]===0x1f4){logger[_0x5977('0x14')](_0x5977('0xf'),_0x453184,_0x123679[_0x5977('0x14')]['message']);return _0x338ba7(_0x123679['error'][_0x5977('0x15')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x453184,_0x123679[_0x5977('0x14')][_0x5977('0x15')]);return _0x41b6aa(_0x123679['error'][_0x5977('0x15')]);}else{logger[_0x5977('0xe')]('MailInteraction,\x20%s,\x20%s',_0x453184,_0x5977('0x10'));_0x41b6aa(_0x123679[_0x5977('0x16')][_0x5977('0x15')]);}})['catch'](function(_0x43a94a){logger[_0x5977('0x14')](_0x5977('0xf'),_0x453184,_0x43a94a);_0x338ba7(_0x43a94a);});});}exports[_0x5977('0x17')]=function(_0x4aefa3){var _0x13e332=this;return new Promise(function(_0x211ee2,_0x190fa6){return db[_0x5977('0x18')][_0x5977('0x19')](_0x4aefa3[_0x5977('0x1a')],{'raw':_0x4aefa3[_0x5977('0x1b')]?_0x4aefa3[_0x5977('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4aefa3[_0x5977('0x1b')]?_0x4aefa3[_0x5977('0x1b')][_0x5977('0x1c')]||null:null,'attributes':_0x4aefa3[_0x5977('0x1b')]?_0x4aefa3[_0x5977('0x1b')]['attributes']||null:null,'limit':_0x4aefa3[_0x5977('0x1b')]?_0x4aefa3[_0x5977('0x1b')][_0x5977('0x1d')]||null:null})[_0x5977('0xd')](function(_0x534831){logger[_0x5977('0xe')](_0x5977('0x17'),_0x4aefa3);logger[_0x5977('0x11')](_0x5977('0x17'),_0x4aefa3,JSON[_0x5977('0x1e')](_0x534831));_0x211ee2(_0x534831);})[_0x5977('0x1f')](function(_0x2a11ac){logger[_0x5977('0x14')](_0x5977('0x17'),_0x2a11ac[_0x5977('0x15')],_0x4aefa3);_0x190fa6(_0x13e332[_0x5977('0x14')](0x1f4,_0x2a11ac['message']));});});};exports[_0x5977('0x20')]=function(_0x2fa0c4){return new Promise(function(_0x527035,_0x2395d2){return db['MailInteraction'][_0x5977('0x21')]({'where':_0x2fa0c4[_0x5977('0x1b')]?_0x2fa0c4['options'][_0x5977('0x1c')]||null:null})[_0x5977('0xd')](function(_0x372673){if(_0x372673){return _0x372673[_0x5977('0x22')](_0x2fa0c4[_0x5977('0x1a')]['ids'],_[_0x5977('0x23')](_0x2fa0c4[_0x5977('0x1a')],[_0x5977('0x24'),'id'])||{});}})[_0x5977('0x25')](function(_0x2afbc0){logger[_0x5977('0xe')]('AddTags',_0x2fa0c4);logger['debug'](_0x5977('0x26'),_0x2fa0c4,JSON[_0x5977('0x1e')](_0x2afbc0));_0x527035(_0x2afbc0);})[_0x5977('0x1f')](function(_0x9a9e98){logger['error']('AddTags',_0x9a9e98[_0x5977('0x15')],_0x2fa0c4);_0x2395d2(_this[_0x5977('0x14')](0x1f4,_0x9a9e98[_0x5977('0x15')]));});});}; \ No newline at end of file +var _0xb10f=['localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','MailInteraction','update','body','options','raw','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x23d160,_0x15e4dc){var _0x5df430=function(_0x588aca){while(--_0x588aca){_0x23d160['push'](_0x23d160['shift']());}};_0x5df430(++_0x15e4dc);}(_0xb10f,0xa3));var _0xfb10=function(_0x530bdd,_0x21c51b){_0x530bdd=_0x530bdd-0x0;var _0x5ad537=_0xb10f[_0x530bdd];return _0x5ad537;};'use strict';var _=require('lodash');var util=require(_0xfb10('0x0'));var moment=require(_0xfb10('0x1'));var BPromise=require(_0xfb10('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb10('0x3'));var db=require(_0xfb10('0x4'))['db'];var utils=require(_0xfb10('0x5'));var logger=require(_0xfb10('0x6'))(_0xfb10('0x7'));var config=require(_0xfb10('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfb10('0x9')][_0xfb10('0xa')]({'port':0x232a});config[_0xfb10('0xb')]=_[_0xfb10('0xc')](config['redis'],{'host':_0xfb10('0xd'),'port':0x18eb});var socket=require(_0xfb10('0xe'))(new Redis(config['redis']));require(_0xfb10('0xf'))[_0xfb10('0x10')](socket);function respondWithRpcPromise(_0x161228,_0x4242cf,_0xa6c950){return new BPromise(function(_0x218810,_0x3d54a3){return client['request'](_0x161228,_0xa6c950)[_0xfb10('0x11')](function(_0x23f179){logger[_0xfb10('0x12')](_0xfb10('0x13'),_0x4242cf,'request\x20sent');logger[_0xfb10('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4242cf,_0xfb10('0x15'),JSON[_0xfb10('0x16')](_0x23f179));if(_0x23f179[_0xfb10('0x17')]){if(_0x23f179[_0xfb10('0x17')][_0xfb10('0x18')]===0x1f4){logger[_0xfb10('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4242cf,_0x23f179[_0xfb10('0x17')][_0xfb10('0x19')]);return _0x3d54a3(_0x23f179[_0xfb10('0x17')][_0xfb10('0x19')]);}logger[_0xfb10('0x17')](_0xfb10('0x13'),_0x4242cf,_0x23f179['error'][_0xfb10('0x19')]);return _0x218810(_0x23f179[_0xfb10('0x17')][_0xfb10('0x19')]);}else{logger[_0xfb10('0x12')](_0xfb10('0x13'),_0x4242cf,_0xfb10('0x15'));_0x218810(_0x23f179[_0xfb10('0x1a')][_0xfb10('0x19')]);}})[_0xfb10('0x1b')](function(_0x29519b){logger[_0xfb10('0x17')](_0xfb10('0x13'),_0x4242cf,_0x29519b);_0x3d54a3(_0x29519b);});});}exports['UpdateMailInteraction']=function(_0x258ce4){var _0x3f4416=this;return new Promise(function(_0x2c96dc,_0x52b5a2){return db[_0xfb10('0x1c')][_0xfb10('0x1d')](_0x258ce4[_0xfb10('0x1e')],{'raw':_0x258ce4[_0xfb10('0x1f')]?_0x258ce4[_0xfb10('0x1f')][_0xfb10('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258ce4[_0xfb10('0x1f')]?_0x258ce4[_0xfb10('0x1f')]['where']||null:null,'attributes':_0x258ce4[_0xfb10('0x1f')]?_0x258ce4['options'][_0xfb10('0x21')]||null:null,'limit':_0x258ce4[_0xfb10('0x1f')]?_0x258ce4[_0xfb10('0x1f')][_0xfb10('0x22')]||null:null})['then'](function(_0x758d36){logger[_0xfb10('0x12')](_0xfb10('0x23'),_0x258ce4);logger[_0xfb10('0x14')]('UpdateMailInteraction',_0x258ce4,JSON[_0xfb10('0x16')](_0x758d36));_0x2c96dc(_0x758d36);})['catch'](function(_0x3feb0b){logger[_0xfb10('0x17')]('UpdateMailInteraction',_0x3feb0b[_0xfb10('0x19')],_0x258ce4);_0x52b5a2(_0x3f4416['error'](0x1f4,_0x3feb0b['message']));});});};exports[_0xfb10('0x24')]=function(_0x2e0ee7){return new Promise(function(_0x1870df,_0x49cd1e){return db[_0xfb10('0x1c')][_0xfb10('0x25')]({'where':_0x2e0ee7[_0xfb10('0x1f')]?_0x2e0ee7[_0xfb10('0x1f')][_0xfb10('0x26')]||null:null})[_0xfb10('0x11')](function(_0x4466b4){if(_0x4466b4){return _0x4466b4[_0xfb10('0x27')](_0x2e0ee7[_0xfb10('0x1e')][_0xfb10('0x28')],_[_0xfb10('0x29')](_0x2e0ee7[_0xfb10('0x1e')],['ids','id'])||{});}})[_0xfb10('0x2a')](function(_0x2943d5){logger[_0xfb10('0x12')](_0xfb10('0x2b'),_0x2e0ee7);logger[_0xfb10('0x14')](_0xfb10('0x2b'),_0x2e0ee7,JSON[_0xfb10('0x16')](_0x2943d5));_0x1870df(_0x2943d5);})['catch'](function(_0x39bdc){logger[_0xfb10('0x17')](_0xfb10('0x2b'),_0x39bdc[_0xfb10('0x19')],_0x2e0ee7);_0x49cd1e(_this[_0xfb10('0x17')](0x1f4,_0x39bdc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 482ee62..20f7694 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 _0x62f2=['remove','update','emit','removeListener','register','length','mailInteraction:','save'];(function(_0x727c31,_0x4b6046){var _0x4fc54b=function(_0x4f3fa6){while(--_0x4f3fa6){_0x727c31['push'](_0x727c31['shift']());}};_0x4fc54b(++_0x4b6046);}(_0x62f2,0xff));var _0x262f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x62f2[_0xa464c9];return _0x3d73c4;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x262f('0x0'),_0x262f('0x1'),_0x262f('0x2')];function createListener(_0xe0f6d3,_0x56a1d3){return function(_0x488aaa){_0x56a1d3[_0x262f('0x3')](_0xe0f6d3,_0x488aaa);};}function removeListener(_0x395735,_0x2c4917){return function(){MailInteractionEvents[_0x262f('0x4')](_0x395735,_0x2c4917);};}exports[_0x262f('0x5')]=function(_0x531a60){for(var _0xb7bc5f=0x0,_0x39f3d3=events[_0x262f('0x6')];_0xb7bc5f<_0x39f3d3;_0xb7bc5f++){var _0x4479c6=events[_0xb7bc5f];var _0x157614=createListener(_0x262f('0x7')+_0x4479c6,_0x531a60);MailInteractionEvents['on'](_0x4479c6,_0x157614);}}; \ No newline at end of file +var _0xa7bf=['emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','update'];(function(_0x1650f3,_0x5716d0){var _0x36ebe5=function(_0x44af7f){while(--_0x44af7f){_0x1650f3['push'](_0x1650f3['shift']());}};_0x36ebe5(++_0x5716d0);}(_0xa7bf,0x140));var _0xfa7b=function(_0x147e49,_0x2a121b){_0x147e49=_0x147e49-0x0;var _0x4b406e=_0xa7bf[_0x147e49];return _0x4b406e;};'use strict';var MailInteractionEvents=require(_0xfa7b('0x0'));var events=[_0xfa7b('0x1'),_0xfa7b('0x2'),_0xfa7b('0x3')];function createListener(_0x59f4cb,_0xe8db9f){return function(_0x46f468){_0xe8db9f[_0xfa7b('0x4')](_0x59f4cb,_0x46f468);};}function removeListener(_0x3a7721,_0x3420c6){return function(){MailInteractionEvents[_0xfa7b('0x5')](_0x3a7721,_0x3420c6);};}exports[_0xfa7b('0x6')]=function(_0x27f93e){for(var _0xcf5f31=0x0,_0x551222=events[_0xfa7b('0x7')];_0xcf5f31<_0x551222;_0xcf5f31++){var _0x55ce62=events[_0xcf5f31];var _0x5b2e0c=createListener(_0xfa7b('0x8')+_0x55ce62,_0x27f93e);MailInteractionEvents['on'](_0x55ce62,_0x5b2e0c);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 7efd11c..0fe7979 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb07=['express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get','isAuthenticated','describe','exports'];(function(_0x473af7,_0x49a38b){var _0x4cbf74=function(_0x1917da){while(--_0x1917da){_0x473af7['push'](_0x473af7['shift']());}};_0x4cbf74(++_0x49a38b);}(_0xcb07,0x98));var _0x7cb0=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xcb07[_0x2adbeb];return _0x5e18a6;};'use strict';var express=require(_0x7cb0('0x0'));var router=express[_0x7cb0('0x1')]();var auth=require(_0x7cb0('0x2'));var controller=require(_0x7cb0('0x3'));router[_0x7cb0('0x4')]('/describe',auth[_0x7cb0('0x5')](),controller[_0x7cb0('0x6')]);module[_0x7cb0('0x7')]=router; \ No newline at end of file +var _0x3f8a=['./mailInteractionHasTag.controller','/describe','isAuthenticated','describe','exports','express','Router','../../components/auth/service'];(function(_0x5bccd3,_0x4e2b7b){var _0x322dbc=function(_0x2f7b82){while(--_0x2f7b82){_0x5bccd3['push'](_0x5bccd3['shift']());}};_0x322dbc(++_0x4e2b7b);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3a213b,_0x1626a6){_0x3a213b=_0x3a213b-0x0;var _0x1353cd=_0x3f8a[_0x3a213b];return _0x1353cd;};'use strict';var express=require(_0xa3f8('0x0'));var router=express[_0xa3f8('0x1')]();var auth=require(_0xa3f8('0x2'));var controller=require(_0xa3f8('0x3'));router['get'](_0xa3f8('0x4'),auth[_0xa3f8('0x5')](),controller[_0xa3f8('0x6')]);module[_0xa3f8('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index baaac36..6f4eed3 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x18f1ad,_0x73d824){var _0x25e544=function(_0x3a344b){while(--_0x3a344b){_0x18f1ad['push'](_0x18f1ad['shift']());}};_0x25e544(++_0x73d824);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x37c75a,_0x9ae779){var _0x4e5927=function(_0x533866){while(--_0x533866){_0x37c75a['push'](_0x37c75a['shift']());}};_0x4e5927(++_0x9ae779);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 08d4f81..cf13110 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b67=['sequelize','exports','INTEGER'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0x7b67,0x195));var _0x77b6=function(_0x4c0e85,_0x49e1be){_0x4c0e85=_0x4c0e85-0x0;var _0x1feade=_0x7b67[_0x4c0e85];return _0x1feade;};'use strict';var Sequelize=require(_0x77b6('0x0'));module[_0x77b6('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x77b6('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x9d38=['INTEGER'];(function(_0x2af890,_0x388497){var _0x2354b2=function(_0x5aab9f){while(--_0x5aab9f){_0x2af890['push'](_0x2af890['shift']());}};_0x2354b2(++_0x388497);}(_0x9d38,0x173));var _0x89d3=function(_0x189a32,_0x1e4100){_0x189a32=_0x189a32-0x0;var _0x558fcc=_0x9d38[_0x189a32];return _0x558fcc;};'use strict';var Sequelize=require('sequelize');module['exports']={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x89d3('0x0')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 253c853..0de1bf8 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5592=['./mailInteractionHasTag','exports','mail_interaction_has_tags'];(function(_0x9a825b,_0x35c63e){var _0x4e5706=function(_0x20e4f2){while(--_0x20e4f2){_0x9a825b['push'](_0x9a825b['shift']());}};_0x4e5706(++_0x35c63e);}(_0x5592,0xab));var _0x2559=function(_0x5e9dfd,_0x508625){_0x5e9dfd=_0x5e9dfd-0x0;var _0x264b0f=_0x5592[_0x5e9dfd];return _0x264b0f;};'use strict';var attributes=require(_0x2559('0x0'));module[_0x2559('0x1')]=function(_0x35ce93){return _0x35ce93['define']('MailInteractionHasTag',attributes,{'tableName':_0x2559('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35f2=['exports','define','MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0x199d51,_0x24c09e){var _0x21fed8=function(_0x2ac403){while(--_0x2ac403){_0x199d51['push'](_0x199d51['shift']());}};_0x21fed8(++_0x24c09e);}(_0x35f2,0xb8));var _0x235f=function(_0x3f034e,_0xf1a7a){_0x3f034e=_0x3f034e-0x0;var _0x589189=_0x35f2[_0x3f034e];return _0x589189;};'use strict';var attributes=require(_0x235f('0x0'));module[_0x235f('0x1')]=function(_0x15625e){return _0x15625e[_0x235f('0x2')](_0x235f('0x3'),attributes,{'tableName':_0x235f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a10603b..a984b92 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 _0xa9e0=['/:id/reject','reject','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','show','/:id/download','isAuthenticated','download','post','create','put','/:id','update','accept'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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('0xf')]('/',auth['isAuthenticated'](),interaction['tracked']('mail','mailmessage:create'),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x11')]('/:id/accept',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0x15'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x16')]);router['delete'](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);module['exports']=router; \ No newline at end of file +var _0xb921=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','create','put','update','/:id/accept','accept','delete','exports','multer','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb921,0x16a));var _0x1b92=function(_0x12e075,_0x2f6b9c){_0x12e075=_0x12e075-0x0;var _0xacd6dd=_0xb921[_0x12e075];return _0xacd6dd;};'use strict';var multer=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var path=require(_0x1b92('0x2'));var timeout=require(_0x1b92('0x3'));var express=require(_0x1b92('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1b92('0x5'));var interaction=require(_0x1b92('0x6'));var config=require(_0x1b92('0x7'));var controller=require(_0x1b92('0x8'));router[_0x1b92('0x9')]('/',auth[_0x1b92('0xa')](),controller[_0x1b92('0xb')]);router[_0x1b92('0x9')](_0x1b92('0xc'),auth[_0x1b92('0xa')](),controller[_0x1b92('0xd')]);router[_0x1b92('0x9')](_0x1b92('0xe'),auth[_0x1b92('0xa')](),controller[_0x1b92('0xf')]);router['get'](_0x1b92('0x10'),auth[_0x1b92('0xa')](),controller[_0x1b92('0x11')]);router[_0x1b92('0x12')]('/',auth[_0x1b92('0xa')](),interaction[_0x1b92('0x13')](_0x1b92('0x14'),'mailmessage:create'),controller[_0x1b92('0x15')]);router[_0x1b92('0x16')]('/:id',auth[_0x1b92('0xa')](),controller[_0x1b92('0x17')]);router[_0x1b92('0x16')](_0x1b92('0x18'),auth[_0x1b92('0xa')](),controller[_0x1b92('0x19')]);router[_0x1b92('0x16')]('/:id/reject',auth[_0x1b92('0xa')](),controller['reject']);router[_0x1b92('0x1a')]('/:id',auth[_0x1b92('0xa')](),controller['destroy']);module[_0x1b92('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 307ed55..ffcefde 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 _0x5af6=['BOOLEAN','ENUM','out','STRING','TEXT','INTEGER','DATE','Email','sequelize','long','medium'];(function(_0x20157e,_0x57b6e4){var _0x333635=function(_0xe8eccc){while(--_0xe8eccc){_0x20157e['push'](_0x20157e['shift']());}};_0x333635(++_0x57b6e4);}(_0x5af6,0x15d));var _0x65af=function(_0x62a38f,_0xba94cc){_0x62a38f=_0x62a38f-0x0;var _0x1ec10f=_0x5af6[_0x62a38f];return _0x1ec10f;};'use strict';var Sequelize=require(_0x65af('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize['TEXT'](_0x65af('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x65af('0x2'))},'read':{'type':Sequelize[_0x65af('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x65af('0x4')]('in','out'),'defaultValue':_0x65af('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x65af('0x6')](0x1fe)},'from':{'type':Sequelize[_0x65af('0x6')]},'to':{'type':Sequelize['TEXT'](_0x65af('0x1'))},'cc':{'type':Sequelize[_0x65af('0x7')]('long')},'bcc':{'type':Sequelize[_0x65af('0x7')]('long')},'subject':{'type':Sequelize[_0x65af('0x7')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x65af('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x65af('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x65af('0x9')]},'originTo':{'type':Sequelize[_0x65af('0x7')](_0x65af('0x1'))},'originCc':{'type':Sequelize['TEXT'](_0x65af('0x1'))},'originChannel':{'type':Sequelize[_0x65af('0x4')](_0x65af('0xa'),'Chat'),'defaultValue':_0x65af('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x6a27=['medium','BOOLEAN','ENUM','out','STRING','DATE','Email','Chat','sequelize','TEXT','long'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x6a27,0x97));var _0x76a2=function(_0x133e8d,_0x4648f1){_0x133e8d=_0x133e8d-0x0;var _0x10ce55=_0x6a27[_0x133e8d];return _0x10ce55;};'use strict';var Sequelize=require(_0x76a2('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x76a2('0x1')](_0x76a2('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x76a2('0x1')](_0x76a2('0x3'))},'read':{'type':Sequelize[_0x76a2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x76a2('0x5')]('in',_0x76a2('0x6')),'defaultValue':_0x76a2('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x76a2('0x7')](0x1fe)},'from':{'type':Sequelize[_0x76a2('0x7')]},'to':{'type':Sequelize[_0x76a2('0x1')](_0x76a2('0x2'))},'cc':{'type':Sequelize[_0x76a2('0x1')]('long')},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x76a2('0x1')]},'sentAt':{'type':Sequelize[_0x76a2('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x76a2('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x76a2('0x8')]},'originTo':{'type':Sequelize[_0x76a2('0x1')]('long')},'originCc':{'type':Sequelize[_0x76a2('0x1')](_0x76a2('0x2'))},'originChannel':{'type':Sequelize[_0x76a2('0x5')](_0x76a2('0x9'),_0x76a2('0xa')),'defaultValue':_0x76a2('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 9d46ec3..27745e2 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 _0xc358=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','include','find','update','body','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','List','Contacts','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','CmContact','ListId','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','reject','UserId','agent','get','MailInteractionId','interaction','user','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','format','channel','event','EventManager','rejectmessage','download','unix','toString','server','files','join','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','build','writeFileSync','moment','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','limit','count','Content-Range','destroy','end','stack','name','send','index','map','MailMessage','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x59f0f7,_0x423bc4){var _0xf5ef2a=function(_0x53c37f){while(--_0x53c37f){_0x59f0f7['push'](_0x59f0f7['shift']());}};_0xf5ef2a(++_0x423bc4);}(_0xc358,0x16e));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var moment=require(_0x8c35('0x0'));var util=require('util');var path=require(_0x8c35('0x1'));var fs=require('fs');var _=require(_0x8c35('0x2'));var Redis=require(_0x8c35('0x3'));var htmlToText=require(_0x8c35('0x4'));var interactionService=require(_0x8c35('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x8c35('0x6'))('api');var interaction_log=require('../../config/logger')(_0x8c35('0x7'));var config=require(_0x8c35('0x8'));var db=require(_0x8c35('0x9'))['db'];config[_0x8c35('0xa')]=_[_0x8c35('0xb')](config[_0x8c35('0xa')],{'host':_0x8c35('0xc'),'port':0x18eb});var socket=require(_0x8c35('0xd'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0x8c35('0xe'))[_0x8c35('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8c35('0x10')][_0x8c35('0x11')]({'port':0x232c});var client9003=jayson[_0x8c35('0x10')]['http']({'port':0x232b});var client9002=jayson[_0x8c35('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25ebe3,_0x59b548,_0x3d87f3,_0x57f226){return new Promise(function(_0x2d52fb,_0x115c22){var _0x150208=_0x57f226||client;return _0x150208[_0x8c35('0x12')](_0x25ebe3,_0x3d87f3)[_0x8c35('0x13')](function(_0x5ea991){logger[_0x8c35('0x14')](_0x8c35('0x15'),_0x59b548,'request\x20sent');logger['debug'](_0x8c35('0x16'),_0x59b548,_0x8c35('0x17'),JSON[_0x8c35('0x18')](_0x5ea991));if(_0x5ea991['error']){if(_0x5ea991[_0x8c35('0x19')][_0x8c35('0x1a')]===0x1f4){logger['error'](_0x8c35('0x15'),_0x59b548,_0x5ea991['error'][_0x8c35('0x1b')]);return _0x115c22(_0x5ea991[_0x8c35('0x19')][_0x8c35('0x1b')]);}logger[_0x8c35('0x19')](_0x8c35('0x15'),_0x59b548,_0x5ea991[_0x8c35('0x19')][_0x8c35('0x1b')]);return _0x2d52fb(_0x5ea991[_0x8c35('0x19')]['message']);}else{logger[_0x8c35('0x14')](_0x8c35('0x15'),_0x59b548,_0x8c35('0x17'));_0x2d52fb(_0x5ea991[_0x8c35('0x1c')][_0x8c35('0x1b')]);}})[_0x8c35('0x1d')](function(_0x2e5e02){logger['error']('MailMessage,\x20%s,\x20%s',_0x59b548,_0x2e5e02);_0x115c22(_0x2e5e02);});});}function respondWithResult(_0x5f2fce,_0x45834a){_0x45834a=_0x45834a||0xc8;return function(_0x422e21){if(_0x422e21){return _0x5f2fce[_0x8c35('0x1e')](_0x45834a)[_0x8c35('0x1f')](_0x422e21);}};}function respondWithFilteredResult(_0x57dde6,_0x3cbf15){return function(_0x289f0e){if(_0x289f0e){var _0x2c77b2=typeof _0x3cbf15[_0x8c35('0x20')]==='undefined'&&typeof _0x3cbf15[_0x8c35('0x21')]==='undefined';var _0x2eecf4=_0x289f0e['count'];var _0x5af25a=_0x2c77b2?0x0:_0x3cbf15[_0x8c35('0x20')];var _0xf4ed60=_0x2c77b2?_0x289f0e[_0x8c35('0x22')]:_0x3cbf15[_0x8c35('0x20')]+_0x3cbf15[_0x8c35('0x21')];var _0x5a776c;if(_0xf4ed60>=_0x2eecf4){_0xf4ed60=_0x2eecf4;_0x5a776c=0xc8;}else{_0x5a776c=0xce;}_0x57dde6['status'](_0x5a776c);return _0x57dde6['set'](_0x8c35('0x23'),_0x5af25a+'-'+_0xf4ed60+'/'+_0x2eecf4)[_0x8c35('0x1f')](_0x289f0e);}return null;};}function saveUpdates(_0x227147){return function(_0x3c513a){if(_0x3c513a){return _0x3c513a['update'](_0x227147)[_0x8c35('0x13')](function(_0x23eecb){return _0x23eecb;});}return null;};}function removeEntity(_0x350dc0){return function(_0x2386a7){if(_0x2386a7){return _0x2386a7[_0x8c35('0x24')]()[_0x8c35('0x13')](function(){_0x350dc0['status'](0xcc)[_0x8c35('0x25')]();});}};}function handleEntityNotFound(_0x15a5ee){return function(_0x4f5cd4){if(!_0x4f5cd4){_0x15a5ee['sendStatus'](0x194);}return _0x4f5cd4;};}function handleError(_0x411c83,_0x199059){_0x199059=_0x199059||0x1f4;return function(_0x7fd569){logger[_0x8c35('0x19')](_0x7fd569[_0x8c35('0x26')]);if(_0x7fd569['name']){delete _0x7fd569[_0x8c35('0x27')];}_0x411c83[_0x8c35('0x1e')](_0x199059)[_0x8c35('0x28')](_0x7fd569);};}exports[_0x8c35('0x29')]=function(_0x43ddd6,_0x594a12){var _0x1d980d={},_0x487fd9={},_0x5460a9={'count':0x0,'rows':[]};var _0x2a4ecc=_[_0x8c35('0x2a')](db[_0x8c35('0x2b')]['rawAttributes'],function(_0x2a5158){return{'name':_0x2a5158[_0x8c35('0x2c')],'type':_0x2a5158[_0x8c35('0x2d')][_0x8c35('0x2e')]};});_0x487fd9[_0x8c35('0x2f')]=_[_0x8c35('0x2a')](_0x2a4ecc,_0x8c35('0x27'));_0x487fd9[_0x8c35('0x30')]=_[_0x8c35('0x31')](_0x43ddd6['query']);_0x487fd9['filters']=_[_0x8c35('0x32')](_0x487fd9['model'],_0x487fd9[_0x8c35('0x30')]);_0x1d980d['attributes']=_[_0x8c35('0x32')](_0x487fd9[_0x8c35('0x2f')],qs[_0x8c35('0x33')](_0x43ddd6[_0x8c35('0x30')]['fields']));_0x1d980d[_0x8c35('0x34')]=_0x1d980d[_0x8c35('0x34')][_0x8c35('0x35')]?_0x1d980d[_0x8c35('0x34')]:_0x487fd9['model'];if(!_0x43ddd6[_0x8c35('0x30')][_0x8c35('0x36')](_0x8c35('0x37'))){_0x1d980d[_0x8c35('0x21')]=qs['limit'](_0x43ddd6[_0x8c35('0x30')]['limit']);_0x1d980d[_0x8c35('0x20')]=qs[_0x8c35('0x20')](_0x43ddd6[_0x8c35('0x30')][_0x8c35('0x20')]);}_0x1d980d[_0x8c35('0x38')]=qs[_0x8c35('0x39')](_0x43ddd6['query']['sort']);_0x1d980d[_0x8c35('0x3a')]=qs[_0x8c35('0x3b')](_[_0x8c35('0x3c')](_0x43ddd6[_0x8c35('0x30')],_0x487fd9['filters']),_0x2a4ecc);if(_0x43ddd6[_0x8c35('0x30')][_0x8c35('0x3d')]){_0x1d980d[_0x8c35('0x3a')]=_[_0x8c35('0x3e')](_0x1d980d[_0x8c35('0x3a')],{'$or':_[_0x8c35('0x2a')](_0x2a4ecc,function(_0x416f81){if(_0x416f81['type']!==_0x8c35('0x3f')){var _0x12a78e={};_0x12a78e[_0x416f81[_0x8c35('0x27')]]={'$like':'%'+_0x43ddd6['query']['filter']+'%'};return _0x12a78e;}})});}_0x1d980d=_[_0x8c35('0x3e')]({},_0x1d980d,_0x43ddd6[_0x8c35('0x40')]);var _0x1fcce5={'where':_0x1d980d['where']};return db['MailMessage'][_0x8c35('0x22')](_0x1fcce5)[_0x8c35('0x13')](function(_0x2ca24a){_0x5460a9[_0x8c35('0x22')]=_0x2ca24a;if(_0x43ddd6[_0x8c35('0x30')][_0x8c35('0x41')]){_0x1d980d['include']=[{'all':!![]}];}return db[_0x8c35('0x2b')][_0x8c35('0x42')](_0x1d980d);})['then'](function(_0x4be0ac){_0x5460a9['rows']=_0x4be0ac;return _0x5460a9;})[_0x8c35('0x13')](respondWithFilteredResult(_0x594a12,_0x1d980d))[_0x8c35('0x1d')](handleError(_0x594a12,null));};exports[_0x8c35('0x43')]=function(_0x26f89f,_0x5d2417){var _0x30be58={'raw':!![],'where':{'id':_0x26f89f[_0x8c35('0x44')]['id']}},_0x54ab77={};_0x54ab77[_0x8c35('0x2f')]=_[_0x8c35('0x31')](db['MailMessage'][_0x8c35('0x45')]);_0x54ab77[_0x8c35('0x30')]=_[_0x8c35('0x31')](_0x26f89f[_0x8c35('0x30')]);_0x54ab77[_0x8c35('0x3b')]=_[_0x8c35('0x32')](_0x54ab77[_0x8c35('0x2f')],_0x54ab77[_0x8c35('0x30')]);_0x30be58['attributes']=_[_0x8c35('0x32')](_0x54ab77[_0x8c35('0x2f')],qs[_0x8c35('0x33')](_0x26f89f[_0x8c35('0x30')][_0x8c35('0x33')]));_0x30be58[_0x8c35('0x34')]=_0x30be58[_0x8c35('0x34')]['length']?_0x30be58['attributes']:_0x54ab77[_0x8c35('0x2f')];if(_0x26f89f['query'][_0x8c35('0x41')]){_0x30be58[_0x8c35('0x46')]=[{'all':!![]}];}_0x30be58=_[_0x8c35('0x3e')]({},_0x30be58,_0x26f89f[_0x8c35('0x40')]);return db[_0x8c35('0x2b')][_0x8c35('0x47')](_0x30be58)[_0x8c35('0x13')](handleEntityNotFound(_0x5d2417,null))[_0x8c35('0x13')](respondWithResult(_0x5d2417,null))[_0x8c35('0x1d')](handleError(_0x5d2417,null));};exports[_0x8c35('0x48')]=function(_0x2cddfb,_0x5340a8){if(_0x2cddfb[_0x8c35('0x49')]['id']){delete _0x2cddfb[_0x8c35('0x49')]['id'];}return db[_0x8c35('0x2b')][_0x8c35('0x47')]({'where':{'id':_0x2cddfb[_0x8c35('0x44')]['id']}})['then'](handleEntityNotFound(_0x5340a8,null))[_0x8c35('0x13')](saveUpdates(_0x2cddfb[_0x8c35('0x49')],null))['then'](respondWithResult(_0x5340a8,null))['catch'](handleError(_0x5340a8,null));};exports[_0x8c35('0x24')]=function(_0x36efbc,_0x78c22){return db['MailMessage'][_0x8c35('0x47')]({'where':{'id':_0x36efbc[_0x8c35('0x44')]['id']}})[_0x8c35('0x13')](handleEntityNotFound(_0x78c22,null))[_0x8c35('0x13')](removeEntity(_0x78c22,null))['catch'](handleError(_0x78c22,null));};exports[_0x8c35('0x4a')]=function(_0x4fd1e1,_0x438da8){return db['MailMessage']['describe']()['then'](respondWithResult(_0x438da8,null))['catch'](handleError(_0x438da8,null));};exports[_0x8c35('0x4b')]=function(_0x172940,_0x3074fb){return db[_0x8c35('0x2b')][_0x8c35('0x4b')](_0x172940[_0x8c35('0x49')])[_0x8c35('0x13')](function(_0x39859c){if(_0x39859c){if(_0x39859c[_0x8c35('0x4c')]===_0x8c35('0x4d')&&!_0x39859c['secret']){var _0x2dda66,_0x38affe,_0x35b3f2;if(_0x172940[_0x8c35('0x49')]['to']){_0x38affe=_0x172940[_0x8c35('0x49')]['to'][_0x8c35('0x4e')](',')[0x0];}return db[_0x8c35('0x4f')][_0x8c35('0x50')]({'where':{'id':_0x39859c[_0x8c35('0x51')]},'include':[{'model':db['CmList'],'as':_0x8c35('0x52'),'include':[{'model':db['CmContact'],'as':_0x8c35('0x53'),'where':{'email':_0x38affe},'limit':0x1,'order':[['updatedAt',_0x8c35('0x54')]]}]},{'model':db['MailServerOut'],'as':_0x8c35('0x55'),'raw':!![],'include':[{'model':db[_0x8c35('0x56')],'as':_0x8c35('0x56'),'raw':!![]}]}]})[_0x8c35('0x13')](function(_0x1a0e6b){_0x2dda66=_0x1a0e6b;if(!_0x2dda66||!_0x2dda66[_0x8c35('0x55')])return;var _0x2fbd50=_0x2dda66[_0x8c35('0x57')]();if(_0x172940['body'][_0x8c35('0x58')]&&_0x172940[_0x8c35('0x49')][_0x8c35('0x58')]['length']){for(var _0x38cccc=0x0;_0x38cccc<_0x172940['body']['attachments']['length'];_0x38cccc+=0x1){_0x172940['body'][_0x8c35('0x58')][_0x38cccc]={'filename':_0x172940['body'][_0x8c35('0x58')][_0x38cccc][_0x8c35('0x27')],'path':path['join'](config[_0x8c35('0x59')],_0x8c35('0x5a'),_0x172940[_0x8c35('0x49')]['attachments'][_0x38cccc][_0x8c35('0x5b')])};}}_0x35b3f2={'account':_0x2fbd50,'message':_0x172940[_0x8c35('0x49')]};return;})['then'](function(){if(_0x2dda66[_0x8c35('0x52')]){if(_0x2dda66[_0x8c35('0x52')][_0x8c35('0x53')][_0x8c35('0x35')]){return _0x2dda66[_0x8c35('0x52')][_0x8c35('0x53')][0x0];}else{return db[_0x8c35('0x5c')][_0x8c35('0x4b')](_['defaults'](_0x172940[_0x8c35('0x49')],{'firstName':_0x172940['body']['to'],'email':_0x172940['body']['to'],'phone':_0x172940[_0x8c35('0x49')]['to'],'ListId':_0x2dda66[_0x8c35('0x5d')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x8c35('0x13')](function(){if(_0x35b3f2){return respondWithRpcPromise('SendMail',_0x8c35('0x5e'),_0x35b3f2,client9003)[_0x8c35('0x13')](function(_0x632bca){return _0x39859c['update']({'read':!![],'messageId':_0x632bca['messageId'],'sentAt':moment()['format'](_0x8c35('0x5f'))});})[_0x8c35('0x1d')](function(_0x1588bb){logger[_0x8c35('0x19')]('%s',JSON[_0x8c35('0x18')](_0x1588bb));return _0x39859c;});}return _0x39859c;});}return _0x39859c;}})[_0x8c35('0x13')](respondWithResult(_0x3074fb,0xc9))[_0x8c35('0x1d')](handleError(_0x3074fb,null));};exports[_0x8c35('0x60')]=function(_0x30b63a,_0xaf9291){var _0xced551=_0x8c35('0x61');return interactionService[_0x8c35('0x62')](_0x30b63a,_0xced551)[_0x8c35('0x13')](respondWithResult(_0xaf9291,null))[_0x8c35('0x1d')](handleError(_0xaf9291,null));};exports[_0x8c35('0x63')]=function(_0x2fedf7,_0x19f57c){var _0x161e13={'agent':{},'channel':_0x8c35('0x61')};if(_0x2fedf7[_0x8c35('0x49')]['id']){delete _0x2fedf7['body']['id'];}_0x2fedf7[_0x8c35('0x49')][_0x8c35('0x64')]=_0x2fedf7['body'][_0x8c35('0x64')]||_0x2fedf7['user']['id'];_0x161e13[_0x8c35('0x65')]['id']=_0x2fedf7[_0x8c35('0x49')]['UserId'];return db[_0x8c35('0x2b')][_0x8c35('0x47')]({'where':{'id':_0x2fedf7['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x19f57c,null))[_0x8c35('0x13')](function(_0x5b4a24){if(_0x5b4a24){_0x161e13['message']=_0x5b4a24[_0x8c35('0x66')]({'plain':!![]});return db['MailInteraction'][_0x8c35('0x47')]({'where':{'id':_0x5b4a24[_0x8c35('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x19f57c,null))[_0x8c35('0x13')](function(_0x5d9f2b){if(_0x5d9f2b){_0x161e13[_0x8c35('0x68')]=_0x5d9f2b[_0x8c35('0x66')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2fedf7['user']['id'],_0x2fedf7[_0x8c35('0x69')][_0x8c35('0x27')],_0x2fedf7[_0x8c35('0x69')]['role'],_0x161e13[_0x8c35('0x68')]['id'],_0x2fedf7[_0x8c35('0x49')]?JSON[_0x8c35('0x18')](_0x2fedf7[_0x8c35('0x49')]):_0x8c35('0x6a'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x161e13);}return null;})[_0x8c35('0x13')](function(_0x583627){var _0x384cfc=_0x8c35('0x6b')+_0x583627[_0x8c35('0x1b')][_0x8c35('0x6c')];return db[_0x8c35('0x6d')][_0x8c35('0x30')](_0x384cfc,{'type':db[_0x8c35('0x6e')]['QueryTypes'][_0x8c35('0x6f')],'raw':!![]})[_0x8c35('0x13')](function(_0x2b78b0){return _0x2b78b0;});})[_0x8c35('0x13')](function(_0x2123f4){if(_0x2123f4){_0x161e13['message'][_0x8c35('0x70')]=_0x2123f4[0x0];if(!_0x2fedf7[_0x8c35('0x49')][_0x8c35('0x64')])return;return db[_0x8c35('0x71')][_0x8c35('0x47')]({'where':{'id':_0x2fedf7[_0x8c35('0x49')][_0x8c35('0x64')],'role':_0x8c35('0x65')},'attributes':['id',_0x8c35('0x27'),_0x8c35('0x72'),_0x8c35('0x73'),_0x8c35('0x74')],'raw':!![]});}return null;})['then'](function(_0x225888){if(!_0x225888)return null;_0x161e13[_0x8c35('0x1b')][_0x8c35('0x65')]=_0x225888;return _0x161e13;})[_0x8c35('0x13')](function(_0x559867){if(_0x559867){_0x559867[_0x8c35('0x1b')][_0x8c35('0x75')]=util[_0x8c35('0x76')]('SIP/%s',_0x2fedf7[_0x8c35('0x69')][_0x8c35('0x27')]);_0x559867[_0x8c35('0x1b')][_0x8c35('0x77')]=_0x161e13[_0x8c35('0x77')];_0x559867[_0x8c35('0x1b')]['motionChannel']=_0x161e13[_0x8c35('0x77')];_0x559867['message'][_0x8c35('0x78')]=_0x8c35('0x63');_0x559867[_0x8c35('0x1b')][_0x8c35('0x49')]=htmlToText['fromString'](_0x161e13[_0x8c35('0x1b')][_0x8c35('0x49')]);respondWithRpcPromise(_0x8c35('0x79'),_0x8c35('0x79'),{'event':_0x8c35('0x7a'),'message':_0x559867[_0x8c35('0x1b')]},client9002);return _0x161e13;}return null;})['then'](respondWithResult(_0x19f57c,null))[_0x8c35('0x1d')](handleError(_0x19f57c,null));};exports[_0x8c35('0x7b')]=function(_0x40511a,_0x5c748b){var _0x1d4c14=moment()[_0x8c35('0x7c')]()[_0x8c35('0x7d')]();var _0x393175=path['join'](config['root'],_0x8c35('0x7e'),_0x8c35('0x7f'),'tmp');var _0xe5a095=path[_0x8c35('0x80')](config[_0x8c35('0x59')],_0x8c35('0x7e'),'files',_0x8c35('0x58'));var _0x1772a2=util['format'](_0x8c35('0x81'),_0x1d4c14);return db['MailMessage']['find']({'where':{'id':_0x40511a[_0x8c35('0x44')]['id']},'attributes':['id',_0x8c35('0x49'),_0x8c35('0x82'),'to','cc',_0x8c35('0x83'),_0x8c35('0x84'),_0x8c35('0x85')],'include':_0x40511a[_0x8c35('0x30')][_0x8c35('0x58')]?[{'model':db[_0x8c35('0x86')],'as':_0x8c35('0x87')}]:undefined})[_0x8c35('0x13')](handleEntityNotFound(_0x5c748b,null))[_0x8c35('0x13')](function(_0x3d28fc){if(_0x3d28fc){var _0x29c4d9=_0x3d28fc;var _0x39e3cb={'from':_0x29c4d9['from'],'to':_0x29c4d9['to'],'subject':_0x29c4d9[_0x8c35('0x84')],'html':htmlEntities[_0x8c35('0x88')](_0x29c4d9[_0x8c35('0x49')]),'headers':{'Date':moment(_0x29c4d9[_0x8c35('0x85')])['format'](_0x8c35('0x89'))},'attachments':[]};if(_0x3d28fc['cc']){_0x39e3cb['headers']['Cc']=_0x3d28fc['cc'];}if(_0x3d28fc['bcc']){_0x39e3cb[_0x8c35('0x8a')][_0x8c35('0x8b')]=_0x3d28fc[_0x8c35('0x83')];}return new Promise(function(_0x6a6455,_0x553b7){if(_0x3d28fc[_0x8c35('0x87')]){for(var _0x2a7973=0x0;_0x2a7973<_0x3d28fc[_0x8c35('0x87')]['length'];_0x2a7973++){var _0x3c12f2=_0x3d28fc[_0x8c35('0x87')][_0x2a7973];var _0x490a3=path['join'](_0xe5a095,_0x3c12f2[_0x8c35('0x5b')]);if(fs['existsSync'](_0x490a3)){_0x39e3cb[_0x8c35('0x58')]['push']({'name':_0x3c12f2[_0x8c35('0x27')],'contentType':_0x3c12f2[_0x8c35('0x2d')],'data':fs['readFileSync'](_0x490a3)});}}}emlformat[_0x8c35('0x8c')](_0x39e3cb,function(_0x5ac853,_0xf23a7){if(_0x5ac853)return _0x553b7(_0x5ac853);fs[_0x8c35('0x8d')](path[_0x8c35('0x80')](_0x393175,_0x1772a2),_0xf23a7);return _0x6a6455(_0xf23a7);});});}})[_0x8c35('0x13')](function(_0x36a3bf){if(_0x36a3bf){return _0x5c748b[_0x8c35('0x7b')](path[_0x8c35('0x80')](_0x393175,_0x1772a2),_0x1772a2,function(_0x317e60){if(!_0x317e60)fs['unlinkSync'](path['join'](_0x393175,_0x1772a2));});}})[_0x8c35('0x1d')](handleError(_0x5c748b,null));}; \ No newline at end of file +var _0x5862=['User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','reject','fromString','EventManager','rejectmessage','download','unix','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','push','readFileSync','build','unlinkSync','eml-format','util','lodash','ioredis','html-to-text','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','localhost','redis','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','MailMessage','includeAll','include','findAll','rows','catch','show','params','find','body','describe','create','direction','secret','split','findOne','MailAccountId','List','CmContact','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','Contacts','length','ListId','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','UserId','user','agent','get','MailInteraction','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact'];(function(_0x4fbd0c,_0x54eda6){var _0x4371e4=function(_0x3999c8){while(--_0x3999c8){_0x4fbd0c['push'](_0x4fbd0c['shift']());}};_0x4371e4(++_0x54eda6);}(_0x5862,0x1de));var _0x2586=function(_0x31ec29,_0x58915c){_0x31ec29=_0x31ec29-0x0;var _0x3275fc=_0x5862[_0x31ec29];return _0x3275fc;};'use strict';var emlformat=require(_0x2586('0x0'));var moment=require('moment');var util=require(_0x2586('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x2586('0x2'));var Redis=require(_0x2586('0x3'));var htmlToText=require(_0x2586('0x4'));var interactionService=require(_0x2586('0x5'));var qs=require(_0x2586('0x6'));var logger=require(_0x2586('0x7'))(_0x2586('0x8'));var interaction_log=require(_0x2586('0x7'))(_0x2586('0x9'));var config=require(_0x2586('0xa'));var db=require(_0x2586('0xb'))['db'];config['redis']=_[_0x2586('0xc')](config['redis'],{'host':_0x2586('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2586('0xe')]));var htmlEntities=require('html-entities');require(_0x2586('0xf'))[_0x2586('0x10')](socket);var jayson=require(_0x2586('0x11'));var client=jayson[_0x2586('0x12')][_0x2586('0x13')]({'port':0x232c});var client9003=jayson[_0x2586('0x12')][_0x2586('0x13')]({'port':0x232b});var client9002=jayson[_0x2586('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0xac1174,_0x2968e4,_0x200ce9,_0x758edb){return new Promise(function(_0x41951b,_0x331821){var _0xfbc3d6=_0x758edb||client;return _0xfbc3d6[_0x2586('0x14')](_0xac1174,_0x200ce9)[_0x2586('0x15')](function(_0x634771){logger[_0x2586('0x16')](_0x2586('0x17'),_0x2968e4,_0x2586('0x18'));logger[_0x2586('0x19')](_0x2586('0x1a'),_0x2968e4,_0x2586('0x18'),JSON['stringify'](_0x634771));if(_0x634771[_0x2586('0x1b')]){if(_0x634771[_0x2586('0x1b')]['code']===0x1f4){logger[_0x2586('0x1b')](_0x2586('0x17'),_0x2968e4,_0x634771[_0x2586('0x1b')][_0x2586('0x1c')]);return _0x331821(_0x634771[_0x2586('0x1b')][_0x2586('0x1c')]);}logger[_0x2586('0x1b')](_0x2586('0x17'),_0x2968e4,_0x634771[_0x2586('0x1b')]['message']);return _0x41951b(_0x634771['error'][_0x2586('0x1c')]);}else{logger[_0x2586('0x16')]('MailMessage,\x20%s,\x20%s',_0x2968e4,_0x2586('0x18'));_0x41951b(_0x634771[_0x2586('0x1d')][_0x2586('0x1c')]);}})['catch'](function(_0xc9c052){logger[_0x2586('0x1b')](_0x2586('0x17'),_0x2968e4,_0xc9c052);_0x331821(_0xc9c052);});});}function respondWithResult(_0x32ee75,_0x6991b){_0x6991b=_0x6991b||0xc8;return function(_0x4a1d25){if(_0x4a1d25){return _0x32ee75[_0x2586('0x1e')](_0x6991b)[_0x2586('0x1f')](_0x4a1d25);}};}function respondWithFilteredResult(_0x16f948,_0x40e372){return function(_0x10fa74){if(_0x10fa74){var _0x4f1ba6=typeof _0x40e372[_0x2586('0x20')]===_0x2586('0x21')&&typeof _0x40e372[_0x2586('0x22')]===_0x2586('0x21');var _0x28835c=_0x10fa74[_0x2586('0x23')];var _0x338b9e=_0x4f1ba6?0x0:_0x40e372[_0x2586('0x20')];var _0x47fa80=_0x4f1ba6?_0x10fa74['count']:_0x40e372[_0x2586('0x20')]+_0x40e372[_0x2586('0x22')];var _0x342ab3;if(_0x47fa80>=_0x28835c){_0x47fa80=_0x28835c;_0x342ab3=0xc8;}else{_0x342ab3=0xce;}_0x16f948['status'](_0x342ab3);return _0x16f948[_0x2586('0x24')](_0x2586('0x25'),_0x338b9e+'-'+_0x47fa80+'/'+_0x28835c)[_0x2586('0x1f')](_0x10fa74);}return null;};}function saveUpdates(_0x31f710){return function(_0x353fe3){if(_0x353fe3){return _0x353fe3['update'](_0x31f710)['then'](function(_0x2e0b50){return _0x2e0b50;});}return null;};}function removeEntity(_0x1fe5d4){return function(_0x278576){if(_0x278576){return _0x278576[_0x2586('0x26')]()[_0x2586('0x15')](function(){_0x1fe5d4[_0x2586('0x1e')](0xcc)[_0x2586('0x27')]();});}};}function handleEntityNotFound(_0x47d401){return function(_0x6c398b){if(!_0x6c398b){_0x47d401['sendStatus'](0x194);}return _0x6c398b;};}function handleError(_0x459649,_0x19c31e){_0x19c31e=_0x19c31e||0x1f4;return function(_0x1cdfc7){logger['error'](_0x1cdfc7[_0x2586('0x28')]);if(_0x1cdfc7[_0x2586('0x29')]){delete _0x1cdfc7[_0x2586('0x29')];}_0x459649[_0x2586('0x1e')](_0x19c31e)[_0x2586('0x2a')](_0x1cdfc7);};}exports[_0x2586('0x2b')]=function(_0x18e16c,_0x42a708){var _0x5a079a={},_0x3dfedc={},_0x12389c={'count':0x0,'rows':[]};var _0x393ff2=_[_0x2586('0x2c')](db['MailMessage'][_0x2586('0x2d')],function(_0x533794){return{'name':_0x533794[_0x2586('0x2e')],'type':_0x533794[_0x2586('0x2f')][_0x2586('0x30')]};});_0x3dfedc[_0x2586('0x31')]=_[_0x2586('0x2c')](_0x393ff2,_0x2586('0x29'));_0x3dfedc[_0x2586('0x32')]=_[_0x2586('0x33')](_0x18e16c['query']);_0x3dfedc[_0x2586('0x34')]=_[_0x2586('0x35')](_0x3dfedc['model'],_0x3dfedc['query']);_0x5a079a['attributes']=_[_0x2586('0x35')](_0x3dfedc[_0x2586('0x31')],qs[_0x2586('0x36')](_0x18e16c[_0x2586('0x32')][_0x2586('0x36')]));_0x5a079a['attributes']=_0x5a079a[_0x2586('0x37')]['length']?_0x5a079a[_0x2586('0x37')]:_0x3dfedc[_0x2586('0x31')];if(!_0x18e16c[_0x2586('0x32')][_0x2586('0x38')]('nolimit')){_0x5a079a[_0x2586('0x22')]=qs[_0x2586('0x22')](_0x18e16c['query']['limit']);_0x5a079a[_0x2586('0x20')]=qs[_0x2586('0x20')](_0x18e16c[_0x2586('0x32')][_0x2586('0x20')]);}_0x5a079a[_0x2586('0x39')]=qs['sort'](_0x18e16c['query'][_0x2586('0x3a')]);_0x5a079a[_0x2586('0x3b')]=qs[_0x2586('0x34')](_[_0x2586('0x3c')](_0x18e16c['query'],_0x3dfedc[_0x2586('0x34')]),_0x393ff2);if(_0x18e16c[_0x2586('0x32')][_0x2586('0x3d')]){_0x5a079a[_0x2586('0x3b')]=_['merge'](_0x5a079a[_0x2586('0x3b')],{'$or':_[_0x2586('0x2c')](_0x393ff2,function(_0x3c0845){if(_0x3c0845[_0x2586('0x2f')]!==_0x2586('0x3e')){var _0x232c15={};_0x232c15[_0x3c0845[_0x2586('0x29')]]={'$like':'%'+_0x18e16c[_0x2586('0x32')]['filter']+'%'};return _0x232c15;}})});}_0x5a079a=_[_0x2586('0x3f')]({},_0x5a079a,_0x18e16c[_0x2586('0x40')]);var _0x559d29={'where':_0x5a079a[_0x2586('0x3b')]};return db[_0x2586('0x41')][_0x2586('0x23')](_0x559d29)[_0x2586('0x15')](function(_0x8b299d){_0x12389c[_0x2586('0x23')]=_0x8b299d;if(_0x18e16c[_0x2586('0x32')][_0x2586('0x42')]){_0x5a079a[_0x2586('0x43')]=[{'all':!![]}];}return db['MailMessage'][_0x2586('0x44')](_0x5a079a);})[_0x2586('0x15')](function(_0x53488e){_0x12389c[_0x2586('0x45')]=_0x53488e;return _0x12389c;})['then'](respondWithFilteredResult(_0x42a708,_0x5a079a))[_0x2586('0x46')](handleError(_0x42a708,null));};exports[_0x2586('0x47')]=function(_0x545d92,_0x436b88){var _0x2d1d6d={'raw':!![],'where':{'id':_0x545d92[_0x2586('0x48')]['id']}},_0x35bf77={};_0x35bf77[_0x2586('0x31')]=_['keys'](db[_0x2586('0x41')][_0x2586('0x2d')]);_0x35bf77[_0x2586('0x32')]=_[_0x2586('0x33')](_0x545d92[_0x2586('0x32')]);_0x35bf77[_0x2586('0x34')]=_[_0x2586('0x35')](_0x35bf77[_0x2586('0x31')],_0x35bf77['query']);_0x2d1d6d[_0x2586('0x37')]=_[_0x2586('0x35')](_0x35bf77[_0x2586('0x31')],qs[_0x2586('0x36')](_0x545d92[_0x2586('0x32')][_0x2586('0x36')]));_0x2d1d6d[_0x2586('0x37')]=_0x2d1d6d[_0x2586('0x37')]['length']?_0x2d1d6d[_0x2586('0x37')]:_0x35bf77[_0x2586('0x31')];if(_0x545d92['query'][_0x2586('0x42')]){_0x2d1d6d[_0x2586('0x43')]=[{'all':!![]}];}_0x2d1d6d=_[_0x2586('0x3f')]({},_0x2d1d6d,_0x545d92[_0x2586('0x40')]);return db[_0x2586('0x41')][_0x2586('0x49')](_0x2d1d6d)[_0x2586('0x15')](handleEntityNotFound(_0x436b88,null))[_0x2586('0x15')](respondWithResult(_0x436b88,null))[_0x2586('0x46')](handleError(_0x436b88,null));};exports['update']=function(_0x525f64,_0x571456){if(_0x525f64['body']['id']){delete _0x525f64[_0x2586('0x4a')]['id'];}return db[_0x2586('0x41')][_0x2586('0x49')]({'where':{'id':_0x525f64['params']['id']}})['then'](handleEntityNotFound(_0x571456,null))[_0x2586('0x15')](saveUpdates(_0x525f64[_0x2586('0x4a')],null))[_0x2586('0x15')](respondWithResult(_0x571456,null))[_0x2586('0x46')](handleError(_0x571456,null));};exports[_0x2586('0x26')]=function(_0x14f611,_0xdb377f){return db[_0x2586('0x41')][_0x2586('0x49')]({'where':{'id':_0x14f611[_0x2586('0x48')]['id']}})[_0x2586('0x15')](handleEntityNotFound(_0xdb377f,null))[_0x2586('0x15')](removeEntity(_0xdb377f,null))[_0x2586('0x46')](handleError(_0xdb377f,null));};exports[_0x2586('0x4b')]=function(_0x4a1108,_0x1ba30c){return db[_0x2586('0x41')][_0x2586('0x4b')]()['then'](respondWithResult(_0x1ba30c,null))[_0x2586('0x46')](handleError(_0x1ba30c,null));};exports[_0x2586('0x4c')]=function(_0x75e52,_0x3268de){return db[_0x2586('0x41')][_0x2586('0x4c')](_0x75e52[_0x2586('0x4a')])[_0x2586('0x15')](function(_0x115e21){if(_0x115e21){if(_0x115e21[_0x2586('0x4d')]==='out'&&!_0x115e21[_0x2586('0x4e')]){var _0x3f76f5,_0x5611c1,_0xcf1742;if(_0x75e52[_0x2586('0x4a')]['to']){_0x5611c1=_0x75e52[_0x2586('0x4a')]['to'][_0x2586('0x4f')](',')[0x0];}return db['MailAccount'][_0x2586('0x50')]({'where':{'id':_0x115e21[_0x2586('0x51')]},'include':[{'model':db['CmList'],'as':_0x2586('0x52'),'include':[{'model':db[_0x2586('0x53')],'as':'Contacts','where':{'email':_0x5611c1},'limit':0x1,'order':[[_0x2586('0x54'),'DESC']]}]},{'model':db[_0x2586('0x55')],'as':_0x2586('0x56'),'raw':!![],'include':[{'model':db[_0x2586('0x57')],'as':_0x2586('0x57'),'raw':!![]}]}]})[_0x2586('0x15')](function(_0x265065){_0x3f76f5=_0x265065;if(!_0x3f76f5||!_0x3f76f5['Smtp'])return;var _0x4dd9c6=_0x3f76f5[_0x2586('0x58')]();if(_0x75e52[_0x2586('0x4a')][_0x2586('0x59')]&&_0x75e52[_0x2586('0x4a')]['attachments']['length']){for(var _0x2e4fb3=0x0;_0x2e4fb3<_0x75e52[_0x2586('0x4a')][_0x2586('0x59')]['length'];_0x2e4fb3+=0x1){_0x75e52[_0x2586('0x4a')][_0x2586('0x59')][_0x2e4fb3]={'filename':_0x75e52['body'][_0x2586('0x59')][_0x2e4fb3]['name'],'path':path[_0x2586('0x5a')](config[_0x2586('0x5b')],'server/files/attachments',_0x75e52[_0x2586('0x4a')][_0x2586('0x59')][_0x2e4fb3]['basename'])};}}_0xcf1742={'account':_0x4dd9c6,'message':_0x75e52[_0x2586('0x4a')]};return;})[_0x2586('0x15')](function(){if(_0x3f76f5['List']){if(_0x3f76f5[_0x2586('0x52')][_0x2586('0x5c')][_0x2586('0x5d')]){return _0x3f76f5[_0x2586('0x52')][_0x2586('0x5c')][0x0];}else{return db[_0x2586('0x53')][_0x2586('0x4c')](_[_0x2586('0xc')](_0x75e52[_0x2586('0x4a')],{'firstName':_0x75e52[_0x2586('0x4a')]['to'],'email':_0x75e52[_0x2586('0x4a')]['to'],'phone':_0x75e52[_0x2586('0x4a')]['to'],'ListId':_0x3f76f5[_0x2586('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x2586('0x15')](function(){if(_0xcf1742){return respondWithRpcPromise(_0x2586('0x5f'),_0x2586('0x60'),_0xcf1742,client9003)[_0x2586('0x15')](function(_0x235f66){return _0x115e21['update']({'read':!![],'messageId':_0x235f66['messageId'],'sentAt':moment()[_0x2586('0x61')](_0x2586('0x62'))});})[_0x2586('0x46')](function(_0x7c1544){logger[_0x2586('0x1b')]('%s',JSON[_0x2586('0x63')](_0x7c1544));return _0x115e21;});}return _0x115e21;});}return _0x115e21;}})[_0x2586('0x15')](respondWithResult(_0x3268de,0xc9))[_0x2586('0x46')](handleError(_0x3268de,null));};exports[_0x2586('0x64')]=function(_0x3e9fba,_0x22bce1){var _0x403456=_0x2586('0x65');return interactionService['acceptMessage'](_0x3e9fba,_0x403456)[_0x2586('0x15')](respondWithResult(_0x22bce1,null))[_0x2586('0x46')](handleError(_0x22bce1,null));};exports['reject']=function(_0x128e9b,_0x28c091){var _0x594337={'agent':{},'channel':_0x2586('0x65')};if(_0x128e9b[_0x2586('0x4a')]['id']){delete _0x128e9b[_0x2586('0x4a')]['id'];}_0x128e9b[_0x2586('0x4a')][_0x2586('0x66')]=_0x128e9b[_0x2586('0x4a')]['UserId']||_0x128e9b[_0x2586('0x67')]['id'];_0x594337[_0x2586('0x68')]['id']=_0x128e9b[_0x2586('0x4a')][_0x2586('0x66')];return db[_0x2586('0x41')][_0x2586('0x49')]({'where':{'id':_0x128e9b[_0x2586('0x48')]['id'],'UserId':null}})[_0x2586('0x15')](handleEntityNotFound(_0x28c091,null))['then'](function(_0x115eaa){if(_0x115eaa){_0x594337['message']=_0x115eaa[_0x2586('0x69')]({'plain':!![]});return db[_0x2586('0x6a')][_0x2586('0x49')]({'where':{'id':_0x115eaa[_0x2586('0x6b')]}});}return null;})[_0x2586('0x15')](handleEntityNotFound(_0x28c091,null))[_0x2586('0x15')](function(_0x250e71){if(_0x250e71){_0x594337['interaction']=_0x250e71['get']({'plain':!![]});interaction_log[_0x2586('0x16')](_0x2586('0x6c'),_0x128e9b[_0x2586('0x67')]['id'],_0x128e9b[_0x2586('0x67')][_0x2586('0x29')],_0x128e9b[_0x2586('0x67')]['role'],_0x594337[_0x2586('0x6d')]['id'],_0x128e9b[_0x2586('0x4a')]?JSON[_0x2586('0x63')](_0x128e9b[_0x2586('0x4a')]):_0x2586('0x6e'));return respondWithRpcPromise(_0x2586('0x6f'),'rejectMessage',_0x594337);}return null;})[_0x2586('0x15')](function(_0x698617){var _0x8c5341=_0x2586('0x70')+_0x698617[_0x2586('0x1c')][_0x2586('0x71')];return db['sequelize'][_0x2586('0x32')](_0x8c5341,{'type':db[_0x2586('0x72')][_0x2586('0x73')][_0x2586('0x74')],'raw':!![]})[_0x2586('0x15')](function(_0x4256a2){return _0x4256a2;});})[_0x2586('0x15')](function(_0x41c32c){if(_0x41c32c){_0x594337['message'][_0x2586('0x75')]=_0x41c32c[0x0];if(!_0x128e9b[_0x2586('0x4a')][_0x2586('0x66')])return;return db[_0x2586('0x76')][_0x2586('0x49')]({'where':{'id':_0x128e9b[_0x2586('0x4a')][_0x2586('0x66')],'role':_0x2586('0x68')},'attributes':['id',_0x2586('0x29'),_0x2586('0x77'),_0x2586('0x78'),_0x2586('0x79')],'raw':!![]});}return null;})[_0x2586('0x15')](function(_0x59f680){if(!_0x59f680)return null;_0x594337[_0x2586('0x1c')]['agent']=_0x59f680;return _0x594337;})[_0x2586('0x15')](function(_0x49980c){if(_0x49980c){_0x49980c[_0x2586('0x1c')][_0x2586('0x7a')]=util[_0x2586('0x61')](_0x2586('0x7b'),_0x128e9b[_0x2586('0x67')]['name']);_0x49980c[_0x2586('0x1c')][_0x2586('0x7c')]=_0x594337[_0x2586('0x7c')];_0x49980c[_0x2586('0x1c')][_0x2586('0x7d')]=_0x594337[_0x2586('0x7c')];_0x49980c[_0x2586('0x1c')][_0x2586('0x7e')]=_0x2586('0x7f');_0x49980c[_0x2586('0x1c')][_0x2586('0x4a')]=htmlToText[_0x2586('0x80')](_0x594337[_0x2586('0x1c')][_0x2586('0x4a')]);respondWithRpcPromise(_0x2586('0x81'),_0x2586('0x81'),{'event':_0x2586('0x82'),'message':_0x49980c['message']},client9002);return _0x594337;}return null;})['then'](respondWithResult(_0x28c091,null))[_0x2586('0x46')](handleError(_0x28c091,null));};exports[_0x2586('0x83')]=function(_0x2999c5,_0x162802){var _0x1e8ca8=moment()[_0x2586('0x84')]()['toString']();var _0x502984=path[_0x2586('0x5a')](config['root'],_0x2586('0x85'),_0x2586('0x86'),_0x2586('0x87'));var _0x51f125=path['join'](config[_0x2586('0x5b')],_0x2586('0x85'),_0x2586('0x86'),_0x2586('0x59'));var _0x430211=util['format'](_0x2586('0x88'),_0x1e8ca8);return db[_0x2586('0x41')][_0x2586('0x49')]({'where':{'id':_0x2999c5['params']['id']},'attributes':['id','body',_0x2586('0x89'),'to','cc',_0x2586('0x8a'),'subject',_0x2586('0x8b')],'include':_0x2999c5['query'][_0x2586('0x59')]?[{'model':db[_0x2586('0x8c')],'as':_0x2586('0x8d')}]:undefined})['then'](handleEntityNotFound(_0x162802,null))[_0x2586('0x15')](function(_0x59b95f){if(_0x59b95f){var _0x3b95c2=_0x59b95f;var _0x49d298={'from':_0x3b95c2[_0x2586('0x89')],'to':_0x3b95c2['to'],'subject':_0x3b95c2['subject'],'html':htmlEntities['decode'](_0x3b95c2['body']),'headers':{'Date':moment(_0x3b95c2['createdAt'])[_0x2586('0x61')](_0x2586('0x8e'))},'attachments':[]};if(_0x59b95f['cc']){_0x49d298['headers']['Cc']=_0x59b95f['cc'];}if(_0x59b95f['bcc']){_0x49d298[_0x2586('0x8f')]['Bcc']=_0x59b95f[_0x2586('0x8a')];}return new Promise(function(_0x32025d,_0x40f80e){if(_0x59b95f[_0x2586('0x8d')]){for(var _0x28ffcd=0x0;_0x28ffcd<_0x59b95f[_0x2586('0x8d')][_0x2586('0x5d')];_0x28ffcd++){var _0x2a1531=_0x59b95f['Attachments'][_0x28ffcd];var _0xaf09b7=path[_0x2586('0x5a')](_0x51f125,_0x2a1531[_0x2586('0x90')]);if(fs['existsSync'](_0xaf09b7)){_0x49d298[_0x2586('0x59')][_0x2586('0x91')]({'name':_0x2a1531[_0x2586('0x29')],'contentType':_0x2a1531['type'],'data':fs[_0x2586('0x92')](_0xaf09b7)});}}}emlformat[_0x2586('0x93')](_0x49d298,function(_0x575351,_0x38e5c6){if(_0x575351)return _0x40f80e(_0x575351);fs['writeFileSync'](path[_0x2586('0x5a')](_0x502984,_0x430211),_0x38e5c6);return _0x32025d(_0x38e5c6);});});}})[_0x2586('0x15')](function(_0x5466b5){if(_0x5466b5){return _0x162802[_0x2586('0x83')](path[_0x2586('0x5a')](_0x502984,_0x430211),_0x430211,function(_0x3c599e){if(!_0x3c599e)fs[_0x2586('0x94')](path['join'](_0x502984,_0x430211));});}})[_0x2586('0x46')](handleError(_0x162802,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index cd8f58d..8d6a043 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 _0x3282=['exports','events','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x311bc1,_0x1c18ef){var _0x1f496b=function(_0x5d8846){while(--_0x5d8846){_0x311bc1['push'](_0x311bc1['shift']());}};_0x1f496b(++_0x1c18ef);}(_0x3282,0xeb));var _0x2328=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x3282[_0x2aee2f];return _0x19337f;};'use strict';var EventEmitter=require(_0x2328('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x2328('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x2328('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2328('0x3'),'afterDestroy':_0x2328('0x4')};function emitEvent(_0x8256b2){return function(_0x4e9b26,_0x48b1c0,_0x155444){MailMessageEvents[_0x2328('0x5')](_0x8256b2+':'+_0x4e9b26['id'],_0x4e9b26);MailMessageEvents[_0x2328('0x5')](_0x8256b2,_0x4e9b26);_0x155444(null);};}for(var e in events){if(events[_0x2328('0x6')](e)){var event=events[e];MailMessage[_0x2328('0x7')](e,emitEvent(event));}}module[_0x2328('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x4e3f=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4e3f,0x16c));var _0xf4e3=function(_0x4d264f,_0x5cdcee){_0x4d264f=_0x4d264f-0x0;var _0x9d522a=_0x4e3f[_0x4d264f];return _0x9d522a;};'use strict';var EventEmitter=require(_0xf4e3('0x0'));var MailMessage=require(_0xf4e3('0x1'))['db'][_0xf4e3('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf4e3('0x3')](0x0);var events={'afterCreate':_0xf4e3('0x4'),'afterUpdate':_0xf4e3('0x5'),'afterDestroy':_0xf4e3('0x6')};function emitEvent(_0x59bbf2){return function(_0x4c19bf,_0x40ce84,_0x1d7104){MailMessageEvents['emit'](_0x59bbf2+':'+_0x4c19bf['id'],_0x4c19bf);MailMessageEvents[_0xf4e3('0x7')](_0x59bbf2,_0x4c19bf);_0x1d7104(null);};}for(var e in events){if(events[_0xf4e3('0x8')](e)){var event=events[e];MailMessage[_0xf4e3('0x9')](e,emitEvent(event));}}module[_0xf4e3('0xa')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index a652278..7a4cc8d 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 _0xc4ae=['direction','catch','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','html-to-text','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','subject','body','plainBody','models','get','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','createdAt'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0xc4ae,0x73));var _0xec4a=function(_0x57247a,_0x3e977a){_0x57247a=_0x57247a-0x0;var _0x30b968=_0xc4ae[_0x57247a];return _0x30b968;};'use strict';var _=require('lodash');var util=require(_0xec4a('0x0'));var logger=require(_0xec4a('0x1'))('api');var moment=require(_0xec4a('0x2'));var BPromise=require(_0xec4a('0x3'));var rp=require(_0xec4a('0x4'));var htmlToText=require(_0xec4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xec4a('0x6'));var attributes=require(_0xec4a('0x7'));module['exports']=function(_0x3a5c91,_0x501b87){return _0x3a5c91[_0xec4a('0x8')](_0xec4a('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xec4a('0xa'),'fields':[_0xec4a('0xa')]},{'name':'fti_mail_messages','fields':['plainBody',_0xec4a('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xc61ee9,_0x339ef1,_0x3d6673){if(_0xc61ee9[_0xec4a('0xc')]){_0xc61ee9[_0xec4a('0xd')]=htmlToText['fromString'](_0xc61ee9['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3d6673(null,_0x339ef1);},'afterCreate':function(_0x370c85,_0x1ac975,_0x46b879){var _0x3db70e=_0x3a5c91[_0xec4a('0xe')];var _0x4fe7da=_0x370c85[_0xec4a('0xf')]({'plain':!![]});if(_0x4fe7da['direction'][_0xec4a('0x10')]()==='in'||_0x4fe7da['direction'][_0xec4a('0x10')]()===_0xec4a('0x11')&&!_0x4fe7da[_0xec4a('0x12')]&&!_[_0xec4a('0x13')](_0x4fe7da['UserId'])){_0x3db70e[_0xec4a('0x14')][_0xec4a('0x15')]({'where':{'id':_0x4fe7da[_0xec4a('0x16')]}})[_0xec4a('0x17')](function(_0x1a530e){if(_0x1a530e){_0x1a530e['update']({'lastMsgAt':_0x4fe7da[_0xec4a('0x18')],'lastMsgDirection':_0x4fe7da[_0xec4a('0x19')]['toLowerCase']()});}})[_0xec4a('0x1a')](function(_0x5d1838){console['error'](_0x5d1838);});}_0x46b879();}},'charset':_0xec4a('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa0ea=['plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa0ea,0xe7));var _0xaa0e=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xa0ea[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0xaa0e('0x0'));var util=require(_0xaa0e('0x1'));var logger=require(_0xaa0e('0x2'))(_0xaa0e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa0e('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xaa0e('0x5'));var rimraf=require(_0xaa0e('0x6'));var config=require(_0xaa0e('0x7'));var attributes=require(_0xaa0e('0x8'));module[_0xaa0e('0x9')]=function(_0x6f9358,_0x46bdae){return _0x6f9358[_0xaa0e('0xa')]('MailMessage',attributes,{'tableName':_0xaa0e('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xaa0e('0xc')]},{'name':_0xaa0e('0xd'),'fields':[_0xaa0e('0xe'),_0xaa0e('0xf')],'type':_0xaa0e('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18f880,_0x3fcfd8,_0x2b7be9){if(_0x18f880[_0xaa0e('0x11')]){_0x18f880[_0xaa0e('0xe')]=htmlToText['fromString'](_0x18f880['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2b7be9(null,_0x3fcfd8);},'afterCreate':function(_0x1b8f54,_0x222fe7,_0x48fd8c){var _0x3d1601=_0x6f9358[_0xaa0e('0x12')];var _0x5f0dc8=_0x1b8f54[_0xaa0e('0x13')]({'plain':!![]});if(_0x5f0dc8[_0xaa0e('0x14')][_0xaa0e('0x15')]()==='in'||_0x5f0dc8[_0xaa0e('0x14')]['toLowerCase']()===_0xaa0e('0x16')&&!_0x5f0dc8[_0xaa0e('0x17')]&&!_[_0xaa0e('0x18')](_0x5f0dc8[_0xaa0e('0x19')])){_0x3d1601[_0xaa0e('0x1a')][_0xaa0e('0x1b')]({'where':{'id':_0x5f0dc8[_0xaa0e('0x1c')]}})[_0xaa0e('0x1d')](function(_0x1f6477){if(_0x1f6477){_0x1f6477[_0xaa0e('0x1e')]({'lastMsgAt':_0x5f0dc8[_0xaa0e('0x1f')],'lastMsgDirection':_0x5f0dc8[_0xaa0e('0x14')][_0xaa0e('0x15')]()});}})[_0xaa0e('0x20')](function(_0x1857eb){console[_0xaa0e('0x21')](_0x1857eb);});}_0x48fd8c();}},'charset':'utf8mb4','collate':_0xaa0e('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e37f3a2..2509d2b 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 _0x583c=['request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','CreateMailMessage','MailMessage','create','body','options','raw','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x5a037a,_0x44a3fc){var _0x28ff57=function(_0x13d49f){while(--_0x13d49f){_0x5a037a['push'](_0x5a037a['shift']());}};_0x28ff57(++_0x44a3fc);}(_0x583c,0x12b));var _0xc583=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0x583c[_0x232ec0];return _0x356705;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});config[_0xc583('0xa')]=_[_0xc583('0xb')](config['redis'],{'host':_0xc583('0xc'),'port':0x18eb});var socket=require(_0xc583('0xd'))(new Redis(config['redis']));require(_0xc583('0xe'))[_0xc583('0xf')](socket);function respondWithRpcPromise(_0x25f8d3,_0xb23f07,_0x2d99ca){return new BPromise(function(_0x550b1e,_0x3437be){return client[_0xc583('0x10')](_0x25f8d3,_0x2d99ca)['then'](function(_0x23c51a){logger[_0xc583('0x11')]('MailMessage,\x20%s,\x20%s',_0xb23f07,_0xc583('0x12'));logger[_0xc583('0x13')](_0xc583('0x14'),_0xb23f07,_0xc583('0x12'),JSON[_0xc583('0x15')](_0x23c51a));if(_0x23c51a[_0xc583('0x16')]){if(_0x23c51a[_0xc583('0x16')][_0xc583('0x17')]===0x1f4){logger[_0xc583('0x16')]('MailMessage,\x20%s,\x20%s',_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x3437be(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}logger['error'](_0xc583('0x19'),_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x550b1e(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}else{logger['info'](_0xc583('0x19'),_0xb23f07,_0xc583('0x12'));_0x550b1e(_0x23c51a[_0xc583('0x1a')][_0xc583('0x18')]);}})['catch'](function(_0x3dd3cc){logger['error'](_0xc583('0x19'),_0xb23f07,_0x3dd3cc);_0x3437be(_0x3dd3cc);});});}exports[_0xc583('0x1b')]=function(_0xfd9a60){var _0x774f4c=this;return new Promise(function(_0x1052b5,_0x12b910){return db[_0xc583('0x1c')][_0xc583('0x1d')](_0xfd9a60[_0xc583('0x1e')],{'raw':_0xfd9a60[_0xc583('0x1f')]?_0xfd9a60[_0xc583('0x1f')][_0xc583('0x20')]===undefined?!![]:![]:!![]})[_0xc583('0x21')](function(_0x478ee1){logger['info'](_0xc583('0x1b'),_0xfd9a60);logger[_0xc583('0x13')](_0xc583('0x1b'),_0xfd9a60,JSON['stringify'](_0x478ee1));_0x1052b5(_0x478ee1);})[_0xc583('0x22')](function(_0x959500){logger[_0xc583('0x16')](_0xc583('0x1b'),_0x959500[_0xc583('0x18')],_0xfd9a60);_0x12b910(_0x774f4c['error'](0x1f4,_0x959500['message']));});});}; \ No newline at end of file +var _0x0abf=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info'];(function(_0x5c6c64,_0x12d4cb){var _0x172174=function(_0x3f49c3){while(--_0x3f49c3){_0x5c6c64['push'](_0x5c6c64['shift']());}};_0x172174(++_0x12d4cb);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0abf[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});config[_0xf0ab('0xa')]=_['defaults'](config[_0xf0ab('0xa')],{'host':_0xf0ab('0xb'),'port':0x18eb});var socket=require(_0xf0ab('0xc'))(new Redis(config[_0xf0ab('0xa')]));require('./mailMessage.socket')[_0xf0ab('0xd')](socket);function respondWithRpcPromise(_0x4688d8,_0x1e7887,_0x4ab8e7){return new BPromise(function(_0x5d25a0,_0x30042c){return client['request'](_0x4688d8,_0x4ab8e7)[_0xf0ab('0xe')](function(_0x10a5a2){logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));logger[_0xf0ab('0x12')](_0xf0ab('0x13'),_0x1e7887,'request\x20sent',JSON[_0xf0ab('0x14')](_0x10a5a2));if(_0x10a5a2[_0xf0ab('0x15')]){if(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x16')]===0x1f4){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x30042c(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);}logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x5d25a0(_0x10a5a2[_0xf0ab('0x15')]['message']);}else{logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));_0x5d25a0(_0x10a5a2[_0xf0ab('0x18')][_0xf0ab('0x17')]);}})[_0xf0ab('0x19')](function(_0x3a0edf){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x3a0edf);_0x30042c(_0x3a0edf);});});}exports[_0xf0ab('0x1a')]=function(_0x715579){var _0xdfcfb2=this;return new Promise(function(_0xf43bc4,_0x22a205){return db[_0xf0ab('0x1b')][_0xf0ab('0x1c')](_0x715579['body'],{'raw':_0x715579[_0xf0ab('0x1d')]?_0x715579[_0xf0ab('0x1d')][_0xf0ab('0x1e')]===undefined?!![]:![]:!![]})[_0xf0ab('0xe')](function(_0x3bf6a1){logger[_0xf0ab('0xf')](_0xf0ab('0x1a'),_0x715579);logger[_0xf0ab('0x12')](_0xf0ab('0x1a'),_0x715579,JSON[_0xf0ab('0x14')](_0x3bf6a1));_0xf43bc4(_0x3bf6a1);})[_0xf0ab('0x19')](function(_0x5645b2){logger['error']('CreateMailMessage',_0x5645b2[_0xf0ab('0x17')],_0x715579);_0x22a205(_0xdfcfb2['error'](0x1f4,_0x5645b2[_0xf0ab('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a5ffa5b..493cdbf 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 _0x8bd1=['update','emit','removeListener','register','length','./mailMessage.events','remove'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x8bd1,0x1da));var _0x18bd=function(_0x4916c3,_0x160684){_0x4916c3=_0x4916c3-0x0;var _0x12d901=_0x8bd1[_0x4916c3];return _0x12d901;};'use strict';var MailMessageEvents=require(_0x18bd('0x0'));var events=['save',_0x18bd('0x1'),_0x18bd('0x2')];function createListener(_0x3a1758,_0x205187){return function(_0x48ad81){_0x205187[_0x18bd('0x3')](_0x3a1758,_0x48ad81);};}function removeListener(_0x5652b9,_0x32c369){return function(){MailMessageEvents[_0x18bd('0x4')](_0x5652b9,_0x32c369);};}exports[_0x18bd('0x5')]=function(_0x3b075b){for(var _0x49d44a=0x0,_0x4ea0bd=events[_0x18bd('0x6')];_0x49d44a<_0x4ea0bd;_0x49d44a++){var _0x246cd1=events[_0x49d44a];var _0x3132df=createListener('mailMessage:'+_0x246cd1,_0x3b075b);MailMessageEvents['on'](_0x246cd1,_0x3132df);}}; \ No newline at end of file +var _0xaf09=['update','emit','removeListener','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x17dfcb,_0x1a762b){var _0x268f6f=function(_0x3737b5){while(--_0x3737b5){_0x17dfcb['push'](_0x17dfcb['shift']());}};_0x268f6f(++_0x1a762b);}(_0xaf09,0x10d));var _0x9af0=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0xaf09[_0x3f3f06];return _0x140feb;};'use strict';var MailMessageEvents=require(_0x9af0('0x0'));var events=[_0x9af0('0x1'),_0x9af0('0x2'),_0x9af0('0x3')];function createListener(_0x397a04,_0x30b56d){return function(_0x3ac792){_0x30b56d[_0x9af0('0x4')](_0x397a04,_0x3ac792);};}function removeListener(_0x10ebd9,_0x4db6f8){return function(){MailMessageEvents[_0x9af0('0x5')](_0x10ebd9,_0x4db6f8);};}exports['register']=function(_0x31ce7a){for(var _0x450ea7=0x0,_0x52162e=events[_0x9af0('0x6')];_0x450ea7<_0x52162e;_0x450ea7++){var _0x556d1a=events[_0x450ea7];var _0x51663a=createListener(_0x9af0('0x7')+_0x556d1a,_0x31ce7a);MailMessageEvents['on'](_0x556d1a,_0x51663a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 33f27bb..50acd24 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 _0xfaa2=['isAuthenticated','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','delete','/:id','destroy','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','describe'];(function(_0x1dcbad,_0x250887){var _0x4574be=function(_0x19dde1){while(--_0x19dde1){_0x1dcbad['push'](_0x1dcbad['shift']());}};_0x4574be(++_0x250887);}(_0xfaa2,0x109));var _0x2faa=function(_0x394ebf,_0x18412e){_0x394ebf=_0x394ebf-0x0;var _0x45f014=_0xfaa2[_0x394ebf];return _0x45f014;};'use strict';var multer=require('multer');var util=require(_0x2faa('0x0'));var path=require('path');var timeout=require(_0x2faa('0x1'));var express=require('express');var router=express[_0x2faa('0x2')]();var fs_extra=require(_0x2faa('0x3'));var auth=require(_0x2faa('0x4'));var interaction=require(_0x2faa('0x5'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0x2faa('0x6')]('/',auth['isAuthenticated'](),controller[_0x2faa('0x7')]);router[_0x2faa('0x6')](_0x2faa('0x8'),auth['isAuthenticated'](),controller[_0x2faa('0x9')]);router[_0x2faa('0x6')]('/:id',auth[_0x2faa('0xa')](),controller[_0x2faa('0xb')]);router[_0x2faa('0x6')](_0x2faa('0xc'),auth[_0x2faa('0xa')](),controller['getMembers']);router['get'](_0x2faa('0xd'),auth[_0x2faa('0xa')](),controller[_0x2faa('0xe')]);router[_0x2faa('0x6')](_0x2faa('0xf'),auth[_0x2faa('0xa')](),controller['getAgents']);router[_0x2faa('0x10')]('/',auth[_0x2faa('0xa')](),controller[_0x2faa('0x11')]);router['post'](_0x2faa('0xd'),auth[_0x2faa('0xa')](),controller['addTeams']);router[_0x2faa('0x10')](_0x2faa('0xf'),auth[_0x2faa('0xa')](),controller[_0x2faa('0x12')]);router[_0x2faa('0x13')]('/:id',auth[_0x2faa('0xa')](),controller['update']);router[_0x2faa('0x14')](_0x2faa('0x15'),auth[_0x2faa('0xa')](),controller[_0x2faa('0x16')]);router[_0x2faa('0x14')](_0x2faa('0xd'),auth[_0x2faa('0xa')](),controller['removeTeams']);router[_0x2faa('0x14')](_0x2faa('0xf'),auth[_0x2faa('0xa')](),controller[_0x2faa('0x17')]);module[_0x2faa('0x18')]=router; \ No newline at end of file +var _0xc341=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0xc341,0x1d4));var _0x1c34=function(_0x1d1b93,_0x1e44c9){_0x1d1b93=_0x1d1b93-0x0;var _0x100cd1=_0xc341[_0x1d1b93];return _0x100cd1;};'use strict';var multer=require(_0x1c34('0x0'));var util=require(_0x1c34('0x1'));var path=require(_0x1c34('0x2'));var timeout=require(_0x1c34('0x3'));var express=require(_0x1c34('0x4'));var router=express['Router']();var fs_extra=require(_0x1c34('0x5'));var auth=require(_0x1c34('0x6'));var interaction=require(_0x1c34('0x7'));var config=require(_0x1c34('0x8'));var controller=require('./mailQueue.controller');router[_0x1c34('0x9')]('/',auth[_0x1c34('0xa')](),controller['index']);router['get'](_0x1c34('0xb'),auth[_0x1c34('0xa')](),controller[_0x1c34('0xc')]);router['get'](_0x1c34('0xd'),auth[_0x1c34('0xa')](),controller[_0x1c34('0xe')]);router[_0x1c34('0x9')]('/:id/members',auth[_0x1c34('0xa')](),controller[_0x1c34('0xf')]);router['get'](_0x1c34('0x10'),auth[_0x1c34('0xa')](),controller['getTeams']);router[_0x1c34('0x9')](_0x1c34('0x11'),auth[_0x1c34('0xa')](),controller[_0x1c34('0x12')]);router[_0x1c34('0x13')]('/',auth[_0x1c34('0xa')](),controller['create']);router[_0x1c34('0x13')](_0x1c34('0x10'),auth[_0x1c34('0xa')](),controller[_0x1c34('0x14')]);router[_0x1c34('0x13')]('/:id/users',auth[_0x1c34('0xa')](),controller[_0x1c34('0x15')]);router['put'](_0x1c34('0xd'),auth[_0x1c34('0xa')](),controller[_0x1c34('0x16')]);router['delete'](_0x1c34('0xd'),auth[_0x1c34('0xa')](),controller[_0x1c34('0x17')]);router[_0x1c34('0x18')](_0x1c34('0x10'),auth[_0x1c34('0xa')](),controller[_0x1c34('0x19')]);router['delete'](_0x1c34('0x11'),auth['isAuthenticated'](),controller[_0x1c34('0x1a')]);module[_0x1c34('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 61997a5..c8dde39 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 _0xa8e8=['beepall','exports','STRING','INTEGER','ENUM'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xa8e8,0xce));var _0x8a8e=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0xa8e8[_0x1ceb7b];return _0x57c016;};'use strict';var Sequelize=require('sequelize');module[_0x8a8e('0x0')]={'name':{'type':Sequelize[_0x8a8e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8a8e('0x1')]},'timeout':{'type':Sequelize[_0x8a8e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8a8e('0x3')]('rrmemory',_0x8a8e('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x8eaf=['STRING','name','INTEGER','ENUM','roundrobin','sequelize','exports'];(function(_0x4fd791,_0x180648){var _0x30c89e=function(_0x2b1edd){while(--_0x2b1edd){_0x4fd791['push'](_0x4fd791['shift']());}};_0x30c89e(++_0x180648);}(_0x8eaf,0x7c));var _0xf8ea=function(_0xd746ed,_0x81920c){_0xd746ed=_0xd746ed-0x0;var _0x5ef2a6=_0x8eaf[_0xd746ed];return _0x5ef2a6;};'use strict';var Sequelize=require(_0xf8ea('0x0'));module[_0xf8ea('0x1')]={'name':{'type':Sequelize[_0xf8ea('0x2')],'unique':_0xf8ea('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf8ea('0x2')]},'timeout':{'type':Sequelize[_0xf8ea('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf8ea('0x5')]('rrmemory','beepall',_0xf8ea('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index cbeac0f..19b075e 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 _0x1e65=['online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','Team','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','compact','value','transaction','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','MailQueues','error','stack','name','send','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','show','params','model','keys','filters','intersection','attributes','fields','length','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','sort','pick','MailQueueId','filter','findAndCountAll','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','nolimit','ids','findAll','User','Agents'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e65,0x191));var _0x51e6=function(_0x146261,_0x308383){_0x146261=_0x146261-0x0;var _0xe5fc79=_0x1e65[_0x146261];return _0xe5fc79;};'use strict';var BPromise=require('bluebird');var util=require(_0x51e6('0x0'));var _=require('lodash');var squel=require(_0x51e6('0x1'));var Redis=require(_0x51e6('0x2'));var qs=require(_0x51e6('0x3'));var logger=require(_0x51e6('0x4'))(_0x51e6('0x5'));var config=require(_0x51e6('0x6'));var db=require(_0x51e6('0x7'))['db'];config[_0x51e6('0x8')]=_[_0x51e6('0x9')](config[_0x51e6('0x8')],{'host':_0x51e6('0xa'),'port':0x18eb});var socket=require(_0x51e6('0xb'))(new Redis(config['redis']));require(_0x51e6('0xc'))['register'](socket);function respondWithStatusCode(_0x3caca8,_0x28123b){_0x28123b=_0x28123b||0xcc;return function(_0x5e168c){if(_0x5e168c){return _0x3caca8[_0x51e6('0xd')](_0x28123b);}return _0x3caca8[_0x51e6('0xe')](_0x28123b)['end']();};}function respondWithResult(_0x1b79e2,_0x23b60e){_0x23b60e=_0x23b60e||0xc8;return function(_0x2ba405){if(_0x2ba405){return _0x1b79e2['status'](_0x23b60e)[_0x51e6('0xf')](_0x2ba405);}};}function respondWithFilteredResult(_0x523d03,_0x1ac973){return function(_0x11bb52){if(_0x11bb52){var _0x36da79=typeof _0x1ac973[_0x51e6('0x10')]===_0x51e6('0x11')&&typeof _0x1ac973[_0x51e6('0x12')]==='undefined';var _0x20f770=_0x11bb52[_0x51e6('0x13')];var _0x19a98f=_0x36da79?0x0:_0x1ac973['offset'];var _0x67da31=_0x36da79?_0x11bb52[_0x51e6('0x13')]:_0x1ac973[_0x51e6('0x10')]+_0x1ac973[_0x51e6('0x12')];var _0x4fa1b8;if(_0x67da31>=_0x20f770){_0x67da31=_0x20f770;_0x4fa1b8=0xc8;}else{_0x4fa1b8=0xce;}_0x523d03['status'](_0x4fa1b8);return _0x523d03[_0x51e6('0x14')](_0x51e6('0x15'),_0x19a98f+'-'+_0x67da31+'/'+_0x20f770)[_0x51e6('0xf')](_0x11bb52);}return null;};}function saveUpdates(_0x1b3393){return function(_0x1a5659){if(_0x1a5659){return _0x1a5659[_0x51e6('0x16')](_0x1b3393)[_0x51e6('0x17')](function(_0x3e69d2){return _0x3e69d2;});}return null;};}function removeEntity(_0x27a08d){return function(_0x1e98c1){if(_0x1e98c1){return _0x1e98c1[_0x51e6('0x18')]()[_0x51e6('0x17')](function(){var _0x4db48a=_0x1e98c1[_0x51e6('0x19')]({'plain':!![]});var _0x4c307f=_0x51e6('0x1a');return db['UserProfileResource'][_0x51e6('0x18')]({'where':{'type':_0x4c307f,'resourceId':_0x4db48a['id']}})['then'](function(){return _0x1e98c1;});})['then'](function(){_0x27a08d[_0x51e6('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x585f17){return function(_0x2e7629){if(!_0x2e7629){_0x585f17[_0x51e6('0xd')](0x194);}return _0x2e7629;};}function handleError(_0x2bfd2b,_0x58be95){_0x58be95=_0x58be95||0x1f4;return function(_0x567081){logger[_0x51e6('0x1b')](_0x567081[_0x51e6('0x1c')]);if(_0x567081[_0x51e6('0x1d')]){delete _0x567081[_0x51e6('0x1d')];}_0x2bfd2b['status'](_0x58be95)[_0x51e6('0x1e')](_0x567081);};}exports['index']=function(_0x1bb31d,_0xfde8c3){var _0x3e4473={};var _0x179de1={'count':0x0,'rows':[]};var _0x284577=_[_0x51e6('0x1f')](db[_0x51e6('0x20')][_0x51e6('0x21')],function(_0x54810f){return{'name':_0x54810f[_0x51e6('0x22')],'type':_0x54810f[_0x51e6('0x23')][_0x51e6('0x24')]};});_0x3e4473=qs[_0x51e6('0x25')](_0x284577,_0x1bb31d);var _0x1b1f56={'where':_0x3e4473[_0x51e6('0x26')]};return db[_0x51e6('0x20')][_0x51e6('0x13')](_0x1b1f56)[_0x51e6('0x17')](function(_0x44fcf1){_0x179de1[_0x51e6('0x13')]=_0x44fcf1;_0x3e4473[_0x51e6('0x27')]=qs[_0x51e6('0x27')](_0x1bb31d[_0x51e6('0x28')]);return db[_0x51e6('0x20')]['findAll'](_0x3e4473);})[_0x51e6('0x17')](function(_0x4fa9b1){_0x179de1['rows']=_0x4fa9b1;return _0x179de1;})['then'](respondWithFilteredResult(_0xfde8c3,_0x3e4473))['catch'](handleError(_0xfde8c3,null));};exports[_0x51e6('0x29')]=function(_0x20fcce,_0x103c4e){var _0x3fd81c={'raw':!![],'where':{'id':_0x20fcce[_0x51e6('0x2a')]['id']}},_0x32b517={};_0x32b517[_0x51e6('0x2b')]=_[_0x51e6('0x2c')](db[_0x51e6('0x20')][_0x51e6('0x21')]);_0x32b517['query']=_[_0x51e6('0x2c')](_0x20fcce['query']);_0x32b517[_0x51e6('0x2d')]=_[_0x51e6('0x2e')](_0x32b517[_0x51e6('0x2b')],_0x32b517[_0x51e6('0x28')]);_0x3fd81c[_0x51e6('0x2f')]=_['intersection'](_0x32b517['model'],qs['fields'](_0x20fcce[_0x51e6('0x28')][_0x51e6('0x30')]));_0x3fd81c[_0x51e6('0x2f')]=_0x3fd81c['attributes'][_0x51e6('0x31')]?_0x3fd81c[_0x51e6('0x2f')]:_0x32b517[_0x51e6('0x2b')];if(_0x20fcce['query']['includeAll']){_0x3fd81c[_0x51e6('0x27')]=[{'all':!![]}];}_0x3fd81c=_[_0x51e6('0x32')]({},_0x3fd81c,_0x20fcce[_0x51e6('0x33')]);return db['MailQueue'][_0x51e6('0x34')](_0x3fd81c)[_0x51e6('0x17')](handleEntityNotFound(_0x103c4e,null))[_0x51e6('0x17')](respondWithResult(_0x103c4e,null))[_0x51e6('0x35')](handleError(_0x103c4e,null));};exports[_0x51e6('0x36')]=function(_0x192491,_0x1cfb7d){return db[_0x51e6('0x20')]['create'](_0x192491['body'],{})['then'](function(_0x4156eb){var _0x56e068=_0x192491[_0x51e6('0x37')][_0x51e6('0x19')]({'plain':!![]});if(!_0x56e068)throw new Error(_0x51e6('0x38'));if(_0x56e068[_0x51e6('0x39')]===_0x51e6('0x37')){var _0x16e88c=_0x4156eb[_0x51e6('0x19')]({'plain':!![]});var _0xb9ed2f=_0x51e6('0x1a');return db[_0x51e6('0x3a')]['find']({'where':{'name':_0xb9ed2f,'userProfileId':_0x56e068[_0x51e6('0x3b')]},'raw':!![]})['then'](function(_0x1f7b17){if(_0x1f7b17&&_0x1f7b17['autoAssociation']===0x0){return db[_0x51e6('0x3c')][_0x51e6('0x36')]({'name':_0x16e88c[_0x51e6('0x1d')],'resourceId':_0x16e88c['id'],'type':_0x1f7b17[_0x51e6('0x1d')],'sectionId':_0x1f7b17['id']},{})[_0x51e6('0x17')](function(){return _0x4156eb;});}else{return _0x4156eb;}})[_0x51e6('0x35')](function(_0x30bb8f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30bb8f);throw _0x30bb8f;});}return _0x4156eb;})[_0x51e6('0x17')](respondWithResult(_0x1cfb7d,0xc9))[_0x51e6('0x35')](handleError(_0x1cfb7d,null));};exports[_0x51e6('0x16')]=function(_0x1b43b8,_0x49428d){if(_0x1b43b8[_0x51e6('0x3d')]['id']){delete _0x1b43b8[_0x51e6('0x3d')]['id'];}return db['MailQueue'][_0x51e6('0x34')]({'where':{'id':_0x1b43b8[_0x51e6('0x2a')]['id']}})[_0x51e6('0x17')](handleEntityNotFound(_0x49428d,null))[_0x51e6('0x17')](saveUpdates(_0x1b43b8[_0x51e6('0x3d')],null))[_0x51e6('0x17')](respondWithResult(_0x49428d,null))[_0x51e6('0x35')](handleError(_0x49428d,null));};exports[_0x51e6('0x18')]=function(_0x23f57f,_0x4e5cb5){return db[_0x51e6('0x20')][_0x51e6('0x34')]({'where':{'id':_0x23f57f[_0x51e6('0x2a')]['id']}})[_0x51e6('0x17')](handleEntityNotFound(_0x4e5cb5,null))[_0x51e6('0x17')](removeEntity(_0x4e5cb5,null))[_0x51e6('0x35')](handleError(_0x4e5cb5,null));};exports[_0x51e6('0x3e')]=function(_0x559896,_0x51384d){return db[_0x51e6('0x20')]['describe']()[_0x51e6('0x17')](respondWithResult(_0x51384d,null))[_0x51e6('0x35')](handleError(_0x51384d,null));};exports[_0x51e6('0x3f')]=function(_0x4dda3a,_0xe08687){var _0xbba27a={'raw':!![],'where':{}},_0x186aa5={},_0x5371b1;return db['MailQueue'][_0x51e6('0x40')]({'where':{'id':_0x4dda3a['params']['id']}})['then'](handleEntityNotFound(_0xe08687,null))['then'](function(_0x4bc373){if(_0x4bc373){_0x5371b1=_0x4bc373[_0x51e6('0x19')]({'plain':!![]});_0x186aa5[_0x51e6('0x2b')]=_['keys'](db[_0x51e6('0x41')][_0x51e6('0x21')]);_0x186aa5[_0x51e6('0x28')]=_['keys'](_0x4dda3a[_0x51e6('0x28')]);_0x186aa5[_0x51e6('0x2d')]=_[_0x51e6('0x2e')](_0x186aa5[_0x51e6('0x2b')],_0x186aa5[_0x51e6('0x28')]);_0xbba27a[_0x51e6('0x2f')]=_['intersection'](_0x186aa5[_0x51e6('0x2b')],qs[_0x51e6('0x30')](_0x4dda3a[_0x51e6('0x28')]['fields']));_0xbba27a[_0x51e6('0x2f')]=_0xbba27a[_0x51e6('0x2f')][_0x51e6('0x31')]?_0xbba27a['attributes']:_0x186aa5[_0x51e6('0x2b')];if(!_0x4dda3a['query'][_0x51e6('0x42')]('nolimit')){_0xbba27a[_0x51e6('0x12')]=qs[_0x51e6('0x12')](_0x4dda3a[_0x51e6('0x28')]['limit']);_0xbba27a[_0x51e6('0x10')]=qs[_0x51e6('0x10')](_0x4dda3a['query'][_0x51e6('0x10')]);}_0xbba27a[_0x51e6('0x43')]=qs[_0x51e6('0x44')](_0x4dda3a[_0x51e6('0x28')][_0x51e6('0x44')]);_0xbba27a[_0x51e6('0x26')]=qs[_0x51e6('0x2d')](_[_0x51e6('0x45')](_0x4dda3a[_0x51e6('0x28')],_0x186aa5[_0x51e6('0x2d')]));_0xbba27a['where'][_0x51e6('0x46')]=_0x4bc373['id'];if(_0x4dda3a[_0x51e6('0x28')][_0x51e6('0x47')]){_0xbba27a[_0x51e6('0x26')]=_['merge'](_0xbba27a[_0x51e6('0x26')],{'$or':_['map'](_0xbba27a['attributes'],function(_0x4dbb88){var _0x559f3b={};_0x559f3b[_0x4dbb88]={'$like':'%'+_0x4dda3a[_0x51e6('0x28')]['filter']+'%'};return _0x559f3b;})});}_0xbba27a=_['merge']({},_0xbba27a,_0x4dda3a[_0x51e6('0x33')]);return db[_0x51e6('0x41')]['findAll'](_0xbba27a);}})['then'](function(_0x5c4095){if(_0x5c4095){return db['User'][_0x51e6('0x48')]({'where':{'id':_[_0x51e6('0x1f')](_0x5c4095,'UserId'),'role':_0x51e6('0x49')},'attributes':['id',_0x51e6('0x1d'),_0x51e6('0x4a'),_0x51e6('0x4b'),_0x51e6('0x4c')]});}})['then'](function(_0x45073d){if(_0x45073d){return{'count':_0x45073d[_0x51e6('0x13')],'rows':_['map'](_0x45073d[_0x51e6('0x4d')],function(_0x2979dd){return{'membername':_0x2979dd['name'],'UserId':_0x2979dd['id'],'queue_name':_0x5371b1['name'],'MailQueueId':_0x5371b1['id'],'interface':util[_0x51e6('0x4e')](_0x51e6('0x4f'),_0x51e6('0x50'),_0x2979dd[_0x51e6('0x1d')]),'penalty':0x0,'paused':_0x2979dd[_0x51e6('0x4a')],'createdAt':_0x2979dd[_0x51e6('0x4c')],'updatedAt':_0x2979dd[_0x51e6('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xe08687,_0xbba27a))[_0x51e6('0x35')](handleError(_0xe08687,null));};exports['getTeams']=function(_0x565e56,_0x3e1b17){var _0x85d060={};var _0x1dc378={};var _0x3ab138;var _0x2e42c8;return db[_0x51e6('0x20')]['findOne']({'where':{'id':_0x565e56[_0x51e6('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3e1b17,null))[_0x51e6('0x17')](function(_0x3b106c){if(_0x3b106c){_0x3ab138=_0x3b106c;_0x1dc378['model']=_['keys'](db['Team'][_0x51e6('0x21')]);_0x1dc378[_0x51e6('0x28')]=_[_0x51e6('0x2c')](_0x565e56[_0x51e6('0x28')]);_0x1dc378[_0x51e6('0x2d')]=_[_0x51e6('0x2e')](_0x1dc378[_0x51e6('0x2b')],_0x1dc378[_0x51e6('0x28')]);_0x85d060['attributes']=_[_0x51e6('0x2e')](_0x1dc378[_0x51e6('0x2b')],qs[_0x51e6('0x30')](_0x565e56[_0x51e6('0x28')][_0x51e6('0x30')]));_0x85d060[_0x51e6('0x2f')]=_0x85d060[_0x51e6('0x2f')][_0x51e6('0x31')]?_0x85d060[_0x51e6('0x2f')]:_0x1dc378[_0x51e6('0x2b')];_0x85d060[_0x51e6('0x43')]=qs[_0x51e6('0x44')](_0x565e56[_0x51e6('0x28')][_0x51e6('0x44')]);_0x85d060[_0x51e6('0x26')]=qs['filters'](_[_0x51e6('0x45')](_0x565e56[_0x51e6('0x28')],_0x1dc378[_0x51e6('0x2d')]));if(_0x565e56['query'][_0x51e6('0x47')]){_0x85d060[_0x51e6('0x26')]=_[_0x51e6('0x32')](_0x85d060[_0x51e6('0x26')],{'$or':_[_0x51e6('0x1f')](_0x85d060[_0x51e6('0x2f')],function(_0x572c3b){var _0x489222={};_0x489222[_0x572c3b]={'$like':'%'+_0x565e56[_0x51e6('0x28')][_0x51e6('0x47')]+'%'};return _0x489222;})});}_0x85d060=_[_0x51e6('0x32')]({},_0x85d060,_0x565e56['options']);return _0x3ab138[_0x51e6('0x51')](_0x85d060);}})[_0x51e6('0x17')](function(_0x443d13){if(_0x443d13){_0x2e42c8=_0x443d13[_0x51e6('0x31')];if(!_0x565e56[_0x51e6('0x28')][_0x51e6('0x42')](_0x51e6('0x52'))){_0x85d060[_0x51e6('0x12')]=qs['limit'](_0x565e56['query'][_0x51e6('0x12')]);_0x85d060[_0x51e6('0x10')]=qs[_0x51e6('0x10')](_0x565e56[_0x51e6('0x28')]['offset']);}return _0x3ab138['getTeams'](_0x85d060);}})[_0x51e6('0x17')](function(_0x592d1b){if(_0x592d1b){return _0x592d1b?{'count':_0x2e42c8,'rows':_0x592d1b}:null;}})[_0x51e6('0x17')](respondWithResult(_0x3e1b17,null))[_0x51e6('0x35')](handleError(_0x3e1b17,null));};exports['addTeams']=function(_0x3ebfaa,_0x3b1f9d){var _0x2f981b=_0x3ebfaa['body'][_0x51e6('0x53')];return db['Team'][_0x51e6('0x54')]({'where':{'id':_0x2f981b},'attributes':['id'],'include':[{'model':db[_0x51e6('0x55')],'as':_0x51e6('0x56'),'attributes':['id',_0x51e6('0x1d'),_0x51e6('0x57'),_0x51e6('0x58'),_0x51e6('0x59')],'raw':!![]}]})[_0x51e6('0x17')](function(_0xb7e296){if(_0xb7e296){var _0x2e16e9=_[_0x51e6('0x5a')](_0xb7e296,function(_0x26ce67){var _0x327354=_0x26ce67['get']({'plain':!![]});return _0x327354[_0x51e6('0x56')];});return db['MailQueue'][_0x51e6('0x34')]({'where':{'id':_0x3ebfaa[_0x51e6('0x2a')]['id']}})[_0x51e6('0x17')](function(_0x1c678b){return db['sequelize']['transaction'](function(_0x3c2320){return _0x1c678b['addTeams'](_0x2f981b,{'transaction':_0x3c2320})['then'](function(){return BPromise['each'](_0x2e16e9,function(_0x3733af){return db[_0x51e6('0x41')][_0x51e6('0x5b')]({'where':{'UserId':_0x3733af['id'],'MailQueueId':_0x3ebfaa[_0x51e6('0x2a')]['id']},'transaction':_0x3c2320});});})[_0x51e6('0x17')](function(){_0x2e16e9[_0x51e6('0x5c')](function(_0x586687){socket[_0x51e6('0x5d')](_0x51e6('0x5e'),{'UserId':_0x586687['id'],'MailQueueId':_0x1c678b['id']});});});});});}})[_0x51e6('0x17')](respondWithStatusCode(_0x3b1f9d,null))[_0x51e6('0x35')](handleError(_0x3b1f9d,null));};exports[_0x51e6('0x5f')]=function(_0x22843d,_0x48be45){return db[_0x51e6('0x60')][_0x51e6('0x54')]({'where':{'id':_0x22843d[_0x51e6('0x28')][_0x51e6('0x53')]},'attributes':['id'],'include':[{'model':db[_0x51e6('0x55')],'as':_0x51e6('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x48be45,null))['then'](function(_0x5cfc38){var _0x422daf=_[_0x51e6('0x1f')](_0x5cfc38,'id');var _0x5675d5=[];var _0x1fddfe=[];var _0x371f84=squel[_0x51e6('0x61')]();_0x371f84[_0x51e6('0x62')](_0x51e6('0x63'))[_0x51e6('0x64')]('team_has_mail_queues','tq')[_0x51e6('0x65')](_0x51e6('0x66'),'ut',_0x51e6('0x67'))[_0x51e6('0x26')]('MailQueueId\x20=\x20?',_0x22843d[_0x51e6('0x2a')]['id']);for(var _0x371013=0x0;_0x371013<_0x5cfc38['length'];_0x371013+=0x1){let _0x18dda0=_0x5cfc38[_0x371013];for(var _0x337e35=0x0;_0x337e35<_0x18dda0[_0x51e6('0x56')]['length'];_0x337e35+=0x1){let _0x5dc761=_0x18dda0[_0x51e6('0x56')][_0x337e35];var _0x340dbe=_0x371f84[_0x51e6('0x68')]();_0x340dbe[_0x51e6('0x26')](_0x51e6('0x69'),_0x5dc761['id']);_0x1fddfe[_0x51e6('0x6a')](db[_0x51e6('0x6b')][_0x51e6('0x28')](_0x340dbe[_0x51e6('0x6c')](),{'type':db[_0x51e6('0x6b')][_0x51e6('0x6d')][_0x51e6('0x6e')]})[_0x51e6('0x17')](function(_0x1376b2){if(_0x1376b2[_0x51e6('0x31')]===0x1){return _0x5dc761['id'];}else{var _0x3edf1b=_['every'](_[_0x51e6('0x1f')](_0x1376b2,_0x51e6('0x6f')),function(_0x23ad8c){return _['includes'](_0x422daf,_0x23ad8c);});if(_0x3edf1b){return _0x5dc761['id'];}}}));}}return BPromise[_0x51e6('0x70')](_0x1fddfe)[_0x51e6('0x17')](function(_0x440408){_0x5675d5=_(_0x5675d5)['union'](_0x440408)[_0x51e6('0x71')]()[_0x51e6('0x72')]();return db['MailQueue'][_0x51e6('0x34')]({'where':{'id':_0x22843d['params']['id']}})[_0x51e6('0x17')](function(_0x32cd8f){return db['sequelize'][_0x51e6('0x73')](function(_0x1d47b2){return _0x32cd8f[_0x51e6('0x5f')](_0x22843d['query']['ids'],{'transaction':_0x1d47b2})[_0x51e6('0x17')](function(){if(!_['isEmpty'](_0x5675d5)){return _0x32cd8f[_0x51e6('0x74')](_0x5675d5,{'transaction':_0x1d47b2});}})['then'](function(){_0x5675d5[_0x51e6('0x5c')](function(_0x194ccc){socket[_0x51e6('0x5d')](_0x51e6('0x75'),{'UserId':_0x194ccc,'MailQueueId':_0x32cd8f['id']});});});});});});})[_0x51e6('0x17')](respondWithStatusCode(_0x48be45,null))['catch'](handleError(_0x48be45,null));};exports[_0x51e6('0x76')]=function(_0x2818cd,_0x214876){return db[_0x51e6('0x20')]['find']({'where':{'id':_0x2818cd[_0x51e6('0x2a')]['id']}})[_0x51e6('0x17')](handleEntityNotFound(_0x214876,null))[_0x51e6('0x17')](function(_0x2dfcac){if(_0x2dfcac){return _0x2dfcac['addAgents'](_0x2818cd[_0x51e6('0x3d')]['ids'],_['omit'](_0x2818cd[_0x51e6('0x3d')],['ids','id'])||{})[_0x51e6('0x77')](function(_0x42bad5){for(var _0x1ecb17=0x0;_0x1ecb17<_0x2818cd['body'][_0x51e6('0x53')][_0x51e6('0x31')];_0x1ecb17+=0x1){socket[_0x51e6('0x5d')](_0x51e6('0x5e'),{'UserId':Number(_0x2818cd[_0x51e6('0x3d')][_0x51e6('0x53')][_0x1ecb17]),'MailQueueId':Number(_0x2818cd['params']['id'])});}return _0x42bad5;});}})[_0x51e6('0x17')](respondWithResult(_0x214876,null))[_0x51e6('0x35')](handleError(_0x214876,null));};exports[_0x51e6('0x74')]=function(_0x5a539c,_0x5277f2){return db[_0x51e6('0x20')][_0x51e6('0x34')]({'where':{'id':_0x5a539c[_0x51e6('0x2a')]['id']}})[_0x51e6('0x17')](handleEntityNotFound(_0x5277f2,null))['then'](function(_0x4f18f8){if(_0x4f18f8){return _0x4f18f8[_0x51e6('0x74')](_0x5a539c[_0x51e6('0x28')]['ids'])[_0x51e6('0x17')](function(){if(_[_0x51e6('0x78')](_0x5a539c[_0x51e6('0x28')][_0x51e6('0x53')])){for(var _0x5ec859=0x0;_0x5ec859<_0x5a539c[_0x51e6('0x28')][_0x51e6('0x53')]['length'];_0x5ec859+=0x1){socket[_0x51e6('0x5d')](_0x51e6('0x75'),{'UserId':Number(_0x5a539c[_0x51e6('0x28')][_0x51e6('0x53')][_0x5ec859]),'MailQueueId':Number(_0x5a539c[_0x51e6('0x2a')]['id'])});}}else{socket[_0x51e6('0x5d')](_0x51e6('0x75'),{'UserId':Number(_0x5a539c[_0x51e6('0x28')][_0x51e6('0x53')]),'MailQueueId':Number(_0x5a539c[_0x51e6('0x2a')]['id'])});}});}})[_0x51e6('0x17')](respondWithStatusCode(_0x5277f2,null))[_0x51e6('0x35')](handleError(_0x5277f2,null));};exports[_0x51e6('0x79')]=function(_0x4b824f,_0x207773){var _0x3a7a3a={};var _0x18eb57={};var _0x402929;var _0x39b57e;return db[_0x51e6('0x20')][_0x51e6('0x40')]({'where':{'id':_0x4b824f[_0x51e6('0x2a')]['id']}})['then'](handleEntityNotFound(_0x207773,null))['then'](function(_0x34e7f1){if(_0x34e7f1){_0x402929=_0x34e7f1;_0x18eb57[_0x51e6('0x2b')]=_['keys'](db[_0x51e6('0x55')][_0x51e6('0x21')]);_0x18eb57[_0x51e6('0x28')]=_[_0x51e6('0x2c')](_0x4b824f['query']);_0x18eb57[_0x51e6('0x2d')]=_[_0x51e6('0x2e')](_0x18eb57[_0x51e6('0x2b')],_0x18eb57['query']);_0x3a7a3a[_0x51e6('0x2f')]=_[_0x51e6('0x2e')](_0x18eb57[_0x51e6('0x2b')],qs[_0x51e6('0x30')](_0x4b824f[_0x51e6('0x28')]['fields']));_0x3a7a3a[_0x51e6('0x2f')]=_0x3a7a3a['attributes']['length']?_0x3a7a3a['attributes']:_0x18eb57[_0x51e6('0x2b')];_0x3a7a3a[_0x51e6('0x43')]=qs[_0x51e6('0x44')](_0x4b824f[_0x51e6('0x28')][_0x51e6('0x44')]);_0x3a7a3a[_0x51e6('0x26')]=qs['filters'](_[_0x51e6('0x45')](_0x4b824f['query'],_0x18eb57[_0x51e6('0x2d')]));if(_0x4b824f[_0x51e6('0x28')][_0x51e6('0x47')]){_0x3a7a3a[_0x51e6('0x26')]=_[_0x51e6('0x32')](_0x3a7a3a[_0x51e6('0x26')],{'$or':_['map'](_0x3a7a3a['attributes'],function(_0x40b596){var _0x3d83d8={};_0x3d83d8[_0x40b596]={'$like':'%'+_0x4b824f[_0x51e6('0x28')][_0x51e6('0x47')]+'%'};return _0x3d83d8;})});}_0x3a7a3a=_[_0x51e6('0x32')]({},_0x3a7a3a,_0x4b824f[_0x51e6('0x33')]);return _0x402929['getAgents'](_0x3a7a3a);}})[_0x51e6('0x17')](function(_0x2d9f3f){if(_0x2d9f3f){_0x39b57e=_0x2d9f3f[_0x51e6('0x31')];if(!_0x4b824f[_0x51e6('0x28')][_0x51e6('0x42')]('nolimit')){_0x3a7a3a[_0x51e6('0x12')]=qs[_0x51e6('0x12')](_0x4b824f[_0x51e6('0x28')][_0x51e6('0x12')]);_0x3a7a3a['offset']=qs[_0x51e6('0x10')](_0x4b824f[_0x51e6('0x28')][_0x51e6('0x10')]);}return _0x402929[_0x51e6('0x79')](_0x3a7a3a);}})[_0x51e6('0x17')](function(_0x2c2e61){if(_0x2c2e61){return _0x2c2e61?{'count':_0x39b57e,'rows':_0x2c2e61}:null;}})[_0x51e6('0x17')](respondWithResult(_0x207773,null))['catch'](handleError(_0x207773,null));}; \ No newline at end of file +var _0x7efe=['MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','MailQueue','include','query','findAll','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','pick','where','MailQueueId','filter','merge','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy'];(function(_0x242750,_0x454e0b){var _0x17eeba=function(_0x4fc28c){while(--_0x4fc28c){_0x242750['push'](_0x242750['shift']());}};_0x17eeba(++_0x454e0b);}(_0x7efe,0x16a));var _0xe7ef=function(_0x5d2c2b,_0xacb574){_0x5d2c2b=_0x5d2c2b-0x0;var _0x206dc9=_0x7efe[_0x5d2c2b];return _0x206dc9;};'use strict';var BPromise=require(_0xe7ef('0x0'));var util=require('util');var _=require(_0xe7ef('0x1'));var squel=require('squel');var Redis=require(_0xe7ef('0x2'));var qs=require(_0xe7ef('0x3'));var logger=require('../../config/logger')(_0xe7ef('0x4'));var config=require(_0xe7ef('0x5'));var db=require(_0xe7ef('0x6'))['db'];config[_0xe7ef('0x7')]=_[_0xe7ef('0x8')](config[_0xe7ef('0x7')],{'host':_0xe7ef('0x9'),'port':0x18eb});var socket=require(_0xe7ef('0xa'))(new Redis(config[_0xe7ef('0x7')]));require(_0xe7ef('0xb'))[_0xe7ef('0xc')](socket);function respondWithStatusCode(_0x58a34b,_0x583b7c){_0x583b7c=_0x583b7c||0xcc;return function(_0x2cabfc){if(_0x2cabfc){return _0x58a34b['sendStatus'](_0x583b7c);}return _0x58a34b[_0xe7ef('0xd')](_0x583b7c)[_0xe7ef('0xe')]();};}function respondWithResult(_0x732646,_0x52c0f9){_0x52c0f9=_0x52c0f9||0xc8;return function(_0x61035c){if(_0x61035c){return _0x732646['status'](_0x52c0f9)[_0xe7ef('0xf')](_0x61035c);}};}function respondWithFilteredResult(_0x5a299b,_0xf3c9f9){return function(_0x11a2cf){if(_0x11a2cf){var _0x23348e=typeof _0xf3c9f9[_0xe7ef('0x10')]===_0xe7ef('0x11')&&typeof _0xf3c9f9[_0xe7ef('0x12')]===_0xe7ef('0x11');var _0x2927fb=_0x11a2cf['count'];var _0x356e3e=_0x23348e?0x0:_0xf3c9f9[_0xe7ef('0x10')];var _0x4ca7e6=_0x23348e?_0x11a2cf[_0xe7ef('0x13')]:_0xf3c9f9[_0xe7ef('0x10')]+_0xf3c9f9[_0xe7ef('0x12')];var _0x314a07;if(_0x4ca7e6>=_0x2927fb){_0x4ca7e6=_0x2927fb;_0x314a07=0xc8;}else{_0x314a07=0xce;}_0x5a299b[_0xe7ef('0xd')](_0x314a07);return _0x5a299b[_0xe7ef('0x14')](_0xe7ef('0x15'),_0x356e3e+'-'+_0x4ca7e6+'/'+_0x2927fb)['json'](_0x11a2cf);}return null;};}function saveUpdates(_0x2df72a){return function(_0x3a0894){if(_0x3a0894){return _0x3a0894[_0xe7ef('0x16')](_0x2df72a)[_0xe7ef('0x17')](function(_0x382028){return _0x382028;});}return null;};}function removeEntity(_0x27f42a){return function(_0x1e618d){if(_0x1e618d){return _0x1e618d[_0xe7ef('0x18')]()[_0xe7ef('0x17')](function(){var _0x24753a=_0x1e618d['get']({'plain':!![]});var _0x5dac9a=_0xe7ef('0x19');return db[_0xe7ef('0x1a')]['destroy']({'where':{'type':_0x5dac9a,'resourceId':_0x24753a['id']}})[_0xe7ef('0x17')](function(){return _0x1e618d;});})[_0xe7ef('0x17')](function(){_0x27f42a[_0xe7ef('0xd')](0xcc)[_0xe7ef('0xe')]();});}};}function handleEntityNotFound(_0x49ff89){return function(_0x21aed1){if(!_0x21aed1){_0x49ff89[_0xe7ef('0x1b')](0x194);}return _0x21aed1;};}function handleError(_0x452bf7,_0x330106){_0x330106=_0x330106||0x1f4;return function(_0x3e6cc8){logger[_0xe7ef('0x1c')](_0x3e6cc8[_0xe7ef('0x1d')]);if(_0x3e6cc8[_0xe7ef('0x1e')]){delete _0x3e6cc8[_0xe7ef('0x1e')];}_0x452bf7[_0xe7ef('0xd')](_0x330106)[_0xe7ef('0x1f')](_0x3e6cc8);};}exports[_0xe7ef('0x20')]=function(_0x3f9a60,_0x19cccf){var _0x46315d={};var _0x4bcc4d={'count':0x0,'rows':[]};var _0x5a8cc5=_[_0xe7ef('0x21')](db['MailQueue'][_0xe7ef('0x22')],function(_0x2bca63){return{'name':_0x2bca63[_0xe7ef('0x23')],'type':_0x2bca63[_0xe7ef('0x24')][_0xe7ef('0x25')]};});_0x46315d=qs[_0xe7ef('0x26')](_0x5a8cc5,_0x3f9a60);var _0x316436={'where':_0x46315d['where']};return db[_0xe7ef('0x27')][_0xe7ef('0x13')](_0x316436)['then'](function(_0x4de599){_0x4bcc4d[_0xe7ef('0x13')]=_0x4de599;_0x46315d[_0xe7ef('0x28')]=qs[_0xe7ef('0x28')](_0x3f9a60[_0xe7ef('0x29')]);return db[_0xe7ef('0x27')][_0xe7ef('0x2a')](_0x46315d);})[_0xe7ef('0x17')](function(_0x425aa4){_0x4bcc4d['rows']=_0x425aa4;return _0x4bcc4d;})[_0xe7ef('0x17')](respondWithFilteredResult(_0x19cccf,_0x46315d))['catch'](handleError(_0x19cccf,null));};exports[_0xe7ef('0x2b')]=function(_0x2e6eb4,_0x40eeec){var _0x597803={'raw':!![],'where':{'id':_0x2e6eb4[_0xe7ef('0x2c')]['id']}},_0x28c967={};_0x28c967[_0xe7ef('0x2d')]=_[_0xe7ef('0x2e')](db['MailQueue'][_0xe7ef('0x22')]);_0x28c967[_0xe7ef('0x29')]=_['keys'](_0x2e6eb4[_0xe7ef('0x29')]);_0x28c967[_0xe7ef('0x2f')]=_[_0xe7ef('0x30')](_0x28c967['model'],_0x28c967[_0xe7ef('0x29')]);_0x597803[_0xe7ef('0x31')]=_[_0xe7ef('0x30')](_0x28c967[_0xe7ef('0x2d')],qs[_0xe7ef('0x32')](_0x2e6eb4[_0xe7ef('0x29')]['fields']));_0x597803[_0xe7ef('0x31')]=_0x597803['attributes'][_0xe7ef('0x33')]?_0x597803[_0xe7ef('0x31')]:_0x28c967[_0xe7ef('0x2d')];if(_0x2e6eb4['query'][_0xe7ef('0x34')]){_0x597803['include']=[{'all':!![]}];}_0x597803=_['merge']({},_0x597803,_0x2e6eb4[_0xe7ef('0x35')]);return db[_0xe7ef('0x27')][_0xe7ef('0x36')](_0x597803)[_0xe7ef('0x17')](handleEntityNotFound(_0x40eeec,null))['then'](respondWithResult(_0x40eeec,null))[_0xe7ef('0x37')](handleError(_0x40eeec,null));};exports[_0xe7ef('0x38')]=function(_0x2ead91,_0x1c972d){return db[_0xe7ef('0x27')][_0xe7ef('0x38')](_0x2ead91[_0xe7ef('0x39')],{})[_0xe7ef('0x17')](function(_0x3aa314){var _0x267fc6=_0x2ead91[_0xe7ef('0x3a')][_0xe7ef('0x3b')]({'plain':!![]});if(!_0x267fc6)throw new Error(_0xe7ef('0x3c'));if(_0x267fc6[_0xe7ef('0x3d')]==='user'){var _0x165cee=_0x3aa314[_0xe7ef('0x3b')]({'plain':!![]});var _0x299b2a='MailQueues';return db[_0xe7ef('0x3e')][_0xe7ef('0x36')]({'where':{'name':_0x299b2a,'userProfileId':_0x267fc6[_0xe7ef('0x3f')]},'raw':!![]})[_0xe7ef('0x17')](function(_0x2d0f64){if(_0x2d0f64&&_0x2d0f64[_0xe7ef('0x40')]===0x0){return db['UserProfileResource']['create']({'name':_0x165cee[_0xe7ef('0x1e')],'resourceId':_0x165cee['id'],'type':_0x2d0f64['name'],'sectionId':_0x2d0f64['id']},{})['then'](function(){return _0x3aa314;});}else{return _0x3aa314;}})[_0xe7ef('0x37')](function(_0x18cbf9){logger['error'](_0xe7ef('0x41'),_0x18cbf9);throw _0x18cbf9;});}return _0x3aa314;})[_0xe7ef('0x17')](respondWithResult(_0x1c972d,0xc9))['catch'](handleError(_0x1c972d,null));};exports['update']=function(_0x3a419d,_0x45ef44){if(_0x3a419d[_0xe7ef('0x39')]['id']){delete _0x3a419d[_0xe7ef('0x39')]['id'];}return db[_0xe7ef('0x27')][_0xe7ef('0x36')]({'where':{'id':_0x3a419d['params']['id']}})[_0xe7ef('0x17')](handleEntityNotFound(_0x45ef44,null))[_0xe7ef('0x17')](saveUpdates(_0x3a419d[_0xe7ef('0x39')],null))[_0xe7ef('0x17')](respondWithResult(_0x45ef44,null))['catch'](handleError(_0x45ef44,null));};exports[_0xe7ef('0x18')]=function(_0x2e94ee,_0xa1e608){return db[_0xe7ef('0x27')][_0xe7ef('0x36')]({'where':{'id':_0x2e94ee[_0xe7ef('0x2c')]['id']}})[_0xe7ef('0x17')](handleEntityNotFound(_0xa1e608,null))[_0xe7ef('0x17')](removeEntity(_0xa1e608,null))[_0xe7ef('0x37')](handleError(_0xa1e608,null));};exports['describe']=function(_0x3485f0,_0x4271e7){return db[_0xe7ef('0x27')]['describe']()[_0xe7ef('0x17')](respondWithResult(_0x4271e7,null))[_0xe7ef('0x37')](handleError(_0x4271e7,null));};exports['getMembers']=function(_0x42dae9,_0x4c29bd){var _0x33f408={'raw':!![],'where':{}},_0x346b60={},_0x20fc0c;return db[_0xe7ef('0x27')][_0xe7ef('0x42')]({'where':{'id':_0x42dae9[_0xe7ef('0x2c')]['id']}})[_0xe7ef('0x17')](handleEntityNotFound(_0x4c29bd,null))['then'](function(_0x48c8de){if(_0x48c8de){_0x20fc0c=_0x48c8de['get']({'plain':!![]});_0x346b60[_0xe7ef('0x2d')]=_[_0xe7ef('0x2e')](db[_0xe7ef('0x43')][_0xe7ef('0x22')]);_0x346b60[_0xe7ef('0x29')]=_[_0xe7ef('0x2e')](_0x42dae9[_0xe7ef('0x29')]);_0x346b60[_0xe7ef('0x2f')]=_[_0xe7ef('0x30')](_0x346b60[_0xe7ef('0x2d')],_0x346b60['query']);_0x33f408['attributes']=_[_0xe7ef('0x30')](_0x346b60[_0xe7ef('0x2d')],qs['fields'](_0x42dae9[_0xe7ef('0x29')][_0xe7ef('0x32')]));_0x33f408[_0xe7ef('0x31')]=_0x33f408[_0xe7ef('0x31')][_0xe7ef('0x33')]?_0x33f408['attributes']:_0x346b60[_0xe7ef('0x2d')];if(!_0x42dae9[_0xe7ef('0x29')][_0xe7ef('0x44')](_0xe7ef('0x45'))){_0x33f408[_0xe7ef('0x12')]=qs[_0xe7ef('0x12')](_0x42dae9['query'][_0xe7ef('0x12')]);_0x33f408[_0xe7ef('0x10')]=qs[_0xe7ef('0x10')](_0x42dae9[_0xe7ef('0x29')][_0xe7ef('0x10')]);}_0x33f408[_0xe7ef('0x46')]=qs[_0xe7ef('0x47')](_0x42dae9[_0xe7ef('0x29')][_0xe7ef('0x47')]);_0x33f408['where']=qs[_0xe7ef('0x2f')](_[_0xe7ef('0x48')](_0x42dae9['query'],_0x346b60[_0xe7ef('0x2f')]));_0x33f408[_0xe7ef('0x49')][_0xe7ef('0x4a')]=_0x48c8de['id'];if(_0x42dae9[_0xe7ef('0x29')][_0xe7ef('0x4b')]){_0x33f408[_0xe7ef('0x49')]=_[_0xe7ef('0x4c')](_0x33f408[_0xe7ef('0x49')],{'$or':_[_0xe7ef('0x21')](_0x33f408[_0xe7ef('0x31')],function(_0x129a30){var _0x1f7fa8={};_0x1f7fa8[_0x129a30]={'$like':'%'+_0x42dae9['query']['filter']+'%'};return _0x1f7fa8;})});}_0x33f408=_[_0xe7ef('0x4c')]({},_0x33f408,_0x42dae9[_0xe7ef('0x35')]);return db['UserMailQueue'][_0xe7ef('0x2a')](_0x33f408);}})['then'](function(_0x3a2714){if(_0x3a2714){return db[_0xe7ef('0x4d')][_0xe7ef('0x4e')]({'where':{'id':_[_0xe7ef('0x21')](_0x3a2714,_0xe7ef('0x4f')),'role':_0xe7ef('0x50')},'attributes':['id',_0xe7ef('0x1e'),_0xe7ef('0x51'),_0xe7ef('0x52'),_0xe7ef('0x53')]});}})[_0xe7ef('0x17')](function(_0x562af2){if(_0x562af2){return{'count':_0x562af2[_0xe7ef('0x13')],'rows':_[_0xe7ef('0x21')](_0x562af2['rows'],function(_0x20afc4){return{'membername':_0x20afc4['name'],'UserId':_0x20afc4['id'],'queue_name':_0x20fc0c[_0xe7ef('0x1e')],'MailQueueId':_0x20fc0c['id'],'interface':util[_0xe7ef('0x54')](_0xe7ef('0x55'),_0xe7ef('0x56'),_0x20afc4[_0xe7ef('0x1e')]),'penalty':0x0,'paused':_0x20afc4[_0xe7ef('0x51')],'createdAt':_0x20afc4['createdAt'],'updatedAt':_0x20afc4[_0xe7ef('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4c29bd,_0x33f408))[_0xe7ef('0x37')](handleError(_0x4c29bd,null));};exports['getTeams']=function(_0x283ebd,_0x18c1ab){var _0xc8927f={};var _0x378aac={};var _0x30f7ac;var _0x564f2d;return db[_0xe7ef('0x27')][_0xe7ef('0x42')]({'where':{'id':_0x283ebd[_0xe7ef('0x2c')]['id']}})[_0xe7ef('0x17')](handleEntityNotFound(_0x18c1ab,null))[_0xe7ef('0x17')](function(_0x51f3c2){if(_0x51f3c2){_0x30f7ac=_0x51f3c2;_0x378aac[_0xe7ef('0x2d')]=_['keys'](db[_0xe7ef('0x57')][_0xe7ef('0x22')]);_0x378aac['query']=_[_0xe7ef('0x2e')](_0x283ebd[_0xe7ef('0x29')]);_0x378aac[_0xe7ef('0x2f')]=_['intersection'](_0x378aac[_0xe7ef('0x2d')],_0x378aac['query']);_0xc8927f[_0xe7ef('0x31')]=_['intersection'](_0x378aac[_0xe7ef('0x2d')],qs[_0xe7ef('0x32')](_0x283ebd['query']['fields']));_0xc8927f[_0xe7ef('0x31')]=_0xc8927f[_0xe7ef('0x31')][_0xe7ef('0x33')]?_0xc8927f[_0xe7ef('0x31')]:_0x378aac['model'];_0xc8927f[_0xe7ef('0x46')]=qs[_0xe7ef('0x47')](_0x283ebd[_0xe7ef('0x29')][_0xe7ef('0x47')]);_0xc8927f[_0xe7ef('0x49')]=qs['filters'](_['pick'](_0x283ebd[_0xe7ef('0x29')],_0x378aac[_0xe7ef('0x2f')]));if(_0x283ebd[_0xe7ef('0x29')][_0xe7ef('0x4b')]){_0xc8927f[_0xe7ef('0x49')]=_['merge'](_0xc8927f[_0xe7ef('0x49')],{'$or':_[_0xe7ef('0x21')](_0xc8927f['attributes'],function(_0x9b364c){var _0x37e431={};_0x37e431[_0x9b364c]={'$like':'%'+_0x283ebd[_0xe7ef('0x29')]['filter']+'%'};return _0x37e431;})});}_0xc8927f=_['merge']({},_0xc8927f,_0x283ebd[_0xe7ef('0x35')]);return _0x30f7ac[_0xe7ef('0x58')](_0xc8927f);}})[_0xe7ef('0x17')](function(_0x57482c){if(_0x57482c){_0x564f2d=_0x57482c['length'];if(!_0x283ebd[_0xe7ef('0x29')][_0xe7ef('0x44')](_0xe7ef('0x45'))){_0xc8927f['limit']=qs[_0xe7ef('0x12')](_0x283ebd['query'][_0xe7ef('0x12')]);_0xc8927f[_0xe7ef('0x10')]=qs[_0xe7ef('0x10')](_0x283ebd[_0xe7ef('0x29')][_0xe7ef('0x10')]);}return _0x30f7ac[_0xe7ef('0x58')](_0xc8927f);}})[_0xe7ef('0x17')](function(_0x4fbcfc){if(_0x4fbcfc){return _0x4fbcfc?{'count':_0x564f2d,'rows':_0x4fbcfc}:null;}})[_0xe7ef('0x17')](respondWithResult(_0x18c1ab,null))[_0xe7ef('0x37')](handleError(_0x18c1ab,null));};exports[_0xe7ef('0x59')]=function(_0xf103c8,_0x19394c){var _0x661105=_0xf103c8['body']['ids'];return db['Team'][_0xe7ef('0x2a')]({'where':{'id':_0x661105},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe7ef('0x5a'),'attributes':['id',_0xe7ef('0x1e'),'online',_0xe7ef('0x5b'),_0xe7ef('0x5c')],'raw':!![]}]})[_0xe7ef('0x17')](function(_0x3edc4e){if(_0x3edc4e){var _0x1e5554=_[_0xe7ef('0x5d')](_0x3edc4e,function(_0x1f36f9){var _0x15b9ad=_0x1f36f9[_0xe7ef('0x3b')]({'plain':!![]});return _0x15b9ad[_0xe7ef('0x5a')];});return db['MailQueue'][_0xe7ef('0x36')]({'where':{'id':_0xf103c8[_0xe7ef('0x2c')]['id']}})[_0xe7ef('0x17')](function(_0x350929){return db[_0xe7ef('0x5e')][_0xe7ef('0x5f')](function(_0x358d49){return _0x350929['addTeams'](_0x661105,{'transaction':_0x358d49})[_0xe7ef('0x17')](function(){return BPromise[_0xe7ef('0x60')](_0x1e5554,function(_0x16d69a){return db[_0xe7ef('0x43')][_0xe7ef('0x61')]({'where':{'UserId':_0x16d69a['id'],'MailQueueId':_0xf103c8['params']['id']},'transaction':_0x358d49});});})[_0xe7ef('0x17')](function(){_0x1e5554[_0xe7ef('0x62')](function(_0xff6328){socket['emit'](_0xe7ef('0x63'),{'UserId':_0xff6328['id'],'MailQueueId':_0x350929['id']});});});});});}})['then'](respondWithStatusCode(_0x19394c,null))[_0xe7ef('0x37')](handleError(_0x19394c,null));};exports['removeTeams']=function(_0x30eb26,_0x472184){return db[_0xe7ef('0x57')][_0xe7ef('0x2a')]({'where':{'id':_0x30eb26[_0xe7ef('0x29')][_0xe7ef('0x64')]},'attributes':['id'],'include':[{'model':db[_0xe7ef('0x4d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe7ef('0x17')](handleEntityNotFound(_0x472184,null))[_0xe7ef('0x17')](function(_0x15a4bc){var _0x5b19fa=_[_0xe7ef('0x21')](_0x15a4bc,'id');var _0x1475db=[];var _0x56b001=[];var _0x2a8c02=squel[_0xe7ef('0x65')]();_0x2a8c02[_0xe7ef('0x66')](_0xe7ef('0x67'))[_0xe7ef('0x68')]('team_has_mail_queues','tq')[_0xe7ef('0x69')](_0xe7ef('0x6a'),'ut',_0xe7ef('0x6b'))[_0xe7ef('0x49')](_0xe7ef('0x6c'),_0x30eb26[_0xe7ef('0x2c')]['id']);for(var _0x5741a8=0x0;_0x5741a8<_0x15a4bc['length'];_0x5741a8+=0x1){let _0x1a56c9=_0x15a4bc[_0x5741a8];for(var _0x228d6f=0x0;_0x228d6f<_0x1a56c9[_0xe7ef('0x5a')]['length'];_0x228d6f+=0x1){let _0x2d7fa1=_0x1a56c9[_0xe7ef('0x5a')][_0x228d6f];var _0x2387bc=_0x2a8c02[_0xe7ef('0x6d')]();_0x2387bc[_0xe7ef('0x49')](_0xe7ef('0x6e'),_0x2d7fa1['id']);_0x56b001['push'](db['sequelize'][_0xe7ef('0x29')](_0x2387bc[_0xe7ef('0x6f')](),{'type':db['sequelize'][_0xe7ef('0x70')]['SELECT']})['then'](function(_0x233c90){if(_0x233c90[_0xe7ef('0x33')]===0x1){return _0x2d7fa1['id'];}else{var _0x439915=_[_0xe7ef('0x71')](_[_0xe7ef('0x21')](_0x233c90,_0xe7ef('0x72')),function(_0x310567){return _[_0xe7ef('0x73')](_0x5b19fa,_0x310567);});if(_0x439915){return _0x2d7fa1['id'];}}}));}}return BPromise[_0xe7ef('0x74')](_0x56b001)[_0xe7ef('0x17')](function(_0x11b185){_0x1475db=_(_0x1475db)[_0xe7ef('0x75')](_0x11b185)[_0xe7ef('0x76')]()[_0xe7ef('0x77')]();return db['MailQueue'][_0xe7ef('0x36')]({'where':{'id':_0x30eb26[_0xe7ef('0x2c')]['id']}})[_0xe7ef('0x17')](function(_0x3f9692){return db[_0xe7ef('0x5e')][_0xe7ef('0x5f')](function(_0x198184){return _0x3f9692[_0xe7ef('0x78')](_0x30eb26['query'][_0xe7ef('0x64')],{'transaction':_0x198184})[_0xe7ef('0x17')](function(){if(!_[_0xe7ef('0x79')](_0x1475db)){return _0x3f9692[_0xe7ef('0x7a')](_0x1475db,{'transaction':_0x198184});}})['then'](function(){_0x1475db[_0xe7ef('0x62')](function(_0x4cef8a){socket[_0xe7ef('0x7b')](_0xe7ef('0x7c'),{'UserId':_0x4cef8a,'MailQueueId':_0x3f9692['id']});});});});});});})[_0xe7ef('0x17')](respondWithStatusCode(_0x472184,null))[_0xe7ef('0x37')](handleError(_0x472184,null));};exports[_0xe7ef('0x7d')]=function(_0x256915,_0x344f58){return db[_0xe7ef('0x27')][_0xe7ef('0x36')]({'where':{'id':_0x256915[_0xe7ef('0x2c')]['id']}})['then'](handleEntityNotFound(_0x344f58,null))[_0xe7ef('0x17')](function(_0xd2eede){if(_0xd2eede){return _0xd2eede[_0xe7ef('0x7d')](_0x256915['body'][_0xe7ef('0x64')],_[_0xe7ef('0x7e')](_0x256915[_0xe7ef('0x39')],['ids','id'])||{})['spread'](function(_0x6a15f0){for(var _0x95f7f9=0x0;_0x95f7f9<_0x256915[_0xe7ef('0x39')][_0xe7ef('0x64')]['length'];_0x95f7f9+=0x1){socket[_0xe7ef('0x7b')](_0xe7ef('0x63'),{'UserId':Number(_0x256915[_0xe7ef('0x39')]['ids'][_0x95f7f9]),'MailQueueId':Number(_0x256915[_0xe7ef('0x2c')]['id'])});}return _0x6a15f0;});}})[_0xe7ef('0x17')](respondWithResult(_0x344f58,null))[_0xe7ef('0x37')](handleError(_0x344f58,null));};exports[_0xe7ef('0x7a')]=function(_0x2c6b93,_0x599bdd){return db[_0xe7ef('0x27')][_0xe7ef('0x36')]({'where':{'id':_0x2c6b93[_0xe7ef('0x2c')]['id']}})[_0xe7ef('0x17')](handleEntityNotFound(_0x599bdd,null))[_0xe7ef('0x17')](function(_0x29c80a){if(_0x29c80a){return _0x29c80a['removeAgents'](_0x2c6b93['query'][_0xe7ef('0x64')])[_0xe7ef('0x17')](function(){if(_[_0xe7ef('0x7f')](_0x2c6b93[_0xe7ef('0x29')][_0xe7ef('0x64')])){for(var _0x23d48c=0x0;_0x23d48c<_0x2c6b93[_0xe7ef('0x29')]['ids'][_0xe7ef('0x33')];_0x23d48c+=0x1){socket[_0xe7ef('0x7b')](_0xe7ef('0x7c'),{'UserId':Number(_0x2c6b93[_0xe7ef('0x29')][_0xe7ef('0x64')][_0x23d48c]),'MailQueueId':Number(_0x2c6b93[_0xe7ef('0x2c')]['id'])});}}else{socket[_0xe7ef('0x7b')](_0xe7ef('0x7c'),{'UserId':Number(_0x2c6b93[_0xe7ef('0x29')]['ids']),'MailQueueId':Number(_0x2c6b93[_0xe7ef('0x2c')]['id'])});}});}})[_0xe7ef('0x17')](respondWithStatusCode(_0x599bdd,null))['catch'](handleError(_0x599bdd,null));};exports[_0xe7ef('0x80')]=function(_0x8fe05f,_0x38b31e){var _0x205d08={};var _0x2568e8={};var _0x353a0c;var _0x52ee77;return db['MailQueue'][_0xe7ef('0x42')]({'where':{'id':_0x8fe05f[_0xe7ef('0x2c')]['id']}})[_0xe7ef('0x17')](handleEntityNotFound(_0x38b31e,null))[_0xe7ef('0x17')](function(_0x244ddf){if(_0x244ddf){_0x353a0c=_0x244ddf;_0x2568e8[_0xe7ef('0x2d')]=_[_0xe7ef('0x2e')](db[_0xe7ef('0x4d')]['rawAttributes']);_0x2568e8[_0xe7ef('0x29')]=_[_0xe7ef('0x2e')](_0x8fe05f['query']);_0x2568e8[_0xe7ef('0x2f')]=_[_0xe7ef('0x30')](_0x2568e8[_0xe7ef('0x2d')],_0x2568e8[_0xe7ef('0x29')]);_0x205d08[_0xe7ef('0x31')]=_[_0xe7ef('0x30')](_0x2568e8[_0xe7ef('0x2d')],qs[_0xe7ef('0x32')](_0x8fe05f['query'][_0xe7ef('0x32')]));_0x205d08['attributes']=_0x205d08['attributes'][_0xe7ef('0x33')]?_0x205d08[_0xe7ef('0x31')]:_0x2568e8[_0xe7ef('0x2d')];_0x205d08[_0xe7ef('0x46')]=qs[_0xe7ef('0x47')](_0x8fe05f['query'][_0xe7ef('0x47')]);_0x205d08['where']=qs[_0xe7ef('0x2f')](_[_0xe7ef('0x48')](_0x8fe05f[_0xe7ef('0x29')],_0x2568e8[_0xe7ef('0x2f')]));if(_0x8fe05f[_0xe7ef('0x29')][_0xe7ef('0x4b')]){_0x205d08[_0xe7ef('0x49')]=_[_0xe7ef('0x4c')](_0x205d08[_0xe7ef('0x49')],{'$or':_['map'](_0x205d08[_0xe7ef('0x31')],function(_0x51dbc4){var _0xa9f806={};_0xa9f806[_0x51dbc4]={'$like':'%'+_0x8fe05f[_0xe7ef('0x29')][_0xe7ef('0x4b')]+'%'};return _0xa9f806;})});}_0x205d08=_[_0xe7ef('0x4c')]({},_0x205d08,_0x8fe05f['options']);return _0x353a0c[_0xe7ef('0x80')](_0x205d08);}})[_0xe7ef('0x17')](function(_0x5d9812){if(_0x5d9812){_0x52ee77=_0x5d9812[_0xe7ef('0x33')];if(!_0x8fe05f[_0xe7ef('0x29')][_0xe7ef('0x44')](_0xe7ef('0x45'))){_0x205d08[_0xe7ef('0x12')]=qs[_0xe7ef('0x12')](_0x8fe05f['query']['limit']);_0x205d08[_0xe7ef('0x10')]=qs[_0xe7ef('0x10')](_0x8fe05f[_0xe7ef('0x29')][_0xe7ef('0x10')]);}return _0x353a0c[_0xe7ef('0x80')](_0x205d08);}})[_0xe7ef('0x17')](function(_0x2b8a25){if(_0x2b8a25){return _0x2b8a25?{'count':_0x52ee77,'rows':_0x2b8a25}:null;}})[_0xe7ef('0x17')](respondWithResult(_0x38b31e,null))[_0xe7ef('0x37')](handleError(_0x38b31e,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 767e1ee..0e256d9 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 _0x31a3=['emit','hook','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31a3,0xe6));var _0x331a=function(_0x119ec0,_0x206327){_0x119ec0=_0x119ec0-0x0;var _0x56f82b=_0x31a3[_0x119ec0];return _0x56f82b;};'use strict';var EventEmitter=require(_0x331a('0x0'));var MailQueue=require(_0x331a('0x1'))['db'][_0x331a('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x331a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x16ede9){return function(_0x3826d8,_0x14fd53,_0x33bd8a){MailQueueEvents['emit'](_0x16ede9+':'+_0x3826d8['id'],_0x3826d8);MailQueueEvents[_0x331a('0x4')](_0x16ede9,_0x3826d8);_0x33bd8a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x331a('0x5')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x7cc2=['../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','events'];(function(_0xf912a,_0x533423){var _0x348f59=function(_0x2c1aa4){while(--_0x2c1aa4){_0xf912a['push'](_0xf912a['shift']());}};_0x348f59(++_0x533423);}(_0x7cc2,0x1c7));var _0x27cc=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x7cc2[_0x4fbfd9];return _0x31dc94;};'use strict';var EventEmitter=require(_0x27cc('0x0'));var MailQueue=require(_0x27cc('0x1'))['db'][_0x27cc('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x27cc('0x3')](0x0);var events={'afterCreate':_0x27cc('0x4'),'afterUpdate':_0x27cc('0x5'),'afterDestroy':_0x27cc('0x6')};function emitEvent(_0x68c708){return function(_0x5728ee,_0x362bd6,_0x4f6b54){MailQueueEvents[_0x27cc('0x7')](_0x68c708+':'+_0x5728ee['id'],_0x5728ee);MailQueueEvents[_0x27cc('0x7')](_0x68c708,_0x5728ee);_0x4f6b54(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 204e0a3..fc27b93 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 _0xba15=['request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','moment','bluebird'];(function(_0x2eeca0,_0x516de3){var _0x4de5c8=function(_0x554dc8){while(--_0x554dc8){_0x2eeca0['push'](_0x2eeca0['shift']());}};_0x4de5c8(++_0x516de3);}(_0xba15,0x134));var _0x5ba1=function(_0x21ba7f,_0x45cfc2){_0x21ba7f=_0x21ba7f-0x0;var _0x3f2dc2=_0xba15[_0x21ba7f];return _0x3f2dc2;};'use strict';var _=require(_0x5ba1('0x0'));var util=require(_0x5ba1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5ba1('0x2'));var BPromise=require(_0x5ba1('0x3'));var rp=require(_0x5ba1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ba1('0x5'));var config=require(_0x5ba1('0x6'));var attributes=require(_0x5ba1('0x7'));module[_0x5ba1('0x8')]=function(_0x2a013d,_0x416580){return _0x2a013d[_0x5ba1('0x9')](_0x5ba1('0xa'),attributes,{'tableName':_0x5ba1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5173=['exports','define','MailQueue','util','api','moment','bluebird','path'];(function(_0x5b443d,_0x3beeaa){var _0x2f3099=function(_0x1b0068){while(--_0x1b0068){_0x5b443d['push'](_0x5b443d['shift']());}};_0x2f3099(++_0x3beeaa);}(_0x5173,0x1a3));var _0x3517=function(_0x4427a4,_0x2f71cc){_0x4427a4=_0x4427a4-0x0;var _0x3291e0=_0x5173[_0x4427a4];return _0x3291e0;};'use strict';var _=require('lodash');var util=require(_0x3517('0x0'));var logger=require('../../config/logger')(_0x3517('0x1'));var moment=require(_0x3517('0x2'));var BPromise=require(_0x3517('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3517('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x3517('0x5')]=function(_0x37ba3c,_0x54a52b){return _0x37ba3c[_0x3517('0x6')](_0x3517('0x7'),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 2b74e5a..c8802d6 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 _0x0c08=['error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue','MailQueue','options','attributes','include','map','model','find','raw','where','ShowMailQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','request\x20sent','stringify'];(function(_0x37e125,_0x7dcb21){var _0x2d187d=function(_0x10205c){while(--_0x10205c){_0x37e125['push'](_0x37e125['shift']());}};_0x2d187d(++_0x7dcb21);}(_0x0c08,0x1e6));var _0x80c0=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x0c08[_0x999b85];return _0x1d7124;};'use strict';var _=require(_0x80c0('0x0'));var util=require(_0x80c0('0x1'));var moment=require('moment');var BPromise=require(_0x80c0('0x2'));var rs=require(_0x80c0('0x3'));var fs=require('fs');var Redis=require(_0x80c0('0x4'));var db=require(_0x80c0('0x5'))['db'];var utils=require(_0x80c0('0x6'));var logger=require('../../config/logger')(_0x80c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x80c0('0x8'));var client=jayson[_0x80c0('0x9')]['http']({'port':0x232a});config[_0x80c0('0xa')]=_[_0x80c0('0xb')](config[_0x80c0('0xa')],{'host':_0x80c0('0xc'),'port':0x18eb});var socket=require(_0x80c0('0xd'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x80c0('0xe')](socket);function respondWithRpcPromise(_0x856b47,_0x28496c,_0x2cc13f){return new BPromise(function(_0x259637,_0x297a59){return client['request'](_0x856b47,_0x2cc13f)[_0x80c0('0xf')](function(_0x30baa0){logger['info']('MailQueue,\x20%s,\x20%s',_0x28496c,_0x80c0('0x10'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x28496c,'request\x20sent',JSON[_0x80c0('0x11')](_0x30baa0));if(_0x30baa0[_0x80c0('0x12')]){if(_0x30baa0[_0x80c0('0x12')][_0x80c0('0x13')]===0x1f4){logger[_0x80c0('0x12')](_0x80c0('0x14'),_0x28496c,_0x30baa0[_0x80c0('0x12')][_0x80c0('0x15')]);return _0x297a59(_0x30baa0[_0x80c0('0x12')][_0x80c0('0x15')]);}logger[_0x80c0('0x12')](_0x80c0('0x14'),_0x28496c,_0x30baa0['error'][_0x80c0('0x15')]);return _0x259637(_0x30baa0[_0x80c0('0x12')][_0x80c0('0x15')]);}else{logger[_0x80c0('0x16')]('MailQueue,\x20%s,\x20%s',_0x28496c,_0x80c0('0x10'));_0x259637(_0x30baa0[_0x80c0('0x17')]['message']);}})[_0x80c0('0x18')](function(_0x4146d4){logger['error'](_0x80c0('0x14'),_0x28496c,_0x4146d4);_0x297a59(_0x4146d4);});});}exports[_0x80c0('0x19')]=function(_0x19ac32){var _0x3d4026=this;return new Promise(function(_0x5cee69,_0x3aca93){return db[_0x80c0('0x1a')]['findAll']({'raw':_0x19ac32[_0x80c0('0x1b')]?_0x19ac32[_0x80c0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x19ac32[_0x80c0('0x1b')]?_0x19ac32[_0x80c0('0x1b')]['where']||null:null,'attributes':_0x19ac32[_0x80c0('0x1b')]?_0x19ac32['options'][_0x80c0('0x1c')]||null:null,'limit':_0x19ac32[_0x80c0('0x1b')]?_0x19ac32['options']['limit']||null:null,'include':_0x19ac32['options']?_0x19ac32['options'][_0x80c0('0x1d')]?_[_0x80c0('0x1e')](_0x19ac32['options'][_0x80c0('0x1d')],function(_0x4851aa){return{'model':db[_0x4851aa[_0x80c0('0x1f')]],'as':_0x4851aa['as'],'attributes':_0x4851aa[_0x80c0('0x1c')],'include':_0x4851aa[_0x80c0('0x1d')]?_[_0x80c0('0x1e')](_0x4851aa[_0x80c0('0x1d')],function(_0x482929){return{'model':db[_0x482929['model']],'as':_0x482929['as'],'attributes':_0x482929['attributes'],'include':_0x482929[_0x80c0('0x1d')]?_[_0x80c0('0x1e')](_0x482929[_0x80c0('0x1d')],function(_0x291fed){return{'model':db[_0x291fed['model']],'as':_0x291fed['as'],'attributes':_0x291fed[_0x80c0('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x531c46){logger[_0x80c0('0x16')](_0x80c0('0x19'),_0x19ac32);logger['debug'](_0x80c0('0x19'),_0x19ac32,JSON[_0x80c0('0x11')](_0x531c46));_0x5cee69(_0x531c46);})[_0x80c0('0x18')](function(_0x53a9c3){logger['error'](_0x80c0('0x19'),_0x53a9c3[_0x80c0('0x15')],_0x19ac32);_0x3aca93(_0x3d4026[_0x80c0('0x12')](0x1f4,_0x53a9c3[_0x80c0('0x15')]));});});};exports['ShowMailQueue']=function(_0x593b42){var _0x36decd=this;return new Promise(function(_0x330bf2,_0x323458){return db['MailQueue'][_0x80c0('0x20')]({'raw':_0x593b42[_0x80c0('0x1b')]?_0x593b42[_0x80c0('0x1b')][_0x80c0('0x21')]===undefined?!![]:![]:!![],'where':_0x593b42[_0x80c0('0x1b')]?_0x593b42[_0x80c0('0x1b')][_0x80c0('0x22')]||null:null,'attributes':_0x593b42[_0x80c0('0x1b')]?_0x593b42[_0x80c0('0x1b')][_0x80c0('0x1c')]||null:null,'include':_0x593b42['options']?_0x593b42['options'][_0x80c0('0x1d')]?_[_0x80c0('0x1e')](_0x593b42[_0x80c0('0x1b')]['include'],function(_0x1b5944){return{'model':db[_0x1b5944['model']],'as':_0x1b5944['as'],'attributes':_0x1b5944[_0x80c0('0x1c')],'include':_0x1b5944[_0x80c0('0x1d')]?_[_0x80c0('0x1e')](_0x1b5944['include'],function(_0x513e60){return{'model':db[_0x513e60[_0x80c0('0x1f')]],'as':_0x513e60['as'],'attributes':_0x513e60['attributes'],'include':_0x513e60[_0x80c0('0x1d')]?_['map'](_0x513e60[_0x80c0('0x1d')],function(_0x2c4d03){return{'model':db[_0x2c4d03[_0x80c0('0x1f')]],'as':_0x2c4d03['as'],'attributes':_0x2c4d03[_0x80c0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x80c0('0xf')](function(_0x1320d3){logger[_0x80c0('0x16')](_0x80c0('0x23'),_0x593b42);logger['debug']('ShowMailQueue',_0x593b42,JSON[_0x80c0('0x11')](_0x1320d3));_0x330bf2(_0x1320d3);})[_0x80c0('0x18')](function(_0x1ca489){logger[_0x80c0('0x12')](_0x80c0('0x23'),_0x1ca489[_0x80c0('0x15')],_0x593b42);_0x323458(_0x36decd['error'](0x1f4,_0x1ca489[_0x80c0('0x15')]));});});}; \ No newline at end of file +var _0x2504=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailQueue.socket','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','where','attributes','include','map','model','GetMailQueue','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2504,0xee));var _0x4250=function(_0x9dd605,_0x4b7014){_0x9dd605=_0x9dd605-0x0;var _0x51038c=_0x2504[_0x9dd605];return _0x51038c;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var moment=require(_0x4250('0x2'));var BPromise=require(_0x4250('0x3'));var rs=require(_0x4250('0x4'));var fs=require('fs');var Redis=require(_0x4250('0x5'));var db=require(_0x4250('0x6'))['db'];var utils=require(_0x4250('0x7'));var logger=require(_0x4250('0x8'))(_0x4250('0x9'));var config=require(_0x4250('0xa'));var jayson=require(_0x4250('0xb'));var client=jayson['client'][_0x4250('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4250('0xd')],{'host':_0x4250('0xe'),'port':0x18eb});var socket=require(_0x4250('0xf'))(new Redis(config[_0x4250('0xd')]));require(_0x4250('0x10'))['register'](socket);function respondWithRpcPromise(_0x1016b9,_0x49bf26,_0x2de8a7){return new BPromise(function(_0x2ff5ca,_0x55a792){return client[_0x4250('0x11')](_0x1016b9,_0x2de8a7)['then'](function(_0x535015){logger[_0x4250('0x12')](_0x4250('0x13'),_0x49bf26,_0x4250('0x14'));logger[_0x4250('0x15')](_0x4250('0x16'),_0x49bf26,'request\x20sent',JSON[_0x4250('0x17')](_0x535015));if(_0x535015[_0x4250('0x18')]){if(_0x535015[_0x4250('0x18')][_0x4250('0x19')]===0x1f4){logger[_0x4250('0x18')](_0x4250('0x13'),_0x49bf26,_0x535015['error'][_0x4250('0x1a')]);return _0x55a792(_0x535015[_0x4250('0x18')][_0x4250('0x1a')]);}logger[_0x4250('0x18')](_0x4250('0x13'),_0x49bf26,_0x535015[_0x4250('0x18')][_0x4250('0x1a')]);return _0x2ff5ca(_0x535015['error'][_0x4250('0x1a')]);}else{logger[_0x4250('0x12')](_0x4250('0x13'),_0x49bf26,_0x4250('0x14'));_0x2ff5ca(_0x535015[_0x4250('0x1b')][_0x4250('0x1a')]);}})[_0x4250('0x1c')](function(_0x508bc3){logger[_0x4250('0x18')]('MailQueue,\x20%s,\x20%s',_0x49bf26,_0x508bc3);_0x55a792(_0x508bc3);});});}exports['GetMailQueue']=function(_0x2c7d1c){var _0x3c8325=this;return new Promise(function(_0x5b7e7f,_0x42c331){return db[_0x4250('0x1d')][_0x4250('0x1e')]({'raw':_0x2c7d1c[_0x4250('0x1f')]?_0x2c7d1c[_0x4250('0x1f')][_0x4250('0x20')]===undefined?!![]:![]:!![],'where':_0x2c7d1c[_0x4250('0x1f')]?_0x2c7d1c[_0x4250('0x1f')][_0x4250('0x21')]||null:null,'attributes':_0x2c7d1c['options']?_0x2c7d1c[_0x4250('0x1f')][_0x4250('0x22')]||null:null,'limit':_0x2c7d1c[_0x4250('0x1f')]?_0x2c7d1c['options']['limit']||null:null,'include':_0x2c7d1c[_0x4250('0x1f')]?_0x2c7d1c[_0x4250('0x1f')][_0x4250('0x23')]?_[_0x4250('0x24')](_0x2c7d1c[_0x4250('0x1f')]['include'],function(_0x431d01){return{'model':db[_0x431d01[_0x4250('0x25')]],'as':_0x431d01['as'],'attributes':_0x431d01[_0x4250('0x22')],'include':_0x431d01['include']?_['map'](_0x431d01[_0x4250('0x23')],function(_0x5d0fa2){return{'model':db[_0x5d0fa2[_0x4250('0x25')]],'as':_0x5d0fa2['as'],'attributes':_0x5d0fa2[_0x4250('0x22')],'include':_0x5d0fa2[_0x4250('0x23')]?_[_0x4250('0x24')](_0x5d0fa2[_0x4250('0x23')],function(_0x501c5f){return{'model':db[_0x501c5f[_0x4250('0x25')]],'as':_0x501c5f['as'],'attributes':_0x501c5f[_0x4250('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e1c91){logger['info'](_0x4250('0x26'),_0x2c7d1c);logger['debug']('GetMailQueue',_0x2c7d1c,JSON[_0x4250('0x17')](_0x2e1c91));_0x5b7e7f(_0x2e1c91);})['catch'](function(_0x16b8a4){logger[_0x4250('0x18')]('GetMailQueue',_0x16b8a4[_0x4250('0x1a')],_0x2c7d1c);_0x42c331(_0x3c8325[_0x4250('0x18')](0x1f4,_0x16b8a4['message']));});});};exports[_0x4250('0x27')]=function(_0x34d17c){var _0x4a346e=this;return new Promise(function(_0x18d41d,_0x1c2756){return db[_0x4250('0x1d')][_0x4250('0x28')]({'raw':_0x34d17c[_0x4250('0x1f')]?_0x34d17c[_0x4250('0x1f')][_0x4250('0x20')]===undefined?!![]:![]:!![],'where':_0x34d17c[_0x4250('0x1f')]?_0x34d17c[_0x4250('0x1f')][_0x4250('0x21')]||null:null,'attributes':_0x34d17c[_0x4250('0x1f')]?_0x34d17c[_0x4250('0x1f')][_0x4250('0x22')]||null:null,'include':_0x34d17c['options']?_0x34d17c[_0x4250('0x1f')]['include']?_[_0x4250('0x24')](_0x34d17c[_0x4250('0x1f')]['include'],function(_0xf14c4e){return{'model':db[_0xf14c4e[_0x4250('0x25')]],'as':_0xf14c4e['as'],'attributes':_0xf14c4e[_0x4250('0x22')],'include':_0xf14c4e[_0x4250('0x23')]?_['map'](_0xf14c4e['include'],function(_0x589c15){return{'model':db[_0x589c15[_0x4250('0x25')]],'as':_0x589c15['as'],'attributes':_0x589c15[_0x4250('0x22')],'include':_0x589c15['include']?_[_0x4250('0x24')](_0x589c15[_0x4250('0x23')],function(_0x3f2ef7){return{'model':db[_0x3f2ef7[_0x4250('0x25')]],'as':_0x3f2ef7['as'],'attributes':_0x3f2ef7[_0x4250('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16f3f3){logger['info']('ShowMailQueue',_0x34d17c);logger[_0x4250('0x15')]('ShowMailQueue',_0x34d17c,JSON[_0x4250('0x17')](_0x16f3f3));_0x18d41d(_0x16f3f3);})[_0x4250('0x1c')](function(_0x3e6121){logger['error'](_0x4250('0x27'),_0x3e6121[_0x4250('0x1a')],_0x34d17c);_0x1c2756(_0x4a346e[_0x4250('0x18')](0x1f4,_0x3e6121[_0x4250('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 88ac032..96e3a2f 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 _0x80bd=['remove','update','emit','length','mailQueue:','./mailQueue.events','save'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x80bd,0x16a));var _0xd80b=function(_0x477c6c,_0x412021){_0x477c6c=_0x477c6c-0x0;var _0x118717=_0x80bd[_0x477c6c];return _0x118717;};'use strict';var MailQueueEvents=require(_0xd80b('0x0'));var events=[_0xd80b('0x1'),_0xd80b('0x2'),_0xd80b('0x3')];function createListener(_0x2adb19,_0x5d28fb){return function(_0x41f89b){_0x5d28fb[_0xd80b('0x4')](_0x2adb19,_0x41f89b);};}function removeListener(_0x14e461,_0x48d1eb){return function(){MailQueueEvents['removeListener'](_0x14e461,_0x48d1eb);};}exports['register']=function(_0x35f63f){for(var _0x59e964=0x0,_0x1827db=events[_0xd80b('0x5')];_0x59e964<_0x1827db;_0x59e964++){var _0x280f03=events[_0x59e964];var _0x4fb7aa=createListener(_0xd80b('0x6')+_0x280f03,_0x35f63f);MailQueueEvents['on'](_0x280f03,_0x4fb7aa);}}; \ No newline at end of file +var _0xe4a4=['emit','removeListener','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x41a5c9,_0x485f73){var _0xe84bbc=function(_0x4f439e){while(--_0x4f439e){_0x41a5c9['push'](_0x41a5c9['shift']());}};_0xe84bbc(++_0x485f73);}(_0xe4a4,0x11b));var _0x4e4a=function(_0x59c294,_0x546ef3){_0x59c294=_0x59c294-0x0;var _0x330ccf=_0xe4a4[_0x59c294];return _0x330ccf;};'use strict';var MailQueueEvents=require(_0x4e4a('0x0'));var events=[_0x4e4a('0x1'),_0x4e4a('0x2'),_0x4e4a('0x3')];function createListener(_0x52173b,_0x238268){return function(_0x8b3d51){_0x238268[_0x4e4a('0x4')](_0x52173b,_0x8b3d51);};}function removeListener(_0x1c0b05,_0x3ebb0b){return function(){MailQueueEvents[_0x4e4a('0x5')](_0x1c0b05,_0x3ebb0b);};}exports['register']=function(_0x1b8115){for(var _0x2adc15=0x0,_0x58a239=events['length'];_0x2adc15<_0x58a239;_0x2adc15++){var _0x291600=events[_0x2adc15];var _0x7aeb32=createListener(_0x4e4a('0x6')+_0x291600,_0x1b8115);MailQueueEvents['on'](_0x291600,_0x7aeb32);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 3c5900a..2cf9c10 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 _0xb6ee=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','destroy','exports','multer'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xb6ee,0x1b7));var _0xeb6e=function(_0x1d2f12,_0x5e9868){_0x1d2f12=_0x1d2f12-0x0;var _0x149f38=_0xb6ee[_0x1d2f12];return _0x149f38;};'use strict';var multer=require(_0xeb6e('0x0'));var util=require(_0xeb6e('0x1'));var path=require(_0xeb6e('0x2'));var timeout=require(_0xeb6e('0x3'));var express=require(_0xeb6e('0x4'));var router=express['Router']();var fs_extra=require(_0xeb6e('0x5'));var auth=require(_0xeb6e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb6e('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0xeb6e('0x8')](),controller[_0xeb6e('0x9')]);router[_0xeb6e('0xa')](_0xeb6e('0xb'),auth['isAuthenticated'](),controller[_0xeb6e('0xc')]);router['get'](_0xeb6e('0xd'),auth[_0xeb6e('0x8')](),controller[_0xeb6e('0xe')]);router['post']('/',auth[_0xeb6e('0x8')](),controller[_0xeb6e('0xf')]);router[_0xeb6e('0x10')](_0xeb6e('0xd'),auth[_0xeb6e('0x8')](),controller[_0xeb6e('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xeb6e('0x12')]);module[_0xeb6e('0x13')]=router; \ No newline at end of file +var _0xfae6=['update','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','create','put','/:id'];(function(_0x4b853f,_0x5abf56){var _0xbdf7ee=function(_0x2d519a){while(--_0x2d519a){_0x4b853f['push'](_0x4b853f['shift']());}};_0xbdf7ee(++_0x5abf56);}(_0xfae6,0x120));var _0x6fae=function(_0x282da5,_0x3e4a0d){_0x282da5=_0x282da5-0x0;var _0x3e9589=_0xfae6[_0x282da5];return _0x3e9589;};'use strict';var multer=require(_0x6fae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6fae('0x1'));var express=require('express');var router=express[_0x6fae('0x2')]();var fs_extra=require(_0x6fae('0x3'));var auth=require(_0x6fae('0x4'));var interaction=require(_0x6fae('0x5'));var config=require(_0x6fae('0x6'));var controller=require(_0x6fae('0x7'));router[_0x6fae('0x8')]('/',auth['isAuthenticated'](),controller[_0x6fae('0x9')]);router[_0x6fae('0x8')](_0x6fae('0xa'),auth[_0x6fae('0xb')](),controller[_0x6fae('0xc')]);router[_0x6fae('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6fae('0xb')](),controller[_0x6fae('0xd')]);router[_0x6fae('0xe')](_0x6fae('0xf'),auth['isAuthenticated'](),controller[_0x6fae('0x10')]);router[_0x6fae('0x11')](_0x6fae('0xf'),auth[_0x6fae('0xb')](),controller['destroy']);module[_0x6fae('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 75aa736..c074e08 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 _0xd2fc=['STRING','DATE','sequelize'];(function(_0x2c4dbb,_0x50319e){var _0x1cac33=function(_0x2337c1){while(--_0x2337c1){_0x2c4dbb['push'](_0x2c4dbb['shift']());}};_0x1cac33(++_0x50319e);}(_0xd2fc,0xda));var _0xcd2f=function(_0x2fe10f,_0x58e757){_0x2fe10f=_0x2fe10f-0x0;var _0x1aad8e=_0xd2fc[_0x2fe10f];return _0x1aad8e;};'use strict';var moment=require('moment');var Sequelize=require(_0xcd2f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xcd2f('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcd2f('0x2')]},'leaveAt':{'type':Sequelize[_0xcd2f('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xcd2f('0x2')]},'reason':{'type':Sequelize[_0xcd2f('0x1')]}}; \ No newline at end of file +var _0xe321=['DATE','moment','sequelize','exports','STRING'];(function(_0x1ba9e6,_0x478222){var _0x2d8007=function(_0x4448cf){while(--_0x4448cf){_0x1ba9e6['push'](_0x1ba9e6['shift']());}};_0x2d8007(++_0x478222);}(_0xe321,0x100));var _0x1e32=function(_0x26fa43,_0x30a86c){_0x26fa43=_0x26fa43-0x0;var _0x81ca8d=_0xe321[_0x26fa43];return _0x81ca8d;};'use strict';var moment=require(_0x1e32('0x0'));var Sequelize=require(_0x1e32('0x1'));module[_0x1e32('0x2')]={'uniqueid':{'type':Sequelize[_0x1e32('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1e32('0x4')]},'leaveAt':{'type':Sequelize[_0x1e32('0x4')]},'acceptAt':{'type':Sequelize[_0x1e32('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1e32('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6413eed..80c7f23 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 _0x01d9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','MailQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':!![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['MailQueueReport'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['MailQueueReport'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));};exports[_0x901d('0x4d')]=function(_0x52aa2d,_0x3a3ea6){return db[_0x901d('0x2f')][_0x901d('0x4d')]()[_0x901d('0x28')](respondWithResult(_0x3a3ea6,null))[_0x901d('0x46')](handleError(_0x3a3ea6,null));}; \ No newline at end of file +var _0xa30a=['destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','save','update','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','includeAll','find','body'];(function(_0x45b707,_0x28ae8d){var _0x500a7d=function(_0x5c9ac1){while(--_0x5c9ac1){_0x45b707['push'](_0x45b707['shift']());}};_0x500a7d(++_0x28ae8d);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec992f,_0x3de2d1){_0x3de2d1=_0x3de2d1||0xcc;return function(_0xcd1d3b){if(_0xcd1d3b){return _0xec992f['sendStatus'](_0x3de2d1);}return _0xec992f[_0xaa30('0x19')](_0x3de2d1)[_0xaa30('0x1a')]();};}function respondWithResult(_0x25c02e,_0x14de74){_0x14de74=_0x14de74||0xc8;return function(_0x41f1d9){if(_0x41f1d9){return _0x25c02e[_0xaa30('0x19')](_0x14de74)[_0xaa30('0x1b')](_0x41f1d9);}};}function respondWithFilteredResult(_0x3b8095,_0x2e37af){return function(_0xfae724){if(_0xfae724){var _0x519518=typeof _0x2e37af[_0xaa30('0x1c')]==='undefined'&&typeof _0x2e37af['limit']===_0xaa30('0x1d');var _0x153939=_0xfae724[_0xaa30('0x1e')];var _0x540e36=_0x519518?0x0:_0x2e37af['offset'];var _0x53f9fd=_0x519518?_0xfae724[_0xaa30('0x1e')]:_0x2e37af['offset']+_0x2e37af[_0xaa30('0x1f')];var _0x332a0a;if(_0x53f9fd>=_0x153939){_0x53f9fd=_0x153939;_0x332a0a=0xc8;}else{_0x332a0a=0xce;}_0x3b8095['status'](_0x332a0a);return _0x3b8095['set']('Content-Range',_0x540e36+'-'+_0x53f9fd+'/'+_0x153939)[_0xaa30('0x1b')](_0xfae724);}return null;};}function patchUpdates(_0x3e4f1d){return function(_0x61b85){try{jsonpatch[_0xaa30('0x20')](_0x61b85,_0x3e4f1d,!![]);}catch(_0x43a526){return BPromise['reject'](_0x43a526);}return _0x61b85[_0xaa30('0x21')]();};}function saveUpdates(_0x24bb25,_0x2e16e7){return function(_0x2d9e35){if(_0x2d9e35){return _0x2d9e35[_0xaa30('0x22')](_0x24bb25)['then'](function(_0x325b42){return _0x325b42;});}return null;};}function removeEntity(_0x13128a,_0x2fecdd){return function(_0x326f84){if(_0x326f84){return _0x326f84['destroy']()[_0xaa30('0x23')](function(){_0x13128a[_0xaa30('0x19')](0xcc)[_0xaa30('0x1a')]();});}};}function handleEntityNotFound(_0x12da2f,_0x97b038){return function(_0x2a59ce){if(!_0x2a59ce){_0x12da2f['sendStatus'](0x194);}return _0x2a59ce;};}function handleError(_0x467850,_0x465701){_0x465701=_0x465701||0x1f4;return function(_0x5d4da8){logger[_0xaa30('0x24')](_0x5d4da8['stack']);if(_0x5d4da8[_0xaa30('0x25')]){delete _0x5d4da8[_0xaa30('0x25')];}_0x467850[_0xaa30('0x19')](_0x465701)[_0xaa30('0x26')](_0x5d4da8);};}exports[_0xaa30('0x27')]=function(_0xc10b8f,_0x6ff09a){var _0x39f708={},_0x1f288c={},_0x43fb30={'count':0x0,'rows':[]};var _0x44aa9b=_[_0xaa30('0x28')](db[_0xaa30('0x29')][_0xaa30('0x2a')],function(_0x40e4ee){return{'name':_0x40e4ee[_0xaa30('0x2b')],'type':_0x40e4ee[_0xaa30('0x2c')][_0xaa30('0x2d')]};});_0x1f288c['model']=_[_0xaa30('0x28')](_0x44aa9b,_0xaa30('0x25'));_0x1f288c[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0xc10b8f[_0xaa30('0x2e')]);_0x1f288c[_0xaa30('0x30')]=_['intersection'](_0x1f288c['model'],_0x1f288c['query']);_0x39f708[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x1f288c[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0xc10b8f[_0xaa30('0x2e')]['fields']));_0x39f708['attributes']=_0x39f708[_0xaa30('0x31')][_0xaa30('0x35')]?_0x39f708['attributes']:_0x1f288c[_0xaa30('0x33')];if(!_0xc10b8f['query'][_0xaa30('0x36')]('nolimit')){_0x39f708[_0xaa30('0x1f')]=qs[_0xaa30('0x1f')](_0xc10b8f['query'][_0xaa30('0x1f')]);_0x39f708[_0xaa30('0x1c')]=qs[_0xaa30('0x1c')](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x1c')]);}_0x39f708[_0xaa30('0x37')]=qs['sort'](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x38')]);_0x39f708['where']=qs[_0xaa30('0x30')](_[_0xaa30('0x39')](_0xc10b8f[_0xaa30('0x2e')],_0x1f288c['filters']),_0x44aa9b);if(_0xc10b8f['query'][_0xaa30('0x3a')]){_0x39f708[_0xaa30('0x3b')]=_[_0xaa30('0x3c')](_0x39f708[_0xaa30('0x3b')],{'$or':_[_0xaa30('0x28')](_0x44aa9b,function(_0x291854){if(_0x291854['type']!=='VIRTUAL'){var _0x120c43={};_0x120c43[_0x291854[_0xaa30('0x25')]]={'$like':'%'+_0xc10b8f[_0xaa30('0x2e')]['filter']+'%'};return _0x120c43;}})});}_0x39f708=_[_0xaa30('0x3c')]({},_0x39f708,_0xc10b8f[_0xaa30('0x3d')]);var _0x8fb95e={'where':_0x39f708[_0xaa30('0x3b')]};return db['MailQueueReport'][_0xaa30('0x1e')](_0x8fb95e)[_0xaa30('0x23')](function(_0x2c5ddb){_0x43fb30[_0xaa30('0x1e')]=_0x2c5ddb;if(_0xc10b8f[_0xaa30('0x2e')]['includeAll']){_0x39f708[_0xaa30('0x3e')]=[{'all':!![]}];}return db[_0xaa30('0x29')][_0xaa30('0x3f')](_0x39f708);})[_0xaa30('0x23')](function(_0x13f08f){_0x43fb30[_0xaa30('0x40')]=_0x13f08f;return _0x43fb30;})[_0xaa30('0x23')](respondWithFilteredResult(_0x6ff09a,_0x39f708))[_0xaa30('0x41')](handleError(_0x6ff09a,null));};exports['show']=function(_0x59ef25,_0x18771d){var _0x4a170a={'raw':!![],'where':{'id':_0x59ef25['params']['id']}},_0x5208f8={};_0x5208f8[_0xaa30('0x33')]=_['keys'](db[_0xaa30('0x29')]['rawAttributes']);_0x5208f8[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0x59ef25[_0xaa30('0x2e')]);_0x5208f8[_0xaa30('0x30')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],_0x5208f8[_0xaa30('0x2e')]);_0x4a170a[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0x59ef25['query'][_0xaa30('0x34')]));_0x4a170a[_0xaa30('0x31')]=_0x4a170a[_0xaa30('0x31')][_0xaa30('0x35')]?_0x4a170a[_0xaa30('0x31')]:_0x5208f8['model'];if(_0x59ef25['query'][_0xaa30('0x42')]){_0x4a170a['include']=[{'all':!![]}];}_0x4a170a=_[_0xaa30('0x3c')]({},_0x4a170a,_0x59ef25[_0xaa30('0x3d')]);return db[_0xaa30('0x29')][_0xaa30('0x43')](_0x4a170a)[_0xaa30('0x23')](handleEntityNotFound(_0x18771d,null))[_0xaa30('0x23')](respondWithResult(_0x18771d,null))[_0xaa30('0x41')](handleError(_0x18771d,null));};exports['create']=function(_0x3cf0bb,_0x6c9da6){return db[_0xaa30('0x29')]['create'](_0x3cf0bb[_0xaa30('0x44')],{})[_0xaa30('0x23')](respondWithResult(_0x6c9da6,0xc9))['catch'](handleError(_0x6c9da6,null));};exports[_0xaa30('0x22')]=function(_0x4a8fcc,_0x25d227){if(_0x4a8fcc['body']['id']){delete _0x4a8fcc['body']['id'];}return db[_0xaa30('0x29')]['find']({'where':{'id':_0x4a8fcc['params']['id']}})[_0xaa30('0x23')](handleEntityNotFound(_0x25d227,null))[_0xaa30('0x23')](saveUpdates(_0x4a8fcc[_0xaa30('0x44')],null))[_0xaa30('0x23')](respondWithResult(_0x25d227,null))[_0xaa30('0x41')](handleError(_0x25d227,null));};exports[_0xaa30('0x45')]=function(_0x5616cd,_0x17d75d){return db[_0xaa30('0x29')][_0xaa30('0x43')]({'where':{'id':_0x5616cd['params']['id']}})['then'](handleEntityNotFound(_0x17d75d,null))['then'](removeEntity(_0x17d75d,null))['catch'](handleError(_0x17d75d,null));};exports[_0xaa30('0x46')]=function(_0x1ba164,_0xdc32bc){return db[_0xaa30('0x29')][_0xaa30('0x46')]()[_0xaa30('0x23')](respondWithResult(_0xdc32bc,null))['catch'](handleError(_0xdc32bc,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index b95a393..bb71592 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 _0xbc6b=['util','./mailQueueReport.attributes','define','MailQueueReport','uniqueid'];(function(_0xeba09b,_0x506e53){var _0x1a5f70=function(_0x4e2842){while(--_0x4e2842){_0xeba09b['push'](_0xeba09b['shift']());}};_0x1a5f70(++_0x506e53);}(_0xbc6b,0x19f));var _0xbbc6=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0xbc6b[_0x33fcbb];return _0x2efe40;};'use strict';var _=require('lodash');var util=require(_0xbbc6('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbbc6('0x1'));module['exports']=function(_0x194152,_0x2b6fff){return _0x194152[_0xbbc6('0x2')](_0xbbc6('0x3'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xbbc6('0x4'),'fields':[_0xbbc6('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb662=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a5438,_0x19aa59){var _0x35a70d=function(_0x42b805){while(--_0x42b805){_0x4a5438['push'](_0x4a5438['shift']());}};_0x35a70d(++_0x19aa59);}(_0xb662,0x13e));var _0x2b66=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0xb662[_0x578275];return _0xf78041;};'use strict';var _=require(_0x2b66('0x0'));var util=require(_0x2b66('0x1'));var logger=require(_0x2b66('0x2'))(_0x2b66('0x3'));var moment=require(_0x2b66('0x4'));var BPromise=require(_0x2b66('0x5'));var rp=require(_0x2b66('0x6'));var fs=require('fs');var path=require(_0x2b66('0x7'));var rimraf=require(_0x2b66('0x8'));var config=require(_0x2b66('0x9'));var attributes=require(_0x2b66('0xa'));module[_0x2b66('0xb')]=function(_0x260b9f,_0x371f28){return _0x260b9f['define']('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x2b66('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 981ae0d..39627b5 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x14405e,_0x28c551){var _0x349986=function(_0x47ad0c){while(--_0x47ad0c){_0x14405e['push'](_0x14405e['shift']());}};_0x349986(++_0x28c551);}(_0x5f2f,0x73));var _0xf5f2=function(_0x202bbc,_0x464937){_0x202bbc=_0x202bbc-0x0;var _0x1b7b71=_0x5f2f[_0x202bbc];return _0x1b7b71;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0xbe0610,_0x1d0d20){var _0x2e8152=function(_0x1a2369){while(--_0x1a2369){_0xbe0610['push'](_0xbe0610['shift']());}};_0x2e8152(++_0x1d0d20);}(_0x7a54,0x106));var _0x47a5=function(_0x56296c,_0x30a896){_0x56296c=_0x56296c-0x0;var _0x1b105a=_0x7a54[_0x56296c];return _0x1b105a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d714ac2..7c6c112 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(_0x31d395,_0x58ad11){var _0x2daa5b=function(_0x351e93){while(--_0x351e93){_0x31d395['push'](_0x31d395['shift']());}};_0x2daa5b(++_0x58ad11);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c1da1,_0xe2763a){_0x4c1da1=_0x4c1da1-0x0;var _0x214ad0=_0xedd9[_0x4c1da1];return _0x214ad0;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x53513a,_0x391521){var _0x24aed2=function(_0x4f523b){while(--_0x4f523b){_0x53513a['push'](_0x53513a['shift']());}};_0x24aed2(++_0x391521);}(_0xe706,0xa3));var _0x6e70=function(_0x35f6b4,_0x505966){_0x35f6b4=_0x35f6b4-0x0;var _0x10f072=_0xe706[_0x35f6b4];return _0x10f072;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 95a4d75..8255700 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 _0xfce0=['STRING','BOOLEAN','INBOX','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfce0,0x15c));var _0x0fce=function(_0x5f4382,_0xcb3195){_0x5f4382=_0x5f4382-0x0;var _0x368006=_0xfce0[_0x5f4382];return _0x368006;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x0fce('0x0')]},'host':{'type':Sequelize[_0x0fce('0x0')]},'authentication':{'type':Sequelize[_0x0fce('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x0fce('0x0')]},'password':{'type':Sequelize[_0x0fce('0x0')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x0fce('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0fce('0x0')],'defaultValue':_0x0fce('0x2')},'connTimeout':{'type':Sequelize[_0x0fce('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x0fce('0x0')]},'modernAuthentication':{'type':Sequelize[_0x0fce('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x0bbe=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x0bbe,0x13c));var _0xe0bb=function(_0x15ba03,_0x3ded28){_0x15ba03=_0x15ba03-0x0;var _0x5ec7d8=_0x0bbe[_0x15ba03];return _0x5ec7d8;};'use strict';var Sequelize=require(_0xe0bb('0x0'));module[_0xe0bb('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe0bb('0x2')]},'authentication':{'type':Sequelize[_0xe0bb('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe0bb('0x2')]},'password':{'type':Sequelize[_0xe0bb('0x2')]},'port':{'type':Sequelize[_0xe0bb('0x4')]},'tls':{'type':Sequelize[_0xe0bb('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe0bb('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xe0bb('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe0bb('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe0bb('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9fe4aaa..414a629 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 _0x58a4=['./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x58a4,0x7a));var _0x458a=function(_0x443f79,_0x33e446){_0x443f79=_0x443f79-0x0;var _0x3847e4=_0x58a4[_0x443f79];return _0x3847e4;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var logger=require('../../config/logger')(_0x458a('0x2'));var moment=require(_0x458a('0x3'));var BPromise=require(_0x458a('0x4'));var rp=require(_0x458a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x458a('0x6'));var config=require(_0x458a('0x7'));var attributes=require(_0x458a('0x8'));module[_0x458a('0x9')]=function(_0x407fda,_0x1f8f40){return _0x407fda[_0x458a('0xa')](_0x458a('0xb'),attributes,{'tableName':_0x458a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60cb=['bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util'];(function(_0x5b6f98,_0x1b6307){var _0x36b052=function(_0x2f68b3){while(--_0x2f68b3){_0x5b6f98['push'](_0x5b6f98['shift']());}};_0x36b052(++_0x1b6307);}(_0x60cb,0x1d7));var _0xb60c=function(_0x2068b1,_0x31a02e){_0x2068b1=_0x2068b1-0x0;var _0x549972=_0x60cb[_0x2068b1];return _0x549972;};'use strict';var _=require(_0xb60c('0x0'));var util=require(_0xb60c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb60c('0x2'));var rp=require(_0xb60c('0x3'));var fs=require('fs');var path=require(_0xb60c('0x4'));var rimraf=require(_0xb60c('0x5'));var config=require(_0xb60c('0x6'));var attributes=require(_0xb60c('0x7'));module[_0xb60c('0x8')]=function(_0x503700,_0x454e65){return _0x503700['define'](_0xb60c('0x9'),attributes,{'tableName':_0xb60c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 4167b0f..deb45d6 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 _0xbb94=['client','request','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','GetMailServerIn','debug','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbb94,0xde));var _0x4bb9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbb94[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4bb9('0x0'));var BPromise=require('bluebird');var rs=require(_0x4bb9('0x1'));var fs=require('fs');var Redis=require(_0x4bb9('0x2'));var db=require(_0x4bb9('0x3'))['db'];var utils=require(_0x4bb9('0x4'));var logger=require(_0x4bb9('0x5'))(_0x4bb9('0x6'));var config=require(_0x4bb9('0x7'));var jayson=require(_0x4bb9('0x8'));var client=jayson[_0x4bb9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29bf40,_0x1fa27e,_0x18112b){return new BPromise(function(_0x5cfac1,_0x3f3415){return client[_0x4bb9('0xa')](_0x29bf40,_0x18112b)['then'](function(_0x314d79){logger['info'](_0x4bb9('0xb'),_0x1fa27e,_0x4bb9('0xc'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1fa27e,_0x4bb9('0xc'),JSON[_0x4bb9('0xd')](_0x314d79));if(_0x314d79[_0x4bb9('0xe')]){if(_0x314d79[_0x4bb9('0xe')][_0x4bb9('0xf')]===0x1f4){logger['error'](_0x4bb9('0xb'),_0x1fa27e,_0x314d79['error'][_0x4bb9('0x10')]);return _0x3f3415(_0x314d79[_0x4bb9('0xe')][_0x4bb9('0x10')]);}logger[_0x4bb9('0xe')](_0x4bb9('0xb'),_0x1fa27e,_0x314d79['error'][_0x4bb9('0x10')]);return _0x5cfac1(_0x314d79[_0x4bb9('0xe')][_0x4bb9('0x10')]);}else{logger[_0x4bb9('0x11')](_0x4bb9('0xb'),_0x1fa27e,_0x4bb9('0xc'));_0x5cfac1(_0x314d79[_0x4bb9('0x12')]['message']);}})[_0x4bb9('0x13')](function(_0x277544){logger['error'](_0x4bb9('0xb'),_0x1fa27e,_0x277544);_0x3f3415(_0x277544);});});}exports['GetMailServerIn']=function(_0x421813){var _0x115b15=this;return new Promise(function(_0x5b7c73,_0x4cbe2d){return db[_0x4bb9('0x14')][_0x4bb9('0x15')]({'raw':_0x421813[_0x4bb9('0x16')]?_0x421813[_0x4bb9('0x16')][_0x4bb9('0x17')]===undefined?!![]:![]:!![],'where':_0x421813['options']?_0x421813[_0x4bb9('0x16')][_0x4bb9('0x18')]||null:null,'attributes':_0x421813['options']?_0x421813[_0x4bb9('0x16')][_0x4bb9('0x19')]||null:null,'limit':_0x421813[_0x4bb9('0x16')]?_0x421813[_0x4bb9('0x16')][_0x4bb9('0x1a')]||null:null,'include':_0x421813[_0x4bb9('0x16')]?_0x421813[_0x4bb9('0x16')][_0x4bb9('0x1b')]?_[_0x4bb9('0x1c')](_0x421813[_0x4bb9('0x16')][_0x4bb9('0x1b')],function(_0x27675f){return{'model':db[_0x27675f[_0x4bb9('0x1d')]],'as':_0x27675f['as'],'attributes':_0x27675f[_0x4bb9('0x19')],'include':_0x27675f[_0x4bb9('0x1b')]?_['map'](_0x27675f[_0x4bb9('0x1b')],function(_0x510008){return{'model':db[_0x510008[_0x4bb9('0x1d')]],'as':_0x510008['as'],'attributes':_0x510008['attributes'],'include':_0x510008[_0x4bb9('0x1b')]?_[_0x4bb9('0x1c')](_0x510008['include'],function(_0x1ab6e5){return{'model':db[_0x1ab6e5[_0x4bb9('0x1d')]],'as':_0x1ab6e5['as'],'attributes':_0x1ab6e5[_0x4bb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4bb9('0x1e')](function(_0x1c0351){logger['info'](_0x4bb9('0x1f'),_0x421813);logger[_0x4bb9('0x20')]('GetMailServerIn',_0x421813,JSON[_0x4bb9('0xd')](_0x1c0351));_0x5b7c73(_0x1c0351);})[_0x4bb9('0x13')](function(_0x224045){logger['error'](_0x4bb9('0x1f'),_0x224045[_0x4bb9('0x10')],_0x421813);_0x4cbe2d(_0x115b15[_0x4bb9('0xe')](0x1f4,_0x224045[_0x4bb9('0x10')]));});});}; \ No newline at end of file +var _0x98ea=['error','message','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','options','raw','where','attributes','include','map','model','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x2d2a9b,_0x5870ff){var _0x3d2d49=function(_0x13884d){while(--_0x13884d){_0x2d2a9b['push'](_0x2d2a9b['shift']());}};_0x3d2d49(++_0x5870ff);}(_0x98ea,0x1ce));var _0xa98e=function(_0x112796,_0xf2b482){_0x112796=_0x112796-0x0;var _0x189f89=_0x98ea[_0x112796];return _0x189f89;};'use strict';var _=require(_0xa98e('0x0'));var util=require('util');var moment=require(_0xa98e('0x1'));var BPromise=require('bluebird');var rs=require(_0xa98e('0x2'));var fs=require('fs');var Redis=require(_0xa98e('0x3'));var db=require(_0xa98e('0x4'))['db'];var utils=require(_0xa98e('0x5'));var logger=require(_0xa98e('0x6'))('rpc');var config=require(_0xa98e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa98e('0x8')][_0xa98e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x173f49,_0x5be438,_0x61ad22){return new BPromise(function(_0x125887,_0x550555){return client[_0xa98e('0xa')](_0x173f49,_0x61ad22)[_0xa98e('0xb')](function(_0x57251c){logger[_0xa98e('0xc')]('MailServerIn,\x20%s,\x20%s',_0x5be438,_0xa98e('0xd'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x5be438,'request\x20sent',JSON['stringify'](_0x57251c));if(_0x57251c[_0xa98e('0xe')]){if(_0x57251c[_0xa98e('0xe')]['code']===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x5be438,_0x57251c['error'][_0xa98e('0xf')]);return _0x550555(_0x57251c[_0xa98e('0xe')][_0xa98e('0xf')]);}logger['error'](_0xa98e('0x10'),_0x5be438,_0x57251c[_0xa98e('0xe')][_0xa98e('0xf')]);return _0x125887(_0x57251c['error'][_0xa98e('0xf')]);}else{logger[_0xa98e('0xc')]('MailServerIn,\x20%s,\x20%s',_0x5be438,_0xa98e('0xd'));_0x125887(_0x57251c[_0xa98e('0x11')][_0xa98e('0xf')]);}})[_0xa98e('0x12')](function(_0x52a95a){logger[_0xa98e('0xe')]('MailServerIn,\x20%s,\x20%s',_0x5be438,_0x52a95a);_0x550555(_0x52a95a);});});}exports[_0xa98e('0x13')]=function(_0xae2fd1){var _0xfcec3b=this;return new Promise(function(_0x22c6f6,_0x432bdb){return db['MailServerIn']['findAll']({'raw':_0xae2fd1[_0xa98e('0x14')]?_0xae2fd1['options'][_0xa98e('0x15')]===undefined?!![]:![]:!![],'where':_0xae2fd1['options']?_0xae2fd1[_0xa98e('0x14')][_0xa98e('0x16')]||null:null,'attributes':_0xae2fd1['options']?_0xae2fd1[_0xa98e('0x14')][_0xa98e('0x17')]||null:null,'limit':_0xae2fd1[_0xa98e('0x14')]?_0xae2fd1['options']['limit']||null:null,'include':_0xae2fd1[_0xa98e('0x14')]?_0xae2fd1[_0xa98e('0x14')][_0xa98e('0x18')]?_[_0xa98e('0x19')](_0xae2fd1['options'][_0xa98e('0x18')],function(_0x55b993){return{'model':db[_0x55b993['model']],'as':_0x55b993['as'],'attributes':_0x55b993[_0xa98e('0x17')],'include':_0x55b993['include']?_[_0xa98e('0x19')](_0x55b993[_0xa98e('0x18')],function(_0xdb0a25){return{'model':db[_0xdb0a25[_0xa98e('0x1a')]],'as':_0xdb0a25['as'],'attributes':_0xdb0a25[_0xa98e('0x17')],'include':_0xdb0a25[_0xa98e('0x18')]?_['map'](_0xdb0a25[_0xa98e('0x18')],function(_0x3ab819){return{'model':db[_0x3ab819['model']],'as':_0x3ab819['as'],'attributes':_0x3ab819['attributes']};}):[]};}):[]};}):[]:[]})[_0xa98e('0xb')](function(_0xad3ca5){logger['info'](_0xa98e('0x13'),_0xae2fd1);logger[_0xa98e('0x1b')]('GetMailServerIn',_0xae2fd1,JSON['stringify'](_0xad3ca5));_0x22c6f6(_0xad3ca5);})['catch'](function(_0x5144d7){logger[_0xa98e('0xe')]('GetMailServerIn',_0x5144d7[_0xa98e('0xf')],_0xae2fd1);_0x432bdb(_0xfcec3b[_0xa98e('0xe')](0x1f4,_0x5144d7[_0xa98e('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f7dacae..a7d0d63 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(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7a54,0x106));var _0x47a5=function(_0x2e3a28,_0x48cec9){_0x2e3a28=_0x2e3a28-0x0;var _0x30753b=_0x7a54[_0x2e3a28];return _0x30753b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 0526ef8..80435fa 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 _0xb58b=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x1d9644,_0x371adf){var _0x23d6b6=function(_0x9e6091){while(--_0x9e6091){_0x1d9644['push'](_0x1d9644['shift']());}};_0x23d6b6(++_0x371adf);}(_0xb58b,0x1f1));var _0xbb58=function(_0x220a41,_0x1231ca){_0x220a41=_0x220a41-0x0;var _0x5f10ee=_0xb58b[_0x220a41];return _0x5f10ee;};'use strict';var Sequelize=require('sequelize');module[_0xbb58('0x0')]={'description':{'type':Sequelize[_0xbb58('0x1')]},'host':{'type':Sequelize[_0xbb58('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xbb58('0x1')]},'port':{'type':Sequelize[_0xbb58('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xbb58('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xbb58('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe5b5=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x3c6ae6,_0x55e2c6){var _0x3246cc=function(_0x560848){while(--_0x560848){_0x3c6ae6['push'](_0x3c6ae6['shift']());}};_0x3246cc(++_0x55e2c6);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0xe5b5[_0x53e3de];return _0x7b905b;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'description':{'type':Sequelize[_0x5e5b('0x2')]},'host':{'type':Sequelize[_0x5e5b('0x2')]},'user':{'type':Sequelize[_0x5e5b('0x2')]},'pass':{'type':Sequelize[_0x5e5b('0x2')]},'port':{'type':Sequelize[_0x5e5b('0x3')]},'secure':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x5e5b('0x2')]},'authentication':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index b4687ef..449c126 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 _0x98bd=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','MailServerOut','count','includeAll','findAll','catch','params','include','find','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x1f404a,_0x5088b2){var _0x2cdcd5=function(_0xe30d8c){while(--_0xe30d8c){_0x1f404a['push'](_0x1f404a['shift']());}};_0x2cdcd5(++_0x5088b2);}(_0x98bd,0x1d1));var _0xd98b=function(_0x28d872,_0x265276){_0x28d872=_0x28d872-0x0;var _0x36308a=_0x98bd[_0x28d872];return _0x36308a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd98b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd98b('0x1'));var rp=require(_0xd98b('0x2'));var moment=require(_0xd98b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd98b('0x4'));var util=require(_0xd98b('0x5'));var path=require('path');var sox=require(_0xd98b('0x6'));var csv=require('to-csv');var ejs=require(_0xd98b('0x7'));var fs=require('fs');var fs_extra=require(_0xd98b('0x8'));var _=require(_0xd98b('0x9'));var squel=require(_0xd98b('0xa'));var crypto=require(_0xd98b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd98b('0xc'));var toCsv=require(_0xd98b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd98b('0xe'));var qs=require(_0xd98b('0xf'));var as=require(_0xd98b('0x10'));var hardwareService=require(_0xd98b('0x11'));var logger=require(_0xd98b('0x12'))(_0xd98b('0x13'));var utils=require(_0xd98b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd98b('0x15'));var db=require(_0xd98b('0x16'))['db'];function respondWithStatusCode(_0x363297,_0x2483fb){_0x2483fb=_0x2483fb||0xcc;return function(_0x2b7fe6){if(_0x2b7fe6){return _0x363297[_0xd98b('0x17')](_0x2483fb);}return _0x363297[_0xd98b('0x18')](_0x2483fb)[_0xd98b('0x19')]();};}function respondWithResult(_0x33e81c,_0x3226a0){_0x3226a0=_0x3226a0||0xc8;return function(_0x5c4275){if(_0x5c4275){return _0x33e81c[_0xd98b('0x18')](_0x3226a0)[_0xd98b('0x1a')](_0x5c4275);}};}function respondWithFilteredResult(_0x34efef,_0x334e4c){return function(_0x2e0426){if(_0x2e0426){var _0x248e76=typeof _0x334e4c[_0xd98b('0x1b')]===_0xd98b('0x1c')&&typeof _0x334e4c[_0xd98b('0x1d')]===_0xd98b('0x1c');var _0x32ec09=_0x2e0426['count'];var _0x130499=_0x248e76?0x0:_0x334e4c['offset'];var _0x5a7295=_0x248e76?_0x2e0426['count']:_0x334e4c[_0xd98b('0x1b')]+_0x334e4c[_0xd98b('0x1d')];var _0x4cc619;if(_0x5a7295>=_0x32ec09){_0x5a7295=_0x32ec09;_0x4cc619=0xc8;}else{_0x4cc619=0xce;}_0x34efef[_0xd98b('0x18')](_0x4cc619);return _0x34efef[_0xd98b('0x1e')]('Content-Range',_0x130499+'-'+_0x5a7295+'/'+_0x32ec09)['json'](_0x2e0426);}return null;};}function patchUpdates(_0x17b79c){return function(_0x42ec92){try{jsonpatch[_0xd98b('0x1f')](_0x42ec92,_0x17b79c,!![]);}catch(_0x3cadfd){return BPromise[_0xd98b('0x20')](_0x3cadfd);}return _0x42ec92[_0xd98b('0x21')]();};}function saveUpdates(_0x10bf32,_0x27cbf6){return function(_0x1e5b54){if(_0x1e5b54){return _0x1e5b54[_0xd98b('0x22')](_0x10bf32)[_0xd98b('0x23')](function(_0x1cb882){return _0x1cb882;});}return null;};}function removeEntity(_0x3c25ac,_0x43ce03){return function(_0x464d1f){if(_0x464d1f){return _0x464d1f['destroy']()[_0xd98b('0x23')](function(){_0x3c25ac['status'](0xcc)[_0xd98b('0x19')]();});}};}function handleEntityNotFound(_0x4a1e76,_0x4c509d){return function(_0x31f475){if(!_0x31f475){_0x4a1e76[_0xd98b('0x17')](0x194);}return _0x31f475;};}function handleError(_0x132287,_0x2a495a){_0x2a495a=_0x2a495a||0x1f4;return function(_0x55c1e3){logger[_0xd98b('0x24')](_0x55c1e3[_0xd98b('0x25')]);if(_0x55c1e3[_0xd98b('0x26')]){delete _0x55c1e3[_0xd98b('0x26')];}_0x132287[_0xd98b('0x18')](_0x2a495a)[_0xd98b('0x27')](_0x55c1e3);};}exports[_0xd98b('0x28')]=function(_0x281943,_0x4f2865){var _0x12727c={},_0x6e6133={},_0x3928d4={'count':0x0,'rows':[]};var _0x16e8f3=_[_0xd98b('0x29')](db['MailServerOut'][_0xd98b('0x2a')],function(_0x55fc78){return{'name':_0x55fc78[_0xd98b('0x2b')],'type':_0x55fc78[_0xd98b('0x2c')][_0xd98b('0x2d')]};});_0x6e6133[_0xd98b('0x2e')]=_[_0xd98b('0x29')](_0x16e8f3,_0xd98b('0x26'));_0x6e6133[_0xd98b('0x2f')]=_[_0xd98b('0x30')](_0x281943['query']);_0x6e6133[_0xd98b('0x31')]=_[_0xd98b('0x32')](_0x6e6133[_0xd98b('0x2e')],_0x6e6133[_0xd98b('0x2f')]);_0x12727c[_0xd98b('0x33')]=_[_0xd98b('0x32')](_0x6e6133[_0xd98b('0x2e')],qs[_0xd98b('0x34')](_0x281943['query'][_0xd98b('0x34')]));_0x12727c[_0xd98b('0x33')]=_0x12727c[_0xd98b('0x33')][_0xd98b('0x35')]?_0x12727c[_0xd98b('0x33')]:_0x6e6133[_0xd98b('0x2e')];if(!_0x281943['query'][_0xd98b('0x36')](_0xd98b('0x37'))){_0x12727c[_0xd98b('0x1d')]=qs[_0xd98b('0x1d')](_0x281943[_0xd98b('0x2f')][_0xd98b('0x1d')]);_0x12727c[_0xd98b('0x1b')]=qs[_0xd98b('0x1b')](_0x281943['query'][_0xd98b('0x1b')]);}_0x12727c[_0xd98b('0x38')]=qs[_0xd98b('0x39')](_0x281943[_0xd98b('0x2f')][_0xd98b('0x39')]);_0x12727c[_0xd98b('0x3a')]=qs['filters'](_['pick'](_0x281943[_0xd98b('0x2f')],_0x6e6133[_0xd98b('0x31')]),_0x16e8f3);if(_0x281943[_0xd98b('0x2f')]['filter']){_0x12727c[_0xd98b('0x3a')]=_[_0xd98b('0x3b')](_0x12727c[_0xd98b('0x3a')],{'$or':_[_0xd98b('0x29')](_0x16e8f3,function(_0x377a86){if(_0x377a86[_0xd98b('0x2c')]!==_0xd98b('0x3c')){var _0x41edab={};_0x41edab[_0x377a86[_0xd98b('0x26')]]={'$like':'%'+_0x281943[_0xd98b('0x2f')][_0xd98b('0x3d')]+'%'};return _0x41edab;}})});}_0x12727c=_[_0xd98b('0x3b')]({},_0x12727c,_0x281943[_0xd98b('0x3e')]);var _0x467503={'where':_0x12727c[_0xd98b('0x3a')]};return db[_0xd98b('0x3f')][_0xd98b('0x40')](_0x467503)[_0xd98b('0x23')](function(_0x3a38f3){_0x3928d4['count']=_0x3a38f3;if(_0x281943[_0xd98b('0x2f')][_0xd98b('0x41')]){_0x12727c['include']=[{'all':!![]}];}return db[_0xd98b('0x3f')][_0xd98b('0x42')](_0x12727c);})[_0xd98b('0x23')](function(_0x3a31aa){_0x3928d4['rows']=_0x3a31aa;return _0x3928d4;})[_0xd98b('0x23')](respondWithFilteredResult(_0x4f2865,_0x12727c))[_0xd98b('0x43')](handleError(_0x4f2865,null));};exports['show']=function(_0x18e9fa,_0x30113c){var _0x764671={'raw':!![],'where':{'id':_0x18e9fa[_0xd98b('0x44')]['id']}},_0x4b4864={};_0x4b4864[_0xd98b('0x2e')]=_[_0xd98b('0x30')](db[_0xd98b('0x3f')][_0xd98b('0x2a')]);_0x4b4864[_0xd98b('0x2f')]=_['keys'](_0x18e9fa[_0xd98b('0x2f')]);_0x4b4864['filters']=_[_0xd98b('0x32')](_0x4b4864[_0xd98b('0x2e')],_0x4b4864[_0xd98b('0x2f')]);_0x764671[_0xd98b('0x33')]=_[_0xd98b('0x32')](_0x4b4864[_0xd98b('0x2e')],qs['fields'](_0x18e9fa[_0xd98b('0x2f')][_0xd98b('0x34')]));_0x764671[_0xd98b('0x33')]=_0x764671[_0xd98b('0x33')][_0xd98b('0x35')]?_0x764671['attributes']:_0x4b4864[_0xd98b('0x2e')];if(_0x18e9fa['query']['includeAll']){_0x764671[_0xd98b('0x45')]=[{'all':!![]}];}_0x764671=_['merge']({},_0x764671,_0x18e9fa[_0xd98b('0x3e')]);return db['MailServerOut'][_0xd98b('0x46')](_0x764671)[_0xd98b('0x23')](handleEntityNotFound(_0x30113c,null))[_0xd98b('0x23')](respondWithResult(_0x30113c,null))[_0xd98b('0x43')](handleError(_0x30113c,null));};exports['create']=function(_0x321d78,_0x3bcd50){return db[_0xd98b('0x3f')][_0xd98b('0x47')](_0x321d78[_0xd98b('0x48')],{})[_0xd98b('0x23')](respondWithResult(_0x3bcd50,0xc9))[_0xd98b('0x43')](handleError(_0x3bcd50,null));};exports[_0xd98b('0x22')]=function(_0x45f434,_0x4969c4){if(_0x45f434[_0xd98b('0x48')]['id']){delete _0x45f434[_0xd98b('0x48')]['id'];}return db[_0xd98b('0x3f')][_0xd98b('0x46')]({'where':{'id':_0x45f434[_0xd98b('0x44')]['id']}})[_0xd98b('0x23')](handleEntityNotFound(_0x4969c4,null))['then'](saveUpdates(_0x45f434['body'],null))[_0xd98b('0x23')](respondWithResult(_0x4969c4,null))['catch'](handleError(_0x4969c4,null));};exports['destroy']=function(_0x38d589,_0x1a1d6f){return db['MailServerOut'][_0xd98b('0x46')]({'where':{'id':_0x38d589['params']['id']}})['then'](handleEntityNotFound(_0x1a1d6f,null))[_0xd98b('0x23')](removeEntity(_0x1a1d6f,null))[_0xd98b('0x43')](handleError(_0x1a1d6f,null));}; \ No newline at end of file +var _0xe114=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model'];(function(_0x54b77e,_0x1b05ef){var _0x2d1f15=function(_0x6af5dd){while(--_0x6af5dd){_0x54b77e['push'](_0x54b77e['shift']());}};_0x2d1f15(++_0x1b05ef);}(_0xe114,0xbc));var _0x4e11=function(_0x2ff3f1,_0x2c6cba){_0x2ff3f1=_0x2ff3f1-0x0;var _0x3e01b7=_0xe114[_0x2ff3f1];return _0x3e01b7;};'use strict';var emlformat=require(_0x4e11('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e11('0x1'));var jsonpatch=require(_0x4e11('0x2'));var rp=require(_0x4e11('0x3'));var moment=require(_0x4e11('0x4'));var BPromise=require(_0x4e11('0x5'));var Mustache=require(_0x4e11('0x6'));var util=require('util');var path=require(_0x4e11('0x7'));var sox=require(_0x4e11('0x8'));var csv=require(_0x4e11('0x9'));var ejs=require(_0x4e11('0xa'));var fs=require('fs');var fs_extra=require(_0x4e11('0xb'));var _=require(_0x4e11('0xc'));var squel=require(_0x4e11('0xd'));var crypto=require(_0x4e11('0xe'));var jsforce=require(_0x4e11('0xf'));var deskjs=require(_0x4e11('0x10'));var toCsv=require(_0x4e11('0x9'));var querystring=require(_0x4e11('0x11'));var Papa=require(_0x4e11('0x12'));var Redis=require(_0x4e11('0x13'));var authService=require(_0x4e11('0x14'));var qs=require(_0x4e11('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e11('0x16'));var logger=require(_0x4e11('0x17'))(_0x4e11('0x18'));var utils=require(_0x4e11('0x19'));var config=require(_0x4e11('0x1a'));var licenseUtil=require(_0x4e11('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bfeb2,_0x12cd52){_0x12cd52=_0x12cd52||0xcc;return function(_0x23ded6){if(_0x23ded6){return _0x2bfeb2['sendStatus'](_0x12cd52);}return _0x2bfeb2[_0x4e11('0x1c')](_0x12cd52)[_0x4e11('0x1d')]();};}function respondWithResult(_0x494adb,_0x251ba5){_0x251ba5=_0x251ba5||0xc8;return function(_0x929b7e){if(_0x929b7e){return _0x494adb[_0x4e11('0x1c')](_0x251ba5)['json'](_0x929b7e);}};}function respondWithFilteredResult(_0x3280c0,_0x3e85da){return function(_0x4094b3){if(_0x4094b3){var _0x35e898=typeof _0x3e85da['offset']===_0x4e11('0x1e')&&typeof _0x3e85da[_0x4e11('0x1f')]==='undefined';var _0x870765=_0x4094b3[_0x4e11('0x20')];var _0x27b420=_0x35e898?0x0:_0x3e85da['offset'];var _0x4c936c=_0x35e898?_0x4094b3[_0x4e11('0x20')]:_0x3e85da[_0x4e11('0x21')]+_0x3e85da[_0x4e11('0x1f')];var _0x56ed7a;if(_0x4c936c>=_0x870765){_0x4c936c=_0x870765;_0x56ed7a=0xc8;}else{_0x56ed7a=0xce;}_0x3280c0[_0x4e11('0x1c')](_0x56ed7a);return _0x3280c0[_0x4e11('0x22')](_0x4e11('0x23'),_0x27b420+'-'+_0x4c936c+'/'+_0x870765)[_0x4e11('0x24')](_0x4094b3);}return null;};}function patchUpdates(_0x595adf){return function(_0x26b9ea){try{jsonpatch[_0x4e11('0x25')](_0x26b9ea,_0x595adf,!![]);}catch(_0x2de3cd){return BPromise[_0x4e11('0x26')](_0x2de3cd);}return _0x26b9ea['save']();};}function saveUpdates(_0x50ac18,_0x314c16){return function(_0x336f22){if(_0x336f22){return _0x336f22[_0x4e11('0x27')](_0x50ac18)[_0x4e11('0x28')](function(_0x315802){return _0x315802;});}return null;};}function removeEntity(_0x314b2f,_0x4a3114){return function(_0x3ccd2d){if(_0x3ccd2d){return _0x3ccd2d[_0x4e11('0x29')]()[_0x4e11('0x28')](function(){_0x314b2f[_0x4e11('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x284ad1,_0x4bdd30){return function(_0x4b9935){if(!_0x4b9935){_0x284ad1[_0x4e11('0x2a')](0x194);}return _0x4b9935;};}function handleError(_0x356ae5,_0x21dc2c){_0x21dc2c=_0x21dc2c||0x1f4;return function(_0x2a266a){logger[_0x4e11('0x2b')](_0x2a266a[_0x4e11('0x2c')]);if(_0x2a266a[_0x4e11('0x2d')]){delete _0x2a266a['name'];}_0x356ae5[_0x4e11('0x1c')](_0x21dc2c)[_0x4e11('0x2e')](_0x2a266a);};}exports[_0x4e11('0x2f')]=function(_0x3dc5b9,_0x30ce09){var _0x200322={},_0x2f957c={},_0x438f83={'count':0x0,'rows':[]};var _0x175d01=_[_0x4e11('0x30')](db[_0x4e11('0x31')][_0x4e11('0x32')],function(_0x47e993){return{'name':_0x47e993[_0x4e11('0x33')],'type':_0x47e993[_0x4e11('0x34')][_0x4e11('0x35')]};});_0x2f957c[_0x4e11('0x36')]=_[_0x4e11('0x30')](_0x175d01,_0x4e11('0x2d'));_0x2f957c[_0x4e11('0x37')]=_[_0x4e11('0x38')](_0x3dc5b9[_0x4e11('0x37')]);_0x2f957c[_0x4e11('0x39')]=_[_0x4e11('0x3a')](_0x2f957c[_0x4e11('0x36')],_0x2f957c[_0x4e11('0x37')]);_0x200322[_0x4e11('0x3b')]=_[_0x4e11('0x3a')](_0x2f957c['model'],qs[_0x4e11('0x3c')](_0x3dc5b9[_0x4e11('0x37')][_0x4e11('0x3c')]));_0x200322['attributes']=_0x200322[_0x4e11('0x3b')]['length']?_0x200322['attributes']:_0x2f957c['model'];if(!_0x3dc5b9[_0x4e11('0x37')][_0x4e11('0x3d')](_0x4e11('0x3e'))){_0x200322[_0x4e11('0x1f')]=qs[_0x4e11('0x1f')](_0x3dc5b9[_0x4e11('0x37')][_0x4e11('0x1f')]);_0x200322[_0x4e11('0x21')]=qs[_0x4e11('0x21')](_0x3dc5b9['query'][_0x4e11('0x21')]);}_0x200322[_0x4e11('0x3f')]=qs[_0x4e11('0x40')](_0x3dc5b9['query'][_0x4e11('0x40')]);_0x200322[_0x4e11('0x41')]=qs[_0x4e11('0x39')](_['pick'](_0x3dc5b9[_0x4e11('0x37')],_0x2f957c['filters']),_0x175d01);if(_0x3dc5b9[_0x4e11('0x37')][_0x4e11('0x42')]){_0x200322['where']=_[_0x4e11('0x43')](_0x200322['where'],{'$or':_[_0x4e11('0x30')](_0x175d01,function(_0x44e832){if(_0x44e832[_0x4e11('0x34')]!==_0x4e11('0x44')){var _0x2a521f={};_0x2a521f[_0x44e832[_0x4e11('0x2d')]]={'$like':'%'+_0x3dc5b9[_0x4e11('0x37')][_0x4e11('0x42')]+'%'};return _0x2a521f;}})});}_0x200322=_['merge']({},_0x200322,_0x3dc5b9['options']);var _0x378bb3={'where':_0x200322['where']};return db[_0x4e11('0x31')][_0x4e11('0x20')](_0x378bb3)['then'](function(_0x58e780){_0x438f83[_0x4e11('0x20')]=_0x58e780;if(_0x3dc5b9[_0x4e11('0x37')][_0x4e11('0x45')]){_0x200322[_0x4e11('0x46')]=[{'all':!![]}];}return db['MailServerOut'][_0x4e11('0x47')](_0x200322);})[_0x4e11('0x28')](function(_0x46ce96){_0x438f83[_0x4e11('0x48')]=_0x46ce96;return _0x438f83;})[_0x4e11('0x28')](respondWithFilteredResult(_0x30ce09,_0x200322))[_0x4e11('0x49')](handleError(_0x30ce09,null));};exports[_0x4e11('0x4a')]=function(_0x45cc50,_0x407c5e){var _0x871981={'raw':!![],'where':{'id':_0x45cc50[_0x4e11('0x4b')]['id']}},_0x45b277={};_0x45b277[_0x4e11('0x36')]=_[_0x4e11('0x38')](db['MailServerOut']['rawAttributes']);_0x45b277[_0x4e11('0x37')]=_[_0x4e11('0x38')](_0x45cc50[_0x4e11('0x37')]);_0x45b277[_0x4e11('0x39')]=_[_0x4e11('0x3a')](_0x45b277[_0x4e11('0x36')],_0x45b277[_0x4e11('0x37')]);_0x871981[_0x4e11('0x3b')]=_[_0x4e11('0x3a')](_0x45b277[_0x4e11('0x36')],qs[_0x4e11('0x3c')](_0x45cc50['query'][_0x4e11('0x3c')]));_0x871981[_0x4e11('0x3b')]=_0x871981[_0x4e11('0x3b')][_0x4e11('0x4c')]?_0x871981[_0x4e11('0x3b')]:_0x45b277[_0x4e11('0x36')];if(_0x45cc50[_0x4e11('0x37')][_0x4e11('0x45')]){_0x871981[_0x4e11('0x46')]=[{'all':!![]}];}_0x871981=_['merge']({},_0x871981,_0x45cc50[_0x4e11('0x4d')]);return db[_0x4e11('0x31')][_0x4e11('0x4e')](_0x871981)[_0x4e11('0x28')](handleEntityNotFound(_0x407c5e,null))[_0x4e11('0x28')](respondWithResult(_0x407c5e,null))[_0x4e11('0x49')](handleError(_0x407c5e,null));};exports[_0x4e11('0x4f')]=function(_0x2cd402,_0x1b86cd){return db[_0x4e11('0x31')][_0x4e11('0x4f')](_0x2cd402[_0x4e11('0x50')],{})['then'](respondWithResult(_0x1b86cd,0xc9))['catch'](handleError(_0x1b86cd,null));};exports[_0x4e11('0x27')]=function(_0x44f9a9,_0xa058cd){if(_0x44f9a9[_0x4e11('0x50')]['id']){delete _0x44f9a9['body']['id'];}return db[_0x4e11('0x31')]['find']({'where':{'id':_0x44f9a9['params']['id']}})['then'](handleEntityNotFound(_0xa058cd,null))['then'](saveUpdates(_0x44f9a9[_0x4e11('0x50')],null))[_0x4e11('0x28')](respondWithResult(_0xa058cd,null))[_0x4e11('0x49')](handleError(_0xa058cd,null));};exports[_0x4e11('0x29')]=function(_0x3f25a3,_0x5eb1b5){return db['MailServerOut'][_0x4e11('0x4e')]({'where':{'id':_0x3f25a3[_0x4e11('0x4b')]['id']}})[_0x4e11('0x28')](handleEntityNotFound(_0x5eb1b5,null))[_0x4e11('0x28')](removeEntity(_0x5eb1b5,null))['catch'](handleError(_0x5eb1b5,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 01ad5a2..dbb100a 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 _0x62fc=['MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x149a3f,_0x108447){var _0x4e2e2f=function(_0x36064d){while(--_0x36064d){_0x149a3f['push'](_0x149a3f['shift']());}};_0x4e2e2f(++_0x108447);}(_0x62fc,0x1bc));var _0xc62f=function(_0x47fdd1,_0x28d5a5){_0x47fdd1=_0x47fdd1-0x0;var _0x747e7d=_0x62fc[_0x47fdd1];return _0x747e7d;};'use strict';var _=require(_0xc62f('0x0'));var util=require(_0xc62f('0x1'));var logger=require(_0xc62f('0x2'))(_0xc62f('0x3'));var moment=require(_0xc62f('0x4'));var BPromise=require(_0xc62f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc62f('0x6'));var rimraf=require(_0xc62f('0x7'));var config=require(_0xc62f('0x8'));var attributes=require(_0xc62f('0x9'));module[_0xc62f('0xa')]=function(_0x2cc79a,_0x5460d0){return _0x2cc79a['define'](_0xc62f('0xb'),attributes,{'tableName':_0xc62f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08b6=['./mailServerOut.attributes','exports','define','MailServerOut','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);}(_0x08b6,0xb8));var _0x608b=function(_0x4fa3a1,_0x43d65f){_0x4fa3a1=_0x4fa3a1-0x0;var _0x5b3cb1=_0x08b6[_0x4fa3a1];return _0x5b3cb1;};'use strict';var _=require(_0x608b('0x0'));var util=require(_0x608b('0x1'));var logger=require(_0x608b('0x2'))(_0x608b('0x3'));var moment=require(_0x608b('0x4'));var BPromise=require(_0x608b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x608b('0x6'));var config=require(_0x608b('0x7'));var attributes=require(_0x608b('0x8'));module[_0x608b('0x9')]=function(_0x1855dd,_0x1d5786){return _0x1855dd[_0x608b('0xa')](_0x608b('0xb'),attributes,{'tableName':'mail_servers_out','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 c35d4b9..d4dad93 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(_0xea32f,_0x1ca14d){var _0x4618a2=function(_0x158d7e){while(--_0x158d7e){_0xea32f['push'](_0xea32f['shift']());}};_0x4618a2(++_0x1ca14d);}(_0x2ef3,0xba));var _0x32ef=function(_0x5eb9c0,_0x5daa04){_0x5eb9c0=_0x5eb9c0-0x0;var _0x23499d=_0x2ef3[_0x5eb9c0];return _0x23499d;};'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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x26216a,_0x10bd7d){var _0x1d6f92=function(_0x245343){while(--_0x245343){_0x26216a['push'](_0x26216a['shift']());}};_0x1d6f92(++_0x10bd7d);}(_0xdb28,0x106));var _0x8db2=function(_0x3a5653,_0x21e36c){_0x3a5653=_0x3a5653-0x0;var _0xba5cce=_0xdb28[_0x3a5653];return _0xba5cce;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 7d25055..1ceaa3e 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 _0x6f28=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x9ce40c,_0x5ea968){var _0x2ef180=function(_0x449961){while(--_0x449961){_0x9ce40c['push'](_0x9ce40c['shift']());}};_0x2ef180(++_0x5ea968);}(_0x6f28,0x1a4));var _0x86f2=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0x6f28[_0x1a72b8];return _0x39f72d;};'use strict';var multer=require('multer');var util=require(_0x86f2('0x0'));var path=require(_0x86f2('0x1'));var timeout=require(_0x86f2('0x2'));var express=require('express');var router=express[_0x86f2('0x3')]();var fs_extra=require(_0x86f2('0x4'));var auth=require(_0x86f2('0x5'));var interaction=require(_0x86f2('0x6'));var config=require(_0x86f2('0x7'));var controller=require('./mailSubstatus.controller');router[_0x86f2('0x8')]('/',auth[_0x86f2('0x9')](),controller['index']);router['get'](_0x86f2('0xa'),auth[_0x86f2('0x9')](),controller[_0x86f2('0xb')]);router[_0x86f2('0x8')](_0x86f2('0xc'),auth[_0x86f2('0x9')](),controller[_0x86f2('0xd')]);router[_0x86f2('0xe')]('/',auth['isAuthenticated'](),controller[_0x86f2('0xf')]);router[_0x86f2('0x10')](_0x86f2('0xc'),auth[_0x86f2('0x9')](),controller[_0x86f2('0x11')]);router[_0x86f2('0x12')](_0x86f2('0xc'),auth['isAuthenticated'](),controller[_0x86f2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1819=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x1819,0x107));var _0x9181=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0x1819[_0x16aaef];return _0x1c82ef;};'use strict';var multer=require(_0x9181('0x0'));var util=require(_0x9181('0x1'));var path=require('path');var timeout=require(_0x9181('0x2'));var express=require(_0x9181('0x3'));var router=express[_0x9181('0x4')]();var fs_extra=require(_0x9181('0x5'));var auth=require(_0x9181('0x6'));var interaction=require(_0x9181('0x7'));var config=require(_0x9181('0x8'));var controller=require(_0x9181('0x9'));router[_0x9181('0xa')]('/',auth[_0x9181('0xb')](),controller[_0x9181('0xc')]);router['get'](_0x9181('0xd'),auth['isAuthenticated'](),controller[_0x9181('0xe')]);router[_0x9181('0xa')]('/:id',auth[_0x9181('0xb')](),controller['show']);router[_0x9181('0xf')]('/',auth[_0x9181('0xb')](),controller[_0x9181('0x10')]);router['put'](_0x9181('0x11'),auth[_0x9181('0xb')](),controller[_0x9181('0x12')]);router[_0x9181('0x13')](_0x9181('0x11'),auth[_0x9181('0xb')](),controller[_0x9181('0x14')]);module[_0x9181('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 06eb742..864249a 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 _0xa899=['exports','STRING','sequelize'];(function(_0x3c7070,_0x849708){var _0x3a1f84=function(_0x418046){while(--_0x418046){_0x3c7070['push'](_0x3c7070['shift']());}};_0x3a1f84(++_0x849708);}(_0xa899,0x155));var _0x9a89=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0xa899[_0x1aa3fe];return _0x163cee;};'use strict';var Sequelize=require(_0x9a89('0x0'));module[_0x9a89('0x1')]={'name':{'type':Sequelize[_0x9a89('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9a89('0x2')]}}; \ No newline at end of file +var _0x7278=['name','sequelize','exports','STRING'];(function(_0x2d0953,_0x30bcf9){var _0x1e824a=function(_0x4ec9f1){while(--_0x4ec9f1){_0x2d0953['push'](_0x2d0953['shift']());}};_0x1e824a(++_0x30bcf9);}(_0x7278,0x161));var _0x8727=function(_0xe2d7da,_0x1af6c5){_0xe2d7da=_0xe2d7da-0x0;var _0x1d05d9=_0x7278[_0xe2d7da];return _0x1d05d9;};'use strict';var Sequelize=require(_0x8727('0x0'));module[_0x8727('0x1')]={'name':{'type':Sequelize[_0x8727('0x2')],'unique':_0x8727('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8727('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index da485aa..359dd25 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 _0xd7ed=['fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','then','stack','name','send','index','map','MailSubstatus','rawAttributes'];(function(_0x42e0f0,_0x15eddf){var _0x2a21cb=function(_0xe786cb){while(--_0xe786cb){_0x42e0f0['push'](_0x42e0f0['shift']());}};_0x2a21cb(++_0x15eddf);}(_0xd7ed,0x1e7));var _0xdd7e=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xd7ed[_0x44bcb0];return _0xfaf881;};'use strict';var emlformat=require(_0xdd7e('0x0'));var rimraf=require(_0xdd7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd7e('0x2'));var rp=require(_0xdd7e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdd7e('0x4'));var util=require(_0xdd7e('0x5'));var path=require(_0xdd7e('0x6'));var sox=require('sox');var csv=require(_0xdd7e('0x7'));var ejs=require(_0xdd7e('0x8'));var fs=require('fs');var fs_extra=require(_0xdd7e('0x9'));var _=require('lodash');var squel=require(_0xdd7e('0xa'));var crypto=require(_0xdd7e('0xb'));var jsforce=require(_0xdd7e('0xc'));var deskjs=require(_0xdd7e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdd7e('0xe'));var Papa=require(_0xdd7e('0xf'));var Redis=require('ioredis');var authService=require(_0xdd7e('0x10'));var qs=require(_0xdd7e('0x11'));var as=require(_0xdd7e('0x12'));var hardwareService=require(_0xdd7e('0x13'));var logger=require('../../config/logger')(_0xdd7e('0x14'));var utils=require(_0xdd7e('0x15'));var config=require(_0xdd7e('0x16'));var licenseUtil=require(_0xdd7e('0x17'));var db=require(_0xdd7e('0x18'))['db'];function respondWithStatusCode(_0x486551,_0x1a92ec){_0x1a92ec=_0x1a92ec||0xcc;return function(_0x53dd80){if(_0x53dd80){return _0x486551[_0xdd7e('0x19')](_0x1a92ec);}return _0x486551[_0xdd7e('0x1a')](_0x1a92ec)[_0xdd7e('0x1b')]();};}function respondWithResult(_0x43058b,_0x21bc64){_0x21bc64=_0x21bc64||0xc8;return function(_0xc14872){if(_0xc14872){return _0x43058b[_0xdd7e('0x1a')](_0x21bc64)[_0xdd7e('0x1c')](_0xc14872);}};}function respondWithFilteredResult(_0x10017c,_0x232d24){return function(_0x453758){if(_0x453758){var _0x4a911f=typeof _0x232d24['offset']==='undefined'&&typeof _0x232d24[_0xdd7e('0x1d')]===_0xdd7e('0x1e');var _0x363286=_0x453758[_0xdd7e('0x1f')];var _0x5d2ebd=_0x4a911f?0x0:_0x232d24['offset'];var _0x17a160=_0x4a911f?_0x453758[_0xdd7e('0x1f')]:_0x232d24[_0xdd7e('0x20')]+_0x232d24['limit'];var _0x2300f3;if(_0x17a160>=_0x363286){_0x17a160=_0x363286;_0x2300f3=0xc8;}else{_0x2300f3=0xce;}_0x10017c[_0xdd7e('0x1a')](_0x2300f3);return _0x10017c[_0xdd7e('0x21')]('Content-Range',_0x5d2ebd+'-'+_0x17a160+'/'+_0x363286)[_0xdd7e('0x1c')](_0x453758);}return null;};}function patchUpdates(_0x1a79bd){return function(_0x2d5d94){try{jsonpatch[_0xdd7e('0x22')](_0x2d5d94,_0x1a79bd,!![]);}catch(_0x29a139){return BPromise[_0xdd7e('0x23')](_0x29a139);}return _0x2d5d94['save']();};}function saveUpdates(_0x10670e,_0x27dc10){return function(_0x48555a){if(_0x48555a){return _0x48555a[_0xdd7e('0x24')](_0x10670e)[_0xdd7e('0x25')](function(_0x95960){return _0x95960;});}return null;};}function removeEntity(_0x38507c,_0x171ea6){return function(_0x2a3f26){if(_0x2a3f26){return _0x2a3f26['destroy']()[_0xdd7e('0x25')](function(){_0x38507c['status'](0xcc)[_0xdd7e('0x1b')]();});}};}function handleEntityNotFound(_0x9258ed,_0x406468){return function(_0x101c71){if(!_0x101c71){_0x9258ed[_0xdd7e('0x19')](0x194);}return _0x101c71;};}function handleError(_0xd4186c,_0x553055){_0x553055=_0x553055||0x1f4;return function(_0x5ba445){logger['error'](_0x5ba445[_0xdd7e('0x26')]);if(_0x5ba445[_0xdd7e('0x27')]){delete _0x5ba445[_0xdd7e('0x27')];}_0xd4186c['status'](_0x553055)[_0xdd7e('0x28')](_0x5ba445);};}exports[_0xdd7e('0x29')]=function(_0x14cd46,_0xfeb6ec){var _0x4f06d9={},_0x1b9d6e={},_0x3b5e57={'count':0x0,'rows':[]};var _0xde5f12=_[_0xdd7e('0x2a')](db[_0xdd7e('0x2b')][_0xdd7e('0x2c')],function(_0x31dabf){return{'name':_0x31dabf[_0xdd7e('0x2d')],'type':_0x31dabf['type'][_0xdd7e('0x2e')]};});_0x1b9d6e['model']=_[_0xdd7e('0x2a')](_0xde5f12,_0xdd7e('0x27'));_0x1b9d6e[_0xdd7e('0x2f')]=_[_0xdd7e('0x30')](_0x14cd46[_0xdd7e('0x2f')]);_0x1b9d6e[_0xdd7e('0x31')]=_[_0xdd7e('0x32')](_0x1b9d6e[_0xdd7e('0x33')],_0x1b9d6e[_0xdd7e('0x2f')]);_0x4f06d9[_0xdd7e('0x34')]=_['intersection'](_0x1b9d6e['model'],qs[_0xdd7e('0x35')](_0x14cd46[_0xdd7e('0x2f')][_0xdd7e('0x35')]));_0x4f06d9['attributes']=_0x4f06d9[_0xdd7e('0x34')][_0xdd7e('0x36')]?_0x4f06d9[_0xdd7e('0x34')]:_0x1b9d6e[_0xdd7e('0x33')];if(!_0x14cd46[_0xdd7e('0x2f')][_0xdd7e('0x37')](_0xdd7e('0x38'))){_0x4f06d9[_0xdd7e('0x1d')]=qs[_0xdd7e('0x1d')](_0x14cd46[_0xdd7e('0x2f')][_0xdd7e('0x1d')]);_0x4f06d9[_0xdd7e('0x20')]=qs[_0xdd7e('0x20')](_0x14cd46[_0xdd7e('0x2f')][_0xdd7e('0x20')]);}_0x4f06d9[_0xdd7e('0x39')]=qs[_0xdd7e('0x3a')](_0x14cd46[_0xdd7e('0x2f')][_0xdd7e('0x3a')]);_0x4f06d9[_0xdd7e('0x3b')]=qs[_0xdd7e('0x31')](_[_0xdd7e('0x3c')](_0x14cd46[_0xdd7e('0x2f')],_0x1b9d6e[_0xdd7e('0x31')]),_0xde5f12);if(_0x14cd46['query'][_0xdd7e('0x3d')]){_0x4f06d9['where']=_['merge'](_0x4f06d9[_0xdd7e('0x3b')],{'$or':_[_0xdd7e('0x2a')](_0xde5f12,function(_0x1a9744){if(_0x1a9744[_0xdd7e('0x3e')]!==_0xdd7e('0x3f')){var _0x233c81={};_0x233c81[_0x1a9744[_0xdd7e('0x27')]]={'$like':'%'+_0x14cd46['query']['filter']+'%'};return _0x233c81;}})});}_0x4f06d9=_[_0xdd7e('0x40')]({},_0x4f06d9,_0x14cd46[_0xdd7e('0x41')]);var _0x4b13b1={'where':_0x4f06d9[_0xdd7e('0x3b')]};return db[_0xdd7e('0x2b')][_0xdd7e('0x1f')](_0x4b13b1)[_0xdd7e('0x25')](function(_0x2a221c){_0x3b5e57['count']=_0x2a221c;if(_0x14cd46[_0xdd7e('0x2f')][_0xdd7e('0x42')]){_0x4f06d9[_0xdd7e('0x43')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x4f06d9);})[_0xdd7e('0x25')](function(_0x504859){_0x3b5e57['rows']=_0x504859;return _0x3b5e57;})[_0xdd7e('0x25')](respondWithFilteredResult(_0xfeb6ec,_0x4f06d9))[_0xdd7e('0x44')](handleError(_0xfeb6ec,null));};exports[_0xdd7e('0x45')]=function(_0x4bdc43,_0x4e144f){var _0x593461={'raw':!![],'where':{'id':_0x4bdc43[_0xdd7e('0x46')]['id']}},_0x4dbd7c={};_0x4dbd7c[_0xdd7e('0x33')]=_[_0xdd7e('0x30')](db[_0xdd7e('0x2b')][_0xdd7e('0x2c')]);_0x4dbd7c[_0xdd7e('0x2f')]=_[_0xdd7e('0x30')](_0x4bdc43['query']);_0x4dbd7c['filters']=_[_0xdd7e('0x32')](_0x4dbd7c['model'],_0x4dbd7c['query']);_0x593461[_0xdd7e('0x34')]=_[_0xdd7e('0x32')](_0x4dbd7c['model'],qs[_0xdd7e('0x35')](_0x4bdc43[_0xdd7e('0x2f')][_0xdd7e('0x35')]));_0x593461[_0xdd7e('0x34')]=_0x593461[_0xdd7e('0x34')]['length']?_0x593461[_0xdd7e('0x34')]:_0x4dbd7c[_0xdd7e('0x33')];if(_0x4bdc43[_0xdd7e('0x2f')]['includeAll']){_0x593461[_0xdd7e('0x43')]=[{'all':!![]}];}_0x593461=_['merge']({},_0x593461,_0x4bdc43['options']);return db['MailSubstatus'][_0xdd7e('0x47')](_0x593461)['then'](handleEntityNotFound(_0x4e144f,null))[_0xdd7e('0x25')](respondWithResult(_0x4e144f,null))[_0xdd7e('0x44')](handleError(_0x4e144f,null));};exports['create']=function(_0x5577bb,_0x544e69){return db[_0xdd7e('0x2b')][_0xdd7e('0x48')](_0x5577bb[_0xdd7e('0x49')],{})[_0xdd7e('0x25')](respondWithResult(_0x544e69,0xc9))['catch'](handleError(_0x544e69,null));};exports[_0xdd7e('0x24')]=function(_0x2b2a65,_0x5dad33){if(_0x2b2a65['body']['id']){delete _0x2b2a65['body']['id'];}return db['MailSubstatus'][_0xdd7e('0x47')]({'where':{'id':_0x2b2a65['params']['id']}})[_0xdd7e('0x25')](handleEntityNotFound(_0x5dad33,null))[_0xdd7e('0x25')](saveUpdates(_0x2b2a65[_0xdd7e('0x49')],null))[_0xdd7e('0x25')](respondWithResult(_0x5dad33,null))[_0xdd7e('0x44')](handleError(_0x5dad33,null));};exports[_0xdd7e('0x4a')]=function(_0xf91fbe,_0x4e2df1){return db['MailSubstatus'][_0xdd7e('0x47')]({'where':{'id':_0xf91fbe[_0xdd7e('0x46')]['id']}})[_0xdd7e('0x25')](handleEntityNotFound(_0x4e2df1,null))[_0xdd7e('0x25')](removeEntity(_0x4e2df1,null))['catch'](handleError(_0x4e2df1,null));};exports['describe']=function(_0x15b21a,_0x1333b5){return db[_0xdd7e('0x2b')][_0xdd7e('0x4b')]()[_0xdd7e('0x25')](respondWithResult(_0x1333b5,null))['catch'](handleError(_0x1333b5,null));}; \ No newline at end of file +var _0x8000=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','MailSubstatus','count','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs'];(function(_0x641958,_0x956c3){var _0x20abf3=function(_0x1bf199){while(--_0x1bf199){_0x641958['push'](_0x641958['shift']());}};_0x20abf3(++_0x956c3);}(_0x8000,0x83));var _0x0800=function(_0x45614f,_0x2b7443){_0x45614f=_0x45614f-0x0;var _0x438e13=_0x8000[_0x45614f];return _0x438e13;};'use strict';var emlformat=require(_0x0800('0x0'));var rimraf=require(_0x0800('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0800('0x2'));var rp=require('request-promise');var moment=require(_0x0800('0x3'));var BPromise=require(_0x0800('0x4'));var Mustache=require(_0x0800('0x5'));var util=require(_0x0800('0x6'));var path=require(_0x0800('0x7'));var sox=require(_0x0800('0x8'));var csv=require(_0x0800('0x9'));var ejs=require(_0x0800('0xa'));var fs=require('fs');var fs_extra=require(_0x0800('0xb'));var _=require(_0x0800('0xc'));var squel=require(_0x0800('0xd'));var crypto=require(_0x0800('0xe'));var jsforce=require(_0x0800('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0800('0x10'));var Papa=require('papaparse');var Redis=require(_0x0800('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0800('0x12'));var as=require(_0x0800('0x13'));var hardwareService=require(_0x0800('0x14'));var logger=require(_0x0800('0x15'))(_0x0800('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0800('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bdb7f,_0x18d53c){_0x18d53c=_0x18d53c||0xcc;return function(_0x927fde){if(_0x927fde){return _0x5bdb7f[_0x0800('0x18')](_0x18d53c);}return _0x5bdb7f[_0x0800('0x19')](_0x18d53c)['end']();};}function respondWithResult(_0x24c46f,_0x5668a1){_0x5668a1=_0x5668a1||0xc8;return function(_0x2a1560){if(_0x2a1560){return _0x24c46f[_0x0800('0x19')](_0x5668a1)[_0x0800('0x1a')](_0x2a1560);}};}function respondWithFilteredResult(_0x30c212,_0x42a7f6){return function(_0x343381){if(_0x343381){var _0x362d08=typeof _0x42a7f6[_0x0800('0x1b')]===_0x0800('0x1c')&&typeof _0x42a7f6[_0x0800('0x1d')]==='undefined';var _0x1f2365=_0x343381['count'];var _0x54113f=_0x362d08?0x0:_0x42a7f6[_0x0800('0x1b')];var _0x23179b=_0x362d08?_0x343381['count']:_0x42a7f6[_0x0800('0x1b')]+_0x42a7f6[_0x0800('0x1d')];var _0x399c3;if(_0x23179b>=_0x1f2365){_0x23179b=_0x1f2365;_0x399c3=0xc8;}else{_0x399c3=0xce;}_0x30c212[_0x0800('0x19')](_0x399c3);return _0x30c212[_0x0800('0x1e')](_0x0800('0x1f'),_0x54113f+'-'+_0x23179b+'/'+_0x1f2365)['json'](_0x343381);}return null;};}function patchUpdates(_0x24f881){return function(_0x109b71){try{jsonpatch[_0x0800('0x20')](_0x109b71,_0x24f881,!![]);}catch(_0x1c4b68){return BPromise['reject'](_0x1c4b68);}return _0x109b71[_0x0800('0x21')]();};}function saveUpdates(_0x98c2f5,_0xc880c7){return function(_0x224062){if(_0x224062){return _0x224062[_0x0800('0x22')](_0x98c2f5)[_0x0800('0x23')](function(_0xa33133){return _0xa33133;});}return null;};}function removeEntity(_0x2d0ece,_0x13c87f){return function(_0x4bac3b){if(_0x4bac3b){return _0x4bac3b[_0x0800('0x24')]()[_0x0800('0x23')](function(){_0x2d0ece['status'](0xcc)[_0x0800('0x25')]();});}};}function handleEntityNotFound(_0x33c103,_0x31689b){return function(_0x38cad9){if(!_0x38cad9){_0x33c103[_0x0800('0x18')](0x194);}return _0x38cad9;};}function handleError(_0x39b45b,_0x10b6e5){_0x10b6e5=_0x10b6e5||0x1f4;return function(_0x3a9742){logger['error'](_0x3a9742[_0x0800('0x26')]);if(_0x3a9742[_0x0800('0x27')]){delete _0x3a9742[_0x0800('0x27')];}_0x39b45b[_0x0800('0x19')](_0x10b6e5)[_0x0800('0x28')](_0x3a9742);};}exports['index']=function(_0x1487d5,_0x14defa){var _0x145624={},_0x599bf8={},_0x1d2080={'count':0x0,'rows':[]};var _0x25cac4=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x148450){return{'name':_0x148450[_0x0800('0x29')],'type':_0x148450['type'][_0x0800('0x2a')]};});_0x599bf8[_0x0800('0x2b')]=_[_0x0800('0x2c')](_0x25cac4,_0x0800('0x27'));_0x599bf8[_0x0800('0x2d')]=_[_0x0800('0x2e')](_0x1487d5[_0x0800('0x2d')]);_0x599bf8[_0x0800('0x2f')]=_[_0x0800('0x30')](_0x599bf8[_0x0800('0x2b')],_0x599bf8[_0x0800('0x2d')]);_0x145624[_0x0800('0x31')]=_[_0x0800('0x30')](_0x599bf8['model'],qs[_0x0800('0x32')](_0x1487d5[_0x0800('0x2d')]['fields']));_0x145624['attributes']=_0x145624['attributes'][_0x0800('0x33')]?_0x145624['attributes']:_0x599bf8['model'];if(!_0x1487d5[_0x0800('0x2d')][_0x0800('0x34')](_0x0800('0x35'))){_0x145624[_0x0800('0x1d')]=qs[_0x0800('0x1d')](_0x1487d5[_0x0800('0x2d')][_0x0800('0x1d')]);_0x145624[_0x0800('0x1b')]=qs[_0x0800('0x1b')](_0x1487d5['query'][_0x0800('0x1b')]);}_0x145624[_0x0800('0x36')]=qs[_0x0800('0x37')](_0x1487d5[_0x0800('0x2d')][_0x0800('0x37')]);_0x145624['where']=qs[_0x0800('0x2f')](_[_0x0800('0x38')](_0x1487d5[_0x0800('0x2d')],_0x599bf8['filters']),_0x25cac4);if(_0x1487d5[_0x0800('0x2d')][_0x0800('0x39')]){_0x145624[_0x0800('0x3a')]=_['merge'](_0x145624[_0x0800('0x3a')],{'$or':_[_0x0800('0x2c')](_0x25cac4,function(_0x497c47){if(_0x497c47[_0x0800('0x3b')]!==_0x0800('0x3c')){var _0xcabc1b={};_0xcabc1b[_0x497c47[_0x0800('0x27')]]={'$like':'%'+_0x1487d5[_0x0800('0x2d')][_0x0800('0x39')]+'%'};return _0xcabc1b;}})});}_0x145624=_[_0x0800('0x3d')]({},_0x145624,_0x1487d5[_0x0800('0x3e')]);var _0xf64cc9={'where':_0x145624[_0x0800('0x3a')]};return db[_0x0800('0x3f')][_0x0800('0x40')](_0xf64cc9)[_0x0800('0x23')](function(_0x965b41){_0x1d2080['count']=_0x965b41;if(_0x1487d5['query']['includeAll']){_0x145624[_0x0800('0x41')]=[{'all':!![]}];}return db[_0x0800('0x3f')][_0x0800('0x42')](_0x145624);})[_0x0800('0x23')](function(_0x37f33e){_0x1d2080[_0x0800('0x43')]=_0x37f33e;return _0x1d2080;})['then'](respondWithFilteredResult(_0x14defa,_0x145624))[_0x0800('0x44')](handleError(_0x14defa,null));};exports[_0x0800('0x45')]=function(_0x36c31e,_0x42ae01){var _0x3279bd={'raw':!![],'where':{'id':_0x36c31e[_0x0800('0x46')]['id']}},_0x3a301f={};_0x3a301f[_0x0800('0x2b')]=_[_0x0800('0x2e')](db[_0x0800('0x3f')]['rawAttributes']);_0x3a301f[_0x0800('0x2d')]=_[_0x0800('0x2e')](_0x36c31e[_0x0800('0x2d')]);_0x3a301f[_0x0800('0x2f')]=_[_0x0800('0x30')](_0x3a301f[_0x0800('0x2b')],_0x3a301f[_0x0800('0x2d')]);_0x3279bd[_0x0800('0x31')]=_['intersection'](_0x3a301f[_0x0800('0x2b')],qs[_0x0800('0x32')](_0x36c31e[_0x0800('0x2d')]['fields']));_0x3279bd['attributes']=_0x3279bd[_0x0800('0x31')][_0x0800('0x33')]?_0x3279bd[_0x0800('0x31')]:_0x3a301f[_0x0800('0x2b')];if(_0x36c31e['query']['includeAll']){_0x3279bd[_0x0800('0x41')]=[{'all':!![]}];}_0x3279bd=_['merge']({},_0x3279bd,_0x36c31e[_0x0800('0x3e')]);return db['MailSubstatus']['find'](_0x3279bd)['then'](handleEntityNotFound(_0x42ae01,null))['then'](respondWithResult(_0x42ae01,null))[_0x0800('0x44')](handleError(_0x42ae01,null));};exports['create']=function(_0xe482db,_0x367139){return db[_0x0800('0x3f')][_0x0800('0x47')](_0xe482db[_0x0800('0x48')],{})['then'](respondWithResult(_0x367139,0xc9))[_0x0800('0x44')](handleError(_0x367139,null));};exports[_0x0800('0x22')]=function(_0x52f9ba,_0x5c4796){if(_0x52f9ba['body']['id']){delete _0x52f9ba[_0x0800('0x48')]['id'];}return db[_0x0800('0x3f')][_0x0800('0x49')]({'where':{'id':_0x52f9ba[_0x0800('0x46')]['id']}})[_0x0800('0x23')](handleEntityNotFound(_0x5c4796,null))[_0x0800('0x23')](saveUpdates(_0x52f9ba[_0x0800('0x48')],null))['then'](respondWithResult(_0x5c4796,null))[_0x0800('0x44')](handleError(_0x5c4796,null));};exports[_0x0800('0x24')]=function(_0x562a35,_0x3c94d0){return db[_0x0800('0x3f')][_0x0800('0x49')]({'where':{'id':_0x562a35[_0x0800('0x46')]['id']}})[_0x0800('0x23')](handleEntityNotFound(_0x3c94d0,null))[_0x0800('0x23')](removeEntity(_0x3c94d0,null))[_0x0800('0x44')](handleError(_0x3c94d0,null));};exports['describe']=function(_0x94ea50,_0x3aed08){return db[_0x0800('0x3f')][_0x0800('0x4a')]()[_0x0800('0x23')](respondWithResult(_0x3aed08,null))[_0x0800('0x44')](handleError(_0x3aed08,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 6e1bb52..d6199ed 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 _0xc562=['hook','events','../../mysqldb','MailSubstatus','emit','hasOwnProperty'];(function(_0xb3e611,_0x1a6c71){var _0x51c73d=function(_0x336a6c){while(--_0x336a6c){_0xb3e611['push'](_0xb3e611['shift']());}};_0x51c73d(++_0x1a6c71);}(_0xc562,0xcd));var _0x2c56=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc562[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0x2c56('0x0'));var MailSubstatus=require(_0x2c56('0x1'))['db'][_0x2c56('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x4d90c7){return function(_0x54b29e,_0x60eb71,_0x4ac394){MailSubstatusEvents[_0x2c56('0x3')](_0x4d90c7+':'+_0x54b29e['id'],_0x54b29e);MailSubstatusEvents[_0x2c56('0x3')](_0x4d90c7,_0x54b29e);_0x4ac394(null);};}for(var e in events){if(events[_0x2c56('0x4')](e)){var event=events[e];MailSubstatus[_0x2c56('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xe0ac=['setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x204198,_0x8139d0){var _0x281e02=function(_0x8694c1){while(--_0x8694c1){_0x204198['push'](_0x204198['shift']());}};_0x281e02(++_0x8139d0);}(_0xe0ac,0x1b7));var _0xce0a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0ac[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xce0a('0x0'));var MailSubstatus=require(_0xce0a('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xce0a('0x2')](0x0);var events={'afterUpdate':_0xce0a('0x3')};function emitEvent(_0x34c4f8){return function(_0x305b66,_0x5d56c6,_0x2f6d18){MailSubstatusEvents['emit'](_0x34c4f8+':'+_0x305b66['id'],_0x305b66);MailSubstatusEvents[_0xce0a('0x4')](_0x34c4f8,_0x305b66);_0x2f6d18(null);};}for(var e in events){if(events[_0xce0a('0x5')](e)){var event=events[e];MailSubstatus[_0xce0a('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f4de3ce..5c5387a 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 _0x274e=['update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','models','define','MailSubstatus','mail_substatuses','Condition'];(function(_0x4b0830,_0x2e3b0a){var _0x1f53a7=function(_0x4b5503){while(--_0x4b5503){_0x4b0830['push'](_0x4b0830['shift']());}};_0x1f53a7(++_0x2e3b0a);}(_0x274e,0x11a));var _0xe274=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x274e[_0x21549c];return _0x426cbd;};'use strict';var attributes=require(_0xe274('0x0'));module['exports']=function(_0x225d07){var _0x183851=_0x225d07[_0xe274('0x1')];return _0x225d07[_0xe274('0x2')](_0xe274('0x3'),attributes,{'tableName':_0xe274('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2fed80,_0x1d1d02,_0x3983e0){return _0x183851[_0xe274('0x5')][_0xe274('0x6')]({'value':_0x2fed80[_0xe274('0x7')]},{'where':{'field':_0xe274('0x8'),'value':_0x2fed80[_0xe274('0x9')]['name']}})[_0xe274('0xa')](function(){_0x3983e0();})[_0xe274('0xb')](function(_0x387970){_0x3983e0(_0x387970);});}}});}; \ No newline at end of file +var _0xd2f5=['define','update','name','mailSubstatus','then','catch','./mailSubstatus.attributes','exports'];(function(_0x13d9bb,_0x2399b1){var _0x288829=function(_0x565f76){while(--_0x565f76){_0x13d9bb['push'](_0x13d9bb['shift']());}};_0x288829(++_0x2399b1);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x58dd36,_0x535bb5){_0x58dd36=_0x58dd36-0x0;var _0x56ee1c=_0xd2f5[_0x58dd36];return _0x56ee1c;};'use strict';var attributes=require(_0x5d2f('0x0'));module[_0x5d2f('0x1')]=function(_0x44d650){var _0x1605c5=_0x44d650['models'];return _0x44d650[_0x5d2f('0x2')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x11bc44,_0x436447,_0x263891){return _0x1605c5['Condition'][_0x5d2f('0x3')]({'value':_0x11bc44[_0x5d2f('0x4')]},{'where':{'field':_0x5d2f('0x5'),'value':_0x11bc44['_previousDataValues'][_0x5d2f('0x4')]}})[_0x5d2f('0x6')](function(){_0x263891();})[_0x5d2f('0x7')](function(_0x485432){_0x263891(_0x485432);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a39be98..71a2783 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 _0xeb1c=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x42a568,_0x1e431a){var _0x5b1306=function(_0x295c46){while(--_0x295c46){_0x42a568['push'](_0x42a568['shift']());}};_0x5b1306(++_0x1e431a);}(_0xeb1c,0x185));var _0xceb1=function(_0x5ba627,_0x4f5555){_0x5ba627=_0x5ba627-0x0;var _0xda7af3=_0xeb1c[_0x5ba627];return _0xda7af3;};'use strict';var _=require(_0xceb1('0x0'));var util=require(_0xceb1('0x1'));var moment=require(_0xceb1('0x2'));var BPromise=require('bluebird');var rs=require(_0xceb1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceb1('0x4'))['db'];var utils=require(_0xceb1('0x5'));var logger=require(_0xceb1('0x6'))(_0xceb1('0x7'));var config=require(_0xceb1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xceb1('0x9')][_0xceb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3378b0,_0xc5815b,_0x4228fb){return new BPromise(function(_0x160724,_0x453356){return client['request'](_0x3378b0,_0x4228fb)[_0xceb1('0xb')](function(_0x39ddcb){logger[_0xceb1('0xc')](_0xceb1('0xd'),_0xc5815b,'request\x20sent');logger[_0xceb1('0xe')](_0xceb1('0xf'),_0xc5815b,_0xceb1('0x10'),JSON[_0xceb1('0x11')](_0x39ddcb));if(_0x39ddcb[_0xceb1('0x12')]){if(_0x39ddcb[_0xceb1('0x12')][_0xceb1('0x13')]===0x1f4){logger[_0xceb1('0x12')]('MailSubstatus,\x20%s,\x20%s',_0xc5815b,_0x39ddcb[_0xceb1('0x12')][_0xceb1('0x14')]);return _0x453356(_0x39ddcb[_0xceb1('0x12')][_0xceb1('0x14')]);}logger[_0xceb1('0x12')](_0xceb1('0xd'),_0xc5815b,_0x39ddcb[_0xceb1('0x12')]['message']);return _0x160724(_0x39ddcb[_0xceb1('0x12')]['message']);}else{logger[_0xceb1('0xc')]('MailSubstatus,\x20%s,\x20%s',_0xc5815b,_0xceb1('0x10'));_0x160724(_0x39ddcb[_0xceb1('0x15')][_0xceb1('0x14')]);}})[_0xceb1('0x16')](function(_0xb4fe79){logger['error'](_0xceb1('0xd'),_0xc5815b,_0xb4fe79);_0x453356(_0xb4fe79);});});} \ No newline at end of file +var _0x246b=['stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x33314d,_0x499628){var _0x4ffe8e=function(_0xb1ec35){while(--_0xb1ec35){_0x33314d['push'](_0x33314d['shift']());}};_0x4ffe8e(++_0x499628);}(_0x246b,0xe1));var _0xb246=function(_0x3a4106,_0x5c1250){_0x3a4106=_0x3a4106-0x0;var _0x16aaab=_0x246b[_0x3a4106];return _0x16aaab;};'use strict';var _=require(_0xb246('0x0'));var util=require(_0xb246('0x1'));var moment=require(_0xb246('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb246('0x3'));var db=require(_0xb246('0x4'))['db'];var utils=require(_0xb246('0x5'));var logger=require(_0xb246('0x6'))(_0xb246('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb246('0x8')][_0xb246('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50e84c,_0x48f755,_0x1c860e){return new BPromise(function(_0x10e441,_0xcec729){return client['request'](_0x50e84c,_0x1c860e)[_0xb246('0xa')](function(_0x407593){logger[_0xb246('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x48f755,_0xb246('0xc'));logger[_0xb246('0xd')](_0xb246('0xe'),_0x48f755,_0xb246('0xc'),JSON[_0xb246('0xf')](_0x407593));if(_0x407593[_0xb246('0x10')]){if(_0x407593[_0xb246('0x10')][_0xb246('0x11')]===0x1f4){logger[_0xb246('0x10')](_0xb246('0x12'),_0x48f755,_0x407593[_0xb246('0x10')][_0xb246('0x13')]);return _0xcec729(_0x407593[_0xb246('0x10')][_0xb246('0x13')]);}logger[_0xb246('0x10')](_0xb246('0x12'),_0x48f755,_0x407593[_0xb246('0x10')][_0xb246('0x13')]);return _0x10e441(_0x407593[_0xb246('0x10')]['message']);}else{logger[_0xb246('0xb')](_0xb246('0x12'),_0x48f755,_0xb246('0xc'));_0x10e441(_0x407593['result'][_0xb246('0x13')]);}})['catch'](function(_0x1ae1c4){logger[_0xb246('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x48f755,_0x1ae1c4);_0xcec729(_0x1ae1c4);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fb14f8f..602b5f1 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 _0xa1f1=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','delete','destroy','exports','multer'];(function(_0x45bb14,_0x245555){var _0x32dff1=function(_0x593e4e){while(--_0x593e4e){_0x45bb14['push'](_0x45bb14['shift']());}};_0x32dff1(++_0x245555);}(_0xa1f1,0x92));var _0x1a1f=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xa1f1[_0x2ae2ad];return _0x26dbd7;};'use strict';var multer=require(_0x1a1f('0x0'));var util=require(_0x1a1f('0x1'));var path=require(_0x1a1f('0x2'));var timeout=require(_0x1a1f('0x3'));var express=require(_0x1a1f('0x4'));var router=express[_0x1a1f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1a1f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1a1f('0x7'));var controller=require(_0x1a1f('0x8'));router[_0x1a1f('0x9')]('/',auth[_0x1a1f('0xa')](),controller[_0x1a1f('0xb')]);router[_0x1a1f('0x9')](_0x1a1f('0xc'),auth[_0x1a1f('0xa')](),controller[_0x1a1f('0xd')]);router[_0x1a1f('0x9')]('/:id',auth[_0x1a1f('0xa')](),controller[_0x1a1f('0xe')]);router[_0x1a1f('0xf')]('/',auth[_0x1a1f('0xa')](),controller[_0x1a1f('0x10')]);router[_0x1a1f('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1a1f('0x12')]('/:id',auth[_0x1a1f('0xa')](),controller[_0x1a1f('0x13')]);module[_0x1a1f('0x14')]=router; \ No newline at end of file +var _0xa08f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa08f,0x14c));var _0xfa08=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa08f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfa08('0x0'));var util=require(_0xfa08('0x1'));var path=require(_0xfa08('0x2'));var timeout=require(_0xfa08('0x3'));var express=require(_0xfa08('0x4'));var router=express[_0xfa08('0x5')]();var fs_extra=require(_0xfa08('0x6'));var auth=require(_0xfa08('0x7'));var interaction=require(_0xfa08('0x8'));var config=require(_0xfa08('0x9'));var controller=require('./mailTransferReport.controller');router[_0xfa08('0xa')]('/',auth[_0xfa08('0xb')](),controller[_0xfa08('0xc')]);router[_0xfa08('0xa')](_0xfa08('0xd'),auth[_0xfa08('0xb')](),controller[_0xfa08('0xe')]);router['get'](_0xfa08('0xf'),auth[_0xfa08('0xb')](),controller[_0xfa08('0x10')]);router[_0xfa08('0x11')]('/',auth['isAuthenticated'](),controller[_0xfa08('0x12')]);router[_0xfa08('0x13')](_0xfa08('0xf'),auth[_0xfa08('0xb')](),controller[_0xfa08('0x14')]);router[_0xfa08('0x15')]('/:id',auth[_0xfa08('0xb')](),controller[_0xfa08('0x16')]);module[_0xfa08('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index dfb0470..fc79d2e 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x890014,_0x2b265a){var _0x280626=function(_0x44feb1){while(--_0x44feb1){_0x890014['push'](_0x890014['shift']());}};_0x280626(++_0x2b265a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xcb91[_0x288f5e];return _0x476cc9;};'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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x3d88be,_0x3aeaf6){var _0x5ceaa2=function(_0x1c6d93){while(--_0x1c6d93){_0x3d88be['push'](_0x3d88be['shift']());}};_0x5ceaa2(++_0x3aeaf6);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4c9ae0,_0x719c98){_0x4c9ae0=_0x4c9ae0-0x0;var _0x5a1539=_0xf4eb[_0x4c9ae0];return _0x5a1539;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 1079ba7..007e2db 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 _0xb6f9=['show','params','keys','find','create','body','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','name','map','MailTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x4114dd,_0x2ad862){var _0x26f44c=function(_0xad2246){while(--_0xad2246){_0x4114dd['push'](_0x4114dd['shift']());}};_0x26f44c(++_0x2ad862);}(_0xb6f9,0x137));var _0x9b6f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb6f9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9b6f('0x0'));var rimraf=require(_0x9b6f('0x1'));var zipdir=require(_0x9b6f('0x2'));var jsonpatch=require(_0x9b6f('0x3'));var rp=require(_0x9b6f('0x4'));var moment=require('moment');var BPromise=require(_0x9b6f('0x5'));var Mustache=require(_0x9b6f('0x6'));var util=require(_0x9b6f('0x7'));var path=require(_0x9b6f('0x8'));var sox=require(_0x9b6f('0x9'));var csv=require(_0x9b6f('0xa'));var ejs=require(_0x9b6f('0xb'));var fs=require('fs');var fs_extra=require(_0x9b6f('0xc'));var _=require(_0x9b6f('0xd'));var squel=require('squel');var crypto=require(_0x9b6f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9b6f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9b6f('0x10'));var Redis=require(_0x9b6f('0x11'));var authService=require(_0x9b6f('0x12'));var qs=require(_0x9b6f('0x13'));var as=require(_0x9b6f('0x14'));var hardwareService=require(_0x9b6f('0x15'));var logger=require('../../config/logger')(_0x9b6f('0x16'));var utils=require(_0x9b6f('0x17'));var config=require(_0x9b6f('0x18'));var licenseUtil=require(_0x9b6f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x370bb0,_0x5d5be0){_0x5d5be0=_0x5d5be0||0xcc;return function(_0x44e6ea){if(_0x44e6ea){return _0x370bb0[_0x9b6f('0x1a')](_0x5d5be0);}return _0x370bb0['status'](_0x5d5be0)[_0x9b6f('0x1b')]();};}function respondWithResult(_0x448a34,_0x54a1f2){_0x54a1f2=_0x54a1f2||0xc8;return function(_0xda130e){if(_0xda130e){return _0x448a34[_0x9b6f('0x1c')](_0x54a1f2)[_0x9b6f('0x1d')](_0xda130e);}};}function respondWithFilteredResult(_0xce61a9,_0x30f2a1){return function(_0x1b7513){if(_0x1b7513){var _0x21032c=typeof _0x30f2a1[_0x9b6f('0x1e')]==='undefined'&&typeof _0x30f2a1[_0x9b6f('0x1f')]===_0x9b6f('0x20');var _0x40afed=_0x1b7513[_0x9b6f('0x21')];var _0x10e876=_0x21032c?0x0:_0x30f2a1['offset'];var _0x4424b4=_0x21032c?_0x1b7513[_0x9b6f('0x21')]:_0x30f2a1[_0x9b6f('0x1e')]+_0x30f2a1[_0x9b6f('0x1f')];var _0x4c4703;if(_0x4424b4>=_0x40afed){_0x4424b4=_0x40afed;_0x4c4703=0xc8;}else{_0x4c4703=0xce;}_0xce61a9[_0x9b6f('0x1c')](_0x4c4703);return _0xce61a9[_0x9b6f('0x22')]('Content-Range',_0x10e876+'-'+_0x4424b4+'/'+_0x40afed)[_0x9b6f('0x1d')](_0x1b7513);}return null;};}function patchUpdates(_0x1c1c2a){return function(_0x5f1f3b){try{jsonpatch[_0x9b6f('0x23')](_0x5f1f3b,_0x1c1c2a,!![]);}catch(_0x2fbc0e){return BPromise[_0x9b6f('0x24')](_0x2fbc0e);}return _0x5f1f3b[_0x9b6f('0x25')]();};}function saveUpdates(_0x1ac462,_0x157d83){return function(_0x3e5652){if(_0x3e5652){return _0x3e5652[_0x9b6f('0x26')](_0x1ac462)[_0x9b6f('0x27')](function(_0x14c493){return _0x14c493;});}return null;};}function removeEntity(_0x3e947d,_0x49ec7c){return function(_0x22c9d4){if(_0x22c9d4){return _0x22c9d4[_0x9b6f('0x28')]()[_0x9b6f('0x27')](function(){_0x3e947d[_0x9b6f('0x1c')](0xcc)[_0x9b6f('0x1b')]();});}};}function handleEntityNotFound(_0x34696a,_0x384041){return function(_0x2fcc50){if(!_0x2fcc50){_0x34696a['sendStatus'](0x194);}return _0x2fcc50;};}function handleError(_0x4141b3,_0x1d8680){_0x1d8680=_0x1d8680||0x1f4;return function(_0x4e8c8c){logger[_0x9b6f('0x29')](_0x4e8c8c['stack']);if(_0x4e8c8c['name']){delete _0x4e8c8c[_0x9b6f('0x2a')];}_0x4141b3[_0x9b6f('0x1c')](_0x1d8680)['send'](_0x4e8c8c);};}exports['index']=function(_0x13d3ee,_0x9f3625){var _0x2bfd54={},_0x484ee2={},_0x49a39a={'count':0x0,'rows':[]};var _0x34e56d=_[_0x9b6f('0x2b')](db[_0x9b6f('0x2c')][_0x9b6f('0x2d')],function(_0x350fb0){return{'name':_0x350fb0[_0x9b6f('0x2e')],'type':_0x350fb0['type'][_0x9b6f('0x2f')]};});_0x484ee2[_0x9b6f('0x30')]=_['map'](_0x34e56d,_0x9b6f('0x2a'));_0x484ee2[_0x9b6f('0x31')]=_['keys'](_0x13d3ee[_0x9b6f('0x31')]);_0x484ee2[_0x9b6f('0x32')]=_[_0x9b6f('0x33')](_0x484ee2['model'],_0x484ee2[_0x9b6f('0x31')]);_0x2bfd54[_0x9b6f('0x34')]=_[_0x9b6f('0x33')](_0x484ee2['model'],qs[_0x9b6f('0x35')](_0x13d3ee[_0x9b6f('0x31')][_0x9b6f('0x35')]));_0x2bfd54[_0x9b6f('0x34')]=_0x2bfd54[_0x9b6f('0x34')][_0x9b6f('0x36')]?_0x2bfd54[_0x9b6f('0x34')]:_0x484ee2[_0x9b6f('0x30')];if(!_0x13d3ee[_0x9b6f('0x31')][_0x9b6f('0x37')](_0x9b6f('0x38'))){_0x2bfd54[_0x9b6f('0x1f')]=qs[_0x9b6f('0x1f')](_0x13d3ee[_0x9b6f('0x31')][_0x9b6f('0x1f')]);_0x2bfd54[_0x9b6f('0x1e')]=qs[_0x9b6f('0x1e')](_0x13d3ee[_0x9b6f('0x31')]['offset']);}_0x2bfd54[_0x9b6f('0x39')]=qs[_0x9b6f('0x3a')](_0x13d3ee['query'][_0x9b6f('0x3a')]);_0x2bfd54[_0x9b6f('0x3b')]=qs['filters'](_[_0x9b6f('0x3c')](_0x13d3ee[_0x9b6f('0x31')],_0x484ee2[_0x9b6f('0x32')]),_0x34e56d);if(_0x13d3ee['query'][_0x9b6f('0x3d')]){_0x2bfd54[_0x9b6f('0x3b')]=_[_0x9b6f('0x3e')](_0x2bfd54[_0x9b6f('0x3b')],{'$or':_['map'](_0x34e56d,function(_0x51939d){if(_0x51939d['type']!=='VIRTUAL'){var _0x11b38e={};_0x11b38e[_0x51939d['name']]={'$like':'%'+_0x13d3ee[_0x9b6f('0x31')][_0x9b6f('0x3d')]+'%'};return _0x11b38e;}})});}_0x2bfd54=_[_0x9b6f('0x3e')]({},_0x2bfd54,_0x13d3ee[_0x9b6f('0x3f')]);var _0x57512a={'where':_0x2bfd54[_0x9b6f('0x3b')]};return db[_0x9b6f('0x2c')][_0x9b6f('0x21')](_0x57512a)[_0x9b6f('0x27')](function(_0x53f47e){_0x49a39a[_0x9b6f('0x21')]=_0x53f47e;if(_0x13d3ee[_0x9b6f('0x31')][_0x9b6f('0x40')]){_0x2bfd54[_0x9b6f('0x41')]=[{'all':!![]}];}return db[_0x9b6f('0x2c')][_0x9b6f('0x42')](_0x2bfd54);})[_0x9b6f('0x27')](function(_0x467085){_0x49a39a[_0x9b6f('0x43')]=_0x467085;return _0x49a39a;})[_0x9b6f('0x27')](respondWithFilteredResult(_0x9f3625,_0x2bfd54))[_0x9b6f('0x44')](handleError(_0x9f3625,null));};exports[_0x9b6f('0x45')]=function(_0x150638,_0x34114b){var _0x1b7b06={'raw':!![],'where':{'id':_0x150638[_0x9b6f('0x46')]['id']}},_0x3cbe91={};_0x3cbe91['model']=_['keys'](db['MailTransferReport'][_0x9b6f('0x2d')]);_0x3cbe91['query']=_[_0x9b6f('0x47')](_0x150638[_0x9b6f('0x31')]);_0x3cbe91[_0x9b6f('0x32')]=_[_0x9b6f('0x33')](_0x3cbe91['model'],_0x3cbe91[_0x9b6f('0x31')]);_0x1b7b06['attributes']=_[_0x9b6f('0x33')](_0x3cbe91[_0x9b6f('0x30')],qs[_0x9b6f('0x35')](_0x150638[_0x9b6f('0x31')][_0x9b6f('0x35')]));_0x1b7b06[_0x9b6f('0x34')]=_0x1b7b06['attributes']['length']?_0x1b7b06[_0x9b6f('0x34')]:_0x3cbe91[_0x9b6f('0x30')];if(_0x150638[_0x9b6f('0x31')]['includeAll']){_0x1b7b06[_0x9b6f('0x41')]=[{'all':!![]}];}_0x1b7b06=_[_0x9b6f('0x3e')]({},_0x1b7b06,_0x150638[_0x9b6f('0x3f')]);return db['MailTransferReport'][_0x9b6f('0x48')](_0x1b7b06)[_0x9b6f('0x27')](handleEntityNotFound(_0x34114b,null))[_0x9b6f('0x27')](respondWithResult(_0x34114b,null))[_0x9b6f('0x44')](handleError(_0x34114b,null));};exports['create']=function(_0x13b8fd,_0x4f9f35){return db[_0x9b6f('0x2c')][_0x9b6f('0x49')](_0x13b8fd[_0x9b6f('0x4a')],{})['then'](respondWithResult(_0x4f9f35,0xc9))[_0x9b6f('0x44')](handleError(_0x4f9f35,null));};exports[_0x9b6f('0x26')]=function(_0x2cfffb,_0x48a2be){if(_0x2cfffb['body']['id']){delete _0x2cfffb[_0x9b6f('0x4a')]['id'];}return db[_0x9b6f('0x2c')][_0x9b6f('0x48')]({'where':{'id':_0x2cfffb[_0x9b6f('0x46')]['id']}})[_0x9b6f('0x27')](handleEntityNotFound(_0x48a2be,null))['then'](saveUpdates(_0x2cfffb[_0x9b6f('0x4a')],null))[_0x9b6f('0x27')](respondWithResult(_0x48a2be,null))['catch'](handleError(_0x48a2be,null));};exports[_0x9b6f('0x28')]=function(_0x13f6fe,_0x4c9126){return db[_0x9b6f('0x2c')][_0x9b6f('0x48')]({'where':{'id':_0x13f6fe[_0x9b6f('0x46')]['id']}})[_0x9b6f('0x27')](handleEntityNotFound(_0x4c9126,null))[_0x9b6f('0x27')](removeEntity(_0x4c9126,null))[_0x9b6f('0x44')](handleError(_0x4c9126,null));};exports[_0x9b6f('0x4b')]=function(_0x10d8d1,_0xc6876a){return db['MailTransferReport'][_0x9b6f('0x4b')]()[_0x9b6f('0x27')](respondWithResult(_0xc6876a,null))[_0x9b6f('0x44')](handleError(_0xc6876a,null));}; \ No newline at end of file +var _0x3e72=['mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x29a744,_0xef394e){var _0x27c966=function(_0xa8516e){while(--_0xa8516e){_0x29a744['push'](_0x29a744['shift']());}};_0x27c966(++_0xef394e);}(_0x3e72,0xea));var _0x23e7=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x3e72[_0x3fb030];return _0xd6899b;};'use strict';var emlformat=require(_0x23e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x23e7('0x1'));var jsonpatch=require(_0x23e7('0x2'));var rp=require(_0x23e7('0x3'));var moment=require(_0x23e7('0x4'));var BPromise=require(_0x23e7('0x5'));var Mustache=require(_0x23e7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x23e7('0x7'));var csv=require(_0x23e7('0x8'));var ejs=require(_0x23e7('0x9'));var fs=require('fs');var fs_extra=require(_0x23e7('0xa'));var _=require(_0x23e7('0xb'));var squel=require(_0x23e7('0xc'));var crypto=require(_0x23e7('0xd'));var jsforce=require(_0x23e7('0xe'));var deskjs=require(_0x23e7('0xf'));var toCsv=require(_0x23e7('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x23e7('0x10'));var authService=require(_0x23e7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x23e7('0x12'));var hardwareService=require(_0x23e7('0x13'));var logger=require(_0x23e7('0x14'))(_0x23e7('0x15'));var utils=require(_0x23e7('0x16'));var config=require(_0x23e7('0x17'));var licenseUtil=require(_0x23e7('0x18'));var db=require(_0x23e7('0x19'))['db'];function respondWithStatusCode(_0x2488e2,_0x3a8349){_0x3a8349=_0x3a8349||0xcc;return function(_0x3b8a47){if(_0x3b8a47){return _0x2488e2[_0x23e7('0x1a')](_0x3a8349);}return _0x2488e2[_0x23e7('0x1b')](_0x3a8349)[_0x23e7('0x1c')]();};}function respondWithResult(_0x50f518,_0x251d8c){_0x251d8c=_0x251d8c||0xc8;return function(_0x429adc){if(_0x429adc){return _0x50f518[_0x23e7('0x1b')](_0x251d8c)[_0x23e7('0x1d')](_0x429adc);}};}function respondWithFilteredResult(_0x268e7c,_0x22af6a){return function(_0x134cbc){if(_0x134cbc){var _0x458383=typeof _0x22af6a['offset']===_0x23e7('0x1e')&&typeof _0x22af6a[_0x23e7('0x1f')]===_0x23e7('0x1e');var _0x5dbd5a=_0x134cbc[_0x23e7('0x20')];var _0xca7b64=_0x458383?0x0:_0x22af6a[_0x23e7('0x21')];var _0x3cce80=_0x458383?_0x134cbc[_0x23e7('0x20')]:_0x22af6a[_0x23e7('0x21')]+_0x22af6a[_0x23e7('0x1f')];var _0x435e62;if(_0x3cce80>=_0x5dbd5a){_0x3cce80=_0x5dbd5a;_0x435e62=0xc8;}else{_0x435e62=0xce;}_0x268e7c['status'](_0x435e62);return _0x268e7c[_0x23e7('0x22')](_0x23e7('0x23'),_0xca7b64+'-'+_0x3cce80+'/'+_0x5dbd5a)[_0x23e7('0x1d')](_0x134cbc);}return null;};}function patchUpdates(_0x3f6fef){return function(_0x1e1776){try{jsonpatch[_0x23e7('0x24')](_0x1e1776,_0x3f6fef,!![]);}catch(_0x10d6fa){return BPromise[_0x23e7('0x25')](_0x10d6fa);}return _0x1e1776['save']();};}function saveUpdates(_0x71ca0d,_0x437d71){return function(_0x36c559){if(_0x36c559){return _0x36c559[_0x23e7('0x26')](_0x71ca0d)[_0x23e7('0x27')](function(_0x4e2088){return _0x4e2088;});}return null;};}function removeEntity(_0x43f4cc,_0x402a9d){return function(_0x1b40f8){if(_0x1b40f8){return _0x1b40f8[_0x23e7('0x28')]()[_0x23e7('0x27')](function(){_0x43f4cc[_0x23e7('0x1b')](0xcc)[_0x23e7('0x1c')]();});}};}function handleEntityNotFound(_0x471f45,_0xf2ca2a){return function(_0x4c71ca){if(!_0x4c71ca){_0x471f45[_0x23e7('0x1a')](0x194);}return _0x4c71ca;};}function handleError(_0x3eaddb,_0xcda0d8){_0xcda0d8=_0xcda0d8||0x1f4;return function(_0x54fba2){logger[_0x23e7('0x29')](_0x54fba2[_0x23e7('0x2a')]);if(_0x54fba2[_0x23e7('0x2b')]){delete _0x54fba2[_0x23e7('0x2b')];}_0x3eaddb[_0x23e7('0x1b')](_0xcda0d8)[_0x23e7('0x2c')](_0x54fba2);};}exports[_0x23e7('0x2d')]=function(_0xd3218b,_0x1664ef){var _0x2debc3={},_0x33f4c6={},_0x5996bd={'count':0x0,'rows':[]};var _0x26c0b3=_[_0x23e7('0x2e')](db[_0x23e7('0x2f')][_0x23e7('0x30')],function(_0x2ab68f){return{'name':_0x2ab68f[_0x23e7('0x31')],'type':_0x2ab68f[_0x23e7('0x32')][_0x23e7('0x33')]};});_0x33f4c6[_0x23e7('0x34')]=_[_0x23e7('0x2e')](_0x26c0b3,_0x23e7('0x2b'));_0x33f4c6[_0x23e7('0x35')]=_['keys'](_0xd3218b[_0x23e7('0x35')]);_0x33f4c6[_0x23e7('0x36')]=_[_0x23e7('0x37')](_0x33f4c6[_0x23e7('0x34')],_0x33f4c6[_0x23e7('0x35')]);_0x2debc3[_0x23e7('0x38')]=_[_0x23e7('0x37')](_0x33f4c6[_0x23e7('0x34')],qs['fields'](_0xd3218b['query'][_0x23e7('0x39')]));_0x2debc3['attributes']=_0x2debc3[_0x23e7('0x38')][_0x23e7('0x3a')]?_0x2debc3[_0x23e7('0x38')]:_0x33f4c6[_0x23e7('0x34')];if(!_0xd3218b[_0x23e7('0x35')][_0x23e7('0x3b')](_0x23e7('0x3c'))){_0x2debc3[_0x23e7('0x1f')]=qs[_0x23e7('0x1f')](_0xd3218b[_0x23e7('0x35')]['limit']);_0x2debc3[_0x23e7('0x21')]=qs['offset'](_0xd3218b[_0x23e7('0x35')][_0x23e7('0x21')]);}_0x2debc3[_0x23e7('0x3d')]=qs['sort'](_0xd3218b[_0x23e7('0x35')][_0x23e7('0x3e')]);_0x2debc3[_0x23e7('0x3f')]=qs['filters'](_[_0x23e7('0x40')](_0xd3218b[_0x23e7('0x35')],_0x33f4c6[_0x23e7('0x36')]),_0x26c0b3);if(_0xd3218b[_0x23e7('0x35')][_0x23e7('0x41')]){_0x2debc3[_0x23e7('0x3f')]=_['merge'](_0x2debc3[_0x23e7('0x3f')],{'$or':_[_0x23e7('0x2e')](_0x26c0b3,function(_0x3fb847){if(_0x3fb847[_0x23e7('0x32')]!==_0x23e7('0x42')){var _0x971ca5={};_0x971ca5[_0x3fb847[_0x23e7('0x2b')]]={'$like':'%'+_0xd3218b[_0x23e7('0x35')]['filter']+'%'};return _0x971ca5;}})});}_0x2debc3=_[_0x23e7('0x43')]({},_0x2debc3,_0xd3218b[_0x23e7('0x44')]);var _0x1d0092={'where':_0x2debc3[_0x23e7('0x3f')]};return db[_0x23e7('0x2f')][_0x23e7('0x20')](_0x1d0092)[_0x23e7('0x27')](function(_0xaf0c49){_0x5996bd[_0x23e7('0x20')]=_0xaf0c49;if(_0xd3218b['query'][_0x23e7('0x45')]){_0x2debc3['include']=[{'all':!![]}];}return db[_0x23e7('0x2f')][_0x23e7('0x46')](_0x2debc3);})[_0x23e7('0x27')](function(_0x2fcb81){_0x5996bd[_0x23e7('0x47')]=_0x2fcb81;return _0x5996bd;})['then'](respondWithFilteredResult(_0x1664ef,_0x2debc3))['catch'](handleError(_0x1664ef,null));};exports[_0x23e7('0x48')]=function(_0x5613bd,_0x219a88){var _0x43c820={'raw':!![],'where':{'id':_0x5613bd[_0x23e7('0x49')]['id']}},_0x564901={};_0x564901[_0x23e7('0x34')]=_['keys'](db[_0x23e7('0x2f')][_0x23e7('0x30')]);_0x564901[_0x23e7('0x35')]=_['keys'](_0x5613bd['query']);_0x564901[_0x23e7('0x36')]=_[_0x23e7('0x37')](_0x564901[_0x23e7('0x34')],_0x564901['query']);_0x43c820[_0x23e7('0x38')]=_[_0x23e7('0x37')](_0x564901[_0x23e7('0x34')],qs[_0x23e7('0x39')](_0x5613bd['query'][_0x23e7('0x39')]));_0x43c820[_0x23e7('0x38')]=_0x43c820[_0x23e7('0x38')][_0x23e7('0x3a')]?_0x43c820[_0x23e7('0x38')]:_0x564901['model'];if(_0x5613bd['query'][_0x23e7('0x45')]){_0x43c820[_0x23e7('0x4a')]=[{'all':!![]}];}_0x43c820=_['merge']({},_0x43c820,_0x5613bd[_0x23e7('0x44')]);return db[_0x23e7('0x2f')][_0x23e7('0x4b')](_0x43c820)[_0x23e7('0x27')](handleEntityNotFound(_0x219a88,null))[_0x23e7('0x27')](respondWithResult(_0x219a88,null))[_0x23e7('0x4c')](handleError(_0x219a88,null));};exports[_0x23e7('0x4d')]=function(_0x1994af,_0x5ee4dd){return db['MailTransferReport'][_0x23e7('0x4d')](_0x1994af[_0x23e7('0x4e')],{})['then'](respondWithResult(_0x5ee4dd,0xc9))[_0x23e7('0x4c')](handleError(_0x5ee4dd,null));};exports['update']=function(_0x5bd23f,_0x269340){if(_0x5bd23f[_0x23e7('0x4e')]['id']){delete _0x5bd23f[_0x23e7('0x4e')]['id'];}return db['MailTransferReport'][_0x23e7('0x4b')]({'where':{'id':_0x5bd23f[_0x23e7('0x49')]['id']}})[_0x23e7('0x27')](handleEntityNotFound(_0x269340,null))[_0x23e7('0x27')](saveUpdates(_0x5bd23f[_0x23e7('0x4e')],null))[_0x23e7('0x27')](respondWithResult(_0x269340,null))[_0x23e7('0x4c')](handleError(_0x269340,null));};exports[_0x23e7('0x28')]=function(_0x153041,_0x2173e4){return db[_0x23e7('0x2f')][_0x23e7('0x4b')]({'where':{'id':_0x153041[_0x23e7('0x49')]['id']}})[_0x23e7('0x27')](handleEntityNotFound(_0x2173e4,null))[_0x23e7('0x27')](removeEntity(_0x2173e4,null))[_0x23e7('0x4c')](handleError(_0x2173e4,null));};exports[_0x23e7('0x4f')]=function(_0x39095b,_0xd17a09){return db[_0x23e7('0x2f')][_0x23e7('0x4f')]()[_0x23e7('0x27')](respondWithResult(_0xd17a09,null))[_0x23e7('0x4c')](handleError(_0xd17a09,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c4274e2..0838f80 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 _0xa947=['api','moment','bluebird','request-promise','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0xae6ff2,_0x2f521a){var _0x2bd6ad=function(_0x216423){while(--_0x216423){_0xae6ff2['push'](_0xae6ff2['shift']());}};_0x2bd6ad(++_0x2f521a);}(_0xa947,0x11d));var _0x7a94=function(_0x447feb,_0x512e68){_0x447feb=_0x447feb-0x0;var _0x1036a7=_0xa947[_0x447feb];return _0x1036a7;};'use strict';var _=require(_0x7a94('0x0'));var util=require(_0x7a94('0x1'));var logger=require(_0x7a94('0x2'))(_0x7a94('0x3'));var moment=require(_0x7a94('0x4'));var BPromise=require(_0x7a94('0x5'));var rp=require(_0x7a94('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a94('0x7'));module['exports']=function(_0x2ea02c,_0x281dc9){return _0x2ea02c[_0x7a94('0x8')](_0x7a94('0x9'),attributes,{'tableName':_0x7a94('0xa'),'paranoid':![],'indexes':[{'name':_0x7a94('0xb'),'fields':[_0x7a94('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4d1=['rimraf','./mailTransferReport.attributes','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1a1769,_0x8cd205){var _0x33453a=function(_0x2904f4){while(--_0x2904f4){_0x1a1769['push'](_0x1a1769['shift']());}};_0x33453a(++_0x8cd205);}(_0xd4d1,0x123));var _0x1d4d=function(_0x572b56,_0x33e935){_0x572b56=_0x572b56-0x0;var _0x4da71e=_0xd4d1[_0x572b56];return _0x4da71e;};'use strict';var _=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var logger=require(_0x1d4d('0x2'))(_0x1d4d('0x3'));var moment=require(_0x1d4d('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d4d('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d4d('0x7'));module['exports']=function(_0x2bc295,_0x184978){return _0x2bc295[_0x1d4d('0x8')]('MailTransferReport',attributes,{'tableName':_0x1d4d('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1d4d('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 5b9dda9..8ba202d 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 _0x93f0=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then'];(function(_0x13867a,_0x4e4a53){var _0x53e62=function(_0x310dfb){while(--_0x310dfb){_0x13867a['push'](_0x13867a['shift']());}};_0x53e62(++_0x4e4a53);}(_0x93f0,0x1a9));var _0x093f=function(_0x23a940,_0x32f9a8){_0x23a940=_0x23a940-0x0;var _0x1fd179=_0x93f0[_0x23a940];return _0x1fd179;};'use strict';var _=require(_0x093f('0x0'));var util=require(_0x093f('0x1'));var moment=require('moment');var BPromise=require(_0x093f('0x2'));var rs=require(_0x093f('0x3'));var fs=require('fs');var Redis=require(_0x093f('0x4'));var db=require(_0x093f('0x5'))['db'];var utils=require(_0x093f('0x6'));var logger=require(_0x093f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x093f('0x8'));var client=jayson[_0x093f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533718,_0x489352,_0x3ac76d){return new BPromise(function(_0x24aedb,_0x1c23b1){return client[_0x093f('0xa')](_0x533718,_0x3ac76d)[_0x093f('0xb')](function(_0x448e7a){logger[_0x093f('0xc')](_0x093f('0xd'),_0x489352,_0x093f('0xe'));logger[_0x093f('0xf')](_0x093f('0x10'),_0x489352,_0x093f('0xe'),JSON[_0x093f('0x11')](_0x448e7a));if(_0x448e7a[_0x093f('0x12')]){if(_0x448e7a[_0x093f('0x12')][_0x093f('0x13')]===0x1f4){logger[_0x093f('0x12')](_0x093f('0xd'),_0x489352,_0x448e7a[_0x093f('0x12')][_0x093f('0x14')]);return _0x1c23b1(_0x448e7a[_0x093f('0x12')]['message']);}logger[_0x093f('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x489352,_0x448e7a[_0x093f('0x12')][_0x093f('0x14')]);return _0x24aedb(_0x448e7a[_0x093f('0x12')][_0x093f('0x14')]);}else{logger[_0x093f('0xc')](_0x093f('0xd'),_0x489352,_0x093f('0xe'));_0x24aedb(_0x448e7a[_0x093f('0x15')][_0x093f('0x14')]);}})[_0x093f('0x16')](function(_0x3d6570){logger[_0x093f('0x12')](_0x093f('0xd'),_0x489352,_0x3d6570);_0x1c23b1(_0x3d6570);});});} \ No newline at end of file +var _0x203d=['client','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3860d4,_0x1d8a52){var _0x4843d2=function(_0x3dc7c6){while(--_0x3dc7c6){_0x3860d4['push'](_0x3860d4['shift']());}};_0x4843d2(++_0x1d8a52);}(_0x203d,0x101));var _0xd203=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0x203d[_0x18f152];return _0xa10b34;};'use strict';var _=require(_0xd203('0x0'));var util=require('util');var moment=require(_0xd203('0x1'));var BPromise=require(_0xd203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd203('0x3'));var db=require(_0xd203('0x4'))['db'];var utils=require(_0xd203('0x5'));var logger=require('../../config/logger')(_0xd203('0x6'));var config=require(_0xd203('0x7'));var jayson=require(_0xd203('0x8'));var client=jayson[_0xd203('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d9cfb,_0x46b9ac,_0x30de54){return new BPromise(function(_0xd23936,_0x44d5bd){return client['request'](_0x2d9cfb,_0x30de54)[_0xd203('0xa')](function(_0x5f1d30){logger[_0xd203('0xb')](_0xd203('0xc'),_0x46b9ac,_0xd203('0xd'));logger[_0xd203('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x46b9ac,_0xd203('0xd'),JSON[_0xd203('0xf')](_0x5f1d30));if(_0x5f1d30[_0xd203('0x10')]){if(_0x5f1d30[_0xd203('0x10')]['code']===0x1f4){logger['error'](_0xd203('0xc'),_0x46b9ac,_0x5f1d30[_0xd203('0x10')][_0xd203('0x11')]);return _0x44d5bd(_0x5f1d30['error'][_0xd203('0x11')]);}logger[_0xd203('0x10')](_0xd203('0xc'),_0x46b9ac,_0x5f1d30['error'][_0xd203('0x11')]);return _0xd23936(_0x5f1d30['error']['message']);}else{logger[_0xd203('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x46b9ac,_0xd203('0xd'));_0xd23936(_0x5f1d30[_0xd203('0x12')][_0xd203('0x11')]);}})['catch'](function(_0x1e50c4){logger[_0xd203('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x46b9ac,_0x1e50c4);_0x44d5bd(_0x1e50c4);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 88e8dc4..ca3bbb9 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 _0xc7ce=['post','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show'];(function(_0x4816bb,_0x5c313d){var _0x12b0ca=function(_0x40ca9a){while(--_0x40ca9a){_0x4816bb['push'](_0x4816bb['shift']());}};_0x12b0ca(++_0x5c313d);}(_0xc7ce,0x10d));var _0xec7c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc7ce[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xec7c('0x0'));var util=require(_0xec7c('0x1'));var path=require(_0xec7c('0x2'));var timeout=require(_0xec7c('0x3'));var express=require(_0xec7c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xec7c('0x5'));var interaction=require(_0xec7c('0x6'));var config=require(_0xec7c('0x7'));var controller=require(_0xec7c('0x8'));router[_0xec7c('0x9')]('/',auth['isAuthenticated'](),controller[_0xec7c('0xa')]);router[_0xec7c('0x9')](_0xec7c('0xb'),auth['isAuthenticated'](),controller[_0xec7c('0xc')]);router[_0xec7c('0x9')](_0xec7c('0xd'),auth[_0xec7c('0xe')](),controller[_0xec7c('0xf')]);router[_0xec7c('0x10')]('/',auth[_0xec7c('0xe')](),controller['create']);router['put']('/:id',auth[_0xec7c('0xe')](),controller['update']);router[_0xec7c('0x11')](_0xec7c('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xec7c('0x12')]=router; \ No newline at end of file +var _0xcd97=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','/describe','isAuthenticated','describe','show','put','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3a6b45,_0x181d28){var _0x6642d0=function(_0x428df4){while(--_0x428df4){_0x3a6b45['push'](_0x3a6b45['shift']());}};_0x6642d0(++_0x181d28);}(_0xcd97,0x68));var _0x7cd9=function(_0x852e47,_0x5297bd){_0x852e47=_0x852e47-0x0;var _0x35a316=_0xcd97[_0x852e47];return _0x35a316;};'use strict';var multer=require(_0x7cd9('0x0'));var util=require(_0x7cd9('0x1'));var path=require('path');var timeout=require(_0x7cd9('0x2'));var express=require(_0x7cd9('0x3'));var router=express[_0x7cd9('0x4')]();var fs_extra=require(_0x7cd9('0x5'));var auth=require(_0x7cd9('0x6'));var interaction=require(_0x7cd9('0x7'));var config=require('../../config/environment');var controller=require(_0x7cd9('0x8'));router[_0x7cd9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7cd9('0x9')](_0x7cd9('0xa'),auth[_0x7cd9('0xb')](),controller[_0x7cd9('0xc')]);router[_0x7cd9('0x9')]('/:id',auth[_0x7cd9('0xb')](),controller[_0x7cd9('0xd')]);router['post']('/',auth[_0x7cd9('0xb')](),controller['create']);router[_0x7cd9('0xe')]('/:id',auth[_0x7cd9('0xb')](),controller['update']);router[_0x7cd9('0xf')]('/:id',auth[_0x7cd9('0xb')](),controller[_0x7cd9('0x10')]);module[_0x7cd9('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 248d098..9c39e62 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 _0xc039=['moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize'];(function(_0x6f1523,_0x18493a){var _0xefb2a5=function(_0x289f42){while(--_0x289f42){_0x6f1523['push'](_0x6f1523['shift']());}};_0xefb2a5(++_0x18493a);}(_0xc039,0xd0));var _0x9c03=function(_0x3ba1f5,_0x326c02){_0x3ba1f5=_0x3ba1f5-0x0;var _0x1b5f40=_0xc039[_0x3ba1f5];return _0x1b5f40;};'use strict';var Sequelize=require(_0x9c03('0x0'));var moment=require(_0x9c03('0x1'));module[_0x9c03('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9c03('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9c03('0x3')],'defaultValue':_0x9c03('0x4'),'comment':_0x9c03('0x5')},'duration':{'type':Sequelize[_0x9c03('0x6')]},'enterAt':{'type':Sequelize[_0x9c03('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x5a12cb){var _0xa0ec3c=moment(_0x5a12cb);var _0x51f194=moment(this[_0x9c03('0x8')](_0x9c03('0x9')));var _0x8a152e=_0xa0ec3c[_0x9c03('0xa')](_0x51f194,_0x9c03('0xb'));this['setDataValue']('exitAt',_0x5a12cb);this[_0x9c03('0xc')](_0x9c03('0xd'),_0x8a152e>=0x0?_0x8a152e:null);}},'data1':{'type':Sequelize[_0x9c03('0x3')],'comment':_0x9c03('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0x9c03('0xf')},'data3':{'type':Sequelize[_0x9c03('0x3')],'comment':_0x9c03('0x10')},'data4':{'type':Sequelize['STRING'],'comment':_0x9c03('0x11')},'data5':{'type':Sequelize[_0x9c03('0x3')],'comment':_0x9c03('0x12')},'role':{'type':Sequelize[_0x9c03('0x3')]},'internal':{'type':Sequelize[_0x9c03('0x6')]},'uniqueid':{'type':Sequelize[_0x9c03('0x3')]}}; \ No newline at end of file +var _0x24ae=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','setDataValue'];(function(_0x374789,_0x8de75f){var _0x1d5a6d=function(_0x8b2b1){while(--_0x8b2b1){_0x374789['push'](_0x374789['shift']());}};_0x1d5a6d(++_0x8de75f);}(_0x24ae,0x75));var _0xe24a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x24ae[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xe24a('0x0'));var moment=require(_0xe24a('0x1'));module[_0xe24a('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xe24a('0x3')]},'type':{'type':Sequelize[_0xe24a('0x3')],'defaultValue':_0xe24a('0x4'),'comment':_0xe24a('0x5')},'duration':{'type':Sequelize[_0xe24a('0x6')]},'enterAt':{'type':Sequelize[_0xe24a('0x7')]},'exitAt':{'type':Sequelize[_0xe24a('0x7')],'set':function(_0x37c6a1){var _0x5bc2c8=moment(_0x37c6a1);var _0x42f9a9=moment(this[_0xe24a('0x8')]('enterAt'));var _0x55c9a6=_0x5bc2c8[_0xe24a('0x9')](_0x42f9a9,'seconds');this[_0xe24a('0xa')](_0xe24a('0xb'),_0x37c6a1);this[_0xe24a('0xa')](_0xe24a('0xc'),_0x55c9a6>=0x0?_0x55c9a6:null);}},'data1':{'type':Sequelize[_0xe24a('0x3')],'comment':_0xe24a('0xd')},'data2':{'type':Sequelize[_0xe24a('0x3')],'comment':_0xe24a('0xe')},'data3':{'type':Sequelize[_0xe24a('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xe24a('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xe24a('0x3')],'comment':_0xe24a('0xf')},'role':{'type':Sequelize[_0xe24a('0x3')]},'internal':{'type':Sequelize[_0xe24a('0x6')]},'uniqueid':{'type':Sequelize[_0xe24a('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8df6f7d..0021662 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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xedd9,0xfc));var _0x9edd=function(_0x249b69,_0x31ff67){_0x249b69=_0x249b69-0x0;var _0x3476a=_0xedd9[_0x249b69];return _0x3476a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +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(_0x43f1b5,_0xcee793){var _0x3e01a9=function(_0x20518b){while(--_0x20518b){_0x43f1b5['push'](_0x43f1b5['shift']());}};_0x3e01a9(++_0xcee793);}(_0x008c,0x188));var _0xc008=function(_0x297269,_0x568256){_0x297269=_0x297269-0x0;var _0x4ba584=_0x008c[_0x297269];return _0x4ba584;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 3db3c13..af31aa6 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 _0x57b3=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','report_member','membername_interface','membername'];(function(_0x4a7193,_0x556c6a){var _0xc33d94=function(_0x3b7b34){while(--_0x3b7b34){_0x4a7193['push'](_0x4a7193['shift']());}};_0xc33d94(++_0x556c6a);}(_0x57b3,0x1ad));var _0x357b=function(_0x22567e,_0xa74485){_0x22567e=_0x22567e-0x0;var _0x202e95=_0x57b3[_0x22567e];return _0x202e95;};'use strict';var _=require('lodash');var util=require(_0x357b('0x0'));var logger=require(_0x357b('0x1'))(_0x357b('0x2'));var moment=require(_0x357b('0x3'));var BPromise=require(_0x357b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x357b('0x5'));var rimraf=require(_0x357b('0x6'));var config=require(_0x357b('0x7'));var attributes=require(_0x357b('0x8'));module[_0x357b('0x9')]=function(_0x4c90cc,_0x290d6b){return _0x4c90cc['define']('MemberReport',attributes,{'tableName':_0x357b('0xa'),'paranoid':![],'indexes':[{'name':_0x357b('0xb'),'fields':[_0x357b('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b09=['lodash','util','api','moment','request-promise','rimraf','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface'];(function(_0x4cdecc,_0x321d1a){var _0x3948a9=function(_0x2a247d){while(--_0x2a247d){_0x4cdecc['push'](_0x4cdecc['shift']());}};_0x3948a9(++_0x321d1a);}(_0x9b09,0x1ad));var _0x99b0=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x9b09[_0x33154d];return _0x3b2f03;};'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'));module[_0x99b0('0x7')]=function(_0x498180,_0x466c23){return _0x498180[_0x99b0('0x8')]('MemberReport',attributes,{'tableName':_0x99b0('0x9'),'paranoid':![],'indexes':[{'name':_0x99b0('0xa'),'fields':[_0x99b0('0xb'),_0x99b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 3e8097d..468b2e7 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 _0x600f=['MemberReport','findAll','options','where','limit','include','map','model','attributes','stringify','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x600f,0xb4));var _0xf600=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x600f[_0x1911ed];return _0x11edaa;};'use strict';var _=require(_0xf600('0x0'));var util=require(_0xf600('0x1'));var moment=require(_0xf600('0x2'));var BPromise=require('bluebird');var rs=require(_0xf600('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf600('0x4'))['db'];var utils=require(_0xf600('0x5'));var logger=require(_0xf600('0x6'))(_0xf600('0x7'));var config=require(_0xf600('0x8'));var jayson=require(_0xf600('0x9'));var client=jayson[_0xf600('0xa')][_0xf600('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a6457,_0x1a620c,_0x56f333){return new BPromise(function(_0x489c42,_0x5c96d8){return client[_0xf600('0xc')](_0x5a6457,_0x56f333)[_0xf600('0xd')](function(_0xa9d85e){logger[_0xf600('0xe')]('MemberReport,\x20%s,\x20%s',_0x1a620c,_0xf600('0xf'));logger[_0xf600('0x10')](_0xf600('0x11'),_0x1a620c,_0xf600('0xf'),JSON['stringify'](_0xa9d85e));if(_0xa9d85e[_0xf600('0x12')]){if(_0xa9d85e['error'][_0xf600('0x13')]===0x1f4){logger[_0xf600('0x12')](_0xf600('0x14'),_0x1a620c,_0xa9d85e[_0xf600('0x12')][_0xf600('0x15')]);return _0x5c96d8(_0xa9d85e[_0xf600('0x12')][_0xf600('0x15')]);}logger[_0xf600('0x12')]('MemberReport,\x20%s,\x20%s',_0x1a620c,_0xa9d85e[_0xf600('0x12')][_0xf600('0x15')]);return _0x489c42(_0xa9d85e[_0xf600('0x12')]['message']);}else{logger[_0xf600('0xe')]('MemberReport,\x20%s,\x20%s',_0x1a620c,'request\x20sent');_0x489c42(_0xa9d85e[_0xf600('0x16')][_0xf600('0x15')]);}})[_0xf600('0x17')](function(_0x439e2d){logger[_0xf600('0x12')]('MemberReport,\x20%s,\x20%s',_0x1a620c,_0x439e2d);_0x5c96d8(_0x439e2d);});});}exports[_0xf600('0x18')]=function(_0x1e4efa){var _0x29988b=this;return new Promise(function(_0x2c9a76,_0x4768cb){return db[_0xf600('0x19')][_0xf600('0x1a')]({'raw':_0x1e4efa['options']?_0x1e4efa[_0xf600('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1e4efa[_0xf600('0x1b')]?_0x1e4efa[_0xf600('0x1b')][_0xf600('0x1c')]||null:null,'attributes':_0x1e4efa[_0xf600('0x1b')]?_0x1e4efa[_0xf600('0x1b')]['attributes']||null:null,'limit':_0x1e4efa[_0xf600('0x1b')]?_0x1e4efa[_0xf600('0x1b')][_0xf600('0x1d')]||null:null,'include':_0x1e4efa[_0xf600('0x1b')]?_0x1e4efa[_0xf600('0x1b')][_0xf600('0x1e')]?_[_0xf600('0x1f')](_0x1e4efa[_0xf600('0x1b')][_0xf600('0x1e')],function(_0x259a3c){return{'model':db[_0x259a3c['model']],'as':_0x259a3c['as'],'attributes':_0x259a3c['attributes'],'include':_0x259a3c['include']?_[_0xf600('0x1f')](_0x259a3c[_0xf600('0x1e')],function(_0xf5299c){return{'model':db[_0xf5299c[_0xf600('0x20')]],'as':_0xf5299c['as'],'attributes':_0xf5299c[_0xf600('0x21')],'include':_0xf5299c[_0xf600('0x1e')]?_[_0xf600('0x1f')](_0xf5299c[_0xf600('0x1e')],function(_0x16d5bc){return{'model':db[_0x16d5bc[_0xf600('0x20')]],'as':_0x16d5bc['as'],'attributes':_0x16d5bc[_0xf600('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf600('0xd')](function(_0x370027){logger[_0xf600('0xe')](_0xf600('0x18'),_0x1e4efa);logger[_0xf600('0x10')](_0xf600('0x18'),_0x1e4efa,JSON[_0xf600('0x22')](_0x370027));_0x2c9a76(_0x370027);})[_0xf600('0x17')](function(_0x474e2c){logger['error'](_0xf600('0x18'),_0x474e2c['message'],_0x1e4efa);_0x4768cb(_0x29988b[_0xf600('0x12')](0x1f4,_0x474e2c[_0xf600('0x15')]));});});};exports[_0xf600('0x23')]=function(_0x2dfdc9){var _0x45c957=this;return new Promise(function(_0x32f144,_0x5bf5ef){return db[_0xf600('0x19')][_0xf600('0x24')](_0x2dfdc9[_0xf600('0x25')],{'raw':_0x2dfdc9[_0xf600('0x1b')]?_0x2dfdc9[_0xf600('0x1b')][_0xf600('0x26')]===undefined?!![]:![]:!![]})['then'](function(_0x2397be){logger[_0xf600('0xe')]('CreateMemberReport',_0x2dfdc9);logger['debug'](_0xf600('0x23'),_0x2dfdc9,JSON[_0xf600('0x22')](_0x2397be));_0x32f144(_0x2397be);})[_0xf600('0x17')](function(_0x1bf9ca){logger[_0xf600('0x12')](_0xf600('0x23'),_0x1bf9ca['message'],_0x2dfdc9);_0x5bf5ef(_0x45c957[_0xf600('0x12')](0x1f4,_0x1bf9ca[_0xf600('0x15')]));});});};exports[_0xf600('0x27')]=function(_0x27caf5){var _0x1f022f=this;return new Promise(function(_0x27b029,_0x1aab0b){return db['MemberReport'][_0xf600('0x28')](_0x27caf5[_0xf600('0x25')],{'raw':_0x27caf5[_0xf600('0x1b')]?_0x27caf5[_0xf600('0x1b')][_0xf600('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27caf5[_0xf600('0x1b')]?_0x27caf5[_0xf600('0x1b')][_0xf600('0x1c')]||null:null,'attributes':_0x27caf5[_0xf600('0x1b')]?_0x27caf5['options'][_0xf600('0x21')]||null:null,'limit':_0x27caf5['options']?_0x27caf5[_0xf600('0x1b')][_0xf600('0x1d')]||null:null})[_0xf600('0xd')](function(_0x4f0d1e){logger['info'](_0xf600('0x27'),_0x27caf5);logger[_0xf600('0x10')](_0xf600('0x27'),_0x27caf5,JSON['stringify'](_0x4f0d1e));_0x27b029(_0x4f0d1e);})[_0xf600('0x17')](function(_0x4e395d){logger[_0xf600('0x12')]('UpdateMemberReport',_0x4e395d[_0xf600('0x15')],_0x27caf5);_0x1aab0b(_0x1f022f['error'](0x1f4,_0x4e395d['message']));});});}; \ No newline at end of file +var _0x7ebb=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dc434,_0x14d9df){var _0x518e15=function(_0x5329d5){while(--_0x5329d5){_0x3dc434['push'](_0x3dc434['shift']());}};_0x518e15(++_0x14d9df);}(_0x7ebb,0x161));var _0xb7eb=function(_0x3424b5,_0x4e7a6d){_0x3424b5=_0x3424b5-0x0;var _0x3f0196=_0x7ebb[_0x3424b5];return _0x3f0196;};'use strict';var _=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var moment=require(_0xb7eb('0x2'));var BPromise=require(_0xb7eb('0x3'));var rs=require(_0xb7eb('0x4'));var fs=require('fs');var Redis=require(_0xb7eb('0x5'));var db=require(_0xb7eb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7eb('0x7'))(_0xb7eb('0x8'));var config=require(_0xb7eb('0x9'));var jayson=require(_0xb7eb('0xa'));var client=jayson[_0xb7eb('0xb')][_0xb7eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b53b1,_0x1b8cc5,_0x282eb0){return new BPromise(function(_0x3abb1f,_0x542325){return client['request'](_0x2b53b1,_0x282eb0)[_0xb7eb('0xd')](function(_0xb669b9){logger[_0xb7eb('0xe')](_0xb7eb('0xf'),_0x1b8cc5,'request\x20sent');logger[_0xb7eb('0x10')](_0xb7eb('0x11'),_0x1b8cc5,'request\x20sent',JSON[_0xb7eb('0x12')](_0xb669b9));if(_0xb669b9[_0xb7eb('0x13')]){if(_0xb669b9[_0xb7eb('0x13')][_0xb7eb('0x14')]===0x1f4){logger[_0xb7eb('0x13')](_0xb7eb('0xf'),_0x1b8cc5,_0xb669b9[_0xb7eb('0x13')]['message']);return _0x542325(_0xb669b9[_0xb7eb('0x13')][_0xb7eb('0x15')]);}logger[_0xb7eb('0x13')]('MemberReport,\x20%s,\x20%s',_0x1b8cc5,_0xb669b9[_0xb7eb('0x13')][_0xb7eb('0x15')]);return _0x3abb1f(_0xb669b9[_0xb7eb('0x13')][_0xb7eb('0x15')]);}else{logger['info'](_0xb7eb('0xf'),_0x1b8cc5,'request\x20sent');_0x3abb1f(_0xb669b9[_0xb7eb('0x16')][_0xb7eb('0x15')]);}})[_0xb7eb('0x17')](function(_0x549546){logger[_0xb7eb('0x13')](_0xb7eb('0xf'),_0x1b8cc5,_0x549546);_0x542325(_0x549546);});});}exports[_0xb7eb('0x18')]=function(_0x1c0294){var _0x52324c=this;return new Promise(function(_0x36fc4d,_0x499f4e){return db[_0xb7eb('0x19')][_0xb7eb('0x1a')]({'raw':_0x1c0294['options']?_0x1c0294[_0xb7eb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1c0294[_0xb7eb('0x1b')]?_0x1c0294[_0xb7eb('0x1b')][_0xb7eb('0x1c')]||null:null,'attributes':_0x1c0294[_0xb7eb('0x1b')]?_0x1c0294[_0xb7eb('0x1b')][_0xb7eb('0x1d')]||null:null,'limit':_0x1c0294[_0xb7eb('0x1b')]?_0x1c0294[_0xb7eb('0x1b')][_0xb7eb('0x1e')]||null:null,'include':_0x1c0294['options']?_0x1c0294['options'][_0xb7eb('0x1f')]?_[_0xb7eb('0x20')](_0x1c0294[_0xb7eb('0x1b')][_0xb7eb('0x1f')],function(_0x68c3d0){return{'model':db[_0x68c3d0['model']],'as':_0x68c3d0['as'],'attributes':_0x68c3d0[_0xb7eb('0x1d')],'include':_0x68c3d0[_0xb7eb('0x1f')]?_[_0xb7eb('0x20')](_0x68c3d0[_0xb7eb('0x1f')],function(_0x48e4d7){return{'model':db[_0x48e4d7[_0xb7eb('0x21')]],'as':_0x48e4d7['as'],'attributes':_0x48e4d7['attributes'],'include':_0x48e4d7[_0xb7eb('0x1f')]?_[_0xb7eb('0x20')](_0x48e4d7[_0xb7eb('0x1f')],function(_0x56a5d7){return{'model':db[_0x56a5d7[_0xb7eb('0x21')]],'as':_0x56a5d7['as'],'attributes':_0x56a5d7[_0xb7eb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb7eb('0xd')](function(_0x3c8676){logger[_0xb7eb('0xe')](_0xb7eb('0x18'),_0x1c0294);logger[_0xb7eb('0x10')](_0xb7eb('0x18'),_0x1c0294,JSON[_0xb7eb('0x12')](_0x3c8676));_0x36fc4d(_0x3c8676);})[_0xb7eb('0x17')](function(_0xc68143){logger[_0xb7eb('0x13')](_0xb7eb('0x18'),_0xc68143['message'],_0x1c0294);_0x499f4e(_0x52324c[_0xb7eb('0x13')](0x1f4,_0xc68143['message']));});});};exports[_0xb7eb('0x22')]=function(_0x4f3e84){var _0x409045=this;return new Promise(function(_0x3ce7e2,_0x57412b){return db[_0xb7eb('0x19')][_0xb7eb('0x23')](_0x4f3e84[_0xb7eb('0x24')],{'raw':_0x4f3e84['options']?_0x4f3e84[_0xb7eb('0x1b')][_0xb7eb('0x25')]===undefined?!![]:![]:!![]})[_0xb7eb('0xd')](function(_0x45e2f7){logger[_0xb7eb('0xe')](_0xb7eb('0x22'),_0x4f3e84);logger['debug'](_0xb7eb('0x22'),_0x4f3e84,JSON[_0xb7eb('0x12')](_0x45e2f7));_0x3ce7e2(_0x45e2f7);})[_0xb7eb('0x17')](function(_0x3b38f2){logger['error'](_0xb7eb('0x22'),_0x3b38f2[_0xb7eb('0x15')],_0x4f3e84);_0x57412b(_0x409045['error'](0x1f4,_0x3b38f2[_0xb7eb('0x15')]));});});};exports[_0xb7eb('0x26')]=function(_0x453676){var _0x4fe8fa=this;return new Promise(function(_0x144b57,_0x593338){return db[_0xb7eb('0x19')][_0xb7eb('0x27')](_0x453676[_0xb7eb('0x24')],{'raw':_0x453676[_0xb7eb('0x1b')]?_0x453676['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x453676[_0xb7eb('0x1b')]?_0x453676[_0xb7eb('0x1b')]['where']||null:null,'attributes':_0x453676[_0xb7eb('0x1b')]?_0x453676[_0xb7eb('0x1b')][_0xb7eb('0x1d')]||null:null,'limit':_0x453676[_0xb7eb('0x1b')]?_0x453676[_0xb7eb('0x1b')][_0xb7eb('0x1e')]||null:null})[_0xb7eb('0xd')](function(_0x1959d7){logger['info'](_0xb7eb('0x26'),_0x453676);logger['debug'](_0xb7eb('0x26'),_0x453676,JSON[_0xb7eb('0x12')](_0x1959d7));_0x144b57(_0x1959d7);})[_0xb7eb('0x17')](function(_0xe6a5ff){logger['error'](_0xb7eb('0x26'),_0xe6a5ff[_0xb7eb('0x15')],_0x453676);_0x593338(_0x4fe8fa[_0xb7eb('0x13')](0x1f4,_0xe6a5ff[_0xb7eb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 79d17fa..09c04fc 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 _0xf5f8=['../../config/environment','./migration.controller','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x37858f,_0x5a87bd){var _0x4d25df=function(_0x3aa61f){while(--_0x3aa61f){_0x37858f['push'](_0x37858f['shift']());}};_0x4d25df(++_0x5a87bd);}(_0xf5f8,0x1bb));var _0x8f5f=function(_0x4c6c5c,_0x47d9db){_0x4c6c5c=_0x4c6c5c-0x0;var _0x532421=_0xf5f8[_0x4c6c5c];return _0x532421;};'use strict';var multer=require(_0x8f5f('0x0'));var util=require(_0x8f5f('0x1'));var path=require(_0x8f5f('0x2'));var timeout=require(_0x8f5f('0x3'));var express=require(_0x8f5f('0x4'));var router=express[_0x8f5f('0x5')]();var fs_extra=require(_0x8f5f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8f5f('0x7'));var config=require(_0x8f5f('0x8'));var controller=require(_0x8f5f('0x9'));router['get']('/',controller['index']);module[_0x8f5f('0xa')]=router; \ No newline at end of file +var _0x9400=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0x9400,0x152));var _0x0940=function(_0x42e7a2,_0x3fda3a){_0x42e7a2=_0x42e7a2-0x0;var _0x2d7a37=_0x9400[_0x42e7a2];return _0x2d7a37;};'use strict';var multer=require(_0x0940('0x0'));var util=require(_0x0940('0x1'));var path=require(_0x0940('0x2'));var timeout=require(_0x0940('0x3'));var express=require(_0x0940('0x4'));var router=express[_0x0940('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0940('0x6'));var interaction=require(_0x0940('0x7'));var config=require(_0x0940('0x8'));var controller=require(_0x0940('0x9'));router[_0x0940('0xa')]('/',controller[_0x0940('0xb')]);module[_0x0940('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7c736ea..dd5ba37 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 _0x1105=['exports','STRING','version'];(function(_0x519874,_0x205d1f){var _0x5d3fa6=function(_0x36be48){while(--_0x36be48){_0x519874['push'](_0x519874['shift']());}};_0x5d3fa6(++_0x205d1f);}(_0x1105,0x15f));var _0x5110=function(_0x3b0ca4,_0x32b0c9){_0x3b0ca4=_0x3b0ca4-0x0;var _0x3f8a8b=_0x1105[_0x3b0ca4];return _0x3f8a8b;};'use strict';var Sequelize=require('sequelize');module[_0x5110('0x0')]={'version':{'type':Sequelize[_0x5110('0x1')],'unique':_0x5110('0x2')}}; \ No newline at end of file +var _0x0960=['sequelize','STRING'];(function(_0x3ba938,_0x27414d){var _0x2aabff=function(_0x10709c){while(--_0x10709c){_0x3ba938['push'](_0x3ba938['shift']());}};_0x2aabff(++_0x27414d);}(_0x0960,0x8e));var _0x0096=function(_0x22ea5c,_0x3eb430){_0x22ea5c=_0x22ea5c-0x0;var _0x28c3da=_0x0960[_0x22ea5c];return _0x28c3da;};'use strict';var Sequelize=require(_0x0096('0x0'));module['exports']={'version':{'type':Sequelize[_0x0096('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index f774492..dc5ea49 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 _0x5e18=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','Migration','findAll','rows','catch','eml-format','zip-dir','request-promise','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x36826a,_0x27ef6a){var _0x3e5a0b=function(_0x398777){while(--_0x398777){_0x36826a['push'](_0x36826a['shift']());}};_0x3e5a0b(++_0x27ef6a);}(_0x5e18,0xfc));var _0x85e1=function(_0x347f41,_0x8fece4){_0x347f41=_0x347f41-0x0;var _0xd3795e=_0x5e18[_0x347f41];return _0xd3795e;};'use strict';var emlformat=require(_0x85e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x85e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85e1('0x2'));var moment=require('moment');var BPromise=require(_0x85e1('0x3'));var Mustache=require('mustache');var util=require(_0x85e1('0x4'));var path=require('path');var sox=require(_0x85e1('0x5'));var csv=require('to-csv');var ejs=require(_0x85e1('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x85e1('0x7'));var crypto=require(_0x85e1('0x8'));var jsforce=require(_0x85e1('0x9'));var deskjs=require(_0x85e1('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x85e1('0xb'));var Redis=require('ioredis');var authService=require(_0x85e1('0xc'));var qs=require(_0x85e1('0xd'));var as=require(_0x85e1('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x85e1('0xf'));var utils=require(_0x85e1('0x10'));var config=require(_0x85e1('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x85e1('0x12'))['db'];function respondWithStatusCode(_0x665c9d,_0xb7b5d2){_0xb7b5d2=_0xb7b5d2||0xcc;return function(_0x3e2a78){if(_0x3e2a78){return _0x665c9d[_0x85e1('0x13')](_0xb7b5d2);}return _0x665c9d[_0x85e1('0x14')](_0xb7b5d2)[_0x85e1('0x15')]();};}function respondWithResult(_0xad62db,_0x4c7eef){_0x4c7eef=_0x4c7eef||0xc8;return function(_0x4a25ab){if(_0x4a25ab){return _0xad62db[_0x85e1('0x14')](_0x4c7eef)[_0x85e1('0x16')](_0x4a25ab);}};}function respondWithFilteredResult(_0x5d9d33,_0x42142f){return function(_0x158aa6){if(_0x158aa6){var _0x3c080b=typeof _0x42142f[_0x85e1('0x17')]===_0x85e1('0x18')&&typeof _0x42142f[_0x85e1('0x19')]==='undefined';var _0x33eca4=_0x158aa6['count'];var _0x546c41=_0x3c080b?0x0:_0x42142f[_0x85e1('0x17')];var _0x277045=_0x3c080b?_0x158aa6['count']:_0x42142f[_0x85e1('0x17')]+_0x42142f[_0x85e1('0x19')];var _0x24312a;if(_0x277045>=_0x33eca4){_0x277045=_0x33eca4;_0x24312a=0xc8;}else{_0x24312a=0xce;}_0x5d9d33[_0x85e1('0x14')](_0x24312a);return _0x5d9d33[_0x85e1('0x1a')](_0x85e1('0x1b'),_0x546c41+'-'+_0x277045+'/'+_0x33eca4)[_0x85e1('0x16')](_0x158aa6);}return null;};}function patchUpdates(_0x2254ae){return function(_0x5767e7){try{jsonpatch[_0x85e1('0x1c')](_0x5767e7,_0x2254ae,!![]);}catch(_0x584f42){return BPromise[_0x85e1('0x1d')](_0x584f42);}return _0x5767e7[_0x85e1('0x1e')]();};}function saveUpdates(_0xacf90e,_0x12732e){return function(_0x4147e0){if(_0x4147e0){return _0x4147e0['update'](_0xacf90e)['then'](function(_0x2a56e2){return _0x2a56e2;});}return null;};}function removeEntity(_0x426f3c,_0x2cc6f5){return function(_0x488706){if(_0x488706){return _0x488706[_0x85e1('0x1f')]()[_0x85e1('0x20')](function(){_0x426f3c[_0x85e1('0x14')](0xcc)[_0x85e1('0x15')]();});}};}function handleEntityNotFound(_0x587fd6,_0x2cb611){return function(_0x1b27af){if(!_0x1b27af){_0x587fd6[_0x85e1('0x13')](0x194);}return _0x1b27af;};}function handleError(_0x5981b9,_0x501c26){_0x501c26=_0x501c26||0x1f4;return function(_0x1b1d50){logger[_0x85e1('0x21')](_0x1b1d50[_0x85e1('0x22')]);if(_0x1b1d50['name']){delete _0x1b1d50[_0x85e1('0x23')];}_0x5981b9[_0x85e1('0x14')](_0x501c26)[_0x85e1('0x24')](_0x1b1d50);};}exports[_0x85e1('0x25')]=function(_0x5dc818,_0x38e0b5){var _0x31a21f={},_0x28841b={},_0x2682b8={'count':0x0,'rows':[]};var _0x5eea36=_[_0x85e1('0x26')](db['Migration'][_0x85e1('0x27')],function(_0xe3971c){return{'name':_0xe3971c[_0x85e1('0x28')],'type':_0xe3971c['type'][_0x85e1('0x29')]};});_0x28841b[_0x85e1('0x2a')]=_[_0x85e1('0x26')](_0x5eea36,_0x85e1('0x23'));_0x28841b[_0x85e1('0x2b')]=_['keys'](_0x5dc818[_0x85e1('0x2b')]);_0x28841b[_0x85e1('0x2c')]=_[_0x85e1('0x2d')](_0x28841b['model'],_0x28841b[_0x85e1('0x2b')]);_0x31a21f[_0x85e1('0x2e')]=_[_0x85e1('0x2d')](_0x28841b['model'],qs[_0x85e1('0x2f')](_0x5dc818['query'][_0x85e1('0x2f')]));_0x31a21f[_0x85e1('0x2e')]=_0x31a21f[_0x85e1('0x2e')][_0x85e1('0x30')]?_0x31a21f[_0x85e1('0x2e')]:_0x28841b[_0x85e1('0x2a')];if(!_0x5dc818[_0x85e1('0x2b')]['hasOwnProperty'](_0x85e1('0x31'))){_0x31a21f['limit']=qs[_0x85e1('0x19')](_0x5dc818[_0x85e1('0x2b')]['limit']);_0x31a21f[_0x85e1('0x17')]=qs[_0x85e1('0x17')](_0x5dc818['query'][_0x85e1('0x17')]);}_0x31a21f[_0x85e1('0x32')]=qs[_0x85e1('0x33')](_0x5dc818['query'][_0x85e1('0x33')]);_0x31a21f[_0x85e1('0x34')]=qs[_0x85e1('0x2c')](_[_0x85e1('0x35')](_0x5dc818[_0x85e1('0x2b')],_0x28841b[_0x85e1('0x2c')]),_0x5eea36);if(_0x5dc818['query'][_0x85e1('0x36')]){_0x31a21f['where']=_[_0x85e1('0x37')](_0x31a21f[_0x85e1('0x34')],{'$or':_['map'](_0x5eea36,function(_0x5a0e2a){if(_0x5a0e2a[_0x85e1('0x38')]!==_0x85e1('0x39')){var _0x114131={};_0x114131[_0x5a0e2a[_0x85e1('0x23')]]={'$like':'%'+_0x5dc818[_0x85e1('0x2b')]['filter']+'%'};return _0x114131;}})});}_0x31a21f=_['merge']({},_0x31a21f,_0x5dc818[_0x85e1('0x3a')]);var _0x2c8907={'where':_0x31a21f['where']};return db['Migration'][_0x85e1('0x3b')](_0x2c8907)[_0x85e1('0x20')](function(_0x291266){_0x2682b8['count']=_0x291266;if(_0x5dc818[_0x85e1('0x2b')][_0x85e1('0x3c')]){_0x31a21f[_0x85e1('0x3d')]=[{'all':!![]}];}return db[_0x85e1('0x3e')][_0x85e1('0x3f')](_0x31a21f);})['then'](function(_0x9e1fc0){_0x2682b8[_0x85e1('0x40')]=_0x9e1fc0;return _0x2682b8;})[_0x85e1('0x20')](respondWithFilteredResult(_0x38e0b5,_0x31a21f))[_0x85e1('0x41')](handleError(_0x38e0b5,null));}; \ No newline at end of file +var _0xc988=['lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','reject','save','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','Migration','findAll','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0xc988,0x132));var _0x8c98=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xc988[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require(_0x8c98('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8c98('0x1'));var rp=require(_0x8c98('0x2'));var moment=require(_0x8c98('0x3'));var BPromise=require(_0x8c98('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c98('0x5'));var sox=require('sox');var csv=require(_0x8c98('0x6'));var ejs=require(_0x8c98('0x7'));var fs=require('fs');var fs_extra=require(_0x8c98('0x8'));var _=require(_0x8c98('0x9'));var squel=require('squel');var crypto=require(_0x8c98('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8c98('0xb'));var toCsv=require(_0x8c98('0x6'));var querystring=require(_0x8c98('0xc'));var Papa=require(_0x8c98('0xd'));var Redis=require(_0x8c98('0xe'));var authService=require(_0x8c98('0xf'));var qs=require(_0x8c98('0x10'));var as=require(_0x8c98('0x11'));var hardwareService=require(_0x8c98('0x12'));var logger=require(_0x8c98('0x13'))(_0x8c98('0x14'));var utils=require(_0x8c98('0x15'));var config=require(_0x8c98('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4259c5,_0x4ebf92){_0x4ebf92=_0x4ebf92||0xcc;return function(_0xcc8869){if(_0xcc8869){return _0x4259c5[_0x8c98('0x17')](_0x4ebf92);}return _0x4259c5[_0x8c98('0x18')](_0x4ebf92)['end']();};}function respondWithResult(_0x21acc9,_0x41c9df){_0x41c9df=_0x41c9df||0xc8;return function(_0x5621a9){if(_0x5621a9){return _0x21acc9[_0x8c98('0x18')](_0x41c9df)[_0x8c98('0x19')](_0x5621a9);}};}function respondWithFilteredResult(_0x124a4c,_0x4d4c22){return function(_0x5bbfd1){if(_0x5bbfd1){var _0x2fd3b4=typeof _0x4d4c22[_0x8c98('0x1a')]===_0x8c98('0x1b')&&typeof _0x4d4c22[_0x8c98('0x1c')]===_0x8c98('0x1b');var _0x38e81d=_0x5bbfd1[_0x8c98('0x1d')];var _0x2369c7=_0x2fd3b4?0x0:_0x4d4c22[_0x8c98('0x1a')];var _0x59e163=_0x2fd3b4?_0x5bbfd1['count']:_0x4d4c22['offset']+_0x4d4c22[_0x8c98('0x1c')];var _0x4cfc92;if(_0x59e163>=_0x38e81d){_0x59e163=_0x38e81d;_0x4cfc92=0xc8;}else{_0x4cfc92=0xce;}_0x124a4c[_0x8c98('0x18')](_0x4cfc92);return _0x124a4c['set']('Content-Range',_0x2369c7+'-'+_0x59e163+'/'+_0x38e81d)[_0x8c98('0x19')](_0x5bbfd1);}return null;};}function patchUpdates(_0x482eda){return function(_0x54be95){try{jsonpatch['apply'](_0x54be95,_0x482eda,!![]);}catch(_0x22d114){return BPromise[_0x8c98('0x1e')](_0x22d114);}return _0x54be95[_0x8c98('0x1f')]();};}function saveUpdates(_0x20276b,_0xba6fa2){return function(_0x2a7c43){if(_0x2a7c43){return _0x2a7c43['update'](_0x20276b)[_0x8c98('0x20')](function(_0x4dc3c6){return _0x4dc3c6;});}return null;};}function removeEntity(_0x43bf0f,_0x382763){return function(_0x4292d0){if(_0x4292d0){return _0x4292d0[_0x8c98('0x21')]()[_0x8c98('0x20')](function(){_0x43bf0f[_0x8c98('0x18')](0xcc)[_0x8c98('0x22')]();});}};}function handleEntityNotFound(_0x5ee0bd,_0x184d59){return function(_0x104c9c){if(!_0x104c9c){_0x5ee0bd[_0x8c98('0x17')](0x194);}return _0x104c9c;};}function handleError(_0x4b9670,_0x2b0a8b){_0x2b0a8b=_0x2b0a8b||0x1f4;return function(_0x399b60){logger[_0x8c98('0x23')](_0x399b60['stack']);if(_0x399b60['name']){delete _0x399b60[_0x8c98('0x24')];}_0x4b9670[_0x8c98('0x18')](_0x2b0a8b)[_0x8c98('0x25')](_0x399b60);};}exports['index']=function(_0x3b3fea,_0x52ebff){var _0x86a228={},_0x902a58={},_0x4f3398={'count':0x0,'rows':[]};var _0x4b66d5=_[_0x8c98('0x26')](db['Migration'][_0x8c98('0x27')],function(_0x519429){return{'name':_0x519429[_0x8c98('0x28')],'type':_0x519429[_0x8c98('0x29')][_0x8c98('0x2a')]};});_0x902a58[_0x8c98('0x2b')]=_[_0x8c98('0x26')](_0x4b66d5,_0x8c98('0x24'));_0x902a58[_0x8c98('0x2c')]=_[_0x8c98('0x2d')](_0x3b3fea[_0x8c98('0x2c')]);_0x902a58['filters']=_['intersection'](_0x902a58['model'],_0x902a58[_0x8c98('0x2c')]);_0x86a228[_0x8c98('0x2e')]=_[_0x8c98('0x2f')](_0x902a58[_0x8c98('0x2b')],qs['fields'](_0x3b3fea[_0x8c98('0x2c')]['fields']));_0x86a228[_0x8c98('0x2e')]=_0x86a228['attributes'][_0x8c98('0x30')]?_0x86a228['attributes']:_0x902a58['model'];if(!_0x3b3fea[_0x8c98('0x2c')][_0x8c98('0x31')](_0x8c98('0x32'))){_0x86a228[_0x8c98('0x1c')]=qs[_0x8c98('0x1c')](_0x3b3fea[_0x8c98('0x2c')][_0x8c98('0x1c')]);_0x86a228['offset']=qs[_0x8c98('0x1a')](_0x3b3fea[_0x8c98('0x2c')][_0x8c98('0x1a')]);}_0x86a228[_0x8c98('0x33')]=qs[_0x8c98('0x34')](_0x3b3fea[_0x8c98('0x2c')][_0x8c98('0x34')]);_0x86a228[_0x8c98('0x35')]=qs[_0x8c98('0x36')](_[_0x8c98('0x37')](_0x3b3fea['query'],_0x902a58[_0x8c98('0x36')]),_0x4b66d5);if(_0x3b3fea['query'][_0x8c98('0x38')]){_0x86a228[_0x8c98('0x35')]=_['merge'](_0x86a228[_0x8c98('0x35')],{'$or':_[_0x8c98('0x26')](_0x4b66d5,function(_0x415f7b){if(_0x415f7b[_0x8c98('0x29')]!==_0x8c98('0x39')){var _0x2e5d1c={};_0x2e5d1c[_0x415f7b[_0x8c98('0x24')]]={'$like':'%'+_0x3b3fea[_0x8c98('0x2c')][_0x8c98('0x38')]+'%'};return _0x2e5d1c;}})});}_0x86a228=_['merge']({},_0x86a228,_0x3b3fea[_0x8c98('0x3a')]);var _0x37edf2={'where':_0x86a228['where']};return db['Migration'][_0x8c98('0x1d')](_0x37edf2)[_0x8c98('0x20')](function(_0x42e038){_0x4f3398[_0x8c98('0x1d')]=_0x42e038;if(_0x3b3fea[_0x8c98('0x2c')][_0x8c98('0x3b')]){_0x86a228['include']=[{'all':!![]}];}return db[_0x8c98('0x3c')][_0x8c98('0x3d')](_0x86a228);})[_0x8c98('0x20')](function(_0x2ee29e){_0x4f3398['rows']=_0x2ee29e;return _0x4f3398;})[_0x8c98('0x20')](respondWithFilteredResult(_0x52ebff,_0x86a228))[_0x8c98('0x3e')](handleError(_0x52ebff,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 6ffe17e..82cb70d 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 _0x0d67=['../../config/environment','define','migrations','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0d67,0x14d));var _0x70d6=function(_0x3d3195,_0x1d9a9c){_0x3d3195=_0x3d3195-0x0;var _0x5e97a5=_0x0d67[_0x3d3195];return _0x5e97a5;};'use strict';var _=require(_0x70d6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x70d6('0x1'));var moment=require(_0x70d6('0x2'));var BPromise=require(_0x70d6('0x3'));var rp=require(_0x70d6('0x4'));var fs=require('fs');var path=require(_0x70d6('0x5'));var rimraf=require(_0x70d6('0x6'));var config=require(_0x70d6('0x7'));var attributes=require('./migration.attributes');module['exports']=function(_0x4fac66,_0x1466b0){return _0x4fac66[_0x70d6('0x8')]('Migration',attributes,{'tableName':_0x70d6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd8d=['Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./migration.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd8d,0x113));var _0xdbd8=function(_0x22986c,_0x45869c){_0x22986c=_0x22986c-0x0;var _0x2a0f2f=_0xbd8d[_0x22986c];return _0x2a0f2f;};'use strict';var _=require(_0xdbd8('0x0'));var util=require(_0xdbd8('0x1'));var logger=require(_0xdbd8('0x2'))(_0xdbd8('0x3'));var moment=require(_0xdbd8('0x4'));var BPromise=require(_0xdbd8('0x5'));var rp=require(_0xdbd8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbd8('0x7'));var config=require('../../config/environment');var attributes=require(_0xdbd8('0x8'));module[_0xdbd8('0x9')]=function(_0xb91946,_0x52891f){return _0xb91946[_0xdbd8('0xa')](_0xdbd8('0xb'),attributes,{'tableName':_0xdbd8('0xc'),'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 bde3797..39569ba 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 _0x750a=['error','code','Migration,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify'];(function(_0x504ced,_0x14e76b){var _0x42fd26=function(_0x1f9dab){while(--_0x1f9dab){_0x504ced['push'](_0x504ced['shift']());}};_0x42fd26(++_0x14e76b);}(_0x750a,0x140));var _0xa750=function(_0x4a22c5,_0x5ac44b){_0x4a22c5=_0x4a22c5-0x0;var _0x5ba569=_0x750a[_0x4a22c5];return _0x5ba569;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('Migration,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});} \ No newline at end of file +var _0x0eaa=['http','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x154a6d,_0x23c132){var _0x288660=function(_0x456659){while(--_0x456659){_0x154a6d['push'](_0x154a6d['shift']());}};_0x288660(++_0x23c132);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x46e421,_0x1eeabf){_0x46e421=_0x46e421-0x0;var _0x3bc5b9=_0x0eaa[_0x46e421];return _0x3bc5b9;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0ea('0x2'));var fs=require('fs');var Redis=require(_0xa0ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0ea('0x4'));var logger=require(_0xa0ea('0x5'))(_0xa0ea('0x6'));var config=require(_0xa0ea('0x7'));var jayson=require(_0xa0ea('0x8'));var client=jayson['client'][_0xa0ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x521881,_0x4b8856,_0x361178){return new BPromise(function(_0x8632a1,_0x5b2adc){return client['request'](_0x521881,_0x361178)[_0xa0ea('0xa')](function(_0x2746f2){logger[_0xa0ea('0xb')](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));logger['debug'](_0xa0ea('0xe'),_0x4b8856,_0xa0ea('0xd'),JSON[_0xa0ea('0xf')](_0x2746f2));if(_0x2746f2[_0xa0ea('0x10')]){if(_0x2746f2['error'][_0xa0ea('0x11')]===0x1f4){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x5b2adc(_0x2746f2['error'][_0xa0ea('0x12')]);}logger[_0xa0ea('0x10')]('Migration,\x20%s,\x20%s',_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x8632a1(_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);}else{logger['info'](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));_0x8632a1(_0x2746f2[_0xa0ea('0x13')][_0xa0ea('0x12')]);}})[_0xa0ea('0x14')](function(_0x34b94c){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x34b94c);_0x5b2adc(_0x34b94c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index c7fd9d7..44eea3a 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 _0xe98c=['get','isAuthenticated','/:id','post','create','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x103abd,_0x3732c3){var _0x3058f9=function(_0x191ec9){while(--_0x191ec9){_0x103abd['push'](_0x103abd['shift']());}};_0x3058f9(++_0x3732c3);}(_0xe98c,0xd3));var _0xce98=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xe98c[_0x4dcc2d];return _0x1bbd79;};'use strict';var multer=require(_0xce98('0x0'));var util=require(_0xce98('0x1'));var path=require(_0xce98('0x2'));var timeout=require(_0xce98('0x3'));var express=require(_0xce98('0x4'));var router=express['Router']();var fs_extra=require(_0xce98('0x5'));var auth=require(_0xce98('0x6'));var interaction=require(_0xce98('0x7'));var config=require(_0xce98('0x8'));var controller=require(_0xce98('0x9'));router[_0xce98('0xa')]('/',auth[_0xce98('0xb')](),controller['index']);router[_0xce98('0xa')](_0xce98('0xc'),auth[_0xce98('0xb')](),controller['show']);router[_0xce98('0xd')]('/',auth['isAuthenticated'](),controller[_0xce98('0xe')]);router['put'](_0xce98('0xc'),auth[_0xce98('0xb')](),controller[_0xce98('0xf')]);router['delete'](_0xce98('0xc'),auth[_0xce98('0xb')](),controller[_0xce98('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2da6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x48e171,_0x504946){var _0x1614ad=function(_0x5e664b){while(--_0x5e664b){_0x48e171['push'](_0x48e171['shift']());}};_0x1614ad(++_0x504946);}(_0x2da6,0x1dd));var _0x62da=function(_0x5c3bef,_0x6d186c){_0x5c3bef=_0x5c3bef-0x0;var _0x39420b=_0x2da6[_0x5c3bef];return _0x39420b;};'use strict';var multer=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var path=require(_0x62da('0x2'));var timeout=require(_0x62da('0x3'));var express=require(_0x62da('0x4'));var router=express[_0x62da('0x5')]();var fs_extra=require(_0x62da('0x6'));var auth=require(_0x62da('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x62da('0x8'));router[_0x62da('0x9')]('/',auth[_0x62da('0xa')](),controller[_0x62da('0xb')]);router[_0x62da('0x9')](_0x62da('0xc'),auth[_0x62da('0xa')](),controller[_0x62da('0xd')]);router[_0x62da('0xe')]('/',auth['isAuthenticated'](),controller[_0x62da('0xf')]);router[_0x62da('0x10')](_0x62da('0xc'),auth[_0x62da('0xa')](),controller['update']);router[_0x62da('0x11')](_0x62da('0xc'),auth[_0x62da('0xa')](),controller[_0x62da('0x12')]);module[_0x62da('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 7bea179..28ee762 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 _0xc633=['sequelize','exports','ENUM','localnet','turn','STRING'];(function(_0x30a201,_0x178d8d){var _0x200ec0=function(_0x5f4862){while(--_0x5f4862){_0x30a201['push'](_0x30a201['shift']());}};_0x200ec0(++_0x178d8d);}(_0xc633,0x66));var _0x3c63=function(_0x34cc52,_0x5f0c7e){_0x34cc52=_0x34cc52-0x0;var _0x296404=_0xc633[_0x34cc52];return _0x296404;};'use strict';var Sequelize=require(_0x3c63('0x0'));module[_0x3c63('0x1')]={'type':{'type':Sequelize[_0x3c63('0x2')](_0x3c63('0x3'),'externip','stun',_0x3c63('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3c63('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9993=['turn','STRING','localnet','stun'];(function(_0x246360,_0x46ed80){var _0x3d3aea=function(_0x18275c){while(--_0x18275c){_0x246360['push'](_0x246360['shift']());}};_0x3d3aea(++_0x46ed80);}(_0x9993,0x182));var _0x3999=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x9993[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x3999('0x0'),'externip',_0x3999('0x1'),_0x3999('0x2'))},'value':{'type':Sequelize[_0x3999('0x3')]},'username':{'type':Sequelize[_0x3999('0x3')]},'password':{'type':Sequelize[_0x3999('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 4cd9e28..bc67771 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 _0x1e0d=['Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','undefined','limit','count','offset','status','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','toUpperCase','STUN','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','update','server/files/templates/stun_multiple.ejs','TURN','/etc/asterisk/sip_xcally_%s.conf','util','path','lodash','api','../../mysqldb','jayson/promise','client','http','then','info'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1e0d,0x14e));var _0xd1e0=function(_0x313b30,_0x42d580){_0x313b30=_0x313b30-0x0;var _0x2e2e85=_0x1e0d[_0x313b30];return _0x2e2e85;};'use strict';var util=require(_0xd1e0('0x0'));var path=require(_0xd1e0('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd1e0('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd1e0('0x3'));var config=require('../../config/environment');var db=require(_0xd1e0('0x4'))['db'];var jayson=require(_0xd1e0('0x5'));var client=jayson[_0xd1e0('0x6')][_0xd1e0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x404baa,_0x478d23,_0x20d5dc,_0x1db3d0){return new Promise(function(_0x4d24d3,_0x14e1b1){var _0x14cec2=_0x1db3d0||client;return _0x14cec2['request'](_0x404baa,_0x20d5dc)[_0xd1e0('0x8')](function(_0x5ac81e){logger[_0xd1e0('0x9')](_0xd1e0('0xa'),_0x478d23,_0xd1e0('0xb'));logger[_0xd1e0('0xc')](_0xd1e0('0xd'),_0x478d23,'request\x20sent',JSON[_0xd1e0('0xe')](_0x5ac81e));if(_0x5ac81e[_0xd1e0('0xf')]){if(_0x5ac81e['error'][_0xd1e0('0x10')]===0x1f4){logger['error'](_0xd1e0('0xa'),_0x478d23,_0x5ac81e[_0xd1e0('0xf')][_0xd1e0('0x11')]);return _0x14e1b1(_0x5ac81e[_0xd1e0('0xf')][_0xd1e0('0x11')]);}logger['error'](_0xd1e0('0xa'),_0x478d23,_0x5ac81e['error'][_0xd1e0('0x11')]);return _0x4d24d3(_0x5ac81e['error'][_0xd1e0('0x11')]);}else{logger[_0xd1e0('0x9')](_0xd1e0('0xa'),_0x478d23,_0xd1e0('0xb'));_0x4d24d3(_0x5ac81e[_0xd1e0('0x12')][_0xd1e0('0x11')]);}})[_0xd1e0('0x13')](function(_0x43e68a){logger[_0xd1e0('0xf')]('Network,\x20%s,\x20%s',_0x478d23,_0x43e68a);_0x14e1b1(_0x43e68a);});});}function respondWithResult(_0x11b21e,_0x3840cb){_0x3840cb=_0x3840cb||0xc8;return function(_0x10602e){if(_0x10602e){return _0x11b21e['status'](_0x3840cb)[_0xd1e0('0x14')](_0x10602e);}};}function respondWithFilteredResult(_0x51016d,_0x5628c8){return function(_0x1580d0){if(_0x1580d0){var _0x8555cc=typeof _0x5628c8['offset']===_0xd1e0('0x15')&&typeof _0x5628c8[_0xd1e0('0x16')]===_0xd1e0('0x15');var _0x36b8ed=_0x1580d0[_0xd1e0('0x17')];var _0x3dcf5a=_0x8555cc?0x0:_0x5628c8[_0xd1e0('0x18')];var _0xc698e9=_0x8555cc?_0x1580d0[_0xd1e0('0x17')]:_0x5628c8['offset']+_0x5628c8[_0xd1e0('0x16')];var _0x4532e6;if(_0xc698e9>=_0x36b8ed){_0xc698e9=_0x36b8ed;_0x4532e6=0xc8;}else{_0x4532e6=0xce;}_0x51016d[_0xd1e0('0x19')](_0x4532e6);return _0x51016d['set'](_0xd1e0('0x1a'),_0x3dcf5a+'-'+_0xc698e9+'/'+_0x36b8ed)[_0xd1e0('0x14')](_0x1580d0);}return null;};}function saveUpdates(_0x159ed6){return function(_0x27937f){if(_0x27937f){return _0x27937f['update'](_0x159ed6)[_0xd1e0('0x8')](function(_0x23e544){return _0x23e544;});}return null;};}function removeEntity(_0x3891df){return function(_0x2608d9){if(_0x2608d9){return _0x2608d9[_0xd1e0('0x1b')]()[_0xd1e0('0x8')](function(){_0x3891df['status'](0xcc)[_0xd1e0('0x1c')]();});}};}function handleEntityNotFound(_0x57edd7){return function(_0x4b9173){if(!_0x4b9173){_0x57edd7[_0xd1e0('0x1d')](0x194);}return _0x4b9173;};}function handleError(_0x34ef28,_0x1bbe84){_0x1bbe84=_0x1bbe84||0x1f4;return function(_0x3bd5a4){logger[_0xd1e0('0xf')](_0x3bd5a4[_0xd1e0('0x1e')]);if(_0x3bd5a4['name']){delete _0x3bd5a4[_0xd1e0('0x1f')];}_0x34ef28[_0xd1e0('0x19')](_0x1bbe84)[_0xd1e0('0x20')](_0x3bd5a4);};}exports[_0xd1e0('0x21')]=function(_0xc227c8,_0x30472d){var _0x10e793={},_0x426200={},_0x2c18cd={'count':0x0,'rows':[]};var _0x17b836=_[_0xd1e0('0x22')](db[_0xd1e0('0x23')][_0xd1e0('0x24')],function(_0x59884f){return{'name':_0x59884f[_0xd1e0('0x25')],'type':_0x59884f[_0xd1e0('0x26')][_0xd1e0('0x27')]};});_0x426200[_0xd1e0('0x28')]=_['map'](_0x17b836,'name');_0x426200['query']=_[_0xd1e0('0x29')](_0xc227c8[_0xd1e0('0x2a')]);_0x426200[_0xd1e0('0x2b')]=_[_0xd1e0('0x2c')](_0x426200['model'],_0x426200[_0xd1e0('0x2a')]);_0x10e793[_0xd1e0('0x2d')]=_[_0xd1e0('0x2c')](_0x426200[_0xd1e0('0x28')],qs[_0xd1e0('0x2e')](_0xc227c8[_0xd1e0('0x2a')][_0xd1e0('0x2e')]));_0x10e793[_0xd1e0('0x2d')]=_0x10e793[_0xd1e0('0x2d')][_0xd1e0('0x2f')]?_0x10e793[_0xd1e0('0x2d')]:_0x426200['model'];if(!_0xc227c8[_0xd1e0('0x2a')][_0xd1e0('0x30')]('nolimit')){_0x10e793[_0xd1e0('0x16')]=qs[_0xd1e0('0x16')](_0xc227c8[_0xd1e0('0x2a')]['limit']);_0x10e793[_0xd1e0('0x18')]=qs[_0xd1e0('0x18')](_0xc227c8[_0xd1e0('0x2a')][_0xd1e0('0x18')]);}_0x10e793[_0xd1e0('0x31')]=qs[_0xd1e0('0x32')](_0xc227c8['query'][_0xd1e0('0x32')]);_0x10e793[_0xd1e0('0x33')]=qs['filters'](_[_0xd1e0('0x34')](_0xc227c8[_0xd1e0('0x2a')],_0x426200[_0xd1e0('0x2b')]),_0x17b836);if(_0xc227c8[_0xd1e0('0x2a')]['filter']){_0x10e793[_0xd1e0('0x33')]=_[_0xd1e0('0x35')](_0x10e793[_0xd1e0('0x33')],{'$or':_[_0xd1e0('0x22')](_0x17b836,function(_0x2f6867){if(_0x2f6867[_0xd1e0('0x26')]!=='VIRTUAL'){var _0x1329cb={};_0x1329cb[_0x2f6867[_0xd1e0('0x1f')]]={'$like':'%'+_0xc227c8['query'][_0xd1e0('0x36')]+'%'};return _0x1329cb;}})});}_0x10e793=_[_0xd1e0('0x35')]({},_0x10e793,_0xc227c8[_0xd1e0('0x37')]);var _0x1db8b6={'where':_0x10e793[_0xd1e0('0x33')]};return db['Network'][_0xd1e0('0x17')](_0x1db8b6)[_0xd1e0('0x8')](function(_0x1197ad){_0x2c18cd[_0xd1e0('0x17')]=_0x1197ad;if(_0xc227c8[_0xd1e0('0x2a')][_0xd1e0('0x38')]){_0x10e793[_0xd1e0('0x39')]=[{'all':!![]}];}return db[_0xd1e0('0x23')][_0xd1e0('0x3a')](_0x10e793);})[_0xd1e0('0x8')](function(_0x5a2ebd){_0x2c18cd[_0xd1e0('0x3b')]=_0x5a2ebd;return _0x2c18cd;})[_0xd1e0('0x8')](respondWithFilteredResult(_0x30472d,_0x10e793))[_0xd1e0('0x13')](handleError(_0x30472d,null));};exports[_0xd1e0('0x3c')]=function(_0x4e9801,_0x50ecd6){var _0x24506c={'raw':!![],'where':{'id':_0x4e9801[_0xd1e0('0x3d')]['id']}},_0x5a021e={};_0x5a021e[_0xd1e0('0x28')]=_[_0xd1e0('0x29')](db[_0xd1e0('0x23')][_0xd1e0('0x24')]);_0x5a021e[_0xd1e0('0x2a')]=_[_0xd1e0('0x29')](_0x4e9801[_0xd1e0('0x2a')]);_0x5a021e[_0xd1e0('0x2b')]=_['intersection'](_0x5a021e[_0xd1e0('0x28')],_0x5a021e['query']);_0x24506c['attributes']=_[_0xd1e0('0x2c')](_0x5a021e[_0xd1e0('0x28')],qs['fields'](_0x4e9801[_0xd1e0('0x2a')]['fields']));_0x24506c['attributes']=_0x24506c['attributes'][_0xd1e0('0x2f')]?_0x24506c[_0xd1e0('0x2d')]:_0x5a021e[_0xd1e0('0x28')];if(_0x4e9801[_0xd1e0('0x2a')][_0xd1e0('0x38')]){_0x24506c['include']=[{'all':!![]}];}_0x24506c=_[_0xd1e0('0x35')]({},_0x24506c,_0x4e9801[_0xd1e0('0x37')]);return db[_0xd1e0('0x23')][_0xd1e0('0x3e')](_0x24506c)[_0xd1e0('0x8')](handleEntityNotFound(_0x50ecd6,null))[_0xd1e0('0x8')](respondWithResult(_0x50ecd6,null))[_0xd1e0('0x13')](handleError(_0x50ecd6,null));};exports[_0xd1e0('0x3f')]=function(_0x47da76,_0x2038c8){var _0x41b738;return db[_0xd1e0('0x23')][_0xd1e0('0x3f')](_0x47da76['body'],{'raw':!![]})['then'](function(_0x37cb88){_0x41b738=_0x37cb88;return db[_0xd1e0('0x23')]['findAll']({'where':{'type':_0x47da76[_0xd1e0('0x40')][_0xd1e0('0x26')]},'raw':!![]});})[_0xd1e0('0x8')](function(_0x5af0c0){if(_0x41b738[_0xd1e0('0x26')][_0xd1e0('0x41')]()==_0xd1e0('0x42')){var _0x45d9fa=fs[_0xd1e0('0x43')](path[_0xd1e0('0x44')](config[_0xd1e0('0x45')],'server/files/templates/stun_multiple.ejs'),_0xd1e0('0x46'));var _0x4946a6=ejs['render'](_0x45d9fa,{'networks':_0x5af0c0||[]});fs[_0xd1e0('0x47')](_0xd1e0('0x48'),_0x4946a6);return respondWithRpcPromise(_0xd1e0('0x49'),_0xd1e0('0x3f'),{'module':'res_stun_monitor.so'});}else if(_0x41b738[_0xd1e0('0x26')][_0xd1e0('0x41')]()=='TURN'){var _0x5b6910=fs[_0xd1e0('0x43')](path[_0xd1e0('0x44')](config[_0xd1e0('0x45')],_0xd1e0('0x4a')),'utf8');var _0x503a47=ejs[_0xd1e0('0x4b')](_0x5b6910,{'networks':_0x5af0c0||[]});fs[_0xd1e0('0x47')](_0xd1e0('0x4c'),_0x503a47);return respondWithRpcPromise(_0xd1e0('0x49'),_0xd1e0('0x3f'),{'module':_0xd1e0('0x4d')});}else{var _0xeac223=fs[_0xd1e0('0x43')](path['join'](config[_0xd1e0('0x45')],_0xd1e0('0x4e')),_0xd1e0('0x46'));var _0xac7ee8=ejs['render'](_0xeac223,{'networks':_0x5af0c0||[]});fs['writeFileSync'](util[_0xd1e0('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x47da76['body']['type'][_0xd1e0('0x50')]()),_0xac7ee8);return respondWithRpcPromise(_0xd1e0('0x49'),'create',{'module':_0xd1e0('0x51')});}})[_0xd1e0('0x8')](function(){return _0x41b738;})['then'](respondWithResult(_0x2038c8,0xc9))['catch'](handleError(_0x2038c8,null));};exports[_0xd1e0('0x52')]=function(_0x392e7c,_0x594bb2){var _0xeb5ac8;return db[_0xd1e0('0x23')][_0xd1e0('0x3e')]({'where':{'id':_0x392e7c[_0xd1e0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x594bb2,null))['then'](saveUpdates(_0x392e7c[_0xd1e0('0x40')],null))[_0xd1e0('0x8')](function(_0x3a1013){if(_0x3a1013){_0xeb5ac8=_0x3a1013;return db['Network'][_0xd1e0('0x3a')]({'where':{'type':_0xeb5ac8[_0xd1e0('0x26')]},'raw':!![]});}return null;})[_0xd1e0('0x8')](function(_0x4b74bd){if(_0xeb5ac8[_0xd1e0('0x26')]['toUpperCase']()==_0xd1e0('0x42')){var _0x327f18=fs[_0xd1e0('0x43')](path['join'](config['root'],_0xd1e0('0x53')),_0xd1e0('0x46'));var _0x1ccf09=ejs[_0xd1e0('0x4b')](_0x327f18,{'networks':_0x4b74bd||[]});fs[_0xd1e0('0x47')](_0xd1e0('0x48'),_0x1ccf09);return respondWithRpcPromise(_0xd1e0('0x49'),'update',{'module':_0xd1e0('0x4d')});}else if(_0xeb5ac8[_0xd1e0('0x26')][_0xd1e0('0x41')]()==_0xd1e0('0x54')){var _0x4f4492=fs[_0xd1e0('0x43')](path[_0xd1e0('0x44')](config[_0xd1e0('0x45')],_0xd1e0('0x4a')),_0xd1e0('0x46'));var _0x244eee=ejs['render'](_0x4f4492,{'networks':_0x4b74bd||[]});fs['writeFileSync'](_0xd1e0('0x4c'),_0x244eee);return respondWithRpcPromise(_0xd1e0('0x49'),_0xd1e0('0x52'),{'module':'res_stun_monitor.so'});}else{var _0x877003=fs[_0xd1e0('0x43')](path[_0xd1e0('0x44')](config[_0xd1e0('0x45')],_0xd1e0('0x4e')),_0xd1e0('0x46'));var _0xca3d4f=ejs['render'](_0x877003,{'networks':_0x4b74bd||[]});fs[_0xd1e0('0x47')](util['format'](_0xd1e0('0x55'),_0x392e7c['body']['type']['toLowerCase']()),_0xca3d4f);return respondWithRpcPromise(_0xd1e0('0x49'),_0xd1e0('0x52'),{'module':_0xd1e0('0x51')});}})['then'](function(_0xb07c4d){if(_0xb07c4d){return _0xeb5ac8;}return null;})['then'](respondWithResult(_0x594bb2,null))[_0xd1e0('0x13')](handleError(_0x594bb2,null));};exports[_0xd1e0('0x1b')]=function(_0x23eefc,_0x4b177c){var _0x5069e9;return db[_0xd1e0('0x23')][_0xd1e0('0x3e')]({'where':{'id':_0x23eefc[_0xd1e0('0x3d')]['id']}})[_0xd1e0('0x8')](function(_0x3b20b1){_0x5069e9=_0x3b20b1;return _0x3b20b1;})[_0xd1e0('0x8')](handleEntityNotFound(_0x4b177c,null))[_0xd1e0('0x8')](removeEntity(_0x4b177c,null))[_0xd1e0('0x8')](function(){if(_0x5069e9){return db[_0xd1e0('0x23')]['findAll']({'where':{'type':_0x5069e9[_0xd1e0('0x26')]},'raw':!![]});}})['then'](function(_0x105269){if(_0x5069e9[_0xd1e0('0x26')][_0xd1e0('0x41')]()==_0xd1e0('0x42')){var _0x238e6d=fs[_0xd1e0('0x43')](path[_0xd1e0('0x44')](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x57a7c3=ejs[_0xd1e0('0x4b')](_0x238e6d,{'networks':_0x105269||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x57a7c3);return respondWithRpcPromise(_0xd1e0('0x49'),_0xd1e0('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x5069e9[_0xd1e0('0x26')][_0xd1e0('0x41')]()==_0xd1e0('0x54')){var _0x490e15=fs[_0xd1e0('0x43')](path[_0xd1e0('0x44')](config[_0xd1e0('0x45')],_0xd1e0('0x4a')),_0xd1e0('0x46'));var _0x401e4e=ejs['render'](_0x490e15,{'networks':_0x105269||[]});fs['writeFileSync'](_0xd1e0('0x4c'),_0x401e4e);return respondWithRpcPromise(_0xd1e0('0x49'),'destroy',{'module':_0xd1e0('0x4d')});}else{var _0x511447=fs[_0xd1e0('0x43')](path[_0xd1e0('0x44')](config[_0xd1e0('0x45')],_0xd1e0('0x4e')),_0xd1e0('0x46'));var _0x824539=ejs[_0xd1e0('0x4b')](_0x511447,{'networks':_0x105269||[]});fs[_0xd1e0('0x47')](util[_0xd1e0('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x5069e9[_0xd1e0('0x26')][_0xd1e0('0x50')]()),_0x824539);return respondWithRpcPromise(_0xd1e0('0x49'),_0xd1e0('0x1b'),{'module':_0xd1e0('0x51')});}})['catch'](handleError(_0x4b177c,null));}; \ No newline at end of file +var _0x78a1=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','status','json','offset','undefined','limit','count','Content-Range','destroy','then','end','stack','name','send','index','Network','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','map','VIRTUAL','includeAll','include','catch','show','params','keys','options','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','res_stun_monitor.so','TURN','readFileSync','/etc/asterisk/turn_xcally.conf','Reload','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','findAll','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','util','path','ejs','lodash'];(function(_0x5763a1,_0x4df510){var _0x3350f7=function(_0x228ea9){while(--_0x228ea9){_0x5763a1['push'](_0x5763a1['shift']());}};_0x3350f7(++_0x4df510);}(_0x78a1,0x154));var _0x178a=function(_0x9867ad,_0x1b118f){_0x9867ad=_0x9867ad-0x0;var _0x13e7b0=_0x78a1[_0x9867ad];return _0x13e7b0;};'use strict';var util=require(_0x178a('0x0'));var path=require(_0x178a('0x1'));var ejs=require(_0x178a('0x2'));var fs=require('fs');var _=require(_0x178a('0x3'));var qs=require(_0x178a('0x4'));var logger=require(_0x178a('0x5'))(_0x178a('0x6'));var config=require('../../config/environment');var db=require(_0x178a('0x7'))['db'];var jayson=require(_0x178a('0x8'));var client=jayson[_0x178a('0x9')][_0x178a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19bc37,_0xeeb092,_0x518b99,_0x1bf9a6){return new Promise(function(_0x58a17f,_0x20c104){var _0x1a2fba=_0x1bf9a6||client;return _0x1a2fba[_0x178a('0xb')](_0x19bc37,_0x518b99)['then'](function(_0x256393){logger['info'](_0x178a('0xc'),_0xeeb092,_0x178a('0xd'));logger[_0x178a('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0xeeb092,_0x178a('0xd'),JSON[_0x178a('0xf')](_0x256393));if(_0x256393['error']){if(_0x256393[_0x178a('0x10')][_0x178a('0x11')]===0x1f4){logger[_0x178a('0x10')]('Network,\x20%s,\x20%s',_0xeeb092,_0x256393[_0x178a('0x10')][_0x178a('0x12')]);return _0x20c104(_0x256393[_0x178a('0x10')][_0x178a('0x12')]);}logger[_0x178a('0x10')](_0x178a('0xc'),_0xeeb092,_0x256393[_0x178a('0x10')][_0x178a('0x12')]);return _0x58a17f(_0x256393[_0x178a('0x10')][_0x178a('0x12')]);}else{logger[_0x178a('0x13')]('Network,\x20%s,\x20%s',_0xeeb092,'request\x20sent');_0x58a17f(_0x256393['result'][_0x178a('0x12')]);}})['catch'](function(_0x5f3a3f){logger['error'](_0x178a('0xc'),_0xeeb092,_0x5f3a3f);_0x20c104(_0x5f3a3f);});});}function respondWithResult(_0x2e790f,_0x1212a5){_0x1212a5=_0x1212a5||0xc8;return function(_0x389571){if(_0x389571){return _0x2e790f[_0x178a('0x14')](_0x1212a5)[_0x178a('0x15')](_0x389571);}};}function respondWithFilteredResult(_0x3bf9a1,_0x1bbf03){return function(_0x51ca94){if(_0x51ca94){var _0x297414=typeof _0x1bbf03[_0x178a('0x16')]===_0x178a('0x17')&&typeof _0x1bbf03[_0x178a('0x18')]==='undefined';var _0x218d9d=_0x51ca94[_0x178a('0x19')];var _0x57b894=_0x297414?0x0:_0x1bbf03[_0x178a('0x16')];var _0x543665=_0x297414?_0x51ca94[_0x178a('0x19')]:_0x1bbf03[_0x178a('0x16')]+_0x1bbf03[_0x178a('0x18')];var _0x97e93a;if(_0x543665>=_0x218d9d){_0x543665=_0x218d9d;_0x97e93a=0xc8;}else{_0x97e93a=0xce;}_0x3bf9a1[_0x178a('0x14')](_0x97e93a);return _0x3bf9a1['set'](_0x178a('0x1a'),_0x57b894+'-'+_0x543665+'/'+_0x218d9d)[_0x178a('0x15')](_0x51ca94);}return null;};}function saveUpdates(_0x12c0e6){return function(_0x2be976){if(_0x2be976){return _0x2be976['update'](_0x12c0e6)['then'](function(_0x13e959){return _0x13e959;});}return null;};}function removeEntity(_0x2fb609){return function(_0x51c3be){if(_0x51c3be){return _0x51c3be[_0x178a('0x1b')]()[_0x178a('0x1c')](function(){_0x2fb609[_0x178a('0x14')](0xcc)[_0x178a('0x1d')]();});}};}function handleEntityNotFound(_0x24cbe4){return function(_0x1aae69){if(!_0x1aae69){_0x24cbe4['sendStatus'](0x194);}return _0x1aae69;};}function handleError(_0x3b02eb,_0x302c7a){_0x302c7a=_0x302c7a||0x1f4;return function(_0x2b745b){logger[_0x178a('0x10')](_0x2b745b[_0x178a('0x1e')]);if(_0x2b745b[_0x178a('0x1f')]){delete _0x2b745b[_0x178a('0x1f')];}_0x3b02eb[_0x178a('0x14')](_0x302c7a)[_0x178a('0x20')](_0x2b745b);};}exports[_0x178a('0x21')]=function(_0x28942a,_0x474bbb){var _0x4c0525={},_0x45bdf7={},_0x35343c={'count':0x0,'rows':[]};var _0x52c8d2=_['map'](db[_0x178a('0x22')][_0x178a('0x23')],function(_0x5bcdce){return{'name':_0x5bcdce['fieldName'],'type':_0x5bcdce[_0x178a('0x24')][_0x178a('0x25')]};});_0x45bdf7[_0x178a('0x26')]=_['map'](_0x52c8d2,'name');_0x45bdf7[_0x178a('0x27')]=_['keys'](_0x28942a[_0x178a('0x27')]);_0x45bdf7['filters']=_[_0x178a('0x28')](_0x45bdf7[_0x178a('0x26')],_0x45bdf7[_0x178a('0x27')]);_0x4c0525['attributes']=_[_0x178a('0x28')](_0x45bdf7[_0x178a('0x26')],qs[_0x178a('0x29')](_0x28942a[_0x178a('0x27')][_0x178a('0x29')]));_0x4c0525[_0x178a('0x2a')]=_0x4c0525['attributes'][_0x178a('0x2b')]?_0x4c0525['attributes']:_0x45bdf7[_0x178a('0x26')];if(!_0x28942a[_0x178a('0x27')][_0x178a('0x2c')](_0x178a('0x2d'))){_0x4c0525[_0x178a('0x18')]=qs['limit'](_0x28942a['query'][_0x178a('0x18')]);_0x4c0525[_0x178a('0x16')]=qs['offset'](_0x28942a['query'][_0x178a('0x16')]);}_0x4c0525[_0x178a('0x2e')]=qs[_0x178a('0x2f')](_0x28942a['query'][_0x178a('0x2f')]);_0x4c0525['where']=qs[_0x178a('0x30')](_['pick'](_0x28942a[_0x178a('0x27')],_0x45bdf7['filters']),_0x52c8d2);if(_0x28942a[_0x178a('0x27')][_0x178a('0x31')]){_0x4c0525[_0x178a('0x32')]=_[_0x178a('0x33')](_0x4c0525[_0x178a('0x32')],{'$or':_[_0x178a('0x34')](_0x52c8d2,function(_0x1ac52f){if(_0x1ac52f[_0x178a('0x24')]!==_0x178a('0x35')){var _0x38a1be={};_0x38a1be[_0x1ac52f[_0x178a('0x1f')]]={'$like':'%'+_0x28942a[_0x178a('0x27')][_0x178a('0x31')]+'%'};return _0x38a1be;}})});}_0x4c0525=_['merge']({},_0x4c0525,_0x28942a['options']);var _0x1d9db8={'where':_0x4c0525[_0x178a('0x32')]};return db['Network']['count'](_0x1d9db8)['then'](function(_0x283153){_0x35343c['count']=_0x283153;if(_0x28942a[_0x178a('0x27')][_0x178a('0x36')]){_0x4c0525[_0x178a('0x37')]=[{'all':!![]}];}return db[_0x178a('0x22')]['findAll'](_0x4c0525);})[_0x178a('0x1c')](function(_0x5d79c9){_0x35343c['rows']=_0x5d79c9;return _0x35343c;})[_0x178a('0x1c')](respondWithFilteredResult(_0x474bbb,_0x4c0525))[_0x178a('0x38')](handleError(_0x474bbb,null));};exports[_0x178a('0x39')]=function(_0x142787,_0x422a7a){var _0x493e95={'raw':!![],'where':{'id':_0x142787[_0x178a('0x3a')]['id']}},_0x3efd9e={};_0x3efd9e[_0x178a('0x26')]=_[_0x178a('0x3b')](db[_0x178a('0x22')][_0x178a('0x23')]);_0x3efd9e[_0x178a('0x27')]=_[_0x178a('0x3b')](_0x142787[_0x178a('0x27')]);_0x3efd9e[_0x178a('0x30')]=_[_0x178a('0x28')](_0x3efd9e[_0x178a('0x26')],_0x3efd9e['query']);_0x493e95[_0x178a('0x2a')]=_[_0x178a('0x28')](_0x3efd9e[_0x178a('0x26')],qs['fields'](_0x142787[_0x178a('0x27')][_0x178a('0x29')]));_0x493e95[_0x178a('0x2a')]=_0x493e95['attributes'][_0x178a('0x2b')]?_0x493e95[_0x178a('0x2a')]:_0x3efd9e[_0x178a('0x26')];if(_0x142787[_0x178a('0x27')][_0x178a('0x36')]){_0x493e95[_0x178a('0x37')]=[{'all':!![]}];}_0x493e95=_['merge']({},_0x493e95,_0x142787[_0x178a('0x3c')]);return db[_0x178a('0x22')][_0x178a('0x3d')](_0x493e95)['then'](handleEntityNotFound(_0x422a7a,null))['then'](respondWithResult(_0x422a7a,null))['catch'](handleError(_0x422a7a,null));};exports[_0x178a('0x3e')]=function(_0x213360,_0x405a34){var _0x241963;return db[_0x178a('0x22')][_0x178a('0x3e')](_0x213360['body'],{'raw':!![]})['then'](function(_0x536626){_0x241963=_0x536626;return db[_0x178a('0x22')]['findAll']({'where':{'type':_0x213360[_0x178a('0x3f')][_0x178a('0x24')]},'raw':!![]});})[_0x178a('0x1c')](function(_0x520e83){if(_0x241963[_0x178a('0x24')][_0x178a('0x40')]()==_0x178a('0x41')){var _0xb300fa=fs['readFileSync'](path[_0x178a('0x42')](config[_0x178a('0x43')],_0x178a('0x44')),_0x178a('0x45'));var _0x40e9b9=ejs[_0x178a('0x46')](_0xb300fa,{'networks':_0x520e83||[]});fs[_0x178a('0x47')]('/etc/asterisk/stun_xcally.conf',_0x40e9b9);return respondWithRpcPromise('Reload',_0x178a('0x3e'),{'module':_0x178a('0x48')});}else if(_0x241963[_0x178a('0x24')]['toUpperCase']()==_0x178a('0x49')){var _0x4e7310=fs[_0x178a('0x4a')](path['join'](config[_0x178a('0x43')],'server/files/templates/turn_multiple.ejs'),_0x178a('0x45'));var _0xc853d4=ejs[_0x178a('0x46')](_0x4e7310,{'networks':_0x520e83||[]});fs['writeFileSync'](_0x178a('0x4b'),_0xc853d4);return respondWithRpcPromise(_0x178a('0x4c'),'create',{'module':_0x178a('0x48')});}else{var _0x93ccac=fs[_0x178a('0x4a')](path[_0x178a('0x42')](config[_0x178a('0x43')],'server/files/templates/network.ejs'),_0x178a('0x45'));var _0x3c39a4=ejs[_0x178a('0x46')](_0x93ccac,{'networks':_0x520e83||[]});fs[_0x178a('0x47')](util['format'](_0x178a('0x4d'),_0x213360[_0x178a('0x3f')][_0x178a('0x24')][_0x178a('0x4e')]()),_0x3c39a4);return respondWithRpcPromise('Reload','create',{'module':_0x178a('0x4f')});}})[_0x178a('0x1c')](function(){return _0x241963;})[_0x178a('0x1c')](respondWithResult(_0x405a34,0xc9))['catch'](handleError(_0x405a34,null));};exports[_0x178a('0x50')]=function(_0x487877,_0x4dda65){var _0x829857;return db[_0x178a('0x22')][_0x178a('0x3d')]({'where':{'id':_0x487877['params']['id']}})[_0x178a('0x1c')](handleEntityNotFound(_0x4dda65,null))[_0x178a('0x1c')](saveUpdates(_0x487877[_0x178a('0x3f')],null))[_0x178a('0x1c')](function(_0xe2d16b){if(_0xe2d16b){_0x829857=_0xe2d16b;return db[_0x178a('0x22')][_0x178a('0x51')]({'where':{'type':_0x829857['type']},'raw':!![]});}return null;})['then'](function(_0x40e0c9){if(_0x829857[_0x178a('0x24')][_0x178a('0x40')]()==_0x178a('0x41')){var _0x17be64=fs['readFileSync'](path['join'](config[_0x178a('0x43')],'server/files/templates/stun_multiple.ejs'),_0x178a('0x45'));var _0x2e7746=ejs[_0x178a('0x46')](_0x17be64,{'networks':_0x40e0c9||[]});fs[_0x178a('0x47')](_0x178a('0x52'),_0x2e7746);return respondWithRpcPromise(_0x178a('0x4c'),_0x178a('0x50'),{'module':_0x178a('0x48')});}else if(_0x829857[_0x178a('0x24')][_0x178a('0x40')]()=='TURN'){var _0x2e5243=fs[_0x178a('0x4a')](path[_0x178a('0x42')](config[_0x178a('0x43')],_0x178a('0x53')),_0x178a('0x45'));var _0x5f1e87=ejs[_0x178a('0x46')](_0x2e5243,{'networks':_0x40e0c9||[]});fs[_0x178a('0x47')](_0x178a('0x4b'),_0x5f1e87);return respondWithRpcPromise(_0x178a('0x4c'),_0x178a('0x50'),{'module':_0x178a('0x48')});}else{var _0x3e16f8=fs[_0x178a('0x4a')](path['join'](config['root'],_0x178a('0x54')),_0x178a('0x45'));var _0x5951e5=ejs[_0x178a('0x46')](_0x3e16f8,{'networks':_0x40e0c9||[]});fs[_0x178a('0x47')](util[_0x178a('0x55')](_0x178a('0x4d'),_0x487877[_0x178a('0x3f')][_0x178a('0x24')]['toLowerCase']()),_0x5951e5);return respondWithRpcPromise(_0x178a('0x4c'),_0x178a('0x50'),{'module':_0x178a('0x4f')});}})[_0x178a('0x1c')](function(_0x483eb5){if(_0x483eb5){return _0x829857;}return null;})['then'](respondWithResult(_0x4dda65,null))['catch'](handleError(_0x4dda65,null));};exports[_0x178a('0x1b')]=function(_0x1ead51,_0x493f72){var _0x1aa129;return db[_0x178a('0x22')][_0x178a('0x3d')]({'where':{'id':_0x1ead51['params']['id']}})['then'](function(_0x3cad4d){_0x1aa129=_0x3cad4d;return _0x3cad4d;})[_0x178a('0x1c')](handleEntityNotFound(_0x493f72,null))[_0x178a('0x1c')](removeEntity(_0x493f72,null))['then'](function(){if(_0x1aa129){return db['Network'][_0x178a('0x51')]({'where':{'type':_0x1aa129[_0x178a('0x24')]},'raw':!![]});}})[_0x178a('0x1c')](function(_0xb0cf28){if(_0x1aa129[_0x178a('0x24')][_0x178a('0x40')]()==_0x178a('0x41')){var _0x3b07e9=fs[_0x178a('0x4a')](path[_0x178a('0x42')](config[_0x178a('0x43')],_0x178a('0x44')),_0x178a('0x45'));var _0x515b9c=ejs[_0x178a('0x46')](_0x3b07e9,{'networks':_0xb0cf28||[]});fs[_0x178a('0x47')](_0x178a('0x52'),_0x515b9c);return respondWithRpcPromise(_0x178a('0x4c'),_0x178a('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x1aa129['type'][_0x178a('0x40')]()==_0x178a('0x49')){var _0x7916d1=fs[_0x178a('0x4a')](path[_0x178a('0x42')](config[_0x178a('0x43')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3d2350=ejs[_0x178a('0x46')](_0x7916d1,{'networks':_0xb0cf28||[]});fs[_0x178a('0x47')]('/etc/asterisk/turn_xcally.conf',_0x3d2350);return respondWithRpcPromise(_0x178a('0x4c'),'destroy',{'module':_0x178a('0x48')});}else{var _0x3b95c3=fs[_0x178a('0x4a')](path[_0x178a('0x42')](config[_0x178a('0x43')],'server/files/templates/network.ejs'),_0x178a('0x45'));var _0x340feb=ejs['render'](_0x3b95c3,{'networks':_0xb0cf28||[]});fs[_0x178a('0x47')](util[_0x178a('0x55')](_0x178a('0x4d'),_0x1aa129[_0x178a('0x24')][_0x178a('0x4e')]()),_0x340feb);return respondWithRpcPromise('Reload','destroy',{'module':_0x178a('0x4f')});}})['catch'](handleError(_0x493f72,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 3ef8709..6a107d1 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 _0x9c5e=['moment','rimraf','../../config/environment','exports','define','network','lodash','util','../../config/logger','api'];(function(_0x555788,_0x207c93){var _0x2ec89b=function(_0x376709){while(--_0x376709){_0x555788['push'](_0x555788['shift']());}};_0x2ec89b(++_0x207c93);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x55dcfb,_0x50f23e){_0x55dcfb=_0x55dcfb-0x0;var _0x44bb21=_0x9c5e[_0x55dcfb];return _0x44bb21;};'use strict';var _=require(_0xe9c5('0x0'));var util=require(_0xe9c5('0x1'));var logger=require(_0xe9c5('0x2'))(_0xe9c5('0x3'));var moment=require(_0xe9c5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe9c5('0x5'));var config=require(_0xe9c5('0x6'));var attributes=require('./network.attributes');module[_0xe9c5('0x7')]=function(_0x5c11e5,_0x1e6a31){return _0x5c11e5[_0xe9c5('0x8')]('Network',attributes,{'tableName':_0xe9c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3667=['network','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./network.attributes','exports','Network'];(function(_0x5aa3bb,_0x4b4427){var _0x472097=function(_0x13b41c){while(--_0x13b41c){_0x5aa3bb['push'](_0x5aa3bb['shift']());}};_0x472097(++_0x4b4427);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var moment=require(_0x7366('0x4'));var BPromise=require('bluebird');var rp=require(_0x7366('0x5'));var fs=require('fs');var path=require(_0x7366('0x6'));var rimraf=require('rimraf');var config=require(_0x7366('0x7'));var attributes=require(_0x7366('0x8'));module[_0x7366('0x9')]=function(_0x1c0cf4,_0x101e3d){return _0x1c0cf4['define'](_0x7366('0xa'),attributes,{'tableName':_0x7366('0xb'),'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 3df7910..465fdec 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x1ad18b,_0x241b19){_0x1ad18b=_0x1ad18b-0x0;var _0x3dad12=_0x7a54[_0x1ad18b];return _0x3dad12;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x154ea1,_0x631904){_0x154ea1=_0x154ea1-0x0;var _0x5bcd2d=_0x7a54[_0x154ea1];return _0x5bcd2d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 3f5dc2f..853f154 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 _0x9582=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','create','post','/:id/notify','notify','/:id/users','update','delete','destroy','removeDispositions','removeAnswers','removeAgents'];(function(_0x43b596,_0x59af26){var _0x71232d=function(_0x3fe56c){while(--_0x3fe56c){_0x43b596['push'](_0x43b596['shift']());}};_0x71232d(++_0x59af26);}(_0x9582,0x95));var _0x2958=function(_0x1918d2,_0x1b4040){_0x1918d2=_0x1918d2-0x0;var _0x1261e7=_0x9582[_0x1918d2];return _0x1261e7;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2958('0x6'));var interaction=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var controller=require(_0x2958('0x9'));router[_0x2958('0xa')]('/',auth[_0x2958('0xb')](),controller[_0x2958('0xc')]);router[_0x2958('0xa')](_0x2958('0xd'),auth[_0x2958('0xb')](),controller['describe']);router['get'](_0x2958('0xe'),auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['get'](_0x2958('0x10'),auth['isAuthenticated'](),controller[_0x2958('0x11')]);router[_0x2958('0xa')](_0x2958('0x12'),auth[_0x2958('0xb')](),controller[_0x2958('0x13')]);router['get'](_0x2958('0x14'),auth[_0x2958('0xb')](),controller[_0x2958('0x15')]);router[_0x2958('0xa')](_0x2958('0x16'),auth[_0x2958('0xb')](),controller[_0x2958('0x17')]);router[_0x2958('0xa')]('/:id/users',auth[_0x2958('0xb')](),controller[_0x2958('0x18')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2958('0x19')]);router[_0x2958('0x1a')]('/:id/dispositions',auth[_0x2958('0xb')](),controller['addDisposition']);router['post'](_0x2958('0x12'),auth[_0x2958('0xb')](),controller['addAnswer']);router['post'](_0x2958('0x1b'),controller[_0x2958('0x1c')]);router[_0x2958('0x1a')](_0x2958('0x14'),auth[_0x2958('0xb')](),controller['addApplications']);router[_0x2958('0x1a')](_0x2958('0x1d'),auth[_0x2958('0xb')](),controller['addAgents']);router[_0x2958('0x1a')]('/:id/send',auth[_0x2958('0xb')](),controller['send']);router['put'](_0x2958('0xe'),auth[_0x2958('0xb')](),controller[_0x2958('0x1e')]);router[_0x2958('0x1f')](_0x2958('0xe'),auth[_0x2958('0xb')](),controller[_0x2958('0x20')]);router[_0x2958('0x1f')](_0x2958('0x10'),auth[_0x2958('0xb')](),controller[_0x2958('0x21')]);router[_0x2958('0x1f')](_0x2958('0x12'),auth[_0x2958('0xb')](),controller[_0x2958('0x22')]);router['delete']('/:id/users',auth[_0x2958('0xb')](),controller[_0x2958('0x23')]);module[_0x2958('0x24')]=router; \ No newline at end of file +var _0x5b12=['show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','/:id/notify','notify','addAgents','/:id/send','send','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id'];(function(_0x5f0450,_0x422a6c){var _0x421656=function(_0x46876f){while(--_0x46876f){_0x5f0450['push'](_0x5f0450['shift']());}};_0x421656(++_0x422a6c);}(_0x5b12,0xa3));var _0x25b1=function(_0x57e795,_0x5e2ef1){_0x57e795=_0x57e795-0x0;var _0x17ffab=_0x5b12[_0x57e795];return _0x17ffab;};'use strict';var multer=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var path=require(_0x25b1('0x2'));var timeout=require('connect-timeout');var express=require(_0x25b1('0x3'));var router=express['Router']();var fs_extra=require(_0x25b1('0x4'));var auth=require(_0x25b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x25b1('0x6'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x25b1('0x7')](),controller['index']);router['get'](_0x25b1('0x8'),auth[_0x25b1('0x7')](),controller[_0x25b1('0x9')]);router[_0x25b1('0xa')](_0x25b1('0xb'),auth[_0x25b1('0x7')](),controller[_0x25b1('0xc')]);router[_0x25b1('0xa')]('/:id/dispositions',auth[_0x25b1('0x7')](),controller[_0x25b1('0xd')]);router[_0x25b1('0xa')](_0x25b1('0xe'),auth[_0x25b1('0x7')](),controller[_0x25b1('0xf')]);router[_0x25b1('0xa')](_0x25b1('0x10'),auth[_0x25b1('0x7')](),controller[_0x25b1('0x11')]);router[_0x25b1('0xa')](_0x25b1('0x12'),auth[_0x25b1('0x7')](),controller[_0x25b1('0x13')]);router[_0x25b1('0xa')](_0x25b1('0x14'),auth['isAuthenticated'](),controller[_0x25b1('0x15')]);router[_0x25b1('0x16')]('/',auth['isAuthenticated'](),controller[_0x25b1('0x17')]);router[_0x25b1('0x16')](_0x25b1('0x18'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x25b1('0x16')]('/:id/canned_answers',auth[_0x25b1('0x7')](),controller[_0x25b1('0x19')]);router[_0x25b1('0x16')](_0x25b1('0x1a'),controller[_0x25b1('0x1b')]);router[_0x25b1('0x16')](_0x25b1('0x10'),auth[_0x25b1('0x7')](),controller['addApplications']);router['post'](_0x25b1('0x14'),auth['isAuthenticated'](),controller[_0x25b1('0x1c')]);router['post'](_0x25b1('0x1d'),auth['isAuthenticated'](),controller[_0x25b1('0x1e')]);router['put'](_0x25b1('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x25b1('0xb'),auth[_0x25b1('0x7')](),controller['destroy']);router[_0x25b1('0x1f')](_0x25b1('0x18'),auth[_0x25b1('0x7')](),controller[_0x25b1('0x20')]);router[_0x25b1('0x1f')]('/:id/canned_answers',auth[_0x25b1('0x7')](),controller[_0x25b1('0x21')]);router[_0x25b1('0x1f')](_0x25b1('0x14'),auth[_0x25b1('0x7')](),controller[_0x25b1('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 1d80545..faf2365 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 _0x6850=['setDataValue','sequelize','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x333e5f,_0x4c9c9f){var _0x22e5c6=function(_0x1bd25d){while(--_0x1bd25d){_0x333e5f['push'](_0x333e5f['shift']());}};_0x22e5c6(++_0x4c9c9f);}(_0x6850,0xd0));var _0x0685=function(_0x576af4,_0x109e2e){_0x576af4=_0x576af4-0x0;var _0x20b66e=_0x6850[_0x576af4];return _0x20b66e;};'use strict';var Sequelize=require(_0x0685('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x0685('0x1')],'unique':_0x0685('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0685('0x1')],'defaultValue':function(){return rs[_0x0685('0x3')]();}},'replyUri':{'type':Sequelize[_0x0685('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x0685('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0685('0x4');}},'notificationSound':{'type':Sequelize[_0x0685('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0685('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0685('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0685('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x0685('0x1')]},'queueTransfer':{'type':Sequelize[_0x0685('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0685('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0685('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0685('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0685('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x0685('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x0685('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1a3ff7){if(!_0x1a3ff7)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x0685('0x8')]('mandatoryDisposition',_0x1a3ff7);}}}; \ No newline at end of file +var _0xe826=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x1c667f,_0x337154){var _0x4217c4=function(_0x484654){while(--_0x484654){_0x1c667f['push'](_0x1c667f['shift']());}};_0x4217c4(++_0x337154);}(_0xe826,0x163));var _0x6e82=function(_0x43c5f1,_0x24aded){_0x43c5f1=_0x43c5f1-0x0;var _0x3662ff=_0xe826[_0x43c5f1];return _0x3662ff;};'use strict';var Sequelize=require(_0x6e82('0x0'));var rs=require(_0x6e82('0x1'));module[_0x6e82('0x2')]={'name':{'type':Sequelize[_0x6e82('0x3')],'unique':_0x6e82('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6e82('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6e82('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6e82('0x6');}},'notificationSound':{'type':Sequelize[_0x6e82('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6e82('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6e82('0x3')]},'queueTransfer':{'type':Sequelize[_0x6e82('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e82('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e82('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e82('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e82('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x6e82('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6e82('0xa'),'set':function(_0x269f10){if(!_0x269f10)this[_0x6e82('0xb')](_0x6e82('0xc'),null);this[_0x6e82('0xb')](_0x6e82('0xd'),_0x269f10);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 5f32139..33b59a1 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 _0xbd10=['rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','count','includeAll','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','order','OpenchannelAccountId','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','Sequelize','ValidationError','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','from','CmList','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','orderBy','asc','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','contact','messageId','created','interaction','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','json','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','offset','limit','undefined','set','Content-Range','reject','then','destroy','get','OpenchannelAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','map','OpenchannelAccount'];(function(_0x2e9e70,_0x4b55ed){var _0x585b9d=function(_0x10f0ea){while(--_0x10f0ea){_0x2e9e70['push'](_0x2e9e70['shift']());}};_0x585b9d(++_0x4b55ed);}(_0xbd10,0x85));var _0x0bd1=function(_0x52f873,_0x12eb10){_0x52f873=_0x52f873-0x0;var _0x76f7e3=_0xbd10[_0x52f873];return _0x76f7e3;};'use strict';var emlformat=require(_0x0bd1('0x0'));var rimraf=require(_0x0bd1('0x1'));var zipdir=require(_0x0bd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd1('0x3'));var moment=require(_0x0bd1('0x4'));var BPromise=require(_0x0bd1('0x5'));var Mustache=require('mustache');var util=require(_0x0bd1('0x6'));var path=require(_0x0bd1('0x7'));var sox=require(_0x0bd1('0x8'));var csv=require(_0x0bd1('0x9'));var ejs=require(_0x0bd1('0xa'));var fs=require('fs');var fs_extra=require(_0x0bd1('0xb'));var _=require('lodash');var squel=require(_0x0bd1('0xc'));var crypto=require('crypto');var jsforce=require(_0x0bd1('0xd'));var deskjs=require(_0x0bd1('0xe'));var toCsv=require(_0x0bd1('0x9'));var querystring=require(_0x0bd1('0xf'));var Papa=require('papaparse');var Redis=require(_0x0bd1('0x10'));var authService=require(_0x0bd1('0x11'));var qs=require(_0x0bd1('0x12'));var as=require(_0x0bd1('0x13'));var hardwareService=require(_0x0bd1('0x14'));var logger=require(_0x0bd1('0x15'))('api');var utils=require(_0x0bd1('0x16'));var config=require(_0x0bd1('0x17'));var licenseUtil=require(_0x0bd1('0x18'));var db=require(_0x0bd1('0x19'))['db'];config[_0x0bd1('0x1a')]=_[_0x0bd1('0x1b')](config['redis'],{'host':_0x0bd1('0x1c'),'port':0x18eb});var socket=require(_0x0bd1('0x1d'))(new Redis(config[_0x0bd1('0x1a')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x0bd1('0x1e'));var client=jayson[_0x0bd1('0x1f')][_0x0bd1('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x180809,_0x88e088,_0xc96c4d,_0x5ab359){return new BPromise(function(_0x1876fb,_0x2718cd){var _0x2f2969=_0x5ab359||client;return _0x2f2969[_0x0bd1('0x21')](_0x180809,_0xc96c4d)['then'](function(_0x11479e){logger[_0x0bd1('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x88e088,_0x0bd1('0x23'));logger[_0x0bd1('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x88e088,'request\x20sent',JSON[_0x0bd1('0x25')](_0x11479e));if(_0x11479e[_0x0bd1('0x26')]){if(_0x11479e[_0x0bd1('0x26')][_0x0bd1('0x27')]===0x1f4){logger[_0x0bd1('0x26')](_0x0bd1('0x28'),_0x88e088,_0x11479e[_0x0bd1('0x26')][_0x0bd1('0x29')]);return _0x2718cd(_0x11479e['error'][_0x0bd1('0x29')]);}logger[_0x0bd1('0x26')](_0x0bd1('0x28'),_0x88e088,_0x11479e[_0x0bd1('0x26')][_0x0bd1('0x29')]);return _0x1876fb(_0x11479e['error'][_0x0bd1('0x29')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x88e088,_0x0bd1('0x23'));_0x1876fb(_0x11479e[_0x0bd1('0x2a')][_0x0bd1('0x29')]);}})[_0x0bd1('0x2b')](function(_0x237f4a){logger[_0x0bd1('0x26')](_0x0bd1('0x28'),_0x88e088,_0x237f4a);_0x2718cd(_0x237f4a);});});}function respondWithStatusCode(_0x36273c,_0x2cacfc){_0x2cacfc=_0x2cacfc||0xcc;return function(_0x58a565){if(_0x58a565){return _0x36273c['sendStatus'](_0x2cacfc);}return _0x36273c[_0x0bd1('0x2c')](_0x2cacfc)['end']();};}function respondWithResult(_0xe92935,_0x44ca37){_0x44ca37=_0x44ca37||0xc8;return function(_0x53bcdc){if(_0x53bcdc){return _0xe92935['status'](_0x44ca37)['json'](_0x53bcdc);}};}function respondWithFilteredResult(_0x4b64cb,_0x551fcd){return function(_0x4616b9){if(_0x4616b9){var _0x2ac8bb=typeof _0x551fcd[_0x0bd1('0x2d')]==='undefined'&&typeof _0x551fcd[_0x0bd1('0x2e')]===_0x0bd1('0x2f');var _0x5f0f47=_0x4616b9['count'];var _0x32d913=_0x2ac8bb?0x0:_0x551fcd['offset'];var _0x5366c4=_0x2ac8bb?_0x4616b9['count']:_0x551fcd[_0x0bd1('0x2d')]+_0x551fcd[_0x0bd1('0x2e')];var _0x12e9bb;if(_0x5366c4>=_0x5f0f47){_0x5366c4=_0x5f0f47;_0x12e9bb=0xc8;}else{_0x12e9bb=0xce;}_0x4b64cb['status'](_0x12e9bb);return _0x4b64cb[_0x0bd1('0x30')](_0x0bd1('0x31'),_0x32d913+'-'+_0x5366c4+'/'+_0x5f0f47)['json'](_0x4616b9);}return null;};}function patchUpdates(_0x5c204f){return function(_0x28877b){try{jsonpatch['apply'](_0x28877b,_0x5c204f,!![]);}catch(_0xf382fa){return BPromise[_0x0bd1('0x32')](_0xf382fa);}return _0x28877b['save']();};}function saveUpdates(_0x203f35,_0x41b63f){return function(_0x7248e6){if(_0x7248e6){return _0x7248e6['update'](_0x203f35)[_0x0bd1('0x33')](function(_0x4e79f4){return _0x4e79f4;});}return null;};}function removeEntity(_0x4628ba,_0x2cc999){return function(_0x175f59){if(_0x175f59){return _0x175f59[_0x0bd1('0x34')]()['then'](function(){var _0x3fb0c6=_0x175f59[_0x0bd1('0x35')]({'plain':!![]});var _0x255533=_0x0bd1('0x36');return db[_0x0bd1('0x37')][_0x0bd1('0x34')]({'where':{'type':_0x255533,'resourceId':_0x3fb0c6['id']}})[_0x0bd1('0x33')](function(){return _0x175f59;});})['then'](function(){_0x4628ba[_0x0bd1('0x2c')](0xcc)[_0x0bd1('0x38')]();});}};}function handleEntityNotFound(_0x488310,_0x224159){return function(_0x3a6157){if(!_0x3a6157){_0x488310[_0x0bd1('0x39')](0x194);}return _0x3a6157;};}function handleError(_0x49f2bb,_0x1008e3){_0x1008e3=_0x1008e3||0x1f4;return function(_0x2d1177){logger[_0x0bd1('0x26')](_0x2d1177[_0x0bd1('0x3a')]);if(_0x2d1177[_0x0bd1('0x3b')]){delete _0x2d1177[_0x0bd1('0x3b')];}_0x49f2bb[_0x0bd1('0x2c')](_0x1008e3)[_0x0bd1('0x3c')](_0x2d1177);};}exports[_0x0bd1('0x3d')]=function(_0x217c77,_0x28b835){var _0x3fc2b8={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3d858e={},_0x36544f={'count':0x0,'rows':[]};var _0x2fe9da=_[_0x0bd1('0x3e')](db[_0x0bd1('0x3f')][_0x0bd1('0x40')],function(_0x316c37){return{'name':_0x316c37[_0x0bd1('0x41')],'type':_0x316c37['type']['key']};});_0x3d858e[_0x0bd1('0x42')]=_[_0x0bd1('0x3e')](_0x2fe9da,_0x0bd1('0x3b'));_0x3d858e[_0x0bd1('0x43')]=_['keys'](_0x217c77[_0x0bd1('0x43')]);_0x3d858e['filters']=_[_0x0bd1('0x44')](_0x3d858e['model'],_0x3d858e[_0x0bd1('0x43')]);_0x3fc2b8[_0x0bd1('0x45')]=_[_0x0bd1('0x44')](_0x3d858e[_0x0bd1('0x42')],qs['fields'](_0x217c77[_0x0bd1('0x43')][_0x0bd1('0x46')]));_0x3fc2b8[_0x0bd1('0x45')]=_0x3fc2b8['attributes'][_0x0bd1('0x47')]?_0x3fc2b8[_0x0bd1('0x45')]:_0x3d858e[_0x0bd1('0x42')];if(!_0x217c77[_0x0bd1('0x43')][_0x0bd1('0x48')](_0x0bd1('0x49'))){_0x3fc2b8[_0x0bd1('0x2e')]=qs[_0x0bd1('0x2e')](_0x217c77[_0x0bd1('0x43')][_0x0bd1('0x2e')]);_0x3fc2b8[_0x0bd1('0x2d')]=qs['offset'](_0x217c77['query'][_0x0bd1('0x2d')]);}_0x3fc2b8['order']=qs[_0x0bd1('0x4a')](_0x217c77['query'][_0x0bd1('0x4a')]);_0x3fc2b8[_0x0bd1('0x4b')]=qs[_0x0bd1('0x4c')](_[_0x0bd1('0x4d')](_0x217c77[_0x0bd1('0x43')],_0x3d858e[_0x0bd1('0x4c')]),_0x2fe9da);if(_0x217c77[_0x0bd1('0x43')][_0x0bd1('0x4e')]){_0x3fc2b8[_0x0bd1('0x4b')]=_[_0x0bd1('0x4f')](_0x3fc2b8['where'],{'$or':_[_0x0bd1('0x3e')](_0x2fe9da,function(_0x1099fc){if(_0x1099fc[_0x0bd1('0x50')]!==_0x0bd1('0x51')){var _0x5eaef6={};_0x5eaef6[_0x1099fc['name']]={'$like':'%'+_0x217c77[_0x0bd1('0x43')][_0x0bd1('0x4e')]+'%'};return _0x5eaef6;}})});}_0x3fc2b8=_[_0x0bd1('0x4f')]({},_0x3fc2b8,_0x217c77['options']);var _0x3cc311={'where':_0x3fc2b8[_0x0bd1('0x4b')]};return db[_0x0bd1('0x3f')][_0x0bd1('0x52')](_0x3cc311)['then'](function(_0x516f4c){_0x36544f[_0x0bd1('0x52')]=_0x516f4c;if(_0x217c77['query'][_0x0bd1('0x53')]){_0x3fc2b8['include']=[{'all':!![]}];}return db[_0x0bd1('0x3f')]['findAll'](_0x3fc2b8);})[_0x0bd1('0x33')](function(_0x43ecb5){_0x36544f['rows']=_0x43ecb5;return _0x36544f;})['then'](respondWithFilteredResult(_0x28b835,_0x3fc2b8))[_0x0bd1('0x2b')](handleError(_0x28b835,null));};exports[_0x0bd1('0x54')]=function(_0x4ab350,_0x4bca08){var _0x17aeb6={'raw':![],'where':{'id':_0x4ab350[_0x0bd1('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x450812={};_0x450812[_0x0bd1('0x42')]=_[_0x0bd1('0x56')](db[_0x0bd1('0x3f')][_0x0bd1('0x40')]);_0x450812['query']=_[_0x0bd1('0x56')](_0x4ab350['query']);_0x450812['filters']=_[_0x0bd1('0x44')](_0x450812['model'],_0x450812[_0x0bd1('0x43')]);_0x17aeb6['attributes']=_['intersection'](_0x450812[_0x0bd1('0x42')],qs[_0x0bd1('0x46')](_0x4ab350[_0x0bd1('0x43')]['fields']));_0x17aeb6[_0x0bd1('0x45')]=_0x17aeb6['attributes'][_0x0bd1('0x47')]?_0x17aeb6['attributes']:_0x450812['model'];if(_0x4ab350[_0x0bd1('0x43')][_0x0bd1('0x53')]){_0x17aeb6['include']=[{'all':!![]}];}_0x17aeb6=_[_0x0bd1('0x4f')]({},_0x17aeb6,_0x4ab350[_0x0bd1('0x57')]);return db['OpenchannelAccount'][_0x0bd1('0x58')](_0x17aeb6)[_0x0bd1('0x33')](handleEntityNotFound(_0x4bca08,null))[_0x0bd1('0x33')](respondWithResult(_0x4bca08,null))[_0x0bd1('0x2b')](handleError(_0x4bca08,null));};exports[_0x0bd1('0x59')]=function(_0x254f5b,_0x32d473){return db[_0x0bd1('0x3f')][_0x0bd1('0x59')](_0x254f5b[_0x0bd1('0x5a')],{})[_0x0bd1('0x33')](function(_0x3fe02b){var _0x366626=_0x254f5b[_0x0bd1('0x5b')][_0x0bd1('0x35')]({'plain':!![]});if(!_0x366626)throw new Error(_0x0bd1('0x5c'));if(_0x366626['role']==='user'){var _0x1d4621=_0x3fe02b[_0x0bd1('0x35')]({'plain':!![]});var _0x361d79=_0x0bd1('0x36');return db[_0x0bd1('0x5d')][_0x0bd1('0x58')]({'where':{'name':_0x361d79,'userProfileId':_0x366626[_0x0bd1('0x5e')]},'raw':!![]})['then'](function(_0x4b806d){if(_0x4b806d&&_0x4b806d[_0x0bd1('0x5f')]===0x0){return db[_0x0bd1('0x37')][_0x0bd1('0x59')]({'name':_0x1d4621[_0x0bd1('0x3b')],'resourceId':_0x1d4621['id'],'type':_0x4b806d['name'],'sectionId':_0x4b806d['id']},{})['then'](function(){return _0x3fe02b;});}else{return _0x3fe02b;}})[_0x0bd1('0x2b')](function(_0x2eb435){logger[_0x0bd1('0x26')](_0x0bd1('0x60'),_0x2eb435);throw _0x2eb435;});}return _0x3fe02b;})[_0x0bd1('0x33')](respondWithResult(_0x32d473,0xc9))[_0x0bd1('0x2b')](handleError(_0x32d473,null));};exports['update']=function(_0xd822e4,_0x4d32b7){if(_0xd822e4[_0x0bd1('0x5a')]['id']){delete _0xd822e4[_0x0bd1('0x5a')]['id'];}return db[_0x0bd1('0x3f')][_0x0bd1('0x58')]({'where':{'id':_0xd822e4[_0x0bd1('0x55')]['id']},'include':[{'model':db[_0x0bd1('0x61')],'as':_0x0bd1('0x62')}]})['then'](handleEntityNotFound(_0x4d32b7,null))[_0x0bd1('0x33')](saveUpdates(_0xd822e4[_0x0bd1('0x5a')],null))[_0x0bd1('0x33')](respondWithResult(_0x4d32b7,null))['catch'](handleError(_0x4d32b7,null));};exports[_0x0bd1('0x34')]=function(_0x33aa3f,_0x47b9e0){return db['OpenchannelAccount'][_0x0bd1('0x58')]({'where':{'id':_0x33aa3f[_0x0bd1('0x55')]['id']}})['then'](handleEntityNotFound(_0x47b9e0,null))[_0x0bd1('0x33')](removeEntity(_0x47b9e0,null))['catch'](handleError(_0x47b9e0,null));};exports[_0x0bd1('0x63')]=function(_0x53f344,_0xa026ca){return db[_0x0bd1('0x3f')][_0x0bd1('0x63')]()[_0x0bd1('0x33')](respondWithResult(_0xa026ca,null))['catch'](handleError(_0xa026ca,null));};exports[_0x0bd1('0x64')]=function(_0x1b708c,_0x386f0f,_0x593070){if(_0x1b708c[_0x0bd1('0x5a')]['id']){delete _0x1b708c[_0x0bd1('0x5a')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x1b708c[_0x0bd1('0x55')]['id']}})[_0x0bd1('0x33')](handleEntityNotFound(_0x386f0f,null))[_0x0bd1('0x33')](function(_0x2fcbd3){if(_0x2fcbd3){_0x1b708c['body']['OpenchannelAccountId']=_0x2fcbd3['id'];return db[_0x0bd1('0x65')][_0x0bd1('0x59')](_0x1b708c['body']);}})[_0x0bd1('0x33')](respondWithResult(_0x386f0f,null))[_0x0bd1('0x2b')](handleError(_0x386f0f,null));};exports[_0x0bd1('0x66')]=function(_0x22aa1a,_0x5c786d,_0x565765){var _0x3c70da={'raw':![],'where':{}};var _0x175907={};var _0x276045={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x22aa1a['params']['id']}})[_0x0bd1('0x33')](handleEntityNotFound(_0x5c786d,null))[_0x0bd1('0x33')](function(_0x2b05cd){if(_0x2b05cd){_0x175907[_0x0bd1('0x42')]=_[_0x0bd1('0x56')](db[_0x0bd1('0x65')][_0x0bd1('0x40')]);_0x175907[_0x0bd1('0x43')]=_[_0x0bd1('0x56')](_0x22aa1a[_0x0bd1('0x43')]);_0x175907[_0x0bd1('0x4c')]=_[_0x0bd1('0x44')](_0x175907['model'],_0x175907[_0x0bd1('0x43')]);_0x3c70da['attributes']=_[_0x0bd1('0x44')](_0x175907[_0x0bd1('0x42')],qs[_0x0bd1('0x46')](_0x22aa1a['query'][_0x0bd1('0x46')]));_0x3c70da['attributes']=_0x3c70da[_0x0bd1('0x45')][_0x0bd1('0x47')]?_0x3c70da[_0x0bd1('0x45')]:_0x175907[_0x0bd1('0x42')];if(!_0x22aa1a['query'][_0x0bd1('0x48')](_0x0bd1('0x49'))){_0x3c70da[_0x0bd1('0x2e')]=qs[_0x0bd1('0x2e')](_0x22aa1a[_0x0bd1('0x43')][_0x0bd1('0x2e')]);_0x3c70da[_0x0bd1('0x2d')]=qs[_0x0bd1('0x2d')](_0x22aa1a[_0x0bd1('0x43')][_0x0bd1('0x2d')]);}_0x3c70da[_0x0bd1('0x67')]=qs[_0x0bd1('0x4a')](_0x22aa1a[_0x0bd1('0x43')][_0x0bd1('0x4a')]);_0x3c70da[_0x0bd1('0x4b')]=qs[_0x0bd1('0x4c')](_[_0x0bd1('0x4d')](_0x22aa1a['query'],_0x175907[_0x0bd1('0x4c')]));_0x3c70da[_0x0bd1('0x4b')][_0x0bd1('0x68')]=_0x2b05cd['id'];if(_0x22aa1a[_0x0bd1('0x43')][_0x0bd1('0x4e')]){_0x3c70da[_0x0bd1('0x4b')]=_[_0x0bd1('0x4f')](_0x3c70da['where'],{'$or':_['map'](_0x3c70da[_0x0bd1('0x45')],function(_0x1d55c1){var _0x1f8c2a={};_0x1f8c2a[_0x1d55c1]={'$like':'%'+_0x22aa1a[_0x0bd1('0x43')]['filter']+'%'};return _0x1f8c2a;})});}_0x3c70da=_[_0x0bd1('0x4f')]({},_0x3c70da,_0x22aa1a[_0x0bd1('0x57')]);return db[_0x0bd1('0x65')]['count']({'where':_0x3c70da['where']})[_0x0bd1('0x33')](function(_0x5d983c){_0x276045[_0x0bd1('0x52')]=_0x5d983c;if(_0x22aa1a[_0x0bd1('0x43')][_0x0bd1('0x53')]){_0x3c70da[_0x0bd1('0x69')]=[{'all':!![]}];}return db[_0x0bd1('0x65')][_0x0bd1('0x6a')](_0x3c70da);})[_0x0bd1('0x33')](function(_0x5b9234){_0x276045['rows']=_0x5b9234;return _0x276045;});}})['then'](respondWithFilteredResult(_0x5c786d,_0x3c70da))[_0x0bd1('0x2b')](handleError(_0x5c786d,null));};exports[_0x0bd1('0x6b')]=function(_0x19c6db,_0x4da951,_0x32c020){return db[_0x0bd1('0x3f')]['find']({'where':{'id':_0x19c6db[_0x0bd1('0x55')]['id']}})[_0x0bd1('0x33')](handleEntityNotFound(_0x4da951,null))[_0x0bd1('0x33')](function(_0x52d001){if(_0x52d001){return _0x52d001[_0x0bd1('0x6b')](_0x19c6db[_0x0bd1('0x43')][_0x0bd1('0x6c')]);}})[_0x0bd1('0x33')](respondWithStatusCode(_0x4da951,null))['catch'](handleError(_0x4da951,null));};exports[_0x0bd1('0x6d')]=function(_0xfb0149,_0x427cba,_0x571707){if(_0xfb0149[_0x0bd1('0x5a')]['id']){delete _0xfb0149[_0x0bd1('0x5a')]['id'];}return db[_0x0bd1('0x3f')][_0x0bd1('0x58')]({'where':{'id':_0xfb0149['params']['id']}})[_0x0bd1('0x33')](handleEntityNotFound(_0x427cba,null))[_0x0bd1('0x33')](function(_0x1e5b85){if(_0x1e5b85){_0xfb0149[_0x0bd1('0x5a')][_0x0bd1('0x68')]=_0x1e5b85['id'];return db[_0x0bd1('0x6e')][_0x0bd1('0x59')](_0xfb0149['body']);}})[_0x0bd1('0x33')](respondWithResult(_0x427cba,null))[_0x0bd1('0x2b')](handleError(_0x427cba,null));};exports[_0x0bd1('0x6f')]=function(_0xfb6016,_0x20ab8f,_0x4ee1ec){var _0x361650={'raw':![],'where':{}};var _0x19610f={};var _0x54496e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0bd1('0x70')]({'where':{'id':_0xfb6016['params']['id']}})[_0x0bd1('0x33')](handleEntityNotFound(_0x20ab8f,null))[_0x0bd1('0x33')](function(_0xe403d3){if(_0xe403d3){_0x19610f[_0x0bd1('0x42')]=_[_0x0bd1('0x56')](db['CannedAnswer'][_0x0bd1('0x40')]);_0x19610f['query']=_[_0x0bd1('0x56')](_0xfb6016[_0x0bd1('0x43')]);_0x19610f[_0x0bd1('0x4c')]=_[_0x0bd1('0x44')](_0x19610f[_0x0bd1('0x42')],_0x19610f['query']);_0x361650[_0x0bd1('0x45')]=_[_0x0bd1('0x44')](_0x19610f[_0x0bd1('0x42')],qs[_0x0bd1('0x46')](_0xfb6016[_0x0bd1('0x43')]['fields']));_0x361650[_0x0bd1('0x45')]=_0x361650[_0x0bd1('0x45')]['length']?_0x361650[_0x0bd1('0x45')]:_0x19610f[_0x0bd1('0x42')];if(!_0xfb6016[_0x0bd1('0x43')][_0x0bd1('0x48')]('nolimit')){_0x361650[_0x0bd1('0x2e')]=qs['limit'](_0xfb6016[_0x0bd1('0x43')][_0x0bd1('0x2e')]);_0x361650[_0x0bd1('0x2d')]=qs[_0x0bd1('0x2d')](_0xfb6016[_0x0bd1('0x43')]['offset']);}_0x361650[_0x0bd1('0x67')]=qs['sort'](_0xfb6016['query'][_0x0bd1('0x4a')]);_0x361650['where']=qs[_0x0bd1('0x4c')](_[_0x0bd1('0x4d')](_0xfb6016['query'],_0x19610f[_0x0bd1('0x4c')]));_0x361650['where']['OpenchannelAccountId']=_0xe403d3['id'];if(_0xfb6016[_0x0bd1('0x43')][_0x0bd1('0x4e')]){_0x361650[_0x0bd1('0x4b')]=_[_0x0bd1('0x4f')](_0x361650[_0x0bd1('0x4b')],{'$or':_[_0x0bd1('0x3e')](_0x361650[_0x0bd1('0x45')],function(_0x2d3d8c){var _0x1d5b11={};_0x1d5b11[_0x2d3d8c]={'$like':'%'+_0xfb6016[_0x0bd1('0x43')]['filter']+'%'};return _0x1d5b11;})});}_0x361650=_[_0x0bd1('0x4f')]({},_0x361650,_0xfb6016[_0x0bd1('0x57')]);return db['CannedAnswer'][_0x0bd1('0x52')]({'where':_0x361650[_0x0bd1('0x4b')]})[_0x0bd1('0x33')](function(_0x297433){_0x54496e[_0x0bd1('0x52')]=_0x297433;if(_0xfb6016[_0x0bd1('0x43')][_0x0bd1('0x53')]){_0x361650[_0x0bd1('0x69')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0bd1('0x6a')](_0x361650);})[_0x0bd1('0x33')](function(_0x34daca){_0x54496e[_0x0bd1('0x71')]=_0x34daca;return _0x54496e;});}})[_0x0bd1('0x33')](respondWithFilteredResult(_0x20ab8f,_0x361650))[_0x0bd1('0x2b')](handleError(_0x20ab8f,null));};exports[_0x0bd1('0x72')]=function(_0x5d29c4,_0x3869f9,_0x4baf57){return db['OpenchannelAccount'][_0x0bd1('0x58')]({'where':{'id':_0x5d29c4[_0x0bd1('0x55')]['id']}})[_0x0bd1('0x33')](handleEntityNotFound(_0x3869f9,null))['then'](function(_0x513ba0){if(_0x513ba0){return _0x513ba0['removeAnswers'](_0x5d29c4[_0x0bd1('0x43')][_0x0bd1('0x6c')]);}})[_0x0bd1('0x33')](respondWithStatusCode(_0x3869f9,null))[_0x0bd1('0x2b')](handleError(_0x3869f9,null));};exports[_0x0bd1('0x73')]=function(_0x4ad425,_0x340eed,_0x1d47e2){var _0x30e2e8={'body':_0x4ad425['body'],'channel':_0x0bd1('0x74')};var _0x7ac9c5=[];var _0x17df23=[];var _0x24a403={};var _0x4b716d=![];return db[_0x0bd1('0x75')][_0x0bd1('0x63')]()['then'](function(_0x5b6b6d){if(!_0x5b6b6d){throw new db['Sequelize']['ValidationError'](_0x0bd1('0x76'));}_0x7ac9c5=_[_0x0bd1('0x77')](_[_0x0bd1('0x56')](_0x5b6b6d),[_0x0bd1('0x78'),_0x0bd1('0x79')]);_0x17df23=_['difference'](_[_0x0bd1('0x56')](_0x5b6b6d),[_0x0bd1('0x78'),_0x0bd1('0x79'),'CompanyId',_0x0bd1('0x7a')]);if(_0x4ad425[_0x0bd1('0x5a')]['id']){delete _0x4ad425[_0x0bd1('0x5a')]['id'];}if(_[_0x0bd1('0x7b')](_0x4ad425[_0x0bd1('0x5a')]['from'])){throw new db[(_0x0bd1('0x7c'))][(_0x0bd1('0x7d'))](_0x0bd1('0x7e'));}if(_['isNil'](_0x4ad425[_0x0bd1('0x5a')]['body'])||_0x4ad425['body'][_0x0bd1('0x5a')]===''){throw new db[(_0x0bd1('0x7c'))][(_0x0bd1('0x7d'))](_0x0bd1('0x7f'));}if(_[_0x0bd1('0x7b')](_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x80')])){throw new db['Sequelize'][(_0x0bd1('0x7d'))](_0x0bd1('0x81')+_0x17df23);}if(!_[_0x0bd1('0x82')](_0x17df23,_0x4ad425['body'][_0x0bd1('0x80')])){throw new db[(_0x0bd1('0x7c'))][(_0x0bd1('0x7d'))](_0x0bd1('0x83')+_0x17df23);}_0x24a403[_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x80')]]=_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x84')];})[_0x0bd1('0x33')](function(){return db[_0x0bd1('0x3f')][_0x0bd1('0x58')]({'where':{'id':_0x4ad425[_0x0bd1('0x55')]['id']},'include':[{'model':db[_0x0bd1('0x85')],'as':_0x0bd1('0x86'),'include':[{'model':db[_0x0bd1('0x75')],'as':_0x0bd1('0x87'),'where':_0x24a403,'limit':0x1,'order':[[_0x0bd1('0x79'),_0x0bd1('0x88')]]}]},{'model':db[_0x0bd1('0x89')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x340eed,null))['then'](function(_0x39dec3){if(_0x39dec3&&_0x39dec3[_0x0bd1('0x86')]){_0x30e2e8[_0x0bd1('0x8a')]=_0x39dec3;_0x30e2e8[_0x0bd1('0x8b')]=_0x39dec3[_0x0bd1('0x8c')];_0x30e2e8[_0x0bd1('0x8d')]=_0x39dec3[_0x0bd1('0x86')];_0x30e2e8[_0x0bd1('0x8b')]=_[_0x0bd1('0x8e')](_0x30e2e8['applications'],['priority'],[_0x0bd1('0x8f')]);if(_0x30e2e8[_0x0bd1('0x8a')][_0x0bd1('0x8c')]){delete _0x30e2e8[_0x0bd1('0x8a')][_0x0bd1('0x8c')];}if(_0x30e2e8['account'][_0x0bd1('0x86')]&&_0x30e2e8[_0x0bd1('0x8a')][_0x0bd1('0x86')][_0x0bd1('0x87')][_0x0bd1('0x47')]){return _0x30e2e8[_0x0bd1('0x8a')][_0x0bd1('0x86')]['Contacts'][0x0];}var _0x4efc51=_[_0x0bd1('0x1b')](_0x4ad425[_0x0bd1('0x5a')],{'firstName':_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x84')],'ListId':_0x39dec3[_0x0bd1('0x7a')]});_0x4efc51[_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x80')]]=_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x84')];return db[_0x0bd1('0x75')][_0x0bd1('0x59')](_0x4efc51,{'fields':_0x7ac9c5,'raw':!![]});}})['then'](handleEntityNotFound(_0x340eed,null))[_0x0bd1('0x33')](function(_0x5edeb6){_0x30e2e8['contact']=_0x5edeb6;if(_0x5edeb6){var _0x12a3f6={'ContactId':_0x5edeb6['id'],'OpenchannelAccountId':_0x4ad425[_0x0bd1('0x55')]['id'],'from':(_0x5edeb6[_0x0bd1('0x90')]||'')+'\x20'+(_0x5edeb6[_0x0bd1('0x91')]||'')};var _0x34a297={'OpenchannelAccountId':_0x4ad425[_0x0bd1('0x55')]['id'],'closed':![]};if(_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x92')]){_0x34a297['threadId']=_0x4ad425['body']['threadId'];return db['OpenchannelInteraction'][_0x0bd1('0x58')]({'where':_0x34a297})['then'](function(_0x3e464e){if(_0x3e464e){return[_0x3e464e,![]];}_0x12a3f6[_0x0bd1('0x92')]=_0x4ad425['body'][_0x0bd1('0x92')];_0x12a3f6[_0x0bd1('0x93')]=_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x93')];return db[_0x0bd1('0x94')][_0x0bd1('0x59')](_0x12a3f6)[_0x0bd1('0x33')](function(_0x223f93){return[_0x223f93,!![]];});});}else{_0x34a297['threadId']=null;}_0x34a297[_0x0bd1('0x95')]=_0x5edeb6['id'];return db['OpenchannelInteraction'][_0x0bd1('0x58')]({'where':_0x34a297})[_0x0bd1('0x33')](function(_0x242c3b){if(_0x242c3b){return[_0x242c3b,![]];}return db['OpenchannelInteraction'][_0x0bd1('0x59')](_0x12a3f6)[_0x0bd1('0x33')](function(_0x4eeec0){return[_0x4eeec0,!![]];});});}})['spread'](function(_0x4401e8,_0x73cd1c){if(_0x4401e8){_0x4b716d=_0x73cd1c;if(!_0x73cd1c){var _0x3fc499={'from':(_0x30e2e8['contact'][_0x0bd1('0x90')]||'')+'\x20'+(_0x30e2e8[_0x0bd1('0x96')]['lastName']||'')};if(_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x92')]&&_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x97')]&&_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x92')]!=_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x97')]){_0x3fc499['threadId']=_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x97')];}return _0x4401e8['update'](_0x3fc499);}else{return _0x4401e8;}}})[_0x0bd1('0x33')](function(_0xe651eb){_0x30e2e8['interaction']=_0xe651eb[_0x0bd1('0x35')]({'plain':!![]});_0x30e2e8['interaction'][_0x0bd1('0x98')]=_0x4b716d;if(_0x30e2e8[_0x0bd1('0x99')][_0x0bd1('0x98')]){if(_0x30e2e8[_0x0bd1('0x8a')][_0x0bd1('0x9a')]){_0x30e2e8[_0x0bd1('0x8b')][_0x0bd1('0x9b')]({'id':0x0,'priority':_0x30e2e8[_0x0bd1('0x8b')][_0x0bd1('0x47')]+0x1,'app':_0x0bd1('0x9c'),'appdata':_0x0bd1('0x9d'),'interval':_0x0bd1('0x9e')});}}return db[_0x0bd1('0x9f')][_0x0bd1('0x59')]({'body':_0x4ad425[_0x0bd1('0x5a')][_0x0bd1('0x5a')],'OpenchannelAccountId':_0x4ad425['params']['id'],'OpenchannelInteractionId':_0xe651eb['id'],'direction':'in','ContactId':_0x30e2e8[_0x0bd1('0x96')]['id'],'AttachmentId':_0x4ad425['body']['AttachmentId']});})[_0x0bd1('0x33')](function(_0x1b2140){_0x30e2e8['message']=_0x1b2140;if(!_0x30e2e8[_0x0bd1('0x99')][_0x0bd1('0xa0')])return;return db[_0x0bd1('0xa1')]['find']({'attributes':['id',_0x0bd1('0x3b')],'where':{'id':_0x30e2e8[_0x0bd1('0x99')][_0x0bd1('0xa0')]}});})['then'](function(_0x49933f){if(_0x49933f){_0x30e2e8[_0x0bd1('0x8b')][_0x0bd1('0xa2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x49933f[_0x0bd1('0x3b')]+','+(_0x30e2e8[_0x0bd1('0x8a')][_0x0bd1('0xa3')]||0xa),'interval':'*,*,*,*'});}if(!_0x30e2e8[_0x0bd1('0x99')][_0x0bd1('0xa4')])return;return db[_0x0bd1('0xa5')][_0x0bd1('0x58')]({'attributes':['id',_0x0bd1('0x3b')],'where':{'id':_0x30e2e8[_0x0bd1('0x99')]['queueId']}});})['then'](function(_0x203aec){if(_0x203aec){_0x30e2e8[_0x0bd1('0x8b')][_0x0bd1('0xa2')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x203aec[_0x0bd1('0x3b')]+','+(_0x30e2e8['account'][_0x0bd1('0xa6')]||0x12c),'interval':_0x0bd1('0x9e')});}return respondWithRpcPromise(_0x0bd1('0xa7'),'startRouting',_0x30e2e8);})['then'](function(_0x271b15){respondWithRpcPromise(_0x0bd1('0xa8'),_0x0bd1('0xa8'),{'event':'notify','message':_0x271b15},client9002);return _0x271b15;})[_0x0bd1('0x33')](respondWithResult(_0x340eed,null))[_0x0bd1('0x2b')](handleError(_0x340eed,null));};exports[_0x0bd1('0xa9')]=function(_0x861efd,_0x443b04){var _0x4a5ed5=_0x861efd[_0x0bd1('0x55')]['id'];var _0x10829a=_0x861efd['body'];var _0x1fed42=0xc8;var _0x116e13=null;return db[_0x0bd1('0xaa')][_0x0bd1('0xab')]({'isolationLevel':db[_0x0bd1('0xaa')][_0x0bd1('0xac')]['ISOLATION_LEVELS'][_0x0bd1('0xad')]},function(_0x3deb9d){return db[_0x0bd1('0x3f')]['findOne']({'where':{'id':_0x4a5ed5},'transaction':_0x3deb9d})[_0x0bd1('0x33')](function(_0x3b97bf){if(_0x3b97bf){return db[_0x0bd1('0x89')][_0x0bd1('0x34')]({'where':{'OpenchannelAccountId':_0x4a5ed5},'transaction':_0x3deb9d})[_0x0bd1('0x33')](function(){var _0x6e7bdd=_['map'](_0x10829a,function(_0x5bfc72){_0x5bfc72['OpenchannelAccountId']=_0x4a5ed5;return _0x5bfc72;});return db[_0x0bd1('0x89')][_0x0bd1('0xae')](_0x6e7bdd,{'transaction':_0x3deb9d});});}else{_0x1fed42=0x194;_0x116e13=[];}});})[_0x0bd1('0x33')](function(){if(_0x1fed42!==0x194){return db['OpenchannelApplication'][_0x0bd1('0xaf')]({'where':{'OpenchannelAccountId':_0x4a5ed5},'order':'priority'})[_0x0bd1('0x33')](function(_0x5ef3bd){_0x116e13=_0x5ef3bd;});}})[_0x0bd1('0x2b')](function(_0x365f0e){_0x1fed42=0x1f4;logger['error'](_0x365f0e[_0x0bd1('0x3a')]);if(_0x365f0e[_0x0bd1('0x3b')]){delete _0x365f0e[_0x0bd1('0x3b')];}_0x116e13=_0x365f0e;})[_0x0bd1('0xb0')](function(){if(_0x116e13===null){_0x443b04[_0x0bd1('0x39')](_0x1fed42);}else{if(_0x1fed42===0x1f4){_0x443b04[_0x0bd1('0x2c')](_0x1fed42)[_0x0bd1('0x3c')](_0x116e13);}else{_0x443b04[_0x0bd1('0x2c')](_0x1fed42)[_0x0bd1('0xb1')](_0x116e13);}}});};exports['getApplications']=function(_0x102c91,_0x2bfa72,_0x11bff3){var _0x2c0574={};var _0x49f9bb={};var _0x4be21a;var _0x3fcf03;return db[_0x0bd1('0x3f')]['findOne']({'where':{'id':_0x102c91[_0x0bd1('0x55')]['id']}})[_0x0bd1('0x33')](handleEntityNotFound(_0x2bfa72,null))[_0x0bd1('0x33')](function(_0x39ec42){if(_0x39ec42){_0x4be21a=_0x39ec42;_0x49f9bb[_0x0bd1('0x42')]=_['keys'](db[_0x0bd1('0x89')]['rawAttributes']);_0x49f9bb[_0x0bd1('0x43')]=_[_0x0bd1('0x56')](_0x102c91['query']);_0x49f9bb['filters']=_[_0x0bd1('0x44')](_0x49f9bb['model'],_0x49f9bb[_0x0bd1('0x43')]);_0x2c0574[_0x0bd1('0x45')]=_[_0x0bd1('0x44')](_0x49f9bb[_0x0bd1('0x42')],qs[_0x0bd1('0x46')](_0x102c91['query']['fields']));_0x2c0574[_0x0bd1('0x45')]=_0x2c0574[_0x0bd1('0x45')][_0x0bd1('0x47')]?_0x2c0574[_0x0bd1('0x45')]:_0x49f9bb[_0x0bd1('0x42')];_0x2c0574[_0x0bd1('0x67')]=qs[_0x0bd1('0x4a')](_0x102c91[_0x0bd1('0x43')][_0x0bd1('0x4a')]);_0x2c0574[_0x0bd1('0x4b')]=qs[_0x0bd1('0x4c')](_[_0x0bd1('0x4d')](_0x102c91[_0x0bd1('0x43')],_0x49f9bb[_0x0bd1('0x4c')]));if(_0x102c91[_0x0bd1('0x43')]['filter']){_0x2c0574['where']=_['merge'](_0x2c0574[_0x0bd1('0x4b')],{'$or':_[_0x0bd1('0x3e')](_0x2c0574[_0x0bd1('0x45')],function(_0x5e0a1c){var _0x1c126e={};_0x1c126e[_0x5e0a1c]={'$like':'%'+_0x102c91['query'][_0x0bd1('0x4e')]+'%'};return _0x1c126e;})});}_0x2c0574=_[_0x0bd1('0x4f')]({},_0x2c0574,_0x102c91[_0x0bd1('0x57')]);return _0x4be21a['getApplications'](_0x2c0574);}})[_0x0bd1('0x33')](function(_0x5bfe35){if(_0x5bfe35){_0x3fcf03=_0x5bfe35[_0x0bd1('0x47')];if(!_0x102c91['query']['hasOwnProperty'](_0x0bd1('0x49'))){_0x2c0574[_0x0bd1('0x2e')]=qs[_0x0bd1('0x2e')](_0x102c91['query'][_0x0bd1('0x2e')]);_0x2c0574[_0x0bd1('0x2d')]=qs[_0x0bd1('0x2d')](_0x102c91[_0x0bd1('0x43')][_0x0bd1('0x2d')]);}return _0x4be21a['getApplications'](_0x2c0574);}})[_0x0bd1('0x33')](function(_0x5ae193){if(_0x5ae193){return _0x5ae193?{'count':_0x3fcf03,'rows':_0x5ae193}:null;}})[_0x0bd1('0x33')](respondWithResult(_0x2bfa72,null))['catch'](handleError(_0x2bfa72,null));};exports[_0x0bd1('0xb2')]=function(_0x28c786,_0x57e768,_0x386bfb){var _0x440c5e={'raw':![],'where':{}};var _0x3ecf93={};var _0x659fc1={'count':0x0,'rows':[]};return db[_0x0bd1('0x3f')][_0x0bd1('0x70')]({'where':{'id':_0x28c786['params']['id']}})[_0x0bd1('0x33')](handleEntityNotFound(_0x57e768,null))[_0x0bd1('0x33')](function(_0x1f45a6){if(_0x1f45a6){_0x3ecf93[_0x0bd1('0x42')]=_[_0x0bd1('0x56')](db[_0x0bd1('0x94')][_0x0bd1('0x40')]);_0x3ecf93[_0x0bd1('0x43')]=_[_0x0bd1('0x56')](_0x28c786[_0x0bd1('0x43')]);_0x3ecf93[_0x0bd1('0x4c')]=_[_0x0bd1('0x44')](_0x3ecf93[_0x0bd1('0x42')],_0x3ecf93[_0x0bd1('0x43')]);_0x440c5e[_0x0bd1('0x45')]=_['intersection'](_0x3ecf93[_0x0bd1('0x42')],qs[_0x0bd1('0x46')](_0x28c786[_0x0bd1('0x43')][_0x0bd1('0x46')]));_0x440c5e[_0x0bd1('0x45')]=_0x440c5e['attributes'][_0x0bd1('0x47')]?_0x440c5e[_0x0bd1('0x45')]:_0x3ecf93['model'];if(!_0x28c786[_0x0bd1('0x43')][_0x0bd1('0x48')]('nolimit')){_0x440c5e[_0x0bd1('0x2e')]=qs[_0x0bd1('0x2e')](_0x28c786[_0x0bd1('0x43')][_0x0bd1('0x2e')]);_0x440c5e[_0x0bd1('0x2d')]=qs[_0x0bd1('0x2d')](_0x28c786[_0x0bd1('0x43')][_0x0bd1('0x2d')]);}_0x440c5e[_0x0bd1('0x67')]=qs[_0x0bd1('0x4a')](_0x28c786['query'][_0x0bd1('0x4a')]);_0x440c5e[_0x0bd1('0x4b')]=qs[_0x0bd1('0x4c')](_[_0x0bd1('0x4d')](_0x28c786[_0x0bd1('0x43')],_0x3ecf93['filters']));_0x440c5e[_0x0bd1('0x4b')][_0x0bd1('0x68')]=_0x1f45a6['id'];if(_0x28c786[_0x0bd1('0x43')]['filter']){_0x440c5e[_0x0bd1('0x4b')]=_['merge'](_0x440c5e[_0x0bd1('0x4b')],{'$or':_[_0x0bd1('0x3e')](_0x440c5e[_0x0bd1('0x45')],function(_0x367c29){var _0x5804ae={};_0x5804ae[_0x367c29]={'$like':'%'+_0x28c786[_0x0bd1('0x43')][_0x0bd1('0x4e')]+'%'};return _0x5804ae;})});}_0x440c5e=_[_0x0bd1('0x4f')]({},_0x440c5e,_0x28c786[_0x0bd1('0x57')]);return db['OpenchannelInteraction'][_0x0bd1('0x52')]({'where':_0x440c5e[_0x0bd1('0x4b')]})['then'](function(_0x1f96a3){_0x659fc1[_0x0bd1('0x52')]=_0x1f96a3;if(_0x28c786['query'][_0x0bd1('0x53')]){_0x440c5e[_0x0bd1('0x69')]=[{'model':db[_0x0bd1('0x75')],'as':_0x0bd1('0xb3'),'required':![]},{'model':db[_0x0bd1('0xa1')],'as':_0x0bd1('0xb4'),'attributes':[_0x0bd1('0x3b'),_0x0bd1('0xb5'),_0x0bd1('0xb6')],'required':![]},{'model':db['Tag'],'as':_0x0bd1('0xb7'),'attributes':['id',_0x0bd1('0x3b'),_0x0bd1('0xb8')],'where':_0x28c786[_0x0bd1('0x43')]['tag']?{'id':_0x28c786[_0x0bd1('0x43')][_0x0bd1('0xb9')]}:undefined,'required':_0x28c786[_0x0bd1('0x43')][_0x0bd1('0xb9')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x440c5e);})[_0x0bd1('0x33')](function(_0x2d3dbe){_0x659fc1['rows']=_0x2d3dbe;return _0x659fc1;});}})[_0x0bd1('0x33')](respondWithFilteredResult(_0x57e768,_0x440c5e))[_0x0bd1('0x2b')](handleError(_0x57e768,null));};exports[_0x0bd1('0xba')]=function(_0x5dcd27,_0x15784c,_0x5f3154){return db['OpenchannelAccount'][_0x0bd1('0x58')]({'where':{'id':_0x5dcd27[_0x0bd1('0x55')]['id']}})['then'](handleEntityNotFound(_0x15784c,null))[_0x0bd1('0x33')](function(_0x3c0209){if(_0x3c0209){return _0x3c0209[_0x0bd1('0xba')](_0x5dcd27[_0x0bd1('0x5a')][_0x0bd1('0x6c')],_['omit'](_0x5dcd27[_0x0bd1('0x5a')],['ids','id'])||{})[_0x0bd1('0xbb')](function(_0x2b4276){for(var _0x3f8a24=0x0;_0x3f8a24<_0x5dcd27[_0x0bd1('0x5a')]['ids'][_0x0bd1('0x47')];_0x3f8a24+=0x1){socket[_0x0bd1('0xbc')](_0x0bd1('0xbd'),{'UserId':Number(_0x5dcd27[_0x0bd1('0x5a')][_0x0bd1('0x6c')][_0x3f8a24]),'OpenchannelAccountId':Number(_0x5dcd27[_0x0bd1('0x55')]['id'])});}return _0x2b4276;});}})[_0x0bd1('0x33')](respondWithResult(_0x15784c,null))[_0x0bd1('0x2b')](handleError(_0x15784c,null));};exports[_0x0bd1('0xbe')]=function(_0x22b490,_0xa862b8,_0x5af909){return db['OpenchannelAccount'][_0x0bd1('0x58')]({'where':{'id':_0x22b490[_0x0bd1('0x55')]['id']}})['then'](handleEntityNotFound(_0xa862b8,null))['then'](function(_0x2b1dbb){if(_0x2b1dbb){return _0x2b1dbb['removeAgents'](_0x22b490['query'][_0x0bd1('0x6c')])[_0x0bd1('0x33')](function(){if(_[_0x0bd1('0xbf')](_0x22b490[_0x0bd1('0x43')][_0x0bd1('0x6c')])){for(var _0x2ccadd=0x0;_0x2ccadd<_0x22b490[_0x0bd1('0x43')][_0x0bd1('0x6c')][_0x0bd1('0x47')];_0x2ccadd+=0x1){socket[_0x0bd1('0xbc')](_0x0bd1('0xc0'),{'UserId':Number(_0x22b490['query'][_0x0bd1('0x6c')][_0x2ccadd]),'OpenchannelAccountId':Number(_0x22b490[_0x0bd1('0x55')]['id'])});}}else{socket[_0x0bd1('0xbc')]('userOpenchannelAccount:remove',{'UserId':Number(_0x22b490[_0x0bd1('0x43')][_0x0bd1('0x6c')]),'OpenchannelAccountId':Number(_0x22b490[_0x0bd1('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0xa862b8,null))[_0x0bd1('0x2b')](handleError(_0xa862b8,null));};exports['getAgents']=function(_0x5338e3,_0x3213f0,_0x4a2495){var _0xc77910={};var _0x41001b={};var _0x2f3efd;var _0x2e44ec;return db[_0x0bd1('0x3f')][_0x0bd1('0x70')]({'where':{'id':_0x5338e3['params']['id']}})['then'](handleEntityNotFound(_0x3213f0,null))['then'](function(_0x37ff57){if(_0x37ff57){_0x2f3efd=_0x37ff57;_0x41001b[_0x0bd1('0x42')]=_[_0x0bd1('0x56')](db[_0x0bd1('0xa1')][_0x0bd1('0x40')]);_0x41001b['query']=_[_0x0bd1('0x56')](_0x5338e3[_0x0bd1('0x43')]);_0x41001b['filters']=_['intersection'](_0x41001b[_0x0bd1('0x42')],_0x41001b['query']);_0xc77910[_0x0bd1('0x45')]=_[_0x0bd1('0x44')](_0x41001b[_0x0bd1('0x42')],qs['fields'](_0x5338e3['query'][_0x0bd1('0x46')]));_0xc77910[_0x0bd1('0x45')]=_0xc77910['attributes']['length']?_0xc77910[_0x0bd1('0x45')]:_0x41001b[_0x0bd1('0x42')];_0xc77910['order']=qs[_0x0bd1('0x4a')](_0x5338e3[_0x0bd1('0x43')][_0x0bd1('0x4a')]);_0xc77910['where']=qs[_0x0bd1('0x4c')](_[_0x0bd1('0x4d')](_0x5338e3[_0x0bd1('0x43')],_0x41001b[_0x0bd1('0x4c')]));if(_0x5338e3[_0x0bd1('0x43')][_0x0bd1('0x4e')]){_0xc77910[_0x0bd1('0x4b')]=_[_0x0bd1('0x4f')](_0xc77910[_0x0bd1('0x4b')],{'$or':_['map'](_0xc77910[_0x0bd1('0x45')],function(_0x47b0c7){var _0x494612={};_0x494612[_0x47b0c7]={'$like':'%'+_0x5338e3[_0x0bd1('0x43')]['filter']+'%'};return _0x494612;})});}_0xc77910=_[_0x0bd1('0x4f')]({},_0xc77910,_0x5338e3[_0x0bd1('0x57')]);return _0x2f3efd[_0x0bd1('0xc1')](_0xc77910);}})[_0x0bd1('0x33')](function(_0x122b24){if(_0x122b24){_0x2e44ec=_0x122b24[_0x0bd1('0x47')];if(!_0x5338e3[_0x0bd1('0x43')][_0x0bd1('0x48')](_0x0bd1('0x49'))){_0xc77910['limit']=qs[_0x0bd1('0x2e')](_0x5338e3[_0x0bd1('0x43')][_0x0bd1('0x2e')]);_0xc77910[_0x0bd1('0x2d')]=qs['offset'](_0x5338e3[_0x0bd1('0x43')][_0x0bd1('0x2d')]);}return _0x2f3efd['getAgents'](_0xc77910);}})['then'](function(_0x190736){if(_0x190736){return _0x190736?{'count':_0x2e44ec,'rows':_0x190736}:null;}})[_0x0bd1('0x33')](respondWithResult(_0x3213f0,null))[_0x0bd1('0x2b')](handleError(_0x3213f0,null));};exports['send']=function(_0xf66f44,_0x4218fd,_0x3fcd63){var _0x260d67,_0x240930,_0x20907a;if(_['isNil'](_0xf66f44['body'][_0x0bd1('0x5a')])||_0xf66f44['body'][_0x0bd1('0x5a')]===''){throw new db['Sequelize'][(_0x0bd1('0x7d'))](_0x0bd1('0x7f'));}if(_[_0x0bd1('0x7b')](_0xf66f44[_0x0bd1('0x5a')]['to'])){}_0x260d67=_0xf66f44['body']['to'];return db[_0x0bd1('0x3f')][_0x0bd1('0x70')]({'where':{'id':_0xf66f44[_0x0bd1('0x55')]['id']}})['then'](handleEntityNotFound(_0x4218fd,null))['then'](function(_0x1dcb3d){if(_0x1dcb3d){return db[_0x0bd1('0x3f')][_0x0bd1('0x58')]({'where':{'id':_0x1dcb3d['id']},'include':[{'model':db[_0x0bd1('0x85')],'as':'List','include':[{'model':db[_0x0bd1('0x75')],'as':_0x0bd1('0x87'),'where':{[_0x1dcb3d[_0x0bd1('0x80')]]:_0x260d67},'limit':0x1,'order':[[_0x0bd1('0x79'),_0x0bd1('0x88')]]}]}]})[_0x0bd1('0x33')](handleEntityNotFound(_0x4218fd,null))['then'](function(_0x4ab435){if(_0x4ab435&&_0x4ab435[_0x0bd1('0x86')]){_0x240930=_0x4ab435[_0x0bd1('0x35')]({'plain':!![]});if(_0x240930[_0x0bd1('0x86')]&&_0x240930[_0x0bd1('0x86')][_0x0bd1('0x87')]['length']){return _0x240930[_0x0bd1('0x86')][_0x0bd1('0x87')][0x0];}return db[_0x0bd1('0x75')][_0x0bd1('0x59')](_[_0x0bd1('0x1b')](_0xf66f44[_0x0bd1('0x5a')],{'firstName':_0x260d67,[_0x4ab435[_0x0bd1('0x80')]]:_0x260d67,'phone':_0x260d67,'ListId':_0x240930[_0x0bd1('0x7a')]}));}})[_0x0bd1('0x33')](handleEntityNotFound(_0x4218fd,null))[_0x0bd1('0x33')](function(_0x233200){if(_0x233200){_0x20907a=_0x233200;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x20907a['id'],'closed':![],'OpenchannelAccountId':_0x240930['id']}})[_0x0bd1('0x33')](function(_0x6e8e92){if(_0x6e8e92){return[_0x6e8e92,![]];}return db[_0x0bd1('0x94')][_0x0bd1('0x59')]({'UserId':_0xf66f44[_0x0bd1('0x5b')]['id'],'ContactId':_0x20907a['id'],'OpenchannelAccountId':_0x240930['id'],'lastMsgDirection':_0x0bd1('0xc2'),'firstMsgDirection':'out','Messages':[_['merge'](_0xf66f44[_0x0bd1('0x5a')],{'read':![],'body':_0xf66f44[_0x0bd1('0x5a')][_0x0bd1('0x5a')],'OpenchannelAccountId':_0x240930['id'],'UserId':_0xf66f44[_0x0bd1('0x5b')]['id'],'ContactId':_0x20907a['id']})]},{'include':[{'model':db[_0x0bd1('0x9f')],'as':'Messages'}]})[_0x0bd1('0x33')](function(_0x6fb8f){return[_0x6fb8f,!![]];});});}})[_0x0bd1('0xbb')](function(_0x4e8a40,_0x392cb4){if(_0x392cb4){return _0x4e8a40;}return db[_0x0bd1('0x9f')][_0x0bd1('0x59')](_[_0x0bd1('0x4f')](_0xf66f44[_0x0bd1('0x5a')],{'read':![],'body':_0xf66f44[_0x0bd1('0x5a')][_0x0bd1('0x5a')],'OpenchannelAccountId':_0x240930['id'],'OpenchannelInteractionId':_0x4e8a40['id'],'UserId':_0xf66f44[_0x0bd1('0x5b')]['id'],'ContactId':_0x20907a['id']}))[_0x0bd1('0x33')](function(_0xefce70){_0x4e8a40[_0x0bd1('0xc3')][_0x0bd1('0xc4')]=[];_0x4e8a40[_0x0bd1('0xc3')]['Messages'][_0x0bd1('0x9b')](_0xefce70[_0x0bd1('0xc3')]);return _0x4e8a40;});});}})['then'](respondWithResult(_0x4218fd,null))[_0x0bd1('0x2b')](handleError(_0x4218fd,null));}; \ No newline at end of file +var _0x1b64=['attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','include','rows','show','intersection','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','getDispositions','findOne','Disposition','length','OpenchannelAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','includes','List','CmContact','Contacts','DESC','Applications','account','applications','list','orderBy','priority','contact','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','finally','getApplications','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','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','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','debug','request\x20sent','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','fields'];(function(_0xbf8ec1,_0x9169c8){var _0xc84567=function(_0x509094){while(--_0x509094){_0xbf8ec1['push'](_0xbf8ec1['shift']());}};_0xc84567(++_0x9169c8);}(_0x1b64,0x76));var _0x41b6=function(_0x35f5c0,_0x2a3613){_0x35f5c0=_0x35f5c0-0x0;var _0x3ce05a=_0x1b64[_0x35f5c0];return _0x3ce05a;};'use strict';var emlformat=require(_0x41b6('0x0'));var rimraf=require(_0x41b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41b6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x41b6('0x3'));var util=require(_0x41b6('0x4'));var path=require(_0x41b6('0x5'));var sox=require(_0x41b6('0x6'));var csv=require('to-csv');var ejs=require(_0x41b6('0x7'));var fs=require('fs');var fs_extra=require(_0x41b6('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x41b6('0x9'));var deskjs=require(_0x41b6('0xa'));var toCsv=require(_0x41b6('0xb'));var querystring=require(_0x41b6('0xc'));var Papa=require(_0x41b6('0xd'));var Redis=require(_0x41b6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x41b6('0xf'));var as=require(_0x41b6('0x10'));var hardwareService=require(_0x41b6('0x11'));var logger=require(_0x41b6('0x12'))(_0x41b6('0x13'));var utils=require(_0x41b6('0x14'));var config=require(_0x41b6('0x15'));var licenseUtil=require(_0x41b6('0x16'));var db=require(_0x41b6('0x17'))['db'];config[_0x41b6('0x18')]=_[_0x41b6('0x19')](config[_0x41b6('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x41b6('0x1a'))(new Redis(config[_0x41b6('0x18')]));require(_0x41b6('0x1b'))[_0x41b6('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x41b6('0x1d')][_0x41b6('0x1e')]({'port':0x232c});var client9002=jayson[_0x41b6('0x1d')][_0x41b6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1d4441,_0x1bd0b0,_0x30f076,_0x4805de){return new BPromise(function(_0x13ce57,_0xf0d6ae){var _0x1b2500=_0x4805de||client;return _0x1b2500[_0x41b6('0x1f')](_0x1d4441,_0x30f076)[_0x41b6('0x20')](function(_0x47feb9){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x1bd0b0,'request\x20sent');logger[_0x41b6('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1bd0b0,_0x41b6('0x22'),JSON[_0x41b6('0x23')](_0x47feb9));if(_0x47feb9[_0x41b6('0x24')]){if(_0x47feb9[_0x41b6('0x24')][_0x41b6('0x25')]===0x1f4){logger[_0x41b6('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x1bd0b0,_0x47feb9['error'][_0x41b6('0x26')]);return _0xf0d6ae(_0x47feb9['error'][_0x41b6('0x26')]);}logger[_0x41b6('0x24')](_0x41b6('0x27'),_0x1bd0b0,_0x47feb9[_0x41b6('0x24')][_0x41b6('0x26')]);return _0x13ce57(_0x47feb9[_0x41b6('0x24')][_0x41b6('0x26')]);}else{logger[_0x41b6('0x28')](_0x41b6('0x27'),_0x1bd0b0,_0x41b6('0x22'));_0x13ce57(_0x47feb9[_0x41b6('0x29')]['message']);}})[_0x41b6('0x2a')](function(_0x2c1290){logger['error'](_0x41b6('0x27'),_0x1bd0b0,_0x2c1290);_0xf0d6ae(_0x2c1290);});});}function respondWithStatusCode(_0x358872,_0x4f98de){_0x4f98de=_0x4f98de||0xcc;return function(_0x22d399){if(_0x22d399){return _0x358872[_0x41b6('0x2b')](_0x4f98de);}return _0x358872[_0x41b6('0x2c')](_0x4f98de)['end']();};}function respondWithResult(_0x40a466,_0x5e431d){_0x5e431d=_0x5e431d||0xc8;return function(_0x49142b){if(_0x49142b){return _0x40a466['status'](_0x5e431d)[_0x41b6('0x2d')](_0x49142b);}};}function respondWithFilteredResult(_0x425c16,_0x5b5ca7){return function(_0x2dee1f){if(_0x2dee1f){var _0x45f9e2=typeof _0x5b5ca7[_0x41b6('0x2e')]===_0x41b6('0x2f')&&typeof _0x5b5ca7[_0x41b6('0x30')]==='undefined';var _0x5a0554=_0x2dee1f[_0x41b6('0x31')];var _0x37bd7a=_0x45f9e2?0x0:_0x5b5ca7[_0x41b6('0x2e')];var _0x56b365=_0x45f9e2?_0x2dee1f[_0x41b6('0x31')]:_0x5b5ca7[_0x41b6('0x2e')]+_0x5b5ca7['limit'];var _0x27a737;if(_0x56b365>=_0x5a0554){_0x56b365=_0x5a0554;_0x27a737=0xc8;}else{_0x27a737=0xce;}_0x425c16[_0x41b6('0x2c')](_0x27a737);return _0x425c16[_0x41b6('0x32')](_0x41b6('0x33'),_0x37bd7a+'-'+_0x56b365+'/'+_0x5a0554)[_0x41b6('0x2d')](_0x2dee1f);}return null;};}function patchUpdates(_0x2ac3a7){return function(_0x1c47b1){try{jsonpatch['apply'](_0x1c47b1,_0x2ac3a7,!![]);}catch(_0x13562f){return BPromise['reject'](_0x13562f);}return _0x1c47b1['save']();};}function saveUpdates(_0x2235fd,_0x4cf4d5){return function(_0x207412){if(_0x207412){return _0x207412[_0x41b6('0x34')](_0x2235fd)[_0x41b6('0x20')](function(_0x435639){return _0x435639;});}return null;};}function removeEntity(_0xc97805,_0x3c5141){return function(_0x420e40){if(_0x420e40){return _0x420e40[_0x41b6('0x35')]()['then'](function(){var _0x457e50=_0x420e40[_0x41b6('0x36')]({'plain':!![]});var _0x326e10=_0x41b6('0x37');return db[_0x41b6('0x38')][_0x41b6('0x35')]({'where':{'type':_0x326e10,'resourceId':_0x457e50['id']}})[_0x41b6('0x20')](function(){return _0x420e40;});})['then'](function(){_0xc97805[_0x41b6('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a5ede,_0x34edfc){return function(_0x239d34){if(!_0x239d34){_0x5a5ede[_0x41b6('0x2b')](0x194);}return _0x239d34;};}function handleError(_0x2de366,_0xabf8fe){_0xabf8fe=_0xabf8fe||0x1f4;return function(_0x2291ba){logger['error'](_0x2291ba[_0x41b6('0x39')]);if(_0x2291ba[_0x41b6('0x3a')]){delete _0x2291ba[_0x41b6('0x3a')];}_0x2de366[_0x41b6('0x2c')](_0xabf8fe)[_0x41b6('0x3b')](_0x2291ba);};}exports[_0x41b6('0x3c')]=function(_0x434281,_0x565ff8){var _0x457919={'include':[{'model':db[_0x41b6('0x3d')],'as':_0x41b6('0x3e')}]},_0xaaa0b6={},_0x143288={'count':0x0,'rows':[]};var _0x158d55=_[_0x41b6('0x3f')](db[_0x41b6('0x40')][_0x41b6('0x41')],function(_0x33bf08){return{'name':_0x33bf08[_0x41b6('0x42')],'type':_0x33bf08[_0x41b6('0x43')]['key']};});_0xaaa0b6[_0x41b6('0x44')]=_[_0x41b6('0x3f')](_0x158d55,_0x41b6('0x3a'));_0xaaa0b6[_0x41b6('0x45')]=_[_0x41b6('0x46')](_0x434281[_0x41b6('0x45')]);_0xaaa0b6['filters']=_['intersection'](_0xaaa0b6[_0x41b6('0x44')],_0xaaa0b6[_0x41b6('0x45')]);_0x457919['attributes']=_['intersection'](_0xaaa0b6[_0x41b6('0x44')],qs[_0x41b6('0x47')](_0x434281[_0x41b6('0x45')]['fields']));_0x457919['attributes']=_0x457919[_0x41b6('0x48')]['length']?_0x457919[_0x41b6('0x48')]:_0xaaa0b6[_0x41b6('0x44')];if(!_0x434281[_0x41b6('0x45')][_0x41b6('0x49')](_0x41b6('0x4a'))){_0x457919['limit']=qs[_0x41b6('0x30')](_0x434281[_0x41b6('0x45')][_0x41b6('0x30')]);_0x457919[_0x41b6('0x2e')]=qs['offset'](_0x434281[_0x41b6('0x45')][_0x41b6('0x2e')]);}_0x457919[_0x41b6('0x4b')]=qs[_0x41b6('0x4c')](_0x434281[_0x41b6('0x45')][_0x41b6('0x4c')]);_0x457919[_0x41b6('0x4d')]=qs['filters'](_[_0x41b6('0x4e')](_0x434281['query'],_0xaaa0b6[_0x41b6('0x4f')]),_0x158d55);if(_0x434281[_0x41b6('0x45')]['filter']){_0x457919[_0x41b6('0x4d')]=_[_0x41b6('0x50')](_0x457919['where'],{'$or':_[_0x41b6('0x3f')](_0x158d55,function(_0x16bb9a){if(_0x16bb9a[_0x41b6('0x43')]!==_0x41b6('0x51')){var _0x1e4086={};_0x1e4086[_0x16bb9a['name']]={'$like':'%'+_0x434281[_0x41b6('0x45')][_0x41b6('0x52')]+'%'};return _0x1e4086;}})});}_0x457919=_[_0x41b6('0x50')]({},_0x457919,_0x434281['options']);var _0x1b519a={'where':_0x457919[_0x41b6('0x4d')]};return db[_0x41b6('0x40')][_0x41b6('0x31')](_0x1b519a)[_0x41b6('0x20')](function(_0x3bf131){_0x143288[_0x41b6('0x31')]=_0x3bf131;if(_0x434281['query']['includeAll']){_0x457919[_0x41b6('0x53')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x457919);})[_0x41b6('0x20')](function(_0x40a284){_0x143288[_0x41b6('0x54')]=_0x40a284;return _0x143288;})[_0x41b6('0x20')](respondWithFilteredResult(_0x565ff8,_0x457919))[_0x41b6('0x2a')](handleError(_0x565ff8,null));};exports[_0x41b6('0x55')]=function(_0x4a5c71,_0x288798){var _0x4f5c9a={'raw':![],'where':{'id':_0x4a5c71['params']['id']},'include':[{'model':db[_0x41b6('0x3d')],'as':_0x41b6('0x3e')}]},_0x439833={};_0x439833['model']=_[_0x41b6('0x46')](db[_0x41b6('0x40')][_0x41b6('0x41')]);_0x439833[_0x41b6('0x45')]=_[_0x41b6('0x46')](_0x4a5c71[_0x41b6('0x45')]);_0x439833[_0x41b6('0x4f')]=_[_0x41b6('0x56')](_0x439833[_0x41b6('0x44')],_0x439833[_0x41b6('0x45')]);_0x4f5c9a[_0x41b6('0x48')]=_[_0x41b6('0x56')](_0x439833[_0x41b6('0x44')],qs[_0x41b6('0x47')](_0x4a5c71[_0x41b6('0x45')][_0x41b6('0x47')]));_0x4f5c9a['attributes']=_0x4f5c9a['attributes']['length']?_0x4f5c9a[_0x41b6('0x48')]:_0x439833[_0x41b6('0x44')];if(_0x4a5c71[_0x41b6('0x45')][_0x41b6('0x57')]){_0x4f5c9a[_0x41b6('0x53')]=[{'all':!![]}];}_0x4f5c9a=_[_0x41b6('0x50')]({},_0x4f5c9a,_0x4a5c71[_0x41b6('0x58')]);return db[_0x41b6('0x40')][_0x41b6('0x59')](_0x4f5c9a)[_0x41b6('0x20')](handleEntityNotFound(_0x288798,null))['then'](respondWithResult(_0x288798,null))['catch'](handleError(_0x288798,null));};exports[_0x41b6('0x5a')]=function(_0x3a214c,_0x14a2ab){return db[_0x41b6('0x40')][_0x41b6('0x5a')](_0x3a214c[_0x41b6('0x5b')],{})[_0x41b6('0x20')](function(_0x1fe9b4){var _0x3db501=_0x3a214c[_0x41b6('0x5c')][_0x41b6('0x36')]({'plain':!![]});if(!_0x3db501)throw new Error(_0x41b6('0x5d'));if(_0x3db501['role']===_0x41b6('0x5c')){var _0x3ddb75=_0x1fe9b4[_0x41b6('0x36')]({'plain':!![]});var _0x10fa2d='OpenchannelAccounts';return db['UserProfileSection'][_0x41b6('0x59')]({'where':{'name':_0x10fa2d,'userProfileId':_0x3db501['userProfileId']},'raw':!![]})['then'](function(_0x4625eb){if(_0x4625eb&&_0x4625eb[_0x41b6('0x5e')]===0x0){return db[_0x41b6('0x38')][_0x41b6('0x5a')]({'name':_0x3ddb75[_0x41b6('0x3a')],'resourceId':_0x3ddb75['id'],'type':_0x4625eb[_0x41b6('0x3a')],'sectionId':_0x4625eb['id']},{})['then'](function(){return _0x1fe9b4;});}else{return _0x1fe9b4;}})[_0x41b6('0x2a')](function(_0x3b6854){logger['error'](_0x41b6('0x5f'),_0x3b6854);throw _0x3b6854;});}return _0x1fe9b4;})[_0x41b6('0x20')](respondWithResult(_0x14a2ab,0xc9))['catch'](handleError(_0x14a2ab,null));};exports[_0x41b6('0x34')]=function(_0x2222f6,_0x379d00){if(_0x2222f6[_0x41b6('0x5b')]['id']){delete _0x2222f6[_0x41b6('0x5b')]['id'];}return db[_0x41b6('0x40')][_0x41b6('0x59')]({'where':{'id':_0x2222f6[_0x41b6('0x60')]['id']},'include':[{'model':db[_0x41b6('0x3d')],'as':_0x41b6('0x3e')}]})['then'](handleEntityNotFound(_0x379d00,null))[_0x41b6('0x20')](saveUpdates(_0x2222f6[_0x41b6('0x5b')],null))[_0x41b6('0x20')](respondWithResult(_0x379d00,null))[_0x41b6('0x2a')](handleError(_0x379d00,null));};exports[_0x41b6('0x35')]=function(_0x25b2ac,_0x5e4924){return db[_0x41b6('0x40')][_0x41b6('0x59')]({'where':{'id':_0x25b2ac[_0x41b6('0x60')]['id']}})['then'](handleEntityNotFound(_0x5e4924,null))['then'](removeEntity(_0x5e4924,null))[_0x41b6('0x2a')](handleError(_0x5e4924,null));};exports[_0x41b6('0x61')]=function(_0x562206,_0x4f7ad0){return db[_0x41b6('0x40')]['describe']()[_0x41b6('0x20')](respondWithResult(_0x4f7ad0,null))[_0x41b6('0x2a')](handleError(_0x4f7ad0,null));};exports[_0x41b6('0x62')]=function(_0x55e915,_0x213f6a,_0x34d8f5){if(_0x55e915['body']['id']){delete _0x55e915[_0x41b6('0x5b')]['id'];}return db['OpenchannelAccount'][_0x41b6('0x59')]({'where':{'id':_0x55e915[_0x41b6('0x60')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x213f6a,null))[_0x41b6('0x20')](function(_0x2a7a85){if(_0x2a7a85){_0x55e915[_0x41b6('0x5b')]['OpenchannelAccountId']=_0x2a7a85['id'];return db['Disposition'][_0x41b6('0x5a')](_0x55e915['body']);}})[_0x41b6('0x20')](respondWithResult(_0x213f6a,null))[_0x41b6('0x2a')](handleError(_0x213f6a,null));};exports[_0x41b6('0x63')]=function(_0xf8cb1e,_0x49da03,_0x590194){var _0x6114dc={'raw':![],'where':{}};var _0x252244={};var _0x5c5941={'count':0x0,'rows':[]};return db[_0x41b6('0x40')][_0x41b6('0x64')]({'where':{'id':_0xf8cb1e['params']['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x49da03,null))[_0x41b6('0x20')](function(_0x3c30bc){if(_0x3c30bc){_0x252244[_0x41b6('0x44')]=_[_0x41b6('0x46')](db[_0x41b6('0x65')][_0x41b6('0x41')]);_0x252244['query']=_[_0x41b6('0x46')](_0xf8cb1e[_0x41b6('0x45')]);_0x252244[_0x41b6('0x4f')]=_[_0x41b6('0x56')](_0x252244[_0x41b6('0x44')],_0x252244['query']);_0x6114dc[_0x41b6('0x48')]=_[_0x41b6('0x56')](_0x252244[_0x41b6('0x44')],qs[_0x41b6('0x47')](_0xf8cb1e[_0x41b6('0x45')][_0x41b6('0x47')]));_0x6114dc[_0x41b6('0x48')]=_0x6114dc[_0x41b6('0x48')][_0x41b6('0x66')]?_0x6114dc[_0x41b6('0x48')]:_0x252244[_0x41b6('0x44')];if(!_0xf8cb1e[_0x41b6('0x45')][_0x41b6('0x49')](_0x41b6('0x4a'))){_0x6114dc['limit']=qs[_0x41b6('0x30')](_0xf8cb1e[_0x41b6('0x45')]['limit']);_0x6114dc[_0x41b6('0x2e')]=qs[_0x41b6('0x2e')](_0xf8cb1e[_0x41b6('0x45')]['offset']);}_0x6114dc[_0x41b6('0x4b')]=qs['sort'](_0xf8cb1e[_0x41b6('0x45')]['sort']);_0x6114dc[_0x41b6('0x4d')]=qs[_0x41b6('0x4f')](_[_0x41b6('0x4e')](_0xf8cb1e['query'],_0x252244[_0x41b6('0x4f')]));_0x6114dc['where'][_0x41b6('0x67')]=_0x3c30bc['id'];if(_0xf8cb1e[_0x41b6('0x45')]['filter']){_0x6114dc[_0x41b6('0x4d')]=_[_0x41b6('0x50')](_0x6114dc[_0x41b6('0x4d')],{'$or':_[_0x41b6('0x3f')](_0x6114dc[_0x41b6('0x48')],function(_0x266050){var _0x5b41c5={};_0x5b41c5[_0x266050]={'$like':'%'+_0xf8cb1e['query'][_0x41b6('0x52')]+'%'};return _0x5b41c5;})});}_0x6114dc=_['merge']({},_0x6114dc,_0xf8cb1e['options']);return db[_0x41b6('0x65')][_0x41b6('0x31')]({'where':_0x6114dc['where']})[_0x41b6('0x20')](function(_0x45f71d){_0x5c5941[_0x41b6('0x31')]=_0x45f71d;if(_0xf8cb1e[_0x41b6('0x45')][_0x41b6('0x57')]){_0x6114dc['include']=[{'all':!![]}];}return db['Disposition'][_0x41b6('0x68')](_0x6114dc);})[_0x41b6('0x20')](function(_0x18cff3){_0x5c5941[_0x41b6('0x54')]=_0x18cff3;return _0x5c5941;});}})['then'](respondWithFilteredResult(_0x49da03,_0x6114dc))['catch'](handleError(_0x49da03,null));};exports[_0x41b6('0x69')]=function(_0x46cd95,_0x44f3cd,_0xf2f00c){return db['OpenchannelAccount']['find']({'where':{'id':_0x46cd95[_0x41b6('0x60')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x44f3cd,null))[_0x41b6('0x20')](function(_0x31ec71){if(_0x31ec71){return _0x31ec71[_0x41b6('0x69')](_0x46cd95['query'][_0x41b6('0x6a')]);}})['then'](respondWithStatusCode(_0x44f3cd,null))[_0x41b6('0x2a')](handleError(_0x44f3cd,null));};exports[_0x41b6('0x6b')]=function(_0x32fcbf,_0x4da3f9,_0x4b5963){if(_0x32fcbf[_0x41b6('0x5b')]['id']){delete _0x32fcbf['body']['id'];}return db[_0x41b6('0x40')][_0x41b6('0x59')]({'where':{'id':_0x32fcbf['params']['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x4da3f9,null))[_0x41b6('0x20')](function(_0x2919b2){if(_0x2919b2){_0x32fcbf[_0x41b6('0x5b')]['OpenchannelAccountId']=_0x2919b2['id'];return db[_0x41b6('0x6c')][_0x41b6('0x5a')](_0x32fcbf[_0x41b6('0x5b')]);}})[_0x41b6('0x20')](respondWithResult(_0x4da3f9,null))[_0x41b6('0x2a')](handleError(_0x4da3f9,null));};exports[_0x41b6('0x6d')]=function(_0xf93d65,_0x50351a,_0x104edd){var _0x30283a={'raw':![],'where':{}};var _0x6afdc3={};var _0x50f0b5={'count':0x0,'rows':[]};return db[_0x41b6('0x40')]['findOne']({'where':{'id':_0xf93d65[_0x41b6('0x60')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x50351a,null))[_0x41b6('0x20')](function(_0x58cf3e){if(_0x58cf3e){_0x6afdc3['model']=_[_0x41b6('0x46')](db['CannedAnswer'][_0x41b6('0x41')]);_0x6afdc3[_0x41b6('0x45')]=_[_0x41b6('0x46')](_0xf93d65['query']);_0x6afdc3['filters']=_[_0x41b6('0x56')](_0x6afdc3['model'],_0x6afdc3[_0x41b6('0x45')]);_0x30283a[_0x41b6('0x48')]=_[_0x41b6('0x56')](_0x6afdc3['model'],qs[_0x41b6('0x47')](_0xf93d65['query'][_0x41b6('0x47')]));_0x30283a[_0x41b6('0x48')]=_0x30283a[_0x41b6('0x48')][_0x41b6('0x66')]?_0x30283a['attributes']:_0x6afdc3[_0x41b6('0x44')];if(!_0xf93d65[_0x41b6('0x45')][_0x41b6('0x49')](_0x41b6('0x4a'))){_0x30283a[_0x41b6('0x30')]=qs['limit'](_0xf93d65[_0x41b6('0x45')]['limit']);_0x30283a[_0x41b6('0x2e')]=qs[_0x41b6('0x2e')](_0xf93d65[_0x41b6('0x45')][_0x41b6('0x2e')]);}_0x30283a['order']=qs[_0x41b6('0x4c')](_0xf93d65['query'][_0x41b6('0x4c')]);_0x30283a[_0x41b6('0x4d')]=qs['filters'](_[_0x41b6('0x4e')](_0xf93d65[_0x41b6('0x45')],_0x6afdc3[_0x41b6('0x4f')]));_0x30283a[_0x41b6('0x4d')][_0x41b6('0x67')]=_0x58cf3e['id'];if(_0xf93d65[_0x41b6('0x45')][_0x41b6('0x52')]){_0x30283a['where']=_[_0x41b6('0x50')](_0x30283a[_0x41b6('0x4d')],{'$or':_[_0x41b6('0x3f')](_0x30283a[_0x41b6('0x48')],function(_0x1675f8){var _0x509913={};_0x509913[_0x1675f8]={'$like':'%'+_0xf93d65[_0x41b6('0x45')][_0x41b6('0x52')]+'%'};return _0x509913;})});}_0x30283a=_[_0x41b6('0x50')]({},_0x30283a,_0xf93d65[_0x41b6('0x58')]);return db[_0x41b6('0x6c')][_0x41b6('0x31')]({'where':_0x30283a[_0x41b6('0x4d')]})[_0x41b6('0x20')](function(_0x5439bb){_0x50f0b5[_0x41b6('0x31')]=_0x5439bb;if(_0xf93d65[_0x41b6('0x45')][_0x41b6('0x57')]){_0x30283a['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x41b6('0x68')](_0x30283a);})[_0x41b6('0x20')](function(_0x231453){_0x50f0b5['rows']=_0x231453;return _0x50f0b5;});}})[_0x41b6('0x20')](respondWithFilteredResult(_0x50351a,_0x30283a))[_0x41b6('0x2a')](handleError(_0x50351a,null));};exports[_0x41b6('0x6e')]=function(_0x18d81e,_0x4c709c,_0x2468c2){return db[_0x41b6('0x40')][_0x41b6('0x59')]({'where':{'id':_0x18d81e[_0x41b6('0x60')]['id']}})['then'](handleEntityNotFound(_0x4c709c,null))['then'](function(_0x3cd76b){if(_0x3cd76b){return _0x3cd76b[_0x41b6('0x6e')](_0x18d81e['query'][_0x41b6('0x6a')]);}})[_0x41b6('0x20')](respondWithStatusCode(_0x4c709c,null))[_0x41b6('0x2a')](handleError(_0x4c709c,null));};exports['notify']=function(_0x44f18b,_0x345378,_0x4b677c){var _0x2691ce={'body':_0x44f18b['body'],'channel':_0x41b6('0x6f')};var _0x361cbe=[];var _0x2d412a=[];var _0x70b12e={};var _0x497fb1=![];return db['CmContact'][_0x41b6('0x61')]()['then'](function(_0x4c8926){if(!_0x4c8926){throw new db['Sequelize'][(_0x41b6('0x70'))](_0x41b6('0x71'));}_0x361cbe=_[_0x41b6('0x72')](_['keys'](_0x4c8926),[_0x41b6('0x73'),_0x41b6('0x74')]);_0x2d412a=_['difference'](_[_0x41b6('0x46')](_0x4c8926),[_0x41b6('0x73'),'updatedAt',_0x41b6('0x75'),_0x41b6('0x76')]);if(_0x44f18b[_0x41b6('0x5b')]['id']){delete _0x44f18b[_0x41b6('0x5b')]['id'];}if(_[_0x41b6('0x77')](_0x44f18b[_0x41b6('0x5b')][_0x41b6('0x78')])){throw new db[(_0x41b6('0x79'))][(_0x41b6('0x70'))](_0x41b6('0x7a'));}if(_['isNil'](_0x44f18b['body'][_0x41b6('0x5b')])||_0x44f18b[_0x41b6('0x5b')][_0x41b6('0x5b')]===''){throw new db[(_0x41b6('0x79'))][(_0x41b6('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x41b6('0x77')](_0x44f18b['body'][_0x41b6('0x7b')])){throw new db[(_0x41b6('0x79'))][(_0x41b6('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d412a);}if(!_[_0x41b6('0x7c')](_0x2d412a,_0x44f18b[_0x41b6('0x5b')][_0x41b6('0x7b')])){throw new db['Sequelize'][(_0x41b6('0x70'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d412a);}_0x70b12e[_0x44f18b['body']['mapKey']]=_0x44f18b[_0x41b6('0x5b')][_0x41b6('0x78')];})[_0x41b6('0x20')](function(){return db[_0x41b6('0x40')][_0x41b6('0x59')]({'where':{'id':_0x44f18b['params']['id']},'include':[{'model':db['CmList'],'as':_0x41b6('0x7d'),'include':[{'model':db[_0x41b6('0x7e')],'as':_0x41b6('0x7f'),'where':_0x70b12e,'limit':0x1,'order':[[_0x41b6('0x74'),_0x41b6('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x41b6('0x81')}]});})[_0x41b6('0x20')](handleEntityNotFound(_0x345378,null))[_0x41b6('0x20')](function(_0x3508b2){if(_0x3508b2&&_0x3508b2['List']){_0x2691ce[_0x41b6('0x82')]=_0x3508b2;_0x2691ce[_0x41b6('0x83')]=_0x3508b2['Applications'];_0x2691ce[_0x41b6('0x84')]=_0x3508b2[_0x41b6('0x7d')];_0x2691ce[_0x41b6('0x83')]=_[_0x41b6('0x85')](_0x2691ce['applications'],[_0x41b6('0x86')],['asc']);if(_0x2691ce[_0x41b6('0x82')][_0x41b6('0x81')]){delete _0x2691ce[_0x41b6('0x82')][_0x41b6('0x81')];}if(_0x2691ce[_0x41b6('0x82')][_0x41b6('0x7d')]&&_0x2691ce[_0x41b6('0x82')][_0x41b6('0x7d')][_0x41b6('0x7f')][_0x41b6('0x66')]){return _0x2691ce[_0x41b6('0x82')]['List'][_0x41b6('0x7f')][0x0];}var _0x3477bf=_[_0x41b6('0x19')](_0x44f18b[_0x41b6('0x5b')],{'firstName':_0x44f18b[_0x41b6('0x5b')]['from'],'ListId':_0x3508b2[_0x41b6('0x76')]});_0x3477bf[_0x44f18b[_0x41b6('0x5b')]['mapKey']]=_0x44f18b['body'][_0x41b6('0x78')];return db[_0x41b6('0x7e')]['create'](_0x3477bf,{'fields':_0x361cbe,'raw':!![]});}})[_0x41b6('0x20')](handleEntityNotFound(_0x345378,null))[_0x41b6('0x20')](function(_0x508bd5){_0x2691ce[_0x41b6('0x87')]=_0x508bd5;if(_0x508bd5){var _0x9d446={'ContactId':_0x508bd5['id'],'OpenchannelAccountId':_0x44f18b['params']['id'],'from':(_0x508bd5['firstName']||'')+'\x20'+(_0x508bd5['lastName']||'')};var _0x1765a4={'OpenchannelAccountId':_0x44f18b[_0x41b6('0x60')]['id'],'closed':![]};if(_0x44f18b[_0x41b6('0x5b')][_0x41b6('0x88')]){_0x1765a4[_0x41b6('0x88')]=_0x44f18b[_0x41b6('0x5b')]['threadId'];return db['OpenchannelInteraction'][_0x41b6('0x59')]({'where':_0x1765a4})[_0x41b6('0x20')](function(_0x45bec0){if(_0x45bec0){return[_0x45bec0,![]];}_0x9d446[_0x41b6('0x88')]=_0x44f18b[_0x41b6('0x5b')][_0x41b6('0x88')];_0x9d446[_0x41b6('0x89')]=_0x44f18b['body'][_0x41b6('0x89')];return db['OpenchannelInteraction']['create'](_0x9d446)[_0x41b6('0x20')](function(_0xea6ca5){return[_0xea6ca5,!![]];});});}else{_0x1765a4['threadId']=null;}_0x1765a4[_0x41b6('0x8a')]=_0x508bd5['id'];return db[_0x41b6('0x8b')][_0x41b6('0x59')]({'where':_0x1765a4})['then'](function(_0x973bb8){if(_0x973bb8){return[_0x973bb8,![]];}return db[_0x41b6('0x8b')][_0x41b6('0x5a')](_0x9d446)[_0x41b6('0x20')](function(_0x4fd755){return[_0x4fd755,!![]];});});}})[_0x41b6('0x8c')](function(_0x3f7f36,_0x21b95f){if(_0x3f7f36){_0x497fb1=_0x21b95f;if(!_0x21b95f){var _0xf4daba={'from':(_0x2691ce[_0x41b6('0x87')]['firstName']||'')+'\x20'+(_0x2691ce[_0x41b6('0x87')][_0x41b6('0x8d')]||'')};if(_0x44f18b[_0x41b6('0x5b')][_0x41b6('0x88')]&&_0x44f18b[_0x41b6('0x5b')][_0x41b6('0x8e')]&&_0x44f18b['body']['threadId']!=_0x44f18b['body'][_0x41b6('0x8e')]){_0xf4daba[_0x41b6('0x88')]=_0x44f18b['body']['messageId'];}return _0x3f7f36[_0x41b6('0x34')](_0xf4daba);}else{return _0x3f7f36;}}})[_0x41b6('0x20')](function(_0x2a72cf){_0x2691ce[_0x41b6('0x8f')]=_0x2a72cf[_0x41b6('0x36')]({'plain':!![]});_0x2691ce[_0x41b6('0x8f')][_0x41b6('0x90')]=_0x497fb1;if(_0x2691ce[_0x41b6('0x8f')][_0x41b6('0x90')]){if(_0x2691ce[_0x41b6('0x82')][_0x41b6('0x91')]){_0x2691ce[_0x41b6('0x83')][_0x41b6('0x92')]({'id':0x0,'priority':_0x2691ce[_0x41b6('0x83')][_0x41b6('0x66')]+0x1,'app':_0x41b6('0x93'),'appdata':_0x41b6('0x94'),'interval':_0x41b6('0x95')});}}return db[_0x41b6('0x96')][_0x41b6('0x5a')]({'body':_0x44f18b['body'][_0x41b6('0x5b')],'OpenchannelAccountId':_0x44f18b[_0x41b6('0x60')]['id'],'OpenchannelInteractionId':_0x2a72cf['id'],'direction':'in','ContactId':_0x2691ce['contact']['id'],'AttachmentId':_0x44f18b['body'][_0x41b6('0x97')]});})[_0x41b6('0x20')](function(_0x30475e){_0x2691ce[_0x41b6('0x26')]=_0x30475e;if(!_0x2691ce['interaction'][_0x41b6('0x98')])return;return db[_0x41b6('0x99')][_0x41b6('0x59')]({'attributes':['id',_0x41b6('0x3a')],'where':{'id':_0x2691ce[_0x41b6('0x8f')][_0x41b6('0x98')]}});})[_0x41b6('0x20')](function(_0x230c16){if(_0x230c16){_0x2691ce[_0x41b6('0x83')][_0x41b6('0x9a')]({'id':0x0,'priority':0x0,'app':_0x41b6('0x9b'),'appdata':_0x230c16[_0x41b6('0x3a')]+','+(_0x2691ce[_0x41b6('0x82')][_0x41b6('0x9c')]||0xa),'interval':_0x41b6('0x95')});}if(!_0x2691ce[_0x41b6('0x8f')][_0x41b6('0x9d')])return;return db['OpenchannelQueue']['find']({'attributes':['id',_0x41b6('0x3a')],'where':{'id':_0x2691ce['interaction'][_0x41b6('0x9d')]}});})['then'](function(_0x1afebb){if(_0x1afebb){_0x2691ce[_0x41b6('0x83')][_0x41b6('0x9a')]({'id':0x0,'priority':0x1,'app':_0x41b6('0x9e'),'appdata':_0x1afebb['name']+','+(_0x2691ce['account'][_0x41b6('0x9f')]||0x12c),'interval':_0x41b6('0x95')});}return respondWithRpcPromise(_0x41b6('0xa0'),_0x41b6('0xa1'),_0x2691ce);})[_0x41b6('0x20')](function(_0x16b82c){respondWithRpcPromise('EventManager',_0x41b6('0xa2'),{'event':'notify','message':_0x16b82c},client9002);return _0x16b82c;})[_0x41b6('0x20')](respondWithResult(_0x345378,null))[_0x41b6('0x2a')](handleError(_0x345378,null));};exports['addApplications']=function(_0x1ff800,_0x16c17e){var _0x28a94c=_0x1ff800[_0x41b6('0x60')]['id'];var _0x183183=_0x1ff800['body'];var _0x3acac1=0xc8;var _0x1ed98c=null;return db[_0x41b6('0xa3')][_0x41b6('0xa4')]({'isolationLevel':db[_0x41b6('0xa3')][_0x41b6('0xa5')][_0x41b6('0xa6')][_0x41b6('0xa7')]},function(_0x3a6e0e){return db[_0x41b6('0x40')][_0x41b6('0x64')]({'where':{'id':_0x28a94c},'transaction':_0x3a6e0e})[_0x41b6('0x20')](function(_0x3f7ce4){if(_0x3f7ce4){return db[_0x41b6('0xa8')]['destroy']({'where':{'OpenchannelAccountId':_0x28a94c},'transaction':_0x3a6e0e})[_0x41b6('0x20')](function(){var _0x39bcbe=_[_0x41b6('0x3f')](_0x183183,function(_0x289841){_0x289841['OpenchannelAccountId']=_0x28a94c;return _0x289841;});return db[_0x41b6('0xa8')]['bulkCreate'](_0x39bcbe,{'transaction':_0x3a6e0e});});}else{_0x3acac1=0x194;_0x1ed98c=[];}});})['then'](function(){if(_0x3acac1!==0x194){return db[_0x41b6('0xa8')][_0x41b6('0xa9')]({'where':{'OpenchannelAccountId':_0x28a94c},'order':'priority'})[_0x41b6('0x20')](function(_0x597c34){_0x1ed98c=_0x597c34;});}})[_0x41b6('0x2a')](function(_0x543d69){_0x3acac1=0x1f4;logger[_0x41b6('0x24')](_0x543d69[_0x41b6('0x39')]);if(_0x543d69[_0x41b6('0x3a')]){delete _0x543d69[_0x41b6('0x3a')];}_0x1ed98c=_0x543d69;})[_0x41b6('0xaa')](function(){if(_0x1ed98c===null){_0x16c17e['sendStatus'](_0x3acac1);}else{if(_0x3acac1===0x1f4){_0x16c17e['status'](_0x3acac1)[_0x41b6('0x3b')](_0x1ed98c);}else{_0x16c17e[_0x41b6('0x2c')](_0x3acac1)['json'](_0x1ed98c);}}});};exports[_0x41b6('0xab')]=function(_0x11f754,_0x36bcf2,_0x53cdf2){var _0x3e5bff={};var _0x594833={};var _0x2ed255;var _0x1b7180;return db[_0x41b6('0x40')]['findOne']({'where':{'id':_0x11f754[_0x41b6('0x60')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x36bcf2,null))[_0x41b6('0x20')](function(_0x3477dc){if(_0x3477dc){_0x2ed255=_0x3477dc;_0x594833[_0x41b6('0x44')]=_['keys'](db['OpenchannelApplication'][_0x41b6('0x41')]);_0x594833[_0x41b6('0x45')]=_[_0x41b6('0x46')](_0x11f754[_0x41b6('0x45')]);_0x594833[_0x41b6('0x4f')]=_[_0x41b6('0x56')](_0x594833[_0x41b6('0x44')],_0x594833['query']);_0x3e5bff[_0x41b6('0x48')]=_[_0x41b6('0x56')](_0x594833[_0x41b6('0x44')],qs[_0x41b6('0x47')](_0x11f754[_0x41b6('0x45')]['fields']));_0x3e5bff['attributes']=_0x3e5bff[_0x41b6('0x48')][_0x41b6('0x66')]?_0x3e5bff['attributes']:_0x594833['model'];_0x3e5bff[_0x41b6('0x4b')]=qs[_0x41b6('0x4c')](_0x11f754[_0x41b6('0x45')][_0x41b6('0x4c')]);_0x3e5bff[_0x41b6('0x4d')]=qs['filters'](_[_0x41b6('0x4e')](_0x11f754[_0x41b6('0x45')],_0x594833[_0x41b6('0x4f')]));if(_0x11f754[_0x41b6('0x45')][_0x41b6('0x52')]){_0x3e5bff[_0x41b6('0x4d')]=_[_0x41b6('0x50')](_0x3e5bff[_0x41b6('0x4d')],{'$or':_['map'](_0x3e5bff[_0x41b6('0x48')],function(_0xe07b64){var _0x1a2881={};_0x1a2881[_0xe07b64]={'$like':'%'+_0x11f754['query']['filter']+'%'};return _0x1a2881;})});}_0x3e5bff=_[_0x41b6('0x50')]({},_0x3e5bff,_0x11f754[_0x41b6('0x58')]);return _0x2ed255[_0x41b6('0xab')](_0x3e5bff);}})[_0x41b6('0x20')](function(_0x2f08d6){if(_0x2f08d6){_0x1b7180=_0x2f08d6['length'];if(!_0x11f754[_0x41b6('0x45')][_0x41b6('0x49')]('nolimit')){_0x3e5bff[_0x41b6('0x30')]=qs[_0x41b6('0x30')](_0x11f754[_0x41b6('0x45')][_0x41b6('0x30')]);_0x3e5bff[_0x41b6('0x2e')]=qs[_0x41b6('0x2e')](_0x11f754[_0x41b6('0x45')][_0x41b6('0x2e')]);}return _0x2ed255[_0x41b6('0xab')](_0x3e5bff);}})['then'](function(_0x25989f){if(_0x25989f){return _0x25989f?{'count':_0x1b7180,'rows':_0x25989f}:null;}})[_0x41b6('0x20')](respondWithResult(_0x36bcf2,null))[_0x41b6('0x2a')](handleError(_0x36bcf2,null));};exports['getInteractions']=function(_0x29cc4a,_0x49e169,_0x4f6122){var _0xe71ef3={'raw':![],'where':{}};var _0x16cd98={};var _0x3ad34e={'count':0x0,'rows':[]};return db[_0x41b6('0x40')][_0x41b6('0x64')]({'where':{'id':_0x29cc4a[_0x41b6('0x60')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x49e169,null))['then'](function(_0x30862b){if(_0x30862b){_0x16cd98[_0x41b6('0x44')]=_[_0x41b6('0x46')](db['OpenchannelInteraction'][_0x41b6('0x41')]);_0x16cd98[_0x41b6('0x45')]=_[_0x41b6('0x46')](_0x29cc4a[_0x41b6('0x45')]);_0x16cd98[_0x41b6('0x4f')]=_[_0x41b6('0x56')](_0x16cd98[_0x41b6('0x44')],_0x16cd98[_0x41b6('0x45')]);_0xe71ef3['attributes']=_['intersection'](_0x16cd98[_0x41b6('0x44')],qs[_0x41b6('0x47')](_0x29cc4a[_0x41b6('0x45')][_0x41b6('0x47')]));_0xe71ef3[_0x41b6('0x48')]=_0xe71ef3[_0x41b6('0x48')][_0x41b6('0x66')]?_0xe71ef3[_0x41b6('0x48')]:_0x16cd98['model'];if(!_0x29cc4a[_0x41b6('0x45')][_0x41b6('0x49')]('nolimit')){_0xe71ef3['limit']=qs['limit'](_0x29cc4a[_0x41b6('0x45')][_0x41b6('0x30')]);_0xe71ef3[_0x41b6('0x2e')]=qs['offset'](_0x29cc4a[_0x41b6('0x45')][_0x41b6('0x2e')]);}_0xe71ef3['order']=qs['sort'](_0x29cc4a[_0x41b6('0x45')][_0x41b6('0x4c')]);_0xe71ef3['where']=qs[_0x41b6('0x4f')](_[_0x41b6('0x4e')](_0x29cc4a['query'],_0x16cd98[_0x41b6('0x4f')]));_0xe71ef3['where'][_0x41b6('0x67')]=_0x30862b['id'];if(_0x29cc4a[_0x41b6('0x45')][_0x41b6('0x52')]){_0xe71ef3['where']=_[_0x41b6('0x50')](_0xe71ef3[_0x41b6('0x4d')],{'$or':_['map'](_0xe71ef3[_0x41b6('0x48')],function(_0x220f31){var _0x292525={};_0x292525[_0x220f31]={'$like':'%'+_0x29cc4a[_0x41b6('0x45')][_0x41b6('0x52')]+'%'};return _0x292525;})});}_0xe71ef3=_[_0x41b6('0x50')]({},_0xe71ef3,_0x29cc4a['options']);return db[_0x41b6('0x8b')][_0x41b6('0x31')]({'where':_0xe71ef3[_0x41b6('0x4d')]})[_0x41b6('0x20')](function(_0x58b92d){_0x3ad34e['count']=_0x58b92d;if(_0x29cc4a[_0x41b6('0x45')]['includeAll']){_0xe71ef3['include']=[{'model':db[_0x41b6('0x7e')],'as':_0x41b6('0xac'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x41b6('0xad'),_0x41b6('0xae')],'required':![]},{'model':db[_0x41b6('0xaf')],'as':_0x41b6('0xb0'),'attributes':['id','name',_0x41b6('0xb1')],'where':_0x29cc4a[_0x41b6('0x45')][_0x41b6('0xb2')]?{'id':_0x29cc4a['query'][_0x41b6('0xb2')]}:undefined,'required':_0x29cc4a[_0x41b6('0x45')][_0x41b6('0xb2')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x41b6('0x68')](_0xe71ef3);})[_0x41b6('0x20')](function(_0x2f5fdc){_0x3ad34e['rows']=_0x2f5fdc;return _0x3ad34e;});}})['then'](respondWithFilteredResult(_0x49e169,_0xe71ef3))['catch'](handleError(_0x49e169,null));};exports[_0x41b6('0xb3')]=function(_0x498c8f,_0x55b5ad,_0xd5e17d){return db[_0x41b6('0x40')][_0x41b6('0x59')]({'where':{'id':_0x498c8f[_0x41b6('0x60')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x55b5ad,null))[_0x41b6('0x20')](function(_0xb0d181){if(_0xb0d181){return _0xb0d181[_0x41b6('0xb3')](_0x498c8f['body']['ids'],_['omit'](_0x498c8f[_0x41b6('0x5b')],['ids','id'])||{})[_0x41b6('0x8c')](function(_0xa0fb1){for(var _0x558ae2=0x0;_0x558ae2<_0x498c8f[_0x41b6('0x5b')][_0x41b6('0x6a')][_0x41b6('0x66')];_0x558ae2+=0x1){socket[_0x41b6('0xb4')](_0x41b6('0xb5'),{'UserId':Number(_0x498c8f['body'][_0x41b6('0x6a')][_0x558ae2]),'OpenchannelAccountId':Number(_0x498c8f[_0x41b6('0x60')]['id'])});}return _0xa0fb1;});}})['then'](respondWithResult(_0x55b5ad,null))[_0x41b6('0x2a')](handleError(_0x55b5ad,null));};exports[_0x41b6('0xb6')]=function(_0x1814fe,_0x4c05c3,_0x43de91){return db[_0x41b6('0x40')][_0x41b6('0x59')]({'where':{'id':_0x1814fe['params']['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x4c05c3,null))[_0x41b6('0x20')](function(_0x536930){if(_0x536930){return _0x536930[_0x41b6('0xb6')](_0x1814fe[_0x41b6('0x45')][_0x41b6('0x6a')])[_0x41b6('0x20')](function(){if(_['isArray'](_0x1814fe['query']['ids'])){for(var _0x18dd60=0x0;_0x18dd60<_0x1814fe['query'][_0x41b6('0x6a')]['length'];_0x18dd60+=0x1){socket[_0x41b6('0xb4')](_0x41b6('0xb7'),{'UserId':Number(_0x1814fe['query'][_0x41b6('0x6a')][_0x18dd60]),'OpenchannelAccountId':Number(_0x1814fe['params']['id'])});}}else{socket[_0x41b6('0xb4')](_0x41b6('0xb7'),{'UserId':Number(_0x1814fe[_0x41b6('0x45')][_0x41b6('0x6a')]),'OpenchannelAccountId':Number(_0x1814fe[_0x41b6('0x60')]['id'])});}});}})[_0x41b6('0x20')](respondWithStatusCode(_0x4c05c3,null))[_0x41b6('0x2a')](handleError(_0x4c05c3,null));};exports[_0x41b6('0xb8')]=function(_0x4ec7d7,_0x2e27bf,_0x526bd3){var _0x16b819={};var _0x271c8b={};var _0x2be402;var _0x3b873c;return db[_0x41b6('0x40')][_0x41b6('0x64')]({'where':{'id':_0x4ec7d7[_0x41b6('0x60')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x2e27bf,null))[_0x41b6('0x20')](function(_0x19df70){if(_0x19df70){_0x2be402=_0x19df70;_0x271c8b[_0x41b6('0x44')]=_[_0x41b6('0x46')](db[_0x41b6('0x99')][_0x41b6('0x41')]);_0x271c8b[_0x41b6('0x45')]=_['keys'](_0x4ec7d7[_0x41b6('0x45')]);_0x271c8b[_0x41b6('0x4f')]=_[_0x41b6('0x56')](_0x271c8b[_0x41b6('0x44')],_0x271c8b[_0x41b6('0x45')]);_0x16b819[_0x41b6('0x48')]=_[_0x41b6('0x56')](_0x271c8b[_0x41b6('0x44')],qs[_0x41b6('0x47')](_0x4ec7d7[_0x41b6('0x45')][_0x41b6('0x47')]));_0x16b819[_0x41b6('0x48')]=_0x16b819[_0x41b6('0x48')]['length']?_0x16b819[_0x41b6('0x48')]:_0x271c8b[_0x41b6('0x44')];_0x16b819[_0x41b6('0x4b')]=qs[_0x41b6('0x4c')](_0x4ec7d7[_0x41b6('0x45')][_0x41b6('0x4c')]);_0x16b819[_0x41b6('0x4d')]=qs['filters'](_[_0x41b6('0x4e')](_0x4ec7d7[_0x41b6('0x45')],_0x271c8b['filters']));if(_0x4ec7d7[_0x41b6('0x45')][_0x41b6('0x52')]){_0x16b819[_0x41b6('0x4d')]=_['merge'](_0x16b819[_0x41b6('0x4d')],{'$or':_[_0x41b6('0x3f')](_0x16b819[_0x41b6('0x48')],function(_0x512f00){var _0x551b77={};_0x551b77[_0x512f00]={'$like':'%'+_0x4ec7d7[_0x41b6('0x45')][_0x41b6('0x52')]+'%'};return _0x551b77;})});}_0x16b819=_[_0x41b6('0x50')]({},_0x16b819,_0x4ec7d7[_0x41b6('0x58')]);return _0x2be402[_0x41b6('0xb8')](_0x16b819);}})[_0x41b6('0x20')](function(_0x2b24b5){if(_0x2b24b5){_0x3b873c=_0x2b24b5[_0x41b6('0x66')];if(!_0x4ec7d7[_0x41b6('0x45')]['hasOwnProperty']('nolimit')){_0x16b819[_0x41b6('0x30')]=qs[_0x41b6('0x30')](_0x4ec7d7[_0x41b6('0x45')][_0x41b6('0x30')]);_0x16b819[_0x41b6('0x2e')]=qs[_0x41b6('0x2e')](_0x4ec7d7[_0x41b6('0x45')][_0x41b6('0x2e')]);}return _0x2be402[_0x41b6('0xb8')](_0x16b819);}})[_0x41b6('0x20')](function(_0x12304b){if(_0x12304b){return _0x12304b?{'count':_0x3b873c,'rows':_0x12304b}:null;}})[_0x41b6('0x20')](respondWithResult(_0x2e27bf,null))[_0x41b6('0x2a')](handleError(_0x2e27bf,null));};exports[_0x41b6('0x3b')]=function(_0x454cd3,_0xcc506c,_0x4cfdd0){var _0x10da9a,_0x27f3dc,_0x2bf684;if(_['isNil'](_0x454cd3[_0x41b6('0x5b')]['body'])||_0x454cd3['body'][_0x41b6('0x5b')]===''){throw new db['Sequelize'][(_0x41b6('0x70'))](_0x41b6('0xb9'));}if(_[_0x41b6('0x77')](_0x454cd3[_0x41b6('0x5b')]['to'])){}_0x10da9a=_0x454cd3['body']['to'];return db[_0x41b6('0x40')][_0x41b6('0x64')]({'where':{'id':_0x454cd3[_0x41b6('0x60')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0xcc506c,null))['then'](function(_0x7c2a3){if(_0x7c2a3){return db[_0x41b6('0x40')]['find']({'where':{'id':_0x7c2a3['id']},'include':[{'model':db[_0x41b6('0xba')],'as':_0x41b6('0x7d'),'include':[{'model':db[_0x41b6('0x7e')],'as':_0x41b6('0x7f'),'where':{[_0x7c2a3['mapKey']]:_0x10da9a},'limit':0x1,'order':[[_0x41b6('0x74'),_0x41b6('0x80')]]}]}]})['then'](handleEntityNotFound(_0xcc506c,null))[_0x41b6('0x20')](function(_0x58e22d){if(_0x58e22d&&_0x58e22d[_0x41b6('0x7d')]){_0x27f3dc=_0x58e22d[_0x41b6('0x36')]({'plain':!![]});if(_0x27f3dc[_0x41b6('0x7d')]&&_0x27f3dc[_0x41b6('0x7d')][_0x41b6('0x7f')][_0x41b6('0x66')]){return _0x27f3dc[_0x41b6('0x7d')][_0x41b6('0x7f')][0x0];}return db[_0x41b6('0x7e')]['create'](_[_0x41b6('0x19')](_0x454cd3['body'],{'firstName':_0x10da9a,[_0x58e22d[_0x41b6('0x7b')]]:_0x10da9a,'phone':_0x10da9a,'ListId':_0x27f3dc[_0x41b6('0x76')]}));}})[_0x41b6('0x20')](handleEntityNotFound(_0xcc506c,null))[_0x41b6('0x20')](function(_0x594261){if(_0x594261){_0x2bf684=_0x594261;return db[_0x41b6('0x8b')][_0x41b6('0x59')]({'where':{'ContactId':_0x2bf684['id'],'closed':![],'OpenchannelAccountId':_0x27f3dc['id']}})['then'](function(_0x4d11d1){if(_0x4d11d1){return[_0x4d11d1,![]];}return db[_0x41b6('0x8b')][_0x41b6('0x5a')]({'UserId':_0x454cd3['user']['id'],'ContactId':_0x2bf684['id'],'OpenchannelAccountId':_0x27f3dc['id'],'lastMsgDirection':'out','firstMsgDirection':_0x41b6('0xbb'),'Messages':[_['merge'](_0x454cd3[_0x41b6('0x5b')],{'read':![],'body':_0x454cd3[_0x41b6('0x5b')][_0x41b6('0x5b')],'OpenchannelAccountId':_0x27f3dc['id'],'UserId':_0x454cd3[_0x41b6('0x5c')]['id'],'ContactId':_0x2bf684['id']})]},{'include':[{'model':db[_0x41b6('0x96')],'as':_0x41b6('0xbc')}]})['then'](function(_0x169652){return[_0x169652,!![]];});});}})['spread'](function(_0xe95961,_0xba1f1f){if(_0xba1f1f){return _0xe95961;}return db[_0x41b6('0x96')][_0x41b6('0x5a')](_['merge'](_0x454cd3[_0x41b6('0x5b')],{'read':![],'body':_0x454cd3[_0x41b6('0x5b')][_0x41b6('0x5b')],'OpenchannelAccountId':_0x27f3dc['id'],'OpenchannelInteractionId':_0xe95961['id'],'UserId':_0x454cd3[_0x41b6('0x5c')]['id'],'ContactId':_0x2bf684['id']}))[_0x41b6('0x20')](function(_0x38c43c){_0xe95961[_0x41b6('0xbd')][_0x41b6('0xbc')]=[];_0xe95961['dataValues'][_0x41b6('0xbc')][_0x41b6('0x92')](_0x38c43c['dataValues']);return _0xe95961;});});}})['then'](respondWithResult(_0xcc506c,null))[_0x41b6('0x2a')](handleError(_0xcc506c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 97ca69b..accacea 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 _0xbdb7=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x5223a4,_0x5f477e){var _0x5ac416=function(_0x1e9f4e){while(--_0x1e9f4e){_0x5223a4['push'](_0x5223a4['shift']());}};_0x5ac416(++_0x5f477e);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x18b20e,_0x46903c){_0x18b20e=_0x18b20e-0x0;var _0xadd3a9=_0xbdb7[_0x18b20e];return _0xadd3a9;};'use strict';var EventEmitter=require(_0x7bdb('0x0'));var OpenchannelAccount=require(_0x7bdb('0x1'))['db'][_0x7bdb('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7bdb('0x3')](0x0);var events={'afterCreate':_0x7bdb('0x4'),'afterUpdate':_0x7bdb('0x5'),'afterDestroy':_0x7bdb('0x6')};function emitEvent(_0x2c7e07){return function(_0x46c068,_0x47aec5,_0x28542c){OpenchannelAccountEvents['emit'](_0x2c7e07+':'+_0x46c068['id'],_0x46c068);OpenchannelAccountEvents['emit'](_0x2c7e07,_0x46c068);_0x28542c(null);};}for(var e in events){if(events[_0x7bdb('0x7')](e)){var event=events[e];OpenchannelAccount[_0x7bdb('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x6324=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit'];(function(_0x296631,_0x2179ea){var _0x361f69=function(_0x469b11){while(--_0x469b11){_0x296631['push'](_0x296631['shift']());}};_0x361f69(++_0x2179ea);}(_0x6324,0x142));var _0x4632=function(_0x312484,_0x2605e6){_0x312484=_0x312484-0x0;var _0x5035e8=_0x6324[_0x312484];return _0x5035e8;};'use strict';var EventEmitter=require(_0x4632('0x0'));var OpenchannelAccount=require(_0x4632('0x1'))['db'][_0x4632('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4632('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4632('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3bea40){return function(_0x54c200,_0x13b218,_0x592e39){OpenchannelAccountEvents[_0x4632('0x5')](_0x3bea40+':'+_0x54c200['id'],_0x54c200);OpenchannelAccountEvents[_0x4632('0x5')](_0x3bea40,_0x54c200);_0x592e39(null);};}for(var e in events){if(events[_0x4632('0x6')](e)){var event=events[e];OpenchannelAccount[_0x4632('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4e30627..960b6ac 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(_0x192124,_0x1629fc){var _0x111d15=function(_0x16d10a){while(--_0x16d10a){_0x192124['push'](_0x192124['shift']());}};_0x111d15(++_0x1629fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x15b4a7,_0x1ce038){var _0x4d0ec3=function(_0x7062dd){while(--_0x7062dd){_0x15b4a7['push'](_0x15b4a7['shift']());}};_0x4d0ec3(++_0x1ce038);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 694c299..9772647 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 _0x4746=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4746,0xc6));var _0x6474=function(_0x48157b,_0x3dd91e){_0x48157b=_0x48157b-0x0;var _0x23e206=_0x4746[_0x48157b];return _0x23e206;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var moment=require('moment');var BPromise=require(_0x6474('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6474('0x3'));var db=require(_0x6474('0x4'))['db'];var utils=require(_0x6474('0x5'));var logger=require(_0x6474('0x6'))(_0x6474('0x7'));var config=require('../../config/environment');var jayson=require(_0x6474('0x8'));var client=jayson[_0x6474('0x9')]['http']({'port':0x232a});config[_0x6474('0xa')]=_[_0x6474('0xb')](config[_0x6474('0xa')],{'host':_0x6474('0xc'),'port':0x18eb});var socket=require(_0x6474('0xd'))(new Redis(config[_0x6474('0xa')]));require('./openchannelAccount.socket')[_0x6474('0xe')](socket);function respondWithRpcPromise(_0x5bbee1,_0x5335ac,_0x347697){return new BPromise(function(_0x1a202c,_0x4c970d){return client[_0x6474('0xf')](_0x5bbee1,_0x347697)['then'](function(_0x212cda){logger['info'](_0x6474('0x10'),_0x5335ac,_0x6474('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5335ac,'request\x20sent',JSON[_0x6474('0x12')](_0x212cda));if(_0x212cda[_0x6474('0x13')]){if(_0x212cda[_0x6474('0x13')][_0x6474('0x14')]===0x1f4){logger[_0x6474('0x13')](_0x6474('0x10'),_0x5335ac,_0x212cda[_0x6474('0x13')][_0x6474('0x15')]);return _0x4c970d(_0x212cda[_0x6474('0x13')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5335ac,_0x212cda[_0x6474('0x13')][_0x6474('0x15')]);return _0x1a202c(_0x212cda[_0x6474('0x13')][_0x6474('0x15')]);}else{logger[_0x6474('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5335ac,_0x6474('0x11'));_0x1a202c(_0x212cda[_0x6474('0x17')][_0x6474('0x15')]);}})[_0x6474('0x18')](function(_0x17a086){logger[_0x6474('0x13')](_0x6474('0x10'),_0x5335ac,_0x17a086);_0x4c970d(_0x17a086);});});} \ No newline at end of file +var _0x2884=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x14a34a,_0x424129){var _0x4d921e=function(_0x1982be){while(--_0x1982be){_0x14a34a['push'](_0x14a34a['shift']());}};_0x4d921e(++_0x424129);}(_0x2884,0x1eb));var _0x4288=function(_0x22766f,_0x577e75){_0x22766f=_0x22766f-0x0;var _0x5e0773=_0x2884[_0x22766f];return _0x5e0773;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4288('0x9')](config['redis'],{'host':_0x4288('0xa'),'port':0x18eb});var socket=require(_0x4288('0xb'))(new Redis(config['redis']));require(_0x4288('0xc'))[_0x4288('0xd')](socket);function respondWithRpcPromise(_0x41794a,_0x55c9ee,_0x55a4f7){return new BPromise(function(_0x5c0e2d,_0x42a234){return client[_0x4288('0xe')](_0x41794a,_0x55a4f7)[_0x4288('0xf')](function(_0x2445eb){logger[_0x4288('0x10')](_0x4288('0x11'),_0x55c9ee,'request\x20sent');logger[_0x4288('0x12')](_0x4288('0x13'),_0x55c9ee,_0x4288('0x14'),JSON[_0x4288('0x15')](_0x2445eb));if(_0x2445eb['error']){if(_0x2445eb[_0x4288('0x16')][_0x4288('0x17')]===0x1f4){logger['error'](_0x4288('0x11'),_0x55c9ee,_0x2445eb['error'][_0x4288('0x18')]);return _0x42a234(_0x2445eb['error'][_0x4288('0x18')]);}logger[_0x4288('0x16')](_0x4288('0x11'),_0x55c9ee,_0x2445eb[_0x4288('0x16')][_0x4288('0x18')]);return _0x5c0e2d(_0x2445eb[_0x4288('0x16')][_0x4288('0x18')]);}else{logger[_0x4288('0x10')](_0x4288('0x11'),_0x55c9ee,'request\x20sent');_0x5c0e2d(_0x2445eb[_0x4288('0x19')][_0x4288('0x18')]);}})['catch'](function(_0x479d52){logger['error'](_0x4288('0x11'),_0x55c9ee,_0x479d52);_0x42a234(_0x479d52);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 4ef7a32..3e49cb5 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 _0x5d70=['openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener','register'];(function(_0x56e124,_0x1ca566){var _0x2e0f7f=function(_0x590fdb){while(--_0x590fdb){_0x56e124['push'](_0x56e124['shift']());}};_0x2e0f7f(++_0x1ca566);}(_0x5d70,0x8d));var _0x05d7=function(_0x24cc96,_0x12721e){_0x24cc96=_0x24cc96-0x0;var _0x3d21da=_0x5d70[_0x24cc96];return _0x3d21da;};'use strict';var OpenchannelAccountEvents=require(_0x05d7('0x0'));var events=[_0x05d7('0x1'),'remove',_0x05d7('0x2')];function createListener(_0x39cab8,_0x164bf9){return function(_0x126236){_0x164bf9[_0x05d7('0x3')](_0x39cab8,_0x126236);};}function removeListener(_0x2a2455,_0x5c9e70){return function(){OpenchannelAccountEvents[_0x05d7('0x4')](_0x2a2455,_0x5c9e70);};}exports[_0x05d7('0x5')]=function(_0x416de3){for(var _0x2fe205=0x0,_0x4b155c=events['length'];_0x2fe205<_0x4b155c;_0x2fe205++){var _0x1e1254=events[_0x2fe205];var _0x29a5e0=createListener(_0x05d7('0x6')+_0x1e1254,_0x416de3);OpenchannelAccountEvents['on'](_0x1e1254,_0x29a5e0);}}; \ No newline at end of file +var _0xc39c=['length','openchannelAccount:','save','remove','update','emit','removeListener','register'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc39c,0xd2));var _0xcc39=function(_0x6070d0,_0x3c6da7){_0x6070d0=_0x6070d0-0x0;var _0x5a899a=_0xc39c[_0x6070d0];return _0x5a899a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xcc39('0x0'),_0xcc39('0x1'),_0xcc39('0x2')];function createListener(_0x5d885b,_0x6c204c){return function(_0x29b2e2){_0x6c204c[_0xcc39('0x3')](_0x5d885b,_0x29b2e2);};}function removeListener(_0x5bc333,_0x29c6c2){return function(){OpenchannelAccountEvents[_0xcc39('0x4')](_0x5bc333,_0x29c6c2);};}exports[_0xcc39('0x5')]=function(_0x3118f8){for(var _0x592ad7=0x0,_0x32cf84=events[_0xcc39('0x6')];_0x592ad7<_0x32cf84;_0x592ad7++){var _0x12361a=events[_0x592ad7];var _0x46bb71=createListener(_0xcc39('0x7')+_0x12361a,_0x3118f8);OpenchannelAccountEvents['on'](_0x12361a,_0x46bb71);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 6daaf55..8df9f3e 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 _0xebae=['get','isAuthenticated','index','/:id','show','post','update','delete','destroy','multer','path','express','Router','fs-extra'];(function(_0x1c3375,_0x29cf53){var _0x179181=function(_0xc0207c){while(--_0xc0207c){_0x1c3375['push'](_0x1c3375['shift']());}};_0x179181(++_0x29cf53);}(_0xebae,0xdb));var _0xeeba=function(_0x225c0c,_0x5071b1){_0x225c0c=_0x225c0c-0x0;var _0x7d45e6=_0xebae[_0x225c0c];return _0x7d45e6;};'use strict';var multer=require(_0xeeba('0x0'));var util=require('util');var path=require(_0xeeba('0x1'));var timeout=require('connect-timeout');var express=require(_0xeeba('0x2'));var router=express[_0xeeba('0x3')]();var fs_extra=require(_0xeeba('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0xeeba('0x5')]('/',auth[_0xeeba('0x6')](),controller[_0xeeba('0x7')]);router[_0xeeba('0x5')](_0xeeba('0x8'),auth[_0xeeba('0x6')](),controller[_0xeeba('0x9')]);router[_0xeeba('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xeeba('0x8'),auth[_0xeeba('0x6')](),controller[_0xeeba('0xb')]);router[_0xeeba('0xc')](_0xeeba('0x8'),auth['isAuthenticated'](),controller[_0xeeba('0xd')]);module['exports']=router; \ No newline at end of file +var _0xf98c=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xf98c,0xc0));var _0xcf98=function(_0x13bab8,_0x3bc6e9){_0x13bab8=_0x13bab8-0x0;var _0x30cdee=_0xf98c[_0x13bab8];return _0x30cdee;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcf98('0x0'));var express=require('express');var router=express[_0xcf98('0x1')]();var fs_extra=require(_0xcf98('0x2'));var auth=require(_0xcf98('0x3'));var interaction=require(_0xcf98('0x4'));var config=require('../../config/environment');var controller=require(_0xcf98('0x5'));router[_0xcf98('0x6')]('/',auth[_0xcf98('0x7')](),controller[_0xcf98('0x8')]);router['get'](_0xcf98('0x9'),auth[_0xcf98('0x7')](),controller['show']);router[_0xcf98('0xa')]('/',auth[_0xcf98('0x7')](),controller['create']);router[_0xcf98('0xb')](_0xcf98('0x9'),auth['isAuthenticated'](),controller[_0xcf98('0xc')]);router[_0xcf98('0xd')](_0xcf98('0x9'),auth['isAuthenticated'](),controller[_0xcf98('0xe')]);module[_0xcf98('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index c56477a..c831553 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 _0xe88b=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xe88b,0x1df));var _0xbe88=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xe88b[_0x31abee];return _0x3c1761;};'use strict';var Sequelize=require('sequelize');module[_0xbe88('0x0')]={'priority':{'type':Sequelize[_0xbe88('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbe88('0x2')],'allowNull':![],'defaultValue':_0xbe88('0x3')},'appdata':{'type':Sequelize[_0xbe88('0x4')]()},'description':{'type':Sequelize[_0xbe88('0x2')]},'interval':{'type':Sequelize[_0xbe88('0x2')],'defaultValue':_0xbe88('0x5')}}; \ No newline at end of file +var _0xebe2=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5a148f,_0x114dfa){var _0x5af2d4=function(_0x6a9ba4){while(--_0x6a9ba4){_0x5a148f['push'](_0x5a148f['shift']());}};_0x5af2d4(++_0x114dfa);}(_0xebe2,0x82));var _0x2ebe=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0xebe2[_0x2bf888];return _0x3038d6;};'use strict';var Sequelize=require(_0x2ebe('0x0'));module[_0x2ebe('0x1')]={'priority':{'type':Sequelize[_0x2ebe('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2ebe('0x3')],'allowNull':![],'defaultValue':_0x2ebe('0x4')},'appdata':{'type':Sequelize[_0x2ebe('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2ebe('0x3')],'defaultValue':_0x2ebe('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e365303..e3ea976 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 _0x0d43=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name','index','map','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','OpenchannelApplication','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x3209f2,_0x5c51e2){var _0x56aabc=function(_0x429ab1){while(--_0x429ab1){_0x3209f2['push'](_0x3209f2['shift']());}};_0x56aabc(++_0x5c51e2);}(_0x0d43,0x171));var _0x30d4=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x0d43[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0x30d4('0x0'));var rimraf=require(_0x30d4('0x1'));var zipdir=require(_0x30d4('0x2'));var jsonpatch=require(_0x30d4('0x3'));var rp=require('request-promise');var moment=require(_0x30d4('0x4'));var BPromise=require(_0x30d4('0x5'));var Mustache=require(_0x30d4('0x6'));var util=require('util');var path=require(_0x30d4('0x7'));var sox=require(_0x30d4('0x8'));var csv=require(_0x30d4('0x9'));var ejs=require(_0x30d4('0xa'));var fs=require('fs');var fs_extra=require(_0x30d4('0xb'));var _=require(_0x30d4('0xc'));var squel=require('squel');var crypto=require(_0x30d4('0xd'));var jsforce=require(_0x30d4('0xe'));var deskjs=require(_0x30d4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x30d4('0x10'));var Papa=require(_0x30d4('0x11'));var Redis=require('ioredis');var authService=require(_0x30d4('0x12'));var qs=require(_0x30d4('0x13'));var as=require(_0x30d4('0x14'));var hardwareService=require(_0x30d4('0x15'));var logger=require('../../config/logger')(_0x30d4('0x16'));var utils=require('../../config/utils');var config=require(_0x30d4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x30d4('0x18'))['db'];function respondWithStatusCode(_0x5410b9,_0x538c2c){_0x538c2c=_0x538c2c||0xcc;return function(_0x1e0917){if(_0x1e0917){return _0x5410b9['sendStatus'](_0x538c2c);}return _0x5410b9[_0x30d4('0x19')](_0x538c2c)[_0x30d4('0x1a')]();};}function respondWithResult(_0x566e63,_0x28f071){_0x28f071=_0x28f071||0xc8;return function(_0x3db80c){if(_0x3db80c){return _0x566e63[_0x30d4('0x19')](_0x28f071)['json'](_0x3db80c);}};}function respondWithFilteredResult(_0x37286e,_0x5c3559){return function(_0x34dc2a){if(_0x34dc2a){var _0x27ca88=typeof _0x5c3559[_0x30d4('0x1b')]===_0x30d4('0x1c')&&typeof _0x5c3559[_0x30d4('0x1d')]===_0x30d4('0x1c');var _0x5d064d=_0x34dc2a[_0x30d4('0x1e')];var _0x3449a9=_0x27ca88?0x0:_0x5c3559['offset'];var _0x5e0e69=_0x27ca88?_0x34dc2a[_0x30d4('0x1e')]:_0x5c3559[_0x30d4('0x1b')]+_0x5c3559[_0x30d4('0x1d')];var _0x5a37f8;if(_0x5e0e69>=_0x5d064d){_0x5e0e69=_0x5d064d;_0x5a37f8=0xc8;}else{_0x5a37f8=0xce;}_0x37286e['status'](_0x5a37f8);return _0x37286e[_0x30d4('0x1f')](_0x30d4('0x20'),_0x3449a9+'-'+_0x5e0e69+'/'+_0x5d064d)[_0x30d4('0x21')](_0x34dc2a);}return null;};}function patchUpdates(_0x1b7902){return function(_0x564a3b){try{jsonpatch[_0x30d4('0x22')](_0x564a3b,_0x1b7902,!![]);}catch(_0x17b353){return BPromise[_0x30d4('0x23')](_0x17b353);}return _0x564a3b['save']();};}function saveUpdates(_0x2308b7,_0x5deba6){return function(_0x526514){if(_0x526514){return _0x526514[_0x30d4('0x24')](_0x2308b7)[_0x30d4('0x25')](function(_0x4d6642){return _0x4d6642;});}return null;};}function removeEntity(_0x4ce6dd,_0x130fb7){return function(_0x50bd49){if(_0x50bd49){return _0x50bd49['destroy']()[_0x30d4('0x25')](function(){_0x4ce6dd[_0x30d4('0x19')](0xcc)[_0x30d4('0x1a')]();});}};}function handleEntityNotFound(_0x4c5a4c,_0x4e8b98){return function(_0x16c7f8){if(!_0x16c7f8){_0x4c5a4c[_0x30d4('0x26')](0x194);}return _0x16c7f8;};}function handleError(_0x4d4392,_0x234075){_0x234075=_0x234075||0x1f4;return function(_0x2a1763){logger[_0x30d4('0x27')](_0x2a1763[_0x30d4('0x28')]);if(_0x2a1763[_0x30d4('0x29')]){delete _0x2a1763[_0x30d4('0x29')];}_0x4d4392[_0x30d4('0x19')](_0x234075)['send'](_0x2a1763);};}exports[_0x30d4('0x2a')]=function(_0x1a6c2f,_0x5ba830){var _0xbe998e={},_0x10f5f9={},_0xd72c84={'count':0x0,'rows':[]};var _0xed510=_[_0x30d4('0x2b')](db['OpenchannelApplication'][_0x30d4('0x2c')],function(_0x70ca65){return{'name':_0x70ca65['fieldName'],'type':_0x70ca65['type'][_0x30d4('0x2d')]};});_0x10f5f9[_0x30d4('0x2e')]=_[_0x30d4('0x2b')](_0xed510,_0x30d4('0x29'));_0x10f5f9[_0x30d4('0x2f')]=_[_0x30d4('0x30')](_0x1a6c2f[_0x30d4('0x2f')]);_0x10f5f9['filters']=_['intersection'](_0x10f5f9['model'],_0x10f5f9['query']);_0xbe998e[_0x30d4('0x31')]=_[_0x30d4('0x32')](_0x10f5f9[_0x30d4('0x2e')],qs[_0x30d4('0x33')](_0x1a6c2f[_0x30d4('0x2f')][_0x30d4('0x33')]));_0xbe998e[_0x30d4('0x31')]=_0xbe998e[_0x30d4('0x31')][_0x30d4('0x34')]?_0xbe998e['attributes']:_0x10f5f9[_0x30d4('0x2e')];if(!_0x1a6c2f[_0x30d4('0x2f')][_0x30d4('0x35')](_0x30d4('0x36'))){_0xbe998e[_0x30d4('0x1d')]=qs[_0x30d4('0x1d')](_0x1a6c2f[_0x30d4('0x2f')][_0x30d4('0x1d')]);_0xbe998e[_0x30d4('0x1b')]=qs[_0x30d4('0x1b')](_0x1a6c2f[_0x30d4('0x2f')]['offset']);}_0xbe998e[_0x30d4('0x37')]=qs[_0x30d4('0x38')](_0x1a6c2f['query'][_0x30d4('0x38')]);_0xbe998e[_0x30d4('0x39')]=qs[_0x30d4('0x3a')](_[_0x30d4('0x3b')](_0x1a6c2f[_0x30d4('0x2f')],_0x10f5f9[_0x30d4('0x3a')]),_0xed510);if(_0x1a6c2f[_0x30d4('0x2f')][_0x30d4('0x3c')]){_0xbe998e[_0x30d4('0x39')]=_[_0x30d4('0x3d')](_0xbe998e[_0x30d4('0x39')],{'$or':_[_0x30d4('0x2b')](_0xed510,function(_0x215104){if(_0x215104[_0x30d4('0x3e')]!=='VIRTUAL'){var _0x1fac6f={};_0x1fac6f[_0x215104[_0x30d4('0x29')]]={'$like':'%'+_0x1a6c2f[_0x30d4('0x2f')][_0x30d4('0x3c')]+'%'};return _0x1fac6f;}})});}_0xbe998e=_[_0x30d4('0x3d')]({},_0xbe998e,_0x1a6c2f[_0x30d4('0x3f')]);var _0x5f1613={'where':_0xbe998e['where']};return db[_0x30d4('0x40')][_0x30d4('0x1e')](_0x5f1613)['then'](function(_0x2a065d){_0xd72c84['count']=_0x2a065d;if(_0x1a6c2f[_0x30d4('0x2f')][_0x30d4('0x41')]){_0xbe998e['include']=[{'all':!![]}];}return db[_0x30d4('0x40')][_0x30d4('0x42')](_0xbe998e);})[_0x30d4('0x25')](function(_0x28c45b){_0xd72c84[_0x30d4('0x43')]=_0x28c45b;return _0xd72c84;})[_0x30d4('0x25')](respondWithFilteredResult(_0x5ba830,_0xbe998e))[_0x30d4('0x44')](handleError(_0x5ba830,null));};exports[_0x30d4('0x45')]=function(_0x1ee41a,_0x2bd6ea){var _0x12d87e={'raw':!![],'where':{'id':_0x1ee41a[_0x30d4('0x46')]['id']}},_0x3a54e6={};_0x3a54e6[_0x30d4('0x2e')]=_[_0x30d4('0x30')](db[_0x30d4('0x40')]['rawAttributes']);_0x3a54e6['query']=_[_0x30d4('0x30')](_0x1ee41a[_0x30d4('0x2f')]);_0x3a54e6[_0x30d4('0x3a')]=_[_0x30d4('0x32')](_0x3a54e6[_0x30d4('0x2e')],_0x3a54e6['query']);_0x12d87e['attributes']=_[_0x30d4('0x32')](_0x3a54e6[_0x30d4('0x2e')],qs[_0x30d4('0x33')](_0x1ee41a[_0x30d4('0x2f')][_0x30d4('0x33')]));_0x12d87e[_0x30d4('0x31')]=_0x12d87e['attributes'][_0x30d4('0x34')]?_0x12d87e[_0x30d4('0x31')]:_0x3a54e6[_0x30d4('0x2e')];if(_0x1ee41a[_0x30d4('0x2f')][_0x30d4('0x41')]){_0x12d87e[_0x30d4('0x47')]=[{'all':!![]}];}_0x12d87e=_['merge']({},_0x12d87e,_0x1ee41a[_0x30d4('0x3f')]);return db[_0x30d4('0x40')][_0x30d4('0x48')](_0x12d87e)[_0x30d4('0x25')](handleEntityNotFound(_0x2bd6ea,null))['then'](respondWithResult(_0x2bd6ea,null))[_0x30d4('0x44')](handleError(_0x2bd6ea,null));};exports['create']=function(_0x1cd88c,_0x46ecaf){return db[_0x30d4('0x40')][_0x30d4('0x49')](_0x1cd88c[_0x30d4('0x4a')],{})[_0x30d4('0x25')](respondWithResult(_0x46ecaf,0xc9))['catch'](handleError(_0x46ecaf,null));};exports[_0x30d4('0x24')]=function(_0x220357,_0xb42fad){if(_0x220357['body']['id']){delete _0x220357['body']['id'];}return db['OpenchannelApplication'][_0x30d4('0x48')]({'where':{'id':_0x220357[_0x30d4('0x46')]['id']}})[_0x30d4('0x25')](handleEntityNotFound(_0xb42fad,null))[_0x30d4('0x25')](saveUpdates(_0x220357[_0x30d4('0x4a')],null))['then'](respondWithResult(_0xb42fad,null))[_0x30d4('0x44')](handleError(_0xb42fad,null));};exports[_0x30d4('0x4b')]=function(_0x27f08b,_0x502f2a){return db[_0x30d4('0x40')][_0x30d4('0x48')]({'where':{'id':_0x27f08b[_0x30d4('0x46')]['id']}})[_0x30d4('0x25')](handleEntityNotFound(_0x502f2a,null))[_0x30d4('0x25')](removeEntity(_0x502f2a,null))['catch'](handleError(_0x502f2a,null));}; \ No newline at end of file +var _0x0b2e=['pick','filter','merge','options','includeAll','findAll','show','length','include','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../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','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where'];(function(_0xe708f0,_0x58be78){var _0x5284b8=function(_0x28e49c){while(--_0x28e49c){_0xe708f0['push'](_0xe708f0['shift']());}};_0x5284b8(++_0x58be78);}(_0x0b2e,0x132));var _0xe0b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b2e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe0b2('0x0'));var rimraf=require(_0xe0b2('0x1'));var zipdir=require(_0xe0b2('0x2'));var jsonpatch=require(_0xe0b2('0x3'));var rp=require(_0xe0b2('0x4'));var moment=require(_0xe0b2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe0b2('0x6'));var util=require(_0xe0b2('0x7'));var path=require('path');var sox=require(_0xe0b2('0x8'));var csv=require(_0xe0b2('0x9'));var ejs=require(_0xe0b2('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b2('0xb'));var _=require('lodash');var squel=require(_0xe0b2('0xc'));var crypto=require(_0xe0b2('0xd'));var jsforce=require(_0xe0b2('0xe'));var deskjs=require(_0xe0b2('0xf'));var toCsv=require(_0xe0b2('0x9'));var querystring=require(_0xe0b2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe0b2('0x11'));var qs=require(_0xe0b2('0x12'));var as=require(_0xe0b2('0x13'));var hardwareService=require(_0xe0b2('0x14'));var logger=require(_0xe0b2('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xe0b2('0x16'));var licenseUtil=require(_0xe0b2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ef18a,_0x3f1040){_0x3f1040=_0x3f1040||0xcc;return function(_0x565489){if(_0x565489){return _0x3ef18a[_0xe0b2('0x18')](_0x3f1040);}return _0x3ef18a[_0xe0b2('0x19')](_0x3f1040)[_0xe0b2('0x1a')]();};}function respondWithResult(_0x3af4c0,_0x4f565d){_0x4f565d=_0x4f565d||0xc8;return function(_0x58b050){if(_0x58b050){return _0x3af4c0[_0xe0b2('0x19')](_0x4f565d)[_0xe0b2('0x1b')](_0x58b050);}};}function respondWithFilteredResult(_0x324654,_0x4ad0fe){return function(_0x2d78d2){if(_0x2d78d2){var _0x517a2a=typeof _0x4ad0fe['offset']===_0xe0b2('0x1c')&&typeof _0x4ad0fe[_0xe0b2('0x1d')]==='undefined';var _0x48fd88=_0x2d78d2[_0xe0b2('0x1e')];var _0x1a711e=_0x517a2a?0x0:_0x4ad0fe[_0xe0b2('0x1f')];var _0x3ec32f=_0x517a2a?_0x2d78d2[_0xe0b2('0x1e')]:_0x4ad0fe[_0xe0b2('0x1f')]+_0x4ad0fe['limit'];var _0x3650a;if(_0x3ec32f>=_0x48fd88){_0x3ec32f=_0x48fd88;_0x3650a=0xc8;}else{_0x3650a=0xce;}_0x324654[_0xe0b2('0x19')](_0x3650a);return _0x324654[_0xe0b2('0x20')]('Content-Range',_0x1a711e+'-'+_0x3ec32f+'/'+_0x48fd88)[_0xe0b2('0x1b')](_0x2d78d2);}return null;};}function patchUpdates(_0x101fd9){return function(_0x43d859){try{jsonpatch[_0xe0b2('0x21')](_0x43d859,_0x101fd9,!![]);}catch(_0x5dd239){return BPromise[_0xe0b2('0x22')](_0x5dd239);}return _0x43d859['save']();};}function saveUpdates(_0x5e062e,_0x117d02){return function(_0xb9a491){if(_0xb9a491){return _0xb9a491[_0xe0b2('0x23')](_0x5e062e)[_0xe0b2('0x24')](function(_0x3488e3){return _0x3488e3;});}return null;};}function removeEntity(_0x147287,_0x4ea020){return function(_0x3e50ea){if(_0x3e50ea){return _0x3e50ea[_0xe0b2('0x25')]()[_0xe0b2('0x24')](function(){_0x147287['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30d890,_0x517423){return function(_0x4a5795){if(!_0x4a5795){_0x30d890['sendStatus'](0x194);}return _0x4a5795;};}function handleError(_0x512f6d,_0x3c58f){_0x3c58f=_0x3c58f||0x1f4;return function(_0x3e3969){logger[_0xe0b2('0x26')](_0x3e3969[_0xe0b2('0x27')]);if(_0x3e3969[_0xe0b2('0x28')]){delete _0x3e3969[_0xe0b2('0x28')];}_0x512f6d['status'](_0x3c58f)[_0xe0b2('0x29')](_0x3e3969);};}exports[_0xe0b2('0x2a')]=function(_0x18a361,_0x27df75){var _0x2eaa26={},_0x4af83d={},_0x219336={'count':0x0,'rows':[]};var _0x5b683d=_[_0xe0b2('0x2b')](db[_0xe0b2('0x2c')][_0xe0b2('0x2d')],function(_0x4f30b3){return{'name':_0x4f30b3[_0xe0b2('0x2e')],'type':_0x4f30b3[_0xe0b2('0x2f')]['key']};});_0x4af83d['model']=_['map'](_0x5b683d,_0xe0b2('0x28'));_0x4af83d[_0xe0b2('0x30')]=_[_0xe0b2('0x31')](_0x18a361[_0xe0b2('0x30')]);_0x4af83d[_0xe0b2('0x32')]=_[_0xe0b2('0x33')](_0x4af83d['model'],_0x4af83d[_0xe0b2('0x30')]);_0x2eaa26[_0xe0b2('0x34')]=_[_0xe0b2('0x33')](_0x4af83d[_0xe0b2('0x35')],qs[_0xe0b2('0x36')](_0x18a361['query'][_0xe0b2('0x36')]));_0x2eaa26[_0xe0b2('0x34')]=_0x2eaa26[_0xe0b2('0x34')]['length']?_0x2eaa26[_0xe0b2('0x34')]:_0x4af83d[_0xe0b2('0x35')];if(!_0x18a361[_0xe0b2('0x30')][_0xe0b2('0x37')](_0xe0b2('0x38'))){_0x2eaa26[_0xe0b2('0x1d')]=qs[_0xe0b2('0x1d')](_0x18a361[_0xe0b2('0x30')][_0xe0b2('0x1d')]);_0x2eaa26[_0xe0b2('0x1f')]=qs[_0xe0b2('0x1f')](_0x18a361[_0xe0b2('0x30')][_0xe0b2('0x1f')]);}_0x2eaa26['order']=qs[_0xe0b2('0x39')](_0x18a361['query'][_0xe0b2('0x39')]);_0x2eaa26[_0xe0b2('0x3a')]=qs['filters'](_[_0xe0b2('0x3b')](_0x18a361[_0xe0b2('0x30')],_0x4af83d[_0xe0b2('0x32')]),_0x5b683d);if(_0x18a361[_0xe0b2('0x30')][_0xe0b2('0x3c')]){_0x2eaa26[_0xe0b2('0x3a')]=_[_0xe0b2('0x3d')](_0x2eaa26[_0xe0b2('0x3a')],{'$or':_[_0xe0b2('0x2b')](_0x5b683d,function(_0x1d64e4){if(_0x1d64e4[_0xe0b2('0x2f')]!=='VIRTUAL'){var _0x1142c9={};_0x1142c9[_0x1d64e4['name']]={'$like':'%'+_0x18a361[_0xe0b2('0x30')][_0xe0b2('0x3c')]+'%'};return _0x1142c9;}})});}_0x2eaa26=_[_0xe0b2('0x3d')]({},_0x2eaa26,_0x18a361[_0xe0b2('0x3e')]);var _0x5728f7={'where':_0x2eaa26[_0xe0b2('0x3a')]};return db[_0xe0b2('0x2c')][_0xe0b2('0x1e')](_0x5728f7)[_0xe0b2('0x24')](function(_0x55f50a){_0x219336[_0xe0b2('0x1e')]=_0x55f50a;if(_0x18a361[_0xe0b2('0x30')][_0xe0b2('0x3f')]){_0x2eaa26['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xe0b2('0x40')](_0x2eaa26);})[_0xe0b2('0x24')](function(_0x18756d){_0x219336['rows']=_0x18756d;return _0x219336;})['then'](respondWithFilteredResult(_0x27df75,_0x2eaa26))['catch'](handleError(_0x27df75,null));};exports[_0xe0b2('0x41')]=function(_0x36a117,_0x15fec3){var _0x432fcf={'raw':!![],'where':{'id':_0x36a117['params']['id']}},_0x304b56={};_0x304b56[_0xe0b2('0x35')]=_[_0xe0b2('0x31')](db['OpenchannelApplication'][_0xe0b2('0x2d')]);_0x304b56[_0xe0b2('0x30')]=_[_0xe0b2('0x31')](_0x36a117[_0xe0b2('0x30')]);_0x304b56[_0xe0b2('0x32')]=_[_0xe0b2('0x33')](_0x304b56['model'],_0x304b56[_0xe0b2('0x30')]);_0x432fcf['attributes']=_[_0xe0b2('0x33')](_0x304b56[_0xe0b2('0x35')],qs[_0xe0b2('0x36')](_0x36a117[_0xe0b2('0x30')][_0xe0b2('0x36')]));_0x432fcf[_0xe0b2('0x34')]=_0x432fcf[_0xe0b2('0x34')][_0xe0b2('0x42')]?_0x432fcf[_0xe0b2('0x34')]:_0x304b56[_0xe0b2('0x35')];if(_0x36a117[_0xe0b2('0x30')][_0xe0b2('0x3f')]){_0x432fcf[_0xe0b2('0x43')]=[{'all':!![]}];}_0x432fcf=_[_0xe0b2('0x3d')]({},_0x432fcf,_0x36a117['options']);return db[_0xe0b2('0x2c')][_0xe0b2('0x44')](_0x432fcf)[_0xe0b2('0x24')](handleEntityNotFound(_0x15fec3,null))[_0xe0b2('0x24')](respondWithResult(_0x15fec3,null))['catch'](handleError(_0x15fec3,null));};exports[_0xe0b2('0x45')]=function(_0x5b0b44,_0x18618f){return db[_0xe0b2('0x2c')][_0xe0b2('0x45')](_0x5b0b44[_0xe0b2('0x46')],{})['then'](respondWithResult(_0x18618f,0xc9))[_0xe0b2('0x47')](handleError(_0x18618f,null));};exports[_0xe0b2('0x23')]=function(_0x4c496b,_0x4044d1){if(_0x4c496b[_0xe0b2('0x46')]['id']){delete _0x4c496b[_0xe0b2('0x46')]['id'];}return db[_0xe0b2('0x2c')][_0xe0b2('0x44')]({'where':{'id':_0x4c496b[_0xe0b2('0x48')]['id']}})['then'](handleEntityNotFound(_0x4044d1,null))[_0xe0b2('0x24')](saveUpdates(_0x4c496b[_0xe0b2('0x46')],null))[_0xe0b2('0x24')](respondWithResult(_0x4044d1,null))[_0xe0b2('0x47')](handleError(_0x4044d1,null));};exports[_0xe0b2('0x25')]=function(_0x5df881,_0x494788){return db[_0xe0b2('0x2c')][_0xe0b2('0x44')]({'where':{'id':_0x5df881['params']['id']}})[_0xe0b2('0x24')](handleEntityNotFound(_0x494788,null))[_0xe0b2('0x24')](removeEntity(_0x494788,null))[_0xe0b2('0x47')](handleError(_0x494788,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 7e6aaf4..a1acfb8 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 _0xa23d=['request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa23d,0x14c));var _0xda23=function(_0x292cc0,_0x1ab9c1){_0x292cc0=_0x292cc0-0x0;var _0xbcf94=_0xa23d[_0x292cc0];return _0xbcf94;};'use strict';var _=require(_0xda23('0x0'));var util=require(_0xda23('0x1'));var logger=require('../../config/logger')(_0xda23('0x2'));var moment=require('moment');var BPromise=require(_0xda23('0x3'));var rp=require(_0xda23('0x4'));var fs=require('fs');var path=require(_0xda23('0x5'));var rimraf=require(_0xda23('0x6'));var config=require(_0xda23('0x7'));var attributes=require(_0xda23('0x8'));module['exports']=function(_0x590396,_0x4726fe){return _0x590396[_0xda23('0x9')](_0xda23('0xa'),attributes,{'tableName':_0xda23('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xda23('0xc'),'collate':_0xda23('0xd')});}; \ No newline at end of file +var _0xe053=['define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports'];(function(_0x517c2e,_0x3d4bf3){var _0x5d4029=function(_0x150245){while(--_0x150245){_0x517c2e['push'](_0x517c2e['shift']());}};_0x5d4029(++_0x3d4bf3);}(_0xe053,0x1d5));var _0x3e05=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xe053[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x3e05('0x0'));var util=require(_0x3e05('0x1'));var logger=require(_0x3e05('0x2'))(_0x3e05('0x3'));var moment=require(_0x3e05('0x4'));var BPromise=require(_0x3e05('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e05('0x6'));var rimraf=require(_0x3e05('0x7'));var config=require(_0x3e05('0x8'));var attributes=require(_0x3e05('0x9'));module[_0x3e05('0xa')]=function(_0x1f41b2,_0x22a8eb){return _0x1f41b2[_0x3e05('0xb')](_0x3e05('0xc'),attributes,{'tableName':_0x3e05('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3e05('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 8b2a8ef..d157760 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 _0x4964=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','util'];(function(_0x17f210,_0x4e53e2){var _0x4614d7=function(_0x1b2c4e){while(--_0x1b2c4e){_0x17f210['push'](_0x17f210['shift']());}};_0x4614d7(++_0x4e53e2);}(_0x4964,0x73));var _0x4496=function(_0x5d4b1f,_0x438f40){_0x5d4b1f=_0x5d4b1f-0x0;var _0x24b97f=_0x4964[_0x5d4b1f];return _0x24b97f;};'use strict';var _=require('lodash');var util=require(_0x4496('0x0'));var moment=require(_0x4496('0x1'));var BPromise=require(_0x4496('0x2'));var rs=require(_0x4496('0x3'));var fs=require('fs');var Redis=require(_0x4496('0x4'));var db=require(_0x4496('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4496('0x6'))('rpc');var config=require(_0x4496('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4496('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48ad4b,_0x1715f9,_0x224572){return new BPromise(function(_0x505109,_0x1d4d5d){return client[_0x4496('0x9')](_0x48ad4b,_0x224572)[_0x4496('0xa')](function(_0x408c5f){logger[_0x4496('0xb')](_0x4496('0xc'),_0x1715f9,_0x4496('0xd'));logger[_0x4496('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x1715f9,'request\x20sent',JSON[_0x4496('0xf')](_0x408c5f));if(_0x408c5f['error']){if(_0x408c5f[_0x4496('0x10')][_0x4496('0x11')]===0x1f4){logger[_0x4496('0x10')](_0x4496('0xc'),_0x1715f9,_0x408c5f['error'][_0x4496('0x12')]);return _0x1d4d5d(_0x408c5f[_0x4496('0x10')]['message']);}logger[_0x4496('0x10')](_0x4496('0xc'),_0x1715f9,_0x408c5f[_0x4496('0x10')][_0x4496('0x12')]);return _0x505109(_0x408c5f[_0x4496('0x10')][_0x4496('0x12')]);}else{logger['info'](_0x4496('0xc'),_0x1715f9,_0x4496('0xd'));_0x505109(_0x408c5f[_0x4496('0x13')][_0x4496('0x12')]);}})[_0x4496('0x14')](function(_0x334c42){logger['error'](_0x4496('0xc'),_0x1715f9,_0x334c42);_0x1d4d5d(_0x334c42);});});}exports[_0x4496('0x15')]=function(_0x31bab9){var _0x5a97f8=this;return new Promise(function(_0x17071e,_0x186a22){return db[_0x4496('0x16')][_0x4496('0x17')](_0x31bab9[_0x4496('0x18')],{'raw':_0x31bab9[_0x4496('0x19')]?_0x31bab9[_0x4496('0x19')][_0x4496('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31bab9[_0x4496('0x19')]?_0x31bab9[_0x4496('0x19')][_0x4496('0x1b')]||null:null,'attributes':_0x31bab9['options']?_0x31bab9[_0x4496('0x19')]['attributes']||null:null,'limit':_0x31bab9[_0x4496('0x19')]?_0x31bab9[_0x4496('0x19')][_0x4496('0x1c')]||null:null})[_0x4496('0xa')](function(_0x1fe35d){logger[_0x4496('0xb')](_0x4496('0x15'),_0x31bab9);logger[_0x4496('0xe')]('UpdateOpenchannelApplication',_0x31bab9,JSON[_0x4496('0xf')](_0x1fe35d));_0x17071e(_0x1fe35d);})[_0x4496('0x14')](function(_0x258785){logger[_0x4496('0x10')](_0x4496('0x15'),_0x258785[_0x4496('0x12')],_0x31bab9);_0x186a22(_0x5a97f8[_0x4496('0x10')](0x1f4,_0x258785[_0x4496('0x12')]));});});}; \ No newline at end of file +var _0x6187=['../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','OpenchannelApplication','update','body','options','raw','limit','UpdateOpenchannelApplication','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x23c70a,_0x32eda1){var _0x40cb9a=function(_0x51ab22){while(--_0x51ab22){_0x23c70a['push'](_0x23c70a['shift']());}};_0x40cb9a(++_0x32eda1);}(_0x6187,0x1bb));var _0x7618=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x6187[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0x7618('0x0'));var util=require(_0x7618('0x1'));var moment=require('moment');var BPromise=require(_0x7618('0x2'));var rs=require(_0x7618('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7618('0x4'))['db'];var utils=require(_0x7618('0x5'));var logger=require(_0x7618('0x6'))('rpc');var config=require(_0x7618('0x7'));var jayson=require(_0x7618('0x8'));var client=jayson[_0x7618('0x9')][_0x7618('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x279838,_0x376066,_0x49e007){return new BPromise(function(_0x24edfc,_0x4ec0ca){return client[_0x7618('0xb')](_0x279838,_0x49e007)[_0x7618('0xc')](function(_0x3f78fa){logger[_0x7618('0xd')](_0x7618('0xe'),_0x376066,'request\x20sent');logger[_0x7618('0xf')](_0x7618('0x10'),_0x376066,_0x7618('0x11'),JSON[_0x7618('0x12')](_0x3f78fa));if(_0x3f78fa[_0x7618('0x13')]){if(_0x3f78fa[_0x7618('0x13')]['code']===0x1f4){logger['error'](_0x7618('0xe'),_0x376066,_0x3f78fa[_0x7618('0x13')][_0x7618('0x14')]);return _0x4ec0ca(_0x3f78fa[_0x7618('0x13')][_0x7618('0x14')]);}logger['error'](_0x7618('0xe'),_0x376066,_0x3f78fa[_0x7618('0x13')][_0x7618('0x14')]);return _0x24edfc(_0x3f78fa['error'][_0x7618('0x14')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x376066,_0x7618('0x11'));_0x24edfc(_0x3f78fa[_0x7618('0x15')][_0x7618('0x14')]);}})[_0x7618('0x16')](function(_0x4fe3a9){logger[_0x7618('0x13')](_0x7618('0xe'),_0x376066,_0x4fe3a9);_0x4ec0ca(_0x4fe3a9);});});}exports['UpdateOpenchannelApplication']=function(_0x2043e5){var _0x486fa1=this;return new Promise(function(_0x46726d,_0x5057e3){return db[_0x7618('0x17')][_0x7618('0x18')](_0x2043e5[_0x7618('0x19')],{'raw':_0x2043e5[_0x7618('0x1a')]?_0x2043e5[_0x7618('0x1a')][_0x7618('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2043e5[_0x7618('0x1a')]?_0x2043e5[_0x7618('0x1a')]['where']||null:null,'attributes':_0x2043e5[_0x7618('0x1a')]?_0x2043e5['options']['attributes']||null:null,'limit':_0x2043e5[_0x7618('0x1a')]?_0x2043e5[_0x7618('0x1a')][_0x7618('0x1c')]||null:null})['then'](function(_0x26d620){logger['info'](_0x7618('0x1d'),_0x2043e5);logger[_0x7618('0xf')](_0x7618('0x1d'),_0x2043e5,JSON['stringify'](_0x26d620));_0x46726d(_0x26d620);})[_0x7618('0x16')](function(_0x43af9a){logger[_0x7618('0x13')](_0x7618('0x1d'),_0x43af9a[_0x7618('0x14')],_0x2043e5);_0x5057e3(_0x486fa1[_0x7618('0x13')](0x1f4,_0x43af9a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 099196c..f242ba1 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 _0x2de9=['describe','/:id','show','/:id/messages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2de9,0x9c));var _0x92de=function(_0x16a24b,_0x1a4ebc){_0x16a24b=_0x16a24b-0x0;var _0x4d4e9a=_0x2de9[_0x16a24b];return _0x4d4e9a;};'use strict';var multer=require(_0x92de('0x0'));var util=require(_0x92de('0x1'));var path=require(_0x92de('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x92de('0x3')]();var fs_extra=require(_0x92de('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92de('0x5'));var config=require(_0x92de('0x6'));var controller=require(_0x92de('0x7'));router[_0x92de('0x8')]('/',auth[_0x92de('0x9')](),controller[_0x92de('0xa')]);router[_0x92de('0x8')](_0x92de('0xb'),auth[_0x92de('0x9')](),controller[_0x92de('0xc')]);router[_0x92de('0x8')](_0x92de('0xd'),auth[_0x92de('0x9')](),controller[_0x92de('0xe')]);router[_0x92de('0x8')](_0x92de('0xf'),auth[_0x92de('0x9')](),controller['getMessages']);router[_0x92de('0x8')](_0x92de('0x10'),auth[_0x92de('0x9')](),controller[_0x92de('0x11')]);router[_0x92de('0x12')]('/',auth['isAuthenticated'](),controller[_0x92de('0x13')]);router[_0x92de('0x12')](_0x92de('0xf'),auth[_0x92de('0x9')](),controller['addMessage']);router['post'](_0x92de('0x14'),auth[_0x92de('0x9')](),interaction[_0x92de('0x15')](_0x92de('0x16'),'openchannelinteraction:addtags'),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x92de('0x15')](_0x92de('0x16'),_0x92de('0x17')),controller[_0x92de('0x18')]);router[_0x92de('0x19')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x92de('0x16'),_0x92de('0x1a')),controller[_0x92de('0x1b')]);router[_0x92de('0x19')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x3cba=['getMessages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','/:id','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages'];(function(_0x1de7a3,_0x590f16){var _0xcfd43d=function(_0x1392f6){while(--_0x1392f6){_0x1de7a3['push'](_0x1de7a3['shift']());}};_0xcfd43d(++_0x590f16);}(_0x3cba,0x8d));var _0xa3cb=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x3cba[_0x2cc594];return _0x4abff7;};'use strict';var multer=require(_0xa3cb('0x0'));var util=require(_0xa3cb('0x1'));var path=require(_0xa3cb('0x2'));var timeout=require(_0xa3cb('0x3'));var express=require(_0xa3cb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa3cb('0x5'));var config=require(_0xa3cb('0x6'));var controller=require(_0xa3cb('0x7'));router[_0xa3cb('0x8')]('/',auth[_0xa3cb('0x9')](),controller['index']);router[_0xa3cb('0x8')](_0xa3cb('0xa'),auth[_0xa3cb('0x9')](),controller[_0xa3cb('0xb')]);router[_0xa3cb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa3cb('0xc')]);router[_0xa3cb('0x8')](_0xa3cb('0xd'),auth[_0xa3cb('0x9')](),controller[_0xa3cb('0xe')]);router[_0xa3cb('0x8')](_0xa3cb('0xf'),auth[_0xa3cb('0x9')](),controller[_0xa3cb('0x10')]);router[_0xa3cb('0x11')]('/',auth[_0xa3cb('0x9')](),controller[_0xa3cb('0x12')]);router['post'](_0xa3cb('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa3cb('0x11')](_0xa3cb('0x13'),auth[_0xa3cb('0x9')](),interaction[_0xa3cb('0x14')](_0xa3cb('0x15'),_0xa3cb('0x16')),controller['addTags']);router[_0xa3cb('0x17')](_0xa3cb('0x18'),auth['isAuthenticated'](),interaction[_0xa3cb('0x14')](_0xa3cb('0x15'),_0xa3cb('0x19')),controller[_0xa3cb('0x1a')]);router[_0xa3cb('0x1b')](_0xa3cb('0x18'),auth[_0xa3cb('0x9')](),interaction[_0xa3cb('0x14')]('openchannel','openchannelinteraction:destroy'),controller[_0xa3cb('0x1c')]);router[_0xa3cb('0x1b')]('/:id/tags',auth[_0xa3cb('0x9')](),controller[_0xa3cb('0x1d')]);module[_0xa3cb('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 045b994..c98f25f 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 _0x8978=['BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x5cc899,_0x2029f5){var _0x1eb22c=function(_0x4c6cd2){while(--_0x4c6cd2){_0x5cc899['push'](_0x5cc899['shift']());}};_0x1eb22c(++_0x2029f5);}(_0x8978,0x1cc));var _0x8897=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x8978[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x8897('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8897('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8897('0x1')]},'note':{'type':Sequelize[_0x8897('0x1')]},'read1stAt':{'type':Sequelize[_0x8897('0x2')]},'threadId':{'type':Sequelize[_0x8897('0x1')]},'externalUrl':{'type':Sequelize[_0x8897('0x1')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8897('0x3')]('in',_0x8897('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8897('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8897('0x1')]},'autoreplyExecuted':{'type':Sequelize[_0x8897('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6901=['STRING','out','ENUM','INTEGER','sequelize','BOOLEAN','DATE'];(function(_0x1c0734,_0x34fa94){var _0x2f7c93=function(_0xf00197){while(--_0xf00197){_0x1c0734['push'](_0x1c0734['shift']());}};_0x2f7c93(++_0x34fa94);}(_0x6901,0x100));var _0x1690=function(_0x485714,_0x128dfa){_0x485714=_0x485714-0x0;var _0x2a6ec7=_0x6901[_0x485714];return _0x2a6ec7;};'use strict';var Sequelize=require(_0x1690('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1690('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1690('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1690('0x3')]},'note':{'type':Sequelize[_0x1690('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x1690('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1690('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x1690('0x5')]('in',_0x1690('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1690('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x1690('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1690('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index dfe9f5e..30d1bb4 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 _0xeffa=['files','tmp','join','server','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','disposition','Public','Private','basename','existsSync','pipe','out','System','secret','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','type','key','findAll','openchannel','user','show','query','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','nolimit','order','sort','pick','where','OpenchannelInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','toString','root'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xeffa,0x133));var _0xaeff=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xeffa[_0x565ed7];return _0x183ad7;};'use strict';var rimraf=require(_0xaeff('0x0'));var zipdir=require(_0xaeff('0x1'));var moment=require(_0xaeff('0x2'));var util=require(_0xaeff('0x3'));var path=require(_0xaeff('0x4'));var ejs=require(_0xaeff('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xaeff('0x6'));var interaction=require(_0xaeff('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xaeff('0x8'));var logger=require('../../config/logger')(_0xaeff('0x9'));var config=require(_0xaeff('0xa'));var db=require('../../mysqldb')['db'];config[_0xaeff('0xb')]=_[_0xaeff('0xc')](config[_0xaeff('0xb')],{'host':_0xaeff('0xd'),'port':0x18eb});var socket=require(_0xaeff('0xe'))(new Redis(config[_0xaeff('0xb')]));require(_0xaeff('0xf'))[_0xaeff('0x10')](socket);function respondWithStatusCode(_0x5ce5a5,_0x3cf22e){_0x3cf22e=_0x3cf22e||0xcc;return function(_0x108e29){if(_0x108e29){return _0x5ce5a5[_0xaeff('0x11')](_0x3cf22e);}return _0x5ce5a5[_0xaeff('0x12')](_0x3cf22e)[_0xaeff('0x13')]();};}function respondWithResult(_0x2a48a1,_0x515a56){_0x515a56=_0x515a56||0xc8;return function(_0x390f7b){if(_0x390f7b){return _0x2a48a1[_0xaeff('0x12')](_0x515a56)[_0xaeff('0x14')](_0x390f7b);}};}function respondWithFilteredResult(_0x301e8,_0x5972df){return function(_0x2c70b3){if(_0x2c70b3){var _0x85db24=typeof _0x5972df['offset']===_0xaeff('0x15')&&typeof _0x5972df[_0xaeff('0x16')]===_0xaeff('0x15');var _0x5c305f=_0x2c70b3[_0xaeff('0x17')];var _0x54a77b=_0x85db24?0x0:_0x5972df['offset'];var _0x5bcfb9=_0x85db24?_0x2c70b3[_0xaeff('0x17')]:_0x5972df[_0xaeff('0x18')]+_0x5972df['limit'];var _0x4238b9;if(_0x5bcfb9>=_0x5c305f){_0x5bcfb9=_0x5c305f;_0x4238b9=0xc8;}else{_0x4238b9=0xce;}_0x301e8[_0xaeff('0x12')](_0x4238b9);return _0x301e8[_0xaeff('0x19')](_0xaeff('0x1a'),_0x54a77b+'-'+_0x5bcfb9+'/'+_0x5c305f)['json'](_0x2c70b3);}return null;};}function saveUpdates(_0x1f4a20){return function(_0x358403){if(_0x358403){return _0x358403[_0xaeff('0x1b')](_0x1f4a20)[_0xaeff('0x1c')](function(_0x45ec7b){return _0x45ec7b;});}return null;};}function removeEntity(_0x129427){return function(_0x48e048){if(_0x48e048){return _0x48e048[_0xaeff('0x1d')]()[_0xaeff('0x1c')](function(){_0x129427['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0b5f){return function(_0x1ab16c){if(!_0x1ab16c){_0x1d0b5f[_0xaeff('0x11')](0x194);}return _0x1ab16c;};}function handleError(_0x7421db,_0x491a7f){_0x491a7f=_0x491a7f||0x1f4;return function(_0x1dae89){logger[_0xaeff('0x1e')](_0x1dae89[_0xaeff('0x1f')]);if(_0x1dae89[_0xaeff('0x20')]){delete _0x1dae89['name'];}_0x7421db[_0xaeff('0x12')](_0x491a7f)[_0xaeff('0x21')](_0x1dae89);};}exports[_0xaeff('0x22')]=function(_0x339fe7,_0x18aa92){var _0x343c5f={};var _0x488475=_[_0xaeff('0x23')](db[_0xaeff('0x24')][_0xaeff('0x25')],function(_0x2de730){return{'name':_0x2de730['fieldName'],'type':_0x2de730[_0xaeff('0x26')][_0xaeff('0x27')]};});_0x343c5f=qs['getOptions'](_0x488475,_0x339fe7);return interaction[_0xaeff('0x28')](_0xaeff('0x29'),_0x339fe7['query'],_0x339fe7[_0xaeff('0x2a')],_0x343c5f,_0x488475)[_0xaeff('0x1c')](respondWithFilteredResult(_0x18aa92,_0x343c5f))['catch'](handleError(_0x18aa92,null));};exports[_0xaeff('0x2b')]=function(_0x32468d,_0x555efc){var _0x3d3c47={};if(_0x32468d[_0xaeff('0x2c')][_0xaeff('0x26')]&&_0x32468d[_0xaeff('0x2c')][_0xaeff('0x26')]===_0xaeff('0x2d')){_0x3d3c47[_0xaeff('0x2d')]=_0x32468d['params']['id'];}else{_0x3d3c47['id']=_0x32468d[_0xaeff('0x2e')]['id'];}var _0x3c5a4f={'raw':![],'where':_0x3d3c47},_0x3591c6={};_0x3591c6[_0xaeff('0x2f')]=_[_0xaeff('0x30')](db[_0xaeff('0x24')][_0xaeff('0x25')]);_0x3591c6[_0xaeff('0x2c')]=_[_0xaeff('0x30')](_0x32468d[_0xaeff('0x2c')]);_0x3591c6[_0xaeff('0x31')]=_[_0xaeff('0x32')](_0x3591c6[_0xaeff('0x2f')],_0x3591c6[_0xaeff('0x2c')]);_0x3c5a4f[_0xaeff('0x33')]=_[_0xaeff('0x32')](_0x3591c6[_0xaeff('0x2f')],qs['fields'](_0x32468d[_0xaeff('0x2c')][_0xaeff('0x34')]));_0x3c5a4f[_0xaeff('0x33')]=_0x3c5a4f[_0xaeff('0x33')][_0xaeff('0x35')]?_0x3c5a4f['attributes']:_0x3591c6[_0xaeff('0x2f')];if(_0x32468d[_0xaeff('0x2c')][_0xaeff('0x36')]){_0x3c5a4f[_0xaeff('0x37')]=[{'all':!![]}];}_0x3c5a4f=_['merge']({},_0x3c5a4f,_0x32468d[_0xaeff('0x38')]);return db[_0xaeff('0x24')][_0xaeff('0x39')](_0x3c5a4f)[_0xaeff('0x1c')](handleEntityNotFound(_0x555efc,null))[_0xaeff('0x1c')](respondWithResult(_0x555efc,null))[_0xaeff('0x3a')](handleError(_0x555efc,null));};exports[_0xaeff('0x3b')]=function(_0x1e1058,_0x11615c){return db[_0xaeff('0x24')][_0xaeff('0x3b')](_0x1e1058['body'],{})[_0xaeff('0x1c')](respondWithResult(_0x11615c,0xc9))[_0xaeff('0x3a')](handleError(_0x11615c,null));};exports[_0xaeff('0x1b')]=function(_0x4f9b42,_0x370ae3){if(_0x4f9b42['body']['id']){delete _0x4f9b42[_0xaeff('0x3c')]['id'];}return db[_0xaeff('0x24')][_0xaeff('0x39')]({'where':{'id':_0x4f9b42['params']['id']}})['then'](handleEntityNotFound(_0x370ae3,null))[_0xaeff('0x1c')](saveUpdates(_0x4f9b42[_0xaeff('0x3c')],null))[_0xaeff('0x1c')](respondWithResult(_0x370ae3,null))['catch'](handleError(_0x370ae3,null));};exports['destroy']=function(_0x21c801,_0xaae08d){return db[_0xaeff('0x24')][_0xaeff('0x39')]({'where':{'id':_0x21c801[_0xaeff('0x2e')]['id']}})[_0xaeff('0x1c')](handleEntityNotFound(_0xaae08d,null))[_0xaeff('0x1c')](removeEntity(_0xaae08d,null))[_0xaeff('0x3a')](handleError(_0xaae08d,null));};exports['describe']=function(_0x3d23d8,_0xf848d9){return db['OpenchannelInteraction'][_0xaeff('0x3d')]()[_0xaeff('0x1c')](respondWithResult(_0xf848d9,null))[_0xaeff('0x3a')](handleError(_0xf848d9,null));};exports[_0xaeff('0x3e')]=function(_0x1265e0,_0x4b952d){return db[_0xaeff('0x3f')]['find']({'where':{'id':_0x1265e0[_0xaeff('0x2e')]['id']}})[_0xaeff('0x1c')](handleEntityNotFound(_0x4b952d,null))[_0xaeff('0x1c')](function(_0x3db3c9){if(_0x3db3c9){return _0x3db3c9['addMessage'](_0x1265e0[_0xaeff('0x3c')][_0xaeff('0x40')],_['omit'](_0x1265e0[_0xaeff('0x3c')],[_0xaeff('0x40'),'id'])||{});}})['then'](respondWithResult(_0x4b952d,null))[_0xaeff('0x3a')](handleError(_0x4b952d,null));};exports[_0xaeff('0x41')]=function(_0x4a5bec,_0x49780b){var _0x4d9897={'raw':![],'where':{}};var _0x1b2ef6={};var _0x49164a={'count':0x0,'rows':[]};return db[_0xaeff('0x24')][_0xaeff('0x42')]({'where':{'id':_0x4a5bec[_0xaeff('0x2e')]['id']}})[_0xaeff('0x1c')](handleEntityNotFound(_0x49780b,null))[_0xaeff('0x1c')](function(_0x247233){if(_0x247233){_0x1b2ef6[_0xaeff('0x2f')]=_['keys'](db[_0xaeff('0x3f')]['rawAttributes']);_0x1b2ef6['query']=_[_0xaeff('0x30')](_0x4a5bec[_0xaeff('0x2c')]);_0x1b2ef6[_0xaeff('0x31')]=_['intersection'](_0x1b2ef6[_0xaeff('0x2f')],_0x1b2ef6[_0xaeff('0x2c')]);_0x4d9897[_0xaeff('0x33')]=_[_0xaeff('0x32')](_0x1b2ef6[_0xaeff('0x2f')],qs[_0xaeff('0x34')](_0x4a5bec[_0xaeff('0x2c')]['fields']));_0x4d9897[_0xaeff('0x33')]=_0x4d9897['attributes']['length']?_0x4d9897[_0xaeff('0x33')]:_0x1b2ef6[_0xaeff('0x2f')];if(!_0x4a5bec['query']['hasOwnProperty'](_0xaeff('0x43'))){_0x4d9897['limit']=qs['limit'](_0x4a5bec['query'][_0xaeff('0x16')]);_0x4d9897[_0xaeff('0x18')]=qs[_0xaeff('0x18')](_0x4a5bec[_0xaeff('0x2c')][_0xaeff('0x18')]);}_0x4d9897[_0xaeff('0x44')]=qs['sort'](_0x4a5bec[_0xaeff('0x2c')][_0xaeff('0x45')]);_0x4d9897['where']=qs[_0xaeff('0x31')](_[_0xaeff('0x46')](_0x4a5bec['query'],_0x1b2ef6[_0xaeff('0x31')]));_0x4d9897[_0xaeff('0x47')][_0xaeff('0x48')]=_0x247233['id'];if(_0x4a5bec[_0xaeff('0x2c')][_0xaeff('0x49')]){_0x4d9897[_0xaeff('0x47')]=_[_0xaeff('0x4a')](_0x4d9897[_0xaeff('0x47')],{'$or':_[_0xaeff('0x23')](_0x4d9897[_0xaeff('0x33')],function(_0xd3ce12){var _0xb6c73d={};_0xb6c73d[_0xd3ce12]={'$like':'%'+_0x4a5bec[_0xaeff('0x2c')]['filter']+'%'};return _0xb6c73d;})});}if(_0x4a5bec[_0xaeff('0x2c')]['$gte']){var _0x335a23=_0x4a5bec['query'][_0xaeff('0x4b')][_0xaeff('0x4c')](',');var _0x55b100={};_0x55b100[_0x335a23[0x0]]={'$gte':moment(_0x335a23[0x1])[_0xaeff('0x4d')](_0xaeff('0x4e'))};_0x4d9897[_0xaeff('0x47')]=_[_0xaeff('0x4a')](_0x4d9897['where'],_0x55b100);}_0x4d9897=_[_0xaeff('0x4a')]({},_0x4d9897,_0x4a5bec[_0xaeff('0x38')]);return db[_0xaeff('0x3f')][_0xaeff('0x17')]({'where':_0x4d9897['where']})[_0xaeff('0x1c')](function(_0x59a5e4){_0x49164a['count']=_0x59a5e4;if(_0x4a5bec[_0xaeff('0x2c')][_0xaeff('0x36')]){_0x4d9897['include']=[{'all':!![]}];}return db[_0xaeff('0x3f')][_0xaeff('0x28')](_0x4d9897);})[_0xaeff('0x1c')](function(_0x333f39){_0x49164a[_0xaeff('0x4f')]=_0x333f39;return _0x49164a;});}})['then'](respondWithFilteredResult(_0x49780b,_0x4d9897))['catch'](handleError(_0x49780b,null));};exports[_0xaeff('0x50')]=function(_0x3a61f7,_0x256932){return db[_0xaeff('0x24')][_0xaeff('0x39')]({'where':{'id':_0x3a61f7[_0xaeff('0x2e')]['id']}})['then'](handleEntityNotFound(_0x256932,null))[_0xaeff('0x1c')](function(_0x37cae3){if(_0x37cae3){return _0x37cae3[_0xaeff('0x51')](_0x3a61f7[_0xaeff('0x3c')][_0xaeff('0x40')],_[_0xaeff('0x52')](_0x3a61f7[_0xaeff('0x3c')],[_0xaeff('0x40'),'id'])||{})[_0xaeff('0x53')](function(){return db[_0xaeff('0x54')][_0xaeff('0x28')]({'attributes':['id',_0xaeff('0x20'),_0xaeff('0x55')],'where':{'id':_0x3a61f7[_0xaeff('0x3c')]['ids']}});})['then'](function(_0x3ad880){socket[_0xaeff('0x56')](_0xaeff('0x57'),{'id':Number(_0x3a61f7[_0xaeff('0x2e')]['id']),'tags':_0x3ad880||[]});return{'id':Number(_0x3a61f7[_0xaeff('0x2e')]['id']),'tags':_0x3ad880||[]};});}})[_0xaeff('0x1c')](respondWithResult(_0x256932,null))['catch'](handleError(_0x256932,null));};exports[_0xaeff('0x58')]=function(_0x3920c3,_0x15e689){return db[_0xaeff('0x24')]['find']({'where':{'id':_0x3920c3[_0xaeff('0x2e')]['id']}})[_0xaeff('0x1c')](handleEntityNotFound(_0x15e689,null))[_0xaeff('0x1c')](function(_0x25a915){if(_0x25a915){return _0x25a915[_0xaeff('0x58')](_0x3920c3[_0xaeff('0x2c')][_0xaeff('0x40')]);}})[_0xaeff('0x1c')](respondWithStatusCode(_0x15e689,null))[_0xaeff('0x3a')](handleError(_0x15e689,null));};exports[_0xaeff('0x59')]=function(_0x50005d,_0x84f026){var _0x475e60=moment()['unix']()[_0xaeff('0x5a')]();var _0x119b87=path['join'](config[_0xaeff('0x5b')],'server',_0xaeff('0x5c'),_0xaeff('0x5d'));var _0x2f3457=path[_0xaeff('0x5e')](config['root'],_0xaeff('0x5f'),_0xaeff('0x5c'),_0xaeff('0x60'));var _0x31f408=path[_0xaeff('0x5e')](_0x119b87,_0x475e60);var _0x59ec68=util[_0xaeff('0x4d')](_0xaeff('0x61'),_0x50005d[_0xaeff('0x2e')]['id'],_0x475e60);var _0x5e63e9=path['join'](_0x119b87,_0x59ec68);var _0x3ed73b=[];_0x3ed73b[_0xaeff('0x62')]({'model':db[_0xaeff('0x63')],'as':_0xaeff('0x63'),'attributes':['id',_0xaeff('0x64')],'raw':!![]});_0x3ed73b['push']({'model':db['CmContact'],'as':_0xaeff('0x65'),'attributes':['id',_0xaeff('0x66'),_0xaeff('0x67')],'raw':!![]});if(_0x50005d['query'][_0xaeff('0x60')]){_0x3ed73b[_0xaeff('0x62')]({'model':db['Attachment'],'as':_0xaeff('0x68'),'raw':!![]});}var _0x49596a=[{'model':db[_0xaeff('0x3f')],'as':_0xaeff('0x69'),'attributes':['id',_0xaeff('0x3c'),_0xaeff('0x6a'),_0xaeff('0x6b'),'secret',_0xaeff('0x6c')],'include':_0x3ed73b}];_0x49596a[_0xaeff('0x62')]({'model':db[_0xaeff('0x6d')],'as':_0xaeff('0x6e'),'attributes':['id','name']});_0x49596a[_0xaeff('0x62')]({'model':db[_0xaeff('0x63')],'as':_0xaeff('0x6f'),'attributes':['id',_0xaeff('0x64')]});return db[_0xaeff('0x24')][_0xaeff('0x39')]({'where':{'id':_0x50005d['params']['id']},'include':_0x49596a})[_0xaeff('0x1c')](handleEntityNotFound(_0x84f026,null))[_0xaeff('0x1c')](function(_0x53fb27){if(_0x53fb27){var _0x27d1cf=_0x53fb27[_0xaeff('0x70')]({'plain':!![]});fs[_0xaeff('0x71')](_0x31f408);var _0x304d44={'channel':_0xaeff('0x72'),'account':_0x27d1cf[_0xaeff('0x6e')][_0xaeff('0x20')],'agent':_0x27d1cf[_0xaeff('0x6f')]?_0x27d1cf[_0xaeff('0x6f')][_0xaeff('0x64')]:_0xaeff('0x73'),'createdAt':moment(_0x27d1cf[_0xaeff('0x6a')])[_0xaeff('0x4d')](_0xaeff('0x4e'))[_0xaeff('0x5a')](),'closedAt':_0x27d1cf[_0xaeff('0x74')]?moment(_0x27d1cf['closedAt'])[_0xaeff('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0xaeff('0x5a')]():'','disposition':_0x27d1cf[_0xaeff('0x75')],'visibility':_0x27d1cf['threadId']?_0xaeff('0x76'):_0xaeff('0x77'),'messages':_(_0x27d1cf['Messages'])['filter']({'secret':![]})['map'](function(_0x4e5849){if(_0x4e5849[_0xaeff('0x68')]){var _0x19b752=path['join'](_0x2f3457,_0x4e5849['Attachment'][_0xaeff('0x78')]);if(fs[_0xaeff('0x79')](_0x19b752)){fs['createReadStream'](_0x19b752)[_0xaeff('0x7a')](fs['createWriteStream'](path[_0xaeff('0x5e')](_0x31f408,_0x4e5849[_0xaeff('0x68')][_0xaeff('0x78')])));}}return{'date':moment(_0x4e5849[_0xaeff('0x6a')])[_0xaeff('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0xaeff('0x5a')](),'sender':_0x4e5849[_0xaeff('0x6b')]===_0xaeff('0x7b')?_0x4e5849[_0xaeff('0x63')]?_0x4e5849[_0xaeff('0x63')][_0xaeff('0x64')]:_0xaeff('0x7c'):_0x4e5849['Contact']['firstName']+(_0x4e5849[_0xaeff('0x65')][_0xaeff('0x67')]?'\x20'+_0x4e5849['Contact']['lastName']:''),'body':_0x4e5849[_0xaeff('0x68')]?_0x4e5849[_0xaeff('0x68')][_0xaeff('0x78')]:_0x4e5849[_0xaeff('0x3c')],'direction':_0x4e5849['direction']===_0xaeff('0x7b')?'A':'C','secret':_0x4e5849[_0xaeff('0x7d')],'read':_0x4e5849[_0xaeff('0x6c')],'attachment':_0x4e5849[_0xaeff('0x68')]};})[_0xaeff('0x7e')]()};return ejs[_0xaeff('0x7f')](path['join'](config[_0xaeff('0x5b')],'server',_0xaeff('0x80'),'downloadInteraction.ejs'),{'interaction':_0x304d44})[_0xaeff('0x1c')](function(_0x2fe3c5){var _0x418e31=path['join'](_0x31f408,_0xaeff('0x81')+_0x27d1cf['id']+'-'+_0x475e60+_0xaeff('0x82'));var _0x5fa8bd={'path':_0x418e31,'channel':_0xaeff('0x72'),'interactionId':_0x27d1cf['id']};return pdf[_0xaeff('0x83')](_0x2fe3c5,_0x5fa8bd);})[_0xaeff('0x1c')](function(){return new Promise(function(_0x23615e,_0x25683b){zipdir(_0x31f408,{'saveTo':_0x5e63e9},function(_0x5eb664,_0x11830b){if(_0x5eb664)return _0x25683b(_0x5eb664);return _0x23615e(_0x11830b);});})['then'](function(){return new Promise(function(_0x1e1c7a,_0x3c7109){rimraf(_0x31f408,function(_0x2c94e5){if(_0x2c94e5)_0x3c7109(_0x2c94e5);return _0x1e1c7a();});});})[_0xaeff('0x1c')](function(){return _0x84f026[_0xaeff('0x59')](_0x5e63e9,_0x59ec68,function(_0x3b5167){if(_0x3b5167){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x3b5167);}else{fs[_0xaeff('0x84')](_0x5e63e9);}});});});}else{return _0x84f026[_0xaeff('0x11')](0xc8);}})['catch'](handleError(_0x84f026,null));}; \ No newline at end of file +var _0x120f=['intersection','fields','attributes','length','include','options','find','create','body','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','Tag','color','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','mkdirSync','Account','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','sendStatus','zip-dir','moment','util','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','map','OpenchannelInteraction','rawAttributes','type','key','getOptions','findAll','openchannel','query','catch','show','from','params','model','keys','filters'];(function(_0x1c573e,_0x57f4fb){var _0x1bc607=function(_0x50d787){while(--_0x50d787){_0x1c573e['push'](_0x1c573e['shift']());}};_0x1bc607(++_0x57f4fb);}(_0x120f,0xd6));var _0xf120=function(_0x2f40e9,_0x1bdddf){_0x2f40e9=_0x2f40e9-0x0;var _0x3ddc69=_0x120f[_0x2f40e9];return _0x3ddc69;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xf120('0x0'));var moment=require(_0xf120('0x1'));var util=require(_0xf120('0x2'));var path=require('path');var ejs=require(_0xf120('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xf120('0x4'));var interaction=require(_0xf120('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0xf120('0x6'));var logger=require(_0xf120('0x7'))(_0xf120('0x8'));var config=require(_0xf120('0x9'));var db=require(_0xf120('0xa'))['db'];config[_0xf120('0xb')]=_[_0xf120('0xc')](config['redis'],{'host':_0xf120('0xd'),'port':0x18eb});var socket=require(_0xf120('0xe'))(new Redis(config[_0xf120('0xb')]));require(_0xf120('0xf'))['register'](socket);function respondWithStatusCode(_0x5c0c09,_0x4e5687){_0x4e5687=_0x4e5687||0xcc;return function(_0x3bbb21){if(_0x3bbb21){return _0x5c0c09['sendStatus'](_0x4e5687);}return _0x5c0c09[_0xf120('0x10')](_0x4e5687)['end']();};}function respondWithResult(_0x2976e0,_0x445291){_0x445291=_0x445291||0xc8;return function(_0x1c09ad){if(_0x1c09ad){return _0x2976e0[_0xf120('0x10')](_0x445291)[_0xf120('0x11')](_0x1c09ad);}};}function respondWithFilteredResult(_0xa7ea9e,_0x5055b8){return function(_0x223565){if(_0x223565){var _0x324e9b=typeof _0x5055b8[_0xf120('0x12')]===_0xf120('0x13')&&typeof _0x5055b8['limit']===_0xf120('0x13');var _0x3a2d7a=_0x223565[_0xf120('0x14')];var _0x2780f2=_0x324e9b?0x0:_0x5055b8[_0xf120('0x12')];var _0x4181fb=_0x324e9b?_0x223565['count']:_0x5055b8[_0xf120('0x12')]+_0x5055b8[_0xf120('0x15')];var _0x51e26a;if(_0x4181fb>=_0x3a2d7a){_0x4181fb=_0x3a2d7a;_0x51e26a=0xc8;}else{_0x51e26a=0xce;}_0xa7ea9e[_0xf120('0x10')](_0x51e26a);return _0xa7ea9e[_0xf120('0x16')](_0xf120('0x17'),_0x2780f2+'-'+_0x4181fb+'/'+_0x3a2d7a)[_0xf120('0x11')](_0x223565);}return null;};}function saveUpdates(_0x1828f4){return function(_0x3bf80b){if(_0x3bf80b){return _0x3bf80b[_0xf120('0x18')](_0x1828f4)[_0xf120('0x19')](function(_0x41778f){return _0x41778f;});}return null;};}function removeEntity(_0x4dfdc2){return function(_0x17f2b6){if(_0x17f2b6){return _0x17f2b6[_0xf120('0x1a')]()['then'](function(){_0x4dfdc2[_0xf120('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5844a7){return function(_0x3e0fcc){if(!_0x3e0fcc){_0x5844a7['sendStatus'](0x194);}return _0x3e0fcc;};}function handleError(_0x47f7e5,_0x3e93dd){_0x3e93dd=_0x3e93dd||0x1f4;return function(_0x401575){logger[_0xf120('0x1b')](_0x401575[_0xf120('0x1c')]);if(_0x401575[_0xf120('0x1d')]){delete _0x401575[_0xf120('0x1d')];}_0x47f7e5[_0xf120('0x10')](_0x3e93dd)['send'](_0x401575);};}exports['index']=function(_0x5f1516,_0x254a43){var _0x52f0fe={};var _0x1bda33=_[_0xf120('0x1e')](db[_0xf120('0x1f')][_0xf120('0x20')],function(_0x179bd6){return{'name':_0x179bd6['fieldName'],'type':_0x179bd6[_0xf120('0x21')][_0xf120('0x22')]};});_0x52f0fe=qs[_0xf120('0x23')](_0x1bda33,_0x5f1516);return interaction[_0xf120('0x24')](_0xf120('0x25'),_0x5f1516[_0xf120('0x26')],_0x5f1516['user'],_0x52f0fe,_0x1bda33)[_0xf120('0x19')](respondWithFilteredResult(_0x254a43,_0x52f0fe))[_0xf120('0x27')](handleError(_0x254a43,null));};exports[_0xf120('0x28')]=function(_0x114be0,_0x2ef494){var _0x4b5e5f={};if(_0x114be0[_0xf120('0x26')]['type']&&_0x114be0[_0xf120('0x26')][_0xf120('0x21')]===_0xf120('0x29')){_0x4b5e5f['from']=_0x114be0[_0xf120('0x2a')]['id'];}else{_0x4b5e5f['id']=_0x114be0['params']['id'];}var _0x4217c5={'raw':![],'where':_0x4b5e5f},_0x985319={};_0x985319[_0xf120('0x2b')]=_['keys'](db[_0xf120('0x1f')][_0xf120('0x20')]);_0x985319[_0xf120('0x26')]=_[_0xf120('0x2c')](_0x114be0[_0xf120('0x26')]);_0x985319[_0xf120('0x2d')]=_[_0xf120('0x2e')](_0x985319[_0xf120('0x2b')],_0x985319['query']);_0x4217c5['attributes']=_['intersection'](_0x985319['model'],qs[_0xf120('0x2f')](_0x114be0[_0xf120('0x26')]['fields']));_0x4217c5[_0xf120('0x30')]=_0x4217c5['attributes'][_0xf120('0x31')]?_0x4217c5[_0xf120('0x30')]:_0x985319['model'];if(_0x114be0[_0xf120('0x26')]['includeAll']){_0x4217c5[_0xf120('0x32')]=[{'all':!![]}];}_0x4217c5=_['merge']({},_0x4217c5,_0x114be0[_0xf120('0x33')]);return db['OpenchannelInteraction'][_0xf120('0x34')](_0x4217c5)['then'](handleEntityNotFound(_0x2ef494,null))[_0xf120('0x19')](respondWithResult(_0x2ef494,null))[_0xf120('0x27')](handleError(_0x2ef494,null));};exports[_0xf120('0x35')]=function(_0x4724df,_0x807304){return db[_0xf120('0x1f')][_0xf120('0x35')](_0x4724df[_0xf120('0x36')],{})[_0xf120('0x19')](respondWithResult(_0x807304,0xc9))[_0xf120('0x27')](handleError(_0x807304,null));};exports[_0xf120('0x18')]=function(_0x359080,_0x4cd755){if(_0x359080[_0xf120('0x36')]['id']){delete _0x359080[_0xf120('0x36')]['id'];}return db[_0xf120('0x1f')]['find']({'where':{'id':_0x359080[_0xf120('0x2a')]['id']}})[_0xf120('0x19')](handleEntityNotFound(_0x4cd755,null))[_0xf120('0x19')](saveUpdates(_0x359080[_0xf120('0x36')],null))[_0xf120('0x19')](respondWithResult(_0x4cd755,null))[_0xf120('0x27')](handleError(_0x4cd755,null));};exports[_0xf120('0x1a')]=function(_0x33ec68,_0x2217e9){return db[_0xf120('0x1f')][_0xf120('0x34')]({'where':{'id':_0x33ec68[_0xf120('0x2a')]['id']}})[_0xf120('0x19')](handleEntityNotFound(_0x2217e9,null))[_0xf120('0x19')](removeEntity(_0x2217e9,null))['catch'](handleError(_0x2217e9,null));};exports[_0xf120('0x37')]=function(_0x48b583,_0x47664e){return db[_0xf120('0x1f')][_0xf120('0x37')]()[_0xf120('0x19')](respondWithResult(_0x47664e,null))[_0xf120('0x27')](handleError(_0x47664e,null));};exports['addMessage']=function(_0x3d0aa2,_0x2209be){return db[_0xf120('0x38')][_0xf120('0x34')]({'where':{'id':_0x3d0aa2[_0xf120('0x2a')]['id']}})[_0xf120('0x19')](handleEntityNotFound(_0x2209be,null))[_0xf120('0x19')](function(_0x58cc95){if(_0x58cc95){return _0x58cc95[_0xf120('0x39')](_0x3d0aa2[_0xf120('0x36')][_0xf120('0x3a')],_[_0xf120('0x3b')](_0x3d0aa2['body'],[_0xf120('0x3a'),'id'])||{});}})[_0xf120('0x19')](respondWithResult(_0x2209be,null))[_0xf120('0x27')](handleError(_0x2209be,null));};exports[_0xf120('0x3c')]=function(_0x3c84d7,_0x17acb0){var _0x5d2978={'raw':![],'where':{}};var _0x49dea8={};var _0xf55a1={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xf120('0x3d')]({'where':{'id':_0x3c84d7[_0xf120('0x2a')]['id']}})[_0xf120('0x19')](handleEntityNotFound(_0x17acb0,null))['then'](function(_0x305939){if(_0x305939){_0x49dea8[_0xf120('0x2b')]=_[_0xf120('0x2c')](db[_0xf120('0x38')][_0xf120('0x20')]);_0x49dea8[_0xf120('0x26')]=_['keys'](_0x3c84d7[_0xf120('0x26')]);_0x49dea8[_0xf120('0x2d')]=_[_0xf120('0x2e')](_0x49dea8[_0xf120('0x2b')],_0x49dea8['query']);_0x5d2978['attributes']=_['intersection'](_0x49dea8['model'],qs[_0xf120('0x2f')](_0x3c84d7['query'][_0xf120('0x2f')]));_0x5d2978[_0xf120('0x30')]=_0x5d2978[_0xf120('0x30')]['length']?_0x5d2978[_0xf120('0x30')]:_0x49dea8[_0xf120('0x2b')];if(!_0x3c84d7[_0xf120('0x26')][_0xf120('0x3e')](_0xf120('0x3f'))){_0x5d2978[_0xf120('0x15')]=qs[_0xf120('0x15')](_0x3c84d7[_0xf120('0x26')][_0xf120('0x15')]);_0x5d2978['offset']=qs[_0xf120('0x12')](_0x3c84d7[_0xf120('0x26')][_0xf120('0x12')]);}_0x5d2978[_0xf120('0x40')]=qs[_0xf120('0x41')](_0x3c84d7[_0xf120('0x26')]['sort']);_0x5d2978[_0xf120('0x42')]=qs[_0xf120('0x2d')](_[_0xf120('0x43')](_0x3c84d7[_0xf120('0x26')],_0x49dea8[_0xf120('0x2d')]));_0x5d2978['where']['OpenchannelInteractionId']=_0x305939['id'];if(_0x3c84d7[_0xf120('0x26')][_0xf120('0x44')]){_0x5d2978[_0xf120('0x42')]=_[_0xf120('0x45')](_0x5d2978['where'],{'$or':_[_0xf120('0x1e')](_0x5d2978[_0xf120('0x30')],function(_0x582a68){var _0xd3acf5={};_0xd3acf5[_0x582a68]={'$like':'%'+_0x3c84d7[_0xf120('0x26')][_0xf120('0x44')]+'%'};return _0xd3acf5;})});}if(_0x3c84d7[_0xf120('0x26')][_0xf120('0x46')]){var _0x3453fb=_0x3c84d7[_0xf120('0x26')][_0xf120('0x46')][_0xf120('0x47')](',');var _0x45a0c4={};_0x45a0c4[_0x3453fb[0x0]]={'$gte':moment(_0x3453fb[0x1])[_0xf120('0x48')](_0xf120('0x49'))};_0x5d2978[_0xf120('0x42')]=_[_0xf120('0x45')](_0x5d2978[_0xf120('0x42')],_0x45a0c4);}_0x5d2978=_['merge']({},_0x5d2978,_0x3c84d7[_0xf120('0x33')]);return db[_0xf120('0x38')][_0xf120('0x14')]({'where':_0x5d2978[_0xf120('0x42')]})['then'](function(_0x591859){_0xf55a1[_0xf120('0x14')]=_0x591859;if(_0x3c84d7[_0xf120('0x26')][_0xf120('0x4a')]){_0x5d2978['include']=[{'all':!![]}];}return db[_0xf120('0x38')][_0xf120('0x24')](_0x5d2978);})[_0xf120('0x19')](function(_0x370256){_0xf55a1[_0xf120('0x4b')]=_0x370256;return _0xf55a1;});}})[_0xf120('0x19')](respondWithFilteredResult(_0x17acb0,_0x5d2978))[_0xf120('0x27')](handleError(_0x17acb0,null));};exports[_0xf120('0x4c')]=function(_0x54a623,_0x6e1ec8){return db[_0xf120('0x1f')][_0xf120('0x34')]({'where':{'id':_0x54a623[_0xf120('0x2a')]['id']}})['then'](handleEntityNotFound(_0x6e1ec8,null))[_0xf120('0x19')](function(_0x18914c){if(_0x18914c){return _0x18914c['setTags'](_0x54a623[_0xf120('0x36')][_0xf120('0x3a')],_[_0xf120('0x3b')](_0x54a623['body'],[_0xf120('0x3a'),'id'])||{})['spread'](function(){return db[_0xf120('0x4d')][_0xf120('0x24')]({'attributes':['id',_0xf120('0x1d'),_0xf120('0x4e')],'where':{'id':_0x54a623[_0xf120('0x36')]['ids']}});})['then'](function(_0x567489){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x54a623[_0xf120('0x2a')]['id']),'tags':_0x567489||[]});return{'id':Number(_0x54a623[_0xf120('0x2a')]['id']),'tags':_0x567489||[]};});}})[_0xf120('0x19')](respondWithResult(_0x6e1ec8,null))['catch'](handleError(_0x6e1ec8,null));};exports['removeTags']=function(_0x5e622d,_0x5e3175){return db[_0xf120('0x1f')][_0xf120('0x34')]({'where':{'id':_0x5e622d[_0xf120('0x2a')]['id']}})[_0xf120('0x19')](handleEntityNotFound(_0x5e3175,null))['then'](function(_0x3459e4){if(_0x3459e4){return _0x3459e4[_0xf120('0x4f')](_0x5e622d['query']['ids']);}})['then'](respondWithStatusCode(_0x5e3175,null))['catch'](handleError(_0x5e3175,null));};exports[_0xf120('0x50')]=function(_0xd5ba5f,_0x2aeb19){var _0x3100e0=moment()['unix']()[_0xf120('0x51')]();var _0x442b7f=path[_0xf120('0x52')](config[_0xf120('0x53')],_0xf120('0x54'),_0xf120('0x55'),_0xf120('0x56'));var _0x213611=path['join'](config[_0xf120('0x53')],_0xf120('0x54'),_0xf120('0x55'),_0xf120('0x57'));var _0x5da41b=path[_0xf120('0x52')](_0x442b7f,_0x3100e0);var _0x88c812=util[_0xf120('0x48')](_0xf120('0x58'),_0xd5ba5f[_0xf120('0x2a')]['id'],_0x3100e0);var _0x4d7da1=path[_0xf120('0x52')](_0x442b7f,_0x88c812);var _0xcbb47b=[];_0xcbb47b[_0xf120('0x59')]({'model':db[_0xf120('0x5a')],'as':_0xf120('0x5a'),'attributes':['id',_0xf120('0x5b')],'raw':!![]});_0xcbb47b[_0xf120('0x59')]({'model':db[_0xf120('0x5c')],'as':_0xf120('0x5d'),'attributes':['id',_0xf120('0x5e'),_0xf120('0x5f')],'raw':!![]});if(_0xd5ba5f[_0xf120('0x26')]['attachments']){_0xcbb47b[_0xf120('0x59')]({'model':db[_0xf120('0x60')],'as':_0xf120('0x60'),'raw':!![]});}var _0x39ed4f=[{'model':db['OpenchannelMessage'],'as':_0xf120('0x61'),'attributes':['id',_0xf120('0x36'),_0xf120('0x62'),_0xf120('0x63'),_0xf120('0x64'),_0xf120('0x65')],'include':_0xcbb47b}];_0x39ed4f['push']({'model':db[_0xf120('0x66')],'as':'Account','attributes':['id',_0xf120('0x1d')]});_0x39ed4f[_0xf120('0x59')]({'model':db['User'],'as':_0xf120('0x67'),'attributes':['id','fullname']});return db[_0xf120('0x1f')][_0xf120('0x34')]({'where':{'id':_0xd5ba5f[_0xf120('0x2a')]['id']},'include':_0x39ed4f})[_0xf120('0x19')](handleEntityNotFound(_0x2aeb19,null))[_0xf120('0x19')](function(_0x2c2131){if(_0x2c2131){var _0x56f7b4=_0x2c2131['get']({'plain':!![]});fs[_0xf120('0x68')](_0x5da41b);var _0x19105b={'channel':'Openchannel','account':_0x56f7b4[_0xf120('0x69')][_0xf120('0x1d')],'agent':_0x56f7b4[_0xf120('0x67')]?_0x56f7b4[_0xf120('0x67')]['fullname']:_0xf120('0x6a'),'createdAt':moment(_0x56f7b4['createdAt'])[_0xf120('0x48')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x56f7b4[_0xf120('0x6b')]?moment(_0x56f7b4[_0xf120('0x6c')])['format'](_0xf120('0x49'))[_0xf120('0x51')]():'','disposition':_0x56f7b4[_0xf120('0x6d')],'visibility':_0x56f7b4[_0xf120('0x6e')]?_0xf120('0x6f'):_0xf120('0x70'),'messages':_(_0x56f7b4['Messages'])[_0xf120('0x44')]({'secret':![]})[_0xf120('0x1e')](function(_0x570542){if(_0x570542['Attachment']){var _0x492cf9=path[_0xf120('0x52')](_0x213611,_0x570542[_0xf120('0x60')][_0xf120('0x71')]);if(fs[_0xf120('0x72')](_0x492cf9)){fs[_0xf120('0x73')](_0x492cf9)[_0xf120('0x74')](fs[_0xf120('0x75')](path[_0xf120('0x52')](_0x5da41b,_0x570542[_0xf120('0x60')][_0xf120('0x71')])));}}return{'date':moment(_0x570542[_0xf120('0x62')])['format'](_0xf120('0x49'))[_0xf120('0x51')](),'sender':_0x570542[_0xf120('0x63')]==='out'?_0x570542[_0xf120('0x5a')]?_0x570542[_0xf120('0x5a')][_0xf120('0x5b')]:'System':_0x570542['Contact'][_0xf120('0x5e')]+(_0x570542[_0xf120('0x5d')][_0xf120('0x5f')]?'\x20'+_0x570542['Contact']['lastName']:''),'body':_0x570542[_0xf120('0x60')]?_0x570542[_0xf120('0x60')][_0xf120('0x71')]:_0x570542['body'],'direction':_0x570542['direction']===_0xf120('0x76')?'A':'C','secret':_0x570542[_0xf120('0x64')],'read':_0x570542[_0xf120('0x65')],'attachment':_0x570542[_0xf120('0x60')]};})[_0xf120('0x77')]()};return ejs[_0xf120('0x78')](path['join'](config[_0xf120('0x53')],_0xf120('0x54'),_0xf120('0x79'),_0xf120('0x7a')),{'interaction':_0x19105b})[_0xf120('0x19')](function(_0x15f6df){var _0x137a73=path[_0xf120('0x52')](_0x5da41b,_0xf120('0x7b')+_0x56f7b4['id']+'-'+_0x3100e0+_0xf120('0x7c'));var _0xa527bf={'path':_0x137a73,'channel':_0xf120('0x7d'),'interactionId':_0x56f7b4['id']};return pdf[_0xf120('0x7e')](_0x15f6df,_0xa527bf);})[_0xf120('0x19')](function(){return new Promise(function(_0x27c152,_0x5093f7){zipdir(_0x5da41b,{'saveTo':_0x4d7da1},function(_0x3a4d4d,_0x1a5867){if(_0x3a4d4d)return _0x5093f7(_0x3a4d4d);return _0x27c152(_0x1a5867);});})[_0xf120('0x19')](function(){return new Promise(function(_0x549b85,_0x13033b){rimraf(_0x5da41b,function(_0x4ab371){if(_0x4ab371)_0x13033b(_0x4ab371);return _0x549b85();});});})['then'](function(){return _0x2aeb19[_0xf120('0x50')](_0x4d7da1,_0x88c812,function(_0x18e3fc){if(_0x18e3fc){logger['error'](_0xf120('0x7f'),_0x18e3fc);}else{fs[_0xf120('0x80')](_0x4d7da1);}});});});}else{return _0x2aeb19[_0xf120('0x81')](0xc8);}})['catch'](handleError(_0x2aeb19,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 47b9c13..b590c00 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 _0x4e38=['Users','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','then','setDataValue'];(function(_0x4f36ca,_0x3b40dc){var _0x5383fb=function(_0x43687d){while(--_0x43687d){_0x4f36ca['push'](_0x4f36ca['shift']());}};_0x5383fb(++_0x3b40dc);}(_0x4e38,0x128));var _0x84e3=function(_0x5f3e50,_0x5d5dba){_0x5f3e50=_0x5f3e50-0x0;var _0x16fd55=_0x4e38[_0x5f3e50];return _0x16fd55;};'use strict';var EventEmitter=require(_0x84e3('0x0'));var OpenchannelInteraction=require(_0x84e3('0x1'))['db'][_0x84e3('0x2')];var OpenchannelMessage=require(_0x84e3('0x1'))['db'][_0x84e3('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x84e3('0x4'),'afterUpdate':_0x84e3('0x5'),'afterDestroy':_0x84e3('0x6')};function emitEvent(_0x449966){return function(_0x176bc7,_0x16c1d8,_0x4d5b16){_0x176bc7[_0x84e3('0x7')]({'attributes':['id'],'raw':!![]})[_0x84e3('0x8')](function(_0x366cd9){_0x176bc7[_0x84e3('0x9')](_0x84e3('0xa'),_0x366cd9['map'](function(_0x125a3c){return{'id':_0x125a3c['id']};}));return OpenchannelMessage[_0x84e3('0xb')]({'where':{'OpenchannelInteractionId':_0x176bc7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x84e3('0x8')](function(_0x1bef7b){_0x176bc7['setDataValue']('unreadMessages',_0x1bef7b[_0x84e3('0xc')]);OpenchannelInteractionEvents[_0x84e3('0xd')](_0x449966+':'+_0x176bc7['id'],_0x176bc7);OpenchannelInteractionEvents[_0x84e3('0xd')](_0x449966,_0x176bc7);_0x4d5b16(null);})[_0x84e3('0xe')](_0x4d5b16(null));};}for(var e in events){if(events[_0x84e3('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x84e3('0x10')](e,emitEvent(event));}}module[_0x84e3('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4d16=['update','remove','getUsers','then','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x32973a,_0x5dbadb){var _0x5759c2=function(_0x4b9935){while(--_0x4b9935){_0x32973a['push'](_0x32973a['shift']());}};_0x5759c2(++_0x5dbadb);}(_0x4d16,0x1d7));var _0x64d1=function(_0x1a02dd,_0x3780ab){_0x1a02dd=_0x1a02dd-0x0;var _0x39ad99=_0x4d16[_0x1a02dd];return _0x39ad99;};'use strict';var EventEmitter=require(_0x64d1('0x0'));var OpenchannelInteraction=require(_0x64d1('0x1'))['db'][_0x64d1('0x2')];var OpenchannelMessage=require(_0x64d1('0x1'))['db'][_0x64d1('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x64d1('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x64d1('0x5'),'afterDestroy':_0x64d1('0x6')};function emitEvent(_0xc9244){return function(_0x117d35,_0xcac7b8,_0x3007d7){_0x117d35[_0x64d1('0x7')]({'attributes':['id'],'raw':!![]})[_0x64d1('0x8')](function(_0x5159d2){_0x117d35['setDataValue']('Users',_0x5159d2[_0x64d1('0x9')](function(_0x25a3e6){return{'id':_0x25a3e6['id']};}));return OpenchannelMessage[_0x64d1('0xa')]({'where':{'OpenchannelInteractionId':_0x117d35['id'],'direction':'in','read':![]},'raw':!![]});})[_0x64d1('0x8')](function(_0x100d33){_0x117d35[_0x64d1('0xb')](_0x64d1('0xc'),_0x100d33[_0x64d1('0xd')]);OpenchannelInteractionEvents[_0x64d1('0xe')](_0xc9244+':'+_0x117d35['id'],_0x117d35);OpenchannelInteractionEvents[_0x64d1('0xe')](_0xc9244,_0x117d35);_0x3007d7(null);})['catch'](_0x3007d7(null));};}for(var e in events){if(events[_0x64d1('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x64d1('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 26ed8bb..4dd6589 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 _0xf43e=['utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf43e,0x66));var _0xef43=function(_0x12d93e,_0x8c48d3){_0x12d93e=_0x12d93e-0x0;var _0x3ed0f6=_0xf43e[_0x12d93e];return _0x3ed0f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xef43('0x0'))(_0xef43('0x1'));var moment=require(_0xef43('0x2'));var BPromise=require(_0xef43('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xef43('0x4'));var config=require('../../config/environment');var attributes=require(_0xef43('0x5'));module[_0xef43('0x6')]=function(_0x52e98a,_0x2f4024){return _0x52e98a[_0xef43('0x7')](_0xef43('0x8'),attributes,{'tableName':_0xef43('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xef43('0xa'),'collate':_0xef43('0xb'),'hooks':{'beforeUpdate':function(_0x4206e8,_0x21970a,_0x2cf803){if(_0x4206e8[_0xef43('0xc')]('closed')){_0x4206e8[_0xef43('0xd')]=moment()[_0xef43('0xe')](_0xef43('0xf'));}_0x2cf803(null,_0x4206e8);}}});}; \ No newline at end of file +var _0x13c5=['YYYY-MM-DD\x20HH:mm:ss','lodash','path','./openchannelInteraction.attributes','exports','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format'];(function(_0x4c60e4,_0x438e6a){var _0x30258d=function(_0x263b9c){while(--_0x263b9c){_0x4c60e4['push'](_0x4c60e4['shift']());}};_0x30258d(++_0x438e6a);}(_0x13c5,0x7a));var _0x513c=function(_0x36c2e9,_0x5bfe05){_0x36c2e9=_0x36c2e9-0x0;var _0x4acbbc=_0x13c5[_0x36c2e9];return _0x4acbbc;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x513c('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x513c('0x2'));module[_0x513c('0x3')]=function(_0x982017,_0x2ad2db){return _0x982017['define']('OpenchannelInteraction',attributes,{'tableName':_0x513c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x513c('0x5'),'collate':_0x513c('0x6'),'hooks':{'beforeUpdate':function(_0x414e01,_0x42af7b,_0x3126f2){if(_0x414e01[_0x513c('0x7')](_0x513c('0x8'))){_0x414e01['closedAt']=moment()[_0x513c('0x9')](_0x513c('0xa'));}_0x3126f2(null,_0x414e01);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 8d3e6d8..8eead23 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 _0x0c97=['message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0x0c97,0x150));var _0x70c9=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x0c97[_0x5756f8];return _0x3bb749;};'use strict';var _=require(_0x70c9('0x0'));var util=require('util');var moment=require(_0x70c9('0x1'));var BPromise=require('bluebird');var rs=require(_0x70c9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70c9('0x3'))['db'];var utils=require(_0x70c9('0x4'));var logger=require(_0x70c9('0x5'))(_0x70c9('0x6'));var config=require(_0x70c9('0x7'));var jayson=require(_0x70c9('0x8'));var client=jayson[_0x70c9('0x9')][_0x70c9('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x70c9('0xb')],{'host':_0x70c9('0xc'),'port':0x18eb});var socket=require(_0x70c9('0xd'))(new Redis(config[_0x70c9('0xb')]));require(_0x70c9('0xe'))[_0x70c9('0xf')](socket);function respondWithRpcPromise(_0x352f1b,_0x4c810d,_0x387e77){return new BPromise(function(_0x421e1c,_0x9fd640){return client[_0x70c9('0x10')](_0x352f1b,_0x387e77)[_0x70c9('0x11')](function(_0x39ee18){logger[_0x70c9('0x12')](_0x70c9('0x13'),_0x4c810d,_0x70c9('0x14'));logger[_0x70c9('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4c810d,'request\x20sent',JSON[_0x70c9('0x16')](_0x39ee18));if(_0x39ee18['error']){if(_0x39ee18[_0x70c9('0x17')]['code']===0x1f4){logger[_0x70c9('0x17')](_0x70c9('0x13'),_0x4c810d,_0x39ee18[_0x70c9('0x17')][_0x70c9('0x18')]);return _0x9fd640(_0x39ee18['error'][_0x70c9('0x18')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4c810d,_0x39ee18[_0x70c9('0x17')]['message']);return _0x421e1c(_0x39ee18[_0x70c9('0x17')][_0x70c9('0x18')]);}else{logger[_0x70c9('0x12')](_0x70c9('0x13'),_0x4c810d,_0x70c9('0x14'));_0x421e1c(_0x39ee18['result'][_0x70c9('0x18')]);}})[_0x70c9('0x19')](function(_0x2530be){logger[_0x70c9('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4c810d,_0x2530be);_0x9fd640(_0x2530be);});});}exports[_0x70c9('0x1a')]=function(_0x52686f){var _0x4102fc=this;return new Promise(function(_0x1c5ee6,_0x148998){return db[_0x70c9('0x1b')][_0x70c9('0x1c')](_0x52686f[_0x70c9('0x1d')],{'raw':_0x52686f[_0x70c9('0x1e')]?_0x52686f[_0x70c9('0x1e')][_0x70c9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52686f['options']?_0x52686f[_0x70c9('0x1e')][_0x70c9('0x20')]||null:null,'attributes':_0x52686f[_0x70c9('0x1e')]?_0x52686f[_0x70c9('0x1e')]['attributes']||null:null,'limit':_0x52686f[_0x70c9('0x1e')]?_0x52686f[_0x70c9('0x1e')][_0x70c9('0x21')]||null:null})['then'](function(_0x29b688){logger[_0x70c9('0x12')](_0x70c9('0x1a'),_0x52686f);logger[_0x70c9('0x15')](_0x70c9('0x1a'),_0x52686f,JSON[_0x70c9('0x16')](_0x29b688));_0x1c5ee6(_0x29b688);})[_0x70c9('0x19')](function(_0x17a524){logger[_0x70c9('0x17')](_0x70c9('0x1a'),_0x17a524[_0x70c9('0x18')],_0x52686f);_0x148998(_0x4102fc['error'](0x1f4,_0x17a524[_0x70c9('0x18')]));});});};exports[_0x70c9('0x22')]=function(_0x1ef361){return new Promise(function(_0x5340b5,_0xcb6b6d){return db['OpenchannelInteraction'][_0x70c9('0x23')]({'where':_0x1ef361[_0x70c9('0x1e')]?_0x1ef361['options'][_0x70c9('0x20')]||null:null})['then'](function(_0x4ba303){if(_0x4ba303){return _0x4ba303[_0x70c9('0x24')](_0x1ef361['body'][_0x70c9('0x25')],_['omit'](_0x1ef361[_0x70c9('0x1d')],[_0x70c9('0x25'),'id'])||{});}})[_0x70c9('0x26')](function(_0x5d3b1a){logger[_0x70c9('0x12')](_0x70c9('0x27'),_0x1ef361);logger[_0x70c9('0x15')](_0x70c9('0x27'),_0x1ef361,JSON[_0x70c9('0x16')](_0x5d3b1a));_0x5340b5(_0x5d3b1a);})[_0x70c9('0x19')](function(_0x4b8904){logger[_0x70c9('0x17')]('AddTags',_0x4b8904[_0x70c9('0x18')],_0x1ef361);_0xcb6b6d(_this[_0x70c9('0x17')](0x1f4,_0x4b8904[_0x70c9('0x18')]));});});}; \ No newline at end of file +var _0x241f=['find','addTags','body','ids','omit','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','OpenchannelInteraction','update','options','where','attributes','UpdateOpenchannelInteraction','debug','AddTagsToOpenchannelInteraction'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x241f,0x1e6));var _0xf241=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0x241f[_0x75ce5b];return _0x22195e;};'use strict';var _=require(_0xf241('0x0'));var util=require('util');var moment=require(_0xf241('0x1'));var BPromise=require('bluebird');var rs=require(_0xf241('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf241('0x3'))['db'];var utils=require(_0xf241('0x4'));var logger=require(_0xf241('0x5'))(_0xf241('0x6'));var config=require(_0xf241('0x7'));var jayson=require(_0xf241('0x8'));var client=jayson['client'][_0xf241('0x9')]({'port':0x232a});config[_0xf241('0xa')]=_[_0xf241('0xb')](config[_0xf241('0xa')],{'host':_0xf241('0xc'),'port':0x18eb});var socket=require(_0xf241('0xd'))(new Redis(config['redis']));require(_0xf241('0xe'))['register'](socket);function respondWithRpcPromise(_0x49619a,_0x55340c,_0x2753d8){return new BPromise(function(_0x95fe4b,_0x4852b9){return client[_0xf241('0xf')](_0x49619a,_0x2753d8)[_0xf241('0x10')](function(_0x3306f1){logger[_0xf241('0x11')](_0xf241('0x12'),_0x55340c,_0xf241('0x13'));logger['debug'](_0xf241('0x14'),_0x55340c,_0xf241('0x13'),JSON[_0xf241('0x15')](_0x3306f1));if(_0x3306f1[_0xf241('0x16')]){if(_0x3306f1[_0xf241('0x16')][_0xf241('0x17')]===0x1f4){logger[_0xf241('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x55340c,_0x3306f1[_0xf241('0x16')][_0xf241('0x18')]);return _0x4852b9(_0x3306f1[_0xf241('0x16')][_0xf241('0x18')]);}logger[_0xf241('0x16')](_0xf241('0x12'),_0x55340c,_0x3306f1[_0xf241('0x16')][_0xf241('0x18')]);return _0x95fe4b(_0x3306f1[_0xf241('0x16')]['message']);}else{logger['info'](_0xf241('0x12'),_0x55340c,'request\x20sent');_0x95fe4b(_0x3306f1['result']['message']);}})[_0xf241('0x19')](function(_0x4f95bf){logger[_0xf241('0x16')](_0xf241('0x12'),_0x55340c,_0x4f95bf);_0x4852b9(_0x4f95bf);});});}exports['UpdateOpenchannelInteraction']=function(_0x578b12){var _0x1b5f78=this;return new Promise(function(_0x4dc6b9,_0x5095aa){return db[_0xf241('0x1a')][_0xf241('0x1b')](_0x578b12['body'],{'raw':_0x578b12[_0xf241('0x1c')]?_0x578b12[_0xf241('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x578b12[_0xf241('0x1c')]?_0x578b12[_0xf241('0x1c')][_0xf241('0x1d')]||null:null,'attributes':_0x578b12[_0xf241('0x1c')]?_0x578b12[_0xf241('0x1c')][_0xf241('0x1e')]||null:null,'limit':_0x578b12[_0xf241('0x1c')]?_0x578b12[_0xf241('0x1c')]['limit']||null:null})[_0xf241('0x10')](function(_0x4a9ecd){logger[_0xf241('0x11')](_0xf241('0x1f'),_0x578b12);logger[_0xf241('0x20')]('UpdateOpenchannelInteraction',_0x578b12,JSON[_0xf241('0x15')](_0x4a9ecd));_0x4dc6b9(_0x4a9ecd);})[_0xf241('0x19')](function(_0x2ae04e){logger[_0xf241('0x16')](_0xf241('0x1f'),_0x2ae04e['message'],_0x578b12);_0x5095aa(_0x1b5f78[_0xf241('0x16')](0x1f4,_0x2ae04e['message']));});});};exports[_0xf241('0x21')]=function(_0x4a5198){return new Promise(function(_0x2b9757,_0x21ca84){return db[_0xf241('0x1a')][_0xf241('0x22')]({'where':_0x4a5198[_0xf241('0x1c')]?_0x4a5198[_0xf241('0x1c')][_0xf241('0x1d')]||null:null})['then'](function(_0x368d12){if(_0x368d12){return _0x368d12[_0xf241('0x23')](_0x4a5198[_0xf241('0x24')][_0xf241('0x25')],_[_0xf241('0x26')](_0x4a5198[_0xf241('0x24')],[_0xf241('0x25'),'id'])||{});}})['spread'](function(_0x4e9bdb){logger['info'](_0xf241('0x27'),_0x4a5198);logger[_0xf241('0x20')](_0xf241('0x27'),_0x4a5198,JSON[_0xf241('0x15')](_0x4e9bdb));_0x2b9757(_0x4e9bdb);})[_0xf241('0x19')](function(_0x12841a){logger[_0xf241('0x16')]('AddTags',_0x12841a[_0xf241('0x18')],_0x4a5198);_0x21ca84(_this[_0xf241('0x16')](0x1f4,_0x12841a[_0xf241('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 253fb29..d3e0ea4 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 _0xa41e=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0xa41e,0x64));var _0xea41=function(_0xc1bb9c,_0x5bb45e){_0xc1bb9c=_0xc1bb9c-0x0;var _0xcbceba=_0xa41e[_0xc1bb9c];return _0xcbceba;};'use strict';var OpenchannelInteractionEvents=require(_0xea41('0x0'));var events=[_0xea41('0x1'),_0xea41('0x2'),'update'];function createListener(_0x2ed460,_0x413f15){return function(_0x32eac7){_0x413f15[_0xea41('0x3')](_0x2ed460,_0x32eac7);};}function removeListener(_0x4c8129,_0x426a17){return function(){OpenchannelInteractionEvents[_0xea41('0x4')](_0x4c8129,_0x426a17);};}exports[_0xea41('0x5')]=function(_0x14d67d){for(var _0x5706d3=0x0,_0x11bc64=events[_0xea41('0x6')];_0x5706d3<_0x11bc64;_0x5706d3++){var _0x3e738b=events[_0x5706d3];var _0xc2f212=createListener(_0xea41('0x7')+_0x3e738b,_0x14d67d);OpenchannelInteractionEvents['on'](_0x3e738b,_0xc2f212);}}; \ No newline at end of file +var _0x8cc5=['remove','removeListener','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x3924b1,_0x1ab6ec){var _0x25faf8=function(_0x5bfd54){while(--_0x5bfd54){_0x3924b1['push'](_0x3924b1['shift']());}};_0x25faf8(++_0x1ab6ec);}(_0x8cc5,0x9e));var _0x58cc=function(_0x35595a,_0x48679f){_0x35595a=_0x35595a-0x0;var _0x4fc462=_0x8cc5[_0x35595a];return _0x4fc462;};'use strict';var OpenchannelInteractionEvents=require(_0x58cc('0x0'));var events=[_0x58cc('0x1'),_0x58cc('0x2'),'update'];function createListener(_0x17f98e,_0x82d5ff){return function(_0x451111){_0x82d5ff['emit'](_0x17f98e,_0x451111);};}function removeListener(_0x209ce9,_0x2720f9){return function(){OpenchannelInteractionEvents[_0x58cc('0x3')](_0x209ce9,_0x2720f9);};}exports['register']=function(_0x5d1420){for(var _0x132ba9=0x0,_0xf1f287=events['length'];_0x132ba9<_0xf1f287;_0x132ba9++){var _0x2fefa2=events[_0x132ba9];var _0x176e61=createListener(_0x58cc('0x4')+_0x2fefa2,_0x5d1420);OpenchannelInteractionEvents['on'](_0x2fefa2,_0x176e61);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 46c7344..50efe20 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(_0x356c18,_0x4d01e8){var _0x545a18=function(_0x42701f){while(--_0x42701f){_0x356c18['push'](_0x356c18['shift']());}};_0x545a18(++_0x4d01e8);}(_0xedd9,0xfc));var _0x9edd=function(_0x25140e,_0x256029){_0x25140e=_0x25140e-0x0;var _0x157586=_0xedd9[_0x25140e];return _0x157586;};'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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x40bc32,_0x428c83){var _0x2351e3=function(_0x3ba9f0){while(--_0x3ba9f0){_0x40bc32['push'](_0x40bc32['shift']());}};_0x2351e3(++_0x428c83);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0xcb91[_0x136a0d];return _0x212ea5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 013d9fa..fe9f732 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 _0xe5b5=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5dff0c,_0x2bdeb4){var _0x15615f=function(_0x22956e){while(--_0x22956e){_0x5dff0c['push'](_0x5dff0c['shift']());}};_0x15615f(++_0x2bdeb4);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0xe5b5[_0xb5fc3e];return _0x2efc3c;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'body':{'type':Sequelize[_0x5e5b('0x2')](_0x5e5b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5e5b('0x5')]('in',_0x5e5b('0x6')),'defaultValue':_0x5e5b('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5e5b('0x7')]},'providerName':{'type':Sequelize[_0x5e5b('0x8')]},'providerResponse':{'type':Sequelize[_0x5e5b('0x2')]}}; \ No newline at end of file +var _0x97c1=['exports','medium','ENUM','out','DATE','STRING','sequelize'];(function(_0x54d949,_0x13d6da){var _0x58e6a1=function(_0x2716ee){while(--_0x2716ee){_0x54d949['push'](_0x54d949['shift']());}};_0x58e6a1(++_0x13d6da);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x197c('0x0'));module[_0x197c('0x1')]={'body':{'type':Sequelize['TEXT'](_0x197c('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x197c('0x3')]('in',_0x197c('0x4')),'defaultValue':_0x197c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x197c('0x5')]},'providerName':{'type':Sequelize[_0x197c('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index dfdb52b..169a2cd 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 _0x8ffc=['VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','find','create','body','update','params','destroy','describe','openchannel','acceptMessage','reject','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','get','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','format','SIP/%s','channel','motionChannel','event','EventManager','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','http','client','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','undefined','limit','count','status','set','Content-Range','end','sendStatus','name','send','index','OpenchannelMessage','fieldName','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge'];(function(_0x6ae3f1,_0x328976){var _0x3ce5fd=function(_0x5d908a){while(--_0x5d908a){_0x6ae3f1['push'](_0x6ae3f1['shift']());}};_0x3ce5fd(++_0x328976);}(_0x8ffc,0x1bc));var _0xc8ff=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x8ffc[_0x139a3c];return _0x2b375b;};'use strict';var util=require(_0xc8ff('0x0'));var _=require(_0xc8ff('0x1'));var Redis=require(_0xc8ff('0x2'));var interactionService=require(_0xc8ff('0x3'));var qs=require(_0xc8ff('0x4'));var logger=require(_0xc8ff('0x5'))('api');var config=require(_0xc8ff('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc8ff('0x7')](config['redis'],{'host':_0xc8ff('0x8'),'port':0x18eb});var socket=require(_0xc8ff('0x9'))(new Redis(config[_0xc8ff('0xa')]));require('./openchannelMessage.socket')[_0xc8ff('0xb')](socket);var jayson=require(_0xc8ff('0xc'));var client=jayson['client'][_0xc8ff('0xd')]({'port':0x232c});var client9002=jayson[_0xc8ff('0xe')]['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0xc8ff('0xf'));function respondWithRpcPromise(_0x398669,_0x1ec9e1,_0x5e4215,_0x580805){return new Promise(function(_0x379616,_0x1e0012){var _0x5d1826=_0x580805||client;return _0x5d1826[_0xc8ff('0x10')](_0x398669,_0x5e4215)[_0xc8ff('0x11')](function(_0x35c771){logger[_0xc8ff('0x12')](_0xc8ff('0x13'),_0x1ec9e1,_0xc8ff('0x14'));logger[_0xc8ff('0x15')](_0xc8ff('0x16'),_0x1ec9e1,_0xc8ff('0x14'),JSON[_0xc8ff('0x17')](_0x35c771));if(_0x35c771[_0xc8ff('0x18')]){if(_0x35c771[_0xc8ff('0x18')][_0xc8ff('0x19')]===0x1f4){logger[_0xc8ff('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x1ec9e1,_0x35c771[_0xc8ff('0x18')][_0xc8ff('0x1a')]);return _0x1e0012(_0x35c771[_0xc8ff('0x18')][_0xc8ff('0x1a')]);}logger[_0xc8ff('0x18')](_0xc8ff('0x13'),_0x1ec9e1,_0x35c771['error']['message']);return _0x379616(_0x35c771[_0xc8ff('0x18')]['message']);}else{logger['info'](_0xc8ff('0x13'),_0x1ec9e1,_0xc8ff('0x14'));_0x379616(_0x35c771[_0xc8ff('0x1b')][_0xc8ff('0x1a')]);}})[_0xc8ff('0x1c')](function(_0x528f68){logger[_0xc8ff('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x1ec9e1,_0x528f68);_0x1e0012(_0x528f68);});});}function respondWithResult(_0x1ec93e,_0x19b28e){_0x19b28e=_0x19b28e||0xc8;return function(_0x359dad){if(_0x359dad){return _0x1ec93e['status'](_0x19b28e)[_0xc8ff('0x1d')](_0x359dad);}};}function respondWithFilteredResult(_0x265770,_0x297a0d){return function(_0x2e73ec){if(_0x2e73ec){var _0x1831f8=typeof _0x297a0d['offset']===_0xc8ff('0x1e')&&typeof _0x297a0d[_0xc8ff('0x1f')]===_0xc8ff('0x1e');var _0x198aec=_0x2e73ec['count'];var _0x9c2a89=_0x1831f8?0x0:_0x297a0d['offset'];var _0x58eac9=_0x1831f8?_0x2e73ec[_0xc8ff('0x20')]:_0x297a0d['offset']+_0x297a0d[_0xc8ff('0x1f')];var _0x5ea0ac;if(_0x58eac9>=_0x198aec){_0x58eac9=_0x198aec;_0x5ea0ac=0xc8;}else{_0x5ea0ac=0xce;}_0x265770[_0xc8ff('0x21')](_0x5ea0ac);return _0x265770[_0xc8ff('0x22')](_0xc8ff('0x23'),_0x9c2a89+'-'+_0x58eac9+'/'+_0x198aec)[_0xc8ff('0x1d')](_0x2e73ec);}return null;};}function saveUpdates(_0x476a82){return function(_0x57f0fb){if(_0x57f0fb){return _0x57f0fb['update'](_0x476a82)[_0xc8ff('0x11')](function(_0x187668){return _0x187668;});}return null;};}function removeEntity(_0x20eead){return function(_0x194fe8){if(_0x194fe8){return _0x194fe8['destroy']()[_0xc8ff('0x11')](function(){_0x20eead['status'](0xcc)[_0xc8ff('0x24')]();});}};}function handleEntityNotFound(_0x543fe2){return function(_0x1ae286){if(!_0x1ae286){_0x543fe2[_0xc8ff('0x25')](0x194);}return _0x1ae286;};}function handleError(_0x4dd56c,_0x4769ae){_0x4769ae=_0x4769ae||0x1f4;return function(_0x18c877){logger['error'](_0x18c877['stack']);if(_0x18c877[_0xc8ff('0x26')]){delete _0x18c877['name'];}_0x4dd56c[_0xc8ff('0x21')](_0x4769ae)[_0xc8ff('0x27')](_0x18c877);};}exports[_0xc8ff('0x28')]=function(_0x112869,_0x26ac24){var _0x5ed1dd={},_0x116b95={},_0x5c568c={'count':0x0,'rows':[]};var _0x48605c=_['map'](db[_0xc8ff('0x29')]['rawAttributes'],function(_0x18942e){return{'name':_0x18942e[_0xc8ff('0x2a')],'type':_0x18942e['type'][_0xc8ff('0x2b')]};});_0x116b95[_0xc8ff('0x2c')]=_[_0xc8ff('0x2d')](_0x48605c,_0xc8ff('0x26'));_0x116b95['query']=_[_0xc8ff('0x2e')](_0x112869['query']);_0x116b95[_0xc8ff('0x2f')]=_['intersection'](_0x116b95[_0xc8ff('0x2c')],_0x116b95[_0xc8ff('0x30')]);_0x5ed1dd[_0xc8ff('0x31')]=_[_0xc8ff('0x32')](_0x116b95['model'],qs['fields'](_0x112869[_0xc8ff('0x30')][_0xc8ff('0x33')]));_0x5ed1dd[_0xc8ff('0x31')]=_0x5ed1dd[_0xc8ff('0x31')][_0xc8ff('0x34')]?_0x5ed1dd[_0xc8ff('0x31')]:_0x116b95[_0xc8ff('0x2c')];if(!_0x112869[_0xc8ff('0x30')][_0xc8ff('0x35')](_0xc8ff('0x36'))){_0x5ed1dd[_0xc8ff('0x1f')]=qs[_0xc8ff('0x1f')](_0x112869[_0xc8ff('0x30')][_0xc8ff('0x1f')]);_0x5ed1dd[_0xc8ff('0x37')]=qs[_0xc8ff('0x37')](_0x112869[_0xc8ff('0x30')]['offset']);}_0x5ed1dd[_0xc8ff('0x38')]=qs['sort'](_0x112869[_0xc8ff('0x30')][_0xc8ff('0x39')]);_0x5ed1dd['where']=qs[_0xc8ff('0x2f')](_[_0xc8ff('0x3a')](_0x112869[_0xc8ff('0x30')],_0x116b95[_0xc8ff('0x2f')]),_0x48605c);if(_0x112869['query']['filter']){_0x5ed1dd[_0xc8ff('0x3b')]=_[_0xc8ff('0x3c')](_0x5ed1dd[_0xc8ff('0x3b')],{'$or':_[_0xc8ff('0x2d')](_0x48605c,function(_0x547fd9){if(_0x547fd9['type']!==_0xc8ff('0x3d')){var _0x19f1de={};_0x19f1de[_0x547fd9[_0xc8ff('0x26')]]={'$like':'%'+_0x112869[_0xc8ff('0x30')]['filter']+'%'};return _0x19f1de;}})});}_0x5ed1dd=_[_0xc8ff('0x3c')]({},_0x5ed1dd,_0x112869[_0xc8ff('0x3e')]);var _0x3b06f7={'where':_0x5ed1dd['where']};return db[_0xc8ff('0x29')][_0xc8ff('0x20')](_0x3b06f7)['then'](function(_0x3adc39){_0x5c568c[_0xc8ff('0x20')]=_0x3adc39;if(_0x112869[_0xc8ff('0x30')][_0xc8ff('0x3f')]){_0x5ed1dd['include']=[{'all':!![]}];}return db[_0xc8ff('0x29')][_0xc8ff('0x40')](_0x5ed1dd);})[_0xc8ff('0x11')](function(_0x32465d){_0x5c568c[_0xc8ff('0x41')]=_0x32465d;return _0x5c568c;})['then'](respondWithFilteredResult(_0x26ac24,_0x5ed1dd))[_0xc8ff('0x1c')](handleError(_0x26ac24,null));};exports[_0xc8ff('0x42')]=function(_0xcb0b39,_0x5558a1){var _0x1d4fdd={'raw':!![],'where':{'id':_0xcb0b39['params']['id']}},_0x3de956={};_0x3de956[_0xc8ff('0x2c')]=_['keys'](db[_0xc8ff('0x29')][_0xc8ff('0x43')]);_0x3de956[_0xc8ff('0x30')]=_[_0xc8ff('0x2e')](_0xcb0b39[_0xc8ff('0x30')]);_0x3de956[_0xc8ff('0x2f')]=_[_0xc8ff('0x32')](_0x3de956[_0xc8ff('0x2c')],_0x3de956[_0xc8ff('0x30')]);_0x1d4fdd[_0xc8ff('0x31')]=_[_0xc8ff('0x32')](_0x3de956['model'],qs['fields'](_0xcb0b39[_0xc8ff('0x30')][_0xc8ff('0x33')]));_0x1d4fdd['attributes']=_0x1d4fdd['attributes']['length']?_0x1d4fdd[_0xc8ff('0x31')]:_0x3de956[_0xc8ff('0x2c')];if(_0xcb0b39[_0xc8ff('0x30')][_0xc8ff('0x3f')]){_0x1d4fdd['include']=[{'all':!![]}];}_0x1d4fdd=_[_0xc8ff('0x3c')]({},_0x1d4fdd,_0xcb0b39[_0xc8ff('0x3e')]);return db[_0xc8ff('0x29')][_0xc8ff('0x44')](_0x1d4fdd)['then'](handleEntityNotFound(_0x5558a1,null))['then'](respondWithResult(_0x5558a1,null))[_0xc8ff('0x1c')](handleError(_0x5558a1,null));};exports['create']=function(_0x102e86,_0x17bb16){return db[_0xc8ff('0x29')][_0xc8ff('0x45')](_0x102e86[_0xc8ff('0x46')],{})[_0xc8ff('0x11')](respondWithResult(_0x17bb16,0xc9))['catch'](handleError(_0x17bb16,null));};exports[_0xc8ff('0x47')]=function(_0x19768b,_0x344018){if(_0x19768b[_0xc8ff('0x46')]['id']){delete _0x19768b['body']['id'];}return db[_0xc8ff('0x29')][_0xc8ff('0x44')]({'where':{'id':_0x19768b[_0xc8ff('0x48')]['id']}})[_0xc8ff('0x11')](handleEntityNotFound(_0x344018,null))[_0xc8ff('0x11')](saveUpdates(_0x19768b[_0xc8ff('0x46')],null))[_0xc8ff('0x11')](respondWithResult(_0x344018,null))['catch'](handleError(_0x344018,null));};exports[_0xc8ff('0x49')]=function(_0x50505f,_0x3606fe){return db['OpenchannelMessage'][_0xc8ff('0x44')]({'where':{'id':_0x50505f['params']['id']}})[_0xc8ff('0x11')](handleEntityNotFound(_0x3606fe,null))[_0xc8ff('0x11')](removeEntity(_0x3606fe,null))[_0xc8ff('0x1c')](handleError(_0x3606fe,null));};exports[_0xc8ff('0x4a')]=function(_0x1883c5,_0x1bddce){return db[_0xc8ff('0x29')][_0xc8ff('0x4a')]()[_0xc8ff('0x11')](respondWithResult(_0x1bddce,null))[_0xc8ff('0x1c')](handleError(_0x1bddce,null));};exports['accept']=function(_0x13a482,_0x45513b){var _0x2e683b=_0xc8ff('0x4b');return interactionService[_0xc8ff('0x4c')](_0x13a482,_0x2e683b)['then'](respondWithResult(_0x45513b,null))['catch'](handleError(_0x45513b,null));};exports[_0xc8ff('0x4d')]=function(_0x4fc68b,_0x238e91){var _0x42fb31={'agent':{},'channel':_0xc8ff('0x4b')};if(_0x4fc68b[_0xc8ff('0x46')]['id']){delete _0x4fc68b[_0xc8ff('0x46')]['id'];}_0x4fc68b['body'][_0xc8ff('0x4e')]=_0x4fc68b[_0xc8ff('0x46')][_0xc8ff('0x4e')]||_0x4fc68b[_0xc8ff('0x4f')]['id'];_0x42fb31[_0xc8ff('0x50')]['id']=_0x4fc68b[_0xc8ff('0x46')][_0xc8ff('0x4e')];return db['OpenchannelMessage'][_0xc8ff('0x44')]({'where':{'id':_0x4fc68b[_0xc8ff('0x48')]['id'],'UserId':null}})[_0xc8ff('0x11')](handleEntityNotFound(_0x238e91,null))['then'](function(_0x1e5e5a){if(_0x1e5e5a){_0x42fb31['message']=_0x1e5e5a['get']({'plain':!![]});return db[_0xc8ff('0x51')]['find']({'where':{'id':_0x1e5e5a[_0xc8ff('0x52')]}});}return null;})[_0xc8ff('0x11')](handleEntityNotFound(_0x238e91,null))[_0xc8ff('0x11')](function(_0xe12d76){if(_0xe12d76){_0x42fb31[_0xc8ff('0x53')]=_0xe12d76[_0xc8ff('0x54')]({'plain':!![]});interaction_log[_0xc8ff('0x12')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4fc68b['user']['id'],_0x4fc68b[_0xc8ff('0x4f')]['name'],_0x4fc68b[_0xc8ff('0x4f')]['role'],_0x42fb31[_0xc8ff('0x53')]['id'],_0x4fc68b[_0xc8ff('0x46')]?JSON[_0xc8ff('0x17')](_0x4fc68b[_0xc8ff('0x46')]):_0xc8ff('0x55'));return respondWithRpcPromise(_0xc8ff('0x56'),'rejectMessage',_0x42fb31);}return null;})['then'](function(_0x4cdae0){var _0x218c18=_0xc8ff('0x57')+_0x4cdae0[_0xc8ff('0x1a')][_0xc8ff('0x58')];return db[_0xc8ff('0x59')][_0xc8ff('0x30')](_0x218c18,{'type':db[_0xc8ff('0x5a')][_0xc8ff('0x5b')]['SELECT'],'raw':!![]})[_0xc8ff('0x11')](function(_0x9071d3){return _0x9071d3;});})['then'](function(_0x2ee6d3){if(_0x2ee6d3){_0x42fb31['message']['contact']=_0x2ee6d3[0x0];if(!_0x4fc68b[_0xc8ff('0x46')][_0xc8ff('0x4e')])return;return db[_0xc8ff('0x5c')][_0xc8ff('0x44')]({'where':{'id':_0x4fc68b[_0xc8ff('0x46')][_0xc8ff('0x4e')],'role':_0xc8ff('0x50')},'attributes':['id',_0xc8ff('0x26'),_0xc8ff('0x5d'),_0xc8ff('0x5e'),'internal'],'raw':!![]});}return null;})[_0xc8ff('0x11')](function(_0x4d957c){if(!_0x4d957c)return null;_0x42fb31[_0xc8ff('0x1a')][_0xc8ff('0x50')]=_0x4d957c;return _0x42fb31;})[_0xc8ff('0x11')](function(_0x1598d8){if(_0x1598d8){_0x1598d8[_0xc8ff('0x1a')]['interface']=util[_0xc8ff('0x5f')](_0xc8ff('0x60'),_0x4fc68b[_0xc8ff('0x4f')][_0xc8ff('0x26')]);_0x1598d8['message'][_0xc8ff('0x61')]=_0x42fb31[_0xc8ff('0x61')];_0x1598d8[_0xc8ff('0x1a')][_0xc8ff('0x62')]=_0x42fb31[_0xc8ff('0x61')];_0x1598d8[_0xc8ff('0x1a')][_0xc8ff('0x63')]=_0xc8ff('0x4d');respondWithRpcPromise('EventManager',_0xc8ff('0x64'),{'event':'rejectmessage','message':_0x1598d8['message']},client9002);return _0x42fb31;}return null;})[_0xc8ff('0x11')](respondWithResult(_0x238e91,null))[_0xc8ff('0x1c')](handleError(_0x238e91,null));}; \ No newline at end of file +var _0x761e=['destroy','end','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','includeAll','include','catch','show','params','options','find','create','body','describe','accept','openchannel','acceptMessage','reject','agent','get','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','../../config/logger','request','then','info','request\x20sent','debug','error','message','OpenchannelMessage,\x20%s,\x20%s','result','json','undefined','limit','count','offset','status','set','Content-Range','update'];(function(_0x192fed,_0x3037e1){var _0x5583b1=function(_0xb75805){while(--_0xb75805){_0x192fed['push'](_0x192fed['shift']());}};_0x5583b1(++_0x3037e1);}(_0x761e,0x114));var _0xe761=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x761e[_0xa1e3e3];return _0xc980e9;};'use strict';var util=require(_0xe761('0x0'));var _=require(_0xe761('0x1'));var Redis=require(_0xe761('0x2'));var interactionService=require(_0xe761('0x3'));var qs=require(_0xe761('0x4'));var logger=require('../../config/logger')(_0xe761('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe761('0x6')]=_['defaults'](config[_0xe761('0x6')],{'host':_0xe761('0x7'),'port':0x18eb});var socket=require(_0xe761('0x8'))(new Redis(config[_0xe761('0x6')]));require(_0xe761('0x9'))[_0xe761('0xa')](socket);var jayson=require(_0xe761('0xb'));var client=jayson['client'][_0xe761('0xc')]({'port':0x232c});var client9002=jayson[_0xe761('0xd')]['http']({'port':0x232a});var interaction_log=require(_0xe761('0xe'))('openchannel-interactions');function respondWithRpcPromise(_0x5e7a2a,_0x4e41b4,_0x15e394,_0x4ddb07){return new Promise(function(_0x5af51f,_0x30fbb5){var _0xb0ca21=_0x4ddb07||client;return _0xb0ca21[_0xe761('0xf')](_0x5e7a2a,_0x15e394)[_0xe761('0x10')](function(_0x419157){logger[_0xe761('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e41b4,_0xe761('0x12'));logger[_0xe761('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4e41b4,_0xe761('0x12'),JSON['stringify'](_0x419157));if(_0x419157[_0xe761('0x14')]){if(_0x419157[_0xe761('0x14')]['code']===0x1f4){logger[_0xe761('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e41b4,_0x419157[_0xe761('0x14')][_0xe761('0x15')]);return _0x30fbb5(_0x419157[_0xe761('0x14')][_0xe761('0x15')]);}logger[_0xe761('0x14')](_0xe761('0x16'),_0x4e41b4,_0x419157[_0xe761('0x14')][_0xe761('0x15')]);return _0x5af51f(_0x419157['error'][_0xe761('0x15')]);}else{logger[_0xe761('0x11')](_0xe761('0x16'),_0x4e41b4,_0xe761('0x12'));_0x5af51f(_0x419157[_0xe761('0x17')][_0xe761('0x15')]);}})['catch'](function(_0x4ac123){logger[_0xe761('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e41b4,_0x4ac123);_0x30fbb5(_0x4ac123);});});}function respondWithResult(_0x5554c9,_0x157124){_0x157124=_0x157124||0xc8;return function(_0x699967){if(_0x699967){return _0x5554c9['status'](_0x157124)[_0xe761('0x18')](_0x699967);}};}function respondWithFilteredResult(_0x24ae7f,_0x46952b){return function(_0x27f1f0){if(_0x27f1f0){var _0x438ce3=typeof _0x46952b['offset']===_0xe761('0x19')&&typeof _0x46952b[_0xe761('0x1a')]===_0xe761('0x19');var _0x3dfcaa=_0x27f1f0[_0xe761('0x1b')];var _0x6446f=_0x438ce3?0x0:_0x46952b[_0xe761('0x1c')];var _0x29936d=_0x438ce3?_0x27f1f0[_0xe761('0x1b')]:_0x46952b[_0xe761('0x1c')]+_0x46952b[_0xe761('0x1a')];var _0x2fc5a3;if(_0x29936d>=_0x3dfcaa){_0x29936d=_0x3dfcaa;_0x2fc5a3=0xc8;}else{_0x2fc5a3=0xce;}_0x24ae7f[_0xe761('0x1d')](_0x2fc5a3);return _0x24ae7f[_0xe761('0x1e')](_0xe761('0x1f'),_0x6446f+'-'+_0x29936d+'/'+_0x3dfcaa)[_0xe761('0x18')](_0x27f1f0);}return null;};}function saveUpdates(_0x4ed62e){return function(_0x4ee9ec){if(_0x4ee9ec){return _0x4ee9ec[_0xe761('0x20')](_0x4ed62e)[_0xe761('0x10')](function(_0xfc7da){return _0xfc7da;});}return null;};}function removeEntity(_0x79b3ab){return function(_0x880e59){if(_0x880e59){return _0x880e59[_0xe761('0x21')]()[_0xe761('0x10')](function(){_0x79b3ab[_0xe761('0x1d')](0xcc)[_0xe761('0x22')]();});}};}function handleEntityNotFound(_0x507a27){return function(_0x2d3519){if(!_0x2d3519){_0x507a27[_0xe761('0x23')](0x194);}return _0x2d3519;};}function handleError(_0x2048aa,_0x29db4){_0x29db4=_0x29db4||0x1f4;return function(_0x10e48d){logger['error'](_0x10e48d[_0xe761('0x24')]);if(_0x10e48d[_0xe761('0x25')]){delete _0x10e48d[_0xe761('0x25')];}_0x2048aa[_0xe761('0x1d')](_0x29db4)[_0xe761('0x26')](_0x10e48d);};}exports[_0xe761('0x27')]=function(_0x1305ba,_0x47f5a6){var _0xf3777d={},_0x137353={},_0xd916f1={'count':0x0,'rows':[]};var _0x32f2b7=_[_0xe761('0x28')](db[_0xe761('0x29')][_0xe761('0x2a')],function(_0x4e8120){return{'name':_0x4e8120[_0xe761('0x2b')],'type':_0x4e8120[_0xe761('0x2c')][_0xe761('0x2d')]};});_0x137353[_0xe761('0x2e')]=_['map'](_0x32f2b7,'name');_0x137353[_0xe761('0x2f')]=_[_0xe761('0x30')](_0x1305ba[_0xe761('0x2f')]);_0x137353['filters']=_[_0xe761('0x31')](_0x137353['model'],_0x137353[_0xe761('0x2f')]);_0xf3777d['attributes']=_[_0xe761('0x31')](_0x137353[_0xe761('0x2e')],qs[_0xe761('0x32')](_0x1305ba[_0xe761('0x2f')][_0xe761('0x32')]));_0xf3777d[_0xe761('0x33')]=_0xf3777d[_0xe761('0x33')][_0xe761('0x34')]?_0xf3777d[_0xe761('0x33')]:_0x137353[_0xe761('0x2e')];if(!_0x1305ba[_0xe761('0x2f')][_0xe761('0x35')]('nolimit')){_0xf3777d[_0xe761('0x1a')]=qs[_0xe761('0x1a')](_0x1305ba[_0xe761('0x2f')]['limit']);_0xf3777d[_0xe761('0x1c')]=qs[_0xe761('0x1c')](_0x1305ba['query'][_0xe761('0x1c')]);}_0xf3777d[_0xe761('0x36')]=qs[_0xe761('0x37')](_0x1305ba[_0xe761('0x2f')][_0xe761('0x37')]);_0xf3777d[_0xe761('0x38')]=qs['filters'](_[_0xe761('0x39')](_0x1305ba[_0xe761('0x2f')],_0x137353[_0xe761('0x3a')]),_0x32f2b7);if(_0x1305ba[_0xe761('0x2f')][_0xe761('0x3b')]){_0xf3777d[_0xe761('0x38')]=_[_0xe761('0x3c')](_0xf3777d[_0xe761('0x38')],{'$or':_[_0xe761('0x28')](_0x32f2b7,function(_0x456068){if(_0x456068[_0xe761('0x2c')]!=='VIRTUAL'){var _0x2a5de6={};_0x2a5de6[_0x456068[_0xe761('0x25')]]={'$like':'%'+_0x1305ba[_0xe761('0x2f')][_0xe761('0x3b')]+'%'};return _0x2a5de6;}})});}_0xf3777d=_[_0xe761('0x3c')]({},_0xf3777d,_0x1305ba['options']);var _0x598536={'where':_0xf3777d[_0xe761('0x38')]};return db[_0xe761('0x29')][_0xe761('0x1b')](_0x598536)['then'](function(_0x5c240a){_0xd916f1[_0xe761('0x1b')]=_0x5c240a;if(_0x1305ba['query'][_0xe761('0x3d')]){_0xf3777d[_0xe761('0x3e')]=[{'all':!![]}];}return db[_0xe761('0x29')]['findAll'](_0xf3777d);})[_0xe761('0x10')](function(_0x2465e4){_0xd916f1['rows']=_0x2465e4;return _0xd916f1;})[_0xe761('0x10')](respondWithFilteredResult(_0x47f5a6,_0xf3777d))[_0xe761('0x3f')](handleError(_0x47f5a6,null));};exports[_0xe761('0x40')]=function(_0x132a91,_0x402496){var _0x5e6f83={'raw':!![],'where':{'id':_0x132a91[_0xe761('0x41')]['id']}},_0x38b86e={};_0x38b86e[_0xe761('0x2e')]=_[_0xe761('0x30')](db[_0xe761('0x29')][_0xe761('0x2a')]);_0x38b86e[_0xe761('0x2f')]=_[_0xe761('0x30')](_0x132a91[_0xe761('0x2f')]);_0x38b86e['filters']=_[_0xe761('0x31')](_0x38b86e['model'],_0x38b86e[_0xe761('0x2f')]);_0x5e6f83[_0xe761('0x33')]=_[_0xe761('0x31')](_0x38b86e[_0xe761('0x2e')],qs['fields'](_0x132a91[_0xe761('0x2f')][_0xe761('0x32')]));_0x5e6f83[_0xe761('0x33')]=_0x5e6f83[_0xe761('0x33')][_0xe761('0x34')]?_0x5e6f83['attributes']:_0x38b86e[_0xe761('0x2e')];if(_0x132a91[_0xe761('0x2f')][_0xe761('0x3d')]){_0x5e6f83[_0xe761('0x3e')]=[{'all':!![]}];}_0x5e6f83=_[_0xe761('0x3c')]({},_0x5e6f83,_0x132a91[_0xe761('0x42')]);return db[_0xe761('0x29')][_0xe761('0x43')](_0x5e6f83)[_0xe761('0x10')](handleEntityNotFound(_0x402496,null))[_0xe761('0x10')](respondWithResult(_0x402496,null))[_0xe761('0x3f')](handleError(_0x402496,null));};exports[_0xe761('0x44')]=function(_0x279ba1,_0x1d6b9c){return db[_0xe761('0x29')][_0xe761('0x44')](_0x279ba1[_0xe761('0x45')],{})[_0xe761('0x10')](respondWithResult(_0x1d6b9c,0xc9))[_0xe761('0x3f')](handleError(_0x1d6b9c,null));};exports[_0xe761('0x20')]=function(_0x5a21b5,_0x28d850){if(_0x5a21b5[_0xe761('0x45')]['id']){delete _0x5a21b5[_0xe761('0x45')]['id'];}return db[_0xe761('0x29')][_0xe761('0x43')]({'where':{'id':_0x5a21b5['params']['id']}})[_0xe761('0x10')](handleEntityNotFound(_0x28d850,null))[_0xe761('0x10')](saveUpdates(_0x5a21b5[_0xe761('0x45')],null))[_0xe761('0x10')](respondWithResult(_0x28d850,null))[_0xe761('0x3f')](handleError(_0x28d850,null));};exports[_0xe761('0x21')]=function(_0x3953b8,_0x1853d1){return db[_0xe761('0x29')]['find']({'where':{'id':_0x3953b8['params']['id']}})['then'](handleEntityNotFound(_0x1853d1,null))['then'](removeEntity(_0x1853d1,null))[_0xe761('0x3f')](handleError(_0x1853d1,null));};exports[_0xe761('0x46')]=function(_0xb8c657,_0x4c4846){return db[_0xe761('0x29')]['describe']()['then'](respondWithResult(_0x4c4846,null))[_0xe761('0x3f')](handleError(_0x4c4846,null));};exports[_0xe761('0x47')]=function(_0x3d6e60,_0x282e05){var _0x3fe4a3=_0xe761('0x48');return interactionService[_0xe761('0x49')](_0x3d6e60,_0x3fe4a3)[_0xe761('0x10')](respondWithResult(_0x282e05,null))[_0xe761('0x3f')](handleError(_0x282e05,null));};exports[_0xe761('0x4a')]=function(_0x126b58,_0x3c0365){var _0x45b1c0={'agent':{},'channel':_0xe761('0x48')};if(_0x126b58['body']['id']){delete _0x126b58['body']['id'];}_0x126b58[_0xe761('0x45')]['UserId']=_0x126b58['body']['UserId']||_0x126b58['user']['id'];_0x45b1c0[_0xe761('0x4b')]['id']=_0x126b58[_0xe761('0x45')]['UserId'];return db[_0xe761('0x29')][_0xe761('0x43')]({'where':{'id':_0x126b58[_0xe761('0x41')]['id'],'UserId':null}})[_0xe761('0x10')](handleEntityNotFound(_0x3c0365,null))[_0xe761('0x10')](function(_0x3819ab){if(_0x3819ab){_0x45b1c0[_0xe761('0x15')]=_0x3819ab[_0xe761('0x4c')]({'plain':!![]});return db['OpenchannelInteraction'][_0xe761('0x43')]({'where':{'id':_0x3819ab[_0xe761('0x4d')]}});}return null;})[_0xe761('0x10')](handleEntityNotFound(_0x3c0365,null))['then'](function(_0x119015){if(_0x119015){_0x45b1c0[_0xe761('0x4e')]=_0x119015[_0xe761('0x4c')]({'plain':!![]});interaction_log[_0xe761('0x11')](_0xe761('0x4f'),_0x126b58[_0xe761('0x50')]['id'],_0x126b58['user'][_0xe761('0x25')],_0x126b58['user'][_0xe761('0x51')],_0x45b1c0[_0xe761('0x4e')]['id'],_0x126b58['body']?JSON['stringify'](_0x126b58['body']):'null');return respondWithRpcPromise(_0xe761('0x52'),_0xe761('0x53'),_0x45b1c0);}return null;})['then'](function(_0x17dca7){var _0x28b473=_0xe761('0x54')+_0x17dca7[_0xe761('0x15')]['ContactId'];return db[_0xe761('0x55')][_0xe761('0x2f')](_0x28b473,{'type':db[_0xe761('0x56')][_0xe761('0x57')][_0xe761('0x58')],'raw':!![]})['then'](function(_0x5b3b85){return _0x5b3b85;});})['then'](function(_0x5761a6){if(_0x5761a6){_0x45b1c0[_0xe761('0x15')][_0xe761('0x59')]=_0x5761a6[0x0];if(!_0x126b58[_0xe761('0x45')][_0xe761('0x5a')])return;return db[_0xe761('0x5b')][_0xe761('0x43')]({'where':{'id':_0x126b58[_0xe761('0x45')][_0xe761('0x5a')],'role':_0xe761('0x4b')},'attributes':['id',_0xe761('0x25'),_0xe761('0x5c'),_0xe761('0x5d'),_0xe761('0x5e')],'raw':!![]});}return null;})[_0xe761('0x10')](function(_0x1f7194){if(!_0x1f7194)return null;_0x45b1c0[_0xe761('0x15')]['agent']=_0x1f7194;return _0x45b1c0;})[_0xe761('0x10')](function(_0x3b95bd){if(_0x3b95bd){_0x3b95bd[_0xe761('0x15')][_0xe761('0x5f')]=util[_0xe761('0x60')](_0xe761('0x61'),_0x126b58[_0xe761('0x50')][_0xe761('0x25')]);_0x3b95bd['message'][_0xe761('0x62')]=_0x45b1c0[_0xe761('0x62')];_0x3b95bd[_0xe761('0x15')][_0xe761('0x63')]=_0x45b1c0[_0xe761('0x62')];_0x3b95bd['message'][_0xe761('0x64')]=_0xe761('0x4a');respondWithRpcPromise(_0xe761('0x65'),'EventManager',{'event':_0xe761('0x66'),'message':_0x3b95bd[_0xe761('0x15')]},client9002);return _0x45b1c0;}return null;})[_0xe761('0x10')](respondWithResult(_0x3c0365,null))[_0xe761('0x3f')](handleError(_0x3c0365,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 164a60a..4f8bba8 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 _0xd4f7=['emit','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x14ac9e,_0x443c98){var _0x455527=function(_0x43c0bc){while(--_0x43c0bc){_0x14ac9e['push'](_0x14ac9e['shift']());}};_0x455527(++_0x443c98);}(_0xd4f7,0x182));var _0x7d4f=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0xd4f7[_0x191154];return _0x3dcd73;};'use strict';var EventEmitter=require(_0x7d4f('0x0'));var OpenchannelMessage=require(_0x7d4f('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7d4f('0x2')](0x0);var events={'afterCreate':_0x7d4f('0x3'),'afterUpdate':_0x7d4f('0x4'),'afterDestroy':_0x7d4f('0x5')};function emitEvent(_0x21b80e){return function(_0x4a88d9,_0x39efcc,_0x7c81b1){OpenchannelMessageEvents[_0x7d4f('0x6')](_0x21b80e+':'+_0x4a88d9['id'],_0x4a88d9);OpenchannelMessageEvents['emit'](_0x21b80e,_0x4a88d9);_0x7c81b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xbbaa=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x420cea,_0x315ab9){var _0x2385f8=function(_0x1bb4e6){while(--_0x1bb4e6){_0x420cea['push'](_0x420cea['shift']());}};_0x2385f8(++_0x315ab9);}(_0xbbaa,0x17b));var _0xabba=function(_0x23788d,_0x7d4d67){_0x23788d=_0x23788d-0x0;var _0x16f9fe=_0xbbaa[_0x23788d];return _0x16f9fe;};'use strict';var EventEmitter=require(_0xabba('0x0'));var OpenchannelMessage=require(_0xabba('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xabba('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xabba('0x3')};function emitEvent(_0xf5d316){return function(_0x33b285,_0x4b917c,_0x338f0a){OpenchannelMessageEvents[_0xabba('0x4')](_0xf5d316+':'+_0x33b285['id'],_0x33b285);OpenchannelMessageEvents[_0xabba('0x4')](_0xf5d316,_0x33b285);_0x338f0a(null);};}for(var e in events){if(events[_0xabba('0x5')](e)){var event=events[e];OpenchannelMessage[_0xabba('0x6')](e,emitEvent(event));}}module[_0xabba('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 06da89b..b81bddd 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 _0x1201=['Interaction','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','finally','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','openchannel_messages','body','FULLTEXT','direction','toLowerCase','out','secret','findOne','OpenchannelInteractionId','then','update','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','get','replyUri','info','afterCreate','format'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x1201,0x8a));var _0x1120=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x1201[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x1120('0x0'));var util=require('util');var logger=require(_0x1120('0x1'))(_0x1120('0x2'));var moment=require(_0x1120('0x3'));var BPromise=require(_0x1120('0x4'));var rp=require(_0x1120('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1120('0x6'));var config=require(_0x1120('0x7'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x15615a,_0x183399){return _0x15615a[_0x1120('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x1120('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x1120('0xa')],'type':_0x1120('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x430230,_0x135eef,_0x2ece8f){var _0x32271f=_0x15615a['models'];var _0x48d3c3=_0x430230['get']({'plain':!![]});if(_0x48d3c3[_0x1120('0xc')]['toLowerCase']()==='in'||_0x48d3c3[_0x1120('0xc')][_0x1120('0xd')]()===_0x1120('0xe')&&!_0x48d3c3[_0x1120('0xf')]&&!_['isNil'](_0x48d3c3['UserId'])){_0x32271f['OpenchannelInteraction'][_0x1120('0x10')]({'where':{'id':_0x48d3c3[_0x1120('0x11')]}})[_0x1120('0x12')](function(_0x55353c){if(_0x55353c){_0x55353c[_0x1120('0x13')]({'lastMsgAt':_0x48d3c3['createdAt'],'lastMsgDirection':_0x48d3c3['direction']['toLowerCase']()});}})[_0x1120('0x14')](function(_0x50c05f){console['error'](_0x50c05f);});}if(_0x48d3c3[_0x1120('0xc')]===_0x1120('0xe')&&!_0x48d3c3[_0x1120('0xf')]){var _0x1df82d;_0x32271f[_0x1120('0x15')][_0x1120('0x16')]()['then'](function(_0x3397c7){return _0x32271f[_0x1120('0x17')][_0x1120('0x18')]({'where':{'id':_0x48d3c3[_0x1120('0x19')]},'include':[{'model':_0x32271f[_0x1120('0x1a')],'as':_0x1120('0x1b'),'where':{'id':_0x48d3c3[_0x1120('0x11')]},'limit':0x1,'include':[{'model':_0x32271f['CmContact'],'as':_0x1120('0x1c'),'attributes':_['keys'](_0x3397c7)}]}]});})[_0x1120('0x12')](function(_0x479ac4){_0x1df82d=_0x479ac4[_0x1120('0x1d')]({'plain':!![]});if(_0x1df82d&&_0x1df82d[_0x1120('0x1e')]){logger[_0x1120('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x1120('0x20'),util[_0x1120('0x21')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x48d3c3['id'],_0x1df82d['replyUri']));if(_0x1df82d[_0x1120('0x1b')]&&_0x1df82d[_0x1120('0x1b')]['length']){_0x48d3c3[_0x1120('0x22')]=_[_0x1120('0x23')](_0x1df82d[_0x1120('0x1b')][0x0],_0x1120('0x1c'));_0x48d3c3[_0x1120('0x1c')]=_0x1df82d[_0x1120('0x1b')][0x0][_0x1120('0x1c')];}var _0x135eef={'method':_0x1120('0x24'),'uri':encodeURI(_0x1df82d[_0x1120('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x135eef[_0x1120('0x25')]){case _0x1120('0x26'):_0x135eef['qs']=_0x48d3c3;break;case _0x1120('0x24'):_0x135eef[_0x1120('0xa')]=_0x48d3c3;break;}return rp(_0x135eef)[_0x1120('0x12')](function(_0x171488){logger[_0x1120('0x1f')](_0x1120('0x27'),_0x1120('0x20'),util['format'](_0x1120('0x28'),_0x48d3c3['id'],_0x1df82d[_0x1120('0x1e')]));if(_0x171488['body']['threadId']&&_0x171488['body'][_0x1120('0x29')]!=_0x48d3c3[_0x1120('0x22')][_0x1120('0x29')]){return _0x32271f[_0x1120('0x1a')][_0x1120('0x13')]({'threadId':_0x171488[_0x1120('0xa')][_0x1120('0x29')]},{'where':{'id':_0x48d3c3['Interaction']['id']}});}else{return;}})[_0x1120('0x12')](function(){return _0x430230['update']({'read':!![]});})[_0x1120('0x14')](function(_0xfe2f97){logger['error'](_0x1120('0x27'),'afterCreate',util['inspect'](_0xfe2f97,{'showHidden':![],'depth':null}));_0x2ece8f();});}else{_0x2ece8f();}})[_0x1120('0x2a')](function(){_0x2ece8f();});}else{_0x2ece8f();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe56a=['info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','Contact','POST','method','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','OpenchannelAccountId','Interactions','keys','replyUri'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0xe56a,0x10e));var _0xae56=function(_0x3ef6f5,_0xd179b9){_0x3ef6f5=_0x3ef6f5-0x0;var _0x2ee7d7=_0xe56a[_0x3ef6f5];return _0x2ee7d7;};'use strict';var _=require('lodash');var util=require(_0xae56('0x0'));var logger=require('../../config/logger')(_0xae56('0x1'));var moment=require(_0xae56('0x2'));var BPromise=require(_0xae56('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae56('0x4'));var rimraf=require(_0xae56('0x5'));var config=require(_0xae56('0x6'));var attributes=require(_0xae56('0x7'));module[_0xae56('0x8')]=function(_0x37e293,_0x1ccdb5){return _0x37e293['define'](_0xae56('0x9'),attributes,{'tableName':_0xae56('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xae56('0xb')],'type':_0xae56('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x326dae,_0x5d0392,_0x20571d){var _0x289d3a=_0x37e293[_0xae56('0xd')];var _0x28761d=_0x326dae[_0xae56('0xe')]({'plain':!![]});if(_0x28761d[_0xae56('0xf')][_0xae56('0x10')]()==='in'||_0x28761d[_0xae56('0xf')]['toLowerCase']()===_0xae56('0x11')&&!_0x28761d[_0xae56('0x12')]&&!_[_0xae56('0x13')](_0x28761d[_0xae56('0x14')])){_0x289d3a[_0xae56('0x15')][_0xae56('0x16')]({'where':{'id':_0x28761d[_0xae56('0x17')]}})['then'](function(_0x25d620){if(_0x25d620){_0x25d620[_0xae56('0x18')]({'lastMsgAt':_0x28761d[_0xae56('0x19')],'lastMsgDirection':_0x28761d['direction'][_0xae56('0x10')]()});}})[_0xae56('0x1a')](function(_0x4e917c){console[_0xae56('0x1b')](_0x4e917c);});}if(_0x28761d[_0xae56('0xf')]===_0xae56('0x11')&&!_0x28761d['secret']){var _0x10cab6;_0x289d3a[_0xae56('0x1c')][_0xae56('0x1d')]()[_0xae56('0x1e')](function(_0x14fd47){return _0x289d3a[_0xae56('0x1f')]['find']({'where':{'id':_0x28761d[_0xae56('0x20')]},'include':[{'model':_0x289d3a[_0xae56('0x15')],'as':_0xae56('0x21'),'where':{'id':_0x28761d[_0xae56('0x17')]},'limit':0x1,'include':[{'model':_0x289d3a[_0xae56('0x1c')],'as':'Contact','attributes':_[_0xae56('0x22')](_0x14fd47)}]}]});})[_0xae56('0x1e')](function(_0x4ac86c){_0x10cab6=_0x4ac86c[_0xae56('0xe')]({'plain':!![]});if(_0x10cab6&&_0x10cab6[_0xae56('0x23')]){logger[_0xae56('0x24')](_0xae56('0x25'),'afterCreate',util['format'](_0xae56('0x26'),_0x28761d['id'],_0x10cab6[_0xae56('0x23')]));if(_0x10cab6['Interactions']&&_0x10cab6['Interactions'][_0xae56('0x27')]){_0x28761d['Interaction']=_[_0xae56('0x28')](_0x10cab6['Interactions'][0x0],'Contact');_0x28761d[_0xae56('0x29')]=_0x10cab6['Interactions'][0x0]['Contact'];}var _0x5d0392={'method':_0xae56('0x2a'),'uri':encodeURI(_0x10cab6['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5d0392[_0xae56('0x2b')]){case'GET':_0x5d0392['qs']=_0x28761d;break;case'POST':_0x5d0392[_0xae56('0xb')]=_0x28761d;break;}return rp(_0x5d0392)[_0xae56('0x1e')](function(_0x45970c){logger['info'](_0xae56('0x25'),_0xae56('0x2c'),util['format'](_0xae56('0x2d'),_0x28761d['id'],_0x10cab6[_0xae56('0x23')]));if(_0x45970c[_0xae56('0xb')]['threadId']&&_0x45970c[_0xae56('0xb')]['threadId']!=_0x28761d['Interaction'][_0xae56('0x2e')]){return _0x289d3a[_0xae56('0x15')]['update']({'threadId':_0x45970c['body']['threadId']},{'where':{'id':_0x28761d[_0xae56('0x2f')]['id']}});}else{return;}})[_0xae56('0x1e')](function(){return _0x326dae[_0xae56('0x18')]({'read':!![]});})['catch'](function(_0x74b304){logger[_0xae56('0x1b')](_0xae56('0x25'),_0xae56('0x2c'),util[_0xae56('0x30')](_0x74b304,{'showHidden':![],'depth':null}));_0x20571d();});}else{_0x20571d();}})[_0xae56('0x31')](function(){_0x20571d();});}else{_0x20571d();}}},'charset':'utf8mb4','collate':_0xae56('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index a8e26f1..7ffa9bb 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x37a3a8,_0x4ce68e){var _0x3a0882=function(_0x4370a1){while(--_0x4370a1){_0x37a3a8['push'](_0x37a3a8['shift']());}};_0x3a0882(++_0x4ce68e);}(_0xadb5,0xad));var _0x5adb=function(_0x5202ae,_0x3b43ea){_0x5202ae=_0x5202ae-0x0;var _0x366905=_0xadb5[_0x5202ae];return _0x366905;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x5c1b05,_0x213768){var _0x1a65e7=function(_0x2845d7){while(--_0x2845d7){_0x5c1b05['push'](_0x5c1b05['shift']());}};_0x1a65e7(++_0x213768);}(_0xdb28,0x106));var _0x8db2=function(_0x5e59dd,_0x2bdc55){_0x5e59dd=_0x5e59dd-0x0;var _0xff7df=_0xdb28[_0x5e59dd];return _0xff7df;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 951edf2..60ab133 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 _0x36a9=['save','remove','update','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x460168,_0x134616){var _0x16af7b=function(_0x1b34ac){while(--_0x1b34ac){_0x460168['push'](_0x460168['shift']());}};_0x16af7b(++_0x134616);}(_0x36a9,0x1a3));var _0x936a=function(_0x117c78,_0x46cd27){_0x117c78=_0x117c78-0x0;var _0x1ddc90=_0x36a9[_0x117c78];return _0x1ddc90;};'use strict';var OpenchannelMessageEvents=require(_0x936a('0x0'));var events=[_0x936a('0x1'),_0x936a('0x2'),_0x936a('0x3')];function createListener(_0x522dc8,_0x6c0996){return function(_0x2204ea){_0x6c0996['emit'](_0x522dc8,_0x2204ea);};}function removeListener(_0x43553a,_0x337c4b){return function(){OpenchannelMessageEvents['removeListener'](_0x43553a,_0x337c4b);};}exports[_0x936a('0x4')]=function(_0x4aa883){for(var _0x2f71a1=0x0,_0x5ba805=events[_0x936a('0x5')];_0x2f71a1<_0x5ba805;_0x2f71a1++){var _0x50174a=events[_0x2f71a1];var _0x4d3507=createListener(_0x936a('0x6')+_0x50174a,_0x4aa883);OpenchannelMessageEvents['on'](_0x50174a,_0x4d3507);}}; \ No newline at end of file +var _0xec38=['emit','removeListener','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x101134,_0x1ed1d3){var _0xc47acc=function(_0x7ea469){while(--_0x7ea469){_0x101134['push'](_0x101134['shift']());}};_0xc47acc(++_0x1ed1d3);}(_0xec38,0x1f4));var _0x8ec3=function(_0x5f0c5f,_0x1a58ae){_0x5f0c5f=_0x5f0c5f-0x0;var _0x2112e3=_0xec38[_0x5f0c5f];return _0x2112e3;};'use strict';var OpenchannelMessageEvents=require(_0x8ec3('0x0'));var events=[_0x8ec3('0x1'),_0x8ec3('0x2'),_0x8ec3('0x3')];function createListener(_0x129313,_0x339aa6){return function(_0x285e51){_0x339aa6[_0x8ec3('0x4')](_0x129313,_0x285e51);};}function removeListener(_0x2d0593,_0x16bed5){return function(){OpenchannelMessageEvents[_0x8ec3('0x5')](_0x2d0593,_0x16bed5);};}exports['register']=function(_0x353e89){for(var _0x4db3e1=0x0,_0x5d3abc=events[_0x8ec3('0x6')];_0x4db3e1<_0x5d3abc;_0x4db3e1++){var _0x4e6c3f=events[_0x4db3e1];var _0x10210b=createListener(_0x8ec3('0x7')+_0x4e6c3f,_0x353e89);OpenchannelMessageEvents['on'](_0x4e6c3f,_0x10210b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ec3e0a3..83860fa 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 _0x22ff=['multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','/:id','update','delete','removeAgents','exports'];(function(_0x3ecd33,_0x3fa855){var _0x5538ff=function(_0x2c6183){while(--_0x2c6183){_0x3ecd33['push'](_0x3ecd33['shift']());}};_0x5538ff(++_0x3fa855);}(_0x22ff,0x1f4));var _0xf22f=function(_0x585199,_0x10d223){_0x585199=_0x585199-0x0;var _0x4f5eaf=_0x22ff[_0x585199];return _0x4f5eaf;};'use strict';var multer=require(_0xf22f('0x0'));var util=require(_0xf22f('0x1'));var path=require(_0xf22f('0x2'));var timeout=require(_0xf22f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf22f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf22f('0x5'));var config=require(_0xf22f('0x6'));var controller=require('./openchannelQueue.controller');router[_0xf22f('0x7')]('/',auth[_0xf22f('0x8')](),controller['index']);router['get'](_0xf22f('0x9'),auth['isAuthenticated'](),controller[_0xf22f('0xa')]);router[_0xf22f('0x7')]('/:id',auth[_0xf22f('0x8')](),controller[_0xf22f('0xb')]);router['get']('/:id/members',auth[_0xf22f('0x8')](),controller[_0xf22f('0xc')]);router[_0xf22f('0x7')](_0xf22f('0xd'),auth['isAuthenticated'](),controller[_0xf22f('0xe')]);router['get'](_0xf22f('0xf'),auth['isAuthenticated'](),controller[_0xf22f('0x10')]);router[_0xf22f('0x11')]('/',auth['isAuthenticated'](),controller[_0xf22f('0x12')]);router[_0xf22f('0x11')](_0xf22f('0xd'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xf22f('0xf'),auth[_0xf22f('0x8')](),controller[_0xf22f('0x13')]);router['put'](_0xf22f('0x14'),auth['isAuthenticated'](),controller[_0xf22f('0x15')]);router[_0xf22f('0x16')](_0xf22f('0x14'),auth[_0xf22f('0x8')](),controller['destroy']);router[_0xf22f('0x16')]('/:id/teams',auth[_0xf22f('0x8')](),controller['removeTeams']);router[_0xf22f('0x16')](_0xf22f('0xf'),auth[_0xf22f('0x8')](),controller[_0xf22f('0x17')]);module[_0xf22f('0x18')]=router; \ No newline at end of file +var _0x35d9=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addAgents','put','delete','destroy','removeTeams','/:id/users','removeAgents','exports'];(function(_0x54b221,_0x571fc0){var _0x1de365=function(_0x570559){while(--_0x570559){_0x54b221['push'](_0x54b221['shift']());}};_0x1de365(++_0x571fc0);}(_0x35d9,0xae));var _0x935d=function(_0x57db29,_0x42126c){_0x57db29=_0x57db29-0x0;var _0x18caaa=_0x35d9[_0x57db29];return _0x18caaa;};'use strict';var multer=require(_0x935d('0x0'));var util=require(_0x935d('0x1'));var path=require(_0x935d('0x2'));var timeout=require(_0x935d('0x3'));var express=require(_0x935d('0x4'));var router=express[_0x935d('0x5')]();var fs_extra=require(_0x935d('0x6'));var auth=require(_0x935d('0x7'));var interaction=require(_0x935d('0x8'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x935d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x935d('0x9')](_0x935d('0xa'),auth[_0x935d('0xb')](),controller['describe']);router[_0x935d('0x9')](_0x935d('0xc'),auth[_0x935d('0xb')](),controller[_0x935d('0xd')]);router[_0x935d('0x9')](_0x935d('0xe'),auth[_0x935d('0xb')](),controller[_0x935d('0xf')]);router['get'](_0x935d('0x10'),auth['isAuthenticated'](),controller[_0x935d('0x11')]);router[_0x935d('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x935d('0x12')]);router[_0x935d('0x13')]('/',auth[_0x935d('0xb')](),controller[_0x935d('0x14')]);router[_0x935d('0x13')]('/:id/teams',auth[_0x935d('0xb')](),controller['addTeams']);router[_0x935d('0x13')]('/:id/users',auth[_0x935d('0xb')](),controller[_0x935d('0x15')]);router[_0x935d('0x16')](_0x935d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x935d('0x17')](_0x935d('0xc'),auth[_0x935d('0xb')](),controller[_0x935d('0x18')]);router['delete']('/:id/teams',auth[_0x935d('0xb')](),controller[_0x935d('0x19')]);router[_0x935d('0x17')](_0x935d('0x1a'),auth[_0x935d('0xb')](),controller[_0x935d('0x1b')]);module[_0x935d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index de75036..9835d5d 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 _0x5452=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x177ae5,_0x215d8a){var _0x2b54f7=function(_0x20a27e){while(--_0x20a27e){_0x177ae5['push'](_0x177ae5['shift']());}};_0x2b54f7(++_0x215d8a);}(_0x5452,0x174));var _0x2545=function(_0x39d280,_0x8e74d7){_0x39d280=_0x39d280-0x0;var _0xe0d875=_0x5452[_0x39d280];return _0xe0d875;};'use strict';var Sequelize=require(_0x2545('0x0'));module[_0x2545('0x1')]={'name':{'type':Sequelize[_0x2545('0x2')],'unique':_0x2545('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2545('0x2')]},'timeout':{'type':Sequelize[_0x2545('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2545('0x5')](_0x2545('0x6'),_0x2545('0x7'),_0x2545('0x8'))}}; \ No newline at end of file +var _0x9b8d=['sequelize','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x9b8d,0xea));var _0xd9b8=function(_0x40c98f,_0x538320){_0x40c98f=_0x40c98f-0x0;var _0x2380b5=_0x9b8d[_0x40c98f];return _0x2380b5;};'use strict';var Sequelize=require(_0xd9b8('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9b8('0x1')],'unique':_0xd9b8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd9b8('0x1')]},'timeout':{'type':Sequelize[_0xd9b8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd9b8('0x4')]('rrmemory','beepall',_0xd9b8('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index c5755db..c73db57 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 _0x713a=['redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','getOptions','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserOpenchannelQueue','length','nolimit','sort','where','pick','OpenchannelQueueId','filter','merge','options','findAll','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','order','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','User','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','hasOwnProperty','util','lodash','squel','../../config/logger','api','../../config/environment','../../mysqldb','defaults'];(function(_0x21c0b7,_0xdf47bc){var _0x5bf808=function(_0x41cbe7){while(--_0x41cbe7){_0x21c0b7['push'](_0x21c0b7['shift']());}};_0x5bf808(++_0xdf47bc);}(_0x713a,0xf2));var _0xa713=function(_0x4b57a1,_0x276810){_0x4b57a1=_0x4b57a1-0x0;var _0x12e4d6=_0x713a[_0x4b57a1];return _0x12e4d6;};'use strict';var BPromise=require('bluebird');var util=require(_0xa713('0x0'));var _=require(_0xa713('0x1'));var squel=require(_0xa713('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa713('0x3'))(_0xa713('0x4'));var config=require(_0xa713('0x5'));var db=require(_0xa713('0x6'))['db'];config['redis']=_[_0xa713('0x7')](config[_0xa713('0x8')],{'host':_0xa713('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa713('0x8')]));require(_0xa713('0xa'))[_0xa713('0xb')](socket);function respondWithStatusCode(_0xe6871e,_0x1808ac){_0x1808ac=_0x1808ac||0xcc;return function(_0x25ba56){if(_0x25ba56){return _0xe6871e[_0xa713('0xc')](_0x1808ac);}return _0xe6871e[_0xa713('0xd')](_0x1808ac)[_0xa713('0xe')]();};}function respondWithResult(_0x2a1ba1,_0x492cbc){_0x492cbc=_0x492cbc||0xc8;return function(_0x5a0f98){if(_0x5a0f98){return _0x2a1ba1[_0xa713('0xd')](_0x492cbc)[_0xa713('0xf')](_0x5a0f98);}};}function respondWithFilteredResult(_0x518c1b,_0x368e8b){return function(_0x69ff30){if(_0x69ff30){var _0x459ea6=typeof _0x368e8b[_0xa713('0x10')]===_0xa713('0x11')&&typeof _0x368e8b[_0xa713('0x12')]===_0xa713('0x11');var _0x303f54=_0x69ff30[_0xa713('0x13')];var _0x300bae=_0x459ea6?0x0:_0x368e8b[_0xa713('0x10')];var _0x5ea546=_0x459ea6?_0x69ff30[_0xa713('0x13')]:_0x368e8b[_0xa713('0x10')]+_0x368e8b[_0xa713('0x12')];var _0xb83693;if(_0x5ea546>=_0x303f54){_0x5ea546=_0x303f54;_0xb83693=0xc8;}else{_0xb83693=0xce;}_0x518c1b[_0xa713('0xd')](_0xb83693);return _0x518c1b[_0xa713('0x14')]('Content-Range',_0x300bae+'-'+_0x5ea546+'/'+_0x303f54)['json'](_0x69ff30);}return null;};}function saveUpdates(_0x2db8ac){return function(_0x59e9a7){if(_0x59e9a7){return _0x59e9a7['update'](_0x2db8ac)[_0xa713('0x15')](function(_0x284fda){return _0x284fda;});}return null;};}function removeEntity(_0x5f2275){return function(_0xb21a91){if(_0xb21a91){return _0xb21a91[_0xa713('0x16')]()[_0xa713('0x15')](function(){var _0x7e1f73=_0xb21a91['get']({'plain':!![]});var _0x2a1538=_0xa713('0x17');return db[_0xa713('0x18')][_0xa713('0x16')]({'where':{'type':_0x2a1538,'resourceId':_0x7e1f73['id']}})[_0xa713('0x15')](function(){return _0xb21a91;});})[_0xa713('0x15')](function(){_0x5f2275[_0xa713('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e708e){return function(_0xe38994){if(!_0xe38994){_0x2e708e['sendStatus'](0x194);}return _0xe38994;};}function handleError(_0x20798d,_0x1d260f){_0x1d260f=_0x1d260f||0x1f4;return function(_0x2858be){logger[_0xa713('0x19')](_0x2858be[_0xa713('0x1a')]);if(_0x2858be[_0xa713('0x1b')]){delete _0x2858be['name'];}_0x20798d[_0xa713('0xd')](_0x1d260f)[_0xa713('0x1c')](_0x2858be);};}exports[_0xa713('0x1d')]=function(_0xdc631e,_0x4024bd){var _0x277474={};var _0x4e6dc0={'count':0x0,'rows':[]};var _0x1d398a=_[_0xa713('0x1e')](db[_0xa713('0x1f')][_0xa713('0x20')],function(_0x4e4741){return{'name':_0x4e4741[_0xa713('0x21')],'type':_0x4e4741[_0xa713('0x22')]['key']};});_0x277474=qs[_0xa713('0x23')](_0x1d398a,_0xdc631e);var _0x5f4221={'where':_0x277474['where']};return db['OpenchannelQueue'][_0xa713('0x13')](_0x5f4221)['then'](function(_0x42e5ab){_0x4e6dc0['count']=_0x42e5ab;_0x277474[_0xa713('0x24')]=qs[_0xa713('0x24')](_0xdc631e[_0xa713('0x25')]);return db[_0xa713('0x1f')]['findAll'](_0x277474);})['then'](function(_0x1480f1){_0x4e6dc0[_0xa713('0x26')]=_0x1480f1;return _0x4e6dc0;})['then'](respondWithFilteredResult(_0x4024bd,_0x277474))[_0xa713('0x27')](handleError(_0x4024bd,null));};exports[_0xa713('0x28')]=function(_0x20a190,_0x5828f4){var _0x42b83d={'raw':!![],'where':{'id':_0x20a190[_0xa713('0x29')]['id']}},_0x4ad685={};_0x4ad685[_0xa713('0x2a')]=_[_0xa713('0x2b')](db[_0xa713('0x1f')]['rawAttributes']);_0x4ad685[_0xa713('0x25')]=_[_0xa713('0x2b')](_0x20a190[_0xa713('0x25')]);_0x4ad685[_0xa713('0x2c')]=_[_0xa713('0x2d')](_0x4ad685[_0xa713('0x2a')],_0x4ad685[_0xa713('0x25')]);_0x42b83d[_0xa713('0x2e')]=_['intersection'](_0x4ad685[_0xa713('0x2a')],qs[_0xa713('0x2f')](_0x20a190['query'][_0xa713('0x2f')]));_0x42b83d[_0xa713('0x2e')]=_0x42b83d[_0xa713('0x2e')]['length']?_0x42b83d[_0xa713('0x2e')]:_0x4ad685[_0xa713('0x2a')];if(_0x20a190['query'][_0xa713('0x30')]){_0x42b83d[_0xa713('0x24')]=[{'all':!![]}];}_0x42b83d=_['merge']({},_0x42b83d,_0x20a190['options']);return db[_0xa713('0x1f')][_0xa713('0x31')](_0x42b83d)['then'](handleEntityNotFound(_0x5828f4,null))['then'](respondWithResult(_0x5828f4,null))[_0xa713('0x27')](handleError(_0x5828f4,null));};exports[_0xa713('0x32')]=function(_0x292d73,_0x2950e1){return db['OpenchannelQueue'][_0xa713('0x32')](_0x292d73['body'],{})[_0xa713('0x15')](function(_0x5bf35b){var _0x3c4c1b=_0x292d73[_0xa713('0x33')]['get']({'plain':!![]});if(!_0x3c4c1b)throw new Error(_0xa713('0x34'));if(_0x3c4c1b[_0xa713('0x35')]===_0xa713('0x33')){var _0x32ace9=_0x5bf35b[_0xa713('0x36')]({'plain':!![]});var _0x2d6ae3=_0xa713('0x17');return db['UserProfileSection'][_0xa713('0x31')]({'where':{'name':_0x2d6ae3,'userProfileId':_0x3c4c1b[_0xa713('0x37')]},'raw':!![]})[_0xa713('0x15')](function(_0x5df095){if(_0x5df095&&_0x5df095[_0xa713('0x38')]===0x0){return db[_0xa713('0x18')][_0xa713('0x32')]({'name':_0x32ace9[_0xa713('0x1b')],'resourceId':_0x32ace9['id'],'type':_0x5df095['name'],'sectionId':_0x5df095['id']},{})[_0xa713('0x15')](function(){return _0x5bf35b;});}else{return _0x5bf35b;}})[_0xa713('0x27')](function(_0x5ca091){logger[_0xa713('0x19')](_0xa713('0x39'),_0x5ca091);throw _0x5ca091;});}return _0x5bf35b;})[_0xa713('0x15')](respondWithResult(_0x2950e1,0xc9))[_0xa713('0x27')](handleError(_0x2950e1,null));};exports[_0xa713('0x3a')]=function(_0x547802,_0x39be5a){if(_0x547802['body']['id']){delete _0x547802[_0xa713('0x3b')]['id'];}return db['OpenchannelQueue'][_0xa713('0x31')]({'where':{'id':_0x547802[_0xa713('0x29')]['id']}})[_0xa713('0x15')](handleEntityNotFound(_0x39be5a,null))[_0xa713('0x15')](saveUpdates(_0x547802[_0xa713('0x3b')],null))[_0xa713('0x15')](respondWithResult(_0x39be5a,null))[_0xa713('0x27')](handleError(_0x39be5a,null));};exports[_0xa713('0x16')]=function(_0x1969e6,_0x4effbe){return db[_0xa713('0x1f')][_0xa713('0x31')]({'where':{'id':_0x1969e6[_0xa713('0x29')]['id']}})[_0xa713('0x15')](handleEntityNotFound(_0x4effbe,null))[_0xa713('0x15')](removeEntity(_0x4effbe,null))[_0xa713('0x27')](handleError(_0x4effbe,null));};exports[_0xa713('0x3c')]=function(_0x1ac46f,_0x2af289){return db[_0xa713('0x1f')]['describe']()[_0xa713('0x15')](respondWithResult(_0x2af289,null))[_0xa713('0x27')](handleError(_0x2af289,null));};exports[_0xa713('0x3d')]=function(_0x2cc11e,_0x1c864f){var _0x22d6c6={'raw':!![],'where':{}},_0x53e0f8={},_0xb60e8;return db[_0xa713('0x1f')]['findOne']({'where':{'id':_0x2cc11e['params']['id']}})[_0xa713('0x15')](handleEntityNotFound(_0x1c864f,null))[_0xa713('0x15')](function(_0x2c4cd6){if(_0x2c4cd6){_0xb60e8=_0x2c4cd6[_0xa713('0x36')]({'plain':!![]});_0x53e0f8[_0xa713('0x2a')]=_['keys'](db[_0xa713('0x3e')][_0xa713('0x20')]);_0x53e0f8['query']=_['keys'](_0x2cc11e[_0xa713('0x25')]);_0x53e0f8[_0xa713('0x2c')]=_[_0xa713('0x2d')](_0x53e0f8[_0xa713('0x2a')],_0x53e0f8[_0xa713('0x25')]);_0x22d6c6[_0xa713('0x2e')]=_[_0xa713('0x2d')](_0x53e0f8['model'],qs[_0xa713('0x2f')](_0x2cc11e[_0xa713('0x25')][_0xa713('0x2f')]));_0x22d6c6[_0xa713('0x2e')]=_0x22d6c6[_0xa713('0x2e')][_0xa713('0x3f')]?_0x22d6c6[_0xa713('0x2e')]:_0x53e0f8[_0xa713('0x2a')];if(!_0x2cc11e[_0xa713('0x25')]['hasOwnProperty'](_0xa713('0x40'))){_0x22d6c6[_0xa713('0x12')]=qs[_0xa713('0x12')](_0x2cc11e[_0xa713('0x25')]['limit']);_0x22d6c6[_0xa713('0x10')]=qs['offset'](_0x2cc11e['query'][_0xa713('0x10')]);}_0x22d6c6['order']=qs[_0xa713('0x41')](_0x2cc11e[_0xa713('0x25')]['sort']);_0x22d6c6[_0xa713('0x42')]=qs[_0xa713('0x2c')](_[_0xa713('0x43')](_0x2cc11e[_0xa713('0x25')],_0x53e0f8[_0xa713('0x2c')]));_0x22d6c6[_0xa713('0x42')][_0xa713('0x44')]=_0x2c4cd6['id'];if(_0x2cc11e['query']['filter']){_0x22d6c6['where']=_['merge'](_0x22d6c6[_0xa713('0x42')],{'$or':_[_0xa713('0x1e')](_0x22d6c6[_0xa713('0x2e')],function(_0x3614b3){var _0x482b36={};_0x482b36[_0x3614b3]={'$like':'%'+_0x2cc11e[_0xa713('0x25')][_0xa713('0x45')]+'%'};return _0x482b36;})});}_0x22d6c6=_[_0xa713('0x46')]({},_0x22d6c6,_0x2cc11e[_0xa713('0x47')]);return db[_0xa713('0x3e')][_0xa713('0x48')](_0x22d6c6);}})['then'](function(_0x166d39){if(_0x166d39){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x166d39,_0xa713('0x49')),'role':'agent'},'attributes':['id',_0xa713('0x1b'),_0xa713('0x4a'),_0xa713('0x4b'),_0xa713('0x4c')]});}})[_0xa713('0x15')](function(_0x576625){if(_0x576625){return{'count':_0x576625[_0xa713('0x13')],'rows':_[_0xa713('0x1e')](_0x576625['rows'],function(_0x5b41ab){return{'membername':_0x5b41ab[_0xa713('0x1b')],'UserId':_0x5b41ab['id'],'queue_name':_0xb60e8[_0xa713('0x1b')],'OpenchannelQueueId':_0xb60e8['id'],'interface':util[_0xa713('0x4d')](_0xa713('0x4e'),'SIP',_0x5b41ab[_0xa713('0x1b')]),'penalty':0x0,'paused':_0x5b41ab[_0xa713('0x4a')],'createdAt':_0x5b41ab[_0xa713('0x4c')],'updatedAt':_0x5b41ab[_0xa713('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa713('0x15')](respondWithFilteredResult(_0x1c864f,_0x22d6c6))[_0xa713('0x27')](handleError(_0x1c864f,null));};exports[_0xa713('0x4f')]=function(_0x317d22,_0x12c61a){var _0x30b569={};var _0x3bef5b={};var _0x3f5d62;var _0x5cf9;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x317d22[_0xa713('0x29')]['id']}})[_0xa713('0x15')](handleEntityNotFound(_0x12c61a,null))[_0xa713('0x15')](function(_0xffa81f){if(_0xffa81f){_0x3f5d62=_0xffa81f;_0x3bef5b[_0xa713('0x2a')]=_[_0xa713('0x2b')](db['Team'][_0xa713('0x20')]);_0x3bef5b[_0xa713('0x25')]=_[_0xa713('0x2b')](_0x317d22['query']);_0x3bef5b[_0xa713('0x2c')]=_[_0xa713('0x2d')](_0x3bef5b[_0xa713('0x2a')],_0x3bef5b['query']);_0x30b569[_0xa713('0x2e')]=_[_0xa713('0x2d')](_0x3bef5b[_0xa713('0x2a')],qs[_0xa713('0x2f')](_0x317d22[_0xa713('0x25')][_0xa713('0x2f')]));_0x30b569[_0xa713('0x2e')]=_0x30b569[_0xa713('0x2e')][_0xa713('0x3f')]?_0x30b569['attributes']:_0x3bef5b[_0xa713('0x2a')];_0x30b569[_0xa713('0x50')]=qs[_0xa713('0x41')](_0x317d22[_0xa713('0x25')][_0xa713('0x41')]);_0x30b569[_0xa713('0x42')]=qs[_0xa713('0x2c')](_[_0xa713('0x43')](_0x317d22[_0xa713('0x25')],_0x3bef5b[_0xa713('0x2c')]));if(_0x317d22[_0xa713('0x25')][_0xa713('0x45')]){_0x30b569[_0xa713('0x42')]=_[_0xa713('0x46')](_0x30b569['where'],{'$or':_['map'](_0x30b569[_0xa713('0x2e')],function(_0x4a63bc){var _0x5bded8={};_0x5bded8[_0x4a63bc]={'$like':'%'+_0x317d22[_0xa713('0x25')][_0xa713('0x45')]+'%'};return _0x5bded8;})});}_0x30b569=_[_0xa713('0x46')]({},_0x30b569,_0x317d22[_0xa713('0x47')]);return _0x3f5d62['getTeams'](_0x30b569);}})[_0xa713('0x15')](function(_0x25ea66){if(_0x25ea66){_0x5cf9=_0x25ea66[_0xa713('0x3f')];if(!_0x317d22['query']['hasOwnProperty']('nolimit')){_0x30b569['limit']=qs[_0xa713('0x12')](_0x317d22[_0xa713('0x25')][_0xa713('0x12')]);_0x30b569['offset']=qs[_0xa713('0x10')](_0x317d22[_0xa713('0x25')]['offset']);}return _0x3f5d62['getTeams'](_0x30b569);}})[_0xa713('0x15')](function(_0x45ee0d){if(_0x45ee0d){return _0x45ee0d?{'count':_0x5cf9,'rows':_0x45ee0d}:null;}})['then'](respondWithResult(_0x12c61a,null))[_0xa713('0x27')](handleError(_0x12c61a,null));};exports['addTeams']=function(_0x3f7eee,_0x1e5a63){var _0xe11156=_0x3f7eee[_0xa713('0x3b')][_0xa713('0x51')];return db[_0xa713('0x52')][_0xa713('0x48')]({'where':{'id':_0xe11156},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa713('0x53'),'attributes':['id',_0xa713('0x1b'),_0xa713('0x54'),_0xa713('0x55'),_0xa713('0x56')],'raw':!![]}]})[_0xa713('0x15')](function(_0x56793c){if(_0x56793c){var _0x2544fe=_[_0xa713('0x57')](_0x56793c,function(_0x187b8f){var _0x28b503=_0x187b8f[_0xa713('0x36')]({'plain':!![]});return _0x28b503[_0xa713('0x53')];});return db['OpenchannelQueue'][_0xa713('0x31')]({'where':{'id':_0x3f7eee[_0xa713('0x29')]['id']}})[_0xa713('0x15')](function(_0x59594e){return db[_0xa713('0x58')]['transaction'](function(_0x54270c){return _0x59594e[_0xa713('0x59')](_0xe11156,{'transaction':_0x54270c})[_0xa713('0x15')](function(){return BPromise[_0xa713('0x5a')](_0x2544fe,function(_0x29a984){return db[_0xa713('0x3e')][_0xa713('0x5b')]({'where':{'UserId':_0x29a984['id'],'OpenchannelQueueId':_0x3f7eee[_0xa713('0x29')]['id']},'transaction':_0x54270c});});})[_0xa713('0x15')](function(){_0x2544fe[_0xa713('0x5c')](function(_0x535a00){socket[_0xa713('0x5d')](_0xa713('0x5e'),{'UserId':_0x535a00['id'],'OpenchannelQueueId':_0x59594e['id']});});});});});}})[_0xa713('0x15')](respondWithStatusCode(_0x1e5a63,null))[_0xa713('0x27')](handleError(_0x1e5a63,null));};exports['removeTeams']=function(_0x3c1236,_0x163f90){return db['Team'][_0xa713('0x48')]({'where':{'id':_0x3c1236[_0xa713('0x25')][_0xa713('0x51')]},'attributes':['id'],'include':[{'model':db[_0xa713('0x5f')],'as':_0xa713('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x163f90,null))[_0xa713('0x15')](function(_0x1a1993){var _0x3b2c08=_[_0xa713('0x1e')](_0x1a1993,'id');var _0x2ac1d2=[];var _0x32c4e5=[];var _0xf5f4b5=squel[_0xa713('0x60')]();_0xf5f4b5[_0xa713('0x61')](_0xa713('0x62'))[_0xa713('0x63')](_0xa713('0x64'),'tq')[_0xa713('0x65')](_0xa713('0x66'),'ut',_0xa713('0x67'))[_0xa713('0x42')](_0xa713('0x68'),_0x3c1236['params']['id']);for(var _0x48654a=0x0;_0x48654a<_0x1a1993[_0xa713('0x3f')];_0x48654a+=0x1){let _0x219cf0=_0x1a1993[_0x48654a];for(var _0x38e9f3=0x0;_0x38e9f3<_0x219cf0[_0xa713('0x53')][_0xa713('0x3f')];_0x38e9f3+=0x1){let _0x1807c0=_0x219cf0[_0xa713('0x53')][_0x38e9f3];var _0xfd70af=_0xf5f4b5['clone']();_0xfd70af['where'](_0xa713('0x69'),_0x1807c0['id']);_0x32c4e5['push'](db['sequelize'][_0xa713('0x25')](_0xfd70af[_0xa713('0x6a')](),{'type':db[_0xa713('0x58')][_0xa713('0x6b')][_0xa713('0x6c')]})[_0xa713('0x15')](function(_0xcf05a){if(_0xcf05a[_0xa713('0x3f')]===0x1){return _0x1807c0['id'];}else{var _0x9ae024=_[_0xa713('0x6d')](_[_0xa713('0x1e')](_0xcf05a,_0xa713('0x6e')),function(_0xdc6d97){return _['includes'](_0x3b2c08,_0xdc6d97);});if(_0x9ae024){return _0x1807c0['id'];}}}));}}return BPromise[_0xa713('0x6f')](_0x32c4e5)[_0xa713('0x15')](function(_0x32bca9){_0x2ac1d2=_(_0x2ac1d2)[_0xa713('0x70')](_0x32bca9)[_0xa713('0x71')]()[_0xa713('0x72')]();return db[_0xa713('0x1f')]['find']({'where':{'id':_0x3c1236[_0xa713('0x29')]['id']}})[_0xa713('0x15')](function(_0x3dd78d){return db['sequelize'][_0xa713('0x73')](function(_0x3fde95){return _0x3dd78d['removeTeams'](_0x3c1236[_0xa713('0x25')][_0xa713('0x51')],{'transaction':_0x3fde95})['then'](function(){if(!_[_0xa713('0x74')](_0x2ac1d2)){return _0x3dd78d[_0xa713('0x75')](_0x2ac1d2,{'transaction':_0x3fde95});}})[_0xa713('0x15')](function(){_0x2ac1d2[_0xa713('0x5c')](function(_0x1ff480){socket[_0xa713('0x5d')]('userOpenchannelQueue:remove',{'UserId':_0x1ff480,'OpenchannelQueueId':_0x3dd78d['id']});});});});});});})[_0xa713('0x15')](respondWithStatusCode(_0x163f90,null))[_0xa713('0x27')](handleError(_0x163f90,null));};exports[_0xa713('0x76')]=function(_0x24ef75,_0x26af0b){return db[_0xa713('0x1f')]['find']({'where':{'id':_0x24ef75['params']['id']}})[_0xa713('0x15')](handleEntityNotFound(_0x26af0b,null))[_0xa713('0x15')](function(_0x5623aa){if(_0x5623aa){return _0x5623aa[_0xa713('0x76')](_0x24ef75[_0xa713('0x3b')][_0xa713('0x51')],_[_0xa713('0x77')](_0x24ef75[_0xa713('0x3b')],[_0xa713('0x51'),'id'])||{})[_0xa713('0x78')](function(_0x56c9b5){for(var _0x6f4e7e=0x0;_0x6f4e7e<_0x24ef75[_0xa713('0x3b')][_0xa713('0x51')][_0xa713('0x3f')];_0x6f4e7e+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x24ef75['body'][_0xa713('0x51')][_0x6f4e7e]),'OpenchannelQueueId':Number(_0x24ef75['params']['id'])});}return _0x56c9b5;});}})[_0xa713('0x15')](respondWithResult(_0x26af0b,null))[_0xa713('0x27')](handleError(_0x26af0b,null));};exports[_0xa713('0x75')]=function(_0x46fad2,_0x27829c){return db['OpenchannelQueue'][_0xa713('0x31')]({'where':{'id':_0x46fad2[_0xa713('0x29')]['id']}})[_0xa713('0x15')](handleEntityNotFound(_0x27829c,null))[_0xa713('0x15')](function(_0x2e7cfe){if(_0x2e7cfe){return _0x2e7cfe['removeAgents'](_0x46fad2[_0xa713('0x25')]['ids'])[_0xa713('0x15')](function(){if(_[_0xa713('0x79')](_0x46fad2[_0xa713('0x25')][_0xa713('0x51')])){for(var _0x2e59e8=0x0;_0x2e59e8<_0x46fad2['query'][_0xa713('0x51')][_0xa713('0x3f')];_0x2e59e8+=0x1){socket[_0xa713('0x5d')](_0xa713('0x7a'),{'UserId':Number(_0x46fad2[_0xa713('0x25')]['ids'][_0x2e59e8]),'OpenchannelQueueId':Number(_0x46fad2[_0xa713('0x29')]['id'])});}}else{socket['emit'](_0xa713('0x7a'),{'UserId':Number(_0x46fad2[_0xa713('0x25')][_0xa713('0x51')]),'OpenchannelQueueId':Number(_0x46fad2[_0xa713('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x27829c,null))[_0xa713('0x27')](handleError(_0x27829c,null));};exports[_0xa713('0x7b')]=function(_0x25a9d9,_0x3722b3){var _0x498a1d={};var _0x3db011={};var _0x159a9a;var _0x2a5eba;return db[_0xa713('0x1f')]['findOne']({'where':{'id':_0x25a9d9[_0xa713('0x29')]['id']}})[_0xa713('0x15')](handleEntityNotFound(_0x3722b3,null))['then'](function(_0x395253){if(_0x395253){_0x159a9a=_0x395253;_0x3db011[_0xa713('0x2a')]=_[_0xa713('0x2b')](db[_0xa713('0x5f')]['rawAttributes']);_0x3db011[_0xa713('0x25')]=_['keys'](_0x25a9d9[_0xa713('0x25')]);_0x3db011[_0xa713('0x2c')]=_['intersection'](_0x3db011[_0xa713('0x2a')],_0x3db011[_0xa713('0x25')]);_0x498a1d[_0xa713('0x2e')]=_[_0xa713('0x2d')](_0x3db011[_0xa713('0x2a')],qs[_0xa713('0x2f')](_0x25a9d9[_0xa713('0x25')][_0xa713('0x2f')]));_0x498a1d[_0xa713('0x2e')]=_0x498a1d[_0xa713('0x2e')][_0xa713('0x3f')]?_0x498a1d['attributes']:_0x3db011[_0xa713('0x2a')];_0x498a1d['order']=qs[_0xa713('0x41')](_0x25a9d9[_0xa713('0x25')][_0xa713('0x41')]);_0x498a1d['where']=qs[_0xa713('0x2c')](_[_0xa713('0x43')](_0x25a9d9[_0xa713('0x25')],_0x3db011[_0xa713('0x2c')]));if(_0x25a9d9['query']['filter']){_0x498a1d[_0xa713('0x42')]=_[_0xa713('0x46')](_0x498a1d[_0xa713('0x42')],{'$or':_[_0xa713('0x1e')](_0x498a1d[_0xa713('0x2e')],function(_0x2359a9){var _0x453484={};_0x453484[_0x2359a9]={'$like':'%'+_0x25a9d9[_0xa713('0x25')][_0xa713('0x45')]+'%'};return _0x453484;})});}_0x498a1d=_[_0xa713('0x46')]({},_0x498a1d,_0x25a9d9[_0xa713('0x47')]);return _0x159a9a[_0xa713('0x7b')](_0x498a1d);}})[_0xa713('0x15')](function(_0x5c0088){if(_0x5c0088){_0x2a5eba=_0x5c0088[_0xa713('0x3f')];if(!_0x25a9d9[_0xa713('0x25')][_0xa713('0x7c')](_0xa713('0x40'))){_0x498a1d[_0xa713('0x12')]=qs[_0xa713('0x12')](_0x25a9d9['query'][_0xa713('0x12')]);_0x498a1d[_0xa713('0x10')]=qs[_0xa713('0x10')](_0x25a9d9[_0xa713('0x25')][_0xa713('0x10')]);}return _0x159a9a[_0xa713('0x7b')](_0x498a1d);}})[_0xa713('0x15')](function(_0x3a9bcd){if(_0x3a9bcd){return _0x3a9bcd?{'count':_0x2a5eba,'rows':_0x3a9bcd}:null;}})[_0xa713('0x15')](respondWithResult(_0x3722b3,null))[_0xa713('0x27')](handleError(_0x3722b3,null));}; \ No newline at end of file +var _0x12fa=['index','OpenchannelQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','nolimit','sort','pick','filter','map','UserOpenchannelQueue','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','order','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','defaults','redis','./openchannelQueue.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','json','update','then','destroy','OpenchannelQueues','UserProfileResource','stack','name','send'];(function(_0x35e11f,_0x1f910f){var _0x3a7117=function(_0x2d0a5b){while(--_0x2d0a5b){_0x35e11f['push'](_0x35e11f['shift']());}};_0x3a7117(++_0x1f910f);}(_0x12fa,0xd9));var _0xa12f=function(_0x53f0a8,_0x2195fc){_0x53f0a8=_0x53f0a8-0x0;var _0x418418=_0x12fa[_0x53f0a8];return _0x418418;};'use strict';var BPromise=require(_0xa12f('0x0'));var util=require(_0xa12f('0x1'));var _=require(_0xa12f('0x2'));var squel=require(_0xa12f('0x3'));var Redis=require(_0xa12f('0x4'));var qs=require(_0xa12f('0x5'));var logger=require('../../config/logger')('api');var config=require(_0xa12f('0x6'));var db=require(_0xa12f('0x7'))['db'];config['redis']=_[_0xa12f('0x8')](config[_0xa12f('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa12f('0xa'))[_0xa12f('0xb')](socket);function respondWithStatusCode(_0x1a17a3,_0x1431c7){_0x1431c7=_0x1431c7||0xcc;return function(_0x356bdc){if(_0x356bdc){return _0x1a17a3[_0xa12f('0xc')](_0x1431c7);}return _0x1a17a3['status'](_0x1431c7)[_0xa12f('0xd')]();};}function respondWithResult(_0x527724,_0x4196b0){_0x4196b0=_0x4196b0||0xc8;return function(_0x460042){if(_0x460042){return _0x527724[_0xa12f('0xe')](_0x4196b0)['json'](_0x460042);}};}function respondWithFilteredResult(_0x3f21af,_0xa4d73a){return function(_0x58ff69){if(_0x58ff69){var _0x43b3c0=typeof _0xa4d73a['offset']===_0xa12f('0xf')&&typeof _0xa4d73a[_0xa12f('0x10')]===_0xa12f('0xf');var _0x389382=_0x58ff69[_0xa12f('0x11')];var _0x32f30b=_0x43b3c0?0x0:_0xa4d73a[_0xa12f('0x12')];var _0x42de3e=_0x43b3c0?_0x58ff69[_0xa12f('0x11')]:_0xa4d73a[_0xa12f('0x12')]+_0xa4d73a[_0xa12f('0x10')];var _0x371c2d;if(_0x42de3e>=_0x389382){_0x42de3e=_0x389382;_0x371c2d=0xc8;}else{_0x371c2d=0xce;}_0x3f21af[_0xa12f('0xe')](_0x371c2d);return _0x3f21af[_0xa12f('0x13')]('Content-Range',_0x32f30b+'-'+_0x42de3e+'/'+_0x389382)[_0xa12f('0x14')](_0x58ff69);}return null;};}function saveUpdates(_0x4da763){return function(_0x3222e4){if(_0x3222e4){return _0x3222e4[_0xa12f('0x15')](_0x4da763)[_0xa12f('0x16')](function(_0x9cd71){return _0x9cd71;});}return null;};}function removeEntity(_0xca0405){return function(_0x3f2ae0){if(_0x3f2ae0){return _0x3f2ae0[_0xa12f('0x17')]()[_0xa12f('0x16')](function(){var _0x58cc0a=_0x3f2ae0['get']({'plain':!![]});var _0x303c83=_0xa12f('0x18');return db[_0xa12f('0x19')][_0xa12f('0x17')]({'where':{'type':_0x303c83,'resourceId':_0x58cc0a['id']}})[_0xa12f('0x16')](function(){return _0x3f2ae0;});})[_0xa12f('0x16')](function(){_0xca0405[_0xa12f('0xe')](0xcc)[_0xa12f('0xd')]();});}};}function handleEntityNotFound(_0x448d2a){return function(_0x179a9f){if(!_0x179a9f){_0x448d2a[_0xa12f('0xc')](0x194);}return _0x179a9f;};}function handleError(_0x573750,_0x5738c4){_0x5738c4=_0x5738c4||0x1f4;return function(_0x446015){logger['error'](_0x446015[_0xa12f('0x1a')]);if(_0x446015[_0xa12f('0x1b')]){delete _0x446015[_0xa12f('0x1b')];}_0x573750[_0xa12f('0xe')](_0x5738c4)[_0xa12f('0x1c')](_0x446015);};}exports[_0xa12f('0x1d')]=function(_0x1f0711,_0x3f90f5){var _0x39b0f7={};var _0xcaab0e={'count':0x0,'rows':[]};var _0x22e08f=_['map'](db[_0xa12f('0x1e')][_0xa12f('0x1f')],function(_0x18a091){return{'name':_0x18a091[_0xa12f('0x20')],'type':_0x18a091['type'][_0xa12f('0x21')]};});_0x39b0f7=qs[_0xa12f('0x22')](_0x22e08f,_0x1f0711);var _0xa4d569={'where':_0x39b0f7[_0xa12f('0x23')]};return db[_0xa12f('0x1e')][_0xa12f('0x11')](_0xa4d569)[_0xa12f('0x16')](function(_0x1e5a57){_0xcaab0e['count']=_0x1e5a57;_0x39b0f7[_0xa12f('0x24')]=qs[_0xa12f('0x24')](_0x1f0711[_0xa12f('0x25')]);return db[_0xa12f('0x1e')][_0xa12f('0x26')](_0x39b0f7);})['then'](function(_0x4037ac){_0xcaab0e['rows']=_0x4037ac;return _0xcaab0e;})['then'](respondWithFilteredResult(_0x3f90f5,_0x39b0f7))['catch'](handleError(_0x3f90f5,null));};exports[_0xa12f('0x27')]=function(_0x381696,_0x516e13){var _0x5d728b={'raw':!![],'where':{'id':_0x381696[_0xa12f('0x28')]['id']}},_0x514beb={};_0x514beb[_0xa12f('0x29')]=_['keys'](db['OpenchannelQueue'][_0xa12f('0x1f')]);_0x514beb[_0xa12f('0x25')]=_[_0xa12f('0x2a')](_0x381696[_0xa12f('0x25')]);_0x514beb[_0xa12f('0x2b')]=_[_0xa12f('0x2c')](_0x514beb['model'],_0x514beb['query']);_0x5d728b[_0xa12f('0x2d')]=_['intersection'](_0x514beb[_0xa12f('0x29')],qs[_0xa12f('0x2e')](_0x381696[_0xa12f('0x25')][_0xa12f('0x2e')]));_0x5d728b[_0xa12f('0x2d')]=_0x5d728b['attributes'][_0xa12f('0x2f')]?_0x5d728b[_0xa12f('0x2d')]:_0x514beb['model'];if(_0x381696[_0xa12f('0x25')][_0xa12f('0x30')]){_0x5d728b[_0xa12f('0x24')]=[{'all':!![]}];}_0x5d728b=_[_0xa12f('0x31')]({},_0x5d728b,_0x381696[_0xa12f('0x32')]);return db[_0xa12f('0x1e')][_0xa12f('0x33')](_0x5d728b)[_0xa12f('0x16')](handleEntityNotFound(_0x516e13,null))['then'](respondWithResult(_0x516e13,null))[_0xa12f('0x34')](handleError(_0x516e13,null));};exports['create']=function(_0x3f3307,_0x467418){return db[_0xa12f('0x1e')]['create'](_0x3f3307[_0xa12f('0x35')],{})[_0xa12f('0x16')](function(_0x5b39d6){var _0x5c374b=_0x3f3307[_0xa12f('0x36')][_0xa12f('0x37')]({'plain':!![]});if(!_0x5c374b)throw new Error(_0xa12f('0x38'));if(_0x5c374b[_0xa12f('0x39')]===_0xa12f('0x36')){var _0x51ea2a=_0x5b39d6[_0xa12f('0x37')]({'plain':!![]});var _0x29713d=_0xa12f('0x18');return db['UserProfileSection'][_0xa12f('0x33')]({'where':{'name':_0x29713d,'userProfileId':_0x5c374b[_0xa12f('0x3a')]},'raw':!![]})[_0xa12f('0x16')](function(_0x42d3ee){if(_0x42d3ee&&_0x42d3ee[_0xa12f('0x3b')]===0x0){return db[_0xa12f('0x19')]['create']({'name':_0x51ea2a[_0xa12f('0x1b')],'resourceId':_0x51ea2a['id'],'type':_0x42d3ee['name'],'sectionId':_0x42d3ee['id']},{})[_0xa12f('0x16')](function(){return _0x5b39d6;});}else{return _0x5b39d6;}})[_0xa12f('0x34')](function(_0x52e6ee){logger[_0xa12f('0x3c')](_0xa12f('0x3d'),_0x52e6ee);throw _0x52e6ee;});}return _0x5b39d6;})[_0xa12f('0x16')](respondWithResult(_0x467418,0xc9))['catch'](handleError(_0x467418,null));};exports[_0xa12f('0x15')]=function(_0x2f297d,_0x3e537e){if(_0x2f297d[_0xa12f('0x35')]['id']){delete _0x2f297d[_0xa12f('0x35')]['id'];}return db['OpenchannelQueue'][_0xa12f('0x33')]({'where':{'id':_0x2f297d['params']['id']}})[_0xa12f('0x16')](handleEntityNotFound(_0x3e537e,null))[_0xa12f('0x16')](saveUpdates(_0x2f297d[_0xa12f('0x35')],null))[_0xa12f('0x16')](respondWithResult(_0x3e537e,null))[_0xa12f('0x34')](handleError(_0x3e537e,null));};exports[_0xa12f('0x17')]=function(_0xe249aa,_0x214634){return db[_0xa12f('0x1e')][_0xa12f('0x33')]({'where':{'id':_0xe249aa[_0xa12f('0x28')]['id']}})[_0xa12f('0x16')](handleEntityNotFound(_0x214634,null))[_0xa12f('0x16')](removeEntity(_0x214634,null))['catch'](handleError(_0x214634,null));};exports[_0xa12f('0x3e')]=function(_0x1ea0e3,_0x274ddd){return db[_0xa12f('0x1e')][_0xa12f('0x3e')]()[_0xa12f('0x16')](respondWithResult(_0x274ddd,null))['catch'](handleError(_0x274ddd,null));};exports[_0xa12f('0x3f')]=function(_0x146663,_0x40d978){var _0x12b74b={'raw':!![],'where':{}},_0x23785c={},_0x12dd6c;return db[_0xa12f('0x1e')][_0xa12f('0x40')]({'where':{'id':_0x146663[_0xa12f('0x28')]['id']}})[_0xa12f('0x16')](handleEntityNotFound(_0x40d978,null))[_0xa12f('0x16')](function(_0x4981b4){if(_0x4981b4){_0x12dd6c=_0x4981b4[_0xa12f('0x37')]({'plain':!![]});_0x23785c[_0xa12f('0x29')]=_[_0xa12f('0x2a')](db['UserOpenchannelQueue'][_0xa12f('0x1f')]);_0x23785c['query']=_['keys'](_0x146663[_0xa12f('0x25')]);_0x23785c[_0xa12f('0x2b')]=_[_0xa12f('0x2c')](_0x23785c['model'],_0x23785c[_0xa12f('0x25')]);_0x12b74b['attributes']=_[_0xa12f('0x2c')](_0x23785c[_0xa12f('0x29')],qs[_0xa12f('0x2e')](_0x146663[_0xa12f('0x25')][_0xa12f('0x2e')]));_0x12b74b['attributes']=_0x12b74b[_0xa12f('0x2d')][_0xa12f('0x2f')]?_0x12b74b[_0xa12f('0x2d')]:_0x23785c[_0xa12f('0x29')];if(!_0x146663[_0xa12f('0x25')][_0xa12f('0x41')](_0xa12f('0x42'))){_0x12b74b['limit']=qs[_0xa12f('0x10')](_0x146663['query'][_0xa12f('0x10')]);_0x12b74b[_0xa12f('0x12')]=qs[_0xa12f('0x12')](_0x146663[_0xa12f('0x25')]['offset']);}_0x12b74b['order']=qs[_0xa12f('0x43')](_0x146663[_0xa12f('0x25')][_0xa12f('0x43')]);_0x12b74b['where']=qs[_0xa12f('0x2b')](_[_0xa12f('0x44')](_0x146663[_0xa12f('0x25')],_0x23785c[_0xa12f('0x2b')]));_0x12b74b[_0xa12f('0x23')]['OpenchannelQueueId']=_0x4981b4['id'];if(_0x146663[_0xa12f('0x25')][_0xa12f('0x45')]){_0x12b74b[_0xa12f('0x23')]=_[_0xa12f('0x31')](_0x12b74b['where'],{'$or':_[_0xa12f('0x46')](_0x12b74b[_0xa12f('0x2d')],function(_0x8c5beb){var _0x4f47fc={};_0x4f47fc[_0x8c5beb]={'$like':'%'+_0x146663[_0xa12f('0x25')]['filter']+'%'};return _0x4f47fc;})});}_0x12b74b=_[_0xa12f('0x31')]({},_0x12b74b,_0x146663[_0xa12f('0x32')]);return db[_0xa12f('0x47')][_0xa12f('0x26')](_0x12b74b);}})[_0xa12f('0x16')](function(_0x48f876){if(_0x48f876){return db['User']['findAndCountAll']({'where':{'id':_[_0xa12f('0x46')](_0x48f876,_0xa12f('0x48')),'role':_0xa12f('0x49')},'attributes':['id','name',_0xa12f('0x4a'),_0xa12f('0x4b'),_0xa12f('0x4c')]});}})[_0xa12f('0x16')](function(_0x1e1d3c){if(_0x1e1d3c){return{'count':_0x1e1d3c[_0xa12f('0x11')],'rows':_['map'](_0x1e1d3c[_0xa12f('0x4d')],function(_0x1baed8){return{'membername':_0x1baed8[_0xa12f('0x1b')],'UserId':_0x1baed8['id'],'queue_name':_0x12dd6c[_0xa12f('0x1b')],'OpenchannelQueueId':_0x12dd6c['id'],'interface':util[_0xa12f('0x4e')](_0xa12f('0x4f'),_0xa12f('0x50'),_0x1baed8[_0xa12f('0x1b')]),'penalty':0x0,'paused':_0x1baed8[_0xa12f('0x4a')],'createdAt':_0x1baed8['createdAt'],'updatedAt':_0x1baed8[_0xa12f('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa12f('0x16')](respondWithFilteredResult(_0x40d978,_0x12b74b))['catch'](handleError(_0x40d978,null));};exports[_0xa12f('0x51')]=function(_0x2841c3,_0x3c2d2f){var _0x3acc15={};var _0x1e78c6={};var _0x4a5148;var _0x9e8c59;return db['OpenchannelQueue'][_0xa12f('0x40')]({'where':{'id':_0x2841c3[_0xa12f('0x28')]['id']}})[_0xa12f('0x16')](handleEntityNotFound(_0x3c2d2f,null))['then'](function(_0x263c03){if(_0x263c03){_0x4a5148=_0x263c03;_0x1e78c6['model']=_['keys'](db['Team'][_0xa12f('0x1f')]);_0x1e78c6[_0xa12f('0x25')]=_['keys'](_0x2841c3['query']);_0x1e78c6['filters']=_[_0xa12f('0x2c')](_0x1e78c6[_0xa12f('0x29')],_0x1e78c6[_0xa12f('0x25')]);_0x3acc15[_0xa12f('0x2d')]=_['intersection'](_0x1e78c6['model'],qs[_0xa12f('0x2e')](_0x2841c3['query'][_0xa12f('0x2e')]));_0x3acc15[_0xa12f('0x2d')]=_0x3acc15[_0xa12f('0x2d')][_0xa12f('0x2f')]?_0x3acc15[_0xa12f('0x2d')]:_0x1e78c6[_0xa12f('0x29')];_0x3acc15['order']=qs[_0xa12f('0x43')](_0x2841c3[_0xa12f('0x25')]['sort']);_0x3acc15[_0xa12f('0x23')]=qs[_0xa12f('0x2b')](_['pick'](_0x2841c3['query'],_0x1e78c6[_0xa12f('0x2b')]));if(_0x2841c3[_0xa12f('0x25')][_0xa12f('0x45')]){_0x3acc15[_0xa12f('0x23')]=_[_0xa12f('0x31')](_0x3acc15[_0xa12f('0x23')],{'$or':_[_0xa12f('0x46')](_0x3acc15[_0xa12f('0x2d')],function(_0x5c5b5e){var _0x3bc943={};_0x3bc943[_0x5c5b5e]={'$like':'%'+_0x2841c3[_0xa12f('0x25')][_0xa12f('0x45')]+'%'};return _0x3bc943;})});}_0x3acc15=_[_0xa12f('0x31')]({},_0x3acc15,_0x2841c3[_0xa12f('0x32')]);return _0x4a5148[_0xa12f('0x51')](_0x3acc15);}})[_0xa12f('0x16')](function(_0x46a842){if(_0x46a842){_0x9e8c59=_0x46a842[_0xa12f('0x2f')];if(!_0x2841c3[_0xa12f('0x25')][_0xa12f('0x41')](_0xa12f('0x42'))){_0x3acc15[_0xa12f('0x10')]=qs[_0xa12f('0x10')](_0x2841c3[_0xa12f('0x25')][_0xa12f('0x10')]);_0x3acc15[_0xa12f('0x12')]=qs[_0xa12f('0x12')](_0x2841c3[_0xa12f('0x25')][_0xa12f('0x12')]);}return _0x4a5148[_0xa12f('0x51')](_0x3acc15);}})[_0xa12f('0x16')](function(_0x57c7b3){if(_0x57c7b3){return _0x57c7b3?{'count':_0x9e8c59,'rows':_0x57c7b3}:null;}})[_0xa12f('0x16')](respondWithResult(_0x3c2d2f,null))[_0xa12f('0x34')](handleError(_0x3c2d2f,null));};exports[_0xa12f('0x52')]=function(_0x1d6bd0,_0x5adb54){var _0x41f794=_0x1d6bd0[_0xa12f('0x35')][_0xa12f('0x53')];return db['Team']['findAll']({'where':{'id':_0x41f794},'attributes':['id'],'include':[{'model':db[_0xa12f('0x54')],'as':_0xa12f('0x55'),'attributes':['id','name',_0xa12f('0x56'),_0xa12f('0x57'),_0xa12f('0x58')],'raw':!![]}]})['then'](function(_0x4ba3e1){if(_0x4ba3e1){var _0x3bf313=_[_0xa12f('0x59')](_0x4ba3e1,function(_0xe3701c){var _0x1dcb4e=_0xe3701c[_0xa12f('0x37')]({'plain':!![]});return _0x1dcb4e[_0xa12f('0x55')];});return db[_0xa12f('0x1e')][_0xa12f('0x33')]({'where':{'id':_0x1d6bd0[_0xa12f('0x28')]['id']}})[_0xa12f('0x16')](function(_0x56a953){return db['sequelize'][_0xa12f('0x5a')](function(_0xdfbca){return _0x56a953['addTeams'](_0x41f794,{'transaction':_0xdfbca})[_0xa12f('0x16')](function(){return BPromise[_0xa12f('0x5b')](_0x3bf313,function(_0x4cff8f){return db['UserOpenchannelQueue'][_0xa12f('0x5c')]({'where':{'UserId':_0x4cff8f['id'],'OpenchannelQueueId':_0x1d6bd0[_0xa12f('0x28')]['id']},'transaction':_0xdfbca});});})[_0xa12f('0x16')](function(){_0x3bf313[_0xa12f('0x5d')](function(_0x532c07){socket[_0xa12f('0x5e')](_0xa12f('0x5f'),{'UserId':_0x532c07['id'],'OpenchannelQueueId':_0x56a953['id']});});});});});}})[_0xa12f('0x16')](respondWithStatusCode(_0x5adb54,null))[_0xa12f('0x34')](handleError(_0x5adb54,null));};exports[_0xa12f('0x60')]=function(_0xc0d297,_0x495346){return db['Team'][_0xa12f('0x26')]({'where':{'id':_0xc0d297['query'][_0xa12f('0x53')]},'attributes':['id'],'include':[{'model':db[_0xa12f('0x54')],'as':_0xa12f('0x55'),'attributes':['id'],'raw':!![]}]})[_0xa12f('0x16')](handleEntityNotFound(_0x495346,null))[_0xa12f('0x16')](function(_0x5b283d){var _0x5311f6=_['map'](_0x5b283d,'id');var _0x3238c7=[];var _0x7f253d=[];var _0xd27d5b=squel[_0xa12f('0x61')]();_0xd27d5b[_0xa12f('0x62')]('tq.TeamId')['from']('team_has_openchannel_queues','tq')[_0xa12f('0x63')](_0xa12f('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa12f('0x23')](_0xa12f('0x65'),_0xc0d297[_0xa12f('0x28')]['id']);for(var _0x463581=0x0;_0x463581<_0x5b283d[_0xa12f('0x2f')];_0x463581+=0x1){let _0xdd55c2=_0x5b283d[_0x463581];for(var _0x2fb91c=0x0;_0x2fb91c<_0xdd55c2[_0xa12f('0x55')][_0xa12f('0x2f')];_0x2fb91c+=0x1){let _0x3efa0a=_0xdd55c2[_0xa12f('0x55')][_0x2fb91c];var _0xb60f6a=_0xd27d5b[_0xa12f('0x66')]();_0xb60f6a[_0xa12f('0x23')](_0xa12f('0x67'),_0x3efa0a['id']);_0x7f253d[_0xa12f('0x68')](db['sequelize'][_0xa12f('0x25')](_0xb60f6a[_0xa12f('0x69')](),{'type':db[_0xa12f('0x6a')][_0xa12f('0x6b')][_0xa12f('0x6c')]})[_0xa12f('0x16')](function(_0x55d7a8){if(_0x55d7a8[_0xa12f('0x2f')]===0x1){return _0x3efa0a['id'];}else{var _0x1141fe=_[_0xa12f('0x6d')](_[_0xa12f('0x46')](_0x55d7a8,_0xa12f('0x6e')),function(_0x1ba3d6){return _[_0xa12f('0x6f')](_0x5311f6,_0x1ba3d6);});if(_0x1141fe){return _0x3efa0a['id'];}}}));}}return BPromise[_0xa12f('0x70')](_0x7f253d)[_0xa12f('0x16')](function(_0x1a9a90){_0x3238c7=_(_0x3238c7)[_0xa12f('0x71')](_0x1a9a90)['compact']()['value']();return db['OpenchannelQueue'][_0xa12f('0x33')]({'where':{'id':_0xc0d297[_0xa12f('0x28')]['id']}})[_0xa12f('0x16')](function(_0x376630){return db[_0xa12f('0x6a')][_0xa12f('0x5a')](function(_0x576631){return _0x376630[_0xa12f('0x60')](_0xc0d297['query']['ids'],{'transaction':_0x576631})[_0xa12f('0x16')](function(){if(!_[_0xa12f('0x72')](_0x3238c7)){return _0x376630[_0xa12f('0x73')](_0x3238c7,{'transaction':_0x576631});}})[_0xa12f('0x16')](function(){_0x3238c7[_0xa12f('0x5d')](function(_0x1e0c6f){socket[_0xa12f('0x5e')](_0xa12f('0x74'),{'UserId':_0x1e0c6f,'OpenchannelQueueId':_0x376630['id']});});});});});});})[_0xa12f('0x16')](respondWithStatusCode(_0x495346,null))['catch'](handleError(_0x495346,null));};exports[_0xa12f('0x75')]=function(_0x12f46d,_0x1b099c){return db['OpenchannelQueue'][_0xa12f('0x33')]({'where':{'id':_0x12f46d[_0xa12f('0x28')]['id']}})[_0xa12f('0x16')](handleEntityNotFound(_0x1b099c,null))['then'](function(_0x374c99){if(_0x374c99){return _0x374c99['addAgents'](_0x12f46d[_0xa12f('0x35')][_0xa12f('0x53')],_[_0xa12f('0x76')](_0x12f46d['body'],['ids','id'])||{})[_0xa12f('0x77')](function(_0x32b539){for(var _0x575c13=0x0;_0x575c13<_0x12f46d[_0xa12f('0x35')]['ids']['length'];_0x575c13+=0x1){socket[_0xa12f('0x5e')](_0xa12f('0x5f'),{'UserId':Number(_0x12f46d[_0xa12f('0x35')][_0xa12f('0x53')][_0x575c13]),'OpenchannelQueueId':Number(_0x12f46d[_0xa12f('0x28')]['id'])});}return _0x32b539;});}})[_0xa12f('0x16')](respondWithResult(_0x1b099c,null))[_0xa12f('0x34')](handleError(_0x1b099c,null));};exports[_0xa12f('0x73')]=function(_0x5c3837,_0x1e484f){return db[_0xa12f('0x1e')][_0xa12f('0x33')]({'where':{'id':_0x5c3837[_0xa12f('0x28')]['id']}})[_0xa12f('0x16')](handleEntityNotFound(_0x1e484f,null))[_0xa12f('0x16')](function(_0x17228c){if(_0x17228c){return _0x17228c[_0xa12f('0x73')](_0x5c3837[_0xa12f('0x25')][_0xa12f('0x53')])['then'](function(){if(_[_0xa12f('0x78')](_0x5c3837[_0xa12f('0x25')]['ids'])){for(var _0xf5fe5f=0x0;_0xf5fe5f<_0x5c3837['query'][_0xa12f('0x53')][_0xa12f('0x2f')];_0xf5fe5f+=0x1){socket['emit'](_0xa12f('0x74'),{'UserId':Number(_0x5c3837[_0xa12f('0x25')][_0xa12f('0x53')][_0xf5fe5f]),'OpenchannelQueueId':Number(_0x5c3837[_0xa12f('0x28')]['id'])});}}else{socket[_0xa12f('0x5e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5c3837[_0xa12f('0x25')][_0xa12f('0x53')]),'OpenchannelQueueId':Number(_0x5c3837[_0xa12f('0x28')]['id'])});}});}})[_0xa12f('0x16')](respondWithStatusCode(_0x1e484f,null))['catch'](handleError(_0x1e484f,null));};exports[_0xa12f('0x79')]=function(_0x2b1d05,_0x454ca2){var _0x184492={};var _0x2db3fb={};var _0x476721;var _0x726b6b;return db[_0xa12f('0x1e')][_0xa12f('0x40')]({'where':{'id':_0x2b1d05[_0xa12f('0x28')]['id']}})[_0xa12f('0x16')](handleEntityNotFound(_0x454ca2,null))['then'](function(_0x298794){if(_0x298794){_0x476721=_0x298794;_0x2db3fb[_0xa12f('0x29')]=_['keys'](db[_0xa12f('0x54')][_0xa12f('0x1f')]);_0x2db3fb[_0xa12f('0x25')]=_[_0xa12f('0x2a')](_0x2b1d05[_0xa12f('0x25')]);_0x2db3fb[_0xa12f('0x2b')]=_['intersection'](_0x2db3fb[_0xa12f('0x29')],_0x2db3fb['query']);_0x184492[_0xa12f('0x2d')]=_[_0xa12f('0x2c')](_0x2db3fb[_0xa12f('0x29')],qs[_0xa12f('0x2e')](_0x2b1d05['query'][_0xa12f('0x2e')]));_0x184492[_0xa12f('0x2d')]=_0x184492[_0xa12f('0x2d')][_0xa12f('0x2f')]?_0x184492[_0xa12f('0x2d')]:_0x2db3fb[_0xa12f('0x29')];_0x184492[_0xa12f('0x7a')]=qs[_0xa12f('0x43')](_0x2b1d05[_0xa12f('0x25')][_0xa12f('0x43')]);_0x184492[_0xa12f('0x23')]=qs[_0xa12f('0x2b')](_[_0xa12f('0x44')](_0x2b1d05[_0xa12f('0x25')],_0x2db3fb[_0xa12f('0x2b')]));if(_0x2b1d05[_0xa12f('0x25')]['filter']){_0x184492[_0xa12f('0x23')]=_[_0xa12f('0x31')](_0x184492['where'],{'$or':_[_0xa12f('0x46')](_0x184492[_0xa12f('0x2d')],function(_0x49a322){var _0xbe53ab={};_0xbe53ab[_0x49a322]={'$like':'%'+_0x2b1d05['query'][_0xa12f('0x45')]+'%'};return _0xbe53ab;})});}_0x184492=_['merge']({},_0x184492,_0x2b1d05[_0xa12f('0x32')]);return _0x476721['getAgents'](_0x184492);}})[_0xa12f('0x16')](function(_0x1be3d6){if(_0x1be3d6){_0x726b6b=_0x1be3d6[_0xa12f('0x2f')];if(!_0x2b1d05[_0xa12f('0x25')][_0xa12f('0x41')](_0xa12f('0x42'))){_0x184492[_0xa12f('0x10')]=qs[_0xa12f('0x10')](_0x2b1d05[_0xa12f('0x25')]['limit']);_0x184492[_0xa12f('0x12')]=qs[_0xa12f('0x12')](_0x2b1d05[_0xa12f('0x25')][_0xa12f('0x12')]);}return _0x476721[_0xa12f('0x79')](_0x184492);}})['then'](function(_0x3c6d1c){if(_0x3c6d1c){return _0x3c6d1c?{'count':_0x726b6b,'rows':_0x3c6d1c}:null;}})[_0xa12f('0x16')](respondWithResult(_0x454ca2,null))[_0xa12f('0x34')](handleError(_0x454ca2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 64e0a67..2408e87 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 _0xd3ab=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xd3ab,0xf0));var _0xbd3a=function(_0x3354a4,_0x3484d3){_0x3354a4=_0x3354a4-0x0;var _0x590ef6=_0xd3ab[_0x3354a4];return _0x590ef6;};'use strict';var EventEmitter=require(_0xbd3a('0x0'));var OpenchannelQueue=require(_0xbd3a('0x1'))['db'][_0xbd3a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xbd3a('0x3')](0x0);var events={'afterCreate':_0xbd3a('0x4'),'afterUpdate':_0xbd3a('0x5'),'afterDestroy':_0xbd3a('0x6')};function emitEvent(_0x2fd8cd){return function(_0x46209e,_0x3664db,_0x2f5815){OpenchannelQueueEvents[_0xbd3a('0x7')](_0x2fd8cd+':'+_0x46209e['id'],_0x46209e);OpenchannelQueueEvents[_0xbd3a('0x7')](_0x2fd8cd,_0x46209e);_0x2f5815(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xbd3a('0x8')](e,emitEvent(event));}}module[_0xbd3a('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x750f=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','hasOwnProperty'];(function(_0x42bd44,_0x51fe91){var _0x2cee8a=function(_0x10f5e8){while(--_0x10f5e8){_0x42bd44['push'](_0x42bd44['shift']());}};_0x2cee8a(++_0x51fe91);}(_0x750f,0x78));var _0xf750=function(_0x497875,_0x2ae785){_0x497875=_0x497875-0x0;var _0x761c99=_0x750f[_0x497875];return _0x761c99;};'use strict';var EventEmitter=require(_0xf750('0x0'));var OpenchannelQueue=require(_0xf750('0x1'))['db'][_0xf750('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf750('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf750('0x4'),'afterDestroy':'remove'};function emitEvent(_0x24a9b4){return function(_0x30bfe9,_0x3444e8,_0x521166){OpenchannelQueueEvents['emit'](_0x24a9b4+':'+_0x30bfe9['id'],_0x30bfe9);OpenchannelQueueEvents['emit'](_0x24a9b4,_0x30bfe9);_0x521166(null);};}for(var e in events){if(events[_0xf750('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](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 551a83b..1e7bee9 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 _0xb0c9=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','define','OpenchannelQueue','openchannel_queues'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb0c9,0x136));var _0x9b0c=function(_0xb366f1,_0x1b9197){_0xb366f1=_0xb366f1-0x0;var _0x879beb=_0xb0c9[_0xb366f1];return _0x879beb;};'use strict';var _=require(_0x9b0c('0x0'));var util=require(_0x9b0c('0x1'));var logger=require(_0x9b0c('0x2'))(_0x9b0c('0x3'));var moment=require(_0x9b0c('0x4'));var BPromise=require(_0x9b0c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9b0c('0x6'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x2e24df,_0x28d742){return _0x2e24df[_0x9b0c('0x7')](_0x9b0c('0x8'),attributes,{'tableName':_0x9b0c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cae=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','api'];(function(_0x17a5d7,_0x4080a9){var _0x2cc7bc=function(_0xc1fcbf){while(--_0xc1fcbf){_0x17a5d7['push'](_0x17a5d7['shift']());}};_0x2cc7bc(++_0x4080a9);}(_0x0cae,0x81));var _0xe0ca=function(_0x19ff3d,_0x10b083){_0x19ff3d=_0x19ff3d-0x0;var _0x516325=_0x0cae[_0x19ff3d];return _0x516325;};'use strict';var _=require(_0xe0ca('0x0'));var util=require(_0xe0ca('0x1'));var logger=require('../../config/logger')(_0xe0ca('0x2'));var moment=require(_0xe0ca('0x3'));var BPromise=require(_0xe0ca('0x4'));var rp=require(_0xe0ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0ca('0x6'));var config=require(_0xe0ca('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0xe0ca('0x8')]=function(_0x1ec4e6,_0x478613){return _0x1ec4e6[_0xe0ca('0x9')](_0xe0ca('0xa'),attributes,{'tableName':_0xe0ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 3d13f6d..1aa17d2 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 _0x6fec=['request','then','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register'];(function(_0x45b585,_0x53fd7e){var _0x158eb4=function(_0x47d62d){while(--_0x47d62d){_0x45b585['push'](_0x45b585['shift']());}};_0x158eb4(++_0x53fd7e);}(_0x6fec,0xdb));var _0xc6fe=function(_0x2f3db3,_0x53ac84){_0x2f3db3=_0x2f3db3-0x0;var _0x2041cd=_0x6fec[_0x2f3db3];return _0x2041cd;};'use strict';var _=require(_0xc6fe('0x0'));var util=require(_0xc6fe('0x1'));var moment=require(_0xc6fe('0x2'));var BPromise=require(_0xc6fe('0x3'));var rs=require(_0xc6fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6fe('0x5'))['db'];var utils=require(_0xc6fe('0x6'));var logger=require(_0xc6fe('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc6fe('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xc6fe('0x9')]=_[_0xc6fe('0xa')](config[_0xc6fe('0x9')],{'host':_0xc6fe('0xb'),'port':0x18eb});var socket=require(_0xc6fe('0xc'))(new Redis(config[_0xc6fe('0x9')]));require(_0xc6fe('0xd'))[_0xc6fe('0xe')](socket);function respondWithRpcPromise(_0x57480f,_0xb213ce,_0x1cedcc){return new BPromise(function(_0x2987e3,_0x569f5d){return client[_0xc6fe('0xf')](_0x57480f,_0x1cedcc)[_0xc6fe('0x10')](function(_0x3a5d3d){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0xb213ce,_0xc6fe('0x11'));logger[_0xc6fe('0x12')](_0xc6fe('0x13'),_0xb213ce,_0xc6fe('0x11'),JSON[_0xc6fe('0x14')](_0x3a5d3d));if(_0x3a5d3d[_0xc6fe('0x15')]){if(_0x3a5d3d[_0xc6fe('0x15')][_0xc6fe('0x16')]===0x1f4){logger['error'](_0xc6fe('0x17'),_0xb213ce,_0x3a5d3d[_0xc6fe('0x15')][_0xc6fe('0x18')]);return _0x569f5d(_0x3a5d3d[_0xc6fe('0x15')]['message']);}logger[_0xc6fe('0x15')](_0xc6fe('0x17'),_0xb213ce,_0x3a5d3d['error']['message']);return _0x2987e3(_0x3a5d3d[_0xc6fe('0x15')][_0xc6fe('0x18')]);}else{logger[_0xc6fe('0x19')](_0xc6fe('0x17'),_0xb213ce,'request\x20sent');_0x2987e3(_0x3a5d3d[_0xc6fe('0x1a')][_0xc6fe('0x18')]);}})[_0xc6fe('0x1b')](function(_0x5b5717){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0xb213ce,_0x5b5717);_0x569f5d(_0x5b5717);});});}exports[_0xc6fe('0x1c')]=function(_0x35401c){var _0x5ec82d=this;return new Promise(function(_0x194e1f,_0x5c3f8f){return db[_0xc6fe('0x1d')]['findAll']({'raw':_0x35401c[_0xc6fe('0x1e')]?_0x35401c['options'][_0xc6fe('0x1f')]===undefined?!![]:![]:!![],'where':_0x35401c[_0xc6fe('0x1e')]?_0x35401c[_0xc6fe('0x1e')]['where']||null:null,'attributes':_0x35401c[_0xc6fe('0x1e')]?_0x35401c[_0xc6fe('0x1e')][_0xc6fe('0x20')]||null:null,'limit':_0x35401c[_0xc6fe('0x1e')]?_0x35401c[_0xc6fe('0x1e')][_0xc6fe('0x21')]||null:null,'include':_0x35401c['options']?_0x35401c['options'][_0xc6fe('0x22')]?_['map'](_0x35401c['options'][_0xc6fe('0x22')],function(_0x5cb062){return{'model':db[_0x5cb062['model']],'as':_0x5cb062['as'],'attributes':_0x5cb062['attributes'],'include':_0x5cb062[_0xc6fe('0x22')]?_[_0xc6fe('0x23')](_0x5cb062[_0xc6fe('0x22')],function(_0x59ab52){return{'model':db[_0x59ab52[_0xc6fe('0x24')]],'as':_0x59ab52['as'],'attributes':_0x59ab52['attributes'],'include':_0x59ab52['include']?_['map'](_0x59ab52['include'],function(_0x136241){return{'model':db[_0x136241[_0xc6fe('0x24')]],'as':_0x136241['as'],'attributes':_0x136241[_0xc6fe('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc6fe('0x10')](function(_0x48d817){logger['info'](_0xc6fe('0x1c'),_0x35401c);logger[_0xc6fe('0x12')](_0xc6fe('0x1c'),_0x35401c,JSON['stringify'](_0x48d817));_0x194e1f(_0x48d817);})[_0xc6fe('0x1b')](function(_0x4b061b){logger[_0xc6fe('0x15')](_0xc6fe('0x1c'),_0x4b061b[_0xc6fe('0x18')],_0x35401c);_0x5c3f8f(_0x5ec82d[_0xc6fe('0x15')](0x1f4,_0x4b061b['message']));});});};exports[_0xc6fe('0x25')]=function(_0xd0998c){var _0x41722d=this;return new Promise(function(_0x46dbcc,_0x51a168){return db['OpenchannelQueue'][_0xc6fe('0x26')]({'raw':_0xd0998c[_0xc6fe('0x1e')]?_0xd0998c[_0xc6fe('0x1e')][_0xc6fe('0x1f')]===undefined?!![]:![]:!![],'where':_0xd0998c[_0xc6fe('0x1e')]?_0xd0998c[_0xc6fe('0x1e')]['where']||null:null,'attributes':_0xd0998c['options']?_0xd0998c[_0xc6fe('0x1e')][_0xc6fe('0x20')]||null:null,'include':_0xd0998c['options']?_0xd0998c[_0xc6fe('0x1e')][_0xc6fe('0x22')]?_[_0xc6fe('0x23')](_0xd0998c[_0xc6fe('0x1e')][_0xc6fe('0x22')],function(_0x126279){return{'model':db[_0x126279['model']],'as':_0x126279['as'],'attributes':_0x126279[_0xc6fe('0x20')],'include':_0x126279[_0xc6fe('0x22')]?_['map'](_0x126279[_0xc6fe('0x22')],function(_0x5f348e){return{'model':db[_0x5f348e[_0xc6fe('0x24')]],'as':_0x5f348e['as'],'attributes':_0x5f348e['attributes'],'include':_0x5f348e['include']?_[_0xc6fe('0x23')](_0x5f348e['include'],function(_0x30de6d){return{'model':db[_0x30de6d[_0xc6fe('0x24')]],'as':_0x30de6d['as'],'attributes':_0x30de6d[_0xc6fe('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b6369){logger[_0xc6fe('0x19')]('ShowOpenchannelQueue',_0xd0998c);logger[_0xc6fe('0x12')](_0xc6fe('0x25'),_0xd0998c,JSON[_0xc6fe('0x14')](_0x3b6369));_0x46dbcc(_0x3b6369);})['catch'](function(_0x4955de){logger[_0xc6fe('0x15')](_0xc6fe('0x25'),_0x4955de[_0xc6fe('0x18')],_0xd0998c);_0x51a168(_0x41722d[_0xc6fe('0x15')](0x1f4,_0x4955de['message']));});});}; \ No newline at end of file +var _0x01f9=['http','redis','defaults','localhost','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetOpenchannelQueue','findAll','options','raw','limit','include','map','attributes','model','then','catch','ShowOpenchannelQueue','OpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x406eb8,_0x4dc747){var _0x4c17f5=function(_0x311d1c){while(--_0x311d1c){_0x406eb8['push'](_0x406eb8['shift']());}};_0x4c17f5(++_0x4dc747);}(_0x01f9,0x16e));var _0x901f=function(_0x4a121d,_0x3ace8e){_0x4a121d=_0x4a121d-0x0;var _0x5d75c6=_0x01f9[_0x4a121d];return _0x5d75c6;};'use strict';var _=require(_0x901f('0x0'));var util=require(_0x901f('0x1'));var moment=require(_0x901f('0x2'));var BPromise=require(_0x901f('0x3'));var rs=require(_0x901f('0x4'));var fs=require('fs');var Redis=require(_0x901f('0x5'));var db=require(_0x901f('0x6'))['db'];var utils=require(_0x901f('0x7'));var logger=require(_0x901f('0x8'))(_0x901f('0x9'));var config=require(_0x901f('0xa'));var jayson=require(_0x901f('0xb'));var client=jayson['client'][_0x901f('0xc')]({'port':0x232a});config[_0x901f('0xd')]=_[_0x901f('0xe')](config[_0x901f('0xd')],{'host':_0x901f('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x901f('0xd')]));require(_0x901f('0x10'))['register'](socket);function respondWithRpcPromise(_0x3b51f1,_0x5bb35b,_0x38f00c){return new BPromise(function(_0x2ee563,_0x1fe139){return client[_0x901f('0x11')](_0x3b51f1,_0x38f00c)['then'](function(_0x1d8a45){logger[_0x901f('0x12')](_0x901f('0x13'),_0x5bb35b,_0x901f('0x14'));logger[_0x901f('0x15')](_0x901f('0x16'),_0x5bb35b,'request\x20sent',JSON[_0x901f('0x17')](_0x1d8a45));if(_0x1d8a45[_0x901f('0x18')]){if(_0x1d8a45[_0x901f('0x18')][_0x901f('0x19')]===0x1f4){logger[_0x901f('0x18')](_0x901f('0x13'),_0x5bb35b,_0x1d8a45[_0x901f('0x18')][_0x901f('0x1a')]);return _0x1fe139(_0x1d8a45['error'][_0x901f('0x1a')]);}logger[_0x901f('0x18')](_0x901f('0x13'),_0x5bb35b,_0x1d8a45[_0x901f('0x18')][_0x901f('0x1a')]);return _0x2ee563(_0x1d8a45['error'][_0x901f('0x1a')]);}else{logger[_0x901f('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x5bb35b,'request\x20sent');_0x2ee563(_0x1d8a45['result']['message']);}})['catch'](function(_0x467afc){logger[_0x901f('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x5bb35b,_0x467afc);_0x1fe139(_0x467afc);});});}exports[_0x901f('0x1b')]=function(_0xdcb28f){var _0x28c518=this;return new Promise(function(_0x28b1fe,_0x35d9c2){return db['OpenchannelQueue'][_0x901f('0x1c')]({'raw':_0xdcb28f[_0x901f('0x1d')]?_0xdcb28f[_0x901f('0x1d')][_0x901f('0x1e')]===undefined?!![]:![]:!![],'where':_0xdcb28f[_0x901f('0x1d')]?_0xdcb28f['options']['where']||null:null,'attributes':_0xdcb28f[_0x901f('0x1d')]?_0xdcb28f['options']['attributes']||null:null,'limit':_0xdcb28f[_0x901f('0x1d')]?_0xdcb28f['options'][_0x901f('0x1f')]||null:null,'include':_0xdcb28f[_0x901f('0x1d')]?_0xdcb28f[_0x901f('0x1d')][_0x901f('0x20')]?_[_0x901f('0x21')](_0xdcb28f[_0x901f('0x1d')][_0x901f('0x20')],function(_0x144bca){return{'model':db[_0x144bca['model']],'as':_0x144bca['as'],'attributes':_0x144bca[_0x901f('0x22')],'include':_0x144bca[_0x901f('0x20')]?_[_0x901f('0x21')](_0x144bca[_0x901f('0x20')],function(_0x5b450f){return{'model':db[_0x5b450f[_0x901f('0x23')]],'as':_0x5b450f['as'],'attributes':_0x5b450f[_0x901f('0x22')],'include':_0x5b450f[_0x901f('0x20')]?_[_0x901f('0x21')](_0x5b450f[_0x901f('0x20')],function(_0x1fd179){return{'model':db[_0x1fd179['model']],'as':_0x1fd179['as'],'attributes':_0x1fd179['attributes']};}):[]};}):[]};}):[]:[]})[_0x901f('0x24')](function(_0x4b623e){logger['info'](_0x901f('0x1b'),_0xdcb28f);logger['debug'](_0x901f('0x1b'),_0xdcb28f,JSON[_0x901f('0x17')](_0x4b623e));_0x28b1fe(_0x4b623e);})[_0x901f('0x25')](function(_0x352919){logger[_0x901f('0x18')](_0x901f('0x1b'),_0x352919[_0x901f('0x1a')],_0xdcb28f);_0x35d9c2(_0x28c518[_0x901f('0x18')](0x1f4,_0x352919['message']));});});};exports[_0x901f('0x26')]=function(_0x1b34ab){var _0x154cf0=this;return new Promise(function(_0x5b84fe,_0x28e21a){return db[_0x901f('0x27')][_0x901f('0x28')]({'raw':_0x1b34ab[_0x901f('0x1d')]?_0x1b34ab['options'][_0x901f('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b34ab[_0x901f('0x1d')]?_0x1b34ab[_0x901f('0x1d')][_0x901f('0x29')]||null:null,'attributes':_0x1b34ab[_0x901f('0x1d')]?_0x1b34ab['options'][_0x901f('0x22')]||null:null,'include':_0x1b34ab[_0x901f('0x1d')]?_0x1b34ab[_0x901f('0x1d')][_0x901f('0x20')]?_[_0x901f('0x21')](_0x1b34ab[_0x901f('0x1d')][_0x901f('0x20')],function(_0x5bacc2){return{'model':db[_0x5bacc2['model']],'as':_0x5bacc2['as'],'attributes':_0x5bacc2[_0x901f('0x22')],'include':_0x5bacc2[_0x901f('0x20')]?_['map'](_0x5bacc2['include'],function(_0x3df417){return{'model':db[_0x3df417[_0x901f('0x23')]],'as':_0x3df417['as'],'attributes':_0x3df417['attributes'],'include':_0x3df417[_0x901f('0x20')]?_['map'](_0x3df417[_0x901f('0x20')],function(_0x202aa7){return{'model':db[_0x202aa7[_0x901f('0x23')]],'as':_0x202aa7['as'],'attributes':_0x202aa7[_0x901f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x901f('0x24')](function(_0x194bce){logger['info'](_0x901f('0x26'),_0x1b34ab);logger[_0x901f('0x15')]('ShowOpenchannelQueue',_0x1b34ab,JSON['stringify'](_0x194bce));_0x5b84fe(_0x194bce);})[_0x901f('0x25')](function(_0x4d2084){logger[_0x901f('0x18')](_0x901f('0x26'),_0x4d2084['message'],_0x1b34ab);_0x28e21a(_0x154cf0[_0x901f('0x18')](0x1f4,_0x4d2084[_0x901f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0dccbfb..6cbeb86 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 _0xe303=['length','openchannelQueue:','./openchannelQueue.events','save','remove','update','register'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0xe303,0x1d7));var _0x3e30=function(_0x9fa734,_0x1b128e){_0x9fa734=_0x9fa734-0x0;var _0x14c91b=_0xe303[_0x9fa734];return _0x14c91b;};'use strict';var OpenchannelQueueEvents=require(_0x3e30('0x0'));var events=[_0x3e30('0x1'),_0x3e30('0x2'),_0x3e30('0x3')];function createListener(_0x2ce3f0,_0x48f825){return function(_0x19053d){_0x48f825['emit'](_0x2ce3f0,_0x19053d);};}function removeListener(_0x32fe27,_0x24b58f){return function(){OpenchannelQueueEvents['removeListener'](_0x32fe27,_0x24b58f);};}exports[_0x3e30('0x4')]=function(_0x21e627){for(var _0x3e3394=0x0,_0x3a8285=events[_0x3e30('0x5')];_0x3e3394<_0x3a8285;_0x3e3394++){var _0x9683bd=events[_0x3e3394];var _0x4739fa=createListener(_0x3e30('0x6')+_0x9683bd,_0x21e627);OpenchannelQueueEvents['on'](_0x9683bd,_0x4739fa);}}; \ No newline at end of file +var _0x7a0b=['register','./openchannelQueue.events','save','remove','removeListener'];(function(_0xe87d93,_0x40b24b){var _0x3415b7=function(_0x2c7e22){while(--_0x2c7e22){_0xe87d93['push'](_0xe87d93['shift']());}};_0x3415b7(++_0x40b24b);}(_0x7a0b,0x173));var _0xb7a0=function(_0xb761d,_0x16a9e9){_0xb761d=_0xb761d-0x0;var _0x56833c=_0x7a0b[_0xb761d];return _0x56833c;};'use strict';var OpenchannelQueueEvents=require(_0xb7a0('0x0'));var events=[_0xb7a0('0x1'),_0xb7a0('0x2'),'update'];function createListener(_0x32a78b,_0x1dc583){return function(_0x3df096){_0x1dc583['emit'](_0x32a78b,_0x3df096);};}function removeListener(_0x57ff3c,_0x46271b){return function(){OpenchannelQueueEvents[_0xb7a0('0x3')](_0x57ff3c,_0x46271b);};}exports[_0xb7a0('0x4')]=function(_0x2e7162){for(var _0x16a809=0x0,_0x2d1337=events['length'];_0x16a809<_0x2d1337;_0x16a809++){var _0x3b761c=events[_0x16a809];var _0x45ac41=createListener('openchannelQueue:'+_0x3b761c,_0x2e7162);OpenchannelQueueEvents['on'](_0x3b761c,_0x45ac41);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 95fc6b8..e147256 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 _0xc653=['get','isAuthenticated','index','/describe','describe','/:id','post','create','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelQueueReport.controller'];(function(_0x2e30d8,_0x344b2c){var _0x347234=function(_0x5916cf){while(--_0x5916cf){_0x2e30d8['push'](_0x2e30d8['shift']());}};_0x347234(++_0x344b2c);}(_0xc653,0x13c));var _0x3c65=function(_0x585fe7,_0xad274d){_0x585fe7=_0x585fe7-0x0;var _0x49847f=_0xc653[_0x585fe7];return _0x49847f;};'use strict';var multer=require(_0x3c65('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3c65('0x1'));var express=require(_0x3c65('0x2'));var router=express[_0x3c65('0x3')]();var fs_extra=require(_0x3c65('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3c65('0x5'));var config=require('../../config/environment');var controller=require(_0x3c65('0x6'));router[_0x3c65('0x7')]('/',auth[_0x3c65('0x8')](),controller[_0x3c65('0x9')]);router[_0x3c65('0x7')](_0x3c65('0xa'),auth[_0x3c65('0x8')](),controller[_0x3c65('0xb')]);router[_0x3c65('0x7')](_0x3c65('0xc'),auth[_0x3c65('0x8')](),controller['show']);router[_0x3c65('0xd')]('/',auth['isAuthenticated'](),controller[_0x3c65('0xe')]);router['put'](_0x3c65('0xc'),auth[_0x3c65('0x8')](),controller['update']);router['delete'](_0x3c65('0xc'),auth[_0x3c65('0x8')](),controller[_0x3c65('0xf')]);module[_0x3c65('0x10')]=router; \ No newline at end of file +var _0xbee6=['./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2703c6,_0x1cafa1){var _0x4df84c=function(_0x3b7307){while(--_0x3b7307){_0x2703c6['push'](_0x2703c6['shift']());}};_0x4df84c(++_0x1cafa1);}(_0xbee6,0x1cd));var _0x6bee=function(_0x583440,_0x120ba3){_0x583440=_0x583440-0x0;var _0x2bee7e=_0xbee6[_0x583440];return _0x2bee7e;};'use strict';var multer=require(_0x6bee('0x0'));var util=require(_0x6bee('0x1'));var path=require('path');var timeout=require(_0x6bee('0x2'));var express=require('express');var router=express[_0x6bee('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6bee('0x4'));var interaction=require(_0x6bee('0x5'));var config=require(_0x6bee('0x6'));var controller=require(_0x6bee('0x7'));router[_0x6bee('0x8')]('/',auth[_0x6bee('0x9')](),controller[_0x6bee('0xa')]);router[_0x6bee('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6bee('0xb')]);router[_0x6bee('0x8')](_0x6bee('0xc'),auth[_0x6bee('0x9')](),controller[_0x6bee('0xd')]);router[_0x6bee('0xe')]('/',auth['isAuthenticated'](),controller[_0x6bee('0xf')]);router['put'](_0x6bee('0xc'),auth[_0x6bee('0x9')](),controller[_0x6bee('0x10')]);router[_0x6bee('0x11')](_0x6bee('0xc'),auth[_0x6bee('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1ce0273..87cb4c3 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 _0x74cb=['sequelize','STRING','DATE'];(function(_0x381bff,_0x19d01f){var _0x201ab1=function(_0x7d6446){while(--_0x7d6446){_0x381bff['push'](_0x381bff['shift']());}};_0x201ab1(++_0x19d01f);}(_0x74cb,0xf6));var _0xb74c=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x74cb[_0x2b10c6];return _0x3789d2;};'use strict';var moment=require('moment');var Sequelize=require(_0xb74c('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb74c('0x1')]},'joinAt':{'type':Sequelize[_0xb74c('0x2')]},'leaveAt':{'type':Sequelize[_0xb74c('0x2')]},'acceptAt':{'type':Sequelize[_0xb74c('0x2')]},'exitAt':{'type':Sequelize[_0xb74c('0x2')]},'reason':{'type':Sequelize[_0xb74c('0x1')]}}; \ No newline at end of file +var _0x611e=['STRING','DATE','sequelize','exports'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x611e,0x10e));var _0xe611=function(_0x3f997f,_0x59fa39){_0x3f997f=_0x3f997f-0x0;var _0x536ca5=_0x611e[_0x3f997f];return _0x536ca5;};'use strict';var moment=require('moment');var Sequelize=require(_0xe611('0x0'));module[_0xe611('0x1')]={'uniqueid':{'type':Sequelize[_0xe611('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe611('0x2')]},'joinAt':{'type':Sequelize[_0xe611('0x3')]},'leaveAt':{'type':Sequelize[_0xe611('0x3')]},'acceptAt':{'type':Sequelize[_0xe611('0x3')]},'exitAt':{'type':Sequelize[_0xe611('0x3')]},'reason':{'type':Sequelize[_0xe611('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index bff007d..03e1ec0 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 _0x8b9c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','save','then','destroy','end','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','include','findAll','rows','show','params','keys','includeAll','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x8b9c,0x110));var _0xc8b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b9c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc8b9('0x0'));var rimraf=require(_0xc8b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8b9('0x2'));var rp=require(_0xc8b9('0x3'));var moment=require('moment');var BPromise=require(_0xc8b9('0x4'));var Mustache=require('mustache');var util=require(_0xc8b9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xc8b9('0x6'));var ejs=require(_0xc8b9('0x7'));var fs=require('fs');var fs_extra=require(_0xc8b9('0x8'));var _=require('lodash');var squel=require(_0xc8b9('0x9'));var crypto=require(_0xc8b9('0xa'));var jsforce=require(_0xc8b9('0xb'));var deskjs=require(_0xc8b9('0xc'));var toCsv=require(_0xc8b9('0x6'));var querystring=require('querystring');var Papa=require(_0xc8b9('0xd'));var Redis=require(_0xc8b9('0xe'));var authService=require(_0xc8b9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc8b9('0x10'));var hardwareService=require(_0xc8b9('0x11'));var logger=require(_0xc8b9('0x12'))(_0xc8b9('0x13'));var utils=require(_0xc8b9('0x14'));var config=require(_0xc8b9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8b9('0x16'))['db'];function respondWithStatusCode(_0x3541bf,_0x497c5b){_0x497c5b=_0x497c5b||0xcc;return function(_0x149563){if(_0x149563){return _0x3541bf[_0xc8b9('0x17')](_0x497c5b);}return _0x3541bf[_0xc8b9('0x18')](_0x497c5b)['end']();};}function respondWithResult(_0x501cac,_0x379dd1){_0x379dd1=_0x379dd1||0xc8;return function(_0x1e8b23){if(_0x1e8b23){return _0x501cac[_0xc8b9('0x18')](_0x379dd1)[_0xc8b9('0x19')](_0x1e8b23);}};}function respondWithFilteredResult(_0x1d57fe,_0x3f6d8f){return function(_0x1bab46){if(_0x1bab46){var _0x3beaa9=typeof _0x3f6d8f['offset']===_0xc8b9('0x1a')&&typeof _0x3f6d8f[_0xc8b9('0x1b')]===_0xc8b9('0x1a');var _0x2b6b5b=_0x1bab46[_0xc8b9('0x1c')];var _0x1f25fc=_0x3beaa9?0x0:_0x3f6d8f['offset'];var _0x2af3ec=_0x3beaa9?_0x1bab46['count']:_0x3f6d8f[_0xc8b9('0x1d')]+_0x3f6d8f['limit'];var _0x34b630;if(_0x2af3ec>=_0x2b6b5b){_0x2af3ec=_0x2b6b5b;_0x34b630=0xc8;}else{_0x34b630=0xce;}_0x1d57fe[_0xc8b9('0x18')](_0x34b630);return _0x1d57fe[_0xc8b9('0x1e')]('Content-Range',_0x1f25fc+'-'+_0x2af3ec+'/'+_0x2b6b5b)[_0xc8b9('0x19')](_0x1bab46);}return null;};}function patchUpdates(_0x4311cc){return function(_0x30ea57){try{jsonpatch['apply'](_0x30ea57,_0x4311cc,!![]);}catch(_0x57dce2){return BPromise['reject'](_0x57dce2);}return _0x30ea57[_0xc8b9('0x1f')]();};}function saveUpdates(_0xf8bdca,_0x515fd0){return function(_0x234999){if(_0x234999){return _0x234999['update'](_0xf8bdca)[_0xc8b9('0x20')](function(_0x3aefd7){return _0x3aefd7;});}return null;};}function removeEntity(_0x206e6e,_0x30bf75){return function(_0x5474d7){if(_0x5474d7){return _0x5474d7[_0xc8b9('0x21')]()[_0xc8b9('0x20')](function(){_0x206e6e[_0xc8b9('0x18')](0xcc)[_0xc8b9('0x22')]();});}};}function handleEntityNotFound(_0x315e2d,_0x1d07c6){return function(_0x3885d0){if(!_0x3885d0){_0x315e2d['sendStatus'](0x194);}return _0x3885d0;};}function handleError(_0x209191,_0x4e2239){_0x4e2239=_0x4e2239||0x1f4;return function(_0x5991a7){logger[_0xc8b9('0x23')](_0x5991a7[_0xc8b9('0x24')]);if(_0x5991a7['name']){delete _0x5991a7[_0xc8b9('0x25')];}_0x209191[_0xc8b9('0x18')](_0x4e2239)['send'](_0x5991a7);};}exports[_0xc8b9('0x26')]=function(_0x3ef8ee,_0x111b80){var _0x54f578={},_0x134c02={},_0x441ab7={'count':0x0,'rows':[]};var _0x3fcc02=_[_0xc8b9('0x27')](db[_0xc8b9('0x28')][_0xc8b9('0x29')],function(_0x7ad931){return{'name':_0x7ad931[_0xc8b9('0x2a')],'type':_0x7ad931[_0xc8b9('0x2b')][_0xc8b9('0x2c')]};});_0x134c02[_0xc8b9('0x2d')]=_['map'](_0x3fcc02,_0xc8b9('0x25'));_0x134c02[_0xc8b9('0x2e')]=_['keys'](_0x3ef8ee['query']);_0x134c02[_0xc8b9('0x2f')]=_[_0xc8b9('0x30')](_0x134c02[_0xc8b9('0x2d')],_0x134c02[_0xc8b9('0x2e')]);_0x54f578['attributes']=_[_0xc8b9('0x30')](_0x134c02[_0xc8b9('0x2d')],qs[_0xc8b9('0x31')](_0x3ef8ee[_0xc8b9('0x2e')][_0xc8b9('0x31')]));_0x54f578[_0xc8b9('0x32')]=_0x54f578[_0xc8b9('0x32')][_0xc8b9('0x33')]?_0x54f578[_0xc8b9('0x32')]:_0x134c02['model'];if(!_0x3ef8ee[_0xc8b9('0x2e')][_0xc8b9('0x34')](_0xc8b9('0x35'))){_0x54f578[_0xc8b9('0x1b')]=qs[_0xc8b9('0x1b')](_0x3ef8ee[_0xc8b9('0x2e')][_0xc8b9('0x1b')]);_0x54f578[_0xc8b9('0x1d')]=qs[_0xc8b9('0x1d')](_0x3ef8ee['query'][_0xc8b9('0x1d')]);}_0x54f578['order']=qs[_0xc8b9('0x36')](_0x3ef8ee[_0xc8b9('0x2e')][_0xc8b9('0x36')]);_0x54f578['where']=qs[_0xc8b9('0x2f')](_[_0xc8b9('0x37')](_0x3ef8ee['query'],_0x134c02[_0xc8b9('0x2f')]),_0x3fcc02);if(_0x3ef8ee[_0xc8b9('0x2e')][_0xc8b9('0x38')]){_0x54f578[_0xc8b9('0x39')]=_[_0xc8b9('0x3a')](_0x54f578[_0xc8b9('0x39')],{'$or':_[_0xc8b9('0x27')](_0x3fcc02,function(_0x372007){if(_0x372007[_0xc8b9('0x2b')]!=='VIRTUAL'){var _0x583383={};_0x583383[_0x372007[_0xc8b9('0x25')]]={'$like':'%'+_0x3ef8ee['query'][_0xc8b9('0x38')]+'%'};return _0x583383;}})});}_0x54f578=_[_0xc8b9('0x3a')]({},_0x54f578,_0x3ef8ee['options']);var _0x442766={'where':_0x54f578['where']};return db[_0xc8b9('0x28')][_0xc8b9('0x1c')](_0x442766)[_0xc8b9('0x20')](function(_0x2d51c6){_0x441ab7[_0xc8b9('0x1c')]=_0x2d51c6;if(_0x3ef8ee[_0xc8b9('0x2e')]['includeAll']){_0x54f578[_0xc8b9('0x3b')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xc8b9('0x3c')](_0x54f578);})[_0xc8b9('0x20')](function(_0x40722f){_0x441ab7[_0xc8b9('0x3d')]=_0x40722f;return _0x441ab7;})[_0xc8b9('0x20')](respondWithFilteredResult(_0x111b80,_0x54f578))['catch'](handleError(_0x111b80,null));};exports[_0xc8b9('0x3e')]=function(_0x142269,_0x1e4687){var _0x41723f={'raw':!![],'where':{'id':_0x142269[_0xc8b9('0x3f')]['id']}},_0x43bb90={};_0x43bb90[_0xc8b9('0x2d')]=_['keys'](db[_0xc8b9('0x28')][_0xc8b9('0x29')]);_0x43bb90[_0xc8b9('0x2e')]=_[_0xc8b9('0x40')](_0x142269[_0xc8b9('0x2e')]);_0x43bb90['filters']=_['intersection'](_0x43bb90['model'],_0x43bb90[_0xc8b9('0x2e')]);_0x41723f[_0xc8b9('0x32')]=_[_0xc8b9('0x30')](_0x43bb90[_0xc8b9('0x2d')],qs['fields'](_0x142269[_0xc8b9('0x2e')][_0xc8b9('0x31')]));_0x41723f['attributes']=_0x41723f[_0xc8b9('0x32')][_0xc8b9('0x33')]?_0x41723f[_0xc8b9('0x32')]:_0x43bb90['model'];if(_0x142269['query'][_0xc8b9('0x41')]){_0x41723f[_0xc8b9('0x3b')]=[{'all':!![]}];}_0x41723f=_[_0xc8b9('0x3a')]({},_0x41723f,_0x142269[_0xc8b9('0x42')]);return db[_0xc8b9('0x28')][_0xc8b9('0x43')](_0x41723f)[_0xc8b9('0x20')](handleEntityNotFound(_0x1e4687,null))[_0xc8b9('0x20')](respondWithResult(_0x1e4687,null))[_0xc8b9('0x44')](handleError(_0x1e4687,null));};exports[_0xc8b9('0x45')]=function(_0x45b90e,_0x91f033){return db[_0xc8b9('0x28')][_0xc8b9('0x45')](_0x45b90e['body'],{})['then'](respondWithResult(_0x91f033,0xc9))[_0xc8b9('0x44')](handleError(_0x91f033,null));};exports['update']=function(_0x32b62f,_0x55c71b){if(_0x32b62f[_0xc8b9('0x46')]['id']){delete _0x32b62f[_0xc8b9('0x46')]['id'];}return db[_0xc8b9('0x28')][_0xc8b9('0x43')]({'where':{'id':_0x32b62f[_0xc8b9('0x3f')]['id']}})[_0xc8b9('0x20')](handleEntityNotFound(_0x55c71b,null))[_0xc8b9('0x20')](saveUpdates(_0x32b62f[_0xc8b9('0x46')],null))[_0xc8b9('0x20')](respondWithResult(_0x55c71b,null))[_0xc8b9('0x44')](handleError(_0x55c71b,null));};exports[_0xc8b9('0x21')]=function(_0x1a1763,_0x59fbab){return db[_0xc8b9('0x28')][_0xc8b9('0x43')]({'where':{'id':_0x1a1763[_0xc8b9('0x3f')]['id']}})[_0xc8b9('0x20')](handleEntityNotFound(_0x59fbab,null))[_0xc8b9('0x20')](removeEntity(_0x59fbab,null))['catch'](handleError(_0x59fbab,null));};exports[_0xc8b9('0x47')]=function(_0x4faaad,_0x4f4872){return db[_0xc8b9('0x28')][_0xc8b9('0x47')]()['then'](respondWithResult(_0x4f4872,null))[_0xc8b9('0x44')](handleError(_0x4f4872,null));}; \ No newline at end of file +var _0x3837=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','rawAttributes','length','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x3ce1a9,_0x4ff858){var _0x1364b9=function(_0x1e7cc9){while(--_0x1e7cc9){_0x3ce1a9['push'](_0x3ce1a9['shift']());}};_0x1364b9(++_0x4ff858);}(_0x3837,0x1e9));var _0x7383=function(_0x1eaf19,_0x21368c){_0x1eaf19=_0x1eaf19-0x0;var _0x24559d=_0x3837[_0x1eaf19];return _0x24559d;};'use strict';var emlformat=require(_0x7383('0x0'));var rimraf=require(_0x7383('0x1'));var zipdir=require(_0x7383('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7383('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7383('0x4'));var util=require('util');var path=require(_0x7383('0x5'));var sox=require(_0x7383('0x6'));var csv=require(_0x7383('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7383('0x8'));var _=require(_0x7383('0x9'));var squel=require(_0x7383('0xa'));var crypto=require('crypto');var jsforce=require(_0x7383('0xb'));var deskjs=require(_0x7383('0xc'));var toCsv=require(_0x7383('0x7'));var querystring=require('querystring');var Papa=require(_0x7383('0xd'));var Redis=require(_0x7383('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7383('0xf'));var as=require(_0x7383('0x10'));var hardwareService=require(_0x7383('0x11'));var logger=require(_0x7383('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7383('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7383('0x14'))['db'];function respondWithStatusCode(_0x5c2779,_0x1a6b84){_0x1a6b84=_0x1a6b84||0xcc;return function(_0x44d6c4){if(_0x44d6c4){return _0x5c2779[_0x7383('0x15')](_0x1a6b84);}return _0x5c2779['status'](_0x1a6b84)[_0x7383('0x16')]();};}function respondWithResult(_0x44ac1d,_0x167b7c){_0x167b7c=_0x167b7c||0xc8;return function(_0xa78fc3){if(_0xa78fc3){return _0x44ac1d[_0x7383('0x17')](_0x167b7c)[_0x7383('0x18')](_0xa78fc3);}};}function respondWithFilteredResult(_0x4166cc,_0x5cb3c6){return function(_0x152438){if(_0x152438){var _0x4e3832=typeof _0x5cb3c6[_0x7383('0x19')]===_0x7383('0x1a')&&typeof _0x5cb3c6[_0x7383('0x1b')]===_0x7383('0x1a');var _0x3227b7=_0x152438['count'];var _0x5352b4=_0x4e3832?0x0:_0x5cb3c6[_0x7383('0x19')];var _0x1c50f5=_0x4e3832?_0x152438[_0x7383('0x1c')]:_0x5cb3c6[_0x7383('0x19')]+_0x5cb3c6[_0x7383('0x1b')];var _0x51c40d;if(_0x1c50f5>=_0x3227b7){_0x1c50f5=_0x3227b7;_0x51c40d=0xc8;}else{_0x51c40d=0xce;}_0x4166cc['status'](_0x51c40d);return _0x4166cc['set']('Content-Range',_0x5352b4+'-'+_0x1c50f5+'/'+_0x3227b7)['json'](_0x152438);}return null;};}function patchUpdates(_0x43b184){return function(_0x1b95b7){try{jsonpatch[_0x7383('0x1d')](_0x1b95b7,_0x43b184,!![]);}catch(_0x3ce3bd){return BPromise[_0x7383('0x1e')](_0x3ce3bd);}return _0x1b95b7['save']();};}function saveUpdates(_0x30518f,_0xe8a76a){return function(_0x2581c8){if(_0x2581c8){return _0x2581c8[_0x7383('0x1f')](_0x30518f)[_0x7383('0x20')](function(_0x2b83ce){return _0x2b83ce;});}return null;};}function removeEntity(_0x54dbbb,_0x589d3f){return function(_0x4ca5c7){if(_0x4ca5c7){return _0x4ca5c7[_0x7383('0x21')]()['then'](function(){_0x54dbbb[_0x7383('0x17')](0xcc)[_0x7383('0x16')]();});}};}function handleEntityNotFound(_0x248331,_0x529b8b){return function(_0x3a9e06){if(!_0x3a9e06){_0x248331['sendStatus'](0x194);}return _0x3a9e06;};}function handleError(_0x438b2e,_0x521f2d){_0x521f2d=_0x521f2d||0x1f4;return function(_0x38c0a5){logger[_0x7383('0x22')](_0x38c0a5[_0x7383('0x23')]);if(_0x38c0a5[_0x7383('0x24')]){delete _0x38c0a5[_0x7383('0x24')];}_0x438b2e[_0x7383('0x17')](_0x521f2d)[_0x7383('0x25')](_0x38c0a5);};}exports[_0x7383('0x26')]=function(_0xc84387,_0x1e501b){var _0x3584cc={},_0x54ca4e={},_0x39b95a={'count':0x0,'rows':[]};var _0x3b510e=_[_0x7383('0x27')](db[_0x7383('0x28')]['rawAttributes'],function(_0x29eb92){return{'name':_0x29eb92[_0x7383('0x29')],'type':_0x29eb92[_0x7383('0x2a')][_0x7383('0x2b')]};});_0x54ca4e[_0x7383('0x2c')]=_[_0x7383('0x27')](_0x3b510e,_0x7383('0x24'));_0x54ca4e[_0x7383('0x2d')]=_[_0x7383('0x2e')](_0xc84387['query']);_0x54ca4e[_0x7383('0x2f')]=_[_0x7383('0x30')](_0x54ca4e[_0x7383('0x2c')],_0x54ca4e[_0x7383('0x2d')]);_0x3584cc[_0x7383('0x31')]=_[_0x7383('0x30')](_0x54ca4e['model'],qs['fields'](_0xc84387['query'][_0x7383('0x32')]));_0x3584cc[_0x7383('0x31')]=_0x3584cc['attributes']['length']?_0x3584cc[_0x7383('0x31')]:_0x54ca4e['model'];if(!_0xc84387[_0x7383('0x2d')][_0x7383('0x33')]('nolimit')){_0x3584cc[_0x7383('0x1b')]=qs[_0x7383('0x1b')](_0xc84387[_0x7383('0x2d')]['limit']);_0x3584cc['offset']=qs[_0x7383('0x19')](_0xc84387[_0x7383('0x2d')][_0x7383('0x19')]);}_0x3584cc[_0x7383('0x34')]=qs[_0x7383('0x35')](_0xc84387[_0x7383('0x2d')][_0x7383('0x35')]);_0x3584cc[_0x7383('0x36')]=qs[_0x7383('0x2f')](_[_0x7383('0x37')](_0xc84387[_0x7383('0x2d')],_0x54ca4e[_0x7383('0x2f')]),_0x3b510e);if(_0xc84387['query']['filter']){_0x3584cc['where']=_[_0x7383('0x38')](_0x3584cc[_0x7383('0x36')],{'$or':_['map'](_0x3b510e,function(_0x2b7162){if(_0x2b7162[_0x7383('0x2a')]!==_0x7383('0x39')){var _0x42b2cc={};_0x42b2cc[_0x2b7162[_0x7383('0x24')]]={'$like':'%'+_0xc84387['query'][_0x7383('0x3a')]+'%'};return _0x42b2cc;}})});}_0x3584cc=_[_0x7383('0x38')]({},_0x3584cc,_0xc84387['options']);var _0x4b2974={'where':_0x3584cc[_0x7383('0x36')]};return db[_0x7383('0x28')][_0x7383('0x1c')](_0x4b2974)[_0x7383('0x20')](function(_0x3f58f1){_0x39b95a[_0x7383('0x1c')]=_0x3f58f1;if(_0xc84387[_0x7383('0x2d')][_0x7383('0x3b')]){_0x3584cc[_0x7383('0x3c')]=[{'all':!![]}];}return db[_0x7383('0x28')][_0x7383('0x3d')](_0x3584cc);})[_0x7383('0x20')](function(_0x2f0339){_0x39b95a[_0x7383('0x3e')]=_0x2f0339;return _0x39b95a;})[_0x7383('0x20')](respondWithFilteredResult(_0x1e501b,_0x3584cc))['catch'](handleError(_0x1e501b,null));};exports['show']=function(_0x6dea3e,_0x10c031){var _0x9245b8={'raw':!![],'where':{'id':_0x6dea3e[_0x7383('0x3f')]['id']}},_0x1e02dc={};_0x1e02dc[_0x7383('0x2c')]=_[_0x7383('0x2e')](db['OpenchannelQueueReport'][_0x7383('0x40')]);_0x1e02dc[_0x7383('0x2d')]=_['keys'](_0x6dea3e[_0x7383('0x2d')]);_0x1e02dc[_0x7383('0x2f')]=_[_0x7383('0x30')](_0x1e02dc[_0x7383('0x2c')],_0x1e02dc['query']);_0x9245b8[_0x7383('0x31')]=_[_0x7383('0x30')](_0x1e02dc[_0x7383('0x2c')],qs[_0x7383('0x32')](_0x6dea3e[_0x7383('0x2d')][_0x7383('0x32')]));_0x9245b8['attributes']=_0x9245b8[_0x7383('0x31')][_0x7383('0x41')]?_0x9245b8['attributes']:_0x1e02dc[_0x7383('0x2c')];if(_0x6dea3e[_0x7383('0x2d')][_0x7383('0x3b')]){_0x9245b8['include']=[{'all':!![]}];}_0x9245b8=_['merge']({},_0x9245b8,_0x6dea3e[_0x7383('0x42')]);return db[_0x7383('0x28')][_0x7383('0x43')](_0x9245b8)[_0x7383('0x20')](handleEntityNotFound(_0x10c031,null))[_0x7383('0x20')](respondWithResult(_0x10c031,null))[_0x7383('0x44')](handleError(_0x10c031,null));};exports['create']=function(_0x3647bb,_0x569172){return db[_0x7383('0x28')][_0x7383('0x45')](_0x3647bb[_0x7383('0x46')],{})[_0x7383('0x20')](respondWithResult(_0x569172,0xc9))[_0x7383('0x44')](handleError(_0x569172,null));};exports[_0x7383('0x1f')]=function(_0x4f3b90,_0x149377){if(_0x4f3b90[_0x7383('0x46')]['id']){delete _0x4f3b90[_0x7383('0x46')]['id'];}return db['OpenchannelQueueReport'][_0x7383('0x43')]({'where':{'id':_0x4f3b90[_0x7383('0x3f')]['id']}})[_0x7383('0x20')](handleEntityNotFound(_0x149377,null))[_0x7383('0x20')](saveUpdates(_0x4f3b90[_0x7383('0x46')],null))[_0x7383('0x20')](respondWithResult(_0x149377,null))[_0x7383('0x44')](handleError(_0x149377,null));};exports[_0x7383('0x21')]=function(_0x358faa,_0x125f2f){return db['OpenchannelQueueReport'][_0x7383('0x43')]({'where':{'id':_0x358faa['params']['id']}})[_0x7383('0x20')](handleEntityNotFound(_0x125f2f,null))['then'](removeEntity(_0x125f2f,null))[_0x7383('0x44')](handleError(_0x125f2f,null));};exports[_0x7383('0x47')]=function(_0x56ef42,_0xb1c1f){return db[_0x7383('0x28')][_0x7383('0x47')]()['then'](respondWithResult(_0xb1c1f,null))[_0x7383('0x44')](handleError(_0xb1c1f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4c42a11..7c8254a 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x749614,_0x9c4b56){var _0x4cacdf=function(_0x2b6bcc){while(--_0x2b6bcc){_0x749614['push'](_0x749614['shift']());}};_0x4cacdf(++_0x9c4b56);}(_0x2ef3,0xba));var _0x32ef=function(_0x2355c6,_0x5af951){_0x2355c6=_0x2355c6-0x0;var _0x161236=_0x2ef3[_0x2355c6];return _0x161236;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x46717d,_0x71b508){var _0x35f49e=function(_0x3d1b39){while(--_0x3d1b39){_0x46717d['push'](_0x46717d['shift']());}};_0x35f49e(++_0x71b508);}(_0xe14b,0x93));var _0xbe14=function(_0x97ec0e,_0x10eb67){_0x97ec0e=_0x97ec0e-0x0;var _0x1fd9dd=_0xe14b[_0x97ec0e];return _0x1fd9dd;};'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':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 3d247c3..e8e56f4 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 _0xd523=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xd523,0x153));var _0x3d52=function(_0x1e6763,_0x557792){_0x1e6763=_0x1e6763-0x0;var _0x43ec0d=_0xd523[_0x1e6763];return _0x43ec0d;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcc92,_0x189147,_0x2f3ebc){return new BPromise(function(_0x232bd4,_0x2e03c0){return client[_0x3d52('0xb')](_0x4fcc92,_0x2f3ebc)[_0x3d52('0xc')](function(_0x34c184){logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,'request\x20sent');logger[_0x3d52('0xf')](_0x3d52('0x10'),_0x189147,_0x3d52('0x11'),JSON[_0x3d52('0x12')](_0x34c184));if(_0x34c184[_0x3d52('0x13')]){if(_0x34c184['error'][_0x3d52('0x14')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x2e03c0(_0x34c184['error']['message']);}logger['error'](_0x3d52('0xe'),_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x232bd4(_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);}else{logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,_0x3d52('0x11'));_0x232bd4(_0x34c184[_0x3d52('0x16')][_0x3d52('0x15')]);}})[_0x3d52('0x17')](function(_0x15cc02){logger[_0x3d52('0x13')](_0x3d52('0xe'),_0x189147,_0x15cc02);_0x2e03c0(_0x15cc02);});});}exports[_0x3d52('0x18')]=function(_0x5bce9a){var _0x163d88=this;return new Promise(function(_0x3b3451,_0x386cdb){return db['OpenchannelQueueReport'][_0x3d52('0x19')](_0x5bce9a[_0x3d52('0x1a')],{'raw':_0x5bce9a[_0x3d52('0x1b')]?_0x5bce9a['options'][_0x3d52('0x1c')]===undefined?!![]:![]:!![]})[_0x3d52('0xc')](function(_0x1163c5){logger[_0x3d52('0xd')](_0x3d52('0x18'),_0x5bce9a);logger[_0x3d52('0xf')](_0x3d52('0x18'),_0x5bce9a,JSON[_0x3d52('0x12')](_0x1163c5));_0x3b3451(_0x1163c5);})['catch'](function(_0x419c05){logger[_0x3d52('0x13')](_0x3d52('0x18'),_0x419c05['message'],_0x5bce9a);_0x386cdb(_0x163d88[_0x3d52('0x13')](0x1f4,_0x419c05[_0x3d52('0x15')]));});});};exports[_0x3d52('0x1d')]=function(_0xc6c76){var _0x3816bc=this;return new Promise(function(_0x349b30,_0xdf73cd){return db[_0x3d52('0x1e')][_0x3d52('0x1f')](_0xc6c76[_0x3d52('0x1a')],{'raw':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76['options'][_0x3d52('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76[_0x3d52('0x1b')][_0x3d52('0x20')]||null:null,'attributes':_0xc6c76['options']?_0xc6c76['options'][_0x3d52('0x21')]||null:null,'limit':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76[_0x3d52('0x1b')]['limit']||null:null})[_0x3d52('0xc')](function(_0x4312a7){logger[_0x3d52('0xd')](_0x3d52('0x1d'),_0xc6c76);logger['debug'](_0x3d52('0x1d'),_0xc6c76,JSON[_0x3d52('0x12')](_0x4312a7));_0x349b30(_0x4312a7);})[_0x3d52('0x17')](function(_0x193bf1){logger['error'](_0x3d52('0x1d'),_0x193bf1['message'],_0xc6c76);_0xdf73cd(_0x3816bc[_0x3d52('0x13')](0x1f4,_0x193bf1[_0x3d52('0x15')]));});});}; \ No newline at end of file +var _0xdc91=['stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x182ddb,_0x165c85){var _0x1184e2=function(_0x192c87){while(--_0x192c87){_0x182ddb['push'](_0x182ddb['shift']());}};_0x1184e2(++_0x165c85);}(_0xdc91,0x8b));var _0x1dc9=function(_0x423a53,_0x218205){_0x423a53=_0x423a53-0x0;var _0x3c554b=_0xdc91[_0x423a53];return _0x3c554b;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dc9('0x2'))['db'];var utils=require(_0x1dc9('0x3'));var logger=require(_0x1dc9('0x4'))(_0x1dc9('0x5'));var config=require(_0x1dc9('0x6'));var jayson=require(_0x1dc9('0x7'));var client=jayson[_0x1dc9('0x8')][_0x1dc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ac058,_0x2c6e6c,_0x25a752){return new BPromise(function(_0x316995,_0x3d1772){return client[_0x1dc9('0xa')](_0x5ac058,_0x25a752)[_0x1dc9('0xb')](function(_0x43c405){logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,_0x1dc9('0xe'));logger['debug'](_0x1dc9('0xf'),_0x2c6e6c,'request\x20sent',JSON[_0x1dc9('0x10')](_0x43c405));if(_0x43c405['error']){if(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x12')]===0x1f4){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error'][_0x1dc9('0x13')]);return _0x3d1772(_0x43c405[_0x1dc9('0x11')]['message']);}logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error']['message']);return _0x316995(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x13')]);}else{logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,'request\x20sent');_0x316995(_0x43c405['result'][_0x1dc9('0x13')]);}})[_0x1dc9('0x14')](function(_0x5cccb9){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x5cccb9);_0x3d1772(_0x5cccb9);});});}exports[_0x1dc9('0x15')]=function(_0x197bcd){var _0x335590=this;return new Promise(function(_0x1e845a,_0x2442d0){return db[_0x1dc9('0x16')][_0x1dc9('0x17')](_0x197bcd[_0x1dc9('0x18')],{'raw':_0x197bcd[_0x1dc9('0x19')]?_0x197bcd[_0x1dc9('0x19')][_0x1dc9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x49bd5b){logger[_0x1dc9('0xc')]('CreateOpenchannelQueueReport',_0x197bcd);logger['debug']('CreateOpenchannelQueueReport',_0x197bcd,JSON[_0x1dc9('0x10')](_0x49bd5b));_0x1e845a(_0x49bd5b);})[_0x1dc9('0x14')](function(_0x277499){logger[_0x1dc9('0x11')](_0x1dc9('0x15'),_0x277499[_0x1dc9('0x13')],_0x197bcd);_0x2442d0(_0x335590[_0x1dc9('0x11')](0x1f4,_0x277499['message']));});});};exports[_0x1dc9('0x1b')]=function(_0x2a4740){var _0x14181d=this;return new Promise(function(_0x4c6e65,_0x39f3f7){return db[_0x1dc9('0x16')][_0x1dc9('0x1c')](_0x2a4740[_0x1dc9('0x18')],{'raw':_0x2a4740[_0x1dc9('0x19')]?_0x2a4740[_0x1dc9('0x19')][_0x1dc9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a4740[_0x1dc9('0x19')]?_0x2a4740[_0x1dc9('0x19')]['where']||null:null,'attributes':_0x2a4740['options']?_0x2a4740[_0x1dc9('0x19')][_0x1dc9('0x1d')]||null:null,'limit':_0x2a4740[_0x1dc9('0x19')]?_0x2a4740[_0x1dc9('0x19')][_0x1dc9('0x1e')]||null:null})[_0x1dc9('0xb')](function(_0x10123d){logger[_0x1dc9('0xc')](_0x1dc9('0x1b'),_0x2a4740);logger['debug'](_0x1dc9('0x1b'),_0x2a4740,JSON[_0x1dc9('0x10')](_0x10123d));_0x4c6e65(_0x10123d);})[_0x1dc9('0x14')](function(_0x2d75bc){logger[_0x1dc9('0x11')](_0x1dc9('0x1b'),_0x2d75bc['message'],_0x2a4740);_0x39f3f7(_0x14181d['error'](0x1f4,_0x2d75bc[_0x1dc9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ed53011..3b51e60 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 _0x464e=['isAuthenticated','/describe','describe','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment'];(function(_0x255834,_0x2e5a0c){var _0x4dbc46=function(_0x3fd831){while(--_0x3fd831){_0x255834['push'](_0x255834['shift']());}};_0x4dbc46(++_0x2e5a0c);}(_0x464e,0x192));var _0xe464=function(_0x2f5f59,_0xb39421){_0x2f5f59=_0x2f5f59-0x0;var _0x28c320=_0x464e[_0x2f5f59];return _0x28c320;};'use strict';var multer=require(_0xe464('0x0'));var util=require(_0xe464('0x1'));var path=require(_0xe464('0x2'));var timeout=require(_0xe464('0x3'));var express=require(_0xe464('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(_0xe464('0x5'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0xe464('0x6')](),controller['index']);router['get'](_0xe464('0x7'),auth[_0xe464('0x6')](),controller[_0xe464('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe464('0x9')]);router[_0xe464('0xa')]('/',auth[_0xe464('0x6')](),controller[_0xe464('0xb')]);router[_0xe464('0xc')]('/:id',auth[_0xe464('0x6')](),controller[_0xe464('0xd')]);router[_0xe464('0xe')]('/:id',auth[_0xe464('0x6')](),controller[_0xe464('0xf')]);module[_0xe464('0x10')]=router; \ No newline at end of file +var _0x9c55=['/:id','show','create','put','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0x9c55,0x1f3));var _0x59c5=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x9c55[_0x588011];return _0x3b3773;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x59c5('0x0'));var timeout=require(_0x59c5('0x1'));var express=require(_0x59c5('0x2'));var router=express[_0x59c5('0x3')]();var fs_extra=require(_0x59c5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x59c5('0x5'));var config=require(_0x59c5('0x6'));var controller=require(_0x59c5('0x7'));router[_0x59c5('0x8')]('/',auth[_0x59c5('0x9')](),controller[_0x59c5('0xa')]);router[_0x59c5('0x8')]('/describe',auth[_0x59c5('0x9')](),controller['describe']);router[_0x59c5('0x8')](_0x59c5('0xb'),auth[_0x59c5('0x9')](),controller[_0x59c5('0xc')]);router['post']('/',auth[_0x59c5('0x9')](),controller[_0x59c5('0xd')]);router[_0x59c5('0xe')](_0x59c5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x59c5('0xf')](_0x59c5('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x59c5('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 2a161ad..2a0ce28 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0x9bde,0xe1));var _0xe9bd=function(_0x46af3b,_0x3b3ac1){_0x46af3b=_0x46af3b-0x0;var _0x4a8794=_0x9bde[_0x46af3b];return _0x4a8794;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x578d84,_0x352aef){var _0x2c0cea=function(_0xd30512){while(--_0xd30512){_0x578d84['push'](_0x578d84['shift']());}};_0x2c0cea(++_0x352aef);}(_0x008c,0x188));var _0xc008=function(_0x223ace,_0x28a4f1){_0x223ace=_0x223ace-0x0;var _0x599ef9=_0x008c[_0x223ace];return _0x599ef9;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 9f213fc..cb5c2e5 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 _0x1722=['where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x190e94,_0x117fc1){var _0x3012a0=function(_0x500c69){while(--_0x500c69){_0x190e94['push'](_0x190e94['shift']());}};_0x3012a0(++_0x117fc1);}(_0x1722,0xad));var _0x2172=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1722[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x2172('0x0'));var rimraf=require(_0x2172('0x1'));var zipdir=require(_0x2172('0x2'));var jsonpatch=require(_0x2172('0x3'));var rp=require(_0x2172('0x4'));var moment=require(_0x2172('0x5'));var BPromise=require(_0x2172('0x6'));var Mustache=require(_0x2172('0x7'));var util=require('util');var path=require(_0x2172('0x8'));var sox=require(_0x2172('0x9'));var csv=require(_0x2172('0xa'));var ejs=require(_0x2172('0xb'));var fs=require('fs');var fs_extra=require(_0x2172('0xc'));var _=require(_0x2172('0xd'));var squel=require('squel');var crypto=require(_0x2172('0xe'));var jsforce=require(_0x2172('0xf'));var deskjs=require(_0x2172('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2172('0x11'));var Papa=require(_0x2172('0x12'));var Redis=require(_0x2172('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2172('0x14'));var hardwareService=require(_0x2172('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x2172('0x16'));var config=require(_0x2172('0x17'));var licenseUtil=require(_0x2172('0x18'));var db=require(_0x2172('0x19'))['db'];function respondWithStatusCode(_0x34236f,_0x562350){_0x562350=_0x562350||0xcc;return function(_0x2fa871){if(_0x2fa871){return _0x34236f[_0x2172('0x1a')](_0x562350);}return _0x34236f[_0x2172('0x1b')](_0x562350)[_0x2172('0x1c')]();};}function respondWithResult(_0x378a61,_0x2fc52f){_0x2fc52f=_0x2fc52f||0xc8;return function(_0x16d45c){if(_0x16d45c){return _0x378a61[_0x2172('0x1b')](_0x2fc52f)['json'](_0x16d45c);}};}function respondWithFilteredResult(_0x1d18a1,_0x2980cb){return function(_0x3bfea6){if(_0x3bfea6){var _0x4a162b=typeof _0x2980cb[_0x2172('0x1d')]==='undefined'&&typeof _0x2980cb[_0x2172('0x1e')]==='undefined';var _0x3d6d4a=_0x3bfea6[_0x2172('0x1f')];var _0x116a26=_0x4a162b?0x0:_0x2980cb[_0x2172('0x1d')];var _0x20a4f8=_0x4a162b?_0x3bfea6[_0x2172('0x1f')]:_0x2980cb[_0x2172('0x1d')]+_0x2980cb[_0x2172('0x1e')];var _0x11ccb7;if(_0x20a4f8>=_0x3d6d4a){_0x20a4f8=_0x3d6d4a;_0x11ccb7=0xc8;}else{_0x11ccb7=0xce;}_0x1d18a1[_0x2172('0x1b')](_0x11ccb7);return _0x1d18a1['set'](_0x2172('0x20'),_0x116a26+'-'+_0x20a4f8+'/'+_0x3d6d4a)['json'](_0x3bfea6);}return null;};}function patchUpdates(_0x1b7e40){return function(_0x511496){try{jsonpatch[_0x2172('0x21')](_0x511496,_0x1b7e40,!![]);}catch(_0x14604d){return BPromise[_0x2172('0x22')](_0x14604d);}return _0x511496[_0x2172('0x23')]();};}function saveUpdates(_0x4d02f6,_0x1af4f0){return function(_0x56d5b7){if(_0x56d5b7){return _0x56d5b7['update'](_0x4d02f6)[_0x2172('0x24')](function(_0x5189cf){return _0x5189cf;});}return null;};}function removeEntity(_0x25e8fa,_0x4f20e9){return function(_0x239aca){if(_0x239aca){return _0x239aca[_0x2172('0x25')]()[_0x2172('0x24')](function(){_0x25e8fa[_0x2172('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19c9cc,_0xbb6fba){return function(_0x43dca2){if(!_0x43dca2){_0x19c9cc[_0x2172('0x1a')](0x194);}return _0x43dca2;};}function handleError(_0x57a4eb,_0x459c4d){_0x459c4d=_0x459c4d||0x1f4;return function(_0x4759aa){logger[_0x2172('0x26')](_0x4759aa[_0x2172('0x27')]);if(_0x4759aa[_0x2172('0x28')]){delete _0x4759aa['name'];}_0x57a4eb[_0x2172('0x1b')](_0x459c4d)[_0x2172('0x29')](_0x4759aa);};}exports[_0x2172('0x2a')]=function(_0x5aee0e,_0x1dbdca){var _0x3c6072={},_0x1cefb9={},_0xfb89d7={'count':0x0,'rows':[]};var _0xcc7ab9=_['map'](db[_0x2172('0x2b')][_0x2172('0x2c')],function(_0x30916d){return{'name':_0x30916d[_0x2172('0x2d')],'type':_0x30916d[_0x2172('0x2e')][_0x2172('0x2f')]};});_0x1cefb9[_0x2172('0x30')]=_[_0x2172('0x31')](_0xcc7ab9,'name');_0x1cefb9[_0x2172('0x32')]=_[_0x2172('0x33')](_0x5aee0e[_0x2172('0x32')]);_0x1cefb9[_0x2172('0x34')]=_[_0x2172('0x35')](_0x1cefb9[_0x2172('0x30')],_0x1cefb9[_0x2172('0x32')]);_0x3c6072[_0x2172('0x36')]=_['intersection'](_0x1cefb9[_0x2172('0x30')],qs[_0x2172('0x37')](_0x5aee0e[_0x2172('0x32')][_0x2172('0x37')]));_0x3c6072['attributes']=_0x3c6072[_0x2172('0x36')][_0x2172('0x38')]?_0x3c6072[_0x2172('0x36')]:_0x1cefb9[_0x2172('0x30')];if(!_0x5aee0e['query'][_0x2172('0x39')](_0x2172('0x3a'))){_0x3c6072['limit']=qs[_0x2172('0x1e')](_0x5aee0e[_0x2172('0x32')][_0x2172('0x1e')]);_0x3c6072[_0x2172('0x1d')]=qs['offset'](_0x5aee0e[_0x2172('0x32')][_0x2172('0x1d')]);}_0x3c6072[_0x2172('0x3b')]=qs[_0x2172('0x3c')](_0x5aee0e[_0x2172('0x32')]['sort']);_0x3c6072[_0x2172('0x3d')]=qs[_0x2172('0x34')](_[_0x2172('0x3e')](_0x5aee0e['query'],_0x1cefb9[_0x2172('0x34')]),_0xcc7ab9);if(_0x5aee0e['query'][_0x2172('0x3f')]){_0x3c6072[_0x2172('0x3d')]=_[_0x2172('0x40')](_0x3c6072['where'],{'$or':_[_0x2172('0x31')](_0xcc7ab9,function(_0x1ac2de){if(_0x1ac2de[_0x2172('0x2e')]!==_0x2172('0x41')){var _0x13aa92={};_0x13aa92[_0x1ac2de[_0x2172('0x28')]]={'$like':'%'+_0x5aee0e[_0x2172('0x32')][_0x2172('0x3f')]+'%'};return _0x13aa92;}})});}_0x3c6072=_[_0x2172('0x40')]({},_0x3c6072,_0x5aee0e[_0x2172('0x42')]);var _0x6b70bf={'where':_0x3c6072[_0x2172('0x3d')]};return db[_0x2172('0x2b')][_0x2172('0x1f')](_0x6b70bf)[_0x2172('0x24')](function(_0x219c99){_0xfb89d7[_0x2172('0x1f')]=_0x219c99;if(_0x5aee0e[_0x2172('0x32')][_0x2172('0x43')]){_0x3c6072['include']=[{'all':!![]}];}return db[_0x2172('0x2b')][_0x2172('0x44')](_0x3c6072);})[_0x2172('0x24')](function(_0x431cb7){_0xfb89d7[_0x2172('0x45')]=_0x431cb7;return _0xfb89d7;})[_0x2172('0x24')](respondWithFilteredResult(_0x1dbdca,_0x3c6072))[_0x2172('0x46')](handleError(_0x1dbdca,null));};exports[_0x2172('0x47')]=function(_0x260ff4,_0x374cc8){var _0xaa4e1={'raw':!![],'where':{'id':_0x260ff4[_0x2172('0x48')]['id']}},_0x4eebc3={};_0x4eebc3['model']=_[_0x2172('0x33')](db[_0x2172('0x2b')][_0x2172('0x2c')]);_0x4eebc3[_0x2172('0x32')]=_['keys'](_0x260ff4[_0x2172('0x32')]);_0x4eebc3[_0x2172('0x34')]=_[_0x2172('0x35')](_0x4eebc3[_0x2172('0x30')],_0x4eebc3[_0x2172('0x32')]);_0xaa4e1[_0x2172('0x36')]=_[_0x2172('0x35')](_0x4eebc3['model'],qs[_0x2172('0x37')](_0x260ff4[_0x2172('0x32')]['fields']));_0xaa4e1[_0x2172('0x36')]=_0xaa4e1['attributes']['length']?_0xaa4e1[_0x2172('0x36')]:_0x4eebc3[_0x2172('0x30')];if(_0x260ff4[_0x2172('0x32')]['includeAll']){_0xaa4e1['include']=[{'all':!![]}];}_0xaa4e1=_[_0x2172('0x40')]({},_0xaa4e1,_0x260ff4[_0x2172('0x42')]);return db[_0x2172('0x2b')][_0x2172('0x49')](_0xaa4e1)[_0x2172('0x24')](handleEntityNotFound(_0x374cc8,null))[_0x2172('0x24')](respondWithResult(_0x374cc8,null))[_0x2172('0x46')](handleError(_0x374cc8,null));};exports[_0x2172('0x4a')]=function(_0x4cb6bc,_0x2f04da){return db[_0x2172('0x2b')]['create'](_0x4cb6bc[_0x2172('0x4b')],{})['then'](respondWithResult(_0x2f04da,0xc9))[_0x2172('0x46')](handleError(_0x2f04da,null));};exports[_0x2172('0x4c')]=function(_0x1847d9,_0x718631){if(_0x1847d9[_0x2172('0x4b')]['id']){delete _0x1847d9[_0x2172('0x4b')]['id'];}return db[_0x2172('0x2b')][_0x2172('0x49')]({'where':{'id':_0x1847d9['params']['id']}})[_0x2172('0x24')](handleEntityNotFound(_0x718631,null))['then'](saveUpdates(_0x1847d9[_0x2172('0x4b')],null))[_0x2172('0x24')](respondWithResult(_0x718631,null))[_0x2172('0x46')](handleError(_0x718631,null));};exports[_0x2172('0x25')]=function(_0x52a037,_0x425575){return db[_0x2172('0x2b')]['find']({'where':{'id':_0x52a037[_0x2172('0x48')]['id']}})['then'](handleEntityNotFound(_0x425575,null))[_0x2172('0x24')](removeEntity(_0x425575,null))[_0x2172('0x46')](handleError(_0x425575,null));};exports['describe']=function(_0x5147ce,_0x1bb008){return db[_0x2172('0x2b')][_0x2172('0x4d')]()['then'](respondWithResult(_0x1bb008,null))[_0x2172('0x46')](handleError(_0x1bb008,null));}; \ No newline at end of file +var _0x71ba=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','OpenchannelTransferReport','then','include','catch','params','includeAll','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service'];(function(_0xf67f45,_0x36e087){var _0xd9ab5=function(_0x594070){while(--_0x594070){_0xf67f45['push'](_0xf67f45['shift']());}};_0xd9ab5(++_0x36e087);}(_0x71ba,0xd1));var _0xa71b=function(_0x1c83d6,_0x59dfb5){_0x1c83d6=_0x1c83d6-0x0;var _0x8131c0=_0x71ba[_0x1c83d6];return _0x8131c0;};'use strict';var emlformat=require(_0xa71b('0x0'));var rimraf=require(_0xa71b('0x1'));var zipdir=require(_0xa71b('0x2'));var jsonpatch=require(_0xa71b('0x3'));var rp=require(_0xa71b('0x4'));var moment=require(_0xa71b('0x5'));var BPromise=require(_0xa71b('0x6'));var Mustache=require(_0xa71b('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa71b('0x8'));var fs=require('fs');var fs_extra=require(_0xa71b('0x9'));var _=require(_0xa71b('0xa'));var squel=require(_0xa71b('0xb'));var crypto=require(_0xa71b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa71b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa71b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa71b('0xf'));var qs=require(_0xa71b('0x10'));var as=require(_0xa71b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa71b('0x12'))(_0xa71b('0x13'));var utils=require(_0xa71b('0x14'));var config=require(_0xa71b('0x15'));var licenseUtil=require(_0xa71b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37d547,_0xbc07b8){_0xbc07b8=_0xbc07b8||0xcc;return function(_0x32cd65){if(_0x32cd65){return _0x37d547[_0xa71b('0x17')](_0xbc07b8);}return _0x37d547[_0xa71b('0x18')](_0xbc07b8)[_0xa71b('0x19')]();};}function respondWithResult(_0x5d5412,_0x499dc4){_0x499dc4=_0x499dc4||0xc8;return function(_0x2b6144){if(_0x2b6144){return _0x5d5412['status'](_0x499dc4)['json'](_0x2b6144);}};}function respondWithFilteredResult(_0x26d561,_0x5e96fa){return function(_0x79fd49){if(_0x79fd49){var _0x13c222=typeof _0x5e96fa[_0xa71b('0x1a')]===_0xa71b('0x1b')&&typeof _0x5e96fa[_0xa71b('0x1c')]==='undefined';var _0x3d580a=_0x79fd49[_0xa71b('0x1d')];var _0x2f4355=_0x13c222?0x0:_0x5e96fa['offset'];var _0x3b1ddc=_0x13c222?_0x79fd49[_0xa71b('0x1d')]:_0x5e96fa[_0xa71b('0x1a')]+_0x5e96fa[_0xa71b('0x1c')];var _0x28373f;if(_0x3b1ddc>=_0x3d580a){_0x3b1ddc=_0x3d580a;_0x28373f=0xc8;}else{_0x28373f=0xce;}_0x26d561[_0xa71b('0x18')](_0x28373f);return _0x26d561[_0xa71b('0x1e')]('Content-Range',_0x2f4355+'-'+_0x3b1ddc+'/'+_0x3d580a)[_0xa71b('0x1f')](_0x79fd49);}return null;};}function patchUpdates(_0x593718){return function(_0x53eeef){try{jsonpatch[_0xa71b('0x20')](_0x53eeef,_0x593718,!![]);}catch(_0x551b42){return BPromise[_0xa71b('0x21')](_0x551b42);}return _0x53eeef[_0xa71b('0x22')]();};}function saveUpdates(_0x1981bc,_0x43be2f){return function(_0x3000cc){if(_0x3000cc){return _0x3000cc['update'](_0x1981bc)['then'](function(_0x220842){return _0x220842;});}return null;};}function removeEntity(_0x1856a9,_0x3bcc21){return function(_0x1aebce){if(_0x1aebce){return _0x1aebce['destroy']()['then'](function(){_0x1856a9[_0xa71b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589b47,_0x59805e){return function(_0x3c4016){if(!_0x3c4016){_0x589b47[_0xa71b('0x17')](0x194);}return _0x3c4016;};}function handleError(_0x80bf02,_0xe0f82c){_0xe0f82c=_0xe0f82c||0x1f4;return function(_0x469c2b){logger[_0xa71b('0x23')](_0x469c2b[_0xa71b('0x24')]);if(_0x469c2b[_0xa71b('0x25')]){delete _0x469c2b['name'];}_0x80bf02[_0xa71b('0x18')](_0xe0f82c)[_0xa71b('0x26')](_0x469c2b);};}exports[_0xa71b('0x27')]=function(_0x51851a,_0x6b1ade){var _0x5819ed={},_0x19b6ca={},_0x45429f={'count':0x0,'rows':[]};var _0x3777f2=_['map'](db['OpenchannelTransferReport'][_0xa71b('0x28')],function(_0x6f976a){return{'name':_0x6f976a[_0xa71b('0x29')],'type':_0x6f976a[_0xa71b('0x2a')][_0xa71b('0x2b')]};});_0x19b6ca[_0xa71b('0x2c')]=_['map'](_0x3777f2,_0xa71b('0x25'));_0x19b6ca[_0xa71b('0x2d')]=_[_0xa71b('0x2e')](_0x51851a[_0xa71b('0x2d')]);_0x19b6ca[_0xa71b('0x2f')]=_[_0xa71b('0x30')](_0x19b6ca['model'],_0x19b6ca['query']);_0x5819ed['attributes']=_[_0xa71b('0x30')](_0x19b6ca[_0xa71b('0x2c')],qs['fields'](_0x51851a['query'][_0xa71b('0x31')]));_0x5819ed[_0xa71b('0x32')]=_0x5819ed[_0xa71b('0x32')][_0xa71b('0x33')]?_0x5819ed[_0xa71b('0x32')]:_0x19b6ca[_0xa71b('0x2c')];if(!_0x51851a[_0xa71b('0x2d')][_0xa71b('0x34')](_0xa71b('0x35'))){_0x5819ed[_0xa71b('0x1c')]=qs[_0xa71b('0x1c')](_0x51851a[_0xa71b('0x2d')]['limit']);_0x5819ed[_0xa71b('0x1a')]=qs['offset'](_0x51851a['query']['offset']);}_0x5819ed[_0xa71b('0x36')]=qs['sort'](_0x51851a[_0xa71b('0x2d')][_0xa71b('0x37')]);_0x5819ed[_0xa71b('0x38')]=qs[_0xa71b('0x2f')](_[_0xa71b('0x39')](_0x51851a[_0xa71b('0x2d')],_0x19b6ca[_0xa71b('0x2f')]),_0x3777f2);if(_0x51851a[_0xa71b('0x2d')][_0xa71b('0x3a')]){_0x5819ed[_0xa71b('0x38')]=_['merge'](_0x5819ed['where'],{'$or':_[_0xa71b('0x3b')](_0x3777f2,function(_0x167da0){if(_0x167da0['type']!==_0xa71b('0x3c')){var _0x55687a={};_0x55687a[_0x167da0[_0xa71b('0x25')]]={'$like':'%'+_0x51851a[_0xa71b('0x2d')][_0xa71b('0x3a')]+'%'};return _0x55687a;}})});}_0x5819ed=_[_0xa71b('0x3d')]({},_0x5819ed,_0x51851a[_0xa71b('0x3e')]);var _0x3c57c0={'where':_0x5819ed['where']};return db[_0xa71b('0x3f')][_0xa71b('0x1d')](_0x3c57c0)[_0xa71b('0x40')](function(_0x835d8f){_0x45429f[_0xa71b('0x1d')]=_0x835d8f;if(_0x51851a[_0xa71b('0x2d')]['includeAll']){_0x5819ed[_0xa71b('0x41')]=[{'all':!![]}];}return db[_0xa71b('0x3f')]['findAll'](_0x5819ed);})['then'](function(_0x4e385c){_0x45429f['rows']=_0x4e385c;return _0x45429f;})['then'](respondWithFilteredResult(_0x6b1ade,_0x5819ed))[_0xa71b('0x42')](handleError(_0x6b1ade,null));};exports['show']=function(_0x1d1f90,_0x1d6baa){var _0x2a48ba={'raw':!![],'where':{'id':_0x1d1f90[_0xa71b('0x43')]['id']}},_0x5ed202={};_0x5ed202[_0xa71b('0x2c')]=_[_0xa71b('0x2e')](db[_0xa71b('0x3f')][_0xa71b('0x28')]);_0x5ed202[_0xa71b('0x2d')]=_['keys'](_0x1d1f90[_0xa71b('0x2d')]);_0x5ed202[_0xa71b('0x2f')]=_[_0xa71b('0x30')](_0x5ed202[_0xa71b('0x2c')],_0x5ed202['query']);_0x2a48ba[_0xa71b('0x32')]=_['intersection'](_0x5ed202['model'],qs[_0xa71b('0x31')](_0x1d1f90[_0xa71b('0x2d')][_0xa71b('0x31')]));_0x2a48ba[_0xa71b('0x32')]=_0x2a48ba['attributes'][_0xa71b('0x33')]?_0x2a48ba[_0xa71b('0x32')]:_0x5ed202[_0xa71b('0x2c')];if(_0x1d1f90['query'][_0xa71b('0x44')]){_0x2a48ba[_0xa71b('0x41')]=[{'all':!![]}];}_0x2a48ba=_[_0xa71b('0x3d')]({},_0x2a48ba,_0x1d1f90[_0xa71b('0x3e')]);return db[_0xa71b('0x3f')][_0xa71b('0x45')](_0x2a48ba)[_0xa71b('0x40')](handleEntityNotFound(_0x1d6baa,null))[_0xa71b('0x40')](respondWithResult(_0x1d6baa,null))['catch'](handleError(_0x1d6baa,null));};exports['create']=function(_0x401670,_0x4d8f4f){return db[_0xa71b('0x3f')][_0xa71b('0x46')](_0x401670[_0xa71b('0x47')],{})[_0xa71b('0x40')](respondWithResult(_0x4d8f4f,0xc9))[_0xa71b('0x42')](handleError(_0x4d8f4f,null));};exports[_0xa71b('0x48')]=function(_0x2427b6,_0x4fc8a7){if(_0x2427b6[_0xa71b('0x47')]['id']){delete _0x2427b6[_0xa71b('0x47')]['id'];}return db['OpenchannelTransferReport'][_0xa71b('0x45')]({'where':{'id':_0x2427b6[_0xa71b('0x43')]['id']}})[_0xa71b('0x40')](handleEntityNotFound(_0x4fc8a7,null))[_0xa71b('0x40')](saveUpdates(_0x2427b6[_0xa71b('0x47')],null))['then'](respondWithResult(_0x4fc8a7,null))[_0xa71b('0x42')](handleError(_0x4fc8a7,null));};exports[_0xa71b('0x49')]=function(_0x4da5f9,_0xcbb3ef){return db['OpenchannelTransferReport'][_0xa71b('0x45')]({'where':{'id':_0x4da5f9[_0xa71b('0x43')]['id']}})[_0xa71b('0x40')](handleEntityNotFound(_0xcbb3ef,null))[_0xa71b('0x40')](removeEntity(_0xcbb3ef,null))[_0xa71b('0x42')](handleError(_0xcbb3ef,null));};exports[_0xa71b('0x4a')]=function(_0xc8f467,_0x5a8261){return db[_0xa71b('0x3f')][_0xa71b('0x4a')]()[_0xa71b('0x40')](respondWithResult(_0x5a8261,null))[_0xa71b('0x42')](handleError(_0x5a8261,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 5df288c..62d66bf 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 _0xb53f=['exports','report_openchannel_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb53f,0x9f));var _0xfb53=function(_0x440c18,_0x28315c){_0x440c18=_0x440c18-0x0;var _0xa870ec=_0xb53f[_0x440c18];return _0xa870ec;};'use strict';var _=require('lodash');var util=require(_0xfb53('0x0'));var logger=require(_0xfb53('0x1'))('api');var moment=require(_0xfb53('0x2'));var BPromise=require(_0xfb53('0x3'));var rp=require(_0xfb53('0x4'));var fs=require('fs');var path=require(_0xfb53('0x5'));var rimraf=require(_0xfb53('0x6'));var config=require(_0xfb53('0x7'));var attributes=require(_0xfb53('0x8'));module[_0xfb53('0x9')]=function(_0x955dd8,_0x4575fc){return _0x955dd8['define']('OpenchannelTransferReport',attributes,{'tableName':_0xfb53('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfb53('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3784=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2d452d,_0x4a77c7){var _0x3a6600=function(_0x5de90d){while(--_0x5de90d){_0x2d452d['push'](_0x2d452d['shift']());}};_0x3a6600(++_0x4a77c7);}(_0x3784,0x1a7));var _0x4378=function(_0x5d64da,_0x22c47c){_0x5d64da=_0x5d64da-0x0;var _0x54c6cc=_0x3784[_0x5d64da];return _0x54c6cc;};'use strict';var _=require(_0x4378('0x0'));var util=require(_0x4378('0x1'));var logger=require(_0x4378('0x2'))(_0x4378('0x3'));var moment=require(_0x4378('0x4'));var BPromise=require(_0x4378('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4378('0x6'));var config=require(_0x4378('0x7'));var attributes=require(_0x4378('0x8'));module[_0x4378('0x9')]=function(_0x539ef6,_0x3506f9){return _0x539ef6[_0x4378('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x4378('0xb'),'paranoid':![],'indexes':[{'name':_0x4378('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 85539d3..a9e526e 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 _0x3d6d=['OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5830b0,_0x4bf4b4){var _0x54bbf0=function(_0x557932){while(--_0x557932){_0x5830b0['push'](_0x5830b0['shift']());}};_0x54bbf0(++_0x4bf4b4);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x1510c5,_0xde9022){_0x1510c5=_0x1510c5-0x0;var _0x433a86=_0x3d6d[_0x1510c5];return _0x433a86;};'use strict';var _=require(_0xd3d6('0x0'));var util=require(_0xd3d6('0x1'));var moment=require(_0xd3d6('0x2'));var BPromise=require(_0xd3d6('0x3'));var rs=require(_0xd3d6('0x4'));var fs=require('fs');var Redis=require(_0xd3d6('0x5'));var db=require(_0xd3d6('0x6'))['db'];var utils=require(_0xd3d6('0x7'));var logger=require(_0xd3d6('0x8'))(_0xd3d6('0x9'));var config=require(_0xd3d6('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd3d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f02f5,_0x1bb0d5,_0x3c2a9b){return new BPromise(function(_0x4356b7,_0x5a469d){return client[_0xd3d6('0xc')](_0x1f02f5,_0x3c2a9b)[_0xd3d6('0xd')](function(_0x465ffd){logger[_0xd3d6('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1bb0d5,'request\x20sent');logger[_0xd3d6('0xf')](_0xd3d6('0x10'),_0x1bb0d5,_0xd3d6('0x11'),JSON[_0xd3d6('0x12')](_0x465ffd));if(_0x465ffd[_0xd3d6('0x13')]){if(_0x465ffd[_0xd3d6('0x13')][_0xd3d6('0x14')]===0x1f4){logger[_0xd3d6('0x13')](_0xd3d6('0x15'),_0x1bb0d5,_0x465ffd['error'][_0xd3d6('0x16')]);return _0x5a469d(_0x465ffd[_0xd3d6('0x13')][_0xd3d6('0x16')]);}logger['error'](_0xd3d6('0x15'),_0x1bb0d5,_0x465ffd[_0xd3d6('0x13')][_0xd3d6('0x16')]);return _0x4356b7(_0x465ffd['error'][_0xd3d6('0x16')]);}else{logger[_0xd3d6('0xe')](_0xd3d6('0x15'),_0x1bb0d5,_0xd3d6('0x11'));_0x4356b7(_0x465ffd[_0xd3d6('0x17')][_0xd3d6('0x16')]);}})[_0xd3d6('0x18')](function(_0x31d4f0){logger[_0xd3d6('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1bb0d5,_0x31d4f0);_0x5a469d(_0x31d4f0);});});} \ No newline at end of file +var _0x34f8=['http','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x34f8,0x80));var _0x834f=function(_0x149be0,_0x43d7e7){_0x149be0=_0x149be0-0x0;var _0x5c96f7=_0x34f8[_0x149be0];return _0x5c96f7;};'use strict';var _=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var moment=require(_0x834f('0x2'));var BPromise=require(_0x834f('0x3'));var rs=require(_0x834f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x834f('0x5'));var logger=require(_0x834f('0x6'))('rpc');var config=require(_0x834f('0x7'));var jayson=require(_0x834f('0x8'));var client=jayson[_0x834f('0x9')][_0x834f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5378c4,_0x4cd107,_0xf778e4){return new BPromise(function(_0x2597c6,_0x20b504){return client[_0x834f('0xb')](_0x5378c4,_0xf778e4)['then'](function(_0x4210cf){logger[_0x834f('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4cd107,_0x834f('0xd'));logger[_0x834f('0xe')](_0x834f('0xf'),_0x4cd107,_0x834f('0xd'),JSON[_0x834f('0x10')](_0x4210cf));if(_0x4210cf[_0x834f('0x11')]){if(_0x4210cf[_0x834f('0x11')][_0x834f('0x12')]===0x1f4){logger['error'](_0x834f('0x13'),_0x4cd107,_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);return _0x20b504(_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);}logger['error'](_0x834f('0x13'),_0x4cd107,_0x4210cf[_0x834f('0x11')]['message']);return _0x2597c6(_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);}else{logger['info'](_0x834f('0x13'),_0x4cd107,'request\x20sent');_0x2597c6(_0x4210cf[_0x834f('0x15')][_0x834f('0x14')]);}})[_0x834f('0x16')](function(_0x248924){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4cd107,_0x248924);_0x20b504(_0x248924);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 4453300..27ecb07 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 _0x33a4=['delete','util','connect-timeout','express','Router','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0x33a4,0x88));var _0x433a=function(_0x38ba48,_0x2c2555){_0x38ba48=_0x38ba48-0x0;var _0x3af06e=_0x33a4[_0x38ba48];return _0x3af06e;};'use strict';var multer=require('multer');var util=require(_0x433a('0x0'));var path=require('path');var timeout=require(_0x433a('0x1'));var express=require(_0x433a('0x2'));var router=express[_0x433a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x433a('0x4'));var controller=require(_0x433a('0x5'));router[_0x433a('0x6')]('/',auth[_0x433a('0x7')](),controller[_0x433a('0x8')]);router['get'](_0x433a('0x9'),auth['isAuthenticated'](),controller[_0x433a('0xa')]);router[_0x433a('0xb')]('/',auth[_0x433a('0x7')](),controller[_0x433a('0xc')]);router['put']('/:id',auth[_0x433a('0x7')](),controller[_0x433a('0xd')]);router[_0x433a('0xe')](_0x433a('0x9'),auth[_0x433a('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6b62=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x47936d,_0x52ff42){var _0x1044ea=function(_0x5a3d92){while(--_0x5a3d92){_0x47936d['push'](_0x47936d['shift']());}};_0x1044ea(++_0x52ff42);}(_0x6b62,0x73));var _0x26b6=function(_0x1d3510,_0x45ad9d){_0x1d3510=_0x1d3510-0x0;var _0x262696=_0x6b62[_0x1d3510];return _0x262696;};'use strict';var multer=require(_0x26b6('0x0'));var util=require(_0x26b6('0x1'));var path=require(_0x26b6('0x2'));var timeout=require(_0x26b6('0x3'));var express=require(_0x26b6('0x4'));var router=express[_0x26b6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x26b6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x26b6('0x7'));var controller=require(_0x26b6('0x8'));router[_0x26b6('0x9')]('/',auth[_0x26b6('0xa')](),controller[_0x26b6('0xb')]);router['get'](_0x26b6('0xc'),auth[_0x26b6('0xa')](),controller[_0x26b6('0xd')]);router['post']('/',auth[_0x26b6('0xa')](),controller[_0x26b6('0xe')]);router[_0x26b6('0xf')](_0x26b6('0xc'),auth[_0x26b6('0xa')](),controller[_0x26b6('0x10')]);router[_0x26b6('0x11')](_0x26b6('0xc'),auth['isAuthenticated'](),controller[_0x26b6('0x12')]);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 772d1b1..7883090 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 _0xa279=['STRING','exports'];(function(_0xc87adb,_0x29c131){var _0x54dff6=function(_0x4e4adf){while(--_0x4e4adf){_0xc87adb['push'](_0xc87adb['shift']());}};_0x54dff6(++_0x29c131);}(_0xa279,0x11b));var _0x9a27=function(_0x35a770,_0x5a73d0){_0x35a770=_0x35a770-0x0;var _0x1f97ea=_0xa279[_0x35a770];return _0x1f97ea;};'use strict';var Sequelize=require('sequelize');module[_0x9a27('0x0')]={'name':{'type':Sequelize[_0x9a27('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x756d=['name','sequelize','STRING'];(function(_0x149ad5,_0x12b417){var _0x2566b7=function(_0x157f10){while(--_0x157f10){_0x149ad5['push'](_0x149ad5['shift']());}};_0x2566b7(++_0x12b417);}(_0x756d,0x178));var _0xd756=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x756d[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xd756('0x0'));module['exports']={'name':{'type':Sequelize[_0xd756('0x1')],'unique':_0xd756('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd756('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 848c118..3ae2281 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 _0xc67b=['sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','save','update','get','UserProfileResource','then','end','error','stack','name','send','index','map','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Pause','rows','show','params','keys','rawAttributes','includeAll','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Pauses','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x698e19,_0x37fd58){var _0x3db5bf=function(_0x73b6b0){while(--_0x73b6b0){_0x698e19['push'](_0x698e19['shift']());}};_0x3db5bf(++_0x37fd58);}(_0xc67b,0x1e4));var _0xbc67=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xc67b[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0xbc67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc67('0x1'));var jsonpatch=require(_0xbc67('0x2'));var rp=require(_0xbc67('0x3'));var moment=require(_0xbc67('0x4'));var BPromise=require(_0xbc67('0x5'));var Mustache=require(_0xbc67('0x6'));var util=require(_0xbc67('0x7'));var path=require(_0xbc67('0x8'));var sox=require(_0xbc67('0x9'));var csv=require('to-csv');var ejs=require(_0xbc67('0xa'));var fs=require('fs');var fs_extra=require(_0xbc67('0xb'));var _=require(_0xbc67('0xc'));var squel=require('squel');var crypto=require(_0xbc67('0xd'));var jsforce=require(_0xbc67('0xe'));var deskjs=require(_0xbc67('0xf'));var toCsv=require(_0xbc67('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbc67('0x11'));var authService=require(_0xbc67('0x12'));var qs=require(_0xbc67('0x13'));var as=require(_0xbc67('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc67('0x15'))(_0xbc67('0x16'));var utils=require(_0xbc67('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbc67('0x18'));var db=require(_0xbc67('0x19'))['db'];function respondWithStatusCode(_0x13b8a8,_0x738be3){_0x738be3=_0x738be3||0xcc;return function(_0x1a1ea4){if(_0x1a1ea4){return _0x13b8a8[_0xbc67('0x1a')](_0x738be3);}return _0x13b8a8['status'](_0x738be3)['end']();};}function respondWithResult(_0x1dd44e,_0x8f1316){_0x8f1316=_0x8f1316||0xc8;return function(_0x4c722c){if(_0x4c722c){return _0x1dd44e['status'](_0x8f1316)[_0xbc67('0x1b')](_0x4c722c);}};}function respondWithFilteredResult(_0x1fc313,_0xe8c03){return function(_0x3e0dac){if(_0x3e0dac){var _0x439546=typeof _0xe8c03['offset']===_0xbc67('0x1c')&&typeof _0xe8c03[_0xbc67('0x1d')]==='undefined';var _0x2988c9=_0x3e0dac[_0xbc67('0x1e')];var _0x105751=_0x439546?0x0:_0xe8c03['offset'];var _0x39802f=_0x439546?_0x3e0dac['count']:_0xe8c03[_0xbc67('0x1f')]+_0xe8c03[_0xbc67('0x1d')];var _0x22c65e;if(_0x39802f>=_0x2988c9){_0x39802f=_0x2988c9;_0x22c65e=0xc8;}else{_0x22c65e=0xce;}_0x1fc313[_0xbc67('0x20')](_0x22c65e);return _0x1fc313[_0xbc67('0x21')](_0xbc67('0x22'),_0x105751+'-'+_0x39802f+'/'+_0x2988c9)[_0xbc67('0x1b')](_0x3e0dac);}return null;};}function patchUpdates(_0x42f6d1){return function(_0xd63c36){try{jsonpatch[_0xbc67('0x23')](_0xd63c36,_0x42f6d1,!![]);}catch(_0x37bf28){return BPromise['reject'](_0x37bf28);}return _0xd63c36[_0xbc67('0x24')]();};}function saveUpdates(_0x2a19a0,_0x3819cb){return function(_0xaae88){if(_0xaae88){return _0xaae88[_0xbc67('0x25')](_0x2a19a0)['then'](function(_0x463e96){return _0x463e96;});}return null;};}function removeEntity(_0x503b1c,_0xda444d){return function(_0xfd8891){if(_0xfd8891){return _0xfd8891['destroy']()['then'](function(){var _0x3a69da=_0xfd8891[_0xbc67('0x26')]({'plain':!![]});var _0x392595='Pauses';return db[_0xbc67('0x27')]['destroy']({'where':{'type':_0x392595,'resourceId':_0x3a69da['id']}})[_0xbc67('0x28')](function(){return _0xfd8891;});})[_0xbc67('0x28')](function(){_0x503b1c['status'](0xcc)[_0xbc67('0x29')]();});}};}function handleEntityNotFound(_0x5c05f6,_0x4cb950){return function(_0x1c1443){if(!_0x1c1443){_0x5c05f6['sendStatus'](0x194);}return _0x1c1443;};}function handleError(_0xe57769,_0x59bf33){_0x59bf33=_0x59bf33||0x1f4;return function(_0xc9dcf0){logger[_0xbc67('0x2a')](_0xc9dcf0[_0xbc67('0x2b')]);if(_0xc9dcf0['name']){delete _0xc9dcf0[_0xbc67('0x2c')];}_0xe57769[_0xbc67('0x20')](_0x59bf33)[_0xbc67('0x2d')](_0xc9dcf0);};}exports[_0xbc67('0x2e')]=function(_0x3ec805,_0x4ad0d1){var _0x2cdf00={},_0xe5c07={},_0x427f72={'count':0x0,'rows':[]};var _0x4ce5a5=_[_0xbc67('0x2f')](db['Pause']['rawAttributes'],function(_0x1b043f){return{'name':_0x1b043f['fieldName'],'type':_0x1b043f[_0xbc67('0x30')][_0xbc67('0x31')]};});_0xe5c07[_0xbc67('0x32')]=_[_0xbc67('0x2f')](_0x4ce5a5,_0xbc67('0x2c'));_0xe5c07[_0xbc67('0x33')]=_['keys'](_0x3ec805[_0xbc67('0x33')]);_0xe5c07[_0xbc67('0x34')]=_['intersection'](_0xe5c07[_0xbc67('0x32')],_0xe5c07[_0xbc67('0x33')]);_0x2cdf00[_0xbc67('0x35')]=_[_0xbc67('0x36')](_0xe5c07[_0xbc67('0x32')],qs[_0xbc67('0x37')](_0x3ec805[_0xbc67('0x33')][_0xbc67('0x37')]));_0x2cdf00['attributes']=_0x2cdf00[_0xbc67('0x35')][_0xbc67('0x38')]?_0x2cdf00['attributes']:_0xe5c07[_0xbc67('0x32')];if(!_0x3ec805['query'][_0xbc67('0x39')](_0xbc67('0x3a'))){_0x2cdf00[_0xbc67('0x1d')]=qs[_0xbc67('0x1d')](_0x3ec805[_0xbc67('0x33')]['limit']);_0x2cdf00['offset']=qs['offset'](_0x3ec805[_0xbc67('0x33')][_0xbc67('0x1f')]);}_0x2cdf00[_0xbc67('0x3b')]=qs[_0xbc67('0x3c')](_0x3ec805[_0xbc67('0x33')][_0xbc67('0x3c')]);_0x2cdf00[_0xbc67('0x3d')]=qs['filters'](_[_0xbc67('0x3e')](_0x3ec805[_0xbc67('0x33')],_0xe5c07[_0xbc67('0x34')]),_0x4ce5a5);if(_0x3ec805[_0xbc67('0x33')][_0xbc67('0x3f')]){_0x2cdf00['where']=_['merge'](_0x2cdf00[_0xbc67('0x3d')],{'$or':_['map'](_0x4ce5a5,function(_0xc2abd8){if(_0xc2abd8[_0xbc67('0x30')]!==_0xbc67('0x40')){var _0x5229cf={};_0x5229cf[_0xc2abd8[_0xbc67('0x2c')]]={'$like':'%'+_0x3ec805[_0xbc67('0x33')]['filter']+'%'};return _0x5229cf;}})});}_0x2cdf00=_[_0xbc67('0x41')]({},_0x2cdf00,_0x3ec805[_0xbc67('0x42')]);var _0x101805={'where':_0x2cdf00[_0xbc67('0x3d')]};return db[_0xbc67('0x43')][_0xbc67('0x1e')](_0x101805)[_0xbc67('0x28')](function(_0x5077f4){_0x427f72['count']=_0x5077f4;if(_0x3ec805[_0xbc67('0x33')]['includeAll']){_0x2cdf00['include']=[{'all':!![]}];}return db[_0xbc67('0x43')]['findAll'](_0x2cdf00);})[_0xbc67('0x28')](function(_0x353f0d){_0x427f72[_0xbc67('0x44')]=_0x353f0d;return _0x427f72;})['then'](respondWithFilteredResult(_0x4ad0d1,_0x2cdf00))['catch'](handleError(_0x4ad0d1,null));};exports[_0xbc67('0x45')]=function(_0x3768c8,_0x496305){var _0x208fa2={'raw':!![],'where':{'id':_0x3768c8[_0xbc67('0x46')]['id']}},_0x19683a={};_0x19683a[_0xbc67('0x32')]=_[_0xbc67('0x47')](db[_0xbc67('0x43')][_0xbc67('0x48')]);_0x19683a[_0xbc67('0x33')]=_[_0xbc67('0x47')](_0x3768c8[_0xbc67('0x33')]);_0x19683a[_0xbc67('0x34')]=_[_0xbc67('0x36')](_0x19683a[_0xbc67('0x32')],_0x19683a['query']);_0x208fa2['attributes']=_[_0xbc67('0x36')](_0x19683a[_0xbc67('0x32')],qs[_0xbc67('0x37')](_0x3768c8[_0xbc67('0x33')][_0xbc67('0x37')]));_0x208fa2[_0xbc67('0x35')]=_0x208fa2[_0xbc67('0x35')][_0xbc67('0x38')]?_0x208fa2[_0xbc67('0x35')]:_0x19683a[_0xbc67('0x32')];if(_0x3768c8[_0xbc67('0x33')][_0xbc67('0x49')]){_0x208fa2[_0xbc67('0x4a')]=[{'all':!![]}];}_0x208fa2=_['merge']({},_0x208fa2,_0x3768c8[_0xbc67('0x42')]);return db[_0xbc67('0x43')][_0xbc67('0x4b')](_0x208fa2)['then'](handleEntityNotFound(_0x496305,null))[_0xbc67('0x28')](respondWithResult(_0x496305,null))[_0xbc67('0x4c')](handleError(_0x496305,null));};exports[_0xbc67('0x4d')]=function(_0x26adc7,_0x52e83d){return db[_0xbc67('0x43')][_0xbc67('0x4d')](_0x26adc7[_0xbc67('0x4e')],{})[_0xbc67('0x28')](function(_0x13d055){var _0x403761=_0x26adc7['user'][_0xbc67('0x26')]({'plain':!![]});if(!_0x403761)throw new Error(_0xbc67('0x4f'));if(_0x403761['role']===_0xbc67('0x50')){var _0x2618d9=_0x13d055[_0xbc67('0x26')]({'plain':!![]});var _0xe8714a=_0xbc67('0x51');return db[_0xbc67('0x52')][_0xbc67('0x4b')]({'where':{'name':_0xe8714a,'userProfileId':_0x403761['userProfileId']},'raw':!![]})[_0xbc67('0x28')](function(_0x112481){if(_0x112481&&_0x112481[_0xbc67('0x53')]===0x0){return db[_0xbc67('0x27')][_0xbc67('0x4d')]({'name':_0x2618d9[_0xbc67('0x2c')],'resourceId':_0x2618d9['id'],'type':_0x112481['name'],'sectionId':_0x112481['id']},{})[_0xbc67('0x28')](function(){return _0x13d055;});}else{return _0x13d055;}})[_0xbc67('0x4c')](function(_0x121bf6){logger['error'](_0xbc67('0x54'),_0x121bf6);throw _0x121bf6;});}return _0x13d055;})[_0xbc67('0x28')](respondWithResult(_0x52e83d,0xc9))[_0xbc67('0x4c')](handleError(_0x52e83d,null));};exports[_0xbc67('0x25')]=function(_0x25c5ed,_0x2c9331){if(_0x25c5ed[_0xbc67('0x4e')]['id']){delete _0x25c5ed['body']['id'];}return db[_0xbc67('0x43')][_0xbc67('0x4b')]({'where':{'id':_0x25c5ed[_0xbc67('0x46')]['id']}})[_0xbc67('0x28')](handleEntityNotFound(_0x2c9331,null))['then'](saveUpdates(_0x25c5ed[_0xbc67('0x4e')],null))['then'](respondWithResult(_0x2c9331,null))[_0xbc67('0x4c')](handleError(_0x2c9331,null));};exports['destroy']=function(_0x3d73eb,_0xa2fb0c){return db[_0xbc67('0x43')][_0xbc67('0x4b')]({'where':{'id':_0x3d73eb[_0xbc67('0x46')]['id']}})[_0xbc67('0x28')](handleEntityNotFound(_0xa2fb0c,null))['then'](removeEntity(_0xa2fb0c,null))[_0xbc67('0x4c')](handleError(_0xa2fb0c,null));}; \ No newline at end of file +var _0xd6b6=['save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','Pause','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','set','apply'];(function(_0x44b48c,_0x32f971){var _0x39fe6c=function(_0x3f2cfe){while(--_0x3f2cfe){_0x44b48c['push'](_0x44b48c['shift']());}};_0x39fe6c(++_0x32f971);}(_0xd6b6,0x1dc));var _0x6d6b=function(_0x43be4d,_0x374dc2){_0x43be4d=_0x43be4d-0x0;var _0xc6b0cf=_0xd6b6[_0x43be4d];return _0xc6b0cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d6b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d6b('0x1'));var rp=require(_0x6d6b('0x2'));var moment=require(_0x6d6b('0x3'));var BPromise=require(_0x6d6b('0x4'));var Mustache=require(_0x6d6b('0x5'));var util=require(_0x6d6b('0x6'));var path=require(_0x6d6b('0x7'));var sox=require(_0x6d6b('0x8'));var csv=require(_0x6d6b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6b('0xa'));var _=require(_0x6d6b('0xb'));var squel=require(_0x6d6b('0xc'));var crypto=require(_0x6d6b('0xd'));var jsforce=require(_0x6d6b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6d6b('0x9'));var querystring=require('querystring');var Papa=require(_0x6d6b('0xf'));var Redis=require(_0x6d6b('0x10'));var authService=require(_0x6d6b('0x11'));var qs=require(_0x6d6b('0x12'));var as=require(_0x6d6b('0x13'));var hardwareService=require(_0x6d6b('0x14'));var logger=require(_0x6d6b('0x15'))(_0x6d6b('0x16'));var utils=require(_0x6d6b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6d6b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb4ce22,_0x4cdf26){_0x4cdf26=_0x4cdf26||0xcc;return function(_0x32e7b8){if(_0x32e7b8){return _0xb4ce22['sendStatus'](_0x4cdf26);}return _0xb4ce22['status'](_0x4cdf26)[_0x6d6b('0x19')]();};}function respondWithResult(_0x1960fa,_0x338382){_0x338382=_0x338382||0xc8;return function(_0x36f347){if(_0x36f347){return _0x1960fa[_0x6d6b('0x1a')](_0x338382)[_0x6d6b('0x1b')](_0x36f347);}};}function respondWithFilteredResult(_0x2565b3,_0x2f9471){return function(_0x5d1a34){if(_0x5d1a34){var _0x1cc5ea=typeof _0x2f9471[_0x6d6b('0x1c')]===_0x6d6b('0x1d')&&typeof _0x2f9471[_0x6d6b('0x1e')]===_0x6d6b('0x1d');var _0x2ead8d=_0x5d1a34[_0x6d6b('0x1f')];var _0x444a15=_0x1cc5ea?0x0:_0x2f9471[_0x6d6b('0x1c')];var _0xdf3c02=_0x1cc5ea?_0x5d1a34[_0x6d6b('0x1f')]:_0x2f9471[_0x6d6b('0x1c')]+_0x2f9471[_0x6d6b('0x1e')];var _0x5a1de3;if(_0xdf3c02>=_0x2ead8d){_0xdf3c02=_0x2ead8d;_0x5a1de3=0xc8;}else{_0x5a1de3=0xce;}_0x2565b3['status'](_0x5a1de3);return _0x2565b3[_0x6d6b('0x20')]('Content-Range',_0x444a15+'-'+_0xdf3c02+'/'+_0x2ead8d)['json'](_0x5d1a34);}return null;};}function patchUpdates(_0x4ca3b7){return function(_0x219988){try{jsonpatch[_0x6d6b('0x21')](_0x219988,_0x4ca3b7,!![]);}catch(_0x38119e){return BPromise['reject'](_0x38119e);}return _0x219988[_0x6d6b('0x22')]();};}function saveUpdates(_0x47f0dc,_0x244c0e){return function(_0x508bd0){if(_0x508bd0){return _0x508bd0[_0x6d6b('0x23')](_0x47f0dc)[_0x6d6b('0x24')](function(_0x184c58){return _0x184c58;});}return null;};}function removeEntity(_0x4d8d9a,_0x482626){return function(_0x3b646f){if(_0x3b646f){return _0x3b646f['destroy']()['then'](function(){var _0x5b96ae=_0x3b646f[_0x6d6b('0x25')]({'plain':!![]});var _0x3c455a='Pauses';return db[_0x6d6b('0x26')][_0x6d6b('0x27')]({'where':{'type':_0x3c455a,'resourceId':_0x5b96ae['id']}})[_0x6d6b('0x24')](function(){return _0x3b646f;});})[_0x6d6b('0x24')](function(){_0x4d8d9a[_0x6d6b('0x1a')](0xcc)[_0x6d6b('0x19')]();});}};}function handleEntityNotFound(_0x128996,_0x21ebab){return function(_0x4d3a85){if(!_0x4d3a85){_0x128996[_0x6d6b('0x28')](0x194);}return _0x4d3a85;};}function handleError(_0x241c12,_0x21e49a){_0x21e49a=_0x21e49a||0x1f4;return function(_0x403f15){logger[_0x6d6b('0x29')](_0x403f15[_0x6d6b('0x2a')]);if(_0x403f15[_0x6d6b('0x2b')]){delete _0x403f15[_0x6d6b('0x2b')];}_0x241c12[_0x6d6b('0x1a')](_0x21e49a)[_0x6d6b('0x2c')](_0x403f15);};}exports[_0x6d6b('0x2d')]=function(_0x415e39,_0xff4fdb){var _0x466a56={},_0x2c93a0={},_0x46e4ee={'count':0x0,'rows':[]};var _0x1a2883=_['map'](db[_0x6d6b('0x2e')]['rawAttributes'],function(_0x5a5e37){return{'name':_0x5a5e37[_0x6d6b('0x2f')],'type':_0x5a5e37[_0x6d6b('0x30')][_0x6d6b('0x31')]};});_0x2c93a0[_0x6d6b('0x32')]=_['map'](_0x1a2883,_0x6d6b('0x2b'));_0x2c93a0[_0x6d6b('0x33')]=_[_0x6d6b('0x34')](_0x415e39[_0x6d6b('0x33')]);_0x2c93a0[_0x6d6b('0x35')]=_[_0x6d6b('0x36')](_0x2c93a0[_0x6d6b('0x32')],_0x2c93a0['query']);_0x466a56[_0x6d6b('0x37')]=_[_0x6d6b('0x36')](_0x2c93a0[_0x6d6b('0x32')],qs[_0x6d6b('0x38')](_0x415e39[_0x6d6b('0x33')][_0x6d6b('0x38')]));_0x466a56[_0x6d6b('0x37')]=_0x466a56[_0x6d6b('0x37')]['length']?_0x466a56[_0x6d6b('0x37')]:_0x2c93a0['model'];if(!_0x415e39['query'][_0x6d6b('0x39')]('nolimit')){_0x466a56['limit']=qs[_0x6d6b('0x1e')](_0x415e39[_0x6d6b('0x33')]['limit']);_0x466a56[_0x6d6b('0x1c')]=qs[_0x6d6b('0x1c')](_0x415e39['query']['offset']);}_0x466a56[_0x6d6b('0x3a')]=qs[_0x6d6b('0x3b')](_0x415e39['query']['sort']);_0x466a56[_0x6d6b('0x3c')]=qs[_0x6d6b('0x35')](_[_0x6d6b('0x3d')](_0x415e39[_0x6d6b('0x33')],_0x2c93a0[_0x6d6b('0x35')]),_0x1a2883);if(_0x415e39[_0x6d6b('0x33')][_0x6d6b('0x3e')]){_0x466a56[_0x6d6b('0x3c')]=_[_0x6d6b('0x3f')](_0x466a56[_0x6d6b('0x3c')],{'$or':_[_0x6d6b('0x40')](_0x1a2883,function(_0x3bd02c){if(_0x3bd02c[_0x6d6b('0x30')]!==_0x6d6b('0x41')){var _0x5c325a={};_0x5c325a[_0x3bd02c[_0x6d6b('0x2b')]]={'$like':'%'+_0x415e39['query'][_0x6d6b('0x3e')]+'%'};return _0x5c325a;}})});}_0x466a56=_[_0x6d6b('0x3f')]({},_0x466a56,_0x415e39[_0x6d6b('0x42')]);var _0x72acdb={'where':_0x466a56[_0x6d6b('0x3c')]};return db[_0x6d6b('0x2e')][_0x6d6b('0x1f')](_0x72acdb)[_0x6d6b('0x24')](function(_0x1ae164){_0x46e4ee[_0x6d6b('0x1f')]=_0x1ae164;if(_0x415e39[_0x6d6b('0x33')][_0x6d6b('0x43')]){_0x466a56[_0x6d6b('0x44')]=[{'all':!![]}];}return db[_0x6d6b('0x2e')][_0x6d6b('0x45')](_0x466a56);})['then'](function(_0x2e4d67){_0x46e4ee[_0x6d6b('0x46')]=_0x2e4d67;return _0x46e4ee;})[_0x6d6b('0x24')](respondWithFilteredResult(_0xff4fdb,_0x466a56))[_0x6d6b('0x47')](handleError(_0xff4fdb,null));};exports[_0x6d6b('0x48')]=function(_0x3b36e4,_0x1fbeb3){var _0x22d285={'raw':!![],'where':{'id':_0x3b36e4[_0x6d6b('0x49')]['id']}},_0x25d21f={};_0x25d21f[_0x6d6b('0x32')]=_[_0x6d6b('0x34')](db['Pause']['rawAttributes']);_0x25d21f['query']=_['keys'](_0x3b36e4[_0x6d6b('0x33')]);_0x25d21f[_0x6d6b('0x35')]=_['intersection'](_0x25d21f[_0x6d6b('0x32')],_0x25d21f[_0x6d6b('0x33')]);_0x22d285[_0x6d6b('0x37')]=_[_0x6d6b('0x36')](_0x25d21f[_0x6d6b('0x32')],qs[_0x6d6b('0x38')](_0x3b36e4[_0x6d6b('0x33')][_0x6d6b('0x38')]));_0x22d285[_0x6d6b('0x37')]=_0x22d285[_0x6d6b('0x37')][_0x6d6b('0x4a')]?_0x22d285[_0x6d6b('0x37')]:_0x25d21f[_0x6d6b('0x32')];if(_0x3b36e4[_0x6d6b('0x33')][_0x6d6b('0x43')]){_0x22d285[_0x6d6b('0x44')]=[{'all':!![]}];}_0x22d285=_[_0x6d6b('0x3f')]({},_0x22d285,_0x3b36e4[_0x6d6b('0x42')]);return db[_0x6d6b('0x2e')][_0x6d6b('0x4b')](_0x22d285)['then'](handleEntityNotFound(_0x1fbeb3,null))[_0x6d6b('0x24')](respondWithResult(_0x1fbeb3,null))['catch'](handleError(_0x1fbeb3,null));};exports[_0x6d6b('0x4c')]=function(_0x2b3bb4,_0x38389e){return db[_0x6d6b('0x2e')]['create'](_0x2b3bb4['body'],{})[_0x6d6b('0x24')](function(_0x834574){var _0x55f812=_0x2b3bb4[_0x6d6b('0x4d')][_0x6d6b('0x25')]({'plain':!![]});if(!_0x55f812)throw new Error(_0x6d6b('0x4e'));if(_0x55f812['role']===_0x6d6b('0x4d')){var _0xb9bcaf=_0x834574[_0x6d6b('0x25')]({'plain':!![]});var _0x5d8674=_0x6d6b('0x4f');return db[_0x6d6b('0x50')]['find']({'where':{'name':_0x5d8674,'userProfileId':_0x55f812[_0x6d6b('0x51')]},'raw':!![]})['then'](function(_0x593f4b){if(_0x593f4b&&_0x593f4b[_0x6d6b('0x52')]===0x0){return db[_0x6d6b('0x26')][_0x6d6b('0x4c')]({'name':_0xb9bcaf[_0x6d6b('0x2b')],'resourceId':_0xb9bcaf['id'],'type':_0x593f4b[_0x6d6b('0x2b')],'sectionId':_0x593f4b['id']},{})[_0x6d6b('0x24')](function(){return _0x834574;});}else{return _0x834574;}})[_0x6d6b('0x47')](function(_0x304e9){logger['error'](_0x6d6b('0x53'),_0x304e9);throw _0x304e9;});}return _0x834574;})[_0x6d6b('0x24')](respondWithResult(_0x38389e,0xc9))[_0x6d6b('0x47')](handleError(_0x38389e,null));};exports['update']=function(_0x468e63,_0x7edf9a){if(_0x468e63[_0x6d6b('0x54')]['id']){delete _0x468e63['body']['id'];}return db[_0x6d6b('0x2e')][_0x6d6b('0x4b')]({'where':{'id':_0x468e63[_0x6d6b('0x49')]['id']}})[_0x6d6b('0x24')](handleEntityNotFound(_0x7edf9a,null))[_0x6d6b('0x24')](saveUpdates(_0x468e63[_0x6d6b('0x54')],null))[_0x6d6b('0x24')](respondWithResult(_0x7edf9a,null))[_0x6d6b('0x47')](handleError(_0x7edf9a,null));};exports['destroy']=function(_0x331325,_0x3a43dc){return db[_0x6d6b('0x2e')][_0x6d6b('0x4b')]({'where':{'id':_0x331325[_0x6d6b('0x49')]['id']}})[_0x6d6b('0x24')](handleEntityNotFound(_0x3a43dc,null))[_0x6d6b('0x24')](removeEntity(_0x3a43dc,null))[_0x6d6b('0x47')](handleError(_0x3a43dc,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index d3d7e1e..4bdb7aa 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0xfe0269,_0x18cdbc){var _0x5585a5=function(_0x49b197){while(--_0x49b197){_0xfe0269['push'](_0xfe0269['shift']());}};_0x5585a5(++_0x18cdbc);}(_0xf494,0x1c6));var _0x4f49=function(_0x3fb9fc,_0x5d22f1){_0x3fb9fc=_0x3fb9fc-0x0;var _0xc13658=_0xf494[_0x3fb9fc];return _0xc13658;};'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')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./pause.attributes','exports','define','tools_pauses','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x55ca,0x126));var _0xa55c=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0x55ca[_0x4ac48d];return _0x7537af;};'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')]('Pause',attributes,{'tableName':_0xa55c('0x9'),'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 9e3570a..2364702 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(_0x569bbc,_0x5513eb){var _0x5abfad=function(_0x201398){while(--_0x201398){_0x569bbc['push'](_0x569bbc['shift']());}};_0x5abfad(++_0x5513eb);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e1fe9,_0x216dd9){_0x1e1fe9=_0x1e1fe9-0x0;var _0x4eeb06=_0xb10b[_0x1e1fe9];return _0x4eeb06;};'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(_0x2d031f,_0x54ab61){var _0x1b38d8=function(_0x5c9c95){while(--_0x5c9c95){_0x2d031f['push'](_0x2d031f['shift']());}};_0x1b38d8(++_0x54ab61);}(_0xb10b,0x12a));var _0xbb10=function(_0x7b717,_0x311539){_0x7b717=_0x7b717-0x0;var _0x50d254=_0xb10b[_0x7b717];return _0x50d254;};'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 f28a648..f2a6ac5 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 _0x2123=['join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','isAuthenticated','show','/:id/download','diskStorage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2123,0x190));var _0x3212=function(_0xf9332a,_0xb2f99b){_0xf9332a=_0xf9332a-0x0;var _0x2654ce=_0x2123[_0xf9332a];return _0x2654ce;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),controller['webhookGet']);router[_0x3212('0xb')]('/:id',auth[_0x3212('0xe')](),controller[_0x3212('0xf')]);router[_0x3212('0xb')](_0x3212('0x10'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x3212('0x11')]({'destination':function(_0xf166c2,_0x1a3b2f,_0x23f7e3){_0x23f7e3(null,path[_0x3212('0x12')](config[_0x3212('0x13')],_0x3212('0x14')));},'filename':function(_0x359cef,_0x26c1c8,_0x2d5fce){_0x26c1c8[_0x3212('0x15')]=_0x26c1c8[_0x3212('0x15')][_0x3212('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d5fce(null,util[_0x3212('0x17')](_0x3212('0x18'),path[_0x3212('0x19')](_0x26c1c8[_0x3212('0x15')],path[_0x3212('0x1a')](_0x26c1c8[_0x3212('0x15')])),Date[_0x3212('0x1b')](),path[_0x3212('0x1a')](_0x26c1c8[_0x3212('0x15')])));}})});router['post']('/',upload[_0x3212('0x1c')](_0x3212('0x1d')),controller[_0x3212('0x1e')]);router[_0x3212('0x1f')](_0x3212('0xd'),controller[_0x3212('0x20')]);router[_0x3212('0x21')]('/:id',auth['isAuthenticated'](),controller[_0x3212('0x22')]);router['delete'](_0x3212('0x23'),auth[_0x3212('0xe')](),controller[_0x3212('0x24')]);module[_0x3212('0x25')]=router; \ No newline at end of file +var _0x9bde=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','now','post','file','upload','webhookPost','put','delete'];(function(_0x3d4c00,_0x396a9c){var _0x494bcd=function(_0x43fbaf){while(--_0x43fbaf){_0x3d4c00['push'](_0x3d4c00['shift']());}};_0x494bcd(++_0x396a9c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4d9188,_0x368638){_0x4d9188=_0x4d9188-0x0;var _0x2e147a=_0x9bde[_0x4d9188];return _0x2e147a;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),controller[_0xe9bd('0xb')]);router[_0xe9bd('0x8')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0x8')](_0xe9bd('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xe9bd('0x10')]({'destination':function(_0x145521,_0x2601ac,_0x581ab9){_0x581ab9(null,path[_0xe9bd('0x11')](config[_0xe9bd('0x12')],_0xe9bd('0x13')));},'filename':function(_0x141587,_0x5e022a,_0x2c1d98){_0x5e022a['originalname']=_0x5e022a[_0xe9bd('0x14')][_0xe9bd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c1d98(null,util[_0xe9bd('0x16')]('%s-%s%s',path['basename'](_0x5e022a[_0xe9bd('0x14')],path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])),Date[_0xe9bd('0x18')](),path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])));}})});router[_0xe9bd('0x19')]('/',upload['single'](_0xe9bd('0x1a')),controller[_0xe9bd('0x1b')]);router[_0xe9bd('0x19')]('/webhook',controller[_0xe9bd('0x1c')]);router[_0xe9bd('0x1d')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller['update']);router[_0xe9bd('0x1e')]('/:id',auth[_0xe9bd('0xd')](),controller['delete']);module[_0xe9bd('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 32b15a3..ed5b109 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 _0x203a=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING'];(function(_0x5aba4f,_0x1afb63){var _0x10cf5c=function(_0x1adea5){while(--_0x1adea5){_0x5aba4f['push'](_0x5aba4f['shift']());}};_0x10cf5c(++_0x1afb63);}(_0x203a,0xf5));var _0xa203=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x203a[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xa203('0x0'));module['exports']={'name':{'type':Sequelize[_0xa203('0x1')]},'type':{'type':Sequelize[_0xa203('0x2')](_0xa203('0x3'),'script')},'description':{'type':Sequelize[_0xa203('0x4')]},'version':{'type':Sequelize[_0xa203('0x4')]},'path':{'type':Sequelize[_0xa203('0x1')],'comment':_0xa203('0x5')},'active':{'type':Sequelize[_0xa203('0x6')],'defaultValue':0x0,'comment':_0xa203('0x7')},'sidebar':{'type':Sequelize[_0xa203('0x2')](_0xa203('0x8'),_0xa203('0x9'),_0xa203('0xa'),_0xa203('0xb')),'defaultValue':'always','comment':_0xa203('0xc')},'icon':{'type':Sequelize[_0xa203('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xa203('0x1')]},'scriptName':{'type':Sequelize[_0xa203('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x52b0=['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.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x4f0aec,_0x97ac17){var _0x18a18e=function(_0x3ae9e7){while(--_0x3ae9e7){_0x4f0aec['push'](_0x4f0aec['shift']());}};_0x18a18e(++_0x97ac17);}(_0x52b0,0x108));var _0x052b=function(_0x7358e1,_0x2850fc){_0x7358e1=_0x7358e1-0x0;var _0x41f0bf=_0x52b0[_0x7358e1];return _0x41f0bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x052b('0x0')]},'type':{'type':Sequelize[_0x052b('0x1')]('html',_0x052b('0x2'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x052b('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0x052b('0x4')},'active':{'type':Sequelize[_0x052b('0x5')],'defaultValue':0x0,'comment':_0x052b('0x6')},'sidebar':{'type':Sequelize[_0x052b('0x1')]('adminOnly',_0x052b('0x7'),_0x052b('0x8'),_0x052b('0x9')),'defaultValue':_0x052b('0x8'),'comment':_0x052b('0xa')},'icon':{'type':Sequelize[_0x052b('0x0')]},'adminUrl':{'type':Sequelize[_0x052b('0x0')]},'agentUrl':{'type':Sequelize[_0x052b('0x0')]},'scriptName':{'type':Sequelize[_0x052b('0x0')]},'scriptPath':{'type':Sequelize[_0x052b('0x0')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index edf77c0..b4e8b32 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 _0xbdeb=['intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','VIRTUAL','where','Plugin','includeAll','findAll','show','params','include','merge','options','find','catch','root','format','%s.zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','server/files/plugins','dirname','node_modules/**/*','basename','attachments/**/*','finalize','Plugin\x20not\x20found','download','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','method','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','get','Plugins','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes'];(function(_0x119edf,_0x51c478){var _0x421024=function(_0x2d9105){while(--_0x2d9105){_0x119edf['push'](_0x119edf['shift']());}};_0x421024(++_0x51c478);}(_0xbdeb,0x6c));var _0xbbde=function(_0x346c79,_0x2c01c3){_0x346c79=_0x346c79-0x0;var _0x46712f=_0xbdeb[_0x346c79];return _0x46712f;};'use strict';var emlformat=require(_0xbbde('0x0'));var rimraf=require(_0xbbde('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbde('0x2'));var rp=require(_0xbbde('0x3'));var moment=require(_0xbbde('0x4'));var BPromise=require(_0xbbde('0x5'));var Mustache=require(_0xbbde('0x6'));var util=require(_0xbbde('0x7'));var path=require(_0xbbde('0x8'));var sox=require(_0xbbde('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbde('0xa'));var _=require(_0xbbde('0xb'));var squel=require('squel');var crypto=require(_0xbbde('0xc'));var jsforce=require(_0xbbde('0xd'));var deskjs=require(_0xbbde('0xe'));var toCsv=require(_0xbbde('0xf'));var querystring=require('querystring');var Papa=require(_0xbbde('0x10'));var extract=require('extract-zip');var rimraf=require(_0xbbde('0x1'));var archiver=require('archiver');var Redis=require(_0xbbde('0x11'));var authService=require(_0xbbde('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbbde('0x13'));var hardwareService=require(_0xbbde('0x14'));var logger=require(_0xbbde('0x15'))(_0xbbde('0x16'));var utils=require(_0xbbde('0x17'));var config=require(_0xbbde('0x18'));var licenseUtil=require(_0xbbde('0x19'));var db=require('../../mysqldb')['db'];config[_0xbbde('0x1a')]=_[_0xbbde('0x1b')](config[_0xbbde('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xbbde('0x1c'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x1e1d90,_0x774f3b){_0x774f3b=_0x774f3b||0xcc;return function(_0x34852f){if(_0x34852f){return _0x1e1d90[_0xbbde('0x1d')](_0x774f3b);}return _0x1e1d90[_0xbbde('0x1e')](_0x774f3b)[_0xbbde('0x1f')]();};}function respondWithResult(_0x4e7502,_0x3ff419){_0x3ff419=_0x3ff419||0xc8;return function(_0x82bd2d){if(_0x82bd2d){return _0x4e7502[_0xbbde('0x1e')](_0x3ff419)[_0xbbde('0x20')](_0x82bd2d);}};}function respondWithFilteredResult(_0x1f8f7d,_0x19f949){return function(_0x5ea7fd){if(_0x5ea7fd){var _0x23f5aa=typeof _0x19f949[_0xbbde('0x21')]===_0xbbde('0x22')&&typeof _0x19f949[_0xbbde('0x23')]===_0xbbde('0x22');var _0x210f6c=_0x5ea7fd[_0xbbde('0x24')];var _0x18a36d=_0x23f5aa?0x0:_0x19f949[_0xbbde('0x21')];var _0x1f907d=_0x23f5aa?_0x5ea7fd[_0xbbde('0x24')]:_0x19f949['offset']+_0x19f949[_0xbbde('0x23')];var _0x4d80cb;if(_0x1f907d>=_0x210f6c){_0x1f907d=_0x210f6c;_0x4d80cb=0xc8;}else{_0x4d80cb=0xce;}_0x1f8f7d[_0xbbde('0x1e')](_0x4d80cb);return _0x1f8f7d[_0xbbde('0x25')](_0xbbde('0x26'),_0x18a36d+'-'+_0x1f907d+'/'+_0x210f6c)[_0xbbde('0x20')](_0x5ea7fd);}return null;};}function patchUpdates(_0x7fa182){return function(_0x124e51){try{jsonpatch[_0xbbde('0x27')](_0x124e51,_0x7fa182,!![]);}catch(_0x407b37){return BPromise[_0xbbde('0x28')](_0x407b37);}return _0x124e51['save']();};}function saveUpdates(_0x53828a,_0x35456f){return function(_0x2e8cec){if(_0x2e8cec){return _0x2e8cec['update'](_0x53828a)['then'](function(_0x44296c){return _0x44296c;});}return null;};}function removeEntity(_0x3d73b4,_0x4338e2){return function(_0x593de9){if(_0x593de9){return _0x593de9[_0xbbde('0x29')]()[_0xbbde('0x2a')](function(){var _0x1ddea5=_0x593de9[_0xbbde('0x2b')]({'plain':!![]});var _0x1384c5=_0xbbde('0x2c');return db['UserProfileResource'][_0xbbde('0x29')]({'where':{'type':_0x1384c5,'resourceId':_0x1ddea5['id']}})[_0xbbde('0x2a')](function(){return _0x593de9;});})[_0xbbde('0x2a')](function(){_0x3d73b4[_0xbbde('0x1e')](0xcc)[_0xbbde('0x1f')]();});}};}function handleEntityNotFound(_0xc28818,_0x4e125e){return function(_0x3c145f){if(!_0x3c145f){_0xc28818[_0xbbde('0x1d')](0x194);}return _0x3c145f;};}function handleError(_0xece840,_0x4f0f6f){_0x4f0f6f=_0x4f0f6f||0x1f4;return function(_0x37cd55){logger[_0xbbde('0x2d')](_0x37cd55[_0xbbde('0x2e')]);if(_0x37cd55[_0xbbde('0x2f')]){delete _0x37cd55[_0xbbde('0x2f')];}_0xece840[_0xbbde('0x1e')](_0x4f0f6f)[_0xbbde('0x30')](_0x37cd55);};}exports[_0xbbde('0x31')]=function(_0x2f48ce,_0x58d77f){var _0x154655={},_0x3dafea={},_0x46088d={'count':0x0,'rows':[]};var _0x52f14b=_[_0xbbde('0x32')](db['Plugin'][_0xbbde('0x33')],function(_0x382dac){return{'name':_0x382dac[_0xbbde('0x34')],'type':_0x382dac[_0xbbde('0x35')][_0xbbde('0x36')]};});_0x3dafea[_0xbbde('0x37')]=_[_0xbbde('0x32')](_0x52f14b,_0xbbde('0x2f'));_0x3dafea['query']=_[_0xbbde('0x38')](_0x2f48ce[_0xbbde('0x39')]);_0x3dafea['filters']=_['intersection'](_0x3dafea[_0xbbde('0x37')],_0x3dafea['query']);_0x154655[_0xbbde('0x3a')]=_[_0xbbde('0x3b')](_0x3dafea['model'],qs['fields'](_0x2f48ce[_0xbbde('0x39')][_0xbbde('0x3c')]));_0x154655[_0xbbde('0x3a')]=_0x154655[_0xbbde('0x3a')][_0xbbde('0x3d')]?_0x154655['attributes']:_0x3dafea[_0xbbde('0x37')];if(!_0x2f48ce['query'][_0xbbde('0x3e')]('nolimit')){_0x154655[_0xbbde('0x23')]=qs[_0xbbde('0x23')](_0x2f48ce[_0xbbde('0x39')][_0xbbde('0x23')]);_0x154655[_0xbbde('0x21')]=qs[_0xbbde('0x21')](_0x2f48ce[_0xbbde('0x39')][_0xbbde('0x21')]);}_0x154655[_0xbbde('0x3f')]=qs[_0xbbde('0x40')](_0x2f48ce[_0xbbde('0x39')][_0xbbde('0x40')]);_0x154655['where']=qs[_0xbbde('0x41')](_[_0xbbde('0x42')](_0x2f48ce[_0xbbde('0x39')],_0x3dafea[_0xbbde('0x41')]),_0x52f14b);if(_0x2f48ce['query'][_0xbbde('0x43')]){_0x154655['where']=_['merge'](_0x154655['where'],{'$or':_[_0xbbde('0x32')](_0x52f14b,function(_0xb77abf){if(_0xb77abf[_0xbbde('0x35')]!==_0xbbde('0x44')){var _0x60ccea={};_0x60ccea[_0xb77abf['name']]={'$like':'%'+_0x2f48ce['query']['filter']+'%'};return _0x60ccea;}})});}_0x154655=_['merge']({},_0x154655,_0x2f48ce['options']);var _0xf84be3={'where':_0x154655[_0xbbde('0x45')]};return db[_0xbbde('0x46')][_0xbbde('0x24')](_0xf84be3)[_0xbbde('0x2a')](function(_0x4a8f6d){_0x46088d[_0xbbde('0x24')]=_0x4a8f6d;if(_0x2f48ce[_0xbbde('0x39')][_0xbbde('0x47')]){_0x154655['include']=[{'all':!![]}];}return db[_0xbbde('0x46')][_0xbbde('0x48')](_0x154655);})[_0xbbde('0x2a')](function(_0x2b33e5){_0x46088d['rows']=_0x2b33e5;return _0x46088d;})['then'](respondWithFilteredResult(_0x58d77f,_0x154655))['catch'](handleError(_0x58d77f,null));};exports[_0xbbde('0x49')]=function(_0x442a3c,_0x25a0f4){var _0x95a832={'raw':!![],'where':{'id':_0x442a3c[_0xbbde('0x4a')]['id']}},_0x3bd16e={};_0x3bd16e['model']=_['keys'](db[_0xbbde('0x46')]['rawAttributes']);_0x3bd16e[_0xbbde('0x39')]=_['keys'](_0x442a3c[_0xbbde('0x39')]);_0x3bd16e[_0xbbde('0x41')]=_[_0xbbde('0x3b')](_0x3bd16e[_0xbbde('0x37')],_0x3bd16e[_0xbbde('0x39')]);_0x95a832[_0xbbde('0x3a')]=_[_0xbbde('0x3b')](_0x3bd16e[_0xbbde('0x37')],qs[_0xbbde('0x3c')](_0x442a3c[_0xbbde('0x39')][_0xbbde('0x3c')]));_0x95a832[_0xbbde('0x3a')]=_0x95a832[_0xbbde('0x3a')][_0xbbde('0x3d')]?_0x95a832[_0xbbde('0x3a')]:_0x3bd16e[_0xbbde('0x37')];if(_0x442a3c[_0xbbde('0x39')][_0xbbde('0x47')]){_0x95a832[_0xbbde('0x4b')]=[{'all':!![]}];}_0x95a832=_[_0xbbde('0x4c')]({},_0x95a832,_0x442a3c[_0xbbde('0x4d')]);return db['Plugin'][_0xbbde('0x4e')](_0x95a832)['then'](handleEntityNotFound(_0x25a0f4,null))['then'](respondWithResult(_0x25a0f4,null))[_0xbbde('0x4f')](handleError(_0x25a0f4,null));};exports['download']=function(_0x3a2552,_0x464850,_0xb61c08){return db['Plugin'][_0xbbde('0x4e')]({'where':{'id':_0x3a2552[_0xbbde('0x4a')]['id']},'attributes':['name','path'],'raw':!![]})[_0xbbde('0x2a')](handleEntityNotFound(_0x464850,null))[_0xbbde('0x2a')](function(_0x59c8a1){if(_0x59c8a1){var _0x37c65d=path['join'](config[_0xbbde('0x50')],'server/files/plugins',util[_0xbbde('0x51')](_0xbbde('0x52'),path['basename'](_0x59c8a1[_0xbbde('0x8')])));var _0x4a6b85=fs['createWriteStream'](_0x37c65d);var _0xc2d5b0=archiver('zip',{'zlib':{'level':0x9}});_0xc2d5b0['on']('warning',function(_0x557148){if(_0x557148[_0xbbde('0x53')]===_0xbbde('0x54')){logger['error'](_0x557148);}else{throw new db[(_0xbbde('0x55'))][(_0xbbde('0x56'))](_0xbbde('0x57'));}});_0xc2d5b0['on'](_0xbbde('0x2d'),function(_0x3df6dd){throw new db[(_0xbbde('0x55'))][(_0xbbde('0x56'))](_0xbbde('0x57'));});_0xc2d5b0[_0xbbde('0x58')](_0x4a6b85);_0xc2d5b0[_0xbbde('0x59')](_0xbbde('0x5a'),{'cwd':path[_0xbbde('0x5b')](config[_0xbbde('0x50')],_0xbbde('0x5c'),path[_0xbbde('0x5d')](_0x59c8a1[_0xbbde('0x8')])),'ignore':[path['join'](path['basename'](_0x59c8a1['path']),_0xbbde('0x5e')),path[_0xbbde('0x5b')](path[_0xbbde('0x5f')](_0x59c8a1[_0xbbde('0x8')]),_0xbbde('0x60'))],'nodir':!![]})[_0xbbde('0x61')]();_0x4a6b85['on']('close',function(){if(!fs['existsSync'](_0x37c65d)){throw new db[(_0xbbde('0x55'))][(_0xbbde('0x56'))](_0xbbde('0x62'));}return _0x464850[_0xbbde('0x63')](_0x37c65d,util[_0xbbde('0x51')](_0xbbde('0x52'),path[_0xbbde('0x5f')](_0x59c8a1[_0xbbde('0x8')])),function(_0x395ccb){if(_0x395ccb){throw new db['Sequelize'][(_0xbbde('0x56'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xbbde('0x64')](_0x37c65d);logger[_0xbbde('0x65')]('Download\x20completed');logger[_0xbbde('0x65')](_0xbbde('0x66'));});});}return null;})[_0xbbde('0x4f')](handleError(_0x464850,null));};exports[_0xbbde('0x67')]=function(_0x466e61,_0x2c7b80,_0x47c5fe){var _0x284743=path['basename'](_0x466e61[_0xbbde('0x68')][_0xbbde('0x69')],path['extname'](_0x466e61['file'][_0xbbde('0x69')]));var _0x559f69=path['join'](config['root'],_0xbbde('0x5c'),_0x466e61[_0xbbde('0x68')][_0xbbde('0x69')]);var _0x1048dc=path[_0xbbde('0x5b')](config[_0xbbde('0x50')],_0xbbde('0x5c'),_0x284743);logger[_0xbbde('0x65')](_0xbbde('0x6a'),_0x559f69);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x1048dc);try{fs['chmodSync'](_0x559f69,parseInt('0777',0x8));extract(_0x559f69,{'dir':_0x1048dc},function(_0x1bf605){if(_0x1bf605){logger[_0xbbde('0x2d')](_0x1bf605);handleError(_0x1bf605,!![]);};var _0x3b7e24=fs[_0xbbde('0x6b')](_0x1048dc);if(_0x3b7e24[_0xbbde('0x3d')]>0x1){removeReferences(_0x559f69,_0x1048dc);logger['error'](_0xbbde('0x6c'));return _0x47c5fe(new Error('Invalid\x20plugin\x20structure'));}var _0x2d2835=fs[_0xbbde('0x6d')](path[_0xbbde('0x5b')](_0x1048dc,_0x3b7e24[0x0]));if(_0x2d2835[_0xbbde('0x6e')]()){removeReferences(_0x559f69,_0x1048dc);logger[_0xbbde('0x2d')](_0xbbde('0x6c'));return _0x47c5fe(new Error(_0xbbde('0x6c')));}if(_0x2d2835[_0xbbde('0x6f')]()){var _0x18dd6a=fs['readdirSync'](path[_0xbbde('0x5b')](_0x1048dc,_0x3b7e24[0x0]));if(_0x18dd6a[_0xbbde('0x3d')]===0x0){removeReferences(_0x559f69,_0x1048dc);logger[_0xbbde('0x2d')](_0xbbde('0x6c'));return _0x47c5fe(new Error(_0xbbde('0x6c')));}var _0x1aa578=_0x18dd6a[_0xbbde('0x70')](function(_0x3d3a02){return _0x3d3a02===_0xbbde('0x71');});if(!_0x1aa578){return _0x47c5fe(new Error(_0xbbde('0x72')));}var _0x413a85=fs[_0xbbde('0x73')](path[_0xbbde('0x5b')](_0x1048dc,_0x3b7e24[0x0],_0xbbde('0x71')));var _0x58ef60=JSON[_0xbbde('0x74')](_0x413a85);if('undefined'==typeof _0x58ef60['name']){return _0x47c5fe(new Error(_0xbbde('0x75')));}if(_0xbbde('0x22')==typeof _0x58ef60[_0xbbde('0x35')]){return _0x47c5fe(new Error(_0xbbde('0x76')));}if(_0xbbde('0x22')==typeof _0x58ef60[_0xbbde('0x77')]){return _0x47c5fe(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xbbde('0x22')==typeof _0x58ef60[_0xbbde('0x78')]){return _0x47c5fe(new Error(_0xbbde('0x79')));}if(_0x58ef60[_0xbbde('0x35')]===_0xbbde('0x7a')){if('undefined'==typeof _0x58ef60[_0xbbde('0x78')][_0xbbde('0x7b')]){return _0x47c5fe(new Error(_0xbbde('0x7c')));}if(_0xbbde('0x22')==typeof _0x58ef60['parameters']['views'][_0xbbde('0x7d')]&&_0xbbde('0x22')==typeof _0x58ef60[_0xbbde('0x78')][_0xbbde('0x7b')]['agent']){return _0x47c5fe(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x58ef60[_0xbbde('0x35')]===_0xbbde('0x7e')){if(_0xbbde('0x22')==typeof _0x58ef60[_0xbbde('0x78')]['scriptName']){return _0x47c5fe(new Error(_0xbbde('0x7f')));}if(_0xbbde('0x22')==typeof _0x58ef60[_0xbbde('0x78')][_0xbbde('0x80')]){return _0x47c5fe(new Error(_0xbbde('0x81')));}}else{return _0x47c5fe(new Error(_0xbbde('0x82')));}var _0x524390=_0x58ef60[_0xbbde('0x2f')];var _0x46d083=_0x58ef60[_0xbbde('0x83')];var _0x19b4d6=_0x58ef60[_0xbbde('0x35')];var _0x1b6bb3=_0x58ef60[_0xbbde('0x84')]?_0x58ef60[_0xbbde('0x84')]:_0xbbde('0x85');var _0x5e3f29=_0x58ef60[_0xbbde('0x86')]?_0x58ef60[_0xbbde('0x86')]:'icon-apps';var _0x115d7f='';var _0x247b1e='';var _0x418716='';var _0x29d552='';var _0x36e5fe=_0x58ef60[_0xbbde('0x77')];if(_0x19b4d6==='html'){if('undefined'!=typeof _0x58ef60['parameters'][_0xbbde('0x7b')][_0xbbde('0x7d')]){var _0x2aca36=_0x58ef60[_0xbbde('0x78')][_0xbbde('0x7b')][_0xbbde('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xbbde('0x87')](_0x2aca36)){_0x115d7f=path[_0xbbde('0x5b')](_0xbbde('0x88'),_0x284743,_0x3b7e24[0x0],_0x2aca36);}else{_0x115d7f=_0x2aca36;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x58ef60['parameters']['views']['agent']){var _0x245571=_0x58ef60[_0xbbde('0x78')][_0xbbde('0x7b')][_0xbbde('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x245571)){_0x247b1e=path[_0xbbde('0x5b')](_0xbbde('0x88'),_0x284743,_0x3b7e24[0x0],_0x245571);}else{_0x247b1e=_0x245571;}}else{logger['info'](_0xbbde('0x8a'));}}else if(_0x19b4d6===_0xbbde('0x7e')){_0x418716=_0x58ef60['parameters']['scriptName'];_0x29d552=_0x58ef60[_0xbbde('0x78')][_0xbbde('0x80')];if(_0xbbde('0x22')!=typeof _0x58ef60[_0xbbde('0x78')][_0xbbde('0x7b')]){if('undefined'!=typeof _0x58ef60[_0xbbde('0x78')][_0xbbde('0x7b')][_0xbbde('0x7d')]){var _0x2aca36=_0x58ef60['parameters'][_0xbbde('0x7b')][_0xbbde('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2aca36)){_0x115d7f=path['join'](_0xbbde('0x88'),_0x284743,_0x3b7e24[0x0],_0x2aca36);}else{_0x115d7f=_0x2aca36;}}if(_0xbbde('0x22')!=typeof _0x58ef60[_0xbbde('0x78')][_0xbbde('0x7b')]['agent']){var _0x245571=_0x58ef60['parameters'][_0xbbde('0x7b')][_0xbbde('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xbbde('0x87')](_0x245571)){_0x247b1e=path[_0xbbde('0x5b')]('plugins',_0x284743,_0x3b7e24[0x0],_0x245571);}else{_0x247b1e=_0x245571;}}}}var _0x2c5559={'name':_0x524390,'description':_0x46d083,'path':path[_0xbbde('0x5b')](_0x284743,_0x3b7e24[0x0]),'type':_0x19b4d6,'sidebar':_0x1b6bb3,'icon':_0x5e3f29,'adminUrl':_0x115d7f,'agentUrl':_0x247b1e,'scriptName':_0x418716,'scriptPath':_0x29d552,'version':_0x36e5fe};removeReferences(_0x559f69,null);return db[_0xbbde('0x46')]['create'](_0x2c5559)[_0xbbde('0x2a')](function(_0x46ff06){var _0x53d6e4={'role':_0x466e61[_0xbbde('0x8b')][_0xbbde('0x8c')],'userProfileId':_0x466e61['body']['userProfileId']};if(!_0x53d6e4)throw new Error(_0xbbde('0x8d'));if(_0x53d6e4[_0xbbde('0x8c')]===_0xbbde('0x8e')){var _0x38fb2a=_0x46ff06[_0xbbde('0x2b')]({'plain':!![]});return db[_0xbbde('0x8f')][_0xbbde('0x4e')]({'where':{'name':_0xbbde('0x2c'),'userProfileId':_0x53d6e4[_0xbbde('0x90')]},'raw':!![]})[_0xbbde('0x2a')](function(_0x2a314b){if(_0x2a314b&&_0x2a314b[_0xbbde('0x91')]===0x0){return db[_0xbbde('0x92')][_0xbbde('0x93')]({'name':_0x38fb2a[_0xbbde('0x2f')],'resourceId':_0x38fb2a['id'],'type':_0x2a314b[_0xbbde('0x2f')],'sectionId':_0x2a314b['id']},{})[_0xbbde('0x2a')](function(){return _0x46ff06;});}else{return _0x46ff06;}})[_0xbbde('0x4f')](function(_0x4b65d8){logger['error'](_0xbbde('0x94'),_0x4b65d8);throw _0x4b65d8;});}return _0x46ff06;})[_0xbbde('0x2a')](respondWithResult(_0x2c7b80,null))[_0xbbde('0x4f')](handleError(_0x2c7b80,null));}});}catch(_0x731395){_0x2c7b80[_0xbbde('0x1e')](0x1f4)[_0xbbde('0x30')](_0x731395);}};function removeReferences(_0x3af578,_0x588da9){try{if(_0x3af578){fs[_0xbbde('0x64')](_0x3af578);logger[_0xbbde('0x65')]('Zip\x20archive\x20removed');}if(_0x588da9){rimraf(_0x588da9,function(){});logger[_0xbbde('0x65')](_0xbbde('0x95'));}}catch(_0x1053f6){logger[_0xbbde('0x2d')](_0x1053f6);}}exports['update']=function(_0xfa4fee,_0x6c6049,_0x53507e){return db[_0xbbde('0x46')][_0xbbde('0x4e')]({'where':{'id':_0xfa4fee[_0xbbde('0x4a')]['id']}})[_0xbbde('0x2a')](handleEntityNotFound(_0x6c6049,null))[_0xbbde('0x2a')](saveUpdates(_0xfa4fee[_0xbbde('0x8b')],null))[_0xbbde('0x2a')](respondWithResult(_0x6c6049,null))[_0xbbde('0x4f')](handleError(_0x6c6049,null));};exports[_0xbbde('0x96')]=function(_0xe66e92,_0x41bcd6,_0x1394ec){return db[_0xbbde('0x46')][_0xbbde('0x4e')]({'where':{'id':_0xe66e92['params']['id']}})[_0xbbde('0x2a')](function(_0x204a47){if(_0x204a47){return _0x204a47['destroy']();}})[_0xbbde('0x2a')](function(_0x52635e){rimraf(path['join'](config['root'],_0xbbde('0x5c'),path['dirname'](_0x52635e[_0xbbde('0x8')])),function(){});return _0x52635e;})['then'](handleEntityNotFound(_0x41bcd6,null))[_0xbbde('0x2a')](respondWithStatusCode(_0x41bcd6,null))['catch'](handleError(_0x41bcd6,null));};exports[_0xbbde('0x97')]=function(_0x11e18f,_0x5431fd,_0x5964cf){return BPromise[_0xbbde('0x98')]()['then'](function(){if(!_0x11e18f['query'][_0xbbde('0x8')]){throw new Error(_0xbbde('0x99'));}if(!_0x11e18f[_0xbbde('0x39')][_0xbbde('0x9a')]){throw new Error(_0xbbde('0x9b'));}var _0x4d4594=_0x11e18f[_0xbbde('0x39')][_0xbbde('0x9c')]?_0x11e18f[_0xbbde('0x39')][_0xbbde('0x9c')]+':'+_0x11e18f[_0xbbde('0x39')][_0xbbde('0x9a')]:'http://localhost:'+_0x11e18f[_0xbbde('0x39')][_0xbbde('0x9a')];var _0x3751e1=_0x11e18f['query']['json']?_0x11e18f[_0xbbde('0x39')][_0xbbde('0x20')]:!![];var _0x39ce2d=_0x11e18f[_0xbbde('0x39')][_0xbbde('0x9d')]?_0x11e18f[_0xbbde('0x39')]['encoding']:null;var _0x289bce={'method':_0x11e18f['method'],'uri':util[_0xbbde('0x51')](_0xbbde('0x9e'),_0x4d4594,_0x11e18f[_0xbbde('0x39')][_0xbbde('0x8')]),'json':_0x3751e1,'resolveWithFullResponse':!![],'encoding':_0x39ce2d,'qs':_0x11e18f['query']};if(_0x11e18f[_0xbbde('0x9f')]){_0x289bce[_0xbbde('0x9f')]=_0x11e18f[_0xbbde('0x9f')];if(_0x289bce['headers']['content-length']){delete _0x289bce[_0xbbde('0x9f')][_0xbbde('0xa0')];}}if(_0x289bce[_0xbbde('0x9f')][_0xbbde('0xa1')]){delete _0x289bce[_0xbbde('0x9f')][_0xbbde('0xa1')];}return rp(_0x289bce);})[_0xbbde('0x2a')](function(_0x582fd2){if(_0x582fd2){_0x5431fd[_0xbbde('0x25')](_0x582fd2[_0xbbde('0x9f')]);logger[_0xbbde('0x65')](_0x582fd2[_0xbbde('0x8b')]);if(_[_0xbbde('0xa2')](_0x11e18f[_0xbbde('0x39')][_0xbbde('0x8')],_0xbbde('0x63'))&&_0x582fd2['statusCode']==0x1f4){return _0x5431fd[_0xbbde('0x1d')](_0x582fd2[_0xbbde('0xa3')]);}else{return _0x5431fd[_0xbbde('0x1e')](_0x582fd2['statusCode'])['send'](_0x582fd2[_0xbbde('0x8b')]);}}else{return _0x5431fd[_0xbbde('0x1d')](0xc8);}})[_0xbbde('0x4f')](handleError(_0x5431fd,null));};exports[_0xbbde('0xa4')]=function(_0x3880b4,_0xbb286b,_0x8da6cb){return BPromise['resolve']()[_0xbbde('0x2a')](function(){if(!_0x3880b4[_0xbbde('0x39')][_0xbbde('0x8')]){throw new Error(_0xbbde('0x99'));}if(!_0x3880b4[_0xbbde('0x39')]['port']){throw new Error(_0xbbde('0x9b'));}var _0x32089b=_0x3880b4[_0xbbde('0x39')]['hostname']?_0x3880b4['query']['hostname']+':'+_0x3880b4[_0xbbde('0x39')][_0xbbde('0x9a')]:_0xbbde('0xa5')+_0x3880b4[_0xbbde('0x39')][_0xbbde('0x9a')];var _0x3b5675=_0x3880b4[_0xbbde('0x39')][_0xbbde('0x20')]?_0x3880b4['query'][_0xbbde('0x20')]:!![];var _0x49b03d=_0x3880b4[_0xbbde('0x39')][_0xbbde('0x9d')]?_0x3880b4[_0xbbde('0x39')][_0xbbde('0x9d')]:null;var _0x5ee31c={'method':_0x3880b4[_0xbbde('0xa6')],'uri':util['format'](_0xbbde('0x9e'),_0x32089b,_0x3880b4[_0xbbde('0x39')][_0xbbde('0x8')]),'json':_0x3b5675,'resolveWithFullResponse':!![],'encoding':_0x49b03d,'body':_0x3880b4[_0xbbde('0x8b')]};if(_0x3880b4['headers']){_0x5ee31c[_0xbbde('0x9f')]=_0x3880b4['headers'];if(_0x5ee31c[_0xbbde('0x9f')][_0xbbde('0xa0')]){delete _0x5ee31c[_0xbbde('0x9f')][_0xbbde('0xa0')];}}if(_0x5ee31c[_0xbbde('0x9f')]['content-type']){delete _0x5ee31c[_0xbbde('0x9f')][_0xbbde('0xa1')];}return rp(_0x5ee31c);})[_0xbbde('0x2a')](function(_0x46207c){if(_0x46207c){_0xbb286b[_0xbbde('0x25')](_0x46207c[_0xbbde('0x9f')]);logger[_0xbbde('0x65')](_0x46207c['body']);return _0xbb286b[_0xbbde('0x1e')](_0x46207c[_0xbbde('0xa3')])[_0xbbde('0x30')](_0x46207c[_0xbbde('0x8b')]);}else{return _0xbb286b[_0xbbde('0x1d')](0xc8);}})[_0xbbde('0x4f')](handleError(_0xbb286b,null));}; \ No newline at end of file +var _0xc2a7=['format','%s.zip','basename','zip','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','**/*','root','dirname','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','Plugins','UserProfileResource','end','error','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','join','server/files/plugins'];(function(_0x27eabf,_0x16a6b0){var _0xa96366=function(_0x1fdfd6){while(--_0x1fdfd6){_0x27eabf['push'](_0x27eabf['shift']());}};_0xa96366(++_0x16a6b0);}(_0xc2a7,0x1a7));var _0x7c2a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc2a7[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7c2a('0x0'));var jsonpatch=require(_0x7c2a('0x1'));var rp=require(_0x7c2a('0x2'));var moment=require(_0x7c2a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7c2a('0x4'));var sox=require('sox');var csv=require(_0x7c2a('0x5'));var ejs=require(_0x7c2a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c2a('0x7'));var squel=require(_0x7c2a('0x8'));var crypto=require(_0x7c2a('0x9'));var jsforce=require(_0x7c2a('0xa'));var deskjs=require(_0x7c2a('0xb'));var toCsv=require(_0x7c2a('0x5'));var querystring=require(_0x7c2a('0xc'));var Papa=require(_0x7c2a('0xd'));var extract=require(_0x7c2a('0xe'));var rimraf=require(_0x7c2a('0xf'));var archiver=require(_0x7c2a('0x10'));var Redis=require(_0x7c2a('0x11'));var authService=require(_0x7c2a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7c2a('0x13'));var hardwareService=require(_0x7c2a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7c2a('0x15'));var config=require(_0x7c2a('0x16'));var licenseUtil=require(_0x7c2a('0x17'));var db=require(_0x7c2a('0x18'))['db'];config[_0x7c2a('0x19')]=_[_0x7c2a('0x1a')](config[_0x7c2a('0x19')],{'host':_0x7c2a('0x1b'),'port':0x18eb});var socket=require(_0x7c2a('0x1c'))(new Redis(config[_0x7c2a('0x19')]));require(_0x7c2a('0x1d'))[_0x7c2a('0x1e')](socket);function respondWithStatusCode(_0x16d42d,_0x344b04){_0x344b04=_0x344b04||0xcc;return function(_0x3b0b57){if(_0x3b0b57){return _0x16d42d[_0x7c2a('0x1f')](_0x344b04);}return _0x16d42d[_0x7c2a('0x20')](_0x344b04)['end']();};}function respondWithResult(_0x3c0e3f,_0x36ee18){_0x36ee18=_0x36ee18||0xc8;return function(_0x111a8d){if(_0x111a8d){return _0x3c0e3f['status'](_0x36ee18)[_0x7c2a('0x21')](_0x111a8d);}};}function respondWithFilteredResult(_0x47a873,_0x11c934){return function(_0x5e1390){if(_0x5e1390){var _0xd1b378=typeof _0x11c934[_0x7c2a('0x22')]===_0x7c2a('0x23')&&typeof _0x11c934['limit']===_0x7c2a('0x23');var _0x51ac75=_0x5e1390[_0x7c2a('0x24')];var _0x2fdd6f=_0xd1b378?0x0:_0x11c934['offset'];var _0x2e40de=_0xd1b378?_0x5e1390['count']:_0x11c934[_0x7c2a('0x22')]+_0x11c934[_0x7c2a('0x25')];var _0x5e9848;if(_0x2e40de>=_0x51ac75){_0x2e40de=_0x51ac75;_0x5e9848=0xc8;}else{_0x5e9848=0xce;}_0x47a873[_0x7c2a('0x20')](_0x5e9848);return _0x47a873[_0x7c2a('0x26')](_0x7c2a('0x27'),_0x2fdd6f+'-'+_0x2e40de+'/'+_0x51ac75)[_0x7c2a('0x21')](_0x5e1390);}return null;};}function patchUpdates(_0x455c77){return function(_0x574790){try{jsonpatch[_0x7c2a('0x28')](_0x574790,_0x455c77,!![]);}catch(_0x1217a0){return BPromise['reject'](_0x1217a0);}return _0x574790[_0x7c2a('0x29')]();};}function saveUpdates(_0x2cbd25,_0xb7d90){return function(_0x45dc5f){if(_0x45dc5f){return _0x45dc5f[_0x7c2a('0x2a')](_0x2cbd25)[_0x7c2a('0x2b')](function(_0x45eba1){return _0x45eba1;});}return null;};}function removeEntity(_0x38505c,_0x304ee5){return function(_0x367708){if(_0x367708){return _0x367708[_0x7c2a('0x2c')]()[_0x7c2a('0x2b')](function(){var _0x540545=_0x367708[_0x7c2a('0x2d')]({'plain':!![]});var _0xfd225f=_0x7c2a('0x2e');return db[_0x7c2a('0x2f')][_0x7c2a('0x2c')]({'where':{'type':_0xfd225f,'resourceId':_0x540545['id']}})[_0x7c2a('0x2b')](function(){return _0x367708;});})['then'](function(){_0x38505c['status'](0xcc)[_0x7c2a('0x30')]();});}};}function handleEntityNotFound(_0x492e45,_0xe8f1e8){return function(_0x132071){if(!_0x132071){_0x492e45['sendStatus'](0x194);}return _0x132071;};}function handleError(_0x43f4fa,_0x5e33b5){_0x5e33b5=_0x5e33b5||0x1f4;return function(_0x11a6dd){logger[_0x7c2a('0x31')](_0x11a6dd['stack']);if(_0x11a6dd[_0x7c2a('0x32')]){delete _0x11a6dd['name'];}_0x43f4fa['status'](_0x5e33b5)[_0x7c2a('0x33')](_0x11a6dd);};}exports['index']=function(_0x36efd1,_0x2fe1d8){var _0x1008f2={},_0xdc5471={},_0x1bce38={'count':0x0,'rows':[]};var _0x29406c=_[_0x7c2a('0x34')](db[_0x7c2a('0x35')][_0x7c2a('0x36')],function(_0x2137a2){return{'name':_0x2137a2[_0x7c2a('0x37')],'type':_0x2137a2[_0x7c2a('0x38')][_0x7c2a('0x39')]};});_0xdc5471[_0x7c2a('0x3a')]=_[_0x7c2a('0x34')](_0x29406c,_0x7c2a('0x32'));_0xdc5471['query']=_[_0x7c2a('0x3b')](_0x36efd1[_0x7c2a('0x3c')]);_0xdc5471[_0x7c2a('0x3d')]=_[_0x7c2a('0x3e')](_0xdc5471[_0x7c2a('0x3a')],_0xdc5471[_0x7c2a('0x3c')]);_0x1008f2['attributes']=_[_0x7c2a('0x3e')](_0xdc5471[_0x7c2a('0x3a')],qs[_0x7c2a('0x3f')](_0x36efd1[_0x7c2a('0x3c')][_0x7c2a('0x3f')]));_0x1008f2[_0x7c2a('0x40')]=_0x1008f2[_0x7c2a('0x40')][_0x7c2a('0x41')]?_0x1008f2[_0x7c2a('0x40')]:_0xdc5471[_0x7c2a('0x3a')];if(!_0x36efd1['query'][_0x7c2a('0x42')]('nolimit')){_0x1008f2[_0x7c2a('0x25')]=qs[_0x7c2a('0x25')](_0x36efd1[_0x7c2a('0x3c')][_0x7c2a('0x25')]);_0x1008f2['offset']=qs[_0x7c2a('0x22')](_0x36efd1['query'][_0x7c2a('0x22')]);}_0x1008f2[_0x7c2a('0x43')]=qs[_0x7c2a('0x44')](_0x36efd1[_0x7c2a('0x3c')][_0x7c2a('0x44')]);_0x1008f2[_0x7c2a('0x45')]=qs[_0x7c2a('0x3d')](_[_0x7c2a('0x46')](_0x36efd1[_0x7c2a('0x3c')],_0xdc5471[_0x7c2a('0x3d')]),_0x29406c);if(_0x36efd1['query'][_0x7c2a('0x47')]){_0x1008f2[_0x7c2a('0x45')]=_[_0x7c2a('0x48')](_0x1008f2['where'],{'$or':_['map'](_0x29406c,function(_0x1794a5){if(_0x1794a5[_0x7c2a('0x38')]!=='VIRTUAL'){var _0x3cec9e={};_0x3cec9e[_0x1794a5[_0x7c2a('0x32')]]={'$like':'%'+_0x36efd1[_0x7c2a('0x3c')][_0x7c2a('0x47')]+'%'};return _0x3cec9e;}})});}_0x1008f2=_[_0x7c2a('0x48')]({},_0x1008f2,_0x36efd1['options']);var _0x307716={'where':_0x1008f2[_0x7c2a('0x45')]};return db[_0x7c2a('0x35')][_0x7c2a('0x24')](_0x307716)['then'](function(_0x59c2d8){_0x1bce38['count']=_0x59c2d8;if(_0x36efd1[_0x7c2a('0x3c')]['includeAll']){_0x1008f2[_0x7c2a('0x49')]=[{'all':!![]}];}return db[_0x7c2a('0x35')][_0x7c2a('0x4a')](_0x1008f2);})[_0x7c2a('0x2b')](function(_0x27cb62){_0x1bce38[_0x7c2a('0x4b')]=_0x27cb62;return _0x1bce38;})[_0x7c2a('0x2b')](respondWithFilteredResult(_0x2fe1d8,_0x1008f2))[_0x7c2a('0x4c')](handleError(_0x2fe1d8,null));};exports[_0x7c2a('0x4d')]=function(_0x414201,_0x477ac8){var _0x13147d={'raw':!![],'where':{'id':_0x414201[_0x7c2a('0x4e')]['id']}},_0x50e3bd={};_0x50e3bd['model']=_[_0x7c2a('0x3b')](db['Plugin'][_0x7c2a('0x36')]);_0x50e3bd['query']=_[_0x7c2a('0x3b')](_0x414201[_0x7c2a('0x3c')]);_0x50e3bd[_0x7c2a('0x3d')]=_[_0x7c2a('0x3e')](_0x50e3bd[_0x7c2a('0x3a')],_0x50e3bd[_0x7c2a('0x3c')]);_0x13147d[_0x7c2a('0x40')]=_[_0x7c2a('0x3e')](_0x50e3bd[_0x7c2a('0x3a')],qs[_0x7c2a('0x3f')](_0x414201[_0x7c2a('0x3c')][_0x7c2a('0x3f')]));_0x13147d[_0x7c2a('0x40')]=_0x13147d[_0x7c2a('0x40')][_0x7c2a('0x41')]?_0x13147d[_0x7c2a('0x40')]:_0x50e3bd[_0x7c2a('0x3a')];if(_0x414201[_0x7c2a('0x3c')][_0x7c2a('0x4f')]){_0x13147d['include']=[{'all':!![]}];}_0x13147d=_[_0x7c2a('0x48')]({},_0x13147d,_0x414201[_0x7c2a('0x50')]);return db[_0x7c2a('0x35')][_0x7c2a('0x51')](_0x13147d)['then'](handleEntityNotFound(_0x477ac8,null))['then'](respondWithResult(_0x477ac8,null))[_0x7c2a('0x4c')](handleError(_0x477ac8,null));};exports['download']=function(_0x563387,_0x132c7c,_0x2ebc80){return db[_0x7c2a('0x35')]['find']({'where':{'id':_0x563387['params']['id']},'attributes':['name',_0x7c2a('0x4')],'raw':!![]})[_0x7c2a('0x2b')](handleEntityNotFound(_0x132c7c,null))[_0x7c2a('0x2b')](function(_0x57b43b){if(_0x57b43b){var _0x17ad8a=path[_0x7c2a('0x52')](config['root'],_0x7c2a('0x53'),util[_0x7c2a('0x54')](_0x7c2a('0x55'),path[_0x7c2a('0x56')](_0x57b43b[_0x7c2a('0x4')])));var _0x43e2ab=fs['createWriteStream'](_0x17ad8a);var _0xa6fb96=archiver(_0x7c2a('0x57'),{'zlib':{'level':0x9}});_0xa6fb96['on']('warning',function(_0x386bdd){if(_0x386bdd[_0x7c2a('0x58')]===_0x7c2a('0x59')){logger[_0x7c2a('0x31')](_0x386bdd);}else{throw new db[(_0x7c2a('0x5a'))]['Error'](_0x7c2a('0x5b'));}});_0xa6fb96['on']('error',function(_0x22a268){throw new db[(_0x7c2a('0x5a'))][(_0x7c2a('0x5c'))](_0x7c2a('0x5b'));});_0xa6fb96['pipe'](_0x43e2ab);_0xa6fb96['glob'](_0x7c2a('0x5d'),{'cwd':path[_0x7c2a('0x52')](config[_0x7c2a('0x5e')],'server/files/plugins',path[_0x7c2a('0x5f')](_0x57b43b[_0x7c2a('0x4')])),'ignore':[path[_0x7c2a('0x52')](path[_0x7c2a('0x56')](_0x57b43b[_0x7c2a('0x4')]),'node_modules/**/*'),path[_0x7c2a('0x52')](path['basename'](_0x57b43b[_0x7c2a('0x4')]),_0x7c2a('0x60'))],'nodir':!![]})[_0x7c2a('0x61')]();_0x43e2ab['on'](_0x7c2a('0x62'),function(){if(!fs['existsSync'](_0x17ad8a)){throw new db['Sequelize'][(_0x7c2a('0x5c'))](_0x7c2a('0x63'));}return _0x132c7c['download'](_0x17ad8a,util['format']('%s.zip',path[_0x7c2a('0x56')](_0x57b43b['path'])),function(_0x8cb39f){if(_0x8cb39f){throw new db['Sequelize'][(_0x7c2a('0x5c'))](_0x7c2a('0x64'));}fs[_0x7c2a('0x65')](_0x17ad8a);logger['info']('Download\x20completed');logger[_0x7c2a('0x66')](_0x7c2a('0x67'));});});}return null;})[_0x7c2a('0x4c')](handleError(_0x132c7c,null));};exports['upload']=function(_0x1dbd35,_0x121b1b,_0x4b9d4b){var _0x343c3f=path[_0x7c2a('0x56')](_0x1dbd35['file'][_0x7c2a('0x68')],path[_0x7c2a('0x69')](_0x1dbd35[_0x7c2a('0x6a')]['filename']));var _0x3db08e=path[_0x7c2a('0x52')](config[_0x7c2a('0x5e')],_0x7c2a('0x53'),_0x1dbd35[_0x7c2a('0x6a')][_0x7c2a('0x68')]);var _0x37e3d9=path[_0x7c2a('0x52')](config[_0x7c2a('0x5e')],_0x7c2a('0x53'),_0x343c3f);logger['info'](_0x7c2a('0x6b'),_0x3db08e);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x37e3d9);try{fs[_0x7c2a('0x6c')](_0x3db08e,parseInt(_0x7c2a('0x6d'),0x8));extract(_0x3db08e,{'dir':_0x37e3d9},function(_0x26f80a){if(_0x26f80a){logger[_0x7c2a('0x31')](_0x26f80a);handleError(_0x26f80a,!![]);};var _0x4f5d7c=fs[_0x7c2a('0x6e')](_0x37e3d9);if(_0x4f5d7c['length']>0x1){removeReferences(_0x3db08e,_0x37e3d9);logger['error']('Invalid\x20plugin\x20structure');return _0x4b9d4b(new Error(_0x7c2a('0x6f')));}var _0x1f3b65=fs[_0x7c2a('0x70')](path[_0x7c2a('0x52')](_0x37e3d9,_0x4f5d7c[0x0]));if(_0x1f3b65[_0x7c2a('0x71')]()){removeReferences(_0x3db08e,_0x37e3d9);logger[_0x7c2a('0x31')](_0x7c2a('0x6f'));return _0x4b9d4b(new Error(_0x7c2a('0x6f')));}if(_0x1f3b65[_0x7c2a('0x72')]()){var _0x5841f3=fs[_0x7c2a('0x6e')](path['join'](_0x37e3d9,_0x4f5d7c[0x0]));if(_0x5841f3['length']===0x0){removeReferences(_0x3db08e,_0x37e3d9);logger[_0x7c2a('0x31')](_0x7c2a('0x6f'));return _0x4b9d4b(new Error(_0x7c2a('0x6f')));}var _0x20a6bb=_0x5841f3[_0x7c2a('0x73')](function(_0x45d357){return _0x45d357===_0x7c2a('0x74');});if(!_0x20a6bb){return _0x4b9d4b(new Error(_0x7c2a('0x75')));}var _0x158260=fs['readFileSync'](path['join'](_0x37e3d9,_0x4f5d7c[0x0],_0x7c2a('0x74')));var _0x968341=JSON[_0x7c2a('0x76')](_0x158260);if('undefined'==typeof _0x968341[_0x7c2a('0x32')]){return _0x4b9d4b(new Error(_0x7c2a('0x77')));}if(_0x7c2a('0x23')==typeof _0x968341['type']){return _0x4b9d4b(new Error(_0x7c2a('0x78')));}if(_0x7c2a('0x23')==typeof _0x968341[_0x7c2a('0x79')]){return _0x4b9d4b(new Error(_0x7c2a('0x7a')));}if('undefined'==typeof _0x968341[_0x7c2a('0x7b')]){return _0x4b9d4b(new Error(_0x7c2a('0x7c')));}if(_0x968341['type']===_0x7c2a('0x7d')){if(_0x7c2a('0x23')==typeof _0x968341[_0x7c2a('0x7b')][_0x7c2a('0x7e')]){return _0x4b9d4b(new Error(_0x7c2a('0x7f')));}if(_0x7c2a('0x23')==typeof _0x968341[_0x7c2a('0x7b')][_0x7c2a('0x7e')][_0x7c2a('0x80')]&&_0x7c2a('0x23')==typeof _0x968341[_0x7c2a('0x7b')]['views']['agent']){return _0x4b9d4b(new Error(_0x7c2a('0x81')));}}else if(_0x968341['type']===_0x7c2a('0x82')){if(_0x7c2a('0x23')==typeof _0x968341['parameters'][_0x7c2a('0x83')]){return _0x4b9d4b(new Error(_0x7c2a('0x84')));}if(_0x7c2a('0x23')==typeof _0x968341[_0x7c2a('0x7b')][_0x7c2a('0x85')]){return _0x4b9d4b(new Error(_0x7c2a('0x86')));}}else{return _0x4b9d4b(new Error(_0x7c2a('0x87')));}var _0x2a8925=_0x968341[_0x7c2a('0x32')];var _0x16e077=_0x968341[_0x7c2a('0x88')];var _0x49955d=_0x968341[_0x7c2a('0x38')];var _0x23dba0=_0x968341['sidebar']?_0x968341[_0x7c2a('0x89')]:_0x7c2a('0x8a');var _0x327d84=_0x968341[_0x7c2a('0x8b')]?_0x968341[_0x7c2a('0x8b')]:_0x7c2a('0x8c');var _0x41c60a='';var _0xc2c705='';var _0x4745eb='';var _0x4734aa='';var _0x30c736=_0x968341[_0x7c2a('0x79')];if(_0x49955d===_0x7c2a('0x7d')){if(_0x7c2a('0x23')!=typeof _0x968341[_0x7c2a('0x7b')][_0x7c2a('0x7e')][_0x7c2a('0x80')]){var _0x110b8e=_0x968341['parameters']['views'][_0x7c2a('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x7c2a('0x8d')](_0x110b8e)){_0x41c60a=path[_0x7c2a('0x52')](_0x7c2a('0x8e'),_0x343c3f,_0x4f5d7c[0x0],_0x110b8e);}else{_0x41c60a=_0x110b8e;}}else{logger[_0x7c2a('0x66')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x7c2a('0x23')!=typeof _0x968341[_0x7c2a('0x7b')]['views'][_0x7c2a('0x8f')]){var _0xdec3f1=_0x968341[_0x7c2a('0x7b')][_0x7c2a('0x7e')][_0x7c2a('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x7c2a('0x8d')](_0xdec3f1)){_0xc2c705=path[_0x7c2a('0x52')]('plugins',_0x343c3f,_0x4f5d7c[0x0],_0xdec3f1);}else{_0xc2c705=_0xdec3f1;}}else{logger[_0x7c2a('0x66')](_0x7c2a('0x90'));}}else if(_0x49955d===_0x7c2a('0x82')){_0x4745eb=_0x968341[_0x7c2a('0x7b')]['scriptName'];_0x4734aa=_0x968341['parameters'][_0x7c2a('0x85')];if(_0x7c2a('0x23')!=typeof _0x968341[_0x7c2a('0x7b')][_0x7c2a('0x7e')]){if(_0x7c2a('0x23')!=typeof _0x968341['parameters']['views'][_0x7c2a('0x80')]){var _0x110b8e=_0x968341['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7c2a('0x8d')](_0x110b8e)){_0x41c60a=path[_0x7c2a('0x52')](_0x7c2a('0x8e'),_0x343c3f,_0x4f5d7c[0x0],_0x110b8e);}else{_0x41c60a=_0x110b8e;}}if(_0x7c2a('0x23')!=typeof _0x968341[_0x7c2a('0x7b')][_0x7c2a('0x7e')]['agent']){var _0xdec3f1=_0x968341[_0x7c2a('0x7b')][_0x7c2a('0x7e')][_0x7c2a('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x7c2a('0x8d')](_0xdec3f1)){_0xc2c705=path[_0x7c2a('0x52')](_0x7c2a('0x8e'),_0x343c3f,_0x4f5d7c[0x0],_0xdec3f1);}else{_0xc2c705=_0xdec3f1;}}}}var _0x253df7={'name':_0x2a8925,'description':_0x16e077,'path':path[_0x7c2a('0x52')](_0x343c3f,_0x4f5d7c[0x0]),'type':_0x49955d,'sidebar':_0x23dba0,'icon':_0x327d84,'adminUrl':_0x41c60a,'agentUrl':_0xc2c705,'scriptName':_0x4745eb,'scriptPath':_0x4734aa,'version':_0x30c736};removeReferences(_0x3db08e,null);return db['Plugin']['create'](_0x253df7)[_0x7c2a('0x2b')](function(_0x52c51b){var _0x34c6da={'role':_0x1dbd35['body'][_0x7c2a('0x91')],'userProfileId':_0x1dbd35[_0x7c2a('0x92')][_0x7c2a('0x93')]};if(!_0x34c6da)throw new Error(_0x7c2a('0x94'));if(_0x34c6da[_0x7c2a('0x91')]===_0x7c2a('0x95')){var _0x5b4009=_0x52c51b[_0x7c2a('0x2d')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Plugins','userProfileId':_0x34c6da['userProfileId']},'raw':!![]})['then'](function(_0x4c41c9){if(_0x4c41c9&&_0x4c41c9['autoAssociation']===0x0){return db[_0x7c2a('0x2f')]['create']({'name':_0x5b4009[_0x7c2a('0x32')],'resourceId':_0x5b4009['id'],'type':_0x4c41c9[_0x7c2a('0x32')],'sectionId':_0x4c41c9['id']},{})[_0x7c2a('0x2b')](function(){return _0x52c51b;});}else{return _0x52c51b;}})[_0x7c2a('0x4c')](function(_0x50b3dc){logger['error'](_0x7c2a('0x96'),_0x50b3dc);throw _0x50b3dc;});}return _0x52c51b;})['then'](respondWithResult(_0x121b1b,null))['catch'](handleError(_0x121b1b,null));}});}catch(_0x262c26){_0x121b1b[_0x7c2a('0x20')](0x1f4)['send'](_0x262c26);}};function removeReferences(_0x3e90de,_0x2dc4c3){try{if(_0x3e90de){fs[_0x7c2a('0x65')](_0x3e90de);logger['info'](_0x7c2a('0x97'));}if(_0x2dc4c3){rimraf(_0x2dc4c3,function(){});logger[_0x7c2a('0x66')](_0x7c2a('0x98'));}}catch(_0x83bcd0){logger['error'](_0x83bcd0);}}exports[_0x7c2a('0x2a')]=function(_0x2c5759,_0x546630,_0x5686c8){return db[_0x7c2a('0x35')][_0x7c2a('0x51')]({'where':{'id':_0x2c5759['params']['id']}})[_0x7c2a('0x2b')](handleEntityNotFound(_0x546630,null))[_0x7c2a('0x2b')](saveUpdates(_0x2c5759[_0x7c2a('0x92')],null))[_0x7c2a('0x2b')](respondWithResult(_0x546630,null))[_0x7c2a('0x4c')](handleError(_0x546630,null));};exports[_0x7c2a('0x99')]=function(_0x112b6d,_0x17cefd,_0x4db343){return db[_0x7c2a('0x35')][_0x7c2a('0x51')]({'where':{'id':_0x112b6d[_0x7c2a('0x4e')]['id']}})[_0x7c2a('0x2b')](function(_0x5d8d01){if(_0x5d8d01){return _0x5d8d01[_0x7c2a('0x2c')]();}})[_0x7c2a('0x2b')](function(_0x3bf242){rimraf(path['join'](config[_0x7c2a('0x5e')],_0x7c2a('0x53'),path[_0x7c2a('0x5f')](_0x3bf242['path'])),function(){});return _0x3bf242;})[_0x7c2a('0x2b')](handleEntityNotFound(_0x17cefd,null))[_0x7c2a('0x2b')](respondWithStatusCode(_0x17cefd,null))['catch'](handleError(_0x17cefd,null));};exports[_0x7c2a('0x9a')]=function(_0x2f6d09,_0x4400ee,_0x4682f7){return BPromise[_0x7c2a('0x9b')]()[_0x7c2a('0x2b')](function(){if(!_0x2f6d09[_0x7c2a('0x3c')][_0x7c2a('0x4')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2f6d09['query'][_0x7c2a('0x9c')]){throw new Error(_0x7c2a('0x9d'));}var _0x553f77=_0x2f6d09[_0x7c2a('0x3c')][_0x7c2a('0x9e')]?_0x2f6d09[_0x7c2a('0x3c')]['hostname']+':'+_0x2f6d09[_0x7c2a('0x3c')][_0x7c2a('0x9c')]:_0x7c2a('0x9f')+_0x2f6d09[_0x7c2a('0x3c')]['port'];var _0x4f3634=_0x2f6d09[_0x7c2a('0x3c')][_0x7c2a('0x21')]?_0x2f6d09['query'][_0x7c2a('0x21')]:!![];var _0x32d874=_0x2f6d09[_0x7c2a('0x3c')][_0x7c2a('0xa0')]?_0x2f6d09[_0x7c2a('0x3c')]['encoding']:null;var _0xc7d39e={'method':_0x2f6d09[_0x7c2a('0xa1')],'uri':util[_0x7c2a('0x54')](_0x7c2a('0xa2'),_0x553f77,_0x2f6d09['query'][_0x7c2a('0x4')]),'json':_0x4f3634,'resolveWithFullResponse':!![],'encoding':_0x32d874,'qs':_0x2f6d09['query']};if(_0x2f6d09[_0x7c2a('0xa3')]){_0xc7d39e[_0x7c2a('0xa3')]=_0x2f6d09['headers'];if(_0xc7d39e['headers'][_0x7c2a('0xa4')]){delete _0xc7d39e['headers']['content-length'];}}if(_0xc7d39e[_0x7c2a('0xa3')][_0x7c2a('0xa5')]){delete _0xc7d39e[_0x7c2a('0xa3')]['content-type'];}return rp(_0xc7d39e);})[_0x7c2a('0x2b')](function(_0xc3a480){if(_0xc3a480){_0x4400ee[_0x7c2a('0x26')](_0xc3a480[_0x7c2a('0xa3')]);logger['info'](_0xc3a480[_0x7c2a('0x92')]);if(_[_0x7c2a('0xa6')](_0x2f6d09[_0x7c2a('0x3c')]['path'],_0x7c2a('0xa7'))&&_0xc3a480[_0x7c2a('0xa8')]==0x1f4){return _0x4400ee['sendStatus'](_0xc3a480['statusCode']);}else{return _0x4400ee[_0x7c2a('0x20')](_0xc3a480[_0x7c2a('0xa8')])[_0x7c2a('0x33')](_0xc3a480[_0x7c2a('0x92')]);}}else{return _0x4400ee[_0x7c2a('0x1f')](0xc8);}})[_0x7c2a('0x4c')](handleError(_0x4400ee,null));};exports['webhookPost']=function(_0x77f29e,_0x2a5649,_0x2fdd2c){return BPromise[_0x7c2a('0x9b')]()[_0x7c2a('0x2b')](function(){if(!_0x77f29e[_0x7c2a('0x3c')][_0x7c2a('0x4')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x77f29e[_0x7c2a('0x3c')][_0x7c2a('0x9c')]){throw new Error(_0x7c2a('0x9d'));}var _0x3db841=_0x77f29e[_0x7c2a('0x3c')][_0x7c2a('0x9e')]?_0x77f29e[_0x7c2a('0x3c')][_0x7c2a('0x9e')]+':'+_0x77f29e['query']['port']:_0x7c2a('0x9f')+_0x77f29e['query']['port'];var _0x37ebaa=_0x77f29e['query'][_0x7c2a('0x21')]?_0x77f29e[_0x7c2a('0x3c')][_0x7c2a('0x21')]:!![];var _0x5d4f22=_0x77f29e[_0x7c2a('0x3c')]['encoding']?_0x77f29e['query'][_0x7c2a('0xa0')]:null;var _0x1179ba={'method':_0x77f29e[_0x7c2a('0xa1')],'uri':util[_0x7c2a('0x54')](_0x7c2a('0xa2'),_0x3db841,_0x77f29e[_0x7c2a('0x3c')][_0x7c2a('0x4')]),'json':_0x37ebaa,'resolveWithFullResponse':!![],'encoding':_0x5d4f22,'body':_0x77f29e[_0x7c2a('0x92')]};if(_0x77f29e['headers']){_0x1179ba[_0x7c2a('0xa3')]=_0x77f29e['headers'];if(_0x1179ba[_0x7c2a('0xa3')][_0x7c2a('0xa4')]){delete _0x1179ba['headers']['content-length'];}}if(_0x1179ba[_0x7c2a('0xa3')]['content-type']){delete _0x1179ba[_0x7c2a('0xa3')][_0x7c2a('0xa5')];}return rp(_0x1179ba);})['then'](function(_0x36e7f3){if(_0x36e7f3){_0x2a5649[_0x7c2a('0x26')](_0x36e7f3['headers']);logger[_0x7c2a('0x66')](_0x36e7f3['body']);return _0x2a5649[_0x7c2a('0x20')](_0x36e7f3[_0x7c2a('0xa8')])[_0x7c2a('0x33')](_0x36e7f3[_0x7c2a('0x92')]);}else{return _0x2a5649[_0x7c2a('0x1f')](0xc8);}})[_0x7c2a('0x4c')](handleError(_0x2a5649,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 22add99..60aa587 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 _0xf88f=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xf88f,0x1bb));var _0xff88=function(_0x587723,_0x32cd9d){_0x587723=_0x587723-0x0;var _0x2e9fa2=_0xf88f[_0x587723];return _0x2e9fa2;};'use strict';var EventEmitter=require(_0xff88('0x0'));var Plugin=require(_0xff88('0x1'))['db'][_0xff88('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xff88('0x3')](0x0);var events={'afterCreate':_0xff88('0x4'),'afterUpdate':_0xff88('0x5'),'afterDestroy':_0xff88('0x6')};function emitEvent(_0x47b3fe){return function(_0x1bcee9,_0x33aa75,_0x3bb862){PluginEvents['emit'](_0x47b3fe+':'+_0x1bcee9['id'],_0x1bcee9);PluginEvents[_0xff88('0x7')](_0x47b3fe,_0x1bcee9);_0x3bb862(null);};}for(var e in events){if(events[_0xff88('0x8')](e)){var event=events[e];Plugin[_0xff88('0x9')](e,emitEvent(event));}}module[_0xff88('0xa')]=PluginEvents; \ No newline at end of file +var _0xea1c=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','Plugin'];(function(_0x124f98,_0x190083){var _0x67d3dc=function(_0x5e1f09){while(--_0x5e1f09){_0x124f98['push'](_0x124f98['shift']());}};_0x67d3dc(++_0x190083);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0xcea1('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0xcea1('0x1')](0x0);var events={'afterCreate':_0xcea1('0x2'),'afterUpdate':_0xcea1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1930dd){return function(_0x377ab8,_0xb835ce,_0xaad3f2){PluginEvents[_0xcea1('0x4')](_0x1930dd+':'+_0x377ab8['id'],_0x377ab8);PluginEvents[_0xcea1('0x4')](_0x1930dd,_0x377ab8);_0xaad3f2(null);};}for(var e in events){if(events[_0xcea1('0x5')](e)){var event=events[e];Plugin[_0xcea1('0x6')](e,emitEvent(event));}}module[_0xcea1('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 9e23004..90a8ff4 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 _0xe8a1=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','Plugin','util'];(function(_0x5c5774,_0x2a4eee){var _0x403787=function(_0x4d7b54){while(--_0x4d7b54){_0x5c5774['push'](_0x5c5774['shift']());}};_0x403787(++_0x2a4eee);}(_0xe8a1,0x1f3));var _0x1e8a=function(_0x2c4b17,_0x4fc4b4){_0x2c4b17=_0x2c4b17-0x0;var _0x4d7604=_0xe8a1[_0x2c4b17];return _0x4d7604;};'use strict';var _=require('lodash');var util=require(_0x1e8a('0x0'));var logger=require(_0x1e8a('0x1'))(_0x1e8a('0x2'));var moment=require(_0x1e8a('0x3'));var BPromise=require(_0x1e8a('0x4'));var rp=require(_0x1e8a('0x5'));var fs=require('fs');var path=require(_0x1e8a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x1e8a('0x7')]=function(_0x3728e7,_0x30b19c){return _0x3728e7[_0x1e8a('0x8')](_0x1e8a('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc59=['Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','define'];(function(_0x3e770d,_0x488c0a){var _0x113bf1=function(_0x1f2e79){while(--_0x1f2e79){_0x3e770d['push'](_0x3e770d['shift']());}};_0x113bf1(++_0x488c0a);}(_0xdc59,0x1a2));var _0x9dc5=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0xdc59[_0x65c50e];return _0x4573e7;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var logger=require(_0x9dc5('0x2'))(_0x9dc5('0x3'));var moment=require(_0x9dc5('0x4'));var BPromise=require(_0x9dc5('0x5'));var rp=require(_0x9dc5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var attributes=require(_0x9dc5('0x9'));module['exports']=function(_0x49f597,_0x35a674){return _0x49f597[_0x9dc5('0xa')](_0x9dc5('0xb'),attributes,{'tableName':_0x9dc5('0xc'),'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 7fdc0bd..70c6f82 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 _0x7426=['then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./plugin.socket','register'];(function(_0x22d124,_0x1dc960){var _0x379806=function(_0x3175e9){while(--_0x3175e9){_0x22d124['push'](_0x22d124['shift']());}};_0x379806(++_0x1dc960);}(_0x7426,0x1df));var _0x6742=function(_0x37e793,_0x4f240f){_0x37e793=_0x37e793-0x0;var _0x2fdc97=_0x7426[_0x37e793];return _0x2fdc97;};'use strict';var _=require('lodash');var util=require(_0x6742('0x0'));var moment=require(_0x6742('0x1'));var BPromise=require(_0x6742('0x2'));var rs=require(_0x6742('0x3'));var fs=require('fs');var Redis=require(_0x6742('0x4'));var db=require(_0x6742('0x5'))['db'];var utils=require(_0x6742('0x6'));var logger=require(_0x6742('0x7'))(_0x6742('0x8'));var config=require('../../config/environment');var jayson=require(_0x6742('0x9'));var client=jayson['client'][_0x6742('0xa')]({'port':0x232a});config[_0x6742('0xb')]=_[_0x6742('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6742('0xd'))(new Redis(config[_0x6742('0xb')]));require(_0x6742('0xe'))[_0x6742('0xf')](socket);function respondWithRpcPromise(_0x146bf4,_0x131049,_0x487ef0){return new BPromise(function(_0x38bcd7,_0x4493bd){return client['request'](_0x146bf4,_0x487ef0)[_0x6742('0x10')](function(_0x29a65d){logger[_0x6742('0x11')](_0x6742('0x12'),_0x131049,_0x6742('0x13'));logger[_0x6742('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x131049,'request\x20sent',JSON[_0x6742('0x15')](_0x29a65d));if(_0x29a65d[_0x6742('0x16')]){if(_0x29a65d['error'][_0x6742('0x17')]===0x1f4){logger[_0x6742('0x16')](_0x6742('0x12'),_0x131049,_0x29a65d[_0x6742('0x16')][_0x6742('0x18')]);return _0x4493bd(_0x29a65d[_0x6742('0x16')]['message']);}logger[_0x6742('0x16')](_0x6742('0x12'),_0x131049,_0x29a65d[_0x6742('0x16')]['message']);return _0x38bcd7(_0x29a65d[_0x6742('0x16')][_0x6742('0x18')]);}else{logger[_0x6742('0x11')]('Plugin,\x20%s,\x20%s',_0x131049,'request\x20sent');_0x38bcd7(_0x29a65d[_0x6742('0x19')][_0x6742('0x18')]);}})[_0x6742('0x1a')](function(_0x162f57){logger[_0x6742('0x16')](_0x6742('0x12'),_0x131049,_0x162f57);_0x4493bd(_0x162f57);});});}exports[_0x6742('0x1b')]=function(_0x210a74){var _0x2e701a=this;return new Promise(function(_0x3e6265,_0x3b3547){return db[_0x6742('0x1c')][_0x6742('0x1d')](_0x210a74[_0x6742('0x1e')],{'raw':_0x210a74[_0x6742('0x1f')]?_0x210a74[_0x6742('0x1f')][_0x6742('0x20')]===undefined?!![]:![]:!![]})[_0x6742('0x10')](function(_0x3b6a44){logger[_0x6742('0x11')](_0x6742('0x1b'),_0x210a74);logger['debug']('CreatePlugin',_0x210a74,JSON[_0x6742('0x15')](_0x3b6a44));_0x3e6265(_0x3b6a44);})[_0x6742('0x1a')](function(_0x164389){logger[_0x6742('0x16')](_0x6742('0x1b'),_0x164389[_0x6742('0x18')],_0x210a74);_0x3b3547(_0x2e701a[_0x6742('0x16')](0x1f4,_0x164389[_0x6742('0x18')]));});});}; \ No newline at end of file +var _0xdaf9=['client','redis','defaults','localhost','socket.io-emitter','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreatePlugin','create','body','options','raw','stringify','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4b45cc,_0x56c1bd){var _0x95df44=function(_0x4f4d11){while(--_0x4f4d11){_0x4b45cc['push'](_0x4b45cc['shift']());}};_0x95df44(++_0x56c1bd);}(_0xdaf9,0xac));var _0x9daf=function(_0x1632e9,_0x20bb13){_0x1632e9=_0x1632e9-0x0;var _0x3814d3=_0xdaf9[_0x1632e9];return _0x3814d3;};'use strict';var _=require(_0x9daf('0x0'));var util=require(_0x9daf('0x1'));var moment=require(_0x9daf('0x2'));var BPromise=require('bluebird');var rs=require(_0x9daf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9daf('0x4'));var logger=require(_0x9daf('0x5'))('rpc');var config=require(_0x9daf('0x6'));var jayson=require(_0x9daf('0x7'));var client=jayson[_0x9daf('0x8')]['http']({'port':0x232a});config[_0x9daf('0x9')]=_[_0x9daf('0xa')](config[_0x9daf('0x9')],{'host':_0x9daf('0xb'),'port':0x18eb});var socket=require(_0x9daf('0xc'))(new Redis(config[_0x9daf('0x9')]));require('./plugin.socket')[_0x9daf('0xd')](socket);function respondWithRpcPromise(_0x687319,_0x50300d,_0x1fc7ed){return new BPromise(function(_0x1ef74e,_0x8c9973){return client['request'](_0x687319,_0x1fc7ed)[_0x9daf('0xe')](function(_0x58553d){logger[_0x9daf('0xf')](_0x9daf('0x10'),_0x50300d,_0x9daf('0x11'));logger[_0x9daf('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x50300d,_0x9daf('0x11'),JSON['stringify'](_0x58553d));if(_0x58553d[_0x9daf('0x13')]){if(_0x58553d['error'][_0x9daf('0x14')]===0x1f4){logger[_0x9daf('0x13')](_0x9daf('0x10'),_0x50300d,_0x58553d[_0x9daf('0x13')]['message']);return _0x8c9973(_0x58553d[_0x9daf('0x13')][_0x9daf('0x15')]);}logger[_0x9daf('0x13')]('Plugin,\x20%s,\x20%s',_0x50300d,_0x58553d[_0x9daf('0x13')]['message']);return _0x1ef74e(_0x58553d[_0x9daf('0x13')][_0x9daf('0x15')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x50300d,'request\x20sent');_0x1ef74e(_0x58553d[_0x9daf('0x16')]['message']);}})[_0x9daf('0x17')](function(_0x4cf3b6){logger[_0x9daf('0x13')](_0x9daf('0x10'),_0x50300d,_0x4cf3b6);_0x8c9973(_0x4cf3b6);});});}exports[_0x9daf('0x18')]=function(_0x563d13){var _0x312db3=this;return new Promise(function(_0x198186,_0x1906e5){return db['Plugin'][_0x9daf('0x19')](_0x563d13[_0x9daf('0x1a')],{'raw':_0x563d13[_0x9daf('0x1b')]?_0x563d13[_0x9daf('0x1b')][_0x9daf('0x1c')]===undefined?!![]:![]:!![]})[_0x9daf('0xe')](function(_0x2ab947){logger[_0x9daf('0xf')](_0x9daf('0x18'),_0x563d13);logger[_0x9daf('0x12')](_0x9daf('0x18'),_0x563d13,JSON[_0x9daf('0x1d')](_0x2ab947));_0x198186(_0x2ab947);})[_0x9daf('0x17')](function(_0xefe25){logger[_0x9daf('0x13')](_0x9daf('0x18'),_0xefe25[_0x9daf('0x15')],_0x563d13);_0x1906e5(_0x312db3[_0x9daf('0x13')](0x1f4,_0xefe25[_0x9daf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4d105ed..71ea315 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 _0xd6d5=['update','removeListener','length','plugin:','save','remove'];(function(_0x3fb256,_0xa066af){var _0x1ca90f=function(_0x3d717a){while(--_0x3d717a){_0x3fb256['push'](_0x3fb256['shift']());}};_0x1ca90f(++_0xa066af);}(_0xd6d5,0x88));var _0x5d6d=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0xd6d5[_0x3c04ef];return _0x6a3a69;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x5d6d('0x0'),_0x5d6d('0x1'),_0x5d6d('0x2')];function createListener(_0x37fc13,_0x11100a){return function(_0x3617e4){_0x11100a['emit'](_0x37fc13,_0x3617e4);};}function removeListener(_0x10c162,_0x27fea2){return function(){PluginEvents[_0x5d6d('0x3')](_0x10c162,_0x27fea2);};}exports['register']=function(_0x354e26){for(var _0x4bcea9=0x0,_0x52f73e=events[_0x5d6d('0x4')];_0x4bcea9<_0x52f73e;_0x4bcea9++){var _0x4f97b0=events[_0x4bcea9];var _0x38824f=createListener(_0x5d6d('0x5')+_0x4f97b0,_0x354e26);PluginEvents['on'](_0x4f97b0,_0x38824f);}}; \ No newline at end of file +var _0x2097=['plugin:','./plugin.events','save','emit','removeListener','length'];(function(_0x1b117f,_0x590e1d){var _0x30b49a=function(_0x555344){while(--_0x555344){_0x1b117f['push'](_0x1b117f['shift']());}};_0x30b49a(++_0x590e1d);}(_0x2097,0x1db));var _0x7209=function(_0x3b54c8,_0x2d1a02){_0x3b54c8=_0x3b54c8-0x0;var _0x5df526=_0x2097[_0x3b54c8];return _0x5df526;};'use strict';var PluginEvents=require(_0x7209('0x0'));var events=[_0x7209('0x1'),'remove','update'];function createListener(_0x155533,_0x156f35){return function(_0x58bca4){_0x156f35[_0x7209('0x2')](_0x155533,_0x58bca4);};}function removeListener(_0x4e3c8c,_0x17b205){return function(){PluginEvents[_0x7209('0x3')](_0x4e3c8c,_0x17b205);};}exports['register']=function(_0x10e143){for(var _0x2f4a3f=0x0,_0x39198d=events[_0x7209('0x4')];_0x2f4a3f<_0x39198d;_0x2f4a3f++){var _0x53b98a=events[_0x2f4a3f];var _0x960bd9=createListener(_0x7209('0x5')+_0x53b98a,_0x10e143);PluginEvents['on'](_0x53b98a,_0x960bd9);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b47d430..1f350c8 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(_0x3f7b2e,_0x4ca408){var _0x53fc81=function(_0x7c1482){while(--_0x7c1482){_0x3f7b2e['push'](_0x3f7b2e['shift']());}};_0x53fc81(++_0x4ca408);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x146aeb,_0x2f1a71){var _0x56779a=function(_0x5a67b8){while(--_0x5a67b8){_0x146aeb['push'](_0x146aeb['shift']());}};_0x56779a(++_0x2f1a71);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 7d71e73..ab10aeb 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 _0x222f=['dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','json','error','stack','name','status','npm\x20install','info','index','list','reject','express','motion2','length','then','catch','describe','params','body','join','../../files/plugins','script','chdir','dirname','start'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x222f,0x1a4));var _0xf222=function(_0x180c9b,_0x13d173){_0x180c9b=_0x180c9b-0x0;var _0x3ff116=_0x222f[_0x180c9b];return _0x3ff116;};'use strict';var _=require(_0xf222('0x0'));var pm2=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var path=require('path');var exec=require('child_process')[_0xf222('0x4')];var BPromise=require(_0xf222('0x5'));function handleEntityNotFound(_0x307791,_0x7b187d){return function(_0x59a619){if(!_0x59a619){_0x307791[_0xf222('0x6')](0x194);;}return _0x59a619;};}function respondWithResult(_0x54a758,_0x112e6d){_0x112e6d=_0x112e6d||0xc8;return function(_0x26f129){if(_0x26f129){return _0x54a758['status'](_0x112e6d)[_0xf222('0x7')](_0x26f129);}return null;};}function handleError(_0x302d7a,_0x4aceb4){_0x4aceb4=_0x4aceb4||0x1f4;return function(_0x31c027){logger[_0xf222('0x8')](_0x31c027[_0xf222('0x9')]);if(_0x31c027[_0xf222('0xa')]){delete _0x31c027[_0xf222('0xa')];}_0x302d7a[_0xf222('0xb')](_0x4aceb4)['send'](_0x31c027);};}function execChildProcess(){return new BPromise(function(_0x2e29ad,_0x405080){exec(_0xf222('0xc'),function(_0x182bc3,_0x48f740,_0x3c9b96){logger[_0xf222('0xd')](_0x48f740);logger[_0xf222('0xd')](_0x3c9b96);if(_0x182bc3){logger[_0xf222('0x8')](_0x182bc3);return _0x405080(_0x182bc3);}return _0x2e29ad(_0x48f740);});});}exports[_0xf222('0xe')]=function(_0x334017,_0x11fca0){return pm2[_0xf222('0xf')]()['then'](function(_0x5b8f97){if(_0x5b8f97){var _0x1feb86=_[_0xf222('0x10')](_0x5b8f97,function(_0x4c2314){return _0x4c2314[_0xf222('0xa')]===_0xf222('0x11')||_0x4c2314[_0xf222('0xa')]===_0xf222('0x12');});return{'rows':_0x1feb86,'count':_0x1feb86[_0xf222('0x13')]};}return null;})[_0xf222('0x14')](respondWithResult(_0x11fca0,null))[_0xf222('0x15')](handleError(_0x11fca0,null));};exports['show']=function(_0x1efa9f,_0x823314){return pm2[_0xf222('0x16')](_0x1efa9f[_0xf222('0x17')]['id'])[_0xf222('0x14')](respondWithResult(_0x823314,null))[_0xf222('0x14')](handleEntityNotFound(_0x823314,null))[_0xf222('0x15')](handleError(_0x823314,null));};exports['create']=function(_0xf26a16,_0x1bdd0a){if(_0xf26a16[_0xf222('0x18')][_0xf222('0xa')]&&_0xf26a16['body']['script']){var _0x398ff4=path[_0xf222('0x19')](__dirname,_0xf222('0x1a'),_0xf26a16[_0xf222('0x18')][_0xf222('0x1b')]);var _0x151a89=process['cwd']();process[_0xf222('0x1c')](path[_0xf222('0x1d')](_0x398ff4));return execChildProcess()[_0xf222('0x14')](function(_0x12d443){process[_0xf222('0x1c')](_0x151a89);return pm2[_0xf222('0x1e')]({'name':_0xf26a16[_0xf222('0x18')][_0xf222('0xa')],'script':_0x398ff4});})['then'](function(_0x145e2e){pm2[_0xf222('0x1f')]();return _0x145e2e[0x0];})[_0xf222('0x14')](respondWithResult(_0x1bdd0a,0xc9))[_0xf222('0x15')](handleError(_0x1bdd0a,null));}else{return _0x1bdd0a[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':_0xf222('0x21')});}};exports[_0xf222('0x22')]=function(_0x15bf4e,_0x2ec2e9){if(_0x15bf4e[_0xf222('0x18')]['id']){delete _0x15bf4e['body']['id'];}var _0x14b2b1={'online':_0xf222('0x23'),'stopped':_0xf222('0x24')};if(_0x14b2b1[_0xf222('0x25')](_0x15bf4e[_0xf222('0x18')][_0xf222('0xb')])){return pm2[_0x14b2b1[_0x15bf4e[_0xf222('0x18')][_0xf222('0xb')]]](_0x15bf4e[_0xf222('0x17')]['id'])['then'](respondWithResult(_0x2ec2e9,0xc8))[_0xf222('0x15')](handleError(_0x2ec2e9,null));}else{return _0x2ec2e9[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':'Unknown\x20status'});}};exports[_0xf222('0x26')]=function(_0x5d5963,_0x40c7e7){if(_0x5d5963[_0xf222('0x18')]['id']){delete _0x5d5963[_0xf222('0x18')]['id'];}if(_0x5d5963[_0xf222('0x17')]['id']){return pm2[_0xf222('0x27')](_0x5d5963[_0xf222('0x17')]['id'])[_0xf222('0x14')](function(_0x5075ad){pm2['dump']();return _0x5075ad[0x0];})[_0xf222('0x14')](respondWithResult(_0x40c7e7,null))[_0xf222('0x15')](handleError(_0x40c7e7,null));}else{return _0x40c7e7[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':_0xf222('0x28')});}}; \ No newline at end of file +var _0x5ff3=['Unknown\x20id','../../config/pm2','api','child_process','exec','bluebird','sendStatus','json','error','name','status','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','delete'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5ff3,0x17d));var _0x35ff=function(_0x1aefc8,_0x473497){_0x1aefc8=_0x1aefc8-0x0;var _0x15a37e=_0x5ff3[_0x1aefc8];return _0x15a37e;};'use strict';var _=require('lodash');var pm2=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var path=require('path');var exec=require(_0x35ff('0x2'))[_0x35ff('0x3')];var BPromise=require(_0x35ff('0x4'));function handleEntityNotFound(_0xd0846d,_0x551514){return function(_0x2fcb74){if(!_0x2fcb74){_0xd0846d[_0x35ff('0x5')](0x194);;}return _0x2fcb74;};}function respondWithResult(_0x2e9873,_0x11e738){_0x11e738=_0x11e738||0xc8;return function(_0x30c3ff){if(_0x30c3ff){return _0x2e9873['status'](_0x11e738)[_0x35ff('0x6')](_0x30c3ff);}return null;};}function handleError(_0x4c9fab,_0x2e7470){_0x2e7470=_0x2e7470||0x1f4;return function(_0xfcec34){logger[_0x35ff('0x7')](_0xfcec34['stack']);if(_0xfcec34[_0x35ff('0x8')]){delete _0xfcec34['name'];}_0x4c9fab[_0x35ff('0x9')](_0x2e7470)[_0x35ff('0xa')](_0xfcec34);};}function execChildProcess(){return new BPromise(function(_0x57ad20,_0x5c3131){exec(_0x35ff('0xb'),function(_0x574c81,_0x592295,_0x567080){logger[_0x35ff('0xc')](_0x592295);logger[_0x35ff('0xc')](_0x567080);if(_0x574c81){logger[_0x35ff('0x7')](_0x574c81);return _0x5c3131(_0x574c81);}return _0x57ad20(_0x592295);});});}exports[_0x35ff('0xd')]=function(_0x559e33,_0x33154f){return pm2[_0x35ff('0xe')]()[_0x35ff('0xf')](function(_0x4d1d41){if(_0x4d1d41){var _0xff8ac=_[_0x35ff('0x10')](_0x4d1d41,function(_0x254975){return _0x254975[_0x35ff('0x8')]===_0x35ff('0x11')||_0x254975[_0x35ff('0x8')]===_0x35ff('0x12');});return{'rows':_0xff8ac,'count':_0xff8ac[_0x35ff('0x13')]};}return null;})[_0x35ff('0xf')](respondWithResult(_0x33154f,null))[_0x35ff('0x14')](handleError(_0x33154f,null));};exports[_0x35ff('0x15')]=function(_0x3430e2,_0x37ea06){return pm2[_0x35ff('0x16')](_0x3430e2[_0x35ff('0x17')]['id'])['then'](respondWithResult(_0x37ea06,null))[_0x35ff('0xf')](handleEntityNotFound(_0x37ea06,null))[_0x35ff('0x14')](handleError(_0x37ea06,null));};exports[_0x35ff('0x18')]=function(_0x1c0d8c,_0x567bcb){if(_0x1c0d8c['body'][_0x35ff('0x8')]&&_0x1c0d8c[_0x35ff('0x19')]['script']){var _0x238f65=path[_0x35ff('0x1a')](__dirname,_0x35ff('0x1b'),_0x1c0d8c[_0x35ff('0x19')]['script']);var _0x3d60b4=process['cwd']();process[_0x35ff('0x1c')](path[_0x35ff('0x1d')](_0x238f65));return execChildProcess()[_0x35ff('0xf')](function(_0x16a5a0){process[_0x35ff('0x1c')](_0x3d60b4);return pm2[_0x35ff('0x1e')]({'name':_0x1c0d8c[_0x35ff('0x19')]['name'],'script':_0x238f65});})[_0x35ff('0xf')](function(_0x2ffcb){pm2['dump']();return _0x2ffcb[0x0];})[_0x35ff('0xf')](respondWithResult(_0x567bcb,0xc9))['catch'](handleError(_0x567bcb,null));}else{return _0x567bcb['status'](0x1f4)[_0x35ff('0xa')]({'message':_0x35ff('0x1f')});}};exports[_0x35ff('0x20')]=function(_0x11a5eb,_0x302d5a){if(_0x11a5eb['body']['id']){delete _0x11a5eb[_0x35ff('0x19')]['id'];}var _0x412873={'online':_0x35ff('0x21'),'stopped':'stop'};if(_0x412873[_0x35ff('0x22')](_0x11a5eb[_0x35ff('0x19')][_0x35ff('0x9')])){return pm2[_0x412873[_0x11a5eb[_0x35ff('0x19')][_0x35ff('0x9')]]](_0x11a5eb[_0x35ff('0x17')]['id'])[_0x35ff('0xf')](respondWithResult(_0x302d5a,0xc8))[_0x35ff('0x14')](handleError(_0x302d5a,null));}else{return _0x302d5a[_0x35ff('0x9')](0x1f4)['send']({'message':_0x35ff('0x23')});}};exports['destroy']=function(_0x1cb370,_0x257501){if(_0x1cb370[_0x35ff('0x19')]['id']){delete _0x1cb370[_0x35ff('0x19')]['id'];}if(_0x1cb370['params']['id']){return pm2[_0x35ff('0x24')](_0x1cb370['params']['id'])[_0x35ff('0xf')](function(_0xf88865){pm2['dump']();return _0xf88865[0x0];})['then'](respondWithResult(_0x257501,null))[_0x35ff('0x14')](handleError(_0x257501,null));}else{return _0x257501[_0x35ff('0x9')](0x1f4)['send']({'message':_0x35ff('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 791fab8..582c70b 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 _0xdba1=['./realtime.controller','get','/agents','getAgents','/queues','isAuthenticated','express','Router','../../components/auth/service'];(function(_0x51b80a,_0x355fe3){var _0x22fdf0=function(_0x152b3e){while(--_0x152b3e){_0x51b80a['push'](_0x51b80a['shift']());}};_0x22fdf0(++_0x355fe3);}(_0xdba1,0x1bf));var _0x1dba=function(_0x177b60,_0x3b7e0c){_0x177b60=_0x177b60-0x0;var _0x2f0976=_0xdba1[_0x177b60];return _0x2f0976;};'use strict';var express=require(_0x1dba('0x0'));var router=express[_0x1dba('0x1')]();var auth=require(_0x1dba('0x2'));var controller=require(_0x1dba('0x3'));router[_0x1dba('0x4')](_0x1dba('0x5'),auth['isAuthenticated'](),controller[_0x1dba('0x6')]);router[_0x1dba('0x4')](_0x1dba('0x7'),auth[_0x1dba('0x8')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0xa0ce=['Router','../../components/auth/service','./realtime.controller','get','getAgents','isAuthenticated','getQueues','exports','express'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xa0ce,0x15e));var _0xea0c=function(_0x2e2109,_0x2151cb){_0x2e2109=_0x2e2109-0x0;var _0x3a13f5=_0xa0ce[_0x2e2109];return _0x3a13f5;};'use strict';var express=require(_0xea0c('0x0'));var router=express[_0xea0c('0x1')]();var auth=require(_0xea0c('0x2'));var controller=require(_0xea0c('0x3'));router[_0xea0c('0x4')]('/agents',auth['isAuthenticated'](),controller[_0xea0c('0x5')]);router['get']('/queues',auth[_0xea0c('0x6')](),controller[_0xea0c('0x7')]);module[_0xea0c('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 0b5ff33..3fcfa1b 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 _0x95f1=['query','globalStatusFilter','pauseTypeFilter','pause','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','fields','order','getAgentIdsByQueues','then','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','role','getOptions','raw','literal','FIELD(id,','forEach','*pause','push','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','voice','voiceStatus','talking','sortAgentsByStatus','pick','catch','startCase','type','key','name','dialActive','join','outbound','QueueCampaigns','Queues','filter','UserProfile','getResources','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','getAgents','getChannels','globalQueueFilter'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x95f1,0x1e2));var _0x195f=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x95f1[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x195f('0x0'));var util=require('util');var rta=require('../../components/realtime/agents');var rtq=require(_0x195f('0x1'));var qs=require(_0x195f('0x2'));var utils=require(_0x195f('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x195f('0x4'))[_0x195f('0x5')];var APIHandleError=require(_0x195f('0x4'))[_0x195f('0x6')];function respondWithFilteredResult(_0x7d4996,_0xbf26e1){return function(_0x9965cc){if(_0x9965cc){var _0x5b7204=typeof _0xbf26e1[_0x195f('0x7')]===_0x195f('0x8')&&typeof _0xbf26e1[_0x195f('0x9')]===_0x195f('0x8');var _0x313fae=_0x9965cc[_0x195f('0xa')];var _0x431dbe=_0x5b7204?0x0:_0xbf26e1[_0x195f('0x7')];var _0x144143=_0x5b7204?_0x9965cc[_0x195f('0xa')]:_0xbf26e1['offset']+_0xbf26e1[_0x195f('0x9')];var _0x399fda;if(_0x144143>=_0x313fae){_0x144143=_0x313fae;_0x399fda=0xc8;}else{_0x399fda=0xce;}_0x7d4996[_0x195f('0xb')](_0x399fda);return _0x7d4996[_0x195f('0xc')]('Content-Range',_0x431dbe+'-'+_0x144143+'/'+_0x313fae)['json'](_0x9965cc);}return null;};}exports[_0x195f('0xd')]=function(_0x5da309,_0x3ed633){var _0x870e1f={'count':0x0,'rows':[]};var _0x271726={};var _0x50b5fe;var _0x1e467b=utils[_0x195f('0xe')]();var _0x2bd6ef;var _0x1c41a2;var _0x4b25ee=_0x5da309['query'][_0x195f('0xf')];var _0x39070f=_0x5da309[_0x195f('0x10')][_0x195f('0x11')];var _0x2feaf5=_0x5da309['query'][_0x195f('0x12')];var _0x5fca8e=_0x39070f===_0x195f('0x13')||_0x39070f==='*pause'?!![]:![];var _0x12818f=[];var _0x19fbd3;var _0x49797b;Promise[_0x195f('0x14')]()['then'](function(){if(_0x5da309[_0x195f('0x10')][_0x195f('0x15')]){if(!utils[_0x195f('0x16')](_0x5da309[_0x195f('0x10')][_0x195f('0x15')])){throw new APIBadRequestError(util[_0x195f('0x17')](_0x195f('0x18'),_0x5da309[_0x195f('0x10')][_0x195f('0x15')]));}_0x50b5fe=_0x5da309[_0x195f('0x10')][_0x195f('0x15')][_0x195f('0x19')]();}if(!_0x5da309[_0x195f('0x10')]['sort']||!_0x5da309[_0x195f('0x10')][_0x195f('0x1a')]['includes'](_0x195f('0x1b'))){_0x5da309['query']['sort']=rta[_0x195f('0x1c')](_0x5da309['query'][_0x195f('0x1a')]);return;}var _0x53a9de=rta['getUpdatedSortOptions'](_0x5da309[_0x195f('0x10')][_0x195f('0x1a')]);_0x5da309['query']['sort']=_0x53a9de[_0x195f('0x1d')]['join'](',');_0x19fbd3=_0x53a9de[_0x195f('0x1e')];})['then'](function(){if(!_0x4b25ee){return[];}return rta[_0x195f('0x1f')](_0x4b25ee,_0x50b5fe);})[_0x195f('0x20')](function(_0x44bf10){_0x12818f=_0x44bf10;return rta[_0x195f('0x21')]();})['then'](function(_0xca8e3){_0x1c41a2=_0xca8e3['rows'];if((!_0x39070f||_0x5fca8e)&&!_0x19fbd3){return _0x12818f;}if(_0x19fbd3&&!_0x39070f){return rta[_0x195f('0x22')](_0x1c41a2,_0x12818f,_0x19fbd3);}else{return rta[_0x195f('0x23')](_0x1c41a2,_0x12818f,_0x39070f);}})[_0x195f('0x20')](function(_0x244048){_0x12818f=_0x244048;var _0x1b10bf=![];if(_0x12818f[_0x195f('0x24')]===0x0){if(_0x4b25ee||_0x39070f){_0x1b10bf=!![];}if(_0x5fca8e){_0x1b10bf=![];}}if(_0x1b10bf){return _0x870e1f;}var _0xf4c160=_[_0x195f('0x25')](db[_0x195f('0x26')][_0x195f('0x27')],function(_0x4c0144){return{'name':_0x4c0144[_0x195f('0x28')],'type':_0x4c0144['type']['key']};});_0x5da309[_0x195f('0x10')][_0x195f('0x29')]='agent';_0x271726=qs[_0x195f('0x2a')](_0xf4c160,_0x5da309);_0x271726[_0x195f('0x2b')]=!![];var _0x195b09=[];if(_0x12818f[_0x195f('0x24')]>0x0){_0x195b09['push']({'id':{'$in':_0x12818f}});if(_0x19fbd3&&!_0x39070f){_0x49797b=[db['sequelize'][_0x195f('0x2c')](_0x195f('0x2d')+_0x12818f+')')];_0x271726['order']=_0x49797b;}}if(_0x5fca8e){_0x1e467b[_0x195f('0x2e')](function(_0x341dc8){var _0x8a390c=!![];if(_0x39070f===_0x195f('0x2f')&&_0x50b5fe!==_0x341dc8){_0x8a390c=![];}_0x195b09[_0x195f('0x30')]({[_0x341dc8+_0x195f('0x31')]:_0x8a390c});});if(_0x2feaf5){_0x195b09[_0x195f('0x30')]({'pauseType':_0x2feaf5});}}else if(_0x39070f){_0x1e467b['forEach'](function(_0x525910){_0x195b09[_0x195f('0x30')]({[_0x525910+_0x195f('0x31')]:![]});});}_0x271726[_0x195f('0x32')]=_[_0x195f('0x33')](_0x271726[_0x195f('0x32')],{'$and':_0x195b09});if(_0x5da309['user'][_0x195f('0x29')]==='user'){var _0x410af3={'params':{'id':_0x5da309[_0x195f('0x34')][_0x195f('0x35')]},'query':{'section':_0x195f('0x36'),'role':'agent','raw':!![],'ids':_0x12818f,'customSorting':_0x49797b}};if(_0x5da309[_0x195f('0x10')]['online']){_0x410af3[_0x195f('0x10')][_0x195f('0x37')]=!![];}if(_0x5fca8e){_0x410af3[_0x195f('0x10')][_0x195f('0x38')]=_0x195b09;}_0x410af3[_0x195f('0x10')]=Object[_0x195f('0x39')](_0x410af3[_0x195f('0x10')],_['omit'](_0x5da309[_0x195f('0x10')],'id'));return db['UserProfile']['getResources'](_0x410af3);}return db[_0x195f('0x26')][_0x195f('0x3a')](_0x271726);})[_0x195f('0x20')](function(_0x2eb277){_0x870e1f[_0x195f('0xa')]=_0x2eb277[_0x195f('0xa')];_0x2bd6ef=_0x2eb277[_0x195f('0x3b')];return _0x2bd6ef[_0x195f('0x25')](function(_0x5dac61){var _0x1d8985=_[_0x195f('0x3c')](_0x1c41a2,['id',_0x5dac61['id']]);if(_0x1d8985){var _0x4442c7=rta[_0x195f('0x3d')](_0x1d8985);_['merge'](_0x5dac61,_0x4442c7);}_0x5dac61['globalStatus']=rta[_0x195f('0x3e')](_0x5dac61);if(_0x5dac61[_0x195f('0x1b')]['includes'](_0x195f('0x13'))){_0x1e467b['forEach'](function(_0x3d5530){if(_0x5dac61[_0x3d5530+_0x195f('0x31')]){if(_0x3d5530===_0x195f('0x3f')){if(_0x5dac61[_0x195f('0x40')]!==_0x195f('0x41')){_0x5dac61['voiceStatus']=_0x195f('0x13');}}else{_0x5dac61[_0x3d5530+'Status']=_0x195f('0x13');}}});}return _0x5dac61;});})[_0x195f('0x20')](function(_0x16f452){if(!_0x19fbd3||_0x49797b){return _0x16f452;}return rta[_0x195f('0x42')](_0x16f452,_0x19fbd3);})[_0x195f('0x20')](function(_0x5b42e1){var _0x5a829c=rta['getRealtimeAgentsQueryFields']();_0x870e1f[_0x195f('0x3b')]=_0x5b42e1['map'](function(_0x1a992f){return _[_0x195f('0x43')](_0x1a992f,_0x5a829c);});return _0x870e1f;})['then'](respondWithFilteredResult(_0x3ed633,_0x271726))[_0x195f('0x44')](APIHandleError(_0x3ed633));};exports['getQueues']=function(_0x4e0c90,_0x199734){var _0x337195={'count':0x0,'rows':[]};var _0x25a195={};var _0x4e1ed7;var _0x2be5e1;var _0x952aed;Promise['resolve']()[_0x195f('0x20')](function(){if(_0x4e0c90[_0x195f('0x10')]['channel']){if(!utils['isValidChannel'](_0x4e0c90[_0x195f('0x10')][_0x195f('0x15')])){throw new APIBadRequestError(util['format'](_0x195f('0x18'),_0x4e0c90['query'][_0x195f('0x15')]));}_0x4e1ed7=_0x4e0c90[_0x195f('0x10')][_0x195f('0x15')][_0x195f('0x19')]();}var _0x22ab85=_[_0x195f('0x45')](_0x4e1ed7)+'Queue';var _0x164e98=_['map'](db[_0x22ab85][_0x195f('0x27')],function(_0x5dbffb){return{'name':_0x5dbffb[_0x195f('0x28')],'type':_0x5dbffb[_0x195f('0x46')][_0x195f('0x47')]};});if(!_0x4e0c90['query'][_0x195f('0x1d')]){var _0x331f49=['id',_0x195f('0x48')];if(_0x4e1ed7===_0x195f('0x3f')){_0x331f49['push'](_0x195f('0x46'));if(_0x4e0c90[_0x195f('0x10')][_0x195f('0x46')]==='outbound'){_0x331f49[_0x195f('0x30')]([_0x195f('0x49'),'dialMethod']);}}_0x4e0c90[_0x195f('0x10')][_0x195f('0x1d')]=_0x331f49[_0x195f('0x4a')](',');}_0x25a195=qs[_0x195f('0x2a')](_0x164e98,_0x4e0c90);if(_0x4e0c90[_0x195f('0x34')][_0x195f('0x29')]===_0x195f('0x34')){var _0x2b601e={'params':{'id':_0x4e0c90['user'][_0x195f('0x35')]},'query':{'section':_0x4e1ed7===_0x195f('0x3f')&&_0x4e0c90[_0x195f('0x10')][_0x195f('0x46')]===_0x195f('0x4b')?_0x195f('0x4c'):_[_0x195f('0x45')](_0x4e1ed7)+_0x195f('0x4d'),'type':_0x4e0c90['query'][_0x195f('0x46')],'nolimit':!![],'sort':_0x195f('0x48'),'filter':_0x4e0c90[_0x195f('0x10')][_0x195f('0x4e')]}};_0x2b601e[_0x195f('0x10')]=Object[_0x195f('0x39')](_0x2b601e[_0x195f('0x10')],_0x4e0c90[_0x195f('0x10')]);delete _0x2b601e[_0x195f('0x10')]['id'];return db[_0x195f('0x4f')][_0x195f('0x50')](_0x2b601e);}return db[_0x22ab85][_0x195f('0x3a')](_0x25a195);})['then'](function(_0x46f11a){_0x337195[_0x195f('0xa')]=_0x46f11a['count'];_0x2be5e1=_0x46f11a[_0x195f('0x3b')];return rtq[_0x195f('0x51')](_0x4e0c90,_0x4e1ed7);})[_0x195f('0x20')](function(_0x51323e){_0x952aed=_0x51323e[_0x195f('0x3b')];return rtq[_0x195f('0x52')](_0x2be5e1,_0x952aed,_0x4e1ed7,_0x4e0c90[_0x195f('0x10')][_0x195f('0x46')]);})['then'](function(_0x272678){_0x337195[_0x195f('0x3b')]=_0x272678;return _0x337195;})[_0x195f('0x20')](respondWithFilteredResult(_0x199734,_0x25a195))[_0x195f('0x44')](APIHandleError(_0x199734));}; \ No newline at end of file +var _0x8e38=['voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','fieldName','name','outbound','dialActive','dialMethod','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','set','Content-Range','json','getChannels','query','globalStatusFilter','pauseTypeFilter','resolve','then','isValidChannel','format','channel','toLowerCase','sort','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','type','key','role','agent','getOptions','raw','push','FIELD(id,','merge','where','user','userProfileId','Agents','online','assign','omit','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','pause','forEach','Pause'];(function(_0x6a1c94,_0x3e614c){var _0x1e6b51=function(_0x14ea28){while(--_0x14ea28){_0x6a1c94['push'](_0x6a1c94['shift']());}};_0x1e6b51(++_0x3e614c);}(_0x8e38,0xbc));var _0x88e3=function(_0x2e8177,_0x2c80d9){_0x2e8177=_0x2e8177-0x0;var _0x5aa135=_0x8e38[_0x2e8177];return _0x5aa135;};'use strict';var _=require(_0x88e3('0x0'));var util=require(_0x88e3('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x88e3('0x2'));var qs=require(_0x88e3('0x3'));var utils=require(_0x88e3('0x4'));var db=require(_0x88e3('0x5'))['db'];var APIBadRequestError=require(_0x88e3('0x6'))[_0x88e3('0x7')];var APIHandleError=require('../../errors/api')[_0x88e3('0x8')];function respondWithFilteredResult(_0x5e7f22,_0x2f05ea){return function(_0x7da5d5){if(_0x7da5d5){var _0x5d3a57=typeof _0x2f05ea[_0x88e3('0x9')]===_0x88e3('0xa')&&typeof _0x2f05ea[_0x88e3('0xb')]==='undefined';var _0x3e01db=_0x7da5d5[_0x88e3('0xc')];var _0x4da9e8=_0x5d3a57?0x0:_0x2f05ea['offset'];var _0x808cad=_0x5d3a57?_0x7da5d5[_0x88e3('0xc')]:_0x2f05ea[_0x88e3('0x9')]+_0x2f05ea[_0x88e3('0xb')];var _0x63623f;if(_0x808cad>=_0x3e01db){_0x808cad=_0x3e01db;_0x63623f=0xc8;}else{_0x63623f=0xce;}_0x5e7f22['status'](_0x63623f);return _0x5e7f22[_0x88e3('0xd')](_0x88e3('0xe'),_0x4da9e8+'-'+_0x808cad+'/'+_0x3e01db)[_0x88e3('0xf')](_0x7da5d5);}return null;};}exports['getAgents']=function(_0x398b76,_0x393acb){var _0x2f9c50={'count':0x0,'rows':[]};var _0x54aff0={};var _0x422fcf;var _0x2a2296=utils[_0x88e3('0x10')]();var _0x495bb0;var _0x36bc42;var _0x5f0898=_0x398b76[_0x88e3('0x11')]['globalQueueFilter'];var _0x134d2f=_0x398b76[_0x88e3('0x11')][_0x88e3('0x12')];var _0xedb537=_0x398b76['query'][_0x88e3('0x13')];var _0x482589=_0x134d2f==='pause'||_0x134d2f==='*pause'?!![]:![];var _0x353abf=[];var _0x48315c;var _0x3ab3a3;Promise[_0x88e3('0x14')]()[_0x88e3('0x15')](function(){if(_0x398b76[_0x88e3('0x11')]['channel']){if(!utils[_0x88e3('0x16')](_0x398b76[_0x88e3('0x11')]['channel'])){throw new APIBadRequestError(util[_0x88e3('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x398b76[_0x88e3('0x11')][_0x88e3('0x18')]));}_0x422fcf=_0x398b76[_0x88e3('0x11')][_0x88e3('0x18')][_0x88e3('0x19')]();}if(!_0x398b76[_0x88e3('0x11')][_0x88e3('0x1a')]||!_0x398b76['query'][_0x88e3('0x1a')]['includes'](_0x88e3('0x1b'))){_0x398b76['query']['sort']=rta[_0x88e3('0x1c')](_0x398b76[_0x88e3('0x11')][_0x88e3('0x1a')]);return;}var _0x5a18a5=rta['getUpdatedSortOptions'](_0x398b76[_0x88e3('0x11')][_0x88e3('0x1a')]);_0x398b76[_0x88e3('0x11')][_0x88e3('0x1a')]=_0x5a18a5[_0x88e3('0x1d')][_0x88e3('0x1e')](',');_0x48315c=_0x5a18a5[_0x88e3('0x1f')];})[_0x88e3('0x15')](function(){if(!_0x5f0898){return[];}return rta[_0x88e3('0x20')](_0x5f0898,_0x422fcf);})['then'](function(_0x19ff09){_0x353abf=_0x19ff09;return rta[_0x88e3('0x21')]();})[_0x88e3('0x15')](function(_0x4d6c5f){_0x36bc42=_0x4d6c5f[_0x88e3('0x22')];if((!_0x134d2f||_0x482589)&&!_0x48315c){return _0x353abf;}if(_0x48315c&&!_0x134d2f){return rta[_0x88e3('0x23')](_0x36bc42,_0x353abf,_0x48315c);}else{return rta[_0x88e3('0x24')](_0x36bc42,_0x353abf,_0x134d2f);}})[_0x88e3('0x15')](function(_0x2725f2){_0x353abf=_0x2725f2;var _0x49accd=![];if(_0x353abf[_0x88e3('0x25')]===0x0){if(_0x5f0898||_0x134d2f){_0x49accd=!![];}if(_0x482589){_0x49accd=![];}}if(_0x49accd){return _0x2f9c50;}var _0x39092b=_[_0x88e3('0x26')](db['User'][_0x88e3('0x27')],function(_0x18f7cc){return{'name':_0x18f7cc['fieldName'],'type':_0x18f7cc[_0x88e3('0x28')][_0x88e3('0x29')]};});_0x398b76['query'][_0x88e3('0x2a')]=_0x88e3('0x2b');_0x54aff0=qs[_0x88e3('0x2c')](_0x39092b,_0x398b76);_0x54aff0[_0x88e3('0x2d')]=!![];var _0x3385c4=[];if(_0x353abf[_0x88e3('0x25')]>0x0){_0x3385c4[_0x88e3('0x2e')]({'id':{'$in':_0x353abf}});if(_0x48315c&&!_0x134d2f){_0x3ab3a3=[db['sequelize']['literal'](_0x88e3('0x2f')+_0x353abf+')')];_0x54aff0['order']=_0x3ab3a3;}}if(_0x482589){_0x2a2296['forEach'](function(_0x26dacb){var _0x318bb3=!![];if(_0x134d2f==='*pause'&&_0x422fcf!==_0x26dacb){_0x318bb3=![];}_0x3385c4[_0x88e3('0x2e')]({[_0x26dacb+'Pause']:_0x318bb3});});if(_0xedb537){_0x3385c4[_0x88e3('0x2e')]({'pauseType':_0xedb537});}}else if(_0x134d2f){_0x2a2296['forEach'](function(_0x1f3ed8){_0x3385c4[_0x88e3('0x2e')]({[_0x1f3ed8+'Pause']:![]});});}_0x54aff0['where']=_[_0x88e3('0x30')](_0x54aff0[_0x88e3('0x31')],{'$and':_0x3385c4});if(_0x398b76['user'][_0x88e3('0x2a')]===_0x88e3('0x32')){var _0x416c05={'params':{'id':_0x398b76[_0x88e3('0x32')][_0x88e3('0x33')]},'query':{'section':_0x88e3('0x34'),'role':_0x88e3('0x2b'),'raw':!![],'ids':_0x353abf,'customSorting':_0x3ab3a3}};if(_0x398b76[_0x88e3('0x11')]['online']){_0x416c05[_0x88e3('0x11')][_0x88e3('0x35')]=!![];}if(_0x482589){_0x416c05[_0x88e3('0x11')]['extraQueryConditions']=_0x3385c4;}_0x416c05[_0x88e3('0x11')]=Object[_0x88e3('0x36')](_0x416c05[_0x88e3('0x11')],_[_0x88e3('0x37')](_0x398b76[_0x88e3('0x11')],'id'));return db[_0x88e3('0x38')][_0x88e3('0x39')](_0x416c05);}return db['User'][_0x88e3('0x3a')](_0x54aff0);})[_0x88e3('0x15')](function(_0x35f5e2){_0x2f9c50['count']=_0x35f5e2['count'];_0x495bb0=_0x35f5e2[_0x88e3('0x22')];return _0x495bb0[_0x88e3('0x26')](function(_0x29b67c){var _0x5c5722=_[_0x88e3('0x3b')](_0x36bc42,['id',_0x29b67c['id']]);if(_0x5c5722){var _0x13aeda=rta[_0x88e3('0x3c')](_0x5c5722);_['merge'](_0x29b67c,_0x13aeda);}_0x29b67c['globalStatus']=rta['getAgentStatus'](_0x29b67c);if(_0x29b67c[_0x88e3('0x1b')]['includes'](_0x88e3('0x3d'))){_0x2a2296[_0x88e3('0x3e')](function(_0x55b6de){if(_0x29b67c[_0x55b6de+_0x88e3('0x3f')]){if(_0x55b6de===_0x88e3('0x40')){if(_0x29b67c[_0x88e3('0x41')]!==_0x88e3('0x42')){_0x29b67c[_0x88e3('0x41')]=_0x88e3('0x3d');}}else{_0x29b67c[_0x55b6de+_0x88e3('0x43')]=_0x88e3('0x3d');}}});}return _0x29b67c;});})[_0x88e3('0x15')](function(_0x51c0d9){if(!_0x48315c||_0x3ab3a3){return _0x51c0d9;}return rta[_0x88e3('0x44')](_0x51c0d9,_0x48315c);})[_0x88e3('0x15')](function(_0x29ba2d){var _0x2ace3e=rta[_0x88e3('0x45')]();_0x2f9c50['rows']=_0x29ba2d[_0x88e3('0x26')](function(_0x55e11b){return _[_0x88e3('0x46')](_0x55e11b,_0x2ace3e);});return _0x2f9c50;})['then'](respondWithFilteredResult(_0x393acb,_0x54aff0))[_0x88e3('0x47')](APIHandleError(_0x393acb));};exports[_0x88e3('0x48')]=function(_0x32734b,_0x2d9e8e){var _0x120f9f={'count':0x0,'rows':[]};var _0x4b6919={};var _0x3df7c4;var _0x4172e0;var _0x5e2243;Promise['resolve']()[_0x88e3('0x15')](function(){if(_0x32734b[_0x88e3('0x11')]['channel']){if(!utils[_0x88e3('0x16')](_0x32734b['query'][_0x88e3('0x18')])){throw new APIBadRequestError(util[_0x88e3('0x17')](_0x88e3('0x49'),_0x32734b[_0x88e3('0x11')]['channel']));}_0x3df7c4=_0x32734b[_0x88e3('0x11')][_0x88e3('0x18')][_0x88e3('0x19')]();}var _0x352cec=_[_0x88e3('0x4a')](_0x3df7c4)+_0x88e3('0x4b');var _0x3c29a0=_[_0x88e3('0x26')](db[_0x352cec]['rawAttributes'],function(_0x270e7f){return{'name':_0x270e7f[_0x88e3('0x4c')],'type':_0x270e7f[_0x88e3('0x28')][_0x88e3('0x29')]};});if(!_0x32734b[_0x88e3('0x11')][_0x88e3('0x1d')]){var _0x21f9ad=['id',_0x88e3('0x4d')];if(_0x3df7c4===_0x88e3('0x40')){_0x21f9ad['push'](_0x88e3('0x28'));if(_0x32734b['query'][_0x88e3('0x28')]===_0x88e3('0x4e')){_0x21f9ad['push']([_0x88e3('0x4f'),_0x88e3('0x50')]);}}_0x32734b[_0x88e3('0x11')][_0x88e3('0x1d')]=_0x21f9ad[_0x88e3('0x1e')](',');}_0x4b6919=qs['getOptions'](_0x3c29a0,_0x32734b);if(_0x32734b[_0x88e3('0x32')][_0x88e3('0x2a')]===_0x88e3('0x32')){var _0x3d9d92={'params':{'id':_0x32734b[_0x88e3('0x32')][_0x88e3('0x33')]},'query':{'section':_0x3df7c4==='voice'&&_0x32734b['query'][_0x88e3('0x28')]==='outbound'?'QueueCampaigns':_[_0x88e3('0x4a')](_0x3df7c4)+'Queues','type':_0x32734b[_0x88e3('0x11')][_0x88e3('0x28')],'nolimit':!![],'sort':_0x88e3('0x4d'),'filter':_0x32734b[_0x88e3('0x11')][_0x88e3('0x51')]}};_0x3d9d92[_0x88e3('0x11')]=Object[_0x88e3('0x36')](_0x3d9d92[_0x88e3('0x11')],_0x32734b[_0x88e3('0x11')]);delete _0x3d9d92[_0x88e3('0x11')]['id'];return db[_0x88e3('0x38')][_0x88e3('0x39')](_0x3d9d92);}return db[_0x352cec][_0x88e3('0x3a')](_0x4b6919);})[_0x88e3('0x15')](function(_0x31f299){_0x120f9f[_0x88e3('0xc')]=_0x31f299[_0x88e3('0xc')];_0x4172e0=_0x31f299[_0x88e3('0x22')];return rtq[_0x88e3('0x52')](_0x32734b,_0x3df7c4);})['then'](function(_0x344f73){_0x5e2243=_0x344f73[_0x88e3('0x22')];return rtq[_0x88e3('0x53')](_0x4172e0,_0x5e2243,_0x3df7c4,_0x32734b[_0x88e3('0x11')]['type']);})['then'](function(_0x2d580f){_0x120f9f[_0x88e3('0x22')]=_0x2d580f;return _0x120f9f;})[_0x88e3('0x15')](respondWithFilteredResult(_0x2d9e8e,_0x4b6919))[_0x88e3('0x47')](APIHandleError(_0x2d9e8e));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index bad7556..a04b348 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xc196be,_0x22b081){var _0x26cb67=function(_0x2b88a8){while(--_0x2b88a8){_0xc196be['push'](_0xc196be['shift']());}};_0x26cb67(++_0x22b081);}(_0xe706,0xa3));var _0x6e70=function(_0x38c7e3,_0x34b4bc){_0x38c7e3=_0x38c7e3-0x0;var _0x34b66f=_0xe706[_0x38c7e3];return _0x34b66f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4fa5b0,_0xf7f088){var _0x170e53=function(_0x2e6550){while(--_0x2e6550){_0x4fa5b0['push'](_0x4fa5b0['shift']());}};_0x170e53(++_0xf7f088);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index bd124f4..35d905a 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 _0xc9b9=['INTEGER','STRING','DATE'];(function(_0x1936f3,_0x1b3ed6){var _0x3cac13=function(_0x343ec4){while(--_0x343ec4){_0x1936f3['push'](_0x1936f3['shift']());}};_0x3cac13(++_0x1b3ed6);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0xc9b9[_0x25662e];return _0x59b7bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x9c9b('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x9c9b('0x1')]},'scheduledat':{'type':Sequelize[_0x9c9b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9c9b('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb1d3=['STRING','sequelize','DATE'];(function(_0x482bce,_0x53651d){var _0x2fcd98=function(_0x1c6995){while(--_0x1c6995){_0x482bce['push'](_0x482bce['shift']());}};_0x2fcd98(++_0x53651d);}(_0xb1d3,0xe8));var _0x3b1d=function(_0x4c3346,_0x5b6937){_0x4c3346=_0x4c3346-0x0;var _0x43a6a1=_0xb1d3[_0x4c3346];return _0x43a6a1;};'use strict';var Sequelize=require(_0x3b1d('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x3b1d('0x1')]},'uniqueid':{'type':Sequelize[_0x3b1d('0x2')]},'starttime':{'type':Sequelize[_0x3b1d('0x1')]},'responsetime':{'type':Sequelize[_0x3b1d('0x1')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x3b1d('0x2')]},'campaigntype':{'type':Sequelize[_0x3b1d('0x2')]},'membername':{'type':Sequelize[_0x3b1d('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0566b02..ddf466f 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 _0x01fb=['ReportAgentPreview','report_agent_preview','lodash','util','moment','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x01fb,0x1e6));var _0xb01f=function(_0x9396cf,_0x343099){_0x9396cf=_0x9396cf-0x0;var _0x65797e=_0x01fb[_0x9396cf];return _0x65797e;};'use strict';var _=require(_0xb01f('0x0'));var util=require(_0xb01f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb01f('0x2'));var BPromise=require('bluebird');var rp=require(_0xb01f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb01f('0x4'));var config=require(_0xb01f('0x5'));var attributes=require(_0xb01f('0x6'));module[_0xb01f('0x7')]=function(_0x19eb19,_0x15644d){return _0x19eb19[_0xb01f('0x8')](_0xb01f('0x9'),attributes,{'tableName':_0xb01f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x428f=['report_agent_preview','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview'];(function(_0x1c9fa3,_0x3a0fb1){var _0x3045a0=function(_0x59d822){while(--_0x59d822){_0x1c9fa3['push'](_0x1c9fa3['shift']());}};_0x3045a0(++_0x3a0fb1);}(_0x428f,0x140));var _0xf428=function(_0x1337b2,_0x5f4e3b){_0x1337b2=_0x1337b2-0x0;var _0x543248=_0x428f[_0x1337b2];return _0x543248;};'use strict';var _=require(_0xf428('0x0'));var util=require('util');var logger=require(_0xf428('0x1'))(_0xf428('0x2'));var moment=require(_0xf428('0x3'));var BPromise=require(_0xf428('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf428('0x5'));var rimraf=require(_0xf428('0x6'));var config=require(_0xf428('0x7'));var attributes=require(_0xf428('0x8'));module['exports']=function(_0x5ee39d,_0x4908fd){return _0x5ee39d['define'](_0xf428('0x9'),attributes,{'tableName':_0xf428('0xa'),'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 465cc99..44c308c 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 _0x61b5=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','ReportAgentPreview','options','raw','then','CreateReportAgentPreview','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x121f35,_0x5900cd){var _0x365177=function(_0x5a9952){while(--_0x5a9952){_0x121f35['push'](_0x121f35['shift']());}};_0x365177(++_0x5900cd);}(_0x61b5,0x86));var _0x561b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x61b5[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x561b('0x0'));var moment=require(_0x561b('0x1'));var BPromise=require('bluebird');var rs=require(_0x561b('0x2'));var fs=require('fs');var Redis=require(_0x561b('0x3'));var db=require(_0x561b('0x4'))['db'];var utils=require(_0x561b('0x5'));var logger=require('../../config/logger')(_0x561b('0x6'));var config=require(_0x561b('0x7'));var jayson=require(_0x561b('0x8'));var client=jayson[_0x561b('0x9')][_0x561b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cf994,_0x3202cd,_0x4b84e6){return new BPromise(function(_0x3695d0,_0x38c3a2){return client[_0x561b('0xb')](_0x5cf994,_0x4b84e6)['then'](function(_0x210dfb){logger[_0x561b('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x3202cd,_0x561b('0xd'));logger[_0x561b('0xe')](_0x561b('0xf'),_0x3202cd,_0x561b('0xd'),JSON[_0x561b('0x10')](_0x210dfb));if(_0x210dfb[_0x561b('0x11')]){if(_0x210dfb[_0x561b('0x11')][_0x561b('0x12')]===0x1f4){logger[_0x561b('0x11')](_0x561b('0x13'),_0x3202cd,_0x210dfb[_0x561b('0x11')][_0x561b('0x14')]);return _0x38c3a2(_0x210dfb[_0x561b('0x11')][_0x561b('0x14')]);}logger['error'](_0x561b('0x13'),_0x3202cd,_0x210dfb[_0x561b('0x11')][_0x561b('0x14')]);return _0x3695d0(_0x210dfb[_0x561b('0x11')][_0x561b('0x14')]);}else{logger[_0x561b('0xc')](_0x561b('0x13'),_0x3202cd,_0x561b('0xd'));_0x3695d0(_0x210dfb[_0x561b('0x15')][_0x561b('0x14')]);}})[_0x561b('0x16')](function(_0x5827d3){logger['error'](_0x561b('0x13'),_0x3202cd,_0x5827d3);_0x38c3a2(_0x5827d3);});});}exports['CreateReportAgentPreview']=function(_0x461fe7){var _0x8380e=this;return new Promise(function(_0x1321f5,_0x28c6bc){return db[_0x561b('0x17')]['create'](_0x461fe7['body'],{'raw':_0x461fe7[_0x561b('0x18')]?_0x461fe7[_0x561b('0x18')][_0x561b('0x19')]===undefined?!![]:![]:!![]})[_0x561b('0x1a')](function(_0x1d3155){logger[_0x561b('0xc')](_0x561b('0x1b'),_0x461fe7);logger[_0x561b('0xe')]('CreateReportAgentPreview',_0x461fe7,JSON['stringify'](_0x1d3155));_0x1321f5(_0x1d3155);})[_0x561b('0x16')](function(_0x32f497){logger[_0x561b('0x11')](_0x561b('0x1b'),_0x32f497['message'],_0x461fe7);_0x28c6bc(_0x8380e[_0x561b('0x11')](0x1f4,_0x32f497['message']));});});}; \ No newline at end of file +var _0x4b27=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','then','catch','lodash','util','moment','bluebird'];(function(_0x59901b,_0x52016b){var _0x5d775e=function(_0xea3504){while(--_0xea3504){_0x59901b['push'](_0x59901b['shift']());}};_0x5d775e(++_0x52016b);}(_0x4b27,0x1ae));var _0x74b2=function(_0xac78c7,_0x38bbf6){_0xac78c7=_0xac78c7-0x0;var _0x274703=_0x4b27[_0xac78c7];return _0x274703;};'use strict';var _=require(_0x74b2('0x0'));var util=require(_0x74b2('0x1'));var moment=require(_0x74b2('0x2'));var BPromise=require(_0x74b2('0x3'));var rs=require(_0x74b2('0x4'));var fs=require('fs');var Redis=require(_0x74b2('0x5'));var db=require(_0x74b2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x74b2('0x7'))(_0x74b2('0x8'));var config=require(_0x74b2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x74b2('0xa')][_0x74b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e587f,_0xf92f62,_0x12431e){return new BPromise(function(_0xae270e,_0x1e2153){return client[_0x74b2('0xc')](_0x5e587f,_0x12431e)['then'](function(_0x29d6ca){logger[_0x74b2('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0xf92f62,_0x74b2('0xe'));logger[_0x74b2('0xf')](_0x74b2('0x10'),_0xf92f62,_0x74b2('0xe'),JSON[_0x74b2('0x11')](_0x29d6ca));if(_0x29d6ca[_0x74b2('0x12')]){if(_0x29d6ca[_0x74b2('0x12')][_0x74b2('0x13')]===0x1f4){logger[_0x74b2('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0xf92f62,_0x29d6ca['error'][_0x74b2('0x14')]);return _0x1e2153(_0x29d6ca['error']['message']);}logger[_0x74b2('0x12')](_0x74b2('0x15'),_0xf92f62,_0x29d6ca[_0x74b2('0x12')]['message']);return _0xae270e(_0x29d6ca[_0x74b2('0x12')]['message']);}else{logger[_0x74b2('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0xf92f62,_0x74b2('0xe'));_0xae270e(_0x29d6ca[_0x74b2('0x16')]['message']);}})['catch'](function(_0xb851cc){logger[_0x74b2('0x12')](_0x74b2('0x15'),_0xf92f62,_0xb851cc);_0x1e2153(_0xb851cc);});});}exports[_0x74b2('0x17')]=function(_0x16aed5){var _0x3d18dd=this;return new Promise(function(_0x341e33,_0x43f41f){return db[_0x74b2('0x18')][_0x74b2('0x19')](_0x16aed5[_0x74b2('0x1a')],{'raw':_0x16aed5[_0x74b2('0x1b')]?_0x16aed5[_0x74b2('0x1b')][_0x74b2('0x1c')]===undefined?!![]:![]:!![]})[_0x74b2('0x1d')](function(_0x5bf923){logger[_0x74b2('0xd')](_0x74b2('0x17'),_0x16aed5);logger[_0x74b2('0xf')](_0x74b2('0x17'),_0x16aed5,JSON['stringify'](_0x5bf923));_0x341e33(_0x5bf923);})[_0x74b2('0x1e')](function(_0x4fb769){logger[_0x74b2('0x12')](_0x74b2('0x17'),_0x4fb769[_0x74b2('0x14')],_0x16aed5);_0x43f41f(_0x3d18dd[_0x74b2('0x12')](0x1f4,_0x4fb769[_0x74b2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 0f1d75d..2966837 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 _0xc924=['voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor'];(function(_0x5777b9,_0x53d406){var _0x50883d=function(_0x5dc27b){while(--_0x5dc27b){_0x5777b9['push'](_0x5777b9['shift']());}};_0x50883d(++_0x53d406);}(_0xc924,0x136));var _0x4c92=function(_0x278647,_0xab8460){_0x278647=_0x278647-0x0;var _0x1b8393=_0xc924[_0x278647];return _0x1b8393;};'use strict';var multer=require(_0x4c92('0x0'));var util=require(_0x4c92('0x1'));var path=require(_0x4c92('0x2'));var express=require(_0x4c92('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x4c92('0x4'));router[_0x4c92('0x5')](_0x4c92('0x6'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x8')]);router[_0x4c92('0x5')](_0x4c92('0x9'),auth['isAuthenticated'](),controller[_0x4c92('0xa')]);router['get'](_0x4c92('0xb'),auth[_0x4c92('0x7')](),controller[_0x4c92('0xc')]);router['get'](_0x4c92('0xd'),auth['isAuthenticated'](),controller[_0x4c92('0xe')]);router['get']('/chat/queues',auth[_0x4c92('0x7')](),controller[_0x4c92('0xf')]);router[_0x4c92('0x5')]('/mail/queues',auth[_0x4c92('0x7')](),controller[_0x4c92('0x10')]);router[_0x4c92('0x5')](_0x4c92('0x11'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x12')]);router[_0x4c92('0x5')](_0x4c92('0x13'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x14')]);router[_0x4c92('0x5')]('/sms/queues',auth[_0x4c92('0x7')](),controller[_0x4c92('0x15')]);router['get'](_0x4c92('0x16'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x17')]);router[_0x4c92('0x5')]('/fax/queues',auth[_0x4c92('0x7')](),controller[_0x4c92('0x18')]);router[_0x4c92('0x5')](_0x4c92('0x19'),auth[_0x4c92('0x7')](),controller['voiceQueuesPreview']);router[_0x4c92('0x5')](_0x4c92('0x1a'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x1b')]);router[_0x4c92('0x5')](_0x4c92('0x1c'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x1d')]);router[_0x4c92('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x4c92('0x7')](),controller[_0x4c92('0x1e')]);router[_0x4c92('0x5')](_0x4c92('0x1f'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x20')]);router['get'](_0x4c92('0x21'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x22')]);router['put']('/voice/queues/:id',auth[_0x4c92('0x7')](),controller[_0x4c92('0x23')]);router[_0x4c92('0x5')]('/outbound',auth['isAuthenticated'](),controller[_0x4c92('0x24')]);router[_0x4c92('0x5')](_0x4c92('0x25'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x26')]);router[_0x4c92('0x5')](_0x4c92('0x27'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x28')]);router['put'](_0x4c92('0x29'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x2a')]);router[_0x4c92('0x5')](_0x4c92('0x2b'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x2c')]);router[_0x4c92('0x5')](_0x4c92('0x2d'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x2e')]);router['get'](_0x4c92('0x2f'),auth[_0x4c92('0x7')](),controller['campaigns']);router[_0x4c92('0x5')](_0x4c92('0x30'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x31')]);router[_0x4c92('0x5')](_0x4c92('0x32'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x33')]);router[_0x4c92('0x5')](_0x4c92('0x34'),auth[_0x4c92('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x4c92('0x5')](_0x4c92('0x35'),auth[_0x4c92('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0x4c92('0x5')](_0x4c92('0x36'),auth[_0x4c92('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0x4c92('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0x4c92('0x5')](_0x4c92('0x37'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x38')]);router['get'](_0x4c92('0x39'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x3a')]);router[_0x4c92('0x3b')]('/mail/queues/:id/notify',auth[_0x4c92('0x7')](),controller[_0x4c92('0x3c')]('mail'));router['get'](_0x4c92('0x3d'),auth[_0x4c92('0x7')](),controller['showMailQueues']);router[_0x4c92('0x3b')]('/chat/queues/:id/notify',auth[_0x4c92('0x7')](),controller[_0x4c92('0x3c')](_0x4c92('0x3e')));router[_0x4c92('0x5')]('/chat/queues/:id',auth[_0x4c92('0x7')](),controller[_0x4c92('0x3f')]);router[_0x4c92('0x3b')](_0x4c92('0x40'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x3c')](_0x4c92('0x41')));router[_0x4c92('0x5')]('/fax/queues/:id',auth[_0x4c92('0x7')](),controller[_0x4c92('0x42')]);router['post'](_0x4c92('0x43'),auth['isAuthenticated'](),controller[_0x4c92('0x3c')](_0x4c92('0x44')));router['get'](_0x4c92('0x45'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x46')]);router[_0x4c92('0x3b')](_0x4c92('0x47'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x3c')](_0x4c92('0x48')));router[_0x4c92('0x3b')](_0x4c92('0x49'),auth[_0x4c92('0x7')](),controller['queueNotify'](_0x4c92('0x4a')));router['get'](_0x4c92('0x4b'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x4c92('0x5')](_0x4c92('0x4c'),auth[_0x4c92('0x7')](),controller[_0x4c92('0x4d')]);router[_0x4c92('0x3b')](_0x4c92('0x4e'),auth[_0x4c92('0x7')](),controller['agentNotify']);module[_0x4c92('0x4f')]=router; \ No newline at end of file +var _0x8d57=['path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','agentNotify','exports','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8d57,0xaf));var _0x78d5=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x8d57[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require('multer');var util=require(_0x78d5('0x0'));var path=require(_0x78d5('0x1'));var express=require(_0x78d5('0x2'));var router=express[_0x78d5('0x3')]();var auth=require(_0x78d5('0x4'));var controller=require(_0x78d5('0x5'));router[_0x78d5('0x6')](_0x78d5('0x7'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x9')]);router['get'](_0x78d5('0xa'),auth[_0x78d5('0x8')](),controller[_0x78d5('0xb')]);router[_0x78d5('0x6')](_0x78d5('0xc'),auth[_0x78d5('0x8')](),controller[_0x78d5('0xd')]);router[_0x78d5('0x6')](_0x78d5('0xe'),auth['isAuthenticated'](),controller[_0x78d5('0xf')]);router[_0x78d5('0x6')](_0x78d5('0x10'),auth[_0x78d5('0x8')](),controller['chatQueues']);router[_0x78d5('0x6')](_0x78d5('0x11'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x12')]);router['get'](_0x78d5('0x13'),auth['isAuthenticated'](),controller[_0x78d5('0x14')]);router[_0x78d5('0x6')]('/openchannel/queues',auth[_0x78d5('0x8')](),controller[_0x78d5('0x15')]);router[_0x78d5('0x6')](_0x78d5('0x16'),auth[_0x78d5('0x8')](),controller['smsQueues']);router[_0x78d5('0x6')](_0x78d5('0x17'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x78d5('0x6')](_0x78d5('0x18'),auth['isAuthenticated'](),controller[_0x78d5('0x19')]);router['get']('/voice/queues/preview/:id',auth[_0x78d5('0x8')](),controller[_0x78d5('0x1a')]);router[_0x78d5('0x6')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x78d5('0x1b')]);router[_0x78d5('0x6')](_0x78d5('0x1c'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x1d')]);router[_0x78d5('0x6')](_0x78d5('0x1e'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x1f')]);router[_0x78d5('0x6')](_0x78d5('0x20'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x21')]);router['get']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x78d5('0x22')]);router[_0x78d5('0x23')](_0x78d5('0x24'),auth['isAuthenticated'](),controller[_0x78d5('0x25')]);router[_0x78d5('0x6')](_0x78d5('0x26'),auth[_0x78d5('0x8')](),controller['outbound']);router[_0x78d5('0x6')](_0x78d5('0x27'),auth[_0x78d5('0x8')](),controller['outboundChannels']);router[_0x78d5('0x6')](_0x78d5('0x28'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x29')]);router[_0x78d5('0x23')](_0x78d5('0x2a'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x2b')]);router[_0x78d5('0x6')]('/telephones',auth[_0x78d5('0x8')](),controller[_0x78d5('0x2c')]);router[_0x78d5('0x6')](_0x78d5('0x2d'),auth['isAuthenticated'](),controller[_0x78d5('0x2e')]);router[_0x78d5('0x6')](_0x78d5('0x2f'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x30')]);router[_0x78d5('0x6')](_0x78d5('0x31'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x32')]);router[_0x78d5('0x6')](_0x78d5('0x33'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x34')]);router[_0x78d5('0x6')](_0x78d5('0x35'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x36')]);router[_0x78d5('0x6')](_0x78d5('0x37'),auth['isAuthenticated'](),controller[_0x78d5('0x38')]);router['get'](_0x78d5('0x39'),auth[_0x78d5('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x78d5('0x6')](_0x78d5('0x3a'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x3b')]);router[_0x78d5('0x6')](_0x78d5('0x3c'),auth['isAuthenticated'](),controller[_0x78d5('0x3d')]);router[_0x78d5('0x6')](_0x78d5('0x3e'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x3f')]);router[_0x78d5('0x40')](_0x78d5('0x41'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x42')](_0x78d5('0x43')));router[_0x78d5('0x6')](_0x78d5('0x44'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x45')]);router[_0x78d5('0x40')](_0x78d5('0x46'),auth['isAuthenticated'](),controller['queueNotify'](_0x78d5('0x47')));router['get'](_0x78d5('0x48'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x49')]);router['post'](_0x78d5('0x4a'),auth['isAuthenticated'](),controller[_0x78d5('0x42')](_0x78d5('0x4b')));router['get']('/fax/queues/:id',auth[_0x78d5('0x8')](),controller[_0x78d5('0x4c')]);router[_0x78d5('0x40')](_0x78d5('0x4d'),auth['isAuthenticated'](),controller[_0x78d5('0x42')](_0x78d5('0x4e')));router[_0x78d5('0x6')](_0x78d5('0x4f'),auth['isAuthenticated'](),controller[_0x78d5('0x50')]);router[_0x78d5('0x40')](_0x78d5('0x51'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x42')](_0x78d5('0x52')));router[_0x78d5('0x40')]('/whatsapp/queues/:id/notify',auth[_0x78d5('0x8')](),controller[_0x78d5('0x42')](_0x78d5('0x53')));router['get'](_0x78d5('0x54'),auth[_0x78d5('0x8')](),controller['showSmsQueues']);router[_0x78d5('0x6')](_0x78d5('0x55'),auth[_0x78d5('0x8')](),controller['showWhatsappQueues']);router[_0x78d5('0x40')]('/agents/:id/notify',auth[_0x78d5('0x8')](),controller[_0x78d5('0x56')]);module[_0x78d5('0x57')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5bba659..b467580 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 _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0xb004af,_0x1fe19b){var _0x3b1222=function(_0x487227){while(--_0x487227){_0xb004af['push'](_0xb004af['shift']());}};_0x3b1222(++_0x1fe19b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a5772ac..f559c53 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 _0xf102=['../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','post','create','put','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xf102,0x198));var _0x2f10=function(_0x1f047e,_0x23b312){_0x1f047e=_0x1f047e-0x0;var _0x206db5=_0xf102[_0x1f047e];return _0x206db5;};'use strict';var multer=require('multer');var util=require(_0x2f10('0x0'));var path=require(_0x2f10('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2f10('0x2')]();var fs_extra=require(_0x2f10('0x3'));var auth=require(_0x2f10('0x4'));var interaction=require(_0x2f10('0x5'));var config=require(_0x2f10('0x6'));var controller=require(_0x2f10('0x7'));router[_0x2f10('0x8')]('/',auth[_0x2f10('0x9')](),controller['index']);router[_0x2f10('0x8')](_0x2f10('0xa'),auth[_0x2f10('0x9')](),controller[_0x2f10('0xb')]);router['get'](_0x2f10('0xc'),auth['isAuthenticated'](),controller['run']);router[_0x2f10('0xd')]('/',auth[_0x2f10('0x9')](),controller[_0x2f10('0xe')]);router[_0x2f10('0xf')](_0x2f10('0xa'),auth[_0x2f10('0x9')](),controller['update']);router[_0x2f10('0x10')](_0x2f10('0xa'),auth[_0x2f10('0x9')](),controller['destroy']);module[_0x2f10('0x11')]=router; \ No newline at end of file +var _0x380e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','/:id/run','run','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x34ddc8,_0x2de78e){var _0x2722f3=function(_0x184584){while(--_0x184584){_0x34ddc8['push'](_0x34ddc8['shift']());}};_0x2722f3(++_0x2de78e);}(_0x380e,0x191));var _0xe380=function(_0x32e54e,_0xb24e5c){_0x32e54e=_0x32e54e-0x0;var _0x16ea9e=_0x380e[_0x32e54e];return _0x16ea9e;};'use strict';var multer=require(_0xe380('0x0'));var util=require(_0xe380('0x1'));var path=require(_0xe380('0x2'));var timeout=require(_0xe380('0x3'));var express=require(_0xe380('0x4'));var router=express[_0xe380('0x5')]();var fs_extra=require(_0xe380('0x6'));var auth=require(_0xe380('0x7'));var interaction=require(_0xe380('0x8'));var config=require(_0xe380('0x9'));var controller=require(_0xe380('0xa'));router['get']('/',auth[_0xe380('0xb')](),controller[_0xe380('0xc')]);router[_0xe380('0xd')](_0xe380('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xe380('0xd')](_0xe380('0xf'),auth['isAuthenticated'](),controller[_0xe380('0x10')]);router[_0xe380('0x11')]('/',auth[_0xe380('0xb')](),controller[_0xe380('0x12')]);router[_0xe380('0x13')]('/:id',auth[_0xe380('0xb')](),controller[_0xe380('0x14')]);router[_0xe380('0x15')](_0xe380('0xe'),auth[_0xe380('0xb')](),controller[_0xe380('0x16')]);module[_0xe380('0x17')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index f6c08a2..699d956 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 _0x0413=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks','minutes','days','pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x52dd7b,_0xfa3e99){var _0x5e160c=function(_0x469b0f){while(--_0x469b0f){_0x52dd7b['push'](_0x52dd7b['shift']());}};_0x5e160c(++_0xfa3e99);}(_0x0413,0xf3));var _0x3041=function(_0x586f34,_0x2f3224){_0x586f34=_0x586f34-0x0;var _0x10b9ee=_0x0413[_0x586f34];return _0x10b9ee;};'use strict';var Sequelize=require(_0x3041('0x0'));module[_0x3041('0x1')]={'name':{'type':Sequelize[_0x3041('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3041('0x2')]},'active':{'type':Sequelize[_0x3041('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3041('0x2')],'allowNull':![],'defaultValue':_0x3041('0x4')},'startAt':{'type':Sequelize[_0x3041('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3041('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3041('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3041('0x7')](_0x3041('0x8'),_0x3041('0x9'),'months',_0x3041('0xa'),'days','hours',_0x3041('0xb')),'allowNull':![],'defaultValue':_0x3041('0xc')},'output':{'type':Sequelize[_0x3041('0x7')]('csv',_0x3041('0xd'),_0x3041('0xe')),'allowNull':![],'defaultValue':_0x3041('0xf')},'type':{'type':Sequelize['ENUM'](_0x3041('0x10'),_0x3041('0x11')),'allowNull':![],'defaultValue':_0x3041('0x10')},'sendMail':{'type':Sequelize[_0x3041('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x3041('0x2')]},'cc':{'type':Sequelize[_0x3041('0x12')]},'bcc':{'type':Sequelize[_0x3041('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x3041('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0176=['custom','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','minutes','csv','pdf','xlsx'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0176,0x178));var _0x6017=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0176[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6017('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x6017('0x0')]},'active':{'type':Sequelize[_0x6017('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6017('0x0')],'allowNull':![],'defaultValue':_0x6017('0x2')},'startAt':{'type':Sequelize[_0x6017('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x6017('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x6017('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6017('0x5')](_0x6017('0x6'),_0x6017('0x7'),_0x6017('0x8'),_0x6017('0x9'),_0x6017('0xa'),'hours',_0x6017('0xb')),'allowNull':![],'defaultValue':_0x6017('0xa')},'output':{'type':Sequelize[_0x6017('0x5')](_0x6017('0xc'),_0x6017('0xd'),_0x6017('0xe')),'allowNull':![],'defaultValue':_0x6017('0xc')},'type':{'type':Sequelize[_0x6017('0x5')](_0x6017('0xf'),'default'),'allowNull':![],'defaultValue':_0x6017('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6017('0x10')]},'bcc':{'type':Sequelize[_0x6017('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x6017('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 3a37b23..196a4d3 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 _0x88c7=['fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','update','get','UserProfileResource','destroy','then','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','error','../../config/schedule','run','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x2515a3,_0x356de5){var _0xe8bbb=function(_0x18876b){while(--_0x18876b){_0x2515a3['push'](_0x2515a3['shift']());}};_0xe8bbb(++_0x356de5);}(_0x88c7,0xfa));var _0x788c=function(_0x1cf917,_0x3d66e5){_0x1cf917=_0x1cf917-0x0;var _0x4b1e4e=_0x88c7[_0x1cf917];return _0x4b1e4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x788c('0x0'));var zipdir=require(_0x788c('0x1'));var jsonpatch=require(_0x788c('0x2'));var rp=require(_0x788c('0x3'));var moment=require(_0x788c('0x4'));var BPromise=require(_0x788c('0x5'));var Mustache=require(_0x788c('0x6'));var util=require('util');var path=require(_0x788c('0x7'));var sox=require(_0x788c('0x8'));var csv=require(_0x788c('0x9'));var ejs=require(_0x788c('0xa'));var fs=require('fs');var fs_extra=require(_0x788c('0xb'));var _=require(_0x788c('0xc'));var squel=require('squel');var crypto=require(_0x788c('0xd'));var jsforce=require(_0x788c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x788c('0x9'));var querystring=require(_0x788c('0xf'));var Papa=require(_0x788c('0x10'));var Redis=require(_0x788c('0x11'));var authService=require(_0x788c('0x12'));var qs=require(_0x788c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x788c('0x14'));var logger=require(_0x788c('0x15'))(_0x788c('0x16'));var utils=require('../../config/utils');var config=require(_0x788c('0x17'));var licenseUtil=require(_0x788c('0x18'));var db=require(_0x788c('0x19'))['db'];function respondWithStatusCode(_0x5ad1da,_0x115c78){_0x115c78=_0x115c78||0xcc;return function(_0x45e35c){if(_0x45e35c){return _0x5ad1da[_0x788c('0x1a')](_0x115c78);}return _0x5ad1da[_0x788c('0x1b')](_0x115c78)[_0x788c('0x1c')]();};}function respondWithResult(_0x47b7f3,_0x1a59d4){_0x1a59d4=_0x1a59d4||0xc8;return function(_0x21c06b){if(_0x21c06b){return _0x47b7f3['status'](_0x1a59d4)[_0x788c('0x1d')](_0x21c06b);}};}function respondWithFilteredResult(_0x3e68bf,_0x373189){return function(_0x5e8b70){if(_0x5e8b70){var _0x29d9b1=typeof _0x373189[_0x788c('0x1e')]===_0x788c('0x1f')&&typeof _0x373189['limit']==='undefined';var _0x1e316d=_0x5e8b70['count'];var _0x48afc4=_0x29d9b1?0x0:_0x373189['offset'];var _0x3e0992=_0x29d9b1?_0x5e8b70[_0x788c('0x20')]:_0x373189[_0x788c('0x1e')]+_0x373189['limit'];var _0xb85545;if(_0x3e0992>=_0x1e316d){_0x3e0992=_0x1e316d;_0xb85545=0xc8;}else{_0xb85545=0xce;}_0x3e68bf['status'](_0xb85545);return _0x3e68bf[_0x788c('0x21')](_0x788c('0x22'),_0x48afc4+'-'+_0x3e0992+'/'+_0x1e316d)[_0x788c('0x1d')](_0x5e8b70);}return null;};}function patchUpdates(_0x6d63ef){return function(_0xfa4774){try{jsonpatch['apply'](_0xfa4774,_0x6d63ef,!![]);}catch(_0x536360){return BPromise['reject'](_0x536360);}return _0xfa4774[_0x788c('0x23')]();};}function saveUpdates(_0xeedd2f,_0x2cf2a7){return function(_0x7d94fe){if(_0x7d94fe){return _0x7d94fe[_0x788c('0x24')](_0xeedd2f)['then'](function(_0x20b8f9){return _0x20b8f9;});}return null;};}function removeEntity(_0x1b34e4,_0x38a5e5){return function(_0x4fb7fe){if(_0x4fb7fe){return _0x4fb7fe['destroy']()['then'](function(){var _0x5cfce2=_0x4fb7fe[_0x788c('0x25')]({'plain':!![]});var _0x378dac='Scheduler';return db[_0x788c('0x26')][_0x788c('0x27')]({'where':{'type':_0x378dac,'resourceId':_0x5cfce2['id']}})[_0x788c('0x28')](function(){return _0x4fb7fe;});})[_0x788c('0x28')](function(){_0x1b34e4['status'](0xcc)[_0x788c('0x1c')]();});}};}function handleEntityNotFound(_0x1a9dca,_0x3026da){return function(_0x226902){if(!_0x226902){_0x1a9dca[_0x788c('0x1a')](0x194);}return _0x226902;};}function handleError(_0x4a7cd6,_0x13374c){_0x13374c=_0x13374c||0x1f4;return function(_0xc763f8){logger['error'](_0xc763f8['stack']);if(_0xc763f8['name']){delete _0xc763f8[_0x788c('0x29')];}_0x4a7cd6[_0x788c('0x1b')](_0x13374c)[_0x788c('0x2a')](_0xc763f8);};}exports[_0x788c('0x2b')]=function(_0x44398e,_0x54bc31){var _0x1d8a67={},_0x3b3746={},_0x3da6e3={'count':0x0,'rows':[]};var _0x541ceb=_[_0x788c('0x2c')](db[_0x788c('0x2d')][_0x788c('0x2e')],function(_0xf89d37){return{'name':_0xf89d37[_0x788c('0x2f')],'type':_0xf89d37[_0x788c('0x30')][_0x788c('0x31')]};});_0x3b3746['model']=_[_0x788c('0x2c')](_0x541ceb,'name');_0x3b3746[_0x788c('0x32')]=_['keys'](_0x44398e[_0x788c('0x32')]);_0x3b3746[_0x788c('0x33')]=_[_0x788c('0x34')](_0x3b3746['model'],_0x3b3746['query']);_0x1d8a67['attributes']=_[_0x788c('0x34')](_0x3b3746['model'],qs[_0x788c('0x35')](_0x44398e['query'][_0x788c('0x35')]));_0x1d8a67['attributes']=_0x1d8a67[_0x788c('0x36')][_0x788c('0x37')]?_0x1d8a67[_0x788c('0x36')]:_0x3b3746[_0x788c('0x38')];if(!_0x44398e['query'][_0x788c('0x39')](_0x788c('0x3a'))){_0x1d8a67['limit']=qs['limit'](_0x44398e[_0x788c('0x32')][_0x788c('0x3b')]);_0x1d8a67['offset']=qs['offset'](_0x44398e[_0x788c('0x32')][_0x788c('0x1e')]);}_0x1d8a67[_0x788c('0x3c')]=qs[_0x788c('0x3d')](_0x44398e[_0x788c('0x32')][_0x788c('0x3d')]);_0x1d8a67['where']=qs['filters'](_['pick'](_0x44398e[_0x788c('0x32')],_0x3b3746[_0x788c('0x33')]),_0x541ceb);if(_0x44398e['query'][_0x788c('0x3e')]){_0x1d8a67[_0x788c('0x3f')]=_[_0x788c('0x40')](_0x1d8a67[_0x788c('0x3f')],{'$or':_['map'](_0x541ceb,function(_0x184536){if(_0x184536[_0x788c('0x30')]!==_0x788c('0x41')){var _0x592360={};_0x592360[_0x184536['name']]={'$like':'%'+_0x44398e[_0x788c('0x32')][_0x788c('0x3e')]+'%'};return _0x592360;}})});}_0x1d8a67=_[_0x788c('0x40')]({},_0x1d8a67,_0x44398e[_0x788c('0x42')]);var _0x1d928e={'where':_0x1d8a67[_0x788c('0x3f')]};return db['Schedule'][_0x788c('0x20')](_0x1d928e)['then'](function(_0x586992){_0x3da6e3[_0x788c('0x20')]=_0x586992;if(_0x44398e['query'][_0x788c('0x43')]){_0x1d8a67['include']=[{'all':!![]}];}return db[_0x788c('0x2d')][_0x788c('0x44')](_0x1d8a67);})['then'](function(_0x50fad0){_0x3da6e3[_0x788c('0x45')]=_0x50fad0;return _0x3da6e3;})[_0x788c('0x28')](respondWithFilteredResult(_0x54bc31,_0x1d8a67))[_0x788c('0x46')](handleError(_0x54bc31,null));};exports[_0x788c('0x47')]=function(_0xa31550,_0x382a6c){var _0x58e8e0={'raw':![],'where':{'id':_0xa31550[_0x788c('0x48')]['id']}},_0x227478={};_0x227478[_0x788c('0x38')]=_[_0x788c('0x49')](db[_0x788c('0x2d')][_0x788c('0x2e')]);_0x227478[_0x788c('0x32')]=_[_0x788c('0x49')](_0xa31550['query']);_0x227478[_0x788c('0x33')]=_[_0x788c('0x34')](_0x227478['model'],_0x227478[_0x788c('0x32')]);_0x58e8e0[_0x788c('0x36')]=_['intersection'](_0x227478['model'],qs[_0x788c('0x35')](_0xa31550[_0x788c('0x32')][_0x788c('0x35')]));_0x58e8e0[_0x788c('0x36')]=_0x58e8e0[_0x788c('0x36')][_0x788c('0x37')]?_0x58e8e0['attributes']:_0x227478['model'];if(_0xa31550[_0x788c('0x32')][_0x788c('0x43')]){_0x58e8e0['include']=[{'all':!![]}];}_0x58e8e0=_['merge']({},_0x58e8e0,_0xa31550[_0x788c('0x42')]);return db['Schedule'][_0x788c('0x4a')](_0x58e8e0)[_0x788c('0x28')](handleEntityNotFound(_0x382a6c,null))['then'](respondWithResult(_0x382a6c,null))['catch'](handleError(_0x382a6c,null));};exports[_0x788c('0x4b')]=function(_0x310f68,_0x55186c){return db[_0x788c('0x2d')]['create'](_0x310f68[_0x788c('0x4c')],{})['then'](function(_0x1b8b10){var _0x184306=_0x310f68[_0x788c('0x4d')]['get']({'plain':!![]});if(!_0x184306)throw new Error(_0x788c('0x4e'));if(_0x184306[_0x788c('0x4f')]==='user'){var _0x203645=_0x1b8b10[_0x788c('0x25')]({'plain':!![]});var _0x2a21fa=_0x788c('0x50');return db[_0x788c('0x51')][_0x788c('0x4a')]({'where':{'name':_0x2a21fa,'userProfileId':_0x184306[_0x788c('0x52')]},'raw':!![]})['then'](function(_0x2482d1){if(_0x2482d1&&_0x2482d1[_0x788c('0x53')]===0x0){return db[_0x788c('0x26')][_0x788c('0x4b')]({'name':_0x203645[_0x788c('0x29')],'resourceId':_0x203645['id'],'type':_0x2482d1[_0x788c('0x29')],'sectionId':_0x2482d1['id']},{})['then'](function(){return _0x1b8b10;});}else{return _0x1b8b10;}})['catch'](function(_0x49b17c){logger[_0x788c('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49b17c);throw _0x49b17c;});}return _0x1b8b10;})[_0x788c('0x28')](respondWithResult(_0x55186c,0xc9))[_0x788c('0x46')](handleError(_0x55186c,null));};exports['update']=function(_0x5a15d9,_0x4331fa){if(_0x5a15d9[_0x788c('0x4c')]['id']){delete _0x5a15d9[_0x788c('0x4c')]['id'];}return db[_0x788c('0x2d')][_0x788c('0x4a')]({'where':{'id':_0x5a15d9[_0x788c('0x48')]['id']}})['then'](handleEntityNotFound(_0x4331fa,null))['then'](saveUpdates(_0x5a15d9[_0x788c('0x4c')],null))[_0x788c('0x28')](respondWithResult(_0x4331fa,null))['catch'](handleError(_0x4331fa,null));};exports[_0x788c('0x27')]=function(_0x3929c8,_0x7f70f6){return db[_0x788c('0x2d')][_0x788c('0x4a')]({'where':{'id':_0x3929c8[_0x788c('0x48')]['id']}})['then'](handleEntityNotFound(_0x7f70f6,null))[_0x788c('0x28')](removeEntity(_0x7f70f6,null))['catch'](handleError(_0x7f70f6,null));};exports['run']=function(_0x28b5e2,_0x2711f7,_0xe3c501){var _0x9b347c=require(_0x788c('0x55'));return db[_0x788c('0x2d')][_0x788c('0x4a')]({'where':{'id':_0x28b5e2[_0x788c('0x48')]['id']},'raw':!![]})[_0x788c('0x28')](handleEntityNotFound(_0x2711f7,null))['then'](function(){_0x9b347c[_0x788c('0x56')](_0x28b5e2[_0x788c('0x48')]['id']);})[_0x788c('0x28')](respondWithStatusCode(_0x2711f7,null))[_0x788c('0x46')](handleError(_0x2711f7,null));}; \ No newline at end of file +var _0xc0e7=['name','send','index','map','Schedule','rawAttributes','model','query','keys','filters','fields','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','attributes','intersection','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','../../config/schedule','run','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','destroy','then','get','Scheduler','error'];(function(_0x2c3cd5,_0x2686e4){var _0x6d9643=function(_0x157831){while(--_0x157831){_0x2c3cd5['push'](_0x2c3cd5['shift']());}};_0x6d9643(++_0x2686e4);}(_0xc0e7,0x15a));var _0x7c0e=function(_0x2cd04a,_0x3ffc34){_0x2cd04a=_0x2cd04a-0x0;var _0x2659fe=_0xc0e7[_0x2cd04a];return _0x2659fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c0e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c0e('0x1'));var rp=require(_0x7c0e('0x2'));var moment=require(_0x7c0e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7c0e('0x4'));var util=require(_0x7c0e('0x5'));var path=require(_0x7c0e('0x6'));var sox=require(_0x7c0e('0x7'));var csv=require(_0x7c0e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c0e('0x9'));var _=require('lodash');var squel=require(_0x7c0e('0xa'));var crypto=require(_0x7c0e('0xb'));var jsforce=require(_0x7c0e('0xc'));var deskjs=require(_0x7c0e('0xd'));var toCsv=require(_0x7c0e('0x8'));var querystring=require(_0x7c0e('0xe'));var Papa=require('papaparse');var Redis=require(_0x7c0e('0xf'));var authService=require(_0x7c0e('0x10'));var qs=require(_0x7c0e('0x11'));var as=require(_0x7c0e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c0e('0x13'))(_0x7c0e('0x14'));var utils=require(_0x7c0e('0x15'));var config=require(_0x7c0e('0x16'));var licenseUtil=require(_0x7c0e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6fc8c8,_0x613304){_0x613304=_0x613304||0xcc;return function(_0x2a08f9){if(_0x2a08f9){return _0x6fc8c8[_0x7c0e('0x18')](_0x613304);}return _0x6fc8c8[_0x7c0e('0x19')](_0x613304)[_0x7c0e('0x1a')]();};}function respondWithResult(_0x49e79a,_0x57e97a){_0x57e97a=_0x57e97a||0xc8;return function(_0xd2dabe){if(_0xd2dabe){return _0x49e79a[_0x7c0e('0x19')](_0x57e97a)['json'](_0xd2dabe);}};}function respondWithFilteredResult(_0x4b528e,_0x276f51){return function(_0x497db1){if(_0x497db1){var _0x301036=typeof _0x276f51[_0x7c0e('0x1b')]===_0x7c0e('0x1c')&&typeof _0x276f51['limit']===_0x7c0e('0x1c');var _0x4a357e=_0x497db1[_0x7c0e('0x1d')];var _0x485ec4=_0x301036?0x0:_0x276f51[_0x7c0e('0x1b')];var _0x55c9c9=_0x301036?_0x497db1[_0x7c0e('0x1d')]:_0x276f51[_0x7c0e('0x1b')]+_0x276f51[_0x7c0e('0x1e')];var _0xb513cf;if(_0x55c9c9>=_0x4a357e){_0x55c9c9=_0x4a357e;_0xb513cf=0xc8;}else{_0xb513cf=0xce;}_0x4b528e[_0x7c0e('0x19')](_0xb513cf);return _0x4b528e[_0x7c0e('0x1f')](_0x7c0e('0x20'),_0x485ec4+'-'+_0x55c9c9+'/'+_0x4a357e)['json'](_0x497db1);}return null;};}function patchUpdates(_0x31540f){return function(_0x41c4c0){try{jsonpatch['apply'](_0x41c4c0,_0x31540f,!![]);}catch(_0x124613){return BPromise[_0x7c0e('0x21')](_0x124613);}return _0x41c4c0['save']();};}function saveUpdates(_0x409baf,_0x54bf1c){return function(_0x29c1af){if(_0x29c1af){return _0x29c1af['update'](_0x409baf)['then'](function(_0x3682ed){return _0x3682ed;});}return null;};}function removeEntity(_0xa0625,_0x355e2d){return function(_0x56a24c){if(_0x56a24c){return _0x56a24c[_0x7c0e('0x22')]()[_0x7c0e('0x23')](function(){var _0x35195a=_0x56a24c[_0x7c0e('0x24')]({'plain':!![]});var _0x38f4f8=_0x7c0e('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x38f4f8,'resourceId':_0x35195a['id']}})[_0x7c0e('0x23')](function(){return _0x56a24c;});})[_0x7c0e('0x23')](function(){_0xa0625[_0x7c0e('0x19')](0xcc)[_0x7c0e('0x1a')]();});}};}function handleEntityNotFound(_0x31873f,_0x57a527){return function(_0x2abe78){if(!_0x2abe78){_0x31873f[_0x7c0e('0x18')](0x194);}return _0x2abe78;};}function handleError(_0x232e6e,_0x1aa9bd){_0x1aa9bd=_0x1aa9bd||0x1f4;return function(_0xb95146){logger[_0x7c0e('0x26')](_0xb95146['stack']);if(_0xb95146[_0x7c0e('0x27')]){delete _0xb95146['name'];}_0x232e6e[_0x7c0e('0x19')](_0x1aa9bd)[_0x7c0e('0x28')](_0xb95146);};}exports[_0x7c0e('0x29')]=function(_0x3a4659,_0x19fb52){var _0x74e0e7={},_0x197c44={},_0x21f4d0={'count':0x0,'rows':[]};var _0x333d9c=_[_0x7c0e('0x2a')](db[_0x7c0e('0x2b')][_0x7c0e('0x2c')],function(_0x1f4ba0){return{'name':_0x1f4ba0['fieldName'],'type':_0x1f4ba0['type']['key']};});_0x197c44[_0x7c0e('0x2d')]=_['map'](_0x333d9c,_0x7c0e('0x27'));_0x197c44[_0x7c0e('0x2e')]=_[_0x7c0e('0x2f')](_0x3a4659['query']);_0x197c44[_0x7c0e('0x30')]=_['intersection'](_0x197c44['model'],_0x197c44[_0x7c0e('0x2e')]);_0x74e0e7['attributes']=_['intersection'](_0x197c44[_0x7c0e('0x2d')],qs['fields'](_0x3a4659[_0x7c0e('0x2e')][_0x7c0e('0x31')]));_0x74e0e7['attributes']=_0x74e0e7['attributes']['length']?_0x74e0e7['attributes']:_0x197c44[_0x7c0e('0x2d')];if(!_0x3a4659[_0x7c0e('0x2e')]['hasOwnProperty']('nolimit')){_0x74e0e7[_0x7c0e('0x1e')]=qs['limit'](_0x3a4659[_0x7c0e('0x2e')]['limit']);_0x74e0e7[_0x7c0e('0x1b')]=qs[_0x7c0e('0x1b')](_0x3a4659[_0x7c0e('0x2e')]['offset']);}_0x74e0e7['order']=qs[_0x7c0e('0x32')](_0x3a4659['query']['sort']);_0x74e0e7[_0x7c0e('0x33')]=qs[_0x7c0e('0x30')](_['pick'](_0x3a4659['query'],_0x197c44[_0x7c0e('0x30')]),_0x333d9c);if(_0x3a4659[_0x7c0e('0x2e')][_0x7c0e('0x34')]){_0x74e0e7[_0x7c0e('0x33')]=_[_0x7c0e('0x35')](_0x74e0e7[_0x7c0e('0x33')],{'$or':_[_0x7c0e('0x2a')](_0x333d9c,function(_0x5873d7){if(_0x5873d7['type']!==_0x7c0e('0x36')){var _0x11d8e3={};_0x11d8e3[_0x5873d7[_0x7c0e('0x27')]]={'$like':'%'+_0x3a4659['query']['filter']+'%'};return _0x11d8e3;}})});}_0x74e0e7=_[_0x7c0e('0x35')]({},_0x74e0e7,_0x3a4659[_0x7c0e('0x37')]);var _0xb144a={'where':_0x74e0e7[_0x7c0e('0x33')]};return db['Schedule'][_0x7c0e('0x1d')](_0xb144a)[_0x7c0e('0x23')](function(_0x28b481){_0x21f4d0[_0x7c0e('0x1d')]=_0x28b481;if(_0x3a4659['query'][_0x7c0e('0x38')]){_0x74e0e7[_0x7c0e('0x39')]=[{'all':!![]}];}return db[_0x7c0e('0x2b')][_0x7c0e('0x3a')](_0x74e0e7);})['then'](function(_0x5a8e15){_0x21f4d0['rows']=_0x5a8e15;return _0x21f4d0;})['then'](respondWithFilteredResult(_0x19fb52,_0x74e0e7))['catch'](handleError(_0x19fb52,null));};exports['show']=function(_0x1e9258,_0x194c48){var _0x1c937f={'raw':![],'where':{'id':_0x1e9258[_0x7c0e('0x3b')]['id']}},_0x36d281={};_0x36d281[_0x7c0e('0x2d')]=_[_0x7c0e('0x2f')](db[_0x7c0e('0x2b')][_0x7c0e('0x2c')]);_0x36d281[_0x7c0e('0x2e')]=_[_0x7c0e('0x2f')](_0x1e9258[_0x7c0e('0x2e')]);_0x36d281[_0x7c0e('0x30')]=_['intersection'](_0x36d281['model'],_0x36d281['query']);_0x1c937f[_0x7c0e('0x3c')]=_[_0x7c0e('0x3d')](_0x36d281[_0x7c0e('0x2d')],qs[_0x7c0e('0x31')](_0x1e9258['query'][_0x7c0e('0x31')]));_0x1c937f['attributes']=_0x1c937f['attributes']['length']?_0x1c937f['attributes']:_0x36d281['model'];if(_0x1e9258['query']['includeAll']){_0x1c937f[_0x7c0e('0x39')]=[{'all':!![]}];}_0x1c937f=_[_0x7c0e('0x35')]({},_0x1c937f,_0x1e9258['options']);return db[_0x7c0e('0x2b')]['find'](_0x1c937f)[_0x7c0e('0x23')](handleEntityNotFound(_0x194c48,null))['then'](respondWithResult(_0x194c48,null))[_0x7c0e('0x3e')](handleError(_0x194c48,null));};exports[_0x7c0e('0x3f')]=function(_0xb3d3a4,_0xe90a4){return db[_0x7c0e('0x2b')][_0x7c0e('0x3f')](_0xb3d3a4[_0x7c0e('0x40')],{})['then'](function(_0x117d3f){var _0xe48066=_0xb3d3a4[_0x7c0e('0x41')][_0x7c0e('0x24')]({'plain':!![]});if(!_0xe48066)throw new Error(_0x7c0e('0x42'));if(_0xe48066[_0x7c0e('0x43')]===_0x7c0e('0x41')){var _0x3081b1=_0x117d3f[_0x7c0e('0x24')]({'plain':!![]});var _0x355a8b='Scheduler';return db[_0x7c0e('0x44')]['find']({'where':{'name':_0x355a8b,'userProfileId':_0xe48066[_0x7c0e('0x45')]},'raw':!![]})[_0x7c0e('0x23')](function(_0x5b883b){if(_0x5b883b&&_0x5b883b[_0x7c0e('0x46')]===0x0){return db[_0x7c0e('0x47')]['create']({'name':_0x3081b1[_0x7c0e('0x27')],'resourceId':_0x3081b1['id'],'type':_0x5b883b[_0x7c0e('0x27')],'sectionId':_0x5b883b['id']},{})[_0x7c0e('0x23')](function(){return _0x117d3f;});}else{return _0x117d3f;}})[_0x7c0e('0x3e')](function(_0x4ae4a8){logger[_0x7c0e('0x26')](_0x7c0e('0x48'),_0x4ae4a8);throw _0x4ae4a8;});}return _0x117d3f;})[_0x7c0e('0x23')](respondWithResult(_0xe90a4,0xc9))[_0x7c0e('0x3e')](handleError(_0xe90a4,null));};exports[_0x7c0e('0x49')]=function(_0x3fecae,_0x5cb808){if(_0x3fecae[_0x7c0e('0x40')]['id']){delete _0x3fecae['body']['id'];}return db[_0x7c0e('0x2b')][_0x7c0e('0x4a')]({'where':{'id':_0x3fecae['params']['id']}})[_0x7c0e('0x23')](handleEntityNotFound(_0x5cb808,null))[_0x7c0e('0x23')](saveUpdates(_0x3fecae['body'],null))[_0x7c0e('0x23')](respondWithResult(_0x5cb808,null))[_0x7c0e('0x3e')](handleError(_0x5cb808,null));};exports[_0x7c0e('0x22')]=function(_0x53bbca,_0x49d06b){return db[_0x7c0e('0x2b')][_0x7c0e('0x4a')]({'where':{'id':_0x53bbca['params']['id']}})[_0x7c0e('0x23')](handleEntityNotFound(_0x49d06b,null))['then'](removeEntity(_0x49d06b,null))['catch'](handleError(_0x49d06b,null));};exports['run']=function(_0xbb1052,_0x18c7c1,_0x25735b){var _0x2ff10c=require(_0x7c0e('0x4b'));return db[_0x7c0e('0x2b')]['find']({'where':{'id':_0xbb1052[_0x7c0e('0x3b')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x18c7c1,null))['then'](function(){_0x2ff10c[_0x7c0e('0x4c')](_0xbb1052['params']['id']);})[_0x7c0e('0x23')](respondWithStatusCode(_0x18c7c1,null))[_0x7c0e('0x3e')](handleError(_0x18c7c1,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index d53f4e9..0da4607 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 _0xd463=['request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','api','moment','bluebird'];(function(_0x467f09,_0x496f4c){var _0x1f8db5=function(_0x345dbc){while(--_0x345dbc){_0x467f09['push'](_0x467f09['shift']());}};_0x1f8db5(++_0x496f4c);}(_0xd463,0x18e));var _0x3d46=function(_0x3144b3,_0x45f961){_0x3144b3=_0x3144b3-0x0;var _0x2517a9=_0xd463[_0x3144b3];return _0x2517a9;};'use strict';var _=require(_0x3d46('0x0'));var util=require(_0x3d46('0x1'));var logger=require('../../config/logger')(_0x3d46('0x2'));var moment=require(_0x3d46('0x3'));var BPromise=require(_0x3d46('0x4'));var rp=require(_0x3d46('0x5'));var fs=require('fs');var path=require(_0x3d46('0x6'));var rimraf=require(_0x3d46('0x7'));var config=require(_0x3d46('0x8'));var attributes=require(_0x3d46('0x9'));module[_0x3d46('0xa')]=function(_0x45a863,_0x5e007a){return _0x45a863[_0x3d46('0xb')]('Schedule',attributes,{'tableName':_0x3d46('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf004=['path','../../config/environment','exports','Schedule','tools_schedules','util','../../config/logger','api','moment'];(function(_0x406800,_0x33f731){var _0x44dece=function(_0x331aaa){while(--_0x331aaa){_0x406800['push'](_0x406800['shift']());}};_0x44dece(++_0x33f731);}(_0xf004,0x17f));var _0x4f00=function(_0x212953,_0x1a5ac6){_0x212953=_0x212953-0x0;var _0x21d7eb=_0xf004[_0x212953];return _0x21d7eb;};'use strict';var _=require('lodash');var util=require(_0x4f00('0x0'));var logger=require(_0x4f00('0x1'))(_0x4f00('0x2'));var moment=require(_0x4f00('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f00('0x4'));var rimraf=require('rimraf');var config=require(_0x4f00('0x5'));var attributes=require('./schedule.attributes');module[_0x4f00('0x6')]=function(_0x2bc676,_0x448af5){return _0x2bc676['define'](_0x4f00('0x7'),attributes,{'tableName':_0x4f00('0x8'),'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 e3266a8..3af815f 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 _0xf753=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','request\x20sent','stringify','code','error','Schedule,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf753,0xe6));var _0x3f75=function(_0x57cc22,_0x2d351f){_0x57cc22=_0x57cc22-0x0;var _0x6f7bdc=_0xf753[_0x57cc22];return _0x6f7bdc;};'use strict';var _=require(_0x3f75('0x0'));var util=require('util');var moment=require(_0x3f75('0x1'));var BPromise=require(_0x3f75('0x2'));var rs=require(_0x3f75('0x3'));var fs=require('fs');var Redis=require(_0x3f75('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f75('0x5'));var logger=require(_0x3f75('0x6'))('rpc');var config=require(_0x3f75('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3f75('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f343,_0x41d1a2,_0x4c5f82){return new BPromise(function(_0x21cd23,_0x5490d3){return client[_0x3f75('0x9')](_0x17f343,_0x4c5f82)[_0x3f75('0xa')](function(_0x37b419){logger[_0x3f75('0xb')]('Schedule,\x20%s,\x20%s',_0x41d1a2,'request\x20sent');logger[_0x3f75('0xc')]('Schedule,\x20%s,\x20%s,\x20%s',_0x41d1a2,_0x3f75('0xd'),JSON[_0x3f75('0xe')](_0x37b419));if(_0x37b419['error']){if(_0x37b419['error'][_0x3f75('0xf')]===0x1f4){logger[_0x3f75('0x10')](_0x3f75('0x11'),_0x41d1a2,_0x37b419['error'][_0x3f75('0x12')]);return _0x5490d3(_0x37b419[_0x3f75('0x10')]['message']);}logger[_0x3f75('0x10')]('Schedule,\x20%s,\x20%s',_0x41d1a2,_0x37b419[_0x3f75('0x10')][_0x3f75('0x12')]);return _0x21cd23(_0x37b419[_0x3f75('0x10')][_0x3f75('0x12')]);}else{logger[_0x3f75('0xb')]('Schedule,\x20%s,\x20%s',_0x41d1a2,_0x3f75('0xd'));_0x21cd23(_0x37b419[_0x3f75('0x13')][_0x3f75('0x12')]);}})[_0x3f75('0x14')](function(_0x16a426){logger[_0x3f75('0x10')](_0x3f75('0x11'),_0x41d1a2,_0x16a426);_0x5490d3(_0x16a426);});});} \ No newline at end of file +var _0xd8ed=['then','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','info','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xd8ed,0x1bf));var _0xdd8e=function(_0x5f2322,_0x2d64b8){_0x5f2322=_0x5f2322-0x0;var _0x569853=_0xd8ed[_0x5f2322];return _0x569853;};'use strict';var _=require('lodash');var util=require(_0xdd8e('0x0'));var moment=require(_0xdd8e('0x1'));var BPromise=require(_0xdd8e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd8e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd8e('0x4'));var logger=require(_0xdd8e('0x5'))(_0xdd8e('0x6'));var config=require(_0xdd8e('0x7'));var jayson=require(_0xdd8e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a7fc3,_0x5366e0,_0x31a0fb){return new BPromise(function(_0x57719d,_0x471191){return client['request'](_0x4a7fc3,_0x31a0fb)[_0xdd8e('0x9')](function(_0x1367a8){logger['info']('Schedule,\x20%s,\x20%s',_0x5366e0,_0xdd8e('0xa'));logger[_0xdd8e('0xb')](_0xdd8e('0xc'),_0x5366e0,_0xdd8e('0xa'),JSON[_0xdd8e('0xd')](_0x1367a8));if(_0x1367a8[_0xdd8e('0xe')]){if(_0x1367a8[_0xdd8e('0xe')][_0xdd8e('0xf')]===0x1f4){logger[_0xdd8e('0xe')](_0xdd8e('0x10'),_0x5366e0,_0x1367a8[_0xdd8e('0xe')][_0xdd8e('0x11')]);return _0x471191(_0x1367a8[_0xdd8e('0xe')][_0xdd8e('0x11')]);}logger['error'](_0xdd8e('0x10'),_0x5366e0,_0x1367a8[_0xdd8e('0xe')][_0xdd8e('0x11')]);return _0x57719d(_0x1367a8[_0xdd8e('0xe')][_0xdd8e('0x11')]);}else{logger[_0xdd8e('0x12')](_0xdd8e('0x10'),_0x5366e0,_0xdd8e('0xa'));_0x57719d(_0x1367a8['result'][_0xdd8e('0x11')]);}})['catch'](function(_0x41bff1){logger[_0xdd8e('0xe')](_0xdd8e('0x10'),_0x5366e0,_0x41bff1);_0x471191(_0x41bff1);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 07c6659..02c3b4d 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 _0xa6d7=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post'];(function(_0x103ad5,_0x279f7a){var _0x3b687a=function(_0x4881ca){while(--_0x4881ca){_0x103ad5['push'](_0x103ad5['shift']());}};_0x3b687a(++_0x279f7a);}(_0xa6d7,0x12e));var _0x7a6d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa6d7[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7a6d('0x0'));var util=require('util');var path=require(_0x7a6d('0x1'));var timeout=require(_0x7a6d('0x2'));var express=require(_0x7a6d('0x3'));var router=express[_0x7a6d('0x4')]();var fs_extra=require(_0x7a6d('0x5'));var auth=require(_0x7a6d('0x6'));var interaction=require(_0x7a6d('0x7'));var config=require(_0x7a6d('0x8'));var controller=require(_0x7a6d('0x9'));router[_0x7a6d('0xa')]('/',auth['isAuthenticated'](),controller[_0x7a6d('0xb')]);router[_0x7a6d('0xa')](_0x7a6d('0xc'),auth[_0x7a6d('0xd')](),controller[_0x7a6d('0xe')]);router[_0x7a6d('0xa')](_0x7a6d('0xf'),auth[_0x7a6d('0xd')](),controller[_0x7a6d('0x10')]);router[_0x7a6d('0xa')](_0x7a6d('0x11'),auth[_0x7a6d('0xd')](),controller[_0x7a6d('0x12')]);router[_0x7a6d('0x13')]('/',auth[_0x7a6d('0xd')](),controller['create']);router['put'](_0x7a6d('0xf'),auth[_0x7a6d('0xd')](),controller['update']);router[_0x7a6d('0x14')](_0x7a6d('0xf'),auth[_0x7a6d('0xd')](),controller[_0x7a6d('0x15')]);module[_0x7a6d('0x16')]=router; \ No newline at end of file +var _0xbd92=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','create','update','delete','exports'];(function(_0xe70f6c,_0x3b734d){var _0x29d959=function(_0x37c8d9){while(--_0x37c8d9){_0xe70f6c['push'](_0xe70f6c['shift']());}};_0x29d959(++_0x3b734d);}(_0xbd92,0x18c));var _0x2bd9=function(_0x3979bb,_0x3b3af1){_0x3979bb=_0x3979bb-0x0;var _0x3b476c=_0xbd92[_0x3979bb];return _0x3b476c;};'use strict';var multer=require(_0x2bd9('0x0'));var util=require(_0x2bd9('0x1'));var path=require(_0x2bd9('0x2'));var timeout=require(_0x2bd9('0x3'));var express=require('express');var router=express[_0x2bd9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2bd9('0x5'));var interaction=require(_0x2bd9('0x6'));var config=require(_0x2bd9('0x7'));var controller=require(_0x2bd9('0x8'));router[_0x2bd9('0x9')]('/',auth[_0x2bd9('0xa')](),controller[_0x2bd9('0xb')]);router[_0x2bd9('0x9')](_0x2bd9('0xc'),auth[_0x2bd9('0xa')](),controller[_0x2bd9('0xd')]);router[_0x2bd9('0x9')](_0x2bd9('0xe'),auth[_0x2bd9('0xa')](),controller[_0x2bd9('0xf')]);router[_0x2bd9('0x9')](_0x2bd9('0x10'),auth[_0x2bd9('0xa')](),controller['download']);router[_0x2bd9('0x11')]('/',auth[_0x2bd9('0xa')](),controller[_0x2bd9('0x12')]);router['put'](_0x2bd9('0xe'),auth[_0x2bd9('0xa')](),controller[_0x2bd9('0x13')]);router[_0x2bd9('0x14')]('/:id',auth[_0x2bd9('0xa')](),controller['destroy']);module[_0x2bd9('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 5fef71d..32fdbae 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 _0x5b12=['setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','getDataValue','value','STRING','replace'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x5b12,0xa3));var _0x25b1=function(_0x17b332,_0x3da0c4){_0x17b332=_0x17b332-0x0;var _0x5d2dfa=_0x5b12[_0x17b332];return _0x5d2dfa;};'use strict';var Sequelize=require(_0x25b1('0x0'));var moment=require(_0x25b1('0x1'));var path=require(_0x25b1('0x2'));var config=require('../../config/environment');module[_0x25b1('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x25b1('0x4')](_0x25b1('0x5'))?path['extname'](this[_0x25b1('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x25b1('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x5bb95b){var _0x1f715d=_0x5bb95b[_0x25b1('0x7')](/\\/g,'/');this[_0x25b1('0x8')](_0x25b1('0x5'),_0x1f715d);}},'rating':{'type':Sequelize[_0x25b1('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x25b1('0x9')],'set':function(_0x3346ed){this[_0x25b1('0x8')]('startedAt',moment()[_0x25b1('0xa')](_0x3346ed,'ms'));this[_0x25b1('0x8')](_0x25b1('0xb'),moment());this[_0x25b1('0x8')](_0x25b1('0xc'),_0x3346ed);}},'startedAt':{'type':Sequelize[_0x25b1('0xd')],'get':function(){return moment(this[_0x25b1('0x4')](_0x25b1('0xe')))[_0x25b1('0xf')](_0x25b1('0x10'))[_0x25b1('0x11')]();}},'closedAt':{'type':Sequelize[_0x25b1('0xd')],'get':function(){return moment(this[_0x25b1('0x4')](_0x25b1('0xb')))[_0x25b1('0xf')](_0x25b1('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0x25b1('0xd')],'get':function(){return moment(this[_0x25b1('0x4')]('createdAt'))[_0x25b1('0xf')](_0x25b1('0x10'))[_0x25b1('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x25b1('0x12')))['format'](_0x25b1('0x10'))[_0x25b1('0x11')]();}}}; \ No newline at end of file +var _0x4171=['replace','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING'];(function(_0x44459a,_0x5f1491){var _0x2eef2c=function(_0x531b98){while(--_0x531b98){_0x44459a['push'](_0x44459a['shift']());}};_0x2eef2c(++_0x5f1491);}(_0x4171,0x6a));var _0x1417=function(_0x5f583c,_0x5a9bf4){_0x5f583c=_0x5f583c-0x0;var _0x4cce55=_0x4171[_0x5f583c];return _0x4cce55;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1417('0x0'));var path=require(_0x1417('0x1'));var config=require(_0x1417('0x2'));module[_0x1417('0x3')]={'format':{'type':Sequelize[_0x1417('0x4')],'get':function(){return this[_0x1417('0x5')](_0x1417('0x6'))?path['extname'](this[_0x1417('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x1417('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x1417('0x7')],'set':function(_0x35c775){var _0x3e2a7d=_0x35c775[_0x1417('0x8')](/\\/g,'/');this['setDataValue'](_0x1417('0x6'),_0x3e2a7d);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x57f09e){this[_0x1417('0x9')](_0x1417('0xa'),moment()[_0x1417('0xb')](_0x57f09e,'ms'));this[_0x1417('0x9')](_0x1417('0xc'),moment());this[_0x1417('0x9')](_0x1417('0xd'),_0x57f09e);}},'startedAt':{'type':Sequelize[_0x1417('0xe')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x1417('0xf')](_0x1417('0x10'))[_0x1417('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1417('0x5')](_0x1417('0xc')))[_0x1417('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x1417('0x11')]();}},'createdAt':{'type':Sequelize[_0x1417('0xe')],'get':function(){return moment(this[_0x1417('0x5')](_0x1417('0x12')))[_0x1417('0xf')](_0x1417('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0x1417('0xe')],'get':function(){return moment(this[_0x1417('0x5')]('updatedAt'))[_0x1417('0xf')](_0x1417('0x10'))[_0x1417('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a62654f..14e619b 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 _0x8958=['pick','merge','VIRTUAL','filter','options','ScreenRecording','include','findAll','params','rawAttributes','includeAll','create','catch','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2510c4,_0x23ead0){var _0x23c053=function(_0x277371){while(--_0x277371){_0x2510c4['push'](_0x2510c4['shift']());}};_0x23c053(++_0x23ead0);}(_0x8958,0x93));var _0x8895=function(_0x41159b,_0x18ae88){_0x41159b=_0x41159b-0x0;var _0x5bea4e=_0x8958[_0x41159b];return _0x5bea4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['ScreenRecording']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['differenceBy'](_[_0x8895('0x29')](_0x16b65b,'name'),[_0x8895('0x2e')]);_0x37ac3a['query']=_[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x30')]);_0x37ac3a[_0x8895('0x31')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a['query']);_0x6e449d[_0x8895('0x33')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x5c03ea[_0x8895('0x30')]['fields']));_0x6e449d[_0x8895('0x33')]=_0x6e449d['attributes'][_0x8895('0x35')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea[_0x8895('0x30')][_0x8895('0x36')](_0x8895('0x37'))){_0x6e449d[_0x8895('0x1d')]=qs['limit'](_0x5c03ea[_0x8895('0x30')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs[_0x8895('0x1f')](_0x5c03ea[_0x8895('0x30')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x38')]=qs[_0x8895('0x39')](_0x5c03ea['query'][_0x8895('0x39')]);_0x6e449d[_0x8895('0x3a')]=qs['filters'](_[_0x8895('0x3b')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x31')]),_0x16b65b);if(_0x5c03ea[_0x8895('0x30')]['filter']){_0x6e449d[_0x8895('0x3a')]=_[_0x8895('0x3c')](_0x6e449d['where'],{'$or':_['map'](_0x16b65b,function(_0x202130){if(_0x202130[_0x8895('0x2b')]!==_0x8895('0x3d')){var _0x331a9e={};_0x331a9e[_0x202130[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea['query'][_0x8895('0x3e')]+'%'};return _0x331a9e;}})});}_0x6e449d=_[_0x8895('0x3c')]({},_0x6e449d,_0x5c03ea[_0x8895('0x3f')]);var _0x10005f={'where':_0x6e449d[_0x8895('0x3a')]};return db[_0x8895('0x40')]['count'](_0x10005f)[_0x8895('0x24')](function(_0x5ebfc4){_0x3fc4cc[_0x8895('0x1e')]=_0x5ebfc4;if(_0x5c03ea[_0x8895('0x30')]['includeAll']){_0x6e449d[_0x8895('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8895('0x42')](_0x6e449d);})['then'](function(_0x4af3b1){_0x3fc4cc['rows']=_0x4af3b1;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x447ed6,_0x206f57){var _0x596531={'raw':![],'where':{'id':_0x447ed6[_0x8895('0x43')]['id']}},_0x4835d7={};_0x4835d7[_0x8895('0x2d')]=_['keys'](db[_0x8895('0x40')][_0x8895('0x44')]);_0x4835d7[_0x8895('0x30')]=_[_0x8895('0x2f')](_0x447ed6[_0x8895('0x30')]);_0x4835d7['filters']=_['intersection'](_0x4835d7['model'],_0x4835d7[_0x8895('0x30')]);_0x596531['attributes']=_[_0x8895('0x32')](_0x4835d7[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x447ed6[_0x8895('0x30')]['fields']));_0x596531[_0x8895('0x33')]=_0x596531[_0x8895('0x33')][_0x8895('0x35')]?_0x596531[_0x8895('0x33')]:_0x4835d7[_0x8895('0x2d')];if(_0x447ed6[_0x8895('0x30')][_0x8895('0x45')]){_0x596531[_0x8895('0x41')]=[{'all':!![]}];}_0x596531=_['merge']({},_0x596531,_0x447ed6[_0x8895('0x3f')]);return db[_0x8895('0x40')]['find'](_0x596531)[_0x8895('0x24')](handleEntityNotFound(_0x206f57,null))['then'](respondWithResult(_0x206f57,null))['catch'](handleError(_0x206f57,null));};exports[_0x8895('0x46')]=function(_0x337a9f,_0x130018){return db['ScreenRecording'][_0x8895('0x46')](_0x337a9f['body'],{})[_0x8895('0x24')](respondWithResult(_0x130018,0xc9))[_0x8895('0x47')](handleError(_0x130018,null));};exports[_0x8895('0x23')]=function(_0x1ca539,_0x2f3bf1){if(_0x1ca539[_0x8895('0x48')]['id']){delete _0x1ca539[_0x8895('0x48')]['id'];}delete _0x1ca539['body']['duration'];delete _0x1ca539[_0x8895('0x48')][_0x8895('0x49')];delete _0x1ca539['body'][_0x8895('0x4a')];delete _0x1ca539['body']['value'];return db[_0x8895('0x40')]['find']({'where':{'id':_0x1ca539[_0x8895('0x43')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2f3bf1,null))[_0x8895('0x24')](saveUpdates(_0x1ca539[_0x8895('0x48')],null))[_0x8895('0x24')](respondWithResult(_0x2f3bf1,null))[_0x8895('0x47')](handleError(_0x2f3bf1,null));};exports[_0x8895('0x4b')]=function(_0x38d6ae,_0x583419){return db[_0x8895('0x40')][_0x8895('0x4b')]()[_0x8895('0x24')](respondWithResult(_0x583419,null))['catch'](handleError(_0x583419,null));};exports[_0x8895('0x4c')]=function(_0x3935fd,_0xd7ffeb,_0x14e769){var _0x1e264a=require(_0x8895('0x4d'));var _0x434ab8=![];var _0x216e6e={};if(_0x3935fd[_0x8895('0x30')][_0x8895('0x2b')]&&_0x3935fd['query'][_0x8895('0x2b')]===_0x8895('0x4e')){_0x216e6e[_0x8895('0x4e')]=_0x3935fd[_0x8895('0x43')]['id'];}else{_0x216e6e['id']=_0x3935fd[_0x8895('0x43')]['id'];}return db['ScreenRecording'][_0x8895('0x4f')]({'where':_0x216e6e,'attributes':['id',_0x8895('0x50')],'raw':!![]})[_0x8895('0x24')](handleEntityNotFound(_0xd7ffeb,null))[_0x8895('0x24')](function(_0x37a7b4){if(_0x37a7b4){var _0x58dd6c=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x37a7b4['value']);var _0x20422f=util[_0x8895('0x2e')](_0x8895('0x54'),_0x58dd6c);if(fs['existsSync'](_0x20422f)){_0x434ab8=!![];return _0x1e264a[_0x8895('0x55')](_0x20422f,_0x58dd6c,config[_0x8895('0x56')]['recording'])[_0x8895('0x24')](function(){return _0x37a7b4;});}return _0x37a7b4;}})[_0x8895('0x24')](function(_0x5198f8){if(_0x5198f8){var _0x2f990a=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x5198f8['value']);if(!fs['existsSync'](_0x2f990a)){throw new db[(_0x8895('0x57'))][(_0x8895('0x58'))](_0x8895('0x59'));}if(_0x5198f8['filename']){return _0xd7ffeb[_0x8895('0x4c')](_0x2f990a,_0x5198f8[_0x8895('0x5a')]+path['extname'](_0x2f990a),function(){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}else{return _0xd7ffeb['download'](_0x2f990a,function(_0x435e36){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}}})[_0x8895('0x47')](function(_0x14f8a4){if(_0x14f8a4[_0x8895('0x5c')]==='ScreenRecording\x20not\x20found'){_0xd7ffeb['status'](0x194)[_0x8895('0x27')](_0x8895('0x5d'));}else{return handleError(_0xd7ffeb,null);}});};exports['destroy']=function(_0x46f8ae,_0x131476){return db[_0x8895('0x40')][_0x8895('0x4f')]({'where':{'id':_0x46f8ae['params']['id']}})[_0x8895('0x24')](function(_0x2d2bf9){if(_[_0x8895('0x5e')](_0x2d2bf9)){throw new ReferenceError(_0x8895('0x5f'));}return _0x2d2bf9;})[_0x8895('0x24')](function(_0x41a2fe){var _0x261d4b=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x41a2fe[_0x8895('0x50')]);logger[_0x8895('0x60')](_0x8895('0x61'),_0x261d4b);if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger['info']('File:\x20\x22'+_0x261d4b+_0x8895('0x62'));fs[_0x8895('0x63')](_0x261d4b);}_0x261d4b=_0x261d4b+_0x8895('0x64');if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger[_0x8895('0x60')](_0x8895('0x65')+_0x261d4b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8895('0x63')](_0x261d4b);}return _0x41a2fe;})[_0x8895('0x24')](function(_0xf51f48){if(!_0xf51f48)throw new InternalError();return _0xf51f48[_0x8895('0x66')]();})[_0x8895('0x24')](function(){_0x131476['status'](0xcc)[_0x8895('0x1a')]();})[_0x8895('0x47')](handleError(_0x131476,null));}; \ No newline at end of file +var _0x3e74=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','catch','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','decryptFile','secrets','server/files/screen_recordings','Sequelize','ValidationError','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','existsSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox'];(function(_0x57d9d9,_0x2f40a7){var _0xa249e8=function(_0xfbd448){while(--_0xfbd448){_0x57d9d9['push'](_0x57d9d9['shift']());}};_0xa249e8(++_0x2f40a7);}(_0x3e74,0x175));var _0x43e7=function(_0x445ac2,_0x4ed0c8){_0x445ac2=_0x445ac2-0x0;var _0x407ed0=_0x3e74[_0x445ac2];return _0x407ed0;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_[_0x43e7('0x27')](_0x50f9f5,'name'),[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0xb1fc63[_0x43e7('0x30')]);_0x4690a6[_0x43e7('0x32')]=_['intersection'](_0x4690a6[_0x43e7('0x2d')],_0x4690a6[_0x43e7('0x30')]);_0x33a1a5[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x4690a6['model'],qs['fields'](_0xb1fc63['query'][_0x43e7('0x35')]));_0x33a1a5[_0x43e7('0x33')]=_0x33a1a5[_0x43e7('0x33')][_0x43e7('0x36')]?_0x33a1a5[_0x43e7('0x33')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63['query']['hasOwnProperty']('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5[_0x43e7('0x19')]=qs['offset'](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x19')]);}_0x33a1a5[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x38')]);_0x33a1a5[_0x43e7('0x39')]=qs['filters'](_['pick'](_0xb1fc63['query'],_0x4690a6[_0x43e7('0x32')]),_0x50f9f5);if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x39')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x39')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x2ffd43){if(_0x2ffd43['type']!==_0x43e7('0x3c')){var _0x2b0ffe={};_0x2b0ffe[_0x2ffd43['name']]={'$like':'%'+_0xb1fc63[_0x43e7('0x30')]['filter']+'%'};return _0x2b0ffe;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63[_0x43e7('0x3d')]);var _0x1c6f45={'where':_0x33a1a5[_0x43e7('0x39')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x1c6f45)['then'](function(_0x574a93){_0x45b675[_0x43e7('0x1a')]=_0x574a93;if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x33a1a5[_0x43e7('0x3f')]=[{'all':!![]}];}return db[_0x43e7('0x28')]['findAll'](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4227c4){_0x45b675['rows']=_0x4227c4;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x40')]=function(_0x504101,_0x3d81ae){var _0x3b4235={'raw':![],'where':{'id':_0x504101[_0x43e7('0x41')]['id']}},_0x3a5807={};_0x3a5807['model']=_['keys'](db[_0x43e7('0x28')][_0x43e7('0x29')]);_0x3a5807[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x504101['query']);_0x3a5807['filters']=_['intersection'](_0x3a5807[_0x43e7('0x2d')],_0x3a5807['query']);_0x3b4235[_0x43e7('0x33')]=_['intersection'](_0x3a5807['model'],qs[_0x43e7('0x35')](_0x504101['query'][_0x43e7('0x35')]));_0x3b4235[_0x43e7('0x33')]=_0x3b4235[_0x43e7('0x33')][_0x43e7('0x36')]?_0x3b4235['attributes']:_0x3a5807[_0x43e7('0x2d')];if(_0x504101[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x3b4235[_0x43e7('0x3f')]=[{'all':!![]}];}_0x3b4235=_[_0x43e7('0x3b')]({},_0x3b4235,_0x504101[_0x43e7('0x3d')]);return db['ScreenRecording']['find'](_0x3b4235)[_0x43e7('0x21')](handleEntityNotFound(_0x3d81ae,null))[_0x43e7('0x21')](respondWithResult(_0x3d81ae,null))[_0x43e7('0x42')](handleError(_0x3d81ae,null));};exports['create']=function(_0x5c1c18,_0x56489b){return db[_0x43e7('0x28')][_0x43e7('0x43')](_0x5c1c18['body'],{})[_0x43e7('0x21')](respondWithResult(_0x56489b,0xc9))[_0x43e7('0x42')](handleError(_0x56489b,null));};exports[_0x43e7('0x20')]=function(_0x560329,_0x593155){if(_0x560329['body']['id']){delete _0x560329['body']['id'];}delete _0x560329[_0x43e7('0x44')][_0x43e7('0x45')];delete _0x560329['body'][_0x43e7('0x46')];delete _0x560329[_0x43e7('0x44')][_0x43e7('0x47')];delete _0x560329[_0x43e7('0x44')]['value'];return db[_0x43e7('0x28')]['find']({'where':{'id':_0x560329['params']['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x593155,null))[_0x43e7('0x21')](saveUpdates(_0x560329[_0x43e7('0x44')],null))[_0x43e7('0x21')](respondWithResult(_0x593155,null))[_0x43e7('0x42')](handleError(_0x593155,null));};exports[_0x43e7('0x48')]=function(_0x1cd87c,_0x256ddd){return db[_0x43e7('0x28')][_0x43e7('0x48')]()['then'](respondWithResult(_0x256ddd,null))[_0x43e7('0x42')](handleError(_0x256ddd,null));};exports[_0x43e7('0x49')]=function(_0x499c03,_0x39e3ca,_0x4e6f6d){var _0x35b799=require(_0x43e7('0x4a'));var _0x34e2ec=![];var _0x1f561f={};if(_0x499c03[_0x43e7('0x30')]['type']&&_0x499c03['query'][_0x43e7('0x2b')]===_0x43e7('0x4b')){_0x1f561f[_0x43e7('0x4b')]=_0x499c03[_0x43e7('0x41')]['id'];}else{_0x1f561f['id']=_0x499c03[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':_0x1f561f,'attributes':['id',_0x43e7('0x4d')],'raw':!![]})[_0x43e7('0x21')](handleEntityNotFound(_0x39e3ca,null))[_0x43e7('0x21')](function(_0x312306){if(_0x312306){var _0x4ace49=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],'server/files/screen_recordings',_0x312306[_0x43e7('0x4d')]);var _0x220bf2=util[_0x43e7('0x2f')]('%s.cypher',_0x4ace49);if(fs['existsSync'](_0x220bf2)){_0x34e2ec=!![];return _0x35b799[_0x43e7('0x50')](_0x220bf2,_0x4ace49,config[_0x43e7('0x51')]['recording'])[_0x43e7('0x21')](function(){return _0x312306;});}return _0x312306;}})['then'](function(_0x49a6ce){if(_0x49a6ce){var _0x1fa3f6=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],_0x43e7('0x52'),_0x49a6ce[_0x43e7('0x4d')]);if(!fs['existsSync'](_0x1fa3f6)){throw new db[(_0x43e7('0x53'))][(_0x43e7('0x54'))]('ScreenRecording\x20not\x20found');}if(_0x49a6ce[_0x43e7('0x55')]){return _0x39e3ca[_0x43e7('0x49')](_0x1fa3f6,_0x49a6ce[_0x43e7('0x55')]+path['extname'](_0x1fa3f6),function(){if(_0x34e2ec){fs['unlink'](_0x1fa3f6);}});}else{return _0x39e3ca['download'](_0x1fa3f6,function(_0x2ada55){if(_0x34e2ec){fs[_0x43e7('0x56')](_0x1fa3f6);}});}}})[_0x43e7('0x42')](function(_0x3a6404){if(_0x3a6404['message']==='ScreenRecording\x20not\x20found'){_0x39e3ca[_0x43e7('0x1b')](0x194)[_0x43e7('0x25')](_0x43e7('0x57'));}else{return handleError(_0x39e3ca,null);}});};exports[_0x43e7('0x22')]=function(_0x5ea0db,_0x4438c0){return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':{'id':_0x5ea0db[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](function(_0xd41e79){if(_[_0x43e7('0x58')](_0xd41e79)){throw new ReferenceError(_0x43e7('0x59'));}return _0xd41e79;})[_0x43e7('0x21')](function(_0x381208){var _0x252f00=path['join'](config['root'],_0x43e7('0x52'),_0x381208['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x252f00);if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs['existsSync'](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}_0x252f00=_0x252f00+_0x43e7('0x5d');if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs[_0x43e7('0x5e')](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}return _0x381208;})[_0x43e7('0x21')](function(_0x40d0c0){if(!_0x40d0c0)throw new InternalError();return _0x40d0c0[_0x43e7('0x22')]();})['then'](function(){_0x4438c0['status'](0xcc)[_0x43e7('0x15')]();})['catch'](handleError(_0x4438c0,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 9b4affe..6151e78 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 _0x86da=['./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','util','api','moment','request-promise','path','rimraf'];(function(_0x51e299,_0x203008){var _0x30568f=function(_0x5ea69a){while(--_0x5ea69a){_0x51e299['push'](_0x51e299['shift']());}};_0x30568f(++_0x203008);}(_0x86da,0xa2));var _0xa86d=function(_0x6048e7,_0x485f4f){_0x6048e7=_0x6048e7-0x0;var _0x576f4c=_0x86da[_0x6048e7];return _0x576f4c;};'use strict';var _=require('lodash');var util=require(_0xa86d('0x0'));var logger=require('../../config/logger')(_0xa86d('0x1'));var moment=require(_0xa86d('0x2'));var BPromise=require('bluebird');var rp=require(_0xa86d('0x3'));var fs=require('fs');var path=require(_0xa86d('0x4'));var rimraf=require(_0xa86d('0x5'));var config=require('../../config/environment');var attributes=require(_0xa86d('0x6'));module[_0xa86d('0x7')]=function(_0x104c2d,_0xcd052){return _0x104c2d[_0xa86d('0x8')](_0xa86d('0x9'),attributes,{'tableName':_0xa86d('0xa'),'paranoid':![],'indexes':[{'name':_0xa86d('0xb'),'fields':[_0xa86d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x35ee=['../../config/logger','api','moment','bluebird','path','../../config/environment','./screenRecording.attributes','define','screen_recordings','interactionid','lodash','util'];(function(_0x5eb27e,_0x156849){var _0x3c19aa=function(_0x5abd85){while(--_0x5abd85){_0x5eb27e['push'](_0x5eb27e['shift']());}};_0x3c19aa(++_0x156849);}(_0x35ee,0x1c6));var _0xe35e=function(_0x56fafb,_0x22ccf7){_0x56fafb=_0x56fafb-0x0;var _0x1a8563=_0x35ee[_0x56fafb];return _0x1a8563;};'use strict';var _=require(_0xe35e('0x0'));var util=require(_0xe35e('0x1'));var logger=require(_0xe35e('0x2'))(_0xe35e('0x3'));var moment=require(_0xe35e('0x4'));var BPromise=require(_0xe35e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe35e('0x6'));var rimraf=require('rimraf');var config=require(_0xe35e('0x7'));var attributes=require(_0xe35e('0x8'));module['exports']=function(_0x413a48,_0x2e426a){return _0x413a48[_0xe35e('0x9')]('ScreenRecording',attributes,{'tableName':_0xe35e('0xa'),'paranoid':![],'indexes':[{'name':_0xe35e('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 0c26c8c..0f59d29 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 _0x65bd=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4acda0,_0x2458c4){var _0x1ca0c5=function(_0x4bf247){while(--_0x4bf247){_0x4acda0['push'](_0x4acda0['shift']());}};_0x1ca0c5(++_0x2458c4);}(_0x65bd,0x1e3));var _0xd65b=function(_0x3ddcb6,_0x3b9bfe){_0x3ddcb6=_0x3ddcb6-0x0;var _0x1b9234=_0x65bd[_0x3ddcb6];return _0x1b9234;};'use strict';var _=require(_0xd65b('0x0'));var util=require(_0xd65b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd65b('0x2'));var fs=require('fs');var Redis=require(_0xd65b('0x3'));var db=require(_0xd65b('0x4'))['db'];var utils=require(_0xd65b('0x5'));var logger=require('../../config/logger')(_0xd65b('0x6'));var config=require(_0xd65b('0x7'));var jayson=require(_0xd65b('0x8'));var client=jayson[_0xd65b('0x9')][_0xd65b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5176f2,_0x36f715,_0x4328c3){return new BPromise(function(_0x15f899,_0x20fea9){return client[_0xd65b('0xb')](_0x5176f2,_0x4328c3)[_0xd65b('0xc')](function(_0x4feaf8){logger[_0xd65b('0xd')](_0xd65b('0xe'),_0x36f715,_0xd65b('0xf'));logger[_0xd65b('0x10')](_0xd65b('0x11'),_0x36f715,'request\x20sent',JSON[_0xd65b('0x12')](_0x4feaf8));if(_0x4feaf8[_0xd65b('0x13')]){if(_0x4feaf8['error'][_0xd65b('0x14')]===0x1f4){logger[_0xd65b('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x36f715,_0x4feaf8['error'][_0xd65b('0x15')]);return _0x20fea9(_0x4feaf8['error'][_0xd65b('0x15')]);}logger[_0xd65b('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x36f715,_0x4feaf8[_0xd65b('0x13')][_0xd65b('0x15')]);return _0x15f899(_0x4feaf8[_0xd65b('0x13')][_0xd65b('0x15')]);}else{logger[_0xd65b('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x36f715,'request\x20sent');_0x15f899(_0x4feaf8[_0xd65b('0x16')][_0xd65b('0x15')]);}})[_0xd65b('0x17')](function(_0x1089a6){logger[_0xd65b('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x36f715,_0x1089a6);_0x20fea9(_0x1089a6);});});} \ No newline at end of file +var _0xbd65=['then','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','ScreenRecording,\x20%s,\x20%s','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3bacf8,_0x315aaa){var _0x53d999=function(_0xd57078){while(--_0xd57078){_0x3bacf8['push'](_0x3bacf8['shift']());}};_0x53d999(++_0x315aaa);}(_0xbd65,0x106));var _0x5bd6=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xbd65[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require(_0x5bd6('0x0'));var moment=require('moment');var BPromise=require(_0x5bd6('0x1'));var rs=require(_0x5bd6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bd6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bd6('0x4'))('rpc');var config=require(_0x5bd6('0x5'));var jayson=require(_0x5bd6('0x6'));var client=jayson[_0x5bd6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7de8fd,_0x2ea1e6,_0x443009){return new BPromise(function(_0x17f72,_0x25d2e1){return client['request'](_0x7de8fd,_0x443009)[_0x5bd6('0x8')](function(_0xe6452d){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x2ea1e6,'request\x20sent');logger[_0x5bd6('0x9')](_0x5bd6('0xa'),_0x2ea1e6,'request\x20sent',JSON[_0x5bd6('0xb')](_0xe6452d));if(_0xe6452d[_0x5bd6('0xc')]){if(_0xe6452d['error']['code']===0x1f4){logger[_0x5bd6('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x2ea1e6,_0xe6452d[_0x5bd6('0xc')][_0x5bd6('0xd')]);return _0x25d2e1(_0xe6452d[_0x5bd6('0xc')][_0x5bd6('0xd')]);}logger[_0x5bd6('0xc')](_0x5bd6('0xe'),_0x2ea1e6,_0xe6452d['error'][_0x5bd6('0xd')]);return _0x17f72(_0xe6452d['error'][_0x5bd6('0xd')]);}else{logger[_0x5bd6('0xf')](_0x5bd6('0xe'),_0x2ea1e6,'request\x20sent');_0x17f72(_0xe6452d[_0x5bd6('0x10')][_0x5bd6('0xd')]);}})[_0x5bd6('0x11')](function(_0x2a98cb){logger[_0x5bd6('0xc')](_0x5bd6('0xe'),_0x2ea1e6,_0x2a98cb);_0x25d2e1(_0x2a98cb);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index abcd00a..184f872 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 _0x2a04=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','logo','extname','post','single','addLogo','root','logologin','originalname','file','addLogoLogin','%s%s','preferred','addPreferred','favicon','addFavicon','put','update','multer','util','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2a04,0x189));var _0x42a0=function(_0x4717c7,_0x5ddb7b){_0x4717c7=_0x4717c7-0x0;var _0x22cfc6=_0x2a04[_0x4717c7];return _0x22cfc6;};'use strict';var multer=require(_0x42a0('0x0'));var util=require(_0x42a0('0x1'));var path=require('path');var timeout=require(_0x42a0('0x2'));var express=require(_0x42a0('0x3'));var router=express[_0x42a0('0x4')]();var fs_extra=require(_0x42a0('0x5'));var auth=require(_0x42a0('0x6'));var interaction=require(_0x42a0('0x7'));var config=require(_0x42a0('0x8'));var controller=require('./setting.controller');router[_0x42a0('0x9')]('/',auth[_0x42a0('0xa')](),controller[_0x42a0('0xb')]);router[_0x42a0('0x9')](_0x42a0('0xc'),controller[_0x42a0('0xd')]);router[_0x42a0('0x9')](_0x42a0('0xe'),controller[_0x42a0('0xf')]);router[_0x42a0('0x9')](_0x42a0('0x10'),controller[_0x42a0('0x11')]);router[_0x42a0('0x9')](_0x42a0('0x12'),controller['getLogoLogin']);router[_0x42a0('0x9')](_0x42a0('0x13'),controller['gdpr']);router[_0x42a0('0x9')](_0x42a0('0x14'),controller['getPreferred']);router['get'](_0x42a0('0x15'),controller[_0x42a0('0x16')]);var upload=multer({'storage':multer[_0x42a0('0x17')]({'destination':function(_0x604342,_0x1f39bd,_0x41e2a7){_0x41e2a7(null,path[_0x42a0('0x18')](config['root'],_0x42a0('0x19')));},'filename':function(_0x13a8ab,_0x487332,_0x221210){_0x221210(null,util[_0x42a0('0x1a')]('%s%s',_0x42a0('0x1b'),path[_0x42a0('0x1c')](_0x487332['originalname'])));}})});router[_0x42a0('0x1d')](_0x42a0('0x10'),upload[_0x42a0('0x1e')]('file'),controller[_0x42a0('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5142ea,_0x1f222f,_0x71e74e){_0x71e74e(null,path[_0x42a0('0x18')](config[_0x42a0('0x20')],_0x42a0('0x19')));},'filename':function(_0x2b7e78,_0xfa0881,_0x5f2a02){_0x5f2a02(null,util['format']('%s%s',_0x42a0('0x21'),path['extname'](_0xfa0881[_0x42a0('0x22')])));}})});router[_0x42a0('0x1d')](_0x42a0('0x12'),upload[_0x42a0('0x1e')](_0x42a0('0x23')),controller[_0x42a0('0x24')]);var upload=multer({'storage':multer[_0x42a0('0x17')]({'destination':function(_0xc4d2af,_0x49bd66,_0x2f6c2a){_0x2f6c2a(null,path[_0x42a0('0x18')](config[_0x42a0('0x20')],_0x42a0('0x19')));},'filename':function(_0x4f0839,_0x4558eb,_0x51a802){_0x51a802(null,util['format'](_0x42a0('0x25'),_0x42a0('0x26'),path[_0x42a0('0x1c')](_0x4558eb[_0x42a0('0x22')])));}})});router[_0x42a0('0x1d')](_0x42a0('0x14'),upload[_0x42a0('0x1e')]('file'),controller[_0x42a0('0x27')]);var upload=multer({'storage':multer[_0x42a0('0x17')]({'destination':function(_0x13fc06,_0x272267,_0x1be2ff){_0x1be2ff(null,path['join'](config[_0x42a0('0x20')],_0x42a0('0x19')));},'filename':function(_0x2cec01,_0xe472a9,_0x4ce53c){_0x4ce53c(null,util[_0x42a0('0x1a')](_0x42a0('0x25'),_0x42a0('0x28'),path[_0x42a0('0x1c')](_0xe472a9[_0x42a0('0x22')])));}})});router['post'](_0x42a0('0x15'),upload[_0x42a0('0x1e')](_0x42a0('0x23')),controller[_0x42a0('0x29')]);router[_0x42a0('0x2a')](_0x42a0('0xe'),auth['isAuthenticated'](),controller[_0x42a0('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xdaa0=['addLogo','root','addLogoLogin','server/files/images/logos/','preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','format','%s%s','logo','extname','originalname','post','/:id/logo','single','file'];(function(_0x350a4a,_0x528cc0){var _0x373fab=function(_0x588f97){while(--_0x588f97){_0x350a4a['push'](_0x350a4a['shift']());}};_0x373fab(++_0x528cc0);}(_0xdaa0,0x66));var _0x0daa=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xdaa0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require('multer');var util=require(_0x0daa('0x0'));var path=require(_0x0daa('0x1'));var timeout=require(_0x0daa('0x2'));var express=require('express');var router=express[_0x0daa('0x3')]();var fs_extra=require(_0x0daa('0x4'));var auth=require(_0x0daa('0x5'));var interaction=require(_0x0daa('0x6'));var config=require('../../config/environment');var controller=require(_0x0daa('0x7'));router[_0x0daa('0x8')]('/',auth[_0x0daa('0x9')](),controller[_0x0daa('0xa')]);router[_0x0daa('0x8')](_0x0daa('0xb'),controller[_0x0daa('0xc')]);router[_0x0daa('0x8')](_0x0daa('0xd'),controller['show']);router[_0x0daa('0x8')]('/:id/logo',controller[_0x0daa('0xe')]);router[_0x0daa('0x8')](_0x0daa('0xf'),controller[_0x0daa('0x10')]);router['get'](_0x0daa('0x11'),controller[_0x0daa('0x12')]);router[_0x0daa('0x8')](_0x0daa('0x13'),controller[_0x0daa('0x14')]);router[_0x0daa('0x8')]('/:id/favicon',controller[_0x0daa('0x15')]);var upload=multer({'storage':multer[_0x0daa('0x16')]({'destination':function(_0x50b141,_0x26c3f4,_0x390985){_0x390985(null,path[_0x0daa('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0xf08ce6,_0x4e97b9,_0x3c9e68){_0x3c9e68(null,util[_0x0daa('0x18')](_0x0daa('0x19'),_0x0daa('0x1a'),path[_0x0daa('0x1b')](_0x4e97b9[_0x0daa('0x1c')])));}})});router[_0x0daa('0x1d')](_0x0daa('0x1e'),upload[_0x0daa('0x1f')](_0x0daa('0x20')),controller[_0x0daa('0x21')]);var upload=multer({'storage':multer[_0x0daa('0x16')]({'destination':function(_0x26881f,_0x2c8c6c,_0x324413){_0x324413(null,path['join'](config[_0x0daa('0x22')],'server/files/images/logos/'));},'filename':function(_0x3128e4,_0x471192,_0x10733a){_0x10733a(null,util[_0x0daa('0x18')](_0x0daa('0x19'),'logologin',path[_0x0daa('0x1b')](_0x471192[_0x0daa('0x1c')])));}})});router[_0x0daa('0x1d')](_0x0daa('0xf'),upload[_0x0daa('0x1f')]('file'),controller[_0x0daa('0x23')]);var upload=multer({'storage':multer[_0x0daa('0x16')]({'destination':function(_0x22a3bd,_0x2f09c5,_0x2307e3){_0x2307e3(null,path['join'](config[_0x0daa('0x22')],_0x0daa('0x24')));},'filename':function(_0x5366a2,_0x5e7954,_0x4abc9c){_0x4abc9c(null,util[_0x0daa('0x18')]('%s%s',_0x0daa('0x25'),path['extname'](_0x5e7954[_0x0daa('0x1c')])));}})});router[_0x0daa('0x1d')](_0x0daa('0x13'),upload[_0x0daa('0x1f')](_0x0daa('0x20')),controller[_0x0daa('0x26')]);var upload=multer({'storage':multer[_0x0daa('0x16')]({'destination':function(_0x42e992,_0x53137d,_0x13f2d3){_0x13f2d3(null,path[_0x0daa('0x17')](config['root'],_0x0daa('0x24')));},'filename':function(_0x192211,_0x2e10c7,_0x20b59f){_0x20b59f(null,util['format']('%s%s',_0x0daa('0x27'),path[_0x0daa('0x1b')](_0x2e10c7[_0x0daa('0x1c')])));}})});router['post'](_0x0daa('0x28'),upload[_0x0daa('0x1f')](_0x0daa('0x20')),controller[_0x0daa('0x29')]);router[_0x0daa('0x2a')](_0x0daa('0xd'),auth[_0x0daa('0x9')](),controller[_0x0daa('0x2b')]);module[_0x0daa('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 1fdf0b4..3ce5e1e 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 _0xe769=['min_internal','min_mailbox','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0xe769,0xfb));var _0x9e76=function(_0x5de02c,_0x2bca83){_0x5de02c=_0x5de02c-0x0;var _0x5bee77=_0xe769[_0x5de02c];return _0x5bee77;};'use strict';var Sequelize=require(_0x9e76('0x0'));module[_0x9e76('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x9e76('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x9e76('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9e76('0x4')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9e76('0x5')],'defaultValue':_0x9e76('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9e76('0x5')]},'turnaddr':{'type':Sequelize[_0x9e76('0x5')]},'turnusername':{'type':Sequelize[_0x9e76('0x5')]},'turnpassword':{'type':Sequelize[_0x9e76('0x5')]},'pageTitle':{'type':Sequelize[_0x9e76('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9e76('0x5')],'defaultValue':_0x9e76('0x8')},'enableEmailPreview':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x9e76('0x5')],'defaultValue':_0x9e76('0x9')},'chatTimeout':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x9e76('0x5')]},'defaultPreferred':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x9e76('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x9e76('0x5')]},'defaultFavicon':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9e76('0x4')]},'sentimentRegion':{'type':Sequelize[_0x9e76('0x5')]},'language':{'type':Sequelize[_0x9e76('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x9e76('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x9e76('0x4')](0x2)[_0x9e76('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x9e76('0x4')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x9e76('0x4')](0x2)[_0x9e76('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x9e76('0x4')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x9e76('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x8482=['sequelize','exports','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x59d8d0,_0x11d4a2){var _0xb812a3=function(_0x5c207d){while(--_0x5c207d){_0x59d8d0['push'](_0x59d8d0['shift']());}};_0xb812a3(++_0x11d4a2);}(_0x8482,0x154));var _0x2848=function(_0x1a49f9,_0x594ce1){_0x1a49f9=_0x1a49f9-0x0;var _0x5742fd=_0x8482[_0x1a49f9];return _0x5742fd;};'use strict';var Sequelize=require(_0x2848('0x0'));module[_0x2848('0x1')]={'min_internal':{'type':Sequelize[_0x2848('0x2')](0xb),'unique':_0x2848('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2848('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2848('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2848('0x4')],'defaultValue':_0x2848('0x5')},'logo':{'type':Sequelize[_0x2848('0x4')]},'defaultLogo':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2848('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2848('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x2848('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x2848('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2848('0x4')],'defaultValue':_0x2848('0x7')},'enableEmailPreview':{'type':Sequelize[_0x2848('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2848('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x2848('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x2848('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x2848('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x2848('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x2848('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x2848('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x2848('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2848('0x4')]},'defaultFavicon':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x2848('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2848('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2848('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2848('0x2')]},'transcribeRegion':{'type':Sequelize[_0x2848('0x4')]},'sentiment':{'type':Sequelize[_0x2848('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x2848('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2848('0x4')]},'bucket':{'type':Sequelize[_0x2848('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x2848('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x2848('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x2848('0x2')](0x2)[_0x2848('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x2848('0x2')](0x2)[_0x2848('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x2848('0x2')](0x2)[_0x2848('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x2848('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x2848('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x2848('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x2848('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x2848('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 693e74c..93ad5c9 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 _0x6e0d=['catch','update','body','params','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','existsSync','join','root','toLower','default_logo.svg','upperFirst','\x20not\x20found','download','getLicense','preferred','default','custom','Sequelize','ValidationError','gdpr','securePassword','addPreferred','../../config/license/util','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','Setting','includeAll','include','findAll','rows','show','attributes','find'];(function(_0x4631be,_0x30f31c){var _0x2b03df=function(_0x4e6e78){while(--_0x4e6e78){_0x4631be['push'](_0x4631be['shift']());}};_0x2b03df(++_0x30f31c);}(_0x6e0d,0x11c));var _0xd6e0=function(_0x5e8eda,_0x447230){_0x5e8eda=_0x5e8eda-0x0;var _0x1eb057=_0x6e0d[_0x5e8eda];return _0x1eb057;};'use strict';var emlformat=require(_0xd6e0('0x0'));var rimraf=require(_0xd6e0('0x1'));var zipdir=require(_0xd6e0('0x2'));var jsonpatch=require(_0xd6e0('0x3'));var rp=require('request-promise');var moment=require(_0xd6e0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd6e0('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6e0('0x6'));var _=require(_0xd6e0('0x7'));var squel=require(_0xd6e0('0x8'));var crypto=require(_0xd6e0('0x9'));var jsforce=require(_0xd6e0('0xa'));var deskjs=require(_0xd6e0('0xb'));var toCsv=require(_0xd6e0('0xc'));var querystring=require(_0xd6e0('0xd'));var Papa=require('papaparse');var Redis=require(_0xd6e0('0xe'));var authService=require(_0xd6e0('0xf'));var qs=require(_0xd6e0('0x10'));var as=require(_0xd6e0('0x11'));var hardwareService=require(_0xd6e0('0x12'));var logger=require(_0xd6e0('0x13'))(_0xd6e0('0x14'));var utils=require(_0xd6e0('0x15'));var config=require(_0xd6e0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6e0('0x17'))['db'];var jayson=require(_0xd6e0('0x18'));var client=jayson[_0xd6e0('0x19')][_0xd6e0('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4e12d9,_0x284d81,_0x50eb01,_0x3abda4){return new BPromise(function(_0x9dfd8a,_0x5a8474){var _0x14db3b=_0x3abda4||client;return _0x14db3b[_0xd6e0('0x1b')](_0x4e12d9,_0x50eb01)[_0xd6e0('0x1c')](function(_0x50276c){logger['info'](_0xd6e0('0x1d'),_0x284d81,_0xd6e0('0x1e'));logger['debug'](_0xd6e0('0x1f'),_0x284d81,_0xd6e0('0x1e'),JSON[_0xd6e0('0x20')](_0x50276c));if(_0x50276c[_0xd6e0('0x21')]){if(_0x50276c[_0xd6e0('0x21')][_0xd6e0('0x22')]===0x1f4){logger['error'](_0xd6e0('0x1d'),_0x284d81,_0x50276c[_0xd6e0('0x21')][_0xd6e0('0x23')]);return _0x5a8474(_0x50276c['error'][_0xd6e0('0x23')]);}logger[_0xd6e0('0x21')](_0xd6e0('0x1d'),_0x284d81,_0x50276c[_0xd6e0('0x21')][_0xd6e0('0x23')]);return _0x9dfd8a(_0x50276c[_0xd6e0('0x21')][_0xd6e0('0x23')]);}else{logger['info'](_0xd6e0('0x1d'),_0x284d81,_0xd6e0('0x1e'));_0x9dfd8a(_0x50276c[_0xd6e0('0x24')][_0xd6e0('0x23')]);}})['catch'](function(_0x5afb0e){logger[_0xd6e0('0x21')]('Setting,\x20%s,\x20%s',_0x284d81,_0x5afb0e);_0x5a8474(_0x5afb0e);});});}function respondWithStatusCode(_0xdd8088,_0x21b610){_0x21b610=_0x21b610||0xcc;return function(_0x33635a){if(_0x33635a){return _0xdd8088[_0xd6e0('0x25')](_0x21b610);}return _0xdd8088[_0xd6e0('0x26')](_0x21b610)[_0xd6e0('0x27')]();};}function respondWithResult(_0x4f26b2,_0x5ecf75){_0x5ecf75=_0x5ecf75||0xc8;return function(_0x20a4c9){if(_0x20a4c9){return _0x4f26b2['status'](_0x5ecf75)['json'](_0x20a4c9);}};}function respondWithFilteredResult(_0x3e7a71,_0x902721){return function(_0x49764e){if(_0x49764e){var _0x2c8423=typeof _0x902721[_0xd6e0('0x28')]===_0xd6e0('0x29')&&typeof _0x902721['limit']===_0xd6e0('0x29');var _0x46b82f=_0x49764e[_0xd6e0('0x2a')];var _0x33a311=_0x2c8423?0x0:_0x902721[_0xd6e0('0x28')];var _0x35fea3=_0x2c8423?_0x49764e[_0xd6e0('0x2a')]:_0x902721['offset']+_0x902721[_0xd6e0('0x2b')];var _0x3c1219;if(_0x35fea3>=_0x46b82f){_0x35fea3=_0x46b82f;_0x3c1219=0xc8;}else{_0x3c1219=0xce;}_0x3e7a71['status'](_0x3c1219);return _0x3e7a71[_0xd6e0('0x2c')](_0xd6e0('0x2d'),_0x33a311+'-'+_0x35fea3+'/'+_0x46b82f)[_0xd6e0('0x2e')](_0x49764e);}return null;};}function patchUpdates(_0x4df613){return function(_0x1e6e3b){try{jsonpatch['apply'](_0x1e6e3b,_0x4df613,!![]);}catch(_0x3e035f){return BPromise[_0xd6e0('0x2f')](_0x3e035f);}return _0x1e6e3b['save']();};}function saveUpdates(_0x5b9f6f,_0x529d35){return function(_0x131ac9){if(_0x131ac9){return _0x131ac9['update'](_0x5b9f6f)['then'](function(_0x329eda){return _0x329eda;});}return null;};}function removeEntity(_0xafda11,_0x50b496){return function(_0x2cc048){if(_0x2cc048){return _0x2cc048[_0xd6e0('0x30')]()['then'](function(){_0xafda11['status'](0xcc)[_0xd6e0('0x27')]();});}};}function handleEntityNotFound(_0x5b98bf,_0x21ea75){return function(_0x3ec23e){if(!_0x3ec23e){_0x5b98bf['sendStatus'](0x194);}return _0x3ec23e;};}function handleError(_0x406f55,_0x13a825){_0x13a825=_0x13a825||0x1f4;return function(_0x35f213){logger[_0xd6e0('0x21')](_0x35f213['stack']);if(_0x35f213[_0xd6e0('0x31')]){delete _0x35f213[_0xd6e0('0x31')];}_0x406f55[_0xd6e0('0x26')](_0x13a825)[_0xd6e0('0x32')](_0x35f213);};}exports[_0xd6e0('0x33')]=function(_0x37b2fd,_0x21eddc){var _0x5b7b53={},_0x52ad32={},_0xa528d3={'count':0x0,'rows':[]};var _0x1f26e4=_[_0xd6e0('0x34')](db['Setting'][_0xd6e0('0x35')],function(_0x799a84){return{'name':_0x799a84[_0xd6e0('0x36')],'type':_0x799a84[_0xd6e0('0x37')][_0xd6e0('0x38')]};});_0x52ad32[_0xd6e0('0x39')]=_['map'](_0x1f26e4,_0xd6e0('0x31'));_0x52ad32[_0xd6e0('0x3a')]=_[_0xd6e0('0x3b')](_0x37b2fd['query']);_0x52ad32[_0xd6e0('0x3c')]=_[_0xd6e0('0x3d')](_0x52ad32[_0xd6e0('0x39')],_0x52ad32[_0xd6e0('0x3a')]);_0x5b7b53['attributes']=_[_0xd6e0('0x3d')](_0x52ad32[_0xd6e0('0x39')],qs[_0xd6e0('0x3e')](_0x37b2fd[_0xd6e0('0x3a')]['fields']));_0x5b7b53['attributes']=_0x5b7b53['attributes'][_0xd6e0('0x3f')]?_0x5b7b53['attributes']:_0x52ad32['model'];if(!_0x37b2fd[_0xd6e0('0x3a')][_0xd6e0('0x40')](_0xd6e0('0x41'))){_0x5b7b53[_0xd6e0('0x2b')]=qs[_0xd6e0('0x2b')](_0x37b2fd[_0xd6e0('0x3a')][_0xd6e0('0x2b')]);_0x5b7b53[_0xd6e0('0x28')]=qs[_0xd6e0('0x28')](_0x37b2fd[_0xd6e0('0x3a')][_0xd6e0('0x28')]);}_0x5b7b53[_0xd6e0('0x42')]=qs['sort'](_0x37b2fd[_0xd6e0('0x3a')]['sort']);_0x5b7b53[_0xd6e0('0x43')]=qs[_0xd6e0('0x3c')](_['pick'](_0x37b2fd[_0xd6e0('0x3a')],_0x52ad32['filters']),_0x1f26e4);if(_0x37b2fd[_0xd6e0('0x3a')][_0xd6e0('0x44')]){_0x5b7b53[_0xd6e0('0x43')]=_[_0xd6e0('0x45')](_0x5b7b53[_0xd6e0('0x43')],{'$or':_[_0xd6e0('0x34')](_0x1f26e4,function(_0x1bcb9b){if(_0x1bcb9b['type']!=='VIRTUAL'){var _0x138cd0={};_0x138cd0[_0x1bcb9b[_0xd6e0('0x31')]]={'$like':'%'+_0x37b2fd[_0xd6e0('0x3a')]['filter']+'%'};return _0x138cd0;}})});}_0x5b7b53=_[_0xd6e0('0x45')]({},_0x5b7b53,_0x37b2fd[_0xd6e0('0x46')]);var _0x2fbb91={'where':_0x5b7b53[_0xd6e0('0x43')]};return db[_0xd6e0('0x47')][_0xd6e0('0x2a')](_0x2fbb91)[_0xd6e0('0x1c')](function(_0x2e91e3){_0xa528d3['count']=_0x2e91e3;if(_0x37b2fd['query'][_0xd6e0('0x48')]){_0x5b7b53[_0xd6e0('0x49')]=[{'all':!![]}];}return db['Setting'][_0xd6e0('0x4a')](_0x5b7b53);})[_0xd6e0('0x1c')](function(_0x1b4caa){_0xa528d3[_0xd6e0('0x4b')]=_0x1b4caa;return _0xa528d3;})['then'](respondWithFilteredResult(_0x21eddc,_0x5b7b53))['catch'](handleError(_0x21eddc,null));};exports[_0xd6e0('0x4c')]=function(_0x47d1ba,_0x47305c){var _0x254574={'raw':![],'where':{'id':_0x47d1ba['params']['id']}},_0x2b3306={};_0x2b3306[_0xd6e0('0x39')]=_[_0xd6e0('0x3b')](db[_0xd6e0('0x47')][_0xd6e0('0x35')]);_0x2b3306[_0xd6e0('0x3a')]=_[_0xd6e0('0x3b')](_0x47d1ba[_0xd6e0('0x3a')]);_0x2b3306[_0xd6e0('0x3c')]=_[_0xd6e0('0x3d')](_0x2b3306[_0xd6e0('0x39')],_0x2b3306['query']);_0x254574['attributes']=_[_0xd6e0('0x3d')](_0x2b3306[_0xd6e0('0x39')],qs['fields'](_0x47d1ba[_0xd6e0('0x3a')][_0xd6e0('0x3e')]));_0x254574[_0xd6e0('0x4d')]=_0x254574['attributes']['length']?_0x254574['attributes']:_0x2b3306[_0xd6e0('0x39')];if(_0x47d1ba[_0xd6e0('0x3a')][_0xd6e0('0x48')]){_0x254574[_0xd6e0('0x49')]=[{'all':!![]}];}_0x254574=_[_0xd6e0('0x45')]({},_0x254574,_0x47d1ba[_0xd6e0('0x46')]);return db[_0xd6e0('0x47')][_0xd6e0('0x4e')](_0x254574)[_0xd6e0('0x1c')](handleEntityNotFound(_0x47305c,null))[_0xd6e0('0x1c')](respondWithResult(_0x47305c,null))[_0xd6e0('0x4f')](handleError(_0x47305c,null));};exports[_0xd6e0('0x50')]=function(_0x4ec6c3,_0x4918e4){if(_0x4ec6c3[_0xd6e0('0x51')]['id']){delete _0x4ec6c3[_0xd6e0('0x51')]['id'];}return db[_0xd6e0('0x47')][_0xd6e0('0x4e')]({'where':{'id':_0x4ec6c3[_0xd6e0('0x52')]['id']}})[_0xd6e0('0x1c')](handleEntityNotFound(_0x4918e4,null))[_0xd6e0('0x1c')](saveUpdates(_0x4ec6c3['body'],null))[_0xd6e0('0x1c')](respondWithResult(_0x4918e4,null))['catch'](handleError(_0x4918e4,null));};exports[_0xd6e0('0x53')]=function(_0x22390c,_0x576122,_0xa6db19){if(_0x22390c[_0xd6e0('0x54')]&&_0x22390c[_0xd6e0('0x54')][_0xd6e0('0x55')]){_0x22390c[_0xd6e0('0x51')]['logo']=_0x22390c['file'][_0xd6e0('0x55')];}return db[_0xd6e0('0x47')][_0xd6e0('0x4e')]({'where':{'id':_0x22390c['params']['id']}})['then'](handleEntityNotFound(_0x576122,null))[_0xd6e0('0x1c')](saveUpdates(_0x22390c['body'],null))[_0xd6e0('0x1c')](respondWithResult(_0x576122,null))[_0xd6e0('0x4f')](handleError(_0x576122,null));};exports[_0xd6e0('0x56')]=function(_0x387c99,_0x17a92a,_0x51e0b3){if(_0x387c99[_0xd6e0('0x54')]&&_0x387c99['file'][_0xd6e0('0x55')]){_0x387c99[_0xd6e0('0x51')][_0xd6e0('0x57')]=_0x387c99[_0xd6e0('0x54')][_0xd6e0('0x55')];}return db[_0xd6e0('0x47')][_0xd6e0('0x4e')]({'where':{'id':_0x387c99[_0xd6e0('0x52')]['id']}})['then'](handleEntityNotFound(_0x17a92a,null))['then'](saveUpdates(_0x387c99[_0xd6e0('0x51')],null))[_0xd6e0('0x1c')](respondWithResult(_0x17a92a,null))['catch'](handleError(_0x17a92a,null));};var utilLicense=require('../../config/license/util');exports[_0xd6e0('0x58')]=function(_0x13cb04,_0x1ccd1a,_0x3a3c28){var _0x26d55e=_0xd6e0('0x59');var _0x484d2e={'custom':![]};return utilLicense['getLicense']()[_0xd6e0('0x1c')](function(_0x1c3800){if(_0x1c3800){_0x484d2e=_0x1c3800;}return db[_0xd6e0('0x47')]['find']({'where':{'id':_0x13cb04[_0xd6e0('0x52')]['id']},'attributes':['logo','loginLogo','preferred',_0xd6e0('0x5a'),_0xd6e0('0x5b'),_0xd6e0('0x5c'),_0xd6e0('0x5d'),_0xd6e0('0x5e')],'raw':!![]});})[_0xd6e0('0x1c')](handleEntityNotFound(_0x1ccd1a,null))[_0xd6e0('0x1c')](function(_0x288560){if(_0x288560){var _0x1cdbfb=_0x288560[_0xd6e0('0x5f')]&&fs[_0xd6e0('0x60')](path[_0xd6e0('0x61')](config[_0xd6e0('0x62')],_0x26d55e,_[_0xd6e0('0x63')](_0x288560[_0xd6e0('0x5f')])))?path['join'](config['root'],_0x26d55e,_['toLower'](_0x288560[_0xd6e0('0x5f')])):path['join'](config[_0xd6e0('0x62')],_0x26d55e,_[_0xd6e0('0x63')](_0xd6e0('0x64')));var _0x2b061b='default'+_[_0xd6e0('0x65')]('logo');if(_0x288560[_0x2b061b]||!_0x484d2e['custom']){_0x1cdbfb=path[_0xd6e0('0x61')](config[_0xd6e0('0x62')],_0x26d55e,_['toLower'](_0xd6e0('0x64')));}if(!fs[_0xd6e0('0x60')](_0x1cdbfb)){throw new db['Sequelize']['ValidationError'](_[_0xd6e0('0x65')](_0xd6e0('0x5f'))+_0xd6e0('0x66'));}return _0x1ccd1a[_0xd6e0('0x67')](_0x1cdbfb);}})[_0xd6e0('0x4f')](handleError(_0x1ccd1a,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x196079,_0x12c68f,_0x36deb6){var _0x41cd86=_0xd6e0('0x59');var _0x765b28={'custom':![]};return utilLicense[_0xd6e0('0x68')]()[_0xd6e0('0x1c')](function(_0x1bce62){if(_0x1bce62){_0x765b28=_0x1bce62;}return db['Setting'][_0xd6e0('0x4e')]({'where':{'id':_0x196079['params']['id']},'attributes':[_0xd6e0('0x5f'),_0xd6e0('0x57'),_0xd6e0('0x69'),_0xd6e0('0x5a'),'defaultLogo','defaultLoginLogo',_0xd6e0('0x5d'),'defaultFavicon'],'raw':!![]});})[_0xd6e0('0x1c')](handleEntityNotFound(_0x12c68f,null))[_0xd6e0('0x1c')](function(_0x11774d){if(_0x11774d){var _0x39ba5c=_0x11774d[_0xd6e0('0x57')]&&fs[_0xd6e0('0x60')](path[_0xd6e0('0x61')](config['root'],_0x41cd86,_[_0xd6e0('0x63')](_0x11774d[_0xd6e0('0x57')])))?path[_0xd6e0('0x61')](config[_0xd6e0('0x62')],_0x41cd86,_[_0xd6e0('0x63')](_0x11774d['loginLogo'])):path['join'](config[_0xd6e0('0x62')],_0x41cd86,_[_0xd6e0('0x63')]('default_loginLogo.svg'));var _0x757528=_0xd6e0('0x6a')+_[_0xd6e0('0x65')]('loginLogo');if(_0x11774d[_0x757528]||!_0x765b28[_0xd6e0('0x6b')]){_0x39ba5c=path[_0xd6e0('0x61')](config[_0xd6e0('0x62')],_0x41cd86,_[_0xd6e0('0x63')]('default_loginLogo.svg'));}if(!fs[_0xd6e0('0x60')](_0x39ba5c)){throw new db[(_0xd6e0('0x6c'))][(_0xd6e0('0x6d'))](_['upperFirst']('loginLogo')+'\x20not\x20found');}return _0x12c68f[_0xd6e0('0x67')](_0x39ba5c);}})[_0xd6e0('0x4f')](handleError(_0x12c68f,null));};exports[_0xd6e0('0x6e')]=function(_0x2d563c,_0x5f3897){return db[_0xd6e0('0x47')][_0xd6e0('0x4e')]({'where':{'id':_0x2d563c[_0xd6e0('0x52')]['id']},'attributes':[_0xd6e0('0x6f')]})[_0xd6e0('0x1c')](respondWithResult(_0x5f3897,null))['catch'](handleError(_0x5f3897,null));};exports[_0xd6e0('0x70')]=function(_0x2d0a91,_0x24c34b,_0x2b2d09){if(_0x2d0a91[_0xd6e0('0x54')]&&_0x2d0a91[_0xd6e0('0x54')]['filename']){_0x2d0a91['body'][_0xd6e0('0x69')]=_0x2d0a91['file'][_0xd6e0('0x55')];}return db['Setting'][_0xd6e0('0x4e')]({'where':{'id':_0x2d0a91[_0xd6e0('0x52')]['id']}})['then'](handleEntityNotFound(_0x24c34b,null))['then'](saveUpdates(_0x2d0a91[_0xd6e0('0x51')],null))[_0xd6e0('0x1c')](respondWithResult(_0x24c34b,null))['catch'](handleError(_0x24c34b,null));};var utilLicense=require(_0xd6e0('0x71'));exports[_0xd6e0('0x72')]=function(_0x1e8003,_0x4ff77d,_0x12176c){var _0x4349db=_0xd6e0('0x59');var _0x31f538={'custom':![]};return utilLicense[_0xd6e0('0x68')]()[_0xd6e0('0x1c')](function(_0x38311){if(_0x38311){_0x31f538=_0x38311;}return db[_0xd6e0('0x47')][_0xd6e0('0x4e')]({'where':{'id':_0x1e8003[_0xd6e0('0x52')]['id']},'attributes':[_0xd6e0('0x5f'),_0xd6e0('0x57'),_0xd6e0('0x69'),_0xd6e0('0x5a'),_0xd6e0('0x5b'),_0xd6e0('0x5c'),_0xd6e0('0x5d'),_0xd6e0('0x5e')],'raw':!![]});})[_0xd6e0('0x1c')](handleEntityNotFound(_0x4ff77d,null))[_0xd6e0('0x1c')](function(_0x2612c4){if(_0x2612c4){var _0x42a33a=_0x2612c4[_0xd6e0('0x69')]&&fs[_0xd6e0('0x60')](path[_0xd6e0('0x61')](config[_0xd6e0('0x62')],_0x4349db,_[_0xd6e0('0x63')](_0x2612c4['preferred'])))?path[_0xd6e0('0x61')](config[_0xd6e0('0x62')],_0x4349db,_[_0xd6e0('0x63')](_0x2612c4[_0xd6e0('0x69')])):path[_0xd6e0('0x61')](config['root'],_0x4349db,_['toLower'](_0xd6e0('0x73')));var _0x48c404=_0xd6e0('0x6a')+_[_0xd6e0('0x65')](_0xd6e0('0x69'));if(_0x2612c4[_0x48c404]||!_0x31f538[_0xd6e0('0x6b')]||!_0x31f538[_0xd6e0('0x69')]){_0x42a33a=path[_0xd6e0('0x61')](config[_0xd6e0('0x62')],_0x4349db,_[_0xd6e0('0x63')](_0xd6e0('0x73')));}if(!fs[_0xd6e0('0x60')](_0x42a33a)){throw new db[(_0xd6e0('0x6c'))][(_0xd6e0('0x6d'))](_[_0xd6e0('0x65')]('preferred')+'\x20not\x20found');}return _0x4ff77d[_0xd6e0('0x67')](_0x42a33a);}})['catch'](handleError(_0x4ff77d,null));};exports[_0xd6e0('0x74')]=function(_0x17e491,_0x32f090,_0x3dd245){if(_0x17e491[_0xd6e0('0x54')]&&_0x17e491['file']['filename']){_0x17e491['body']['favicon']=_0x17e491[_0xd6e0('0x54')][_0xd6e0('0x55')];}return db[_0xd6e0('0x47')][_0xd6e0('0x4e')]({'where':{'id':_0x17e491[_0xd6e0('0x52')]['id']}})['then'](handleEntityNotFound(_0x32f090,null))[_0xd6e0('0x1c')](saveUpdates(_0x17e491[_0xd6e0('0x51')],null))[_0xd6e0('0x1c')](respondWithResult(_0x32f090,null))[_0xd6e0('0x4f')](handleError(_0x32f090,null));};var utilLicense=require(_0xd6e0('0x71'));exports[_0xd6e0('0x75')]=function(_0x391778,_0x49c12a,_0x1bce50){var _0x58a0c3='server/files/images/logos';var _0x10b852={'custom':![]};return utilLicense['getLicense']()[_0xd6e0('0x1c')](function(_0x5d2188){if(_0x5d2188){_0x10b852=_0x5d2188;}return db['Setting'][_0xd6e0('0x4e')]({'where':{'id':_0x391778[_0xd6e0('0x52')]['id']},'attributes':[_0xd6e0('0x5f'),_0xd6e0('0x57'),_0xd6e0('0x69'),_0xd6e0('0x5a'),'defaultLogo',_0xd6e0('0x5c'),_0xd6e0('0x5d'),_0xd6e0('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x49c12a,null))[_0xd6e0('0x1c')](function(_0x5d4b5f){if(_0x5d4b5f){var _0x4d0ad4=_0x5d4b5f[_0xd6e0('0x5a')]&&fs[_0xd6e0('0x60')](path[_0xd6e0('0x61')](config['root'],_0x58a0c3,_[_0xd6e0('0x63')](_0x5d4b5f[_0xd6e0('0x5a')])))?path[_0xd6e0('0x61')](config[_0xd6e0('0x62')],_0x58a0c3,_['toLower'](_0x5d4b5f[_0xd6e0('0x5a')])):path[_0xd6e0('0x61')](config[_0xd6e0('0x62')],_0x58a0c3,_['toLower'](_0xd6e0('0x76')));var _0x4381da=_0xd6e0('0x6a')+_[_0xd6e0('0x65')](_0xd6e0('0x5a'));if(_0x5d4b5f[_0x4381da]||!_0x10b852[_0xd6e0('0x6b')]){_0x4d0ad4=path[_0xd6e0('0x61')](config[_0xd6e0('0x62')],_0x58a0c3,_[_0xd6e0('0x63')]('default_favicon.ico'));}if(!fs[_0xd6e0('0x60')](_0x4d0ad4)){throw new db['Sequelize'][(_0xd6e0('0x6d'))](_[_0xd6e0('0x65')]('favicon')+_0xd6e0('0x66'));}return _0x49c12a['download'](_0x4d0ad4);}})[_0xd6e0('0x4f')](handleError(_0x49c12a,null));};exports['getDate']=function(_0x9de4cb,_0xf14bf1){var _0x59e158={'offset':moment()[_0xd6e0('0x77')]()};_0x59e158['now']=moment()[_0xd6e0('0x77')](_0x59e158[_0xd6e0('0x28')])['format'](_0xd6e0('0x78'));return _0xf14bf1[_0xd6e0('0x26')](0xc8)[_0xd6e0('0x32')](_0x59e158);}; \ No newline at end of file +var _0x5c58=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','debug','request\x20sent','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','Setting','find','update','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','root','toLower','join','default_logo.svg','default','upperFirst','existsSync','Sequelize','download','getLogoLogin','default_loginLogo.svg','custom','\x20not\x20found','gdpr','securePassword','getPreferred','default_preferred.png','ValidationError','addFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','lodash','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4fd75e,_0x219e4a){var _0x5b6338=function(_0xf2969c){while(--_0xf2969c){_0x4fd75e['push'](_0x4fd75e['shift']());}};_0x5b6338(++_0x219e4a);}(_0x5c58,0x154));var _0x85c5=function(_0x3932e5,_0x400ce6){_0x3932e5=_0x3932e5-0x0;var _0x2f0ee3=_0x5c58[_0x3932e5];return _0x2f0ee3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85c5('0x0'));var zipdir=require(_0x85c5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85c5('0x2'));var BPromise=require(_0x85c5('0x3'));var Mustache=require(_0x85c5('0x4'));var util=require('util');var path=require(_0x85c5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x85c5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85c5('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x85c5('0x8'));var toCsv=require(_0x85c5('0x9'));var querystring=require('querystring');var Papa=require(_0x85c5('0xa'));var Redis=require('ioredis');var authService=require(_0x85c5('0xb'));var qs=require(_0x85c5('0xc'));var as=require(_0x85c5('0xd'));var hardwareService=require(_0x85c5('0xe'));var logger=require('../../config/logger')(_0x85c5('0xf'));var utils=require(_0x85c5('0x10'));var config=require(_0x85c5('0x11'));var licenseUtil=require(_0x85c5('0x12'));var db=require(_0x85c5('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x85c5('0x14')][_0x85c5('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x265f50,_0xdef972,_0x1c1603,_0x4f5266){return new BPromise(function(_0x211d62,_0x4fbaf4){var _0x30cb4b=_0x4f5266||client;return _0x30cb4b[_0x85c5('0x16')](_0x265f50,_0x1c1603)['then'](function(_0x34fee5){logger[_0x85c5('0x17')]('Setting,\x20%s,\x20%s',_0xdef972,'request\x20sent');logger[_0x85c5('0x18')]('Setting,\x20%s,\x20%s,\x20%s',_0xdef972,_0x85c5('0x19'),JSON[_0x85c5('0x1a')](_0x34fee5));if(_0x34fee5[_0x85c5('0x1b')]){if(_0x34fee5[_0x85c5('0x1b')]['code']===0x1f4){logger[_0x85c5('0x1b')](_0x85c5('0x1c'),_0xdef972,_0x34fee5[_0x85c5('0x1b')][_0x85c5('0x1d')]);return _0x4fbaf4(_0x34fee5[_0x85c5('0x1b')][_0x85c5('0x1d')]);}logger['error'](_0x85c5('0x1c'),_0xdef972,_0x34fee5[_0x85c5('0x1b')][_0x85c5('0x1d')]);return _0x211d62(_0x34fee5['error'][_0x85c5('0x1d')]);}else{logger['info'](_0x85c5('0x1c'),_0xdef972,_0x85c5('0x19'));_0x211d62(_0x34fee5[_0x85c5('0x1e')][_0x85c5('0x1d')]);}})[_0x85c5('0x1f')](function(_0x5a3dc5){logger['error'](_0x85c5('0x1c'),_0xdef972,_0x5a3dc5);_0x4fbaf4(_0x5a3dc5);});});}function respondWithStatusCode(_0x131052,_0x41b9db){_0x41b9db=_0x41b9db||0xcc;return function(_0x42a420){if(_0x42a420){return _0x131052['sendStatus'](_0x41b9db);}return _0x131052[_0x85c5('0x20')](_0x41b9db)[_0x85c5('0x21')]();};}function respondWithResult(_0x1e840c,_0x19fb1b){_0x19fb1b=_0x19fb1b||0xc8;return function(_0x21c89d){if(_0x21c89d){return _0x1e840c[_0x85c5('0x20')](_0x19fb1b)[_0x85c5('0x22')](_0x21c89d);}};}function respondWithFilteredResult(_0x49ee7b,_0x488300){return function(_0x3fa2db){if(_0x3fa2db){var _0x428855=typeof _0x488300[_0x85c5('0x23')]===_0x85c5('0x24')&&typeof _0x488300[_0x85c5('0x25')]===_0x85c5('0x24');var _0x3d532d=_0x3fa2db[_0x85c5('0x26')];var _0x10f65b=_0x428855?0x0:_0x488300[_0x85c5('0x23')];var _0x5e525e=_0x428855?_0x3fa2db[_0x85c5('0x26')]:_0x488300['offset']+_0x488300['limit'];var _0x2ba1a6;if(_0x5e525e>=_0x3d532d){_0x5e525e=_0x3d532d;_0x2ba1a6=0xc8;}else{_0x2ba1a6=0xce;}_0x49ee7b[_0x85c5('0x20')](_0x2ba1a6);return _0x49ee7b[_0x85c5('0x27')](_0x85c5('0x28'),_0x10f65b+'-'+_0x5e525e+'/'+_0x3d532d)[_0x85c5('0x22')](_0x3fa2db);}return null;};}function patchUpdates(_0x4bf4ea){return function(_0x116c71){try{jsonpatch[_0x85c5('0x29')](_0x116c71,_0x4bf4ea,!![]);}catch(_0x1108ce){return BPromise[_0x85c5('0x2a')](_0x1108ce);}return _0x116c71[_0x85c5('0x2b')]();};}function saveUpdates(_0x2b954a,_0x6d097f){return function(_0x584d9a){if(_0x584d9a){return _0x584d9a['update'](_0x2b954a)[_0x85c5('0x2c')](function(_0x425e0c){return _0x425e0c;});}return null;};}function removeEntity(_0x21ab4f,_0x1b45d1){return function(_0x17a6f2){if(_0x17a6f2){return _0x17a6f2[_0x85c5('0x2d')]()[_0x85c5('0x2c')](function(){_0x21ab4f['status'](0xcc)[_0x85c5('0x21')]();});}};}function handleEntityNotFound(_0x25c844,_0x30e3aa){return function(_0x55ca3c){if(!_0x55ca3c){_0x25c844[_0x85c5('0x2e')](0x194);}return _0x55ca3c;};}function handleError(_0x3c2129,_0x39c440){_0x39c440=_0x39c440||0x1f4;return function(_0x5dddb1){logger[_0x85c5('0x1b')](_0x5dddb1['stack']);if(_0x5dddb1['name']){delete _0x5dddb1[_0x85c5('0x2f')];}_0x3c2129[_0x85c5('0x20')](_0x39c440)[_0x85c5('0x30')](_0x5dddb1);};}exports[_0x85c5('0x31')]=function(_0x19d5c0,_0x464c79){var _0x29621e={},_0x574acf={},_0x52d615={'count':0x0,'rows':[]};var _0xf4a9d0=_['map'](db['Setting'][_0x85c5('0x32')],function(_0x9583ed){return{'name':_0x9583ed[_0x85c5('0x33')],'type':_0x9583ed[_0x85c5('0x34')][_0x85c5('0x35')]};});_0x574acf[_0x85c5('0x36')]=_[_0x85c5('0x37')](_0xf4a9d0,_0x85c5('0x2f'));_0x574acf[_0x85c5('0x38')]=_[_0x85c5('0x39')](_0x19d5c0['query']);_0x574acf[_0x85c5('0x3a')]=_[_0x85c5('0x3b')](_0x574acf[_0x85c5('0x36')],_0x574acf[_0x85c5('0x38')]);_0x29621e[_0x85c5('0x3c')]=_[_0x85c5('0x3b')](_0x574acf['model'],qs[_0x85c5('0x3d')](_0x19d5c0[_0x85c5('0x38')][_0x85c5('0x3d')]));_0x29621e['attributes']=_0x29621e[_0x85c5('0x3c')]['length']?_0x29621e[_0x85c5('0x3c')]:_0x574acf['model'];if(!_0x19d5c0[_0x85c5('0x38')]['hasOwnProperty'](_0x85c5('0x3e'))){_0x29621e[_0x85c5('0x25')]=qs[_0x85c5('0x25')](_0x19d5c0['query'][_0x85c5('0x25')]);_0x29621e[_0x85c5('0x23')]=qs['offset'](_0x19d5c0[_0x85c5('0x38')][_0x85c5('0x23')]);}_0x29621e[_0x85c5('0x3f')]=qs[_0x85c5('0x40')](_0x19d5c0[_0x85c5('0x38')][_0x85c5('0x40')]);_0x29621e['where']=qs[_0x85c5('0x3a')](_[_0x85c5('0x41')](_0x19d5c0['query'],_0x574acf[_0x85c5('0x3a')]),_0xf4a9d0);if(_0x19d5c0[_0x85c5('0x38')][_0x85c5('0x42')]){_0x29621e[_0x85c5('0x43')]=_[_0x85c5('0x44')](_0x29621e[_0x85c5('0x43')],{'$or':_['map'](_0xf4a9d0,function(_0x571744){if(_0x571744[_0x85c5('0x34')]!==_0x85c5('0x45')){var _0x539d24={};_0x539d24[_0x571744[_0x85c5('0x2f')]]={'$like':'%'+_0x19d5c0[_0x85c5('0x38')][_0x85c5('0x42')]+'%'};return _0x539d24;}})});}_0x29621e=_[_0x85c5('0x44')]({},_0x29621e,_0x19d5c0[_0x85c5('0x46')]);var _0x12c114={'where':_0x29621e['where']};return db['Setting'][_0x85c5('0x26')](_0x12c114)[_0x85c5('0x2c')](function(_0x2de15a){_0x52d615[_0x85c5('0x26')]=_0x2de15a;if(_0x19d5c0[_0x85c5('0x38')][_0x85c5('0x47')]){_0x29621e[_0x85c5('0x48')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x29621e);})[_0x85c5('0x2c')](function(_0x2d79a5){_0x52d615[_0x85c5('0x49')]=_0x2d79a5;return _0x52d615;})[_0x85c5('0x2c')](respondWithFilteredResult(_0x464c79,_0x29621e))[_0x85c5('0x1f')](handleError(_0x464c79,null));};exports[_0x85c5('0x4a')]=function(_0x3e582b,_0x3a0316){var _0x5cdb47={'raw':![],'where':{'id':_0x3e582b[_0x85c5('0x4b')]['id']}},_0x53acf0={};_0x53acf0[_0x85c5('0x36')]=_[_0x85c5('0x39')](db['Setting']['rawAttributes']);_0x53acf0['query']=_['keys'](_0x3e582b[_0x85c5('0x38')]);_0x53acf0[_0x85c5('0x3a')]=_[_0x85c5('0x3b')](_0x53acf0[_0x85c5('0x36')],_0x53acf0['query']);_0x5cdb47[_0x85c5('0x3c')]=_[_0x85c5('0x3b')](_0x53acf0[_0x85c5('0x36')],qs['fields'](_0x3e582b['query'][_0x85c5('0x3d')]));_0x5cdb47[_0x85c5('0x3c')]=_0x5cdb47[_0x85c5('0x3c')][_0x85c5('0x4c')]?_0x5cdb47[_0x85c5('0x3c')]:_0x53acf0[_0x85c5('0x36')];if(_0x3e582b[_0x85c5('0x38')]['includeAll']){_0x5cdb47['include']=[{'all':!![]}];}_0x5cdb47=_[_0x85c5('0x44')]({},_0x5cdb47,_0x3e582b[_0x85c5('0x46')]);return db[_0x85c5('0x4d')][_0x85c5('0x4e')](_0x5cdb47)['then'](handleEntityNotFound(_0x3a0316,null))[_0x85c5('0x2c')](respondWithResult(_0x3a0316,null))['catch'](handleError(_0x3a0316,null));};exports[_0x85c5('0x4f')]=function(_0x27e866,_0x51dcb8){if(_0x27e866['body']['id']){delete _0x27e866[_0x85c5('0x50')]['id'];}return db[_0x85c5('0x4d')]['find']({'where':{'id':_0x27e866[_0x85c5('0x4b')]['id']}})[_0x85c5('0x2c')](handleEntityNotFound(_0x51dcb8,null))['then'](saveUpdates(_0x27e866[_0x85c5('0x50')],null))[_0x85c5('0x2c')](respondWithResult(_0x51dcb8,null))[_0x85c5('0x1f')](handleError(_0x51dcb8,null));};exports[_0x85c5('0x51')]=function(_0x55b0f7,_0x2f5c9f,_0x19bce4){if(_0x55b0f7['file']&&_0x55b0f7[_0x85c5('0x52')][_0x85c5('0x53')]){_0x55b0f7[_0x85c5('0x50')][_0x85c5('0x54')]=_0x55b0f7[_0x85c5('0x52')]['filename'];}return db['Setting']['find']({'where':{'id':_0x55b0f7[_0x85c5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2f5c9f,null))[_0x85c5('0x2c')](saveUpdates(_0x55b0f7[_0x85c5('0x50')],null))[_0x85c5('0x2c')](respondWithResult(_0x2f5c9f,null))[_0x85c5('0x1f')](handleError(_0x2f5c9f,null));};exports['addLogoLogin']=function(_0x10b681,_0x5be224,_0x1fc6a0){if(_0x10b681[_0x85c5('0x52')]&&_0x10b681[_0x85c5('0x52')]['filename']){_0x10b681['body'][_0x85c5('0x55')]=_0x10b681[_0x85c5('0x52')][_0x85c5('0x53')];}return db[_0x85c5('0x4d')][_0x85c5('0x4e')]({'where':{'id':_0x10b681[_0x85c5('0x4b')]['id']}})[_0x85c5('0x2c')](handleEntityNotFound(_0x5be224,null))['then'](saveUpdates(_0x10b681['body'],null))['then'](respondWithResult(_0x5be224,null))[_0x85c5('0x1f')](handleError(_0x5be224,null));};var utilLicense=require(_0x85c5('0x12'));exports[_0x85c5('0x56')]=function(_0x440d09,_0x14ab3a,_0x12e86a){var _0x39c2c2=_0x85c5('0x57');var _0x51060b={'custom':![]};return utilLicense[_0x85c5('0x58')]()['then'](function(_0x3df024){if(_0x3df024){_0x51060b=_0x3df024;}return db['Setting'][_0x85c5('0x4e')]({'where':{'id':_0x440d09[_0x85c5('0x4b')]['id']},'attributes':[_0x85c5('0x54'),'loginLogo',_0x85c5('0x59'),_0x85c5('0x5a'),_0x85c5('0x5b'),_0x85c5('0x5c'),_0x85c5('0x5d'),_0x85c5('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x14ab3a,null))[_0x85c5('0x2c')](function(_0x33c0b6){if(_0x33c0b6){var _0x2528da=_0x33c0b6[_0x85c5('0x54')]&&fs['existsSync'](path['join'](config[_0x85c5('0x5f')],_0x39c2c2,_[_0x85c5('0x60')](_0x33c0b6['logo'])))?path[_0x85c5('0x61')](config[_0x85c5('0x5f')],_0x39c2c2,_['toLower'](_0x33c0b6['logo'])):path[_0x85c5('0x61')](config[_0x85c5('0x5f')],_0x39c2c2,_['toLower'](_0x85c5('0x62')));var _0x4c84cd=_0x85c5('0x63')+_[_0x85c5('0x64')](_0x85c5('0x54'));if(_0x33c0b6[_0x4c84cd]||!_0x51060b['custom']){_0x2528da=path['join'](config[_0x85c5('0x5f')],_0x39c2c2,_[_0x85c5('0x60')](_0x85c5('0x62')));}if(!fs[_0x85c5('0x65')](_0x2528da)){throw new db[(_0x85c5('0x66'))]['ValidationError'](_[_0x85c5('0x64')](_0x85c5('0x54'))+'\x20not\x20found');}return _0x14ab3a[_0x85c5('0x67')](_0x2528da);}})[_0x85c5('0x1f')](handleError(_0x14ab3a,null));};var utilLicense=require(_0x85c5('0x12'));exports[_0x85c5('0x68')]=function(_0x455833,_0x16c1c7,_0x160e0b){var _0x52c0e2=_0x85c5('0x57');var _0x5199ef={'custom':![]};return utilLicense['getLicense']()[_0x85c5('0x2c')](function(_0x2e7a49){if(_0x2e7a49){_0x5199ef=_0x2e7a49;}return db[_0x85c5('0x4d')][_0x85c5('0x4e')]({'where':{'id':_0x455833[_0x85c5('0x4b')]['id']},'attributes':[_0x85c5('0x54'),'loginLogo','preferred',_0x85c5('0x5a'),_0x85c5('0x5b'),_0x85c5('0x5c'),'defaultPreferred',_0x85c5('0x5e')],'raw':!![]});})[_0x85c5('0x2c')](handleEntityNotFound(_0x16c1c7,null))[_0x85c5('0x2c')](function(_0x213aef){if(_0x213aef){var _0x34bd21=_0x213aef['loginLogo']&&fs[_0x85c5('0x65')](path[_0x85c5('0x61')](config[_0x85c5('0x5f')],_0x52c0e2,_[_0x85c5('0x60')](_0x213aef[_0x85c5('0x55')])))?path[_0x85c5('0x61')](config[_0x85c5('0x5f')],_0x52c0e2,_[_0x85c5('0x60')](_0x213aef[_0x85c5('0x55')])):path[_0x85c5('0x61')](config[_0x85c5('0x5f')],_0x52c0e2,_[_0x85c5('0x60')](_0x85c5('0x69')));var _0x1404f9=_0x85c5('0x63')+_[_0x85c5('0x64')](_0x85c5('0x55'));if(_0x213aef[_0x1404f9]||!_0x5199ef[_0x85c5('0x6a')]){_0x34bd21=path[_0x85c5('0x61')](config['root'],_0x52c0e2,_[_0x85c5('0x60')](_0x85c5('0x69')));}if(!fs[_0x85c5('0x65')](_0x34bd21)){throw new db[(_0x85c5('0x66'))]['ValidationError'](_[_0x85c5('0x64')](_0x85c5('0x55'))+_0x85c5('0x6b'));}return _0x16c1c7[_0x85c5('0x67')](_0x34bd21);}})[_0x85c5('0x1f')](handleError(_0x16c1c7,null));};exports[_0x85c5('0x6c')]=function(_0x117f2f,_0x188cf1){return db[_0x85c5('0x4d')]['find']({'where':{'id':_0x117f2f[_0x85c5('0x4b')]['id']},'attributes':[_0x85c5('0x6d')]})[_0x85c5('0x2c')](respondWithResult(_0x188cf1,null))[_0x85c5('0x1f')](handleError(_0x188cf1,null));};exports['addPreferred']=function(_0x772a1f,_0x1a3875,_0x3753d3){if(_0x772a1f[_0x85c5('0x52')]&&_0x772a1f[_0x85c5('0x52')]['filename']){_0x772a1f[_0x85c5('0x50')]['preferred']=_0x772a1f[_0x85c5('0x52')]['filename'];}return db[_0x85c5('0x4d')][_0x85c5('0x4e')]({'where':{'id':_0x772a1f[_0x85c5('0x4b')]['id']}})[_0x85c5('0x2c')](handleEntityNotFound(_0x1a3875,null))[_0x85c5('0x2c')](saveUpdates(_0x772a1f[_0x85c5('0x50')],null))['then'](respondWithResult(_0x1a3875,null))['catch'](handleError(_0x1a3875,null));};var utilLicense=require(_0x85c5('0x12'));exports[_0x85c5('0x6e')]=function(_0x52bada,_0x26b190,_0x42bcf0){var _0x589a60=_0x85c5('0x57');var _0xd10836={'custom':![]};return utilLicense[_0x85c5('0x58')]()[_0x85c5('0x2c')](function(_0x576642){if(_0x576642){_0xd10836=_0x576642;}return db[_0x85c5('0x4d')][_0x85c5('0x4e')]({'where':{'id':_0x52bada[_0x85c5('0x4b')]['id']},'attributes':['logo',_0x85c5('0x55'),_0x85c5('0x59'),'favicon',_0x85c5('0x5b'),_0x85c5('0x5c'),_0x85c5('0x5d'),_0x85c5('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x26b190,null))[_0x85c5('0x2c')](function(_0x20e773){if(_0x20e773){var _0x105e73=_0x20e773['preferred']&&fs[_0x85c5('0x65')](path['join'](config[_0x85c5('0x5f')],_0x589a60,_[_0x85c5('0x60')](_0x20e773[_0x85c5('0x59')])))?path['join'](config[_0x85c5('0x5f')],_0x589a60,_['toLower'](_0x20e773[_0x85c5('0x59')])):path['join'](config[_0x85c5('0x5f')],_0x589a60,_['toLower'](_0x85c5('0x6f')));var _0x603cf7=_0x85c5('0x63')+_[_0x85c5('0x64')](_0x85c5('0x59'));if(_0x20e773[_0x603cf7]||!_0xd10836['custom']||!_0xd10836[_0x85c5('0x59')]){_0x105e73=path[_0x85c5('0x61')](config['root'],_0x589a60,_[_0x85c5('0x60')](_0x85c5('0x6f')));}if(!fs['existsSync'](_0x105e73)){throw new db[(_0x85c5('0x66'))][(_0x85c5('0x70'))](_[_0x85c5('0x64')](_0x85c5('0x59'))+_0x85c5('0x6b'));}return _0x26b190[_0x85c5('0x67')](_0x105e73);}})[_0x85c5('0x1f')](handleError(_0x26b190,null));};exports[_0x85c5('0x71')]=function(_0x142531,_0x7b7b66,_0x135893){if(_0x142531['file']&&_0x142531['file'][_0x85c5('0x53')]){_0x142531[_0x85c5('0x50')][_0x85c5('0x5a')]=_0x142531['file']['filename'];}return db[_0x85c5('0x4d')]['find']({'where':{'id':_0x142531['params']['id']}})[_0x85c5('0x2c')](handleEntityNotFound(_0x7b7b66,null))[_0x85c5('0x2c')](saveUpdates(_0x142531[_0x85c5('0x50')],null))['then'](respondWithResult(_0x7b7b66,null))[_0x85c5('0x1f')](handleError(_0x7b7b66,null));};var utilLicense=require(_0x85c5('0x12'));exports['getFavicon']=function(_0x252ae6,_0x38209e,_0x5ecafd){var _0x2289e4=_0x85c5('0x57');var _0x4a6ccb={'custom':![]};return utilLicense[_0x85c5('0x58')]()[_0x85c5('0x2c')](function(_0xc1c8aa){if(_0xc1c8aa){_0x4a6ccb=_0xc1c8aa;}return db[_0x85c5('0x4d')][_0x85c5('0x4e')]({'where':{'id':_0x252ae6['params']['id']},'attributes':['logo','loginLogo',_0x85c5('0x59'),_0x85c5('0x5a'),_0x85c5('0x5b'),_0x85c5('0x5c'),_0x85c5('0x5d'),_0x85c5('0x5e')],'raw':!![]});})[_0x85c5('0x2c')](handleEntityNotFound(_0x38209e,null))['then'](function(_0x5e8438){if(_0x5e8438){var _0x36837b=_0x5e8438[_0x85c5('0x5a')]&&fs['existsSync'](path['join'](config[_0x85c5('0x5f')],_0x2289e4,_[_0x85c5('0x60')](_0x5e8438[_0x85c5('0x5a')])))?path['join'](config[_0x85c5('0x5f')],_0x2289e4,_['toLower'](_0x5e8438[_0x85c5('0x5a')])):path[_0x85c5('0x61')](config['root'],_0x2289e4,_[_0x85c5('0x60')](_0x85c5('0x72')));var _0x5234f4=_0x85c5('0x63')+_['upperFirst'](_0x85c5('0x5a'));if(_0x5e8438[_0x5234f4]||!_0x4a6ccb[_0x85c5('0x6a')]){_0x36837b=path[_0x85c5('0x61')](config[_0x85c5('0x5f')],_0x2289e4,_[_0x85c5('0x60')](_0x85c5('0x72')));}if(!fs[_0x85c5('0x65')](_0x36837b)){throw new db[(_0x85c5('0x66'))][(_0x85c5('0x70'))](_['upperFirst'](_0x85c5('0x5a'))+_0x85c5('0x6b'));}return _0x38209e[_0x85c5('0x67')](_0x36837b);}})[_0x85c5('0x1f')](handleError(_0x38209e,null));};exports['getDate']=function(_0x4b764f,_0x2ec7b1){var _0x5bef2a={'offset':moment()[_0x85c5('0x73')]()};_0x5bef2a[_0x85c5('0x74')]=moment()[_0x85c5('0x73')](_0x5bef2a[_0x85c5('0x23')])['format'](_0x85c5('0x75'));return _0x2ec7b1['status'](0xc8)[_0x85c5('0x30')](_0x5bef2a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index b23eca8..f257075 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0xc3083f,_0x5ac664){var _0x8e45bb=function(_0x466769){while(--_0x466769){_0xc3083f['push'](_0xc3083f['shift']());}};_0x8e45bb(++_0x5ac664);}(_0x008c,0x188));var _0xc008=function(_0x2e81f4,_0x44f46a){_0x2e81f4=_0x2e81f4-0x0;var _0x198f70=_0x008c[_0x2e81f4];return _0x198f70;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x4ba941,_0x4765e9){var _0x383fe1=function(_0x1ce87f){while(--_0x1ce87f){_0x4ba941['push'](_0x4ba941['shift']());}};_0x383fe1(++_0x4765e9);}(_0xe14b,0x93));var _0xbe14=function(_0x5c1cd1,_0x47062a){_0x5c1cd1=_0x5c1cd1-0x0;var _0x34b671=_0xe14b[_0x5c1cd1];return _0x34b671;};'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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index bba8773..fb83309 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 _0x70b1=['result','catch','ShowSetting','Setting','find','raw','options','where','attributes','include','model','map','then','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x8941d4,_0x220c53){var _0x5beb42=function(_0x4b3d5e){while(--_0x4b3d5e){_0x8941d4['push'](_0x8941d4['shift']());}};_0x5beb42(++_0x220c53);}(_0x70b1,0xcd));var _0x170b=function(_0x5dbe75,_0x5d23e0){_0x5dbe75=_0x5dbe75-0x0;var _0x528bd3=_0x70b1[_0x5dbe75];return _0x528bd3;};'use strict';var _=require(_0x170b('0x0'));var util=require(_0x170b('0x1'));var moment=require(_0x170b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x170b('0x3'));var db=require(_0x170b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x170b('0x5'))(_0x170b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x170b('0x7')][_0x170b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d827d,_0x22b826,_0x5e70af){return new BPromise(function(_0x14377d,_0xf1c01b){return client[_0x170b('0x9')](_0x1d827d,_0x5e70af)['then'](function(_0x5efd3f){logger[_0x170b('0xa')](_0x170b('0xb'),_0x22b826,_0x170b('0xc'));logger[_0x170b('0xd')](_0x170b('0xe'),_0x22b826,_0x170b('0xc'),JSON[_0x170b('0xf')](_0x5efd3f));if(_0x5efd3f['error']){if(_0x5efd3f[_0x170b('0x10')][_0x170b('0x11')]===0x1f4){logger[_0x170b('0x10')](_0x170b('0xb'),_0x22b826,_0x5efd3f['error']['message']);return _0xf1c01b(_0x5efd3f[_0x170b('0x10')]['message']);}logger['error'](_0x170b('0xb'),_0x22b826,_0x5efd3f[_0x170b('0x10')][_0x170b('0x12')]);return _0x14377d(_0x5efd3f['error'][_0x170b('0x12')]);}else{logger[_0x170b('0xa')](_0x170b('0xb'),_0x22b826,_0x170b('0xc'));_0x14377d(_0x5efd3f[_0x170b('0x13')][_0x170b('0x12')]);}})[_0x170b('0x14')](function(_0x549f52){logger['error'](_0x170b('0xb'),_0x22b826,_0x549f52);_0xf1c01b(_0x549f52);});});}exports[_0x170b('0x15')]=function(_0x4390d7){var _0x20ea91=this;return new Promise(function(_0x3de1eb,_0x2da85e){return db[_0x170b('0x16')][_0x170b('0x17')]({'raw':_0x4390d7['options']?_0x4390d7['options'][_0x170b('0x18')]===undefined?!![]:![]:!![],'where':_0x4390d7[_0x170b('0x19')]?_0x4390d7[_0x170b('0x19')][_0x170b('0x1a')]||null:null,'attributes':_0x4390d7[_0x170b('0x19')]?_0x4390d7['options'][_0x170b('0x1b')]||null:null,'include':_0x4390d7[_0x170b('0x19')]?_0x4390d7[_0x170b('0x19')][_0x170b('0x1c')]?_['map'](_0x4390d7[_0x170b('0x19')][_0x170b('0x1c')],function(_0x3c3961){return{'model':db[_0x3c3961[_0x170b('0x1d')]],'as':_0x3c3961['as'],'attributes':_0x3c3961[_0x170b('0x1b')],'include':_0x3c3961['include']?_[_0x170b('0x1e')](_0x3c3961['include'],function(_0x403a6b){return{'model':db[_0x403a6b[_0x170b('0x1d')]],'as':_0x403a6b['as'],'attributes':_0x403a6b[_0x170b('0x1b')],'include':_0x403a6b[_0x170b('0x1c')]?_[_0x170b('0x1e')](_0x403a6b[_0x170b('0x1c')],function(_0x377bd9){return{'model':db[_0x377bd9[_0x170b('0x1d')]],'as':_0x377bd9['as'],'attributes':_0x377bd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x170b('0x1f')](function(_0x2eefe4){logger['info']('ShowSetting',_0x4390d7);logger['debug']('ShowSetting',_0x4390d7,JSON[_0x170b('0xf')](_0x2eefe4));_0x3de1eb(_0x2eefe4);})['catch'](function(_0x578cc1){logger[_0x170b('0x10')](_0x170b('0x15'),_0x578cc1[_0x170b('0x12')],_0x4390d7);_0x2da85e(_0x20ea91[_0x170b('0x10')](0x1f4,_0x578cc1[_0x170b('0x12')]));});});}; \ No newline at end of file +var _0xc1e0=['request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','map','include','model','stringify','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc1e0,0x18d));var _0x0c1e=function(_0x10bba9,_0x32a3dc){_0x10bba9=_0x10bba9-0x0;var _0x44ffc1=_0xc1e0[_0x10bba9];return _0x44ffc1;};'use strict';var _=require('lodash');var util=require(_0x0c1e('0x0'));var moment=require('moment');var BPromise=require(_0x0c1e('0x1'));var rs=require(_0x0c1e('0x2'));var fs=require('fs');var Redis=require(_0x0c1e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c1e('0x4'));var logger=require(_0x0c1e('0x5'))(_0x0c1e('0x6'));var config=require(_0x0c1e('0x7'));var jayson=require(_0x0c1e('0x8'));var client=jayson[_0x0c1e('0x9')][_0x0c1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x155554,_0x35ed23,_0x18ead6){return new BPromise(function(_0x5ec02f,_0x522aa7){return client[_0x0c1e('0xb')](_0x155554,_0x18ead6)[_0x0c1e('0xc')](function(_0x37bea0){logger[_0x0c1e('0xd')](_0x0c1e('0xe'),_0x35ed23,_0x0c1e('0xf'));logger[_0x0c1e('0x10')](_0x0c1e('0x11'),_0x35ed23,_0x0c1e('0xf'),JSON['stringify'](_0x37bea0));if(_0x37bea0[_0x0c1e('0x12')]){if(_0x37bea0['error'][_0x0c1e('0x13')]===0x1f4){logger[_0x0c1e('0x12')]('Setting,\x20%s,\x20%s',_0x35ed23,_0x37bea0[_0x0c1e('0x12')][_0x0c1e('0x14')]);return _0x522aa7(_0x37bea0[_0x0c1e('0x12')][_0x0c1e('0x14')]);}logger[_0x0c1e('0x12')]('Setting,\x20%s,\x20%s',_0x35ed23,_0x37bea0[_0x0c1e('0x12')][_0x0c1e('0x14')]);return _0x5ec02f(_0x37bea0[_0x0c1e('0x12')][_0x0c1e('0x14')]);}else{logger[_0x0c1e('0xd')]('Setting,\x20%s,\x20%s',_0x35ed23,'request\x20sent');_0x5ec02f(_0x37bea0[_0x0c1e('0x15')][_0x0c1e('0x14')]);}})[_0x0c1e('0x16')](function(_0x3d4bb8){logger['error'](_0x0c1e('0xe'),_0x35ed23,_0x3d4bb8);_0x522aa7(_0x3d4bb8);});});}exports[_0x0c1e('0x17')]=function(_0xef88bd){var _0x1f674c=this;return new Promise(function(_0x59bac2,_0x4df87e){return db[_0x0c1e('0x18')][_0x0c1e('0x19')]({'raw':_0xef88bd['options']?_0xef88bd[_0x0c1e('0x1a')][_0x0c1e('0x1b')]===undefined?!![]:![]:!![],'where':_0xef88bd[_0x0c1e('0x1a')]?_0xef88bd[_0x0c1e('0x1a')][_0x0c1e('0x1c')]||null:null,'attributes':_0xef88bd[_0x0c1e('0x1a')]?_0xef88bd['options'][_0x0c1e('0x1d')]||null:null,'include':_0xef88bd[_0x0c1e('0x1a')]?_0xef88bd[_0x0c1e('0x1a')]['include']?_[_0x0c1e('0x1e')](_0xef88bd[_0x0c1e('0x1a')][_0x0c1e('0x1f')],function(_0x621264){return{'model':db[_0x621264[_0x0c1e('0x20')]],'as':_0x621264['as'],'attributes':_0x621264['attributes'],'include':_0x621264[_0x0c1e('0x1f')]?_['map'](_0x621264[_0x0c1e('0x1f')],function(_0x4841f9){return{'model':db[_0x4841f9[_0x0c1e('0x20')]],'as':_0x4841f9['as'],'attributes':_0x4841f9[_0x0c1e('0x1d')],'include':_0x4841f9[_0x0c1e('0x1f')]?_[_0x0c1e('0x1e')](_0x4841f9[_0x0c1e('0x1f')],function(_0x2a3473){return{'model':db[_0x2a3473[_0x0c1e('0x20')]],'as':_0x2a3473['as'],'attributes':_0x2a3473[_0x0c1e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0c1e('0xc')](function(_0x240d13){logger['info'](_0x0c1e('0x17'),_0xef88bd);logger['debug'](_0x0c1e('0x17'),_0xef88bd,JSON[_0x0c1e('0x21')](_0x240d13));_0x59bac2(_0x240d13);})['catch'](function(_0x313783){logger['error']('ShowSetting',_0x313783[_0x0c1e('0x14')],_0xef88bd);_0x4df87e(_0x1f674c[_0x0c1e('0x12')](0x1f4,_0x313783['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 65acc0f..290f16b 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x1e8ec3,_0x3f0312){var _0x2d5f70=function(_0x1c812a){while(--_0x1c812a){_0x1e8ec3['push'](_0x1e8ec3['shift']());}};_0x2d5f70(++_0x3f0312);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x1674cc,_0x512650){var _0x3347a1=function(_0x1f7881){while(--_0x1f7881){_0x1674cc['push'](_0x1674cc['shift']());}};_0x3347a1(++_0x512650);}(_0x7a54,0x106));var _0x47a5=function(_0x48c5bb,_0x3e08ce){_0x48c5bb=_0x48c5bb-0x0;var _0x430dbd=_0x7a54[_0x48c5bb];return _0x430dbd;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 8fd64bd..faf4d57 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 _0xa5dc=['plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio'];(function(_0x1a57f5,_0x341be2){var _0x3bf1a3=function(_0x5ebd87){while(--_0x5ebd87){_0x1a57f5['push'](_0x1a57f5['shift']());}};_0x3bf1a3(++_0x341be2);}(_0xa5dc,0x1c5));var _0xca5d=function(_0x2e0ffa,_0x451f12){_0x2e0ffa=_0x2e0ffa-0x0;var _0x24d627=_0xa5dc[_0x2e0ffa];return _0x24d627;};'use strict';var Sequelize=require(_0xca5d('0x0'));var rs=require(_0xca5d('0x1'));module[_0xca5d('0x2')]={'name':{'type':Sequelize[_0xca5d('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xca5d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xca5d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xca5d('0x3')],'defaultValue':function(){return rs[_0xca5d('0x4')]();}},'phone':{'type':Sequelize[_0xca5d('0x3')]},'type':{'type':Sequelize[_0xca5d('0x5')](_0xca5d('0x6'),'skebby','connectel','clicksend',_0xca5d('0x7'),_0xca5d('0x8'),'bandwidth',_0xca5d('0x9'),_0xca5d('0xa'),_0xca5d('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xca5d('0x3')]},'authToken':{'type':Sequelize[_0xca5d('0x3')]},'smsMethod':{'type':Sequelize[_0xca5d('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xca5d('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xca5d('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xca5d('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xca5d('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xca5d('0x3')]},'notificationTemplate':{'type':Sequelize[_0xca5d('0xd')],'defaultValue':function(){return _0xca5d('0xe');}},'notificationSound':{'type':Sequelize[_0xca5d('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xca5d('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xca5d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xca5d('0xf')],'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[_0xca5d('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xca5d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xca5d('0xf')],'comment':_0xca5d('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xca5d('0xc')],'defaultValue':![],'comment':_0xca5d('0x11'),'set':function(_0x5d034c){if(!_0x5d034c)this[_0xca5d('0x12')]('mandatoryDispositionPauseId',null);this[_0xca5d('0x12')](_0xca5d('0x13'),_0x5d034c);}}}; \ No newline at end of file +var _0x2ad7=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x33f583,_0x383e66){var _0x12478a=function(_0x27af99){while(--_0x27af99){_0x33f583['push'](_0x33f583['shift']());}};_0x12478a(++_0x383e66);}(_0x2ad7,0x14d));var _0x72ad=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2ad7[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x72ad('0x0'));var rs=require(_0x72ad('0x1'));module[_0x72ad('0x2')]={'name':{'type':Sequelize[_0x72ad('0x3')],'unique':_0x72ad('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x72ad('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x72ad('0x3')],'defaultValue':function(){return rs[_0x72ad('0x5')]();}},'phone':{'type':Sequelize[_0x72ad('0x3')]},'type':{'type':Sequelize[_0x72ad('0x6')](_0x72ad('0x7'),_0x72ad('0x8'),'connectel','clicksend',_0x72ad('0x9'),_0x72ad('0xa'),_0x72ad('0xb'),_0x72ad('0xc'),'infobip',_0x72ad('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x72ad('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x72ad('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x72ad('0x3')]},'applicationId':{'type':Sequelize[_0x72ad('0x3')]},'accountId':{'type':Sequelize[_0x72ad('0x3')]},'senderString':{'type':Sequelize[_0x72ad('0x3')]},'deliveryReport':{'type':Sequelize[_0x72ad('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x72ad('0xf')],'defaultValue':function(){return _0x72ad('0x10');}},'notificationSound':{'type':Sequelize[_0x72ad('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x72ad('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x72ad('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x72ad('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x72ad('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x72ad('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x72ad('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x72ad('0x11')],'comment':_0x72ad('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x72ad('0x13'),'set':function(_0x2d6738){if(!_0x2d6738)this[_0x72ad('0x14')]('mandatoryDispositionPauseId',null);this[_0x72ad('0x14')](_0x72ad('0x15'),_0x2d6738);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 623f845..7fa8eaa 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 _0x63a1=['util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','SmsAccounts','UserProfileResource','destroy','end','stack','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','show','params','Pause','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From','messageId','MessageSid','from','sender','text','connectel','clicksend','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','refid','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','User','unshift','agent','queueId','SmsQueue','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','intelepeer','redif','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x4125c4,_0x12a3a4){var _0x1107f9=function(_0x24fcda){while(--_0x24fcda){_0x4125c4['push'](_0x4125c4['shift']());}};_0x1107f9(++_0x12a3a4);}(_0x63a1,0xe4));var _0x163a=function(_0x488076,_0x2f3718){_0x488076=_0x488076-0x0;var _0x178d2e=_0x63a1[_0x488076];return _0x178d2e;};'use strict';var emlformat=require(_0x163a('0x0'));var rimraf=require(_0x163a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x163a('0x2'));var moment=require(_0x163a('0x3'));var BPromise=require(_0x163a('0x4'));var Mustache=require(_0x163a('0x5'));var util=require(_0x163a('0x6'));var path=require('path');var sox=require(_0x163a('0x7'));var csv=require(_0x163a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x163a('0x9'));var _=require(_0x163a('0xa'));var squel=require(_0x163a('0xb'));var crypto=require(_0x163a('0xc'));var jsforce=require(_0x163a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x163a('0xe'));var Papa=require(_0x163a('0xf'));var Redis=require(_0x163a('0x10'));var authService=require(_0x163a('0x11'));var qs=require(_0x163a('0x12'));var as=require(_0x163a('0x13'));var hardwareService=require(_0x163a('0x14'));var logger=require(_0x163a('0x15'))(_0x163a('0x16'));var utils=require(_0x163a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x163a('0x18'));var db=require(_0x163a('0x19'))['db'];config[_0x163a('0x1a')]=_[_0x163a('0x1b')](config[_0x163a('0x1a')],{'host':_0x163a('0x1c'),'port':0x18eb});var socket=require(_0x163a('0x1d'))(new Redis(config[_0x163a('0x1a')]));require(_0x163a('0x1e'))[_0x163a('0x1f')](socket);var jayson=require(_0x163a('0x20'));var client=jayson[_0x163a('0x21')][_0x163a('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x3b7fec,_0x2a0a32,_0x5ef07b,_0x3e12f2){return new BPromise(function(_0x36366c,_0x19b1a1){var _0x4e8a70=_0x3e12f2||client;return _0x4e8a70[_0x163a('0x23')](_0x3b7fec,_0x5ef07b)[_0x163a('0x24')](function(_0x441a15){logger[_0x163a('0x25')]('SmsAccount,\x20%s,\x20%s',_0x2a0a32,_0x163a('0x26'));logger[_0x163a('0x27')](_0x163a('0x28'),_0x2a0a32,_0x163a('0x26'),JSON[_0x163a('0x29')](_0x441a15));if(_0x441a15['error']){if(_0x441a15[_0x163a('0x2a')][_0x163a('0x2b')]===0x1f4){logger[_0x163a('0x2a')](_0x163a('0x2c'),_0x2a0a32,_0x441a15[_0x163a('0x2a')][_0x163a('0x2d')]);return _0x19b1a1(_0x441a15[_0x163a('0x2a')][_0x163a('0x2d')]);}logger[_0x163a('0x2a')](_0x163a('0x2c'),_0x2a0a32,_0x441a15['error'][_0x163a('0x2d')]);return _0x36366c(_0x441a15[_0x163a('0x2a')][_0x163a('0x2d')]);}else{logger['info'](_0x163a('0x2c'),_0x2a0a32,_0x163a('0x26'));_0x36366c(_0x441a15[_0x163a('0x2e')]['message']);}})[_0x163a('0x2f')](function(_0x4b508d){logger[_0x163a('0x2a')](_0x163a('0x2c'),_0x2a0a32,_0x4b508d);_0x19b1a1(_0x4b508d);});});}function respondWithStatusCode(_0x4591b5,_0xb648f8){_0xb648f8=_0xb648f8||0xcc;return function(_0x4e45c7){if(_0x4e45c7){return _0x4591b5[_0x163a('0x30')](_0xb648f8);}return _0x4591b5[_0x163a('0x31')](_0xb648f8)['end']();};}function respondWithResult(_0x5b18dc,_0x413506){_0x413506=_0x413506||0xc8;return function(_0x5b68bc){if(_0x5b68bc){return _0x5b18dc[_0x163a('0x31')](_0x413506)[_0x163a('0x32')](_0x5b68bc);}};}function respondWithFilteredResult(_0x2d3b27,_0x3b130e){return function(_0x48b612){if(_0x48b612){var _0x40c43c=typeof _0x3b130e[_0x163a('0x33')]===_0x163a('0x34')&&typeof _0x3b130e[_0x163a('0x35')]===_0x163a('0x34');var _0xc58f22=_0x48b612[_0x163a('0x36')];var _0x5b5a48=_0x40c43c?0x0:_0x3b130e[_0x163a('0x33')];var _0x329531=_0x40c43c?_0x48b612['count']:_0x3b130e['offset']+_0x3b130e[_0x163a('0x35')];var _0x496841;if(_0x329531>=_0xc58f22){_0x329531=_0xc58f22;_0x496841=0xc8;}else{_0x496841=0xce;}_0x2d3b27[_0x163a('0x31')](_0x496841);return _0x2d3b27[_0x163a('0x37')](_0x163a('0x38'),_0x5b5a48+'-'+_0x329531+'/'+_0xc58f22)[_0x163a('0x32')](_0x48b612);}return null;};}function patchUpdates(_0x1f330f){return function(_0x5e1e65){try{jsonpatch[_0x163a('0x39')](_0x5e1e65,_0x1f330f,!![]);}catch(_0x1c97ee){return BPromise['reject'](_0x1c97ee);}return _0x5e1e65[_0x163a('0x3a')]();};}function saveUpdates(_0x49dcb3,_0xb87d7c){return function(_0xf910ba){if(_0xf910ba){return _0xf910ba[_0x163a('0x3b')](_0x49dcb3)[_0x163a('0x24')](function(_0x21ef7a){return _0x21ef7a;});}return null;};}function removeEntity(_0x45e161,_0x66eead){return function(_0x5d9dd4){if(_0x5d9dd4){return _0x5d9dd4['destroy']()[_0x163a('0x24')](function(){var _0x11c35b=_0x5d9dd4[_0x163a('0x3c')]({'plain':!![]});var _0x5b35a2=_0x163a('0x3d');return db[_0x163a('0x3e')][_0x163a('0x3f')]({'where':{'type':_0x5b35a2,'resourceId':_0x11c35b['id']}})[_0x163a('0x24')](function(){return _0x5d9dd4;});})[_0x163a('0x24')](function(){_0x45e161['status'](0xcc)[_0x163a('0x40')]();});}};}function handleEntityNotFound(_0x549036,_0x582f58){return function(_0x26043a){if(!_0x26043a){_0x549036[_0x163a('0x30')](0x194);}return _0x26043a;};}function handleError(_0x3e2771,_0x359767){_0x359767=_0x359767||0x1f4;return function(_0x50ede9){logger[_0x163a('0x2a')](_0x50ede9[_0x163a('0x41')]);if(_0x50ede9[_0x163a('0x42')]){delete _0x50ede9[_0x163a('0x42')];}_0x3e2771[_0x163a('0x31')](_0x359767)[_0x163a('0x43')](_0x50ede9);};}exports[_0x163a('0x44')]=function(_0x528d75,_0x3f047d){var _0xafcaed={'include':[{'model':db['Pause'],'as':_0x163a('0x45')}]},_0x371dcb={},_0x49eadd={'count':0x0,'rows':[]};var _0x57757e=_[_0x163a('0x46')](db[_0x163a('0x47')][_0x163a('0x48')],function(_0x5148d6){return{'name':_0x5148d6[_0x163a('0x49')],'type':_0x5148d6[_0x163a('0x4a')][_0x163a('0x4b')]};});_0x371dcb[_0x163a('0x4c')]=_[_0x163a('0x46')](_0x57757e,_0x163a('0x42'));_0x371dcb[_0x163a('0x4d')]=_[_0x163a('0x4e')](_0x528d75['query']);_0x371dcb[_0x163a('0x4f')]=_[_0x163a('0x50')](_0x371dcb[_0x163a('0x4c')],_0x371dcb['query']);_0xafcaed[_0x163a('0x51')]=_[_0x163a('0x50')](_0x371dcb[_0x163a('0x4c')],qs[_0x163a('0x52')](_0x528d75[_0x163a('0x4d')][_0x163a('0x52')]));_0xafcaed[_0x163a('0x51')]=_0xafcaed[_0x163a('0x51')][_0x163a('0x53')]?_0xafcaed[_0x163a('0x51')]:_0x371dcb[_0x163a('0x4c')];if(!_0x528d75[_0x163a('0x4d')][_0x163a('0x54')](_0x163a('0x55'))){_0xafcaed[_0x163a('0x35')]=qs[_0x163a('0x35')](_0x528d75[_0x163a('0x4d')][_0x163a('0x35')]);_0xafcaed[_0x163a('0x33')]=qs[_0x163a('0x33')](_0x528d75[_0x163a('0x4d')]['offset']);}_0xafcaed[_0x163a('0x56')]=qs[_0x163a('0x57')](_0x528d75[_0x163a('0x4d')][_0x163a('0x57')]);_0xafcaed[_0x163a('0x58')]=qs['filters'](_[_0x163a('0x59')](_0x528d75['query'],_0x371dcb['filters']),_0x57757e);if(_0x528d75[_0x163a('0x4d')][_0x163a('0x5a')]){_0xafcaed[_0x163a('0x58')]=_['merge'](_0xafcaed['where'],{'$or':_[_0x163a('0x46')](_0x57757e,function(_0x2a56bb){if(_0x2a56bb[_0x163a('0x4a')]!==_0x163a('0x5b')){var _0x4de840={};_0x4de840[_0x2a56bb[_0x163a('0x42')]]={'$like':'%'+_0x528d75[_0x163a('0x4d')][_0x163a('0x5a')]+'%'};return _0x4de840;}})});}_0xafcaed=_[_0x163a('0x5c')]({},_0xafcaed,_0x528d75[_0x163a('0x5d')]);var _0x4e41ae={'where':_0xafcaed['where']};return db[_0x163a('0x47')]['count'](_0x4e41ae)[_0x163a('0x24')](function(_0x27e604){_0x49eadd[_0x163a('0x36')]=_0x27e604;if(_0x528d75['query'][_0x163a('0x5e')]){_0xafcaed['include']=[{'all':!![]}];}return db[_0x163a('0x47')][_0x163a('0x5f')](_0xafcaed);})[_0x163a('0x24')](function(_0xbabda3){_0x49eadd['rows']=_0xbabda3;return _0x49eadd;})['then'](respondWithFilteredResult(_0x3f047d,_0xafcaed))[_0x163a('0x2f')](handleError(_0x3f047d,null));};exports[_0x163a('0x60')]=function(_0x2edb2c,_0x21243c){var _0x1da710={'raw':![],'where':{'id':_0x2edb2c[_0x163a('0x61')]['id']},'include':[{'model':db[_0x163a('0x62')],'as':'mandatoryDispositionPause'}]},_0x4312b1={};_0x4312b1[_0x163a('0x4c')]=_[_0x163a('0x4e')](db['SmsAccount']['rawAttributes']);_0x4312b1[_0x163a('0x4d')]=_[_0x163a('0x4e')](_0x2edb2c[_0x163a('0x4d')]);_0x4312b1['filters']=_[_0x163a('0x50')](_0x4312b1[_0x163a('0x4c')],_0x4312b1[_0x163a('0x4d')]);_0x1da710['attributes']=_[_0x163a('0x50')](_0x4312b1[_0x163a('0x4c')],qs[_0x163a('0x52')](_0x2edb2c[_0x163a('0x4d')][_0x163a('0x52')]));_0x1da710['attributes']=_0x1da710['attributes']['length']?_0x1da710[_0x163a('0x51')]:_0x4312b1[_0x163a('0x4c')];if(_0x2edb2c[_0x163a('0x4d')][_0x163a('0x5e')]){_0x1da710[_0x163a('0x63')]=[{'all':!![]}];}_0x1da710=_[_0x163a('0x5c')]({},_0x1da710,_0x2edb2c[_0x163a('0x5d')]);return db[_0x163a('0x47')][_0x163a('0x64')](_0x1da710)[_0x163a('0x24')](handleEntityNotFound(_0x21243c,null))['then'](respondWithResult(_0x21243c,null))['catch'](handleError(_0x21243c,null));};exports[_0x163a('0x65')]=function(_0x443e6d,_0x44f02d){return db[_0x163a('0x47')]['create'](_0x443e6d[_0x163a('0x66')],{})[_0x163a('0x24')](function(_0x31ac17){var _0x77a1fe=_0x443e6d['user'][_0x163a('0x3c')]({'plain':!![]});if(!_0x77a1fe)throw new Error(_0x163a('0x67'));if(_0x77a1fe['role']===_0x163a('0x68')){var _0x324684=_0x31ac17[_0x163a('0x3c')]({'plain':!![]});var _0x25a2fa='SmsAccounts';return db[_0x163a('0x69')][_0x163a('0x64')]({'where':{'name':_0x25a2fa,'userProfileId':_0x77a1fe[_0x163a('0x6a')]},'raw':!![]})[_0x163a('0x24')](function(_0x4f105a){if(_0x4f105a&&_0x4f105a[_0x163a('0x6b')]===0x0){return db['UserProfileResource'][_0x163a('0x65')]({'name':_0x324684[_0x163a('0x42')],'resourceId':_0x324684['id'],'type':_0x4f105a[_0x163a('0x42')],'sectionId':_0x4f105a['id']},{})[_0x163a('0x24')](function(){return _0x31ac17;});}else{return _0x31ac17;}})[_0x163a('0x2f')](function(_0x3c5c5e){logger[_0x163a('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c5c5e);throw _0x3c5c5e;});}return _0x31ac17;})[_0x163a('0x24')](respondWithResult(_0x44f02d,0xc9))[_0x163a('0x2f')](handleError(_0x44f02d,null));};exports[_0x163a('0x3b')]=function(_0x3a3472,_0x4efe6f){if(_0x3a3472[_0x163a('0x66')]['id']){delete _0x3a3472[_0x163a('0x66')]['id'];}return db[_0x163a('0x47')]['find']({'where':{'id':_0x3a3472[_0x163a('0x61')]['id']},'include':[{'model':db[_0x163a('0x62')],'as':_0x163a('0x45')}]})[_0x163a('0x24')](handleEntityNotFound(_0x4efe6f,null))[_0x163a('0x24')](saveUpdates(_0x3a3472[_0x163a('0x66')],null))[_0x163a('0x24')](respondWithResult(_0x4efe6f,null))[_0x163a('0x2f')](handleError(_0x4efe6f,null));};exports[_0x163a('0x3f')]=function(_0xfcfe22,_0x42bf41){return db['SmsAccount'][_0x163a('0x64')]({'where':{'id':_0xfcfe22[_0x163a('0x61')]['id']}})[_0x163a('0x24')](handleEntityNotFound(_0x42bf41,null))[_0x163a('0x24')](removeEntity(_0x42bf41,null))[_0x163a('0x2f')](handleError(_0x42bf41,null));};exports['describe']=function(_0x4f4d87,_0x5400cd){return db[_0x163a('0x47')][_0x163a('0x6c')]()[_0x163a('0x24')](respondWithResult(_0x5400cd,null))[_0x163a('0x2f')](handleError(_0x5400cd,null));};exports[_0x163a('0x6d')]=function(_0x2e51e6,_0x22a5e9,_0x554cfe){if(_0x2e51e6[_0x163a('0x66')]['id']){delete _0x2e51e6[_0x163a('0x66')]['id'];}return db['SmsAccount'][_0x163a('0x64')]({'where':{'id':_0x2e51e6[_0x163a('0x61')]['id']}})[_0x163a('0x24')](handleEntityNotFound(_0x22a5e9,null))['then'](function(_0x3d1cd3){if(_0x3d1cd3){_0x2e51e6[_0x163a('0x66')][_0x163a('0x6e')]=_0x3d1cd3['id'];return db[_0x163a('0x6f')]['create'](_0x2e51e6[_0x163a('0x66')]);}})[_0x163a('0x24')](respondWithResult(_0x22a5e9,null))['catch'](handleError(_0x22a5e9,null));};exports[_0x163a('0x70')]=function(_0x106d57,_0x50d4c4,_0xbd255b){var _0x2d71ff={'raw':![],'where':{}};var _0x9398e={};var _0x528668={'count':0x0,'rows':[]};return db[_0x163a('0x47')][_0x163a('0x71')]({'where':{'id':_0x106d57[_0x163a('0x61')]['id']}})['then'](handleEntityNotFound(_0x50d4c4,null))[_0x163a('0x24')](function(_0x5e5e61){if(_0x5e5e61){_0x9398e[_0x163a('0x4c')]=_[_0x163a('0x4e')](db[_0x163a('0x6f')][_0x163a('0x48')]);_0x9398e['query']=_['keys'](_0x106d57['query']);_0x9398e[_0x163a('0x4f')]=_[_0x163a('0x50')](_0x9398e['model'],_0x9398e[_0x163a('0x4d')]);_0x2d71ff[_0x163a('0x51')]=_[_0x163a('0x50')](_0x9398e[_0x163a('0x4c')],qs['fields'](_0x106d57['query'][_0x163a('0x52')]));_0x2d71ff[_0x163a('0x51')]=_0x2d71ff[_0x163a('0x51')][_0x163a('0x53')]?_0x2d71ff[_0x163a('0x51')]:_0x9398e['model'];if(!_0x106d57[_0x163a('0x4d')][_0x163a('0x54')](_0x163a('0x55'))){_0x2d71ff[_0x163a('0x35')]=qs['limit'](_0x106d57[_0x163a('0x4d')]['limit']);_0x2d71ff[_0x163a('0x33')]=qs['offset'](_0x106d57[_0x163a('0x4d')][_0x163a('0x33')]);}_0x2d71ff[_0x163a('0x56')]=qs[_0x163a('0x57')](_0x106d57[_0x163a('0x4d')][_0x163a('0x57')]);_0x2d71ff[_0x163a('0x58')]=qs[_0x163a('0x4f')](_['pick'](_0x106d57['query'],_0x9398e[_0x163a('0x4f')]));_0x2d71ff[_0x163a('0x58')][_0x163a('0x6e')]=_0x5e5e61['id'];if(_0x106d57['query'][_0x163a('0x5a')]){_0x2d71ff['where']=_['merge'](_0x2d71ff['where'],{'$or':_['map'](_0x2d71ff[_0x163a('0x51')],function(_0x5c7b5a){var _0x25e608={};_0x25e608[_0x5c7b5a]={'$like':'%'+_0x106d57[_0x163a('0x4d')][_0x163a('0x5a')]+'%'};return _0x25e608;})});}_0x2d71ff=_[_0x163a('0x5c')]({},_0x2d71ff,_0x106d57[_0x163a('0x5d')]);return db[_0x163a('0x6f')][_0x163a('0x36')]({'where':_0x2d71ff[_0x163a('0x58')]})[_0x163a('0x24')](function(_0x5ae7b4){_0x528668[_0x163a('0x36')]=_0x5ae7b4;if(_0x106d57[_0x163a('0x4d')]['includeAll']){_0x2d71ff[_0x163a('0x63')]=[{'all':!![]}];}return db[_0x163a('0x6f')][_0x163a('0x5f')](_0x2d71ff);})[_0x163a('0x24')](function(_0x5f2868){_0x528668[_0x163a('0x72')]=_0x5f2868;return _0x528668;});}})[_0x163a('0x24')](respondWithFilteredResult(_0x50d4c4,_0x2d71ff))[_0x163a('0x2f')](handleError(_0x50d4c4,null));};exports[_0x163a('0x73')]=function(_0xee6988,_0x2b0431,_0x436ecc){return db[_0x163a('0x47')][_0x163a('0x64')]({'where':{'id':_0xee6988[_0x163a('0x61')]['id']}})[_0x163a('0x24')](handleEntityNotFound(_0x2b0431,null))[_0x163a('0x24')](function(_0x82b7){if(_0x82b7){return _0x82b7[_0x163a('0x73')](_0xee6988[_0x163a('0x4d')][_0x163a('0x74')]);}})[_0x163a('0x24')](respondWithStatusCode(_0x2b0431,null))[_0x163a('0x2f')](handleError(_0x2b0431,null));};exports['addAnswer']=function(_0x22af05,_0x1fa9ff,_0x120cea){if(_0x22af05[_0x163a('0x66')]['id']){delete _0x22af05['body']['id'];}return db[_0x163a('0x47')]['find']({'where':{'id':_0x22af05[_0x163a('0x61')]['id']}})[_0x163a('0x24')](handleEntityNotFound(_0x1fa9ff,null))[_0x163a('0x24')](function(_0x1d549a){if(_0x1d549a){_0x22af05[_0x163a('0x66')][_0x163a('0x6e')]=_0x1d549a['id'];return db[_0x163a('0x75')][_0x163a('0x65')](_0x22af05['body']);}})[_0x163a('0x24')](respondWithResult(_0x1fa9ff,null))[_0x163a('0x2f')](handleError(_0x1fa9ff,null));};exports[_0x163a('0x76')]=function(_0x4df17e,_0x4c3e3e,_0x5a6536){var _0xfba647={'raw':![],'where':{}};var _0x5d8649={};var _0x21ee30={'count':0x0,'rows':[]};return db['SmsAccount'][_0x163a('0x71')]({'where':{'id':_0x4df17e[_0x163a('0x61')]['id']}})['then'](handleEntityNotFound(_0x4c3e3e,null))[_0x163a('0x24')](function(_0x851e0){if(_0x851e0){_0x5d8649[_0x163a('0x4c')]=_[_0x163a('0x4e')](db[_0x163a('0x75')][_0x163a('0x48')]);_0x5d8649[_0x163a('0x4d')]=_[_0x163a('0x4e')](_0x4df17e['query']);_0x5d8649[_0x163a('0x4f')]=_[_0x163a('0x50')](_0x5d8649['model'],_0x5d8649['query']);_0xfba647[_0x163a('0x51')]=_[_0x163a('0x50')](_0x5d8649['model'],qs['fields'](_0x4df17e[_0x163a('0x4d')][_0x163a('0x52')]));_0xfba647['attributes']=_0xfba647['attributes'][_0x163a('0x53')]?_0xfba647[_0x163a('0x51')]:_0x5d8649[_0x163a('0x4c')];if(!_0x4df17e['query']['hasOwnProperty'](_0x163a('0x55'))){_0xfba647['limit']=qs[_0x163a('0x35')](_0x4df17e[_0x163a('0x4d')][_0x163a('0x35')]);_0xfba647[_0x163a('0x33')]=qs[_0x163a('0x33')](_0x4df17e[_0x163a('0x4d')][_0x163a('0x33')]);}_0xfba647['order']=qs[_0x163a('0x57')](_0x4df17e['query']['sort']);_0xfba647['where']=qs[_0x163a('0x4f')](_['pick'](_0x4df17e['query'],_0x5d8649['filters']));_0xfba647[_0x163a('0x58')]['SmsAccountId']=_0x851e0['id'];if(_0x4df17e[_0x163a('0x4d')][_0x163a('0x5a')]){_0xfba647['where']=_[_0x163a('0x5c')](_0xfba647['where'],{'$or':_[_0x163a('0x46')](_0xfba647['attributes'],function(_0x32e773){var _0x132b46={};_0x132b46[_0x32e773]={'$like':'%'+_0x4df17e[_0x163a('0x4d')][_0x163a('0x5a')]+'%'};return _0x132b46;})});}_0xfba647=_[_0x163a('0x5c')]({},_0xfba647,_0x4df17e[_0x163a('0x5d')]);return db[_0x163a('0x75')][_0x163a('0x36')]({'where':_0xfba647[_0x163a('0x58')]})[_0x163a('0x24')](function(_0x3d6042){_0x21ee30['count']=_0x3d6042;if(_0x4df17e[_0x163a('0x4d')][_0x163a('0x5e')]){_0xfba647['include']=[{'all':!![]}];}return db[_0x163a('0x75')][_0x163a('0x5f')](_0xfba647);})['then'](function(_0x30cd1c){_0x21ee30['rows']=_0x30cd1c;return _0x21ee30;});}})[_0x163a('0x24')](respondWithFilteredResult(_0x4c3e3e,_0xfba647))['catch'](handleError(_0x4c3e3e,null));};exports['removeAnswers']=function(_0x108233,_0x1e937f,_0x5aa9f6){return db['SmsAccount'][_0x163a('0x64')]({'where':{'id':_0x108233[_0x163a('0x61')]['id']}})[_0x163a('0x24')](handleEntityNotFound(_0x1e937f,null))[_0x163a('0x24')](function(_0x4a7005){if(_0x4a7005){return _0x4a7005[_0x163a('0x77')](_0x108233[_0x163a('0x4d')][_0x163a('0x74')]);}})[_0x163a('0x24')](respondWithStatusCode(_0x1e937f,null))[_0x163a('0x2f')](handleError(_0x1e937f,null));};exports['notify']=function(_0x31618d,_0xcf9163,_0x35f614){var _0x2c5efc={'channel':_0x163a('0x78')};var _0x21ce8d=[];var _0x463f87=[];var _0x451028={};return db[_0x163a('0x47')][_0x163a('0x64')]({'where':{'id':_0x31618d['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x163a('0x79')}]})[_0x163a('0x24')](handleEntityNotFound(_0xcf9163,null))[_0x163a('0x24')](function(_0xd9e6ee){_0x2c5efc[_0x163a('0x7a')]=_0xd9e6ee;_0x2c5efc[_0x163a('0x7b')]=_[_0x163a('0x7c')](_0xd9e6ee[_0x163a('0x79')],[_0x163a('0x7d')],[_0x163a('0x7e')]);if(_0x2c5efc[_0x163a('0x7a')][_0x163a('0x79')]){delete _0x2c5efc[_0x163a('0x7a')][_0x163a('0x79')];}return db[_0x163a('0x7f')][_0x163a('0x6c')]();})[_0x163a('0x24')](function(_0x4d2524){if(!_0x4d2524){throw new db[(_0x163a('0x80'))][(_0x163a('0x81'))](_0x163a('0x82'));}_0x21ce8d=_[_0x163a('0x83')](_[_0x163a('0x4e')](_0x4d2524),['createdAt','updatedAt']);_0x463f87=_[_0x163a('0x83')](_['keys'](_0x4d2524),[_0x163a('0x84'),_0x163a('0x85'),_0x163a('0x86'),_0x163a('0x87')]);_0x2c5efc[_0x163a('0x66')]={'mapKey':_0x163a('0x88')};if(_0x2c5efc['account'][_0x163a('0x4a')]){switch(_0x2c5efc[_0x163a('0x7a')][_0x163a('0x4a')]){case'twilio':_0x2c5efc['body']['from']=_0x31618d[_0x163a('0x66')][_0x163a('0x89')];_0x2c5efc[_0x163a('0x66')][_0x163a('0x66')]=_0x31618d[_0x163a('0x66')]['Body'];_0x2c5efc[_0x163a('0x66')][_0x163a('0x8a')]=_0x31618d[_0x163a('0x66')][_0x163a('0x8b')];break;case'skebby':_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')]='+'+_0x31618d[_0x163a('0x66')][_0x163a('0x8d')];_0x2c5efc[_0x163a('0x66')][_0x163a('0x66')]=_0x31618d[_0x163a('0x66')][_0x163a('0x8e')];break;case _0x163a('0x8f'):_0x2c5efc['body'][_0x163a('0x8c')]=_0x31618d[_0x163a('0x66')]['from'];_0x2c5efc[_0x163a('0x66')]['body']=_0x31618d[_0x163a('0x66')]['message'];break;case _0x163a('0x90'):_0x2c5efc[_0x163a('0x66')]['from']=_0x31618d[_0x163a('0x66')]['from'];_0x2c5efc[_0x163a('0x66')]['body']=_0x31618d[_0x163a('0x66')][_0x163a('0x66')];_0x2c5efc[_0x163a('0x66')][_0x163a('0x8a')]=_0x31618d[_0x163a('0x66')]['message_id'];break;case _0x163a('0x91'):_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')]=_0x31618d[_0x163a('0x66')]['From'];_0x2c5efc['body']['body']=_0x31618d[_0x163a('0x66')][_0x163a('0x92')];_0x2c5efc[_0x163a('0x66')]['messageId']=_0x31618d[_0x163a('0x66')][_0x163a('0x93')];break;case _0x163a('0x94'):_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')]='+'+_0x31618d[_0x163a('0x66')][_0x163a('0x95')][0x0][_0x163a('0x8c')];_0x2c5efc['body'][_0x163a('0x66')]=_0x31618d[_0x163a('0x66')][_0x163a('0x95')][0x0][_0x163a('0x8e')];_0x2c5efc[_0x163a('0x66')][_0x163a('0x8a')]=_0x31618d[_0x163a('0x66')][_0x163a('0x95')][0x0][_0x163a('0x8a')];break;case _0x163a('0x96'):_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')]=_0x31618d[_0x163a('0x66')][_0x163a('0x97')];_0x2c5efc[_0x163a('0x66')][_0x163a('0x66')]=_0x31618d[_0x163a('0x66')][_0x163a('0x98')][_0x163a('0x2d')];break;case _0x163a('0x99'):_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')]=_0x31618d[_0x163a('0x66')][_0x163a('0x9a')];_0x2c5efc['body'][_0x163a('0x66')]=_0x31618d[_0x163a('0x66')][_0x163a('0x8e')];_0x2c5efc['body'][_0x163a('0x8a')]=_0x31618d[_0x163a('0x66')]['replyMessageId'];break;case _0x163a('0x9b'):_0x2c5efc['body'][_0x163a('0x8a')]=_0x31618d[_0x163a('0x66')][0x0]['message']['id'];_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')]=_0x31618d['body'][0x0][_0x163a('0x2d')]['from'];_0x2c5efc[_0x163a('0x66')][_0x163a('0x66')]=_0x31618d['body'][0x0][_0x163a('0x2d')][_0x163a('0x8e')];break;case'intelepeer':_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')]=_0x31618d[_0x163a('0x66')][_0x163a('0x8c')];_0x2c5efc[_0x163a('0x66')][_0x163a('0x66')]=_0x31618d[_0x163a('0x66')][_0x163a('0x2d')];_0x2c5efc[_0x163a('0x66')][_0x163a('0x8a')]=_0x31618d[_0x163a('0x66')][_0x163a('0x9c')];break;}}if(_0x2c5efc[_0x163a('0x66')]['id']){delete _0x2c5efc[_0x163a('0x66')]['id'];}if(_['isNil'](_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')])){throw new db[(_0x163a('0x80'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x2c5efc[_0x163a('0x66')]['body'])||_0x2c5efc[_0x163a('0x66')]['body']===''){throw new db['Sequelize'][(_0x163a('0x81'))](_0x163a('0x9d'));}if(_[_0x163a('0x9e')](_0x2c5efc[_0x163a('0x66')][_0x163a('0x9f')])){throw new db['Sequelize'][(_0x163a('0x81'))](_0x163a('0xa0')+_0x463f87);}if(!_['includes'](_0x463f87,_0x2c5efc[_0x163a('0x66')][_0x163a('0x9f')])){throw new db[(_0x163a('0x80'))][(_0x163a('0x81'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x463f87);}_0x451028[_0x2c5efc[_0x163a('0x66')][_0x163a('0x9f')]]=_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')];return db[_0x163a('0xa1')]['find']({'where':{'id':_0x2c5efc['account'][_0x163a('0x87')]},'include':[{'model':db['CmContact'],'as':_0x163a('0xa2'),'where':_0x451028,'limit':0x1,'order':[[_0x163a('0x85'),_0x163a('0xa3')]]}]});})[_0x163a('0x24')](handleEntityNotFound(_0xcf9163,null))[_0x163a('0x24')](function(_0x5d9420){if(_0x5d9420){_0x2c5efc[_0x163a('0xa4')]=_['omit'](_0x5d9420,['Contacts']);if(_0x5d9420[_0x163a('0xa2')]['length']){return _0x5d9420[_0x163a('0xa2')][0x0];}var _0x5b2742=_[_0x163a('0x1b')](_0x2c5efc[_0x163a('0x66')],{'firstName':_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')],'ListId':_0x5d9420['id']});_0x5b2742[_0x2c5efc['body'][_0x163a('0x9f')]]=_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')];return db['CmContact'][_0x163a('0x65')](_0x5b2742,{'fields':_0x21ce8d,'raw':!![]});}})[_0x163a('0x24')](handleEntityNotFound(_0xcf9163,null))[_0x163a('0x24')](function(_0x4fb8c8){if(_0x4fb8c8){_0x2c5efc[_0x163a('0xa5')]=_0x4fb8c8;var _0x564d7f={'ContactId':_0x4fb8c8['id'],'phone':_0x2c5efc['body'][_0x163a('0x8c')],'SmsAccountId':_0x31618d[_0x163a('0x61')]['id']};var _0x14a132={'ContactId':_0x4fb8c8['id'],'SmsAccountId':_0x31618d[_0x163a('0x61')]['id'],'closed':![]};return db[_0x163a('0xa6')][_0x163a('0x64')]({'where':_0x14a132})['then'](function(_0x22aec0){if(_0x22aec0){return[_0x22aec0,![]];}return db['SmsInteraction'][_0x163a('0x65')](_0x564d7f)[_0x163a('0x24')](function(_0x31d33d){return[_0x31d33d,!![]];});});}})[_0x163a('0xa7')](function(_0x175c32,_0x117956){_0x2c5efc[_0x163a('0xa8')]=_0x175c32[_0x163a('0x3c')]({'plain':!![]});_0x2c5efc[_0x163a('0xa8')][_0x163a('0xa9')]=![];if(_0x117956){if(_0x2c5efc[_0x163a('0x7a')]['autoclose']){_0x2c5efc[_0x163a('0x7b')][_0x163a('0xaa')]({'id':0x0,'priority':_0x2c5efc[_0x163a('0x7b')][_0x163a('0x53')]+0x1,'app':_0x163a('0xab'),'appdata':_0x163a('0xac'),'interval':_0x163a('0xad')});}_0x2c5efc[_0x163a('0xa8')][_0x163a('0xa9')]=!![];}return db['SmsMessage'][_0x163a('0x65')]({'phone':_0x2c5efc[_0x163a('0x66')][_0x163a('0x8c')],'messageId':_0x2c5efc[_0x163a('0x66')][_0x163a('0x8a')],'body':_0x2c5efc['body'][_0x163a('0x66')],'SmsAccountId':_0x31618d['params']['id'],'SmsInteractionId':_0x175c32['id'],'direction':'in','ContactId':_0x175c32[_0x163a('0xae')],'AttachmentId':_0x2c5efc[_0x163a('0x66')][_0x163a('0xaf')]});})[_0x163a('0x24')](function(_0x404b84){_0x2c5efc[_0x163a('0x2d')]=_0x404b84;if(!_0x2c5efc['interaction']['UserId'])return;return db[_0x163a('0xb0')][_0x163a('0x64')]({'attributes':['id','name'],'where':{'id':_0x2c5efc[_0x163a('0xa8')]['UserId']}});})[_0x163a('0x24')](function(_0x25d62e){if(_0x25d62e){_0x2c5efc[_0x163a('0x7b')][_0x163a('0xb1')]({'id':0x0,'priority':0x0,'app':_0x163a('0xb2'),'appdata':_0x25d62e[_0x163a('0x42')]+','+(_0x2c5efc[_0x163a('0x7a')]['waitForTheAssignedAgent']||0xa),'interval':_0x163a('0xad')});}if(!_0x2c5efc[_0x163a('0xa8')][_0x163a('0xb3')])return;return db[_0x163a('0xb4')][_0x163a('0x64')]({'attributes':['id',_0x163a('0x42')],'where':{'id':_0x2c5efc[_0x163a('0xa8')][_0x163a('0xb3')]}});})['then'](function(_0x3f3e20){if(_0x3f3e20){_0x2c5efc[_0x163a('0x7b')][_0x163a('0xb1')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3f3e20[_0x163a('0x42')]+','+(_0x2c5efc[_0x163a('0x7a')]['waitForTheAssignedQueue']||0x12c),'interval':_0x163a('0xad')});}return respondWithRpcPromise(_0x163a('0xb5'),_0x163a('0xb6'),_0x2c5efc);})['then'](function(_0x1446f6){if(_0x1446f6){var _0x1cabd9=0xc8;var _0x33a45c=_0x163a('0xb7');logger[_0x163a('0x25')](_0x163a('0x28'),_0x33a45c,_0x1cabd9,_0x163a('0xb8'));logger[_0x163a('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x33a45c,_0x1cabd9,_0x163a('0xb8'),JSON[_0x163a('0x29')](_0x1446f6));if(_0x2c5efc[_0x163a('0x7a')][_0x163a('0x4a')]==='twilio'){return _0xcf9163['status'](_0x1cabd9)[_0x163a('0x37')](_0x163a('0xb9'),_0x163a('0xba'))[_0x163a('0x43')](_0x163a('0xbb'));}else{return _0xcf9163[_0x163a('0x31')](_0x1cabd9)[_0x163a('0x32')](_0x1446f6);}}})[_0x163a('0x2f')](handleError(_0xcf9163,null));};exports[_0x163a('0xbc')]=function(_0x1dd635,_0xeeded1){var _0x2baa60=_0x1dd635[_0x163a('0x61')]['id'];var _0x536163=_0x1dd635['body'];var _0xe26125=0xc8;var _0x5a35d2=null;return db[_0x163a('0xbd')][_0x163a('0xbe')]({'isolationLevel':db[_0x163a('0xbd')][_0x163a('0xbf')][_0x163a('0xc0')][_0x163a('0xc1')]},function(_0x383f20){return db[_0x163a('0x47')]['findOne']({'where':{'id':_0x2baa60},'transaction':_0x383f20})['then'](function(_0x24a274){if(_0x24a274){return db[_0x163a('0xc2')][_0x163a('0x3f')]({'where':{'SmsAccountId':_0x2baa60},'transaction':_0x383f20})[_0x163a('0x24')](function(){var _0x176988=_['map'](_0x536163,function(_0x106495){_0x106495[_0x163a('0x6e')]=_0x2baa60;return _0x106495;});return db[_0x163a('0xc2')][_0x163a('0xc3')](_0x176988,{'transaction':_0x383f20});});}else{_0xe26125=0x194;_0x5a35d2=[];}});})[_0x163a('0x24')](function(){if(_0xe26125!==0x194){return db[_0x163a('0xc2')][_0x163a('0xc4')]({'where':{'SmsAccountId':_0x2baa60},'order':'priority'})['then'](function(_0x2f4f67){_0x5a35d2=_0x2f4f67;});}})[_0x163a('0x2f')](function(_0x1728e7){_0xe26125=0x1f4;logger['error'](_0x1728e7['stack']);if(_0x1728e7[_0x163a('0x42')]){delete _0x1728e7[_0x163a('0x42')];}_0x5a35d2=_0x1728e7;})[_0x163a('0xc5')](function(){if(_0x5a35d2===null){_0xeeded1[_0x163a('0x30')](_0xe26125);}else{if(_0xe26125===0x1f4){_0xeeded1[_0x163a('0x31')](_0xe26125)['send'](_0x5a35d2);}else{_0xeeded1[_0x163a('0x31')](_0xe26125)[_0x163a('0x32')](_0x5a35d2);}}});};exports[_0x163a('0xc6')]=function(_0x1dd270,_0x12e45d,_0x37d28d){var _0x1cae8b={};var _0x187116={};var _0x140220;var _0x18fe8f;return db[_0x163a('0x47')][_0x163a('0x71')]({'where':{'id':_0x1dd270['params']['id']}})['then'](handleEntityNotFound(_0x12e45d,null))[_0x163a('0x24')](function(_0x90aaf){if(_0x90aaf){_0x140220=_0x90aaf;_0x187116['model']=_[_0x163a('0x4e')](db[_0x163a('0xc2')][_0x163a('0x48')]);_0x187116['query']=_[_0x163a('0x4e')](_0x1dd270[_0x163a('0x4d')]);_0x187116[_0x163a('0x4f')]=_[_0x163a('0x50')](_0x187116['model'],_0x187116['query']);_0x1cae8b[_0x163a('0x51')]=_['intersection'](_0x187116[_0x163a('0x4c')],qs['fields'](_0x1dd270[_0x163a('0x4d')]['fields']));_0x1cae8b[_0x163a('0x51')]=_0x1cae8b[_0x163a('0x51')][_0x163a('0x53')]?_0x1cae8b[_0x163a('0x51')]:_0x187116['model'];_0x1cae8b[_0x163a('0x56')]=qs[_0x163a('0x57')](_0x1dd270[_0x163a('0x4d')][_0x163a('0x57')]);_0x1cae8b[_0x163a('0x58')]=qs[_0x163a('0x4f')](_[_0x163a('0x59')](_0x1dd270[_0x163a('0x4d')],_0x187116[_0x163a('0x4f')]));if(_0x1dd270['query']['filter']){_0x1cae8b[_0x163a('0x58')]=_['merge'](_0x1cae8b[_0x163a('0x58')],{'$or':_[_0x163a('0x46')](_0x1cae8b[_0x163a('0x51')],function(_0x15411c){var _0x1a0705={};_0x1a0705[_0x15411c]={'$like':'%'+_0x1dd270[_0x163a('0x4d')][_0x163a('0x5a')]+'%'};return _0x1a0705;})});}_0x1cae8b=_[_0x163a('0x5c')]({},_0x1cae8b,_0x1dd270['options']);return _0x140220[_0x163a('0xc6')](_0x1cae8b);}})['then'](function(_0xfa74da){if(_0xfa74da){_0x18fe8f=_0xfa74da[_0x163a('0x53')];if(!_0x1dd270[_0x163a('0x4d')][_0x163a('0x54')](_0x163a('0x55'))){_0x1cae8b[_0x163a('0x35')]=qs[_0x163a('0x35')](_0x1dd270[_0x163a('0x4d')]['limit']);_0x1cae8b['offset']=qs[_0x163a('0x33')](_0x1dd270[_0x163a('0x4d')][_0x163a('0x33')]);}return _0x140220['getApplications'](_0x1cae8b);}})[_0x163a('0x24')](function(_0x2e8761){if(_0x2e8761){return _0x2e8761?{'count':_0x18fe8f,'rows':_0x2e8761}:null;}})[_0x163a('0x24')](respondWithResult(_0x12e45d,null))[_0x163a('0x2f')](handleError(_0x12e45d,null));};exports[_0x163a('0xc7')]=function(_0x195c6a,_0x515110,_0x2bac35){var _0x335e39={'raw':![],'where':{}};var _0x517088={};var _0x493f84={'count':0x0,'rows':[]};return db[_0x163a('0x47')][_0x163a('0x71')]({'where':{'id':_0x195c6a[_0x163a('0x61')]['id']}})[_0x163a('0x24')](handleEntityNotFound(_0x515110,null))[_0x163a('0x24')](function(_0x3d13c4){if(_0x3d13c4){_0x517088['model']=_[_0x163a('0x4e')](db['SmsInteraction'][_0x163a('0x48')]);_0x517088[_0x163a('0x4d')]=_[_0x163a('0x4e')](_0x195c6a['query']);_0x517088[_0x163a('0x4f')]=_[_0x163a('0x50')](_0x517088[_0x163a('0x4c')],_0x517088[_0x163a('0x4d')]);_0x335e39['attributes']=_[_0x163a('0x50')](_0x517088['model'],qs['fields'](_0x195c6a[_0x163a('0x4d')]['fields']));_0x335e39[_0x163a('0x51')]=_0x335e39[_0x163a('0x51')][_0x163a('0x53')]?_0x335e39[_0x163a('0x51')]:_0x517088['model'];if(!_0x195c6a[_0x163a('0x4d')][_0x163a('0x54')](_0x163a('0x55'))){_0x335e39[_0x163a('0x35')]=qs[_0x163a('0x35')](_0x195c6a[_0x163a('0x4d')][_0x163a('0x35')]);_0x335e39[_0x163a('0x33')]=qs[_0x163a('0x33')](_0x195c6a[_0x163a('0x4d')][_0x163a('0x33')]);}_0x335e39[_0x163a('0x56')]=qs[_0x163a('0x57')](_0x195c6a[_0x163a('0x4d')][_0x163a('0x57')]);_0x335e39[_0x163a('0x58')]=qs[_0x163a('0x4f')](_['pick'](_0x195c6a[_0x163a('0x4d')],_0x517088['filters']));_0x335e39[_0x163a('0x58')][_0x163a('0x6e')]=_0x3d13c4['id'];if(_0x195c6a['query'][_0x163a('0x5a')]){_0x335e39[_0x163a('0x58')]=_['merge'](_0x335e39['where'],{'$or':_[_0x163a('0x46')](_0x335e39[_0x163a('0x51')],function(_0x16c0ee){var _0x3faed9={};_0x3faed9[_0x16c0ee]={'$like':'%'+_0x195c6a['query'][_0x163a('0x5a')]+'%'};return _0x3faed9;})});}_0x335e39=_[_0x163a('0x5c')]({},_0x335e39,_0x195c6a[_0x163a('0x5d')]);return db[_0x163a('0xa6')][_0x163a('0x36')]({'where':_0x335e39[_0x163a('0x58')]})['then'](function(_0x7dd411){_0x493f84[_0x163a('0x36')]=_0x7dd411;if(_0x195c6a[_0x163a('0x4d')]['includeAll']){_0x335e39[_0x163a('0x63')]=[{'model':db[_0x163a('0x7f')],'as':_0x163a('0xc8'),'required':![]},{'model':db[_0x163a('0xb0')],'as':_0x163a('0xc9'),'attributes':[_0x163a('0x42'),_0x163a('0xca'),_0x163a('0xcb')],'required':![]},{'model':db['Tag'],'as':_0x163a('0xcc'),'attributes':['id','name',_0x163a('0xcd')],'where':_0x195c6a[_0x163a('0x4d')][_0x163a('0xce')]?{'id':_0x195c6a[_0x163a('0x4d')][_0x163a('0xce')]}:undefined,'required':_0x195c6a[_0x163a('0x4d')][_0x163a('0xce')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x335e39);})[_0x163a('0x24')](function(_0x57bdad){_0x493f84[_0x163a('0x72')]=_0x57bdad;return _0x493f84;});}})['then'](respondWithFilteredResult(_0x515110,_0x335e39))[_0x163a('0x2f')](handleError(_0x515110,null));};exports[_0x163a('0x43')]=function(_0x5efeb5,_0x1a7c6d,_0x263366){var _0x3a3991,_0x3c6da7,_0x30e1f7;if(_['isNil'](_0x5efeb5['body'][_0x163a('0x66')])||_0x5efeb5[_0x163a('0x66')][_0x163a('0x66')]===''){throw new db[(_0x163a('0x80'))][(_0x163a('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x163a('0x9e')](_0x5efeb5[_0x163a('0x66')]['to'])){throw new db[(_0x163a('0x80'))][(_0x163a('0x81'))]('to\x20is\x20mandatory');}_0x3a3991=_0x5efeb5[_0x163a('0x66')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x5efeb5['params']['id']},'include':[{'model':db[_0x163a('0xa1')],'as':_0x163a('0xcf'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x3a3991},'limit':0x1,'order':[[_0x163a('0x85'),_0x163a('0xa3')]]}]}]})[_0x163a('0x24')](handleEntityNotFound(_0x1a7c6d,null))['then'](function(_0x1d9584){if(_0x1d9584&&_0x1d9584[_0x163a('0xcf')]){_0x3c6da7=_0x1d9584['get']({'plain':!![]});if(_0x3c6da7[_0x163a('0xcf')]&&_0x3c6da7[_0x163a('0xcf')][_0x163a('0xa2')][_0x163a('0x53')]){return _0x3c6da7[_0x163a('0xcf')][_0x163a('0xa2')][0x0];}return db[_0x163a('0x7f')][_0x163a('0x65')](_[_0x163a('0x1b')](_0x5efeb5[_0x163a('0x66')],{'firstName':_0x3a3991,'mobile':_0x3a3991,'phone':_0x3a3991,'ListId':_0x3c6da7[_0x163a('0x87')]}));}})[_0x163a('0x24')](handleEntityNotFound(_0x1a7c6d,null))[_0x163a('0x24')](function(_0x16df77){if(_0x16df77){_0x30e1f7=_0x16df77;return db['SmsInteraction'][_0x163a('0x64')]({'where':{'ContactId':_0x30e1f7['id'],'closed':![],'SmsAccountId':_0x3c6da7['id']}})[_0x163a('0x24')](function(_0x48c6a2){if(_0x48c6a2){return[_0x48c6a2,![]];}return db['SmsInteraction'][_0x163a('0x65')]({'UserId':_0x5efeb5[_0x163a('0x68')]['id'],'ContactId':_0x30e1f7['id'],'SmsAccountId':_0x3c6da7['id'],'phone':_0x3a3991,'firstMsgDirection':_0x163a('0xd0'),'Messages':[_[_0x163a('0x5c')](_0x5efeb5[_0x163a('0x66')],{'read':![],'body':_0x5efeb5[_0x163a('0x66')][_0x163a('0x66')],'phone':_0x3a3991,'SmsAccountId':_0x3c6da7['id'],'UserId':_0x5efeb5[_0x163a('0x68')]['id'],'ContactId':_0x30e1f7['id']})]},{'include':[{'model':db[_0x163a('0xd1')],'as':_0x163a('0xd2')}]})[_0x163a('0x24')](function(_0x69a6a7){return[_0x69a6a7,!![]];});});}})[_0x163a('0xa7')](function(_0x13fa85,_0x1c72fc){if(_0x1c72fc){return _0x13fa85;}return db[_0x163a('0xd1')][_0x163a('0x65')](_[_0x163a('0x5c')](_0x5efeb5[_0x163a('0x66')],{'read':![],'body':_0x5efeb5[_0x163a('0x66')]['body'],'phone':_0x3a3991,'SmsAccountId':_0x3c6da7['id'],'SmsInteractionId':_0x13fa85['id'],'UserId':_0x5efeb5[_0x163a('0x68')]['id'],'ContactId':_0x30e1f7['id']}))[_0x163a('0x24')](function(_0x5bb347){_0x13fa85[_0x163a('0xd3')][_0x163a('0xd2')]=[];_0x13fa85[_0x163a('0xd3')][_0x163a('0xd2')][_0x163a('0xaa')](_0x5bb347['dataValues']);return _0x13fa85;});})[_0x163a('0x24')](respondWithResult(_0x1a7c6d,null))[_0x163a('0x2f')](handleError(_0x1a7c6d,null));};exports[_0x163a('0x31')]=function(_0xd88c24,_0x2a30b8,_0x1ba8b0){if(_0xd88c24[_0x163a('0x66')]['id']){delete _0xd88c24[_0x163a('0x66')]['id'];}var _0x1b46f0,_0x2e8bfa,_0x596fb0;return db[_0x163a('0x47')][_0x163a('0x64')]({'where':{'id':_0xd88c24[_0x163a('0x61')]['id']}})['then'](handleEntityNotFound(_0x2a30b8,null))[_0x163a('0x24')](function(_0x495988){if(_0x495988){_0x596fb0=_0x495988;logger[_0x163a('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x163a('0x31'),_0x163a('0xd4'),_0x495988[_0x163a('0x4a')],util[_0x163a('0xd5')](_0xd88c24['body'],{'showHidden':![],'depth':null}));switch(_0x495988['type']){case _0x163a('0xd6'):if(_0xd88c24['body'][_0x163a('0xd7')]&&_0xd88c24[_0x163a('0x66')][_0x163a('0x31')]){_0x2e8bfa=_0xd88c24[_0x163a('0x66')][_0x163a('0x31')];return db[_0x163a('0xd1')]['find']({'where':{'messageId':_0xd88c24['body'][_0x163a('0xd7')]}});}break;case _0x163a('0x8f'):if(_0xd88c24[_0x163a('0x66')][_0x163a('0xd8')]&&_0xd88c24[_0x163a('0x66')][_0x163a('0xd9')]){_0x2e8bfa=_0xd88c24[_0x163a('0x66')][_0x163a('0xd9')];return db[_0x163a('0xd1')]['find']({'where':{'messageId':_0xd88c24[_0x163a('0x66')][_0x163a('0xd8')]}});}break;case _0x163a('0x90'):if(_0xd88c24['body'][_0x163a('0xda')]&&_0xd88c24[_0x163a('0x66')]['status_code']){_0x2e8bfa=_0xd88c24['body'][_0x163a('0xdb')];return db[_0x163a('0xd1')][_0x163a('0x64')]({'where':{'messageId':_0xd88c24[_0x163a('0x66')]['message_id']}});}break;case _0x163a('0x94'):var _0x339759=_0xd88c24['body'][_0x163a('0x95')][0x0];if(_0x339759[_0x163a('0x8a')]&&_0x339759['status'][_0x163a('0xdc')]===_0x163a('0xdd')){_0x2e8bfa=_0x339759[_0x163a('0x31')]['groupName'];return db[_0x163a('0xd1')][_0x163a('0x64')]({'where':{'messageId':_0x339759['messageId']}});}break;case'clickatell':if(_0xd88c24[_0x163a('0x66')][_0x163a('0x8a')]&&_0xd88c24[_0x163a('0x66')][_0x163a('0x31')]){_0x2e8bfa=_0xd88c24[_0x163a('0x66')]['status'];return db[_0x163a('0xd1')]['find']({'where':{'messageId':_0xd88c24['body']['messageId']}});}break;case'bandwidth':if(_0xd88c24[_0x163a('0x66')][0x0]['message']['id']){_0x2e8bfa=_0xd88c24['body'][0x0][_0x163a('0x4a')];return db[_0x163a('0xd1')][_0x163a('0x64')]({'where':{'messageId':_0xd88c24['body'][0x0][_0x163a('0x2d')]['id']}});}break;case _0x163a('0xde'):if(_0xd88c24[_0x163a('0x66')][_0x163a('0xdf')]&&_0xd88c24[_0x163a('0x66')][_0x163a('0x31')]){_0x2e8bfa=_0xd88c24[_0x163a('0x66')][_0x163a('0x31')];return db[_0x163a('0xd1')][_0x163a('0x64')]({'where':{'messageId':_0xd88c24[_0x163a('0x66')][_0x163a('0xdf')]}});}break;}}})[_0x163a('0x24')](handleEntityNotFound(_0x2a30b8,null))[_0x163a('0x24')](function(_0x3f2d3d){if(_0x3f2d3d){_0x1b46f0=_0x3f2d3d;switch(_0x596fb0[_0x163a('0x4a')]){case _0x163a('0xd6'):if(_0x2e8bfa===_0x163a('0xdd')){return _0x1b46f0[_0x163a('0x3b')]({'read':!![]});}else{logger['error'](_0x163a('0x28'),_0x163a('0x31'),_0x163a('0xd6'),util[_0x163a('0xd5')](_0xd88c24[_0x163a('0x66')],{'showHidden':![],'depth':null}));}break;case _0x163a('0x8f'):if(_0x2e8bfa==='1'){return _0x1b46f0['update']({'read':!![]});}else{logger['error'](_0x163a('0x28'),_0x163a('0x31'),_0x163a('0xd6'),util[_0x163a('0xd5')](_0xd88c24[_0x163a('0x66')],{'showHidden':![],'depth':null}));}break;case _0x163a('0x90'):if(!_0xd88c24[_0x163a('0x66')]['error_code']&&_0x2e8bfa>=0xc8&&_0x2e8bfa<=0xce){return _0x1b46f0[_0x163a('0x3b')]({'read':!![]});}else{logger[_0x163a('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x163a('0x31'),_0x163a('0x90'),util[_0x163a('0xd5')](_0xd88c24[_0x163a('0x66')],{'showHidden':![],'depth':null}));}break;case _0x163a('0x94'):var _0x393e35=_0xd88c24[_0x163a('0x66')]['results'][0x0];if(_0x393e35[_0x163a('0x31')][_0x163a('0xdc')]==='DELIVERED'){return _0x1b46f0[_0x163a('0x3b')]({'read':!![]});}else{logger[_0x163a('0x2a')](_0x163a('0x28'),_0x163a('0x31'),_0x163a('0x94'),util[_0x163a('0xd5')](_0xd88c24['body'],{'showHidden':![],'depth':null}));}break;case _0x163a('0x99'):if(_0x2e8bfa==_0x163a('0xe0')||_0x2e8bfa=='RECEIVED_BY_RECIPIENT'){return _0x1b46f0[_0x163a('0x3b')]({'read':!![]});}else{logger[_0x163a('0x2a')](_0x163a('0x28'),_0x163a('0x31'),_0x163a('0x99'),util[_0x163a('0xd5')](_0xd88c24['body'],{'showHidden':![],'depth':null}));}break;case _0x163a('0x9b'):if(_0x2e8bfa=='message-delivered'){return _0x1b46f0[_0x163a('0x3b')]({'read':!![]});}else{logger['error'](_0x163a('0x28'),_0x163a('0x31'),_0x163a('0x9b'),util[_0x163a('0xd5')](_0xd88c24[_0x163a('0x66')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x2e8bfa===_0x163a('0xe1')||_0x2e8bfa===_0x163a('0xe2')){return _0x1b46f0[_0x163a('0x3b')]({'read':!![]});}else{logger[_0x163a('0x2a')](_0x163a('0x28'),_0x163a('0x31'),_0x163a('0xde'),util[_0x163a('0xd5')](_0xd88c24[_0x163a('0x66')],{'showHidden':![],'depth':null}));}break;}return _0x1b46f0;}})[_0x163a('0x24')](respondWithResult(_0x2a30b8,null))[_0x163a('0x2f')](handleError(_0x2a30b8,null));};exports['statusGet']=function(_0x3bdd63,_0x1ec45f,_0xdcfe4b){var _0x481851,_0x29de9b,_0x41ac95;return db['SmsAccount'][_0x163a('0x64')]({'where':{'id':_0x3bdd63[_0x163a('0x61')]['id']}})[_0x163a('0x24')](handleEntityNotFound(_0x1ec45f,null))[_0x163a('0x24')](function(_0x1854a5){if(_0x1854a5){_0x41ac95=_0x1854a5;logger[_0x163a('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x163a('0x31'),_0x163a('0xd4'),_0x1854a5[_0x163a('0x4a')],util[_0x163a('0xd5')](_0x3bdd63[_0x163a('0x4d')],{'showHidden':![],'depth':null}));switch(_0x1854a5[_0x163a('0x4a')]){case _0x163a('0x96'):if(_0x3bdd63[_0x163a('0x4d')][_0x163a('0xe3')]&&_0x3bdd63[_0x163a('0x4d')][_0x163a('0xe4')]){_0x29de9b=_0x3bdd63[_0x163a('0x4d')][_0x163a('0xe4')];return db[_0x163a('0xd1')][_0x163a('0x64')]({'where':{'messageId':_0x3bdd63[_0x163a('0x4d')][_0x163a('0xe3')]}});}break;}}})[_0x163a('0x24')](handleEntityNotFound(_0x1ec45f,null))[_0x163a('0x24')](function(_0xd2fa74){if(_0xd2fa74){_0x481851=_0xd2fa74;switch(_0x41ac95[_0x163a('0x4a')]){case'csc':if(_0x29de9b==='2'||_0x29de9b==='6'){return _0x481851['update']({'read':!![]});}else{logger[_0x163a('0x2a')](_0x163a('0x28'),_0x163a('0x31'),_0x163a('0x96'),util[_0x163a('0xd5')](_0x3bdd63[_0x163a('0x4d')],{'showHidden':![],'depth':null}));};break;}return _0x481851;}})['then'](respondWithResult(_0x1ec45f,null))['catch'](handleError(_0x1ec45f,null));};exports[_0x163a('0xe5')]=function(_0x45515f,_0x237a16,_0x72c07c){return db[_0x163a('0x47')][_0x163a('0x64')]({'where':{'id':_0x45515f[_0x163a('0x61')]['id']}})[_0x163a('0x24')](handleEntityNotFound(_0x237a16,null))['then'](function(_0x30f131){if(_0x30f131){return _0x30f131[_0x163a('0xe5')](_0x45515f['body']['ids'],_['omit'](_0x45515f['body'],['ids','id'])||{})[_0x163a('0xa7')](function(_0x1b9db4){for(var _0x2564cd=0x0;_0x2564cd<_0x45515f[_0x163a('0x66')][_0x163a('0x74')][_0x163a('0x53')];_0x2564cd+=0x1){socket[_0x163a('0xe6')]('userSmsAccount:save',{'UserId':Number(_0x45515f['body'][_0x163a('0x74')][_0x2564cd]),'SmsAccountId':Number(_0x45515f[_0x163a('0x61')]['id'])});}return _0x1b9db4;});}})[_0x163a('0x24')](respondWithResult(_0x237a16,null))[_0x163a('0x2f')](handleError(_0x237a16,null));};exports['removeAgents']=function(_0x20d0e5,_0x21df6e,_0x5d59fc){return db['SmsAccount'][_0x163a('0x64')]({'where':{'id':_0x20d0e5['params']['id']}})[_0x163a('0x24')](handleEntityNotFound(_0x21df6e,null))[_0x163a('0x24')](function(_0x39e3ef){if(_0x39e3ef){return _0x39e3ef['removeAgents'](_0x20d0e5['query'][_0x163a('0x74')])[_0x163a('0x24')](function(){if(_[_0x163a('0xe7')](_0x20d0e5['query']['ids'])){for(var _0x3df365=0x0;_0x3df365<_0x20d0e5['query'][_0x163a('0x74')][_0x163a('0x53')];_0x3df365+=0x1){socket['emit'](_0x163a('0xe8'),{'UserId':Number(_0x20d0e5[_0x163a('0x4d')]['ids'][_0x3df365]),'SmsAccountId':Number(_0x20d0e5[_0x163a('0x61')]['id'])});}}else{socket[_0x163a('0xe6')](_0x163a('0xe8'),{'UserId':Number(_0x20d0e5[_0x163a('0x4d')][_0x163a('0x74')]),'SmsAccountId':Number(_0x20d0e5[_0x163a('0x61')]['id'])});}});}})[_0x163a('0x24')](respondWithStatusCode(_0x21df6e,null))[_0x163a('0x2f')](handleError(_0x21df6e,null));};exports['getAgents']=function(_0x308880,_0x3cf28f,_0x29bbe6){var _0x22c4f8={};var _0x3121af={};var _0x2baff2;var _0x25e017;return db[_0x163a('0x47')]['findOne']({'where':{'id':_0x308880['params']['id']}})['then'](handleEntityNotFound(_0x3cf28f,null))[_0x163a('0x24')](function(_0x1c7023){if(_0x1c7023){_0x2baff2=_0x1c7023;_0x3121af[_0x163a('0x4c')]=_[_0x163a('0x4e')](db[_0x163a('0xb0')]['rawAttributes']);_0x3121af[_0x163a('0x4d')]=_[_0x163a('0x4e')](_0x308880['query']);_0x3121af[_0x163a('0x4f')]=_[_0x163a('0x50')](_0x3121af[_0x163a('0x4c')],_0x3121af['query']);_0x22c4f8[_0x163a('0x51')]=_[_0x163a('0x50')](_0x3121af[_0x163a('0x4c')],qs[_0x163a('0x52')](_0x308880[_0x163a('0x4d')][_0x163a('0x52')]));_0x22c4f8[_0x163a('0x51')]=_0x22c4f8[_0x163a('0x51')][_0x163a('0x53')]?_0x22c4f8[_0x163a('0x51')]:_0x3121af[_0x163a('0x4c')];_0x22c4f8[_0x163a('0x56')]=qs[_0x163a('0x57')](_0x308880['query'][_0x163a('0x57')]);_0x22c4f8['where']=qs[_0x163a('0x4f')](_[_0x163a('0x59')](_0x308880[_0x163a('0x4d')],_0x3121af[_0x163a('0x4f')]));if(_0x308880['query'][_0x163a('0x5a')]){_0x22c4f8[_0x163a('0x58')]=_[_0x163a('0x5c')](_0x22c4f8[_0x163a('0x58')],{'$or':_['map'](_0x22c4f8[_0x163a('0x51')],function(_0x1454f3){var _0x3fa94b={};_0x3fa94b[_0x1454f3]={'$like':'%'+_0x308880[_0x163a('0x4d')][_0x163a('0x5a')]+'%'};return _0x3fa94b;})});}_0x22c4f8=_[_0x163a('0x5c')]({},_0x22c4f8,_0x308880[_0x163a('0x5d')]);return _0x2baff2[_0x163a('0xe9')](_0x22c4f8);}})['then'](function(_0x2755a1){if(_0x2755a1){_0x25e017=_0x2755a1[_0x163a('0x53')];if(!_0x308880[_0x163a('0x4d')][_0x163a('0x54')](_0x163a('0x55'))){_0x22c4f8[_0x163a('0x35')]=qs['limit'](_0x308880[_0x163a('0x4d')]['limit']);_0x22c4f8[_0x163a('0x33')]=qs[_0x163a('0x33')](_0x308880[_0x163a('0x4d')][_0x163a('0x33')]);}return _0x2baff2[_0x163a('0xe9')](_0x22c4f8);}})[_0x163a('0x24')](function(_0x45c98a){if(_0x45c98a){return _0x45c98a?{'count':_0x25e017,'rows':_0x45c98a}:null;}})[_0x163a('0x24')](respondWithResult(_0x3cf28f,null))['catch'](handleError(_0x3cf28f,null));}; \ No newline at end of file +var _0x5caf=['twilio','From','Body','MessageSid','skebby','from','sender','text','connectel','messageId','message_id','plivo','MessageUUID','results','csc','originatingAddress','fromNumber','replyMessageId','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','SmsQueue','unshift','queue','waitForTheAssignedQueue','startRouting','receiveMessage','info','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','SmsMessage','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','clickatell','redif','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','bandwidth','DELIVRD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','register','jayson/promise','client','request','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5caf,0x15b));var _0xf5ca=function(_0x226e66,_0x2f3066){_0x226e66=_0x226e66-0x0;var _0x33e403=_0x5caf[_0x226e66];return _0x33e403;};'use strict';var emlformat=require(_0xf5ca('0x0'));var rimraf=require(_0xf5ca('0x1'));var zipdir=require(_0xf5ca('0x2'));var jsonpatch=require(_0xf5ca('0x3'));var rp=require(_0xf5ca('0x4'));var moment=require(_0xf5ca('0x5'));var BPromise=require(_0xf5ca('0x6'));var Mustache=require('mustache');var util=require(_0xf5ca('0x7'));var path=require(_0xf5ca('0x8'));var sox=require(_0xf5ca('0x9'));var csv=require(_0xf5ca('0xa'));var ejs=require(_0xf5ca('0xb'));var fs=require('fs');var fs_extra=require(_0xf5ca('0xc'));var _=require(_0xf5ca('0xd'));var squel=require(_0xf5ca('0xe'));var crypto=require(_0xf5ca('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf5ca('0x10'));var toCsv=require(_0xf5ca('0xa'));var querystring=require('querystring');var Papa=require(_0xf5ca('0x11'));var Redis=require(_0xf5ca('0x12'));var authService=require(_0xf5ca('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf5ca('0x14'));var hardwareService=require(_0xf5ca('0x15'));var logger=require(_0xf5ca('0x16'))(_0xf5ca('0x17'));var utils=require(_0xf5ca('0x18'));var config=require(_0xf5ca('0x19'));var licenseUtil=require(_0xf5ca('0x1a'));var db=require(_0xf5ca('0x1b'))['db'];config['redis']=_[_0xf5ca('0x1c')](config['redis'],{'host':_0xf5ca('0x1d'),'port':0x18eb});var socket=require(_0xf5ca('0x1e'))(new Redis(config[_0xf5ca('0x1f')]));require(_0xf5ca('0x20'))[_0xf5ca('0x21')](socket);var jayson=require(_0xf5ca('0x22'));var client=jayson[_0xf5ca('0x23')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2044c1,_0x131236,_0x9b66b4,_0x3b5148){return new BPromise(function(_0x30b162,_0x68d25d){var _0xaf2da3=_0x3b5148||client;return _0xaf2da3[_0xf5ca('0x24')](_0x2044c1,_0x9b66b4)['then'](function(_0x3dd10c){logger['info'](_0xf5ca('0x25'),_0x131236,_0xf5ca('0x26'));logger['debug'](_0xf5ca('0x27'),_0x131236,_0xf5ca('0x26'),JSON[_0xf5ca('0x28')](_0x3dd10c));if(_0x3dd10c[_0xf5ca('0x29')]){if(_0x3dd10c['error']['code']===0x1f4){logger[_0xf5ca('0x29')](_0xf5ca('0x25'),_0x131236,_0x3dd10c[_0xf5ca('0x29')]['message']);return _0x68d25d(_0x3dd10c[_0xf5ca('0x29')]['message']);}logger[_0xf5ca('0x29')](_0xf5ca('0x25'),_0x131236,_0x3dd10c['error'][_0xf5ca('0x2a')]);return _0x30b162(_0x3dd10c[_0xf5ca('0x29')][_0xf5ca('0x2a')]);}else{logger['info'](_0xf5ca('0x25'),_0x131236,_0xf5ca('0x26'));_0x30b162(_0x3dd10c[_0xf5ca('0x2b')][_0xf5ca('0x2a')]);}})[_0xf5ca('0x2c')](function(_0x4bc44d){logger['error'](_0xf5ca('0x25'),_0x131236,_0x4bc44d);_0x68d25d(_0x4bc44d);});});}function respondWithStatusCode(_0x1398a2,_0x39e75b){_0x39e75b=_0x39e75b||0xcc;return function(_0x317ade){if(_0x317ade){return _0x1398a2[_0xf5ca('0x2d')](_0x39e75b);}return _0x1398a2['status'](_0x39e75b)[_0xf5ca('0x2e')]();};}function respondWithResult(_0x32f9f4,_0x4aafeb){_0x4aafeb=_0x4aafeb||0xc8;return function(_0x3cad75){if(_0x3cad75){return _0x32f9f4[_0xf5ca('0x2f')](_0x4aafeb)[_0xf5ca('0x30')](_0x3cad75);}};}function respondWithFilteredResult(_0x40ded7,_0x570b2d){return function(_0x1595d3){if(_0x1595d3){var _0x2bd84f=typeof _0x570b2d[_0xf5ca('0x31')]===_0xf5ca('0x32')&&typeof _0x570b2d[_0xf5ca('0x33')]==='undefined';var _0x1656b3=_0x1595d3[_0xf5ca('0x34')];var _0x4b62c7=_0x2bd84f?0x0:_0x570b2d[_0xf5ca('0x31')];var _0x4cd10a=_0x2bd84f?_0x1595d3[_0xf5ca('0x34')]:_0x570b2d[_0xf5ca('0x31')]+_0x570b2d['limit'];var _0xb4438;if(_0x4cd10a>=_0x1656b3){_0x4cd10a=_0x1656b3;_0xb4438=0xc8;}else{_0xb4438=0xce;}_0x40ded7[_0xf5ca('0x2f')](_0xb4438);return _0x40ded7['set'](_0xf5ca('0x35'),_0x4b62c7+'-'+_0x4cd10a+'/'+_0x1656b3)[_0xf5ca('0x30')](_0x1595d3);}return null;};}function patchUpdates(_0x1240bc){return function(_0x72bef3){try{jsonpatch['apply'](_0x72bef3,_0x1240bc,!![]);}catch(_0x25ab0b){return BPromise[_0xf5ca('0x36')](_0x25ab0b);}return _0x72bef3[_0xf5ca('0x37')]();};}function saveUpdates(_0x49d642,_0x3087b5){return function(_0x349cc3){if(_0x349cc3){return _0x349cc3['update'](_0x49d642)[_0xf5ca('0x38')](function(_0x532d1b){return _0x532d1b;});}return null;};}function removeEntity(_0x638f9,_0x26eb58){return function(_0x3dec66){if(_0x3dec66){return _0x3dec66[_0xf5ca('0x39')]()[_0xf5ca('0x38')](function(){var _0x3dcce8=_0x3dec66[_0xf5ca('0x3a')]({'plain':!![]});var _0x109ee5='SmsAccounts';return db[_0xf5ca('0x3b')][_0xf5ca('0x39')]({'where':{'type':_0x109ee5,'resourceId':_0x3dcce8['id']}})['then'](function(){return _0x3dec66;});})[_0xf5ca('0x38')](function(){_0x638f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53b586,_0x273566){return function(_0x4066c4){if(!_0x4066c4){_0x53b586[_0xf5ca('0x2d')](0x194);}return _0x4066c4;};}function handleError(_0xedd554,_0x158043){_0x158043=_0x158043||0x1f4;return function(_0x55f9c0){logger[_0xf5ca('0x29')](_0x55f9c0[_0xf5ca('0x3c')]);if(_0x55f9c0['name']){delete _0x55f9c0[_0xf5ca('0x3d')];}_0xedd554['status'](_0x158043)[_0xf5ca('0x3e')](_0x55f9c0);};}exports[_0xf5ca('0x3f')]=function(_0x27d0c9,_0x2e89c){var _0x43490f={'include':[{'model':db[_0xf5ca('0x40')],'as':_0xf5ca('0x41')}]},_0x77614c={},_0x27ff4e={'count':0x0,'rows':[]};var _0x5c7a00=_[_0xf5ca('0x42')](db[_0xf5ca('0x43')][_0xf5ca('0x44')],function(_0x3ac021){return{'name':_0x3ac021[_0xf5ca('0x45')],'type':_0x3ac021[_0xf5ca('0x46')][_0xf5ca('0x47')]};});_0x77614c[_0xf5ca('0x48')]=_[_0xf5ca('0x42')](_0x5c7a00,'name');_0x77614c['query']=_['keys'](_0x27d0c9[_0xf5ca('0x49')]);_0x77614c[_0xf5ca('0x4a')]=_[_0xf5ca('0x4b')](_0x77614c['model'],_0x77614c['query']);_0x43490f[_0xf5ca('0x4c')]=_[_0xf5ca('0x4b')](_0x77614c['model'],qs['fields'](_0x27d0c9[_0xf5ca('0x49')][_0xf5ca('0x4d')]));_0x43490f[_0xf5ca('0x4c')]=_0x43490f[_0xf5ca('0x4c')][_0xf5ca('0x4e')]?_0x43490f[_0xf5ca('0x4c')]:_0x77614c['model'];if(!_0x27d0c9[_0xf5ca('0x49')][_0xf5ca('0x4f')](_0xf5ca('0x50'))){_0x43490f[_0xf5ca('0x33')]=qs['limit'](_0x27d0c9['query'][_0xf5ca('0x33')]);_0x43490f[_0xf5ca('0x31')]=qs[_0xf5ca('0x31')](_0x27d0c9[_0xf5ca('0x49')][_0xf5ca('0x31')]);}_0x43490f[_0xf5ca('0x51')]=qs[_0xf5ca('0x52')](_0x27d0c9[_0xf5ca('0x49')][_0xf5ca('0x52')]);_0x43490f[_0xf5ca('0x53')]=qs['filters'](_[_0xf5ca('0x54')](_0x27d0c9[_0xf5ca('0x49')],_0x77614c[_0xf5ca('0x4a')]),_0x5c7a00);if(_0x27d0c9[_0xf5ca('0x49')]['filter']){_0x43490f[_0xf5ca('0x53')]=_[_0xf5ca('0x55')](_0x43490f[_0xf5ca('0x53')],{'$or':_[_0xf5ca('0x42')](_0x5c7a00,function(_0xdb215d){if(_0xdb215d['type']!==_0xf5ca('0x56')){var _0x388186={};_0x388186[_0xdb215d[_0xf5ca('0x3d')]]={'$like':'%'+_0x27d0c9[_0xf5ca('0x49')][_0xf5ca('0x57')]+'%'};return _0x388186;}})});}_0x43490f=_[_0xf5ca('0x55')]({},_0x43490f,_0x27d0c9[_0xf5ca('0x58')]);var _0x5de4c5={'where':_0x43490f['where']};return db[_0xf5ca('0x43')][_0xf5ca('0x34')](_0x5de4c5)[_0xf5ca('0x38')](function(_0x3ebb3e){_0x27ff4e[_0xf5ca('0x34')]=_0x3ebb3e;if(_0x27d0c9['query'][_0xf5ca('0x59')]){_0x43490f[_0xf5ca('0x5a')]=[{'all':!![]}];}return db[_0xf5ca('0x43')][_0xf5ca('0x5b')](_0x43490f);})[_0xf5ca('0x38')](function(_0x4d9c85){_0x27ff4e[_0xf5ca('0x5c')]=_0x4d9c85;return _0x27ff4e;})[_0xf5ca('0x38')](respondWithFilteredResult(_0x2e89c,_0x43490f))[_0xf5ca('0x2c')](handleError(_0x2e89c,null));};exports['show']=function(_0x395297,_0x13f46f){var _0x401ae7={'raw':![],'where':{'id':_0x395297[_0xf5ca('0x5d')]['id']},'include':[{'model':db[_0xf5ca('0x40')],'as':_0xf5ca('0x41')}]},_0x562565={};_0x562565[_0xf5ca('0x48')]=_[_0xf5ca('0x5e')](db[_0xf5ca('0x43')]['rawAttributes']);_0x562565[_0xf5ca('0x49')]=_[_0xf5ca('0x5e')](_0x395297[_0xf5ca('0x49')]);_0x562565[_0xf5ca('0x4a')]=_['intersection'](_0x562565['model'],_0x562565['query']);_0x401ae7[_0xf5ca('0x4c')]=_[_0xf5ca('0x4b')](_0x562565['model'],qs['fields'](_0x395297[_0xf5ca('0x49')][_0xf5ca('0x4d')]));_0x401ae7['attributes']=_0x401ae7['attributes'][_0xf5ca('0x4e')]?_0x401ae7[_0xf5ca('0x4c')]:_0x562565[_0xf5ca('0x48')];if(_0x395297[_0xf5ca('0x49')][_0xf5ca('0x59')]){_0x401ae7[_0xf5ca('0x5a')]=[{'all':!![]}];}_0x401ae7=_[_0xf5ca('0x55')]({},_0x401ae7,_0x395297[_0xf5ca('0x58')]);return db[_0xf5ca('0x43')][_0xf5ca('0x5f')](_0x401ae7)[_0xf5ca('0x38')](handleEntityNotFound(_0x13f46f,null))[_0xf5ca('0x38')](respondWithResult(_0x13f46f,null))[_0xf5ca('0x2c')](handleError(_0x13f46f,null));};exports[_0xf5ca('0x60')]=function(_0xa87b15,_0x498208){return db['SmsAccount']['create'](_0xa87b15[_0xf5ca('0x61')],{})['then'](function(_0x44c77e){var _0x86cdfd=_0xa87b15[_0xf5ca('0x62')][_0xf5ca('0x3a')]({'plain':!![]});if(!_0x86cdfd)throw new Error(_0xf5ca('0x63'));if(_0x86cdfd[_0xf5ca('0x64')]===_0xf5ca('0x62')){var _0x15eb06=_0x44c77e[_0xf5ca('0x3a')]({'plain':!![]});var _0x1c7ba3='SmsAccounts';return db[_0xf5ca('0x65')][_0xf5ca('0x5f')]({'where':{'name':_0x1c7ba3,'userProfileId':_0x86cdfd[_0xf5ca('0x66')]},'raw':!![]})[_0xf5ca('0x38')](function(_0x186f0f){if(_0x186f0f&&_0x186f0f['autoAssociation']===0x0){return db[_0xf5ca('0x3b')]['create']({'name':_0x15eb06[_0xf5ca('0x3d')],'resourceId':_0x15eb06['id'],'type':_0x186f0f[_0xf5ca('0x3d')],'sectionId':_0x186f0f['id']},{})[_0xf5ca('0x38')](function(){return _0x44c77e;});}else{return _0x44c77e;}})[_0xf5ca('0x2c')](function(_0x576d16){logger[_0xf5ca('0x29')](_0xf5ca('0x67'),_0x576d16);throw _0x576d16;});}return _0x44c77e;})[_0xf5ca('0x38')](respondWithResult(_0x498208,0xc9))[_0xf5ca('0x2c')](handleError(_0x498208,null));};exports[_0xf5ca('0x68')]=function(_0x3b949,_0x1bbc6e){if(_0x3b949['body']['id']){delete _0x3b949[_0xf5ca('0x61')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x3b949[_0xf5ca('0x5d')]['id']},'include':[{'model':db[_0xf5ca('0x40')],'as':_0xf5ca('0x41')}]})[_0xf5ca('0x38')](handleEntityNotFound(_0x1bbc6e,null))[_0xf5ca('0x38')](saveUpdates(_0x3b949[_0xf5ca('0x61')],null))[_0xf5ca('0x38')](respondWithResult(_0x1bbc6e,null))[_0xf5ca('0x2c')](handleError(_0x1bbc6e,null));};exports['destroy']=function(_0x29e857,_0x10cb33){return db[_0xf5ca('0x43')][_0xf5ca('0x5f')]({'where':{'id':_0x29e857[_0xf5ca('0x5d')]['id']}})[_0xf5ca('0x38')](handleEntityNotFound(_0x10cb33,null))[_0xf5ca('0x38')](removeEntity(_0x10cb33,null))[_0xf5ca('0x2c')](handleError(_0x10cb33,null));};exports[_0xf5ca('0x69')]=function(_0x11b30a,_0x5a37dd){return db['SmsAccount'][_0xf5ca('0x69')]()[_0xf5ca('0x38')](respondWithResult(_0x5a37dd,null))[_0xf5ca('0x2c')](handleError(_0x5a37dd,null));};exports[_0xf5ca('0x6a')]=function(_0x5ae50c,_0x5d72d3,_0x2b6011){if(_0x5ae50c[_0xf5ca('0x61')]['id']){delete _0x5ae50c[_0xf5ca('0x61')]['id'];}return db[_0xf5ca('0x43')][_0xf5ca('0x5f')]({'where':{'id':_0x5ae50c[_0xf5ca('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5d72d3,null))['then'](function(_0x359c78){if(_0x359c78){_0x5ae50c['body'][_0xf5ca('0x6b')]=_0x359c78['id'];return db[_0xf5ca('0x6c')][_0xf5ca('0x60')](_0x5ae50c[_0xf5ca('0x61')]);}})['then'](respondWithResult(_0x5d72d3,null))[_0xf5ca('0x2c')](handleError(_0x5d72d3,null));};exports['getDispositions']=function(_0x4d915b,_0x4a86d7,_0x23a547){var _0x54157f={'raw':![],'where':{}};var _0x377fd3={};var _0x36fff2={'count':0x0,'rows':[]};return db[_0xf5ca('0x43')][_0xf5ca('0x6d')]({'where':{'id':_0x4d915b[_0xf5ca('0x5d')]['id']}})[_0xf5ca('0x38')](handleEntityNotFound(_0x4a86d7,null))[_0xf5ca('0x38')](function(_0x3730b0){if(_0x3730b0){_0x377fd3[_0xf5ca('0x48')]=_['keys'](db[_0xf5ca('0x6c')]['rawAttributes']);_0x377fd3[_0xf5ca('0x49')]=_[_0xf5ca('0x5e')](_0x4d915b[_0xf5ca('0x49')]);_0x377fd3[_0xf5ca('0x4a')]=_[_0xf5ca('0x4b')](_0x377fd3['model'],_0x377fd3['query']);_0x54157f['attributes']=_[_0xf5ca('0x4b')](_0x377fd3['model'],qs[_0xf5ca('0x4d')](_0x4d915b[_0xf5ca('0x49')][_0xf5ca('0x4d')]));_0x54157f[_0xf5ca('0x4c')]=_0x54157f[_0xf5ca('0x4c')][_0xf5ca('0x4e')]?_0x54157f[_0xf5ca('0x4c')]:_0x377fd3[_0xf5ca('0x48')];if(!_0x4d915b[_0xf5ca('0x49')][_0xf5ca('0x4f')]('nolimit')){_0x54157f[_0xf5ca('0x33')]=qs[_0xf5ca('0x33')](_0x4d915b[_0xf5ca('0x49')][_0xf5ca('0x33')]);_0x54157f[_0xf5ca('0x31')]=qs['offset'](_0x4d915b[_0xf5ca('0x49')][_0xf5ca('0x31')]);}_0x54157f[_0xf5ca('0x51')]=qs[_0xf5ca('0x52')](_0x4d915b[_0xf5ca('0x49')][_0xf5ca('0x52')]);_0x54157f[_0xf5ca('0x53')]=qs['filters'](_[_0xf5ca('0x54')](_0x4d915b[_0xf5ca('0x49')],_0x377fd3['filters']));_0x54157f[_0xf5ca('0x53')][_0xf5ca('0x6b')]=_0x3730b0['id'];if(_0x4d915b[_0xf5ca('0x49')][_0xf5ca('0x57')]){_0x54157f['where']=_[_0xf5ca('0x55')](_0x54157f[_0xf5ca('0x53')],{'$or':_[_0xf5ca('0x42')](_0x54157f['attributes'],function(_0x2a1f12){var _0x8a5fdf={};_0x8a5fdf[_0x2a1f12]={'$like':'%'+_0x4d915b[_0xf5ca('0x49')][_0xf5ca('0x57')]+'%'};return _0x8a5fdf;})});}_0x54157f=_[_0xf5ca('0x55')]({},_0x54157f,_0x4d915b[_0xf5ca('0x58')]);return db[_0xf5ca('0x6c')][_0xf5ca('0x34')]({'where':_0x54157f['where']})['then'](function(_0x429569){_0x36fff2[_0xf5ca('0x34')]=_0x429569;if(_0x4d915b[_0xf5ca('0x49')][_0xf5ca('0x59')]){_0x54157f['include']=[{'all':!![]}];}return db[_0xf5ca('0x6c')][_0xf5ca('0x5b')](_0x54157f);})[_0xf5ca('0x38')](function(_0x383843){_0x36fff2[_0xf5ca('0x5c')]=_0x383843;return _0x36fff2;});}})[_0xf5ca('0x38')](respondWithFilteredResult(_0x4a86d7,_0x54157f))['catch'](handleError(_0x4a86d7,null));};exports['removeDispositions']=function(_0x4df76d,_0x589c24,_0x306013){return db[_0xf5ca('0x43')][_0xf5ca('0x5f')]({'where':{'id':_0x4df76d[_0xf5ca('0x5d')]['id']}})['then'](handleEntityNotFound(_0x589c24,null))[_0xf5ca('0x38')](function(_0x47f50a){if(_0x47f50a){return _0x47f50a[_0xf5ca('0x6e')](_0x4df76d[_0xf5ca('0x49')][_0xf5ca('0x6f')]);}})[_0xf5ca('0x38')](respondWithStatusCode(_0x589c24,null))['catch'](handleError(_0x589c24,null));};exports[_0xf5ca('0x70')]=function(_0x564a27,_0x3ab15d,_0x16e7db){if(_0x564a27[_0xf5ca('0x61')]['id']){delete _0x564a27[_0xf5ca('0x61')]['id'];}return db[_0xf5ca('0x43')][_0xf5ca('0x5f')]({'where':{'id':_0x564a27[_0xf5ca('0x5d')]['id']}})[_0xf5ca('0x38')](handleEntityNotFound(_0x3ab15d,null))[_0xf5ca('0x38')](function(_0x7760d9){if(_0x7760d9){_0x564a27[_0xf5ca('0x61')][_0xf5ca('0x6b')]=_0x7760d9['id'];return db[_0xf5ca('0x71')]['create'](_0x564a27['body']);}})[_0xf5ca('0x38')](respondWithResult(_0x3ab15d,null))[_0xf5ca('0x2c')](handleError(_0x3ab15d,null));};exports[_0xf5ca('0x72')]=function(_0x18a581,_0x214228,_0x105b55){var _0x133772={'raw':![],'where':{}};var _0x387c8c={};var _0x36f7a5={'count':0x0,'rows':[]};return db[_0xf5ca('0x43')][_0xf5ca('0x6d')]({'where':{'id':_0x18a581[_0xf5ca('0x5d')]['id']}})['then'](handleEntityNotFound(_0x214228,null))[_0xf5ca('0x38')](function(_0x14e024){if(_0x14e024){_0x387c8c[_0xf5ca('0x48')]=_[_0xf5ca('0x5e')](db[_0xf5ca('0x71')]['rawAttributes']);_0x387c8c[_0xf5ca('0x49')]=_[_0xf5ca('0x5e')](_0x18a581[_0xf5ca('0x49')]);_0x387c8c[_0xf5ca('0x4a')]=_[_0xf5ca('0x4b')](_0x387c8c['model'],_0x387c8c[_0xf5ca('0x49')]);_0x133772['attributes']=_[_0xf5ca('0x4b')](_0x387c8c[_0xf5ca('0x48')],qs[_0xf5ca('0x4d')](_0x18a581['query'][_0xf5ca('0x4d')]));_0x133772[_0xf5ca('0x4c')]=_0x133772['attributes'][_0xf5ca('0x4e')]?_0x133772['attributes']:_0x387c8c[_0xf5ca('0x48')];if(!_0x18a581['query'][_0xf5ca('0x4f')](_0xf5ca('0x50'))){_0x133772[_0xf5ca('0x33')]=qs[_0xf5ca('0x33')](_0x18a581[_0xf5ca('0x49')][_0xf5ca('0x33')]);_0x133772['offset']=qs[_0xf5ca('0x31')](_0x18a581[_0xf5ca('0x49')][_0xf5ca('0x31')]);}_0x133772[_0xf5ca('0x51')]=qs['sort'](_0x18a581[_0xf5ca('0x49')]['sort']);_0x133772[_0xf5ca('0x53')]=qs[_0xf5ca('0x4a')](_[_0xf5ca('0x54')](_0x18a581[_0xf5ca('0x49')],_0x387c8c[_0xf5ca('0x4a')]));_0x133772['where'][_0xf5ca('0x6b')]=_0x14e024['id'];if(_0x18a581[_0xf5ca('0x49')][_0xf5ca('0x57')]){_0x133772[_0xf5ca('0x53')]=_[_0xf5ca('0x55')](_0x133772['where'],{'$or':_[_0xf5ca('0x42')](_0x133772[_0xf5ca('0x4c')],function(_0x1de8c2){var _0x2d15ad={};_0x2d15ad[_0x1de8c2]={'$like':'%'+_0x18a581[_0xf5ca('0x49')]['filter']+'%'};return _0x2d15ad;})});}_0x133772=_[_0xf5ca('0x55')]({},_0x133772,_0x18a581[_0xf5ca('0x58')]);return db[_0xf5ca('0x71')][_0xf5ca('0x34')]({'where':_0x133772[_0xf5ca('0x53')]})['then'](function(_0x4fd5f0){_0x36f7a5['count']=_0x4fd5f0;if(_0x18a581['query'][_0xf5ca('0x59')]){_0x133772[_0xf5ca('0x5a')]=[{'all':!![]}];}return db[_0xf5ca('0x71')][_0xf5ca('0x5b')](_0x133772);})[_0xf5ca('0x38')](function(_0x4e0993){_0x36f7a5[_0xf5ca('0x5c')]=_0x4e0993;return _0x36f7a5;});}})[_0xf5ca('0x38')](respondWithFilteredResult(_0x214228,_0x133772))['catch'](handleError(_0x214228,null));};exports['removeAnswers']=function(_0x2a8df1,_0xac91ed,_0x31cd47){return db[_0xf5ca('0x43')][_0xf5ca('0x5f')]({'where':{'id':_0x2a8df1['params']['id']}})[_0xf5ca('0x38')](handleEntityNotFound(_0xac91ed,null))[_0xf5ca('0x38')](function(_0x446b42){if(_0x446b42){return _0x446b42['removeAnswers'](_0x2a8df1[_0xf5ca('0x49')][_0xf5ca('0x6f')]);}})['then'](respondWithStatusCode(_0xac91ed,null))[_0xf5ca('0x2c')](handleError(_0xac91ed,null));};exports[_0xf5ca('0x73')]=function(_0x3c56a2,_0x40c0c5,_0x344630){var _0x23d2a8={'channel':'sms'};var _0x2b8846=[];var _0x1509bc=[];var _0x608742={};return db[_0xf5ca('0x43')][_0xf5ca('0x5f')]({'where':{'id':_0x3c56a2['params']['id']},'include':[{'model':db[_0xf5ca('0x74')],'as':_0xf5ca('0x75')}]})[_0xf5ca('0x38')](handleEntityNotFound(_0x40c0c5,null))[_0xf5ca('0x38')](function(_0x4eab1a){_0x23d2a8[_0xf5ca('0x76')]=_0x4eab1a;_0x23d2a8[_0xf5ca('0x77')]=_[_0xf5ca('0x78')](_0x4eab1a[_0xf5ca('0x75')],[_0xf5ca('0x79')],['asc']);if(_0x23d2a8[_0xf5ca('0x76')][_0xf5ca('0x75')]){delete _0x23d2a8[_0xf5ca('0x76')][_0xf5ca('0x75')];}return db[_0xf5ca('0x7a')][_0xf5ca('0x69')]();})[_0xf5ca('0x38')](function(_0x3c3299){if(!_0x3c3299){throw new db[(_0xf5ca('0x7b'))][(_0xf5ca('0x7c'))]('no\x20available\x20attributes');}_0x2b8846=_[_0xf5ca('0x7d')](_[_0xf5ca('0x5e')](_0x3c3299),[_0xf5ca('0x7e'),_0xf5ca('0x7f')]);_0x1509bc=_[_0xf5ca('0x7d')](_[_0xf5ca('0x5e')](_0x3c3299),['createdAt',_0xf5ca('0x7f'),_0xf5ca('0x80'),_0xf5ca('0x81')]);_0x23d2a8[_0xf5ca('0x61')]={'mapKey':_0xf5ca('0x82')};if(_0x23d2a8[_0xf5ca('0x76')][_0xf5ca('0x46')]){switch(_0x23d2a8[_0xf5ca('0x76')][_0xf5ca('0x46')]){case _0xf5ca('0x83'):_0x23d2a8['body']['from']=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x84')];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x85')];_0x23d2a8['body']['messageId']=_0x3c56a2['body'][_0xf5ca('0x86')];break;case _0xf5ca('0x87'):_0x23d2a8['body'][_0xf5ca('0x88')]='+'+_0x3c56a2['body'][_0xf5ca('0x89')];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x8a')];break;case _0xf5ca('0x8b'):_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x88')]=_0x3c56a2[_0xf5ca('0x61')]['from'];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x2a')];break;case'clicksend':_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x88')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x88')];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x61')];_0x23d2a8['body'][_0xf5ca('0x8c')]=_0x3c56a2['body'][_0xf5ca('0x8d')];break;case _0xf5ca('0x8e'):_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x88')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x84')];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')]=_0x3c56a2[_0xf5ca('0x61')]['Text'];_0x23d2a8[_0xf5ca('0x61')]['messageId']=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x8f')];break;case'infobip':_0x23d2a8['body'][_0xf5ca('0x88')]='+'+_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x90')][0x0][_0xf5ca('0x88')];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x90')][0x0][_0xf5ca('0x8a')];_0x23d2a8['body'][_0xf5ca('0x8c')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x90')][0x0][_0xf5ca('0x8c')];break;case _0xf5ca('0x91'):_0x23d2a8['body'][_0xf5ca('0x88')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x92')];_0x23d2a8['body']['body']=_0x3c56a2[_0xf5ca('0x61')]['segmentedMessage'][_0xf5ca('0x2a')];break;case'clickatell':_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x88')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x93')];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x8a')];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x8c')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x94')];break;case'bandwidth':_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x8c')]=_0x3c56a2['body'][0x0][_0xf5ca('0x2a')]['id'];_0x23d2a8['body'][_0xf5ca('0x88')]=_0x3c56a2[_0xf5ca('0x61')][0x0][_0xf5ca('0x2a')][_0xf5ca('0x88')];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')]=_0x3c56a2[_0xf5ca('0x61')][0x0][_0xf5ca('0x2a')][_0xf5ca('0x8a')];break;case _0xf5ca('0x95'):_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x88')]=_0x3c56a2['body'][_0xf5ca('0x88')];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')]=_0x3c56a2[_0xf5ca('0x61')]['message'];_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x8c')]=_0x3c56a2[_0xf5ca('0x61')][_0xf5ca('0x96')];break;}}if(_0x23d2a8[_0xf5ca('0x61')]['id']){delete _0x23d2a8['body']['id'];}if(_['isNil'](_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x88')])){throw new db[(_0xf5ca('0x7b'))][(_0xf5ca('0x7c'))]('from\x20is\x20mandatory');}if(_[_0xf5ca('0x97')](_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')])||_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')]===''){throw new db[(_0xf5ca('0x7b'))][(_0xf5ca('0x7c'))](_0xf5ca('0x98'));}if(_[_0xf5ca('0x97')](_0x23d2a8[_0xf5ca('0x61')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xf5ca('0x99')+_0x1509bc);}if(!_[_0xf5ca('0x9a')](_0x1509bc,_0x23d2a8['body'][_0xf5ca('0x9b')])){throw new db[(_0xf5ca('0x7b'))][(_0xf5ca('0x7c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1509bc);}_0x608742[_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x9b')]]=_0x23d2a8['body'][_0xf5ca('0x88')];return db[_0xf5ca('0x9c')][_0xf5ca('0x5f')]({'where':{'id':_0x23d2a8['account'][_0xf5ca('0x81')]},'include':[{'model':db['CmContact'],'as':_0xf5ca('0x9d'),'where':_0x608742,'limit':0x1,'order':[[_0xf5ca('0x7f'),_0xf5ca('0x9e')]]}]});})['then'](handleEntityNotFound(_0x40c0c5,null))[_0xf5ca('0x38')](function(_0x58fc82){if(_0x58fc82){_0x23d2a8[_0xf5ca('0x9f')]=_[_0xf5ca('0xa0')](_0x58fc82,['Contacts']);if(_0x58fc82[_0xf5ca('0x9d')]['length']){return _0x58fc82[_0xf5ca('0x9d')][0x0];}var _0x433b62=_[_0xf5ca('0x1c')](_0x23d2a8[_0xf5ca('0x61')],{'firstName':_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x88')],'ListId':_0x58fc82['id']});_0x433b62[_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x9b')]]=_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x88')];return db[_0xf5ca('0x7a')][_0xf5ca('0x60')](_0x433b62,{'fields':_0x2b8846,'raw':!![]});}})['then'](handleEntityNotFound(_0x40c0c5,null))[_0xf5ca('0x38')](function(_0x1fc543){if(_0x1fc543){_0x23d2a8[_0xf5ca('0xa1')]=_0x1fc543;var _0x270cd5={'ContactId':_0x1fc543['id'],'phone':_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x88')],'SmsAccountId':_0x3c56a2['params']['id']};var _0x3fa1c0={'ContactId':_0x1fc543['id'],'SmsAccountId':_0x3c56a2[_0xf5ca('0x5d')]['id'],'closed':![]};return db[_0xf5ca('0xa2')][_0xf5ca('0x5f')]({'where':_0x3fa1c0})[_0xf5ca('0x38')](function(_0x100bac){if(_0x100bac){return[_0x100bac,![]];}return db[_0xf5ca('0xa2')]['create'](_0x270cd5)[_0xf5ca('0x38')](function(_0x35bdb5){return[_0x35bdb5,!![]];});});}})[_0xf5ca('0xa3')](function(_0x3cd0c1,_0x25a917){_0x23d2a8[_0xf5ca('0xa4')]=_0x3cd0c1[_0xf5ca('0x3a')]({'plain':!![]});_0x23d2a8[_0xf5ca('0xa4')][_0xf5ca('0xa5')]=![];if(_0x25a917){if(_0x23d2a8['account']['autoclose']){_0x23d2a8[_0xf5ca('0x77')][_0xf5ca('0xa6')]({'id':0x0,'priority':_0x23d2a8[_0xf5ca('0x77')][_0xf5ca('0x4e')]+0x1,'app':_0xf5ca('0xa7'),'appdata':_0xf5ca('0xa8'),'interval':_0xf5ca('0xa9')});}_0x23d2a8['interaction'][_0xf5ca('0xa5')]=!![];}return db['SmsMessage'][_0xf5ca('0x60')]({'phone':_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x88')],'messageId':_0x23d2a8[_0xf5ca('0x61')]['messageId'],'body':_0x23d2a8[_0xf5ca('0x61')][_0xf5ca('0x61')],'SmsAccountId':_0x3c56a2[_0xf5ca('0x5d')]['id'],'SmsInteractionId':_0x3cd0c1['id'],'direction':'in','ContactId':_0x3cd0c1[_0xf5ca('0xaa')],'AttachmentId':_0x23d2a8['body'][_0xf5ca('0xab')]});})[_0xf5ca('0x38')](function(_0x38de37){_0x23d2a8['message']=_0x38de37;if(!_0x23d2a8['interaction'][_0xf5ca('0xac')])return;return db[_0xf5ca('0xad')][_0xf5ca('0x5f')]({'attributes':['id','name'],'where':{'id':_0x23d2a8[_0xf5ca('0xa4')]['UserId']}});})[_0xf5ca('0x38')](function(_0x34b148){if(_0x34b148){_0x23d2a8[_0xf5ca('0x77')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf5ca('0xae'),'appdata':_0x34b148[_0xf5ca('0x3d')]+','+(_0x23d2a8['account'][_0xf5ca('0xaf')]||0xa),'interval':_0xf5ca('0xa9')});}if(!_0x23d2a8[_0xf5ca('0xa4')][_0xf5ca('0xb0')])return;return db[_0xf5ca('0xb1')]['find']({'attributes':['id',_0xf5ca('0x3d')],'where':{'id':_0x23d2a8[_0xf5ca('0xa4')][_0xf5ca('0xb0')]}});})[_0xf5ca('0x38')](function(_0x3aa1e9){if(_0x3aa1e9){_0x23d2a8[_0xf5ca('0x77')][_0xf5ca('0xb2')]({'id':0x0,'priority':0x1,'app':_0xf5ca('0xb3'),'appdata':_0x3aa1e9[_0xf5ca('0x3d')]+','+(_0x23d2a8['account'][_0xf5ca('0xb4')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xf5ca('0xb5'),_0x23d2a8);})[_0xf5ca('0x38')](function(_0x2e8c40){if(_0x2e8c40){var _0x217823=0xc8;var _0x3ded37=_0xf5ca('0xb6');logger[_0xf5ca('0xb7')](_0xf5ca('0x27'),_0x3ded37,_0x217823,_0xf5ca('0xb8'));logger[_0xf5ca('0xb9')](_0xf5ca('0xba'),_0x3ded37,_0x217823,'entity\x20found',JSON[_0xf5ca('0x28')](_0x2e8c40));if(_0x23d2a8[_0xf5ca('0x76')][_0xf5ca('0x46')]===_0xf5ca('0x83')){return _0x40c0c5[_0xf5ca('0x2f')](_0x217823)[_0xf5ca('0xbb')](_0xf5ca('0xbc'),_0xf5ca('0xbd'))[_0xf5ca('0x3e')]('\x0a');}else{return _0x40c0c5[_0xf5ca('0x2f')](_0x217823)['json'](_0x2e8c40);}}})[_0xf5ca('0x2c')](handleError(_0x40c0c5,null));};exports[_0xf5ca('0xbe')]=function(_0x524e4e,_0x14db0d){var _0x381605=_0x524e4e[_0xf5ca('0x5d')]['id'];var _0x13cf8a=_0x524e4e[_0xf5ca('0x61')];var _0x12a3cb=0xc8;var _0x2e65b4=null;return db['sequelize'][_0xf5ca('0xbf')]({'isolationLevel':db[_0xf5ca('0xc0')][_0xf5ca('0xc1')][_0xf5ca('0xc2')][_0xf5ca('0xc3')]},function(_0x8707d5){return db['SmsAccount'][_0xf5ca('0x6d')]({'where':{'id':_0x381605},'transaction':_0x8707d5})[_0xf5ca('0x38')](function(_0x525d05){if(_0x525d05){return db[_0xf5ca('0x74')][_0xf5ca('0x39')]({'where':{'SmsAccountId':_0x381605},'transaction':_0x8707d5})['then'](function(){var _0x422f3d=_[_0xf5ca('0x42')](_0x13cf8a,function(_0x27a548){_0x27a548[_0xf5ca('0x6b')]=_0x381605;return _0x27a548;});return db[_0xf5ca('0x74')][_0xf5ca('0xc4')](_0x422f3d,{'transaction':_0x8707d5});});}else{_0x12a3cb=0x194;_0x2e65b4=[];}});})[_0xf5ca('0x38')](function(){if(_0x12a3cb!==0x194){return db['SmsApplication'][_0xf5ca('0xc5')]({'where':{'SmsAccountId':_0x381605},'order':_0xf5ca('0x79')})['then'](function(_0x12608a){_0x2e65b4=_0x12608a;});}})[_0xf5ca('0x2c')](function(_0x1cfd9a){_0x12a3cb=0x1f4;logger[_0xf5ca('0x29')](_0x1cfd9a['stack']);if(_0x1cfd9a[_0xf5ca('0x3d')]){delete _0x1cfd9a[_0xf5ca('0x3d')];}_0x2e65b4=_0x1cfd9a;})[_0xf5ca('0xc6')](function(){if(_0x2e65b4===null){_0x14db0d[_0xf5ca('0x2d')](_0x12a3cb);}else{if(_0x12a3cb===0x1f4){_0x14db0d[_0xf5ca('0x2f')](_0x12a3cb)[_0xf5ca('0x3e')](_0x2e65b4);}else{_0x14db0d[_0xf5ca('0x2f')](_0x12a3cb)[_0xf5ca('0x30')](_0x2e65b4);}}});};exports[_0xf5ca('0xc7')]=function(_0x5ecdde,_0x2c33d5,_0x36c713){var _0x52b37e={};var _0x4986e3={};var _0x511ac8;var _0x3b05da;return db[_0xf5ca('0x43')][_0xf5ca('0x6d')]({'where':{'id':_0x5ecdde[_0xf5ca('0x5d')]['id']}})[_0xf5ca('0x38')](handleEntityNotFound(_0x2c33d5,null))[_0xf5ca('0x38')](function(_0x4542fa){if(_0x4542fa){_0x511ac8=_0x4542fa;_0x4986e3[_0xf5ca('0x48')]=_[_0xf5ca('0x5e')](db['SmsApplication'][_0xf5ca('0x44')]);_0x4986e3[_0xf5ca('0x49')]=_[_0xf5ca('0x5e')](_0x5ecdde['query']);_0x4986e3[_0xf5ca('0x4a')]=_[_0xf5ca('0x4b')](_0x4986e3[_0xf5ca('0x48')],_0x4986e3[_0xf5ca('0x49')]);_0x52b37e[_0xf5ca('0x4c')]=_[_0xf5ca('0x4b')](_0x4986e3[_0xf5ca('0x48')],qs[_0xf5ca('0x4d')](_0x5ecdde[_0xf5ca('0x49')][_0xf5ca('0x4d')]));_0x52b37e[_0xf5ca('0x4c')]=_0x52b37e[_0xf5ca('0x4c')][_0xf5ca('0x4e')]?_0x52b37e[_0xf5ca('0x4c')]:_0x4986e3[_0xf5ca('0x48')];_0x52b37e['order']=qs['sort'](_0x5ecdde[_0xf5ca('0x49')][_0xf5ca('0x52')]);_0x52b37e[_0xf5ca('0x53')]=qs['filters'](_['pick'](_0x5ecdde['query'],_0x4986e3[_0xf5ca('0x4a')]));if(_0x5ecdde[_0xf5ca('0x49')][_0xf5ca('0x57')]){_0x52b37e['where']=_[_0xf5ca('0x55')](_0x52b37e[_0xf5ca('0x53')],{'$or':_['map'](_0x52b37e[_0xf5ca('0x4c')],function(_0x2e8eeb){var _0x3e1bde={};_0x3e1bde[_0x2e8eeb]={'$like':'%'+_0x5ecdde[_0xf5ca('0x49')][_0xf5ca('0x57')]+'%'};return _0x3e1bde;})});}_0x52b37e=_[_0xf5ca('0x55')]({},_0x52b37e,_0x5ecdde[_0xf5ca('0x58')]);return _0x511ac8[_0xf5ca('0xc7')](_0x52b37e);}})['then'](function(_0x404747){if(_0x404747){_0x3b05da=_0x404747['length'];if(!_0x5ecdde[_0xf5ca('0x49')][_0xf5ca('0x4f')]('nolimit')){_0x52b37e['limit']=qs[_0xf5ca('0x33')](_0x5ecdde[_0xf5ca('0x49')][_0xf5ca('0x33')]);_0x52b37e[_0xf5ca('0x31')]=qs['offset'](_0x5ecdde[_0xf5ca('0x49')]['offset']);}return _0x511ac8[_0xf5ca('0xc7')](_0x52b37e);}})[_0xf5ca('0x38')](function(_0x40da4e){if(_0x40da4e){return _0x40da4e?{'count':_0x3b05da,'rows':_0x40da4e}:null;}})[_0xf5ca('0x38')](respondWithResult(_0x2c33d5,null))[_0xf5ca('0x2c')](handleError(_0x2c33d5,null));};exports['getInteractions']=function(_0x312bc0,_0x45a5c1,_0x415fa2){var _0x13c2e9={'raw':![],'where':{}};var _0x643937={};var _0x3be82f={'count':0x0,'rows':[]};return db[_0xf5ca('0x43')]['findOne']({'where':{'id':_0x312bc0[_0xf5ca('0x5d')]['id']}})[_0xf5ca('0x38')](handleEntityNotFound(_0x45a5c1,null))[_0xf5ca('0x38')](function(_0x515a43){if(_0x515a43){_0x643937[_0xf5ca('0x48')]=_[_0xf5ca('0x5e')](db['SmsInteraction'][_0xf5ca('0x44')]);_0x643937[_0xf5ca('0x49')]=_[_0xf5ca('0x5e')](_0x312bc0['query']);_0x643937[_0xf5ca('0x4a')]=_[_0xf5ca('0x4b')](_0x643937['model'],_0x643937[_0xf5ca('0x49')]);_0x13c2e9[_0xf5ca('0x4c')]=_[_0xf5ca('0x4b')](_0x643937[_0xf5ca('0x48')],qs[_0xf5ca('0x4d')](_0x312bc0[_0xf5ca('0x49')][_0xf5ca('0x4d')]));_0x13c2e9[_0xf5ca('0x4c')]=_0x13c2e9[_0xf5ca('0x4c')][_0xf5ca('0x4e')]?_0x13c2e9[_0xf5ca('0x4c')]:_0x643937[_0xf5ca('0x48')];if(!_0x312bc0['query'][_0xf5ca('0x4f')](_0xf5ca('0x50'))){_0x13c2e9['limit']=qs[_0xf5ca('0x33')](_0x312bc0[_0xf5ca('0x49')][_0xf5ca('0x33')]);_0x13c2e9[_0xf5ca('0x31')]=qs['offset'](_0x312bc0['query'][_0xf5ca('0x31')]);}_0x13c2e9['order']=qs[_0xf5ca('0x52')](_0x312bc0['query'][_0xf5ca('0x52')]);_0x13c2e9[_0xf5ca('0x53')]=qs[_0xf5ca('0x4a')](_[_0xf5ca('0x54')](_0x312bc0[_0xf5ca('0x49')],_0x643937[_0xf5ca('0x4a')]));_0x13c2e9[_0xf5ca('0x53')]['SmsAccountId']=_0x515a43['id'];if(_0x312bc0[_0xf5ca('0x49')]['filter']){_0x13c2e9[_0xf5ca('0x53')]=_[_0xf5ca('0x55')](_0x13c2e9[_0xf5ca('0x53')],{'$or':_[_0xf5ca('0x42')](_0x13c2e9['attributes'],function(_0x588a88){var _0x277803={};_0x277803[_0x588a88]={'$like':'%'+_0x312bc0[_0xf5ca('0x49')][_0xf5ca('0x57')]+'%'};return _0x277803;})});}_0x13c2e9=_['merge']({},_0x13c2e9,_0x312bc0['options']);return db[_0xf5ca('0xa2')][_0xf5ca('0x34')]({'where':_0x13c2e9['where']})[_0xf5ca('0x38')](function(_0x4d6b89){_0x3be82f['count']=_0x4d6b89;if(_0x312bc0['query'][_0xf5ca('0x59')]){_0x13c2e9[_0xf5ca('0x5a')]=[{'model':db['CmContact'],'as':_0xf5ca('0xc8'),'required':![]},{'model':db[_0xf5ca('0xad')],'as':_0xf5ca('0xc9'),'attributes':[_0xf5ca('0x3d'),_0xf5ca('0xca'),_0xf5ca('0xcb')],'required':![]},{'model':db[_0xf5ca('0xcc')],'as':_0xf5ca('0xcd'),'attributes':['id',_0xf5ca('0x3d'),'color'],'where':_0x312bc0[_0xf5ca('0x49')][_0xf5ca('0xce')]?{'id':_0x312bc0[_0xf5ca('0x49')][_0xf5ca('0xce')]}:undefined,'required':_0x312bc0['query'][_0xf5ca('0xce')]?!![]:![]}];}return db[_0xf5ca('0xa2')]['findAll'](_0x13c2e9);})[_0xf5ca('0x38')](function(_0x21c979){_0x3be82f[_0xf5ca('0x5c')]=_0x21c979;return _0x3be82f;});}})[_0xf5ca('0x38')](respondWithFilteredResult(_0x45a5c1,_0x13c2e9))[_0xf5ca('0x2c')](handleError(_0x45a5c1,null));};exports[_0xf5ca('0x3e')]=function(_0x49a060,_0x199c1e,_0x37155f){var _0x4ff0dc,_0xcf1844,_0x2fa2c0;if(_[_0xf5ca('0x97')](_0x49a060[_0xf5ca('0x61')][_0xf5ca('0x61')])||_0x49a060[_0xf5ca('0x61')][_0xf5ca('0x61')]===''){throw new db['Sequelize'][(_0xf5ca('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x49a060[_0xf5ca('0x61')]['to'])){throw new db[(_0xf5ca('0x7b'))][(_0xf5ca('0x7c'))](_0xf5ca('0xcf'));}_0x4ff0dc=_0x49a060[_0xf5ca('0x61')]['to'];return db[_0xf5ca('0x43')][_0xf5ca('0x5f')]({'where':{'id':_0x49a060[_0xf5ca('0x5d')]['id']},'include':[{'model':db[_0xf5ca('0x9c')],'as':_0xf5ca('0xd0'),'include':[{'model':db[_0xf5ca('0x7a')],'as':'Contacts','where':{'mobile':_0x4ff0dc},'limit':0x1,'order':[[_0xf5ca('0x7f'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x199c1e,null))[_0xf5ca('0x38')](function(_0x3e6f90){if(_0x3e6f90&&_0x3e6f90[_0xf5ca('0xd0')]){_0xcf1844=_0x3e6f90['get']({'plain':!![]});if(_0xcf1844[_0xf5ca('0xd0')]&&_0xcf1844['List'][_0xf5ca('0x9d')][_0xf5ca('0x4e')]){return _0xcf1844[_0xf5ca('0xd0')]['Contacts'][0x0];}return db[_0xf5ca('0x7a')][_0xf5ca('0x60')](_['defaults'](_0x49a060[_0xf5ca('0x61')],{'firstName':_0x4ff0dc,'mobile':_0x4ff0dc,'phone':_0x4ff0dc,'ListId':_0xcf1844[_0xf5ca('0x81')]}));}})['then'](handleEntityNotFound(_0x199c1e,null))[_0xf5ca('0x38')](function(_0x25474a){if(_0x25474a){_0x2fa2c0=_0x25474a;return db[_0xf5ca('0xa2')][_0xf5ca('0x5f')]({'where':{'ContactId':_0x2fa2c0['id'],'closed':![],'SmsAccountId':_0xcf1844['id']}})[_0xf5ca('0x38')](function(_0x4b28c6){if(_0x4b28c6){return[_0x4b28c6,![]];}return db['SmsInteraction'][_0xf5ca('0x60')]({'UserId':_0x49a060[_0xf5ca('0x62')]['id'],'ContactId':_0x2fa2c0['id'],'SmsAccountId':_0xcf1844['id'],'phone':_0x4ff0dc,'firstMsgDirection':'out','Messages':[_[_0xf5ca('0x55')](_0x49a060[_0xf5ca('0x61')],{'read':![],'body':_0x49a060[_0xf5ca('0x61')]['body'],'phone':_0x4ff0dc,'SmsAccountId':_0xcf1844['id'],'UserId':_0x49a060[_0xf5ca('0x62')]['id'],'ContactId':_0x2fa2c0['id']})]},{'include':[{'model':db[_0xf5ca('0xd1')],'as':'Messages'}]})[_0xf5ca('0x38')](function(_0x15b8f6){return[_0x15b8f6,!![]];});});}})[_0xf5ca('0xa3')](function(_0x3da07c,_0x4eef45){if(_0x4eef45){return _0x3da07c;}return db['SmsMessage'][_0xf5ca('0x60')](_[_0xf5ca('0x55')](_0x49a060[_0xf5ca('0x61')],{'read':![],'body':_0x49a060['body'][_0xf5ca('0x61')],'phone':_0x4ff0dc,'SmsAccountId':_0xcf1844['id'],'SmsInteractionId':_0x3da07c['id'],'UserId':_0x49a060[_0xf5ca('0x62')]['id'],'ContactId':_0x2fa2c0['id']}))[_0xf5ca('0x38')](function(_0x439075){_0x3da07c[_0xf5ca('0xd2')][_0xf5ca('0xd3')]=[];_0x3da07c[_0xf5ca('0xd2')][_0xf5ca('0xd3')][_0xf5ca('0xa6')](_0x439075[_0xf5ca('0xd2')]);return _0x3da07c;});})[_0xf5ca('0x38')](respondWithResult(_0x199c1e,null))[_0xf5ca('0x2c')](handleError(_0x199c1e,null));};exports[_0xf5ca('0x2f')]=function(_0x142811,_0x25343e,_0x45f814){if(_0x142811[_0xf5ca('0x61')]['id']){delete _0x142811[_0xf5ca('0x61')]['id'];}var _0x113635,_0x3c409f,_0xf3f1db;return db[_0xf5ca('0x43')][_0xf5ca('0x5f')]({'where':{'id':_0x142811[_0xf5ca('0x5d')]['id']}})['then'](handleEntityNotFound(_0x25343e,null))[_0xf5ca('0x38')](function(_0x100ae6){if(_0x100ae6){_0xf3f1db=_0x100ae6;logger[_0xf5ca('0xb9')](_0xf5ca('0x27'),_0xf5ca('0x2f'),_0xf5ca('0xd4'),_0x100ae6[_0xf5ca('0x46')],util[_0xf5ca('0xd5')](_0x142811[_0xf5ca('0x61')],{'showHidden':![],'depth':null}));switch(_0x100ae6[_0xf5ca('0x46')]){case _0xf5ca('0x87'):if(_0x142811['body'][_0xf5ca('0xd6')]&&_0x142811[_0xf5ca('0x61')][_0xf5ca('0x2f')]){_0x3c409f=_0x142811[_0xf5ca('0x61')][_0xf5ca('0x2f')];return db[_0xf5ca('0xd1')][_0xf5ca('0x5f')]({'where':{'messageId':_0x142811['body'][_0xf5ca('0xd6')]}});}break;case _0xf5ca('0x8b'):if(_0x142811['body']['requestid']&&_0x142811['body'][_0xf5ca('0xd7')]){_0x3c409f=_0x142811['body']['statusInt'];return db[_0xf5ca('0xd1')]['find']({'where':{'messageId':_0x142811['body'][_0xf5ca('0xd8')]}});}break;case _0xf5ca('0xd9'):if(_0x142811[_0xf5ca('0x61')][_0xf5ca('0x8d')]&&_0x142811[_0xf5ca('0x61')][_0xf5ca('0xda')]){_0x3c409f=_0x142811[_0xf5ca('0x61')][_0xf5ca('0xda')];return db[_0xf5ca('0xd1')][_0xf5ca('0x5f')]({'where':{'messageId':_0x142811[_0xf5ca('0x61')]['message_id']}});}break;case'infobip':var _0x23bd07=_0x142811[_0xf5ca('0x61')]['results'][0x0];if(_0x23bd07[_0xf5ca('0x8c')]&&_0x23bd07[_0xf5ca('0x2f')][_0xf5ca('0xdb')]===_0xf5ca('0xdc')){_0x3c409f=_0x23bd07[_0xf5ca('0x2f')][_0xf5ca('0xdb')];return db[_0xf5ca('0xd1')]['find']({'where':{'messageId':_0x23bd07[_0xf5ca('0x8c')]}});}break;case _0xf5ca('0xdd'):if(_0x142811['body'][_0xf5ca('0x8c')]&&_0x142811[_0xf5ca('0x61')][_0xf5ca('0x2f')]){_0x3c409f=_0x142811[_0xf5ca('0x61')]['status'];return db[_0xf5ca('0xd1')][_0xf5ca('0x5f')]({'where':{'messageId':_0x142811[_0xf5ca('0x61')][_0xf5ca('0x8c')]}});}break;case'bandwidth':if(_0x142811[_0xf5ca('0x61')][0x0][_0xf5ca('0x2a')]['id']){_0x3c409f=_0x142811['body'][0x0][_0xf5ca('0x46')];return db[_0xf5ca('0xd1')]['find']({'where':{'messageId':_0x142811[_0xf5ca('0x61')][0x0]['message']['id']}});}break;case _0xf5ca('0x95'):if(_0x142811[_0xf5ca('0x61')][_0xf5ca('0xde')]&&_0x142811[_0xf5ca('0x61')][_0xf5ca('0x2f')]){_0x3c409f=_0x142811[_0xf5ca('0x61')][_0xf5ca('0x2f')];return db[_0xf5ca('0xd1')][_0xf5ca('0x5f')]({'where':{'messageId':_0x142811[_0xf5ca('0x61')][_0xf5ca('0xde')]}});}break;}}})[_0xf5ca('0x38')](handleEntityNotFound(_0x25343e,null))['then'](function(_0x3f4ef8){if(_0x3f4ef8){_0x113635=_0x3f4ef8;switch(_0xf3f1db[_0xf5ca('0x46')]){case _0xf5ca('0x87'):if(_0x3c409f===_0xf5ca('0xdc')){return _0x113635[_0xf5ca('0x68')]({'read':!![]});}else{logger['error'](_0xf5ca('0x27'),_0xf5ca('0x2f'),_0xf5ca('0x87'),util[_0xf5ca('0xd5')](_0x142811[_0xf5ca('0x61')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3c409f==='1'){return _0x113635[_0xf5ca('0x68')]({'read':!![]});}else{logger[_0xf5ca('0x29')](_0xf5ca('0x27'),'status',_0xf5ca('0x87'),util[_0xf5ca('0xd5')](_0x142811[_0xf5ca('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x142811[_0xf5ca('0x61')][_0xf5ca('0xdf')]&&_0x3c409f>=0xc8&&_0x3c409f<=0xce){return _0x113635['update']({'read':!![]});}else{logger[_0xf5ca('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xf5ca('0xd9'),util[_0xf5ca('0xd5')](_0x142811[_0xf5ca('0x61')],{'showHidden':![],'depth':null}));}break;case _0xf5ca('0xe0'):var _0xa5f946=_0x142811[_0xf5ca('0x61')][_0xf5ca('0x90')][0x0];if(_0xa5f946[_0xf5ca('0x2f')]['groupName']===_0xf5ca('0xdc')){return _0x113635[_0xf5ca('0x68')]({'read':!![]});}else{logger[_0xf5ca('0x29')](_0xf5ca('0x27'),_0xf5ca('0x2f'),_0xf5ca('0xe0'),util[_0xf5ca('0xd5')](_0x142811[_0xf5ca('0x61')],{'showHidden':![],'depth':null}));}break;case _0xf5ca('0xdd'):if(_0x3c409f==_0xf5ca('0xe1')||_0x3c409f==_0xf5ca('0xe2')){return _0x113635[_0xf5ca('0x68')]({'read':!![]});}else{logger['error'](_0xf5ca('0x27'),_0xf5ca('0x2f'),_0xf5ca('0xdd'),util[_0xf5ca('0xd5')](_0x142811['body'],{'showHidden':![],'depth':null}));}break;case _0xf5ca('0xe3'):if(_0x3c409f=='message-delivered'){return _0x113635[_0xf5ca('0x68')]({'read':!![]});}else{logger[_0xf5ca('0x29')](_0xf5ca('0x27'),_0xf5ca('0x2f'),_0xf5ca('0xe3'),util[_0xf5ca('0xd5')](_0x142811[_0xf5ca('0x61')],{'showHidden':![],'depth':null}));}break;case _0xf5ca('0x95'):if(_0x3c409f===_0xf5ca('0xe4')||_0x3c409f==='ACCEPTD'){return _0x113635[_0xf5ca('0x68')]({'read':!![]});}else{logger[_0xf5ca('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf5ca('0x2f'),_0xf5ca('0x95'),util[_0xf5ca('0xd5')](_0x142811[_0xf5ca('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x113635;}})[_0xf5ca('0x38')](respondWithResult(_0x25343e,null))['catch'](handleError(_0x25343e,null));};exports[_0xf5ca('0xe5')]=function(_0x185f51,_0x276f2c,_0x2b1444){var _0x14c7e0,_0x4dc292,_0x4141db;return db['SmsAccount'][_0xf5ca('0x5f')]({'where':{'id':_0x185f51['params']['id']}})[_0xf5ca('0x38')](handleEntityNotFound(_0x276f2c,null))[_0xf5ca('0x38')](function(_0x5de6fa){if(_0x5de6fa){_0x4141db=_0x5de6fa;logger[_0xf5ca('0xb9')](_0xf5ca('0x27'),_0xf5ca('0x2f'),_0xf5ca('0xd4'),_0x5de6fa[_0xf5ca('0x46')],util[_0xf5ca('0xd5')](_0x185f51[_0xf5ca('0x49')],{'showHidden':![],'depth':null}));switch(_0x5de6fa[_0xf5ca('0x46')]){case _0xf5ca('0x91'):if(_0x185f51['query'][_0xf5ca('0xe6')]&&_0x185f51[_0xf5ca('0x49')]['state']){_0x4dc292=_0x185f51[_0xf5ca('0x49')][_0xf5ca('0xe7')];return db[_0xf5ca('0xd1')]['find']({'where':{'messageId':_0x185f51[_0xf5ca('0x49')]['message-id']}});}break;}}})[_0xf5ca('0x38')](handleEntityNotFound(_0x276f2c,null))[_0xf5ca('0x38')](function(_0x4bd5a9){if(_0x4bd5a9){_0x14c7e0=_0x4bd5a9;switch(_0x4141db[_0xf5ca('0x46')]){case _0xf5ca('0x91'):if(_0x4dc292==='2'||_0x4dc292==='6'){return _0x14c7e0[_0xf5ca('0x68')]({'read':!![]});}else{logger[_0xf5ca('0x29')](_0xf5ca('0x27'),_0xf5ca('0x2f'),_0xf5ca('0x91'),util[_0xf5ca('0xd5')](_0x185f51['query'],{'showHidden':![],'depth':null}));};break;}return _0x14c7e0;}})[_0xf5ca('0x38')](respondWithResult(_0x276f2c,null))['catch'](handleError(_0x276f2c,null));};exports[_0xf5ca('0xe8')]=function(_0x432500,_0x12fc41,_0x41c472){return db[_0xf5ca('0x43')][_0xf5ca('0x5f')]({'where':{'id':_0x432500[_0xf5ca('0x5d')]['id']}})['then'](handleEntityNotFound(_0x12fc41,null))[_0xf5ca('0x38')](function(_0x265af6){if(_0x265af6){return _0x265af6['addAgents'](_0x432500['body'][_0xf5ca('0x6f')],_[_0xf5ca('0xa0')](_0x432500[_0xf5ca('0x61')],['ids','id'])||{})[_0xf5ca('0xa3')](function(_0x289695){for(var _0x5bf407=0x0;_0x5bf407<_0x432500['body']['ids'][_0xf5ca('0x4e')];_0x5bf407+=0x1){socket[_0xf5ca('0xe9')](_0xf5ca('0xea'),{'UserId':Number(_0x432500[_0xf5ca('0x61')][_0xf5ca('0x6f')][_0x5bf407]),'SmsAccountId':Number(_0x432500[_0xf5ca('0x5d')]['id'])});}return _0x289695;});}})['then'](respondWithResult(_0x12fc41,null))[_0xf5ca('0x2c')](handleError(_0x12fc41,null));};exports['removeAgents']=function(_0x24e24f,_0x5417ff,_0x3c89a6){return db['SmsAccount'][_0xf5ca('0x5f')]({'where':{'id':_0x24e24f['params']['id']}})[_0xf5ca('0x38')](handleEntityNotFound(_0x5417ff,null))[_0xf5ca('0x38')](function(_0x14e3f2){if(_0x14e3f2){return _0x14e3f2[_0xf5ca('0xeb')](_0x24e24f[_0xf5ca('0x49')][_0xf5ca('0x6f')])[_0xf5ca('0x38')](function(){if(_[_0xf5ca('0xec')](_0x24e24f[_0xf5ca('0x49')][_0xf5ca('0x6f')])){for(var _0x4a3bcf=0x0;_0x4a3bcf<_0x24e24f[_0xf5ca('0x49')]['ids']['length'];_0x4a3bcf+=0x1){socket[_0xf5ca('0xe9')](_0xf5ca('0xed'),{'UserId':Number(_0x24e24f[_0xf5ca('0x49')]['ids'][_0x4a3bcf]),'SmsAccountId':Number(_0x24e24f[_0xf5ca('0x5d')]['id'])});}}else{socket[_0xf5ca('0xe9')](_0xf5ca('0xed'),{'UserId':Number(_0x24e24f['query'][_0xf5ca('0x6f')]),'SmsAccountId':Number(_0x24e24f[_0xf5ca('0x5d')]['id'])});}});}})[_0xf5ca('0x38')](respondWithStatusCode(_0x5417ff,null))[_0xf5ca('0x2c')](handleError(_0x5417ff,null));};exports['getAgents']=function(_0x57e776,_0x2fd293,_0x344e30){var _0x48332e={};var _0x4c39e8={};var _0x3e2f05;var _0x4c931f;return db['SmsAccount'][_0xf5ca('0x6d')]({'where':{'id':_0x57e776[_0xf5ca('0x5d')]['id']}})[_0xf5ca('0x38')](handleEntityNotFound(_0x2fd293,null))[_0xf5ca('0x38')](function(_0x2ab074){if(_0x2ab074){_0x3e2f05=_0x2ab074;_0x4c39e8[_0xf5ca('0x48')]=_['keys'](db[_0xf5ca('0xad')][_0xf5ca('0x44')]);_0x4c39e8['query']=_[_0xf5ca('0x5e')](_0x57e776[_0xf5ca('0x49')]);_0x4c39e8['filters']=_[_0xf5ca('0x4b')](_0x4c39e8[_0xf5ca('0x48')],_0x4c39e8[_0xf5ca('0x49')]);_0x48332e[_0xf5ca('0x4c')]=_['intersection'](_0x4c39e8[_0xf5ca('0x48')],qs[_0xf5ca('0x4d')](_0x57e776[_0xf5ca('0x49')][_0xf5ca('0x4d')]));_0x48332e[_0xf5ca('0x4c')]=_0x48332e[_0xf5ca('0x4c')][_0xf5ca('0x4e')]?_0x48332e[_0xf5ca('0x4c')]:_0x4c39e8[_0xf5ca('0x48')];_0x48332e['order']=qs[_0xf5ca('0x52')](_0x57e776[_0xf5ca('0x49')][_0xf5ca('0x52')]);_0x48332e[_0xf5ca('0x53')]=qs[_0xf5ca('0x4a')](_[_0xf5ca('0x54')](_0x57e776[_0xf5ca('0x49')],_0x4c39e8[_0xf5ca('0x4a')]));if(_0x57e776[_0xf5ca('0x49')]['filter']){_0x48332e[_0xf5ca('0x53')]=_['merge'](_0x48332e['where'],{'$or':_[_0xf5ca('0x42')](_0x48332e['attributes'],function(_0x478c5a){var _0x1871c9={};_0x1871c9[_0x478c5a]={'$like':'%'+_0x57e776['query'][_0xf5ca('0x57')]+'%'};return _0x1871c9;})});}_0x48332e=_[_0xf5ca('0x55')]({},_0x48332e,_0x57e776[_0xf5ca('0x58')]);return _0x3e2f05['getAgents'](_0x48332e);}})['then'](function(_0x27a70a){if(_0x27a70a){_0x4c931f=_0x27a70a['length'];if(!_0x57e776[_0xf5ca('0x49')][_0xf5ca('0x4f')]('nolimit')){_0x48332e[_0xf5ca('0x33')]=qs['limit'](_0x57e776[_0xf5ca('0x49')][_0xf5ca('0x33')]);_0x48332e['offset']=qs[_0xf5ca('0x31')](_0x57e776['query'][_0xf5ca('0x31')]);}return _0x3e2f05[_0xf5ca('0xee')](_0x48332e);}})[_0xf5ca('0x38')](function(_0x529261){if(_0x529261){return _0x529261?{'count':_0x4c931f,'rows':_0x529261}:null;}})[_0xf5ca('0x38')](respondWithResult(_0x2fd293,null))['catch'](handleError(_0x2fd293,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 57b02fa..22b646e 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 _0xca01=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x4d9b5d,_0x3ac8c9){var _0x46504f=function(_0x24c4ce){while(--_0x24c4ce){_0x4d9b5d['push'](_0x4d9b5d['shift']());}};_0x46504f(++_0x3ac8c9);}(_0xca01,0x1d7));var _0x1ca0=function(_0x4767f7,_0x62e847){_0x4767f7=_0x4767f7-0x0;var _0x48a120=_0xca01[_0x4767f7];return _0x48a120;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x1ca0('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1ca0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ca0('0x2'),'afterDestroy':_0x1ca0('0x3')};function emitEvent(_0x1ffaf9){return function(_0x3d8467,_0x39e9fc,_0x2ffb10){SmsAccountEvents[_0x1ca0('0x4')](_0x1ffaf9+':'+_0x3d8467['id'],_0x3d8467);SmsAccountEvents['emit'](_0x1ffaf9,_0x3d8467);_0x2ffb10(null);};}for(var e in events){if(events[_0x1ca0('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x1ca0('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xb43d=['hook','exports','save','update','remove','emit','hasOwnProperty'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0xb43d,0x159));var _0xdb43=function(_0x5f2fc1,_0x515083){_0x5f2fc1=_0x5f2fc1-0x0;var _0x34135e=_0xb43d[_0x5f2fc1];return _0x34135e;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdb43('0x0'),'afterUpdate':_0xdb43('0x1'),'afterDestroy':_0xdb43('0x2')};function emitEvent(_0x32e69c){return function(_0x4c2008,_0x157f21,_0x813c47){SmsAccountEvents[_0xdb43('0x3')](_0x32e69c+':'+_0x4c2008['id'],_0x4c2008);SmsAccountEvents[_0xdb43('0x3')](_0x32e69c,_0x4c2008);_0x813c47(null);};}for(var e in events){if(events[_0xdb43('0x4')](e)){var event=events[e];SmsAccount[_0xdb43('0x5')](e,emitEvent(event));}}module[_0xdb43('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 9438025..9625873 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 _0x249f=['./smsAccount.attributes','define','sms_accounts','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x27ef56,_0x44e56b){var _0x9031a0=function(_0x4a1c66){while(--_0x4a1c66){_0x27ef56['push'](_0x27ef56['shift']());}};_0x9031a0(++_0x44e56b);}(_0x249f,0x8a));var _0xf249=function(_0xed4369,_0x235778){_0xed4369=_0xed4369-0x0;var _0xe0e0fa=_0x249f[_0xed4369];return _0xe0e0fa;};'use strict';var _=require(_0xf249('0x0'));var util=require(_0xf249('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf249('0x2'));var rp=require(_0xf249('0x3'));var fs=require('fs');var path=require(_0xf249('0x4'));var rimraf=require(_0xf249('0x5'));var config=require('../../config/environment');var attributes=require(_0xf249('0x6'));module['exports']=function(_0x5bcd24,_0x487efa){return _0x5bcd24[_0xf249('0x7')]('SmsAccount',attributes,{'tableName':_0xf249('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2301=['lodash','util','moment','bluebird','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2301,0x1e0));var _0x1230=function(_0x33bb07,_0x5b1849){_0x33bb07=_0x33bb07-0x0;var _0x481c81=_0x2301[_0x33bb07];return _0x481c81;};'use strict';var _=require(_0x1230('0x0'));var util=require(_0x1230('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1230('0x2'));var BPromise=require(_0x1230('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1230('0x4'));var attributes=require(_0x1230('0x5'));module[_0x1230('0x6')]=function(_0x61fc4e,_0x4151af){return _0x61fc4e[_0x1230('0x7')](_0x1230('0x8'),attributes,{'tableName':_0x1230('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 6e639c0..8e4488f 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 _0xd12f=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','model','attributes','map','debug','util','moment','randomstring','ioredis'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0xd12f,0xe0));var _0xfd12=function(_0x244c9c,_0x35249c){_0x244c9c=_0x244c9c-0x0;var _0x4b7c60=_0xd12f[_0x244c9c];return _0x4b7c60;};'use strict';var _=require('lodash');var util=require(_0xfd12('0x0'));var moment=require(_0xfd12('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd12('0x2'));var fs=require('fs');var Redis=require(_0xfd12('0x3'));var db=require(_0xfd12('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd12('0x5'))(_0xfd12('0x6'));var config=require(_0xfd12('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfd12('0x8')][_0xfd12('0x9')]({'port':0x232a});config[_0xfd12('0xa')]=_[_0xfd12('0xb')](config[_0xfd12('0xa')],{'host':_0xfd12('0xc'),'port':0x18eb});var socket=require(_0xfd12('0xd'))(new Redis(config[_0xfd12('0xa')]));require(_0xfd12('0xe'))[_0xfd12('0xf')](socket);function respondWithRpcPromise(_0x1be264,_0x5f3cff,_0x5bfb7d){return new BPromise(function(_0x3bc862,_0x2dc176){return client[_0xfd12('0x10')](_0x1be264,_0x5bfb7d)[_0xfd12('0x11')](function(_0x213032){logger[_0xfd12('0x12')](_0xfd12('0x13'),_0x5f3cff,_0xfd12('0x14'));logger['debug'](_0xfd12('0x15'),_0x5f3cff,'request\x20sent',JSON[_0xfd12('0x16')](_0x213032));if(_0x213032['error']){if(_0x213032[_0xfd12('0x17')]['code']===0x1f4){logger['error'](_0xfd12('0x13'),_0x5f3cff,_0x213032['error']['message']);return _0x2dc176(_0x213032[_0xfd12('0x17')][_0xfd12('0x18')]);}logger[_0xfd12('0x17')](_0xfd12('0x13'),_0x5f3cff,_0x213032[_0xfd12('0x17')][_0xfd12('0x18')]);return _0x3bc862(_0x213032[_0xfd12('0x17')]['message']);}else{logger[_0xfd12('0x12')](_0xfd12('0x13'),_0x5f3cff,_0xfd12('0x14'));_0x3bc862(_0x213032[_0xfd12('0x19')][_0xfd12('0x18')]);}})[_0xfd12('0x1a')](function(_0x4bd81a){logger['error'](_0xfd12('0x13'),_0x5f3cff,_0x4bd81a);_0x2dc176(_0x4bd81a);});});}exports[_0xfd12('0x1b')]=function(_0x92cb83){var _0x39d5fa=this;return new Promise(function(_0x320a19,_0xafc53c){return db[_0xfd12('0x1c')][_0xfd12('0x1d')]({'raw':_0x92cb83[_0xfd12('0x1e')]?_0x92cb83[_0xfd12('0x1e')][_0xfd12('0x1f')]===undefined?!![]:![]:!![],'where':_0x92cb83[_0xfd12('0x1e')]?_0x92cb83[_0xfd12('0x1e')][_0xfd12('0x20')]||null:null,'attributes':_0x92cb83[_0xfd12('0x1e')]?_0x92cb83[_0xfd12('0x1e')]['attributes']||null:null,'include':_0x92cb83[_0xfd12('0x1e')]?_0x92cb83[_0xfd12('0x1e')][_0xfd12('0x21')]?_['map'](_0x92cb83[_0xfd12('0x1e')]['include'],function(_0x50b1c3){return{'model':db[_0x50b1c3[_0xfd12('0x22')]],'as':_0x50b1c3['as'],'attributes':_0x50b1c3[_0xfd12('0x23')],'include':_0x50b1c3[_0xfd12('0x21')]?_[_0xfd12('0x24')](_0x50b1c3[_0xfd12('0x21')],function(_0x5516e4){return{'model':db[_0x5516e4[_0xfd12('0x22')]],'as':_0x5516e4['as'],'attributes':_0x5516e4[_0xfd12('0x23')],'include':_0x5516e4[_0xfd12('0x21')]?_[_0xfd12('0x24')](_0x5516e4[_0xfd12('0x21')],function(_0x53799b){return{'model':db[_0x53799b[_0xfd12('0x22')]],'as':_0x53799b['as'],'attributes':_0x53799b['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd12('0x11')](function(_0x2c164b){logger[_0xfd12('0x12')](_0xfd12('0x1b'),_0x92cb83);logger[_0xfd12('0x25')](_0xfd12('0x1b'),_0x92cb83,JSON[_0xfd12('0x16')](_0x2c164b));_0x320a19(_0x2c164b);})[_0xfd12('0x1a')](function(_0x51f09e){logger[_0xfd12('0x17')]('ShowSmsAccount',_0x51f09e[_0xfd12('0x18')],_0x92cb83);_0xafc53c(_0x39d5fa[_0xfd12('0x17')](0x1f4,_0x51f09e[_0xfd12('0x18')]));});});}; \ No newline at end of file +var _0x4c17=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSmsAccount','find','options','raw','include','attributes','map','model','then','catch','util'];(function(_0x23ef49,_0x3976e){var _0x3b82bd=function(_0x2279cb){while(--_0x2279cb){_0x23ef49['push'](_0x23ef49['shift']());}};_0x3b82bd(++_0x3976e);}(_0x4c17,0x1ee));var _0x74c1=function(_0x43df89,_0x501cc1){_0x43df89=_0x43df89-0x0;var _0x35ea84=_0x4c17[_0x43df89];return _0x35ea84;};'use strict';var _=require('lodash');var util=require(_0x74c1('0x0'));var moment=require('moment');var BPromise=require(_0x74c1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74c1('0x2'));var db=require(_0x74c1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x74c1('0x4'))(_0x74c1('0x5'));var config=require('../../config/environment');var jayson=require(_0x74c1('0x6'));var client=jayson['client'][_0x74c1('0x7')]({'port':0x232a});config[_0x74c1('0x8')]=_[_0x74c1('0x9')](config[_0x74c1('0x8')],{'host':_0x74c1('0xa'),'port':0x18eb});var socket=require(_0x74c1('0xb'))(new Redis(config[_0x74c1('0x8')]));require(_0x74c1('0xc'))['register'](socket);function respondWithRpcPromise(_0x28433e,_0x161268,_0x193f30){return new BPromise(function(_0x13befc,_0x409b40){return client[_0x74c1('0xd')](_0x28433e,_0x193f30)['then'](function(_0x121450){logger[_0x74c1('0xe')](_0x74c1('0xf'),_0x161268,_0x74c1('0x10'));logger[_0x74c1('0x11')](_0x74c1('0x12'),_0x161268,'request\x20sent',JSON[_0x74c1('0x13')](_0x121450));if(_0x121450[_0x74c1('0x14')]){if(_0x121450[_0x74c1('0x14')]['code']===0x1f4){logger['error'](_0x74c1('0xf'),_0x161268,_0x121450['error'][_0x74c1('0x15')]);return _0x409b40(_0x121450[_0x74c1('0x14')][_0x74c1('0x15')]);}logger[_0x74c1('0x14')](_0x74c1('0xf'),_0x161268,_0x121450['error'][_0x74c1('0x15')]);return _0x13befc(_0x121450['error'][_0x74c1('0x15')]);}else{logger[_0x74c1('0xe')]('SmsAccount,\x20%s,\x20%s',_0x161268,'request\x20sent');_0x13befc(_0x121450[_0x74c1('0x16')]['message']);}})['catch'](function(_0x3a713e){logger['error'](_0x74c1('0xf'),_0x161268,_0x3a713e);_0x409b40(_0x3a713e);});});}exports[_0x74c1('0x17')]=function(_0x3c05c5){var _0x39d9b8=this;return new Promise(function(_0x1a4ee0,_0x31c2a4){return db['SmsAccount'][_0x74c1('0x18')]({'raw':_0x3c05c5[_0x74c1('0x19')]?_0x3c05c5[_0x74c1('0x19')][_0x74c1('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c05c5[_0x74c1('0x19')]?_0x3c05c5[_0x74c1('0x19')]['where']||null:null,'attributes':_0x3c05c5[_0x74c1('0x19')]?_0x3c05c5[_0x74c1('0x19')]['attributes']||null:null,'include':_0x3c05c5['options']?_0x3c05c5[_0x74c1('0x19')][_0x74c1('0x1b')]?_['map'](_0x3c05c5['options']['include'],function(_0x1bce1d){return{'model':db[_0x1bce1d['model']],'as':_0x1bce1d['as'],'attributes':_0x1bce1d[_0x74c1('0x1c')],'include':_0x1bce1d[_0x74c1('0x1b')]?_[_0x74c1('0x1d')](_0x1bce1d[_0x74c1('0x1b')],function(_0x24976f){return{'model':db[_0x24976f[_0x74c1('0x1e')]],'as':_0x24976f['as'],'attributes':_0x24976f['attributes'],'include':_0x24976f[_0x74c1('0x1b')]?_[_0x74c1('0x1d')](_0x24976f[_0x74c1('0x1b')],function(_0x7b235){return{'model':db[_0x7b235[_0x74c1('0x1e')]],'as':_0x7b235['as'],'attributes':_0x7b235[_0x74c1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x74c1('0x1f')](function(_0xc7a60f){logger[_0x74c1('0xe')](_0x74c1('0x17'),_0x3c05c5);logger[_0x74c1('0x11')](_0x74c1('0x17'),_0x3c05c5,JSON[_0x74c1('0x13')](_0xc7a60f));_0x1a4ee0(_0xc7a60f);})[_0x74c1('0x20')](function(_0x44f410){logger[_0x74c1('0x14')](_0x74c1('0x17'),_0x44f410[_0x74c1('0x15')],_0x3c05c5);_0x31c2a4(_0x39d9b8[_0x74c1('0x14')](0x1f4,_0x44f410[_0x74c1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 5ea4307..1d5d996 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 75a6349..cfaa38c 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x3c1d9a,_0x149246){var _0xdacaba=function(_0x1e8a4b){while(--_0x1e8a4b){_0x3c1d9a['push'](_0x3c1d9a['shift']());}};_0xdacaba(++_0x149246);}(_0x55ca,0x126));var _0xa55c=function(_0x820843,_0x4b6f7e){_0x820843=_0x820843-0x0;var _0x2077c2=_0x55ca[_0x820843];return _0x2077c2;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x404d5f,_0x5b119b){var _0x51aa8b=function(_0x3fbfe5){while(--_0x3fbfe5){_0x404d5f['push'](_0x404d5f['shift']());}};_0x51aa8b(++_0x5b119b);}(_0xedd9,0xfc));var _0x9edd=function(_0x976636,_0x46b2cb){_0x976636=_0x976636-0x0;var _0x414ecb=_0xedd9[_0x976636];return _0x414ecb;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index ad0027e..d511747 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 _0x8fac=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x560d66,_0xf86af7){var _0x1a7191=function(_0x47fdbc){while(--_0x47fdbc){_0x560d66['push'](_0x560d66['shift']());}};_0x1a7191(++_0xf86af7);}(_0x8fac,0x1e9));var _0xc8fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8fac[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xc8fa('0x0'));module[_0xc8fa('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc8fa('0x2')],'allowNull':![],'defaultValue':_0xc8fa('0x3')},'appdata':{'type':Sequelize[_0xc8fa('0x4')]()},'description':{'type':Sequelize[_0xc8fa('0x2')]},'interval':{'type':Sequelize[_0xc8fa('0x2')],'defaultValue':_0xc8fa('0x5')}}; \ No newline at end of file +var _0x12b3=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0xb62d61,_0x10f558){var _0x2f3244=function(_0x1721d3){while(--_0x1721d3){_0xb62d61['push'](_0xb62d61['shift']());}};_0x2f3244(++_0x10f558);}(_0x12b3,0x198));var _0x312b=function(_0x2e6177,_0x50b334){_0x2e6177=_0x2e6177-0x0;var _0x54bf40=_0x12b3[_0x2e6177];return _0x54bf40;};'use strict';var Sequelize=require('sequelize');module[_0x312b('0x0')]={'priority':{'type':Sequelize[_0x312b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x312b('0x2')],'allowNull':![],'defaultValue':_0x312b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x312b('0x2')]},'interval':{'type':Sequelize[_0x312b('0x2')],'defaultValue':_0x312b('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index d561478..c84dfd5 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 _0x0c01=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','params','merge','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','map','SmsApplication','rawAttributes','type','model','name','query','keys','filters'];(function(_0x1ae54a,_0x575be9){var _0x1bfa45=function(_0x1c84d8){while(--_0x1c84d8){_0x1ae54a['push'](_0x1ae54a['shift']());}};_0x1bfa45(++_0x575be9);}(_0x0c01,0xf7));var _0x10c0=function(_0x4da1c9,_0x29a62b){_0x4da1c9=_0x4da1c9-0x0;var _0x1e3f79=_0x0c01[_0x4da1c9];return _0x1e3f79;};'use strict';var emlformat=require(_0x10c0('0x0'));var rimraf=require(_0x10c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x10c0('0x2'));var moment=require(_0x10c0('0x3'));var BPromise=require(_0x10c0('0x4'));var Mustache=require(_0x10c0('0x5'));var util=require(_0x10c0('0x6'));var path=require('path');var sox=require(_0x10c0('0x7'));var csv=require(_0x10c0('0x8'));var ejs=require(_0x10c0('0x9'));var fs=require('fs');var fs_extra=require(_0x10c0('0xa'));var _=require(_0x10c0('0xb'));var squel=require(_0x10c0('0xc'));var crypto=require(_0x10c0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x10c0('0xe'));var toCsv=require(_0x10c0('0x8'));var querystring=require('querystring');var Papa=require(_0x10c0('0xf'));var Redis=require('ioredis');var authService=require(_0x10c0('0x10'));var qs=require(_0x10c0('0x11'));var as=require(_0x10c0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x10c0('0x13'))(_0x10c0('0x14'));var utils=require(_0x10c0('0x15'));var config=require(_0x10c0('0x16'));var licenseUtil=require(_0x10c0('0x17'));var db=require(_0x10c0('0x18'))['db'];function respondWithStatusCode(_0xebe6c5,_0x32b45d){_0x32b45d=_0x32b45d||0xcc;return function(_0x1e2585){if(_0x1e2585){return _0xebe6c5[_0x10c0('0x19')](_0x32b45d);}return _0xebe6c5[_0x10c0('0x1a')](_0x32b45d)[_0x10c0('0x1b')]();};}function respondWithResult(_0x1efe48,_0x486d23){_0x486d23=_0x486d23||0xc8;return function(_0x1cf073){if(_0x1cf073){return _0x1efe48[_0x10c0('0x1a')](_0x486d23)[_0x10c0('0x1c')](_0x1cf073);}};}function respondWithFilteredResult(_0x60d27e,_0x6f04b0){return function(_0x67ee2f){if(_0x67ee2f){var _0x414b91=typeof _0x6f04b0[_0x10c0('0x1d')]===_0x10c0('0x1e')&&typeof _0x6f04b0[_0x10c0('0x1f')]===_0x10c0('0x1e');var _0x1db338=_0x67ee2f[_0x10c0('0x20')];var _0x5d1ea0=_0x414b91?0x0:_0x6f04b0[_0x10c0('0x1d')];var _0x51a2c4=_0x414b91?_0x67ee2f[_0x10c0('0x20')]:_0x6f04b0[_0x10c0('0x1d')]+_0x6f04b0[_0x10c0('0x1f')];var _0x515819;if(_0x51a2c4>=_0x1db338){_0x51a2c4=_0x1db338;_0x515819=0xc8;}else{_0x515819=0xce;}_0x60d27e[_0x10c0('0x1a')](_0x515819);return _0x60d27e[_0x10c0('0x21')](_0x10c0('0x22'),_0x5d1ea0+'-'+_0x51a2c4+'/'+_0x1db338)[_0x10c0('0x1c')](_0x67ee2f);}return null;};}function patchUpdates(_0x3b6898){return function(_0x4340a){try{jsonpatch[_0x10c0('0x23')](_0x4340a,_0x3b6898,!![]);}catch(_0x248d9a){return BPromise[_0x10c0('0x24')](_0x248d9a);}return _0x4340a[_0x10c0('0x25')]();};}function saveUpdates(_0x2a1df8,_0x32d64b){return function(_0x1d9b53){if(_0x1d9b53){return _0x1d9b53[_0x10c0('0x26')](_0x2a1df8)[_0x10c0('0x27')](function(_0x2bb802){return _0x2bb802;});}return null;};}function removeEntity(_0x116c1a,_0x398eb6){return function(_0x776b0d){if(_0x776b0d){return _0x776b0d[_0x10c0('0x28')]()['then'](function(){_0x116c1a[_0x10c0('0x1a')](0xcc)[_0x10c0('0x1b')]();});}};}function handleEntityNotFound(_0x1f373d,_0x29503e){return function(_0x148d35){if(!_0x148d35){_0x1f373d[_0x10c0('0x19')](0x194);}return _0x148d35;};}function handleError(_0x4a22de,_0x1939ad){_0x1939ad=_0x1939ad||0x1f4;return function(_0x3e941f){logger[_0x10c0('0x29')](_0x3e941f[_0x10c0('0x2a')]);if(_0x3e941f['name']){delete _0x3e941f['name'];}_0x4a22de[_0x10c0('0x1a')](_0x1939ad)['send'](_0x3e941f);};}exports[_0x10c0('0x2b')]=function(_0x4dd5c5,_0x5d5e67){var _0x310f29={},_0x2f201c={},_0x144168={'count':0x0,'rows':[]};var _0x3f9c2e=_[_0x10c0('0x2c')](db[_0x10c0('0x2d')][_0x10c0('0x2e')],function(_0xf5d98){return{'name':_0xf5d98['fieldName'],'type':_0xf5d98[_0x10c0('0x2f')]['key']};});_0x2f201c[_0x10c0('0x30')]=_[_0x10c0('0x2c')](_0x3f9c2e,_0x10c0('0x31'));_0x2f201c[_0x10c0('0x32')]=_[_0x10c0('0x33')](_0x4dd5c5[_0x10c0('0x32')]);_0x2f201c[_0x10c0('0x34')]=_['intersection'](_0x2f201c['model'],_0x2f201c[_0x10c0('0x32')]);_0x310f29[_0x10c0('0x35')]=_[_0x10c0('0x36')](_0x2f201c[_0x10c0('0x30')],qs[_0x10c0('0x37')](_0x4dd5c5['query']['fields']));_0x310f29['attributes']=_0x310f29[_0x10c0('0x35')][_0x10c0('0x38')]?_0x310f29[_0x10c0('0x35')]:_0x2f201c['model'];if(!_0x4dd5c5[_0x10c0('0x32')][_0x10c0('0x39')](_0x10c0('0x3a'))){_0x310f29[_0x10c0('0x1f')]=qs['limit'](_0x4dd5c5[_0x10c0('0x32')][_0x10c0('0x1f')]);_0x310f29[_0x10c0('0x1d')]=qs[_0x10c0('0x1d')](_0x4dd5c5[_0x10c0('0x32')][_0x10c0('0x1d')]);}_0x310f29[_0x10c0('0x3b')]=qs['sort'](_0x4dd5c5['query'][_0x10c0('0x3c')]);_0x310f29[_0x10c0('0x3d')]=qs[_0x10c0('0x34')](_[_0x10c0('0x3e')](_0x4dd5c5['query'],_0x2f201c[_0x10c0('0x34')]),_0x3f9c2e);if(_0x4dd5c5[_0x10c0('0x32')][_0x10c0('0x3f')]){_0x310f29[_0x10c0('0x3d')]=_['merge'](_0x310f29[_0x10c0('0x3d')],{'$or':_[_0x10c0('0x2c')](_0x3f9c2e,function(_0x37f877){if(_0x37f877['type']!==_0x10c0('0x40')){var _0x459c40={};_0x459c40[_0x37f877['name']]={'$like':'%'+_0x4dd5c5['query'][_0x10c0('0x3f')]+'%'};return _0x459c40;}})});}_0x310f29=_['merge']({},_0x310f29,_0x4dd5c5[_0x10c0('0x41')]);var _0x527a27={'where':_0x310f29[_0x10c0('0x3d')]};return db['SmsApplication'][_0x10c0('0x20')](_0x527a27)[_0x10c0('0x27')](function(_0x5c9609){_0x144168['count']=_0x5c9609;if(_0x4dd5c5['query']['includeAll']){_0x310f29[_0x10c0('0x42')]=[{'all':!![]}];}return db[_0x10c0('0x2d')][_0x10c0('0x43')](_0x310f29);})[_0x10c0('0x27')](function(_0x2f6c46){_0x144168[_0x10c0('0x44')]=_0x2f6c46;return _0x144168;})[_0x10c0('0x27')](respondWithFilteredResult(_0x5d5e67,_0x310f29))[_0x10c0('0x45')](handleError(_0x5d5e67,null));};exports['show']=function(_0x228b2a,_0x4298dc){var _0x1dbfde={'raw':!![],'where':{'id':_0x228b2a[_0x10c0('0x46')]['id']}},_0x4b8a85={};_0x4b8a85[_0x10c0('0x30')]=_[_0x10c0('0x33')](db['SmsApplication'][_0x10c0('0x2e')]);_0x4b8a85['query']=_[_0x10c0('0x33')](_0x228b2a[_0x10c0('0x32')]);_0x4b8a85[_0x10c0('0x34')]=_[_0x10c0('0x36')](_0x4b8a85['model'],_0x4b8a85[_0x10c0('0x32')]);_0x1dbfde['attributes']=_[_0x10c0('0x36')](_0x4b8a85[_0x10c0('0x30')],qs[_0x10c0('0x37')](_0x228b2a['query']['fields']));_0x1dbfde[_0x10c0('0x35')]=_0x1dbfde['attributes'][_0x10c0('0x38')]?_0x1dbfde[_0x10c0('0x35')]:_0x4b8a85[_0x10c0('0x30')];if(_0x228b2a[_0x10c0('0x32')]['includeAll']){_0x1dbfde['include']=[{'all':!![]}];}_0x1dbfde=_[_0x10c0('0x47')]({},_0x1dbfde,_0x228b2a[_0x10c0('0x41')]);return db[_0x10c0('0x2d')][_0x10c0('0x48')](_0x1dbfde)['then'](handleEntityNotFound(_0x4298dc,null))[_0x10c0('0x27')](respondWithResult(_0x4298dc,null))[_0x10c0('0x45')](handleError(_0x4298dc,null));};exports['create']=function(_0x3bcb48,_0x39e31b){return db[_0x10c0('0x2d')][_0x10c0('0x49')](_0x3bcb48['body'],{})[_0x10c0('0x27')](respondWithResult(_0x39e31b,0xc9))['catch'](handleError(_0x39e31b,null));};exports[_0x10c0('0x26')]=function(_0x55b623,_0x26eb13){if(_0x55b623['body']['id']){delete _0x55b623[_0x10c0('0x4a')]['id'];}return db[_0x10c0('0x2d')]['find']({'where':{'id':_0x55b623[_0x10c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x26eb13,null))[_0x10c0('0x27')](saveUpdates(_0x55b623[_0x10c0('0x4a')],null))[_0x10c0('0x27')](respondWithResult(_0x26eb13,null))[_0x10c0('0x45')](handleError(_0x26eb13,null));};exports[_0x10c0('0x28')]=function(_0x3975ef,_0x595823){return db['SmsApplication'][_0x10c0('0x48')]({'where':{'id':_0x3975ef[_0x10c0('0x46')]['id']}})[_0x10c0('0x27')](handleEntityNotFound(_0x595823,null))['then'](removeEntity(_0x595823,null))['catch'](handleError(_0x595823,null));}; \ No newline at end of file +var _0x78b1=['reject','save','update','then','destroy','error','name','index','map','SmsApplication','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x78b1,0x195));var _0x178b=function(_0x3e72b9,_0x555ebb){_0x3e72b9=_0x3e72b9-0x0;var _0x217108=_0x78b1[_0x3e72b9];return _0x217108;};'use strict';var emlformat=require(_0x178b('0x0'));var rimraf=require(_0x178b('0x1'));var zipdir=require(_0x178b('0x2'));var jsonpatch=require(_0x178b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x178b('0x4'));var Mustache=require(_0x178b('0x5'));var util=require(_0x178b('0x6'));var path=require(_0x178b('0x7'));var sox=require(_0x178b('0x8'));var csv=require('to-csv');var ejs=require(_0x178b('0x9'));var fs=require('fs');var fs_extra=require(_0x178b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x178b('0xb'));var jsforce=require(_0x178b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x178b('0xd'));var querystring=require('querystring');var Papa=require(_0x178b('0xe'));var Redis=require(_0x178b('0xf'));var authService=require(_0x178b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x178b('0x11'));var hardwareService=require(_0x178b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x178b('0x13'));var config=require(_0x178b('0x14'));var licenseUtil=require(_0x178b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc468,_0x1bc2e1){_0x1bc2e1=_0x1bc2e1||0xcc;return function(_0x56134a){if(_0x56134a){return _0x3cc468[_0x178b('0x16')](_0x1bc2e1);}return _0x3cc468[_0x178b('0x17')](_0x1bc2e1)[_0x178b('0x18')]();};}function respondWithResult(_0x87d23,_0x4b0700){_0x4b0700=_0x4b0700||0xc8;return function(_0x34cfaf){if(_0x34cfaf){return _0x87d23['status'](_0x4b0700)[_0x178b('0x19')](_0x34cfaf);}};}function respondWithFilteredResult(_0x511a33,_0x16b525){return function(_0x5089cb){if(_0x5089cb){var _0x46d7d5=typeof _0x16b525[_0x178b('0x1a')]===_0x178b('0x1b')&&typeof _0x16b525[_0x178b('0x1c')]===_0x178b('0x1b');var _0x1bc9dc=_0x5089cb[_0x178b('0x1d')];var _0x289930=_0x46d7d5?0x0:_0x16b525['offset'];var _0x53eb1b=_0x46d7d5?_0x5089cb[_0x178b('0x1d')]:_0x16b525['offset']+_0x16b525[_0x178b('0x1c')];var _0x5d7ad2;if(_0x53eb1b>=_0x1bc9dc){_0x53eb1b=_0x1bc9dc;_0x5d7ad2=0xc8;}else{_0x5d7ad2=0xce;}_0x511a33[_0x178b('0x17')](_0x5d7ad2);return _0x511a33[_0x178b('0x1e')](_0x178b('0x1f'),_0x289930+'-'+_0x53eb1b+'/'+_0x1bc9dc)[_0x178b('0x19')](_0x5089cb);}return null;};}function patchUpdates(_0x3c6aeb){return function(_0x3cb047){try{jsonpatch[_0x178b('0x20')](_0x3cb047,_0x3c6aeb,!![]);}catch(_0x46c30c){return BPromise[_0x178b('0x21')](_0x46c30c);}return _0x3cb047[_0x178b('0x22')]();};}function saveUpdates(_0x30118c,_0x3f4322){return function(_0x32a4e7){if(_0x32a4e7){return _0x32a4e7[_0x178b('0x23')](_0x30118c)[_0x178b('0x24')](function(_0x6323bb){return _0x6323bb;});}return null;};}function removeEntity(_0xe9b771,_0x42f9e9){return function(_0x458c8b){if(_0x458c8b){return _0x458c8b[_0x178b('0x25')]()[_0x178b('0x24')](function(){_0xe9b771[_0x178b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a45c1,_0x1f9ec4){return function(_0xae99aa){if(!_0xae99aa){_0x3a45c1['sendStatus'](0x194);}return _0xae99aa;};}function handleError(_0x512fe2,_0x4c0c29){_0x4c0c29=_0x4c0c29||0x1f4;return function(_0x3f2087){logger[_0x178b('0x26')](_0x3f2087['stack']);if(_0x3f2087[_0x178b('0x27')]){delete _0x3f2087['name'];}_0x512fe2[_0x178b('0x17')](_0x4c0c29)['send'](_0x3f2087);};}exports[_0x178b('0x28')]=function(_0x3e0617,_0x4f3d7c){var _0x1d2684={},_0x48f547={},_0x1652da={'count':0x0,'rows':[]};var _0x2f5be5=_[_0x178b('0x29')](db[_0x178b('0x2a')][_0x178b('0x2b')],function(_0xd04500){return{'name':_0xd04500['fieldName'],'type':_0xd04500[_0x178b('0x2c')][_0x178b('0x2d')]};});_0x48f547[_0x178b('0x2e')]=_[_0x178b('0x29')](_0x2f5be5,_0x178b('0x27'));_0x48f547[_0x178b('0x2f')]=_[_0x178b('0x30')](_0x3e0617['query']);_0x48f547[_0x178b('0x31')]=_['intersection'](_0x48f547[_0x178b('0x2e')],_0x48f547[_0x178b('0x2f')]);_0x1d2684['attributes']=_[_0x178b('0x32')](_0x48f547[_0x178b('0x2e')],qs['fields'](_0x3e0617[_0x178b('0x2f')][_0x178b('0x33')]));_0x1d2684[_0x178b('0x34')]=_0x1d2684['attributes'][_0x178b('0x35')]?_0x1d2684[_0x178b('0x34')]:_0x48f547[_0x178b('0x2e')];if(!_0x3e0617[_0x178b('0x2f')][_0x178b('0x36')](_0x178b('0x37'))){_0x1d2684[_0x178b('0x1c')]=qs[_0x178b('0x1c')](_0x3e0617[_0x178b('0x2f')]['limit']);_0x1d2684['offset']=qs[_0x178b('0x1a')](_0x3e0617[_0x178b('0x2f')][_0x178b('0x1a')]);}_0x1d2684[_0x178b('0x38')]=qs[_0x178b('0x39')](_0x3e0617[_0x178b('0x2f')][_0x178b('0x39')]);_0x1d2684[_0x178b('0x3a')]=qs['filters'](_[_0x178b('0x3b')](_0x3e0617['query'],_0x48f547[_0x178b('0x31')]),_0x2f5be5);if(_0x3e0617[_0x178b('0x2f')]['filter']){_0x1d2684[_0x178b('0x3a')]=_[_0x178b('0x3c')](_0x1d2684['where'],{'$or':_[_0x178b('0x29')](_0x2f5be5,function(_0x4a0e20){if(_0x4a0e20[_0x178b('0x2c')]!=='VIRTUAL'){var _0x2f4715={};_0x2f4715[_0x4a0e20[_0x178b('0x27')]]={'$like':'%'+_0x3e0617[_0x178b('0x2f')][_0x178b('0x3d')]+'%'};return _0x2f4715;}})});}_0x1d2684=_[_0x178b('0x3c')]({},_0x1d2684,_0x3e0617['options']);var _0x17c18e={'where':_0x1d2684[_0x178b('0x3a')]};return db[_0x178b('0x2a')][_0x178b('0x1d')](_0x17c18e)[_0x178b('0x24')](function(_0x3467fb){_0x1652da['count']=_0x3467fb;if(_0x3e0617[_0x178b('0x2f')][_0x178b('0x3e')]){_0x1d2684[_0x178b('0x3f')]=[{'all':!![]}];}return db[_0x178b('0x2a')][_0x178b('0x40')](_0x1d2684);})[_0x178b('0x24')](function(_0x498206){_0x1652da[_0x178b('0x41')]=_0x498206;return _0x1652da;})[_0x178b('0x24')](respondWithFilteredResult(_0x4f3d7c,_0x1d2684))[_0x178b('0x42')](handleError(_0x4f3d7c,null));};exports[_0x178b('0x43')]=function(_0x278b69,_0x4bffb4){var _0x4e8b01={'raw':!![],'where':{'id':_0x278b69['params']['id']}},_0x4cc36f={};_0x4cc36f[_0x178b('0x2e')]=_[_0x178b('0x30')](db['SmsApplication'][_0x178b('0x2b')]);_0x4cc36f[_0x178b('0x2f')]=_['keys'](_0x278b69[_0x178b('0x2f')]);_0x4cc36f['filters']=_[_0x178b('0x32')](_0x4cc36f['model'],_0x4cc36f[_0x178b('0x2f')]);_0x4e8b01[_0x178b('0x34')]=_[_0x178b('0x32')](_0x4cc36f[_0x178b('0x2e')],qs[_0x178b('0x33')](_0x278b69[_0x178b('0x2f')][_0x178b('0x33')]));_0x4e8b01[_0x178b('0x34')]=_0x4e8b01['attributes'][_0x178b('0x35')]?_0x4e8b01[_0x178b('0x34')]:_0x4cc36f['model'];if(_0x278b69['query']['includeAll']){_0x4e8b01[_0x178b('0x3f')]=[{'all':!![]}];}_0x4e8b01=_[_0x178b('0x3c')]({},_0x4e8b01,_0x278b69[_0x178b('0x44')]);return db[_0x178b('0x2a')][_0x178b('0x45')](_0x4e8b01)[_0x178b('0x24')](handleEntityNotFound(_0x4bffb4,null))[_0x178b('0x24')](respondWithResult(_0x4bffb4,null))[_0x178b('0x42')](handleError(_0x4bffb4,null));};exports[_0x178b('0x46')]=function(_0x4c54f7,_0x39b7e0){return db['SmsApplication'][_0x178b('0x46')](_0x4c54f7['body'],{})[_0x178b('0x24')](respondWithResult(_0x39b7e0,0xc9))[_0x178b('0x42')](handleError(_0x39b7e0,null));};exports[_0x178b('0x23')]=function(_0x4b94c1,_0x48f5b7){if(_0x4b94c1[_0x178b('0x47')]['id']){delete _0x4b94c1[_0x178b('0x47')]['id'];}return db[_0x178b('0x2a')]['find']({'where':{'id':_0x4b94c1[_0x178b('0x48')]['id']}})['then'](handleEntityNotFound(_0x48f5b7,null))[_0x178b('0x24')](saveUpdates(_0x4b94c1[_0x178b('0x47')],null))[_0x178b('0x24')](respondWithResult(_0x48f5b7,null))[_0x178b('0x42')](handleError(_0x48f5b7,null));};exports[_0x178b('0x25')]=function(_0x33424,_0x549d69){return db[_0x178b('0x2a')]['find']({'where':{'id':_0x33424[_0x178b('0x48')]['id']}})[_0x178b('0x24')](handleEntityNotFound(_0x549d69,null))[_0x178b('0x24')](removeEntity(_0x549d69,null))[_0x178b('0x42')](handleError(_0x549d69,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 46c9d17..daedb06 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 _0x8fd3=['api','path','rimraf','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x11ba46,_0x1d6752){var _0x1c8c6f=function(_0x4cf96f){while(--_0x4cf96f){_0x11ba46['push'](_0x11ba46['shift']());}};_0x1c8c6f(++_0x1d6752);}(_0x8fd3,0x1d7));var _0x38fd=function(_0x1ed8ee,_0x5023c9){_0x1ed8ee=_0x1ed8ee-0x0;var _0x193133=_0x8fd3[_0x1ed8ee];return _0x193133;};'use strict';var _=require('lodash');var util=require(_0x38fd('0x0'));var logger=require(_0x38fd('0x1'))(_0x38fd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x38fd('0x3'));var rimraf=require(_0x38fd('0x4'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x38fd('0x5')]=function(_0x2c9738,_0x3e49db){return _0x2c9738[_0x38fd('0x6')](_0x38fd('0x7'),attributes,{'tableName':_0x38fd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x38fd('0x9'),'collate':_0x38fd('0xa')});}; \ No newline at end of file +var _0x0799=['../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x377f12,_0x73b7d7){var _0x22ab09=function(_0x4a296e){while(--_0x4a296e){_0x377f12['push'](_0x377f12['shift']());}};_0x22ab09(++_0x73b7d7);}(_0x0799,0x125));var _0x9079=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x0799[_0x4629ee];return _0x47fb5b;};'use strict';var _=require(_0x9079('0x0'));var util=require(_0x9079('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9079('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9079('0x3'));var attributes=require(_0x9079('0x4'));module['exports']=function(_0x1787d7,_0x3f6657){return _0x1787d7['define'](_0x9079('0x5'),attributes,{'tableName':_0x9079('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9079('0x7')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index e8d9086..86d824f 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 _0x0c2b=['code','SmsApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0c2b,0x194));var _0xb0c2=function(_0x2d0043,_0x48c363){_0x2d0043=_0x2d0043-0x0;var _0x1c95f7=_0x0c2b[_0x2d0043];return _0x1c95f7;};'use strict';var _=require(_0xb0c2('0x0'));var util=require(_0xb0c2('0x1'));var moment=require('moment');var BPromise=require(_0xb0c2('0x2'));var rs=require(_0xb0c2('0x3'));var fs=require('fs');var Redis=require(_0xb0c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0c2('0x5'))(_0xb0c2('0x6'));var config=require(_0xb0c2('0x7'));var jayson=require(_0xb0c2('0x8'));var client=jayson[_0xb0c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18649a,_0x3fe284,_0x13d064){return new BPromise(function(_0x5052b8,_0x247201){return client[_0xb0c2('0xa')](_0x18649a,_0x13d064)[_0xb0c2('0xb')](function(_0x281dd2){logger['info']('SmsApplication,\x20%s,\x20%s',_0x3fe284,_0xb0c2('0xc'));logger[_0xb0c2('0xd')](_0xb0c2('0xe'),_0x3fe284,_0xb0c2('0xc'),JSON['stringify'](_0x281dd2));if(_0x281dd2[_0xb0c2('0xf')]){if(_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x10')]===0x1f4){logger[_0xb0c2('0xf')](_0xb0c2('0x11'),_0x3fe284,_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);return _0x247201(_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);}logger[_0xb0c2('0xf')](_0xb0c2('0x11'),_0x3fe284,_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);return _0x5052b8(_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);}else{logger['info'](_0xb0c2('0x11'),_0x3fe284,_0xb0c2('0xc'));_0x5052b8(_0x281dd2[_0xb0c2('0x13')]['message']);}})['catch'](function(_0x332d44){logger[_0xb0c2('0xf')](_0xb0c2('0x11'),_0x3fe284,_0x332d44);_0x247201(_0x332d44);});});} \ No newline at end of file +var _0xb4b6=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x45564a,_0x160043){var _0x1184c7=function(_0x529f16){while(--_0x529f16){_0x45564a['push'](_0x45564a['shift']());}};_0x1184c7(++_0x160043);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x25e5c2,_0x1fe29c){_0x25e5c2=_0x25e5c2-0x0;var _0x2aaca2=_0xb4b6[_0x25e5c2];return _0x2aaca2;};'use strict';var _=require('lodash');var util=require(_0x6b4b('0x0'));var moment=require(_0x6b4b('0x1'));var BPromise=require(_0x6b4b('0x2'));var rs=require(_0x6b4b('0x3'));var fs=require('fs');var Redis=require(_0x6b4b('0x4'));var db=require(_0x6b4b('0x5'))['db'];var utils=require(_0x6b4b('0x6'));var logger=require(_0x6b4b('0x7'))(_0x6b4b('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b4b('0x9'));var client=jayson['client'][_0x6b4b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25eef2,_0x8b279d,_0x127577){return new BPromise(function(_0x2e6b81,_0x572b2d){return client[_0x6b4b('0xb')](_0x25eef2,_0x127577)[_0x6b4b('0xc')](function(_0x40b391){logger[_0x6b4b('0xd')](_0x6b4b('0xe'),_0x8b279d,_0x6b4b('0xf'));logger[_0x6b4b('0x10')](_0x6b4b('0x11'),_0x8b279d,'request\x20sent',JSON[_0x6b4b('0x12')](_0x40b391));if(_0x40b391['error']){if(_0x40b391[_0x6b4b('0x13')][_0x6b4b('0x14')]===0x1f4){logger[_0x6b4b('0x13')](_0x6b4b('0xe'),_0x8b279d,_0x40b391[_0x6b4b('0x13')][_0x6b4b('0x15')]);return _0x572b2d(_0x40b391[_0x6b4b('0x13')]['message']);}logger[_0x6b4b('0x13')](_0x6b4b('0xe'),_0x8b279d,_0x40b391[_0x6b4b('0x13')]['message']);return _0x2e6b81(_0x40b391['error'][_0x6b4b('0x15')]);}else{logger[_0x6b4b('0xd')]('SmsApplication,\x20%s,\x20%s',_0x8b279d,_0x6b4b('0xf'));_0x2e6b81(_0x40b391[_0x6b4b('0x16')][_0x6b4b('0x15')]);}})[_0x6b4b('0x17')](function(_0x22a176){logger[_0x6b4b('0x13')](_0x6b4b('0xe'),_0x8b279d,_0x22a176);_0x572b2d(_0x22a176);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7e8871d..bdc7b5f 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 _0xe511=['addTags','put','update','smsinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','describe','show','/:id/messages','isAuthenticated','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xe511,0x16f));var _0x1e51=function(_0x40fa64,_0xb797a4){_0x40fa64=_0x40fa64-0x0;var _0x272ab0=_0xe511[_0x40fa64];return _0x272ab0;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0x8')]('/:id/download',auth[_0x1e51('0xd')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')]('/',auth[_0x1e51('0xd')](),controller[_0x1e51('0x11')]);router[_0x1e51('0x10')]('/:id/messages',auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x10')](_0x1e51('0x13'),auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x16')),controller[_0x1e51('0x17')]);router[_0x1e51('0x18')]('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),'smsinteraction:update'),controller[_0x1e51('0x19')]);router['delete']('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x1a')),controller[_0x1e51('0x1b')]);router[_0x1e51('0x1c')]('/:id/tags',auth[_0x1e51('0xd')](),controller['removeTags']);module[_0x1e51('0x1d')]=router; \ No newline at end of file +var _0x6e6c=['create','addMessage','tracked','sms','smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x2c84f5,_0x236ef1){var _0xcd4f7=function(_0x381aad){while(--_0x381aad){_0x2c84f5['push'](_0x2c84f5['shift']());}};_0xcd4f7(++_0x236ef1);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./smsInteraction.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id',auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0x6')](_0xc6e6('0xc'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xe')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['post'](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0xe')]('/:id/tags',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0x11')](_0xc6e6('0x12'),_0xc6e6('0x13')),controller[_0xc6e6('0x14')]);router['put'](_0xc6e6('0x15'),auth[_0xc6e6('0x7')](),interaction['tracked'](_0xc6e6('0x12'),_0xc6e6('0x16')),controller[_0xc6e6('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xc6e6('0x11')]('sms',_0xc6e6('0x18')),controller[_0xc6e6('0x19')]);router[_0xc6e6('0x1a')](_0xc6e6('0x1b'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x1c')]);module[_0xc6e6('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 9dcc593..ff64609 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 _0x236c=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x2d85d9,_0x3608f3){var _0x3b23c3=function(_0x3e3ca7){while(--_0x3e3ca7){_0x2d85d9['push'](_0x2d85d9['shift']());}};_0x3b23c3(++_0x3608f3);}(_0x236c,0x155));var _0xc236=function(_0x18f07f,_0x2db555){_0x18f07f=_0x18f07f-0x0;var _0x20bc4f=_0x236c[_0x18f07f];return _0x20bc4f;};'use strict';var Sequelize=require(_0xc236('0x0'));var moment=require('moment');module[_0xc236('0x1')]={'closed':{'type':Sequelize[_0xc236('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc236('0x3')]},'disposition':{'type':Sequelize[_0xc236('0x4')]},'secondDisposition':{'type':Sequelize[_0xc236('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc236('0x4')]},'phone':{'type':Sequelize[_0xc236('0x4')]},'read1stAt':{'type':Sequelize[_0xc236('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc236('0x5')]('in',_0xc236('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc236('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc236('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc236('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5d0a=['STRING','ENUM','out','BOOLEAN','INTEGER','sequelize','exports','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d0a,0x175));var _0xa5d0=function(_0x27adc0,_0xe8650d){_0x27adc0=_0x27adc0-0x0;var _0x3d42c4=_0x5d0a[_0x27adc0];return _0x3d42c4;};'use strict';var Sequelize=require(_0xa5d0('0x0'));var moment=require('moment');module[_0xa5d0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa5d0('0x2')]},'disposition':{'type':Sequelize[_0xa5d0('0x3')]},'secondDisposition':{'type':Sequelize[_0xa5d0('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa5d0('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa5d0('0x3')]},'read1stAt':{'type':Sequelize[_0xa5d0('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa5d0('0x4')]('in',_0xa5d0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa5d0('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa5d0('0x4')]('in',_0xa5d0('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa5d0('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa5d0('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 780a04b..c30c448 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 _0x6cad=['sms','user','show','params','keys','query','intersection','attributes','model','includeAll','include','merge','create','body','catch','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','filters','fields','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','Account','Owner','get','mkdirSync','Sms','N.A.','toString','closed','closedAt','disposition','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','end','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll'];(function(_0x15cf2d,_0x4c292e){var _0x3dd84b=function(_0x41bbd4){while(--_0x41bbd4){_0x15cf2d['push'](_0x15cf2d['shift']());}};_0x3dd84b(++_0x4c292e);}(_0x6cad,0x1c5));var _0xd6ca=function(_0x1a660e,_0x2ca76b){_0x1a660e=_0x1a660e-0x0;var _0x25df5f=_0x6cad[_0x1a660e];return _0x25df5f;};'use strict';var rimraf=require(_0xd6ca('0x0'));var zipdir=require(_0xd6ca('0x1'));var moment=require(_0xd6ca('0x2'));var BPromise=require(_0xd6ca('0x3'));var util=require(_0xd6ca('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6ca('0x5'));var Redis=require(_0xd6ca('0x6'));var interaction=require(_0xd6ca('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xd6ca('0x8'));var logger=require(_0xd6ca('0x9'))(_0xd6ca('0xa'));var config=require(_0xd6ca('0xb'));var db=require('../../mysqldb')['db'];config[_0xd6ca('0xc')]=_[_0xd6ca('0xd')](config[_0xd6ca('0xc')],{'host':_0xd6ca('0xe'),'port':0x18eb});var socket=require(_0xd6ca('0xf'))(new Redis(config[_0xd6ca('0xc')]));require(_0xd6ca('0x10'))[_0xd6ca('0x11')](socket);function respondWithStatusCode(_0x3e7eff,_0xe726f9){_0xe726f9=_0xe726f9||0xcc;return function(_0xce614e){if(_0xce614e){return _0x3e7eff[_0xd6ca('0x12')](_0xe726f9);}return _0x3e7eff[_0xd6ca('0x13')](_0xe726f9)['end']();};}function respondWithResult(_0x49a76b,_0x1d7cab){_0x1d7cab=_0x1d7cab||0xc8;return function(_0xdadf3e){if(_0xdadf3e){return _0x49a76b[_0xd6ca('0x13')](_0x1d7cab)['json'](_0xdadf3e);}};}function respondWithFilteredResult(_0x3187a4,_0x47a210){return function(_0x283d5e){if(_0x283d5e){var _0x5284f9=typeof _0x47a210[_0xd6ca('0x14')]===_0xd6ca('0x15')&&typeof _0x47a210[_0xd6ca('0x16')]===_0xd6ca('0x15');var _0x499daf=_0x283d5e[_0xd6ca('0x17')];var _0x48121a=_0x5284f9?0x0:_0x47a210[_0xd6ca('0x14')];var _0x44adfd=_0x5284f9?_0x283d5e['count']:_0x47a210[_0xd6ca('0x14')]+_0x47a210[_0xd6ca('0x16')];var _0x443639;if(_0x44adfd>=_0x499daf){_0x44adfd=_0x499daf;_0x443639=0xc8;}else{_0x443639=0xce;}_0x3187a4[_0xd6ca('0x13')](_0x443639);return _0x3187a4['set'](_0xd6ca('0x18'),_0x48121a+'-'+_0x44adfd+'/'+_0x499daf)[_0xd6ca('0x19')](_0x283d5e);}return null;};}function saveUpdates(_0x11a8ce){return function(_0x112c8e){if(_0x112c8e){return _0x112c8e[_0xd6ca('0x1a')](_0x11a8ce)[_0xd6ca('0x1b')](function(_0x4061bb){return _0x4061bb;});}return null;};}function removeEntity(_0x39ca41){return function(_0x2233e8){if(_0x2233e8){return _0x2233e8[_0xd6ca('0x1c')]()['then'](function(){_0x39ca41[_0xd6ca('0x13')](0xcc)[_0xd6ca('0x1d')]();});}};}function handleEntityNotFound(_0x1016aa){return function(_0x2b01ad){if(!_0x2b01ad){_0x1016aa[_0xd6ca('0x12')](0x194);}return _0x2b01ad;};}function handleError(_0x53b509,_0x34af80){_0x34af80=_0x34af80||0x1f4;return function(_0x3569f1){logger[_0xd6ca('0x1e')](_0x3569f1[_0xd6ca('0x1f')]);if(_0x3569f1[_0xd6ca('0x20')]){delete _0x3569f1[_0xd6ca('0x20')];}_0x53b509[_0xd6ca('0x13')](_0x34af80)[_0xd6ca('0x21')](_0x3569f1);};}exports[_0xd6ca('0x22')]=function(_0x44a58f,_0x572ed6){var _0x4f8948={};var _0x386213=_[_0xd6ca('0x23')](db[_0xd6ca('0x24')][_0xd6ca('0x25')],function(_0x5e9be4){return{'name':_0x5e9be4[_0xd6ca('0x26')],'type':_0x5e9be4[_0xd6ca('0x27')][_0xd6ca('0x28')]};});_0x4f8948=qs[_0xd6ca('0x29')](_0x386213,_0x44a58f);return interaction[_0xd6ca('0x2a')](_0xd6ca('0x2b'),_0x44a58f['query'],_0x44a58f[_0xd6ca('0x2c')],_0x4f8948,_0x386213)[_0xd6ca('0x1b')](respondWithFilteredResult(_0x572ed6,_0x4f8948))['catch'](handleError(_0x572ed6,null));};exports[_0xd6ca('0x2d')]=function(_0x25f6a7,_0x17e3ea){var _0x1e2656={'raw':![],'where':{'id':_0x25f6a7[_0xd6ca('0x2e')]['id']}},_0x9ddd65={};_0x9ddd65['model']=_[_0xd6ca('0x2f')](db[_0xd6ca('0x24')][_0xd6ca('0x25')]);_0x9ddd65[_0xd6ca('0x30')]=_[_0xd6ca('0x2f')](_0x25f6a7['query']);_0x9ddd65['filters']=_[_0xd6ca('0x31')](_0x9ddd65['model'],_0x9ddd65['query']);_0x1e2656['attributes']=_[_0xd6ca('0x31')](_0x9ddd65['model'],qs['fields'](_0x25f6a7['query']['fields']));_0x1e2656['attributes']=_0x1e2656['attributes']['length']?_0x1e2656[_0xd6ca('0x32')]:_0x9ddd65[_0xd6ca('0x33')];if(_0x25f6a7['query'][_0xd6ca('0x34')]){_0x1e2656[_0xd6ca('0x35')]=[{'all':!![]}];}_0x1e2656=_[_0xd6ca('0x36')]({},_0x1e2656,_0x25f6a7['options']);return db[_0xd6ca('0x24')]['find'](_0x1e2656)[_0xd6ca('0x1b')](handleEntityNotFound(_0x17e3ea,null))[_0xd6ca('0x1b')](respondWithResult(_0x17e3ea,null))['catch'](handleError(_0x17e3ea,null));};exports[_0xd6ca('0x37')]=function(_0x54066b,_0x120b12){return db[_0xd6ca('0x24')][_0xd6ca('0x37')](_0x54066b[_0xd6ca('0x38')],{})[_0xd6ca('0x1b')](respondWithResult(_0x120b12,0xc9))[_0xd6ca('0x39')](handleError(_0x120b12,null));};exports[_0xd6ca('0x1a')]=function(_0x14ae9d,_0x53cb5a){if(_0x14ae9d[_0xd6ca('0x38')]['id']){delete _0x14ae9d[_0xd6ca('0x38')]['id'];}return db[_0xd6ca('0x24')][_0xd6ca('0x3a')]({'where':{'id':_0x14ae9d[_0xd6ca('0x2e')]['id']}})[_0xd6ca('0x1b')](handleEntityNotFound(_0x53cb5a,null))['then'](saveUpdates(_0x14ae9d[_0xd6ca('0x38')],null))[_0xd6ca('0x1b')](respondWithResult(_0x53cb5a,null))[_0xd6ca('0x39')](handleError(_0x53cb5a,null));};exports[_0xd6ca('0x1c')]=function(_0x2aa68c,_0x2594bf){return db[_0xd6ca('0x24')][_0xd6ca('0x3a')]({'where':{'id':_0x2aa68c['params']['id']}})[_0xd6ca('0x1b')](handleEntityNotFound(_0x2594bf,null))[_0xd6ca('0x1b')](removeEntity(_0x2594bf,null))['catch'](handleError(_0x2594bf,null));};exports[_0xd6ca('0x3b')]=function(_0x3e59ba,_0x30d041){return db[_0xd6ca('0x24')][_0xd6ca('0x3b')]()[_0xd6ca('0x1b')](respondWithResult(_0x30d041,null))['catch'](handleError(_0x30d041,null));};exports[_0xd6ca('0x3c')]=function(_0x2c276b,_0xb3ad6e){return db[_0xd6ca('0x3d')][_0xd6ca('0x3a')]({'where':{'id':_0x2c276b[_0xd6ca('0x2e')]['id']}})[_0xd6ca('0x1b')](handleEntityNotFound(_0xb3ad6e,null))[_0xd6ca('0x1b')](function(_0x398c02){if(_0x398c02){return _0x398c02[_0xd6ca('0x3c')](_0x2c276b['body'][_0xd6ca('0x3e')],_[_0xd6ca('0x3f')](_0x2c276b[_0xd6ca('0x38')],[_0xd6ca('0x3e'),'id'])||{});}})[_0xd6ca('0x1b')](respondWithResult(_0xb3ad6e,null))[_0xd6ca('0x39')](handleError(_0xb3ad6e,null));};exports[_0xd6ca('0x40')]=function(_0x3b24f2,_0x550430){var _0x1cdb9d={'raw':![],'where':{}};var _0x71ec8c={};var _0x5043e7={'count':0x0,'rows':[]};return db[_0xd6ca('0x24')][_0xd6ca('0x41')]({'where':{'id':_0x3b24f2[_0xd6ca('0x2e')]['id']}})[_0xd6ca('0x1b')](handleEntityNotFound(_0x550430,null))['then'](function(_0x3d5e9d){if(_0x3d5e9d){_0x71ec8c[_0xd6ca('0x33')]=_['keys'](db[_0xd6ca('0x3d')][_0xd6ca('0x25')]);_0x71ec8c['query']=_['keys'](_0x3b24f2[_0xd6ca('0x30')]);_0x71ec8c[_0xd6ca('0x42')]=_[_0xd6ca('0x31')](_0x71ec8c[_0xd6ca('0x33')],_0x71ec8c[_0xd6ca('0x30')]);_0x1cdb9d[_0xd6ca('0x32')]=_[_0xd6ca('0x31')](_0x71ec8c[_0xd6ca('0x33')],qs['fields'](_0x3b24f2[_0xd6ca('0x30')][_0xd6ca('0x43')]));_0x1cdb9d[_0xd6ca('0x32')]=_0x1cdb9d[_0xd6ca('0x32')]['length']?_0x1cdb9d[_0xd6ca('0x32')]:_0x71ec8c[_0xd6ca('0x33')];if(!_0x3b24f2[_0xd6ca('0x30')]['hasOwnProperty']('nolimit')){_0x1cdb9d[_0xd6ca('0x16')]=qs[_0xd6ca('0x16')](_0x3b24f2[_0xd6ca('0x30')][_0xd6ca('0x16')]);_0x1cdb9d[_0xd6ca('0x14')]=qs[_0xd6ca('0x14')](_0x3b24f2['query'][_0xd6ca('0x14')]);}_0x1cdb9d['order']=qs[_0xd6ca('0x44')](_0x3b24f2[_0xd6ca('0x30')][_0xd6ca('0x44')]);_0x1cdb9d[_0xd6ca('0x45')]=qs['filters'](_[_0xd6ca('0x46')](_0x3b24f2['query'],_0x71ec8c[_0xd6ca('0x42')]));_0x1cdb9d[_0xd6ca('0x45')]['SmsInteractionId']=_0x3d5e9d['id'];if(_0x3b24f2[_0xd6ca('0x30')][_0xd6ca('0x47')]){_0x1cdb9d[_0xd6ca('0x45')]=_['merge'](_0x1cdb9d[_0xd6ca('0x45')],{'$or':_[_0xd6ca('0x23')](_0x1cdb9d[_0xd6ca('0x32')],function(_0x3c991b){var _0x4d7c2c={};_0x4d7c2c[_0x3c991b]={'$like':'%'+_0x3b24f2[_0xd6ca('0x30')]['filter']+'%'};return _0x4d7c2c;})});}if(_0x3b24f2[_0xd6ca('0x30')]['$gte']){var _0x21652f=_0x3b24f2[_0xd6ca('0x30')][_0xd6ca('0x48')][_0xd6ca('0x49')](',');var _0x54d130={};_0x54d130[_0x21652f[0x0]]={'$gte':moment(_0x21652f[0x1])[_0xd6ca('0x4a')](_0xd6ca('0x4b'))};_0x1cdb9d['where']=_['merge'](_0x1cdb9d[_0xd6ca('0x45')],_0x54d130);}_0x1cdb9d=_[_0xd6ca('0x36')]({},_0x1cdb9d,_0x3b24f2[_0xd6ca('0x4c')]);return db['SmsMessage'][_0xd6ca('0x17')]({'where':_0x1cdb9d[_0xd6ca('0x45')]})[_0xd6ca('0x1b')](function(_0x30007f){_0x5043e7[_0xd6ca('0x17')]=_0x30007f;if(_0x3b24f2[_0xd6ca('0x30')][_0xd6ca('0x34')]){_0x1cdb9d['include']=[{'all':!![]}];}return db['SmsMessage'][_0xd6ca('0x2a')](_0x1cdb9d);})['then'](function(_0x4152c5){_0x5043e7[_0xd6ca('0x4d')]=_0x4152c5;return _0x5043e7;});}})[_0xd6ca('0x1b')](respondWithFilteredResult(_0x550430,_0x1cdb9d))[_0xd6ca('0x39')](handleError(_0x550430,null));};exports[_0xd6ca('0x4e')]=function(_0x100fc3,_0x4a4a7d){return db[_0xd6ca('0x24')][_0xd6ca('0x3a')]({'where':{'id':_0x100fc3[_0xd6ca('0x2e')]['id']}})[_0xd6ca('0x1b')](handleEntityNotFound(_0x4a4a7d,null))[_0xd6ca('0x1b')](function(_0xf7fa2e){if(_0xf7fa2e){return _0xf7fa2e[_0xd6ca('0x4f')](_0x100fc3[_0xd6ca('0x38')][_0xd6ca('0x3e')],_['omit'](_0x100fc3[_0xd6ca('0x38')],[_0xd6ca('0x3e'),'id'])||{})[_0xd6ca('0x50')](function(){return db[_0xd6ca('0x51')][_0xd6ca('0x2a')]({'attributes':['id',_0xd6ca('0x20'),_0xd6ca('0x52')],'where':{'id':_0x100fc3[_0xd6ca('0x38')][_0xd6ca('0x3e')]}});})[_0xd6ca('0x1b')](function(_0x375b99){socket[_0xd6ca('0x53')](_0xd6ca('0x54'),{'id':Number(_0x100fc3[_0xd6ca('0x2e')]['id']),'tags':_0x375b99||[]});return{'id':Number(_0x100fc3[_0xd6ca('0x2e')]['id']),'tags':_0x375b99||[]};});}})[_0xd6ca('0x1b')](respondWithResult(_0x4a4a7d,null))[_0xd6ca('0x39')](handleError(_0x4a4a7d,null));};exports[_0xd6ca('0x55')]=function(_0x1d7a93,_0x57779a){return db['SmsInteraction'][_0xd6ca('0x3a')]({'where':{'id':_0x1d7a93[_0xd6ca('0x2e')]['id']}})['then'](handleEntityNotFound(_0x57779a,null))['then'](function(_0x335f9f){if(_0x335f9f){return _0x335f9f[_0xd6ca('0x55')](_0x1d7a93['query']['ids']);}})[_0xd6ca('0x1b')](respondWithStatusCode(_0x57779a,null))[_0xd6ca('0x39')](handleError(_0x57779a,null));};exports[_0xd6ca('0x56')]=function(_0x51342f,_0x2d1a50){var _0x798285=moment()['unix']()['toString']();var _0x457843=path[_0xd6ca('0x57')](config[_0xd6ca('0x58')],_0xd6ca('0x59'),_0xd6ca('0x5a'),_0xd6ca('0x5b'));var _0x522bb5=path[_0xd6ca('0x57')](_0x457843,_0x798285);var _0x37528c=util['format'](_0xd6ca('0x5c'),_0x51342f['params']['id'],_0x798285);var _0x165f4d=path['join'](_0x457843,_0x37528c);var _0x300e45=[];_0x300e45['push']({'model':db[_0xd6ca('0x5d')],'as':_0xd6ca('0x5d'),'attributes':['id',_0xd6ca('0x5e')],'raw':!![]});_0x300e45['push']({'model':db[_0xd6ca('0x5f')],'as':_0xd6ca('0x60'),'attributes':['id',_0xd6ca('0x61'),_0xd6ca('0x62')],'raw':!![]});var _0xa01724=[{'model':db[_0xd6ca('0x3d')],'as':_0xd6ca('0x63'),'attributes':['id',_0xd6ca('0x38'),_0xd6ca('0x64'),_0xd6ca('0x65'),_0xd6ca('0x66'),'read'],'include':_0x300e45}];_0xa01724['push']({'model':db['SmsAccount'],'as':_0xd6ca('0x67'),'attributes':['id',_0xd6ca('0x20')]});_0xa01724['push']({'model':db['User'],'as':_0xd6ca('0x68'),'attributes':['id',_0xd6ca('0x5e')]});return db[_0xd6ca('0x24')][_0xd6ca('0x3a')]({'where':{'id':_0x51342f[_0xd6ca('0x2e')]['id']},'include':_0xa01724})['then'](handleEntityNotFound(_0x2d1a50,null))[_0xd6ca('0x1b')](function(_0x278226){if(_0x278226){var _0x4a7e65=_0x278226[_0xd6ca('0x69')]({'plain':!![]});fs[_0xd6ca('0x6a')](_0x522bb5);var _0x92570f={'channel':_0xd6ca('0x6b'),'account':_0x4a7e65[_0xd6ca('0x67')][_0xd6ca('0x20')],'agent':_0x4a7e65[_0xd6ca('0x68')]?_0x4a7e65[_0xd6ca('0x68')][_0xd6ca('0x5e')]:_0xd6ca('0x6c'),'createdAt':moment(_0x4a7e65[_0xd6ca('0x64')])[_0xd6ca('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd6ca('0x6d')](),'closedAt':_0x4a7e65[_0xd6ca('0x6e')]?moment(_0x4a7e65[_0xd6ca('0x6f')])[_0xd6ca('0x4a')](_0xd6ca('0x4b'))['toString']():'','disposition':_0x4a7e65[_0xd6ca('0x70')],'messages':_(_0x4a7e65['Messages'])['filter']({'secret':![]})[_0xd6ca('0x23')](function(_0x528fd4){return{'date':moment(_0x528fd4[_0xd6ca('0x64')])[_0xd6ca('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x528fd4[_0xd6ca('0x65')]===_0xd6ca('0x71')?_0x528fd4[_0xd6ca('0x5d')]?_0x528fd4[_0xd6ca('0x5d')][_0xd6ca('0x5e')]:_0xd6ca('0x72'):_0x528fd4['Contact'][_0xd6ca('0x61')]+(_0x528fd4[_0xd6ca('0x60')]['lastName']?'\x20'+_0x528fd4[_0xd6ca('0x60')]['lastName']:''),'body':_0x528fd4['body'],'direction':_0x528fd4[_0xd6ca('0x65')]===_0xd6ca('0x71')?'A':'C','secret':_0x528fd4[_0xd6ca('0x66')],'read':_0x528fd4['read']};})['value']()};return ejs[_0xd6ca('0x73')](path['join'](config[_0xd6ca('0x58')],'server',_0xd6ca('0x74'),_0xd6ca('0x75')),{'interaction':_0x92570f})[_0xd6ca('0x1b')](function(_0x46821d){var _0x5adb37=path[_0xd6ca('0x57')](_0x522bb5,_0xd6ca('0x76')+_0x4a7e65['id']+'-'+_0x798285+_0xd6ca('0x77'));var _0x97b19c={'path':_0x5adb37,'channel':_0xd6ca('0x6b'),'interactionId':_0x4a7e65['id']};return pdf[_0xd6ca('0x78')](_0x46821d,_0x97b19c);})[_0xd6ca('0x1b')](function(){return new BPromise(function(_0xd1825b,_0x520c54){zipdir(_0x522bb5,{'saveTo':_0x165f4d},function(_0x4c834a,_0x2d7c60){if(_0x4c834a)return _0x520c54(_0x4c834a);return _0xd1825b(_0x2d7c60);});})[_0xd6ca('0x1b')](function(){return new BPromise(function(_0x5d57fa,_0x2c163b){rimraf(_0x522bb5,function(_0x4abe05){if(_0x4abe05)_0x2c163b(_0x4abe05);return _0x5d57fa();});});})[_0xd6ca('0x1b')](function(){return _0x2d1a50[_0xd6ca('0x56')](_0x165f4d,_0x37528c,function(_0x5357db){if(_0x5357db){console[_0xd6ca('0x79')](_0xd6ca('0x7a'),_0x5357db);}else{fs[_0xd6ca('0x7b')](_0x165f4d);}});});});}else{return _0x2d1a50[_0xd6ca('0x12')](0xc8);}})[_0xd6ca('0x39')](handleError(_0x2d1a50,null));}; \ No newline at end of file +var _0xc7d3=['SmsAccount','Account','fullname','Sms','Owner','N.A.','closed','closedAt','direction','out','System','value','renderFile','server','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','localhost','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','then','error','stack','name','send','index','map','fieldName','key','getOptions','findAll','query','user','catch','show','params','model','keys','SmsInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','update','describe','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','toString','root','files','tmp','join','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','read'];(function(_0x5bed28,_0x3069b3){var _0x44fe9f=function(_0x5c934e){while(--_0x5c934e){_0x5bed28['push'](_0x5bed28['shift']());}};_0x44fe9f(++_0x3069b3);}(_0xc7d3,0x8f));var _0x3c7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7d3[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x3c7d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x3c7d('0x1'));var BPromise=require(_0x3c7d('0x2'));var util=require(_0x3c7d('0x3'));var path=require(_0x3c7d('0x4'));var ejs=require(_0x3c7d('0x5'));var fs=require('fs');var _=require(_0x3c7d('0x6'));var Redis=require(_0x3c7d('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x3c7d('0x8'));var pdf=require(_0x3c7d('0x9'));var logger=require(_0x3c7d('0xa'))(_0x3c7d('0xb'));var config=require(_0x3c7d('0xc'));var db=require('../../mysqldb')['db'];config[_0x3c7d('0xd')]=_['defaults'](config[_0x3c7d('0xd')],{'host':_0x3c7d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c7d('0xd')]));require(_0x3c7d('0xf'))[_0x3c7d('0x10')](socket);function respondWithStatusCode(_0x431bb0,_0x29022c){_0x29022c=_0x29022c||0xcc;return function(_0x46d4fa){if(_0x46d4fa){return _0x431bb0[_0x3c7d('0x11')](_0x29022c);}return _0x431bb0[_0x3c7d('0x12')](_0x29022c)[_0x3c7d('0x13')]();};}function respondWithResult(_0x5c63f4,_0x4d4a1a){_0x4d4a1a=_0x4d4a1a||0xc8;return function(_0x253cb1){if(_0x253cb1){return _0x5c63f4[_0x3c7d('0x12')](_0x4d4a1a)['json'](_0x253cb1);}};}function respondWithFilteredResult(_0x92cc0e,_0x5d52ff){return function(_0x145be7){if(_0x145be7){var _0x378fd7=typeof _0x5d52ff[_0x3c7d('0x14')]===_0x3c7d('0x15')&&typeof _0x5d52ff[_0x3c7d('0x16')]===_0x3c7d('0x15');var _0x48c4d2=_0x145be7['count'];var _0xeb9b7f=_0x378fd7?0x0:_0x5d52ff[_0x3c7d('0x14')];var _0x2b0d57=_0x378fd7?_0x145be7[_0x3c7d('0x17')]:_0x5d52ff[_0x3c7d('0x14')]+_0x5d52ff[_0x3c7d('0x16')];var _0x1b2d62;if(_0x2b0d57>=_0x48c4d2){_0x2b0d57=_0x48c4d2;_0x1b2d62=0xc8;}else{_0x1b2d62=0xce;}_0x92cc0e[_0x3c7d('0x12')](_0x1b2d62);return _0x92cc0e[_0x3c7d('0x18')](_0x3c7d('0x19'),_0xeb9b7f+'-'+_0x2b0d57+'/'+_0x48c4d2)[_0x3c7d('0x1a')](_0x145be7);}return null;};}function saveUpdates(_0xd618b){return function(_0x5032c0){if(_0x5032c0){return _0x5032c0['update'](_0xd618b)['then'](function(_0x1666ed){return _0x1666ed;});}return null;};}function removeEntity(_0x193fa7){return function(_0x4c6208){if(_0x4c6208){return _0x4c6208[_0x3c7d('0x1b')]()[_0x3c7d('0x1c')](function(){_0x193fa7['status'](0xcc)[_0x3c7d('0x13')]();});}};}function handleEntityNotFound(_0x45a06a){return function(_0xb29940){if(!_0xb29940){_0x45a06a[_0x3c7d('0x11')](0x194);}return _0xb29940;};}function handleError(_0x323017,_0x389633){_0x389633=_0x389633||0x1f4;return function(_0x3e3ea0){logger[_0x3c7d('0x1d')](_0x3e3ea0[_0x3c7d('0x1e')]);if(_0x3e3ea0[_0x3c7d('0x1f')]){delete _0x3e3ea0[_0x3c7d('0x1f')];}_0x323017['status'](_0x389633)[_0x3c7d('0x20')](_0x3e3ea0);};}exports[_0x3c7d('0x21')]=function(_0x2468a0,_0x1d8878){var _0x49acce={};var _0x3236b9=_[_0x3c7d('0x22')](db['SmsInteraction']['rawAttributes'],function(_0x98aa45){return{'name':_0x98aa45[_0x3c7d('0x23')],'type':_0x98aa45['type'][_0x3c7d('0x24')]};});_0x49acce=qs[_0x3c7d('0x25')](_0x3236b9,_0x2468a0);return interaction[_0x3c7d('0x26')]('sms',_0x2468a0[_0x3c7d('0x27')],_0x2468a0[_0x3c7d('0x28')],_0x49acce,_0x3236b9)[_0x3c7d('0x1c')](respondWithFilteredResult(_0x1d8878,_0x49acce))[_0x3c7d('0x29')](handleError(_0x1d8878,null));};exports[_0x3c7d('0x2a')]=function(_0x2e1e9f,_0x37e6f9){var _0x48b691={'raw':![],'where':{'id':_0x2e1e9f[_0x3c7d('0x2b')]['id']}},_0x3c30ef={};_0x3c30ef[_0x3c7d('0x2c')]=_[_0x3c7d('0x2d')](db[_0x3c7d('0x2e')]['rawAttributes']);_0x3c30ef[_0x3c7d('0x27')]=_[_0x3c7d('0x2d')](_0x2e1e9f[_0x3c7d('0x27')]);_0x3c30ef[_0x3c7d('0x2f')]=_[_0x3c7d('0x30')](_0x3c30ef[_0x3c7d('0x2c')],_0x3c30ef[_0x3c7d('0x27')]);_0x48b691[_0x3c7d('0x31')]=_[_0x3c7d('0x30')](_0x3c30ef['model'],qs[_0x3c7d('0x32')](_0x2e1e9f['query']['fields']));_0x48b691['attributes']=_0x48b691['attributes'][_0x3c7d('0x33')]?_0x48b691[_0x3c7d('0x31')]:_0x3c30ef[_0x3c7d('0x2c')];if(_0x2e1e9f[_0x3c7d('0x27')][_0x3c7d('0x34')]){_0x48b691[_0x3c7d('0x35')]=[{'all':!![]}];}_0x48b691=_[_0x3c7d('0x36')]({},_0x48b691,_0x2e1e9f[_0x3c7d('0x37')]);return db[_0x3c7d('0x2e')][_0x3c7d('0x38')](_0x48b691)[_0x3c7d('0x1c')](handleEntityNotFound(_0x37e6f9,null))[_0x3c7d('0x1c')](respondWithResult(_0x37e6f9,null))[_0x3c7d('0x29')](handleError(_0x37e6f9,null));};exports[_0x3c7d('0x39')]=function(_0x295ca0,_0x4a578a){return db[_0x3c7d('0x2e')][_0x3c7d('0x39')](_0x295ca0[_0x3c7d('0x3a')],{})[_0x3c7d('0x1c')](respondWithResult(_0x4a578a,0xc9))[_0x3c7d('0x29')](handleError(_0x4a578a,null));};exports[_0x3c7d('0x3b')]=function(_0x204fa8,_0x3785de){if(_0x204fa8[_0x3c7d('0x3a')]['id']){delete _0x204fa8[_0x3c7d('0x3a')]['id'];}return db[_0x3c7d('0x2e')][_0x3c7d('0x38')]({'where':{'id':_0x204fa8[_0x3c7d('0x2b')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x3785de,null))[_0x3c7d('0x1c')](saveUpdates(_0x204fa8[_0x3c7d('0x3a')],null))[_0x3c7d('0x1c')](respondWithResult(_0x3785de,null))[_0x3c7d('0x29')](handleError(_0x3785de,null));};exports[_0x3c7d('0x1b')]=function(_0xced95f,_0xf963a8){return db[_0x3c7d('0x2e')][_0x3c7d('0x38')]({'where':{'id':_0xced95f[_0x3c7d('0x2b')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0xf963a8,null))[_0x3c7d('0x1c')](removeEntity(_0xf963a8,null))[_0x3c7d('0x29')](handleError(_0xf963a8,null));};exports[_0x3c7d('0x3c')]=function(_0x50f7ae,_0x165bc8){return db[_0x3c7d('0x2e')][_0x3c7d('0x3c')]()['then'](respondWithResult(_0x165bc8,null))['catch'](handleError(_0x165bc8,null));};exports['addMessage']=function(_0x570660,_0x5d3c36){return db['SmsMessage'][_0x3c7d('0x38')]({'where':{'id':_0x570660[_0x3c7d('0x2b')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x5d3c36,null))[_0x3c7d('0x1c')](function(_0x30739f){if(_0x30739f){return _0x30739f['addMessage'](_0x570660['body'][_0x3c7d('0x3d')],_[_0x3c7d('0x3e')](_0x570660['body'],['ids','id'])||{});}})[_0x3c7d('0x1c')](respondWithResult(_0x5d3c36,null))[_0x3c7d('0x29')](handleError(_0x5d3c36,null));};exports[_0x3c7d('0x3f')]=function(_0x4db688,_0x4ce7f5){var _0xfe3657={'raw':![],'where':{}};var _0x6a4025={};var _0x5886bc={'count':0x0,'rows':[]};return db[_0x3c7d('0x2e')][_0x3c7d('0x40')]({'where':{'id':_0x4db688[_0x3c7d('0x2b')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x4ce7f5,null))['then'](function(_0x4c5b01){if(_0x4c5b01){_0x6a4025['model']=_[_0x3c7d('0x2d')](db[_0x3c7d('0x41')]['rawAttributes']);_0x6a4025[_0x3c7d('0x27')]=_[_0x3c7d('0x2d')](_0x4db688[_0x3c7d('0x27')]);_0x6a4025[_0x3c7d('0x2f')]=_[_0x3c7d('0x30')](_0x6a4025[_0x3c7d('0x2c')],_0x6a4025['query']);_0xfe3657[_0x3c7d('0x31')]=_['intersection'](_0x6a4025['model'],qs[_0x3c7d('0x32')](_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x32')]));_0xfe3657[_0x3c7d('0x31')]=_0xfe3657[_0x3c7d('0x31')][_0x3c7d('0x33')]?_0xfe3657[_0x3c7d('0x31')]:_0x6a4025[_0x3c7d('0x2c')];if(!_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x42')]('nolimit')){_0xfe3657[_0x3c7d('0x16')]=qs[_0x3c7d('0x16')](_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x16')]);_0xfe3657['offset']=qs[_0x3c7d('0x14')](_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x14')]);}_0xfe3657[_0x3c7d('0x43')]=qs[_0x3c7d('0x44')](_0x4db688['query']['sort']);_0xfe3657[_0x3c7d('0x45')]=qs[_0x3c7d('0x2f')](_[_0x3c7d('0x46')](_0x4db688[_0x3c7d('0x27')],_0x6a4025[_0x3c7d('0x2f')]));_0xfe3657[_0x3c7d('0x45')][_0x3c7d('0x47')]=_0x4c5b01['id'];if(_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x48')]){_0xfe3657[_0x3c7d('0x45')]=_[_0x3c7d('0x36')](_0xfe3657[_0x3c7d('0x45')],{'$or':_['map'](_0xfe3657[_0x3c7d('0x31')],function(_0x4c2e64){var _0x4270d2={};_0x4270d2[_0x4c2e64]={'$like':'%'+_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x48')]+'%'};return _0x4270d2;})});}if(_0x4db688['query']['$gte']){var _0x102cdc=_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x49')][_0x3c7d('0x4a')](',');var _0x406a1c={};_0x406a1c[_0x102cdc[0x0]]={'$gte':moment(_0x102cdc[0x1])[_0x3c7d('0x4b')](_0x3c7d('0x4c'))};_0xfe3657[_0x3c7d('0x45')]=_['merge'](_0xfe3657['where'],_0x406a1c);}_0xfe3657=_[_0x3c7d('0x36')]({},_0xfe3657,_0x4db688[_0x3c7d('0x37')]);return db[_0x3c7d('0x41')][_0x3c7d('0x17')]({'where':_0xfe3657[_0x3c7d('0x45')]})[_0x3c7d('0x1c')](function(_0x1cc82f){_0x5886bc[_0x3c7d('0x17')]=_0x1cc82f;if(_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x34')]){_0xfe3657['include']=[{'all':!![]}];}return db[_0x3c7d('0x41')]['findAll'](_0xfe3657);})[_0x3c7d('0x1c')](function(_0x15b3ab){_0x5886bc['rows']=_0x15b3ab;return _0x5886bc;});}})[_0x3c7d('0x1c')](respondWithFilteredResult(_0x4ce7f5,_0xfe3657))[_0x3c7d('0x29')](handleError(_0x4ce7f5,null));};exports[_0x3c7d('0x4d')]=function(_0x3b5062,_0x21d9ef){return db[_0x3c7d('0x2e')]['find']({'where':{'id':_0x3b5062[_0x3c7d('0x2b')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x21d9ef,null))[_0x3c7d('0x1c')](function(_0xcc0c02){if(_0xcc0c02){return _0xcc0c02[_0x3c7d('0x4e')](_0x3b5062[_0x3c7d('0x3a')][_0x3c7d('0x3d')],_[_0x3c7d('0x3e')](_0x3b5062[_0x3c7d('0x3a')],['ids','id'])||{})[_0x3c7d('0x4f')](function(){return db[_0x3c7d('0x50')][_0x3c7d('0x26')]({'attributes':['id',_0x3c7d('0x1f'),'color'],'where':{'id':_0x3b5062[_0x3c7d('0x3a')]['ids']}});})['then'](function(_0x56240a){socket[_0x3c7d('0x51')](_0x3c7d('0x52'),{'id':Number(_0x3b5062[_0x3c7d('0x2b')]['id']),'tags':_0x56240a||[]});return{'id':Number(_0x3b5062[_0x3c7d('0x2b')]['id']),'tags':_0x56240a||[]};});}})[_0x3c7d('0x1c')](respondWithResult(_0x21d9ef,null))[_0x3c7d('0x29')](handleError(_0x21d9ef,null));};exports[_0x3c7d('0x53')]=function(_0x56ef60,_0x3c8df0){return db[_0x3c7d('0x2e')][_0x3c7d('0x38')]({'where':{'id':_0x56ef60[_0x3c7d('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3c8df0,null))[_0x3c7d('0x1c')](function(_0x374380){if(_0x374380){return _0x374380[_0x3c7d('0x53')](_0x56ef60[_0x3c7d('0x27')][_0x3c7d('0x3d')]);}})[_0x3c7d('0x1c')](respondWithStatusCode(_0x3c8df0,null))[_0x3c7d('0x29')](handleError(_0x3c8df0,null));};exports[_0x3c7d('0x54')]=function(_0x5ac1cb,_0x3e3ae3){var _0x84aa90=moment()['unix']()[_0x3c7d('0x55')]();var _0x4987ea=path['join'](config[_0x3c7d('0x56')],'server',_0x3c7d('0x57'),_0x3c7d('0x58'));var _0x1c6f1f=path[_0x3c7d('0x59')](_0x4987ea,_0x84aa90);var _0x1dd9f8=util['format'](_0x3c7d('0x5a'),_0x5ac1cb[_0x3c7d('0x2b')]['id'],_0x84aa90);var _0x48ad25=path[_0x3c7d('0x59')](_0x4987ea,_0x1dd9f8);var _0xaa5d47=[];_0xaa5d47[_0x3c7d('0x5b')]({'model':db[_0x3c7d('0x5c')],'as':_0x3c7d('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0xaa5d47[_0x3c7d('0x5b')]({'model':db[_0x3c7d('0x5d')],'as':_0x3c7d('0x5e'),'attributes':['id',_0x3c7d('0x5f'),_0x3c7d('0x60')],'raw':!![]});var _0x4c8e82=[{'model':db[_0x3c7d('0x41')],'as':_0x3c7d('0x61'),'attributes':['id',_0x3c7d('0x3a'),_0x3c7d('0x62'),'direction',_0x3c7d('0x63'),_0x3c7d('0x64')],'include':_0xaa5d47}];_0x4c8e82[_0x3c7d('0x5b')]({'model':db[_0x3c7d('0x65')],'as':_0x3c7d('0x66'),'attributes':['id','name']});_0x4c8e82[_0x3c7d('0x5b')]({'model':db[_0x3c7d('0x5c')],'as':'Owner','attributes':['id',_0x3c7d('0x67')]});return db[_0x3c7d('0x2e')][_0x3c7d('0x38')]({'where':{'id':_0x5ac1cb['params']['id']},'include':_0x4c8e82})['then'](handleEntityNotFound(_0x3e3ae3,null))[_0x3c7d('0x1c')](function(_0x1208cc){if(_0x1208cc){var _0x9df427=_0x1208cc['get']({'plain':!![]});fs['mkdirSync'](_0x1c6f1f);var _0x44eaa4={'channel':_0x3c7d('0x68'),'account':_0x9df427['Account'][_0x3c7d('0x1f')],'agent':_0x9df427[_0x3c7d('0x69')]?_0x9df427['Owner'][_0x3c7d('0x67')]:_0x3c7d('0x6a'),'createdAt':moment(_0x9df427[_0x3c7d('0x62')])[_0x3c7d('0x4b')](_0x3c7d('0x4c'))['toString'](),'closedAt':_0x9df427[_0x3c7d('0x6b')]?moment(_0x9df427[_0x3c7d('0x6c')])['format'](_0x3c7d('0x4c'))[_0x3c7d('0x55')]():'','disposition':_0x9df427['disposition'],'messages':_(_0x9df427[_0x3c7d('0x61')])[_0x3c7d('0x48')]({'secret':![]})[_0x3c7d('0x22')](function(_0x204967){return{'date':moment(_0x204967[_0x3c7d('0x62')])[_0x3c7d('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x204967[_0x3c7d('0x6d')]===_0x3c7d('0x6e')?_0x204967['User']?_0x204967[_0x3c7d('0x5c')][_0x3c7d('0x67')]:_0x3c7d('0x6f'):_0x204967[_0x3c7d('0x5e')]['firstName']+(_0x204967[_0x3c7d('0x5e')][_0x3c7d('0x60')]?'\x20'+_0x204967[_0x3c7d('0x5e')][_0x3c7d('0x60')]:''),'body':_0x204967[_0x3c7d('0x3a')],'direction':_0x204967[_0x3c7d('0x6d')]===_0x3c7d('0x6e')?'A':'C','secret':_0x204967[_0x3c7d('0x63')],'read':_0x204967[_0x3c7d('0x64')]};})[_0x3c7d('0x70')]()};return ejs[_0x3c7d('0x71')](path[_0x3c7d('0x59')](config[_0x3c7d('0x56')],_0x3c7d('0x72'),_0x3c7d('0x73'),'downloadInteraction.ejs'),{'interaction':_0x44eaa4})['then'](function(_0x32b77a){var _0x25e9a3=path[_0x3c7d('0x59')](_0x1c6f1f,_0x3c7d('0x74')+_0x9df427['id']+'-'+_0x84aa90+_0x3c7d('0x75'));var _0x485618={'path':_0x25e9a3,'channel':_0x3c7d('0x68'),'interactionId':_0x9df427['id']};return pdf[_0x3c7d('0x76')](_0x32b77a,_0x485618);})[_0x3c7d('0x1c')](function(){return new BPromise(function(_0x44c986,_0x39d890){zipdir(_0x1c6f1f,{'saveTo':_0x48ad25},function(_0x22c6b7,_0x143597){if(_0x22c6b7)return _0x39d890(_0x22c6b7);return _0x44c986(_0x143597);});})['then'](function(){return new BPromise(function(_0x499ddc,_0x4a053b){rimraf(_0x1c6f1f,function(_0x51c07d){if(_0x51c07d)_0x4a053b(_0x51c07d);return _0x499ddc();});});})['then'](function(){return _0x3e3ae3[_0x3c7d('0x54')](_0x48ad25,_0x1dd9f8,function(_0x2a70e8){if(_0x2a70e8){console[_0x3c7d('0x77')](_0x3c7d('0x78'),_0x2a70e8);}else{fs[_0x3c7d('0x79')](_0x48ad25);}});});});}else{return _0x3e3ae3[_0x3c7d('0x11')](0xc8);}})[_0x3c7d('0x29')](handleError(_0x3e3ae3,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index dee4e9c..efded0a 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 _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x122960,_0x15b996){var _0x49e321=function(_0x557ea9){while(--_0x557ea9){_0x122960['push'](_0x122960['shift']());}};_0x49e321(++_0x15b996);}(_0xadb5,0xad));var _0x5adb=function(_0x40cc56,_0xd050fc){_0x40cc56=_0x40cc56-0x0;var _0x36cefa=_0xadb5[_0x40cc56];return _0x36cefa;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5adb('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return SmsMessage[_0x5adb('0xa')]({'where':{'SmsInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);SmsInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);SmsInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x8f4c=['length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','Users','map','findAll','then','setDataValue','unreadMessages'];(function(_0x50ab99,_0x152640){var _0x3ea1d9=function(_0x1219f7){while(--_0x1219f7){_0x50ab99['push'](_0x50ab99['shift']());}};_0x3ea1d9(++_0x152640);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3505a5,_0x1c52bf){_0x3505a5=_0x3505a5-0x0;var _0xb1fdc3=_0x8f4c[_0x3505a5];return _0xb1fdc3;};'use strict';var EventEmitter=require(_0xc8f4('0x0'));var SmsInteraction=require(_0xc8f4('0x1'))['db'][_0xc8f4('0x2')];var SmsMessage=require(_0xc8f4('0x1'))['db'][_0xc8f4('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc8f4('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc8f4('0x5'),'afterDestroy':_0xc8f4('0x6')};function emitEvent(_0x133764){return function(_0x56c9b1,_0x32cd80,_0x5208da){_0x56c9b1['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x373506){_0x56c9b1['setDataValue'](_0xc8f4('0x7'),_0x373506[_0xc8f4('0x8')](function(_0xceb9b3){return{'id':_0xceb9b3['id']};}));return SmsMessage[_0xc8f4('0x9')]({'where':{'SmsInteractionId':_0x56c9b1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc8f4('0xa')](function(_0x599de3){_0x56c9b1[_0xc8f4('0xb')](_0xc8f4('0xc'),_0x599de3[_0xc8f4('0xd')]);SmsInteractionEvents[_0xc8f4('0xe')](_0x133764+':'+_0x56c9b1['id'],_0x56c9b1);SmsInteractionEvents['emit'](_0x133764,_0x56c9b1);_0x5208da(null);})[_0xc8f4('0xf')](_0x5208da(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc8f4('0x10')](e,emitEvent(event));}}module[_0xc8f4('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 6961ce4..a06e024 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 _0xba35=['changed','closed','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','define'];(function(_0x5e16a4,_0x737456){var _0x13da94=function(_0x242523){while(--_0x242523){_0x5e16a4['push'](_0x5e16a4['shift']());}};_0x13da94(++_0x737456);}(_0xba35,0x1b2));var _0x5ba3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba35[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5ba3('0x0'));var util=require(_0x5ba3('0x1'));var logger=require(_0x5ba3('0x2'))('api');var moment=require(_0x5ba3('0x3'));var BPromise=require(_0x5ba3('0x4'));var rp=require(_0x5ba3('0x5'));var fs=require('fs');var path=require(_0x5ba3('0x6'));var rimraf=require(_0x5ba3('0x7'));var config=require('../../config/environment');var attributes=require(_0x5ba3('0x8'));module['exports']=function(_0x13e0e2,_0x34e256){return _0x13e0e2[_0x5ba3('0x9')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56692b,_0x1152c5,_0x3b1280){if(_0x56692b[_0x5ba3('0xa')](_0x5ba3('0xb'))){_0x56692b['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3b1280(null,_0x56692b);}}});}; \ No newline at end of file +var _0x1a29=['sms_interactions','changed','closed','closedAt','format','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1a29,0xcb));var _0x91a2=function(_0x1adc0e,_0x4f38ff){_0x1adc0e=_0x1adc0e-0x0;var _0x23a973=_0x1a29[_0x1adc0e];return _0x23a973;};'use strict';var _=require(_0x91a2('0x0'));var util=require('util');var logger=require(_0x91a2('0x1'))(_0x91a2('0x2'));var moment=require(_0x91a2('0x3'));var BPromise=require(_0x91a2('0x4'));var rp=require(_0x91a2('0x5'));var fs=require('fs');var path=require(_0x91a2('0x6'));var rimraf=require(_0x91a2('0x7'));var config=require(_0x91a2('0x8'));var attributes=require(_0x91a2('0x9'));module[_0x91a2('0xa')]=function(_0x4205b9,_0x45550e){return _0x4205b9[_0x91a2('0xb')](_0x91a2('0xc'),attributes,{'tableName':_0x91a2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fdc3f,_0x23e602,_0x196e44){if(_0x3fdc3f[_0x91a2('0xe')](_0x91a2('0xf'))){_0x3fdc3f[_0x91a2('0x10')]=moment()[_0x91a2('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x196e44(null,_0x3fdc3f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 4ebbad6..3378ff9 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 _0x479f=['defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','http'];(function(_0x55f161,_0xd56c0){var _0x426d9b=function(_0x40c61b){while(--_0x40c61b){_0x55f161['push'](_0x55f161['shift']());}};_0x426d9b(++_0xd56c0);}(_0x479f,0x1a5));var _0xf479=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x479f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf479('0x0'));var util=require(_0xf479('0x1'));var moment=require(_0xf479('0x2'));var BPromise=require(_0xf479('0x3'));var rs=require(_0xf479('0x4'));var fs=require('fs');var Redis=require(_0xf479('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf479('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf479('0x7')]({'port':0x232a});config['redis']=_[_0xf479('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf479('0x9'))(new Redis(config['redis']));require(_0xf479('0xa'))[_0xf479('0xb')](socket);function respondWithRpcPromise(_0x45b368,_0xf8556d,_0x2cb7cc){return new BPromise(function(_0x50d35f,_0x1bd15e){return client[_0xf479('0xc')](_0x45b368,_0x2cb7cc)[_0xf479('0xd')](function(_0xdb019e){logger[_0xf479('0xe')]('SmsInteraction,\x20%s,\x20%s',_0xf8556d,_0xf479('0xf'));logger[_0xf479('0x10')](_0xf479('0x11'),_0xf8556d,_0xf479('0xf'),JSON[_0xf479('0x12')](_0xdb019e));if(_0xdb019e[_0xf479('0x13')]){if(_0xdb019e['error'][_0xf479('0x14')]===0x1f4){logger[_0xf479('0x13')](_0xf479('0x15'),_0xf8556d,_0xdb019e[_0xf479('0x13')][_0xf479('0x16')]);return _0x1bd15e(_0xdb019e[_0xf479('0x13')][_0xf479('0x16')]);}logger['error'](_0xf479('0x15'),_0xf8556d,_0xdb019e['error'][_0xf479('0x16')]);return _0x50d35f(_0xdb019e[_0xf479('0x13')][_0xf479('0x16')]);}else{logger[_0xf479('0xe')]('SmsInteraction,\x20%s,\x20%s',_0xf8556d,_0xf479('0xf'));_0x50d35f(_0xdb019e[_0xf479('0x17')]['message']);}})[_0xf479('0x18')](function(_0x5c0014){logger[_0xf479('0x13')](_0xf479('0x15'),_0xf8556d,_0x5c0014);_0x1bd15e(_0x5c0014);});});}exports['UpdateSmsInteraction']=function(_0x3c9621){var _0x25d6ae=this;return new Promise(function(_0x3a52d3,_0x1c87b5){return db[_0xf479('0x19')]['update'](_0x3c9621[_0xf479('0x1a')],{'raw':_0x3c9621['options']?_0x3c9621[_0xf479('0x1b')][_0xf479('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c9621[_0xf479('0x1b')]?_0x3c9621['options'][_0xf479('0x1d')]||null:null,'attributes':_0x3c9621[_0xf479('0x1b')]?_0x3c9621['options'][_0xf479('0x1e')]||null:null,'limit':_0x3c9621[_0xf479('0x1b')]?_0x3c9621[_0xf479('0x1b')][_0xf479('0x1f')]||null:null})[_0xf479('0xd')](function(_0x2242c2){logger['info'](_0xf479('0x20'),_0x3c9621);logger[_0xf479('0x10')](_0xf479('0x20'),_0x3c9621,JSON['stringify'](_0x2242c2));_0x3a52d3(_0x2242c2);})['catch'](function(_0xa6ab9d){logger[_0xf479('0x13')](_0xf479('0x20'),_0xa6ab9d[_0xf479('0x16')],_0x3c9621);_0x1c87b5(_0x25d6ae[_0xf479('0x13')](0x1f4,_0xa6ab9d['message']));});});};exports[_0xf479('0x21')]=function(_0x5e8735){return new Promise(function(_0x13856e,_0x53be7d){return db[_0xf479('0x19')][_0xf479('0x22')]({'where':_0x5e8735[_0xf479('0x1b')]?_0x5e8735[_0xf479('0x1b')][_0xf479('0x1d')]||null:null})[_0xf479('0xd')](function(_0x5b8869){if(_0x5b8869){return _0x5b8869[_0xf479('0x23')](_0x5e8735[_0xf479('0x1a')]['ids'],_[_0xf479('0x24')](_0x5e8735['body'],['ids','id'])||{});}})[_0xf479('0x25')](function(_0x17e7d5){logger[_0xf479('0xe')](_0xf479('0x26'),_0x5e8735);logger[_0xf479('0x10')](_0xf479('0x26'),_0x5e8735,JSON[_0xf479('0x12')](_0x17e7d5));_0x13856e(_0x17e7d5);})[_0xf479('0x18')](function(_0x2d62d2){logger[_0xf479('0x13')](_0xf479('0x26'),_0x2d62d2[_0xf479('0x16')],_0x5e8735);_0x53be7d(_this[_0xf479('0x13')](0x1f4,_0x2d62d2['message']));});});}; \ No newline at end of file +var _0x9d6c=['http','redis','defaults','localhost','socket.io-emitter','request','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','UpdateSmsInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToSmsInteraction','SmsInteraction','find','addTags','omit','ids','spread','AddTags','catch','lodash','util','bluebird','../../config/utils','rpc','../../config/environment','client'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x9d6c,0x111));var _0xc9d6=function(_0x460e94,_0xd22afc){_0x460e94=_0x460e94-0x0;var _0x2fdd9d=_0x9d6c[_0x460e94];return _0x2fdd9d;};'use strict';var _=require(_0xc9d6('0x0'));var util=require(_0xc9d6('0x1'));var moment=require('moment');var BPromise=require(_0xc9d6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc9d6('0x3'));var logger=require('../../config/logger')(_0xc9d6('0x4'));var config=require(_0xc9d6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc9d6('0x6')][_0xc9d6('0x7')]({'port':0x232a});config[_0xc9d6('0x8')]=_[_0xc9d6('0x9')](config[_0xc9d6('0x8')],{'host':_0xc9d6('0xa'),'port':0x18eb});var socket=require(_0xc9d6('0xb'))(new Redis(config[_0xc9d6('0x8')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2e1949,_0x9157e7,_0x58831b){return new BPromise(function(_0x175600,_0x2c6186){return client[_0xc9d6('0xc')](_0x2e1949,_0x58831b)['then'](function(_0x15fcb4){logger['info'](_0xc9d6('0xd'),_0x9157e7,'request\x20sent');logger[_0xc9d6('0xe')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x9157e7,_0xc9d6('0xf'),JSON[_0xc9d6('0x10')](_0x15fcb4));if(_0x15fcb4[_0xc9d6('0x11')]){if(_0x15fcb4[_0xc9d6('0x11')][_0xc9d6('0x12')]===0x1f4){logger[_0xc9d6('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x9157e7,_0x15fcb4[_0xc9d6('0x11')][_0xc9d6('0x13')]);return _0x2c6186(_0x15fcb4[_0xc9d6('0x11')][_0xc9d6('0x13')]);}logger[_0xc9d6('0x11')](_0xc9d6('0xd'),_0x9157e7,_0x15fcb4[_0xc9d6('0x11')][_0xc9d6('0x13')]);return _0x175600(_0x15fcb4[_0xc9d6('0x11')][_0xc9d6('0x13')]);}else{logger[_0xc9d6('0x14')](_0xc9d6('0xd'),_0x9157e7,_0xc9d6('0xf'));_0x175600(_0x15fcb4[_0xc9d6('0x15')][_0xc9d6('0x13')]);}})['catch'](function(_0x29616f){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x9157e7,_0x29616f);_0x2c6186(_0x29616f);});});}exports[_0xc9d6('0x16')]=function(_0x246f57){var _0x589a58=this;return new Promise(function(_0x3378b5,_0x3d5372){return db['SmsInteraction'][_0xc9d6('0x17')](_0x246f57[_0xc9d6('0x18')],{'raw':_0x246f57['options']?_0x246f57[_0xc9d6('0x19')][_0xc9d6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x246f57[_0xc9d6('0x19')]?_0x246f57['options'][_0xc9d6('0x1b')]||null:null,'attributes':_0x246f57[_0xc9d6('0x19')]?_0x246f57['options'][_0xc9d6('0x1c')]||null:null,'limit':_0x246f57[_0xc9d6('0x19')]?_0x246f57[_0xc9d6('0x19')][_0xc9d6('0x1d')]||null:null})[_0xc9d6('0x1e')](function(_0x51e4cb){logger[_0xc9d6('0x14')](_0xc9d6('0x16'),_0x246f57);logger[_0xc9d6('0xe')](_0xc9d6('0x16'),_0x246f57,JSON[_0xc9d6('0x10')](_0x51e4cb));_0x3378b5(_0x51e4cb);})['catch'](function(_0xcc278d){logger[_0xc9d6('0x11')](_0xc9d6('0x16'),_0xcc278d[_0xc9d6('0x13')],_0x246f57);_0x3d5372(_0x589a58[_0xc9d6('0x11')](0x1f4,_0xcc278d[_0xc9d6('0x13')]));});});};exports[_0xc9d6('0x1f')]=function(_0x49fa77){return new Promise(function(_0x2a7864,_0x234356){return db[_0xc9d6('0x20')][_0xc9d6('0x21')]({'where':_0x49fa77['options']?_0x49fa77[_0xc9d6('0x19')][_0xc9d6('0x1b')]||null:null})['then'](function(_0x574cff){if(_0x574cff){return _0x574cff[_0xc9d6('0x22')](_0x49fa77[_0xc9d6('0x18')]['ids'],_[_0xc9d6('0x23')](_0x49fa77[_0xc9d6('0x18')],[_0xc9d6('0x24'),'id'])||{});}})[_0xc9d6('0x25')](function(_0x538c78){logger[_0xc9d6('0x14')]('AddTags',_0x49fa77);logger[_0xc9d6('0xe')](_0xc9d6('0x26'),_0x49fa77,JSON[_0xc9d6('0x10')](_0x538c78));_0x2a7864(_0x538c78);})[_0xc9d6('0x27')](function(_0x17bf2a){logger[_0xc9d6('0x11')](_0xc9d6('0x26'),_0x17bf2a[_0xc9d6('0x13')],_0x49fa77);_0x234356(_this[_0xc9d6('0x11')](0x1f4,_0x17bf2a[_0xc9d6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b36d195..61ce5f9 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 _0x15ee=['register','length','smsInteraction:','./smsInteraction.events','remove','emit','removeListener'];(function(_0x353b77,_0x46f199){var _0x7e9f11=function(_0x2858b2){while(--_0x2858b2){_0x353b77['push'](_0x353b77['shift']());}};_0x7e9f11(++_0x46f199);}(_0x15ee,0x192));var _0xe15e=function(_0x15185f,_0x2003a5){_0x15185f=_0x15185f-0x0;var _0x3c9c47=_0x15ee[_0x15185f];return _0x3c9c47;};'use strict';var SmsInteractionEvents=require(_0xe15e('0x0'));var events=['save',_0xe15e('0x1'),'update'];function createListener(_0x24f5f9,_0x581e40){return function(_0x4379c1){_0x581e40[_0xe15e('0x2')](_0x24f5f9,_0x4379c1);};}function removeListener(_0x52650c,_0x2224bb){return function(){SmsInteractionEvents[_0xe15e('0x3')](_0x52650c,_0x2224bb);};}exports[_0xe15e('0x4')]=function(_0x9bd5a2){for(var _0xe5943e=0x0,_0x16844f=events[_0xe15e('0x5')];_0xe5943e<_0x16844f;_0xe5943e++){var _0xd73279=events[_0xe5943e];var _0x22301e=createListener(_0xe15e('0x6')+_0xd73279,_0x9bd5a2);SmsInteractionEvents['on'](_0xd73279,_0x22301e);}}; \ No newline at end of file +var _0xa9ad=['./smsInteraction.events','update','emit','removeListener','register','length'];(function(_0x6ed828,_0x4cd566){var _0xe4f4c3=function(_0x2154ff){while(--_0x2154ff){_0x6ed828['push'](_0x6ed828['shift']());}};_0xe4f4c3(++_0x4cd566);}(_0xa9ad,0x6c));var _0xda9a=function(_0x15b31d,_0x472ea0){_0x15b31d=_0x15b31d-0x0;var _0x2201d9=_0xa9ad[_0x15b31d];return _0x2201d9;};'use strict';var SmsInteractionEvents=require(_0xda9a('0x0'));var events=['save','remove',_0xda9a('0x1')];function createListener(_0x3aea09,_0x4a4775){return function(_0x2a7004){_0x4a4775[_0xda9a('0x2')](_0x3aea09,_0x2a7004);};}function removeListener(_0x301c61,_0x4d34de){return function(){SmsInteractionEvents[_0xda9a('0x3')](_0x301c61,_0x4d34de);};}exports[_0xda9a('0x4')]=function(_0x1e9608){for(var _0x514360=0x0,_0x3f3c5b=events[_0xda9a('0x5')];_0x514360<_0x3f3c5b;_0x514360++){var _0x592e66=events[_0x514360];var _0x2cdb67=createListener('smsInteraction:'+_0x592e66,_0x1e9608);SmsInteractionEvents['on'](_0x592e66,_0x2cdb67);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 551e259..cda0e97 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 _0x930d=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','index','get','/describe','describe','isAuthenticated','show','post','tracked','sms','smsmessage:create','create','status','/:id','accept','/:id/reject','reject','delete'];(function(_0x2e11ca,_0x42c8aa){var _0x13e0e6=function(_0x14b835){while(--_0x14b835){_0x2e11ca['push'](_0x2e11ca['shift']());}};_0x13e0e6(++_0x42c8aa);}(_0x930d,0x72));var _0xd930=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x930d[_0x330414];return _0x99dbff;};'use strict';var multer=require(_0xd930('0x0'));var util=require('util');var path=require(_0xd930('0x1'));var timeout=require(_0xd930('0x2'));var express=require(_0xd930('0x3'));var router=express['Router']();var fs_extra=require(_0xd930('0x4'));var auth=require(_0xd930('0x5'));var interaction=require(_0xd930('0x6'));var config=require(_0xd930('0x7'));var controller=require(_0xd930('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd930('0x9')]);router[_0xd930('0xa')](_0xd930('0xb'),auth['isAuthenticated'](),controller[_0xd930('0xc')]);router[_0xd930('0xa')]('/:id',auth[_0xd930('0xd')](),controller[_0xd930('0xe')]);router[_0xd930('0xf')]('/',auth[_0xd930('0xd')](),interaction[_0xd930('0x10')](_0xd930('0x11'),_0xd930('0x12')),controller[_0xd930('0x13')]);router[_0xd930('0xf')]('/:id/status',controller[_0xd930('0x14')]);router['put'](_0xd930('0x15'),auth['isAuthenticated'](),controller['update']);router['put']('/:id/accept',auth[_0xd930('0xd')](),controller[_0xd930('0x16')]);router['put'](_0xd930('0x17'),auth[_0xd930('0xd')](),controller[_0xd930('0x18')]);router[_0xd930('0x19')](_0xd930('0x15'),auth[_0xd930('0xd')](),controller[_0xd930('0x1a')]);module[_0xd930('0x1b')]=router; \ No newline at end of file +var _0xa0e9=['./smsMessage.controller','get','isAuthenticated','/describe','/:id','post','tracked','create','put','update','/:id/accept','accept','/:id/reject','reject','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xa0e9,0x196));var _0x9a0e=function(_0x449488,_0x2d2f21){_0x449488=_0x449488-0x0;var _0x35f5eb=_0xa0e9[_0x449488];return _0x35f5eb;};'use strict';var multer=require(_0x9a0e('0x0'));var util=require(_0x9a0e('0x1'));var path=require(_0x9a0e('0x2'));var timeout=require(_0x9a0e('0x3'));var express=require('express');var router=express[_0x9a0e('0x4')]();var fs_extra=require(_0x9a0e('0x5'));var auth=require(_0x9a0e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9a0e('0x7'));var controller=require(_0x9a0e('0x8'));router[_0x9a0e('0x9')]('/',auth[_0x9a0e('0xa')](),controller['index']);router[_0x9a0e('0x9')](_0x9a0e('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x9a0e('0x9')](_0x9a0e('0xc'),auth[_0x9a0e('0xa')](),controller['show']);router[_0x9a0e('0xd')]('/',auth[_0x9a0e('0xa')](),interaction[_0x9a0e('0xe')]('sms','smsmessage:create'),controller[_0x9a0e('0xf')]);router[_0x9a0e('0xd')]('/:id/status',controller['status']);router[_0x9a0e('0x10')](_0x9a0e('0xc'),auth[_0x9a0e('0xa')](),controller[_0x9a0e('0x11')]);router[_0x9a0e('0x10')](_0x9a0e('0x12'),auth['isAuthenticated'](),controller[_0x9a0e('0x13')]);router[_0x9a0e('0x10')](_0x9a0e('0x14'),auth[_0x9a0e('0xa')](),controller[_0x9a0e('0x15')]);router['delete'](_0x9a0e('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a0e('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 8a8c263..1561b95 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 _0xc1cc=['medium','BOOLEAN','ENUM','out','STRING','exports','TEXT'];(function(_0x331399,_0x5cc045){var _0x2ba8a9=function(_0x4ef7e3){while(--_0x4ef7e3){_0x331399['push'](_0x331399['shift']());}};_0x2ba8a9(++_0x5cc045);}(_0xc1cc,0x16a));var _0xcc1c=function(_0x1e3fa7,_0x4ca156){_0x1e3fa7=_0x1e3fa7-0x0;var _0x559ef8=_0xc1cc[_0x1e3fa7];return _0x559ef8;};'use strict';var Sequelize=require('sequelize');module[_0xcc1c('0x0')]={'body':{'type':Sequelize[_0xcc1c('0x1')](_0xcc1c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcc1c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcc1c('0x4')]('in',_0xcc1c('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xcc1c('0x6')](0xbe)},'phone':{'type':Sequelize[_0xcc1c('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xcc1c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcc1c('0x6')]},'providerResponse':{'type':Sequelize[_0xcc1c('0x1')]}}; \ No newline at end of file +var _0xe526=['STRING','DATE','TEXT','exports','medium','ENUM','out'];(function(_0x16d7af,_0x485d45){var _0x4697cf=function(_0x173039){while(--_0x173039){_0x16d7af['push'](_0x16d7af['shift']());}};_0x4697cf(++_0x485d45);}(_0xe526,0x6c));var _0x6e52=function(_0x4065c9,_0x32eca5){_0x4065c9=_0x4065c9-0x0;var _0x1fbf2f=_0xe526[_0x4065c9];return _0x1fbf2f;};'use strict';var Sequelize=require('sequelize');module[_0x6e52('0x0')]={'body':{'type':Sequelize['TEXT'](_0x6e52('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6e52('0x2')]('in',_0x6e52('0x3')),'defaultValue':_0x6e52('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6e52('0x4')](0xbe)},'phone':{'type':Sequelize[_0x6e52('0x4')]},'readAt':{'type':Sequelize[_0x6e52('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6e52('0x4')]},'providerResponse':{'type':Sequelize[_0x6e52('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index f6aaa3c..012f554 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 _0x4404=['User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','results','groupName','DELIVERED','inspect','util','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','http','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','destroy','end','name','send','map','SmsMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','rawAttributes','length','include','find','create','body','update','params','describe','accept','sms','acceptMessage','reject','UserId','agent','get','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact'];(function(_0x5290ca,_0x2fdbde){var _0x564a70=function(_0x4c814f){while(--_0x4c814f){_0x5290ca['push'](_0x5290ca['shift']());}};_0x564a70(++_0x2fdbde);}(_0x4404,0x1ef));var _0x4440=function(_0x555f84,_0x50e205){_0x555f84=_0x555f84-0x0;var _0x528450=_0x4404[_0x555f84];return _0x528450;};'use strict';var util=require(_0x4440('0x0'));var _=require('lodash');var Redis=require(_0x4440('0x1'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x4440('0x2'))(_0x4440('0x3'));var config=require(_0x4440('0x4'));var db=require(_0x4440('0x5'))['db'];config[_0x4440('0x6')]=_[_0x4440('0x7')](config[_0x4440('0x6')],{'host':_0x4440('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4440('0x6')]));require(_0x4440('0x9'))[_0x4440('0xa')](socket);var jayson=require(_0x4440('0xb'));var client=jayson['client'][_0x4440('0xc')]({'port':0x232c});var client9002=jayson['client'][_0x4440('0xc')]({'port':0x232a});var interaction_log=require(_0x4440('0x2'))(_0x4440('0xd'));function respondWithRpcPromise(_0x386d46,_0x465426,_0x43a3d4,_0x138e89){return new Promise(function(_0x3ec2e6,_0x119144){var _0x3feed0=_0x138e89||client;return _0x3feed0[_0x4440('0xe')](_0x386d46,_0x43a3d4)[_0x4440('0xf')](function(_0x3f0444){logger[_0x4440('0x10')](_0x4440('0x11'),_0x465426,'request\x20sent');logger[_0x4440('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x465426,_0x4440('0x13'),JSON[_0x4440('0x14')](_0x3f0444));if(_0x3f0444[_0x4440('0x15')]){if(_0x3f0444[_0x4440('0x15')][_0x4440('0x16')]===0x1f4){logger['error'](_0x4440('0x11'),_0x465426,_0x3f0444[_0x4440('0x15')][_0x4440('0x17')]);return _0x119144(_0x3f0444[_0x4440('0x15')]['message']);}logger[_0x4440('0x15')](_0x4440('0x11'),_0x465426,_0x3f0444[_0x4440('0x15')]['message']);return _0x3ec2e6(_0x3f0444[_0x4440('0x15')][_0x4440('0x17')]);}else{logger['info'](_0x4440('0x11'),_0x465426,'request\x20sent');_0x3ec2e6(_0x3f0444[_0x4440('0x18')][_0x4440('0x17')]);}})[_0x4440('0x19')](function(_0x448321){logger['error'](_0x4440('0x11'),_0x465426,_0x448321);_0x119144(_0x448321);});});}function respondWithResult(_0x2fe7d8,_0x26908b){_0x26908b=_0x26908b||0xc8;return function(_0x30aa49){if(_0x30aa49){return _0x2fe7d8[_0x4440('0x1a')](_0x26908b)[_0x4440('0x1b')](_0x30aa49);}};}function respondWithFilteredResult(_0x27620b,_0x4f0af2){return function(_0x384809){if(_0x384809){var _0x3a1aff=typeof _0x4f0af2[_0x4440('0x1c')]==='undefined'&&typeof _0x4f0af2[_0x4440('0x1d')]===_0x4440('0x1e');var _0x1c1577=_0x384809[_0x4440('0x1f')];var _0xf62044=_0x3a1aff?0x0:_0x4f0af2[_0x4440('0x1c')];var _0x162c97=_0x3a1aff?_0x384809[_0x4440('0x1f')]:_0x4f0af2[_0x4440('0x1c')]+_0x4f0af2[_0x4440('0x1d')];var _0x21fc39;if(_0x162c97>=_0x1c1577){_0x162c97=_0x1c1577;_0x21fc39=0xc8;}else{_0x21fc39=0xce;}_0x27620b['status'](_0x21fc39);return _0x27620b[_0x4440('0x20')]('Content-Range',_0xf62044+'-'+_0x162c97+'/'+_0x1c1577)[_0x4440('0x1b')](_0x384809);}return null;};}function saveUpdates(_0x33ce61){return function(_0x46ed0a){if(_0x46ed0a){return _0x46ed0a['update'](_0x33ce61)[_0x4440('0xf')](function(_0x55254c){return _0x55254c;});}return null;};}function removeEntity(_0x4bcc03){return function(_0x4077c0){if(_0x4077c0){return _0x4077c0[_0x4440('0x21')]()[_0x4440('0xf')](function(){_0x4bcc03[_0x4440('0x1a')](0xcc)[_0x4440('0x22')]();});}};}function handleEntityNotFound(_0x5e883e){return function(_0x32657f){if(!_0x32657f){_0x5e883e['sendStatus'](0x194);}return _0x32657f;};}function handleError(_0x6897d7,_0x23f502){_0x23f502=_0x23f502||0x1f4;return function(_0xc153b0){logger[_0x4440('0x15')](_0xc153b0['stack']);if(_0xc153b0[_0x4440('0x23')]){delete _0xc153b0['name'];}_0x6897d7[_0x4440('0x1a')](_0x23f502)[_0x4440('0x24')](_0xc153b0);};}exports['index']=function(_0x3e6891,_0x4c9ba4){var _0x3e9fa2={},_0x2e9e2f={},_0x41259c={'count':0x0,'rows':[]};var _0x62f7b9=_[_0x4440('0x25')](db[_0x4440('0x26')]['rawAttributes'],function(_0xed15fd){return{'name':_0xed15fd[_0x4440('0x27')],'type':_0xed15fd[_0x4440('0x28')][_0x4440('0x29')]};});_0x2e9e2f[_0x4440('0x2a')]=_['map'](_0x62f7b9,_0x4440('0x23'));_0x2e9e2f[_0x4440('0x2b')]=_[_0x4440('0x2c')](_0x3e6891[_0x4440('0x2b')]);_0x2e9e2f[_0x4440('0x2d')]=_[_0x4440('0x2e')](_0x2e9e2f[_0x4440('0x2a')],_0x2e9e2f[_0x4440('0x2b')]);_0x3e9fa2[_0x4440('0x2f')]=_[_0x4440('0x2e')](_0x2e9e2f[_0x4440('0x2a')],qs['fields'](_0x3e6891['query'][_0x4440('0x30')]));_0x3e9fa2[_0x4440('0x2f')]=_0x3e9fa2[_0x4440('0x2f')]['length']?_0x3e9fa2['attributes']:_0x2e9e2f['model'];if(!_0x3e6891[_0x4440('0x2b')][_0x4440('0x31')](_0x4440('0x32'))){_0x3e9fa2[_0x4440('0x1d')]=qs[_0x4440('0x1d')](_0x3e6891[_0x4440('0x2b')]['limit']);_0x3e9fa2['offset']=qs[_0x4440('0x1c')](_0x3e6891['query'][_0x4440('0x1c')]);}_0x3e9fa2[_0x4440('0x33')]=qs[_0x4440('0x34')](_0x3e6891[_0x4440('0x2b')][_0x4440('0x34')]);_0x3e9fa2[_0x4440('0x35')]=qs['filters'](_[_0x4440('0x36')](_0x3e6891[_0x4440('0x2b')],_0x2e9e2f[_0x4440('0x2d')]),_0x62f7b9);if(_0x3e6891[_0x4440('0x2b')]['filter']){_0x3e9fa2['where']=_[_0x4440('0x37')](_0x3e9fa2['where'],{'$or':_[_0x4440('0x25')](_0x62f7b9,function(_0x1c59ac){if(_0x1c59ac[_0x4440('0x28')]!==_0x4440('0x38')){var _0x3591f7={};_0x3591f7[_0x1c59ac['name']]={'$like':'%'+_0x3e6891['query'][_0x4440('0x39')]+'%'};return _0x3591f7;}})});}_0x3e9fa2=_[_0x4440('0x37')]({},_0x3e9fa2,_0x3e6891[_0x4440('0x3a')]);var _0x1515b6={'where':_0x3e9fa2['where']};return db['SmsMessage'][_0x4440('0x1f')](_0x1515b6)['then'](function(_0x5d4e67){_0x41259c['count']=_0x5d4e67;if(_0x3e6891['query'][_0x4440('0x3b')]){_0x3e9fa2['include']=[{'all':!![]}];}return db[_0x4440('0x26')]['findAll'](_0x3e9fa2);})[_0x4440('0xf')](function(_0x2c8808){_0x41259c[_0x4440('0x3c')]=_0x2c8808;return _0x41259c;})[_0x4440('0xf')](respondWithFilteredResult(_0x4c9ba4,_0x3e9fa2))[_0x4440('0x19')](handleError(_0x4c9ba4,null));};exports[_0x4440('0x3d')]=function(_0x7e9508,_0x446137){var _0xf3e73={'raw':!![],'where':{'id':_0x7e9508['params']['id']}},_0x9f0785={};_0x9f0785[_0x4440('0x2a')]=_[_0x4440('0x2c')](db['SmsMessage'][_0x4440('0x3e')]);_0x9f0785[_0x4440('0x2b')]=_['keys'](_0x7e9508[_0x4440('0x2b')]);_0x9f0785[_0x4440('0x2d')]=_[_0x4440('0x2e')](_0x9f0785[_0x4440('0x2a')],_0x9f0785[_0x4440('0x2b')]);_0xf3e73['attributes']=_[_0x4440('0x2e')](_0x9f0785[_0x4440('0x2a')],qs[_0x4440('0x30')](_0x7e9508[_0x4440('0x2b')][_0x4440('0x30')]));_0xf3e73['attributes']=_0xf3e73['attributes'][_0x4440('0x3f')]?_0xf3e73[_0x4440('0x2f')]:_0x9f0785[_0x4440('0x2a')];if(_0x7e9508[_0x4440('0x2b')]['includeAll']){_0xf3e73[_0x4440('0x40')]=[{'all':!![]}];}_0xf3e73=_['merge']({},_0xf3e73,_0x7e9508[_0x4440('0x3a')]);return db['SmsMessage'][_0x4440('0x41')](_0xf3e73)[_0x4440('0xf')](handleEntityNotFound(_0x446137,null))[_0x4440('0xf')](respondWithResult(_0x446137,null))['catch'](handleError(_0x446137,null));};exports[_0x4440('0x42')]=function(_0x48a3bb,_0x3a853c){return db[_0x4440('0x26')][_0x4440('0x42')](_0x48a3bb[_0x4440('0x43')],{})[_0x4440('0xf')](respondWithResult(_0x3a853c,0xc9))[_0x4440('0x19')](handleError(_0x3a853c,null));};exports[_0x4440('0x44')]=function(_0x9ed144,_0x51a179){if(_0x9ed144[_0x4440('0x43')]['id']){delete _0x9ed144[_0x4440('0x43')]['id'];}return db[_0x4440('0x26')][_0x4440('0x41')]({'where':{'id':_0x9ed144[_0x4440('0x45')]['id']}})[_0x4440('0xf')](handleEntityNotFound(_0x51a179,null))['then'](saveUpdates(_0x9ed144['body'],null))[_0x4440('0xf')](respondWithResult(_0x51a179,null))[_0x4440('0x19')](handleError(_0x51a179,null));};exports[_0x4440('0x21')]=function(_0x181745,_0x3033a8){return db[_0x4440('0x26')][_0x4440('0x41')]({'where':{'id':_0x181745[_0x4440('0x45')]['id']}})[_0x4440('0xf')](handleEntityNotFound(_0x3033a8,null))[_0x4440('0xf')](removeEntity(_0x3033a8,null))[_0x4440('0x19')](handleError(_0x3033a8,null));};exports[_0x4440('0x46')]=function(_0x2bd57a,_0x13b02e){return db[_0x4440('0x26')]['describe']()[_0x4440('0xf')](respondWithResult(_0x13b02e,null))[_0x4440('0x19')](handleError(_0x13b02e,null));};exports[_0x4440('0x47')]=function(_0x3a79bd,_0x36bf35){var _0x7ef59d=_0x4440('0x48');return interactionService[_0x4440('0x49')](_0x3a79bd,_0x7ef59d)[_0x4440('0xf')](respondWithResult(_0x36bf35,null))[_0x4440('0x19')](handleError(_0x36bf35,null));};exports[_0x4440('0x4a')]=function(_0x496224,_0x9ff181){var _0x4657af={'agent':{},'channel':_0x4440('0x48')};if(_0x496224[_0x4440('0x43')]['id']){delete _0x496224[_0x4440('0x43')]['id'];}_0x496224[_0x4440('0x43')]['UserId']=_0x496224[_0x4440('0x43')][_0x4440('0x4b')]||_0x496224['user']['id'];_0x4657af[_0x4440('0x4c')]['id']=_0x496224[_0x4440('0x43')]['UserId'];return db[_0x4440('0x26')][_0x4440('0x41')]({'where':{'id':_0x496224[_0x4440('0x45')]['id'],'UserId':null}})[_0x4440('0xf')](handleEntityNotFound(_0x9ff181,null))[_0x4440('0xf')](function(_0x46900b){if(_0x46900b){_0x4657af[_0x4440('0x17')]=_0x46900b[_0x4440('0x4d')]({'plain':!![]});return db[_0x4440('0x4e')][_0x4440('0x41')]({'where':{'id':_0x46900b[_0x4440('0x4f')]}});}return null;})['then'](handleEntityNotFound(_0x9ff181,null))[_0x4440('0xf')](function(_0x1a98e8){if(_0x1a98e8){_0x4657af['interaction']=_0x1a98e8[_0x4440('0x4d')]({'plain':!![]});interaction_log[_0x4440('0x10')](_0x4440('0x50'),_0x496224[_0x4440('0x51')]['id'],_0x496224[_0x4440('0x51')][_0x4440('0x23')],_0x496224[_0x4440('0x51')]['role'],_0x4657af['interaction']['id'],_0x496224[_0x4440('0x43')]?JSON[_0x4440('0x14')](_0x496224['body']):'null');return respondWithRpcPromise(_0x4440('0x52'),_0x4440('0x53'),_0x4657af);}return null;})['then'](function(_0x5835be){var _0x412eca='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5835be[_0x4440('0x17')][_0x4440('0x54')];return db[_0x4440('0x55')][_0x4440('0x2b')](_0x412eca,{'type':db[_0x4440('0x56')][_0x4440('0x57')][_0x4440('0x58')],'raw':!![]})[_0x4440('0xf')](function(_0x23a61a){return _0x23a61a;});})[_0x4440('0xf')](function(_0x1091f0){if(_0x1091f0){_0x4657af['message'][_0x4440('0x59')]=_0x1091f0[0x0];if(!_0x496224[_0x4440('0x43')][_0x4440('0x4b')])return;return db[_0x4440('0x5a')][_0x4440('0x41')]({'where':{'id':_0x496224[_0x4440('0x43')][_0x4440('0x4b')],'role':_0x4440('0x4c')},'attributes':['id','name',_0x4440('0x5b'),_0x4440('0x5c'),_0x4440('0x5d')],'raw':!![]});}return null;})[_0x4440('0xf')](function(_0x1b7ae3){if(!_0x1b7ae3)return null;_0x4657af[_0x4440('0x17')][_0x4440('0x4c')]=_0x1b7ae3;return _0x4657af;})[_0x4440('0xf')](function(_0x53b5f8){if(_0x53b5f8){_0x53b5f8[_0x4440('0x17')][_0x4440('0x5e')]=util['format'](_0x4440('0x5f'),_0x496224[_0x4440('0x51')][_0x4440('0x23')]);_0x53b5f8['message'][_0x4440('0x60')]=_0x4657af['channel'];_0x53b5f8[_0x4440('0x17')][_0x4440('0x61')]=_0x4657af['channel'];_0x53b5f8[_0x4440('0x17')]['event']=_0x4440('0x4a');respondWithRpcPromise('EventManager','EventManager',{'event':_0x4440('0x62'),'message':_0x53b5f8[_0x4440('0x17')]},client9002);return _0x4657af;}return null;})[_0x4440('0xf')](respondWithResult(_0x9ff181,null))['catch'](handleError(_0x9ff181,null));};exports[_0x4440('0x1a')]=function(_0x2d16e3,_0x31cc83){if(_0x2d16e3[_0x4440('0x43')]['id']){delete _0x2d16e3[_0x4440('0x43')]['id'];}var _0x505790;return db[_0x4440('0x26')]['find']({'where':{'id':_0x2d16e3[_0x4440('0x45')]['id']}})[_0x4440('0xf')](handleEntityNotFound(_0x31cc83,null))[_0x4440('0xf')](function(_0x41c7f1){if(_0x41c7f1){_0x505790=_0x41c7f1;return db[_0x4440('0x63')][_0x4440('0x41')]({'where':{'id':_0x41c7f1['SmsAccountId']}});}})[_0x4440('0xf')](handleEntityNotFound(_0x31cc83,null))[_0x4440('0xf')](function(_0x4601f2){if(_0x4601f2){logger['debug'](_0x4440('0x64'),_0x4440('0x1a'),_0x4440('0x65'),_0x4601f2[_0x4440('0x28')],util['inspect'](_0x2d16e3[_0x4440('0x43')],{'showHidden':![],'depth':null}));switch(_0x4601f2[_0x4440('0x28')]){case _0x4440('0x66'):if(_0x2d16e3['body'][_0x4440('0x67')]&&_0x2d16e3['body'][_0x4440('0x67')]===_0x505790[_0x4440('0x68')]){return _0x505790[_0x4440('0x44')]({'read':!![]});}else{logger[_0x4440('0x15')](_0x4440('0x69'),'status',_0x4440('0x66'),util['inspect'](_0x2d16e3[_0x4440('0x43')],{'showHidden':![],'depth':null}));}break;case _0x4440('0x6a'):if(_0x2d16e3[_0x4440('0x43')]['MessageUUID']&&_0x2d16e3[_0x4440('0x43')][_0x4440('0x6b')]===_0x505790[_0x4440('0x68')]&&_[_0x4440('0x6c')](['sent',_0x4440('0x6d')],_0x2d16e3[_0x4440('0x43')][_0x4440('0x6e')])>=0x0){return _0x505790[_0x4440('0x44')]({'read':!![]});}else{logger['error'](_0x4440('0x69'),'status',_0x4440('0x6f'),util['inspect'](_0x2d16e3['body'],{'showHidden':![],'depth':null}));}break;case _0x4440('0x70'):var _0x1e4113=_0x2d16e3['body'][_0x4440('0x71')][0x0];if(_0x1e4113[_0x4440('0x1a')][_0x4440('0x72')]===_0x4440('0x73')){return _0x505790[_0x4440('0x44')]({'read':!![]});}else{logger[_0x4440('0x15')](_0x4440('0x69'),_0x4440('0x1a'),_0x4440('0x70'),util[_0x4440('0x74')](_0x2d16e3[_0x4440('0x43')],{'showHidden':![],'depth':null}));}break;}return _0x505790;}})[_0x4440('0xf')](respondWithResult(_0x31cc83,null))['catch'](handleError(_0x31cc83,null));}; \ No newline at end of file +var _0x5ea9=['SmsAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../config/logger','api','../../config/environment','redis','jayson/promise','client','http','sms-interactions','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','status','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SmsMessage','then','includeAll','include','findAll','rows','params','find','create','body','destroy','describe','accept','sms','acceptMessage','reject','UserId','user','agent','SmsInteraction','SmsInteractionId','interaction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','DELIVERED'];(function(_0x3e5a77,_0x36a5f1){var _0x3f3ba8=function(_0x20e88f){while(--_0x20e88f){_0x3e5a77['push'](_0x3e5a77['shift']());}};_0x3f3ba8(++_0x36a5f1);}(_0x5ea9,0xe7));var _0x95ea=function(_0x11f82b,_0x255da7){_0x11f82b=_0x11f82b-0x0;var _0xf6dada=_0x5ea9[_0x11f82b];return _0xf6dada;};'use strict';var util=require(_0x95ea('0x0'));var _=require(_0x95ea('0x1'));var Redis=require(_0x95ea('0x2'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x95ea('0x3'))(_0x95ea('0x4'));var config=require(_0x95ea('0x5'));var db=require('../../mysqldb')['db'];config[_0x95ea('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x95ea('0x6')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x95ea('0x7'));var client=jayson[_0x95ea('0x8')][_0x95ea('0x9')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require(_0x95ea('0x3'))(_0x95ea('0xa'));function respondWithRpcPromise(_0x3437b7,_0x4ac354,_0xaa4e6b,_0x23ff05){return new Promise(function(_0x1839c1,_0x4b73ce){var _0x11776a=_0x23ff05||client;return _0x11776a['request'](_0x3437b7,_0xaa4e6b)['then'](function(_0x15993e){logger[_0x95ea('0xb')]('SmsMessage,\x20%s,\x20%s',_0x4ac354,'request\x20sent');logger[_0x95ea('0xc')](_0x95ea('0xd'),_0x4ac354,'request\x20sent',JSON[_0x95ea('0xe')](_0x15993e));if(_0x15993e[_0x95ea('0xf')]){if(_0x15993e['error'][_0x95ea('0x10')]===0x1f4){logger[_0x95ea('0xf')](_0x95ea('0x11'),_0x4ac354,_0x15993e['error'][_0x95ea('0x12')]);return _0x4b73ce(_0x15993e[_0x95ea('0xf')]['message']);}logger[_0x95ea('0xf')]('SmsMessage,\x20%s,\x20%s',_0x4ac354,_0x15993e[_0x95ea('0xf')][_0x95ea('0x12')]);return _0x1839c1(_0x15993e[_0x95ea('0xf')][_0x95ea('0x12')]);}else{logger[_0x95ea('0xb')](_0x95ea('0x11'),_0x4ac354,_0x95ea('0x13'));_0x1839c1(_0x15993e[_0x95ea('0x14')][_0x95ea('0x12')]);}})[_0x95ea('0x15')](function(_0x119168){logger[_0x95ea('0xf')](_0x95ea('0x11'),_0x4ac354,_0x119168);_0x4b73ce(_0x119168);});});}function respondWithResult(_0x15152a,_0x5f0afb){_0x5f0afb=_0x5f0afb||0xc8;return function(_0x57b1ff){if(_0x57b1ff){return _0x15152a[_0x95ea('0x16')](_0x5f0afb)['json'](_0x57b1ff);}};}function respondWithFilteredResult(_0x348a31,_0x1d9925){return function(_0xb94736){if(_0xb94736){var _0xf7ea0c=typeof _0x1d9925[_0x95ea('0x17')]===_0x95ea('0x18')&&typeof _0x1d9925[_0x95ea('0x19')]==='undefined';var _0x480c64=_0xb94736[_0x95ea('0x1a')];var _0x23cf7f=_0xf7ea0c?0x0:_0x1d9925[_0x95ea('0x17')];var _0x3e39e3=_0xf7ea0c?_0xb94736[_0x95ea('0x1a')]:_0x1d9925[_0x95ea('0x17')]+_0x1d9925['limit'];var _0x45a186;if(_0x3e39e3>=_0x480c64){_0x3e39e3=_0x480c64;_0x45a186=0xc8;}else{_0x45a186=0xce;}_0x348a31[_0x95ea('0x16')](_0x45a186);return _0x348a31[_0x95ea('0x1b')](_0x95ea('0x1c'),_0x23cf7f+'-'+_0x3e39e3+'/'+_0x480c64)['json'](_0xb94736);}return null;};}function saveUpdates(_0x4cfd2a){return function(_0x134048){if(_0x134048){return _0x134048[_0x95ea('0x1d')](_0x4cfd2a)['then'](function(_0x1463d2){return _0x1463d2;});}return null;};}function removeEntity(_0x2582cb){return function(_0x1e5bd0){if(_0x1e5bd0){return _0x1e5bd0['destroy']()['then'](function(){_0x2582cb[_0x95ea('0x16')](0xcc)[_0x95ea('0x1e')]();});}};}function handleEntityNotFound(_0x269133){return function(_0xe1cdc1){if(!_0xe1cdc1){_0x269133[_0x95ea('0x1f')](0x194);}return _0xe1cdc1;};}function handleError(_0x5c44c8,_0x431fc2){_0x431fc2=_0x431fc2||0x1f4;return function(_0xc10568){logger[_0x95ea('0xf')](_0xc10568[_0x95ea('0x20')]);if(_0xc10568[_0x95ea('0x21')]){delete _0xc10568[_0x95ea('0x21')];}_0x5c44c8[_0x95ea('0x16')](_0x431fc2)[_0x95ea('0x22')](_0xc10568);};}exports[_0x95ea('0x23')]=function(_0x2826e1,_0x197ddd){var _0x576263={},_0x5c27f5={},_0x54fb88={'count':0x0,'rows':[]};var _0xc4de94=_[_0x95ea('0x24')](db['SmsMessage'][_0x95ea('0x25')],function(_0xe66a14){return{'name':_0xe66a14[_0x95ea('0x26')],'type':_0xe66a14[_0x95ea('0x27')]['key']};});_0x5c27f5[_0x95ea('0x28')]=_[_0x95ea('0x24')](_0xc4de94,_0x95ea('0x21'));_0x5c27f5[_0x95ea('0x29')]=_[_0x95ea('0x2a')](_0x2826e1[_0x95ea('0x29')]);_0x5c27f5[_0x95ea('0x2b')]=_[_0x95ea('0x2c')](_0x5c27f5[_0x95ea('0x28')],_0x5c27f5[_0x95ea('0x29')]);_0x576263[_0x95ea('0x2d')]=_[_0x95ea('0x2c')](_0x5c27f5[_0x95ea('0x28')],qs[_0x95ea('0x2e')](_0x2826e1[_0x95ea('0x29')]['fields']));_0x576263[_0x95ea('0x2d')]=_0x576263[_0x95ea('0x2d')][_0x95ea('0x2f')]?_0x576263[_0x95ea('0x2d')]:_0x5c27f5[_0x95ea('0x28')];if(!_0x2826e1['query'][_0x95ea('0x30')](_0x95ea('0x31'))){_0x576263[_0x95ea('0x19')]=qs['limit'](_0x2826e1[_0x95ea('0x29')][_0x95ea('0x19')]);_0x576263[_0x95ea('0x17')]=qs[_0x95ea('0x17')](_0x2826e1[_0x95ea('0x29')][_0x95ea('0x17')]);}_0x576263[_0x95ea('0x32')]=qs[_0x95ea('0x33')](_0x2826e1['query'][_0x95ea('0x33')]);_0x576263[_0x95ea('0x34')]=qs['filters'](_[_0x95ea('0x35')](_0x2826e1[_0x95ea('0x29')],_0x5c27f5[_0x95ea('0x2b')]),_0xc4de94);if(_0x2826e1[_0x95ea('0x29')][_0x95ea('0x36')]){_0x576263[_0x95ea('0x34')]=_[_0x95ea('0x37')](_0x576263['where'],{'$or':_[_0x95ea('0x24')](_0xc4de94,function(_0x33964e){if(_0x33964e[_0x95ea('0x27')]!==_0x95ea('0x38')){var _0x1b85a9={};_0x1b85a9[_0x33964e[_0x95ea('0x21')]]={'$like':'%'+_0x2826e1[_0x95ea('0x29')]['filter']+'%'};return _0x1b85a9;}})});}_0x576263=_[_0x95ea('0x37')]({},_0x576263,_0x2826e1['options']);var _0x2b2445={'where':_0x576263[_0x95ea('0x34')]};return db[_0x95ea('0x39')][_0x95ea('0x1a')](_0x2b2445)[_0x95ea('0x3a')](function(_0x2067ac){_0x54fb88[_0x95ea('0x1a')]=_0x2067ac;if(_0x2826e1[_0x95ea('0x29')][_0x95ea('0x3b')]){_0x576263[_0x95ea('0x3c')]=[{'all':!![]}];}return db[_0x95ea('0x39')][_0x95ea('0x3d')](_0x576263);})[_0x95ea('0x3a')](function(_0x1cbf67){_0x54fb88[_0x95ea('0x3e')]=_0x1cbf67;return _0x54fb88;})[_0x95ea('0x3a')](respondWithFilteredResult(_0x197ddd,_0x576263))[_0x95ea('0x15')](handleError(_0x197ddd,null));};exports['show']=function(_0x4c4bcb,_0x31a760){var _0x342e78={'raw':!![],'where':{'id':_0x4c4bcb[_0x95ea('0x3f')]['id']}},_0x59ff15={};_0x59ff15[_0x95ea('0x28')]=_['keys'](db[_0x95ea('0x39')][_0x95ea('0x25')]);_0x59ff15[_0x95ea('0x29')]=_['keys'](_0x4c4bcb['query']);_0x59ff15['filters']=_[_0x95ea('0x2c')](_0x59ff15[_0x95ea('0x28')],_0x59ff15[_0x95ea('0x29')]);_0x342e78[_0x95ea('0x2d')]=_[_0x95ea('0x2c')](_0x59ff15[_0x95ea('0x28')],qs['fields'](_0x4c4bcb['query'][_0x95ea('0x2e')]));_0x342e78['attributes']=_0x342e78[_0x95ea('0x2d')][_0x95ea('0x2f')]?_0x342e78[_0x95ea('0x2d')]:_0x59ff15[_0x95ea('0x28')];if(_0x4c4bcb[_0x95ea('0x29')][_0x95ea('0x3b')]){_0x342e78[_0x95ea('0x3c')]=[{'all':!![]}];}_0x342e78=_[_0x95ea('0x37')]({},_0x342e78,_0x4c4bcb['options']);return db['SmsMessage'][_0x95ea('0x40')](_0x342e78)[_0x95ea('0x3a')](handleEntityNotFound(_0x31a760,null))[_0x95ea('0x3a')](respondWithResult(_0x31a760,null))[_0x95ea('0x15')](handleError(_0x31a760,null));};exports[_0x95ea('0x41')]=function(_0xf849f2,_0x251875){return db[_0x95ea('0x39')][_0x95ea('0x41')](_0xf849f2['body'],{})[_0x95ea('0x3a')](respondWithResult(_0x251875,0xc9))['catch'](handleError(_0x251875,null));};exports[_0x95ea('0x1d')]=function(_0x13686,_0x55257a){if(_0x13686['body']['id']){delete _0x13686[_0x95ea('0x42')]['id'];}return db['SmsMessage'][_0x95ea('0x40')]({'where':{'id':_0x13686['params']['id']}})[_0x95ea('0x3a')](handleEntityNotFound(_0x55257a,null))['then'](saveUpdates(_0x13686[_0x95ea('0x42')],null))[_0x95ea('0x3a')](respondWithResult(_0x55257a,null))[_0x95ea('0x15')](handleError(_0x55257a,null));};exports[_0x95ea('0x43')]=function(_0x4f626a,_0x323605){return db[_0x95ea('0x39')][_0x95ea('0x40')]({'where':{'id':_0x4f626a['params']['id']}})[_0x95ea('0x3a')](handleEntityNotFound(_0x323605,null))[_0x95ea('0x3a')](removeEntity(_0x323605,null))['catch'](handleError(_0x323605,null));};exports[_0x95ea('0x44')]=function(_0x14bbdc,_0x479d03){return db[_0x95ea('0x39')]['describe']()[_0x95ea('0x3a')](respondWithResult(_0x479d03,null))[_0x95ea('0x15')](handleError(_0x479d03,null));};exports[_0x95ea('0x45')]=function(_0x5973e5,_0x28214d){var _0xb8dac4=_0x95ea('0x46');return interactionService[_0x95ea('0x47')](_0x5973e5,_0xb8dac4)['then'](respondWithResult(_0x28214d,null))[_0x95ea('0x15')](handleError(_0x28214d,null));};exports[_0x95ea('0x48')]=function(_0x2448dc,_0x5bde7e){var _0x24e213={'agent':{},'channel':_0x95ea('0x46')};if(_0x2448dc[_0x95ea('0x42')]['id']){delete _0x2448dc[_0x95ea('0x42')]['id'];}_0x2448dc['body']['UserId']=_0x2448dc[_0x95ea('0x42')][_0x95ea('0x49')]||_0x2448dc[_0x95ea('0x4a')]['id'];_0x24e213[_0x95ea('0x4b')]['id']=_0x2448dc[_0x95ea('0x42')][_0x95ea('0x49')];return db[_0x95ea('0x39')][_0x95ea('0x40')]({'where':{'id':_0x2448dc[_0x95ea('0x3f')]['id'],'UserId':null}})[_0x95ea('0x3a')](handleEntityNotFound(_0x5bde7e,null))['then'](function(_0x4180ef){if(_0x4180ef){_0x24e213[_0x95ea('0x12')]=_0x4180ef['get']({'plain':!![]});return db[_0x95ea('0x4c')][_0x95ea('0x40')]({'where':{'id':_0x4180ef[_0x95ea('0x4d')]}});}return null;})[_0x95ea('0x3a')](handleEntityNotFound(_0x5bde7e,null))[_0x95ea('0x3a')](function(_0xd25b33){if(_0xd25b33){_0x24e213[_0x95ea('0x4e')]=_0xd25b33[_0x95ea('0x4f')]({'plain':!![]});interaction_log[_0x95ea('0xb')](_0x95ea('0x50'),_0x2448dc[_0x95ea('0x4a')]['id'],_0x2448dc[_0x95ea('0x4a')][_0x95ea('0x21')],_0x2448dc['user'][_0x95ea('0x51')],_0x24e213[_0x95ea('0x4e')]['id'],_0x2448dc['body']?JSON[_0x95ea('0xe')](_0x2448dc['body']):_0x95ea('0x52'));return respondWithRpcPromise('RejectMessage',_0x95ea('0x53'),_0x24e213);}return null;})[_0x95ea('0x3a')](function(_0x43db32){var _0x3c1faf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x43db32[_0x95ea('0x12')][_0x95ea('0x54')];return db[_0x95ea('0x55')]['query'](_0x3c1faf,{'type':db[_0x95ea('0x56')][_0x95ea('0x57')][_0x95ea('0x58')],'raw':!![]})[_0x95ea('0x3a')](function(_0x46fb31){return _0x46fb31;});})[_0x95ea('0x3a')](function(_0x33669a){if(_0x33669a){_0x24e213[_0x95ea('0x12')][_0x95ea('0x59')]=_0x33669a[0x0];if(!_0x2448dc[_0x95ea('0x42')]['UserId'])return;return db[_0x95ea('0x5a')][_0x95ea('0x40')]({'where':{'id':_0x2448dc[_0x95ea('0x42')][_0x95ea('0x49')],'role':_0x95ea('0x4b')},'attributes':['id',_0x95ea('0x21'),_0x95ea('0x5b'),_0x95ea('0x5c'),_0x95ea('0x5d')],'raw':!![]});}return null;})['then'](function(_0x432cac){if(!_0x432cac)return null;_0x24e213[_0x95ea('0x12')][_0x95ea('0x4b')]=_0x432cac;return _0x24e213;})[_0x95ea('0x3a')](function(_0x3c4b0e){if(_0x3c4b0e){_0x3c4b0e[_0x95ea('0x12')][_0x95ea('0x5e')]=util['format'](_0x95ea('0x5f'),_0x2448dc['user']['name']);_0x3c4b0e['message']['channel']=_0x24e213[_0x95ea('0x60')];_0x3c4b0e[_0x95ea('0x12')][_0x95ea('0x61')]=_0x24e213['channel'];_0x3c4b0e[_0x95ea('0x12')][_0x95ea('0x62')]=_0x95ea('0x48');respondWithRpcPromise(_0x95ea('0x63'),_0x95ea('0x63'),{'event':'rejectmessage','message':_0x3c4b0e[_0x95ea('0x12')]},client9002);return _0x24e213;}return null;})['then'](respondWithResult(_0x5bde7e,null))['catch'](handleError(_0x5bde7e,null));};exports['status']=function(_0x3bc52c,_0x69dba){if(_0x3bc52c[_0x95ea('0x42')]['id']){delete _0x3bc52c[_0x95ea('0x42')]['id'];}var _0x3827a4;return db[_0x95ea('0x39')][_0x95ea('0x40')]({'where':{'id':_0x3bc52c[_0x95ea('0x3f')]['id']}})[_0x95ea('0x3a')](handleEntityNotFound(_0x69dba,null))[_0x95ea('0x3a')](function(_0x1e5900){if(_0x1e5900){_0x3827a4=_0x1e5900;return db['SmsAccount'][_0x95ea('0x40')]({'where':{'id':_0x1e5900[_0x95ea('0x64')]}});}})[_0x95ea('0x3a')](handleEntityNotFound(_0x69dba,null))[_0x95ea('0x3a')](function(_0x2821d9){if(_0x2821d9){logger[_0x95ea('0xc')](_0x95ea('0xd'),_0x95ea('0x16'),_0x95ea('0x65'),_0x2821d9[_0x95ea('0x27')],util[_0x95ea('0x66')](_0x3bc52c['body'],{'showHidden':![],'depth':null}));switch(_0x2821d9[_0x95ea('0x27')]){case _0x95ea('0x67'):if(_0x3bc52c[_0x95ea('0x42')][_0x95ea('0x68')]&&_0x3bc52c[_0x95ea('0x42')][_0x95ea('0x68')]===_0x3827a4[_0x95ea('0x69')]){return _0x3827a4['update']({'read':!![]});}else{logger[_0x95ea('0xf')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x95ea('0x16'),_0x95ea('0x67'),util[_0x95ea('0x66')](_0x3bc52c[_0x95ea('0x42')],{'showHidden':![],'depth':null}));}break;case _0x95ea('0x6a'):if(_0x3bc52c[_0x95ea('0x42')]['MessageUUID']&&_0x3bc52c[_0x95ea('0x42')][_0x95ea('0x6b')]===_0x3827a4[_0x95ea('0x69')]&&_[_0x95ea('0x6c')]([_0x95ea('0x6d'),'delivered'],_0x3bc52c[_0x95ea('0x42')][_0x95ea('0x6e')])>=0x0){return _0x3827a4['update']({'read':!![]});}else{logger[_0x95ea('0xf')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x95ea('0x16'),_0x95ea('0x6f'),util[_0x95ea('0x66')](_0x3bc52c[_0x95ea('0x42')],{'showHidden':![],'depth':null}));}break;case _0x95ea('0x70'):var _0x81bace=_0x3bc52c[_0x95ea('0x42')]['results'][0x0];if(_0x81bace['status']['groupName']===_0x95ea('0x71')){return _0x3827a4[_0x95ea('0x1d')]({'read':!![]});}else{logger[_0x95ea('0xf')](_0x95ea('0x72'),_0x95ea('0x16'),'infobip',util[_0x95ea('0x66')](_0x3bc52c[_0x95ea('0x42')],{'showHidden':![],'depth':null}));}break;}return _0x3827a4;}})[_0x95ea('0x3a')](respondWithResult(_0x69dba,null))[_0x95ea('0x15')](handleError(_0x69dba,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1de952f..418d25a 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 _0x953c=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x49e6d7,_0x3e3270){var _0x14c021=function(_0x1456c6){while(--_0x1456c6){_0x49e6d7['push'](_0x49e6d7['shift']());}};_0x14c021(++_0x3e3270);}(_0x953c,0x78));var _0xc953=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0x953c[_0x34b821];return _0x5e00a0;};'use strict';var EventEmitter=require(_0xc953('0x0'));var SmsMessage=require(_0xc953('0x1'))['db'][_0xc953('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc953('0x3')](0x0);var events={'afterCreate':_0xc953('0x4'),'afterUpdate':_0xc953('0x5'),'afterDestroy':'remove'};function emitEvent(_0x32e562){return function(_0x393bb7,_0x5888dd,_0x5b77f6){SmsMessageEvents['emit'](_0x32e562+':'+_0x393bb7['id'],_0x393bb7);SmsMessageEvents[_0xc953('0x6')](_0x32e562,_0x393bb7);_0x5b77f6(null);};}for(var e in events){if(events[_0xc953('0x7')](e)){var event=events[e];SmsMessage[_0xc953('0x8')](e,emitEvent(event));}}module[_0xc953('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x7894=['setMaxListeners','save','update','remove','hasOwnProperty','../../mysqldb','SmsMessage'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7894,0x1be));var _0x4789=function(_0x29b8fa,_0x4286a2){_0x29b8fa=_0x29b8fa-0x0;var _0x2cb9da=_0x7894[_0x29b8fa];return _0x2cb9da;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x4789('0x0'))['db'][_0x4789('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4789('0x2')](0x0);var events={'afterCreate':_0x4789('0x3'),'afterUpdate':_0x4789('0x4'),'afterDestroy':_0x4789('0x5')};function emitEvent(_0x130243){return function(_0x1ed111,_0x282bd7,_0x2b7e66){SmsMessageEvents['emit'](_0x130243+':'+_0x1ed111['id'],_0x1ed111);SmsMessageEvents['emit'](_0x130243,_0x1ed111);_0x2b7e66(null);};}for(var e in events){if(events[_0x4789('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c53025b..8a3094d 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 _0x56ca=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','split','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','catch','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','/status?token=','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','apiKey','createHash','md5','digest','signature=','GET','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','body','remote','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56ca,0x144));var _0xa56c=function(_0x1daf66,_0x3815ab){_0x1daf66=_0x1daf66-0x0;var _0x4809b4=_0x56ca[_0x1daf66];return _0x4809b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa56c('0x0'))('api');var moment=require(_0xa56c('0x1'));var BPromise=require(_0xa56c('0x2'));var rp=require(_0xa56c('0x3'));var fs=require('fs');var path=require(_0xa56c('0x4'));var rimraf=require(_0xa56c('0x5'));var config=require(_0xa56c('0x6'));var attributes=require('./smsMessage.attributes');module[_0xa56c('0x7')]=function(_0x2afefc,_0x1ac3a2){return _0x2afefc[_0xa56c('0x8')](_0xa56c('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xa56c('0xa'),'fields':[_0xa56c('0xa')]},{'name':_0xa56c('0xb'),'fields':['body'],'type':_0xa56c('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e28e4,_0x37a03c,_0x4af1cb){var _0x28e84a=_0x2afefc[_0xa56c('0xd')];var _0x59429e=_0x2e28e4['get']({'plain':!![]});if(_0x59429e[_0xa56c('0xe')][_0xa56c('0xf')]()==='in'||_0x59429e[_0xa56c('0xe')][_0xa56c('0xf')]()===_0xa56c('0x10')&&!_0x59429e[_0xa56c('0x11')]&&!_[_0xa56c('0x12')](_0x59429e[_0xa56c('0x13')])&&!_[_0xa56c('0x12')](_0x59429e[_0xa56c('0x14')])){_0x28e84a['SmsInteraction'][_0xa56c('0x15')]({'where':{'id':_0x59429e['SmsInteractionId']}})[_0xa56c('0x16')](function(_0x337698){if(_0x337698){_0x337698[_0xa56c('0x17')]({'lastMsgAt':_0x59429e[_0xa56c('0x18')],'lastMsgDirection':_0x59429e[_0xa56c('0xe')][_0xa56c('0xf')]()});}})['catch'](function(_0x4de794){console[_0xa56c('0x19')](_0x4de794);});}if(_0x59429e[_0xa56c('0xe')]===_0xa56c('0x10')&&!_0x59429e[_0xa56c('0x11')]){var _0x4866d0;_0x28e84a[_0xa56c('0x1a')][_0xa56c('0x1b')]({'where':{'id':_0x59429e[_0xa56c('0x1c')]},'raw':!![]})['then'](function(_0x456ba5){_0x4866d0=_0x456ba5;if(_0x4866d0&&_0x4866d0[_0xa56c('0x1d')]){switch(_0x4866d0['type']){case _0xa56c('0x1e'):var _0x2129fc=require('twilio');if(_0x4866d0[_0xa56c('0x1f')]&&_0x4866d0[_0xa56c('0x20')]&&_0x4866d0[_0xa56c('0x21')]){var _0x24fe70=new _0x2129fc(_0x4866d0['accountSid'],_0x4866d0['authToken']);_0x24fe70[_0xa56c('0x22')]['create']({'body':_0x59429e[_0xa56c('0x23')],'to':_0x59429e['phone'],'from':_0x4866d0[_0xa56c('0x21')],'statusCallback':_0x4866d0[_0xa56c('0x24')]+_0xa56c('0x25')+_0x59429e['id']+'/status?token='+_0x4866d0['token']})[_0xa56c('0x16')](function(_0x3e124a){if(_0x3e124a[_0xa56c('0x26')]){return _0x2e28e4[_0xa56c('0x17')]({'messageId':_0x3e124a[_0xa56c('0x26')]});}})['catch'](function(_0x10d0a8){logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x1e'),util[_0xa56c('0x29')](_0x10d0a8,{'showHidden':![],'depth':null}));});}else{logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),'twilio',_0xa56c('0x2a'));}break;case _0xa56c('0x2b'):var _0x1d889a=_0xa56c('0x2c');if(_0x4866d0[_0xa56c('0x2d')]&&_0x4866d0[_0xa56c('0x2e')]){var _0x2fb3b9={'recipient':[_0x59429e[_0xa56c('0x21')]],'message':_0x59429e[_0xa56c('0x23')],'message_type':_0x4866d0[_0xa56c('0x2f')]};if(_0x4866d0[_0xa56c('0x2f')]&&_0x4866d0[_0xa56c('0x2f')]!=='SI'){_0x2fb3b9[_0xa56c('0x30')]=_0x4866d0[_0xa56c('0x21')];}var _0x10421c={'url':_0x1d889a+_0xa56c('0x31')+_0x4866d0[_0xa56c('0x2d')]+'&password='+_0x4866d0[_0xa56c('0x2e')],'method':'GET'};rp(_0x10421c)[_0xa56c('0x16')](function(_0x22d4be){var _0x51fd42=_0x22d4be[_0xa56c('0x32')](';');var _0x4931aa={'user_key':_0x51fd42[0x0],'session_key':_0x51fd42[0x1]};_0x10421c={'url':_0x1d889a+'sms','method':'POST','headers':{'user_key':_0x4931aa[_0xa56c('0x33')],'Session_key':_0x4931aa[_0xa56c('0x34')]},'json':!![],'body':_0x2fb3b9};return rp(_0x10421c);})[_0xa56c('0x16')](function(_0x3906bf){if(_0x3906bf[_0xa56c('0x35')]>=0x1){var _0x3d6af8={'messageId':_0x3906bf[_0xa56c('0x36')]};if(_0x4866d0[_0xa56c('0x2f')]!=='GP'||!_0x4866d0[_0xa56c('0x37')]){_0x3d6af8[_0xa56c('0x38')]=!![];}return _0x2e28e4[_0xa56c('0x17')](_0x3d6af8);}else{return logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x2b'),util['inspect'](_0x3906bf,{'showHidden':![],'depth':null}));}})[_0xa56c('0x39')](function(_0x1e518c){return logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x2b'),util['inspect'](_0x1e518c,{'showHidden':![],'depth':null}));});}else{logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),'skebby',_0xa56c('0x3a'));}break;case _0xa56c('0x3b'):if(_0x4866d0[_0xa56c('0x20')]){var _0x3f7a12={'recipient':_0x59429e[_0xa56c('0x21')],'message':_0x59429e[_0xa56c('0x23')],'sender':_0x4866d0['senderString']||_0x4866d0[_0xa56c('0x21')],'authorization':_0x4866d0['authToken']};var _0x37a03c={'method':_0xa56c('0x3c'),'uri':_0xa56c('0x3d'),'body':_0x3f7a12,'json':!![]};rp(_0x37a03c)[_0xa56c('0x16')](function(_0x557734){var _0x403b66={'messageId':_0x557734['requestid']};if(!_0x4866d0[_0xa56c('0x37')]){_0x403b66['read']=!![];}return _0x2e28e4[_0xa56c('0x17')](_0x403b66);})[_0xa56c('0x39')](function(_0x57bdcf){logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x3b'),util[_0xa56c('0x29')](_0x57bdcf,{'showHidden':![],'depth':null}));});}else{logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x3b'),_0xa56c('0x3e'));}break;case'clicksend':if(_0x4866d0[_0xa56c('0x2d')]&&_0x4866d0[_0xa56c('0x2e')]){var _0x3f7a12={'messages':[{'source':'xCALLY\x20Motion','to':_0x59429e[_0xa56c('0x21')],'body':_0x59429e[_0xa56c('0x23')],'from':_0x4866d0[_0xa56c('0x3f')]||_0x4866d0[_0xa56c('0x21')]}]};var _0x56e46e=util[_0xa56c('0x40')](_0xa56c('0x41'),_0x4866d0[_0xa56c('0x2d')],_0x4866d0[_0xa56c('0x2e')]);var _0x37a03c={'method':'POST','uri':_0xa56c('0x42'),'body':_0x3f7a12,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x56e46e)[_0xa56c('0x43')](_0xa56c('0x44')))},'json':!![]};rp(_0x37a03c)[_0xa56c('0x16')](function(_0x2c3829){if(_0x2c3829[_0xa56c('0x45')]>=0xc8&&_0x2c3829[_0xa56c('0x45')]<=0xce){if(_0x2c3829[_0xa56c('0x46')]&&_0x2c3829['data'][_0xa56c('0x47')]>0x0){var _0x1e1cbc=_[_0xa56c('0x48')](_0x2c3829['data'][_0xa56c('0x22')]);var _0x4bb1e7={'messageId':_0x1e1cbc[_0xa56c('0x49')]};if(!_0x4866d0['deliveryReport']){_0x4bb1e7['read']=!![];}return _0x2e28e4[_0xa56c('0x17')](_0x4bb1e7);}else{logger[_0xa56c('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa56c('0x28'),'clickSend',util[_0xa56c('0x29')](_0x2c3829,{'showHidden':![],'depth':null}));}}else{logger[_0xa56c('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa56c('0x28'),_0xa56c('0x4a'),util[_0xa56c('0x29')](_0x2c3829,{'showHidden':![],'depth':null}));}})[_0xa56c('0x39')](function(_0x479c4a){logger['error'](_0xa56c('0x27'),_0xa56c('0x28'),'clickSend',util['inspect'](_0x479c4a,{'showHidden':![],'depth':null}));});}else{logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa56c('0x4b'):if(_0x4866d0[_0xa56c('0x4c')]&&_0x4866d0[_0xa56c('0x20')]){var _0x3f7a12={'dst':_0x59429e[_0xa56c('0x21')],'text':_0x59429e[_0xa56c('0x23')],'src':_0x4866d0[_0xa56c('0x3f')]||_0x4866d0[_0xa56c('0x21')],'url':_0x4866d0[_0xa56c('0x24')]+'/api/sms/messages/'+_0x59429e['id']+'/status?token='+_0x4866d0[_0xa56c('0x4d')]};var _0x56e46e=util[_0xa56c('0x40')](_0xa56c('0x41'),_0x4866d0[_0xa56c('0x4c')],_0x4866d0[_0xa56c('0x20')]);var _0x37a03c={'method':_0xa56c('0x3c'),'uri':util['format'](_0xa56c('0x4e'),_0x4866d0['authId']),'body':_0x3f7a12,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x56e46e)[_0xa56c('0x43')](_0xa56c('0x44')))},'json':!![]};rp(_0x37a03c)[_0xa56c('0x16')](function(_0x19c080){var _0x4d89ed={'messageId':_0x19c080[_0xa56c('0x4f')][0x0]};return _0x2e28e4[_0xa56c('0x17')](_0x4d89ed);})['catch'](function(_0x5afc2b){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa56c('0x28'),'plivo',util[_0xa56c('0x29')](_0x5afc2b,{'showHidden':![],'depth':null}));});}else{logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x4b'),_0xa56c('0x50'));}break;case _0xa56c('0x51'):if(_0x4866d0['username']&&_0x4866d0[_0xa56c('0x2e')]){if(_0x4866d0[_0xa56c('0x52')]){var _0xf21073={'method':'POST','uri':_0x4866d0[_0xa56c('0x52')]+'/auth/1/session','body':{'username':_0x4866d0[_0xa56c('0x2d')],'password':_0x4866d0[_0xa56c('0x2e')]},'json':!![]};return rp(_0xf21073)['then'](function(_0x5f10c8){var _0x4b0481={'method':_0xa56c('0x3c'),'uri':_0x4866d0[_0xa56c('0x52')]+_0xa56c('0x53'),'body':{'messages':[{'from':_0x4866d0[_0xa56c('0x21')],'destinations':[{'to':_0x59429e[_0xa56c('0x21')]}],'text':_0x59429e[_0xa56c('0x23')],'notifyUrl':_0x4866d0['remote']+_0xa56c('0x25')+_0x59429e['id']+_0xa56c('0x54')+_0x4866d0[_0xa56c('0x4d')],'notifyContentType':'application/json','callbackData':_0x4866d0[_0xa56c('0x21')]+';'+_0x59429e[_0xa56c('0x23')]}]},'headers':{'Authorization':_0xa56c('0x55')+_0x5f10c8[_0xa56c('0x4d')]},'json':!![]};return rp(_0x4b0481)[_0xa56c('0x16')](function(_0x47fcee){if(_0x47fcee[_0xa56c('0x22')]){var _0x3c1d8e={'messageId':_0x47fcee[_0xa56c('0x22')][0x0][_0xa56c('0xa')]};if(!_0x4866d0[_0xa56c('0x37')]){_0x3c1d8e[_0xa56c('0x38')]=!![];}return _0x2e28e4[_0xa56c('0x17')](_0x3c1d8e);}else{return logger[_0xa56c('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa56c('0x51'),util[_0xa56c('0x29')](_0x47fcee,{'showHidden':![],'depth':null}));}});})[_0xa56c('0x39')](function(_0xf10aae){return logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),'infobip',util[_0xa56c('0x29')](_0xf10aae,{'showHidden':![],'depth':null}));});}else{logger[_0xa56c('0x19')](_0xa56c('0x27'),'afterCreate',_0xa56c('0x51'),_0xa56c('0x56'));}}else{logger['error'](_0xa56c('0x27'),'afterCreate',_0xa56c('0x51'),_0xa56c('0x3a'));}break;case _0xa56c('0x57'):var _0x1672ad=require(_0xa56c('0x58'));if(_0x4866d0['apiKey']){var _0xb2cc90={};_0xb2cc90[_0xa56c('0x59')]=_0x4866d0[_0xa56c('0x2d')];_0xb2cc90[_0xa56c('0x21')]=_0x59429e[_0xa56c('0x21')];_0xb2cc90[_0xa56c('0x30')]=_0x4866d0[_0xa56c('0x21')];_0xb2cc90[_0xa56c('0x5a')]=_0x59429e['body'];_0xb2cc90[_0xa56c('0x5b')]=+new Date();var _0x5df44f='';var _0x56607b='';var _0x52d1f7=Object[_0xa56c('0x5c')](_0xb2cc90);_0x52d1f7[_0xa56c('0x5d')]();for(var _0x3662fe=0x0;_0x3662fe<_0x52d1f7[_0xa56c('0x5e')];_0x3662fe++){if(_0x5df44f!=''){_0x5df44f+='&';}_0x5df44f+=_0x52d1f7[_0x3662fe]+'='+encodeURIComponent(_0xb2cc90[_0x52d1f7[_0x3662fe]]);_0x56607b+=_0xb2cc90[_0x52d1f7[_0x3662fe]];}_0x56607b+=_0x4866d0[_0xa56c('0x5f')];_0x56607b=_0x1672ad[_0xa56c('0x60')](_0xa56c('0x61'))[_0xa56c('0x17')](_0x56607b)[_0xa56c('0x62')]('hex');if(_0x5df44f!==''){_0x5df44f+='&';}_0x5df44f+=_0xa56c('0x63')+_0x56607b;var _0x10421c={'method':_0xa56c('0x64'),'uri':_0x4866d0[_0xa56c('0x52')]+_0xa56c('0x65')+_0x5df44f,'json':!![]};return rp(_0x10421c)[_0xa56c('0x16')](function(_0xb9f62c){var _0x54ad92=Object[_0xa56c('0x5c')](_0xb9f62c);if(_0xb9f62c[_0x54ad92[0x0]]['error']&&parseInt(_0xb9f62c[_0x54ad92[0x0]][_0xa56c('0x19')])===0x0){var _0x1f56ac={'messageId':_0xb9f62c[_0x54ad92[0x0]]['id_sms']};if(!_0x4866d0['deliveryReport']){_0x1f56ac['read']=!![];}return _0x2e28e4[_0xa56c('0x17')](_0x1f56ac);}else{return logger[_0xa56c('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa56c('0x28'),_0xa56c('0x57'),util[_0xa56c('0x29')](_0xb9f62c['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x21cc72){return logger['error'](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x57'),util[_0xa56c('0x29')](_0x21cc72,{'showHidden':![],'depth':null}));});}else{logger[_0xa56c('0x19')](_0xa56c('0x27'),'afterCreate',_0xa56c('0x57'),_0xa56c('0x66'));}break;case _0xa56c('0x67'):if(_0x4866d0['apiKey']){var _0x57a05e={'method':_0xa56c('0x3c'),'uri':_0xa56c('0x68'),'headers':{'Authorization':_0x4866d0[_0xa56c('0x5f')]},'body':{'content':_0x59429e[_0xa56c('0x23')],'to':[_0x59429e[_0xa56c('0x21')]],'from':_0x4866d0[_0xa56c('0x21')],'binary':![],'clientMessageId':_0xa56c('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x57a05e)[_0xa56c('0x16')](function(_0x315656){if(!_0x315656['error']){var _0x4d3e20={'messageId':_0x315656[_0xa56c('0x22')][0x0][_0xa56c('0x6a')]};if(!_0x4866d0['deliveryReport']){_0x4d3e20['read']=!![];}return _0x2e28e4['update'](_0x4d3e20);}else{return logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),'clickatell',util[_0xa56c('0x29')](_0x315656[_0xa56c('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1c23cb){return logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x67'),util[_0xa56c('0x29')](_0x1c23cb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x67'),'Missing\x20parameters:\x20apiKey');}break;case _0xa56c('0x6b'):if(_0x4866d0['username']&&_0x4866d0[_0xa56c('0x2e')]){var _0x56e46e=util['format'](_0xa56c('0x41'),_0x4866d0[_0xa56c('0x2d')],_0x4866d0[_0xa56c('0x2e')]);var _0x37a03c={'method':_0xa56c('0x3c'),'uri':_0xa56c('0x6c')+_0x4866d0['accountId']+_0xa56c('0x6d'),'body':{'to':[_0x59429e[_0xa56c('0x21')]],'text':_0x59429e['body'],'from':_0x4866d0['phone'],'applicationId':_0x4866d0[_0xa56c('0x6e')]},'headers':{'Authorization':util[_0xa56c('0x40')]('Basic\x20%s',new Buffer(_0x56e46e)['toString']('base64'))},'json':!![]};rp(_0x37a03c)[_0xa56c('0x16')](function(_0x1e7b5d){if(_0x1e7b5d['id']){var _0x54dc7a={'messageId':_0x1e7b5d['id']};return _0x2e28e4[_0xa56c('0x17')](_0x54dc7a);}else{logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),'bandwidth',util[_0xa56c('0x29')](_0x1e7b5d,{'showHidden':![],'depth':null}));}})[_0xa56c('0x39')](function(_0x35fcc2){logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x6b'),util[_0xa56c('0x29')](_0x35fcc2,{'showHidden':![],'depth':null}));});}else{logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x4866d0[_0xa56c('0x5f')]){var _0x3e377d={};var _0x10421c={'method':_0xa56c('0x3c'),'uri':_0xa56c('0x6f'),'headers':{'Authorization':_0xa56c('0x70')+_0x4866d0[_0xa56c('0x5f')],'Content-Type':_0xa56c('0x71')},'body':{'from':_0x4866d0['phone'],'to':_0x59429e[_0xa56c('0x21')],'text':_0x59429e[_0xa56c('0x23')]},'json':!![]};return rp(_0x10421c)[_0xa56c('0x16')](function(_0x5a56d3){if(_0x5a56d3['code']==0xca){_0x3e377d[_0xa56c('0x72')]=_0x5a56d3;var _0x88ee17={'method':_0xa56c('0x3c'),'uri':_0xa56c('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x4866d0[_0xa56c('0x5f')],'Content-Type':_0xa56c('0x71')},'body':{'refid':_0x3e377d[_0xa56c('0x72')][_0xa56c('0x74')]},'json':!![]};return rp(_0x88ee17)[_0xa56c('0x16')](function(_0x58d149){_0x3e377d[_0xa56c('0x75')]=_0x58d149;var _0xa0710b={'messageId':_0x3e377d['message'][_0xa56c('0x74')],'read':!![]};return _0x2e28e4[_0xa56c('0x17')](_0xa0710b);});}else{return logger[_0xa56c('0x19')](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x76'),util[_0xa56c('0x29')](_0x5a56d3,{'showHidden':![],'depth':null}));}})[_0xa56c('0x39')](function(_0x5a7229){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa56c('0x28'),_0xa56c('0x76'),util[_0xa56c('0x29')](_0x5a7229,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xa56c('0x27'),_0xa56c('0x28'),_0xa56c('0x76'),'Token\x20not\x20received');}break;}}})[_0xa56c('0x77')](function(){_0x4af1cb();});}else{_0x4af1cb();}}},'charset':_0xa56c('0x78'),'collate':_0xa56c('0x79')});}; \ No newline at end of file +var _0xa5db=['toLowerCase','catch','error','find','type','twilio','accountSid','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','GET','split','sms','POST','user_key','total_sent','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','authToken','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','toString','http_code','queued_count','clickSend','plivo','%s:%s','authId','Basic\x20%s','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','createHash','md5','hex','signature=','Missing\x20parameters:\x20apiKey','apiKey','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','status','message','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xa5db,0x1bc));var _0xba5d=function(_0x10d7cb,_0x36abd2){_0x10d7cb=_0x10d7cb-0x0;var _0x3211d4=_0xa5db[_0x10d7cb];return _0x3211d4;};'use strict';var _=require(_0xba5d('0x0'));var util=require(_0xba5d('0x1'));var logger=require(_0xba5d('0x2'))(_0xba5d('0x3'));var moment=require(_0xba5d('0x4'));var BPromise=require(_0xba5d('0x5'));var rp=require(_0xba5d('0x6'));var fs=require('fs');var path=require(_0xba5d('0x7'));var rimraf=require('rimraf');var config=require(_0xba5d('0x8'));var attributes=require(_0xba5d('0x9'));module[_0xba5d('0xa')]=function(_0x3b170f,_0x363666){return _0x3b170f[_0xba5d('0xb')]('SmsMessage',attributes,{'tableName':_0xba5d('0xc'),'paranoid':![],'indexes':[{'name':_0xba5d('0xd'),'fields':['messageId']},{'name':_0xba5d('0xe'),'fields':[_0xba5d('0xf')],'type':_0xba5d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b840e,_0x3ae5ec,_0x3fd97d){var _0x22ed76=_0x3b170f['models'];var _0x432f12=_0x1b840e[_0xba5d('0x11')]({'plain':!![]});if(_0x432f12[_0xba5d('0x12')]['toLowerCase']()==='in'||_0x432f12[_0xba5d('0x12')]['toLowerCase']()===_0xba5d('0x13')&&!_0x432f12[_0xba5d('0x14')]&&!_[_0xba5d('0x15')](_0x432f12[_0xba5d('0x16')])&&!_[_0xba5d('0x15')](_0x432f12[_0xba5d('0x17')])){_0x22ed76[_0xba5d('0x18')]['findOne']({'where':{'id':_0x432f12[_0xba5d('0x17')]}})[_0xba5d('0x19')](function(_0x411185){if(_0x411185){_0x411185[_0xba5d('0x1a')]({'lastMsgAt':_0x432f12[_0xba5d('0x1b')],'lastMsgDirection':_0x432f12[_0xba5d('0x12')][_0xba5d('0x1c')]()});}})[_0xba5d('0x1d')](function(_0x225f38){console[_0xba5d('0x1e')](_0x225f38);});}if(_0x432f12[_0xba5d('0x12')]===_0xba5d('0x13')&&!_0x432f12['secret']){var _0x303046;_0x22ed76['SmsAccount'][_0xba5d('0x1f')]({'where':{'id':_0x432f12['SmsAccountId']},'raw':!![]})['then'](function(_0x22a25f){_0x303046=_0x22a25f;if(_0x303046&&_0x303046[_0xba5d('0x20')]){switch(_0x303046[_0xba5d('0x20')]){case _0xba5d('0x21'):var _0x43a6fb=require(_0xba5d('0x21'));if(_0x303046[_0xba5d('0x22')]&&_0x303046['authToken']&&_0x303046[_0xba5d('0x23')]){var _0x17a066=new _0x43a6fb(_0x303046[_0xba5d('0x22')],_0x303046['authToken']);_0x17a066[_0xba5d('0x24')][_0xba5d('0x25')]({'body':_0x432f12[_0xba5d('0xf')],'to':_0x432f12[_0xba5d('0x23')],'from':_0x303046['phone'],'statusCallback':_0x303046[_0xba5d('0x26')]+_0xba5d('0x27')+_0x432f12['id']+_0xba5d('0x28')+_0x303046[_0xba5d('0x29')]})[_0xba5d('0x19')](function(_0x4b68fd){if(_0x4b68fd[_0xba5d('0x2a')]){return _0x1b840e['update']({'messageId':_0x4b68fd[_0xba5d('0x2a')]});}})[_0xba5d('0x1d')](function(_0x573960){logger[_0xba5d('0x1e')](_0xba5d('0x2b'),'afterCreate',_0xba5d('0x21'),util['inspect'](_0x573960,{'showHidden':![],'depth':null}));});}else{logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x21'),_0xba5d('0x2d'));}break;case _0xba5d('0x2e'):var _0x4d5217='https://api.skebby.it/API/v1.0/REST/';if(_0x303046[_0xba5d('0x2f')]&&_0x303046[_0xba5d('0x30')]){var _0x2a786b={'recipient':[_0x432f12[_0xba5d('0x23')]],'message':_0x432f12[_0xba5d('0xf')],'message_type':_0x303046[_0xba5d('0x31')]};if(_0x303046[_0xba5d('0x31')]&&_0x303046['smsMethod']!=='SI'){_0x2a786b[_0xba5d('0x32')]=_0x303046[_0xba5d('0x23')];}var _0x1fa74c={'url':_0x4d5217+'login?username='+_0x303046[_0xba5d('0x2f')]+'&password='+_0x303046[_0xba5d('0x30')],'method':_0xba5d('0x33')};rp(_0x1fa74c)[_0xba5d('0x19')](function(_0x3d6386){var _0x49f765=_0x3d6386[_0xba5d('0x34')](';');var _0x1d8d40={'user_key':_0x49f765[0x0],'session_key':_0x49f765[0x1]};_0x1fa74c={'url':_0x4d5217+_0xba5d('0x35'),'method':_0xba5d('0x36'),'headers':{'user_key':_0x1d8d40[_0xba5d('0x37')],'Session_key':_0x1d8d40['session_key']},'json':!![],'body':_0x2a786b};return rp(_0x1fa74c);})[_0xba5d('0x19')](function(_0x5bb371){if(_0x5bb371[_0xba5d('0x38')]>=0x1){var _0x2f32a8={'messageId':_0x5bb371['internal_order_id']};if(_0x303046['smsMethod']!=='GP'||!_0x303046[_0xba5d('0x39')]){_0x2f32a8[_0xba5d('0x3a')]=!![];}return _0x1b840e[_0xba5d('0x1a')](_0x2f32a8);}else{return logger[_0xba5d('0x1e')](_0xba5d('0x2b'),'afterCreate',_0xba5d('0x2e'),util[_0xba5d('0x3b')](_0x5bb371,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3a38ff){return logger[_0xba5d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba5d('0x2c'),'skebby',util[_0xba5d('0x3b')](_0x3a38ff,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x2e'),_0xba5d('0x3c'));}break;case _0xba5d('0x3d'):if(_0x303046['authToken']){var _0x5268f8={'recipient':_0x432f12[_0xba5d('0x23')],'message':_0x432f12[_0xba5d('0xf')],'sender':_0x303046[_0xba5d('0x3e')]||_0x303046[_0xba5d('0x23')],'authorization':_0x303046[_0xba5d('0x3f')]};var _0x3ae5ec={'method':_0xba5d('0x36'),'uri':_0xba5d('0x40'),'body':_0x5268f8,'json':!![]};rp(_0x3ae5ec)[_0xba5d('0x19')](function(_0x3acf1f){var _0x1d97d0={'messageId':_0x3acf1f[_0xba5d('0x41')]};if(!_0x303046[_0xba5d('0x39')]){_0x1d97d0[_0xba5d('0x3a')]=!![];}return _0x1b840e[_0xba5d('0x1a')](_0x1d97d0);})[_0xba5d('0x1d')](function(_0x57b758){logger[_0xba5d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba5d('0x2c'),_0xba5d('0x3d'),util[_0xba5d('0x3b')](_0x57b758,{'showHidden':![],'depth':null}));});}else{logger[_0xba5d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba5d('0x2c'),_0xba5d('0x3d'),_0xba5d('0x42'));}break;case'clicksend':if(_0x303046['username']&&_0x303046['password']){var _0x5268f8={'messages':[{'source':_0xba5d('0x43'),'to':_0x432f12[_0xba5d('0x23')],'body':_0x432f12[_0xba5d('0xf')],'from':_0x303046[_0xba5d('0x3e')]||_0x303046['phone']}]};var _0x2849bc=util[_0xba5d('0x44')]('%s:%s',_0x303046['username'],_0x303046[_0xba5d('0x30')]);var _0x3ae5ec={'method':_0xba5d('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5268f8,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x2849bc)[_0xba5d('0x45')]('base64'))},'json':!![]};rp(_0x3ae5ec)[_0xba5d('0x19')](function(_0x3d9a7c){if(_0x3d9a7c[_0xba5d('0x46')]>=0xc8&&_0x3d9a7c[_0xba5d('0x46')]<=0xce){if(_0x3d9a7c['data']&&_0x3d9a7c['data'][_0xba5d('0x47')]>0x0){var _0x47b73f=_['head'](_0x3d9a7c['data']['messages']);var _0xad9765={'messageId':_0x47b73f['message_id']};if(!_0x303046[_0xba5d('0x39')]){_0xad9765[_0xba5d('0x3a')]=!![];}return _0x1b840e['update'](_0xad9765);}else{logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x48'),util[_0xba5d('0x3b')](_0x3d9a7c,{'showHidden':![],'depth':null}));}}else{logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),'clickSend',util[_0xba5d('0x3b')](_0x3d9a7c,{'showHidden':![],'depth':null}));}})[_0xba5d('0x1d')](function(_0x458dd2){logger[_0xba5d('0x1e')](_0xba5d('0x2b'),'afterCreate','clickSend',util[_0xba5d('0x3b')](_0x458dd2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x48'),_0xba5d('0x3c'));}break;case _0xba5d('0x49'):if(_0x303046['authId']&&_0x303046[_0xba5d('0x3f')]){var _0x5268f8={'dst':_0x432f12[_0xba5d('0x23')],'text':_0x432f12[_0xba5d('0xf')],'src':_0x303046[_0xba5d('0x3e')]||_0x303046[_0xba5d('0x23')],'url':_0x303046[_0xba5d('0x26')]+_0xba5d('0x27')+_0x432f12['id']+_0xba5d('0x28')+_0x303046[_0xba5d('0x29')]};var _0x2849bc=util['format'](_0xba5d('0x4a'),_0x303046[_0xba5d('0x4b')],_0x303046['authToken']);var _0x3ae5ec={'method':_0xba5d('0x36'),'uri':util[_0xba5d('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x303046[_0xba5d('0x4b')]),'body':_0x5268f8,'headers':{'Authorization':util[_0xba5d('0x44')](_0xba5d('0x4c'),new Buffer(_0x2849bc)['toString'](_0xba5d('0x4d')))},'json':!![]};rp(_0x3ae5ec)[_0xba5d('0x19')](function(_0x3e136b){var _0x4add5d={'messageId':_0x3e136b[_0xba5d('0x4e')][0x0]};return _0x1b840e['update'](_0x4add5d);})[_0xba5d('0x1d')](function(_0x1723de){logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x49'),util['inspect'](_0x1723de,{'showHidden':![],'depth':null}));});}else{logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x49'),_0xba5d('0x4f'));}break;case _0xba5d('0x50'):if(_0x303046['username']&&_0x303046[_0xba5d('0x30')]){if(_0x303046['baseUrl']){var _0x50a577={'method':_0xba5d('0x36'),'uri':_0x303046[_0xba5d('0x51')]+'/auth/1/session','body':{'username':_0x303046['username'],'password':_0x303046['password']},'json':!![]};return rp(_0x50a577)[_0xba5d('0x19')](function(_0x53264b){var _0x299648={'method':_0xba5d('0x36'),'uri':_0x303046['baseUrl']+_0xba5d('0x52'),'body':{'messages':[{'from':_0x303046[_0xba5d('0x23')],'destinations':[{'to':_0x432f12[_0xba5d('0x23')]}],'text':_0x432f12['body'],'notifyUrl':_0x303046['remote']+'/api/sms/messages/'+_0x432f12['id']+'/status?token='+_0x303046[_0xba5d('0x29')],'notifyContentType':_0xba5d('0x53'),'callbackData':_0x303046[_0xba5d('0x23')]+';'+_0x432f12[_0xba5d('0xf')]}]},'headers':{'Authorization':_0xba5d('0x54')+_0x53264b[_0xba5d('0x29')]},'json':!![]};return rp(_0x299648)[_0xba5d('0x19')](function(_0x5e8ded){if(_0x5e8ded[_0xba5d('0x24')]){var _0x3247b6={'messageId':_0x5e8ded[_0xba5d('0x24')][0x0][_0xba5d('0xd')]};if(!_0x303046[_0xba5d('0x39')]){_0x3247b6[_0xba5d('0x3a')]=!![];}return _0x1b840e[_0xba5d('0x1a')](_0x3247b6);}else{return logger['error'](_0xba5d('0x2b'),'afterCreate',_0xba5d('0x50'),util[_0xba5d('0x3b')](_0x5e8ded,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3ca844){return logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),'infobip',util[_0xba5d('0x3b')](_0x3ca844,{'showHidden':![],'depth':null}));});}else{logger[_0xba5d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba5d('0x2c'),_0xba5d('0x50'),_0xba5d('0x55'));}}else{logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xba5d('0x56'):var _0x40c4d6=require(_0xba5d('0x57'));if(_0x303046['apiKey']){var _0xc11317={};_0xc11317[_0xba5d('0x58')]=_0x303046[_0xba5d('0x2f')];_0xc11317['phone']=_0x432f12[_0xba5d('0x23')];_0xc11317[_0xba5d('0x32')]=_0x303046['phone'];_0xc11317[_0xba5d('0x59')]=_0x432f12[_0xba5d('0xf')];_0xc11317[_0xba5d('0x5a')]=+new Date();var _0x20bfb3='';var _0x4b1bac='';var _0x3ac838=Object[_0xba5d('0x5b')](_0xc11317);_0x3ac838[_0xba5d('0x5c')]();for(var _0x12916c=0x0;_0x12916c<_0x3ac838[_0xba5d('0x5d')];_0x12916c++){if(_0x20bfb3!=''){_0x20bfb3+='&';}_0x20bfb3+=_0x3ac838[_0x12916c]+'='+encodeURIComponent(_0xc11317[_0x3ac838[_0x12916c]]);_0x4b1bac+=_0xc11317[_0x3ac838[_0x12916c]];}_0x4b1bac+=_0x303046['apiKey'];_0x4b1bac=_0x40c4d6[_0xba5d('0x5e')](_0xba5d('0x5f'))[_0xba5d('0x1a')](_0x4b1bac)['digest'](_0xba5d('0x60'));if(_0x20bfb3!==''){_0x20bfb3+='&';}_0x20bfb3+=_0xba5d('0x61')+_0x4b1bac;var _0x1fa74c={'method':'GET','uri':_0x303046[_0xba5d('0x51')]+'/external/get/send.php?'+_0x20bfb3,'json':!![]};return rp(_0x1fa74c)[_0xba5d('0x19')](function(_0x2916f7){var _0x2ddbd0=Object[_0xba5d('0x5b')](_0x2916f7);if(_0x2916f7[_0x2ddbd0[0x0]][_0xba5d('0x1e')]&&parseInt(_0x2916f7[_0x2ddbd0[0x0]][_0xba5d('0x1e')])===0x0){var _0x22eed4={'messageId':_0x2916f7[_0x2ddbd0[0x0]]['id_sms']};if(!_0x303046[_0xba5d('0x39')]){_0x22eed4['read']=!![];}return _0x1b840e[_0xba5d('0x1a')](_0x22eed4);}else{return logger[_0xba5d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba5d('0x2c'),'csc',util['inspect'](_0x2916f7[_0xba5d('0x1e')],{'showHidden':![],'depth':null}));}})[_0xba5d('0x1d')](function(_0x441c6d){return logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x56'),util[_0xba5d('0x3b')](_0x441c6d,{'showHidden':![],'depth':null}));});}else{logger[_0xba5d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba5d('0x2c'),'csc',_0xba5d('0x62'));}break;case'clickatell':if(_0x303046[_0xba5d('0x63')]){var _0x28be81={'method':_0xba5d('0x36'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x303046[_0xba5d('0x63')]},'body':{'content':_0x432f12[_0xba5d('0xf')],'to':[_0x432f12['phone']],'from':_0x303046[_0xba5d('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0xba5d('0x64')},'json':!![]};rp(_0x28be81)['then'](function(_0xae9d9d){if(!_0xae9d9d[_0xba5d('0x1e')]){var _0x115884={'messageId':_0xae9d9d[_0xba5d('0x24')][0x0][_0xba5d('0x65')]};if(!_0x303046[_0xba5d('0x39')]){_0x115884[_0xba5d('0x3a')]=!![];}return _0x1b840e[_0xba5d('0x1a')](_0x115884);}else{return logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x66'),util[_0xba5d('0x3b')](_0xae9d9d[_0xba5d('0x1e')],{'showHidden':![],'depth':null}));}})[_0xba5d('0x1d')](function(_0x346529){return logger['error'](_0xba5d('0x2b'),_0xba5d('0x2c'),'clickatell',util[_0xba5d('0x3b')](_0x346529,{'showHidden':![],'depth':null}));});}else{logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x66'),_0xba5d('0x62'));}break;case _0xba5d('0x67'):if(_0x303046[_0xba5d('0x2f')]&&_0x303046[_0xba5d('0x30')]){var _0x2849bc=util['format']('%s:%s',_0x303046[_0xba5d('0x2f')],_0x303046[_0xba5d('0x30')]);var _0x3ae5ec={'method':_0xba5d('0x36'),'uri':_0xba5d('0x68')+_0x303046[_0xba5d('0x69')]+_0xba5d('0x6a'),'body':{'to':[_0x432f12['phone']],'text':_0x432f12[_0xba5d('0xf')],'from':_0x303046['phone'],'applicationId':_0x303046[_0xba5d('0x6b')]},'headers':{'Authorization':util['format'](_0xba5d('0x4c'),new Buffer(_0x2849bc)[_0xba5d('0x45')](_0xba5d('0x4d')))},'json':!![]};rp(_0x3ae5ec)[_0xba5d('0x19')](function(_0x1faaad){if(_0x1faaad['id']){var _0x35b850={'messageId':_0x1faaad['id']};return _0x1b840e[_0xba5d('0x1a')](_0x35b850);}else{logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x67'),util[_0xba5d('0x3b')](_0x1faaad,{'showHidden':![],'depth':null}));}})['catch'](function(_0x153db1){logger[_0xba5d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba5d('0x2c'),_0xba5d('0x67'),util['inspect'](_0x153db1,{'showHidden':![],'depth':null}));});}else{logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x67'),_0xba5d('0x3c'));}break;case'intelepeer':if(_0x303046[_0xba5d('0x63')]){var _0x1fc20d={};var _0x1fa74c={'method':_0xba5d('0x36'),'uri':_0xba5d('0x6c'),'headers':{'Authorization':_0xba5d('0x6d')+_0x303046[_0xba5d('0x63')],'Content-Type':'application/json'},'body':{'from':_0x303046[_0xba5d('0x23')],'to':_0x432f12[_0xba5d('0x23')],'text':_0x432f12['body']},'json':!![]};return rp(_0x1fa74c)[_0xba5d('0x19')](function(_0x5417f2){if(_0x5417f2[_0xba5d('0x6e')]==0xca){_0x1fc20d['message']=_0x5417f2;var _0x212fde={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xba5d('0x6d')+_0x303046['apiKey'],'Content-Type':_0xba5d('0x53')},'body':{'refid':_0x1fc20d['message']['refid']},'json':!![]};return rp(_0x212fde)[_0xba5d('0x19')](function(_0x1ee676){_0x1fc20d[_0xba5d('0x6f')]=_0x1ee676;var _0x5ea0e9={'messageId':_0x1fc20d[_0xba5d('0x70')][_0xba5d('0x71')],'read':!![]};return _0x1b840e[_0xba5d('0x1a')](_0x5ea0e9);});}else{return logger[_0xba5d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba5d('0x2c'),_0xba5d('0x72'),util[_0xba5d('0x3b')](_0x5417f2,{'showHidden':![],'depth':null}));}})[_0xba5d('0x1d')](function(_0x481eb6){return logger[_0xba5d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba5d('0x2c'),_0xba5d('0x72'),util[_0xba5d('0x3b')](_0x481eb6,{'showHidden':![],'depth':null}));});}else{return logger[_0xba5d('0x1e')](_0xba5d('0x2b'),_0xba5d('0x2c'),_0xba5d('0x72'),_0xba5d('0x73'));}break;}}})[_0xba5d('0x74')](function(){_0x3fd97d();});}else{_0x3fd97d();}}},'charset':_0xba5d('0x75'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 9b042c9..e4e709a 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 _0xaae9=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x448ea4,_0x2bea35){var _0x387319=function(_0x4356a3){while(--_0x4356a3){_0x448ea4['push'](_0x448ea4['shift']());}};_0x387319(++_0x2bea35);}(_0xaae9,0xcb));var _0x9aae=function(_0x5a9830,_0x4409ae){_0x5a9830=_0x5a9830-0x0;var _0x1256c2=_0xaae9[_0x5a9830];return _0x1256c2;};'use strict';var _=require('lodash');var util=require(_0x9aae('0x0'));var moment=require('moment');var BPromise=require(_0x9aae('0x1'));var rs=require(_0x9aae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9aae('0x3'))['db'];var utils=require(_0x9aae('0x4'));var logger=require(_0x9aae('0x5'))(_0x9aae('0x6'));var config=require(_0x9aae('0x7'));var jayson=require(_0x9aae('0x8'));var client=jayson[_0x9aae('0x9')][_0x9aae('0xa')]({'port':0x232a});config[_0x9aae('0xb')]=_[_0x9aae('0xc')](config[_0x9aae('0xb')],{'host':_0x9aae('0xd'),'port':0x18eb});var socket=require(_0x9aae('0xe'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x9aae('0xf')](socket);function respondWithRpcPromise(_0x56de73,_0x4ba483,_0x3594a3){return new BPromise(function(_0x23500a,_0x4734fd){return client[_0x9aae('0x10')](_0x56de73,_0x3594a3)[_0x9aae('0x11')](function(_0x5a00b2){logger[_0x9aae('0x12')](_0x9aae('0x13'),_0x4ba483,_0x9aae('0x14'));logger['debug'](_0x9aae('0x15'),_0x4ba483,'request\x20sent',JSON[_0x9aae('0x16')](_0x5a00b2));if(_0x5a00b2[_0x9aae('0x17')]){if(_0x5a00b2[_0x9aae('0x17')][_0x9aae('0x18')]===0x1f4){logger[_0x9aae('0x17')]('SmsMessage,\x20%s,\x20%s',_0x4ba483,_0x5a00b2['error']['message']);return _0x4734fd(_0x5a00b2[_0x9aae('0x17')][_0x9aae('0x19')]);}logger[_0x9aae('0x17')](_0x9aae('0x13'),_0x4ba483,_0x5a00b2['error']['message']);return _0x23500a(_0x5a00b2['error'][_0x9aae('0x19')]);}else{logger[_0x9aae('0x12')]('SmsMessage,\x20%s,\x20%s',_0x4ba483,_0x9aae('0x14'));_0x23500a(_0x5a00b2[_0x9aae('0x1a')][_0x9aae('0x19')]);}})[_0x9aae('0x1b')](function(_0x325298){logger['error'](_0x9aae('0x13'),_0x4ba483,_0x325298);_0x4734fd(_0x325298);});});}exports[_0x9aae('0x1c')]=function(_0x4129c6){var _0x129927=this;return new Promise(function(_0x2267ee,_0xe45b49){return db[_0x9aae('0x1d')][_0x9aae('0x1e')](_0x4129c6[_0x9aae('0x1f')],{'raw':_0x4129c6[_0x9aae('0x20')]?_0x4129c6[_0x9aae('0x20')][_0x9aae('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x4aa2d7){logger[_0x9aae('0x12')](_0x9aae('0x1c'),_0x4129c6);logger[_0x9aae('0x22')]('CreateSmsMessage',_0x4129c6,JSON['stringify'](_0x4aa2d7));_0x2267ee(_0x4aa2d7);})[_0x9aae('0x1b')](function(_0x435725){logger['error']('CreateSmsMessage',_0x435725[_0x9aae('0x19')],_0x4129c6);_0xe45b49(_0x129927[_0x9aae('0x17')](0x1f4,_0x435725[_0x9aae('0x19')]));});});}; \ No newline at end of file +var _0xd983=['message','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','debug','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','then','info','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s'];(function(_0x21930d,_0x18339a){var _0x2b286b=function(_0x2a3250){while(--_0x2a3250){_0x21930d['push'](_0x21930d['shift']());}};_0x2b286b(++_0x18339a);}(_0xd983,0x182));var _0x3d98=function(_0x53fb8b,_0x39ba63){_0x53fb8b=_0x53fb8b-0x0;var _0x5da8e0=_0xd983[_0x53fb8b];return _0x5da8e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3d98('0x0'));var BPromise=require('bluebird');var rs=require(_0x3d98('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3d98('0x2'))(_0x3d98('0x3'));var config=require(_0x3d98('0x4'));var jayson=require(_0x3d98('0x5'));var client=jayson[_0x3d98('0x6')][_0x3d98('0x7')]({'port':0x232a});config[_0x3d98('0x8')]=_[_0x3d98('0x9')](config[_0x3d98('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d98('0xa'))(new Redis(config[_0x3d98('0x8')]));require(_0x3d98('0xb'))[_0x3d98('0xc')](socket);function respondWithRpcPromise(_0x10f5c1,_0x270244,_0x3dfa21){return new BPromise(function(_0x53b741,_0x5ab42e){return client['request'](_0x10f5c1,_0x3dfa21)[_0x3d98('0xd')](function(_0x318e11){logger[_0x3d98('0xe')]('SmsMessage,\x20%s,\x20%s',_0x270244,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x270244,_0x3d98('0xf'),JSON[_0x3d98('0x10')](_0x318e11));if(_0x318e11[_0x3d98('0x11')]){if(_0x318e11[_0x3d98('0x11')][_0x3d98('0x12')]===0x1f4){logger[_0x3d98('0x11')](_0x3d98('0x13'),_0x270244,_0x318e11[_0x3d98('0x11')][_0x3d98('0x14')]);return _0x5ab42e(_0x318e11[_0x3d98('0x11')][_0x3d98('0x14')]);}logger['error'](_0x3d98('0x13'),_0x270244,_0x318e11[_0x3d98('0x11')][_0x3d98('0x14')]);return _0x53b741(_0x318e11['error']['message']);}else{logger[_0x3d98('0xe')](_0x3d98('0x13'),_0x270244,_0x3d98('0xf'));_0x53b741(_0x318e11[_0x3d98('0x15')]['message']);}})[_0x3d98('0x16')](function(_0x540651){logger['error'](_0x3d98('0x13'),_0x270244,_0x540651);_0x5ab42e(_0x540651);});});}exports[_0x3d98('0x17')]=function(_0x2fa042){var _0x2ec4fe=this;return new Promise(function(_0x5803a6,_0x19bdc8){return db[_0x3d98('0x18')]['create'](_0x2fa042[_0x3d98('0x19')],{'raw':_0x2fa042[_0x3d98('0x1a')]?_0x2fa042[_0x3d98('0x1a')][_0x3d98('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x32e2a0){logger[_0x3d98('0xe')](_0x3d98('0x17'),_0x2fa042);logger[_0x3d98('0x1c')](_0x3d98('0x17'),_0x2fa042,JSON[_0x3d98('0x10')](_0x32e2a0));_0x5803a6(_0x32e2a0);})[_0x3d98('0x16')](function(_0x21166c){logger[_0x3d98('0x11')]('CreateSmsMessage',_0x21166c[_0x3d98('0x14')],_0x2fa042);_0x19bdc8(_0x2ec4fe[_0x3d98('0x11')](0x1f4,_0x21166c[_0x3d98('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index fcc51c6..1f10371 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 _0x9cac=['removeListener','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9cac,0x176));var _0xc9ca=function(_0x518d3d,_0x4888ab){_0x518d3d=_0x518d3d-0x0;var _0xeb10d9=_0x9cac[_0x518d3d];return _0xeb10d9;};'use strict';var SmsMessageEvents=require(_0xc9ca('0x0'));var events=[_0xc9ca('0x1'),_0xc9ca('0x2'),_0xc9ca('0x3')];function createListener(_0x25f377,_0x2d9459){return function(_0x1a431d){_0x2d9459['emit'](_0x25f377,_0x1a431d);};}function removeListener(_0x4fa4e6,_0x32b9a8){return function(){SmsMessageEvents[_0xc9ca('0x4')](_0x4fa4e6,_0x32b9a8);};}exports['register']=function(_0x3cee92){for(var _0x2f90e0=0x0,_0x7b4a63=events[_0xc9ca('0x5')];_0x2f90e0<_0x7b4a63;_0x2f90e0++){var _0x379332=events[_0x2f90e0];var _0x1e9502=createListener(_0xc9ca('0x6')+_0x379332,_0x3cee92);SmsMessageEvents['on'](_0x379332,_0x1e9502);}}; \ No newline at end of file +var _0x2c46=['emit','register','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x5cc7d9,_0x2315c8){var _0x476e21=function(_0x2e5efe){while(--_0x2e5efe){_0x5cc7d9['push'](_0x5cc7d9['shift']());}};_0x476e21(++_0x2315c8);}(_0x2c46,0x1e4));var _0x62c4=function(_0x2106be,_0x5eb545){_0x2106be=_0x2106be-0x0;var _0x2a0be9=_0x2c46[_0x2106be];return _0x2a0be9;};'use strict';var SmsMessageEvents=require(_0x62c4('0x0'));var events=[_0x62c4('0x1'),_0x62c4('0x2'),_0x62c4('0x3')];function createListener(_0x2a20d2,_0x545069){return function(_0x42060c){_0x545069[_0x62c4('0x4')](_0x2a20d2,_0x42060c);};}function removeListener(_0x925740,_0x16c19b){return function(){SmsMessageEvents['removeListener'](_0x925740,_0x16c19b);};}exports[_0x62c4('0x5')]=function(_0x410185){for(var _0x528d95=0x0,_0x2b4fd0=events[_0x62c4('0x6')];_0x528d95<_0x2b4fd0;_0x528d95++){var _0x3ce442=events[_0x528d95];var _0x312482=createListener(_0x62c4('0x7')+_0x3ce442,_0x410185);SmsMessageEvents['on'](_0x3ce442,_0x312482);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 93a27d4..ba373c7 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 _0xdff1=['addAgents','put','update','delete','destroy','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x302156,_0x37990d){var _0x2d4b3f=function(_0x36cfb7){while(--_0x36cfb7){_0x302156['push'](_0x302156['shift']());}};_0x2d4b3f(++_0x37990d);}(_0xdff1,0x1d2));var _0x1dff=function(_0xb5f5ab,_0x3415af){_0xb5f5ab=_0xb5f5ab-0x0;var _0x59bef6=_0xdff1[_0xb5f5ab];return _0x59bef6;};'use strict';var multer=require(_0x1dff('0x0'));var util=require('util');var path=require(_0x1dff('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1dff('0x2')]();var fs_extra=require(_0x1dff('0x3'));var auth=require(_0x1dff('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1dff('0x5'));var controller=require(_0x1dff('0x6'));router[_0x1dff('0x7')]('/',auth['isAuthenticated'](),controller[_0x1dff('0x8')]);router[_0x1dff('0x7')](_0x1dff('0x9'),auth[_0x1dff('0xa')](),controller['describe']);router[_0x1dff('0x7')](_0x1dff('0xb'),auth[_0x1dff('0xa')](),controller[_0x1dff('0xc')]);router['get']('/:id/members',auth[_0x1dff('0xa')](),controller[_0x1dff('0xd')]);router[_0x1dff('0x7')](_0x1dff('0xe'),auth['isAuthenticated'](),controller[_0x1dff('0xf')]);router[_0x1dff('0x7')](_0x1dff('0x10'),auth['isAuthenticated'](),controller[_0x1dff('0x11')]);router[_0x1dff('0x12')]('/',auth[_0x1dff('0xa')](),controller[_0x1dff('0x13')]);router['post'](_0x1dff('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0x1dff('0xa')](),controller[_0x1dff('0x14')]);router[_0x1dff('0x15')](_0x1dff('0xb'),auth[_0x1dff('0xa')](),controller[_0x1dff('0x16')]);router[_0x1dff('0x17')](_0x1dff('0xb'),auth[_0x1dff('0xa')](),controller[_0x1dff('0x18')]);router['delete'](_0x1dff('0xe'),auth[_0x1dff('0xa')](),controller['removeTeams']);router[_0x1dff('0x17')](_0x1dff('0x10'),auth[_0x1dff('0xa')](),controller[_0x1dff('0x19')]);module[_0x1dff('0x1a')]=router; \ No newline at end of file +var _0xd783=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd783,0x9e));var _0x3d78=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0xd783[_0x3d78d7];return _0x4b6784;};'use strict';var multer=require(_0x3d78('0x0'));var util=require(_0x3d78('0x1'));var path=require('path');var timeout=require(_0x3d78('0x2'));var express=require(_0x3d78('0x3'));var router=express[_0x3d78('0x4')]();var fs_extra=require(_0x3d78('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3d78('0x6'));var controller=require(_0x3d78('0x7'));router[_0x3d78('0x8')]('/',auth[_0x3d78('0x9')](),controller[_0x3d78('0xa')]);router['get'](_0x3d78('0xb'),auth[_0x3d78('0x9')](),controller[_0x3d78('0xc')]);router[_0x3d78('0x8')](_0x3d78('0xd'),auth['isAuthenticated'](),controller[_0x3d78('0xe')]);router['get'](_0x3d78('0xf'),auth[_0x3d78('0x9')](),controller['getMembers']);router[_0x3d78('0x8')](_0x3d78('0x10'),auth[_0x3d78('0x9')](),controller[_0x3d78('0x11')]);router[_0x3d78('0x8')](_0x3d78('0x12'),auth['isAuthenticated'](),controller[_0x3d78('0x13')]);router[_0x3d78('0x14')]('/',auth['isAuthenticated'](),controller[_0x3d78('0x15')]);router['post'](_0x3d78('0x10'),auth['isAuthenticated'](),controller[_0x3d78('0x16')]);router[_0x3d78('0x14')](_0x3d78('0x12'),auth[_0x3d78('0x9')](),controller[_0x3d78('0x17')]);router[_0x3d78('0x18')](_0x3d78('0xd'),auth[_0x3d78('0x9')](),controller['update']);router[_0x3d78('0x19')]('/:id',auth[_0x3d78('0x9')](),controller['destroy']);router[_0x3d78('0x19')](_0x3d78('0x10'),auth[_0x3d78('0x9')](),controller[_0x3d78('0x1a')]);router[_0x3d78('0x19')](_0x3d78('0x12'),auth[_0x3d78('0x9')](),controller[_0x3d78('0x1b')]);module[_0x3d78('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7b3e7fd..cb2a06b 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 _0x9844=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x890d3a,_0x45b788){var _0x866513=function(_0x43a1c7){while(--_0x43a1c7){_0x890d3a['push'](_0x890d3a['shift']());}};_0x866513(++_0x45b788);}(_0x9844,0x122));var _0x4984=function(_0x439c99,_0x4ab659){_0x439c99=_0x439c99-0x0;var _0x30df93=_0x9844[_0x439c99];return _0x30df93;};'use strict';var Sequelize=require(_0x4984('0x0'));module[_0x4984('0x1')]={'name':{'type':Sequelize[_0x4984('0x2')],'unique':_0x4984('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4984('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4984('0x4')](_0x4984('0x5'),_0x4984('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xf27d=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x4934ef,_0x51b5c6){var _0x4bd77e=function(_0x47a3fb){while(--_0x47a3fb){_0x4934ef['push'](_0x4934ef['shift']());}};_0x4bd77e(++_0x51b5c6);}(_0xf27d,0x197));var _0xdf27=function(_0x164b06,_0x4a3052){_0x164b06=_0x164b06-0x0;var _0x1e122a=_0xf27d[_0x164b06];return _0x1e122a;};'use strict';var Sequelize=require(_0xdf27('0x0'));module[_0xdf27('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdf27('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdf27('0x3')]},'timeout':{'type':Sequelize[_0xdf27('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdf27('0x5')](_0xdf27('0x6'),_0xdf27('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index d670e38..093e2ea 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 _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x2032,0xd9));var _0x2203=function(_0x91998d,_0x3e840f){_0x91998d=_0x91998d-0x0;var _0x65efb5=_0x2032[_0x91998d];return _0x65efb5;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file +var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2242a1,_0x38f44d){_0x2242a1=_0x2242a1-0x0;var _0x2c298b=_0x0b0e[_0x2242a1];return _0x2c298b;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 1dcc93b..7f437d1 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 _0xf450=['events','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3902e5,_0x1a20dd){var _0x3cd7f4=function(_0x5acd5d){while(--_0x5acd5d){_0x3902e5['push'](_0x3902e5['shift']());}};_0x3cd7f4(++_0x1a20dd);}(_0xf450,0xdc));var _0x0f45=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf450[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x0f45('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x0f45('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x0f45('0x2')](0x0);var events={'afterCreate':_0x0f45('0x3'),'afterUpdate':_0x0f45('0x4'),'afterDestroy':_0x0f45('0x5')};function emitEvent(_0x3d4688){return function(_0x3cb929,_0xd3c62b,_0x424847){SmsQueueEvents[_0x0f45('0x6')](_0x3d4688+':'+_0x3cb929['id'],_0x3cb929);SmsQueueEvents[_0x0f45('0x6')](_0x3d4688,_0x3cb929);_0x424847(null);};}for(var e in events){if(events[_0x0f45('0x7')](e)){var event=events[e];SmsQueue[_0x0f45('0x8')](e,emitEvent(event));}}module[_0x0f45('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xa24e=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa24e,0x145));var _0xea24=function(_0x1dff39,_0x1cf83c){_0x1dff39=_0x1dff39-0x0;var _0x18bc86=_0xa24e[_0x1dff39];return _0x18bc86;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xea24('0x0'))['db'][_0xea24('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xea24('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xea24('0x3'),'afterDestroy':'remove'};function emitEvent(_0x20c119){return function(_0x558dd5,_0x53d55c,_0x3b3ad1){SmsQueueEvents[_0xea24('0x4')](_0x20c119+':'+_0x558dd5['id'],_0x558dd5);SmsQueueEvents[_0xea24('0x4')](_0x20c119,_0x558dd5);_0x3b3ad1(null);};}for(var e in events){if(events[_0xea24('0x5')](e)){var event=events[e];SmsQueue[_0xea24('0x6')](e,emitEvent(event));}}module[_0xea24('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c698830..cc6190e 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 _0x6f26=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','SmsQueue','sms_queues','lodash','util'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6f26,0x112));var _0x66f2=function(_0x5eb92c,_0x48cb85){_0x5eb92c=_0x5eb92c-0x0;var _0x4338db=_0x6f26[_0x5eb92c];return _0x4338db;};'use strict';var _=require(_0x66f2('0x0'));var util=require(_0x66f2('0x1'));var logger=require(_0x66f2('0x2'))(_0x66f2('0x3'));var moment=require(_0x66f2('0x4'));var BPromise=require(_0x66f2('0x5'));var rp=require(_0x66f2('0x6'));var fs=require('fs');var path=require(_0x66f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x66f2('0x8')]=function(_0x39f276,_0x5edc58){return _0x39f276[_0x66f2('0x9')](_0x66f2('0xa'),attributes,{'tableName':_0x66f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54fd=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','SmsQueue','sms_queues','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x54fd,0x1e3));var _0xd54f=function(_0x425169,_0x995f89){_0x425169=_0x425169-0x0;var _0x3cf196=_0x54fd[_0x425169];return _0x3cf196;};'use strict';var _=require(_0xd54f('0x0'));var util=require('util');var logger=require(_0xd54f('0x1'))(_0xd54f('0x2'));var moment=require(_0xd54f('0x3'));var BPromise=require(_0xd54f('0x4'));var rp=require(_0xd54f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd54f('0x6'));var attributes=require('./smsQueue.attributes');module[_0xd54f('0x7')]=function(_0x198016,_0xd3466d){return _0x198016[_0xd54f('0x8')](_0xd54f('0x9'),attributes,{'tableName':_0xd54f('0xa'),'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 b4b94cb..685983b 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 _0xb5bc=['message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowSmsQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb5bc,0x195));var _0xcb5b=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0xb5bc[_0x34232c];return _0x4d4f4e;};'use strict';var _=require(_0xcb5b('0x0'));var util=require(_0xcb5b('0x1'));var moment=require(_0xcb5b('0x2'));var BPromise=require(_0xcb5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb5b('0x4'));var db=require(_0xcb5b('0x5'))['db'];var utils=require(_0xcb5b('0x6'));var logger=require(_0xcb5b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcb5b('0x8'));var client=jayson[_0xcb5b('0x9')]['http']({'port':0x232a});config[_0xcb5b('0xa')]=_[_0xcb5b('0xb')](config[_0xcb5b('0xa')],{'host':_0xcb5b('0xc'),'port':0x18eb});var socket=require(_0xcb5b('0xd'))(new Redis(config[_0xcb5b('0xa')]));require(_0xcb5b('0xe'))[_0xcb5b('0xf')](socket);function respondWithRpcPromise(_0x53f4e1,_0x2cc5bd,_0x1565f5){return new BPromise(function(_0x5dfea5,_0x12bda4){return client['request'](_0x53f4e1,_0x1565f5)['then'](function(_0x4ffee9){logger[_0xcb5b('0x10')](_0xcb5b('0x11'),_0x2cc5bd,_0xcb5b('0x12'));logger[_0xcb5b('0x13')](_0xcb5b('0x14'),_0x2cc5bd,_0xcb5b('0x12'),JSON[_0xcb5b('0x15')](_0x4ffee9));if(_0x4ffee9['error']){if(_0x4ffee9[_0xcb5b('0x16')][_0xcb5b('0x17')]===0x1f4){logger[_0xcb5b('0x16')](_0xcb5b('0x11'),_0x2cc5bd,_0x4ffee9[_0xcb5b('0x16')][_0xcb5b('0x18')]);return _0x12bda4(_0x4ffee9[_0xcb5b('0x16')][_0xcb5b('0x18')]);}logger['error'](_0xcb5b('0x11'),_0x2cc5bd,_0x4ffee9[_0xcb5b('0x16')]['message']);return _0x5dfea5(_0x4ffee9['error'][_0xcb5b('0x18')]);}else{logger[_0xcb5b('0x10')](_0xcb5b('0x11'),_0x2cc5bd,_0xcb5b('0x12'));_0x5dfea5(_0x4ffee9['result']['message']);}})[_0xcb5b('0x19')](function(_0x535f2b){logger[_0xcb5b('0x16')](_0xcb5b('0x11'),_0x2cc5bd,_0x535f2b);_0x12bda4(_0x535f2b);});});}exports[_0xcb5b('0x1a')]=function(_0x47ac1e){var _0x5b1b9e=this;return new Promise(function(_0x5129d6,_0x18a030){return db[_0xcb5b('0x1b')][_0xcb5b('0x1c')]({'raw':_0x47ac1e[_0xcb5b('0x1d')]?_0x47ac1e[_0xcb5b('0x1d')][_0xcb5b('0x1e')]===undefined?!![]:![]:!![],'where':_0x47ac1e['options']?_0x47ac1e[_0xcb5b('0x1d')][_0xcb5b('0x1f')]||null:null,'attributes':_0x47ac1e[_0xcb5b('0x1d')]?_0x47ac1e[_0xcb5b('0x1d')][_0xcb5b('0x20')]||null:null,'limit':_0x47ac1e[_0xcb5b('0x1d')]?_0x47ac1e[_0xcb5b('0x1d')][_0xcb5b('0x21')]||null:null,'include':_0x47ac1e[_0xcb5b('0x1d')]?_0x47ac1e[_0xcb5b('0x1d')][_0xcb5b('0x22')]?_[_0xcb5b('0x23')](_0x47ac1e['options'][_0xcb5b('0x22')],function(_0x7a3903){return{'model':db[_0x7a3903['model']],'as':_0x7a3903['as'],'attributes':_0x7a3903[_0xcb5b('0x20')],'include':_0x7a3903[_0xcb5b('0x22')]?_[_0xcb5b('0x23')](_0x7a3903[_0xcb5b('0x22')],function(_0x53fc0a){return{'model':db[_0x53fc0a[_0xcb5b('0x24')]],'as':_0x53fc0a['as'],'attributes':_0x53fc0a[_0xcb5b('0x20')],'include':_0x53fc0a[_0xcb5b('0x22')]?_[_0xcb5b('0x23')](_0x53fc0a[_0xcb5b('0x22')],function(_0x280c89){return{'model':db[_0x280c89[_0xcb5b('0x24')]],'as':_0x280c89['as'],'attributes':_0x280c89[_0xcb5b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcb5b('0x25')](function(_0xf5fe9e){logger['info'](_0xcb5b('0x1a'),_0x47ac1e);logger[_0xcb5b('0x13')]('GetSmsQueue',_0x47ac1e,JSON[_0xcb5b('0x15')](_0xf5fe9e));_0x5129d6(_0xf5fe9e);})[_0xcb5b('0x19')](function(_0x327d24){logger['error'](_0xcb5b('0x1a'),_0x327d24[_0xcb5b('0x18')],_0x47ac1e);_0x18a030(_0x5b1b9e[_0xcb5b('0x16')](0x1f4,_0x327d24['message']));});});};exports[_0xcb5b('0x26')]=function(_0x3078c7){var _0x27ba0b=this;return new Promise(function(_0x27df55,_0x12ac93){return db['SmsQueue']['find']({'raw':_0x3078c7[_0xcb5b('0x1d')]?_0x3078c7[_0xcb5b('0x1d')][_0xcb5b('0x1e')]===undefined?!![]:![]:!![],'where':_0x3078c7[_0xcb5b('0x1d')]?_0x3078c7['options'][_0xcb5b('0x1f')]||null:null,'attributes':_0x3078c7[_0xcb5b('0x1d')]?_0x3078c7[_0xcb5b('0x1d')][_0xcb5b('0x20')]||null:null,'include':_0x3078c7[_0xcb5b('0x1d')]?_0x3078c7['options'][_0xcb5b('0x22')]?_[_0xcb5b('0x23')](_0x3078c7[_0xcb5b('0x1d')]['include'],function(_0x765958){return{'model':db[_0x765958[_0xcb5b('0x24')]],'as':_0x765958['as'],'attributes':_0x765958[_0xcb5b('0x20')],'include':_0x765958[_0xcb5b('0x22')]?_[_0xcb5b('0x23')](_0x765958[_0xcb5b('0x22')],function(_0x365e93){return{'model':db[_0x365e93['model']],'as':_0x365e93['as'],'attributes':_0x365e93[_0xcb5b('0x20')],'include':_0x365e93[_0xcb5b('0x22')]?_[_0xcb5b('0x23')](_0x365e93['include'],function(_0x353ead){return{'model':db[_0x353ead[_0xcb5b('0x24')]],'as':_0x353ead['as'],'attributes':_0x353ead['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x890972){logger[_0xcb5b('0x10')]('ShowSmsQueue',_0x3078c7);logger[_0xcb5b('0x13')](_0xcb5b('0x26'),_0x3078c7,JSON['stringify'](_0x890972));_0x27df55(_0x890972);})[_0xcb5b('0x19')](function(_0x1d07ac){logger[_0xcb5b('0x16')](_0xcb5b('0x26'),_0x1d07ac['message'],_0x3078c7);_0x12ac93(_0x27ba0b[_0xcb5b('0x16')](0x1f4,_0x1d07ac[_0xcb5b('0x18')]));});});}; \ No newline at end of file +var _0xb702=['request\x20sent','stringify','error','message','result','GetSmsQueue','SmsQueue','findAll','options','where','attributes','model','include','map','ShowSmsQueue','find','raw','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0x2e9975,_0x5e07c7){var _0x50c0c9=function(_0x192e8c){while(--_0x192e8c){_0x2e9975['push'](_0x2e9975['shift']());}};_0x50c0c9(++_0x5e07c7);}(_0xb702,0x1c1));var _0x2b70=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0xb702[_0x1c8cc6];return _0x522936;};'use strict';var _=require('lodash');var util=require(_0x2b70('0x0'));var moment=require(_0x2b70('0x1'));var BPromise=require(_0x2b70('0x2'));var rs=require(_0x2b70('0x3'));var fs=require('fs');var Redis=require(_0x2b70('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2b70('0x5'));var config=require(_0x2b70('0x6'));var jayson=require(_0x2b70('0x7'));var client=jayson[_0x2b70('0x8')]['http']({'port':0x232a});config['redis']=_[_0x2b70('0x9')](config['redis'],{'host':_0x2b70('0xa'),'port':0x18eb});var socket=require(_0x2b70('0xb'))(new Redis(config[_0x2b70('0xc')]));require(_0x2b70('0xd'))[_0x2b70('0xe')](socket);function respondWithRpcPromise(_0xa9b3d7,_0x358f7b,_0x5c1402){return new BPromise(function(_0x27c57a,_0x21928c){return client[_0x2b70('0xf')](_0xa9b3d7,_0x5c1402)[_0x2b70('0x10')](function(_0x4baded){logger[_0x2b70('0x11')](_0x2b70('0x12'),_0x358f7b,_0x2b70('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x358f7b,_0x2b70('0x13'),JSON[_0x2b70('0x14')](_0x4baded));if(_0x4baded[_0x2b70('0x15')]){if(_0x4baded[_0x2b70('0x15')]['code']===0x1f4){logger[_0x2b70('0x15')]('SmsQueue,\x20%s,\x20%s',_0x358f7b,_0x4baded[_0x2b70('0x15')][_0x2b70('0x16')]);return _0x21928c(_0x4baded['error'][_0x2b70('0x16')]);}logger[_0x2b70('0x15')](_0x2b70('0x12'),_0x358f7b,_0x4baded['error'][_0x2b70('0x16')]);return _0x27c57a(_0x4baded[_0x2b70('0x15')][_0x2b70('0x16')]);}else{logger[_0x2b70('0x11')](_0x2b70('0x12'),_0x358f7b,'request\x20sent');_0x27c57a(_0x4baded[_0x2b70('0x17')]['message']);}})['catch'](function(_0x273c5a){logger[_0x2b70('0x15')](_0x2b70('0x12'),_0x358f7b,_0x273c5a);_0x21928c(_0x273c5a);});});}exports[_0x2b70('0x18')]=function(_0x5de871){var _0x4b6646=this;return new Promise(function(_0x1791c6,_0x1c6607){return db[_0x2b70('0x19')][_0x2b70('0x1a')]({'raw':_0x5de871[_0x2b70('0x1b')]?_0x5de871[_0x2b70('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5de871['options']?_0x5de871[_0x2b70('0x1b')][_0x2b70('0x1c')]||null:null,'attributes':_0x5de871[_0x2b70('0x1b')]?_0x5de871[_0x2b70('0x1b')][_0x2b70('0x1d')]||null:null,'limit':_0x5de871[_0x2b70('0x1b')]?_0x5de871['options']['limit']||null:null,'include':_0x5de871[_0x2b70('0x1b')]?_0x5de871[_0x2b70('0x1b')]['include']?_['map'](_0x5de871['options']['include'],function(_0x3fa5df){return{'model':db[_0x3fa5df[_0x2b70('0x1e')]],'as':_0x3fa5df['as'],'attributes':_0x3fa5df['attributes'],'include':_0x3fa5df[_0x2b70('0x1f')]?_[_0x2b70('0x20')](_0x3fa5df[_0x2b70('0x1f')],function(_0x202cd5){return{'model':db[_0x202cd5[_0x2b70('0x1e')]],'as':_0x202cd5['as'],'attributes':_0x202cd5[_0x2b70('0x1d')],'include':_0x202cd5[_0x2b70('0x1f')]?_[_0x2b70('0x20')](_0x202cd5[_0x2b70('0x1f')],function(_0x2f42b7){return{'model':db[_0x2f42b7[_0x2b70('0x1e')]],'as':_0x2f42b7['as'],'attributes':_0x2f42b7[_0x2b70('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2b70('0x10')](function(_0x40dfd1){logger[_0x2b70('0x11')](_0x2b70('0x18'),_0x5de871);logger['debug']('GetSmsQueue',_0x5de871,JSON[_0x2b70('0x14')](_0x40dfd1));_0x1791c6(_0x40dfd1);})['catch'](function(_0x3f630e){logger[_0x2b70('0x15')](_0x2b70('0x18'),_0x3f630e[_0x2b70('0x16')],_0x5de871);_0x1c6607(_0x4b6646[_0x2b70('0x15')](0x1f4,_0x3f630e[_0x2b70('0x16')]));});});};exports[_0x2b70('0x21')]=function(_0x551282){var _0x235c87=this;return new Promise(function(_0x5736a9,_0x3f613e){return db[_0x2b70('0x19')][_0x2b70('0x22')]({'raw':_0x551282['options']?_0x551282[_0x2b70('0x1b')][_0x2b70('0x23')]===undefined?!![]:![]:!![],'where':_0x551282[_0x2b70('0x1b')]?_0x551282[_0x2b70('0x1b')][_0x2b70('0x1c')]||null:null,'attributes':_0x551282[_0x2b70('0x1b')]?_0x551282[_0x2b70('0x1b')][_0x2b70('0x1d')]||null:null,'include':_0x551282[_0x2b70('0x1b')]?_0x551282[_0x2b70('0x1b')][_0x2b70('0x1f')]?_[_0x2b70('0x20')](_0x551282[_0x2b70('0x1b')][_0x2b70('0x1f')],function(_0x45f693){return{'model':db[_0x45f693[_0x2b70('0x1e')]],'as':_0x45f693['as'],'attributes':_0x45f693[_0x2b70('0x1d')],'include':_0x45f693[_0x2b70('0x1f')]?_[_0x2b70('0x20')](_0x45f693['include'],function(_0x380ace){return{'model':db[_0x380ace[_0x2b70('0x1e')]],'as':_0x380ace['as'],'attributes':_0x380ace['attributes'],'include':_0x380ace['include']?_[_0x2b70('0x20')](_0x380ace[_0x2b70('0x1f')],function(_0x760251){return{'model':db[_0x760251['model']],'as':_0x760251['as'],'attributes':_0x760251[_0x2b70('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2b70('0x10')](function(_0x497d49){logger[_0x2b70('0x11')](_0x2b70('0x21'),_0x551282);logger['debug'](_0x2b70('0x21'),_0x551282,JSON[_0x2b70('0x14')](_0x497d49));_0x5736a9(_0x497d49);})['catch'](function(_0x2c2c56){logger[_0x2b70('0x15')]('ShowSmsQueue',_0x2c2c56[_0x2b70('0x16')],_0x551282);_0x3f613e(_0x235c87[_0x2b70('0x15')](0x1f4,_0x2c2c56[_0x2b70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8f839de..6b856d3 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 _0x0858=['length','smsQueue:','./smsQueue.events','save','update','removeListener','register'];(function(_0x47c6b9,_0x210b3c){var _0x34f34d=function(_0x47c336){while(--_0x47c336){_0x47c6b9['push'](_0x47c6b9['shift']());}};_0x34f34d(++_0x210b3c);}(_0x0858,0x1de));var _0x8085=function(_0x41919f,_0x46bd08){_0x41919f=_0x41919f-0x0;var _0x3a3efb=_0x0858[_0x41919f];return _0x3a3efb;};'use strict';var SmsQueueEvents=require(_0x8085('0x0'));var events=[_0x8085('0x1'),'remove',_0x8085('0x2')];function createListener(_0x3b3a85,_0x193902){return function(_0x596ec7){_0x193902['emit'](_0x3b3a85,_0x596ec7);};}function removeListener(_0x4b5854,_0x5a4f6e){return function(){SmsQueueEvents[_0x8085('0x3')](_0x4b5854,_0x5a4f6e);};}exports[_0x8085('0x4')]=function(_0x207d36){for(var _0x41c1ed=0x0,_0x2c6fb1=events[_0x8085('0x5')];_0x41c1ed<_0x2c6fb1;_0x41c1ed++){var _0x5a5e15=events[_0x41c1ed];var _0x402c6f=createListener(_0x8085('0x6')+_0x5a5e15,_0x207d36);SmsQueueEvents['on'](_0x5a5e15,_0x402c6f);}}; \ No newline at end of file +var _0xb631=['register','length','smsQueue:','./smsQueue.events','save','remove','update','removeListener'];(function(_0x4bc9a5,_0x240609){var _0x5f13f4=function(_0x3f07e0){while(--_0x3f07e0){_0x4bc9a5['push'](_0x4bc9a5['shift']());}};_0x5f13f4(++_0x240609);}(_0xb631,0x1c3));var _0x1b63=function(_0x474731,_0x5851d2){_0x474731=_0x474731-0x0;var _0x20963b=_0xb631[_0x474731];return _0x20963b;};'use strict';var SmsQueueEvents=require(_0x1b63('0x0'));var events=[_0x1b63('0x1'),_0x1b63('0x2'),_0x1b63('0x3')];function createListener(_0x18d182,_0x396552){return function(_0x408c38){_0x396552['emit'](_0x18d182,_0x408c38);};}function removeListener(_0x73784,_0x5ccfa7){return function(){SmsQueueEvents[_0x1b63('0x4')](_0x73784,_0x5ccfa7);};}exports[_0x1b63('0x5')]=function(_0x458b6c){for(var _0x271536=0x0,_0x3017d1=events[_0x1b63('0x6')];_0x271536<_0x3017d1;_0x271536++){var _0x57247e=events[_0x271536];var _0x3e1b94=createListener(_0x1b63('0x7')+_0x57247e,_0x458b6c);SmsQueueEvents['on'](_0x57247e,_0x3e1b94);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d414c04..78a3aa4 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 _0x7553=['get','index','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x547510,_0x30e1c5){var _0x273c31=function(_0x51caf5){while(--_0x51caf5){_0x547510['push'](_0x547510['shift']());}};_0x273c31(++_0x30e1c5);}(_0x7553,0x1c3));var _0x3755=function(_0x28caf4,_0x797e55){_0x28caf4=_0x28caf4-0x0;var _0x503f93=_0x7553[_0x28caf4];return _0x503f93;};'use strict';var multer=require(_0x3755('0x0'));var util=require(_0x3755('0x1'));var path=require('path');var timeout=require(_0x3755('0x2'));var express=require(_0x3755('0x3'));var router=express[_0x3755('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3755('0x5'));var interaction=require(_0x3755('0x6'));var config=require(_0x3755('0x7'));var controller=require(_0x3755('0x8'));router[_0x3755('0x9')]('/',auth['isAuthenticated'](),controller[_0x3755('0xa')]);router['get']('/describe',auth[_0x3755('0xb')](),controller[_0x3755('0xc')]);router[_0x3755('0x9')](_0x3755('0xd'),auth[_0x3755('0xb')](),controller[_0x3755('0xe')]);router['post']('/',auth[_0x3755('0xb')](),controller[_0x3755('0xf')]);router['put']('/:id',auth[_0x3755('0xb')](),controller[_0x3755('0x10')]);router[_0x3755('0x11')](_0x3755('0xd'),auth[_0x3755('0xb')](),controller[_0x3755('0x12')]);module[_0x3755('0x13')]=router; \ No newline at end of file +var _0x5334=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','describe','get','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer'];(function(_0x8c868d,_0x25e1ad){var _0x26e8b9=function(_0x3fbaa2){while(--_0x3fbaa2){_0x8c868d['push'](_0x8c868d['shift']());}};_0x26e8b9(++_0x25e1ad);}(_0x5334,0x84));var _0x4533=function(_0x366ef0,_0x2534b8){_0x366ef0=_0x366ef0-0x0;var _0x1e8024=_0x5334[_0x366ef0];return _0x1e8024;};'use strict';var multer=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var path=require(_0x4533('0x2'));var timeout=require(_0x4533('0x3'));var express=require(_0x4533('0x4'));var router=express['Router']();var fs_extra=require(_0x4533('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4533('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4533('0x9')]);router[_0x4533('0xa')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller[_0x4533('0xd')]);router[_0x4533('0xe')]('/',auth[_0x4533('0xc')](),controller['create']);router[_0x4533('0xf')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller[_0x4533('0x10')]);router['delete'](_0x4533('0xb'),auth['isAuthenticated'](),controller[_0x4533('0x11')]);module[_0x4533('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ad2e6c9..4057628 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 _0xbd48=['STRING','DATE','moment','sequelize','exports'];(function(_0x38b77f,_0x3659af){var _0x1174cb=function(_0x5959e1){while(--_0x5959e1){_0x38b77f['push'](_0x38b77f['shift']());}};_0x1174cb(++_0x3659af);}(_0xbd48,0x124));var _0x8bd4=function(_0x2f34dd,_0x422adf){_0x2f34dd=_0x2f34dd-0x0;var _0x1cef64=_0xbd48[_0x2f34dd];return _0x1cef64;};'use strict';var moment=require(_0x8bd4('0x0'));var Sequelize=require(_0x8bd4('0x1'));module[_0x8bd4('0x2')]={'uniqueid':{'type':Sequelize[_0x8bd4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8bd4('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8bd4('0x4')]},'acceptAt':{'type':Sequelize[_0x8bd4('0x4')]},'exitAt':{'type':Sequelize[_0x8bd4('0x4')]},'reason':{'type':Sequelize[_0x8bd4('0x3')]}}; \ No newline at end of file +var _0xe7cd=['STRING','DATE','moment','exports'];(function(_0x4f2d40,_0x2b76f8){var _0x227027=function(_0x57d2a4){while(--_0x57d2a4){_0x4f2d40['push'](_0x4f2d40['shift']());}};_0x227027(++_0x2b76f8);}(_0xe7cd,0xaa));var _0xde7c=function(_0xaf778f,_0x445386){_0xaf778f=_0xaf778f-0x0;var _0x12dc95=_0xe7cd[_0xaf778f];return _0x12dc95;};'use strict';var moment=require(_0xde7c('0x0'));var Sequelize=require('sequelize');module[_0xde7c('0x1')]={'uniqueid':{'type':Sequelize[_0xde7c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xde7c('0x2')]},'joinAt':{'type':Sequelize[_0xde7c('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xde7c('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xde7c('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f3fc1eb..63acd83 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 _0xf2dd=['then','include','findAll','rows','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','error','stack','send','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x1dc14d,_0x20f4c5){var _0x442f6a=function(_0x45c736){while(--_0x45c736){_0x1dc14d['push'](_0x1dc14d['shift']());}};_0x442f6a(++_0x20f4c5);}(_0xf2dd,0x178));var _0xdf2d=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xf2dd[_0x280f4a];return _0x1bb157;};'use strict';var emlformat=require(_0xdf2d('0x0'));var rimraf=require(_0xdf2d('0x1'));var zipdir=require(_0xdf2d('0x2'));var jsonpatch=require(_0xdf2d('0x3'));var rp=require(_0xdf2d('0x4'));var moment=require(_0xdf2d('0x5'));var BPromise=require(_0xdf2d('0x6'));var Mustache=require('mustache');var util=require(_0xdf2d('0x7'));var path=require(_0xdf2d('0x8'));var sox=require(_0xdf2d('0x9'));var csv=require(_0xdf2d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf2d('0xb'));var _=require(_0xdf2d('0xc'));var squel=require('squel');var crypto=require(_0xdf2d('0xd'));var jsforce=require(_0xdf2d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdf2d('0xa'));var querystring=require(_0xdf2d('0xf'));var Papa=require('papaparse');var Redis=require(_0xdf2d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdf2d('0x11'));var as=require(_0xdf2d('0x12'));var hardwareService=require(_0xdf2d('0x13'));var logger=require('../../config/logger')(_0xdf2d('0x14'));var utils=require(_0xdf2d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdf2d('0x16'))['db'];function respondWithStatusCode(_0x2be0f7,_0x2b7a62){_0x2b7a62=_0x2b7a62||0xcc;return function(_0x31d8a7){if(_0x31d8a7){return _0x2be0f7[_0xdf2d('0x17')](_0x2b7a62);}return _0x2be0f7[_0xdf2d('0x18')](_0x2b7a62)[_0xdf2d('0x19')]();};}function respondWithResult(_0x32d8f4,_0x38ec4c){_0x38ec4c=_0x38ec4c||0xc8;return function(_0xbea81f){if(_0xbea81f){return _0x32d8f4['status'](_0x38ec4c)[_0xdf2d('0x1a')](_0xbea81f);}};}function respondWithFilteredResult(_0x52af62,_0x3a6cbc){return function(_0x505ee6){if(_0x505ee6){var _0x2b7e27=typeof _0x3a6cbc[_0xdf2d('0x1b')]===_0xdf2d('0x1c')&&typeof _0x3a6cbc[_0xdf2d('0x1d')]===_0xdf2d('0x1c');var _0x78685=_0x505ee6['count'];var _0x19164f=_0x2b7e27?0x0:_0x3a6cbc[_0xdf2d('0x1b')];var _0x20e4b5=_0x2b7e27?_0x505ee6[_0xdf2d('0x1e')]:_0x3a6cbc[_0xdf2d('0x1b')]+_0x3a6cbc[_0xdf2d('0x1d')];var _0x1375c4;if(_0x20e4b5>=_0x78685){_0x20e4b5=_0x78685;_0x1375c4=0xc8;}else{_0x1375c4=0xce;}_0x52af62[_0xdf2d('0x18')](_0x1375c4);return _0x52af62['set'](_0xdf2d('0x1f'),_0x19164f+'-'+_0x20e4b5+'/'+_0x78685)[_0xdf2d('0x1a')](_0x505ee6);}return null;};}function patchUpdates(_0x59e76e){return function(_0x55b799){try{jsonpatch[_0xdf2d('0x20')](_0x55b799,_0x59e76e,!![]);}catch(_0x18390c){return BPromise[_0xdf2d('0x21')](_0x18390c);}return _0x55b799['save']();};}function saveUpdates(_0xbb3cc2,_0x5cc0b5){return function(_0x3cf556){if(_0x3cf556){return _0x3cf556[_0xdf2d('0x22')](_0xbb3cc2)['then'](function(_0x511da4){return _0x511da4;});}return null;};}function removeEntity(_0x2159de,_0x3f82db){return function(_0xdd6d4f){if(_0xdd6d4f){return _0xdd6d4f['destroy']()['then'](function(){_0x2159de[_0xdf2d('0x18')](0xcc)[_0xdf2d('0x19')]();});}};}function handleEntityNotFound(_0xeda6a1,_0xd54a9d){return function(_0x43d268){if(!_0x43d268){_0xeda6a1[_0xdf2d('0x17')](0x194);}return _0x43d268;};}function handleError(_0x38e323,_0x1d49b5){_0x1d49b5=_0x1d49b5||0x1f4;return function(_0x111975){logger[_0xdf2d('0x23')](_0x111975[_0xdf2d('0x24')]);if(_0x111975['name']){delete _0x111975['name'];}_0x38e323[_0xdf2d('0x18')](_0x1d49b5)[_0xdf2d('0x25')](_0x111975);};}exports['index']=function(_0x214ebb,_0x5c0eb7){var _0xd29f18={},_0x2356c0={},_0xbf2374={'count':0x0,'rows':[]};var _0x45656c=_[_0xdf2d('0x26')](db[_0xdf2d('0x27')][_0xdf2d('0x28')],function(_0x2d8bc2){return{'name':_0x2d8bc2[_0xdf2d('0x29')],'type':_0x2d8bc2[_0xdf2d('0x2a')][_0xdf2d('0x2b')]};});_0x2356c0[_0xdf2d('0x2c')]=_[_0xdf2d('0x26')](_0x45656c,_0xdf2d('0x2d'));_0x2356c0[_0xdf2d('0x2e')]=_[_0xdf2d('0x2f')](_0x214ebb[_0xdf2d('0x2e')]);_0x2356c0[_0xdf2d('0x30')]=_[_0xdf2d('0x31')](_0x2356c0['model'],_0x2356c0[_0xdf2d('0x2e')]);_0xd29f18['attributes']=_['intersection'](_0x2356c0[_0xdf2d('0x2c')],qs[_0xdf2d('0x32')](_0x214ebb[_0xdf2d('0x2e')][_0xdf2d('0x32')]));_0xd29f18[_0xdf2d('0x33')]=_0xd29f18[_0xdf2d('0x33')][_0xdf2d('0x34')]?_0xd29f18['attributes']:_0x2356c0[_0xdf2d('0x2c')];if(!_0x214ebb[_0xdf2d('0x2e')][_0xdf2d('0x35')](_0xdf2d('0x36'))){_0xd29f18['limit']=qs[_0xdf2d('0x1d')](_0x214ebb['query'][_0xdf2d('0x1d')]);_0xd29f18[_0xdf2d('0x1b')]=qs[_0xdf2d('0x1b')](_0x214ebb[_0xdf2d('0x2e')][_0xdf2d('0x1b')]);}_0xd29f18['order']=qs[_0xdf2d('0x37')](_0x214ebb[_0xdf2d('0x2e')][_0xdf2d('0x37')]);_0xd29f18['where']=qs['filters'](_[_0xdf2d('0x38')](_0x214ebb['query'],_0x2356c0[_0xdf2d('0x30')]),_0x45656c);if(_0x214ebb[_0xdf2d('0x2e')][_0xdf2d('0x39')]){_0xd29f18[_0xdf2d('0x3a')]=_[_0xdf2d('0x3b')](_0xd29f18['where'],{'$or':_['map'](_0x45656c,function(_0x804c15){if(_0x804c15[_0xdf2d('0x2a')]!==_0xdf2d('0x3c')){var _0x599608={};_0x599608[_0x804c15[_0xdf2d('0x2d')]]={'$like':'%'+_0x214ebb[_0xdf2d('0x2e')][_0xdf2d('0x39')]+'%'};return _0x599608;}})});}_0xd29f18=_[_0xdf2d('0x3b')]({},_0xd29f18,_0x214ebb[_0xdf2d('0x3d')]);var _0x5e6b82={'where':_0xd29f18[_0xdf2d('0x3a')]};return db['SmsQueueReport']['count'](_0x5e6b82)[_0xdf2d('0x3e')](function(_0x51dce2){_0xbf2374[_0xdf2d('0x1e')]=_0x51dce2;if(_0x214ebb['query']['includeAll']){_0xd29f18[_0xdf2d('0x3f')]=[{'all':!![]}];}return db[_0xdf2d('0x27')][_0xdf2d('0x40')](_0xd29f18);})[_0xdf2d('0x3e')](function(_0x54fefe){_0xbf2374[_0xdf2d('0x41')]=_0x54fefe;return _0xbf2374;})[_0xdf2d('0x3e')](respondWithFilteredResult(_0x5c0eb7,_0xd29f18))['catch'](handleError(_0x5c0eb7,null));};exports['show']=function(_0x3d0f02,_0x1fcedb){var _0x42d5a5={'raw':!![],'where':{'id':_0x3d0f02[_0xdf2d('0x42')]['id']}},_0xeb4772={};_0xeb4772[_0xdf2d('0x2c')]=_[_0xdf2d('0x2f')](db['SmsQueueReport'][_0xdf2d('0x28')]);_0xeb4772[_0xdf2d('0x2e')]=_['keys'](_0x3d0f02[_0xdf2d('0x2e')]);_0xeb4772['filters']=_['intersection'](_0xeb4772[_0xdf2d('0x2c')],_0xeb4772['query']);_0x42d5a5['attributes']=_['intersection'](_0xeb4772[_0xdf2d('0x2c')],qs['fields'](_0x3d0f02['query'][_0xdf2d('0x32')]));_0x42d5a5[_0xdf2d('0x33')]=_0x42d5a5[_0xdf2d('0x33')][_0xdf2d('0x34')]?_0x42d5a5[_0xdf2d('0x33')]:_0xeb4772[_0xdf2d('0x2c')];if(_0x3d0f02['query'][_0xdf2d('0x43')]){_0x42d5a5[_0xdf2d('0x3f')]=[{'all':!![]}];}_0x42d5a5=_['merge']({},_0x42d5a5,_0x3d0f02[_0xdf2d('0x3d')]);return db[_0xdf2d('0x27')][_0xdf2d('0x44')](_0x42d5a5)[_0xdf2d('0x3e')](handleEntityNotFound(_0x1fcedb,null))['then'](respondWithResult(_0x1fcedb,null))[_0xdf2d('0x45')](handleError(_0x1fcedb,null));};exports[_0xdf2d('0x46')]=function(_0x2cbfc1,_0x2e3aae){return db['SmsQueueReport'][_0xdf2d('0x46')](_0x2cbfc1[_0xdf2d('0x47')],{})['then'](respondWithResult(_0x2e3aae,0xc9))[_0xdf2d('0x45')](handleError(_0x2e3aae,null));};exports[_0xdf2d('0x22')]=function(_0x1f29a5,_0x2babb6){if(_0x1f29a5[_0xdf2d('0x47')]['id']){delete _0x1f29a5['body']['id'];}return db[_0xdf2d('0x27')][_0xdf2d('0x44')]({'where':{'id':_0x1f29a5[_0xdf2d('0x42')]['id']}})[_0xdf2d('0x3e')](handleEntityNotFound(_0x2babb6,null))[_0xdf2d('0x3e')](saveUpdates(_0x1f29a5[_0xdf2d('0x47')],null))['then'](respondWithResult(_0x2babb6,null))[_0xdf2d('0x45')](handleError(_0x2babb6,null));};exports['destroy']=function(_0x33c944,_0x170e61){return db[_0xdf2d('0x27')][_0xdf2d('0x44')]({'where':{'id':_0x33c944[_0xdf2d('0x42')]['id']}})[_0xdf2d('0x3e')](handleEntityNotFound(_0x170e61,null))['then'](removeEntity(_0x170e61,null))['catch'](handleError(_0x170e61,null));};exports['describe']=function(_0x33f40e,_0x480006){return db[_0xdf2d('0x27')][_0xdf2d('0x48')]()[_0xdf2d('0x3e')](respondWithResult(_0x480006,null))[_0xdf2d('0x45')](handleError(_0x480006,null));}; \ No newline at end of file +var _0x62c1=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','SmsQueueReport','includeAll','include','findAll','catch','params','find','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x432e9e,_0x2841b2){var _0x1480db=function(_0x1aebc9){while(--_0x1aebc9){_0x432e9e['push'](_0x432e9e['shift']());}};_0x1480db(++_0x2841b2);}(_0x62c1,0x15d));var _0x162c=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x62c1[_0x4a6cf8];return _0x22205e;};'use strict';var emlformat=require(_0x162c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x162c('0x1'));var jsonpatch=require(_0x162c('0x2'));var rp=require(_0x162c('0x3'));var moment=require(_0x162c('0x4'));var BPromise=require(_0x162c('0x5'));var Mustache=require(_0x162c('0x6'));var util=require(_0x162c('0x7'));var path=require(_0x162c('0x8'));var sox=require('sox');var csv=require(_0x162c('0x9'));var ejs=require(_0x162c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x162c('0xb'));var squel=require(_0x162c('0xc'));var crypto=require(_0x162c('0xd'));var jsforce=require(_0x162c('0xe'));var deskjs=require(_0x162c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x162c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x162c('0x11'));var qs=require(_0x162c('0x12'));var as=require(_0x162c('0x13'));var hardwareService=require(_0x162c('0x14'));var logger=require(_0x162c('0x15'))('api');var utils=require(_0x162c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x162c('0x17'));var db=require(_0x162c('0x18'))['db'];function respondWithStatusCode(_0x52a700,_0x23025f){_0x23025f=_0x23025f||0xcc;return function(_0x519ec4){if(_0x519ec4){return _0x52a700[_0x162c('0x19')](_0x23025f);}return _0x52a700[_0x162c('0x1a')](_0x23025f)[_0x162c('0x1b')]();};}function respondWithResult(_0x348d6b,_0x167c5b){_0x167c5b=_0x167c5b||0xc8;return function(_0x16263d){if(_0x16263d){return _0x348d6b[_0x162c('0x1a')](_0x167c5b)[_0x162c('0x1c')](_0x16263d);}};}function respondWithFilteredResult(_0x3b852a,_0x5c19e4){return function(_0x19d35e){if(_0x19d35e){var _0x215c92=typeof _0x5c19e4[_0x162c('0x1d')]==='undefined'&&typeof _0x5c19e4[_0x162c('0x1e')]===_0x162c('0x1f');var _0x24d73b=_0x19d35e[_0x162c('0x20')];var _0x380830=_0x215c92?0x0:_0x5c19e4['offset'];var _0x2fb86c=_0x215c92?_0x19d35e['count']:_0x5c19e4[_0x162c('0x1d')]+_0x5c19e4[_0x162c('0x1e')];var _0x581611;if(_0x2fb86c>=_0x24d73b){_0x2fb86c=_0x24d73b;_0x581611=0xc8;}else{_0x581611=0xce;}_0x3b852a[_0x162c('0x1a')](_0x581611);return _0x3b852a[_0x162c('0x21')](_0x162c('0x22'),_0x380830+'-'+_0x2fb86c+'/'+_0x24d73b)[_0x162c('0x1c')](_0x19d35e);}return null;};}function patchUpdates(_0x4d0b92){return function(_0x1fb2a4){try{jsonpatch[_0x162c('0x23')](_0x1fb2a4,_0x4d0b92,!![]);}catch(_0xfbc817){return BPromise[_0x162c('0x24')](_0xfbc817);}return _0x1fb2a4[_0x162c('0x25')]();};}function saveUpdates(_0x4b7aec,_0x3902c2){return function(_0x3b6232){if(_0x3b6232){return _0x3b6232[_0x162c('0x26')](_0x4b7aec)[_0x162c('0x27')](function(_0x5a8845){return _0x5a8845;});}return null;};}function removeEntity(_0x436650,_0x181b16){return function(_0x360eac){if(_0x360eac){return _0x360eac['destroy']()['then'](function(){_0x436650[_0x162c('0x1a')](0xcc)[_0x162c('0x1b')]();});}};}function handleEntityNotFound(_0x2e3eac,_0x4d417c){return function(_0x5f289b){if(!_0x5f289b){_0x2e3eac[_0x162c('0x19')](0x194);}return _0x5f289b;};}function handleError(_0x46b783,_0x3a902a){_0x3a902a=_0x3a902a||0x1f4;return function(_0x3b3771){logger[_0x162c('0x28')](_0x3b3771[_0x162c('0x29')]);if(_0x3b3771['name']){delete _0x3b3771[_0x162c('0x2a')];}_0x46b783[_0x162c('0x1a')](_0x3a902a)['send'](_0x3b3771);};}exports['index']=function(_0x54d267,_0x3b1b8c){var _0x137561={},_0x12ec8e={},_0x1a5eb7={'count':0x0,'rows':[]};var _0x59aea0=_['map'](db['SmsQueueReport'][_0x162c('0x2b')],function(_0x12e952){return{'name':_0x12e952[_0x162c('0x2c')],'type':_0x12e952[_0x162c('0x2d')]['key']};});_0x12ec8e[_0x162c('0x2e')]=_['map'](_0x59aea0,_0x162c('0x2a'));_0x12ec8e[_0x162c('0x2f')]=_[_0x162c('0x30')](_0x54d267[_0x162c('0x2f')]);_0x12ec8e[_0x162c('0x31')]=_['intersection'](_0x12ec8e['model'],_0x12ec8e[_0x162c('0x2f')]);_0x137561['attributes']=_[_0x162c('0x32')](_0x12ec8e[_0x162c('0x2e')],qs[_0x162c('0x33')](_0x54d267[_0x162c('0x2f')][_0x162c('0x33')]));_0x137561[_0x162c('0x34')]=_0x137561[_0x162c('0x34')][_0x162c('0x35')]?_0x137561[_0x162c('0x34')]:_0x12ec8e['model'];if(!_0x54d267[_0x162c('0x2f')][_0x162c('0x36')](_0x162c('0x37'))){_0x137561['limit']=qs['limit'](_0x54d267[_0x162c('0x2f')][_0x162c('0x1e')]);_0x137561['offset']=qs[_0x162c('0x1d')](_0x54d267[_0x162c('0x2f')][_0x162c('0x1d')]);}_0x137561['order']=qs[_0x162c('0x38')](_0x54d267['query']['sort']);_0x137561[_0x162c('0x39')]=qs[_0x162c('0x31')](_[_0x162c('0x3a')](_0x54d267[_0x162c('0x2f')],_0x12ec8e[_0x162c('0x31')]),_0x59aea0);if(_0x54d267[_0x162c('0x2f')][_0x162c('0x3b')]){_0x137561[_0x162c('0x39')]=_[_0x162c('0x3c')](_0x137561[_0x162c('0x39')],{'$or':_[_0x162c('0x3d')](_0x59aea0,function(_0x2256f8){if(_0x2256f8[_0x162c('0x2d')]!==_0x162c('0x3e')){var _0x4deb39={};_0x4deb39[_0x2256f8[_0x162c('0x2a')]]={'$like':'%'+_0x54d267['query'][_0x162c('0x3b')]+'%'};return _0x4deb39;}})});}_0x137561=_[_0x162c('0x3c')]({},_0x137561,_0x54d267[_0x162c('0x3f')]);var _0x4e5cda={'where':_0x137561[_0x162c('0x39')]};return db[_0x162c('0x40')][_0x162c('0x20')](_0x4e5cda)[_0x162c('0x27')](function(_0x2c5ba1){_0x1a5eb7[_0x162c('0x20')]=_0x2c5ba1;if(_0x54d267[_0x162c('0x2f')][_0x162c('0x41')]){_0x137561[_0x162c('0x42')]=[{'all':!![]}];}return db[_0x162c('0x40')][_0x162c('0x43')](_0x137561);})[_0x162c('0x27')](function(_0x40c3c2){_0x1a5eb7['rows']=_0x40c3c2;return _0x1a5eb7;})[_0x162c('0x27')](respondWithFilteredResult(_0x3b1b8c,_0x137561))[_0x162c('0x44')](handleError(_0x3b1b8c,null));};exports['show']=function(_0x5bbd0a,_0x4e6f08){var _0xc51f9a={'raw':!![],'where':{'id':_0x5bbd0a[_0x162c('0x45')]['id']}},_0x57bd92={};_0x57bd92[_0x162c('0x2e')]=_[_0x162c('0x30')](db[_0x162c('0x40')]['rawAttributes']);_0x57bd92[_0x162c('0x2f')]=_[_0x162c('0x30')](_0x5bbd0a['query']);_0x57bd92[_0x162c('0x31')]=_[_0x162c('0x32')](_0x57bd92[_0x162c('0x2e')],_0x57bd92[_0x162c('0x2f')]);_0xc51f9a[_0x162c('0x34')]=_['intersection'](_0x57bd92[_0x162c('0x2e')],qs['fields'](_0x5bbd0a[_0x162c('0x2f')][_0x162c('0x33')]));_0xc51f9a['attributes']=_0xc51f9a[_0x162c('0x34')][_0x162c('0x35')]?_0xc51f9a[_0x162c('0x34')]:_0x57bd92[_0x162c('0x2e')];if(_0x5bbd0a[_0x162c('0x2f')][_0x162c('0x41')]){_0xc51f9a[_0x162c('0x42')]=[{'all':!![]}];}_0xc51f9a=_[_0x162c('0x3c')]({},_0xc51f9a,_0x5bbd0a[_0x162c('0x3f')]);return db[_0x162c('0x40')][_0x162c('0x46')](_0xc51f9a)[_0x162c('0x27')](handleEntityNotFound(_0x4e6f08,null))['then'](respondWithResult(_0x4e6f08,null))[_0x162c('0x44')](handleError(_0x4e6f08,null));};exports['create']=function(_0x544737,_0x24eb52){return db[_0x162c('0x40')]['create'](_0x544737['body'],{})['then'](respondWithResult(_0x24eb52,0xc9))['catch'](handleError(_0x24eb52,null));};exports[_0x162c('0x26')]=function(_0x174164,_0xe18fb0){if(_0x174164[_0x162c('0x47')]['id']){delete _0x174164[_0x162c('0x47')]['id'];}return db[_0x162c('0x40')][_0x162c('0x46')]({'where':{'id':_0x174164[_0x162c('0x45')]['id']}})[_0x162c('0x27')](handleEntityNotFound(_0xe18fb0,null))[_0x162c('0x27')](saveUpdates(_0x174164[_0x162c('0x47')],null))[_0x162c('0x27')](respondWithResult(_0xe18fb0,null))[_0x162c('0x44')](handleError(_0xe18fb0,null));};exports[_0x162c('0x48')]=function(_0x1a8410,_0x5e2440){return db[_0x162c('0x40')][_0x162c('0x46')]({'where':{'id':_0x1a8410[_0x162c('0x45')]['id']}})[_0x162c('0x27')](handleEntityNotFound(_0x5e2440,null))[_0x162c('0x27')](removeEntity(_0x5e2440,null))[_0x162c('0x44')](handleError(_0x5e2440,null));};exports[_0x162c('0x49')]=function(_0x56f77c,_0x8be3e2){return db[_0x162c('0x40')][_0x162c('0x49')]()[_0x162c('0x27')](respondWithResult(_0x8be3e2,null))['catch'](handleError(_0x8be3e2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index a96c3ec..fb9c9d0 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x187718,_0x427383){var _0x29ddf4=function(_0x2ec62a){while(--_0x2ec62a){_0x187718['push'](_0x187718['shift']());}};_0x29ddf4(++_0x427383);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x16a4a0,_0x3c8bad){var _0x4ef51c=function(_0x5ab154){while(--_0x5ab154){_0x16a4a0['push'](_0x16a4a0['shift']());}};_0x4ef51c(++_0x3c8bad);}(_0xb7e7,0x121));var _0x7b7e=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xb7e7[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 5d45500..2f18fcd 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 _0xd393=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','where','attributes','lodash','util','moment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd393,0x147));var _0x3d39=function(_0x3c1fdd,_0x3358fd){_0x3c1fdd=_0x3c1fdd-0x0;var _0x107455=_0xd393[_0x3c1fdd];return _0x107455;};'use strict';var _=require(_0x3d39('0x0'));var util=require(_0x3d39('0x1'));var moment=require(_0x3d39('0x2'));var BPromise=require('bluebird');var rs=require(_0x3d39('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d39('0x4'))['db'];var utils=require(_0x3d39('0x5'));var logger=require(_0x3d39('0x6'))(_0x3d39('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d39('0x8')][_0x3d39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18b8b2,_0x5a9f4e,_0x442229){return new BPromise(function(_0x1c4f11,_0x5c6c2f){return client['request'](_0x18b8b2,_0x442229)[_0x3d39('0xa')](function(_0x133423){logger['info'](_0x3d39('0xb'),_0x5a9f4e,_0x3d39('0xc'));logger[_0x3d39('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5a9f4e,_0x3d39('0xc'),JSON[_0x3d39('0xe')](_0x133423));if(_0x133423[_0x3d39('0xf')]){if(_0x133423[_0x3d39('0xf')][_0x3d39('0x10')]===0x1f4){logger[_0x3d39('0xf')](_0x3d39('0xb'),_0x5a9f4e,_0x133423[_0x3d39('0xf')][_0x3d39('0x11')]);return _0x5c6c2f(_0x133423['error'][_0x3d39('0x11')]);}logger[_0x3d39('0xf')](_0x3d39('0xb'),_0x5a9f4e,_0x133423['error'][_0x3d39('0x11')]);return _0x1c4f11(_0x133423[_0x3d39('0xf')][_0x3d39('0x11')]);}else{logger[_0x3d39('0x12')](_0x3d39('0xb'),_0x5a9f4e,_0x3d39('0xc'));_0x1c4f11(_0x133423[_0x3d39('0x13')][_0x3d39('0x11')]);}})[_0x3d39('0x14')](function(_0xe667f5){logger[_0x3d39('0xf')](_0x3d39('0xb'),_0x5a9f4e,_0xe667f5);_0x5c6c2f(_0xe667f5);});});}exports[_0x3d39('0x15')]=function(_0x4a075d){var _0x2192a4=this;return new Promise(function(_0x482480,_0x2d2364){return db[_0x3d39('0x16')][_0x3d39('0x17')](_0x4a075d[_0x3d39('0x18')],{'raw':_0x4a075d[_0x3d39('0x19')]?_0x4a075d[_0x3d39('0x19')][_0x3d39('0x1a')]===undefined?!![]:![]:!![]})[_0x3d39('0xa')](function(_0x43b610){logger[_0x3d39('0x12')](_0x3d39('0x15'),_0x4a075d);logger[_0x3d39('0xd')]('CreateSmsQueueReport',_0x4a075d,JSON[_0x3d39('0xe')](_0x43b610));_0x482480(_0x43b610);})['catch'](function(_0xb00b20){logger[_0x3d39('0xf')](_0x3d39('0x15'),_0xb00b20[_0x3d39('0x11')],_0x4a075d);_0x2d2364(_0x2192a4[_0x3d39('0xf')](0x1f4,_0xb00b20[_0x3d39('0x11')]));});});};exports[_0x3d39('0x1b')]=function(_0x20fa57){var _0x187523=this;return new Promise(function(_0x3f0ccc,_0x128476){return db[_0x3d39('0x16')]['update'](_0x20fa57[_0x3d39('0x18')],{'raw':_0x20fa57['options']?_0x20fa57[_0x3d39('0x19')][_0x3d39('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fa57[_0x3d39('0x19')]?_0x20fa57['options'][_0x3d39('0x1c')]||null:null,'attributes':_0x20fa57[_0x3d39('0x19')]?_0x20fa57[_0x3d39('0x19')][_0x3d39('0x1d')]||null:null,'limit':_0x20fa57[_0x3d39('0x19')]?_0x20fa57['options']['limit']||null:null})[_0x3d39('0xa')](function(_0x307db4){logger['info'](_0x3d39('0x1b'),_0x20fa57);logger[_0x3d39('0xd')](_0x3d39('0x1b'),_0x20fa57,JSON['stringify'](_0x307db4));_0x3f0ccc(_0x307db4);})[_0x3d39('0x14')](function(_0x26b988){logger[_0x3d39('0xf')](_0x3d39('0x1b'),_0x26b988[_0x3d39('0x11')],_0x20fa57);_0x128476(_0x187523['error'](0x1f4,_0x26b988[_0x3d39('0x11')]));});});}; \ No newline at end of file +var _0xdf44=['create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','CreateSmsQueueReport'];(function(_0x4a1b3c,_0x20aa97){var _0xe314d7=function(_0x220bdf){while(--_0x220bdf){_0x4a1b3c['push'](_0x4a1b3c['shift']());}};_0xe314d7(++_0x20aa97);}(_0xdf44,0x128));var _0x4df4=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xdf44[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x4df4('0x0'));var util=require(_0x4df4('0x1'));var moment=require(_0x4df4('0x2'));var BPromise=require(_0x4df4('0x3'));var rs=require(_0x4df4('0x4'));var fs=require('fs');var Redis=require(_0x4df4('0x5'));var db=require(_0x4df4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4df4('0x7'));var config=require(_0x4df4('0x8'));var jayson=require(_0x4df4('0x9'));var client=jayson[_0x4df4('0xa')][_0x4df4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c24d9,_0x583f8d,_0x34ee79){return new BPromise(function(_0x32e2e7,_0x5bd79d){return client[_0x4df4('0xc')](_0x4c24d9,_0x34ee79)[_0x4df4('0xd')](function(_0x588de8){logger[_0x4df4('0xe')](_0x4df4('0xf'),_0x583f8d,_0x4df4('0x10'));logger[_0x4df4('0x11')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x583f8d,_0x4df4('0x10'),JSON['stringify'](_0x588de8));if(_0x588de8['error']){if(_0x588de8['error'][_0x4df4('0x12')]===0x1f4){logger[_0x4df4('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x583f8d,_0x588de8['error'][_0x4df4('0x14')]);return _0x5bd79d(_0x588de8[_0x4df4('0x13')][_0x4df4('0x14')]);}logger[_0x4df4('0x13')](_0x4df4('0xf'),_0x583f8d,_0x588de8[_0x4df4('0x13')][_0x4df4('0x14')]);return _0x32e2e7(_0x588de8['error'][_0x4df4('0x14')]);}else{logger['info'](_0x4df4('0xf'),_0x583f8d,'request\x20sent');_0x32e2e7(_0x588de8[_0x4df4('0x15')][_0x4df4('0x14')]);}})[_0x4df4('0x16')](function(_0x36455c){logger['error'](_0x4df4('0xf'),_0x583f8d,_0x36455c);_0x5bd79d(_0x36455c);});});}exports[_0x4df4('0x17')]=function(_0x543a52){var _0x243a58=this;return new Promise(function(_0xce44d3,_0x2cf777){return db['SmsQueueReport'][_0x4df4('0x18')](_0x543a52[_0x4df4('0x19')],{'raw':_0x543a52['options']?_0x543a52[_0x4df4('0x1a')][_0x4df4('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x904f72){logger[_0x4df4('0xe')](_0x4df4('0x17'),_0x543a52);logger[_0x4df4('0x11')](_0x4df4('0x17'),_0x543a52,JSON['stringify'](_0x904f72));_0xce44d3(_0x904f72);})[_0x4df4('0x16')](function(_0x570298){logger[_0x4df4('0x13')](_0x4df4('0x17'),_0x570298['message'],_0x543a52);_0x2cf777(_0x243a58[_0x4df4('0x13')](0x1f4,_0x570298[_0x4df4('0x14')]));});});};exports[_0x4df4('0x1c')]=function(_0x3b3aa3){var _0x52c966=this;return new Promise(function(_0x383a82,_0x590e53){return db[_0x4df4('0x1d')]['update'](_0x3b3aa3['body'],{'raw':_0x3b3aa3['options']?_0x3b3aa3['options'][_0x4df4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b3aa3['options']?_0x3b3aa3[_0x4df4('0x1a')][_0x4df4('0x1e')]||null:null,'attributes':_0x3b3aa3[_0x4df4('0x1a')]?_0x3b3aa3[_0x4df4('0x1a')][_0x4df4('0x1f')]||null:null,'limit':_0x3b3aa3['options']?_0x3b3aa3[_0x4df4('0x1a')]['limit']||null:null})[_0x4df4('0xd')](function(_0x9284d9){logger[_0x4df4('0xe')](_0x4df4('0x1c'),_0x3b3aa3);logger[_0x4df4('0x11')](_0x4df4('0x1c'),_0x3b3aa3,JSON['stringify'](_0x9284d9));_0x383a82(_0x9284d9);})[_0x4df4('0x16')](function(_0x184f21){logger['error'](_0x4df4('0x1c'),_0x184f21['message'],_0x3b3aa3);_0x590e53(_0x52c966['error'](0x1f4,_0x184f21[_0x4df4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 141e4f2..af918c8 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 _0x32ef=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x479a18,_0x944aa3){var _0xbea75c=function(_0x3b711b){while(--_0x3b711b){_0x479a18['push'](_0x479a18['shift']());}};_0xbea75c(++_0x944aa3);}(_0x32ef,0xf9));var _0xf32e=function(_0xe6360e,_0x1411e3){_0xe6360e=_0xe6360e-0x0;var _0x539447=_0x32ef[_0xe6360e];return _0x539447;};'use strict';var multer=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var path=require(_0xf32e('0x2'));var timeout=require(_0xf32e('0x3'));var express=require(_0xf32e('0x4'));var router=express[_0xf32e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf32e('0x6'));var interaction=require(_0xf32e('0x7'));var config=require('../../config/environment');var controller=require(_0xf32e('0x8'));router[_0xf32e('0x9')]('/',auth[_0xf32e('0xa')](),controller[_0xf32e('0xb')]);router[_0xf32e('0x9')](_0xf32e('0xc'),auth['isAuthenticated'](),controller[_0xf32e('0xd')]);router['get'](_0xf32e('0xe'),auth[_0xf32e('0xa')](),controller[_0xf32e('0xf')]);router[_0xf32e('0x10')]('/',auth[_0xf32e('0xa')](),controller['create']);router[_0xf32e('0x11')](_0xf32e('0xe'),auth[_0xf32e('0xa')](),controller[_0xf32e('0x12')]);router[_0xf32e('0x13')](_0xf32e('0xe'),auth[_0xf32e('0xa')](),controller[_0xf32e('0x14')]);module[_0xf32e('0x15')]=router; \ No newline at end of file +var _0xc3b5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports','path','connect-timeout','express'];(function(_0x50243b,_0x2c4989){var _0x480721=function(_0x5f236c){while(--_0x5f236c){_0x50243b['push'](_0x50243b['shift']());}};_0x480721(++_0x2c4989);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x4e3de1,_0x250f2d){_0x4e3de1=_0x4e3de1-0x0;var _0x526f4b=_0xc3b5[_0x4e3de1];return _0x526f4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var fs_extra=require(_0x5c3b('0x4'));var auth=require(_0x5c3b('0x5'));var interaction=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var controller=require('./smsTransferReport.controller');router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0xa'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xb')]);router['get'](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xd')]);router[_0x5c3b('0xe')]('/',auth['isAuthenticated'](),controller[_0x5c3b('0xf')]);router[_0x5c3b('0x10')](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0x11')]);router['delete'](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller['destroy']);module[_0x5c3b('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f31a585..8e0dead 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x84ce4d,_0x24c6d7){var _0x327d33=function(_0x5748f9){while(--_0x5748f9){_0x84ce4d['push'](_0x84ce4d['shift']());}};_0x327d33(++_0x24c6d7);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x17f06d,_0x232350){var _0x465981=function(_0x504e8e){while(--_0x504e8e){_0x17f06d['push'](_0x17f06d['shift']());}};_0x465981(++_0x232350);}(_0xaa88,0x137));var _0x8aa8=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0xaa88[_0x1d6a82];return _0x5834ac;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 1533569..66899d1 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 _0x5ce2=['api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsTransferReport','includeAll','findAll','rows','catch','show','include','create','body','params','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x5ce2,0x86));var _0x25ce=function(_0x4396f2,_0x1e081e){_0x4396f2=_0x4396f2-0x0;var _0x4a6a41=_0x5ce2[_0x4396f2];return _0x4a6a41;};'use strict';var emlformat=require(_0x25ce('0x0'));var rimraf=require(_0x25ce('0x1'));var zipdir=require(_0x25ce('0x2'));var jsonpatch=require(_0x25ce('0x3'));var rp=require(_0x25ce('0x4'));var moment=require(_0x25ce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x25ce('0x6'));var util=require(_0x25ce('0x7'));var path=require(_0x25ce('0x8'));var sox=require(_0x25ce('0x9'));var csv=require(_0x25ce('0xa'));var ejs=require(_0x25ce('0xb'));var fs=require('fs');var fs_extra=require(_0x25ce('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x25ce('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x25ce('0xe'));var toCsv=require(_0x25ce('0xa'));var querystring=require(_0x25ce('0xf'));var Papa=require('papaparse');var Redis=require(_0x25ce('0x10'));var authService=require(_0x25ce('0x11'));var qs=require(_0x25ce('0x12'));var as=require(_0x25ce('0x13'));var hardwareService=require(_0x25ce('0x14'));var logger=require(_0x25ce('0x15'))(_0x25ce('0x16'));var utils=require(_0x25ce('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x25ce('0x18'))['db'];function respondWithStatusCode(_0x58c83e,_0x36e895){_0x36e895=_0x36e895||0xcc;return function(_0x193f96){if(_0x193f96){return _0x58c83e[_0x25ce('0x19')](_0x36e895);}return _0x58c83e['status'](_0x36e895)['end']();};}function respondWithResult(_0x194a5b,_0x51cd33){_0x51cd33=_0x51cd33||0xc8;return function(_0x5ebb49){if(_0x5ebb49){return _0x194a5b[_0x25ce('0x1a')](_0x51cd33)[_0x25ce('0x1b')](_0x5ebb49);}};}function respondWithFilteredResult(_0x682e9c,_0x121df1){return function(_0x210c48){if(_0x210c48){var _0x2eed43=typeof _0x121df1[_0x25ce('0x1c')]===_0x25ce('0x1d')&&typeof _0x121df1[_0x25ce('0x1e')]===_0x25ce('0x1d');var _0x40d395=_0x210c48[_0x25ce('0x1f')];var _0xa13b59=_0x2eed43?0x0:_0x121df1['offset'];var _0x282127=_0x2eed43?_0x210c48[_0x25ce('0x1f')]:_0x121df1[_0x25ce('0x1c')]+_0x121df1['limit'];var _0x708c56;if(_0x282127>=_0x40d395){_0x282127=_0x40d395;_0x708c56=0xc8;}else{_0x708c56=0xce;}_0x682e9c[_0x25ce('0x1a')](_0x708c56);return _0x682e9c[_0x25ce('0x20')](_0x25ce('0x21'),_0xa13b59+'-'+_0x282127+'/'+_0x40d395)[_0x25ce('0x1b')](_0x210c48);}return null;};}function patchUpdates(_0x173ae9){return function(_0x1b28ec){try{jsonpatch[_0x25ce('0x22')](_0x1b28ec,_0x173ae9,!![]);}catch(_0x432b20){return BPromise[_0x25ce('0x23')](_0x432b20);}return _0x1b28ec[_0x25ce('0x24')]();};}function saveUpdates(_0x465c5b,_0x15aa50){return function(_0x56312c){if(_0x56312c){return _0x56312c[_0x25ce('0x25')](_0x465c5b)[_0x25ce('0x26')](function(_0x1ecc51){return _0x1ecc51;});}return null;};}function removeEntity(_0x5a27d2,_0x1cd498){return function(_0x2db207){if(_0x2db207){return _0x2db207[_0x25ce('0x27')]()[_0x25ce('0x26')](function(){_0x5a27d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbc16ce,_0x32963d){return function(_0x20e8b9){if(!_0x20e8b9){_0xbc16ce['sendStatus'](0x194);}return _0x20e8b9;};}function handleError(_0x1c33a3,_0x529541){_0x529541=_0x529541||0x1f4;return function(_0x2b2bb7){logger['error'](_0x2b2bb7['stack']);if(_0x2b2bb7[_0x25ce('0x28')]){delete _0x2b2bb7[_0x25ce('0x28')];}_0x1c33a3[_0x25ce('0x1a')](_0x529541)[_0x25ce('0x29')](_0x2b2bb7);};}exports[_0x25ce('0x2a')]=function(_0x5f23b1,_0x5305ab){var _0x220fe4={},_0x55599d={},_0x35a1d3={'count':0x0,'rows':[]};var _0x425b7c=_['map'](db['SmsTransferReport'][_0x25ce('0x2b')],function(_0x35e458){return{'name':_0x35e458[_0x25ce('0x2c')],'type':_0x35e458[_0x25ce('0x2d')][_0x25ce('0x2e')]};});_0x55599d[_0x25ce('0x2f')]=_[_0x25ce('0x30')](_0x425b7c,_0x25ce('0x28'));_0x55599d[_0x25ce('0x31')]=_[_0x25ce('0x32')](_0x5f23b1[_0x25ce('0x31')]);_0x55599d[_0x25ce('0x33')]=_[_0x25ce('0x34')](_0x55599d[_0x25ce('0x2f')],_0x55599d[_0x25ce('0x31')]);_0x220fe4['attributes']=_[_0x25ce('0x34')](_0x55599d[_0x25ce('0x2f')],qs[_0x25ce('0x35')](_0x5f23b1[_0x25ce('0x31')][_0x25ce('0x35')]));_0x220fe4['attributes']=_0x220fe4[_0x25ce('0x36')][_0x25ce('0x37')]?_0x220fe4[_0x25ce('0x36')]:_0x55599d[_0x25ce('0x2f')];if(!_0x5f23b1[_0x25ce('0x31')][_0x25ce('0x38')](_0x25ce('0x39'))){_0x220fe4[_0x25ce('0x1e')]=qs[_0x25ce('0x1e')](_0x5f23b1['query'][_0x25ce('0x1e')]);_0x220fe4[_0x25ce('0x1c')]=qs[_0x25ce('0x1c')](_0x5f23b1['query']['offset']);}_0x220fe4[_0x25ce('0x3a')]=qs[_0x25ce('0x3b')](_0x5f23b1['query'][_0x25ce('0x3b')]);_0x220fe4[_0x25ce('0x3c')]=qs[_0x25ce('0x33')](_[_0x25ce('0x3d')](_0x5f23b1[_0x25ce('0x31')],_0x55599d[_0x25ce('0x33')]),_0x425b7c);if(_0x5f23b1[_0x25ce('0x31')][_0x25ce('0x3e')]){_0x220fe4['where']=_[_0x25ce('0x3f')](_0x220fe4[_0x25ce('0x3c')],{'$or':_[_0x25ce('0x30')](_0x425b7c,function(_0x15fcdb){if(_0x15fcdb[_0x25ce('0x2d')]!==_0x25ce('0x40')){var _0x320da5={};_0x320da5[_0x15fcdb['name']]={'$like':'%'+_0x5f23b1[_0x25ce('0x31')][_0x25ce('0x3e')]+'%'};return _0x320da5;}})});}_0x220fe4=_[_0x25ce('0x3f')]({},_0x220fe4,_0x5f23b1[_0x25ce('0x41')]);var _0xe61c11={'where':_0x220fe4[_0x25ce('0x3c')]};return db[_0x25ce('0x42')][_0x25ce('0x1f')](_0xe61c11)[_0x25ce('0x26')](function(_0x54e4e3){_0x35a1d3[_0x25ce('0x1f')]=_0x54e4e3;if(_0x5f23b1['query'][_0x25ce('0x43')]){_0x220fe4['include']=[{'all':!![]}];}return db[_0x25ce('0x42')][_0x25ce('0x44')](_0x220fe4);})[_0x25ce('0x26')](function(_0x5770b2){_0x35a1d3[_0x25ce('0x45')]=_0x5770b2;return _0x35a1d3;})['then'](respondWithFilteredResult(_0x5305ab,_0x220fe4))[_0x25ce('0x46')](handleError(_0x5305ab,null));};exports[_0x25ce('0x47')]=function(_0x1b211e,_0x2abd72){var _0x5da346={'raw':!![],'where':{'id':_0x1b211e['params']['id']}},_0x269280={};_0x269280[_0x25ce('0x2f')]=_[_0x25ce('0x32')](db[_0x25ce('0x42')][_0x25ce('0x2b')]);_0x269280[_0x25ce('0x31')]=_[_0x25ce('0x32')](_0x1b211e[_0x25ce('0x31')]);_0x269280[_0x25ce('0x33')]=_[_0x25ce('0x34')](_0x269280['model'],_0x269280[_0x25ce('0x31')]);_0x5da346[_0x25ce('0x36')]=_['intersection'](_0x269280[_0x25ce('0x2f')],qs[_0x25ce('0x35')](_0x1b211e['query']['fields']));_0x5da346[_0x25ce('0x36')]=_0x5da346['attributes'][_0x25ce('0x37')]?_0x5da346['attributes']:_0x269280[_0x25ce('0x2f')];if(_0x1b211e[_0x25ce('0x31')][_0x25ce('0x43')]){_0x5da346[_0x25ce('0x48')]=[{'all':!![]}];}_0x5da346=_['merge']({},_0x5da346,_0x1b211e[_0x25ce('0x41')]);return db[_0x25ce('0x42')]['find'](_0x5da346)[_0x25ce('0x26')](handleEntityNotFound(_0x2abd72,null))[_0x25ce('0x26')](respondWithResult(_0x2abd72,null))[_0x25ce('0x46')](handleError(_0x2abd72,null));};exports[_0x25ce('0x49')]=function(_0x409144,_0x423ce9){return db[_0x25ce('0x42')][_0x25ce('0x49')](_0x409144[_0x25ce('0x4a')],{})[_0x25ce('0x26')](respondWithResult(_0x423ce9,0xc9))[_0x25ce('0x46')](handleError(_0x423ce9,null));};exports[_0x25ce('0x25')]=function(_0x451ec9,_0x21f299){if(_0x451ec9[_0x25ce('0x4a')]['id']){delete _0x451ec9[_0x25ce('0x4a')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x451ec9[_0x25ce('0x4b')]['id']}})[_0x25ce('0x26')](handleEntityNotFound(_0x21f299,null))['then'](saveUpdates(_0x451ec9['body'],null))[_0x25ce('0x26')](respondWithResult(_0x21f299,null))[_0x25ce('0x46')](handleError(_0x21f299,null));};exports[_0x25ce('0x27')]=function(_0x254230,_0x558ddb){return db[_0x25ce('0x42')][_0x25ce('0x4c')]({'where':{'id':_0x254230[_0x25ce('0x4b')]['id']}})[_0x25ce('0x26')](handleEntityNotFound(_0x558ddb,null))['then'](removeEntity(_0x558ddb,null))['catch'](handleError(_0x558ddb,null));};exports['describe']=function(_0x4ee506,_0x34175c){return db[_0x25ce('0x42')][_0x25ce('0x4d')]()[_0x25ce('0x26')](respondWithResult(_0x34175c,null))[_0x25ce('0x46')](handleError(_0x34175c,null));}; \ No newline at end of file +var _0x2498=['eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','index','map','SmsTransferReport','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe'];(function(_0x804d19,_0x43ea51){var _0x577365=function(_0x5e7441){while(--_0x5e7441){_0x804d19['push'](_0x804d19['shift']());}};_0x577365(++_0x43ea51);}(_0x2498,0x1c2));var _0x8249=function(_0x56e574,_0x14c566){_0x56e574=_0x56e574-0x0;var _0x52eb9e=_0x2498[_0x56e574];return _0x52eb9e;};'use strict';var emlformat=require(_0x8249('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8249('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8249('0x2'));var BPromise=require(_0x8249('0x3'));var Mustache=require(_0x8249('0x4'));var util=require(_0x8249('0x5'));var path=require(_0x8249('0x6'));var sox=require(_0x8249('0x7'));var csv=require('to-csv');var ejs=require(_0x8249('0x8'));var fs=require('fs');var fs_extra=require(_0x8249('0x9'));var _=require(_0x8249('0xa'));var squel=require(_0x8249('0xb'));var crypto=require(_0x8249('0xc'));var jsforce=require(_0x8249('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8249('0xe'));var querystring=require(_0x8249('0xf'));var Papa=require(_0x8249('0x10'));var Redis=require('ioredis');var authService=require(_0x8249('0x11'));var qs=require(_0x8249('0x12'));var as=require(_0x8249('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8249('0x14'))(_0x8249('0x15'));var utils=require(_0x8249('0x16'));var config=require(_0x8249('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8249('0x18'))['db'];function respondWithStatusCode(_0x413381,_0x5ed6d1){_0x5ed6d1=_0x5ed6d1||0xcc;return function(_0x50777a){if(_0x50777a){return _0x413381[_0x8249('0x19')](_0x5ed6d1);}return _0x413381[_0x8249('0x1a')](_0x5ed6d1)[_0x8249('0x1b')]();};}function respondWithResult(_0xd11781,_0x2e5a16){_0x2e5a16=_0x2e5a16||0xc8;return function(_0x2ff19a){if(_0x2ff19a){return _0xd11781[_0x8249('0x1a')](_0x2e5a16)[_0x8249('0x1c')](_0x2ff19a);}};}function respondWithFilteredResult(_0x9c7362,_0x560eb5){return function(_0x3ea904){if(_0x3ea904){var _0xdf251a=typeof _0x560eb5[_0x8249('0x1d')]===_0x8249('0x1e')&&typeof _0x560eb5[_0x8249('0x1f')]===_0x8249('0x1e');var _0x41d6d8=_0x3ea904[_0x8249('0x20')];var _0x57767e=_0xdf251a?0x0:_0x560eb5[_0x8249('0x1d')];var _0x2e05b5=_0xdf251a?_0x3ea904['count']:_0x560eb5[_0x8249('0x1d')]+_0x560eb5[_0x8249('0x1f')];var _0x8b3aaf;if(_0x2e05b5>=_0x41d6d8){_0x2e05b5=_0x41d6d8;_0x8b3aaf=0xc8;}else{_0x8b3aaf=0xce;}_0x9c7362[_0x8249('0x1a')](_0x8b3aaf);return _0x9c7362[_0x8249('0x21')]('Content-Range',_0x57767e+'-'+_0x2e05b5+'/'+_0x41d6d8)[_0x8249('0x1c')](_0x3ea904);}return null;};}function patchUpdates(_0x231a0e){return function(_0x598e43){try{jsonpatch[_0x8249('0x22')](_0x598e43,_0x231a0e,!![]);}catch(_0x5e5af1){return BPromise[_0x8249('0x23')](_0x5e5af1);}return _0x598e43['save']();};}function saveUpdates(_0x59923c,_0x21c1a4){return function(_0x490cbd){if(_0x490cbd){return _0x490cbd[_0x8249('0x24')](_0x59923c)[_0x8249('0x25')](function(_0x10f57d){return _0x10f57d;});}return null;};}function removeEntity(_0x378427,_0x56bdb6){return function(_0x324b24){if(_0x324b24){return _0x324b24[_0x8249('0x26')]()[_0x8249('0x25')](function(){_0x378427[_0x8249('0x1a')](0xcc)[_0x8249('0x1b')]();});}};}function handleEntityNotFound(_0x994e46,_0x24480f){return function(_0x6f633c){if(!_0x6f633c){_0x994e46['sendStatus'](0x194);}return _0x6f633c;};}function handleError(_0x40925b,_0x181661){_0x181661=_0x181661||0x1f4;return function(_0x4a3fe8){logger['error'](_0x4a3fe8[_0x8249('0x27')]);if(_0x4a3fe8['name']){delete _0x4a3fe8[_0x8249('0x28')];}_0x40925b[_0x8249('0x1a')](_0x181661)['send'](_0x4a3fe8);};}exports[_0x8249('0x29')]=function(_0x5847f2,_0x190dc9){var _0x48082e={},_0x501ce3={},_0x148f3={'count':0x0,'rows':[]};var _0x3d1eeb=_[_0x8249('0x2a')](db[_0x8249('0x2b')]['rawAttributes'],function(_0x5630a8){return{'name':_0x5630a8[_0x8249('0x2c')],'type':_0x5630a8['type'][_0x8249('0x2d')]};});_0x501ce3[_0x8249('0x2e')]=_['map'](_0x3d1eeb,_0x8249('0x28'));_0x501ce3['query']=_[_0x8249('0x2f')](_0x5847f2[_0x8249('0x30')]);_0x501ce3[_0x8249('0x31')]=_[_0x8249('0x32')](_0x501ce3['model'],_0x501ce3[_0x8249('0x30')]);_0x48082e[_0x8249('0x33')]=_[_0x8249('0x32')](_0x501ce3[_0x8249('0x2e')],qs[_0x8249('0x34')](_0x5847f2[_0x8249('0x30')]['fields']));_0x48082e[_0x8249('0x33')]=_0x48082e[_0x8249('0x33')]['length']?_0x48082e[_0x8249('0x33')]:_0x501ce3[_0x8249('0x2e')];if(!_0x5847f2[_0x8249('0x30')][_0x8249('0x35')]('nolimit')){_0x48082e[_0x8249('0x1f')]=qs['limit'](_0x5847f2['query']['limit']);_0x48082e[_0x8249('0x1d')]=qs[_0x8249('0x1d')](_0x5847f2[_0x8249('0x30')][_0x8249('0x1d')]);}_0x48082e[_0x8249('0x36')]=qs[_0x8249('0x37')](_0x5847f2[_0x8249('0x30')][_0x8249('0x37')]);_0x48082e[_0x8249('0x38')]=qs[_0x8249('0x31')](_['pick'](_0x5847f2[_0x8249('0x30')],_0x501ce3[_0x8249('0x31')]),_0x3d1eeb);if(_0x5847f2[_0x8249('0x30')][_0x8249('0x39')]){_0x48082e[_0x8249('0x38')]=_[_0x8249('0x3a')](_0x48082e[_0x8249('0x38')],{'$or':_['map'](_0x3d1eeb,function(_0x276cdd){if(_0x276cdd[_0x8249('0x3b')]!==_0x8249('0x3c')){var _0x2a65f9={};_0x2a65f9[_0x276cdd[_0x8249('0x28')]]={'$like':'%'+_0x5847f2[_0x8249('0x30')][_0x8249('0x39')]+'%'};return _0x2a65f9;}})});}_0x48082e=_[_0x8249('0x3a')]({},_0x48082e,_0x5847f2[_0x8249('0x3d')]);var _0x322357={'where':_0x48082e[_0x8249('0x38')]};return db[_0x8249('0x2b')][_0x8249('0x20')](_0x322357)[_0x8249('0x25')](function(_0x691a41){_0x148f3[_0x8249('0x20')]=_0x691a41;if(_0x5847f2['query'][_0x8249('0x3e')]){_0x48082e[_0x8249('0x3f')]=[{'all':!![]}];}return db[_0x8249('0x2b')][_0x8249('0x40')](_0x48082e);})[_0x8249('0x25')](function(_0x3b62cc){_0x148f3[_0x8249('0x41')]=_0x3b62cc;return _0x148f3;})[_0x8249('0x25')](respondWithFilteredResult(_0x190dc9,_0x48082e))[_0x8249('0x42')](handleError(_0x190dc9,null));};exports[_0x8249('0x43')]=function(_0x46e0ea,_0x2728a6){var _0xbb624={'raw':!![],'where':{'id':_0x46e0ea[_0x8249('0x44')]['id']}},_0x37e453={};_0x37e453[_0x8249('0x2e')]=_[_0x8249('0x2f')](db[_0x8249('0x2b')][_0x8249('0x45')]);_0x37e453[_0x8249('0x30')]=_['keys'](_0x46e0ea[_0x8249('0x30')]);_0x37e453['filters']=_[_0x8249('0x32')](_0x37e453[_0x8249('0x2e')],_0x37e453[_0x8249('0x30')]);_0xbb624[_0x8249('0x33')]=_[_0x8249('0x32')](_0x37e453[_0x8249('0x2e')],qs['fields'](_0x46e0ea[_0x8249('0x30')][_0x8249('0x34')]));_0xbb624[_0x8249('0x33')]=_0xbb624[_0x8249('0x33')][_0x8249('0x46')]?_0xbb624[_0x8249('0x33')]:_0x37e453[_0x8249('0x2e')];if(_0x46e0ea[_0x8249('0x30')][_0x8249('0x3e')]){_0xbb624[_0x8249('0x3f')]=[{'all':!![]}];}_0xbb624=_[_0x8249('0x3a')]({},_0xbb624,_0x46e0ea[_0x8249('0x3d')]);return db[_0x8249('0x2b')][_0x8249('0x47')](_0xbb624)['then'](handleEntityNotFound(_0x2728a6,null))['then'](respondWithResult(_0x2728a6,null))[_0x8249('0x42')](handleError(_0x2728a6,null));};exports[_0x8249('0x48')]=function(_0x45c743,_0x1c0906){return db['SmsTransferReport'][_0x8249('0x48')](_0x45c743[_0x8249('0x49')],{})[_0x8249('0x25')](respondWithResult(_0x1c0906,0xc9))[_0x8249('0x42')](handleError(_0x1c0906,null));};exports[_0x8249('0x24')]=function(_0x57369c,_0x315866){if(_0x57369c[_0x8249('0x49')]['id']){delete _0x57369c[_0x8249('0x49')]['id'];}return db['SmsTransferReport'][_0x8249('0x47')]({'where':{'id':_0x57369c[_0x8249('0x44')]['id']}})[_0x8249('0x25')](handleEntityNotFound(_0x315866,null))[_0x8249('0x25')](saveUpdates(_0x57369c[_0x8249('0x49')],null))[_0x8249('0x25')](respondWithResult(_0x315866,null))[_0x8249('0x42')](handleError(_0x315866,null));};exports['destroy']=function(_0x2f4b86,_0x17a502){return db[_0x8249('0x2b')]['find']({'where':{'id':_0x2f4b86[_0x8249('0x44')]['id']}})[_0x8249('0x25')](handleEntityNotFound(_0x17a502,null))[_0x8249('0x25')](removeEntity(_0x17a502,null))[_0x8249('0x42')](handleError(_0x17a502,null));};exports[_0x8249('0x4a')]=function(_0x2a4acc,_0x1857e8){return db[_0x8249('0x2b')][_0x8249('0x4a')]()[_0x8249('0x25')](respondWithResult(_0x1857e8,null))[_0x8249('0x42')](handleError(_0x1857e8,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 38075bb..e77da78 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 _0xdbd0=['./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2029cc,_0x120c63){var _0x593c71=function(_0x1397d4){while(--_0x1397d4){_0x2029cc['push'](_0x2029cc['shift']());}};_0x593c71(++_0x120c63);}(_0xdbd0,0x88));var _0x0dbd=function(_0x2235b9,_0x3ad463){_0x2235b9=_0x2235b9-0x0;var _0x181c29=_0xdbd0[_0x2235b9];return _0x181c29;};'use strict';var _=require(_0x0dbd('0x0'));var util=require(_0x0dbd('0x1'));var logger=require(_0x0dbd('0x2'))(_0x0dbd('0x3'));var moment=require(_0x0dbd('0x4'));var BPromise=require('bluebird');var rp=require(_0x0dbd('0x5'));var fs=require('fs');var path=require(_0x0dbd('0x6'));var rimraf=require(_0x0dbd('0x7'));var config=require('../../config/environment');var attributes=require(_0x0dbd('0x8'));module[_0x0dbd('0x9')]=function(_0xcd515f,_0x3bd770){return _0xcd515f['define']('SmsTransferReport',attributes,{'tableName':_0x0dbd('0xa'),'paranoid':![],'indexes':[{'name':_0x0dbd('0xb'),'fields':[_0x0dbd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7548=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','lodash','util','../../config/logger','moment','request-promise'];(function(_0x2dd61d,_0x90d79c){var _0x48762e=function(_0x4dd3c2){while(--_0x4dd3c2){_0x2dd61d['push'](_0x2dd61d['shift']());}};_0x48762e(++_0x90d79c);}(_0x7548,0x1f3));var _0x8754=function(_0x2c59b3,_0x5d9eef){_0x2c59b3=_0x2c59b3-0x0;var _0x1a7344=_0x7548[_0x2c59b3];return _0x1a7344;};'use strict';var _=require(_0x8754('0x0'));var util=require(_0x8754('0x1'));var logger=require(_0x8754('0x2'))('api');var moment=require(_0x8754('0x3'));var BPromise=require('bluebird');var rp=require(_0x8754('0x4'));var fs=require('fs');var path=require(_0x8754('0x5'));var rimraf=require(_0x8754('0x6'));var config=require(_0x8754('0x7'));var attributes=require(_0x8754('0x8'));module[_0x8754('0x9')]=function(_0x30a548,_0x14eef7){return _0x30a548['define'](_0x8754('0xa'),attributes,{'tableName':_0x8754('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 802f65a..56c71fc 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 _0x98a8=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x51eec9,_0xabb3e6){var _0x445a3d=function(_0x8af3ac){while(--_0x8af3ac){_0x51eec9['push'](_0x51eec9['shift']());}};_0x445a3d(++_0xabb3e6);}(_0x98a8,0x12c));var _0x898a=function(_0x20ddc9,_0x34f6fc){_0x20ddc9=_0x20ddc9-0x0;var _0x40c12f=_0x98a8[_0x20ddc9];return _0x40c12f;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file +var _0x3e9d=['info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5efa12,_0xf7f041){var _0x57cccc=function(_0x585cc9){while(--_0x585cc9){_0x5efa12['push'](_0x5efa12['shift']());}};_0x57cccc(++_0xf7f041);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x359184,_0x3b6d5e){_0x359184=_0x359184-0x0;var _0xa0f9f2=_0x3e9d[_0x359184];return _0xa0f9f2;};'use strict';var _=require(_0xd3e9('0x0'));var util=require(_0xd3e9('0x1'));var moment=require('moment');var BPromise=require(_0xd3e9('0x2'));var rs=require(_0xd3e9('0x3'));var fs=require('fs');var Redis=require(_0xd3e9('0x4'));var db=require(_0xd3e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3e9('0x6'));var config=require(_0xd3e9('0x7'));var jayson=require(_0xd3e9('0x8'));var client=jayson[_0xd3e9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc1de,_0x17f2b0,_0x140f2d){return new BPromise(function(_0x45364e,_0x3025f9){return client[_0xd3e9('0xa')](_0x4dc1de,_0x140f2d)[_0xd3e9('0xb')](function(_0x2944cd){logger['info'](_0xd3e9('0xc'),_0x17f2b0,_0xd3e9('0xd'));logger[_0xd3e9('0xe')](_0xd3e9('0xf'),_0x17f2b0,_0xd3e9('0xd'),JSON[_0xd3e9('0x10')](_0x2944cd));if(_0x2944cd[_0xd3e9('0x11')]){if(_0x2944cd[_0xd3e9('0x11')][_0xd3e9('0x12')]===0x1f4){logger[_0xd3e9('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x17f2b0,_0x2944cd[_0xd3e9('0x11')]['message']);return _0x3025f9(_0x2944cd['error']['message']);}logger[_0xd3e9('0x11')](_0xd3e9('0xc'),_0x17f2b0,_0x2944cd[_0xd3e9('0x11')][_0xd3e9('0x13')]);return _0x45364e(_0x2944cd[_0xd3e9('0x11')][_0xd3e9('0x13')]);}else{logger[_0xd3e9('0x14')](_0xd3e9('0xc'),_0x17f2b0,_0xd3e9('0xd'));_0x45364e(_0x2944cd['result'][_0xd3e9('0x13')]);}})['catch'](function(_0x8b9e10){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x17f2b0,_0x8b9e10);_0x3025f9(_0x8b9e10);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index ed786c5..38eaa93 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 _0xe268=['server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','post','single','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0xe268,0x11a));var _0x8e26=function(_0x3d655b,_0x2057eb){_0x3d655b=_0x3d655b-0x0;var _0x4c7e16=_0xe268[_0x3d655b];return _0x4c7e16;};'use strict';var multer=require(_0x8e26('0x0'));var util=require('util');var path=require(_0x8e26('0x1'));var timeout=require(_0x8e26('0x2'));var express=require(_0x8e26('0x3'));var router=express[_0x8e26('0x4')]();var fs_extra=require(_0x8e26('0x5'));var auth=require(_0x8e26('0x6'));var interaction=require(_0x8e26('0x7'));var config=require(_0x8e26('0x8'));var controller=require(_0x8e26('0x9'));router[_0x8e26('0xa')]('/',auth[_0x8e26('0xb')](),controller[_0x8e26('0xc')]);router[_0x8e26('0xa')](_0x8e26('0xd'),auth[_0x8e26('0xb')](),controller[_0x8e26('0xe')]);router['get'](_0x8e26('0xf'),auth[_0x8e26('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x8e26('0x10')]({'destination':function(_0x100d49,_0x2c0338,_0x1c46e4){_0x1c46e4(null,path[_0x8e26('0x11')](config['root'],_0x8e26('0x12')));},'filename':function(_0x3da02d,_0x425cdb,_0x17d836){_0x425cdb['originalname']=_0x425cdb[_0x8e26('0x13')][_0x8e26('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17d836(null,util['format'](_0x8e26('0x15'),path[_0x8e26('0x16')](_0x425cdb[_0x8e26('0x13')],path[_0x8e26('0x17')](_0x425cdb['originalname'])),Date['now'](),path[_0x8e26('0x17')](_0x425cdb[_0x8e26('0x13')])));}})});router[_0x8e26('0x18')]('/',upload[_0x8e26('0x19')]('file'),controller[_0x8e26('0x1a')]);router[_0x8e26('0x1b')](_0x8e26('0xd'),auth['isAuthenticated'](),controller[_0x8e26('0x1c')]);router['delete'](_0x8e26('0xd'),auth[_0x8e26('0xb')](),controller[_0x8e26('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x7108=['basename','now','extname','post','single','file','create','put','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','index','/:id','show','get','/:id/download','root','originalname','%s-%s%s'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x7108,0x1ef));var _0x8710=function(_0x29560b,_0x5081e7){_0x29560b=_0x29560b-0x0;var _0x23081d=_0x7108[_0x29560b];return _0x23081d;};'use strict';var multer=require(_0x8710('0x0'));var util=require('util');var path=require(_0x8710('0x1'));var timeout=require(_0x8710('0x2'));var express=require(_0x8710('0x3'));var router=express[_0x8710('0x4')]();var fs_extra=require(_0x8710('0x5'));var auth=require(_0x8710('0x6'));var interaction=require(_0x8710('0x7'));var config=require('../../config/environment');var controller=require(_0x8710('0x8'));router['get']('/',auth[_0x8710('0x9')](),controller[_0x8710('0xa')]);router['get'](_0x8710('0xb'),auth[_0x8710('0x9')](),controller[_0x8710('0xc')]);router[_0x8710('0xd')](_0x8710('0xe'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x50483f,_0x36ea94,_0x79e943){_0x79e943(null,path['join'](config[_0x8710('0xf')],'server/files/sounds/original/'));},'filename':function(_0x4181c4,_0xd8d0c0,_0x3571bf){_0xd8d0c0[_0x8710('0x10')]=_0xd8d0c0[_0x8710('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3571bf(null,util['format'](_0x8710('0x11'),path[_0x8710('0x12')](_0xd8d0c0['originalname'],path['extname'](_0xd8d0c0['originalname'])),Date[_0x8710('0x13')](),path[_0x8710('0x14')](_0xd8d0c0[_0x8710('0x10')])));}})});router[_0x8710('0x15')]('/',upload[_0x8710('0x16')](_0x8710('0x17')),controller[_0x8710('0x18')]);router[_0x8710('0x19')](_0x8710('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8710('0x1a')]('/:id',auth[_0x8710('0x9')](),controller[_0x8710('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 9f5ad59..66bec47 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 _0xb157=['name','BIGINT','INTEGER','FLOAT','sequelize','exports','STRING'];(function(_0xf47695,_0x2eaf65){var _0x202673=function(_0x10adae){while(--_0x10adae){_0xf47695['push'](_0xf47695['shift']());}};_0x202673(++_0x2eaf65);}(_0xb157,0x170));var _0x7b15=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb157[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x7b15('0x0'));module[_0x7b15('0x1')]={'name':{'type':Sequelize[_0x7b15('0x2')],'unique':_0x7b15('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x7b15('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x7b15('0x4')]},'original_channelCount':{'type':Sequelize[_0x7b15('0x5')]},'original_bitRate':{'type':Sequelize[_0x7b15('0x4')]},'original_sampleRate':{'type':Sequelize[_0x7b15('0x5')]},'converted_format':{'type':Sequelize[_0x7b15('0x2')]},'converted_duration':{'type':Sequelize[_0x7b15('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x7b15('0x4')]},'converted_channelCount':{'type':Sequelize[_0x7b15('0x5')]},'converted_bitRate':{'type':Sequelize[_0x7b15('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x7b15('0x5')]}}; \ No newline at end of file +var _0x400a=['INTEGER','exports','STRING','name','FLOAT','BIGINT'];(function(_0x569e33,_0x549217){var _0x5e02ef=function(_0x299654){while(--_0x299654){_0x569e33['push'](_0x569e33['shift']());}};_0x5e02ef(++_0x549217);}(_0x400a,0xaf));var _0xa400=function(_0x3e3d6b,_0x3e0e5e){_0x3e3d6b=_0x3e3d6b-0x0;var _0x121b90=_0x400a[_0x3e3d6b];return _0x121b90;};'use strict';var Sequelize=require('sequelize');module[_0xa400('0x0')]={'name':{'type':Sequelize[_0xa400('0x1')],'unique':_0xa400('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa400('0x1')]},'display_name':{'type':Sequelize[_0xa400('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xa400('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xa400('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa400('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xa400('0x4')]},'original_sampleRate':{'type':Sequelize[_0xa400('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xa400('0x4')]},'converted_channelCount':{'type':Sequelize[_0xa400('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xa400('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 886f70c..7e3aee9 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 _0x02de=['query','intersection','attributes','fields','length','nolimit','limit','order','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','keys','options','find','converted_format','existsSync','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','download','join','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','0777','unlinkSync','send','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','role','body','userProfileId','user','Sounds','autoAssociation','pick','description','delete','destroy','server/files/sounds/original','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','error','stack','name','index','map','Sound','rawAttributes','fieldName','key','model'];(function(_0x517648,_0x5df3a8){var _0x45f498=function(_0x4ac6c9){while(--_0x4ac6c9){_0x517648['push'](_0x517648['shift']());}};_0x45f498(++_0x5df3a8);}(_0x02de,0x13b));var _0xe02d=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0x02de[_0x2bcb75];return _0x175345;};'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(_0xe02d('0x0'));var moment=require(_0xe02d('0x1'));var BPromise=require(_0xe02d('0x2'));var Mustache=require('mustache');var util=require(_0xe02d('0x3'));var path=require(_0xe02d('0x4'));var sox=require(_0xe02d('0x5'));var csv=require('to-csv');var ejs=require(_0xe02d('0x6'));var fs=require('fs');var fs_extra=require(_0xe02d('0x7'));var _=require(_0xe02d('0x8'));var squel=require(_0xe02d('0x9'));var crypto=require(_0xe02d('0xa'));var jsforce=require(_0xe02d('0xb'));var deskjs=require(_0xe02d('0xc'));var toCsv=require(_0xe02d('0xd'));var querystring=require('querystring');var Papa=require(_0xe02d('0xe'));var Redis=require(_0xe02d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe02d('0x10'));var as=require(_0xe02d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe02d('0x12'))(_0xe02d('0x13'));var utils=require(_0xe02d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe02d('0x15'));var db=require(_0xe02d('0x16'))['db'];function respondWithStatusCode(_0x4de5e0,_0x2a8277){_0x2a8277=_0x2a8277||0xcc;return function(_0x5dccfa){if(_0x5dccfa){return _0x4de5e0[_0xe02d('0x17')](_0x2a8277);}return _0x4de5e0[_0xe02d('0x18')](_0x2a8277)[_0xe02d('0x19')]();};}function respondWithResult(_0x2eedd9,_0x4c0da0){_0x4c0da0=_0x4c0da0||0xc8;return function(_0x540157){if(_0x540157){return _0x2eedd9[_0xe02d('0x18')](_0x4c0da0)[_0xe02d('0x1a')](_0x540157);}};}function respondWithFilteredResult(_0x535529,_0x5e5285){return function(_0x5d8282){if(_0x5d8282){var _0x12d3bd=typeof _0x5e5285[_0xe02d('0x1b')]===_0xe02d('0x1c')&&typeof _0x5e5285['limit']===_0xe02d('0x1c');var _0x57115d=_0x5d8282[_0xe02d('0x1d')];var _0x102184=_0x12d3bd?0x0:_0x5e5285['offset'];var _0x2f4d99=_0x12d3bd?_0x5d8282[_0xe02d('0x1d')]:_0x5e5285['offset']+_0x5e5285['limit'];var _0x3924e6;if(_0x2f4d99>=_0x57115d){_0x2f4d99=_0x57115d;_0x3924e6=0xc8;}else{_0x3924e6=0xce;}_0x535529['status'](_0x3924e6);return _0x535529[_0xe02d('0x1e')](_0xe02d('0x1f'),_0x102184+'-'+_0x2f4d99+'/'+_0x57115d)[_0xe02d('0x1a')](_0x5d8282);}return null;};}function patchUpdates(_0x242858){return function(_0x291748){try{jsonpatch[_0xe02d('0x20')](_0x291748,_0x242858,!![]);}catch(_0xb40161){return BPromise['reject'](_0xb40161);}return _0x291748[_0xe02d('0x21')]();};}function saveUpdates(_0x4b4d58,_0x131270){return function(_0x4a2659){if(_0x4a2659){return _0x4a2659[_0xe02d('0x22')](_0x4b4d58)[_0xe02d('0x23')](function(_0x4d3c49){return _0x4d3c49;});}return null;};}function removeEntity(_0x10c05e,_0x3bf863){return function(_0xf7283b){if(_0xf7283b){return _0xf7283b['destroy']()['then'](function(){var _0x1c96b1=_0xf7283b[_0xe02d('0x24')]({'plain':!![]});var _0x46ab5b='Sounds';return db[_0xe02d('0x25')]['destroy']({'where':{'type':_0x46ab5b,'resourceId':_0x1c96b1['id']}})['then'](function(){return _0xf7283b;});})['then'](function(){_0x10c05e['status'](0xcc)[_0xe02d('0x19')]();});}};}function handleEntityNotFound(_0x10c17d,_0x22452b){return function(_0x2520e0){if(!_0x2520e0){_0x10c17d[_0xe02d('0x17')](0x194);}return _0x2520e0;};}function handleError(_0x5db8fb,_0xbf3fcc){_0xbf3fcc=_0xbf3fcc||0x1f4;return function(_0x4ae789){logger[_0xe02d('0x26')](_0x4ae789[_0xe02d('0x27')]);if(_0x4ae789['name']){delete _0x4ae789[_0xe02d('0x28')];}_0x5db8fb['status'](_0xbf3fcc)['send'](_0x4ae789);};}exports[_0xe02d('0x29')]=function(_0x459574,_0x417bec){var _0x1df87d={},_0x5a093c={},_0x2fdba1={'count':0x0,'rows':[]};var _0x4a97c9=_[_0xe02d('0x2a')](db[_0xe02d('0x2b')][_0xe02d('0x2c')],function(_0x1ea80c){return{'name':_0x1ea80c[_0xe02d('0x2d')],'type':_0x1ea80c['type'][_0xe02d('0x2e')]};});_0x5a093c[_0xe02d('0x2f')]=_[_0xe02d('0x2a')](_0x4a97c9,_0xe02d('0x28'));_0x5a093c[_0xe02d('0x30')]=_['keys'](_0x459574['query']);_0x5a093c['filters']=_[_0xe02d('0x31')](_0x5a093c[_0xe02d('0x2f')],_0x5a093c[_0xe02d('0x30')]);_0x1df87d[_0xe02d('0x32')]=_[_0xe02d('0x31')](_0x5a093c[_0xe02d('0x2f')],qs[_0xe02d('0x33')](_0x459574[_0xe02d('0x30')][_0xe02d('0x33')]));_0x1df87d[_0xe02d('0x32')]=_0x1df87d[_0xe02d('0x32')][_0xe02d('0x34')]?_0x1df87d['attributes']:_0x5a093c[_0xe02d('0x2f')];if(!_0x459574[_0xe02d('0x30')]['hasOwnProperty'](_0xe02d('0x35'))){_0x1df87d[_0xe02d('0x36')]=qs[_0xe02d('0x36')](_0x459574['query'][_0xe02d('0x36')]);_0x1df87d['offset']=qs[_0xe02d('0x1b')](_0x459574[_0xe02d('0x30')][_0xe02d('0x1b')]);}_0x1df87d[_0xe02d('0x37')]=qs['sort'](_0x459574[_0xe02d('0x30')]['sort']);_0x1df87d['where']=qs['filters'](_['pick'](_0x459574[_0xe02d('0x30')],_0x5a093c['filters']),_0x4a97c9);if(_0x459574[_0xe02d('0x30')]['filter']){_0x1df87d[_0xe02d('0x38')]=_[_0xe02d('0x39')](_0x1df87d['where'],{'$or':_['map'](_0x4a97c9,function(_0x37fda9){if(_0x37fda9[_0xe02d('0x3a')]!==_0xe02d('0x3b')){var _0x53a653={};_0x53a653[_0x37fda9[_0xe02d('0x28')]]={'$like':'%'+_0x459574['query'][_0xe02d('0x3c')]+'%'};return _0x53a653;}})});}_0x1df87d=_[_0xe02d('0x39')]({},_0x1df87d,_0x459574['options']);var _0x21c2ba={'where':_0x1df87d[_0xe02d('0x38')]};return db[_0xe02d('0x2b')][_0xe02d('0x1d')](_0x21c2ba)[_0xe02d('0x23')](function(_0x3318e6){_0x2fdba1[_0xe02d('0x1d')]=_0x3318e6;if(_0x459574[_0xe02d('0x30')][_0xe02d('0x3d')]){_0x1df87d[_0xe02d('0x3e')]=[{'all':!![]}];}return db[_0xe02d('0x2b')][_0xe02d('0x3f')](_0x1df87d);})['then'](function(_0xe1305b){_0x2fdba1[_0xe02d('0x40')]=_0xe1305b;return _0x2fdba1;})[_0xe02d('0x23')](respondWithFilteredResult(_0x417bec,_0x1df87d))[_0xe02d('0x41')](handleError(_0x417bec,null));};exports['show']=function(_0x9eb03a,_0x1235da){var _0x36245a={'raw':!![],'where':{'id':_0x9eb03a[_0xe02d('0x42')]['id']}},_0x170034={};_0x170034['model']=_[_0xe02d('0x43')](db[_0xe02d('0x2b')][_0xe02d('0x2c')]);_0x170034[_0xe02d('0x30')]=_[_0xe02d('0x43')](_0x9eb03a[_0xe02d('0x30')]);_0x170034['filters']=_[_0xe02d('0x31')](_0x170034[_0xe02d('0x2f')],_0x170034['query']);_0x36245a[_0xe02d('0x32')]=_[_0xe02d('0x31')](_0x170034['model'],qs[_0xe02d('0x33')](_0x9eb03a[_0xe02d('0x30')][_0xe02d('0x33')]));_0x36245a[_0xe02d('0x32')]=_0x36245a['attributes'][_0xe02d('0x34')]?_0x36245a[_0xe02d('0x32')]:_0x170034[_0xe02d('0x2f')];if(_0x9eb03a['query'][_0xe02d('0x3d')]){_0x36245a[_0xe02d('0x3e')]=[{'all':!![]}];}_0x36245a=_[_0xe02d('0x39')]({},_0x36245a,_0x9eb03a[_0xe02d('0x44')]);return db['Sound'][_0xe02d('0x45')](_0x36245a)['then'](handleEntityNotFound(_0x1235da,null))[_0xe02d('0x23')](respondWithResult(_0x1235da,null))[_0xe02d('0x41')](handleError(_0x1235da,null));};exports['download']=function(_0x594f0e,_0x5a3515,_0x4a50ba){return db[_0xe02d('0x2b')][_0xe02d('0x45')]({'where':{'id':_0x594f0e[_0xe02d('0x42')]['id']},'attributes':[_0xe02d('0x28'),'save_name',_0xe02d('0x46')],'raw':!![]})[_0xe02d('0x23')](handleEntityNotFound(_0x5a3515,null))[_0xe02d('0x23')](function(_0xf76e2e){if(_0xf76e2e){if(!fs[_0xe02d('0x47')](path['join'](config[_0xe02d('0x48')],_0xe02d('0x49'),_0xf76e2e[_0xe02d('0x4a')]+'.'+_0xf76e2e['converted_format']))){throw new db[(_0xe02d('0x4b'))][(_0xe02d('0x4c'))](_0xe02d('0x4d'));}return _0x5a3515[_0xe02d('0x4e')](path[_0xe02d('0x4f')](config[_0xe02d('0x48')],_0xe02d('0x49'),util[_0xe02d('0x50')]('%s.%s',_0xf76e2e[_0xe02d('0x4a')],_0xf76e2e[_0xe02d('0x46')])),util[_0xe02d('0x50')](_0xe02d('0x51'),_0xf76e2e[_0xe02d('0x28')],_0xf76e2e['converted_format']));}return null;})[_0xe02d('0x41')](handleError(_0x5a3515,null));};exports[_0xe02d('0x52')]=function(_0x9ddefe,_0x4a97e9,_0x35cca0){var _0x5d51e2={'name':path[_0xe02d('0x53')](_0x9ddefe[_0xe02d('0x54')][_0xe02d('0x55')],path['extname'](_0x9ddefe['file'][_0xe02d('0x55')])),'save_name':path[_0xe02d('0x53')](_0x9ddefe['file'][_0xe02d('0x56')],path[_0xe02d('0x57')](_0x9ddefe['file'][_0xe02d('0x56')])),'original_format':path['extname'](_0x9ddefe[_0xe02d('0x54')]['originalname'])[_0xe02d('0x58')](0x1),'converted_format':_0xe02d('0x59')};var _0x16f494=path[_0xe02d('0x4f')](config[_0xe02d('0x48')],'server/files/sounds/original',_0x9ddefe[_0xe02d('0x54')][_0xe02d('0x56')]);var _0x28ace6=path[_0xe02d('0x4f')](config[_0xe02d('0x48')],'server/files/sounds/converted',util[_0xe02d('0x50')](_0xe02d('0x51'),path[_0xe02d('0x53')](_0x9ddefe[_0xe02d('0x54')]['filename'],path[_0xe02d('0x57')](_0x9ddefe[_0xe02d('0x54')][_0xe02d('0x56')])),_0x5d51e2[_0xe02d('0x46')]));logger[_0xe02d('0x5a')](_0xe02d('0x5b'),_0x16f494);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x28ace6);try{fs['chmodSync'](_0x16f494,parseInt(_0xe02d('0x5c'),0x8));var _0x17e3db=sox['transcode'](_0x16f494,_0x28ace6,{'sampleRate':0x1f40,'format':_0xe02d('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x17e3db['on'](_0xe02d('0x26'),function(_0x5411d5){fs[_0xe02d('0x5d')](_0x16f494);_0x4a97e9[_0xe02d('0x18')](0x1f4)[_0xe02d('0x5e')](_0x5411d5);});_0x17e3db['on'](_0xe02d('0x5f'),function(_0x2949a8){_0x5d51e2['original_duration']=isNaN(_0x2949a8[_0xe02d('0x60')])?null:_0x2949a8[_0xe02d('0x60')]*0x3e8;_0x5d51e2['original_sampleCount']=isNaN(_0x2949a8[_0xe02d('0x61')])?null:_0x2949a8['sampleCount'];_0x5d51e2[_0xe02d('0x62')]=isNaN(_0x2949a8[_0xe02d('0x63')])?null:_0x2949a8['channelCount'];_0x5d51e2[_0xe02d('0x64')]=isNaN(_0x2949a8[_0xe02d('0x65')])?null:_0x2949a8[_0xe02d('0x65')];_0x5d51e2[_0xe02d('0x66')]=isNaN(_0x2949a8[_0xe02d('0x67')])?null:_0x2949a8[_0xe02d('0x67')];});_0x17e3db['on'](_0xe02d('0x68'),function(_0x4d6ebf){_0x5d51e2[_0xe02d('0x69')]=isNaN(_0x4d6ebf[_0xe02d('0x60')])?null:_0x4d6ebf[_0xe02d('0x60')]*0x3e8;_0x5d51e2[_0xe02d('0x6a')]=isNaN(_0x4d6ebf[_0xe02d('0x61')])?null:_0x4d6ebf[_0xe02d('0x61')];_0x5d51e2['converted_channelCount']=isNaN(_0x4d6ebf[_0xe02d('0x63')])?null:_0x4d6ebf[_0xe02d('0x63')];_0x5d51e2[_0xe02d('0x6b')]=isNaN(_0x4d6ebf[_0xe02d('0x65')])?null:_0x4d6ebf[_0xe02d('0x65')];_0x5d51e2[_0xe02d('0x6c')]=isNaN(_0x4d6ebf['sampleRate'])?null:_0x4d6ebf[_0xe02d('0x67')];});_0x17e3db['on'](_0xe02d('0x19'),function(){fs[_0xe02d('0x6d')](_0x28ace6,parseInt('0777',0x8));return db['Sound'][_0xe02d('0x52')](_0x5d51e2)[_0xe02d('0x23')](function(_0x41a1e6){var _0x573323={'role':_0x9ddefe['body'][_0xe02d('0x6e')],'userProfileId':_0x9ddefe[_0xe02d('0x6f')][_0xe02d('0x70')]};if(!_0x573323)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x573323[_0xe02d('0x6e')]===_0xe02d('0x71')){var _0x2b4d06=_0x41a1e6[_0xe02d('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xe02d('0x45')]({'where':{'name':_0xe02d('0x72'),'userProfileId':_0x573323['userProfileId']},'raw':!![]})['then'](function(_0x1e5775){if(_0x1e5775&&_0x1e5775[_0xe02d('0x73')]===0x0){return db[_0xe02d('0x25')][_0xe02d('0x52')]({'name':_0x2b4d06[_0xe02d('0x28')],'resourceId':_0x2b4d06['id'],'type':_0x1e5775[_0xe02d('0x28')],'sectionId':_0x1e5775['id']},{})[_0xe02d('0x23')](function(){return _0x41a1e6;});}else{return _0x41a1e6;}})[_0xe02d('0x41')](function(_0x351aac){logger[_0xe02d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x351aac);throw _0x351aac;});}return _0x41a1e6;})[_0xe02d('0x23')](respondWithResult(_0x4a97e9,null))[_0xe02d('0x41')](handleError(_0x4a97e9,null));});_0x17e3db['start']();}catch(_0xd68b9c){_0x4a97e9[_0xe02d('0x18')](0x1f4)[_0xe02d('0x5e')](_0xd68b9c);}};exports['update']=function(_0x417654,_0x84b262,_0x232239){return db[_0xe02d('0x2b')][_0xe02d('0x45')]({'where':{'id':_0x417654['params']['id']}})[_0xe02d('0x23')](handleEntityNotFound(_0x84b262,null))[_0xe02d('0x23')](saveUpdates(_[_0xe02d('0x74')](_0x417654[_0xe02d('0x6f')],['name',_0xe02d('0x75')]),null))[_0xe02d('0x23')](respondWithResult(_0x84b262,null))[_0xe02d('0x41')](handleError(_0x84b262,null));};exports[_0xe02d('0x76')]=function(_0x80c00d,_0x2db8c8,_0x55007c){return db[_0xe02d('0x2b')][_0xe02d('0x45')]({'where':{'id':_0x80c00d[_0xe02d('0x42')]['id']}})[_0xe02d('0x23')](function(_0x4961d7){if(_0x4961d7){return _0x4961d7[_0xe02d('0x77')]();}})[_0xe02d('0x23')](function(_0x110bcd){var _0x5510a1=path[_0xe02d('0x4f')](config[_0xe02d('0x48')],_0xe02d('0x78'),util['format'](_0xe02d('0x51'),_0x110bcd[_0xe02d('0x4a')],_0x110bcd['original_format']));var _0x2bc9ea=path['join'](config[_0xe02d('0x48')],_0xe02d('0x49'),util[_0xe02d('0x50')](_0xe02d('0x51'),_0x110bcd[_0xe02d('0x4a')],_0x110bcd['converted_format']));fs[_0xe02d('0x5d')](_0x5510a1);fs[_0xe02d('0x5d')](_0x2bc9ea);return _0x110bcd;})[_0xe02d('0x23')](function(_0x3d32c9){if(_0x3d32c9){return _0x2db8c8[_0xe02d('0x18')](0xcc)[_0xe02d('0x19')]();}})['then'](handleEntityNotFound(_0x2db8c8,null))[_0xe02d('0x41')](handleError(_0x2db8c8,null));}; \ No newline at end of file +var _0xf722=['src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','start','description','delete','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','fs-extra','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','Sounds','UserProfileResource','error','name','Sound','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','create','basename','file','originalname','extname','filename','substring','wav','format','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','send'];(function(_0x3ed136,_0x16fb6b){var _0x45292b=function(_0x42e5b6){while(--_0x42e5b6){_0x3ed136['push'](_0x3ed136['shift']());}};_0x45292b(++_0x16fb6b);}(_0xf722,0x1ed));var _0x2f72=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xf722[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x2f72('0x0'));var rimraf=require(_0x2f72('0x1'));var zipdir=require(_0x2f72('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f72('0x3'));var moment=require(_0x2f72('0x4'));var BPromise=require(_0x2f72('0x5'));var Mustache=require(_0x2f72('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2f72('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f72('0x8'));var _=require('lodash');var squel=require(_0x2f72('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2f72('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2f72('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2f72('0xc'));var as=require(_0x2f72('0xd'));var hardwareService=require(_0x2f72('0xe'));var logger=require(_0x2f72('0xf'))(_0x2f72('0x10'));var utils=require(_0x2f72('0x11'));var config=require(_0x2f72('0x12'));var licenseUtil=require(_0x2f72('0x13'));var db=require(_0x2f72('0x14'))['db'];function respondWithStatusCode(_0x33dab6,_0x123275){_0x123275=_0x123275||0xcc;return function(_0x3de2c5){if(_0x3de2c5){return _0x33dab6[_0x2f72('0x15')](_0x123275);}return _0x33dab6[_0x2f72('0x16')](_0x123275)[_0x2f72('0x17')]();};}function respondWithResult(_0x24bf42,_0x2d79a1){_0x2d79a1=_0x2d79a1||0xc8;return function(_0x911634){if(_0x911634){return _0x24bf42[_0x2f72('0x16')](_0x2d79a1)[_0x2f72('0x18')](_0x911634);}};}function respondWithFilteredResult(_0x308a3f,_0x2b82b2){return function(_0x378f76){if(_0x378f76){var _0x402ac8=typeof _0x2b82b2[_0x2f72('0x19')]===_0x2f72('0x1a')&&typeof _0x2b82b2[_0x2f72('0x1b')]===_0x2f72('0x1a');var _0x22fa00=_0x378f76[_0x2f72('0x1c')];var _0x44bb71=_0x402ac8?0x0:_0x2b82b2[_0x2f72('0x19')];var _0x23abba=_0x402ac8?_0x378f76[_0x2f72('0x1c')]:_0x2b82b2['offset']+_0x2b82b2[_0x2f72('0x1b')];var _0x587718;if(_0x23abba>=_0x22fa00){_0x23abba=_0x22fa00;_0x587718=0xc8;}else{_0x587718=0xce;}_0x308a3f['status'](_0x587718);return _0x308a3f[_0x2f72('0x1d')](_0x2f72('0x1e'),_0x44bb71+'-'+_0x23abba+'/'+_0x22fa00)[_0x2f72('0x18')](_0x378f76);}return null;};}function patchUpdates(_0x483e5b){return function(_0x35e194){try{jsonpatch[_0x2f72('0x1f')](_0x35e194,_0x483e5b,!![]);}catch(_0x348f72){return BPromise['reject'](_0x348f72);}return _0x35e194['save']();};}function saveUpdates(_0x1c442d,_0x2e43b3){return function(_0x363574){if(_0x363574){return _0x363574[_0x2f72('0x20')](_0x1c442d)['then'](function(_0x3326d7){return _0x3326d7;});}return null;};}function removeEntity(_0x2f427d,_0x1ac77a){return function(_0x104979){if(_0x104979){return _0x104979[_0x2f72('0x21')]()[_0x2f72('0x22')](function(){var _0x2d0cb3=_0x104979['get']({'plain':!![]});var _0x2d015d=_0x2f72('0x23');return db[_0x2f72('0x24')][_0x2f72('0x21')]({'where':{'type':_0x2d015d,'resourceId':_0x2d0cb3['id']}})[_0x2f72('0x22')](function(){return _0x104979;});})['then'](function(){_0x2f427d[_0x2f72('0x16')](0xcc)[_0x2f72('0x17')]();});}};}function handleEntityNotFound(_0x1091d9,_0x542822){return function(_0x41e1bb){if(!_0x41e1bb){_0x1091d9[_0x2f72('0x15')](0x194);}return _0x41e1bb;};}function handleError(_0x497838,_0x253b6e){_0x253b6e=_0x253b6e||0x1f4;return function(_0x22e401){logger[_0x2f72('0x25')](_0x22e401['stack']);if(_0x22e401[_0x2f72('0x26')]){delete _0x22e401[_0x2f72('0x26')];}_0x497838[_0x2f72('0x16')](_0x253b6e)['send'](_0x22e401);};}exports['index']=function(_0x150614,_0x539e31){var _0x42ec67={},_0x1446a7={},_0x27e001={'count':0x0,'rows':[]};var _0x3ca25a=_['map'](db[_0x2f72('0x27')][_0x2f72('0x28')],function(_0x2f9102){return{'name':_0x2f9102[_0x2f72('0x29')],'type':_0x2f9102['type'][_0x2f72('0x2a')]};});_0x1446a7[_0x2f72('0x2b')]=_[_0x2f72('0x2c')](_0x3ca25a,'name');_0x1446a7[_0x2f72('0x2d')]=_[_0x2f72('0x2e')](_0x150614[_0x2f72('0x2d')]);_0x1446a7[_0x2f72('0x2f')]=_[_0x2f72('0x30')](_0x1446a7[_0x2f72('0x2b')],_0x1446a7[_0x2f72('0x2d')]);_0x42ec67[_0x2f72('0x31')]=_[_0x2f72('0x30')](_0x1446a7[_0x2f72('0x2b')],qs[_0x2f72('0x32')](_0x150614['query']['fields']));_0x42ec67[_0x2f72('0x31')]=_0x42ec67[_0x2f72('0x31')]['length']?_0x42ec67['attributes']:_0x1446a7[_0x2f72('0x2b')];if(!_0x150614[_0x2f72('0x2d')][_0x2f72('0x33')](_0x2f72('0x34'))){_0x42ec67['limit']=qs[_0x2f72('0x1b')](_0x150614[_0x2f72('0x2d')][_0x2f72('0x1b')]);_0x42ec67[_0x2f72('0x19')]=qs[_0x2f72('0x19')](_0x150614[_0x2f72('0x2d')][_0x2f72('0x19')]);}_0x42ec67['order']=qs[_0x2f72('0x35')](_0x150614[_0x2f72('0x2d')][_0x2f72('0x35')]);_0x42ec67[_0x2f72('0x36')]=qs[_0x2f72('0x2f')](_[_0x2f72('0x37')](_0x150614[_0x2f72('0x2d')],_0x1446a7[_0x2f72('0x2f')]),_0x3ca25a);if(_0x150614[_0x2f72('0x2d')][_0x2f72('0x38')]){_0x42ec67['where']=_['merge'](_0x42ec67[_0x2f72('0x36')],{'$or':_[_0x2f72('0x2c')](_0x3ca25a,function(_0x379671){if(_0x379671['type']!=='VIRTUAL'){var _0x54c68c={};_0x54c68c[_0x379671[_0x2f72('0x26')]]={'$like':'%'+_0x150614[_0x2f72('0x2d')][_0x2f72('0x38')]+'%'};return _0x54c68c;}})});}_0x42ec67=_[_0x2f72('0x39')]({},_0x42ec67,_0x150614[_0x2f72('0x3a')]);var _0x58af80={'where':_0x42ec67['where']};return db['Sound']['count'](_0x58af80)[_0x2f72('0x22')](function(_0x5b5540){_0x27e001[_0x2f72('0x1c')]=_0x5b5540;if(_0x150614[_0x2f72('0x2d')][_0x2f72('0x3b')]){_0x42ec67[_0x2f72('0x3c')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x42ec67);})['then'](function(_0x4c9a7b){_0x27e001[_0x2f72('0x3d')]=_0x4c9a7b;return _0x27e001;})[_0x2f72('0x22')](respondWithFilteredResult(_0x539e31,_0x42ec67))[_0x2f72('0x3e')](handleError(_0x539e31,null));};exports[_0x2f72('0x3f')]=function(_0x5ce41c,_0x535624){var _0x40b675={'raw':!![],'where':{'id':_0x5ce41c[_0x2f72('0x40')]['id']}},_0xcfde92={};_0xcfde92[_0x2f72('0x2b')]=_[_0x2f72('0x2e')](db[_0x2f72('0x27')][_0x2f72('0x28')]);_0xcfde92[_0x2f72('0x2d')]=_[_0x2f72('0x2e')](_0x5ce41c['query']);_0xcfde92[_0x2f72('0x2f')]=_[_0x2f72('0x30')](_0xcfde92[_0x2f72('0x2b')],_0xcfde92[_0x2f72('0x2d')]);_0x40b675[_0x2f72('0x31')]=_[_0x2f72('0x30')](_0xcfde92[_0x2f72('0x2b')],qs[_0x2f72('0x32')](_0x5ce41c[_0x2f72('0x2d')]['fields']));_0x40b675['attributes']=_0x40b675[_0x2f72('0x31')]['length']?_0x40b675[_0x2f72('0x31')]:_0xcfde92['model'];if(_0x5ce41c[_0x2f72('0x2d')][_0x2f72('0x3b')]){_0x40b675[_0x2f72('0x3c')]=[{'all':!![]}];}_0x40b675=_[_0x2f72('0x39')]({},_0x40b675,_0x5ce41c[_0x2f72('0x3a')]);return db[_0x2f72('0x27')][_0x2f72('0x41')](_0x40b675)[_0x2f72('0x22')](handleEntityNotFound(_0x535624,null))[_0x2f72('0x22')](respondWithResult(_0x535624,null))[_0x2f72('0x3e')](handleError(_0x535624,null));};exports[_0x2f72('0x42')]=function(_0xb088ad,_0x24e619,_0x1285e9){return db[_0x2f72('0x27')][_0x2f72('0x41')]({'where':{'id':_0xb088ad['params']['id']},'attributes':['name',_0x2f72('0x43'),_0x2f72('0x44')],'raw':!![]})['then'](handleEntityNotFound(_0x24e619,null))['then'](function(_0x3a80a9){if(_0x3a80a9){if(!fs[_0x2f72('0x45')](path[_0x2f72('0x46')](config[_0x2f72('0x47')],_0x2f72('0x48'),_0x3a80a9[_0x2f72('0x43')]+'.'+_0x3a80a9[_0x2f72('0x44')]))){throw new db[(_0x2f72('0x49'))]['ValidationError'](_0x2f72('0x4a'));}return _0x24e619[_0x2f72('0x42')](path[_0x2f72('0x46')](config[_0x2f72('0x47')],_0x2f72('0x48'),util['format']('%s.%s',_0x3a80a9[_0x2f72('0x43')],_0x3a80a9[_0x2f72('0x44')])),util['format']('%s.%s',_0x3a80a9[_0x2f72('0x26')],_0x3a80a9[_0x2f72('0x44')]));}return null;})[_0x2f72('0x3e')](handleError(_0x24e619,null));};exports[_0x2f72('0x4b')]=function(_0x24a80c,_0xde9817,_0x14d36c){var _0x47616a={'name':path[_0x2f72('0x4c')](_0x24a80c[_0x2f72('0x4d')][_0x2f72('0x4e')],path[_0x2f72('0x4f')](_0x24a80c['file'][_0x2f72('0x4e')])),'save_name':path[_0x2f72('0x4c')](_0x24a80c[_0x2f72('0x4d')][_0x2f72('0x50')],path['extname'](_0x24a80c[_0x2f72('0x4d')][_0x2f72('0x50')])),'original_format':path[_0x2f72('0x4f')](_0x24a80c['file'][_0x2f72('0x4e')])[_0x2f72('0x51')](0x1),'converted_format':_0x2f72('0x52')};var _0x24671b=path[_0x2f72('0x46')](config[_0x2f72('0x47')],'server/files/sounds/original',_0x24a80c['file'][_0x2f72('0x50')]);var _0x1b7028=path[_0x2f72('0x46')](config[_0x2f72('0x47')],_0x2f72('0x48'),util[_0x2f72('0x53')](_0x2f72('0x54'),path[_0x2f72('0x4c')](_0x24a80c[_0x2f72('0x4d')]['filename'],path[_0x2f72('0x4f')](_0x24a80c[_0x2f72('0x4d')][_0x2f72('0x50')])),_0x47616a[_0x2f72('0x44')]));logger[_0x2f72('0x55')](_0x2f72('0x56'),_0x24671b);logger[_0x2f72('0x55')](_0x2f72('0x57'),_0x1b7028);try{fs[_0x2f72('0x58')](_0x24671b,parseInt('0777',0x8));var _0x1a7b13=sox[_0x2f72('0x59')](_0x24671b,_0x1b7028,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a7b13['on'](_0x2f72('0x25'),function(_0xabb5c){fs[_0x2f72('0x5a')](_0x24671b);_0xde9817['status'](0x1f4)[_0x2f72('0x5b')](_0xabb5c);});_0x1a7b13['on'](_0x2f72('0x5c'),function(_0x48a9f9){_0x47616a[_0x2f72('0x5d')]=isNaN(_0x48a9f9[_0x2f72('0x5e')])?null:_0x48a9f9[_0x2f72('0x5e')]*0x3e8;_0x47616a[_0x2f72('0x5f')]=isNaN(_0x48a9f9['sampleCount'])?null:_0x48a9f9[_0x2f72('0x60')];_0x47616a[_0x2f72('0x61')]=isNaN(_0x48a9f9['channelCount'])?null:_0x48a9f9['channelCount'];_0x47616a[_0x2f72('0x62')]=isNaN(_0x48a9f9[_0x2f72('0x63')])?null:_0x48a9f9[_0x2f72('0x63')];_0x47616a['original_sampleRate']=isNaN(_0x48a9f9['sampleRate'])?null:_0x48a9f9[_0x2f72('0x64')];});_0x1a7b13['on'](_0x2f72('0x65'),function(_0x3d8c63){_0x47616a[_0x2f72('0x66')]=isNaN(_0x3d8c63['duration'])?null:_0x3d8c63[_0x2f72('0x5e')]*0x3e8;_0x47616a[_0x2f72('0x67')]=isNaN(_0x3d8c63[_0x2f72('0x60')])?null:_0x3d8c63[_0x2f72('0x60')];_0x47616a[_0x2f72('0x68')]=isNaN(_0x3d8c63[_0x2f72('0x69')])?null:_0x3d8c63[_0x2f72('0x69')];_0x47616a[_0x2f72('0x6a')]=isNaN(_0x3d8c63[_0x2f72('0x63')])?null:_0x3d8c63[_0x2f72('0x63')];_0x47616a[_0x2f72('0x6b')]=isNaN(_0x3d8c63[_0x2f72('0x64')])?null:_0x3d8c63[_0x2f72('0x64')];});_0x1a7b13['on']('end',function(){fs[_0x2f72('0x58')](_0x1b7028,parseInt(_0x2f72('0x6c'),0x8));return db[_0x2f72('0x27')][_0x2f72('0x4b')](_0x47616a)[_0x2f72('0x22')](function(_0x447e4e){var _0x270ca3={'role':_0x24a80c[_0x2f72('0x6d')][_0x2f72('0x6e')],'userProfileId':_0x24a80c[_0x2f72('0x6d')]['userProfileId']};if(!_0x270ca3)throw new Error(_0x2f72('0x6f'));if(_0x270ca3[_0x2f72('0x6e')]==='user'){var _0x368c51=_0x447e4e['get']({'plain':!![]});return db[_0x2f72('0x70')]['find']({'where':{'name':'Sounds','userProfileId':_0x270ca3[_0x2f72('0x71')]},'raw':!![]})[_0x2f72('0x22')](function(_0x3273a3){if(_0x3273a3&&_0x3273a3['autoAssociation']===0x0){return db[_0x2f72('0x24')][_0x2f72('0x4b')]({'name':_0x368c51['name'],'resourceId':_0x368c51['id'],'type':_0x3273a3[_0x2f72('0x26')],'sectionId':_0x3273a3['id']},{})[_0x2f72('0x22')](function(){return _0x447e4e;});}else{return _0x447e4e;}})[_0x2f72('0x3e')](function(_0x212b92){logger[_0x2f72('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x212b92);throw _0x212b92;});}return _0x447e4e;})['then'](respondWithResult(_0xde9817,null))['catch'](handleError(_0xde9817,null));});_0x1a7b13[_0x2f72('0x72')]();}catch(_0x593360){_0xde9817['status'](0x1f4)[_0x2f72('0x5b')](_0x593360);}};exports['update']=function(_0x1638cb,_0x2417c6,_0x265e06){return db['Sound'][_0x2f72('0x41')]({'where':{'id':_0x1638cb[_0x2f72('0x40')]['id']}})['then'](handleEntityNotFound(_0x2417c6,null))[_0x2f72('0x22')](saveUpdates(_[_0x2f72('0x37')](_0x1638cb[_0x2f72('0x6d')],[_0x2f72('0x26'),_0x2f72('0x73')]),null))[_0x2f72('0x22')](respondWithResult(_0x2417c6,null))[_0x2f72('0x3e')](handleError(_0x2417c6,null));};exports[_0x2f72('0x74')]=function(_0x4d1e15,_0x3cdb9a,_0x15c08a){return db[_0x2f72('0x27')][_0x2f72('0x41')]({'where':{'id':_0x4d1e15[_0x2f72('0x40')]['id']}})[_0x2f72('0x22')](function(_0x48e39a){if(_0x48e39a){return _0x48e39a['destroy']();}})[_0x2f72('0x22')](function(_0x13faec){var _0x43f7eb=path['join'](config[_0x2f72('0x47')],'server/files/sounds/original',util[_0x2f72('0x53')](_0x2f72('0x54'),_0x13faec[_0x2f72('0x43')],_0x13faec['original_format']));var _0x53213c=path[_0x2f72('0x46')](config['root'],_0x2f72('0x48'),util[_0x2f72('0x53')](_0x2f72('0x54'),_0x13faec['save_name'],_0x13faec[_0x2f72('0x44')]));fs['unlinkSync'](_0x43f7eb);fs[_0x2f72('0x5a')](_0x53213c);return _0x13faec;})[_0x2f72('0x22')](function(_0x2c98f6){if(_0x2c98f6){return _0x3cdb9a[_0x2f72('0x16')](0xcc)['end']();}})[_0x2f72('0x22')](handleEntityNotFound(_0x3cdb9a,null))[_0x2f72('0x3e')](handleError(_0x3cdb9a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 61a32cb..60e94dc 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 _0x4559=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4559,0xdb));var _0x9455=function(_0x4e0ab8,_0x401afb){_0x4e0ab8=_0x4e0ab8-0x0;var _0x4c1f40=_0x4559[_0x4e0ab8];return _0x4c1f40;};'use strict';var _=require('lodash');var util=require(_0x9455('0x0'));var logger=require(_0x9455('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9455('0x2'));var rp=require(_0x9455('0x3'));var fs=require('fs');var path=require(_0x9455('0x4'));var rimraf=require(_0x9455('0x5'));var config=require(_0x9455('0x6'));var attributes=require(_0x9455('0x7'));module[_0x9455('0x8')]=function(_0x1b1a9b,_0x58c73b){return _0x1b1a9b[_0x9455('0x9')](_0x9455('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x730f=['rimraf','exports','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4f7c31,_0x4ef205){var _0x1783a9=function(_0x4fb3cb){while(--_0x4fb3cb){_0x4f7c31['push'](_0x4f7c31['shift']());}};_0x1783a9(++_0x4ef205);}(_0x730f,0x162));var _0xf730=function(_0x206381,_0x1775b4){_0x206381=_0x206381-0x0;var _0x2da6a1=_0x730f[_0x206381];return _0x2da6a1;};'use strict';var _=require(_0xf730('0x0'));var util=require('util');var logger=require(_0xf730('0x1'))(_0xf730('0x2'));var moment=require(_0xf730('0x3'));var BPromise=require(_0xf730('0x4'));var rp=require(_0xf730('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf730('0x6'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0xf730('0x7')]=function(_0x4e7166,_0x16d000){return _0x4e7166['define']('Sound',attributes,{'tableName':'tools_sounds','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 abe1ff2..cefa178 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 _0xf316=['request\x20sent','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x58d217,_0x5acb1a){var _0x2774ac=function(_0x128afa){while(--_0x128afa){_0x58d217['push'](_0x58d217['shift']());}};_0x2774ac(++_0x5acb1a);}(_0xf316,0x7a));var _0x6f31=function(_0x12aa8a,_0x5d7b4f){_0x12aa8a=_0x12aa8a-0x0;var _0x2b221e=_0xf316[_0x12aa8a];return _0x2b221e;};'use strict';var _=require(_0x6f31('0x0'));var util=require(_0x6f31('0x1'));var moment=require(_0x6f31('0x2'));var BPromise=require(_0x6f31('0x3'));var rs=require(_0x6f31('0x4'));var fs=require('fs');var Redis=require(_0x6f31('0x5'));var db=require(_0x6f31('0x6'))['db'];var utils=require(_0x6f31('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f31('0x8'));var jayson=require(_0x6f31('0x9'));var client=jayson[_0x6f31('0xa')][_0x6f31('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5714ec,_0x5c0637,_0x3fec03){return new BPromise(function(_0x37db22,_0xe297){return client[_0x6f31('0xc')](_0x5714ec,_0x3fec03)[_0x6f31('0xd')](function(_0x572e14){logger[_0x6f31('0xe')](_0x6f31('0xf'),_0x5c0637,'request\x20sent');logger[_0x6f31('0x10')](_0x6f31('0x11'),_0x5c0637,_0x6f31('0x12'),JSON[_0x6f31('0x13')](_0x572e14));if(_0x572e14[_0x6f31('0x14')]){if(_0x572e14['error'][_0x6f31('0x15')]===0x1f4){logger[_0x6f31('0x14')](_0x6f31('0xf'),_0x5c0637,_0x572e14[_0x6f31('0x14')]['message']);return _0xe297(_0x572e14[_0x6f31('0x14')][_0x6f31('0x16')]);}logger[_0x6f31('0x14')](_0x6f31('0xf'),_0x5c0637,_0x572e14['error']['message']);return _0x37db22(_0x572e14[_0x6f31('0x14')]['message']);}else{logger[_0x6f31('0xe')]('Sound,\x20%s,\x20%s',_0x5c0637,_0x6f31('0x12'));_0x37db22(_0x572e14[_0x6f31('0x17')][_0x6f31('0x16')]);}})[_0x6f31('0x18')](function(_0x37ea36){logger[_0x6f31('0x14')](_0x6f31('0xf'),_0x5c0637,_0x37ea36);_0xe297(_0x37ea36);});});}exports[_0x6f31('0x19')]=function(_0xfa334){var _0x17202a=this;return new Promise(function(_0x12b54b,_0x50d43e){return db[_0x6f31('0x1a')][_0x6f31('0x1b')]({'raw':_0xfa334[_0x6f31('0x1c')]?_0xfa334['options'][_0x6f31('0x1d')]===undefined?!![]:![]:!![],'where':_0xfa334[_0x6f31('0x1c')]?_0xfa334[_0x6f31('0x1c')][_0x6f31('0x1e')]||null:null,'attributes':_0xfa334[_0x6f31('0x1c')]?_0xfa334[_0x6f31('0x1c')]['attributes']||null:null,'include':_0xfa334[_0x6f31('0x1c')]?_0xfa334[_0x6f31('0x1c')][_0x6f31('0x1f')]?_[_0x6f31('0x20')](_0xfa334[_0x6f31('0x1c')][_0x6f31('0x1f')],function(_0x4d7065){return{'model':db[_0x4d7065[_0x6f31('0x21')]],'as':_0x4d7065['as'],'attributes':_0x4d7065[_0x6f31('0x22')],'include':_0x4d7065[_0x6f31('0x1f')]?_[_0x6f31('0x20')](_0x4d7065[_0x6f31('0x1f')],function(_0x17e438){return{'model':db[_0x17e438[_0x6f31('0x21')]],'as':_0x17e438['as'],'attributes':_0x17e438[_0x6f31('0x22')],'include':_0x17e438[_0x6f31('0x1f')]?_[_0x6f31('0x20')](_0x17e438['include'],function(_0x343d57){return{'model':db[_0x343d57[_0x6f31('0x21')]],'as':_0x343d57['as'],'attributes':_0x343d57[_0x6f31('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6f31('0xd')](function(_0x128681){logger['info'](_0x6f31('0x19'),_0xfa334);logger[_0x6f31('0x10')](_0x6f31('0x19'),_0xfa334,JSON[_0x6f31('0x13')](_0x128681));_0x12b54b(_0x128681);})['catch'](function(_0x5134c0){logger['error'](_0x6f31('0x19'),_0x5134c0[_0x6f31('0x16')],_0xfa334);_0x50d43e(_0x17202a[_0x6f31('0x14')](0x1f4,_0x5134c0['message']));});});}; \ No newline at end of file +var _0xa441=['then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSound','Sound','options','raw','where','attributes','include','map','model','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0xfb3b3,_0x10db7a){var _0x36cae7=function(_0x183814){while(--_0x183814){_0xfb3b3['push'](_0xfb3b3['shift']());}};_0x36cae7(++_0x10db7a);}(_0xa441,0xd5));var _0x1a44=function(_0x473bae,_0x580d37){_0x473bae=_0x473bae-0x0;var _0x213c06=_0xa441[_0x473bae];return _0x213c06;};'use strict';var _=require('lodash');var util=require(_0x1a44('0x0'));var moment=require(_0x1a44('0x1'));var BPromise=require(_0x1a44('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a44('0x3'));var db=require(_0x1a44('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a44('0x5'))(_0x1a44('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a44('0x7'));var client=jayson[_0x1a44('0x8')][_0x1a44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3129f9,_0x18f735,_0x14b2a5){return new BPromise(function(_0x2f5fcc,_0x6d7d51){return client[_0x1a44('0xa')](_0x3129f9,_0x14b2a5)[_0x1a44('0xb')](function(_0x5ea416){logger[_0x1a44('0xc')](_0x1a44('0xd'),_0x18f735,_0x1a44('0xe'));logger[_0x1a44('0xf')](_0x1a44('0x10'),_0x18f735,_0x1a44('0xe'),JSON['stringify'](_0x5ea416));if(_0x5ea416[_0x1a44('0x11')]){if(_0x5ea416['error'][_0x1a44('0x12')]===0x1f4){logger[_0x1a44('0x11')]('Sound,\x20%s,\x20%s',_0x18f735,_0x5ea416[_0x1a44('0x11')]['message']);return _0x6d7d51(_0x5ea416[_0x1a44('0x11')][_0x1a44('0x13')]);}logger[_0x1a44('0x11')](_0x1a44('0xd'),_0x18f735,_0x5ea416[_0x1a44('0x11')][_0x1a44('0x13')]);return _0x2f5fcc(_0x5ea416['error'][_0x1a44('0x13')]);}else{logger[_0x1a44('0xc')](_0x1a44('0xd'),_0x18f735,_0x1a44('0xe'));_0x2f5fcc(_0x5ea416[_0x1a44('0x14')][_0x1a44('0x13')]);}})[_0x1a44('0x15')](function(_0x237a47){logger[_0x1a44('0x11')](_0x1a44('0xd'),_0x18f735,_0x237a47);_0x6d7d51(_0x237a47);});});}exports[_0x1a44('0x16')]=function(_0x23c7a8){var _0x3ae5b4=this;return new Promise(function(_0x5ef1c5,_0x456a42){return db[_0x1a44('0x17')]['find']({'raw':_0x23c7a8[_0x1a44('0x18')]?_0x23c7a8[_0x1a44('0x18')][_0x1a44('0x19')]===undefined?!![]:![]:!![],'where':_0x23c7a8[_0x1a44('0x18')]?_0x23c7a8[_0x1a44('0x18')][_0x1a44('0x1a')]||null:null,'attributes':_0x23c7a8['options']?_0x23c7a8['options'][_0x1a44('0x1b')]||null:null,'include':_0x23c7a8[_0x1a44('0x18')]?_0x23c7a8['options'][_0x1a44('0x1c')]?_[_0x1a44('0x1d')](_0x23c7a8[_0x1a44('0x18')][_0x1a44('0x1c')],function(_0x5c2b8f){return{'model':db[_0x5c2b8f['model']],'as':_0x5c2b8f['as'],'attributes':_0x5c2b8f[_0x1a44('0x1b')],'include':_0x5c2b8f[_0x1a44('0x1c')]?_[_0x1a44('0x1d')](_0x5c2b8f[_0x1a44('0x1c')],function(_0x4dcb26){return{'model':db[_0x4dcb26[_0x1a44('0x1e')]],'as':_0x4dcb26['as'],'attributes':_0x4dcb26[_0x1a44('0x1b')],'include':_0x4dcb26[_0x1a44('0x1c')]?_[_0x1a44('0x1d')](_0x4dcb26['include'],function(_0x4419ec){return{'model':db[_0x4419ec[_0x1a44('0x1e')]],'as':_0x4419ec['as'],'attributes':_0x4419ec[_0x1a44('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1a44('0xb')](function(_0x2b7334){logger[_0x1a44('0xc')](_0x1a44('0x16'),_0x23c7a8);logger[_0x1a44('0xf')](_0x1a44('0x16'),_0x23c7a8,JSON[_0x1a44('0x1f')](_0x2b7334));_0x5ef1c5(_0x2b7334);})['catch'](function(_0x42bea1){logger['error'](_0x1a44('0x16'),_0x42bea1[_0x1a44('0x13')],_0x23c7a8);_0x456a42(_0x3ae5b4['error'](0x1f4,_0x42bea1[_0x1a44('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ad895a8..f49321a 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 _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0x9ffd,0xaa));var _0xd9ff=function(_0xdf5b7d,_0x13a1ef){_0xdf5b7d=_0xdf5b7d-0x0;var _0x594f8e=_0x9ffd[_0xdf5b7d];return _0x594f8e;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1246c0,_0x5af302){var _0x7ef4ba=function(_0x3eefad){while(--_0x3eefad){_0x1246c0['push'](_0x1246c0['shift']());}};_0x7ef4ba(++_0x5af302);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b6fd3,_0x4af8d4){_0x5b6fd3=_0x5b6fd3-0x0;var _0x75ef1e=_0xb10b[_0x5b6fd3];return _0x75ef1e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 84cf46c..771b6d7 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 _0x3afb=['STRING','sequelize','medium','ENUM','out'];(function(_0xb724ba,_0x367ae7){var _0x1a2ae3=function(_0x3377d3){while(--_0x3377d3){_0xb724ba['push'](_0xb724ba['shift']());}};_0x1a2ae3(++_0x367ae7);}(_0x3afb,0xa1));var _0xb3af=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0x3afb[_0x2fbcf6];return _0x3e7265;};'use strict';var Sequelize=require(_0xb3af('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xb3af('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0xb3af('0x2')]('in',_0xb3af('0x3')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xb3af('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x191f=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x4f9264,_0x1a39c2){var _0x5b9d72=function(_0x2dd3de){while(--_0x2dd3de){_0x4f9264['push'](_0x4f9264['shift']());}};_0x5b9d72(++_0x1a39c2);}(_0x191f,0xfe));var _0xf191=function(_0x5e0f0e,_0x3f0607){_0x5e0f0e=_0x5e0f0e-0x0;var _0x32edb2=_0x191f[_0x5e0f0e];return _0x32edb2;};'use strict';var Sequelize=require(_0xf191('0x0'));module[_0xf191('0x1')]={'uniqueid':{'type':Sequelize[_0xf191('0x2')]},'body':{'type':Sequelize[_0xf191('0x3')](_0xf191('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xf191('0x5')]('in',_0xf191('0x6')),'defaultValue':_0xf191('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf191('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index e0f8613..caa062e 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 _0xc08a=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','map','SquareMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xe359bf,_0x2f8013){var _0x31fae1=function(_0x290666){while(--_0x290666){_0xe359bf['push'](_0xe359bf['shift']());}};_0x31fae1(++_0x2f8013);}(_0xc08a,0x167));var _0xac08=function(_0x1988fe,_0x5e4786){_0x1988fe=_0x1988fe-0x0;var _0x1f0f50=_0xc08a[_0x1988fe];return _0x1f0f50;};'use strict';var emlformat=require(_0xac08('0x0'));var rimraf=require(_0xac08('0x1'));var zipdir=require(_0xac08('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac08('0x3'));var moment=require(_0xac08('0x4'));var BPromise=require(_0xac08('0x5'));var Mustache=require(_0xac08('0x6'));var util=require(_0xac08('0x7'));var path=require(_0xac08('0x8'));var sox=require(_0xac08('0x9'));var csv=require(_0xac08('0xa'));var ejs=require(_0xac08('0xb'));var fs=require('fs');var fs_extra=require(_0xac08('0xc'));var _=require(_0xac08('0xd'));var squel=require(_0xac08('0xe'));var crypto=require(_0xac08('0xf'));var jsforce=require(_0xac08('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xac08('0xa'));var querystring=require(_0xac08('0x11'));var Papa=require(_0xac08('0x12'));var Redis=require(_0xac08('0x13'));var authService=require(_0xac08('0x14'));var qs=require(_0xac08('0x15'));var as=require(_0xac08('0x16'));var hardwareService=require(_0xac08('0x17'));var logger=require(_0xac08('0x18'))(_0xac08('0x19'));var utils=require(_0xac08('0x1a'));var config=require(_0xac08('0x1b'));var licenseUtil=require(_0xac08('0x1c'));var db=require(_0xac08('0x1d'))['db'];function respondWithStatusCode(_0x4fe1a2,_0x61d0f7){_0x61d0f7=_0x61d0f7||0xcc;return function(_0x36b81a){if(_0x36b81a){return _0x4fe1a2[_0xac08('0x1e')](_0x61d0f7);}return _0x4fe1a2['status'](_0x61d0f7)[_0xac08('0x1f')]();};}function respondWithResult(_0x319b3b,_0x15bf10){_0x15bf10=_0x15bf10||0xc8;return function(_0x194768){if(_0x194768){return _0x319b3b[_0xac08('0x20')](_0x15bf10)[_0xac08('0x21')](_0x194768);}};}function respondWithFilteredResult(_0x349a6a,_0x4867ec){return function(_0xdcd026){if(_0xdcd026){var _0x1e213b=typeof _0x4867ec[_0xac08('0x22')]===_0xac08('0x23')&&typeof _0x4867ec[_0xac08('0x24')]===_0xac08('0x23');var _0x37036f=_0xdcd026['count'];var _0x480336=_0x1e213b?0x0:_0x4867ec[_0xac08('0x22')];var _0x321869=_0x1e213b?_0xdcd026[_0xac08('0x25')]:_0x4867ec[_0xac08('0x22')]+_0x4867ec[_0xac08('0x24')];var _0x340bfa;if(_0x321869>=_0x37036f){_0x321869=_0x37036f;_0x340bfa=0xc8;}else{_0x340bfa=0xce;}_0x349a6a[_0xac08('0x20')](_0x340bfa);return _0x349a6a[_0xac08('0x26')](_0xac08('0x27'),_0x480336+'-'+_0x321869+'/'+_0x37036f)[_0xac08('0x21')](_0xdcd026);}return null;};}function patchUpdates(_0x11cf36){return function(_0x4e2510){try{jsonpatch[_0xac08('0x28')](_0x4e2510,_0x11cf36,!![]);}catch(_0x4af9f7){return BPromise[_0xac08('0x29')](_0x4af9f7);}return _0x4e2510[_0xac08('0x2a')]();};}function saveUpdates(_0xdcf2b7,_0x48de6f){return function(_0x441ed2){if(_0x441ed2){return _0x441ed2['update'](_0xdcf2b7)[_0xac08('0x2b')](function(_0xb14658){return _0xb14658;});}return null;};}function removeEntity(_0x57e5dc,_0x278187){return function(_0x2cdbab){if(_0x2cdbab){return _0x2cdbab[_0xac08('0x2c')]()['then'](function(){_0x57e5dc[_0xac08('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38682a,_0x570169){return function(_0x558706){if(!_0x558706){_0x38682a[_0xac08('0x1e')](0x194);}return _0x558706;};}function handleError(_0x2e416e,_0x27cdcd){_0x27cdcd=_0x27cdcd||0x1f4;return function(_0x455093){logger['error'](_0x455093[_0xac08('0x2d')]);if(_0x455093[_0xac08('0x2e')]){delete _0x455093[_0xac08('0x2e')];}_0x2e416e[_0xac08('0x20')](_0x27cdcd)['send'](_0x455093);};}exports['index']=function(_0x415cfc,_0xcb3f8){var _0x325c43={},_0x5c1f68={},_0xcda08f={'count':0x0,'rows':[]};var _0x383057=_[_0xac08('0x2f')](db[_0xac08('0x30')][_0xac08('0x31')],function(_0x293356){return{'name':_0x293356[_0xac08('0x32')],'type':_0x293356[_0xac08('0x33')][_0xac08('0x34')]};});_0x5c1f68['model']=_[_0xac08('0x2f')](_0x383057,_0xac08('0x2e'));_0x5c1f68[_0xac08('0x35')]=_['keys'](_0x415cfc[_0xac08('0x35')]);_0x5c1f68[_0xac08('0x36')]=_[_0xac08('0x37')](_0x5c1f68[_0xac08('0x38')],_0x5c1f68[_0xac08('0x35')]);_0x325c43['attributes']=_['intersection'](_0x5c1f68[_0xac08('0x38')],qs[_0xac08('0x39')](_0x415cfc[_0xac08('0x35')][_0xac08('0x39')]));_0x325c43[_0xac08('0x3a')]=_0x325c43['attributes'][_0xac08('0x3b')]?_0x325c43['attributes']:_0x5c1f68[_0xac08('0x38')];if(!_0x415cfc[_0xac08('0x35')][_0xac08('0x3c')](_0xac08('0x3d'))){_0x325c43['limit']=qs[_0xac08('0x24')](_0x415cfc[_0xac08('0x35')][_0xac08('0x24')]);_0x325c43[_0xac08('0x22')]=qs[_0xac08('0x22')](_0x415cfc['query']['offset']);}_0x325c43['order']=qs['sort'](_0x415cfc[_0xac08('0x35')]['sort']);_0x325c43[_0xac08('0x3e')]=qs[_0xac08('0x36')](_[_0xac08('0x3f')](_0x415cfc[_0xac08('0x35')],_0x5c1f68[_0xac08('0x36')]),_0x383057);if(_0x415cfc[_0xac08('0x35')][_0xac08('0x40')]){_0x325c43['where']=_[_0xac08('0x41')](_0x325c43[_0xac08('0x3e')],{'$or':_[_0xac08('0x2f')](_0x383057,function(_0xd2ae1a){if(_0xd2ae1a['type']!==_0xac08('0x42')){var _0x377360={};_0x377360[_0xd2ae1a[_0xac08('0x2e')]]={'$like':'%'+_0x415cfc[_0xac08('0x35')][_0xac08('0x40')]+'%'};return _0x377360;}})});}_0x325c43=_[_0xac08('0x41')]({},_0x325c43,_0x415cfc[_0xac08('0x43')]);var _0x46a69e={'where':_0x325c43[_0xac08('0x3e')]};return db[_0xac08('0x30')][_0xac08('0x25')](_0x46a69e)[_0xac08('0x2b')](function(_0x72d8bf){_0xcda08f['count']=_0x72d8bf;if(_0x415cfc[_0xac08('0x35')][_0xac08('0x44')]){_0x325c43[_0xac08('0x45')]=[{'all':!![]}];}return db[_0xac08('0x30')]['findAll'](_0x325c43);})[_0xac08('0x2b')](function(_0x1b7470){_0xcda08f[_0xac08('0x46')]=_0x1b7470;return _0xcda08f;})[_0xac08('0x2b')](respondWithFilteredResult(_0xcb3f8,_0x325c43))[_0xac08('0x47')](handleError(_0xcb3f8,null));};exports[_0xac08('0x48')]=function(_0x240dd3,_0x1a46cc){var _0x506ea1={'raw':!![],'where':{'id':_0x240dd3[_0xac08('0x49')]['id']}},_0x164d14={};_0x164d14[_0xac08('0x38')]=_['keys'](db[_0xac08('0x30')][_0xac08('0x31')]);_0x164d14['query']=_[_0xac08('0x4a')](_0x240dd3[_0xac08('0x35')]);_0x164d14[_0xac08('0x36')]=_[_0xac08('0x37')](_0x164d14[_0xac08('0x38')],_0x164d14[_0xac08('0x35')]);_0x506ea1[_0xac08('0x3a')]=_[_0xac08('0x37')](_0x164d14[_0xac08('0x38')],qs[_0xac08('0x39')](_0x240dd3[_0xac08('0x35')][_0xac08('0x39')]));_0x506ea1[_0xac08('0x3a')]=_0x506ea1['attributes'][_0xac08('0x3b')]?_0x506ea1[_0xac08('0x3a')]:_0x164d14['model'];if(_0x240dd3['query']['includeAll']){_0x506ea1[_0xac08('0x45')]=[{'all':!![]}];}_0x506ea1=_['merge']({},_0x506ea1,_0x240dd3['options']);return db[_0xac08('0x30')][_0xac08('0x4b')](_0x506ea1)[_0xac08('0x2b')](handleEntityNotFound(_0x1a46cc,null))[_0xac08('0x2b')](respondWithResult(_0x1a46cc,null))[_0xac08('0x47')](handleError(_0x1a46cc,null));};exports[_0xac08('0x4c')]=function(_0x4b3719,_0x42fbf0){return db['SquareMessage']['create'](_0x4b3719[_0xac08('0x4d')],{})[_0xac08('0x2b')](respondWithResult(_0x42fbf0,0xc9))[_0xac08('0x47')](handleError(_0x42fbf0,null));};exports['update']=function(_0xe2ab3d,_0x40007b){if(_0xe2ab3d['body']['id']){delete _0xe2ab3d[_0xac08('0x4d')]['id'];}return db['SquareMessage'][_0xac08('0x4b')]({'where':{'id':_0xe2ab3d[_0xac08('0x49')]['id']}})[_0xac08('0x2b')](handleEntityNotFound(_0x40007b,null))[_0xac08('0x2b')](saveUpdates(_0xe2ab3d[_0xac08('0x4d')],null))[_0xac08('0x2b')](respondWithResult(_0x40007b,null))[_0xac08('0x47')](handleError(_0x40007b,null));};exports[_0xac08('0x2c')]=function(_0x3e6167,_0x2442a9){return db['SquareMessage'][_0xac08('0x4b')]({'where':{'id':_0x3e6167[_0xac08('0x49')]['id']}})['then'](handleEntityNotFound(_0x2442a9,null))['then'](removeEntity(_0x2442a9,null))[_0xac08('0x47')](handleError(_0x2442a9,null));}; \ No newline at end of file +var _0x291e=['params','rawAttributes','includeAll','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','map','SquareMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','include','findAll','rows','catch'];(function(_0x4e7c30,_0x4d7dfe){var _0x4fe983=function(_0xdbd617){while(--_0xdbd617){_0x4e7c30['push'](_0x4e7c30['shift']());}};_0x4fe983(++_0x4d7dfe);}(_0x291e,0xeb));var _0xe291=function(_0xfd9a0,_0xa752df){_0xfd9a0=_0xfd9a0-0x0;var _0x19614e=_0x291e[_0xfd9a0];return _0x19614e;};'use strict';var emlformat=require(_0xe291('0x0'));var rimraf=require(_0xe291('0x1'));var zipdir=require(_0xe291('0x2'));var jsonpatch=require(_0xe291('0x3'));var rp=require(_0xe291('0x4'));var moment=require(_0xe291('0x5'));var BPromise=require(_0xe291('0x6'));var Mustache=require(_0xe291('0x7'));var util=require('util');var path=require(_0xe291('0x8'));var sox=require(_0xe291('0x9'));var csv=require('to-csv');var ejs=require(_0xe291('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe291('0xb'));var crypto=require(_0xe291('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe291('0xd'));var toCsv=require(_0xe291('0xe'));var querystring=require(_0xe291('0xf'));var Papa=require(_0xe291('0x10'));var Redis=require(_0xe291('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe291('0x12'));var hardwareService=require(_0xe291('0x13'));var logger=require(_0xe291('0x14'))('api');var utils=require(_0xe291('0x15'));var config=require(_0xe291('0x16'));var licenseUtil=require(_0xe291('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x229ca6,_0x34f1ee){_0x34f1ee=_0x34f1ee||0xcc;return function(_0x10c2ea){if(_0x10c2ea){return _0x229ca6[_0xe291('0x18')](_0x34f1ee);}return _0x229ca6['status'](_0x34f1ee)[_0xe291('0x19')]();};}function respondWithResult(_0x169b42,_0xd6d9aa){_0xd6d9aa=_0xd6d9aa||0xc8;return function(_0x44dec8){if(_0x44dec8){return _0x169b42[_0xe291('0x1a')](_0xd6d9aa)[_0xe291('0x1b')](_0x44dec8);}};}function respondWithFilteredResult(_0x1aa641,_0x184149){return function(_0x536910){if(_0x536910){var _0x9b4dd9=typeof _0x184149[_0xe291('0x1c')]===_0xe291('0x1d')&&typeof _0x184149[_0xe291('0x1e')]===_0xe291('0x1d');var _0x580cec=_0x536910[_0xe291('0x1f')];var _0x3b4453=_0x9b4dd9?0x0:_0x184149[_0xe291('0x1c')];var _0x372138=_0x9b4dd9?_0x536910[_0xe291('0x1f')]:_0x184149[_0xe291('0x1c')]+_0x184149['limit'];var _0x397ebe;if(_0x372138>=_0x580cec){_0x372138=_0x580cec;_0x397ebe=0xc8;}else{_0x397ebe=0xce;}_0x1aa641[_0xe291('0x1a')](_0x397ebe);return _0x1aa641[_0xe291('0x20')](_0xe291('0x21'),_0x3b4453+'-'+_0x372138+'/'+_0x580cec)[_0xe291('0x1b')](_0x536910);}return null;};}function patchUpdates(_0x4dcedc){return function(_0x177f62){try{jsonpatch[_0xe291('0x22')](_0x177f62,_0x4dcedc,!![]);}catch(_0x33a196){return BPromise[_0xe291('0x23')](_0x33a196);}return _0x177f62[_0xe291('0x24')]();};}function saveUpdates(_0x5ddb5e,_0x178022){return function(_0x40ba71){if(_0x40ba71){return _0x40ba71[_0xe291('0x25')](_0x5ddb5e)['then'](function(_0x16e7e0){return _0x16e7e0;});}return null;};}function removeEntity(_0x28043b,_0xfb812b){return function(_0x151cc6){if(_0x151cc6){return _0x151cc6[_0xe291('0x26')]()[_0xe291('0x27')](function(){_0x28043b[_0xe291('0x1a')](0xcc)[_0xe291('0x19')]();});}};}function handleEntityNotFound(_0x317f75,_0x364164){return function(_0x562fce){if(!_0x562fce){_0x317f75[_0xe291('0x18')](0x194);}return _0x562fce;};}function handleError(_0x2502ff,_0x3ba067){_0x3ba067=_0x3ba067||0x1f4;return function(_0x3c946c){logger[_0xe291('0x28')](_0x3c946c[_0xe291('0x29')]);if(_0x3c946c['name']){delete _0x3c946c['name'];}_0x2502ff['status'](_0x3ba067)[_0xe291('0x2a')](_0x3c946c);};}exports['index']=function(_0x188bf3,_0x5eff27){var _0x498c78={},_0x195f30={},_0x5afffa={'count':0x0,'rows':[]};var _0x479639=_[_0xe291('0x2b')](db[_0xe291('0x2c')]['rawAttributes'],function(_0x454acd){return{'name':_0x454acd[_0xe291('0x2d')],'type':_0x454acd[_0xe291('0x2e')][_0xe291('0x2f')]};});_0x195f30[_0xe291('0x30')]=_[_0xe291('0x2b')](_0x479639,'name');_0x195f30[_0xe291('0x31')]=_[_0xe291('0x32')](_0x188bf3[_0xe291('0x31')]);_0x195f30[_0xe291('0x33')]=_[_0xe291('0x34')](_0x195f30[_0xe291('0x30')],_0x195f30[_0xe291('0x31')]);_0x498c78[_0xe291('0x35')]=_[_0xe291('0x34')](_0x195f30[_0xe291('0x30')],qs[_0xe291('0x36')](_0x188bf3['query'][_0xe291('0x36')]));_0x498c78['attributes']=_0x498c78[_0xe291('0x35')][_0xe291('0x37')]?_0x498c78[_0xe291('0x35')]:_0x195f30[_0xe291('0x30')];if(!_0x188bf3['query']['hasOwnProperty'](_0xe291('0x38'))){_0x498c78['limit']=qs[_0xe291('0x1e')](_0x188bf3[_0xe291('0x31')][_0xe291('0x1e')]);_0x498c78[_0xe291('0x1c')]=qs[_0xe291('0x1c')](_0x188bf3[_0xe291('0x31')][_0xe291('0x1c')]);}_0x498c78[_0xe291('0x39')]=qs[_0xe291('0x3a')](_0x188bf3[_0xe291('0x31')]['sort']);_0x498c78['where']=qs['filters'](_[_0xe291('0x3b')](_0x188bf3[_0xe291('0x31')],_0x195f30[_0xe291('0x33')]),_0x479639);if(_0x188bf3[_0xe291('0x31')][_0xe291('0x3c')]){_0x498c78[_0xe291('0x3d')]=_[_0xe291('0x3e')](_0x498c78[_0xe291('0x3d')],{'$or':_['map'](_0x479639,function(_0x441dd0){if(_0x441dd0['type']!==_0xe291('0x3f')){var _0xeeb325={};_0xeeb325[_0x441dd0[_0xe291('0x40')]]={'$like':'%'+_0x188bf3[_0xe291('0x31')][_0xe291('0x3c')]+'%'};return _0xeeb325;}})});}_0x498c78=_[_0xe291('0x3e')]({},_0x498c78,_0x188bf3['options']);var _0x15dda9={'where':_0x498c78[_0xe291('0x3d')]};return db[_0xe291('0x2c')][_0xe291('0x1f')](_0x15dda9)[_0xe291('0x27')](function(_0x2ae0e7){_0x5afffa['count']=_0x2ae0e7;if(_0x188bf3[_0xe291('0x31')]['includeAll']){_0x498c78[_0xe291('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0xe291('0x42')](_0x498c78);})[_0xe291('0x27')](function(_0x1f45b7){_0x5afffa[_0xe291('0x43')]=_0x1f45b7;return _0x5afffa;})['then'](respondWithFilteredResult(_0x5eff27,_0x498c78))[_0xe291('0x44')](handleError(_0x5eff27,null));};exports['show']=function(_0x386616,_0x3c438c){var _0x160753={'raw':!![],'where':{'id':_0x386616[_0xe291('0x45')]['id']}},_0x41af9d={};_0x41af9d[_0xe291('0x30')]=_[_0xe291('0x32')](db[_0xe291('0x2c')][_0xe291('0x46')]);_0x41af9d[_0xe291('0x31')]=_[_0xe291('0x32')](_0x386616[_0xe291('0x31')]);_0x41af9d['filters']=_[_0xe291('0x34')](_0x41af9d[_0xe291('0x30')],_0x41af9d['query']);_0x160753['attributes']=_['intersection'](_0x41af9d[_0xe291('0x30')],qs[_0xe291('0x36')](_0x386616[_0xe291('0x31')][_0xe291('0x36')]));_0x160753[_0xe291('0x35')]=_0x160753[_0xe291('0x35')][_0xe291('0x37')]?_0x160753[_0xe291('0x35')]:_0x41af9d['model'];if(_0x386616[_0xe291('0x31')][_0xe291('0x47')]){_0x160753['include']=[{'all':!![]}];}_0x160753=_[_0xe291('0x3e')]({},_0x160753,_0x386616[_0xe291('0x48')]);return db[_0xe291('0x2c')]['find'](_0x160753)[_0xe291('0x27')](handleEntityNotFound(_0x3c438c,null))[_0xe291('0x27')](respondWithResult(_0x3c438c,null))[_0xe291('0x44')](handleError(_0x3c438c,null));};exports[_0xe291('0x49')]=function(_0x382337,_0x3b908d){return db['SquareMessage'][_0xe291('0x49')](_0x382337[_0xe291('0x4a')],{})[_0xe291('0x27')](respondWithResult(_0x3b908d,0xc9))[_0xe291('0x44')](handleError(_0x3b908d,null));};exports['update']=function(_0x599f94,_0x486b59){if(_0x599f94[_0xe291('0x4a')]['id']){delete _0x599f94['body']['id'];}return db[_0xe291('0x2c')][_0xe291('0x4b')]({'where':{'id':_0x599f94[_0xe291('0x45')]['id']}})[_0xe291('0x27')](handleEntityNotFound(_0x486b59,null))[_0xe291('0x27')](saveUpdates(_0x599f94['body'],null))[_0xe291('0x27')](respondWithResult(_0x486b59,null))['catch'](handleError(_0x486b59,null));};exports[_0xe291('0x26')]=function(_0x3809a0,_0x2aee2f){return db[_0xe291('0x2c')][_0xe291('0x4b')]({'where':{'id':_0x3809a0[_0xe291('0x45')]['id']}})[_0xe291('0x27')](handleEntityNotFound(_0x2aee2f,null))[_0xe291('0x27')](removeEntity(_0x2aee2f,null))[_0xe291('0x44')](handleError(_0x2aee2f,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 0e3b17a..fc96059 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 _0x19d6=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2adca1,_0x5236f5){var _0x164b4c=function(_0x17fbae){while(--_0x17fbae){_0x2adca1['push'](_0x2adca1['shift']());}};_0x164b4c(++_0x5236f5);}(_0x19d6,0x16f));var _0x619d=function(_0x497b36,_0x4fc262){_0x497b36=_0x497b36-0x0;var _0x55c187=_0x19d6[_0x497b36];return _0x55c187;};'use strict';var _=require(_0x619d('0x0'));var util=require(_0x619d('0x1'));var logger=require(_0x619d('0x2'))(_0x619d('0x3'));var moment=require(_0x619d('0x4'));var BPromise=require(_0x619d('0x5'));var rp=require(_0x619d('0x6'));var fs=require('fs');var path=require(_0x619d('0x7'));var rimraf=require(_0x619d('0x8'));var config=require(_0x619d('0x9'));var attributes=require(_0x619d('0xa'));module[_0x619d('0xb')]=function(_0x226ecd,_0x345775){return _0x226ecd[_0x619d('0xc')](_0x619d('0xd'),attributes,{'tableName':_0x619d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe48c=['../../config/environment','./squareMessage.attributes','define','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2dcfc8,_0x482c6c){var _0x412348=function(_0xf0dc41){while(--_0xf0dc41){_0x2dcfc8['push'](_0x2dcfc8['shift']());}};_0x412348(++_0x482c6c);}(_0xe48c,0x19b));var _0xce48=function(_0x34568f,_0x421199){_0x34568f=_0x34568f-0x0;var _0x4ca0ed=_0xe48c[_0x34568f];return _0x4ca0ed;};'use strict';var _=require(_0xce48('0x0'));var util=require(_0xce48('0x1'));var logger=require(_0xce48('0x2'))(_0xce48('0x3'));var moment=require(_0xce48('0x4'));var BPromise=require(_0xce48('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce48('0x6'));var rimraf=require('rimraf');var config=require(_0xce48('0x7'));var attributes=require(_0xce48('0x8'));module['exports']=function(_0x4bc033,_0x37c0dc){return _0x4bc033[_0xce48('0x9')](_0xce48('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 15f8936..2b7d6b2 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 _0xf8d8=['then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x17d69e,_0x27717d){var _0x4b153f=function(_0x542e11){while(--_0x542e11){_0x17d69e['push'](_0x17d69e['shift']());}};_0x4b153f(++_0x27717d);}(_0xf8d8,0x80));var _0x8f8d=function(_0x45ea78,_0x31678e){_0x45ea78=_0x45ea78-0x0;var _0xd722b7=_0xf8d8[_0x45ea78];return _0xd722b7;};'use strict';var _=require('lodash');var util=require(_0x8f8d('0x0'));var moment=require(_0x8f8d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f8d('0x2'));var fs=require('fs');var Redis=require(_0x8f8d('0x3'));var db=require(_0x8f8d('0x4'))['db'];var utils=require(_0x8f8d('0x5'));var logger=require(_0x8f8d('0x6'))(_0x8f8d('0x7'));var config=require(_0x8f8d('0x8'));var jayson=require(_0x8f8d('0x9'));var client=jayson['client'][_0x8f8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b5dde,_0x31c9de,_0x53226a){return new BPromise(function(_0x4d5c21,_0x34bc45){return client[_0x8f8d('0xb')](_0x4b5dde,_0x53226a)[_0x8f8d('0xc')](function(_0x141376){logger[_0x8f8d('0xd')](_0x8f8d('0xe'),_0x31c9de,_0x8f8d('0xf'));logger[_0x8f8d('0x10')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x31c9de,_0x8f8d('0xf'),JSON[_0x8f8d('0x11')](_0x141376));if(_0x141376[_0x8f8d('0x12')]){if(_0x141376[_0x8f8d('0x12')][_0x8f8d('0x13')]===0x1f4){logger[_0x8f8d('0x12')]('SquareMessage,\x20%s,\x20%s',_0x31c9de,_0x141376[_0x8f8d('0x12')][_0x8f8d('0x14')]);return _0x34bc45(_0x141376[_0x8f8d('0x12')]['message']);}logger[_0x8f8d('0x12')](_0x8f8d('0xe'),_0x31c9de,_0x141376[_0x8f8d('0x12')][_0x8f8d('0x14')]);return _0x4d5c21(_0x141376['error'][_0x8f8d('0x14')]);}else{logger['info'](_0x8f8d('0xe'),_0x31c9de,_0x8f8d('0xf'));_0x4d5c21(_0x141376[_0x8f8d('0x15')][_0x8f8d('0x14')]);}})[_0x8f8d('0x16')](function(_0x4be418){logger[_0x8f8d('0x12')]('SquareMessage,\x20%s,\x20%s',_0x31c9de,_0x4be418);_0x34bc45(_0x4be418);});});}exports[_0x8f8d('0x17')]=function(_0x13b42a){var _0x4ab852=this;return new Promise(function(_0x3bd860,_0x35ced6){return db[_0x8f8d('0x18')][_0x8f8d('0x19')](_0x13b42a[_0x8f8d('0x1a')],{'raw':_0x13b42a['options']?_0x13b42a['options'][_0x8f8d('0x1b')]===undefined?!![]:![]:!![]})[_0x8f8d('0xc')](function(_0x471c1d){logger[_0x8f8d('0xd')]('CreateSquareMessage',_0x13b42a);logger['debug'](_0x8f8d('0x17'),_0x13b42a,JSON[_0x8f8d('0x11')](_0x471c1d));_0x3bd860(_0x471c1d);})[_0x8f8d('0x16')](function(_0x504d59){logger[_0x8f8d('0x12')](_0x8f8d('0x17'),_0x504d59[_0x8f8d('0x14')],_0x13b42a);_0x35ced6(_0x4ab852[_0x8f8d('0x12')](0x1f4,_0x504d59[_0x8f8d('0x14')]));});});}; \ No newline at end of file +var _0xd26a=['rpc','../../config/environment','jayson/promise','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x454e26,_0x47e491){var _0x58ad71=function(_0x46520c){while(--_0x46520c){_0x454e26['push'](_0x454e26['shift']());}};_0x58ad71(++_0x47e491);}(_0xd26a,0x132));var _0xad26=function(_0x2fbc91,_0x46bb33){_0x2fbc91=_0x2fbc91-0x0;var _0x4e502e=_0xd26a[_0x2fbc91];return _0x4e502e;};'use strict';var _=require('lodash');var util=require(_0xad26('0x0'));var moment=require(_0xad26('0x1'));var BPromise=require('bluebird');var rs=require(_0xad26('0x2'));var fs=require('fs');var Redis=require(_0xad26('0x3'));var db=require(_0xad26('0x4'))['db'];var utils=require(_0xad26('0x5'));var logger=require('../../config/logger')(_0xad26('0x6'));var config=require(_0xad26('0x7'));var jayson=require(_0xad26('0x8'));var client=jayson['client'][_0xad26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5208a5,_0x29177f,_0x2eee14){return new BPromise(function(_0x4f28f1,_0x115f4e){return client['request'](_0x5208a5,_0x2eee14)[_0xad26('0xa')](function(_0x3b1cc1){logger[_0xad26('0xb')](_0xad26('0xc'),_0x29177f,_0xad26('0xd'));logger[_0xad26('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x29177f,_0xad26('0xd'),JSON[_0xad26('0xf')](_0x3b1cc1));if(_0x3b1cc1[_0xad26('0x10')]){if(_0x3b1cc1['error']['code']===0x1f4){logger[_0xad26('0x10')](_0xad26('0xc'),_0x29177f,_0x3b1cc1['error'][_0xad26('0x11')]);return _0x115f4e(_0x3b1cc1['error'][_0xad26('0x11')]);}logger[_0xad26('0x10')](_0xad26('0xc'),_0x29177f,_0x3b1cc1['error'][_0xad26('0x11')]);return _0x4f28f1(_0x3b1cc1['error'][_0xad26('0x11')]);}else{logger[_0xad26('0xb')](_0xad26('0xc'),_0x29177f,_0xad26('0xd'));_0x4f28f1(_0x3b1cc1[_0xad26('0x12')][_0xad26('0x11')]);}})[_0xad26('0x13')](function(_0x4a0c90){logger[_0xad26('0x10')](_0xad26('0xc'),_0x29177f,_0x4a0c90);_0x115f4e(_0x4a0c90);});});}exports[_0xad26('0x14')]=function(_0x1a622b){var _0x3ff7a8=this;return new Promise(function(_0x438e45,_0x3a41db){return db[_0xad26('0x15')][_0xad26('0x16')](_0x1a622b[_0xad26('0x17')],{'raw':_0x1a622b[_0xad26('0x18')]?_0x1a622b[_0xad26('0x18')][_0xad26('0x19')]===undefined?!![]:![]:!![]})[_0xad26('0xa')](function(_0x29efda){logger['info'](_0xad26('0x14'),_0x1a622b);logger[_0xad26('0xe')]('CreateSquareMessage',_0x1a622b,JSON[_0xad26('0xf')](_0x29efda));_0x438e45(_0x29efda);})['catch'](function(_0xd88ccd){logger['error']('CreateSquareMessage',_0xd88ccd[_0xad26('0x11')],_0x1a622b);_0x3a41db(_0x3ff7a8[_0xad26('0x10')](0x1f4,_0xd88ccd[_0xad26('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 5c28400..f312478 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 _0xcf29=['util','Router','fs-extra','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','15s','test','create','put','delete','destroy','exports','multer'];(function(_0x5b2b56,_0x66d130){var _0x4003f9=function(_0x387a58){while(--_0x387a58){_0x5b2b56['push'](_0x5b2b56['shift']());}};_0x4003f9(++_0x66d130);}(_0xcf29,0xf6));var _0x9cf2=function(_0x4a095e,_0x381cd5){_0x4a095e=_0x4a095e-0x0;var _0x10ef73=_0xcf29[_0x4a095e];return _0x10ef73;};'use strict';var multer=require(_0x9cf2('0x0'));var util=require(_0x9cf2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cf2('0x2')]();var fs_extra=require(_0x9cf2('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9cf2('0x4'));var controller=require(_0x9cf2('0x5'));router['get']('/',auth[_0x9cf2('0x6')](),controller[_0x9cf2('0x7')]);router[_0x9cf2('0x8')](_0x9cf2('0x9'),auth['isAuthenticated'](),controller[_0x9cf2('0xa')]);router[_0x9cf2('0x8')](_0x9cf2('0xb'),auth[_0x9cf2('0x6')](),timeout(_0x9cf2('0xc')),controller[_0x9cf2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9cf2('0xe')]);router[_0x9cf2('0xf')]('/:id',auth[_0x9cf2('0x6')](),controller['update']);router[_0x9cf2('0x10')](_0x9cf2('0x9'),auth[_0x9cf2('0x6')](),controller[_0x9cf2('0x11')]);module[_0x9cf2('0x12')]=router; \ No newline at end of file +var _0xe8f2=['post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','test'];(function(_0x3a41fb,_0x2a9a6d){var _0x27b6c0=function(_0xadcdae){while(--_0xadcdae){_0x3a41fb['push'](_0x3a41fb['shift']());}};_0x27b6c0(++_0x2a9a6d);}(_0xe8f2,0x92));var _0x2e8f=function(_0x4c4af2,_0x22ed01){_0x4c4af2=_0x4c4af2-0x0;var _0x3f91fa=_0xe8f2[_0x4c4af2];return _0x3f91fa;};'use strict';var multer=require('multer');var util=require(_0x2e8f('0x0'));var path=require('path');var timeout=require(_0x2e8f('0x1'));var express=require(_0x2e8f('0x2'));var router=express[_0x2e8f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2e8f('0x4'));var interaction=require(_0x2e8f('0x5'));var config=require(_0x2e8f('0x6'));var controller=require(_0x2e8f('0x7'));router[_0x2e8f('0x8')]('/',auth[_0x2e8f('0x9')](),controller[_0x2e8f('0xa')]);router[_0x2e8f('0x8')](_0x2e8f('0xb'),auth[_0x2e8f('0x9')](),controller['show']);router[_0x2e8f('0x8')](_0x2e8f('0xc'),auth[_0x2e8f('0x9')](),timeout('15s'),controller[_0x2e8f('0xd')]);router[_0x2e8f('0xe')]('/',auth[_0x2e8f('0x9')](),controller[_0x2e8f('0xf')]);router[_0x2e8f('0x10')]('/:id',auth[_0x2e8f('0x9')](),controller['update']);router[_0x2e8f('0x11')](_0x2e8f('0xb'),auth[_0x2e8f('0x9')](),controller[_0x2e8f('0x12')]);module[_0x2e8f('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index a270f12..ed50cd2 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 _0xcd72=['name','sequelize','exports','STRING'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0xcd72,0xc1));var _0x2cd7=function(_0x1a4a06,_0x36a5c2){_0x1a4a06=_0x1a4a06-0x0;var _0x49ec08=_0xcd72[_0x1a4a06];return _0x49ec08;};'use strict';var Sequelize=require(_0x2cd7('0x0'));module[_0x2cd7('0x1')]={'name':{'type':Sequelize[_0x2cd7('0x2')],'unique':_0x2cd7('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2cd7('0x2')]},'description':{'type':Sequelize[_0x2cd7('0x2')]}}; \ No newline at end of file +var _0x8f3d=['STRING','name','sequelize'];(function(_0x13dd8c,_0x43f25d){var _0x1d7da9=function(_0x3f935b){while(--_0x3f935b){_0x13dd8c['push'](_0x13dd8c['shift']());}};_0x1d7da9(++_0x43f25d);}(_0x8f3d,0xfe));var _0xd8f3=function(_0x4e6427,_0x284421){_0x4e6427=_0x4e6427-0x0;var _0x5cc83a=_0x8f3d[_0x4e6427];return _0x5cc83a;};'use strict';var Sequelize=require(_0xd8f3('0x0'));module['exports']={'name':{'type':Sequelize[_0xd8f3('0x1')],'unique':_0xd8f3('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd8f3('0x1')]},'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 ed10796..87f713b 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 _0xe119=['apply','reject','destroy','get','ODBC','UserProfileResource','then','sendStatus','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','dsn','openSync','closeSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range'];(function(_0x538105,_0x2df303){var _0x57eacf=function(_0x3d3f84){while(--_0x3d3f84){_0x538105['push'](_0x538105['shift']());}};_0x57eacf(++_0x2df303);}(_0xe119,0x84));var _0x9e11=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0xe119[_0x57645b];return _0xe82f00;};'use strict';var emlformat=require(_0x9e11('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e11('0x1'));var jsonpatch=require(_0x9e11('0x2'));var rp=require('request-promise');var moment=require(_0x9e11('0x3'));var BPromise=require(_0x9e11('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9e11('0x5'));var sox=require(_0x9e11('0x6'));var csv=require(_0x9e11('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e11('0x8'));var _=require('lodash');var squel=require(_0x9e11('0x9'));var crypto=require(_0x9e11('0xa'));var jsforce=require(_0x9e11('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9e11('0x7'));var querystring=require(_0x9e11('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9e11('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e11('0xe'))(_0x9e11('0xf'));var utils=require(_0x9e11('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9e11('0x11'))['db'];function respondWithStatusCode(_0x37d62d,_0x15a652){_0x15a652=_0x15a652||0xcc;return function(_0x36a886){if(_0x36a886){return _0x37d62d['sendStatus'](_0x15a652);}return _0x37d62d[_0x9e11('0x12')](_0x15a652)[_0x9e11('0x13')]();};}function respondWithResult(_0x5a8851,_0x1d78e7){_0x1d78e7=_0x1d78e7||0xc8;return function(_0x4d080a){if(_0x4d080a){return _0x5a8851['status'](_0x1d78e7)[_0x9e11('0x14')](_0x4d080a);}};}function respondWithFilteredResult(_0x27bafb,_0x5e8fc5){return function(_0x536a26){if(_0x536a26){var _0x3cc096=typeof _0x5e8fc5[_0x9e11('0x15')]===_0x9e11('0x16')&&typeof _0x5e8fc5['limit']===_0x9e11('0x16');var _0x55567f=_0x536a26[_0x9e11('0x17')];var _0x480629=_0x3cc096?0x0:_0x5e8fc5['offset'];var _0x13d888=_0x3cc096?_0x536a26[_0x9e11('0x17')]:_0x5e8fc5[_0x9e11('0x15')]+_0x5e8fc5['limit'];var _0x4775f2;if(_0x13d888>=_0x55567f){_0x13d888=_0x55567f;_0x4775f2=0xc8;}else{_0x4775f2=0xce;}_0x27bafb[_0x9e11('0x12')](_0x4775f2);return _0x27bafb[_0x9e11('0x18')](_0x9e11('0x19'),_0x480629+'-'+_0x13d888+'/'+_0x55567f)[_0x9e11('0x14')](_0x536a26);}return null;};}function patchUpdates(_0x388d0a){return function(_0x8b18cf){try{jsonpatch[_0x9e11('0x1a')](_0x8b18cf,_0x388d0a,!![]);}catch(_0x531599){return BPromise[_0x9e11('0x1b')](_0x531599);}return _0x8b18cf['save']();};}function saveUpdates(_0x88bb63,_0x577e0b){return function(_0x411a3c){if(_0x411a3c){return _0x411a3c['update'](_0x88bb63)['then'](function(_0x387240){return _0x387240;});}return null;};}function removeEntity(_0x1ecc2c,_0x54d1b2){return function(_0x50031b){if(_0x50031b){return _0x50031b[_0x9e11('0x1c')]()['then'](function(){var _0x4bd895=_0x50031b[_0x9e11('0x1d')]({'plain':!![]});var _0x59667b=_0x9e11('0x1e');return db[_0x9e11('0x1f')]['destroy']({'where':{'type':_0x59667b,'resourceId':_0x4bd895['id']}})[_0x9e11('0x20')](function(){return _0x50031b;});})[_0x9e11('0x20')](function(){_0x1ecc2c[_0x9e11('0x12')](0xcc)[_0x9e11('0x13')]();});}};}function handleEntityNotFound(_0x4da9b3,_0x8ebbdb){return function(_0x2af3ba){if(!_0x2af3ba){_0x4da9b3[_0x9e11('0x21')](0x194);}return _0x2af3ba;};}function handleError(_0x189a0a,_0x31418a){_0x31418a=_0x31418a||0x1f4;return function(_0x257e28){logger[_0x9e11('0x22')](_0x257e28['stack']);if(_0x257e28['name']){delete _0x257e28[_0x9e11('0x23')];}_0x189a0a['status'](_0x31418a)[_0x9e11('0x24')](_0x257e28);};}exports[_0x9e11('0x25')]=function(_0x5998cd,_0x27d290){var _0x79e0db={},_0x3414ae={},_0x5b83b8={'count':0x0,'rows':[]};var _0x504997=_[_0x9e11('0x26')](db[_0x9e11('0x27')][_0x9e11('0x28')],function(_0x46fe83){return{'name':_0x46fe83[_0x9e11('0x29')],'type':_0x46fe83[_0x9e11('0x2a')]['key']};});_0x3414ae[_0x9e11('0x2b')]=_[_0x9e11('0x26')](_0x504997,_0x9e11('0x23'));_0x3414ae[_0x9e11('0x2c')]=_[_0x9e11('0x2d')](_0x5998cd['query']);_0x3414ae[_0x9e11('0x2e')]=_[_0x9e11('0x2f')](_0x3414ae[_0x9e11('0x2b')],_0x3414ae[_0x9e11('0x2c')]);_0x79e0db[_0x9e11('0x30')]=_[_0x9e11('0x2f')](_0x3414ae['model'],qs[_0x9e11('0x31')](_0x5998cd[_0x9e11('0x2c')]['fields']));_0x79e0db[_0x9e11('0x30')]=_0x79e0db[_0x9e11('0x30')][_0x9e11('0x32')]?_0x79e0db[_0x9e11('0x30')]:_0x3414ae['model'];if(!_0x5998cd[_0x9e11('0x2c')]['hasOwnProperty'](_0x9e11('0x33'))){_0x79e0db[_0x9e11('0x34')]=qs['limit'](_0x5998cd[_0x9e11('0x2c')][_0x9e11('0x34')]);_0x79e0db[_0x9e11('0x15')]=qs[_0x9e11('0x15')](_0x5998cd[_0x9e11('0x2c')][_0x9e11('0x15')]);}_0x79e0db['order']=qs[_0x9e11('0x35')](_0x5998cd[_0x9e11('0x2c')][_0x9e11('0x35')]);_0x79e0db[_0x9e11('0x36')]=qs['filters'](_[_0x9e11('0x37')](_0x5998cd[_0x9e11('0x2c')],_0x3414ae['filters']),_0x504997);if(_0x5998cd[_0x9e11('0x2c')]['filter']){_0x79e0db[_0x9e11('0x36')]=_[_0x9e11('0x38')](_0x79e0db[_0x9e11('0x36')],{'$or':_[_0x9e11('0x26')](_0x504997,function(_0x48bf60){if(_0x48bf60['type']!==_0x9e11('0x39')){var _0x316dc6={};_0x316dc6[_0x48bf60[_0x9e11('0x23')]]={'$like':'%'+_0x5998cd[_0x9e11('0x2c')][_0x9e11('0x3a')]+'%'};return _0x316dc6;}})});}_0x79e0db=_[_0x9e11('0x38')]({},_0x79e0db,_0x5998cd['options']);var _0x552373={'where':_0x79e0db['where']};return db[_0x9e11('0x27')]['count'](_0x552373)['then'](function(_0x3fb5a1){_0x5b83b8[_0x9e11('0x17')]=_0x3fb5a1;if(_0x5998cd['query'][_0x9e11('0x3b')]){_0x79e0db[_0x9e11('0x3c')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x79e0db);})[_0x9e11('0x20')](function(_0x121ad0){_0x5b83b8[_0x9e11('0x3d')]=_0x121ad0;return _0x5b83b8;})['then'](respondWithFilteredResult(_0x27d290,_0x79e0db))[_0x9e11('0x3e')](handleError(_0x27d290,null));};exports[_0x9e11('0x3f')]=function(_0x431b34,_0x3f74c9){var _0x39ec12={'raw':!![],'where':{'id':_0x431b34[_0x9e11('0x40')]['id']}},_0x3ba48f={};_0x3ba48f[_0x9e11('0x2b')]=_[_0x9e11('0x2d')](db[_0x9e11('0x27')]['rawAttributes']);_0x3ba48f[_0x9e11('0x2c')]=_[_0x9e11('0x2d')](_0x431b34[_0x9e11('0x2c')]);_0x3ba48f[_0x9e11('0x2e')]=_[_0x9e11('0x2f')](_0x3ba48f[_0x9e11('0x2b')],_0x3ba48f[_0x9e11('0x2c')]);_0x39ec12[_0x9e11('0x30')]=_[_0x9e11('0x2f')](_0x3ba48f['model'],qs[_0x9e11('0x31')](_0x431b34[_0x9e11('0x2c')][_0x9e11('0x31')]));_0x39ec12[_0x9e11('0x30')]=_0x39ec12['attributes'][_0x9e11('0x32')]?_0x39ec12[_0x9e11('0x30')]:_0x3ba48f[_0x9e11('0x2b')];if(_0x431b34['query'][_0x9e11('0x3b')]){_0x39ec12[_0x9e11('0x3c')]=[{'all':!![]}];}_0x39ec12=_[_0x9e11('0x38')]({},_0x39ec12,_0x431b34[_0x9e11('0x41')]);return db[_0x9e11('0x27')][_0x9e11('0x42')](_0x39ec12)['then'](handleEntityNotFound(_0x3f74c9,null))['then'](respondWithResult(_0x3f74c9,null))[_0x9e11('0x3e')](handleError(_0x3f74c9,null));};exports[_0x9e11('0x43')]=function(_0x803641,_0x84ec0f){return db[_0x9e11('0x27')]['create'](_0x803641['body'],{})['then'](function(_0x4fa43f){var _0x343fc6=_0x803641[_0x9e11('0x44')][_0x9e11('0x1d')]({'plain':!![]});if(!_0x343fc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x343fc6[_0x9e11('0x45')]==='user'){var _0x8a136c=_0x4fa43f['get']({'plain':!![]});var _0x1bc8bd=_0x9e11('0x1e');return db[_0x9e11('0x46')][_0x9e11('0x42')]({'where':{'name':_0x1bc8bd,'userProfileId':_0x343fc6[_0x9e11('0x47')]},'raw':!![]})['then'](function(_0x78d488){if(_0x78d488&&_0x78d488[_0x9e11('0x48')]===0x0){return db['UserProfileResource'][_0x9e11('0x43')]({'name':_0x8a136c[_0x9e11('0x23')],'resourceId':_0x8a136c['id'],'type':_0x78d488[_0x9e11('0x23')],'sectionId':_0x78d488['id']},{})[_0x9e11('0x20')](function(){return _0x4fa43f;});}else{return _0x4fa43f;}})['catch'](function(_0x5b616e){logger[_0x9e11('0x22')](_0x9e11('0x49'),_0x5b616e);throw _0x5b616e;});}return _0x4fa43f;})[_0x9e11('0x20')](respondWithResult(_0x84ec0f,0xc9))[_0x9e11('0x3e')](handleError(_0x84ec0f,null));};exports[_0x9e11('0x4a')]=function(_0x1c8e57,_0x35b91d){if(_0x1c8e57[_0x9e11('0x4b')]['id']){delete _0x1c8e57[_0x9e11('0x4b')]['id'];}return db[_0x9e11('0x27')][_0x9e11('0x42')]({'where':{'id':_0x1c8e57[_0x9e11('0x40')]['id']}})['then'](handleEntityNotFound(_0x35b91d,null))[_0x9e11('0x20')](saveUpdates(_0x1c8e57[_0x9e11('0x4b')],null))['then'](respondWithResult(_0x35b91d,null))['catch'](handleError(_0x35b91d,null));};exports[_0x9e11('0x1c')]=function(_0x514feb,_0x55c2e9){return db['SquareOdbc']['find']({'where':{'id':_0x514feb[_0x9e11('0x40')]['id']}})['then'](handleEntityNotFound(_0x55c2e9,null))[_0x9e11('0x20')](removeEntity(_0x55c2e9,null))[_0x9e11('0x3e')](handleError(_0x55c2e9,null));};exports['test']=function(_0x28978a,_0x197361,_0x320508){var _0x37b41a;return db['SquareOdbc'][_0x9e11('0x42')]({'where':{'id':_0x28978a[_0x9e11('0x40')]['id']},'attributes':['id',_0x9e11('0x4c')]})[_0x9e11('0x20')](handleEntityNotFound(_0x197361,null))[_0x9e11('0x20')](function(_0x242be3){if(_0x242be3){var _0x4dceb7=require('odbc')();_0x4dceb7[_0x9e11('0x4d')](_0x242be3['dsn']);_0x4dceb7[_0x9e11('0x4e')]();return _0x242be3;}})[_0x9e11('0x20')](respondWithResult(_0x197361,null))['catch'](handleError(_0x197361,null));}; \ No newline at end of file +var _0x78ad=['findAll','catch','show','keys','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','odbc','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','update','then','ODBC','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x5292aa,_0x295f23){var _0x16bef8=function(_0x151734){while(--_0x151734){_0x5292aa['push'](_0x5292aa['shift']());}};_0x16bef8(++_0x295f23);}(_0x78ad,0xad));var _0xd78a=function(_0x28cbc8,_0x58f0ce){_0x28cbc8=_0x28cbc8-0x0;var _0xd93a66=_0x78ad[_0x28cbc8];return _0xd93a66;};'use strict';var emlformat=require(_0xd78a('0x0'));var rimraf=require(_0xd78a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd78a('0x2'));var rp=require(_0xd78a('0x3'));var moment=require(_0xd78a('0x4'));var BPromise=require(_0xd78a('0x5'));var Mustache=require(_0xd78a('0x6'));var util=require(_0xd78a('0x7'));var path=require(_0xd78a('0x8'));var sox=require(_0xd78a('0x9'));var csv=require(_0xd78a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd78a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd78a('0xc'));var deskjs=require(_0xd78a('0xd'));var toCsv=require(_0xd78a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd78a('0xe'));var authService=require(_0xd78a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd78a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd78a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd78a('0x12'));var licenseUtil=require(_0xd78a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5102b1,_0x57ea20){_0x57ea20=_0x57ea20||0xcc;return function(_0xca5cbb){if(_0xca5cbb){return _0x5102b1['sendStatus'](_0x57ea20);}return _0x5102b1[_0xd78a('0x14')](_0x57ea20)[_0xd78a('0x15')]();};}function respondWithResult(_0x18bfe9,_0x26f24c){_0x26f24c=_0x26f24c||0xc8;return function(_0x18da2a){if(_0x18da2a){return _0x18bfe9[_0xd78a('0x14')](_0x26f24c)[_0xd78a('0x16')](_0x18da2a);}};}function respondWithFilteredResult(_0x2edcc5,_0x289cf9){return function(_0x4c7d00){if(_0x4c7d00){var _0x552805=typeof _0x289cf9[_0xd78a('0x17')]===_0xd78a('0x18')&&typeof _0x289cf9[_0xd78a('0x19')]===_0xd78a('0x18');var _0x358077=_0x4c7d00['count'];var _0x32c9b8=_0x552805?0x0:_0x289cf9[_0xd78a('0x17')];var _0x103226=_0x552805?_0x4c7d00[_0xd78a('0x1a')]:_0x289cf9[_0xd78a('0x17')]+_0x289cf9[_0xd78a('0x19')];var _0x4562ee;if(_0x103226>=_0x358077){_0x103226=_0x358077;_0x4562ee=0xc8;}else{_0x4562ee=0xce;}_0x2edcc5[_0xd78a('0x14')](_0x4562ee);return _0x2edcc5[_0xd78a('0x1b')]('Content-Range',_0x32c9b8+'-'+_0x103226+'/'+_0x358077)[_0xd78a('0x16')](_0x4c7d00);}return null;};}function patchUpdates(_0x1b6339){return function(_0x28f5f3){try{jsonpatch[_0xd78a('0x1c')](_0x28f5f3,_0x1b6339,!![]);}catch(_0x5eeabc){return BPromise['reject'](_0x5eeabc);}return _0x28f5f3['save']();};}function saveUpdates(_0x2e7a85,_0x49965a){return function(_0x2a26cf){if(_0x2a26cf){return _0x2a26cf[_0xd78a('0x1d')](_0x2e7a85)[_0xd78a('0x1e')](function(_0x6cf5a3){return _0x6cf5a3;});}return null;};}function removeEntity(_0x5d8cb8,_0x802b6c){return function(_0x398300){if(_0x398300){return _0x398300['destroy']()[_0xd78a('0x1e')](function(){var _0x55df13=_0x398300['get']({'plain':!![]});var _0x269f39=_0xd78a('0x1f');return db[_0xd78a('0x20')]['destroy']({'where':{'type':_0x269f39,'resourceId':_0x55df13['id']}})['then'](function(){return _0x398300;});})[_0xd78a('0x1e')](function(){_0x5d8cb8[_0xd78a('0x14')](0xcc)[_0xd78a('0x15')]();});}};}function handleEntityNotFound(_0x1f635a,_0x4d97e9){return function(_0x2f267b){if(!_0x2f267b){_0x1f635a[_0xd78a('0x21')](0x194);}return _0x2f267b;};}function handleError(_0x5966ea,_0x3504e4){_0x3504e4=_0x3504e4||0x1f4;return function(_0x2cd57e){logger[_0xd78a('0x22')](_0x2cd57e[_0xd78a('0x23')]);if(_0x2cd57e[_0xd78a('0x24')]){delete _0x2cd57e['name'];}_0x5966ea[_0xd78a('0x14')](_0x3504e4)[_0xd78a('0x25')](_0x2cd57e);};}exports[_0xd78a('0x26')]=function(_0x3df678,_0x29afa4){var _0x4d2b0d={},_0x3cb336={},_0x4118fe={'count':0x0,'rows':[]};var _0x59cd1a=_[_0xd78a('0x27')](db[_0xd78a('0x28')][_0xd78a('0x29')],function(_0x19e6b8){return{'name':_0x19e6b8['fieldName'],'type':_0x19e6b8[_0xd78a('0x2a')]['key']};});_0x3cb336[_0xd78a('0x2b')]=_[_0xd78a('0x27')](_0x59cd1a,_0xd78a('0x24'));_0x3cb336['query']=_['keys'](_0x3df678[_0xd78a('0x2c')]);_0x3cb336[_0xd78a('0x2d')]=_[_0xd78a('0x2e')](_0x3cb336[_0xd78a('0x2b')],_0x3cb336[_0xd78a('0x2c')]);_0x4d2b0d[_0xd78a('0x2f')]=_[_0xd78a('0x2e')](_0x3cb336[_0xd78a('0x2b')],qs['fields'](_0x3df678[_0xd78a('0x2c')][_0xd78a('0x30')]));_0x4d2b0d[_0xd78a('0x2f')]=_0x4d2b0d[_0xd78a('0x2f')][_0xd78a('0x31')]?_0x4d2b0d[_0xd78a('0x2f')]:_0x3cb336['model'];if(!_0x3df678['query'][_0xd78a('0x32')](_0xd78a('0x33'))){_0x4d2b0d[_0xd78a('0x19')]=qs[_0xd78a('0x19')](_0x3df678[_0xd78a('0x2c')][_0xd78a('0x19')]);_0x4d2b0d[_0xd78a('0x17')]=qs[_0xd78a('0x17')](_0x3df678[_0xd78a('0x2c')][_0xd78a('0x17')]);}_0x4d2b0d[_0xd78a('0x34')]=qs[_0xd78a('0x35')](_0x3df678[_0xd78a('0x2c')]['sort']);_0x4d2b0d[_0xd78a('0x36')]=qs[_0xd78a('0x2d')](_[_0xd78a('0x37')](_0x3df678['query'],_0x3cb336[_0xd78a('0x2d')]),_0x59cd1a);if(_0x3df678[_0xd78a('0x2c')][_0xd78a('0x38')]){_0x4d2b0d[_0xd78a('0x36')]=_[_0xd78a('0x39')](_0x4d2b0d['where'],{'$or':_['map'](_0x59cd1a,function(_0x42a3b3){if(_0x42a3b3[_0xd78a('0x2a')]!=='VIRTUAL'){var _0x178262={};_0x178262[_0x42a3b3[_0xd78a('0x24')]]={'$like':'%'+_0x3df678[_0xd78a('0x2c')][_0xd78a('0x38')]+'%'};return _0x178262;}})});}_0x4d2b0d=_[_0xd78a('0x39')]({},_0x4d2b0d,_0x3df678[_0xd78a('0x3a')]);var _0x242162={'where':_0x4d2b0d[_0xd78a('0x36')]};return db['SquareOdbc'][_0xd78a('0x1a')](_0x242162)[_0xd78a('0x1e')](function(_0x3b0ca3){_0x4118fe[_0xd78a('0x1a')]=_0x3b0ca3;if(_0x3df678['query'][_0xd78a('0x3b')]){_0x4d2b0d[_0xd78a('0x3c')]=[{'all':!![]}];}return db[_0xd78a('0x28')][_0xd78a('0x3d')](_0x4d2b0d);})['then'](function(_0x511009){_0x4118fe['rows']=_0x511009;return _0x4118fe;})[_0xd78a('0x1e')](respondWithFilteredResult(_0x29afa4,_0x4d2b0d))[_0xd78a('0x3e')](handleError(_0x29afa4,null));};exports[_0xd78a('0x3f')]=function(_0x3a09af,_0x18aa55){var _0x12bcc5={'raw':!![],'where':{'id':_0x3a09af['params']['id']}},_0x4609c6={};_0x4609c6['model']=_[_0xd78a('0x40')](db[_0xd78a('0x28')][_0xd78a('0x29')]);_0x4609c6[_0xd78a('0x2c')]=_[_0xd78a('0x40')](_0x3a09af[_0xd78a('0x2c')]);_0x4609c6[_0xd78a('0x2d')]=_[_0xd78a('0x2e')](_0x4609c6[_0xd78a('0x2b')],_0x4609c6['query']);_0x12bcc5['attributes']=_[_0xd78a('0x2e')](_0x4609c6[_0xd78a('0x2b')],qs['fields'](_0x3a09af[_0xd78a('0x2c')][_0xd78a('0x30')]));_0x12bcc5[_0xd78a('0x2f')]=_0x12bcc5[_0xd78a('0x2f')][_0xd78a('0x31')]?_0x12bcc5[_0xd78a('0x2f')]:_0x4609c6[_0xd78a('0x2b')];if(_0x3a09af[_0xd78a('0x2c')][_0xd78a('0x3b')]){_0x12bcc5[_0xd78a('0x3c')]=[{'all':!![]}];}_0x12bcc5=_[_0xd78a('0x39')]({},_0x12bcc5,_0x3a09af['options']);return db[_0xd78a('0x28')][_0xd78a('0x41')](_0x12bcc5)[_0xd78a('0x1e')](handleEntityNotFound(_0x18aa55,null))[_0xd78a('0x1e')](respondWithResult(_0x18aa55,null))[_0xd78a('0x3e')](handleError(_0x18aa55,null));};exports[_0xd78a('0x42')]=function(_0x2d977e,_0x32247f){return db[_0xd78a('0x28')][_0xd78a('0x42')](_0x2d977e[_0xd78a('0x43')],{})[_0xd78a('0x1e')](function(_0x2c3c42){var _0x2baf0a=_0x2d977e[_0xd78a('0x44')][_0xd78a('0x45')]({'plain':!![]});if(!_0x2baf0a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2baf0a[_0xd78a('0x46')]==='user'){var _0x6e99a6=_0x2c3c42[_0xd78a('0x45')]({'plain':!![]});var _0x55c067=_0xd78a('0x1f');return db[_0xd78a('0x47')][_0xd78a('0x41')]({'where':{'name':_0x55c067,'userProfileId':_0x2baf0a[_0xd78a('0x48')]},'raw':!![]})[_0xd78a('0x1e')](function(_0x4f297d){if(_0x4f297d&&_0x4f297d['autoAssociation']===0x0){return db[_0xd78a('0x20')]['create']({'name':_0x6e99a6[_0xd78a('0x24')],'resourceId':_0x6e99a6['id'],'type':_0x4f297d[_0xd78a('0x24')],'sectionId':_0x4f297d['id']},{})[_0xd78a('0x1e')](function(){return _0x2c3c42;});}else{return _0x2c3c42;}})['catch'](function(_0x61cd3a){logger[_0xd78a('0x22')](_0xd78a('0x49'),_0x61cd3a);throw _0x61cd3a;});}return _0x2c3c42;})[_0xd78a('0x1e')](respondWithResult(_0x32247f,0xc9))[_0xd78a('0x3e')](handleError(_0x32247f,null));};exports['update']=function(_0x4ab04a,_0x50040a){if(_0x4ab04a['body']['id']){delete _0x4ab04a[_0xd78a('0x43')]['id'];}return db[_0xd78a('0x28')]['find']({'where':{'id':_0x4ab04a[_0xd78a('0x4a')]['id']}})[_0xd78a('0x1e')](handleEntityNotFound(_0x50040a,null))['then'](saveUpdates(_0x4ab04a[_0xd78a('0x43')],null))['then'](respondWithResult(_0x50040a,null))[_0xd78a('0x3e')](handleError(_0x50040a,null));};exports['destroy']=function(_0x19178c,_0x29ce4e){return db[_0xd78a('0x28')][_0xd78a('0x41')]({'where':{'id':_0x19178c[_0xd78a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x29ce4e,null))['then'](removeEntity(_0x29ce4e,null))[_0xd78a('0x3e')](handleError(_0x29ce4e,null));};exports[_0xd78a('0x4b')]=function(_0x3402e8,_0x513b4a,_0x21d040){var _0x4458ad;return db[_0xd78a('0x28')][_0xd78a('0x41')]({'where':{'id':_0x3402e8[_0xd78a('0x4a')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x513b4a,null))['then'](function(_0xa6c396){if(_0xa6c396){var _0x21e256=require(_0xd78a('0x4c'))();_0x21e256['openSync'](_0xa6c396['dsn']);_0x21e256[_0xd78a('0x4d')]();return _0xa6c396;}})[_0xd78a('0x1e')](respondWithResult(_0x513b4a,null))[_0xd78a('0x3e')](handleError(_0x513b4a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 2f49cf0..f8a9fb6 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 _0x75db=['rimraf','../../config/environment','./squareOdbc.attributes','exports','define','util','api','moment','request-promise','path'];(function(_0x28ecdf,_0x5f2693){var _0x3c2c05=function(_0x1967f2){while(--_0x1967f2){_0x28ecdf['push'](_0x28ecdf['shift']());}};_0x3c2c05(++_0x5f2693);}(_0x75db,0x181));var _0xb75d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb75d('0x0'));var logger=require('../../config/logger')(_0xb75d('0x1'));var moment=require(_0xb75d('0x2'));var BPromise=require('bluebird');var rp=require(_0xb75d('0x3'));var fs=require('fs');var path=require(_0xb75d('0x4'));var rimraf=require(_0xb75d('0x5'));var config=require(_0xb75d('0x6'));var attributes=require(_0xb75d('0x7'));module[_0xb75d('0x8')]=function(_0x5c94fd,_0x555b29){return _0x5c94fd[_0xb75d('0x9')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b95=['exports','define','square_odbc','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4b95,0x1d7));var _0x54b9=function(_0x2d3f24,_0x3f0a19){_0x2d3f24=_0x2d3f24-0x0;var _0x54795e=_0x4b95[_0x2d3f24];return _0x54795e;};'use strict';var _=require(_0x54b9('0x0'));var util=require(_0x54b9('0x1'));var logger=require(_0x54b9('0x2'))(_0x54b9('0x3'));var moment=require('moment');var BPromise=require(_0x54b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x54b9('0x5'));var rimraf=require(_0x54b9('0x6'));var config=require(_0x54b9('0x7'));var attributes=require(_0x54b9('0x8'));module[_0x54b9('0x9')]=function(_0xe91451,_0x16c235){return _0xe91451[_0x54b9('0xa')]('SquareOdbc',attributes,{'tableName':_0x54b9('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 dfdc8a1..c98c897 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 _0x7b3f=['../../config/environment','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','raw','where','map','include','model','attributes','then','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x40f87d,_0x5b309f){var _0x546439=function(_0x12d91b){while(--_0x12d91b){_0x40f87d['push'](_0x40f87d['shift']());}};_0x546439(++_0x5b309f);}(_0x7b3f,0x139));var _0xf7b3=function(_0x22fd57,_0x2c039b){_0x22fd57=_0x22fd57-0x0;var _0x1c48f9=_0x7b3f[_0x22fd57];return _0x1c48f9;};'use strict';var _=require(_0xf7b3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf7b3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7b3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7b3('0x3'));var logger=require(_0xf7b3('0x4'))(_0xf7b3('0x5'));var config=require(_0xf7b3('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf7b3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43469a,_0x2246c0,_0x39f49a){return new BPromise(function(_0x2a1e55,_0x7d6835){return client[_0xf7b3('0x8')](_0x43469a,_0x39f49a)['then'](function(_0x5eea8f){logger[_0xf7b3('0x9')](_0xf7b3('0xa'),_0x2246c0,_0xf7b3('0xb'));logger[_0xf7b3('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x2246c0,_0xf7b3('0xb'),JSON[_0xf7b3('0xd')](_0x5eea8f));if(_0x5eea8f[_0xf7b3('0xe')]){if(_0x5eea8f['error'][_0xf7b3('0xf')]===0x1f4){logger[_0xf7b3('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x2246c0,_0x5eea8f['error']['message']);return _0x7d6835(_0x5eea8f[_0xf7b3('0xe')][_0xf7b3('0x10')]);}logger[_0xf7b3('0xe')](_0xf7b3('0xa'),_0x2246c0,_0x5eea8f[_0xf7b3('0xe')][_0xf7b3('0x10')]);return _0x2a1e55(_0x5eea8f[_0xf7b3('0xe')][_0xf7b3('0x10')]);}else{logger['info'](_0xf7b3('0xa'),_0x2246c0,_0xf7b3('0xb'));_0x2a1e55(_0x5eea8f[_0xf7b3('0x11')][_0xf7b3('0x10')]);}})[_0xf7b3('0x12')](function(_0x2151cd){logger[_0xf7b3('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x2246c0,_0x2151cd);_0x7d6835(_0x2151cd);});});}exports[_0xf7b3('0x13')]=function(_0x2b6e72){var _0x17c0f3=this;return new Promise(function(_0x3410c9,_0x5181c4){return db['SquareOdbc'][_0xf7b3('0x14')]({'raw':_0x2b6e72[_0xf7b3('0x15')]?_0x2b6e72['options'][_0xf7b3('0x16')]===undefined?!![]:![]:!![],'where':_0x2b6e72[_0xf7b3('0x15')]?_0x2b6e72['options'][_0xf7b3('0x17')]||null:null,'attributes':_0x2b6e72['options']?_0x2b6e72[_0xf7b3('0x15')]['attributes']||null:null,'include':_0x2b6e72[_0xf7b3('0x15')]?_0x2b6e72[_0xf7b3('0x15')]['include']?_[_0xf7b3('0x18')](_0x2b6e72['options'][_0xf7b3('0x19')],function(_0x3320f4){return{'model':db[_0x3320f4[_0xf7b3('0x1a')]],'as':_0x3320f4['as'],'attributes':_0x3320f4[_0xf7b3('0x1b')],'include':_0x3320f4[_0xf7b3('0x19')]?_[_0xf7b3('0x18')](_0x3320f4[_0xf7b3('0x19')],function(_0x1e6f0d){return{'model':db[_0x1e6f0d[_0xf7b3('0x1a')]],'as':_0x1e6f0d['as'],'attributes':_0x1e6f0d[_0xf7b3('0x1b')],'include':_0x1e6f0d['include']?_[_0xf7b3('0x18')](_0x1e6f0d[_0xf7b3('0x19')],function(_0x23a480){return{'model':db[_0x23a480[_0xf7b3('0x1a')]],'as':_0x23a480['as'],'attributes':_0x23a480['attributes']};}):[]};}):[]};}):[]:[]})[_0xf7b3('0x1c')](function(_0x41fbb1){logger[_0xf7b3('0x9')](_0xf7b3('0x13'),_0x2b6e72);logger[_0xf7b3('0xc')]('ShowSquareOdbc',_0x2b6e72,JSON[_0xf7b3('0xd')](_0x41fbb1));_0x3410c9(_0x41fbb1);})[_0xf7b3('0x12')](function(_0x570a96){logger[_0xf7b3('0xe')](_0xf7b3('0x13'),_0x570a96[_0xf7b3('0x10')],_0x2b6e72);_0x5181c4(_0x17c0f3[_0xf7b3('0xe')](0x1f4,_0x570a96['message']));});});}; \ No newline at end of file +var _0x720a=['attributes','include','map','model','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSquareOdbc','SquareOdbc','options','raw','where'];(function(_0x45f9f0,_0x334f43){var _0x17251e=function(_0x122a87){while(--_0x122a87){_0x45f9f0['push'](_0x45f9f0['shift']());}};_0x17251e(++_0x334f43);}(_0x720a,0x12e));var _0xa720=function(_0x2003a2,_0x2212ac){_0x2003a2=_0x2003a2-0x0;var _0x4f5285=_0x720a[_0x2003a2];return _0x4f5285;};'use strict';var _=require(_0xa720('0x0'));var util=require(_0xa720('0x1'));var moment=require(_0xa720('0x2'));var BPromise=require(_0xa720('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa720('0x4'));var db=require(_0xa720('0x5'))['db'];var utils=require(_0xa720('0x6'));var logger=require(_0xa720('0x7'))(_0xa720('0x8'));var config=require(_0xa720('0x9'));var jayson=require(_0xa720('0xa'));var client=jayson[_0xa720('0xb')][_0xa720('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65af31,_0x1380dc,_0xca94c){return new BPromise(function(_0x5bde3c,_0x4a9a46){return client[_0xa720('0xd')](_0x65af31,_0xca94c)[_0xa720('0xe')](function(_0xfb516){logger[_0xa720('0xf')](_0xa720('0x10'),_0x1380dc,_0xa720('0x11'));logger['debug'](_0xa720('0x12'),_0x1380dc,'request\x20sent',JSON[_0xa720('0x13')](_0xfb516));if(_0xfb516[_0xa720('0x14')]){if(_0xfb516['error'][_0xa720('0x15')]===0x1f4){logger[_0xa720('0x14')](_0xa720('0x10'),_0x1380dc,_0xfb516[_0xa720('0x14')][_0xa720('0x16')]);return _0x4a9a46(_0xfb516[_0xa720('0x14')]['message']);}logger[_0xa720('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x1380dc,_0xfb516[_0xa720('0x14')][_0xa720('0x16')]);return _0x5bde3c(_0xfb516[_0xa720('0x14')][_0xa720('0x16')]);}else{logger[_0xa720('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x1380dc,_0xa720('0x11'));_0x5bde3c(_0xfb516['result'][_0xa720('0x16')]);}})['catch'](function(_0x34db42){logger[_0xa720('0x14')](_0xa720('0x10'),_0x1380dc,_0x34db42);_0x4a9a46(_0x34db42);});});}exports[_0xa720('0x17')]=function(_0x4af6fa){var _0x2d791a=this;return new Promise(function(_0x5d8c9a,_0x4b6858){return db[_0xa720('0x18')]['find']({'raw':_0x4af6fa[_0xa720('0x19')]?_0x4af6fa[_0xa720('0x19')][_0xa720('0x1a')]===undefined?!![]:![]:!![],'where':_0x4af6fa[_0xa720('0x19')]?_0x4af6fa[_0xa720('0x19')][_0xa720('0x1b')]||null:null,'attributes':_0x4af6fa[_0xa720('0x19')]?_0x4af6fa[_0xa720('0x19')][_0xa720('0x1c')]||null:null,'include':_0x4af6fa[_0xa720('0x19')]?_0x4af6fa[_0xa720('0x19')][_0xa720('0x1d')]?_[_0xa720('0x1e')](_0x4af6fa[_0xa720('0x19')][_0xa720('0x1d')],function(_0x24e661){return{'model':db[_0x24e661[_0xa720('0x1f')]],'as':_0x24e661['as'],'attributes':_0x24e661['attributes'],'include':_0x24e661[_0xa720('0x1d')]?_[_0xa720('0x1e')](_0x24e661[_0xa720('0x1d')],function(_0x59ca36){return{'model':db[_0x59ca36[_0xa720('0x1f')]],'as':_0x59ca36['as'],'attributes':_0x59ca36[_0xa720('0x1c')],'include':_0x59ca36[_0xa720('0x1d')]?_[_0xa720('0x1e')](_0x59ca36[_0xa720('0x1d')],function(_0x3c5de2){return{'model':db[_0x3c5de2['model']],'as':_0x3c5de2['as'],'attributes':_0x3c5de2[_0xa720('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x849f68){logger['info'](_0xa720('0x17'),_0x4af6fa);logger[_0xa720('0x20')](_0xa720('0x17'),_0x4af6fa,JSON[_0xa720('0x13')](_0x849f68));_0x5d8c9a(_0x849f68);})['catch'](function(_0x2481d1){logger[_0xa720('0x14')]('ShowSquareOdbc',_0x2481d1[_0xa720('0x16')],_0x4af6fa);_0x4b6858(_0x2d791a[_0xa720('0x14')](0x1f4,_0x2481d1[_0xa720('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 70e52a9..fc51a56 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 _0x405f=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service'];(function(_0x165482,_0x5e8f84){var _0x53c164=function(_0x3be6a1){while(--_0x3be6a1){_0x165482['push'](_0x165482['shift']());}};_0x53c164(++_0x5e8f84);}(_0x405f,0x1ab));var _0xf405=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x405f[_0x17928f];return _0x500b63;};'use strict';var multer=require(_0xf405('0x0'));var util=require(_0xf405('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf405('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf405('0x3'));var interaction=require(_0xf405('0x4'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0xf405('0x5')]('/',auth[_0xf405('0x6')](),controller[_0xf405('0x7')]);router[_0xf405('0x5')](_0xf405('0x8'),auth[_0xf405('0x6')](),controller[_0xf405('0x9')]);router['post']('/',auth[_0xf405('0x6')](),controller[_0xf405('0xa')]);router[_0xf405('0xb')]('/:id',auth[_0xf405('0x6')](),controller[_0xf405('0xc')]);router[_0xf405('0xd')](_0xf405('0x8'),auth['isAuthenticated'](),controller[_0xf405('0xe')]);module[_0xf405('0xf')]=router; \ No newline at end of file +var _0x73fe=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated','get','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x82b2af,_0x37e1b0){var _0x12f439=function(_0x884ada){while(--_0x884ada){_0x82b2af['push'](_0x82b2af['shift']());}};_0x12f439(++_0x37e1b0);}(_0x73fe,0x116));var _0xe73f=function(_0x10b401,_0x291733){_0x10b401=_0x10b401-0x0;var _0x159c61=_0x73fe[_0x10b401];return _0x159c61;};'use strict';var multer=require(_0xe73f('0x0'));var util=require(_0xe73f('0x1'));var path=require(_0xe73f('0x2'));var timeout=require(_0xe73f('0x3'));var express=require(_0xe73f('0x4'));var router=express[_0xe73f('0x5')]();var fs_extra=require(_0xe73f('0x6'));var auth=require(_0xe73f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe73f('0x8'));var controller=require(_0xe73f('0x9'));router['get']('/',auth[_0xe73f('0xa')](),controller['index']);router[_0xe73f('0xb')](_0xe73f('0xc'),auth[_0xe73f('0xa')](),controller['show']);router[_0xe73f('0xd')]('/',auth[_0xe73f('0xa')](),controller[_0xe73f('0xe')]);router[_0xe73f('0xf')](_0xe73f('0xc'),auth[_0xe73f('0xa')](),controller[_0xe73f('0x10')]);router[_0xe73f('0x11')](_0xe73f('0xc'),auth['isAuthenticated'](),controller[_0xe73f('0x12')]);module[_0xe73f('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 001bc32..137fe84 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 _0x405b=['production','DATE','sequelize','exports','STRING','name','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x628f99,_0x2c7553){var _0x216a5e=function(_0x4ab239){while(--_0x4ab239){_0x628f99['push'](_0x628f99['shift']());}};_0x216a5e(++_0x2c7553);}(_0x405b,0x152));var _0xb405=function(_0x33c9a0,_0x29c509){_0x33c9a0=_0x33c9a0-0x0;var _0x2b49cb=_0x405b[_0x33c9a0];return _0x2b49cb;};'use strict';var Sequelize=require(_0xb405('0x0'));module[_0xb405('0x1')]={'name':{'type':Sequelize[_0xb405('0x2')],'unique':_0xb405('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb405('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xb405('0x4')](_0xb405('0x5')),'get':function(){if(this[_0xb405('0x6')](_0xb405('0x7'))){return this[_0xb405('0x6')](_0xb405('0x7'))[_0xb405('0x8')](_0xb405('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0xb405('0x5')),'get':function(){if(this[_0xb405('0x6')]('production')){return this['getDataValue'](_0xb405('0xa'))[_0xb405('0x8')](_0xb405('0x9'));}}},'savedAt':{'type':Sequelize[_0xb405('0xb')]},'publishedAt':{'type':Sequelize[_0xb405('0xb')]}}; \ No newline at end of file +var _0x3553=['toString','utf8','long','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue'];(function(_0x47071d,_0x337966){var _0x16ee20=function(_0x3c4075){while(--_0x3c4075){_0x47071d['push'](_0x47071d['shift']());}};_0x16ee20(++_0x337966);}(_0x3553,0x65));var _0x3355=function(_0x520875,_0x4545b7){_0x520875=_0x520875-0x0;var _0xf4d6a6=_0x3553[_0x520875];return _0xf4d6a6;};'use strict';var Sequelize=require(_0x3355('0x0'));module[_0x3355('0x1')]={'name':{'type':Sequelize[_0x3355('0x2')],'unique':_0x3355('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3355('0x2')]},'notes':{'type':Sequelize[_0x3355('0x4')]},'preproduction':{'type':Sequelize[_0x3355('0x5')]('long'),'get':function(){if(this[_0x3355('0x6')]('preproduction')){return this[_0x3355('0x6')]('preproduction')[_0x3355('0x7')](_0x3355('0x8'));}}},'production':{'type':Sequelize[_0x3355('0x5')](_0x3355('0x9')),'get':function(){if(this['getDataValue'](_0x3355('0xa'))){return this[_0x3355('0x6')]('production')[_0x3355('0x7')](_0x3355('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x3355('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 02192c9..b2102a5 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 _0xf863=['api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','undefined','limit','count','set','Content-Range','update','then','get','SquareProjects','UserProfileResource','destroy','publish','stringify','end','sendStatus','stack','name','status','send','map','SquareProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','includeAll','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','agi','production','ioredis'];(function(_0x49146a,_0x2b978b){var _0x47f7ed=function(_0x58dcca){while(--_0x58dcca){_0x49146a['push'](_0x49146a['shift']());}};_0x47f7ed(++_0x2b978b);}(_0xf863,0x89));var _0x3f86=function(_0xf1d436,_0x5128b7){_0xf1d436=_0xf1d436-0x0;var _0x15149a=_0xf863[_0xf1d436];return _0x15149a;};'use strict';var _=require('lodash');var Redis=require(_0x3f86('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3f86('0x1'));var config=require('../../config/environment');var db=require(_0x3f86('0x2'))['db'];config[_0x3f86('0x3')]=_[_0x3f86('0x4')](config[_0x3f86('0x3')],{'host':_0x3f86('0x5'),'port':0x18eb});var socket=require(_0x3f86('0x6'))(new Redis(config[_0x3f86('0x3')]));require(_0x3f86('0x7'))[_0x3f86('0x8')](socket);function respondWithResult(_0x5eb00d,_0x4edceb){_0x4edceb=_0x4edceb||0xc8;return function(_0x401235){if(_0x401235){return _0x5eb00d['status'](_0x4edceb)[_0x3f86('0x9')](_0x401235);}};}function respondWithFilteredResult(_0x4b9311,_0x24294f){return function(_0x4c463a){if(_0x4c463a){var _0x2a5d58=typeof _0x24294f[_0x3f86('0xa')]===_0x3f86('0xb')&&typeof _0x24294f[_0x3f86('0xc')]==='undefined';var _0x49184c=_0x4c463a[_0x3f86('0xd')];var _0x472b93=_0x2a5d58?0x0:_0x24294f[_0x3f86('0xa')];var _0x4bc7d2=_0x2a5d58?_0x4c463a[_0x3f86('0xd')]:_0x24294f[_0x3f86('0xa')]+_0x24294f[_0x3f86('0xc')];var _0x43ea5e;if(_0x4bc7d2>=_0x49184c){_0x4bc7d2=_0x49184c;_0x43ea5e=0xc8;}else{_0x43ea5e=0xce;}_0x4b9311['status'](_0x43ea5e);return _0x4b9311[_0x3f86('0xe')](_0x3f86('0xf'),_0x472b93+'-'+_0x4bc7d2+'/'+_0x49184c)[_0x3f86('0x9')](_0x4c463a);}return null;};}function saveUpdates(_0x5350fe){return function(_0x1345e4){if(_0x1345e4){return _0x1345e4[_0x3f86('0x10')](_0x5350fe)[_0x3f86('0x11')](function(_0x79e215){return _0x79e215;});}return null;};}function removeEntity(_0x1eb072){return function(_0x5b54fa){if(_0x5b54fa){return _0x5b54fa['destroy']()['then'](function(){var _0x4d56bd=_0x5b54fa[_0x3f86('0x12')]({'plain':!![]});var _0x23f1d6=_0x3f86('0x13');return db[_0x3f86('0x14')][_0x3f86('0x15')]({'where':{'type':_0x23f1d6,'resourceId':_0x4d56bd['id']}})[_0x3f86('0x11')](function(){return _0x5b54fa;});})['then'](function(){var _0x31b4ac=new Redis(config[_0x3f86('0x3')]);_0x31b4ac[_0x3f86('0x16')]('agi',JSON[_0x3f86('0x17')]({'id':_0x5b54fa['id'],'deleted':!![]}));})[_0x3f86('0x11')](function(){_0x1eb072['status'](0xcc)[_0x3f86('0x18')]();});}};}function handleEntityNotFound(_0x4b2579){return function(_0xcf2caa){if(!_0xcf2caa){_0x4b2579[_0x3f86('0x19')](0x194);}return _0xcf2caa;};}function handleError(_0x346f7e,_0x301b22){_0x301b22=_0x301b22||0x1f4;return function(_0x3bade3){logger['error'](_0x3bade3[_0x3f86('0x1a')]);if(_0x3bade3[_0x3f86('0x1b')]){delete _0x3bade3['name'];}_0x346f7e[_0x3f86('0x1c')](_0x301b22)[_0x3f86('0x1d')](_0x3bade3);};}exports['index']=function(_0xb2db2d,_0x47a310){var _0x36d819={},_0x1edac6={},_0x537405={'count':0x0,'rows':[]};var _0x269043=_[_0x3f86('0x1e')](db[_0x3f86('0x1f')][_0x3f86('0x20')],function(_0x180c6d){return{'name':_0x180c6d[_0x3f86('0x21')],'type':_0x180c6d[_0x3f86('0x22')][_0x3f86('0x23')]};});_0x1edac6['model']=_[_0x3f86('0x1e')](_0x269043,_0x3f86('0x1b'));_0x1edac6[_0x3f86('0x24')]=_[_0x3f86('0x25')](_0xb2db2d['query']);_0x1edac6[_0x3f86('0x26')]=_[_0x3f86('0x27')](_0x1edac6[_0x3f86('0x28')],_0x1edac6['query']);_0x36d819[_0x3f86('0x29')]=_['intersection'](_0x1edac6[_0x3f86('0x28')],qs[_0x3f86('0x2a')](_0xb2db2d[_0x3f86('0x24')][_0x3f86('0x2a')]));_0x36d819['attributes']=_0x36d819[_0x3f86('0x29')][_0x3f86('0x2b')]?_0x36d819['attributes']:_0x1edac6[_0x3f86('0x28')];if(!_0xb2db2d[_0x3f86('0x24')]['hasOwnProperty']('nolimit')){_0x36d819['limit']=qs['limit'](_0xb2db2d[_0x3f86('0x24')][_0x3f86('0xc')]);_0x36d819['offset']=qs[_0x3f86('0xa')](_0xb2db2d[_0x3f86('0x24')][_0x3f86('0xa')]);}_0x36d819['order']=qs[_0x3f86('0x2c')](_0xb2db2d[_0x3f86('0x24')]['sort']);_0x36d819[_0x3f86('0x2d')]=qs[_0x3f86('0x26')](_[_0x3f86('0x2e')](_0xb2db2d[_0x3f86('0x24')],_0x1edac6[_0x3f86('0x26')]),_0x269043);if(_0xb2db2d['query']['filter']){_0x36d819['where']=_[_0x3f86('0x2f')](_0x36d819['where'],{'$or':_[_0x3f86('0x1e')](_0x269043,function(_0x430390){if(_0x430390[_0x3f86('0x22')]!=='VIRTUAL'){var _0x41f5ea={};_0x41f5ea[_0x430390[_0x3f86('0x1b')]]={'$like':'%'+_0xb2db2d['query'][_0x3f86('0x30')]+'%'};return _0x41f5ea;}})});}_0x36d819=_[_0x3f86('0x2f')]({},_0x36d819,_0xb2db2d[_0x3f86('0x31')]);var _0x21f3f6={'where':_0x36d819[_0x3f86('0x2d')]};return db[_0x3f86('0x1f')]['count'](_0x21f3f6)['then'](function(_0xf3169b){_0x537405[_0x3f86('0xd')]=_0xf3169b;if(_0xb2db2d[_0x3f86('0x24')]['includeAll']){_0x36d819[_0x3f86('0x32')]=[{'all':!![]}];}return db['SquareProject'][_0x3f86('0x33')](_0x36d819);})[_0x3f86('0x11')](function(_0x57b02c){_0x537405[_0x3f86('0x34')]=_0x57b02c;return _0x537405;})[_0x3f86('0x11')](respondWithFilteredResult(_0x47a310,_0x36d819))['catch'](handleError(_0x47a310,null));};exports[_0x3f86('0x35')]=function(_0x21c64a,_0x357f53){var _0x4091c3={'raw':![],'where':{'id':_0x21c64a[_0x3f86('0x36')]['id']}},_0x824d61={};_0x824d61[_0x3f86('0x28')]=_[_0x3f86('0x25')](db[_0x3f86('0x1f')][_0x3f86('0x20')]);_0x824d61['query']=_['keys'](_0x21c64a[_0x3f86('0x24')]);_0x824d61[_0x3f86('0x26')]=_[_0x3f86('0x27')](_0x824d61[_0x3f86('0x28')],_0x824d61[_0x3f86('0x24')]);_0x4091c3['attributes']=_[_0x3f86('0x27')](_0x824d61['model'],qs[_0x3f86('0x2a')](_0x21c64a[_0x3f86('0x24')][_0x3f86('0x2a')]));_0x4091c3[_0x3f86('0x29')]=_0x4091c3[_0x3f86('0x29')]['length']?_0x4091c3[_0x3f86('0x29')]:_0x824d61[_0x3f86('0x28')];if(_0x21c64a['query'][_0x3f86('0x37')]){_0x4091c3[_0x3f86('0x32')]=[{'all':!![]}];}_0x4091c3=_[_0x3f86('0x2f')]({},_0x4091c3,_0x21c64a[_0x3f86('0x31')]);return db[_0x3f86('0x1f')][_0x3f86('0x38')](_0x4091c3)[_0x3f86('0x11')](handleEntityNotFound(_0x357f53,null))['then'](respondWithResult(_0x357f53,null))[_0x3f86('0x39')](handleError(_0x357f53,null));};exports['create']=function(_0x1e2360,_0x14cb01){return db[_0x3f86('0x1f')][_0x3f86('0x3a')](_0x1e2360['body'],{})['then'](function(_0x399a2b){var _0x34c7fe=_0x1e2360[_0x3f86('0x3b')][_0x3f86('0x12')]({'plain':!![]});if(!_0x34c7fe)throw new Error(_0x3f86('0x3c'));if(_0x34c7fe[_0x3f86('0x3d')]===_0x3f86('0x3b')){var _0x466cdf=_0x399a2b['get']({'plain':!![]});var _0x3ae9a2=_0x3f86('0x13');return db[_0x3f86('0x3e')]['find']({'where':{'name':_0x3ae9a2,'userProfileId':_0x34c7fe[_0x3f86('0x3f')]},'raw':!![]})[_0x3f86('0x11')](function(_0x527c79){if(_0x527c79&&_0x527c79[_0x3f86('0x40')]===0x0){return db[_0x3f86('0x14')][_0x3f86('0x3a')]({'name':_0x466cdf['name'],'resourceId':_0x466cdf['id'],'type':_0x527c79[_0x3f86('0x1b')],'sectionId':_0x527c79['id']},{})['then'](function(){return _0x399a2b;});}else{return _0x399a2b;}})[_0x3f86('0x39')](function(_0x41af04){logger['error'](_0x3f86('0x41'),_0x41af04);throw _0x41af04;});}return _0x399a2b;})[_0x3f86('0x11')](respondWithResult(_0x14cb01,0xc9))[_0x3f86('0x39')](handleError(_0x14cb01,null));};exports[_0x3f86('0x10')]=function(_0x3076b8,_0x366645){if(_0x3076b8['body']['id']){delete _0x3076b8[_0x3f86('0x42')]['id'];}return db[_0x3f86('0x1f')][_0x3f86('0x38')]({'where':{'id':_0x3076b8['params']['id']}})[_0x3f86('0x11')](handleEntityNotFound(_0x366645,null))['then'](saveUpdates(_0x3076b8[_0x3f86('0x42')],null))[_0x3f86('0x11')](function(_0x4bff0d){if(!_0x4bff0d)return;var _0x5335e5=_0x4bff0d[_0x3f86('0x12')]({'plain':!![]});return _0x5335e5;})['then'](function(_0x2ff019){var _0x42c462=new Redis(config[_0x3f86('0x3')]);_0x42c462['publish'](_0x3f86('0x43'),JSON[_0x3f86('0x17')](_['pick'](_0x2ff019,['id',_0x3f86('0x1b'),_0x3f86('0x44')])));return _0x2ff019;})['then'](respondWithResult(_0x366645,null))[_0x3f86('0x39')](handleError(_0x366645,null));};exports[_0x3f86('0x15')]=function(_0x30958e,_0x4c8602){return db[_0x3f86('0x1f')][_0x3f86('0x38')]({'where':{'id':_0x30958e['params']['id']}})['then'](handleEntityNotFound(_0x4c8602,null))[_0x3f86('0x11')](removeEntity(_0x4c8602,null))[_0x3f86('0x39')](handleError(_0x4c8602,null));}; \ No newline at end of file +var _0xb65c=['fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareProject','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','user','role','SquareProjects','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','publish','stringify','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./squareProject.socket','register','status','offset','undefined','limit','count','set','json','update','then','destroy','get','UserProfileResource','agi','end','sendStatus','error','stack','name','send','map'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0xb65c,0x1d1));var _0xcb65=function(_0x304aca,_0x4f8e0b){_0x304aca=_0x304aca-0x0;var _0x3b811c=_0xb65c[_0x304aca];return _0x3b811c;};'use strict';var _=require(_0xcb65('0x0'));var Redis=require(_0xcb65('0x1'));var qs=require(_0xcb65('0x2'));var logger=require(_0xcb65('0x3'))(_0xcb65('0x4'));var config=require(_0xcb65('0x5'));var db=require(_0xcb65('0x6'))['db'];config['redis']=_[_0xcb65('0x7')](config[_0xcb65('0x8')],{'host':_0xcb65('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb65('0x8')]));require(_0xcb65('0xa'))[_0xcb65('0xb')](socket);function respondWithResult(_0x1f1111,_0xea9efd){_0xea9efd=_0xea9efd||0xc8;return function(_0x335d47){if(_0x335d47){return _0x1f1111[_0xcb65('0xc')](_0xea9efd)['json'](_0x335d47);}};}function respondWithFilteredResult(_0x5a1aff,_0x4050bc){return function(_0x5e1805){if(_0x5e1805){var _0x4e4c7a=typeof _0x4050bc[_0xcb65('0xd')]===_0xcb65('0xe')&&typeof _0x4050bc[_0xcb65('0xf')]===_0xcb65('0xe');var _0x69836b=_0x5e1805['count'];var _0x1cc05d=_0x4e4c7a?0x0:_0x4050bc[_0xcb65('0xd')];var _0x3318cf=_0x4e4c7a?_0x5e1805[_0xcb65('0x10')]:_0x4050bc['offset']+_0x4050bc[_0xcb65('0xf')];var _0x44b220;if(_0x3318cf>=_0x69836b){_0x3318cf=_0x69836b;_0x44b220=0xc8;}else{_0x44b220=0xce;}_0x5a1aff[_0xcb65('0xc')](_0x44b220);return _0x5a1aff[_0xcb65('0x11')]('Content-Range',_0x1cc05d+'-'+_0x3318cf+'/'+_0x69836b)[_0xcb65('0x12')](_0x5e1805);}return null;};}function saveUpdates(_0x1dcbda){return function(_0x426a8b){if(_0x426a8b){return _0x426a8b[_0xcb65('0x13')](_0x1dcbda)[_0xcb65('0x14')](function(_0x301696){return _0x301696;});}return null;};}function removeEntity(_0xb6b0c3){return function(_0x11a41c){if(_0x11a41c){return _0x11a41c[_0xcb65('0x15')]()[_0xcb65('0x14')](function(){var _0x319e5c=_0x11a41c[_0xcb65('0x16')]({'plain':!![]});var _0x3c62da='SquareProjects';return db[_0xcb65('0x17')][_0xcb65('0x15')]({'where':{'type':_0x3c62da,'resourceId':_0x319e5c['id']}})[_0xcb65('0x14')](function(){return _0x11a41c;});})[_0xcb65('0x14')](function(){var _0x4cd8e2=new Redis(config[_0xcb65('0x8')]);_0x4cd8e2['publish'](_0xcb65('0x18'),JSON['stringify']({'id':_0x11a41c['id'],'deleted':!![]}));})[_0xcb65('0x14')](function(){_0xb6b0c3[_0xcb65('0xc')](0xcc)[_0xcb65('0x19')]();});}};}function handleEntityNotFound(_0x424d52){return function(_0x2345ff){if(!_0x2345ff){_0x424d52[_0xcb65('0x1a')](0x194);}return _0x2345ff;};}function handleError(_0x247118,_0x20afb3){_0x20afb3=_0x20afb3||0x1f4;return function(_0x3422da){logger[_0xcb65('0x1b')](_0x3422da[_0xcb65('0x1c')]);if(_0x3422da['name']){delete _0x3422da[_0xcb65('0x1d')];}_0x247118['status'](_0x20afb3)[_0xcb65('0x1e')](_0x3422da);};}exports['index']=function(_0xaa3b21,_0xd9d755){var _0x5bb742={},_0x40669f={},_0x2df1c2={'count':0x0,'rows':[]};var _0x210cf7=_[_0xcb65('0x1f')](db['SquareProject']['rawAttributes'],function(_0x325b23){return{'name':_0x325b23[_0xcb65('0x20')],'type':_0x325b23['type'][_0xcb65('0x21')]};});_0x40669f['model']=_['map'](_0x210cf7,_0xcb65('0x1d'));_0x40669f[_0xcb65('0x22')]=_[_0xcb65('0x23')](_0xaa3b21[_0xcb65('0x22')]);_0x40669f[_0xcb65('0x24')]=_['intersection'](_0x40669f[_0xcb65('0x25')],_0x40669f['query']);_0x5bb742[_0xcb65('0x26')]=_[_0xcb65('0x27')](_0x40669f[_0xcb65('0x25')],qs['fields'](_0xaa3b21['query'][_0xcb65('0x28')]));_0x5bb742[_0xcb65('0x26')]=_0x5bb742[_0xcb65('0x26')][_0xcb65('0x29')]?_0x5bb742[_0xcb65('0x26')]:_0x40669f[_0xcb65('0x25')];if(!_0xaa3b21[_0xcb65('0x22')]['hasOwnProperty'](_0xcb65('0x2a'))){_0x5bb742['limit']=qs[_0xcb65('0xf')](_0xaa3b21[_0xcb65('0x22')][_0xcb65('0xf')]);_0x5bb742[_0xcb65('0xd')]=qs[_0xcb65('0xd')](_0xaa3b21['query'][_0xcb65('0xd')]);}_0x5bb742[_0xcb65('0x2b')]=qs[_0xcb65('0x2c')](_0xaa3b21[_0xcb65('0x22')][_0xcb65('0x2c')]);_0x5bb742[_0xcb65('0x2d')]=qs[_0xcb65('0x24')](_[_0xcb65('0x2e')](_0xaa3b21[_0xcb65('0x22')],_0x40669f['filters']),_0x210cf7);if(_0xaa3b21[_0xcb65('0x22')][_0xcb65('0x2f')]){_0x5bb742[_0xcb65('0x2d')]=_[_0xcb65('0x30')](_0x5bb742[_0xcb65('0x2d')],{'$or':_['map'](_0x210cf7,function(_0x532c14){if(_0x532c14['type']!==_0xcb65('0x31')){var _0x23e2ae={};_0x23e2ae[_0x532c14['name']]={'$like':'%'+_0xaa3b21[_0xcb65('0x22')][_0xcb65('0x2f')]+'%'};return _0x23e2ae;}})});}_0x5bb742=_[_0xcb65('0x30')]({},_0x5bb742,_0xaa3b21[_0xcb65('0x32')]);var _0x37278b={'where':_0x5bb742[_0xcb65('0x2d')]};return db[_0xcb65('0x33')][_0xcb65('0x10')](_0x37278b)[_0xcb65('0x14')](function(_0x1aa576){_0x2df1c2['count']=_0x1aa576;if(_0xaa3b21[_0xcb65('0x22')][_0xcb65('0x34')]){_0x5bb742[_0xcb65('0x35')]=[{'all':!![]}];}return db['SquareProject'][_0xcb65('0x36')](_0x5bb742);})[_0xcb65('0x14')](function(_0x1cc35c){_0x2df1c2[_0xcb65('0x37')]=_0x1cc35c;return _0x2df1c2;})[_0xcb65('0x14')](respondWithFilteredResult(_0xd9d755,_0x5bb742))[_0xcb65('0x38')](handleError(_0xd9d755,null));};exports['show']=function(_0x305e3f,_0x3bc79b){var _0x365d12={'raw':![],'where':{'id':_0x305e3f['params']['id']}},_0x4ae381={};_0x4ae381[_0xcb65('0x25')]=_[_0xcb65('0x23')](db[_0xcb65('0x33')][_0xcb65('0x39')]);_0x4ae381['query']=_['keys'](_0x305e3f[_0xcb65('0x22')]);_0x4ae381[_0xcb65('0x24')]=_['intersection'](_0x4ae381[_0xcb65('0x25')],_0x4ae381[_0xcb65('0x22')]);_0x365d12[_0xcb65('0x26')]=_[_0xcb65('0x27')](_0x4ae381[_0xcb65('0x25')],qs[_0xcb65('0x28')](_0x305e3f[_0xcb65('0x22')]['fields']));_0x365d12[_0xcb65('0x26')]=_0x365d12['attributes'][_0xcb65('0x29')]?_0x365d12[_0xcb65('0x26')]:_0x4ae381[_0xcb65('0x25')];if(_0x305e3f['query'][_0xcb65('0x34')]){_0x365d12[_0xcb65('0x35')]=[{'all':!![]}];}_0x365d12=_[_0xcb65('0x30')]({},_0x365d12,_0x305e3f[_0xcb65('0x32')]);return db['SquareProject'][_0xcb65('0x3a')](_0x365d12)['then'](handleEntityNotFound(_0x3bc79b,null))[_0xcb65('0x14')](respondWithResult(_0x3bc79b,null))[_0xcb65('0x38')](handleError(_0x3bc79b,null));};exports[_0xcb65('0x3b')]=function(_0x3417dd,_0x778883){return db[_0xcb65('0x33')][_0xcb65('0x3b')](_0x3417dd[_0xcb65('0x3c')],{})['then'](function(_0x2fae89){var _0x522102=_0x3417dd[_0xcb65('0x3d')]['get']({'plain':!![]});if(!_0x522102)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x522102[_0xcb65('0x3e')]===_0xcb65('0x3d')){var _0x1e3db3=_0x2fae89[_0xcb65('0x16')]({'plain':!![]});var _0x390267=_0xcb65('0x3f');return db['UserProfileSection']['find']({'where':{'name':_0x390267,'userProfileId':_0x522102[_0xcb65('0x40')]},'raw':!![]})[_0xcb65('0x14')](function(_0x2f1eaf){if(_0x2f1eaf&&_0x2f1eaf[_0xcb65('0x41')]===0x0){return db['UserProfileResource'][_0xcb65('0x3b')]({'name':_0x1e3db3[_0xcb65('0x1d')],'resourceId':_0x1e3db3['id'],'type':_0x2f1eaf[_0xcb65('0x1d')],'sectionId':_0x2f1eaf['id']},{})[_0xcb65('0x14')](function(){return _0x2fae89;});}else{return _0x2fae89;}})[_0xcb65('0x38')](function(_0x482b09){logger['error'](_0xcb65('0x42'),_0x482b09);throw _0x482b09;});}return _0x2fae89;})[_0xcb65('0x14')](respondWithResult(_0x778883,0xc9))[_0xcb65('0x38')](handleError(_0x778883,null));};exports[_0xcb65('0x13')]=function(_0x2ccf,_0x3161d2){if(_0x2ccf[_0xcb65('0x3c')]['id']){delete _0x2ccf[_0xcb65('0x3c')]['id'];}return db[_0xcb65('0x33')][_0xcb65('0x3a')]({'where':{'id':_0x2ccf[_0xcb65('0x43')]['id']}})[_0xcb65('0x14')](handleEntityNotFound(_0x3161d2,null))[_0xcb65('0x14')](saveUpdates(_0x2ccf[_0xcb65('0x3c')],null))[_0xcb65('0x14')](function(_0x23b6d5){if(!_0x23b6d5)return;var _0x1d72d1=_0x23b6d5[_0xcb65('0x16')]({'plain':!![]});return _0x1d72d1;})[_0xcb65('0x14')](function(_0x531eb5){var _0x43cc3=new Redis(config['redis']);_0x43cc3[_0xcb65('0x44')]('agi',JSON[_0xcb65('0x45')](_['pick'](_0x531eb5,['id','name',_0xcb65('0x46')])));return _0x531eb5;})[_0xcb65('0x14')](respondWithResult(_0x3161d2,null))[_0xcb65('0x38')](handleError(_0x3161d2,null));};exports[_0xcb65('0x15')]=function(_0xe7dbee,_0x42d44d){return db[_0xcb65('0x33')][_0xcb65('0x3a')]({'where':{'id':_0xe7dbee[_0xcb65('0x43')]['id']}})[_0xcb65('0x14')](handleEntityNotFound(_0x42d44d,null))['then'](removeEntity(_0x42d44d,null))[_0xcb65('0x38')](handleError(_0x42d44d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index cf72751..8c5f713 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 _0xe777=['remove','emit','events','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x30f788,_0x4a5b0a){var _0x480448=function(_0x29b81a){while(--_0x29b81a){_0x30f788['push'](_0x30f788['shift']());}};_0x480448(++_0x4a5b0a);}(_0xe777,0x1da));var _0x7e77=function(_0x36f3e0,_0x5d033b){_0x36f3e0=_0x36f3e0-0x0;var _0x48ebd9=_0xe777[_0x36f3e0];return _0x48ebd9;};'use strict';var EventEmitter=require(_0x7e77('0x0'));var SquareProject=require(_0x7e77('0x1'))['db'][_0x7e77('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7e77('0x3')](0x0);var events={'afterCreate':_0x7e77('0x4'),'afterUpdate':_0x7e77('0x5'),'afterDestroy':_0x7e77('0x6')};function emitEvent(_0x4cf019){return function(_0x492519,_0x54a484,_0x581074){SquareProjectEvents['emit'](_0x4cf019+':'+_0x492519['id'],_0x492519);SquareProjectEvents[_0x7e77('0x7')](_0x4cf019,_0x492519);_0x581074(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x33db=['exports','SquareProject','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x55f20a,_0x5b9a64){var _0x2b894a=function(_0x584fde){while(--_0x584fde){_0x55f20a['push'](_0x55f20a['shift']());}};_0x2b894a(++_0x5b9a64);}(_0x33db,0x1ba));var _0xb33d=function(_0x2ceedb,_0x3d4af3){_0x2ceedb=_0x2ceedb-0x0;var _0x1eef5c=_0x33db[_0x2ceedb];return _0x1eef5c;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xb33d('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb33d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb33d('0x2'),'afterDestroy':'remove'};function emitEvent(_0x89f12e){return function(_0x144a25,_0x5a08e0,_0x377ae3){SquareProjectEvents['emit'](_0x89f12e+':'+_0x144a25['id'],_0x144a25);SquareProjectEvents[_0xb33d('0x3')](_0x89f12e,_0x144a25);_0x377ae3(null);};}for(var e in events){if(events[_0xb33d('0x4')](e)){var event=events[e];SquareProject[_0xb33d('0x5')](e,emitEvent(event));}}module[_0xb33d('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 af5dcbb..6aa21b6 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 _0xc510=['YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0xc510,0x1a8));var _0x0c51=function(_0xa9859c,_0x50500d){_0xa9859c=_0xa9859c-0x0;var _0x3e23f9=_0xc510[_0xa9859c];return _0x3e23f9;};'use strict';var _=require(_0x0c51('0x0'));var util=require(_0x0c51('0x1'));var logger=require('../../config/logger')(_0x0c51('0x2'));var moment=require(_0x0c51('0x3'));var BPromise=require(_0x0c51('0x4'));var rp=require(_0x0c51('0x5'));var fs=require('fs');var path=require(_0x0c51('0x6'));var rimraf=require(_0x0c51('0x7'));var config=require(_0x0c51('0x8'));var attributes=require(_0x0c51('0x9'));module['exports']=function(_0x4bf49d,_0x4c61c9){return _0x4bf49d[_0x0c51('0xa')](_0x0c51('0xb'),attributes,{'tableName':_0x0c51('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48e013,_0x5793bf,_0x949345){if(_0x48e013[_0x0c51('0xd')](_0x0c51('0xe'))){_0x48e013[_0x0c51('0xf')]=moment()['format'](_0x0c51('0x10'));}if(_0x48e013[_0x0c51('0xd')](_0x0c51('0x11'))){_0x48e013[_0x0c51('0x12')]=moment()[_0x0c51('0x13')]('YYYY-MM-DD\x20HH:mm:ss');}_0x949345(null,_0x48e013);}}});}; \ No newline at end of file +var _0x1eb3=['publishedAt','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production'];(function(_0x4219a4,_0x193700){var _0x73d7c7=function(_0x13797a){while(--_0x13797a){_0x4219a4['push'](_0x4219a4['shift']());}};_0x73d7c7(++_0x193700);}(_0x1eb3,0x141));var _0x31eb=function(_0xae7bec,_0x550c9f){_0xae7bec=_0xae7bec-0x0;var _0x400518=_0x1eb3[_0xae7bec];return _0x400518;};'use strict';var _=require(_0x31eb('0x0'));var util=require(_0x31eb('0x1'));var logger=require(_0x31eb('0x2'))(_0x31eb('0x3'));var moment=require('moment');var BPromise=require(_0x31eb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31eb('0x5'));var rimraf=require(_0x31eb('0x6'));var config=require(_0x31eb('0x7'));var attributes=require(_0x31eb('0x8'));module[_0x31eb('0x9')]=function(_0x480dd7,_0x2e70a4){return _0x480dd7[_0x31eb('0xa')](_0x31eb('0xb'),attributes,{'tableName':_0x31eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1feb54,_0xaaaf33,_0x28858e){if(_0x1feb54['changed'](_0x31eb('0xd'))){_0x1feb54[_0x31eb('0xe')]=moment()[_0x31eb('0xf')](_0x31eb('0x10'));}if(_0x1feb54[_0x31eb('0x11')](_0x31eb('0x12'))){_0x1feb54[_0x31eb('0x13')]=moment()[_0x31eb('0xf')](_0x31eb('0x10'));}_0x28858e(null,_0x1feb54);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 21c19fa..dfd6cbf 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 _0xb22a=['attributes','limit','include','map','model','then','debug','catch','error','message','find','info','ShowSquareProject','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','raw','options'];(function(_0x55d31a,_0x1e463d){var _0x16f7f1=function(_0x3eb1d0){while(--_0x3eb1d0){_0x55d31a['push'](_0x55d31a['shift']());}};_0x16f7f1(++_0x1e463d);}(_0xb22a,0xd1));var _0xab22=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0xb22a[_0x11f5ff];return _0x46eefb;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0xab22('0x0'))['db'];var logger=require(_0xab22('0x1'))(_0xab22('0x2'));var config=require(_0xab22('0x3'));config[_0xab22('0x4')]=_[_0xab22('0x5')](config[_0xab22('0x4')],{'host':_0xab22('0x6'),'port':0x18eb});var socket=require(_0xab22('0x7'))(new Redis(config['redis']));require(_0xab22('0x8'))[_0xab22('0x9')](socket);exports[_0xab22('0xa')]=function(_0x467f54){var _0x9feea0=this;return new Promise(function(_0x44e0b0,_0x2a32e4){return db[_0xab22('0xb')][_0xab22('0xc')]({'raw':_0x467f54['options']?_0x467f54['options'][_0xab22('0xd')]===undefined?!![]:![]:!![],'where':_0x467f54[_0xab22('0xe')]?_0x467f54[_0xab22('0xe')]['where']||null:null,'attributes':_0x467f54[_0xab22('0xe')]?_0x467f54[_0xab22('0xe')][_0xab22('0xf')]||null:null,'limit':_0x467f54[_0xab22('0xe')]?_0x467f54[_0xab22('0xe')][_0xab22('0x10')]||null:null,'include':_0x467f54[_0xab22('0xe')]?_0x467f54[_0xab22('0xe')][_0xab22('0x11')]?_[_0xab22('0x12')](_0x467f54[_0xab22('0xe')][_0xab22('0x11')],function(_0x566c27){return{'model':db[_0x566c27['model']],'as':_0x566c27['as'],'attributes':_0x566c27['attributes'],'include':_0x566c27[_0xab22('0x11')]?_[_0xab22('0x12')](_0x566c27[_0xab22('0x11')],function(_0x46c0ae){return{'model':db[_0x46c0ae['model']],'as':_0x46c0ae['as'],'attributes':_0x46c0ae[_0xab22('0xf')],'include':_0x46c0ae[_0xab22('0x11')]?_['map'](_0x46c0ae[_0xab22('0x11')],function(_0x56a75f){return{'model':db[_0x56a75f[_0xab22('0x13')]],'as':_0x56a75f['as'],'attributes':_0x56a75f[_0xab22('0xf')]};}):[]};}):[]};}):[]:[]})[_0xab22('0x14')](function(_0x553a05){logger['info']('GetSquareProjects',_0x467f54);logger[_0xab22('0x15')](_0xab22('0xa'),_0x467f54,JSON['stringify'](_0x553a05));_0x44e0b0(_0x553a05);})[_0xab22('0x16')](function(_0x2ced8c){logger[_0xab22('0x17')](_0xab22('0xa'),_0x2ced8c[_0xab22('0x18')],_0x467f54);_0x2a32e4(_0x9feea0[_0xab22('0x17')](0x1f4,_0x2ced8c[_0xab22('0x18')]));});});};exports['ShowSquareProject']=function(_0x871e25){var _0x410876=this;return new Promise(function(_0x47af7f,_0x4ede0d){return db[_0xab22('0xb')][_0xab22('0x19')]({'raw':_0x871e25[_0xab22('0xe')]?_0x871e25[_0xab22('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x871e25['options']?_0x871e25[_0xab22('0xe')]['where']||null:null,'attributes':_0x871e25[_0xab22('0xe')]?_0x871e25[_0xab22('0xe')][_0xab22('0xf')]||null:null,'include':_0x871e25['options']?_0x871e25[_0xab22('0xe')]['include']?_[_0xab22('0x12')](_0x871e25[_0xab22('0xe')]['include'],function(_0x5a9867){return{'model':db[_0x5a9867[_0xab22('0x13')]],'as':_0x5a9867['as'],'attributes':_0x5a9867[_0xab22('0xf')],'include':_0x5a9867[_0xab22('0x11')]?_[_0xab22('0x12')](_0x5a9867[_0xab22('0x11')],function(_0x4d055b){return{'model':db[_0x4d055b['model']],'as':_0x4d055b['as'],'attributes':_0x4d055b[_0xab22('0xf')],'include':_0x4d055b[_0xab22('0x11')]?_[_0xab22('0x12')](_0x4d055b[_0xab22('0x11')],function(_0x5bf6ad){return{'model':db[_0x5bf6ad[_0xab22('0x13')]],'as':_0x5bf6ad['as'],'attributes':_0x5bf6ad[_0xab22('0xf')]};}):[]};}):[]};}):[]:[]})[_0xab22('0x14')](function(_0xc0583d){logger[_0xab22('0x1a')](_0xab22('0x1b'),_0x871e25);logger['debug'](_0xab22('0x1b'),_0x871e25,JSON['stringify'](_0xc0583d));_0x47af7f(_0xc0583d);})[_0xab22('0x16')](function(_0x52b17f){logger['error'](_0xab22('0x1b'),_0x52b17f[_0xab22('0x18')],_0x871e25);_0x4ede0d(_0x410876['error'](0x1f4,_0x52b17f['message']));});});}; \ No newline at end of file +var _0xecf3=['where','limit','include','map','model','attributes','then','info','debug','message','error','ShowSquareProject','find','stringify','catch','lodash','ioredis','rpc','redis','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','raw'];(function(_0x5a37c2,_0x6bce34){var _0x24c0d3=function(_0x1cca4e){while(--_0x1cca4e){_0x5a37c2['push'](_0x5a37c2['shift']());}};_0x24c0d3(++_0x6bce34);}(_0xecf3,0x102));var _0x3ecf=function(_0x1761d0,_0x4f9470){_0x1761d0=_0x1761d0-0x0;var _0x1a59e2=_0xecf3[_0x1761d0];return _0x1a59e2;};'use strict';var _=require(_0x3ecf('0x0'));var Redis=require(_0x3ecf('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x3ecf('0x2'));var config=require('../../config/environment');config[_0x3ecf('0x3')]=_['defaults'](config[_0x3ecf('0x3')],{'host':_0x3ecf('0x4'),'port':0x18eb});var socket=require(_0x3ecf('0x5'))(new Redis(config[_0x3ecf('0x3')]));require(_0x3ecf('0x6'))[_0x3ecf('0x7')](socket);exports[_0x3ecf('0x8')]=function(_0x40ed8c){var _0x752e4b=this;return new Promise(function(_0x50ba2c,_0x1408e3){return db['SquareProject'][_0x3ecf('0x9')]({'raw':_0x40ed8c[_0x3ecf('0xa')]?_0x40ed8c['options'][_0x3ecf('0xb')]===undefined?!![]:![]:!![],'where':_0x40ed8c[_0x3ecf('0xa')]?_0x40ed8c[_0x3ecf('0xa')][_0x3ecf('0xc')]||null:null,'attributes':_0x40ed8c[_0x3ecf('0xa')]?_0x40ed8c[_0x3ecf('0xa')]['attributes']||null:null,'limit':_0x40ed8c[_0x3ecf('0xa')]?_0x40ed8c[_0x3ecf('0xa')][_0x3ecf('0xd')]||null:null,'include':_0x40ed8c[_0x3ecf('0xa')]?_0x40ed8c[_0x3ecf('0xa')][_0x3ecf('0xe')]?_[_0x3ecf('0xf')](_0x40ed8c['options'][_0x3ecf('0xe')],function(_0x2fe411){return{'model':db[_0x2fe411[_0x3ecf('0x10')]],'as':_0x2fe411['as'],'attributes':_0x2fe411[_0x3ecf('0x11')],'include':_0x2fe411[_0x3ecf('0xe')]?_[_0x3ecf('0xf')](_0x2fe411['include'],function(_0x598ce1){return{'model':db[_0x598ce1[_0x3ecf('0x10')]],'as':_0x598ce1['as'],'attributes':_0x598ce1[_0x3ecf('0x11')],'include':_0x598ce1[_0x3ecf('0xe')]?_['map'](_0x598ce1[_0x3ecf('0xe')],function(_0x4ffd3e){return{'model':db[_0x4ffd3e[_0x3ecf('0x10')]],'as':_0x4ffd3e['as'],'attributes':_0x4ffd3e[_0x3ecf('0x11')]};}):[]};}):[]};}):[]:[]})[_0x3ecf('0x12')](function(_0x2428ea){logger[_0x3ecf('0x13')](_0x3ecf('0x8'),_0x40ed8c);logger[_0x3ecf('0x14')]('GetSquareProjects',_0x40ed8c,JSON['stringify'](_0x2428ea));_0x50ba2c(_0x2428ea);})['catch'](function(_0x12aa90){logger['error']('GetSquareProjects',_0x12aa90[_0x3ecf('0x15')],_0x40ed8c);_0x1408e3(_0x752e4b[_0x3ecf('0x16')](0x1f4,_0x12aa90['message']));});});};exports[_0x3ecf('0x17')]=function(_0x5ad56c){var _0x1b4398=this;return new Promise(function(_0x319235,_0x35e798){return db['SquareProject'][_0x3ecf('0x18')]({'raw':_0x5ad56c['options']?_0x5ad56c[_0x3ecf('0xa')][_0x3ecf('0xb')]===undefined?!![]:![]:!![],'where':_0x5ad56c[_0x3ecf('0xa')]?_0x5ad56c[_0x3ecf('0xa')]['where']||null:null,'attributes':_0x5ad56c[_0x3ecf('0xa')]?_0x5ad56c[_0x3ecf('0xa')][_0x3ecf('0x11')]||null:null,'include':_0x5ad56c[_0x3ecf('0xa')]?_0x5ad56c[_0x3ecf('0xa')][_0x3ecf('0xe')]?_[_0x3ecf('0xf')](_0x5ad56c[_0x3ecf('0xa')][_0x3ecf('0xe')],function(_0x22faa7){return{'model':db[_0x22faa7['model']],'as':_0x22faa7['as'],'attributes':_0x22faa7[_0x3ecf('0x11')],'include':_0x22faa7[_0x3ecf('0xe')]?_[_0x3ecf('0xf')](_0x22faa7['include'],function(_0x17a336){return{'model':db[_0x17a336[_0x3ecf('0x10')]],'as':_0x17a336['as'],'attributes':_0x17a336[_0x3ecf('0x11')],'include':_0x17a336['include']?_[_0x3ecf('0xf')](_0x17a336[_0x3ecf('0xe')],function(_0x2c170d){return{'model':db[_0x2c170d['model']],'as':_0x2c170d['as'],'attributes':_0x2c170d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ecf('0x12')](function(_0x35216f){logger['info'](_0x3ecf('0x17'),_0x5ad56c);logger['debug'](_0x3ecf('0x17'),_0x5ad56c,JSON[_0x3ecf('0x19')](_0x35216f));_0x319235(_0x35216f);})[_0x3ecf('0x1a')](function(_0x1d172b){logger[_0x3ecf('0x16')](_0x3ecf('0x17'),_0x1d172b[_0x3ecf('0x15')],_0x5ad56c);_0x35e798(_0x1b4398[_0x3ecf('0x16')](0x1f4,_0x1d172b[_0x3ecf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index ca72ab2..7a49d92 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 _0x598a=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x172fa4,_0x1530af){var _0x1e0e8b=function(_0x54055a){while(--_0x54055a){_0x172fa4['push'](_0x172fa4['shift']());}};_0x1e0e8b(++_0x1530af);}(_0x598a,0x13a));var _0xa598=function(_0x11e239,_0x3c3ad8){_0x11e239=_0x11e239-0x0;var _0x17b9e=_0x598a[_0x11e239];return _0x17b9e;};'use strict';var SquareProjectEvents=require(_0xa598('0x0'));var events=[_0xa598('0x1'),_0xa598('0x2'),_0xa598('0x3')];function createListener(_0x43648d,_0x43489a){return function(_0x2b4193){_0x43489a[_0xa598('0x4')](_0x43648d,_0x2b4193);};}function removeListener(_0x3e1294,_0x3d228a){return function(){SquareProjectEvents[_0xa598('0x5')](_0x3e1294,_0x3d228a);};}exports[_0xa598('0x6')]=function(_0x49dbed){for(var _0x2283ce=0x0,_0x117976=events[_0xa598('0x7')];_0x2283ce<_0x117976;_0x2283ce++){var _0x38d734=events[_0x2283ce];var _0x15a95f=createListener(_0xa598('0x8')+_0x38d734,_0x49dbed);SquareProjectEvents['on'](_0x38d734,_0x15a95f);}}; \ No newline at end of file +var _0x4760=['register','length','squareProject:','./squareProject.events','remove','update','emit','removeListener'];(function(_0x59f97a,_0x511696){var _0x411b33=function(_0x4f801e){while(--_0x4f801e){_0x59f97a['push'](_0x59f97a['shift']());}};_0x411b33(++_0x511696);}(_0x4760,0x143));var _0x0476=function(_0x3240a2,_0x1ed21c){_0x3240a2=_0x3240a2-0x0;var _0x4415c0=_0x4760[_0x3240a2];return _0x4415c0;};'use strict';var SquareProjectEvents=require(_0x0476('0x0'));var events=['save',_0x0476('0x1'),_0x0476('0x2')];function createListener(_0x317da4,_0xd81f6e){return function(_0x3921ce){_0xd81f6e[_0x0476('0x3')](_0x317da4,_0x3921ce);};}function removeListener(_0x3af7d6,_0x47eac8){return function(){SquareProjectEvents[_0x0476('0x4')](_0x3af7d6,_0x47eac8);};}exports[_0x0476('0x5')]=function(_0x1f2c27){for(var _0x12bdf9=0x0,_0x55d47c=events[_0x0476('0x6')];_0x12bdf9<_0x55d47c;_0x12bdf9++){var _0x216b6d=events[_0x12bdf9];var _0x52ccbf=createListener(_0x0476('0x7')+_0x216b6d,_0x1f2c27);SquareProjectEvents['on'](_0x216b6d,_0x52ccbf);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9803c85..e723ec2 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x3b9179,_0x245bb1){var _0x1121de=function(_0x4c7a04){while(--_0x4c7a04){_0x3b9179['push'](_0x3b9179['shift']());}};_0x1121de(++_0x245bb1);}(_0x7a54,0x106));var _0x47a5=function(_0x5be833,_0x726775){_0x5be833=_0x5be833-0x0;var _0x5d3d65=_0x7a54[_0x5be833];return _0x5d3d65;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x29c0b1,_0x97fa3){var _0x53291e=function(_0x1690ac){while(--_0x1690ac){_0x29c0b1['push'](_0x29c0b1['shift']());}};_0x53291e(++_0x97fa3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'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['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index e8bafd8..f6c2208 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 _0x31f0=['getDataValue','savePath','substring','sequelize','STRING','VIRTUAL'];(function(_0x543540,_0x8a1ba7){var _0x1a6d8f=function(_0x3407b6){while(--_0x3407b6){_0x543540['push'](_0x543540['shift']());}};_0x1a6d8f(++_0x8a1ba7);}(_0x31f0,0xb7));var _0x031f=function(_0x2f3cb1,_0x2d86b3){_0x2f3cb1=_0x2f3cb1-0x0;var _0x1c1d65=_0x31f0[_0x2f3cb1];return _0x1c1d65;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x031f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x031f('0x1')]},'context':{'type':Sequelize[_0x031f('0x1')]},'extension':{'type':Sequelize[_0x031f('0x1')]},'priority':{'type':Sequelize[_0x031f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x031f('0x1')]},'projectName':{'type':Sequelize[_0x031f('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x031f('0x2')],'get':function(){var _0x487e65='';var _0x365f59=this[_0x031f('0x3')](_0x031f('0x4'));if(_0x365f59){_0x487e65=_0x365f59[_0x031f('0x5')](_0x365f59['lastIndexOf']('.'));}return _0x487e65;}}}; \ No newline at end of file +var _0x6aa7=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x5390b3,_0x207725){var _0x42d5be=function(_0x2fb24a){while(--_0x2fb24a){_0x5390b3['push'](_0x5390b3['shift']());}};_0x42d5be(++_0x207725);}(_0x6aa7,0x178));var _0x76aa=function(_0x5e8f86,_0x588a78){_0x5e8f86=_0x5e8f86-0x0;var _0x4b9342=_0x6aa7[_0x5e8f86];return _0x4b9342;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'dnid':{'type':Sequelize[_0x76aa('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x76aa('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x76aa('0x2')],'get':function(){var _0x36d12b='';var _0xa9b695=this['getDataValue'](_0x76aa('0x3'));if(_0xa9b695){_0x36d12b=_0xa9b695[_0x76aa('0x4')](_0xa9b695[_0x76aa('0x5')]('.'));}return _0x36d12b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e47692f..4e985a6 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 _0x79be=['File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','moment','util','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','then','destroy','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','fields','catch','create','body','update','find','download','../../components/encryptor','type','uniqueid','savePath','format','%s.cypher','existsSync','secrets','recording','Sequelize','filename','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil'];(function(_0x3a2910,_0x7936c6){var _0x2e8bce=function(_0x2ed507){while(--_0x2ed507){_0x3a2910['push'](_0x3a2910['shift']());}};_0x2e8bce(++_0x7936c6);}(_0x79be,0x113));var _0xe79b=function(_0x554670,_0x5c3d99){_0x554670=_0x554670-0x0;var _0x44cbc1=_0x79be[_0x554670];return _0x44cbc1;};'use strict';var emlformat=require(_0xe79b('0x0'));var rimraf=require(_0xe79b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe79b('0x2'));var rp=require(_0xe79b('0x3'));var moment=require(_0xe79b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe79b('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe79b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe79b('0x7'));var squel=require(_0xe79b('0x8'));var crypto=require(_0xe79b('0x9'));var jsforce=require(_0xe79b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe79b('0xb'));var querystring=require(_0xe79b('0xc'));var Papa=require(_0xe79b('0xd'));var Redis=require(_0xe79b('0xe'));var authService=require(_0xe79b('0xf'));var qs=require(_0xe79b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe79b('0x11'))('api');var utils=require(_0xe79b('0x12'));var config=require(_0xe79b('0x13'));var licenseUtil=require(_0xe79b('0x14'));var db=require(_0xe79b('0x15'))['db'];function respondWithStatusCode(_0x2ec226,_0x592689){_0x592689=_0x592689||0xcc;return function(_0x47ec8a){if(_0x47ec8a){return _0x2ec226[_0xe79b('0x16')](_0x592689);}return _0x2ec226['status'](_0x592689)[_0xe79b('0x17')]();};}function respondWithResult(_0x2569d5,_0x266866){_0x266866=_0x266866||0xc8;return function(_0x254356){if(_0x254356){return _0x2569d5[_0xe79b('0x18')](_0x266866)['json'](_0x254356);}};}function respondWithFilteredResult(_0x252e92,_0x15f556){return function(_0x122939){if(_0x122939){var _0x589e5f=typeof _0x15f556[_0xe79b('0x19')]===_0xe79b('0x1a')&&typeof _0x15f556[_0xe79b('0x1b')]===_0xe79b('0x1a');var _0x2720b3=_0x122939[_0xe79b('0x1c')];var _0x1e966b=_0x589e5f?0x0:_0x15f556['offset'];var _0x3d0efa=_0x589e5f?_0x122939[_0xe79b('0x1c')]:_0x15f556[_0xe79b('0x19')]+_0x15f556[_0xe79b('0x1b')];var _0x1d3b87;if(_0x3d0efa>=_0x2720b3){_0x3d0efa=_0x2720b3;_0x1d3b87=0xc8;}else{_0x1d3b87=0xce;}_0x252e92['status'](_0x1d3b87);return _0x252e92['set']('Content-Range',_0x1e966b+'-'+_0x3d0efa+'/'+_0x2720b3)[_0xe79b('0x1d')](_0x122939);}return null;};}function patchUpdates(_0x1faa69){return function(_0x349edb){try{jsonpatch[_0xe79b('0x1e')](_0x349edb,_0x1faa69,!![]);}catch(_0x157675){return BPromise[_0xe79b('0x1f')](_0x157675);}return _0x349edb[_0xe79b('0x20')]();};}function saveUpdates(_0x31b6ba,_0x3815a2){return function(_0x37d7a3){if(_0x37d7a3){return _0x37d7a3['update'](_0x31b6ba)[_0xe79b('0x21')](function(_0x473fd4){return _0x473fd4;});}return null;};}function removeEntity(_0x2f417c,_0x5bdfaa){return function(_0x1f47ac){if(_0x1f47ac){return _0x1f47ac[_0xe79b('0x22')]()[_0xe79b('0x21')](function(){_0x2f417c[_0xe79b('0x18')](0xcc)[_0xe79b('0x17')]();});}};}function handleEntityNotFound(_0x180da6,_0x5c4f1c){return function(_0x11db8b){if(!_0x11db8b){_0x180da6[_0xe79b('0x16')](0x194);}return _0x11db8b;};}function handleError(_0x3b4f94,_0xf679fa){_0xf679fa=_0xf679fa||0x1f4;return function(_0x48eeac){logger[_0xe79b('0x23')](_0x48eeac['stack']);if(_0x48eeac[_0xe79b('0x24')]){delete _0x48eeac[_0xe79b('0x24')];}_0x3b4f94[_0xe79b('0x18')](_0xf679fa)[_0xe79b('0x25')](_0x48eeac);};}exports[_0xe79b('0x26')]=function(_0x36e49a,_0x3b3733){var _0x5105e8={},_0x91c6e0={},_0x3a6869={'count':0x0,'rows':[]};var _0x24a7cc=_[_0xe79b('0x27')](db[_0xe79b('0x28')][_0xe79b('0x29')],function(_0x4c4055){return{'name':_0x4c4055[_0xe79b('0x2a')],'type':_0x4c4055['type'][_0xe79b('0x2b')]};});_0x91c6e0[_0xe79b('0x2c')]=_['map'](_0x24a7cc,_0xe79b('0x24'));_0x91c6e0[_0xe79b('0x2d')]=_[_0xe79b('0x2e')](_0x36e49a['query']);_0x91c6e0[_0xe79b('0x2f')]=_[_0xe79b('0x30')](_0x91c6e0[_0xe79b('0x2c')],_0x91c6e0['query']);_0x5105e8[_0xe79b('0x31')]=_['intersection'](_0x91c6e0['model'],qs['fields'](_0x36e49a[_0xe79b('0x2d')]['fields']));_0x5105e8[_0xe79b('0x31')]=_0x5105e8['attributes'][_0xe79b('0x32')]?_0x5105e8['attributes']:_0x91c6e0['model'];if(!_0x36e49a[_0xe79b('0x2d')]['hasOwnProperty'](_0xe79b('0x33'))){_0x5105e8['limit']=qs[_0xe79b('0x1b')](_0x36e49a[_0xe79b('0x2d')]['limit']);_0x5105e8[_0xe79b('0x19')]=qs[_0xe79b('0x19')](_0x36e49a[_0xe79b('0x2d')][_0xe79b('0x19')]);}_0x5105e8['order']=qs[_0xe79b('0x34')](_0x36e49a[_0xe79b('0x2d')]['sort']);_0x5105e8[_0xe79b('0x35')]=qs[_0xe79b('0x2f')](_[_0xe79b('0x36')](_0x36e49a[_0xe79b('0x2d')],_0x91c6e0[_0xe79b('0x2f')]),_0x24a7cc);if(_0x36e49a['query'][_0xe79b('0x37')]){_0x5105e8[_0xe79b('0x35')]=_[_0xe79b('0x38')](_0x5105e8[_0xe79b('0x35')],{'$or':_['map'](_0x24a7cc,function(_0x4025f4){if(_0x4025f4['type']!==_0xe79b('0x39')){var _0x5a0c17={};_0x5a0c17[_0x4025f4[_0xe79b('0x24')]]={'$like':'%'+_0x36e49a[_0xe79b('0x2d')]['filter']+'%'};return _0x5a0c17;}})});}_0x5105e8=_['merge']({},_0x5105e8,_0x36e49a[_0xe79b('0x3a')]);var _0x1ef2cc={'where':_0x5105e8[_0xe79b('0x35')]};return db[_0xe79b('0x28')]['count'](_0x1ef2cc)['then'](function(_0x34600b){_0x3a6869[_0xe79b('0x1c')]=_0x34600b;if(_0x36e49a['query']['includeAll']){_0x5105e8[_0xe79b('0x3b')]=[{'all':!![]}];}return db[_0xe79b('0x28')]['findAll'](_0x5105e8);})[_0xe79b('0x21')](function(_0x2730ad){_0x3a6869[_0xe79b('0x3c')]=_0x2730ad;return _0x3a6869;})[_0xe79b('0x21')](respondWithFilteredResult(_0x3b3733,_0x5105e8))['catch'](handleError(_0x3b3733,null));};exports[_0xe79b('0x3d')]=function(_0x29394a,_0x25289d){var _0x4d8151={'raw':!![],'where':{'id':_0x29394a[_0xe79b('0x3e')]['id']}},_0x1c899f={};_0x1c899f[_0xe79b('0x2c')]=_[_0xe79b('0x2e')](db[_0xe79b('0x28')][_0xe79b('0x29')]);_0x1c899f[_0xe79b('0x2d')]=_[_0xe79b('0x2e')](_0x29394a['query']);_0x1c899f[_0xe79b('0x2f')]=_[_0xe79b('0x30')](_0x1c899f['model'],_0x1c899f[_0xe79b('0x2d')]);_0x4d8151[_0xe79b('0x31')]=_[_0xe79b('0x30')](_0x1c899f[_0xe79b('0x2c')],qs[_0xe79b('0x3f')](_0x29394a[_0xe79b('0x2d')][_0xe79b('0x3f')]));_0x4d8151[_0xe79b('0x31')]=_0x4d8151[_0xe79b('0x31')][_0xe79b('0x32')]?_0x4d8151[_0xe79b('0x31')]:_0x1c899f[_0xe79b('0x2c')];if(_0x29394a[_0xe79b('0x2d')]['includeAll']){_0x4d8151[_0xe79b('0x3b')]=[{'all':!![]}];}_0x4d8151=_[_0xe79b('0x38')]({},_0x4d8151,_0x29394a[_0xe79b('0x3a')]);return db['SquareRecording']['find'](_0x4d8151)[_0xe79b('0x21')](handleEntityNotFound(_0x25289d,null))[_0xe79b('0x21')](respondWithResult(_0x25289d,null))[_0xe79b('0x40')](handleError(_0x25289d,null));};exports['create']=function(_0x1bdbe2,_0x56d99d){return db[_0xe79b('0x28')][_0xe79b('0x41')](_0x1bdbe2[_0xe79b('0x42')],{})['then'](respondWithResult(_0x56d99d,0xc9))[_0xe79b('0x40')](handleError(_0x56d99d,null));};exports[_0xe79b('0x43')]=function(_0x5f9c5b,_0x272e65){if(_0x5f9c5b['body']['id']){delete _0x5f9c5b['body']['id'];}return db[_0xe79b('0x28')][_0xe79b('0x44')]({'where':{'id':_0x5f9c5b[_0xe79b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x272e65,null))[_0xe79b('0x21')](saveUpdates(_0x5f9c5b['body'],null))[_0xe79b('0x21')](respondWithResult(_0x272e65,null))[_0xe79b('0x40')](handleError(_0x272e65,null));};exports[_0xe79b('0x45')]=function(_0x402df5,_0x36cc7f,_0x592ad4){var _0x287811=require(_0xe79b('0x46'));var _0x1bdfd6=![];var _0x1e10cd={};if(_0x402df5[_0xe79b('0x2d')][_0xe79b('0x47')]&&_0x402df5['query'][_0xe79b('0x47')]===_0xe79b('0x48')){_0x1e10cd[_0xe79b('0x48')]=_0x402df5[_0xe79b('0x3e')]['id'];}else{_0x1e10cd['id']=_0x402df5[_0xe79b('0x3e')]['id'];}return db[_0xe79b('0x28')]['find']({'where':_0x1e10cd,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0x36cc7f,null))[_0xe79b('0x21')](function(_0x548617){if(_0x548617){var _0xc763a4=_0x548617[_0xe79b('0x49')];var _0x1b5dee=util[_0xe79b('0x4a')](_0xe79b('0x4b'),_0xc763a4);if(fs[_0xe79b('0x4c')](_0x1b5dee)){_0x1bdfd6=!![];return _0x287811['decryptFile'](_0x1b5dee,_0xc763a4,config[_0xe79b('0x4d')][_0xe79b('0x4e')])[_0xe79b('0x21')](function(){return _0x548617;});}return _0x548617;}})['then'](function(_0x234be3){if(_0x234be3){var _0x2654c1=_0x234be3[_0xe79b('0x49')];if(!fs[_0xe79b('0x4c')](_0x2654c1)){throw new db[(_0xe79b('0x4f'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x234be3[_0xe79b('0x50')]){return _0x36cc7f['download'](_0x2654c1,_0x234be3[_0xe79b('0x50')]+path[_0xe79b('0x51')](_0x2654c1),function(){if(_0x1bdfd6){fs['unlink'](_0x2654c1);}});}else{return _0x36cc7f['download'](_0x2654c1,function(_0x5ed999){if(_0x1bdfd6){fs[_0xe79b('0x52')](_0x2654c1);}});}}})[_0xe79b('0x40')](function(_0x24982c){if(_0x24982c[_0xe79b('0x53')]===_0xe79b('0x54')){_0x36cc7f[_0xe79b('0x18')](0x194)[_0xe79b('0x25')](_0xe79b('0x55'));}else{return handleError(_0x36cc7f,null);}});};exports[_0xe79b('0x22')]=function(_0x182c09,_0x1f4627){return db[_0xe79b('0x28')][_0xe79b('0x44')]({'where':{'id':_0x182c09[_0xe79b('0x3e')]['id']}})['then'](function(_0x360a66){if(_['isNil'](_0x360a66)){throw new ReferenceError('Entity\x20not\x20found');}return _0x360a66;})[_0xe79b('0x21')](function(_0x364baa){var _0x2835dc=_0x364baa['savePath'];logger[_0xe79b('0x56')](_0xe79b('0x57'),_0x2835dc);if(!_[_0xe79b('0x58')](_0x364baa[_0xe79b('0x49')])&&fs[_0xe79b('0x4c')](_0x2835dc)){logger['info'](_0xe79b('0x59')+_0x2835dc+_0xe79b('0x5a'));fs['unlinkSync'](_0x2835dc);}_0x2835dc=_0x2835dc+'.cypher';if(!_['isNil'](_0x364baa[_0xe79b('0x49')])&&fs[_0xe79b('0x4c')](_0x2835dc)){logger[_0xe79b('0x56')](_0xe79b('0x59')+_0x2835dc+_0xe79b('0x5a'));fs['unlinkSync'](_0x2835dc);}return _0x364baa;})[_0xe79b('0x21')](function(_0xeaed38){if(!_0xeaed38)throw new InternalError();return _0xeaed38[_0xe79b('0x22')]();})[_0xe79b('0x21')](function(){_0x1f4627['status'](0xcc)[_0xe79b('0x17')]();})[_0xe79b('0x40')](handleError(_0x1f4627,null));}; \ No newline at end of file +var _0xd357=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','includeAll','rows','catch','show','params','keys','include','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','SquareRecording\x20not\x20found','filename','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','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','status','error','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','filters','model','intersection'];(function(_0x319d91,_0x53c827){var _0x57ac2d=function(_0x1470e7){while(--_0x1470e7){_0x319d91['push'](_0x319d91['shift']());}};_0x57ac2d(++_0x53c827);}(_0xd357,0x1ba));var _0x7d35=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd357[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x7d35('0x0'));var rimraf=require(_0x7d35('0x1'));var zipdir=require(_0x7d35('0x2'));var jsonpatch=require(_0x7d35('0x3'));var rp=require(_0x7d35('0x4'));var moment=require(_0x7d35('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d35('0x6'));var path=require('path');var sox=require(_0x7d35('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d35('0x8'));var squel=require('squel');var crypto=require(_0x7d35('0x9'));var jsforce=require(_0x7d35('0xa'));var deskjs=require(_0x7d35('0xb'));var toCsv=require(_0x7d35('0xc'));var querystring=require(_0x7d35('0xd'));var Papa=require(_0x7d35('0xe'));var Redis=require(_0x7d35('0xf'));var authService=require(_0x7d35('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7d35('0x11'));var hardwareService=require(_0x7d35('0x12'));var logger=require(_0x7d35('0x13'))(_0x7d35('0x14'));var utils=require(_0x7d35('0x15'));var config=require(_0x7d35('0x16'));var licenseUtil=require(_0x7d35('0x17'));var db=require(_0x7d35('0x18'))['db'];function respondWithStatusCode(_0x17b7d9,_0x34dcb0){_0x34dcb0=_0x34dcb0||0xcc;return function(_0x369735){if(_0x369735){return _0x17b7d9[_0x7d35('0x19')](_0x34dcb0);}return _0x17b7d9['status'](_0x34dcb0)[_0x7d35('0x1a')]();};}function respondWithResult(_0x32f6d3,_0x3f4eeb){_0x3f4eeb=_0x3f4eeb||0xc8;return function(_0x374764){if(_0x374764){return _0x32f6d3['status'](_0x3f4eeb)[_0x7d35('0x1b')](_0x374764);}};}function respondWithFilteredResult(_0x2857d4,_0x3339ff){return function(_0x2150a9){if(_0x2150a9){var _0x2d526c=typeof _0x3339ff['offset']===_0x7d35('0x1c')&&typeof _0x3339ff[_0x7d35('0x1d')]===_0x7d35('0x1c');var _0x29d4c9=_0x2150a9[_0x7d35('0x1e')];var _0x116b85=_0x2d526c?0x0:_0x3339ff[_0x7d35('0x1f')];var _0xaf6e36=_0x2d526c?_0x2150a9[_0x7d35('0x1e')]:_0x3339ff[_0x7d35('0x1f')]+_0x3339ff[_0x7d35('0x1d')];var _0x5446cf;if(_0xaf6e36>=_0x29d4c9){_0xaf6e36=_0x29d4c9;_0x5446cf=0xc8;}else{_0x5446cf=0xce;}_0x2857d4['status'](_0x5446cf);return _0x2857d4[_0x7d35('0x20')](_0x7d35('0x21'),_0x116b85+'-'+_0xaf6e36+'/'+_0x29d4c9)[_0x7d35('0x1b')](_0x2150a9);}return null;};}function patchUpdates(_0x1c2e9f){return function(_0x284b37){try{jsonpatch['apply'](_0x284b37,_0x1c2e9f,!![]);}catch(_0x4f17aa){return BPromise[_0x7d35('0x22')](_0x4f17aa);}return _0x284b37[_0x7d35('0x23')]();};}function saveUpdates(_0x161bb4,_0x5cae33){return function(_0x12d7f8){if(_0x12d7f8){return _0x12d7f8[_0x7d35('0x24')](_0x161bb4)[_0x7d35('0x25')](function(_0x29909e){return _0x29909e;});}return null;};}function removeEntity(_0x58fc52,_0x33d25b){return function(_0x5b94ae){if(_0x5b94ae){return _0x5b94ae[_0x7d35('0x26')]()[_0x7d35('0x25')](function(){_0x58fc52[_0x7d35('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321cd4,_0x5a2191){return function(_0x4d7bd7){if(!_0x4d7bd7){_0x321cd4[_0x7d35('0x19')](0x194);}return _0x4d7bd7;};}function handleError(_0x47e1b5,_0x575abf){_0x575abf=_0x575abf||0x1f4;return function(_0x4c83aa){logger[_0x7d35('0x28')](_0x4c83aa['stack']);if(_0x4c83aa['name']){delete _0x4c83aa['name'];}_0x47e1b5[_0x7d35('0x27')](_0x575abf)[_0x7d35('0x29')](_0x4c83aa);};}exports[_0x7d35('0x2a')]=function(_0xdc4d66,_0x312ab3){var _0x93b347={},_0x4f837c={},_0x3d8e07={'count':0x0,'rows':[]};var _0x4ff6b5=_[_0x7d35('0x2b')](db[_0x7d35('0x2c')][_0x7d35('0x2d')],function(_0x4e2de9){return{'name':_0x4e2de9[_0x7d35('0x2e')],'type':_0x4e2de9[_0x7d35('0x2f')][_0x7d35('0x30')]};});_0x4f837c['model']=_['map'](_0x4ff6b5,'name');_0x4f837c['query']=_['keys'](_0xdc4d66[_0x7d35('0x31')]);_0x4f837c[_0x7d35('0x32')]=_['intersection'](_0x4f837c[_0x7d35('0x33')],_0x4f837c[_0x7d35('0x31')]);_0x93b347['attributes']=_[_0x7d35('0x34')](_0x4f837c[_0x7d35('0x33')],qs[_0x7d35('0x35')](_0xdc4d66[_0x7d35('0x31')][_0x7d35('0x35')]));_0x93b347[_0x7d35('0x36')]=_0x93b347[_0x7d35('0x36')][_0x7d35('0x37')]?_0x93b347[_0x7d35('0x36')]:_0x4f837c['model'];if(!_0xdc4d66['query'][_0x7d35('0x38')](_0x7d35('0x39'))){_0x93b347[_0x7d35('0x1d')]=qs[_0x7d35('0x1d')](_0xdc4d66[_0x7d35('0x31')][_0x7d35('0x1d')]);_0x93b347[_0x7d35('0x1f')]=qs[_0x7d35('0x1f')](_0xdc4d66[_0x7d35('0x31')][_0x7d35('0x1f')]);}_0x93b347[_0x7d35('0x3a')]=qs[_0x7d35('0x3b')](_0xdc4d66['query'][_0x7d35('0x3b')]);_0x93b347['where']=qs[_0x7d35('0x32')](_[_0x7d35('0x3c')](_0xdc4d66[_0x7d35('0x31')],_0x4f837c[_0x7d35('0x32')]),_0x4ff6b5);if(_0xdc4d66[_0x7d35('0x31')][_0x7d35('0x3d')]){_0x93b347[_0x7d35('0x3e')]=_[_0x7d35('0x3f')](_0x93b347[_0x7d35('0x3e')],{'$or':_[_0x7d35('0x2b')](_0x4ff6b5,function(_0x413288){if(_0x413288['type']!==_0x7d35('0x40')){var _0x46d90e={};_0x46d90e[_0x413288[_0x7d35('0x41')]]={'$like':'%'+_0xdc4d66[_0x7d35('0x31')][_0x7d35('0x3d')]+'%'};return _0x46d90e;}})});}_0x93b347=_[_0x7d35('0x3f')]({},_0x93b347,_0xdc4d66['options']);var _0x5c2c44={'where':_0x93b347[_0x7d35('0x3e')]};return db[_0x7d35('0x2c')][_0x7d35('0x1e')](_0x5c2c44)[_0x7d35('0x25')](function(_0x54c67b){_0x3d8e07['count']=_0x54c67b;if(_0xdc4d66[_0x7d35('0x31')][_0x7d35('0x42')]){_0x93b347['include']=[{'all':!![]}];}return db[_0x7d35('0x2c')]['findAll'](_0x93b347);})[_0x7d35('0x25')](function(_0xfc3daa){_0x3d8e07[_0x7d35('0x43')]=_0xfc3daa;return _0x3d8e07;})[_0x7d35('0x25')](respondWithFilteredResult(_0x312ab3,_0x93b347))[_0x7d35('0x44')](handleError(_0x312ab3,null));};exports[_0x7d35('0x45')]=function(_0xf9a8c2,_0x2549ab){var _0xe62cd3={'raw':!![],'where':{'id':_0xf9a8c2[_0x7d35('0x46')]['id']}},_0x1aa138={};_0x1aa138['model']=_[_0x7d35('0x47')](db[_0x7d35('0x2c')]['rawAttributes']);_0x1aa138[_0x7d35('0x31')]=_['keys'](_0xf9a8c2[_0x7d35('0x31')]);_0x1aa138[_0x7d35('0x32')]=_[_0x7d35('0x34')](_0x1aa138['model'],_0x1aa138[_0x7d35('0x31')]);_0xe62cd3['attributes']=_[_0x7d35('0x34')](_0x1aa138[_0x7d35('0x33')],qs[_0x7d35('0x35')](_0xf9a8c2[_0x7d35('0x31')][_0x7d35('0x35')]));_0xe62cd3[_0x7d35('0x36')]=_0xe62cd3[_0x7d35('0x36')][_0x7d35('0x37')]?_0xe62cd3['attributes']:_0x1aa138['model'];if(_0xf9a8c2[_0x7d35('0x31')]['includeAll']){_0xe62cd3[_0x7d35('0x48')]=[{'all':!![]}];}_0xe62cd3=_[_0x7d35('0x3f')]({},_0xe62cd3,_0xf9a8c2[_0x7d35('0x49')]);return db['SquareRecording'][_0x7d35('0x4a')](_0xe62cd3)[_0x7d35('0x25')](handleEntityNotFound(_0x2549ab,null))[_0x7d35('0x25')](respondWithResult(_0x2549ab,null))['catch'](handleError(_0x2549ab,null));};exports[_0x7d35('0x4b')]=function(_0x4ae0a4,_0x4e54ff){return db['SquareRecording'][_0x7d35('0x4b')](_0x4ae0a4[_0x7d35('0x4c')],{})[_0x7d35('0x25')](respondWithResult(_0x4e54ff,0xc9))[_0x7d35('0x44')](handleError(_0x4e54ff,null));};exports[_0x7d35('0x24')]=function(_0x3b4499,_0x59eded){if(_0x3b4499[_0x7d35('0x4c')]['id']){delete _0x3b4499[_0x7d35('0x4c')]['id'];}return db[_0x7d35('0x2c')][_0x7d35('0x4a')]({'where':{'id':_0x3b4499[_0x7d35('0x46')]['id']}})['then'](handleEntityNotFound(_0x59eded,null))[_0x7d35('0x25')](saveUpdates(_0x3b4499[_0x7d35('0x4c')],null))[_0x7d35('0x25')](respondWithResult(_0x59eded,null))[_0x7d35('0x44')](handleError(_0x59eded,null));};exports[_0x7d35('0x4d')]=function(_0x588dda,_0x53ccce,_0x3288a5){var _0x58f16b=require(_0x7d35('0x4e'));var _0x7a34a3=![];var _0x180443={};if(_0x588dda[_0x7d35('0x31')]['type']&&_0x588dda[_0x7d35('0x31')]['type']===_0x7d35('0x4f')){_0x180443[_0x7d35('0x4f')]=_0x588dda['params']['id'];}else{_0x180443['id']=_0x588dda['params']['id'];}return db['SquareRecording'][_0x7d35('0x4a')]({'where':_0x180443,'attributes':['id',_0x7d35('0x50'),'filename'],'raw':!![]})[_0x7d35('0x25')](handleEntityNotFound(_0x53ccce,null))['then'](function(_0x4e34b3){if(_0x4e34b3){var _0x575f97=_0x4e34b3[_0x7d35('0x50')];var _0x1c00bb=util[_0x7d35('0x51')](_0x7d35('0x52'),_0x575f97);if(fs[_0x7d35('0x53')](_0x1c00bb)){_0x7a34a3=!![];return _0x58f16b[_0x7d35('0x54')](_0x1c00bb,_0x575f97,config[_0x7d35('0x55')][_0x7d35('0x56')])['then'](function(){return _0x4e34b3;});}return _0x4e34b3;}})[_0x7d35('0x25')](function(_0xdef94b){if(_0xdef94b){var _0x449382=_0xdef94b[_0x7d35('0x50')];if(!fs['existsSync'](_0x449382)){throw new db['Sequelize']['ValidationError'](_0x7d35('0x57'));}if(_0xdef94b[_0x7d35('0x58')]){return _0x53ccce[_0x7d35('0x4d')](_0x449382,_0xdef94b['filename']+path['extname'](_0x449382),function(){if(_0x7a34a3){fs['unlink'](_0x449382);}});}else{return _0x53ccce[_0x7d35('0x4d')](_0x449382,function(_0x5efb46){if(_0x7a34a3){fs['unlink'](_0x449382);}});}}})[_0x7d35('0x44')](function(_0x3fc1d8){if(_0x3fc1d8[_0x7d35('0x59')]===_0x7d35('0x57')){_0x53ccce['status'](0x194)[_0x7d35('0x29')](_0x7d35('0x5a'));}else{return handleError(_0x53ccce,null);}});};exports['destroy']=function(_0x397046,_0x339c6d){return db[_0x7d35('0x2c')]['find']({'where':{'id':_0x397046[_0x7d35('0x46')]['id']}})[_0x7d35('0x25')](function(_0x263c35){if(_[_0x7d35('0x5b')](_0x263c35)){throw new ReferenceError(_0x7d35('0x5c'));}return _0x263c35;})[_0x7d35('0x25')](function(_0x3ad659){var _0x529889=_0x3ad659['savePath'];logger[_0x7d35('0x5d')](_0x7d35('0x5e'),_0x529889);if(!_[_0x7d35('0x5b')](_0x3ad659['savePath'])&&fs[_0x7d35('0x53')](_0x529889)){logger[_0x7d35('0x5d')](_0x7d35('0x5f')+_0x529889+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7d35('0x60')](_0x529889);}_0x529889=_0x529889+_0x7d35('0x61');if(!_[_0x7d35('0x5b')](_0x3ad659[_0x7d35('0x50')])&&fs['existsSync'](_0x529889)){logger['info'](_0x7d35('0x5f')+_0x529889+_0x7d35('0x62'));fs['unlinkSync'](_0x529889);}return _0x3ad659;})[_0x7d35('0x25')](function(_0x1d06a7){if(!_0x1d06a7)throw new InternalError();return _0x1d06a7[_0x7d35('0x26')]();})[_0x7d35('0x25')](function(){_0x339c6d['status'](0xcc)['end']();})['catch'](handleError(_0x339c6d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 73bdab0..a56f40d 100644 --- a/server/api/squareRecording/squareRecording.model.js +++ b/server/api/squareRecording/squareRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaaee=['./squareRecording.attributes','exports','define','SquareRecording','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xea1f45,_0x1624b2){var _0x53d97e=function(_0x4c082f){while(--_0x4c082f){_0xea1f45['push'](_0xea1f45['shift']());}};_0x53d97e(++_0x1624b2);}(_0xaaee,0xa9));var _0xeaae=function(_0x1596cd,_0x3d4104){_0x1596cd=_0x1596cd-0x0;var _0x60d890=_0xaaee[_0x1596cd];return _0x60d890;};'use strict';var _=require(_0xeaae('0x0'));var util=require('util');var logger=require(_0xeaae('0x1'))(_0xeaae('0x2'));var moment=require('moment');var BPromise=require(_0xeaae('0x3'));var rp=require(_0xeaae('0x4'));var fs=require('fs');var path=require(_0xeaae('0x5'));var rimraf=require(_0xeaae('0x6'));var config=require('../../config/environment');var attributes=require(_0xeaae('0x7'));module[_0xeaae('0x8')]=function(_0x213422,_0x45c104){return _0x213422[_0xeaae('0x9')](_0xeaae('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83d0=['./squareRecording.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x40ac19,_0x370d3c){var _0x222653=function(_0x2218ac){while(--_0x2218ac){_0x40ac19['push'](_0x40ac19['shift']());}};_0x222653(++_0x370d3c);}(_0x83d0,0xb7));var _0x083d=function(_0x267d02,_0x2fe313){_0x267d02=_0x267d02-0x0;var _0x496157=_0x83d0[_0x267d02];return _0x496157;};'use strict';var _=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var logger=require(_0x083d('0x2'))(_0x083d('0x3'));var moment=require(_0x083d('0x4'));var BPromise=require(_0x083d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x083d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x083d('0x7'));module[_0x083d('0x8')]=function(_0x3c4b8c,_0x2e75e8){return _0x3c4b8c[_0x083d('0x9')]('SquareRecording',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 be613e2..ebec73f 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 _0x728d=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','CreateSquareRecording','SquareRecording','create','body','options'];(function(_0x9e9e71,_0x164667){var _0x44c29b=function(_0x19785c){while(--_0x19785c){_0x9e9e71['push'](_0x9e9e71['shift']());}};_0x44c29b(++_0x164667);}(_0x728d,0x1a5));var _0xd728=function(_0x259e77,_0x52f430){_0x259e77=_0x259e77-0x0;var _0x1f93bd=_0x728d[_0x259e77];return _0x1f93bd;};'use strict';var _=require(_0xd728('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd728('0x1'));var rs=require(_0xd728('0x2'));var fs=require('fs');var Redis=require(_0xd728('0x3'));var db=require(_0xd728('0x4'))['db'];var utils=require(_0xd728('0x5'));var logger=require(_0xd728('0x6'))(_0xd728('0x7'));var config=require(_0xd728('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd728('0x9')][_0xd728('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57117d,_0x24fd1f,_0x39b5da){return new BPromise(function(_0x34be66,_0x21fe1d){return client[_0xd728('0xb')](_0x57117d,_0x39b5da)[_0xd728('0xc')](function(_0x412faa){logger['info'](_0xd728('0xd'),_0x24fd1f,'request\x20sent');logger[_0xd728('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x24fd1f,_0xd728('0xf'),JSON[_0xd728('0x10')](_0x412faa));if(_0x412faa[_0xd728('0x11')]){if(_0x412faa['error'][_0xd728('0x12')]===0x1f4){logger[_0xd728('0x11')](_0xd728('0xd'),_0x24fd1f,_0x412faa[_0xd728('0x11')][_0xd728('0x13')]);return _0x21fe1d(_0x412faa['error'][_0xd728('0x13')]);}logger[_0xd728('0x11')]('SquareRecording,\x20%s,\x20%s',_0x24fd1f,_0x412faa[_0xd728('0x11')]['message']);return _0x34be66(_0x412faa[_0xd728('0x11')][_0xd728('0x13')]);}else{logger[_0xd728('0x14')](_0xd728('0xd'),_0x24fd1f,_0xd728('0xf'));_0x34be66(_0x412faa[_0xd728('0x15')]['message']);}})['catch'](function(_0x348877){logger[_0xd728('0x11')](_0xd728('0xd'),_0x24fd1f,_0x348877);_0x21fe1d(_0x348877);});});}exports[_0xd728('0x16')]=function(_0x228aa8){var _0x4394e1=this;return new Promise(function(_0x2ef13a,_0x1d9f92){return db[_0xd728('0x17')][_0xd728('0x18')](_0x228aa8[_0xd728('0x19')],{'raw':_0x228aa8['options']?_0x228aa8[_0xd728('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4abfe6){logger[_0xd728('0x14')]('CreateSquareRecording',_0x228aa8);logger[_0xd728('0xe')](_0xd728('0x16'),_0x228aa8,JSON['stringify'](_0x4abfe6));_0x2ef13a(_0x4abfe6);})[_0xd728('0x1b')](function(_0x2da3a8){logger[_0xd728('0x11')](_0xd728('0x16'),_0x2da3a8[_0xd728('0x13')],_0x228aa8);_0x1d9f92(_0x4394e1[_0xd728('0x11')](0x1f4,_0x2da3a8[_0xd728('0x13')]));});});}; \ No newline at end of file +var _0xef3c=['create','body','options','raw','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareRecording,\x20%s,\x20%s','message','CreateSquareRecording','SquareRecording'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xef3c,0x10b));var _0xcef3=function(_0x1de36c,_0x48fa13){_0x1de36c=_0x1de36c-0x0;var _0x147d48=_0xef3c[_0x1de36c];return _0x147d48;};'use strict';var _=require(_0xcef3('0x0'));var util=require(_0xcef3('0x1'));var moment=require(_0xcef3('0x2'));var BPromise=require(_0xcef3('0x3'));var rs=require(_0xcef3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcef3('0x5'))['db'];var utils=require(_0xcef3('0x6'));var logger=require('../../config/logger')(_0xcef3('0x7'));var config=require(_0xcef3('0x8'));var jayson=require(_0xcef3('0x9'));var client=jayson[_0xcef3('0xa')][_0xcef3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x298d66,_0x100dca,_0x460dc4){return new BPromise(function(_0x711901,_0x566b71){return client[_0xcef3('0xc')](_0x298d66,_0x460dc4)[_0xcef3('0xd')](function(_0x4a29a8){logger[_0xcef3('0xe')]('SquareRecording,\x20%s,\x20%s',_0x100dca,'request\x20sent');logger['debug'](_0xcef3('0xf'),_0x100dca,_0xcef3('0x10'),JSON['stringify'](_0x4a29a8));if(_0x4a29a8[_0xcef3('0x11')]){if(_0x4a29a8[_0xcef3('0x11')][_0xcef3('0x12')]===0x1f4){logger[_0xcef3('0x11')](_0xcef3('0x13'),_0x100dca,_0x4a29a8[_0xcef3('0x11')][_0xcef3('0x14')]);return _0x566b71(_0x4a29a8[_0xcef3('0x11')][_0xcef3('0x14')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x100dca,_0x4a29a8['error']['message']);return _0x711901(_0x4a29a8[_0xcef3('0x11')][_0xcef3('0x14')]);}else{logger[_0xcef3('0xe')](_0xcef3('0x13'),_0x100dca,_0xcef3('0x10'));_0x711901(_0x4a29a8['result'][_0xcef3('0x14')]);}})['catch'](function(_0x2d84b5){logger[_0xcef3('0x11')]('SquareRecording,\x20%s,\x20%s',_0x100dca,_0x2d84b5);_0x566b71(_0x2d84b5);});});}exports[_0xcef3('0x15')]=function(_0x2c82d4){var _0x5620d2=this;return new Promise(function(_0x48f458,_0xe2152c){return db[_0xcef3('0x16')][_0xcef3('0x17')](_0x2c82d4[_0xcef3('0x18')],{'raw':_0x2c82d4['options']?_0x2c82d4[_0xcef3('0x19')][_0xcef3('0x1a')]===undefined?!![]:![]:!![]})[_0xcef3('0xd')](function(_0x55caec){logger[_0xcef3('0xe')]('CreateSquareRecording',_0x2c82d4);logger['debug'](_0xcef3('0x15'),_0x2c82d4,JSON[_0xcef3('0x1b')](_0x55caec));_0x48f458(_0x55caec);})[_0xcef3('0x1c')](function(_0x48941c){logger['error']('CreateSquareRecording',_0x48941c['message'],_0x2c82d4);_0xe2152c(_0x5620d2['error'](0x1f4,_0x48941c[_0xcef3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index a38f097..98844ee 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x59cac8,_0xa09b00){var _0x2243e8=function(_0x44d90a){while(--_0x44d90a){_0x59cac8['push'](_0x59cac8['shift']());}};_0x2243e8(++_0xa09b00);}(_0xe706,0xa3));var _0x6e70=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0xe706[_0x439d59];return _0x3670c7;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x2ae448,_0x314451){var _0x5ea854=function(_0x1d8c9e){while(--_0x1d8c9e){_0x2ae448['push'](_0x2ae448['shift']());}};_0x5ea854(++_0x314451);}(_0xe706,0xa3));var _0x6e70=function(_0xbf1132,_0x176b34){_0xbf1132=_0xbf1132-0x0;var _0xe63ce4=_0xe706[_0xbf1132];return _0xe63ce4;};'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 450b66a..2781d7a 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 _0xd883=['exports','STRING','DATE','sequelize'];(function(_0x43f4d7,_0x58c738){var _0x47948f=function(_0x1f84b3){while(--_0x1f84b3){_0x43f4d7['push'](_0x43f4d7['shift']());}};_0x47948f(++_0x58c738);}(_0xd883,0xbf));var _0x3d88=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xd883[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x3d88('0x0'));module[_0x3d88('0x1')]={'network':{'type':Sequelize[_0x3d88('0x2')]},'network_script':{'type':Sequelize[_0x3d88('0x2')]},'request':{'type':Sequelize[_0x3d88('0x2')]},'channel':{'type':Sequelize[_0x3d88('0x2')]},'language':{'type':Sequelize[_0x3d88('0x2')]},'type':{'type':Sequelize[_0x3d88('0x2')]},'uniqueid':{'type':Sequelize[_0x3d88('0x2')]},'version':{'type':Sequelize[_0x3d88('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3d88('0x2')]},'callingpres':{'type':Sequelize[_0x3d88('0x2')]},'callingani2':{'type':Sequelize[_0x3d88('0x2')]},'callington':{'type':Sequelize[_0x3d88('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x3d88('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3d88('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3d88('0x2')]},'enhanced':{'type':Sequelize[_0x3d88('0x2')]},'accountcode':{'type':Sequelize[_0x3d88('0x2')]},'threadid':{'type':Sequelize[_0x3d88('0x2')]},'project_name':{'type':Sequelize[_0x3d88('0x2')]},'joinAt':{'type':Sequelize[_0x3d88('0x3')]},'leaveAt':{'type':Sequelize[_0x3d88('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xadea=['STRING','DATE','BOOLEAN','exports'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0xadea,0x163));var _0xaade=function(_0x3d7595,_0x23bf60){_0x3d7595=_0x3d7595-0x0;var _0x163d06=_0xadea[_0x3d7595];return _0x163d06;};'use strict';var Sequelize=require('sequelize');module[_0xaade('0x0')]={'network':{'type':Sequelize[_0xaade('0x1')]},'network_script':{'type':Sequelize[_0xaade('0x1')]},'request':{'type':Sequelize[_0xaade('0x1')]},'channel':{'type':Sequelize[_0xaade('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xaade('0x1')]},'version':{'type':Sequelize[_0xaade('0x1')]},'callerid':{'type':Sequelize[_0xaade('0x1')]},'calleridname':{'type':Sequelize[_0xaade('0x1')]},'callingpres':{'type':Sequelize[_0xaade('0x1')]},'callingani2':{'type':Sequelize[_0xaade('0x1')]},'callington':{'type':Sequelize[_0xaade('0x1')]},'callingtns':{'type':Sequelize[_0xaade('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaade('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xaade('0x1')]},'enhanced':{'type':Sequelize[_0xaade('0x1')]},'accountcode':{'type':Sequelize[_0xaade('0x1')]},'threadid':{'type':Sequelize[_0xaade('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xaade('0x2')]},'bot':{'type':Sequelize[_0xaade('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index b0ecea3..01123e3 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 _0xb759=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','SquareReport','includeAll','findAll','show','catch','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb759,0x17f));var _0x9b75=function(_0x258f97,_0x4dffa6){_0x258f97=_0x258f97-0x0;var _0x120c73=_0xb759[_0x258f97];return _0x120c73;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b75('0x0'));var zipdir=require(_0x9b75('0x1'));var jsonpatch=require(_0x9b75('0x2'));var rp=require(_0x9b75('0x3'));var moment=require(_0x9b75('0x4'));var BPromise=require(_0x9b75('0x5'));var Mustache=require(_0x9b75('0x6'));var util=require(_0x9b75('0x7'));var path=require(_0x9b75('0x8'));var sox=require(_0x9b75('0x9'));var csv=require(_0x9b75('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9b75('0xb'));var _=require(_0x9b75('0xc'));var squel=require('squel');var crypto=require(_0x9b75('0xd'));var jsforce=require(_0x9b75('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9b75('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9b75('0xf'));var authService=require(_0x9b75('0x10'));var qs=require(_0x9b75('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b75('0x12'));var logger=require('../../config/logger')(_0x9b75('0x13'));var utils=require(_0x9b75('0x14'));var config=require(_0x9b75('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6f2231,_0x5aefc6){_0x5aefc6=_0x5aefc6||0xcc;return function(_0x297acc){if(_0x297acc){return _0x6f2231['sendStatus'](_0x5aefc6);}return _0x6f2231[_0x9b75('0x16')](_0x5aefc6)[_0x9b75('0x17')]();};}function respondWithResult(_0x4efc33,_0x1bfcd3){_0x1bfcd3=_0x1bfcd3||0xc8;return function(_0x1e4562){if(_0x1e4562){return _0x4efc33[_0x9b75('0x16')](_0x1bfcd3)[_0x9b75('0x18')](_0x1e4562);}};}function respondWithFilteredResult(_0x16a15f,_0x2c3559){return function(_0x28744c){if(_0x28744c){var _0x3308e8=typeof _0x2c3559[_0x9b75('0x19')]==='undefined'&&typeof _0x2c3559[_0x9b75('0x1a')]===_0x9b75('0x1b');var _0x408dbc=_0x28744c[_0x9b75('0x1c')];var _0x45383b=_0x3308e8?0x0:_0x2c3559[_0x9b75('0x19')];var _0x2434f0=_0x3308e8?_0x28744c[_0x9b75('0x1c')]:_0x2c3559['offset']+_0x2c3559['limit'];var _0x5d4a7a;if(_0x2434f0>=_0x408dbc){_0x2434f0=_0x408dbc;_0x5d4a7a=0xc8;}else{_0x5d4a7a=0xce;}_0x16a15f[_0x9b75('0x16')](_0x5d4a7a);return _0x16a15f[_0x9b75('0x1d')](_0x9b75('0x1e'),_0x45383b+'-'+_0x2434f0+'/'+_0x408dbc)[_0x9b75('0x18')](_0x28744c);}return null;};}function patchUpdates(_0xa019ea){return function(_0x39f39a){try{jsonpatch[_0x9b75('0x1f')](_0x39f39a,_0xa019ea,!![]);}catch(_0x563f62){return BPromise[_0x9b75('0x20')](_0x563f62);}return _0x39f39a['save']();};}function saveUpdates(_0x2dd1f3,_0x396979){return function(_0x1116b7){if(_0x1116b7){return _0x1116b7[_0x9b75('0x21')](_0x2dd1f3)[_0x9b75('0x22')](function(_0x147389){return _0x147389;});}return null;};}function removeEntity(_0x1c9995,_0x14f3d8){return function(_0x243429){if(_0x243429){return _0x243429[_0x9b75('0x23')]()[_0x9b75('0x22')](function(){_0x1c9995['status'](0xcc)[_0x9b75('0x17')]();});}};}function handleEntityNotFound(_0x574556,_0x501263){return function(_0xb4918a){if(!_0xb4918a){_0x574556['sendStatus'](0x194);}return _0xb4918a;};}function handleError(_0x77205f,_0x4d70e6){_0x4d70e6=_0x4d70e6||0x1f4;return function(_0x332f66){logger['error'](_0x332f66['stack']);if(_0x332f66[_0x9b75('0x24')]){delete _0x332f66['name'];}_0x77205f[_0x9b75('0x16')](_0x4d70e6)[_0x9b75('0x25')](_0x332f66);};}exports[_0x9b75('0x26')]=function(_0x3e2f2d,_0x5f19e9){var _0x15ada2={},_0x5b7f40={},_0x4b628d={'count':0x0,'rows':[]};var _0x5afde6=_[_0x9b75('0x27')](db['SquareReport'][_0x9b75('0x28')],function(_0x2e3965){return{'name':_0x2e3965[_0x9b75('0x29')],'type':_0x2e3965[_0x9b75('0x2a')][_0x9b75('0x2b')]};});_0x5b7f40[_0x9b75('0x2c')]=_[_0x9b75('0x27')](_0x5afde6,_0x9b75('0x24'));_0x5b7f40[_0x9b75('0x2d')]=_[_0x9b75('0x2e')](_0x3e2f2d[_0x9b75('0x2d')]);_0x5b7f40[_0x9b75('0x2f')]=_[_0x9b75('0x30')](_0x5b7f40[_0x9b75('0x2c')],_0x5b7f40['query']);_0x15ada2[_0x9b75('0x31')]=_[_0x9b75('0x30')](_0x5b7f40[_0x9b75('0x2c')],qs[_0x9b75('0x32')](_0x3e2f2d['query']['fields']));_0x15ada2[_0x9b75('0x31')]=_0x15ada2[_0x9b75('0x31')][_0x9b75('0x33')]?_0x15ada2[_0x9b75('0x31')]:_0x5b7f40[_0x9b75('0x2c')];if(!_0x3e2f2d[_0x9b75('0x2d')][_0x9b75('0x34')](_0x9b75('0x35'))){_0x15ada2[_0x9b75('0x1a')]=qs[_0x9b75('0x1a')](_0x3e2f2d[_0x9b75('0x2d')][_0x9b75('0x1a')]);_0x15ada2[_0x9b75('0x19')]=qs[_0x9b75('0x19')](_0x3e2f2d['query'][_0x9b75('0x19')]);}_0x15ada2[_0x9b75('0x36')]=qs[_0x9b75('0x37')](_0x3e2f2d[_0x9b75('0x2d')][_0x9b75('0x37')]);_0x15ada2['where']=qs['filters'](_['pick'](_0x3e2f2d[_0x9b75('0x2d')],_0x5b7f40[_0x9b75('0x2f')]),_0x5afde6);if(_0x3e2f2d['query'][_0x9b75('0x38')]){_0x15ada2[_0x9b75('0x39')]=_[_0x9b75('0x3a')](_0x15ada2[_0x9b75('0x39')],{'$or':_[_0x9b75('0x27')](_0x5afde6,function(_0x1ceba3){if(_0x1ceba3[_0x9b75('0x2a')]!==_0x9b75('0x3b')){var _0x39819b={};_0x39819b[_0x1ceba3['name']]={'$like':'%'+_0x3e2f2d[_0x9b75('0x2d')][_0x9b75('0x38')]+'%'};return _0x39819b;}})});}_0x15ada2=_[_0x9b75('0x3a')]({},_0x15ada2,_0x3e2f2d[_0x9b75('0x3c')]);var _0x188dc5={'where':_0x15ada2[_0x9b75('0x39')]};return db[_0x9b75('0x3d')][_0x9b75('0x1c')](_0x188dc5)[_0x9b75('0x22')](function(_0x5aa3f9){_0x4b628d[_0x9b75('0x1c')]=_0x5aa3f9;if(_0x3e2f2d[_0x9b75('0x2d')][_0x9b75('0x3e')]){_0x15ada2['include']=[{'all':!![]}];}return db[_0x9b75('0x3d')][_0x9b75('0x3f')](_0x15ada2);})[_0x9b75('0x22')](function(_0x1d0a1c){_0x4b628d['rows']=_0x1d0a1c;return _0x4b628d;})[_0x9b75('0x22')](respondWithFilteredResult(_0x5f19e9,_0x15ada2))['catch'](handleError(_0x5f19e9,null));};exports[_0x9b75('0x40')]=function(_0x37bc94,_0x4e693a){var _0x17f8b0={'raw':!![],'where':{'id':_0x37bc94['params']['id']}},_0x2bb0f8={};_0x2bb0f8[_0x9b75('0x2c')]=_[_0x9b75('0x2e')](db[_0x9b75('0x3d')][_0x9b75('0x28')]);_0x2bb0f8[_0x9b75('0x2d')]=_['keys'](_0x37bc94[_0x9b75('0x2d')]);_0x2bb0f8[_0x9b75('0x2f')]=_[_0x9b75('0x30')](_0x2bb0f8['model'],_0x2bb0f8[_0x9b75('0x2d')]);_0x17f8b0[_0x9b75('0x31')]=_[_0x9b75('0x30')](_0x2bb0f8[_0x9b75('0x2c')],qs['fields'](_0x37bc94[_0x9b75('0x2d')][_0x9b75('0x32')]));_0x17f8b0[_0x9b75('0x31')]=_0x17f8b0['attributes'][_0x9b75('0x33')]?_0x17f8b0['attributes']:_0x2bb0f8['model'];if(_0x37bc94[_0x9b75('0x2d')][_0x9b75('0x3e')]){_0x17f8b0['include']=[{'all':!![]}];}_0x17f8b0=_[_0x9b75('0x3a')]({},_0x17f8b0,_0x37bc94[_0x9b75('0x3c')]);return db[_0x9b75('0x3d')]['find'](_0x17f8b0)[_0x9b75('0x22')](handleEntityNotFound(_0x4e693a,null))[_0x9b75('0x22')](respondWithResult(_0x4e693a,null))[_0x9b75('0x41')](handleError(_0x4e693a,null));};exports[_0x9b75('0x42')]=function(_0x30675e,_0x57e335){return db[_0x9b75('0x3d')]['create'](_0x30675e[_0x9b75('0x43')],{})[_0x9b75('0x22')](respondWithResult(_0x57e335,0xc9))['catch'](handleError(_0x57e335,null));};exports['update']=function(_0x1631aa,_0x183e39){if(_0x1631aa[_0x9b75('0x43')]['id']){delete _0x1631aa['body']['id'];}return db['SquareReport'][_0x9b75('0x44')]({'where':{'id':_0x1631aa[_0x9b75('0x45')]['id']}})[_0x9b75('0x22')](handleEntityNotFound(_0x183e39,null))[_0x9b75('0x22')](saveUpdates(_0x1631aa[_0x9b75('0x43')],null))[_0x9b75('0x22')](respondWithResult(_0x183e39,null))[_0x9b75('0x41')](handleError(_0x183e39,null));};exports['destroy']=function(_0x5b159a,_0x4ffdf7){return db['SquareReport'][_0x9b75('0x44')]({'where':{'id':_0x5b159a['params']['id']}})['then'](handleEntityNotFound(_0x4ffdf7,null))['then'](removeEntity(_0x4ffdf7,null))[_0x9b75('0x41')](handleError(_0x4ffdf7,null));};exports[_0x9b75('0x46')]=function(_0x3c1d76,_0x93b303){return db[_0x9b75('0x3d')]['describe']()[_0x9b75('0x22')](respondWithResult(_0x93b303,null))[_0x9b75('0x41')](handleError(_0x93b303,null));}; \ No newline at end of file +var _0x0cbf=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','end','offset','undefined','limit','count','status','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','index','SquareReport','fieldName','key','model','filters','intersection','query','fields','length','attributes','nolimit','order','sort','pick','filter','merge','where','map','type','VIRTUAL','includeAll','include','findAll','rows','show','keys','rawAttributes','options','find','catch','create','body','params','describe','eml-format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0cbf,0xe3));var _0xf0cb=function(_0x5d8dba,_0x39b4b9){_0x5d8dba=_0x5d8dba-0x0;var _0x4f7640=_0x0cbf[_0x5d8dba];return _0x4f7640;};'use strict';var emlformat=require(_0xf0cb('0x0'));var rimraf=require(_0xf0cb('0x1'));var zipdir=require(_0xf0cb('0x2'));var jsonpatch=require(_0xf0cb('0x3'));var rp=require('request-promise');var moment=require(_0xf0cb('0x4'));var BPromise=require(_0xf0cb('0x5'));var Mustache=require(_0xf0cb('0x6'));var util=require(_0xf0cb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf0cb('0x8'));var ejs=require(_0xf0cb('0x9'));var fs=require('fs');var fs_extra=require(_0xf0cb('0xa'));var _=require(_0xf0cb('0xb'));var squel=require(_0xf0cb('0xc'));var crypto=require(_0xf0cb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf0cb('0xe'));var toCsv=require(_0xf0cb('0x8'));var querystring=require('querystring');var Papa=require(_0xf0cb('0xf'));var Redis=require(_0xf0cb('0x10'));var authService=require(_0xf0cb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf0cb('0x12'));var hardwareService=require(_0xf0cb('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf0cb('0x14'));var config=require(_0xf0cb('0x15'));var licenseUtil=require(_0xf0cb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x167ef4,_0x4099fa){_0x4099fa=_0x4099fa||0xcc;return function(_0x563aeb){if(_0x563aeb){return _0x167ef4['sendStatus'](_0x4099fa);}return _0x167ef4['status'](_0x4099fa)[_0xf0cb('0x17')]();};}function respondWithResult(_0xce440c,_0x3da4b4){_0x3da4b4=_0x3da4b4||0xc8;return function(_0x53bdd0){if(_0x53bdd0){return _0xce440c['status'](_0x3da4b4)['json'](_0x53bdd0);}};}function respondWithFilteredResult(_0x38926e,_0x55cbbe){return function(_0x2f1bb3){if(_0x2f1bb3){var _0x349ec4=typeof _0x55cbbe[_0xf0cb('0x18')]===_0xf0cb('0x19')&&typeof _0x55cbbe[_0xf0cb('0x1a')]===_0xf0cb('0x19');var _0x233cff=_0x2f1bb3['count'];var _0x671d=_0x349ec4?0x0:_0x55cbbe[_0xf0cb('0x18')];var _0x205347=_0x349ec4?_0x2f1bb3[_0xf0cb('0x1b')]:_0x55cbbe[_0xf0cb('0x18')]+_0x55cbbe[_0xf0cb('0x1a')];var _0x217bb1;if(_0x205347>=_0x233cff){_0x205347=_0x233cff;_0x217bb1=0xc8;}else{_0x217bb1=0xce;}_0x38926e[_0xf0cb('0x1c')](_0x217bb1);return _0x38926e[_0xf0cb('0x1d')](_0xf0cb('0x1e'),_0x671d+'-'+_0x205347+'/'+_0x233cff)[_0xf0cb('0x1f')](_0x2f1bb3);}return null;};}function patchUpdates(_0x4d5c68){return function(_0x5f3946){try{jsonpatch['apply'](_0x5f3946,_0x4d5c68,!![]);}catch(_0x410ae1){return BPromise[_0xf0cb('0x20')](_0x410ae1);}return _0x5f3946[_0xf0cb('0x21')]();};}function saveUpdates(_0x830b7f,_0x74dad7){return function(_0x32a2b3){if(_0x32a2b3){return _0x32a2b3[_0xf0cb('0x22')](_0x830b7f)[_0xf0cb('0x23')](function(_0x2813b6){return _0x2813b6;});}return null;};}function removeEntity(_0x583e6f,_0x3a745c){return function(_0xcb556d){if(_0xcb556d){return _0xcb556d[_0xf0cb('0x24')]()[_0xf0cb('0x23')](function(){_0x583e6f[_0xf0cb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54b4a2,_0x41197e){return function(_0x1aa1fb){if(!_0x1aa1fb){_0x54b4a2[_0xf0cb('0x25')](0x194);}return _0x1aa1fb;};}function handleError(_0x35693c,_0x4ca6fd){_0x4ca6fd=_0x4ca6fd||0x1f4;return function(_0x471dae){logger[_0xf0cb('0x26')](_0x471dae[_0xf0cb('0x27')]);if(_0x471dae[_0xf0cb('0x28')]){delete _0x471dae['name'];}_0x35693c[_0xf0cb('0x1c')](_0x4ca6fd)['send'](_0x471dae);};}exports[_0xf0cb('0x29')]=function(_0x378738,_0x5eeaf3){var _0x2b7af7={},_0x3be01b={},_0xfd7b4a={'count':0x0,'rows':[]};var _0x437e08=_['map'](db[_0xf0cb('0x2a')]['rawAttributes'],function(_0x2de270){return{'name':_0x2de270[_0xf0cb('0x2b')],'type':_0x2de270['type'][_0xf0cb('0x2c')]};});_0x3be01b[_0xf0cb('0x2d')]=_['map'](_0x437e08,_0xf0cb('0x28'));_0x3be01b['query']=_['keys'](_0x378738['query']);_0x3be01b[_0xf0cb('0x2e')]=_[_0xf0cb('0x2f')](_0x3be01b[_0xf0cb('0x2d')],_0x3be01b[_0xf0cb('0x30')]);_0x2b7af7['attributes']=_[_0xf0cb('0x2f')](_0x3be01b[_0xf0cb('0x2d')],qs['fields'](_0x378738[_0xf0cb('0x30')][_0xf0cb('0x31')]));_0x2b7af7['attributes']=_0x2b7af7['attributes'][_0xf0cb('0x32')]?_0x2b7af7[_0xf0cb('0x33')]:_0x3be01b[_0xf0cb('0x2d')];if(!_0x378738[_0xf0cb('0x30')]['hasOwnProperty'](_0xf0cb('0x34'))){_0x2b7af7[_0xf0cb('0x1a')]=qs[_0xf0cb('0x1a')](_0x378738[_0xf0cb('0x30')][_0xf0cb('0x1a')]);_0x2b7af7[_0xf0cb('0x18')]=qs[_0xf0cb('0x18')](_0x378738[_0xf0cb('0x30')][_0xf0cb('0x18')]);}_0x2b7af7[_0xf0cb('0x35')]=qs[_0xf0cb('0x36')](_0x378738[_0xf0cb('0x30')][_0xf0cb('0x36')]);_0x2b7af7['where']=qs[_0xf0cb('0x2e')](_[_0xf0cb('0x37')](_0x378738['query'],_0x3be01b['filters']),_0x437e08);if(_0x378738[_0xf0cb('0x30')][_0xf0cb('0x38')]){_0x2b7af7['where']=_[_0xf0cb('0x39')](_0x2b7af7[_0xf0cb('0x3a')],{'$or':_[_0xf0cb('0x3b')](_0x437e08,function(_0xebfce9){if(_0xebfce9[_0xf0cb('0x3c')]!==_0xf0cb('0x3d')){var _0x37c9f1={};_0x37c9f1[_0xebfce9[_0xf0cb('0x28')]]={'$like':'%'+_0x378738['query']['filter']+'%'};return _0x37c9f1;}})});}_0x2b7af7=_[_0xf0cb('0x39')]({},_0x2b7af7,_0x378738['options']);var _0x43fbfe={'where':_0x2b7af7[_0xf0cb('0x3a')]};return db[_0xf0cb('0x2a')]['count'](_0x43fbfe)[_0xf0cb('0x23')](function(_0x13bf51){_0xfd7b4a[_0xf0cb('0x1b')]=_0x13bf51;if(_0x378738[_0xf0cb('0x30')][_0xf0cb('0x3e')]){_0x2b7af7[_0xf0cb('0x3f')]=[{'all':!![]}];}return db[_0xf0cb('0x2a')][_0xf0cb('0x40')](_0x2b7af7);})[_0xf0cb('0x23')](function(_0x16e4c5){_0xfd7b4a[_0xf0cb('0x41')]=_0x16e4c5;return _0xfd7b4a;})[_0xf0cb('0x23')](respondWithFilteredResult(_0x5eeaf3,_0x2b7af7))['catch'](handleError(_0x5eeaf3,null));};exports[_0xf0cb('0x42')]=function(_0xcb4ca2,_0x4fdcba){var _0x66353d={'raw':!![],'where':{'id':_0xcb4ca2['params']['id']}},_0x142c96={};_0x142c96[_0xf0cb('0x2d')]=_[_0xf0cb('0x43')](db[_0xf0cb('0x2a')][_0xf0cb('0x44')]);_0x142c96[_0xf0cb('0x30')]=_[_0xf0cb('0x43')](_0xcb4ca2['query']);_0x142c96[_0xf0cb('0x2e')]=_[_0xf0cb('0x2f')](_0x142c96[_0xf0cb('0x2d')],_0x142c96[_0xf0cb('0x30')]);_0x66353d[_0xf0cb('0x33')]=_[_0xf0cb('0x2f')](_0x142c96[_0xf0cb('0x2d')],qs[_0xf0cb('0x31')](_0xcb4ca2[_0xf0cb('0x30')][_0xf0cb('0x31')]));_0x66353d[_0xf0cb('0x33')]=_0x66353d['attributes']['length']?_0x66353d[_0xf0cb('0x33')]:_0x142c96[_0xf0cb('0x2d')];if(_0xcb4ca2['query']['includeAll']){_0x66353d[_0xf0cb('0x3f')]=[{'all':!![]}];}_0x66353d=_[_0xf0cb('0x39')]({},_0x66353d,_0xcb4ca2[_0xf0cb('0x45')]);return db[_0xf0cb('0x2a')][_0xf0cb('0x46')](_0x66353d)[_0xf0cb('0x23')](handleEntityNotFound(_0x4fdcba,null))[_0xf0cb('0x23')](respondWithResult(_0x4fdcba,null))[_0xf0cb('0x47')](handleError(_0x4fdcba,null));};exports[_0xf0cb('0x48')]=function(_0x3630ce,_0x3bfe61){return db[_0xf0cb('0x2a')][_0xf0cb('0x48')](_0x3630ce['body'],{})[_0xf0cb('0x23')](respondWithResult(_0x3bfe61,0xc9))[_0xf0cb('0x47')](handleError(_0x3bfe61,null));};exports[_0xf0cb('0x22')]=function(_0x51ecb6,_0x395d25){if(_0x51ecb6[_0xf0cb('0x49')]['id']){delete _0x51ecb6[_0xf0cb('0x49')]['id'];}return db[_0xf0cb('0x2a')]['find']({'where':{'id':_0x51ecb6[_0xf0cb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x395d25,null))[_0xf0cb('0x23')](saveUpdates(_0x51ecb6[_0xf0cb('0x49')],null))['then'](respondWithResult(_0x395d25,null))[_0xf0cb('0x47')](handleError(_0x395d25,null));};exports[_0xf0cb('0x24')]=function(_0x1a26f1,_0x4d7823){return db[_0xf0cb('0x2a')]['find']({'where':{'id':_0x1a26f1[_0xf0cb('0x4a')]['id']}})[_0xf0cb('0x23')](handleEntityNotFound(_0x4d7823,null))[_0xf0cb('0x23')](removeEntity(_0x4d7823,null))[_0xf0cb('0x47')](handleError(_0x4d7823,null));};exports[_0xf0cb('0x4b')]=function(_0x1c7471,_0x2b43d7){return db['SquareReport'][_0xf0cb('0x4b')]()[_0xf0cb('0x23')](respondWithResult(_0x2b43d7,null))[_0xf0cb('0x47')](handleError(_0x2b43d7,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 6ac6b14..eada0e7 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 _0xa6cc=['project_name','leaveAt','lodash','api','bluebird','path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x3d1244,_0x156028){var _0x5d6372=function(_0x509c76){while(--_0x509c76){_0x3d1244['push'](_0x3d1244['shift']());}};_0x5d6372(++_0x156028);}(_0xa6cc,0x72));var _0xca6c=function(_0x41fe02,_0x20a2a6){_0x41fe02=_0x41fe02-0x0;var _0x5e97eb=_0xa6cc[_0x41fe02];return _0x5e97eb;};'use strict';var _=require(_0xca6c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xca6c('0x1'));var moment=require('moment');var BPromise=require(_0xca6c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca6c('0x3'));var rimraf=require(_0xca6c('0x4'));var config=require('../../config/environment');var attributes=require(_0xca6c('0x5'));module[_0xca6c('0x6')]=function(_0x399c3a,_0x14c9e4){return _0x399c3a[_0xca6c('0x7')](_0xca6c('0x8'),attributes,{'tableName':_0xca6c('0x9'),'paranoid':![],'indexes':[{'name':_0xca6c('0xa'),'fields':[_0xca6c('0xb'),_0xca6c('0xc')]},{'name':_0xca6c('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d3c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x408916,_0x42e608){var _0x2c3ab2=function(_0x37e774){while(--_0x37e774){_0x408916['push'](_0x408916['shift']());}};_0x2c3ab2(++_0x42e608);}(_0x0d3c,0xdd));var _0xc0d3=function(_0x35498a,_0x4c5f60){_0x35498a=_0x35498a-0x0;var _0x419121=_0x0d3c[_0x35498a];return _0x419121;};'use strict';var _=require(_0xc0d3('0x0'));var util=require(_0xc0d3('0x1'));var logger=require(_0xc0d3('0x2'))(_0xc0d3('0x3'));var moment=require(_0xc0d3('0x4'));var BPromise=require(_0xc0d3('0x5'));var rp=require(_0xc0d3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0d3('0x7'));var config=require(_0xc0d3('0x8'));var attributes=require('./squareReport.attributes');module[_0xc0d3('0x9')]=function(_0x3296ee,_0x271e36){return _0x3296ee[_0xc0d3('0xa')](_0xc0d3('0xb'),attributes,{'tableName':_0xc0d3('0xc'),'paranoid':![],'indexes':[{'name':_0xc0d3('0xd'),'fields':['uniqueid',_0xc0d3('0xe')]},{'name':_0xc0d3('0xf'),'fields':[_0xc0d3('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index ec6e89f..4008e5b 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 _0x4025=['SquareReport','body','options','raw','UpdateSquareReport','attributes','limit','util','ioredis','../../config/logger','rpc','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'];(function(_0x2914ad,_0x361c7e){var _0x4258b2=function(_0x1f3479){while(--_0x1f3479){_0x2914ad['push'](_0x2914ad['shift']());}};_0x4258b2(++_0x361c7e);}(_0x4025,0x77));var _0x5402=function(_0x2b3bf6,_0x3b7adf){_0x2b3bf6=_0x2b3bf6-0x0;var _0x3980ef=_0x4025[_0x2b3bf6];return _0x3980ef;};'use strict';var _=require('lodash');var util=require(_0x5402('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5402('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5402('0x2'))(_0x5402('0x3'));var config=require('../../config/environment');var jayson=require(_0x5402('0x4'));var client=jayson[_0x5402('0x5')][_0x5402('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x88472c,_0x13d2ee,_0x1dc6d5){return new BPromise(function(_0x473bc9,_0x37eb00){return client[_0x5402('0x7')](_0x88472c,_0x1dc6d5)[_0x5402('0x8')](function(_0x4b9bf5){logger[_0x5402('0x9')](_0x5402('0xa'),_0x13d2ee,_0x5402('0xb'));logger[_0x5402('0xc')](_0x5402('0xd'),_0x13d2ee,'request\x20sent',JSON[_0x5402('0xe')](_0x4b9bf5));if(_0x4b9bf5[_0x5402('0xf')]){if(_0x4b9bf5[_0x5402('0xf')][_0x5402('0x10')]===0x1f4){logger[_0x5402('0xf')]('SquareReport,\x20%s,\x20%s',_0x13d2ee,_0x4b9bf5[_0x5402('0xf')][_0x5402('0x11')]);return _0x37eb00(_0x4b9bf5[_0x5402('0xf')]['message']);}logger[_0x5402('0xf')](_0x5402('0xa'),_0x13d2ee,_0x4b9bf5[_0x5402('0xf')][_0x5402('0x11')]);return _0x473bc9(_0x4b9bf5[_0x5402('0xf')][_0x5402('0x11')]);}else{logger[_0x5402('0x9')](_0x5402('0xa'),_0x13d2ee,_0x5402('0xb'));_0x473bc9(_0x4b9bf5[_0x5402('0x12')][_0x5402('0x11')]);}})[_0x5402('0x13')](function(_0x50a633){logger[_0x5402('0xf')](_0x5402('0xa'),_0x13d2ee,_0x50a633);_0x37eb00(_0x50a633);});});}exports[_0x5402('0x14')]=function(_0x2ac0b3){var _0x2342a4=this;return new Promise(function(_0x261a60,_0x3bf0f9){return db[_0x5402('0x15')]['create'](_0x2ac0b3[_0x5402('0x16')],{'raw':_0x2ac0b3[_0x5402('0x17')]?_0x2ac0b3['options'][_0x5402('0x18')]===undefined?!![]:![]:!![]})[_0x5402('0x8')](function(_0x50e1de){logger[_0x5402('0x9')](_0x5402('0x14'),_0x2ac0b3);logger[_0x5402('0xc')](_0x5402('0x14'),_0x2ac0b3,JSON[_0x5402('0xe')](_0x50e1de));_0x261a60(_0x50e1de);})[_0x5402('0x13')](function(_0x4bf6e0){logger[_0x5402('0xf')](_0x5402('0x14'),_0x4bf6e0[_0x5402('0x11')],_0x2ac0b3);_0x3bf0f9(_0x2342a4[_0x5402('0xf')](0x1f4,_0x4bf6e0[_0x5402('0x11')]));});});};exports[_0x5402('0x19')]=function(_0x46a663){var _0x48013c=this;return new Promise(function(_0x9f23db,_0x1f4a09){return db[_0x5402('0x15')]['update'](_0x46a663['body'],{'raw':_0x46a663['options']?_0x46a663[_0x5402('0x17')][_0x5402('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a663[_0x5402('0x17')]?_0x46a663[_0x5402('0x17')]['where']||null:null,'attributes':_0x46a663[_0x5402('0x17')]?_0x46a663[_0x5402('0x17')][_0x5402('0x1a')]||null:null,'limit':_0x46a663[_0x5402('0x17')]?_0x46a663['options'][_0x5402('0x1b')]||null:null})['then'](function(_0x4622f3){logger['info'](_0x5402('0x19'),_0x46a663);logger[_0x5402('0xc')]('UpdateSquareReport',_0x46a663,JSON['stringify'](_0x4622f3));_0x9f23db(_0x4622f3);})[_0x5402('0x13')](function(_0x37e0a2){logger['error'](_0x5402('0x19'),_0x37e0a2[_0x5402('0x11')],_0x46a663);_0x1f4a09(_0x48013c[_0x5402('0xf')](0x1f4,_0x37e0a2[_0x5402('0x11')]));});});}; \ No newline at end of file +var _0xb2a1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareReport','SquareReport','create','body','options','raw','catch','update','where','UpdateSquareReport','lodash','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb2a1,0x1aa));var _0x1b2a=function(_0xc275a1,_0x39bc28){_0xc275a1=_0xc275a1-0x0;var _0x684c2e=_0xb2a1[_0xc275a1];return _0x684c2e;};'use strict';var _=require(_0x1b2a('0x0'));var util=require(_0x1b2a('0x1'));var moment=require(_0x1b2a('0x2'));var BPromise=require(_0x1b2a('0x3'));var rs=require(_0x1b2a('0x4'));var fs=require('fs');var Redis=require(_0x1b2a('0x5'));var db=require(_0x1b2a('0x6'))['db'];var utils=require(_0x1b2a('0x7'));var logger=require('../../config/logger')(_0x1b2a('0x8'));var config=require(_0x1b2a('0x9'));var jayson=require(_0x1b2a('0xa'));var client=jayson[_0x1b2a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2db611,_0x1ebe7e,_0x19c035){return new BPromise(function(_0x30ff5b,_0x39f6c6){return client[_0x1b2a('0xc')](_0x2db611,_0x19c035)[_0x1b2a('0xd')](function(_0x4dc60a){logger[_0x1b2a('0xe')](_0x1b2a('0xf'),_0x1ebe7e,_0x1b2a('0x10'));logger[_0x1b2a('0x11')](_0x1b2a('0x12'),_0x1ebe7e,_0x1b2a('0x10'),JSON[_0x1b2a('0x13')](_0x4dc60a));if(_0x4dc60a[_0x1b2a('0x14')]){if(_0x4dc60a[_0x1b2a('0x14')][_0x1b2a('0x15')]===0x1f4){logger[_0x1b2a('0x14')]('SquareReport,\x20%s,\x20%s',_0x1ebe7e,_0x4dc60a[_0x1b2a('0x14')][_0x1b2a('0x16')]);return _0x39f6c6(_0x4dc60a[_0x1b2a('0x14')][_0x1b2a('0x16')]);}logger[_0x1b2a('0x14')](_0x1b2a('0xf'),_0x1ebe7e,_0x4dc60a['error']['message']);return _0x30ff5b(_0x4dc60a[_0x1b2a('0x14')][_0x1b2a('0x16')]);}else{logger[_0x1b2a('0xe')]('SquareReport,\x20%s,\x20%s',_0x1ebe7e,_0x1b2a('0x10'));_0x30ff5b(_0x4dc60a['result'][_0x1b2a('0x16')]);}})['catch'](function(_0x55bd0f){logger['error'](_0x1b2a('0xf'),_0x1ebe7e,_0x55bd0f);_0x39f6c6(_0x55bd0f);});});}exports[_0x1b2a('0x17')]=function(_0x2cd32f){var _0x1a4284=this;return new Promise(function(_0x3f1361,_0x4bb84f){return db[_0x1b2a('0x18')][_0x1b2a('0x19')](_0x2cd32f[_0x1b2a('0x1a')],{'raw':_0x2cd32f[_0x1b2a('0x1b')]?_0x2cd32f[_0x1b2a('0x1b')][_0x1b2a('0x1c')]===undefined?!![]:![]:!![]})[_0x1b2a('0xd')](function(_0x75fb90){logger[_0x1b2a('0xe')](_0x1b2a('0x17'),_0x2cd32f);logger['debug']('CreateSquareReport',_0x2cd32f,JSON[_0x1b2a('0x13')](_0x75fb90));_0x3f1361(_0x75fb90);})[_0x1b2a('0x1d')](function(_0x2c1df9){logger[_0x1b2a('0x14')](_0x1b2a('0x17'),_0x2c1df9[_0x1b2a('0x16')],_0x2cd32f);_0x4bb84f(_0x1a4284[_0x1b2a('0x14')](0x1f4,_0x2c1df9[_0x1b2a('0x16')]));});});};exports['UpdateSquareReport']=function(_0x315bc0){var _0x185cd1=this;return new Promise(function(_0x383252,_0x1ef3ff){return db[_0x1b2a('0x18')][_0x1b2a('0x1e')](_0x315bc0[_0x1b2a('0x1a')],{'raw':_0x315bc0[_0x1b2a('0x1b')]?_0x315bc0[_0x1b2a('0x1b')][_0x1b2a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x315bc0[_0x1b2a('0x1b')]?_0x315bc0[_0x1b2a('0x1b')][_0x1b2a('0x1f')]||null:null,'attributes':_0x315bc0[_0x1b2a('0x1b')]?_0x315bc0[_0x1b2a('0x1b')]['attributes']||null:null,'limit':_0x315bc0[_0x1b2a('0x1b')]?_0x315bc0[_0x1b2a('0x1b')]['limit']||null:null})['then'](function(_0x2bf872){logger[_0x1b2a('0xe')]('UpdateSquareReport',_0x315bc0);logger[_0x1b2a('0x11')]('UpdateSquareReport',_0x315bc0,JSON['stringify'](_0x2bf872));_0x383252(_0x2bf872);})[_0x1b2a('0x1d')](function(_0x7291ca){logger[_0x1b2a('0x14')](_0x1b2a('0x20'),_0x7291ca[_0x1b2a('0x16')],_0x315bc0);_0x1ef3ff(_0x185cd1[_0x1b2a('0x14')](0x1f4,_0x7291ca[_0x1b2a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 5ebc21b..c0ce57b 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 _0x9967=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update'];(function(_0x5375c3,_0x520033){var _0x1ff7ac=function(_0x3468fb){while(--_0x3468fb){_0x5375c3['push'](_0x5375c3['shift']());}};_0x1ff7ac(++_0x520033);}(_0x9967,0xd3));var _0x7996=function(_0x2192d9,_0x4520b3){_0x2192d9=_0x2192d9-0x0;var _0x118776=_0x9967[_0x2192d9];return _0x118776;};'use strict';var multer=require(_0x7996('0x0'));var util=require(_0x7996('0x1'));var path=require(_0x7996('0x2'));var timeout=require(_0x7996('0x3'));var express=require(_0x7996('0x4'));var router=express['Router']();var fs_extra=require(_0x7996('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7996('0x6'));var config=require('../../config/environment');var controller=require(_0x7996('0x7'));router[_0x7996('0x8')]('/',auth[_0x7996('0x9')](),controller[_0x7996('0xa')]);router['get'](_0x7996('0xb'),auth[_0x7996('0x9')](),controller['describe']);router[_0x7996('0x8')](_0x7996('0xc'),auth[_0x7996('0x9')](),controller[_0x7996('0xd')]);router[_0x7996('0xe')]('/',auth[_0x7996('0x9')](),controller[_0x7996('0xf')]);router['put']('/:id',auth[_0x7996('0x9')](),controller[_0x7996('0x10')]);router[_0x7996('0x11')](_0x7996('0xc'),auth[_0x7996('0x9')](),controller[_0x7996('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1d9b=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x546f85,_0x1d7288){var _0x175b58=function(_0x73f824){while(--_0x73f824){_0x546f85['push'](_0x546f85['shift']());}};_0x175b58(++_0x1d7288);}(_0x1d9b,0xd4));var _0xb1d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d9b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb1d9('0x0'));var util=require(_0xb1d9('0x1'));var path=require(_0xb1d9('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1d9('0x3'));var router=express[_0xb1d9('0x4')]();var fs_extra=require(_0xb1d9('0x5'));var auth=require(_0xb1d9('0x6'));var interaction=require(_0xb1d9('0x7'));var config=require(_0xb1d9('0x8'));var controller=require('./squareReportDetail.controller');router[_0xb1d9('0x9')]('/',auth['isAuthenticated'](),controller[_0xb1d9('0xa')]);router[_0xb1d9('0x9')](_0xb1d9('0xb'),auth[_0xb1d9('0xc')](),controller[_0xb1d9('0xd')]);router['get'](_0xb1d9('0xe'),auth[_0xb1d9('0xc')](),controller[_0xb1d9('0xf')]);router['post']('/',auth[_0xb1d9('0xc')](),controller[_0xb1d9('0x10')]);router[_0xb1d9('0x11')](_0xb1d9('0xe'),auth[_0xb1d9('0xc')](),controller[_0xb1d9('0x12')]);router[_0xb1d9('0x13')](_0xb1d9('0xe'),auth[_0xb1d9('0xc')](),controller[_0xb1d9('0x14')]);module[_0xb1d9('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 2f876b7..3a3b26a 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 _0xd4d5=['STRING','sequelize','exports'];(function(_0x2fcd6c,_0x278eeb){var _0x3afdd6=function(_0x7f874f){while(--_0x7f874f){_0x2fcd6c['push'](_0x2fcd6c['shift']());}};_0x3afdd6(++_0x278eeb);}(_0xd4d5,0xee));var _0x5d4d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd4d5[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x5d4d('0x0'));module[_0x5d4d('0x1')]={'uniqueid':{'type':Sequelize[_0x5d4d('0x2')]},'node':{'type':Sequelize[_0x5d4d('0x2')]},'application':{'type':Sequelize[_0x5d4d('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x5d4d('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa7bd=['STRING','TEXT'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa7bd,0x116));var _0xda7b=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0xa7bd[_0x9df3d8];return _0x366da1;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xda7b('0x0')]},'node':{'type':Sequelize[_0xda7b('0x0')]},'application':{'type':Sequelize[_0xda7b('0x0')]},'data':{'type':Sequelize[_0xda7b('0x1')]},'project_name':{'type':Sequelize[_0xda7b('0x0')]},'callerid':{'type':Sequelize[_0xda7b('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index bfc815d..74e4485 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 _0x9cb6=['fields','attributes','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','catch','params','length','include','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name','send','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x48c85b,_0x302d8d){var _0xc634e6=function(_0x2a43d1){while(--_0x2a43d1){_0x48c85b['push'](_0x48c85b['shift']());}};_0xc634e6(++_0x302d8d);}(_0x9cb6,0x9a));var _0x69cb=function(_0x2fb120,_0x4f218f){_0x2fb120=_0x2fb120-0x0;var _0x2120e0=_0x9cb6[_0x2fb120];return _0x2120e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69cb('0x0'));var zipdir=require(_0x69cb('0x1'));var jsonpatch=require(_0x69cb('0x2'));var rp=require(_0x69cb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x69cb('0x4'));var util=require(_0x69cb('0x5'));var path=require(_0x69cb('0x6'));var sox=require('sox');var csv=require(_0x69cb('0x7'));var ejs=require(_0x69cb('0x8'));var fs=require('fs');var fs_extra=require(_0x69cb('0x9'));var _=require(_0x69cb('0xa'));var squel=require(_0x69cb('0xb'));var crypto=require('crypto');var jsforce=require(_0x69cb('0xc'));var deskjs=require(_0x69cb('0xd'));var toCsv=require(_0x69cb('0x7'));var querystring=require('querystring');var Papa=require(_0x69cb('0xe'));var Redis=require('ioredis');var authService=require(_0x69cb('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69cb('0x10'));var logger=require('../../config/logger')(_0x69cb('0x11'));var utils=require(_0x69cb('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x69cb('0x13'));var db=require(_0x69cb('0x14'))['db'];function respondWithStatusCode(_0x5516a3,_0x5b6ab4){_0x5b6ab4=_0x5b6ab4||0xcc;return function(_0x3472d9){if(_0x3472d9){return _0x5516a3[_0x69cb('0x15')](_0x5b6ab4);}return _0x5516a3[_0x69cb('0x16')](_0x5b6ab4)['end']();};}function respondWithResult(_0x273119,_0x5a19c2){_0x5a19c2=_0x5a19c2||0xc8;return function(_0x8c9924){if(_0x8c9924){return _0x273119['status'](_0x5a19c2)[_0x69cb('0x17')](_0x8c9924);}};}function respondWithFilteredResult(_0x1dd8b7,_0x545488){return function(_0x299456){if(_0x299456){var _0x4f65f3=typeof _0x545488[_0x69cb('0x18')]===_0x69cb('0x19')&&typeof _0x545488[_0x69cb('0x1a')]===_0x69cb('0x19');var _0x3a7bbf=_0x299456[_0x69cb('0x1b')];var _0x46f2f7=_0x4f65f3?0x0:_0x545488[_0x69cb('0x18')];var _0x17b340=_0x4f65f3?_0x299456[_0x69cb('0x1b')]:_0x545488[_0x69cb('0x18')]+_0x545488[_0x69cb('0x1a')];var _0x1bb6bc;if(_0x17b340>=_0x3a7bbf){_0x17b340=_0x3a7bbf;_0x1bb6bc=0xc8;}else{_0x1bb6bc=0xce;}_0x1dd8b7['status'](_0x1bb6bc);return _0x1dd8b7[_0x69cb('0x1c')](_0x69cb('0x1d'),_0x46f2f7+'-'+_0x17b340+'/'+_0x3a7bbf)['json'](_0x299456);}return null;};}function patchUpdates(_0x19f5ba){return function(_0xec840a){try{jsonpatch['apply'](_0xec840a,_0x19f5ba,!![]);}catch(_0x24dbf0){return BPromise[_0x69cb('0x1e')](_0x24dbf0);}return _0xec840a[_0x69cb('0x1f')]();};}function saveUpdates(_0x2f3d28,_0x34590e){return function(_0x27426e){if(_0x27426e){return _0x27426e[_0x69cb('0x20')](_0x2f3d28)[_0x69cb('0x21')](function(_0x2286a6){return _0x2286a6;});}return null;};}function removeEntity(_0x4030b4,_0x3657b3){return function(_0x5c601f){if(_0x5c601f){return _0x5c601f[_0x69cb('0x22')]()['then'](function(){_0x4030b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c63e1,_0x61cc1c){return function(_0x391ea0){if(!_0x391ea0){_0x3c63e1[_0x69cb('0x15')](0x194);}return _0x391ea0;};}function handleError(_0x29ca78,_0x5d7c8f){_0x5d7c8f=_0x5d7c8f||0x1f4;return function(_0x3be6ff){logger['error'](_0x3be6ff['stack']);if(_0x3be6ff[_0x69cb('0x23')]){delete _0x3be6ff[_0x69cb('0x23')];}_0x29ca78[_0x69cb('0x16')](_0x5d7c8f)[_0x69cb('0x24')](_0x3be6ff);};}exports['index']=function(_0x7ea47d,_0x25b313){var _0x24396b={},_0x4b97a1={},_0x2705a8={'count':0x0,'rows':[]};var _0x5460c1=_['map'](db[_0x69cb('0x25')][_0x69cb('0x26')],function(_0x4f7939){return{'name':_0x4f7939[_0x69cb('0x27')],'type':_0x4f7939[_0x69cb('0x28')][_0x69cb('0x29')]};});_0x4b97a1[_0x69cb('0x2a')]=_[_0x69cb('0x2b')](_0x5460c1,_0x69cb('0x23'));_0x4b97a1[_0x69cb('0x2c')]=_[_0x69cb('0x2d')](_0x7ea47d[_0x69cb('0x2c')]);_0x4b97a1['filters']=_[_0x69cb('0x2e')](_0x4b97a1[_0x69cb('0x2a')],_0x4b97a1['query']);_0x24396b['attributes']=_[_0x69cb('0x2e')](_0x4b97a1[_0x69cb('0x2a')],qs[_0x69cb('0x2f')](_0x7ea47d[_0x69cb('0x2c')][_0x69cb('0x2f')]));_0x24396b[_0x69cb('0x30')]=_0x24396b[_0x69cb('0x30')]['length']?_0x24396b['attributes']:_0x4b97a1[_0x69cb('0x2a')];if(!_0x7ea47d['query']['hasOwnProperty'](_0x69cb('0x31'))){_0x24396b[_0x69cb('0x1a')]=qs[_0x69cb('0x1a')](_0x7ea47d[_0x69cb('0x2c')]['limit']);_0x24396b[_0x69cb('0x18')]=qs[_0x69cb('0x18')](_0x7ea47d[_0x69cb('0x2c')][_0x69cb('0x18')]);}_0x24396b[_0x69cb('0x32')]=qs['sort'](_0x7ea47d[_0x69cb('0x2c')][_0x69cb('0x33')]);_0x24396b['where']=qs[_0x69cb('0x34')](_[_0x69cb('0x35')](_0x7ea47d[_0x69cb('0x2c')],_0x4b97a1['filters']),_0x5460c1);if(_0x7ea47d[_0x69cb('0x2c')][_0x69cb('0x36')]){_0x24396b[_0x69cb('0x37')]=_[_0x69cb('0x38')](_0x24396b[_0x69cb('0x37')],{'$or':_[_0x69cb('0x2b')](_0x5460c1,function(_0x522f25){if(_0x522f25[_0x69cb('0x28')]!=='VIRTUAL'){var _0x231595={};_0x231595[_0x522f25['name']]={'$like':'%'+_0x7ea47d[_0x69cb('0x2c')]['filter']+'%'};return _0x231595;}})});}_0x24396b=_['merge']({},_0x24396b,_0x7ea47d['options']);var _0xac37e1={'where':_0x24396b[_0x69cb('0x37')]};return db[_0x69cb('0x25')][_0x69cb('0x1b')](_0xac37e1)[_0x69cb('0x21')](function(_0x5cdd97){_0x2705a8[_0x69cb('0x1b')]=_0x5cdd97;if(_0x7ea47d['query'][_0x69cb('0x39')]){_0x24396b['include']=[{'all':!![]}];}return db[_0x69cb('0x25')]['findAll'](_0x24396b);})['then'](function(_0x122567){_0x2705a8['rows']=_0x122567;return _0x2705a8;})[_0x69cb('0x21')](respondWithFilteredResult(_0x25b313,_0x24396b))[_0x69cb('0x3a')](handleError(_0x25b313,null));};exports['show']=function(_0x44ebd6,_0x7ba592){var _0x1c97ee={'raw':!![],'where':{'id':_0x44ebd6[_0x69cb('0x3b')]['id']}},_0x4d39cd={};_0x4d39cd[_0x69cb('0x2a')]=_[_0x69cb('0x2d')](db['SquareDetailsReport']['rawAttributes']);_0x4d39cd['query']=_['keys'](_0x44ebd6[_0x69cb('0x2c')]);_0x4d39cd['filters']=_[_0x69cb('0x2e')](_0x4d39cd['model'],_0x4d39cd[_0x69cb('0x2c')]);_0x1c97ee['attributes']=_[_0x69cb('0x2e')](_0x4d39cd[_0x69cb('0x2a')],qs[_0x69cb('0x2f')](_0x44ebd6['query'][_0x69cb('0x2f')]));_0x1c97ee['attributes']=_0x1c97ee[_0x69cb('0x30')][_0x69cb('0x3c')]?_0x1c97ee['attributes']:_0x4d39cd[_0x69cb('0x2a')];if(_0x44ebd6[_0x69cb('0x2c')]['includeAll']){_0x1c97ee[_0x69cb('0x3d')]=[{'all':!![]}];}_0x1c97ee=_[_0x69cb('0x38')]({},_0x1c97ee,_0x44ebd6[_0x69cb('0x3e')]);return db['SquareDetailsReport'][_0x69cb('0x3f')](_0x1c97ee)[_0x69cb('0x21')](handleEntityNotFound(_0x7ba592,null))['then'](respondWithResult(_0x7ba592,null))[_0x69cb('0x3a')](handleError(_0x7ba592,null));};exports['create']=function(_0x1316c7,_0x49c584){return db['SquareDetailsReport'][_0x69cb('0x40')](_0x1316c7[_0x69cb('0x41')],{})[_0x69cb('0x21')](respondWithResult(_0x49c584,0xc9))[_0x69cb('0x3a')](handleError(_0x49c584,null));};exports['update']=function(_0x234b8a,_0x3d4a07){if(_0x234b8a[_0x69cb('0x41')]['id']){delete _0x234b8a[_0x69cb('0x41')]['id'];}return db[_0x69cb('0x25')]['find']({'where':{'id':_0x234b8a[_0x69cb('0x3b')]['id']}})[_0x69cb('0x21')](handleEntityNotFound(_0x3d4a07,null))['then'](saveUpdates(_0x234b8a[_0x69cb('0x41')],null))[_0x69cb('0x21')](respondWithResult(_0x3d4a07,null))[_0x69cb('0x3a')](handleError(_0x3d4a07,null));};exports['destroy']=function(_0x19a76f,_0x234b42){return db[_0x69cb('0x25')]['find']({'where':{'id':_0x19a76f['params']['id']}})[_0x69cb('0x21')](handleEntityNotFound(_0x234b42,null))[_0x69cb('0x21')](removeEntity(_0x234b42,null))[_0x69cb('0x3a')](handleError(_0x234b42,null));};exports[_0x69cb('0x42')]=function(_0x4b7031,_0x4abfc5){return db['SquareDetailsReport']['describe']()[_0x69cb('0x21')](respondWithResult(_0x4abfc5,null))[_0x69cb('0x3a')](handleError(_0x4abfc5,null));}; \ No newline at end of file +var _0x83a3=['filter','where','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','intersection','length','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','sendStatus','error','name','send','SquareDetailsReport','rawAttributes','fieldName','type','map','query','filters','model','attributes','fields','order','sort','pick'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x83a3,0x13a));var _0x383a=function(_0x6c6d75,_0xef7deb){_0x6c6d75=_0x6c6d75-0x0;var _0x48a161=_0x83a3[_0x6c6d75];return _0x48a161;};'use strict';var emlformat=require(_0x383a('0x0'));var rimraf=require(_0x383a('0x1'));var zipdir=require(_0x383a('0x2'));var jsonpatch=require(_0x383a('0x3'));var rp=require(_0x383a('0x4'));var moment=require(_0x383a('0x5'));var BPromise=require(_0x383a('0x6'));var Mustache=require(_0x383a('0x7'));var util=require(_0x383a('0x8'));var path=require('path');var sox=require(_0x383a('0x9'));var csv=require(_0x383a('0xa'));var ejs=require(_0x383a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x383a('0xc'));var squel=require(_0x383a('0xd'));var crypto=require(_0x383a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x383a('0xf'));var toCsv=require(_0x383a('0xa'));var querystring=require(_0x383a('0x10'));var Papa=require(_0x383a('0x11'));var Redis=require(_0x383a('0x12'));var authService=require(_0x383a('0x13'));var qs=require(_0x383a('0x14'));var as=require(_0x383a('0x15'));var hardwareService=require(_0x383a('0x16'));var logger=require(_0x383a('0x17'))(_0x383a('0x18'));var utils=require(_0x383a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x383a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16eba6,_0x3989df){_0x3989df=_0x3989df||0xcc;return function(_0x18fbf5){if(_0x18fbf5){return _0x16eba6['sendStatus'](_0x3989df);}return _0x16eba6[_0x383a('0x1b')](_0x3989df)[_0x383a('0x1c')]();};}function respondWithResult(_0x99a7c8,_0x4d000e){_0x4d000e=_0x4d000e||0xc8;return function(_0x192a8b){if(_0x192a8b){return _0x99a7c8[_0x383a('0x1b')](_0x4d000e)[_0x383a('0x1d')](_0x192a8b);}};}function respondWithFilteredResult(_0x3bf836,_0x419be9){return function(_0xb144e6){if(_0xb144e6){var _0x52ec69=typeof _0x419be9[_0x383a('0x1e')]===_0x383a('0x1f')&&typeof _0x419be9[_0x383a('0x20')]===_0x383a('0x1f');var _0x3544cc=_0xb144e6[_0x383a('0x21')];var _0x378b93=_0x52ec69?0x0:_0x419be9[_0x383a('0x1e')];var _0x4fb673=_0x52ec69?_0xb144e6[_0x383a('0x21')]:_0x419be9[_0x383a('0x1e')]+_0x419be9['limit'];var _0x251357;if(_0x4fb673>=_0x3544cc){_0x4fb673=_0x3544cc;_0x251357=0xc8;}else{_0x251357=0xce;}_0x3bf836[_0x383a('0x1b')](_0x251357);return _0x3bf836['set'](_0x383a('0x22'),_0x378b93+'-'+_0x4fb673+'/'+_0x3544cc)[_0x383a('0x1d')](_0xb144e6);}return null;};}function patchUpdates(_0x8239f){return function(_0x17fa4a){try{jsonpatch[_0x383a('0x23')](_0x17fa4a,_0x8239f,!![]);}catch(_0x4552ea){return BPromise['reject'](_0x4552ea);}return _0x17fa4a[_0x383a('0x24')]();};}function saveUpdates(_0x11b912,_0x5cfa24){return function(_0x3b07c9){if(_0x3b07c9){return _0x3b07c9['update'](_0x11b912)[_0x383a('0x25')](function(_0x376dc4){return _0x376dc4;});}return null;};}function removeEntity(_0x13610a,_0x2a0b17){return function(_0xfd4247){if(_0xfd4247){return _0xfd4247[_0x383a('0x26')]()[_0x383a('0x25')](function(){_0x13610a['status'](0xcc)[_0x383a('0x1c')]();});}};}function handleEntityNotFound(_0x353a2b,_0x263952){return function(_0x2ac261){if(!_0x2ac261){_0x353a2b[_0x383a('0x27')](0x194);}return _0x2ac261;};}function handleError(_0x50e4f9,_0x1d3b83){_0x1d3b83=_0x1d3b83||0x1f4;return function(_0x59a17f){logger[_0x383a('0x28')](_0x59a17f['stack']);if(_0x59a17f[_0x383a('0x29')]){delete _0x59a17f[_0x383a('0x29')];}_0x50e4f9[_0x383a('0x1b')](_0x1d3b83)[_0x383a('0x2a')](_0x59a17f);};}exports['index']=function(_0xe3ca0b,_0x1caeca){var _0x321a87={},_0x4ddd5e={},_0x3e49a6={'count':0x0,'rows':[]};var _0x2edb80=_['map'](db[_0x383a('0x2b')][_0x383a('0x2c')],function(_0x558fbd){return{'name':_0x558fbd[_0x383a('0x2d')],'type':_0x558fbd[_0x383a('0x2e')]['key']};});_0x4ddd5e['model']=_[_0x383a('0x2f')](_0x2edb80,_0x383a('0x29'));_0x4ddd5e[_0x383a('0x30')]=_['keys'](_0xe3ca0b['query']);_0x4ddd5e[_0x383a('0x31')]=_['intersection'](_0x4ddd5e[_0x383a('0x32')],_0x4ddd5e[_0x383a('0x30')]);_0x321a87[_0x383a('0x33')]=_['intersection'](_0x4ddd5e[_0x383a('0x32')],qs[_0x383a('0x34')](_0xe3ca0b[_0x383a('0x30')][_0x383a('0x34')]));_0x321a87[_0x383a('0x33')]=_0x321a87[_0x383a('0x33')]['length']?_0x321a87[_0x383a('0x33')]:_0x4ddd5e[_0x383a('0x32')];if(!_0xe3ca0b['query']['hasOwnProperty']('nolimit')){_0x321a87[_0x383a('0x20')]=qs[_0x383a('0x20')](_0xe3ca0b['query'][_0x383a('0x20')]);_0x321a87[_0x383a('0x1e')]=qs[_0x383a('0x1e')](_0xe3ca0b[_0x383a('0x30')][_0x383a('0x1e')]);}_0x321a87[_0x383a('0x35')]=qs[_0x383a('0x36')](_0xe3ca0b[_0x383a('0x30')][_0x383a('0x36')]);_0x321a87['where']=qs[_0x383a('0x31')](_[_0x383a('0x37')](_0xe3ca0b[_0x383a('0x30')],_0x4ddd5e[_0x383a('0x31')]),_0x2edb80);if(_0xe3ca0b['query'][_0x383a('0x38')]){_0x321a87[_0x383a('0x39')]=_[_0x383a('0x3a')](_0x321a87['where'],{'$or':_[_0x383a('0x2f')](_0x2edb80,function(_0x36dcac){if(_0x36dcac[_0x383a('0x2e')]!==_0x383a('0x3b')){var _0x175421={};_0x175421[_0x36dcac[_0x383a('0x29')]]={'$like':'%'+_0xe3ca0b[_0x383a('0x30')][_0x383a('0x38')]+'%'};return _0x175421;}})});}_0x321a87=_['merge']({},_0x321a87,_0xe3ca0b['options']);var _0x2d8070={'where':_0x321a87[_0x383a('0x39')]};return db[_0x383a('0x2b')][_0x383a('0x21')](_0x2d8070)[_0x383a('0x25')](function(_0x3e28e1){_0x3e49a6[_0x383a('0x21')]=_0x3e28e1;if(_0xe3ca0b[_0x383a('0x30')][_0x383a('0x3c')]){_0x321a87[_0x383a('0x3d')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x321a87);})[_0x383a('0x25')](function(_0x54abf0){_0x3e49a6[_0x383a('0x3e')]=_0x54abf0;return _0x3e49a6;})[_0x383a('0x25')](respondWithFilteredResult(_0x1caeca,_0x321a87))[_0x383a('0x3f')](handleError(_0x1caeca,null));};exports['show']=function(_0x3bfed0,_0x51a8ab){var _0x26501f={'raw':!![],'where':{'id':_0x3bfed0[_0x383a('0x40')]['id']}},_0xbff713={};_0xbff713[_0x383a('0x32')]=_[_0x383a('0x41')](db[_0x383a('0x2b')][_0x383a('0x2c')]);_0xbff713[_0x383a('0x30')]=_['keys'](_0x3bfed0[_0x383a('0x30')]);_0xbff713[_0x383a('0x31')]=_[_0x383a('0x42')](_0xbff713[_0x383a('0x32')],_0xbff713[_0x383a('0x30')]);_0x26501f[_0x383a('0x33')]=_[_0x383a('0x42')](_0xbff713[_0x383a('0x32')],qs[_0x383a('0x34')](_0x3bfed0[_0x383a('0x30')][_0x383a('0x34')]));_0x26501f[_0x383a('0x33')]=_0x26501f[_0x383a('0x33')][_0x383a('0x43')]?_0x26501f[_0x383a('0x33')]:_0xbff713[_0x383a('0x32')];if(_0x3bfed0[_0x383a('0x30')][_0x383a('0x3c')]){_0x26501f[_0x383a('0x3d')]=[{'all':!![]}];}_0x26501f=_[_0x383a('0x3a')]({},_0x26501f,_0x3bfed0[_0x383a('0x44')]);return db[_0x383a('0x2b')][_0x383a('0x45')](_0x26501f)[_0x383a('0x25')](handleEntityNotFound(_0x51a8ab,null))[_0x383a('0x25')](respondWithResult(_0x51a8ab,null))[_0x383a('0x3f')](handleError(_0x51a8ab,null));};exports[_0x383a('0x46')]=function(_0x4e5af9,_0x1fbe64){return db[_0x383a('0x2b')][_0x383a('0x46')](_0x4e5af9[_0x383a('0x47')],{})[_0x383a('0x25')](respondWithResult(_0x1fbe64,0xc9))[_0x383a('0x3f')](handleError(_0x1fbe64,null));};exports[_0x383a('0x48')]=function(_0x4f5233,_0x10bd0e){if(_0x4f5233['body']['id']){delete _0x4f5233[_0x383a('0x47')]['id'];}return db['SquareDetailsReport'][_0x383a('0x45')]({'where':{'id':_0x4f5233['params']['id']}})[_0x383a('0x25')](handleEntityNotFound(_0x10bd0e,null))[_0x383a('0x25')](saveUpdates(_0x4f5233['body'],null))[_0x383a('0x25')](respondWithResult(_0x10bd0e,null))[_0x383a('0x3f')](handleError(_0x10bd0e,null));};exports[_0x383a('0x26')]=function(_0x2dd393,_0x39e182){return db[_0x383a('0x2b')][_0x383a('0x45')]({'where':{'id':_0x2dd393[_0x383a('0x40')]['id']}})[_0x383a('0x25')](handleEntityNotFound(_0x39e182,null))[_0x383a('0x25')](removeEntity(_0x39e182,null))[_0x383a('0x3f')](handleError(_0x39e182,null));};exports['describe']=function(_0xbd9446,_0xe1f5d3){return db[_0x383a('0x2b')][_0x383a('0x49')]()[_0x383a('0x25')](respondWithResult(_0xe1f5d3,null))[_0x383a('0x3f')](handleError(_0xe1f5d3,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b972e01..2c4c7bc 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 _0x7d30=['path','rimraf','../../config/environment','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20b9df,_0x260189){var _0x5a7f17=function(_0x522fd1){while(--_0x522fd1){_0x20b9df['push'](_0x20b9df['shift']());}};_0x5a7f17(++_0x260189);}(_0x7d30,0x119));var _0x07d3=function(_0x34de11,_0x2d6ada){_0x34de11=_0x34de11-0x0;var _0x5a2d2b=_0x7d30[_0x34de11];return _0x5a2d2b;};'use strict';var _=require(_0x07d3('0x0'));var util=require(_0x07d3('0x1'));var logger=require(_0x07d3('0x2'))(_0x07d3('0x3'));var moment=require(_0x07d3('0x4'));var BPromise=require(_0x07d3('0x5'));var rp=require(_0x07d3('0x6'));var fs=require('fs');var path=require(_0x07d3('0x7'));var rimraf=require(_0x07d3('0x8'));var config=require(_0x07d3('0x9'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x596bd6,_0x42c784){return _0x596bd6[_0x07d3('0xa')](_0x07d3('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1860=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes'];(function(_0x2e9cd4,_0x253548){var _0x4fac64=function(_0x584068){while(--_0x584068){_0x2e9cd4['push'](_0x2e9cd4['shift']());}};_0x4fac64(++_0x253548);}(_0x1860,0x90));var _0x0186=function(_0x4ea627,_0x40e20f){_0x4ea627=_0x4ea627-0x0;var _0x3b9377=_0x1860[_0x4ea627];return _0x3b9377;};'use strict';var _=require(_0x0186('0x0'));var util=require(_0x0186('0x1'));var logger=require(_0x0186('0x2'))(_0x0186('0x3'));var moment=require(_0x0186('0x4'));var BPromise=require(_0x0186('0x5'));var rp=require(_0x0186('0x6'));var fs=require('fs');var path=require(_0x0186('0x7'));var rimraf=require('rimraf');var config=require(_0x0186('0x8'));var attributes=require(_0x0186('0x9'));module[_0x0186('0xa')]=function(_0x322eec,_0x533891){return _0x322eec[_0x0186('0xb')](_0x0186('0xc'),attributes,{'tableName':_0x0186('0xd'),'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 b592be0..8eea1a4 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 _0xaa5e=['CreateSquareDetailsReport','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','SquareDetailsReport','create','options','raw'];(function(_0x508f7e,_0xc538a5){var _0x219b83=function(_0x181464){while(--_0x181464){_0x508f7e['push'](_0x508f7e['shift']());}};_0x219b83(++_0xc538a5);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x474530,_0x2ce4ef){_0x474530=_0x474530-0x0;var _0x54527d=_0xaa5e[_0x474530];return _0x54527d;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var moment=require('moment');var BPromise=require(_0xeaa5('0x2'));var rs=require(_0xeaa5('0x3'));var fs=require('fs');var Redis=require(_0xeaa5('0x4'));var db=require(_0xeaa5('0x5'))['db'];var utils=require(_0xeaa5('0x6'));var logger=require('../../config/logger')(_0xeaa5('0x7'));var config=require(_0xeaa5('0x8'));var jayson=require(_0xeaa5('0x9'));var client=jayson[_0xeaa5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d405e,_0x2f9041,_0x2c9696){return new BPromise(function(_0x50cb62,_0x2e35c3){return client[_0xeaa5('0xb')](_0x4d405e,_0x2c9696)['then'](function(_0x2e9ca6){logger['info'](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));logger['debug'](_0xeaa5('0xe'),_0x2f9041,_0xeaa5('0xd'),JSON[_0xeaa5('0xf')](_0x2e9ca6));if(_0x2e9ca6[_0xeaa5('0x10')]){if(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x11')]===0x1f4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x2e35c3(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x12')]);}logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x50cb62(_0x2e9ca6[_0xeaa5('0x10')]['message']);}else{logger[_0xeaa5('0x13')](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));_0x50cb62(_0x2e9ca6['result'][_0xeaa5('0x12')]);}})['catch'](function(_0x44e4b4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x44e4b4);_0x2e35c3(_0x44e4b4);});});}exports['CreateSquareDetailsReport']=function(_0x1877a6){var _0x50256a=this;return new Promise(function(_0x222da7,_0x85fb44){return db[_0xeaa5('0x14')][_0xeaa5('0x15')](_0x1877a6['body'],{'raw':_0x1877a6[_0xeaa5('0x16')]?_0x1877a6[_0xeaa5('0x16')][_0xeaa5('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x11ace2){logger[_0xeaa5('0x13')](_0xeaa5('0x18'),_0x1877a6);logger[_0xeaa5('0x19')](_0xeaa5('0x18'),_0x1877a6,JSON['stringify'](_0x11ace2));_0x222da7(_0x11ace2);})[_0xeaa5('0x1a')](function(_0x5f2d83){logger[_0xeaa5('0x10')](_0xeaa5('0x18'),_0x5f2d83[_0xeaa5('0x12')],_0x1877a6);_0x85fb44(_0x50256a[_0xeaa5('0x10')](0x1f4,_0x5f2d83[_0xeaa5('0x12')]));});});}; \ No newline at end of file +var _0x5b12=['../../config/utils','rpc','client','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x284231,_0x18333b){var _0xecb575=function(_0x29cf0f){while(--_0x29cf0f){_0x284231['push'](_0x284231['shift']());}};_0xecb575(++_0x18333b);}(_0x5b12,0xa3));var _0x25b1=function(_0x484118,_0x533221){_0x484118=_0x484118-0x0;var _0x428b49=_0x5b12[_0x484118];return _0x428b49;};'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')]('SquareDetailsReport,\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);});});}exports[_0x25b1('0x14')]=function(_0x27ccc9){var _0x1f78c2=this;return new Promise(function(_0x2a7d14,_0x17024a){return db[_0x25b1('0x15')]['create'](_0x27ccc9['body'],{'raw':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3bfd7d){logger['info'](_0x25b1('0x14'),_0x27ccc9);logger['debug'](_0x25b1('0x14'),_0x27ccc9,JSON['stringify'](_0x3bfd7d));_0x2a7d14(_0x3bfd7d);})['catch'](function(_0x565cfd){logger[_0x25b1('0xf')](_0x25b1('0x14'),_0x565cfd['message'],_0x27ccc9);_0x17024a(_0x1f78c2[_0x25b1('0xf')](0x1f4,_0x565cfd[_0x25b1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1218cea..ace8415 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 _0xf33a=['killProcess','express','Router','../../components/auth/service','./system.controller','isAuthenticated','get'];(function(_0x58dd95,_0x538374){var _0x36a891=function(_0x4eb229){while(--_0x4eb229){_0x58dd95['push'](_0x58dd95['shift']());}};_0x36a891(++_0x538374);}(_0xf33a,0x151));var _0xaf33=function(_0x3cff52,_0x46c284){_0x3cff52=_0x3cff52-0x0;var _0x8083d0=_0xf33a[_0x3cff52];return _0x8083d0;};'use strict';var express=require(_0xaf33('0x0'));var router=express[_0xaf33('0x1')]();var auth=require(_0xaf33('0x2'));var controller=require(_0xaf33('0x3'));router['get']('/',auth[_0xaf33('0x4')](),controller['index']);router[_0xaf33('0x5')]('/process/:pid/kill',auth[_0xaf33('0x4')](),controller[_0xaf33('0x6')]);module['exports']=router; \ No newline at end of file +var _0xb35a=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express'];(function(_0x33c8c9,_0x17bf09){var _0x26d6a0=function(_0x40f3fb){while(--_0x40f3fb){_0x33c8c9['push'](_0x33c8c9['shift']());}};_0x26d6a0(++_0x17bf09);}(_0xb35a,0x1c1));var _0xab35=function(_0x31c27f,_0x40294c){_0x31c27f=_0x31c27f-0x0;var _0x28f9c6=_0xb35a[_0x31c27f];return _0x28f9c6;};'use strict';var express=require(_0xab35('0x0'));var router=express[_0xab35('0x1')]();var auth=require(_0xab35('0x2'));var controller=require(_0xab35('0x3'));router[_0xab35('0x4')]('/',auth[_0xab35('0x5')](),controller[_0xab35('0x6')]);router[_0xab35('0x4')](_0xab35('0x7'),auth['isAuthenticated'](),controller[_0xab35('0x8')]);module[_0xab35('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 80d7d2c..4538231 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 _0xba30=['length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','inspect','status','index','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then'];(function(_0x24ff97,_0x17fb48){var _0x1bd660=function(_0x553733){while(--_0x553733){_0x24ff97['push'](_0x24ff97['shift']());}};_0x1bd660(++_0x17fb48);}(_0xba30,0x13d));var _0x0ba3=function(_0x3797d9,_0x1ce1c7){_0x3797d9=_0x3797d9-0x0;var _0x2d1c0d=_0xba30[_0x3797d9];return _0x2d1c0d;};'use strict';var info=require(_0x0ba3('0x0'));var exec=require(_0x0ba3('0x1'))[_0x0ba3('0x2')];var logger=require(_0x0ba3('0x3'))(_0x0ba3('0x4'));var util=require(_0x0ba3('0x5'));var BPromise=require(_0x0ba3('0x6'));var _=require(_0x0ba3('0x7'));function handleError(_0x3c79f6,_0x477d11,_0x407647){_0x477d11=_0x477d11||0x1f4;return function(_0x47a683){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x407647,_0x477d11,util[_0x0ba3('0x8')](_0x47a683,{'showHidden':![],'depth':null}));delete _0x47a683['name'];_0x3c79f6[_0x0ba3('0x9')](_0x477d11)['send'](_0x47a683);};}exports[_0x0ba3('0xa')]=function(_0x13a461,_0x4218b9){return info[_0x0ba3('0xb')]()['then'](function(_0x443429){return _0x4218b9[_0x0ba3('0x9')](0xc8)[_0x0ba3('0xc')](_0x443429);})[_0x0ba3('0xd')](function(_0x297e6a){return _0x4218b9['status'](0x1f4)[_0x0ba3('0xc')](_0x297e6a);});};exports[_0x0ba3('0xe')]=function(_0x29d2ef,_0x50c076){var _0x4bf02c=[_0x0ba3('0xf')];return new BPromise(function(_0x18dc1f,_0x28a41c){return exec(util[_0x0ba3('0x10')](_0x0ba3('0x11'),_0x29d2ef[_0x0ba3('0x12')][_0x0ba3('0x13')]),function(_0x4b1731,_0x253cc7,_0x136880){if(_0x4b1731){return _0x28a41c(_0x4b1731);}return _0x18dc1f(_0x253cc7);});})[_0x0ba3('0x14')](function(_0x977f68){var _0x34f2d3=![];var _0x2dbbca=_0x977f68['split'](/\n/);for(var _0x2ba603=0x0,_0x42da53=_0x4bf02c[_0x0ba3('0x15')];_0x2ba603<_0x42da53,_0x34f2d3===![];_0x2ba603+=0x1){if(_0x977f68[_0x0ba3('0x16')](_0x4bf02c[_0x2ba603])>=0x0){_0x34f2d3=!![];}}if(!_0x34f2d3){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x29d2ef[_0x0ba3('0x12')]['pid']));}process[_0x0ba3('0x17')](_0x29d2ef['params'][_0x0ba3('0x13')],_0x0ba3('0x18'));return _0x50c076['status'](0xc8)[_0x0ba3('0xc')]({'message':util[_0x0ba3('0x10')](_0x0ba3('0x19'),_0x29d2ef[_0x0ba3('0x12')][_0x0ba3('0x13')])});})[_0x0ba3('0xd')](handleError(_0x50c076,null,_0x0ba3('0xe')));}; \ No newline at end of file +var _0x471d=['lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process','exec','../../config/logger','api','util','bluebird'];(function(_0x372400,_0xdaeb10){var _0x4cd28c=function(_0x497d1f){while(--_0x497d1f){_0x372400['push'](_0x372400['shift']());}};_0x4cd28c(++_0xdaeb10);}(_0x471d,0xd2));var _0xd471=function(_0x465371,_0xc830d0){_0x465371=_0x465371-0x0;var _0x3bfb77=_0x471d[_0x465371];return _0x3bfb77;};'use strict';var info=require('systeminformation');var exec=require(_0xd471('0x0'))[_0xd471('0x1')];var logger=require(_0xd471('0x2'))(_0xd471('0x3'));var util=require(_0xd471('0x4'));var BPromise=require(_0xd471('0x5'));var _=require(_0xd471('0x6'));function handleError(_0x2bd66f,_0x5d21f7,_0x2b6ad9){_0x5d21f7=_0x5d21f7||0x1f4;return function(_0x3af5d3){logger['error'](_0xd471('0x7'),_0x2b6ad9,_0x5d21f7,util['inspect'](_0x3af5d3,{'showHidden':![],'depth':null}));delete _0x3af5d3['name'];_0x2bd66f[_0xd471('0x8')](_0x5d21f7)[_0xd471('0x9')](_0x3af5d3);};}exports[_0xd471('0xa')]=function(_0x3e0f35,_0x31dd05){return info[_0xd471('0xb')]()['then'](function(_0x17008f){return _0x31dd05[_0xd471('0x8')](0xc8)[_0xd471('0xc')](_0x17008f);})[_0xd471('0xd')](function(_0x200761){return _0x31dd05[_0xd471('0x8')](0x1f4)[_0xd471('0xc')](_0x200761);});};exports['killProcess']=function(_0xecfb75,_0x4ac123){var _0x98cae2=[_0xd471('0xe')];return new BPromise(function(_0x5d70e7,_0x192963){return exec(util[_0xd471('0xf')](_0xd471('0x10'),_0xecfb75['params'][_0xd471('0x11')]),function(_0x22ce89,_0x4f4f0d,_0x3eed49){if(_0x22ce89){return _0x192963(_0x22ce89);}return _0x5d70e7(_0x4f4f0d);});})[_0xd471('0x12')](function(_0x10b2c4){var _0x52f51b=![];var _0x3795b9=_0x10b2c4[_0xd471('0x13')](/\n/);for(var _0x4fcd8a=0x0,_0x465e4d=_0x98cae2['length'];_0x4fcd8a<_0x465e4d,_0x52f51b===![];_0x4fcd8a+=0x1){if(_0x10b2c4[_0xd471('0x14')](_0x98cae2[_0x4fcd8a])>=0x0){_0x52f51b=!![];}}if(!_0x52f51b){throw new Error(util[_0xd471('0xf')](_0xd471('0x15'),_0xecfb75[_0xd471('0x16')][_0xd471('0x11')]));}process[_0xd471('0x17')](_0xecfb75['params'][_0xd471('0x11')],_0xd471('0x18'));return _0x4ac123['status'](0xc8)[_0xd471('0xc')]({'message':util[_0xd471('0xf')](_0xd471('0x19'),_0xecfb75[_0xd471('0x16')][_0xd471('0x11')])});})[_0xd471('0xd')](handleError(_0x4ac123,null,_0xd471('0x1a')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 3027260..7bb94d1 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 _0x6f0d=['post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','get','/describe','describe','show'];(function(_0x15b8d7,_0x57a4a5){var _0x27108d=function(_0x883cfc){while(--_0x883cfc){_0x15b8d7['push'](_0x15b8d7['shift']());}};_0x27108d(++_0x57a4a5);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5a97b6,_0x46a222){_0x5a97b6=_0x5a97b6-0x0;var _0x43ee14=_0x6f0d[_0x5a97b6];return _0x43ee14;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')]('/',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);router['put'](_0xd6f0('0x10'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x11')]);router[_0xd6f0('0x12')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x13')]);module[_0xd6f0('0x14')]=router; \ No newline at end of file +var _0x54ef=['/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','index','get'];(function(_0x3078d8,_0x297362){var _0x5466b2=function(_0x147d35){while(--_0x147d35){_0x3078d8['push'](_0x3078d8['shift']());}};_0x5466b2(++_0x297362);}(_0x54ef,0x112));var _0xf54e=function(_0x5cb0fa,_0x3d12c3){_0x5cb0fa=_0x5cb0fa-0x0;var _0x451b0e=_0x54ef[_0x5cb0fa];return _0x451b0e;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router['get'](_0xf54e('0xe'),auth[_0xf54e('0xf')](),controller['show']);router[_0xf54e('0x10')]('/',auth[_0xf54e('0xf')](),controller[_0xf54e('0x11')]);router[_0xf54e('0x12')]('/:id',auth[_0xf54e('0xf')](),controller[_0xf54e('0x13')]);router[_0xf54e('0x14')](_0xf54e('0xe'),auth['isAuthenticated'](),controller[_0xf54e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 639af99..e2995d4 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 _0x3264=['name','exports','STRING'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x3264,0x7f));var _0x4326=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x3264[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require('sequelize');module[_0x4326('0x0')]={'name':{'type':Sequelize[_0x4326('0x1')],'unique':_0x4326('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4326('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c02=['STRING','sequelize','exports'];(function(_0x1c3105,_0x27cd45){var _0x1a542d=function(_0x5d869e){while(--_0x5d869e){_0x1c3105['push'](_0x1c3105['shift']());}};_0x1a542d(++_0x27cd45);}(_0x9c02,0x196));var _0x29c0=function(_0x4fbdb0,_0x9b980d){_0x4fbdb0=_0x4fbdb0-0x0;var _0x21309d=_0x9c02[_0x4fbdb0];return _0x21309d;};'use strict';var Sequelize=require(_0x29c0('0x0'));module[_0x29c0('0x1')]={'name':{'type':Sequelize[_0x29c0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0fad79f..f15428e 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 _0x7e02=['filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Tag','includeAll','include','findAll','catch','find','create','body','user','role','userProfileId','autoAssociation','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','apply','then','destroy','get','Tags','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x4dca77,_0x2c28ef){var _0x12dc7f=function(_0x4b1582){while(--_0x4b1582){_0x4dca77['push'](_0x4dca77['shift']());}};_0x12dc7f(++_0x2c28ef);}(_0x7e02,0x71));var _0x27e0=function(_0x2d818b,_0x3f2c79){_0x2d818b=_0x2d818b-0x0;var _0x3798a9=_0x7e02[_0x2d818b];return _0x3798a9;};'use strict';var emlformat=require(_0x27e0('0x0'));var rimraf=require(_0x27e0('0x1'));var zipdir=require(_0x27e0('0x2'));var jsonpatch=require(_0x27e0('0x3'));var rp=require(_0x27e0('0x4'));var moment=require(_0x27e0('0x5'));var BPromise=require(_0x27e0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x27e0('0x7'));var sox=require('sox');var csv=require(_0x27e0('0x8'));var ejs=require(_0x27e0('0x9'));var fs=require('fs');var fs_extra=require(_0x27e0('0xa'));var _=require(_0x27e0('0xb'));var squel=require(_0x27e0('0xc'));var crypto=require(_0x27e0('0xd'));var jsforce=require(_0x27e0('0xe'));var deskjs=require(_0x27e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27e0('0x10'));var Papa=require('papaparse');var Redis=require(_0x27e0('0x11'));var authService=require(_0x27e0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x27e0('0x13'));var hardwareService=require(_0x27e0('0x14'));var logger=require(_0x27e0('0x15'))(_0x27e0('0x16'));var utils=require(_0x27e0('0x17'));var config=require(_0x27e0('0x18'));var licenseUtil=require(_0x27e0('0x19'));var db=require(_0x27e0('0x1a'))['db'];function respondWithStatusCode(_0x31ef33,_0x492c65){_0x492c65=_0x492c65||0xcc;return function(_0x156bea){if(_0x156bea){return _0x31ef33[_0x27e0('0x1b')](_0x492c65);}return _0x31ef33[_0x27e0('0x1c')](_0x492c65)['end']();};}function respondWithResult(_0x39fb61,_0x3a67ab){_0x3a67ab=_0x3a67ab||0xc8;return function(_0x473128){if(_0x473128){return _0x39fb61['status'](_0x3a67ab)[_0x27e0('0x1d')](_0x473128);}};}function respondWithFilteredResult(_0x220128,_0x1f7532){return function(_0xf326e2){if(_0xf326e2){var _0x5b1b6e=typeof _0x1f7532['offset']===_0x27e0('0x1e')&&typeof _0x1f7532[_0x27e0('0x1f')]===_0x27e0('0x1e');var _0x2111e=_0xf326e2['count'];var _0x32597b=_0x5b1b6e?0x0:_0x1f7532[_0x27e0('0x20')];var _0x12a91f=_0x5b1b6e?_0xf326e2[_0x27e0('0x21')]:_0x1f7532[_0x27e0('0x20')]+_0x1f7532[_0x27e0('0x1f')];var _0x4d9edc;if(_0x12a91f>=_0x2111e){_0x12a91f=_0x2111e;_0x4d9edc=0xc8;}else{_0x4d9edc=0xce;}_0x220128[_0x27e0('0x1c')](_0x4d9edc);return _0x220128[_0x27e0('0x22')]('Content-Range',_0x32597b+'-'+_0x12a91f+'/'+_0x2111e)[_0x27e0('0x1d')](_0xf326e2);}return null;};}function patchUpdates(_0x23df66){return function(_0x32c2ff){try{jsonpatch[_0x27e0('0x23')](_0x32c2ff,_0x23df66,!![]);}catch(_0x408d95){return BPromise['reject'](_0x408d95);}return _0x32c2ff['save']();};}function saveUpdates(_0x57897e,_0x1ef3aa){return function(_0x11f4ca){if(_0x11f4ca){return _0x11f4ca['update'](_0x57897e)[_0x27e0('0x24')](function(_0xee6318){return _0xee6318;});}return null;};}function removeEntity(_0x32503e,_0x6f83ee){return function(_0xd857c2){if(_0xd857c2){return _0xd857c2[_0x27e0('0x25')]()[_0x27e0('0x24')](function(){var _0x371039=_0xd857c2[_0x27e0('0x26')]({'plain':!![]});var _0x3068c4=_0x27e0('0x27');return db[_0x27e0('0x28')][_0x27e0('0x25')]({'where':{'type':_0x3068c4,'resourceId':_0x371039['id']}})[_0x27e0('0x24')](function(){return _0xd857c2;});})[_0x27e0('0x24')](function(){_0x32503e['status'](0xcc)[_0x27e0('0x29')]();});}};}function handleEntityNotFound(_0x44b237,_0x20d1e3){return function(_0x7e00da){if(!_0x7e00da){_0x44b237[_0x27e0('0x1b')](0x194);}return _0x7e00da;};}function handleError(_0x54bc21,_0x599404){_0x599404=_0x599404||0x1f4;return function(_0x29114d){logger[_0x27e0('0x2a')](_0x29114d[_0x27e0('0x2b')]);if(_0x29114d[_0x27e0('0x2c')]){delete _0x29114d['name'];}_0x54bc21['status'](_0x599404)[_0x27e0('0x2d')](_0x29114d);};}exports[_0x27e0('0x2e')]=function(_0x5a28e6,_0x55d752){var _0x551794={},_0xdedb73={},_0x384e11={'count':0x0,'rows':[]};var _0x24605a=_[_0x27e0('0x2f')](db['Tag'][_0x27e0('0x30')],function(_0x3847a0){return{'name':_0x3847a0[_0x27e0('0x31')],'type':_0x3847a0[_0x27e0('0x32')][_0x27e0('0x33')]};});_0xdedb73[_0x27e0('0x34')]=_[_0x27e0('0x2f')](_0x24605a,_0x27e0('0x2c'));_0xdedb73[_0x27e0('0x35')]=_[_0x27e0('0x36')](_0x5a28e6['query']);_0xdedb73[_0x27e0('0x37')]=_[_0x27e0('0x38')](_0xdedb73['model'],_0xdedb73['query']);_0x551794[_0x27e0('0x39')]=_[_0x27e0('0x38')](_0xdedb73[_0x27e0('0x34')],qs['fields'](_0x5a28e6[_0x27e0('0x35')][_0x27e0('0x3a')]));_0x551794['attributes']=_0x551794[_0x27e0('0x39')][_0x27e0('0x3b')]?_0x551794['attributes']:_0xdedb73[_0x27e0('0x34')];if(!_0x5a28e6[_0x27e0('0x35')]['hasOwnProperty'](_0x27e0('0x3c'))){_0x551794[_0x27e0('0x1f')]=qs['limit'](_0x5a28e6['query'][_0x27e0('0x1f')]);_0x551794[_0x27e0('0x20')]=qs[_0x27e0('0x20')](_0x5a28e6[_0x27e0('0x35')]['offset']);}_0x551794[_0x27e0('0x3d')]=qs['sort'](_0x5a28e6[_0x27e0('0x35')][_0x27e0('0x3e')]);_0x551794[_0x27e0('0x3f')]=qs['filters'](_[_0x27e0('0x40')](_0x5a28e6[_0x27e0('0x35')],_0xdedb73['filters']),_0x24605a);if(_0x5a28e6['query'][_0x27e0('0x41')]){_0x551794[_0x27e0('0x3f')]=_[_0x27e0('0x42')](_0x551794[_0x27e0('0x3f')],{'$or':_['map'](_0x24605a,function(_0x5378ee){if(_0x5378ee['type']!==_0x27e0('0x43')){var _0x318c30={};_0x318c30[_0x5378ee['name']]={'$like':'%'+_0x5a28e6['query']['filter']+'%'};return _0x318c30;}})});}_0x551794=_[_0x27e0('0x42')]({},_0x551794,_0x5a28e6[_0x27e0('0x44')]);var _0x237e21={'where':_0x551794[_0x27e0('0x3f')]};return db[_0x27e0('0x45')][_0x27e0('0x21')](_0x237e21)[_0x27e0('0x24')](function(_0x3f81ba){_0x384e11[_0x27e0('0x21')]=_0x3f81ba;if(_0x5a28e6[_0x27e0('0x35')][_0x27e0('0x46')]){_0x551794[_0x27e0('0x47')]=[{'all':!![]}];}return db[_0x27e0('0x45')][_0x27e0('0x48')](_0x551794);})[_0x27e0('0x24')](function(_0x535260){_0x384e11['rows']=_0x535260;return _0x384e11;})[_0x27e0('0x24')](respondWithFilteredResult(_0x55d752,_0x551794))[_0x27e0('0x49')](handleError(_0x55d752,null));};exports['show']=function(_0x59462f,_0x5548aa){var _0x3a6b20={'raw':!![],'where':{'id':_0x59462f['params']['id']}},_0x399d95={};_0x399d95['model']=_[_0x27e0('0x36')](db[_0x27e0('0x45')][_0x27e0('0x30')]);_0x399d95[_0x27e0('0x35')]=_[_0x27e0('0x36')](_0x59462f[_0x27e0('0x35')]);_0x399d95[_0x27e0('0x37')]=_[_0x27e0('0x38')](_0x399d95[_0x27e0('0x34')],_0x399d95[_0x27e0('0x35')]);_0x3a6b20[_0x27e0('0x39')]=_[_0x27e0('0x38')](_0x399d95[_0x27e0('0x34')],qs[_0x27e0('0x3a')](_0x59462f[_0x27e0('0x35')][_0x27e0('0x3a')]));_0x3a6b20[_0x27e0('0x39')]=_0x3a6b20[_0x27e0('0x39')][_0x27e0('0x3b')]?_0x3a6b20[_0x27e0('0x39')]:_0x399d95[_0x27e0('0x34')];if(_0x59462f[_0x27e0('0x35')][_0x27e0('0x46')]){_0x3a6b20[_0x27e0('0x47')]=[{'all':!![]}];}_0x3a6b20=_[_0x27e0('0x42')]({},_0x3a6b20,_0x59462f[_0x27e0('0x44')]);return db[_0x27e0('0x45')][_0x27e0('0x4a')](_0x3a6b20)['then'](handleEntityNotFound(_0x5548aa,null))['then'](respondWithResult(_0x5548aa,null))[_0x27e0('0x49')](handleError(_0x5548aa,null));};exports[_0x27e0('0x4b')]=function(_0x5322c9,_0x58aef9){return db[_0x27e0('0x45')][_0x27e0('0x4b')](_0x5322c9[_0x27e0('0x4c')],{})[_0x27e0('0x24')](function(_0x3c1af4){var _0x1c2933=_0x5322c9[_0x27e0('0x4d')]['get']({'plain':!![]});if(!_0x1c2933)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c2933[_0x27e0('0x4e')]===_0x27e0('0x4d')){var _0xca08c=_0x3c1af4[_0x27e0('0x26')]({'plain':!![]});var _0x46108a=_0x27e0('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x46108a,'userProfileId':_0x1c2933[_0x27e0('0x4f')]},'raw':!![]})[_0x27e0('0x24')](function(_0x45b702){if(_0x45b702&&_0x45b702[_0x27e0('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0xca08c[_0x27e0('0x2c')],'resourceId':_0xca08c['id'],'type':_0x45b702[_0x27e0('0x2c')],'sectionId':_0x45b702['id']},{})['then'](function(){return _0x3c1af4;});}else{return _0x3c1af4;}})[_0x27e0('0x49')](function(_0x1a7e93){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a7e93);throw _0x1a7e93;});}return _0x3c1af4;})['then'](respondWithResult(_0x58aef9,0xc9))[_0x27e0('0x49')](handleError(_0x58aef9,null));};exports[_0x27e0('0x51')]=function(_0x2247fb,_0x4c44cb){if(_0x2247fb[_0x27e0('0x4c')]['id']){delete _0x2247fb[_0x27e0('0x4c')]['id'];}return db[_0x27e0('0x45')][_0x27e0('0x4a')]({'where':{'id':_0x2247fb[_0x27e0('0x52')]['id']}})[_0x27e0('0x24')](handleEntityNotFound(_0x4c44cb,null))[_0x27e0('0x24')](saveUpdates(_0x2247fb[_0x27e0('0x4c')],null))[_0x27e0('0x24')](respondWithResult(_0x4c44cb,null))[_0x27e0('0x49')](handleError(_0x4c44cb,null));};exports[_0x27e0('0x25')]=function(_0x5599be,_0x4416e8){return db[_0x27e0('0x45')][_0x27e0('0x4a')]({'where':{'id':_0x5599be[_0x27e0('0x52')]['id']}})['then'](handleEntityNotFound(_0x4416e8,null))[_0x27e0('0x24')](removeEntity(_0x4416e8,null))[_0x27e0('0x49')](handleError(_0x4416e8,null));};exports[_0x27e0('0x53')]=function(_0x3ff30d,_0x439911){return db[_0x27e0('0x45')]['describe']()[_0x27e0('0x24')](respondWithResult(_0x439911,null))[_0x27e0('0x49')](handleError(_0x439911,null));}; \ No newline at end of file +var _0xea98=['stack','name','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','end','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea98,0xd8));var _0x8ea9=function(_0x8f14c6,_0x253e30){_0x8f14c6=_0x8f14c6-0x0;var _0x548769=_0xea98[_0x8f14c6];return _0x548769;};'use strict';var emlformat=require(_0x8ea9('0x0'));var rimraf=require(_0x8ea9('0x1'));var zipdir=require(_0x8ea9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ea9('0x3'));var moment=require(_0x8ea9('0x4'));var BPromise=require(_0x8ea9('0x5'));var Mustache=require(_0x8ea9('0x6'));var util=require('util');var path=require(_0x8ea9('0x7'));var sox=require(_0x8ea9('0x8'));var csv=require(_0x8ea9('0x9'));var ejs=require(_0x8ea9('0xa'));var fs=require('fs');var fs_extra=require(_0x8ea9('0xb'));var _=require(_0x8ea9('0xc'));var squel=require('squel');var crypto=require(_0x8ea9('0xd'));var jsforce=require(_0x8ea9('0xe'));var deskjs=require(_0x8ea9('0xf'));var toCsv=require(_0x8ea9('0x9'));var querystring=require(_0x8ea9('0x10'));var Papa=require('papaparse');var Redis=require(_0x8ea9('0x11'));var authService=require(_0x8ea9('0x12'));var qs=require(_0x8ea9('0x13'));var as=require(_0x8ea9('0x14'));var hardwareService=require(_0x8ea9('0x15'));var logger=require(_0x8ea9('0x16'))(_0x8ea9('0x17'));var utils=require(_0x8ea9('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8ea9('0x19'))['db'];function respondWithStatusCode(_0x34e851,_0x5b8082){_0x5b8082=_0x5b8082||0xcc;return function(_0x46aa9e){if(_0x46aa9e){return _0x34e851[_0x8ea9('0x1a')](_0x5b8082);}return _0x34e851[_0x8ea9('0x1b')](_0x5b8082)['end']();};}function respondWithResult(_0x162b4b,_0x3e55ca){_0x3e55ca=_0x3e55ca||0xc8;return function(_0x5962d0){if(_0x5962d0){return _0x162b4b[_0x8ea9('0x1b')](_0x3e55ca)[_0x8ea9('0x1c')](_0x5962d0);}};}function respondWithFilteredResult(_0x4e1bc8,_0x43b4cf){return function(_0x501fe6){if(_0x501fe6){var _0x3d18f9=typeof _0x43b4cf[_0x8ea9('0x1d')]==='undefined'&&typeof _0x43b4cf[_0x8ea9('0x1e')]===_0x8ea9('0x1f');var _0x4a1d76=_0x501fe6[_0x8ea9('0x20')];var _0x1ff50e=_0x3d18f9?0x0:_0x43b4cf[_0x8ea9('0x1d')];var _0x58cae3=_0x3d18f9?_0x501fe6[_0x8ea9('0x20')]:_0x43b4cf[_0x8ea9('0x1d')]+_0x43b4cf[_0x8ea9('0x1e')];var _0x23e59b;if(_0x58cae3>=_0x4a1d76){_0x58cae3=_0x4a1d76;_0x23e59b=0xc8;}else{_0x23e59b=0xce;}_0x4e1bc8[_0x8ea9('0x1b')](_0x23e59b);return _0x4e1bc8[_0x8ea9('0x21')](_0x8ea9('0x22'),_0x1ff50e+'-'+_0x58cae3+'/'+_0x4a1d76)[_0x8ea9('0x1c')](_0x501fe6);}return null;};}function patchUpdates(_0x2585e3){return function(_0x34e8a8){try{jsonpatch[_0x8ea9('0x23')](_0x34e8a8,_0x2585e3,!![]);}catch(_0x128dda){return BPromise[_0x8ea9('0x24')](_0x128dda);}return _0x34e8a8[_0x8ea9('0x25')]();};}function saveUpdates(_0x1e0d0d,_0x3a067c){return function(_0x5cceac){if(_0x5cceac){return _0x5cceac[_0x8ea9('0x26')](_0x1e0d0d)[_0x8ea9('0x27')](function(_0x20c550){return _0x20c550;});}return null;};}function removeEntity(_0x2f691d,_0x369058){return function(_0x20ef0e){if(_0x20ef0e){return _0x20ef0e[_0x8ea9('0x28')]()[_0x8ea9('0x27')](function(){var _0x18c124=_0x20ef0e[_0x8ea9('0x29')]({'plain':!![]});var _0xd0c891=_0x8ea9('0x2a');return db['UserProfileResource'][_0x8ea9('0x28')]({'where':{'type':_0xd0c891,'resourceId':_0x18c124['id']}})[_0x8ea9('0x27')](function(){return _0x20ef0e;});})[_0x8ea9('0x27')](function(){_0x2f691d[_0x8ea9('0x1b')](0xcc)[_0x8ea9('0x2b')]();});}};}function handleEntityNotFound(_0x3c34a8,_0x36fa02){return function(_0x20ff98){if(!_0x20ff98){_0x3c34a8[_0x8ea9('0x1a')](0x194);}return _0x20ff98;};}function handleError(_0x5c385b,_0x16c783){_0x16c783=_0x16c783||0x1f4;return function(_0x397a28){logger[_0x8ea9('0x2c')](_0x397a28[_0x8ea9('0x2d')]);if(_0x397a28[_0x8ea9('0x2e')]){delete _0x397a28[_0x8ea9('0x2e')];}_0x5c385b[_0x8ea9('0x1b')](_0x16c783)['send'](_0x397a28);};}exports['index']=function(_0x1daa06,_0xeb388a){var _0x21b8e0={},_0x5956d6={},_0x5ae561={'count':0x0,'rows':[]};var _0x158c4e=_[_0x8ea9('0x2f')](db[_0x8ea9('0x30')][_0x8ea9('0x31')],function(_0x4bc043){return{'name':_0x4bc043[_0x8ea9('0x32')],'type':_0x4bc043[_0x8ea9('0x33')][_0x8ea9('0x34')]};});_0x5956d6[_0x8ea9('0x35')]=_['map'](_0x158c4e,_0x8ea9('0x2e'));_0x5956d6[_0x8ea9('0x36')]=_[_0x8ea9('0x37')](_0x1daa06[_0x8ea9('0x36')]);_0x5956d6[_0x8ea9('0x38')]=_[_0x8ea9('0x39')](_0x5956d6['model'],_0x5956d6[_0x8ea9('0x36')]);_0x21b8e0[_0x8ea9('0x3a')]=_[_0x8ea9('0x39')](_0x5956d6['model'],qs[_0x8ea9('0x3b')](_0x1daa06[_0x8ea9('0x36')]['fields']));_0x21b8e0[_0x8ea9('0x3a')]=_0x21b8e0[_0x8ea9('0x3a')][_0x8ea9('0x3c')]?_0x21b8e0['attributes']:_0x5956d6['model'];if(!_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x3d')](_0x8ea9('0x3e'))){_0x21b8e0[_0x8ea9('0x1e')]=qs[_0x8ea9('0x1e')](_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x1e')]);_0x21b8e0['offset']=qs[_0x8ea9('0x1d')](_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x1d')]);}_0x21b8e0[_0x8ea9('0x3f')]=qs[_0x8ea9('0x40')](_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x40')]);_0x21b8e0[_0x8ea9('0x41')]=qs[_0x8ea9('0x38')](_[_0x8ea9('0x42')](_0x1daa06['query'],_0x5956d6[_0x8ea9('0x38')]),_0x158c4e);if(_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x43')]){_0x21b8e0[_0x8ea9('0x41')]=_[_0x8ea9('0x44')](_0x21b8e0['where'],{'$or':_[_0x8ea9('0x2f')](_0x158c4e,function(_0x47ed01){if(_0x47ed01['type']!=='VIRTUAL'){var _0x326b6c={};_0x326b6c[_0x47ed01[_0x8ea9('0x2e')]]={'$like':'%'+_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x43')]+'%'};return _0x326b6c;}})});}_0x21b8e0=_[_0x8ea9('0x44')]({},_0x21b8e0,_0x1daa06['options']);var _0x493a0e={'where':_0x21b8e0['where']};return db['Tag'][_0x8ea9('0x20')](_0x493a0e)[_0x8ea9('0x27')](function(_0x28a61e){_0x5ae561[_0x8ea9('0x20')]=_0x28a61e;if(_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x45')]){_0x21b8e0[_0x8ea9('0x46')]=[{'all':!![]}];}return db[_0x8ea9('0x30')]['findAll'](_0x21b8e0);})[_0x8ea9('0x27')](function(_0x832edf){_0x5ae561[_0x8ea9('0x47')]=_0x832edf;return _0x5ae561;})[_0x8ea9('0x27')](respondWithFilteredResult(_0xeb388a,_0x21b8e0))[_0x8ea9('0x48')](handleError(_0xeb388a,null));};exports[_0x8ea9('0x49')]=function(_0x212517,_0x1c208a){var _0x32e0d4={'raw':!![],'where':{'id':_0x212517[_0x8ea9('0x4a')]['id']}},_0x5eec31={};_0x5eec31[_0x8ea9('0x35')]=_[_0x8ea9('0x37')](db[_0x8ea9('0x30')][_0x8ea9('0x31')]);_0x5eec31[_0x8ea9('0x36')]=_['keys'](_0x212517[_0x8ea9('0x36')]);_0x5eec31[_0x8ea9('0x38')]=_[_0x8ea9('0x39')](_0x5eec31['model'],_0x5eec31[_0x8ea9('0x36')]);_0x32e0d4['attributes']=_[_0x8ea9('0x39')](_0x5eec31['model'],qs[_0x8ea9('0x3b')](_0x212517['query'][_0x8ea9('0x3b')]));_0x32e0d4[_0x8ea9('0x3a')]=_0x32e0d4[_0x8ea9('0x3a')][_0x8ea9('0x3c')]?_0x32e0d4[_0x8ea9('0x3a')]:_0x5eec31[_0x8ea9('0x35')];if(_0x212517[_0x8ea9('0x36')][_0x8ea9('0x45')]){_0x32e0d4[_0x8ea9('0x46')]=[{'all':!![]}];}_0x32e0d4=_['merge']({},_0x32e0d4,_0x212517[_0x8ea9('0x4b')]);return db[_0x8ea9('0x30')][_0x8ea9('0x4c')](_0x32e0d4)['then'](handleEntityNotFound(_0x1c208a,null))[_0x8ea9('0x27')](respondWithResult(_0x1c208a,null))['catch'](handleError(_0x1c208a,null));};exports[_0x8ea9('0x4d')]=function(_0x11e0f4,_0x390bcf){return db[_0x8ea9('0x30')]['create'](_0x11e0f4['body'],{})[_0x8ea9('0x27')](function(_0x2dcd93){var _0x1ca23d=_0x11e0f4[_0x8ea9('0x4e')][_0x8ea9('0x29')]({'plain':!![]});if(!_0x1ca23d)throw new Error(_0x8ea9('0x4f'));if(_0x1ca23d[_0x8ea9('0x50')]==='user'){var _0x13166c=_0x2dcd93[_0x8ea9('0x29')]({'plain':!![]});var _0x124d11=_0x8ea9('0x2a');return db[_0x8ea9('0x51')][_0x8ea9('0x4c')]({'where':{'name':_0x124d11,'userProfileId':_0x1ca23d[_0x8ea9('0x52')]},'raw':!![]})[_0x8ea9('0x27')](function(_0x199476){if(_0x199476&&_0x199476[_0x8ea9('0x53')]===0x0){return db[_0x8ea9('0x54')][_0x8ea9('0x4d')]({'name':_0x13166c[_0x8ea9('0x2e')],'resourceId':_0x13166c['id'],'type':_0x199476[_0x8ea9('0x2e')],'sectionId':_0x199476['id']},{})[_0x8ea9('0x27')](function(){return _0x2dcd93;});}else{return _0x2dcd93;}})['catch'](function(_0x1fc27a){logger[_0x8ea9('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fc27a);throw _0x1fc27a;});}return _0x2dcd93;})[_0x8ea9('0x27')](respondWithResult(_0x390bcf,0xc9))[_0x8ea9('0x48')](handleError(_0x390bcf,null));};exports['update']=function(_0x3f9a44,_0x547456){if(_0x3f9a44[_0x8ea9('0x55')]['id']){delete _0x3f9a44[_0x8ea9('0x55')]['id'];}return db[_0x8ea9('0x30')][_0x8ea9('0x4c')]({'where':{'id':_0x3f9a44[_0x8ea9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x547456,null))[_0x8ea9('0x27')](saveUpdates(_0x3f9a44['body'],null))[_0x8ea9('0x27')](respondWithResult(_0x547456,null))['catch'](handleError(_0x547456,null));};exports[_0x8ea9('0x28')]=function(_0x5b370a,_0x2c0883){return db[_0x8ea9('0x30')]['find']({'where':{'id':_0x5b370a[_0x8ea9('0x4a')]['id']}})[_0x8ea9('0x27')](handleEntityNotFound(_0x2c0883,null))[_0x8ea9('0x27')](removeEntity(_0x2c0883,null))[_0x8ea9('0x48')](handleError(_0x2c0883,null));};exports['describe']=function(_0x22da6d,_0x449b94){return db[_0x8ea9('0x30')][_0x8ea9('0x56')]()[_0x8ea9('0x27')](respondWithResult(_0x449b94,null))[_0x8ea9('0x48')](handleError(_0x449b94,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 010ffea..9ca4182 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 _0xe5b3=['request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','util','../../config/logger','api','moment','bluebird'];(function(_0x219fa0,_0x18b239){var _0xc603fb=function(_0x3371ad){while(--_0x3371ad){_0x219fa0['push'](_0x219fa0['shift']());}};_0xc603fb(++_0x18b239);}(_0xe5b3,0x133));var _0x3e5b=function(_0x185656,_0x36b620){_0x185656=_0x185656-0x0;var _0x24a077=_0xe5b3[_0x185656];return _0x24a077;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Tag',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b15=['rimraf','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4e1f18,_0x3ad500){var _0x30a99b=function(_0x42d861){while(--_0x42d861){_0x4e1f18['push'](_0x4e1f18['shift']());}};_0x30a99b(++_0x3ad500);}(_0x9b15,0x191));var _0x59b1=function(_0x5b850c,_0x33c569){_0x5b850c=_0x5b850c-0x0;var _0x33887b=_0x9b15[_0x5b850c];return _0x33887b;};'use strict';var _=require(_0x59b1('0x0'));var util=require(_0x59b1('0x1'));var logger=require(_0x59b1('0x2'))('api');var moment=require(_0x59b1('0x3'));var BPromise=require(_0x59b1('0x4'));var rp=require(_0x59b1('0x5'));var fs=require('fs');var path=require(_0x59b1('0x6'));var rimraf=require(_0x59b1('0x7'));var config=require('../../config/environment');var attributes=require(_0x59b1('0x8'));module[_0x59b1('0x9')]=function(_0x5f3c1b,_0x2cbac0){return _0x5f3c1b['define'](_0x59b1('0xa'),attributes,{'tableName':_0x59b1('0xb'),'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 5f98529..210daae 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 _0x5089=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0x5089,0x1bb));var _0x9508=function(_0x1c7f48,_0x255687){_0x1c7f48=_0x1c7f48-0x0;var _0x274c31=_0x5089[_0x1c7f48];return _0x274c31;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var moment=require('moment');var BPromise=require(_0x9508('0x2'));var rs=require(_0x9508('0x3'));var fs=require('fs');var Redis=require(_0x9508('0x4'));var db=require(_0x9508('0x5'))['db'];var utils=require(_0x9508('0x6'));var logger=require('../../config/logger')(_0x9508('0x7'));var config=require('../../config/environment');var jayson=require(_0x9508('0x8'));var client=jayson[_0x9508('0x9')][_0x9508('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ab3c6,_0x1dc04c,_0x42d13a){return new BPromise(function(_0x55a5de,_0x14dae7){return client[_0x9508('0xb')](_0x4ab3c6,_0x42d13a)['then'](function(_0x342ddd){logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));logger[_0x9508('0xe')](_0x9508('0xf'),_0x1dc04c,_0x9508('0xd'),JSON[_0x9508('0x10')](_0x342ddd));if(_0x342ddd['error']){if(_0x342ddd[_0x9508('0x11')]['code']===0x1f4){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x342ddd['error'][_0x9508('0x12')]);return _0x14dae7(_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);}logger[_0x9508('0x11')]('Tag,\x20%s,\x20%s',_0x1dc04c,_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);return _0x55a5de(_0x342ddd['error'][_0x9508('0x12')]);}else{logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));_0x55a5de(_0x342ddd[_0x9508('0x13')][_0x9508('0x12')]);}})[_0x9508('0x14')](function(_0x343802){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x343802);_0x14dae7(_0x343802);});});} \ No newline at end of file +var _0x106f=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird'];(function(_0x3864d3,_0x1079ff){var _0xc0d25d=function(_0x533d90){while(--_0x533d90){_0x3864d3['push'](_0x3864d3['shift']());}};_0xc0d25d(++_0x1079ff);}(_0x106f,0x162));var _0xf106=function(_0x105c58,_0x38f3db){_0x105c58=_0x105c58-0x0;var _0x419ffc=_0x106f[_0x105c58];return _0x419ffc;};'use strict';var _=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var moment=require('moment');var BPromise=require(_0xf106('0x2'));var rs=require(_0xf106('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf106('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf106('0x5'))(_0xf106('0x6'));var config=require(_0xf106('0x7'));var jayson=require(_0xf106('0x8'));var client=jayson[_0xf106('0x9')][_0xf106('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc9588d,_0x546acc,_0x4ea3b8){return new BPromise(function(_0x3ac1bd,_0x5ea4f0){return client['request'](_0xc9588d,_0x4ea3b8)['then'](function(_0x4bd78d){logger['info'](_0xf106('0xb'),_0x546acc,_0xf106('0xc'));logger[_0xf106('0xd')](_0xf106('0xe'),_0x546acc,_0xf106('0xc'),JSON[_0xf106('0xf')](_0x4bd78d));if(_0x4bd78d[_0xf106('0x10')]){if(_0x4bd78d[_0xf106('0x10')][_0xf106('0x11')]===0x1f4){logger[_0xf106('0x10')](_0xf106('0xb'),_0x546acc,_0x4bd78d['error'][_0xf106('0x12')]);return _0x5ea4f0(_0x4bd78d[_0xf106('0x10')]['message']);}logger['error'](_0xf106('0xb'),_0x546acc,_0x4bd78d[_0xf106('0x10')][_0xf106('0x12')]);return _0x3ac1bd(_0x4bd78d['error'][_0xf106('0x12')]);}else{logger[_0xf106('0x13')](_0xf106('0xb'),_0x546acc,'request\x20sent');_0x3ac1bd(_0x4bd78d[_0xf106('0x14')][_0xf106('0x12')]);}})['catch'](function(_0x134f6d){logger[_0xf106('0x10')](_0xf106('0xb'),_0x546acc,_0x134f6d);_0x5ea4f0(_0x134f6d);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d87e57f..c992f55 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_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 +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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 4f81096..bf7d4af 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xb7e7[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 4c7c6b7..28f8843 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 _0x177f=['findAll','rows','catch','show','params','keys','include','options','find','create','body','user','get','role','Teams','UserProfileSection','userProfileId','UserProfileResource','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','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','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','isValidChannel','capitalize','toLowerCase','Queue','sort','addQueues','Unknown\x20channel','add','Queues','ids','remove','addAgents','isArray','Chat','Mail','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','Voice','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','format','all','removeAgents','Sms','Queue:remove','TeamVoicePrefix','getAgents','filter','hasOwnProperty','nolimit','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','name','send','index','map','Team','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','order','pick','merge','where','type','includeAll'];(function(_0x49df95,_0x28358a){var _0x457a6a=function(_0x100673){while(--_0x100673){_0x49df95['push'](_0x49df95['shift']());}};_0x457a6a(++_0x28358a);}(_0x177f,0xf5));var _0xf177=function(_0x478bbc,_0x54c396){_0x478bbc=_0x478bbc-0x0;var _0x237ca0=_0x177f[_0x478bbc];return _0x237ca0;};'use strict';var emlformat=require(_0xf177('0x0'));var rimraf=require(_0xf177('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf177('0x2'));var moment=require(_0xf177('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf177('0x4'));var util=require(_0xf177('0x5'));var path=require(_0xf177('0x6'));var sox=require('sox');var csv=require(_0xf177('0x7'));var ejs=require(_0xf177('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf177('0x9'));var squel=require(_0xf177('0xa'));var crypto=require(_0xf177('0xb'));var jsforce=require(_0xf177('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf177('0x7'));var querystring=require(_0xf177('0xd'));var Papa=require(_0xf177('0xe'));var Redis=require(_0xf177('0xf'));var authService=require(_0xf177('0x10'));var qs=require(_0xf177('0x11'));var as=require(_0xf177('0x12'));var hardwareService=require(_0xf177('0x13'));var logger=require(_0xf177('0x14'))(_0xf177('0x15'));var utils=require(_0xf177('0x16'));var config=require(_0xf177('0x17'));var licenseUtil=require(_0xf177('0x18'));var db=require(_0xf177('0x19'))['db'];config[_0xf177('0x1a')]=_[_0xf177('0x1b')](config[_0xf177('0x1a')],{'host':_0xf177('0x1c'),'port':0x18eb});var socket=require(_0xf177('0x1d'))(new Redis(config[_0xf177('0x1a')]));require(_0xf177('0x1e'))[_0xf177('0x1f')](socket);function respondWithStatusCode(_0x4c15a5,_0x4b865c){_0x4b865c=_0x4b865c||0xcc;return function(_0x57aab4){if(_0x57aab4){return _0x4c15a5[_0xf177('0x20')](_0x4b865c);}return _0x4c15a5['status'](_0x4b865c)['end']();};}function respondWithResult(_0x859e1,_0x3b5514){_0x3b5514=_0x3b5514||0xc8;return function(_0x59881f){if(_0x59881f){return _0x859e1[_0xf177('0x21')](_0x3b5514)[_0xf177('0x22')](_0x59881f);}};}function respondWithFilteredResult(_0x233e5b,_0x349661){return function(_0x43b536){if(_0x43b536){var _0x31b3d8=typeof _0x349661[_0xf177('0x23')]===_0xf177('0x24')&&typeof _0x349661[_0xf177('0x25')]==='undefined';var _0x40f8f2=_0x43b536['count'];var _0x4cf74d=_0x31b3d8?0x0:_0x349661['offset'];var _0x302da5=_0x31b3d8?_0x43b536[_0xf177('0x26')]:_0x349661[_0xf177('0x23')]+_0x349661[_0xf177('0x25')];var _0x1aff5d;if(_0x302da5>=_0x40f8f2){_0x302da5=_0x40f8f2;_0x1aff5d=0xc8;}else{_0x1aff5d=0xce;}_0x233e5b[_0xf177('0x21')](_0x1aff5d);return _0x233e5b[_0xf177('0x27')](_0xf177('0x28'),_0x4cf74d+'-'+_0x302da5+'/'+_0x40f8f2)[_0xf177('0x22')](_0x43b536);}return null;};}function patchUpdates(_0x23f00f){return function(_0x26c4c4){try{jsonpatch[_0xf177('0x29')](_0x26c4c4,_0x23f00f,!![]);}catch(_0x178ee3){return BPromise['reject'](_0x178ee3);}return _0x26c4c4[_0xf177('0x2a')]();};}function saveUpdates(_0x5e8197,_0x5ca7ed){return function(_0x3d66ce){if(_0x3d66ce){return _0x3d66ce['update'](_0x5e8197)[_0xf177('0x2b')](function(_0xed5da){return _0xed5da;});}return null;};}function handleEntityNotFound(_0x3ad449,_0x5508a){return function(_0x142b66){if(!_0x142b66){_0x3ad449[_0xf177('0x20')](0x194);}return _0x142b66;};}function handleError(_0x327168,_0x2d95fc){_0x2d95fc=_0x2d95fc||0x1f4;return function(_0x1c7781){logger[_0xf177('0x2c')](_0x1c7781['stack']);if(_0x1c7781[_0xf177('0x2d')]){delete _0x1c7781[_0xf177('0x2d')];}_0x327168['status'](_0x2d95fc)[_0xf177('0x2e')](_0x1c7781);};}exports[_0xf177('0x2f')]=function(_0x268739,_0x337d14){var _0x24c65a={},_0xd4a804={},_0x496c29={'count':0x0,'rows':[]};var _0x1d80c6=_[_0xf177('0x30')](db[_0xf177('0x31')][_0xf177('0x32')],function(_0xca29f3){return{'name':_0xca29f3['fieldName'],'type':_0xca29f3['type'][_0xf177('0x33')]};});_0xd4a804[_0xf177('0x34')]=_[_0xf177('0x30')](_0x1d80c6,'name');_0xd4a804[_0xf177('0x35')]=_['keys'](_0x268739[_0xf177('0x35')]);_0xd4a804[_0xf177('0x36')]=_[_0xf177('0x37')](_0xd4a804[_0xf177('0x34')],_0xd4a804['query']);_0x24c65a[_0xf177('0x38')]=_['intersection'](_0xd4a804['model'],qs[_0xf177('0x39')](_0x268739['query'][_0xf177('0x39')]));_0x24c65a['attributes']=_0x24c65a[_0xf177('0x38')][_0xf177('0x3a')]?_0x24c65a['attributes']:_0xd4a804[_0xf177('0x34')];if(!_0x268739[_0xf177('0x35')]['hasOwnProperty']('nolimit')){_0x24c65a[_0xf177('0x25')]=qs['limit'](_0x268739[_0xf177('0x35')][_0xf177('0x25')]);_0x24c65a[_0xf177('0x23')]=qs[_0xf177('0x23')](_0x268739[_0xf177('0x35')][_0xf177('0x23')]);}_0x24c65a[_0xf177('0x3b')]=qs['sort'](_0x268739[_0xf177('0x35')]['sort']);_0x24c65a['where']=qs['filters'](_[_0xf177('0x3c')](_0x268739[_0xf177('0x35')],_0xd4a804[_0xf177('0x36')]),_0x1d80c6);if(_0x268739[_0xf177('0x35')]['filter']){_0x24c65a['where']=_[_0xf177('0x3d')](_0x24c65a[_0xf177('0x3e')],{'$or':_[_0xf177('0x30')](_0x1d80c6,function(_0x46382c){if(_0x46382c[_0xf177('0x3f')]!=='VIRTUAL'){var _0x4c5064={};_0x4c5064[_0x46382c[_0xf177('0x2d')]]={'$like':'%'+_0x268739['query']['filter']+'%'};return _0x4c5064;}})});}_0x24c65a=_[_0xf177('0x3d')]({},_0x24c65a,_0x268739['options']);var _0x22e905={'where':_0x24c65a[_0xf177('0x3e')]};return db[_0xf177('0x31')][_0xf177('0x26')](_0x22e905)[_0xf177('0x2b')](function(_0x554d39){_0x496c29[_0xf177('0x26')]=_0x554d39;if(_0x268739[_0xf177('0x35')][_0xf177('0x40')]){_0x24c65a['include']=[{'all':!![]}];}return db[_0xf177('0x31')][_0xf177('0x41')](_0x24c65a);})[_0xf177('0x2b')](function(_0x1b680b){_0x496c29[_0xf177('0x42')]=_0x1b680b;return _0x496c29;})['then'](respondWithFilteredResult(_0x337d14,_0x24c65a))[_0xf177('0x43')](handleError(_0x337d14,null));};exports[_0xf177('0x44')]=function(_0x3f2329,_0x3d9d04){var _0x545e10={'raw':![],'where':{'id':_0x3f2329[_0xf177('0x45')]['id']}},_0x4d98fe={};_0x4d98fe[_0xf177('0x34')]=_[_0xf177('0x46')](db['Team'][_0xf177('0x32')]);_0x4d98fe[_0xf177('0x35')]=_[_0xf177('0x46')](_0x3f2329['query']);_0x4d98fe[_0xf177('0x36')]=_['intersection'](_0x4d98fe[_0xf177('0x34')],_0x4d98fe['query']);_0x545e10['attributes']=_[_0xf177('0x37')](_0x4d98fe[_0xf177('0x34')],qs[_0xf177('0x39')](_0x3f2329[_0xf177('0x35')][_0xf177('0x39')]));_0x545e10[_0xf177('0x38')]=_0x545e10['attributes']['length']?_0x545e10[_0xf177('0x38')]:_0x4d98fe['model'];if(_0x3f2329[_0xf177('0x35')][_0xf177('0x40')]){_0x545e10[_0xf177('0x47')]=[{'all':!![]}];}_0x545e10=_[_0xf177('0x3d')]({},_0x545e10,_0x3f2329[_0xf177('0x48')]);return db[_0xf177('0x31')][_0xf177('0x49')](_0x545e10)[_0xf177('0x2b')](handleEntityNotFound(_0x3d9d04,null))[_0xf177('0x2b')](respondWithResult(_0x3d9d04,null))['catch'](handleError(_0x3d9d04,null));};exports[_0xf177('0x4a')]=function(_0x2f70ed,_0x4a312e){return db[_0xf177('0x31')]['create'](_0x2f70ed[_0xf177('0x4b')],{})['then'](function(_0x1d6568){var _0x5cbc12=_0x2f70ed[_0xf177('0x4c')][_0xf177('0x4d')]({'plain':!![]});if(!_0x5cbc12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cbc12[_0xf177('0x4e')]==='user'){var _0x346726=_0x1d6568[_0xf177('0x4d')]({'plain':!![]});var _0x22898e=_0xf177('0x4f');return db[_0xf177('0x50')][_0xf177('0x49')]({'where':{'name':_0x22898e,'userProfileId':_0x5cbc12[_0xf177('0x51')]},'raw':!![]})['then'](function(_0x27252a){if(_0x27252a&&_0x27252a['autoAssociation']===0x0){return db[_0xf177('0x52')]['create']({'name':_0x346726[_0xf177('0x2d')],'resourceId':_0x346726['id'],'type':_0x27252a[_0xf177('0x2d')],'sectionId':_0x27252a['id']},{})['then'](function(){return _0x1d6568;});}else{return _0x1d6568;}})[_0xf177('0x43')](function(_0x2f17e){logger[_0xf177('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f17e);throw _0x2f17e;});}return _0x1d6568;})[_0xf177('0x2b')](respondWithResult(_0x4a312e,0xc9))[_0xf177('0x43')](handleError(_0x4a312e,null));};exports['update']=function(_0x3eeed2,_0x22de0f){if(_0x3eeed2[_0xf177('0x4b')]['id']){delete _0x3eeed2[_0xf177('0x4b')]['id'];}return db[_0xf177('0x31')][_0xf177('0x49')]({'where':{'id':_0x3eeed2['params']['id']}})[_0xf177('0x2b')](handleEntityNotFound(_0x22de0f,null))['then'](saveUpdates(_0x3eeed2['body'],null))[_0xf177('0x2b')](respondWithResult(_0x22de0f,null))['catch'](handleError(_0x22de0f,null));};exports[_0xf177('0x53')]=function(_0x5cbfe9,_0x45d9d6){var _0x44bf79=_0x5cbfe9[_0xf177('0x45')]['id'];var _0x5db9ae=[];return db[_0xf177('0x54')]['transaction'](function(_0xd5b563){var _0x29823c=_0xf177('0x55')+_0x44bf79;return db[_0xf177('0x54')][_0xf177('0x35')](_0x29823c,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xd5b563})[_0xf177('0x2b')](function(_0x2b35a5){_0x5db9ae=_[_0xf177('0x30')](_0x2b35a5,function(_0x37f845){return Number(_0x37f845[_0xf177('0x56')]);});})[_0xf177('0x2b')](function(){var _0x42685a=_0xf177('0x57')+_0x44bf79;return db[_0xf177('0x54')][_0xf177('0x35')](_0x42685a,{'type':db['Sequelize'][_0xf177('0x58')][_0xf177('0x59')],'raw':!![],'transaction':_0xd5b563});})[_0xf177('0x2b')](function(_0x3ff993){var _0x61b151=_['map'](_0x3ff993,function(_0x2d823b){return Number(_0x2d823b[_0xf177('0x5a')]);});return db[_0xf177('0x5b')][_0xf177('0x53')]({'where':{'UserId':{'$in':_0x5db9ae},'VoiceQueueId':{'$in':_0x61b151}},'transaction':_0xd5b563});})[_0xf177('0x2b')](function(){var _0x5601a8=_0xf177('0x5c')+_0x44bf79;return db[_0xf177('0x54')]['query'](_0x5601a8,{'type':db['Sequelize']['QueryTypes'][_0xf177('0x59')],'raw':!![],'transaction':_0xd5b563});})[_0xf177('0x2b')](function(_0x20f10e){var _0x3a5c32=_[_0xf177('0x30')](_0x20f10e,function(_0x4276ce){return Number(_0x4276ce[_0xf177('0x5d')]);});return db[_0xf177('0x5e')][_0xf177('0x53')]({'where':{'UserId':{'$in':_0x5db9ae},'MailQueueId':{'$in':_0x3a5c32}},'transaction':_0xd5b563});})['then'](function(){var _0x4f8c2b=_0xf177('0x5f')+_0x44bf79;return db['sequelize'][_0xf177('0x35')](_0x4f8c2b,{'type':db[_0xf177('0x60')][_0xf177('0x58')][_0xf177('0x59')],'raw':!![],'transaction':_0xd5b563});})[_0xf177('0x2b')](function(_0x172072){var _0x5af4c0=_[_0xf177('0x30')](_0x172072,function(_0x54727d){return Number(_0x54727d[_0xf177('0x61')]);});return db[_0xf177('0x62')]['destroy']({'where':{'UserId':{'$in':_0x5db9ae},'SmsQueueId':{'$in':_0x5af4c0}},'transaction':_0xd5b563});})['then'](function(){var _0x5d6b68=_0xf177('0x63')+_0x44bf79;return db[_0xf177('0x54')]['query'](_0x5d6b68,{'type':db['Sequelize'][_0xf177('0x58')][_0xf177('0x59')],'raw':!![],'transaction':_0xd5b563});})[_0xf177('0x2b')](function(_0x581bee){var _0x49782b=_[_0xf177('0x30')](_0x581bee,function(_0x56b80b){return Number(_0x56b80b[_0xf177('0x64')]);});return db['UserChatQueue'][_0xf177('0x53')]({'where':{'UserId':{'$in':_0x5db9ae},'ChatQueueId':{'$in':_0x49782b}},'transaction':_0xd5b563});})[_0xf177('0x2b')](function(){var _0x202f9d=_0xf177('0x65')+_0x44bf79;return db[_0xf177('0x54')]['query'](_0x202f9d,{'type':db[_0xf177('0x60')]['QueryTypes'][_0xf177('0x59')],'raw':!![],'transaction':_0xd5b563});})[_0xf177('0x2b')](function(_0x4264c9){var _0x8f6175=_['map'](_0x4264c9,function(_0x5cae5c){return Number(_0x5cae5c['FaxQueueId']);});return db['UserFaxQueue'][_0xf177('0x53')]({'where':{'UserId':{'$in':_0x5db9ae},'FaxQueueId':{'$in':_0x8f6175}},'transaction':_0xd5b563});})['then'](function(){var _0x5f1438='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x44bf79;return db[_0xf177('0x54')]['query'](_0x5f1438,{'type':db[_0xf177('0x60')][_0xf177('0x58')][_0xf177('0x59')],'raw':!![],'transaction':_0xd5b563});})[_0xf177('0x2b')](function(_0xc6612f){var _0x449488=_[_0xf177('0x30')](_0xc6612f,function(_0x3be298){return Number(_0x3be298[_0xf177('0x66')]);});return db['UserOpenchannelQueue'][_0xf177('0x53')]({'where':{'UserId':{'$in':_0x5db9ae},'OpenchannelQueueId':{'$in':_0x449488}},'transaction':_0xd5b563});})[_0xf177('0x2b')](function(){var _0x3bf8b3=_0xf177('0x67')+_0x44bf79;return db[_0xf177('0x54')][_0xf177('0x35')](_0x3bf8b3,{'type':db[_0xf177('0x60')]['QueryTypes'][_0xf177('0x59')],'raw':!![],'transaction':_0xd5b563});})['then'](function(_0x3d6f13){var _0x4c9c6e=_[_0xf177('0x30')](_0x3d6f13,function(_0xeb7fd0){return Number(_0xeb7fd0[_0xf177('0x68')]);});return db[_0xf177('0x69')][_0xf177('0x53')]({'where':{'UserId':{'$in':_0x5db9ae},'WhatsappQueueId':{'$in':_0x4c9c6e}},'transaction':_0xd5b563});})[_0xf177('0x2b')](function(){return db['TeamVoicePrefix'][_0xf177('0x49')]({'where':{'TeamId':_0x44bf79}});})['then'](function(_0x4c76b2){if(_0x4c76b2===null){return;}return db[_0xf177('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x5db9ae},'VoicePrefixId':_0x4c76b2[_0xf177('0x6b')]},'transaction':_0xd5b563});})[_0xf177('0x2b')](function(){return db['Team'][_0xf177('0x53')]({'where':{'id':_0x44bf79},'cascade':!![],'transaction':_0xd5b563});})[_0xf177('0x2b')](function(_0x27bdfd){if(_0x27bdfd===0x0){_0x45d9d6[_0xf177('0x20')](0x194);}else{return db[_0xf177('0x52')][_0xf177('0x53')]({'where':{'type':_0xf177('0x4f'),'resourceId':_0x44bf79},'cascade':!![],'transaction':_0xd5b563})[_0xf177('0x2b')](function(){_0x45d9d6[_0xf177('0x21')](0xcc)[_0xf177('0x6c')]();});}})[_0xf177('0x43')](function(_0x262e00){_0x45d9d6[_0xf177('0x21')](0x1f4)[_0xf177('0x2e')](_0x262e00);});});};exports[_0xf177('0x6d')]=function(_0x10edcf,_0x42f63e,_0xcbcde4){return db[_0xf177('0x31')][_0xf177('0x6e')]({'where':{'id':_0x10edcf[_0xf177('0x45')]['id']}})[_0xf177('0x2b')](handleEntityNotFound(_0x42f63e,null))['then'](function(_0x5656cd){if(!_0x10edcf['query'][_0xf177('0x6f')]||!utils[_0xf177('0x70')](_0x10edcf[_0xf177('0x35')][_0xf177('0x6f')])){throw new db[(_0xf177('0x60'))]['ValidationError']('Unknown\x20channel');}var _0x506fe9={};var _0x26ce57={};_0x26ce57[_0xf177('0x34')]=_[_0xf177('0x46')](db[_[_0xf177('0x71')](_0x10edcf[_0xf177('0x35')][_0xf177('0x6f')][_0xf177('0x72')]())+_0xf177('0x73')]['rawAttributes']);_0x26ce57[_0xf177('0x35')]=_[_0xf177('0x46')](_0x10edcf[_0xf177('0x35')]);_0x26ce57[_0xf177('0x36')]=_[_0xf177('0x37')](_0x26ce57[_0xf177('0x34')],_0x26ce57[_0xf177('0x35')]);_0x506fe9['attributes']=_[_0xf177('0x37')](_0x26ce57[_0xf177('0x34')],qs[_0xf177('0x39')](_0x10edcf[_0xf177('0x35')]['fields']));_0x506fe9['attributes']=_0x506fe9[_0xf177('0x38')]['length']?_0x506fe9[_0xf177('0x38')]:_0x26ce57['model'];_0x506fe9['limit']=qs['limit'](_0x10edcf[_0xf177('0x35')]['limit']);_0x506fe9[_0xf177('0x23')]=qs['offset'](_0x10edcf['query'][_0xf177('0x23')]);_0x506fe9[_0xf177('0x3b')]=qs[_0xf177('0x74')](_0x10edcf[_0xf177('0x35')][_0xf177('0x74')]);_0x506fe9['where']=qs[_0xf177('0x36')](_['pick'](_0x10edcf[_0xf177('0x35')],_0x26ce57['filters']));_0x506fe9=_[_0xf177('0x3d')]({},_0x506fe9,_0x10edcf[_0xf177('0x48')]);return _0x5656cd[_0xf177('0x4d')+_['capitalize'](_0x10edcf['query'][_0xf177('0x6f')]['toLowerCase']())+'Queues'](_0x506fe9);})[_0xf177('0x2b')](respondWithResult(_0x42f63e,null))[_0xf177('0x43')](handleError(_0x42f63e,null));};exports[_0xf177('0x75')]=function(_0x5b87ba,_0x50aec9,_0xac541f){return db[_0xf177('0x31')]['findOne']({'where':{'id':_0x5b87ba[_0xf177('0x45')]['id']}})[_0xf177('0x2b')](function(_0x3e7203){if(_0x3e7203){if(!_0x5b87ba['body'][_0xf177('0x6f')]||!utils[_0xf177('0x70')](_0x5b87ba[_0xf177('0x4b')][_0xf177('0x6f')])){throw new db['Sequelize']['ValidationError'](_0xf177('0x76'));}return _0x3e7203[_0xf177('0x77')+_['capitalize'](_0x5b87ba[_0xf177('0x4b')][_0xf177('0x6f')][_0xf177('0x72')]())+_0xf177('0x78')](_0x5b87ba['body'][_0xf177('0x79')]);}return null;})[_0xf177('0x2b')](handleEntityNotFound(_0x50aec9,null))[_0xf177('0x2b')](respondWithStatusCode(_0x50aec9,null))['catch'](handleError(_0x50aec9,null));};exports['removeQueues']=function(_0x35718d,_0x19da44,_0x1814ee){return db[_0xf177('0x31')][_0xf177('0x6e')]({'where':{'id':_0x35718d['params']['id']}})[_0xf177('0x2b')](function(_0x563b23){if(_0x563b23){if(!_0x35718d[_0xf177('0x35')]['channel']||!utils[_0xf177('0x70')](_0x35718d[_0xf177('0x35')]['channel'])){throw new db[(_0xf177('0x60'))]['ValidationError'](_0xf177('0x76'));}return _0x563b23[_0xf177('0x7a')+_[_0xf177('0x71')](_0x35718d[_0xf177('0x35')]['channel'][_0xf177('0x72')]())+_0xf177('0x78')](_0x35718d[_0xf177('0x35')]['ids']);}return null;})[_0xf177('0x2b')](handleEntityNotFound(_0x19da44,null))[_0xf177('0x2b')](respondWithStatusCode(_0x19da44,null))['catch'](handleError(_0x19da44,null));};exports[_0xf177('0x7b')]=function(_0x21fc16,_0x5c353e){var _0x5d2a9e=_[_0xf177('0x7c')](_0x21fc16['body'][_0xf177('0x79')])?_0x21fc16[_0xf177('0x4b')][_0xf177('0x79')]:[_0x21fc16[_0xf177('0x4b')][_0xf177('0x79')]];var _0x2d9786=_0x21fc16['params']['id'];return db[_0xf177('0x31')][_0xf177('0x49')]({'where':{'id':_0x2d9786}})[_0xf177('0x2b')](handleEntityNotFound(_0x5c353e,null))[_0xf177('0x2b')](function(_0x486ad7){if(_0x486ad7){var _0xaf4c77=['Voice',_0xf177('0x7d'),_0xf177('0x7e'),'Sms',_0xf177('0x7f'),_0xf177('0x80'),_0xf177('0x81')];return db['sequelize'][_0xf177('0x82')](function(_0x186a47){var _0x374bc4=_[_0xf177('0x30')](_0xaf4c77,function(_0x48c70f){var _0x11185f={'attributes':['id',_0xf177('0x2d')]};if(_0x48c70f==='Voice'){_0x11185f[_0xf177('0x83')]={'attributes':[_0xf177('0x84')]};}return _0x486ad7[_0xf177('0x4d')+_0x48c70f+_0xf177('0x78')](_0x11185f)['then'](function(_0x327e18){var _0x4ef2d5=_[_0xf177('0x30')](_0x327e18,function(_0x5b9998){var _0x1d78e8=_['map'](_0x5d2a9e,function(_0xd889d6){var _0x39d794={'where':{'UserId':_0xd889d6,[_0x48c70f+_0xf177('0x85')]:_0x5b9998['id']},'transaction':_0x186a47};if(_0x48c70f===_0xf177('0x86')){_0x39d794[_0xf177('0x1b')]={'penalty':_0x5b9998[_0xf177('0x87')][_0xf177('0x84')]};}return db[_0xf177('0x88')+_0x48c70f+_0xf177('0x73')][_0xf177('0x89')](_0x39d794)[_0xf177('0x2b')](function(){socket[_0xf177('0x8a')](_0xf177('0x4c')+_0x48c70f+_0xf177('0x8b'),{'UserId':_0xd889d6,[_0x48c70f+'QueueId']:_0x5b9998['id']});if(_0x48c70f!=='Voice'){return;}return db[_0xf177('0x88')]['findAll']({'where':{'id':_0x5d2a9e,'online':0x1},'attributes':['id',_0xf177('0x2d'),_0xf177('0x8c'),_0xf177('0x8d'),_0xf177('0x8e')],'raw':!![]})[_0xf177('0x2b')](function(_0x21cf31){var _0x29172d=_['map'](_0x21cf31,function(_0x568f20){return db[_0xf177('0x8f')][_0xf177('0x90')]({'membername':_0x568f20[_0xf177('0x2d')],'UserId':_0x568f20['id'],'queue_name':_0x5b9998[_0xf177('0x2d')],'VoiceQueueId':_0x5b9998['id'],'interface':_['isNil'](_0x568f20[_0xf177('0x8e')])?util[_0xf177('0x91')]('SIP/%s',_0x568f20[_0xf177('0x2d')]):_0x568f20[_0xf177('0x8e')],'paused':_0x568f20[_0xf177('0x8d')]||![],'penalty':_0x5b9998['TeamVoiceQueue'][_0xf177('0x84')]},{'transaction':_0x186a47});});return Promise[_0xf177('0x92')](_0x29172d);});});});return Promise[_0xf177('0x92')](_0x1d78e8);});return Promise[_0xf177('0x92')](_0x4ef2d5);})[_0xf177('0x2b')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x2d9786}})[_0xf177('0x2b')](function(_0x4a747b){if(_0x4a747b){var _0x27689d=_[_0xf177('0x30')](_0x5d2a9e,function(_0x453c38){db[_0xf177('0x6a')][_0xf177('0x90')]({'UserId':_0x453c38,'VoicePrefixId':_0x4a747b[_0xf177('0x6b')]});});return Promise[_0xf177('0x92')](_0x27689d);}});});});return Promise['all'](_0x374bc4)[_0xf177('0x2b')](function(){return _0x486ad7[_0xf177('0x7b')](_0x5d2a9e,{'transaction':_0x186a47})['spread'](function(_0x57ce97){return _0x57ce97;});});});}})[_0xf177('0x2b')](respondWithResult(_0x5c353e,null))[_0xf177('0x43')](handleError(_0x5c353e,null));};exports[_0xf177('0x93')]=function(_0x492543,_0x433bf2){var _0x388d00=_['isArray'](_0x492543[_0xf177('0x35')][_0xf177('0x79')])?_0x492543[_0xf177('0x35')]['ids']:[_0x492543[_0xf177('0x35')]['ids']];var _0x3ea10e=_0x492543[_0xf177('0x45')]['id'];return db[_0xf177('0x31')][_0xf177('0x49')]({'where':{'id':_0x3ea10e}})['then'](handleEntityNotFound(_0x433bf2,null))[_0xf177('0x2b')](function(_0x11da05){if(_0x11da05){var _0x27c3e6=[_0xf177('0x86'),_0xf177('0x7d'),_0xf177('0x7e'),_0xf177('0x94'),_0xf177('0x7f'),_0xf177('0x80'),_0xf177('0x81')];return db['sequelize'][_0xf177('0x82')](function(_0x4ca6e3){var _0x41d98f=_['map'](_0x27c3e6,function(_0x494c35){var _0x5963ad={'attributes':['id',_0xf177('0x2d')]};return _0x11da05[_0xf177('0x4d')+_0x494c35+_0xf177('0x78')](_0x5963ad)['then'](function(_0x38d310){var _0x2c0098=_['map'](_0x38d310,function(_0x20a454){return _0x20a454[_0xf177('0x93')](_0x388d00,{'transaction':_0x4ca6e3})[_0xf177('0x2b')](function(){var _0x33fdbd=_[_0xf177('0x30')](_0x388d00,function(_0x5d9cb6){socket[_0xf177('0x8a')](_0xf177('0x4c')+_0x494c35+_0xf177('0x95'),{'UserId':Number(_0x5d9cb6),[_0x494c35+_0xf177('0x85')]:_0x20a454['id']});if(_0x494c35!==_0xf177('0x86')){return;}return db[_0xf177('0x8f')][_0xf177('0x53')]({'where':{'VoiceQueueId':_0x20a454['id'],'UserId':_0x5d9cb6},'transaction':_0x4ca6e3});});return Promise['all'](_0x33fdbd);});});return Promise[_0xf177('0x92')](_0x2c0098);});});return Promise[_0xf177('0x92')](_0x41d98f)[_0xf177('0x2b')](function(){return _0x11da05[_0xf177('0x93')](_0x388d00,{'transaction':_0x4ca6e3});})[_0xf177('0x2b')](function(){return db[_0xf177('0x96')][_0xf177('0x6e')]({'where':{'teamId':_0x3ea10e}})[_0xf177('0x2b')](function(_0x583ef5){if(_0x583ef5){var _0x3e2fb3=_[_0xf177('0x30')](_0x388d00,function(_0x274755){db[_0xf177('0x6a')][_0xf177('0x53')]({'where':{'UserId':_0x274755,'VoicePrefixId':_0x583ef5[_0xf177('0x6b')]}});});return Promise[_0xf177('0x92')](_0x3e2fb3);}});});});}})[_0xf177('0x2b')](respondWithStatusCode(_0x433bf2,null))[_0xf177('0x43')](handleError(_0x433bf2,null));};exports[_0xf177('0x97')]=function(_0x16f6ad,_0x265e28,_0x50f2e3){var _0x31b190={};var _0x59deeb={};var _0x2630da;var _0x12d547;return db[_0xf177('0x31')]['findOne']({'where':{'id':_0x16f6ad['params']['id']}})[_0xf177('0x2b')](handleEntityNotFound(_0x265e28,null))['then'](function(_0x2a5c3c){if(_0x2a5c3c){_0x2630da=_0x2a5c3c;_0x59deeb[_0xf177('0x34')]=_[_0xf177('0x46')](db[_0xf177('0x88')][_0xf177('0x32')]);_0x59deeb[_0xf177('0x35')]=_['keys'](_0x16f6ad['query']);_0x59deeb[_0xf177('0x36')]=_[_0xf177('0x37')](_0x59deeb[_0xf177('0x34')],_0x59deeb[_0xf177('0x35')]);_0x31b190[_0xf177('0x38')]=_[_0xf177('0x37')](_0x59deeb[_0xf177('0x34')],qs[_0xf177('0x39')](_0x16f6ad[_0xf177('0x35')][_0xf177('0x39')]));_0x31b190[_0xf177('0x38')]=_0x31b190[_0xf177('0x38')][_0xf177('0x3a')]?_0x31b190['attributes']:_0x59deeb[_0xf177('0x34')];_0x31b190[_0xf177('0x3b')]=qs[_0xf177('0x74')](_0x16f6ad[_0xf177('0x35')][_0xf177('0x74')]);_0x31b190[_0xf177('0x3e')]=qs[_0xf177('0x36')](_['pick'](_0x16f6ad[_0xf177('0x35')],_0x59deeb[_0xf177('0x36')]));if(_0x16f6ad[_0xf177('0x35')][_0xf177('0x98')]){_0x31b190[_0xf177('0x3e')]=_['merge'](_0x31b190[_0xf177('0x3e')],{'$or':_['map'](_0x31b190[_0xf177('0x38')],function(_0x23ca9f){var _0x2ef085={};_0x2ef085[_0x23ca9f]={'$like':'%'+_0x16f6ad[_0xf177('0x35')]['filter']+'%'};return _0x2ef085;})});}_0x31b190=_[_0xf177('0x3d')]({},_0x31b190,_0x16f6ad[_0xf177('0x48')]);return _0x2630da[_0xf177('0x97')](_0x31b190);}})[_0xf177('0x2b')](function(_0x37d814){if(_0x37d814){_0x12d547=_0x37d814[_0xf177('0x3a')];if(!_0x16f6ad[_0xf177('0x35')][_0xf177('0x99')](_0xf177('0x9a'))){_0x31b190[_0xf177('0x25')]=qs[_0xf177('0x25')](_0x16f6ad[_0xf177('0x35')]['limit']);_0x31b190[_0xf177('0x23')]=qs[_0xf177('0x23')](_0x16f6ad[_0xf177('0x35')][_0xf177('0x23')]);}return _0x2630da[_0xf177('0x97')](_0x31b190);}})['then'](function(_0x1b89fb){if(_0x1b89fb){return _0x1b89fb?{'count':_0x12d547,'rows':_0x1b89fb}:null;}})[_0xf177('0x2b')](respondWithResult(_0x265e28,null))[_0xf177('0x43')](handleError(_0x265e28,null));}; \ No newline at end of file +var _0x198a=['name','send','index','map','Team','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','length','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','destroy','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','isValidChannel','Unknown\x20channel','capitalize','channel','toLowerCase','Queue','Queues','addQueues','ValidationError','add','removeQueues','ids','addAgents','isArray','Chat','Mail','Sms','Whatsapp','penalty','QueueId','Voice','TeamVoiceQueue','emit','Queue:save','User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Fax','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','error','stack'];(function(_0x531ad8,_0x5d0901){var _0x4ebe63=function(_0x57abe8){while(--_0x57abe8){_0x531ad8['push'](_0x531ad8['shift']());}};_0x4ebe63(++_0x5d0901);}(_0x198a,0x68));var _0xa198=function(_0x956b21,_0x4bd12f){_0x956b21=_0x956b21-0x0;var _0x4cc815=_0x198a[_0x956b21];return _0x4cc815;};'use strict';var emlformat=require(_0xa198('0x0'));var rimraf=require(_0xa198('0x1'));var zipdir=require(_0xa198('0x2'));var jsonpatch=require(_0xa198('0x3'));var rp=require(_0xa198('0x4'));var moment=require('moment');var BPromise=require(_0xa198('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa198('0x6'));var sox=require(_0xa198('0x7'));var csv=require(_0xa198('0x8'));var ejs=require(_0xa198('0x9'));var fs=require('fs');var fs_extra=require(_0xa198('0xa'));var _=require(_0xa198('0xb'));var squel=require('squel');var crypto=require(_0xa198('0xc'));var jsforce=require(_0xa198('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa198('0x8'));var querystring=require(_0xa198('0xe'));var Papa=require('papaparse');var Redis=require(_0xa198('0xf'));var authService=require(_0xa198('0x10'));var qs=require(_0xa198('0x11'));var as=require(_0xa198('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa198('0x13'));var utils=require(_0xa198('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa198('0x15'));var db=require(_0xa198('0x16'))['db'];config[_0xa198('0x17')]=_[_0xa198('0x18')](config[_0xa198('0x17')],{'host':_0xa198('0x19'),'port':0x18eb});var socket=require(_0xa198('0x1a'))(new Redis(config[_0xa198('0x17')]));require('./team.socket')[_0xa198('0x1b')](socket);function respondWithStatusCode(_0x44cab2,_0x5803fb){_0x5803fb=_0x5803fb||0xcc;return function(_0x49d934){if(_0x49d934){return _0x44cab2[_0xa198('0x1c')](_0x5803fb);}return _0x44cab2[_0xa198('0x1d')](_0x5803fb)[_0xa198('0x1e')]();};}function respondWithResult(_0x2fd891,_0x32b78f){_0x32b78f=_0x32b78f||0xc8;return function(_0x436996){if(_0x436996){return _0x2fd891[_0xa198('0x1d')](_0x32b78f)['json'](_0x436996);}};}function respondWithFilteredResult(_0x3e79de,_0x29d1eb){return function(_0x8872af){if(_0x8872af){var _0x38b673=typeof _0x29d1eb[_0xa198('0x1f')]==='undefined'&&typeof _0x29d1eb[_0xa198('0x20')]===_0xa198('0x21');var _0x4b0e5f=_0x8872af[_0xa198('0x22')];var _0x32dd78=_0x38b673?0x0:_0x29d1eb[_0xa198('0x1f')];var _0x41a41d=_0x38b673?_0x8872af[_0xa198('0x22')]:_0x29d1eb[_0xa198('0x1f')]+_0x29d1eb[_0xa198('0x20')];var _0x3beb01;if(_0x41a41d>=_0x4b0e5f){_0x41a41d=_0x4b0e5f;_0x3beb01=0xc8;}else{_0x3beb01=0xce;}_0x3e79de[_0xa198('0x1d')](_0x3beb01);return _0x3e79de[_0xa198('0x23')](_0xa198('0x24'),_0x32dd78+'-'+_0x41a41d+'/'+_0x4b0e5f)[_0xa198('0x25')](_0x8872af);}return null;};}function patchUpdates(_0x1a8225){return function(_0x322cbe){try{jsonpatch[_0xa198('0x26')](_0x322cbe,_0x1a8225,!![]);}catch(_0x45f1e3){return BPromise['reject'](_0x45f1e3);}return _0x322cbe[_0xa198('0x27')]();};}function saveUpdates(_0x15921f,_0x3ee287){return function(_0x738b12){if(_0x738b12){return _0x738b12[_0xa198('0x28')](_0x15921f)[_0xa198('0x29')](function(_0x5a5542){return _0x5a5542;});}return null;};}function handleEntityNotFound(_0xc4b6c1,_0x5b0254){return function(_0x3f01ed){if(!_0x3f01ed){_0xc4b6c1[_0xa198('0x1c')](0x194);}return _0x3f01ed;};}function handleError(_0x536d13,_0x226743){_0x226743=_0x226743||0x1f4;return function(_0x3ac18e){logger[_0xa198('0x2a')](_0x3ac18e[_0xa198('0x2b')]);if(_0x3ac18e[_0xa198('0x2c')]){delete _0x3ac18e[_0xa198('0x2c')];}_0x536d13['status'](_0x226743)[_0xa198('0x2d')](_0x3ac18e);};}exports[_0xa198('0x2e')]=function(_0x3d6689,_0x286d0f){var _0x496e90={},_0x1cad16={},_0x503400={'count':0x0,'rows':[]};var _0x3d251b=_[_0xa198('0x2f')](db[_0xa198('0x30')][_0xa198('0x31')],function(_0x36383a){return{'name':_0x36383a['fieldName'],'type':_0x36383a[_0xa198('0x32')][_0xa198('0x33')]};});_0x1cad16[_0xa198('0x34')]=_[_0xa198('0x2f')](_0x3d251b,_0xa198('0x2c'));_0x1cad16[_0xa198('0x35')]=_[_0xa198('0x36')](_0x3d6689['query']);_0x1cad16['filters']=_[_0xa198('0x37')](_0x1cad16[_0xa198('0x34')],_0x1cad16['query']);_0x496e90[_0xa198('0x38')]=_['intersection'](_0x1cad16[_0xa198('0x34')],qs[_0xa198('0x39')](_0x3d6689[_0xa198('0x35')][_0xa198('0x39')]));_0x496e90[_0xa198('0x38')]=_0x496e90['attributes']['length']?_0x496e90[_0xa198('0x38')]:_0x1cad16[_0xa198('0x34')];if(!_0x3d6689[_0xa198('0x35')][_0xa198('0x3a')](_0xa198('0x3b'))){_0x496e90['limit']=qs[_0xa198('0x20')](_0x3d6689[_0xa198('0x35')][_0xa198('0x20')]);_0x496e90[_0xa198('0x1f')]=qs['offset'](_0x3d6689['query'][_0xa198('0x1f')]);}_0x496e90[_0xa198('0x3c')]=qs[_0xa198('0x3d')](_0x3d6689[_0xa198('0x35')]['sort']);_0x496e90[_0xa198('0x3e')]=qs[_0xa198('0x3f')](_[_0xa198('0x40')](_0x3d6689[_0xa198('0x35')],_0x1cad16[_0xa198('0x3f')]),_0x3d251b);if(_0x3d6689[_0xa198('0x35')]['filter']){_0x496e90[_0xa198('0x3e')]=_[_0xa198('0x41')](_0x496e90['where'],{'$or':_[_0xa198('0x2f')](_0x3d251b,function(_0x4363c5){if(_0x4363c5[_0xa198('0x32')]!==_0xa198('0x42')){var _0xa4d7da={};_0xa4d7da[_0x4363c5[_0xa198('0x2c')]]={'$like':'%'+_0x3d6689[_0xa198('0x35')][_0xa198('0x43')]+'%'};return _0xa4d7da;}})});}_0x496e90=_[_0xa198('0x41')]({},_0x496e90,_0x3d6689[_0xa198('0x44')]);var _0x310bbb={'where':_0x496e90['where']};return db[_0xa198('0x30')][_0xa198('0x22')](_0x310bbb)[_0xa198('0x29')](function(_0x358cda){_0x503400[_0xa198('0x22')]=_0x358cda;if(_0x3d6689[_0xa198('0x35')]['includeAll']){_0x496e90['include']=[{'all':!![]}];}return db[_0xa198('0x30')][_0xa198('0x45')](_0x496e90);})[_0xa198('0x29')](function(_0x7bcc86){_0x503400[_0xa198('0x46')]=_0x7bcc86;return _0x503400;})[_0xa198('0x29')](respondWithFilteredResult(_0x286d0f,_0x496e90))[_0xa198('0x47')](handleError(_0x286d0f,null));};exports[_0xa198('0x48')]=function(_0x203012,_0x1dd80a){var _0x10594c={'raw':![],'where':{'id':_0x203012[_0xa198('0x49')]['id']}},_0x5a29d3={};_0x5a29d3['model']=_['keys'](db[_0xa198('0x30')]['rawAttributes']);_0x5a29d3['query']=_[_0xa198('0x36')](_0x203012[_0xa198('0x35')]);_0x5a29d3[_0xa198('0x3f')]=_[_0xa198('0x37')](_0x5a29d3[_0xa198('0x34')],_0x5a29d3[_0xa198('0x35')]);_0x10594c['attributes']=_[_0xa198('0x37')](_0x5a29d3[_0xa198('0x34')],qs[_0xa198('0x39')](_0x203012[_0xa198('0x35')]['fields']));_0x10594c[_0xa198('0x38')]=_0x10594c[_0xa198('0x38')][_0xa198('0x4a')]?_0x10594c['attributes']:_0x5a29d3[_0xa198('0x34')];if(_0x203012[_0xa198('0x35')][_0xa198('0x4b')]){_0x10594c['include']=[{'all':!![]}];}_0x10594c=_[_0xa198('0x41')]({},_0x10594c,_0x203012[_0xa198('0x44')]);return db[_0xa198('0x30')][_0xa198('0x4c')](_0x10594c)[_0xa198('0x29')](handleEntityNotFound(_0x1dd80a,null))[_0xa198('0x29')](respondWithResult(_0x1dd80a,null))[_0xa198('0x47')](handleError(_0x1dd80a,null));};exports['create']=function(_0x163618,_0x5b023d){return db[_0xa198('0x30')]['create'](_0x163618[_0xa198('0x4d')],{})[_0xa198('0x29')](function(_0x1c1713){var _0x40e796=_0x163618[_0xa198('0x4e')][_0xa198('0x4f')]({'plain':!![]});if(!_0x40e796)throw new Error(_0xa198('0x50'));if(_0x40e796[_0xa198('0x51')]===_0xa198('0x4e')){var _0x4581e0=_0x1c1713[_0xa198('0x4f')]({'plain':!![]});var _0x1985d1=_0xa198('0x52');return db[_0xa198('0x53')]['find']({'where':{'name':_0x1985d1,'userProfileId':_0x40e796[_0xa198('0x54')]},'raw':!![]})[_0xa198('0x29')](function(_0x5e9a69){if(_0x5e9a69&&_0x5e9a69['autoAssociation']===0x0){return db[_0xa198('0x55')]['create']({'name':_0x4581e0['name'],'resourceId':_0x4581e0['id'],'type':_0x5e9a69['name'],'sectionId':_0x5e9a69['id']},{})[_0xa198('0x29')](function(){return _0x1c1713;});}else{return _0x1c1713;}})[_0xa198('0x47')](function(_0x30eb8c){logger[_0xa198('0x2a')](_0xa198('0x56'),_0x30eb8c);throw _0x30eb8c;});}return _0x1c1713;})[_0xa198('0x29')](respondWithResult(_0x5b023d,0xc9))[_0xa198('0x47')](handleError(_0x5b023d,null));};exports[_0xa198('0x28')]=function(_0x502923,_0x2c4226){if(_0x502923[_0xa198('0x4d')]['id']){delete _0x502923[_0xa198('0x4d')]['id'];}return db['Team'][_0xa198('0x4c')]({'where':{'id':_0x502923[_0xa198('0x49')]['id']}})[_0xa198('0x29')](handleEntityNotFound(_0x2c4226,null))[_0xa198('0x29')](saveUpdates(_0x502923[_0xa198('0x4d')],null))[_0xa198('0x29')](respondWithResult(_0x2c4226,null))[_0xa198('0x47')](handleError(_0x2c4226,null));};exports['destroy']=function(_0xb989f,_0x3013bf){var _0x17e4e8=_0xb989f['params']['id'];var _0x59e63f=[];return db[_0xa198('0x57')][_0xa198('0x58')](function(_0x2fb46b){var _0x1e5ce6=_0xa198('0x59')+_0x17e4e8;return db['sequelize']['query'](_0x1e5ce6,{'type':db[_0xa198('0x5a')][_0xa198('0x5b')][_0xa198('0x5c')],'raw':!![],'transaction':_0x2fb46b})[_0xa198('0x29')](function(_0x1f7be5){_0x59e63f=_['map'](_0x1f7be5,function(_0x198e48){return Number(_0x198e48[_0xa198('0x5d')]);});})['then'](function(){var _0x1249c4=_0xa198('0x5e')+_0x17e4e8;return db[_0xa198('0x57')][_0xa198('0x35')](_0x1249c4,{'type':db['Sequelize'][_0xa198('0x5b')][_0xa198('0x5c')],'raw':!![],'transaction':_0x2fb46b});})[_0xa198('0x29')](function(_0x5034ce){var _0x598f8a=_[_0xa198('0x2f')](_0x5034ce,function(_0x429e40){return Number(_0x429e40[_0xa198('0x5f')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x59e63f},'VoiceQueueId':{'$in':_0x598f8a}},'transaction':_0x2fb46b});})[_0xa198('0x29')](function(){var _0x1b8691='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17e4e8;return db[_0xa198('0x57')][_0xa198('0x35')](_0x1b8691,{'type':db[_0xa198('0x5a')][_0xa198('0x5b')][_0xa198('0x5c')],'raw':!![],'transaction':_0x2fb46b});})[_0xa198('0x29')](function(_0x1dfb08){var _0x14d4c1=_[_0xa198('0x2f')](_0x1dfb08,function(_0x2be9d1){return Number(_0x2be9d1['MailQueueId']);});return db['UserMailQueue'][_0xa198('0x60')]({'where':{'UserId':{'$in':_0x59e63f},'MailQueueId':{'$in':_0x14d4c1}},'transaction':_0x2fb46b});})['then'](function(){var _0x24ae63=_0xa198('0x61')+_0x17e4e8;return db[_0xa198('0x57')]['query'](_0x24ae63,{'type':db[_0xa198('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x2fb46b});})['then'](function(_0x586b1d){var _0x2d0d26=_[_0xa198('0x2f')](_0x586b1d,function(_0x80e01){return Number(_0x80e01['SmsQueueId']);});return db[_0xa198('0x62')][_0xa198('0x60')]({'where':{'UserId':{'$in':_0x59e63f},'SmsQueueId':{'$in':_0x2d0d26}},'transaction':_0x2fb46b});})[_0xa198('0x29')](function(){var _0x31fa33=_0xa198('0x63')+_0x17e4e8;return db[_0xa198('0x57')][_0xa198('0x35')](_0x31fa33,{'type':db['Sequelize']['QueryTypes'][_0xa198('0x5c')],'raw':!![],'transaction':_0x2fb46b});})[_0xa198('0x29')](function(_0x3c2d5a){var _0x3c28b0=_[_0xa198('0x2f')](_0x3c2d5a,function(_0x822732){return Number(_0x822732[_0xa198('0x64')]);});return db[_0xa198('0x65')][_0xa198('0x60')]({'where':{'UserId':{'$in':_0x59e63f},'ChatQueueId':{'$in':_0x3c28b0}},'transaction':_0x2fb46b});})[_0xa198('0x29')](function(){var _0x5cba8e='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17e4e8;return db[_0xa198('0x57')]['query'](_0x5cba8e,{'type':db[_0xa198('0x5a')][_0xa198('0x5b')][_0xa198('0x5c')],'raw':!![],'transaction':_0x2fb46b});})[_0xa198('0x29')](function(_0x16dd2c){var _0x3ee0de=_[_0xa198('0x2f')](_0x16dd2c,function(_0x17356d){return Number(_0x17356d['FaxQueueId']);});return db['UserFaxQueue'][_0xa198('0x60')]({'where':{'UserId':{'$in':_0x59e63f},'FaxQueueId':{'$in':_0x3ee0de}},'transaction':_0x2fb46b});})[_0xa198('0x29')](function(){var _0x28e1fa='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17e4e8;return db['sequelize']['query'](_0x28e1fa,{'type':db[_0xa198('0x5a')][_0xa198('0x5b')][_0xa198('0x5c')],'raw':!![],'transaction':_0x2fb46b});})[_0xa198('0x29')](function(_0x19c41a){var _0x45e1d2=_['map'](_0x19c41a,function(_0x5707ce){return Number(_0x5707ce[_0xa198('0x66')]);});return db[_0xa198('0x67')][_0xa198('0x60')]({'where':{'UserId':{'$in':_0x59e63f},'OpenchannelQueueId':{'$in':_0x45e1d2}},'transaction':_0x2fb46b});})['then'](function(){var _0x4f83a6=_0xa198('0x68')+_0x17e4e8;return db['sequelize']['query'](_0x4f83a6,{'type':db[_0xa198('0x5a')][_0xa198('0x5b')][_0xa198('0x5c')],'raw':!![],'transaction':_0x2fb46b});})[_0xa198('0x29')](function(_0x58c493){var _0x1e72c0=_['map'](_0x58c493,function(_0x530e49){return Number(_0x530e49['WhatsappQueueId']);});return db[_0xa198('0x69')][_0xa198('0x60')]({'where':{'UserId':{'$in':_0x59e63f},'WhatsappQueueId':{'$in':_0x1e72c0}},'transaction':_0x2fb46b});})['then'](function(){return db[_0xa198('0x6a')][_0xa198('0x4c')]({'where':{'TeamId':_0x17e4e8}});})[_0xa198('0x29')](function(_0x2132b1){if(_0x2132b1===null){return;}return db[_0xa198('0x6b')][_0xa198('0x60')]({'where':{'UserId':{'$in':_0x59e63f},'VoicePrefixId':_0x2132b1[_0xa198('0x6c')]},'transaction':_0x2fb46b});})['then'](function(){return db[_0xa198('0x30')][_0xa198('0x60')]({'where':{'id':_0x17e4e8},'cascade':!![],'transaction':_0x2fb46b});})[_0xa198('0x29')](function(_0x1a771b){if(_0x1a771b===0x0){_0x3013bf[_0xa198('0x1c')](0x194);}else{return db[_0xa198('0x55')][_0xa198('0x60')]({'where':{'type':_0xa198('0x52'),'resourceId':_0x17e4e8},'cascade':!![],'transaction':_0x2fb46b})[_0xa198('0x29')](function(){_0x3013bf[_0xa198('0x1d')](0xcc)['end']();});}})['catch'](function(_0x340c14){_0x3013bf['status'](0x1f4)[_0xa198('0x2d')](_0x340c14);});});};exports[_0xa198('0x6d')]=function(_0x4c45c5,_0xb7d1f5,_0x939371){return db[_0xa198('0x30')][_0xa198('0x6e')]({'where':{'id':_0x4c45c5[_0xa198('0x49')]['id']}})[_0xa198('0x29')](handleEntityNotFound(_0xb7d1f5,null))[_0xa198('0x29')](function(_0x1b68a4){if(!_0x4c45c5[_0xa198('0x35')]['channel']||!utils[_0xa198('0x6f')](_0x4c45c5['query']['channel'])){throw new db['Sequelize']['ValidationError'](_0xa198('0x70'));}var _0x23997d={};var _0x80879d={};_0x80879d[_0xa198('0x34')]=_[_0xa198('0x36')](db[_[_0xa198('0x71')](_0x4c45c5[_0xa198('0x35')][_0xa198('0x72')][_0xa198('0x73')]())+_0xa198('0x74')][_0xa198('0x31')]);_0x80879d[_0xa198('0x35')]=_['keys'](_0x4c45c5[_0xa198('0x35')]);_0x80879d[_0xa198('0x3f')]=_['intersection'](_0x80879d[_0xa198('0x34')],_0x80879d[_0xa198('0x35')]);_0x23997d[_0xa198('0x38')]=_[_0xa198('0x37')](_0x80879d[_0xa198('0x34')],qs[_0xa198('0x39')](_0x4c45c5[_0xa198('0x35')][_0xa198('0x39')]));_0x23997d[_0xa198('0x38')]=_0x23997d['attributes'][_0xa198('0x4a')]?_0x23997d['attributes']:_0x80879d['model'];_0x23997d[_0xa198('0x20')]=qs[_0xa198('0x20')](_0x4c45c5[_0xa198('0x35')][_0xa198('0x20')]);_0x23997d[_0xa198('0x1f')]=qs[_0xa198('0x1f')](_0x4c45c5[_0xa198('0x35')][_0xa198('0x1f')]);_0x23997d[_0xa198('0x3c')]=qs[_0xa198('0x3d')](_0x4c45c5[_0xa198('0x35')]['sort']);_0x23997d[_0xa198('0x3e')]=qs[_0xa198('0x3f')](_[_0xa198('0x40')](_0x4c45c5[_0xa198('0x35')],_0x80879d['filters']));_0x23997d=_[_0xa198('0x41')]({},_0x23997d,_0x4c45c5['options']);return _0x1b68a4[_0xa198('0x4f')+_[_0xa198('0x71')](_0x4c45c5[_0xa198('0x35')][_0xa198('0x72')][_0xa198('0x73')]())+_0xa198('0x75')](_0x23997d);})[_0xa198('0x29')](respondWithResult(_0xb7d1f5,null))[_0xa198('0x47')](handleError(_0xb7d1f5,null));};exports[_0xa198('0x76')]=function(_0x5541ab,_0x1cf56a,_0x259455){return db[_0xa198('0x30')][_0xa198('0x6e')]({'where':{'id':_0x5541ab[_0xa198('0x49')]['id']}})[_0xa198('0x29')](function(_0x57e9aa){if(_0x57e9aa){if(!_0x5541ab[_0xa198('0x4d')][_0xa198('0x72')]||!utils[_0xa198('0x6f')](_0x5541ab[_0xa198('0x4d')][_0xa198('0x72')])){throw new db[(_0xa198('0x5a'))][(_0xa198('0x77'))](_0xa198('0x70'));}return _0x57e9aa[_0xa198('0x78')+_[_0xa198('0x71')](_0x5541ab['body']['channel']['toLowerCase']())+'Queues'](_0x5541ab[_0xa198('0x4d')]['ids']);}return null;})[_0xa198('0x29')](handleEntityNotFound(_0x1cf56a,null))[_0xa198('0x29')](respondWithStatusCode(_0x1cf56a,null))[_0xa198('0x47')](handleError(_0x1cf56a,null));};exports[_0xa198('0x79')]=function(_0x4c5c92,_0x158238,_0xd3a355){return db['Team'][_0xa198('0x6e')]({'where':{'id':_0x4c5c92[_0xa198('0x49')]['id']}})[_0xa198('0x29')](function(_0x2334dd){if(_0x2334dd){if(!_0x4c5c92['query'][_0xa198('0x72')]||!utils[_0xa198('0x6f')](_0x4c5c92[_0xa198('0x35')][_0xa198('0x72')])){throw new db[(_0xa198('0x5a'))][(_0xa198('0x77'))](_0xa198('0x70'));}return _0x2334dd['remove'+_[_0xa198('0x71')](_0x4c5c92[_0xa198('0x35')]['channel']['toLowerCase']())+'Queues'](_0x4c5c92[_0xa198('0x35')][_0xa198('0x7a')]);}return null;})[_0xa198('0x29')](handleEntityNotFound(_0x158238,null))[_0xa198('0x29')](respondWithStatusCode(_0x158238,null))[_0xa198('0x47')](handleError(_0x158238,null));};exports[_0xa198('0x7b')]=function(_0x3072fd,_0x31c0d8){var _0x152d38=_[_0xa198('0x7c')](_0x3072fd['body'][_0xa198('0x7a')])?_0x3072fd[_0xa198('0x4d')][_0xa198('0x7a')]:[_0x3072fd['body'][_0xa198('0x7a')]];var _0x1c151c=_0x3072fd[_0xa198('0x49')]['id'];return db[_0xa198('0x30')][_0xa198('0x4c')]({'where':{'id':_0x1c151c}})[_0xa198('0x29')](handleEntityNotFound(_0x31c0d8,null))[_0xa198('0x29')](function(_0x4ed6f9){if(_0x4ed6f9){var _0x221038=['Voice',_0xa198('0x7d'),_0xa198('0x7e'),_0xa198('0x7f'),'Fax','Openchannel',_0xa198('0x80')];return db[_0xa198('0x57')][_0xa198('0x58')](function(_0x55b384){var _0x407c6e=_[_0xa198('0x2f')](_0x221038,function(_0x30ce44){var _0x37d7b0={'attributes':['id',_0xa198('0x2c')]};if(_0x30ce44==='Voice'){_0x37d7b0['through']={'attributes':[_0xa198('0x81')]};}return _0x4ed6f9[_0xa198('0x4f')+_0x30ce44+_0xa198('0x75')](_0x37d7b0)['then'](function(_0x4a20cd){var _0x2a2d3f=_['map'](_0x4a20cd,function(_0x5a03c9){var _0x555934=_[_0xa198('0x2f')](_0x152d38,function(_0x41166e){var _0xc3bc6d={'where':{'UserId':_0x41166e,[_0x30ce44+_0xa198('0x82')]:_0x5a03c9['id']},'transaction':_0x55b384};if(_0x30ce44===_0xa198('0x83')){_0xc3bc6d[_0xa198('0x18')]={'penalty':_0x5a03c9[_0xa198('0x84')][_0xa198('0x81')]};}return db['User'+_0x30ce44+_0xa198('0x74')]['findOrCreate'](_0xc3bc6d)[_0xa198('0x29')](function(){socket[_0xa198('0x85')]('user'+_0x30ce44+_0xa198('0x86'),{'UserId':_0x41166e,[_0x30ce44+_0xa198('0x82')]:_0x5a03c9['id']});if(_0x30ce44!=='Voice'){return;}return db[_0xa198('0x87')]['findAll']({'where':{'id':_0x152d38,'online':0x1},'attributes':['id',_0xa198('0x2c'),'online',_0xa198('0x88'),_0xa198('0x89')],'raw':!![]})[_0xa198('0x29')](function(_0x5205b0){var _0x567b5f=_[_0xa198('0x2f')](_0x5205b0,function(_0x2382cf){return db[_0xa198('0x8a')][_0xa198('0x8b')]({'membername':_0x2382cf[_0xa198('0x2c')],'UserId':_0x2382cf['id'],'queue_name':_0x5a03c9['name'],'VoiceQueueId':_0x5a03c9['id'],'interface':_[_0xa198('0x8c')](_0x2382cf[_0xa198('0x89')])?util[_0xa198('0x8d')](_0xa198('0x8e'),_0x2382cf[_0xa198('0x2c')]):_0x2382cf[_0xa198('0x89')],'paused':_0x2382cf['voicePause']||![],'penalty':_0x5a03c9[_0xa198('0x84')][_0xa198('0x81')]},{'transaction':_0x55b384});});return Promise['all'](_0x567b5f);});});});return Promise[_0xa198('0x8f')](_0x555934);});return Promise[_0xa198('0x8f')](_0x2a2d3f);})[_0xa198('0x29')](function(){return db[_0xa198('0x6a')]['findOne']({'where':{'teamId':_0x1c151c}})[_0xa198('0x29')](function(_0x32a2c5){if(_0x32a2c5){var _0x35bb59=_[_0xa198('0x2f')](_0x152d38,function(_0x106ec2){db[_0xa198('0x6b')][_0xa198('0x8b')]({'UserId':_0x106ec2,'VoicePrefixId':_0x32a2c5[_0xa198('0x6c')]});});return Promise[_0xa198('0x8f')](_0x35bb59);}});});});return Promise[_0xa198('0x8f')](_0x407c6e)[_0xa198('0x29')](function(){return _0x4ed6f9['addAgents'](_0x152d38,{'transaction':_0x55b384})[_0xa198('0x90')](function(_0xcf9f1){return _0xcf9f1;});});});}})[_0xa198('0x29')](respondWithResult(_0x31c0d8,null))[_0xa198('0x47')](handleError(_0x31c0d8,null));};exports[_0xa198('0x91')]=function(_0x2eb720,_0x3e0772){var _0x289ee7=_[_0xa198('0x7c')](_0x2eb720[_0xa198('0x35')][_0xa198('0x7a')])?_0x2eb720['query']['ids']:[_0x2eb720[_0xa198('0x35')]['ids']];var _0x4c1f35=_0x2eb720['params']['id'];return db[_0xa198('0x30')][_0xa198('0x4c')]({'where':{'id':_0x4c1f35}})[_0xa198('0x29')](handleEntityNotFound(_0x3e0772,null))[_0xa198('0x29')](function(_0x4c0b16){if(_0x4c0b16){var _0x25778f=[_0xa198('0x83'),_0xa198('0x7d'),_0xa198('0x7e'),_0xa198('0x7f'),_0xa198('0x92'),'Openchannel','Whatsapp'];return db[_0xa198('0x57')][_0xa198('0x58')](function(_0x4d02e4){var _0x1dbbd9=_[_0xa198('0x2f')](_0x25778f,function(_0x2c4f4c){var _0x1cbab3={'attributes':['id',_0xa198('0x2c')]};return _0x4c0b16['get'+_0x2c4f4c+_0xa198('0x75')](_0x1cbab3)[_0xa198('0x29')](function(_0x52c292){var _0x3a6a34=_[_0xa198('0x2f')](_0x52c292,function(_0x2a1e89){return _0x2a1e89['removeAgents'](_0x289ee7,{'transaction':_0x4d02e4})['then'](function(){var _0x6573b1=_[_0xa198('0x2f')](_0x289ee7,function(_0x49d9cb){socket[_0xa198('0x85')](_0xa198('0x4e')+_0x2c4f4c+'Queue:remove',{'UserId':Number(_0x49d9cb),[_0x2c4f4c+_0xa198('0x82')]:_0x2a1e89['id']});if(_0x2c4f4c!=='Voice'){return;}return db[_0xa198('0x8a')][_0xa198('0x60')]({'where':{'VoiceQueueId':_0x2a1e89['id'],'UserId':_0x49d9cb},'transaction':_0x4d02e4});});return Promise['all'](_0x6573b1);});});return Promise[_0xa198('0x8f')](_0x3a6a34);});});return Promise[_0xa198('0x8f')](_0x1dbbd9)[_0xa198('0x29')](function(){return _0x4c0b16[_0xa198('0x91')](_0x289ee7,{'transaction':_0x4d02e4});})['then'](function(){return db[_0xa198('0x6a')][_0xa198('0x6e')]({'where':{'teamId':_0x4c1f35}})[_0xa198('0x29')](function(_0x209d4d){if(_0x209d4d){var _0x4884c4=_['map'](_0x289ee7,function(_0x25f71a){db[_0xa198('0x6b')][_0xa198('0x60')]({'where':{'UserId':_0x25f71a,'VoicePrefixId':_0x209d4d[_0xa198('0x6c')]}});});return Promise[_0xa198('0x8f')](_0x4884c4);}});});});}})['then'](respondWithStatusCode(_0x3e0772,null))[_0xa198('0x47')](handleError(_0x3e0772,null));};exports[_0xa198('0x93')]=function(_0x2254ba,_0x1f1fc8,_0x533eb3){var _0x1c5d49={};var _0x5bf684={};var _0x3be2c9;var _0x447f99;return db[_0xa198('0x30')][_0xa198('0x6e')]({'where':{'id':_0x2254ba[_0xa198('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f1fc8,null))[_0xa198('0x29')](function(_0x5ab448){if(_0x5ab448){_0x3be2c9=_0x5ab448;_0x5bf684[_0xa198('0x34')]=_[_0xa198('0x36')](db['User'][_0xa198('0x31')]);_0x5bf684[_0xa198('0x35')]=_[_0xa198('0x36')](_0x2254ba[_0xa198('0x35')]);_0x5bf684['filters']=_[_0xa198('0x37')](_0x5bf684['model'],_0x5bf684[_0xa198('0x35')]);_0x1c5d49[_0xa198('0x38')]=_[_0xa198('0x37')](_0x5bf684[_0xa198('0x34')],qs[_0xa198('0x39')](_0x2254ba[_0xa198('0x35')][_0xa198('0x39')]));_0x1c5d49['attributes']=_0x1c5d49['attributes']['length']?_0x1c5d49[_0xa198('0x38')]:_0x5bf684['model'];_0x1c5d49['order']=qs[_0xa198('0x3d')](_0x2254ba[_0xa198('0x35')]['sort']);_0x1c5d49['where']=qs['filters'](_[_0xa198('0x40')](_0x2254ba[_0xa198('0x35')],_0x5bf684['filters']));if(_0x2254ba[_0xa198('0x35')]['filter']){_0x1c5d49[_0xa198('0x3e')]=_[_0xa198('0x41')](_0x1c5d49[_0xa198('0x3e')],{'$or':_[_0xa198('0x2f')](_0x1c5d49[_0xa198('0x38')],function(_0x575356){var _0x29c1ba={};_0x29c1ba[_0x575356]={'$like':'%'+_0x2254ba[_0xa198('0x35')][_0xa198('0x43')]+'%'};return _0x29c1ba;})});}_0x1c5d49=_[_0xa198('0x41')]({},_0x1c5d49,_0x2254ba[_0xa198('0x44')]);return _0x3be2c9[_0xa198('0x93')](_0x1c5d49);}})['then'](function(_0x38a9a3){if(_0x38a9a3){_0x447f99=_0x38a9a3[_0xa198('0x4a')];if(!_0x2254ba[_0xa198('0x35')]['hasOwnProperty'](_0xa198('0x3b'))){_0x1c5d49[_0xa198('0x20')]=qs[_0xa198('0x20')](_0x2254ba['query'][_0xa198('0x20')]);_0x1c5d49['offset']=qs[_0xa198('0x1f')](_0x2254ba['query']['offset']);}return _0x3be2c9[_0xa198('0x93')](_0x1c5d49);}})[_0xa198('0x29')](function(_0x5adb60){if(_0x5adb60){return _0x5adb60?{'count':_0x447f99,'rows':_0x5adb60}:null;}})[_0xa198('0x29')](respondWithResult(_0x1f1fc8,null))[_0xa198('0x47')](handleError(_0x1f1fc8,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index dfe43db..0c485ec 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 _0xf624=['emit','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x45643c,_0x591826){var _0x34a46c=function(_0xad2eef){while(--_0xad2eef){_0x45643c['push'](_0x45643c['shift']());}};_0x34a46c(++_0x591826);}(_0xf624,0x186));var _0x4f62=function(_0x28165f,_0x32a3e3){_0x28165f=_0x28165f-0x0;var _0x5c5c75=_0xf624[_0x28165f];return _0x5c5c75;};'use strict';var EventEmitter=require(_0x4f62('0x0'));var Team=require(_0x4f62('0x1'))['db'][_0x4f62('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x4f62('0x3')](0x0);var events={'afterCreate':_0x4f62('0x4'),'afterUpdate':_0x4f62('0x5'),'afterDestroy':'remove'};function emitEvent(_0x31ef32){return function(_0x108ef7,_0x87942f,_0x3dc48c){TeamEvents['emit'](_0x31ef32+':'+_0x108ef7['id'],_0x108ef7);TeamEvents[_0x4f62('0x6')](_0x31ef32,_0x108ef7);_0x3dc48c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x4f62('0x7')](e,emitEvent(event));}}module[_0x4f62('0x8')]=TeamEvents; \ No newline at end of file +var _0xb5ef=['hasOwnProperty','hook','../../mysqldb','Team','setMaxListeners','update','remove','emit'];(function(_0x254599,_0x535b11){var _0x30e66e=function(_0x9eda53){while(--_0x9eda53){_0x254599['push'](_0x254599['shift']());}};_0x30e66e(++_0x535b11);}(_0xb5ef,0x15a));var _0xfb5e=function(_0x1a467b,_0x4956f1){_0x1a467b=_0x1a467b-0x0;var _0x45d7b4=_0xb5ef[_0x1a467b];return _0x45d7b4;};'use strict';var EventEmitter=require('events');var Team=require(_0xfb5e('0x0'))['db'][_0xfb5e('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xfb5e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfb5e('0x3'),'afterDestroy':_0xfb5e('0x4')};function emitEvent(_0x5e5849){return function(_0x28eedf,_0x16ccb9,_0x260cba){TeamEvents[_0xfb5e('0x5')](_0x5e5849+':'+_0x28eedf['id'],_0x28eedf);TeamEvents[_0xfb5e('0x5')](_0x5e5849,_0x28eedf);_0x260cba(null);};}for(var e in events){if(events[_0xfb5e('0x6')](e)){var event=events[e];Team[_0xfb5e('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2b605ca..9063686 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 _0x59ae=['exports','define','teams','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','map','all','lodash','./team.attributes','get','Queues','then','setDataValue','channel','catch'];(function(_0x58598e,_0xc0e9b6){var _0x2c8a78=function(_0x4a144d){while(--_0x4a144d){_0x58598e['push'](_0x58598e['shift']());}};_0x2c8a78(++_0xc0e9b6);}(_0x59ae,0x138));var _0xe59a=function(_0x21f9dd,_0x2acb46){_0x21f9dd=_0x21f9dd-0x0;var _0x120ade=_0x59ae[_0x21f9dd];return _0x120ade;};'use strict';var _=require(_0xe59a('0x0'));var attributes=require(_0xe59a('0x1'));function getQueuesByChannel(_0x5e19b4,_0xdca125){var _0x4e2969=_0xe59a('0x2')+_0xdca125+_0xe59a('0x3');return _0x5e19b4[_0x4e2969]()[_0xe59a('0x4')](function(_0xc87f38){return _['map'](_0xc87f38,function(_0x4fa18f){_0x4fa18f[_0xe59a('0x5')](_0xe59a('0x6'),_0xdca125);return _0x4fa18f;});})[_0xe59a('0x7')](function(_0x25d611){throw _0x25d611;});}module[_0xe59a('0x8')]=function(_0x40dda8){return _0x40dda8[_0xe59a('0x9')]('Team',attributes,{'tableName':_0xe59a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x572c03=this;var _0x15ad73=['Chat',_0xe59a('0xb'),_0xe59a('0xc'),_0xe59a('0xd'),_0xe59a('0xe'),_0xe59a('0xf'),_0xe59a('0x10')];return Promise[_0xe59a('0x11')]()[_0xe59a('0x4')](function(){var _0x3a8f1d=_[_0xe59a('0x12')](_0x15ad73,function(_0x2713ac){return getQueuesByChannel(_0x572c03,_0x2713ac);});return Promise[_0xe59a('0x13')](_0x3a8f1d);})[_0xe59a('0x7')](function(_0x5eebf9){throw _0x5eebf9;});}}});}; \ No newline at end of file +var _0x5721=['then','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Mail','Voice','all','lodash','./team.attributes','get'];(function(_0x34c1fd,_0x36f491){var _0x25d00f=function(_0xa7ef52){while(--_0xa7ef52){_0x34c1fd['push'](_0x34c1fd['shift']());}};_0x25d00f(++_0x36f491);}(_0x5721,0x16d));var _0x1572=function(_0x193039,_0x1f684e){_0x193039=_0x193039-0x0;var _0x5942af=_0x5721[_0x193039];return _0x5942af;};'use strict';var _=require(_0x1572('0x0'));var attributes=require(_0x1572('0x1'));function getQueuesByChannel(_0x2ca3cc,_0x450657){var _0x1729dd=_0x1572('0x2')+_0x450657+'Queues';return _0x2ca3cc[_0x1729dd]()[_0x1572('0x3')](function(_0x15e650){return _[_0x1572('0x4')](_0x15e650,function(_0x7cbea4){_0x7cbea4[_0x1572('0x5')](_0x1572('0x6'),_0x450657);return _0x7cbea4;});})[_0x1572('0x7')](function(_0x342964){throw _0x342964;});}module[_0x1572('0x8')]=function(_0x34059f){return _0x34059f[_0x1572('0x9')](_0x1572('0xa'),attributes,{'tableName':_0x1572('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x151265=this;var _0x142684=[_0x1572('0xc'),'Fax',_0x1572('0xd'),'Openchannel','Sms',_0x1572('0xe'),'Whatsapp'];return Promise['resolve']()[_0x1572('0x3')](function(){var _0x58ecc0=_[_0x1572('0x4')](_0x142684,function(_0x2c8d1d){return getQueuesByChannel(_0x151265,_0x2c8d1d);});return Promise[_0x1572('0xf')](_0x58ecc0);})['catch'](function(_0x288497){throw _0x288497;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index da16952..d89da24 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 _0x31ca=['request','then','info','Team,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','register'];(function(_0x3164e1,_0x556d41){var _0x5487d0=function(_0x3af8b9){while(--_0x3af8b9){_0x3164e1['push'](_0x3164e1['shift']());}};_0x5487d0(++_0x556d41);}(_0x31ca,0x14e));var _0xa31c=function(_0x3355e5,_0x130789){_0x3355e5=_0x3355e5-0x0;var _0x2b3d56=_0x31ca[_0x3355e5];return _0x2b3d56;};'use strict';var _=require(_0xa31c('0x0'));var util=require(_0xa31c('0x1'));var moment=require(_0xa31c('0x2'));var BPromise=require(_0xa31c('0x3'));var rs=require(_0xa31c('0x4'));var fs=require('fs');var Redis=require(_0xa31c('0x5'));var db=require(_0xa31c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa31c('0x7'))(_0xa31c('0x8'));var config=require(_0xa31c('0x9'));var jayson=require(_0xa31c('0xa'));var client=jayson[_0xa31c('0xb')][_0xa31c('0xc')]({'port':0x232a});config['redis']=_[_0xa31c('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa31c('0xe'))(new Redis(config[_0xa31c('0xf')]));require('./team.socket')[_0xa31c('0x10')](socket);function respondWithRpcPromise(_0xf875c,_0x366ecc,_0xfaf808){return new BPromise(function(_0x39629e,_0xe03786){return client[_0xa31c('0x11')](_0xf875c,_0xfaf808)[_0xa31c('0x12')](function(_0x4f5442){logger[_0xa31c('0x13')](_0xa31c('0x14'),_0x366ecc,'request\x20sent');logger[_0xa31c('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x366ecc,_0xa31c('0x16'),JSON[_0xa31c('0x17')](_0x4f5442));if(_0x4f5442[_0xa31c('0x18')]){if(_0x4f5442[_0xa31c('0x18')][_0xa31c('0x19')]===0x1f4){logger[_0xa31c('0x18')](_0xa31c('0x14'),_0x366ecc,_0x4f5442['error'][_0xa31c('0x1a')]);return _0xe03786(_0x4f5442[_0xa31c('0x18')]['message']);}logger[_0xa31c('0x18')](_0xa31c('0x14'),_0x366ecc,_0x4f5442[_0xa31c('0x18')]['message']);return _0x39629e(_0x4f5442['error'][_0xa31c('0x1a')]);}else{logger[_0xa31c('0x13')](_0xa31c('0x14'),_0x366ecc,_0xa31c('0x16'));_0x39629e(_0x4f5442['result'][_0xa31c('0x1a')]);}})['catch'](function(_0x3147c0){logger[_0xa31c('0x18')](_0xa31c('0x14'),_0x366ecc,_0x3147c0);_0xe03786(_0x3147c0);});});} \ No newline at end of file +var _0x8c97=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./team.socket','register','request','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_0x8c97,0x1ae));var _0x78c9=function(_0x5bd713,_0x338476){_0x5bd713=_0x5bd713-0x0;var _0x569949=_0x8c97[_0x5bd713];return _0x569949;};'use strict';var _=require(_0x78c9('0x0'));var util=require(_0x78c9('0x1'));var moment=require('moment');var BPromise=require(_0x78c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78c9('0x3'));var db=require(_0x78c9('0x4'))['db'];var utils=require(_0x78c9('0x5'));var logger=require(_0x78c9('0x6'))('rpc');var config=require(_0x78c9('0x7'));var jayson=require(_0x78c9('0x8'));var client=jayson[_0x78c9('0x9')][_0x78c9('0xa')]({'port':0x232a});config[_0x78c9('0xb')]=_['defaults'](config[_0x78c9('0xb')],{'host':_0x78c9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78c9('0xb')]));require(_0x78c9('0xd'))[_0x78c9('0xe')](socket);function respondWithRpcPromise(_0x1dfba9,_0x21b242,_0x12fb88){return new BPromise(function(_0x247763,_0xff8d78){return client[_0x78c9('0xf')](_0x1dfba9,_0x12fb88)['then'](function(_0x581b3d){logger[_0x78c9('0x10')](_0x78c9('0x11'),_0x21b242,'request\x20sent');logger[_0x78c9('0x12')](_0x78c9('0x13'),_0x21b242,'request\x20sent',JSON[_0x78c9('0x14')](_0x581b3d));if(_0x581b3d[_0x78c9('0x15')]){if(_0x581b3d[_0x78c9('0x15')][_0x78c9('0x16')]===0x1f4){logger[_0x78c9('0x15')](_0x78c9('0x11'),_0x21b242,_0x581b3d[_0x78c9('0x15')]['message']);return _0xff8d78(_0x581b3d[_0x78c9('0x15')][_0x78c9('0x17')]);}logger[_0x78c9('0x15')]('Team,\x20%s,\x20%s',_0x21b242,_0x581b3d[_0x78c9('0x15')]['message']);return _0x247763(_0x581b3d['error'][_0x78c9('0x17')]);}else{logger[_0x78c9('0x10')](_0x78c9('0x11'),_0x21b242,_0x78c9('0x18'));_0x247763(_0x581b3d[_0x78c9('0x19')]['message']);}})[_0x78c9('0x1a')](function(_0x99ef9a){logger[_0x78c9('0x15')](_0x78c9('0x11'),_0x21b242,_0x99ef9a);_0xff8d78(_0x99ef9a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index b377db7..8739160 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 _0xd9cc=['emit','register','length','team:','./team.events','save','update'];(function(_0x5ce566,_0x11e7b4){var _0x4a3966=function(_0x25e273){while(--_0x25e273){_0x5ce566['push'](_0x5ce566['shift']());}};_0x4a3966(++_0x11e7b4);}(_0xd9cc,0x66));var _0xcd9c=function(_0x59a6bb,_0x45d76e){_0x59a6bb=_0x59a6bb-0x0;var _0x4f9e97=_0xd9cc[_0x59a6bb];return _0x4f9e97;};'use strict';var TeamEvents=require(_0xcd9c('0x0'));var events=[_0xcd9c('0x1'),'remove',_0xcd9c('0x2')];function createListener(_0x59a070,_0x5e6fce){return function(_0x1514cb){_0x5e6fce[_0xcd9c('0x3')](_0x59a070,_0x1514cb);};}function removeListener(_0x6d2616,_0x364f7a){return function(){TeamEvents['removeListener'](_0x6d2616,_0x364f7a);};}exports[_0xcd9c('0x4')]=function(_0x144be3){for(var _0x294833=0x0,_0x242d02=events[_0xcd9c('0x5')];_0x294833<_0x242d02;_0x294833++){var _0x9c3c29=events[_0x294833];var _0x4952be=createListener(_0xcd9c('0x6')+_0x9c3c29,_0x144be3);TeamEvents['on'](_0x9c3c29,_0x4952be);}}; \ No newline at end of file +var _0xb5d1=['length','team:','./team.events','save','update','emit','removeListener','register'];(function(_0x3a24fb,_0x567f31){var _0x5788b0=function(_0x18eb4c){while(--_0x18eb4c){_0x3a24fb['push'](_0x3a24fb['shift']());}};_0x5788b0(++_0x567f31);}(_0xb5d1,0x1e2));var _0x1b5d=function(_0x327dac,_0x230179){_0x327dac=_0x327dac-0x0;var _0xef78e5=_0xb5d1[_0x327dac];return _0xef78e5;};'use strict';var TeamEvents=require(_0x1b5d('0x0'));var events=[_0x1b5d('0x1'),'remove',_0x1b5d('0x2')];function createListener(_0x5204e9,_0x14ee18){return function(_0xc79d54){_0x14ee18[_0x1b5d('0x3')](_0x5204e9,_0xc79d54);};}function removeListener(_0x157eb8,_0x5eb7cd){return function(){TeamEvents[_0x1b5d('0x4')](_0x157eb8,_0x5eb7cd);};}exports[_0x1b5d('0x5')]=function(_0x48cebf){for(var _0x4f3941=0x0,_0x3fe6cf=events[_0x1b5d('0x6')];_0x4f3941<_0x3fe6cf;_0x4f3941++){var _0x1e5058=events[_0x4f3941];var _0x58685d=createListener(_0x1b5d('0x7')+_0x1e5058,_0x48cebf);TeamEvents['on'](_0x1e5058,_0x58685d);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 837fdb7..7dbec07 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 _0xc882=['sequelize','exports','INTEGER'];(function(_0xae37f7,_0x240a29){var _0x33fdfb=function(_0x1f8cd3){while(--_0x1f8cd3){_0xae37f7['push'](_0xae37f7['shift']());}};_0x33fdfb(++_0x240a29);}(_0xc882,0xff));var _0x2c88=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc882[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x2c88('0x0'));module[_0x2c88('0x1')]={'TeamId':{'type':Sequelize[_0x2c88('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2c88('0x2')]}}; \ No newline at end of file +var _0xc961=['sequelize','exports','INTEGER'];(function(_0x360d26,_0x700e92){var _0x180eef=function(_0x4422a1){while(--_0x4422a1){_0x360d26['push'](_0x360d26['shift']());}};_0x180eef(++_0x700e92);}(_0xc961,0x17a));var _0x1c96=function(_0x4a858b,_0x270c1c){_0x4a858b=_0x4a858b-0x0;var _0x5ae6a0=_0xc961[_0x4a858b];return _0x5ae6a0;};'use strict';var Sequelize=require(_0x1c96('0x0'));module[_0x1c96('0x1')]={'TeamId':{'type':Sequelize[_0x1c96('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1c96('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index cf554a6..43fdf97 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 _0x0565=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ef1ed,_0x1a0592){var _0xfee3ee=function(_0x5961a1){while(--_0x5961a1){_0x5ef1ed['push'](_0x5ef1ed['shift']());}};_0xfee3ee(++_0x1a0592);}(_0x0565,0xf2));var _0x5056=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x0565[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));var moment=require(_0x5056('0x4'));var BPromise=require(_0x5056('0x5'));var rp=require(_0x5056('0x6'));var fs=require('fs');var path=require(_0x5056('0x7'));var rimraf=require(_0x5056('0x8'));var config=require(_0x5056('0x9'));var attributes=require('./teamVoicePrefix.attributes');module[_0x5056('0xa')]=function(_0x105ea8,_0x1143df){return _0x105ea8[_0x5056('0xb')]('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3611=['../../config/environment','exports','define','team_has_voice_prefixes','lodash','api','request-promise','path','rimraf'];(function(_0x5b3821,_0x245f4f){var _0x10b877=function(_0x3ecc06){while(--_0x3ecc06){_0x5b3821['push'](_0x5b3821['shift']());}};_0x10b877(++_0x245f4f);}(_0x3611,0x136));var _0x1361=function(_0x22dc92,_0x53d374){_0x22dc92=_0x22dc92-0x0;var _0xbcc730=_0x3611[_0x22dc92];return _0xbcc730;};'use strict';var _=require(_0x1361('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1361('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1361('0x2'));var fs=require('fs');var path=require(_0x1361('0x3'));var rimraf=require(_0x1361('0x4'));var config=require(_0x1361('0x5'));var attributes=require('./teamVoicePrefix.attributes');module[_0x1361('0x6')]=function(_0x304832,_0x5aa5dc){return _0x304832[_0x1361('0x7')]('TeamVoicePrefix',attributes,{'tableName':_0x1361('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index e47618f..41b31b5 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x9602bb,_0x360df7){var _0x5ae01f=function(_0x35becd){while(--_0x35becd){_0x9602bb['push'](_0x9602bb['shift']());}};_0x5ae01f(++_0x360df7);}(_0x70e0,0x17b));var _0x070e=function(_0x277301,_0x214d17){_0x277301=_0x277301-0x0;var _0x29e5b9=_0x70e0[_0x277301];return _0x29e5b9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3585b4,_0x3538ba){var _0x30487b=function(_0x2ab21f){while(--_0x2ab21f){_0x3585b4['push'](_0x3585b4['shift']());}};_0x30487b(++_0x3538ba);}(_0xe706,0xa3));var _0x6e70=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0xe706[_0x1e5cc3];return _0x15c596;};'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 52091b6..e2932b5 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 _0x9de1=['INTEGER','sequelize','exports'];(function(_0x3a814f,_0x553e5b){var _0x150de1=function(_0x162bed){while(--_0x162bed){_0x3a814f['push'](_0x3a814f['shift']());}};_0x150de1(++_0x553e5b);}(_0x9de1,0x1a2));var _0x19de=function(_0x56fc58,_0x2e032f){_0x56fc58=_0x56fc58-0x0;var _0x1d7cc4=_0x9de1[_0x56fc58];return _0x1d7cc4;};'use strict';var Sequelize=require(_0x19de('0x0'));module[_0x19de('0x1')]={'penalty':{'type':Sequelize[_0x19de('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8f0b=['INTEGER','sequelize','exports'];(function(_0xfc4d48,_0x2b8964){var _0x4f5ae0=function(_0x240439){while(--_0x240439){_0xfc4d48['push'](_0xfc4d48['shift']());}};_0x4f5ae0(++_0x2b8964);}(_0x8f0b,0x1a2));var _0xb8f0=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x8f0b[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0xb8f0('0x0'));module[_0xb8f0('0x1')]={'penalty':{'type':Sequelize[_0xb8f0('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 8ef9085..15bcad3 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 _0xea70=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash'];(function(_0x1bb5f7,_0x1de976){var _0x28bdac=function(_0x5c0919){while(--_0x5c0919){_0x1bb5f7['push'](_0x1bb5f7['shift']());}};_0x28bdac(++_0x1de976);}(_0xea70,0x175));var _0x0ea7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xea70[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var logger=require(_0x0ea7('0x2'))('api');var moment=require(_0x0ea7('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ea7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ea7('0x5'));var config=require(_0x0ea7('0x6'));var attributes=require(_0x0ea7('0x7'));module[_0x0ea7('0x8')]=function(_0x168372,_0x489be9){return _0x168372[_0x0ea7('0x9')](_0x0ea7('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e35=['exports','team_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x263665,_0x6d1f74){var _0x372cfd=function(_0x3e5900){while(--_0x3e5900){_0x263665['push'](_0x263665['shift']());}};_0x372cfd(++_0x6d1f74);}(_0x2e35,0x1d0));var _0x52e3=function(_0xf92642,_0x3dd759){_0xf92642=_0xf92642-0x0;var _0x2d6027=_0x2e35[_0xf92642];return _0x2d6027;};'use strict';var _=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var logger=require(_0x52e3('0x2'))('api');var moment=require(_0x52e3('0x3'));var BPromise=require(_0x52e3('0x4'));var rp=require(_0x52e3('0x5'));var fs=require('fs');var path=require(_0x52e3('0x6'));var rimraf=require('rimraf');var config=require(_0x52e3('0x7'));var attributes=require(_0x52e3('0x8'));module[_0x52e3('0x9')]=function(_0x20d1bc,_0x5f117a){return _0x20d1bc['define']('TeamVoiceQueue',attributes,{'tableName':_0x52e3('0xa'),'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 4195636..496c727 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 _0x6ae0=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6ae0,0x192));var _0x06ae=function(_0x296629,_0x513ab8){_0x296629=_0x296629-0x0;var _0x15d921=_0x6ae0[_0x296629];return _0x15d921;};'use strict';var _=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var moment=require(_0x06ae('0x2'));var BPromise=require(_0x06ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06ae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x06ae('0x5'))('rpc');var config=require(_0x06ae('0x6'));var jayson=require(_0x06ae('0x7'));var client=jayson['client'][_0x06ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51bac4,_0x26167c,_0x2bc2ad){return new BPromise(function(_0x591c0f,_0x269be5){return client[_0x06ae('0x9')](_0x51bac4,_0x2bc2ad)[_0x06ae('0xa')](function(_0x39f10e){logger[_0x06ae('0xb')](_0x06ae('0xc'),_0x26167c,_0x06ae('0xd'));logger['debug'](_0x06ae('0xe'),_0x26167c,_0x06ae('0xd'),JSON[_0x06ae('0xf')](_0x39f10e));if(_0x39f10e[_0x06ae('0x10')]){if(_0x39f10e[_0x06ae('0x10')][_0x06ae('0x11')]===0x1f4){logger[_0x06ae('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x26167c,_0x39f10e['error']['message']);return _0x269be5(_0x39f10e[_0x06ae('0x10')]['message']);}logger[_0x06ae('0x10')](_0x06ae('0xc'),_0x26167c,_0x39f10e[_0x06ae('0x10')][_0x06ae('0x12')]);return _0x591c0f(_0x39f10e['error']['message']);}else{logger[_0x06ae('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x26167c,_0x06ae('0xd'));_0x591c0f(_0x39f10e[_0x06ae('0x13')][_0x06ae('0x12')]);}})['catch'](function(_0x4ec020){logger['error'](_0x06ae('0xc'),_0x26167c,_0x4ec020);_0x269be5(_0x4ec020);});});} \ No newline at end of file +var _0xbda8=['request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xbda8,0xe3));var _0x8bda=function(_0x68604f,_0x4a0a1c){_0x68604f=_0x68604f-0x0;var _0x13cbdd=_0xbda8[_0x68604f];return _0x13cbdd;};'use strict';var _=require('lodash');var util=require(_0x8bda('0x0'));var moment=require(_0x8bda('0x1'));var BPromise=require(_0x8bda('0x2'));var rs=require(_0x8bda('0x3'));var fs=require('fs');var Redis=require(_0x8bda('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bda('0x5'));var logger=require(_0x8bda('0x6'))(_0x8bda('0x7'));var config=require(_0x8bda('0x8'));var jayson=require(_0x8bda('0x9'));var client=jayson[_0x8bda('0xa')][_0x8bda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2673ca,_0x4502d2,_0x585c8e){return new BPromise(function(_0x403c77,_0x57cac0){return client['request'](_0x2673ca,_0x585c8e)[_0x8bda('0xc')](function(_0x28473d){logger[_0x8bda('0xd')](_0x8bda('0xe'),_0x4502d2,_0x8bda('0xf'));logger['debug'](_0x8bda('0x10'),_0x4502d2,_0x8bda('0xf'),JSON[_0x8bda('0x11')](_0x28473d));if(_0x28473d[_0x8bda('0x12')]){if(_0x28473d[_0x8bda('0x12')][_0x8bda('0x13')]===0x1f4){logger[_0x8bda('0x12')](_0x8bda('0xe'),_0x4502d2,_0x28473d['error']['message']);return _0x57cac0(_0x28473d['error'][_0x8bda('0x14')]);}logger[_0x8bda('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4502d2,_0x28473d[_0x8bda('0x12')][_0x8bda('0x14')]);return _0x403c77(_0x28473d[_0x8bda('0x12')][_0x8bda('0x14')]);}else{logger['info'](_0x8bda('0xe'),_0x4502d2,_0x8bda('0xf'));_0x403c77(_0x28473d[_0x8bda('0x15')]['message']);}})['catch'](function(_0x236446){logger[_0x8bda('0x12')](_0x8bda('0xe'),_0x4502d2,_0x236446);_0x57cac0(_0x236446);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 5bb89e9..641af7a 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 _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x460fd9,_0x4b4b97){var _0x424e18=function(_0x4a4942){while(--_0x4a4942){_0x460fd9['push'](_0x460fd9['shift']());}};_0x424e18(++_0x4b4b97);}(_0x7880,0x1f4));var _0x0788=function(_0x407461,_0x1cf61c){_0x407461=_0x407461-0x0;var _0x2b3ffa=_0x7880[_0x407461];return _0x2b3ffa;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['post']('/',auth[_0x0788('0xa')](),controller['create']);router[_0x0788('0xe')]('/:id',auth[_0x0788('0xa')](),controller[_0x0788('0xf')]);router[_0x0788('0x10')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller['destroy']);module[_0x0788('0x11')]=router; \ No newline at end of file +var _0x2fe5=['isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','index','/:id'];(function(_0x352c7c,_0x545754){var _0x112642=function(_0x245fe6){while(--_0x245fe6){_0x352c7c['push'](_0x352c7c['shift']());}};_0x112642(++_0x545754);}(_0x2fe5,0x14b));var _0x52fe=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2fe5[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x52fe('0x0'));var util=require(_0x52fe('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x52fe('0x2'));var router=express[_0x52fe('0x3')]();var fs_extra=require(_0x52fe('0x4'));var auth=require(_0x52fe('0x5'));var interaction=require(_0x52fe('0x6'));var config=require('../../config/environment');var controller=require(_0x52fe('0x7'));router[_0x52fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x52fe('0x9')]);router[_0x52fe('0x8')](_0x52fe('0xa'),auth[_0x52fe('0xb')](),controller[_0x52fe('0xc')]);router['post']('/',auth[_0x52fe('0xb')](),controller[_0x52fe('0xd')]);router[_0x52fe('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x52fe('0xf')]);router[_0x52fe('0x10')]('/:id',auth[_0x52fe('0xb')](),controller[_0x52fe('0x11')]);module[_0x52fe('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f2f432f..10044dd 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 _0x89fb=['exports','STRING','TEXT'];(function(_0x58de45,_0x524cf3){var _0x3dc89c=function(_0x3b6d57){while(--_0x3b6d57){_0x58de45['push'](_0x58de45['shift']());}};_0x3dc89c(++_0x524cf3);}(_0x89fb,0xd5));var _0xb89f=function(_0x560e54,_0x17614c){_0x560e54=_0x560e54-0x0;var _0x30a149=_0x89fb[_0x560e54];return _0x30a149;};'use strict';var Sequelize=require('sequelize');module[_0xb89f('0x0')]={'name':{'type':Sequelize[_0xb89f('0x1')]},'description':{'type':Sequelize[_0xb89f('0x1')]},'html':{'type':Sequelize[_0xb89f('0x2')]}}; \ No newline at end of file +var _0x3080=['STRING','TEXT'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3080,0x68));var _0x0308=function(_0x387ae1,_0x4923fa){_0x387ae1=_0x387ae1-0x0;var _0x2b1eba=_0x3080[_0x387ae1];return _0x2b1eba;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0308('0x0')]},'description':{'type':Sequelize[_0x0308('0x0')]},'html':{'type':Sequelize[_0x0308('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5c8a4fa..942f429 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 _0xcc0c=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Template','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x25a243,_0x420a03){var _0x2b0711=function(_0x311453){while(--_0x311453){_0x25a243['push'](_0x25a243['shift']());}};_0x2b0711(++_0x420a03);}(_0xcc0c,0x146));var _0xccc0=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xcc0c[_0x231dda];return _0x3f88cb;};'use strict';var emlformat=require(_0xccc0('0x0'));var rimraf=require(_0xccc0('0x1'));var zipdir=require(_0xccc0('0x2'));var jsonpatch=require(_0xccc0('0x3'));var rp=require(_0xccc0('0x4'));var moment=require(_0xccc0('0x5'));var BPromise=require(_0xccc0('0x6'));var Mustache=require(_0xccc0('0x7'));var util=require(_0xccc0('0x8'));var path=require(_0xccc0('0x9'));var sox=require(_0xccc0('0xa'));var csv=require(_0xccc0('0xb'));var ejs=require(_0xccc0('0xc'));var fs=require('fs');var fs_extra=require(_0xccc0('0xd'));var _=require(_0xccc0('0xe'));var squel=require('squel');var crypto=require(_0xccc0('0xf'));var jsforce=require(_0xccc0('0x10'));var deskjs=require(_0xccc0('0x11'));var toCsv=require(_0xccc0('0xb'));var querystring=require(_0xccc0('0x12'));var Papa=require('papaparse');var Redis=require(_0xccc0('0x13'));var authService=require(_0xccc0('0x14'));var qs=require(_0xccc0('0x15'));var as=require(_0xccc0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccc0('0x17'))(_0xccc0('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xccc0('0x19'));var db=require(_0xccc0('0x1a'))['db'];function respondWithStatusCode(_0x3860de,_0x5823cf){_0x5823cf=_0x5823cf||0xcc;return function(_0x317008){if(_0x317008){return _0x3860de[_0xccc0('0x1b')](_0x5823cf);}return _0x3860de[_0xccc0('0x1c')](_0x5823cf)[_0xccc0('0x1d')]();};}function respondWithResult(_0x2dff5b,_0x48b230){_0x48b230=_0x48b230||0xc8;return function(_0x151ba4){if(_0x151ba4){return _0x2dff5b[_0xccc0('0x1c')](_0x48b230)['json'](_0x151ba4);}};}function respondWithFilteredResult(_0x27f84d,_0x32c7a1){return function(_0x451d2c){if(_0x451d2c){var _0x2bacaf=typeof _0x32c7a1['offset']===_0xccc0('0x1e')&&typeof _0x32c7a1[_0xccc0('0x1f')]===_0xccc0('0x1e');var _0x568b09=_0x451d2c[_0xccc0('0x20')];var _0x3d1495=_0x2bacaf?0x0:_0x32c7a1[_0xccc0('0x21')];var _0x4b20fb=_0x2bacaf?_0x451d2c[_0xccc0('0x20')]:_0x32c7a1[_0xccc0('0x21')]+_0x32c7a1[_0xccc0('0x1f')];var _0x41837f;if(_0x4b20fb>=_0x568b09){_0x4b20fb=_0x568b09;_0x41837f=0xc8;}else{_0x41837f=0xce;}_0x27f84d[_0xccc0('0x1c')](_0x41837f);return _0x27f84d['set'](_0xccc0('0x22'),_0x3d1495+'-'+_0x4b20fb+'/'+_0x568b09)[_0xccc0('0x23')](_0x451d2c);}return null;};}function patchUpdates(_0x2984f7){return function(_0x1f342b){try{jsonpatch[_0xccc0('0x24')](_0x1f342b,_0x2984f7,!![]);}catch(_0xa09fe4){return BPromise['reject'](_0xa09fe4);}return _0x1f342b[_0xccc0('0x25')]();};}function saveUpdates(_0xed5583,_0x93c1c3){return function(_0x4f17f3){if(_0x4f17f3){return _0x4f17f3[_0xccc0('0x26')](_0xed5583)[_0xccc0('0x27')](function(_0x4e2972){return _0x4e2972;});}return null;};}function removeEntity(_0x5beb48,_0x204c0e){return function(_0x1c1b10){if(_0x1c1b10){return _0x1c1b10[_0xccc0('0x28')]()['then'](function(){var _0x366443=_0x1c1b10[_0xccc0('0x29')]({'plain':!![]});var _0x48f10d='Templates';return db[_0xccc0('0x2a')][_0xccc0('0x28')]({'where':{'type':_0x48f10d,'resourceId':_0x366443['id']}})[_0xccc0('0x27')](function(){return _0x1c1b10;});})[_0xccc0('0x27')](function(){_0x5beb48[_0xccc0('0x1c')](0xcc)[_0xccc0('0x1d')]();});}};}function handleEntityNotFound(_0x56bffa,_0x26c510){return function(_0x3066d4){if(!_0x3066d4){_0x56bffa[_0xccc0('0x1b')](0x194);}return _0x3066d4;};}function handleError(_0x3a330a,_0x287ee2){_0x287ee2=_0x287ee2||0x1f4;return function(_0x135e7f){logger[_0xccc0('0x2b')](_0x135e7f[_0xccc0('0x2c')]);if(_0x135e7f['name']){delete _0x135e7f[_0xccc0('0x2d')];}_0x3a330a[_0xccc0('0x1c')](_0x287ee2)[_0xccc0('0x2e')](_0x135e7f);};}exports[_0xccc0('0x2f')]=function(_0x4f146b,_0x358161){var _0x2fb9c6={},_0x470b80={},_0x427285={'count':0x0,'rows':[]};var _0x4c8c0b=_['map'](db[_0xccc0('0x30')][_0xccc0('0x31')],function(_0x3aeb6d){return{'name':_0x3aeb6d[_0xccc0('0x32')],'type':_0x3aeb6d[_0xccc0('0x33')]['key']};});_0x470b80[_0xccc0('0x34')]=_[_0xccc0('0x35')](_0x4c8c0b,_0xccc0('0x2d'));_0x470b80[_0xccc0('0x36')]=_[_0xccc0('0x37')](_0x4f146b[_0xccc0('0x36')]);_0x470b80[_0xccc0('0x38')]=_[_0xccc0('0x39')](_0x470b80[_0xccc0('0x34')],_0x470b80[_0xccc0('0x36')]);_0x2fb9c6[_0xccc0('0x3a')]=_['intersection'](_0x470b80[_0xccc0('0x34')],qs[_0xccc0('0x3b')](_0x4f146b[_0xccc0('0x36')][_0xccc0('0x3b')]));_0x2fb9c6[_0xccc0('0x3a')]=_0x2fb9c6[_0xccc0('0x3a')][_0xccc0('0x3c')]?_0x2fb9c6[_0xccc0('0x3a')]:_0x470b80[_0xccc0('0x34')];if(!_0x4f146b[_0xccc0('0x36')][_0xccc0('0x3d')](_0xccc0('0x3e'))){_0x2fb9c6['limit']=qs['limit'](_0x4f146b[_0xccc0('0x36')][_0xccc0('0x1f')]);_0x2fb9c6[_0xccc0('0x21')]=qs['offset'](_0x4f146b[_0xccc0('0x36')][_0xccc0('0x21')]);}_0x2fb9c6[_0xccc0('0x3f')]=qs[_0xccc0('0x40')](_0x4f146b[_0xccc0('0x36')][_0xccc0('0x40')]);_0x2fb9c6[_0xccc0('0x41')]=qs[_0xccc0('0x38')](_[_0xccc0('0x42')](_0x4f146b[_0xccc0('0x36')],_0x470b80['filters']),_0x4c8c0b);if(_0x4f146b[_0xccc0('0x36')][_0xccc0('0x43')]){_0x2fb9c6[_0xccc0('0x41')]=_[_0xccc0('0x44')](_0x2fb9c6[_0xccc0('0x41')],{'$or':_[_0xccc0('0x35')](_0x4c8c0b,function(_0x575e88){if(_0x575e88[_0xccc0('0x33')]!=='VIRTUAL'){var _0x15836d={};_0x15836d[_0x575e88[_0xccc0('0x2d')]]={'$like':'%'+_0x4f146b[_0xccc0('0x36')][_0xccc0('0x43')]+'%'};return _0x15836d;}})});}_0x2fb9c6=_[_0xccc0('0x44')]({},_0x2fb9c6,_0x4f146b[_0xccc0('0x45')]);var _0x1dafef={'where':_0x2fb9c6[_0xccc0('0x41')]};return db[_0xccc0('0x30')][_0xccc0('0x20')](_0x1dafef)[_0xccc0('0x27')](function(_0x4a5dbb){_0x427285[_0xccc0('0x20')]=_0x4a5dbb;if(_0x4f146b[_0xccc0('0x36')][_0xccc0('0x46')]){_0x2fb9c6[_0xccc0('0x47')]=[{'all':!![]}];}return db['Template']['findAll'](_0x2fb9c6);})[_0xccc0('0x27')](function(_0x4a13fa){_0x427285['rows']=_0x4a13fa;return _0x427285;})['then'](respondWithFilteredResult(_0x358161,_0x2fb9c6))['catch'](handleError(_0x358161,null));};exports['show']=function(_0x18d814,_0x7b8096){var _0x5e16d8={'raw':!![],'where':{'id':_0x18d814[_0xccc0('0x48')]['id']}},_0x1d5e28={};_0x1d5e28[_0xccc0('0x34')]=_[_0xccc0('0x37')](db[_0xccc0('0x30')][_0xccc0('0x31')]);_0x1d5e28[_0xccc0('0x36')]=_[_0xccc0('0x37')](_0x18d814['query']);_0x1d5e28['filters']=_[_0xccc0('0x39')](_0x1d5e28['model'],_0x1d5e28[_0xccc0('0x36')]);_0x5e16d8[_0xccc0('0x3a')]=_[_0xccc0('0x39')](_0x1d5e28[_0xccc0('0x34')],qs[_0xccc0('0x3b')](_0x18d814['query'][_0xccc0('0x3b')]));_0x5e16d8[_0xccc0('0x3a')]=_0x5e16d8[_0xccc0('0x3a')][_0xccc0('0x3c')]?_0x5e16d8[_0xccc0('0x3a')]:_0x1d5e28[_0xccc0('0x34')];if(_0x18d814[_0xccc0('0x36')][_0xccc0('0x46')]){_0x5e16d8[_0xccc0('0x47')]=[{'all':!![]}];}_0x5e16d8=_['merge']({},_0x5e16d8,_0x18d814[_0xccc0('0x45')]);return db[_0xccc0('0x30')][_0xccc0('0x49')](_0x5e16d8)[_0xccc0('0x27')](handleEntityNotFound(_0x7b8096,null))[_0xccc0('0x27')](respondWithResult(_0x7b8096,null))[_0xccc0('0x4a')](handleError(_0x7b8096,null));};exports[_0xccc0('0x4b')]=function(_0x5aa6f6,_0x25e99c){return db[_0xccc0('0x30')][_0xccc0('0x4b')](_0x5aa6f6['body'],{})[_0xccc0('0x27')](function(_0x4d2dfc){var _0x1e0148=_0x5aa6f6[_0xccc0('0x4c')]['get']({'plain':!![]});if(!_0x1e0148)throw new Error(_0xccc0('0x4d'));if(_0x1e0148['role']===_0xccc0('0x4c')){var _0x5b642b=_0x4d2dfc[_0xccc0('0x29')]({'plain':!![]});var _0x3190df='Templates';return db[_0xccc0('0x4e')]['find']({'where':{'name':_0x3190df,'userProfileId':_0x1e0148[_0xccc0('0x4f')]},'raw':!![]})[_0xccc0('0x27')](function(_0x32a8e2){if(_0x32a8e2&&_0x32a8e2[_0xccc0('0x50')]===0x0){return db[_0xccc0('0x2a')][_0xccc0('0x4b')]({'name':_0x5b642b[_0xccc0('0x2d')],'resourceId':_0x5b642b['id'],'type':_0x32a8e2[_0xccc0('0x2d')],'sectionId':_0x32a8e2['id']},{})[_0xccc0('0x27')](function(){return _0x4d2dfc;});}else{return _0x4d2dfc;}})[_0xccc0('0x4a')](function(_0x4e545d){logger['error'](_0xccc0('0x51'),_0x4e545d);throw _0x4e545d;});}return _0x4d2dfc;})[_0xccc0('0x27')](respondWithResult(_0x25e99c,0xc9))[_0xccc0('0x4a')](handleError(_0x25e99c,null));};exports[_0xccc0('0x26')]=function(_0x56c8c2,_0x5d3258){if(_0x56c8c2[_0xccc0('0x52')]['id']){delete _0x56c8c2[_0xccc0('0x52')]['id'];}return db[_0xccc0('0x30')]['find']({'where':{'id':_0x56c8c2[_0xccc0('0x48')]['id']}})[_0xccc0('0x27')](handleEntityNotFound(_0x5d3258,null))[_0xccc0('0x27')](saveUpdates(_0x56c8c2[_0xccc0('0x52')],null))['then'](respondWithResult(_0x5d3258,null))[_0xccc0('0x4a')](handleError(_0x5d3258,null));};exports['destroy']=function(_0x4eb2fc,_0xe2f9cf){return db[_0xccc0('0x30')]['find']({'where':{'id':_0x4eb2fc[_0xccc0('0x48')]['id']}})['then'](handleEntityNotFound(_0xe2f9cf,null))[_0xccc0('0x27')](removeEntity(_0xe2f9cf,null))[_0xccc0('0x4a')](handleError(_0xe2f9cf,null));}; \ No newline at end of file +var _0x01c4=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Template','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x544b55,_0x4be33f){var _0x336b57=function(_0x3a8719){while(--_0x3a8719){_0x544b55['push'](_0x544b55['shift']());}};_0x336b57(++_0x4be33f);}(_0x01c4,0x1e0));var _0x401c=function(_0x2ac0dd,_0x162292){_0x2ac0dd=_0x2ac0dd-0x0;var _0x2a0216=_0x01c4[_0x2ac0dd];return _0x2a0216;};'use strict';var emlformat=require(_0x401c('0x0'));var rimraf=require(_0x401c('0x1'));var zipdir=require(_0x401c('0x2'));var jsonpatch=require(_0x401c('0x3'));var rp=require(_0x401c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x401c('0x5'));var util=require('util');var path=require(_0x401c('0x6'));var sox=require(_0x401c('0x7'));var csv=require(_0x401c('0x8'));var ejs=require(_0x401c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x401c('0xa'));var squel=require(_0x401c('0xb'));var crypto=require(_0x401c('0xc'));var jsforce=require(_0x401c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x401c('0xe'));var Papa=require(_0x401c('0xf'));var Redis=require(_0x401c('0x10'));var authService=require(_0x401c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x401c('0x12'));var logger=require(_0x401c('0x13'))(_0x401c('0x14'));var utils=require('../../config/utils');var config=require(_0x401c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b0dc7,_0x322971){_0x322971=_0x322971||0xcc;return function(_0x9e7af6){if(_0x9e7af6){return _0x1b0dc7[_0x401c('0x16')](_0x322971);}return _0x1b0dc7['status'](_0x322971)['end']();};}function respondWithResult(_0x4481ff,_0x531167){_0x531167=_0x531167||0xc8;return function(_0x3702bd){if(_0x3702bd){return _0x4481ff[_0x401c('0x17')](_0x531167)[_0x401c('0x18')](_0x3702bd);}};}function respondWithFilteredResult(_0x1474d5,_0x5b79d3){return function(_0x49ef2d){if(_0x49ef2d){var _0x563083=typeof _0x5b79d3[_0x401c('0x19')]==='undefined'&&typeof _0x5b79d3['limit']===_0x401c('0x1a');var _0x18ef32=_0x49ef2d[_0x401c('0x1b')];var _0x19caf6=_0x563083?0x0:_0x5b79d3['offset'];var _0x4089e4=_0x563083?_0x49ef2d[_0x401c('0x1b')]:_0x5b79d3[_0x401c('0x19')]+_0x5b79d3[_0x401c('0x1c')];var _0x4185dd;if(_0x4089e4>=_0x18ef32){_0x4089e4=_0x18ef32;_0x4185dd=0xc8;}else{_0x4185dd=0xce;}_0x1474d5['status'](_0x4185dd);return _0x1474d5['set']('Content-Range',_0x19caf6+'-'+_0x4089e4+'/'+_0x18ef32)[_0x401c('0x18')](_0x49ef2d);}return null;};}function patchUpdates(_0x548d96){return function(_0x141c3c){try{jsonpatch[_0x401c('0x1d')](_0x141c3c,_0x548d96,!![]);}catch(_0x23f064){return BPromise[_0x401c('0x1e')](_0x23f064);}return _0x141c3c[_0x401c('0x1f')]();};}function saveUpdates(_0x31f754,_0x5d851f){return function(_0x2ccdee){if(_0x2ccdee){return _0x2ccdee[_0x401c('0x20')](_0x31f754)[_0x401c('0x21')](function(_0x5d46b0){return _0x5d46b0;});}return null;};}function removeEntity(_0x175298,_0x2c5f80){return function(_0x1b301e){if(_0x1b301e){return _0x1b301e[_0x401c('0x22')]()['then'](function(){var _0x3411da=_0x1b301e[_0x401c('0x23')]({'plain':!![]});var _0x514926=_0x401c('0x24');return db[_0x401c('0x25')][_0x401c('0x22')]({'where':{'type':_0x514926,'resourceId':_0x3411da['id']}})[_0x401c('0x21')](function(){return _0x1b301e;});})[_0x401c('0x21')](function(){_0x175298['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28e5f8,_0x1a23b7){return function(_0x3afc79){if(!_0x3afc79){_0x28e5f8['sendStatus'](0x194);}return _0x3afc79;};}function handleError(_0x1dc9d7,_0xc69d50){_0xc69d50=_0xc69d50||0x1f4;return function(_0xdb42ac){logger[_0x401c('0x26')](_0xdb42ac[_0x401c('0x27')]);if(_0xdb42ac['name']){delete _0xdb42ac[_0x401c('0x28')];}_0x1dc9d7[_0x401c('0x17')](_0xc69d50)[_0x401c('0x29')](_0xdb42ac);};}exports[_0x401c('0x2a')]=function(_0x27347d,_0x446415){var _0x1d357c={},_0x2ee5bb={},_0x443ea1={'count':0x0,'rows':[]};var _0x277189=_[_0x401c('0x2b')](db['Template']['rawAttributes'],function(_0x3cbf32){return{'name':_0x3cbf32[_0x401c('0x2c')],'type':_0x3cbf32[_0x401c('0x2d')][_0x401c('0x2e')]};});_0x2ee5bb[_0x401c('0x2f')]=_[_0x401c('0x2b')](_0x277189,_0x401c('0x28'));_0x2ee5bb[_0x401c('0x30')]=_[_0x401c('0x31')](_0x27347d[_0x401c('0x30')]);_0x2ee5bb[_0x401c('0x32')]=_[_0x401c('0x33')](_0x2ee5bb[_0x401c('0x2f')],_0x2ee5bb[_0x401c('0x30')]);_0x1d357c[_0x401c('0x34')]=_[_0x401c('0x33')](_0x2ee5bb[_0x401c('0x2f')],qs[_0x401c('0x35')](_0x27347d[_0x401c('0x30')][_0x401c('0x35')]));_0x1d357c[_0x401c('0x34')]=_0x1d357c[_0x401c('0x34')][_0x401c('0x36')]?_0x1d357c[_0x401c('0x34')]:_0x2ee5bb[_0x401c('0x2f')];if(!_0x27347d[_0x401c('0x30')][_0x401c('0x37')]('nolimit')){_0x1d357c['limit']=qs[_0x401c('0x1c')](_0x27347d[_0x401c('0x30')]['limit']);_0x1d357c[_0x401c('0x19')]=qs[_0x401c('0x19')](_0x27347d[_0x401c('0x30')][_0x401c('0x19')]);}_0x1d357c['order']=qs[_0x401c('0x38')](_0x27347d[_0x401c('0x30')][_0x401c('0x38')]);_0x1d357c[_0x401c('0x39')]=qs['filters'](_[_0x401c('0x3a')](_0x27347d[_0x401c('0x30')],_0x2ee5bb[_0x401c('0x32')]),_0x277189);if(_0x27347d[_0x401c('0x30')][_0x401c('0x3b')]){_0x1d357c['where']=_[_0x401c('0x3c')](_0x1d357c[_0x401c('0x39')],{'$or':_[_0x401c('0x2b')](_0x277189,function(_0x15a8da){if(_0x15a8da[_0x401c('0x2d')]!==_0x401c('0x3d')){var _0x10de0b={};_0x10de0b[_0x15a8da[_0x401c('0x28')]]={'$like':'%'+_0x27347d[_0x401c('0x30')][_0x401c('0x3b')]+'%'};return _0x10de0b;}})});}_0x1d357c=_[_0x401c('0x3c')]({},_0x1d357c,_0x27347d[_0x401c('0x3e')]);var _0x55ad29={'where':_0x1d357c[_0x401c('0x39')]};return db[_0x401c('0x3f')][_0x401c('0x1b')](_0x55ad29)[_0x401c('0x21')](function(_0x19075d){_0x443ea1[_0x401c('0x1b')]=_0x19075d;if(_0x27347d[_0x401c('0x30')][_0x401c('0x40')]){_0x1d357c[_0x401c('0x41')]=[{'all':!![]}];}return db[_0x401c('0x3f')][_0x401c('0x42')](_0x1d357c);})['then'](function(_0x508e03){_0x443ea1[_0x401c('0x43')]=_0x508e03;return _0x443ea1;})[_0x401c('0x21')](respondWithFilteredResult(_0x446415,_0x1d357c))[_0x401c('0x44')](handleError(_0x446415,null));};exports[_0x401c('0x45')]=function(_0x543264,_0x3ea426){var _0x1140f4={'raw':!![],'where':{'id':_0x543264[_0x401c('0x46')]['id']}},_0x2ba1d2={};_0x2ba1d2[_0x401c('0x2f')]=_[_0x401c('0x31')](db['Template']['rawAttributes']);_0x2ba1d2['query']=_['keys'](_0x543264[_0x401c('0x30')]);_0x2ba1d2[_0x401c('0x32')]=_['intersection'](_0x2ba1d2['model'],_0x2ba1d2[_0x401c('0x30')]);_0x1140f4[_0x401c('0x34')]=_['intersection'](_0x2ba1d2['model'],qs['fields'](_0x543264[_0x401c('0x30')][_0x401c('0x35')]));_0x1140f4[_0x401c('0x34')]=_0x1140f4['attributes']['length']?_0x1140f4[_0x401c('0x34')]:_0x2ba1d2[_0x401c('0x2f')];if(_0x543264[_0x401c('0x30')]['includeAll']){_0x1140f4[_0x401c('0x41')]=[{'all':!![]}];}_0x1140f4=_[_0x401c('0x3c')]({},_0x1140f4,_0x543264[_0x401c('0x3e')]);return db[_0x401c('0x3f')][_0x401c('0x47')](_0x1140f4)[_0x401c('0x21')](handleEntityNotFound(_0x3ea426,null))[_0x401c('0x21')](respondWithResult(_0x3ea426,null))[_0x401c('0x44')](handleError(_0x3ea426,null));};exports[_0x401c('0x48')]=function(_0x4f42d7,_0x2c916c){return db[_0x401c('0x3f')][_0x401c('0x48')](_0x4f42d7['body'],{})[_0x401c('0x21')](function(_0x556723){var _0x4bc01b=_0x4f42d7[_0x401c('0x49')]['get']({'plain':!![]});if(!_0x4bc01b)throw new Error(_0x401c('0x4a'));if(_0x4bc01b[_0x401c('0x4b')]===_0x401c('0x49')){var _0x9c3b8=_0x556723[_0x401c('0x23')]({'plain':!![]});var _0x216bd1=_0x401c('0x24');return db[_0x401c('0x4c')]['find']({'where':{'name':_0x216bd1,'userProfileId':_0x4bc01b[_0x401c('0x4d')]},'raw':!![]})[_0x401c('0x21')](function(_0x904947){if(_0x904947&&_0x904947['autoAssociation']===0x0){return db[_0x401c('0x25')][_0x401c('0x48')]({'name':_0x9c3b8['name'],'resourceId':_0x9c3b8['id'],'type':_0x904947[_0x401c('0x28')],'sectionId':_0x904947['id']},{})[_0x401c('0x21')](function(){return _0x556723;});}else{return _0x556723;}})[_0x401c('0x44')](function(_0x430843){logger[_0x401c('0x26')](_0x401c('0x4e'),_0x430843);throw _0x430843;});}return _0x556723;})[_0x401c('0x21')](respondWithResult(_0x2c916c,0xc9))[_0x401c('0x44')](handleError(_0x2c916c,null));};exports['update']=function(_0x42337f,_0x251771){if(_0x42337f['body']['id']){delete _0x42337f[_0x401c('0x4f')]['id'];}return db[_0x401c('0x3f')][_0x401c('0x47')]({'where':{'id':_0x42337f[_0x401c('0x46')]['id']}})[_0x401c('0x21')](handleEntityNotFound(_0x251771,null))['then'](saveUpdates(_0x42337f['body'],null))['then'](respondWithResult(_0x251771,null))['catch'](handleError(_0x251771,null));};exports[_0x401c('0x22')]=function(_0x786b91,_0x3ab21d){return db[_0x401c('0x3f')]['find']({'where':{'id':_0x786b91[_0x401c('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ab21d,null))['then'](removeEntity(_0x3ab21d,null))[_0x401c('0x44')](handleError(_0x3ab21d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 5a36873..a50f710 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 _0x0d59=['path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','util','../../config/logger','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d59,0x1dc));var _0x90d5=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0x0d59[_0x343090];return _0x3ff3e8;};'use strict';var _=require('lodash');var util=require(_0x90d5('0x0'));var logger=require(_0x90d5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x90d5('0x2'));var rp=require(_0x90d5('0x3'));var fs=require('fs');var path=require(_0x90d5('0x4'));var rimraf=require(_0x90d5('0x5'));var config=require(_0x90d5('0x6'));var attributes=require(_0x90d5('0x7'));module[_0x90d5('0x8')]=function(_0x59884c,_0x51dd0b){return _0x59884c[_0x90d5('0x9')](_0x90d5('0xa'),attributes,{'tableName':_0x90d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec43=['./template.attributes','exports','Template','tools_templates','lodash','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2263d6,_0x23ef72){var _0x392795=function(_0x555ceb){while(--_0x555ceb){_0x2263d6['push'](_0x2263d6['shift']());}};_0x392795(++_0x23ef72);}(_0xec43,0x1f3));var _0x3ec4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec43[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3ec4('0x0'));var util=require(_0x3ec4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3ec4('0x2'));var BPromise=require(_0x3ec4('0x3'));var rp=require(_0x3ec4('0x4'));var fs=require('fs');var path=require(_0x3ec4('0x5'));var rimraf=require('rimraf');var config=require(_0x3ec4('0x6'));var attributes=require(_0x3ec4('0x7'));module[_0x3ec4('0x8')]=function(_0x41235b,_0x44ff5a){return _0x41235b['define'](_0x3ec4('0x9'),attributes,{'tableName':_0x3ec4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 1281b65..1a4f7e5 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 _0xbf91=['then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','message','result','catch','findAll','options','where','attributes','limit','map','include','model','GetTemplate','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x55336a,_0x240d59){var _0x28ceb3=function(_0x399d5c){while(--_0x399d5c){_0x55336a['push'](_0x55336a['shift']());}};_0x28ceb3(++_0x240d59);}(_0xbf91,0x97));var _0x1bf9=function(_0x4bcc9d,_0xab98f0){_0x4bcc9d=_0x4bcc9d-0x0;var _0x2394f6=_0xbf91[_0x4bcc9d];return _0x2394f6;};'use strict';var _=require(_0x1bf9('0x0'));var util=require(_0x1bf9('0x1'));var moment=require(_0x1bf9('0x2'));var BPromise=require(_0x1bf9('0x3'));var rs=require(_0x1bf9('0x4'));var fs=require('fs');var Redis=require(_0x1bf9('0x5'));var db=require(_0x1bf9('0x6'))['db'];var utils=require(_0x1bf9('0x7'));var logger=require(_0x1bf9('0x8'))('rpc');var config=require(_0x1bf9('0x9'));var jayson=require(_0x1bf9('0xa'));var client=jayson[_0x1bf9('0xb')][_0x1bf9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ed773,_0x2eb146,_0x5f262a){return new BPromise(function(_0x4be6bb,_0x4cad3a){return client[_0x1bf9('0xd')](_0x1ed773,_0x5f262a)[_0x1bf9('0xe')](function(_0x55a608){logger[_0x1bf9('0xf')](_0x1bf9('0x10'),_0x2eb146,_0x1bf9('0x11'));logger['debug'](_0x1bf9('0x12'),_0x2eb146,_0x1bf9('0x11'),JSON['stringify'](_0x55a608));if(_0x55a608[_0x1bf9('0x13')]){if(_0x55a608[_0x1bf9('0x13')]['code']===0x1f4){logger[_0x1bf9('0x13')](_0x1bf9('0x10'),_0x2eb146,_0x55a608[_0x1bf9('0x13')][_0x1bf9('0x14')]);return _0x4cad3a(_0x55a608[_0x1bf9('0x13')]['message']);}logger['error'](_0x1bf9('0x10'),_0x2eb146,_0x55a608[_0x1bf9('0x13')]['message']);return _0x4be6bb(_0x55a608[_0x1bf9('0x13')][_0x1bf9('0x14')]);}else{logger[_0x1bf9('0xf')]('Template,\x20%s,\x20%s',_0x2eb146,'request\x20sent');_0x4be6bb(_0x55a608[_0x1bf9('0x15')][_0x1bf9('0x14')]);}})[_0x1bf9('0x16')](function(_0x3b9292){logger[_0x1bf9('0x13')](_0x1bf9('0x10'),_0x2eb146,_0x3b9292);_0x4cad3a(_0x3b9292);});});}exports['GetTemplate']=function(_0x2cb34c){var _0x224977=this;return new Promise(function(_0x141ced,_0x181653){return db['Template'][_0x1bf9('0x17')]({'raw':_0x2cb34c[_0x1bf9('0x18')]?_0x2cb34c[_0x1bf9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2cb34c[_0x1bf9('0x18')]?_0x2cb34c[_0x1bf9('0x18')][_0x1bf9('0x19')]||null:null,'attributes':_0x2cb34c[_0x1bf9('0x18')]?_0x2cb34c[_0x1bf9('0x18')][_0x1bf9('0x1a')]||null:null,'limit':_0x2cb34c['options']?_0x2cb34c[_0x1bf9('0x18')][_0x1bf9('0x1b')]||null:null,'include':_0x2cb34c[_0x1bf9('0x18')]?_0x2cb34c[_0x1bf9('0x18')]['include']?_[_0x1bf9('0x1c')](_0x2cb34c[_0x1bf9('0x18')][_0x1bf9('0x1d')],function(_0x12aa68){return{'model':db[_0x12aa68[_0x1bf9('0x1e')]],'as':_0x12aa68['as'],'attributes':_0x12aa68[_0x1bf9('0x1a')],'include':_0x12aa68[_0x1bf9('0x1d')]?_[_0x1bf9('0x1c')](_0x12aa68[_0x1bf9('0x1d')],function(_0x198449){return{'model':db[_0x198449['model']],'as':_0x198449['as'],'attributes':_0x198449[_0x1bf9('0x1a')],'include':_0x198449[_0x1bf9('0x1d')]?_[_0x1bf9('0x1c')](_0x198449[_0x1bf9('0x1d')],function(_0x1bb920){return{'model':db[_0x1bb920[_0x1bf9('0x1e')]],'as':_0x1bb920['as'],'attributes':_0x1bb920['attributes']};}):[]};}):[]};}):[]:[]})[_0x1bf9('0xe')](function(_0x13137e){logger[_0x1bf9('0xf')](_0x1bf9('0x1f'),_0x2cb34c);logger[_0x1bf9('0x20')](_0x1bf9('0x1f'),_0x2cb34c,JSON['stringify'](_0x13137e));_0x141ced(_0x13137e);})[_0x1bf9('0x16')](function(_0x1553f9){logger['error']('GetTemplate',_0x1553f9['message'],_0x2cb34c);_0x181653(_0x224977[_0x1bf9('0x13')](0x1f4,_0x1553f9['message']));});});}; \ No newline at end of file +var _0x025e=['http','request','then','info','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetTemplate','findAll','raw','options','attributes','include','map','model','debug','stringify','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x9593e1,_0x4691c7){var _0x464014=function(_0x216d16){while(--_0x216d16){_0x9593e1['push'](_0x9593e1['shift']());}};_0x464014(++_0x4691c7);}(_0x025e,0x116));var _0xe025=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x025e[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xe025('0x0'));var util=require('util');var moment=require(_0xe025('0x1'));var BPromise=require(_0xe025('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe025('0x3'));var db=require(_0xe025('0x4'))['db'];var utils=require(_0xe025('0x5'));var logger=require(_0xe025('0x6'))('rpc');var config=require(_0xe025('0x7'));var jayson=require(_0xe025('0x8'));var client=jayson[_0xe025('0x9')][_0xe025('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f5d18,_0x1ee520,_0x5c896d){return new BPromise(function(_0x212c07,_0x839b1e){return client[_0xe025('0xb')](_0x4f5d18,_0x5c896d)[_0xe025('0xc')](function(_0x1b6ff3){logger[_0xe025('0xd')](_0xe025('0xe'),_0x1ee520,'request\x20sent');logger['debug'](_0xe025('0xf'),_0x1ee520,_0xe025('0x10'),JSON['stringify'](_0x1b6ff3));if(_0x1b6ff3[_0xe025('0x11')]){if(_0x1b6ff3[_0xe025('0x11')][_0xe025('0x12')]===0x1f4){logger['error'](_0xe025('0xe'),_0x1ee520,_0x1b6ff3[_0xe025('0x11')]['message']);return _0x839b1e(_0x1b6ff3[_0xe025('0x11')][_0xe025('0x13')]);}logger['error'](_0xe025('0xe'),_0x1ee520,_0x1b6ff3['error']['message']);return _0x212c07(_0x1b6ff3[_0xe025('0x11')][_0xe025('0x13')]);}else{logger[_0xe025('0xd')]('Template,\x20%s,\x20%s',_0x1ee520,_0xe025('0x10'));_0x212c07(_0x1b6ff3[_0xe025('0x14')][_0xe025('0x13')]);}})['catch'](function(_0x156609){logger[_0xe025('0x11')](_0xe025('0xe'),_0x1ee520,_0x156609);_0x839b1e(_0x156609);});});}exports[_0xe025('0x15')]=function(_0x20b7d2){var _0x2bc42e=this;return new Promise(function(_0x2907c2,_0x56a8ae){return db['Template'][_0xe025('0x16')]({'raw':_0x20b7d2['options']?_0x20b7d2['options'][_0xe025('0x17')]===undefined?!![]:![]:!![],'where':_0x20b7d2[_0xe025('0x18')]?_0x20b7d2[_0xe025('0x18')]['where']||null:null,'attributes':_0x20b7d2[_0xe025('0x18')]?_0x20b7d2[_0xe025('0x18')][_0xe025('0x19')]||null:null,'limit':_0x20b7d2['options']?_0x20b7d2['options']['limit']||null:null,'include':_0x20b7d2[_0xe025('0x18')]?_0x20b7d2['options'][_0xe025('0x1a')]?_['map'](_0x20b7d2[_0xe025('0x18')][_0xe025('0x1a')],function(_0x125f66){return{'model':db[_0x125f66['model']],'as':_0x125f66['as'],'attributes':_0x125f66[_0xe025('0x19')],'include':_0x125f66[_0xe025('0x1a')]?_[_0xe025('0x1b')](_0x125f66[_0xe025('0x1a')],function(_0x339304){return{'model':db[_0x339304[_0xe025('0x1c')]],'as':_0x339304['as'],'attributes':_0x339304['attributes'],'include':_0x339304[_0xe025('0x1a')]?_[_0xe025('0x1b')](_0x339304[_0xe025('0x1a')],function(_0x5bdc5f){return{'model':db[_0x5bdc5f[_0xe025('0x1c')]],'as':_0x5bdc5f['as'],'attributes':_0x5bdc5f[_0xe025('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x301835){logger[_0xe025('0xd')]('GetTemplate',_0x20b7d2);logger[_0xe025('0x1d')](_0xe025('0x15'),_0x20b7d2,JSON[_0xe025('0x1e')](_0x301835));_0x2907c2(_0x301835);})[_0xe025('0x1f')](function(_0x17a5ad){logger['error'](_0xe025('0x15'),_0x17a5ad[_0xe025('0x13')],_0x20b7d2);_0x56a8ae(_0x2bc42e[_0xe025('0x11')](0x1f4,_0x17a5ad['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b8ac065..8d9b986 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 _0x8f9b=['destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','getAnyConditions','getActions','create','post','/:id/all_conditions','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','update','delete'];(function(_0x59a829,_0x121a7e){var _0x382f30=function(_0x4558d7){while(--_0x4558d7){_0x59a829['push'](_0x59a829['shift']());}};_0x382f30(++_0x121a7e);}(_0x8f9b,0x1bb));var _0xb8f9=function(_0x23fc93,_0x3b72c6){_0x23fc93=_0x23fc93-0x0;var _0x4dd9cd=_0x8f9b[_0x23fc93];return _0x4dd9cd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb8f9('0x0'));var timeout=require('connect-timeout');var express=require(_0xb8f9('0x1'));var router=express[_0xb8f9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb8f9('0x3'));var interaction=require(_0xb8f9('0x4'));var config=require(_0xb8f9('0x5'));var controller=require(_0xb8f9('0x6'));router[_0xb8f9('0x7')]('/',auth[_0xb8f9('0x8')](),controller[_0xb8f9('0x9')]);router[_0xb8f9('0x7')](_0xb8f9('0xa'),auth[_0xb8f9('0x8')](),controller[_0xb8f9('0xb')]);router[_0xb8f9('0x7')]('/:id/all_conditions',auth[_0xb8f9('0x8')](),controller[_0xb8f9('0xc')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xb8f9('0xd')]);router['get']('/:id/actions',auth[_0xb8f9('0x8')](),controller[_0xb8f9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb8f9('0xf')]);router[_0xb8f9('0x10')](_0xb8f9('0x11'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0xb8f9('0x10')](_0xb8f9('0x12'),auth[_0xb8f9('0x8')](),controller[_0xb8f9('0x13')]);router[_0xb8f9('0x10')](_0xb8f9('0x14'),auth[_0xb8f9('0x8')](),controller[_0xb8f9('0x15')]);router[_0xb8f9('0x16')](_0xb8f9('0xa'),auth['isAuthenticated'](),controller[_0xb8f9('0x17')]);router[_0xb8f9('0x18')]('/:id',auth[_0xb8f9('0x8')](),controller[_0xb8f9('0x19')]);module['exports']=router; \ No newline at end of file +var _0x88c3=['./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5d3b5b,_0x4ec5f0){var _0x2a629b=function(_0x16358f){while(--_0x16358f){_0x5d3b5b['push'](_0x5d3b5b['shift']());}};_0x2a629b(++_0x4ec5f0);}(_0x88c3,0x1c2));var _0x388c=function(_0xd259e9,_0x10dfb3){_0xd259e9=_0xd259e9-0x0;var _0x33435a=_0x88c3[_0xd259e9];return _0x33435a;};'use strict';var multer=require('multer');var util=require(_0x388c('0x0'));var path=require('path');var timeout=require(_0x388c('0x1'));var express=require(_0x388c('0x2'));var router=express['Router']();var fs_extra=require(_0x388c('0x3'));var auth=require(_0x388c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x388c('0x5'));var controller=require(_0x388c('0x6'));router[_0x388c('0x7')]('/',auth[_0x388c('0x8')](),controller[_0x388c('0x9')]);router[_0x388c('0x7')](_0x388c('0xa'),auth[_0x388c('0x8')](),controller['show']);router[_0x388c('0x7')](_0x388c('0xb'),auth[_0x388c('0x8')](),controller['getAllConditions']);router[_0x388c('0x7')]('/:id/any_conditions',auth[_0x388c('0x8')](),controller['getAnyConditions']);router[_0x388c('0x7')]('/:id/actions',auth[_0x388c('0x8')](),controller[_0x388c('0xc')]);router[_0x388c('0xd')]('/',auth['isAuthenticated'](),controller[_0x388c('0xe')]);router[_0x388c('0xd')](_0x388c('0xb'),auth[_0x388c('0x8')](),controller[_0x388c('0xf')]);router[_0x388c('0xd')](_0x388c('0x10'),auth['isAuthenticated'](),controller[_0x388c('0x11')]);router[_0x388c('0xd')](_0x388c('0x12'),auth[_0x388c('0x8')](),controller[_0x388c('0x13')]);router[_0x388c('0x14')](_0x388c('0xa'),auth[_0x388c('0x8')](),controller[_0x388c('0x15')]);router[_0x388c('0x16')]('/:id',auth[_0x388c('0x8')](),controller['destroy']);module[_0x388c('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 fc40ea3..d4a4bf5 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 _0x6599=['exports','STRING','BOOLEAN','sequelize'];(function(_0x57e517,_0x2707ba){var _0x44ea02=function(_0x31f600){while(--_0x31f600){_0x57e517['push'](_0x57e517['shift']());}};_0x44ea02(++_0x2707ba);}(_0x6599,0x1e7));var _0x9659=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x6599[_0x4653f7];return _0x5454da;};'use strict';var Sequelize=require(_0x9659('0x0'));module[_0x9659('0x1')]={'name':{'type':Sequelize[_0x9659('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x9659('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3946=['sequelize','STRING'];(function(_0x1060f2,_0x3a8aad){var _0x10d447=function(_0x4c9a25){while(--_0x4c9a25){_0x1060f2['push'](_0x1060f2['shift']());}};_0x10d447(++_0x3a8aad);}(_0x3946,0x1d8));var _0x6394=function(_0x113324,_0x273ee0){_0x113324=_0x113324-0x0;var _0x29604d=_0x3946[_0x113324];return _0x29604d;};'use strict';var Sequelize=require(_0x6394('0x0'));module['exports']={'name':{'type':Sequelize[_0x6394('0x1')]},'channel':{'type':Sequelize[_0x6394('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 000db3e..37f26f9 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 _0x75d4=['order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','addAnyCondition','Condition','getAllConditions','findOne','pick','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','name','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x2faa17,_0x4d2f48){var _0x5b3a94=function(_0x1b9e48){while(--_0x1b9e48){_0x2faa17['push'](_0x2faa17['shift']());}};_0x5b3a94(++_0x4d2f48);}(_0x75d4,0x83));var _0x475d=function(_0x2559bc,_0x28e6eb){_0x2559bc=_0x2559bc-0x0;var _0x3e1550=_0x75d4[_0x2559bc];return _0x3e1550;};'use strict';var emlformat=require(_0x475d('0x0'));var rimraf=require(_0x475d('0x1'));var zipdir=require(_0x475d('0x2'));var jsonpatch=require(_0x475d('0x3'));var rp=require('request-promise');var moment=require(_0x475d('0x4'));var BPromise=require(_0x475d('0x5'));var Mustache=require(_0x475d('0x6'));var util=require('util');var path=require(_0x475d('0x7'));var sox=require(_0x475d('0x8'));var csv=require(_0x475d('0x9'));var ejs=require(_0x475d('0xa'));var fs=require('fs');var fs_extra=require(_0x475d('0xb'));var _=require(_0x475d('0xc'));var squel=require(_0x475d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x475d('0x9'));var querystring=require(_0x475d('0xe'));var Papa=require(_0x475d('0xf'));var Redis=require(_0x475d('0x10'));var authService=require(_0x475d('0x11'));var qs=require(_0x475d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x475d('0x13'))(_0x475d('0x14'));var utils=require(_0x475d('0x15'));var config=require(_0x475d('0x16'));var licenseUtil=require(_0x475d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2420a9,_0x162d13){_0x162d13=_0x162d13||0xcc;return function(_0x58c353){if(_0x58c353){return _0x2420a9[_0x475d('0x18')](_0x162d13);}return _0x2420a9[_0x475d('0x19')](_0x162d13)[_0x475d('0x1a')]();};}function respondWithResult(_0x358326,_0x2058ce){_0x2058ce=_0x2058ce||0xc8;return function(_0x1929bf){if(_0x1929bf){return _0x358326[_0x475d('0x19')](_0x2058ce)[_0x475d('0x1b')](_0x1929bf);}};}function respondWithFilteredResult(_0x122890,_0x1e8e45){return function(_0x4449b4){if(_0x4449b4){var _0x13c3de=typeof _0x1e8e45[_0x475d('0x1c')]===_0x475d('0x1d')&&typeof _0x1e8e45[_0x475d('0x1e')]===_0x475d('0x1d');var _0x4044fd=_0x4449b4[_0x475d('0x1f')];var _0x44b2f3=_0x13c3de?0x0:_0x1e8e45[_0x475d('0x1c')];var _0x105761=_0x13c3de?_0x4449b4[_0x475d('0x1f')]:_0x1e8e45[_0x475d('0x1c')]+_0x1e8e45['limit'];var _0x450848;if(_0x105761>=_0x4044fd){_0x105761=_0x4044fd;_0x450848=0xc8;}else{_0x450848=0xce;}_0x122890[_0x475d('0x19')](_0x450848);return _0x122890[_0x475d('0x20')](_0x475d('0x21'),_0x44b2f3+'-'+_0x105761+'/'+_0x4044fd)[_0x475d('0x1b')](_0x4449b4);}return null;};}function patchUpdates(_0x112c19){return function(_0x381ae9){try{jsonpatch[_0x475d('0x22')](_0x381ae9,_0x112c19,!![]);}catch(_0x279b2d){return BPromise[_0x475d('0x23')](_0x279b2d);}return _0x381ae9[_0x475d('0x24')]();};}function saveUpdates(_0x34e0ba,_0x273708){return function(_0x1162b8){if(_0x1162b8){return _0x1162b8[_0x475d('0x25')](_0x34e0ba)[_0x475d('0x26')](function(_0x35afe6){return _0x35afe6;});}return null;};}function removeEntity(_0xa3f8c8,_0x702692){return function(_0x31c939){if(_0x31c939){return _0x31c939['destroy']()[_0x475d('0x26')](function(){var _0x450dd9=_0x31c939[_0x475d('0x27')]({'plain':!![]});var _0x522b29='Triggers';return db[_0x475d('0x28')][_0x475d('0x29')]({'where':{'type':_0x522b29,'resourceId':_0x450dd9['id']}})[_0x475d('0x26')](function(){return _0x31c939;});})['then'](function(){_0xa3f8c8['status'](0xcc)[_0x475d('0x1a')]();});}};}function handleEntityNotFound(_0x598405,_0x3f0cc1){return function(_0x403029){if(!_0x403029){_0x598405[_0x475d('0x18')](0x194);}return _0x403029;};}function handleError(_0x2b7d22,_0x54cfe3){_0x54cfe3=_0x54cfe3||0x1f4;return function(_0x508936){logger[_0x475d('0x2a')](_0x508936['stack']);if(_0x508936[_0x475d('0x2b')]){delete _0x508936[_0x475d('0x2b')];}_0x2b7d22[_0x475d('0x19')](_0x54cfe3)['send'](_0x508936);};}exports[_0x475d('0x2c')]=function(_0x5ba227,_0x48ae02){var _0x57a54c={},_0x4fc4ce={},_0x49057e={'count':0x0,'rows':[]};var _0x548368=_[_0x475d('0x2d')](db[_0x475d('0x2e')][_0x475d('0x2f')],function(_0x392aa6){return{'name':_0x392aa6[_0x475d('0x30')],'type':_0x392aa6[_0x475d('0x31')][_0x475d('0x32')]};});_0x4fc4ce[_0x475d('0x33')]=_[_0x475d('0x2d')](_0x548368,_0x475d('0x2b'));_0x4fc4ce[_0x475d('0x34')]=_[_0x475d('0x35')](_0x5ba227['query']);_0x4fc4ce['filters']=_[_0x475d('0x36')](_0x4fc4ce[_0x475d('0x33')],_0x4fc4ce[_0x475d('0x34')]);_0x57a54c[_0x475d('0x37')]=_[_0x475d('0x36')](_0x4fc4ce[_0x475d('0x33')],qs['fields'](_0x5ba227[_0x475d('0x34')][_0x475d('0x38')]));_0x57a54c[_0x475d('0x37')]=_0x57a54c[_0x475d('0x37')]['length']?_0x57a54c[_0x475d('0x37')]:_0x4fc4ce[_0x475d('0x33')];if(!_0x5ba227[_0x475d('0x34')][_0x475d('0x39')](_0x475d('0x3a'))){_0x57a54c[_0x475d('0x1e')]=qs['limit'](_0x5ba227[_0x475d('0x34')][_0x475d('0x1e')]);_0x57a54c[_0x475d('0x1c')]=qs[_0x475d('0x1c')](_0x5ba227[_0x475d('0x34')]['offset']);}_0x57a54c[_0x475d('0x3b')]=qs[_0x475d('0x3c')](_0x5ba227[_0x475d('0x34')][_0x475d('0x3c')]);_0x57a54c[_0x475d('0x3d')]=qs[_0x475d('0x3e')](_['pick'](_0x5ba227[_0x475d('0x34')],_0x4fc4ce[_0x475d('0x3e')]),_0x548368);if(_0x5ba227[_0x475d('0x34')][_0x475d('0x3f')]){_0x57a54c[_0x475d('0x3d')]=_['merge'](_0x57a54c[_0x475d('0x3d')],{'$or':_[_0x475d('0x2d')](_0x548368,function(_0x259c80){if(_0x259c80[_0x475d('0x31')]!==_0x475d('0x40')){var _0x34cd02={};_0x34cd02[_0x259c80[_0x475d('0x2b')]]={'$like':'%'+_0x5ba227[_0x475d('0x34')][_0x475d('0x3f')]+'%'};return _0x34cd02;}})});}_0x57a54c=_[_0x475d('0x41')]({},_0x57a54c,_0x5ba227[_0x475d('0x42')]);var _0x41ff9c={'where':_0x57a54c[_0x475d('0x3d')]};return db[_0x475d('0x2e')][_0x475d('0x1f')](_0x41ff9c)[_0x475d('0x26')](function(_0x185b28){_0x49057e[_0x475d('0x1f')]=_0x185b28;if(_0x5ba227[_0x475d('0x34')][_0x475d('0x43')]){_0x57a54c[_0x475d('0x44')]=[{'all':!![]}];}return db[_0x475d('0x2e')][_0x475d('0x45')](_0x57a54c);})['then'](function(_0x204185){_0x49057e[_0x475d('0x46')]=_0x204185;return _0x49057e;})[_0x475d('0x26')](respondWithFilteredResult(_0x48ae02,_0x57a54c))['catch'](handleError(_0x48ae02,null));};exports['show']=function(_0x3478f9,_0xa96e55){var _0x445c62={'raw':![],'where':{'id':_0x3478f9['params']['id']}},_0x3a7772={};_0x3a7772[_0x475d('0x33')]=_[_0x475d('0x35')](db['Trigger'][_0x475d('0x2f')]);_0x3a7772[_0x475d('0x34')]=_[_0x475d('0x35')](_0x3478f9[_0x475d('0x34')]);_0x3a7772['filters']=_[_0x475d('0x36')](_0x3a7772[_0x475d('0x33')],_0x3a7772[_0x475d('0x34')]);_0x445c62[_0x475d('0x37')]=_[_0x475d('0x36')](_0x3a7772[_0x475d('0x33')],qs[_0x475d('0x38')](_0x3478f9[_0x475d('0x34')][_0x475d('0x38')]));_0x445c62['attributes']=_0x445c62[_0x475d('0x37')][_0x475d('0x47')]?_0x445c62[_0x475d('0x37')]:_0x3a7772[_0x475d('0x33')];if(_0x3478f9[_0x475d('0x34')]['includeAll']){_0x445c62['include']=[{'all':!![]}];}_0x445c62=_['merge']({},_0x445c62,_0x3478f9[_0x475d('0x42')]);return db['Trigger'][_0x475d('0x48')](_0x445c62)['then'](handleEntityNotFound(_0xa96e55,null))[_0x475d('0x26')](respondWithResult(_0xa96e55,null))[_0x475d('0x49')](handleError(_0xa96e55,null));};exports[_0x475d('0x4a')]=function(_0x3d32ea,_0x3ffca1){return db[_0x475d('0x2e')]['create'](_0x3d32ea[_0x475d('0x4b')],{})[_0x475d('0x26')](function(_0x413eb6){var _0x16abee=_0x3d32ea[_0x475d('0x4c')][_0x475d('0x27')]({'plain':!![]});if(!_0x16abee)throw new Error(_0x475d('0x4d'));if(_0x16abee[_0x475d('0x4e')]===_0x475d('0x4c')){var _0x767ead=_0x413eb6[_0x475d('0x27')]({'plain':!![]});var _0x2e97bb=_0x475d('0x4f');return db[_0x475d('0x50')]['find']({'where':{'name':_0x2e97bb,'userProfileId':_0x16abee[_0x475d('0x51')]},'raw':!![]})[_0x475d('0x26')](function(_0x5da3ae){if(_0x5da3ae&&_0x5da3ae[_0x475d('0x52')]===0x0){return db[_0x475d('0x28')][_0x475d('0x4a')]({'name':_0x767ead['name'],'resourceId':_0x767ead['id'],'type':_0x5da3ae[_0x475d('0x2b')],'sectionId':_0x5da3ae['id']},{})[_0x475d('0x26')](function(){return _0x413eb6;});}else{return _0x413eb6;}})[_0x475d('0x49')](function(_0x5be7a6){logger['error'](_0x475d('0x53'),_0x5be7a6);throw _0x5be7a6;});}return _0x413eb6;})[_0x475d('0x26')](respondWithResult(_0x3ffca1,0xc9))[_0x475d('0x49')](handleError(_0x3ffca1,null));};exports[_0x475d('0x25')]=function(_0x341e9c,_0x35658e){if(_0x341e9c[_0x475d('0x4b')]['id']){delete _0x341e9c[_0x475d('0x4b')]['id'];}return db[_0x475d('0x2e')]['find']({'where':{'id':_0x341e9c[_0x475d('0x54')]['id']}})[_0x475d('0x26')](handleEntityNotFound(_0x35658e,null))[_0x475d('0x26')](saveUpdates(_0x341e9c[_0x475d('0x4b')],null))['then'](respondWithResult(_0x35658e,null))[_0x475d('0x49')](handleError(_0x35658e,null));};exports[_0x475d('0x29')]=function(_0x3c8f2d,_0x49562f){return db[_0x475d('0x2e')][_0x475d('0x48')]({'where':{'id':_0x3c8f2d[_0x475d('0x54')]['id']}})[_0x475d('0x26')](handleEntityNotFound(_0x49562f,null))[_0x475d('0x26')](removeEntity(_0x49562f,null))[_0x475d('0x49')](handleError(_0x49562f,null));};exports[_0x475d('0x55')]=function(_0x19ae99,_0x838de1,_0x279521){if(_0x19ae99[_0x475d('0x4b')]['id']){delete _0x19ae99['body']['id'];}return db[_0x475d('0x2e')]['find']({'where':{'id':_0x19ae99[_0x475d('0x54')]['id']}})['then'](handleEntityNotFound(_0x838de1,null))[_0x475d('0x26')](function(_0x1953df){if(_0x1953df){_0x19ae99[_0x475d('0x4b')]['TriggerAllId']=_0x1953df['id'];return db['Condition'][_0x475d('0x4a')](_0x19ae99['body']);}})[_0x475d('0x26')](respondWithResult(_0x838de1,null))[_0x475d('0x49')](handleError(_0x838de1,null));};exports[_0x475d('0x56')]=function(_0x4f7578,_0x3aa349,_0x495c4e){if(_0x4f7578[_0x475d('0x4b')]['id']){delete _0x4f7578[_0x475d('0x4b')]['id'];}return db[_0x475d('0x2e')][_0x475d('0x48')]({'where':{'id':_0x4f7578[_0x475d('0x54')]['id']}})['then'](handleEntityNotFound(_0x3aa349,null))[_0x475d('0x26')](function(_0x47834a){if(_0x47834a){_0x4f7578[_0x475d('0x4b')]['TriggerAnyId']=_0x47834a['id'];return db[_0x475d('0x57')][_0x475d('0x4a')](_0x4f7578[_0x475d('0x4b')]);}})[_0x475d('0x26')](respondWithResult(_0x3aa349,null))[_0x475d('0x49')](handleError(_0x3aa349,null));};exports[_0x475d('0x58')]=function(_0x29024b,_0x10ca81,_0x2cd8f9){var _0x3a28e8={};var _0x57dced={};var _0x3e7ed5;var _0x223212;return db[_0x475d('0x2e')][_0x475d('0x59')]({'where':{'id':_0x29024b['params']['id']}})[_0x475d('0x26')](handleEntityNotFound(_0x10ca81,null))[_0x475d('0x26')](function(_0x161af2){if(_0x161af2){_0x3e7ed5=_0x161af2;_0x57dced[_0x475d('0x33')]=_['keys'](db[_0x475d('0x57')][_0x475d('0x2f')]);_0x57dced[_0x475d('0x34')]=_[_0x475d('0x35')](_0x29024b[_0x475d('0x34')]);_0x57dced['filters']=_[_0x475d('0x36')](_0x57dced['model'],_0x57dced[_0x475d('0x34')]);_0x3a28e8[_0x475d('0x37')]=_['intersection'](_0x57dced[_0x475d('0x33')],qs[_0x475d('0x38')](_0x29024b[_0x475d('0x34')][_0x475d('0x38')]));_0x3a28e8[_0x475d('0x37')]=_0x3a28e8[_0x475d('0x37')]['length']?_0x3a28e8[_0x475d('0x37')]:_0x57dced[_0x475d('0x33')];_0x3a28e8[_0x475d('0x3b')]=qs[_0x475d('0x3c')](_0x29024b[_0x475d('0x34')][_0x475d('0x3c')]);_0x3a28e8[_0x475d('0x3d')]=qs[_0x475d('0x3e')](_[_0x475d('0x5a')](_0x29024b[_0x475d('0x34')],_0x57dced[_0x475d('0x3e')]));if(_0x29024b['query'][_0x475d('0x3f')]){_0x3a28e8[_0x475d('0x3d')]=_[_0x475d('0x41')](_0x3a28e8[_0x475d('0x3d')],{'$or':_[_0x475d('0x2d')](_0x3a28e8[_0x475d('0x37')],function(_0x48bc32){var _0x19cc20={};_0x19cc20[_0x48bc32]={'$like':'%'+_0x29024b[_0x475d('0x34')]['filter']+'%'};return _0x19cc20;})});}_0x3a28e8=_[_0x475d('0x41')]({},_0x3a28e8,_0x29024b[_0x475d('0x42')]);return _0x3e7ed5['getAllConditions'](_0x3a28e8);}})[_0x475d('0x26')](function(_0x472f56){if(_0x472f56){_0x223212=_0x472f56['length'];if(!_0x29024b['query'][_0x475d('0x39')](_0x475d('0x3a'))){_0x3a28e8[_0x475d('0x1e')]=qs['limit'](_0x29024b[_0x475d('0x34')][_0x475d('0x1e')]);_0x3a28e8[_0x475d('0x1c')]=qs['offset'](_0x29024b[_0x475d('0x34')]['offset']);}return _0x3e7ed5['getAllConditions'](_0x3a28e8);}})[_0x475d('0x26')](function(_0x5bc126){if(_0x5bc126){return _0x5bc126?{'count':_0x223212,'rows':_0x5bc126}:null;}})['then'](respondWithResult(_0x10ca81,null))[_0x475d('0x49')](handleError(_0x10ca81,null));};exports[_0x475d('0x5b')]=function(_0xecfd4e,_0x4b39d1,_0x5cd0c1){var _0x36139f={};var _0x288a69={};var _0x345f1c;var _0x501d9b;return db[_0x475d('0x2e')][_0x475d('0x59')]({'where':{'id':_0xecfd4e[_0x475d('0x54')]['id']}})[_0x475d('0x26')](handleEntityNotFound(_0x4b39d1,null))[_0x475d('0x26')](function(_0xc01c74){if(_0xc01c74){_0x345f1c=_0xc01c74;_0x288a69['model']=_['keys'](db[_0x475d('0x57')][_0x475d('0x2f')]);_0x288a69['query']=_[_0x475d('0x35')](_0xecfd4e[_0x475d('0x34')]);_0x288a69['filters']=_['intersection'](_0x288a69['model'],_0x288a69[_0x475d('0x34')]);_0x36139f[_0x475d('0x37')]=_[_0x475d('0x36')](_0x288a69[_0x475d('0x33')],qs[_0x475d('0x38')](_0xecfd4e['query'][_0x475d('0x38')]));_0x36139f[_0x475d('0x37')]=_0x36139f['attributes']['length']?_0x36139f[_0x475d('0x37')]:_0x288a69[_0x475d('0x33')];_0x36139f[_0x475d('0x3b')]=qs[_0x475d('0x3c')](_0xecfd4e[_0x475d('0x34')][_0x475d('0x3c')]);_0x36139f['where']=qs[_0x475d('0x3e')](_[_0x475d('0x5a')](_0xecfd4e[_0x475d('0x34')],_0x288a69[_0x475d('0x3e')]));if(_0xecfd4e['query'][_0x475d('0x3f')]){_0x36139f[_0x475d('0x3d')]=_[_0x475d('0x41')](_0x36139f[_0x475d('0x3d')],{'$or':_[_0x475d('0x2d')](_0x36139f[_0x475d('0x37')],function(_0x159d0e){var _0x182517={};_0x182517[_0x159d0e]={'$like':'%'+_0xecfd4e[_0x475d('0x34')]['filter']+'%'};return _0x182517;})});}_0x36139f=_[_0x475d('0x41')]({},_0x36139f,_0xecfd4e[_0x475d('0x42')]);return _0x345f1c['getAnyConditions'](_0x36139f);}})[_0x475d('0x26')](function(_0x473497){if(_0x473497){_0x501d9b=_0x473497[_0x475d('0x47')];if(!_0xecfd4e['query'][_0x475d('0x39')](_0x475d('0x3a'))){_0x36139f[_0x475d('0x1e')]=qs[_0x475d('0x1e')](_0xecfd4e[_0x475d('0x34')][_0x475d('0x1e')]);_0x36139f[_0x475d('0x1c')]=qs[_0x475d('0x1c')](_0xecfd4e[_0x475d('0x34')]['offset']);}return _0x345f1c['getAnyConditions'](_0x36139f);}})[_0x475d('0x26')](function(_0x4d36e5){if(_0x4d36e5){return _0x4d36e5?{'count':_0x501d9b,'rows':_0x4d36e5}:null;}})[_0x475d('0x26')](respondWithResult(_0x4b39d1,null))[_0x475d('0x49')](handleError(_0x4b39d1,null));};exports['addAction']=function(_0x5ed207,_0x3f4bd7,_0x16f34b){if(_0x5ed207[_0x475d('0x4b')]['id']){delete _0x5ed207[_0x475d('0x4b')]['id'];}return db[_0x475d('0x2e')][_0x475d('0x48')]({'where':{'id':_0x5ed207[_0x475d('0x54')]['id']}})[_0x475d('0x26')](handleEntityNotFound(_0x3f4bd7,null))[_0x475d('0x26')](function(_0x5bd040){if(_0x5bd040){_0x5ed207[_0x475d('0x4b')][_0x475d('0x5c')]=_0x5bd040['id'];return db[_0x475d('0x5d')][_0x475d('0x4a')](_0x5ed207[_0x475d('0x4b')]);}})[_0x475d('0x26')](respondWithResult(_0x3f4bd7,null))[_0x475d('0x49')](handleError(_0x3f4bd7,null));};exports[_0x475d('0x5e')]=function(_0x4f3c82,_0x22928b,_0x3e0fe5){var _0x1776ce={};var _0x3cf838={};var _0x3a73a2;var _0x3bfb23;return db[_0x475d('0x2e')][_0x475d('0x59')]({'where':{'id':_0x4f3c82[_0x475d('0x54')]['id']}})[_0x475d('0x26')](handleEntityNotFound(_0x22928b,null))[_0x475d('0x26')](function(_0x1a13d3){if(_0x1a13d3){_0x3a73a2=_0x1a13d3;_0x3cf838['model']=_['keys'](db[_0x475d('0x5d')][_0x475d('0x2f')]);_0x3cf838[_0x475d('0x34')]=_[_0x475d('0x35')](_0x4f3c82[_0x475d('0x34')]);_0x3cf838[_0x475d('0x3e')]=_[_0x475d('0x36')](_0x3cf838['model'],_0x3cf838[_0x475d('0x34')]);_0x1776ce[_0x475d('0x37')]=_[_0x475d('0x36')](_0x3cf838[_0x475d('0x33')],qs[_0x475d('0x38')](_0x4f3c82[_0x475d('0x34')][_0x475d('0x38')]));_0x1776ce['attributes']=_0x1776ce[_0x475d('0x37')][_0x475d('0x47')]?_0x1776ce[_0x475d('0x37')]:_0x3cf838[_0x475d('0x33')];_0x1776ce[_0x475d('0x3b')]=qs[_0x475d('0x3c')](_0x4f3c82[_0x475d('0x34')][_0x475d('0x3c')]);_0x1776ce['where']=qs[_0x475d('0x3e')](_[_0x475d('0x5a')](_0x4f3c82[_0x475d('0x34')],_0x3cf838['filters']));if(_0x4f3c82['query'][_0x475d('0x3f')]){_0x1776ce['where']=_['merge'](_0x1776ce[_0x475d('0x3d')],{'$or':_[_0x475d('0x2d')](_0x1776ce[_0x475d('0x37')],function(_0x57729b){var _0xb1fea8={};_0xb1fea8[_0x57729b]={'$like':'%'+_0x4f3c82['query']['filter']+'%'};return _0xb1fea8;})});}_0x1776ce=_['merge']({},_0x1776ce,_0x4f3c82['options']);return _0x3a73a2[_0x475d('0x5e')](_0x1776ce);}})[_0x475d('0x26')](function(_0xdebcc2){if(_0xdebcc2){_0x3bfb23=_0xdebcc2[_0x475d('0x47')];if(!_0x4f3c82[_0x475d('0x34')][_0x475d('0x39')](_0x475d('0x3a'))){_0x1776ce[_0x475d('0x1e')]=qs[_0x475d('0x1e')](_0x4f3c82['query'][_0x475d('0x1e')]);_0x1776ce[_0x475d('0x1c')]=qs[_0x475d('0x1c')](_0x4f3c82[_0x475d('0x34')]['offset']);}return _0x3a73a2[_0x475d('0x5e')](_0x1776ce);}})[_0x475d('0x26')](function(_0x4683cc){if(_0x4683cc){return _0x4683cc?{'count':_0x3bfb23,'rows':_0x4683cc}:null;}})[_0x475d('0x26')](respondWithResult(_0x22928b,null))[_0x475d('0x49')](handleError(_0x22928b,null));}; \ No newline at end of file +var _0x9b2a=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','count','set','apply','get','Triggers','UserProfileResource','destroy','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','Trigger','findAll','rows','show','params','keys','catch','user','role','find','userProfileId','autoAssociation','create','error','update','body','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','length','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x440b7c,_0x2d524b){var _0x2d6581=function(_0x2cc17e){while(--_0x2cc17e){_0x440b7c['push'](_0x440b7c['shift']());}};_0x2d6581(++_0x2d524b);}(_0x9b2a,0x1cf));var _0xa9b2=function(_0x24b076,_0x107370){_0x24b076=_0x24b076-0x0;var _0x2f4281=_0x9b2a[_0x24b076];return _0x2f4281;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9b2('0x0'));var zipdir=require(_0xa9b2('0x1'));var jsonpatch=require(_0xa9b2('0x2'));var rp=require(_0xa9b2('0x3'));var moment=require(_0xa9b2('0x4'));var BPromise=require(_0xa9b2('0x5'));var Mustache=require('mustache');var util=require(_0xa9b2('0x6'));var path=require(_0xa9b2('0x7'));var sox=require(_0xa9b2('0x8'));var csv=require(_0xa9b2('0x9'));var ejs=require(_0xa9b2('0xa'));var fs=require('fs');var fs_extra=require(_0xa9b2('0xb'));var _=require(_0xa9b2('0xc'));var squel=require('squel');var crypto=require(_0xa9b2('0xd'));var jsforce=require(_0xa9b2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa9b2('0x9'));var querystring=require(_0xa9b2('0xf'));var Papa=require(_0xa9b2('0x10'));var Redis=require(_0xa9b2('0x11'));var authService=require(_0xa9b2('0x12'));var qs=require(_0xa9b2('0x13'));var as=require(_0xa9b2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9b2('0x15'));var utils=require(_0xa9b2('0x16'));var config=require(_0xa9b2('0x17'));var licenseUtil=require(_0xa9b2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b1c37,_0x3117f3){_0x3117f3=_0x3117f3||0xcc;return function(_0x27b4f4){if(_0x27b4f4){return _0x3b1c37['sendStatus'](_0x3117f3);}return _0x3b1c37[_0xa9b2('0x19')](_0x3117f3)['end']();};}function respondWithResult(_0x10ad6b,_0x2a68e4){_0x2a68e4=_0x2a68e4||0xc8;return function(_0x533148){if(_0x533148){return _0x10ad6b[_0xa9b2('0x19')](_0x2a68e4)[_0xa9b2('0x1a')](_0x533148);}};}function respondWithFilteredResult(_0x400bd9,_0x281b7d){return function(_0x42613d){if(_0x42613d){var _0x16fe29=typeof _0x281b7d['offset']===_0xa9b2('0x1b')&&typeof _0x281b7d[_0xa9b2('0x1c')]===_0xa9b2('0x1b');var _0x3f0f13=_0x42613d['count'];var _0x3d397e=_0x16fe29?0x0:_0x281b7d[_0xa9b2('0x1d')];var _0x592951=_0x16fe29?_0x42613d[_0xa9b2('0x1e')]:_0x281b7d[_0xa9b2('0x1d')]+_0x281b7d[_0xa9b2('0x1c')];var _0x319a9c;if(_0x592951>=_0x3f0f13){_0x592951=_0x3f0f13;_0x319a9c=0xc8;}else{_0x319a9c=0xce;}_0x400bd9[_0xa9b2('0x19')](_0x319a9c);return _0x400bd9[_0xa9b2('0x1f')]('Content-Range',_0x3d397e+'-'+_0x592951+'/'+_0x3f0f13)[_0xa9b2('0x1a')](_0x42613d);}return null;};}function patchUpdates(_0x5e2914){return function(_0x52e804){try{jsonpatch[_0xa9b2('0x20')](_0x52e804,_0x5e2914,!![]);}catch(_0x59ee0a){return BPromise['reject'](_0x59ee0a);}return _0x52e804['save']();};}function saveUpdates(_0x1d3ce0,_0x4dc426){return function(_0x32dce0){if(_0x32dce0){return _0x32dce0['update'](_0x1d3ce0)['then'](function(_0x34f955){return _0x34f955;});}return null;};}function removeEntity(_0x5b79e1,_0x45741c){return function(_0x32d291){if(_0x32d291){return _0x32d291['destroy']()['then'](function(){var _0x5e3df6=_0x32d291[_0xa9b2('0x21')]({'plain':!![]});var _0x51f4f6=_0xa9b2('0x22');return db[_0xa9b2('0x23')][_0xa9b2('0x24')]({'where':{'type':_0x51f4f6,'resourceId':_0x5e3df6['id']}})[_0xa9b2('0x25')](function(){return _0x32d291;});})[_0xa9b2('0x25')](function(){_0x5b79e1[_0xa9b2('0x19')](0xcc)[_0xa9b2('0x26')]();});}};}function handleEntityNotFound(_0x14ae29,_0x37906a){return function(_0x6e10eb){if(!_0x6e10eb){_0x14ae29[_0xa9b2('0x27')](0x194);}return _0x6e10eb;};}function handleError(_0x5a3d66,_0x45725a){_0x45725a=_0x45725a||0x1f4;return function(_0x977044){logger['error'](_0x977044[_0xa9b2('0x28')]);if(_0x977044[_0xa9b2('0x29')]){delete _0x977044[_0xa9b2('0x29')];}_0x5a3d66[_0xa9b2('0x19')](_0x45725a)[_0xa9b2('0x2a')](_0x977044);};}exports[_0xa9b2('0x2b')]=function(_0x383f6f,_0x29297c){var _0x1ea05d={},_0x4596b1={},_0x54bd05={'count':0x0,'rows':[]};var _0x336ab7=_[_0xa9b2('0x2c')](db['Trigger'][_0xa9b2('0x2d')],function(_0x140150){return{'name':_0x140150[_0xa9b2('0x2e')],'type':_0x140150[_0xa9b2('0x2f')][_0xa9b2('0x30')]};});_0x4596b1[_0xa9b2('0x31')]=_[_0xa9b2('0x2c')](_0x336ab7,_0xa9b2('0x29'));_0x4596b1[_0xa9b2('0x32')]=_['keys'](_0x383f6f['query']);_0x4596b1['filters']=_[_0xa9b2('0x33')](_0x4596b1['model'],_0x4596b1[_0xa9b2('0x32')]);_0x1ea05d[_0xa9b2('0x34')]=_[_0xa9b2('0x33')](_0x4596b1['model'],qs[_0xa9b2('0x35')](_0x383f6f['query'][_0xa9b2('0x35')]));_0x1ea05d[_0xa9b2('0x34')]=_0x1ea05d[_0xa9b2('0x34')]['length']?_0x1ea05d[_0xa9b2('0x34')]:_0x4596b1['model'];if(!_0x383f6f['query'][_0xa9b2('0x36')](_0xa9b2('0x37'))){_0x1ea05d[_0xa9b2('0x1c')]=qs[_0xa9b2('0x1c')](_0x383f6f['query'][_0xa9b2('0x1c')]);_0x1ea05d[_0xa9b2('0x1d')]=qs['offset'](_0x383f6f[_0xa9b2('0x32')][_0xa9b2('0x1d')]);}_0x1ea05d[_0xa9b2('0x38')]=qs[_0xa9b2('0x39')](_0x383f6f[_0xa9b2('0x32')][_0xa9b2('0x39')]);_0x1ea05d[_0xa9b2('0x3a')]=qs['filters'](_[_0xa9b2('0x3b')](_0x383f6f['query'],_0x4596b1[_0xa9b2('0x3c')]),_0x336ab7);if(_0x383f6f[_0xa9b2('0x32')][_0xa9b2('0x3d')]){_0x1ea05d['where']=_[_0xa9b2('0x3e')](_0x1ea05d['where'],{'$or':_[_0xa9b2('0x2c')](_0x336ab7,function(_0x3d726b){if(_0x3d726b['type']!==_0xa9b2('0x3f')){var _0x15238d={};_0x15238d[_0x3d726b[_0xa9b2('0x29')]]={'$like':'%'+_0x383f6f[_0xa9b2('0x32')][_0xa9b2('0x3d')]+'%'};return _0x15238d;}})});}_0x1ea05d=_[_0xa9b2('0x3e')]({},_0x1ea05d,_0x383f6f[_0xa9b2('0x40')]);var _0xabd64a={'where':_0x1ea05d[_0xa9b2('0x3a')]};return db['Trigger'][_0xa9b2('0x1e')](_0xabd64a)[_0xa9b2('0x25')](function(_0x43cbb0){_0x54bd05[_0xa9b2('0x1e')]=_0x43cbb0;if(_0x383f6f[_0xa9b2('0x32')][_0xa9b2('0x41')]){_0x1ea05d[_0xa9b2('0x42')]=[{'all':!![]}];}return db[_0xa9b2('0x43')][_0xa9b2('0x44')](_0x1ea05d);})[_0xa9b2('0x25')](function(_0x20d412){_0x54bd05[_0xa9b2('0x45')]=_0x20d412;return _0x54bd05;})[_0xa9b2('0x25')](respondWithFilteredResult(_0x29297c,_0x1ea05d))['catch'](handleError(_0x29297c,null));};exports[_0xa9b2('0x46')]=function(_0x209357,_0xe83641){var _0x13813a={'raw':![],'where':{'id':_0x209357[_0xa9b2('0x47')]['id']}},_0x283a6e={};_0x283a6e[_0xa9b2('0x31')]=_[_0xa9b2('0x48')](db[_0xa9b2('0x43')][_0xa9b2('0x2d')]);_0x283a6e[_0xa9b2('0x32')]=_[_0xa9b2('0x48')](_0x209357[_0xa9b2('0x32')]);_0x283a6e['filters']=_['intersection'](_0x283a6e[_0xa9b2('0x31')],_0x283a6e[_0xa9b2('0x32')]);_0x13813a[_0xa9b2('0x34')]=_['intersection'](_0x283a6e['model'],qs[_0xa9b2('0x35')](_0x209357[_0xa9b2('0x32')][_0xa9b2('0x35')]));_0x13813a[_0xa9b2('0x34')]=_0x13813a[_0xa9b2('0x34')]['length']?_0x13813a[_0xa9b2('0x34')]:_0x283a6e[_0xa9b2('0x31')];if(_0x209357[_0xa9b2('0x32')][_0xa9b2('0x41')]){_0x13813a[_0xa9b2('0x42')]=[{'all':!![]}];}_0x13813a=_[_0xa9b2('0x3e')]({},_0x13813a,_0x209357[_0xa9b2('0x40')]);return db[_0xa9b2('0x43')]['find'](_0x13813a)['then'](handleEntityNotFound(_0xe83641,null))[_0xa9b2('0x25')](respondWithResult(_0xe83641,null))[_0xa9b2('0x49')](handleError(_0xe83641,null));};exports['create']=function(_0x52103f,_0x2f5f60){return db[_0xa9b2('0x43')]['create'](_0x52103f['body'],{})[_0xa9b2('0x25')](function(_0x183ad8){var _0x488192=_0x52103f[_0xa9b2('0x4a')][_0xa9b2('0x21')]({'plain':!![]});if(!_0x488192)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x488192[_0xa9b2('0x4b')]===_0xa9b2('0x4a')){var _0x2b454c=_0x183ad8[_0xa9b2('0x21')]({'plain':!![]});var _0x15b095=_0xa9b2('0x22');return db['UserProfileSection'][_0xa9b2('0x4c')]({'where':{'name':_0x15b095,'userProfileId':_0x488192[_0xa9b2('0x4d')]},'raw':!![]})['then'](function(_0x303eba){if(_0x303eba&&_0x303eba[_0xa9b2('0x4e')]===0x0){return db[_0xa9b2('0x23')][_0xa9b2('0x4f')]({'name':_0x2b454c['name'],'resourceId':_0x2b454c['id'],'type':_0x303eba['name'],'sectionId':_0x303eba['id']},{})[_0xa9b2('0x25')](function(){return _0x183ad8;});}else{return _0x183ad8;}})['catch'](function(_0x2d008b){logger[_0xa9b2('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d008b);throw _0x2d008b;});}return _0x183ad8;})['then'](respondWithResult(_0x2f5f60,0xc9))[_0xa9b2('0x49')](handleError(_0x2f5f60,null));};exports[_0xa9b2('0x51')]=function(_0x98563a,_0x2c04be){if(_0x98563a[_0xa9b2('0x52')]['id']){delete _0x98563a[_0xa9b2('0x52')]['id'];}return db[_0xa9b2('0x43')][_0xa9b2('0x4c')]({'where':{'id':_0x98563a['params']['id']}})['then'](handleEntityNotFound(_0x2c04be,null))[_0xa9b2('0x25')](saveUpdates(_0x98563a[_0xa9b2('0x52')],null))[_0xa9b2('0x25')](respondWithResult(_0x2c04be,null))['catch'](handleError(_0x2c04be,null));};exports[_0xa9b2('0x24')]=function(_0x46c750,_0x5ad577){return db[_0xa9b2('0x43')][_0xa9b2('0x4c')]({'where':{'id':_0x46c750['params']['id']}})['then'](handleEntityNotFound(_0x5ad577,null))['then'](removeEntity(_0x5ad577,null))[_0xa9b2('0x49')](handleError(_0x5ad577,null));};exports[_0xa9b2('0x53')]=function(_0x3174ca,_0x445c8f,_0x23960b){if(_0x3174ca['body']['id']){delete _0x3174ca[_0xa9b2('0x52')]['id'];}return db[_0xa9b2('0x43')][_0xa9b2('0x4c')]({'where':{'id':_0x3174ca[_0xa9b2('0x47')]['id']}})['then'](handleEntityNotFound(_0x445c8f,null))['then'](function(_0x3987d8){if(_0x3987d8){_0x3174ca[_0xa9b2('0x52')]['TriggerAllId']=_0x3987d8['id'];return db[_0xa9b2('0x54')][_0xa9b2('0x4f')](_0x3174ca[_0xa9b2('0x52')]);}})[_0xa9b2('0x25')](respondWithResult(_0x445c8f,null))['catch'](handleError(_0x445c8f,null));};exports[_0xa9b2('0x55')]=function(_0x4c23de,_0x1518be,_0x3d9c22){if(_0x4c23de[_0xa9b2('0x52')]['id']){delete _0x4c23de[_0xa9b2('0x52')]['id'];}return db[_0xa9b2('0x43')][_0xa9b2('0x4c')]({'where':{'id':_0x4c23de[_0xa9b2('0x47')]['id']}})[_0xa9b2('0x25')](handleEntityNotFound(_0x1518be,null))['then'](function(_0x4a6e4b){if(_0x4a6e4b){_0x4c23de[_0xa9b2('0x52')]['TriggerAnyId']=_0x4a6e4b['id'];return db[_0xa9b2('0x54')][_0xa9b2('0x4f')](_0x4c23de[_0xa9b2('0x52')]);}})[_0xa9b2('0x25')](respondWithResult(_0x1518be,null))[_0xa9b2('0x49')](handleError(_0x1518be,null));};exports[_0xa9b2('0x56')]=function(_0x130b1a,_0x1c0c6e,_0x30c514){var _0x2e2af4={};var _0x284184={};var _0x3b6497;var _0x115155;return db[_0xa9b2('0x43')][_0xa9b2('0x57')]({'where':{'id':_0x130b1a['params']['id']}})[_0xa9b2('0x25')](handleEntityNotFound(_0x1c0c6e,null))[_0xa9b2('0x25')](function(_0x14f43){if(_0x14f43){_0x3b6497=_0x14f43;_0x284184[_0xa9b2('0x31')]=_[_0xa9b2('0x48')](db['Condition'][_0xa9b2('0x2d')]);_0x284184[_0xa9b2('0x32')]=_[_0xa9b2('0x48')](_0x130b1a['query']);_0x284184[_0xa9b2('0x3c')]=_[_0xa9b2('0x33')](_0x284184[_0xa9b2('0x31')],_0x284184[_0xa9b2('0x32')]);_0x2e2af4['attributes']=_[_0xa9b2('0x33')](_0x284184['model'],qs[_0xa9b2('0x35')](_0x130b1a[_0xa9b2('0x32')]['fields']));_0x2e2af4[_0xa9b2('0x34')]=_0x2e2af4[_0xa9b2('0x34')][_0xa9b2('0x58')]?_0x2e2af4[_0xa9b2('0x34')]:_0x284184['model'];_0x2e2af4[_0xa9b2('0x38')]=qs['sort'](_0x130b1a[_0xa9b2('0x32')][_0xa9b2('0x39')]);_0x2e2af4['where']=qs[_0xa9b2('0x3c')](_[_0xa9b2('0x3b')](_0x130b1a[_0xa9b2('0x32')],_0x284184['filters']));if(_0x130b1a[_0xa9b2('0x32')]['filter']){_0x2e2af4[_0xa9b2('0x3a')]=_[_0xa9b2('0x3e')](_0x2e2af4['where'],{'$or':_[_0xa9b2('0x2c')](_0x2e2af4[_0xa9b2('0x34')],function(_0xd9f3b5){var _0x407768={};_0x407768[_0xd9f3b5]={'$like':'%'+_0x130b1a[_0xa9b2('0x32')][_0xa9b2('0x3d')]+'%'};return _0x407768;})});}_0x2e2af4=_['merge']({},_0x2e2af4,_0x130b1a[_0xa9b2('0x40')]);return _0x3b6497['getAllConditions'](_0x2e2af4);}})['then'](function(_0x1aebcb){if(_0x1aebcb){_0x115155=_0x1aebcb[_0xa9b2('0x58')];if(!_0x130b1a[_0xa9b2('0x32')][_0xa9b2('0x36')](_0xa9b2('0x37'))){_0x2e2af4[_0xa9b2('0x1c')]=qs[_0xa9b2('0x1c')](_0x130b1a[_0xa9b2('0x32')][_0xa9b2('0x1c')]);_0x2e2af4[_0xa9b2('0x1d')]=qs[_0xa9b2('0x1d')](_0x130b1a['query'][_0xa9b2('0x1d')]);}return _0x3b6497[_0xa9b2('0x56')](_0x2e2af4);}})[_0xa9b2('0x25')](function(_0x3a86d7){if(_0x3a86d7){return _0x3a86d7?{'count':_0x115155,'rows':_0x3a86d7}:null;}})['then'](respondWithResult(_0x1c0c6e,null))[_0xa9b2('0x49')](handleError(_0x1c0c6e,null));};exports['getAnyConditions']=function(_0x3e2dfd,_0x4efcc4,_0x5cb82a){var _0x1d48dd={};var _0x52c143={};var _0x249295;var _0x1da6da;return db[_0xa9b2('0x43')]['findOne']({'where':{'id':_0x3e2dfd['params']['id']}})['then'](handleEntityNotFound(_0x4efcc4,null))[_0xa9b2('0x25')](function(_0x360223){if(_0x360223){_0x249295=_0x360223;_0x52c143[_0xa9b2('0x31')]=_[_0xa9b2('0x48')](db[_0xa9b2('0x54')]['rawAttributes']);_0x52c143[_0xa9b2('0x32')]=_['keys'](_0x3e2dfd[_0xa9b2('0x32')]);_0x52c143[_0xa9b2('0x3c')]=_[_0xa9b2('0x33')](_0x52c143[_0xa9b2('0x31')],_0x52c143['query']);_0x1d48dd[_0xa9b2('0x34')]=_['intersection'](_0x52c143[_0xa9b2('0x31')],qs[_0xa9b2('0x35')](_0x3e2dfd[_0xa9b2('0x32')][_0xa9b2('0x35')]));_0x1d48dd['attributes']=_0x1d48dd['attributes'][_0xa9b2('0x58')]?_0x1d48dd[_0xa9b2('0x34')]:_0x52c143[_0xa9b2('0x31')];_0x1d48dd[_0xa9b2('0x38')]=qs['sort'](_0x3e2dfd[_0xa9b2('0x32')][_0xa9b2('0x39')]);_0x1d48dd[_0xa9b2('0x3a')]=qs[_0xa9b2('0x3c')](_[_0xa9b2('0x3b')](_0x3e2dfd[_0xa9b2('0x32')],_0x52c143[_0xa9b2('0x3c')]));if(_0x3e2dfd['query'][_0xa9b2('0x3d')]){_0x1d48dd[_0xa9b2('0x3a')]=_['merge'](_0x1d48dd[_0xa9b2('0x3a')],{'$or':_['map'](_0x1d48dd[_0xa9b2('0x34')],function(_0x2182b5){var _0x27c7ec={};_0x27c7ec[_0x2182b5]={'$like':'%'+_0x3e2dfd[_0xa9b2('0x32')]['filter']+'%'};return _0x27c7ec;})});}_0x1d48dd=_['merge']({},_0x1d48dd,_0x3e2dfd[_0xa9b2('0x40')]);return _0x249295[_0xa9b2('0x59')](_0x1d48dd);}})['then'](function(_0x98b676){if(_0x98b676){_0x1da6da=_0x98b676[_0xa9b2('0x58')];if(!_0x3e2dfd[_0xa9b2('0x32')]['hasOwnProperty'](_0xa9b2('0x37'))){_0x1d48dd[_0xa9b2('0x1c')]=qs[_0xa9b2('0x1c')](_0x3e2dfd[_0xa9b2('0x32')][_0xa9b2('0x1c')]);_0x1d48dd[_0xa9b2('0x1d')]=qs[_0xa9b2('0x1d')](_0x3e2dfd[_0xa9b2('0x32')][_0xa9b2('0x1d')]);}return _0x249295['getAnyConditions'](_0x1d48dd);}})[_0xa9b2('0x25')](function(_0x476ce7){if(_0x476ce7){return _0x476ce7?{'count':_0x1da6da,'rows':_0x476ce7}:null;}})[_0xa9b2('0x25')](respondWithResult(_0x4efcc4,null))[_0xa9b2('0x49')](handleError(_0x4efcc4,null));};exports[_0xa9b2('0x5a')]=function(_0x4c9821,_0x9d46c7,_0x22ec19){if(_0x4c9821[_0xa9b2('0x52')]['id']){delete _0x4c9821[_0xa9b2('0x52')]['id'];}return db[_0xa9b2('0x43')]['find']({'where':{'id':_0x4c9821[_0xa9b2('0x47')]['id']}})[_0xa9b2('0x25')](handleEntityNotFound(_0x9d46c7,null))[_0xa9b2('0x25')](function(_0x3768ad){if(_0x3768ad){_0x4c9821[_0xa9b2('0x52')][_0xa9b2('0x5b')]=_0x3768ad['id'];return db[_0xa9b2('0x5c')][_0xa9b2('0x4f')](_0x4c9821[_0xa9b2('0x52')]);}})[_0xa9b2('0x25')](respondWithResult(_0x9d46c7,null))[_0xa9b2('0x49')](handleError(_0x9d46c7,null));};exports[_0xa9b2('0x5d')]=function(_0x578cae,_0x4cd9fb,_0x20daeb){var _0x296b21={};var _0x5020a9={};var _0x58e3d5;var _0x436a27;return db[_0xa9b2('0x43')][_0xa9b2('0x57')]({'where':{'id':_0x578cae[_0xa9b2('0x47')]['id']}})[_0xa9b2('0x25')](handleEntityNotFound(_0x4cd9fb,null))['then'](function(_0x23264e){if(_0x23264e){_0x58e3d5=_0x23264e;_0x5020a9[_0xa9b2('0x31')]=_['keys'](db['Action'][_0xa9b2('0x2d')]);_0x5020a9[_0xa9b2('0x32')]=_[_0xa9b2('0x48')](_0x578cae[_0xa9b2('0x32')]);_0x5020a9[_0xa9b2('0x3c')]=_[_0xa9b2('0x33')](_0x5020a9[_0xa9b2('0x31')],_0x5020a9[_0xa9b2('0x32')]);_0x296b21['attributes']=_[_0xa9b2('0x33')](_0x5020a9[_0xa9b2('0x31')],qs[_0xa9b2('0x35')](_0x578cae['query'][_0xa9b2('0x35')]));_0x296b21['attributes']=_0x296b21[_0xa9b2('0x34')][_0xa9b2('0x58')]?_0x296b21[_0xa9b2('0x34')]:_0x5020a9['model'];_0x296b21[_0xa9b2('0x38')]=qs[_0xa9b2('0x39')](_0x578cae[_0xa9b2('0x32')][_0xa9b2('0x39')]);_0x296b21[_0xa9b2('0x3a')]=qs[_0xa9b2('0x3c')](_['pick'](_0x578cae['query'],_0x5020a9['filters']));if(_0x578cae[_0xa9b2('0x32')][_0xa9b2('0x3d')]){_0x296b21['where']=_['merge'](_0x296b21[_0xa9b2('0x3a')],{'$or':_[_0xa9b2('0x2c')](_0x296b21[_0xa9b2('0x34')],function(_0x1fa952){var _0x3c2bee={};_0x3c2bee[_0x1fa952]={'$like':'%'+_0x578cae[_0xa9b2('0x32')][_0xa9b2('0x3d')]+'%'};return _0x3c2bee;})});}_0x296b21=_[_0xa9b2('0x3e')]({},_0x296b21,_0x578cae[_0xa9b2('0x40')]);return _0x58e3d5[_0xa9b2('0x5d')](_0x296b21);}})[_0xa9b2('0x25')](function(_0x663f64){if(_0x663f64){_0x436a27=_0x663f64[_0xa9b2('0x58')];if(!_0x578cae[_0xa9b2('0x32')][_0xa9b2('0x36')](_0xa9b2('0x37'))){_0x296b21[_0xa9b2('0x1c')]=qs[_0xa9b2('0x1c')](_0x578cae['query'][_0xa9b2('0x1c')]);_0x296b21[_0xa9b2('0x1d')]=qs['offset'](_0x578cae[_0xa9b2('0x32')][_0xa9b2('0x1d')]);}return _0x58e3d5[_0xa9b2('0x5d')](_0x296b21);}})[_0xa9b2('0x25')](function(_0x34eeda){if(_0x34eeda){return _0x34eeda?{'count':_0x436a27,'rows':_0x34eeda}:null;}})[_0xa9b2('0x25')](respondWithResult(_0x4cd9fb,null))[_0xa9b2('0x49')](handleError(_0x4cd9fb,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 08f438f..f0a34b8 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 _0xc7e9=['lodash','util','api','moment','bluebird','path','rimraf','exports','define','Trigger','tools_triggers'];(function(_0x24106c,_0x367a6f){var _0xbaeb73=function(_0x483603){while(--_0x483603){_0x24106c['push'](_0x24106c['shift']());}};_0xbaeb73(++_0x367a6f);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xc7e9[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var logger=require('../../config/logger')(_0x9c7e('0x2'));var moment=require(_0x9c7e('0x3'));var BPromise=require(_0x9c7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c7e('0x5'));var rimraf=require(_0x9c7e('0x6'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x9c7e('0x7')]=function(_0x4e4ccc,_0x1e5135){return _0x4e4ccc[_0x9c7e('0x8')](_0x9c7e('0x9'),attributes,{'tableName':_0x9c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Trigger','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./trigger.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_triggers','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 7cf71c9..cc7a8dc 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 _0xbd26=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','ShowTrigger','stringify','lodash','util','bluebird','randomstring'];(function(_0x2f938f,_0x923379){var _0x360c98=function(_0x13ddf6){while(--_0x13ddf6){_0x2f938f['push'](_0x2f938f['shift']());}};_0x360c98(++_0x923379);}(_0xbd26,0xce));var _0x6bd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6bd2('0x0'));var util=require(_0x6bd2('0x1'));var moment=require('moment');var BPromise=require(_0x6bd2('0x2'));var rs=require(_0x6bd2('0x3'));var fs=require('fs');var Redis=require(_0x6bd2('0x4'));var db=require(_0x6bd2('0x5'))['db'];var utils=require(_0x6bd2('0x6'));var logger=require(_0x6bd2('0x7'))(_0x6bd2('0x8'));var config=require('../../config/environment');var jayson=require(_0x6bd2('0x9'));var client=jayson[_0x6bd2('0xa')][_0x6bd2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d6d78,_0x491999,_0x5dceae){return new BPromise(function(_0x20cda3,_0x1ffde6){return client[_0x6bd2('0xc')](_0x1d6d78,_0x5dceae)[_0x6bd2('0xd')](function(_0x38ad98){logger[_0x6bd2('0xe')](_0x6bd2('0xf'),_0x491999,_0x6bd2('0x10'));logger[_0x6bd2('0x11')](_0x6bd2('0x12'),_0x491999,_0x6bd2('0x10'),JSON['stringify'](_0x38ad98));if(_0x38ad98['error']){if(_0x38ad98[_0x6bd2('0x13')][_0x6bd2('0x14')]===0x1f4){logger[_0x6bd2('0x13')](_0x6bd2('0xf'),_0x491999,_0x38ad98[_0x6bd2('0x13')]['message']);return _0x1ffde6(_0x38ad98[_0x6bd2('0x13')][_0x6bd2('0x15')]);}logger[_0x6bd2('0x13')](_0x6bd2('0xf'),_0x491999,_0x38ad98[_0x6bd2('0x13')][_0x6bd2('0x15')]);return _0x20cda3(_0x38ad98['error'][_0x6bd2('0x15')]);}else{logger[_0x6bd2('0xe')]('Trigger,\x20%s,\x20%s',_0x491999,_0x6bd2('0x10'));_0x20cda3(_0x38ad98['result'][_0x6bd2('0x15')]);}})[_0x6bd2('0x16')](function(_0x1fd496){logger[_0x6bd2('0x13')]('Trigger,\x20%s,\x20%s',_0x491999,_0x1fd496);_0x1ffde6(_0x1fd496);});});}exports[_0x6bd2('0x17')]=function(_0x3e6734){var _0x5e84d0=this;return new Promise(function(_0x33987d,_0xcf0be6){return db[_0x6bd2('0x18')][_0x6bd2('0x19')]({'raw':_0x3e6734[_0x6bd2('0x1a')]?_0x3e6734[_0x6bd2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3e6734[_0x6bd2('0x1a')]?_0x3e6734[_0x6bd2('0x1a')][_0x6bd2('0x1b')]||null:null,'attributes':_0x3e6734[_0x6bd2('0x1a')]?_0x3e6734[_0x6bd2('0x1a')][_0x6bd2('0x1c')]||null:null,'limit':_0x3e6734[_0x6bd2('0x1a')]?_0x3e6734['options'][_0x6bd2('0x1d')]||null:null,'include':_0x3e6734['options']?_0x3e6734[_0x6bd2('0x1a')][_0x6bd2('0x1e')]?_[_0x6bd2('0x1f')](_0x3e6734[_0x6bd2('0x1a')][_0x6bd2('0x1e')],function(_0x446f9a){return{'model':db[_0x446f9a['model']],'as':_0x446f9a['as'],'attributes':_0x446f9a[_0x6bd2('0x1c')],'include':_0x446f9a[_0x6bd2('0x1e')]?_[_0x6bd2('0x1f')](_0x446f9a['include'],function(_0x3b6eb5){return{'model':db[_0x3b6eb5[_0x6bd2('0x20')]],'as':_0x3b6eb5['as'],'attributes':_0x3b6eb5[_0x6bd2('0x1c')],'include':_0x3b6eb5[_0x6bd2('0x1e')]?_[_0x6bd2('0x1f')](_0x3b6eb5[_0x6bd2('0x1e')],function(_0x37356b){return{'model':db[_0x37356b[_0x6bd2('0x20')]],'as':_0x37356b['as'],'attributes':_0x37356b[_0x6bd2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6bd2('0xd')](function(_0x246dc3){logger[_0x6bd2('0xe')]('GetTrigger',_0x3e6734);logger[_0x6bd2('0x11')](_0x6bd2('0x17'),_0x3e6734,JSON['stringify'](_0x246dc3));_0x33987d(_0x246dc3);})[_0x6bd2('0x16')](function(_0x6583e9){logger[_0x6bd2('0x13')](_0x6bd2('0x17'),_0x6583e9[_0x6bd2('0x15')],_0x3e6734);_0xcf0be6(_0x5e84d0['error'](0x1f4,_0x6583e9[_0x6bd2('0x15')]));});});};exports['ShowTrigger']=function(_0x32e07a){var _0x23c011=this;return new Promise(function(_0x5af111,_0x2b4254){return db[_0x6bd2('0x18')]['find']({'raw':_0x32e07a['options']?_0x32e07a[_0x6bd2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x32e07a[_0x6bd2('0x1a')]?_0x32e07a['options'][_0x6bd2('0x1b')]||null:null,'attributes':_0x32e07a[_0x6bd2('0x1a')]?_0x32e07a[_0x6bd2('0x1a')][_0x6bd2('0x1c')]||null:null,'include':_0x32e07a[_0x6bd2('0x1a')]?_0x32e07a[_0x6bd2('0x1a')][_0x6bd2('0x1e')]?_[_0x6bd2('0x1f')](_0x32e07a['options'][_0x6bd2('0x1e')],function(_0x32d38b){return{'model':db[_0x32d38b[_0x6bd2('0x20')]],'as':_0x32d38b['as'],'attributes':_0x32d38b['attributes'],'include':_0x32d38b[_0x6bd2('0x1e')]?_[_0x6bd2('0x1f')](_0x32d38b['include'],function(_0x1d6824){return{'model':db[_0x1d6824[_0x6bd2('0x20')]],'as':_0x1d6824['as'],'attributes':_0x1d6824['attributes'],'include':_0x1d6824['include']?_[_0x6bd2('0x1f')](_0x1d6824[_0x6bd2('0x1e')],function(_0x3bf49b){return{'model':db[_0x3bf49b[_0x6bd2('0x20')]],'as':_0x3bf49b['as'],'attributes':_0x3bf49b[_0x6bd2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52dfed){logger[_0x6bd2('0xe')]('ShowTrigger',_0x32e07a);logger[_0x6bd2('0x11')](_0x6bd2('0x21'),_0x32e07a,JSON[_0x6bd2('0x22')](_0x52dfed));_0x5af111(_0x52dfed);})[_0x6bd2('0x16')](function(_0x48c8bf){logger[_0x6bd2('0x13')]('ShowTrigger',_0x48c8bf[_0x6bd2('0x15')],_0x32e07a);_0x2b4254(_0x23c011[_0x6bd2('0x13')](0x1f4,_0x48c8bf[_0x6bd2('0x15')]));});});}; \ No newline at end of file +var _0x06cc=['Trigger','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowTrigger','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetTrigger'];(function(_0x667807,_0x6c16a8){var _0x574694=function(_0x3d9e45){while(--_0x3d9e45){_0x667807['push'](_0x667807['shift']());}};_0x574694(++_0x6c16a8);}(_0x06cc,0x18e));var _0xc06c=function(_0x256121,_0x5f53ea){_0x256121=_0x256121-0x0;var _0x2b8d03=_0x06cc[_0x256121];return _0x2b8d03;};'use strict';var _=require(_0xc06c('0x0'));var util=require(_0xc06c('0x1'));var moment=require(_0xc06c('0x2'));var BPromise=require(_0xc06c('0x3'));var rs=require(_0xc06c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc06c('0x5'))['db'];var utils=require(_0xc06c('0x6'));var logger=require(_0xc06c('0x7'))(_0xc06c('0x8'));var config=require('../../config/environment');var jayson=require(_0xc06c('0x9'));var client=jayson[_0xc06c('0xa')][_0xc06c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x708d4d,_0x461520,_0x32650d){return new BPromise(function(_0x2e290c,_0x2390bf){return client[_0xc06c('0xc')](_0x708d4d,_0x32650d)[_0xc06c('0xd')](function(_0x4ca4ec){logger[_0xc06c('0xe')](_0xc06c('0xf'),_0x461520,'request\x20sent');logger['debug'](_0xc06c('0x10'),_0x461520,_0xc06c('0x11'),JSON['stringify'](_0x4ca4ec));if(_0x4ca4ec[_0xc06c('0x12')]){if(_0x4ca4ec['error'][_0xc06c('0x13')]===0x1f4){logger[_0xc06c('0x12')](_0xc06c('0xf'),_0x461520,_0x4ca4ec['error'][_0xc06c('0x14')]);return _0x2390bf(_0x4ca4ec[_0xc06c('0x12')][_0xc06c('0x14')]);}logger[_0xc06c('0x12')]('Trigger,\x20%s,\x20%s',_0x461520,_0x4ca4ec[_0xc06c('0x12')][_0xc06c('0x14')]);return _0x2e290c(_0x4ca4ec[_0xc06c('0x12')][_0xc06c('0x14')]);}else{logger['info'](_0xc06c('0xf'),_0x461520,_0xc06c('0x11'));_0x2e290c(_0x4ca4ec['result'][_0xc06c('0x14')]);}})['catch'](function(_0x5a48f3){logger[_0xc06c('0x12')](_0xc06c('0xf'),_0x461520,_0x5a48f3);_0x2390bf(_0x5a48f3);});});}exports[_0xc06c('0x15')]=function(_0x8b7e0c){var _0x38fec2=this;return new Promise(function(_0xc4dc8a,_0x3089b6){return db[_0xc06c('0x16')][_0xc06c('0x17')]({'raw':_0x8b7e0c['options']?_0x8b7e0c[_0xc06c('0x18')][_0xc06c('0x19')]===undefined?!![]:![]:!![],'where':_0x8b7e0c[_0xc06c('0x18')]?_0x8b7e0c[_0xc06c('0x18')][_0xc06c('0x1a')]||null:null,'attributes':_0x8b7e0c['options']?_0x8b7e0c['options'][_0xc06c('0x1b')]||null:null,'limit':_0x8b7e0c[_0xc06c('0x18')]?_0x8b7e0c['options'][_0xc06c('0x1c')]||null:null,'include':_0x8b7e0c[_0xc06c('0x18')]?_0x8b7e0c[_0xc06c('0x18')][_0xc06c('0x1d')]?_[_0xc06c('0x1e')](_0x8b7e0c[_0xc06c('0x18')][_0xc06c('0x1d')],function(_0xdec64d){return{'model':db[_0xdec64d[_0xc06c('0x1f')]],'as':_0xdec64d['as'],'attributes':_0xdec64d['attributes'],'include':_0xdec64d[_0xc06c('0x1d')]?_[_0xc06c('0x1e')](_0xdec64d[_0xc06c('0x1d')],function(_0x2f12df){return{'model':db[_0x2f12df[_0xc06c('0x1f')]],'as':_0x2f12df['as'],'attributes':_0x2f12df[_0xc06c('0x1b')],'include':_0x2f12df['include']?_['map'](_0x2f12df[_0xc06c('0x1d')],function(_0x5123d2){return{'model':db[_0x5123d2[_0xc06c('0x1f')]],'as':_0x5123d2['as'],'attributes':_0x5123d2[_0xc06c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc06c('0xd')](function(_0x345e1b){logger[_0xc06c('0xe')](_0xc06c('0x15'),_0x8b7e0c);logger[_0xc06c('0x20')](_0xc06c('0x15'),_0x8b7e0c,JSON['stringify'](_0x345e1b));_0xc4dc8a(_0x345e1b);})[_0xc06c('0x21')](function(_0x182702){logger['error'](_0xc06c('0x15'),_0x182702[_0xc06c('0x14')],_0x8b7e0c);_0x3089b6(_0x38fec2[_0xc06c('0x12')](0x1f4,_0x182702[_0xc06c('0x14')]));});});};exports[_0xc06c('0x22')]=function(_0x5546f5){var _0x2e8f2f=this;return new Promise(function(_0x24318b,_0x2efa5f){return db['Trigger']['find']({'raw':_0x5546f5['options']?_0x5546f5[_0xc06c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5546f5[_0xc06c('0x18')]?_0x5546f5[_0xc06c('0x18')][_0xc06c('0x1a')]||null:null,'attributes':_0x5546f5['options']?_0x5546f5['options']['attributes']||null:null,'include':_0x5546f5['options']?_0x5546f5['options'][_0xc06c('0x1d')]?_['map'](_0x5546f5['options'][_0xc06c('0x1d')],function(_0x16e7d1){return{'model':db[_0x16e7d1['model']],'as':_0x16e7d1['as'],'attributes':_0x16e7d1[_0xc06c('0x1b')],'include':_0x16e7d1['include']?_[_0xc06c('0x1e')](_0x16e7d1[_0xc06c('0x1d')],function(_0x3ec387){return{'model':db[_0x3ec387[_0xc06c('0x1f')]],'as':_0x3ec387['as'],'attributes':_0x3ec387['attributes'],'include':_0x3ec387[_0xc06c('0x1d')]?_[_0xc06c('0x1e')](_0x3ec387['include'],function(_0xce110b){return{'model':db[_0xce110b['model']],'as':_0xce110b['as'],'attributes':_0xce110b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x559a32){logger[_0xc06c('0xe')](_0xc06c('0x22'),_0x5546f5);logger['debug']('ShowTrigger',_0x5546f5,JSON['stringify'](_0x559a32));_0x24318b(_0x559a32);})[_0xc06c('0x21')](function(_0x19a8b9){logger[_0xc06c('0x12')](_0xc06c('0x22'),_0x19a8b9['message'],_0x5546f5);_0x2efa5f(_0x2e8f2f[_0xc06c('0x12')](0x1f4,_0x19a8b9[_0xc06c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0c41eab..e60a44c 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 _0xf437=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','create','put','update','delete'];(function(_0x207411,_0x510818){var _0x421e8d=function(_0x1459e3){while(--_0x1459e3){_0x207411['push'](_0x207411['shift']());}};_0x421e8d(++_0x510818);}(_0xf437,0x191));var _0x7f43=function(_0x18df6a,_0x3938b6){_0x18df6a=_0x18df6a-0x0;var _0x3b154d=_0xf437[_0x18df6a];return _0x3b154d;};'use strict';var multer=require('multer');var util=require(_0x7f43('0x0'));var path=require(_0x7f43('0x1'));var timeout=require(_0x7f43('0x2'));var express=require(_0x7f43('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7f43('0x4'));var interaction=require(_0x7f43('0x5'));var config=require(_0x7f43('0x6'));var controller=require(_0x7f43('0x7'));router[_0x7f43('0x8')]('/',auth[_0x7f43('0x9')](),controller[_0x7f43('0xa')]);router[_0x7f43('0x8')](_0x7f43('0xb'),auth[_0x7f43('0x9')](),controller[_0x7f43('0xc')]);router['post'](_0x7f43('0xd'),auth[_0x7f43('0x9')](),controller[_0x7f43('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7f43('0xf')]);router[_0x7f43('0x10')](_0x7f43('0xb'),auth['isAuthenticated'](),controller[_0x7f43('0x11')]);router[_0x7f43('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7f43('0x13')]);module[_0x7f43('0x14')]=router; \ No newline at end of file +var _0xe80f=['show','post','/:id/clone','isAuthenticated','clone','create','put','/:id','update','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x2b356f,_0x568025){var _0x7920f7=function(_0x322d58){while(--_0x322d58){_0x2b356f['push'](_0x2b356f['shift']());}};_0x7920f7(++_0x568025);}(_0xe80f,0xdb));var _0xfe80=function(_0x1dbebc,_0x3477f7){_0x1dbebc=_0x1dbebc-0x0;var _0x2f5ad0=_0xe80f[_0x1dbebc];return _0x2f5ad0;};'use strict';var multer=require(_0xfe80('0x0'));var util=require(_0xfe80('0x1'));var path=require('path');var timeout=require(_0xfe80('0x2'));var express=require(_0xfe80('0x3'));var router=express['Router']();var fs_extra=require(_0xfe80('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfe80('0x5'));var config=require(_0xfe80('0x6'));var controller=require(_0xfe80('0x7'));router[_0xfe80('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfe80('0x9')]);router[_0xfe80('0xa')](_0xfe80('0xb'),auth[_0xfe80('0xc')](),controller[_0xfe80('0xd')]);router['post']('/',auth[_0xfe80('0xc')](),controller[_0xfe80('0xe')]);router[_0xfe80('0xf')](_0xfe80('0x10'),auth[_0xfe80('0xc')](),controller[_0xfe80('0x11')]);router['delete'](_0xfe80('0x10'),auth[_0xfe80('0xc')](),controller[_0xfe80('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 76f3a11..cc7c0db 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 _0x5601=['ALLOWED','PROHIB_FAILED_SCREEN','udp','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','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','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update,nonat','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0x18ce9c,_0x437b13){var _0xf1f283=function(_0x44db31){while(--_0x44db31){_0x18ce9c['push'](_0x18ce9c['shift']());}};_0xf1f283(++_0x437b13);}(_0x5601,0x15b));var _0x1560=function(_0x3df954,_0x2df7f4){_0x3df954=_0x3df954-0x0;var _0x501eb2=_0x5601[_0x3df954];return _0x501eb2;};'use strict';var Sequelize=require('sequelize');module[_0x1560('0x0')]={'name':{'type':Sequelize[_0x1560('0x1')],'allowNull':![],'unique':_0x1560('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x4'),_0x1560('0x5'),_0x1560('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1560('0x1')],'allowNull':![],'defaultValue':_0x1560('0x7')},'callingpres':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x8'),_0x1560('0x9'),'ALLOWED_FAILED_SCREEN',_0x1560('0xa'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x1560('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x1560('0x1')]},'permit':{'type':Sequelize[_0x1560('0x1')]},'secret':{'type':Sequelize[_0x1560('0x1')]},'md5secret':{'type':Sequelize[_0x1560('0x1')]},'remotesecret':{'type':Sequelize[_0x1560('0x1')]},'transport':{'type':Sequelize[_0x1560('0x1')],'defaultValue':_0x1560('0xc'),'set':function(_0x1bb79c){this['setDataValue'](_0x1560('0xd'),_0x1bb79c?_0x1bb79c[_0x1560('0xe')](','):null);},'get':function(){return this[_0x1560('0xf')]('transport')?this[_0x1560('0xf')](_0x1560('0xd'))['split'](','):null;},'comment':_0x1560('0x10')},'dtmfmode':{'type':Sequelize[_0x1560('0x3')]('rfc2833',_0x1560('0x11'),_0x1560('0x12'),_0x1560('0x13'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no',_0x1560('0x15'),_0x1560('0x16'),_0x1560('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x1560('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1560('0x1')]},'directmediadeny':{'type':Sequelize[_0x1560('0x1')]},'nat':{'type':Sequelize[_0x1560('0x1')],'defaultValue':_0x1560('0x18'),'set':function(_0xcb88b9){this['setDataValue'](_0x1560('0x19'),_0xcb88b9?_0xcb88b9[_0x1560('0xe')](','):null);},'get':function(){return this[_0x1560('0xf')](_0x1560('0x19'))?this[_0x1560('0xf')]('nat')[_0x1560('0x1a')](','):null;},'comment':_0x1560('0x1b')},'callgroup':{'type':Sequelize[_0x1560('0x1')]},'namedcallgroup':{'type':Sequelize[_0x1560('0x1')]},'pickupgroup':{'type':Sequelize[_0x1560('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x1560('0x1')]},'language':{'type':Sequelize[_0x1560('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1560('0x1')],'defaultValue':_0x1560('0x1c')},'allow':{'type':Sequelize[_0x1560('0x1')],'allowNull':![],'defaultValue':_0x1560('0x1d'),'set':function(_0xdec280){this[_0x1560('0x1e')]('allow',_0xdec280?_0xdec280[_0x1560('0xe')](';'):_0x1560('0x1d'));},'get':function(){return this[_0x1560('0xf')]('allow')?this[_0x1560('0xf')](_0x1560('0x1f'))['split'](';'):null;},'comment':_0x1560('0x20')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x393179){this[_0x1560('0x1e')](_0x1560('0x21'),_0x393179?_0x393179[_0x1560('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x1560('0x21'))?this[_0x1560('0xf')]('insecure')[_0x1560('0x1a')](','):null;},'comment':_0x1560('0x22')},'trustrpid':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1560('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no',_0x1560('0x23'))},'promiscredir':{'type':Sequelize[_0x1560('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no')},'accountcode':{'type':Sequelize[_0x1560('0x24')](0xb)},'setvar':{'type':Sequelize[_0x1560('0x1')]},'callerid':{'type':Sequelize[_0x1560('0x1')],'defaultValue':_0x1560('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no'),'defaultValue':_0x1560('0x14')},'busylevel':{'type':Sequelize[_0x1560('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x1560('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x1560('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x1560('0x14'),'no',_0x1560('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1560('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no')},'mailbox':{'type':Sequelize[_0x1560('0x1')]},'session_timers':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x27'),_0x1560('0x28'),_0x1560('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x1560('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x2a'),'uas'),'defaultValue':_0x1560('0x2b')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x1560('0x1')]},'fromdomain':{'type':Sequelize[_0x1560('0x1')]},'fromuser':{'type':Sequelize[_0x1560('0x1')]},'port':{'type':Sequelize[_0x1560('0x24')](0x5)},'qualify':{'type':Sequelize[_0x1560('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1560('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x1560('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x1560('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1560('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1560('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no',_0x1560('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1560('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x1560('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1560('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x1560('0x1')]},'contactdeny':{'type':Sequelize[_0x1560('0x1')]},'contactacl':{'type':Sequelize[_0x1560('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x1560('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x1560('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no')},'force_avp':{'type':Sequelize[_0x1560('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no',_0x1560('0x2d'),_0x1560('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x1560('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1560('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x1560('0x1')]},'dtlscipher':{'type':Sequelize[_0x1560('0x1')]},'dtlscafile':{'type':Sequelize[_0x1560('0x1')]},'dtlscapath':{'type':Sequelize[_0x1560('0x1')]},'dtlssetup':{'type':Sequelize[_0x1560('0x3')]('active',_0x1560('0x2f'),_0x1560('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1560('0x1')]},'usereqphone':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1560('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x1560('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x1560('0x3')](_0x1560('0x14'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x1560('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1560('0x1')]},'host':{'type':Sequelize[_0x1560('0x1')],'defaultValue':_0x1560('0x31')},'canreinvite':{'type':Sequelize['ENUM'](_0x1560('0x14'),'no',_0x1560('0x15'),'update',_0x1560('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1560('0x1')]},'otherFields':{'type':Sequelize[_0x1560('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x4af8=['rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x2afcb2,_0x1a9aa5){var _0xad2761=function(_0x2279ad){while(--_0x2279ad){_0x2afcb2['push'](_0x2afcb2['shift']());}};_0xad2761(++_0x1a9aa5);}(_0x4af8,0x12e));var _0x84af=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x4af8[_0x34021d];return _0x16597b;};'use strict';var Sequelize=require('sequelize');module[_0x84af('0x0')]={'name':{'type':Sequelize[_0x84af('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x3'),_0x84af('0x4'),_0x84af('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x84af('0x6')},'callingpres':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x7'),_0x84af('0x8'),_0x84af('0x9'),'ALLOWED','PROHIB_NOT_SCREENED',_0x84af('0xa'),_0x84af('0xb'),_0x84af('0xc'))},'deny':{'type':Sequelize[_0x84af('0x1')]},'permit':{'type':Sequelize[_0x84af('0x1')]},'secret':{'type':Sequelize[_0x84af('0x1')]},'md5secret':{'type':Sequelize[_0x84af('0x1')]},'remotesecret':{'type':Sequelize[_0x84af('0x1')]},'transport':{'type':Sequelize[_0x84af('0x1')],'defaultValue':_0x84af('0xd'),'set':function(_0x4f567b){this[_0x84af('0xe')](_0x84af('0xf'),_0x4f567b?_0x4f567b[_0x84af('0x10')](','):null);},'get':function(){return this[_0x84af('0x11')](_0x84af('0xf'))?this[_0x84af('0x11')](_0x84af('0xf'))[_0x84af('0x12')](','):null;},'comment':_0x84af('0x13')},'dtmfmode':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x14'),_0x84af('0x15'),_0x84af('0x16'),_0x84af('0x17'),'auto'),'defaultValue':_0x84af('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0x84af('0x18'),'no',_0x84af('0x19'),_0x84af('0x1a'),_0x84af('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x84af('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x84af('0x1')]},'directmediadeny':{'type':Sequelize[_0x84af('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x5f25c9){this[_0x84af('0xe')]('nat',_0x5f25c9?_0x5f25c9['join'](','):null);},'get':function(){return this[_0x84af('0x11')](_0x84af('0x1c'))?this[_0x84af('0x11')]('nat')['split'](','):null;},'comment':_0x84af('0x1d')},'callgroup':{'type':Sequelize[_0x84af('0x1')]},'namedcallgroup':{'type':Sequelize[_0x84af('0x1')]},'pickupgroup':{'type':Sequelize[_0x84af('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x84af('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x84af('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x84af('0x1')],'allowNull':![],'defaultValue':_0x84af('0x1e'),'set':function(_0x37155c){this[_0x84af('0xe')]('allow',_0x37155c?_0x37155c['join'](';'):_0x84af('0x1e'));},'get':function(){return this['getDataValue'](_0x84af('0x1f'))?this[_0x84af('0x11')](_0x84af('0x1f'))[_0x84af('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x84af('0x18'),'no')},'insecure':{'type':Sequelize[_0x84af('0x1')],'defaultValue':'port,invite','set':function(_0x208832){this[_0x84af('0xe')](_0x84af('0x20'),_0x208832?_0x208832[_0x84af('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x84af('0x20'))?this[_0x84af('0x11')](_0x84af('0x20'))['split'](','):null;},'comment':_0x84af('0x21')},'trustrpid':{'type':Sequelize['ENUM'](_0x84af('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no')},'accountcode':{'type':Sequelize[_0x84af('0x22')](0xb)},'setvar':{'type':Sequelize[_0x84af('0x1')]},'callerid':{'type':Sequelize[_0x84af('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x84af('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x84af('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x84af('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x84af('0x1')]},'videosupport':{'type':Sequelize[_0x84af('0x2')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x84af('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x84af('0x2')]('accept',_0x84af('0x23'),_0x84af('0x24'))},'session_expires':{'type':Sequelize[_0x84af('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x84af('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x25'),_0x84af('0x26')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x84af('0x1')]},'fromdomain':{'type':Sequelize[_0x84af('0x1')]},'fromuser':{'type':Sequelize[_0x84af('0x1')]},'port':{'type':Sequelize[_0x84af('0x22')](0x5)},'qualify':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no'),'defaultValue':_0x84af('0x18')},'keepalive':{'type':Sequelize[_0x84af('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x84af('0x1')]},'defaultuser':{'type':Sequelize[_0x84af('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x84af('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x84af('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x84af('0x2')]('yes','no',_0x84af('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x84af('0x1')]},'callbackextension':{'type':Sequelize[_0x84af('0x1')]},'timert1':{'type':Sequelize[_0x84af('0x22')](0xb)},'timerb':{'type':Sequelize[_0x84af('0x22')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x84af('0x1')]},'contactdeny':{'type':Sequelize[_0x84af('0x1')]},'contactacl':{'type':Sequelize[_0x84af('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x84af('0x1')]},'use_q850_reason':{'type':Sequelize[_0x84af('0x1')]},'maxforwards':{'type':Sequelize[_0x84af('0x22')](0xb)},'encryption':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x84af('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no','fingerprint',_0x84af('0x28'))},'dtlsrekey':{'type':Sequelize[_0x84af('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x84af('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x84af('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x84af('0x1')]},'dtlssetup':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x29'),_0x84af('0x2a'),_0x84af('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x84af('0x1')]},'usereqphone':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x84af('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x84af('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x84af('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x84af('0x2')]('yes','no')},'vmexten':{'type':Sequelize[_0x84af('0x1')]},'mohinterpret':{'type':Sequelize[_0x84af('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x84af('0x1')]},'description':{'type':Sequelize[_0x84af('0x1')]},'host':{'type':Sequelize[_0x84af('0x1')],'defaultValue':_0x84af('0x2c')},'canreinvite':{'type':Sequelize[_0x84af('0x2')](_0x84af('0x18'),'no',_0x84af('0x19'),_0x84af('0x1a'),_0x84af('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 c82a99f..0410734 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 _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x33c6e3,_0x22e0e3){var _0x42cf03=function(_0x29584d){while(--_0x29584d){_0x33c6e3['push'](_0x33c6e3['shift']());}};_0x42cf03(++_0x22e0e3);}(_0xedd9,0xfc));var _0x9edd=function(_0x5df716,_0x5bfe11){_0x5df716=_0x5df716-0x0;var _0x57a85d=_0xedd9[_0x5df716];return _0x57a85d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file +var _0x9957=['clone','includeAll','merge','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','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','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','Trunk','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','include','rows','show','params','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('Trunk,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=typeof _0x2a307e['offset']===_0x7995('0x2e')&&typeof _0x2a307e[_0x7995('0x2f')]===_0x7995('0x2e');var _0x132a42=_0x56691a[_0x7995('0x30')];var _0x4b6f99=_0x47625f?0x0:_0x2a307e[_0x7995('0x31')];var _0x514445=_0x47625f?_0x56691a[_0x7995('0x30')]:_0x2a307e[_0x7995('0x31')]+_0x2a307e[_0x7995('0x2f')];var _0x574574;if(_0x514445>=_0x132a42){_0x514445=_0x132a42;_0x574574=0xc8;}else{_0x574574=0xce;}_0x3a3fcf['status'](_0x574574);return _0x3a3fcf['set'](_0x7995('0x32'),_0x4b6f99+'-'+_0x514445+'/'+_0x132a42)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x327a81){return function(_0x2b874d){try{jsonpatch[_0x7995('0x33')](_0x2b874d,_0x327a81,!![]);}catch(_0x1ca460){return BPromise['reject'](_0x1ca460);}return _0x2b874d['save']();};}function saveUpdates(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')](_0xfa8f15)[_0x7995('0x1f')](function(_0x1e9fa4){return _0x1e9fa4;});}return null;};}function removeEntity(_0x1f7d27,_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x35')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x36');return db['UserProfileResource'][_0x7995('0x35')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1f')](function(){_0x1f7d27[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x5014d2,_0x52d76d){return function(_0x36d057){if(!_0x36d057){_0x5014d2['sendStatus'](0x194);}return _0x36d057;};}function handleError(_0x5d2428,_0x3e99cd){_0x3e99cd=_0x3e99cd||0x1f4;return function(_0xe328b1){logger['error'](_0xe328b1[_0x7995('0x37')]);if(_0xe328b1[_0x7995('0x38')]){delete _0xe328b1[_0x7995('0x38')];}_0x5d2428[_0x7995('0x2b')](_0x3e99cd)[_0x7995('0x39')](_0xe328b1);};}exports['index']=function(_0x2d4285,_0x242713){var _0xf612e6={},_0x1d60b8={},_0x4b1541={'count':0x0,'rows':[]};var _0x2be2c0=_[_0x7995('0x3a')](db[_0x7995('0x3b')][_0x7995('0x3c')],function(_0x1f5bee){return{'name':_0x1f5bee[_0x7995('0x3d')],'type':_0x1f5bee['type'][_0x7995('0x3e')]};});_0x1d60b8[_0x7995('0x3f')]=_[_0x7995('0x3a')](_0x2be2c0,_0x7995('0x38'));_0x1d60b8[_0x7995('0x40')]=_[_0x7995('0x41')](_0x2d4285[_0x7995('0x40')]);_0x1d60b8[_0x7995('0x42')]=_[_0x7995('0x43')](_0x1d60b8[_0x7995('0x3f')],_0x1d60b8[_0x7995('0x40')]);_0xf612e6[_0x7995('0x44')]=_[_0x7995('0x43')](_0x1d60b8['model'],qs['fields'](_0x2d4285[_0x7995('0x40')][_0x7995('0x45')]));_0xf612e6['attributes']=_0xf612e6['attributes'][_0x7995('0x46')]?_0xf612e6['attributes']:_0x1d60b8['model'];if(!_0x2d4285[_0x7995('0x40')][_0x7995('0x47')](_0x7995('0x48'))){_0xf612e6['limit']=qs[_0x7995('0x2f')](_0x2d4285['query'][_0x7995('0x2f')]);_0xf612e6['offset']=qs['offset'](_0x2d4285[_0x7995('0x40')][_0x7995('0x31')]);}_0xf612e6[_0x7995('0x49')]=qs[_0x7995('0x4a')](_0x2d4285['query'][_0x7995('0x4a')]);_0xf612e6[_0x7995('0x4b')]=qs[_0x7995('0x42')](_[_0x7995('0x4c')](_0x2d4285['query'],_0x1d60b8['filters']),_0x2be2c0);if(_0x2d4285[_0x7995('0x40')]['filter']){_0xf612e6[_0x7995('0x4b')]=_['merge'](_0xf612e6[_0x7995('0x4b')],{'$or':_['map'](_0x2be2c0,function(_0x1e795e){if(_0x1e795e[_0x7995('0x4d')]!=='VIRTUAL'){var _0x3e9e62={};_0x3e9e62[_0x1e795e[_0x7995('0x38')]]={'$like':'%'+_0x2d4285[_0x7995('0x40')][_0x7995('0x4e')]+'%'};return _0x3e9e62;}})});}_0xf612e6=_['merge']({},_0xf612e6,_0x2d4285[_0x7995('0x4f')]);var _0x3e787d={'where':_0xf612e6[_0x7995('0x4b')]};return db['Trunk'][_0x7995('0x30')](_0x3e787d)[_0x7995('0x1f')](function(_0x511567){_0x4b1541[_0x7995('0x30')]=_0x511567;if(_0x2d4285[_0x7995('0x40')]['includeAll']){_0xf612e6[_0x7995('0x50')]=[{'all':!![]}];}return db[_0x7995('0x3b')]['findAll'](_0xf612e6);})[_0x7995('0x1f')](function(_0x5843ba){_0x4b1541[_0x7995('0x51')]=_0x5843ba;return _0x4b1541;})[_0x7995('0x1f')](respondWithFilteredResult(_0x242713,_0xf612e6))[_0x7995('0x29')](handleError(_0x242713,null));};exports[_0x7995('0x52')]=function(_0xddf537,_0x14b537){var _0x1579b9={'raw':![],'where':{'id':_0xddf537[_0x7995('0x53')]['id']}},_0x4d46bc={};_0x4d46bc[_0x7995('0x3f')]=_[_0x7995('0x41')](db['Trunk'][_0x7995('0x3c')]);_0x4d46bc[_0x7995('0x40')]=_[_0x7995('0x41')](_0xddf537['query']);_0x4d46bc['filters']=_['intersection'](_0x4d46bc[_0x7995('0x3f')],_0x4d46bc[_0x7995('0x40')]);_0x1579b9['attributes']=_[_0x7995('0x43')](_0x4d46bc[_0x7995('0x3f')],qs[_0x7995('0x45')](_0xddf537[_0x7995('0x40')][_0x7995('0x45')]));_0x1579b9['attributes']=_0x1579b9[_0x7995('0x44')]['length']?_0x1579b9[_0x7995('0x44')]:_0x4d46bc[_0x7995('0x3f')];if(_0xddf537[_0x7995('0x40')]['includeAll']){_0x1579b9['include']=[{'all':!![]}];}_0x1579b9=_['merge']({},_0x1579b9,_0xddf537['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x1579b9)[_0x7995('0x1f')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x1f')](respondWithResult(_0x14b537,null))[_0x7995('0x29')](handleError(_0x14b537,null));};exports[_0x7995('0x55')]=function(_0x1f4270,_0xda6ce8){var _0x328671={'where':{'id':_0x1f4270[_0x7995('0x53')]['id']}},_0x17ecd3={};_0x17ecd3[_0x7995('0x3f')]=_[_0x7995('0x41')](db[_0x7995('0x3b')][_0x7995('0x3c')]);_0x328671[_0x7995('0x44')]=_[_0x7995('0x43')](_0x17ecd3[_0x7995('0x3f')],qs[_0x7995('0x45')](_0x1f4270['query'][_0x7995('0x45')]));_0x328671[_0x7995('0x44')]=_0x328671[_0x7995('0x44')][_0x7995('0x46')]?_0x328671['attributes']:_0x17ecd3['model'];if(_0x1f4270[_0x7995('0x40')][_0x7995('0x56')]){_0x328671[_0x7995('0x50')]=[{'all':!![]}];}_0x328671=_[_0x7995('0x57')]({},_0x328671,_0x1f4270['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x328671)[_0x7995('0x1f')](handleEntityNotFound(_0xda6ce8,null))[_0x7995('0x1f')](function(_0x502d43){if(_0x502d43){var _0x5e2d97=_0x502d43[_0x7995('0x58')]({'plain':!![]});_0x5e2d97=qs[_0x7995('0x59')](_0x5e2d97,['id',_0x7995('0x5a'),_0x7995('0x5b')]);_0x1f4270[_0x7995('0x5c')]=_[_0x7995('0x59')](_0x1f4270[_0x7995('0x5c')],['id',_0x7995('0x5a'),_0x7995('0x5b')]);return db['Trunk'][_0x7995('0x5d')](_[_0x7995('0x57')](_0x5e2d97,_0x1f4270[_0x7995('0x5c')]),{'include':_0x1f4270[_0x7995('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3053fd){var _0xebb5c8=_0x1f4270['user'][_0x7995('0x58')]({'plain':!![]});if(!_0xebb5c8)throw new Error(_0x7995('0x5e'));if(_0xebb5c8[_0x7995('0x5f')]===_0x7995('0x60')){var _0x32cb04=_0x3053fd['get']({'plain':!![]});var _0x457d09='Trunks';return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':_0x457d09,'userProfileId':_0xebb5c8[_0x7995('0x62')]},'raw':!![]})[_0x7995('0x1f')](function(_0x4388c1){if(_0x4388c1&&_0x4388c1[_0x7995('0x63')]===0x0){return db[_0x7995('0x64')][_0x7995('0x5d')]({'name':_0x32cb04[_0x7995('0x38')],'resourceId':_0x32cb04['id'],'type':_0x4388c1[_0x7995('0x38')],'sectionId':_0x4388c1['id']},{})[_0x7995('0x1f')](function(){return _0x3053fd;});}else{return _0x3053fd;}})[_0x7995('0x29')](function(_0x56eb85){logger[_0x7995('0x25')](_0x7995('0x65'),_0x56eb85);throw _0x56eb85;});}return _0x3053fd;});}})[_0x7995('0x1f')](respondWithResult(_0xda6ce8,0xc9))[_0x7995('0x29')](handleError(_0xda6ce8,null));};exports[_0x7995('0x5d')]=function(_0x54a2e0,_0x4b54f2,_0x268fde){var _0x87e38d;return db[_0x7995('0x3b')][_0x7995('0x5d')](_0x54a2e0['body'],{'raw':!![]})[_0x7995('0x1f')](function(_0x50a12e){_0x87e38d=_0x50a12e;return db['Trunk'][_0x7995('0x66')]({'raw':!![]});})[_0x7995('0x1f')](function(_0x3f0a71){var _0x44bf2b=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x2466df=fs['readFileSync'](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6c')),'utf8');var _0x1fe1cb=ejs[_0x7995('0x6d')](_0x44bf2b,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x1fe1cb);if(_0x87e38d[_0x7995('0x70')]){var _0x51ab1e=ejs[_0x7995('0x6d')](_0x2466df,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x51ab1e);}})[_0x7995('0x1f')](function(){return respondWithRpcPromise(_0x7995('0x72'),'create',{'module':'chan_sip.so'});})[_0x7995('0x1f')](function(){var _0xfe1105=_0x54a2e0[_0x7995('0x60')][_0x7995('0x58')]({'plain':!![]});if(!_0xfe1105)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfe1105[_0x7995('0x5f')]===_0x7995('0x60')){var _0x54b955=_0x87e38d['get']({'plain':!![]});return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':'Trunks','userProfileId':_0xfe1105[_0x7995('0x62')]},'raw':!![]})['then'](function(_0x3758f9){if(_0x3758f9&&_0x3758f9[_0x7995('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x54b955[_0x7995('0x38')],'resourceId':_0x54b955['id'],'type':_0x3758f9['name'],'sectionId':_0x3758f9['id']},{})[_0x7995('0x1f')](function(){return _0x87e38d;});}else{return _0x87e38d;}})[_0x7995('0x29')](function(_0x3dd197){logger[_0x7995('0x25')](_0x7995('0x65'),_0x3dd197);throw _0x3dd197;});}return _0x87e38d;})[_0x7995('0x1f')](respondWithResult(_0x4b54f2,0xc9))[_0x7995('0x29')](handleError(_0x4b54f2,null));};exports[_0x7995('0x34')]=function(_0x29e0ee,_0x117317,_0x1ab590){var _0x16108c;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x29e0ee[_0x7995('0x53')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x117317,null))[_0x7995('0x1f')](saveUpdates(_0x29e0ee[_0x7995('0x5c')],null))[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x16108c=_0xa2fc8e;return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});}})[_0x7995('0x1f')](function(_0x280fbb){if(_0x280fbb){var _0x260ef1=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/trunk.ejs'),_0x7995('0x6b'));var _0x10f4ca=fs['readFileSync'](path['join'](config[_0x7995('0x69')],_0x7995('0x6c')),_0x7995('0x6b'));var _0x38acda=ejs[_0x7995('0x6d')](_0x260ef1,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x38acda);var _0x2f8a2d=ejs[_0x7995('0x6d')](_0x10f4ca,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x2f8a2d);return respondWithRpcPromise(_0x7995('0x72'),_0x7995('0x34'),{'module':_0x7995('0x73')});}return null;})[_0x7995('0x1f')](function(_0x560095){if(_0x560095){return _0x16108c;}})[_0x7995('0x1f')](respondWithResult(_0x117317,null))[_0x7995('0x29')](handleError(_0x117317,null));};exports['destroy']=function(_0x479271,_0xd24c64,_0xf8c2ed){var _0x18e1a2;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x479271['params']['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0xd24c64,null))[_0x7995('0x1f')](removeEntity(_0xd24c64,null))['then'](function(){return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});})['then'](function(_0x1535a3){var _0x4a5bc5=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x5d16da=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/registry.ejs'),_0x7995('0x6b'));var _0x3f3434=ejs[_0x7995('0x6d')](_0x4a5bc5,{'trunks':_0x1535a3});var _0x308a26=ejs['render'](_0x5d16da,{'trunks':_0x1535a3});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x3f3434);fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_registers.conf',_0x308a26);return respondWithRpcPromise('Reload',_0x7995('0x35'),{'module':_0x7995('0x73')});})['catch'](handleError(_0xd24c64,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 86ca930..8bef8f6 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 _0x25e0=['moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','api'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x25e0,0xb1));var _0x025e=function(_0x45c44b,_0x288803){_0x45c44b=_0x45c44b-0x0;var _0x1fa4d8=_0x25e0[_0x45c44b];return _0x1fa4d8;};'use strict';var _=require(_0x025e('0x0'));var util=require(_0x025e('0x1'));var logger=require('../../config/logger')(_0x025e('0x2'));var moment=require(_0x025e('0x3'));var BPromise=require(_0x025e('0x4'));var rp=require(_0x025e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x025e('0x6'));var config=require(_0x025e('0x7'));var attributes=require(_0x025e('0x8'));module[_0x025e('0x9')]=function(_0x3bf990,_0x5e5795){return _0x3bf990['define'](_0x025e('0xa'),attributes,{'tableName':_0x025e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8473=['define','Trunk','tools_trunks','lodash','util','api','request-promise','path','../../config/environment','./trunk.attributes'];(function(_0x5410b8,_0x21984d){var _0x5e0a97=function(_0x3fb585){while(--_0x3fb585){_0x5410b8['push'](_0x5410b8['shift']());}};_0x5e0a97(++_0x21984d);}(_0x8473,0x175));var _0x3847=function(_0x332886,_0x3cb135){_0x332886=_0x332886-0x0;var _0x27c1a3=_0x8473[_0x332886];return _0x27c1a3;};'use strict';var _=require(_0x3847('0x0'));var util=require(_0x3847('0x1'));var logger=require('../../config/logger')(_0x3847('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3847('0x3'));var fs=require('fs');var path=require(_0x3847('0x4'));var rimraf=require('rimraf');var config=require(_0x3847('0x5'));var attributes=require(_0x3847('0x6'));module['exports']=function(_0x13ef53,_0x932f7f){return _0x13ef53[_0x3847('0x7')](_0x3847('0x8'),attributes,{'tableName':_0x3847('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 21d8ea4..811a8d7 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 _0x994b=['options','raw','where','attributes','limit','include','map','model','GetTrunk','catch','ShowTrunk','Trunk','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','findAll'];(function(_0x4855ac,_0x438bd4){var _0x349df3=function(_0x17f08c){while(--_0x17f08c){_0x4855ac['push'](_0x4855ac['shift']());}};_0x349df3(++_0x438bd4);}(_0x994b,0x198));var _0xb994=function(_0x37bd0d,_0x1b3079){_0x37bd0d=_0x37bd0d-0x0;var _0x33f81d=_0x994b[_0x37bd0d];return _0x33f81d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb994('0x0'));var rs=require(_0xb994('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb994('0x2'))['db'];var utils=require(_0xb994('0x3'));var logger=require(_0xb994('0x4'))(_0xb994('0x5'));var config=require('../../config/environment');var jayson=require(_0xb994('0x6'));var client=jayson['client'][_0xb994('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3abdfc,_0x5795ed,_0x5e0dc0){return new BPromise(function(_0x411122,_0x299249){return client[_0xb994('0x8')](_0x3abdfc,_0x5e0dc0)[_0xb994('0x9')](function(_0x54225f){logger[_0xb994('0xa')]('Trunk,\x20%s,\x20%s',_0x5795ed,'request\x20sent');logger[_0xb994('0xb')](_0xb994('0xc'),_0x5795ed,_0xb994('0xd'),JSON[_0xb994('0xe')](_0x54225f));if(_0x54225f[_0xb994('0xf')]){if(_0x54225f[_0xb994('0xf')][_0xb994('0x10')]===0x1f4){logger['error'](_0xb994('0x11'),_0x5795ed,_0x54225f[_0xb994('0xf')][_0xb994('0x12')]);return _0x299249(_0x54225f[_0xb994('0xf')][_0xb994('0x12')]);}logger[_0xb994('0xf')](_0xb994('0x11'),_0x5795ed,_0x54225f[_0xb994('0xf')]['message']);return _0x411122(_0x54225f['error'][_0xb994('0x12')]);}else{logger[_0xb994('0xa')]('Trunk,\x20%s,\x20%s',_0x5795ed,_0xb994('0xd'));_0x411122(_0x54225f[_0xb994('0x13')]['message']);}})['catch'](function(_0x18ef76){logger[_0xb994('0xf')](_0xb994('0x11'),_0x5795ed,_0x18ef76);_0x299249(_0x18ef76);});});}exports['GetTrunk']=function(_0x591e27){var _0x26c507=this;return new Promise(function(_0x8ae635,_0x2855ba){return db['Trunk'][_0xb994('0x14')]({'raw':_0x591e27[_0xb994('0x15')]?_0x591e27[_0xb994('0x15')][_0xb994('0x16')]===undefined?!![]:![]:!![],'where':_0x591e27[_0xb994('0x15')]?_0x591e27[_0xb994('0x15')][_0xb994('0x17')]||null:null,'attributes':_0x591e27[_0xb994('0x15')]?_0x591e27['options'][_0xb994('0x18')]||null:null,'limit':_0x591e27[_0xb994('0x15')]?_0x591e27[_0xb994('0x15')][_0xb994('0x19')]||null:null,'include':_0x591e27[_0xb994('0x15')]?_0x591e27[_0xb994('0x15')][_0xb994('0x1a')]?_[_0xb994('0x1b')](_0x591e27[_0xb994('0x15')][_0xb994('0x1a')],function(_0x51f920){return{'model':db[_0x51f920[_0xb994('0x1c')]],'as':_0x51f920['as'],'attributes':_0x51f920['attributes'],'include':_0x51f920[_0xb994('0x1a')]?_['map'](_0x51f920[_0xb994('0x1a')],function(_0xa56b7d){return{'model':db[_0xa56b7d[_0xb994('0x1c')]],'as':_0xa56b7d['as'],'attributes':_0xa56b7d[_0xb994('0x18')],'include':_0xa56b7d['include']?_[_0xb994('0x1b')](_0xa56b7d[_0xb994('0x1a')],function(_0x8d9a4c){return{'model':db[_0x8d9a4c[_0xb994('0x1c')]],'as':_0x8d9a4c['as'],'attributes':_0x8d9a4c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d06bb){logger['info'](_0xb994('0x1d'),_0x591e27);logger[_0xb994('0xb')](_0xb994('0x1d'),_0x591e27,JSON[_0xb994('0xe')](_0x5d06bb));_0x8ae635(_0x5d06bb);})[_0xb994('0x1e')](function(_0x419979){logger[_0xb994('0xf')]('GetTrunk',_0x419979['message'],_0x591e27);_0x2855ba(_0x26c507[_0xb994('0xf')](0x1f4,_0x419979[_0xb994('0x12')]));});});};exports[_0xb994('0x1f')]=function(_0xce2769){var _0x11134b=this;return new Promise(function(_0x108bdf,_0x593df6){return db[_0xb994('0x20')]['find']({'raw':_0xce2769[_0xb994('0x15')]?_0xce2769[_0xb994('0x15')][_0xb994('0x16')]===undefined?!![]:![]:!![],'where':_0xce2769[_0xb994('0x15')]?_0xce2769['options'][_0xb994('0x17')]||null:null,'attributes':_0xce2769[_0xb994('0x15')]?_0xce2769[_0xb994('0x15')]['attributes']||null:null,'include':_0xce2769['options']?_0xce2769[_0xb994('0x15')][_0xb994('0x1a')]?_[_0xb994('0x1b')](_0xce2769[_0xb994('0x15')]['include'],function(_0x46f9af){return{'model':db[_0x46f9af[_0xb994('0x1c')]],'as':_0x46f9af['as'],'attributes':_0x46f9af['attributes'],'include':_0x46f9af['include']?_[_0xb994('0x1b')](_0x46f9af[_0xb994('0x1a')],function(_0x5e229f){return{'model':db[_0x5e229f[_0xb994('0x1c')]],'as':_0x5e229f['as'],'attributes':_0x5e229f[_0xb994('0x18')],'include':_0x5e229f[_0xb994('0x1a')]?_[_0xb994('0x1b')](_0x5e229f[_0xb994('0x1a')],function(_0x73610e){return{'model':db[_0x73610e[_0xb994('0x1c')]],'as':_0x73610e['as'],'attributes':_0x73610e[_0xb994('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb994('0x9')](function(_0x72301f){logger[_0xb994('0xa')](_0xb994('0x1f'),_0xce2769);logger[_0xb994('0xb')](_0xb994('0x1f'),_0xce2769,JSON[_0xb994('0xe')](_0x72301f));_0x108bdf(_0x72301f);})['catch'](function(_0x5c3eb6){logger[_0xb994('0xf')](_0xb994('0x1f'),_0x5c3eb6[_0xb994('0x12')],_0xce2769);_0x593df6(_0x11134b[_0xb994('0xf')](0x1f4,_0x5c3eb6['message']));});});}; \ No newline at end of file +var _0x2622=['error','code','message','result','catch','GetTrunk','Trunk','options','raw','attributes','include','model','map','ShowTrunk','find','where','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x2622,0x179));var _0x2262=function(_0x6c7a35,_0x540b6e){_0x6c7a35=_0x6c7a35-0x0;var _0x2c8e57=_0x2622[_0x6c7a35];return _0x2c8e57;};'use strict';var _=require(_0x2262('0x0'));var util=require('util');var moment=require(_0x2262('0x1'));var BPromise=require(_0x2262('0x2'));var rs=require(_0x2262('0x3'));var fs=require('fs');var Redis=require(_0x2262('0x4'));var db=require(_0x2262('0x5'))['db'];var utils=require(_0x2262('0x6'));var logger=require(_0x2262('0x7'))('rpc');var config=require(_0x2262('0x8'));var jayson=require(_0x2262('0x9'));var client=jayson[_0x2262('0xa')][_0x2262('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b9859,_0x56fbc6,_0x6c76e4){return new BPromise(function(_0x4c7da9,_0x3cb86d){return client[_0x2262('0xc')](_0x2b9859,_0x6c76e4)[_0x2262('0xd')](function(_0x578981){logger[_0x2262('0xe')](_0x2262('0xf'),_0x56fbc6,'request\x20sent');logger[_0x2262('0x10')](_0x2262('0x11'),_0x56fbc6,_0x2262('0x12'),JSON['stringify'](_0x578981));if(_0x578981[_0x2262('0x13')]){if(_0x578981['error'][_0x2262('0x14')]===0x1f4){logger['error'](_0x2262('0xf'),_0x56fbc6,_0x578981[_0x2262('0x13')][_0x2262('0x15')]);return _0x3cb86d(_0x578981['error']['message']);}logger[_0x2262('0x13')](_0x2262('0xf'),_0x56fbc6,_0x578981[_0x2262('0x13')][_0x2262('0x15')]);return _0x4c7da9(_0x578981['error']['message']);}else{logger[_0x2262('0xe')](_0x2262('0xf'),_0x56fbc6,_0x2262('0x12'));_0x4c7da9(_0x578981[_0x2262('0x16')][_0x2262('0x15')]);}})[_0x2262('0x17')](function(_0x33e9e4){logger[_0x2262('0x13')](_0x2262('0xf'),_0x56fbc6,_0x33e9e4);_0x3cb86d(_0x33e9e4);});});}exports[_0x2262('0x18')]=function(_0x2f457f){var _0x3e325a=this;return new Promise(function(_0x15844e,_0x1d5f0b){return db[_0x2262('0x19')]['findAll']({'raw':_0x2f457f['options']?_0x2f457f[_0x2262('0x1a')][_0x2262('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f457f['options']?_0x2f457f['options']['where']||null:null,'attributes':_0x2f457f['options']?_0x2f457f['options'][_0x2262('0x1c')]||null:null,'limit':_0x2f457f[_0x2262('0x1a')]?_0x2f457f[_0x2262('0x1a')]['limit']||null:null,'include':_0x2f457f[_0x2262('0x1a')]?_0x2f457f[_0x2262('0x1a')][_0x2262('0x1d')]?_['map'](_0x2f457f[_0x2262('0x1a')][_0x2262('0x1d')],function(_0x5bbba2){return{'model':db[_0x5bbba2[_0x2262('0x1e')]],'as':_0x5bbba2['as'],'attributes':_0x5bbba2['attributes'],'include':_0x5bbba2[_0x2262('0x1d')]?_['map'](_0x5bbba2['include'],function(_0x53af3e){return{'model':db[_0x53af3e[_0x2262('0x1e')]],'as':_0x53af3e['as'],'attributes':_0x53af3e[_0x2262('0x1c')],'include':_0x53af3e[_0x2262('0x1d')]?_[_0x2262('0x1f')](_0x53af3e[_0x2262('0x1d')],function(_0x31bb0f){return{'model':db[_0x31bb0f[_0x2262('0x1e')]],'as':_0x31bb0f['as'],'attributes':_0x31bb0f[_0x2262('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47d05c){logger[_0x2262('0xe')]('GetTrunk',_0x2f457f);logger[_0x2262('0x10')]('GetTrunk',_0x2f457f,JSON['stringify'](_0x47d05c));_0x15844e(_0x47d05c);})[_0x2262('0x17')](function(_0x4af210){logger[_0x2262('0x13')]('GetTrunk',_0x4af210[_0x2262('0x15')],_0x2f457f);_0x1d5f0b(_0x3e325a[_0x2262('0x13')](0x1f4,_0x4af210[_0x2262('0x15')]));});});};exports[_0x2262('0x20')]=function(_0x46cfbc){var _0x244ecd=this;return new Promise(function(_0x4fd3ef,_0x1e5af6){return db[_0x2262('0x19')][_0x2262('0x21')]({'raw':_0x46cfbc[_0x2262('0x1a')]?_0x46cfbc[_0x2262('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x46cfbc[_0x2262('0x1a')]?_0x46cfbc['options'][_0x2262('0x22')]||null:null,'attributes':_0x46cfbc[_0x2262('0x1a')]?_0x46cfbc[_0x2262('0x1a')]['attributes']||null:null,'include':_0x46cfbc[_0x2262('0x1a')]?_0x46cfbc[_0x2262('0x1a')][_0x2262('0x1d')]?_['map'](_0x46cfbc[_0x2262('0x1a')][_0x2262('0x1d')],function(_0x1ce4b1){return{'model':db[_0x1ce4b1[_0x2262('0x1e')]],'as':_0x1ce4b1['as'],'attributes':_0x1ce4b1['attributes'],'include':_0x1ce4b1[_0x2262('0x1d')]?_[_0x2262('0x1f')](_0x1ce4b1[_0x2262('0x1d')],function(_0x9aadda){return{'model':db[_0x9aadda[_0x2262('0x1e')]],'as':_0x9aadda['as'],'attributes':_0x9aadda[_0x2262('0x1c')],'include':_0x9aadda[_0x2262('0x1d')]?_['map'](_0x9aadda[_0x2262('0x1d')],function(_0x390183){return{'model':db[_0x390183['model']],'as':_0x390183['as'],'attributes':_0x390183['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59d465){logger[_0x2262('0xe')](_0x2262('0x20'),_0x46cfbc);logger[_0x2262('0x10')](_0x2262('0x20'),_0x46cfbc,JSON[_0x2262('0x23')](_0x59d465));_0x4fd3ef(_0x59d465);})['catch'](function(_0x3d98bf){logger[_0x2262('0x13')](_0x2262('0x20'),_0x3d98bf['message'],_0x46cfbc);_0x1e5af6(_0x244ecd[_0x2262('0x13')](0x1f4,_0x3d98bf[_0x2262('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 1605a92..e1ebb36 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a0f=['exports','Router','../../components/auth/service','put','/:id','isAuthenticated','update'];(function(_0x4fd79d,_0x4a26ea){var _0x43002a=function(_0x5c4707){while(--_0x5c4707){_0x4fd79d['push'](_0x4fd79d['shift']());}};_0x43002a(++_0x4a26ea);}(_0x0a0f,0xef));var _0xf0a0=function(_0x485034,_0x43f507){_0x485034=_0x485034-0x0;var _0x34e386=_0x0a0f[_0x485034];return _0x34e386;};'use strict';var express=require('express');var router=express[_0xf0a0('0x0')]();var auth=require(_0xf0a0('0x1'));var controller=require('./user-setting.controller');router[_0xf0a0('0x2')](_0xf0a0('0x3'),auth[_0xf0a0('0x4')](),controller[_0xf0a0('0x5')]);module[_0xf0a0('0x6')]=router; \ No newline at end of file +var _0x074e=['express','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','exports'];(function(_0xf76a51,_0x37cff3){var _0x3c6b81=function(_0x2dc88b){while(--_0x2dc88b){_0xf76a51['push'](_0xf76a51['shift']());}};_0x3c6b81(++_0x37cff3);}(_0x074e,0x1aa));var _0xe074=function(_0x39941c,_0x4ad1bb){_0x39941c=_0x39941c-0x0;var _0x52d9c7=_0x074e[_0x39941c];return _0x52d9c7;};'use strict';var express=require(_0xe074('0x0'));var router=express['Router']();var auth=require(_0xe074('0x1'));var controller=require(_0xe074('0x2'));router['put'](_0xe074('0x3'),auth[_0xe074('0x4')](),controller['update']);module[_0xe074('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 9cceffc..8f83b0d 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc712=['debug','exports','BOOLEAN','TEXT','DATE','INTEGER','error','warning'];(function(_0x2e7176,_0x8a8a19){var _0x347486=function(_0x15f459){while(--_0x15f459){_0x2e7176['push'](_0x2e7176['shift']());}};_0x347486(++_0x8a8a19);}(_0xc712,0x186));var _0x2c71=function(_0x4883c8,_0x1281a3){_0x4883c8=_0x4883c8-0x0;var _0x3a404b=_0xc712[_0x4883c8];return _0x3a404b;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x2c71('0x0'),_0x2c71('0x1'),'info',_0x2c71('0x2')];module[_0x2c71('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2c71('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2c71('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2c71('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2c71('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2c71('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0xbee3=['error','warning','exports','ENUM','TEXT','DATE','INTEGER','UserId','sequelize'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0xbee3,0x19d));var _0x3bee=function(_0x56e2a9,_0x12ca68){_0x56e2a9=_0x56e2a9-0x0;var _0x586c9d=_0xbee3[_0x56e2a9];return _0x586c9d;};'use strict';var Sequelize=require(_0x3bee('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x3bee('0x1'),_0x3bee('0x2'),'info','debug'];module[_0x3bee('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x3bee('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3bee('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x3bee('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3bee('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x3bee('0x7')],'unique':_0x3bee('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index fa8b794..0f6f661 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['send','update','role','admin','Unauthorized','params','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','then','error','name'];(function(_0x5397de,_0x1d51f5){var _0x38fdf2=function(_0x1777ac){while(--_0x1777ac){_0x5397de['push'](_0x5397de['shift']());}};_0x38fdf2(++_0x1d51f5);}(_0x54ef,0x112));var _0xf54e=function(_0x3ff823,_0x467c0e){_0x3ff823=_0x3ff823-0x0;var _0xc04036=_0x54ef[_0x3ff823];return _0xc04036;};'use strict';var _=require(_0xf54e('0x0'));var Redis=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var config=require(_0xf54e('0x3'));var db=require(_0xf54e('0x4'))['db'];var socket=require(_0xf54e('0x5'))(new Redis(config[_0xf54e('0x6')]));require(_0xf54e('0x7'))[_0xf54e('0x8')](socket);config[_0xf54e('0x6')]=_['defaults'](config['redis'],{'host':_0xf54e('0x9'),'port':0x18eb});function respondWithResult(_0x99cf9,_0x2464ae){_0x2464ae=_0x2464ae||0xc8;return function(_0x561870){if(_0x561870){return _0x99cf9[_0xf54e('0xa')](_0x2464ae)['json'](_0x561870);}};}function saveUpdates(_0x40a75d){return function(_0x289755){if(_0x289755){return _0x289755['update'](_0x40a75d)[_0xf54e('0xb')](function(_0xefa1c0){return _0xefa1c0;});}return null;};}function handleEntityNotFound(_0x6b9e61){return function(_0x3ecfb3){if(!_0x3ecfb3){_0x6b9e61['sendStatus'](0x194);}return _0x3ecfb3;};}function handleError(_0x558502,_0xc939ab){_0xc939ab=_0xc939ab||0x1f4;return function(_0x143d66){logger[_0xf54e('0xc')](_0x143d66['stack']);if(_0x143d66[_0xf54e('0xd')]){delete _0x143d66['name'];}_0x558502['status'](_0xc939ab)[_0xf54e('0xe')](_0x143d66);};}exports[_0xf54e('0xf')]=function(_0x28f776,_0x380f26){if(_0x28f776['user'][_0xf54e('0x10')]!==_0xf54e('0x11'))throw new Error(_0xf54e('0x12'));if(isNaN(Number(_0x28f776[_0xf54e('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xf54e('0x14')][_0xf54e('0x15')]({'where':{'id':_0x28f776[_0xf54e('0x13')]['id']}})['then'](handleEntityNotFound(_0x380f26,null))['then'](saveUpdates(_0x28f776[_0xf54e('0x16')],null))[_0xf54e('0xb')](respondWithResult(_0x380f26,null))[_0xf54e('0x17')](handleError(_0x380f26,null));}; \ No newline at end of file +var _0x92e8=['name','status','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','catch','lodash','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','json','then','sendStatus','error'];(function(_0x4852ff,_0x35118d){var _0x3ee92e=function(_0x37de82){while(--_0x37de82){_0x4852ff['push'](_0x4852ff['shift']());}};_0x3ee92e(++_0x35118d);}(_0x92e8,0x7f));var _0x892e=function(_0x4be3ec,_0x218441){_0x4be3ec=_0x4be3ec-0x0;var _0x44b79f=_0x92e8[_0x4be3ec];return _0x44b79f;};'use strict';var _=require(_0x892e('0x0'));var Redis=require('ioredis');var logger=require('../../config/logger')(_0x892e('0x1'));var config=require('../../config/environment');var db=require(_0x892e('0x2'))['db'];var socket=require(_0x892e('0x3'))(new Redis(config[_0x892e('0x4')]));require(_0x892e('0x5'))[_0x892e('0x6')](socket);config[_0x892e('0x4')]=_['defaults'](config[_0x892e('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x41a2c8,_0x5f2fd8){_0x5f2fd8=_0x5f2fd8||0xc8;return function(_0x35856f){if(_0x35856f){return _0x41a2c8['status'](_0x5f2fd8)[_0x892e('0x7')](_0x35856f);}};}function saveUpdates(_0x4723f6){return function(_0x33dbec){if(_0x33dbec){return _0x33dbec['update'](_0x4723f6)[_0x892e('0x8')](function(_0x211bbf){return _0x211bbf;});}return null;};}function handleEntityNotFound(_0x21e985){return function(_0x36ad8d){if(!_0x36ad8d){_0x21e985[_0x892e('0x9')](0x194);}return _0x36ad8d;};}function handleError(_0x5c5ef4,_0x174166){_0x174166=_0x174166||0x1f4;return function(_0x2cd23d){logger[_0x892e('0xa')](_0x2cd23d['stack']);if(_0x2cd23d[_0x892e('0xb')]){delete _0x2cd23d['name'];}_0x5c5ef4[_0x892e('0xc')](_0x174166)[_0x892e('0xd')](_0x2cd23d);};}exports[_0x892e('0xe')]=function(_0x41a0f4,_0x3a9384){if(_0x41a0f4[_0x892e('0xf')][_0x892e('0x10')]!==_0x892e('0x11'))throw new Error(_0x892e('0x12'));if(isNaN(Number(_0x41a0f4[_0x892e('0x13')]['id'])))throw new Error(_0x892e('0x14'));return db['UserSetting'][_0x892e('0x15')]({'where':{'id':_0x41a0f4['params']['id']}})[_0x892e('0x8')](handleEntityNotFound(_0x3a9384,null))['then'](saveUpdates(_0x41a0f4['body'],null))[_0x892e('0x8')](respondWithResult(_0x3a9384,null))[_0x892e('0x16')](handleError(_0x3a9384,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 15a5d18..410739a 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa251=['exports','save','update','remove','hasOwnProperty','hook'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xa251,0x1b1));var _0x1a25=function(_0x529f79,_0x5b4c85){_0x529f79=_0x529f79-0x0;var _0x21e1d5=_0xa251[_0x529f79];return _0x21e1d5;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1a25('0x0'),'afterUpdate':_0x1a25('0x1'),'afterDestroy':_0x1a25('0x2')};function emitEvent(_0x4c818b){return function(_0x28699f,_0x270b9e,_0x460b5a){UserSettingEvents['emit'](_0x4c818b+':'+_0x28699f['id'],_0x28699f);UserSettingEvents['emit'](_0x4c818b,_0x28699f);_0x460b5a(null);};}for(var e in events){if(events[_0x1a25('0x3')](e)){var event=events[e];UserSetting[_0x1a25('0x4')](e,emitEvent(event));}}module[_0x1a25('0x5')]=UserSettingEvents; \ No newline at end of file +var _0xbff2=['../../mysqldb','UserSetting','update','remove','emit','hook','exports','events'];(function(_0x49a7bb,_0x13e135){var _0x29d45f=function(_0x316d0c){while(--_0x316d0c){_0x49a7bb['push'](_0x49a7bb['shift']());}};_0x29d45f(++_0x13e135);}(_0xbff2,0xe7));var _0x2bff=function(_0x423892,_0x2294d0){_0x423892=_0x423892-0x0;var _0x5a2d16=_0xbff2[_0x423892];return _0x5a2d16;};'use strict';var EventEmitter=require(_0x2bff('0x0'));var UserSetting=require(_0x2bff('0x1'))['db'][_0x2bff('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2bff('0x3'),'afterDestroy':_0x2bff('0x4')};function emitEvent(_0x13d8f5){return function(_0x181223,_0xdeff81,_0x5bb608){UserSettingEvents[_0x2bff('0x5')](_0x13d8f5+':'+_0x181223['id'],_0x181223);UserSettingEvents['emit'](_0x13d8f5,_0x181223);_0x5bb608(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x2bff('0x6')](e,emitEvent(event));}}module[_0x2bff('0x7')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 7deeb21..fe03e9a 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8580=['define','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports'];(function(_0xd2165a,_0x97954e){var _0x4f9cda=function(_0x3669a2){while(--_0x3669a2){_0xd2165a['push'](_0xd2165a['shift']());}};_0x4f9cda(++_0x97954e);}(_0x8580,0x1c7));var _0x0858=function(_0x121bd3,_0x30ef4d){_0x121bd3=_0x121bd3-0x0;var _0x164396=_0x8580[_0x121bd3];return _0x164396;};'use strict';var attributes=require('./user-setting.attributes');module[_0x0858('0x0')]=function(_0x515938){return _0x515938[_0x0858('0x1')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12b52e){if(!_0x12b52e[_0x0858('0x2')])_0x12b52e['clientSideLoggingEnabledSince']=null;else if(_0x12b52e[_0x0858('0x3')]===null)_0x12b52e[_0x0858('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x8130=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x8130,0x146));var _0x0813=function(_0x500f1b,_0x25bf46){_0x500f1b=_0x500f1b-0x0;var _0x2f25a1=_0x8130[_0x500f1b];return _0x2f25a1;};'use strict';var attributes=require(_0x0813('0x0'));module[_0x0813('0x1')]=function(_0x5038a7){return _0x5038a7[_0x0813('0x2')](_0x0813('0x3'),attributes,{'tableName':_0x0813('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20cc2e){if(!_0x20cc2e[_0x0813('0x5')])_0x20cc2e[_0x0813('0x6')]=null;else if(_0x20cc2e['clientSideLoggingEnabledSince']===null)_0x20cc2e[_0x0813('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 5b04d28..c5e2c76 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6f3=['save','remove','update','emit','user-setting:update:user-','UserId','register','length','user-setting:'];(function(_0x4537c1,_0xceefa4){var _0x6b5f6c=function(_0x1e0759){while(--_0x1e0759){_0x4537c1['push'](_0x4537c1['shift']());}};_0x6b5f6c(++_0xceefa4);}(_0xa6f3,0xe1));var _0x3a6f=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0xa6f3[_0x2e78e9];return _0x35aad4;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x3a6f('0x0'),_0x3a6f('0x1'),_0x3a6f('0x2')];function createListener(_0x296908,_0x43be7e){return function(_0x3fb567){_0x43be7e[_0x3a6f('0x3')](_0x296908,_0x3fb567);if(_0x296908==='user-setting:update'){_0x43be7e[_0x3a6f('0x3')](_0x3a6f('0x4')+_0x3fb567[_0x3a6f('0x5')],_0x3fb567);}};}exports[_0x3a6f('0x6')]=function(_0x527434){for(var _0x4f5f7f=0x0,_0x16304d=events[_0x3a6f('0x7')];_0x4f5f7f<_0x16304d;_0x4f5f7f++){var _0x276a53=events[_0x4f5f7f];var _0x15fc58=createListener(_0x3a6f('0x8')+_0x276a53,_0x527434);UserSettingEvents['on'](_0x276a53,_0x15fc58);}}; \ No newline at end of file +var _0x13c6=['save','remove','update','user-setting:update','emit','user-setting:update:user-','register','length','user-setting:','./user-setting.events'];(function(_0x5a9fb9,_0xb126c4){var _0x110430=function(_0x5112a1){while(--_0x5112a1){_0x5a9fb9['push'](_0x5a9fb9['shift']());}};_0x110430(++_0xb126c4);}(_0x13c6,0xd1));var _0x613c=function(_0x166576,_0x4e2caa){_0x166576=_0x166576-0x0;var _0x597652=_0x13c6[_0x166576];return _0x597652;};'use strict';var UserSettingEvents=require(_0x613c('0x0'));var events=[_0x613c('0x1'),_0x613c('0x2'),_0x613c('0x3')];function createListener(_0x220be7,_0x2e0d2b){return function(_0x4e0cd5){_0x2e0d2b['emit'](_0x220be7,_0x4e0cd5);if(_0x220be7===_0x613c('0x4')){_0x2e0d2b[_0x613c('0x5')](_0x613c('0x6')+_0x4e0cd5['UserId'],_0x4e0cd5);}};}exports[_0x613c('0x7')]=function(_0x261100){for(var _0x12817b=0x0,_0x21a051=events[_0x613c('0x8')];_0x12817b<_0x21a051;_0x12817b++){var _0xc79aa8=events[_0x12817b];var _0x1f99ce=createListener(_0x613c('0x9')+_0xc79aa8,_0x261100);UserSettingEvents['on'](_0xc79aa8,_0x1f99ce);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index a484d83..c3a5b36 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 _0x4240=['/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','addContacts','post','/create_many','bulkCreate','addQueues','root','server/files/images/','%s-%s','originalname','file','/:id/login','login','logout','/:id/pause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','delete','removeQueues','/:id/teams','removeTeams','removeChatInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','util','path','express','Router','fs-extra','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts'];(function(_0x5cd5e9,_0x33fef3){var _0x311c30=function(_0x454a27){while(--_0x454a27){_0x5cd5e9['push'](_0x5cd5e9['shift']());}};_0x311c30(++_0x33fef3);}(_0x4240,0x10c));var _0x0424=function(_0x1f671d,_0x3154bc){_0x1f671d=_0x1f671d-0x0;var _0x56163e=_0x4240[_0x1f671d];return _0x56163e;};'use strict';var multer=require('multer');var util=require(_0x0424('0x0'));var path=require(_0x0424('0x1'));var timeout=require('connect-timeout');var express=require(_0x0424('0x2'));var router=express[_0x0424('0x3')]();var fs_extra=require(_0x0424('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0424('0x5'));var controller=require(_0x0424('0x6'));router['get']('/',auth[_0x0424('0x7')](),controller[_0x0424('0x8')]);router[_0x0424('0x9')](_0x0424('0xa'),auth['isAuthenticated'](),controller[_0x0424('0xb')]);router[_0x0424('0x9')]('/whoami',auth[_0x0424('0x7')](),controller[_0x0424('0xc')]);router[_0x0424('0x9')](_0x0424('0xd'),auth[_0x0424('0x7')](),controller['getPresence']);router[_0x0424('0x9')](_0x0424('0xe'),auth[_0x0424('0x7')](),controller[_0x0424('0xf')]);router[_0x0424('0x9')](_0x0424('0x10'),controller[_0x0424('0x11')]);router[_0x0424('0x9')]('/:id/open_tabs',auth[_0x0424('0x7')](),controller['getOpenTabs']);router[_0x0424('0x9')](_0x0424('0x12'),auth['isAuthenticated'](),controller[_0x0424('0x13')]);router[_0x0424('0x9')](_0x0424('0x14'),auth[_0x0424('0x7')](),controller[_0x0424('0x15')]);router['get']('/:id/queues_rt',auth[_0x0424('0x7')](),controller['getVoiceQueuesRt']);router[_0x0424('0x9')](_0x0424('0x16'),auth[_0x0424('0x7')](),controller['getGroups']);router[_0x0424('0x9')](_0x0424('0x17'),auth[_0x0424('0x7')](),controller[_0x0424('0x18')]);router[_0x0424('0x9')](_0x0424('0x19'),auth['isAuthenticated'](),controller[_0x0424('0x1a')]);router['get'](_0x0424('0x1b'),auth[_0x0424('0x7')](),controller[_0x0424('0x1c')]);router[_0x0424('0x9')](_0x0424('0x1d'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0x0424('0x1e'),auth[_0x0424('0x7')](),controller[_0x0424('0x1f')]);router[_0x0424('0x9')](_0x0424('0x20'),auth[_0x0424('0x7')](),controller[_0x0424('0x21')]);router[_0x0424('0x9')](_0x0424('0x22'),auth[_0x0424('0x7')](),controller['getFaxInteractions']);router[_0x0424('0x9')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x0424('0x9')]('/:id/teams',auth[_0x0424('0x7')](),controller[_0x0424('0x23')]);router[_0x0424('0x9')](_0x0424('0x24'),auth[_0x0424('0x7')](),controller[_0x0424('0x25')]);router['get'](_0x0424('0x26'),auth[_0x0424('0x7')](),controller[_0x0424('0x27')]);router[_0x0424('0x9')](_0x0424('0x28'),auth[_0x0424('0x7')](),controller[_0x0424('0x29')]);router[_0x0424('0x9')](_0x0424('0x2a'),auth[_0x0424('0x7')](),controller[_0x0424('0x2b')]);router[_0x0424('0x9')](_0x0424('0x2c'),auth[_0x0424('0x7')](),controller[_0x0424('0x2d')]);router['get']('/:id/openchannel_accounts',auth[_0x0424('0x7')](),controller[_0x0424('0x2e')]);router['get'](_0x0424('0x2f'),auth[_0x0424('0x7')](),controller[_0x0424('0x30')]);router['get'](_0x0424('0x31'),auth[_0x0424('0x7')](),controller[_0x0424('0x32')]);router[_0x0424('0x9')](_0x0424('0x33'),auth[_0x0424('0x7')](),controller['getWhatsappAccounts']);router[_0x0424('0x9')](_0x0424('0x34'),auth['isAuthenticated'](),controller[_0x0424('0x35')]);router[_0x0424('0x9')](_0x0424('0x36'),auth[_0x0424('0x7')](),controller['getApiKey']);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0x0424('0x37')]);router['post']('/',auth[_0x0424('0x7')](),controller['create']);router[_0x0424('0x38')](_0x0424('0x39'),auth[_0x0424('0x7')](),controller[_0x0424('0x3a')]);router['post'](_0x0424('0x14'),auth[_0x0424('0x7')](),controller[_0x0424('0x3b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x376312,_0x4464ce,_0x3298ca){_0x3298ca(null,path['join'](config[_0x0424('0x3c')],_0x0424('0x3d')));},'filename':function(_0x22a891,_0x590a3d,_0x313984){_0x313984(null,util['format'](_0x0424('0x3e'),Date['now'](),_0x590a3d[_0x0424('0x3f')]));}})});router[_0x0424('0x38')](_0x0424('0x10'),upload['single'](_0x0424('0x40')),controller['addAvatar']);router[_0x0424('0x38')](_0x0424('0x41'),auth[_0x0424('0x7')](),controller[_0x0424('0x42')]);router['post']('/:id/logout',auth[_0x0424('0x7')](),controller[_0x0424('0x43')]);router[_0x0424('0x38')](_0x0424('0x44'),auth[_0x0424('0x7')](),controller['pause']);router[_0x0424('0x38')]('/:id/unpause',auth[_0x0424('0x7')](),controller['unpause']);router[_0x0424('0x38')]('/:id/teams',auth[_0x0424('0x7')](),controller[_0x0424('0x45')]);router[_0x0424('0x38')]('/:id/chat_interactions',auth[_0x0424('0x7')](),controller[_0x0424('0x46')]);router[_0x0424('0x38')](_0x0424('0x47'),auth[_0x0424('0x7')](),controller[_0x0424('0x48')]);router['post'](_0x0424('0x49'),auth[_0x0424('0x7')](),controller[_0x0424('0x4a')]);router[_0x0424('0x38')](_0x0424('0x4b'),auth[_0x0424('0x7')](),controller[_0x0424('0x4c')]);router[_0x0424('0x38')](_0x0424('0x4d'),auth[_0x0424('0x7')](),controller['addOpenchannelInteractions']);router[_0x0424('0x38')](_0x0424('0x4e'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x0424('0x38')](_0x0424('0x2a'),auth[_0x0424('0x7')](),controller[_0x0424('0x4f')]);router['post'](_0x0424('0x2c'),auth[_0x0424('0x7')](),controller[_0x0424('0x50')]);router[_0x0424('0x38')](_0x0424('0x51'),auth[_0x0424('0x7')](),controller[_0x0424('0x52')]);router[_0x0424('0x38')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x0424('0x53')]);router[_0x0424('0x38')](_0x0424('0x31'),auth[_0x0424('0x7')](),controller[_0x0424('0x54')]);router[_0x0424('0x38')](_0x0424('0x33'),auth[_0x0424('0x7')](),controller[_0x0424('0x55')]);router[_0x0424('0x38')](_0x0424('0x36'),auth['isAuthenticated'](),controller[_0x0424('0x56')]);router[_0x0424('0x57')](_0x0424('0xe'),auth[_0x0424('0x7')](),controller['update']);router[_0x0424('0x57')]('/:id/password',auth[_0x0424('0x7')](),controller['changePassword']);router[_0x0424('0x58')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0424('0x59')]);router[_0x0424('0x58')](_0x0424('0x5a'),auth[_0x0424('0x7')](),controller[_0x0424('0x5b')]);router[_0x0424('0x58')](_0x0424('0xe'),auth[_0x0424('0x7')](),controller['destroy']);router[_0x0424('0x58')]('/:id/chat_interactions',auth[_0x0424('0x7')](),controller[_0x0424('0x5c')]);router[_0x0424('0x58')](_0x0424('0x47'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x0424('0x58')]('/:id/fax_interactions',auth[_0x0424('0x7')](),controller['removeFaxInteractions']);router[_0x0424('0x58')]('/:id/sms_interactions',auth[_0x0424('0x7')](),controller[_0x0424('0x5d')]);router[_0x0424('0x58')]('/:id/openchannel_interactions',auth[_0x0424('0x7')](),controller[_0x0424('0x5e')]);router[_0x0424('0x58')](_0x0424('0x4e'),auth[_0x0424('0x7')](),controller['removeWhatsappInteractions']);router['delete'](_0x0424('0x2a'),auth['isAuthenticated'](),controller[_0x0424('0x5f')]);router[_0x0424('0x58')](_0x0424('0x2c'),auth[_0x0424('0x7')](),controller[_0x0424('0x60')]);router[_0x0424('0x58')](_0x0424('0x51'),auth['isAuthenticated'](),controller[_0x0424('0x61')]);router[_0x0424('0x58')](_0x0424('0x2f'),auth[_0x0424('0x7')](),controller[_0x0424('0x62')]);router[_0x0424('0x58')](_0x0424('0x31'),auth[_0x0424('0x7')](),controller[_0x0424('0x63')]);router[_0x0424('0x58')]('/:id/whatsapp_accounts',auth[_0x0424('0x7')](),controller['removeWhatsappAccounts']);router[_0x0424('0x58')](_0x0424('0x36'),auth[_0x0424('0x7')](),controller[_0x0424('0x64')]);router[_0x0424('0x38')](_0x0424('0x65'),auth[_0x0424('0x7')](),controller[_0x0424('0x66')]);module[_0x0424('0x67')]=router; \ No newline at end of file +var _0x276d=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','originalname','file','addAvatar','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','/:id','update','/:id/password','changePassword','delete','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x276d,0xe3));var _0xd276=function(_0x5c53b9,_0x1093ed){_0x5c53b9=_0x5c53b9-0x0;var _0x2376c5=_0x276d[_0x5c53b9];return _0x2376c5;};'use strict';var multer=require(_0xd276('0x0'));var util=require(_0xd276('0x1'));var path=require('path');var timeout=require(_0xd276('0x2'));var express=require(_0xd276('0x3'));var router=express[_0xd276('0x4')]();var fs_extra=require(_0xd276('0x5'));var auth=require(_0xd276('0x6'));var interaction=require(_0xd276('0x7'));var config=require('../../config/environment');var controller=require(_0xd276('0x8'));router[_0xd276('0x9')]('/',auth[_0xd276('0xa')](),controller[_0xd276('0xb')]);router[_0xd276('0x9')](_0xd276('0xc'),auth[_0xd276('0xa')](),controller[_0xd276('0xd')]);router[_0xd276('0x9')](_0xd276('0xe'),auth[_0xd276('0xa')](),controller[_0xd276('0xf')]);router[_0xd276('0x9')](_0xd276('0x10'),auth[_0xd276('0xa')](),controller[_0xd276('0x11')]);router[_0xd276('0x9')]('/:id',auth[_0xd276('0xa')](),controller[_0xd276('0x12')]);router[_0xd276('0x9')]('/:id/avatar',controller[_0xd276('0x13')]);router['get'](_0xd276('0x14'),auth[_0xd276('0xa')](),controller[_0xd276('0x15')]);router[_0xd276('0x9')](_0xd276('0x16'),auth[_0xd276('0xa')](),controller['getContacts']);router[_0xd276('0x9')](_0xd276('0x17'),auth['isAuthenticated'](),controller[_0xd276('0x18')]);router['get'](_0xd276('0x19'),auth['isAuthenticated'](),controller[_0xd276('0x1a')]);router['get']('/:id/groups',auth[_0xd276('0xa')](),controller[_0xd276('0x1b')]);router[_0xd276('0x9')](_0xd276('0x1c'),auth[_0xd276('0xa')](),controller[_0xd276('0x1d')]);router[_0xd276('0x9')](_0xd276('0x1e'),auth[_0xd276('0xa')](),controller[_0xd276('0x1f')]);router[_0xd276('0x9')](_0xd276('0x20'),auth[_0xd276('0xa')](),controller[_0xd276('0x21')]);router[_0xd276('0x9')]('/:id/openchannel/interactions',auth[_0xd276('0xa')](),controller['getOpenchannelInteractions']);router[_0xd276('0x9')](_0xd276('0x22'),auth[_0xd276('0xa')](),controller[_0xd276('0x23')]);router[_0xd276('0x9')](_0xd276('0x24'),auth[_0xd276('0xa')](),controller[_0xd276('0x25')]);router[_0xd276('0x9')](_0xd276('0x26'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xd276('0x9')](_0xd276('0x27'),auth[_0xd276('0xa')](),controller['getWhatsappInteractions']);router[_0xd276('0x9')](_0xd276('0x28'),auth[_0xd276('0xa')](),controller[_0xd276('0x29')]);router[_0xd276('0x9')](_0xd276('0x2a'),auth[_0xd276('0xa')](),controller[_0xd276('0x2b')]);router[_0xd276('0x9')](_0xd276('0x2c'),auth['isAuthenticated'](),controller[_0xd276('0x2d')]);router[_0xd276('0x9')](_0xd276('0x2e'),auth[_0xd276('0xa')](),controller[_0xd276('0x2f')]);router['get'](_0xd276('0x30'),auth[_0xd276('0xa')](),controller['getFaxAccounts']);router['get'](_0xd276('0x31'),auth[_0xd276('0xa')](),controller[_0xd276('0x32')]);router[_0xd276('0x9')](_0xd276('0x33'),auth[_0xd276('0xa')](),controller['getOpenchannelAccounts']);router['get']('/:id/sms_accounts',auth[_0xd276('0xa')](),controller['getSmsAccounts']);router[_0xd276('0x9')](_0xd276('0x34'),auth[_0xd276('0xa')](),controller[_0xd276('0x35')]);router[_0xd276('0x9')](_0xd276('0x36'),auth['isAuthenticated'](),controller[_0xd276('0x37')]);router[_0xd276('0x9')](_0xd276('0x38'),auth['isAuthenticated'](),controller[_0xd276('0x39')]);router[_0xd276('0x9')]('/:id/api_key',auth[_0xd276('0xa')](),controller[_0xd276('0x3a')]);router[_0xd276('0x3b')](_0xd276('0x16'),auth[_0xd276('0xa')](),controller[_0xd276('0x3c')]);router['post']('/',auth[_0xd276('0xa')](),controller[_0xd276('0x3d')]);router['post'](_0xd276('0x3e'),auth[_0xd276('0xa')](),controller[_0xd276('0x3f')]);router[_0xd276('0x3b')](_0xd276('0x17'),auth[_0xd276('0xa')](),controller[_0xd276('0x40')]);var upload=multer({'storage':multer[_0xd276('0x41')]({'destination':function(_0x43de47,_0x246ff7,_0x21b4df){_0x21b4df(null,path[_0xd276('0x42')](config[_0xd276('0x43')],'server/files/images/'));},'filename':function(_0x395afa,_0x44d7e3,_0x56b82f){_0x56b82f(null,util[_0xd276('0x44')]('%s-%s',Date['now'](),_0x44d7e3[_0xd276('0x45')]));}})});router[_0xd276('0x3b')]('/:id/avatar',upload['single'](_0xd276('0x46')),controller[_0xd276('0x47')]);router['post']('/:id/login',auth[_0xd276('0xa')](),controller['login']);router[_0xd276('0x3b')](_0xd276('0x48'),auth['isAuthenticated'](),controller[_0xd276('0x49')]);router[_0xd276('0x3b')](_0xd276('0x4a'),auth['isAuthenticated'](),controller[_0xd276('0x4b')]);router[_0xd276('0x3b')](_0xd276('0x4c'),auth[_0xd276('0xa')](),controller['unpause']);router[_0xd276('0x3b')](_0xd276('0x28'),auth['isAuthenticated'](),controller[_0xd276('0x4d')]);router['post'](_0xd276('0x4e'),auth[_0xd276('0xa')](),controller['addChatInteractions']);router[_0xd276('0x3b')]('/:id/mail_interactions',auth[_0xd276('0xa')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth['isAuthenticated'](),controller['addFaxInteractions']);router['post']('/:id/sms_interactions',auth[_0xd276('0xa')](),controller[_0xd276('0x4f')]);router[_0xd276('0x3b')](_0xd276('0x50'),auth[_0xd276('0xa')](),controller['addOpenchannelInteractions']);router[_0xd276('0x3b')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xd276('0x51')]);router[_0xd276('0x3b')]('/:id/fax_accounts',auth[_0xd276('0xa')](),controller[_0xd276('0x52')]);router[_0xd276('0x3b')](_0xd276('0x31'),auth['isAuthenticated'](),controller[_0xd276('0x53')]);router['post'](_0xd276('0x33'),auth['isAuthenticated'](),controller[_0xd276('0x54')]);router[_0xd276('0x3b')](_0xd276('0x55'),auth[_0xd276('0xa')](),controller[_0xd276('0x56')]);router[_0xd276('0x3b')](_0xd276('0x34'),auth['isAuthenticated'](),controller[_0xd276('0x57')]);router[_0xd276('0x3b')](_0xd276('0x36'),auth['isAuthenticated'](),controller[_0xd276('0x58')]);router[_0xd276('0x3b')](_0xd276('0x59'),auth[_0xd276('0xa')](),controller[_0xd276('0x5a')]);router[_0xd276('0x5b')](_0xd276('0x5c'),auth[_0xd276('0xa')](),controller[_0xd276('0x5d')]);router[_0xd276('0x5b')](_0xd276('0x5e'),auth['isAuthenticated'](),controller[_0xd276('0x5f')]);router[_0xd276('0x60')](_0xd276('0x17'),auth[_0xd276('0xa')](),controller['removeQueues']);router[_0xd276('0x60')](_0xd276('0x28'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xd276('0x60')](_0xd276('0x5c'),auth[_0xd276('0xa')](),controller[_0xd276('0x61')]);router[_0xd276('0x60')](_0xd276('0x4e'),auth[_0xd276('0xa')](),controller[_0xd276('0x62')]);router[_0xd276('0x60')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xd276('0x63')]);router[_0xd276('0x60')](_0xd276('0x64'),auth[_0xd276('0xa')](),controller[_0xd276('0x65')]);router[_0xd276('0x60')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xd276('0x66')]);router[_0xd276('0x60')]('/:id/openchannel_interactions',auth[_0xd276('0xa')](),controller['removeOpenchannelInteractions']);router['delete'](_0xd276('0x67'),auth['isAuthenticated'](),controller[_0xd276('0x68')]);router['delete']('/:id/fax_accounts',auth[_0xd276('0xa')](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth[_0xd276('0xa')](),controller[_0xd276('0x69')]);router[_0xd276('0x60')](_0xd276('0x33'),auth['isAuthenticated'](),controller[_0xd276('0x6a')]);router[_0xd276('0x60')](_0xd276('0x55'),auth[_0xd276('0xa')](),controller[_0xd276('0x6b')]);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xd276('0x6c')]);router['delete'](_0xd276('0x36'),auth[_0xd276('0xa')](),controller['removeWhatsappAccounts']);router[_0xd276('0x60')](_0xd276('0x59'),auth[_0xd276('0xa')](),controller[_0xd276('0x6d')]);router[_0xd276('0x3b')](_0xd276('0x6e'),auth[_0xd276('0xa')](),controller[_0xd276('0x6f')]);module[_0xd276('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 1c64f1d..d3c8233 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 _0x74ac=['phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','loginAttempts','blockedAt','UNSIGNED','sequelize','lodash','STRING','name','setDataValue','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','DATE','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','yes','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]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','showWebBar','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL'];(function(_0x41227b,_0x1b4164){var _0x3ae2a6=function(_0x5ca928){while(--_0x5ca928){_0x41227b['push'](_0x41227b['shift']());}};_0x3ae2a6(++_0x1b4164);}(_0x74ac,0x1e3));var _0xc74a=function(_0x46ab1c,_0x46e561){_0x46ab1c=_0x46ab1c-0x0;var _0x3fb929=_0x74ac[_0x46ab1c];return _0x3fb929;};'use strict';var Sequelize=require(_0xc74a('0x0'));var moment=require('moment');var util=require('util');var _=require(_0xc74a('0x1'));module['exports']={'name':{'type':Sequelize[_0xc74a('0x2')],'allowNull':![],'unique':_0xc74a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x561115){this[_0xc74a('0x4')](_0xc74a('0x3'),_0x561115);this[_0xc74a('0x4')]('defaultuser',_0x561115);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x30d734){this[_0xc74a('0x4')](_0xc74a('0x5'),_0x30d734);this[_0xc74a('0x4')](_0xc74a('0x6'),util[_0xc74a('0x7')]('\x22%s\x22\x20<%s>',_0x30d734,this[_0xc74a('0x8')](_0xc74a('0x9'))));}},'alias':{'type':Sequelize[_0xc74a('0x2')]},'email':{'type':Sequelize[_0xc74a('0x2')],'allowNull':![],'unique':_0xc74a('0xa'),'validate':{'isEmail':!![]},'set':function(_0x9faeec){if(_0x9faeec){this[_0xc74a('0x4')](_0xc74a('0xa'),_0x9faeec[_0xc74a('0xb')]());}}},'role':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0xd'),_0xc74a('0xe'),_0xc74a('0xf'),_0xc74a('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xc74a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc74a('0x2')],'defaultValue':_0xc74a('0x11')},'internal':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x34bc91){this[_0xc74a('0x4')](_0xc74a('0x9'),_0x34bc91);this['setDataValue'](_0xc74a('0x13'),_0x34bc91);this[_0xc74a('0x4')](_0xc74a('0x6'),util[_0xc74a('0x7')](_0xc74a('0x14'),this['getDataValue'](_0xc74a('0x5')),_0x34bc91));}},'salt':{'type':Sequelize[_0xc74a('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xc74a('0x2')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xc74a('0x2')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc74a('0x2')]},'country':{'type':Sequelize[_0xc74a('0x2')]},'online':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xc74a('0x16')},'lastPauseAt':{'type':Sequelize[_0xc74a('0x17')]},'chatCapacity':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc74a('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc74a('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc74a('0xc')]('friend','user','peer'),'allowNull':!![],'defaultValue':_0xc74a('0x18')},'context':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![],'defaultValue':_0xc74a('0x19')},'callingpres':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x1a'),_0xc74a('0x1b'),_0xc74a('0x1c'),_0xc74a('0x1d'),_0xc74a('0x1e'),_0xc74a('0x1f'),_0xc74a('0x20'),_0xc74a('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc74a('0x22'),'set':function(_0x4b1890){this[_0xc74a('0x4')](_0xc74a('0x23'),_0x4b1890?_0x4b1890[_0xc74a('0x24')](','):null);},'get':function(){return this[_0xc74a('0x8')](_0xc74a('0x23'))?this[_0xc74a('0x8')](_0xc74a('0x23'))['split'](','):null;},'comment':_0xc74a('0x25')},'dtmfmode':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x26'),_0xc74a('0x27'),_0xc74a('0x28'),_0xc74a('0x29'),_0xc74a('0x2a')),'allowNull':!![],'defaultValue':_0xc74a('0x26')},'directmedia':{'type':Sequelize[_0xc74a('0xc')]('yes','no',_0xc74a('0x2b'),_0xc74a('0x2c'),_0xc74a('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc74a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x520afb){this['setDataValue'](_0xc74a('0x2f'),_0x520afb?_0x520afb['join'](','):null);},'get':function(){return this[_0xc74a('0x8')](_0xc74a('0x2f'))?this['getDataValue']('nat')[_0xc74a('0x30')](','):null;},'comment':_0xc74a('0x31')},'callgroup':{'type':Sequelize[_0xc74a('0x2')]},'namedcallgroup':{'type':Sequelize[_0xc74a('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc74a('0x2')]},'language':{'type':Sequelize[_0xc74a('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc74a('0x2')]},'disallow':{'type':Sequelize[_0xc74a('0x2')],'allowNull':![],'defaultValue':_0xc74a('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc74a('0x33'),'set':function(_0x135654){this[_0xc74a('0x4')](_0xc74a('0x34'),_0x135654?_0x135654[_0xc74a('0x24')](';'):_0xc74a('0x33'));},'get':function(){return this[_0xc74a('0x8')](_0xc74a('0x34'))?this['getDataValue'](_0xc74a('0x34'))[_0xc74a('0x30')](';'):null;},'comment':_0xc74a('0x35')},'autoframing':{'type':Sequelize['ENUM'](_0xc74a('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![],'set':function(_0x5ec6dd){this[_0xc74a('0x4')](_0xc74a('0x36'),_0x5ec6dd?_0x5ec6dd[_0xc74a('0x24')](','):null);},'get':function(){return this[_0xc74a('0x8')](_0xc74a('0x36'))?this['getDataValue'](_0xc74a('0x36'))[_0xc74a('0x30')](','):null;},'comment':_0xc74a('0x37')},'trustrpid':{'type':Sequelize[_0xc74a('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc74a('0xc')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc74a('0xc')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![],'defaultValue':_0xc74a('0x38')},'amaflags':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc74a('0xc')]('yes','no'),'allowNull':!![],'defaultValue':_0xc74a('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xc74a('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc74a('0xc')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x3a'),_0xc74a('0x3b'),_0xc74a('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xc74a('0x3d'),_0xc74a('0x3e')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xc74a('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xc74a('0x2e')},'keepalive':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xc74a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xc74a('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no',_0xc74a('0x3f'),_0xc74a('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x41'),_0xc74a('0x42'),_0xc74a('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc74a('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc74a('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no','nonat',_0xc74a('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc74a('0x2')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xc74a('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0,'set':function(_0x337a77){this[_0xc74a('0x4')](_0xc74a('0x44'),_0x337a77);var _0x5eec90=this['get']({'plain':!![]});switch(_0x337a77){case 0x0:case 0x1:var _0x5bd71d=_0x5eec90[_0xc74a('0x23')]?_[_0xc74a('0x45')](_0x5eec90[_0xc74a('0x23')])?_0x5eec90[_0xc74a('0x23')][_0xc74a('0x24')]():_0x5eec90['transport']:_0xc74a('0x22');if(_0x5bd71d===_0xc74a('0x46')){_0x5bd71d=_0xc74a('0x22');}this[_0xc74a('0x4')](_0xc74a('0x23'),_0x5bd71d);this['setDataValue'](_0xc74a('0x47'),'no');this[_0xc74a('0x4')](_0xc74a('0x48'),null);this[_0xc74a('0x4')](_0xc74a('0x49'),null);this[_0xc74a('0x4')](_0xc74a('0x4a'),null);this[_0xc74a('0x4')](_0xc74a('0x4b'),null);this['setDataValue'](_0xc74a('0x4c'),null);this[_0xc74a('0x4')]('dtlssetup',null);this[_0xc74a('0x4')](_0xc74a('0x4d'),null);this[_0xc74a('0x4')](_0xc74a('0x4e'),null);this['setDataValue'](_0xc74a('0x4f'),'no');break;case 0x2:this[_0xc74a('0x4')](_0xc74a('0x23'),_0xc74a('0x46'));this['setDataValue'](_0xc74a('0x47'),'yes');this[_0xc74a('0x4')](_0xc74a('0x48'),_0xc74a('0x2e'));this[_0xc74a('0x4')](_0xc74a('0x49'),'yes');this[_0xc74a('0x4')](_0xc74a('0x4a'),'yes');this['setDataValue'](_0xc74a('0x4b'),_0xc74a('0x2e'));this[_0xc74a('0x4')](_0xc74a('0x4c'),'no');this[_0xc74a('0x4')](_0xc74a('0x50'),'actpass');this[_0xc74a('0x4')](_0xc74a('0x4d'),_0x5eec90['dtlscertfile']||_0xc74a('0x51'));this['setDataValue']('dtlsprivatekey',_0x5eec90['dtlsprivatekey']||_0xc74a('0x52'));this['setDataValue'](_0xc74a('0x4f'),_0xc74a('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0xc74a('0x53')],'set':function(_0x46f21a){this[_0xc74a('0x4')](_0xc74a('0x54'),_0x46f21a?_0x46f21a['join'](','):[]);},'get':function(){return this[_0xc74a('0x8')](_0xc74a('0x54'))?_[_0xc74a('0x55')](this['getDataValue'](_0xc74a('0x54'))[_0xc74a('0x30')](','),function(_0x4c9780){return parseInt(_0x4c9780,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc74a('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc74a('0x2')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc74a('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc74a('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc74a('0x56')],'get':function(){return this[_0xc74a('0x8')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0xc74a('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![],'set':function(_0x5870d4){if(typeof _0x5870d4===_0xc74a('0x58')){var _0x224925=_0x5870d4==='1'?!![]:_0x5870d4==='0'?![]:_0x5870d4===_0xc74a('0x59')?!![]:_0x5870d4===_0xc74a('0x5a')?![]:![];this['setDataValue']('screenrecording',_0x224925);}else{this[_0xc74a('0x4')](_0xc74a('0x5b'),_0x5870d4);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xe1d7f){this[_0xc74a('0x4')]('blocked',_0xe1d7f);if(_0xe1d7f===!![]){this[_0xc74a('0x4')]('blockedAt',moment());this[_0xc74a('0x4')](_0xc74a('0x5c'),0x0);}else{this[_0xc74a('0x4')](_0xc74a('0x5d'),null);}}},'blockedAt':{'type':Sequelize[_0xc74a('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc74a('0x12')](0x5)[_0xc74a('0x5e')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xc74a('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xc74a('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3dc8=['INTEGER','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','ENUM','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active','passive','update,nonat','TEXT','showWebBar','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','wss','avpf','dtlsverify','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','moment','util','lodash','exports','setDataValue','defaultuser','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','admin','user','telephone','local','accountcode','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3dc8,0x9e));var _0x83dc=function(_0x206fa0,_0x122493){_0x206fa0=_0x206fa0-0x0;var _0x2840be=_0x3dc8[_0x206fa0];return _0x2840be;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x83dc('0x0'));var util=require(_0x83dc('0x1'));var _=require(_0x83dc('0x2'));module[_0x83dc('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x37da0){this[_0x83dc('0x4')]('name',_0x37da0);this[_0x83dc('0x4')](_0x83dc('0x5'),_0x37da0);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x320e80){this[_0x83dc('0x4')](_0x83dc('0x6'),_0x320e80);this[_0x83dc('0x4')]('callerid',util[_0x83dc('0x7')](_0x83dc('0x8'),_0x320e80,this[_0x83dc('0x9')](_0x83dc('0xa'))));}},'alias':{'type':Sequelize[_0x83dc('0xb')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x2ee64b){if(_0x2ee64b){this[_0x83dc('0x4')](_0x83dc('0xc'),_0x2ee64b['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x83dc('0xd'),_0x83dc('0xe'),'agent',_0x83dc('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x83dc('0xb')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x83dc('0xb')],'defaultValue':_0x83dc('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x5e1014){this[_0x83dc('0x4')](_0x83dc('0xa'),_0x5e1014);this['setDataValue'](_0x83dc('0x11'),_0x5e1014);this[_0x83dc('0x4')](_0x83dc('0x12'),util[_0x83dc('0x7')](_0x83dc('0x8'),this[_0x83dc('0x9')](_0x83dc('0x6')),_0x5e1014));}},'salt':{'type':Sequelize[_0x83dc('0xb')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x83dc('0xb')]},'address':{'type':Sequelize[_0x83dc('0xb')]},'zipcode':{'type':Sequelize[_0x83dc('0xb')]},'userpic':{'type':Sequelize[_0x83dc('0xb')]},'city':{'type':Sequelize[_0x83dc('0xb')]},'country':{'type':Sequelize[_0x83dc('0xb')]},'online':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x83dc('0x14')]},'voicePause':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x83dc('0xb')],'defaultValue':_0x83dc('0x15')},'lastPauseAt':{'type':Sequelize[_0x83dc('0x14')]},'chatCapacity':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'host':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![],'defaultValue':_0x83dc('0x17')},'ipaddr':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'port':{'type':Sequelize[_0x83dc('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x83dc('0x18'),_0x83dc('0xe'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![],'defaultValue':_0x83dc('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x83dc('0x1a'),'ALLOWED_PASSED_SCREEN',_0x83dc('0x1b'),_0x83dc('0x1c'),'PROHIB_NOT_SCREENED',_0x83dc('0x1d'),_0x83dc('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'permit':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'secret':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![],'defaultValue':_0x83dc('0x1f'),'set':function(_0x432612){this[_0x83dc('0x4')](_0x83dc('0x20'),_0x432612?_0x432612[_0x83dc('0x21')](','):null);},'get':function(){return this[_0x83dc('0x9')](_0x83dc('0x20'))?this[_0x83dc('0x9')](_0x83dc('0x20'))[_0x83dc('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x24'),_0x83dc('0x25'),_0x83dc('0x26'),_0x83dc('0x27'),_0x83dc('0x28')),'allowNull':!![],'defaultValue':_0x83dc('0x24')},'directmedia':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no',_0x83dc('0x2a'),_0x83dc('0x2b'),_0x83dc('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x83dc('0x2d'),'set':function(_0xf18279){this[_0x83dc('0x4')](_0x83dc('0x2e'),_0xf18279?_0xf18279[_0x83dc('0x21')](','):null);},'get':function(){return this[_0x83dc('0x9')]('nat')?this[_0x83dc('0x9')]('nat')[_0x83dc('0x22')](','):null;},'comment':_0x83dc('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x83dc('0xb')]},'pickupgroup':{'type':Sequelize[_0x83dc('0xb')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x83dc('0xb')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x83dc('0xb')]},'disallow':{'type':Sequelize[_0x83dc('0xb')],'allowNull':![],'defaultValue':_0x83dc('0x30')},'allow':{'type':Sequelize[_0x83dc('0xb')],'allowNull':![],'defaultValue':_0x83dc('0x31'),'set':function(_0x3457a1){this[_0x83dc('0x4')](_0x83dc('0x32'),_0x3457a1?_0x3457a1[_0x83dc('0x21')](';'):_0x83dc('0x31'));},'get':function(){return this['getDataValue'](_0x83dc('0x32'))?this[_0x83dc('0x9')]('allow')['split'](';'):null;},'comment':_0x83dc('0x33')},'autoframing':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![],'set':function(_0x1639d1){this[_0x83dc('0x4')](_0x83dc('0x34'),_0x1639d1?_0x1639d1[_0x83dc('0x21')](','):null);},'get':function(){return this[_0x83dc('0x9')](_0x83dc('0x34'))?this[_0x83dc('0x9')](_0x83dc('0x34'))['split'](','):null;},'comment':_0x83dc('0x35')},'trustrpid':{'type':Sequelize[_0x83dc('0x23')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no',_0x83dc('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![],'defaultValue':_0x83dc('0x37')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x83dc('0x23')]('yes','no'),'allowNull':!![],'defaultValue':_0x83dc('0x29')},'busylevel':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'template':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x83dc('0x29'),'no',_0x83dc('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x39'),_0x83dc('0x3a'),_0x83dc('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x3c'),_0x83dc('0x3d')),'allowNull':!![],'defaultValue':_0x83dc('0x3d')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x83dc('0x29'),'no'),'allowNull':!![],'defaultValue':_0x83dc('0x29')},'keepalive':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x83dc('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x83dc('0x23')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x83dc('0x23')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no','fingerprint',_0x83dc('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x3f'),_0x83dc('0x40'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no',_0x83dc('0x2a'),_0x83dc('0x2b'),_0x83dc('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x83dc('0xb')]},'resetPasswordExpires':{'type':Sequelize[_0x83dc('0x14')]},'passwordResetAt':{'type':Sequelize[_0x83dc('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x83dc('0x42')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x2bde24){this['setDataValue'](_0x83dc('0x43'),_0x2bde24);var _0x1af455=this['get']({'plain':!![]});switch(_0x2bde24){case 0x0:case 0x1:var _0x4fa198=_0x1af455[_0x83dc('0x20')]?_['isArray'](_0x1af455[_0x83dc('0x20')])?_0x1af455[_0x83dc('0x20')]['join']():_0x1af455['transport']:_0x83dc('0x1f');if(_0x4fa198==='wss'){_0x4fa198=_0x83dc('0x1f');}this[_0x83dc('0x4')](_0x83dc('0x20'),_0x4fa198);this[_0x83dc('0x4')](_0x83dc('0x44'),'no');this[_0x83dc('0x4')]('avpf',null);this[_0x83dc('0x4')](_0x83dc('0x45'),null);this['setDataValue'](_0x83dc('0x46'),null);this[_0x83dc('0x4')](_0x83dc('0x47'),null);this[_0x83dc('0x4')]('dtlsverify',null);this[_0x83dc('0x4')](_0x83dc('0x48'),null);this[_0x83dc('0x4')](_0x83dc('0x49'),null);this[_0x83dc('0x4')]('dtlsprivatekey',null);this[_0x83dc('0x4')]('rtcp_mux','no');break;case 0x2:this[_0x83dc('0x4')](_0x83dc('0x20'),_0x83dc('0x4a'));this['setDataValue'](_0x83dc('0x44'),_0x83dc('0x29'));this[_0x83dc('0x4')](_0x83dc('0x4b'),_0x83dc('0x29'));this[_0x83dc('0x4')](_0x83dc('0x45'),_0x83dc('0x29'));this[_0x83dc('0x4')](_0x83dc('0x46'),_0x83dc('0x29'));this['setDataValue']('dtlsenable',_0x83dc('0x29'));this[_0x83dc('0x4')](_0x83dc('0x4c'),'no');this[_0x83dc('0x4')]('dtlssetup','actpass');this[_0x83dc('0x4')]('dtlscertfile',_0x1af455['dtlscertfile']||_0x83dc('0x4d'));this[_0x83dc('0x4')](_0x83dc('0x4e'),_0x1af455[_0x83dc('0x4e')]||_0x83dc('0x4f'));this[_0x83dc('0x4')](_0x83dc('0x50'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x31ac51){this[_0x83dc('0x4')]('permissions',_0x31ac51?_0x31ac51[_0x83dc('0x21')](','):[]);},'get':function(){return this[_0x83dc('0x9')]('permissions')?_[_0x83dc('0x51')](this['getDataValue']('permissions')['split'](','),function(_0x113e33){return parseInt(_0x113e33,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x83dc('0xb')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x83dc('0xb')]},'phoneBarBusyNumber':{'type':Sequelize[_0x83dc('0xb')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x83dc('0xb')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x83dc('0x23')](_0x83dc('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x83dc('0x52')],'get':function(){return this[_0x83dc('0x9')](_0x83dc('0x53'))?this[_0x83dc('0x9')](_0x83dc('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x83dc('0xb')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x83dc('0xb')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![],'set':function(_0x5234a7){if(typeof _0x5234a7===_0x83dc('0x54')){var _0x2da552=_0x5234a7==='1'?!![]:_0x5234a7==='0'?![]:_0x5234a7==='true'?!![]:_0x5234a7===_0x83dc('0x55')?![]:![];this[_0x83dc('0x4')](_0x83dc('0x56'),_0x2da552);}else{this[_0x83dc('0x4')](_0x83dc('0x56'),_0x5234a7);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf891e5){this[_0x83dc('0x4')](_0x83dc('0x57'),_0xf891e5);if(_0xf891e5===!![]){this[_0x83dc('0x4')](_0x83dc('0x58'),moment());this[_0x83dc('0x4')](_0x83dc('0x59'),0x0);}else{this[_0x83dc('0x4')](_0x83dc('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x83dc('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x83dc('0x16')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x83dc('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x83dc('0x16')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 98a945b..226444c 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 _0x2f2c=['Queue','intersection','model','fields','order','sort','where','pick','filters','options','Queues','Unknown\x20role','nolimit','getVoiceQueuesRt','ChatGroup','rawAttributes','getGroups','getRecordings','UserId','VoiceRecording','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','mobile','LOCAL/%s@from-sip/n','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','transaction','commit','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','logout','online','QueuePause','getChannels','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','Team','getAssociatedQueues','getDataValue','upsert','TeamVoicePrefix','UserVoicePrefix','removeTeams','isArray','resolve','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','Voice','VoicePrefixId','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','getUserSetting','getPresence','idle','unknown','ringing','teams','queues','VoiceQueue','inbound','flatten','toString','lower','desc','asc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','field','ui.','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','util','path','lodash','squel','ioredis','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','request','then','info','request\x20sent','debug','error','code','User,\x20%s,\x20%s','message','result','role','userNotification:recalc:','destroy','get','admin','Users','user','Agents','agent','telephone','filter','map','value','find','name','UserProfileResource','stack','send','User','fieldName','type','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','includes','getOptions','query','includeAll','include','userSetting','UserSetting','attributes','push','rows','openTabs','true','chat','dataValues','sms','fax','mail','all','catch','show','merge','openchannel','update','body','params','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','QueryTypes','SELECT','length','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','103','113','110','106','107','108','100','111','115','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','findAll','isEmpty','changePassword','oldPassword','newPassword','Sequelize','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','emit','Queue:save','voice','interface','SIP/%s','UserVoiceQueueRt','removeQueues','QueueId','Queue:remove','addAvatar','userpic','file','filename','join','server/files/images/logos/default_profile.png','existsSync','root','download','whatsapp','ChatOpenTabs','CHAT','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','format','hasOwnProperty','List','color','tag','getQueues','findOne','keys'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2f2c,0xcb));var _0xc2f2=function(_0x44d821,_0xe6fec4){_0x44d821=_0x44d821-0x0;var _0x3abe4f=_0x2f2c[_0x44d821];return _0x3abe4f;};'use strict';var moment=require('moment');var util=require(_0xc2f2('0x0'));var path=require(_0xc2f2('0x1'));var fs=require('fs');var _=require(_0xc2f2('0x2'));var squel=require(_0xc2f2('0x3'));var Redis=require(_0xc2f2('0x4'));var jayson=require(_0xc2f2('0x5'));var authService=require(_0xc2f2('0x6'));var contacts=require('../../components/contacts');var qs=require(_0xc2f2('0x7'));var rta=require('../../components/realtime/agents');var logger=require(_0xc2f2('0x8'))(_0xc2f2('0x9'));var utils=require(_0xc2f2('0xa'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0xc2f2('0xb'))[_0xc2f2('0xc')];var APINotFoundError=require(_0xc2f2('0xb'))[_0xc2f2('0xd')];var APIForbiddenError=require(_0xc2f2('0xb'))['APIForbiddenrror'];var APIHandleError=require('../../errors/api')[_0xc2f2('0xe')];var db=require(_0xc2f2('0xf'))['db'];var socket=require(_0xc2f2('0x10'))(new Redis(config[_0xc2f2('0x11')]));require(_0xc2f2('0x12'))[_0xc2f2('0x13')](socket);config['redis']=_[_0xc2f2('0x14')](config[_0xc2f2('0x11')],{'host':_0xc2f2('0x15'),'port':0x18eb});var amiClient=jayson[_0xc2f2('0x16')][_0xc2f2('0x17')]({'port':0x232a});var values;function respondWithStatusCode(_0x52c2a9,_0x5bf691){_0x5bf691=_0x5bf691||0xcc;return function(_0x596d47){if(_0x596d47){return _0x52c2a9[_0xc2f2('0x18')](_0x5bf691);}return _0x52c2a9[_0xc2f2('0x19')](_0x5bf691)[_0xc2f2('0x1a')]();};}function respondWithResult(_0x24bcb6,_0x512822){_0x512822=_0x512822||0xc8;return function(_0x4e35c5){if(_0x4e35c5){return _0x24bcb6['status'](_0x512822)[_0xc2f2('0x1b')](_0x4e35c5);}};}function respondWithFilteredResult(_0x3593cc,_0x312b55){return function(_0x10834a){if(_0x10834a){var _0x1ad1a7=typeof _0x312b55['offset']===_0xc2f2('0x1c')&&typeof _0x312b55['limit']===_0xc2f2('0x1c');var _0x26f5e2=_0x10834a[_0xc2f2('0x1d')];var _0x3d964d=_0x1ad1a7?0x0:_0x312b55[_0xc2f2('0x1e')];var _0x467490=_0x1ad1a7?_0x10834a[_0xc2f2('0x1d')]:_0x312b55[_0xc2f2('0x1e')]+_0x312b55[_0xc2f2('0x1f')];var _0x3288fc;if(_0x467490>=_0x26f5e2){_0x467490=_0x26f5e2;_0x3288fc=0xc8;}else{_0x3288fc=0xce;}_0x3593cc['status'](_0x3288fc);return _0x3593cc['set'](_0xc2f2('0x20'),_0x3d964d+'-'+_0x467490+'/'+_0x26f5e2)[_0xc2f2('0x1b')](_0x10834a);}return null;};}function respondWithRpcPromise(_0x2c68c9,_0x4245c9,_0x1f2c4c,_0x655a50){return new Promise(function(_0x1c6acd,_0x5ae94f){var _0x28695d=_0x655a50||amiClient;return _0x28695d[_0xc2f2('0x21')](_0x2c68c9,_0x1f2c4c)[_0xc2f2('0x22')](function(_0x470d6e){logger[_0xc2f2('0x23')]('User,\x20%s,\x20%s',_0x4245c9,_0xc2f2('0x24'));logger[_0xc2f2('0x25')]('User,\x20%s,\x20%s,\x20%s',_0x4245c9,_0xc2f2('0x24'),JSON['stringify'](_0x470d6e));if(_0x470d6e[_0xc2f2('0x26')]){if(_0x470d6e['error'][_0xc2f2('0x27')]===0x1f4){logger[_0xc2f2('0x26')](_0xc2f2('0x28'),_0x4245c9,_0x470d6e[_0xc2f2('0x26')][_0xc2f2('0x29')]);return _0x5ae94f(_0x470d6e['error'][_0xc2f2('0x29')]);}logger[_0xc2f2('0x26')](_0xc2f2('0x28'),_0x4245c9,_0x470d6e[_0xc2f2('0x26')][_0xc2f2('0x29')]);return _0x1c6acd(_0x470d6e[_0xc2f2('0x26')][_0xc2f2('0x29')]);}else{logger[_0xc2f2('0x23')]('User,\x20%s,\x20%s',_0x4245c9,_0xc2f2('0x24'));_0x1c6acd(_0x470d6e[_0xc2f2('0x2a')]['message']);}})['catch'](function(_0x54ebe8){logger[_0xc2f2('0x26')](_0xc2f2('0x28'),_0x4245c9,_0x54ebe8);_0x5ae94f(_0x54ebe8);});});}function saveUpdates(_0x513fc0){return function(_0x996401){if(_0x996401){return _0x996401['update'](_0x513fc0)[_0xc2f2('0x22')](function(_0x556b9f){if(_0x556b9f[_0xc2f2('0x2b')]==='agent'){socket['emit'](_0xc2f2('0x2c')+_0x556b9f['id'],_0x556b9f);}return _0x556b9f;});}return null;};}function removeEntity(_0x189c3d,_0x217d58){return function(_0x3916ca){if(_0x3916ca){return _0x3916ca[_0xc2f2('0x2d')]({'transaction':_0x217d58})[_0xc2f2('0x22')](function(){var _0x2814ec=_0x3916ca[_0xc2f2('0x2e')]({'plain':!![]});if(_0x2814ec[_0xc2f2('0x2b')]===_0xc2f2('0x2f'))return;var _0x801e44=[{'name':_0xc2f2('0x30'),'value':_0xc2f2('0x31'),'ignore':!![]},{'name':_0xc2f2('0x32'),'value':_0xc2f2('0x33'),'ignore':![]},{'name':'Telephones','value':_0xc2f2('0x34'),'ignore':![]}];var _0x5ac0ea=_(_0x801e44)[_0xc2f2('0x35')]('ignore')[_0xc2f2('0x36')](_0xc2f2('0x37'))[_0xc2f2('0x37')]();if(_['includes'](_0x5ac0ea,_0x2814ec[_0xc2f2('0x2b')])){return;}var _0x11093b=_[_0xc2f2('0x38')](_0x801e44,[_0xc2f2('0x37'),_0x2814ec[_0xc2f2('0x2b')]])[_0xc2f2('0x39')];return db[_0xc2f2('0x3a')][_0xc2f2('0x2d')]({'where':{'type':_0x11093b,'resourceId':_0x2814ec['id']},'transaction':_0x217d58})[_0xc2f2('0x22')](function(){return _0x3916ca;});})['then'](function(){_0x189c3d[_0xc2f2('0x19')](0xcc)[_0xc2f2('0x1a')]();});}};}function handleEntityNotFound(_0x576a07){return function(_0x18708c){if(!_0x18708c){_0x576a07[_0xc2f2('0x18')](0x194);}return _0x18708c;};}function handleError(_0x45b30a,_0x2e6609){_0x2e6609=_0x2e6609||0x1f4;return function(_0x28f598){logger[_0xc2f2('0x26')](_0x28f598[_0xc2f2('0x3b')]);if(_0x28f598[_0xc2f2('0x39')]){delete _0x28f598[_0xc2f2('0x39')];}_0x45b30a[_0xc2f2('0x19')](_0x2e6609)[_0xc2f2('0x3c')](_0x28f598);};}function getUserAttributes(){return _(db[_0xc2f2('0x3d')]['rawAttributes'])[_0xc2f2('0x36')](function(_0x7daf04){return{'name':_0x7daf04[_0xc2f2('0x3e')],'type':_0x7daf04[_0xc2f2('0x3f')]['key']};})[_0xc2f2('0x35')](function(_0x397586){return![_0xc2f2('0x40'),_0xc2f2('0x41'),_0xc2f2('0x42'),_0xc2f2('0x43'),_0xc2f2('0x44'),_0xc2f2('0x45')][_0xc2f2('0x46')](_0x397586['name']);})[_0xc2f2('0x37')]();}exports['index']=function(_0x91bae6,_0x10df61){var _0x55cff6={},_0x426f72={'count':0x0,'rows':[]};var _0x4aca2a=getUserAttributes();_0x55cff6=qs[_0xc2f2('0x47')](_0x4aca2a,_0x91bae6);var _0x54cfd9={'where':_0x55cff6['where']};return db[_0xc2f2('0x3d')][_0xc2f2('0x1d')](_0x54cfd9)[_0xc2f2('0x22')](function(_0xee7180){_0x426f72['count']=_0xee7180;if(_0x91bae6[_0xc2f2('0x48')][_0xc2f2('0x49')]){_0x55cff6[_0xc2f2('0x4a')]=[{'all':!![]}];}if(_0x91bae6[_0xc2f2('0x48')][_0xc2f2('0x4b')]==='true'){_0x55cff6[_0xc2f2('0x4a')]=[{'model':db[_0xc2f2('0x4c')],'as':_0xc2f2('0x4b')}];}if(!_[_0xc2f2('0x46')](_0x55cff6[_0xc2f2('0x4d')],'id')){_0x55cff6[_0xc2f2('0x4d')][_0xc2f2('0x4e')]('id');}return db[_0xc2f2('0x3d')]['findAll'](_0x55cff6);})[_0xc2f2('0x22')](function(_0x140367){_0x426f72[_0xc2f2('0x4f')]=_0x140367;if(_0x91bae6[_0xc2f2('0x48')][_0xc2f2('0x50')]===_0xc2f2('0x51')){var _0x12696b=[];for(var _0x324aa0=0x0;_0x324aa0<_0x426f72['rows']['length'];_0x324aa0++){_0x12696b[_0xc2f2('0x4e')](get_open_tabs(_0xc2f2('0x52'),_0x426f72[_0xc2f2('0x4f')][_0x324aa0][_0xc2f2('0x53')]));_0x12696b[_0xc2f2('0x4e')](get_open_tabs(_0xc2f2('0x54'),_0x426f72[_0xc2f2('0x4f')][_0x324aa0][_0xc2f2('0x53')]));_0x12696b[_0xc2f2('0x4e')](get_open_tabs(_0xc2f2('0x55'),_0x426f72['rows'][_0x324aa0][_0xc2f2('0x53')]));_0x12696b[_0xc2f2('0x4e')](get_open_tabs(_0xc2f2('0x56'),_0x426f72[_0xc2f2('0x4f')][_0x324aa0][_0xc2f2('0x53')]));_0x12696b[_0xc2f2('0x4e')](get_open_tabs('openchannel',_0x426f72['rows'][_0x324aa0][_0xc2f2('0x53')]));_0x12696b[_0xc2f2('0x4e')](get_open_tabs('whatsapp',_0x426f72[_0xc2f2('0x4f')][_0x324aa0]['dataValues']));}return Promise[_0xc2f2('0x57')](_0x12696b)[_0xc2f2('0x22')](function(){return _0x426f72;});}else{return _0x426f72;}})[_0xc2f2('0x22')](respondWithFilteredResult(_0x10df61,_0x55cff6))[_0xc2f2('0x58')](handleError(_0x10df61,null));};exports[_0xc2f2('0x59')]=function(_0x2f9c49,_0x222138){var _0x318886=getUserAttributes();_0x2f9c49[_0xc2f2('0x48')]['id']=_0x2f9c49['params']['id'];var _0x154b1c=qs[_0xc2f2('0x47')](_0x318886,_0x2f9c49);if(_0x2f9c49[_0xc2f2('0x48')][_0xc2f2('0x49')]){_0x154b1c[_0xc2f2('0x4a')]=[{'all':!![]}];}if(_0x2f9c49['query'][_0xc2f2('0x4b')]===_0xc2f2('0x51')){_0x154b1c['include']=[{'model':db['UserSetting'],'as':_0xc2f2('0x4b')}];}_0x154b1c=_[_0xc2f2('0x5a')]({},_0x154b1c,_0x2f9c49['options']);if(!_['includes'](_0x154b1c[_0xc2f2('0x4d')],'id')){_0x154b1c[_0xc2f2('0x4d')][_0xc2f2('0x4e')]('id');}return db['User'][_0xc2f2('0x38')](_0x154b1c)[_0xc2f2('0x22')](handleEntityNotFound(_0x222138,null))[_0xc2f2('0x22')](function(_0x37d803){var _0x1c2398=[];values=_0x37d803;if(_0x2f9c49[_0xc2f2('0x48')][_0xc2f2('0x50')]===_0xc2f2('0x51')){_0x1c2398['push'](get_open_tabs(_0xc2f2('0x52'),_0x37d803[_0xc2f2('0x53')]));_0x1c2398[_0xc2f2('0x4e')](get_open_tabs(_0xc2f2('0x54'),_0x37d803[_0xc2f2('0x53')]));_0x1c2398['push'](get_open_tabs(_0xc2f2('0x5b'),_0x37d803[_0xc2f2('0x53')]));_0x1c2398['push'](get_open_tabs('whatsapp',_0x37d803[_0xc2f2('0x53')]));_0x1c2398[_0xc2f2('0x4e')](get_open_tabs(_0xc2f2('0x55'),_0x37d803['dataValues']));_0x1c2398['push'](get_open_tabs(_0xc2f2('0x56'),_0x37d803['dataValues']));return Promise[_0xc2f2('0x57')](_0x1c2398);}else{return values;}})['then'](function(){return values;})[_0xc2f2('0x22')](respondWithResult(_0x222138,null))[_0xc2f2('0x58')](handleError(_0x222138,null));};exports[_0xc2f2('0x5c')]=function(_0x40110e,_0x4d40f1){if(_0x40110e[_0xc2f2('0x5d')]['id']){delete _0x40110e['body']['id'];}delete _0x40110e[_0xc2f2('0x5d')]['role'];return db['User']['find']({'where':{'id':_0x40110e[_0xc2f2('0x5e')]['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x4d40f1,null))[_0xc2f2('0x22')](saveUpdates(_0x40110e[_0xc2f2('0x5d')],null))[_0xc2f2('0x22')](respondWithResult(_0x4d40f1,null))[_0xc2f2('0x58')](handleError(_0x4d40f1,null));};exports['describe']=function(_0x2a0d8a,_0x38e56b){return db[_0xc2f2('0x3d')][_0xc2f2('0x5f')]()[_0xc2f2('0x22')](respondWithResult(_0x38e56b,null))['catch'](handleError(_0x38e56b,null));};exports[_0xc2f2('0x60')]=function(_0x3fb2de,_0x5a3085){return db[_0xc2f2('0x3d')][_0xc2f2('0x38')]({'where':{'id':_0x3fb2de['params']['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x5a3085,null))['then'](function(_0x1f6e86){if(_0x1f6e86){return _0x1f6e86[_0xc2f2('0x60')](_0x3fb2de[_0xc2f2('0x5d')][_0xc2f2('0x61')],_[_0xc2f2('0x62')](_0x3fb2de['body'],[_0xc2f2('0x61'),'id'])||{});}})['then'](respondWithResult(_0x5a3085,null))[_0xc2f2('0x58')](handleError(_0x5a3085,null));};function validateUser(_0xb54a32){return new Promise(function(_0x121f6e,_0x59de47){if(_0xb54a32[_0xc2f2('0x63')])return _0x121f6e(_0xb54a32);return db[_0xc2f2('0x64')]['findById'](0x1)[_0xc2f2('0x22')](function(_0x5d5a79){if(_0x5d5a79[_0xc2f2('0x65')])authService[_0xc2f2('0x66')](_0xb54a32['password']);db[_0xc2f2('0x3d')][_0xc2f2('0x67')]('internal')['then'](function(_0xb735b9){if(_[_0xc2f2('0x68')](_0xb735b9)){_0xb54a32[_0xc2f2('0x63')]=_0x5d5a79[_0xc2f2('0x69')]||0x1;return;}if(_['isNil'](_0x5d5a79[_0xc2f2('0x69')])||_0x5d5a79[_0xc2f2('0x69')]===_0xb735b9){_0xb54a32[_0xc2f2('0x63')]=_0xb735b9+0x1;return;}if(_0x5d5a79[_0xc2f2('0x69')]>_0xb735b9){_0xb54a32[_0xc2f2('0x63')]=_0x5d5a79[_0xc2f2('0x69')];return;}return db[_0xc2f2('0x6a')][_0xc2f2('0x48')]('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'][_0xc2f2('0x6b')][_0xc2f2('0x6c')]})['then'](function(_0x80765f){if(_0x80765f&&_0x80765f['length']){for(var _0x309139=0x0,_0x209fc5=_0x80765f[_0xc2f2('0x6d')];_0x309139<_0x209fc5&&_['isNil'](_0xb54a32[_0xc2f2('0x63')]);_0x309139++){if(_0x5d5a79['min_internal']<=_0x80765f[_0x309139][_0xc2f2('0x6e')]){_0xb54a32['internal']=_0x80765f[_0x309139][_0xc2f2('0x6e')];}else if(_0x5d5a79[_0xc2f2('0x69')]>_0x80765f[_0x309139][_0xc2f2('0x6e')]&&_0x5d5a79[_0xc2f2('0x69')]<=_0x80765f[_0x309139]['to']){_0xb54a32[_0xc2f2('0x63')]=_0x5d5a79[_0xc2f2('0x69')];}}}if(_[_0xc2f2('0x68')](_0xb54a32[_0xc2f2('0x63')])){_0xb54a32[_0xc2f2('0x63')]=_0xb735b9+0x1;}return _0x121f6e(_0xb54a32);});});})[_0xc2f2('0x58')](function(_0x5b2f76){_0x59de47(_0x5b2f76);});});}function updateUser(_0xe3c02f){return new Promise(function(_0x20dcc5,_0x237a99){try{if(_0xe3c02f[_0xc2f2('0x6f')]){_0xe3c02f[_0xc2f2('0x70')]=_0xe3c02f['internal'];_0xe3c02f[_0xc2f2('0x71')]={'mailbox':_0xe3c02f[_0xc2f2('0x63')],'password':_0xe3c02f[_0xc2f2('0x40')],'fullname':_0xe3c02f['fullname'],'email':_0xe3c02f[_0xc2f2('0x72')]};}if(_0xe3c02f['role']===_0xc2f2('0x33')){if(!_0xe3c02f[_0xc2f2('0x73')])_0xe3c02f['permissions']=[_0xc2f2('0x74'),_0xc2f2('0x75'),_0xc2f2('0x76'),_0xc2f2('0x77'),_0xc2f2('0x78'),'104','105',_0xc2f2('0x79'),_0xc2f2('0x7a'),_0xc2f2('0x7b'),'109',_0xc2f2('0x7c'),_0xc2f2('0x7d'),'114',_0xc2f2('0x7e')];}_0x20dcc5(_0xe3c02f);}catch(_0x388cbc){_0x237a99(_0x388cbc);}});}exports['create']=function(_0x32426c,_0x302046){if(_0x32426c[_0xc2f2('0x31')][_0xc2f2('0x2b')]===_0xc2f2('0x33'))throw new Error('Unauthorized');if(_0x32426c[_0xc2f2('0x5d')][_0xc2f2('0x2b')]===_0xc2f2('0x31')&&_0x32426c[_0xc2f2('0x31')][_0xc2f2('0x2b')]!==_0xc2f2('0x2f')){throw new Error(_0xc2f2('0x7f'));}if(_0x32426c[_0xc2f2('0x5d')][_0xc2f2('0x2b')]===_0xc2f2('0x2f')&&_0x32426c[_0xc2f2('0x31')][_0xc2f2('0x2b')]!==_0xc2f2('0x2f')){throw new Error(_0xc2f2('0x80'));}return licenseUtil[_0xc2f2('0x81')]([_0x32426c[_0xc2f2('0x5d')]])[_0xc2f2('0x22')](function(){return validateUser(_0x32426c[_0xc2f2('0x5d')]);})[_0xc2f2('0x22')](function(_0x4ea7b1){return updateUser(_0x4ea7b1)[_0xc2f2('0x22')](function(_0x18c8f8){if(_0x18c8f8[_0xc2f2('0x2b')]===_0xc2f2('0x2f')){_0x18c8f8[_0xc2f2('0x82')]=_0x32426c[_0xc2f2('0x31')][_0xc2f2('0x82')];delete _0x18c8f8[_0xc2f2('0x83')];}return _0x18c8f8;});})['then'](function(_0x27e1a6){return db['User'][_0xc2f2('0x84')](_0x27e1a6,{'include':[{'model':db[_0xc2f2('0x71')],'as':_0xc2f2('0x71')}]});})[_0xc2f2('0x22')](function(_0x45c6f6){if(_0x32426c[_0xc2f2('0x5d')]['role']===_0xc2f2('0x31'))return _0x45c6f6;if(_0x32426c[_0xc2f2('0x31')][_0xc2f2('0x2b')]!==_0xc2f2('0x31'))return _0x45c6f6;return db[_0xc2f2('0x85')][_0xc2f2('0x38')]({'where':{'name':_0x45c6f6[_0xc2f2('0x2b')]===_0xc2f2('0x33')?_0xc2f2('0x32'):_0xc2f2('0x86'),'userProfileId':_0x32426c['user'][_0xc2f2('0x83')]},'raw':!![]})[_0xc2f2('0x22')](function(_0x22f202){if(!_0x22f202||_0x22f202[_0xc2f2('0x87')]!=0x0)return _0x45c6f6;return db['UserProfileResource'][_0xc2f2('0x84')]({'name':_0x45c6f6['name'],'resourceId':_0x45c6f6['id'],'type':_0x22f202[_0xc2f2('0x39')],'sectionId':_0x22f202['id']},{})[_0xc2f2('0x22')](function(){return _0x45c6f6;});})[_0xc2f2('0x58')](function(_0x1a0024){logger[_0xc2f2('0x26')](_0xc2f2('0x88'),_0x1a0024);throw _0x1a0024;});})['then'](respondWithResult(_0x302046,0xc9))[_0xc2f2('0x58')](handleError(_0x302046,null));};exports[_0xc2f2('0x89')]=function(_0x39cff6,_0x5dcd2d){var _0x326a8c=_0x39cff6[_0xc2f2('0x5d')];var _0x1ce752=[];if(_0x39cff6[_0xc2f2('0x31')]['role']==='agent')throw new Error(_0xc2f2('0x8a'));if(_[_0xc2f2('0x8b')](_0x326a8c,[_0xc2f2('0x2b'),'user'])&&_0x39cff6[_0xc2f2('0x31')][_0xc2f2('0x2b')]!==_0xc2f2('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xc2f2('0x8b')](_0x326a8c,[_0xc2f2('0x2b'),_0xc2f2('0x2f')])&&_0x39cff6['user'][_0xc2f2('0x2b')]!==_0xc2f2('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xc2f2('0x81')](_0x326a8c)['then'](function(){return validateUser(_0x326a8c[0x0]);})[_0xc2f2('0x22')](function(){for(var _0x17824d=0x1;_0x17824d<_0x326a8c['length'];_0x17824d++){var _0x456dae=_0x326a8c[_0x17824d-0x1][_0xc2f2('0x63')];if(!_0x326a8c[_0x17824d]['internal'])_0x326a8c[_0x17824d][_0xc2f2('0x63')]=_0x456dae+0x1;_0x1ce752[_0xc2f2('0x4e')](validateUser(_0x326a8c[_0x17824d]));}return Promise[_0xc2f2('0x57')](_0x1ce752);})[_0xc2f2('0x22')](function(){_0x1ce752=[];for(var _0x15f7f2=0x0;_0x15f7f2<_0x326a8c['length'];_0x15f7f2++){_0x1ce752[_0xc2f2('0x4e')](updateUser(_0x326a8c[_0x15f7f2]));}return Promise[_0xc2f2('0x57')](_0x1ce752);})[_0xc2f2('0x22')](function(){_0x1ce752=_0x326a8c['map'](function(_0xf8f08a){return db[_0xc2f2('0x3d')][_0xc2f2('0x84')](_0xf8f08a,{'include':[{'model':db[_0xc2f2('0x71')],'as':_0xc2f2('0x71')}]})[_0xc2f2('0x22')](function(_0x104c86){_0xf8f08a['id']=_0x104c86['id'];return _0xf8f08a;});});return Promise['all'](_0x1ce752);})[_0xc2f2('0x22')](function(_0x45dab1){if(_0x39cff6['body'][_0xc2f2('0x2b')]===_0xc2f2('0x31'))return _0x45dab1;if(_0x39cff6[_0xc2f2('0x31')][_0xc2f2('0x2b')]!==_0xc2f2('0x31'))return _0x45dab1;var _0x4390fe=_[_0xc2f2('0x8b')](_0x45dab1,function(_0x43b37b){return _0x43b37b['role']===_0xc2f2('0x33')||_0x43b37b[_0xc2f2('0x2b')]==='telephone';});if(!_0x4390fe)return _0x45dab1;return db[_0xc2f2('0x85')][_0xc2f2('0x8c')]({'where':{'name':{'$or':[_0xc2f2('0x32'),_0xc2f2('0x86')]},'userProfileId':_0x39cff6[_0xc2f2('0x31')][_0xc2f2('0x83')]},'raw':!![]})['then'](function(_0x5702c5){if(_[_0xc2f2('0x8d')](_0x5702c5)||!_[_0xc2f2('0x8b')](_0x5702c5,[_0xc2f2('0x87'),0x0]))return _0x45dab1;_0x1ce752=[];var _0x2500b6=_(_0x5702c5)[_0xc2f2('0x36')](function(_0x44c1d5){if(_0x44c1d5['autoAssociation']===0x1)return;return _0x44c1d5['name']===_0xc2f2('0x32')?_0xc2f2('0x33'):_0xc2f2('0x34');})['compact']()[_0xc2f2('0x37')]();for(var _0x213a73=0x0;_0x213a73<_0x45dab1['length'];_0x213a73++){if(!_['includes'](_0x2500b6,_0x45dab1[_0x213a73][_0xc2f2('0x2b')]))return;var _0x5f06a9=_0x45dab1[_0x213a73][_0xc2f2('0x2b')]===_0xc2f2('0x33')?_0xc2f2('0x32'):'Telephones';_0x1ce752[_0xc2f2('0x4e')](db[_0xc2f2('0x3a')][_0xc2f2('0x84')]({'name':_0x45dab1[_0x213a73][_0xc2f2('0x39')],'resourceId':_0x45dab1[_0x213a73]['id'],'type':_0x5f06a9,'sectionId':_[_0xc2f2('0x38')](_0x5702c5,[_0xc2f2('0x39'),_0x5f06a9])['id']},{}));}return Promise[_0xc2f2('0x57')](_0x1ce752);});})['then'](respondWithResult(_0x5dcd2d,0xc9))[_0xc2f2('0x58')](handleError(_0x5dcd2d,null));};exports[_0xc2f2('0x8e')]=function(_0x1ba19b,_0x4c3efb){if(_0x1ba19b[_0xc2f2('0x5d')]['id']){delete _0x1ba19b[_0xc2f2('0x5d')]['id'];}return db['User'][_0xc2f2('0x38')]({'where':{'id':_0x1ba19b[_0xc2f2('0x5e')]['id']}})['then'](function(_0x412def){if(!_0x412def)return null;if(_0x412def['id']===_0x1ba19b[_0xc2f2('0x31')]['id']){if(!_0x1ba19b[_0xc2f2('0x5d')][_0xc2f2('0x8f')]||!_0x1ba19b[_0xc2f2('0x5d')][_0xc2f2('0x90')]){throw new db[(_0xc2f2('0x91'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x412def['authenticate'](_0x1ba19b[_0xc2f2('0x5d')][_0xc2f2('0x8f')])){throw new db['Sequelize']['ValidationError']('Wrong\x20credentials');}if(_0x1ba19b[_0xc2f2('0x5d')][_0xc2f2('0x8f')]===_0x1ba19b[_0xc2f2('0x5d')][_0xc2f2('0x90')]){throw new db[(_0xc2f2('0x91'))][(_0xc2f2('0x92'))](_0xc2f2('0x93'));}}else if(_0x1ba19b[_0xc2f2('0x31')][_0xc2f2('0x2b')]===_0xc2f2('0x2f')){if(!_0x1ba19b[_0xc2f2('0x5d')]['newPassword']){throw new db[(_0xc2f2('0x91'))][(_0xc2f2('0x92'))](_0xc2f2('0x94'));}}else if(_0x1ba19b['user'][_0xc2f2('0x2b')]===_0xc2f2('0x31')){if(!_0x1ba19b[_0xc2f2('0x5d')]['newPassword']){throw new db[(_0xc2f2('0x91'))][(_0xc2f2('0x92'))](_0xc2f2('0x94'));}if(_0x412def[_0xc2f2('0x2b')]!==_0xc2f2('0x33')){throw new db[(_0xc2f2('0x91'))][(_0xc2f2('0x92'))]('Unauthorized');}}else{throw new db[(_0xc2f2('0x91'))]['ValidationError'](_0xc2f2('0x8a'));}return _0x412def;})[_0xc2f2('0x22')](handleEntityNotFound(_0x4c3efb,null))[_0xc2f2('0x22')](function(_0x5dd8f3){return db['Setting']['findOne']({'attributes':['id',_0xc2f2('0x65'),_0xc2f2('0x95'),_0xc2f2('0x96')]})[_0xc2f2('0x22')](function(_0x5a1fa0){if(_0x5a1fa0['securePassword'])authService[_0xc2f2('0x66')](_0x1ba19b[_0xc2f2('0x5d')][_0xc2f2('0x90')]);if(!_0x5a1fa0[_0xc2f2('0x95')]||!_0x5dd8f3[_0xc2f2('0x42')])return _0x5dd8f3;authService[_0xc2f2('0x97')](_0x1ba19b[_0xc2f2('0x5d')][_0xc2f2('0x90')],_0x5dd8f3[_0xc2f2('0x42')],_0x5a1fa0[_0xc2f2('0x96')]);return _0x5dd8f3;})[_0xc2f2('0x22')](saveUpdates({'password':_0x1ba19b['body'][_0xc2f2('0x90')],'passwordResetAt':_0x1ba19b[_0xc2f2('0x31')]['id']==_0x1ba19b['params']['id']?moment():null,'previousPasswords':authService[_0xc2f2('0x98')](_0x1ba19b[_0xc2f2('0x5d')][_0xc2f2('0x90')],_0x5dd8f3['previousPasswords'])},null));})['then'](respondWithResult(_0x4c3efb,null))[_0xc2f2('0x58')](handleError(_0x4c3efb,null));};exports[_0xc2f2('0x99')]=function(_0x1e9dad,_0x1d64b8){var _0x2edc73=_0x1e9dad[_0xc2f2('0x5d')][_0xc2f2('0x9a')];return db[_0xc2f2('0x3d')][_0xc2f2('0x38')]({'where':{'id':_0x1e9dad['params']['id']},'attributes':['id',_0xc2f2('0x39'),'role','online',_0xc2f2('0x9b'),_0xc2f2('0x9c'),'interface']})[_0xc2f2('0x22')](handleEntityNotFound(_0x1d64b8,null))['then'](function(_0x227173){if(_0x227173){if(!utils[_0xc2f2('0x9d')](_0x2edc73)){throw new db[(_0xc2f2('0x91'))][(_0xc2f2('0x92'))](_0xc2f2('0x9e'));}return _0x227173[_0xc2f2('0x9f')+_[_0xc2f2('0xa0')](_0x2edc73[_0xc2f2('0xa1')]())+'Queues'](_0x1e9dad[_0xc2f2('0x5d')][_0xc2f2('0x61')],{'penalty':_0x1e9dad[_0xc2f2('0x5d')][_0xc2f2('0xa2')]||0x0})[_0xc2f2('0xa3')](function(_0x3f5311){for(var _0xd0b562=0x0;_0xd0b562<_0x1e9dad['body'][_0xc2f2('0x61')][_0xc2f2('0x6d')];_0xd0b562+=0x1){var _0x2f143f={'UserId':Number(_0x1e9dad[_0xc2f2('0x5e')]['id'])};_0x2f143f[_[_0xc2f2('0xa0')](_0x2edc73[_0xc2f2('0xa1')]())+'QueueId']=Number(_0x1e9dad[_0xc2f2('0x5d')][_0xc2f2('0x61')][_0xd0b562]);socket[_0xc2f2('0xa4')]('user'+_['capitalize'](_0x2edc73['toLowerCase']())+_0xc2f2('0xa5'),_0x2f143f);}return _0x3f5311;})[_0xc2f2('0x22')](function(){if(_0x2edc73===_0xc2f2('0xa6')){return db['VoiceQueue'][_0xc2f2('0x8c')]({'where':{'id':_0x1e9dad['body'][_0xc2f2('0x61')]||[]},'raw':!![],'attributes':['id',_0xc2f2('0x39')]});}})['then'](function(_0x29273b){var _0x11b77a=_0x227173[_0xc2f2('0x2e')]({'plain':!![]});var _0x5f0361=[];if(_0x2edc73===_0xc2f2('0xa6')&&_0x11b77a[_0xc2f2('0x2b')]===_0xc2f2('0x33')&&_0x11b77a['online']){for(let _0x97a10a=0x0;_0x97a10a<_0x29273b[_0xc2f2('0x6d')];_0x97a10a+=0x1){_0x5f0361['push']({'membername':_0x11b77a[_0xc2f2('0x39')],'UserId':_0x11b77a['id'],'queue_name':_0x29273b[_0x97a10a]['name'],'VoiceQueueId':_0x29273b[_0x97a10a]['id'],'interface':_['isNil'](_0x11b77a[_0xc2f2('0xa7')])?util['format'](_0xc2f2('0xa8'),_0x11b77a[_0xc2f2('0x39')]):_0x11b77a['interface'],'paused':_0x11b77a['voicePause']||![],'penalty':_0x1e9dad['body'][_0xc2f2('0xa2')]||0x0});}return Promise[_0xc2f2('0x57')](_0x5f0361[_0xc2f2('0x36')](function(_0x34601e){return db[_0xc2f2('0xa9')]['upsert'](_0x34601e);}));}return _0x227173;});}})['then'](respondWithStatusCode(_0x1d64b8,null))[_0xc2f2('0x58')](handleError(_0x1d64b8,null));};exports[_0xc2f2('0xaa')]=function(_0x57b60a,_0x3d3ed3){var _0x11fbdc,_0x2dfaa1;return db[_0xc2f2('0x3d')][_0xc2f2('0x38')]({'where':{'id':_0x57b60a[_0xc2f2('0x5e')]['id']},'attributes':['id','name',_0xc2f2('0x2b')]})[_0xc2f2('0x22')](handleEntityNotFound(_0x3d3ed3,null))[_0xc2f2('0x22')](function(_0x14f327){if(_0x14f327){_0x11fbdc=_0x14f327;if(!_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x9a')]||!utils[_0xc2f2('0x9d')](_0x57b60a[_0xc2f2('0x48')]['channel'])){throw new db[(_0xc2f2('0x91'))][(_0xc2f2('0x92'))](_0xc2f2('0x9e'));}return _0x14f327['remove'+_[_0xc2f2('0xa0')](_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x9a')][_0xc2f2('0xa1')]())+'Queues'](_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x61')]);}})['then'](function(_0x39fb9a){if(_['isArray'](_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x61')])){for(var _0x621de=0x0;_0x621de<_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x61')]['length'];_0x621de+=0x1){_0x2dfaa1={'UserId':Number(_0x57b60a[_0xc2f2('0x5e')]['id'])};_0x2dfaa1[_[_0xc2f2('0xa0')](_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x9a')][_0xc2f2('0xa1')]())+_0xc2f2('0xab')]=Number(_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x61')][_0x621de]);socket[_0xc2f2('0xa4')](_0xc2f2('0x31')+_['capitalize'](_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x9a')][_0xc2f2('0xa1')]())+_0xc2f2('0xac'),_0x2dfaa1);}}else{_0x2dfaa1={'UserId':Number(_0x57b60a['params']['id'])};_0x2dfaa1[_[_0xc2f2('0xa0')](_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x9a')]['toLowerCase']())+_0xc2f2('0xab')]=Number(_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x61')]);socket[_0xc2f2('0xa4')](_0xc2f2('0x31')+_[_0xc2f2('0xa0')](_0x57b60a['query'][_0xc2f2('0x9a')]['toLowerCase']())+_0xc2f2('0xac'),_0x2dfaa1);}return _0x39fb9a;})[_0xc2f2('0x22')](function(){if(_0x57b60a[_0xc2f2('0x48')]['channel']==='voice'){return db[_0xc2f2('0xa9')][_0xc2f2('0x2d')]({'where':{'UserId':_0x57b60a[_0xc2f2('0x5e')]['id'],'VoiceQueueId':_0x57b60a[_0xc2f2('0x48')][_0xc2f2('0x61')]},'individualHooks':!![]})[_0xc2f2('0x22')](function(){return _0x11fbdc;});}return _0x11fbdc;})[_0xc2f2('0x22')](respondWithStatusCode(_0x3d3ed3,null))['catch'](handleError(_0x3d3ed3,null));};exports[_0xc2f2('0xad')]=function(_0x3cc65e,_0x569ed1){_0x3cc65e[_0xc2f2('0x5d')][_0xc2f2('0xae')]=_0x3cc65e[_0xc2f2('0xaf')][_0xc2f2('0xb0')];return db['User'][_0xc2f2('0x38')]({'where':{'id':_0x3cc65e[_0xc2f2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x569ed1,null))['then'](saveUpdates(_0x3cc65e[_0xc2f2('0x5d')],null))[_0xc2f2('0x22')](respondWithResult(_0x569ed1,null))[_0xc2f2('0x58')](handleError(_0x569ed1,null));};exports['getAvatar']=function(_0x240680,_0x4e7de2){var _0x1f8be5=path[_0xc2f2('0xb1')](config['root'],_0xc2f2('0xb2'));return db[_0xc2f2('0x3d')][_0xc2f2('0x38')]({'where':{'id':_0x240680['params']['id']},'attributes':['id',_0xc2f2('0xae')],'raw':!![]})[_0xc2f2('0x22')](handleEntityNotFound(_0x4e7de2,null))[_0xc2f2('0x22')](function(_0xd5e567){if(_0xd5e567){if(_[_0xc2f2('0x68')](_0xd5e567[_0xc2f2('0xae')])){return _0x4e7de2['download'](_0x1f8be5);}else{if(!fs[_0xc2f2('0xb3')](path[_0xc2f2('0xb1')](config[_0xc2f2('0xb4')],'server/files/images/',_0xd5e567['userpic']))){return _0x4e7de2[_0xc2f2('0xb5')](_0x1f8be5);}return _0x4e7de2[_0xc2f2('0xb5')](path[_0xc2f2('0xb1')](config[_0xc2f2('0xb4')],'server/files/images/',_0xd5e567[_0xc2f2('0xae')]));}}})[_0xc2f2('0x58')](handleError(_0x4e7de2,null));};exports['getOpenTabs']=function(_0xbe3acc,_0x4adcd3){return db['User'][_0xc2f2('0x38')]({'where':{'id':_0xbe3acc['params']['id']},'attributes':['id']})[_0xc2f2('0x22')](handleEntityNotFound(_0x4adcd3,null))[_0xc2f2('0x22')](function(_0x10546a){var _0x3544b4=[];values=_0x10546a[_0xc2f2('0x53')];_0x3544b4[_0xc2f2('0x4e')](get_open_tabs(_0xc2f2('0x52'),_0x10546a[_0xc2f2('0x53')]));_0x3544b4['push'](get_open_tabs(_0xc2f2('0x54'),_0x10546a[_0xc2f2('0x53')]));_0x3544b4['push'](get_open_tabs('openchannel',_0x10546a['dataValues']));_0x3544b4['push'](get_open_tabs(_0xc2f2('0xb6'),_0x10546a[_0xc2f2('0x53')]));_0x3544b4[_0xc2f2('0x4e')](get_open_tabs(_0xc2f2('0x55'),_0x10546a['dataValues']));_0x3544b4[_0xc2f2('0x4e')](get_open_tabs('mail',_0x10546a[_0xc2f2('0x53')]));return Promise[_0xc2f2('0x57')](_0x3544b4);})[_0xc2f2('0x22')](function(_0x5b4f60){if(_0x5b4f60){var _0x55e3ee=_['map'](values[_0xc2f2('0xb7')],function(_0x2460c9){return{'channel':_0xc2f2('0xb8'),'id':_0x2460c9['id'],'createdAt':_0x2460c9[_0xc2f2('0xb9')]};});var _0x5d8e7e=_[_0xc2f2('0x36')](values['FaxOpenTabs'],function(_0x286f82){return{'channel':'FAX','id':_0x286f82['id'],'createdAt':_0x286f82[_0xc2f2('0xb9')]};});var _0x2df87e=_['map'](values[_0xc2f2('0xba')],function(_0x23515f){return{'channel':_0xc2f2('0xbb'),'id':_0x23515f['id'],'createdAt':_0x23515f['createdAt']};});var _0x2d9b8d=_[_0xc2f2('0x36')](values[_0xc2f2('0xbc')],function(_0x465eb8){return{'channel':_0xc2f2('0xbd'),'id':_0x465eb8['id'],'createdAt':_0x465eb8['createdAt']};});var _0x8829ca=_['map'](values[_0xc2f2('0xbe')],function(_0x199064){return{'channel':_0xc2f2('0xbf'),'id':_0x199064['id'],'createdAt':_0x199064['createdAt']};});var _0x394300=_[_0xc2f2('0x36')](values[_0xc2f2('0xc0')],function(_0x20f193){return{'channel':_0xc2f2('0xc1'),'id':_0x20f193['id'],'createdAt':_0x20f193[_0xc2f2('0xb9')]};});var _0x542944=_['concat'](_0x55e3ee,_0x5d8e7e,_0x2df87e,_0x2d9b8d,_0x8829ca,_0x394300);var _0x15ab6f={'count':_0x542944[_0xc2f2('0x6d')],'rows':_0x542944};return _0x15ab6f;}else return null;})[_0xc2f2('0x22')](respondWithResult(_0x4adcd3,null))[_0xc2f2('0x58')](handleError(_0x4adcd3,null));};exports[_0xc2f2('0xc2')]=function(_0x169ab6,_0x4ccded){var _0x4f0e38={};return db[_0xc2f2('0x3d')]['findOne']({'where':{'id':_0x169ab6[_0xc2f2('0x5e')]['id']}})[_0xc2f2('0x22')](function(_0x315ff8){if(!_0x315ff8){throw new APINotFoundError(util[_0xc2f2('0xc3')]('User\x20with\x20id\x20%s\x20not\x20found',_0x169ab6[_0xc2f2('0x5e')]['id']));}return contacts[_0xc2f2('0x5f')]();})[_0xc2f2('0x22')](function(_0x5b89f9){_0x169ab6[_0xc2f2('0x48')][_0xc2f2('0x3d')]=_0x169ab6[_0xc2f2('0x5e')]['id'];_0x4f0e38=qs[_0xc2f2('0x47')](_0x5b89f9,_0x169ab6);if(_0x169ab6[_0xc2f2('0x48')][_0xc2f2('0xc4')](_0xc2f2('0x49'))){_0x4f0e38[_0xc2f2('0x4a')]=[{'model':db['CmList'],'as':_0xc2f2('0xc5'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xc2f2('0x39'),_0xc2f2('0xc6')],'where':_0x169ab6['query'][_0xc2f2('0xc7')]?{'id':_0x169ab6[_0xc2f2('0x48')]['tag']}:undefined,'required':_0x169ab6[_0xc2f2('0x48')][_0xc2f2('0xc7')]?!![]:![]}];}return contacts[_0xc2f2('0x8c')](_0x169ab6[_0xc2f2('0x48')],_0x169ab6[_0xc2f2('0x31')],_0x4f0e38,_0x5b89f9);})[_0xc2f2('0x22')](respondWithFilteredResult(_0x4ccded,_0x4f0e38))['catch'](APIHandleError(_0x4ccded));};exports[_0xc2f2('0xc8')]=function(_0x43765c,_0x58f640){var _0x110b98;var _0x7f3f17={};var _0x53ba3b;return db[_0xc2f2('0x3d')][_0xc2f2('0xc9')]({'where':{'id':_0x43765c[_0xc2f2('0x5e')]['id']},'attributes':['id','name',_0xc2f2('0x2b')]})[_0xc2f2('0x22')](handleEntityNotFound(_0x58f640,null))['then'](function(_0x1bb81b){if(!utils['isValidChannel'](_0x43765c[_0xc2f2('0x48')][_0xc2f2('0x9a')])){throw new db[(_0xc2f2('0x91'))][(_0xc2f2('0x92'))](_0xc2f2('0x9e'));}_0x110b98=_0x1bb81b;var _0x3051db={};_0x3051db['model']=_[_0xc2f2('0xca')](db[_[_0xc2f2('0xa0')](_0x43765c[_0xc2f2('0x48')][_0xc2f2('0x9a')])+_0xc2f2('0xcb')]['rawAttributes']);_0x3051db[_0xc2f2('0x48')]=_[_0xc2f2('0xca')](_0x43765c['query']);_0x3051db['filters']=_[_0xc2f2('0xcc')](_0x3051db[_0xc2f2('0xcd')],_0x3051db[_0xc2f2('0x48')]);_0x7f3f17[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x3051db[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x43765c[_0xc2f2('0x48')][_0xc2f2('0xce')]));_0x7f3f17['attributes']=_0x7f3f17[_0xc2f2('0x4d')][_0xc2f2('0x6d')]?_0x7f3f17[_0xc2f2('0x4d')]:_0x3051db[_0xc2f2('0xcd')];_0x7f3f17[_0xc2f2('0xcf')]=qs[_0xc2f2('0xd0')](_0x43765c[_0xc2f2('0x48')]['sort']);_0x7f3f17[_0xc2f2('0xd1')]=qs['filters'](_[_0xc2f2('0xd2')](_0x43765c[_0xc2f2('0x48')],_0x3051db[_0xc2f2('0xd3')]));if(_0x43765c[_0xc2f2('0x48')][_0xc2f2('0x35')]){_0x7f3f17['where']=_[_0xc2f2('0x5a')](_0x7f3f17[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0x7f3f17[_0xc2f2('0x4d')],function(_0xa2fd28){var _0x381019={};_0x381019[_0xa2fd28]={'$like':'%'+_0x43765c[_0xc2f2('0x48')][_0xc2f2('0x35')]+'%'};return _0x381019;})});}_0x7f3f17=_[_0xc2f2('0x5a')]({},_0x7f3f17,_0x43765c[_0xc2f2('0xd4')]);switch(_0x110b98[_0xc2f2('0x2b')]){case _0xc2f2('0x2f'):return db[_[_0xc2f2('0xa0')](_0x43765c[_0xc2f2('0x48')]['channel'])+_0xc2f2('0xcb')][_0xc2f2('0x8c')](_0x7f3f17);case _0xc2f2('0x31'):case _0xc2f2('0x33'):return _0x110b98[_0xc2f2('0x2e')+_['capitalize'](_0x43765c[_0xc2f2('0x48')]['channel'])+_0xc2f2('0xd5')](_0x7f3f17);default:throw new db['Sequelize']['ValidationError'](_0xc2f2('0xd6'));}})[_0xc2f2('0x22')](function(_0x35bb99){_0x53ba3b=_0x35bb99[_0xc2f2('0x6d')];if(!_0x43765c['query'][_0xc2f2('0xc4')](_0xc2f2('0xd7'))){_0x7f3f17['limit']=qs[_0xc2f2('0x1f')](_0x43765c[_0xc2f2('0x48')][_0xc2f2('0x1f')]);_0x7f3f17['offset']=qs[_0xc2f2('0x1e')](_0x43765c[_0xc2f2('0x48')]['offset']);}switch(_0x110b98['role']){case _0xc2f2('0x2f'):return db[_[_0xc2f2('0xa0')](_0x43765c[_0xc2f2('0x48')]['channel'])+_0xc2f2('0xcb')][_0xc2f2('0x8c')](_0x7f3f17);case'user':case _0xc2f2('0x33'):return _0x110b98[_0xc2f2('0x2e')+_['capitalize'](_0x43765c[_0xc2f2('0x48')][_0xc2f2('0x9a')])+_0xc2f2('0xd5')](_0x7f3f17);}})[_0xc2f2('0x22')](function(_0x3f007e){return{'count':_0x53ba3b,'rows':_0x3f007e};})[_0xc2f2('0x22')](respondWithResult(_0x58f640,null))[_0xc2f2('0x58')](handleError(_0x58f640,null));};exports[_0xc2f2('0xd8')]=function(_0x55f2bd,_0x4dcef4){var _0x9177c4={};var _0x25df21={};var _0x1b7b26;var _0x41cf78;return db[_0xc2f2('0x3d')]['findOne']({'where':{'id':_0x55f2bd[_0xc2f2('0x5e')]['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x4dcef4,null))['then'](function(_0x36f96c){if(_0x36f96c){_0x1b7b26=_0x36f96c;_0x25df21[_0xc2f2('0xcd')]=_[_0xc2f2('0xca')](db[_0xc2f2('0xa9')]['rawAttributes']);_0x25df21[_0xc2f2('0x48')]=_[_0xc2f2('0xca')](_0x55f2bd[_0xc2f2('0x48')]);_0x25df21['filters']=_['intersection'](_0x25df21['model'],_0x25df21[_0xc2f2('0x48')]);_0x9177c4[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x25df21[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x55f2bd[_0xc2f2('0x48')]['fields']));_0x9177c4[_0xc2f2('0x4d')]=_0x9177c4['attributes']['length']?_0x9177c4[_0xc2f2('0x4d')]:_0x25df21[_0xc2f2('0xcd')];_0x9177c4[_0xc2f2('0xcf')]=qs['sort'](_0x55f2bd[_0xc2f2('0x48')][_0xc2f2('0xd0')]);_0x9177c4[_0xc2f2('0xd1')]=qs['filters'](_[_0xc2f2('0xd2')](_0x55f2bd[_0xc2f2('0x48')],_0x25df21[_0xc2f2('0xd3')]));if(_0x55f2bd[_0xc2f2('0x48')][_0xc2f2('0x35')]){_0x9177c4[_0xc2f2('0xd1')]=_['merge'](_0x9177c4[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0x9177c4[_0xc2f2('0x4d')],function(_0x4aff6c){var _0x370f72={};_0x370f72[_0x4aff6c]={'$like':'%'+_0x55f2bd[_0xc2f2('0x48')][_0xc2f2('0x35')]+'%'};return _0x370f72;})});}_0x9177c4=_['merge']({},_0x9177c4,_0x55f2bd['options']);return _0x1b7b26[_0xc2f2('0xd8')](_0x9177c4);}})[_0xc2f2('0x22')](function(_0x3deba2){if(_0x3deba2){_0x41cf78=_0x3deba2[_0xc2f2('0x6d')];if(!_0x55f2bd['query'][_0xc2f2('0xc4')](_0xc2f2('0xd7'))){_0x9177c4['limit']=qs[_0xc2f2('0x1f')](_0x55f2bd[_0xc2f2('0x48')][_0xc2f2('0x1f')]);_0x9177c4[_0xc2f2('0x1e')]=qs['offset'](_0x55f2bd[_0xc2f2('0x48')][_0xc2f2('0x1e')]);}return _0x1b7b26['getVoiceQueuesRt'](_0x9177c4);}})[_0xc2f2('0x22')](function(_0x595355){if(_0x595355){return _0x595355?{'count':_0x41cf78,'rows':_0x595355}:null;}})[_0xc2f2('0x22')](respondWithResult(_0x4dcef4,null))[_0xc2f2('0x58')](handleError(_0x4dcef4,null));};exports['getGroups']=function(_0x46cbff,_0x281db5){var _0xd0bd7f={};var _0x41454f={};var _0x285521;var _0x4d54cf;return db[_0xc2f2('0x3d')][_0xc2f2('0xc9')]({'where':{'id':_0x46cbff[_0xc2f2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x281db5,null))[_0xc2f2('0x22')](function(_0x510fe5){if(_0x510fe5){_0x285521=_0x510fe5;_0x41454f[_0xc2f2('0xcd')]=_[_0xc2f2('0xca')](db[_0xc2f2('0xd9')][_0xc2f2('0xda')]);_0x41454f[_0xc2f2('0x48')]=_['keys'](_0x46cbff['query']);_0x41454f[_0xc2f2('0xd3')]=_['intersection'](_0x41454f[_0xc2f2('0xcd')],_0x41454f[_0xc2f2('0x48')]);_0xd0bd7f[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x41454f[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x46cbff['query'][_0xc2f2('0xce')]));_0xd0bd7f['attributes']=_0xd0bd7f['attributes'][_0xc2f2('0x6d')]?_0xd0bd7f['attributes']:_0x41454f['model'];_0xd0bd7f[_0xc2f2('0xcf')]=qs[_0xc2f2('0xd0')](_0x46cbff[_0xc2f2('0x48')]['sort']);_0xd0bd7f['where']=qs[_0xc2f2('0xd3')](_[_0xc2f2('0xd2')](_0x46cbff['query'],_0x41454f[_0xc2f2('0xd3')]));if(_0x46cbff['query']['filter']){_0xd0bd7f['where']=_[_0xc2f2('0x5a')](_0xd0bd7f[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0xd0bd7f['attributes'],function(_0x56ce18){var _0xe08518={};_0xe08518[_0x56ce18]={'$like':'%'+_0x46cbff[_0xc2f2('0x48')][_0xc2f2('0x35')]+'%'};return _0xe08518;})});}_0xd0bd7f=_[_0xc2f2('0x5a')]({},_0xd0bd7f,_0x46cbff['options']);return _0x285521[_0xc2f2('0xdb')](_0xd0bd7f);}})[_0xc2f2('0x22')](function(_0x45ca45){if(_0x45ca45){_0x4d54cf=_0x45ca45[_0xc2f2('0x6d')];if(!_0x46cbff[_0xc2f2('0x48')][_0xc2f2('0xc4')](_0xc2f2('0xd7'))){_0xd0bd7f[_0xc2f2('0x1f')]=qs[_0xc2f2('0x1f')](_0x46cbff[_0xc2f2('0x48')]['limit']);_0xd0bd7f[_0xc2f2('0x1e')]=qs[_0xc2f2('0x1e')](_0x46cbff[_0xc2f2('0x48')][_0xc2f2('0x1e')]);}return _0x285521[_0xc2f2('0xdb')](_0xd0bd7f);}})[_0xc2f2('0x22')](function(_0x3060a2){if(_0x3060a2){return _0x3060a2?{'count':_0x4d54cf,'rows':_0x3060a2}:null;}})[_0xc2f2('0x22')](respondWithResult(_0x281db5,null))['catch'](handleError(_0x281db5,null));};exports[_0xc2f2('0xdc')]=function(_0x461118,_0x226e3d){var _0x25bb0b={'raw':!![],'where':{}};var _0x2c913a={};var _0x506f79={'count':0x0,'rows':[]};return db['User'][_0xc2f2('0xc9')]({'where':{'id':_0x461118[_0xc2f2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x226e3d,null))[_0xc2f2('0x22')](function(_0x1e722b){if(_0x1e722b){_0x2c913a['model']=_[_0xc2f2('0xca')](db['VoiceRecording'][_0xc2f2('0xda')]);_0x2c913a[_0xc2f2('0x48')]=_['keys'](_0x461118[_0xc2f2('0x48')]);_0x2c913a[_0xc2f2('0xd3')]=_[_0xc2f2('0xcc')](_0x2c913a[_0xc2f2('0xcd')],_0x2c913a[_0xc2f2('0x48')]);_0x25bb0b[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x2c913a[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x461118['query'][_0xc2f2('0xce')]));_0x25bb0b[_0xc2f2('0x4d')]=_0x25bb0b[_0xc2f2('0x4d')][_0xc2f2('0x6d')]?_0x25bb0b[_0xc2f2('0x4d')]:_0x2c913a['model'];if(!_0x461118['query'][_0xc2f2('0xc4')](_0xc2f2('0xd7'))){_0x25bb0b[_0xc2f2('0x1f')]=qs['limit'](_0x461118[_0xc2f2('0x48')][_0xc2f2('0x1f')]);_0x25bb0b[_0xc2f2('0x1e')]=qs[_0xc2f2('0x1e')](_0x461118[_0xc2f2('0x48')][_0xc2f2('0x1e')]);}_0x25bb0b[_0xc2f2('0xcf')]=qs['sort'](_0x461118[_0xc2f2('0x48')][_0xc2f2('0xd0')]);_0x25bb0b[_0xc2f2('0xd1')]=qs[_0xc2f2('0xd3')](_[_0xc2f2('0xd2')](_0x461118[_0xc2f2('0x48')],_0x2c913a['filters']));_0x25bb0b['where'][_0xc2f2('0xdd')]=_0x1e722b['id'];if(_0x461118[_0xc2f2('0x48')][_0xc2f2('0x35')]){_0x25bb0b[_0xc2f2('0xd1')]=_[_0xc2f2('0x5a')](_0x25bb0b[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0x25bb0b[_0xc2f2('0x4d')],function(_0x2587e7){var _0x115eef={};_0x115eef[_0x2587e7]={'$like':'%'+_0x461118[_0xc2f2('0x48')]['filter']+'%'};return _0x115eef;})});}_0x25bb0b=_['merge']({},_0x25bb0b,_0x461118[_0xc2f2('0xd4')]);return db[_0xc2f2('0xde')][_0xc2f2('0x1d')]({'where':_0x25bb0b['where']})[_0xc2f2('0x22')](function(_0x43c290){_0x506f79['count']=_0x43c290;if(_0x461118[_0xc2f2('0x48')][_0xc2f2('0x49')]){_0x25bb0b[_0xc2f2('0x4a')]=[{'all':!![]}];}return db[_0xc2f2('0xde')]['findAll'](_0x25bb0b);})[_0xc2f2('0x22')](function(_0x2a8cf6){_0x506f79[_0xc2f2('0x4f')]=_0x2a8cf6;return _0x506f79;});}})[_0xc2f2('0x22')](respondWithFilteredResult(_0x226e3d,_0x25bb0b))[_0xc2f2('0x58')](handleError(_0x226e3d,null));};exports['getScreenRecordings']=function(_0x50d837,_0x2d24c2){var _0x3ee0f8={'raw':!![],'where':{}};var _0x22c99f={};var _0x25f800={'count':0x0,'rows':[]};return db['User'][_0xc2f2('0xc9')]({'where':{'id':_0x50d837[_0xc2f2('0x5e')]['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x2d24c2,null))[_0xc2f2('0x22')](function(_0x42bc6d){if(_0x42bc6d){_0x22c99f['model']=_[_0xc2f2('0xca')](db['ScreenRecording'][_0xc2f2('0xda')]);_0x22c99f['query']=_[_0xc2f2('0xca')](_0x50d837[_0xc2f2('0x48')]);_0x22c99f[_0xc2f2('0xd3')]=_[_0xc2f2('0xcc')](_0x22c99f[_0xc2f2('0xcd')],_0x22c99f[_0xc2f2('0x48')]);_0x3ee0f8[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x22c99f['model'],qs[_0xc2f2('0xce')](_0x50d837[_0xc2f2('0x48')]['fields']));_0x3ee0f8['attributes']=_0x3ee0f8[_0xc2f2('0x4d')][_0xc2f2('0x6d')]?_0x3ee0f8[_0xc2f2('0x4d')]:_0x22c99f[_0xc2f2('0xcd')];if(!_0x50d837[_0xc2f2('0x48')][_0xc2f2('0xc4')]('nolimit')){_0x3ee0f8[_0xc2f2('0x1f')]=qs[_0xc2f2('0x1f')](_0x50d837[_0xc2f2('0x48')]['limit']);_0x3ee0f8['offset']=qs['offset'](_0x50d837[_0xc2f2('0x48')]['offset']);}_0x3ee0f8['order']=qs['sort'](_0x50d837[_0xc2f2('0x48')][_0xc2f2('0xd0')]);_0x3ee0f8[_0xc2f2('0xd1')]=qs[_0xc2f2('0xd3')](_['pick'](_0x50d837[_0xc2f2('0x48')],_0x22c99f[_0xc2f2('0xd3')]));_0x3ee0f8[_0xc2f2('0xd1')][_0xc2f2('0xdd')]=_0x42bc6d['id'];if(_0x50d837[_0xc2f2('0x48')][_0xc2f2('0x35')]){_0x3ee0f8[_0xc2f2('0xd1')]=_['merge'](_0x3ee0f8[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0x3ee0f8['attributes'],function(_0x37c5bf){var _0x50c551={};_0x50c551[_0x37c5bf]={'$like':'%'+_0x50d837['query'][_0xc2f2('0x35')]+'%'};return _0x50c551;})});}_0x3ee0f8=_[_0xc2f2('0x5a')]({},_0x3ee0f8,_0x50d837[_0xc2f2('0xd4')]);return db[_0xc2f2('0xdf')][_0xc2f2('0x1d')]({'where':_0x3ee0f8['where']})[_0xc2f2('0x22')](function(_0x5c9939){_0x25f800[_0xc2f2('0x1d')]=_0x5c9939;if(_0x50d837[_0xc2f2('0x48')][_0xc2f2('0x49')]){_0x3ee0f8[_0xc2f2('0x4a')]=[{'all':!![]}];}return db[_0xc2f2('0xdf')][_0xc2f2('0x8c')](_0x3ee0f8);})[_0xc2f2('0x22')](function(_0x9285d9){_0x25f800[_0xc2f2('0x4f')]=_0x9285d9;return _0x25f800;});}})[_0xc2f2('0x22')](respondWithFilteredResult(_0x2d24c2,_0x3ee0f8))[_0xc2f2('0x58')](handleError(_0x2d24c2,null));};exports[_0xc2f2('0xe0')]=function(_0x25eabc,_0x325e00){var _0x36dd03={};var _0x4b6be1={};var _0x573362;var _0x3e9f74;return db[_0xc2f2('0x3d')]['findOne']({'where':{'id':_0x25eabc['params']['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x325e00,null))[_0xc2f2('0x22')](function(_0x75606f){if(_0x75606f){_0x573362=_0x75606f;_0x4b6be1['model']=_[_0xc2f2('0xca')](db[_0xc2f2('0xe1')][_0xc2f2('0xda')]);_0x4b6be1['query']=_[_0xc2f2('0xca')](_0x25eabc[_0xc2f2('0x48')]);_0x4b6be1[_0xc2f2('0xd3')]=_[_0xc2f2('0xcc')](_0x4b6be1[_0xc2f2('0xcd')],_0x4b6be1[_0xc2f2('0x48')]);_0x36dd03[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x4b6be1[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x25eabc['query'][_0xc2f2('0xce')]));_0x36dd03['attributes']=_0x36dd03[_0xc2f2('0x4d')][_0xc2f2('0x6d')]?_0x36dd03['attributes']:_0x4b6be1[_0xc2f2('0xcd')];_0x36dd03[_0xc2f2('0xcf')]=qs[_0xc2f2('0xd0')](_0x25eabc[_0xc2f2('0x48')][_0xc2f2('0xd0')]);_0x36dd03[_0xc2f2('0xd1')]=qs[_0xc2f2('0xd3')](_[_0xc2f2('0xd2')](_0x25eabc[_0xc2f2('0x48')],_0x4b6be1['filters']));if(_0x25eabc[_0xc2f2('0x48')][_0xc2f2('0x35')]){_0x36dd03[_0xc2f2('0xd1')]=_['merge'](_0x36dd03[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0x36dd03[_0xc2f2('0x4d')],function(_0x39c72c){var _0x21bd1b={};_0x21bd1b[_0x39c72c]={'$like':'%'+_0x25eabc['query'][_0xc2f2('0x35')]+'%'};return _0x21bd1b;})});}_0x36dd03=_['merge']({},_0x36dd03,_0x25eabc[_0xc2f2('0xd4')]);return _0x573362[_0xc2f2('0xe0')](_0x36dd03);}})['then'](function(_0x20c438){if(_0x20c438){_0x3e9f74=_0x20c438[_0xc2f2('0x6d')];if(!_0x25eabc[_0xc2f2('0x48')][_0xc2f2('0xc4')](_0xc2f2('0xd7'))){_0x36dd03[_0xc2f2('0x1f')]=qs[_0xc2f2('0x1f')](_0x25eabc['query'][_0xc2f2('0x1f')]);_0x36dd03[_0xc2f2('0x1e')]=qs[_0xc2f2('0x1e')](_0x25eabc[_0xc2f2('0x48')][_0xc2f2('0x1e')]);}return _0x573362[_0xc2f2('0xe0')](_0x36dd03);}})[_0xc2f2('0x22')](function(_0x4191b8){if(_0x4191b8){return _0x4191b8?{'count':_0x3e9f74,'rows':_0x4191b8}:null;}})['then'](respondWithResult(_0x325e00,null))[_0xc2f2('0x58')](handleError(_0x325e00,null));};exports[_0xc2f2('0xe2')]=function(_0x4605d7,_0x3bb683){var _0x2f0cc2={};var _0x543238={};var _0x1d6c8d;var _0x58df23;return db[_0xc2f2('0x3d')][_0xc2f2('0xc9')]({'where':{'id':_0x4605d7[_0xc2f2('0x5e')]['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x3bb683,null))[_0xc2f2('0x22')](function(_0x557260){if(_0x557260){_0x1d6c8d=_0x557260;_0x543238['model']=_[_0xc2f2('0xca')](db[_0xc2f2('0xe3')][_0xc2f2('0xda')]);_0x543238[_0xc2f2('0x48')]=_['keys'](_0x4605d7[_0xc2f2('0x48')]);_0x543238['filters']=_['intersection'](_0x543238[_0xc2f2('0xcd')],_0x543238['query']);_0x2f0cc2[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x543238[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x4605d7[_0xc2f2('0x48')][_0xc2f2('0xce')]));_0x2f0cc2[_0xc2f2('0x4d')]=_0x2f0cc2['attributes']['length']?_0x2f0cc2[_0xc2f2('0x4d')]:_0x543238[_0xc2f2('0xcd')];_0x2f0cc2[_0xc2f2('0xcf')]=qs[_0xc2f2('0xd0')](_0x4605d7[_0xc2f2('0x48')]['sort']);_0x2f0cc2[_0xc2f2('0xd1')]=qs[_0xc2f2('0xd3')](_[_0xc2f2('0xd2')](_0x4605d7[_0xc2f2('0x48')],_0x543238['filters']));if(_0x4605d7[_0xc2f2('0x48')]['filter']){_0x2f0cc2[_0xc2f2('0xd1')]=_[_0xc2f2('0x5a')](_0x2f0cc2[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0x2f0cc2[_0xc2f2('0x4d')],function(_0x3ee21d){var _0x111e1c={};_0x111e1c[_0x3ee21d]={'$like':'%'+_0x4605d7[_0xc2f2('0x48')][_0xc2f2('0x35')]+'%'};return _0x111e1c;})});}_0x2f0cc2=_[_0xc2f2('0x5a')]({},_0x2f0cc2,_0x4605d7[_0xc2f2('0xd4')]);return _0x1d6c8d['getOpenchannelInteractions'](_0x2f0cc2);}})[_0xc2f2('0x22')](function(_0x5c5e9b){if(_0x5c5e9b){_0x58df23=_0x5c5e9b[_0xc2f2('0x6d')];if(!_0x4605d7[_0xc2f2('0x48')][_0xc2f2('0xc4')]('nolimit')){_0x2f0cc2[_0xc2f2('0x1f')]=qs[_0xc2f2('0x1f')](_0x4605d7[_0xc2f2('0x48')][_0xc2f2('0x1f')]);_0x2f0cc2[_0xc2f2('0x1e')]=qs[_0xc2f2('0x1e')](_0x4605d7[_0xc2f2('0x48')][_0xc2f2('0x1e')]);}return _0x1d6c8d[_0xc2f2('0xe2')](_0x2f0cc2);}})[_0xc2f2('0x22')](function(_0x3c7c36){if(_0x3c7c36){return _0x3c7c36?{'count':_0x58df23,'rows':_0x3c7c36}:null;}})[_0xc2f2('0x22')](respondWithResult(_0x3bb683,null))[_0xc2f2('0x58')](handleError(_0x3bb683,null));};exports[_0xc2f2('0xe4')]=function(_0x34a7f7,_0x2c44b1){var _0x4af392={'raw':!![],'where':{}};var _0x161d6f={};var _0x5307e3={'count':0x0,'rows':[]};return db['User'][_0xc2f2('0xc9')]({'where':{'id':_0x34a7f7[_0xc2f2('0x5e')]['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x2c44b1,null))[_0xc2f2('0x22')](function(_0x7fa9c5){if(_0x7fa9c5){_0x161d6f[_0xc2f2('0xcd')]=_['keys'](db['MailInteraction'][_0xc2f2('0xda')]);_0x161d6f['query']=_[_0xc2f2('0xca')](_0x34a7f7[_0xc2f2('0x48')]);_0x161d6f[_0xc2f2('0xd3')]=_['intersection'](_0x161d6f[_0xc2f2('0xcd')],_0x161d6f[_0xc2f2('0x48')]);_0x4af392[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x161d6f[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x34a7f7[_0xc2f2('0x48')][_0xc2f2('0xce')]));_0x4af392['attributes']=_0x4af392[_0xc2f2('0x4d')]['length']?_0x4af392[_0xc2f2('0x4d')]:_0x161d6f[_0xc2f2('0xcd')];if(!_0x34a7f7['query'][_0xc2f2('0xc4')](_0xc2f2('0xd7'))){_0x4af392[_0xc2f2('0x1f')]=qs['limit'](_0x34a7f7[_0xc2f2('0x48')]['limit']);_0x4af392[_0xc2f2('0x1e')]=qs[_0xc2f2('0x1e')](_0x34a7f7[_0xc2f2('0x48')][_0xc2f2('0x1e')]);}_0x4af392['order']=qs[_0xc2f2('0xd0')](_0x34a7f7['query'][_0xc2f2('0xd0')]);_0x4af392['where']=qs[_0xc2f2('0xd3')](_[_0xc2f2('0xd2')](_0x34a7f7[_0xc2f2('0x48')],_0x161d6f[_0xc2f2('0xd3')]));_0x4af392[_0xc2f2('0xd1')][_0xc2f2('0xdd')]=_0x7fa9c5['id'];if(_0x34a7f7['query'][_0xc2f2('0x35')]){_0x4af392[_0xc2f2('0xd1')]=_['merge'](_0x4af392[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0x4af392[_0xc2f2('0x4d')],function(_0x396ee6){var _0x1b9678={};_0x1b9678[_0x396ee6]={'$like':'%'+_0x34a7f7[_0xc2f2('0x48')][_0xc2f2('0x35')]+'%'};return _0x1b9678;})});}_0x4af392=_[_0xc2f2('0x5a')]({},_0x4af392,_0x34a7f7[_0xc2f2('0xd4')]);return db[_0xc2f2('0xe5')]['count']({'where':_0x4af392[_0xc2f2('0xd1')]})[_0xc2f2('0x22')](function(_0x869df2){_0x5307e3[_0xc2f2('0x1d')]=_0x869df2;if(_0x34a7f7[_0xc2f2('0x48')]['includeAll']){_0x4af392[_0xc2f2('0x4a')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x4af392);})[_0xc2f2('0x22')](function(_0x5859bd){_0x5307e3[_0xc2f2('0x4f')]=_0x5859bd;return _0x5307e3;});}})[_0xc2f2('0x22')](respondWithFilteredResult(_0x2c44b1,_0x4af392))[_0xc2f2('0x58')](handleError(_0x2c44b1,null));};exports[_0xc2f2('0xe6')]=function(_0x58db59,_0x5403e6){var _0x1419c7={};var _0x518b52={};var _0x284b65;var _0x41ac6f;return db[_0xc2f2('0x3d')][_0xc2f2('0xc9')]({'where':{'id':_0x58db59[_0xc2f2('0x5e')]['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x5403e6,null))[_0xc2f2('0x22')](function(_0x2f2f27){if(_0x2f2f27){_0x284b65=_0x2f2f27;_0x518b52['model']=_[_0xc2f2('0xca')](db[_0xc2f2('0xe7')][_0xc2f2('0xda')]);_0x518b52[_0xc2f2('0x48')]=_['keys'](_0x58db59[_0xc2f2('0x48')]);_0x518b52[_0xc2f2('0xd3')]=_[_0xc2f2('0xcc')](_0x518b52[_0xc2f2('0xcd')],_0x518b52[_0xc2f2('0x48')]);_0x1419c7['attributes']=_[_0xc2f2('0xcc')](_0x518b52[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x58db59[_0xc2f2('0x48')][_0xc2f2('0xce')]));_0x1419c7[_0xc2f2('0x4d')]=_0x1419c7[_0xc2f2('0x4d')][_0xc2f2('0x6d')]?_0x1419c7[_0xc2f2('0x4d')]:_0x518b52[_0xc2f2('0xcd')];_0x1419c7[_0xc2f2('0xcf')]=qs[_0xc2f2('0xd0')](_0x58db59[_0xc2f2('0x48')][_0xc2f2('0xd0')]);_0x1419c7[_0xc2f2('0xd1')]=qs[_0xc2f2('0xd3')](_[_0xc2f2('0xd2')](_0x58db59['query'],_0x518b52[_0xc2f2('0xd3')]));if(_0x58db59['query']['filter']){_0x1419c7['where']=_[_0xc2f2('0x5a')](_0x1419c7[_0xc2f2('0xd1')],{'$or':_['map'](_0x1419c7[_0xc2f2('0x4d')],function(_0x59936a){var _0x4ae8ec={};_0x4ae8ec[_0x59936a]={'$like':'%'+_0x58db59['query'][_0xc2f2('0x35')]+'%'};return _0x4ae8ec;})});}_0x1419c7=_[_0xc2f2('0x5a')]({},_0x1419c7,_0x58db59[_0xc2f2('0xd4')]);return _0x284b65['getSmsInteractions'](_0x1419c7);}})[_0xc2f2('0x22')](function(_0x2dcb36){if(_0x2dcb36){_0x41ac6f=_0x2dcb36[_0xc2f2('0x6d')];if(!_0x58db59['query'][_0xc2f2('0xc4')](_0xc2f2('0xd7'))){_0x1419c7[_0xc2f2('0x1f')]=qs[_0xc2f2('0x1f')](_0x58db59[_0xc2f2('0x48')][_0xc2f2('0x1f')]);_0x1419c7[_0xc2f2('0x1e')]=qs['offset'](_0x58db59[_0xc2f2('0x48')]['offset']);}return _0x284b65['getSmsInteractions'](_0x1419c7);}})[_0xc2f2('0x22')](function(_0x1a3ea8){if(_0x1a3ea8){return _0x1a3ea8?{'count':_0x41ac6f,'rows':_0x1a3ea8}:null;}})[_0xc2f2('0x22')](respondWithResult(_0x5403e6,null))[_0xc2f2('0x58')](handleError(_0x5403e6,null));};exports[_0xc2f2('0xe8')]=function(_0xea5db7,_0x2943a7){var _0xc380a2={};var _0x57d464={};var _0x5c40e7;var _0xb44a3a;return db[_0xc2f2('0x3d')][_0xc2f2('0xc9')]({'where':{'id':_0xea5db7[_0xc2f2('0x5e')]['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x2943a7,null))[_0xc2f2('0x22')](function(_0x2e7ca6){if(_0x2e7ca6){_0x5c40e7=_0x2e7ca6;_0x57d464[_0xc2f2('0xcd')]=_[_0xc2f2('0xca')](db['FaxInteraction'][_0xc2f2('0xda')]);_0x57d464['query']=_[_0xc2f2('0xca')](_0xea5db7[_0xc2f2('0x48')]);_0x57d464['filters']=_[_0xc2f2('0xcc')](_0x57d464[_0xc2f2('0xcd')],_0x57d464[_0xc2f2('0x48')]);_0xc380a2[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x57d464[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0xea5db7[_0xc2f2('0x48')][_0xc2f2('0xce')]));_0xc380a2[_0xc2f2('0x4d')]=_0xc380a2[_0xc2f2('0x4d')]['length']?_0xc380a2[_0xc2f2('0x4d')]:_0x57d464[_0xc2f2('0xcd')];_0xc380a2[_0xc2f2('0xcf')]=qs[_0xc2f2('0xd0')](_0xea5db7[_0xc2f2('0x48')][_0xc2f2('0xd0')]);_0xc380a2[_0xc2f2('0xd1')]=qs[_0xc2f2('0xd3')](_['pick'](_0xea5db7[_0xc2f2('0x48')],_0x57d464[_0xc2f2('0xd3')]));if(_0xea5db7[_0xc2f2('0x48')][_0xc2f2('0x35')]){_0xc380a2['where']=_['merge'](_0xc380a2[_0xc2f2('0xd1')],{'$or':_['map'](_0xc380a2[_0xc2f2('0x4d')],function(_0x446b26){var _0x7b38c8={};_0x7b38c8[_0x446b26]={'$like':'%'+_0xea5db7[_0xc2f2('0x48')][_0xc2f2('0x35')]+'%'};return _0x7b38c8;})});}_0xc380a2=_[_0xc2f2('0x5a')]({},_0xc380a2,_0xea5db7['options']);return _0x5c40e7[_0xc2f2('0xe8')](_0xc380a2);}})[_0xc2f2('0x22')](function(_0x406203){if(_0x406203){_0xb44a3a=_0x406203[_0xc2f2('0x6d')];if(!_0xea5db7[_0xc2f2('0x48')]['hasOwnProperty'](_0xc2f2('0xd7'))){_0xc380a2['limit']=qs[_0xc2f2('0x1f')](_0xea5db7[_0xc2f2('0x48')][_0xc2f2('0x1f')]);_0xc380a2[_0xc2f2('0x1e')]=qs[_0xc2f2('0x1e')](_0xea5db7[_0xc2f2('0x48')][_0xc2f2('0x1e')]);}return _0x5c40e7[_0xc2f2('0xe8')](_0xc380a2);}})['then'](function(_0x157ed2){if(_0x157ed2){return _0x157ed2?{'count':_0xb44a3a,'rows':_0x157ed2}:null;}})['then'](respondWithResult(_0x2943a7,null))['catch'](handleError(_0x2943a7,null));};exports[_0xc2f2('0xe9')]=function(_0x309f09,_0x383c9e){var _0x359112={};var _0x5a1b27={};var _0x3439a9;var _0x508589;return db[_0xc2f2('0x3d')][_0xc2f2('0xc9')]({'where':{'id':_0x309f09[_0xc2f2('0x5e')]['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x383c9e,null))[_0xc2f2('0x22')](function(_0x37b0e9){if(_0x37b0e9){_0x3439a9=_0x37b0e9;_0x5a1b27[_0xc2f2('0xcd')]=_[_0xc2f2('0xca')](db[_0xc2f2('0xea')]['rawAttributes']);_0x5a1b27[_0xc2f2('0x48')]=_[_0xc2f2('0xca')](_0x309f09[_0xc2f2('0x48')]);_0x5a1b27['filters']=_[_0xc2f2('0xcc')](_0x5a1b27[_0xc2f2('0xcd')],_0x5a1b27[_0xc2f2('0x48')]);_0x359112['attributes']=_[_0xc2f2('0xcc')](_0x5a1b27[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x309f09[_0xc2f2('0x48')][_0xc2f2('0xce')]));_0x359112[_0xc2f2('0x4d')]=_0x359112['attributes'][_0xc2f2('0x6d')]?_0x359112[_0xc2f2('0x4d')]:_0x5a1b27['model'];_0x359112['order']=qs[_0xc2f2('0xd0')](_0x309f09[_0xc2f2('0x48')]['sort']);_0x359112[_0xc2f2('0xd1')]=qs[_0xc2f2('0xd3')](_[_0xc2f2('0xd2')](_0x309f09[_0xc2f2('0x48')],_0x5a1b27[_0xc2f2('0xd3')]));if(_0x309f09[_0xc2f2('0x48')][_0xc2f2('0x35')]){_0x359112[_0xc2f2('0xd1')]=_[_0xc2f2('0x5a')](_0x359112['where'],{'$or':_[_0xc2f2('0x36')](_0x359112[_0xc2f2('0x4d')],function(_0x9c074d){var _0x1b37e8={};_0x1b37e8[_0x9c074d]={'$like':'%'+_0x309f09['query']['filter']+'%'};return _0x1b37e8;})});}_0x359112=_[_0xc2f2('0x5a')]({},_0x359112,_0x309f09['options']);return _0x3439a9[_0xc2f2('0xe9')](_0x359112);}})[_0xc2f2('0x22')](function(_0xb8aad1){if(_0xb8aad1){_0x508589=_0xb8aad1[_0xc2f2('0x6d')];if(!_0x309f09[_0xc2f2('0x48')][_0xc2f2('0xc4')](_0xc2f2('0xd7'))){_0x359112['limit']=qs['limit'](_0x309f09[_0xc2f2('0x48')]['limit']);_0x359112['offset']=qs[_0xc2f2('0x1e')](_0x309f09['query'][_0xc2f2('0x1e')]);}return _0x3439a9[_0xc2f2('0xe9')](_0x359112);}})[_0xc2f2('0x22')](function(_0x4f6551){if(_0x4f6551){return _0x4f6551?{'count':_0x508589,'rows':_0x4f6551}:null;}})[_0xc2f2('0x22')](respondWithResult(_0x383c9e,null))[_0xc2f2('0x58')](handleError(_0x383c9e,null));};exports['login']=function(_0x58334e,_0x22b106,_0xd788f4){var _0x2de1cc;var _0x3849f8;var _0x41ae3e;var _0x25f3e8=!_[_0xc2f2('0x68')](_0x58334e['params']['id'])?_0x58334e['params']['id']:!_[_0xc2f2('0x68')](_0x58334e[_0xc2f2('0x31')]['id'])?_0x58334e[_0xc2f2('0x31')]['id']:null;return db[_0xc2f2('0x3d')][_0xc2f2('0x38')]({'where':{'id':_0x25f3e8,'role':{'$or':[_0xc2f2('0x2f'),_0xc2f2('0x31'),_0xc2f2('0x33')]}},'attributes':['id',_0xc2f2('0x39'),'phone',_0xc2f2('0xeb'),_0xc2f2('0x2b'),'internal',_0xc2f2('0x9b')]})['then'](function(_0x56bc28){if(_0x56bc28){if(_0x56bc28['role']==='agent'){_0x2de1cc=_0x56bc28;if(_0x58334e[_0xc2f2('0x5d')][_0xc2f2('0xa7')]){_0x41ae3e=util[_0xc2f2('0xc3')](_0xc2f2('0xec'),_0x2de1cc[_0x58334e['body'][_0xc2f2('0xa7')]]);}else if(_0x58334e[_0xc2f2('0x5d')]['intrf']){_0x41ae3e=util[_0xc2f2('0xc3')](_0xc2f2('0xa8'),_0x58334e[_0xc2f2('0x5d')]['intrf']);}else{_0x41ae3e=util['format'](_0xc2f2('0xa8'),_0x2de1cc[_0xc2f2('0x39')]);}socket['to'](util[_0xc2f2('0xc3')](_0xc2f2('0xed'),_0x2de1cc[_0xc2f2('0x39')]))[_0xc2f2('0xa4')](_0xc2f2('0xee'),{'user':{'id':_0x2de1cc['id'],'name':_0x2de1cc['name']},'ip':_0x58334e[_0xc2f2('0xef')][_0xc2f2('0xf0')]||_0x58334e[_0xc2f2('0xf1')][_0xc2f2('0xf2')]||_0x58334e[_0xc2f2('0xf3')][_0xc2f2('0xf2')]||_0x58334e['connection']['socket'][_0xc2f2('0xf2')]});return new Promise(function(_0x25d9b2,_0x194871){db[_0xc2f2('0x6a')][_0xc2f2('0xf4')]()[_0xc2f2('0x22')](_0x275e7e=>{db['UserVoiceQueueRt'][_0xc2f2('0x2d')]({'where':{'membername':_0x2de1cc[_0xc2f2('0x39')]},'individualHooks':!![]},{'transaction':_0x275e7e})[_0xc2f2('0x22')](function(){return _0x275e7e[_0xc2f2('0xf5')]();})[_0xc2f2('0x22')](_0x25d9b2)[_0xc2f2('0x58')](_0x194871);});});}}else{throw new db['Sequelize'][(_0xc2f2('0x92'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xc2f2('0x22')](function(){if(_0x2de1cc){return _0x2de1cc[_0xc2f2('0xf6')]({'raw':!![]});}})[_0xc2f2('0x22')](function(_0x1ed33d){if(_0x2de1cc){if(_0x1ed33d){_0x3849f8=_0x1ed33d;if(_0x3849f8[_0xc2f2('0x6d')]){var _0x174762=_0x3849f8[_0xc2f2('0x36')](function(_0x53882c){return{'membername':_0x2de1cc[_0xc2f2('0x39')],'UserId':_0x2de1cc['id'],'queue_name':_0x53882c['name'],'VoiceQueueId':_0x53882c['id'],'interface':_0x41ae3e,'paused':_0x2de1cc['loginInPause']||![],'penalty':_0x53882c[_0xc2f2('0xf7')]||0x0};});return db[_0xc2f2('0xa9')][_0xc2f2('0x89')](_0x174762);}}}})[_0xc2f2('0x22')](function(){if(_0x2de1cc){return db[_0xc2f2('0xf8')][_0xc2f2('0x8c')]({'where':{'membername':_0x2de1cc['name'],'exitAt':null}});}})['then'](function(_0x4afe9f){if(_0x2de1cc){var _0xce5cb3=[];_0x4afe9f[_0xc2f2('0xf9')](function(_0x36e175){_0xce5cb3['push'](_0x36e175[_0xc2f2('0x5c')]({'exitAt':moment()[_0xc2f2('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xc2f2('0x57')](_0xce5cb3);}})[_0xc2f2('0x22')](function(){if(_0x2de1cc){var _0x1f6dcd=[];var _0x1b7a5f=[];var _0x106a4a=utils['getChannels']();var _0x495b0b={'membername':_0x2de1cc[_0xc2f2('0x39')],'interface':_0x41ae3e,'enterAt':moment()['format'](_0xc2f2('0xfa')),'role':_0x2de1cc['role'],'internal':_0x2de1cc['internal']};_0x106a4a[_0xc2f2('0xf9')](function(_0x563b3f){_0x1f6dcd[_0xc2f2('0x4e')](_['merge']({'channel':_0x563b3f,'type':_0xc2f2('0xfb'),'data1':_0x58334e[_0xc2f2('0x5d')][_0xc2f2('0xfc')],'data2':_0x41ae3e},_0x495b0b));if(_0x2de1cc['loginInPause']){_0x1b7a5f[_0xc2f2('0x4e')](_[_0xc2f2('0x5a')]({'channel':_0x563b3f,'type':_0xc2f2('0xfd'),'data1':_0xc2f2('0xfe')},_0x495b0b));}});return db[_0xc2f2('0xf8')][_0xc2f2('0x89')](_0x1f6dcd[_0xc2f2('0xff')](_0x1b7a5f),{'individualHooks':!![]});}})[_0xc2f2('0x22')](function(){if(_0x2de1cc){return _0x2de1cc[_0xc2f2('0x5c')]({'online':!![],'lastLoginAt':moment()[_0xc2f2('0xc3')](_0xc2f2('0xfa')),'voicePause':_0x2de1cc[_0xc2f2('0x9b')]||![],'mailPause':_0x2de1cc[_0xc2f2('0x9b')]||![],'chatPause':_0x2de1cc[_0xc2f2('0x9b')]||![],'faxPause':_0x2de1cc[_0xc2f2('0x9b')]||![],'smsPause':_0x2de1cc[_0xc2f2('0x9b')]||![],'openchannelPause':_0x2de1cc[_0xc2f2('0x9b')]||![],'whatsappPause':_0x2de1cc[_0xc2f2('0x9b')]||![],'pauseType':_0x2de1cc[_0xc2f2('0x9b')]?_0xc2f2('0xfe'):null,'interface':_0x41ae3e,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xc2f2('0x22')](function(_0x52c258){if(_0x58334e[_0xc2f2('0x100')]){return _0xd788f4();}else{return Promise['resolve'](_0x52c258)[_0xc2f2('0x22')](respondWithResult(_0x22b106,null));}})[_0xc2f2('0x58')](handleError(_0x22b106,null));};exports[_0xc2f2('0x101')]=function(_0x40d6cf,_0x95f885){var _0x452387;return db[_0xc2f2('0x3d')][_0xc2f2('0x38')]({'where':{'id':_0x40d6cf[_0xc2f2('0x5e')]['id'],'role':_0xc2f2('0x33')},'attributes':['id','name',_0xc2f2('0x2b')]})[_0xc2f2('0x22')](handleEntityNotFound(_0x95f885,null))['then'](function(_0x310452){if(_0x310452){_0x452387=_0x310452;return db['UserVoiceQueueRt'][_0xc2f2('0x2d')]({'where':{'membername':_0x452387[_0xc2f2('0x39')]},'individualHooks':!![]});}})[_0xc2f2('0x22')](function(){return db[_0xc2f2('0xf8')][_0xc2f2('0x8c')]({'where':{'membername':_0x452387[_0xc2f2('0x39')],'exitAt':null}});})['then'](function(_0x1b2946){var _0x3f8134=[];_0x1b2946[_0xc2f2('0xf9')](function(_0x3bb912){_0x3f8134[_0xc2f2('0x4e')](_0x3bb912[_0xc2f2('0x5c')]({'exitAt':moment()[_0xc2f2('0xc3')](_0xc2f2('0xfa'))}));});return Promise[_0xc2f2('0x57')](_0x3f8134);})[_0xc2f2('0x22')](function(){return _0x452387['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x95f885,null))[_0xc2f2('0x58')](handleError(_0x95f885,null));};exports['pause']=function(_0x322a91,_0x5ab85){var _0x43d9d1;return db[_0xc2f2('0xa9')][_0xc2f2('0x5c')]({'paused':0x1},{'where':{'UserId':_0x322a91['params']['id']},'individualHooks':!![]})[_0xc2f2('0x22')](function(){return db[_0xc2f2('0x3d')][_0xc2f2('0x38')]({'where':{'id':_0x322a91[_0xc2f2('0x5e')]['id'],'role':_0xc2f2('0x33')},'attributes':['id',_0xc2f2('0x39'),_0xc2f2('0x2b'),_0xc2f2('0x63'),'interface',_0xc2f2('0x102')]});})[_0xc2f2('0x22')](handleEntityNotFound(_0x5ab85,null))['then'](function(_0x2494a1){if(_0x2494a1){_0x43d9d1=_0x2494a1;return respondWithRpcPromise(_0xc2f2('0x103'),'pause',{'id':_0x43d9d1['id'],'name':_0x43d9d1[_0xc2f2('0x39')],'pause':!![]});}})[_0xc2f2('0x22')](function(){if(_0x43d9d1){return db['MemberReport'][_0xc2f2('0x8c')]({'where':{'membername':_0x43d9d1[_0xc2f2('0x39')],'type':_0xc2f2('0xfd'),'exitAt':null}});}})[_0xc2f2('0x22')](function(_0x15d84a){if(_0x15d84a[_0xc2f2('0x6d')]){var _0x2b3f94=moment()[_0xc2f2('0xc3')](_0xc2f2('0xfa'));for(var _0x574ec6=0x0,_0x19f0de=_0x15d84a[_0xc2f2('0x6d')];_0x574ec6<_0x19f0de;_0x574ec6++){_0x15d84a[_0x574ec6]['updateAttributes']({'exitAt':_0x2b3f94});}}})[_0xc2f2('0x22')](function(){var _0x48e39c=[];var _0x561223=utils[_0xc2f2('0x104')]();_0x561223[_0xc2f2('0xf9')](function(_0x576953){_0x48e39c[_0xc2f2('0x4e')]({'channel':_0x576953,'membername':_0x43d9d1[_0xc2f2('0x39')],'interface':_['isNil'](_0x43d9d1[_0xc2f2('0xa7')])?util[_0xc2f2('0xc3')](_0xc2f2('0xa8'),_0x43d9d1[_0xc2f2('0x39')]):_0x43d9d1['interface'],'type':_0xc2f2('0xfd'),'enterAt':moment()[_0xc2f2('0xc3')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x322a91[_0xc2f2('0x5d')][_0xc2f2('0x3f')]||'DEFAULT\x20PAUSE','role':_0x43d9d1[_0xc2f2('0x2b')],'internal':_0x43d9d1[_0xc2f2('0x63')]});});return db[_0xc2f2('0xf8')][_0xc2f2('0x89')](_0x48e39c,{'individualHooks':!![]});})[_0xc2f2('0x22')](function(){return _0x43d9d1[_0xc2f2('0x5c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x322a91['body'][_0xc2f2('0x3f')]||_0xc2f2('0x105'),'lastPauseAt':moment()[_0xc2f2('0xc3')](_0xc2f2('0xfa'))});})[_0xc2f2('0x22')](respondWithResult(_0x5ab85,null))[_0xc2f2('0x58')](handleError(_0x5ab85,null));};exports[_0xc2f2('0x106')]=function(_0x12e9dc,_0x36af39){if(_0x12e9dc[_0xc2f2('0x5d')][_0xc2f2('0x9a')]&&!utils[_0xc2f2('0x9d')](_0x12e9dc['body'][_0xc2f2('0x9a')])){throw new APIBadRequestError(util[_0xc2f2('0xc3')](_0xc2f2('0x107'),_0x12e9dc[_0xc2f2('0x5d')]['channel']));}return db['User'][_0xc2f2('0x38')]({'where':{'id':_0x12e9dc[_0xc2f2('0x5e')]['id']},'attributes':['id','name',_0xc2f2('0x2b'),'internal','interface',_0xc2f2('0x102'),_0xc2f2('0x9c'),_0xc2f2('0x108'),_0xc2f2('0x109'),_0xc2f2('0x10a'),_0xc2f2('0x10b'),_0xc2f2('0x10c'),_0xc2f2('0x10d'),_0xc2f2('0x10e'),_0xc2f2('0x10f')]})[_0xc2f2('0x22')](function(_0x32811c){if(!_0x32811c){throw new APINotFoundError(util[_0xc2f2('0xc3')](_0xc2f2('0x110'),_0x12e9dc['params']['id']));}return _0x32811c['unpause'](_0x12e9dc[_0xc2f2('0x5d')]['channel']);})['then'](respondWithResult(_0x36af39,null))[_0xc2f2('0x58')](APIHandleError(_0x36af39));};exports['getTeams']=function(_0x42f85c,_0x5a01ba){var _0x379f55={};var _0x30cf49={};var _0x283fd8;var _0x5b990c;return db[_0xc2f2('0x3d')][_0xc2f2('0xc9')]({'where':{'id':_0x42f85c['params']['id']}})['then'](handleEntityNotFound(_0x5a01ba,null))[_0xc2f2('0x22')](function(_0x2c9ff4){if(_0x2c9ff4){_0x283fd8=_0x2c9ff4;_0x30cf49[_0xc2f2('0xcd')]=_[_0xc2f2('0xca')](db['Team'][_0xc2f2('0xda')]);_0x30cf49[_0xc2f2('0x48')]=_['keys'](_0x42f85c['query']);_0x30cf49[_0xc2f2('0xd3')]=_[_0xc2f2('0xcc')](_0x30cf49[_0xc2f2('0xcd')],_0x30cf49['query']);_0x379f55[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x30cf49[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x42f85c[_0xc2f2('0x48')][_0xc2f2('0xce')]));_0x379f55[_0xc2f2('0x4d')]=_0x379f55[_0xc2f2('0x4d')][_0xc2f2('0x6d')]?_0x379f55[_0xc2f2('0x4d')]:_0x30cf49['model'];_0x379f55[_0xc2f2('0xcf')]=qs['sort'](_0x42f85c[_0xc2f2('0x48')]['sort']);_0x379f55[_0xc2f2('0xd1')]=qs[_0xc2f2('0xd3')](_[_0xc2f2('0xd2')](_0x42f85c[_0xc2f2('0x48')],_0x30cf49[_0xc2f2('0xd3')]));if(_0x42f85c['query'][_0xc2f2('0x35')]){_0x379f55[_0xc2f2('0xd1')]=_['merge'](_0x379f55[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0x379f55[_0xc2f2('0x4d')],function(_0x67c282){var _0x401747={};_0x401747[_0x67c282]={'$like':'%'+_0x42f85c[_0xc2f2('0x48')][_0xc2f2('0x35')]+'%'};return _0x401747;})});}_0x379f55=_['merge']({},_0x379f55,_0x42f85c[_0xc2f2('0xd4')]);return _0x283fd8[_0xc2f2('0x111')](_0x379f55);}})[_0xc2f2('0x22')](function(_0x5f1da5){if(_0x5f1da5){_0x5b990c=_0x5f1da5[_0xc2f2('0x6d')];if(!_0x42f85c[_0xc2f2('0x48')][_0xc2f2('0xc4')](_0xc2f2('0xd7'))){_0x379f55[_0xc2f2('0x1f')]=qs[_0xc2f2('0x1f')](_0x42f85c[_0xc2f2('0x48')][_0xc2f2('0x1f')]);_0x379f55['offset']=qs[_0xc2f2('0x1e')](_0x42f85c[_0xc2f2('0x48')][_0xc2f2('0x1e')]);}return _0x283fd8[_0xc2f2('0x111')](_0x379f55);}})['then'](function(_0x217aa5){if(_0x217aa5){return _0x217aa5?{'count':_0x5b990c,'rows':_0x217aa5}:null;}})[_0xc2f2('0x22')](respondWithResult(_0x5a01ba,null))[_0xc2f2('0x58')](handleError(_0x5a01ba,null));};exports[_0xc2f2('0x112')]=function(_0x2fd2b9,_0x507a06){var _0x285293=_0x2fd2b9['params']['id'];var _0x1db72b=_0x2fd2b9[_0xc2f2('0x5d')]?_0x2fd2b9['body'][_0xc2f2('0x61')]:null;var _0x32368a=[];return Promise['resolve']()[_0xc2f2('0x22')](function(){if(!_0x1db72b)throw new APIBadRequestError(_0xc2f2('0x113'));})[_0xc2f2('0x22')](function(){return db[_0xc2f2('0x3d')][_0xc2f2('0xc9')]({'where':{'id':_0x285293}});})[_0xc2f2('0x22')](function(_0x1fda48){if(!_0x1fda48)throw new APINotFoundError(util[_0xc2f2('0xc3')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2fd2b9[_0xc2f2('0x5e')]['id']));return db[_0xc2f2('0x6a')][_0xc2f2('0xf4')](function(_0x3ef931){return _0x1fda48['addTeams'](_0x1db72b,{'transaction':_0x3ef931})[_0xc2f2('0x22')](function(){return db[_0xc2f2('0x114')]['findAll']({'where':{'id':{'$in':_0x1db72b}}});})[_0xc2f2('0x22')](function(_0x51c375){var _0xcaec44=_[_0xc2f2('0x36')](_0x51c375,function(_0x1bccf3){return _0x1bccf3[_0xc2f2('0x115')]();});return Promise[_0xc2f2('0x57')](_0xcaec44);})[_0xc2f2('0x22')](function(_0x4dd25c){_0x32368a=_['flattenDeep'](_0x4dd25c);var _0x2a4388=_[_0xc2f2('0x36')](_0x32368a,function(_0x3d9ece){return _0x3d9ece['addAgent'](_0x1fda48['id'],{'transaction':_0x3ef931});});return Promise[_0xc2f2('0x57')](_0x2a4388);})['then'](function(){if(!_0x1fda48['online'])return;var _0x3545c4=_[_0xc2f2('0x35')](_0x32368a,function(_0x52ba4e){return _0x52ba4e[_0xc2f2('0x116')]('channel')==='Voice';});var _0x318b45=_[_0xc2f2('0x36')](_0x3545c4,function(_0xcaa442){return db['UserVoiceQueueRt'][_0xc2f2('0x117')]({'membername':_0x1fda48[_0xc2f2('0x39')],'UserId':_0x1fda48['id'],'queue_name':_0xcaa442[_0xc2f2('0x39')],'VoiceQueueId':_0xcaa442['id'],'interface':_[_0xc2f2('0x68')](_0x1fda48['interface'])?util[_0xc2f2('0xc3')](_0xc2f2('0xa8'),_0x1fda48[_0xc2f2('0x39')]):_0x1fda48[_0xc2f2('0xa7')],'paused':_0x1fda48[_0xc2f2('0x9c')]||![],'penalty':_0x1fda48[_0xc2f2('0xa2')]},{'transaction':_0x3ef931});});return Promise[_0xc2f2('0x57')](_0x318b45);})[_0xc2f2('0x22')](function(){return db[_0xc2f2('0x118')][_0xc2f2('0x8c')]({'where':{'teamId':{'$in':_0x1db72b}}});})['then'](function(_0x56a3fb){var _0x45ec5e=_[_0xc2f2('0x36')](_0x56a3fb,function(_0x595150){return db[_0xc2f2('0x119')][_0xc2f2('0x84')]({'UserId':_0x1fda48['id'],'VoicePrefixId':_0x595150['VoicePrefixId']},{'transaction':_0x3ef931});});return Promise[_0xc2f2('0x57')](_0x45ec5e);});});})[_0xc2f2('0x22')](function(){for(var _0x2db655=0x0;_0x2db655<_0x32368a[_0xc2f2('0x6d')];_0x2db655++){var _0x18f201=_0x32368a[_0x2db655][_0xc2f2('0x116')]('channel');var _0x406107=_0x18f201+'QueueId';socket[_0xc2f2('0xa4')](_0xc2f2('0x31')+_0x18f201+'Queue:save',{'UserId':_0x285293,['queueField']:_0x32368a[_0x2db655]['id']});}})[_0xc2f2('0x22')](respondWithStatusCode(_0x507a06,null))[_0xc2f2('0x58')](APIHandleError(_0x507a06));};exports[_0xc2f2('0x11a')]=function(_0x5222e2,_0x479c51){var _0x15da51=_0x5222e2['params']['id'];var _0xa2775f=null;if(_0x5222e2[_0xc2f2('0x48')]['ids']){_0xa2775f=_[_0xc2f2('0x11b')](_0x5222e2[_0xc2f2('0x48')]['ids'])?_0x5222e2[_0xc2f2('0x48')][_0xc2f2('0x61')]:[_0x5222e2['query']['ids']];}var _0x1256a8=[];return Promise[_0xc2f2('0x11c')]()[_0xc2f2('0x22')](function(){if(!_0xa2775f)throw new APIBadRequestError(_0xc2f2('0x11d'));})[_0xc2f2('0x22')](function(){return db[_0xc2f2('0x3d')][_0xc2f2('0xc9')]({'where':{'id':_0x15da51}});})[_0xc2f2('0x22')](function(_0x32de5a){if(!_0x32de5a)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x5222e2[_0xc2f2('0x5e')]['id']));return db['sequelize']['transaction'](function(_0x15c3d4){return _0x32de5a[_0xc2f2('0x11a')](_0xa2775f,{'transaction':_0x15c3d4})[_0xc2f2('0x22')](function(){return db['Team'][_0xc2f2('0x8c')]({'where':{'id':{'$in':_0xa2775f}}});})[_0xc2f2('0x22')](function(_0x5ce5f3){var _0x2334cf=_['map'](_0x5ce5f3,function(_0x4440af){return _0x4440af[_0xc2f2('0x115')]();});return Promise[_0xc2f2('0x57')](_0x2334cf);})[_0xc2f2('0x22')](function(_0x38dfe0){_0x1256a8=_[_0xc2f2('0x11e')](_0x38dfe0);var _0x3b9ab7=_['map'](_0x1256a8,function(_0x5dad23){return _0x5dad23[_0xc2f2('0x11f')](_0x32de5a['id'],{'transaction':_0x15c3d4});});return Promise[_0xc2f2('0x57')](_0x3b9ab7);})['then'](function(){if(!_0x32de5a[_0xc2f2('0x102')])return;var _0x680547=_[_0xc2f2('0x35')](_0x1256a8,function(_0x192905){return _0x192905[_0xc2f2('0x116')](_0xc2f2('0x9a'))===_0xc2f2('0x120');});var _0x54abf8=_[_0xc2f2('0x36')](_0x680547,function(_0x419c15){return db['UserVoiceQueueRt'][_0xc2f2('0x2d')]({'where':{'VoiceQueueId':_0x419c15['id'],'UserId':_0x32de5a['id']},'transaction':_0x15c3d4});});return Promise[_0xc2f2('0x57')](_0x54abf8);})[_0xc2f2('0x22')](function(){return db[_0xc2f2('0x118')][_0xc2f2('0x8c')]({'where':{'teamId':{'$in':_0xa2775f}}});})[_0xc2f2('0x22')](function(_0x4c78b3){var _0x816807=_[_0xc2f2('0x36')](_0x4c78b3,function(_0x20f248){return db[_0xc2f2('0x119')][_0xc2f2('0x2d')]({'where':{'UserId':_0x32de5a['id'],'VoicePrefixId':_0x20f248[_0xc2f2('0x121')]}},{'transaction':_0x15c3d4});});return Promise[_0xc2f2('0x57')](_0x816807);});});})['then'](function(){for(var _0x5cf9fa=0x0;_0x5cf9fa<_0x1256a8[_0xc2f2('0x6d')];_0x5cf9fa++){var _0x3029cb=_0x1256a8[_0x5cf9fa][_0xc2f2('0x116')](_0xc2f2('0x9a'));var _0x31bf93=_0x3029cb+'QueueId';socket[_0xc2f2('0xa4')]('user'+_0x3029cb+_0xc2f2('0xac'),{'UserId':_0x15da51,['queueField']:_0x1256a8[_0x5cf9fa]['id']});}})[_0xc2f2('0x22')](respondWithStatusCode(_0x479c51,null))[_0xc2f2('0x58')](APIHandleError(_0x479c51));};exports[_0xc2f2('0x122')]=function(_0x3639cf,_0x1ad621){var _0x1c49f5={};var _0x2bfd46={};var _0x3bb79;var _0x11a4ce;return db[_0xc2f2('0x3d')]['findOne']({'where':{'id':_0x3639cf['params']['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x1ad621,null))[_0xc2f2('0x22')](function(_0xd88962){if(_0xd88962){_0x3bb79=_0xd88962;_0x2bfd46[_0xc2f2('0xcd')]=_[_0xc2f2('0xca')](db[_0xc2f2('0x123')][_0xc2f2('0xda')]);_0x2bfd46['query']=_['keys'](_0x3639cf[_0xc2f2('0x48')]);_0x2bfd46[_0xc2f2('0xd3')]=_[_0xc2f2('0xcc')](_0x2bfd46[_0xc2f2('0xcd')],_0x2bfd46[_0xc2f2('0x48')]);_0x1c49f5['attributes']=_[_0xc2f2('0xcc')](_0x2bfd46[_0xc2f2('0xcd')],qs[_0xc2f2('0xce')](_0x3639cf[_0xc2f2('0x48')]['fields']));_0x1c49f5[_0xc2f2('0x4d')]=_0x1c49f5[_0xc2f2('0x4d')]['length']?_0x1c49f5[_0xc2f2('0x4d')]:_0x2bfd46[_0xc2f2('0xcd')];_0x1c49f5[_0xc2f2('0xcf')]=qs[_0xc2f2('0xd0')](_0x3639cf[_0xc2f2('0x48')]['sort']);_0x1c49f5[_0xc2f2('0xd1')]=qs[_0xc2f2('0xd3')](_[_0xc2f2('0xd2')](_0x3639cf[_0xc2f2('0x48')],_0x2bfd46['filters']));if(_0x3639cf[_0xc2f2('0x48')][_0xc2f2('0x35')]){_0x1c49f5[_0xc2f2('0xd1')]=_[_0xc2f2('0x5a')](_0x1c49f5[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0x1c49f5[_0xc2f2('0x4d')],function(_0x4bd465){var _0x3d42d7={};_0x3d42d7[_0x4bd465]={'$like':'%'+_0x3639cf[_0xc2f2('0x48')][_0xc2f2('0x35')]+'%'};return _0x3d42d7;})});}_0x1c49f5=_['merge']({},_0x1c49f5,_0x3639cf[_0xc2f2('0xd4')]);return _0x3bb79[_0xc2f2('0x122')](_0x1c49f5);}})['then'](function(_0x342d72){if(_0x342d72){_0x11a4ce=_0x342d72[_0xc2f2('0x6d')];if(!_0x3639cf[_0xc2f2('0x48')][_0xc2f2('0xc4')]('nolimit')){_0x1c49f5[_0xc2f2('0x1f')]=qs[_0xc2f2('0x1f')](_0x3639cf[_0xc2f2('0x48')][_0xc2f2('0x1f')]);_0x1c49f5[_0xc2f2('0x1e')]=qs[_0xc2f2('0x1e')](_0x3639cf['query'][_0xc2f2('0x1e')]);}return _0x3bb79[_0xc2f2('0x122')](_0x1c49f5);}})[_0xc2f2('0x22')](function(_0x5a6a20){if(_0x5a6a20){return _0x5a6a20?{'count':_0x11a4ce,'rows':_0x5a6a20}:null;}})[_0xc2f2('0x22')](respondWithResult(_0x1ad621,null))[_0xc2f2('0x58')](handleError(_0x1ad621,null));};exports[_0xc2f2('0x124')]=function(_0x590add,_0x1c2a4e){var _0x42caeb={};var _0x4fe917={};var _0x3bbb0d;return db[_0xc2f2('0x3d')]['findOne']({'where':{'id':_0x590add[_0xc2f2('0x5e')]['id']}})[_0xc2f2('0x22')](handleEntityNotFound(_0x1c2a4e,null))[_0xc2f2('0x22')](function(_0x483d19){if(_0x483d19){_0x3bbb0d=_0x483d19;_0x4fe917[_0xc2f2('0xcd')]=_['keys'](db[_0xc2f2('0x3d')][_0xc2f2('0xda')]);_0x4fe917['query']=_[_0xc2f2('0xca')](_0x590add['query']);_0x4fe917['filters']=_[_0xc2f2('0xcc')](_0x4fe917['model'],_0x4fe917[_0xc2f2('0x48')]);_0x42caeb[_0xc2f2('0x4d')]=_[_0xc2f2('0xcc')](_0x4fe917['model'],qs['fields'](_0x590add['query'][_0xc2f2('0xce')]));_0x42caeb['attributes']=_0x42caeb[_0xc2f2('0x4d')][_0xc2f2('0x6d')]?_0x42caeb[_0xc2f2('0x4d')]:_0x4fe917[_0xc2f2('0xcd')];_0x42caeb[_0xc2f2('0xcf')]=qs['sort'](_0x590add[_0xc2f2('0x48')][_0xc2f2('0xd0')]);_0x42caeb[_0xc2f2('0xd1')]=qs[_0xc2f2('0xd3')](_['pick'](_0x590add['query'],_0x4fe917[_0xc2f2('0xd3')]));if(_0x590add[_0xc2f2('0x48')]['filter']){_0x42caeb[_0xc2f2('0xd1')]=_[_0xc2f2('0x5a')](_0x42caeb[_0xc2f2('0xd1')],{'$or':_[_0xc2f2('0x36')](_0x42caeb[_0xc2f2('0x4d')],function(_0x5c1180){var _0x106203={};_0x106203[_0x5c1180]={'$like':'%'+_0x590add[_0xc2f2('0x48')][_0xc2f2('0x35')]+'%'};return _0x106203;})});}_0x42caeb[_0xc2f2('0xcd')]=db['User'];_0x42caeb['as']=_0xc2f2('0x32');_0x42caeb=_[_0xc2f2('0x5a')]({},_0x42caeb,_0x590add[_0xc2f2('0xd4')]);return _0x3bbb0d[_0xc2f2('0xf6')]({'include':[_0x42caeb]});}})[_0xc2f2('0x22')](function(_0x64b4ff){if(_0x64b4ff){var _0xec76ae={},_0x439670=[];for(var _0x1a976e=0x0;_0x1a976e<_0x64b4ff[_0xc2f2('0x6d')];_0x1a976e+=0x1){for(var _0xdc3e45=0x0,_0x5bcad4;_0xdc3e45<_0x64b4ff[_0x1a976e][_0xc2f2('0x32')][_0xc2f2('0x6d')];_0xdc3e45+=0x1){_0x5bcad4=_0x64b4ff[_0x1a976e][_0xc2f2('0x32')][_0xdc3e45][_0xc2f2('0x2e')]({'plain':!![]});_0xec76ae[_0x5bcad4['id']]=_0x5bcad4;}}_0xec76ae=_[_0xc2f2('0x125')](_0xec76ae);for(var _0x3cb50c=qs['offset'](_0x590add[_0xc2f2('0x48')][_0xc2f2('0x1e')]);_0x3cb50c<_0xec76ae[_0xc2f2('0x6d')]&&_0x439670[_0xc2f2('0x6d')]=_0x4c23d0){_0x33c4bd=_0x4c23d0;_0x2f0bde=0xc8;}else{_0x2f0bde=0xce;}_0x245d80[_0x3718('0x11')](_0x2f0bde);return _0x245d80[_0x3718('0x17')](_0x3718('0x18'),_0x4357af+'-'+_0x33c4bd+'/'+_0x4c23d0)['json'](_0x2d632c);}return null;};}function respondWithRpcPromise(_0xdc371a,_0x27c04f,_0x1d4e22,_0x29b698){return new Promise(function(_0x13e8dc,_0x19a92e){var _0x45d434=_0x29b698||amiClient;return _0x45d434[_0x3718('0x19')](_0xdc371a,_0x1d4e22)['then'](function(_0x3e99b7){logger['info'](_0x3718('0x1a'),_0x27c04f,_0x3718('0x1b'));logger[_0x3718('0x1c')](_0x3718('0x1d'),_0x27c04f,_0x3718('0x1b'),JSON[_0x3718('0x1e')](_0x3e99b7));if(_0x3e99b7[_0x3718('0x1f')]){if(_0x3e99b7[_0x3718('0x1f')][_0x3718('0x20')]===0x1f4){logger[_0x3718('0x1f')](_0x3718('0x1a'),_0x27c04f,_0x3e99b7[_0x3718('0x1f')]['message']);return _0x19a92e(_0x3e99b7[_0x3718('0x1f')][_0x3718('0x21')]);}logger['error'](_0x3718('0x1a'),_0x27c04f,_0x3e99b7[_0x3718('0x1f')][_0x3718('0x21')]);return _0x13e8dc(_0x3e99b7[_0x3718('0x1f')][_0x3718('0x21')]);}else{logger['info'](_0x3718('0x1a'),_0x27c04f,_0x3718('0x1b'));_0x13e8dc(_0x3e99b7[_0x3718('0x22')][_0x3718('0x21')]);}})['catch'](function(_0x22de2d){logger[_0x3718('0x1f')](_0x3718('0x1a'),_0x27c04f,_0x22de2d);_0x19a92e(_0x22de2d);});});}function saveUpdates(_0x1dcfc4){return function(_0x25b735){if(_0x25b735){return _0x25b735[_0x3718('0x23')](_0x1dcfc4)[_0x3718('0x24')](function(_0x456d3b){if(_0x456d3b['role']==='agent'){socket[_0x3718('0x25')]('userNotification:recalc:'+_0x456d3b['id'],_0x456d3b);}return _0x456d3b;});}return null;};}function removeEntity(_0x4bbaeb,_0x437c0e){return function(_0x51ed2d){if(_0x51ed2d){return _0x51ed2d[_0x3718('0x26')]({'transaction':_0x437c0e})[_0x3718('0x24')](function(){var _0x5bb654=_0x51ed2d[_0x3718('0x27')]({'plain':!![]});if(_0x5bb654[_0x3718('0x28')]===_0x3718('0x29'))return;var _0x2df6d2=[{'name':'Users','value':_0x3718('0x2a'),'ignore':!![]},{'name':_0x3718('0x2b'),'value':'agent','ignore':![]},{'name':_0x3718('0x2c'),'value':'telephone','ignore':![]}];var _0x337fd5=_(_0x2df6d2)[_0x3718('0x2d')](_0x3718('0x2e'))[_0x3718('0x2f')](_0x3718('0x30'))[_0x3718('0x30')]();if(_[_0x3718('0x31')](_0x337fd5,_0x5bb654[_0x3718('0x28')])){return;}var _0x2c6bd9=_[_0x3718('0x32')](_0x2df6d2,['value',_0x5bb654['role']])['name'];return db['UserProfileResource'][_0x3718('0x26')]({'where':{'type':_0x2c6bd9,'resourceId':_0x5bb654['id']},'transaction':_0x437c0e})[_0x3718('0x24')](function(){return _0x51ed2d;});})[_0x3718('0x24')](function(){_0x4bbaeb[_0x3718('0x11')](0xcc)[_0x3718('0x33')]();});}};}function handleEntityNotFound(_0x4c8f5d){return function(_0x4cdac4){if(!_0x4cdac4){_0x4c8f5d[_0x3718('0x10')](0x194);}return _0x4cdac4;};}function handleError(_0x590fe1,_0xce0de){_0xce0de=_0xce0de||0x1f4;return function(_0x2d14d4){logger[_0x3718('0x1f')](_0x2d14d4[_0x3718('0x34')]);if(_0x2d14d4[_0x3718('0x35')]){delete _0x2d14d4[_0x3718('0x35')];}_0x590fe1[_0x3718('0x11')](_0xce0de)[_0x3718('0x36')](_0x2d14d4);};}function getUserAttributes(){return _(db[_0x3718('0x37')]['rawAttributes'])[_0x3718('0x2f')](function(_0x3a155b){return{'name':_0x3a155b[_0x3718('0x38')],'type':_0x3a155b[_0x3718('0x39')][_0x3718('0x3a')]};})[_0x3718('0x2d')](function(_0xceb0a9){return![_0x3718('0x3b'),_0x3718('0x3c'),_0x3718('0x3d'),_0x3718('0x3e'),'resetPasswordExpires',_0x3718('0x3f')][_0x3718('0x31')](_0xceb0a9[_0x3718('0x35')]);})['value']();}exports[_0x3718('0x40')]=function(_0x3b3f5e,_0x34c587){var _0x2a014c={},_0x3f0172={'count':0x0,'rows':[]};var _0x5b1d64=getUserAttributes();_0x2a014c=qs[_0x3718('0x41')](_0x5b1d64,_0x3b3f5e);var _0x2a26ce={'where':_0x2a014c['where']};return db['User'][_0x3718('0x16')](_0x2a26ce)[_0x3718('0x24')](function(_0x3ea436){_0x3f0172[_0x3718('0x16')]=_0x3ea436;if(_0x3b3f5e['query'][_0x3718('0x42')]){_0x2a014c[_0x3718('0x43')]=[{'all':!![]}];}if(_0x3b3f5e[_0x3718('0x44')][_0x3718('0x45')]===_0x3718('0x46')){_0x2a014c[_0x3718('0x43')]=[{'model':db['UserSetting'],'as':_0x3718('0x45')}];}if(!_[_0x3718('0x31')](_0x2a014c[_0x3718('0x47')],'id')){_0x2a014c['attributes']['push']('id');}return db[_0x3718('0x37')][_0x3718('0x48')](_0x2a014c);})[_0x3718('0x24')](function(_0x43e096){_0x3f0172[_0x3718('0x49')]=_0x43e096;if(_0x3b3f5e[_0x3718('0x44')][_0x3718('0x4a')]==='true'){var _0xe3f862=[];for(var _0x296f0f=0x0;_0x296f0f<_0x3f0172['rows'][_0x3718('0x4b')];_0x296f0f++){_0xe3f862[_0x3718('0x4c')](get_open_tabs('chat',_0x3f0172[_0x3718('0x49')][_0x296f0f][_0x3718('0x4d')]));_0xe3f862[_0x3718('0x4c')](get_open_tabs(_0x3718('0x4e'),_0x3f0172['rows'][_0x296f0f][_0x3718('0x4d')]));_0xe3f862[_0x3718('0x4c')](get_open_tabs(_0x3718('0x4f'),_0x3f0172[_0x3718('0x49')][_0x296f0f]['dataValues']));_0xe3f862[_0x3718('0x4c')](get_open_tabs('mail',_0x3f0172[_0x3718('0x49')][_0x296f0f][_0x3718('0x4d')]));_0xe3f862[_0x3718('0x4c')](get_open_tabs('openchannel',_0x3f0172[_0x3718('0x49')][_0x296f0f][_0x3718('0x4d')]));_0xe3f862[_0x3718('0x4c')](get_open_tabs(_0x3718('0x50'),_0x3f0172['rows'][_0x296f0f][_0x3718('0x4d')]));}return Promise[_0x3718('0x51')](_0xe3f862)[_0x3718('0x24')](function(){return _0x3f0172;});}else{return _0x3f0172;}})[_0x3718('0x24')](respondWithFilteredResult(_0x34c587,_0x2a014c))[_0x3718('0x52')](handleError(_0x34c587,null));};exports[_0x3718('0x53')]=function(_0x218d19,_0x43cfb4){var _0x2f94f6=getUserAttributes();_0x218d19[_0x3718('0x44')]['id']=_0x218d19[_0x3718('0x54')]['id'];var _0x5aca9d=qs[_0x3718('0x41')](_0x2f94f6,_0x218d19);if(_0x218d19[_0x3718('0x44')]['includeAll']){_0x5aca9d[_0x3718('0x43')]=[{'all':!![]}];}if(_0x218d19[_0x3718('0x44')][_0x3718('0x45')]===_0x3718('0x46')){_0x5aca9d[_0x3718('0x43')]=[{'model':db[_0x3718('0x55')],'as':_0x3718('0x45')}];}_0x5aca9d=_['merge']({},_0x5aca9d,_0x218d19['options']);if(!_['includes'](_0x5aca9d[_0x3718('0x47')],'id')){_0x5aca9d[_0x3718('0x47')][_0x3718('0x4c')]('id');}return db['User'][_0x3718('0x32')](_0x5aca9d)[_0x3718('0x24')](handleEntityNotFound(_0x43cfb4,null))[_0x3718('0x24')](function(_0x5740fe){var _0x50f860=[];values=_0x5740fe;if(_0x218d19[_0x3718('0x44')]['openTabs']==='true'){_0x50f860[_0x3718('0x4c')](get_open_tabs(_0x3718('0x56'),_0x5740fe['dataValues']));_0x50f860[_0x3718('0x4c')](get_open_tabs(_0x3718('0x4e'),_0x5740fe[_0x3718('0x4d')]));_0x50f860[_0x3718('0x4c')](get_open_tabs(_0x3718('0x57'),_0x5740fe[_0x3718('0x4d')]));_0x50f860[_0x3718('0x4c')](get_open_tabs(_0x3718('0x50'),_0x5740fe['dataValues']));_0x50f860[_0x3718('0x4c')](get_open_tabs(_0x3718('0x4f'),_0x5740fe[_0x3718('0x4d')]));_0x50f860[_0x3718('0x4c')](get_open_tabs(_0x3718('0x58'),_0x5740fe[_0x3718('0x4d')]));return Promise[_0x3718('0x51')](_0x50f860);}else{return values;}})[_0x3718('0x24')](function(){return values;})['then'](respondWithResult(_0x43cfb4,null))[_0x3718('0x52')](handleError(_0x43cfb4,null));};exports[_0x3718('0x23')]=function(_0x20eb9d,_0x344806){if(_0x20eb9d[_0x3718('0x59')]['id']){delete _0x20eb9d['body']['id'];}delete _0x20eb9d[_0x3718('0x59')][_0x3718('0x28')];return db[_0x3718('0x37')][_0x3718('0x32')]({'where':{'id':_0x20eb9d[_0x3718('0x54')]['id']}})['then'](handleEntityNotFound(_0x344806,null))[_0x3718('0x24')](saveUpdates(_0x20eb9d[_0x3718('0x59')],null))['then'](respondWithResult(_0x344806,null))[_0x3718('0x52')](handleError(_0x344806,null));};exports[_0x3718('0x5a')]=function(_0x2d1026,_0xdc1aeb){return db[_0x3718('0x37')][_0x3718('0x5a')]()['then'](respondWithResult(_0xdc1aeb,null))['catch'](handleError(_0xdc1aeb,null));};exports['addContacts']=function(_0x4ef0f3,_0x54e11c){return db['User'][_0x3718('0x32')]({'where':{'id':_0x4ef0f3['params']['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x54e11c,null))[_0x3718('0x24')](function(_0xb0d9d6){if(_0xb0d9d6){return _0xb0d9d6[_0x3718('0x5b')](_0x4ef0f3[_0x3718('0x59')][_0x3718('0x5c')],_['omit'](_0x4ef0f3[_0x3718('0x59')],['ids','id'])||{});}})[_0x3718('0x24')](respondWithResult(_0x54e11c,null))[_0x3718('0x52')](handleError(_0x54e11c,null));};function validateUser(_0x5eec28){return new Promise(function(_0x3e477e,_0x36824e){if(_0x5eec28[_0x3718('0x5d')])return _0x3e477e(_0x5eec28);return db[_0x3718('0x5e')]['findById'](0x1)[_0x3718('0x24')](function(_0x36eafb){if(_0x36eafb[_0x3718('0x5f')])authService['validatePasswordPattern'](_0x5eec28[_0x3718('0x3b')]);db[_0x3718('0x37')]['max'](_0x3718('0x5d'))[_0x3718('0x24')](function(_0x15f852){if(_[_0x3718('0x60')](_0x15f852)){_0x5eec28[_0x3718('0x5d')]=_0x36eafb[_0x3718('0x61')]||0x1;return;}if(_['isNil'](_0x36eafb[_0x3718('0x61')])||_0x36eafb[_0x3718('0x61')]===_0x15f852){_0x5eec28['internal']=_0x15f852+0x1;return;}if(_0x36eafb['min_internal']>_0x15f852){_0x5eec28[_0x3718('0x5d')]=_0x36eafb[_0x3718('0x61')];return;}return db[_0x3718('0x62')][_0x3718('0x44')]('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[_0x3718('0x62')]['QueryTypes'][_0x3718('0x63')]})[_0x3718('0x24')](function(_0x10d885){if(_0x10d885&&_0x10d885[_0x3718('0x4b')]){for(var _0x3bdbfd=0x0,_0x3ad9b6=_0x10d885[_0x3718('0x4b')];_0x3bdbfd<_0x3ad9b6&&_[_0x3718('0x60')](_0x5eec28['internal']);_0x3bdbfd++){if(_0x36eafb['min_internal']<=_0x10d885[_0x3bdbfd][_0x3718('0x64')]){_0x5eec28[_0x3718('0x5d')]=_0x10d885[_0x3bdbfd][_0x3718('0x64')];}else if(_0x36eafb[_0x3718('0x61')]>_0x10d885[_0x3bdbfd][_0x3718('0x64')]&&_0x36eafb[_0x3718('0x61')]<=_0x10d885[_0x3bdbfd]['to']){_0x5eec28[_0x3718('0x5d')]=_0x36eafb['min_internal'];}}}if(_[_0x3718('0x60')](_0x5eec28['internal'])){_0x5eec28[_0x3718('0x5d')]=_0x15f852+0x1;}return _0x3e477e(_0x5eec28);});});})[_0x3718('0x52')](function(_0x1a4025){_0x36824e(_0x1a4025);});});}function updateUser(_0x2ed77b){return new Promise(function(_0x6197f,_0xe11248){try{if(_0x2ed77b[_0x3718('0x65')]){_0x2ed77b[_0x3718('0x66')]=_0x2ed77b[_0x3718('0x5d')];_0x2ed77b[_0x3718('0x67')]={'mailbox':_0x2ed77b[_0x3718('0x5d')],'password':_0x2ed77b[_0x3718('0x3b')],'fullname':_0x2ed77b[_0x3718('0x68')],'email':_0x2ed77b[_0x3718('0x69')]};}if(_0x2ed77b[_0x3718('0x28')]===_0x3718('0x6a')){if(!_0x2ed77b[_0x3718('0x6b')])_0x2ed77b['permissions']=[_0x3718('0x6c'),_0x3718('0x6d'),_0x3718('0x6e'),_0x3718('0x6f'),_0x3718('0x70'),_0x3718('0x71'),_0x3718('0x72'),'106',_0x3718('0x73'),_0x3718('0x74'),_0x3718('0x75'),_0x3718('0x76'),_0x3718('0x77'),'114',_0x3718('0x78')];}_0x6197f(_0x2ed77b);}catch(_0x1399dd){_0xe11248(_0x1399dd);}});}exports[_0x3718('0x79')]=function(_0x1bb2ea,_0x445b3d){if(_0x1bb2ea[_0x3718('0x2a')][_0x3718('0x28')]==='agent')throw new Error(_0x3718('0x7a'));if(_0x1bb2ea[_0x3718('0x59')][_0x3718('0x28')]==='user'&&_0x1bb2ea[_0x3718('0x2a')]['role']!==_0x3718('0x29')){throw new Error(_0x3718('0x7b'));}if(_0x1bb2ea[_0x3718('0x59')][_0x3718('0x28')]===_0x3718('0x29')&&_0x1bb2ea[_0x3718('0x2a')][_0x3718('0x28')]!==_0x3718('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x1bb2ea[_0x3718('0x59')]])[_0x3718('0x24')](function(){return validateUser(_0x1bb2ea[_0x3718('0x59')]);})[_0x3718('0x24')](function(_0x3c88e7){return updateUser(_0x3c88e7)['then'](function(_0x3689ef){if(_0x3689ef[_0x3718('0x28')]===_0x3718('0x29')){_0x3689ef[_0x3718('0x7c')]=_0x1bb2ea[_0x3718('0x2a')][_0x3718('0x7c')];delete _0x3689ef[_0x3718('0x7d')];}return _0x3689ef;});})['then'](function(_0x1cb877){return db[_0x3718('0x37')][_0x3718('0x79')](_0x1cb877,{'include':[{'model':db[_0x3718('0x67')],'as':_0x3718('0x67')}]});})[_0x3718('0x24')](function(_0x59cff4){if(_0x1bb2ea[_0x3718('0x59')][_0x3718('0x28')]===_0x3718('0x2a'))return _0x59cff4;if(_0x1bb2ea[_0x3718('0x2a')]['role']!==_0x3718('0x2a'))return _0x59cff4;return db['UserProfileSection'][_0x3718('0x32')]({'where':{'name':_0x59cff4[_0x3718('0x28')]===_0x3718('0x6a')?_0x3718('0x2b'):_0x3718('0x2c'),'userProfileId':_0x1bb2ea[_0x3718('0x2a')][_0x3718('0x7d')]},'raw':!![]})[_0x3718('0x24')](function(_0x3fa1a5){if(!_0x3fa1a5||_0x3fa1a5[_0x3718('0x7e')]!=0x0)return _0x59cff4;return db[_0x3718('0x7f')][_0x3718('0x79')]({'name':_0x59cff4[_0x3718('0x35')],'resourceId':_0x59cff4['id'],'type':_0x3fa1a5[_0x3718('0x35')],'sectionId':_0x3fa1a5['id']},{})[_0x3718('0x24')](function(){return _0x59cff4;});})[_0x3718('0x52')](function(_0x2dd726){logger[_0x3718('0x1f')](_0x3718('0x80'),_0x2dd726);throw _0x2dd726;});})[_0x3718('0x24')](respondWithResult(_0x445b3d,0xc9))['catch'](handleError(_0x445b3d,null));};exports[_0x3718('0x81')]=function(_0x101a71,_0x50c3c6){var _0x4a68b6=_0x101a71['body'];var _0xb5b0dd=[];if(_0x101a71[_0x3718('0x2a')][_0x3718('0x28')]===_0x3718('0x6a'))throw new Error(_0x3718('0x7a'));if(_[_0x3718('0x82')](_0x4a68b6,[_0x3718('0x28'),_0x3718('0x2a')])&&_0x101a71[_0x3718('0x2a')][_0x3718('0x28')]!==_0x3718('0x29')){throw new Error(_0x3718('0x7b'));}if(_[_0x3718('0x82')](_0x4a68b6,[_0x3718('0x28'),_0x3718('0x29')])&&_0x101a71[_0x3718('0x2a')]['role']!=='admin'){throw new Error(_0x3718('0x83'));}return licenseUtil[_0x3718('0x84')](_0x4a68b6)['then'](function(){return validateUser(_0x4a68b6[0x0]);})[_0x3718('0x24')](function(){for(var _0x474cd3=0x1;_0x474cd3<_0x4a68b6[_0x3718('0x4b')];_0x474cd3++){var _0x1c2d6c=_0x4a68b6[_0x474cd3-0x1][_0x3718('0x5d')];if(!_0x4a68b6[_0x474cd3][_0x3718('0x5d')])_0x4a68b6[_0x474cd3]['internal']=_0x1c2d6c+0x1;_0xb5b0dd[_0x3718('0x4c')](validateUser(_0x4a68b6[_0x474cd3]));}return Promise[_0x3718('0x51')](_0xb5b0dd);})[_0x3718('0x24')](function(){_0xb5b0dd=[];for(var _0x26a3d5=0x0;_0x26a3d5<_0x4a68b6[_0x3718('0x4b')];_0x26a3d5++){_0xb5b0dd[_0x3718('0x4c')](updateUser(_0x4a68b6[_0x26a3d5]));}return Promise[_0x3718('0x51')](_0xb5b0dd);})[_0x3718('0x24')](function(){_0xb5b0dd=_0x4a68b6['map'](function(_0x205064){return db['User']['create'](_0x205064,{'include':[{'model':db[_0x3718('0x67')],'as':_0x3718('0x67')}]})['then'](function(_0xb38fe7){_0x205064['id']=_0xb38fe7['id'];return _0x205064;});});return Promise[_0x3718('0x51')](_0xb5b0dd);})[_0x3718('0x24')](function(_0xc73b48){if(_0x101a71[_0x3718('0x59')][_0x3718('0x28')]===_0x3718('0x2a'))return _0xc73b48;if(_0x101a71[_0x3718('0x2a')][_0x3718('0x28')]!==_0x3718('0x2a'))return _0xc73b48;var _0x14b70b=_[_0x3718('0x82')](_0xc73b48,function(_0x8d8e9f){return _0x8d8e9f['role']===_0x3718('0x6a')||_0x8d8e9f[_0x3718('0x28')]===_0x3718('0x85');});if(!_0x14b70b)return _0xc73b48;return db[_0x3718('0x86')][_0x3718('0x48')]({'where':{'name':{'$or':[_0x3718('0x2b'),_0x3718('0x2c')]},'userProfileId':_0x101a71[_0x3718('0x2a')]['userProfileId']},'raw':!![]})[_0x3718('0x24')](function(_0x1a93e5){if(_[_0x3718('0x87')](_0x1a93e5)||!_[_0x3718('0x82')](_0x1a93e5,[_0x3718('0x7e'),0x0]))return _0xc73b48;_0xb5b0dd=[];var _0x76a23=_(_0x1a93e5)[_0x3718('0x2f')](function(_0x4a2997){if(_0x4a2997[_0x3718('0x7e')]===0x1)return;return _0x4a2997[_0x3718('0x35')]===_0x3718('0x2b')?_0x3718('0x6a'):_0x3718('0x85');})[_0x3718('0x88')]()[_0x3718('0x30')]();for(var _0x141e5=0x0;_0x141e5<_0xc73b48['length'];_0x141e5++){if(!_['includes'](_0x76a23,_0xc73b48[_0x141e5]['role']))return;var _0x19f042=_0xc73b48[_0x141e5]['role']===_0x3718('0x6a')?_0x3718('0x2b'):'Telephones';_0xb5b0dd[_0x3718('0x4c')](db[_0x3718('0x7f')]['create']({'name':_0xc73b48[_0x141e5][_0x3718('0x35')],'resourceId':_0xc73b48[_0x141e5]['id'],'type':_0x19f042,'sectionId':_['find'](_0x1a93e5,['name',_0x19f042])['id']},{}));}return Promise[_0x3718('0x51')](_0xb5b0dd);});})[_0x3718('0x24')](respondWithResult(_0x50c3c6,0xc9))[_0x3718('0x52')](handleError(_0x50c3c6,null));};exports['changePassword']=function(_0x295907,_0x210041){if(_0x295907['body']['id']){delete _0x295907[_0x3718('0x59')]['id'];}return db[_0x3718('0x37')][_0x3718('0x32')]({'where':{'id':_0x295907[_0x3718('0x54')]['id']}})['then'](function(_0x18e2dd){if(!_0x18e2dd)return null;if(_0x18e2dd['id']===_0x295907[_0x3718('0x2a')]['id']){if(!_0x295907[_0x3718('0x59')][_0x3718('0x89')]||!_0x295907['body']['newPassword']){throw new db['Sequelize'][(_0x3718('0x8a'))](_0x3718('0x8b'));}if(!_0x18e2dd[_0x3718('0x8c')](_0x295907[_0x3718('0x59')]['oldPassword'])){throw new db[(_0x3718('0x8d'))]['ValidationError'](_0x3718('0x8e'));}if(_0x295907[_0x3718('0x59')][_0x3718('0x89')]===_0x295907[_0x3718('0x59')][_0x3718('0x8f')]){throw new db[(_0x3718('0x8d'))][(_0x3718('0x8a'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x295907['user'][_0x3718('0x28')]===_0x3718('0x29')){if(!_0x295907[_0x3718('0x59')][_0x3718('0x8f')]){throw new db[(_0x3718('0x8d'))][(_0x3718('0x8a'))](_0x3718('0x90'));}}else if(_0x295907[_0x3718('0x2a')][_0x3718('0x28')]===_0x3718('0x2a')){if(!_0x295907['body']['newPassword']){throw new db[(_0x3718('0x8d'))][(_0x3718('0x8a'))](_0x3718('0x90'));}if(_0x18e2dd[_0x3718('0x28')]!==_0x3718('0x6a')){throw new db[(_0x3718('0x8d'))][(_0x3718('0x8a'))](_0x3718('0x7a'));}}else{throw new db['Sequelize'][(_0x3718('0x8a'))](_0x3718('0x7a'));}return _0x18e2dd;})[_0x3718('0x24')](handleEntityNotFound(_0x210041,null))[_0x3718('0x24')](function(_0x1b6087){return db[_0x3718('0x5e')][_0x3718('0x91')]({'attributes':['id',_0x3718('0x5f'),_0x3718('0x92'),_0x3718('0x93')]})['then'](function(_0x4ef952){if(_0x4ef952[_0x3718('0x5f')])authService[_0x3718('0x94')](_0x295907[_0x3718('0x59')][_0x3718('0x8f')]);if(!_0x4ef952[_0x3718('0x92')]||!_0x1b6087['previousPasswords'])return _0x1b6087;authService[_0x3718('0x95')](_0x295907[_0x3718('0x59')]['newPassword'],_0x1b6087[_0x3718('0x3d')],_0x4ef952[_0x3718('0x93')]);return _0x1b6087;})[_0x3718('0x24')](saveUpdates({'password':_0x295907[_0x3718('0x59')][_0x3718('0x8f')],'passwordResetAt':_0x295907[_0x3718('0x2a')]['id']==_0x295907[_0x3718('0x54')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x295907[_0x3718('0x59')][_0x3718('0x8f')],_0x1b6087[_0x3718('0x3d')])},null));})[_0x3718('0x24')](respondWithResult(_0x210041,null))[_0x3718('0x52')](handleError(_0x210041,null));};exports[_0x3718('0x96')]=function(_0x5f0f86,_0x526628){var _0x2d7c1c=_0x5f0f86[_0x3718('0x59')][_0x3718('0x97')];return db[_0x3718('0x37')]['find']({'where':{'id':_0x5f0f86['params']['id']},'attributes':['id','name',_0x3718('0x28'),_0x3718('0x98'),_0x3718('0x99'),_0x3718('0x9a'),'interface']})[_0x3718('0x24')](handleEntityNotFound(_0x526628,null))[_0x3718('0x24')](function(_0xf1a665){if(_0xf1a665){if(!utils[_0x3718('0x9b')](_0x2d7c1c)){throw new db[(_0x3718('0x8d'))][(_0x3718('0x8a'))]('Unknown\x20channel');}return _0xf1a665[_0x3718('0x9c')+_[_0x3718('0x9d')](_0x2d7c1c[_0x3718('0x9e')]())+_0x3718('0x9f')](_0x5f0f86[_0x3718('0x59')][_0x3718('0x5c')],{'penalty':_0x5f0f86[_0x3718('0x59')][_0x3718('0xa0')]||0x0})[_0x3718('0xa1')](function(_0x52247b){for(var _0x381e55=0x0;_0x381e55<_0x5f0f86['body'][_0x3718('0x5c')][_0x3718('0x4b')];_0x381e55+=0x1){var _0x17e875={'UserId':Number(_0x5f0f86['params']['id'])};_0x17e875[_[_0x3718('0x9d')](_0x2d7c1c[_0x3718('0x9e')]())+_0x3718('0xa2')]=Number(_0x5f0f86[_0x3718('0x59')][_0x3718('0x5c')][_0x381e55]);socket[_0x3718('0x25')](_0x3718('0x2a')+_[_0x3718('0x9d')](_0x2d7c1c['toLowerCase']())+_0x3718('0xa3'),_0x17e875);}return _0x52247b;})[_0x3718('0x24')](function(){if(_0x2d7c1c===_0x3718('0xa4')){return db['VoiceQueue'][_0x3718('0x48')]({'where':{'id':_0x5f0f86[_0x3718('0x59')][_0x3718('0x5c')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x3718('0x24')](function(_0x5ce31a){var _0x41d488=_0xf1a665[_0x3718('0x27')]({'plain':!![]});var _0x49f4bc=[];if(_0x2d7c1c===_0x3718('0xa4')&&_0x41d488[_0x3718('0x28')]===_0x3718('0x6a')&&_0x41d488[_0x3718('0x98')]){for(let _0x54581f=0x0;_0x54581f<_0x5ce31a['length'];_0x54581f+=0x1){_0x49f4bc[_0x3718('0x4c')]({'membername':_0x41d488['name'],'UserId':_0x41d488['id'],'queue_name':_0x5ce31a[_0x54581f]['name'],'VoiceQueueId':_0x5ce31a[_0x54581f]['id'],'interface':_[_0x3718('0x60')](_0x41d488[_0x3718('0xa5')])?util[_0x3718('0xa6')]('SIP/%s',_0x41d488[_0x3718('0x35')]):_0x41d488[_0x3718('0xa5')],'paused':_0x41d488[_0x3718('0x9a')]||![],'penalty':_0x5f0f86[_0x3718('0x59')][_0x3718('0xa0')]||0x0});}return Promise[_0x3718('0x51')](_0x49f4bc[_0x3718('0x2f')](function(_0x26f40d){return db[_0x3718('0xa7')][_0x3718('0xa8')](_0x26f40d);}));}return _0xf1a665;});}})[_0x3718('0x24')](respondWithStatusCode(_0x526628,null))[_0x3718('0x52')](handleError(_0x526628,null));};exports[_0x3718('0xa9')]=function(_0x48942a,_0x1f09f8){var _0x5ee4c8,_0xca5340;return db[_0x3718('0x37')][_0x3718('0x32')]({'where':{'id':_0x48942a[_0x3718('0x54')]['id']},'attributes':['id',_0x3718('0x35'),'role']})[_0x3718('0x24')](handleEntityNotFound(_0x1f09f8,null))[_0x3718('0x24')](function(_0x5db040){if(_0x5db040){_0x5ee4c8=_0x5db040;if(!_0x48942a[_0x3718('0x44')][_0x3718('0x97')]||!utils[_0x3718('0x9b')](_0x48942a[_0x3718('0x44')][_0x3718('0x97')])){throw new db[(_0x3718('0x8d'))][(_0x3718('0x8a'))](_0x3718('0xaa'));}return _0x5db040[_0x3718('0xab')+_['capitalize'](_0x48942a[_0x3718('0x44')]['channel'][_0x3718('0x9e')]())+_0x3718('0x9f')](_0x48942a[_0x3718('0x44')][_0x3718('0x5c')]);}})[_0x3718('0x24')](function(_0x205e7c){if(_['isArray'](_0x48942a[_0x3718('0x44')][_0x3718('0x5c')])){for(var _0x30f629=0x0;_0x30f629<_0x48942a[_0x3718('0x44')][_0x3718('0x5c')][_0x3718('0x4b')];_0x30f629+=0x1){_0xca5340={'UserId':Number(_0x48942a['params']['id'])};_0xca5340[_[_0x3718('0x9d')](_0x48942a['query'][_0x3718('0x97')]['toLowerCase']())+_0x3718('0xa2')]=Number(_0x48942a[_0x3718('0x44')]['ids'][_0x30f629]);socket[_0x3718('0x25')]('user'+_['capitalize'](_0x48942a[_0x3718('0x44')]['channel'][_0x3718('0x9e')]())+_0x3718('0xac'),_0xca5340);}}else{_0xca5340={'UserId':Number(_0x48942a['params']['id'])};_0xca5340[_[_0x3718('0x9d')](_0x48942a['query'][_0x3718('0x97')][_0x3718('0x9e')]())+_0x3718('0xa2')]=Number(_0x48942a['query'][_0x3718('0x5c')]);socket[_0x3718('0x25')]('user'+_['capitalize'](_0x48942a[_0x3718('0x44')][_0x3718('0x97')][_0x3718('0x9e')]())+_0x3718('0xac'),_0xca5340);}return _0x205e7c;})['then'](function(){if(_0x48942a[_0x3718('0x44')][_0x3718('0x97')]===_0x3718('0xa4')){return db[_0x3718('0xa7')][_0x3718('0x26')]({'where':{'UserId':_0x48942a[_0x3718('0x54')]['id'],'VoiceQueueId':_0x48942a[_0x3718('0x44')][_0x3718('0x5c')]},'individualHooks':!![]})[_0x3718('0x24')](function(){return _0x5ee4c8;});}return _0x5ee4c8;})['then'](respondWithStatusCode(_0x1f09f8,null))[_0x3718('0x52')](handleError(_0x1f09f8,null));};exports[_0x3718('0xad')]=function(_0x4a3ede,_0xfd80d4){_0x4a3ede[_0x3718('0x59')][_0x3718('0xae')]=_0x4a3ede['file'][_0x3718('0xaf')];return db[_0x3718('0x37')][_0x3718('0x32')]({'where':{'id':_0x4a3ede[_0x3718('0x54')]['id']}})['then'](handleEntityNotFound(_0xfd80d4,null))[_0x3718('0x24')](saveUpdates(_0x4a3ede[_0x3718('0x59')],null))['then'](respondWithResult(_0xfd80d4,null))[_0x3718('0x52')](handleError(_0xfd80d4,null));};exports[_0x3718('0xb0')]=function(_0xcd5714,_0xa59e1b){var _0x41ca79=path['join'](config[_0x3718('0xb1')],_0x3718('0xb2'));return db['User'][_0x3718('0x32')]({'where':{'id':_0xcd5714[_0x3718('0x54')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x3718('0x24')](handleEntityNotFound(_0xa59e1b,null))[_0x3718('0x24')](function(_0x647fe8){if(_0x647fe8){if(_[_0x3718('0x60')](_0x647fe8[_0x3718('0xae')])){return _0xa59e1b[_0x3718('0xb3')](_0x41ca79);}else{if(!fs[_0x3718('0xb4')](path[_0x3718('0xb5')](config[_0x3718('0xb1')],_0x3718('0xb6'),_0x647fe8[_0x3718('0xae')]))){return _0xa59e1b[_0x3718('0xb3')](_0x41ca79);}return _0xa59e1b[_0x3718('0xb3')](path[_0x3718('0xb5')](config[_0x3718('0xb1')],'server/files/images/',_0x647fe8['userpic']));}}})[_0x3718('0x52')](handleError(_0xa59e1b,null));};exports['getOpenTabs']=function(_0xc0d3f9,_0x57dbce){return db['User'][_0x3718('0x32')]({'where':{'id':_0xc0d3f9[_0x3718('0x54')]['id']},'attributes':['id']})[_0x3718('0x24')](handleEntityNotFound(_0x57dbce,null))[_0x3718('0x24')](function(_0x1f74a8){var _0x12d6fe=[];values=_0x1f74a8[_0x3718('0x4d')];_0x12d6fe[_0x3718('0x4c')](get_open_tabs(_0x3718('0x56'),_0x1f74a8[_0x3718('0x4d')]));_0x12d6fe[_0x3718('0x4c')](get_open_tabs('sms',_0x1f74a8['dataValues']));_0x12d6fe['push'](get_open_tabs('openchannel',_0x1f74a8[_0x3718('0x4d')]));_0x12d6fe['push'](get_open_tabs(_0x3718('0x50'),_0x1f74a8[_0x3718('0x4d')]));_0x12d6fe[_0x3718('0x4c')](get_open_tabs(_0x3718('0x4f'),_0x1f74a8['dataValues']));_0x12d6fe[_0x3718('0x4c')](get_open_tabs(_0x3718('0x58'),_0x1f74a8[_0x3718('0x4d')]));return Promise[_0x3718('0x51')](_0x12d6fe);})[_0x3718('0x24')](function(_0x883ff){if(_0x883ff){var _0x5d40aa=_[_0x3718('0x2f')](values['ChatOpenTabs'],function(_0x551f3d){return{'channel':'CHAT','id':_0x551f3d['id'],'createdAt':_0x551f3d[_0x3718('0xb7')]};});var _0x1a379c=_[_0x3718('0x2f')](values[_0x3718('0xb8')],function(_0xe13356){return{'channel':_0x3718('0xb9'),'id':_0xe13356['id'],'createdAt':_0xe13356[_0x3718('0xb7')]};});var _0x2e57d3=_[_0x3718('0x2f')](values[_0x3718('0xba')],function(_0x288181){return{'channel':'OPENCHANNEL','id':_0x288181['id'],'createdAt':_0x288181[_0x3718('0xb7')]};});var _0x1dbbc9=_['map'](values[_0x3718('0xbb')],function(_0x4b55d9){return{'channel':'MAIL','id':_0x4b55d9['id'],'createdAt':_0x4b55d9[_0x3718('0xb7')]};});var _0x17b255=_[_0x3718('0x2f')](values['SmsOpenTabs'],function(_0x528d65){return{'channel':'SMS','id':_0x528d65['id'],'createdAt':_0x528d65[_0x3718('0xb7')]};});var _0x3bc09a=_[_0x3718('0x2f')](values[_0x3718('0xbc')],function(_0x364a7d){return{'channel':_0x3718('0xbd'),'id':_0x364a7d['id'],'createdAt':_0x364a7d[_0x3718('0xb7')]};});var _0x24c55d=_[_0x3718('0xbe')](_0x5d40aa,_0x1a379c,_0x2e57d3,_0x1dbbc9,_0x17b255,_0x3bc09a);var _0x453c35={'count':_0x24c55d[_0x3718('0x4b')],'rows':_0x24c55d};return _0x453c35;}else return null;})[_0x3718('0x24')](respondWithResult(_0x57dbce,null))[_0x3718('0x52')](handleError(_0x57dbce,null));};exports['getContacts']=function(_0x3be4bd,_0x2e9310){var _0x428744={};return db[_0x3718('0x37')][_0x3718('0x91')]({'where':{'id':_0x3be4bd[_0x3718('0x54')]['id']}})[_0x3718('0x24')](function(_0x3604ca){if(!_0x3604ca){throw new APINotFoundError(util[_0x3718('0xa6')](_0x3718('0xbf'),_0x3be4bd['params']['id']));}return contacts['describe']();})[_0x3718('0x24')](function(_0x5b9cfa){_0x3be4bd[_0x3718('0x44')][_0x3718('0x37')]=_0x3be4bd[_0x3718('0x54')]['id'];_0x428744=qs[_0x3718('0x41')](_0x5b9cfa,_0x3be4bd);if(_0x3be4bd[_0x3718('0x44')][_0x3718('0xc0')](_0x3718('0x42'))){_0x428744['include']=[{'model':db[_0x3718('0xc1')],'as':_0x3718('0xc2'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x3be4bd[_0x3718('0x44')]['tag']?{'id':_0x3be4bd['query'][_0x3718('0xc3')]}:undefined,'required':_0x3be4bd[_0x3718('0x44')]['tag']?!![]:![]}];}return contacts['findAll'](_0x3be4bd['query'],_0x3be4bd[_0x3718('0x2a')],_0x428744,_0x5b9cfa);})[_0x3718('0x24')](respondWithFilteredResult(_0x2e9310,_0x428744))[_0x3718('0x52')](APIHandleError(_0x2e9310));};exports[_0x3718('0xc4')]=function(_0x537ff0,_0x15a1c3){var _0x25f9bd;var _0x215e47={};var _0x11966a;return db[_0x3718('0x37')]['findOne']({'where':{'id':_0x537ff0[_0x3718('0x54')]['id']},'attributes':['id',_0x3718('0x35'),'role']})[_0x3718('0x24')](handleEntityNotFound(_0x15a1c3,null))['then'](function(_0x3e6453){if(!utils['isValidChannel'](_0x537ff0[_0x3718('0x44')][_0x3718('0x97')])){throw new db[(_0x3718('0x8d'))][(_0x3718('0x8a'))]('Unknown\x20channel');}_0x25f9bd=_0x3e6453;var _0x4c64b3={};_0x4c64b3[_0x3718('0xc5')]=_['keys'](db[_['capitalize'](_0x537ff0['query'][_0x3718('0x97')])+'Queue'][_0x3718('0xc6')]);_0x4c64b3[_0x3718('0x44')]=_[_0x3718('0xc7')](_0x537ff0[_0x3718('0x44')]);_0x4c64b3['filters']=_['intersection'](_0x4c64b3[_0x3718('0xc5')],_0x4c64b3['query']);_0x215e47[_0x3718('0x47')]=_['intersection'](_0x4c64b3['model'],qs[_0x3718('0xc8')](_0x537ff0[_0x3718('0x44')]['fields']));_0x215e47['attributes']=_0x215e47[_0x3718('0x47')][_0x3718('0x4b')]?_0x215e47[_0x3718('0x47')]:_0x4c64b3['model'];_0x215e47[_0x3718('0xc9')]=qs[_0x3718('0xca')](_0x537ff0[_0x3718('0x44')][_0x3718('0xca')]);_0x215e47[_0x3718('0xcb')]=qs[_0x3718('0xcc')](_['pick'](_0x537ff0[_0x3718('0x44')],_0x4c64b3[_0x3718('0xcc')]));if(_0x537ff0[_0x3718('0x44')][_0x3718('0x2d')]){_0x215e47[_0x3718('0xcb')]=_['merge'](_0x215e47[_0x3718('0xcb')],{'$or':_['map'](_0x215e47[_0x3718('0x47')],function(_0x15d33b){var _0x3d5e5b={};_0x3d5e5b[_0x15d33b]={'$like':'%'+_0x537ff0[_0x3718('0x44')][_0x3718('0x2d')]+'%'};return _0x3d5e5b;})});}_0x215e47=_[_0x3718('0xcd')]({},_0x215e47,_0x537ff0[_0x3718('0xce')]);switch(_0x25f9bd['role']){case'admin':return db[_['capitalize'](_0x537ff0['query']['channel'])+_0x3718('0xcf')][_0x3718('0x48')](_0x215e47);case'user':case _0x3718('0x6a'):return _0x25f9bd['get'+_[_0x3718('0x9d')](_0x537ff0[_0x3718('0x44')][_0x3718('0x97')])+_0x3718('0x9f')](_0x215e47);default:throw new db['Sequelize'][(_0x3718('0x8a'))](_0x3718('0xd0'));}})['then'](function(_0x50591c){_0x11966a=_0x50591c[_0x3718('0x4b')];if(!_0x537ff0['query'][_0x3718('0xc0')]('nolimit')){_0x215e47['limit']=qs[_0x3718('0x15')](_0x537ff0[_0x3718('0x44')][_0x3718('0x15')]);_0x215e47['offset']=qs[_0x3718('0x13')](_0x537ff0[_0x3718('0x44')][_0x3718('0x13')]);}switch(_0x25f9bd['role']){case _0x3718('0x29'):return db[_[_0x3718('0x9d')](_0x537ff0[_0x3718('0x44')][_0x3718('0x97')])+'Queue'][_0x3718('0x48')](_0x215e47);case _0x3718('0x2a'):case _0x3718('0x6a'):return _0x25f9bd[_0x3718('0x27')+_[_0x3718('0x9d')](_0x537ff0['query'][_0x3718('0x97')])+_0x3718('0x9f')](_0x215e47);}})[_0x3718('0x24')](function(_0x7a2834){return{'count':_0x11966a,'rows':_0x7a2834};})[_0x3718('0x24')](respondWithResult(_0x15a1c3,null))['catch'](handleError(_0x15a1c3,null));};exports[_0x3718('0xd1')]=function(_0xe45473,_0x5c3623){var _0x44182c={};var _0x25b8d5={};var _0x3861fd;var _0x2cc4d4;return db[_0x3718('0x37')][_0x3718('0x91')]({'where':{'id':_0xe45473[_0x3718('0x54')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x5c3623,null))[_0x3718('0x24')](function(_0x31d32d){if(_0x31d32d){_0x3861fd=_0x31d32d;_0x25b8d5['model']=_[_0x3718('0xc7')](db[_0x3718('0xa7')][_0x3718('0xc6')]);_0x25b8d5[_0x3718('0x44')]=_[_0x3718('0xc7')](_0xe45473[_0x3718('0x44')]);_0x25b8d5['filters']=_['intersection'](_0x25b8d5['model'],_0x25b8d5[_0x3718('0x44')]);_0x44182c[_0x3718('0x47')]=_[_0x3718('0xd2')](_0x25b8d5[_0x3718('0xc5')],qs[_0x3718('0xc8')](_0xe45473[_0x3718('0x44')][_0x3718('0xc8')]));_0x44182c[_0x3718('0x47')]=_0x44182c[_0x3718('0x47')][_0x3718('0x4b')]?_0x44182c[_0x3718('0x47')]:_0x25b8d5[_0x3718('0xc5')];_0x44182c['order']=qs[_0x3718('0xca')](_0xe45473[_0x3718('0x44')][_0x3718('0xca')]);_0x44182c[_0x3718('0xcb')]=qs[_0x3718('0xcc')](_[_0x3718('0xd3')](_0xe45473[_0x3718('0x44')],_0x25b8d5['filters']));if(_0xe45473[_0x3718('0x44')][_0x3718('0x2d')]){_0x44182c[_0x3718('0xcb')]=_['merge'](_0x44182c[_0x3718('0xcb')],{'$or':_[_0x3718('0x2f')](_0x44182c[_0x3718('0x47')],function(_0x18e5d4){var _0x4480e4={};_0x4480e4[_0x18e5d4]={'$like':'%'+_0xe45473['query']['filter']+'%'};return _0x4480e4;})});}_0x44182c=_[_0x3718('0xcd')]({},_0x44182c,_0xe45473['options']);return _0x3861fd[_0x3718('0xd1')](_0x44182c);}})['then'](function(_0x5bce60){if(_0x5bce60){_0x2cc4d4=_0x5bce60['length'];if(!_0xe45473[_0x3718('0x44')]['hasOwnProperty'](_0x3718('0xd4'))){_0x44182c[_0x3718('0x15')]=qs[_0x3718('0x15')](_0xe45473[_0x3718('0x44')]['limit']);_0x44182c[_0x3718('0x13')]=qs[_0x3718('0x13')](_0xe45473[_0x3718('0x44')][_0x3718('0x13')]);}return _0x3861fd[_0x3718('0xd1')](_0x44182c);}})['then'](function(_0x5e046a){if(_0x5e046a){return _0x5e046a?{'count':_0x2cc4d4,'rows':_0x5e046a}:null;}})[_0x3718('0x24')](respondWithResult(_0x5c3623,null))[_0x3718('0x52')](handleError(_0x5c3623,null));};exports[_0x3718('0xd5')]=function(_0x208ce1,_0x35061f){var _0x3adaf0={};var _0x135c72={};var _0x1bc2ad;var _0x53ae42;return db[_0x3718('0x37')][_0x3718('0x91')]({'where':{'id':_0x208ce1['params']['id']}})['then'](handleEntityNotFound(_0x35061f,null))[_0x3718('0x24')](function(_0x572096){if(_0x572096){_0x1bc2ad=_0x572096;_0x135c72[_0x3718('0xc5')]=_[_0x3718('0xc7')](db[_0x3718('0xd6')]['rawAttributes']);_0x135c72[_0x3718('0x44')]=_[_0x3718('0xc7')](_0x208ce1[_0x3718('0x44')]);_0x135c72[_0x3718('0xcc')]=_[_0x3718('0xd2')](_0x135c72[_0x3718('0xc5')],_0x135c72[_0x3718('0x44')]);_0x3adaf0[_0x3718('0x47')]=_[_0x3718('0xd2')](_0x135c72[_0x3718('0xc5')],qs['fields'](_0x208ce1[_0x3718('0x44')][_0x3718('0xc8')]));_0x3adaf0['attributes']=_0x3adaf0[_0x3718('0x47')][_0x3718('0x4b')]?_0x3adaf0[_0x3718('0x47')]:_0x135c72['model'];_0x3adaf0[_0x3718('0xc9')]=qs[_0x3718('0xca')](_0x208ce1[_0x3718('0x44')]['sort']);_0x3adaf0[_0x3718('0xcb')]=qs[_0x3718('0xcc')](_['pick'](_0x208ce1[_0x3718('0x44')],_0x135c72['filters']));if(_0x208ce1[_0x3718('0x44')][_0x3718('0x2d')]){_0x3adaf0[_0x3718('0xcb')]=_['merge'](_0x3adaf0[_0x3718('0xcb')],{'$or':_[_0x3718('0x2f')](_0x3adaf0[_0x3718('0x47')],function(_0x35ce41){var _0x3c0adf={};_0x3c0adf[_0x35ce41]={'$like':'%'+_0x208ce1[_0x3718('0x44')][_0x3718('0x2d')]+'%'};return _0x3c0adf;})});}_0x3adaf0=_[_0x3718('0xcd')]({},_0x3adaf0,_0x208ce1[_0x3718('0xce')]);return _0x1bc2ad[_0x3718('0xd5')](_0x3adaf0);}})[_0x3718('0x24')](function(_0x23c9ed){if(_0x23c9ed){_0x53ae42=_0x23c9ed[_0x3718('0x4b')];if(!_0x208ce1[_0x3718('0x44')][_0x3718('0xc0')]('nolimit')){_0x3adaf0[_0x3718('0x15')]=qs[_0x3718('0x15')](_0x208ce1[_0x3718('0x44')][_0x3718('0x15')]);_0x3adaf0[_0x3718('0x13')]=qs[_0x3718('0x13')](_0x208ce1['query']['offset']);}return _0x1bc2ad['getGroups'](_0x3adaf0);}})['then'](function(_0x5119da){if(_0x5119da){return _0x5119da?{'count':_0x53ae42,'rows':_0x5119da}:null;}})[_0x3718('0x24')](respondWithResult(_0x35061f,null))[_0x3718('0x52')](handleError(_0x35061f,null));};exports['getRecordings']=function(_0x2c7bd5,_0x55c7b7){var _0xdc966f={'raw':!![],'where':{}};var _0x21220d={};var _0x4d02e0={'count':0x0,'rows':[]};return db['User'][_0x3718('0x91')]({'where':{'id':_0x2c7bd5[_0x3718('0x54')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x55c7b7,null))[_0x3718('0x24')](function(_0x884c7d){if(_0x884c7d){_0x21220d[_0x3718('0xc5')]=_['keys'](db['VoiceRecording'][_0x3718('0xc6')]);_0x21220d[_0x3718('0x44')]=_[_0x3718('0xc7')](_0x2c7bd5[_0x3718('0x44')]);_0x21220d[_0x3718('0xcc')]=_['intersection'](_0x21220d[_0x3718('0xc5')],_0x21220d['query']);_0xdc966f[_0x3718('0x47')]=_[_0x3718('0xd2')](_0x21220d['model'],qs[_0x3718('0xc8')](_0x2c7bd5['query'][_0x3718('0xc8')]));_0xdc966f[_0x3718('0x47')]=_0xdc966f['attributes'][_0x3718('0x4b')]?_0xdc966f['attributes']:_0x21220d[_0x3718('0xc5')];if(!_0x2c7bd5[_0x3718('0x44')][_0x3718('0xc0')](_0x3718('0xd4'))){_0xdc966f[_0x3718('0x15')]=qs[_0x3718('0x15')](_0x2c7bd5[_0x3718('0x44')][_0x3718('0x15')]);_0xdc966f[_0x3718('0x13')]=qs[_0x3718('0x13')](_0x2c7bd5['query'][_0x3718('0x13')]);}_0xdc966f[_0x3718('0xc9')]=qs['sort'](_0x2c7bd5[_0x3718('0x44')][_0x3718('0xca')]);_0xdc966f['where']=qs[_0x3718('0xcc')](_[_0x3718('0xd3')](_0x2c7bd5[_0x3718('0x44')],_0x21220d[_0x3718('0xcc')]));_0xdc966f[_0x3718('0xcb')]['UserId']=_0x884c7d['id'];if(_0x2c7bd5[_0x3718('0x44')][_0x3718('0x2d')]){_0xdc966f[_0x3718('0xcb')]=_['merge'](_0xdc966f[_0x3718('0xcb')],{'$or':_[_0x3718('0x2f')](_0xdc966f['attributes'],function(_0x3beb2b){var _0x421d55={};_0x421d55[_0x3beb2b]={'$like':'%'+_0x2c7bd5[_0x3718('0x44')][_0x3718('0x2d')]+'%'};return _0x421d55;})});}_0xdc966f=_[_0x3718('0xcd')]({},_0xdc966f,_0x2c7bd5[_0x3718('0xce')]);return db[_0x3718('0xd7')][_0x3718('0x16')]({'where':_0xdc966f['where']})[_0x3718('0x24')](function(_0xf01ac0){_0x4d02e0[_0x3718('0x16')]=_0xf01ac0;if(_0x2c7bd5[_0x3718('0x44')][_0x3718('0x42')]){_0xdc966f[_0x3718('0x43')]=[{'all':!![]}];}return db[_0x3718('0xd7')][_0x3718('0x48')](_0xdc966f);})[_0x3718('0x24')](function(_0x447533){_0x4d02e0[_0x3718('0x49')]=_0x447533;return _0x4d02e0;});}})[_0x3718('0x24')](respondWithFilteredResult(_0x55c7b7,_0xdc966f))[_0x3718('0x52')](handleError(_0x55c7b7,null));};exports[_0x3718('0xd8')]=function(_0x3195e3,_0x217b5b){var _0x4cde05={'raw':!![],'where':{}};var _0x287502={};var _0x143c33={'count':0x0,'rows':[]};return db[_0x3718('0x37')][_0x3718('0x91')]({'where':{'id':_0x3195e3[_0x3718('0x54')]['id']}})['then'](handleEntityNotFound(_0x217b5b,null))[_0x3718('0x24')](function(_0x5083fd){if(_0x5083fd){_0x287502[_0x3718('0xc5')]=_[_0x3718('0xc7')](db[_0x3718('0xd9')][_0x3718('0xc6')]);_0x287502[_0x3718('0x44')]=_[_0x3718('0xc7')](_0x3195e3[_0x3718('0x44')]);_0x287502[_0x3718('0xcc')]=_[_0x3718('0xd2')](_0x287502[_0x3718('0xc5')],_0x287502['query']);_0x4cde05[_0x3718('0x47')]=_['intersection'](_0x287502['model'],qs[_0x3718('0xc8')](_0x3195e3[_0x3718('0x44')][_0x3718('0xc8')]));_0x4cde05['attributes']=_0x4cde05[_0x3718('0x47')]['length']?_0x4cde05[_0x3718('0x47')]:_0x287502[_0x3718('0xc5')];if(!_0x3195e3[_0x3718('0x44')]['hasOwnProperty'](_0x3718('0xd4'))){_0x4cde05['limit']=qs[_0x3718('0x15')](_0x3195e3[_0x3718('0x44')][_0x3718('0x15')]);_0x4cde05[_0x3718('0x13')]=qs[_0x3718('0x13')](_0x3195e3[_0x3718('0x44')][_0x3718('0x13')]);}_0x4cde05[_0x3718('0xc9')]=qs[_0x3718('0xca')](_0x3195e3['query'][_0x3718('0xca')]);_0x4cde05[_0x3718('0xcb')]=qs[_0x3718('0xcc')](_[_0x3718('0xd3')](_0x3195e3[_0x3718('0x44')],_0x287502[_0x3718('0xcc')]));_0x4cde05['where'][_0x3718('0xda')]=_0x5083fd['id'];if(_0x3195e3['query']['filter']){_0x4cde05[_0x3718('0xcb')]=_[_0x3718('0xcd')](_0x4cde05[_0x3718('0xcb')],{'$or':_['map'](_0x4cde05[_0x3718('0x47')],function(_0x4bd002){var _0x1cdfc9={};_0x1cdfc9[_0x4bd002]={'$like':'%'+_0x3195e3[_0x3718('0x44')][_0x3718('0x2d')]+'%'};return _0x1cdfc9;})});}_0x4cde05=_[_0x3718('0xcd')]({},_0x4cde05,_0x3195e3['options']);return db['ScreenRecording'][_0x3718('0x16')]({'where':_0x4cde05['where']})[_0x3718('0x24')](function(_0x3c2a16){_0x143c33['count']=_0x3c2a16;if(_0x3195e3[_0x3718('0x44')][_0x3718('0x42')]){_0x4cde05[_0x3718('0x43')]=[{'all':!![]}];}return db[_0x3718('0xd9')][_0x3718('0x48')](_0x4cde05);})[_0x3718('0x24')](function(_0x2eb3d0){_0x143c33['rows']=_0x2eb3d0;return _0x143c33;});}})[_0x3718('0x24')](respondWithFilteredResult(_0x217b5b,_0x4cde05))[_0x3718('0x52')](handleError(_0x217b5b,null));};exports[_0x3718('0xdb')]=function(_0xed08d1,_0x164bfa){var _0x32ca55={};var _0x395be7={};var _0x10d5fd;var _0x4b43ba;return db[_0x3718('0x37')][_0x3718('0x91')]({'where':{'id':_0xed08d1[_0x3718('0x54')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x164bfa,null))[_0x3718('0x24')](function(_0x369778){if(_0x369778){_0x10d5fd=_0x369778;_0x395be7[_0x3718('0xc5')]=_[_0x3718('0xc7')](db[_0x3718('0xdc')][_0x3718('0xc6')]);_0x395be7[_0x3718('0x44')]=_[_0x3718('0xc7')](_0xed08d1[_0x3718('0x44')]);_0x395be7['filters']=_['intersection'](_0x395be7[_0x3718('0xc5')],_0x395be7[_0x3718('0x44')]);_0x32ca55[_0x3718('0x47')]=_[_0x3718('0xd2')](_0x395be7[_0x3718('0xc5')],qs['fields'](_0xed08d1['query'][_0x3718('0xc8')]));_0x32ca55[_0x3718('0x47')]=_0x32ca55['attributes'][_0x3718('0x4b')]?_0x32ca55[_0x3718('0x47')]:_0x395be7['model'];_0x32ca55[_0x3718('0xc9')]=qs[_0x3718('0xca')](_0xed08d1['query']['sort']);_0x32ca55[_0x3718('0xcb')]=qs[_0x3718('0xcc')](_['pick'](_0xed08d1['query'],_0x395be7['filters']));if(_0xed08d1['query'][_0x3718('0x2d')]){_0x32ca55[_0x3718('0xcb')]=_[_0x3718('0xcd')](_0x32ca55['where'],{'$or':_['map'](_0x32ca55[_0x3718('0x47')],function(_0xc59799){var _0x4179c5={};_0x4179c5[_0xc59799]={'$like':'%'+_0xed08d1[_0x3718('0x44')][_0x3718('0x2d')]+'%'};return _0x4179c5;})});}_0x32ca55=_[_0x3718('0xcd')]({},_0x32ca55,_0xed08d1[_0x3718('0xce')]);return _0x10d5fd[_0x3718('0xdb')](_0x32ca55);}})[_0x3718('0x24')](function(_0x77f825){if(_0x77f825){_0x4b43ba=_0x77f825['length'];if(!_0xed08d1[_0x3718('0x44')][_0x3718('0xc0')]('nolimit')){_0x32ca55['limit']=qs[_0x3718('0x15')](_0xed08d1['query'][_0x3718('0x15')]);_0x32ca55['offset']=qs[_0x3718('0x13')](_0xed08d1['query'][_0x3718('0x13')]);}return _0x10d5fd[_0x3718('0xdb')](_0x32ca55);}})['then'](function(_0x20701e){if(_0x20701e){return _0x20701e?{'count':_0x4b43ba,'rows':_0x20701e}:null;}})[_0x3718('0x24')](respondWithResult(_0x164bfa,null))[_0x3718('0x52')](handleError(_0x164bfa,null));};exports[_0x3718('0xdd')]=function(_0x3a3e94,_0x32bb4f){var _0xb20493={};var _0xab1aee={};var _0xba8ab4;var _0x5c189d;return db[_0x3718('0x37')]['findOne']({'where':{'id':_0x3a3e94[_0x3718('0x54')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x32bb4f,null))['then'](function(_0x4621a4){if(_0x4621a4){_0xba8ab4=_0x4621a4;_0xab1aee[_0x3718('0xc5')]=_[_0x3718('0xc7')](db[_0x3718('0xde')]['rawAttributes']);_0xab1aee[_0x3718('0x44')]=_[_0x3718('0xc7')](_0x3a3e94[_0x3718('0x44')]);_0xab1aee[_0x3718('0xcc')]=_['intersection'](_0xab1aee[_0x3718('0xc5')],_0xab1aee['query']);_0xb20493[_0x3718('0x47')]=_[_0x3718('0xd2')](_0xab1aee[_0x3718('0xc5')],qs['fields'](_0x3a3e94[_0x3718('0x44')][_0x3718('0xc8')]));_0xb20493[_0x3718('0x47')]=_0xb20493[_0x3718('0x47')][_0x3718('0x4b')]?_0xb20493[_0x3718('0x47')]:_0xab1aee[_0x3718('0xc5')];_0xb20493[_0x3718('0xc9')]=qs[_0x3718('0xca')](_0x3a3e94[_0x3718('0x44')]['sort']);_0xb20493[_0x3718('0xcb')]=qs[_0x3718('0xcc')](_[_0x3718('0xd3')](_0x3a3e94[_0x3718('0x44')],_0xab1aee[_0x3718('0xcc')]));if(_0x3a3e94[_0x3718('0x44')][_0x3718('0x2d')]){_0xb20493[_0x3718('0xcb')]=_[_0x3718('0xcd')](_0xb20493['where'],{'$or':_[_0x3718('0x2f')](_0xb20493[_0x3718('0x47')],function(_0x48de37){var _0x40aec0={};_0x40aec0[_0x48de37]={'$like':'%'+_0x3a3e94[_0x3718('0x44')]['filter']+'%'};return _0x40aec0;})});}_0xb20493=_[_0x3718('0xcd')]({},_0xb20493,_0x3a3e94[_0x3718('0xce')]);return _0xba8ab4[_0x3718('0xdd')](_0xb20493);}})[_0x3718('0x24')](function(_0x2fecdc){if(_0x2fecdc){_0x5c189d=_0x2fecdc['length'];if(!_0x3a3e94[_0x3718('0x44')][_0x3718('0xc0')](_0x3718('0xd4'))){_0xb20493[_0x3718('0x15')]=qs['limit'](_0x3a3e94[_0x3718('0x44')]['limit']);_0xb20493[_0x3718('0x13')]=qs[_0x3718('0x13')](_0x3a3e94['query']['offset']);}return _0xba8ab4['getOpenchannelInteractions'](_0xb20493);}})[_0x3718('0x24')](function(_0x2b90b9){if(_0x2b90b9){return _0x2b90b9?{'count':_0x5c189d,'rows':_0x2b90b9}:null;}})['then'](respondWithResult(_0x32bb4f,null))[_0x3718('0x52')](handleError(_0x32bb4f,null));};exports[_0x3718('0xdf')]=function(_0x1cb72a,_0x25879d){var _0x167071={'raw':!![],'where':{}};var _0x4ef05d={};var _0x3972b1={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x1cb72a[_0x3718('0x54')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x25879d,null))[_0x3718('0x24')](function(_0x15b41f){if(_0x15b41f){_0x4ef05d['model']=_['keys'](db[_0x3718('0xe0')][_0x3718('0xc6')]);_0x4ef05d[_0x3718('0x44')]=_[_0x3718('0xc7')](_0x1cb72a['query']);_0x4ef05d[_0x3718('0xcc')]=_['intersection'](_0x4ef05d[_0x3718('0xc5')],_0x4ef05d[_0x3718('0x44')]);_0x167071[_0x3718('0x47')]=_['intersection'](_0x4ef05d[_0x3718('0xc5')],qs[_0x3718('0xc8')](_0x1cb72a['query']['fields']));_0x167071[_0x3718('0x47')]=_0x167071[_0x3718('0x47')][_0x3718('0x4b')]?_0x167071[_0x3718('0x47')]:_0x4ef05d[_0x3718('0xc5')];if(!_0x1cb72a['query']['hasOwnProperty'](_0x3718('0xd4'))){_0x167071[_0x3718('0x15')]=qs[_0x3718('0x15')](_0x1cb72a[_0x3718('0x44')]['limit']);_0x167071[_0x3718('0x13')]=qs[_0x3718('0x13')](_0x1cb72a[_0x3718('0x44')][_0x3718('0x13')]);}_0x167071['order']=qs[_0x3718('0xca')](_0x1cb72a[_0x3718('0x44')][_0x3718('0xca')]);_0x167071['where']=qs[_0x3718('0xcc')](_[_0x3718('0xd3')](_0x1cb72a[_0x3718('0x44')],_0x4ef05d[_0x3718('0xcc')]));_0x167071['where'][_0x3718('0xda')]=_0x15b41f['id'];if(_0x1cb72a[_0x3718('0x44')][_0x3718('0x2d')]){_0x167071[_0x3718('0xcb')]=_[_0x3718('0xcd')](_0x167071[_0x3718('0xcb')],{'$or':_[_0x3718('0x2f')](_0x167071[_0x3718('0x47')],function(_0x4cbc4f){var _0x4bb1b0={};_0x4bb1b0[_0x4cbc4f]={'$like':'%'+_0x1cb72a[_0x3718('0x44')]['filter']+'%'};return _0x4bb1b0;})});}_0x167071=_[_0x3718('0xcd')]({},_0x167071,_0x1cb72a[_0x3718('0xce')]);return db[_0x3718('0xe0')][_0x3718('0x16')]({'where':_0x167071[_0x3718('0xcb')]})[_0x3718('0x24')](function(_0x1bf18d){_0x3972b1['count']=_0x1bf18d;if(_0x1cb72a[_0x3718('0x44')]['includeAll']){_0x167071['include']=[{'all':!![]}];}return db[_0x3718('0xe0')][_0x3718('0x48')](_0x167071);})[_0x3718('0x24')](function(_0x597c54){_0x3972b1[_0x3718('0x49')]=_0x597c54;return _0x3972b1;});}})[_0x3718('0x24')](respondWithFilteredResult(_0x25879d,_0x167071))[_0x3718('0x52')](handleError(_0x25879d,null));};exports['getSmsInteractions']=function(_0x4a16e4,_0x179c73){var _0xdeebe4={};var _0x1a06d7={};var _0x153181;var _0x2e9284;return db[_0x3718('0x37')][_0x3718('0x91')]({'where':{'id':_0x4a16e4[_0x3718('0x54')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x179c73,null))[_0x3718('0x24')](function(_0x46d9f3){if(_0x46d9f3){_0x153181=_0x46d9f3;_0x1a06d7[_0x3718('0xc5')]=_[_0x3718('0xc7')](db[_0x3718('0xe1')][_0x3718('0xc6')]);_0x1a06d7['query']=_[_0x3718('0xc7')](_0x4a16e4[_0x3718('0x44')]);_0x1a06d7[_0x3718('0xcc')]=_[_0x3718('0xd2')](_0x1a06d7[_0x3718('0xc5')],_0x1a06d7[_0x3718('0x44')]);_0xdeebe4[_0x3718('0x47')]=_[_0x3718('0xd2')](_0x1a06d7[_0x3718('0xc5')],qs[_0x3718('0xc8')](_0x4a16e4['query'][_0x3718('0xc8')]));_0xdeebe4[_0x3718('0x47')]=_0xdeebe4[_0x3718('0x47')]['length']?_0xdeebe4['attributes']:_0x1a06d7[_0x3718('0xc5')];_0xdeebe4[_0x3718('0xc9')]=qs['sort'](_0x4a16e4[_0x3718('0x44')][_0x3718('0xca')]);_0xdeebe4[_0x3718('0xcb')]=qs[_0x3718('0xcc')](_['pick'](_0x4a16e4[_0x3718('0x44')],_0x1a06d7[_0x3718('0xcc')]));if(_0x4a16e4['query'][_0x3718('0x2d')]){_0xdeebe4[_0x3718('0xcb')]=_[_0x3718('0xcd')](_0xdeebe4[_0x3718('0xcb')],{'$or':_[_0x3718('0x2f')](_0xdeebe4['attributes'],function(_0x73f512){var _0x26aada={};_0x26aada[_0x73f512]={'$like':'%'+_0x4a16e4['query'][_0x3718('0x2d')]+'%'};return _0x26aada;})});}_0xdeebe4=_[_0x3718('0xcd')]({},_0xdeebe4,_0x4a16e4[_0x3718('0xce')]);return _0x153181[_0x3718('0xe2')](_0xdeebe4);}})[_0x3718('0x24')](function(_0x5cf233){if(_0x5cf233){_0x2e9284=_0x5cf233['length'];if(!_0x4a16e4['query'][_0x3718('0xc0')](_0x3718('0xd4'))){_0xdeebe4[_0x3718('0x15')]=qs[_0x3718('0x15')](_0x4a16e4[_0x3718('0x44')][_0x3718('0x15')]);_0xdeebe4[_0x3718('0x13')]=qs['offset'](_0x4a16e4[_0x3718('0x44')][_0x3718('0x13')]);}return _0x153181['getSmsInteractions'](_0xdeebe4);}})[_0x3718('0x24')](function(_0x599d2d){if(_0x599d2d){return _0x599d2d?{'count':_0x2e9284,'rows':_0x599d2d}:null;}})[_0x3718('0x24')](respondWithResult(_0x179c73,null))['catch'](handleError(_0x179c73,null));};exports[_0x3718('0xe3')]=function(_0x30f7c9,_0x2924d3){var _0x1c2a64={};var _0x370078={};var _0x11e8e8;var _0x368217;return db[_0x3718('0x37')]['findOne']({'where':{'id':_0x30f7c9[_0x3718('0x54')]['id']}})['then'](handleEntityNotFound(_0x2924d3,null))['then'](function(_0x40dcdc){if(_0x40dcdc){_0x11e8e8=_0x40dcdc;_0x370078['model']=_[_0x3718('0xc7')](db[_0x3718('0xe4')][_0x3718('0xc6')]);_0x370078[_0x3718('0x44')]=_['keys'](_0x30f7c9[_0x3718('0x44')]);_0x370078['filters']=_['intersection'](_0x370078[_0x3718('0xc5')],_0x370078['query']);_0x1c2a64['attributes']=_[_0x3718('0xd2')](_0x370078['model'],qs[_0x3718('0xc8')](_0x30f7c9['query'][_0x3718('0xc8')]));_0x1c2a64[_0x3718('0x47')]=_0x1c2a64[_0x3718('0x47')][_0x3718('0x4b')]?_0x1c2a64['attributes']:_0x370078[_0x3718('0xc5')];_0x1c2a64['order']=qs[_0x3718('0xca')](_0x30f7c9[_0x3718('0x44')]['sort']);_0x1c2a64['where']=qs[_0x3718('0xcc')](_['pick'](_0x30f7c9[_0x3718('0x44')],_0x370078[_0x3718('0xcc')]));if(_0x30f7c9[_0x3718('0x44')][_0x3718('0x2d')]){_0x1c2a64[_0x3718('0xcb')]=_[_0x3718('0xcd')](_0x1c2a64[_0x3718('0xcb')],{'$or':_[_0x3718('0x2f')](_0x1c2a64[_0x3718('0x47')],function(_0x12383a){var _0x4d7a47={};_0x4d7a47[_0x12383a]={'$like':'%'+_0x30f7c9[_0x3718('0x44')][_0x3718('0x2d')]+'%'};return _0x4d7a47;})});}_0x1c2a64=_[_0x3718('0xcd')]({},_0x1c2a64,_0x30f7c9[_0x3718('0xce')]);return _0x11e8e8[_0x3718('0xe3')](_0x1c2a64);}})[_0x3718('0x24')](function(_0x276c0b){if(_0x276c0b){_0x368217=_0x276c0b['length'];if(!_0x30f7c9[_0x3718('0x44')][_0x3718('0xc0')](_0x3718('0xd4'))){_0x1c2a64[_0x3718('0x15')]=qs[_0x3718('0x15')](_0x30f7c9[_0x3718('0x44')][_0x3718('0x15')]);_0x1c2a64[_0x3718('0x13')]=qs[_0x3718('0x13')](_0x30f7c9['query'][_0x3718('0x13')]);}return _0x11e8e8['getFaxInteractions'](_0x1c2a64);}})[_0x3718('0x24')](function(_0x1803a3){if(_0x1803a3){return _0x1803a3?{'count':_0x368217,'rows':_0x1803a3}:null;}})[_0x3718('0x24')](respondWithResult(_0x2924d3,null))[_0x3718('0x52')](handleError(_0x2924d3,null));};exports[_0x3718('0xe5')]=function(_0x11dce4,_0x9b9ec1){var _0x38c7e9={};var _0x3c3303={};var _0x50faca;var _0x191b93;return db[_0x3718('0x37')][_0x3718('0x91')]({'where':{'id':_0x11dce4[_0x3718('0x54')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x9b9ec1,null))[_0x3718('0x24')](function(_0xd994c8){if(_0xd994c8){_0x50faca=_0xd994c8;_0x3c3303['model']=_['keys'](db[_0x3718('0xe6')]['rawAttributes']);_0x3c3303[_0x3718('0x44')]=_[_0x3718('0xc7')](_0x11dce4['query']);_0x3c3303[_0x3718('0xcc')]=_[_0x3718('0xd2')](_0x3c3303[_0x3718('0xc5')],_0x3c3303['query']);_0x38c7e9[_0x3718('0x47')]=_[_0x3718('0xd2')](_0x3c3303[_0x3718('0xc5')],qs['fields'](_0x11dce4['query'][_0x3718('0xc8')]));_0x38c7e9[_0x3718('0x47')]=_0x38c7e9[_0x3718('0x47')][_0x3718('0x4b')]?_0x38c7e9[_0x3718('0x47')]:_0x3c3303[_0x3718('0xc5')];_0x38c7e9[_0x3718('0xc9')]=qs['sort'](_0x11dce4[_0x3718('0x44')][_0x3718('0xca')]);_0x38c7e9['where']=qs[_0x3718('0xcc')](_[_0x3718('0xd3')](_0x11dce4[_0x3718('0x44')],_0x3c3303[_0x3718('0xcc')]));if(_0x11dce4[_0x3718('0x44')][_0x3718('0x2d')]){_0x38c7e9[_0x3718('0xcb')]=_['merge'](_0x38c7e9[_0x3718('0xcb')],{'$or':_[_0x3718('0x2f')](_0x38c7e9[_0x3718('0x47')],function(_0x23ade5){var _0x29c27d={};_0x29c27d[_0x23ade5]={'$like':'%'+_0x11dce4[_0x3718('0x44')][_0x3718('0x2d')]+'%'};return _0x29c27d;})});}_0x38c7e9=_[_0x3718('0xcd')]({},_0x38c7e9,_0x11dce4[_0x3718('0xce')]);return _0x50faca[_0x3718('0xe5')](_0x38c7e9);}})['then'](function(_0x3bd492){if(_0x3bd492){_0x191b93=_0x3bd492[_0x3718('0x4b')];if(!_0x11dce4[_0x3718('0x44')][_0x3718('0xc0')]('nolimit')){_0x38c7e9[_0x3718('0x15')]=qs['limit'](_0x11dce4[_0x3718('0x44')][_0x3718('0x15')]);_0x38c7e9[_0x3718('0x13')]=qs[_0x3718('0x13')](_0x11dce4[_0x3718('0x44')][_0x3718('0x13')]);}return _0x50faca['getWhatsappInteractions'](_0x38c7e9);}})[_0x3718('0x24')](function(_0x878996){if(_0x878996){return _0x878996?{'count':_0x191b93,'rows':_0x878996}:null;}})[_0x3718('0x24')](respondWithResult(_0x9b9ec1,null))['catch'](handleError(_0x9b9ec1,null));};exports[_0x3718('0xe7')]=function(_0x50e0fd,_0x508a61,_0xf5bdc){var _0x42f079;var _0x4fbd3e;var _0x16e1b1;var _0x3e237f=!_['isNil'](_0x50e0fd[_0x3718('0x54')]['id'])?_0x50e0fd[_0x3718('0x54')]['id']:!_[_0x3718('0x60')](_0x50e0fd[_0x3718('0x2a')]['id'])?_0x50e0fd['user']['id']:null;return db[_0x3718('0x37')][_0x3718('0x32')]({'where':{'id':_0x3e237f,'role':{'$or':[_0x3718('0x29'),_0x3718('0x2a'),_0x3718('0x6a')]}},'attributes':['id',_0x3718('0x35'),'phone','mobile','role',_0x3718('0x5d'),'loginInPause']})[_0x3718('0x24')](function(_0x4cdcf8){if(_0x4cdcf8){if(_0x4cdcf8['role']==='agent'){_0x42f079=_0x4cdcf8;if(_0x50e0fd['body'][_0x3718('0xa5')]){_0x16e1b1=util['format'](_0x3718('0xe8'),_0x42f079[_0x50e0fd[_0x3718('0x59')][_0x3718('0xa5')]]);}else if(_0x50e0fd[_0x3718('0x59')][_0x3718('0xe9')]){_0x16e1b1=util[_0x3718('0xa6')]('SIP/%s',_0x50e0fd['body']['intrf']);}else{_0x16e1b1=util[_0x3718('0xa6')](_0x3718('0xea'),_0x42f079[_0x3718('0x35')]);}socket['to'](util['format'](_0x3718('0xeb'),_0x42f079['name']))[_0x3718('0x25')](_0x3718('0xec'),{'user':{'id':_0x42f079['id'],'name':_0x42f079[_0x3718('0x35')]},'ip':_0x50e0fd[_0x3718('0xed')][_0x3718('0xee')]||_0x50e0fd[_0x3718('0xef')][_0x3718('0xf0')]||_0x50e0fd[_0x3718('0xf1')][_0x3718('0xf0')]||_0x50e0fd[_0x3718('0xef')]['socket']['remoteAddress']});return new Promise(function(_0x2bb9e9,_0x2b779a){db[_0x3718('0x62')][_0x3718('0xf2')]()[_0x3718('0x24')](_0x5616d7=>{db[_0x3718('0xa7')][_0x3718('0x26')]({'where':{'membername':_0x42f079[_0x3718('0x35')]},'individualHooks':!![]},{'transaction':_0x5616d7})[_0x3718('0x24')](function(){return _0x5616d7['commit']();})[_0x3718('0x24')](_0x2bb9e9)['catch'](_0x2b779a);});});}}else{throw new db[(_0x3718('0x8d'))]['ValidationError'](_0x3718('0xf3'));}})['then'](function(){if(_0x42f079){return _0x42f079['getVoiceQueues']({'raw':!![]});}})[_0x3718('0x24')](function(_0x175d01){if(_0x42f079){if(_0x175d01){_0x4fbd3e=_0x175d01;if(_0x4fbd3e[_0x3718('0x4b')]){var _0x542949=_0x4fbd3e[_0x3718('0x2f')](function(_0x5df963){return{'membername':_0x42f079[_0x3718('0x35')],'UserId':_0x42f079['id'],'queue_name':_0x5df963['name'],'VoiceQueueId':_0x5df963['id'],'interface':_0x16e1b1,'paused':_0x42f079[_0x3718('0x99')]||![],'penalty':_0x5df963[_0x3718('0xf4')]||0x0};});return db[_0x3718('0xa7')][_0x3718('0x81')](_0x542949);}}}})[_0x3718('0x24')](function(){if(_0x42f079){return db[_0x3718('0xf5')]['findAll']({'where':{'membername':_0x42f079[_0x3718('0x35')],'exitAt':null}});}})[_0x3718('0x24')](function(_0x111ec2){if(_0x42f079){var _0x1f16dd=[];_0x111ec2['forEach'](function(_0x36867f){_0x1f16dd[_0x3718('0x4c')](_0x36867f[_0x3718('0x23')]({'exitAt':moment()[_0x3718('0xa6')](_0x3718('0xf6'))}));});return Promise[_0x3718('0x51')](_0x1f16dd);}})['then'](function(){if(_0x42f079){var _0x22355e=[];var _0x9e1ff3=[];var _0x5081d5=utils[_0x3718('0xf7')]();var _0x36040e={'membername':_0x42f079[_0x3718('0x35')],'interface':_0x16e1b1,'enterAt':moment()[_0x3718('0xa6')](_0x3718('0xf6')),'role':_0x42f079['role'],'internal':_0x42f079[_0x3718('0x5d')]};_0x5081d5['forEach'](function(_0x532c31){_0x22355e[_0x3718('0x4c')](_['merge']({'channel':_0x532c31,'type':_0x3718('0xf8'),'data1':_0x50e0fd[_0x3718('0x59')][_0x3718('0xf9')],'data2':_0x16e1b1},_0x36040e));if(_0x42f079[_0x3718('0x99')]){_0x9e1ff3['push'](_[_0x3718('0xcd')]({'channel':_0x532c31,'type':_0x3718('0xfa'),'data1':'LOGININPAUSE'},_0x36040e));}});return db[_0x3718('0xf5')][_0x3718('0x81')](_0x22355e[_0x3718('0xbe')](_0x9e1ff3),{'individualHooks':!![]});}})['then'](function(){if(_0x42f079){return _0x42f079[_0x3718('0x23')]({'online':!![],'lastLoginAt':moment()[_0x3718('0xa6')](_0x3718('0xf6')),'voicePause':_0x42f079['loginInPause']||![],'mailPause':_0x42f079[_0x3718('0x99')]||![],'chatPause':_0x42f079[_0x3718('0x99')]||![],'faxPause':_0x42f079[_0x3718('0x99')]||![],'smsPause':_0x42f079['loginInPause']||![],'openchannelPause':_0x42f079[_0x3718('0x99')]||![],'whatsappPause':_0x42f079[_0x3718('0x99')]||![],'pauseType':_0x42f079[_0x3718('0x99')]?_0x3718('0xfb'):null,'interface':_0x16e1b1,'lastPauseAt':moment()[_0x3718('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x3718('0x24')](function(_0x44b88f){if(_0x50e0fd['isMiddleware']){return _0xf5bdc();}else{return Promise[_0x3718('0xfc')](_0x44b88f)[_0x3718('0x24')](respondWithResult(_0x508a61,null));}})['catch'](handleError(_0x508a61,null));};exports[_0x3718('0xfd')]=function(_0x3750a4,_0x8c99e){var _0xcbddff;return db['User'][_0x3718('0x32')]({'where':{'id':_0x3750a4[_0x3718('0x54')]['id'],'role':_0x3718('0x6a')},'attributes':['id',_0x3718('0x35'),_0x3718('0x28')]})[_0x3718('0x24')](handleEntityNotFound(_0x8c99e,null))[_0x3718('0x24')](function(_0x19e5ac){if(_0x19e5ac){_0xcbddff=_0x19e5ac;return db[_0x3718('0xa7')]['destroy']({'where':{'membername':_0xcbddff[_0x3718('0x35')]},'individualHooks':!![]});}})[_0x3718('0x24')](function(){return db[_0x3718('0xf5')][_0x3718('0x48')]({'where':{'membername':_0xcbddff[_0x3718('0x35')],'exitAt':null}});})['then'](function(_0x4d8371){var _0x59c208=[];_0x4d8371[_0x3718('0xfe')](function(_0x2703cd){_0x59c208['push'](_0x2703cd[_0x3718('0x23')]({'exitAt':moment()[_0x3718('0xa6')](_0x3718('0xf6'))}));});return Promise[_0x3718('0x51')](_0x59c208);})[_0x3718('0x24')](function(){return _0xcbddff['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3718('0x24')](respondWithResult(_0x8c99e,null))[_0x3718('0x52')](handleError(_0x8c99e,null));};exports['pause']=function(_0x3054b7,_0xcf0b15){var _0x5a9b2b;return db[_0x3718('0xa7')]['update']({'paused':0x1},{'where':{'UserId':_0x3054b7[_0x3718('0x54')]['id']},'individualHooks':!![]})[_0x3718('0x24')](function(){return db[_0x3718('0x37')]['find']({'where':{'id':_0x3054b7[_0x3718('0x54')]['id'],'role':_0x3718('0x6a')},'attributes':['id',_0x3718('0x35'),_0x3718('0x28'),'internal',_0x3718('0xa5'),'online']});})[_0x3718('0x24')](handleEntityNotFound(_0xcf0b15,null))[_0x3718('0x24')](function(_0x5db497){if(_0x5db497){_0x5a9b2b=_0x5db497;return respondWithRpcPromise(_0x3718('0xff'),_0x3718('0x100'),{'id':_0x5a9b2b['id'],'name':_0x5a9b2b[_0x3718('0x35')],'pause':!![]});}})[_0x3718('0x24')](function(){if(_0x5a9b2b){return db[_0x3718('0xf5')][_0x3718('0x48')]({'where':{'membername':_0x5a9b2b['name'],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x21d413){if(_0x21d413['length']){var _0x2082e9=moment()[_0x3718('0xa6')](_0x3718('0xf6'));for(var _0x3e7817=0x0,_0x2d08e5=_0x21d413[_0x3718('0x4b')];_0x3e7817<_0x2d08e5;_0x3e7817++){_0x21d413[_0x3e7817][_0x3718('0x101')]({'exitAt':_0x2082e9});}}})[_0x3718('0x24')](function(){var _0x5a59d8=[];var _0x38ba44=utils[_0x3718('0xf7')]();_0x38ba44[_0x3718('0xfe')](function(_0x1ef4e1){_0x5a59d8[_0x3718('0x4c')]({'channel':_0x1ef4e1,'membername':_0x5a9b2b['name'],'interface':_[_0x3718('0x60')](_0x5a9b2b['interface'])?util['format'](_0x3718('0xea'),_0x5a9b2b[_0x3718('0x35')]):_0x5a9b2b[_0x3718('0xa5')],'type':_0x3718('0xfa'),'enterAt':moment()[_0x3718('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3054b7['body']['type']||_0x3718('0x102'),'role':_0x5a9b2b[_0x3718('0x28')],'internal':_0x5a9b2b[_0x3718('0x5d')]});});return db[_0x3718('0xf5')][_0x3718('0x81')](_0x5a59d8,{'individualHooks':!![]});})[_0x3718('0x24')](function(){return _0x5a9b2b[_0x3718('0x23')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3054b7[_0x3718('0x59')][_0x3718('0x39')]||_0x3718('0x102'),'lastPauseAt':moment()[_0x3718('0xa6')](_0x3718('0xf6'))});})[_0x3718('0x24')](respondWithResult(_0xcf0b15,null))[_0x3718('0x52')](handleError(_0xcf0b15,null));};exports[_0x3718('0x103')]=function(_0x587838,_0xcbfdff){if(_0x587838[_0x3718('0x59')]['channel']&&!utils[_0x3718('0x9b')](_0x587838[_0x3718('0x59')]['channel'])){throw new APIBadRequestError(util[_0x3718('0xa6')](_0x3718('0x104'),_0x587838[_0x3718('0x59')]['channel']));}return db[_0x3718('0x37')][_0x3718('0x32')]({'where':{'id':_0x587838['params']['id']},'attributes':['id',_0x3718('0x35'),_0x3718('0x28'),'internal',_0x3718('0xa5'),_0x3718('0x98'),_0x3718('0x9a'),_0x3718('0x105'),_0x3718('0x106'),'faxPause',_0x3718('0x107'),_0x3718('0x108'),_0x3718('0x109'),_0x3718('0x10a'),_0x3718('0x10b')]})['then'](function(_0x5efb35){if(!_0x5efb35){throw new APINotFoundError(util[_0x3718('0xa6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x587838['params']['id']));}return _0x5efb35[_0x3718('0x103')](_0x587838['body'][_0x3718('0x97')]);})[_0x3718('0x24')](respondWithResult(_0xcbfdff,null))[_0x3718('0x52')](APIHandleError(_0xcbfdff));};exports[_0x3718('0x10c')]=function(_0x545433,_0x1e513d){var _0x50f01a={};var _0x5f3c43={};var _0x11c8ad;var _0x3834a4;return db[_0x3718('0x37')][_0x3718('0x91')]({'where':{'id':_0x545433[_0x3718('0x54')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x1e513d,null))[_0x3718('0x24')](function(_0x43c0f5){if(_0x43c0f5){_0x11c8ad=_0x43c0f5;_0x5f3c43['model']=_[_0x3718('0xc7')](db[_0x3718('0x10d')][_0x3718('0xc6')]);_0x5f3c43[_0x3718('0x44')]=_[_0x3718('0xc7')](_0x545433['query']);_0x5f3c43[_0x3718('0xcc')]=_[_0x3718('0xd2')](_0x5f3c43['model'],_0x5f3c43[_0x3718('0x44')]);_0x50f01a[_0x3718('0x47')]=_[_0x3718('0xd2')](_0x5f3c43['model'],qs[_0x3718('0xc8')](_0x545433['query'][_0x3718('0xc8')]));_0x50f01a[_0x3718('0x47')]=_0x50f01a[_0x3718('0x47')][_0x3718('0x4b')]?_0x50f01a[_0x3718('0x47')]:_0x5f3c43[_0x3718('0xc5')];_0x50f01a[_0x3718('0xc9')]=qs[_0x3718('0xca')](_0x545433[_0x3718('0x44')]['sort']);_0x50f01a[_0x3718('0xcb')]=qs[_0x3718('0xcc')](_['pick'](_0x545433[_0x3718('0x44')],_0x5f3c43[_0x3718('0xcc')]));if(_0x545433['query']['filter']){_0x50f01a['where']=_['merge'](_0x50f01a[_0x3718('0xcb')],{'$or':_[_0x3718('0x2f')](_0x50f01a[_0x3718('0x47')],function(_0x23421b){var _0x186383={};_0x186383[_0x23421b]={'$like':'%'+_0x545433[_0x3718('0x44')]['filter']+'%'};return _0x186383;})});}_0x50f01a=_[_0x3718('0xcd')]({},_0x50f01a,_0x545433[_0x3718('0xce')]);return _0x11c8ad['getTeams'](_0x50f01a);}})['then'](function(_0x23bb93){if(_0x23bb93){_0x3834a4=_0x23bb93['length'];if(!_0x545433[_0x3718('0x44')][_0x3718('0xc0')](_0x3718('0xd4'))){_0x50f01a[_0x3718('0x15')]=qs[_0x3718('0x15')](_0x545433[_0x3718('0x44')][_0x3718('0x15')]);_0x50f01a[_0x3718('0x13')]=qs[_0x3718('0x13')](_0x545433[_0x3718('0x44')]['offset']);}return _0x11c8ad['getTeams'](_0x50f01a);}})[_0x3718('0x24')](function(_0x378254){if(_0x378254){return _0x378254?{'count':_0x3834a4,'rows':_0x378254}:null;}})[_0x3718('0x24')](respondWithResult(_0x1e513d,null))[_0x3718('0x52')](handleError(_0x1e513d,null));};exports[_0x3718('0x10e')]=function(_0x3b1ee8,_0x5a4284){var _0x407abd=_0x3b1ee8['params']['id'];var _0x1aa869=_0x3b1ee8[_0x3718('0x59')]?_0x3b1ee8[_0x3718('0x59')][_0x3718('0x5c')]:null;var _0x248324=[];return Promise[_0x3718('0xfc')]()[_0x3718('0x24')](function(){if(!_0x1aa869)throw new APIBadRequestError(_0x3718('0x10f'));})[_0x3718('0x24')](function(){return db[_0x3718('0x37')][_0x3718('0x91')]({'where':{'id':_0x407abd}});})[_0x3718('0x24')](function(_0x139f3b){if(!_0x139f3b)throw new APINotFoundError(util['format'](_0x3718('0xbf'),_0x3b1ee8[_0x3718('0x54')]['id']));return db[_0x3718('0x62')]['transaction'](function(_0x2d04a8){return _0x139f3b['addTeams'](_0x1aa869,{'transaction':_0x2d04a8})[_0x3718('0x24')](function(){return db['Team'][_0x3718('0x48')]({'where':{'id':{'$in':_0x1aa869}}});})[_0x3718('0x24')](function(_0x3ef579){var _0x2d452d=_[_0x3718('0x2f')](_0x3ef579,function(_0x29a00d){return _0x29a00d[_0x3718('0x110')]();});return Promise['all'](_0x2d452d);})[_0x3718('0x24')](function(_0x4e65f9){_0x248324=_['flattenDeep'](_0x4e65f9);var _0x1a3720=_[_0x3718('0x2f')](_0x248324,function(_0x483ed7){return _0x483ed7[_0x3718('0x111')](_0x139f3b['id'],{'transaction':_0x2d04a8});});return Promise[_0x3718('0x51')](_0x1a3720);})[_0x3718('0x24')](function(){if(!_0x139f3b[_0x3718('0x98')])return;var _0x2ad3fc=_[_0x3718('0x2d')](_0x248324,function(_0x3cc7ba){return _0x3cc7ba[_0x3718('0x112')](_0x3718('0x97'))==='Voice';});var _0x1487e4=_[_0x3718('0x2f')](_0x2ad3fc,function(_0x5a183b){return db[_0x3718('0xa7')][_0x3718('0xa8')]({'membername':_0x139f3b[_0x3718('0x35')],'UserId':_0x139f3b['id'],'queue_name':_0x5a183b[_0x3718('0x35')],'VoiceQueueId':_0x5a183b['id'],'interface':_[_0x3718('0x60')](_0x139f3b[_0x3718('0xa5')])?util['format'](_0x3718('0xea'),_0x139f3b[_0x3718('0x35')]):_0x139f3b[_0x3718('0xa5')],'paused':_0x139f3b[_0x3718('0x9a')]||![],'penalty':_0x139f3b['penalty']},{'transaction':_0x2d04a8});});return Promise[_0x3718('0x51')](_0x1487e4);})[_0x3718('0x24')](function(){return db[_0x3718('0x113')]['findAll']({'where':{'teamId':{'$in':_0x1aa869}}});})[_0x3718('0x24')](function(_0x4bf5d2){var _0x2f3aa1=_[_0x3718('0x2f')](_0x4bf5d2,function(_0x4bf603){return db[_0x3718('0x114')]['create']({'UserId':_0x139f3b['id'],'VoicePrefixId':_0x4bf603['VoicePrefixId']},{'transaction':_0x2d04a8});});return Promise['all'](_0x2f3aa1);});});})[_0x3718('0x24')](function(){for(var _0x3f9620=0x0;_0x3f9620<_0x248324['length'];_0x3f9620++){var _0x3b0c58=_0x248324[_0x3f9620]['getDataValue'](_0x3718('0x97'));var _0x42fd14=_0x3b0c58+'QueueId';socket[_0x3718('0x25')](_0x3718('0x2a')+_0x3b0c58+'Queue:save',{'UserId':_0x407abd,['queueField']:_0x248324[_0x3f9620]['id']});}})[_0x3718('0x24')](respondWithStatusCode(_0x5a4284,null))['catch'](APIHandleError(_0x5a4284));};exports[_0x3718('0x115')]=function(_0x3741fc,_0x2f707a){var _0x2c2493=_0x3741fc[_0x3718('0x54')]['id'];var _0xd9d12a=null;if(_0x3741fc[_0x3718('0x44')][_0x3718('0x5c')]){_0xd9d12a=_[_0x3718('0x116')](_0x3741fc[_0x3718('0x44')]['ids'])?_0x3741fc[_0x3718('0x44')][_0x3718('0x5c')]:[_0x3741fc['query'][_0x3718('0x5c')]];}var _0x127940=[];return Promise[_0x3718('0xfc')]()[_0x3718('0x24')](function(){if(!_0xd9d12a)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x3718('0x24')](function(){return db[_0x3718('0x37')]['findOne']({'where':{'id':_0x2c2493}});})[_0x3718('0x24')](function(_0x525d11){if(!_0x525d11)throw new APINotFoundError(util[_0x3718('0xa6')](_0x3718('0xbf'),_0x3741fc[_0x3718('0x54')]['id']));return db['sequelize'][_0x3718('0xf2')](function(_0xf9d2b1){return _0x525d11[_0x3718('0x115')](_0xd9d12a,{'transaction':_0xf9d2b1})[_0x3718('0x24')](function(){return db[_0x3718('0x10d')][_0x3718('0x48')]({'where':{'id':{'$in':_0xd9d12a}}});})['then'](function(_0x279723){var _0x1debf1=_[_0x3718('0x2f')](_0x279723,function(_0x24baa5){return _0x24baa5[_0x3718('0x110')]();});return Promise[_0x3718('0x51')](_0x1debf1);})[_0x3718('0x24')](function(_0x26c487){_0x127940=_[_0x3718('0x117')](_0x26c487);var _0x47cf44=_[_0x3718('0x2f')](_0x127940,function(_0x3745df){return _0x3745df[_0x3718('0x118')](_0x525d11['id'],{'transaction':_0xf9d2b1});});return Promise[_0x3718('0x51')](_0x47cf44);})[_0x3718('0x24')](function(){if(!_0x525d11['online'])return;var _0x505f20=_['filter'](_0x127940,function(_0x1400fe){return _0x1400fe['getDataValue']('channel')===_0x3718('0x119');});var _0x3f6ee0=_['map'](_0x505f20,function(_0x37be9d){return db['UserVoiceQueueRt'][_0x3718('0x26')]({'where':{'VoiceQueueId':_0x37be9d['id'],'UserId':_0x525d11['id']},'transaction':_0xf9d2b1});});return Promise[_0x3718('0x51')](_0x3f6ee0);})['then'](function(){return db[_0x3718('0x113')][_0x3718('0x48')]({'where':{'teamId':{'$in':_0xd9d12a}}});})[_0x3718('0x24')](function(_0x7fa7a3){var _0x20b8c2=_['map'](_0x7fa7a3,function(_0x117379){return db[_0x3718('0x114')][_0x3718('0x26')]({'where':{'UserId':_0x525d11['id'],'VoicePrefixId':_0x117379['VoicePrefixId']}},{'transaction':_0xf9d2b1});});return Promise[_0x3718('0x51')](_0x20b8c2);});});})[_0x3718('0x24')](function(){for(var _0x1c9710=0x0;_0x1c9710<_0x127940[_0x3718('0x4b')];_0x1c9710++){var _0x52c7d2=_0x127940[_0x1c9710][_0x3718('0x112')]('channel');var _0x321dd7=_0x52c7d2+'QueueId';socket[_0x3718('0x25')](_0x3718('0x2a')+_0x52c7d2+'Queue:remove',{'UserId':_0x2c2493,['queueField']:_0x127940[_0x1c9710]['id']});}})[_0x3718('0x24')](respondWithStatusCode(_0x2f707a,null))[_0x3718('0x52')](APIHandleError(_0x2f707a));};exports[_0x3718('0x11a')]=function(_0x2be43d,_0x17648d){var _0x4e48a3={};var _0x15b32f={};var _0x475533;var _0x1bd692;return db['User'][_0x3718('0x91')]({'where':{'id':_0x2be43d[_0x3718('0x54')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x17648d,null))[_0x3718('0x24')](function(_0x18d511){if(_0x18d511){_0x475533=_0x18d511;_0x15b32f['model']=_[_0x3718('0xc7')](db['CmList'][_0x3718('0xc6')]);_0x15b32f[_0x3718('0x44')]=_[_0x3718('0xc7')](_0x2be43d[_0x3718('0x44')]);_0x15b32f['filters']=_[_0x3718('0xd2')](_0x15b32f[_0x3718('0xc5')],_0x15b32f[_0x3718('0x44')]);_0x4e48a3[_0x3718('0x47')]=_[_0x3718('0xd2')](_0x15b32f[_0x3718('0xc5')],qs['fields'](_0x2be43d['query'][_0x3718('0xc8')]));_0x4e48a3[_0x3718('0x47')]=_0x4e48a3['attributes'][_0x3718('0x4b')]?_0x4e48a3['attributes']:_0x15b32f['model'];_0x4e48a3[_0x3718('0xc9')]=qs[_0x3718('0xca')](_0x2be43d[_0x3718('0x44')][_0x3718('0xca')]);_0x4e48a3[_0x3718('0xcb')]=qs[_0x3718('0xcc')](_[_0x3718('0xd3')](_0x2be43d[_0x3718('0x44')],_0x15b32f['filters']));if(_0x2be43d['query'][_0x3718('0x2d')]){_0x4e48a3['where']=_['merge'](_0x4e48a3['where'],{'$or':_[_0x3718('0x2f')](_0x4e48a3[_0x3718('0x47')],function(_0x398ba7){var _0x3d1761={};_0x3d1761[_0x398ba7]={'$like':'%'+_0x2be43d[_0x3718('0x44')][_0x3718('0x2d')]+'%'};return _0x3d1761;})});}_0x4e48a3=_[_0x3718('0xcd')]({},_0x4e48a3,_0x2be43d[_0x3718('0xce')]);return _0x475533['getLists'](_0x4e48a3);}})['then'](function(_0x4eed37){if(_0x4eed37){_0x1bd692=_0x4eed37[_0x3718('0x4b')];if(!_0x2be43d[_0x3718('0x44')][_0x3718('0xc0')](_0x3718('0xd4'))){_0x4e48a3[_0x3718('0x15')]=qs[_0x3718('0x15')](_0x2be43d['query'][_0x3718('0x15')]);_0x4e48a3[_0x3718('0x13')]=qs[_0x3718('0x13')](_0x2be43d[_0x3718('0x44')][_0x3718('0x13')]);}return _0x475533[_0x3718('0x11a')](_0x4e48a3);}})[_0x3718('0x24')](function(_0x2c2f01){if(_0x2c2f01){return _0x2c2f01?{'count':_0x1bd692,'rows':_0x2c2f01}:null;}})['then'](respondWithResult(_0x17648d,null))['catch'](handleError(_0x17648d,null));};exports['getAgents']=function(_0x15fb23,_0x4035c0){var _0x382f25={};var _0x441d95={};var _0x3db349;return db[_0x3718('0x37')][_0x3718('0x91')]({'where':{'id':_0x15fb23[_0x3718('0x54')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x4035c0,null))[_0x3718('0x24')](function(_0x581b29){if(_0x581b29){_0x3db349=_0x581b29;_0x441d95[_0x3718('0xc5')]=_['keys'](db[_0x3718('0x37')][_0x3718('0xc6')]);_0x441d95[_0x3718('0x44')]=_[_0x3718('0xc7')](_0x15fb23[_0x3718('0x44')]);_0x441d95[_0x3718('0xcc')]=_[_0x3718('0xd2')](_0x441d95[_0x3718('0xc5')],_0x441d95[_0x3718('0x44')]);_0x382f25[_0x3718('0x47')]=_['intersection'](_0x441d95[_0x3718('0xc5')],qs[_0x3718('0xc8')](_0x15fb23[_0x3718('0x44')]['fields']));_0x382f25[_0x3718('0x47')]=_0x382f25[_0x3718('0x47')][_0x3718('0x4b')]?_0x382f25[_0x3718('0x47')]:_0x441d95[_0x3718('0xc5')];_0x382f25[_0x3718('0xc9')]=qs['sort'](_0x15fb23[_0x3718('0x44')][_0x3718('0xca')]);_0x382f25[_0x3718('0xcb')]=qs['filters'](_[_0x3718('0xd3')](_0x15fb23[_0x3718('0x44')],_0x441d95[_0x3718('0xcc')]));if(_0x15fb23[_0x3718('0x44')][_0x3718('0x2d')]){_0x382f25[_0x3718('0xcb')]=_[_0x3718('0xcd')](_0x382f25[_0x3718('0xcb')],{'$or':_['map'](_0x382f25['attributes'],function(_0x2f89d5){var _0x2e3dbf={};_0x2e3dbf[_0x2f89d5]={'$like':'%'+_0x15fb23[_0x3718('0x44')]['filter']+'%'};return _0x2e3dbf;})});}_0x382f25[_0x3718('0xc5')]=db[_0x3718('0x37')];_0x382f25['as']=_0x3718('0x2b');_0x382f25=_[_0x3718('0xcd')]({},_0x382f25,_0x15fb23['options']);return _0x3db349[_0x3718('0x11b')]({'include':[_0x382f25]});}})[_0x3718('0x24')](function(_0x1a9ad1){if(_0x1a9ad1){var _0xfa5b70={},_0x4c16fa=[];for(var _0x5b5b4f=0x0;_0x5b5b4f<_0x1a9ad1['length'];_0x5b5b4f+=0x1){for(var _0x4e769d=0x0,_0x1a3935;_0x4e769d<_0x1a9ad1[_0x5b5b4f][_0x3718('0x2b')]['length'];_0x4e769d+=0x1){_0x1a3935=_0x1a9ad1[_0x5b5b4f][_0x3718('0x2b')][_0x4e769d][_0x3718('0x27')]({'plain':!![]});_0xfa5b70[_0x1a3935['id']]=_0x1a3935;}}_0xfa5b70=_[_0x3718('0x11c')](_0xfa5b70);for(var _0x19d9a1=qs['offset'](_0x15fb23['query'][_0x3718('0x13')]);_0x19d9a1<_0xfa5b70[_0x3718('0x4b')]&&_0x4c16fa[_0x3718('0x4b')]=_0xcf1259[_0x9f4d('0x4e')]){throw new Error(_0x9f4d('0x4f'));}})[_0x9f4d('0x15')](function(){if(_0x5245e5){return db[_0x9f4d('0x26')][_0x9f4d('0x45')]({'where':{'membername':_0x5245e5['name']},'individualHooks':!![]});}})[_0x9f4d('0x15')](function(){if(_0x5245e5){return _0x5245e5[_0x9f4d('0x50')]({'raw':!![]});}})['then'](function(_0x79cde2){if(_0x5245e5){if(_0x79cde2){var _0x4dcdf4=[];_0x351613=_0x79cde2;if(_0x351613['length']){for(var _0x44350f=0x0;_0x44350f<_0x351613[_0x9f4d('0x2a')];_0x44350f++){_0x4dcdf4[_0x9f4d('0x2f')](db['UserVoiceQueueRt'][_0x9f4d('0x51')]({'membername':_0x5245e5[_0x9f4d('0x20')],'UserId':_0x5245e5['id'],'queue_name':_0x351613[_0x44350f][_0x9f4d('0x20')],'VoiceQueueId':_0x351613[_0x44350f]['id'],'interface':_0x2fde28,'paused':_0x5245e5[_0x9f4d('0x49')]||![],'penalty':_0x351613[_0x44350f][_0x9f4d('0x52')]||0x0}));}return BPromise[_0x9f4d('0x46')](_0x4dcdf4);}}}})[_0x9f4d('0x15')](function(){if(_0x5245e5){return db[_0x9f4d('0x28')][_0x9f4d('0xe')]({'where':{'membername':_0x5245e5['name'],'exitAt':null}});}})[_0x9f4d('0x15')](function(_0x4f1a4e){if(_0x5245e5){if(_0x4f1a4e&&_0x4f1a4e[_0x9f4d('0x2a')]){var _0x157c1f=[];_0x4f1a4e[_0x9f4d('0x2e')](function(_0x54c96a){_0x157c1f[_0x9f4d('0x2f')](_0x54c96a[_0x9f4d('0x27')]({'exitAt':moment()[_0x9f4d('0x23')](_0x9f4d('0x2b'))}));});return BPromise[_0x9f4d('0x46')](_0x157c1f);}}})[_0x9f4d('0x15')](function(){if(_0x5245e5){var _0x3bfb08=[];var _0x4e7e42=[];var _0x207c81=utils[_0x9f4d('0x2d')]();var _0x9cb63a={'membername':_0x5245e5[_0x9f4d('0x20')],'interface':_0x2fde28,'enterAt':moment()[_0x9f4d('0x23')](_0x9f4d('0x2b')),'role':_0x5245e5[_0x9f4d('0x21')],'internal':_0x5245e5[_0x9f4d('0x22')]};_0x207c81[_0x9f4d('0x2e')](function(_0x8a7929){_0x3bfb08[_0x9f4d('0x2f')](_[_0x9f4d('0x53')]({'channel':_0x8a7929,'type':_0x9f4d('0x54'),'data1':_0x9f4d('0x55'),'data2':_0x2fde28},_0x9cb63a));if(_0x5245e5[_0x9f4d('0x49')]){_0x4e7e42[_0x9f4d('0x2f')](_[_0x9f4d('0x53')]({'channel':_0x8a7929,'type':_0x9f4d('0x29'),'data1':_0x9f4d('0x56')},_0x9cb63a));}});return db[_0x9f4d('0x28')][_0x9f4d('0x35')](_0x3bfb08[_0x9f4d('0x57')](_0x4e7e42),{'individualHooks':!![]});}})['then'](function(){if(_0x5245e5){return _0x5245e5[_0x9f4d('0x27')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5245e5[_0x9f4d('0x49')]||![],'mailPause':_0x5245e5[_0x9f4d('0x49')]||![],'chatPause':_0x5245e5[_0x9f4d('0x49')]||![],'faxPause':_0x5245e5[_0x9f4d('0x49')]||![],'smsPause':_0x5245e5[_0x9f4d('0x49')]||![],'openchannelPause':_0x5245e5[_0x9f4d('0x49')]||![],'pauseType':_0x5245e5['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x9f4d('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2fde28});}})[_0x9f4d('0x15')](function(_0x494965){_0x51df11(_0x494965);})[_0x9f4d('0x18')](function(_0x43314e){_0x187159(_0xea86b0[_0x9f4d('0x19')](0x1f4,_0x43314e[_0x9f4d('0x1a')]));});});}; \ No newline at end of file +var _0x0825=['model','then','debug','stringify','catch','error','message','ShowUser','info','PauseUser','find','name','internal','interface','User\x20with\x20id\x20%s\x20not\x20found','params','MemberReport','PAUSE','length','format','updateAttributes','getChannels','forEach','push','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','role','uniqueid','update','type','UnpauseUser','resolve','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','findOne','online','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','LogoutUser','destroy','all','LoginUser','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueueRt','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','concat','lodash','util','bluebird','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x2104f4,_0x40fea9){var _0x136b63=function(_0x1275b9){while(--_0x1275b9){_0x2104f4['push'](_0x2104f4['shift']());}};_0x136b63(++_0x40fea9);}(_0x0825,0x142));var _0x5082=function(_0x12172f,_0x20b1f8){_0x12172f=_0x12172f-0x0;var _0x5d146e=_0x0825[_0x12172f];return _0x5d146e;};'use strict';var _=require(_0x5082('0x0'));var util=require(_0x5082('0x1'));var moment=require('moment');var BPromise=require(_0x5082('0x2'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5082('0x3'));var logger=require('../../config/logger')(_0x5082('0x4'));var config=require(_0x5082('0x5'));config[_0x5082('0x6')]=_[_0x5082('0x7')](config[_0x5082('0x6')],{'host':_0x5082('0x8'),'port':0x18eb});var socket=require(_0x5082('0x9'))(new Redis(config[_0x5082('0x6')]));require(_0x5082('0xa'))[_0x5082('0xb')](socket);exports[_0x5082('0xc')]=function(_0x47cc01){var _0xab44b8=this;return new Promise(function(_0xcec464,_0x103132){return db[_0x5082('0xd')][_0x5082('0xe')]({'raw':_0x47cc01[_0x5082('0xf')]?_0x47cc01[_0x5082('0xf')][_0x5082('0x10')]===undefined?!![]:![]:!![],'where':_0x47cc01[_0x5082('0xf')]?_0x47cc01[_0x5082('0xf')][_0x5082('0x11')]||null:null,'attributes':_0x47cc01[_0x5082('0xf')]?_0x47cc01[_0x5082('0xf')][_0x5082('0x12')]||null:null,'limit':_0x47cc01['options']?_0x47cc01[_0x5082('0xf')][_0x5082('0x13')]||null:null,'include':_0x47cc01['options']?_0x47cc01['options'][_0x5082('0x14')]?_[_0x5082('0x15')](_0x47cc01[_0x5082('0xf')]['include'],function(_0x5ec16c){return{'model':db[_0x5ec16c[_0x5082('0x16')]],'as':_0x5ec16c['as'],'attributes':_0x5ec16c[_0x5082('0x12')],'include':_0x5ec16c[_0x5082('0x14')]?_[_0x5082('0x15')](_0x5ec16c['include'],function(_0x3187ba){return{'model':db[_0x3187ba[_0x5082('0x16')]],'as':_0x3187ba['as'],'attributes':_0x3187ba[_0x5082('0x12')],'include':_0x3187ba[_0x5082('0x14')]?_[_0x5082('0x15')](_0x3187ba[_0x5082('0x14')],function(_0x444d0b){return{'model':db[_0x444d0b[_0x5082('0x16')]],'as':_0x444d0b['as'],'attributes':_0x444d0b[_0x5082('0x12')]};}):[]};}):[]};}):[]:[]})[_0x5082('0x17')](function(_0x462382){logger['info']('GetUser',_0x47cc01);logger[_0x5082('0x18')](_0x5082('0xc'),_0x47cc01,JSON[_0x5082('0x19')](_0x462382));_0xcec464(_0x462382);})[_0x5082('0x1a')](function(_0x4f2b99){logger[_0x5082('0x1b')]('GetUser',_0x4f2b99[_0x5082('0x1c')],_0x47cc01);_0x103132(_0xab44b8[_0x5082('0x1b')](0x1f4,_0x4f2b99['message']));});});};exports[_0x5082('0x1d')]=function(_0x1751c7){var _0x4e69fa=this;return new Promise(function(_0x49e131,_0x2b9050){return db[_0x5082('0xd')]['find']({'raw':_0x1751c7['options']?_0x1751c7['options'][_0x5082('0x10')]===undefined?!![]:![]:!![],'where':_0x1751c7[_0x5082('0xf')]?_0x1751c7['options'][_0x5082('0x11')]||null:null,'attributes':_0x1751c7[_0x5082('0xf')]?_0x1751c7[_0x5082('0xf')]['attributes']||null:null,'include':_0x1751c7[_0x5082('0xf')]?_0x1751c7['options'][_0x5082('0x14')]?_[_0x5082('0x15')](_0x1751c7[_0x5082('0xf')][_0x5082('0x14')],function(_0x1dfe22){return{'model':db[_0x1dfe22['model']],'as':_0x1dfe22['as'],'attributes':_0x1dfe22['attributes'],'include':_0x1dfe22['include']?_[_0x5082('0x15')](_0x1dfe22[_0x5082('0x14')],function(_0x2be49e){return{'model':db[_0x2be49e[_0x5082('0x16')]],'as':_0x2be49e['as'],'attributes':_0x2be49e[_0x5082('0x12')],'include':_0x2be49e['include']?_[_0x5082('0x15')](_0x2be49e[_0x5082('0x14')],function(_0x39d2b3){return{'model':db[_0x39d2b3[_0x5082('0x16')]],'as':_0x39d2b3['as'],'attributes':_0x39d2b3[_0x5082('0x12')]};}):[]};}):[]};}):[]:[]})[_0x5082('0x17')](function(_0xb458c3){logger[_0x5082('0x1e')]('ShowUser',_0x1751c7);logger['debug'](_0x5082('0x1d'),_0x1751c7,JSON['stringify'](_0xb458c3));_0x49e131(_0xb458c3);})['catch'](function(_0x528955){logger['error'](_0x5082('0x1d'),_0x528955[_0x5082('0x1c')],_0x1751c7);_0x2b9050(_0x4e69fa[_0x5082('0x1b')](0x1f4,_0x528955['message']));});});};exports[_0x5082('0x1f')]=function(_0x188da3){var _0x2f9154;return db[_0x5082('0xd')][_0x5082('0x20')]({'where':_0x188da3[_0x5082('0xf')][_0x5082('0x11')]||{},'attributes':['id',_0x5082('0x21'),'role',_0x5082('0x22'),_0x5082('0x23')]})[_0x5082('0x17')](function(_0x4b703f){if(!_0x4b703f){throw new Error(util['format'](_0x5082('0x24'),_0x188da3[_0x5082('0x25')]['id']));}_0x2f9154=_0x4b703f;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x2f9154['id']},'individualHooks':!![]});})['then'](function(){return db[_0x5082('0x26')][_0x5082('0xe')]({'where':{'membername':_0x2f9154['name'],'type':_0x5082('0x27'),'exitAt':null}});})[_0x5082('0x17')](function(_0x3391d4){if(_0x3391d4&&_0x3391d4[_0x5082('0x28')]){var _0x6a5f85=moment()[_0x5082('0x29')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x183256=0x0,_0xfa0d1c=_0x3391d4[_0x5082('0x28')];_0x183256<_0xfa0d1c;_0x183256++){_0x3391d4[_0x183256][_0x5082('0x2a')]({'exitAt':_0x6a5f85});}}})[_0x5082('0x17')](function(){var _0x304913=[];var _0x46ec7b=utils[_0x5082('0x2b')]();_0x46ec7b[_0x5082('0x2c')](function(_0x5c897a){_0x304913[_0x5082('0x2d')]({'channel':_0x5c897a,'membername':_0x2f9154[_0x5082('0x21')],'interface':_['isNil'](_0x2f9154['interface'])?util[_0x5082('0x29')](_0x5082('0x2e'),_0x2f9154[_0x5082('0x21')]):_0x2f9154[_0x5082('0x23')],'type':'PAUSE','enterAt':moment()['format'](_0x5082('0x2f')),'data1':_0x188da3[_0x5082('0x30')]['type']||'DEFAULT\x20PAUSE','role':_0x2f9154[_0x5082('0x31')],'internal':_0x2f9154[_0x5082('0x22')],'uniqueid':_0x188da3[_0x5082('0x30')][_0x5082('0x32')]||null});});return db[_0x5082('0x26')]['bulkCreate'](_0x304913,{'individualHooks':!![]});})[_0x5082('0x17')](function(){return _0x2f9154[_0x5082('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x188da3[_0x5082('0x30')][_0x5082('0x34')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x5082('0x1a')](function(_0x349df2){throw _0x349df2;});};exports[_0x5082('0x35')]=function(_0x579d29){return Promise[_0x5082('0x36')]()[_0x5082('0x17')](function(){if(_0x579d29['body']['channel']&&!utils[_0x5082('0x37')](_0x579d29['body']['channel'])){throw new Error(util[_0x5082('0x29')](_0x5082('0x38'),_0x579d29[_0x5082('0x30')][_0x5082('0x39')]));}return db[_0x5082('0xd')][_0x5082('0x3a')]({'where':_0x579d29[_0x5082('0xf')][_0x5082('0x11')]||{},'attributes':['id',_0x5082('0x21'),_0x5082('0x31'),'internal','interface',_0x5082('0x3b'),'voicePause','mailPause',_0x5082('0x3c'),'faxPause',_0x5082('0x3d'),_0x5082('0x3e'),_0x5082('0x3f'),_0x5082('0x40'),_0x5082('0x41')]});})['then'](function(_0xd86486){if(!_0xd86486){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x579d29[_0x5082('0x25')]['id']));}return _0xd86486['unpause'](_0x579d29[_0x5082('0x30')][_0x5082('0x39')],'system');})[_0x5082('0x1a')](function(_0x595ee7){throw _0x595ee7;});};exports[_0x5082('0x42')]=function(_0x12db17){var _0x598d85=this;return new Promise(function(_0x120f5f,_0x33f1f1){var _0xd92b7d;return db[_0x5082('0xd')]['findOne']({'where':_0x12db17['options'][_0x5082('0x11')]||{},'attributes':['id',_0x5082('0x21')]})[_0x5082('0x17')](function(_0x44bbd3){if(_0x44bbd3){_0xd92b7d=_0x44bbd3;return db['UserVoiceQueueRt'][_0x5082('0x43')]({'where':{'membername':_0xd92b7d[_0x5082('0x21')]},'individualHooks':!![]});}})[_0x5082('0x17')](function(){if(_0xd92b7d){return db['MemberReport']['findAll']({'where':{'membername':_0xd92b7d['name'],'exitAt':null}});}})[_0x5082('0x17')](function(_0x206df6){if(_0xd92b7d){if(_0x206df6&&_0x206df6[_0x5082('0x28')]){var _0x41680b=[];_0x206df6[_0x5082('0x2c')](function(_0x5696ef){_0x41680b[_0x5082('0x2d')](_0x5696ef['update']({'exitAt':moment()['format'](_0x5082('0x2f'))}));});return BPromise[_0x5082('0x44')](_0x41680b);}}})[_0x5082('0x17')](function(){if(_0xd92b7d){return _0xd92b7d[_0x5082('0x33')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x5082('0x17')](function(_0x4faf91){_0x120f5f(_0x4faf91);})[_0x5082('0x1a')](function(_0x28613b){_0x33f1f1(_0x598d85[_0x5082('0x1b')](0x1f4,_0x28613b['message']));});});};exports[_0x5082('0x45')]=function(_0x12e570){var _0x9b9e7b=this;return new Promise(function(_0x145615,_0x2561de){var _0x1a208d;var _0x518422;var _0x4e58f4;var _0x12b35c;return db[_0x5082('0xd')]['findOne']({'where':_0x12e570[_0x5082('0xf')][_0x5082('0x11')]||{},'attributes':['id',_0x5082('0x21'),_0x5082('0x31'),'mobile','phone',_0x5082('0x22'),_0x5082('0x46'),_0x5082('0x23')]})['then'](function(_0x3475e4){if(_0x3475e4){_0x1a208d=_0x3475e4;_0x12b35c=_0x12e570[_0x5082('0x30')][_0x5082('0x23')]?_0x12e570[_0x5082('0x30')][_0x5082('0x23')]:util[_0x5082('0x29')](_0x5082('0x2e'),_0x1a208d[_0x5082('0x21')]);return db[_0x5082('0xd')][_0x5082('0x47')]({'where':{'role':_0x5082('0x48'),'online':!![],'id':{'$ne':_0x1a208d['id']}}});}})[_0x5082('0x17')](function(_0x4a2445){if(_0x4a2445){_0x4e58f4=_0x4a2445;return require(_0x5082('0x49'))[_0x5082('0x4a')]();}})[_0x5082('0x17')](function(_0x22a747){if(_0x22a747&&_0x22a747[_0x5082('0x4b')]&&_0x4e58f4>=_0x22a747['agents']){throw new Error(_0x5082('0x4c'));}})['then'](function(){if(_0x1a208d){return db[_0x5082('0x4d')][_0x5082('0x43')]({'where':{'membername':_0x1a208d[_0x5082('0x21')]},'individualHooks':!![]});}})[_0x5082('0x17')](function(){if(_0x1a208d){return _0x1a208d[_0x5082('0x4e')]({'raw':!![]});}})[_0x5082('0x17')](function(_0x2f0238){if(_0x1a208d){if(_0x2f0238){var _0xd407eb=[];_0x518422=_0x2f0238;if(_0x518422[_0x5082('0x28')]){for(var _0x195055=0x0;_0x195055<_0x518422[_0x5082('0x28')];_0x195055++){_0xd407eb['push'](db[_0x5082('0x4d')][_0x5082('0x4f')]({'membername':_0x1a208d[_0x5082('0x21')],'UserId':_0x1a208d['id'],'queue_name':_0x518422[_0x195055]['name'],'VoiceQueueId':_0x518422[_0x195055]['id'],'interface':_0x12b35c,'paused':_0x1a208d['loginInPause']||![],'penalty':_0x518422[_0x195055][_0x5082('0x50')]||0x0}));}return BPromise[_0x5082('0x44')](_0xd407eb);}}}})['then'](function(){if(_0x1a208d){return db[_0x5082('0x26')]['findAll']({'where':{'membername':_0x1a208d[_0x5082('0x21')],'exitAt':null}});}})[_0x5082('0x17')](function(_0x5f1ba6){if(_0x1a208d){if(_0x5f1ba6&&_0x5f1ba6['length']){var _0x41ff3f=[];_0x5f1ba6[_0x5082('0x2c')](function(_0x488d19){_0x41ff3f[_0x5082('0x2d')](_0x488d19[_0x5082('0x33')]({'exitAt':moment()[_0x5082('0x29')](_0x5082('0x2f'))}));});return BPromise['all'](_0x41ff3f);}}})[_0x5082('0x17')](function(){if(_0x1a208d){var _0x14ec7c=[];var _0x47b540=[];var _0x4e7df6=utils[_0x5082('0x2b')]();var _0x477335={'membername':_0x1a208d['name'],'interface':_0x12b35c,'enterAt':moment()[_0x5082('0x29')](_0x5082('0x2f')),'role':_0x1a208d[_0x5082('0x31')],'internal':_0x1a208d[_0x5082('0x22')]};_0x4e7df6[_0x5082('0x2c')](function(_0x1be041){_0x14ec7c[_0x5082('0x2d')](_['merge']({'channel':_0x1be041,'type':_0x5082('0x51'),'data1':_0x5082('0x52'),'data2':_0x12b35c},_0x477335));if(_0x1a208d['loginInPause']){_0x47b540[_0x5082('0x2d')](_[_0x5082('0x53')]({'channel':_0x1be041,'type':'PAUSE','data1':_0x5082('0x54')},_0x477335));}});return db['MemberReport']['bulkCreate'](_0x14ec7c[_0x5082('0x55')](_0x47b540),{'individualHooks':!![]});}})[_0x5082('0x17')](function(){if(_0x1a208d){return _0x1a208d[_0x5082('0x33')]({'online':!![],'lastLoginAt':moment()[_0x5082('0x29')](_0x5082('0x2f')),'voicePause':_0x1a208d['loginInPause']||![],'mailPause':_0x1a208d[_0x5082('0x46')]||![],'chatPause':_0x1a208d['loginInPause']||![],'faxPause':_0x1a208d[_0x5082('0x46')]||![],'smsPause':_0x1a208d[_0x5082('0x46')]||![],'openchannelPause':_0x1a208d['loginInPause']||![],'pauseType':_0x1a208d[_0x5082('0x46')]?_0x5082('0x54'):null,'lastPauseAt':moment()[_0x5082('0x29')](_0x5082('0x2f')),'interface':_0x12b35c});}})[_0x5082('0x17')](function(_0x2ed000){_0x145615(_0x2ed000);})[_0x5082('0x1a')](function(_0x2a3de5){_0x2561de(_0x9b9e7b[_0x5082('0x1b')](0x1f4,_0x2a3de5[_0x5082('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 167ff29..8f0fbe2 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 _0xc53d=['remove','update','emit','register','length','user:','./user.events','save'];(function(_0x2077be,_0x26136a){var _0x198bbf=function(_0x2fd7e3){while(--_0x2fd7e3){_0x2077be['push'](_0x2077be['shift']());}};_0x198bbf(++_0x26136a);}(_0xc53d,0xe6));var _0xdc53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc53d[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0xdc53('0x0'));var events=[_0xdc53('0x1'),_0xdc53('0x2'),_0xdc53('0x3')];function createListener(_0x3a067d,_0x47a2ff){return function(_0x195113){_0x47a2ff[_0xdc53('0x4')](_0x3a067d,_0x195113);};}function removeListener(_0x1470c2,_0x3b35cd){return function(){UserEvents['removeListener'](_0x1470c2,_0x3b35cd);};}exports[_0xdc53('0x5')]=function(_0x4c73d4){for(var _0x4f3a89=0x0,_0x3e5163=events[_0xdc53('0x6')];_0x4f3a89<_0x3e5163;_0x4f3a89++){var _0x55d6c6=events[_0x4f3a89];var _0x33b1e7=createListener(_0xdc53('0x7')+_0x55d6c6,_0x4c73d4);UserEvents['on'](_0x55d6c6,_0x33b1e7);}}; \ No newline at end of file +var _0x0848=['emit','removeListener','length','user:','save','remove','update'];(function(_0x28cb64,_0x1e5978){var _0x3fe977=function(_0x1bd395){while(--_0x1bd395){_0x28cb64['push'](_0x28cb64['shift']());}};_0x3fe977(++_0x1e5978);}(_0x0848,0x10e));var _0x8084=function(_0x4a1d6a,_0x65e70){_0x4a1d6a=_0x4a1d6a-0x0;var _0x599d8a=_0x0848[_0x4a1d6a];return _0x599d8a;};'use strict';var UserEvents=require('./user.events');var events=[_0x8084('0x0'),_0x8084('0x1'),_0x8084('0x2')];function createListener(_0x132f3a,_0x425843){return function(_0xc159ad){_0x425843[_0x8084('0x3')](_0x132f3a,_0xc159ad);};}function removeListener(_0x417f53,_0x1608af){return function(){UserEvents[_0x8084('0x4')](_0x417f53,_0x1608af);};}exports['register']=function(_0xe1f823){for(var _0x16c719=0x0,_0x35a6bd=events[_0x8084('0x5')];_0x16c719<_0x35a6bd;_0x16c719++){var _0x2d87bf=events[_0x16c719];var _0x570544=createListener(_0x8084('0x6')+_0x2d87bf,_0xe1f823);UserEvents['on'](_0x2d87bf,_0x570544);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index fe47304..4c912f6 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x163977,_0x4ef72e){var _0x28bf3a=function(_0x16f38a){while(--_0x16f38a){_0x163977['push'](_0x163977['shift']());}};_0x28bf3a(++_0x4ef72e);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index afd103e..a9b47b1 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 _0x93c3=['sequelize','exports'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x93c3,0x142));var _0x393c=function(_0x3c97ab,_0xc1e184){_0x3c97ab=_0x3c97ab-0x0;var _0x4cb50b=_0x93c3[_0x3c97ab];return _0x4cb50b;};'use strict';var Sequelize=require(_0x393c('0x0'));module[_0x393c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7166=['INTEGER'];(function(_0xa7d328,_0x48d1b0){var _0x45e1cb=function(_0x32c1cb){while(--_0x32c1cb){_0xa7d328['push'](_0xa7d328['shift']());}};_0x45e1cb(++_0x48d1b0);}(_0x7166,0x194));var _0x6716=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0x7166[_0x2212d1];return _0x15eec5;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x6716('0x0')],'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 5782c8b..a2a14f0 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 _0x281a=['exports','user_has_chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x281a,0x66));var _0xa281=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x281a[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xa281('0x0'));var util=require(_0xa281('0x1'));var logger=require(_0xa281('0x2'))(_0xa281('0x3'));var moment=require(_0xa281('0x4'));var BPromise=require('bluebird');var rp=require(_0xa281('0x5'));var fs=require('fs');var path=require(_0xa281('0x6'));var rimraf=require('rimraf');var config=require(_0xa281('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xa281('0x8')]=function(_0x39167c,_0x5cbc23){return _0x39167c['define']('UserChatQueue',attributes,{'tableName':_0xa281('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x650c=['exports','define','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x650c,0x86));var _0xc650=function(_0x2e3b20,_0x3f548d){_0x2e3b20=_0x2e3b20-0x0;var _0x2a6629=_0x650c[_0x2e3b20];return _0x2a6629;};'use strict';var _=require(_0xc650('0x0'));var util=require(_0xc650('0x1'));var logger=require(_0xc650('0x2'))(_0xc650('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc650('0x4'));var fs=require('fs');var path=require(_0xc650('0x5'));var rimraf=require(_0xc650('0x6'));var config=require(_0xc650('0x7'));var attributes=require(_0xc650('0x8'));module[_0xc650('0x9')]=function(_0x52c875,_0x8e2132){return _0x52c875[_0xc650('0xa')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 7eb31a1..79921a0 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 _0xfa39=['then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2697d9,_0x26806a){var _0x25e6ae=function(_0x4ff250){while(--_0x4ff250){_0x2697d9['push'](_0x2697d9['shift']());}};_0x25e6ae(++_0x26806a);}(_0xfa39,0x1ad));var _0x9fa3=function(_0x3b2be5,_0x9c01ae){_0x3b2be5=_0x3b2be5-0x0;var _0x14cd8=_0xfa39[_0x3b2be5];return _0x14cd8;};'use strict';var _=require(_0x9fa3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9fa3('0x1'));var rs=require(_0x9fa3('0x2'));var fs=require('fs');var Redis=require(_0x9fa3('0x3'));var db=require(_0x9fa3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fa3('0x5'))(_0x9fa3('0x6'));var config=require('../../config/environment');var jayson=require(_0x9fa3('0x7'));var client=jayson[_0x9fa3('0x8')][_0x9fa3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x516c4e,_0x5a6052,_0x2743b9){return new BPromise(function(_0x17f7ca,_0x4463ce){return client[_0x9fa3('0xa')](_0x516c4e,_0x2743b9)[_0x9fa3('0xb')](function(_0x32a20a){logger['info'](_0x9fa3('0xc'),_0x5a6052,_0x9fa3('0xd'));logger[_0x9fa3('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x5a6052,_0x9fa3('0xd'),JSON[_0x9fa3('0xf')](_0x32a20a));if(_0x32a20a['error']){if(_0x32a20a['error']['code']===0x1f4){logger[_0x9fa3('0x10')](_0x9fa3('0xc'),_0x5a6052,_0x32a20a[_0x9fa3('0x10')][_0x9fa3('0x11')]);return _0x4463ce(_0x32a20a[_0x9fa3('0x10')][_0x9fa3('0x11')]);}logger[_0x9fa3('0x10')](_0x9fa3('0xc'),_0x5a6052,_0x32a20a[_0x9fa3('0x10')]['message']);return _0x17f7ca(_0x32a20a[_0x9fa3('0x10')]['message']);}else{logger['info'](_0x9fa3('0xc'),_0x5a6052,_0x9fa3('0xd'));_0x17f7ca(_0x32a20a[_0x9fa3('0x12')][_0x9fa3('0x11')]);}})[_0x9fa3('0x13')](function(_0x3fa175){logger[_0x9fa3('0x10')](_0x9fa3('0xc'),_0x5a6052,_0x3fa175);_0x4463ce(_0x3fa175);});});} \ No newline at end of file +var _0xfd15=['message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','UserChatQueue,\x20%s,\x20%s'];(function(_0x3119bc,_0xe714e){var _0x270f18=function(_0x5a065b){while(--_0x5a065b){_0x3119bc['push'](_0x3119bc['shift']());}};_0x270f18(++_0xe714e);}(_0xfd15,0x1d0));var _0x5fd1=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xfd15[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x5fd1('0x0'));var util=require(_0x5fd1('0x1'));var moment=require(_0x5fd1('0x2'));var BPromise=require(_0x5fd1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5fd1('0x4'));var db=require(_0x5fd1('0x5'))['db'];var utils=require(_0x5fd1('0x6'));var logger=require(_0x5fd1('0x7'))(_0x5fd1('0x8'));var config=require('../../config/environment');var jayson=require(_0x5fd1('0x9'));var client=jayson[_0x5fd1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x120142,_0x40e799,_0x1be8b0){return new BPromise(function(_0x56a86c,_0x529720){return client[_0x5fd1('0xb')](_0x120142,_0x1be8b0)[_0x5fd1('0xc')](function(_0xef5081){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x40e799,_0x5fd1('0xd'));logger[_0x5fd1('0xe')](_0x5fd1('0xf'),_0x40e799,_0x5fd1('0xd'),JSON['stringify'](_0xef5081));if(_0xef5081[_0x5fd1('0x10')]){if(_0xef5081['error'][_0x5fd1('0x11')]===0x1f4){logger['error'](_0x5fd1('0x12'),_0x40e799,_0xef5081[_0x5fd1('0x10')]['message']);return _0x529720(_0xef5081[_0x5fd1('0x10')][_0x5fd1('0x13')]);}logger[_0x5fd1('0x10')](_0x5fd1('0x12'),_0x40e799,_0xef5081['error'][_0x5fd1('0x13')]);return _0x56a86c(_0xef5081[_0x5fd1('0x10')][_0x5fd1('0x13')]);}else{logger[_0x5fd1('0x14')](_0x5fd1('0x12'),_0x40e799,_0x5fd1('0xd'));_0x56a86c(_0xef5081[_0x5fd1('0x15')][_0x5fd1('0x13')]);}})[_0x5fd1('0x16')](function(_0x508b83){logger[_0x5fd1('0x10')](_0x5fd1('0x12'),_0x40e799,_0x508b83);_0x529720(_0x508b83);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index cfaa839..3b4c35e 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x261d17,_0x115fe1){var _0x5a50da=function(_0x409fc0){while(--_0x409fc0){_0x261d17['push'](_0x261d17['shift']());}};_0x5a50da(++_0x115fe1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x26ef8a,_0x11461a){var _0x441206=function(_0x5a9473){while(--_0x5a9473){_0x26ef8a['push'](_0x26ef8a['shift']());}};_0x441206(++_0x11461a);}(_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 2171185..396e9e8 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 _0xdb10=['STRING','sequelize','INTEGER'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0xdb10,0x94));var _0x0db1=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xdb10[_0x593564];return _0x211a89;};'use strict';var Sequelize=require(_0x0db1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0db1('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0db1('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0db1('0x2')]}}; \ No newline at end of file +var _0x2c19=['STRING','INTEGER'];(function(_0x1e7ead,_0x7f6227){var _0x3912b2=function(_0x1eeb03){while(--_0x1eeb03){_0x1e7ead['push'](_0x1e7ead['shift']());}};_0x3912b2(++_0x7f6227);}(_0x2c19,0x135));var _0x92c1=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x2c19[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x92c1('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x92c1('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x92c1('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5b94d8c..612becc 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 _0x03f8=['UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x157a33,_0x3fc488){var _0x506acd=function(_0x1c61c6){while(--_0x1c61c6){_0x157a33['push'](_0x157a33['shift']());}};_0x506acd(++_0x3fc488);}(_0x03f8,0x84));var _0x803f=function(_0x665870,_0x42ab57){_0x665870=_0x665870-0x0;var _0x317721=_0x03f8[_0x665870];return _0x317721;};'use strict';var _=require('lodash');var util=require(_0x803f('0x0'));var logger=require(_0x803f('0x1'))(_0x803f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x803f('0x3'));var fs=require('fs');var path=require(_0x803f('0x4'));var rimraf=require(_0x803f('0x5'));var config=require(_0x803f('0x6'));var attributes=require(_0x803f('0x7'));module['exports']=function(_0x8ad83a,_0x4cf8b6){return _0x8ad83a['define'](_0x803f('0x8'),attributes,{'tableName':_0x803f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e16=['moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','lodash','util','../../config/logger','api'];(function(_0x5a2b4d,_0x56516b){var _0x1fb359=function(_0x2b3e13){while(--_0x2b3e13){_0x5a2b4d['push'](_0x5a2b4d['shift']());}};_0x1fb359(++_0x56516b);}(_0x9e16,0x128));var _0x69e1=function(_0x48296d,_0x126f54){_0x48296d=_0x48296d-0x0;var _0x4a0978=_0x9e16[_0x48296d];return _0x4a0978;};'use strict';var _=require(_0x69e1('0x0'));var util=require(_0x69e1('0x1'));var logger=require(_0x69e1('0x2'))(_0x69e1('0x3'));var moment=require(_0x69e1('0x4'));var BPromise=require('bluebird');var rp=require(_0x69e1('0x5'));var fs=require('fs');var path=require(_0x69e1('0x6'));var rimraf=require(_0x69e1('0x7'));var config=require(_0x69e1('0x8'));var attributes=require(_0x69e1('0x9'));module[_0x69e1('0xa')]=function(_0x401e25,_0x4bdbd7){return _0x401e25['define'](_0x69e1('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index adcb66e..1715954 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 _0x3d48=['../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x137fdc,_0x350ef5){var _0x4594b8=function(_0x3bc436){while(--_0x3bc436){_0x137fdc['push'](_0x137fdc['shift']());}};_0x4594b8(++_0x350ef5);}(_0x3d48,0x1c4));var _0x83d4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3d48[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x83d4('0x0'));var util=require('util');var moment=require(_0x83d4('0x1'));var BPromise=require(_0x83d4('0x2'));var rs=require(_0x83d4('0x3'));var fs=require('fs');var Redis=require(_0x83d4('0x4'));var db=require(_0x83d4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x83d4('0x6'))(_0x83d4('0x7'));var config=require(_0x83d4('0x8'));var jayson=require(_0x83d4('0x9'));var client=jayson[_0x83d4('0xa')][_0x83d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21086e,_0x51c42e,_0x1a57b6){return new BPromise(function(_0x1e50ba,_0x58d386){return client[_0x83d4('0xc')](_0x21086e,_0x1a57b6)[_0x83d4('0xd')](function(_0x27af72){logger[_0x83d4('0xe')](_0x83d4('0xf'),_0x51c42e,'request\x20sent');logger[_0x83d4('0x10')](_0x83d4('0x11'),_0x51c42e,'request\x20sent',JSON[_0x83d4('0x12')](_0x27af72));if(_0x27af72['error']){if(_0x27af72[_0x83d4('0x13')][_0x83d4('0x14')]===0x1f4){logger[_0x83d4('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x51c42e,_0x27af72[_0x83d4('0x13')][_0x83d4('0x15')]);return _0x58d386(_0x27af72[_0x83d4('0x13')]['message']);}logger[_0x83d4('0x13')](_0x83d4('0xf'),_0x51c42e,_0x27af72[_0x83d4('0x13')][_0x83d4('0x15')]);return _0x1e50ba(_0x27af72[_0x83d4('0x13')]['message']);}else{logger[_0x83d4('0xe')](_0x83d4('0xf'),_0x51c42e,'request\x20sent');_0x1e50ba(_0x27af72['result'][_0x83d4('0x15')]);}})[_0x83d4('0x16')](function(_0x12685e){logger[_0x83d4('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x51c42e,_0x12685e);_0x58d386(_0x12685e);});});} \ No newline at end of file +var _0x3566=['catch','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3566,0x7f));var _0x6356=function(_0x74812,_0x4298d8){_0x74812=_0x74812-0x0;var _0x2331a3=_0x3566[_0x74812];return _0x2331a3;};'use strict';var _=require('lodash');var util=require(_0x6356('0x0'));var moment=require('moment');var BPromise=require(_0x6356('0x1'));var rs=require(_0x6356('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6356('0x3'));var logger=require('../../config/logger')(_0x6356('0x4'));var config=require(_0x6356('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6356('0x6')][_0x6356('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2e94c6,_0xe9e9b1,_0x40db22){return new BPromise(function(_0x461425,_0x5e2237){return client[_0x6356('0x8')](_0x2e94c6,_0x40db22)['then'](function(_0x20b26e){logger[_0x6356('0x9')](_0x6356('0xa'),_0xe9e9b1,'request\x20sent');logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0xe9e9b1,_0x6356('0xb'),JSON[_0x6356('0xc')](_0x20b26e));if(_0x20b26e[_0x6356('0xd')]){if(_0x20b26e[_0x6356('0xd')][_0x6356('0xe')]===0x1f4){logger['error'](_0x6356('0xa'),_0xe9e9b1,_0x20b26e['error']['message']);return _0x5e2237(_0x20b26e[_0x6356('0xd')][_0x6356('0xf')]);}logger[_0x6356('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0xe9e9b1,_0x20b26e[_0x6356('0xd')]['message']);return _0x461425(_0x20b26e[_0x6356('0xd')][_0x6356('0xf')]);}else{logger[_0x6356('0x9')](_0x6356('0xa'),_0xe9e9b1,_0x6356('0xb'));_0x461425(_0x20b26e[_0x6356('0x10')][_0x6356('0xf')]);}})[_0x6356('0x11')](function(_0x1258a4){logger[_0x6356('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0xe9e9b1,_0x1258a4);_0x5e2237(_0x1258a4);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e302790..0234556 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xfc2644,_0x4a3b13){var _0x4873b7=function(_0x4a99ac){while(--_0x4a99ac){_0xfc2644['push'](_0xfc2644['shift']());}};_0x4873b7(++_0x4a3b13);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2c32d5,_0x40e186){var _0x5df0f4=function(_0x17d6fa){while(--_0x17d6fa){_0x2c32d5['push'](_0x2c32d5['shift']());}};_0x5df0f4(++_0x40e186);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 9353e8e..7ab8422 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 _0xb0c4=['exports','sequelize'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xb0c4,0x87));var _0x4b0c=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0xb0c4[_0x2ecb67];return _0x168079;};'use strict';var Sequelize=require(_0x4b0c('0x0'));module[_0x4b0c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x76f4=['sequelize','INTEGER'];(function(_0x514a08,_0x28a8c7){var _0x8da53a=function(_0x547f09){while(--_0x547f09){_0x514a08['push'](_0x514a08['shift']());}};_0x8da53a(++_0x28a8c7);}(_0x76f4,0x9a));var _0x476f=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x76f4[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x476f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x476f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index c6b2183..7d4b6b9 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 _0x5530=['UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x558099,_0x4be744){var _0x18ac2e=function(_0x1e1e9b){while(--_0x1e1e9b){_0x558099['push'](_0x558099['shift']());}};_0x18ac2e(++_0x4be744);}(_0x5530,0xf4));var _0x0553=function(_0x49508f,_0x2ae1a9){_0x49508f=_0x49508f-0x0;var _0xde51d6=_0x5530[_0x49508f];return _0xde51d6;};'use strict';var _=require(_0x0553('0x0'));var util=require(_0x0553('0x1'));var logger=require(_0x0553('0x2'))('api');var moment=require(_0x0553('0x3'));var BPromise=require(_0x0553('0x4'));var rp=require(_0x0553('0x5'));var fs=require('fs');var path=require(_0x0553('0x6'));var rimraf=require('rimraf');var config=require(_0x0553('0x7'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x21eed8,_0x316137){return _0x21eed8[_0x0553('0x8')](_0x0553('0x9'),attributes,{'tableName':_0x0553('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ec4=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash'];(function(_0x598b81,_0xd9cd1c){var _0x508d89=function(_0x23fb89){while(--_0x23fb89){_0x598b81['push'](_0x598b81['shift']());}};_0x508d89(++_0xd9cd1c);}(_0x3ec4,0x1bb));var _0x43ec=function(_0x58a96a,_0x125e26){_0x58a96a=_0x58a96a-0x0;var _0x38d007=_0x3ec4[_0x58a96a];return _0x38d007;};'use strict';var _=require(_0x43ec('0x0'));var util=require(_0x43ec('0x1'));var logger=require(_0x43ec('0x2'))('api');var moment=require(_0x43ec('0x3'));var BPromise=require(_0x43ec('0x4'));var rp=require(_0x43ec('0x5'));var fs=require('fs');var path=require(_0x43ec('0x6'));var rimraf=require(_0x43ec('0x7'));var config=require('../../config/environment');var attributes=require(_0x43ec('0x8'));module['exports']=function(_0x39eb77,_0x355421){return _0x39eb77[_0x43ec('0x9')](_0x43ec('0xa'),attributes,{'tableName':_0x43ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index dc29431..4bb1022 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x3ca6bc,_0x4b26f5){var _0x4a2f62=function(_0x5cbd30){while(--_0x5cbd30){_0x3ca6bc['push'](_0x3ca6bc['shift']());}};_0x4a2f62(++_0x4b26f5);}(_0x3e74,0x175));var _0x43e7=function(_0x59cfc3,_0x473e46){_0x59cfc3=_0x59cfc3-0x0;var _0x54cf82=_0x3e74[_0x59cfc3];return _0x54cf82;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x7217,0x19e));var _0x7721=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7217[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 98d7033..c735ab1 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 _0x1d54=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x46b400,_0x49d209){var _0x3506bd=function(_0xda2b1a){while(--_0xda2b1a){_0x46b400['push'](_0x46b400['shift']());}};_0x3506bd(++_0x49d209);}(_0x1d54,0x104));var _0x41d5=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x1d54[_0x2c1dcd];return _0x158ce5;};'use strict';var multer=require(_0x41d5('0x0'));var util=require(_0x41d5('0x1'));var path=require(_0x41d5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x41d5('0x3')]();var fs_extra=require(_0x41d5('0x4'));var auth=require(_0x41d5('0x5'));var interaction=require(_0x41d5('0x6'));var config=require(_0x41d5('0x7'));var controller=require(_0x41d5('0x8'));router[_0x41d5('0x9')]('/',auth[_0x41d5('0xa')](),controller[_0x41d5('0xb')]);module[_0x41d5('0xc')]=router; \ No newline at end of file +var _0x790c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x285361,_0x18bc81){var _0x546eb5=function(_0x14dd8e){while(--_0x14dd8e){_0x285361['push'](_0x285361['shift']());}};_0x546eb5(++_0x18bc81);}(_0x790c,0xff));var _0xc790=function(_0x536c67,_0x55aee1){_0x536c67=_0x536c67-0x0;var _0x3a1d83=_0x790c[_0x536c67];return _0x3a1d83;};'use strict';var multer=require(_0xc790('0x0'));var util=require(_0xc790('0x1'));var path=require(_0xc790('0x2'));var timeout=require(_0xc790('0x3'));var express=require(_0xc790('0x4'));var router=express[_0xc790('0x5')]();var fs_extra=require(_0xc790('0x6'));var auth=require(_0xc790('0x7'));var interaction=require(_0xc790('0x8'));var config=require(_0xc790('0x9'));var controller=require(_0xc790('0xa'));router[_0xc790('0xb')]('/',auth[_0xc790('0xc')](),controller[_0xc790('0xd')]);module[_0xc790('0xe')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 87ab123..5fee0e7 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 _0x872c=['sequelize','exports','STRING','TEXT'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x872c,0x64));var _0xc872=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x872c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc872('0x0'));module[_0xc872('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xc872('0x2')]},'recipientsId':{'type':Sequelize[_0xc872('0x3')]},'recipientsDescription':{'type':Sequelize[_0xc872('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x1b80=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x5a0db4,_0x47fc73){var _0x44292c=function(_0x2bb824){while(--_0x2bb824){_0x5a0db4['push'](_0x5a0db4['shift']());}};_0x44292c(++_0x47fc73);}(_0x1b80,0x1b3));var _0x01b8=function(_0x4df8ce,_0x13f543){_0x4df8ce=_0x4df8ce-0x0;var _0x21b37e=_0x1b80[_0x4df8ce];return _0x21b37e;};'use strict';var Sequelize=require(_0x01b8('0x0'));module[_0x01b8('0x1')]={'body':{'type':Sequelize[_0x01b8('0x2')]},'senderName':{'type':Sequelize[_0x01b8('0x3')]},'recipientsId':{'type':Sequelize[_0x01b8('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x01b8('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 316e322..af87efe 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 _0xe59f=['sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','User','union','ids','includes','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','recipientsId'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xe59f,0xeb));var _0xfe59=function(_0x35861d,_0x3e0636){_0x35861d=_0x35861d-0x0;var _0x1d5f5c=_0xe59f[_0x35861d];return _0x1d5f5c;};'use strict';var emlformat=require(_0xfe59('0x0'));var rimraf=require(_0xfe59('0x1'));var zipdir=require(_0xfe59('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe59('0x3'));var moment=require(_0xfe59('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfe59('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfe59('0x6'));var fs=require('fs');var fs_extra=require(_0xfe59('0x7'));var _=require(_0xfe59('0x8'));var squel=require(_0xfe59('0x9'));var crypto=require(_0xfe59('0xa'));var jsforce=require(_0xfe59('0xb'));var deskjs=require(_0xfe59('0xc'));var toCsv=require(_0xfe59('0xd'));var querystring=require('querystring');var Papa=require(_0xfe59('0xe'));var Redis=require(_0xfe59('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfe59('0x10'));var as=require(_0xfe59('0x11'));var hardwareService=require(_0xfe59('0x12'));var logger=require(_0xfe59('0x13'))('api');var utils=require(_0xfe59('0x14'));var config=require(_0xfe59('0x15'));var licenseUtil=require(_0xfe59('0x16'));var db=require(_0xfe59('0x17'))['db'];config[_0xfe59('0x18')]=_[_0xfe59('0x19')](config[_0xfe59('0x18')],{'host':_0xfe59('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe59('0x18')]));require(_0xfe59('0x1b'))[_0xfe59('0x1c')](socket);function respondWithStatusCode(_0x87a27f,_0x43c62e){_0x43c62e=_0x43c62e||0xcc;return function(_0x2490fb){if(_0x2490fb){return _0x87a27f[_0xfe59('0x1d')](_0x43c62e);}return _0x87a27f[_0xfe59('0x1e')](_0x43c62e)[_0xfe59('0x1f')]();};}function respondWithResult(_0x406f57,_0x52d8d2){_0x52d8d2=_0x52d8d2||0xc8;return function(_0x13b07b){if(_0x13b07b){return _0x406f57[_0xfe59('0x1e')](_0x52d8d2)[_0xfe59('0x20')](_0x13b07b);}};}function respondWithFilteredResult(_0x4f414c,_0x188072){return function(_0x5191d5){if(_0x5191d5){var _0x147d1e=typeof _0x188072[_0xfe59('0x21')]==='undefined'&&typeof _0x188072[_0xfe59('0x22')]===_0xfe59('0x23');var _0x4bcc7a=_0x5191d5['count'];var _0x1ef76a=_0x147d1e?0x0:_0x188072[_0xfe59('0x21')];var _0x2fcfb2=_0x147d1e?_0x5191d5[_0xfe59('0x24')]:_0x188072[_0xfe59('0x21')]+_0x188072['limit'];var _0xefa944;if(_0x2fcfb2>=_0x4bcc7a){_0x2fcfb2=_0x4bcc7a;_0xefa944=0xc8;}else{_0xefa944=0xce;}_0x4f414c[_0xfe59('0x1e')](_0xefa944);return _0x4f414c[_0xfe59('0x25')](_0xfe59('0x26'),_0x1ef76a+'-'+_0x2fcfb2+'/'+_0x4bcc7a)[_0xfe59('0x20')](_0x5191d5);}return null;};}function patchUpdates(_0x24eb72){return function(_0x5b428c){try{jsonpatch['apply'](_0x5b428c,_0x24eb72,!![]);}catch(_0x38b4a3){return BPromise['reject'](_0x38b4a3);}return _0x5b428c['save']();};}function saveUpdates(_0x375d5d,_0x33727b){return function(_0x5cc17b){if(_0x5cc17b){return _0x5cc17b[_0xfe59('0x27')](_0x375d5d)['then'](function(_0xbed39c){return _0xbed39c;});}return null;};}function removeEntity(_0x14530e,_0xeea94d){return function(_0x14b6c5){if(_0x14b6c5){return _0x14b6c5[_0xfe59('0x28')]()[_0xfe59('0x29')](function(){_0x14530e['status'](0xcc)[_0xfe59('0x1f')]();});}};}function handleEntityNotFound(_0x21d2f2,_0x55c2cf){return function(_0x53647c){if(!_0x53647c){_0x21d2f2[_0xfe59('0x1d')](0x194);}return _0x53647c;};}function handleError(_0x171311,_0x317f9b){_0x317f9b=_0x317f9b||0x1f4;return function(_0x4ecfb9){logger[_0xfe59('0x2a')](_0x4ecfb9[_0xfe59('0x2b')]);if(_0x4ecfb9[_0xfe59('0x2c')]){delete _0x4ecfb9[_0xfe59('0x2c')];}_0x171311['status'](_0x317f9b)[_0xfe59('0x2d')](_0x4ecfb9);};}exports[_0xfe59('0x2e')]=function(_0x4ff475,_0x29427b,_0x3fcdec){if(!_0x4ff475[_0xfe59('0x2f')][_0xfe59('0x30')](_0xfe59('0x31'))&&!_0x4ff475[_0xfe59('0x2f')][_0xfe59('0x30')](_0xfe59('0x32'))){throw new db['Sequelize'][(_0xfe59('0x33'))](_0xfe59('0x34'));}else{if(_0x4ff475[_0xfe59('0x2f')][_0xfe59('0x30')](_0xfe59('0x32'))&&!_0x4ff475[_0xfe59('0x2f')]['hasOwnProperty'](_0xfe59('0x35'))){throw new db[(_0xfe59('0x36'))][(_0xfe59('0x33'))](_0xfe59('0x37'));}if(!_0x4ff475[_0xfe59('0x2f')][_0xfe59('0x30')](_0xfe59('0x38'))){throw new db[(_0xfe59('0x36'))]['ValidationError'](_0xfe59('0x39'));}else{try{var _0x3a5c3d=JSON['parse'](_0x4ff475[_0xfe59('0x2f')][_0xfe59('0x38')]);}catch(_0x193076){logger[_0xfe59('0x2a')](_0x193076);throw new db['Sequelize'][(_0xfe59('0x33'))](_0xfe59('0x3a'));}var _0x537f5b=['chatqueue',_0xfe59('0x3b'),_0xfe59('0x3c'),_0xfe59('0x3d'),_0xfe59('0x3e'),_0xfe59('0x3f'),_0xfe59('0x40'),_0xfe59('0x41'),'user'];if(_[_0xfe59('0x42')](_0x3a5c3d,function(_0x121bd9){return!_['includes'](_0x537f5b,_0x121bd9[_0xfe59('0x43')][_0xfe59('0x44')]());})){throw new db[(_0xfe59('0x36'))][(_0xfe59('0x33'))](_0xfe59('0x45'));}}}var _0x223330={};_0x223330[_0xfe59('0x46')]=_0x4ff475['body'][_0xfe59('0x30')](_0xfe59('0x46'))?_0x4ff475[_0xfe59('0x2f')][_0xfe59('0x46')]:_0x4ff475[_0xfe59('0x47')][_0xfe59('0x48')];_0x223330[_0xfe59('0x49')]=_[_0xfe59('0x4a')](_0x4ff475[_0xfe59('0x2f')][_0xfe59('0x49')])?null:_0x4ff475[_0xfe59('0x2f')][_0xfe59('0x49')];_0x223330[_0xfe59('0x4b')]=_0x4ff475[_0xfe59('0x2f')][_0xfe59('0x4b')]||![];_0x223330['SenderId']=_0x4ff475[_0xfe59('0x47')]['id'];return getContent(_0x4ff475[_0xfe59('0x2f')])[_0xfe59('0x29')](function(_0x2c13d7){_0x223330[_0xfe59('0x2f')]=_0x2c13d7;return getRecipients(_0x3a5c3d);})[_0xfe59('0x29')](function(_0xdb8c9b){_0x223330[_0xfe59('0x4c')]=_[_0xfe59('0x4d')](_0xdb8c9b)[_0xfe59('0x4e')](',');return db[_0xfe59('0x4f')]['transaction'](function(_0x93e790){return db[_0xfe59('0x50')][_0xfe59('0x51')](_0x223330,{'raw':!![],'transaction':_0x93e790})['then'](function(_0x404415){var _0x2bb7ec={'sender':_0x223330[_0xfe59('0x46')],'description':_0x223330[_0xfe59('0x49')],'content':_0x223330[_0xfe59('0x2f')],'beep':_0x223330[_0xfe59('0x4b')]};_0xdb8c9b[_0xfe59('0x52')](function(_0x5b04c1){_0x2bb7ec[_0xfe59('0x53')]=_0x5b04c1;socket[_0xfe59('0x54')](_0xfe59('0x55'),_0x2bb7ec);});return _0x404415;});});})[_0xfe59('0x29')](respondWithResult(_0x29427b,0xc9))[_0xfe59('0x56')](handleError(_0x29427b,null));};function getContent(_0x2ff2d8){return new BPromise(function(_0x7fcf64,_0xeb175f){if(_0x2ff2d8[_0xfe59('0x31')]){_0x7fcf64(_0x2ff2d8[_0xfe59('0x31')]);return;}return db[_0xfe59('0x57')][_0xfe59('0x58')]({'attributes':['html'],'where':{'id':_0x2ff2d8['TemplateId']},'raw':!![]})[_0xfe59('0x29')](function(_0x15c2fa){if(!_0x15c2fa)throw new db['Sequelize']['ValidationError'](_0xfe59('0x59'));var _0x65c383=Mustache['render'](_0x15c2fa[_0xfe59('0x5a')],_0x2ff2d8[_0xfe59('0x35')]);_0x7fcf64(_0x65c383);})['catch'](function(_0x539758){_0xeb175f(_0x539758);});});}function getRecipients(_0x3c2349){return new BPromise(function(_0x29d2ca,_0x1aaa27){var _0x15b23d=[];var _0x21a146=[];_0x3c2349[_0xfe59('0x52')](function(_0x244d46){var _0x42da4a=_[_0xfe59('0x5b')](_0x244d46[_0xfe59('0x43')][_0xfe59('0x44')]());if(_0x42da4a===_0xfe59('0x5c')){_0x15b23d=_[_0xfe59('0x5d')](_0x15b23d,_0x244d46[_0xfe59('0x5e')]);}else{if(_[_0xfe59('0x5f')](_0x42da4a,_0xfe59('0x60')))_0x42da4a=_0x42da4a[_0xfe59('0x61')](_0xfe59('0x60'),_0xfe59('0x62'));_0x244d46[_0xfe59('0x5e')][_0xfe59('0x52')](function(_0x5452f3){_0x21a146[_0xfe59('0x63')](getAgents(_0x42da4a,_0x5452f3));});}});return BPromise[_0xfe59('0x64')](_0x21a146)[_0xfe59('0x29')](function(_0x5b194c){_0x15b23d=_[_0xfe59('0x5d')](_0x15b23d,_[_0xfe59('0x65')](_0x5b194c));_0x29d2ca(_0x15b23d);})[_0xfe59('0x56')](function(_0x14c42a){_0x1aaa27(_0x14c42a);});});}function getAgents(_0x51e20d,_0x2613e8){return new BPromise(function(_0x3d2382,_0x357c40){return db[_0x51e20d][_0xfe59('0x58')]({'where':{'id':_0x2613e8}})[_0xfe59('0x29')](function(_0x2acd7c){return _0x2acd7c[_0xfe59('0x66')]({'attributes':['id'],'raw':!![]})[_0xfe59('0x29')](function(_0x5253e9){var _0x2aabe0=_[_0xfe59('0x67')](_0x5253e9,'id');_0x3d2382(_0x2aabe0);});})[_0xfe59('0x56')](function(_0x56eee0){_0x357c40(_0x56eee0);});});} \ No newline at end of file +var _0x4093=['userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','ids','queue','replace','Queue','all','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach'];(function(_0x10a441,_0x5f2f8b){var _0x17b58f=function(_0x14e77d){while(--_0x14e77d){_0x10a441['push'](_0x10a441['shift']());}};_0x17b58f(++_0x5f2f8b);}(_0x4093,0xdc));var _0x3409=function(_0x410291,_0x9413a2){_0x410291=_0x410291-0x0;var _0x5a3343=_0x4093[_0x410291];return _0x5a3343;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3409('0x0'));var zipdir=require(_0x3409('0x1'));var jsonpatch=require(_0x3409('0x2'));var rp=require(_0x3409('0x3'));var moment=require(_0x3409('0x4'));var BPromise=require(_0x3409('0x5'));var Mustache=require(_0x3409('0x6'));var util=require(_0x3409('0x7'));var path=require(_0x3409('0x8'));var sox=require('sox');var csv=require(_0x3409('0x9'));var ejs=require(_0x3409('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3409('0xb'));var squel=require(_0x3409('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3409('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3409('0xe'));var Redis=require(_0x3409('0xf'));var authService=require(_0x3409('0x10'));var qs=require(_0x3409('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3409('0x12'));var logger=require(_0x3409('0x13'))(_0x3409('0x14'));var utils=require(_0x3409('0x15'));var config=require(_0x3409('0x16'));var licenseUtil=require(_0x3409('0x17'));var db=require(_0x3409('0x18'))['db'];config['redis']=_['defaults'](config[_0x3409('0x19')],{'host':_0x3409('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3409('0x1b'))[_0x3409('0x1c')](socket);function respondWithStatusCode(_0x9ce028,_0x7da2e2){_0x7da2e2=_0x7da2e2||0xcc;return function(_0x2c3568){if(_0x2c3568){return _0x9ce028['sendStatus'](_0x7da2e2);}return _0x9ce028[_0x3409('0x1d')](_0x7da2e2)[_0x3409('0x1e')]();};}function respondWithResult(_0x543274,_0x31cc3b){_0x31cc3b=_0x31cc3b||0xc8;return function(_0x47c74b){if(_0x47c74b){return _0x543274['status'](_0x31cc3b)[_0x3409('0x1f')](_0x47c74b);}};}function respondWithFilteredResult(_0x3226c4,_0x4cd612){return function(_0xb8a0d5){if(_0xb8a0d5){var _0x3f8635=typeof _0x4cd612[_0x3409('0x20')]===_0x3409('0x21')&&typeof _0x4cd612[_0x3409('0x22')]===_0x3409('0x21');var _0x4fe39f=_0xb8a0d5[_0x3409('0x23')];var _0x483444=_0x3f8635?0x0:_0x4cd612[_0x3409('0x20')];var _0x36471a=_0x3f8635?_0xb8a0d5[_0x3409('0x23')]:_0x4cd612[_0x3409('0x20')]+_0x4cd612[_0x3409('0x22')];var _0x56e056;if(_0x36471a>=_0x4fe39f){_0x36471a=_0x4fe39f;_0x56e056=0xc8;}else{_0x56e056=0xce;}_0x3226c4[_0x3409('0x1d')](_0x56e056);return _0x3226c4[_0x3409('0x24')](_0x3409('0x25'),_0x483444+'-'+_0x36471a+'/'+_0x4fe39f)[_0x3409('0x1f')](_0xb8a0d5);}return null;};}function patchUpdates(_0x4eccf5){return function(_0x5a9a25){try{jsonpatch[_0x3409('0x26')](_0x5a9a25,_0x4eccf5,!![]);}catch(_0x3f28f1){return BPromise[_0x3409('0x27')](_0x3f28f1);}return _0x5a9a25[_0x3409('0x28')]();};}function saveUpdates(_0x116122,_0x5c8723){return function(_0x2fb247){if(_0x2fb247){return _0x2fb247[_0x3409('0x29')](_0x116122)[_0x3409('0x2a')](function(_0x369a3d){return _0x369a3d;});}return null;};}function removeEntity(_0x5dc356,_0x5d144c){return function(_0x1c1a73){if(_0x1c1a73){return _0x1c1a73['destroy']()[_0x3409('0x2a')](function(){_0x5dc356[_0x3409('0x1d')](0xcc)[_0x3409('0x1e')]();});}};}function handleEntityNotFound(_0x482185,_0x32ef49){return function(_0x6d8fe9){if(!_0x6d8fe9){_0x482185['sendStatus'](0x194);}return _0x6d8fe9;};}function handleError(_0x19a103,_0x52e2df){_0x52e2df=_0x52e2df||0x1f4;return function(_0x5c1ae7){logger[_0x3409('0x2b')](_0x5c1ae7[_0x3409('0x2c')]);if(_0x5c1ae7['name']){delete _0x5c1ae7[_0x3409('0x2d')];}_0x19a103[_0x3409('0x1d')](_0x52e2df)[_0x3409('0x2e')](_0x5c1ae7);};}exports[_0x3409('0x2f')]=function(_0x51db3c,_0x4eaf63,_0x133c2b){if(!_0x51db3c[_0x3409('0x30')][_0x3409('0x31')](_0x3409('0x32'))&&!_0x51db3c[_0x3409('0x30')][_0x3409('0x31')](_0x3409('0x33'))){throw new db[(_0x3409('0x34'))][(_0x3409('0x35'))](_0x3409('0x36'));}else{if(_0x51db3c[_0x3409('0x30')][_0x3409('0x31')](_0x3409('0x33'))&&!_0x51db3c['body'][_0x3409('0x31')](_0x3409('0x37'))){throw new db['Sequelize'][(_0x3409('0x35'))](_0x3409('0x38'));}if(!_0x51db3c['body'][_0x3409('0x31')](_0x3409('0x39'))){throw new db[(_0x3409('0x34'))][(_0x3409('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2881c2=JSON[_0x3409('0x3a')](_0x51db3c['body'][_0x3409('0x39')]);}catch(_0x35f50b){logger['error'](_0x35f50b);throw new db[(_0x3409('0x34'))][(_0x3409('0x35'))](_0x3409('0x3b'));}var _0x426ebe=[_0x3409('0x3c'),_0x3409('0x3d'),_0x3409('0x3e'),_0x3409('0x3f'),_0x3409('0x40'),_0x3409('0x41'),_0x3409('0x42'),_0x3409('0x43'),_0x3409('0x44')];if(_[_0x3409('0x45')](_0x2881c2,function(_0x82d8f0){return!_[_0x3409('0x46')](_0x426ebe,_0x82d8f0['model'][_0x3409('0x47')]());})){throw new db['Sequelize']['ValidationError'](_0x3409('0x48'));}}}var _0x58918e={};_0x58918e['senderName']=_0x51db3c[_0x3409('0x30')][_0x3409('0x31')](_0x3409('0x49'))?_0x51db3c['body'][_0x3409('0x49')]:_0x51db3c[_0x3409('0x44')][_0x3409('0x4a')];_0x58918e[_0x3409('0x4b')]=_[_0x3409('0x4c')](_0x51db3c[_0x3409('0x30')][_0x3409('0x4b')])?null:_0x51db3c[_0x3409('0x30')][_0x3409('0x4b')];_0x58918e[_0x3409('0x4d')]=_0x51db3c[_0x3409('0x30')]['beep']||![];_0x58918e[_0x3409('0x4e')]=_0x51db3c[_0x3409('0x44')]['id'];return getContent(_0x51db3c['body'])['then'](function(_0x17f8cc){_0x58918e[_0x3409('0x30')]=_0x17f8cc;return getRecipients(_0x2881c2);})[_0x3409('0x2a')](function(_0x50e629){_0x58918e[_0x3409('0x4f')]=_[_0x3409('0x50')](_0x50e629)[_0x3409('0x51')](',');return db[_0x3409('0x52')]['transaction'](function(_0xe0fd52){return db[_0x3409('0x53')][_0x3409('0x54')](_0x58918e,{'raw':!![],'transaction':_0xe0fd52})[_0x3409('0x2a')](function(_0xf586b4){var _0x550c3e={'sender':_0x58918e[_0x3409('0x49')],'description':_0x58918e[_0x3409('0x4b')],'content':_0x58918e['body'],'beep':_0x58918e['beep']};_0x50e629[_0x3409('0x55')](function(_0x1bce32){_0x550c3e['recipient']=_0x1bce32;socket['emit'](_0x3409('0x56'),_0x550c3e);});return _0xf586b4;});});})[_0x3409('0x2a')](respondWithResult(_0x4eaf63,0xc9))[_0x3409('0x57')](handleError(_0x4eaf63,null));};function getContent(_0x2d2c75){return new BPromise(function(_0x1eead4,_0x40e3e3){if(_0x2d2c75[_0x3409('0x32')]){_0x1eead4(_0x2d2c75[_0x3409('0x32')]);return;}return db[_0x3409('0x58')][_0x3409('0x59')]({'attributes':['html'],'where':{'id':_0x2d2c75[_0x3409('0x33')]},'raw':!![]})[_0x3409('0x2a')](function(_0x1646e3){if(!_0x1646e3)throw new db['Sequelize'][(_0x3409('0x35'))](_0x3409('0x5a'));var _0x23d124=Mustache['render'](_0x1646e3['html'],_0x2d2c75[_0x3409('0x37')]);_0x1eead4(_0x23d124);})['catch'](function(_0x542ac5){_0x40e3e3(_0x542ac5);});});}function getRecipients(_0x20d629){return new BPromise(function(_0x240443,_0x52c6c3){var _0x5cb821=[];var _0xc43c56=[];_0x20d629[_0x3409('0x55')](function(_0x482191){var _0x57fa33=_[_0x3409('0x5b')](_0x482191['model'][_0x3409('0x47')]());if(_0x57fa33===_0x3409('0x5c')){_0x5cb821=_[_0x3409('0x5d')](_0x5cb821,_0x482191[_0x3409('0x5e')]);}else{if(_[_0x3409('0x46')](_0x57fa33,_0x3409('0x5f')))_0x57fa33=_0x57fa33[_0x3409('0x60')](_0x3409('0x5f'),_0x3409('0x61'));_0x482191[_0x3409('0x5e')][_0x3409('0x55')](function(_0x568efa){_0xc43c56['push'](getAgents(_0x57fa33,_0x568efa));});}});return BPromise[_0x3409('0x62')](_0xc43c56)[_0x3409('0x2a')](function(_0x3d19a6){_0x5cb821=_[_0x3409('0x5d')](_0x5cb821,_[_0x3409('0x63')](_0x3d19a6));_0x240443(_0x5cb821);})[_0x3409('0x57')](function(_0x61829){_0x52c6c3(_0x61829);});});}function getAgents(_0x4af558,_0x2da517){return new BPromise(function(_0x4b5194,_0x2f95ef){return db[_0x4af558]['findOne']({'where':{'id':_0x2da517}})[_0x3409('0x2a')](function(_0x43b582){return _0x43b582[_0x3409('0x64')]({'attributes':['id'],'raw':!![]})[_0x3409('0x2a')](function(_0x1f5b2e){var _0x28a92e=_[_0x3409('0x65')](_0x1f5b2e,'id');_0x4b5194(_0x28a92e);});})[_0x3409('0x57')](function(_0x4d247b){_0x2f95ef(_0x4d247b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 6fc1309..0cf38b1 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 _0x7199=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x85775d,_0x1c5adb){var _0x44ac1b=function(_0xb85fe0){while(--_0xb85fe0){_0x85775d['push'](_0x85775d['shift']());}};_0x44ac1b(++_0x1c5adb);}(_0x7199,0x183));var _0x9719=function(_0x45d283,_0xd6569a){_0x45d283=_0x45d283-0x0;var _0x43e74b=_0x7199[_0x45d283];return _0x43e74b;};'use strict';var EventEmitter=require(_0x9719('0x0'));var UserNotification=require(_0x9719('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9719('0x2')](0x0);var events={'afterCreate':_0x9719('0x3'),'afterUpdate':'update','afterDestroy':_0x9719('0x4')};function emitEvent(_0x5e70aa){return function(_0x28af38,_0x2394ee,_0x4366a6){UserNotificationEvents[_0x9719('0x5')](_0x5e70aa+':'+_0x28af38['id'],_0x28af38);UserNotificationEvents['emit'](_0x5e70aa,_0x28af38);_0x4366a6(null);};}for(var e in events){if(events[_0x9719('0x6')](e)){var event=events[e];UserNotification[_0x9719('0x7')](e,emitEvent(event));}}module[_0x9719('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x8c44=['events','../../mysqldb','UserNotification','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8c44,0x90));var _0x48c4=function(_0x506091,_0x12f86f){_0x506091=_0x506091-0x0;var _0xdab9ab=_0x8c44[_0x506091];return _0xdab9ab;};'use strict';var EventEmitter=require(_0x48c4('0x0'));var UserNotification=require(_0x48c4('0x1'))['db'][_0x48c4('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x48c4('0x3')](0x0);var events={'afterCreate':_0x48c4('0x4'),'afterUpdate':_0x48c4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a5d90){return function(_0x4ddc78,_0x3ca7a3,_0x447871){UserNotificationEvents['emit'](_0x2a5d90+':'+_0x4ddc78['id'],_0x4ddc78);UserNotificationEvents[_0x48c4('0x6')](_0x2a5d90,_0x4ddc78);_0x447871(null);};}for(var e in events){if(events[_0x48c4('0x7')](e)){var event=events[e];UserNotification[_0x48c4('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 42ef93e..bc6e408 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 _0x037e=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','UserNotification','utf8mb4'];(function(_0x170166,_0x515ade){var _0x554efd=function(_0x11a8ac){while(--_0x11a8ac){_0x170166['push'](_0x170166['shift']());}};_0x554efd(++_0x515ade);}(_0x037e,0x12c));var _0xe037=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x037e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe037('0x0'));var util=require(_0xe037('0x1'));var logger=require(_0xe037('0x2'))(_0xe037('0x3'));var moment=require(_0xe037('0x4'));var BPromise=require(_0xe037('0x5'));var rp=require(_0xe037('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe037('0x7'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0xe037('0x8')]=function(_0x4ea0b6,_0x54f6e0){return _0x4ea0b6[_0xe037('0x9')](_0xe037('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe037('0xb'),'collate':_0xe037('0xc')});}; \ No newline at end of file +var _0xf589=['utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','exports','define','UserNotification','userNotifications','utf8mb4'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0xf589,0x6f));var _0x9f58=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf589[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x9f58('0x0'));var logger=require(_0x9f58('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f58('0x2'));var fs=require('fs');var path=require(_0x9f58('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x9f58('0x4')]=function(_0x26167e,_0xe3daa1){return _0x26167e[_0x9f58('0x5')](_0x9f58('0x6'),attributes,{'tableName':_0x9f58('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9f58('0x8'),'collate':_0x9f58('0x9')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b600a39..a466708 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 _0x1266=['../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xf61586,_0x56b0c4){var _0x2b6eb3=function(_0x47e12b){while(--_0x47e12b){_0xf61586['push'](_0xf61586['shift']());}};_0x2b6eb3(++_0x56b0c4);}(_0x1266,0x1d6));var _0x6126=function(_0x5cf0a0,_0x4ad4a5){_0x5cf0a0=_0x5cf0a0-0x0;var _0x458126=_0x1266[_0x5cf0a0];return _0x458126;};'use strict';var _=require('lodash');var util=require(_0x6126('0x0'));var moment=require(_0x6126('0x1'));var BPromise=require(_0x6126('0x2'));var rs=require(_0x6126('0x3'));var fs=require('fs');var Redis=require(_0x6126('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6126('0x5'));var logger=require(_0x6126('0x6'))(_0x6126('0x7'));var config=require('../../config/environment');var jayson=require(_0x6126('0x8'));var client=jayson['client'][_0x6126('0x9')]({'port':0x232a});config['redis']=_[_0x6126('0xa')](config[_0x6126('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6126('0xc'))(new Redis(config[_0x6126('0xb')]));require(_0x6126('0xd'))[_0x6126('0xe')](socket);function respondWithRpcPromise(_0x40cd6f,_0x27ce71,_0x3b386a){return new BPromise(function(_0x33bf26,_0x14b159){return client[_0x6126('0xf')](_0x40cd6f,_0x3b386a)[_0x6126('0x10')](function(_0x414473){logger[_0x6126('0x11')]('UserNotification,\x20%s,\x20%s',_0x27ce71,_0x6126('0x12'));logger[_0x6126('0x13')](_0x6126('0x14'),_0x27ce71,_0x6126('0x12'),JSON[_0x6126('0x15')](_0x414473));if(_0x414473['error']){if(_0x414473[_0x6126('0x16')][_0x6126('0x17')]===0x1f4){logger[_0x6126('0x16')](_0x6126('0x18'),_0x27ce71,_0x414473[_0x6126('0x16')][_0x6126('0x19')]);return _0x14b159(_0x414473[_0x6126('0x16')]['message']);}logger[_0x6126('0x16')](_0x6126('0x18'),_0x27ce71,_0x414473['error']['message']);return _0x33bf26(_0x414473[_0x6126('0x16')][_0x6126('0x19')]);}else{logger[_0x6126('0x11')](_0x6126('0x18'),_0x27ce71,_0x6126('0x12'));_0x33bf26(_0x414473[_0x6126('0x1a')][_0x6126('0x19')]);}})[_0x6126('0x1b')](function(_0x1bbed0){logger[_0x6126('0x16')](_0x6126('0x18'),_0x27ce71,_0x1bbed0);_0x14b159(_0x1bbed0);});});} \ No newline at end of file +var _0x2682=['../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','UserNotification,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x2682,0x1c6));var _0x2268=function(_0x3d7ca1,_0x47c03c){_0x3d7ca1=_0x3d7ca1-0x0;var _0x368e2d=_0x2682[_0x3d7ca1];return _0x368e2d;};'use strict';var _=require(_0x2268('0x0'));var util=require(_0x2268('0x1'));var moment=require(_0x2268('0x2'));var BPromise=require(_0x2268('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2268('0x4'));var db=require(_0x2268('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2268('0x6'));var config=require(_0x2268('0x7'));var jayson=require(_0x2268('0x8'));var client=jayson['client'][_0x2268('0x9')]({'port':0x232a});config['redis']=_[_0x2268('0xa')](config[_0x2268('0xb')],{'host':_0x2268('0xc'),'port':0x18eb});var socket=require(_0x2268('0xd'))(new Redis(config[_0x2268('0xb')]));require(_0x2268('0xe'))[_0x2268('0xf')](socket);function respondWithRpcPromise(_0x429499,_0x21d775,_0x240715){return new BPromise(function(_0x2fee8e,_0x2f1e5e){return client[_0x2268('0x10')](_0x429499,_0x240715)[_0x2268('0x11')](function(_0xd46f96){logger['info']('UserNotification,\x20%s,\x20%s',_0x21d775,_0x2268('0x12'));logger[_0x2268('0x13')](_0x2268('0x14'),_0x21d775,_0x2268('0x12'),JSON[_0x2268('0x15')](_0xd46f96));if(_0xd46f96[_0x2268('0x16')]){if(_0xd46f96['error']['code']===0x1f4){logger[_0x2268('0x16')](_0x2268('0x17'),_0x21d775,_0xd46f96[_0x2268('0x16')][_0x2268('0x18')]);return _0x2f1e5e(_0xd46f96[_0x2268('0x16')][_0x2268('0x18')]);}logger[_0x2268('0x16')](_0x2268('0x17'),_0x21d775,_0xd46f96[_0x2268('0x16')][_0x2268('0x18')]);return _0x2fee8e(_0xd46f96['error'][_0x2268('0x18')]);}else{logger[_0x2268('0x19')](_0x2268('0x17'),_0x21d775,_0x2268('0x12'));_0x2fee8e(_0xd46f96['result'][_0x2268('0x18')]);}})[_0x2268('0x1a')](function(_0x1a447e){logger['error'](_0x2268('0x17'),_0x21d775,_0x1a447e);_0x2f1e5e(_0x1a447e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 6c41c76..9d61f23 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 _0xbb8d=['save','remove','update','emit','removeListener','register','length','./userNotification.events'];(function(_0x35132d,_0x42d2e7){var _0x130083=function(_0x316ffc){while(--_0x316ffc){_0x35132d['push'](_0x35132d['shift']());}};_0x130083(++_0x42d2e7);}(_0xbb8d,0x14f));var _0xdbb8=function(_0x55f811,_0x4d6d64){_0x55f811=_0x55f811-0x0;var _0x58b852=_0xbb8d[_0x55f811];return _0x58b852;};'use strict';var UserNotificationEvents=require(_0xdbb8('0x0'));var events=[_0xdbb8('0x1'),_0xdbb8('0x2'),_0xdbb8('0x3')];function createListener(_0xd707fe,_0x385449){return function(_0x4eec0f){_0x385449[_0xdbb8('0x4')](_0xd707fe,_0x4eec0f);};}function removeListener(_0x455230,_0xc94306){return function(){UserNotificationEvents[_0xdbb8('0x5')](_0x455230,_0xc94306);};}exports[_0xdbb8('0x6')]=function(_0x2a7c6b){for(var _0x324bba=0x0,_0x1b5f94=events[_0xdbb8('0x7')];_0x324bba<_0x1b5f94;_0x324bba++){var _0x889b1d=events[_0x324bba];var _0x2ef31d=createListener('userNotification:'+_0x889b1d,_0x2a7c6b);UserNotificationEvents['on'](_0x889b1d,_0x2ef31d);}}; \ No newline at end of file +var _0xc57f=['length','userNotification:','./userNotification.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc57f,0xe2));var _0xfc57=function(_0x29cd52,_0x88b52b){_0x29cd52=_0x29cd52-0x0;var _0x5218bc=_0xc57f[_0x29cd52];return _0x5218bc;};'use strict';var UserNotificationEvents=require(_0xfc57('0x0'));var events=[_0xfc57('0x1'),_0xfc57('0x2'),'update'];function createListener(_0x804f69,_0x3eb543){return function(_0x1f7dda){_0x3eb543[_0xfc57('0x3')](_0x804f69,_0x1f7dda);};}function removeListener(_0x171eca,_0x271119){return function(){UserNotificationEvents[_0xfc57('0x4')](_0x171eca,_0x271119);};}exports['register']=function(_0x56e6e6){for(var _0x38650d=0x0,_0x14a003=events[_0xfc57('0x5')];_0x38650d<_0x14a003;_0x38650d++){var _0x2f70e0=events[_0x38650d];var _0x16b091=createListener(_0xfc57('0x6')+_0x2f70e0,_0x56e6e6);UserNotificationEvents['on'](_0x2f70e0,_0x16b091);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 790a59a..4268928 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5f2afa,_0x3d2cd2){var _0xc21b56=function(_0x14825b){while(--_0x14825b){_0x5f2afa['push'](_0x5f2afa['shift']());}};_0xc21b56(++_0x3d2cd2);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1e7d74,_0x22999e){var _0x3b67a0=function(_0x2549b3){while(--_0x2549b3){_0x1e7d74['push'](_0x1e7d74['shift']());}};_0x3b67a0(++_0x22999e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0d3b76a..17fc381 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 _0xea85=['INTEGER','sequelize','exports'];(function(_0x5d21ed,_0x1a58a5){var _0x3bb131=function(_0x262e41){while(--_0x262e41){_0x5d21ed['push'](_0x5d21ed['shift']());}};_0x3bb131(++_0x1a58a5);}(_0xea85,0x1ea));var _0x5ea8=function(_0x5dcffc,_0xd4878b){_0x5dcffc=_0x5dcffc-0x0;var _0x52a026=_0xea85[_0x5dcffc];return _0x52a026;};'use strict';var Sequelize=require(_0x5ea8('0x0'));module[_0x5ea8('0x1')]={'penalty':{'type':Sequelize[_0x5ea8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa74c=['exports','INTEGER'];(function(_0x77a42b,_0x25c9b3){var _0x8f2a8a=function(_0x26964b){while(--_0x26964b){_0x77a42b['push'](_0x77a42b['shift']());}};_0x8f2a8a(++_0x25c9b3);}(_0xa74c,0x106));var _0xca74=function(_0x369aea,_0x40d1c1){_0x369aea=_0x369aea-0x0;var _0x5460ac=_0xa74c[_0x369aea];return _0x5460ac;};'use strict';var Sequelize=require('sequelize');module[_0xca74('0x0')]={'penalty':{'type':Sequelize[_0xca74('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 60f7b54..669f156 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 _0x0253=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0x0253,0xc5));var _0x3025=function(_0x50f555,_0x5904d3){_0x50f555=_0x50f555-0x0;var _0x5319cf=_0x0253[_0x50f555];return _0x5319cf;};'use strict';var _=require(_0x3025('0x0'));var util=require(_0x3025('0x1'));var logger=require(_0x3025('0x2'))(_0x3025('0x3'));var moment=require('moment');var BPromise=require(_0x3025('0x4'));var rp=require(_0x3025('0x5'));var fs=require('fs');var path=require(_0x3025('0x6'));var rimraf=require('rimraf');var config=require(_0x3025('0x7'));var attributes=require(_0x3025('0x8'));module['exports']=function(_0x32d9e0,_0x1ae462){return _0x32d9e0[_0x3025('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x3025('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d3c=['bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7d3c,0xe0));var _0xc7d3=function(_0xd6d456,_0x37accf){_0xd6d456=_0xd6d456-0x0;var _0x5c3e7d=_0x7d3c[_0xd6d456];return _0x5c3e7d;};'use strict';var _=require(_0xc7d3('0x0'));var util=require(_0xc7d3('0x1'));var logger=require(_0xc7d3('0x2'))(_0xc7d3('0x3'));var moment=require('moment');var BPromise=require(_0xc7d3('0x4'));var rp=require(_0xc7d3('0x5'));var fs=require('fs');var path=require(_0xc7d3('0x6'));var rimraf=require(_0xc7d3('0x7'));var config=require('../../config/environment');var attributes=require(_0xc7d3('0x8'));module['exports']=function(_0x1196fc,_0x31ab9c){return _0x1196fc[_0xc7d3('0x9')](_0xc7d3('0xa'),attributes,{'tableName':_0xc7d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 6b5e561..aedf8ff 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 _0x4619=['jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x1495d5,_0x581401){var _0x320de6=function(_0x3c4618){while(--_0x3c4618){_0x1495d5['push'](_0x1495d5['shift']());}};_0x320de6(++_0x581401);}(_0x4619,0x162));var _0x9461=function(_0x21c0af,_0x4dcaa4){_0x21c0af=_0x21c0af-0x0;var _0x23a010=_0x4619[_0x21c0af];return _0x23a010;};'use strict';var _=require(_0x9461('0x0'));var util=require(_0x9461('0x1'));var moment=require('moment');var BPromise=require(_0x9461('0x2'));var rs=require(_0x9461('0x3'));var fs=require('fs');var Redis=require(_0x9461('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9461('0x5'))('rpc');var config=require(_0x9461('0x6'));var jayson=require(_0x9461('0x7'));var client=jayson[_0x9461('0x8')][_0x9461('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f654b,_0x56bdfd,_0x5f0fe7){return new BPromise(function(_0x1d7a3b,_0x1876e8){return client['request'](_0x1f654b,_0x5f0fe7)[_0x9461('0xa')](function(_0x268ff0){logger[_0x9461('0xb')](_0x9461('0xc'),_0x56bdfd,_0x9461('0xd'));logger[_0x9461('0xe')](_0x9461('0xf'),_0x56bdfd,_0x9461('0xd'),JSON['stringify'](_0x268ff0));if(_0x268ff0['error']){if(_0x268ff0[_0x9461('0x10')][_0x9461('0x11')]===0x1f4){logger['error'](_0x9461('0xc'),_0x56bdfd,_0x268ff0[_0x9461('0x10')][_0x9461('0x12')]);return _0x1876e8(_0x268ff0[_0x9461('0x10')][_0x9461('0x12')]);}logger[_0x9461('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x56bdfd,_0x268ff0[_0x9461('0x10')][_0x9461('0x12')]);return _0x1d7a3b(_0x268ff0[_0x9461('0x10')][_0x9461('0x12')]);}else{logger[_0x9461('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x56bdfd,_0x9461('0xd'));_0x1d7a3b(_0x268ff0['result'][_0x9461('0x12')]);}})['catch'](function(_0x28cdfc){logger[_0x9461('0x10')](_0x9461('0xc'),_0x56bdfd,_0x28cdfc);_0x1876e8(_0x28cdfc);});});} \ No newline at end of file +var _0x805d=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0xb1ee32,_0x564da0){var _0x2dd72d=function(_0x213515){while(--_0x213515){_0xb1ee32['push'](_0xb1ee32['shift']());}};_0x2dd72d(++_0x564da0);}(_0x805d,0xed));var _0xd805=function(_0x4fa292,_0x4a2263){_0x4fa292=_0x4fa292-0x0;var _0x14d0c3=_0x805d[_0x4fa292];return _0x14d0c3;};'use strict';var _=require(_0xd805('0x0'));var util=require(_0xd805('0x1'));var moment=require(_0xd805('0x2'));var BPromise=require('bluebird');var rs=require(_0xd805('0x3'));var fs=require('fs');var Redis=require(_0xd805('0x4'));var db=require(_0xd805('0x5'))['db'];var utils=require(_0xd805('0x6'));var logger=require(_0xd805('0x7'))(_0xd805('0x8'));var config=require(_0xd805('0x9'));var jayson=require(_0xd805('0xa'));var client=jayson[_0xd805('0xb')][_0xd805('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cea4f,_0x3309f0,_0x1da394){return new BPromise(function(_0x23e812,_0x33d34f){return client[_0xd805('0xd')](_0x3cea4f,_0x1da394)[_0xd805('0xe')](function(_0x5cff91){logger[_0xd805('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3309f0,_0xd805('0x10'));logger[_0xd805('0x11')](_0xd805('0x12'),_0x3309f0,_0xd805('0x10'),JSON[_0xd805('0x13')](_0x5cff91));if(_0x5cff91[_0xd805('0x14')]){if(_0x5cff91[_0xd805('0x14')][_0xd805('0x15')]===0x1f4){logger[_0xd805('0x14')](_0xd805('0x16'),_0x3309f0,_0x5cff91['error']['message']);return _0x33d34f(_0x5cff91[_0xd805('0x14')][_0xd805('0x17')]);}logger['error'](_0xd805('0x16'),_0x3309f0,_0x5cff91[_0xd805('0x14')][_0xd805('0x17')]);return _0x23e812(_0x5cff91[_0xd805('0x14')][_0xd805('0x17')]);}else{logger[_0xd805('0xf')](_0xd805('0x16'),_0x3309f0,_0xd805('0x10'));_0x23e812(_0x5cff91[_0xd805('0x18')][_0xd805('0x17')]);}})[_0xd805('0x19')](function(_0x2383b7){logger[_0xd805('0x14')](_0xd805('0x16'),_0x3309f0,_0x2383b7);_0x33d34f(_0x2383b7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 715acc9..bebb9dd 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 _0x92fc=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/resources','getResources','post','create','/:id/clone','/:id/sections','delete','destroy','removeResources'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x92fc,0x1dc));var _0xc92f=function(_0xc1fac2,_0x725358){_0xc1fac2=_0xc1fac2-0x0;var _0x1a31f8=_0x92fc[_0xc1fac2];return _0x1a31f8;};'use strict';var multer=require(_0xc92f('0x0'));var util=require(_0xc92f('0x1'));var path=require(_0xc92f('0x2'));var timeout=require(_0xc92f('0x3'));var express=require(_0xc92f('0x4'));var router=express[_0xc92f('0x5')]();var fs_extra=require(_0xc92f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc92f('0x7'));var config=require('../../config/environment');var controller=require(_0xc92f('0x8'));router[_0xc92f('0x9')]('/',auth[_0xc92f('0xa')](),controller[_0xc92f('0xb')]);router[_0xc92f('0x9')](_0xc92f('0xc'),auth[_0xc92f('0xa')](),controller[_0xc92f('0xd')]);router['get'](_0xc92f('0xe'),auth[_0xc92f('0xa')](),controller['show']);router[_0xc92f('0x9')]('/:id/sections',auth[_0xc92f('0xa')](),controller['getSections']);router[_0xc92f('0x9')](_0xc92f('0xf'),auth[_0xc92f('0xa')](),controller[_0xc92f('0x10')]);router[_0xc92f('0x11')]('/',auth[_0xc92f('0xa')](),controller[_0xc92f('0x12')]);router[_0xc92f('0x11')](_0xc92f('0x13'),auth['isAuthenticated'](),controller['clone']);router[_0xc92f('0x11')](_0xc92f('0x14'),auth[_0xc92f('0xa')](),controller['addSections']);router[_0xc92f('0x11')]('/:id/resources',auth[_0xc92f('0xa')](),controller['addResources']);router['put']('/:id',auth[_0xc92f('0xa')](),controller['update']);router[_0xc92f('0x15')](_0xc92f('0xe'),auth['isAuthenticated'](),controller[_0xc92f('0x16')]);router[_0xc92f('0x15')]('/:id/sections',auth[_0xc92f('0xa')](),controller['removeSections']);router[_0xc92f('0x15')]('/:id/resources',auth[_0xc92f('0xa')](),controller[_0xc92f('0x17')]);module[_0xc92f('0x18')]=router; \ No newline at end of file +var _0xd345=['create','/:id/clone','addSections','addResources','put','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post'];(function(_0xb4b957,_0x426ef2){var _0x2a0779=function(_0x38b048){while(--_0x38b048){_0xb4b957['push'](_0xb4b957['shift']());}};_0x2a0779(++_0x426ef2);}(_0xd345,0x148));var _0x5d34=function(_0x4ec2e8,_0x25f577){_0x4ec2e8=_0x4ec2e8-0x0;var _0x39df4b=_0xd345[_0x4ec2e8];return _0x39df4b;};'use strict';var multer=require(_0x5d34('0x0'));var util=require(_0x5d34('0x1'));var path=require(_0x5d34('0x2'));var timeout=require(_0x5d34('0x3'));var express=require('express');var router=express[_0x5d34('0x4')]();var fs_extra=require(_0x5d34('0x5'));var auth=require(_0x5d34('0x6'));var interaction=require(_0x5d34('0x7'));var config=require(_0x5d34('0x8'));var controller=require('./userProfile.controller');router['get']('/',auth[_0x5d34('0x9')](),controller[_0x5d34('0xa')]);router['get']('/describe',auth[_0x5d34('0x9')](),controller[_0x5d34('0xb')]);router[_0x5d34('0xc')](_0x5d34('0xd'),auth[_0x5d34('0x9')](),controller[_0x5d34('0xe')]);router[_0x5d34('0xc')](_0x5d34('0xf'),auth['isAuthenticated'](),controller[_0x5d34('0x10')]);router[_0x5d34('0xc')](_0x5d34('0x11'),auth[_0x5d34('0x9')](),controller[_0x5d34('0x12')]);router[_0x5d34('0x13')]('/',auth['isAuthenticated'](),controller[_0x5d34('0x14')]);router[_0x5d34('0x13')](_0x5d34('0x15'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x5d34('0xf'),auth[_0x5d34('0x9')](),controller[_0x5d34('0x16')]);router[_0x5d34('0x13')](_0x5d34('0x11'),auth[_0x5d34('0x9')](),controller[_0x5d34('0x17')]);router[_0x5d34('0x18')](_0x5d34('0xd'),auth[_0x5d34('0x9')](),controller['update']);router[_0x5d34('0x19')](_0x5d34('0xd'),auth[_0x5d34('0x9')](),controller['destroy']);router[_0x5d34('0x19')](_0x5d34('0xf'),auth[_0x5d34('0x9')](),controller[_0x5d34('0x1a')]);router[_0x5d34('0x19')](_0x5d34('0x11'),auth[_0x5d34('0x9')](),controller[_0x5d34('0x1b')]);module[_0x5d34('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 69bbd62..64656ac 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 _0xac2b=['STRING','name','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac2b,0x6f));var _0xbac2=function(_0x3840cc,_0x375936){_0x3840cc=_0x3840cc-0x0;var _0xfe3d26=_0xac2b[_0x3840cc];return _0xfe3d26;};'use strict';var Sequelize=require(_0xbac2('0x0'));module['exports']={'name':{'type':Sequelize[_0xbac2('0x1')],'allowNull':![],'unique':_0xbac2('0x2')},'crudPermissions':{'type':Sequelize[_0xbac2('0x1')],'set':function(_0x39b3ed){this['setDataValue'](_0xbac2('0x3'),_0x39b3ed?_0x39b3ed[_0xbac2('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xbac2('0x3'))?this[_0xbac2('0x5')](_0xbac2('0x3'))[_0xbac2('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xbac2('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xbac2('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xbac2('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xbac2('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xbac2('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xbac2('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xbac2('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xbac2('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7487=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','STRING'];(function(_0x5a905e,_0x31aa4a){var _0x4124d6=function(_0x37c28a){while(--_0x37c28a){_0x5a905e['push'](_0x5a905e['shift']());}};_0x4124d6(++_0x31aa4a);}(_0x7487,0x109));var _0x7748=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x7487[_0x507c81];return _0x368a25;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7748('0x0')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x7748('0x0')],'set':function(_0x4d4a5b){this[_0x7748('0x1')](_0x7748('0x2'),_0x4d4a5b?_0x4d4a5b[_0x7748('0x3')](''):[]);},'get':function(){return this[_0x7748('0x4')](_0x7748('0x2'))?this[_0x7748('0x4')]('crudPermissions')[_0x7748('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7748('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7748('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7748('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7748('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7748('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7748('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7748('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7748('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d2cdcfa..2c350a0 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 _0xb76c=['findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','UserProfile','count','includeAll','findAll','rows','catch','show','length','find','create','clone','params','include','get','omit','createdAt','updatedAt','body','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','destroy','describe','addSections','transaction','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat'];(function(_0x23146b,_0x3d2938){var _0x31bb57=function(_0x4c2d25){while(--_0x4c2d25){_0x23146b['push'](_0x23146b['shift']());}};_0x31bb57(++_0x3d2938);}(_0xb76c,0x81));var _0xcb76=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0xb76c[_0x4fd109];return _0x30f0a6;};'use strict';var emlformat=require(_0xcb76('0x0'));var rimraf=require(_0xcb76('0x1'));var zipdir=require(_0xcb76('0x2'));var jsonpatch=require(_0xcb76('0x3'));var rp=require(_0xcb76('0x4'));var moment=require(_0xcb76('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb76('0x6'));var util=require(_0xcb76('0x7'));var path=require('path');var sox=require(_0xcb76('0x8'));var csv=require(_0xcb76('0x9'));var ejs=require(_0xcb76('0xa'));var fs=require('fs');var fs_extra=require(_0xcb76('0xb'));var _=require('lodash');var squel=require(_0xcb76('0xc'));var crypto=require(_0xcb76('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcb76('0x9'));var querystring=require(_0xcb76('0xe'));var Papa=require(_0xcb76('0xf'));var Redis=require(_0xcb76('0x10'));var authService=require(_0xcb76('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcb76('0x12'));var hardwareService=require(_0xcb76('0x13'));var logger=require(_0xcb76('0x14'))(_0xcb76('0x15'));var utils=require(_0xcb76('0x16'));var config=require(_0xcb76('0x17'));var licenseUtil=require(_0xcb76('0x18'));var db=require(_0xcb76('0x19'))['db'];config[_0xcb76('0x1a')]=_['defaults'](config[_0xcb76('0x1a')],{'host':_0xcb76('0x1b'),'port':0x18eb});var socket=require(_0xcb76('0x1c'))(new Redis(config['redis']));require(_0xcb76('0x1d'))[_0xcb76('0x1e')](socket);function respondWithStatusCode(_0x4cf095,_0x691ba5){_0x691ba5=_0x691ba5||0xcc;return function(_0x269f19){if(_0x269f19){return _0x4cf095[_0xcb76('0x1f')](_0x691ba5);}return _0x4cf095[_0xcb76('0x20')](_0x691ba5)[_0xcb76('0x21')]();};}function respondWithResult(_0x208877,_0x4120c8){_0x4120c8=_0x4120c8||0xc8;return function(_0x289dd){if(_0x289dd){return _0x208877[_0xcb76('0x20')](_0x4120c8)[_0xcb76('0x22')](_0x289dd);}};}function respondWithFilteredResult(_0x3ba698,_0x376648){return function(_0x17c767){if(_0x17c767){var _0x5177a4=typeof _0x376648['offset']===_0xcb76('0x23')&&typeof _0x376648[_0xcb76('0x24')]===_0xcb76('0x23');var _0x398b76=_0x17c767['count'];var _0x4d51cb=_0x5177a4?0x0:_0x376648[_0xcb76('0x25')];var _0x28654c=_0x5177a4?_0x17c767['count']:_0x376648[_0xcb76('0x25')]+_0x376648['limit'];var _0x9d3b43;if(_0x28654c>=_0x398b76){_0x28654c=_0x398b76;_0x9d3b43=0xc8;}else{_0x9d3b43=0xce;}_0x3ba698['status'](_0x9d3b43);return _0x3ba698[_0xcb76('0x26')](_0xcb76('0x27'),_0x4d51cb+'-'+_0x28654c+'/'+_0x398b76)[_0xcb76('0x22')](_0x17c767);}return null;};}function patchUpdates(_0x505ec6){return function(_0x1f1e6c){try{jsonpatch[_0xcb76('0x28')](_0x1f1e6c,_0x505ec6,!![]);}catch(_0x53ff23){return BPromise[_0xcb76('0x29')](_0x53ff23);}return _0x1f1e6c[_0xcb76('0x2a')]();};}function saveUpdates(_0x57e22b,_0x52b167){return function(_0x5d39dd){if(_0x5d39dd){return _0x5d39dd[_0xcb76('0x2b')](_0x57e22b)[_0xcb76('0x2c')](function(_0x810ad7){return _0x810ad7;});}return null;};}function removeEntity(_0x555679,_0x5429b7){return function(_0x1f986e){if(_0x1f986e){return _0x1f986e['destroy']()[_0xcb76('0x2c')](function(){_0x555679[_0xcb76('0x20')](0xcc)[_0xcb76('0x21')]();});}};}function handleEntityNotFound(_0x5a8c0d,_0x53bd0e){return function(_0xa8f92d){if(!_0xa8f92d){_0x5a8c0d[_0xcb76('0x1f')](0x194);}return _0xa8f92d;};}function handleError(_0x475763,_0x372aee){_0x372aee=_0x372aee||0x1f4;return function(_0x2b1007){logger['error'](_0x2b1007['stack']);if(_0x2b1007[_0xcb76('0x2d')]){delete _0x2b1007[_0xcb76('0x2d')];}_0x475763[_0xcb76('0x20')](_0x372aee)[_0xcb76('0x2e')](_0x2b1007);};}exports[_0xcb76('0x2f')]=function(_0x20ea41,_0x31920e){var _0x38d049={},_0x5eb5fe={},_0x55cefb={'count':0x0,'rows':[]};var _0x2b2313=_[_0xcb76('0x30')](db['UserProfile'][_0xcb76('0x31')],function(_0x328140){return{'name':_0x328140['fieldName'],'type':_0x328140['type'][_0xcb76('0x32')]};});_0x5eb5fe['model']=_[_0xcb76('0x30')](_0x2b2313,_0xcb76('0x2d'));_0x5eb5fe[_0xcb76('0x33')]=_[_0xcb76('0x34')](_0x20ea41['query']);_0x5eb5fe[_0xcb76('0x35')]=_[_0xcb76('0x36')](_0x5eb5fe[_0xcb76('0x37')],_0x5eb5fe[_0xcb76('0x33')]);_0x38d049['attributes']=_[_0xcb76('0x36')](_0x5eb5fe[_0xcb76('0x37')],qs[_0xcb76('0x38')](_0x20ea41[_0xcb76('0x33')][_0xcb76('0x38')]));_0x38d049[_0xcb76('0x39')]=_0x38d049[_0xcb76('0x39')]['length']?_0x38d049[_0xcb76('0x39')]:_0x5eb5fe[_0xcb76('0x37')];if(!_0x20ea41[_0xcb76('0x33')][_0xcb76('0x3a')](_0xcb76('0x3b'))){_0x38d049['limit']=qs[_0xcb76('0x24')](_0x20ea41['query'][_0xcb76('0x24')]);_0x38d049[_0xcb76('0x25')]=qs['offset'](_0x20ea41[_0xcb76('0x33')][_0xcb76('0x25')]);}_0x38d049[_0xcb76('0x3c')]=qs['sort'](_0x20ea41[_0xcb76('0x33')][_0xcb76('0x3d')]);_0x38d049['where']=qs[_0xcb76('0x35')](_[_0xcb76('0x3e')](_0x20ea41[_0xcb76('0x33')],_0x5eb5fe[_0xcb76('0x35')]),_0x2b2313);if(_0x20ea41[_0xcb76('0x33')][_0xcb76('0x3f')]){_0x38d049[_0xcb76('0x40')]=_[_0xcb76('0x41')](_0x38d049[_0xcb76('0x40')],{'$or':_['map'](_0x2b2313,function(_0x11e0b7){if(_0x11e0b7[_0xcb76('0x42')]!=='VIRTUAL'){var _0x3c8071={};_0x3c8071[_0x11e0b7[_0xcb76('0x2d')]]={'$like':'%'+_0x20ea41[_0xcb76('0x33')][_0xcb76('0x3f')]+'%'};return _0x3c8071;}})});}_0x38d049=_[_0xcb76('0x41')]({},_0x38d049,_0x20ea41[_0xcb76('0x43')]);var _0x43e46d={'where':_0x38d049['where']};return db[_0xcb76('0x44')][_0xcb76('0x45')](_0x43e46d)['then'](function(_0x2bd649){_0x55cefb[_0xcb76('0x45')]=_0x2bd649;if(_0x20ea41[_0xcb76('0x33')][_0xcb76('0x46')]){_0x38d049['include']=[{'all':!![]}];}return db['UserProfile'][_0xcb76('0x47')](_0x38d049);})[_0xcb76('0x2c')](function(_0x1f91e2){_0x55cefb[_0xcb76('0x48')]=_0x1f91e2;return _0x55cefb;})[_0xcb76('0x2c')](respondWithFilteredResult(_0x31920e,_0x38d049))[_0xcb76('0x49')](handleError(_0x31920e,null));};exports[_0xcb76('0x4a')]=function(_0x5912be,_0x41c531){var _0x4f2a72={'raw':![],'where':{'id':_0x5912be['params']['id']}},_0x4c0aa3={};_0x4c0aa3[_0xcb76('0x37')]=_['keys'](db[_0xcb76('0x44')][_0xcb76('0x31')]);_0x4c0aa3[_0xcb76('0x33')]=_[_0xcb76('0x34')](_0x5912be[_0xcb76('0x33')]);_0x4c0aa3[_0xcb76('0x35')]=_[_0xcb76('0x36')](_0x4c0aa3[_0xcb76('0x37')],_0x4c0aa3['query']);_0x4f2a72[_0xcb76('0x39')]=_['intersection'](_0x4c0aa3[_0xcb76('0x37')],qs[_0xcb76('0x38')](_0x5912be[_0xcb76('0x33')][_0xcb76('0x38')]));_0x4f2a72[_0xcb76('0x39')]=_0x4f2a72['attributes'][_0xcb76('0x4b')]?_0x4f2a72[_0xcb76('0x39')]:_0x4c0aa3['model'];if(_0x5912be['query'][_0xcb76('0x46')]){_0x4f2a72['include']=[{'all':!![]}];}_0x4f2a72=_[_0xcb76('0x41')]({},_0x4f2a72,_0x5912be[_0xcb76('0x43')]);return db[_0xcb76('0x44')][_0xcb76('0x4c')](_0x4f2a72)['then'](handleEntityNotFound(_0x41c531,null))[_0xcb76('0x2c')](respondWithResult(_0x41c531,null))['catch'](handleError(_0x41c531,null));};exports[_0xcb76('0x4d')]=function(_0x415578,_0x837ddf){return db[_0xcb76('0x44')]['create'](_0x415578['body'],{})['then'](respondWithResult(_0x837ddf,0xc9))['catch'](handleError(_0x837ddf,null));};exports[_0xcb76('0x4e')]=function(_0x1244a6,_0x5d346e){var _0x27b188={'where':{'id':_0x1244a6[_0xcb76('0x4f')]['id']}},_0x40e161={};_0x40e161[_0xcb76('0x37')]=_[_0xcb76('0x34')](db[_0xcb76('0x44')][_0xcb76('0x31')]);_0x27b188[_0xcb76('0x39')]=_['intersection'](_0x40e161['model'],qs[_0xcb76('0x38')](_0x1244a6['query']['fields']));_0x27b188['attributes']=_0x27b188['attributes'][_0xcb76('0x4b')]?_0x27b188[_0xcb76('0x39')]:_0x40e161[_0xcb76('0x37')];if(_0x1244a6[_0xcb76('0x33')][_0xcb76('0x46')]){_0x27b188[_0xcb76('0x50')]=[{'all':!![]}];}_0x27b188=_[_0xcb76('0x41')]({},_0x27b188,_0x1244a6[_0xcb76('0x43')]);return db[_0xcb76('0x44')][_0xcb76('0x4c')](_0x27b188)[_0xcb76('0x2c')](handleEntityNotFound(_0x5d346e,null))[_0xcb76('0x2c')](function(_0x5808e5){if(_0x5808e5){var _0x17d7e4=_0x5808e5[_0xcb76('0x51')]({'plain':!![]});_0x17d7e4=qs[_0xcb76('0x52')](_0x17d7e4,['id',_0xcb76('0x53'),_0xcb76('0x54'),'crudPermissions']);_0x1244a6[_0xcb76('0x55')]=_[_0xcb76('0x52')](_0x1244a6['body'],['id','createdAt',_0xcb76('0x54')]);return db[_0xcb76('0x56')]['transaction'](function(_0x5be856){return db[_0xcb76('0x44')]['create'](_['merge'](_0x17d7e4,_0x1244a6[_0xcb76('0x55')]),{'include':_0x1244a6[_0xcb76('0x33')][_0xcb76('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x5be856})['then'](function(_0x54e117){var _0x1115e0=_0x54e117[_0xcb76('0x51')]({'plain':!![]});return db[_0xcb76('0x57')]['findAll']({'where':{'userProfileId':_0x1244a6[_0xcb76('0x4f')]['id']},'raw':!![]})[_0xcb76('0x2c')](function(_0x3f8b4a){if(_0x3f8b4a){return BPromise[_0xcb76('0x58')](_0x3f8b4a,function(_0x214c9d){return new BPromise(function(_0x28c39d,_0xbe0ae){if(_0x214c9d['autoAssociation']===null||_0x214c9d[_0xcb76('0x59')]===0x1)_0x28c39d(null);return db[_0xcb76('0x5a')][_0xcb76('0x47')]({'where':{'sectionId':_0x214c9d['id']},'raw':!![]})[_0xcb76('0x2c')](function(_0x4d0867){var _0x26967d=_[_0xcb76('0x30')](_0x4d0867,function(_0x45a969){return qs[_0xcb76('0x52')](_0x45a969,['id',_0xcb76('0x53'),_0xcb76('0x54'),'sectionId']);});_0x28c39d(_0x26967d);})[_0xcb76('0x49')](function(_0x588ae0){_0xbe0ae(_0x588ae0);});})[_0xcb76('0x2c')](function(_0x1ee5e8){var _0x2ddc8b=qs[_0xcb76('0x52')](_0x214c9d,['id',_0xcb76('0x53'),'updatedAt']);_0x2ddc8b[_0xcb76('0x5b')]=_0x1115e0['id'];if(_0x1ee5e8)_0x2ddc8b[_0xcb76('0x5c')]=_0x1ee5e8;return _0x2ddc8b;})[_0xcb76('0x2c')](function(_0x1aba03){return db[_0xcb76('0x57')]['create'](_0x1aba03,{'include':[{'model':db['UserProfileResource'],'as':_0xcb76('0x5c')}],'raw':!![],'transaction':_0x5be856});});})[_0xcb76('0x2c')](function(){return _0x1115e0;});}});});});}})[_0xcb76('0x2c')](respondWithResult(_0x5d346e,0xc9))['catch'](handleError(_0x5d346e,null));};exports[_0xcb76('0x2b')]=function(_0xf87b63,_0x50c844){if(_0xf87b63['body']['id']){delete _0xf87b63[_0xcb76('0x55')]['id'];}return db[_0xcb76('0x44')][_0xcb76('0x4c')]({'where':{'id':_0xf87b63[_0xcb76('0x4f')]['id']}})[_0xcb76('0x2c')](handleEntityNotFound(_0x50c844,null))['then'](saveUpdates(_0xf87b63[_0xcb76('0x55')],null))[_0xcb76('0x2c')](respondWithResult(_0x50c844,null))[_0xcb76('0x49')](handleError(_0x50c844,null));};exports[_0xcb76('0x5d')]=function(_0x13671f,_0x2e9fae){return db[_0xcb76('0x44')][_0xcb76('0x4c')]({'where':{'id':_0x13671f[_0xcb76('0x4f')]['id']}})[_0xcb76('0x2c')](handleEntityNotFound(_0x2e9fae,null))[_0xcb76('0x2c')](removeEntity(_0x2e9fae,null))[_0xcb76('0x49')](handleError(_0x2e9fae,null));};exports[_0xcb76('0x5e')]=function(_0x3e5194,_0x58556a){return db[_0xcb76('0x44')]['describe']()['then'](respondWithResult(_0x58556a,null))[_0xcb76('0x49')](handleError(_0x58556a,null));};exports[_0xcb76('0x5f')]=function(_0x479d94,_0x2596d7){var _0x587e38=_0x479d94[_0xcb76('0x55')];return db[_0xcb76('0x44')][_0xcb76('0x4c')]({'where':{'id':_0x479d94[_0xcb76('0x4f')]['id']}})[_0xcb76('0x2c')](handleEntityNotFound(_0x2596d7,null))[_0xcb76('0x2c')](function(_0x140a05){if(_0x140a05){return db['sequelize'][_0xcb76('0x60')](function(_0x5c0618){return db[_0xcb76('0x57')][_0xcb76('0x5d')]({'where':{'userProfileId':_0x479d94[_0xcb76('0x4f')]['id'],'sectionId':_[_0xcb76('0x30')](_0x587e38,function(_0x3fba33){return _0x3fba33[_0xcb76('0x61')];})},'transaction':_0x5c0618})['then'](function(){var _0x5e3972=_[_0xcb76('0x30')](_0x587e38,function(_0x15e79f){_0x15e79f[_0xcb76('0x5b')]=_0x479d94[_0xcb76('0x4f')]['id'];return _0x15e79f;});var _0x16c9a5=[];return BPromise['each'](_0x5e3972,function(_0x132e4e){return db['UserProfileSection'][_0xcb76('0x4d')](_0x132e4e,{'include':[{'model':db[_0xcb76('0x5a')],'as':_0xcb76('0x5c')}],'raw':!![],'transaction':_0x5c0618})[_0xcb76('0x2c')](function(_0x2476f6){_0x16c9a5[_0xcb76('0x62')](_0x2476f6[_0xcb76('0x51')]({'plain':!![]}));});})[_0xcb76('0x2c')](function(){return _0x16c9a5;});});});}})[_0xcb76('0x2c')](function(_0x35b7e7){return _0x35b7e7;})[_0xcb76('0x2c')](respondWithResult(_0x2596d7,null))['catch'](handleError(_0x2596d7,null));};exports[_0xcb76('0x63')]=function(_0x1d270d,_0x22c33a){var _0x24bf2c;return db['UserProfile'][_0xcb76('0x4c')]({'where':{'id':_0x1d270d[_0xcb76('0x4f')]['id']},'attributes':['id',_0xcb76('0x2d')]})['then'](handleEntityNotFound(_0x22c33a,null))[_0xcb76('0x2c')](function(_0x2a23fe){if(_0x2a23fe){_0x24bf2c=_0x2a23fe;return db[_0xcb76('0x57')]['destroy']({'where':{'userProfileId':_0x1d270d[_0xcb76('0x4f')]['id'],'sectionId':_0x1d270d[_0xcb76('0x33')][_0xcb76('0x64')]}});}})[_0xcb76('0x2c')](function(){return _0x24bf2c;})[_0xcb76('0x2c')](respondWithStatusCode(_0x22c33a,null))[_0xcb76('0x49')](handleError(_0x22c33a,null));};exports[_0xcb76('0x65')]=function(_0x47aa3a,_0x4f3638){var _0x2b161d=[];var _0x1d6961=[];return db[_0xcb76('0x57')][_0xcb76('0x47')]({'where':{'userProfileId':_0x47aa3a[_0xcb76('0x4f')]['id']},'raw':!![]})['then'](function(_0x39d56a){_0x2b161d=_['filter'](_0x39d56a,function(_0x3398d3){return _0x3398d3[_0xcb76('0x66')]===0x1||_[_0xcb76('0x67')]([0x3eb,0x709],_0x3398d3[_0xcb76('0x61')]);});if(!_[_0xcb76('0x68')](_0x2b161d)){return _[_0xcb76('0x30')](_0x2b161d,function(_0x1ba39b){return _0x1ba39b[_0xcb76('0x61')];});}else{return;}})[_0xcb76('0x2c')](function(_0xf4b78e){if(_0xf4b78e)_0x1d6961=_0xf4b78e;if(_['includes'](_0x1d6961,0x64)){var _0x4a6349=_['find'](_0x2b161d,{'sectionId':0x64});return hasDefaultDashboard(_0x4a6349)[_0xcb76('0x2c')](function(_0x83b89){return _[_0xcb76('0x30')](_0x2b161d,function(_0x3bfb12){if(_0x3bfb12[_0xcb76('0x61')]===0x64){_0x3bfb12[_0xcb76('0x69')]=_0x83b89;}return _0x3bfb12;});});}else{return;}})['then'](function(_0x297065){if(_0x297065)_0x2b161d=_0x297065;if(_[_0xcb76('0x67')](_0x1d6961,0x3eb)){var _0x1f14cf=_[_0xcb76('0x4c')](_0x2b161d,{'sectionId':0x3eb});return getCustomDashboards(_0x1f14cf)[_0xcb76('0x2c')](function(_0x1664b9){return _[_0xcb76('0x30')](_0x2b161d,function(_0x38ac4f){if(_0x1f14cf[_0xcb76('0x66')]){if(_0x38ac4f[_0xcb76('0x61')]===0x3eb){_0x38ac4f[_0xcb76('0x69')]=_0x1664b9;}}else{if(_0x38ac4f[_0xcb76('0x61')]===0x64){if(!_0x38ac4f[_0xcb76('0x69')]){_0x38ac4f['subsections']=[];}_0x38ac4f[_0xcb76('0x69')]=_0x38ac4f[_0xcb76('0x69')][_0xcb76('0x6a')](_0x1664b9);}}return _0x38ac4f;});});}else{return;}})['then'](function(_0x3a90ab){if(_0x3a90ab)_0x2b161d=_0x3a90ab;if(_[_0xcb76('0x67')](_0x1d6961,0x709)){var _0x24f93c=_[_0xcb76('0x4c')](_0x2b161d,{'sectionId':0x709});return getPlugins(_0x24f93c)['then'](function(_0x1da823){if(_0x24f93c[_0xcb76('0x66')]){return _['map'](_0x2b161d,function(_0x444c86){if(_0x444c86[_0xcb76('0x61')]===0x709){_0x444c86['subsections']=_0x1da823;}return _0x444c86;});}else{var _0x62635a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1da823};var _0xe6f668=_[_0xcb76('0x30')](_0x2b161d);_0xe6f668[_0xcb76('0x62')](_0x62635a);return _0xe6f668;}});}else{return;}})[_0xcb76('0x2c')](function(_0x2bdaf6){if(_0x2bdaf6)_0x2b161d=_0x2bdaf6;return _[_0xcb76('0x3f')](_0x2b161d,[_0xcb76('0x66'),0x1]);})[_0xcb76('0x2c')](respondWithResult(_0x4f3638,null))[_0xcb76('0x49')](handleError(_0x4f3638,null));};function hasDefaultDashboard(_0x30c753){var _0x4940fe=[0x65];return new BPromise(function(_0x19e65b,_0x4df92d){try{if(_0x30c753['autoAssociation']){_0x19e65b(_0x4940fe);}else{return db[_0xcb76('0x5a')][_0xcb76('0x6b')]({'where':{'sectionId':_0x30c753['id']},'raw':!![]})[_0xcb76('0x2c')](function(_0x1aa6ed){_0x1aa6ed?_0x19e65b(_0x4940fe):_0x19e65b();});}}catch(_0x47f371){_0x4df92d(_0x47f371);}});}function getCustomDashboards(_0x30dc68){var _0x19e521=[];return new BPromise(function(_0x30e448,_0xf94bc9){try{if(_0x30dc68[_0xcb76('0x59')]){return db[_0xcb76('0x6c')][_0xcb76('0x47')]({'raw':!![]})[_0xcb76('0x2c')](function(_0x418604){_0x418604[_0xcb76('0x6d')](function(_0xc5db59){_0x19e521['push'](_0xc5db59['id']+0x1869f);});_0x30e448(_0x19e521);});}else{return db['UserProfileResource'][_0xcb76('0x47')]({'where':{'sectionId':_0x30dc68['id']},'raw':!![]})[_0xcb76('0x2c')](function(_0x5b5e4d){_0x5b5e4d['forEach'](function(_0x273fba){_0x19e521[_0xcb76('0x62')](_0x273fba[_0xcb76('0x6e')]+0x1869f);});_0x30e448(_0x19e521);});}}catch(_0x44965a){_0xf94bc9(_0x44965a);}});}function getPlugins(_0x1de594){var _0x21c2be=[];return new BPromise(function(_0x4b2f88,_0x54def3){try{if(_0x1de594[_0xcb76('0x59')]){return db[_0xcb76('0x6f')]['findAll']({'raw':!![]})['then'](function(_0x1ff252){_0x1ff252[_0xcb76('0x6d')](function(_0x1a8519){_0x21c2be[_0xcb76('0x62')](_0x1a8519['id']+0x15b38);});_0x4b2f88(_0x21c2be);});}else{return db[_0xcb76('0x5a')]['findAll']({'where':{'sectionId':_0x1de594['id']},'raw':!![]})[_0xcb76('0x2c')](function(_0x5bb6ca){_0x5bb6ca[_0xcb76('0x6d')](function(_0x147e6b){_0x21c2be['push'](_0x147e6b[_0xcb76('0x6e')]+0x15b38);});_0x4b2f88(_0x21c2be);});}}catch(_0xcb9c2a){_0x54def3(_0xcb9c2a);}});}exports['addResources']=function(_0x169b1c,_0x8b44b1){return db[_0xcb76('0x44')][_0xcb76('0x4c')]({'where':{'id':_0x169b1c[_0xcb76('0x4f')]['id']}})[_0xcb76('0x2c')](handleEntityNotFound(_0x8b44b1,null))[_0xcb76('0x2c')](function(_0x4eb3f6){if(_0x4eb3f6){return db['sequelize'][_0xcb76('0x60')](function(_0x11a7bf){return db[_0xcb76('0x57')][_0xcb76('0x47')]({'where':{'userProfileId':_0x169b1c['params']['id']},'attributes':['id'],'raw':!![]})[_0xcb76('0x2c')](function(_0x431176){if(_0x431176){return db[_0xcb76('0x57')][_0xcb76('0x5d')]({'where':{'userProfileId':_0x169b1c[_0xcb76('0x4f')]['id'],'id':_[_0xcb76('0x30')](_0x431176,function(_0x279454){return _0x279454['id'];})},'transaction':_0x11a7bf});}})['then'](function(_0x1a6787){var _0x8d63ca=_[_0xcb76('0x30')](_0x169b1c[_0xcb76('0x55')],function(_0x1174c4){_0x1174c4[_0xcb76('0x5b')]=_0x169b1c[_0xcb76('0x4f')]['id'];return _0x1174c4;});return db[_0xcb76('0x57')][_0xcb76('0x70')](_0x8d63ca,{'raw':!![],'transaction':_0x11a7bf});})[_0xcb76('0x2c')](function(_0x10b612){var _0x326dd9=_[_0xcb76('0x3f')](_['map'](_0x10b612,function(_0x54e2a0){return _0x54e2a0[_0xcb76('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x326dd9){return db[_0xcb76('0x57')]['findAll']({'where':{'userProfileId':_0x169b1c[_0xcb76('0x4f')]['id'],'sectionId':_[_0xcb76('0x30')](_0x326dd9,function(_0x370642){return _0x370642[_0xcb76('0x61')];})},'attributes':['id',_0xcb76('0x61')],'raw':!![]})['then'](function(_0xd2f5b6){var _0x3751d5=_[_0xcb76('0x30')](_0x169b1c[_0xcb76('0x55')],function(_0x42425f){_0x42425f[_0xcb76('0x5b')]=_0x169b1c['params']['id'];return _0x42425f;});return db[_0xcb76('0x5a')][_0xcb76('0x70')](_0x3751d5,{'raw':!![],'transaction':_0x11a7bf});});}})[_0xcb76('0x49')](handleError(_0x8b44b1,null));});}})[_0xcb76('0x2c')](function(_0x5b085a){var _0x5de09c=_[_0xcb76('0x30')](_0x5b085a,function(_0x45afa2){return _0x45afa2[_0xcb76('0x51')]({'plain':!![]});});})[_0xcb76('0x2c')](respondWithResult(_0x8b44b1,null))[_0xcb76('0x49')](handleError(_0x8b44b1,null));};exports[_0xcb76('0x71')]=function(_0x1d72d8,_0x58f838,_0x5507c5){return db[_0xcb76('0x44')][_0xcb76('0x4c')]({'where':{'id':_0x1d72d8['params']['id']}})[_0xcb76('0x2c')](handleEntityNotFound(_0x58f838,null))[_0xcb76('0x2c')](function(_0x280d3c){if(_0x280d3c){return _0x280d3c[_0xcb76('0x71')](_0x1d72d8[_0xcb76('0x33')][_0xcb76('0x64')]);}})['then'](respondWithStatusCode(_0x58f838,null))['catch'](handleError(_0x58f838,null));};exports[_0xcb76('0x72')]=function(_0x22b041,_0x4dfc0f){var _0x5db500={};if(!_0x22b041['query'][_0xcb76('0x73')])throw new Error(_0xcb76('0x74'));if(!_0x22b041[_0xcb76('0x33')][_0xcb76('0x3a')](_0xcb76('0x3b'))){_0x5db500[_0xcb76('0x24')]=qs['limit'](_0x22b041[_0xcb76('0x33')][_0xcb76('0x24')]);_0x5db500['offset']=qs[_0xcb76('0x25')](_0x22b041[_0xcb76('0x33')]['offset']);}return db[_0xcb76('0x44')][_0xcb76('0x4c')]({'where':{'id':_0x22b041['params']['id']}})[_0xcb76('0x2c')](function(_0x38b6ea){if(!_0x38b6ea)throw new Error(_0xcb76('0x75')+_0x22b041[_0xcb76('0x4f')]['id']);return db[_0xcb76('0x44')][_0xcb76('0x72')](_0x22b041);})[_0xcb76('0x2c')](respondWithFilteredResult(_0x4dfc0f,_0x5db500))[_0xcb76('0x49')](handleError(_0x4dfc0f,null));}; \ No newline at end of file +var _0xa362=['fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./userProfile.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','stack','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','UserProfile','includeAll','include','findAll','catch','show','rawAttributes','options','create','body','params','find','get','createdAt','omit','updatedAt','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','UserProfileSection','Resources','describe','addSections','userProfileId','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','addResources','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs'];(function(_0x4be79b,_0x21e987){var _0x14d71e=function(_0x25ea7a){while(--_0x25ea7a){_0x4be79b['push'](_0x4be79b['shift']());}};_0x14d71e(++_0x21e987);}(_0xa362,0x143));var _0x2a36=function(_0x31acf2,_0x370cc1){_0x31acf2=_0x31acf2-0x0;var _0x512291=_0xa362[_0x31acf2];return _0x512291;};'use strict';var emlformat=require(_0x2a36('0x0'));var rimraf=require(_0x2a36('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a36('0x2'));var rp=require(_0x2a36('0x3'));var moment=require('moment');var BPromise=require(_0x2a36('0x4'));var Mustache=require(_0x2a36('0x5'));var util=require(_0x2a36('0x6'));var path=require(_0x2a36('0x7'));var sox=require(_0x2a36('0x8'));var csv=require('to-csv');var ejs=require(_0x2a36('0x9'));var fs=require('fs');var fs_extra=require(_0x2a36('0xa'));var _=require('lodash');var squel=require(_0x2a36('0xb'));var crypto=require('crypto');var jsforce=require(_0x2a36('0xc'));var deskjs=require(_0x2a36('0xd'));var toCsv=require(_0x2a36('0xe'));var querystring=require(_0x2a36('0xf'));var Papa=require(_0x2a36('0x10'));var Redis=require(_0x2a36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2a36('0x12'));var as=require(_0x2a36('0x13'));var hardwareService=require(_0x2a36('0x14'));var logger=require(_0x2a36('0x15'))('api');var utils=require(_0x2a36('0x16'));var config=require(_0x2a36('0x17'));var licenseUtil=require(_0x2a36('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2a36('0x19')](config[_0x2a36('0x1a')],{'host':_0x2a36('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a36('0x1a')]));require(_0x2a36('0x1c'))[_0x2a36('0x1d')](socket);function respondWithStatusCode(_0x2b1a8b,_0xdbd155){_0xdbd155=_0xdbd155||0xcc;return function(_0x5d001b){if(_0x5d001b){return _0x2b1a8b['sendStatus'](_0xdbd155);}return _0x2b1a8b[_0x2a36('0x1e')](_0xdbd155)['end']();};}function respondWithResult(_0x254745,_0x39db6b){_0x39db6b=_0x39db6b||0xc8;return function(_0x258d27){if(_0x258d27){return _0x254745[_0x2a36('0x1e')](_0x39db6b)[_0x2a36('0x1f')](_0x258d27);}};}function respondWithFilteredResult(_0x3a97ec,_0x2a6acd){return function(_0x583cf8){if(_0x583cf8){var _0x5dab53=typeof _0x2a6acd[_0x2a36('0x20')]==='undefined'&&typeof _0x2a6acd[_0x2a36('0x21')]===_0x2a36('0x22');var _0xb13bbd=_0x583cf8['count'];var _0xbd983c=_0x5dab53?0x0:_0x2a6acd['offset'];var _0x1a8592=_0x5dab53?_0x583cf8[_0x2a36('0x23')]:_0x2a6acd[_0x2a36('0x20')]+_0x2a6acd[_0x2a36('0x21')];var _0x3410e6;if(_0x1a8592>=_0xb13bbd){_0x1a8592=_0xb13bbd;_0x3410e6=0xc8;}else{_0x3410e6=0xce;}_0x3a97ec[_0x2a36('0x1e')](_0x3410e6);return _0x3a97ec[_0x2a36('0x24')](_0x2a36('0x25'),_0xbd983c+'-'+_0x1a8592+'/'+_0xb13bbd)['json'](_0x583cf8);}return null;};}function patchUpdates(_0xb87b8f){return function(_0x27674c){try{jsonpatch[_0x2a36('0x26')](_0x27674c,_0xb87b8f,!![]);}catch(_0x4a8ad9){return BPromise[_0x2a36('0x27')](_0x4a8ad9);}return _0x27674c['save']();};}function saveUpdates(_0x3d0bcd,_0x1b1584){return function(_0x50f3ae){if(_0x50f3ae){return _0x50f3ae[_0x2a36('0x28')](_0x3d0bcd)['then'](function(_0x4a80bd){return _0x4a80bd;});}return null;};}function removeEntity(_0xdfb4a8,_0x5a8249){return function(_0x2b3323){if(_0x2b3323){return _0x2b3323[_0x2a36('0x29')]()[_0x2a36('0x2a')](function(){_0xdfb4a8[_0x2a36('0x1e')](0xcc)[_0x2a36('0x2b')]();});}};}function handleEntityNotFound(_0x4e62a8,_0x148617){return function(_0xfe4594){if(!_0xfe4594){_0x4e62a8[_0x2a36('0x2c')](0x194);}return _0xfe4594;};}function handleError(_0x3e9bf6,_0x27d9c5){_0x27d9c5=_0x27d9c5||0x1f4;return function(_0x1b2acd){logger['error'](_0x1b2acd[_0x2a36('0x2d')]);if(_0x1b2acd['name']){delete _0x1b2acd[_0x2a36('0x2e')];}_0x3e9bf6['status'](_0x27d9c5)[_0x2a36('0x2f')](_0x1b2acd);};}exports[_0x2a36('0x30')]=function(_0x2d69f2,_0x513b34){var _0x3bb2d2={},_0x2ea692={},_0x4e3dad={'count':0x0,'rows':[]};var _0x25d2be=_[_0x2a36('0x31')](db['UserProfile']['rawAttributes'],function(_0x57ae6e){return{'name':_0x57ae6e['fieldName'],'type':_0x57ae6e['type'][_0x2a36('0x32')]};});_0x2ea692[_0x2a36('0x33')]=_[_0x2a36('0x31')](_0x25d2be,_0x2a36('0x2e'));_0x2ea692[_0x2a36('0x34')]=_[_0x2a36('0x35')](_0x2d69f2[_0x2a36('0x34')]);_0x2ea692[_0x2a36('0x36')]=_[_0x2a36('0x37')](_0x2ea692[_0x2a36('0x33')],_0x2ea692[_0x2a36('0x34')]);_0x3bb2d2[_0x2a36('0x38')]=_[_0x2a36('0x37')](_0x2ea692[_0x2a36('0x33')],qs[_0x2a36('0x39')](_0x2d69f2[_0x2a36('0x34')][_0x2a36('0x39')]));_0x3bb2d2[_0x2a36('0x38')]=_0x3bb2d2[_0x2a36('0x38')][_0x2a36('0x3a')]?_0x3bb2d2[_0x2a36('0x38')]:_0x2ea692[_0x2a36('0x33')];if(!_0x2d69f2[_0x2a36('0x34')][_0x2a36('0x3b')](_0x2a36('0x3c'))){_0x3bb2d2[_0x2a36('0x21')]=qs['limit'](_0x2d69f2[_0x2a36('0x34')]['limit']);_0x3bb2d2[_0x2a36('0x20')]=qs['offset'](_0x2d69f2['query'][_0x2a36('0x20')]);}_0x3bb2d2[_0x2a36('0x3d')]=qs[_0x2a36('0x3e')](_0x2d69f2[_0x2a36('0x34')][_0x2a36('0x3e')]);_0x3bb2d2['where']=qs[_0x2a36('0x36')](_[_0x2a36('0x3f')](_0x2d69f2[_0x2a36('0x34')],_0x2ea692[_0x2a36('0x36')]),_0x25d2be);if(_0x2d69f2[_0x2a36('0x34')][_0x2a36('0x40')]){_0x3bb2d2[_0x2a36('0x41')]=_[_0x2a36('0x42')](_0x3bb2d2[_0x2a36('0x41')],{'$or':_['map'](_0x25d2be,function(_0x76f7e1){if(_0x76f7e1[_0x2a36('0x43')]!=='VIRTUAL'){var _0x3e916b={};_0x3e916b[_0x76f7e1[_0x2a36('0x2e')]]={'$like':'%'+_0x2d69f2[_0x2a36('0x34')][_0x2a36('0x40')]+'%'};return _0x3e916b;}})});}_0x3bb2d2=_[_0x2a36('0x42')]({},_0x3bb2d2,_0x2d69f2['options']);var _0x2d99d4={'where':_0x3bb2d2[_0x2a36('0x41')]};return db[_0x2a36('0x44')][_0x2a36('0x23')](_0x2d99d4)['then'](function(_0x426349){_0x4e3dad[_0x2a36('0x23')]=_0x426349;if(_0x2d69f2['query'][_0x2a36('0x45')]){_0x3bb2d2[_0x2a36('0x46')]=[{'all':!![]}];}return db[_0x2a36('0x44')][_0x2a36('0x47')](_0x3bb2d2);})['then'](function(_0x4353b7){_0x4e3dad['rows']=_0x4353b7;return _0x4e3dad;})[_0x2a36('0x2a')](respondWithFilteredResult(_0x513b34,_0x3bb2d2))[_0x2a36('0x48')](handleError(_0x513b34,null));};exports[_0x2a36('0x49')]=function(_0x21292,_0x28c4a7){var _0x1a089d={'raw':![],'where':{'id':_0x21292['params']['id']}},_0x2bdb0c={};_0x2bdb0c[_0x2a36('0x33')]=_[_0x2a36('0x35')](db[_0x2a36('0x44')][_0x2a36('0x4a')]);_0x2bdb0c[_0x2a36('0x34')]=_[_0x2a36('0x35')](_0x21292[_0x2a36('0x34')]);_0x2bdb0c[_0x2a36('0x36')]=_['intersection'](_0x2bdb0c[_0x2a36('0x33')],_0x2bdb0c[_0x2a36('0x34')]);_0x1a089d[_0x2a36('0x38')]=_[_0x2a36('0x37')](_0x2bdb0c['model'],qs[_0x2a36('0x39')](_0x21292[_0x2a36('0x34')]['fields']));_0x1a089d[_0x2a36('0x38')]=_0x1a089d[_0x2a36('0x38')][_0x2a36('0x3a')]?_0x1a089d[_0x2a36('0x38')]:_0x2bdb0c[_0x2a36('0x33')];if(_0x21292[_0x2a36('0x34')]['includeAll']){_0x1a089d['include']=[{'all':!![]}];}_0x1a089d=_[_0x2a36('0x42')]({},_0x1a089d,_0x21292[_0x2a36('0x4b')]);return db['UserProfile']['find'](_0x1a089d)[_0x2a36('0x2a')](handleEntityNotFound(_0x28c4a7,null))['then'](respondWithResult(_0x28c4a7,null))[_0x2a36('0x48')](handleError(_0x28c4a7,null));};exports['create']=function(_0x1fef2e,_0x25013b){return db['UserProfile'][_0x2a36('0x4c')](_0x1fef2e[_0x2a36('0x4d')],{})[_0x2a36('0x2a')](respondWithResult(_0x25013b,0xc9))[_0x2a36('0x48')](handleError(_0x25013b,null));};exports['clone']=function(_0x41c231,_0x19a519){var _0x813b52={'where':{'id':_0x41c231[_0x2a36('0x4e')]['id']}},_0x4457ca={};_0x4457ca[_0x2a36('0x33')]=_[_0x2a36('0x35')](db[_0x2a36('0x44')][_0x2a36('0x4a')]);_0x813b52[_0x2a36('0x38')]=_['intersection'](_0x4457ca[_0x2a36('0x33')],qs['fields'](_0x41c231['query']['fields']));_0x813b52[_0x2a36('0x38')]=_0x813b52[_0x2a36('0x38')][_0x2a36('0x3a')]?_0x813b52[_0x2a36('0x38')]:_0x4457ca[_0x2a36('0x33')];if(_0x41c231['query']['includeAll']){_0x813b52[_0x2a36('0x46')]=[{'all':!![]}];}_0x813b52=_['merge']({},_0x813b52,_0x41c231[_0x2a36('0x4b')]);return db[_0x2a36('0x44')][_0x2a36('0x4f')](_0x813b52)[_0x2a36('0x2a')](handleEntityNotFound(_0x19a519,null))[_0x2a36('0x2a')](function(_0x5ef714){if(_0x5ef714){var _0x5ca428=_0x5ef714[_0x2a36('0x50')]({'plain':!![]});_0x5ca428=qs['omit'](_0x5ca428,['id',_0x2a36('0x51'),'updatedAt','crudPermissions']);_0x41c231[_0x2a36('0x4d')]=_[_0x2a36('0x52')](_0x41c231[_0x2a36('0x4d')],['id',_0x2a36('0x51'),_0x2a36('0x53')]);return db[_0x2a36('0x54')][_0x2a36('0x55')](function(_0x5dd54a){return db[_0x2a36('0x44')]['create'](_['merge'](_0x5ca428,_0x41c231[_0x2a36('0x4d')]),{'include':_0x41c231['query'][_0x2a36('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x5dd54a})[_0x2a36('0x2a')](function(_0x45901e){var _0x2a74b4=_0x45901e[_0x2a36('0x50')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x41c231[_0x2a36('0x4e')]['id']},'raw':!![]})['then'](function(_0x458e76){if(_0x458e76){return BPromise[_0x2a36('0x56')](_0x458e76,function(_0x4bdb3b){return new BPromise(function(_0xaef0b9,_0x540774){if(_0x4bdb3b[_0x2a36('0x57')]===null||_0x4bdb3b[_0x2a36('0x57')]===0x1)_0xaef0b9(null);return db[_0x2a36('0x58')][_0x2a36('0x47')]({'where':{'sectionId':_0x4bdb3b['id']},'raw':!![]})[_0x2a36('0x2a')](function(_0xb98220){var _0x1bef30=_['map'](_0xb98220,function(_0x4cefc3){return qs['omit'](_0x4cefc3,['id',_0x2a36('0x51'),_0x2a36('0x53'),_0x2a36('0x59')]);});_0xaef0b9(_0x1bef30);})[_0x2a36('0x48')](function(_0x251505){_0x540774(_0x251505);});})['then'](function(_0x292a69){var _0x319d31=qs[_0x2a36('0x52')](_0x4bdb3b,['id',_0x2a36('0x51'),_0x2a36('0x53')]);_0x319d31['userProfileId']=_0x2a74b4['id'];if(_0x292a69)_0x319d31['Resources']=_0x292a69;return _0x319d31;})['then'](function(_0x4b6d87){return db[_0x2a36('0x5a')]['create'](_0x4b6d87,{'include':[{'model':db['UserProfileResource'],'as':_0x2a36('0x5b')}],'raw':!![],'transaction':_0x5dd54a});});})[_0x2a36('0x2a')](function(){return _0x2a74b4;});}});});});}})[_0x2a36('0x2a')](respondWithResult(_0x19a519,0xc9))[_0x2a36('0x48')](handleError(_0x19a519,null));};exports[_0x2a36('0x28')]=function(_0x193c1b,_0xa0d426){if(_0x193c1b['body']['id']){delete _0x193c1b[_0x2a36('0x4d')]['id'];}return db[_0x2a36('0x44')][_0x2a36('0x4f')]({'where':{'id':_0x193c1b[_0x2a36('0x4e')]['id']}})[_0x2a36('0x2a')](handleEntityNotFound(_0xa0d426,null))[_0x2a36('0x2a')](saveUpdates(_0x193c1b['body'],null))['then'](respondWithResult(_0xa0d426,null))[_0x2a36('0x48')](handleError(_0xa0d426,null));};exports[_0x2a36('0x29')]=function(_0x3a941e,_0x56d9e6){return db[_0x2a36('0x44')][_0x2a36('0x4f')]({'where':{'id':_0x3a941e[_0x2a36('0x4e')]['id']}})[_0x2a36('0x2a')](handleEntityNotFound(_0x56d9e6,null))[_0x2a36('0x2a')](removeEntity(_0x56d9e6,null))['catch'](handleError(_0x56d9e6,null));};exports[_0x2a36('0x5c')]=function(_0x4cbc8f,_0x476ac3){return db[_0x2a36('0x44')]['describe']()[_0x2a36('0x2a')](respondWithResult(_0x476ac3,null))[_0x2a36('0x48')](handleError(_0x476ac3,null));};exports[_0x2a36('0x5d')]=function(_0x44a51e,_0x5344d9){var _0x2285c8=_0x44a51e[_0x2a36('0x4d')];return db[_0x2a36('0x44')][_0x2a36('0x4f')]({'where':{'id':_0x44a51e[_0x2a36('0x4e')]['id']}})[_0x2a36('0x2a')](handleEntityNotFound(_0x5344d9,null))[_0x2a36('0x2a')](function(_0x2d05e2){if(_0x2d05e2){return db['sequelize'][_0x2a36('0x55')](function(_0x4d8503){return db[_0x2a36('0x5a')][_0x2a36('0x29')]({'where':{'userProfileId':_0x44a51e['params']['id'],'sectionId':_[_0x2a36('0x31')](_0x2285c8,function(_0x1fab6d){return _0x1fab6d['sectionId'];})},'transaction':_0x4d8503})[_0x2a36('0x2a')](function(){var _0x2fbc68=_[_0x2a36('0x31')](_0x2285c8,function(_0x3549f8){_0x3549f8[_0x2a36('0x5e')]=_0x44a51e[_0x2a36('0x4e')]['id'];return _0x3549f8;});var _0x5fb730=[];return BPromise[_0x2a36('0x56')](_0x2fbc68,function(_0x3f0a49){return db[_0x2a36('0x5a')][_0x2a36('0x4c')](_0x3f0a49,{'include':[{'model':db['UserProfileResource'],'as':_0x2a36('0x5b')}],'raw':!![],'transaction':_0x4d8503})[_0x2a36('0x2a')](function(_0x29bd57){_0x5fb730[_0x2a36('0x5f')](_0x29bd57[_0x2a36('0x50')]({'plain':!![]}));});})[_0x2a36('0x2a')](function(){return _0x5fb730;});});});}})[_0x2a36('0x2a')](function(_0x1c0f42){return _0x1c0f42;})[_0x2a36('0x2a')](respondWithResult(_0x5344d9,null))[_0x2a36('0x48')](handleError(_0x5344d9,null));};exports[_0x2a36('0x60')]=function(_0x378e2f,_0x3140fa){var _0xd60111;return db[_0x2a36('0x44')][_0x2a36('0x4f')]({'where':{'id':_0x378e2f[_0x2a36('0x4e')]['id']},'attributes':['id','name']})[_0x2a36('0x2a')](handleEntityNotFound(_0x3140fa,null))[_0x2a36('0x2a')](function(_0x12a2dc){if(_0x12a2dc){_0xd60111=_0x12a2dc;return db['UserProfileSection'][_0x2a36('0x29')]({'where':{'userProfileId':_0x378e2f['params']['id'],'sectionId':_0x378e2f[_0x2a36('0x34')][_0x2a36('0x61')]}});}})['then'](function(){return _0xd60111;})['then'](respondWithStatusCode(_0x3140fa,null))['catch'](handleError(_0x3140fa,null));};exports[_0x2a36('0x62')]=function(_0x4a2990,_0x2e6975){var _0x288f28=[];var _0x56d5bf=[];return db[_0x2a36('0x5a')][_0x2a36('0x47')]({'where':{'userProfileId':_0x4a2990['params']['id']},'raw':!![]})[_0x2a36('0x2a')](function(_0x52e887){_0x288f28=_['filter'](_0x52e887,function(_0x5ce3bc){return _0x5ce3bc['enabled']===0x1||_[_0x2a36('0x63')]([0x3eb,0x709],_0x5ce3bc[_0x2a36('0x59')]);});if(!_[_0x2a36('0x64')](_0x288f28)){return _['map'](_0x288f28,function(_0x270b64){return _0x270b64[_0x2a36('0x59')];});}else{return;}})[_0x2a36('0x2a')](function(_0x31a98d){if(_0x31a98d)_0x56d5bf=_0x31a98d;if(_['includes'](_0x56d5bf,0x64)){var _0xe975e0=_['find'](_0x288f28,{'sectionId':0x64});return hasDefaultDashboard(_0xe975e0)['then'](function(_0x56ab24){return _[_0x2a36('0x31')](_0x288f28,function(_0x5e44fb){if(_0x5e44fb[_0x2a36('0x59')]===0x64){_0x5e44fb[_0x2a36('0x65')]=_0x56ab24;}return _0x5e44fb;});});}else{return;}})[_0x2a36('0x2a')](function(_0x9a8265){if(_0x9a8265)_0x288f28=_0x9a8265;if(_['includes'](_0x56d5bf,0x3eb)){var _0x49cccf=_[_0x2a36('0x4f')](_0x288f28,{'sectionId':0x3eb});return getCustomDashboards(_0x49cccf)[_0x2a36('0x2a')](function(_0x1084f2){return _[_0x2a36('0x31')](_0x288f28,function(_0x22bab2){if(_0x49cccf[_0x2a36('0x66')]){if(_0x22bab2['sectionId']===0x3eb){_0x22bab2['subsections']=_0x1084f2;}}else{if(_0x22bab2['sectionId']===0x64){if(!_0x22bab2[_0x2a36('0x65')]){_0x22bab2[_0x2a36('0x65')]=[];}_0x22bab2[_0x2a36('0x65')]=_0x22bab2[_0x2a36('0x65')]['concat'](_0x1084f2);}}return _0x22bab2;});});}else{return;}})[_0x2a36('0x2a')](function(_0x3d8719){if(_0x3d8719)_0x288f28=_0x3d8719;if(_['includes'](_0x56d5bf,0x709)){var _0x3498cf=_[_0x2a36('0x4f')](_0x288f28,{'sectionId':0x709});return getPlugins(_0x3498cf)[_0x2a36('0x2a')](function(_0x5b388c){if(_0x3498cf['enabled']){return _[_0x2a36('0x31')](_0x288f28,function(_0x40505b){if(_0x40505b[_0x2a36('0x59')]===0x709){_0x40505b[_0x2a36('0x65')]=_0x5b388c;}return _0x40505b;});}else{var _0x459eb6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5b388c};var _0x187842=_[_0x2a36('0x31')](_0x288f28);_0x187842[_0x2a36('0x5f')](_0x459eb6);return _0x187842;}});}else{return;}})[_0x2a36('0x2a')](function(_0x77195f){if(_0x77195f)_0x288f28=_0x77195f;return _[_0x2a36('0x40')](_0x288f28,[_0x2a36('0x66'),0x1]);})['then'](respondWithResult(_0x2e6975,null))[_0x2a36('0x48')](handleError(_0x2e6975,null));};function hasDefaultDashboard(_0x5da3b4){var _0x59ffb6=[0x65];return new BPromise(function(_0x475a8e,_0x54b62d){try{if(_0x5da3b4[_0x2a36('0x57')]){_0x475a8e(_0x59ffb6);}else{return db['UserProfileResource'][_0x2a36('0x67')]({'where':{'sectionId':_0x5da3b4['id']},'raw':!![]})[_0x2a36('0x2a')](function(_0x623710){_0x623710?_0x475a8e(_0x59ffb6):_0x475a8e();});}}catch(_0x277af1){_0x54b62d(_0x277af1);}});}function getCustomDashboards(_0xc95b45){var _0x1fcf7c=[];return new BPromise(function(_0x489d23,_0x52a65f){try{if(_0xc95b45[_0x2a36('0x57')]){return db[_0x2a36('0x68')][_0x2a36('0x47')]({'raw':!![]})[_0x2a36('0x2a')](function(_0x312608){_0x312608[_0x2a36('0x69')](function(_0x15f9b5){_0x1fcf7c[_0x2a36('0x5f')](_0x15f9b5['id']+0x1869f);});_0x489d23(_0x1fcf7c);});}else{return db[_0x2a36('0x58')][_0x2a36('0x47')]({'where':{'sectionId':_0xc95b45['id']},'raw':!![]})['then'](function(_0x27f145){_0x27f145[_0x2a36('0x69')](function(_0x325ee8){_0x1fcf7c['push'](_0x325ee8['resourceId']+0x1869f);});_0x489d23(_0x1fcf7c);});}}catch(_0x21749d){_0x52a65f(_0x21749d);}});}function getPlugins(_0x4cfa25){var _0x1a29d6=[];return new BPromise(function(_0x14b86c,_0x465c20){try{if(_0x4cfa25[_0x2a36('0x57')]){return db['Plugin']['findAll']({'raw':!![]})[_0x2a36('0x2a')](function(_0x3c0d43){_0x3c0d43[_0x2a36('0x69')](function(_0x2acfe0){_0x1a29d6[_0x2a36('0x5f')](_0x2acfe0['id']+0x15b38);});_0x14b86c(_0x1a29d6);});}else{return db[_0x2a36('0x58')][_0x2a36('0x47')]({'where':{'sectionId':_0x4cfa25['id']},'raw':!![]})['then'](function(_0x33b638){_0x33b638[_0x2a36('0x69')](function(_0x4b2a8f){_0x1a29d6[_0x2a36('0x5f')](_0x4b2a8f['resourceId']+0x15b38);});_0x14b86c(_0x1a29d6);});}}catch(_0x2f3301){_0x465c20(_0x2f3301);}});}exports[_0x2a36('0x6a')]=function(_0x42e183,_0x4ff830){return db[_0x2a36('0x44')]['find']({'where':{'id':_0x42e183[_0x2a36('0x4e')]['id']}})[_0x2a36('0x2a')](handleEntityNotFound(_0x4ff830,null))['then'](function(_0x3f15c9){if(_0x3f15c9){return db['sequelize']['transaction'](function(_0x5ab30f){return db[_0x2a36('0x5a')][_0x2a36('0x47')]({'where':{'userProfileId':_0x42e183[_0x2a36('0x4e')]['id']},'attributes':['id'],'raw':!![]})[_0x2a36('0x2a')](function(_0x458b52){if(_0x458b52){return db['UserProfileSection'][_0x2a36('0x29')]({'where':{'userProfileId':_0x42e183[_0x2a36('0x4e')]['id'],'id':_[_0x2a36('0x31')](_0x458b52,function(_0x1e1c4f){return _0x1e1c4f['id'];})},'transaction':_0x5ab30f});}})[_0x2a36('0x2a')](function(_0x344132){var _0x28770e=_[_0x2a36('0x31')](_0x42e183[_0x2a36('0x4d')],function(_0x4aa884){_0x4aa884[_0x2a36('0x5e')]=_0x42e183[_0x2a36('0x4e')]['id'];return _0x4aa884;});return db[_0x2a36('0x5a')]['bulkCreate'](_0x28770e,{'raw':!![],'transaction':_0x5ab30f});})['then'](function(_0x42fcb4){var _0x539081=_[_0x2a36('0x40')](_['map'](_0x42fcb4,function(_0x446dc2){return _0x446dc2[_0x2a36('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x539081){return db[_0x2a36('0x5a')][_0x2a36('0x47')]({'where':{'userProfileId':_0x42e183[_0x2a36('0x4e')]['id'],'sectionId':_[_0x2a36('0x31')](_0x539081,function(_0x14dbf6){return _0x14dbf6[_0x2a36('0x59')];})},'attributes':['id',_0x2a36('0x59')],'raw':!![]})['then'](function(_0x3d8168){var _0x449a56=_[_0x2a36('0x31')](_0x42e183['body'],function(_0x46d640){_0x46d640[_0x2a36('0x5e')]=_0x42e183[_0x2a36('0x4e')]['id'];return _0x46d640;});return db['UserProfileResource']['bulkCreate'](_0x449a56,{'raw':!![],'transaction':_0x5ab30f});});}})[_0x2a36('0x48')](handleError(_0x4ff830,null));});}})[_0x2a36('0x2a')](function(_0x2069b5){var _0x4bc271=_[_0x2a36('0x31')](_0x2069b5,function(_0x15d5dd){return _0x15d5dd[_0x2a36('0x50')]({'plain':!![]});});})[_0x2a36('0x2a')](respondWithResult(_0x4ff830,null))[_0x2a36('0x48')](handleError(_0x4ff830,null));};exports['removeResources']=function(_0x335263,_0x3e6d58,_0x1c097a){return db['UserProfile'][_0x2a36('0x4f')]({'where':{'id':_0x335263[_0x2a36('0x4e')]['id']}})[_0x2a36('0x2a')](handleEntityNotFound(_0x3e6d58,null))[_0x2a36('0x2a')](function(_0x240cee){if(_0x240cee){return _0x240cee[_0x2a36('0x6b')](_0x335263[_0x2a36('0x34')][_0x2a36('0x61')]);}})[_0x2a36('0x2a')](respondWithStatusCode(_0x3e6d58,null))[_0x2a36('0x48')](handleError(_0x3e6d58,null));};exports[_0x2a36('0x6c')]=function(_0x5e22b0,_0x40f29e){var _0x2df074={};if(!_0x5e22b0[_0x2a36('0x34')][_0x2a36('0x6d')])throw new Error(_0x2a36('0x6e'));if(!_0x5e22b0[_0x2a36('0x34')]['hasOwnProperty'](_0x2a36('0x3c'))){_0x2df074['limit']=qs['limit'](_0x5e22b0['query']['limit']);_0x2df074['offset']=qs[_0x2a36('0x20')](_0x5e22b0[_0x2a36('0x34')][_0x2a36('0x20')]);}return db['UserProfile'][_0x2a36('0x4f')]({'where':{'id':_0x5e22b0[_0x2a36('0x4e')]['id']}})[_0x2a36('0x2a')](function(_0x4fb58c){if(!_0x4fb58c)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5e22b0[_0x2a36('0x4e')]['id']);return db[_0x2a36('0x44')][_0x2a36('0x6c')](_0x5e22b0);})[_0x2a36('0x2a')](respondWithFilteredResult(_0x40f29e,_0x2df074))[_0x2a36('0x48')](handleError(_0x40f29e,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 39fc68b..6c2b851 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 _0x2b29=['emit','hasOwnProperty','exports','../../mysqldb','UserProfile','setMaxListeners','save','remove'];(function(_0x2a5d7d,_0x5c41f7){var _0x158f58=function(_0x1a4b0e){while(--_0x1a4b0e){_0x2a5d7d['push'](_0x2a5d7d['shift']());}};_0x158f58(++_0x5c41f7);}(_0x2b29,0x163));var _0x92b2=function(_0x281efc,_0x228e9e){_0x281efc=_0x281efc-0x0;var _0x32b5df=_0x2b29[_0x281efc];return _0x32b5df;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x92b2('0x0'))['db'][_0x92b2('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x92b2('0x2')](0x0);var events={'afterCreate':_0x92b2('0x3'),'afterUpdate':'update','afterDestroy':_0x92b2('0x4')};function emitEvent(_0xdb5991){return function(_0xbc7de4,_0x3963eb,_0x16c1b0){UserProfileEvents[_0x92b2('0x5')](_0xdb5991+':'+_0xbc7de4['id'],_0xbc7de4);UserProfileEvents['emit'](_0xdb5991,_0xbc7de4);_0x16c1b0(null);};}for(var e in events){if(events[_0x92b2('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x92b2('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x5bc1=['exports','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2682f1,_0x37a307){var _0x4310fa=function(_0x11705e){while(--_0x11705e){_0x2682f1['push'](_0x2682f1['shift']());}};_0x4310fa(++_0x37a307);}(_0x5bc1,0xb5));var _0x15bc=function(_0x5c5cfb,_0x856fe6){_0x5c5cfb=_0x5c5cfb-0x0;var _0xb89878=_0x5bc1[_0x5c5cfb];return _0xb89878;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x15bc('0x0'))['db'][_0x15bc('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x15bc('0x2')](0x0);var events={'afterCreate':_0x15bc('0x3'),'afterUpdate':_0x15bc('0x4'),'afterDestroy':_0x15bc('0x5')};function emitEvent(_0x5cd32c){return function(_0x514d81,_0xe94345,_0x231326){UserProfileEvents[_0x15bc('0x6')](_0x5cd32c+':'+_0x514d81['id'],_0x514d81);UserProfileEvents['emit'](_0x5cd32c,_0x514d81);_0x231326(null);};}for(var e in events){if(events[_0x15bc('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x15bc('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 8223736..f2ad15b 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 _0x2974=['faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','membername','Telephones','User','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','teams','Team','queuecampaigns','users','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','pauses','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','user_profiles','../../components/parsers/qs','raw','mergeResources','isEmpty','length','push','all','ignore','union','find','rawAttributes','keys','filters','intersection','attributes','fields','limit','offset','sort','pick','merge','VIRTUAL','foreignKey','forEach','options','AnalyticExtractedReport','includeAll','include','reportType','default','DefaultReports','custom','reportId','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','color','ThroughTags','tag','true','chat','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','squel','exports','models','field','value','findAll','then','catch','filter','model','associatedResources','map','name','resolve','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','JscriptyProject','Lists','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x2974,0x158));var _0x4297=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0x2974[_0x61b3ab];return _0x57097f;};'use strict';var _=require(_0x4297('0x0'));var attributes=require(_0x4297('0x1'));var squel=require(_0x4297('0x2'));module[_0x4297('0x3')]=function(_0x35af84){var _0x557710=_0x35af84[_0x4297('0x4')];function _0x356095(_0x289ec6,_0xb60f31){return new Promise(function(_0x544f7e,_0x1e82f4){if(!_0xb60f31)return _0x544f7e(null);var _0x4e7b8d=_0xb60f31['filter']?{[_0xb60f31['filter'][_0x4297('0x5')]]:_0xb60f31['filter'][_0x4297('0x6')]}:undefined;return _0x557710[_0x289ec6][_0x4297('0x7')]({'where':_0x4e7b8d,'raw':!![]})[_0x4297('0x8')](function(_0x3f63fc){_0xb60f31['associatedResources']=_['map'](_0x3f63fc,'id');_0x544f7e(_0xb60f31);})[_0x4297('0x9')](function(_0x34d504){_0x1e82f4(_0x34d504);});});}function _0x543f58(_0x290c64,_0x43b18b){return new Promise(function(_0x3cf3f4,_0x5c16ad){var _0x1a4f2c=_0x290c64[_0x4297('0xa')]?{[_0x290c64[_0x4297('0xa')]['field']]:_0x290c64[_0x4297('0xa')][_0x4297('0x6')]}:undefined;return _0x557710[_0x290c64[_0x4297('0xb')]]['findAll']({'where':_0x1a4f2c,'raw':!![]})[_0x4297('0x8')](function(_0x21be01){_0x43b18b[_0x4297('0xc')]=_[_0x4297('0xd')](_0x21be01,function(_0x1ae038){return _0x1ae038[_0x4297('0xe')];});_0x3cf3f4(_0x43b18b);})['catch'](function(_0x4879c3){_0x5c16ad(_0x4879c3);});});}function _0x3bd166(_0x85f20,_0x3c4f2d,_0x1c24de){if(!_0x3c4f2d)return Promise[_0x4297('0xf')](null);return new Promise(function(_0x3f7604,_0x1dbf14){return _0x557710['UserProfileResource'][_0x4297('0x7')]({'where':{'sectionId':_0x3c4f2d['id']},'raw':!![]})[_0x4297('0x8')](function(_0x58c2d8){if(_0x85f20[_0x4297('0x5')]&&_0x85f20[_0x4297('0x5')]!=='id'){_0x3c4f2d['associatedResources']=_[_0x4297('0xd')](_0x58c2d8,function(_0x2b280a){return _0x2b280a[_0x85f20[_0x4297('0x5')]];});}else{if(_0x1c24de==='AnalyticExtractedReport'){_0x3c4f2d['associatedResources']=_[_0x4297('0xd')](_0x58c2d8,function(_0x1bfcff){return{'id':_0x1bfcff['resourceId'],'type':_0x1bfcff[_0x4297('0x10')]};});}else{_0x3c4f2d[_0x4297('0xc')]=_[_0x4297('0xd')](_0x58c2d8,function(_0x2a43b9){return _0x2a43b9[_0x4297('0x11')];});}}_0x3f7604(_0x3c4f2d);})[_0x4297('0x9')](function(_0x6af7b8){_0x1dbf14(_0x6af7b8);});});}function _0x4317f0(_0x17dd35,_0x18d5db){var _0x4624f1={'parentSections':[]};switch(_0x17dd35[_0x4297('0x12')]()){case _0x4297('0x13'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x15');break;case _0x4297('0x16'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x17');break;case _0x4297('0x18'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x19');_0x4624f1[_0x4297('0x1a')]=[{'name':'SquareProjects','field':_0x4297('0xe'),'foreignKey':_0x4297('0x1b')}];break;case'projects':_0x4624f1[_0x4297('0x14')]=_0x4297('0x1c');break;case'contacts':_0x4624f1['childModel']='CmContact';_0x4624f1[_0x4297('0x1a')]=[{'name':_0x4297('0x1d'),'field':'id','foreignKey':'ListId'}];break;case _0x4297('0x1e'):_0x4624f1['childModel']=_0x4297('0x1f');break;case _0x4297('0x20'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x21');break;case'globalcustomfields':_0x4624f1[_0x4297('0x14')]=_0x4297('0x22');break;case _0x4297('0x23'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x24');break;case'chatwebsites':_0x4624f1[_0x4297('0x14')]=_0x4297('0x25');break;case _0x4297('0x26'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x27');break;case _0x4297('0x28'):_0x4624f1['childModel']=_0x4297('0x29');break;case'inboundroutes':case _0x4297('0x2a'):case'outboundroutes':_0x4624f1['childModel']=_0x4297('0x2b');break;case _0x4297('0x2c'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x2d');break;case'voicemails':_0x4624f1['childModel']='VoiceMail';break;case _0x4297('0x2e'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x2f');_0x4624f1['parentSections']=[{'name':'Agents','field':_0x4297('0xe'),'foreignKey':_0x4297('0x30'),'model':'User','filter':{'field':'role','value':['agent']}},{'name':_0x4297('0x31'),'field':_0x4297('0xe'),'foreignKey':_0x4297('0x30'),'model':_0x4297('0x32'),'filter':{'field':_0x4297('0x33'),'value':[_0x4297('0x34')]}},{'name':_0x4297('0x35'),'field':'name','foreignKey':'queue','model':_0x4297('0x36'),'filter':{'field':'type','value':[_0x4297('0x37')]}},{'name':_0x4297('0x38'),'field':_0x4297('0xe'),'foreignKey':_0x4297('0x39'),'model':_0x4297('0x36'),'filter':{'field':_0x4297('0x10'),'value':[_0x4297('0x3a')]}}];break;case'musiconholds':_0x4624f1[_0x4297('0x14')]=_0x4297('0x3b');break;case _0x4297('0x3c'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x3d');break;case _0x4297('0x3e'):_0x4624f1[_0x4297('0x14')]='VoicePrefix';break;case _0x4297('0x3f'):_0x4624f1['childModel']=_0x4297('0x40');break;case _0x4297('0x41'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x42');break;case _0x4297('0x43'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x44');break;case _0x4297('0x45'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x46');break;case _0x4297('0x47'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x48');break;case _0x4297('0x49'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x4a');break;case _0x4297('0x4b'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x4c');break;case _0x4297('0x4d'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x4e');break;case'whatsappqueues':_0x4624f1[_0x4297('0x14')]=_0x4297('0x4f');break;case _0x4297('0x50'):_0x4624f1[_0x4297('0x14')]='WhatsappAccount';break;case _0x4297('0x51'):_0x4624f1['childModel']=_0x4297('0x52');break;case'voicequeues':case _0x4297('0x53'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x36');if(_0x18d5db){_0x4624f1[_0x4297('0x1a')]=[{'name':_0x4297('0x35')},{'name':_0x4297('0x38')}];}break;case _0x4297('0x54'):case'agents':case _0x4297('0x55'):_0x4624f1['childModel']='User';if(_0x18d5db){_0x4624f1[_0x4297('0x1a')]=[{'name':_0x4297('0x56'),'filter':{'field':_0x4297('0x33'),'value':[_0x4297('0x57'),_0x4297('0x58')]},'ignore':!![]},{'name':'Agents'},{'name':_0x4297('0x31')}];}break;case _0x4297('0x59'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x5a');break;case _0x4297('0x5b'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x5c');break;case _0x4297('0x5d'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x5e');break;case _0x4297('0x5f'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x60');break;case _0x4297('0x61'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x62');break;case'zohoaccounts':_0x4624f1[_0x4297('0x14')]=_0x4297('0x63');break;case _0x4297('0x64'):_0x4624f1[_0x4297('0x14')]='User';break;case _0x4297('0x65'):_0x4624f1['childModel']=_0x4297('0x66');break;case _0x4297('0x67'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x68');break;case _0x4297('0x69'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x6a');break;case'intervals':_0x4624f1[_0x4297('0x14')]='Interval';break;case _0x4297('0x6b'):_0x4624f1[_0x4297('0x14')]='Pause';break;case _0x4297('0x6c'):_0x4624f1['childModel']=_0x4297('0x6d');break;case'sounds':_0x4624f1[_0x4297('0x14')]=_0x4297('0x6e');break;case _0x4297('0x6f'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x70');break;case _0x4297('0x71'):_0x4624f1['childModel']=_0x4297('0x72');break;case _0x4297('0x73'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x74');break;case _0x4297('0x75'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x76');break;case _0x4297('0x77'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x78');break;case _0x4297('0x79'):_0x4624f1[_0x4297('0x14')]=_0x4297('0x7a');break;case _0x4297('0x7b'):_0x4624f1['childModel']='AnalyticExtractedReport';_0x4624f1['parentSections']=[{'name':_0x4297('0x7c'),'field':'id','foreignKey':'reportId'}];break;case _0x4297('0x7d'):_0x4624f1['childModel']=_0x4297('0x7e');break;}return _0x4624f1;}function _0x5d4e0f(_0x47dc92,_0x36ceca){var _0x2dd9ce=_0x47dc92['charAt'](0x0)['toUpperCase']()+_0x47dc92[_0x4297('0x7f')](0x1);var _0x2c2353={'type':_0x557710[_0x4297('0x80')][_0x4297('0x81')][_0x4297('0x82')],'raw':!![]};return new Promise(function(_0xfabf71,_0x26896f){var _0x5974db=squel['select']()[_0x4297('0x5')](_0x4297('0x83')+_0x2dd9ce+_0x4297('0x84'),'id')[_0x4297('0x5')](_0x4297('0x85'))['from'](_0x4297('0x86')+_0x47dc92+_0x4297('0x87'),'ui')[_0x4297('0x88')]('ui.UserId\x20=\x20?',_0x36ceca['id']);return _0x557710[_0x4297('0x89')][_0x4297('0x8a')](_0x5974db[_0x4297('0x8b')](),_0x2c2353)[_0x4297('0x8')](function(_0x496786){_0x36ceca[_0x2dd9ce+_0x4297('0x8c')]=_0x496786;_0xfabf71(_0x496786);})[_0x4297('0x9')](function(_0x1d811c){_0x26896f(_0x1d811c);});});}return _0x35af84['define']('UserProfile',attributes,{'tableName':_0x4297('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x32f778){var _0x3912f5=require(_0x4297('0x8e'));var _0x3dbcb0={'raw':_0x32f778[_0x4297('0x8a')][_0x4297('0x8f')],'where':{}};var _0x8c77bc={};var _0x13e781={'count':0x0,'rows':[]};var _0x37ae43=_0x32f778[_0x4297('0x8a')]['section'];var _0x23c7f0=_0x32f778[_0x4297('0x8a')][_0x4297('0x90')]||![];var _0x56ceb3=_0x4317f0(_0x37ae43,_0x23c7f0);if(!_0x56ceb3[_0x4297('0x14')])throw new Error('Invalid\x20section\x20\x27'+_0x37ae43+'\x27');var _0x1055b2=[{'name':_0x37ae43}];if(!_[_0x4297('0x91')](_0x56ceb3[_0x4297('0x1a')]))_0x1055b2=_0x56ceb3[_0x4297('0x1a')];var _0x1acb36=[];for(var _0x4367c4=0x0;_0x4367c4<_0x1055b2[_0x4297('0x92')];_0x4367c4++){_0x1acb36[_0x4297('0x93')](_0x557710['UserProfileSection']['find']({'where':{'userProfileId':_0x32f778['params']['id'],'name':_0x1055b2[_0x4367c4][_0x4297('0xe')]},'raw':!![]}));}return Promise[_0x4297('0x94')](_0x1acb36)['then'](function(_0x329896){var _0x107153=_[_0x4297('0xa')](_0x329896,function(_0x2b4a24){return _0x2b4a24?_0x2b4a24:undefined;});var _0x53cb17=_[_0x4297('0xa')](_0x1055b2,[_0x4297('0x95'),!![]]);var _0x453ac0=_[_0x4297('0x91')](_0x107153)&&_[_0x4297('0x91')](_0x53cb17)?null:_[_0x4297('0x96')](_0x53cb17,_0x107153);if(!_0x453ac0)return null;var _0x2b4f53=[];for(var _0x4cd5d6=0x0;_0x4cd5d6<_0x453ac0['length'];_0x4cd5d6++){var _0x30d2eb=_[_0x4297('0x97')](_0x1055b2,function(_0x2c4595){return _0x453ac0[_0x4cd5d6]?_0x2c4595['name']===_0x453ac0[_0x4cd5d6]['name']:null;});if(_0x30d2eb){if(_0x453ac0[_0x4cd5d6]['ignore']){_0x2b4f53[_0x4297('0x93')](_0x356095(_0x56ceb3[_0x4297('0x14')],_0x453ac0[_0x4cd5d6]));}else{if(!_0x453ac0[_0x4cd5d6]['autoAssociation']){_0x2b4f53[_0x4297('0x93')](_0x3bd166(_0x30d2eb,_0x453ac0[_0x4cd5d6],_0x56ceb3[_0x4297('0x14')]));}else{if(_0x30d2eb[_0x4297('0xb')]){_0x2b4f53['push'](_0x543f58(_0x30d2eb,_0x453ac0[_0x4cd5d6]));}}}}}return Promise[_0x4297('0x94')](_0x2b4f53);})['then'](function(_0x25fac2){var _0x38d535=_0x25fac2;var _0x45d5ad=null;if(_0x38d535){_0x45d5ad=_0x38d535[_0x4297('0x92')]===0x1?_0x38d535[0x0]:null;}if(!_0x45d5ad&&!_0x38d535)return _0x13e781;var _0x58a463=_0x557710[_0x56ceb3[_0x4297('0x14')]][_0x4297('0x98')];_0x8c77bc[_0x4297('0xb')]=_[_0x4297('0x99')](_0x58a463);_0x8c77bc[_0x4297('0x8a')]=_[_0x4297('0x99')](_0x32f778['query']);_0x8c77bc[_0x4297('0x9a')]=_[_0x4297('0x9b')](_0x8c77bc['model'],_0x8c77bc['query']);_0x3dbcb0[_0x4297('0x9c')]=_[_0x4297('0x9b')](_0x8c77bc[_0x4297('0xb')],_0x3912f5['fields'](_0x32f778['query'][_0x4297('0x9d')]));_0x3dbcb0[_0x4297('0x9c')]=_0x3dbcb0[_0x4297('0x9c')][_0x4297('0x92')]?_0x3dbcb0['attributes']:_0x8c77bc[_0x4297('0xb')];if(!_0x32f778[_0x4297('0x8a')]['hasOwnProperty']('nolimit')){_0x3dbcb0[_0x4297('0x9e')]=_0x3912f5[_0x4297('0x9e')](_0x32f778[_0x4297('0x8a')][_0x4297('0x9e')]);_0x3dbcb0[_0x4297('0x9f')]=_0x3912f5[_0x4297('0x9f')](_0x32f778[_0x4297('0x8a')]['offset']);}_0x3dbcb0['order']=_0x3912f5[_0x4297('0xa0')](_0x32f778[_0x4297('0x8a')][_0x4297('0xa0')]);_0x3dbcb0[_0x4297('0x88')]=_0x3912f5[_0x4297('0x9a')](_[_0x4297('0xa1')](_0x32f778[_0x4297('0x8a')],_0x8c77bc[_0x4297('0x9a')]));if(_0x32f778['query'][_0x4297('0xa')]){_0x3dbcb0[_0x4297('0x88')]=_[_0x4297('0xa2')](_0x3dbcb0[_0x4297('0x88')],{'$or':_[_0x4297('0xd')](_0x58a463,function(_0x182360){if(_0x182360['type']['key']!==_0x4297('0xa3')){var _0x2a7292={};_0x2a7292[_0x182360[_0x4297('0x5')]]={'$like':'%'+_0x32f778[_0x4297('0x8a')][_0x4297('0xa')]+'%'};return _0x2a7292;}})});}var _0x3d7a23=[];var _0x469844=null;var _0x3b813e={};if(_0x45d5ad){_0x469844=_[_0x4297('0x97')](_0x1055b2,[_0x4297('0xe'),_0x45d5ad[_0x4297('0xe')]]);if(_0x469844['field']){_0x3b813e={};if(_0x56ceb3['childModel']==='AnalyticExtractedReport'){_0x3b813e[_0x469844[_0x4297('0xa4')]]=_[_0x4297('0xd')](_0x45d5ad[_0x4297('0xc')],'id');}else{_0x3b813e[_0x469844['foreignKey']]=_0x45d5ad[_0x4297('0xc')];}_0x3d7a23[_0x4297('0x93')](_0x3b813e);}else{_0x3dbcb0[_0x4297('0x88')]['id']=_0x45d5ad[_0x4297('0xc')];}}else{for(var _0x5d6750=0x0;_0x5d6750<_0x38d535[_0x4297('0x92')];_0x5d6750++){_0x469844=_[_0x4297('0x97')](_0x1055b2,[_0x4297('0xe'),_0x38d535[_0x5d6750]['name']]);if(_0x469844['field']){_0x3b813e={};_0x3b813e[_0x469844[_0x4297('0xa4')]]=_0x38d535[_0x5d6750]['associatedResources'];_0x3d7a23[_0x4297('0x93')](_0x3b813e);}else{if(!_0x3dbcb0['where']['id'])_0x3dbcb0[_0x4297('0x88')]['id']=[];_0x38d535[_0x5d6750][_0x4297('0xc')][_0x4297('0xa5')](function(_0x4635e5){_0x3dbcb0[_0x4297('0x88')]['id'][_0x4297('0x93')](_0x4635e5);});}}}if(!_[_0x4297('0x91')](_0x3d7a23)){_0x3dbcb0[_0x4297('0x88')]=_[_0x4297('0xa2')](_0x3dbcb0['where'],{'$and':{'$or':_0x3d7a23}});}_0x3dbcb0=_['merge']({},_0x3dbcb0,_0x32f778[_0x4297('0xa6')]);if(_0x45d5ad&&!_0x45d5ad['autoAssociation']&&_0x56ceb3[_0x4297('0x14')]===_0x4297('0xa7')){if(_0x32f778[_0x4297('0x8a')][_0x4297('0xa8')]){_0x3dbcb0[_0x4297('0xa9')]=[{'all':!![]}];}return _0x557710[_0x56ceb3['childModel']]['findAll'](_0x3dbcb0)['then'](function(_0x1199a8){var _0x5c094e=[];_0x1199a8[_0x4297('0xa5')](function(_0x3d7e20){var _0x357991;switch(_0x3d7e20[_0x4297('0xaa')]){case _0x4297('0xab'):_0x357991=_[_0x4297('0x97')](_0x45d5ad['associatedResources'],function(_0x2c5306){return _0x2c5306['id']===_0x3d7e20['reportId']&&_0x2c5306[_0x4297('0x10')]===_0x4297('0xac');});break;case _0x4297('0xad'):_0x357991=_[_0x4297('0x97')](_0x45d5ad[_0x4297('0xc')],function(_0x104878){return _0x104878['id']===_0x3d7e20[_0x4297('0xae')]&&_0x104878[_0x4297('0x10')]===_0x4297('0xaf');});break;}if(_0x357991)_0x5c094e[_0x4297('0x93')](_0x3d7e20);});_0x13e781[_0x4297('0xb0')]=_0x5c094e['length'];_0x13e781[_0x4297('0xb1')]=_0x5c094e;return _0x13e781;});}else{if(!_[_0x4297('0x91')](_0x32f778['query'][_0x4297('0xb2')])){_0x3dbcb0['where']['id']=_0x3dbcb0['where']['id']?_[_0x4297('0x9b')](_0x3dbcb0[_0x4297('0x88')]['id'],_0x32f778[_0x4297('0x8a')][_0x4297('0xb2')]):_0x32f778[_0x4297('0x8a')]['ids'];if(_0x32f778[_0x4297('0x8a')][_0x4297('0xb3')]){_0x3dbcb0[_0x4297('0xb4')]=_0x32f778[_0x4297('0x8a')]['customSorting'];}}if(_0x32f778[_0x4297('0x8a')][_0x4297('0xb5')]){_0x3dbcb0['where']=_[_0x4297('0xa2')](_0x3dbcb0[_0x4297('0x88')],{'$and':_0x32f778[_0x4297('0x8a')][_0x4297('0xb5')]});}return _0x557710[_0x56ceb3[_0x4297('0x14')]][_0x4297('0xb0')]({'where':_0x3dbcb0[_0x4297('0x88')]})[_0x4297('0x8')](function(_0x166c4d){_0x13e781[_0x4297('0xb0')]=_0x166c4d;if(_0x32f778[_0x4297('0x8a')]['includeAll']){if(_0x56ceb3[_0x4297('0x14')]==='CmContact'){_0x3dbcb0[_0x4297('0xa9')]=[{'model':_0x557710[_0x4297('0x70')],'as':'Tags','attributes':['id',_0x4297('0xe'),_0x4297('0xb6')],'required':_0x32f778[_0x4297('0x8a')]['tag']?!![]:![]},{'model':_0x557710['Tag'],'as':_0x4297('0xb7'),'attributes':['id',_0x4297('0xe'),_0x4297('0xb6')],'through':_0x32f778[_0x4297('0x8a')][_0x4297('0xb8')]?{'attributes':[],'where':{'TagId':_0x32f778[_0x4297('0x8a')][_0x4297('0xb8')]||undefined}}:{},'required':_0x32f778['query']['tag']?!![]:![]}];}else{_0x3dbcb0[_0x4297('0xa9')]=[{'all':!![]}];}}return _0x557710[_0x56ceb3[_0x4297('0x14')]][_0x4297('0x7')](_0x3dbcb0);})[_0x4297('0x8')](function(_0x5c64d9){_0x13e781[_0x4297('0xb1')]=_0x5c64d9;if(_0x37ae43==='Agents'&&_0x32f778['query']['openTabs']===_0x4297('0xb9')){var _0x546d25=[];for(var _0x30da18=0x0;_0x30da18<_0x13e781[_0x4297('0xb1')][_0x4297('0x92')];_0x30da18++){_0x546d25[_0x4297('0x93')](_0x5d4e0f(_0x4297('0xba'),_0x13e781[_0x4297('0xb1')][_0x30da18][_0x4297('0xbb')]));_0x546d25[_0x4297('0x93')](_0x5d4e0f(_0x4297('0xbc'),_0x13e781['rows'][_0x30da18][_0x4297('0xbb')]));_0x546d25[_0x4297('0x93')](_0x5d4e0f(_0x4297('0xbd'),_0x13e781[_0x4297('0xb1')][_0x30da18][_0x4297('0xbb')]));_0x546d25[_0x4297('0x93')](_0x5d4e0f(_0x4297('0xbe'),_0x13e781[_0x4297('0xb1')][_0x30da18][_0x4297('0xbb')]));_0x546d25[_0x4297('0x93')](_0x5d4e0f(_0x4297('0xbf'),_0x13e781[_0x4297('0xb1')][_0x30da18][_0x4297('0xbb')]));_0x546d25[_0x4297('0x93')](_0x5d4e0f('whatsapp',_0x13e781[_0x4297('0xb1')][_0x30da18][_0x4297('0xbb')]));}return Promise[_0x4297('0x94')](_0x546d25)[_0x4297('0x8')](function(){return _0x13e781;});}return _0x13e781;});}});}}});}; \ No newline at end of file +var _0x5fb2=['resolve','UserProfileResource','field','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','VoiceQueues','QueueCampaigns','agents','Users','user','ZendeskAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','SELECT','select','ui.createdAt','from','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','isEmpty','push','UserProfileSection','find','all','ignore','union','length','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','reportType','DefaultReports','CustomReports','ids','customSorting','extraQueryConditions','count','include','color','tag','Tag','ThroughTags','rows','openTabs','true','sms','dataValues','fax','openchannel','whatsapp','./userProfile.attributes','squel','exports','filter','value','findAll','associatedResources','map','catch','model','then','name'];(function(_0x16218e,_0x1d626e){var _0xaa548b=function(_0x437fae){while(--_0x437fae){_0x16218e['push'](_0x16218e['shift']());}};_0xaa548b(++_0x1d626e);}(_0x5fb2,0x16e));var _0x25fb=function(_0x96baa6,_0x113c83){_0x96baa6=_0x96baa6-0x0;var _0x14c52b=_0x5fb2[_0x96baa6];return _0x14c52b;};'use strict';var _=require('lodash');var attributes=require(_0x25fb('0x0'));var squel=require(_0x25fb('0x1'));module[_0x25fb('0x2')]=function(_0x429653){var _0x2a4c5f=_0x429653['models'];function _0x37d6ce(_0x1c0903,_0x42fa6e){return new Promise(function(_0x9a5786,_0x36808d){if(!_0x42fa6e)return _0x9a5786(null);var _0x117309=_0x42fa6e[_0x25fb('0x3')]?{[_0x42fa6e[_0x25fb('0x3')]['field']]:_0x42fa6e[_0x25fb('0x3')][_0x25fb('0x4')]}:undefined;return _0x2a4c5f[_0x1c0903][_0x25fb('0x5')]({'where':_0x117309,'raw':!![]})['then'](function(_0x385d35){_0x42fa6e[_0x25fb('0x6')]=_[_0x25fb('0x7')](_0x385d35,'id');_0x9a5786(_0x42fa6e);})[_0x25fb('0x8')](function(_0x1c8e1b){_0x36808d(_0x1c8e1b);});});}function _0x2def7a(_0x1c7c3d,_0x7eec88){return new Promise(function(_0x27f215,_0x1c0f28){var _0x51c614=_0x1c7c3d['filter']?{[_0x1c7c3d['filter']['field']]:_0x1c7c3d['filter'][_0x25fb('0x4')]}:undefined;return _0x2a4c5f[_0x1c7c3d[_0x25fb('0x9')]][_0x25fb('0x5')]({'where':_0x51c614,'raw':!![]})[_0x25fb('0xa')](function(_0x2ae0ab){_0x7eec88[_0x25fb('0x6')]=_['map'](_0x2ae0ab,function(_0x362cc3){return _0x362cc3[_0x25fb('0xb')];});_0x27f215(_0x7eec88);})[_0x25fb('0x8')](function(_0x5992b1){_0x1c0f28(_0x5992b1);});});}function _0x5f50ae(_0x501e84,_0x108bfd,_0x4b02f8){if(!_0x108bfd)return Promise[_0x25fb('0xc')](null);return new Promise(function(_0x2077c3,_0x6c554f){return _0x2a4c5f[_0x25fb('0xd')][_0x25fb('0x5')]({'where':{'sectionId':_0x108bfd['id']},'raw':!![]})[_0x25fb('0xa')](function(_0x3bbee8){if(_0x501e84['field']&&_0x501e84['field']!=='id'){_0x108bfd['associatedResources']=_[_0x25fb('0x7')](_0x3bbee8,function(_0x4a4f8b){return _0x4a4f8b[_0x501e84[_0x25fb('0xe')]];});}else{if(_0x4b02f8===_0x25fb('0xf')){_0x108bfd[_0x25fb('0x6')]=_[_0x25fb('0x7')](_0x3bbee8,function(_0x5d6b16){return{'id':_0x5d6b16['resourceId'],'type':_0x5d6b16[_0x25fb('0x10')]};});}else{_0x108bfd[_0x25fb('0x6')]=_[_0x25fb('0x7')](_0x3bbee8,function(_0x56a64b){return _0x56a64b[_0x25fb('0x11')];});}}_0x2077c3(_0x108bfd);})[_0x25fb('0x8')](function(_0x1218e5){_0x6c554f(_0x1218e5);});});}function _0x5ea7cc(_0x9c8363,_0x4e0164){var _0x1f0cde={'parentSections':[]};switch(_0x9c8363[_0x25fb('0x12')]()){case _0x25fb('0x13'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x15');break;case _0x25fb('0x16'):_0x1f0cde[_0x25fb('0x14')]='SquareOdbc';break;case _0x25fb('0x17'):_0x1f0cde['childModel']=_0x25fb('0x18');_0x1f0cde[_0x25fb('0x19')]=[{'name':_0x25fb('0x1a'),'field':_0x25fb('0xb'),'foreignKey':'projectName'}];break;case'projects':_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x1b');break;case _0x25fb('0x1c'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x1d');_0x1f0cde['parentSections']=[{'name':_0x25fb('0x1e'),'field':'id','foreignKey':_0x25fb('0x1f')}];break;case _0x25fb('0x20'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x21');break;case'companies':_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x22');break;case _0x25fb('0x23'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x24');break;case _0x25fb('0x25'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x26');break;case'chatwebsites':_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x27');break;case'faxqueues':_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x28');break;case'faxaccounts':_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x29');break;case _0x25fb('0x2a'):case _0x25fb('0x2b'):case _0x25fb('0x2c'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x2d');break;case'contexts':_0x1f0cde['childModel']=_0x25fb('0x2e');break;case _0x25fb('0x2f'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x30');break;case _0x25fb('0x31'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x32');_0x1f0cde[_0x25fb('0x19')]=[{'name':_0x25fb('0x33'),'field':_0x25fb('0xb'),'foreignKey':_0x25fb('0x34'),'model':_0x25fb('0x35'),'filter':{'field':_0x25fb('0x36'),'value':[_0x25fb('0x37')]}},{'name':_0x25fb('0x38'),'field':_0x25fb('0xb'),'foreignKey':_0x25fb('0x34'),'model':_0x25fb('0x35'),'filter':{'field':'role','value':[_0x25fb('0x39')]}},{'name':'VoiceQueues','field':_0x25fb('0xb'),'foreignKey':_0x25fb('0x3a'),'model':_0x25fb('0x3b'),'filter':{'field':'type','value':[_0x25fb('0x3c')]}},{'name':'QueueCampaigns','field':_0x25fb('0xb'),'foreignKey':_0x25fb('0x3a'),'model':'VoiceQueue','filter':{'field':_0x25fb('0x10'),'value':[_0x25fb('0x3d')]}}];break;case _0x25fb('0x3e'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x3f');break;case'chanspies':_0x1f0cde['childModel']=_0x25fb('0x40');break;case _0x25fb('0x41'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x42');break;case'ivrcampaigns':_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x43');break;case _0x25fb('0x44'):_0x1f0cde['childModel']=_0x25fb('0x45');break;case'mailaccounts':_0x1f0cde[_0x25fb('0x14')]='MailAccount';break;case _0x25fb('0x46'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x47');break;case _0x25fb('0x48'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x49');break;case _0x25fb('0x4a'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x4b');break;case _0x25fb('0x4c'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x4d');break;case _0x25fb('0x4e'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x4f');break;case _0x25fb('0x50'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x51');break;case _0x25fb('0x52'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x53');break;case _0x25fb('0x54'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x55');break;case'voicequeues':case'queuecampaigns':_0x1f0cde['childModel']='VoiceQueue';if(_0x4e0164){_0x1f0cde[_0x25fb('0x19')]=[{'name':_0x25fb('0x56')},{'name':_0x25fb('0x57')}];}break;case'users':case _0x25fb('0x58'):case'telephones':_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x35');if(_0x4e0164){_0x1f0cde[_0x25fb('0x19')]=[{'name':_0x25fb('0x59'),'filter':{'field':'role','value':['admin',_0x25fb('0x5a')]},'ignore':!![]},{'name':_0x25fb('0x33')},{'name':_0x25fb('0x38')}];}break;case'zendeskaccounts':_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x5b');break;case'salesforceaccounts':_0x1f0cde[_0x25fb('0x14')]='SalesforceAccount';break;case _0x25fb('0x5c'):_0x1f0cde[_0x25fb('0x14')]='FreshdeskAccount';break;case _0x25fb('0x5d'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x5e');break;case _0x25fb('0x5f'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x60');break;case _0x25fb('0x61'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x62');break;case _0x25fb('0x63'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x35');break;case'cannedanswers':_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x64');break;case _0x25fb('0x65'):_0x1f0cde['childModel']='Disposition';break;case _0x25fb('0x66'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x67');break;case _0x25fb('0x68'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x69');break;case _0x25fb('0x6a'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x6b');break;case _0x25fb('0x6c'):_0x1f0cde['childModel']='Schedule';break;case _0x25fb('0x6d'):_0x1f0cde['childModel']=_0x25fb('0x6e');break;case _0x25fb('0x6f'):_0x1f0cde[_0x25fb('0x14')]='Tag';break;case _0x25fb('0x70'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x71');break;case _0x25fb('0x72'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x73');break;case _0x25fb('0x74'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x75');break;case _0x25fb('0x76'):_0x1f0cde['childModel']='Variable';break;case _0x25fb('0x77'):_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x78');break;case _0x25fb('0x79'):_0x1f0cde['childModel']=_0x25fb('0xf');_0x1f0cde[_0x25fb('0x19')]=[{'name':_0x25fb('0x7a'),'field':'id','foreignKey':_0x25fb('0x7b')}];break;case'metrics':_0x1f0cde[_0x25fb('0x14')]=_0x25fb('0x7c');break;}return _0x1f0cde;}function _0x36d8db(_0x45d6b4,_0x588a1b){var _0x5921cd=_0x45d6b4['charAt'](0x0)[_0x25fb('0x7d')]()+_0x45d6b4[_0x25fb('0x7e')](0x1);var _0x48f6aa={'type':_0x2a4c5f[_0x25fb('0x7f')]['QueryTypes'][_0x25fb('0x80')],'raw':!![]};return new Promise(function(_0x4ec6a7,_0xcc3d07){var _0x40a862=squel[_0x25fb('0x81')]()['field']('ui.'+_0x5921cd+'InteractionId','id')[_0x25fb('0xe')](_0x25fb('0x82'))[_0x25fb('0x83')]('user_has_'+_0x45d6b4+'_interactions','ui')[_0x25fb('0x84')](_0x25fb('0x85'),_0x588a1b['id']);return _0x2a4c5f[_0x25fb('0x86')][_0x25fb('0x87')](_0x40a862[_0x25fb('0x88')](),_0x48f6aa)[_0x25fb('0xa')](function(_0x4d6bdf){_0x588a1b[_0x5921cd+_0x25fb('0x89')]=_0x4d6bdf;_0x4ec6a7(_0x4d6bdf);})[_0x25fb('0x8')](function(_0x4ef31d){_0xcc3d07(_0x4ef31d);});});}return _0x429653[_0x25fb('0x8a')](_0x25fb('0x8b'),attributes,{'tableName':_0x25fb('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5dffe6){var _0xf8a509=require(_0x25fb('0x8d'));var _0x14b457={'raw':_0x5dffe6[_0x25fb('0x87')]['raw'],'where':{}};var _0x289ded={};var _0x2791db={'count':0x0,'rows':[]};var _0x54cfe2=_0x5dffe6[_0x25fb('0x87')]['section'];var _0x1d1dd2=_0x5dffe6[_0x25fb('0x87')]['mergeResources']||![];var _0x1e83ee=_0x5ea7cc(_0x54cfe2,_0x1d1dd2);if(!_0x1e83ee[_0x25fb('0x14')])throw new Error('Invalid\x20section\x20\x27'+_0x54cfe2+'\x27');var _0x3ebf03=[{'name':_0x54cfe2}];if(!_[_0x25fb('0x8e')](_0x1e83ee[_0x25fb('0x19')]))_0x3ebf03=_0x1e83ee[_0x25fb('0x19')];var _0x3dd4a4=[];for(var _0x154d54=0x0;_0x154d54<_0x3ebf03['length'];_0x154d54++){_0x3dd4a4[_0x25fb('0x8f')](_0x2a4c5f[_0x25fb('0x90')][_0x25fb('0x91')]({'where':{'userProfileId':_0x5dffe6['params']['id'],'name':_0x3ebf03[_0x154d54][_0x25fb('0xb')]},'raw':!![]}));}return Promise[_0x25fb('0x92')](_0x3dd4a4)[_0x25fb('0xa')](function(_0x5cb03a){var _0x280194=_['filter'](_0x5cb03a,function(_0x2d3b46){return _0x2d3b46?_0x2d3b46:undefined;});var _0x4bf011=_['filter'](_0x3ebf03,[_0x25fb('0x93'),!![]]);var _0x14212c=_['isEmpty'](_0x280194)&&_[_0x25fb('0x8e')](_0x4bf011)?null:_[_0x25fb('0x94')](_0x4bf011,_0x280194);if(!_0x14212c)return null;var _0x18433b=[];for(var _0x209468=0x0;_0x209468<_0x14212c[_0x25fb('0x95')];_0x209468++){var _0x16be05=_[_0x25fb('0x91')](_0x3ebf03,function(_0x226cfd){return _0x14212c[_0x209468]?_0x226cfd[_0x25fb('0xb')]===_0x14212c[_0x209468][_0x25fb('0xb')]:null;});if(_0x16be05){if(_0x14212c[_0x209468]['ignore']){_0x18433b[_0x25fb('0x8f')](_0x37d6ce(_0x1e83ee[_0x25fb('0x14')],_0x14212c[_0x209468]));}else{if(!_0x14212c[_0x209468][_0x25fb('0x96')]){_0x18433b['push'](_0x5f50ae(_0x16be05,_0x14212c[_0x209468],_0x1e83ee['childModel']));}else{if(_0x16be05[_0x25fb('0x9')]){_0x18433b[_0x25fb('0x8f')](_0x2def7a(_0x16be05,_0x14212c[_0x209468]));}}}}}return Promise[_0x25fb('0x92')](_0x18433b);})[_0x25fb('0xa')](function(_0x1dc7cc){var _0x45f728=_0x1dc7cc;var _0x49a002=null;if(_0x45f728){_0x49a002=_0x45f728[_0x25fb('0x95')]===0x1?_0x45f728[0x0]:null;}if(!_0x49a002&&!_0x45f728)return _0x2791db;var _0x3e871b=_0x2a4c5f[_0x1e83ee[_0x25fb('0x14')]]['rawAttributes'];_0x289ded[_0x25fb('0x9')]=_[_0x25fb('0x97')](_0x3e871b);_0x289ded[_0x25fb('0x87')]=_[_0x25fb('0x97')](_0x5dffe6[_0x25fb('0x87')]);_0x289ded[_0x25fb('0x98')]=_[_0x25fb('0x99')](_0x289ded[_0x25fb('0x9')],_0x289ded[_0x25fb('0x87')]);_0x14b457[_0x25fb('0x9a')]=_[_0x25fb('0x99')](_0x289ded[_0x25fb('0x9')],_0xf8a509[_0x25fb('0x9b')](_0x5dffe6['query']['fields']));_0x14b457[_0x25fb('0x9a')]=_0x14b457['attributes'][_0x25fb('0x95')]?_0x14b457[_0x25fb('0x9a')]:_0x289ded['model'];if(!_0x5dffe6[_0x25fb('0x87')][_0x25fb('0x9c')](_0x25fb('0x9d'))){_0x14b457[_0x25fb('0x9e')]=_0xf8a509[_0x25fb('0x9e')](_0x5dffe6[_0x25fb('0x87')]['limit']);_0x14b457[_0x25fb('0x9f')]=_0xf8a509[_0x25fb('0x9f')](_0x5dffe6[_0x25fb('0x87')]['offset']);}_0x14b457[_0x25fb('0xa0')]=_0xf8a509[_0x25fb('0xa1')](_0x5dffe6[_0x25fb('0x87')][_0x25fb('0xa1')]);_0x14b457[_0x25fb('0x84')]=_0xf8a509[_0x25fb('0x98')](_[_0x25fb('0xa2')](_0x5dffe6[_0x25fb('0x87')],_0x289ded[_0x25fb('0x98')]));if(_0x5dffe6[_0x25fb('0x87')][_0x25fb('0x3')]){_0x14b457[_0x25fb('0x84')]=_[_0x25fb('0xa3')](_0x14b457[_0x25fb('0x84')],{'$or':_[_0x25fb('0x7')](_0x3e871b,function(_0x413b37){if(_0x413b37[_0x25fb('0x10')][_0x25fb('0xa4')]!==_0x25fb('0xa5')){var _0x54e5f2={};_0x54e5f2[_0x413b37[_0x25fb('0xe')]]={'$like':'%'+_0x5dffe6[_0x25fb('0x87')][_0x25fb('0x3')]+'%'};return _0x54e5f2;}})});}var _0x3247d5=[];var _0x320001=null;var _0x4e993={};if(_0x49a002){_0x320001=_[_0x25fb('0x91')](_0x3ebf03,['name',_0x49a002[_0x25fb('0xb')]]);if(_0x320001[_0x25fb('0xe')]){_0x4e993={};if(_0x1e83ee[_0x25fb('0x14')]===_0x25fb('0xf')){_0x4e993[_0x320001[_0x25fb('0xa6')]]=_[_0x25fb('0x7')](_0x49a002[_0x25fb('0x6')],'id');}else{_0x4e993[_0x320001[_0x25fb('0xa6')]]=_0x49a002[_0x25fb('0x6')];}_0x3247d5['push'](_0x4e993);}else{_0x14b457[_0x25fb('0x84')]['id']=_0x49a002[_0x25fb('0x6')];}}else{for(var _0x4c9c6d=0x0;_0x4c9c6d<_0x45f728[_0x25fb('0x95')];_0x4c9c6d++){_0x320001=_[_0x25fb('0x91')](_0x3ebf03,[_0x25fb('0xb'),_0x45f728[_0x4c9c6d][_0x25fb('0xb')]]);if(_0x320001[_0x25fb('0xe')]){_0x4e993={};_0x4e993[_0x320001[_0x25fb('0xa6')]]=_0x45f728[_0x4c9c6d][_0x25fb('0x6')];_0x3247d5[_0x25fb('0x8f')](_0x4e993);}else{if(!_0x14b457[_0x25fb('0x84')]['id'])_0x14b457['where']['id']=[];_0x45f728[_0x4c9c6d][_0x25fb('0x6')][_0x25fb('0xa7')](function(_0x3ffe8f){_0x14b457['where']['id'][_0x25fb('0x8f')](_0x3ffe8f);});}}}if(!_['isEmpty'](_0x3247d5)){_0x14b457[_0x25fb('0x84')]=_[_0x25fb('0xa3')](_0x14b457[_0x25fb('0x84')],{'$and':{'$or':_0x3247d5}});}_0x14b457=_[_0x25fb('0xa3')]({},_0x14b457,_0x5dffe6[_0x25fb('0xa8')]);if(_0x49a002&&!_0x49a002['autoAssociation']&&_0x1e83ee['childModel']===_0x25fb('0xf')){if(_0x5dffe6['query']['includeAll']){_0x14b457['include']=[{'all':!![]}];}return _0x2a4c5f[_0x1e83ee['childModel']][_0x25fb('0x5')](_0x14b457)[_0x25fb('0xa')](function(_0x51622b){var _0x52b775=[];_0x51622b[_0x25fb('0xa7')](function(_0x18820e){var _0x1d7a51;switch(_0x18820e[_0x25fb('0xa9')]){case'default':_0x1d7a51=_[_0x25fb('0x91')](_0x49a002[_0x25fb('0x6')],function(_0x4faf41){return _0x4faf41['id']===_0x18820e['reportId']&&_0x4faf41['type']===_0x25fb('0xaa');});break;case'custom':_0x1d7a51=_[_0x25fb('0x91')](_0x49a002[_0x25fb('0x6')],function(_0x10d129){return _0x10d129['id']===_0x18820e['reportId']&&_0x10d129[_0x25fb('0x10')]===_0x25fb('0xab');});break;}if(_0x1d7a51)_0x52b775[_0x25fb('0x8f')](_0x18820e);});_0x2791db['count']=_0x52b775[_0x25fb('0x95')];_0x2791db['rows']=_0x52b775;return _0x2791db;});}else{if(!_[_0x25fb('0x8e')](_0x5dffe6[_0x25fb('0x87')][_0x25fb('0xac')])){_0x14b457[_0x25fb('0x84')]['id']=_0x14b457[_0x25fb('0x84')]['id']?_[_0x25fb('0x99')](_0x14b457['where']['id'],_0x5dffe6[_0x25fb('0x87')][_0x25fb('0xac')]):_0x5dffe6[_0x25fb('0x87')][_0x25fb('0xac')];if(_0x5dffe6[_0x25fb('0x87')][_0x25fb('0xad')]){_0x14b457[_0x25fb('0xa0')]=_0x5dffe6[_0x25fb('0x87')]['customSorting'];}}if(_0x5dffe6[_0x25fb('0x87')][_0x25fb('0xae')]){_0x14b457[_0x25fb('0x84')]=_[_0x25fb('0xa3')](_0x14b457[_0x25fb('0x84')],{'$and':_0x5dffe6['query'][_0x25fb('0xae')]});}return _0x2a4c5f[_0x1e83ee['childModel']][_0x25fb('0xaf')]({'where':_0x14b457['where']})['then'](function(_0x39876f){_0x2791db[_0x25fb('0xaf')]=_0x39876f;if(_0x5dffe6[_0x25fb('0x87')]['includeAll']){if(_0x1e83ee[_0x25fb('0x14')]===_0x25fb('0x1d')){_0x14b457[_0x25fb('0xb0')]=[{'model':_0x2a4c5f['Tag'],'as':'Tags','attributes':['id','name',_0x25fb('0xb1')],'required':_0x5dffe6[_0x25fb('0x87')][_0x25fb('0xb2')]?!![]:![]},{'model':_0x2a4c5f[_0x25fb('0xb3')],'as':_0x25fb('0xb4'),'attributes':['id',_0x25fb('0xb'),'color'],'through':_0x5dffe6['query']['tag']?{'attributes':[],'where':{'TagId':_0x5dffe6[_0x25fb('0x87')]['tag']||undefined}}:{},'required':_0x5dffe6['query'][_0x25fb('0xb2')]?!![]:![]}];}else{_0x14b457['include']=[{'all':!![]}];}}return _0x2a4c5f[_0x1e83ee[_0x25fb('0x14')]][_0x25fb('0x5')](_0x14b457);})[_0x25fb('0xa')](function(_0x5816b4){_0x2791db[_0x25fb('0xb5')]=_0x5816b4;if(_0x54cfe2===_0x25fb('0x33')&&_0x5dffe6['query'][_0x25fb('0xb6')]===_0x25fb('0xb7')){var _0x314982=[];for(var _0x380bf2=0x0;_0x380bf2<_0x2791db[_0x25fb('0xb5')][_0x25fb('0x95')];_0x380bf2++){_0x314982[_0x25fb('0x8f')](_0x36d8db('chat',_0x2791db['rows'][_0x380bf2]['dataValues']));_0x314982[_0x25fb('0x8f')](_0x36d8db(_0x25fb('0xb8'),_0x2791db[_0x25fb('0xb5')][_0x380bf2][_0x25fb('0xb9')]));_0x314982['push'](_0x36d8db(_0x25fb('0xba'),_0x2791db['rows'][_0x380bf2]['dataValues']));_0x314982['push'](_0x36d8db('mail',_0x2791db[_0x25fb('0xb5')][_0x380bf2][_0x25fb('0xb9')]));_0x314982['push'](_0x36d8db(_0x25fb('0xbb'),_0x2791db[_0x25fb('0xb5')][_0x380bf2][_0x25fb('0xb9')]));_0x314982[_0x25fb('0x8f')](_0x36d8db(_0x25fb('0xbc'),_0x2791db['rows'][_0x380bf2][_0x25fb('0xb9')]));}return Promise[_0x25fb('0x92')](_0x314982)['then'](function(){return _0x2791db;});}return _0x2791db;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index dab31ca..d6a3c59 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 _0x87d8=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x431786,_0x234b3e){var _0x341779=function(_0x3bba94){while(--_0x3bba94){_0x431786['push'](_0x431786['shift']());}};_0x341779(++_0x234b3e);}(_0x87d8,0x1a9));var _0x887d=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x87d8[_0x240261];return _0x45c332;};'use strict';var _=require('lodash');var util=require(_0x887d('0x0'));var moment=require(_0x887d('0x1'));var BPromise=require(_0x887d('0x2'));var rs=require(_0x887d('0x3'));var fs=require('fs');var Redis=require(_0x887d('0x4'));var db=require(_0x887d('0x5'))['db'];var utils=require(_0x887d('0x6'));var logger=require(_0x887d('0x7'))(_0x887d('0x8'));var config=require(_0x887d('0x9'));var jayson=require(_0x887d('0xa'));var client=jayson[_0x887d('0xb')][_0x887d('0xc')]({'port':0x232a});config[_0x887d('0xd')]=_[_0x887d('0xe')](config['redis'],{'host':_0x887d('0xf'),'port':0x18eb});var socket=require(_0x887d('0x10'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x56c73a,_0x4396d8,_0x31488d){return new BPromise(function(_0x1f745a,_0x3db821){return client['request'](_0x56c73a,_0x31488d)['then'](function(_0x1aba20){logger[_0x887d('0x11')](_0x887d('0x12'),_0x4396d8,_0x887d('0x13'));logger[_0x887d('0x14')](_0x887d('0x15'),_0x4396d8,_0x887d('0x13'),JSON[_0x887d('0x16')](_0x1aba20));if(_0x1aba20['error']){if(_0x1aba20[_0x887d('0x17')][_0x887d('0x18')]===0x1f4){logger[_0x887d('0x17')]('UserProfile,\x20%s,\x20%s',_0x4396d8,_0x1aba20[_0x887d('0x17')][_0x887d('0x19')]);return _0x3db821(_0x1aba20['error']['message']);}logger['error'](_0x887d('0x12'),_0x4396d8,_0x1aba20[_0x887d('0x17')]['message']);return _0x1f745a(_0x1aba20[_0x887d('0x17')][_0x887d('0x19')]);}else{logger[_0x887d('0x11')]('UserProfile,\x20%s,\x20%s',_0x4396d8,_0x887d('0x13'));_0x1f745a(_0x1aba20[_0x887d('0x1a')]['message']);}})[_0x887d('0x1b')](function(_0x54481b){logger[_0x887d('0x17')](_0x887d('0x12'),_0x4396d8,_0x54481b);_0x3db821(_0x54481b);});});} \ No newline at end of file +var _0x4e83=['bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x2a4da2,_0x8ed4b4){var _0x59529c=function(_0x569eb3){while(--_0x569eb3){_0x2a4da2['push'](_0x2a4da2['shift']());}};_0x59529c(++_0x8ed4b4);}(_0x4e83,0x1ae));var _0x34e8=function(_0x4003fe,_0x38c382){_0x4003fe=_0x4003fe-0x0;var _0x5af37c=_0x4e83[_0x4003fe];return _0x5af37c;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});config[_0x34e8('0x8')]=_[_0x34e8('0x9')](config[_0x34e8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x34e8('0xa'))(new Redis(config[_0x34e8('0x8')]));require(_0x34e8('0xb'))['register'](socket);function respondWithRpcPromise(_0x8ad56d,_0x1e3038,_0x42bb8d){return new BPromise(function(_0x46fe66,_0x316e99){return client[_0x34e8('0xc')](_0x8ad56d,_0x42bb8d)[_0x34e8('0xd')](function(_0x6827a3){logger[_0x34e8('0xe')]('UserProfile,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'));logger[_0x34e8('0x10')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'),JSON[_0x34e8('0x11')](_0x6827a3));if(_0x6827a3[_0x34e8('0x12')]){if(_0x6827a3[_0x34e8('0x12')][_0x34e8('0x13')]===0x1f4){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x316e99(_0x6827a3['error'][_0x34e8('0x15')]);}logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x46fe66(_0x6827a3['error'][_0x34e8('0x15')]);}else{logger[_0x34e8('0xe')](_0x34e8('0x14'),_0x1e3038,_0x34e8('0xf'));_0x46fe66(_0x6827a3[_0x34e8('0x16')][_0x34e8('0x15')]);}})[_0x34e8('0x17')](function(_0x3eb461){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x3eb461);_0x316e99(_0x3eb461);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5f63608..bd0f881 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 _0x120a=['userProfile:','./userProfile.events','emit','removeListener','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x120a,0x123));var _0xa120=function(_0x330bb0,_0x4f695f){_0x330bb0=_0x330bb0-0x0;var _0x442278=_0x120a[_0x330bb0];return _0x442278;};'use strict';var UserProfileEvents=require(_0xa120('0x0'));var events=['save','remove','update'];function createListener(_0x5360b7,_0x5f46ba){return function(_0x6edad1){_0x5f46ba[_0xa120('0x1')](_0x5360b7,_0x6edad1);};}function removeListener(_0x325e81,_0x6e6fca){return function(){UserProfileEvents[_0xa120('0x2')](_0x325e81,_0x6e6fca);};}exports['register']=function(_0x5d9152){for(var _0x3ea11e=0x0,_0x54a4d2=events[_0xa120('0x3')];_0x3ea11e<_0x54a4d2;_0x3ea11e++){var _0x22a5e3=events[_0x3ea11e];var _0x22303c=createListener(_0xa120('0x4')+_0x22a5e3,_0x5d9152);UserProfileEvents['on'](_0x22a5e3,_0x22303c);}}; \ No newline at end of file +var _0x7856=['removeListener','length','userProfile:','./userProfile.events','emit'];(function(_0x2d1840,_0x5dc27e){var _0xd06a88=function(_0x4770c9){while(--_0x4770c9){_0x2d1840['push'](_0x2d1840['shift']());}};_0xd06a88(++_0x5dc27e);}(_0x7856,0x10c));var _0x6785=function(_0x4c2827,_0x1c08f2){_0x4c2827=_0x4c2827-0x0;var _0x1d5395=_0x7856[_0x4c2827];return _0x1d5395;};'use strict';var UserProfileEvents=require(_0x6785('0x0'));var events=['save','remove','update'];function createListener(_0xcc7ac4,_0x3b33df){return function(_0x4930a8){_0x3b33df[_0x6785('0x1')](_0xcc7ac4,_0x4930a8);};}function removeListener(_0x2f1ec,_0x183439){return function(){UserProfileEvents[_0x6785('0x2')](_0x2f1ec,_0x183439);};}exports['register']=function(_0x2c2b16){for(var _0x19a7bf=0x0,_0xe3552c=events[_0x6785('0x3')];_0x19a7bf<_0xe3552c;_0x19a7bf++){var _0x5cdfbe=events[_0x19a7bf];var _0x4f64a2=createListener(_0x6785('0x4')+_0x5cdfbe,_0x2c2b16);UserProfileEvents['on'](_0x5cdfbe,_0x4f64a2);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index e783430..69081db 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 _0xf041=['/:id','show','post','create','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4db17c,_0x4ff943){var _0x137377=function(_0x538ae4){while(--_0x538ae4){_0x4db17c['push'](_0x4db17c['shift']());}};_0x137377(++_0x4ff943);}(_0xf041,0x16b));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x1f04('0x0'));var util=require('util');var path=require(_0x1f04('0x1'));var timeout=require(_0x1f04('0x2'));var express=require(_0x1f04('0x3'));var router=express[_0x1f04('0x4')]();var fs_extra=require(_0x1f04('0x5'));var auth=require(_0x1f04('0x6'));var interaction=require(_0x1f04('0x7'));var config=require(_0x1f04('0x8'));var controller=require(_0x1f04('0x9'));router[_0x1f04('0xa')]('/',auth[_0x1f04('0xb')](),controller[_0x1f04('0xc')]);router[_0x1f04('0xa')](_0x1f04('0xd'),auth[_0x1f04('0xb')](),controller[_0x1f04('0xe')]);router['get'](_0x1f04('0xf'),auth[_0x1f04('0xb')](),controller[_0x1f04('0x10')]);router[_0x1f04('0x11')]('/',auth[_0x1f04('0xb')](),controller[_0x1f04('0x12')]);router['put'](_0x1f04('0xf'),auth[_0x1f04('0xb')](),controller[_0x1f04('0x13')]);router[_0x1f04('0x14')](_0x1f04('0xf'),auth[_0x1f04('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x85ed=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','multer','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x85ed,0x66));var _0xd85e=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x85ed[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0xd85e('0x0'));var util=require(_0xd85e('0x1'));var path=require(_0xd85e('0x2'));var timeout=require(_0xd85e('0x3'));var express=require(_0xd85e('0x4'));var router=express[_0xd85e('0x5')]();var fs_extra=require(_0xd85e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd85e('0x7'));var config=require(_0xd85e('0x8'));var controller=require(_0xd85e('0x9'));router[_0xd85e('0xa')]('/',auth['isAuthenticated'](),controller[_0xd85e('0xb')]);router[_0xd85e('0xa')]('/describe',auth[_0xd85e('0xc')](),controller[_0xd85e('0xd')]);router[_0xd85e('0xa')](_0xd85e('0xe'),auth['isAuthenticated'](),controller[_0xd85e('0xf')]);router[_0xd85e('0x10')]('/',auth[_0xd85e('0xc')](),controller[_0xd85e('0x11')]);router[_0xd85e('0x12')](_0xd85e('0xe'),auth['isAuthenticated'](),controller[_0xd85e('0x13')]);router['delete']('/:id',auth[_0xd85e('0xc')](),controller[_0xd85e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 132ae79..b589695 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 _0x8394=['INTEGER','sequelize','exports','STRING'];(function(_0x5ec47a,_0x53fad6){var _0x5d2faf=function(_0x331883){while(--_0x331883){_0x5ec47a['push'](_0x5ec47a['shift']());}};_0x5d2faf(++_0x53fad6);}(_0x8394,0x171));var _0x4839=function(_0xabf5e4,_0x48b1cc){_0xabf5e4=_0xabf5e4-0x0;var _0x1c9563=_0x8394[_0xabf5e4];return _0x1c9563;};'use strict';var Sequelize=require(_0x4839('0x0'));module[_0x4839('0x1')]={'name':{'type':Sequelize[_0x4839('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4839('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4839('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe3b9=['STRING','INTEGER','sequelize','exports'];(function(_0x13211d,_0x55d8f9){var _0x3b70cd=function(_0x201471){while(--_0x201471){_0x13211d['push'](_0x13211d['shift']());}};_0x3b70cd(++_0x55d8f9);}(_0xe3b9,0x72));var _0x9e3b=function(_0x1806d4,_0x47cc68){_0x1806d4=_0x1806d4-0x0;var _0x392c2c=_0xe3b9[_0x1806d4];return _0x392c2c;};'use strict';var Sequelize=require(_0x9e3b('0x0'));module[_0x9e3b('0x1')]={'name':{'type':Sequelize[_0x9e3b('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9e3b('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9e3b('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 c0de2e4..f517bf0 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 _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','UserProfileResource','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x2eed55,_0x143ff0){var _0x4141fc=function(_0x1d2915){while(--_0x1d2915){_0x2eed55['push'](_0x2eed55['shift']());}};_0x4141fc(++_0x143ff0);}(_0xafc4,0x69));var _0x4afc=function(_0x4fe21d,_0x47e851){_0x4fe21d=_0x4fe21d-0x0;var _0x296b99=_0xafc4[_0x4fe21d];return _0x296b99;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['UserProfileResource'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['UserProfileResource']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file +var _0xba34=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0xba34,0x119));var _0x4ba3=function(_0x464a50,_0x3ff731){_0x464a50=_0x464a50-0x0;var _0xf54fe4=_0xba34[_0x464a50];return _0xf54fe4;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));};exports['describe']=function(_0x43f820,_0x19d70f){return db[_0x4ba3('0x2d')][_0x4ba3('0x4b')]()[_0x4ba3('0x26')](respondWithResult(_0x19d70f,null))[_0x4ba3('0x46')](handleError(_0x19d70f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 5db9f66..6b548a2 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 _0x518d=['../../config/environment','./userProfileResource.attributes','define','compositeIndex','lodash','util','moment','bluebird','path','rimraf'];(function(_0x16ca1a,_0x16f495){var _0x1c0f27=function(_0x400d31){while(--_0x400d31){_0x16ca1a['push'](_0x16ca1a['shift']());}};_0x1c0f27(++_0x16f495);}(_0x518d,0xea));var _0xd518=function(_0x46ee22,_0x1c1b32){_0x46ee22=_0x46ee22-0x0;var _0x63d92b=_0x518d[_0x46ee22];return _0x63d92b;};'use strict';var _=require(_0xd518('0x0'));var util=require(_0xd518('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd518('0x2'));var BPromise=require(_0xd518('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd518('0x4'));var rimraf=require(_0xd518('0x5'));var config=require(_0xd518('0x6'));var attributes=require(_0xd518('0x7'));module['exports']=function(_0x3118a4,_0x905238){return _0x3118a4[_0xd518('0x8')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xd518('0x9'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x07f0=['request-promise','path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','moment'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x07f0,0x130));var _0x007f=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x07f0[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x007f('0x0'));var util=require(_0x007f('0x1'));var logger=require(_0x007f('0x2'))('api');var moment=require(_0x007f('0x3'));var BPromise=require('bluebird');var rp=require(_0x007f('0x4'));var fs=require('fs');var path=require(_0x007f('0x5'));var rimraf=require(_0x007f('0x6'));var config=require('../../config/environment');var attributes=require(_0x007f('0x7'));module[_0x007f('0x8')]=function(_0x74cb6,_0x42f002){return _0x74cb6[_0x007f('0x9')](_0x007f('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x007f('0xb'),'fields':[_0x007f('0xc'),_0x007f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 61f1e5d..e0848f3 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 _0xc922=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x288325,_0x26e4ff){var _0x3b9fd7=function(_0x1f2816){while(--_0x1f2816){_0x288325['push'](_0x288325['shift']());}};_0x3b9fd7(++_0x26e4ff);}(_0xc922,0x1df));var _0x2c92=function(_0x399fd1,_0x3c96a3){_0x399fd1=_0x399fd1-0x0;var _0x24c526=_0xc922[_0x399fd1];return _0x24c526;};'use strict';var _=require(_0x2c92('0x0'));var util=require(_0x2c92('0x1'));var moment=require(_0x2c92('0x2'));var BPromise=require(_0x2c92('0x3'));var rs=require(_0x2c92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c92('0x5'))['db'];var utils=require(_0x2c92('0x6'));var logger=require(_0x2c92('0x7'))('rpc');var config=require(_0x2c92('0x8'));var jayson=require(_0x2c92('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1872fa,_0x357145,_0x13cf99){return new BPromise(function(_0x28109c,_0x2c1802){return client['request'](_0x1872fa,_0x13cf99)[_0x2c92('0xa')](function(_0x30fd13){logger[_0x2c92('0xb')](_0x2c92('0xc'),_0x357145,_0x2c92('0xd'));logger[_0x2c92('0xe')](_0x2c92('0xf'),_0x357145,_0x2c92('0xd'),JSON['stringify'](_0x30fd13));if(_0x30fd13[_0x2c92('0x10')]){if(_0x30fd13[_0x2c92('0x10')][_0x2c92('0x11')]===0x1f4){logger[_0x2c92('0x10')](_0x2c92('0xc'),_0x357145,_0x30fd13['error'][_0x2c92('0x12')]);return _0x2c1802(_0x30fd13['error'][_0x2c92('0x12')]);}logger[_0x2c92('0x10')](_0x2c92('0xc'),_0x357145,_0x30fd13['error'][_0x2c92('0x12')]);return _0x28109c(_0x30fd13[_0x2c92('0x10')][_0x2c92('0x12')]);}else{logger[_0x2c92('0xb')](_0x2c92('0xc'),_0x357145,_0x2c92('0xd'));_0x28109c(_0x30fd13[_0x2c92('0x13')]['message']);}})[_0x2c92('0x14')](function(_0x1fdf7c){logger[_0x2c92('0x10')](_0x2c92('0xc'),_0x357145,_0x1fdf7c);_0x2c1802(_0x1fdf7c);});});} \ No newline at end of file +var _0xe13d=['jayson/promise','request','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x32cf8c,_0x4f793c){var _0x52930b=function(_0x525601){while(--_0x525601){_0x32cf8c['push'](_0x32cf8c['shift']());}};_0x52930b(++_0x4f793c);}(_0xe13d,0xdd));var _0xde13=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xe13d[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0xde13('0x0'));var moment=require(_0xde13('0x1'));var BPromise=require(_0xde13('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde13('0x3'));var db=require(_0xde13('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xde13('0x5'))('rpc');var config=require(_0xde13('0x6'));var jayson=require(_0xde13('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48e557,_0x41de37,_0x589d8f){return new BPromise(function(_0xb25db2,_0x3be349){return client[_0xde13('0x8')](_0x48e557,_0x589d8f)['then'](function(_0x30139d){logger[_0xde13('0x9')](_0xde13('0xa'),_0x41de37,'request\x20sent');logger[_0xde13('0xb')](_0xde13('0xc'),_0x41de37,_0xde13('0xd'),JSON['stringify'](_0x30139d));if(_0x30139d[_0xde13('0xe')]){if(_0x30139d[_0xde13('0xe')][_0xde13('0xf')]===0x1f4){logger[_0xde13('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x41de37,_0x30139d[_0xde13('0xe')]['message']);return _0x3be349(_0x30139d['error'][_0xde13('0x10')]);}logger['error'](_0xde13('0xa'),_0x41de37,_0x30139d['error'][_0xde13('0x10')]);return _0xb25db2(_0x30139d[_0xde13('0xe')]['message']);}else{logger[_0xde13('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x41de37,'request\x20sent');_0xb25db2(_0x30139d[_0xde13('0x11')][_0xde13('0x10')]);}})[_0xde13('0x12')](function(_0x55a47d){logger['error'](_0xde13('0xa'),_0x41de37,_0x55a47d);_0x3be349(_0x55a47d);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index ae36a31..1dc486c 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 _0x2dc3=['/describe','describe','show','post','create','put','delete','/:id','destroy','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x1f1b58,_0x5a5daf){var _0x96cade=function(_0x5da739){while(--_0x5da739){_0x1f1b58['push'](_0x1f1b58['shift']());}};_0x96cade(++_0x5a5daf);}(_0x2dc3,0x1a7));var _0x32dc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2dc3[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x32dc('0x0'));var util=require(_0x32dc('0x1'));var path=require(_0x32dc('0x2'));var timeout=require(_0x32dc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x32dc('0x4'));var config=require(_0x32dc('0x5'));var controller=require(_0x32dc('0x6'));router[_0x32dc('0x7')]('/',auth[_0x32dc('0x8')](),controller['index']);router[_0x32dc('0x7')](_0x32dc('0x9'),auth[_0x32dc('0x8')](),controller[_0x32dc('0xa')]);router['get']('/:id',auth[_0x32dc('0x8')](),controller[_0x32dc('0xb')]);router[_0x32dc('0xc')]('/',auth[_0x32dc('0x8')](),controller[_0x32dc('0xd')]);router[_0x32dc('0xe')]('/:id',auth[_0x32dc('0x8')](),controller['update']);router[_0x32dc('0xf')](_0x32dc('0x10'),auth[_0x32dc('0x8')](),controller[_0x32dc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4b53=['update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','post','put','/:id'];(function(_0x3da577,_0x1caac1){var _0x54db1b=function(_0x531e0a){while(--_0x531e0a){_0x3da577['push'](_0x3da577['shift']());}};_0x54db1b(++_0x1caac1);}(_0x4b53,0xe6));var _0x34b5=function(_0x208d5c,_0x1a2eb6){_0x208d5c=_0x208d5c-0x0;var _0x3ea5d4=_0x4b53[_0x208d5c];return _0x3ea5d4;};'use strict';var multer=require(_0x34b5('0x0'));var util=require(_0x34b5('0x1'));var path=require(_0x34b5('0x2'));var timeout=require(_0x34b5('0x3'));var express=require(_0x34b5('0x4'));var router=express[_0x34b5('0x5')]();var fs_extra=require(_0x34b5('0x6'));var auth=require(_0x34b5('0x7'));var interaction=require(_0x34b5('0x8'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x34b5('0x9')]('/',auth[_0x34b5('0xa')](),controller[_0x34b5('0xb')]);router['get'](_0x34b5('0xc'),auth[_0x34b5('0xa')](),controller[_0x34b5('0xd')]);router[_0x34b5('0x9')]('/:id',auth[_0x34b5('0xa')](),controller['show']);router[_0x34b5('0xe')]('/',auth[_0x34b5('0xa')](),controller['create']);router[_0x34b5('0xf')](_0x34b5('0x10'),auth[_0x34b5('0xa')](),controller[_0x34b5('0x11')]);router[_0x34b5('0x12')](_0x34b5('0x10'),auth[_0x34b5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index fd2d826..e21af41 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 _0x7916=['getDataValue','sequelize','STRING','BOOLEAN','crudPermissions'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x7916,0x128));var _0x6791=function(_0x5470c4,_0x5dddc1){_0x5470c4=_0x5470c4-0x0;var _0x418ee2=_0x7916[_0x5470c4];return _0x418ee2;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x6791('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x6791('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x6791('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x6791('0x1')],'set':function(_0x330476){this['setDataValue'](_0x6791('0x3'),_0x330476?_0x330476['join'](''):[]);},'get':function(){return this[_0x6791('0x4')](_0x6791('0x3'))?this['getDataValue'](_0x6791('0x3'))['split'](''):[];}}}; \ No newline at end of file +var _0x6e6c=['join','getDataValue','crudPermissions','sequelize','exports','STRING','INTEGER','setDataValue'];(function(_0xd00c57,_0x2bf4a5){var _0x49e051=function(_0x37b140){while(--_0x37b140){_0xd00c57['push'](_0xd00c57['shift']());}};_0x49e051(++_0x2bf4a5);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xc6e6('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xc6e6('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc6e6('0x2')],'set':function(_0x5a9e2b){this[_0xc6e6('0x4')]('crudPermissions',_0x5a9e2b?_0x5a9e2b[_0xc6e6('0x5')](''):[]);},'get':function(){return this[_0xc6e6('0x6')]('crudPermissions')?this[_0xc6e6('0x6')](_0xc6e6('0x7'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 10e60f7..2f70cac 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 _0x7e81=['hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','params','keys','rawAttributes','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','UserProfileSection','fieldName','type','key','model','filters','intersection','query','attributes','fields','length'];(function(_0xfd917,_0x1d7006){var _0x22d19b=function(_0x470cc8){while(--_0x470cc8){_0xfd917['push'](_0xfd917['shift']());}};_0x22d19b(++_0x1d7006);}(_0x7e81,0x183));var _0x17e8=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7e81[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x17e8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x17e8('0x1'));var rp=require(_0x17e8('0x2'));var moment=require(_0x17e8('0x3'));var BPromise=require(_0x17e8('0x4'));var Mustache=require('mustache');var util=require(_0x17e8('0x5'));var path=require(_0x17e8('0x6'));var sox=require(_0x17e8('0x7'));var csv=require(_0x17e8('0x8'));var ejs=require(_0x17e8('0x9'));var fs=require('fs');var fs_extra=require(_0x17e8('0xa'));var _=require(_0x17e8('0xb'));var squel=require(_0x17e8('0xc'));var crypto=require('crypto');var jsforce=require(_0x17e8('0xd'));var deskjs=require(_0x17e8('0xe'));var toCsv=require(_0x17e8('0x8'));var querystring=require(_0x17e8('0xf'));var Papa=require(_0x17e8('0x10'));var Redis=require('ioredis');var authService=require(_0x17e8('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17e8('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x17e8('0x13'));var config=require(_0x17e8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x17e8('0x15'))['db'];function respondWithStatusCode(_0x51522a,_0x2bd98f){_0x2bd98f=_0x2bd98f||0xcc;return function(_0x5d3420){if(_0x5d3420){return _0x51522a['sendStatus'](_0x2bd98f);}return _0x51522a[_0x17e8('0x16')](_0x2bd98f)[_0x17e8('0x17')]();};}function respondWithResult(_0x202620,_0x136d38){_0x136d38=_0x136d38||0xc8;return function(_0x4567e8){if(_0x4567e8){return _0x202620['status'](_0x136d38)[_0x17e8('0x18')](_0x4567e8);}};}function respondWithFilteredResult(_0x3d2e01,_0x577703){return function(_0x298c88){if(_0x298c88){var _0x37c845=typeof _0x577703[_0x17e8('0x19')]===_0x17e8('0x1a')&&typeof _0x577703['limit']==='undefined';var _0xe76131=_0x298c88[_0x17e8('0x1b')];var _0x20a468=_0x37c845?0x0:_0x577703[_0x17e8('0x19')];var _0x5876d8=_0x37c845?_0x298c88[_0x17e8('0x1b')]:_0x577703[_0x17e8('0x19')]+_0x577703['limit'];var _0x46dd89;if(_0x5876d8>=_0xe76131){_0x5876d8=_0xe76131;_0x46dd89=0xc8;}else{_0x46dd89=0xce;}_0x3d2e01[_0x17e8('0x16')](_0x46dd89);return _0x3d2e01[_0x17e8('0x1c')]('Content-Range',_0x20a468+'-'+_0x5876d8+'/'+_0xe76131)[_0x17e8('0x18')](_0x298c88);}return null;};}function patchUpdates(_0x21e251){return function(_0x3ee83c){try{jsonpatch[_0x17e8('0x1d')](_0x3ee83c,_0x21e251,!![]);}catch(_0x4495a2){return BPromise['reject'](_0x4495a2);}return _0x3ee83c[_0x17e8('0x1e')]();};}function saveUpdates(_0x1ace49,_0x39180c){return function(_0x22255e){if(_0x22255e){return _0x22255e[_0x17e8('0x1f')](_0x1ace49)['then'](function(_0x2440c0){return _0x2440c0;});}return null;};}function removeEntity(_0x4733a0,_0x8ef158){return function(_0x44a1c7){if(_0x44a1c7){return _0x44a1c7[_0x17e8('0x20')]()[_0x17e8('0x21')](function(){_0x4733a0['status'](0xcc)[_0x17e8('0x17')]();});}};}function handleEntityNotFound(_0x56b16c,_0x51f989){return function(_0x28da37){if(!_0x28da37){_0x56b16c[_0x17e8('0x22')](0x194);}return _0x28da37;};}function handleError(_0x1f6f96,_0x17546e){_0x17546e=_0x17546e||0x1f4;return function(_0x138f03){logger['error'](_0x138f03[_0x17e8('0x23')]);if(_0x138f03[_0x17e8('0x24')]){delete _0x138f03[_0x17e8('0x24')];}_0x1f6f96['status'](_0x17546e)[_0x17e8('0x25')](_0x138f03);};}exports[_0x17e8('0x26')]=function(_0x534dda,_0x75d3e1){var _0x3c38af={},_0x12c557={},_0x19b465={'count':0x0,'rows':[]};var _0x355cac=_[_0x17e8('0x27')](db[_0x17e8('0x28')]['rawAttributes'],function(_0x171c64){return{'name':_0x171c64[_0x17e8('0x29')],'type':_0x171c64[_0x17e8('0x2a')][_0x17e8('0x2b')]};});_0x12c557[_0x17e8('0x2c')]=_[_0x17e8('0x27')](_0x355cac,_0x17e8('0x24'));_0x12c557['query']=_['keys'](_0x534dda['query']);_0x12c557[_0x17e8('0x2d')]=_[_0x17e8('0x2e')](_0x12c557[_0x17e8('0x2c')],_0x12c557[_0x17e8('0x2f')]);_0x3c38af[_0x17e8('0x30')]=_[_0x17e8('0x2e')](_0x12c557['model'],qs[_0x17e8('0x31')](_0x534dda['query']['fields']));_0x3c38af[_0x17e8('0x30')]=_0x3c38af[_0x17e8('0x30')][_0x17e8('0x32')]?_0x3c38af['attributes']:_0x12c557[_0x17e8('0x2c')];if(!_0x534dda['query'][_0x17e8('0x33')](_0x17e8('0x34'))){_0x3c38af[_0x17e8('0x35')]=qs['limit'](_0x534dda[_0x17e8('0x2f')]['limit']);_0x3c38af['offset']=qs[_0x17e8('0x19')](_0x534dda[_0x17e8('0x2f')]['offset']);}_0x3c38af[_0x17e8('0x36')]=qs[_0x17e8('0x37')](_0x534dda[_0x17e8('0x2f')]['sort']);_0x3c38af['where']=qs[_0x17e8('0x2d')](_['pick'](_0x534dda[_0x17e8('0x2f')],_0x12c557[_0x17e8('0x2d')]),_0x355cac);if(_0x534dda[_0x17e8('0x2f')]['filter']){_0x3c38af[_0x17e8('0x38')]=_['merge'](_0x3c38af[_0x17e8('0x38')],{'$or':_[_0x17e8('0x27')](_0x355cac,function(_0x1bdd20){if(_0x1bdd20[_0x17e8('0x2a')]!==_0x17e8('0x39')){var _0x2f135a={};_0x2f135a[_0x1bdd20[_0x17e8('0x24')]]={'$like':'%'+_0x534dda['query'][_0x17e8('0x3a')]+'%'};return _0x2f135a;}})});}_0x3c38af=_[_0x17e8('0x3b')]({},_0x3c38af,_0x534dda['options']);var _0x4466cb={'where':_0x3c38af['where']};return db[_0x17e8('0x28')][_0x17e8('0x1b')](_0x4466cb)[_0x17e8('0x21')](function(_0x315b5b){_0x19b465[_0x17e8('0x1b')]=_0x315b5b;if(_0x534dda[_0x17e8('0x2f')][_0x17e8('0x3c')]){_0x3c38af[_0x17e8('0x3d')]=[{'all':!![]}];}return db[_0x17e8('0x28')]['findAll'](_0x3c38af);})[_0x17e8('0x21')](function(_0x2d2fa2){_0x19b465[_0x17e8('0x3e')]=_0x2d2fa2;return _0x19b465;})['then'](respondWithFilteredResult(_0x75d3e1,_0x3c38af))[_0x17e8('0x3f')](handleError(_0x75d3e1,null));};exports[_0x17e8('0x40')]=function(_0x3d21c9,_0xcbd2bc){var _0x292ba9={'raw':![],'where':{'id':_0x3d21c9[_0x17e8('0x41')]['id']}},_0x416b71={};_0x416b71[_0x17e8('0x2c')]=_[_0x17e8('0x42')](db[_0x17e8('0x28')][_0x17e8('0x43')]);_0x416b71[_0x17e8('0x2f')]=_['keys'](_0x3d21c9[_0x17e8('0x2f')]);_0x416b71[_0x17e8('0x2d')]=_[_0x17e8('0x2e')](_0x416b71[_0x17e8('0x2c')],_0x416b71[_0x17e8('0x2f')]);_0x292ba9['attributes']=_[_0x17e8('0x2e')](_0x416b71[_0x17e8('0x2c')],qs[_0x17e8('0x31')](_0x3d21c9[_0x17e8('0x2f')][_0x17e8('0x31')]));_0x292ba9[_0x17e8('0x30')]=_0x292ba9[_0x17e8('0x30')][_0x17e8('0x32')]?_0x292ba9[_0x17e8('0x30')]:_0x416b71['model'];if(_0x3d21c9['query']['includeAll']){_0x292ba9[_0x17e8('0x3d')]=[{'all':!![]}];}_0x292ba9=_[_0x17e8('0x3b')]({},_0x292ba9,_0x3d21c9[_0x17e8('0x44')]);return db[_0x17e8('0x28')][_0x17e8('0x45')](_0x292ba9)[_0x17e8('0x21')](handleEntityNotFound(_0xcbd2bc,null))[_0x17e8('0x21')](respondWithResult(_0xcbd2bc,null))[_0x17e8('0x3f')](handleError(_0xcbd2bc,null));};exports[_0x17e8('0x46')]=function(_0x3bed79,_0x7c22e){return db[_0x17e8('0x28')][_0x17e8('0x46')](_0x3bed79[_0x17e8('0x47')],{})[_0x17e8('0x21')](respondWithResult(_0x7c22e,0xc9))[_0x17e8('0x3f')](handleError(_0x7c22e,null));};exports[_0x17e8('0x1f')]=function(_0x35d529,_0x3ddf6f){if(_0x35d529[_0x17e8('0x47')]['id']){delete _0x35d529[_0x17e8('0x47')]['id'];}return db[_0x17e8('0x28')][_0x17e8('0x45')]({'where':{'id':_0x35d529['params']['id']}})[_0x17e8('0x21')](handleEntityNotFound(_0x3ddf6f,null))['then'](saveUpdates(_0x35d529['body'],null))[_0x17e8('0x21')](respondWithResult(_0x3ddf6f,null))[_0x17e8('0x3f')](handleError(_0x3ddf6f,null));};exports[_0x17e8('0x20')]=function(_0x57b043,_0x28fdd8){return db[_0x17e8('0x28')][_0x17e8('0x45')]({'where':{'id':_0x57b043[_0x17e8('0x41')]['id']}})['then'](handleEntityNotFound(_0x28fdd8,null))['then'](removeEntity(_0x28fdd8,null))[_0x17e8('0x3f')](handleError(_0x28fdd8,null));};exports[_0x17e8('0x48')]=function(_0x45e1c7,_0x599e24){return db[_0x17e8('0x28')][_0x17e8('0x48')]()[_0x17e8('0x21')](respondWithResult(_0x599e24,null))[_0x17e8('0x3f')](handleError(_0x599e24,null));}; \ No newline at end of file +var _0xf902=['sendStatus','error','name','map','UserProfileSection','rawAttributes','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then'];(function(_0x282442,_0x185644){var _0x244748=function(_0x10a419){while(--_0x10a419){_0x282442['push'](_0x282442['shift']());}};_0x244748(++_0x185644);}(_0xf902,0x18b));var _0x2f90=function(_0x82318,_0x3c9976){_0x82318=_0x82318-0x0;var _0x182c07=_0xf902[_0x82318];return _0x182c07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f90('0x0'));var zipdir=require(_0x2f90('0x1'));var jsonpatch=require(_0x2f90('0x2'));var rp=require(_0x2f90('0x3'));var moment=require(_0x2f90('0x4'));var BPromise=require(_0x2f90('0x5'));var Mustache=require(_0x2f90('0x6'));var util=require(_0x2f90('0x7'));var path=require(_0x2f90('0x8'));var sox=require(_0x2f90('0x9'));var csv=require(_0x2f90('0xa'));var ejs=require(_0x2f90('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f90('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2f90('0xa'));var querystring=require('querystring');var Papa=require(_0x2f90('0xd'));var Redis=require(_0x2f90('0xe'));var authService=require(_0x2f90('0xf'));var qs=require(_0x2f90('0x10'));var as=require(_0x2f90('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f90('0x12'))(_0x2f90('0x13'));var utils=require(_0x2f90('0x14'));var config=require(_0x2f90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f90('0x16'))['db'];function respondWithStatusCode(_0x535c11,_0x2d255b){_0x2d255b=_0x2d255b||0xcc;return function(_0x3bd36e){if(_0x3bd36e){return _0x535c11['sendStatus'](_0x2d255b);}return _0x535c11[_0x2f90('0x17')](_0x2d255b)[_0x2f90('0x18')]();};}function respondWithResult(_0x4433b3,_0x9db680){_0x9db680=_0x9db680||0xc8;return function(_0x14624e){if(_0x14624e){return _0x4433b3['status'](_0x9db680)[_0x2f90('0x19')](_0x14624e);}};}function respondWithFilteredResult(_0x2d1198,_0x1a2309){return function(_0x1e4108){if(_0x1e4108){var _0x432156=typeof _0x1a2309[_0x2f90('0x1a')]===_0x2f90('0x1b')&&typeof _0x1a2309[_0x2f90('0x1c')]===_0x2f90('0x1b');var _0x409a51=_0x1e4108['count'];var _0x469d89=_0x432156?0x0:_0x1a2309[_0x2f90('0x1a')];var _0x4581c3=_0x432156?_0x1e4108[_0x2f90('0x1d')]:_0x1a2309[_0x2f90('0x1a')]+_0x1a2309[_0x2f90('0x1c')];var _0x56185c;if(_0x4581c3>=_0x409a51){_0x4581c3=_0x409a51;_0x56185c=0xc8;}else{_0x56185c=0xce;}_0x2d1198[_0x2f90('0x17')](_0x56185c);return _0x2d1198[_0x2f90('0x1e')](_0x2f90('0x1f'),_0x469d89+'-'+_0x4581c3+'/'+_0x409a51)[_0x2f90('0x19')](_0x1e4108);}return null;};}function patchUpdates(_0x16258c){return function(_0x5b5554){try{jsonpatch[_0x2f90('0x20')](_0x5b5554,_0x16258c,!![]);}catch(_0x5c1f23){return BPromise[_0x2f90('0x21')](_0x5c1f23);}return _0x5b5554['save']();};}function saveUpdates(_0x4bd9fd,_0x24b884){return function(_0x5ab383){if(_0x5ab383){return _0x5ab383[_0x2f90('0x22')](_0x4bd9fd)['then'](function(_0x47eb63){return _0x47eb63;});}return null;};}function removeEntity(_0x34f793,_0xa3c49d){return function(_0x4db511){if(_0x4db511){return _0x4db511[_0x2f90('0x23')]()[_0x2f90('0x24')](function(){_0x34f793['status'](0xcc)[_0x2f90('0x18')]();});}};}function handleEntityNotFound(_0xf4710b,_0x262d48){return function(_0x1a9c83){if(!_0x1a9c83){_0xf4710b[_0x2f90('0x25')](0x194);}return _0x1a9c83;};}function handleError(_0x332fa8,_0x435d39){_0x435d39=_0x435d39||0x1f4;return function(_0x33de72){logger[_0x2f90('0x26')](_0x33de72['stack']);if(_0x33de72[_0x2f90('0x27')]){delete _0x33de72[_0x2f90('0x27')];}_0x332fa8[_0x2f90('0x17')](_0x435d39)['send'](_0x33de72);};}exports['index']=function(_0x13ed04,_0x3c7d78){var _0x39780d={},_0xf2a053={},_0x39f3b3={'count':0x0,'rows':[]};var _0x4ab6de=_[_0x2f90('0x28')](db[_0x2f90('0x29')][_0x2f90('0x2a')],function(_0x100900){return{'name':_0x100900['fieldName'],'type':_0x100900['type'][_0x2f90('0x2b')]};});_0xf2a053['model']=_['map'](_0x4ab6de,_0x2f90('0x27'));_0xf2a053[_0x2f90('0x2c')]=_['keys'](_0x13ed04[_0x2f90('0x2c')]);_0xf2a053[_0x2f90('0x2d')]=_['intersection'](_0xf2a053[_0x2f90('0x2e')],_0xf2a053[_0x2f90('0x2c')]);_0x39780d['attributes']=_[_0x2f90('0x2f')](_0xf2a053[_0x2f90('0x2e')],qs[_0x2f90('0x30')](_0x13ed04[_0x2f90('0x2c')][_0x2f90('0x30')]));_0x39780d[_0x2f90('0x31')]=_0x39780d[_0x2f90('0x31')][_0x2f90('0x32')]?_0x39780d[_0x2f90('0x31')]:_0xf2a053['model'];if(!_0x13ed04[_0x2f90('0x2c')][_0x2f90('0x33')](_0x2f90('0x34'))){_0x39780d[_0x2f90('0x1c')]=qs[_0x2f90('0x1c')](_0x13ed04['query'][_0x2f90('0x1c')]);_0x39780d[_0x2f90('0x1a')]=qs[_0x2f90('0x1a')](_0x13ed04[_0x2f90('0x2c')]['offset']);}_0x39780d[_0x2f90('0x35')]=qs[_0x2f90('0x36')](_0x13ed04[_0x2f90('0x2c')][_0x2f90('0x36')]);_0x39780d['where']=qs[_0x2f90('0x2d')](_[_0x2f90('0x37')](_0x13ed04[_0x2f90('0x2c')],_0xf2a053['filters']),_0x4ab6de);if(_0x13ed04[_0x2f90('0x2c')]['filter']){_0x39780d[_0x2f90('0x38')]=_[_0x2f90('0x39')](_0x39780d[_0x2f90('0x38')],{'$or':_[_0x2f90('0x28')](_0x4ab6de,function(_0x38fe6d){if(_0x38fe6d[_0x2f90('0x3a')]!=='VIRTUAL'){var _0x2533a0={};_0x2533a0[_0x38fe6d['name']]={'$like':'%'+_0x13ed04[_0x2f90('0x2c')][_0x2f90('0x3b')]+'%'};return _0x2533a0;}})});}_0x39780d=_[_0x2f90('0x39')]({},_0x39780d,_0x13ed04['options']);var _0xdd21a5={'where':_0x39780d[_0x2f90('0x38')]};return db[_0x2f90('0x29')][_0x2f90('0x1d')](_0xdd21a5)[_0x2f90('0x24')](function(_0x51138b){_0x39f3b3[_0x2f90('0x1d')]=_0x51138b;if(_0x13ed04['query'][_0x2f90('0x3c')]){_0x39780d[_0x2f90('0x3d')]=[{'all':!![]}];}return db[_0x2f90('0x29')][_0x2f90('0x3e')](_0x39780d);})[_0x2f90('0x24')](function(_0x57ec25){_0x39f3b3[_0x2f90('0x3f')]=_0x57ec25;return _0x39f3b3;})[_0x2f90('0x24')](respondWithFilteredResult(_0x3c7d78,_0x39780d))[_0x2f90('0x40')](handleError(_0x3c7d78,null));};exports['show']=function(_0x4d240b,_0x17e293){var _0x3bb95a={'raw':![],'where':{'id':_0x4d240b[_0x2f90('0x41')]['id']}},_0x5708e0={};_0x5708e0['model']=_['keys'](db[_0x2f90('0x29')][_0x2f90('0x2a')]);_0x5708e0[_0x2f90('0x2c')]=_[_0x2f90('0x42')](_0x4d240b['query']);_0x5708e0['filters']=_[_0x2f90('0x2f')](_0x5708e0[_0x2f90('0x2e')],_0x5708e0[_0x2f90('0x2c')]);_0x3bb95a[_0x2f90('0x31')]=_[_0x2f90('0x2f')](_0x5708e0['model'],qs[_0x2f90('0x30')](_0x4d240b['query'][_0x2f90('0x30')]));_0x3bb95a['attributes']=_0x3bb95a['attributes'][_0x2f90('0x32')]?_0x3bb95a[_0x2f90('0x31')]:_0x5708e0['model'];if(_0x4d240b[_0x2f90('0x2c')][_0x2f90('0x3c')]){_0x3bb95a['include']=[{'all':!![]}];}_0x3bb95a=_['merge']({},_0x3bb95a,_0x4d240b[_0x2f90('0x43')]);return db[_0x2f90('0x29')][_0x2f90('0x44')](_0x3bb95a)[_0x2f90('0x24')](handleEntityNotFound(_0x17e293,null))[_0x2f90('0x24')](respondWithResult(_0x17e293,null))[_0x2f90('0x40')](handleError(_0x17e293,null));};exports[_0x2f90('0x45')]=function(_0xae8871,_0x1bd634){return db[_0x2f90('0x29')][_0x2f90('0x45')](_0xae8871[_0x2f90('0x46')],{})['then'](respondWithResult(_0x1bd634,0xc9))[_0x2f90('0x40')](handleError(_0x1bd634,null));};exports[_0x2f90('0x22')]=function(_0x55a97e,_0x2f3d71){if(_0x55a97e[_0x2f90('0x46')]['id']){delete _0x55a97e[_0x2f90('0x46')]['id'];}return db[_0x2f90('0x29')]['find']({'where':{'id':_0x55a97e[_0x2f90('0x41')]['id']}})[_0x2f90('0x24')](handleEntityNotFound(_0x2f3d71,null))[_0x2f90('0x24')](saveUpdates(_0x55a97e[_0x2f90('0x46')],null))[_0x2f90('0x24')](respondWithResult(_0x2f3d71,null))['catch'](handleError(_0x2f3d71,null));};exports['destroy']=function(_0x2c214b,_0x51e441){return db[_0x2f90('0x29')][_0x2f90('0x44')]({'where':{'id':_0x2c214b[_0x2f90('0x41')]['id']}})[_0x2f90('0x24')](handleEntityNotFound(_0x51e441,null))[_0x2f90('0x24')](removeEntity(_0x51e441,null))[_0x2f90('0x40')](handleError(_0x51e441,null));};exports[_0x2f90('0x47')]=function(_0x43d470,_0x4d21f1){return db['UserProfileSection'][_0x2f90('0x47')]()[_0x2f90('0x24')](respondWithResult(_0x4d21f1,null))[_0x2f90('0x40')](handleError(_0x4d21f1,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 23b0f19..8b41f52 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 _0x1dab=['util','api','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','user_profile_has_sections','compositeIndex','sectionId','lodash'];(function(_0xf9f09b,_0x95fd6d){var _0x326dd2=function(_0x3970d4){while(--_0x3970d4){_0xf9f09b['push'](_0xf9f09b['shift']());}};_0x326dd2(++_0x95fd6d);}(_0x1dab,0x1b7));var _0xb1da=function(_0x4dd072,_0x515c74){_0x4dd072=_0x4dd072-0x0;var _0x45ee58=_0x1dab[_0x4dd072];return _0x45ee58;};'use strict';var _=require(_0xb1da('0x0'));var util=require(_0xb1da('0x1'));var logger=require('../../config/logger')(_0xb1da('0x2'));var moment=require('moment');var BPromise=require(_0xb1da('0x3'));var rp=require(_0xb1da('0x4'));var fs=require('fs');var path=require(_0xb1da('0x5'));var rimraf=require(_0xb1da('0x6'));var config=require('../../config/environment');var attributes=require(_0xb1da('0x7'));module['exports']=function(_0x9fcc27,_0x4c436e){return _0x9fcc27['define']('UserProfileSection',attributes,{'tableName':_0xb1da('0x8'),'paranoid':![],'indexes':[{'name':_0xb1da('0x9'),'fields':[_0xb1da('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x80e6=['bluebird','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','moment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x80e6,0x1e7));var _0x680e=function(_0x9dc3d4,_0x482904){_0x9dc3d4=_0x9dc3d4-0x0;var _0x4b6403=_0x80e6[_0x9dc3d4];return _0x4b6403;};'use strict';var _=require('lodash');var util=require(_0x680e('0x0'));var logger=require(_0x680e('0x1'))('api');var moment=require(_0x680e('0x2'));var BPromise=require(_0x680e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x680e('0x4'));var rimraf=require('rimraf');var config=require(_0x680e('0x5'));var attributes=require(_0x680e('0x6'));module[_0x680e('0x7')]=function(_0xcf8dcd,_0xec34f5){return _0xcf8dcd[_0x680e('0x8')](_0x680e('0x9'),attributes,{'tableName':_0x680e('0xa'),'paranoid':![],'indexes':[{'name':_0x680e('0xb'),'fields':[_0x680e('0xc'),_0x680e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ecb2528..136e369 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 _0x3a92=['request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','UserProfileSection,\x20%s,\x20%s'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3a92,0x12e));var _0x23a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a92[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x23a9('0x0'));var moment=require(_0x23a9('0x1'));var BPromise=require('bluebird');var rs=require(_0x23a9('0x2'));var fs=require('fs');var Redis=require(_0x23a9('0x3'));var db=require(_0x23a9('0x4'))['db'];var utils=require(_0x23a9('0x5'));var logger=require(_0x23a9('0x6'))(_0x23a9('0x7'));var config=require(_0x23a9('0x8'));var jayson=require(_0x23a9('0x9'));var client=jayson['client'][_0x23a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cedbd,_0x3615a8,_0x477066){return new BPromise(function(_0x26435d,_0xa9707a){return client['request'](_0x2cedbd,_0x477066)['then'](function(_0x556074){logger[_0x23a9('0xb')](_0x23a9('0xc'),_0x3615a8,_0x23a9('0xd'));logger[_0x23a9('0xe')](_0x23a9('0xf'),_0x3615a8,_0x23a9('0xd'),JSON[_0x23a9('0x10')](_0x556074));if(_0x556074[_0x23a9('0x11')]){if(_0x556074['error']['code']===0x1f4){logger[_0x23a9('0x11')](_0x23a9('0xc'),_0x3615a8,_0x556074[_0x23a9('0x11')][_0x23a9('0x12')]);return _0xa9707a(_0x556074[_0x23a9('0x11')][_0x23a9('0x12')]);}logger[_0x23a9('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x3615a8,_0x556074[_0x23a9('0x11')][_0x23a9('0x12')]);return _0x26435d(_0x556074[_0x23a9('0x11')][_0x23a9('0x12')]);}else{logger[_0x23a9('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x3615a8,'request\x20sent');_0x26435d(_0x556074[_0x23a9('0x13')][_0x23a9('0x12')]);}})[_0x23a9('0x14')](function(_0x4858f5){logger[_0x23a9('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x3615a8,_0x4858f5);_0xa9707a(_0x4858f5);});});} \ No newline at end of file +var _0x350f=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x472289,_0xb701aa){var _0x563aa5=function(_0x561ee6){while(--_0x561ee6){_0x472289['push'](_0x472289['shift']());}};_0x563aa5(++_0xb701aa);}(_0x350f,0xa0));var _0xf350=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x350f[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0xf350('0x0'));var util=require(_0xf350('0x1'));var moment=require(_0xf350('0x2'));var BPromise=require(_0xf350('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf350('0x4'));var db=require(_0xf350('0x5'))['db'];var utils=require(_0xf350('0x6'));var logger=require(_0xf350('0x7'))('rpc');var config=require(_0xf350('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf350('0x9')][_0xf350('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a74fa,_0x46ae62,_0x38d749){return new BPromise(function(_0xd675ec,_0x25290a){return client['request'](_0x4a74fa,_0x38d749)[_0xf350('0xb')](function(_0x296da0){logger[_0xf350('0xc')](_0xf350('0xd'),_0x46ae62,'request\x20sent');logger[_0xf350('0xe')](_0xf350('0xf'),_0x46ae62,_0xf350('0x10'),JSON[_0xf350('0x11')](_0x296da0));if(_0x296da0['error']){if(_0x296da0[_0xf350('0x12')][_0xf350('0x13')]===0x1f4){logger[_0xf350('0x12')](_0xf350('0xd'),_0x46ae62,_0x296da0[_0xf350('0x12')][_0xf350('0x14')]);return _0x25290a(_0x296da0[_0xf350('0x12')][_0xf350('0x14')]);}logger[_0xf350('0x12')](_0xf350('0xd'),_0x46ae62,_0x296da0[_0xf350('0x12')][_0xf350('0x14')]);return _0xd675ec(_0x296da0['error'][_0xf350('0x14')]);}else{logger[_0xf350('0xc')](_0xf350('0xd'),_0x46ae62,_0xf350('0x10'));_0xd675ec(_0x296da0[_0xf350('0x15')][_0xf350('0x14')]);}})[_0xf350('0x16')](function(_0x47261c){logger['error'](_0xf350('0xd'),_0x46ae62,_0x47261c);_0x25290a(_0x47261c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 72c2b3f..6e7012a 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1496c1,_0x23cf40){var _0x48abc0=function(_0x5337d6){while(--_0x5337d6){_0x1496c1['push'](_0x1496c1['shift']());}};_0x48abc0(++_0x23cf40);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x8307e3,_0x48eb78){var _0x492db9=function(_0x1284f7){while(--_0x1284f7){_0x8307e3['push'](_0x8307e3['shift']());}};_0x492db9(++_0x48eb78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 330f196..68fc417 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 _0xf69d=['INTEGER','sequelize','exports'];(function(_0xeb2a2d,_0x12c42f){var _0x37705c=function(_0xb90c5b){while(--_0xb90c5b){_0xeb2a2d['push'](_0xeb2a2d['shift']());}};_0x37705c(++_0x12c42f);}(_0xf69d,0x76));var _0xdf69=function(_0x29ab29,_0x4e67ca){_0x29ab29=_0x29ab29-0x0;var _0x40505e=_0xf69d[_0x29ab29];return _0x40505e;};'use strict';var Sequelize=require(_0xdf69('0x0'));module[_0xdf69('0x1')]={'penalty':{'type':Sequelize[_0xdf69('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x840f=['sequelize','exports'];(function(_0xdcca54,_0x4b2b61){var _0x453197=function(_0x806f6a){while(--_0x806f6a){_0xdcca54['push'](_0xdcca54['shift']());}};_0x453197(++_0x4b2b61);}(_0x840f,0x8a));var _0xf840=function(_0x4641d9,_0x3362db){_0x4641d9=_0x4641d9-0x0;var _0x58b071=_0x840f[_0x4641d9];return _0x58b071;};'use strict';var Sequelize=require(_0xf840('0x0'));module[_0xf840('0x1')]={'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 78d4c8f..df34a7e 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','lodash','util'];(function(_0x30dc41,_0x4a7bb7){var _0x2f6efc=function(_0x541ed9){while(--_0x541ed9){_0x30dc41['push'](_0x30dc41['shift']());}};_0x2f6efc(++_0x4a7bb7);}(_0xf494,0x1c6));var _0x4f49=function(_0x58a004,_0x1ce962){_0x58a004=_0x58a004-0x0;var _0x11993f=_0xf494[_0x58a004];return _0x11993f;};'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')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d17=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x48536f,_0x59530b){var _0xdc812=function(_0x3b9ad9){while(--_0x3b9ad9){_0x48536f['push'](_0x48536f['shift']());}};_0xdc812(++_0x59530b);}(_0x5d17,0x114));var _0x75d1=function(_0x136e17,_0x4cc300){_0x136e17=_0x136e17-0x0;var _0x5099c9=_0x5d17[_0x136e17];return _0x5099c9;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index ff15e31..c055ef3 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 _0x29ac=['request','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x29ac,0xd1));var _0xc29a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x29ac[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xc29a('0x0'));var moment=require(_0xc29a('0x1'));var BPromise=require(_0xc29a('0x2'));var rs=require(_0xc29a('0x3'));var fs=require('fs');var Redis=require(_0xc29a('0x4'));var db=require(_0xc29a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc29a('0x6'))(_0xc29a('0x7'));var config=require(_0xc29a('0x8'));var jayson=require(_0xc29a('0x9'));var client=jayson[_0xc29a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44ef1d,_0x263f3a,_0xd8b2b0){return new BPromise(function(_0x65e4a5,_0x4631e5){return client[_0xc29a('0xb')](_0x44ef1d,_0xd8b2b0)['then'](function(_0x2c09e7){logger[_0xc29a('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x263f3a,'request\x20sent');logger[_0xc29a('0xd')](_0xc29a('0xe'),_0x263f3a,_0xc29a('0xf'),JSON[_0xc29a('0x10')](_0x2c09e7));if(_0x2c09e7[_0xc29a('0x11')]){if(_0x2c09e7[_0xc29a('0x11')][_0xc29a('0x12')]===0x1f4){logger[_0xc29a('0x11')](_0xc29a('0x13'),_0x263f3a,_0x2c09e7[_0xc29a('0x11')][_0xc29a('0x14')]);return _0x4631e5(_0x2c09e7[_0xc29a('0x11')][_0xc29a('0x14')]);}logger[_0xc29a('0x11')](_0xc29a('0x13'),_0x263f3a,_0x2c09e7[_0xc29a('0x11')][_0xc29a('0x14')]);return _0x65e4a5(_0x2c09e7[_0xc29a('0x11')][_0xc29a('0x14')]);}else{logger['info'](_0xc29a('0x13'),_0x263f3a,_0xc29a('0xf'));_0x65e4a5(_0x2c09e7[_0xc29a('0x15')][_0xc29a('0x14')]);}})['catch'](function(_0x49ba1b){logger[_0xc29a('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x263f3a,_0x49ba1b);_0x4631e5(_0x49ba1b);});});} \ No newline at end of file +var _0xf10e=['client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1debbd,_0x4bd739){var _0x40c66d=function(_0x1d8938){while(--_0x1d8938){_0x1debbd['push'](_0x1debbd['shift']());}};_0x40c66d(++_0x4bd739);}(_0xf10e,0x15d));var _0xef10=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xf10e[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xef10('0x0'));var util=require(_0xef10('0x1'));var moment=require(_0xef10('0x2'));var BPromise=require(_0xef10('0x3'));var rs=require(_0xef10('0x4'));var fs=require('fs');var Redis=require(_0xef10('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xef10('0x6'));var logger=require(_0xef10('0x7'))(_0xef10('0x8'));var config=require(_0xef10('0x9'));var jayson=require(_0xef10('0xa'));var client=jayson[_0xef10('0xb')][_0xef10('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c0e8e,_0x527ceb,_0x414309){return new BPromise(function(_0x69482f,_0xaf98e3){return client[_0xef10('0xd')](_0x3c0e8e,_0x414309)[_0xef10('0xe')](function(_0x505a64){logger[_0xef10('0xf')](_0xef10('0x10'),_0x527ceb,_0xef10('0x11'));logger[_0xef10('0x12')](_0xef10('0x13'),_0x527ceb,_0xef10('0x11'),JSON[_0xef10('0x14')](_0x505a64));if(_0x505a64[_0xef10('0x15')]){if(_0x505a64[_0xef10('0x15')]['code']===0x1f4){logger[_0xef10('0x15')](_0xef10('0x10'),_0x527ceb,_0x505a64[_0xef10('0x15')][_0xef10('0x16')]);return _0xaf98e3(_0x505a64[_0xef10('0x15')][_0xef10('0x16')]);}logger[_0xef10('0x15')](_0xef10('0x10'),_0x527ceb,_0x505a64[_0xef10('0x15')][_0xef10('0x16')]);return _0x69482f(_0x505a64[_0xef10('0x15')]['message']);}else{logger['info'](_0xef10('0x10'),_0x527ceb,_0xef10('0x11'));_0x69482f(_0x505a64['result']['message']);}})[_0xef10('0x17')](function(_0x5e5e65){logger[_0xef10('0x15')]('UserSmsQueue,\x20%s,\x20%s',_0x527ceb,_0x5e5e65);_0xaf98e3(_0x5e5e65);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 3c8cb77..e4f07a5 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 _0x045f=['exports','INTEGER','sequelize'];(function(_0x59d05d,_0x34bbcb){var _0x28e3f0=function(_0x1f9b0a){while(--_0x1f9b0a){_0x59d05d['push'](_0x59d05d['shift']());}};_0x28e3f0(++_0x34bbcb);}(_0x045f,0xfb));var _0xf045=function(_0x454876,_0x580571){_0x454876=_0x454876-0x0;var _0x1084e6=_0x045f[_0x454876];return _0x1084e6;};'use strict';var Sequelize=require(_0xf045('0x0'));module[_0xf045('0x1')]={'UserId':{'type':Sequelize[_0xf045('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xf045('0x2')]}}; \ No newline at end of file +var _0xb203=['sequelize','exports','INTEGER'];(function(_0x14b8c2,_0x2c9e78){var _0x13cb58=function(_0x255814){while(--_0x255814){_0x14b8c2['push'](_0x14b8c2['shift']());}};_0x13cb58(++_0x2c9e78);}(_0xb203,0x78));var _0x3b20=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb203[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x3b20('0x0'));module[_0x3b20('0x1')]={'UserId':{'type':Sequelize[_0x3b20('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x3b20('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 88c9e96..292995a 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(_0x4fa775,_0x338132){var _0x2e92d8=function(_0x3178eb){while(--_0x3178eb){_0x4fa775['push'](_0x4fa775['shift']());}};_0x2e92d8(++_0x338132);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x4ffcfb,_0x439703){var _0x2dcd0c=function(_0x4ee3a0){while(--_0x4ee3a0){_0x4ffcfb['push'](_0x4ffcfb['shift']());}};_0x2dcd0c(++_0x439703);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 38fffa9..a0b316a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4c7de4,_0x1406ee){var _0x5e9eb4=function(_0x418564){while(--_0x418564){_0x4c7de4['push'](_0x4c7de4['shift']());}};_0x5e9eb4(++_0x1406ee);}(_0xe706,0xa3));var _0x6e70=function(_0x13651c,_0x1b81c5){_0x13651c=_0x13651c-0x0;var _0xc6ea66=_0xe706[_0x13651c];return _0xc6ea66;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4692a1,_0x41f54f){var _0x128700=function(_0x2661dc){while(--_0x2661dc){_0x4692a1['push'](_0x4692a1['shift']());}};_0x128700(++_0x41f54f);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 89cce0c..bb90f66 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 _0x30e6=['sequelize','exports','INTEGER'];(function(_0x1cb13c,_0x58a1b5){var _0x230242=function(_0x5030ea){while(--_0x5030ea){_0x1cb13c['push'](_0x1cb13c['shift']());}};_0x230242(++_0x58a1b5);}(_0x30e6,0xab));var _0x630e=function(_0x2472b1,_0x297865){_0x2472b1=_0x2472b1-0x0;var _0x206788=_0x30e6[_0x2472b1];return _0x206788;};'use strict';var Sequelize=require(_0x630e('0x0'));module[_0x630e('0x1')]={'penalty':{'type':Sequelize[_0x630e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x02ee=['sequelize','exports','INTEGER'];(function(_0x2fcf46,_0x50d59e){var _0x5c9013=function(_0x54a501){while(--_0x54a501){_0x2fcf46['push'](_0x2fcf46['shift']());}};_0x5c9013(++_0x50d59e);}(_0x02ee,0x72));var _0xe02e=function(_0x4fabad,_0x197776){_0x4fabad=_0x4fabad-0x0;var _0x3741bc=_0x02ee[_0x4fabad];return _0x3741bc;};'use strict';var Sequelize=require(_0xe02e('0x0'));module[_0xe02e('0x1')]={'penalty':{'type':Sequelize[_0xe02e('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 02730d0..201dc97 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 _0xae76=['../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x214f20,_0x33bc3a){var _0x56a12b=function(_0x36c839){while(--_0x36c839){_0x214f20['push'](_0x214f20['shift']());}};_0x56a12b(++_0x33bc3a);}(_0xae76,0xcb));var _0x6ae7=function(_0x33210d,_0xb42117){_0x33210d=_0x33210d-0x0;var _0x3d30f1=_0xae76[_0x33210d];return _0x3d30f1;};'use strict';var _=require(_0x6ae7('0x0'));var util=require('util');var logger=require(_0x6ae7('0x1'))('api');var moment=require(_0x6ae7('0x2'));var BPromise=require('bluebird');var rp=require(_0x6ae7('0x3'));var fs=require('fs');var path=require(_0x6ae7('0x4'));var rimraf=require(_0x6ae7('0x5'));var config=require(_0x6ae7('0x6'));var attributes=require(_0x6ae7('0x7'));module['exports']=function(_0x467d9c,_0x3bf819){return _0x467d9c[_0x6ae7('0x8')](_0x6ae7('0x9'),attributes,{'tableName':_0x6ae7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e5a=['api','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x1a1a69,_0x38594f){var _0x57b448=function(_0x5c9efc){while(--_0x5c9efc){_0x1a1a69['push'](_0x1a1a69['shift']());}};_0x57b448(++_0x38594f);}(_0x2e5a,0x101));var _0xa2e5=function(_0x4a2991,_0x5c9a51){_0x4a2991=_0x4a2991-0x0;var _0x539f85=_0x2e5a[_0x4a2991];return _0x539f85;};'use strict';var _=require(_0xa2e5('0x0'));var util=require(_0xa2e5('0x1'));var logger=require(_0xa2e5('0x2'))(_0xa2e5('0x3'));var moment=require('moment');var BPromise=require(_0xa2e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2e5('0x5'));var rimraf=require(_0xa2e5('0x6'));var config=require(_0xa2e5('0x7'));var attributes=require(_0xa2e5('0x8'));module[_0xa2e5('0x9')]=function(_0x2dacff,_0x271c00){return _0x2dacff[_0xa2e5('0xa')](_0xa2e5('0xb'),attributes,{'tableName':_0xa2e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 5660bac..d6a0457 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 _0xcd2f=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x464d42,_0x4f1d09){var _0x1483d3=function(_0x3061eb){while(--_0x3061eb){_0x464d42['push'](_0x464d42['shift']());}};_0x1483d3(++_0x4f1d09);}(_0xcd2f,0x1e3));var _0xfcd2=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xcd2f[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xfcd2('0x0'));var util=require(_0xfcd2('0x1'));var moment=require(_0xfcd2('0x2'));var BPromise=require(_0xfcd2('0x3'));var rs=require(_0xfcd2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcd2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcd2('0x6'))(_0xfcd2('0x7'));var config=require(_0xfcd2('0x8'));var jayson=require(_0xfcd2('0x9'));var client=jayson[_0xfcd2('0xa')][_0xfcd2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x67817a,_0x3b2c27,_0x825c20){return new BPromise(function(_0x3ec187,_0x427481){return client[_0xfcd2('0xc')](_0x67817a,_0x825c20)['then'](function(_0x2a914a){logger['info'](_0xfcd2('0xd'),_0x3b2c27,_0xfcd2('0xe'));logger['debug'](_0xfcd2('0xf'),_0x3b2c27,_0xfcd2('0xe'),JSON[_0xfcd2('0x10')](_0x2a914a));if(_0x2a914a[_0xfcd2('0x11')]){if(_0x2a914a['error']['code']===0x1f4){logger[_0xfcd2('0x11')](_0xfcd2('0xd'),_0x3b2c27,_0x2a914a[_0xfcd2('0x11')][_0xfcd2('0x12')]);return _0x427481(_0x2a914a[_0xfcd2('0x11')][_0xfcd2('0x12')]);}logger['error'](_0xfcd2('0xd'),_0x3b2c27,_0x2a914a[_0xfcd2('0x11')][_0xfcd2('0x12')]);return _0x3ec187(_0x2a914a[_0xfcd2('0x11')]['message']);}else{logger[_0xfcd2('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x3b2c27,_0xfcd2('0xe'));_0x3ec187(_0x2a914a[_0xfcd2('0x14')][_0xfcd2('0x12')]);}})[_0xfcd2('0x15')](function(_0x30f9de){logger['error'](_0xfcd2('0xd'),_0x3b2c27,_0x30f9de);_0x427481(_0x30f9de);});});} \ No newline at end of file +var _0x7e2b=['message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0x7e2b,0xa4));var _0xb7e2=function(_0x5c26ee,_0x2de1dc){_0x5c26ee=_0x5c26ee-0x0;var _0x42f31f=_0x7e2b[_0x5c26ee];return _0x42f31f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb7e2('0x0'));var BPromise=require(_0xb7e2('0x1'));var rs=require(_0xb7e2('0x2'));var fs=require('fs');var Redis=require(_0xb7e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb7e2('0x4'));var jayson=require(_0xb7e2('0x5'));var client=jayson[_0xb7e2('0x6')][_0xb7e2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43380d,_0x110dcc,_0x234305){return new BPromise(function(_0x5cdfd0,_0x14f354){return client[_0xb7e2('0x8')](_0x43380d,_0x234305)[_0xb7e2('0x9')](function(_0x53b3dc){logger['info'](_0xb7e2('0xa'),_0x110dcc,'request\x20sent');logger[_0xb7e2('0xb')](_0xb7e2('0xc'),_0x110dcc,_0xb7e2('0xd'),JSON[_0xb7e2('0xe')](_0x53b3dc));if(_0x53b3dc[_0xb7e2('0xf')]){if(_0x53b3dc[_0xb7e2('0xf')]['code']===0x1f4){logger['error'](_0xb7e2('0xa'),_0x110dcc,_0x53b3dc[_0xb7e2('0xf')]['message']);return _0x14f354(_0x53b3dc[_0xb7e2('0xf')][_0xb7e2('0x10')]);}logger[_0xb7e2('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x110dcc,_0x53b3dc['error'][_0xb7e2('0x10')]);return _0x5cdfd0(_0x53b3dc[_0xb7e2('0xf')][_0xb7e2('0x10')]);}else{logger[_0xb7e2('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x110dcc,'request\x20sent');_0x5cdfd0(_0x53b3dc[_0xb7e2('0x12')]['message']);}})[_0xb7e2('0x13')](function(_0x5d8458){logger[_0xb7e2('0xf')](_0xb7e2('0xa'),_0x110dcc,_0x5d8458);_0x14f354(_0x5d8458);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 72fc7d2..5cd3db8 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1ceb36,_0x4e8ecf){var _0x464c23=function(_0x1ed81d){while(--_0x1ed81d){_0x1ceb36['push'](_0x1ceb36['shift']());}};_0x464c23(++_0x4e8ecf);}(_0x70e0,0x17b));var _0x070e=function(_0x182ec5,_0x5d44f4){_0x182ec5=_0x182ec5-0x0;var _0x576df4=_0x70e0[_0x182ec5];return _0x576df4;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x41a70d,_0x168913){var _0x35fcee=function(_0x9afb44){while(--_0x9afb44){_0x41a70d['push'](_0x41a70d['shift']());}};_0x35fcee(++_0x168913);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xcb91[_0xf79bae];return _0x5d2cb7;};'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 fcdeb77..be43ed4 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 _0xd608=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x26c323,_0x559fa7){var _0xaa4f94=function(_0x7b9080){while(--_0x7b9080){_0x26c323['push'](_0x26c323['shift']());}};_0xaa4f94(++_0x559fa7);}(_0xd608,0x1b8));var _0x8d60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd608[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8d60('0x0'));module[_0x8d60('0x1')]={'uniqueid':{'type':Sequelize[_0x8d60('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8d60('0x3')},'membername':{'type':Sequelize[_0x8d60('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x8d60('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8d60('0x5'),'comment':_0x8d60('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8d60('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x8d60('0x4')],'allowNull':![],'unique':_0x8d60('0x5'),'comment':_0x8d60('0x3')},'penalty':{'type':Sequelize[_0x8d60('0x2')](0xb),'defaultValue':0x0,'comment':_0x8d60('0x3')},'paused':{'type':Sequelize[_0x8d60('0x2')](0xb),'defaultValue':0x0,'comment':_0x8d60('0x3')}}; \ No newline at end of file +var _0x5d66=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x5d66,0x130));var _0x65d6=function(_0x49dea6,_0xdc96d6){_0x49dea6=_0x49dea6-0x0;var _0x391f48=_0x5d66[_0x49dea6];return _0x391f48;};'use strict';var Sequelize=require(_0x65d6('0x0'));module[_0x65d6('0x1')]={'uniqueid':{'type':Sequelize[_0x65d6('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x65d6('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x65d6('0x3')},'UserId':{'type':Sequelize[_0x65d6('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x65d6('0x3')},'VoiceQueueId':{'type':Sequelize[_0x65d6('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x65d6('0x4')],'allowNull':![],'unique':_0x65d6('0x5'),'comment':_0x65d6('0x3')},'penalty':{'type':Sequelize[_0x65d6('0x2')](0xb),'defaultValue':0x0,'comment':_0x65d6('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x65d6('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 34b1b9b..ae6564a 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 _0x05f0=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','update','remove','emit','hasOwnProperty'];(function(_0x3812e0,_0x30d7eb){var _0x188b5f=function(_0x4ede40){while(--_0x4ede40){_0x3812e0['push'](_0x3812e0['shift']());}};_0x188b5f(++_0x30d7eb);}(_0x05f0,0x107));var _0x005f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x05f0[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x005f('0x0'));var UserVoiceQueueRt=require(_0x005f('0x1'))['db'][_0x005f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x005f('0x3'),'afterDestroy':_0x005f('0x4')};function emitEvent(_0x5c77bd){return function(_0x277753,_0x366284,_0x4fd1dd){UserVoiceQueueRtEvents[_0x005f('0x5')](_0x5c77bd+':'+_0x277753['id'],_0x277753);UserVoiceQueueRtEvents[_0x005f('0x5')](_0x5c77bd,_0x277753);_0x4fd1dd(null);};}for(var e in events){if(events[_0x005f('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x005f('0x7')](e,emitEvent(event));}}module[_0x005f('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0feb=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x106cc4,_0x480d9c){var _0x1c96cf=function(_0x255e86){while(--_0x255e86){_0x106cc4['push'](_0x106cc4['shift']());}};_0x1c96cf(++_0x480d9c);}(_0x0feb,0x130));var _0xb0fe=function(_0x2f6728,_0x2fd278){_0x2f6728=_0x2f6728-0x0;var _0x50527e=_0x0feb[_0x2f6728];return _0x50527e;};'use strict';var EventEmitter=require(_0xb0fe('0x0'));var UserVoiceQueueRt=require(_0xb0fe('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb0fe('0x2'),'afterUpdate':_0xb0fe('0x3'),'afterDestroy':_0xb0fe('0x4')};function emitEvent(_0x120231){return function(_0x4b8803,_0x16cd39,_0x4b84ad){UserVoiceQueueRtEvents['emit'](_0x120231+':'+_0x4b8803['id'],_0x4b8803);UserVoiceQueueRtEvents[_0xb0fe('0x5')](_0x120231,_0x4b8803);_0x4b84ad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xb0fe('0x6')](e,emitEvent(event));}}module[_0xb0fe('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 9d72994..e30e042 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 _0xb3a5=['lodash','util','../../config/logger','api','bluebird','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt'];(function(_0x243807,_0x5d779d){var _0x495b76=function(_0x5911b4){while(--_0x5911b4){_0x243807['push'](_0x243807['shift']());}};_0x495b76(++_0x5d779d);}(_0xb3a5,0xbd));var _0x5b3a=function(_0x396351,_0x2043db){_0x396351=_0x396351-0x0;var _0x2f81c8=_0xb3a5[_0x396351];return _0x2f81c8;};'use strict';var _=require(_0x5b3a('0x0'));var util=require(_0x5b3a('0x1'));var logger=require(_0x5b3a('0x2'))(_0x5b3a('0x3'));var moment=require('moment');var BPromise=require(_0x5b3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b3a('0x5'));var attributes=require(_0x5b3a('0x6'));module['exports']=function(_0x562d23,_0xe264ba){return _0x562d23[_0x5b3a('0x7')](_0x5b3a('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1ad=['rimraf','../../config/environment','exports','define','user_has_voice_queues_rt','util','../../config/logger','path'];(function(_0x387c65,_0x2fd251){var _0x4d24b7=function(_0x58e055){while(--_0x58e055){_0x387c65['push'](_0x387c65['shift']());}};_0x4d24b7(++_0x2fd251);}(_0xc1ad,0x1ad));var _0xdc1a=function(_0x37d892,_0x5c75dd){_0x37d892=_0x37d892-0x0;var _0x5b4e1f=_0xc1ad[_0x37d892];return _0x5b4e1f;};'use strict';var _=require('lodash');var util=require(_0xdc1a('0x0'));var logger=require(_0xdc1a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc1a('0x2'));var rimraf=require(_0xdc1a('0x3'));var config=require(_0xdc1a('0x4'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xdc1a('0x5')]=function(_0xed78d9,_0x11ca95){return _0xed78d9[_0xdc1a('0x6')]('UserVoiceQueueRt',attributes,{'tableName':_0xdc1a('0x7'),'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 7bd1c8a..1f32698 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 _0x0bc5=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','options','raw','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','request\x20sent','debug'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x0bc5,0x1d7));var _0x50bc=function(_0x3b2156,_0x30a37c){_0x3b2156=_0x3b2156-0x0;var _0x1a18f8=_0x0bc5[_0x3b2156];return _0x1a18f8;};'use strict';var _=require(_0x50bc('0x0'));var util=require(_0x50bc('0x1'));var moment=require(_0x50bc('0x2'));var BPromise=require(_0x50bc('0x3'));var rs=require(_0x50bc('0x4'));var fs=require('fs');var Redis=require(_0x50bc('0x5'));var db=require(_0x50bc('0x6'))['db'];var utils=require(_0x50bc('0x7'));var logger=require(_0x50bc('0x8'))(_0x50bc('0x9'));var config=require(_0x50bc('0xa'));var jayson=require(_0x50bc('0xb'));var client=jayson[_0x50bc('0xc')]['http']({'port':0x232a});config[_0x50bc('0xd')]=_[_0x50bc('0xe')](config[_0x50bc('0xd')],{'host':_0x50bc('0xf'),'port':0x18eb});var socket=require(_0x50bc('0x10'))(new Redis(config['redis']));require(_0x50bc('0x11'))[_0x50bc('0x12')](socket);function respondWithRpcPromise(_0x1d4892,_0x2335ea,_0x3df8f3){return new BPromise(function(_0x34ccba,_0x45c26a){return client[_0x50bc('0x13')](_0x1d4892,_0x3df8f3)[_0x50bc('0x14')](function(_0x1aeedf){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2335ea,_0x50bc('0x15'));logger[_0x50bc('0x16')](_0x50bc('0x17'),_0x2335ea,'request\x20sent',JSON[_0x50bc('0x18')](_0x1aeedf));if(_0x1aeedf[_0x50bc('0x19')]){if(_0x1aeedf[_0x50bc('0x19')][_0x50bc('0x1a')]===0x1f4){logger[_0x50bc('0x19')](_0x50bc('0x1b'),_0x2335ea,_0x1aeedf[_0x50bc('0x19')][_0x50bc('0x1c')]);return _0x45c26a(_0x1aeedf[_0x50bc('0x19')][_0x50bc('0x1c')]);}logger[_0x50bc('0x19')](_0x50bc('0x1b'),_0x2335ea,_0x1aeedf[_0x50bc('0x19')]['message']);return _0x34ccba(_0x1aeedf[_0x50bc('0x19')]['message']);}else{logger['info'](_0x50bc('0x1b'),_0x2335ea,_0x50bc('0x15'));_0x34ccba(_0x1aeedf['result'][_0x50bc('0x1c')]);}})[_0x50bc('0x1d')](function(_0x26f8dc){logger[_0x50bc('0x19')](_0x50bc('0x1b'),_0x2335ea,_0x26f8dc);_0x45c26a(_0x26f8dc);});});}exports['GetVoiceQueueRtPauses']=function(_0x4551dd){var _0x200540=this;return new Promise(function(_0x205e62,_0x3bd004){return db['UserVoiceQueueRt']['findAll']({'raw':_0x4551dd[_0x50bc('0x1e')]?_0x4551dd['options'][_0x50bc('0x1f')]===undefined?!![]:![]:!![],'where':_0x4551dd[_0x50bc('0x1e')]?_0x4551dd[_0x50bc('0x1e')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x50bc('0x20'),db[_0x50bc('0x21')]['fn']('IF',db[_0x50bc('0x21')]['literal'](_0x50bc('0x22')))),_0x50bc('0x23')]]})[_0x50bc('0x14')](function(_0x33476e){logger[_0x50bc('0x24')]('GetVoiceQueueRtPauses',_0x4551dd);logger[_0x50bc('0x16')](_0x50bc('0x25'),_0x4551dd,JSON['stringify'](_0x33476e));_0x205e62(_0x33476e);})[_0x50bc('0x1d')](function(_0x4774d3){logger['error'](_0x50bc('0x25'),_0x4774d3[_0x50bc('0x1c')],_0x4551dd);_0x3bd004(_0x200540[_0x50bc('0x19')](0x1f4,_0x4774d3[_0x50bc('0x1c')]));});});}; \ No newline at end of file +var _0xee5c=['UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','outboundQueuePauses','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info'];(function(_0x3a1f64,_0x52667f){var _0x1daa45=function(_0xd93a48){while(--_0xd93a48){_0x3a1f64['push'](_0x3a1f64['shift']());}};_0x1daa45(++_0x52667f);}(_0xee5c,0x142));var _0xcee5=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0xee5c[_0x36feb2];return _0x292b43;};'use strict';var _=require('lodash');var util=require(_0xcee5('0x0'));var moment=require('moment');var BPromise=require(_0xcee5('0x1'));var rs=require(_0xcee5('0x2'));var fs=require('fs');var Redis=require(_0xcee5('0x3'));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});config[_0xcee5('0xc')]=_[_0xcee5('0xd')](config['redis'],{'host':_0xcee5('0xe'),'port':0x18eb});var socket=require(_0xcee5('0xf'))(new Redis(config[_0xcee5('0xc')]));require(_0xcee5('0x10'))[_0xcee5('0x11')](socket);function respondWithRpcPromise(_0x417a6f,_0x2c37b9,_0x33bc89){return new BPromise(function(_0x382a68,_0x51f373){return client['request'](_0x417a6f,_0x33bc89)[_0xcee5('0x12')](function(_0x3b954e){logger[_0xcee5('0x13')](_0xcee5('0x14'),_0x2c37b9,_0xcee5('0x15'));logger[_0xcee5('0x16')](_0xcee5('0x17'),_0x2c37b9,'request\x20sent',JSON['stringify'](_0x3b954e));if(_0x3b954e[_0xcee5('0x18')]){if(_0x3b954e['error'][_0xcee5('0x19')]===0x1f4){logger[_0xcee5('0x18')](_0xcee5('0x14'),_0x2c37b9,_0x3b954e['error']['message']);return _0x51f373(_0x3b954e[_0xcee5('0x18')][_0xcee5('0x1a')]);}logger['error'](_0xcee5('0x14'),_0x2c37b9,_0x3b954e[_0xcee5('0x18')][_0xcee5('0x1a')]);return _0x382a68(_0x3b954e[_0xcee5('0x18')][_0xcee5('0x1a')]);}else{logger['info'](_0xcee5('0x14'),_0x2c37b9,_0xcee5('0x15'));_0x382a68(_0x3b954e['result']['message']);}})[_0xcee5('0x1b')](function(_0x39f39b){logger[_0xcee5('0x18')](_0xcee5('0x14'),_0x2c37b9,_0x39f39b);_0x51f373(_0x39f39b);});});}exports[_0xcee5('0x1c')]=function(_0x41ef45){var _0x303099=this;return new Promise(function(_0x38bd2b,_0x3a8bb3){return db[_0xcee5('0x1d')][_0xcee5('0x1e')]({'raw':_0x41ef45[_0xcee5('0x1f')]?_0x41ef45['options']['raw']===undefined?!![]:![]:!![],'where':_0x41ef45['options']?_0x41ef45[_0xcee5('0x1f')][_0xcee5('0x20')]||null:null,'attributes':[[db[_0xcee5('0x21')]['fn'](_0xcee5('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0xcee5('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0xcee5('0x24')]]})[_0xcee5('0x12')](function(_0x2ca75b){logger[_0xcee5('0x13')](_0xcee5('0x1c'),_0x41ef45);logger[_0xcee5('0x16')](_0xcee5('0x1c'),_0x41ef45,JSON[_0xcee5('0x25')](_0x2ca75b));_0x38bd2b(_0x2ca75b);})[_0xcee5('0x1b')](function(_0x5587b2){logger['error'](_0xcee5('0x1c'),_0x5587b2[_0xcee5('0x1a')],_0x41ef45);_0x3a8bb3(_0x303099['error'](0x1f4,_0x5587b2[_0xcee5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 7514cef..d87964c 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 _0xc949=['userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener','register','length'];(function(_0x24817f,_0x2a1aae){var _0x56bf59=function(_0x26321a){while(--_0x26321a){_0x24817f['push'](_0x24817f['shift']());}};_0x56bf59(++_0x2a1aae);}(_0xc949,0x181));var _0x9c94=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xc949[_0x5b78e8];return _0xf2c321;};'use strict';var UserVoiceQueueRtEvents=require(_0x9c94('0x0'));var events=['save',_0x9c94('0x1'),_0x9c94('0x2')];function createListener(_0x209cd8,_0x27613f){return function(_0x54facf){_0x27613f[_0x9c94('0x3')](_0x209cd8,_0x54facf);};}function removeListener(_0x231762,_0x528a17){return function(){UserVoiceQueueRtEvents[_0x9c94('0x4')](_0x231762,_0x528a17);};}exports[_0x9c94('0x5')]=function(_0x46d560){for(var _0x1357ac=0x0,_0x57fcd7=events[_0x9c94('0x6')];_0x1357ac<_0x57fcd7;_0x1357ac++){var _0x360e7b=events[_0x1357ac];var _0x25ecd0=createListener(_0x9c94('0x7')+_0x360e7b,_0x46d560);UserVoiceQueueRtEvents['on'](_0x360e7b,_0x25ecd0);}}; \ No newline at end of file +var _0xe647=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','removeListener','register','length'];(function(_0x1f5f25,_0x897434){var _0x2595c2=function(_0x3a1a0b){while(--_0x3a1a0b){_0x1f5f25['push'](_0x1f5f25['shift']());}};_0x2595c2(++_0x897434);}(_0xe647,0x16d));var _0x7e64=function(_0x4b8dd2,_0x24b7ad){_0x4b8dd2=_0x4b8dd2-0x0;var _0xf2260f=_0xe647[_0x4b8dd2];return _0xf2260f;};'use strict';var UserVoiceQueueRtEvents=require(_0x7e64('0x0'));var events=[_0x7e64('0x1'),'remove',_0x7e64('0x2')];function createListener(_0x3b3e4f,_0x4518cd){return function(_0x534f46){_0x4518cd['emit'](_0x3b3e4f,_0x534f46);};}function removeListener(_0x7ed710,_0x2e00b0){return function(){UserVoiceQueueRtEvents[_0x7e64('0x3')](_0x7ed710,_0x2e00b0);};}exports[_0x7e64('0x4')]=function(_0x221235){for(var _0x552ed3=0x0,_0x21db8f=events[_0x7e64('0x5')];_0x552ed3<_0x21db8f;_0x552ed3++){var _0x43039e=events[_0x552ed3];var _0x3e8771=createListener(_0x7e64('0x6')+_0x43039e,_0x221235);UserVoiceQueueRtEvents['on'](_0x43039e,_0x3e8771);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 0f4782e..e8b131d 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x19223d,_0x4a5a7a){var _0x33e726=function(_0xe3bdca){while(--_0xe3bdca){_0x19223d['push'](_0x19223d['shift']());}};_0x33e726(++_0x4a5a7a);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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(_0x89b700,_0x255afb){var _0x578428=function(_0x5317c1){while(--_0x5317c1){_0x89b700['push'](_0x89b700['shift']());}};_0x578428(++_0x255afb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0xcb91[_0x2afbb0];return _0x411ff2;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1b8331e..a2762ec 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 _0x7c24=['sequelize','exports','INTEGER'];(function(_0x157345,_0xaf9f1c){var _0x5c04ea=function(_0x51c78d){while(--_0x51c78d){_0x157345['push'](_0x157345['shift']());}};_0x5c04ea(++_0xaf9f1c);}(_0x7c24,0x186));var _0x47c2=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7c24[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0x47c2('0x0'));module[_0x47c2('0x1')]={'penalty':{'type':Sequelize[_0x47c2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x03d4=['exports','INTEGER','sequelize'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x03d4,0x18e));var _0x403d=function(_0x17e6e4,_0x347d52){_0x17e6e4=_0x17e6e4-0x0;var _0xafd26f=_0x03d4[_0x17e6e4];return _0xafd26f;};'use strict';var Sequelize=require(_0x403d('0x0'));module[_0x403d('0x1')]={'penalty':{'type':Sequelize[_0x403d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 93fd1ff..60225dc 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 _0xce51=['./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x155642,_0x183ce4){var _0x14177d=function(_0x15a83c){while(--_0x15a83c){_0x155642['push'](_0x155642['shift']());}};_0x14177d(++_0x183ce4);}(_0xce51,0xd7));var _0x1ce5=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0xce51[_0x28509b];return _0x1e0b6;};'use strict';var _=require(_0x1ce5('0x0'));var util=require('util');var logger=require(_0x1ce5('0x1'))(_0x1ce5('0x2'));var moment=require(_0x1ce5('0x3'));var BPromise=require(_0x1ce5('0x4'));var rp=require(_0x1ce5('0x5'));var fs=require('fs');var path=require(_0x1ce5('0x6'));var rimraf=require(_0x1ce5('0x7'));var config=require(_0x1ce5('0x8'));var attributes=require(_0x1ce5('0x9'));module[_0x1ce5('0xa')]=function(_0x292a4e,_0xe179cd){return _0x292a4e[_0x1ce5('0xb')](_0x1ce5('0xc'),attributes,{'tableName':_0x1ce5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8363=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','lodash','util','../../config/logger'];(function(_0x2bf8c0,_0x53f4e8){var _0x247e68=function(_0xf7461b){while(--_0xf7461b){_0x2bf8c0['push'](_0x2bf8c0['shift']());}};_0x247e68(++_0x53f4e8);}(_0x8363,0x8d));var _0x3836=function(_0x4d55a6,_0x16f460){_0x4d55a6=_0x4d55a6-0x0;var _0x158b2d=_0x8363[_0x4d55a6];return _0x158b2d;};'use strict';var _=require(_0x3836('0x0'));var util=require(_0x3836('0x1'));var logger=require(_0x3836('0x2'))('api');var moment=require(_0x3836('0x3'));var BPromise=require(_0x3836('0x4'));var rp=require(_0x3836('0x5'));var fs=require('fs');var path=require(_0x3836('0x6'));var rimraf=require(_0x3836('0x7'));var config=require(_0x3836('0x8'));var attributes=require('./userWhatsappQueue.attributes');module[_0x3836('0x9')]=function(_0x53aba9,_0xb21f){return _0x53aba9[_0x3836('0xa')](_0x3836('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 5a05ab9..3154109 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 _0x90fb=['code','message','result','catch','UserWhatsappQueue,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x18d7ae,_0x17a05a){var _0x498035=function(_0x35c6e7){while(--_0x35c6e7){_0x18d7ae['push'](_0x18d7ae['shift']());}};_0x498035(++_0x17a05a);}(_0x90fb,0x1e8));var _0xb90f=function(_0x42af3a,_0x2aafb9){_0x42af3a=_0x42af3a-0x0;var _0x14d099=_0x90fb[_0x42af3a];return _0x14d099;};'use strict';var _=require(_0xb90f('0x0'));var util=require(_0xb90f('0x1'));var moment=require(_0xb90f('0x2'));var BPromise=require(_0xb90f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb90f('0x4'));var db=require(_0xb90f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb90f('0x6'))(_0xb90f('0x7'));var config=require(_0xb90f('0x8'));var jayson=require(_0xb90f('0x9'));var client=jayson[_0xb90f('0xa')][_0xb90f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4051d1,_0xa01c89,_0x3d6a3a){return new BPromise(function(_0x34d635,_0x53f358){return client[_0xb90f('0xc')](_0x4051d1,_0x3d6a3a)['then'](function(_0x1a6ae7){logger[_0xb90f('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0xa01c89,_0xb90f('0xe'));logger['debug'](_0xb90f('0xf'),_0xa01c89,'request\x20sent',JSON[_0xb90f('0x10')](_0x1a6ae7));if(_0x1a6ae7[_0xb90f('0x11')]){if(_0x1a6ae7[_0xb90f('0x11')][_0xb90f('0x12')]===0x1f4){logger[_0xb90f('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0xa01c89,_0x1a6ae7[_0xb90f('0x11')][_0xb90f('0x13')]);return _0x53f358(_0x1a6ae7[_0xb90f('0x11')][_0xb90f('0x13')]);}logger[_0xb90f('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0xa01c89,_0x1a6ae7['error']['message']);return _0x34d635(_0x1a6ae7[_0xb90f('0x11')][_0xb90f('0x13')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0xa01c89,_0xb90f('0xe'));_0x34d635(_0x1a6ae7[_0xb90f('0x14')]['message']);}})[_0xb90f('0x15')](function(_0x1980e0){logger[_0xb90f('0x11')](_0xb90f('0x16'),_0xa01c89,_0x1980e0);_0x53f358(_0x1980e0);});});} \ No newline at end of file +var _0xfd52=['result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x39ca31,_0x29f730){var _0x2c87df=function(_0x136c05){while(--_0x136c05){_0x39ca31['push'](_0x39ca31['shift']());}};_0x2c87df(++_0x29f730);}(_0xfd52,0x110));var _0x2fd5=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xfd52[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x2fd5('0x0'));var util=require('util');var moment=require(_0x2fd5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fd5('0x2'));var db=require(_0x2fd5('0x3'))['db'];var utils=require(_0x2fd5('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2fd5('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xac0f0c,_0xfaea84,_0x1233b0){return new BPromise(function(_0x5a9583,_0x112ab7){return client[_0x2fd5('0x6')](_0xac0f0c,_0x1233b0)['then'](function(_0x4c1c52){logger[_0x2fd5('0x7')](_0x2fd5('0x8'),_0xfaea84,_0x2fd5('0x9'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0xfaea84,_0x2fd5('0x9'),JSON['stringify'](_0x4c1c52));if(_0x4c1c52[_0x2fd5('0xa')]){if(_0x4c1c52['error'][_0x2fd5('0xb')]===0x1f4){logger[_0x2fd5('0xa')](_0x2fd5('0x8'),_0xfaea84,_0x4c1c52[_0x2fd5('0xa')][_0x2fd5('0xc')]);return _0x112ab7(_0x4c1c52['error']['message']);}logger[_0x2fd5('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0xfaea84,_0x4c1c52['error'][_0x2fd5('0xc')]);return _0x5a9583(_0x4c1c52[_0x2fd5('0xa')][_0x2fd5('0xc')]);}else{logger['info'](_0x2fd5('0x8'),_0xfaea84,_0x2fd5('0x9'));_0x5a9583(_0x4c1c52[_0x2fd5('0xd')]['message']);}})[_0x2fd5('0xe')](function(_0x381774){logger[_0x2fd5('0xa')](_0x2fd5('0x8'),_0xfaea84,_0x381774);_0x112ab7(_0x381774);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 4b92787..c6c7beb 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 _0xfa2b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','multer'];(function(_0x2d61be,_0x47f1e4){var _0x3ea3a8=function(_0x396523){while(--_0x396523){_0x2d61be['push'](_0x2d61be['shift']());}};_0x3ea3a8(++_0x47f1e4);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x4fd60e,_0x2bca3c){_0x4fd60e=_0x4fd60e-0x0;var _0x49c73a=_0xfa2b[_0x4fd60e];return _0x49c73a;};'use strict';var multer=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var path=require(_0xbfa2('0x2'));var timeout=require(_0xbfa2('0x3'));var express=require(_0xbfa2('0x4'));var router=express[_0xbfa2('0x5')]();var fs_extra=require(_0xbfa2('0x6'));var auth=require(_0xbfa2('0x7'));var interaction=require(_0xbfa2('0x8'));var config=require(_0xbfa2('0x9'));var controller=require(_0xbfa2('0xa'));router[_0xbfa2('0xb')]('/',auth[_0xbfa2('0xc')](),controller[_0xbfa2('0xd')]);router[_0xbfa2('0xb')](_0xbfa2('0xe'),auth['isAuthenticated'](),controller[_0xbfa2('0xf')]);router['post']('/',auth[_0xbfa2('0xc')](),controller[_0xbfa2('0x10')]);router[_0xbfa2('0x11')](_0xbfa2('0xe'),auth[_0xbfa2('0xc')](),controller[_0xbfa2('0x12')]);router[_0xbfa2('0x13')](_0xbfa2('0xe'),auth[_0xbfa2('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7868=['index','/:id','show','post','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x5f3a04,_0x3a801b){var _0x594d0b=function(_0x160e09){while(--_0x160e09){_0x5f3a04['push'](_0x5f3a04['shift']());}};_0x594d0b(++_0x3a801b);}(_0x7868,0x1c0));var _0x8786=function(_0x1cd82c,_0x45a949){_0x1cd82c=_0x1cd82c-0x0;var _0x478ffc=_0x7868[_0x1cd82c];return _0x478ffc;};'use strict';var multer=require(_0x8786('0x0'));var util=require('util');var path=require(_0x8786('0x1'));var timeout=require(_0x8786('0x2'));var express=require(_0x8786('0x3'));var router=express[_0x8786('0x4')]();var fs_extra=require(_0x8786('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8786('0x6'));var config=require(_0x8786('0x7'));var controller=require(_0x8786('0x8'));router[_0x8786('0x9')]('/',auth[_0x8786('0xa')](),controller[_0x8786('0xb')]);router[_0x8786('0x9')](_0x8786('0xc'),auth[_0x8786('0xa')](),controller[_0x8786('0xd')]);router[_0x8786('0xe')]('/',auth[_0x8786('0xa')](),controller['create']);router['put'](_0x8786('0xc'),auth[_0x8786('0xa')](),controller[_0x8786('0xf')]);router['delete']('/:id',auth[_0x8786('0xa')](),controller['destroy']);module[_0x8786('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 1182f8e..e1f3773 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 _0xc37e=['STRING','name'];(function(_0x288ccd,_0x4c1b69){var _0x3b074a=function(_0x2ea0d4){while(--_0x2ea0d4){_0x288ccd['push'](_0x288ccd['shift']());}};_0x3b074a(++_0x4c1b69);}(_0xc37e,0xfd));var _0xec37=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xc37e[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xec37('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xec37('0x1')]}}; \ No newline at end of file +var _0xe5e0=['exports','STRING','name','sequelize'];(function(_0x51916e,_0x1c627e){var _0x450daf=function(_0x41e021){while(--_0x41e021){_0x51916e['push'](_0x51916e['shift']());}};_0x450daf(++_0x1c627e);}(_0xe5e0,0x123));var _0x0e5e=function(_0x55cdc7,_0x112c06){_0x55cdc7=_0x55cdc7-0x0;var _0x29d00d=_0xe5e0[_0x55cdc7];return _0x29d00d;};'use strict';var Sequelize=require(_0x0e5e('0x0'));module[_0x0e5e('0x1')]={'name':{'type':Sequelize[_0x0e5e('0x2')],'unique':_0x0e5e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0e5e('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c7fbebc..2049b7b 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 _0x72f9=['../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','name','index','map','Variable','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x72f9,0x1c3));var _0x972f=function(_0x3a6194,_0x4574e2){_0x3a6194=_0x3a6194-0x0;var _0x298116=_0x72f9[_0x3a6194];return _0x298116;};'use strict';var emlformat=require(_0x972f('0x0'));var rimraf=require(_0x972f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x972f('0x2'));var rp=require('request-promise');var moment=require(_0x972f('0x3'));var BPromise=require(_0x972f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x972f('0x5'));var sox=require('sox');var csv=require(_0x972f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x972f('0x7'));var jsforce=require(_0x972f('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x972f('0x6'));var querystring=require(_0x972f('0x9'));var Papa=require(_0x972f('0xa'));var Redis=require(_0x972f('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x972f('0xc'));var as=require(_0x972f('0xd'));var hardwareService=require(_0x972f('0xe'));var logger=require(_0x972f('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x972f('0x10'));var licenseUtil=require(_0x972f('0x11'));var db=require(_0x972f('0x12'))['db'];function respondWithStatusCode(_0x2a335e,_0x112bbb){_0x112bbb=_0x112bbb||0xcc;return function(_0xe3d29d){if(_0xe3d29d){return _0x2a335e[_0x972f('0x13')](_0x112bbb);}return _0x2a335e['status'](_0x112bbb)[_0x972f('0x14')]();};}function respondWithResult(_0x1b5384,_0x34ac4e){_0x34ac4e=_0x34ac4e||0xc8;return function(_0x26bcd1){if(_0x26bcd1){return _0x1b5384['status'](_0x34ac4e)[_0x972f('0x15')](_0x26bcd1);}};}function respondWithFilteredResult(_0x37a120,_0x561175){return function(_0x298f37){if(_0x298f37){var _0x2b52cf=typeof _0x561175['offset']===_0x972f('0x16')&&typeof _0x561175[_0x972f('0x17')]===_0x972f('0x16');var _0x41281c=_0x298f37[_0x972f('0x18')];var _0x5f79e1=_0x2b52cf?0x0:_0x561175[_0x972f('0x19')];var _0x36764b=_0x2b52cf?_0x298f37[_0x972f('0x18')]:_0x561175[_0x972f('0x19')]+_0x561175[_0x972f('0x17')];var _0x5a29d9;if(_0x36764b>=_0x41281c){_0x36764b=_0x41281c;_0x5a29d9=0xc8;}else{_0x5a29d9=0xce;}_0x37a120[_0x972f('0x1a')](_0x5a29d9);return _0x37a120[_0x972f('0x1b')](_0x972f('0x1c'),_0x5f79e1+'-'+_0x36764b+'/'+_0x41281c)[_0x972f('0x15')](_0x298f37);}return null;};}function patchUpdates(_0x49ad8f){return function(_0xfdb87a){try{jsonpatch[_0x972f('0x1d')](_0xfdb87a,_0x49ad8f,!![]);}catch(_0x51d7fd){return BPromise['reject'](_0x51d7fd);}return _0xfdb87a[_0x972f('0x1e')]();};}function saveUpdates(_0x42b0f8,_0x24cd5f){return function(_0x4c0556){if(_0x4c0556){return _0x4c0556[_0x972f('0x1f')](_0x42b0f8)[_0x972f('0x20')](function(_0x255996){return _0x255996;});}return null;};}function removeEntity(_0x138fba,_0x5d1b34){return function(_0x2fa0ad){if(_0x2fa0ad){return _0x2fa0ad[_0x972f('0x21')]()[_0x972f('0x20')](function(){var _0x170d0e=_0x2fa0ad[_0x972f('0x22')]({'plain':!![]});var _0x34a957=_0x972f('0x23');return db[_0x972f('0x24')][_0x972f('0x21')]({'where':{'type':_0x34a957,'resourceId':_0x170d0e['id']}})[_0x972f('0x20')](function(){return _0x2fa0ad;});})[_0x972f('0x20')](function(){_0x138fba[_0x972f('0x1a')](0xcc)[_0x972f('0x14')]();});}};}function handleEntityNotFound(_0x16f97e,_0x333463){return function(_0x6d2dd1){if(!_0x6d2dd1){_0x16f97e['sendStatus'](0x194);}return _0x6d2dd1;};}function handleError(_0x466852,_0x490fee){_0x490fee=_0x490fee||0x1f4;return function(_0x3368d9){logger[_0x972f('0x25')](_0x3368d9['stack']);if(_0x3368d9[_0x972f('0x26')]){delete _0x3368d9[_0x972f('0x26')];}_0x466852['status'](_0x490fee)['send'](_0x3368d9);};}exports[_0x972f('0x27')]=function(_0x399c09,_0xad1ce8){var _0x5f5beb={},_0x4fa279={},_0x1f2675={'count':0x0,'rows':[]};var _0x3a3b7a=_[_0x972f('0x28')](db[_0x972f('0x29')][_0x972f('0x2a')],function(_0x2d0019){return{'name':_0x2d0019[_0x972f('0x2b')],'type':_0x2d0019[_0x972f('0x2c')][_0x972f('0x2d')]};});_0x4fa279[_0x972f('0x2e')]=_[_0x972f('0x28')](_0x3a3b7a,_0x972f('0x26'));_0x4fa279['query']=_['keys'](_0x399c09['query']);_0x4fa279[_0x972f('0x2f')]=_[_0x972f('0x30')](_0x4fa279[_0x972f('0x2e')],_0x4fa279[_0x972f('0x31')]);_0x5f5beb[_0x972f('0x32')]=_[_0x972f('0x30')](_0x4fa279['model'],qs['fields'](_0x399c09[_0x972f('0x31')]['fields']));_0x5f5beb[_0x972f('0x32')]=_0x5f5beb['attributes'][_0x972f('0x33')]?_0x5f5beb['attributes']:_0x4fa279[_0x972f('0x2e')];if(!_0x399c09[_0x972f('0x31')][_0x972f('0x34')](_0x972f('0x35'))){_0x5f5beb[_0x972f('0x17')]=qs['limit'](_0x399c09[_0x972f('0x31')][_0x972f('0x17')]);_0x5f5beb[_0x972f('0x19')]=qs[_0x972f('0x19')](_0x399c09['query'][_0x972f('0x19')]);}_0x5f5beb[_0x972f('0x36')]=qs[_0x972f('0x37')](_0x399c09[_0x972f('0x31')][_0x972f('0x37')]);_0x5f5beb[_0x972f('0x38')]=qs['filters'](_['pick'](_0x399c09[_0x972f('0x31')],_0x4fa279[_0x972f('0x2f')]),_0x3a3b7a);if(_0x399c09[_0x972f('0x31')][_0x972f('0x39')]){_0x5f5beb[_0x972f('0x38')]=_[_0x972f('0x3a')](_0x5f5beb['where'],{'$or':_[_0x972f('0x28')](_0x3a3b7a,function(_0x29ac97){if(_0x29ac97['type']!==_0x972f('0x3b')){var _0x185b9b={};_0x185b9b[_0x29ac97[_0x972f('0x26')]]={'$like':'%'+_0x399c09['query'][_0x972f('0x39')]+'%'};return _0x185b9b;}})});}_0x5f5beb=_[_0x972f('0x3a')]({},_0x5f5beb,_0x399c09[_0x972f('0x3c')]);var _0x28f6ef={'where':_0x5f5beb[_0x972f('0x38')]};return db[_0x972f('0x29')][_0x972f('0x18')](_0x28f6ef)['then'](function(_0x320d1b){_0x1f2675['count']=_0x320d1b;if(_0x399c09[_0x972f('0x31')][_0x972f('0x3d')]){_0x5f5beb[_0x972f('0x3e')]=[{'all':!![]}];}return db[_0x972f('0x29')][_0x972f('0x3f')](_0x5f5beb);})[_0x972f('0x20')](function(_0xea9d3e){_0x1f2675[_0x972f('0x40')]=_0xea9d3e;return _0x1f2675;})[_0x972f('0x20')](respondWithFilteredResult(_0xad1ce8,_0x5f5beb))[_0x972f('0x41')](handleError(_0xad1ce8,null));};exports['show']=function(_0x2b9b1e,_0x43bcc3){var _0x44f75c={'raw':!![],'where':{'id':_0x2b9b1e[_0x972f('0x42')]['id']}},_0x175446={};_0x175446[_0x972f('0x2e')]=_['keys'](db[_0x972f('0x29')][_0x972f('0x2a')]);_0x175446[_0x972f('0x31')]=_[_0x972f('0x43')](_0x2b9b1e[_0x972f('0x31')]);_0x175446[_0x972f('0x2f')]=_[_0x972f('0x30')](_0x175446[_0x972f('0x2e')],_0x175446[_0x972f('0x31')]);_0x44f75c[_0x972f('0x32')]=_[_0x972f('0x30')](_0x175446['model'],qs[_0x972f('0x44')](_0x2b9b1e['query'][_0x972f('0x44')]));_0x44f75c[_0x972f('0x32')]=_0x44f75c[_0x972f('0x32')][_0x972f('0x33')]?_0x44f75c['attributes']:_0x175446['model'];if(_0x2b9b1e[_0x972f('0x31')][_0x972f('0x3d')]){_0x44f75c['include']=[{'all':!![]}];}_0x44f75c=_[_0x972f('0x3a')]({},_0x44f75c,_0x2b9b1e[_0x972f('0x3c')]);return db[_0x972f('0x29')][_0x972f('0x45')](_0x44f75c)['then'](handleEntityNotFound(_0x43bcc3,null))[_0x972f('0x20')](respondWithResult(_0x43bcc3,null))[_0x972f('0x41')](handleError(_0x43bcc3,null));};exports[_0x972f('0x46')]=function(_0x423c06,_0xd84bc7){return db[_0x972f('0x29')][_0x972f('0x46')](_0x423c06[_0x972f('0x47')],{})[_0x972f('0x20')](function(_0x507f4b){var _0x29c76c=_0x423c06[_0x972f('0x48')][_0x972f('0x22')]({'plain':!![]});if(!_0x29c76c)throw new Error(_0x972f('0x49'));if(_0x29c76c[_0x972f('0x4a')]===_0x972f('0x48')){var _0x23b801=_0x507f4b[_0x972f('0x22')]({'plain':!![]});var _0xfcfbfa=_0x972f('0x23');return db[_0x972f('0x4b')]['find']({'where':{'name':_0xfcfbfa,'userProfileId':_0x29c76c[_0x972f('0x4c')]},'raw':!![]})[_0x972f('0x20')](function(_0x817a63){if(_0x817a63&&_0x817a63['autoAssociation']===0x0){return db[_0x972f('0x24')]['create']({'name':_0x23b801[_0x972f('0x26')],'resourceId':_0x23b801['id'],'type':_0x817a63['name'],'sectionId':_0x817a63['id']},{})['then'](function(){return _0x507f4b;});}else{return _0x507f4b;}})[_0x972f('0x41')](function(_0x496752){logger[_0x972f('0x25')](_0x972f('0x4d'),_0x496752);throw _0x496752;});}return _0x507f4b;})[_0x972f('0x20')](respondWithResult(_0xd84bc7,0xc9))[_0x972f('0x41')](handleError(_0xd84bc7,null));};exports['update']=function(_0x2618e9,_0x1441e3){if(_0x2618e9[_0x972f('0x47')]['id']){delete _0x2618e9[_0x972f('0x47')]['id'];}return db['Variable'][_0x972f('0x45')]({'where':{'id':_0x2618e9[_0x972f('0x42')]['id']}})[_0x972f('0x20')](handleEntityNotFound(_0x1441e3,null))[_0x972f('0x20')](saveUpdates(_0x2618e9[_0x972f('0x47')],null))[_0x972f('0x20')](respondWithResult(_0x1441e3,null))[_0x972f('0x41')](handleError(_0x1441e3,null));};exports[_0x972f('0x21')]=function(_0x2b6d10,_0x5d200b){return db[_0x972f('0x29')][_0x972f('0x45')]({'where':{'id':_0x2b6d10['params']['id']}})[_0x972f('0x20')](handleEntityNotFound(_0x5d200b,null))['then'](removeEntity(_0x5d200b,null))[_0x972f('0x41')](handleError(_0x5d200b,null));}; \ No newline at end of file +var _0x272e=['then','get','UserProfileResource','destroy','name','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update'];(function(_0x3f7094,_0x4297eb){var _0x4bbedc=function(_0x422c01){while(--_0x422c01){_0x3f7094['push'](_0x3f7094['shift']());}};_0x4bbedc(++_0x4297eb);}(_0x272e,0x181));var _0xe272=function(_0x649717,_0x5183d4){_0x649717=_0x649717-0x0;var _0x36e211=_0x272e[_0x649717];return _0x36e211;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe272('0x0'));var zipdir=require(_0xe272('0x1'));var jsonpatch=require(_0xe272('0x2'));var rp=require(_0xe272('0x3'));var moment=require('moment');var BPromise=require(_0xe272('0x4'));var Mustache=require(_0xe272('0x5'));var util=require(_0xe272('0x6'));var path=require(_0xe272('0x7'));var sox=require(_0xe272('0x8'));var csv=require(_0xe272('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe272('0xa'));var _=require(_0xe272('0xb'));var squel=require(_0xe272('0xc'));var crypto=require(_0xe272('0xd'));var jsforce=require(_0xe272('0xe'));var deskjs=require(_0xe272('0xf'));var toCsv=require(_0xe272('0x9'));var querystring=require(_0xe272('0x10'));var Papa=require(_0xe272('0x11'));var Redis=require(_0xe272('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe272('0x13'));var as=require(_0xe272('0x14'));var hardwareService=require(_0xe272('0x15'));var logger=require(_0xe272('0x16'))(_0xe272('0x17'));var utils=require(_0xe272('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe272('0x19'));var db=require(_0xe272('0x1a'))['db'];function respondWithStatusCode(_0x479b3d,_0x3fb850){_0x3fb850=_0x3fb850||0xcc;return function(_0xec426c){if(_0xec426c){return _0x479b3d[_0xe272('0x1b')](_0x3fb850);}return _0x479b3d[_0xe272('0x1c')](_0x3fb850)[_0xe272('0x1d')]();};}function respondWithResult(_0xbf1776,_0x2276d6){_0x2276d6=_0x2276d6||0xc8;return function(_0x36b63c){if(_0x36b63c){return _0xbf1776['status'](_0x2276d6)['json'](_0x36b63c);}};}function respondWithFilteredResult(_0xc57be9,_0x274d8f){return function(_0x1847d2){if(_0x1847d2){var _0x321192=typeof _0x274d8f[_0xe272('0x1e')]===_0xe272('0x1f')&&typeof _0x274d8f[_0xe272('0x20')]===_0xe272('0x1f');var _0x5974ae=_0x1847d2[_0xe272('0x21')];var _0x4a3b57=_0x321192?0x0:_0x274d8f['offset'];var _0x1e8c11=_0x321192?_0x1847d2[_0xe272('0x21')]:_0x274d8f[_0xe272('0x1e')]+_0x274d8f[_0xe272('0x20')];var _0x38779f;if(_0x1e8c11>=_0x5974ae){_0x1e8c11=_0x5974ae;_0x38779f=0xc8;}else{_0x38779f=0xce;}_0xc57be9['status'](_0x38779f);return _0xc57be9[_0xe272('0x22')](_0xe272('0x23'),_0x4a3b57+'-'+_0x1e8c11+'/'+_0x5974ae)[_0xe272('0x24')](_0x1847d2);}return null;};}function patchUpdates(_0x121705){return function(_0x533105){try{jsonpatch[_0xe272('0x25')](_0x533105,_0x121705,!![]);}catch(_0x59b24a){return BPromise['reject'](_0x59b24a);}return _0x533105[_0xe272('0x26')]();};}function saveUpdates(_0x23f3fb,_0x3311f7){return function(_0x3a84b4){if(_0x3a84b4){return _0x3a84b4[_0xe272('0x27')](_0x23f3fb)['then'](function(_0x2f9258){return _0x2f9258;});}return null;};}function removeEntity(_0x3570f1,_0x4554cf){return function(_0x384fa9){if(_0x384fa9){return _0x384fa9['destroy']()[_0xe272('0x28')](function(){var _0x26c95b=_0x384fa9[_0xe272('0x29')]({'plain':!![]});var _0x371845='Variables';return db[_0xe272('0x2a')][_0xe272('0x2b')]({'where':{'type':_0x371845,'resourceId':_0x26c95b['id']}})[_0xe272('0x28')](function(){return _0x384fa9;});})[_0xe272('0x28')](function(){_0x3570f1[_0xe272('0x1c')](0xcc)[_0xe272('0x1d')]();});}};}function handleEntityNotFound(_0x5a6469,_0x1f793d){return function(_0x16ba8b){if(!_0x16ba8b){_0x5a6469[_0xe272('0x1b')](0x194);}return _0x16ba8b;};}function handleError(_0x3801fc,_0x82a815){_0x82a815=_0x82a815||0x1f4;return function(_0x5a516e){logger['error'](_0x5a516e['stack']);if(_0x5a516e[_0xe272('0x2c')]){delete _0x5a516e['name'];}_0x3801fc[_0xe272('0x1c')](_0x82a815)['send'](_0x5a516e);};}exports[_0xe272('0x2d')]=function(_0x5622ab,_0x299cd4){var _0x44235a={},_0x352df8={},_0x49b2ec={'count':0x0,'rows':[]};var _0x4f790c=_[_0xe272('0x2e')](db[_0xe272('0x2f')][_0xe272('0x30')],function(_0x5c06d8){return{'name':_0x5c06d8[_0xe272('0x31')],'type':_0x5c06d8[_0xe272('0x32')][_0xe272('0x33')]};});_0x352df8[_0xe272('0x34')]=_[_0xe272('0x2e')](_0x4f790c,_0xe272('0x2c'));_0x352df8[_0xe272('0x35')]=_[_0xe272('0x36')](_0x5622ab[_0xe272('0x35')]);_0x352df8[_0xe272('0x37')]=_['intersection'](_0x352df8[_0xe272('0x34')],_0x352df8[_0xe272('0x35')]);_0x44235a['attributes']=_['intersection'](_0x352df8[_0xe272('0x34')],qs[_0xe272('0x38')](_0x5622ab[_0xe272('0x35')][_0xe272('0x38')]));_0x44235a[_0xe272('0x39')]=_0x44235a[_0xe272('0x39')]['length']?_0x44235a[_0xe272('0x39')]:_0x352df8[_0xe272('0x34')];if(!_0x5622ab[_0xe272('0x35')][_0xe272('0x3a')](_0xe272('0x3b'))){_0x44235a[_0xe272('0x20')]=qs[_0xe272('0x20')](_0x5622ab['query'][_0xe272('0x20')]);_0x44235a[_0xe272('0x1e')]=qs[_0xe272('0x1e')](_0x5622ab[_0xe272('0x35')][_0xe272('0x1e')]);}_0x44235a['order']=qs[_0xe272('0x3c')](_0x5622ab[_0xe272('0x35')][_0xe272('0x3c')]);_0x44235a[_0xe272('0x3d')]=qs[_0xe272('0x37')](_[_0xe272('0x3e')](_0x5622ab[_0xe272('0x35')],_0x352df8[_0xe272('0x37')]),_0x4f790c);if(_0x5622ab[_0xe272('0x35')]['filter']){_0x44235a['where']=_[_0xe272('0x3f')](_0x44235a[_0xe272('0x3d')],{'$or':_[_0xe272('0x2e')](_0x4f790c,function(_0x3e9fcd){if(_0x3e9fcd[_0xe272('0x32')]!=='VIRTUAL'){var _0x5d79bc={};_0x5d79bc[_0x3e9fcd[_0xe272('0x2c')]]={'$like':'%'+_0x5622ab['query'][_0xe272('0x40')]+'%'};return _0x5d79bc;}})});}_0x44235a=_[_0xe272('0x3f')]({},_0x44235a,_0x5622ab[_0xe272('0x41')]);var _0x2acb85={'where':_0x44235a[_0xe272('0x3d')]};return db[_0xe272('0x2f')][_0xe272('0x21')](_0x2acb85)[_0xe272('0x28')](function(_0x3518b){_0x49b2ec[_0xe272('0x21')]=_0x3518b;if(_0x5622ab['query'][_0xe272('0x42')]){_0x44235a[_0xe272('0x43')]=[{'all':!![]}];}return db[_0xe272('0x2f')][_0xe272('0x44')](_0x44235a);})[_0xe272('0x28')](function(_0x1f3a6f){_0x49b2ec[_0xe272('0x45')]=_0x1f3a6f;return _0x49b2ec;})[_0xe272('0x28')](respondWithFilteredResult(_0x299cd4,_0x44235a))[_0xe272('0x46')](handleError(_0x299cd4,null));};exports[_0xe272('0x47')]=function(_0xa74e5d,_0x2cf20a){var _0x53420b={'raw':!![],'where':{'id':_0xa74e5d[_0xe272('0x48')]['id']}},_0xcb858d={};_0xcb858d[_0xe272('0x34')]=_[_0xe272('0x36')](db[_0xe272('0x2f')][_0xe272('0x30')]);_0xcb858d[_0xe272('0x35')]=_[_0xe272('0x36')](_0xa74e5d['query']);_0xcb858d[_0xe272('0x37')]=_[_0xe272('0x49')](_0xcb858d[_0xe272('0x34')],_0xcb858d[_0xe272('0x35')]);_0x53420b['attributes']=_[_0xe272('0x49')](_0xcb858d[_0xe272('0x34')],qs[_0xe272('0x38')](_0xa74e5d[_0xe272('0x35')][_0xe272('0x38')]));_0x53420b[_0xe272('0x39')]=_0x53420b[_0xe272('0x39')]['length']?_0x53420b[_0xe272('0x39')]:_0xcb858d['model'];if(_0xa74e5d[_0xe272('0x35')][_0xe272('0x42')]){_0x53420b[_0xe272('0x43')]=[{'all':!![]}];}_0x53420b=_[_0xe272('0x3f')]({},_0x53420b,_0xa74e5d[_0xe272('0x41')]);return db[_0xe272('0x2f')][_0xe272('0x4a')](_0x53420b)[_0xe272('0x28')](handleEntityNotFound(_0x2cf20a,null))['then'](respondWithResult(_0x2cf20a,null))[_0xe272('0x46')](handleError(_0x2cf20a,null));};exports[_0xe272('0x4b')]=function(_0x779354,_0x5e9ee1){return db[_0xe272('0x2f')][_0xe272('0x4b')](_0x779354['body'],{})[_0xe272('0x28')](function(_0x201ef4){var _0x18b0a8=_0x779354[_0xe272('0x4c')][_0xe272('0x29')]({'plain':!![]});if(!_0x18b0a8)throw new Error(_0xe272('0x4d'));if(_0x18b0a8[_0xe272('0x4e')]===_0xe272('0x4c')){var _0x4386d8=_0x201ef4[_0xe272('0x29')]({'plain':!![]});var _0x4ea89c='Variables';return db[_0xe272('0x4f')]['find']({'where':{'name':_0x4ea89c,'userProfileId':_0x18b0a8[_0xe272('0x50')]},'raw':!![]})['then'](function(_0x1fb58f){if(_0x1fb58f&&_0x1fb58f[_0xe272('0x51')]===0x0){return db[_0xe272('0x2a')][_0xe272('0x4b')]({'name':_0x4386d8['name'],'resourceId':_0x4386d8['id'],'type':_0x1fb58f['name'],'sectionId':_0x1fb58f['id']},{})[_0xe272('0x28')](function(){return _0x201ef4;});}else{return _0x201ef4;}})[_0xe272('0x46')](function(_0x58cdb9){logger[_0xe272('0x52')](_0xe272('0x53'),_0x58cdb9);throw _0x58cdb9;});}return _0x201ef4;})[_0xe272('0x28')](respondWithResult(_0x5e9ee1,0xc9))[_0xe272('0x46')](handleError(_0x5e9ee1,null));};exports[_0xe272('0x27')]=function(_0x518bb7,_0xd627bb){if(_0x518bb7['body']['id']){delete _0x518bb7[_0xe272('0x54')]['id'];}return db[_0xe272('0x2f')][_0xe272('0x4a')]({'where':{'id':_0x518bb7['params']['id']}})[_0xe272('0x28')](handleEntityNotFound(_0xd627bb,null))['then'](saveUpdates(_0x518bb7['body'],null))[_0xe272('0x28')](respondWithResult(_0xd627bb,null))[_0xe272('0x46')](handleError(_0xd627bb,null));};exports[_0xe272('0x2b')]=function(_0x2ea923,_0x4475ca){return db[_0xe272('0x2f')][_0xe272('0x4a')]({'where':{'id':_0x2ea923['params']['id']}})[_0xe272('0x28')](handleEntityNotFound(_0x4475ca,null))[_0xe272('0x28')](removeEntity(_0x4475ca,null))[_0xe272('0x46')](handleError(_0x4475ca,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2c81096..adc62de 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 _0xf326=['./variable.attributes','exports','Variable','tools_variables','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x59c2cb,_0x671ebb){var _0x4d2910=function(_0x50c769){while(--_0x50c769){_0x59c2cb['push'](_0x59c2cb['shift']());}};_0x4d2910(++_0x671ebb);}(_0xf326,0x14e));var _0x6f32=function(_0x4057f9,_0x17c5b5){_0x4057f9=_0x4057f9-0x0;var _0x5552b7=_0xf326[_0x4057f9];return _0x5552b7;};'use strict';var _=require('lodash');var util=require(_0x6f32('0x0'));var logger=require('../../config/logger')(_0x6f32('0x1'));var moment=require(_0x6f32('0x2'));var BPromise=require(_0x6f32('0x3'));var rp=require(_0x6f32('0x4'));var fs=require('fs');var path=require(_0x6f32('0x5'));var rimraf=require('rimraf');var config=require(_0x6f32('0x6'));var attributes=require(_0x6f32('0x7'));module[_0x6f32('0x8')]=function(_0x354014,_0x15bfbe){return _0x354014['define'](_0x6f32('0x9'),attributes,{'tableName':_0x6f32('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d4f=['exports','define','Variable','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./variable.attributes'];(function(_0x42a4ec,_0x1fd2ee){var _0x3328f1=function(_0x36f305){while(--_0x36f305){_0x42a4ec['push'](_0x42a4ec['shift']());}};_0x3328f1(++_0x1fd2ee);}(_0x9d4f,0x87));var _0xf9d4=function(_0x49163b,_0xce4a){_0x49163b=_0x49163b-0x0;var _0x303356=_0x9d4f[_0x49163b];return _0x303356;};'use strict';var _=require(_0xf9d4('0x0'));var util=require(_0xf9d4('0x1'));var logger=require('../../config/logger')(_0xf9d4('0x2'));var moment=require(_0xf9d4('0x3'));var BPromise=require('bluebird');var rp=require(_0xf9d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9d4('0x5'));var config=require(_0xf9d4('0x6'));var attributes=require(_0xf9d4('0x7'));module[_0xf9d4('0x8')]=function(_0x228e17,_0x564622){return _0x228e17[_0xf9d4('0x9')](_0xf9d4('0xa'),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 424229a..f1f616e 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x4577c9,_0x583984){var _0x40e3d5=function(_0x3ba390){while(--_0x3ba390){_0x4577c9['push'](_0x4577c9['shift']());}};_0x40e3d5(++_0x583984);}(_0x814b,0x1a2));var _0xb814=function(_0x300c89,_0x25fcad){_0x300c89=_0x300c89-0x0;var _0x41762e=_0x814b[_0x300c89];return _0x41762e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x31c143,_0x23a9b2){var _0x233291=function(_0x548c29){while(--_0x548c29){_0x31c143['push'](_0x31c143['shift']());}};_0x233291(++_0x23a9b2);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('Variable,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 0b94788..7fd5f0e 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 _0x9efb=['/reset','canUpdate','reset','/pull','pull','/restart','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','index','isAuthenticated','fetch','get'];(function(_0x3095ad,_0x1cae11){var _0x3c018b=function(_0x496057){while(--_0x496057){_0x3095ad['push'](_0x3095ad['shift']());}};_0x3c018b(++_0x1cae11);}(_0x9efb,0x91));var _0xb9ef=function(_0x399d20,_0x329286){_0x399d20=_0x399d20-0x0;var _0x2bd971=_0x9efb[_0x399d20];return _0x2bd971;};'use strict';var express=require(_0xb9ef('0x0'));var router=express[_0xb9ef('0x1')]();var auth=require(_0xb9ef('0x2'));var controller=require(_0xb9ef('0x3'));router['get']('/',controller[_0xb9ef('0x4')]);router['get']('/fetch',auth[_0xb9ef('0x5')](),auth['canUpdate'](),controller[_0xb9ef('0x6')]);router[_0xb9ef('0x7')](_0xb9ef('0x8'),auth[_0xb9ef('0x5')](),auth[_0xb9ef('0x9')](),controller[_0xb9ef('0xa')]);router[_0xb9ef('0x7')](_0xb9ef('0xb'),auth['isAuthenticated'](),auth[_0xb9ef('0x9')](),controller[_0xb9ef('0xc')]);router[_0xb9ef('0x7')](_0xb9ef('0xd'),auth['isAuthenticated'](),controller[_0xb9ef('0xe')]);router['get']('/migrations',controller[_0xb9ef('0xf')]);module[_0xb9ef('0x10')]=router; \ No newline at end of file +var _0x8f20=['./version.controller','get','index','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','restart','/migrations','migrations','exports','express','Router'];(function(_0x301ca3,_0x4233c5){var _0x131292=function(_0x4b64fd){while(--_0x4b64fd){_0x301ca3['push'](_0x301ca3['shift']());}};_0x131292(++_0x4233c5);}(_0x8f20,0x12e));var _0x08f2=function(_0x5cb158,_0x45557e){_0x5cb158=_0x5cb158-0x0;var _0x4032a0=_0x8f20[_0x5cb158];return _0x4032a0;};'use strict';var express=require(_0x08f2('0x0'));var router=express[_0x08f2('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x08f2('0x2'));router[_0x08f2('0x3')]('/',controller[_0x08f2('0x4')]);router['get']('/fetch',auth[_0x08f2('0x5')](),auth[_0x08f2('0x6')](),controller[_0x08f2('0x7')]);router[_0x08f2('0x3')](_0x08f2('0x8'),auth[_0x08f2('0x5')](),auth[_0x08f2('0x6')](),controller[_0x08f2('0x9')]);router[_0x08f2('0x3')](_0x08f2('0xa'),auth[_0x08f2('0x5')](),auth[_0x08f2('0x6')](),controller[_0x08f2('0xb')]);router[_0x08f2('0x3')]('/restart',auth[_0x08f2('0x5')](),controller[_0x08f2('0xc')]);router[_0x08f2('0x3')](_0x08f2('0xd'),controller[_0x08f2('0xe')]);module[_0x08f2('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index e4227ec..091c701 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 _0xe40b=['restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','replace','.js','push','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production'];(function(_0x424ab1,_0x1de8d0){var _0x124a0d=function(_0x4240bc){while(--_0x4240bc){_0x424ab1['push'](_0x424ab1['shift']());}};_0x124a0d(++_0x1de8d0);}(_0xe40b,0x110));var _0xbe40=function(_0x263aa7,_0x217cca){_0x263aa7=_0x263aa7-0x0;var _0x57293d=_0xe40b[_0x263aa7];return _0x57293d;};'use strict';var Umzug=require(_0xbe40('0x0'));var path=require(_0xbe40('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xbe40('0x2'))(module,'version');var compareVersions=require(_0xbe40('0x3'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xbe40('0x4'));var pm2=require(_0xbe40('0x5'));var logger=require('../../config/logger')(_0xbe40('0x6'));var git=require(_0xbe40('0x7'))(config[_0xbe40('0x8')]);exports[_0xbe40('0x9')]=function(_0xd9a9f8,_0x471f46){var _0x3a254a={'current':module[_0xbe40('0xa')]['version'],'phonebar':0x2};if(_0xd9a9f8[_0xbe40('0xb')]&&_0xd9a9f8[_0xbe40('0xb')]['latest']){return git[_0xbe40('0xc')]()[_0xbe40('0xd')](function(_0x4f1e2c,_0x1c8bcf){_0x3a254a[_0xbe40('0xe')]=(_0x4f1e2c?module[_0xbe40('0xa')]['version']:_0x1c8bcf[_0xbe40('0xe')])||_0xbe40('0xf');return _0x471f46['status'](0xc8)['json'](_0x3a254a);});}else{return _0x471f46[_0xbe40('0x10')](0xc8)[_0xbe40('0x11')](_0x3a254a);}};exports[_0xbe40('0xc')]=function(_0x40b3e9,_0x24da3d){return git[_0xbe40('0xc')]([_0xbe40('0x12'),'master'],function(_0x3f049c){if(_0x3f049c){logger[_0xbe40('0x13')](_0x3f049c);return _0x24da3d[_0xbe40('0x10')](0x1f4)['json'](_0x3f049c);}logger[_0xbe40('0x14')]('git\x20fetch');return _0x24da3d[_0xbe40('0x10')](0xc8)[_0xbe40('0x11')]({'output':_0xbe40('0x15')});});};exports[_0xbe40('0x16')]=function(_0x2c8be4,_0x1e83b8){return git[_0xbe40('0x16')]([_0xbe40('0x17'),_0xbe40('0x18')],function(_0x560527){if(_0x560527){logger['error'](_0x560527);return _0x1e83b8['status'](0x1f4)[_0xbe40('0x11')](_0x560527);}logger[_0xbe40('0x14')](_0xbe40('0x19'));return _0x1e83b8[_0xbe40('0x10')](0xc8)[_0xbe40('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0xbe40('0x1a')]=function(_0x2443b6,_0xa3b916){exec(_0xbe40('0x1b'),function(_0x1c3243,_0x6dba0c,_0x4da572){logger[_0xbe40('0x14')](_0x6dba0c);logger[_0xbe40('0x14')](_0x4da572);if(_0x1c3243){logger['error'](_0x1c3243);return _0xa3b916[_0xbe40('0x10')](0x1f4)[_0xbe40('0x11')](_0x1c3243);}return _0xa3b916[_0xbe40('0x10')](0xc8)['json']({'output':_0x6dba0c});});};exports['restart']=function(_0x55a51c,_0x4c82d7){return pm2[_0xbe40('0x1c')]('motion2')[_0xbe40('0x1d')](function(_0x28d400){logger[_0xbe40('0x14')](_0xbe40('0x1e'),_0x28d400);return _0x4c82d7[_0xbe40('0x10')](0xc8)['json']({'output':_0xbe40('0x1f')});})[_0xbe40('0x20')](function(_0x4294e7){logger['error'](_0x4294e7);return _0x4c82d7[_0xbe40('0x10')](0x1f4)[_0xbe40('0x11')](_0x4294e7);});};exports[_0xbe40('0x21')]=function(_0x5301a9,_0x4289a8){var _0x2e2596=fs['readdirSync'](path['join'](config[_0xbe40('0x8')],_0xbe40('0x22'),_0xbe40('0x21')));var _0x38b689=[];for(var _0x12598b=0x0;_0x12598b<_0x2e2596[_0xbe40('0x23')];_0x12598b++){var _0x2badca=_0x2e2596[_0x12598b][_0xbe40('0x24')](_0xbe40('0x25'),'');if(compareVersions(module['exports']['version'],_0x2badca)===-0x1){_0x38b689[_0xbe40('0x26')](_0x2badca);}}if(_0x38b689['length']){var _0x20e0a1=_0x38b689['sort'](compareVersions);var _0x3f895a=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xbe40('0x27')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xbe40('0x28')][_0xbe40('0x29')](),db['sequelize']['constructor'],function(){throw new Error(_0xbe40('0x2a'));}],'path':path[_0xbe40('0x2b')](config['root'],_0xbe40('0x22'),_0xbe40('0x21')),'pattern':/\.js$/}});_0x3f895a['up']({'migrations':_[_0xbe40('0x2c')](_0x20e0a1,function(_0x42a004){return _0x42a004+_0xbe40('0x25');})})[_0xbe40('0x1d')](function(){return _0x4289a8[_0xbe40('0x10')](0xc8)[_0xbe40('0x11')]({'output':_0xbe40('0x2d')+module[_0xbe40('0xa')]['version']+_0xbe40('0x2e')+_[_0xbe40('0x2f')](_0x20e0a1),'migrations':_[_0xbe40('0x2b')](_0x20e0a1)});})['catch'](function(_0x15556a){if(_0x15556a instanceof db[_0xbe40('0x28')][_0xbe40('0x30')]){return _0x4289a8['status'](0xc8)[_0xbe40('0x11')]({'output':_0xbe40('0x31')});}else{return _0x4289a8[_0xbe40('0x10')](0x1f4)['json'](_0x15556a);}});}else{return _0x4289a8[_0xbe40('0x10')](0xc8)[_0xbe40('0x11')]({'output':_0xbe40('0x31')});}}; \ No newline at end of file +var _0x3787=['error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','catch','readdirSync','join','server','migrations','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','simple-git','root','index','latest','tags','exports','2.0.0','json','status','fetch','master'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3787,0x194));var _0x7378=function(_0x1db4ac,_0x551e08){_0x1db4ac=_0x1db4ac-0x0;var _0x5b97e0=_0x3787[_0x1db4ac];return _0x5b97e0;};'use strict';var Umzug=require('umzug');var path=require(_0x7378('0x0'));var fs=require('fs');var _=require(_0x7378('0x1'));var pkginfo=require(_0x7378('0x2'))(module,_0x7378('0x3'));var compareVersions=require(_0x7378('0x4'));var exec=require(_0x7378('0x5'))[_0x7378('0x6')];var db=require(_0x7378('0x7'))['db'];var config=require(_0x7378('0x8'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')('update');var git=require(_0x7378('0x9'))(config[_0x7378('0xa')]);exports[_0x7378('0xb')]=function(_0x13a202,_0x362a43){var _0x576495={'current':module['exports'][_0x7378('0x3')],'phonebar':0x2};if(_0x13a202['query']&&_0x13a202['query'][_0x7378('0xc')]){return git['fetch']()[_0x7378('0xd')](function(_0x304592,_0x1fd7c4){_0x576495[_0x7378('0xc')]=(_0x304592?module[_0x7378('0xe')][_0x7378('0x3')]:_0x1fd7c4[_0x7378('0xc')])||_0x7378('0xf');return _0x362a43['status'](0xc8)[_0x7378('0x10')](_0x576495);});}else{return _0x362a43[_0x7378('0x11')](0xc8)[_0x7378('0x10')](_0x576495);}};exports[_0x7378('0x12')]=function(_0x44053d,_0x4be45f){return git[_0x7378('0x12')](['origin',_0x7378('0x13')],function(_0x4cf303){if(_0x4cf303){logger[_0x7378('0x14')](_0x4cf303);return _0x4be45f[_0x7378('0x11')](0x1f4)[_0x7378('0x10')](_0x4cf303);}logger[_0x7378('0x15')](_0x7378('0x16'));return _0x4be45f[_0x7378('0x11')](0xc8)[_0x7378('0x10')]({'output':_0x7378('0x17')});});};exports[_0x7378('0x18')]=function(_0x28425e,_0x469c44){return git[_0x7378('0x18')]([_0x7378('0x19'),_0x7378('0x1a')],function(_0x1ab437){if(_0x1ab437){logger[_0x7378('0x14')](_0x1ab437);return _0x469c44[_0x7378('0x11')](0x1f4)[_0x7378('0x10')](_0x1ab437);}logger[_0x7378('0x15')](_0x7378('0x1b'));return _0x469c44[_0x7378('0x11')](0xc8)[_0x7378('0x10')]({'output':_0x7378('0x1c')});});};exports[_0x7378('0x1d')]=function(_0x296abf,_0x597295){exec(_0x7378('0x1e'),function(_0xcf19a5,_0x5e0214,_0x12f3f4){logger['info'](_0x5e0214);logger[_0x7378('0x15')](_0x12f3f4);if(_0xcf19a5){logger[_0x7378('0x14')](_0xcf19a5);return _0x597295['status'](0x1f4)[_0x7378('0x10')](_0xcf19a5);}return _0x597295['status'](0xc8)['json']({'output':_0x5e0214});});};exports[_0x7378('0x1f')]=function(_0x5646d9,_0x646405){return pm2[_0x7378('0x1f')](_0x7378('0x20'))[_0x7378('0x21')](function(_0x362040){logger[_0x7378('0x15')]('pm2\x20restart\x20motion\x20%s',_0x362040);return _0x646405['status'](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7378('0x22')](function(_0xd9db95){logger[_0x7378('0x14')](_0xd9db95);return _0x646405[_0x7378('0x11')](0x1f4)[_0x7378('0x10')](_0xd9db95);});};exports['migrations']=function(_0x49e8e9,_0x3d4591){var _0x313a7b=fs[_0x7378('0x23')](path[_0x7378('0x24')](config[_0x7378('0xa')],_0x7378('0x25'),_0x7378('0x26')));var _0x312e14=[];for(var _0x574be3=0x0;_0x574be3<_0x313a7b['length'];_0x574be3++){var _0xcb4b0b=_0x313a7b[_0x574be3][_0x7378('0x27')](_0x7378('0x28'),'');if(compareVersions(module[_0x7378('0xe')]['version'],_0xcb4b0b)===-0x1){_0x312e14[_0x7378('0x29')](_0xcb4b0b);}}if(_0x312e14[_0x7378('0x2a')]){var _0x4215a4=_0x312e14[_0x7378('0x2b')](compareVersions);var _0x1bfd3f=new Umzug({'storage':_0x7378('0x2c'),'storageOptions':{'model':db[_0x7378('0x2d')],'modelName':_0x7378('0x2d'),'columnName':_0x7378('0x3')},'migrations':{'params':[db[_0x7378('0x2c')][_0x7378('0x2e')](),db[_0x7378('0x2c')][_0x7378('0x2f')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x7378('0x24')](config[_0x7378('0xa')],_0x7378('0x25'),_0x7378('0x26')),'pattern':/\.js$/}});_0x1bfd3f['up']({'migrations':_['map'](_0x4215a4,function(_0x4cce6b){return _0x4cce6b+_0x7378('0x28');})})[_0x7378('0x21')](function(){return _0x3d4591[_0x7378('0x11')](0xc8)[_0x7378('0x10')]({'output':_0x7378('0x30')+module[_0x7378('0xe')][_0x7378('0x3')]+_0x7378('0x31')+_[_0x7378('0x32')](_0x4215a4),'migrations':_['join'](_0x4215a4)});})[_0x7378('0x22')](function(_0x3522b8){if(_0x3522b8 instanceof db['sequelize'][_0x7378('0x33')]){return _0x3d4591[_0x7378('0x11')](0xc8)[_0x7378('0x10')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x3d4591[_0x7378('0x11')](0x1f4)[_0x7378('0x10')](_0x3522b8);}});}else{return _0x3d4591[_0x7378('0x11')](0xc8)[_0x7378('0x10')]({'output':_0x7378('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3f96fda..3f12af3 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 _0x3bc2=['describe','/:id','show','create','put','delete','destroy','util','path','connect-timeout','fs-extra','../../components/auth/service','./voiceAgentReport.controller','index','get','isAuthenticated'];(function(_0x1b70fe,_0x4ce430){var _0x2c94e5=function(_0x4114ff){while(--_0x4114ff){_0x1b70fe['push'](_0x1b70fe['shift']());}};_0x2c94e5(++_0x4ce430);}(_0x3bc2,0x167));var _0x23bc=function(_0x1016d4,_0x48954d){_0x1016d4=_0x1016d4-0x0;var _0x5cd988=_0x3bc2[_0x1016d4];return _0x5cd988;};'use strict';var multer=require('multer');var util=require(_0x23bc('0x0'));var path=require(_0x23bc('0x1'));var timeout=require(_0x23bc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x23bc('0x3'));var auth=require(_0x23bc('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x23bc('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x23bc('0x6')]);router[_0x23bc('0x7')]('/describe',auth[_0x23bc('0x8')](),controller[_0x23bc('0x9')]);router[_0x23bc('0x7')](_0x23bc('0xa'),auth['isAuthenticated'](),controller[_0x23bc('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x23bc('0xc')]);router[_0x23bc('0xd')](_0x23bc('0xa'),auth[_0x23bc('0x8')](),controller['update']);router[_0x23bc('0xe')](_0x23bc('0xa'),auth[_0x23bc('0x8')](),controller[_0x23bc('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf919=['isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get'];(function(_0x5a004d,_0x319eb5){var _0x27e245=function(_0x4cb3d5){while(--_0x4cb3d5){_0x5a004d['push'](_0x5a004d['shift']());}};_0x27e245(++_0x319eb5);}(_0xf919,0xb6));var _0x9f91=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0xf919[_0x50bf5a];return _0x4ddc1d;};'use strict';var multer=require(_0x9f91('0x0'));var util=require('util');var path=require(_0x9f91('0x1'));var timeout=require(_0x9f91('0x2'));var express=require(_0x9f91('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9f91('0x4'));var config=require(_0x9f91('0x5'));var controller=require(_0x9f91('0x6'));router[_0x9f91('0x7')]('/',auth[_0x9f91('0x8')](),controller[_0x9f91('0x9')]);router['get']('/describe',auth[_0x9f91('0x8')](),controller[_0x9f91('0xa')]);router[_0x9f91('0x7')](_0x9f91('0xb'),auth[_0x9f91('0x8')](),controller[_0x9f91('0xc')]);router['post']('/',auth[_0x9f91('0x8')](),controller[_0x9f91('0xd')]);router[_0x9f91('0xe')](_0x9f91('0xb'),auth[_0x9f91('0x8')](),controller[_0x9f91('0xf')]);router[_0x9f91('0x10')](_0x9f91('0xb'),auth['isAuthenticated'](),controller[_0x9f91('0x11')]);module[_0x9f91('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index bf2fa9c..d2321f3 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 _0x49db=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x213207,_0x12d12b){var _0x3957f8=function(_0xf31660){while(--_0xf31660){_0x213207['push'](_0x213207['shift']());}};_0x3957f8(++_0x12d12b);}(_0x49db,0xc5));var _0xb49d=function(_0x5a1782,_0x2a94c7){_0x5a1782=_0x5a1782-0x0;var _0x55e33e=_0x49db[_0x5a1782];return _0x55e33e;};'use strict';var Sequelize=require(_0xb49d('0x0'));module[_0xb49d('0x1')]={'type':{'type':Sequelize[_0xb49d('0x2')]},'uniqueid':{'type':Sequelize[_0xb49d('0x2')]},'calleridnum':{'type':Sequelize[_0xb49d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb49d('0x2')]},'interface':{'type':Sequelize[_0xb49d('0x2')]},'membername':{'type':Sequelize[_0xb49d('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb49d('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xb49d('0x3')]},'holdtime':{'type':Sequelize[_0xb49d('0x4')]},'agentcomplete':{'type':Sequelize[_0xb49d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb49d('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb49d('0x4')]},'agentacw':{'type':Sequelize[_0xb49d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb49d('0x4')]},'reason':{'type':Sequelize[_0xb49d('0x2')]},'lastevent':{'type':Sequelize[_0xb49d('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xb49d('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb49d('0x2')]},'connectedlinename':{'type':Sequelize[_0xb49d('0x2')]},'language':{'type':Sequelize[_0xb49d('0x2')]},'accountcode':{'type':Sequelize[_0xb49d('0x2')]},'context':{'type':Sequelize[_0xb49d('0x2')]},'exten':{'type':Sequelize[_0xb49d('0x2')]},'priority':{'type':Sequelize[_0xb49d('0x2')]},'destchannel':{'type':Sequelize[_0xb49d('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb49d('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb49d('0x2')]},'destcalleridname':{'type':Sequelize[_0xb49d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb49d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xb49d('0x2')]},'destaccountcode':{'type':Sequelize[_0xb49d('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xb49d('0x2')]},'destpriority':{'type':Sequelize[_0xb49d('0x2')]},'destuniqueid':{'type':Sequelize[_0xb49d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb49d('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xb49d('0x2')]},'transfer':{'type':Sequelize[_0xb49d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb49d('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xb49d('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb49d('0x2')]},'agententerreason':{'type':Sequelize[_0xb49d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbc6=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x413324,_0xb8c1e7){_0x413324=_0x413324-0x0;var _0x2b009a=_0xdbc6[_0x413324];return _0x2b009a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6dbc('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6dbc('0x0')]},'calleridname':{'type':Sequelize[_0x6dbc('0x0')]},'queue':{'type':Sequelize[_0x6dbc('0x0')]},'interface':{'type':Sequelize[_0x6dbc('0x0')]},'membername':{'type':Sequelize[_0x6dbc('0x0')]},'agentcalledAt':{'type':Sequelize[_0x6dbc('0x1')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x6dbc('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x6dbc('0x1')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6dbc('0x2')]},'agentcomplete':{'type':Sequelize[_0x6dbc('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6dbc('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6dbc('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6dbc('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6dbc('0x2')]},'reason':{'type':Sequelize[_0x6dbc('0x0')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6dbc('0x0')]},'channelstate':{'type':Sequelize[_0x6dbc('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6dbc('0x0')]},'connectedlinename':{'type':Sequelize[_0x6dbc('0x0')]},'language':{'type':Sequelize[_0x6dbc('0x0')]},'accountcode':{'type':Sequelize[_0x6dbc('0x0')]},'context':{'type':Sequelize[_0x6dbc('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x6dbc('0x0')]},'destchannelstate':{'type':Sequelize[_0x6dbc('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x6dbc('0x0')]},'destcalleridnum':{'type':Sequelize[_0x6dbc('0x0')]},'destcalleridname':{'type':Sequelize[_0x6dbc('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x6dbc('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x6dbc('0x0')]},'destlanguage':{'type':Sequelize[_0x6dbc('0x0')]},'destaccountcode':{'type':Sequelize[_0x6dbc('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x6dbc('0x0')]},'destpriority':{'type':Sequelize[_0x6dbc('0x0')]},'destuniqueid':{'type':Sequelize[_0x6dbc('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6dbc('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0x6dbc('0x0')]},'transfer':{'type':Sequelize[_0x6dbc('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6dbc('0x0')],'comment':_0x6dbc('0x4')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'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 fd5ff98..7577270 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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 3bc9615..87e5892 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 _0x16a6=['moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','destuniqueid','lodash','util','api'];(function(_0x263c61,_0x50869f){var _0x2e7170=function(_0x562695){while(--_0x562695){_0x263c61['push'](_0x263c61['shift']());}};_0x2e7170(++_0x50869f);}(_0x16a6,0x15c));var _0x616a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x16a6[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var logger=require('../../config/logger')(_0x616a('0x2'));var moment=require(_0x616a('0x3'));var BPromise=require(_0x616a('0x4'));var rp=require(_0x616a('0x5'));var fs=require('fs');var path=require(_0x616a('0x6'));var rimraf=require(_0x616a('0x7'));var config=require('../../config/environment');var attributes=require(_0x616a('0x8'));module[_0x616a('0x9')]=function(_0x4c1641,_0x56eaab){return _0x4c1641[_0x616a('0xa')](_0x616a('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x616a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdad2=['uniqueid','destuniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xdad2,0x14c));var _0x2dad=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdad2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x2dad('0x0'));var logger=require(_0x2dad('0x1'))('api');var moment=require(_0x2dad('0x2'));var BPromise=require(_0x2dad('0x3'));var rp=require(_0x2dad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dad('0x5'));var config=require(_0x2dad('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x2dad('0x7')]=function(_0x36a054,_0x27ca04){return _0x36a054[_0x2dad('0x8')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x2dad('0x9'),_0x2dad('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 93b671f..d6dea7b 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 _0xa7d6=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','error','code','VoiceAgentReport,\x20%s,\x20%s','message','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','then','stringify','catch','UpdateVoiceAgentReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x409407,_0x348490){var _0x34e613=function(_0x4ceae2){while(--_0x4ceae2){_0x409407['push'](_0x409407['shift']());}};_0x34e613(++_0x348490);}(_0xa7d6,0x13a));var _0x6a7d=function(_0x4b836d,_0x22eaba){_0x4b836d=_0x4b836d-0x0;var _0x31c16b=_0xa7d6[_0x4b836d];return _0x31c16b;};'use strict';var _=require(_0x6a7d('0x0'));var util=require(_0x6a7d('0x1'));var moment=require(_0x6a7d('0x2'));var BPromise=require(_0x6a7d('0x3'));var rs=require(_0x6a7d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a7d('0x5'))['db'];var utils=require(_0x6a7d('0x6'));var logger=require(_0x6a7d('0x7'))(_0x6a7d('0x8'));var config=require(_0x6a7d('0x9'));var jayson=require(_0x6a7d('0xa'));var client=jayson[_0x6a7d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x458057,_0x31af72,_0x10033b){return new BPromise(function(_0x523f9c,_0x47a6d2){return client[_0x6a7d('0xc')](_0x458057,_0x10033b)['then'](function(_0x28a48c){logger[_0x6a7d('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x31af72,_0x6a7d('0xe'));logger[_0x6a7d('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x31af72,_0x6a7d('0xe'),JSON['stringify'](_0x28a48c));if(_0x28a48c[_0x6a7d('0x10')]){if(_0x28a48c['error'][_0x6a7d('0x11')]===0x1f4){logger[_0x6a7d('0x10')](_0x6a7d('0x12'),_0x31af72,_0x28a48c[_0x6a7d('0x10')][_0x6a7d('0x13')]);return _0x47a6d2(_0x28a48c[_0x6a7d('0x10')]['message']);}logger['error'](_0x6a7d('0x12'),_0x31af72,_0x28a48c['error'][_0x6a7d('0x13')]);return _0x523f9c(_0x28a48c[_0x6a7d('0x10')]['message']);}else{logger[_0x6a7d('0xd')](_0x6a7d('0x12'),_0x31af72,'request\x20sent');_0x523f9c(_0x28a48c['result'][_0x6a7d('0x13')]);}})['catch'](function(_0x411858){logger[_0x6a7d('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x31af72,_0x411858);_0x47a6d2(_0x411858);});});}exports[_0x6a7d('0x14')]=function(_0xd8ccb1){var _0x472a90=this;return new Promise(function(_0x3890cf,_0x4e9869){return db[_0x6a7d('0x15')][_0x6a7d('0x16')](_0xd8ccb1['body'],{'raw':_0xd8ccb1[_0x6a7d('0x17')]?_0xd8ccb1[_0x6a7d('0x17')][_0x6a7d('0x18')]===undefined?!![]:![]:!![]})[_0x6a7d('0x19')](function(_0x443c1d){logger[_0x6a7d('0xd')](_0x6a7d('0x14'),_0xd8ccb1);logger[_0x6a7d('0xf')](_0x6a7d('0x14'),_0xd8ccb1,JSON[_0x6a7d('0x1a')](_0x443c1d));_0x3890cf(_0x443c1d);})[_0x6a7d('0x1b')](function(_0x367b95){logger[_0x6a7d('0x10')](_0x6a7d('0x14'),_0x367b95[_0x6a7d('0x13')],_0xd8ccb1);_0x4e9869(_0x472a90[_0x6a7d('0x10')](0x1f4,_0x367b95[_0x6a7d('0x13')]));});});};exports[_0x6a7d('0x1c')]=function(_0x231a8f){var _0x81dec7=this;return new Promise(function(_0x1a620b,_0x30d0b4){return db[_0x6a7d('0x15')][_0x6a7d('0x1d')](_0x231a8f['body'],{'raw':_0x231a8f[_0x6a7d('0x17')]?_0x231a8f[_0x6a7d('0x17')][_0x6a7d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x231a8f[_0x6a7d('0x17')]?_0x231a8f[_0x6a7d('0x17')]['where']||null:null,'attributes':_0x231a8f[_0x6a7d('0x17')]?_0x231a8f[_0x6a7d('0x17')][_0x6a7d('0x1e')]||null:null,'limit':_0x231a8f[_0x6a7d('0x17')]?_0x231a8f[_0x6a7d('0x17')][_0x6a7d('0x1f')]||null:null})['then'](function(_0x2b29cb){logger[_0x6a7d('0xd')](_0x6a7d('0x1c'),_0x231a8f);logger['debug'](_0x6a7d('0x1c'),_0x231a8f,JSON[_0x6a7d('0x1a')](_0x2b29cb));_0x1a620b(_0x2b29cb);})[_0x6a7d('0x1b')](function(_0x391de4){logger[_0x6a7d('0x10')](_0x6a7d('0x1c'),_0x391de4['message'],_0x231a8f);_0x30d0b4(_0x81dec7[_0x6a7d('0x10')](0x1f4,_0x391de4[_0x6a7d('0x13')]));});});}; \ No newline at end of file +var _0xb576=['info','result','CreateVoiceAgentReport','create','body','options','raw','then','stringify','UpdateVoiceAgentReport','VoiceAgentReport','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceAgentReport,\x20%s,\x20%s','message'];(function(_0x4b05d8,_0x28cca5){var _0x5e1b33=function(_0x2456cd){while(--_0x2456cd){_0x4b05d8['push'](_0x4b05d8['shift']());}};_0x5e1b33(++_0x28cca5);}(_0xb576,0x179));var _0x6b57=function(_0x5cc67d,_0xeae8b4){_0x5cc67d=_0x5cc67d-0x0;var _0x8ff9ae=_0xb576[_0x5cc67d];return _0x8ff9ae;};'use strict';var _=require('lodash');var util=require(_0x6b57('0x0'));var moment=require(_0x6b57('0x1'));var BPromise=require(_0x6b57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b57('0x3'));var db=require(_0x6b57('0x4'))['db'];var utils=require(_0x6b57('0x5'));var logger=require('../../config/logger')(_0x6b57('0x6'));var config=require(_0x6b57('0x7'));var jayson=require(_0x6b57('0x8'));var client=jayson[_0x6b57('0x9')][_0x6b57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x481ee2,_0x33f7ef,_0x3093dc){return new BPromise(function(_0x20d5e6,_0x5170d6){return client[_0x6b57('0xb')](_0x481ee2,_0x3093dc)['then'](function(_0x425273){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x33f7ef,'request\x20sent');logger[_0x6b57('0xc')](_0x6b57('0xd'),_0x33f7ef,_0x6b57('0xe'),JSON['stringify'](_0x425273));if(_0x425273[_0x6b57('0xf')]){if(_0x425273[_0x6b57('0xf')][_0x6b57('0x10')]===0x1f4){logger['error'](_0x6b57('0x11'),_0x33f7ef,_0x425273['error'][_0x6b57('0x12')]);return _0x5170d6(_0x425273[_0x6b57('0xf')][_0x6b57('0x12')]);}logger[_0x6b57('0xf')](_0x6b57('0x11'),_0x33f7ef,_0x425273[_0x6b57('0xf')][_0x6b57('0x12')]);return _0x20d5e6(_0x425273['error'][_0x6b57('0x12')]);}else{logger[_0x6b57('0x13')](_0x6b57('0x11'),_0x33f7ef,_0x6b57('0xe'));_0x20d5e6(_0x425273[_0x6b57('0x14')]['message']);}})['catch'](function(_0x157eb2){logger['error'](_0x6b57('0x11'),_0x33f7ef,_0x157eb2);_0x5170d6(_0x157eb2);});});}exports[_0x6b57('0x15')]=function(_0x3067b9){var _0x392a5a=this;return new Promise(function(_0x460af4,_0x1108f7){return db['VoiceAgentReport'][_0x6b57('0x16')](_0x3067b9[_0x6b57('0x17')],{'raw':_0x3067b9['options']?_0x3067b9[_0x6b57('0x18')][_0x6b57('0x19')]===undefined?!![]:![]:!![]})[_0x6b57('0x1a')](function(_0x4b69a5){logger[_0x6b57('0x13')]('CreateVoiceAgentReport',_0x3067b9);logger['debug'](_0x6b57('0x15'),_0x3067b9,JSON[_0x6b57('0x1b')](_0x4b69a5));_0x460af4(_0x4b69a5);})['catch'](function(_0x14bba7){logger[_0x6b57('0xf')](_0x6b57('0x15'),_0x14bba7[_0x6b57('0x12')],_0x3067b9);_0x1108f7(_0x392a5a[_0x6b57('0xf')](0x1f4,_0x14bba7[_0x6b57('0x12')]));});});};exports[_0x6b57('0x1c')]=function(_0x38cd64){var _0x1e6635=this;return new Promise(function(_0x3ab05f,_0x281f34){return db[_0x6b57('0x1d')]['update'](_0x38cd64[_0x6b57('0x17')],{'raw':_0x38cd64[_0x6b57('0x18')]?_0x38cd64['options'][_0x6b57('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38cd64[_0x6b57('0x18')]?_0x38cd64[_0x6b57('0x18')][_0x6b57('0x1e')]||null:null,'attributes':_0x38cd64[_0x6b57('0x18')]?_0x38cd64[_0x6b57('0x18')][_0x6b57('0x1f')]||null:null,'limit':_0x38cd64[_0x6b57('0x18')]?_0x38cd64[_0x6b57('0x18')][_0x6b57('0x20')]||null:null})['then'](function(_0x1a86fb){logger[_0x6b57('0x13')]('UpdateVoiceAgentReport',_0x38cd64);logger[_0x6b57('0xc')]('UpdateVoiceAgentReport',_0x38cd64,JSON[_0x6b57('0x1b')](_0x1a86fb));_0x3ab05f(_0x1a86fb);})['catch'](function(_0x4643da){logger[_0x6b57('0xf')]('UpdateVoiceAgentReport',_0x4643da['message'],_0x38cd64);_0x281f34(_0x1e6635[_0x6b57('0xf')](0x1f4,_0x4643da[_0x6b57('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index aed1b7f..f1282c9 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 _0x549a=['../../components/auth/service','./voiceCallReport.controller','index','isAuthenticated','describe','get','/:id','show','post','create','update','put','/with-retry/:id','updateWithRetry','destroy','express'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x549a,0x11f));var _0xa549=function(_0xf85af3,_0x1b86ca){_0xf85af3=_0xf85af3-0x0;var _0x50e4dd=_0x549a[_0xf85af3];return _0x50e4dd;};'use strict';var express=require(_0xa549('0x0'));var router=express['Router']();var auth=require(_0xa549('0x1'));var controller=require(_0xa549('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0xa549('0x3')]);router['get']('/describe',auth[_0xa549('0x4')](),controller[_0xa549('0x5')]);router[_0xa549('0x6')](_0xa549('0x7'),auth[_0xa549('0x4')](),controller[_0xa549('0x8')]);router[_0xa549('0x9')]('/',auth[_0xa549('0x4')](),controller[_0xa549('0xa')]);router['put'](_0xa549('0x7'),auth['isAuthenticated'](),controller[_0xa549('0xb')]);router[_0xa549('0xc')](_0xa549('0xd'),auth[_0xa549('0x4')](),controller[_0xa549('0xe')]);router['delete'](_0xa549('0x7'),auth['isAuthenticated'](),controller[_0xa549('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0db4=['./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','../../components/auth/service'];(function(_0x5d94fb,_0x31dd70){var _0x2d6257=function(_0x4f1121){while(--_0x4f1121){_0x5d94fb['push'](_0x5d94fb['shift']());}};_0x2d6257(++_0x31dd70);}(_0x0db4,0x10b));var _0x40db=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x0db4[_0x1ebe90];return _0x447c82;};'use strict';var express=require(_0x40db('0x0'));var router=express[_0x40db('0x1')]();var auth=require(_0x40db('0x2'));var controller=require(_0x40db('0x3'));router[_0x40db('0x4')]('/',auth[_0x40db('0x5')](),controller['index']);router[_0x40db('0x4')](_0x40db('0x6'),auth['isAuthenticated'](),controller[_0x40db('0x7')]);router[_0x40db('0x4')](_0x40db('0x8'),auth[_0x40db('0x5')](),controller[_0x40db('0x9')]);router['post']('/',auth[_0x40db('0x5')](),controller[_0x40db('0xa')]);router[_0x40db('0xb')](_0x40db('0x8'),auth[_0x40db('0x5')](),controller[_0x40db('0xc')]);router[_0x40db('0xb')](_0x40db('0xd'),auth[_0x40db('0x5')](),controller[_0x40db('0xe')]);router[_0x40db('0xf')](_0x40db('0x8'),auth[_0x40db('0x5')](),controller[_0x40db('0x10')]);module[_0x40db('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 2841216..eee4888 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 _0xd004=['STRING','ENUM','outbound','inbound-fax','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x188332,_0xbadcf1){var _0x1d57ce=function(_0x5416a8){while(--_0x5416a8){_0x188332['push'](_0x188332['shift']());}};_0x1d57ce(++_0xbadcf1);}(_0xd004,0x181));var _0x4d00=function(_0x1fdf47,_0x1da0d0){_0x1fdf47=_0x1fdf47-0x0;var _0x2f42d3=_0xd004[_0x1fdf47];return _0x2f42d3;};'use strict';var Sequelize=require(_0x4d00('0x0'));module[_0x4d00('0x1')]={'uniqueid':{'type':Sequelize[_0x4d00('0x2')]},'type':{'type':Sequelize[_0x4d00('0x3')]('inbound','internal',_0x4d00('0x4'),_0x4d00('0x5'),'outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4d00('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x4d00('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x4d00('0x2')]},'lastapplication':{'type':Sequelize[_0x4d00('0x2')]},'lastdata':{'type':Sequelize[_0x4d00('0x6')]},'starttime':{'type':Sequelize[_0x4d00('0x7')]},'systemanswertime':{'type':Sequelize[_0x4d00('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4d00('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4d00('0x8')]},'mohtime':{'type':Sequelize[_0x4d00('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x4d00('0x2')]},'userfield':{'type':Sequelize[_0x4d00('0x2')]},'userDisposition':{'type':Sequelize[_0x4d00('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4d00('0x2')]},'prefix':{'type':Sequelize[_0x4d00('0x2')]},'routeid':{'type':Sequelize[_0x4d00('0x8')]},'sipcallid':{'type':Sequelize[_0x4d00('0x2')]}}; \ No newline at end of file +var _0x7041=['outbound','inbound-fax','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','internal'];(function(_0x277cd0,_0x37ed86){var _0x4c898b=function(_0x57c0d8){while(--_0x57c0d8){_0x277cd0['push'](_0x277cd0['shift']());}};_0x4c898b(++_0x37ed86);}(_0x7041,0xdd));var _0x1704=function(_0x3d787b,_0x592f42){_0x3d787b=_0x3d787b-0x0;var _0x5ab4ce=_0x7041[_0x3d787b];return _0x5ab4ce;};'use strict';var Sequelize=require(_0x1704('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1704('0x1')]},'type':{'type':Sequelize[_0x1704('0x2')]('inbound',_0x1704('0x3'),_0x1704('0x4'),_0x1704('0x5'),'outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x1704('0x1')]},'destination':{'type':Sequelize[_0x1704('0x1')]},'destinationcontext':{'type':Sequelize[_0x1704('0x1')]},'callerid':{'type':Sequelize[_0x1704('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x1704('0x6')]},'starttime':{'type':Sequelize[_0x1704('0x7')]},'systemanswertime':{'type':Sequelize[_0x1704('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x1704('0x8')]},'mohtime':{'type':Sequelize[_0x1704('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x1704('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x1704('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x1704('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x1704('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index a59d462..5d96e82 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 _0x9536=['catch','params','filters','find','create','body','describe','user','update','uniqueid','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','promise-retry','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','send','map','VoiceCallReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','fullname','alias','User','findAll','rows'];(function(_0x1ac6c6,_0x209b0f){var _0x27a848=function(_0x5863d9){while(--_0x5863d9){_0x1ac6c6['push'](_0x1ac6c6['shift']());}};_0x27a848(++_0x209b0f);}(_0x9536,0x179));var _0x6953=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x9536[_0x2d994d];return _0xd54be4;};'use strict';var _=require(_0x6953('0x0'));var qs=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x6953('0x4'));function respondWithResult(_0x53b172,_0x42fb54){_0x42fb54=_0x42fb54||0xc8;return function(_0x3c32c7){if(_0x3c32c7){return _0x53b172[_0x6953('0x5')](_0x42fb54)[_0x6953('0x6')](_0x3c32c7);}};}function respondWithFilteredResult(_0x2f3cc3,_0x494ac2){return function(_0x2b273e){if(_0x2b273e){var _0x2bb026=typeof _0x494ac2[_0x6953('0x7')]===_0x6953('0x8')&&typeof _0x494ac2[_0x6953('0x9')]==='undefined';var _0x3e8786=_0x2b273e[_0x6953('0xa')];var _0x449acb=_0x2bb026?0x0:_0x494ac2['offset'];var _0x41f41b=_0x2bb026?_0x2b273e[_0x6953('0xa')]:_0x494ac2[_0x6953('0x7')]+_0x494ac2[_0x6953('0x9')];var _0x448c89;if(_0x41f41b>=_0x3e8786){_0x41f41b=_0x3e8786;_0x448c89=0xc8;}else{_0x448c89=0xce;}_0x2f3cc3[_0x6953('0x5')](_0x448c89);return _0x2f3cc3[_0x6953('0xb')](_0x6953('0xc'),_0x449acb+'-'+_0x41f41b+'/'+_0x3e8786)[_0x6953('0x6')](_0x2b273e);}return null;};}function saveUpdates(_0x57652e){return function(_0x358388){if(_0x358388){return _0x358388['update'](_0x57652e)[_0x6953('0xd')](function(_0x5b0558){return _0x5b0558;});}return null;};}function removeEntity(_0x3e83d5){return function(_0xe35f08){if(_0xe35f08){return _0xe35f08[_0x6953('0xe')]()[_0x6953('0xd')](function(){_0x3e83d5[_0x6953('0x5')](0xcc)[_0x6953('0xf')]();});}};}function handleEntityNotFound(_0x28433e){return function(_0x31d182){if(!_0x31d182){_0x28433e[_0x6953('0x10')](0x194);}return _0x31d182;};}function handleError(_0x548473,_0x5f49db){_0x5f49db=_0x5f49db||0x1f4;return function(_0x399b9b){logger[_0x6953('0x11')](_0x399b9b[_0x6953('0x12')]);if(_0x399b9b[_0x6953('0x13')]){delete _0x399b9b['name'];}_0x548473[_0x6953('0x5')](_0x5f49db)[_0x6953('0x14')](_0x399b9b);};}exports['index']=function(_0x10858a,_0x3207dd){var _0x283cf4={},_0x174c59={},_0xc714d3={'count':0x0,'rows':[]};var _0x4a450c=_[_0x6953('0x15')](db[_0x6953('0x16')][_0x6953('0x17')],function(_0x2ba433){return{'name':_0x2ba433[_0x6953('0x18')],'type':_0x2ba433['type'][_0x6953('0x19')]};});_0x174c59[_0x6953('0x1a')]=_['map'](_0x4a450c,_0x6953('0x13'));_0x174c59[_0x6953('0x1b')]=_[_0x6953('0x1c')](_0x10858a[_0x6953('0x1b')]);_0x174c59['filters']=_[_0x6953('0x1d')](_0x174c59[_0x6953('0x1a')],_0x174c59[_0x6953('0x1b')]);_0x283cf4['attributes']=_['intersection'](_0x174c59['model'],qs[_0x6953('0x1e')](_0x10858a[_0x6953('0x1b')]['fields']));_0x283cf4[_0x6953('0x1f')]=_0x283cf4['attributes'][_0x6953('0x20')]?_0x283cf4[_0x6953('0x1f')]:_0x174c59[_0x6953('0x1a')];if(!_0x10858a[_0x6953('0x1b')][_0x6953('0x21')](_0x6953('0x22'))){_0x283cf4['limit']=qs[_0x6953('0x9')](_0x10858a[_0x6953('0x1b')]['limit']);_0x283cf4[_0x6953('0x7')]=qs['offset'](_0x10858a[_0x6953('0x1b')][_0x6953('0x7')]);}_0x283cf4[_0x6953('0x23')]=qs['sort'](_0x10858a[_0x6953('0x1b')][_0x6953('0x24')]);_0x283cf4[_0x6953('0x25')]=qs['filters'](_[_0x6953('0x26')](_0x10858a[_0x6953('0x1b')],_0x174c59['filters']),_0x4a450c);if(_0x10858a['query'][_0x6953('0x27')]){_0x283cf4[_0x6953('0x25')]=_[_0x6953('0x28')](_0x283cf4[_0x6953('0x25')],{'$or':_[_0x6953('0x15')](_0x4a450c,function(_0x56ce8e){if(_0x56ce8e[_0x6953('0x29')]!=='VIRTUAL'){var _0x2d5e76={};_0x2d5e76[_0x56ce8e[_0x6953('0x13')]]={'$like':'%'+_0x10858a['query']['filter']+'%'};return _0x2d5e76;}})});}_0x283cf4=_[_0x6953('0x28')]({},_0x283cf4,_0x10858a[_0x6953('0x2a')]);var _0x34d10b={'where':_0x283cf4['where']};return db[_0x6953('0x16')]['count'](_0x34d10b)['then'](function(_0x5eda70){_0xc714d3['count']=_0x5eda70;if(_0x10858a[_0x6953('0x1b')][_0x6953('0x2b')]){_0x283cf4[_0x6953('0x2c')]=[{'attributes':['id',_0x6953('0x13'),_0x6953('0x2d'),_0x6953('0x2e')],'model':db['User'],'as':_0x6953('0x2f')}];}return db['VoiceCallReport'][_0x6953('0x30')](_0x283cf4);})['then'](function(_0xc63da7){_0xc714d3[_0x6953('0x31')]=_0xc63da7;return _0xc714d3;})[_0x6953('0xd')](respondWithFilteredResult(_0x3207dd,_0x283cf4))[_0x6953('0x32')](handleError(_0x3207dd,null));};exports['show']=function(_0x13c677,_0x6d9c66){var _0x15edc9={'raw':!![],'where':{'id':_0x13c677[_0x6953('0x33')]['id']}},_0xba2c1d={};_0xba2c1d[_0x6953('0x1a')]=_[_0x6953('0x1c')](db[_0x6953('0x16')][_0x6953('0x17')]);_0xba2c1d[_0x6953('0x1b')]=_[_0x6953('0x1c')](_0x13c677['query']);_0xba2c1d[_0x6953('0x34')]=_[_0x6953('0x1d')](_0xba2c1d[_0x6953('0x1a')],_0xba2c1d['query']);_0x15edc9['attributes']=_[_0x6953('0x1d')](_0xba2c1d['model'],qs['fields'](_0x13c677[_0x6953('0x1b')][_0x6953('0x1e')]));_0x15edc9['attributes']=_0x15edc9[_0x6953('0x1f')][_0x6953('0x20')]?_0x15edc9[_0x6953('0x1f')]:_0xba2c1d[_0x6953('0x1a')];if(_0x13c677[_0x6953('0x1b')][_0x6953('0x2b')]){_0x15edc9['include']=[{'all':!![]}];}_0x15edc9=_[_0x6953('0x28')]({},_0x15edc9,_0x13c677[_0x6953('0x2a')]);return db[_0x6953('0x16')][_0x6953('0x35')](_0x15edc9)[_0x6953('0xd')](handleEntityNotFound(_0x6d9c66,null))[_0x6953('0xd')](respondWithResult(_0x6d9c66,null))['catch'](handleError(_0x6d9c66,null));};exports['create']=function(_0xeef91a,_0x54d7c2){return db['VoiceCallReport'][_0x6953('0x36')](_0xeef91a[_0x6953('0x37')],{})[_0x6953('0xd')](respondWithResult(_0x54d7c2,0xc9))[_0x6953('0x32')](handleError(_0x54d7c2,null));};exports[_0x6953('0xe')]=function(_0x5ac8f7,_0x4d43fd){return db[_0x6953('0x16')][_0x6953('0x35')]({'where':{'id':_0x5ac8f7['params']['id']}})[_0x6953('0xd')](handleEntityNotFound(_0x4d43fd,null))['then'](removeEntity(_0x4d43fd,null))[_0x6953('0x32')](handleError(_0x4d43fd,null));};exports[_0x6953('0x38')]=function(_0x41a3fd,_0x26a735){return db['VoiceCallReport'][_0x6953('0x38')]()[_0x6953('0xd')](respondWithResult(_0x26a735,null))['catch'](handleError(_0x26a735,null));};function findForUpdate(_0x16c565){return db[_0x6953('0x16')][_0x6953('0x35')]({'where':{'uniqueid':_0x16c565[_0x6953('0x33')]['id'],'UserId':{'$or':[null,_0x16c565[_0x6953('0x39')]['id']]}}});}exports[_0x6953('0x3a')]=function(_0x13d1a6,_0x4f7a2f){if(_0x13d1a6[_0x6953('0x37')][_0x6953('0x3b')]){delete _0x13d1a6[_0x6953('0x37')]['uniqueid'];}return findForUpdate(_0x13d1a6)[_0x6953('0xd')](handleEntityNotFound(_0x4f7a2f,null))['then'](saveUpdates(_0x13d1a6[_0x6953('0x37')],null))[_0x6953('0xd')](respondWithResult(_0x4f7a2f,null))[_0x6953('0x32')](handleError(_0x4f7a2f,null));};exports['updateWithRetry']=function(_0xfb9613,_0x2a4e54,_0x506561){if(_0xfb9613['body'][_0x6953('0x3b')]){delete _0xfb9613[_0x6953('0x37')][_0x6953('0x3b')];}promiseRetry(function(_0x36d75a){return findForUpdate(_0xfb9613)[_0x6953('0xd')](function(_0x23b59f){if(_0x23b59f!==null){return _0x23b59f;}else{_0x36d75a(new Error(_0x6953('0x3c')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x6953('0xd')](function(_0x2baf90){if(!_0x2baf90){return new Promise(function(_0x18e8ef){_0x18e8ef(handleEntityNotFound(_0x2a4e54)());});}else{return _0x2baf90[_0x6953('0x3a')](_0xfb9613['body'])['then'](function(_0x14a7bf){return respondWithResult(_0x2a4e54)(_0x14a7bf);});}},function(){handleEntityNotFound(_0x2a4e54)();});}; \ No newline at end of file +var _0x7880=['No\x20such\x20report','lodash','../../config/logger','api','../../mysqldb','promise-retry','status','offset','undefined','count','limit','Content-Range','update','then','sendStatus','stack','name','index','map','VoiceCallReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','fullname','alias','User','rows','catch','show','params','create','body','destroy','find','describe','user','uniqueid','updateWithRetry'];(function(_0x4c32f4,_0x54e978){var _0x378354=function(_0x5962df){while(--_0x5962df){_0x4c32f4['push'](_0x4c32f4['shift']());}};_0x378354(++_0x54e978);}(_0x7880,0x10f));var _0x0788=function(_0x1233d1,_0x15cf04){_0x1233d1=_0x1233d1-0x0;var _0x56ee5e=_0x7880[_0x1233d1];return _0x56ee5e;};'use strict';var _=require(_0x0788('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var db=require(_0x0788('0x3'))['db'];const promiseRetry=require(_0x0788('0x4'));function respondWithResult(_0x2caf5c,_0x509799){_0x509799=_0x509799||0xc8;return function(_0x563529){if(_0x563529){return _0x2caf5c[_0x0788('0x5')](_0x509799)['json'](_0x563529);}};}function respondWithFilteredResult(_0x74c6b2,_0x2deca2){return function(_0x34f9f1){if(_0x34f9f1){var _0x5ece1c=typeof _0x2deca2[_0x0788('0x6')]===_0x0788('0x7')&&typeof _0x2deca2['limit']===_0x0788('0x7');var _0x466e68=_0x34f9f1[_0x0788('0x8')];var _0x95ebe3=_0x5ece1c?0x0:_0x2deca2[_0x0788('0x6')];var _0x14552f=_0x5ece1c?_0x34f9f1[_0x0788('0x8')]:_0x2deca2[_0x0788('0x6')]+_0x2deca2[_0x0788('0x9')];var _0x49aac3;if(_0x14552f>=_0x466e68){_0x14552f=_0x466e68;_0x49aac3=0xc8;}else{_0x49aac3=0xce;}_0x74c6b2[_0x0788('0x5')](_0x49aac3);return _0x74c6b2['set'](_0x0788('0xa'),_0x95ebe3+'-'+_0x14552f+'/'+_0x466e68)['json'](_0x34f9f1);}return null;};}function saveUpdates(_0x423e99){return function(_0x9d3024){if(_0x9d3024){return _0x9d3024[_0x0788('0xb')](_0x423e99)[_0x0788('0xc')](function(_0x22b39e){return _0x22b39e;});}return null;};}function removeEntity(_0x4ee22c){return function(_0x2c4682){if(_0x2c4682){return _0x2c4682['destroy']()[_0x0788('0xc')](function(){_0x4ee22c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fedd1){return function(_0x8a7e08){if(!_0x8a7e08){_0x1fedd1[_0x0788('0xd')](0x194);}return _0x8a7e08;};}function handleError(_0x57a803,_0x12553c){_0x12553c=_0x12553c||0x1f4;return function(_0x2d68b0){logger['error'](_0x2d68b0[_0x0788('0xe')]);if(_0x2d68b0[_0x0788('0xf')]){delete _0x2d68b0[_0x0788('0xf')];}_0x57a803['status'](_0x12553c)['send'](_0x2d68b0);};}exports[_0x0788('0x10')]=function(_0xf82fbc,_0x5ce32d){var _0x3f0de9={},_0x3e0ad7={},_0x44be88={'count':0x0,'rows':[]};var _0xd5e0a6=_[_0x0788('0x11')](db[_0x0788('0x12')][_0x0788('0x13')],function(_0x3e383b){return{'name':_0x3e383b['fieldName'],'type':_0x3e383b[_0x0788('0x14')][_0x0788('0x15')]};});_0x3e0ad7[_0x0788('0x16')]=_[_0x0788('0x11')](_0xd5e0a6,_0x0788('0xf'));_0x3e0ad7[_0x0788('0x17')]=_[_0x0788('0x18')](_0xf82fbc['query']);_0x3e0ad7[_0x0788('0x19')]=_[_0x0788('0x1a')](_0x3e0ad7[_0x0788('0x16')],_0x3e0ad7[_0x0788('0x17')]);_0x3f0de9['attributes']=_['intersection'](_0x3e0ad7[_0x0788('0x16')],qs[_0x0788('0x1b')](_0xf82fbc['query'][_0x0788('0x1b')]));_0x3f0de9[_0x0788('0x1c')]=_0x3f0de9['attributes'][_0x0788('0x1d')]?_0x3f0de9[_0x0788('0x1c')]:_0x3e0ad7[_0x0788('0x16')];if(!_0xf82fbc[_0x0788('0x17')]['hasOwnProperty'](_0x0788('0x1e'))){_0x3f0de9['limit']=qs['limit'](_0xf82fbc[_0x0788('0x17')][_0x0788('0x9')]);_0x3f0de9[_0x0788('0x6')]=qs[_0x0788('0x6')](_0xf82fbc['query']['offset']);}_0x3f0de9['order']=qs[_0x0788('0x1f')](_0xf82fbc[_0x0788('0x17')]['sort']);_0x3f0de9[_0x0788('0x20')]=qs[_0x0788('0x19')](_['pick'](_0xf82fbc[_0x0788('0x17')],_0x3e0ad7['filters']),_0xd5e0a6);if(_0xf82fbc[_0x0788('0x17')]['filter']){_0x3f0de9[_0x0788('0x20')]=_[_0x0788('0x21')](_0x3f0de9[_0x0788('0x20')],{'$or':_['map'](_0xd5e0a6,function(_0x4e337c){if(_0x4e337c[_0x0788('0x14')]!==_0x0788('0x22')){var _0x10b0b6={};_0x10b0b6[_0x4e337c['name']]={'$like':'%'+_0xf82fbc[_0x0788('0x17')]['filter']+'%'};return _0x10b0b6;}})});}_0x3f0de9=_[_0x0788('0x21')]({},_0x3f0de9,_0xf82fbc[_0x0788('0x23')]);var _0x182219={'where':_0x3f0de9[_0x0788('0x20')]};return db[_0x0788('0x12')][_0x0788('0x8')](_0x182219)['then'](function(_0x2659be){_0x44be88[_0x0788('0x8')]=_0x2659be;if(_0xf82fbc[_0x0788('0x17')][_0x0788('0x24')]){_0x3f0de9[_0x0788('0x25')]=[{'attributes':['id',_0x0788('0xf'),_0x0788('0x26'),_0x0788('0x27')],'model':db[_0x0788('0x28')],'as':_0x0788('0x28')}];}return db[_0x0788('0x12')]['findAll'](_0x3f0de9);})[_0x0788('0xc')](function(_0x1226e8){_0x44be88[_0x0788('0x29')]=_0x1226e8;return _0x44be88;})[_0x0788('0xc')](respondWithFilteredResult(_0x5ce32d,_0x3f0de9))[_0x0788('0x2a')](handleError(_0x5ce32d,null));};exports[_0x0788('0x2b')]=function(_0x493758,_0x1da994){var _0x574d00={'raw':!![],'where':{'id':_0x493758[_0x0788('0x2c')]['id']}},_0x377ba1={};_0x377ba1[_0x0788('0x16')]=_['keys'](db[_0x0788('0x12')][_0x0788('0x13')]);_0x377ba1['query']=_[_0x0788('0x18')](_0x493758[_0x0788('0x17')]);_0x377ba1[_0x0788('0x19')]=_[_0x0788('0x1a')](_0x377ba1[_0x0788('0x16')],_0x377ba1[_0x0788('0x17')]);_0x574d00[_0x0788('0x1c')]=_[_0x0788('0x1a')](_0x377ba1['model'],qs[_0x0788('0x1b')](_0x493758[_0x0788('0x17')][_0x0788('0x1b')]));_0x574d00[_0x0788('0x1c')]=_0x574d00['attributes'][_0x0788('0x1d')]?_0x574d00[_0x0788('0x1c')]:_0x377ba1[_0x0788('0x16')];if(_0x493758[_0x0788('0x17')][_0x0788('0x24')]){_0x574d00['include']=[{'all':!![]}];}_0x574d00=_[_0x0788('0x21')]({},_0x574d00,_0x493758['options']);return db[_0x0788('0x12')]['find'](_0x574d00)['then'](handleEntityNotFound(_0x1da994,null))['then'](respondWithResult(_0x1da994,null))[_0x0788('0x2a')](handleError(_0x1da994,null));};exports[_0x0788('0x2d')]=function(_0x3e16a0,_0x463b62){return db[_0x0788('0x12')][_0x0788('0x2d')](_0x3e16a0[_0x0788('0x2e')],{})[_0x0788('0xc')](respondWithResult(_0x463b62,0xc9))[_0x0788('0x2a')](handleError(_0x463b62,null));};exports[_0x0788('0x2f')]=function(_0x35b018,_0x267554){return db[_0x0788('0x12')][_0x0788('0x30')]({'where':{'id':_0x35b018[_0x0788('0x2c')]['id']}})[_0x0788('0xc')](handleEntityNotFound(_0x267554,null))[_0x0788('0xc')](removeEntity(_0x267554,null))[_0x0788('0x2a')](handleError(_0x267554,null));};exports[_0x0788('0x31')]=function(_0x35ca95,_0x4495da){return db['VoiceCallReport'][_0x0788('0x31')]()[_0x0788('0xc')](respondWithResult(_0x4495da,null))[_0x0788('0x2a')](handleError(_0x4495da,null));};function findForUpdate(_0x197d12){return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x197d12[_0x0788('0x2c')]['id'],'UserId':{'$or':[null,_0x197d12[_0x0788('0x32')]['id']]}}});}exports[_0x0788('0xb')]=function(_0x473c52,_0x166c16){if(_0x473c52[_0x0788('0x2e')][_0x0788('0x33')]){delete _0x473c52[_0x0788('0x2e')]['uniqueid'];}return findForUpdate(_0x473c52)[_0x0788('0xc')](handleEntityNotFound(_0x166c16,null))[_0x0788('0xc')](saveUpdates(_0x473c52[_0x0788('0x2e')],null))['then'](respondWithResult(_0x166c16,null))['catch'](handleError(_0x166c16,null));};exports[_0x0788('0x34')]=function(_0x16b510,_0x111b13,_0x5d3be7){if(_0x16b510['body'][_0x0788('0x33')]){delete _0x16b510[_0x0788('0x2e')][_0x0788('0x33')];}promiseRetry(function(_0x31aa04){return findForUpdate(_0x16b510)[_0x0788('0xc')](function(_0x51ae93){if(_0x51ae93!==null){return _0x51ae93;}else{_0x31aa04(new Error(_0x0788('0x35')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x2c12b3){if(!_0x2c12b3){return new Promise(function(_0x1d64ec){_0x1d64ec(handleEntityNotFound(_0x111b13)());});}else{return _0x2c12b3[_0x0788('0xb')](_0x16b510['body'])['then'](function(_0x2731fd){return respondWithResult(_0x111b13)(_0x2731fd);});}},function(){handleEntityNotFound(_0x111b13)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index d2d9db4..4b31def 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 _0x4778=['util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x43b5b9,_0x100118){var _0x4fa582=function(_0x45d899){while(--_0x45d899){_0x43b5b9['push'](_0x43b5b9['shift']());}};_0x4fa582(++_0x100118);}(_0x4778,0x6b));var _0x8477=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x4778[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x8477('0x0'));var util=require(_0x8477('0x1'));var logger=require('../../config/logger')(_0x8477('0x2'));var moment=require('moment');var BPromise=require(_0x8477('0x3'));var rp=require(_0x8477('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8477('0x5'));var config=require(_0x8477('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x8477('0x7')]=function(_0x419654,_0x23abbe){return _0x419654[_0x8477('0x8')](_0x8477('0x9'),attributes,{'tableName':_0x8477('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8477('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d25=['path','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','util','api','moment','bluebird','request-promise'];(function(_0x460937,_0xcb54ec){var _0x4ef43c=function(_0x2d76cf){while(--_0x2d76cf){_0x460937['push'](_0x460937['shift']());}};_0x4ef43c(++_0xcb54ec);}(_0x5d25,0x103));var _0x55d2=function(_0x22d23d,_0x14557b){_0x22d23d=_0x22d23d-0x0;var _0x4e1056=_0x5d25[_0x22d23d];return _0x4e1056;};'use strict';var _=require('lodash');var util=require(_0x55d2('0x0'));var logger=require('../../config/logger')(_0x55d2('0x1'));var moment=require(_0x55d2('0x2'));var BPromise=require(_0x55d2('0x3'));var rp=require(_0x55d2('0x4'));var fs=require('fs');var path=require(_0x55d2('0x5'));var rimraf=require('rimraf');var config=require(_0x55d2('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x55d2('0x7')]=function(_0x2729ae,_0x11569f){return _0x2729ae[_0x55d2('0x8')](_0x55d2('0x9'),attributes,{'tableName':_0x55d2('0xa'),'paranoid':![],'indexes':[{'fields':[_0x55d2('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 b98b819..2f6678d 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 _0x3921=['stringify','error','message','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s'];(function(_0xc08430,_0x3b2267){var _0x5091d4=function(_0x5cda01){while(--_0x5cda01){_0xc08430['push'](_0xc08430['shift']());}};_0x5091d4(++_0x3b2267);}(_0x3921,0x1db));var _0x1392=function(_0x4d23ce,_0x4a7c7b){_0x4d23ce=_0x4d23ce-0x0;var _0xddbf96=_0x3921[_0x4d23ce];return _0xddbf96;};'use strict';var _=require(_0x1392('0x0'));var util=require(_0x1392('0x1'));var moment=require(_0x1392('0x2'));var BPromise=require('bluebird');var rs=require(_0x1392('0x3'));var fs=require('fs');var Redis=require(_0x1392('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1392('0x5'));var logger=require(_0x1392('0x6'))(_0x1392('0x7'));var config=require(_0x1392('0x8'));var jayson=require(_0x1392('0x9'));var client=jayson[_0x1392('0xa')][_0x1392('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bfcf0,_0x1f56c1,_0x1bbb4c){return new BPromise(function(_0x3d4840,_0x31a464){return client[_0x1392('0xc')](_0x3bfcf0,_0x1bbb4c)[_0x1392('0xd')](function(_0x4d6a45){logger[_0x1392('0xe')](_0x1392('0xf'),_0x1f56c1,_0x1392('0x10'));logger[_0x1392('0x11')](_0x1392('0x12'),_0x1f56c1,'request\x20sent',JSON[_0x1392('0x13')](_0x4d6a45));if(_0x4d6a45['error']){if(_0x4d6a45['error']['code']===0x1f4){logger[_0x1392('0x14')](_0x1392('0xf'),_0x1f56c1,_0x4d6a45[_0x1392('0x14')][_0x1392('0x15')]);return _0x31a464(_0x4d6a45['error'][_0x1392('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x1f56c1,_0x4d6a45[_0x1392('0x14')][_0x1392('0x15')]);return _0x3d4840(_0x4d6a45[_0x1392('0x14')]['message']);}else{logger[_0x1392('0xe')](_0x1392('0xf'),_0x1f56c1,_0x1392('0x10'));_0x3d4840(_0x4d6a45['result'][_0x1392('0x15')]);}})[_0x1392('0x16')](function(_0x49d2af){logger[_0x1392('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x1f56c1,_0x49d2af);_0x31a464(_0x49d2af);});});}exports[_0x1392('0x17')]=function(_0xcf8d2e){var _0x588465=this;return new Promise(function(_0x566cb5,_0x2746ff){return db[_0x1392('0x18')]['findAll']({'raw':_0xcf8d2e[_0x1392('0x19')]?_0xcf8d2e[_0x1392('0x19')][_0x1392('0x1a')]===undefined?!![]:![]:!![],'where':_0xcf8d2e['options']?_0xcf8d2e['options'][_0x1392('0x1b')]||null:null,'attributes':_0xcf8d2e['options']?_0xcf8d2e[_0x1392('0x19')][_0x1392('0x1c')]||null:null,'limit':_0xcf8d2e['options']?_0xcf8d2e['options'][_0x1392('0x1d')]||null:null,'include':_0xcf8d2e[_0x1392('0x19')]?_0xcf8d2e[_0x1392('0x19')][_0x1392('0x1e')]?_[_0x1392('0x1f')](_0xcf8d2e['options'][_0x1392('0x1e')],function(_0x88e96a){return{'model':db[_0x88e96a['model']],'as':_0x88e96a['as'],'attributes':_0x88e96a[_0x1392('0x1c')],'include':_0x88e96a[_0x1392('0x1e')]?_[_0x1392('0x1f')](_0x88e96a[_0x1392('0x1e')],function(_0x1d73a9){return{'model':db[_0x1d73a9['model']],'as':_0x1d73a9['as'],'attributes':_0x1d73a9[_0x1392('0x1c')],'include':_0x1d73a9[_0x1392('0x1e')]?_[_0x1392('0x1f')](_0x1d73a9['include'],function(_0x1bdd4f){return{'model':db[_0x1bdd4f[_0x1392('0x20')]],'as':_0x1bdd4f['as'],'attributes':_0x1bdd4f[_0x1392('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1392('0xd')](function(_0x26653f){logger[_0x1392('0xe')](_0x1392('0x17'),_0xcf8d2e);logger[_0x1392('0x11')](_0x1392('0x17'),_0xcf8d2e,JSON[_0x1392('0x13')](_0x26653f));_0x566cb5(_0x26653f);})['catch'](function(_0x423607){logger[_0x1392('0x14')]('GetVoiceCallReport',_0x423607[_0x1392('0x15')],_0xcf8d2e);_0x2746ff(_0x588465[_0x1392('0x14')](0x1f4,_0x423607[_0x1392('0x15')]));});});};exports['CreateVoiceCallReport']=function(_0x481312){var _0x52f9e6=this;return new Promise(function(_0x6dbc67,_0x4080a9){return db[_0x1392('0x18')][_0x1392('0x21')](_0x481312['body'],{'raw':_0x481312[_0x1392('0x19')]?_0x481312[_0x1392('0x19')][_0x1392('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x57ddfd){logger[_0x1392('0xe')](_0x1392('0x22'),_0x481312);logger[_0x1392('0x11')](_0x1392('0x22'),_0x481312,JSON['stringify'](_0x57ddfd));_0x6dbc67(_0x57ddfd);})[_0x1392('0x16')](function(_0x82a15a){logger[_0x1392('0x14')](_0x1392('0x22'),_0x82a15a[_0x1392('0x15')],_0x481312);_0x4080a9(_0x52f9e6['error'](0x1f4,_0x82a15a[_0x1392('0x15')]));});});};exports[_0x1392('0x23')]=function(_0x6efa39){var _0x2061f4=this;return new Promise(function(_0x3baa70,_0x525d98){return db['VoiceCallReport'][_0x1392('0x24')](_0x6efa39[_0x1392('0x25')],{'raw':_0x6efa39[_0x1392('0x19')]?_0x6efa39[_0x1392('0x19')][_0x1392('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6efa39[_0x1392('0x19')]?_0x6efa39[_0x1392('0x19')][_0x1392('0x1b')]||null:null,'attributes':_0x6efa39[_0x1392('0x19')]?_0x6efa39[_0x1392('0x19')]['attributes']||null:null,'limit':_0x6efa39[_0x1392('0x19')]?_0x6efa39[_0x1392('0x19')][_0x1392('0x1d')]||null:null})[_0x1392('0xd')](function(_0x104716){logger[_0x1392('0xe')](_0x1392('0x23'),_0x6efa39);logger[_0x1392('0x11')]('UpdateVoiceCallReport',_0x6efa39,JSON[_0x1392('0x13')](_0x104716));_0x3baa70(_0x104716);})[_0x1392('0x16')](function(_0x24be74){logger[_0x1392('0x14')](_0x1392('0x23'),_0x24be74[_0x1392('0x15')],_0x6efa39);_0x525d98(_0x2061f4['error'](0x1f4,_0x24be74['message']));});});}; \ No newline at end of file +var _0x3fe9=['result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','info','stringify','catch','CreateVoiceCallReport','body','UpdateVoiceCallReport','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3fe9,0x179));var _0x93fe=function(_0x169781,_0x184226){_0x169781=_0x169781-0x0;var _0x175833=_0x3fe9[_0x169781];return _0x175833;};'use strict';var _=require(_0x93fe('0x0'));var util=require(_0x93fe('0x1'));var moment=require(_0x93fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93fe('0x3'));var db=require(_0x93fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x93fe('0x5'))(_0x93fe('0x6'));var config=require(_0x93fe('0x7'));var jayson=require(_0x93fe('0x8'));var client=jayson['client'][_0x93fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42ebb7,_0x3ed263,_0x311a8c){return new BPromise(function(_0x4cde9c,_0x3d89c5){return client[_0x93fe('0xa')](_0x42ebb7,_0x311a8c)[_0x93fe('0xb')](function(_0x8d0c1f){logger['info'](_0x93fe('0xc'),_0x3ed263,'request\x20sent');logger[_0x93fe('0xd')](_0x93fe('0xe'),_0x3ed263,_0x93fe('0xf'),JSON['stringify'](_0x8d0c1f));if(_0x8d0c1f['error']){if(_0x8d0c1f[_0x93fe('0x10')][_0x93fe('0x11')]===0x1f4){logger[_0x93fe('0x10')](_0x93fe('0xc'),_0x3ed263,_0x8d0c1f['error'][_0x93fe('0x12')]);return _0x3d89c5(_0x8d0c1f[_0x93fe('0x10')][_0x93fe('0x12')]);}logger[_0x93fe('0x10')](_0x93fe('0xc'),_0x3ed263,_0x8d0c1f[_0x93fe('0x10')]['message']);return _0x4cde9c(_0x8d0c1f[_0x93fe('0x10')][_0x93fe('0x12')]);}else{logger['info'](_0x93fe('0xc'),_0x3ed263,'request\x20sent');_0x4cde9c(_0x8d0c1f[_0x93fe('0x13')][_0x93fe('0x12')]);}})['catch'](function(_0x55e76d){logger[_0x93fe('0x10')](_0x93fe('0xc'),_0x3ed263,_0x55e76d);_0x3d89c5(_0x55e76d);});});}exports[_0x93fe('0x14')]=function(_0x21c628){var _0x4966d7=this;return new Promise(function(_0xd3371,_0x819a7a){return db[_0x93fe('0x15')][_0x93fe('0x16')]({'raw':_0x21c628[_0x93fe('0x17')]?_0x21c628[_0x93fe('0x17')][_0x93fe('0x18')]===undefined?!![]:![]:!![],'where':_0x21c628[_0x93fe('0x17')]?_0x21c628[_0x93fe('0x17')]['where']||null:null,'attributes':_0x21c628[_0x93fe('0x17')]?_0x21c628[_0x93fe('0x17')][_0x93fe('0x19')]||null:null,'limit':_0x21c628[_0x93fe('0x17')]?_0x21c628[_0x93fe('0x17')][_0x93fe('0x1a')]||null:null,'include':_0x21c628[_0x93fe('0x17')]?_0x21c628[_0x93fe('0x17')][_0x93fe('0x1b')]?_[_0x93fe('0x1c')](_0x21c628[_0x93fe('0x17')][_0x93fe('0x1b')],function(_0x320b65){return{'model':db[_0x320b65[_0x93fe('0x1d')]],'as':_0x320b65['as'],'attributes':_0x320b65[_0x93fe('0x19')],'include':_0x320b65[_0x93fe('0x1b')]?_[_0x93fe('0x1c')](_0x320b65['include'],function(_0x5de0da){return{'model':db[_0x5de0da[_0x93fe('0x1d')]],'as':_0x5de0da['as'],'attributes':_0x5de0da[_0x93fe('0x19')],'include':_0x5de0da[_0x93fe('0x1b')]?_[_0x93fe('0x1c')](_0x5de0da['include'],function(_0x1b9c98){return{'model':db[_0x1b9c98['model']],'as':_0x1b9c98['as'],'attributes':_0x1b9c98[_0x93fe('0x19')]};}):[]};}):[]};}):[]:[]})[_0x93fe('0xb')](function(_0x4fe726){logger[_0x93fe('0x1e')](_0x93fe('0x14'),_0x21c628);logger[_0x93fe('0xd')](_0x93fe('0x14'),_0x21c628,JSON[_0x93fe('0x1f')](_0x4fe726));_0xd3371(_0x4fe726);})[_0x93fe('0x20')](function(_0x2ace42){logger[_0x93fe('0x10')](_0x93fe('0x14'),_0x2ace42['message'],_0x21c628);_0x819a7a(_0x4966d7[_0x93fe('0x10')](0x1f4,_0x2ace42[_0x93fe('0x12')]));});});};exports[_0x93fe('0x21')]=function(_0x3aa34e){var _0x2cd788=this;return new Promise(function(_0x333f7a,_0x3c7455){return db[_0x93fe('0x15')]['create'](_0x3aa34e[_0x93fe('0x22')],{'raw':_0x3aa34e[_0x93fe('0x17')]?_0x3aa34e['options']['raw']===undefined?!![]:![]:!![]})[_0x93fe('0xb')](function(_0x2b756a){logger[_0x93fe('0x1e')](_0x93fe('0x21'),_0x3aa34e);logger[_0x93fe('0xd')](_0x93fe('0x21'),_0x3aa34e,JSON[_0x93fe('0x1f')](_0x2b756a));_0x333f7a(_0x2b756a);})[_0x93fe('0x20')](function(_0x591680){logger[_0x93fe('0x10')](_0x93fe('0x21'),_0x591680[_0x93fe('0x12')],_0x3aa34e);_0x3c7455(_0x2cd788[_0x93fe('0x10')](0x1f4,_0x591680[_0x93fe('0x12')]));});});};exports[_0x93fe('0x23')]=function(_0x174fa6){var _0x19029e=this;return new Promise(function(_0x57f4a2,_0x62bd2d){return db['VoiceCallReport']['update'](_0x174fa6[_0x93fe('0x22')],{'raw':_0x174fa6[_0x93fe('0x17')]?_0x174fa6[_0x93fe('0x17')][_0x93fe('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x174fa6[_0x93fe('0x17')]?_0x174fa6[_0x93fe('0x17')]['where']||null:null,'attributes':_0x174fa6[_0x93fe('0x17')]?_0x174fa6['options'][_0x93fe('0x19')]||null:null,'limit':_0x174fa6[_0x93fe('0x17')]?_0x174fa6[_0x93fe('0x17')]['limit']||null:null})[_0x93fe('0xb')](function(_0x2afffe){logger[_0x93fe('0x1e')](_0x93fe('0x23'),_0x174fa6);logger[_0x93fe('0xd')](_0x93fe('0x23'),_0x174fa6,JSON[_0x93fe('0x1f')](_0x2afffe));_0x57f4a2(_0x2afffe);})[_0x93fe('0x20')](function(_0x40b20d){logger[_0x93fe('0x10')](_0x93fe('0x23'),_0x40b20d[_0x93fe('0x12')],_0x174fa6);_0x62bd2d(_0x19029e[_0x93fe('0x10')](0x1f4,_0x40b20d[_0x93fe('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 4babe59..925df10 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 _0xac3d=['get','/:id','isAuthenticated','show','create','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4cc46a,_0xe3149e){var _0x246f8f=function(_0x53737b){while(--_0x53737b){_0x4cc46a['push'](_0x4cc46a['shift']());}};_0x246f8f(++_0xe3149e);}(_0xac3d,0x1ca));var _0xdac3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac3d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdac3('0x0'));var util=require('util');var path=require(_0xdac3('0x1'));var timeout=require('connect-timeout');var express=require(_0xdac3('0x2'));var router=express[_0xdac3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdac3('0x4'));var interaction=require(_0xdac3('0x5'));var config=require(_0xdac3('0x6'));var controller=require('./voiceChanSpy.controller');router[_0xdac3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdac3('0x7')](_0xdac3('0x8'),auth[_0xdac3('0x9')](),controller[_0xdac3('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdac3('0xb')]);router['put'](_0xdac3('0x8'),auth[_0xdac3('0x9')](),controller[_0xdac3('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xdac3('0xd')]);module[_0xdac3('0xe')]=router; \ No newline at end of file +var _0xcd44=['../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0xcd44,0x13e));var _0x4cd4=function(_0x1a2028,_0x4699be){_0x1a2028=_0x1a2028-0x0;var _0x3e97fe=_0xcd44[_0x1a2028];return _0x3e97fe;};'use strict';var multer=require(_0x4cd4('0x0'));var util=require(_0x4cd4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4cd4('0x2'));var router=express[_0x4cd4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4cd4('0x4'));var interaction=require(_0x4cd4('0x5'));var config=require(_0x4cd4('0x6'));var controller=require(_0x4cd4('0x7'));router['get']('/',auth[_0x4cd4('0x8')](),controller[_0x4cd4('0x9')]);router[_0x4cd4('0xa')](_0x4cd4('0xb'),auth['isAuthenticated'](),controller[_0x4cd4('0xc')]);router[_0x4cd4('0xd')]('/',auth[_0x4cd4('0x8')](),controller[_0x4cd4('0xe')]);router[_0x4cd4('0xf')](_0x4cd4('0xb'),auth[_0x4cd4('0x8')](),controller[_0x4cd4('0x10')]);router[_0x4cd4('0x11')](_0x4cd4('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 15b3e89..fafe34a 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 _0x748e=['options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x575a89,_0x154725){var _0x4e4ba9=function(_0x3fec89){while(--_0x3fec89){_0x575a89['push'](_0x575a89['shift']());}};_0x4e4ba9(++_0x154725);}(_0x748e,0x1d9));var _0xe748=function(_0x532d78,_0x25b6a8){_0x532d78=_0x532d78-0x0;var _0x5990c4=_0x748e[_0x532d78];return _0x5990c4;};'use strict';var Sequelize=require(_0xe748('0x0'));module[_0xe748('0x1')]={'name':{'type':Sequelize[_0xe748('0x2')]},'prefix':{'type':Sequelize[_0xe748('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xe748('0x2')],'set':function(_0x1b0e97){this[_0xe748('0x3')](_0xe748('0x4'),_0x1b0e97?_0x1b0e97[_0xe748('0x5')](''):[]);},'get':function(){return this[_0xe748('0x6')](_0xe748('0x4'))?this[_0xe748('0x6')](_0xe748('0x4'))[_0xe748('0x7')](''):[];}},'auth':{'type':Sequelize[_0xe748('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xe748('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe748('0x2')]}}; \ No newline at end of file +var _0x8116=['BOOLEAN','STRING','name','setDataValue','options','getDataValue','split'];(function(_0x51e117,_0x1b296e){var _0x2f276d=function(_0x155beb){while(--_0x155beb){_0x51e117['push'](_0x51e117['shift']());}};_0x2f276d(++_0x1b296e);}(_0x8116,0x1c8));var _0x6811=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8116[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x6811('0x0')],'unique':_0x6811('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x6811('0x0')],'set':function(_0x25ef56){this[_0x6811('0x2')](_0x6811('0x3'),_0x25ef56?_0x25ef56['join'](''):[]);},'get':function(){return this[_0x6811('0x4')](_0x6811('0x3'))?this[_0x6811('0x4')](_0x6811('0x3'))[_0x6811('0x5')](''):[];}},'auth':{'type':Sequelize[_0x6811('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x6811('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6811('0x0')]},'description':{'type':Sequelize[_0x6811('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 7115aba..bfbe856 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 _0xfa2f=['ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','keys','intersection','query','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0xef93cf,_0x51d651){var _0x2147ba=function(_0x2a9842){while(--_0x2a9842){_0xef93cf['push'](_0xef93cf['shift']());}};_0x2147ba(++_0x51d651);}(_0xfa2f,0xe8));var _0xffa2=function(_0x36f4e1,_0xd8a2a7){_0x36f4e1=_0x36f4e1-0x0;var _0x2c7dfa=_0xfa2f[_0x36f4e1];return _0x2c7dfa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xffa2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffa2('0x1'));var moment=require(_0xffa2('0x2'));var BPromise=require(_0xffa2('0x3'));var Mustache=require('mustache');var util=require(_0xffa2('0x4'));var path=require(_0xffa2('0x5'));var sox=require(_0xffa2('0x6'));var csv=require(_0xffa2('0x7'));var ejs=require(_0xffa2('0x8'));var fs=require('fs');var fs_extra=require(_0xffa2('0x9'));var _=require(_0xffa2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xffa2('0xb'));var deskjs=require(_0xffa2('0xc'));var toCsv=require(_0xffa2('0x7'));var querystring=require(_0xffa2('0xd'));var Papa=require(_0xffa2('0xe'));var Redis=require(_0xffa2('0xf'));var authService=require(_0xffa2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xffa2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffa2('0x12'));var utils=require(_0xffa2('0x13'));var config=require(_0xffa2('0x14'));var licenseUtil=require(_0xffa2('0x15'));var db=require(_0xffa2('0x16'))['db'];function respondWithStatusCode(_0x569ebb,_0x33acac){_0x33acac=_0x33acac||0xcc;return function(_0x3f9363){if(_0x3f9363){return _0x569ebb[_0xffa2('0x17')](_0x33acac);}return _0x569ebb[_0xffa2('0x18')](_0x33acac)['end']();};}function respondWithResult(_0x5f44cc,_0x32e54e){_0x32e54e=_0x32e54e||0xc8;return function(_0x19a880){if(_0x19a880){return _0x5f44cc[_0xffa2('0x18')](_0x32e54e)['json'](_0x19a880);}};}function respondWithFilteredResult(_0x2d6803,_0x31a57f){return function(_0x2c4035){if(_0x2c4035){var _0x4019b3=typeof _0x31a57f[_0xffa2('0x19')]===_0xffa2('0x1a')&&typeof _0x31a57f[_0xffa2('0x1b')]==='undefined';var _0x2c83d7=_0x2c4035[_0xffa2('0x1c')];var _0x923abf=_0x4019b3?0x0:_0x31a57f[_0xffa2('0x19')];var _0x2b71e7=_0x4019b3?_0x2c4035[_0xffa2('0x1c')]:_0x31a57f[_0xffa2('0x19')]+_0x31a57f[_0xffa2('0x1b')];var _0x2e93c0;if(_0x2b71e7>=_0x2c83d7){_0x2b71e7=_0x2c83d7;_0x2e93c0=0xc8;}else{_0x2e93c0=0xce;}_0x2d6803[_0xffa2('0x18')](_0x2e93c0);return _0x2d6803[_0xffa2('0x1d')](_0xffa2('0x1e'),_0x923abf+'-'+_0x2b71e7+'/'+_0x2c83d7)['json'](_0x2c4035);}return null;};}function patchUpdates(_0x6c9785){return function(_0x54c2f){try{jsonpatch[_0xffa2('0x1f')](_0x54c2f,_0x6c9785,!![]);}catch(_0x57ac03){return BPromise[_0xffa2('0x20')](_0x57ac03);}return _0x54c2f['save']();};}function saveUpdates(_0x204a0f,_0x3f602c){return function(_0x15edba){if(_0x15edba){return _0x15edba[_0xffa2('0x21')](_0x204a0f)[_0xffa2('0x22')](function(_0x3e6b5e){return _0x3e6b5e;});}return null;};}function removeEntity(_0x341522,_0x251a0d){return function(_0xcfec26){if(_0xcfec26){return _0xcfec26[_0xffa2('0x23')]()['then'](function(){var _0x1d62b1=_0xcfec26[_0xffa2('0x24')]({'plain':!![]});var _0x4d97a3=_0xffa2('0x25');return db[_0xffa2('0x26')][_0xffa2('0x23')]({'where':{'type':_0x4d97a3,'resourceId':_0x1d62b1['id']}})[_0xffa2('0x22')](function(){return _0xcfec26;});})[_0xffa2('0x22')](function(){_0x341522[_0xffa2('0x18')](0xcc)[_0xffa2('0x27')]();});}};}function handleEntityNotFound(_0x361540,_0x4e10b4){return function(_0x2d4376){if(!_0x2d4376){_0x361540[_0xffa2('0x17')](0x194);}return _0x2d4376;};}function handleError(_0x1f91bc,_0x48cdf3){_0x48cdf3=_0x48cdf3||0x1f4;return function(_0x45fa74){logger[_0xffa2('0x28')](_0x45fa74[_0xffa2('0x29')]);if(_0x45fa74['name']){delete _0x45fa74[_0xffa2('0x2a')];}_0x1f91bc[_0xffa2('0x18')](_0x48cdf3)[_0xffa2('0x2b')](_0x45fa74);};}exports[_0xffa2('0x2c')]=function(_0x183076,_0x2824cc){var _0x42568d={},_0x62170b={},_0x3f3d6c={'count':0x0,'rows':[]};var _0xd58f36=_[_0xffa2('0x2d')](db[_0xffa2('0x2e')][_0xffa2('0x2f')],function(_0x29be46){return{'name':_0x29be46[_0xffa2('0x30')],'type':_0x29be46['type'][_0xffa2('0x31')]};});_0x62170b[_0xffa2('0x32')]=_['map'](_0xd58f36,_0xffa2('0x2a'));_0x62170b['query']=_[_0xffa2('0x33')](_0x183076['query']);_0x62170b['filters']=_[_0xffa2('0x34')](_0x62170b['model'],_0x62170b[_0xffa2('0x35')]);_0x42568d['attributes']=_[_0xffa2('0x34')](_0x62170b[_0xffa2('0x32')],qs[_0xffa2('0x36')](_0x183076[_0xffa2('0x35')]['fields']));_0x42568d[_0xffa2('0x37')]=_0x42568d['attributes'][_0xffa2('0x38')]?_0x42568d[_0xffa2('0x37')]:_0x62170b[_0xffa2('0x32')];if(!_0x183076['query']['hasOwnProperty'](_0xffa2('0x39'))){_0x42568d[_0xffa2('0x1b')]=qs[_0xffa2('0x1b')](_0x183076['query'][_0xffa2('0x1b')]);_0x42568d['offset']=qs[_0xffa2('0x19')](_0x183076[_0xffa2('0x35')][_0xffa2('0x19')]);}_0x42568d[_0xffa2('0x3a')]=qs[_0xffa2('0x3b')](_0x183076[_0xffa2('0x35')][_0xffa2('0x3b')]);_0x42568d[_0xffa2('0x3c')]=qs[_0xffa2('0x3d')](_[_0xffa2('0x3e')](_0x183076[_0xffa2('0x35')],_0x62170b[_0xffa2('0x3d')]),_0xd58f36);if(_0x183076['query'][_0xffa2('0x3f')]){_0x42568d['where']=_[_0xffa2('0x40')](_0x42568d[_0xffa2('0x3c')],{'$or':_[_0xffa2('0x2d')](_0xd58f36,function(_0x41d486){if(_0x41d486[_0xffa2('0x41')]!=='VIRTUAL'){var _0x2e2d0b={};_0x2e2d0b[_0x41d486['name']]={'$like':'%'+_0x183076[_0xffa2('0x35')]['filter']+'%'};return _0x2e2d0b;}})});}_0x42568d=_['merge']({},_0x42568d,_0x183076[_0xffa2('0x42')]);var _0x21a6cb={'where':_0x42568d[_0xffa2('0x3c')]};return db[_0xffa2('0x2e')][_0xffa2('0x1c')](_0x21a6cb)['then'](function(_0x4efcdb){_0x3f3d6c[_0xffa2('0x1c')]=_0x4efcdb;if(_0x183076[_0xffa2('0x35')][_0xffa2('0x43')]){_0x42568d[_0xffa2('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xffa2('0x45')](_0x42568d);})[_0xffa2('0x22')](function(_0x386b81){_0x3f3d6c['rows']=_0x386b81;return _0x3f3d6c;})[_0xffa2('0x22')](respondWithFilteredResult(_0x2824cc,_0x42568d))[_0xffa2('0x46')](handleError(_0x2824cc,null));};exports['show']=function(_0x32fd9e,_0x4b7d7a){var _0x10bd17={'raw':![],'where':{'id':_0x32fd9e['params']['id']}},_0x4a42f0={};_0x4a42f0[_0xffa2('0x32')]=_[_0xffa2('0x33')](db[_0xffa2('0x2e')][_0xffa2('0x2f')]);_0x4a42f0['query']=_[_0xffa2('0x33')](_0x32fd9e['query']);_0x4a42f0[_0xffa2('0x3d')]=_[_0xffa2('0x34')](_0x4a42f0[_0xffa2('0x32')],_0x4a42f0[_0xffa2('0x35')]);_0x10bd17['attributes']=_[_0xffa2('0x34')](_0x4a42f0['model'],qs[_0xffa2('0x36')](_0x32fd9e['query'][_0xffa2('0x36')]));_0x10bd17[_0xffa2('0x37')]=_0x10bd17[_0xffa2('0x37')][_0xffa2('0x38')]?_0x10bd17[_0xffa2('0x37')]:_0x4a42f0[_0xffa2('0x32')];if(_0x32fd9e[_0xffa2('0x35')][_0xffa2('0x43')]){_0x10bd17[_0xffa2('0x44')]=[{'all':!![]}];}_0x10bd17=_[_0xffa2('0x40')]({},_0x10bd17,_0x32fd9e[_0xffa2('0x42')]);return db['VoiceChanSpy'][_0xffa2('0x47')](_0x10bd17)[_0xffa2('0x22')](handleEntityNotFound(_0x4b7d7a,null))[_0xffa2('0x22')](respondWithResult(_0x4b7d7a,null))[_0xffa2('0x46')](handleError(_0x4b7d7a,null));};exports[_0xffa2('0x48')]=function(_0x11f72e,_0x198fd5){return db[_0xffa2('0x2e')][_0xffa2('0x48')](_0x11f72e[_0xffa2('0x49')],{})[_0xffa2('0x22')](function(_0x5a1ec1){var _0x4c3c72=_0x11f72e[_0xffa2('0x4a')]['get']({'plain':!![]});if(!_0x4c3c72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c3c72[_0xffa2('0x4b')]==='user'){var _0x1b474c=_0x5a1ec1[_0xffa2('0x24')]({'plain':!![]});var _0xaf9515='ChanSpies';return db[_0xffa2('0x4c')][_0xffa2('0x47')]({'where':{'name':_0xaf9515,'userProfileId':_0x4c3c72[_0xffa2('0x4d')]},'raw':!![]})[_0xffa2('0x22')](function(_0x278795){if(_0x278795&&_0x278795['autoAssociation']===0x0){return db[_0xffa2('0x26')]['create']({'name':_0x1b474c['name'],'resourceId':_0x1b474c['id'],'type':_0x278795[_0xffa2('0x2a')],'sectionId':_0x278795['id']},{})[_0xffa2('0x22')](function(){return _0x5a1ec1;});}else{return _0x5a1ec1;}})['catch'](function(_0x508f81){logger[_0xffa2('0x28')](_0xffa2('0x4e'),_0x508f81);throw _0x508f81;});}return _0x5a1ec1;})[_0xffa2('0x22')](respondWithResult(_0x198fd5,0xc9))[_0xffa2('0x46')](handleError(_0x198fd5,null));};exports['update']=function(_0xd5fc3,_0x5f17ae){if(_0xd5fc3[_0xffa2('0x49')]['id']){delete _0xd5fc3[_0xffa2('0x49')]['id'];}return db[_0xffa2('0x2e')][_0xffa2('0x47')]({'where':{'id':_0xd5fc3[_0xffa2('0x4f')]['id']}})[_0xffa2('0x22')](handleEntityNotFound(_0x5f17ae,null))[_0xffa2('0x22')](saveUpdates(_0xd5fc3['body'],null))[_0xffa2('0x22')](respondWithResult(_0x5f17ae,null))['catch'](handleError(_0x5f17ae,null));};exports[_0xffa2('0x23')]=function(_0xfd6e2d,_0xd2f63){return db[_0xffa2('0x2e')][_0xffa2('0x47')]({'where':{'id':_0xfd6e2d[_0xffa2('0x4f')]['id']}})[_0xffa2('0x22')](handleEntityNotFound(_0xd2f63,null))[_0xffa2('0x22')](removeEntity(_0xd2f63,null))[_0xffa2('0x46')](handleError(_0xd2f63,null));}; \ No newline at end of file +var _0x01fe=['where','filters','pick','filter','merge','options','includeAll','include','catch','show','rawAttributes','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x1af1f0,_0x3dfb39){var _0x5c4479=function(_0x271c36){while(--_0x271c36){_0x1af1f0['push'](_0x1af1f0['shift']());}};_0x5c4479(++_0x3dfb39);}(_0x01fe,0x102));var _0xe01f=function(_0x24688c,_0x198dc9){_0x24688c=_0x24688c-0x0;var _0x2e8a35=_0x01fe[_0x24688c];return _0x2e8a35;};'use strict';var emlformat=require(_0xe01f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe01f('0x1'));var jsonpatch=require(_0xe01f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe01f('0x3'));var Mustache=require(_0xe01f('0x4'));var util=require(_0xe01f('0x5'));var path=require(_0xe01f('0x6'));var sox=require('sox');var csv=require(_0xe01f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe01f('0x8'));var _=require(_0xe01f('0x9'));var squel=require(_0xe01f('0xa'));var crypto=require(_0xe01f('0xb'));var jsforce=require(_0xe01f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe01f('0x7'));var querystring=require(_0xe01f('0xd'));var Papa=require('papaparse');var Redis=require(_0xe01f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe01f('0xf'));var as=require(_0xe01f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe01f('0x11'))('api');var utils=require(_0xe01f('0x12'));var config=require(_0xe01f('0x13'));var licenseUtil=require(_0xe01f('0x14'));var db=require(_0xe01f('0x15'))['db'];function respondWithStatusCode(_0x2d3162,_0x94e3d8){_0x94e3d8=_0x94e3d8||0xcc;return function(_0x81aef3){if(_0x81aef3){return _0x2d3162[_0xe01f('0x16')](_0x94e3d8);}return _0x2d3162['status'](_0x94e3d8)[_0xe01f('0x17')]();};}function respondWithResult(_0x3a9b4b,_0x2d55c8){_0x2d55c8=_0x2d55c8||0xc8;return function(_0x3cb8ac){if(_0x3cb8ac){return _0x3a9b4b[_0xe01f('0x18')](_0x2d55c8)[_0xe01f('0x19')](_0x3cb8ac);}};}function respondWithFilteredResult(_0x664fbb,_0x5e5e30){return function(_0x53d3a1){if(_0x53d3a1){var _0x5e3877=typeof _0x5e5e30[_0xe01f('0x1a')]===_0xe01f('0x1b')&&typeof _0x5e5e30[_0xe01f('0x1c')]===_0xe01f('0x1b');var _0x26cd4c=_0x53d3a1[_0xe01f('0x1d')];var _0x144eef=_0x5e3877?0x0:_0x5e5e30[_0xe01f('0x1a')];var _0x9ee4b5=_0x5e3877?_0x53d3a1[_0xe01f('0x1d')]:_0x5e5e30['offset']+_0x5e5e30[_0xe01f('0x1c')];var _0x5ca305;if(_0x9ee4b5>=_0x26cd4c){_0x9ee4b5=_0x26cd4c;_0x5ca305=0xc8;}else{_0x5ca305=0xce;}_0x664fbb[_0xe01f('0x18')](_0x5ca305);return _0x664fbb[_0xe01f('0x1e')](_0xe01f('0x1f'),_0x144eef+'-'+_0x9ee4b5+'/'+_0x26cd4c)[_0xe01f('0x19')](_0x53d3a1);}return null;};}function patchUpdates(_0x5e9523){return function(_0x32a6b9){try{jsonpatch[_0xe01f('0x20')](_0x32a6b9,_0x5e9523,!![]);}catch(_0xccaf80){return BPromise[_0xe01f('0x21')](_0xccaf80);}return _0x32a6b9[_0xe01f('0x22')]();};}function saveUpdates(_0x3c34fa,_0x570d48){return function(_0x1faeb8){if(_0x1faeb8){return _0x1faeb8[_0xe01f('0x23')](_0x3c34fa)[_0xe01f('0x24')](function(_0xa6da95){return _0xa6da95;});}return null;};}function removeEntity(_0x2480ec,_0x38efcc){return function(_0x1ea55b){if(_0x1ea55b){return _0x1ea55b[_0xe01f('0x25')]()[_0xe01f('0x24')](function(){var _0x4b44b6=_0x1ea55b['get']({'plain':!![]});var _0x3138d3=_0xe01f('0x26');return db[_0xe01f('0x27')][_0xe01f('0x25')]({'where':{'type':_0x3138d3,'resourceId':_0x4b44b6['id']}})['then'](function(){return _0x1ea55b;});})[_0xe01f('0x24')](function(){_0x2480ec[_0xe01f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x378c93,_0x5b9c5e){return function(_0x1b77c8){if(!_0x1b77c8){_0x378c93[_0xe01f('0x16')](0x194);}return _0x1b77c8;};}function handleError(_0x13dcd4,_0x4b85b8){_0x4b85b8=_0x4b85b8||0x1f4;return function(_0x940cb6){logger['error'](_0x940cb6[_0xe01f('0x28')]);if(_0x940cb6[_0xe01f('0x29')]){delete _0x940cb6[_0xe01f('0x29')];}_0x13dcd4[_0xe01f('0x18')](_0x4b85b8)[_0xe01f('0x2a')](_0x940cb6);};}exports[_0xe01f('0x2b')]=function(_0x11386e,_0x41d13d){var _0x1bdfcf={},_0x590598={},_0x3f725a={'count':0x0,'rows':[]};var _0x4bc3c8=_[_0xe01f('0x2c')](db[_0xe01f('0x2d')]['rawAttributes'],function(_0x15f98f){return{'name':_0x15f98f[_0xe01f('0x2e')],'type':_0x15f98f[_0xe01f('0x2f')]['key']};});_0x590598[_0xe01f('0x30')]=_[_0xe01f('0x2c')](_0x4bc3c8,_0xe01f('0x29'));_0x590598[_0xe01f('0x31')]=_[_0xe01f('0x32')](_0x11386e['query']);_0x590598['filters']=_['intersection'](_0x590598[_0xe01f('0x30')],_0x590598['query']);_0x1bdfcf[_0xe01f('0x33')]=_[_0xe01f('0x34')](_0x590598[_0xe01f('0x30')],qs[_0xe01f('0x35')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x35')]));_0x1bdfcf[_0xe01f('0x33')]=_0x1bdfcf[_0xe01f('0x33')]['length']?_0x1bdfcf['attributes']:_0x590598[_0xe01f('0x30')];if(!_0x11386e[_0xe01f('0x31')][_0xe01f('0x36')](_0xe01f('0x37'))){_0x1bdfcf['limit']=qs[_0xe01f('0x1c')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x1c')]);_0x1bdfcf['offset']=qs[_0xe01f('0x1a')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x1a')]);}_0x1bdfcf[_0xe01f('0x38')]=qs[_0xe01f('0x39')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x39')]);_0x1bdfcf[_0xe01f('0x3a')]=qs[_0xe01f('0x3b')](_[_0xe01f('0x3c')](_0x11386e[_0xe01f('0x31')],_0x590598[_0xe01f('0x3b')]),_0x4bc3c8);if(_0x11386e[_0xe01f('0x31')][_0xe01f('0x3d')]){_0x1bdfcf[_0xe01f('0x3a')]=_['merge'](_0x1bdfcf[_0xe01f('0x3a')],{'$or':_[_0xe01f('0x2c')](_0x4bc3c8,function(_0x1deac7){if(_0x1deac7[_0xe01f('0x2f')]!=='VIRTUAL'){var _0x36783f={};_0x36783f[_0x1deac7[_0xe01f('0x29')]]={'$like':'%'+_0x11386e[_0xe01f('0x31')][_0xe01f('0x3d')]+'%'};return _0x36783f;}})});}_0x1bdfcf=_[_0xe01f('0x3e')]({},_0x1bdfcf,_0x11386e[_0xe01f('0x3f')]);var _0x4fbb62={'where':_0x1bdfcf[_0xe01f('0x3a')]};return db[_0xe01f('0x2d')][_0xe01f('0x1d')](_0x4fbb62)[_0xe01f('0x24')](function(_0x20421f){_0x3f725a[_0xe01f('0x1d')]=_0x20421f;if(_0x11386e[_0xe01f('0x31')][_0xe01f('0x40')]){_0x1bdfcf[_0xe01f('0x41')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x1bdfcf);})[_0xe01f('0x24')](function(_0x50b47){_0x3f725a['rows']=_0x50b47;return _0x3f725a;})[_0xe01f('0x24')](respondWithFilteredResult(_0x41d13d,_0x1bdfcf))[_0xe01f('0x42')](handleError(_0x41d13d,null));};exports[_0xe01f('0x43')]=function(_0x5625d8,_0x2eb993){var _0x2da2e9={'raw':![],'where':{'id':_0x5625d8['params']['id']}},_0x56785b={};_0x56785b['model']=_[_0xe01f('0x32')](db['VoiceChanSpy'][_0xe01f('0x44')]);_0x56785b['query']=_[_0xe01f('0x32')](_0x5625d8[_0xe01f('0x31')]);_0x56785b[_0xe01f('0x3b')]=_[_0xe01f('0x34')](_0x56785b[_0xe01f('0x30')],_0x56785b[_0xe01f('0x31')]);_0x2da2e9[_0xe01f('0x33')]=_[_0xe01f('0x34')](_0x56785b[_0xe01f('0x30')],qs[_0xe01f('0x35')](_0x5625d8[_0xe01f('0x31')]['fields']));_0x2da2e9[_0xe01f('0x33')]=_0x2da2e9[_0xe01f('0x33')][_0xe01f('0x45')]?_0x2da2e9[_0xe01f('0x33')]:_0x56785b[_0xe01f('0x30')];if(_0x5625d8['query'][_0xe01f('0x40')]){_0x2da2e9['include']=[{'all':!![]}];}_0x2da2e9=_['merge']({},_0x2da2e9,_0x5625d8[_0xe01f('0x3f')]);return db[_0xe01f('0x2d')][_0xe01f('0x46')](_0x2da2e9)[_0xe01f('0x24')](handleEntityNotFound(_0x2eb993,null))[_0xe01f('0x24')](respondWithResult(_0x2eb993,null))['catch'](handleError(_0x2eb993,null));};exports[_0xe01f('0x47')]=function(_0x337c5d,_0x3bb3b7){return db[_0xe01f('0x2d')][_0xe01f('0x47')](_0x337c5d[_0xe01f('0x48')],{})[_0xe01f('0x24')](function(_0x5a511c){var _0x3f4ae0=_0x337c5d['user'][_0xe01f('0x49')]({'plain':!![]});if(!_0x3f4ae0)throw new Error(_0xe01f('0x4a'));if(_0x3f4ae0['role']===_0xe01f('0x4b')){var _0x100742=_0x5a511c[_0xe01f('0x49')]({'plain':!![]});var _0xea4320=_0xe01f('0x26');return db[_0xe01f('0x4c')]['find']({'where':{'name':_0xea4320,'userProfileId':_0x3f4ae0['userProfileId']},'raw':!![]})[_0xe01f('0x24')](function(_0x216f69){if(_0x216f69&&_0x216f69['autoAssociation']===0x0){return db[_0xe01f('0x27')][_0xe01f('0x47')]({'name':_0x100742[_0xe01f('0x29')],'resourceId':_0x100742['id'],'type':_0x216f69[_0xe01f('0x29')],'sectionId':_0x216f69['id']},{})[_0xe01f('0x24')](function(){return _0x5a511c;});}else{return _0x5a511c;}})[_0xe01f('0x42')](function(_0x4ffa43){logger[_0xe01f('0x4d')](_0xe01f('0x4e'),_0x4ffa43);throw _0x4ffa43;});}return _0x5a511c;})['then'](respondWithResult(_0x3bb3b7,0xc9))[_0xe01f('0x42')](handleError(_0x3bb3b7,null));};exports[_0xe01f('0x23')]=function(_0x33b9a8,_0x47089f){if(_0x33b9a8[_0xe01f('0x48')]['id']){delete _0x33b9a8[_0xe01f('0x48')]['id'];}return db['VoiceChanSpy'][_0xe01f('0x46')]({'where':{'id':_0x33b9a8['params']['id']}})['then'](handleEntityNotFound(_0x47089f,null))[_0xe01f('0x24')](saveUpdates(_0x33b9a8[_0xe01f('0x48')],null))[_0xe01f('0x24')](respondWithResult(_0x47089f,null))[_0xe01f('0x42')](handleError(_0x47089f,null));};exports[_0xe01f('0x25')]=function(_0x3b0ab1,_0x3949e1){return db[_0xe01f('0x2d')]['find']({'where':{'id':_0x3b0ab1['params']['id']}})[_0xe01f('0x24')](handleEntityNotFound(_0x3949e1,null))['then'](removeEntity(_0x3949e1,null))[_0xe01f('0x42')](handleError(_0x3949e1,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 187b318..25ad159 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 _0xd79a=['from-sip','%s%s','prefix','push','merge','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','catch','exports','define','VoiceChanSpy','VoiceExtension','bulkCreate','then','destroy','util','bluebird','./voiceChanSpy.attributes','context'];(function(_0x4fc455,_0x273d1a){var _0x4d65b2=function(_0x59ba0d){while(--_0x59ba0d){_0x4fc455['push'](_0x4fc455['shift']());}};_0x4d65b2(++_0x273d1a);}(_0xd79a,0x94));var _0xad79=function(_0x40cd9b,_0x23c676){_0x40cd9b=_0x40cd9b-0x0;var _0x48167f=_0xd79a[_0x40cd9b];return _0x48167f;};'use strict';var _=require('lodash');var util=require(_0xad79('0x0'));var BPromise=require(_0xad79('0x1'));var attributes=require(_0xad79('0x2'));var getUserApplications=function(_0x526b9a,_0x5b8fcf,_0x3bfc0d){var _0x2b3eb6=0x1;var _0xc015=[];var _0x4e8a44={'context':_0x5b8fcf[_0xad79('0x3')]||_0xad79('0x4'),'exten':util['format'](_0xad79('0x5'),_0x526b9a[_0xad79('0x6')],_0x3bfc0d),'type':'system','isApp':![],'ChanSpyId':_0x526b9a['id'],'UserId':_0x5b8fcf['id']};_0xc015[_0xad79('0x7')](_[_0xad79('0x8')]({'app':'Set','appdata':util[_0xad79('0x9')](_0xad79('0xa'),_0xad79('0xb')),'priority':_0x2b3eb6++},_0x4e8a44));if(_0x526b9a[_0xad79('0xc')]){_0xc015[_0xad79('0x7')](_['merge']({'app':_0xad79('0xd'),'appdata':util[_0xad79('0x9')](_0xad79('0xe'),_0x526b9a[_0xad79('0xf')]),'priority':_0x2b3eb6++},_0x4e8a44));}if(_0x526b9a[_0xad79('0x10')]){_0xc015['push'](_['merge']({'app':_0xad79('0x11'),'appdata':_0x526b9a[_0xad79('0x12')],'priority':_0x2b3eb6++},_0x4e8a44));}_0xc015[_0xad79('0x7')](_['merge']({'app':_0xad79('0x13'),'appdata':util[_0xad79('0x9')](_0xad79('0x14'),_0x5b8fcf[_0xad79('0x15')],_0x526b9a[_0xad79('0x16')]?_0x526b9a['options'][_0xad79('0x17')](''):''),'priority':_0x2b3eb6++},_0x4e8a44));if(_0x526b9a[_0xad79('0xc')]){_0xc015[_0xad79('0x7')](_[_0xad79('0x8')]({'app':_0xad79('0x18'),'priority':_0x2b3eb6++},_0x4e8a44));}return _0xc015;};var getChanSpyApplications=function(_0xf6a8b6,_0x295d52){var _0x386405=[];for(var _0x51471d=0x0,_0x378570=0x1;_0x51471d<_0x295d52[_0xad79('0x19')];_0x51471d++,_0x378570=0x1){_0x386405=_0x386405[_0xad79('0x1a')](getUserApplications(_0xf6a8b6,_0x295d52[_0x51471d],_0x295d52[_0x51471d][_0xad79('0x1b')]));if(_0x295d52[_0x51471d][_0xad79('0x1b')]!=_0x295d52[_0x51471d][_0xad79('0x15')]){_0x386405=_0x386405[_0xad79('0x1a')](getUserApplications(_0xf6a8b6,_0x295d52[_0x51471d],_0x295d52[_0x51471d]['name']));}}return _0x386405;};var getChanSpyPromise=function(_0x3af397,_0x2abcb2){return new BPromise(function(_0x33b291,_0x20cb8b){return _0x3af397[_0xad79('0x1c')][_0xad79('0x1d')]({'attributes':['id',_0xad79('0x15'),_0xad79('0x1b')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x49a101){if(_0x49a101){return _0x33b291(getChanSpyApplications(_0x2abcb2,_0x49a101));}return _0x33b291([]);})[_0xad79('0x1e')](function(_0x2b3e3f){_0x20cb8b(_0x2b3e3f);});});};module[_0xad79('0x1f')]=function(_0x4f9417,_0x1d8fe3){var _0x12576a=_0x4f9417['models'];return _0x4f9417[_0xad79('0x20')](_0xad79('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4be087,_0x4cecae,_0xe0ad05){return getChanSpyPromise(_0x12576a,_0x4be087)['then'](function(_0x3863b1){if(_0x3863b1&&_0x3863b1[_0xad79('0x19')]){return _0x12576a[_0xad79('0x22')][_0xad79('0x23')](_0x3863b1);}})[_0xad79('0x24')](function(){_0xe0ad05();})['catch'](function(_0x12d919){_0xe0ad05(_0x12d919);});},'afterUpdate':function(_0x5b53b6,_0x2d5c63,_0x1231b5){return _0x12576a[_0xad79('0x22')][_0xad79('0x25')]({'where':{'ChanSpyId':_0x5b53b6['id']}})[_0xad79('0x24')](function(){return getChanSpyPromise(_0x12576a,_0x5b53b6);})[_0xad79('0x24')](function(_0x2dcf7b){if(_0x2dcf7b&&_0x2dcf7b[_0xad79('0x19')]){return _0x12576a[_0xad79('0x22')][_0xad79('0x23')](_0x2dcf7b);}})[_0xad79('0x24')](function(){_0x1231b5();})[_0xad79('0x1e')](function(_0xe8fab9){_0x1231b5(_0xe8fab9);});},'afterDestroy':function(_0x37a077,_0xef30ee,_0x29032d){return _0x12576a[_0xad79('0x22')][_0xad79('0x25')]({'where':{'ChanSpyId':_0x37a077['id']}})[_0xad79('0x24')](function(){_0x29032d();})[_0xad79('0x1e')](function(_0x4b29a3){_0x29032d(_0x4b29a3);});}}});}; \ No newline at end of file +var _0x51e1=['VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','lodash','util','context','from-sip','format','%s%s','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','findAll','agent','then','catch','exports','models','define'];(function(_0x5b2681,_0x180b3e){var _0x1b0275=function(_0x2c2338){while(--_0x2c2338){_0x5b2681['push'](_0x5b2681['shift']());}};_0x1b0275(++_0x180b3e);}(_0x51e1,0xe8));var _0x151e=function(_0x2b2b33,_0x56606f){_0x2b2b33=_0x2b2b33-0x0;var _0x229157=_0x51e1[_0x2b2b33];return _0x229157;};'use strict';var _=require(_0x151e('0x0'));var util=require(_0x151e('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x4a2c61,_0x185257,_0x1e4e74){var _0x355852=0x1;var _0x1cf8e7=[];var _0x318aad={'context':_0x185257[_0x151e('0x2')]||_0x151e('0x3'),'exten':util[_0x151e('0x4')](_0x151e('0x5'),_0x4a2c61['prefix'],_0x1e4e74),'type':_0x151e('0x6'),'isApp':![],'ChanSpyId':_0x4a2c61['id'],'UserId':_0x185257['id']};_0x1cf8e7['push'](_[_0x151e('0x7')]({'app':_0x151e('0x8'),'appdata':util[_0x151e('0x4')](_0x151e('0x9'),_0x151e('0xa')),'priority':_0x355852++},_0x318aad));if(_0x4a2c61[_0x151e('0xb')]){_0x1cf8e7[_0x151e('0xc')](_[_0x151e('0x7')]({'app':_0x151e('0xd'),'appdata':util[_0x151e('0x4')](_0x151e('0xe'),_0x4a2c61[_0x151e('0xf')]),'priority':_0x355852++},_0x318aad));}if(_0x4a2c61[_0x151e('0x10')]){_0x1cf8e7[_0x151e('0xc')](_[_0x151e('0x7')]({'app':_0x151e('0x11'),'appdata':_0x4a2c61[_0x151e('0x12')],'priority':_0x355852++},_0x318aad));}_0x1cf8e7[_0x151e('0xc')](_['merge']({'app':_0x151e('0x13'),'appdata':util[_0x151e('0x4')](_0x151e('0x14'),_0x185257[_0x151e('0x15')],_0x4a2c61[_0x151e('0x16')]?_0x4a2c61[_0x151e('0x16')][_0x151e('0x17')](''):''),'priority':_0x355852++},_0x318aad));if(_0x4a2c61['record']){_0x1cf8e7['push'](_[_0x151e('0x7')]({'app':'StopMixMonitor','priority':_0x355852++},_0x318aad));}return _0x1cf8e7;};var getChanSpyApplications=function(_0x23891d,_0x2d5204){var _0x4f8b10=[];for(var _0x22b60a=0x0,_0xfd97c0=0x1;_0x22b60a<_0x2d5204[_0x151e('0x18')];_0x22b60a++,_0xfd97c0=0x1){_0x4f8b10=_0x4f8b10[_0x151e('0x19')](getUserApplications(_0x23891d,_0x2d5204[_0x22b60a],_0x2d5204[_0x22b60a]['internal']));if(_0x2d5204[_0x22b60a][_0x151e('0x1a')]!=_0x2d5204[_0x22b60a][_0x151e('0x15')]){_0x4f8b10=_0x4f8b10[_0x151e('0x19')](getUserApplications(_0x23891d,_0x2d5204[_0x22b60a],_0x2d5204[_0x22b60a]['name']));}}return _0x4f8b10;};var getChanSpyPromise=function(_0x5a4202,_0x15216d){return new BPromise(function(_0xee2b51,_0x423e78){return _0x5a4202['User'][_0x151e('0x1b')]({'attributes':['id','name',_0x151e('0x1a')],'where':{'role':_0x151e('0x1c'),'chanspy':!![]},'raw':!![]})[_0x151e('0x1d')](function(_0xb92fa5){if(_0xb92fa5){return _0xee2b51(getChanSpyApplications(_0x15216d,_0xb92fa5));}return _0xee2b51([]);})[_0x151e('0x1e')](function(_0xfa9ee2){_0x423e78(_0xfa9ee2);});});};module[_0x151e('0x1f')]=function(_0x48bcc0,_0xf9f472){var _0x2b8721=_0x48bcc0[_0x151e('0x20')];return _0x48bcc0[_0x151e('0x21')](_0x151e('0x22'),attributes,{'tableName':_0x151e('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x200808,_0x130a10,_0x323165){return getChanSpyPromise(_0x2b8721,_0x200808)[_0x151e('0x1d')](function(_0x1a282e){if(_0x1a282e&&_0x1a282e[_0x151e('0x18')]){return _0x2b8721[_0x151e('0x24')]['bulkCreate'](_0x1a282e);}})[_0x151e('0x1d')](function(){_0x323165();})[_0x151e('0x1e')](function(_0x440a6e){_0x323165(_0x440a6e);});},'afterUpdate':function(_0xee5bca,_0x5415e4,_0x47a82f){return _0x2b8721['VoiceExtension'][_0x151e('0x25')]({'where':{'ChanSpyId':_0xee5bca['id']}})[_0x151e('0x1d')](function(){return getChanSpyPromise(_0x2b8721,_0xee5bca);})[_0x151e('0x1d')](function(_0x4a7509){if(_0x4a7509&&_0x4a7509[_0x151e('0x18')]){return _0x2b8721[_0x151e('0x24')]['bulkCreate'](_0x4a7509);}})[_0x151e('0x1d')](function(){_0x47a82f();})[_0x151e('0x1e')](function(_0x531d65){_0x47a82f(_0x531d65);});},'afterDestroy':function(_0x1059a8,_0x3c8bc9,_0x368fe9){return _0x2b8721['VoiceExtension'][_0x151e('0x25')]({'where':{'ChanSpyId':_0x1059a8['id']}})[_0x151e('0x1d')](function(){_0x368fe9();})[_0x151e('0x1e')](function(_0x4d9343){_0x368fe9(_0x4d9343);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 561fbf8..bfba28f 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 _0xc3fe=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0xc3fe,0xff));var _0xec3f=function(_0x5e212e,_0x92bfd4){_0x5e212e=_0x5e212e-0x0;var _0x6c9c22=_0xc3fe[_0x5e212e];return _0x6c9c22;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var moment=require(_0xec3f('0x2'));var BPromise=require('bluebird');var rs=require(_0xec3f('0x3'));var fs=require('fs');var Redis=require(_0xec3f('0x4'));var db=require(_0xec3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec3f('0x6'))(_0xec3f('0x7'));var config=require(_0xec3f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b0b84,_0x526183,_0x503775){return new BPromise(function(_0xcb8557,_0x5df7fc){return client[_0xec3f('0xa')](_0x3b0b84,_0x503775)[_0xec3f('0xb')](function(_0x12a7c5){logger[_0xec3f('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));logger[_0xec3f('0xe')](_0xec3f('0xf'),_0x526183,_0xec3f('0xd'),JSON[_0xec3f('0x10')](_0x12a7c5));if(_0x12a7c5[_0xec3f('0x11')]){if(_0x12a7c5['error'][_0xec3f('0x12')]===0x1f4){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0x12a7c5['error']['message']);return _0x5df7fc(_0x12a7c5[_0xec3f('0x11')]['message']);}logger['error'](_0xec3f('0x13'),_0x526183,_0x12a7c5[_0xec3f('0x11')][_0xec3f('0x14')]);return _0xcb8557(_0x12a7c5['error']['message']);}else{logger[_0xec3f('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));_0xcb8557(_0x12a7c5[_0xec3f('0x15')]['message']);}})[_0xec3f('0x16')](function(_0xb8ee6f){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0xb8ee6f);_0x5df7fc(_0xb8ee6f);});});} \ No newline at end of file +var _0x4522=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x43cdd0,_0x43b50f){var _0x589ec0=function(_0x4f1454){while(--_0x4f1454){_0x43cdd0['push'](_0x43cdd0['shift']());}};_0x589ec0(++_0x43b50f);}(_0x4522,0x1a0));var _0x2452=function(_0x58ca4f,_0x1450bd){_0x58ca4f=_0x58ca4f-0x0;var _0x3180bd=_0x4522[_0x58ca4f];return _0x3180bd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2452('0x0'));var BPromise=require(_0x2452('0x1'));var rs=require(_0x2452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require(_0x2452('0x5'))(_0x2452('0x6'));var config=require(_0x2452('0x7'));var jayson=require(_0x2452('0x8'));var client=jayson[_0x2452('0x9')][_0x2452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0139,_0x149807,_0x3bc193){return new BPromise(function(_0x33b935,_0x24073f){return client[_0x2452('0xb')](_0x2f0139,_0x3bc193)[_0x2452('0xc')](function(_0x2995b5){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x149807,_0x2452('0xd'),JSON[_0x2452('0xe')](_0x2995b5));if(_0x2995b5[_0x2452('0xf')]){if(_0x2995b5[_0x2452('0xf')][_0x2452('0x10')]===0x1f4){logger[_0x2452('0xf')](_0x2452('0x11'),_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x24073f(_0x2995b5['error']['message']);}logger[_0x2452('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x33b935(_0x2995b5[_0x2452('0xf')][_0x2452('0x12')]);}else{logger['info'](_0x2452('0x11'),_0x149807,'request\x20sent');_0x33b935(_0x2995b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xdede20){logger['error'](_0x2452('0x11'),_0x149807,_0xdede20);_0x24073f(_0xdede20);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 951ac21..1d6bbe0 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 _0x440b=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x165d9c,_0x3f6448){var _0x3c29f4=function(_0x5785a8){while(--_0x5785a8){_0x165d9c['push'](_0x165d9c['shift']());}};_0x3c29f4(++_0x3f6448);}(_0x440b,0x19c));var _0xb440=function(_0x24516c,_0x59fcd8){_0x24516c=_0x24516c-0x0;var _0xaf2987=_0x440b[_0x24516c];return _0xaf2987;};'use strict';var multer=require(_0xb440('0x0'));var util=require(_0xb440('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb440('0x2'));var router=express[_0xb440('0x3')]();var fs_extra=require(_0xb440('0x4'));var auth=require(_0xb440('0x5'));var interaction=require(_0xb440('0x6'));var config=require(_0xb440('0x7'));var controller=require('./voiceContext.controller');router[_0xb440('0x8')]('/',auth[_0xb440('0x9')](),controller[_0xb440('0xa')]);router['get'](_0xb440('0xb'),auth[_0xb440('0x9')](),controller['show']);router[_0xb440('0xc')]('/',auth['isAuthenticated'](),controller[_0xb440('0xd')]);router[_0xb440('0xe')](_0xb440('0xb'),auth[_0xb440('0x9')](),controller[_0xb440('0xf')]);router[_0xb440('0x10')](_0xb440('0xb'),auth[_0xb440('0x9')](),controller[_0xb440('0x11')]);module[_0xb440('0x12')]=router; \ No newline at end of file +var _0x64d2=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0xb7da7d,_0x2d5da9){var _0x3c0553=function(_0x26f035){while(--_0x26f035){_0xb7da7d['push'](_0xb7da7d['shift']());}};_0x3c0553(++_0x2d5da9);}(_0x64d2,0x94));var _0x264d=function(_0x49157b,_0x5d8601){_0x49157b=_0x49157b-0x0;var _0x3ea5d4=_0x64d2[_0x49157b];return _0x3ea5d4;};'use strict';var multer=require(_0x264d('0x0'));var util=require(_0x264d('0x1'));var path=require(_0x264d('0x2'));var timeout=require(_0x264d('0x3'));var express=require(_0x264d('0x4'));var router=express[_0x264d('0x5')]();var fs_extra=require(_0x264d('0x6'));var auth=require(_0x264d('0x7'));var interaction=require(_0x264d('0x8'));var config=require(_0x264d('0x9'));var controller=require(_0x264d('0xa'));router[_0x264d('0xb')]('/',auth['isAuthenticated'](),controller[_0x264d('0xc')]);router[_0x264d('0xb')](_0x264d('0xd'),auth[_0x264d('0xe')](),controller[_0x264d('0xf')]);router['post']('/',auth[_0x264d('0xe')](),controller['create']);router[_0x264d('0x10')](_0x264d('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x264d('0xd'),auth['isAuthenticated'](),controller[_0x264d('0x11')]);module[_0x264d('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 e82bbeb..d382d9a 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 _0x0318=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x23f948,_0x528caf){var _0x1ca643=function(_0x14e9d8){while(--_0x14e9d8){_0x23f948['push'](_0x23f948['shift']());}};_0x1ca643(++_0x528caf);}(_0x0318,0xa9));var _0x8031=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0318[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8031('0x0'));module[_0x8031('0x1')]={'name':{'type':Sequelize[_0x8031('0x2')],'unique':_0x8031('0x3')},'description':{'type':Sequelize[_0x8031('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x8031('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf7b5=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0xedf622,_0x5a854d){var _0x245b71=function(_0x2058a2){while(--_0x2058a2){_0xedf622['push'](_0xedf622['shift']());}};_0x245b71(++_0x5a854d);}(_0xf7b5,0xac));var _0x5f7b=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xf7b5[_0x5cc8];return _0x450661;};'use strict';var Sequelize=require(_0x5f7b('0x0'));module[_0x5f7b('0x1')]={'name':{'type':Sequelize[_0x5f7b('0x2')],'unique':_0x5f7b('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5f7b('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 2c42510..619cf96 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 _0xec39=['writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','Contexts','name','send','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','VoiceContext','includeAll','include','findAll','show','length','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render'];(function(_0x348bb5,_0x32c723){var _0x4fbc6c=function(_0x62f72e){while(--_0x62f72e){_0x348bb5['push'](_0x348bb5['shift']());}};_0x4fbc6c(++_0x32c723);}(_0xec39,0x19f));var _0x9ec3=function(_0x412605,_0x1a5abc){_0x412605=_0x412605-0x0;var _0x4bfba8=_0xec39[_0x412605];return _0x4bfba8;};'use strict';var emlformat=require(_0x9ec3('0x0'));var rimraf=require(_0x9ec3('0x1'));var zipdir=require(_0x9ec3('0x2'));var jsonpatch=require(_0x9ec3('0x3'));var rp=require(_0x9ec3('0x4'));var moment=require(_0x9ec3('0x5'));var BPromise=require(_0x9ec3('0x6'));var Mustache=require('mustache');var util=require(_0x9ec3('0x7'));var path=require(_0x9ec3('0x8'));var sox=require(_0x9ec3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ec3('0xa'));var squel=require(_0x9ec3('0xb'));var crypto=require(_0x9ec3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9ec3('0xd'));var toCsv=require(_0x9ec3('0xe'));var querystring=require(_0x9ec3('0xf'));var Papa=require(_0x9ec3('0x10'));var Redis=require(_0x9ec3('0x11'));var authService=require(_0x9ec3('0x12'));var qs=require(_0x9ec3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ec3('0x14'));var logger=require(_0x9ec3('0x15'))(_0x9ec3('0x16'));var utils=require(_0x9ec3('0x17'));var config=require(_0x9ec3('0x18'));var licenseUtil=require(_0x9ec3('0x19'));var db=require(_0x9ec3('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9ec3('0x1b')][_0x9ec3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1bd7e6,_0x4bb1b3,_0x2b9f69,_0x4d26ad){return new BPromise(function(_0x471112,_0x23ac30){var _0xcbb897=_0x4d26ad||client;return _0xcbb897[_0x9ec3('0x1d')](_0x1bd7e6,_0x2b9f69)[_0x9ec3('0x1e')](function(_0x2c0ad5){logger[_0x9ec3('0x1f')](_0x9ec3('0x20'),_0x4bb1b3,_0x9ec3('0x21'));logger['debug'](_0x9ec3('0x22'),_0x4bb1b3,'request\x20sent',JSON['stringify'](_0x2c0ad5));if(_0x2c0ad5[_0x9ec3('0x23')]){if(_0x2c0ad5[_0x9ec3('0x23')][_0x9ec3('0x24')]===0x1f4){logger[_0x9ec3('0x23')](_0x9ec3('0x20'),_0x4bb1b3,_0x2c0ad5['error'][_0x9ec3('0x25')]);return _0x23ac30(_0x2c0ad5['error'][_0x9ec3('0x25')]);}logger['error'](_0x9ec3('0x20'),_0x4bb1b3,_0x2c0ad5[_0x9ec3('0x23')][_0x9ec3('0x25')]);return _0x471112(_0x2c0ad5['error'][_0x9ec3('0x25')]);}else{logger['info'](_0x9ec3('0x20'),_0x4bb1b3,'request\x20sent');_0x471112(_0x2c0ad5[_0x9ec3('0x26')][_0x9ec3('0x25')]);}})[_0x9ec3('0x27')](function(_0xdc6ed0){logger[_0x9ec3('0x23')](_0x9ec3('0x20'),_0x4bb1b3,_0xdc6ed0);_0x23ac30(_0xdc6ed0);});});}function respondWithStatusCode(_0x20de22,_0x5efa81){_0x5efa81=_0x5efa81||0xcc;return function(_0x22846c){if(_0x22846c){return _0x20de22[_0x9ec3('0x28')](_0x5efa81);}return _0x20de22[_0x9ec3('0x29')](_0x5efa81)[_0x9ec3('0x2a')]();};}function respondWithResult(_0x3cd7fd,_0x366392){_0x366392=_0x366392||0xc8;return function(_0x2db57b){if(_0x2db57b){return _0x3cd7fd[_0x9ec3('0x29')](_0x366392)[_0x9ec3('0x2b')](_0x2db57b);}};}function respondWithFilteredResult(_0x3983a0,_0xb99216){return function(_0x58d6fe){if(_0x58d6fe){var _0x469313=typeof _0xb99216[_0x9ec3('0x2c')]===_0x9ec3('0x2d')&&typeof _0xb99216[_0x9ec3('0x2e')]==='undefined';var _0x1f7089=_0x58d6fe[_0x9ec3('0x2f')];var _0x141149=_0x469313?0x0:_0xb99216[_0x9ec3('0x2c')];var _0x257269=_0x469313?_0x58d6fe[_0x9ec3('0x2f')]:_0xb99216[_0x9ec3('0x2c')]+_0xb99216[_0x9ec3('0x2e')];var _0xa91ee5;if(_0x257269>=_0x1f7089){_0x257269=_0x1f7089;_0xa91ee5=0xc8;}else{_0xa91ee5=0xce;}_0x3983a0[_0x9ec3('0x29')](_0xa91ee5);return _0x3983a0[_0x9ec3('0x30')](_0x9ec3('0x31'),_0x141149+'-'+_0x257269+'/'+_0x1f7089)[_0x9ec3('0x2b')](_0x58d6fe);}return null;};}function patchUpdates(_0x42ef39){return function(_0x2b7113){try{jsonpatch[_0x9ec3('0x32')](_0x2b7113,_0x42ef39,!![]);}catch(_0x2f4224){return BPromise['reject'](_0x2f4224);}return _0x2b7113['save']();};}function saveUpdates(_0x4c50fd,_0x1e86a7){return function(_0x3c18a7){if(_0x3c18a7){return _0x3c18a7[_0x9ec3('0x33')](_0x4c50fd)[_0x9ec3('0x1e')](function(_0x42047b){return _0x42047b;});}return null;};}function removeEntity(_0x29e68d,_0x2891fc){return function(_0x55b829){if(_0x55b829){return _0x55b829[_0x9ec3('0x34')]()[_0x9ec3('0x1e')](function(){var _0x1f8962=_0x55b829['get']({'plain':!![]});var _0xbe238d=_0x9ec3('0x35');return db['UserProfileResource'][_0x9ec3('0x34')]({'where':{'type':_0xbe238d,'resourceId':_0x1f8962['id']}})[_0x9ec3('0x1e')](function(){return _0x55b829;});})[_0x9ec3('0x1e')](function(){_0x29e68d[_0x9ec3('0x29')](0xcc)[_0x9ec3('0x2a')]();});}};}function handleEntityNotFound(_0x19fea1,_0x29103d){return function(_0x489fd2){if(!_0x489fd2){_0x19fea1[_0x9ec3('0x28')](0x194);}return _0x489fd2;};}function handleError(_0x32581e,_0x515055){_0x515055=_0x515055||0x1f4;return function(_0x505df1){logger[_0x9ec3('0x23')](_0x505df1['stack']);if(_0x505df1[_0x9ec3('0x36')]){delete _0x505df1[_0x9ec3('0x36')];}_0x32581e[_0x9ec3('0x29')](_0x515055)[_0x9ec3('0x37')](_0x505df1);};}exports['index']=function(_0x11d7f5,_0x9b06ff){var _0x37e92b={},_0x1d7518={},_0x1c6044={'count':0x0,'rows':[]};var _0x149bf1=_['map'](db['VoiceContext']['rawAttributes'],function(_0xc1fe40){return{'name':_0xc1fe40[_0x9ec3('0x38')],'type':_0xc1fe40[_0x9ec3('0x39')][_0x9ec3('0x3a')]};});_0x1d7518[_0x9ec3('0x3b')]=_[_0x9ec3('0x3c')](_0x149bf1,'name');_0x1d7518[_0x9ec3('0x3d')]=_[_0x9ec3('0x3e')](_0x11d7f5['query']);_0x1d7518[_0x9ec3('0x3f')]=_[_0x9ec3('0x40')](_0x1d7518[_0x9ec3('0x3b')],_0x1d7518[_0x9ec3('0x3d')]);_0x37e92b['attributes']=_[_0x9ec3('0x40')](_0x1d7518['model'],qs[_0x9ec3('0x41')](_0x11d7f5[_0x9ec3('0x3d')][_0x9ec3('0x41')]));_0x37e92b[_0x9ec3('0x42')]=_0x37e92b[_0x9ec3('0x42')]['length']?_0x37e92b['attributes']:_0x1d7518[_0x9ec3('0x3b')];if(!_0x11d7f5['query'][_0x9ec3('0x43')]('nolimit')){_0x37e92b[_0x9ec3('0x2e')]=qs['limit'](_0x11d7f5[_0x9ec3('0x3d')][_0x9ec3('0x2e')]);_0x37e92b['offset']=qs[_0x9ec3('0x2c')](_0x11d7f5['query'][_0x9ec3('0x2c')]);}_0x37e92b[_0x9ec3('0x44')]=qs['sort'](_0x11d7f5[_0x9ec3('0x3d')][_0x9ec3('0x45')]);_0x37e92b[_0x9ec3('0x46')]=qs['filters'](_[_0x9ec3('0x47')](_0x11d7f5[_0x9ec3('0x3d')],_0x1d7518['filters']),_0x149bf1);if(_0x11d7f5[_0x9ec3('0x3d')][_0x9ec3('0x48')]){_0x37e92b[_0x9ec3('0x46')]=_[_0x9ec3('0x49')](_0x37e92b[_0x9ec3('0x46')],{'$or':_[_0x9ec3('0x3c')](_0x149bf1,function(_0x3fb17b){if(_0x3fb17b[_0x9ec3('0x39')]!=='VIRTUAL'){var _0x57e5d7={};_0x57e5d7[_0x3fb17b[_0x9ec3('0x36')]]={'$like':'%'+_0x11d7f5[_0x9ec3('0x3d')]['filter']+'%'};return _0x57e5d7;}})});}_0x37e92b=_[_0x9ec3('0x49')]({},_0x37e92b,_0x11d7f5[_0x9ec3('0x4a')]);var _0x4fcc61={'where':_0x37e92b[_0x9ec3('0x46')]};return db[_0x9ec3('0x4b')][_0x9ec3('0x2f')](_0x4fcc61)[_0x9ec3('0x1e')](function(_0x278f1a){_0x1c6044[_0x9ec3('0x2f')]=_0x278f1a;if(_0x11d7f5[_0x9ec3('0x3d')][_0x9ec3('0x4c')]){_0x37e92b[_0x9ec3('0x4d')]=[{'all':!![]}];}return db[_0x9ec3('0x4b')][_0x9ec3('0x4e')](_0x37e92b);})[_0x9ec3('0x1e')](function(_0x284088){_0x1c6044['rows']=_0x284088;return _0x1c6044;})[_0x9ec3('0x1e')](respondWithFilteredResult(_0x9b06ff,_0x37e92b))['catch'](handleError(_0x9b06ff,null));};exports[_0x9ec3('0x4f')]=function(_0x1e7766,_0x7713b5){var _0x58c812={'raw':![],'where':{'id':_0x1e7766['params']['id']}},_0x55c7e2={};_0x55c7e2[_0x9ec3('0x3b')]=_[_0x9ec3('0x3e')](db[_0x9ec3('0x4b')]['rawAttributes']);_0x55c7e2['query']=_['keys'](_0x1e7766[_0x9ec3('0x3d')]);_0x55c7e2[_0x9ec3('0x3f')]=_[_0x9ec3('0x40')](_0x55c7e2[_0x9ec3('0x3b')],_0x55c7e2[_0x9ec3('0x3d')]);_0x58c812[_0x9ec3('0x42')]=_['intersection'](_0x55c7e2[_0x9ec3('0x3b')],qs[_0x9ec3('0x41')](_0x1e7766[_0x9ec3('0x3d')][_0x9ec3('0x41')]));_0x58c812[_0x9ec3('0x42')]=_0x58c812[_0x9ec3('0x42')][_0x9ec3('0x50')]?_0x58c812[_0x9ec3('0x42')]:_0x55c7e2[_0x9ec3('0x3b')];if(_0x1e7766[_0x9ec3('0x3d')][_0x9ec3('0x4c')]){_0x58c812['include']=[{'all':!![]}];}_0x58c812=_['merge']({},_0x58c812,_0x1e7766[_0x9ec3('0x4a')]);return db[_0x9ec3('0x4b')]['find'](_0x58c812)[_0x9ec3('0x1e')](handleEntityNotFound(_0x7713b5,null))['then'](respondWithResult(_0x7713b5,null))['catch'](handleError(_0x7713b5,null));};exports[_0x9ec3('0x51')]=function(_0x59538a,_0x50e623,_0xa1bfb9){var _0x42801a;return db[_0x9ec3('0x4b')][_0x9ec3('0x51')](_0x59538a[_0x9ec3('0x52')],{'raw':!![]})['then'](function(_0x32cc74){_0x42801a=_0x32cc74;return db[_0x9ec3('0x4b')]['findAll']({'raw':!![]});})[_0x9ec3('0x1e')](function(_0x53b585){var _0x1e7a25=fs[_0x9ec3('0x53')](path[_0x9ec3('0x54')](config[_0x9ec3('0x55')],_0x9ec3('0x56')),_0x9ec3('0x57'));var _0x3c9e69=ejs['render'](_0x1e7a25,{'contexts':_0x53b585||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x3c9e69);})[_0x9ec3('0x1e')](function(){return respondWithRpcPromise(_0x9ec3('0x58'),_0x9ec3('0x51'),{'module':_0x9ec3('0x59')});})[_0x9ec3('0x1e')](function(){var _0x2dc851=_0x59538a[_0x9ec3('0x5a')][_0x9ec3('0x5b')]({'plain':!![]});if(!_0x2dc851)throw new Error(_0x9ec3('0x5c'));if(_0x2dc851[_0x9ec3('0x5d')]===_0x9ec3('0x5a')){var _0x220b1a=_0x42801a[_0x9ec3('0x5b')]({'plain':!![]});return db[_0x9ec3('0x5e')][_0x9ec3('0x5f')]({'where':{'name':'Contexts','userProfileId':_0x2dc851['userProfileId']},'raw':!![]})[_0x9ec3('0x1e')](function(_0xe85f62){if(_0xe85f62&&_0xe85f62[_0x9ec3('0x60')]===0x0){return db[_0x9ec3('0x61')][_0x9ec3('0x51')]({'name':_0x220b1a[_0x9ec3('0x36')],'resourceId':_0x220b1a['id'],'type':_0xe85f62['name'],'sectionId':_0xe85f62['id']},{})[_0x9ec3('0x1e')](function(){return _0x42801a;});}else{return _0x42801a;}})['catch'](function(_0x1a3c44){logger[_0x9ec3('0x23')](_0x9ec3('0x62'),_0x1a3c44);throw _0x1a3c44;});}return _0x42801a;})[_0x9ec3('0x1e')](respondWithResult(_0x50e623,0xc9))['catch'](handleError(_0x50e623,null));};exports['update']=function(_0x2cf716,_0x5e04f9,_0x30dc77){var _0x1aac06;return db['VoiceContext'][_0x9ec3('0x5f')]({'where':{'id':_0x2cf716['params']['id']}})[_0x9ec3('0x1e')](handleEntityNotFound(_0x5e04f9,null))[_0x9ec3('0x1e')](saveUpdates(_0x2cf716[_0x9ec3('0x52')],null))[_0x9ec3('0x1e')](function(_0x40d2b9){if(_0x40d2b9){_0x1aac06=_0x40d2b9;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x9ec3('0x1e')](function(_0x27e460){var _0x333e11=fs[_0x9ec3('0x53')](path['join'](config['root'],_0x9ec3('0x56')),_0x9ec3('0x57'));var _0x16deb9=ejs[_0x9ec3('0x63')](_0x333e11,{'contexts':_0x27e460||[]});fs[_0x9ec3('0x64')](_0x9ec3('0x65'),_0x16deb9);})[_0x9ec3('0x1e')](function(){return respondWithRpcPromise('Reload',_0x9ec3('0x33'),{'module':_0x9ec3('0x59')});})['then'](function(){return _0x1aac06;})[_0x9ec3('0x1e')](respondWithResult(_0x5e04f9,null))['catch'](handleError(_0x5e04f9,null));};exports[_0x9ec3('0x34')]=function(_0x5b0d39,_0x38506d,_0x158adc){var _0x104029;return db['VoiceContext']['find']({'where':{'id':_0x5b0d39[_0x9ec3('0x66')]['id']}})[_0x9ec3('0x1e')](handleEntityNotFound(_0x38506d,null))['then'](removeEntity(_0x38506d,null))[_0x9ec3('0x1e')](function(){return db[_0x9ec3('0x4b')][_0x9ec3('0x4e')]({'raw':!![]});})[_0x9ec3('0x1e')](function(_0x2ccedc){var _0x50dd90=fs[_0x9ec3('0x53')](path[_0x9ec3('0x54')](config[_0x9ec3('0x55')],_0x9ec3('0x56')),_0x9ec3('0x57'));var _0x2025da=ejs[_0x9ec3('0x63')](_0x50dd90,{'contexts':_0x2ccedc});fs[_0x9ec3('0x64')](_0x9ec3('0x65'),_0x2025da);return respondWithRpcPromise(_0x9ec3('0x58'),_0x9ec3('0x34'),{'module':_0x9ec3('0x59')});})['catch'](handleError(_0x38506d,null));}; \ No newline at end of file +var _0xa78f=['../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','get','UserProfileResource','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','options','VoiceContext','includeAll','include','findAll','rows','show','params','find','catch','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','Contexts','userProfileId','autoAssociation','Reload','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x2bfc36,_0x428d91){var _0x3863f0=function(_0x56a940){while(--_0x56a940){_0x2bfc36['push'](_0x2bfc36['shift']());}};_0x3863f0(++_0x428d91);}(_0xa78f,0x1dc));var _0xfa78=function(_0x192057,_0x5e1ce4){_0x192057=_0x192057-0x0;var _0x3a20a1=_0xa78f[_0x192057];return _0x3a20a1;};'use strict';var emlformat=require(_0xfa78('0x0'));var rimraf=require(_0xfa78('0x1'));var zipdir=require(_0xfa78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa78('0x3'));var moment=require(_0xfa78('0x4'));var BPromise=require(_0xfa78('0x5'));var Mustache=require(_0xfa78('0x6'));var util=require(_0xfa78('0x7'));var path=require(_0xfa78('0x8'));var sox=require(_0xfa78('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa78('0xa'));var _=require(_0xfa78('0xb'));var squel=require(_0xfa78('0xc'));var crypto=require(_0xfa78('0xd'));var jsforce=require(_0xfa78('0xe'));var deskjs=require(_0xfa78('0xf'));var toCsv=require(_0xfa78('0x10'));var querystring=require(_0xfa78('0x11'));var Papa=require('papaparse');var Redis=require(_0xfa78('0x12'));var authService=require(_0xfa78('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa78('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfa78('0x15'));var config=require(_0xfa78('0x16'));var licenseUtil=require(_0xfa78('0x17'));var db=require(_0xfa78('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xfa78('0x19')][_0xfa78('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5c9f66,_0x49beca,_0x858264,_0x2201fb){return new BPromise(function(_0x2c5357,_0x187e79){var _0x563c6f=_0x2201fb||client;return _0x563c6f['request'](_0x5c9f66,_0x858264)['then'](function(_0x27b6c3){logger[_0xfa78('0x1b')](_0xfa78('0x1c'),_0x49beca,'request\x20sent');logger[_0xfa78('0x1d')](_0xfa78('0x1e'),_0x49beca,_0xfa78('0x1f'),JSON[_0xfa78('0x20')](_0x27b6c3));if(_0x27b6c3[_0xfa78('0x21')]){if(_0x27b6c3['error'][_0xfa78('0x22')]===0x1f4){logger[_0xfa78('0x21')]('VoiceContext,\x20%s,\x20%s',_0x49beca,_0x27b6c3[_0xfa78('0x21')][_0xfa78('0x23')]);return _0x187e79(_0x27b6c3['error'][_0xfa78('0x23')]);}logger[_0xfa78('0x21')](_0xfa78('0x1c'),_0x49beca,_0x27b6c3[_0xfa78('0x21')][_0xfa78('0x23')]);return _0x2c5357(_0x27b6c3[_0xfa78('0x21')][_0xfa78('0x23')]);}else{logger[_0xfa78('0x1b')](_0xfa78('0x1c'),_0x49beca,_0xfa78('0x1f'));_0x2c5357(_0x27b6c3[_0xfa78('0x24')]['message']);}})['catch'](function(_0xe9e5e9){logger['error'](_0xfa78('0x1c'),_0x49beca,_0xe9e5e9);_0x187e79(_0xe9e5e9);});});}function respondWithStatusCode(_0xef5869,_0x158903){_0x158903=_0x158903||0xcc;return function(_0x53c462){if(_0x53c462){return _0xef5869['sendStatus'](_0x158903);}return _0xef5869[_0xfa78('0x25')](_0x158903)[_0xfa78('0x26')]();};}function respondWithResult(_0x32f547,_0x3f52b7){_0x3f52b7=_0x3f52b7||0xc8;return function(_0x29bb8e){if(_0x29bb8e){return _0x32f547['status'](_0x3f52b7)[_0xfa78('0x27')](_0x29bb8e);}};}function respondWithFilteredResult(_0x281501,_0xa0e3c4){return function(_0x552220){if(_0x552220){var _0x1c3e2c=typeof _0xa0e3c4[_0xfa78('0x28')]===_0xfa78('0x29')&&typeof _0xa0e3c4[_0xfa78('0x2a')]===_0xfa78('0x29');var _0xb94e9=_0x552220[_0xfa78('0x2b')];var _0x2309c8=_0x1c3e2c?0x0:_0xa0e3c4[_0xfa78('0x28')];var _0x4a421e=_0x1c3e2c?_0x552220[_0xfa78('0x2b')]:_0xa0e3c4[_0xfa78('0x28')]+_0xa0e3c4[_0xfa78('0x2a')];var _0x2153e6;if(_0x4a421e>=_0xb94e9){_0x4a421e=_0xb94e9;_0x2153e6=0xc8;}else{_0x2153e6=0xce;}_0x281501[_0xfa78('0x25')](_0x2153e6);return _0x281501[_0xfa78('0x2c')]('Content-Range',_0x2309c8+'-'+_0x4a421e+'/'+_0xb94e9)[_0xfa78('0x27')](_0x552220);}return null;};}function patchUpdates(_0x1f79df){return function(_0x227e9a){try{jsonpatch[_0xfa78('0x2d')](_0x227e9a,_0x1f79df,!![]);}catch(_0x8318c4){return BPromise[_0xfa78('0x2e')](_0x8318c4);}return _0x227e9a['save']();};}function saveUpdates(_0x15a93f,_0x3ab3fa){return function(_0x8ee7fe){if(_0x8ee7fe){return _0x8ee7fe[_0xfa78('0x2f')](_0x15a93f)[_0xfa78('0x30')](function(_0x59d0d4){return _0x59d0d4;});}return null;};}function removeEntity(_0x4e2cc8,_0xce97dd){return function(_0x8e7c62){if(_0x8e7c62){return _0x8e7c62['destroy']()[_0xfa78('0x30')](function(){var _0x38b309=_0x8e7c62[_0xfa78('0x31')]({'plain':!![]});var _0x5d42a0='Contexts';return db[_0xfa78('0x32')][_0xfa78('0x33')]({'where':{'type':_0x5d42a0,'resourceId':_0x38b309['id']}})['then'](function(){return _0x8e7c62;});})[_0xfa78('0x30')](function(){_0x4e2cc8[_0xfa78('0x25')](0xcc)[_0xfa78('0x26')]();});}};}function handleEntityNotFound(_0x148de6,_0x40c1e1){return function(_0x1a28f6){if(!_0x1a28f6){_0x148de6['sendStatus'](0x194);}return _0x1a28f6;};}function handleError(_0x15339d,_0x81ba0e){_0x81ba0e=_0x81ba0e||0x1f4;return function(_0x293203){logger['error'](_0x293203[_0xfa78('0x34')]);if(_0x293203['name']){delete _0x293203[_0xfa78('0x35')];}_0x15339d[_0xfa78('0x25')](_0x81ba0e)['send'](_0x293203);};}exports[_0xfa78('0x36')]=function(_0xac9d3f,_0x59baa8){var _0x10948a={},_0x58ee62={},_0x35268d={'count':0x0,'rows':[]};var _0x158887=_[_0xfa78('0x37')](db['VoiceContext'][_0xfa78('0x38')],function(_0x9f037d){return{'name':_0x9f037d['fieldName'],'type':_0x9f037d[_0xfa78('0x39')][_0xfa78('0x3a')]};});_0x58ee62[_0xfa78('0x3b')]=_['map'](_0x158887,_0xfa78('0x35'));_0x58ee62[_0xfa78('0x3c')]=_[_0xfa78('0x3d')](_0xac9d3f['query']);_0x58ee62[_0xfa78('0x3e')]=_[_0xfa78('0x3f')](_0x58ee62[_0xfa78('0x3b')],_0x58ee62['query']);_0x10948a[_0xfa78('0x40')]=_[_0xfa78('0x3f')](_0x58ee62[_0xfa78('0x3b')],qs['fields'](_0xac9d3f[_0xfa78('0x3c')][_0xfa78('0x41')]));_0x10948a[_0xfa78('0x40')]=_0x10948a[_0xfa78('0x40')][_0xfa78('0x42')]?_0x10948a[_0xfa78('0x40')]:_0x58ee62[_0xfa78('0x3b')];if(!_0xac9d3f['query'][_0xfa78('0x43')](_0xfa78('0x44'))){_0x10948a[_0xfa78('0x2a')]=qs[_0xfa78('0x2a')](_0xac9d3f[_0xfa78('0x3c')][_0xfa78('0x2a')]);_0x10948a['offset']=qs[_0xfa78('0x28')](_0xac9d3f[_0xfa78('0x3c')][_0xfa78('0x28')]);}_0x10948a['order']=qs[_0xfa78('0x45')](_0xac9d3f[_0xfa78('0x3c')][_0xfa78('0x45')]);_0x10948a[_0xfa78('0x46')]=qs[_0xfa78('0x3e')](_['pick'](_0xac9d3f[_0xfa78('0x3c')],_0x58ee62[_0xfa78('0x3e')]),_0x158887);if(_0xac9d3f[_0xfa78('0x3c')][_0xfa78('0x47')]){_0x10948a[_0xfa78('0x46')]=_['merge'](_0x10948a['where'],{'$or':_[_0xfa78('0x37')](_0x158887,function(_0x57aa12){if(_0x57aa12[_0xfa78('0x39')]!=='VIRTUAL'){var _0x51e571={};_0x51e571[_0x57aa12[_0xfa78('0x35')]]={'$like':'%'+_0xac9d3f['query'][_0xfa78('0x47')]+'%'};return _0x51e571;}})});}_0x10948a=_['merge']({},_0x10948a,_0xac9d3f[_0xfa78('0x48')]);var _0x248d68={'where':_0x10948a[_0xfa78('0x46')]};return db[_0xfa78('0x49')][_0xfa78('0x2b')](_0x248d68)[_0xfa78('0x30')](function(_0x4d7cad){_0x35268d[_0xfa78('0x2b')]=_0x4d7cad;if(_0xac9d3f[_0xfa78('0x3c')][_0xfa78('0x4a')]){_0x10948a[_0xfa78('0x4b')]=[{'all':!![]}];}return db[_0xfa78('0x49')][_0xfa78('0x4c')](_0x10948a);})[_0xfa78('0x30')](function(_0x53371f){_0x35268d[_0xfa78('0x4d')]=_0x53371f;return _0x35268d;})[_0xfa78('0x30')](respondWithFilteredResult(_0x59baa8,_0x10948a))['catch'](handleError(_0x59baa8,null));};exports[_0xfa78('0x4e')]=function(_0x2a09c3,_0x88936e){var _0x323784={'raw':![],'where':{'id':_0x2a09c3[_0xfa78('0x4f')]['id']}},_0x2a88a2={};_0x2a88a2[_0xfa78('0x3b')]=_[_0xfa78('0x3d')](db[_0xfa78('0x49')]['rawAttributes']);_0x2a88a2['query']=_['keys'](_0x2a09c3[_0xfa78('0x3c')]);_0x2a88a2['filters']=_[_0xfa78('0x3f')](_0x2a88a2[_0xfa78('0x3b')],_0x2a88a2[_0xfa78('0x3c')]);_0x323784[_0xfa78('0x40')]=_[_0xfa78('0x3f')](_0x2a88a2[_0xfa78('0x3b')],qs['fields'](_0x2a09c3['query'][_0xfa78('0x41')]));_0x323784[_0xfa78('0x40')]=_0x323784[_0xfa78('0x40')][_0xfa78('0x42')]?_0x323784[_0xfa78('0x40')]:_0x2a88a2[_0xfa78('0x3b')];if(_0x2a09c3[_0xfa78('0x3c')]['includeAll']){_0x323784[_0xfa78('0x4b')]=[{'all':!![]}];}_0x323784=_['merge']({},_0x323784,_0x2a09c3[_0xfa78('0x48')]);return db[_0xfa78('0x49')][_0xfa78('0x50')](_0x323784)[_0xfa78('0x30')](handleEntityNotFound(_0x88936e,null))[_0xfa78('0x30')](respondWithResult(_0x88936e,null))[_0xfa78('0x51')](handleError(_0x88936e,null));};exports[_0xfa78('0x52')]=function(_0x53da07,_0xf7d391,_0x184889){var _0x53fbfa;return db['VoiceContext'][_0xfa78('0x52')](_0x53da07[_0xfa78('0x53')],{'raw':!![]})[_0xfa78('0x30')](function(_0x260cc9){_0x53fbfa=_0x260cc9;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x3760f7){var _0x4c4f5b=fs[_0xfa78('0x54')](path[_0xfa78('0x55')](config[_0xfa78('0x56')],_0xfa78('0x57')),_0xfa78('0x58'));var _0x2c94fd=ejs[_0xfa78('0x59')](_0x4c4f5b,{'contexts':_0x3760f7||[]});fs[_0xfa78('0x5a')](_0xfa78('0x5b'),_0x2c94fd);})[_0xfa78('0x30')](function(){return respondWithRpcPromise('Reload',_0xfa78('0x52'),{'module':_0xfa78('0x5c')});})['then'](function(){var _0x4a77bc=_0x53da07[_0xfa78('0x5d')][_0xfa78('0x31')]({'plain':!![]});if(!_0x4a77bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a77bc[_0xfa78('0x5e')]==='user'){var _0x3ac9c6=_0x53fbfa['get']({'plain':!![]});return db['UserProfileSection'][_0xfa78('0x50')]({'where':{'name':_0xfa78('0x5f'),'userProfileId':_0x4a77bc[_0xfa78('0x60')]},'raw':!![]})[_0xfa78('0x30')](function(_0x5daa24){if(_0x5daa24&&_0x5daa24[_0xfa78('0x61')]===0x0){return db[_0xfa78('0x32')][_0xfa78('0x52')]({'name':_0x3ac9c6[_0xfa78('0x35')],'resourceId':_0x3ac9c6['id'],'type':_0x5daa24['name'],'sectionId':_0x5daa24['id']},{})['then'](function(){return _0x53fbfa;});}else{return _0x53fbfa;}})[_0xfa78('0x51')](function(_0x1e44fe){logger[_0xfa78('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e44fe);throw _0x1e44fe;});}return _0x53fbfa;})['then'](respondWithResult(_0xf7d391,0xc9))[_0xfa78('0x51')](handleError(_0xf7d391,null));};exports[_0xfa78('0x2f')]=function(_0x2e8aed,_0x1ca672,_0x1619ae){var _0x10367e;return db[_0xfa78('0x49')][_0xfa78('0x50')]({'where':{'id':_0x2e8aed['params']['id']}})[_0xfa78('0x30')](handleEntityNotFound(_0x1ca672,null))['then'](saveUpdates(_0x2e8aed[_0xfa78('0x53')],null))[_0xfa78('0x30')](function(_0xe78f49){if(_0xe78f49){_0x10367e=_0xe78f49;return db['VoiceContext'][_0xfa78('0x4c')]({'raw':!![]});}})[_0xfa78('0x30')](function(_0x576c6a){var _0x1e5df2=fs[_0xfa78('0x54')](path[_0xfa78('0x55')](config[_0xfa78('0x56')],_0xfa78('0x57')),_0xfa78('0x58'));var _0x38bc6f=ejs[_0xfa78('0x59')](_0x1e5df2,{'contexts':_0x576c6a||[]});fs[_0xfa78('0x5a')](_0xfa78('0x5b'),_0x38bc6f);})['then'](function(){return respondWithRpcPromise(_0xfa78('0x62'),_0xfa78('0x2f'),{'module':_0xfa78('0x5c')});})[_0xfa78('0x30')](function(){return _0x10367e;})[_0xfa78('0x30')](respondWithResult(_0x1ca672,null))['catch'](handleError(_0x1ca672,null));};exports['destroy']=function(_0xbe8cda,_0x5a9ca1,_0x232e18){var _0x489f06;return db[_0xfa78('0x49')]['find']({'where':{'id':_0xbe8cda[_0xfa78('0x4f')]['id']}})[_0xfa78('0x30')](handleEntityNotFound(_0x5a9ca1,null))['then'](removeEntity(_0x5a9ca1,null))[_0xfa78('0x30')](function(){return db[_0xfa78('0x49')][_0xfa78('0x4c')]({'raw':!![]});})[_0xfa78('0x30')](function(_0x521156){var _0x197a1f=fs[_0xfa78('0x54')](path[_0xfa78('0x55')](config[_0xfa78('0x56')],_0xfa78('0x57')),'utf8');var _0x172a2a=ejs[_0xfa78('0x59')](_0x197a1f,{'contexts':_0x521156});fs[_0xfa78('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x172a2a);return respondWithRpcPromise('Reload',_0xfa78('0x33'),{'module':_0xfa78('0x5c')});})[_0xfa78('0x51')](handleError(_0x5a9ca1,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 9d7c6e4..547c402 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 _0x9cf1=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','api','moment','request-promise','path'];(function(_0x191b42,_0x3a45a0){var _0x1f0ba4=function(_0x1daba7){while(--_0x1daba7){_0x191b42['push'](_0x191b42['shift']());}};_0x1f0ba4(++_0x3a45a0);}(_0x9cf1,0xf1));var _0x19cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x19cf('0x0'));var util=require(_0x19cf('0x1'));var logger=require('../../config/logger')(_0x19cf('0x2'));var moment=require(_0x19cf('0x3'));var BPromise=require('bluebird');var rp=require(_0x19cf('0x4'));var fs=require('fs');var path=require(_0x19cf('0x5'));var rimraf=require(_0x19cf('0x6'));var config=require(_0x19cf('0x7'));var attributes=require(_0x19cf('0x8'));module[_0x19cf('0x9')]=function(_0x3b1c4c,_0xf2e525){return _0x3b1c4c[_0x19cf('0xa')](_0x19cf('0xb'),attributes,{'tableName':_0x19cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5435=['rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','api','moment','request-promise','path'];(function(_0x24d6ca,_0xd4030c){var _0x4da206=function(_0x557614){while(--_0x557614){_0x24d6ca['push'](_0x24d6ca['shift']());}};_0x4da206(++_0xd4030c);}(_0x5435,0x126));var _0x5543=function(_0x935b38,_0x3623c2){_0x935b38=_0x935b38-0x0;var _0x448c38=_0x5435[_0x935b38];return _0x448c38;};'use strict';var _=require(_0x5543('0x0'));var util=require(_0x5543('0x1'));var logger=require('../../config/logger')(_0x5543('0x2'));var moment=require(_0x5543('0x3'));var BPromise=require('bluebird');var rp=require(_0x5543('0x4'));var fs=require('fs');var path=require(_0x5543('0x5'));var rimraf=require(_0x5543('0x6'));var config=require('../../config/environment');var attributes=require(_0x5543('0x7'));module[_0x5543('0x8')]=function(_0xf1317f,_0x1f5c15){return _0xf1317f[_0x5543('0x9')](_0x5543('0xa'),attributes,{'tableName':_0x5543('0xb'),'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 1e7e97f..c584f1a 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 _0xa099=['request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2746a4,_0x5effc7){var _0x4bc33e=function(_0x592dae){while(--_0x592dae){_0x2746a4['push'](_0x2746a4['shift']());}};_0x4bc33e(++_0x5effc7);}(_0xa099,0x69));var _0x9a09=function(_0x5beacf,_0x4eb152){_0x5beacf=_0x5beacf-0x0;var _0x1c666e=_0xa099[_0x5beacf];return _0x1c666e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9a09('0x0'));var rs=require(_0x9a09('0x1'));var fs=require('fs');var Redis=require(_0x9a09('0x2'));var db=require(_0x9a09('0x3'))['db'];var utils=require(_0x9a09('0x4'));var logger=require(_0x9a09('0x5'))(_0x9a09('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a09('0x7'));var client=jayson[_0x9a09('0x8')][_0x9a09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39533e,_0x1241f5,_0x2f4fec){return new BPromise(function(_0x1e8701,_0x1da246){return client[_0x9a09('0xa')](_0x39533e,_0x2f4fec)[_0x9a09('0xb')](function(_0x5af2ba){logger[_0x9a09('0xc')]('VoiceContext,\x20%s,\x20%s',_0x1241f5,_0x9a09('0xd'));logger[_0x9a09('0xe')](_0x9a09('0xf'),_0x1241f5,_0x9a09('0xd'),JSON[_0x9a09('0x10')](_0x5af2ba));if(_0x5af2ba[_0x9a09('0x11')]){if(_0x5af2ba['error'][_0x9a09('0x12')]===0x1f4){logger[_0x9a09('0x11')](_0x9a09('0x13'),_0x1241f5,_0x5af2ba[_0x9a09('0x11')][_0x9a09('0x14')]);return _0x1da246(_0x5af2ba[_0x9a09('0x11')][_0x9a09('0x14')]);}logger[_0x9a09('0x11')](_0x9a09('0x13'),_0x1241f5,_0x5af2ba[_0x9a09('0x11')][_0x9a09('0x14')]);return _0x1e8701(_0x5af2ba[_0x9a09('0x11')][_0x9a09('0x14')]);}else{logger[_0x9a09('0xc')](_0x9a09('0x13'),_0x1241f5,'request\x20sent');_0x1e8701(_0x5af2ba[_0x9a09('0x15')]['message']);}})[_0x9a09('0x16')](function(_0x4ebdfa){logger[_0x9a09('0x11')](_0x9a09('0x13'),_0x1241f5,_0x4ebdfa);_0x1da246(_0x4ebdfa);});});} \ No newline at end of file +var _0xc997=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x133124,_0x4a29f9){var _0x7f7159=function(_0x163315){while(--_0x163315){_0x133124['push'](_0x133124['shift']());}};_0x7f7159(++_0x4a29f9);}(_0xc997,0x1a1));var _0x7c99=function(_0x158be3,_0x3ab1bc){_0x158be3=_0x158be3-0x0;var _0x5027f2=_0xc997[_0x158be3];return _0x5027f2;};'use strict';var _=require(_0x7c99('0x0'));var util=require(_0x7c99('0x1'));var moment=require('moment');var BPromise=require(_0x7c99('0x2'));var rs=require(_0x7c99('0x3'));var fs=require('fs');var Redis=require(_0x7c99('0x4'));var db=require(_0x7c99('0x5'))['db'];var utils=require(_0x7c99('0x6'));var logger=require('../../config/logger')(_0x7c99('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c99('0x8'));var client=jayson['client'][_0x7c99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46a3dd,_0x214999,_0xb815){return new BPromise(function(_0x415e3e,_0x12b4ce){return client[_0x7c99('0xa')](_0x46a3dd,_0xb815)[_0x7c99('0xb')](function(_0x42be42){logger[_0x7c99('0xc')](_0x7c99('0xd'),_0x214999,_0x7c99('0xe'));logger[_0x7c99('0xf')](_0x7c99('0x10'),_0x214999,_0x7c99('0xe'),JSON[_0x7c99('0x11')](_0x42be42));if(_0x42be42[_0x7c99('0x12')]){if(_0x42be42[_0x7c99('0x12')][_0x7c99('0x13')]===0x1f4){logger[_0x7c99('0x12')]('VoiceContext,\x20%s,\x20%s',_0x214999,_0x42be42['error']['message']);return _0x12b4ce(_0x42be42[_0x7c99('0x12')]['message']);}logger[_0x7c99('0x12')](_0x7c99('0xd'),_0x214999,_0x42be42[_0x7c99('0x12')]['message']);return _0x415e3e(_0x42be42[_0x7c99('0x12')][_0x7c99('0x14')]);}else{logger['info'](_0x7c99('0xd'),_0x214999,_0x7c99('0xe'));_0x415e3e(_0x42be42[_0x7c99('0x15')][_0x7c99('0x14')]);}})[_0x7c99('0x16')](function(_0x158828){logger[_0x7c99('0x12')](_0x7c99('0xd'),_0x214999,_0x158828);_0x12b4ce(_0x158828);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 847c266..7807e51 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 _0xe790=['show','post','create','delete','destroy','util','path','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xe790,0x175));var _0x0e79=function(_0xbea9bd,_0x23d5f1){_0xbea9bd=_0xbea9bd-0x0;var _0x3c07ca=_0xe790[_0xbea9bd];return _0x3c07ca;};'use strict';var multer=require('multer');var util=require(_0x0e79('0x0'));var path=require(_0x0e79('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0e79('0x2'));var config=require(_0x0e79('0x3'));var controller=require(_0x0e79('0x4'));router[_0x0e79('0x5')]('/',auth[_0x0e79('0x6')](),controller[_0x0e79('0x7')]);router[_0x0e79('0x5')](_0x0e79('0x8'),auth[_0x0e79('0x6')](),controller[_0x0e79('0x9')]);router[_0x0e79('0x5')](_0x0e79('0xa'),auth[_0x0e79('0x6')](),controller[_0x0e79('0xb')]);router[_0x0e79('0xc')]('/',auth[_0x0e79('0x6')](),controller[_0x0e79('0xd')]);router['put'](_0x0e79('0xa'),auth[_0x0e79('0x6')](),controller['update']);router[_0x0e79('0xe')](_0x0e79('0xa'),auth[_0x0e79('0x6')](),controller[_0x0e79('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1417=['/describe','describe','/:id','show','post','create','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get'];(function(_0x3c495a,_0x5cc5b4){var _0x56876f=function(_0x3c2c14){while(--_0x3c2c14){_0x3c495a['push'](_0x3c495a['shift']());}};_0x56876f(++_0x5cc5b4);}(_0x1417,0xef));var _0x7141=function(_0x193349,_0x24dbf8){_0x193349=_0x193349-0x0;var _0x21159c=_0x1417[_0x193349];return _0x21159c;};'use strict';var multer=require(_0x7141('0x0'));var util=require(_0x7141('0x1'));var path=require(_0x7141('0x2'));var timeout=require(_0x7141('0x3'));var express=require(_0x7141('0x4'));var router=express[_0x7141('0x5')]();var fs_extra=require(_0x7141('0x6'));var auth=require(_0x7141('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7141('0x8'));var controller=require(_0x7141('0x9'));router['get']('/',auth[_0x7141('0xa')](),controller[_0x7141('0xb')]);router[_0x7141('0xc')](_0x7141('0xd'),auth[_0x7141('0xa')](),controller[_0x7141('0xe')]);router[_0x7141('0xc')](_0x7141('0xf'),auth['isAuthenticated'](),controller[_0x7141('0x10')]);router[_0x7141('0x11')]('/',auth['isAuthenticated'](),controller[_0x7141('0x12')]);router['put']('/:id',auth[_0x7141('0xa')](),controller['update']);router[_0x7141('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7141('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b3a4fe3..a36c917 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 _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x338d8d,_0x345bc6){var _0x3c0fcb=function(_0x1ff730){while(--_0x1ff730){_0x338d8d['push'](_0x338d8d['shift']());}};_0x3c0fcb(++_0x345bc6);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x4b84[_0x1ac6e5];return _0x5877dc;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x1c5d2d,_0x28ccf0){var _0x5de1d8=function(_0x421b56){while(--_0x421b56){_0x1c5d2d['push'](_0x1c5d2d['shift']());}};_0x5de1d8(++_0x28ccf0);}(_0x55ca,0x126));var _0xa55c=function(_0x21eb3c,_0x7ce88b){_0x21eb3c=_0x21eb3c-0x0;var _0x4bd2aa=_0x55ca[_0x21eb3c];return _0x4bd2aa;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e75f402..d60c77f 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 _0x8b0d=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x4a9718,_0x22694b){var _0x5c2542=function(_0x594dcf){while(--_0x594dcf){_0x4a9718['push'](_0x4a9718['shift']());}};_0x5c2542(++_0x22694b);}(_0x8b0d,0x83));var _0xd8b0=function(_0x5e3976,_0x1ee208){_0x5e3976=_0x5e3976-0x0;var _0x2b7608=_0x8b0d[_0x5e3976];return _0x2b7608;};'use strict';var emlformat=require(_0xd8b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8b0('0x1'));var jsonpatch=require(_0xd8b0('0x2'));var rp=require(_0xd8b0('0x3'));var moment=require(_0xd8b0('0x4'));var BPromise=require(_0xd8b0('0x5'));var Mustache=require(_0xd8b0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd8b0('0x7'));var ejs=require(_0xd8b0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd8b0('0x9'));var squel=require(_0xd8b0('0xa'));var crypto=require(_0xd8b0('0xb'));var jsforce=require(_0xd8b0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd8b0('0x7'));var querystring=require(_0xd8b0('0xd'));var Papa=require(_0xd8b0('0xe'));var Redis=require(_0xd8b0('0xf'));var authService=require(_0xd8b0('0x10'));var qs=require(_0xd8b0('0x11'));var as=require(_0xd8b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8b0('0x13'))(_0xd8b0('0x14'));var utils=require(_0xd8b0('0x15'));var config=require(_0xd8b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8b0('0x17'))['db'];function respondWithStatusCode(_0x1819dd,_0xb77f84){_0xb77f84=_0xb77f84||0xcc;return function(_0x13d08a){if(_0x13d08a){return _0x1819dd[_0xd8b0('0x18')](_0xb77f84);}return _0x1819dd[_0xd8b0('0x19')](_0xb77f84)['end']();};}function respondWithResult(_0x228451,_0x1d3b7c){_0x1d3b7c=_0x1d3b7c||0xc8;return function(_0x12a288){if(_0x12a288){return _0x228451[_0xd8b0('0x19')](_0x1d3b7c)['json'](_0x12a288);}};}function respondWithFilteredResult(_0x410668,_0x3af76b){return function(_0x57af86){if(_0x57af86){var _0x5c77c3=typeof _0x3af76b[_0xd8b0('0x1a')]===_0xd8b0('0x1b')&&typeof _0x3af76b[_0xd8b0('0x1c')]===_0xd8b0('0x1b');var _0x4ea3f9=_0x57af86[_0xd8b0('0x1d')];var _0x2516f1=_0x5c77c3?0x0:_0x3af76b['offset'];var _0x1537e4=_0x5c77c3?_0x57af86['count']:_0x3af76b[_0xd8b0('0x1a')]+_0x3af76b[_0xd8b0('0x1c')];var _0x6d079c;if(_0x1537e4>=_0x4ea3f9){_0x1537e4=_0x4ea3f9;_0x6d079c=0xc8;}else{_0x6d079c=0xce;}_0x410668[_0xd8b0('0x19')](_0x6d079c);return _0x410668[_0xd8b0('0x1e')](_0xd8b0('0x1f'),_0x2516f1+'-'+_0x1537e4+'/'+_0x4ea3f9)[_0xd8b0('0x20')](_0x57af86);}return null;};}function patchUpdates(_0x49d322){return function(_0x3883db){try{jsonpatch[_0xd8b0('0x21')](_0x3883db,_0x49d322,!![]);}catch(_0x391c93){return BPromise['reject'](_0x391c93);}return _0x3883db[_0xd8b0('0x22')]();};}function saveUpdates(_0x2e9fa9,_0xfadf7d){return function(_0x2d8775){if(_0x2d8775){return _0x2d8775[_0xd8b0('0x23')](_0x2e9fa9)[_0xd8b0('0x24')](function(_0x4dfcc5){return _0x4dfcc5;});}return null;};}function removeEntity(_0x1869cb,_0x57a35b){return function(_0x33c798){if(_0x33c798){return _0x33c798[_0xd8b0('0x25')]()[_0xd8b0('0x24')](function(){_0x1869cb[_0xd8b0('0x19')](0xcc)[_0xd8b0('0x26')]();});}};}function handleEntityNotFound(_0x59cc10,_0x5d9ea){return function(_0x16ccff){if(!_0x16ccff){_0x59cc10[_0xd8b0('0x18')](0x194);}return _0x16ccff;};}function handleError(_0x453103,_0x241c3a){_0x241c3a=_0x241c3a||0x1f4;return function(_0x2a5ee2){logger[_0xd8b0('0x27')](_0x2a5ee2[_0xd8b0('0x28')]);if(_0x2a5ee2[_0xd8b0('0x29')]){delete _0x2a5ee2['name'];}_0x453103[_0xd8b0('0x19')](_0x241c3a)['send'](_0x2a5ee2);};}exports['index']=function(_0x2abea3,_0x1fe736){var _0x2aa9ff={},_0x3edd16={},_0x173c04={'count':0x0,'rows':[]};var _0x36bfe0=_['map'](db[_0xd8b0('0x2a')][_0xd8b0('0x2b')],function(_0x1a2110){return{'name':_0x1a2110[_0xd8b0('0x2c')],'type':_0x1a2110[_0xd8b0('0x2d')][_0xd8b0('0x2e')]};});_0x3edd16['model']=_['map'](_0x36bfe0,_0xd8b0('0x29'));_0x3edd16[_0xd8b0('0x2f')]=_[_0xd8b0('0x30')](_0x2abea3['query']);_0x3edd16[_0xd8b0('0x31')]=_[_0xd8b0('0x32')](_0x3edd16[_0xd8b0('0x33')],_0x3edd16[_0xd8b0('0x2f')]);_0x2aa9ff[_0xd8b0('0x34')]=_[_0xd8b0('0x32')](_0x3edd16['model'],qs[_0xd8b0('0x35')](_0x2abea3[_0xd8b0('0x2f')][_0xd8b0('0x35')]));_0x2aa9ff[_0xd8b0('0x34')]=_0x2aa9ff[_0xd8b0('0x34')][_0xd8b0('0x36')]?_0x2aa9ff[_0xd8b0('0x34')]:_0x3edd16[_0xd8b0('0x33')];if(!_0x2abea3[_0xd8b0('0x2f')][_0xd8b0('0x37')](_0xd8b0('0x38'))){_0x2aa9ff[_0xd8b0('0x1c')]=qs[_0xd8b0('0x1c')](_0x2abea3[_0xd8b0('0x2f')]['limit']);_0x2aa9ff[_0xd8b0('0x1a')]=qs['offset'](_0x2abea3[_0xd8b0('0x2f')][_0xd8b0('0x1a')]);}_0x2aa9ff[_0xd8b0('0x39')]=qs[_0xd8b0('0x3a')](_0x2abea3['query'][_0xd8b0('0x3a')]);_0x2aa9ff[_0xd8b0('0x3b')]=qs[_0xd8b0('0x31')](_[_0xd8b0('0x3c')](_0x2abea3['query'],_0x3edd16[_0xd8b0('0x31')]),_0x36bfe0);if(_0x2abea3['query'][_0xd8b0('0x3d')]){_0x2aa9ff['where']=_[_0xd8b0('0x3e')](_0x2aa9ff['where'],{'$or':_[_0xd8b0('0x3f')](_0x36bfe0,function(_0x3b5226){if(_0x3b5226[_0xd8b0('0x2d')]!=='VIRTUAL'){var _0x5e0d81={};_0x5e0d81[_0x3b5226[_0xd8b0('0x29')]]={'$like':'%'+_0x2abea3[_0xd8b0('0x2f')][_0xd8b0('0x3d')]+'%'};return _0x5e0d81;}})});}_0x2aa9ff=_[_0xd8b0('0x3e')]({},_0x2aa9ff,_0x2abea3[_0xd8b0('0x40')]);var _0x239dc3={'where':_0x2aa9ff[_0xd8b0('0x3b')]};return db['VoiceDialReport']['count'](_0x239dc3)[_0xd8b0('0x24')](function(_0x1cb735){_0x173c04['count']=_0x1cb735;if(_0x2abea3['query']['includeAll']){_0x2aa9ff['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xd8b0('0x41')](_0x2aa9ff);})[_0xd8b0('0x24')](function(_0x514963){_0x173c04[_0xd8b0('0x42')]=_0x514963;return _0x173c04;})[_0xd8b0('0x24')](respondWithFilteredResult(_0x1fe736,_0x2aa9ff))['catch'](handleError(_0x1fe736,null));};exports[_0xd8b0('0x43')]=function(_0x52ddd5,_0x2e3d13){var _0x4d2254={'raw':!![],'where':{'id':_0x52ddd5[_0xd8b0('0x44')]['id']}},_0x1019ef={};_0x1019ef[_0xd8b0('0x33')]=_['keys'](db[_0xd8b0('0x2a')]['rawAttributes']);_0x1019ef[_0xd8b0('0x2f')]=_[_0xd8b0('0x30')](_0x52ddd5[_0xd8b0('0x2f')]);_0x1019ef[_0xd8b0('0x31')]=_['intersection'](_0x1019ef['model'],_0x1019ef[_0xd8b0('0x2f')]);_0x4d2254['attributes']=_[_0xd8b0('0x32')](_0x1019ef[_0xd8b0('0x33')],qs[_0xd8b0('0x35')](_0x52ddd5[_0xd8b0('0x2f')][_0xd8b0('0x35')]));_0x4d2254[_0xd8b0('0x34')]=_0x4d2254['attributes'][_0xd8b0('0x36')]?_0x4d2254[_0xd8b0('0x34')]:_0x1019ef[_0xd8b0('0x33')];if(_0x52ddd5[_0xd8b0('0x2f')][_0xd8b0('0x45')]){_0x4d2254[_0xd8b0('0x46')]=[{'all':!![]}];}_0x4d2254=_['merge']({},_0x4d2254,_0x52ddd5[_0xd8b0('0x40')]);return db['VoiceDialReport'][_0xd8b0('0x47')](_0x4d2254)[_0xd8b0('0x24')](handleEntityNotFound(_0x2e3d13,null))['then'](respondWithResult(_0x2e3d13,null))[_0xd8b0('0x48')](handleError(_0x2e3d13,null));};exports[_0xd8b0('0x49')]=function(_0x9bc41d,_0x57e180){return db[_0xd8b0('0x2a')][_0xd8b0('0x49')](_0x9bc41d['body'],{})[_0xd8b0('0x24')](respondWithResult(_0x57e180,0xc9))['catch'](handleError(_0x57e180,null));};exports['update']=function(_0x387c66,_0x509231){if(_0x387c66[_0xd8b0('0x4a')]['id']){delete _0x387c66[_0xd8b0('0x4a')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x387c66['params']['id']}})[_0xd8b0('0x24')](handleEntityNotFound(_0x509231,null))[_0xd8b0('0x24')](saveUpdates(_0x387c66[_0xd8b0('0x4a')],null))['then'](respondWithResult(_0x509231,null))['catch'](handleError(_0x509231,null));};exports['destroy']=function(_0xdc6eab,_0x284210){return db['VoiceDialReport']['find']({'where':{'id':_0xdc6eab[_0xd8b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x284210,null))[_0xd8b0('0x24')](removeEntity(_0x284210,null))['catch'](handleError(_0x284210,null));};exports[_0xd8b0('0x4b')]=function(_0x49ea0f,_0x16def1){return db[_0xd8b0('0x2a')]['describe']()['then'](respondWithResult(_0x16def1,null))[_0xd8b0('0x48')](handleError(_0x16def1,null));}; \ No newline at end of file +var _0xdbd3=['fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','map','VoiceDialReport'];(function(_0x1f4fcb,_0x211d32){var _0x3c0841=function(_0x5edb17){while(--_0x5edb17){_0x1f4fcb['push'](_0x1f4fcb['shift']());}};_0x3c0841(++_0x211d32);}(_0xdbd3,0x1de));var _0x3dbd=function(_0x190725,_0x4c879f){_0x190725=_0x190725-0x0;var _0x4fe2de=_0xdbd3[_0x190725];return _0x4fe2de;};'use strict';var emlformat=require(_0x3dbd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dbd('0x1'));var jsonpatch=require(_0x3dbd('0x2'));var rp=require(_0x3dbd('0x3'));var moment=require(_0x3dbd('0x4'));var BPromise=require(_0x3dbd('0x5'));var Mustache=require(_0x3dbd('0x6'));var util=require('util');var path=require(_0x3dbd('0x7'));var sox=require('sox');var csv=require(_0x3dbd('0x8'));var ejs=require(_0x3dbd('0x9'));var fs=require('fs');var fs_extra=require(_0x3dbd('0xa'));var _=require(_0x3dbd('0xb'));var squel=require(_0x3dbd('0xc'));var crypto=require(_0x3dbd('0xd'));var jsforce=require(_0x3dbd('0xe'));var deskjs=require(_0x3dbd('0xf'));var toCsv=require(_0x3dbd('0x8'));var querystring=require(_0x3dbd('0x10'));var Papa=require(_0x3dbd('0x11'));var Redis=require('ioredis');var authService=require(_0x3dbd('0x12'));var qs=require(_0x3dbd('0x13'));var as=require(_0x3dbd('0x14'));var hardwareService=require(_0x3dbd('0x15'));var logger=require('../../config/logger')(_0x3dbd('0x16'));var utils=require(_0x3dbd('0x17'));var config=require(_0x3dbd('0x18'));var licenseUtil=require(_0x3dbd('0x19'));var db=require(_0x3dbd('0x1a'))['db'];function respondWithStatusCode(_0x9a820c,_0x4aab6f){_0x4aab6f=_0x4aab6f||0xcc;return function(_0x1760a2){if(_0x1760a2){return _0x9a820c[_0x3dbd('0x1b')](_0x4aab6f);}return _0x9a820c['status'](_0x4aab6f)['end']();};}function respondWithResult(_0x427ad5,_0x35248e){_0x35248e=_0x35248e||0xc8;return function(_0x3055cf){if(_0x3055cf){return _0x427ad5['status'](_0x35248e)[_0x3dbd('0x1c')](_0x3055cf);}};}function respondWithFilteredResult(_0x179cdf,_0x252481){return function(_0x49a578){if(_0x49a578){var _0x42cd01=typeof _0x252481[_0x3dbd('0x1d')]===_0x3dbd('0x1e')&&typeof _0x252481[_0x3dbd('0x1f')]===_0x3dbd('0x1e');var _0x218e42=_0x49a578[_0x3dbd('0x20')];var _0xf1ede8=_0x42cd01?0x0:_0x252481[_0x3dbd('0x1d')];var _0x3a54f5=_0x42cd01?_0x49a578[_0x3dbd('0x20')]:_0x252481[_0x3dbd('0x1d')]+_0x252481[_0x3dbd('0x1f')];var _0x4e9895;if(_0x3a54f5>=_0x218e42){_0x3a54f5=_0x218e42;_0x4e9895=0xc8;}else{_0x4e9895=0xce;}_0x179cdf[_0x3dbd('0x21')](_0x4e9895);return _0x179cdf[_0x3dbd('0x22')](_0x3dbd('0x23'),_0xf1ede8+'-'+_0x3a54f5+'/'+_0x218e42)['json'](_0x49a578);}return null;};}function patchUpdates(_0x27c947){return function(_0x67b081){try{jsonpatch['apply'](_0x67b081,_0x27c947,!![]);}catch(_0x4da926){return BPromise[_0x3dbd('0x24')](_0x4da926);}return _0x67b081[_0x3dbd('0x25')]();};}function saveUpdates(_0x45b62a,_0x2f781a){return function(_0x5223b9){if(_0x5223b9){return _0x5223b9[_0x3dbd('0x26')](_0x45b62a)[_0x3dbd('0x27')](function(_0x19745c){return _0x19745c;});}return null;};}function removeEntity(_0x10fedc,_0x584216){return function(_0x397306){if(_0x397306){return _0x397306[_0x3dbd('0x28')]()[_0x3dbd('0x27')](function(){_0x10fedc[_0x3dbd('0x21')](0xcc)[_0x3dbd('0x29')]();});}};}function handleEntityNotFound(_0x5a3941,_0x2e0c1b){return function(_0xfd488f){if(!_0xfd488f){_0x5a3941[_0x3dbd('0x1b')](0x194);}return _0xfd488f;};}function handleError(_0x5cb8ab,_0x4aaa23){_0x4aaa23=_0x4aaa23||0x1f4;return function(_0x1072ee){logger[_0x3dbd('0x2a')](_0x1072ee['stack']);if(_0x1072ee[_0x3dbd('0x2b')]){delete _0x1072ee[_0x3dbd('0x2b')];}_0x5cb8ab[_0x3dbd('0x21')](_0x4aaa23)[_0x3dbd('0x2c')](_0x1072ee);};}exports['index']=function(_0x502d7e,_0x11a30c){var _0x5a04d7={},_0x532c29={},_0x2d91d4={'count':0x0,'rows':[]};var _0x649d7d=_[_0x3dbd('0x2d')](db[_0x3dbd('0x2e')]['rawAttributes'],function(_0x441996){return{'name':_0x441996[_0x3dbd('0x2f')],'type':_0x441996[_0x3dbd('0x30')]['key']};});_0x532c29[_0x3dbd('0x31')]=_[_0x3dbd('0x2d')](_0x649d7d,_0x3dbd('0x2b'));_0x532c29[_0x3dbd('0x32')]=_[_0x3dbd('0x33')](_0x502d7e[_0x3dbd('0x32')]);_0x532c29['filters']=_[_0x3dbd('0x34')](_0x532c29[_0x3dbd('0x31')],_0x532c29[_0x3dbd('0x32')]);_0x5a04d7[_0x3dbd('0x35')]=_[_0x3dbd('0x34')](_0x532c29[_0x3dbd('0x31')],qs[_0x3dbd('0x36')](_0x502d7e['query']['fields']));_0x5a04d7[_0x3dbd('0x35')]=_0x5a04d7[_0x3dbd('0x35')][_0x3dbd('0x37')]?_0x5a04d7[_0x3dbd('0x35')]:_0x532c29['model'];if(!_0x502d7e[_0x3dbd('0x32')][_0x3dbd('0x38')]('nolimit')){_0x5a04d7[_0x3dbd('0x1f')]=qs[_0x3dbd('0x1f')](_0x502d7e[_0x3dbd('0x32')][_0x3dbd('0x1f')]);_0x5a04d7[_0x3dbd('0x1d')]=qs[_0x3dbd('0x1d')](_0x502d7e[_0x3dbd('0x32')]['offset']);}_0x5a04d7[_0x3dbd('0x39')]=qs['sort'](_0x502d7e[_0x3dbd('0x32')][_0x3dbd('0x3a')]);_0x5a04d7[_0x3dbd('0x3b')]=qs[_0x3dbd('0x3c')](_[_0x3dbd('0x3d')](_0x502d7e['query'],_0x532c29[_0x3dbd('0x3c')]),_0x649d7d);if(_0x502d7e['query'][_0x3dbd('0x3e')]){_0x5a04d7['where']=_[_0x3dbd('0x3f')](_0x5a04d7[_0x3dbd('0x3b')],{'$or':_[_0x3dbd('0x2d')](_0x649d7d,function(_0x925374){if(_0x925374['type']!==_0x3dbd('0x40')){var _0x1bbff8={};_0x1bbff8[_0x925374[_0x3dbd('0x2b')]]={'$like':'%'+_0x502d7e['query'][_0x3dbd('0x3e')]+'%'};return _0x1bbff8;}})});}_0x5a04d7=_[_0x3dbd('0x3f')]({},_0x5a04d7,_0x502d7e['options']);var _0x4cd117={'where':_0x5a04d7[_0x3dbd('0x3b')]};return db[_0x3dbd('0x2e')][_0x3dbd('0x20')](_0x4cd117)[_0x3dbd('0x27')](function(_0x239649){_0x2d91d4[_0x3dbd('0x20')]=_0x239649;if(_0x502d7e['query'][_0x3dbd('0x41')]){_0x5a04d7['include']=[{'all':!![]}];}return db[_0x3dbd('0x2e')][_0x3dbd('0x42')](_0x5a04d7);})['then'](function(_0x4c569e){_0x2d91d4['rows']=_0x4c569e;return _0x2d91d4;})['then'](respondWithFilteredResult(_0x11a30c,_0x5a04d7))[_0x3dbd('0x43')](handleError(_0x11a30c,null));};exports[_0x3dbd('0x44')]=function(_0x3acb9f,_0x486009){var _0x3b9af7={'raw':!![],'where':{'id':_0x3acb9f[_0x3dbd('0x45')]['id']}},_0x284d92={};_0x284d92[_0x3dbd('0x31')]=_['keys'](db[_0x3dbd('0x2e')][_0x3dbd('0x46')]);_0x284d92[_0x3dbd('0x32')]=_[_0x3dbd('0x33')](_0x3acb9f[_0x3dbd('0x32')]);_0x284d92['filters']=_[_0x3dbd('0x34')](_0x284d92[_0x3dbd('0x31')],_0x284d92['query']);_0x3b9af7[_0x3dbd('0x35')]=_[_0x3dbd('0x34')](_0x284d92[_0x3dbd('0x31')],qs[_0x3dbd('0x36')](_0x3acb9f[_0x3dbd('0x32')][_0x3dbd('0x36')]));_0x3b9af7[_0x3dbd('0x35')]=_0x3b9af7[_0x3dbd('0x35')]['length']?_0x3b9af7[_0x3dbd('0x35')]:_0x284d92[_0x3dbd('0x31')];if(_0x3acb9f['query']['includeAll']){_0x3b9af7['include']=[{'all':!![]}];}_0x3b9af7=_[_0x3dbd('0x3f')]({},_0x3b9af7,_0x3acb9f['options']);return db[_0x3dbd('0x2e')][_0x3dbd('0x47')](_0x3b9af7)[_0x3dbd('0x27')](handleEntityNotFound(_0x486009,null))[_0x3dbd('0x27')](respondWithResult(_0x486009,null))['catch'](handleError(_0x486009,null));};exports['create']=function(_0x4ca62c,_0x1ef500){return db[_0x3dbd('0x2e')][_0x3dbd('0x48')](_0x4ca62c[_0x3dbd('0x49')],{})[_0x3dbd('0x27')](respondWithResult(_0x1ef500,0xc9))[_0x3dbd('0x43')](handleError(_0x1ef500,null));};exports['update']=function(_0x193a55,_0x414774){if(_0x193a55['body']['id']){delete _0x193a55['body']['id'];}return db[_0x3dbd('0x2e')][_0x3dbd('0x47')]({'where':{'id':_0x193a55[_0x3dbd('0x45')]['id']}})['then'](handleEntityNotFound(_0x414774,null))[_0x3dbd('0x27')](saveUpdates(_0x193a55['body'],null))[_0x3dbd('0x27')](respondWithResult(_0x414774,null))[_0x3dbd('0x43')](handleError(_0x414774,null));};exports[_0x3dbd('0x28')]=function(_0x41cb44,_0x4f61d1){return db['VoiceDialReport'][_0x3dbd('0x47')]({'where':{'id':_0x41cb44[_0x3dbd('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f61d1,null))[_0x3dbd('0x27')](removeEntity(_0x4f61d1,null))[_0x3dbd('0x43')](handleError(_0x4f61d1,null));};exports[_0x3dbd('0x4a')]=function(_0x5e6f51,_0x41f6f7){return db[_0x3dbd('0x2e')]['describe']()[_0x3dbd('0x27')](respondWithResult(_0x41f6f7,null))[_0x3dbd('0x43')](handleError(_0x41f6f7,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 54fe021..8c3201c 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 _0x677f=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','util','api','moment'];(function(_0x5d821a,_0x5d855c){var _0xbabca3=function(_0x2038a6){while(--_0x2038a6){_0x5d821a['push'](_0x5d821a['shift']());}};_0xbabca3(++_0x5d855c);}(_0x677f,0xf8));var _0xf677=function(_0x56f64f,_0x333808){_0x56f64f=_0x56f64f-0x0;var _0x1a949e=_0x677f[_0x56f64f];return _0x1a949e;};'use strict';var _=require(_0xf677('0x0'));var util=require(_0xf677('0x1'));var logger=require('../../config/logger')(_0xf677('0x2'));var moment=require(_0xf677('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf677('0x4'));var rimraf=require(_0xf677('0x5'));var config=require(_0xf677('0x6'));var attributes=require(_0xf677('0x7'));module[_0xf677('0x8')]=function(_0x468326,_0xbc05c5){return _0x468326[_0xf677('0x9')]('VoiceDialReport',attributes,{'tableName':_0xf677('0xa'),'paranoid':![],'indexes':[{'fields':[_0xf677('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6462=['request-promise','path','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid','lodash','util','moment','bluebird'];(function(_0x4eca24,_0x30f2ec){var _0x4eae6d=function(_0x179253){while(--_0x179253){_0x4eca24['push'](_0x4eca24['shift']());}};_0x4eae6d(++_0x30f2ec);}(_0x6462,0x6a));var _0x2646=function(_0x181d04,_0x43e699){_0x181d04=_0x181d04-0x0;var _0x4c8e4b=_0x6462[_0x181d04];return _0x4c8e4b;};'use strict';var _=require(_0x2646('0x0'));var util=require(_0x2646('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2646('0x2'));var BPromise=require(_0x2646('0x3'));var rp=require(_0x2646('0x4'));var fs=require('fs');var path=require(_0x2646('0x5'));var rimraf=require('rimraf');var config=require(_0x2646('0x6'));var attributes=require(_0x2646('0x7'));module['exports']=function(_0x1bae17,_0x19621f){return _0x1bae17['define'](_0x2646('0x8'),attributes,{'tableName':_0x2646('0x9'),'paranoid':![],'indexes':[{'fields':[_0x2646('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 93b6a96..dd1b54c 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 _0x1ce4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateVoiceDialReport','VoiceDialReport','update','where','attributes','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring'];(function(_0x3e5fb1,_0x137d57){var _0x13bd6a=function(_0x46c51e){while(--_0x46c51e){_0x3e5fb1['push'](_0x3e5fb1['shift']());}};_0x13bd6a(++_0x137d57);}(_0x1ce4,0x1ea));var _0x41ce=function(_0x156610,_0x12f46e){_0x156610=_0x156610-0x0;var _0x306ae0=_0x1ce4[_0x156610];return _0x306ae0;};'use strict';var _=require(_0x41ce('0x0'));var util=require(_0x41ce('0x1'));var moment=require(_0x41ce('0x2'));var BPromise=require(_0x41ce('0x3'));var rs=require(_0x41ce('0x4'));var fs=require('fs');var Redis=require(_0x41ce('0x5'));var db=require(_0x41ce('0x6'))['db'];var utils=require(_0x41ce('0x7'));var logger=require(_0x41ce('0x8'))(_0x41ce('0x9'));var config=require('../../config/environment');var jayson=require(_0x41ce('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x140b44,_0x5aa373,_0x1710c9){return new BPromise(function(_0x2347dd,_0x2316f1){return client[_0x41ce('0xb')](_0x140b44,_0x1710c9)[_0x41ce('0xc')](function(_0x117a2e){logger[_0x41ce('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x5aa373,_0x41ce('0xe'));logger[_0x41ce('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x5aa373,_0x41ce('0xe'),JSON[_0x41ce('0x10')](_0x117a2e));if(_0x117a2e['error']){if(_0x117a2e[_0x41ce('0x11')][_0x41ce('0x12')]===0x1f4){logger[_0x41ce('0x11')](_0x41ce('0x13'),_0x5aa373,_0x117a2e[_0x41ce('0x11')][_0x41ce('0x14')]);return _0x2316f1(_0x117a2e['error'][_0x41ce('0x14')]);}logger[_0x41ce('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x5aa373,_0x117a2e['error'][_0x41ce('0x14')]);return _0x2347dd(_0x117a2e[_0x41ce('0x11')][_0x41ce('0x14')]);}else{logger[_0x41ce('0xd')](_0x41ce('0x13'),_0x5aa373,_0x41ce('0xe'));_0x2347dd(_0x117a2e[_0x41ce('0x15')]['message']);}})[_0x41ce('0x16')](function(_0x292afd){logger['error'](_0x41ce('0x13'),_0x5aa373,_0x292afd);_0x2316f1(_0x292afd);});});}exports['CreateVoiceDialReport']=function(_0x221735){var _0x3c2346=this;return new Promise(function(_0x47313c,_0x187468){return db['VoiceDialReport'][_0x41ce('0x17')](_0x221735[_0x41ce('0x18')],{'raw':_0x221735[_0x41ce('0x19')]?_0x221735[_0x41ce('0x19')][_0x41ce('0x1a')]===undefined?!![]:![]:!![]})[_0x41ce('0xc')](function(_0x40f2d6){logger[_0x41ce('0xd')]('CreateVoiceDialReport',_0x221735);logger[_0x41ce('0xf')](_0x41ce('0x1b'),_0x221735,JSON['stringify'](_0x40f2d6));_0x47313c(_0x40f2d6);})[_0x41ce('0x16')](function(_0x5e430e){logger[_0x41ce('0x11')]('CreateVoiceDialReport',_0x5e430e['message'],_0x221735);_0x187468(_0x3c2346[_0x41ce('0x11')](0x1f4,_0x5e430e[_0x41ce('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x496686){var _0x24a016=this;return new Promise(function(_0x567b81,_0x2a16bb){return db[_0x41ce('0x1c')][_0x41ce('0x1d')](_0x496686[_0x41ce('0x18')],{'raw':_0x496686[_0x41ce('0x19')]?_0x496686['options'][_0x41ce('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x496686[_0x41ce('0x19')]?_0x496686[_0x41ce('0x19')][_0x41ce('0x1e')]||null:null,'attributes':_0x496686[_0x41ce('0x19')]?_0x496686[_0x41ce('0x19')][_0x41ce('0x1f')]||null:null,'limit':_0x496686[_0x41ce('0x19')]?_0x496686[_0x41ce('0x19')]['limit']||null:null})[_0x41ce('0xc')](function(_0x154f8d){logger[_0x41ce('0xd')](_0x41ce('0x20'),_0x496686);logger[_0x41ce('0xf')](_0x41ce('0x20'),_0x496686,JSON[_0x41ce('0x10')](_0x154f8d));_0x567b81(_0x154f8d);})[_0x41ce('0x16')](function(_0x3f7ddc){logger[_0x41ce('0x11')](_0x41ce('0x20'),_0x3f7ddc[_0x41ce('0x14')],_0x496686);_0x2a16bb(_0x24a016[_0x41ce('0x11')](0x1f4,_0x3f7ddc[_0x41ce('0x14')]));});});}; \ No newline at end of file +var _0x85de=['../../config/logger','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','result','CreateVoiceDialReport','VoiceDialReport','create','options','catch','UpdateVoiceDialReport','update','body','raw','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x274a6e,_0x3f9be3){var _0x157091=function(_0x2408b1){while(--_0x2408b1){_0x274a6e['push'](_0x274a6e['shift']());}};_0x157091(++_0x3f9be3);}(_0x85de,0x185));var _0xe85d=function(_0x42b0b6,_0x1fae49){_0x42b0b6=_0x42b0b6-0x0;var _0x306c0f=_0x85de[_0x42b0b6];return _0x306c0f;};'use strict';var _=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var moment=require(_0xe85d('0x2'));var BPromise=require('bluebird');var rs=require(_0xe85d('0x3'));var fs=require('fs');var Redis=require(_0xe85d('0x4'));var db=require(_0xe85d('0x5'))['db'];var utils=require(_0xe85d('0x6'));var logger=require(_0xe85d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe85d('0x8'));var client=jayson[_0xe85d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b743,_0x24233c,_0x553990){return new BPromise(function(_0x44ea2c,_0x528413){return client[_0xe85d('0xa')](_0x59b743,_0x553990)[_0xe85d('0xb')](function(_0x2c21bc){logger[_0xe85d('0xc')](_0xe85d('0xd'),_0x24233c,_0xe85d('0xe'));logger[_0xe85d('0xf')](_0xe85d('0x10'),_0x24233c,'request\x20sent',JSON[_0xe85d('0x11')](_0x2c21bc));if(_0x2c21bc[_0xe85d('0x12')]){if(_0x2c21bc[_0xe85d('0x12')][_0xe85d('0x13')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x24233c,_0x2c21bc[_0xe85d('0x12')]['message']);return _0x528413(_0x2c21bc[_0xe85d('0x12')][_0xe85d('0x14')]);}logger[_0xe85d('0x12')](_0xe85d('0xd'),_0x24233c,_0x2c21bc[_0xe85d('0x12')]['message']);return _0x44ea2c(_0x2c21bc[_0xe85d('0x12')][_0xe85d('0x14')]);}else{logger[_0xe85d('0xc')](_0xe85d('0xd'),_0x24233c,_0xe85d('0xe'));_0x44ea2c(_0x2c21bc[_0xe85d('0x15')][_0xe85d('0x14')]);}})['catch'](function(_0x559889){logger[_0xe85d('0x12')](_0xe85d('0xd'),_0x24233c,_0x559889);_0x528413(_0x559889);});});}exports[_0xe85d('0x16')]=function(_0x1e7ed3){var _0x201373=this;return new Promise(function(_0x3fc359,_0x492188){return db[_0xe85d('0x17')][_0xe85d('0x18')](_0x1e7ed3['body'],{'raw':_0x1e7ed3[_0xe85d('0x19')]?_0x1e7ed3[_0xe85d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe85d('0xb')](function(_0x1910b5){logger[_0xe85d('0xc')](_0xe85d('0x16'),_0x1e7ed3);logger[_0xe85d('0xf')](_0xe85d('0x16'),_0x1e7ed3,JSON['stringify'](_0x1910b5));_0x3fc359(_0x1910b5);})[_0xe85d('0x1a')](function(_0x2ebc81){logger['error'](_0xe85d('0x16'),_0x2ebc81[_0xe85d('0x14')],_0x1e7ed3);_0x492188(_0x201373[_0xe85d('0x12')](0x1f4,_0x2ebc81[_0xe85d('0x14')]));});});};exports[_0xe85d('0x1b')]=function(_0x2d7d33){var _0x2faccb=this;return new Promise(function(_0x17693a,_0x50f74c){return db[_0xe85d('0x17')][_0xe85d('0x1c')](_0x2d7d33[_0xe85d('0x1d')],{'raw':_0x2d7d33[_0xe85d('0x19')]?_0x2d7d33['options'][_0xe85d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d7d33[_0xe85d('0x19')]?_0x2d7d33[_0xe85d('0x19')]['where']||null:null,'attributes':_0x2d7d33[_0xe85d('0x19')]?_0x2d7d33[_0xe85d('0x19')][_0xe85d('0x1f')]||null:null,'limit':_0x2d7d33[_0xe85d('0x19')]?_0x2d7d33['options'][_0xe85d('0x20')]||null:null})['then'](function(_0xc02a2b){logger[_0xe85d('0xc')](_0xe85d('0x1b'),_0x2d7d33);logger['debug'](_0xe85d('0x1b'),_0x2d7d33,JSON[_0xe85d('0x11')](_0xc02a2b));_0x17693a(_0xc02a2b);})[_0xe85d('0x1a')](function(_0x353f44){logger[_0xe85d('0x12')](_0xe85d('0x1b'),_0x353f44['message'],_0x2d7d33);_0x50f74c(_0x2faccb[_0xe85d('0x12')](0x1f4,_0x353f44[_0xe85d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index da16666..0ace392 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 _0x9e70=['show','post','create','/:id/applications','addApplications','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','index','/:id'];(function(_0x5d9ede,_0x5cb53f){var _0x58f676=function(_0x5267cb){while(--_0x5267cb){_0x5d9ede['push'](_0x5d9ede['shift']());}};_0x58f676(++_0x5cb53f);}(_0x9e70,0xe4));var _0x09e7=function(_0x433d72,_0x42f659){_0x433d72=_0x433d72-0x0;var _0x25b924=_0x9e70[_0x433d72];return _0x25b924;};'use strict';var multer=require(_0x09e7('0x0'));var util=require(_0x09e7('0x1'));var path=require(_0x09e7('0x2'));var timeout=require(_0x09e7('0x3'));var express=require(_0x09e7('0x4'));var router=express['Router']();var fs_extra=require(_0x09e7('0x5'));var auth=require(_0x09e7('0x6'));var interaction=require(_0x09e7('0x7'));var config=require('../../config/environment');var controller=require(_0x09e7('0x8'));router['get']('/',auth[_0x09e7('0x9')](),controller[_0x09e7('0xa')]);router['get'](_0x09e7('0xb'),auth[_0x09e7('0x9')](),controller[_0x09e7('0xc')]);router[_0x09e7('0xd')]('/',auth['isAuthenticated'](),controller[_0x09e7('0xe')]);router[_0x09e7('0xd')](_0x09e7('0xf'),auth[_0x09e7('0x9')](),controller[_0x09e7('0x10')]);router[_0x09e7('0x11')](_0x09e7('0xb'),auth[_0x09e7('0x9')](),controller[_0x09e7('0x12')]);router[_0x09e7('0x13')](_0x09e7('0xb'),auth[_0x09e7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5069=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5069,0xc7));var _0x9506=function(_0x3d7a0c,_0x3b2982){_0x3d7a0c=_0x3d7a0c-0x0;var _0x6114e9=_0x5069[_0x3d7a0c];return _0x6114e9;};'use strict';var multer=require(_0x9506('0x0'));var util=require(_0x9506('0x1'));var path=require(_0x9506('0x2'));var timeout=require(_0x9506('0x3'));var express=require(_0x9506('0x4'));var router=express[_0x9506('0x5')]();var fs_extra=require(_0x9506('0x6'));var auth=require(_0x9506('0x7'));var interaction=require(_0x9506('0x8'));var config=require(_0x9506('0x9'));var controller=require(_0x9506('0xa'));router[_0x9506('0xb')]('/',auth[_0x9506('0xc')](),controller[_0x9506('0xd')]);router['get'](_0x9506('0xe'),auth[_0x9506('0xc')](),controller[_0x9506('0xf')]);router[_0x9506('0x10')]('/',auth[_0x9506('0xc')](),controller[_0x9506('0x11')]);router[_0x9506('0x10')](_0x9506('0x12'),auth[_0x9506('0xc')](),controller[_0x9506('0x13')]);router[_0x9506('0x14')](_0x9506('0xe'),auth[_0x9506('0xc')](),controller['update']);router[_0x9506('0x15')](_0x9506('0xe'),auth[_0x9506('0xc')](),controller[_0x9506('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index faad9e6..d9f687f 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x1a7244,_0x3d99d9){var _0x5c4e9f=function(_0xe168b8){while(--_0xe168b8){_0x1a7244['push'](_0x1a7244['shift']());}};_0x5c4e9f(++_0x3d99d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x18b56f,_0x2d8823){var _0x4df0e0=function(_0x9315f2){while(--_0x9315f2){_0x18b56f['push'](_0x18b56f['shift']());}};_0x4df0e0(++_0x2d8823);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 35845e9..7d8652d 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 _0x099d=['cast(priority\x20as\x20unsigned)','finally','send','json','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','./voiceExtension.socket','register','sendStatus','status','end','offset','limit','count','set','Content-Range','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','find','destroy','stack','name','index','VoiceExtension','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','pick','filters','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','body','startsWith','exten','concat','create','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','READ_COMMITTED','createRouting','bulkCreate','findAndCountAll'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x099d,0xbc));var _0xd099=function(_0x26ff02,_0x87110f){_0x26ff02=_0x26ff02-0x0;var _0x2a203e=_0x099d[_0x26ff02];return _0x2a203e;};'use strict';var _=require(_0xd099('0x0'));var Redis=require(_0xd099('0x1'));var qs=require(_0xd099('0x2'));var logger=require(_0xd099('0x3'))(_0xd099('0x4'));var config=require('../../config/environment');var db=require(_0xd099('0x5'))['db'];config['redis']=_['defaults'](config[_0xd099('0x6')],{'host':_0xd099('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd099('0x8'))[_0xd099('0x9')](socket);function respondWithStatusCode(_0x57a3b8,_0x24c69e){_0x24c69e=_0x24c69e||0xcc;return function(_0x3d77ec){if(_0x3d77ec){return _0x57a3b8[_0xd099('0xa')](_0x24c69e);}return _0x57a3b8[_0xd099('0xb')](_0x24c69e)[_0xd099('0xc')]();};}function respondWithResult(_0x4095c3,_0x2b74de){_0x2b74de=_0x2b74de||0xc8;return function(_0x58c088){if(_0x58c088){return _0x4095c3[_0xd099('0xb')](_0x2b74de)['json'](_0x58c088);}};}function respondWithFilteredResult(_0x3940fc,_0x1eb598){return function(_0x4c43d0){if(_0x4c43d0){var _0x8e7794=typeof _0x1eb598[_0xd099('0xd')]==='undefined'&&typeof _0x1eb598[_0xd099('0xe')]==='undefined';var _0x30f911=_0x4c43d0[_0xd099('0xf')];var _0x2b37b1=_0x8e7794?0x0:_0x1eb598[_0xd099('0xd')];var _0x4e591a=_0x8e7794?_0x4c43d0[_0xd099('0xf')]:_0x1eb598[_0xd099('0xd')]+_0x1eb598[_0xd099('0xe')];var _0x140867;if(_0x4e591a>=_0x30f911){_0x4e591a=_0x30f911;_0x140867=0xc8;}else{_0x140867=0xce;}_0x3940fc[_0xd099('0xb')](_0x140867);return _0x3940fc[_0xd099('0x10')](_0xd099('0x11'),_0x2b37b1+'-'+_0x4e591a+'/'+_0x30f911)['json'](_0x4c43d0);}return null;};}function removeEntity(_0x2fa2c4){return function(_0x2ceee3){if(_0x2ceee3){return _0x2ceee3['destroy']()[_0xd099('0x12')](function(){var _0x3d31df=_0x2ceee3['get']({'plain':!![]});var _0x4af249=[{'name':_0xd099('0x13'),'value':_0xd099('0x14'),'ignore':![]},{'name':_0xd099('0x15'),'value':_0xd099('0x16'),'ignore':![]},{'name':_0xd099('0x17'),'value':_0xd099('0x18'),'ignore':![]}];var _0x18bead=_(_0x4af249)[_0xd099('0x19')]('ignore')[_0xd099('0x1a')]('value')[_0xd099('0x1b')]();if(_[_0xd099('0x1c')](_0x18bead,_0x3d31df['type'])){return;}var _0x123b3e=_[_0xd099('0x1d')](_0x4af249,['value',_0x3d31df['type']])['name'];return db['UserProfileResource'][_0xd099('0x1e')]({'where':{'type':_0x123b3e,'resourceId':_0x3d31df['id']}})[_0xd099('0x12')](function(){return _0x2ceee3;});})['then'](function(){_0x2fa2c4[_0xd099('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2512){return function(_0x1d1470){if(!_0x1d1470){_0x5c2512['sendStatus'](0x194);}return _0x1d1470;};}function handleError(_0x361527,_0x2ea94a){_0x2ea94a=_0x2ea94a||0x1f4;return function(_0x180cc1){logger['error'](_0x180cc1[_0xd099('0x1f')]);if(_0x180cc1[_0xd099('0x20')]){delete _0x180cc1[_0xd099('0x20')];}_0x361527['status'](_0x2ea94a)['send'](_0x180cc1);};}exports[_0xd099('0x21')]=function(_0x3d0a7f,_0x562ea3){var _0x352a9={},_0x57999e={},_0xe0a974={'count':0x0,'rows':[]};var _0xbf4b4d=_['map'](db[_0xd099('0x22')][_0xd099('0x23')],function(_0x5cc49d){return{'name':_0x5cc49d[_0xd099('0x24')],'type':_0x5cc49d[_0xd099('0x25')][_0xd099('0x26')]};});_0x57999e[_0xd099('0x27')]=_[_0xd099('0x1a')](_0xbf4b4d,_0xd099('0x20'));_0x57999e[_0xd099('0x28')]=_[_0xd099('0x29')](_0x3d0a7f[_0xd099('0x28')]);_0x57999e['filters']=_[_0xd099('0x2a')](_0x57999e[_0xd099('0x27')],_0x57999e[_0xd099('0x28')]);_0x352a9[_0xd099('0x2b')]=_[_0xd099('0x2a')](_0x57999e[_0xd099('0x27')],qs[_0xd099('0x2c')](_0x3d0a7f['query']['fields']));_0x352a9['attributes']=_0x352a9[_0xd099('0x2b')]['length']?_0x352a9[_0xd099('0x2b')]:_0x57999e[_0xd099('0x27')];if(!_0x3d0a7f[_0xd099('0x28')]['hasOwnProperty']('nolimit')){_0x352a9['limit']=qs[_0xd099('0xe')](_0x3d0a7f[_0xd099('0x28')][_0xd099('0xe')]);_0x352a9[_0xd099('0xd')]=qs[_0xd099('0xd')](_0x3d0a7f[_0xd099('0x28')][_0xd099('0xd')]);}_0x352a9[_0xd099('0x2d')]=qs[_0xd099('0x2e')](_0x3d0a7f[_0xd099('0x28')][_0xd099('0x2e')]);_0x352a9['where']=qs['filters'](_[_0xd099('0x2f')](_0x3d0a7f['query'],_0x57999e[_0xd099('0x30')]),_0xbf4b4d);if(_0x3d0a7f[_0xd099('0x28')][_0xd099('0x19')]){_0x352a9[_0xd099('0x31')]=_[_0xd099('0x32')](_0x352a9[_0xd099('0x31')],{'$or':_[_0xd099('0x1a')](_0xbf4b4d,function(_0xb8aa7a){if(_0xb8aa7a[_0xd099('0x25')]!==_0xd099('0x33')){var _0x5e066a={};_0x5e066a[_0xb8aa7a[_0xd099('0x20')]]={'$like':'%'+_0x3d0a7f['query']['filter']+'%'};return _0x5e066a;}})});}_0x352a9=_[_0xd099('0x32')]({},_0x352a9,_0x3d0a7f['options']);var _0x33424e={'where':_0x352a9[_0xd099('0x31')]};return db[_0xd099('0x22')][_0xd099('0xf')](_0x33424e)[_0xd099('0x12')](function(_0x4c9848){_0xe0a974[_0xd099('0xf')]=_0x4c9848;if(_0x3d0a7f[_0xd099('0x28')][_0xd099('0x34')]){_0x352a9[_0xd099('0x35')]=[{'all':!![]}];}return db['VoiceExtension'][_0xd099('0x36')](_0x352a9);})[_0xd099('0x12')](function(_0x3c749a){_0xe0a974[_0xd099('0x37')]=_0x3c749a;return _0xe0a974;})[_0xd099('0x12')](respondWithFilteredResult(_0x562ea3,_0x352a9))[_0xd099('0x38')](handleError(_0x562ea3,null));};exports[_0xd099('0x39')]=function(_0x70e441,_0x1ea1ac){var _0x486adc={'raw':![],'where':{'id':_0x70e441[_0xd099('0x3a')]['id']}},_0x467183={};_0x467183[_0xd099('0x27')]=_[_0xd099('0x29')](db[_0xd099('0x22')][_0xd099('0x23')]);_0x467183['query']=_['keys'](_0x70e441['query']);_0x467183[_0xd099('0x30')]=_['intersection'](_0x467183['model'],_0x467183[_0xd099('0x28')]);_0x486adc[_0xd099('0x2b')]=_[_0xd099('0x2a')](_0x467183[_0xd099('0x27')],qs[_0xd099('0x2c')](_0x70e441[_0xd099('0x28')][_0xd099('0x2c')]));_0x486adc[_0xd099('0x2b')]=_0x486adc['attributes'][_0xd099('0x3b')]?_0x486adc[_0xd099('0x2b')]:_0x467183['model'];if(_0x70e441['query'][_0xd099('0x34')]){_0x486adc[_0xd099('0x35')]=[{'all':!![]}];}_0x486adc=_[_0xd099('0x32')]({},_0x486adc,_0x70e441[_0xd099('0x3c')]);return db[_0xd099('0x22')][_0xd099('0x1d')](_0x486adc)['then'](handleEntityNotFound(_0x1ea1ac,null))['then'](respondWithResult(_0x1ea1ac,null))[_0xd099('0x38')](handleError(_0x1ea1ac,null));};exports['destroy']=function(_0x5a5f5f,_0x56ddb2){return db[_0xd099('0x22')][_0xd099('0x1d')]({'where':{'id':_0x5a5f5f['params']['id']}})['then'](handleEntityNotFound(_0x56ddb2,null))[_0xd099('0x12')](removeEntity(_0x56ddb2,null))['catch'](handleError(_0x56ddb2,null));};exports['create']=function(_0x4ffbce,_0x390135){if(_0x4ffbce[_0xd099('0x3d')]['type']===_0xd099('0x16')&&!_[_0xd099('0x3e')](_0x4ffbce[_0xd099('0x3d')]['exten'],'_')){_0x4ffbce[_0xd099('0x3d')][_0xd099('0x3f')]='_'[_0xd099('0x40')](_0x4ffbce[_0xd099('0x3d')]['exten']);}return db[_0xd099('0x22')][_0xd099('0x41')](_0x4ffbce['body'],{'raw':![]})['then'](function(_0x552344){var _0x23b6b0=_0x4ffbce['user'][_0xd099('0x42')]({'plain':!![]});if(!_0x23b6b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23b6b0[_0xd099('0x43')]==='user'){var _0x7d8459=_0x552344[_0xd099('0x42')]({'plain':!![]});var _0x490d12=[{'name':_0xd099('0x13'),'value':_0xd099('0x14')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0xd099('0x17'),'value':_0xd099('0x18')}];var _0x277c27=_[_0xd099('0x1d')](_0x490d12,[_0xd099('0x1b'),_0x7d8459[_0xd099('0x25')]])[_0xd099('0x20')];return db[_0xd099('0x44')][_0xd099('0x1d')]({'where':{'name':_0x277c27,'userProfileId':_0x23b6b0[_0xd099('0x45')]},'raw':!![]})[_0xd099('0x12')](function(_0x497b4c){if(_0x497b4c&&_0x497b4c[_0xd099('0x46')]===0x0){return db[_0xd099('0x47')][_0xd099('0x41')]({'name':_0x7d8459[_0xd099('0x20')],'resourceId':_0x7d8459['id'],'type':_0x497b4c[_0xd099('0x20')],'sectionId':_0x497b4c['id']},{})[_0xd099('0x12')](function(){return _0x552344;});}else{return _0x552344;}})[_0xd099('0x38')](function(_0x275cf8){logger[_0xd099('0x48')](_0xd099('0x49'),_0x275cf8);throw _0x275cf8;});}return _0x552344;})[_0xd099('0x12')](respondWithResult(_0x390135,0xc9))['catch'](handleError(_0x390135,null));};exports[_0xd099('0x4a')]=function(_0x21ed86,_0x301000){if(_0x21ed86['body']['id']){delete _0x21ed86[_0xd099('0x3d')]['id'];}return db[_0xd099('0x22')][_0xd099('0x1d')]({'where':{'id':_0x21ed86['params']['id']}})[_0xd099('0x12')](handleEntityNotFound(_0x301000,null))[_0xd099('0x12')](function(_0x2b6fa4){if(_0x2b6fa4){return db['VoiceExtension']['update'](_[_0xd099('0x2f')](_0x21ed86[_0xd099('0x3d')],[_0xd099('0x3f'),_0xd099('0x4b'),_0xd099('0x4c'),_0xd099('0x4d'),_0xd099('0x4e'),_0xd099('0x4f'),_0xd099('0x50')]),{'where':{'context':_0x2b6fa4['context'],'exten':_0x2b6fa4[_0xd099('0x3f')]},'individualHooks':!![]})['then'](function(_0x3f51ae){return _0x3f51ae;});}return null;})[_0xd099('0x12')](respondWithStatusCode(_0x301000,null))[_0xd099('0x38')](handleError(_0x301000,null));};exports[_0xd099('0x51')]=function(_0x475c7,_0x333fac){var _0x5b15de=_0x475c7['params']['id'];var _0x37e73c=_0x475c7[_0xd099('0x3d')];var _0x5dde1d=0xc8;var _0x4421cd=null;return db[_0xd099('0x52')]['transaction']({'isolationLevel':db[_0xd099('0x52')][_0xd099('0x53')]['ISOLATION_LEVELS'][_0xd099('0x54')]},function(_0x4d7d62){return db[_0xd099('0x22')]['findOne']({'where':{'id':_0x5b15de},'transaction':_0x4d7d62})['then'](function(_0x5c42b6){if(_0x5c42b6){return db[_0xd099('0x22')]['destroy']({'where':{'VoiceExtensionId':_0x5b15de},'transaction':_0x4d7d62})[_0xd099('0x12')](function(){var _0xe34343=_[_0xd099('0x1a')](_0x37e73c,function(_0x455583){_0x455583['VoiceExtensionId']=_0x5b15de;_0x455583['isApp']=!![];return _0x455583;});return _0x5c42b6[_0xd099('0x55')](_0xe34343);})[_0xd099('0x12')](function(_0x41c748){return db['VoiceExtension'][_0xd099('0x56')](_0x41c748,{'transaction':_0x4d7d62});});}else{_0x5dde1d=0x194;_0x4421cd=[];}});})[_0xd099('0x12')](function(){if(_0x5dde1d!==0x194){return db['VoiceExtension'][_0xd099('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5b15de},'order':_0xd099('0x58')})['then'](function(_0x5b36b7){_0x4421cd=_0x5b36b7;});}})[_0xd099('0x38')](function(_0x2dee28){_0x5dde1d=0x1f4;logger[_0xd099('0x48')](_0x2dee28[_0xd099('0x1f')]);if(_0x2dee28['name']){delete _0x2dee28[_0xd099('0x20')];}_0x4421cd=_0x2dee28;})[_0xd099('0x59')](function(){if(_0x4421cd===null){_0x333fac['sendStatus'](_0x5dde1d);}else{if(_0x5dde1d===0x1f4){_0x333fac[_0xd099('0xb')](_0x5dde1d)[_0xd099('0x5a')](_0x4421cd);}else{_0x333fac[_0xd099('0xb')](_0x5dde1d)[_0xd099('0x5b')](_0x4421cd);}}});}; \ No newline at end of file +var _0x07c7=['concat','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','internal','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','cutdigits','alias','context','addApplications','sequelize','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','destroy','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','type','find','value','name','UserProfileResource','then','error','stack','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','rows','catch','show','params','create','startsWith','exten'];(function(_0x56718b,_0x4a82ba){var _0x4723e7=function(_0x9ca7cc){while(--_0x9ca7cc){_0x56718b['push'](_0x56718b['shift']());}};_0x4723e7(++_0x4a82ba);}(_0x07c7,0xd3));var _0x707c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x07c7[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x707c('0x0'));var Redis=require(_0x707c('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x707c('0x2'))(_0x707c('0x3'));var config=require(_0x707c('0x4'));var db=require(_0x707c('0x5'))['db'];config['redis']=_[_0x707c('0x6')](config[_0x707c('0x7')],{'host':_0x707c('0x8'),'port':0x18eb});var socket=require(_0x707c('0x9'))(new Redis(config['redis']));require(_0x707c('0xa'))[_0x707c('0xb')](socket);function respondWithStatusCode(_0x110264,_0x27ec25){_0x27ec25=_0x27ec25||0xcc;return function(_0x389f72){if(_0x389f72){return _0x110264[_0x707c('0xc')](_0x27ec25);}return _0x110264['status'](_0x27ec25)[_0x707c('0xd')]();};}function respondWithResult(_0x514048,_0x4dd236){_0x4dd236=_0x4dd236||0xc8;return function(_0x1aa01a){if(_0x1aa01a){return _0x514048[_0x707c('0xe')](_0x4dd236)[_0x707c('0xf')](_0x1aa01a);}};}function respondWithFilteredResult(_0x4e8494,_0x1a808a){return function(_0x2f67fe){if(_0x2f67fe){var _0x50999f=typeof _0x1a808a[_0x707c('0x10')]===_0x707c('0x11')&&typeof _0x1a808a['limit']==='undefined';var _0x4dfda5=_0x2f67fe[_0x707c('0x12')];var _0x422025=_0x50999f?0x0:_0x1a808a[_0x707c('0x10')];var _0x47402a=_0x50999f?_0x2f67fe['count']:_0x1a808a[_0x707c('0x10')]+_0x1a808a[_0x707c('0x13')];var _0x18b6e7;if(_0x47402a>=_0x4dfda5){_0x47402a=_0x4dfda5;_0x18b6e7=0xc8;}else{_0x18b6e7=0xce;}_0x4e8494[_0x707c('0xe')](_0x18b6e7);return _0x4e8494[_0x707c('0x14')](_0x707c('0x15'),_0x422025+'-'+_0x47402a+'/'+_0x4dfda5)[_0x707c('0xf')](_0x2f67fe);}return null;};}function removeEntity(_0x461ea0){return function(_0x469172){if(_0x469172){return _0x469172[_0x707c('0x16')]()['then'](function(){var _0xf5561f=_0x469172['get']({'plain':!![]});var _0x5d44fc=[{'name':_0x707c('0x17'),'value':'inbound','ignore':![]},{'name':_0x707c('0x18'),'value':_0x707c('0x19'),'ignore':![]},{'name':_0x707c('0x1a'),'value':'internal','ignore':![]}];var _0x384a2f=_(_0x5d44fc)[_0x707c('0x1b')](_0x707c('0x1c'))[_0x707c('0x1d')]('value')['value']();if(_['includes'](_0x384a2f,_0xf5561f[_0x707c('0x1e')])){return;}var _0x3895bc=_[_0x707c('0x1f')](_0x5d44fc,[_0x707c('0x20'),_0xf5561f['type']])[_0x707c('0x21')];return db[_0x707c('0x22')][_0x707c('0x16')]({'where':{'type':_0x3895bc,'resourceId':_0xf5561f['id']}})[_0x707c('0x23')](function(){return _0x469172;});})[_0x707c('0x23')](function(){_0x461ea0[_0x707c('0xe')](0xcc)[_0x707c('0xd')]();});}};}function handleEntityNotFound(_0x400226){return function(_0x389418){if(!_0x389418){_0x400226[_0x707c('0xc')](0x194);}return _0x389418;};}function handleError(_0x1dc88b,_0x342862){_0x342862=_0x342862||0x1f4;return function(_0x18d4b0){logger[_0x707c('0x24')](_0x18d4b0[_0x707c('0x25')]);if(_0x18d4b0[_0x707c('0x21')]){delete _0x18d4b0[_0x707c('0x21')];}_0x1dc88b[_0x707c('0xe')](_0x342862)['send'](_0x18d4b0);};}exports[_0x707c('0x26')]=function(_0x5502aa,_0xdeea3d){var _0x48fd55={},_0x31dffe={},_0x55966e={'count':0x0,'rows':[]};var _0x1d41f1=_[_0x707c('0x1d')](db['VoiceExtension'][_0x707c('0x27')],function(_0x498321){return{'name':_0x498321[_0x707c('0x28')],'type':_0x498321['type'][_0x707c('0x29')]};});_0x31dffe[_0x707c('0x2a')]=_[_0x707c('0x1d')](_0x1d41f1,_0x707c('0x21'));_0x31dffe['query']=_[_0x707c('0x2b')](_0x5502aa[_0x707c('0x2c')]);_0x31dffe[_0x707c('0x2d')]=_[_0x707c('0x2e')](_0x31dffe[_0x707c('0x2a')],_0x31dffe[_0x707c('0x2c')]);_0x48fd55[_0x707c('0x2f')]=_[_0x707c('0x2e')](_0x31dffe[_0x707c('0x2a')],qs[_0x707c('0x30')](_0x5502aa['query'][_0x707c('0x30')]));_0x48fd55[_0x707c('0x2f')]=_0x48fd55[_0x707c('0x2f')][_0x707c('0x31')]?_0x48fd55[_0x707c('0x2f')]:_0x31dffe[_0x707c('0x2a')];if(!_0x5502aa['query'][_0x707c('0x32')]('nolimit')){_0x48fd55[_0x707c('0x13')]=qs[_0x707c('0x13')](_0x5502aa[_0x707c('0x2c')][_0x707c('0x13')]);_0x48fd55[_0x707c('0x10')]=qs[_0x707c('0x10')](_0x5502aa[_0x707c('0x2c')][_0x707c('0x10')]);}_0x48fd55[_0x707c('0x33')]=qs[_0x707c('0x34')](_0x5502aa['query'][_0x707c('0x34')]);_0x48fd55[_0x707c('0x35')]=qs[_0x707c('0x2d')](_[_0x707c('0x36')](_0x5502aa['query'],_0x31dffe[_0x707c('0x2d')]),_0x1d41f1);if(_0x5502aa[_0x707c('0x2c')][_0x707c('0x1b')]){_0x48fd55['where']=_[_0x707c('0x37')](_0x48fd55[_0x707c('0x35')],{'$or':_['map'](_0x1d41f1,function(_0x16a171){if(_0x16a171[_0x707c('0x1e')]!==_0x707c('0x38')){var _0x4bad23={};_0x4bad23[_0x16a171[_0x707c('0x21')]]={'$like':'%'+_0x5502aa[_0x707c('0x2c')]['filter']+'%'};return _0x4bad23;}})});}_0x48fd55=_[_0x707c('0x37')]({},_0x48fd55,_0x5502aa[_0x707c('0x39')]);var _0x27afab={'where':_0x48fd55[_0x707c('0x35')]};return db[_0x707c('0x3a')]['count'](_0x27afab)['then'](function(_0x4dd6a1){_0x55966e[_0x707c('0x12')]=_0x4dd6a1;if(_0x5502aa[_0x707c('0x2c')][_0x707c('0x3b')]){_0x48fd55[_0x707c('0x3c')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x48fd55);})['then'](function(_0x501b1e){_0x55966e[_0x707c('0x3d')]=_0x501b1e;return _0x55966e;})[_0x707c('0x23')](respondWithFilteredResult(_0xdeea3d,_0x48fd55))[_0x707c('0x3e')](handleError(_0xdeea3d,null));};exports[_0x707c('0x3f')]=function(_0x56b88d,_0xd0adce){var _0x1711ca={'raw':![],'where':{'id':_0x56b88d['params']['id']}},_0xefff7e={};_0xefff7e[_0x707c('0x2a')]=_[_0x707c('0x2b')](db[_0x707c('0x3a')]['rawAttributes']);_0xefff7e[_0x707c('0x2c')]=_['keys'](_0x56b88d[_0x707c('0x2c')]);_0xefff7e[_0x707c('0x2d')]=_[_0x707c('0x2e')](_0xefff7e['model'],_0xefff7e[_0x707c('0x2c')]);_0x1711ca[_0x707c('0x2f')]=_[_0x707c('0x2e')](_0xefff7e[_0x707c('0x2a')],qs['fields'](_0x56b88d[_0x707c('0x2c')][_0x707c('0x30')]));_0x1711ca[_0x707c('0x2f')]=_0x1711ca[_0x707c('0x2f')][_0x707c('0x31')]?_0x1711ca[_0x707c('0x2f')]:_0xefff7e[_0x707c('0x2a')];if(_0x56b88d[_0x707c('0x2c')][_0x707c('0x3b')]){_0x1711ca['include']=[{'all':!![]}];}_0x1711ca=_[_0x707c('0x37')]({},_0x1711ca,_0x56b88d[_0x707c('0x39')]);return db[_0x707c('0x3a')][_0x707c('0x1f')](_0x1711ca)['then'](handleEntityNotFound(_0xd0adce,null))[_0x707c('0x23')](respondWithResult(_0xd0adce,null))['catch'](handleError(_0xd0adce,null));};exports[_0x707c('0x16')]=function(_0x2221c6,_0x4344b8){return db[_0x707c('0x3a')]['find']({'where':{'id':_0x2221c6[_0x707c('0x40')]['id']}})[_0x707c('0x23')](handleEntityNotFound(_0x4344b8,null))[_0x707c('0x23')](removeEntity(_0x4344b8,null))[_0x707c('0x3e')](handleError(_0x4344b8,null));};exports[_0x707c('0x41')]=function(_0x32399a,_0x369e85){if(_0x32399a['body']['type']==='outbound'&&!_[_0x707c('0x42')](_0x32399a['body'][_0x707c('0x43')],'_')){_0x32399a['body'][_0x707c('0x43')]='_'[_0x707c('0x44')](_0x32399a[_0x707c('0x45')][_0x707c('0x43')]);}return db[_0x707c('0x3a')][_0x707c('0x41')](_0x32399a[_0x707c('0x45')],{'raw':![]})['then'](function(_0x464839){var _0x365995=_0x32399a[_0x707c('0x46')][_0x707c('0x47')]({'plain':!![]});if(!_0x365995)throw new Error(_0x707c('0x48'));if(_0x365995[_0x707c('0x49')]===_0x707c('0x46')){var _0x272dcb=_0x464839[_0x707c('0x47')]({'plain':!![]});var _0x2098f1=[{'name':'InboundRoutes','value':_0x707c('0x4a')},{'name':'OutboundRoutes','value':_0x707c('0x19')},{'name':'InternalRoutes','value':_0x707c('0x4b')}];var _0x1e5a3c=_['find'](_0x2098f1,[_0x707c('0x20'),_0x272dcb[_0x707c('0x1e')]])[_0x707c('0x21')];return db[_0x707c('0x4c')][_0x707c('0x1f')]({'where':{'name':_0x1e5a3c,'userProfileId':_0x365995['userProfileId']},'raw':!![]})[_0x707c('0x23')](function(_0x3f838a){if(_0x3f838a&&_0x3f838a[_0x707c('0x4d')]===0x0){return db['UserProfileResource'][_0x707c('0x41')]({'name':_0x272dcb[_0x707c('0x21')],'resourceId':_0x272dcb['id'],'type':_0x3f838a[_0x707c('0x21')],'sectionId':_0x3f838a['id']},{})[_0x707c('0x23')](function(){return _0x464839;});}else{return _0x464839;}})[_0x707c('0x3e')](function(_0x53d87b){logger['error'](_0x707c('0x4e'),_0x53d87b);throw _0x53d87b;});}return _0x464839;})['then'](respondWithResult(_0x369e85,0xc9))[_0x707c('0x3e')](handleError(_0x369e85,null));};exports['update']=function(_0x30bdbb,_0x5eb217){if(_0x30bdbb[_0x707c('0x45')]['id']){delete _0x30bdbb['body']['id'];}return db[_0x707c('0x3a')][_0x707c('0x1f')]({'where':{'id':_0x30bdbb['params']['id']}})[_0x707c('0x23')](handleEntityNotFound(_0x5eb217,null))[_0x707c('0x23')](function(_0x46fdb7){if(_0x46fdb7){return db[_0x707c('0x3a')]['update'](_[_0x707c('0x36')](_0x30bdbb[_0x707c('0x45')],['exten','context',_0x707c('0x4f'),_0x707c('0x50'),_0x707c('0x51'),'mandatoryDisposition',_0x707c('0x52')]),{'where':{'context':_0x46fdb7[_0x707c('0x53')],'exten':_0x46fdb7[_0x707c('0x43')]},'individualHooks':!![]})[_0x707c('0x23')](function(_0x55612a){return _0x55612a;});}return null;})['then'](respondWithStatusCode(_0x5eb217,null))[_0x707c('0x3e')](handleError(_0x5eb217,null));};exports[_0x707c('0x54')]=function(_0x3b5224,_0x44b1ef){var _0x5c368d=_0x3b5224[_0x707c('0x40')]['id'];var _0x457eaf=_0x3b5224[_0x707c('0x45')];var _0x1a49a3=0xc8;var _0x4fe0c4=null;return db[_0x707c('0x55')]['transaction']({'isolationLevel':db[_0x707c('0x55')]['Transaction']['ISOLATION_LEVELS'][_0x707c('0x56')]},function(_0x577878){return db[_0x707c('0x3a')]['findOne']({'where':{'id':_0x5c368d},'transaction':_0x577878})[_0x707c('0x23')](function(_0x25443c){if(_0x25443c){return db[_0x707c('0x3a')][_0x707c('0x16')]({'where':{'VoiceExtensionId':_0x5c368d},'transaction':_0x577878})[_0x707c('0x23')](function(){var _0x57bf3b=_['map'](_0x457eaf,function(_0x5ad646){_0x5ad646[_0x707c('0x57')]=_0x5c368d;_0x5ad646[_0x707c('0x58')]=!![];return _0x5ad646;});return _0x25443c[_0x707c('0x59')](_0x57bf3b);})[_0x707c('0x23')](function(_0x544eb2){return db['VoiceExtension'][_0x707c('0x5a')](_0x544eb2,{'transaction':_0x577878});});}else{_0x1a49a3=0x194;_0x4fe0c4=[];}});})[_0x707c('0x23')](function(){if(_0x1a49a3!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5c368d},'order':_0x707c('0x5b')})[_0x707c('0x23')](function(_0x399f8a){_0x4fe0c4=_0x399f8a;});}})[_0x707c('0x3e')](function(_0xd9227){_0x1a49a3=0x1f4;logger[_0x707c('0x24')](_0xd9227[_0x707c('0x25')]);if(_0xd9227['name']){delete _0xd9227['name'];}_0x4fe0c4=_0xd9227;})[_0x707c('0x5c')](function(){if(_0x4fe0c4===null){_0x44b1ef[_0x707c('0xc')](_0x1a49a3);}else{if(_0x1a49a3===0x1f4){_0x44b1ef['status'](_0x1a49a3)['send'](_0x4fe0c4);}else{_0x44b1ef[_0x707c('0xe')](_0x1a49a3)[_0x707c('0xf')](_0x4fe0c4);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6619f06..e2d4e95 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 _0xcab9=['VoiceExtension','save','update','remove','emit','hasOwnProperty','events'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xcab9,0x117));var _0x9cab=function(_0x34190e,_0x50ecc7){_0x34190e=_0x34190e-0x0;var _0x41a4e6=_0xcab9[_0x34190e];return _0x41a4e6;};'use strict';var EventEmitter=require(_0x9cab('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x9cab('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9cab('0x2'),'afterUpdate':_0x9cab('0x3'),'afterDestroy':_0x9cab('0x4')};function emitEvent(_0x4d0073){return function(_0x55e258,_0x16734a,_0x23a596){VoiceExtensionEvents[_0x9cab('0x5')](_0x4d0073+':'+_0x55e258['id'],_0x55e258);VoiceExtensionEvents[_0x9cab('0x5')](_0x4d0073,_0x55e258);_0x23a596(null);};}for(var e in events){if(events[_0x9cab('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x32f9=['hook','VoiceExtension','save','remove','emit','hasOwnProperty'];(function(_0x5a5d3f,_0x5581b4){var _0x2c7620=function(_0x3b863e){while(--_0x3b863e){_0x5a5d3f['push'](_0x5a5d3f['shift']());}};_0x2c7620(++_0x5581b4);}(_0x32f9,0xeb));var _0x932f=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x32f9[_0x7e2eb0];return _0xd92de4;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x932f('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x932f('0x1'),'afterUpdate':'update','afterDestroy':_0x932f('0x2')};function emitEvent(_0x37a452){return function(_0x274753,_0x269ded,_0x397b36){VoiceExtensionEvents[_0x932f('0x3')](_0x37a452+':'+_0x274753['id'],_0x274753);VoiceExtensionEvents['emit'](_0x37a452,_0x274753);_0x397b36(null);};}for(var e in events){if(events[_0x932f('0x4')](e)){var event=events[e];VoiceExtension[_0x932f('0x5')](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 f878c52..59fcc3a 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 _0x3276=['MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','wav','timeout','url','split','length','trunk','param','phone','prefix','SIP','join','options','none','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','then','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','exten'];(function(_0x3b63ea,_0xa76dd6){var _0x3c14fb=function(_0x2bd0c9){while(--_0x2bd0c9){_0x3b63ea['push'](_0x3b63ea['shift']());}};_0x3c14fb(++_0xa76dd6);}(_0x3276,0x1d2));var _0x6327=function(_0xe29e61,_0x483104){_0xe29e61=_0xe29e61-0x0;var _0x4745f2=_0x3276[_0xe29e61];return _0x4745f2;};'use strict';var _=require(_0x6327('0x0'));var attributes=require(_0x6327('0x1'));module[_0x6327('0x2')]=function(_0x43cd09){var _0x5edd1d=_0x43cd09[_0x6327('0x3')];function _0xc96773(_0x4c044f){var _0xd0abb1=0x2;var _0x3a3e08=[{'type':_0x4c044f[_0x6327('0x4')],'app':'Set','appdata':_0x6327('0x5')+_0x4c044f[_0x6327('0x4')],'context':_0x4c044f[_0x6327('0x6')],'exten':_0x4c044f['exten'],'priority':_0xd0abb1++,'VoiceExtensionId':_0x4c044f['id']}];if(_0x4c044f['type']===_0x6327('0x7')){_0x3a3e08[_0x6327('0x8')]({'type':'inbound','app':_0x6327('0x9'),'appdata':_0x6327('0xa')+_0x4c044f['id'],'context':_0x4c044f['context'],'exten':_0x4c044f['exten'],'priority':_0xd0abb1++,'VoiceExtensionId':_0x4c044f['id']});}_0x3a3e08[_0x6327('0x8')]({'type':_0x4c044f[_0x6327('0x4')],'app':_0x6327('0x9'),'appdata':_0x6327('0xb'),'context':_0x4c044f[_0x6327('0x6')],'exten':_0x4c044f['exten'],'priority':_0xd0abb1++,'VoiceExtensionId':_0x4c044f['id']},{'type':_0x4c044f[_0x6327('0x4')],'app':_0x6327('0x9'),'appdata':_0x6327('0xc'),'context':_0x4c044f['context'],'exten':_0x4c044f[_0x6327('0xd')],'priority':_0xd0abb1++,'VoiceExtensionId':_0x4c044f['id']},{'type':_0x4c044f[_0x6327('0x4')],'app':_0x6327('0x9'),'appdata':_0x6327('0xe'),'context':_0x4c044f['context'],'exten':_0x4c044f[_0x6327('0xd')],'priority':_0xd0abb1++,'VoiceExtensionId':_0x4c044f['id']});return _0x3a3e08;}function _0x3ee0bf(_0x4fc635){var _0x285192=0x2;var _0x5bad6d=[{'type':'outbound','app':_0x6327('0x9'),'appdata':_0x6327('0xf'),'context':_0x4fc635[_0x6327('0x6')],'exten':_0x4fc635[_0x6327('0xd')],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']},{'type':_0x6327('0x10'),'app':_0x6327('0x9'),'appdata':_0x6327('0x11')+(_0x4fc635[_0x6327('0x12')]?_0x6327('0x13')+_0x4fc635[_0x6327('0x12')]+'}':_0x6327('0x14')),'context':_0x4fc635[_0x6327('0x6')],'exten':_0x4fc635[_0x6327('0xd')],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']},{'type':_0x6327('0x10'),'app':_0x6327('0x9'),'appdata':_0x6327('0xa')+_0x4fc635['id'],'context':_0x4fc635[_0x6327('0x6')],'exten':_0x4fc635[_0x6327('0xd')],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']},{'type':_0x6327('0x10'),'app':_0x6327('0x15'),'appdata':_0x6327('0x16')+(_0x285192+0x2)+'):Goto('+(_0x285192+0x1)+')','context':_0x4fc635[_0x6327('0x6')],'exten':_0x4fc635[_0x6327('0xd')],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']},{'type':'outbound','app':_0x6327('0x9'),'appdata':_0x4fc635['cutdigits']?_0x6327('0x17')+_0x4fc635[_0x6327('0x12')]+'}':_0x6327('0x18'),'context':_0x4fc635[_0x6327('0x6')],'exten':_0x4fc635[_0x6327('0xd')],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']},{'type':'outbound','app':_0x6327('0x9'),'appdata':_0x6327('0xb'),'context':_0x4fc635[_0x6327('0x6')],'exten':_0x4fc635[_0x6327('0xd')],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']},{'type':_0x6327('0x10'),'app':_0x6327('0x9'),'appdata':_0x6327('0xc'),'context':_0x4fc635[_0x6327('0x6')],'exten':_0x4fc635[_0x6327('0xd')],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']},{'type':_0x6327('0x10'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4fc635['context'],'exten':_0x4fc635['exten'],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']},{'type':_0x6327('0x10'),'app':_0x6327('0x9'),'appdata':_0x6327('0x19')+_0x4fc635['id'],'context':_0x4fc635[_0x6327('0x6')],'exten':_0x4fc635[_0x6327('0xd')],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']}];if(_0x4fc635[_0x6327('0x1a')](_0x6327('0x1b'))&&_0x4fc635['recordingFormat']!=='none'){_0x5bad6d[_0x6327('0x8')]({'type':_0x6327('0x10'),'app':_0x6327('0x9'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4fc635['context'],'exten':_0x4fc635[_0x6327('0xd')],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']},{'type':_0x6327('0x10'),'app':_0x6327('0x9'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4fc635[_0x6327('0x1b')]||_0x6327('0x1c'),'context':_0x4fc635[_0x6327('0x6')],'exten':_0x4fc635['exten'],'priority':_0x285192++,'VoiceExtensionId':_0x4fc635['id']});}return _0x5bad6d;}function _0x1159d9(_0x22d4b7,_0x21de26){var _0x10d55d=[{'name':'trunk','param':0x0},{'name':_0x6327('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':_0x6327('0x1e'),'param':0x3}];var _0x26e7d1={};var _0x1d9ecc=_0x21de26[_0x6327('0x1f')](',');var _0x3bbcc4=[];for(var _0x7e200c=0x0;_0x7e200c<_0x10d55d[_0x6327('0x20')];_0x7e200c++){switch(_0x10d55d[_0x7e200c]['name']){case'trunk':_0x26e7d1[_0x6327('0x21')]=_0x1d9ecc[_0x10d55d[_0x7e200c][_0x6327('0x22')]][_0x6327('0x1f')]('/')[0x1];_0x26e7d1[_0x6327('0x23')]=_0x1d9ecc[_0x10d55d[_0x7e200c][_0x6327('0x22')]]['split']('/')[0x2];_0x26e7d1[_0x6327('0x24')]=_0x26e7d1[_0x6327('0x23')]?_0x26e7d1[_0x6327('0x23')][_0x6327('0x1f')]('$')[0x0]:undefined;_0x26e7d1['phone']=_0x22d4b7['cutdigits']?(_0x26e7d1[_0x6327('0x24')]||'')+_0x6327('0x13')+_0x22d4b7['cutdigits']+'}':(_0x26e7d1[_0x6327('0x24')]||'')+_0x6327('0x14');_0x3bbcc4[_0x10d55d[_0x7e200c][_0x6327('0x22')]]=[_0x6327('0x25'),_0x26e7d1[_0x6327('0x21')],_0x26e7d1['phone']][_0x6327('0x26')]('/');break;case _0x6327('0x27'):_0x26e7d1[_0x6327('0x27')]=_0x1d9ecc[_0x10d55d[_0x7e200c][_0x6327('0x22')]];if(_0x22d4b7[_0x6327('0x1b')]!==_0x6327('0x28')){if(_0x26e7d1[_0x6327('0x27')][_0x6327('0x29')](_0x6327('0x2a'))<0x0){_0x26e7d1[_0x6327('0x27')]+='U(xcally-mixmonitor-context)';}}else{_0x26e7d1[_0x6327('0x27')]=_0x26e7d1[_0x6327('0x27')]['replace']('U(xcally-mixmonitor-context)','');}_0x3bbcc4[_0x10d55d[_0x7e200c]['param']]=_0x26e7d1[_0x6327('0x27')];break;default:_0x3bbcc4[_0x10d55d[_0x7e200c][_0x6327('0x22')]]=_0x1d9ecc[_0x10d55d[_0x7e200c]['param']];}}return _0x3bbcc4[_0x6327('0x26')](',');}function _0x79250b(_0xd241c9,_0x241ec1,_0x2a5c32){return new Promise(function(_0xc37e41,_0x59bcea){var _0x39ae4b=[];if(_[_0x6327('0x2b')](_0x241ec1))return _0xc37e41(_0x39ae4b);_0x5edd1d[_0x6327('0x2c')]['findAll']({'attributes':['id',_0x6327('0x2d'),_0x6327('0x2e')],'raw':!![]})['then'](function(_0x1def19){for(var _0x5e79c3=0x0,_0x4066e2=0x0;_0x5e79c3<_0x241ec1[_0x6327('0x20')];_0x5e79c3++,_0x4066e2=0x0){var _0x56a18c=_0x241ec1[_0x5e79c3];var _0x238330=[];var _0xfcc230=[];delete _0x56a18c['id'];if(_0x56a18c['interval']!==_0x6327('0x2f')){_0x56a18c[_0x6327('0x30')]=[_0x56a18c[_0x6327('0x2d')]];}else{_0x56a18c[_0x6327('0x30')]=_0x56a18c[_0x6327('0x2e')]?_[_0x6327('0x31')](_[_0x6327('0x32')](_0x1def19,{'IntervalId':_0x56a18c[_0x6327('0x2e')]}),_0x6327('0x2d')):[];}_0x56a18c[_0x6327('0x6')]=_0xd241c9[_0x6327('0x6')];_0x56a18c['exten']=_0xd241c9['exten'];if(_0x56a18c[_0x6327('0x4')])_0x56a18c['type']=_0x56a18c[_0x6327('0x4')][_0x6327('0x33')]();if(_0xd241c9[_0x6327('0x4')]==='outbound'){if(_0x56a18c['hasOwnProperty']('tag')&&_0x56a18c[_0x6327('0x34')]&&_0x56a18c[_0x6327('0x34')]!=='--'){_0x238330['push']({'type':_0x56a18c[_0x6327('0x4')][_0x6327('0x33')](),'app':'Set','appdata':_0x6327('0x35')+_0x56a18c[_0x6327('0x34')],'context':_0xd241c9['context'],'exten':_0xd241c9[_0x6327('0xd')],'priority':_0x56a18c['intervals']['length']+_0x2a5c32+_0x4066e2++,'VoiceExtensionId':_0xd241c9['id']});}_0x238330['push']({'type':_0x56a18c[_0x6327('0x4')][_0x6327('0x33')](),'app':_0x6327('0x15'),'appdata':_0x6327('0x36')+(_0x56a18c['callerID']?_0x6327('0x37')+_0x56a18c[_0x6327('0x38')]+')':_0x6327('0x39')),'context':_0xd241c9[_0x6327('0x6')],'exten':_0xd241c9['exten'],'priority':_0x56a18c[_0x6327('0x30')]['length']+_0x2a5c32+_0x4066e2++,'VoiceExtensionId':_0xd241c9['id']});}else{if(_0x56a18c[_0x6327('0x1a')]('answer')){if(['queue',_0x6327('0x3a')][_0x6327('0x3b')](_0x56a18c['app']['toLowerCase']())&&_0x56a18c[_0x6327('0x3c')]!==_0x6327('0x3d')){if(_0x56a18c['answer']){_0x238330[_0x6327('0x8')]({'type':_0x56a18c[_0x6327('0x4')][_0x6327('0x33')](),'app':'ExecIf','appdata':_0x6327('0x3e'),'context':_0xd241c9[_0x6327('0x6')],'exten':_0xd241c9[_0x6327('0xd')],'priority':_0x56a18c['intervals'][_0x6327('0x20')]+_0x2a5c32+_0x4066e2++,'VoiceExtensionId':_0xd241c9['id']});_0x238330[_0x6327('0x8')]({'type':_0x56a18c['type'][_0x6327('0x33')](),'app':_0x6327('0x9'),'appdata':_0x6327('0x3f'),'context':_0xd241c9[_0x6327('0x6')],'exten':_0xd241c9[_0x6327('0xd')],'priority':_0x56a18c[_0x6327('0x30')][_0x6327('0x20')]+_0x2a5c32+_0x4066e2++,'VoiceExtensionId':_0xd241c9['id']});}else{_0x238330['push']({'type':_0x56a18c[_0x6327('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xd241c9[_0x6327('0x6')],'exten':_0xd241c9[_0x6327('0xd')],'priority':_0x56a18c[_0x6327('0x30')][_0x6327('0x20')]+_0x2a5c32+_0x4066e2++,'VoiceExtensionId':_0xd241c9['id']});_0x238330[_0x6327('0x8')]({'type':_0x56a18c[_0x6327('0x4')][_0x6327('0x33')](),'app':'Set','appdata':_0x6327('0x40'),'context':_0xd241c9[_0x6327('0x6')],'exten':_0xd241c9[_0x6327('0xd')],'priority':_0x56a18c[_0x6327('0x30')][_0x6327('0x20')]+_0x2a5c32+_0x4066e2++,'VoiceExtensionId':_0xd241c9['id']});}}}}for(var _0x41eb9d=0x0;_0x41eb9d<_0x56a18c[_0x6327('0x30')][_0x6327('0x20')];_0x41eb9d++){var _0x24c6ab=_0x2a5c32+_0x56a18c[_0x6327('0x30')][_0x6327('0x20')];var _0x166af4=_0x41eb9d===_0x56a18c[_0x6327('0x30')][_0x6327('0x20')]-0x1?_0x2a5c32+_0x238330[_0x6327('0x20')]+_0xfcc230[_0x6327('0x20')]+0x2:_0x2a5c32+_0x41eb9d+0x1;_0x238330[_0x6327('0x41')](_0x41eb9d,0x0,{'type':_0xd241c9[_0x6327('0x4')],'app':_0x6327('0x42'),'appdata':_0x56a18c[_0x6327('0x30')][_0x41eb9d]+'?'+_0xd241c9[_0x6327('0x6')]+_0x6327('0x43')+_0x24c6ab+':'+_0xd241c9[_0x6327('0x6')]+',${EXTEN},'+_0x166af4,'exten':_0xd241c9['exten'],'context':_0xd241c9[_0x6327('0x6')],'priority':_0x2a5c32+_0x41eb9d,'VoiceExtensionId':_0xd241c9['id']});}if(_0x56a18c[_0x6327('0x3c')]===_0x6327('0x44')){_0x56a18c[_0x6327('0x45')]=_0x1159d9(_0xd241c9,_0x56a18c[_0x6327('0x45')]);}if(_0x56a18c[_0x6327('0x3c')]==='agi'){_0x238330[_0x6327('0x8')]({'type':_0x56a18c[_0x6327('0x4')][_0x6327('0x33')](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0xd241c9[_0x6327('0x6')],'exten':_0xd241c9['exten'],'priority':_0x56a18c[_0x6327('0x30')][_0x6327('0x20')]+_0x2a5c32+_0x4066e2++,'VoiceExtensionId':_0xd241c9['id']});}_0x56a18c[_0x6327('0x46')]=_0x238330[_0x6327('0x20')]?_['last'](_0x238330)[_0x6327('0x46')]+0x1:_0x2a5c32;_0x39ae4b=_['concat'](_0x39ae4b,_0x238330,[_0x56a18c],_0xfcc230);_0x2a5c32=_[_0x6327('0x47')](_0x39ae4b)['priority']+0x1;}return _0xc37e41(_0x39ae4b);})[_0x6327('0x48')](function(_0x2e6dcd){_0x59bcea(_0x2e6dcd);});});}return _0x43cd09[_0x6327('0x49')](_0x6327('0x4a'),attributes,{'tableName':_0x6327('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3bcf0d){var _0x474670=this[_0x6327('0x4c')]({'plain':!![]});var _0x2419ea=_0x474670['type']==='outbound'?_0x3ee0bf(_0x474670):_0xc96773(_0x474670);return _0x79250b(_0x474670,_0x3bcf0d,_['last'](_0x2419ea)['priority']+0x1)[_0x6327('0x4d')](function(_0x587b1f){var _0x21acea=_[_0x6327('0x4e')](_0x2419ea,_0x587b1f);_0x21acea[_0x6327('0x8')]({'type':_0x474670[_0x6327('0x4')],'app':_0x6327('0x4f'),'exten':_0x474670['exten'],'context':_0x474670[_0x6327('0x6')],'priority':_[_0x6327('0x47')](_0x21acea)[_0x6327('0x46')]+0x1,'VoiceExtensionId':_0x474670['id']});return _0x21acea;});}}});}; \ No newline at end of file +var _0xfdf1=['join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','catch','define','VoiceExtension','last','Hangup','exports','Set','type','context','exten','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','trunk','url','split','length','name','param','phone','prefix','SIP'];(function(_0x574b7f,_0x5a758e){var _0x3da1af=function(_0x4b382e){while(--_0x4b382e){_0x574b7f['push'](_0x574b7f['shift']());}};_0x3da1af(++_0x5a758e);}(_0xfdf1,0x7c));var _0x1fdf=function(_0x5a62fc,_0x466c1b){_0x5a62fc=_0x5a62fc-0x0;var _0x218101=_0xfdf1[_0x5a62fc];return _0x218101;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x1fdf('0x0')]=function(_0x2b054c){var _0x43205b=_0x2b054c['models'];function _0xde3946(_0x5f3c60){var _0x323556=0x2;var _0x54ca6d=[{'type':_0x5f3c60['type'],'app':_0x1fdf('0x1'),'appdata':'CDR(type)='+_0x5f3c60[_0x1fdf('0x2')],'context':_0x5f3c60[_0x1fdf('0x3')],'exten':_0x5f3c60[_0x1fdf('0x4')],'priority':_0x323556++,'VoiceExtensionId':_0x5f3c60['id']}];if(_0x5f3c60[_0x1fdf('0x2')]==='inbound'){_0x54ca6d['push']({'type':'inbound','app':_0x1fdf('0x1'),'appdata':'CDR(routeid)='+_0x5f3c60['id'],'context':_0x5f3c60[_0x1fdf('0x3')],'exten':_0x5f3c60[_0x1fdf('0x4')],'priority':_0x323556++,'VoiceExtensionId':_0x5f3c60['id']});}_0x54ca6d[_0x1fdf('0x5')]({'type':_0x5f3c60['type'],'app':_0x1fdf('0x1'),'appdata':_0x1fdf('0x6'),'context':_0x5f3c60[_0x1fdf('0x3')],'exten':_0x5f3c60[_0x1fdf('0x4')],'priority':_0x323556++,'VoiceExtensionId':_0x5f3c60['id']},{'type':_0x5f3c60[_0x1fdf('0x2')],'app':_0x1fdf('0x1'),'appdata':_0x1fdf('0x7'),'context':_0x5f3c60[_0x1fdf('0x3')],'exten':_0x5f3c60[_0x1fdf('0x4')],'priority':_0x323556++,'VoiceExtensionId':_0x5f3c60['id']},{'type':_0x5f3c60[_0x1fdf('0x2')],'app':_0x1fdf('0x1'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5f3c60[_0x1fdf('0x3')],'exten':_0x5f3c60[_0x1fdf('0x4')],'priority':_0x323556++,'VoiceExtensionId':_0x5f3c60['id']});return _0x54ca6d;}function _0x142699(_0x5ee877){var _0x291a5b=0x2;var _0x44bb36=[{'type':_0x1fdf('0x8'),'app':_0x1fdf('0x1'),'appdata':_0x1fdf('0x9'),'context':_0x5ee877[_0x1fdf('0x3')],'exten':_0x5ee877[_0x1fdf('0x4')],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']},{'type':_0x1fdf('0x8'),'app':_0x1fdf('0x1'),'appdata':_0x1fdf('0xa')+(_0x5ee877['cutdigits']?_0x1fdf('0xb')+_0x5ee877[_0x1fdf('0xc')]+'}':_0x1fdf('0xd')),'context':_0x5ee877['context'],'exten':_0x5ee877[_0x1fdf('0x4')],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']},{'type':_0x1fdf('0x8'),'app':_0x1fdf('0x1'),'appdata':'CDR(routeid)='+_0x5ee877['id'],'context':_0x5ee877['context'],'exten':_0x5ee877[_0x1fdf('0x4')],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']},{'type':_0x1fdf('0x8'),'app':_0x1fdf('0xe'),'appdata':_0x1fdf('0xf')+(_0x291a5b+0x2)+_0x1fdf('0x10')+(_0x291a5b+0x1)+')','context':_0x5ee877[_0x1fdf('0x3')],'exten':_0x5ee877[_0x1fdf('0x4')],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']},{'type':_0x1fdf('0x8'),'app':_0x1fdf('0x1'),'appdata':_0x5ee877[_0x1fdf('0xc')]?_0x1fdf('0x11')+_0x5ee877[_0x1fdf('0xc')]+'}':_0x1fdf('0x12'),'context':_0x5ee877[_0x1fdf('0x3')],'exten':_0x5ee877[_0x1fdf('0x4')],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']},{'type':_0x1fdf('0x8'),'app':_0x1fdf('0x1'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5ee877[_0x1fdf('0x3')],'exten':_0x5ee877['exten'],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']},{'type':_0x1fdf('0x8'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5ee877[_0x1fdf('0x3')],'exten':_0x5ee877[_0x1fdf('0x4')],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']},{'type':_0x1fdf('0x8'),'app':_0x1fdf('0x1'),'appdata':_0x1fdf('0x13'),'context':_0x5ee877[_0x1fdf('0x3')],'exten':_0x5ee877['exten'],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']},{'type':_0x1fdf('0x8'),'app':_0x1fdf('0x1'),'appdata':_0x1fdf('0x14')+_0x5ee877['id'],'context':_0x5ee877[_0x1fdf('0x3')],'exten':_0x5ee877[_0x1fdf('0x4')],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']}];if(_0x5ee877[_0x1fdf('0x15')]('recordingFormat')&&_0x5ee877['recordingFormat']!==_0x1fdf('0x16')){_0x44bb36[_0x1fdf('0x5')]({'type':_0x1fdf('0x8'),'app':'Set','appdata':_0x1fdf('0x17'),'context':_0x5ee877[_0x1fdf('0x3')],'exten':_0x5ee877[_0x1fdf('0x4')],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']},{'type':_0x1fdf('0x8'),'app':_0x1fdf('0x1'),'appdata':_0x1fdf('0x18')+_0x5ee877[_0x1fdf('0x19')]||_0x1fdf('0x1a'),'context':_0x5ee877[_0x1fdf('0x3')],'exten':_0x5ee877[_0x1fdf('0x4')],'priority':_0x291a5b++,'VoiceExtensionId':_0x5ee877['id']});}return _0x44bb36;}function _0x385590(_0x5ca5df,_0x4820cf){var _0x2b04f=[{'name':_0x1fdf('0x1b'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0x1fdf('0x1c'),'param':0x3}];var _0x302c95={};var _0x5c579c=_0x4820cf[_0x1fdf('0x1d')](',');var _0x26683a=[];for(var _0x1a9151=0x0;_0x1a9151<_0x2b04f[_0x1fdf('0x1e')];_0x1a9151++){switch(_0x2b04f[_0x1a9151][_0x1fdf('0x1f')]){case'trunk':_0x302c95[_0x1fdf('0x1b')]=_0x5c579c[_0x2b04f[_0x1a9151][_0x1fdf('0x20')]][_0x1fdf('0x1d')]('/')[0x1];_0x302c95[_0x1fdf('0x21')]=_0x5c579c[_0x2b04f[_0x1a9151][_0x1fdf('0x20')]]['split']('/')[0x2];_0x302c95[_0x1fdf('0x22')]=_0x302c95['phone']?_0x302c95['phone'][_0x1fdf('0x1d')]('$')[0x0]:undefined;_0x302c95[_0x1fdf('0x21')]=_0x5ca5df['cutdigits']?(_0x302c95[_0x1fdf('0x22')]||'')+_0x1fdf('0xb')+_0x5ca5df[_0x1fdf('0xc')]+'}':(_0x302c95['prefix']||'')+'${EXTEN}';_0x26683a[_0x2b04f[_0x1a9151]['param']]=[_0x1fdf('0x23'),_0x302c95[_0x1fdf('0x1b')],_0x302c95[_0x1fdf('0x21')]][_0x1fdf('0x24')]('/');break;case _0x1fdf('0x25'):_0x302c95[_0x1fdf('0x25')]=_0x5c579c[_0x2b04f[_0x1a9151][_0x1fdf('0x20')]];if(_0x5ca5df[_0x1fdf('0x19')]!==_0x1fdf('0x16')){if(_0x302c95[_0x1fdf('0x25')][_0x1fdf('0x26')](_0x1fdf('0x27'))<0x0){_0x302c95['options']+='U(xcally-mixmonitor-context)';}}else{_0x302c95['options']=_0x302c95[_0x1fdf('0x25')][_0x1fdf('0x28')](_0x1fdf('0x27'),'');}_0x26683a[_0x2b04f[_0x1a9151]['param']]=_0x302c95[_0x1fdf('0x25')];break;default:_0x26683a[_0x2b04f[_0x1a9151][_0x1fdf('0x20')]]=_0x5c579c[_0x2b04f[_0x1a9151][_0x1fdf('0x20')]];}}return _0x26683a[_0x1fdf('0x24')](',');}function _0x33d06(_0x3a2f8c,_0x263ba9,_0x4d40e5){return new Promise(function(_0x3f1044,_0x3b4a29){var _0x3eea8a=[];if(_[_0x1fdf('0x29')](_0x263ba9))return _0x3f1044(_0x3eea8a);_0x43205b[_0x1fdf('0x2a')][_0x1fdf('0x2b')]({'attributes':['id',_0x1fdf('0x2c'),'IntervalId'],'raw':!![]})[_0x1fdf('0x2d')](function(_0x439da3){for(var _0x48b6b7=0x0,_0x3a32c0=0x0;_0x48b6b7<_0x263ba9[_0x1fdf('0x1e')];_0x48b6b7++,_0x3a32c0=0x0){var _0x1e12de=_0x263ba9[_0x48b6b7];var _0x4f99cf=[];var _0x1039e1=[];delete _0x1e12de['id'];if(_0x1e12de['interval']!==_0x1fdf('0x2e')){_0x1e12de[_0x1fdf('0x2f')]=[_0x1e12de[_0x1fdf('0x2c')]];}else{_0x1e12de[_0x1fdf('0x2f')]=_0x1e12de[_0x1fdf('0x30')]?_['map'](_[_0x1fdf('0x31')](_0x439da3,{'IntervalId':_0x1e12de[_0x1fdf('0x30')]}),_0x1fdf('0x2c')):[];}_0x1e12de['context']=_0x3a2f8c[_0x1fdf('0x3')];_0x1e12de['exten']=_0x3a2f8c[_0x1fdf('0x4')];if(_0x1e12de[_0x1fdf('0x2')])_0x1e12de['type']=_0x1e12de['type'][_0x1fdf('0x32')]();if(_0x3a2f8c['type']==='outbound'){if(_0x1e12de[_0x1fdf('0x15')](_0x1fdf('0x33'))&&_0x1e12de[_0x1fdf('0x33')]&&_0x1e12de['tag']!=='--'){_0x4f99cf['push']({'type':_0x1e12de[_0x1fdf('0x2')][_0x1fdf('0x32')](),'app':'Set','appdata':'CDR(tag)='+_0x1e12de[_0x1fdf('0x33')],'context':_0x3a2f8c[_0x1fdf('0x3')],'exten':_0x3a2f8c[_0x1fdf('0x4')],'priority':_0x1e12de['intervals'][_0x1fdf('0x1e')]+_0x4d40e5+_0x3a32c0++,'VoiceExtensionId':_0x3a2f8c['id']});}_0x4f99cf[_0x1fdf('0x5')]({'type':_0x1e12de[_0x1fdf('0x2')][_0x1fdf('0x32')](),'app':_0x1fdf('0xe'),'appdata':_0x1fdf('0x34')+(_0x1e12de['callerID']?_0x1fdf('0x35')+_0x1e12de[_0x1fdf('0x36')]+')':_0x1fdf('0x37')),'context':_0x3a2f8c[_0x1fdf('0x3')],'exten':_0x3a2f8c[_0x1fdf('0x4')],'priority':_0x1e12de[_0x1fdf('0x2f')][_0x1fdf('0x1e')]+_0x4d40e5+_0x3a32c0++,'VoiceExtensionId':_0x3a2f8c['id']});}else{if(_0x1e12de[_0x1fdf('0x15')](_0x1fdf('0x38'))){if([_0x1fdf('0x39'),_0x1fdf('0x3a')][_0x1fdf('0x3b')](_0x1e12de[_0x1fdf('0x3c')][_0x1fdf('0x32')]())&&_0x1e12de['appType']!==_0x1fdf('0x3d')){if(_0x1e12de[_0x1fdf('0x38')]){_0x4f99cf[_0x1fdf('0x5')]({'type':_0x1e12de[_0x1fdf('0x2')][_0x1fdf('0x32')](),'app':_0x1fdf('0xe'),'appdata':_0x1fdf('0x3e'),'context':_0x3a2f8c[_0x1fdf('0x3')],'exten':_0x3a2f8c[_0x1fdf('0x4')],'priority':_0x1e12de[_0x1fdf('0x2f')][_0x1fdf('0x1e')]+_0x4d40e5+_0x3a32c0++,'VoiceExtensionId':_0x3a2f8c['id']});_0x4f99cf[_0x1fdf('0x5')]({'type':_0x1e12de[_0x1fdf('0x2')][_0x1fdf('0x32')](),'app':_0x1fdf('0x1'),'appdata':_0x1fdf('0x3f'),'context':_0x3a2f8c[_0x1fdf('0x3')],'exten':_0x3a2f8c[_0x1fdf('0x4')],'priority':_0x1e12de[_0x1fdf('0x2f')]['length']+_0x4d40e5+_0x3a32c0++,'VoiceExtensionId':_0x3a2f8c['id']});}else{_0x4f99cf[_0x1fdf('0x5')]({'type':_0x1e12de[_0x1fdf('0x2')][_0x1fdf('0x32')](),'app':_0x1fdf('0xe'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3a2f8c[_0x1fdf('0x3')],'exten':_0x3a2f8c[_0x1fdf('0x4')],'priority':_0x1e12de['intervals'][_0x1fdf('0x1e')]+_0x4d40e5+_0x3a32c0++,'VoiceExtensionId':_0x3a2f8c['id']});_0x4f99cf[_0x1fdf('0x5')]({'type':_0x1e12de[_0x1fdf('0x2')][_0x1fdf('0x32')](),'app':'Set','appdata':_0x1fdf('0x40'),'context':_0x3a2f8c[_0x1fdf('0x3')],'exten':_0x3a2f8c['exten'],'priority':_0x1e12de[_0x1fdf('0x2f')]['length']+_0x4d40e5+_0x3a32c0++,'VoiceExtensionId':_0x3a2f8c['id']});}}}}for(var _0x409ad9=0x0;_0x409ad9<_0x1e12de[_0x1fdf('0x2f')]['length'];_0x409ad9++){var _0x11ba80=_0x4d40e5+_0x1e12de[_0x1fdf('0x2f')][_0x1fdf('0x1e')];var _0x76ea9e=_0x409ad9===_0x1e12de[_0x1fdf('0x2f')][_0x1fdf('0x1e')]-0x1?_0x4d40e5+_0x4f99cf[_0x1fdf('0x1e')]+_0x1039e1[_0x1fdf('0x1e')]+0x2:_0x4d40e5+_0x409ad9+0x1;_0x4f99cf[_0x1fdf('0x41')](_0x409ad9,0x0,{'type':_0x3a2f8c[_0x1fdf('0x2')],'app':_0x1fdf('0x42'),'appdata':_0x1e12de['intervals'][_0x409ad9]+'?'+_0x3a2f8c[_0x1fdf('0x3')]+',${EXTEN},'+_0x11ba80+':'+_0x3a2f8c[_0x1fdf('0x3')]+_0x1fdf('0x43')+_0x76ea9e,'exten':_0x3a2f8c[_0x1fdf('0x4')],'context':_0x3a2f8c[_0x1fdf('0x3')],'priority':_0x4d40e5+_0x409ad9,'VoiceExtensionId':_0x3a2f8c['id']});}if(_0x1e12de[_0x1fdf('0x44')]===_0x1fdf('0x45')){_0x1e12de[_0x1fdf('0x46')]=_0x385590(_0x3a2f8c,_0x1e12de['appdata']);}if(_0x1e12de[_0x1fdf('0x44')]===_0x1fdf('0x47')){_0x4f99cf['push']({'type':_0x1e12de[_0x1fdf('0x2')][_0x1fdf('0x32')](),'app':_0x1fdf('0x1'),'appdata':_0x1fdf('0x48'),'context':_0x3a2f8c['context'],'exten':_0x3a2f8c[_0x1fdf('0x4')],'priority':_0x1e12de[_0x1fdf('0x2f')]['length']+_0x4d40e5+_0x3a32c0++,'VoiceExtensionId':_0x3a2f8c['id']});}_0x1e12de[_0x1fdf('0x49')]=_0x4f99cf[_0x1fdf('0x1e')]?_['last'](_0x4f99cf)[_0x1fdf('0x49')]+0x1:_0x4d40e5;_0x3eea8a=_[_0x1fdf('0x4a')](_0x3eea8a,_0x4f99cf,[_0x1e12de],_0x1039e1);_0x4d40e5=_['last'](_0x3eea8a)['priority']+0x1;}return _0x3f1044(_0x3eea8a);})[_0x1fdf('0x4b')](function(_0x5cde4d){_0x3b4a29(_0x5cde4d);});});}return _0x2b054c[_0x1fdf('0x4c')](_0x1fdf('0x4d'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4f3fb8){var _0x577a17=this['get']({'plain':!![]});var _0x72b75d=_0x577a17[_0x1fdf('0x2')]===_0x1fdf('0x8')?_0x142699(_0x577a17):_0xde3946(_0x577a17);return _0x33d06(_0x577a17,_0x4f3fb8,_[_0x1fdf('0x4e')](_0x72b75d)[_0x1fdf('0x49')]+0x1)['then'](function(_0x588d8c){var _0x44d964=_[_0x1fdf('0x4a')](_0x72b75d,_0x588d8c);_0x44d964[_0x1fdf('0x5')]({'type':_0x577a17['type'],'app':_0x1fdf('0x4f'),'exten':_0x577a17['exten'],'context':_0x577a17[_0x1fdf('0x3')],'priority':_['last'](_0x44d964)[_0x1fdf('0x49')]+0x1,'VoiceExtensionId':_0x577a17['id']});return _0x44d964;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 69e2d93..668aece 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 _0x7923=['map','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','model'];(function(_0x2e1715,_0x11c9ba){var _0x27f057=function(_0x57c014){while(--_0x57c014){_0x2e1715['push'](_0x2e1715['shift']());}};_0x27f057(++_0x11c9ba);}(_0x7923,0x8f));var _0x3792=function(_0x493990,_0x38b31c){_0x493990=_0x493990-0x0;var _0x1d1037=_0x7923[_0x493990];return _0x1d1037;};'use strict';var _=require(_0x3792('0x0'));var util=require(_0x3792('0x1'));var moment=require(_0x3792('0x2'));var BPromise=require(_0x3792('0x3'));var rs=require(_0x3792('0x4'));var fs=require('fs');var Redis=require(_0x3792('0x5'));var db=require(_0x3792('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3792('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3792('0x8'));var client=jayson['client'][_0x3792('0x9')]({'port':0x232a});config[_0x3792('0xa')]=_[_0x3792('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3792('0xc'))(new Redis(config[_0x3792('0xa')]));require('./voiceExtension.socket')[_0x3792('0xd')](socket);function respondWithRpcPromise(_0x39eafb,_0x4c1a32,_0xebb0d0){return new BPromise(function(_0x23e626,_0x216ddd){return client['request'](_0x39eafb,_0xebb0d0)['then'](function(_0x8ed062){logger[_0x3792('0xe')](_0x3792('0xf'),_0x4c1a32,_0x3792('0x10'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x4c1a32,_0x3792('0x10'),JSON[_0x3792('0x11')](_0x8ed062));if(_0x8ed062[_0x3792('0x12')]){if(_0x8ed062[_0x3792('0x12')][_0x3792('0x13')]===0x1f4){logger[_0x3792('0x12')](_0x3792('0xf'),_0x4c1a32,_0x8ed062[_0x3792('0x12')][_0x3792('0x14')]);return _0x216ddd(_0x8ed062[_0x3792('0x12')][_0x3792('0x14')]);}logger[_0x3792('0x12')](_0x3792('0xf'),_0x4c1a32,_0x8ed062[_0x3792('0x12')][_0x3792('0x14')]);return _0x23e626(_0x8ed062[_0x3792('0x12')][_0x3792('0x14')]);}else{logger['info'](_0x3792('0xf'),_0x4c1a32,_0x3792('0x10'));_0x23e626(_0x8ed062[_0x3792('0x15')][_0x3792('0x14')]);}})[_0x3792('0x16')](function(_0x5a9f56){logger[_0x3792('0x12')](_0x3792('0xf'),_0x4c1a32,_0x5a9f56);_0x216ddd(_0x5a9f56);});});}exports[_0x3792('0x17')]=function(_0x3c36b5){var _0x35eee8=this;return new Promise(function(_0x5647ac,_0x4cd50b){return db[_0x3792('0x18')][_0x3792('0x19')]({'raw':_0x3c36b5[_0x3792('0x1a')]?_0x3c36b5[_0x3792('0x1a')][_0x3792('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c36b5[_0x3792('0x1a')]?_0x3c36b5['options']['where']||null:null,'attributes':_0x3c36b5[_0x3792('0x1a')]?_0x3c36b5[_0x3792('0x1a')][_0x3792('0x1c')]||null:null,'limit':_0x3c36b5[_0x3792('0x1a')]?_0x3c36b5['options'][_0x3792('0x1d')]||null:null,'include':_0x3c36b5['options']?_0x3c36b5[_0x3792('0x1a')][_0x3792('0x1e')]?_['map'](_0x3c36b5['options'][_0x3792('0x1e')],function(_0x2328fe){return{'model':db[_0x2328fe[_0x3792('0x1f')]],'as':_0x2328fe['as'],'attributes':_0x2328fe['attributes'],'include':_0x2328fe['include']?_[_0x3792('0x20')](_0x2328fe[_0x3792('0x1e')],function(_0x53369e){return{'model':db[_0x53369e['model']],'as':_0x53369e['as'],'attributes':_0x53369e[_0x3792('0x1c')],'include':_0x53369e[_0x3792('0x1e')]?_[_0x3792('0x20')](_0x53369e[_0x3792('0x1e')],function(_0x4ca06c){return{'model':db[_0x4ca06c['model']],'as':_0x4ca06c['as'],'attributes':_0x4ca06c[_0x3792('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3792('0x21')](function(_0x3b9b67){logger[_0x3792('0xe')](_0x3792('0x17'),_0x3c36b5);logger[_0x3792('0x22')](_0x3792('0x17'),_0x3c36b5,JSON[_0x3792('0x11')](_0x3b9b67));_0x5647ac(_0x3b9b67);})[_0x3792('0x16')](function(_0x4b2ba4){logger[_0x3792('0x12')](_0x3792('0x17'),_0x4b2ba4[_0x3792('0x14')],_0x3c36b5);_0x4cd50b(_0x35eee8[_0x3792('0x12')](0x1f4,_0x4b2ba4[_0x3792('0x14')]));});});}; \ No newline at end of file +var _0x4279=['model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceExtension.socket','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','map'];(function(_0x34de46,_0x2cbf1b){var _0x54764d=function(_0x227736){while(--_0x227736){_0x34de46['push'](_0x34de46['shift']());}};_0x54764d(++_0x2cbf1b);}(_0x4279,0x8d));var _0x9427=function(_0xfc7049,_0xf58fc5){_0xfc7049=_0xfc7049-0x0;var _0x19c464=_0x4279[_0xfc7049];return _0x19c464;};'use strict';var _=require('lodash');var util=require(_0x9427('0x0'));var moment=require(_0x9427('0x1'));var BPromise=require('bluebird');var rs=require(_0x9427('0x2'));var fs=require('fs');var Redis=require(_0x9427('0x3'));var db=require(_0x9427('0x4'))['db'];var utils=require(_0x9427('0x5'));var logger=require('../../config/logger')(_0x9427('0x6'));var config=require('../../config/environment');var jayson=require(_0x9427('0x7'));var client=jayson[_0x9427('0x8')]['http']({'port':0x232a});config[_0x9427('0x9')]=_[_0x9427('0xa')](config[_0x9427('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9427('0xb'))(new Redis(config['redis']));require(_0x9427('0xc'))['register'](socket);function respondWithRpcPromise(_0x559a48,_0xc62445,_0x12b94e){return new BPromise(function(_0xfe89e1,_0x2aff5b){return client[_0x9427('0xd')](_0x559a48,_0x12b94e)[_0x9427('0xe')](function(_0x4f1a57){logger[_0x9427('0xf')]('VoiceExtension,\x20%s,\x20%s',_0xc62445,_0x9427('0x10'));logger[_0x9427('0x11')](_0x9427('0x12'),_0xc62445,_0x9427('0x10'),JSON[_0x9427('0x13')](_0x4f1a57));if(_0x4f1a57[_0x9427('0x14')]){if(_0x4f1a57[_0x9427('0x14')][_0x9427('0x15')]===0x1f4){logger[_0x9427('0x14')](_0x9427('0x16'),_0xc62445,_0x4f1a57[_0x9427('0x14')][_0x9427('0x17')]);return _0x2aff5b(_0x4f1a57[_0x9427('0x14')]['message']);}logger[_0x9427('0x14')](_0x9427('0x16'),_0xc62445,_0x4f1a57[_0x9427('0x14')]['message']);return _0xfe89e1(_0x4f1a57['error'][_0x9427('0x17')]);}else{logger['info'](_0x9427('0x16'),_0xc62445,_0x9427('0x10'));_0xfe89e1(_0x4f1a57['result']['message']);}})[_0x9427('0x18')](function(_0xd64381){logger[_0x9427('0x14')](_0x9427('0x16'),_0xc62445,_0xd64381);_0x2aff5b(_0xd64381);});});}exports[_0x9427('0x19')]=function(_0x1a60f6){var _0x173554=this;return new Promise(function(_0x2095b8,_0xa9da31){return db[_0x9427('0x1a')][_0x9427('0x1b')]({'raw':_0x1a60f6[_0x9427('0x1c')]?_0x1a60f6[_0x9427('0x1c')][_0x9427('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a60f6[_0x9427('0x1c')]?_0x1a60f6[_0x9427('0x1c')]['where']||null:null,'attributes':_0x1a60f6['options']?_0x1a60f6[_0x9427('0x1c')][_0x9427('0x1e')]||null:null,'limit':_0x1a60f6[_0x9427('0x1c')]?_0x1a60f6[_0x9427('0x1c')][_0x9427('0x1f')]||null:null,'include':_0x1a60f6[_0x9427('0x1c')]?_0x1a60f6[_0x9427('0x1c')][_0x9427('0x20')]?_[_0x9427('0x21')](_0x1a60f6[_0x9427('0x1c')][_0x9427('0x20')],function(_0x32a68a){return{'model':db[_0x32a68a['model']],'as':_0x32a68a['as'],'attributes':_0x32a68a[_0x9427('0x1e')],'include':_0x32a68a['include']?_[_0x9427('0x21')](_0x32a68a[_0x9427('0x20')],function(_0x57c95a){return{'model':db[_0x57c95a[_0x9427('0x22')]],'as':_0x57c95a['as'],'attributes':_0x57c95a[_0x9427('0x1e')],'include':_0x57c95a[_0x9427('0x20')]?_[_0x9427('0x21')](_0x57c95a[_0x9427('0x20')],function(_0x58c7a2){return{'model':db[_0x58c7a2[_0x9427('0x22')]],'as':_0x58c7a2['as'],'attributes':_0x58c7a2[_0x9427('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51a356){logger[_0x9427('0xf')](_0x9427('0x19'),_0x1a60f6);logger['debug'](_0x9427('0x19'),_0x1a60f6,JSON[_0x9427('0x13')](_0x51a356));_0x2095b8(_0x51a356);})[_0x9427('0x18')](function(_0x151293){logger[_0x9427('0x14')]('GetVoiceExtension',_0x151293['message'],_0x1a60f6);_0xa9da31(_0x173554[_0x9427('0x14')](0x1f4,_0x151293[_0x9427('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ca6842d..4c6ea3d 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 _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x46cdd3,_0x3d5282){var _0x1f165c=function(_0x322de9){while(--_0x322de9){_0x46cdd3['push'](_0x46cdd3['shift']());}};_0x1f165c(++_0x3d5282);}(_0x7a54,0x106));var _0x47a5=function(_0x1ce317,_0x3b459f){_0x1ce317=_0x1ce317-0x0;var _0x410b49=_0x7a54[_0x1ce317];return _0x410b49;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x25845a,_0x406c95){var _0x55d3d4=function(_0x5ecaa6){while(--_0x5ecaa6){_0x25845a['push'](_0x25845a['shift']());}};_0x55d3d4(++_0x406c95);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc4aa[_0x4f9b18];return _0x29f20c;};'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 54e9f73..b2c6075 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(_0x591c71,_0x318b16){var _0x549b71=function(_0x2fb19f){while(--_0x2fb19f){_0x591c71['push'](_0x591c71['shift']());}};_0x549b71(++_0x318b16);}(_0xe5af,0x9c));var _0xfe5a=function(_0x1e3652,_0x5692e3){_0x1e3652=_0x1e3652-0x0;var _0x101339=_0xe5af[_0x1e3652];return _0x101339;};'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 _0x0a6b=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','/:id','show','getMessages','post','create','delete','destroy','exports','multer','express'];(function(_0x49b2b0,_0xfd7267){var _0x1b31f8=function(_0x69ab2a){while(--_0x69ab2a){_0x49b2b0['push'](_0x49b2b0['shift']());}};_0x1b31f8(++_0xfd7267);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x5e5cf0,_0x2d97a9){_0x5e5cf0=_0x5e5cf0-0x0;var _0x486355=_0x0a6b[_0x5e5cf0];return _0x486355;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var fs_extra=require(_0xb0a6('0x2'));var auth=require(_0xb0a6('0x3'));var interaction=require(_0xb0a6('0x4'));var config=require('../../config/environment');var controller=require(_0xb0a6('0x5'));router['get']('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x7')]);router['get'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x9')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')]('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0xc')]);router['put'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller['update']);router[_0xb0a6('0xd')](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0xe')]);module[_0xb0a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index c053c25..dec57de 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 _0xe7cd=['central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','\x20-\x20','exports','STRING','from-voicemail','setDataValue','email','trim'];(function(_0x38272a,_0x2dd237){var _0x5b06c5=function(_0x297cb8){while(--_0x297cb8){_0x38272a['push'](_0x38272a['shift']());}};_0x5b06c5(++_0x2dd237);}(_0xe7cd,0x13c));var _0xde7c=function(_0x471f3a,_0x587146){_0x471f3a=_0x471f3a-0x0;var _0x66e33f=_0xe7cd[_0x471f3a];return _0x66e33f;};'use strict';var Sequelize=require('sequelize');module[_0xde7c('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xde7c('0x1')],'defaultValue':_0xde7c('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xde7c('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xde7c('0x1')]},'fullname':{'type':Sequelize[_0xde7c('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0xd46627){this[_0xde7c('0x3')](_0xde7c('0x4'),typeof _0xd46627==='string'&&_0xd46627[_0xde7c('0x5')]()?_0xd46627[_0xde7c('0x5')]():null);}},'pager':{'type':Sequelize[_0xde7c('0x1')]},'tz':{'type':Sequelize[_0xde7c('0x1')],'defaultValue':_0xde7c('0x6')},'attach':{'type':Sequelize[_0xde7c('0x7')]('yes','no'),'defaultValue':_0xde7c('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xde7c('0x8'),'no'),'defaultValue':_0xde7c('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xde7c('0x1')]},'callback':{'type':Sequelize[_0xde7c('0x1')]},'review':{'type':Sequelize[_0xde7c('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xde7c('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xde7c('0x7')](_0xde7c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xde7c('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xde7c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xde7c('0x7')](_0xde7c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xde7c('0x7')](_0xde7c('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xde7c('0x7')](_0xde7c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xde7c('0x7')](_0xde7c('0x8'),'no'),'defaultValue':_0xde7c('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xde7c('0x1')]},'emailbody':{'type':Sequelize[_0xde7c('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xde7c('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xde7c('0xb')],'get':function(){return this[_0xde7c('0xc')]('fullname')+_0xde7c('0xd')+this[_0xde7c('0xc')]('mailbox');}}}; \ No newline at end of file +var _0xd598=['trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email'];(function(_0x45bb30,_0x29ac8d){var _0xf59ed9=function(_0xd4955a){while(--_0xd4955a){_0x45bb30['push'](_0x45bb30['shift']());}};_0xf59ed9(++_0x29ac8d);}(_0xd598,0x181));var _0x8d59=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd598[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8d59('0x0'));module[_0x8d59('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8d59('0x2')],'defaultValue':'from-voicemail','unique':_0x8d59('0x3')},'mailbox':{'type':Sequelize[_0x8d59('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x8d59('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4d3177){this[_0x8d59('0x4')](_0x8d59('0x5'),typeof _0x4d3177==='string'&&_0x4d3177[_0x8d59('0x6')]()?_0x4d3177['trim']():null);}},'pager':{'type':Sequelize[_0x8d59('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x8d59('0x7')},'attach':{'type':Sequelize[_0x8d59('0x8')](_0x8d59('0x9'),'no'),'defaultValue':_0x8d59('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8d59('0x8')](_0x8d59('0x9'),'no'),'defaultValue':_0x8d59('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x8d59('0x2')]},'review':{'type':Sequelize['ENUM'](_0x8d59('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8d59('0x8')](_0x8d59('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8d59('0x8')](_0x8d59('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x8d59('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8d59('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8d59('0x8')](_0x8d59('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8d59('0x8')](_0x8d59('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8d59('0x8')](_0x8d59('0x9'),'no'),'defaultValue':_0x8d59('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8d59('0x8')](_0x8d59('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8d59('0x8')](_0x8d59('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x8d59('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x8d59('0x2')]},'emailbody':{'type':Sequelize[_0x8d59('0x2')]},'maxsecs':{'type':Sequelize[_0x8d59('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8d59('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8d59('0xc')],'get':function(){return this[_0x8d59('0xd')](_0x8d59('0xe'))+_0x8d59('0xf')+this[_0x8d59('0xd')](_0x8d59('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2fefe4f..555de05 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 _0xae60=['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','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','order','pick','mailbox','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x23a959,_0x5c39dd){var _0x2b73dd=function(_0x2ced19){while(--_0x2ced19){_0x23a959['push'](_0x23a959['shift']());}};_0x2b73dd(++_0x5c39dd);}(_0xae60,0x1c7));var _0x0ae6=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xae60[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];function respondWithStatusCode(_0x3b05a4,_0x30f8f9){_0x30f8f9=_0x30f8f9||0xcc;return function(_0x1aefd5){if(_0x1aefd5){return _0x3b05a4[_0x0ae6('0x1c')](_0x30f8f9);}return _0x3b05a4[_0x0ae6('0x1d')](_0x30f8f9)[_0x0ae6('0x1e')]();};}function respondWithResult(_0x4d2da8,_0x3809c6){_0x3809c6=_0x3809c6||0xc8;return function(_0x10c3bc){if(_0x10c3bc){return _0x4d2da8[_0x0ae6('0x1d')](_0x3809c6)[_0x0ae6('0x1f')](_0x10c3bc);}};}function respondWithFilteredResult(_0xce3e23,_0x3a1e26){return function(_0x151144){if(_0x151144){var _0x3b64ac=typeof _0x3a1e26[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x3a1e26[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xa97151=_0x151144[_0x0ae6('0x23')];var _0xda4f01=_0x3b64ac?0x0:_0x3a1e26[_0x0ae6('0x20')];var _0x2fdf25=_0x3b64ac?_0x151144[_0x0ae6('0x23')]:_0x3a1e26[_0x0ae6('0x20')]+_0x3a1e26[_0x0ae6('0x22')];var _0x26b369;if(_0x2fdf25>=_0xa97151){_0x2fdf25=_0xa97151;_0x26b369=0xc8;}else{_0x26b369=0xce;}_0xce3e23[_0x0ae6('0x1d')](_0x26b369);return _0xce3e23['set'](_0x0ae6('0x24'),_0xda4f01+'-'+_0x2fdf25+'/'+_0xa97151)[_0x0ae6('0x1f')](_0x151144);}return null;};}function patchUpdates(_0x140a3b){return function(_0x1027c2){try{jsonpatch[_0x0ae6('0x25')](_0x1027c2,_0x140a3b,!![]);}catch(_0xb4e6af){return BPromise[_0x0ae6('0x26')](_0xb4e6af);}return _0x1027c2[_0x0ae6('0x27')]();};}function saveUpdates(_0x515f3d,_0x39b22e){return function(_0x2a6484){if(_0x2a6484){return _0x2a6484[_0x0ae6('0x28')](_0x515f3d)[_0x0ae6('0x29')](function(_0x31ad85){return _0x31ad85;});}return null;};}function removeEntity(_0x4eba72,_0x296a9d){return function(_0x4e1242){if(_0x4e1242){return _0x4e1242[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){var _0x3c43d8=_0x4e1242[_0x0ae6('0x2b')]({'plain':!![]});var _0x5b86fe=_0x0ae6('0x2c');return db[_0x0ae6('0x2d')]['destroy']({'where':{'type':_0x5b86fe,'resourceId':_0x3c43d8['id']}})['then'](function(){return _0x4e1242;});})[_0x0ae6('0x29')](function(){_0x4eba72[_0x0ae6('0x1d')](0xcc)[_0x0ae6('0x1e')]();});}};}function handleEntityNotFound(_0x4fe77b,_0x3b5f8f){return function(_0xb68cbe){if(!_0xb68cbe){_0x4fe77b[_0x0ae6('0x1c')](0x194);}return _0xb68cbe;};}function handleError(_0x4df796,_0x2428b2){_0x2428b2=_0x2428b2||0x1f4;return function(_0x29fef3){logger[_0x0ae6('0x2e')](_0x29fef3[_0x0ae6('0x2f')]);if(_0x29fef3[_0x0ae6('0x30')]){delete _0x29fef3[_0x0ae6('0x30')];}_0x4df796['status'](_0x2428b2)['send'](_0x29fef3);};}exports[_0x0ae6('0x31')]=function(_0x419384,_0x4e6df8){var _0x4a06f1={},_0x1ca059={},_0x278577={'count':0x0,'rows':[]};var _0x714c6d=_[_0x0ae6('0x32')](db['VoiceMail'][_0x0ae6('0x33')],function(_0x429f06){return{'name':_0x429f06[_0x0ae6('0x34')],'type':_0x429f06['type'][_0x0ae6('0x35')]};});_0x1ca059[_0x0ae6('0x36')]=_[_0x0ae6('0x32')](_0x714c6d,_0x0ae6('0x30'));_0x1ca059[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x419384[_0x0ae6('0x37')]);_0x1ca059[_0x0ae6('0x39')]=_[_0x0ae6('0x3a')](_0x1ca059[_0x0ae6('0x36')],_0x1ca059['query']);_0x4a06f1[_0x0ae6('0x3b')]=_[_0x0ae6('0x3a')](_0x1ca059['model'],qs[_0x0ae6('0x3c')](_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x4a06f1['attributes']=_0x4a06f1[_0x0ae6('0x3b')]['length']?_0x4a06f1['attributes']:_0x1ca059[_0x0ae6('0x36')];if(!_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3d')](_0x0ae6('0x3e'))){_0x4a06f1[_0x0ae6('0x22')]=qs['limit'](_0x419384['query'][_0x0ae6('0x22')]);_0x4a06f1['offset']=qs[_0x0ae6('0x20')](_0x419384['query'][_0x0ae6('0x20')]);}_0x4a06f1['order']=qs[_0x0ae6('0x3f')](_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3f')]);_0x4a06f1[_0x0ae6('0x40')]=qs['filters'](_['pick'](_0x419384[_0x0ae6('0x37')],_0x1ca059[_0x0ae6('0x39')]),_0x714c6d);if(_0x419384[_0x0ae6('0x37')]['filter']){_0x4a06f1[_0x0ae6('0x40')]=_['merge'](_0x4a06f1[_0x0ae6('0x40')],{'$or':_[_0x0ae6('0x32')](_0x714c6d,function(_0x460e3f){if(_0x460e3f[_0x0ae6('0x41')]!==_0x0ae6('0x42')){var _0x1f8258={};_0x1f8258[_0x460e3f['name']]={'$like':'%'+_0x419384[_0x0ae6('0x37')][_0x0ae6('0x43')]+'%'};return _0x1f8258;}})});}_0x4a06f1=_[_0x0ae6('0x44')]({},_0x4a06f1,_0x419384[_0x0ae6('0x45')]);var _0x1ad562={'where':_0x4a06f1[_0x0ae6('0x40')]};return db[_0x0ae6('0x46')][_0x0ae6('0x23')](_0x1ad562)['then'](function(_0x38faeb){_0x278577[_0x0ae6('0x23')]=_0x38faeb;if(_0x419384[_0x0ae6('0x37')][_0x0ae6('0x47')]){_0x4a06f1[_0x0ae6('0x48')]=[{'all':!![]}];}return db[_0x0ae6('0x46')][_0x0ae6('0x49')](_0x4a06f1);})[_0x0ae6('0x29')](function(_0xb38cbb){_0x278577[_0x0ae6('0x4a')]=_0xb38cbb;return _0x278577;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x4e6df8,_0x4a06f1))[_0x0ae6('0x4b')](handleError(_0x4e6df8,null));};exports[_0x0ae6('0x4c')]=function(_0x85d9ce,_0x201e95){var _0x16d225={'raw':!![],'where':{'id':_0x85d9ce[_0x0ae6('0x4d')]['id']}},_0x4235de={};_0x4235de['model']=_[_0x0ae6('0x38')](db[_0x0ae6('0x46')][_0x0ae6('0x33')]);_0x4235de[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x85d9ce[_0x0ae6('0x37')]);_0x4235de['filters']=_[_0x0ae6('0x3a')](_0x4235de[_0x0ae6('0x36')],_0x4235de[_0x0ae6('0x37')]);_0x16d225[_0x0ae6('0x3b')]=_['intersection'](_0x4235de['model'],qs['fields'](_0x85d9ce[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x16d225[_0x0ae6('0x3b')]=_0x16d225['attributes'][_0x0ae6('0x4e')]?_0x16d225[_0x0ae6('0x3b')]:_0x4235de['model'];if(_0x85d9ce[_0x0ae6('0x37')][_0x0ae6('0x47')]){_0x16d225['include']=[{'all':!![]}];}_0x16d225=_[_0x0ae6('0x44')]({},_0x16d225,_0x85d9ce[_0x0ae6('0x45')]);return db['VoiceMail'][_0x0ae6('0x4f')](_0x16d225)[_0x0ae6('0x29')](handleEntityNotFound(_0x201e95,null))[_0x0ae6('0x29')](respondWithResult(_0x201e95,null))['catch'](handleError(_0x201e95,null));};exports[_0x0ae6('0x50')]=function(_0x21de54,_0x46075a){return db[_0x0ae6('0x46')][_0x0ae6('0x50')](_0x21de54[_0x0ae6('0x51')],{})[_0x0ae6('0x29')](function(_0x5ababa){var _0x5afd3b=_0x21de54[_0x0ae6('0x52')][_0x0ae6('0x2b')]({'plain':!![]});if(!_0x5afd3b)throw new Error(_0x0ae6('0x53'));if(_0x5afd3b['role']===_0x0ae6('0x52')){var _0x51df5c=_0x5ababa['get']({'plain':!![]});var _0x23454a=_0x0ae6('0x2c');return db[_0x0ae6('0x54')]['find']({'where':{'name':_0x23454a,'userProfileId':_0x5afd3b[_0x0ae6('0x55')]},'raw':!![]})[_0x0ae6('0x29')](function(_0x31a4db){if(_0x31a4db&&_0x31a4db[_0x0ae6('0x56')]===0x0){return db[_0x0ae6('0x2d')][_0x0ae6('0x50')]({'name':_0x51df5c[_0x0ae6('0x30')],'resourceId':_0x51df5c['id'],'type':_0x31a4db[_0x0ae6('0x30')],'sectionId':_0x31a4db['id']},{})[_0x0ae6('0x29')](function(){return _0x5ababa;});}else{return _0x5ababa;}})[_0x0ae6('0x4b')](function(_0x1cc515){logger[_0x0ae6('0x2e')](_0x0ae6('0x57'),_0x1cc515);throw _0x1cc515;});}return _0x5ababa;})[_0x0ae6('0x29')](respondWithResult(_0x46075a,0xc9))[_0x0ae6('0x4b')](handleError(_0x46075a,null));};exports['update']=function(_0x4cbe19,_0x30a9f1){if(_0x4cbe19[_0x0ae6('0x51')]['id']){delete _0x4cbe19[_0x0ae6('0x51')]['id'];}return db[_0x0ae6('0x46')][_0x0ae6('0x4f')]({'where':{'id':_0x4cbe19[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x30a9f1,null))[_0x0ae6('0x29')](saveUpdates(_0x4cbe19[_0x0ae6('0x51')],null))[_0x0ae6('0x29')](respondWithResult(_0x30a9f1,null))[_0x0ae6('0x4b')](handleError(_0x30a9f1,null));};exports[_0x0ae6('0x2a')]=function(_0x16a311,_0x2babcc){return db[_0x0ae6('0x46')][_0x0ae6('0x4f')]({'where':{'id':_0x16a311[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x2babcc,null))['then'](removeEntity(_0x2babcc,null))[_0x0ae6('0x4b')](handleError(_0x2babcc,null));};exports[_0x0ae6('0x58')]=function(_0x15191e,_0x578125,_0x2648de){return db[_0x0ae6('0x46')][_0x0ae6('0x59')]({'where':{'id':_0x15191e[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x578125,null))[_0x0ae6('0x29')](function(_0x5ec716){var _0x456d2a;var _0x2132d6={},_0x1c53bf={};_0x1c53bf[_0x0ae6('0x36')]=_[_0x0ae6('0x38')](db[_0x0ae6('0x5a')][_0x0ae6('0x33')]);_0x1c53bf[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x15191e['query']);_0x1c53bf['filters']=_[_0x0ae6('0x3a')](_0x1c53bf[_0x0ae6('0x36')],_0x1c53bf['query']);_0x2132d6['attributes']=_[_0x0ae6('0x3a')](_0x1c53bf[_0x0ae6('0x36')],qs[_0x0ae6('0x3c')](_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x2132d6[_0x0ae6('0x3b')]=_0x2132d6[_0x0ae6('0x3b')]['length']?_0x2132d6[_0x0ae6('0x3b')]:_0x1c53bf['model'];if(!_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x3d')]('nolimit')){_0x2132d6[_0x0ae6('0x22')]=qs[_0x0ae6('0x22')](_0x15191e[_0x0ae6('0x37')]['limit']);_0x2132d6[_0x0ae6('0x20')]=qs['offset'](_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x20')]);}_0x2132d6[_0x0ae6('0x5b')]=qs[_0x0ae6('0x3f')](_0x15191e['query']['sort']);_0x2132d6[_0x0ae6('0x40')]=qs[_0x0ae6('0x39')](_[_0x0ae6('0x5c')](_0x15191e[_0x0ae6('0x37')],_0x1c53bf[_0x0ae6('0x39')]));if(_0x15191e[_0x0ae6('0x37')]['filter']){_0x2132d6['where']=_[_0x0ae6('0x44')](_0x2132d6[_0x0ae6('0x40')],{'$or':_[_0x0ae6('0x32')](_0x2132d6[_0x0ae6('0x3b')],function(_0x2bafcc){var _0x15f38f={};_0x15f38f[_0x2bafcc]={'$like':'%'+_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x43')]+'%'};return _0x15f38f;})});}_0x2132d6['where']=_[_0x0ae6('0x44')](_0x2132d6[_0x0ae6('0x40')],{'mailboxuser':_0x5ec716[_0x0ae6('0x5d')]});_0x2132d6=_[_0x0ae6('0x44')]({},_0x2132d6,_0x15191e[_0x0ae6('0x45')]);return db[_0x0ae6('0x5a')]['findAndCountAll'](_0x2132d6)['then'](respondWithFilteredResult(_0x578125,_0x2132d6));})[_0x0ae6('0x4b')](handleError(_0x578125,null));}; \ No newline at end of file +var _0x63a5=['index','map','VoiceMail','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','getMessages','VoiceMailMessage','sort','pick','mailbox','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send'];(function(_0x2c715b,_0x47c7fa){var _0x1f56ca=function(_0x10d1fd){while(--_0x10d1fd){_0x2c715b['push'](_0x2c715b['shift']());}};_0x1f56ca(++_0x47c7fa);}(_0x63a5,0x18e));var _0x563a=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x63a5[_0x4c440b];return _0x2d48cf;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['VoiceMail'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['VoiceMail'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['VoiceMail'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));};exports[_0x563a('0x54')]=function(_0x16aa03,_0x3919a3,_0x1e275c){return db[_0x563a('0x31')]['findOne']({'where':{'id':_0x16aa03[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x3919a3,null))['then'](function(_0x503896){var _0x402bdd;var _0x709bfd={},_0x579d61={};_0x579d61[_0x563a('0x35')]=_['keys'](db[_0x563a('0x55')][_0x563a('0x49')]);_0x579d61[_0x563a('0x36')]=_[_0x563a('0x48')](_0x16aa03[_0x563a('0x36')]);_0x579d61['filters']=_['intersection'](_0x579d61['model'],_0x579d61['query']);_0x709bfd[_0x563a('0x39')]=_['intersection'](_0x579d61[_0x563a('0x35')],qs['fields'](_0x16aa03[_0x563a('0x36')][_0x563a('0x3a')]));_0x709bfd[_0x563a('0x39')]=_0x709bfd[_0x563a('0x39')][_0x563a('0x3b')]?_0x709bfd['attributes']:_0x579d61[_0x563a('0x35')];if(!_0x16aa03['query']['hasOwnProperty'](_0x563a('0x3d'))){_0x709bfd[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x16aa03[_0x563a('0x36')][_0x563a('0x1e')]);_0x709bfd['offset']=qs[_0x563a('0x1f')](_0x16aa03[_0x563a('0x36')][_0x563a('0x1f')]);}_0x709bfd[_0x563a('0x3e')]=qs[_0x563a('0x56')](_0x16aa03['query'][_0x563a('0x56')]);_0x709bfd['where']=qs[_0x563a('0x37')](_[_0x563a('0x57')](_0x16aa03['query'],_0x579d61[_0x563a('0x37')]));if(_0x16aa03[_0x563a('0x36')][_0x563a('0x40')]){_0x709bfd[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x709bfd[_0x563a('0x3f')],{'$or':_[_0x563a('0x30')](_0x709bfd[_0x563a('0x39')],function(_0x4cfa73){var _0x103c59={};_0x103c59[_0x4cfa73]={'$like':'%'+_0x16aa03[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x103c59;})});}_0x709bfd[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x709bfd[_0x563a('0x3f')],{'mailboxuser':_0x503896[_0x563a('0x58')]});_0x709bfd=_['merge']({},_0x709bfd,_0x16aa03[_0x563a('0x42')]);return db['VoiceMailMessage']['findAndCountAll'](_0x709bfd)['then'](respondWithFilteredResult(_0x3919a3,_0x709bfd));})[_0x563a('0x45')](handleError(_0x3919a3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7e2bfe6..aebc4da 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 _0x25ff=['util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','VoiceMail','mailbox_context','mailbox','context','lodash'];(function(_0x5e2635,_0x1bb8c7){var _0xf4e40d=function(_0x46a556){while(--_0x46a556){_0x5e2635['push'](_0x5e2635['shift']());}};_0xf4e40d(++_0x1bb8c7);}(_0x25ff,0x15e));var _0xf25f=function(_0x229fbf,_0x1df363){_0x229fbf=_0x229fbf-0x0;var _0x48ab9e=_0x25ff[_0x229fbf];return _0x48ab9e;};'use strict';var _=require(_0xf25f('0x0'));var util=require(_0xf25f('0x1'));var logger=require(_0xf25f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf25f('0x3'));var rp=require(_0xf25f('0x4'));var fs=require('fs');var path=require(_0xf25f('0x5'));var rimraf=require(_0xf25f('0x6'));var config=require('../../config/environment');var attributes=require(_0xf25f('0x7'));module[_0xf25f('0x8')]=function(_0x5628c8,_0x4720b4){return _0x5628c8['define'](_0xf25f('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xf25f('0xa'),'fields':[_0xf25f('0xb'),_0xf25f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbb2=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x1086a3,_0x3ff9ae){var _0x51d1af=function(_0x1a4fa6){while(--_0x1a4fa6){_0x1086a3['push'](_0x1086a3['shift']());}};_0x51d1af(++_0x3ff9ae);}(_0xfbb2,0xf7));var _0x2fbb=function(_0x575446,_0x1a13fa){_0x575446=_0x575446-0x0;var _0x2fb644=_0xfbb2[_0x575446];return _0x2fb644;};'use strict';var _=require('lodash');var util=require(_0x2fbb('0x0'));var logger=require(_0x2fbb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2fbb('0x2'));var rp=require(_0x2fbb('0x3'));var fs=require('fs');var path=require(_0x2fbb('0x4'));var rimraf=require(_0x2fbb('0x5'));var config=require(_0x2fbb('0x6'));var attributes=require(_0x2fbb('0x7'));module[_0x2fbb('0x8')]=function(_0x8b3f02,_0x5a0cba){return _0x8b3f02[_0x2fbb('0x9')](_0x2fbb('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 06f6ae9..f15d77a 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 _0x17e7=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0x17e7,0x199));var _0x717e=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x17e7[_0x1e2321];return _0x1d346d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x717e('0x0'));var BPromise=require(_0x717e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x717e('0x2'))['db'];var utils=require(_0x717e('0x3'));var logger=require('../../config/logger')(_0x717e('0x4'));var config=require(_0x717e('0x5'));var jayson=require(_0x717e('0x6'));var client=jayson[_0x717e('0x7')][_0x717e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5efb77,_0x15aaaf,_0x1b6e93){return new BPromise(function(_0x5bdf34,_0x3b6aef){return client[_0x717e('0x9')](_0x5efb77,_0x1b6e93)[_0x717e('0xa')](function(_0xb86499){logger[_0x717e('0xb')](_0x717e('0xc'),_0x15aaaf,_0x717e('0xd'));logger[_0x717e('0xe')](_0x717e('0xf'),_0x15aaaf,_0x717e('0xd'),JSON[_0x717e('0x10')](_0xb86499));if(_0xb86499[_0x717e('0x11')]){if(_0xb86499['error'][_0x717e('0x12')]===0x1f4){logger[_0x717e('0x11')](_0x717e('0xc'),_0x15aaaf,_0xb86499[_0x717e('0x11')][_0x717e('0x13')]);return _0x3b6aef(_0xb86499[_0x717e('0x11')][_0x717e('0x13')]);}logger['error'](_0x717e('0xc'),_0x15aaaf,_0xb86499[_0x717e('0x11')][_0x717e('0x13')]);return _0x5bdf34(_0xb86499[_0x717e('0x11')]['message']);}else{logger['info'](_0x717e('0xc'),_0x15aaaf,_0x717e('0xd'));_0x5bdf34(_0xb86499['result'][_0x717e('0x13')]);}})[_0x717e('0x14')](function(_0x30a3d5){logger[_0x717e('0x11')](_0x717e('0xc'),_0x15aaaf,_0x30a3d5);_0x3b6aef(_0x30a3d5);});});} \ No newline at end of file +var _0x4f59=['catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4f59,0x151));var _0x94f5=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x4f59[_0x4bb581];return _0x316bf5;};'use strict';var _=require('lodash');var util=require(_0x94f5('0x0'));var moment=require(_0x94f5('0x1'));var BPromise=require(_0x94f5('0x2'));var rs=require(_0x94f5('0x3'));var fs=require('fs');var Redis=require(_0x94f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x94f5('0x5'));var config=require(_0x94f5('0x6'));var jayson=require(_0x94f5('0x7'));var client=jayson['client'][_0x94f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a4dba,_0x166a4f,_0x503434){return new BPromise(function(_0x1157c2,_0x5c6602){return client[_0x94f5('0x9')](_0x1a4dba,_0x503434)[_0x94f5('0xa')](function(_0x549eac){logger[_0x94f5('0xb')](_0x94f5('0xc'),_0x166a4f,_0x94f5('0xd'));logger[_0x94f5('0xe')](_0x94f5('0xf'),_0x166a4f,_0x94f5('0xd'),JSON[_0x94f5('0x10')](_0x549eac));if(_0x549eac[_0x94f5('0x11')]){if(_0x549eac[_0x94f5('0x11')][_0x94f5('0x12')]===0x1f4){logger[_0x94f5('0x11')](_0x94f5('0xc'),_0x166a4f,_0x549eac['error']['message']);return _0x5c6602(_0x549eac[_0x94f5('0x11')][_0x94f5('0x13')]);}logger['error'](_0x94f5('0xc'),_0x166a4f,_0x549eac[_0x94f5('0x11')]['message']);return _0x1157c2(_0x549eac[_0x94f5('0x11')][_0x94f5('0x13')]);}else{logger[_0x94f5('0xb')](_0x94f5('0xc'),_0x166a4f,_0x94f5('0xd'));_0x1157c2(_0x549eac['result'][_0x94f5('0x13')]);}})[_0x94f5('0x14')](function(_0x2d4641){logger[_0x94f5('0x11')](_0x94f5('0xc'),_0x166a4f,_0x2d4641);_0x5c6602(_0x2d4641);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 12e3beb..210dadb 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 _0x799f=['post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','download'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x799f,0x1aa));var _0xf799=function(_0xe274a1,_0x42c102){_0xe274a1=_0xe274a1-0x0;var _0xc0536a=_0x799f[_0xe274a1];return _0xc0536a;};'use strict';var multer=require(_0xf799('0x0'));var util=require(_0xf799('0x1'));var path=require('path');var timeout=require(_0xf799('0x2'));var express=require(_0xf799('0x3'));var router=express[_0xf799('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf799('0x5'));var config=require(_0xf799('0x6'));var controller=require(_0xf799('0x7'));router[_0xf799('0x8')]('/',auth['isAuthenticated'](),controller[_0xf799('0x9')]);router['get'](_0xf799('0xa'),auth[_0xf799('0xb')](),controller[_0xf799('0xc')]);router[_0xf799('0x8')](_0xf799('0xd'),auth['isAuthenticated'](),controller[_0xf799('0xe')]);router[_0xf799('0xf')]('/',auth[_0xf799('0xb')](),controller[_0xf799('0x10')]);router['put'](_0xf799('0xa'),auth[_0xf799('0xb')](),controller[_0xf799('0x11')]);router[_0xf799('0x12')](_0xf799('0xa'),auth[_0xf799('0xb')](),controller[_0xf799('0x13')]);module[_0xf799('0x14')]=router; \ No newline at end of file +var _0x4f44=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','delete','destroy','exports'];(function(_0x300f6a,_0x19d591){var _0x5ddabf=function(_0x278a78){while(--_0x278a78){_0x300f6a['push'](_0x300f6a['shift']());}};_0x5ddabf(++_0x19d591);}(_0x4f44,0x12c));var _0x44f4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4f44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0x44f4('0x0'));var util=require(_0x44f4('0x1'));var path=require(_0x44f4('0x2'));var timeout=require(_0x44f4('0x3'));var express=require(_0x44f4('0x4'));var router=express[_0x44f4('0x5')]();var fs_extra=require(_0x44f4('0x6'));var auth=require(_0x44f4('0x7'));var interaction=require(_0x44f4('0x8'));var config=require(_0x44f4('0x9'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44f4('0xa')]);router[_0x44f4('0xb')](_0x44f4('0xc'),auth[_0x44f4('0xd')](),controller[_0x44f4('0xe')]);router[_0x44f4('0xb')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x44f4('0xf')]('/',auth[_0x44f4('0xd')](),controller[_0x44f4('0x10')]);router['put'](_0x44f4('0xc'),auth[_0x44f4('0xd')](),controller['update']);router[_0x44f4('0x11')](_0x44f4('0xc'),auth[_0x44f4('0xd')](),controller[_0x44f4('0x12')]);module[_0x44f4('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 59f3961..51d7cac 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 _0x2119=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x2119,0xa4));var _0x9211=function(_0x5cd37d,_0x9c156){_0x5cd37d=_0x5cd37d-0x0;var _0x34f8c5=_0x2119[_0x5cd37d];return _0x34f8c5;};'use strict';var Sequelize=require(_0x9211('0x0'));module['exports']={'name':{'type':Sequelize[_0x9211('0x1')],'get':function(_0x4205fe){return this[_0x9211('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x9211('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x9211('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x9211('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x9211('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9211('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x9211('0x5')](_0x9211('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x9211('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x9211('0x7'),'defaultValue':Sequelize[_0x9211('0x8')](_0x9211('0x9'))}}; \ No newline at end of file +var _0x5122=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB','long'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0x5122,0x193));var _0x2512=function(_0x363560,_0x156d88){_0x363560=_0x363560-0x0;var _0x18a1a2=_0x5122[_0x363560];return _0x18a1a2;};'use strict';var Sequelize=require(_0x2512('0x0'));module[_0x2512('0x1')]={'name':{'type':Sequelize[_0x2512('0x2')],'get':function(_0x6ff40c){return this[_0x2512('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x2512('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x2512('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x2512('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x2512('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x2512('0x5')](_0x2512('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x2512('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x2512('0x4')],'defaultValue':''},'stamp':{'type':_0x2512('0x7'),'defaultValue':Sequelize[_0x2512('0x8')](_0x2512('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 45c3c3b..473d005 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 _0xe8d4=['sort','where','map','VIRTUAL','options','VoiceMailMessage','includeAll','include','findAll','catch','keys','length','find','create','body','params','download','recording','msg_id','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range','reject','update','destroy','then','sendStatus','error','stack','rawAttributes','type','model','differenceBy','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x3150f9,_0xb687b7){var _0x229bc2=function(_0x41302e){while(--_0x41302e){_0x3150f9['push'](_0x3150f9['shift']());}};_0x229bc2(++_0xb687b7);}(_0xe8d4,0x1e2));var _0x4e8d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe8d4[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e8d('0x0'));var jsonpatch=require(_0x4e8d('0x1'));var rp=require('request-promise');var moment=require(_0x4e8d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4e8d('0x3'));var util=require(_0x4e8d('0x4'));var path=require('path');var sox=require(_0x4e8d('0x5'));var csv=require(_0x4e8d('0x6'));var ejs=require(_0x4e8d('0x7'));var fs=require('fs');var fs_extra=require(_0x4e8d('0x8'));var _=require(_0x4e8d('0x9'));var squel=require(_0x4e8d('0xa'));var crypto=require(_0x4e8d('0xb'));var jsforce=require(_0x4e8d('0xc'));var deskjs=require(_0x4e8d('0xd'));var toCsv=require(_0x4e8d('0x6'));var querystring=require('querystring');var Papa=require(_0x4e8d('0xe'));var Redis=require(_0x4e8d('0xf'));var authService=require(_0x4e8d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e8d('0x11'));var logger=require(_0x4e8d('0x12'))('api');var utils=require(_0x4e8d('0x13'));var config=require(_0x4e8d('0x14'));var licenseUtil=require(_0x4e8d('0x15'));var db=require(_0x4e8d('0x16'))['db'];function respondWithStatusCode(_0x338c9a,_0x861c60){_0x861c60=_0x861c60||0xcc;return function(_0x2c64d8){if(_0x2c64d8){return _0x338c9a['sendStatus'](_0x861c60);}return _0x338c9a[_0x4e8d('0x17')](_0x861c60)['end']();};}function respondWithResult(_0x5b66f8,_0x378aee){_0x378aee=_0x378aee||0xc8;return function(_0x752d19){if(_0x752d19){return _0x5b66f8[_0x4e8d('0x17')](_0x378aee)[_0x4e8d('0x18')](_0x752d19);}};}function respondWithFilteredResult(_0x2e25f7,_0x91c227){return function(_0x2b683f){if(_0x2b683f){var _0x58e600=typeof _0x91c227['offset']==='undefined'&&typeof _0x91c227[_0x4e8d('0x19')]===_0x4e8d('0x1a');var _0xf7b4c2=_0x2b683f[_0x4e8d('0x1b')];var _0xc68941=_0x58e600?0x0:_0x91c227[_0x4e8d('0x1c')];var _0x4ae121=_0x58e600?_0x2b683f['count']:_0x91c227[_0x4e8d('0x1c')]+_0x91c227[_0x4e8d('0x19')];var _0x2bd761;if(_0x4ae121>=_0xf7b4c2){_0x4ae121=_0xf7b4c2;_0x2bd761=0xc8;}else{_0x2bd761=0xce;}_0x2e25f7[_0x4e8d('0x17')](_0x2bd761);return _0x2e25f7[_0x4e8d('0x1d')](_0x4e8d('0x1e'),_0xc68941+'-'+_0x4ae121+'/'+_0xf7b4c2)[_0x4e8d('0x18')](_0x2b683f);}return null;};}function patchUpdates(_0x5c7335){return function(_0x3f6cd8){try{jsonpatch['apply'](_0x3f6cd8,_0x5c7335,!![]);}catch(_0x2e4e43){return BPromise[_0x4e8d('0x1f')](_0x2e4e43);}return _0x3f6cd8['save']();};}function saveUpdates(_0x1de39e,_0x89e34f){return function(_0x34df2e){if(_0x34df2e){return _0x34df2e[_0x4e8d('0x20')](_0x1de39e)['then'](function(_0x5202b5){return _0x5202b5;});}return null;};}function removeEntity(_0x49138b,_0x3fb28c){return function(_0x32817a){if(_0x32817a){return _0x32817a[_0x4e8d('0x21')]()[_0x4e8d('0x22')](function(){_0x49138b[_0x4e8d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dee99,_0x49f3e3){return function(_0x23faf5){if(!_0x23faf5){_0x2dee99[_0x4e8d('0x23')](0x194);}return _0x23faf5;};}function handleError(_0x4a79e2,_0x51052a){_0x51052a=_0x51052a||0x1f4;return function(_0x25da45){logger[_0x4e8d('0x24')](_0x25da45[_0x4e8d('0x25')]);if(_0x25da45['name']){delete _0x25da45['name'];}_0x4a79e2[_0x4e8d('0x17')](_0x51052a)['send'](_0x25da45);};}exports['index']=function(_0x262b14,_0x47c8d8){var _0x43cd1c={},_0x411ed5={},_0x5384e3={'count':0x0,'rows':[]};var _0x27822d=_['map'](db['VoiceMailMessage'][_0x4e8d('0x26')],function(_0x211424){return{'name':_0x211424['fieldName'],'type':_0x211424[_0x4e8d('0x27')]['key']};});_0x411ed5[_0x4e8d('0x28')]=_[_0x4e8d('0x29')](_['map'](_0x27822d,_0x4e8d('0x2a')),['name']);_0x411ed5['query']=_['keys'](_0x262b14[_0x4e8d('0x2b')]);_0x411ed5[_0x4e8d('0x2c')]=_[_0x4e8d('0x2d')](_0x411ed5[_0x4e8d('0x28')],_0x411ed5[_0x4e8d('0x2b')]);_0x43cd1c[_0x4e8d('0x2e')]=_[_0x4e8d('0x2d')](_0x411ed5['model'],qs['fields'](_0x262b14[_0x4e8d('0x2b')][_0x4e8d('0x2f')]));_0x43cd1c[_0x4e8d('0x2e')]=_0x43cd1c[_0x4e8d('0x2e')]['length']?_0x43cd1c[_0x4e8d('0x2e')]:_0x411ed5[_0x4e8d('0x28')];if(!_0x262b14[_0x4e8d('0x2b')][_0x4e8d('0x30')](_0x4e8d('0x31'))){_0x43cd1c[_0x4e8d('0x19')]=qs[_0x4e8d('0x19')](_0x262b14[_0x4e8d('0x2b')]['limit']);_0x43cd1c['offset']=qs[_0x4e8d('0x1c')](_0x262b14[_0x4e8d('0x2b')][_0x4e8d('0x1c')]);}_0x43cd1c['order']=qs['sort'](_0x262b14[_0x4e8d('0x2b')][_0x4e8d('0x32')]);_0x43cd1c[_0x4e8d('0x33')]=qs[_0x4e8d('0x2c')](_['pick'](_0x262b14['query'],_0x411ed5[_0x4e8d('0x2c')]),_0x27822d);if(_0x262b14[_0x4e8d('0x2b')]['filter']){_0x43cd1c['where']=_['merge'](_0x43cd1c[_0x4e8d('0x33')],{'$or':_[_0x4e8d('0x34')](_0x27822d,function(_0x104b0c){if(_0x104b0c[_0x4e8d('0x27')]!==_0x4e8d('0x35')){var _0x4d8a21={};_0x4d8a21[_0x104b0c['name']]={'$like':'%'+_0x262b14[_0x4e8d('0x2b')]['filter']+'%'};return _0x4d8a21;}})});}_0x43cd1c=_['merge']({},_0x43cd1c,_0x262b14[_0x4e8d('0x36')]);var _0x4442c1={'where':_0x43cd1c['where']};return db[_0x4e8d('0x37')][_0x4e8d('0x1b')](_0x4442c1)[_0x4e8d('0x22')](function(_0x141a37){_0x5384e3[_0x4e8d('0x1b')]=_0x141a37;if(_0x262b14[_0x4e8d('0x2b')][_0x4e8d('0x38')]){_0x43cd1c[_0x4e8d('0x39')]=[{'all':!![]}];}return db[_0x4e8d('0x37')][_0x4e8d('0x3a')](_0x43cd1c);})[_0x4e8d('0x22')](function(_0x560f4a){_0x5384e3['rows']=_0x560f4a;return _0x5384e3;})[_0x4e8d('0x22')](respondWithFilteredResult(_0x47c8d8,_0x43cd1c))[_0x4e8d('0x3b')](handleError(_0x47c8d8,null));};exports['show']=function(_0x453f52,_0x5eb6c1){var _0x4a3d22={'raw':!![],'where':{'id':_0x453f52['params']['id']}},_0x474a0b={};_0x474a0b[_0x4e8d('0x28')]=_[_0x4e8d('0x3c')](db[_0x4e8d('0x37')][_0x4e8d('0x26')]);_0x474a0b[_0x4e8d('0x2b')]=_[_0x4e8d('0x3c')](_0x453f52[_0x4e8d('0x2b')]);_0x474a0b[_0x4e8d('0x2c')]=_['intersection'](_0x474a0b[_0x4e8d('0x28')],_0x474a0b['query']);_0x4a3d22[_0x4e8d('0x2e')]=_['intersection'](_0x474a0b[_0x4e8d('0x28')],qs[_0x4e8d('0x2f')](_0x453f52[_0x4e8d('0x2b')][_0x4e8d('0x2f')]));_0x4a3d22[_0x4e8d('0x2e')]=_0x4a3d22[_0x4e8d('0x2e')][_0x4e8d('0x3d')]?_0x4a3d22[_0x4e8d('0x2e')]:_0x474a0b['model'];if(_0x453f52[_0x4e8d('0x2b')][_0x4e8d('0x38')]){_0x4a3d22['include']=[{'all':!![]}];}_0x4a3d22=_['merge']({},_0x4a3d22,_0x453f52[_0x4e8d('0x36')]);return db[_0x4e8d('0x37')][_0x4e8d('0x3e')](_0x4a3d22)['then'](handleEntityNotFound(_0x5eb6c1,null))[_0x4e8d('0x22')](respondWithResult(_0x5eb6c1,null))['catch'](handleError(_0x5eb6c1,null));};exports[_0x4e8d('0x3f')]=function(_0x4922ae,_0x5eeb54){return db[_0x4e8d('0x37')][_0x4e8d('0x3f')](_0x4922ae[_0x4e8d('0x40')],{})['then'](respondWithResult(_0x5eeb54,0xc9))[_0x4e8d('0x3b')](handleError(_0x5eeb54,null));};exports['update']=function(_0x5840ce,_0x182b1b){if(_0x5840ce['body']['id']){delete _0x5840ce[_0x4e8d('0x40')]['id'];}return db['VoiceMailMessage'][_0x4e8d('0x3e')]({'where':{'id':_0x5840ce['params']['id']}})[_0x4e8d('0x22')](handleEntityNotFound(_0x182b1b,null))[_0x4e8d('0x22')](saveUpdates(_0x5840ce['body'],null))[_0x4e8d('0x22')](respondWithResult(_0x182b1b,null))['catch'](handleError(_0x182b1b,null));};exports[_0x4e8d('0x21')]=function(_0x5cabb7,_0x4ac30e){return db[_0x4e8d('0x37')][_0x4e8d('0x3e')]({'where':{'id':_0x5cabb7[_0x4e8d('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ac30e,null))[_0x4e8d('0x22')](removeEntity(_0x4ac30e,null))[_0x4e8d('0x3b')](handleError(_0x4ac30e,null));};exports[_0x4e8d('0x42')]=function(_0x3176a7,_0x207dba,_0x521704){return db[_0x4e8d('0x37')]['find']({'where':{'id':_0x3176a7[_0x4e8d('0x41')]['id']},'attributes':['id',_0x4e8d('0x43'),_0x4e8d('0x44')]})['then'](handleEntityNotFound(_0x207dba,null))['then'](function(_0x5651bf){if(_0x5651bf){if(!_0x5651bf[_0x4e8d('0x43')]){throw new db['Sequelize']['ValidationError'](_0x4e8d('0x45'));}var _0x287300={'Content-Type':_0x4e8d('0x46'),'Content-Disposition':_0x4e8d('0x47')};if(_0x5651bf[_0x4e8d('0x44')]){_0x287300[_0x4e8d('0x48')]=_0x4e8d('0x49')+_0x5651bf[_0x4e8d('0x44')]+_0x4e8d('0x4a');}_0x207dba[_0x4e8d('0x1d')](_0x287300);return _0x207dba[_0x4e8d('0x4b')](new Buffer(_0x5651bf[_0x4e8d('0x43')]));}})[_0x4e8d('0x3b')](handleError(_0x207dba,null));}; \ No newline at end of file +var _0xa5f5=['ValidationError','audio/wav','attachment','.wav\x22','recording','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','set','apply','reject','save','update','then','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','length','find','create','body','params','download','msg_id'];(function(_0x57d7e8,_0x3ca452){var _0x3fed0d=function(_0x2d6d90){while(--_0x2d6d90){_0x57d7e8['push'](_0x57d7e8['shift']());}};_0x3fed0d(++_0x3ca452);}(_0xa5f5,0x1d9));var _0x5a5f=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xa5f5[_0x2642cb];return _0xe6e41;};'use strict';var emlformat=require(_0x5a5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a5f('0x1'));var jsonpatch=require(_0x5a5f('0x2'));var rp=require(_0x5a5f('0x3'));var moment=require(_0x5a5f('0x4'));var BPromise=require(_0x5a5f('0x5'));var Mustache=require('mustache');var util=require(_0x5a5f('0x6'));var path=require(_0x5a5f('0x7'));var sox=require(_0x5a5f('0x8'));var csv=require(_0x5a5f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a5f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a5f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5a5f('0xc'));var authService=require(_0x5a5f('0xd'));var qs=require(_0x5a5f('0xe'));var as=require(_0x5a5f('0xf'));var hardwareService=require(_0x5a5f('0x10'));var logger=require(_0x5a5f('0x11'))(_0x5a5f('0x12'));var utils=require(_0x5a5f('0x13'));var config=require(_0x5a5f('0x14'));var licenseUtil=require(_0x5a5f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71bfc8,_0x1f5b4a){_0x1f5b4a=_0x1f5b4a||0xcc;return function(_0xd2ddb5){if(_0xd2ddb5){return _0x71bfc8[_0x5a5f('0x16')](_0x1f5b4a);}return _0x71bfc8[_0x5a5f('0x17')](_0x1f5b4a)[_0x5a5f('0x18')]();};}function respondWithResult(_0x1a012e,_0x20ddbf){_0x20ddbf=_0x20ddbf||0xc8;return function(_0x5d63aa){if(_0x5d63aa){return _0x1a012e[_0x5a5f('0x17')](_0x20ddbf)[_0x5a5f('0x19')](_0x5d63aa);}};}function respondWithFilteredResult(_0x3a346f,_0x2cc0b2){return function(_0x5161fe){if(_0x5161fe){var _0x767f12=typeof _0x2cc0b2['offset']===_0x5a5f('0x1a')&&typeof _0x2cc0b2[_0x5a5f('0x1b')]===_0x5a5f('0x1a');var _0x4d33d0=_0x5161fe['count'];var _0x5de8a6=_0x767f12?0x0:_0x2cc0b2[_0x5a5f('0x1c')];var _0x3315dc=_0x767f12?_0x5161fe['count']:_0x2cc0b2[_0x5a5f('0x1c')]+_0x2cc0b2[_0x5a5f('0x1b')];var _0x15f05b;if(_0x3315dc>=_0x4d33d0){_0x3315dc=_0x4d33d0;_0x15f05b=0xc8;}else{_0x15f05b=0xce;}_0x3a346f[_0x5a5f('0x17')](_0x15f05b);return _0x3a346f[_0x5a5f('0x1d')]('Content-Range',_0x5de8a6+'-'+_0x3315dc+'/'+_0x4d33d0)[_0x5a5f('0x19')](_0x5161fe);}return null;};}function patchUpdates(_0x41f230){return function(_0x49cf42){try{jsonpatch[_0x5a5f('0x1e')](_0x49cf42,_0x41f230,!![]);}catch(_0x27b122){return BPromise[_0x5a5f('0x1f')](_0x27b122);}return _0x49cf42[_0x5a5f('0x20')]();};}function saveUpdates(_0x3e76f6,_0x3c0c39){return function(_0x2199a2){if(_0x2199a2){return _0x2199a2[_0x5a5f('0x21')](_0x3e76f6)[_0x5a5f('0x22')](function(_0x51672b){return _0x51672b;});}return null;};}function removeEntity(_0x45454f,_0x87e9a6){return function(_0x5d6749){if(_0x5d6749){return _0x5d6749['destroy']()['then'](function(){_0x45454f[_0x5a5f('0x17')](0xcc)[_0x5a5f('0x18')]();});}};}function handleEntityNotFound(_0x40b439,_0x5c6029){return function(_0x30e099){if(!_0x30e099){_0x40b439[_0x5a5f('0x16')](0x194);}return _0x30e099;};}function handleError(_0x326550,_0x36bcfd){_0x36bcfd=_0x36bcfd||0x1f4;return function(_0x2ea3c5){logger[_0x5a5f('0x23')](_0x2ea3c5[_0x5a5f('0x24')]);if(_0x2ea3c5['name']){delete _0x2ea3c5[_0x5a5f('0x25')];}_0x326550[_0x5a5f('0x17')](_0x36bcfd)[_0x5a5f('0x26')](_0x2ea3c5);};}exports['index']=function(_0x322ec3,_0x5b2a4b){var _0x46eabc={},_0x5243ba={},_0x32ba59={'count':0x0,'rows':[]};var _0x3f3b77=_[_0x5a5f('0x27')](db[_0x5a5f('0x28')][_0x5a5f('0x29')],function(_0x5b3304){return{'name':_0x5b3304[_0x5a5f('0x2a')],'type':_0x5b3304['type'][_0x5a5f('0x2b')]};});_0x5243ba[_0x5a5f('0x2c')]=_['differenceBy'](_[_0x5a5f('0x27')](_0x3f3b77,_0x5a5f('0x25')),[_0x5a5f('0x25')]);_0x5243ba[_0x5a5f('0x2d')]=_[_0x5a5f('0x2e')](_0x322ec3[_0x5a5f('0x2d')]);_0x5243ba['filters']=_[_0x5a5f('0x2f')](_0x5243ba[_0x5a5f('0x2c')],_0x5243ba[_0x5a5f('0x2d')]);_0x46eabc['attributes']=_['intersection'](_0x5243ba[_0x5a5f('0x2c')],qs[_0x5a5f('0x30')](_0x322ec3[_0x5a5f('0x2d')][_0x5a5f('0x30')]));_0x46eabc[_0x5a5f('0x31')]=_0x46eabc['attributes']['length']?_0x46eabc['attributes']:_0x5243ba[_0x5a5f('0x2c')];if(!_0x322ec3[_0x5a5f('0x2d')]['hasOwnProperty'](_0x5a5f('0x32'))){_0x46eabc[_0x5a5f('0x1b')]=qs[_0x5a5f('0x1b')](_0x322ec3[_0x5a5f('0x2d')][_0x5a5f('0x1b')]);_0x46eabc[_0x5a5f('0x1c')]=qs[_0x5a5f('0x1c')](_0x322ec3[_0x5a5f('0x2d')][_0x5a5f('0x1c')]);}_0x46eabc[_0x5a5f('0x33')]=qs[_0x5a5f('0x34')](_0x322ec3[_0x5a5f('0x2d')][_0x5a5f('0x34')]);_0x46eabc[_0x5a5f('0x35')]=qs['filters'](_['pick'](_0x322ec3[_0x5a5f('0x2d')],_0x5243ba[_0x5a5f('0x36')]),_0x3f3b77);if(_0x322ec3[_0x5a5f('0x2d')]['filter']){_0x46eabc[_0x5a5f('0x35')]=_[_0x5a5f('0x37')](_0x46eabc['where'],{'$or':_[_0x5a5f('0x27')](_0x3f3b77,function(_0x2920e4){if(_0x2920e4[_0x5a5f('0x38')]!==_0x5a5f('0x39')){var _0x31b098={};_0x31b098[_0x2920e4['name']]={'$like':'%'+_0x322ec3['query'][_0x5a5f('0x3a')]+'%'};return _0x31b098;}})});}_0x46eabc=_[_0x5a5f('0x37')]({},_0x46eabc,_0x322ec3[_0x5a5f('0x3b')]);var _0x1c5330={'where':_0x46eabc['where']};return db[_0x5a5f('0x28')][_0x5a5f('0x3c')](_0x1c5330)[_0x5a5f('0x22')](function(_0x385cb8){_0x32ba59['count']=_0x385cb8;if(_0x322ec3['query'][_0x5a5f('0x3d')]){_0x46eabc[_0x5a5f('0x3e')]=[{'all':!![]}];}return db[_0x5a5f('0x28')][_0x5a5f('0x3f')](_0x46eabc);})[_0x5a5f('0x22')](function(_0x20afdb){_0x32ba59['rows']=_0x20afdb;return _0x32ba59;})[_0x5a5f('0x22')](respondWithFilteredResult(_0x5b2a4b,_0x46eabc))[_0x5a5f('0x40')](handleError(_0x5b2a4b,null));};exports[_0x5a5f('0x41')]=function(_0xf9eb07,_0x5a6313){var _0x5b351e={'raw':!![],'where':{'id':_0xf9eb07['params']['id']}},_0x5cb1f1={};_0x5cb1f1[_0x5a5f('0x2c')]=_['keys'](db[_0x5a5f('0x28')][_0x5a5f('0x29')]);_0x5cb1f1['query']=_[_0x5a5f('0x2e')](_0xf9eb07[_0x5a5f('0x2d')]);_0x5cb1f1[_0x5a5f('0x36')]=_[_0x5a5f('0x2f')](_0x5cb1f1['model'],_0x5cb1f1[_0x5a5f('0x2d')]);_0x5b351e[_0x5a5f('0x31')]=_['intersection'](_0x5cb1f1['model'],qs[_0x5a5f('0x30')](_0xf9eb07['query'][_0x5a5f('0x30')]));_0x5b351e[_0x5a5f('0x31')]=_0x5b351e[_0x5a5f('0x31')][_0x5a5f('0x42')]?_0x5b351e[_0x5a5f('0x31')]:_0x5cb1f1[_0x5a5f('0x2c')];if(_0xf9eb07[_0x5a5f('0x2d')][_0x5a5f('0x3d')]){_0x5b351e[_0x5a5f('0x3e')]=[{'all':!![]}];}_0x5b351e=_[_0x5a5f('0x37')]({},_0x5b351e,_0xf9eb07['options']);return db[_0x5a5f('0x28')][_0x5a5f('0x43')](_0x5b351e)[_0x5a5f('0x22')](handleEntityNotFound(_0x5a6313,null))[_0x5a5f('0x22')](respondWithResult(_0x5a6313,null))[_0x5a5f('0x40')](handleError(_0x5a6313,null));};exports['create']=function(_0x47a41d,_0x4b49ba){return db[_0x5a5f('0x28')][_0x5a5f('0x44')](_0x47a41d[_0x5a5f('0x45')],{})[_0x5a5f('0x22')](respondWithResult(_0x4b49ba,0xc9))[_0x5a5f('0x40')](handleError(_0x4b49ba,null));};exports[_0x5a5f('0x21')]=function(_0xb75a91,_0x1578b0){if(_0xb75a91[_0x5a5f('0x45')]['id']){delete _0xb75a91[_0x5a5f('0x45')]['id'];}return db['VoiceMailMessage'][_0x5a5f('0x43')]({'where':{'id':_0xb75a91[_0x5a5f('0x46')]['id']}})[_0x5a5f('0x22')](handleEntityNotFound(_0x1578b0,null))[_0x5a5f('0x22')](saveUpdates(_0xb75a91[_0x5a5f('0x45')],null))['then'](respondWithResult(_0x1578b0,null))[_0x5a5f('0x40')](handleError(_0x1578b0,null));};exports['destroy']=function(_0x443af3,_0x810c23){return db[_0x5a5f('0x28')][_0x5a5f('0x43')]({'where':{'id':_0x443af3[_0x5a5f('0x46')]['id']}})[_0x5a5f('0x22')](handleEntityNotFound(_0x810c23,null))[_0x5a5f('0x22')](removeEntity(_0x810c23,null))[_0x5a5f('0x40')](handleError(_0x810c23,null));};exports[_0x5a5f('0x47')]=function(_0x403114,_0xae6c05,_0xcd78b2){return db['VoiceMailMessage']['find']({'where':{'id':_0x403114['params']['id']},'attributes':['id','recording',_0x5a5f('0x48')]})[_0x5a5f('0x22')](handleEntityNotFound(_0xae6c05,null))['then'](function(_0x58fd7d){if(_0x58fd7d){if(!_0x58fd7d['recording']){throw new db['Sequelize'][(_0x5a5f('0x49'))]('VoiceMailMessage\x20not\x20found');}var _0x456a47={'Content-Type':_0x5a5f('0x4a'),'Content-Disposition':_0x5a5f('0x4b')};if(_0x58fd7d['msg_id']){_0x456a47['Content-Disposition']='attachment;\x20filename=\x22'+_0x58fd7d[_0x5a5f('0x48')]+_0x5a5f('0x4c');}_0xae6c05[_0x5a5f('0x1d')](_0x456a47);return _0xae6c05['send'](new Buffer(_0x58fd7d[_0x5a5f('0x4d')]));}})[_0x5a5f('0x40')](handleError(_0xae6c05,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1983db0..17790eb 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 _0xb9ea=['./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0xb9ea,0xfc));var _0xab9e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb9ea[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xab9e('0x0'));var util=require(_0xab9e('0x1'));var logger=require('../../config/logger')(_0xab9e('0x2'));var moment=require(_0xab9e('0x3'));var BPromise=require(_0xab9e('0x4'));var rp=require(_0xab9e('0x5'));var fs=require('fs');var path=require(_0xab9e('0x6'));var rimraf=require(_0xab9e('0x7'));var config=require('../../config/environment');var attributes=require(_0xab9e('0x8'));module[_0xab9e('0x9')]=function(_0x105113,_0x1a2e32){return _0x105113['define'](_0xab9e('0xa'),attributes,{'tableName':_0xab9e('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xab9e('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1985=['dir','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x1985,0x199));var _0x5198=function(_0x1347c9,_0x5e60a6){_0x1347c9=_0x1347c9-0x0;var _0x1e6592=_0x1985[_0x1347c9];return _0x1e6592;};'use strict';var _=require(_0x5198('0x0'));var util=require(_0x5198('0x1'));var logger=require('../../config/logger')(_0x5198('0x2'));var moment=require(_0x5198('0x3'));var BPromise=require(_0x5198('0x4'));var rp=require(_0x5198('0x5'));var fs=require('fs');var path=require(_0x5198('0x6'));var rimraf=require(_0x5198('0x7'));var config=require('../../config/environment');var attributes=require(_0x5198('0x8'));module[_0x5198('0x9')]=function(_0x27e5d1,_0x2bc8a7){return _0x27e5d1[_0x5198('0xa')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x5198('0xb'),'fields':[_0x5198('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index da95a58..caf8477 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 _0x9a0e=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9a0e,0x1f2));var _0xe9a0=function(_0x503659,_0xfb8b2a){_0x503659=_0x503659-0x0;var _0x9ab53=_0x9a0e[_0x503659];return _0x9ab53;};'use strict';var _=require(_0xe9a0('0x0'));var util=require(_0xe9a0('0x1'));var moment=require(_0xe9a0('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9a0('0x3'));var fs=require('fs');var Redis=require(_0xe9a0('0x4'));var db=require(_0xe9a0('0x5'))['db'];var utils=require(_0xe9a0('0x6'));var logger=require('../../config/logger')(_0xe9a0('0x7'));var config=require(_0xe9a0('0x8'));var jayson=require(_0xe9a0('0x9'));var client=jayson[_0xe9a0('0xa')][_0xe9a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2eef4d,_0x33b9c2,_0x35f84a){return new BPromise(function(_0x296871,_0x345d4c){return client[_0xe9a0('0xc')](_0x2eef4d,_0x35f84a)['then'](function(_0x2adabc){logger['info'](_0xe9a0('0xd'),_0x33b9c2,'request\x20sent');logger[_0xe9a0('0xe')](_0xe9a0('0xf'),_0x33b9c2,_0xe9a0('0x10'),JSON[_0xe9a0('0x11')](_0x2adabc));if(_0x2adabc[_0xe9a0('0x12')]){if(_0x2adabc[_0xe9a0('0x12')][_0xe9a0('0x13')]===0x1f4){logger[_0xe9a0('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x33b9c2,_0x2adabc[_0xe9a0('0x12')]['message']);return _0x345d4c(_0x2adabc[_0xe9a0('0x12')][_0xe9a0('0x14')]);}logger[_0xe9a0('0x12')](_0xe9a0('0xd'),_0x33b9c2,_0x2adabc['error'][_0xe9a0('0x14')]);return _0x296871(_0x2adabc[_0xe9a0('0x12')][_0xe9a0('0x14')]);}else{logger[_0xe9a0('0x15')](_0xe9a0('0xd'),_0x33b9c2,_0xe9a0('0x10'));_0x296871(_0x2adabc[_0xe9a0('0x16')][_0xe9a0('0x14')]);}})[_0xe9a0('0x17')](function(_0x4f2f77){logger[_0xe9a0('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x33b9c2,_0x4f2f77);_0x345d4c(_0x4f2f77);});});} \ No newline at end of file +var _0x4099=['util','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x593968,_0x3399e8){var _0x4613e7=function(_0x5bd497){while(--_0x5bd497){_0x593968['push'](_0x593968['shift']());}};_0x4613e7(++_0x3399e8);}(_0x4099,0x71));var _0x9409=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x4099[_0x946518];return _0x909b69;};'use strict';var _=require(_0x9409('0x0'));var util=require(_0x9409('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9409('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x9409('0x3'))(_0x9409('0x4'));var config=require(_0x9409('0x5'));var jayson=require(_0x9409('0x6'));var client=jayson['client'][_0x9409('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c88e1,_0x2d24fa,_0x409454){return new BPromise(function(_0x33c0bb,_0x1b5b80){return client[_0x9409('0x8')](_0x5c88e1,_0x409454)['then'](function(_0x58a30a){logger[_0x9409('0x9')](_0x9409('0xa'),_0x2d24fa,_0x9409('0xb'));logger['debug'](_0x9409('0xc'),_0x2d24fa,'request\x20sent',JSON[_0x9409('0xd')](_0x58a30a));if(_0x58a30a[_0x9409('0xe')]){if(_0x58a30a['error'][_0x9409('0xf')]===0x1f4){logger[_0x9409('0xe')](_0x9409('0xa'),_0x2d24fa,_0x58a30a[_0x9409('0xe')][_0x9409('0x10')]);return _0x1b5b80(_0x58a30a[_0x9409('0xe')][_0x9409('0x10')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2d24fa,_0x58a30a['error'][_0x9409('0x10')]);return _0x33c0bb(_0x58a30a[_0x9409('0xe')][_0x9409('0x10')]);}else{logger['info'](_0x9409('0xa'),_0x2d24fa,'request\x20sent');_0x33c0bb(_0x58a30a[_0x9409('0x11')][_0x9409('0x10')]);}})[_0x9409('0x12')](function(_0x10cb6){logger[_0x9409('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x2d24fa,_0x10cb6);_0x1b5b80(_0x10cb6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f674cbd..2120e2a 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 _0x59ef=['create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','post'];(function(_0x1b7ef1,_0x57f93e){var _0x577f11=function(_0x585d88){while(--_0x585d88){_0x1b7ef1['push'](_0x1b7ef1['shift']());}};_0x577f11(++_0x57f93e);}(_0x59ef,0x1bd));var _0xf59e=function(_0x2c8fd8,_0x3ec770){_0x2c8fd8=_0x2c8fd8-0x0;var _0x1b4e18=_0x59ef[_0x2c8fd8];return _0x1b4e18;};'use strict';var multer=require(_0xf59e('0x0'));var util=require(_0xf59e('0x1'));var path=require(_0xf59e('0x2'));var timeout=require(_0xf59e('0x3'));var express=require('express');var router=express[_0xf59e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf59e('0x5'));var interaction=require(_0xf59e('0x6'));var config=require(_0xf59e('0x7'));var controller=require(_0xf59e('0x8'));router[_0xf59e('0x9')]('/',auth[_0xf59e('0xa')](),controller[_0xf59e('0xb')]);router[_0xf59e('0x9')](_0xf59e('0xc'),auth[_0xf59e('0xa')](),controller['show']);router[_0xf59e('0x9')](_0xf59e('0xd'),auth[_0xf59e('0xa')](),controller['getSounds']);router[_0xf59e('0xe')]('/',auth[_0xf59e('0xa')](),controller[_0xf59e('0xf')]);router['post'](_0xf59e('0xd'),auth[_0xf59e('0xa')](),controller[_0xf59e('0x10')]);router[_0xf59e('0x11')](_0xf59e('0xc'),auth[_0xf59e('0xa')](),controller[_0xf59e('0x12')]);router[_0xf59e('0x13')](_0xf59e('0xc'),auth[_0xf59e('0xa')](),controller[_0xf59e('0x14')]);router[_0xf59e('0x13')](_0xf59e('0x15'),auth[_0xf59e('0xa')](),controller[_0xf59e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x4f5a=['removeSound','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy'];(function(_0x45af02,_0x23ebe2){var _0x5da10f=function(_0x992165){while(--_0x992165){_0x45af02['push'](_0x45af02['shift']());}};_0x5da10f(++_0x23ebe2);}(_0x4f5a,0x1b2));var _0xa4f5=function(_0xe723a6,_0x394be0){_0xe723a6=_0xe723a6-0x0;var _0x2685ff=_0x4f5a[_0xe723a6];return _0x2685ff;};'use strict';var multer=require(_0xa4f5('0x0'));var util=require(_0xa4f5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa4f5('0x2'));var router=express[_0xa4f5('0x3')]();var fs_extra=require(_0xa4f5('0x4'));var auth=require(_0xa4f5('0x5'));var interaction=require(_0xa4f5('0x6'));var config=require(_0xa4f5('0x7'));var controller=require(_0xa4f5('0x8'));router[_0xa4f5('0x9')]('/',auth[_0xa4f5('0xa')](),controller['index']);router[_0xa4f5('0x9')](_0xa4f5('0xb'),auth[_0xa4f5('0xa')](),controller[_0xa4f5('0xc')]);router[_0xa4f5('0x9')](_0xa4f5('0xd'),auth[_0xa4f5('0xa')](),controller[_0xa4f5('0xe')]);router[_0xa4f5('0xf')]('/',auth[_0xa4f5('0xa')](),controller[_0xa4f5('0x10')]);router['post'](_0xa4f5('0xd'),auth[_0xa4f5('0xa')](),controller[_0xa4f5('0x11')]);router[_0xa4f5('0x12')](_0xa4f5('0xb'),auth[_0xa4f5('0xa')](),controller[_0xa4f5('0x13')]);router[_0xa4f5('0x14')](_0xa4f5('0xb'),auth[_0xa4f5('0xa')](),controller[_0xa4f5('0x15')]);router[_0xa4f5('0x14')]('/:id/sounds/:id2',auth[_0xa4f5('0xa')](),controller[_0xa4f5('0x16')]);module[_0xa4f5('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 1144ae0..30c9bbd 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 _0x6a0b=['TIMESTAMP','BOOLEAN','STRING','name','custom','files','quietmp3nb','quietmp3','mp3','alpha'];(function(_0x8b8916,_0x26ff32){var _0xd0de77=function(_0x876105){while(--_0x876105){_0x8b8916['push'](_0x8b8916['shift']());}};_0xd0de77(++_0x26ff32);}(_0x6a0b,0x8e));var _0xb6a0=function(_0xbdb8ba,_0x4ab0c2){_0xbdb8ba=_0xbdb8ba-0x0;var _0x41425f=_0x6a0b[_0xbdb8ba];return _0x41425f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb6a0('0x0')],'allowNull':![],'unique':_0xb6a0('0x1')},'mode':{'type':Sequelize['ENUM'](_0xb6a0('0x2'),_0xb6a0('0x3'),'mp3nb',_0xb6a0('0x4'),_0xb6a0('0x5'),_0xb6a0('0x6')),'allowNull':!![],'defaultValue':_0xb6a0('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xb6a0('0x0')],'allowNull':!![]},'digit':{'type':Sequelize[_0xb6a0('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0xb6a0('0x0')],'allowNull':!![],'defaultValue':_0xb6a0('0x7')},'format':{'type':Sequelize[_0xb6a0('0x0')],'allowNull':!![]},'stamp':{'type':_0xb6a0('0x8')},'defaultEntry':{'type':Sequelize[_0xb6a0('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x04ed=['quietmp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','files','mp3nb'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x04ed,0x1e5));var _0xd04e=function(_0x24ed85,_0x44c519){_0x24ed85=_0x24ed85-0x0;var _0x82bcd5=_0x04ed[_0x24ed85];return _0x82bcd5;};'use strict';var Sequelize=require(_0xd04e('0x0'));module[_0xd04e('0x1')]={'name':{'type':Sequelize[_0xd04e('0x2')],'allowNull':![],'unique':_0xd04e('0x3')},'mode':{'type':Sequelize[_0xd04e('0x4')]('custom',_0xd04e('0x5'),_0xd04e('0x6'),_0xd04e('0x7'),_0xd04e('0x8'),_0xd04e('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xd04e('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xd04e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd04e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd04e('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xd04e('0x2')],'allowNull':!![]},'stamp':{'type':_0xd04e('0xa')},'defaultEntry':{'type':Sequelize[_0xd04e('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 49c408d..f8b8bec 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 _0x6e15=['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','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','VoiceMusicOnHold','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','rows','catch','rawAttributes','include','find','body','create','mode','files','join','root','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','error','params','sequelize','transaction','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','converted_format','server/files/sounds/converted','%s.%s','basename','save_name','server/files/moh','format','Sequelize','removeSound','id2','createdAt','getSounds','intersection','order','pick','options','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x31d5a0,_0x24c2db){var _0x2fd213=function(_0x22fdf7){while(--_0x22fdf7){_0x31d5a0['push'](_0x31d5a0['shift']());}};_0x2fd213(++_0x24c2db);}(_0x6e15,0x67));var _0x56e1=function(_0x1ffe0b,_0x36a189){_0x1ffe0b=_0x1ffe0b-0x0;var _0x1a9f98=_0x6e15[_0x1ffe0b];return _0x1a9f98;};'use strict';var emlformat=require(_0x56e1('0x0'));var rimraf=require(_0x56e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x56e1('0x2'));var moment=require(_0x56e1('0x3'));var BPromise=require(_0x56e1('0x4'));var Mustache=require(_0x56e1('0x5'));var util=require(_0x56e1('0x6'));var path=require(_0x56e1('0x7'));var sox=require(_0x56e1('0x8'));var csv=require(_0x56e1('0x9'));var ejs=require(_0x56e1('0xa'));var fs=require('fs');var fs_extra=require(_0x56e1('0xb'));var _=require(_0x56e1('0xc'));var squel=require(_0x56e1('0xd'));var crypto=require(_0x56e1('0xe'));var jsforce=require(_0x56e1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x56e1('0x9'));var querystring=require(_0x56e1('0x10'));var Papa=require(_0x56e1('0x11'));var Redis=require(_0x56e1('0x12'));var authService=require(_0x56e1('0x13'));var qs=require(_0x56e1('0x14'));var as=require(_0x56e1('0x15'));var hardwareService=require(_0x56e1('0x16'));var logger=require('../../config/logger')(_0x56e1('0x17'));var utils=require(_0x56e1('0x18'));var config=require(_0x56e1('0x19'));var licenseUtil=require(_0x56e1('0x1a'));var db=require(_0x56e1('0x1b'))['db'];function respondWithStatusCode(_0x4b6e99,_0x551763){_0x551763=_0x551763||0xcc;return function(_0x4dd380){if(_0x4dd380){return _0x4b6e99[_0x56e1('0x1c')](_0x551763);}return _0x4b6e99['status'](_0x551763)[_0x56e1('0x1d')]();};}function respondWithResult(_0x56902e,_0x4283a1){_0x4283a1=_0x4283a1||0xc8;return function(_0xebe6b1){if(_0xebe6b1){return _0x56902e['status'](_0x4283a1)['json'](_0xebe6b1);}};}function respondWithFilteredResult(_0x581905,_0x33ff2b){return function(_0x5c4214){if(_0x5c4214){var _0x32d9c7=typeof _0x33ff2b[_0x56e1('0x1e')]==='undefined'&&typeof _0x33ff2b[_0x56e1('0x1f')]===_0x56e1('0x20');var _0xbbb6db=_0x5c4214[_0x56e1('0x21')];var _0x4de772=_0x32d9c7?0x0:_0x33ff2b[_0x56e1('0x1e')];var _0x37655f=_0x32d9c7?_0x5c4214[_0x56e1('0x21')]:_0x33ff2b[_0x56e1('0x1e')]+_0x33ff2b[_0x56e1('0x1f')];var _0x3e7274;if(_0x37655f>=_0xbbb6db){_0x37655f=_0xbbb6db;_0x3e7274=0xc8;}else{_0x3e7274=0xce;}_0x581905[_0x56e1('0x22')](_0x3e7274);return _0x581905[_0x56e1('0x23')](_0x56e1('0x24'),_0x4de772+'-'+_0x37655f+'/'+_0xbbb6db)[_0x56e1('0x25')](_0x5c4214);}return null;};}function patchUpdates(_0x3782e4){return function(_0x1fb0c7){try{jsonpatch['apply'](_0x1fb0c7,_0x3782e4,!![]);}catch(_0x245c9e){return BPromise[_0x56e1('0x26')](_0x245c9e);}return _0x1fb0c7[_0x56e1('0x27')]();};}function saveUpdates(_0x3418a7,_0x28a670){return function(_0x1fcb51){if(_0x1fcb51){return _0x1fcb51[_0x56e1('0x28')](_0x3418a7)[_0x56e1('0x29')](function(_0x34909a){return _0x34909a;});}return null;};}function removeEntity(_0x1f3e20,_0x127d96){return function(_0x19e592){if(_0x19e592){return _0x19e592[_0x56e1('0x2a')]()[_0x56e1('0x29')](function(){var _0x3a5bde=_0x19e592[_0x56e1('0x2b')]({'plain':!![]});var _0x5a51fc='MusicOnHolds';return db[_0x56e1('0x2c')][_0x56e1('0x2a')]({'where':{'type':_0x5a51fc,'resourceId':_0x3a5bde['id']}})['then'](function(){return _0x19e592;});})[_0x56e1('0x29')](function(){_0x1f3e20['status'](0xcc)[_0x56e1('0x1d')]();});}};}function handleEntityNotFound(_0x4d4743,_0x45ca8b){return function(_0x3549a2){if(!_0x3549a2){_0x4d4743[_0x56e1('0x1c')](0x194);}return _0x3549a2;};}function handleError(_0x1a12c0,_0x7c67e9){_0x7c67e9=_0x7c67e9||0x1f4;return function(_0x5e7404){logger['error'](_0x5e7404['stack']);if(_0x5e7404[_0x56e1('0x2d')]){delete _0x5e7404[_0x56e1('0x2d')];}_0x1a12c0['status'](_0x7c67e9)[_0x56e1('0x2e')](_0x5e7404);};}exports[_0x56e1('0x2f')]=function(_0x212aad,_0x477e82){var _0x379f55={},_0x26ef94={},_0x52b49d={'count':0x0,'rows':[]};var _0x16e9eb=_['map'](db[_0x56e1('0x30')]['rawAttributes'],function(_0x3d1164){return{'name':_0x3d1164[_0x56e1('0x31')],'type':_0x3d1164[_0x56e1('0x32')]['key']};});_0x26ef94[_0x56e1('0x33')]=_[_0x56e1('0x34')](_0x16e9eb,_0x56e1('0x2d'));_0x26ef94[_0x56e1('0x35')]=_[_0x56e1('0x36')](_0x212aad[_0x56e1('0x35')]);_0x26ef94[_0x56e1('0x37')]=_['intersection'](_0x26ef94[_0x56e1('0x33')],_0x26ef94[_0x56e1('0x35')]);_0x379f55[_0x56e1('0x38')]=_['intersection'](_0x26ef94[_0x56e1('0x33')],qs[_0x56e1('0x39')](_0x212aad[_0x56e1('0x35')][_0x56e1('0x39')]));_0x379f55[_0x56e1('0x38')]=_0x379f55[_0x56e1('0x38')][_0x56e1('0x3a')]?_0x379f55['attributes']:_0x26ef94[_0x56e1('0x33')];if(!_0x212aad[_0x56e1('0x35')][_0x56e1('0x3b')](_0x56e1('0x3c'))){_0x379f55['limit']=qs[_0x56e1('0x1f')](_0x212aad[_0x56e1('0x35')][_0x56e1('0x1f')]);_0x379f55[_0x56e1('0x1e')]=qs[_0x56e1('0x1e')](_0x212aad['query'][_0x56e1('0x1e')]);}_0x379f55['order']=qs[_0x56e1('0x3d')](_0x212aad['query'][_0x56e1('0x3d')]);delete _0x212aad[_0x56e1('0x35')][_0x56e1('0x3d')];_0x379f55[_0x56e1('0x3e')]=qs[_0x56e1('0x37')](_['pick'](_0x212aad[_0x56e1('0x35')],_0x26ef94[_0x56e1('0x37')]),_0x16e9eb);if(_0x212aad[_0x56e1('0x35')]['filter']){_0x379f55[_0x56e1('0x3e')]=_[_0x56e1('0x3f')](_0x379f55[_0x56e1('0x3e')],{'$or':_[_0x56e1('0x34')](_0x16e9eb,function(_0x4032f3){if(_0x4032f3[_0x56e1('0x32')]!==_0x56e1('0x40')){var _0x40f2ce={};_0x40f2ce[_0x4032f3[_0x56e1('0x2d')]]={'$like':'%'+_0x212aad[_0x56e1('0x35')][_0x56e1('0x41')]+'%'};return _0x40f2ce;}})});}_0x379f55=_['merge']({},_0x379f55,_0x212aad['options']);var _0x5536df={'where':_0x379f55[_0x56e1('0x3e')]};return db[_0x56e1('0x30')]['count'](_0x5536df)[_0x56e1('0x29')](function(_0x2a13ae){_0x52b49d[_0x56e1('0x21')]=_0x2a13ae;if(_0x212aad[_0x56e1('0x35')][_0x56e1('0x42')]){_0x379f55['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x379f55);})[_0x56e1('0x29')](function(_0x2772f3){_0x52b49d[_0x56e1('0x43')]=_0x2772f3;return _0x52b49d;})['then'](respondWithFilteredResult(_0x477e82,_0x379f55))[_0x56e1('0x44')](handleError(_0x477e82,null));};exports['show']=function(_0x25774c,_0x13568d){var _0x10bdc7={'raw':![],'where':{'id':_0x25774c['params']['id']}},_0x3b8d62={};_0x3b8d62[_0x56e1('0x33')]=_['keys'](db['VoiceMusicOnHold'][_0x56e1('0x45')]);_0x3b8d62['query']=_['keys'](_0x25774c['query']);_0x3b8d62[_0x56e1('0x37')]=_['intersection'](_0x3b8d62[_0x56e1('0x33')],_0x3b8d62[_0x56e1('0x35')]);_0x10bdc7[_0x56e1('0x38')]=_['intersection'](_0x3b8d62[_0x56e1('0x33')],qs['fields'](_0x25774c[_0x56e1('0x35')][_0x56e1('0x39')]));_0x10bdc7[_0x56e1('0x38')]=_0x10bdc7[_0x56e1('0x38')][_0x56e1('0x3a')]?_0x10bdc7[_0x56e1('0x38')]:_0x3b8d62['model'];if(_0x25774c[_0x56e1('0x35')][_0x56e1('0x42')]){_0x10bdc7[_0x56e1('0x46')]=[{'all':!![]}];}_0x10bdc7=_[_0x56e1('0x3f')]({},_0x10bdc7,_0x25774c['options']);return db[_0x56e1('0x30')][_0x56e1('0x47')](_0x10bdc7)[_0x56e1('0x29')](handleEntityNotFound(_0x13568d,null))[_0x56e1('0x29')](respondWithResult(_0x13568d,null))['catch'](handleError(_0x13568d,null));};exports['update']=function(_0x262bef,_0x1dab1){if(_0x262bef[_0x56e1('0x48')]['id']){delete _0x262bef[_0x56e1('0x48')]['id'];}return db[_0x56e1('0x30')][_0x56e1('0x47')]({'where':{'id':_0x262bef['params']['id']}})[_0x56e1('0x29')](handleEntityNotFound(_0x1dab1,null))['then'](saveUpdates(_0x262bef[_0x56e1('0x48')],null))['then'](respondWithResult(_0x1dab1,null))[_0x56e1('0x44')](handleError(_0x1dab1,null));};exports[_0x56e1('0x49')]=function(_0x383985,_0x1b4ef5,_0x3b0359){return db['sequelize']['transaction'](function(_0x3b287b){if(_0x383985[_0x56e1('0x48')][_0x56e1('0x4a')]===_0x56e1('0x4b')){_0x383985['body']['directory']=path[_0x56e1('0x4c')](config[_0x56e1('0x4d')],'server/files/moh',_0x383985[_0x56e1('0x48')][_0x56e1('0x2d')]);}return db[_0x56e1('0x30')][_0x56e1('0x49')](_0x383985[_0x56e1('0x48')],{'transaction':_0x3b287b})[_0x56e1('0x29')](function(_0x7a6fdb){if(_0x383985['body'][_0x56e1('0x4a')]===_0x56e1('0x4b')){fs[_0x56e1('0x4e')](_0x7a6fdb[_0x56e1('0x4f')],parseInt(_0x56e1('0x50'),0x8));}var _0x345dd3=_0x383985['user'][_0x56e1('0x2b')]({'plain':!![]});if(!_0x345dd3)throw new Error(_0x56e1('0x51'));if(_0x345dd3['role']===_0x56e1('0x52')){var _0x3b642c=_0x7a6fdb[_0x56e1('0x2b')]({'plain':!![]});return db[_0x56e1('0x53')][_0x56e1('0x47')]({'where':{'name':_0x56e1('0x54'),'userProfileId':_0x345dd3[_0x56e1('0x55')]},'raw':!![]})[_0x56e1('0x29')](function(_0x4a1a71){if(_0x4a1a71&&_0x4a1a71[_0x56e1('0x56')]===0x0){return db[_0x56e1('0x2c')][_0x56e1('0x49')]({'name':_0x3b642c['name'],'resourceId':_0x3b642c['id'],'type':_0x4a1a71['name'],'sectionId':_0x4a1a71['id']},{})[_0x56e1('0x29')](function(){return _0x7a6fdb;});}else{return _0x7a6fdb;}})['catch'](function(_0x6f7164){logger[_0x56e1('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6f7164);});}return _0x7a6fdb;});})[_0x56e1('0x29')](respondWithResult(_0x1b4ef5,0xc9))['catch'](handleError(_0x1b4ef5,null));};exports[_0x56e1('0x2a')]=function(_0x4f33bb,_0x39c4ee,_0x3f27ff){var _0x1a59a3;return db['VoiceMusicOnHold'][_0x56e1('0x47')]({'where':{'id':_0x4f33bb[_0x56e1('0x58')]['id']}})[_0x56e1('0x29')](function(_0x2ecff8){if(_0x2ecff8){return db[_0x56e1('0x59')][_0x56e1('0x5a')](function(_0x10917e){return _0x2ecff8[_0x56e1('0x2a')]({'transaction':_0x10917e,'raw':!![]})[_0x56e1('0x29')](function(_0x19c095){if(_0x19c095[_0x56e1('0x4f')]){fs[_0x56e1('0x5b')](_0x19c095[_0x56e1('0x4f')])[_0x56e1('0x5c')](function(_0x8128e1){fs[_0x56e1('0x5d')](path[_0x56e1('0x4c')](_0x19c095[_0x56e1('0x4f')],_0x8128e1));});fs[_0x56e1('0x5e')](_0x19c095[_0x56e1('0x4f')]);}return _0x19c095;});})['catch'](function(_0x5a27b2){throw new db['Sequelize'][(_0x56e1('0x5f'))](_0x5a27b2[_0x56e1('0x60')]);});}})[_0x56e1('0x29')](handleEntityNotFound(_0x39c4ee,null))[_0x56e1('0x29')](removeEntity(_0x39c4ee,null))[_0x56e1('0x44')](handleError(_0x39c4ee,null));};exports[_0x56e1('0x61')]=function(_0x539fbb,_0x2c2e71,_0x6f8669){return db['sequelize'][_0x56e1('0x5a')](function(_0x5c0176){var _0x58e213;return db['VoiceMusicOnHold'][_0x56e1('0x47')]({'where':{'id':_0x539fbb[_0x56e1('0x58')]['id']}})[_0x56e1('0x29')](function(_0x1dfdfc){if(_0x1dfdfc){_0x58e213=_0x1dfdfc;return _0x1dfdfc[_0x56e1('0x61')](_0x539fbb[_0x56e1('0x48')]['id'],{'transaction':_0x5c0176});}})[_0x56e1('0x29')](function(_0x4da14b){if(_0x4da14b){return db[_0x56e1('0x62')][_0x56e1('0x63')]({'where':{'id':_0x539fbb[_0x56e1('0x48')]['id']},'attributes':['id','name','save_name',_0x56e1('0x64'),'createdAt'],'raw':!![]});}})[_0x56e1('0x29')](function(_0x80e30e){if(_0x80e30e){var _0x5052d0=path[_0x56e1('0x4c')](config['root'],_0x56e1('0x65'),util['format'](_0x56e1('0x66'),path[_0x56e1('0x67')](_0x80e30e[_0x56e1('0x68')],path['extname'](_0x80e30e[_0x56e1('0x68')])),_0x80e30e[_0x56e1('0x64')]));var _0x47f06f=path[_0x56e1('0x4c')](config[_0x56e1('0x4d')],_0x56e1('0x69'),_0x58e213[_0x56e1('0x2d')],util[_0x56e1('0x6a')](_0x56e1('0x66'),_0x80e30e[_0x56e1('0x2d')],_0x80e30e['converted_format']));fs['symlinkSync'](_0x5052d0,_0x47f06f);return _0x80e30e;}})['catch'](function(_0x452b3b){throw new db[(_0x56e1('0x6b'))]['ValidationError'](_0x452b3b[_0x56e1('0x60')]);});})[_0x56e1('0x29')](handleEntityNotFound(_0x2c2e71,null))[_0x56e1('0x29')](respondWithResult(_0x2c2e71,0xc9))[_0x56e1('0x44')](handleError(_0x2c2e71,null));};exports[_0x56e1('0x6c')]=function(_0x349871,_0x43fad1,_0x1a08e9){return db[_0x56e1('0x59')]['transaction'](function(_0x17ac45){var _0x43b522;return db[_0x56e1('0x30')][_0x56e1('0x63')]({'where':{'id':_0x349871[_0x56e1('0x58')]['id']}})[_0x56e1('0x29')](handleEntityNotFound(_0x43fad1,null))['then'](function(_0x2cdbf2){if(_0x2cdbf2){_0x43b522=_0x2cdbf2;return _0x2cdbf2[_0x56e1('0x6c')](_0x349871[_0x56e1('0x58')][_0x56e1('0x6d')]);}})[_0x56e1('0x29')](function(_0x1ad313){if(_0x1ad313){return db['Sound'][_0x56e1('0x63')]({'where':{'id':_0x349871[_0x56e1('0x58')][_0x56e1('0x6d')]},'attributes':['id','name',_0x56e1('0x68'),_0x56e1('0x64'),_0x56e1('0x6e')],'raw':!![]});}})['then'](function(_0x143652){if(_0x143652){fs[_0x56e1('0x5d')](path[_0x56e1('0x4c')](_0x43b522['directory'],util['format'](_0x56e1('0x66'),_0x143652[_0x56e1('0x2d')],_0x143652[_0x56e1('0x64')])));return _0x143652;}})[_0x56e1('0x44')](function(_0x3adbcd){throw new db[(_0x56e1('0x6b'))][(_0x56e1('0x5f'))](_0x3adbcd['message']);});})[_0x56e1('0x29')](handleEntityNotFound(_0x43fad1,null))[_0x56e1('0x29')](respondWithStatusCode(_0x43fad1,0xcc))[_0x56e1('0x44')](handleError(_0x43fad1,null));};exports[_0x56e1('0x6f')]=function(_0x5ce288,_0x463d91,_0x4c7661){var _0x1f831d={};var _0x23ad6={};var _0x4616e7;var _0x228369;return db[_0x56e1('0x30')][_0x56e1('0x63')]({'where':{'id':_0x5ce288[_0x56e1('0x58')]['id']}})[_0x56e1('0x29')](handleEntityNotFound(_0x463d91,null))[_0x56e1('0x29')](function(_0x4616e4){if(_0x4616e4){_0x4616e7=_0x4616e4;_0x23ad6['model']=_[_0x56e1('0x36')](db['Sound']['rawAttributes']);_0x23ad6['query']=_[_0x56e1('0x36')](_0x5ce288['query']);_0x23ad6[_0x56e1('0x37')]=_[_0x56e1('0x70')](_0x23ad6[_0x56e1('0x33')],_0x23ad6[_0x56e1('0x35')]);_0x1f831d['attributes']=_[_0x56e1('0x70')](_0x23ad6['model'],qs[_0x56e1('0x39')](_0x5ce288[_0x56e1('0x35')][_0x56e1('0x39')]));_0x1f831d[_0x56e1('0x38')]=_0x1f831d[_0x56e1('0x38')][_0x56e1('0x3a')]?_0x1f831d[_0x56e1('0x38')]:_0x23ad6['model'];_0x1f831d[_0x56e1('0x71')]=qs[_0x56e1('0x3d')](_0x5ce288[_0x56e1('0x35')]['sort']);_0x1f831d[_0x56e1('0x3e')]=qs[_0x56e1('0x37')](_[_0x56e1('0x72')](_0x5ce288[_0x56e1('0x35')],_0x23ad6[_0x56e1('0x37')]));if(_0x5ce288[_0x56e1('0x35')]['filter']){_0x1f831d['where']=_['merge'](_0x1f831d[_0x56e1('0x3e')],{'$or':_[_0x56e1('0x34')](_0x1f831d[_0x56e1('0x38')],function(_0x349348){var _0x378c06={};_0x378c06[_0x349348]={'$like':'%'+_0x5ce288[_0x56e1('0x35')][_0x56e1('0x41')]+'%'};return _0x378c06;})});}_0x1f831d=_[_0x56e1('0x3f')]({},_0x1f831d,_0x5ce288[_0x56e1('0x73')]);return _0x4616e7[_0x56e1('0x6f')](_0x1f831d);}})[_0x56e1('0x29')](function(_0x51c8f2){if(_0x51c8f2){_0x228369=_0x51c8f2[_0x56e1('0x3a')];if(!_0x5ce288['query'][_0x56e1('0x3b')]('nolimit')){_0x1f831d[_0x56e1('0x1f')]=qs[_0x56e1('0x1f')](_0x5ce288[_0x56e1('0x35')]['limit']);_0x1f831d[_0x56e1('0x1e')]=qs[_0x56e1('0x1e')](_0x5ce288[_0x56e1('0x35')][_0x56e1('0x1e')]);}return _0x4616e7[_0x56e1('0x6f')](_0x1f831d);}})[_0x56e1('0x29')](function(_0x388821){if(_0x388821){return _0x388821?{'count':_0x228369,'rows':_0x388821}:null;}})[_0x56e1('0x29')](respondWithResult(_0x463d91,null))['catch'](handleError(_0x463d91,null));}; \ No newline at end of file +var _0xb945=['zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','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','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','map','VoiceMusicOnHold','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','body','params','create','sequelize','transaction','mode','join','root','files','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','createdAt','server/files/sounds/converted','%s.%s','basename','extname','save_name','converted_format','server/files/moh','format','symlinkSync','message','removeSound','id2','getSounds','filter','nolimit','eml-format','rimraf'];(function(_0x12f961,_0x424c9c){var _0x38be51=function(_0x5aaee6){while(--_0x5aaee6){_0x12f961['push'](_0x12f961['shift']());}};_0x38be51(++_0x424c9c);}(_0xb945,0x163));var _0x5b94=function(_0x4ef6f3,_0xac58f1){_0x4ef6f3=_0x4ef6f3-0x0;var _0x82f917=_0xb945[_0x4ef6f3];return _0x82f917;};'use strict';var emlformat=require(_0x5b94('0x0'));var rimraf=require(_0x5b94('0x1'));var zipdir=require(_0x5b94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b94('0x3'));var moment=require(_0x5b94('0x4'));var BPromise=require(_0x5b94('0x5'));var Mustache=require('mustache');var util=require(_0x5b94('0x6'));var path=require('path');var sox=require(_0x5b94('0x7'));var csv=require(_0x5b94('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b94('0x9'));var _=require(_0x5b94('0xa'));var squel=require(_0x5b94('0xb'));var crypto=require(_0x5b94('0xc'));var jsforce=require(_0x5b94('0xd'));var deskjs=require(_0x5b94('0xe'));var toCsv=require(_0x5b94('0x8'));var querystring=require(_0x5b94('0xf'));var Papa=require(_0x5b94('0x10'));var Redis=require(_0x5b94('0x11'));var authService=require(_0x5b94('0x12'));var qs=require(_0x5b94('0x13'));var as=require(_0x5b94('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b94('0x15'))('api');var utils=require(_0x5b94('0x16'));var config=require(_0x5b94('0x17'));var licenseUtil=require(_0x5b94('0x18'));var db=require(_0x5b94('0x19'))['db'];function respondWithStatusCode(_0xefc2a9,_0x23da02){_0x23da02=_0x23da02||0xcc;return function(_0x5760ec){if(_0x5760ec){return _0xefc2a9[_0x5b94('0x1a')](_0x23da02);}return _0xefc2a9[_0x5b94('0x1b')](_0x23da02)[_0x5b94('0x1c')]();};}function respondWithResult(_0x34e291,_0x4dfcff){_0x4dfcff=_0x4dfcff||0xc8;return function(_0x2b4818){if(_0x2b4818){return _0x34e291[_0x5b94('0x1b')](_0x4dfcff)[_0x5b94('0x1d')](_0x2b4818);}};}function respondWithFilteredResult(_0x27e675,_0x3acace){return function(_0x48588a){if(_0x48588a){var _0x109418=typeof _0x3acace[_0x5b94('0x1e')]===_0x5b94('0x1f')&&typeof _0x3acace[_0x5b94('0x20')]===_0x5b94('0x1f');var _0x212dd6=_0x48588a['count'];var _0x715681=_0x109418?0x0:_0x3acace['offset'];var _0x244cf6=_0x109418?_0x48588a['count']:_0x3acace[_0x5b94('0x1e')]+_0x3acace['limit'];var _0x447f1b;if(_0x244cf6>=_0x212dd6){_0x244cf6=_0x212dd6;_0x447f1b=0xc8;}else{_0x447f1b=0xce;}_0x27e675[_0x5b94('0x1b')](_0x447f1b);return _0x27e675[_0x5b94('0x21')](_0x5b94('0x22'),_0x715681+'-'+_0x244cf6+'/'+_0x212dd6)[_0x5b94('0x1d')](_0x48588a);}return null;};}function patchUpdates(_0x4c4745){return function(_0x509ea6){try{jsonpatch[_0x5b94('0x23')](_0x509ea6,_0x4c4745,!![]);}catch(_0x5ea41b){return BPromise[_0x5b94('0x24')](_0x5ea41b);}return _0x509ea6[_0x5b94('0x25')]();};}function saveUpdates(_0x2d431f,_0xdcf076){return function(_0x2ce0c1){if(_0x2ce0c1){return _0x2ce0c1[_0x5b94('0x26')](_0x2d431f)[_0x5b94('0x27')](function(_0x2a4fb7){return _0x2a4fb7;});}return null;};}function removeEntity(_0x3cc7ab,_0x17e697){return function(_0x36bc5a){if(_0x36bc5a){return _0x36bc5a[_0x5b94('0x28')]()[_0x5b94('0x27')](function(){var _0x2a6f0c=_0x36bc5a[_0x5b94('0x29')]({'plain':!![]});var _0x2c58d4=_0x5b94('0x2a');return db[_0x5b94('0x2b')][_0x5b94('0x28')]({'where':{'type':_0x2c58d4,'resourceId':_0x2a6f0c['id']}})[_0x5b94('0x27')](function(){return _0x36bc5a;});})[_0x5b94('0x27')](function(){_0x3cc7ab[_0x5b94('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e34ef,_0x1223b7){return function(_0x47885c){if(!_0x47885c){_0x5e34ef[_0x5b94('0x1a')](0x194);}return _0x47885c;};}function handleError(_0x180912,_0x5bd9b5){_0x5bd9b5=_0x5bd9b5||0x1f4;return function(_0x76602){logger['error'](_0x76602[_0x5b94('0x2c')]);if(_0x76602['name']){delete _0x76602[_0x5b94('0x2d')];}_0x180912['status'](_0x5bd9b5)[_0x5b94('0x2e')](_0x76602);};}exports['index']=function(_0x2b2150,_0x20fd47){var _0x5cd493={},_0x54dff6={},_0x1cf0f7={'count':0x0,'rows':[]};var _0x4b31f2=_[_0x5b94('0x2f')](db[_0x5b94('0x30')][_0x5b94('0x31')],function(_0x29486e){return{'name':_0x29486e['fieldName'],'type':_0x29486e[_0x5b94('0x32')][_0x5b94('0x33')]};});_0x54dff6['model']=_[_0x5b94('0x2f')](_0x4b31f2,_0x5b94('0x2d'));_0x54dff6['query']=_[_0x5b94('0x34')](_0x2b2150[_0x5b94('0x35')]);_0x54dff6[_0x5b94('0x36')]=_[_0x5b94('0x37')](_0x54dff6[_0x5b94('0x38')],_0x54dff6['query']);_0x5cd493[_0x5b94('0x39')]=_[_0x5b94('0x37')](_0x54dff6['model'],qs[_0x5b94('0x3a')](_0x2b2150[_0x5b94('0x35')]['fields']));_0x5cd493['attributes']=_0x5cd493['attributes'][_0x5b94('0x3b')]?_0x5cd493[_0x5b94('0x39')]:_0x54dff6['model'];if(!_0x2b2150[_0x5b94('0x35')][_0x5b94('0x3c')]('nolimit')){_0x5cd493[_0x5b94('0x20')]=qs[_0x5b94('0x20')](_0x2b2150['query'][_0x5b94('0x20')]);_0x5cd493[_0x5b94('0x1e')]=qs[_0x5b94('0x1e')](_0x2b2150[_0x5b94('0x35')][_0x5b94('0x1e')]);}_0x5cd493[_0x5b94('0x3d')]=qs['sort'](_0x2b2150[_0x5b94('0x35')][_0x5b94('0x3e')]);delete _0x2b2150[_0x5b94('0x35')][_0x5b94('0x3e')];_0x5cd493[_0x5b94('0x3f')]=qs[_0x5b94('0x36')](_[_0x5b94('0x40')](_0x2b2150[_0x5b94('0x35')],_0x54dff6[_0x5b94('0x36')]),_0x4b31f2);if(_0x2b2150['query']['filter']){_0x5cd493[_0x5b94('0x3f')]=_[_0x5b94('0x41')](_0x5cd493[_0x5b94('0x3f')],{'$or':_[_0x5b94('0x2f')](_0x4b31f2,function(_0x281125){if(_0x281125[_0x5b94('0x32')]!==_0x5b94('0x42')){var _0x494adc={};_0x494adc[_0x281125[_0x5b94('0x2d')]]={'$like':'%'+_0x2b2150['query']['filter']+'%'};return _0x494adc;}})});}_0x5cd493=_[_0x5b94('0x41')]({},_0x5cd493,_0x2b2150[_0x5b94('0x43')]);var _0x4ac473={'where':_0x5cd493[_0x5b94('0x3f')]};return db[_0x5b94('0x30')][_0x5b94('0x44')](_0x4ac473)[_0x5b94('0x27')](function(_0xeeaa9a){_0x1cf0f7[_0x5b94('0x44')]=_0xeeaa9a;if(_0x2b2150[_0x5b94('0x35')][_0x5b94('0x45')]){_0x5cd493[_0x5b94('0x46')]=[{'all':!![]}];}return db[_0x5b94('0x30')][_0x5b94('0x47')](_0x5cd493);})['then'](function(_0x3cabc0){_0x1cf0f7[_0x5b94('0x48')]=_0x3cabc0;return _0x1cf0f7;})[_0x5b94('0x27')](respondWithFilteredResult(_0x20fd47,_0x5cd493))[_0x5b94('0x49')](handleError(_0x20fd47,null));};exports[_0x5b94('0x4a')]=function(_0x1a1120,_0x545d88){var _0x513430={'raw':![],'where':{'id':_0x1a1120['params']['id']}},_0x371265={};_0x371265['model']=_[_0x5b94('0x34')](db[_0x5b94('0x30')][_0x5b94('0x31')]);_0x371265[_0x5b94('0x35')]=_[_0x5b94('0x34')](_0x1a1120[_0x5b94('0x35')]);_0x371265['filters']=_[_0x5b94('0x37')](_0x371265[_0x5b94('0x38')],_0x371265[_0x5b94('0x35')]);_0x513430[_0x5b94('0x39')]=_[_0x5b94('0x37')](_0x371265[_0x5b94('0x38')],qs[_0x5b94('0x3a')](_0x1a1120[_0x5b94('0x35')][_0x5b94('0x3a')]));_0x513430[_0x5b94('0x39')]=_0x513430[_0x5b94('0x39')][_0x5b94('0x3b')]?_0x513430[_0x5b94('0x39')]:_0x371265[_0x5b94('0x38')];if(_0x1a1120[_0x5b94('0x35')][_0x5b94('0x45')]){_0x513430[_0x5b94('0x46')]=[{'all':!![]}];}_0x513430=_[_0x5b94('0x41')]({},_0x513430,_0x1a1120[_0x5b94('0x43')]);return db['VoiceMusicOnHold'][_0x5b94('0x4b')](_0x513430)[_0x5b94('0x27')](handleEntityNotFound(_0x545d88,null))['then'](respondWithResult(_0x545d88,null))[_0x5b94('0x49')](handleError(_0x545d88,null));};exports['update']=function(_0x26ac44,_0x5a63f7){if(_0x26ac44['body']['id']){delete _0x26ac44[_0x5b94('0x4c')]['id'];}return db[_0x5b94('0x30')][_0x5b94('0x4b')]({'where':{'id':_0x26ac44[_0x5b94('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5a63f7,null))[_0x5b94('0x27')](saveUpdates(_0x26ac44[_0x5b94('0x4c')],null))['then'](respondWithResult(_0x5a63f7,null))['catch'](handleError(_0x5a63f7,null));};exports[_0x5b94('0x4e')]=function(_0x2730a6,_0x2d009e,_0x1b7434){return db[_0x5b94('0x4f')][_0x5b94('0x50')](function(_0x299bbf){if(_0x2730a6[_0x5b94('0x4c')][_0x5b94('0x51')]==='files'){_0x2730a6[_0x5b94('0x4c')]['directory']=path[_0x5b94('0x52')](config[_0x5b94('0x53')],'server/files/moh',_0x2730a6['body'][_0x5b94('0x2d')]);}return db[_0x5b94('0x30')][_0x5b94('0x4e')](_0x2730a6['body'],{'transaction':_0x299bbf})[_0x5b94('0x27')](function(_0x5f3d56){if(_0x2730a6[_0x5b94('0x4c')][_0x5b94('0x51')]===_0x5b94('0x54')){fs['mkdirSync'](_0x5f3d56[_0x5b94('0x55')],parseInt(_0x5b94('0x56'),0x8));}var _0x3b9d99=_0x2730a6[_0x5b94('0x57')][_0x5b94('0x29')]({'plain':!![]});if(!_0x3b9d99)throw new Error(_0x5b94('0x58'));if(_0x3b9d99[_0x5b94('0x59')]===_0x5b94('0x57')){var _0x339971=_0x5f3d56['get']({'plain':!![]});return db['UserProfileSection'][_0x5b94('0x4b')]({'where':{'name':_0x5b94('0x2a'),'userProfileId':_0x3b9d99[_0x5b94('0x5a')]},'raw':!![]})[_0x5b94('0x27')](function(_0x38c088){if(_0x38c088&&_0x38c088[_0x5b94('0x5b')]===0x0){return db[_0x5b94('0x2b')][_0x5b94('0x4e')]({'name':_0x339971['name'],'resourceId':_0x339971['id'],'type':_0x38c088['name'],'sectionId':_0x38c088['id']},{})['then'](function(){return _0x5f3d56;});}else{return _0x5f3d56;}})[_0x5b94('0x49')](function(_0x44df17){logger[_0x5b94('0x5c')](_0x5b94('0x5d'),_0x44df17);});}return _0x5f3d56;});})['then'](respondWithResult(_0x2d009e,0xc9))[_0x5b94('0x49')](handleError(_0x2d009e,null));};exports[_0x5b94('0x28')]=function(_0x1c0fb2,_0x415bca,_0x41c753){var _0x52f34a;return db[_0x5b94('0x30')][_0x5b94('0x4b')]({'where':{'id':_0x1c0fb2[_0x5b94('0x4d')]['id']}})[_0x5b94('0x27')](function(_0x2ceefe){if(_0x2ceefe){return db['sequelize'][_0x5b94('0x50')](function(_0x30bb91){return _0x2ceefe['destroy']({'transaction':_0x30bb91,'raw':!![]})[_0x5b94('0x27')](function(_0x454f1d){if(_0x454f1d[_0x5b94('0x55')]){fs[_0x5b94('0x5e')](_0x454f1d[_0x5b94('0x55')])[_0x5b94('0x5f')](function(_0x110852){fs[_0x5b94('0x60')](path[_0x5b94('0x52')](_0x454f1d[_0x5b94('0x55')],_0x110852));});fs[_0x5b94('0x61')](_0x454f1d['directory']);}return _0x454f1d;});})[_0x5b94('0x49')](function(_0x188cd3){throw new db[(_0x5b94('0x62'))][(_0x5b94('0x63'))](_0x188cd3['message']);});}})['then'](handleEntityNotFound(_0x415bca,null))[_0x5b94('0x27')](removeEntity(_0x415bca,null))['catch'](handleError(_0x415bca,null));};exports[_0x5b94('0x64')]=function(_0x131879,_0x590a2e,_0x13866f){return db[_0x5b94('0x4f')][_0x5b94('0x50')](function(_0x82b7e2){var _0x2d0c23;return db['VoiceMusicOnHold'][_0x5b94('0x4b')]({'where':{'id':_0x131879[_0x5b94('0x4d')]['id']}})[_0x5b94('0x27')](function(_0x54a498){if(_0x54a498){_0x2d0c23=_0x54a498;return _0x54a498[_0x5b94('0x64')](_0x131879[_0x5b94('0x4c')]['id'],{'transaction':_0x82b7e2});}})[_0x5b94('0x27')](function(_0x5d7abe){if(_0x5d7abe){return db[_0x5b94('0x65')][_0x5b94('0x66')]({'where':{'id':_0x131879[_0x5b94('0x4c')]['id']},'attributes':['id','name','save_name','converted_format',_0x5b94('0x67')],'raw':!![]});}})[_0x5b94('0x27')](function(_0x478ba1){if(_0x478ba1){var _0x6e1083=path['join'](config['root'],_0x5b94('0x68'),util['format'](_0x5b94('0x69'),path[_0x5b94('0x6a')](_0x478ba1['save_name'],path[_0x5b94('0x6b')](_0x478ba1[_0x5b94('0x6c')])),_0x478ba1[_0x5b94('0x6d')]));var _0x831255=path[_0x5b94('0x52')](config['root'],_0x5b94('0x6e'),_0x2d0c23[_0x5b94('0x2d')],util[_0x5b94('0x6f')](_0x5b94('0x69'),_0x478ba1[_0x5b94('0x2d')],_0x478ba1[_0x5b94('0x6d')]));fs[_0x5b94('0x70')](_0x6e1083,_0x831255);return _0x478ba1;}})['catch'](function(_0x15f29e){throw new db[(_0x5b94('0x62'))]['ValidationError'](_0x15f29e[_0x5b94('0x71')]);});})[_0x5b94('0x27')](handleEntityNotFound(_0x590a2e,null))['then'](respondWithResult(_0x590a2e,0xc9))['catch'](handleError(_0x590a2e,null));};exports[_0x5b94('0x72')]=function(_0x14dd9d,_0x36a7f5,_0x10f594){return db[_0x5b94('0x4f')][_0x5b94('0x50')](function(_0x1129b8){var _0x125071;return db[_0x5b94('0x30')][_0x5b94('0x66')]({'where':{'id':_0x14dd9d[_0x5b94('0x4d')]['id']}})[_0x5b94('0x27')](handleEntityNotFound(_0x36a7f5,null))[_0x5b94('0x27')](function(_0x23b579){if(_0x23b579){_0x125071=_0x23b579;return _0x23b579[_0x5b94('0x72')](_0x14dd9d[_0x5b94('0x4d')][_0x5b94('0x73')]);}})[_0x5b94('0x27')](function(_0x20b9a6){if(_0x20b9a6){return db['Sound'][_0x5b94('0x66')]({'where':{'id':_0x14dd9d[_0x5b94('0x4d')][_0x5b94('0x73')]},'attributes':['id',_0x5b94('0x2d'),_0x5b94('0x6c'),_0x5b94('0x6d'),_0x5b94('0x67')],'raw':!![]});}})['then'](function(_0xa95dc){if(_0xa95dc){fs[_0x5b94('0x60')](path[_0x5b94('0x52')](_0x125071[_0x5b94('0x55')],util['format']('%s.%s',_0xa95dc['name'],_0xa95dc['converted_format'])));return _0xa95dc;}})['catch'](function(_0x3dcb10){throw new db[(_0x5b94('0x62'))][(_0x5b94('0x63'))](_0x3dcb10[_0x5b94('0x71')]);});})[_0x5b94('0x27')](handleEntityNotFound(_0x36a7f5,null))['then'](respondWithStatusCode(_0x36a7f5,0xcc))['catch'](handleError(_0x36a7f5,null));};exports[_0x5b94('0x74')]=function(_0x2229e7,_0x129d01,_0x19ef4f){var _0x1009ee={};var _0xa7fe61={};var _0x4d4f2a;var _0x111a36;return db['VoiceMusicOnHold'][_0x5b94('0x66')]({'where':{'id':_0x2229e7[_0x5b94('0x4d')]['id']}})[_0x5b94('0x27')](handleEntityNotFound(_0x129d01,null))[_0x5b94('0x27')](function(_0x19fb03){if(_0x19fb03){_0x4d4f2a=_0x19fb03;_0xa7fe61[_0x5b94('0x38')]=_['keys'](db[_0x5b94('0x65')]['rawAttributes']);_0xa7fe61['query']=_[_0x5b94('0x34')](_0x2229e7[_0x5b94('0x35')]);_0xa7fe61[_0x5b94('0x36')]=_[_0x5b94('0x37')](_0xa7fe61['model'],_0xa7fe61[_0x5b94('0x35')]);_0x1009ee[_0x5b94('0x39')]=_['intersection'](_0xa7fe61[_0x5b94('0x38')],qs[_0x5b94('0x3a')](_0x2229e7[_0x5b94('0x35')][_0x5b94('0x3a')]));_0x1009ee[_0x5b94('0x39')]=_0x1009ee[_0x5b94('0x39')][_0x5b94('0x3b')]?_0x1009ee['attributes']:_0xa7fe61['model'];_0x1009ee[_0x5b94('0x3d')]=qs[_0x5b94('0x3e')](_0x2229e7[_0x5b94('0x35')][_0x5b94('0x3e')]);_0x1009ee['where']=qs[_0x5b94('0x36')](_[_0x5b94('0x40')](_0x2229e7['query'],_0xa7fe61[_0x5b94('0x36')]));if(_0x2229e7['query'][_0x5b94('0x75')]){_0x1009ee[_0x5b94('0x3f')]=_[_0x5b94('0x41')](_0x1009ee[_0x5b94('0x3f')],{'$or':_[_0x5b94('0x2f')](_0x1009ee[_0x5b94('0x39')],function(_0x5d6869){var _0x11716f={};_0x11716f[_0x5d6869]={'$like':'%'+_0x2229e7[_0x5b94('0x35')]['filter']+'%'};return _0x11716f;})});}_0x1009ee=_[_0x5b94('0x41')]({},_0x1009ee,_0x2229e7[_0x5b94('0x43')]);return _0x4d4f2a['getSounds'](_0x1009ee);}})[_0x5b94('0x27')](function(_0x395a36){if(_0x395a36){_0x111a36=_0x395a36[_0x5b94('0x3b')];if(!_0x2229e7[_0x5b94('0x35')][_0x5b94('0x3c')](_0x5b94('0x76'))){_0x1009ee['limit']=qs[_0x5b94('0x20')](_0x2229e7[_0x5b94('0x35')][_0x5b94('0x20')]);_0x1009ee[_0x5b94('0x1e')]=qs[_0x5b94('0x1e')](_0x2229e7[_0x5b94('0x35')][_0x5b94('0x1e')]);}return _0x4d4f2a['getSounds'](_0x1009ee);}})[_0x5b94('0x27')](function(_0x123a8a){if(_0x123a8a){return _0x123a8a?{'count':_0x111a36,'rows':_0x123a8a}:null;}})[_0x5b94('0x27')](respondWithResult(_0x129d01,null))[_0x5b94('0x49')](handleError(_0x129d01,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c36f51d..8b3d936 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 _0xf977=['../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash'];(function(_0x4097e3,_0xfdd24f){var _0x55f4b5=function(_0x345d66){while(--_0x345d66){_0x4097e3['push'](_0x4097e3['shift']());}};_0x55f4b5(++_0xfdd24f);}(_0xf977,0x99));var _0x7f97=function(_0x472836,_0x473324){_0x472836=_0x472836-0x0;var _0x54f064=_0xf977[_0x472836];return _0x54f064;};'use strict';var _=require(_0x7f97('0x0'));var util=require('util');var logger=require(_0x7f97('0x1'))(_0x7f97('0x2'));var moment=require(_0x7f97('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f97('0x4'));var fs=require('fs');var path=require(_0x7f97('0x5'));var rimraf=require('rimraf');var config=require(_0x7f97('0x6'));var attributes=require(_0x7f97('0x7'));module[_0x7f97('0x8')]=function(_0x25957b,_0x6f27ce){return _0x25957b[_0x7f97('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x7f97('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e7e=['path','rimraf','exports','define','voice_musiconhold','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x545433,_0xe238b6){var _0x1d7243=function(_0x8261fd){while(--_0x8261fd){_0x545433['push'](_0x545433['shift']());}};_0x1d7243(++_0xe238b6);}(_0x7e7e,0x91));var _0xe7e7=function(_0x54dbdc,_0x1cbf47){_0x54dbdc=_0x54dbdc-0x0;var _0x1f0b03=_0x7e7e[_0x54dbdc];return _0x1f0b03;};'use strict';var _=require('lodash');var util=require(_0xe7e7('0x0'));var logger=require(_0xe7e7('0x1'))('api');var moment=require(_0xe7e7('0x2'));var BPromise=require(_0xe7e7('0x3'));var rp=require(_0xe7e7('0x4'));var fs=require('fs');var path=require(_0xe7e7('0x5'));var rimraf=require(_0xe7e7('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0xe7e7('0x7')]=function(_0x5a6c6a,_0x2f10c5){return _0x5a6c6a[_0xe7e7('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0xe7e7('0x9'),'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 e531f8e..9f4efea 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x48814a,_0x15c6af){var _0x471191=function(_0x158e3a){while(--_0x158e3a){_0x48814a['push'](_0x48814a['shift']());}};_0x471191(++_0x15c6af);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xcb91[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x364144,_0x166865){var _0x4ba629=function(_0xab154b){while(--_0xab154b){_0x364144['push'](_0x364144['shift']());}};_0x4ba629(++_0x166865);}(_0xe706,0xa3));var _0x6e70=function(_0x51dbba,_0x817f0d){_0x51dbba=_0x51dbba-0x0;var _0x34906d=_0xe706[_0x51dbba];return _0x34906d;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 12d74b9..bf02a16 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 _0x7dfd=['/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xb')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['describe']);router[_0xd7df('0xb')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x10')]);router['get'](_0xd7df('0x11'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);router['get'](_0xd7df('0x13'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x14')]);router[_0xd7df('0x15')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0x16')]);router[_0xd7df('0x15')](_0xd7df('0x11'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x17')]);router[_0xd7df('0x15')](_0xd7df('0x13'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x18')]);router[_0xd7df('0x19')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller['update']);router[_0xd7df('0x1a')](_0xd7df('0xf'),auth['isAuthenticated'](),controller[_0xd7df('0x1b')]);router[_0xd7df('0x1a')]('/:id/users',auth[_0xd7df('0xc')](),controller[_0xd7df('0x1c')]);router[_0xd7df('0x1a')]('/:id/teams',auth[_0xd7df('0xc')](),controller[_0xd7df('0x1d')]);module[_0xd7df('0x1e')]=router; \ No newline at end of file +var _0xb6a6=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/teams','getTeams','post','create','addAgents','put','/:id','update','delete','destroy','removeTeams','exports','util'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0xb6a6,0x1ed));var _0x6b6a=function(_0x331ff1,_0x31eb1a){_0x331ff1=_0x331ff1-0x0;var _0x4b79b3=_0xb6a6[_0x331ff1];return _0x4b79b3;};'use strict';var multer=require('multer');var util=require(_0x6b6a('0x0'));var path=require(_0x6b6a('0x1'));var timeout=require(_0x6b6a('0x2'));var express=require(_0x6b6a('0x3'));var router=express['Router']();var fs_extra=require(_0x6b6a('0x4'));var auth=require(_0x6b6a('0x5'));var interaction=require(_0x6b6a('0x6'));var config=require(_0x6b6a('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x6b6a('0x8')](),controller[_0x6b6a('0x9')]);router[_0x6b6a('0xa')](_0x6b6a('0xb'),auth[_0x6b6a('0x8')](),controller[_0x6b6a('0xc')]);router['get']('/:id',auth[_0x6b6a('0x8')](),controller[_0x6b6a('0xd')]);router[_0x6b6a('0xa')]('/:id/users',auth[_0x6b6a('0x8')](),controller['getAgents']);router[_0x6b6a('0xa')](_0x6b6a('0xe'),auth[_0x6b6a('0x8')](),controller[_0x6b6a('0xf')]);router[_0x6b6a('0x10')]('/',auth[_0x6b6a('0x8')](),controller[_0x6b6a('0x11')]);router[_0x6b6a('0x10')]('/:id/users',auth[_0x6b6a('0x8')](),controller[_0x6b6a('0x12')]);router[_0x6b6a('0x10')](_0x6b6a('0xe'),auth[_0x6b6a('0x8')](),controller['addTeams']);router[_0x6b6a('0x13')](_0x6b6a('0x14'),auth['isAuthenticated'](),controller[_0x6b6a('0x15')]);router[_0x6b6a('0x16')](_0x6b6a('0x14'),auth[_0x6b6a('0x8')](),controller[_0x6b6a('0x17')]);router[_0x6b6a('0x16')]('/:id/users',auth[_0x6b6a('0x8')](),controller['removeAgents']);router[_0x6b6a('0x16')](_0x6b6a('0xe'),auth[_0x6b6a('0x8')](),controller[_0x6b6a('0x18')]);module[_0x6b6a('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 8538354..c7671ef 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 _0xd05a=['exports','STRING','name','VIRTUAL','system-'];(function(_0x20714a,_0x7de591){var _0x15e877=function(_0x3f9f8d){while(--_0x3f9f8d){_0x20714a['push'](_0x20714a['shift']());}};_0x15e877(++_0x7de591);}(_0xd05a,0x14f));var _0xad05=function(_0x15a0e2,_0x1e8fdf){_0x15a0e2=_0x15a0e2-0x0;var _0x11c2a5=_0xd05a[_0x15a0e2];return _0x11c2a5;};'use strict';var Sequelize=require('sequelize');module[_0xad05('0x0')]={'name':{'type':Sequelize[_0xad05('0x1')],'allowNull':![],'unique':_0xad05('0x2')},'prefix':{'type':Sequelize[_0xad05('0x3')],'get':function(_0x51773b){return _0xad05('0x4')+this['getDataValue'](_0xad05('0x2'))+'-';}},'description':{'type':Sequelize[_0xad05('0x1')]},'callerIdAll':{'type':Sequelize[_0xad05('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x226e=['exports','name','system-','getDataValue','STRING','INTEGER','sequelize'];(function(_0x1b7eb0,_0x4d7835){var _0x56918f=function(_0x17313e){while(--_0x17313e){_0x1b7eb0['push'](_0x1b7eb0['shift']());}};_0x56918f(++_0x4d7835);}(_0x226e,0x11e));var _0xe226=function(_0x5fb695,_0x464037){_0x5fb695=_0x5fb695-0x0;var _0x4d93fa=_0x226e[_0x5fb695];return _0x4d93fa;};'use strict';var Sequelize=require(_0xe226('0x0'));module[_0xe226('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe226('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x15912b){return _0xe226('0x3')+this[_0xe226('0x4')](_0xe226('0x2'))+'-';}},'description':{'type':Sequelize[_0xe226('0x5')]},'callerIdAll':{'type':Sequelize[_0xe226('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0xe226('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 270763a..3852bc0 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 _0x6cb4=['map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','filters','filter','where','merge','VoicePrefix','catch','show','params','include','find','describe','sequelize','transaction','create','VoiceExtensionId','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','body','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','sort','pick','hasOwnProperty','getTeams','Team','options','addTeams','findAll','Agents','online','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','select','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','union','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','VoicePrefixes','UserProfileResource','stack','name','send','index'];(function(_0x94939d,_0x57bc08){var _0x377255=function(_0x21bd9f){while(--_0x21bd9f){_0x94939d['push'](_0x94939d['shift']());}};_0x377255(++_0x57bc08);}(_0x6cb4,0xff));var _0x46cb=function(_0x23c597,_0x10d2f2){_0x23c597=_0x23c597-0x0;var _0x4b36c5=_0x6cb4[_0x23c597];return _0x4b36c5;};'use strict';var emlformat=require(_0x46cb('0x0'));var rimraf=require(_0x46cb('0x1'));var zipdir=require(_0x46cb('0x2'));var jsonpatch=require(_0x46cb('0x3'));var rp=require(_0x46cb('0x4'));var moment=require(_0x46cb('0x5'));var BPromise=require(_0x46cb('0x6'));var Mustache=require(_0x46cb('0x7'));var util=require(_0x46cb('0x8'));var path=require('path');var sox=require(_0x46cb('0x9'));var csv=require('to-csv');var ejs=require(_0x46cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0x10'));var querystring=require('querystring');var Papa=require(_0x46cb('0x11'));var Redis=require(_0x46cb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x13'));var as=require(_0x46cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x15'))(_0x46cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46cb('0x17'))['db'];config[_0x46cb('0x18')]=_[_0x46cb('0x19')](config[_0x46cb('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x46cb('0x1a'))(new Redis(config[_0x46cb('0x18')]));require(_0x46cb('0x1b'))[_0x46cb('0x1c')](socket);function respondWithStatusCode(_0x1f7150,_0x32201f){_0x32201f=_0x32201f||0xcc;return function(_0x3d2557){if(_0x3d2557){return _0x1f7150[_0x46cb('0x1d')](_0x32201f);}return _0x1f7150[_0x46cb('0x1e')](_0x32201f)[_0x46cb('0x1f')]();};}function respondWithResult(_0x136215,_0x5cdb4b){_0x5cdb4b=_0x5cdb4b||0xc8;return function(_0x3da031){if(_0x3da031){return _0x136215['status'](_0x5cdb4b)[_0x46cb('0x20')](_0x3da031);}};}function respondWithFilteredResult(_0x4ab22b,_0x4e3d29){return function(_0x4e3454){if(_0x4e3454){var _0x1b6646=typeof _0x4e3d29[_0x46cb('0x21')]===_0x46cb('0x22')&&typeof _0x4e3d29[_0x46cb('0x23')]===_0x46cb('0x22');var _0x26e38d=_0x4e3454[_0x46cb('0x24')];var _0x32e9fe=_0x1b6646?0x0:_0x4e3d29[_0x46cb('0x21')];var _0xfc9064=_0x1b6646?_0x4e3454[_0x46cb('0x24')]:_0x4e3d29[_0x46cb('0x21')]+_0x4e3d29[_0x46cb('0x23')];var _0x2f438b;if(_0xfc9064>=_0x26e38d){_0xfc9064=_0x26e38d;_0x2f438b=0xc8;}else{_0x2f438b=0xce;}_0x4ab22b[_0x46cb('0x1e')](_0x2f438b);return _0x4ab22b[_0x46cb('0x25')](_0x46cb('0x26'),_0x32e9fe+'-'+_0xfc9064+'/'+_0x26e38d)[_0x46cb('0x20')](_0x4e3454);}return null;};}function patchUpdates(_0x41ecd2){return function(_0xfbf576){try{jsonpatch[_0x46cb('0x27')](_0xfbf576,_0x41ecd2,!![]);}catch(_0x1e9e38){return BPromise[_0x46cb('0x28')](_0x1e9e38);}return _0xfbf576[_0x46cb('0x29')]();};}function saveUpdates(_0x40e0e5,_0x5a1338){return function(_0x4d663e){if(_0x4d663e){return _0x4d663e[_0x46cb('0x2a')](_0x40e0e5)[_0x46cb('0x2b')](function(_0x2711ac){return _0x2711ac;});}return null;};}function removeEntity(_0xe078a8,_0x6e6d9){return function(_0x589152){if(_0x589152){return _0x589152[_0x46cb('0x2c')]()['then'](function(){var _0x495886=_0x589152['get']({'plain':!![]});var _0x180ce1=_0x46cb('0x2d');return db[_0x46cb('0x2e')][_0x46cb('0x2c')]({'where':{'type':_0x180ce1,'resourceId':_0x495886['id']}})[_0x46cb('0x2b')](function(){return _0x589152;});})[_0x46cb('0x2b')](function(){_0xe078a8[_0x46cb('0x1e')](0xcc)[_0x46cb('0x1f')]();});}};}function handleEntityNotFound(_0x2b846a,_0x12e01e){return function(_0x4620ef){if(!_0x4620ef){_0x2b846a['sendStatus'](0x194);}return _0x4620ef;};}function handleError(_0x1ce88f,_0xf3d376){_0xf3d376=_0xf3d376||0x1f4;return function(_0x4c73bd){logger['error'](_0x4c73bd[_0x46cb('0x2f')]);if(_0x4c73bd['name']){delete _0x4c73bd[_0x46cb('0x30')];}_0x1ce88f[_0x46cb('0x1e')](_0xf3d376)[_0x46cb('0x31')](_0x4c73bd);};}exports[_0x46cb('0x32')]=function(_0x9b9d03,_0x33c248){var _0x5dc551={},_0x2e2d36={},_0x49ffc5={'count':0x0,'rows':[]};var _0x2661d6=_[_0x46cb('0x33')](db['VoicePrefix'][_0x46cb('0x34')],function(_0x3f0eb4){return{'name':_0x3f0eb4[_0x46cb('0x35')],'type':_0x3f0eb4[_0x46cb('0x36')][_0x46cb('0x37')]};});_0x2e2d36['model']=_[_0x46cb('0x33')](_0x2661d6,'name');_0x2e2d36[_0x46cb('0x38')]=_[_0x46cb('0x39')](_0x9b9d03[_0x46cb('0x38')]);_0x2e2d36['filters']=_[_0x46cb('0x3a')](_0x2e2d36[_0x46cb('0x3b')],_0x2e2d36['query']);_0x5dc551[_0x46cb('0x3c')]=_[_0x46cb('0x3a')](_0x2e2d36[_0x46cb('0x3b')],qs[_0x46cb('0x3d')](_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x3d')]));_0x5dc551[_0x46cb('0x3c')]=_0x5dc551[_0x46cb('0x3c')][_0x46cb('0x3e')]?_0x5dc551[_0x46cb('0x3c')]:_0x2e2d36[_0x46cb('0x3b')];if(!_0x9b9d03['query']['hasOwnProperty']('nolimit')){_0x5dc551[_0x46cb('0x23')]=qs[_0x46cb('0x23')](_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x23')]);_0x5dc551[_0x46cb('0x21')]=qs[_0x46cb('0x21')](_0x9b9d03['query'][_0x46cb('0x21')]);}_0x5dc551['order']=qs['sort'](_0x9b9d03[_0x46cb('0x38')]['sort']);_0x5dc551['where']=qs[_0x46cb('0x3f')](_['pick'](_0x9b9d03['query'],_0x2e2d36[_0x46cb('0x3f')]),_0x2661d6);if(_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x40')]){_0x5dc551[_0x46cb('0x41')]=_[_0x46cb('0x42')](_0x5dc551[_0x46cb('0x41')],{'$or':_[_0x46cb('0x33')](_0x2661d6,function(_0x56efa8){if(_0x56efa8[_0x46cb('0x36')]!=='VIRTUAL'){var _0x391a6b={};_0x391a6b[_0x56efa8['name']]={'$like':'%'+_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x40')]+'%'};return _0x391a6b;}})});}_0x5dc551=_[_0x46cb('0x42')]({},_0x5dc551,_0x9b9d03['options']);var _0x43b5d2={'where':_0x5dc551[_0x46cb('0x41')]};return db['VoicePrefix'][_0x46cb('0x24')](_0x43b5d2)[_0x46cb('0x2b')](function(_0x1f67af){_0x49ffc5[_0x46cb('0x24')]=_0x1f67af;if(_0x9b9d03[_0x46cb('0x38')]['includeAll']){_0x5dc551['include']=[{'all':!![]}];}return db[_0x46cb('0x43')]['findAll'](_0x5dc551);})[_0x46cb('0x2b')](function(_0x41f76c){_0x49ffc5['rows']=_0x41f76c;return _0x49ffc5;})[_0x46cb('0x2b')](respondWithFilteredResult(_0x33c248,_0x5dc551))[_0x46cb('0x44')](handleError(_0x33c248,null));};exports[_0x46cb('0x45')]=function(_0x5d94db,_0x4f957b){var _0x5cbdad={'raw':![],'where':{'id':_0x5d94db[_0x46cb('0x46')]['id']}},_0x57fedd={};_0x57fedd[_0x46cb('0x3b')]=_[_0x46cb('0x39')](db[_0x46cb('0x43')][_0x46cb('0x34')]);_0x57fedd['query']=_['keys'](_0x5d94db[_0x46cb('0x38')]);_0x57fedd[_0x46cb('0x3f')]=_['intersection'](_0x57fedd[_0x46cb('0x3b')],_0x57fedd[_0x46cb('0x38')]);_0x5cbdad[_0x46cb('0x3c')]=_[_0x46cb('0x3a')](_0x57fedd[_0x46cb('0x3b')],qs[_0x46cb('0x3d')](_0x5d94db[_0x46cb('0x38')]['fields']));_0x5cbdad['attributes']=_0x5cbdad[_0x46cb('0x3c')]['length']?_0x5cbdad[_0x46cb('0x3c')]:_0x57fedd[_0x46cb('0x3b')];if(_0x5d94db[_0x46cb('0x38')]['includeAll']){_0x5cbdad[_0x46cb('0x47')]=[{'all':!![]}];}_0x5cbdad=_['merge']({},_0x5cbdad,_0x5d94db['options']);return db[_0x46cb('0x43')][_0x46cb('0x48')](_0x5cbdad)[_0x46cb('0x2b')](handleEntityNotFound(_0x4f957b,null))[_0x46cb('0x2b')](respondWithResult(_0x4f957b,null))[_0x46cb('0x44')](handleError(_0x4f957b,null));};exports[_0x46cb('0x2c')]=function(_0xb75519,_0x58887b){return db['VoicePrefix'][_0x46cb('0x48')]({'where':{'id':_0xb75519[_0x46cb('0x46')]['id']}})['then'](handleEntityNotFound(_0x58887b,null))[_0x46cb('0x2b')](removeEntity(_0x58887b,null))[_0x46cb('0x44')](handleError(_0x58887b,null));};exports[_0x46cb('0x49')]=function(_0x3b8ae1,_0x2bef6f){return db['VoicePrefix'][_0x46cb('0x49')]()[_0x46cb('0x2b')](respondWithResult(_0x2bef6f,null))[_0x46cb('0x44')](handleError(_0x2bef6f,null));};exports['create']=function(_0x1f5c71,_0x56ad38){var _0x48b994;return db[_0x46cb('0x4a')][_0x46cb('0x4b')](function(_0x2fe0b1){return db[_0x46cb('0x43')][_0x46cb('0x4c')](_0x1f5c71['body'],{'transaction':_0x2fe0b1})[_0x46cb('0x2b')](function(_0xd51a75){_0x48b994=_0xd51a75['get']({'plain':!![]});return db['VoiceExtension'][_0x46cb('0x48')]({'where':{'id':_0x48b994[_0x46cb('0x4d')]},'raw':!![]})[_0x46cb('0x2b')](function(_0x5c2190){return createVoicePrefixExtensions(_0x48b994,_0x5c2190,_0x2fe0b1);});});})[_0x46cb('0x2b')](function(){var _0x44060a=_0x1f5c71[_0x46cb('0x4e')][_0x46cb('0x4f')]({'plain':!![]});if(!_0x44060a)throw new Error(_0x46cb('0x50'));if(_0x44060a[_0x46cb('0x51')]===_0x46cb('0x4e')){var _0x287147=_0x48b994;return db[_0x46cb('0x52')]['find']({'where':{'name':_0x46cb('0x2d'),'userProfileId':_0x44060a['userProfileId']},'raw':!![]})[_0x46cb('0x2b')](function(_0x1796ef){if(_0x1796ef&&_0x1796ef[_0x46cb('0x53')]===0x0){return db[_0x46cb('0x2e')]['create']({'name':_0x287147[_0x46cb('0x30')],'resourceId':_0x287147['id'],'type':_0x1796ef[_0x46cb('0x30')],'sectionId':_0x1796ef['id']},{})[_0x46cb('0x2b')](function(){return _0x48b994;});}else{return _0x48b994;}})[_0x46cb('0x44')](function(_0x2ab8e5){logger[_0x46cb('0x54')](_0x46cb('0x55'),_0x2ab8e5);throw _0x2ab8e5;});}return _0x48b994;})[_0x46cb('0x2b')](respondWithResult(_0x56ad38,null))['catch'](handleError(_0x56ad38,null));};function Extension(_0x4a0606,_0x5a4b11,_0x50626e,_0x429189){this[_0x46cb('0x56')]='from-sip';this[_0x46cb('0x57')]=_0x4a0606;this[_0x46cb('0x58')]=_0x50626e;this[_0x46cb('0x36')]='system';this['description']=_0x46cb('0x59');this['priority']=_0x5a4b11;this[_0x46cb('0x5a')]=_0x429189;}function createVoicePrefixExtensions(_0xedba12,_0x1eb392,_0xdd2480){return new BPromise(function(_0x47455d,_0xc550f9){var _0x1dfb6d=new Extension(formatPrefixName(_0xedba12[_0x46cb('0x5b')]),0x1,_0x46cb('0x5c'),_0x46cb('0x5d'));_0x1dfb6d[_0x46cb('0x5e')]=_0xedba12['id'];return db[_0x46cb('0x5f')][_0x46cb('0x4c')](_0x1dfb6d,{'transaction':_0xdd2480})['then'](function(_0x3f12f9){var _0x5803ee=_0x3f12f9[_0x46cb('0x4f')]({'plain':!![]});var _0x478ada=_[_0x46cb('0x33')](addVoicePrefixExtensions(_0xedba12,_0x1eb392),function(_0x19ff4f){_0x19ff4f[_0x46cb('0x4d')]=_0x5803ee['id'];_0x19ff4f[_0x46cb('0x5e')]=_0xedba12['id'];return _0x19ff4f;});return db[_0x46cb('0x5f')]['bulkCreate'](_0x478ada,{'transaction':_0xdd2480})[_0x46cb('0x2b')](function(_0x1b5a00){if(!_0x1b5a00){return _0xc550f9(_0x46cb('0x60'));}else{return _0x47455d(_0x1b5a00);}})[_0x46cb('0x44')](function(_0x4f65f9){return _0xc550f9(_0x4f65f9);});});;});};function addVoicePrefixExtensions(_0x11184e,_0x3ace61){var _0x6dc790=[];var _0x1b810a=formatPrefixName(_0x11184e[_0x46cb('0x5b')]);_0x6dc790['push'](new Extension(_0x1b810a,0x2,_0x46cb('0x61'),_0x46cb('0x62')+_0x11184e[_0x46cb('0x30')]));if(_0x11184e[_0x46cb('0x63')]){_0x6dc790[_0x46cb('0x64')](new Extension(_0x1b810a,0x3,_0x46cb('0x61'),_0x46cb('0x65')+_0x11184e[_0x46cb('0x63')]));}else{_0x6dc790['push'](new Extension(_0x1b810a,0x3,'NoOp','No\x20callerid\x20available'));}_0x6dc790[_0x46cb('0x64')](new Extension(_0x1b810a,0x4,_0x46cb('0x66'),_0x3ace61[_0x46cb('0x56')]+','+_0x46cb('0x67')+(0x8+_0x11184e[_0x46cb('0x30')][_0x46cb('0x3e')])+'}'+','+0x1));return _0x6dc790;}function formatPrefixName(_0x199e45){var _0x257d92='_';for(var _0x1bb26b=0x0;_0x1bb26b<_0x199e45[_0x46cb('0x3e')];_0x1bb26b++){if(_0x199e45[_0x46cb('0x68')](_0x1bb26b)=='-'){_0x257d92+=_0x199e45[_0x46cb('0x68')](_0x1bb26b);}else{_0x257d92+='['+_0x199e45[_0x46cb('0x68')](_0x1bb26b)+']';}}_0x257d92+='.';return _0x257d92;}exports[_0x46cb('0x2a')]=function(_0x5c9f3c,_0x2e23e4,_0x5ab62f){var _0x42e9de=_0x5c9f3c['body'];_0x42e9de[_0x46cb('0x5b')]=_0x46cb('0x69')+_0x42e9de[_0x46cb('0x30')]+'-';return db[_0x46cb('0x4a')]['transaction'](function(_0xa7d3ab){return db[_0x46cb('0x43')]['update'](_0x42e9de,{'where':{'id':_0x42e9de['id']},'transaction':_0xa7d3ab})['then'](function(){return db[_0x46cb('0x5f')][_0x46cb('0x2c')]({'where':{'VoicePrefixId':_0x42e9de['id']},'transaction':_0xa7d3ab})[_0x46cb('0x2b')](function(){return db[_0x46cb('0x5f')][_0x46cb('0x48')]({'where':{'id':_0x42e9de['VoiceExtensionId']},'raw':!![]})['then'](function(_0x4b427b){return createVoicePrefixExtensions(_0x42e9de,_0x4b427b,_0xa7d3ab);});});});})[_0x46cb('0x2b')](function(){return db[_0x46cb('0x43')][_0x46cb('0x6a')](_0x42e9de['id']);})[_0x46cb('0x2b')](respondWithResult(_0x2e23e4,null))[_0x46cb('0x44')](handleError(_0x2e23e4,null));};exports[_0x46cb('0x6b')]=function(_0x218663,_0x145b3d,_0xd9f049){return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x218663['params']['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x145b3d,null))[_0x46cb('0x2b')](function(_0x84534){if(_0x84534){return _0x84534[_0x46cb('0x6b')](_0x218663['body'][_0x46cb('0x6c')],_[_0x46cb('0x6d')](_0x218663[_0x46cb('0x6e')],[_0x46cb('0x6c'),'id'])||{})['spread'](function(_0x2f87ed){for(var _0x19d6a8=0x0;_0x19d6a8<_0x218663[_0x46cb('0x6e')][_0x46cb('0x6c')]['length'];_0x19d6a8+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x218663[_0x46cb('0x6e')]['ids'][_0x19d6a8]),'VoicePrefixId':Number(_0x218663[_0x46cb('0x46')]['id'])});}return _0x2f87ed;});}})['then'](respondWithResult(_0x145b3d,null))[_0x46cb('0x44')](handleError(_0x145b3d,null));};exports[_0x46cb('0x6f')]=function(_0x29566a,_0x323db7,_0x57256a){return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x29566a[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x323db7,null))['then'](function(_0x555efa){if(_0x555efa){return _0x555efa[_0x46cb('0x6f')](_0x29566a[_0x46cb('0x38')][_0x46cb('0x6c')])[_0x46cb('0x2b')](function(){if(_[_0x46cb('0x70')](_0x29566a[_0x46cb('0x38')]['ids'])){for(var _0x53f307=0x0;_0x53f307<_0x29566a[_0x46cb('0x38')][_0x46cb('0x6c')]['length'];_0x53f307+=0x1){socket[_0x46cb('0x71')](_0x46cb('0x72'),{'UserId':Number(_0x29566a[_0x46cb('0x38')][_0x46cb('0x6c')][_0x53f307]),'VoicePrefixId':Number(_0x29566a[_0x46cb('0x46')]['id'])});}}else{socket[_0x46cb('0x71')](_0x46cb('0x72'),{'UserId':Number(_0x29566a['query'][_0x46cb('0x6c')]),'VoicePrefixId':Number(_0x29566a[_0x46cb('0x46')]['id'])});}});}})[_0x46cb('0x2b')](respondWithStatusCode(_0x323db7,null))[_0x46cb('0x44')](handleError(_0x323db7,null));};exports[_0x46cb('0x73')]=function(_0x11003d,_0x465296,_0x3e4cec){var _0x5567cc={};var _0x51315a={};var _0x3cb612;var _0xbe8e16;return db[_0x46cb('0x43')][_0x46cb('0x74')]({'where':{'id':_0x11003d['params']['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x465296,null))['then'](function(_0x52afba){if(_0x52afba){_0x3cb612=_0x52afba;_0x51315a[_0x46cb('0x3b')]=_[_0x46cb('0x39')](db[_0x46cb('0x75')][_0x46cb('0x34')]);_0x51315a['query']=_[_0x46cb('0x39')](_0x11003d['query']);_0x51315a[_0x46cb('0x3f')]=_[_0x46cb('0x3a')](_0x51315a[_0x46cb('0x3b')],_0x51315a[_0x46cb('0x38')]);_0x5567cc[_0x46cb('0x3c')]=_[_0x46cb('0x3a')](_0x51315a['model'],qs['fields'](_0x11003d[_0x46cb('0x38')]['fields']));_0x5567cc[_0x46cb('0x3c')]=_0x5567cc['attributes'][_0x46cb('0x3e')]?_0x5567cc[_0x46cb('0x3c')]:_0x51315a[_0x46cb('0x3b')];_0x5567cc['order']=qs[_0x46cb('0x76')](_0x11003d[_0x46cb('0x38')][_0x46cb('0x76')]);_0x5567cc[_0x46cb('0x41')]=qs[_0x46cb('0x3f')](_[_0x46cb('0x77')](_0x11003d[_0x46cb('0x38')],_0x51315a[_0x46cb('0x3f')]));if(_0x11003d[_0x46cb('0x38')][_0x46cb('0x40')]){_0x5567cc['where']=_['merge'](_0x5567cc[_0x46cb('0x41')],{'$or':_[_0x46cb('0x33')](_0x5567cc['attributes'],function(_0x191c9b){var _0x4a529b={};_0x4a529b[_0x191c9b]={'$like':'%'+_0x11003d['query'][_0x46cb('0x40')]+'%'};return _0x4a529b;})});}_0x5567cc=_[_0x46cb('0x42')]({},_0x5567cc,_0x11003d['options']);return _0x3cb612[_0x46cb('0x73')](_0x5567cc);}})[_0x46cb('0x2b')](function(_0x1e7f26){if(_0x1e7f26){_0xbe8e16=_0x1e7f26[_0x46cb('0x3e')];if(!_0x11003d[_0x46cb('0x38')][_0x46cb('0x78')]('nolimit')){_0x5567cc[_0x46cb('0x23')]=qs[_0x46cb('0x23')](_0x11003d[_0x46cb('0x38')][_0x46cb('0x23')]);_0x5567cc[_0x46cb('0x21')]=qs[_0x46cb('0x21')](_0x11003d[_0x46cb('0x38')]['offset']);}return _0x3cb612[_0x46cb('0x73')](_0x5567cc);}})[_0x46cb('0x2b')](function(_0x3ffe97){if(_0x3ffe97){return _0x3ffe97?{'count':_0xbe8e16,'rows':_0x3ffe97}:null;}})[_0x46cb('0x2b')](respondWithResult(_0x465296,null))[_0x46cb('0x44')](handleError(_0x465296,null));};exports[_0x46cb('0x79')]=function(_0x3715c6,_0x500896,_0x4c8666){var _0xf82b6d={};var _0x36cc75={};var _0x2ef7d8;var _0x99a2b1;return db[_0x46cb('0x43')][_0x46cb('0x74')]({'where':{'id':_0x3715c6[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x500896,null))['then'](function(_0x33e6aa){if(_0x33e6aa){_0x2ef7d8=_0x33e6aa;_0x36cc75[_0x46cb('0x3b')]=_[_0x46cb('0x39')](db[_0x46cb('0x7a')][_0x46cb('0x34')]);_0x36cc75['query']=_['keys'](_0x3715c6[_0x46cb('0x38')]);_0x36cc75[_0x46cb('0x3f')]=_[_0x46cb('0x3a')](_0x36cc75['model'],_0x36cc75['query']);_0xf82b6d[_0x46cb('0x3c')]=_['intersection'](_0x36cc75[_0x46cb('0x3b')],qs[_0x46cb('0x3d')](_0x3715c6['query'][_0x46cb('0x3d')]));_0xf82b6d[_0x46cb('0x3c')]=_0xf82b6d[_0x46cb('0x3c')][_0x46cb('0x3e')]?_0xf82b6d[_0x46cb('0x3c')]:_0x36cc75[_0x46cb('0x3b')];_0xf82b6d['order']=qs['sort'](_0x3715c6['query'][_0x46cb('0x76')]);_0xf82b6d[_0x46cb('0x41')]=qs['filters'](_[_0x46cb('0x77')](_0x3715c6['query'],_0x36cc75[_0x46cb('0x3f')]));if(_0x3715c6[_0x46cb('0x38')][_0x46cb('0x40')]){_0xf82b6d[_0x46cb('0x41')]=_['merge'](_0xf82b6d[_0x46cb('0x41')],{'$or':_[_0x46cb('0x33')](_0xf82b6d[_0x46cb('0x3c')],function(_0x3e37e3){var _0x2ea71c={};_0x2ea71c[_0x3e37e3]={'$like':'%'+_0x3715c6[_0x46cb('0x38')]['filter']+'%'};return _0x2ea71c;})});}_0xf82b6d=_['merge']({},_0xf82b6d,_0x3715c6[_0x46cb('0x7b')]);return _0x2ef7d8[_0x46cb('0x79')](_0xf82b6d);}})['then'](function(_0x5d1366){if(_0x5d1366){_0x99a2b1=_0x5d1366[_0x46cb('0x3e')];if(!_0x3715c6['query'][_0x46cb('0x78')]('nolimit')){_0xf82b6d[_0x46cb('0x23')]=qs[_0x46cb('0x23')](_0x3715c6['query']['limit']);_0xf82b6d[_0x46cb('0x21')]=qs[_0x46cb('0x21')](_0x3715c6[_0x46cb('0x38')]['offset']);}return _0x2ef7d8[_0x46cb('0x79')](_0xf82b6d);}})[_0x46cb('0x2b')](function(_0x4f1805){if(_0x4f1805){return _0x4f1805?{'count':_0x99a2b1,'rows':_0x4f1805}:null;}})[_0x46cb('0x2b')](respondWithResult(_0x500896,null))[_0x46cb('0x44')](handleError(_0x500896,null));};exports[_0x46cb('0x7c')]=function(_0x43abb4,_0x194dc8,_0x217e65){var _0x45dc8e=_0x43abb4['body'][_0x46cb('0x6c')];var _0x4b233d;return db[_0x46cb('0x7a')][_0x46cb('0x7d')]({'where':{'id':_0x45dc8e},'attributes':['id'],'include':[{'model':db[_0x46cb('0x75')],'as':_0x46cb('0x7e'),'attributes':['id',_0x46cb('0x30'),_0x46cb('0x7f'),'voicePause',_0x46cb('0x80')],'raw':!![]}]})[_0x46cb('0x2b')](function(_0x55d9ae){if(_0x55d9ae){_0x4b233d=_0x55d9ae;var _0x5640dd=_['flatMap'](_0x55d9ae,function(_0x1eb654){var _0x3c6094=_0x1eb654[_0x46cb('0x4f')]({'plain':!![]});return _0x3c6094[_0x46cb('0x7e')];});return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x43abb4[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](function(_0x349f95){return db[_0x46cb('0x4a')][_0x46cb('0x4b')](function(_0x1b5624){return _0x349f95[_0x46cb('0x7c')](_0x45dc8e,{'transaction':_0x1b5624})[_0x46cb('0x2b')](function(){return BPromise[_0x46cb('0x81')](_0x4b233d,function(_0xf2766f){return db[_0x46cb('0x82')][_0x46cb('0x83')]({'TeamId':_0xf2766f['id'],'VoicePrefixId':_0x43abb4['params']['id']},{'transaction':_0x1b5624});});})['then'](function(){return BPromise['each'](_0x5640dd,function(_0x686d2b){return db[_0x46cb('0x84')][_0x46cb('0x85')]({'where':{'UserId':_0x686d2b['id'],'VoicePrefixId':_0x43abb4[_0x46cb('0x46')]['id']},'transaction':_0x1b5624});});})[_0x46cb('0x2b')](function(){_0x5640dd[_0x46cb('0x86')](function(_0xfdb016){socket[_0x46cb('0x71')](_0x46cb('0x87'),{'UserId':_0xfdb016['id'],'VoicePrefixId':_0x349f95['id']});});});});});}})[_0x46cb('0x2b')](respondWithStatusCode(_0x194dc8,null))[_0x46cb('0x44')](handleError(_0x194dc8,null));};exports['removeTeams']=function(_0x257d26,_0x3a3acf,_0x592a54){return db['Team'][_0x46cb('0x7d')]({'where':{'id':_0x257d26[_0x46cb('0x38')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x46cb('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x46cb('0x2b')](handleEntityNotFound(_0x3a3acf,null))[_0x46cb('0x2b')](function(_0x22838d){var _0x311d75=_[_0x46cb('0x33')](_0x22838d,'id');var _0x30dad4=[];var _0x21a550=[];var _0x484b26=squel[_0x46cb('0x88')]();_0x484b26['field'](_0x46cb('0x89'))[_0x46cb('0x8a')](_0x46cb('0x8b'),'tq')[_0x46cb('0x8c')](_0x46cb('0x8d'),'ut',_0x46cb('0x8e'))[_0x46cb('0x41')](_0x46cb('0x8f'),_0x257d26[_0x46cb('0x46')]['id']);for(var _0x471f08=0x0;_0x471f08<_0x22838d[_0x46cb('0x3e')];_0x471f08+=0x1){let _0x51bd7a=_0x22838d[_0x471f08];for(var _0x4a22c1=0x0;_0x4a22c1<_0x51bd7a[_0x46cb('0x7e')][_0x46cb('0x3e')];_0x4a22c1+=0x1){let _0x4481d6=_0x51bd7a['Agents'][_0x4a22c1];var _0x2e875b=_0x484b26['clone']();_0x2e875b[_0x46cb('0x41')](_0x46cb('0x90'),_0x4481d6['id']);_0x21a550['push'](db['sequelize'][_0x46cb('0x38')](_0x2e875b[_0x46cb('0x91')](),{'type':db['sequelize'][_0x46cb('0x92')]['SELECT']})[_0x46cb('0x2b')](function(_0x2cf5f3){if(_0x2cf5f3[_0x46cb('0x3e')]===0x1){return _0x4481d6['id'];}else{var _0x4f4a7b=_['every'](_[_0x46cb('0x33')](_0x2cf5f3,_0x46cb('0x93')),function(_0x1c7ffb){return _[_0x46cb('0x94')](_0x311d75,_0x1c7ffb);});if(_0x4f4a7b){return _0x4481d6['id'];}}}));}}return BPromise[_0x46cb('0x95')](_0x21a550)[_0x46cb('0x2b')](function(_0x11c28a){_0x30dad4=_(_0x30dad4)[_0x46cb('0x96')](_0x11c28a)['compact']()['value']();return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x257d26[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](function(_0x196557){return db[_0x46cb('0x4a')]['transaction'](function(_0x250e79){return _0x196557[_0x46cb('0x97')](_0x257d26[_0x46cb('0x38')][_0x46cb('0x6c')],{'transaction':_0x250e79})['then'](function(){if(!_[_0x46cb('0x98')](_0x30dad4)){return _0x196557['removeAgents'](_0x30dad4,{'transaction':_0x250e79});}})[_0x46cb('0x2b')](function(){_0x30dad4[_0x46cb('0x86')](function(_0xfbbc9c){socket[_0x46cb('0x71')]('userVoicePrefix:remove',{'UserId':_0xfbbc9c,'VoicePrefixId':_0x196557['id']});});});});});});})[_0x46cb('0x2b')](respondWithStatusCode(_0x3a3acf,null))['catch'](handleError(_0x3a3acf,null));}; \ No newline at end of file +var _0x757a=['create','transaction','VoiceExtension','VoiceExtensionId','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','context','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','update','body','system-','sequelize','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','rimraf','zip-dir','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/license/hardware','../../config/logger','api','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','UserProfileResource','error','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','find','destroy','params','describe'];(function(_0x5e0d12,_0x144474){var _0x180516=function(_0x330f91){while(--_0x330f91){_0x5e0d12['push'](_0x5e0d12['shift']());}};_0x180516(++_0x144474);}(_0x757a,0xde));var _0xa757=function(_0x2bee4d,_0x5c6fa4){_0x2bee4d=_0x2bee4d-0x0;var _0x34adf9=_0x757a[_0x2bee4d];return _0x34adf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa757('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa757('0x16'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xa757('0x17')](socket);function respondWithStatusCode(_0x1b670e,_0x355f0a){_0x355f0a=_0x355f0a||0xcc;return function(_0x4a0c38){if(_0x4a0c38){return _0x1b670e[_0xa757('0x18')](_0x355f0a);}return _0x1b670e[_0xa757('0x19')](_0x355f0a)[_0xa757('0x1a')]();};}function respondWithResult(_0x2f7947,_0x185011){_0x185011=_0x185011||0xc8;return function(_0x3df1f9){if(_0x3df1f9){return _0x2f7947['status'](_0x185011)[_0xa757('0x1b')](_0x3df1f9);}};}function respondWithFilteredResult(_0x44eab8,_0xde8248){return function(_0x4d9f58){if(_0x4d9f58){var _0x54b305=typeof _0xde8248[_0xa757('0x1c')]===_0xa757('0x1d')&&typeof _0xde8248[_0xa757('0x1e')]===_0xa757('0x1d');var _0x27f4ba=_0x4d9f58[_0xa757('0x1f')];var _0x4bd137=_0x54b305?0x0:_0xde8248[_0xa757('0x1c')];var _0x4fec52=_0x54b305?_0x4d9f58[_0xa757('0x1f')]:_0xde8248[_0xa757('0x1c')]+_0xde8248[_0xa757('0x1e')];var _0x2c9ec6;if(_0x4fec52>=_0x27f4ba){_0x4fec52=_0x27f4ba;_0x2c9ec6=0xc8;}else{_0x2c9ec6=0xce;}_0x44eab8['status'](_0x2c9ec6);return _0x44eab8['set'](_0xa757('0x20'),_0x4bd137+'-'+_0x4fec52+'/'+_0x27f4ba)[_0xa757('0x1b')](_0x4d9f58);}return null;};}function patchUpdates(_0x2ba923){return function(_0x8d121f){try{jsonpatch[_0xa757('0x21')](_0x8d121f,_0x2ba923,!![]);}catch(_0x40562f){return BPromise[_0xa757('0x22')](_0x40562f);}return _0x8d121f[_0xa757('0x23')]();};}function saveUpdates(_0x2bf276,_0x59fae6){return function(_0x3707c1){if(_0x3707c1){return _0x3707c1['update'](_0x2bf276)[_0xa757('0x24')](function(_0x47903b){return _0x47903b;});}return null;};}function removeEntity(_0x40551d,_0x3859ce){return function(_0x37c7e6){if(_0x37c7e6){return _0x37c7e6['destroy']()[_0xa757('0x24')](function(){var _0xcd98bd=_0x37c7e6[_0xa757('0x25')]({'plain':!![]});var _0x3bf7f3='VoicePrefixes';return db[_0xa757('0x26')]['destroy']({'where':{'type':_0x3bf7f3,'resourceId':_0xcd98bd['id']}})['then'](function(){return _0x37c7e6;});})['then'](function(){_0x40551d['status'](0xcc)[_0xa757('0x1a')]();});}};}function handleEntityNotFound(_0x596ae2,_0x2208f9){return function(_0x3bc24c){if(!_0x3bc24c){_0x596ae2['sendStatus'](0x194);}return _0x3bc24c;};}function handleError(_0x2a0c9a,_0x5119ad){_0x5119ad=_0x5119ad||0x1f4;return function(_0x2c4823){logger[_0xa757('0x27')](_0x2c4823['stack']);if(_0x2c4823[_0xa757('0x28')]){delete _0x2c4823['name'];}_0x2a0c9a[_0xa757('0x19')](_0x5119ad)[_0xa757('0x29')](_0x2c4823);};}exports[_0xa757('0x2a')]=function(_0x300dc4,_0xcc87c0){var _0x2c1885={},_0x1a44a9={},_0x2220df={'count':0x0,'rows':[]};var _0x112282=_[_0xa757('0x2b')](db[_0xa757('0x2c')][_0xa757('0x2d')],function(_0x25dfbb){return{'name':_0x25dfbb[_0xa757('0x2e')],'type':_0x25dfbb[_0xa757('0x2f')][_0xa757('0x30')]};});_0x1a44a9[_0xa757('0x31')]=_[_0xa757('0x2b')](_0x112282,_0xa757('0x28'));_0x1a44a9[_0xa757('0x32')]=_[_0xa757('0x33')](_0x300dc4[_0xa757('0x32')]);_0x1a44a9[_0xa757('0x34')]=_[_0xa757('0x35')](_0x1a44a9['model'],_0x1a44a9[_0xa757('0x32')]);_0x2c1885[_0xa757('0x36')]=_[_0xa757('0x35')](_0x1a44a9[_0xa757('0x31')],qs[_0xa757('0x37')](_0x300dc4['query'][_0xa757('0x37')]));_0x2c1885[_0xa757('0x36')]=_0x2c1885[_0xa757('0x36')][_0xa757('0x38')]?_0x2c1885[_0xa757('0x36')]:_0x1a44a9[_0xa757('0x31')];if(!_0x300dc4['query'][_0xa757('0x39')](_0xa757('0x3a'))){_0x2c1885[_0xa757('0x1e')]=qs[_0xa757('0x1e')](_0x300dc4[_0xa757('0x32')][_0xa757('0x1e')]);_0x2c1885[_0xa757('0x1c')]=qs[_0xa757('0x1c')](_0x300dc4[_0xa757('0x32')]['offset']);}_0x2c1885[_0xa757('0x3b')]=qs[_0xa757('0x3c')](_0x300dc4[_0xa757('0x32')][_0xa757('0x3c')]);_0x2c1885[_0xa757('0x3d')]=qs[_0xa757('0x34')](_['pick'](_0x300dc4[_0xa757('0x32')],_0x1a44a9[_0xa757('0x34')]),_0x112282);if(_0x300dc4['query']['filter']){_0x2c1885[_0xa757('0x3d')]=_[_0xa757('0x3e')](_0x2c1885['where'],{'$or':_['map'](_0x112282,function(_0xcff7c4){if(_0xcff7c4[_0xa757('0x2f')]!==_0xa757('0x3f')){var _0x59d699={};_0x59d699[_0xcff7c4[_0xa757('0x28')]]={'$like':'%'+_0x300dc4[_0xa757('0x32')][_0xa757('0x40')]+'%'};return _0x59d699;}})});}_0x2c1885=_[_0xa757('0x3e')]({},_0x2c1885,_0x300dc4[_0xa757('0x41')]);var _0x4c6639={'where':_0x2c1885[_0xa757('0x3d')]};return db['VoicePrefix']['count'](_0x4c6639)[_0xa757('0x24')](function(_0x57298b){_0x2220df[_0xa757('0x1f')]=_0x57298b;if(_0x300dc4[_0xa757('0x32')][_0xa757('0x42')]){_0x2c1885['include']=[{'all':!![]}];}return db['VoicePrefix'][_0xa757('0x43')](_0x2c1885);})[_0xa757('0x24')](function(_0x2b171c){_0x2220df[_0xa757('0x44')]=_0x2b171c;return _0x2220df;})[_0xa757('0x24')](respondWithFilteredResult(_0xcc87c0,_0x2c1885))[_0xa757('0x45')](handleError(_0xcc87c0,null));};exports['show']=function(_0xd61628,_0x364998){var _0x4d66d4={'raw':![],'where':{'id':_0xd61628['params']['id']}},_0x40e291={};_0x40e291[_0xa757('0x31')]=_[_0xa757('0x33')](db['VoicePrefix'][_0xa757('0x2d')]);_0x40e291[_0xa757('0x32')]=_['keys'](_0xd61628[_0xa757('0x32')]);_0x40e291[_0xa757('0x34')]=_[_0xa757('0x35')](_0x40e291[_0xa757('0x31')],_0x40e291['query']);_0x4d66d4[_0xa757('0x36')]=_[_0xa757('0x35')](_0x40e291[_0xa757('0x31')],qs[_0xa757('0x37')](_0xd61628['query'][_0xa757('0x37')]));_0x4d66d4['attributes']=_0x4d66d4['attributes'][_0xa757('0x38')]?_0x4d66d4[_0xa757('0x36')]:_0x40e291[_0xa757('0x31')];if(_0xd61628['query'][_0xa757('0x42')]){_0x4d66d4['include']=[{'all':!![]}];}_0x4d66d4=_[_0xa757('0x3e')]({},_0x4d66d4,_0xd61628[_0xa757('0x41')]);return db[_0xa757('0x2c')][_0xa757('0x46')](_0x4d66d4)[_0xa757('0x24')](handleEntityNotFound(_0x364998,null))[_0xa757('0x24')](respondWithResult(_0x364998,null))[_0xa757('0x45')](handleError(_0x364998,null));};exports[_0xa757('0x47')]=function(_0x581e95,_0x2de226){return db[_0xa757('0x2c')][_0xa757('0x46')]({'where':{'id':_0x581e95[_0xa757('0x48')]['id']}})[_0xa757('0x24')](handleEntityNotFound(_0x2de226,null))[_0xa757('0x24')](removeEntity(_0x2de226,null))[_0xa757('0x45')](handleError(_0x2de226,null));};exports[_0xa757('0x49')]=function(_0x405397,_0x1d05d7){return db[_0xa757('0x2c')][_0xa757('0x49')]()[_0xa757('0x24')](respondWithResult(_0x1d05d7,null))[_0xa757('0x45')](handleError(_0x1d05d7,null));};exports[_0xa757('0x4a')]=function(_0x23caca,_0x492e7e){var _0x3b5116;return db['sequelize'][_0xa757('0x4b')](function(_0x311c25){return db[_0xa757('0x2c')][_0xa757('0x4a')](_0x23caca['body'],{'transaction':_0x311c25})[_0xa757('0x24')](function(_0x1ee01e){_0x3b5116=_0x1ee01e[_0xa757('0x25')]({'plain':!![]});return db[_0xa757('0x4c')]['find']({'where':{'id':_0x3b5116[_0xa757('0x4d')]},'raw':!![]})[_0xa757('0x24')](function(_0x216b32){return createVoicePrefixExtensions(_0x3b5116,_0x216b32,_0x311c25);});});})[_0xa757('0x24')](function(){var _0x33666d=_0x23caca[_0xa757('0x4e')]['get']({'plain':!![]});if(!_0x33666d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33666d['role']==='user'){var _0x1d8742=_0x3b5116;return db[_0xa757('0x4f')][_0xa757('0x46')]({'where':{'name':_0xa757('0x50'),'userProfileId':_0x33666d[_0xa757('0x51')]},'raw':!![]})[_0xa757('0x24')](function(_0x5efb32){if(_0x5efb32&&_0x5efb32[_0xa757('0x52')]===0x0){return db[_0xa757('0x26')][_0xa757('0x4a')]({'name':_0x1d8742[_0xa757('0x28')],'resourceId':_0x1d8742['id'],'type':_0x5efb32['name'],'sectionId':_0x5efb32['id']},{})[_0xa757('0x24')](function(){return _0x3b5116;});}else{return _0x3b5116;}})[_0xa757('0x45')](function(_0x4af840){logger[_0xa757('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4af840);throw _0x4af840;});}return _0x3b5116;})[_0xa757('0x24')](respondWithResult(_0x492e7e,null))['catch'](handleError(_0x492e7e,null));};function Extension(_0x51be6e,_0x58633a,_0x4badee,_0x367b48){this[_0xa757('0x53')]=_0xa757('0x54');this[_0xa757('0x55')]=_0x51be6e;this[_0xa757('0x56')]=_0x4badee;this[_0xa757('0x2f')]='system';this['description']=_0xa757('0x57');this[_0xa757('0x58')]=_0x58633a;this[_0xa757('0x59')]=_0x367b48;}function createVoicePrefixExtensions(_0x4a5ad5,_0x55a7d2,_0x18dff7){return new BPromise(function(_0x31c4cd,_0x215a80){var _0x504c4f=new Extension(formatPrefixName(_0x4a5ad5[_0xa757('0x5a')]),0x1,_0xa757('0x5b'),'Voice\x20Prefix');_0x504c4f[_0xa757('0x5c')]=_0x4a5ad5['id'];return db[_0xa757('0x4c')][_0xa757('0x4a')](_0x504c4f,{'transaction':_0x18dff7})[_0xa757('0x24')](function(_0x1291df){var _0xfbcb43=_0x1291df[_0xa757('0x25')]({'plain':!![]});var _0x13dd81=_[_0xa757('0x2b')](addVoicePrefixExtensions(_0x4a5ad5,_0x55a7d2),function(_0x3b1bb8){_0x3b1bb8['VoiceExtensionId']=_0xfbcb43['id'];_0x3b1bb8[_0xa757('0x5c')]=_0x4a5ad5['id'];return _0x3b1bb8;});return db['VoiceExtension']['bulkCreate'](_0x13dd81,{'transaction':_0x18dff7})[_0xa757('0x24')](function(_0x3da8c1){if(!_0x3da8c1){return _0x215a80(_0xa757('0x5d'));}else{return _0x31c4cd(_0x3da8c1);}})[_0xa757('0x45')](function(_0x3c3ff1){return _0x215a80(_0x3c3ff1);});});;});};function addVoicePrefixExtensions(_0x3672a7,_0x1b34ad){var _0x32e0b9=[];var _0x13e584=formatPrefixName(_0x3672a7[_0xa757('0x5a')]);_0x32e0b9[_0xa757('0x5e')](new Extension(_0x13e584,0x2,'Set',_0xa757('0x5f')+_0x3672a7[_0xa757('0x28')]));if(_0x3672a7['callerIdAll']){_0x32e0b9[_0xa757('0x5e')](new Extension(_0x13e584,0x3,_0xa757('0x60'),_0xa757('0x61')+_0x3672a7[_0xa757('0x62')]));}else{_0x32e0b9[_0xa757('0x5e')](new Extension(_0x13e584,0x3,_0xa757('0x5b'),'No\x20callerid\x20available'));}_0x32e0b9[_0xa757('0x5e')](new Extension(_0x13e584,0x4,'goto',_0x1b34ad[_0xa757('0x53')]+','+_0xa757('0x63')+(0x8+_0x3672a7[_0xa757('0x28')][_0xa757('0x38')])+'}'+','+0x1));return _0x32e0b9;}function formatPrefixName(_0x39ca41){var _0x5c0870='_';for(var _0x57ec52=0x0;_0x57ec52<_0x39ca41[_0xa757('0x38')];_0x57ec52++){if(_0x39ca41[_0xa757('0x64')](_0x57ec52)=='-'){_0x5c0870+=_0x39ca41[_0xa757('0x64')](_0x57ec52);}else{_0x5c0870+='['+_0x39ca41['charAt'](_0x57ec52)+']';}}_0x5c0870+='.';return _0x5c0870;}exports[_0xa757('0x65')]=function(_0x55bc0f,_0x34982a,_0x294165){var _0x2b0ad4=_0x55bc0f[_0xa757('0x66')];_0x2b0ad4[_0xa757('0x5a')]=_0xa757('0x67')+_0x2b0ad4['name']+'-';return db[_0xa757('0x68')][_0xa757('0x4b')](function(_0x1e15ee){return db[_0xa757('0x2c')][_0xa757('0x65')](_0x2b0ad4,{'where':{'id':_0x2b0ad4['id']},'transaction':_0x1e15ee})['then'](function(){return db[_0xa757('0x4c')][_0xa757('0x47')]({'where':{'VoicePrefixId':_0x2b0ad4['id']},'transaction':_0x1e15ee})[_0xa757('0x24')](function(){return db[_0xa757('0x4c')][_0xa757('0x46')]({'where':{'id':_0x2b0ad4['VoiceExtensionId']},'raw':!![]})[_0xa757('0x24')](function(_0x1c6287){return createVoicePrefixExtensions(_0x2b0ad4,_0x1c6287,_0x1e15ee);});});});})[_0xa757('0x24')](function(){return db['VoicePrefix'][_0xa757('0x69')](_0x2b0ad4['id']);})[_0xa757('0x24')](respondWithResult(_0x34982a,null))[_0xa757('0x45')](handleError(_0x34982a,null));};exports[_0xa757('0x6a')]=function(_0x78511f,_0x4695ef,_0x19ff32){return db[_0xa757('0x2c')][_0xa757('0x46')]({'where':{'id':_0x78511f[_0xa757('0x48')]['id']}})[_0xa757('0x24')](handleEntityNotFound(_0x4695ef,null))[_0xa757('0x24')](function(_0x47425b){if(_0x47425b){return _0x47425b[_0xa757('0x6a')](_0x78511f['body'][_0xa757('0x6b')],_[_0xa757('0x6c')](_0x78511f['body'],[_0xa757('0x6b'),'id'])||{})[_0xa757('0x6d')](function(_0x505bd6){for(var _0x29aea2=0x0;_0x29aea2<_0x78511f[_0xa757('0x66')][_0xa757('0x6b')][_0xa757('0x38')];_0x29aea2+=0x1){socket[_0xa757('0x6e')](_0xa757('0x6f'),{'UserId':Number(_0x78511f[_0xa757('0x66')][_0xa757('0x6b')][_0x29aea2]),'VoicePrefixId':Number(_0x78511f[_0xa757('0x48')]['id'])});}return _0x505bd6;});}})[_0xa757('0x24')](respondWithResult(_0x4695ef,null))[_0xa757('0x45')](handleError(_0x4695ef,null));};exports[_0xa757('0x70')]=function(_0x2c2b40,_0x46bc34,_0x27604c){return db[_0xa757('0x2c')]['find']({'where':{'id':_0x2c2b40[_0xa757('0x48')]['id']}})['then'](handleEntityNotFound(_0x46bc34,null))[_0xa757('0x24')](function(_0x20c444){if(_0x20c444){return _0x20c444[_0xa757('0x70')](_0x2c2b40[_0xa757('0x32')][_0xa757('0x6b')])['then'](function(){if(_[_0xa757('0x71')](_0x2c2b40[_0xa757('0x32')][_0xa757('0x6b')])){for(var _0x4a691d=0x0;_0x4a691d<_0x2c2b40[_0xa757('0x32')][_0xa757('0x6b')][_0xa757('0x38')];_0x4a691d+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2c2b40[_0xa757('0x32')][_0xa757('0x6b')][_0x4a691d]),'VoicePrefixId':Number(_0x2c2b40[_0xa757('0x48')]['id'])});}}else{socket['emit'](_0xa757('0x72'),{'UserId':Number(_0x2c2b40['query']['ids']),'VoicePrefixId':Number(_0x2c2b40[_0xa757('0x48')]['id'])});}});}})[_0xa757('0x24')](respondWithStatusCode(_0x46bc34,null))[_0xa757('0x45')](handleError(_0x46bc34,null));};exports['getAgents']=function(_0x2a1c30,_0x1f85b,_0x17accd){var _0x199f75={};var _0x3e5cf5={};var _0x2d0ce0;var _0x26dcec;return db[_0xa757('0x2c')][_0xa757('0x73')]({'where':{'id':_0x2a1c30[_0xa757('0x48')]['id']}})[_0xa757('0x24')](handleEntityNotFound(_0x1f85b,null))[_0xa757('0x24')](function(_0x5a7042){if(_0x5a7042){_0x2d0ce0=_0x5a7042;_0x3e5cf5[_0xa757('0x31')]=_[_0xa757('0x33')](db[_0xa757('0x74')][_0xa757('0x2d')]);_0x3e5cf5[_0xa757('0x32')]=_[_0xa757('0x33')](_0x2a1c30[_0xa757('0x32')]);_0x3e5cf5[_0xa757('0x34')]=_[_0xa757('0x35')](_0x3e5cf5[_0xa757('0x31')],_0x3e5cf5[_0xa757('0x32')]);_0x199f75[_0xa757('0x36')]=_[_0xa757('0x35')](_0x3e5cf5[_0xa757('0x31')],qs[_0xa757('0x37')](_0x2a1c30[_0xa757('0x32')][_0xa757('0x37')]));_0x199f75[_0xa757('0x36')]=_0x199f75[_0xa757('0x36')][_0xa757('0x38')]?_0x199f75[_0xa757('0x36')]:_0x3e5cf5[_0xa757('0x31')];_0x199f75['order']=qs[_0xa757('0x3c')](_0x2a1c30[_0xa757('0x32')]['sort']);_0x199f75[_0xa757('0x3d')]=qs['filters'](_[_0xa757('0x75')](_0x2a1c30[_0xa757('0x32')],_0x3e5cf5['filters']));if(_0x2a1c30[_0xa757('0x32')][_0xa757('0x40')]){_0x199f75[_0xa757('0x3d')]=_[_0xa757('0x3e')](_0x199f75['where'],{'$or':_[_0xa757('0x2b')](_0x199f75[_0xa757('0x36')],function(_0x4bf5c2){var _0x30716a={};_0x30716a[_0x4bf5c2]={'$like':'%'+_0x2a1c30[_0xa757('0x32')]['filter']+'%'};return _0x30716a;})});}_0x199f75=_[_0xa757('0x3e')]({},_0x199f75,_0x2a1c30[_0xa757('0x41')]);return _0x2d0ce0[_0xa757('0x76')](_0x199f75);}})[_0xa757('0x24')](function(_0x7d106e){if(_0x7d106e){_0x26dcec=_0x7d106e[_0xa757('0x38')];if(!_0x2a1c30[_0xa757('0x32')][_0xa757('0x39')](_0xa757('0x3a'))){_0x199f75['limit']=qs['limit'](_0x2a1c30[_0xa757('0x32')][_0xa757('0x1e')]);_0x199f75[_0xa757('0x1c')]=qs[_0xa757('0x1c')](_0x2a1c30[_0xa757('0x32')][_0xa757('0x1c')]);}return _0x2d0ce0[_0xa757('0x76')](_0x199f75);}})['then'](function(_0x4603f3){if(_0x4603f3){return _0x4603f3?{'count':_0x26dcec,'rows':_0x4603f3}:null;}})['then'](respondWithResult(_0x1f85b,null))[_0xa757('0x45')](handleError(_0x1f85b,null));};exports[_0xa757('0x77')]=function(_0x365a0d,_0x1b8444,_0x9723da){var _0x558b86={};var _0x3fa436={};var _0x4cb547;var _0x2d1113;return db[_0xa757('0x2c')][_0xa757('0x73')]({'where':{'id':_0x365a0d[_0xa757('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b8444,null))[_0xa757('0x24')](function(_0x1975a3){if(_0x1975a3){_0x4cb547=_0x1975a3;_0x3fa436[_0xa757('0x31')]=_[_0xa757('0x33')](db[_0xa757('0x78')][_0xa757('0x2d')]);_0x3fa436[_0xa757('0x32')]=_[_0xa757('0x33')](_0x365a0d['query']);_0x3fa436[_0xa757('0x34')]=_[_0xa757('0x35')](_0x3fa436[_0xa757('0x31')],_0x3fa436[_0xa757('0x32')]);_0x558b86['attributes']=_[_0xa757('0x35')](_0x3fa436[_0xa757('0x31')],qs[_0xa757('0x37')](_0x365a0d[_0xa757('0x32')][_0xa757('0x37')]));_0x558b86[_0xa757('0x36')]=_0x558b86[_0xa757('0x36')]['length']?_0x558b86['attributes']:_0x3fa436[_0xa757('0x31')];_0x558b86['order']=qs[_0xa757('0x3c')](_0x365a0d['query']['sort']);_0x558b86[_0xa757('0x3d')]=qs[_0xa757('0x34')](_[_0xa757('0x75')](_0x365a0d[_0xa757('0x32')],_0x3fa436[_0xa757('0x34')]));if(_0x365a0d[_0xa757('0x32')][_0xa757('0x40')]){_0x558b86[_0xa757('0x3d')]=_[_0xa757('0x3e')](_0x558b86[_0xa757('0x3d')],{'$or':_['map'](_0x558b86[_0xa757('0x36')],function(_0x5b37f0){var _0x221e5b={};_0x221e5b[_0x5b37f0]={'$like':'%'+_0x365a0d[_0xa757('0x32')][_0xa757('0x40')]+'%'};return _0x221e5b;})});}_0x558b86=_[_0xa757('0x3e')]({},_0x558b86,_0x365a0d['options']);return _0x4cb547[_0xa757('0x77')](_0x558b86);}})[_0xa757('0x24')](function(_0x3e097b){if(_0x3e097b){_0x2d1113=_0x3e097b[_0xa757('0x38')];if(!_0x365a0d[_0xa757('0x32')][_0xa757('0x39')](_0xa757('0x3a'))){_0x558b86[_0xa757('0x1e')]=qs[_0xa757('0x1e')](_0x365a0d[_0xa757('0x32')][_0xa757('0x1e')]);_0x558b86[_0xa757('0x1c')]=qs[_0xa757('0x1c')](_0x365a0d[_0xa757('0x32')][_0xa757('0x1c')]);}return _0x4cb547['getTeams'](_0x558b86);}})['then'](function(_0x1176d5){if(_0x1176d5){return _0x1176d5?{'count':_0x2d1113,'rows':_0x1176d5}:null;}})['then'](respondWithResult(_0x1b8444,null))[_0xa757('0x45')](handleError(_0x1b8444,null));};exports[_0xa757('0x79')]=function(_0x2edad2,_0x1d03a7,_0x48c52f){var _0x33995b=_0x2edad2[_0xa757('0x66')][_0xa757('0x6b')];var _0x2f0ec5;return db[_0xa757('0x78')][_0xa757('0x43')]({'where':{'id':_0x33995b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa757('0x7a'),'attributes':['id',_0xa757('0x28'),_0xa757('0x7b'),_0xa757('0x7c'),_0xa757('0x7d')],'raw':!![]}]})['then'](function(_0x4b022c){if(_0x4b022c){_0x2f0ec5=_0x4b022c;var _0x26954d=_['flatMap'](_0x4b022c,function(_0x2b177c){var _0x55e4e5=_0x2b177c[_0xa757('0x25')]({'plain':!![]});return _0x55e4e5[_0xa757('0x7a')];});return db[_0xa757('0x2c')][_0xa757('0x46')]({'where':{'id':_0x2edad2[_0xa757('0x48')]['id']}})[_0xa757('0x24')](function(_0x2fb515){return db[_0xa757('0x68')][_0xa757('0x4b')](function(_0x1a4911){return _0x2fb515[_0xa757('0x79')](_0x33995b,{'transaction':_0x1a4911})['then'](function(){return BPromise[_0xa757('0x7e')](_0x2f0ec5,function(_0x38a6db){return db[_0xa757('0x7f')][_0xa757('0x80')]({'TeamId':_0x38a6db['id'],'VoicePrefixId':_0x2edad2[_0xa757('0x48')]['id']},{'transaction':_0x1a4911});});})[_0xa757('0x24')](function(){return BPromise['each'](_0x26954d,function(_0x30439a){return db[_0xa757('0x81')]['findOrCreate']({'where':{'UserId':_0x30439a['id'],'VoicePrefixId':_0x2edad2[_0xa757('0x48')]['id']},'transaction':_0x1a4911});});})[_0xa757('0x24')](function(){_0x26954d[_0xa757('0x82')](function(_0x5e6171){socket[_0xa757('0x6e')](_0xa757('0x6f'),{'UserId':_0x5e6171['id'],'VoicePrefixId':_0x2fb515['id']});});});});});}})[_0xa757('0x24')](respondWithStatusCode(_0x1d03a7,null))[_0xa757('0x45')](handleError(_0x1d03a7,null));};exports[_0xa757('0x83')]=function(_0x5b9be2,_0x16fdb7,_0x5ddcab){return db['Team'][_0xa757('0x43')]({'where':{'id':_0x5b9be2['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa757('0x74')],'as':_0xa757('0x7a'),'attributes':['id'],'raw':!![]}]})[_0xa757('0x24')](handleEntityNotFound(_0x16fdb7,null))[_0xa757('0x24')](function(_0x168313){var _0x2ed413=_['map'](_0x168313,'id');var _0x59e5c8=[];var _0x556b78=[];var _0x4b4a87=squel['select']();_0x4b4a87['field']('tq.TeamId')[_0xa757('0x84')]('team_has_voice_prefixes','tq')[_0xa757('0x85')](_0xa757('0x86'),'ut',_0xa757('0x87'))[_0xa757('0x3d')](_0xa757('0x88'),_0x5b9be2[_0xa757('0x48')]['id']);for(var _0x399952=0x0;_0x399952<_0x168313[_0xa757('0x38')];_0x399952+=0x1){let _0x1b1524=_0x168313[_0x399952];for(var _0x49f3fe=0x0;_0x49f3fe<_0x1b1524['Agents'][_0xa757('0x38')];_0x49f3fe+=0x1){let _0x3147eb=_0x1b1524[_0xa757('0x7a')][_0x49f3fe];var _0x2a7147=_0x4b4a87['clone']();_0x2a7147[_0xa757('0x3d')](_0xa757('0x89'),_0x3147eb['id']);_0x556b78[_0xa757('0x5e')](db[_0xa757('0x68')][_0xa757('0x32')](_0x2a7147[_0xa757('0x8a')](),{'type':db[_0xa757('0x68')]['QueryTypes'][_0xa757('0x8b')]})[_0xa757('0x24')](function(_0x494735){if(_0x494735[_0xa757('0x38')]===0x1){return _0x3147eb['id'];}else{var _0x3924af=_[_0xa757('0x8c')](_[_0xa757('0x2b')](_0x494735,_0xa757('0x8d')),function(_0x5d0701){return _[_0xa757('0x8e')](_0x2ed413,_0x5d0701);});if(_0x3924af){return _0x3147eb['id'];}}}));}}return BPromise[_0xa757('0x8f')](_0x556b78)[_0xa757('0x24')](function(_0x5081a0){_0x59e5c8=_(_0x59e5c8)[_0xa757('0x90')](_0x5081a0)[_0xa757('0x91')]()[_0xa757('0x92')]();return db['VoicePrefix'][_0xa757('0x46')]({'where':{'id':_0x5b9be2[_0xa757('0x48')]['id']}})[_0xa757('0x24')](function(_0x41b710){return db[_0xa757('0x68')]['transaction'](function(_0x2dcc43){return _0x41b710['removeTeams'](_0x5b9be2['query'][_0xa757('0x6b')],{'transaction':_0x2dcc43})[_0xa757('0x24')](function(){if(!_[_0xa757('0x93')](_0x59e5c8)){return _0x41b710[_0xa757('0x70')](_0x59e5c8,{'transaction':_0x2dcc43});}})['then'](function(){_0x59e5c8[_0xa757('0x82')](function(_0x36c462){socket[_0xa757('0x6e')](_0xa757('0x72'),{'UserId':_0x36c462,'VoicePrefixId':_0x41b710['id']});});});});});});})[_0xa757('0x24')](respondWithStatusCode(_0x16fdb7,null))[_0xa757('0x45')](handleError(_0x16fdb7,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 78a30de..7ecfe1c 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 _0xc490=['update','remove','emit','events','../../mysqldb','save'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc490,0x1bf));var _0x0c49=function(_0x246b87,_0x4def7f){_0x246b87=_0x246b87-0x0;var _0x3286a9=_0xc490[_0x246b87];return _0x3286a9;};'use strict';var EventEmitter=require(_0x0c49('0x0'));var VoicePrefix=require(_0x0c49('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0c49('0x2'),'afterUpdate':_0x0c49('0x3'),'afterDestroy':_0x0c49('0x4')};function emitEvent(_0xc64b04){return function(_0x155e79,_0x50248f,_0x1f0a66){VoicePrefixEvents[_0x0c49('0x5')](_0xc64b04+':'+_0x155e79['id'],_0x155e79);VoicePrefixEvents[_0x0c49('0x5')](_0xc64b04,_0x155e79);_0x1f0a66(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xf809=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x21f4d7,_0x5d60fe){var _0x5d1e01=function(_0x4e36da){while(--_0x4e36da){_0x21f4d7['push'](_0x21f4d7['shift']());}};_0x5d1e01(++_0x5d60fe);}(_0xf809,0x1f1));var _0x9f80=function(_0x236af4,_0x1d1aef){_0x236af4=_0x236af4-0x0;var _0x20c76c=_0xf809[_0x236af4];return _0x20c76c;};'use strict';var EventEmitter=require(_0x9f80('0x0'));var VoicePrefix=require(_0x9f80('0x1'))['db'][_0x9f80('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9f80('0x3')](0x0);var events={'afterCreate':_0x9f80('0x4'),'afterUpdate':_0x9f80('0x5'),'afterDestroy':_0x9f80('0x6')};function emitEvent(_0x5ba04a){return function(_0x62aaad,_0x578e13,_0x1c4f53){VoicePrefixEvents[_0x9f80('0x7')](_0x5ba04a+':'+_0x62aaad['id'],_0x62aaad);VoicePrefixEvents[_0x9f80('0x7')](_0x5ba04a,_0x62aaad);_0x1c4f53(null);};}for(var e in events){if(events[_0x9f80('0x8')](e)){var event=events[e];VoicePrefix[_0x9f80('0x9')](e,emitEvent(event));}}module[_0x9f80('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 603dede..b50fffc 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 _0x6c95=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes'];(function(_0x5d672b,_0x28f0e4){var _0x3268fc=function(_0x47aa90){while(--_0x47aa90){_0x5d672b['push'](_0x5d672b['shift']());}};_0x3268fc(++_0x28f0e4);}(_0x6c95,0x114));var _0x56c9=function(_0x4b5ce4,_0x3dae5e){_0x4b5ce4=_0x4b5ce4-0x0;var _0x46fac6=_0x6c95[_0x4b5ce4];return _0x46fac6;};'use strict';var _=require('lodash');var util=require(_0x56c9('0x0'));var logger=require(_0x56c9('0x1'))('api');var moment=require(_0x56c9('0x2'));var BPromise=require(_0x56c9('0x3'));var rp=require(_0x56c9('0x4'));var fs=require('fs');var path=require(_0x56c9('0x5'));var rimraf=require(_0x56c9('0x6'));var config=require(_0x56c9('0x7'));var attributes=require(_0x56c9('0x8'));module[_0x56c9('0x9')]=function(_0x1c7f28,_0x1e8f93){return _0x1c7f28[_0x56c9('0xa')]('VoicePrefix',attributes,{'tableName':_0x56c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b02=['../../config/environment','./voicePrefix.attributes','define','voice_prefixes','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x54509f,_0x441364){var _0x5bc748=function(_0x458adf){while(--_0x458adf){_0x54509f['push'](_0x54509f['shift']());}};_0x5bc748(++_0x441364);}(_0x3b02,0x1f0));var _0x23b0=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x3b02[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x23b0('0x0'));var util=require('util');var logger=require(_0x23b0('0x1'))(_0x23b0('0x2'));var moment=require(_0x23b0('0x3'));var BPromise=require(_0x23b0('0x4'));var rp=require(_0x23b0('0x5'));var fs=require('fs');var path=require(_0x23b0('0x6'));var rimraf=require(_0x23b0('0x7'));var config=require(_0x23b0('0x8'));var attributes=require(_0x23b0('0x9'));module['exports']=function(_0x11a3f2,_0x590db5){return _0x11a3f2[_0x23b0('0xa')]('VoicePrefix',attributes,{'tableName':_0x23b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 49368cc..32f484d 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 _0xa786=['stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1cba9a,_0x5d570d){var _0x5c894c=function(_0x12ff82){while(--_0x12ff82){_0x1cba9a['push'](_0x1cba9a['shift']());}};_0x5c894c(++_0x5d570d);}(_0xa786,0x71));var _0x6a78=function(_0x4121ac,_0xcb61d7){_0x4121ac=_0x4121ac-0x0;var _0x31d39f=_0xa786[_0x4121ac];return _0x31d39f;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a78('0x4'));var logger=require(_0x6a78('0x5'))(_0x6a78('0x6'));var config=require(_0x6a78('0x7'));var jayson=require(_0x6a78('0x8'));var client=jayson[_0x6a78('0x9')][_0x6a78('0xa')]({'port':0x232a});config['redis']=_[_0x6a78('0xb')](config[_0x6a78('0xc')],{'host':_0x6a78('0xd'),'port':0x18eb});var socket=require(_0x6a78('0xe'))(new Redis(config[_0x6a78('0xc')]));require(_0x6a78('0xf'))[_0x6a78('0x10')](socket);function respondWithRpcPromise(_0x2364b5,_0x43e233,_0x5dd2d2){return new BPromise(function(_0x25b436,_0x1fca69){return client[_0x6a78('0x11')](_0x2364b5,_0x5dd2d2)['then'](function(_0x2a433a){logger[_0x6a78('0x12')](_0x6a78('0x13'),_0x43e233,_0x6a78('0x14'));logger[_0x6a78('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x43e233,_0x6a78('0x14'),JSON[_0x6a78('0x16')](_0x2a433a));if(_0x2a433a[_0x6a78('0x17')]){if(_0x2a433a['error'][_0x6a78('0x18')]===0x1f4){logger[_0x6a78('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x43e233,_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);return _0x1fca69(_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);}logger[_0x6a78('0x17')](_0x6a78('0x13'),_0x43e233,_0x2a433a['error'][_0x6a78('0x19')]);return _0x25b436(_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);}else{logger[_0x6a78('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x43e233,'request\x20sent');_0x25b436(_0x2a433a[_0x6a78('0x1a')]['message']);}})['catch'](function(_0x4efb20){logger[_0x6a78('0x17')](_0x6a78('0x13'),_0x43e233,_0x4efb20);_0x1fca69(_0x4efb20);});});} \ No newline at end of file +var _0x363e=['localhost','socket.io-emitter','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0xe2ae0d,_0x2cefad){var _0x4c787c=function(_0x29b4cf){while(--_0x29b4cf){_0xe2ae0d['push'](_0xe2ae0d['shift']());}};_0x4c787c(++_0x2cefad);}(_0x363e,0x179));var _0xe363=function(_0x2de426,_0x161d7a){_0x2de426=_0x2de426-0x0;var _0x61504e=_0x363e[_0x2de426];return _0x61504e;};'use strict';var _=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var moment=require('moment');var BPromise=require(_0xe363('0x2'));var rs=require(_0xe363('0x3'));var fs=require('fs');var Redis=require(_0xe363('0x4'));var db=require(_0xe363('0x5'))['db'];var utils=require(_0xe363('0x6'));var logger=require(_0xe363('0x7'))(_0xe363('0x8'));var config=require(_0xe363('0x9'));var jayson=require(_0xe363('0xa'));var client=jayson[_0xe363('0xb')][_0xe363('0xc')]({'port':0x232a});config['redis']=_[_0xe363('0xd')](config[_0xe363('0xe')],{'host':_0xe363('0xf'),'port':0x18eb});var socket=require(_0xe363('0x10'))(new Redis(config['redis']));require(_0xe363('0x11'))[_0xe363('0x12')](socket);function respondWithRpcPromise(_0x18cfa8,_0x46076b,_0x29a78c){return new BPromise(function(_0x4133e9,_0x3304a1){return client['request'](_0x18cfa8,_0x29a78c)[_0xe363('0x13')](function(_0x45cd96){logger['info'](_0xe363('0x14'),_0x46076b,'request\x20sent');logger['debug'](_0xe363('0x15'),_0x46076b,_0xe363('0x16'),JSON[_0xe363('0x17')](_0x45cd96));if(_0x45cd96[_0xe363('0x18')]){if(_0x45cd96[_0xe363('0x18')]['code']===0x1f4){logger[_0xe363('0x18')](_0xe363('0x14'),_0x46076b,_0x45cd96['error'][_0xe363('0x19')]);return _0x3304a1(_0x45cd96[_0xe363('0x18')]['message']);}logger[_0xe363('0x18')](_0xe363('0x14'),_0x46076b,_0x45cd96['error'][_0xe363('0x19')]);return _0x4133e9(_0x45cd96[_0xe363('0x18')]['message']);}else{logger[_0xe363('0x1a')](_0xe363('0x14'),_0x46076b,_0xe363('0x16'));_0x4133e9(_0x45cd96['result'][_0xe363('0x19')]);}})[_0xe363('0x1b')](function(_0x5177f4){logger[_0xe363('0x18')](_0xe363('0x14'),_0x46076b,_0x5177f4);_0x3304a1(_0x5177f4);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 31d15f6..951a8a9 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 _0xd353=['update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0xfb1d57,_0x387896){var _0x5bc9c1=function(_0x2f0a81){while(--_0x2f0a81){_0xfb1d57['push'](_0xfb1d57['shift']());}};_0x5bc9c1(++_0x387896);}(_0xd353,0x7e));var _0x3d35=function(_0x4daef5,_0x419741){_0x4daef5=_0x4daef5-0x0;var _0x4a9d29=_0xd353[_0x4daef5];return _0x4a9d29;};'use strict';var VoicePrefixEvents=require(_0x3d35('0x0'));var events=[_0x3d35('0x1'),'remove',_0x3d35('0x2')];function createListener(_0x408bd9,_0x4e0c68){return function(_0x528f0e){_0x4e0c68[_0x3d35('0x3')](_0x408bd9,_0x528f0e);};}function removeListener(_0x4e0869,_0x3bc47e){return function(){VoicePrefixEvents[_0x3d35('0x4')](_0x4e0869,_0x3bc47e);};}exports[_0x3d35('0x5')]=function(_0xb43971){for(var _0x16965f=0x0,_0x174b6b=events[_0x3d35('0x6')];_0x16965f<_0x174b6b;_0x16965f++){var _0x5db879=events[_0x16965f];var _0x2dd75b=createListener(_0x3d35('0x7')+_0x5db879,_0xb43971);VoicePrefixEvents['on'](_0x5db879,_0x2dd75b);}}; \ No newline at end of file +var _0xd73a=['length','./voicePrefix.events','save','remove','update','emit','removeListener','register'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd73a,0x171));var _0xad73=function(_0x666cc6,_0x53441b){_0x666cc6=_0x666cc6-0x0;var _0x4e6d1d=_0xd73a[_0x666cc6];return _0x4e6d1d;};'use strict';var VoicePrefixEvents=require(_0xad73('0x0'));var events=[_0xad73('0x1'),_0xad73('0x2'),_0xad73('0x3')];function createListener(_0x6da8ec,_0x59c24f){return function(_0x5048f2){_0x59c24f[_0xad73('0x4')](_0x6da8ec,_0x5048f2);};}function removeListener(_0x216563,_0x279d4f){return function(){VoicePrefixEvents[_0xad73('0x5')](_0x216563,_0x279d4f);};}exports[_0xad73('0x6')]=function(_0x7d2258){for(var _0x247d3c=0x0,_0x2f4736=events[_0xad73('0x7')];_0x247d3c<_0x2f4736;_0x247d3c++){var _0x15cf28=events[_0x247d3c];var _0x1352b3=createListener('voicePrefix:'+_0x15cf28,_0x7d2258);VoicePrefixEvents['on'](_0x15cf28,_0x1352b3);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index eba8ea9..6c51553 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x1e8f35,_0x3db390){var _0x446c13=function(_0xa1e11e){while(--_0xa1e11e){_0x1e8f35['push'](_0x1e8f35['shift']());}};_0x446c13(++_0x3db390);}(_0xb10b,0x12a));var _0xbb10=function(_0x25979f,_0x32a3eb){_0x25979f=_0x25979f-0x0;var _0x4de4e7=_0xb10b[_0x25979f];return _0x4de4e7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x4f57e4,_0x18914d){var _0x4a584c=function(_0x312dcb){while(--_0x312dcb){_0x4f57e4['push'](_0x4f57e4['shift']());}};_0x4a584c(++_0x18914d);}(_0xb10b,0x12a));var _0xbb10=function(_0x45050c,_0x2c514e){_0x45050c=_0x45050c-0x0;var _0x43be36=_0xb10b[_0x45050c];return _0x43be36;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9798f9c..6ad8b53 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 _0x4685=['#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','ringall','leastrecent','fewestcalls','random','wrandom','rrordered','strategy','rrmemory','getDataValue','type','outbound','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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)','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x121801,_0x3e50bd){var _0x2859f1=function(_0x145628){while(--_0x145628){_0x121801['push'](_0x121801['shift']());}};_0x2859f1(++_0x3e50bd);}(_0x4685,0x160));var _0x5468=function(_0x4c49cd,_0x1b630d){_0x4c49cd=_0x4c49cd-0x0;var _0x29ba71=_0x4685[_0x4c49cd];return _0x29ba71;};'use strict';var Sequelize=require(_0x5468('0x0'));module[_0x5468('0x1')]={'name':{'type':Sequelize[_0x5468('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x5468('0x4')},'musiconhold':{'type':Sequelize[_0x5468('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x5468('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x5468('0x3')]('rr',_0x5468('0x5'),_0x5468('0x6'),_0x5468('0x7'),_0x5468('0x8'),'rrmemory','linear',_0x5468('0x9'),_0x5468('0xa')),'allowNull':![],'defaultValue':_0x5468('0x5'),'set':function(_0x5e42bf){this['setDataValue'](_0x5468('0xb'),_0x5e42bf?_0x5e42bf:_0x5468('0xc'));},'get':function(){var _0x5c47c4=this[_0x5468('0xd')](_0x5468('0xe'));var _0x52de26=this[_0x5468('0xd')]('dialMethod');var _0x233d35=this['getDataValue'](_0x5468('0xb'));if(_0x5c47c4===_0x5468('0xf')){if(_0x52de26===_0x5468('0x10')){return null;}if(_0x52de26===_0x5468('0x11')&&![_0x5468('0xc'),_0x5468('0x12')][_0x5468('0x13')](_0x233d35)){this[_0x5468('0x14')]('strategy','rrmemory');}}return _0x233d35;}},'servicelevel':{'type':Sequelize[_0x5468('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5468('0x15')](0xb)},'timeout':{'type':Sequelize[_0x5468('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5468('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5468('0x2')]},'weight':{'type':Sequelize[_0x5468('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5468('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no'),'defaultValue':_0x5468('0x16')},'autopause':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no',_0x5468('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5468('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x5468('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5468('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5468('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5468('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x5468('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5468('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x5468('0x16'),'no'),'defaultValue':_0x5468('0x16')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x5468('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x5468('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5468('0x2')]},'queue_youarenext':{'type':Sequelize[_0x5468('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5468('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5468('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5468('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x5468('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5468('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x5468('0x2')]},'queue_quantity1':{'type':Sequelize[_0x5468('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x5468('0x2')]},'queue_less_than':{'type':Sequelize[_0x5468('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x35769c){this[_0x5468('0x14')](_0x5468('0x19'),_0x35769c?_0x35769c[_0x5468('0x1a')](','):[]);},'get':function(){return this[_0x5468('0xd')](_0x5468('0x19'))?this['getDataValue'](_0x5468('0x19'))[_0x5468('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x5468('0x2')],'defaultValue':_0x5468('0x16'),'set':function(_0x52ab94){this[_0x5468('0x14')](_0x5468('0x1c'),_0x52ab94?_0x52ab94[_0x5468('0x1a')](','):undefined);},'get':function(){return this[_0x5468('0xd')](_0x5468('0x1c'))?this[_0x5468('0xd')](_0x5468('0x1c'))[_0x5468('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x453f72){this[_0x5468('0x14')](_0x5468('0x1d'),_0x453f72?_0x453f72['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x5468('0x1d'))?this['getDataValue'](_0x5468('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5468('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5468('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x5b9f8c){this[_0x5468('0x14')](_0x5468('0x1e'),_0x5b9f8c);if(_0x5b9f8c){if(this[_0x5468('0xd')](_0x5468('0x1f'))<0x2){this[_0x5468('0x14')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5468('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5468('0x20')],'defaultValue':0x0,'comment':_0x5468('0x21')},'dialMethod':{'type':Sequelize[_0x5468('0x3')]('preview','progressive','power',_0x5468('0x22'),_0x5468('0x11')),'defaultValue':_0x5468('0x23'),'comment':_0x5468('0x24')},'dialLimitChannel':{'type':Sequelize[_0x5468('0x15')](0x4)[_0x5468('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x5468('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5468('0x26')},'dialPowerLevel':{'type':Sequelize[_0x5468('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5468('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x5468('0x29'),_0x5468('0x2a')),'defaultValue':_0x5468('0x2a'),'comment':_0x5468('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5468('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5468('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5468('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5468('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5468('0x2e')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x5468('0x2f'),'comment':_0x5468('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5468('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5468('0x31')},'dialQueueProject':{'type':Sequelize[_0x5468('0x2')],'comment':_0x5468('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5468('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5468('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5468('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5468('0x15')](0x5)[_0x5468('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5468('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'defaultValue':0x3,'comment':_0x5468('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5468('0x15')](0x5)[_0x5468('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5468('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5468('0x37')},'dialTimezone':{'type':Sequelize[_0x5468('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5468('0x2')],'defaultValue':_0x5468('0x38')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x5468('0x39'),_0x5468('0x3a'),_0x5468('0x3b')),'defaultValue':_0x5468('0x39')},'dialAMDActive':{'type':Sequelize[_0x5468('0x20')],'defaultValue':0x0,'comment':_0x5468('0x3c')},'dialAMDInitialSilence':{'type':Sequelize[_0x5468('0x15')](0x9)[_0x5468('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5468('0x3d')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x5468('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5468('0x15')](0x9)[_0x5468('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5468('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5468('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5468('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x5468('0x15')](0x9)[_0x5468('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5468('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5468('0x15')](0x9)[_0x5468('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5468('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5468('0x15')](0x9)[_0x5468('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5468('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5468('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5468('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5468('0x44')},'dialRecallMeTimeout':{'type':Sequelize[_0x5468('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5468('0x45')},'dialRecallInQueue':{'type':Sequelize[_0x5468('0x20')],'defaultValue':0x0,'comment':_0x5468('0x46')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x5468('0x47'),_0x5468('0x48')),'defaultValue':_0x5468('0x47')},'dialQueueProject2':{'type':Sequelize[_0x5468('0x2')],'comment':_0x5468('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5468('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5468('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5468('0x49')},'dialCutDigit':{'type':Sequelize[_0x5468('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5468('0x4a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5468('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5468('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x5468('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5468('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5468('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5468('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x5468('0x15')](0x5)[_0x5468('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5468('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5468('0x15')](0x5)[_0x5468('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5468('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5468('0x15')],'allowNull':!![],'comment':_0x5468('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x5468('0x20')],'defaultValue':![],'comment':_0x5468('0x51'),'set':function(_0x329d30){if(!_0x329d30)this[_0x5468('0x14')](_0x5468('0x52'),null);this[_0x5468('0x14')](_0x5468('0x53'),_0x329d30);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5468('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5468('0x15')](0x3)[_0x5468('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x5468('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0xc901=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','strategy','getDataValue','type','dialMethod','booked','setDataValue','INTEGER','yes','all','once','TEXT','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','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','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xc901,0xea));var _0x1c90=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc901[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1c90('0x0'));module[_0x1c90('0x1')]={'name':{'type':Sequelize[_0x1c90('0x2')],'allowNull':![],'unique':_0x1c90('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x5'),_0x1c90('0x6')),'allowNull':![],'defaultValue':_0x1c90('0x5')},'musiconhold':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':_0x1c90('0x7')},'announce':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x1c90('0x8'),_0x1c90('0x9'),_0x1c90('0xa'),'random',_0x1c90('0xb'),'linear',_0x1c90('0xc'),_0x1c90('0xd')),'allowNull':![],'defaultValue':_0x1c90('0x8'),'set':function(_0x27d4fb){this['setDataValue'](_0x1c90('0xe'),_0x27d4fb?_0x27d4fb:_0x1c90('0xb'));},'get':function(){var _0x35bbe5=this[_0x1c90('0xf')](_0x1c90('0x10'));var _0x2f705d=this['getDataValue'](_0x1c90('0x11'));var _0x1a551d=this['getDataValue']('strategy');if(_0x35bbe5===_0x1c90('0x6')){if(_0x2f705d==='preview'){return null;}if(_0x2f705d===_0x1c90('0x12')&&![_0x1c90('0xb'),'roundrobin']['includes'](_0x1a551d)){this[_0x1c90('0x13')](_0x1c90('0xe'),_0x1c90('0xb'));}}return _0x1a551d;}},'servicelevel':{'type':Sequelize[_0x1c90('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1c90('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1c90('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x1c90('0x15'),'no'),'defaultValue':_0x1c90('0x15')},'autopause':{'type':Sequelize[_0x1c90('0x4')]('yes','no',_0x1c90('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1c90('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1c90('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x1c90('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x1c90('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x1c90('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1c90('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1c90('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1c90('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1c90('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x1c90('0x15'),'no'),'defaultValue':_0x1c90('0x15')},'announce_holdtime':{'type':Sequelize[_0x1c90('0x4')]('yes','no',_0x1c90('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x1c90('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1c90('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1c90('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1c90('0x2')]},'queue_quantity1':{'type':Sequelize[_0x1c90('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x1c90('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x1c90('0x18')],'set':function(_0x1e1324){this[_0x1c90('0x13')](_0x1c90('0x19'),_0x1e1324?_0x1e1324['join'](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this['getDataValue'](_0x1c90('0x19'))[_0x1c90('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':_0x1c90('0x15'),'set':function(_0x5337b1){this[_0x1c90('0x13')](_0x1c90('0x1b'),_0x5337b1?_0x5337b1['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x1c90('0x1b'))?this[_0x1c90('0xf')](_0x1c90('0x1b'))[_0x1c90('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':'no','set':function(_0x411d80){this['setDataValue'](_0x1c90('0x1c'),_0x411d80?_0x411d80[_0x1c90('0x1d')](','):undefined);},'get':function(){return this[_0x1c90('0xf')](_0x1c90('0x1c'))?this[_0x1c90('0xf')](_0x1c90('0x1c'))[_0x1c90('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1c90('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1c90('0x2')]},'acw':{'type':Sequelize[_0x1c90('0x1e')],'defaultValue':0x0,'set':function(_0x15bff2){this[_0x1c90('0x13')]('acw',_0x15bff2);if(_0x15bff2){if(this[_0x1c90('0xf')](_0x1c90('0x1f'))<0x2){this[_0x1c90('0x13')](_0x1c90('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1c90('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1c90('0x1e')],'defaultValue':0x0,'comment':_0x1c90('0x20')},'dialMethod':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x21'),_0x1c90('0x22'),'power',_0x1c90('0x23'),'booked'),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x1c90('0x14')](0x4)[_0x1c90('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1c90('0x25')},'dialLimitQueue':{'type':Sequelize[_0x1c90('0x14')](0x4)[_0x1c90('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1c90('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x1c90('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1c90('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x1c90('0x4')]('agentBusyFactor','dropRate'),'defaultValue':_0x1c90('0x28'),'comment':_0x1c90('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1c90('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x1c90('0x14')](0x3)[_0x1c90('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x1c90('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1c90('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1c90('0x14')](0x3)[_0x1c90('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1c90('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':_0x1c90('0x2c'),'comment':_0x1c90('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1c90('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x1c90('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1c90('0x14')](0x3)[_0x1c90('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1c90('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1c90('0x14')](0x5)[_0x1c90('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1c90('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1c90('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1c90('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1c90('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1c90('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1c90('0x14')](0x3)[_0x1c90('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1c90('0x14')](0x5)[_0x1c90('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x1c90('0x33')},'dialPrefix':{'type':Sequelize[_0x1c90('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x34'),_0x1c90('0x35'),_0x1c90('0x36')),'defaultValue':_0x1c90('0x34')},'dialAMDActive':{'type':Sequelize[_0x1c90('0x1e')],'defaultValue':0x0,'comment':_0x1c90('0x37')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1c90('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x1c90('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1c90('0x14')](0x9)[_0x1c90('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1c90('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1c90('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1c90('0x14')](0x9)[_0x1c90('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1c90('0x14')](0x9)[_0x1c90('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1c90('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1c90('0x14')](0x9)[_0x1c90('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1c90('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1c90('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1c90('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1c90('0x3c')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x1c90('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x1c90('0x1e')],'defaultValue':0x0,'comment':_0x1c90('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x3e'),_0x1c90('0x3f')),'defaultValue':_0x1c90('0x3e')},'dialQueueProject2':{'type':Sequelize[_0x1c90('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1c90('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1c90('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1c90('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1c90('0x40')},'dialCutDigit':{'type':Sequelize[_0x1c90('0x14')](0x3)[_0x1c90('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1c90('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1c90('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1c90('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1c90('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1c90('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x1c90('0x14')](0x3)[_0x1c90('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1c90('0x44')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1c90('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1c90('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1c90('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1c90('0x14')](0x5)[_0x1c90('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1c90('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1c90('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1c90('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1c90('0x14')](0x3)[_0x1c90('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1c90('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1c90('0x14')](0x5)[_0x1c90('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1c90('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1c90('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x1c90('0x1e')],'defaultValue':![],'comment':_0x1c90('0x4b'),'set':function(_0x13bb0c){if(!_0x13bb0c)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x1c90('0x13')](_0x1c90('0x4c'),_0x13bb0c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1c90('0x14')](0x3)[_0x1c90('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x1c90('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1c90('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1c90('0x14')](0x3)[_0x1c90('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 3969c91..3d66f31 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 _0x7fbe=['send','VoiceQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','inbound','outbound','update','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','CmHopperHistory','pick','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','emit','online','isNil','isArray','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','VoiceQueues','QueueCampaigns','filter','map','value','type','name','sendStatus','error'];(function(_0x39221a,_0xf9c0c2){var _0x14644d=function(_0x30c0b7){while(--_0x30c0b7){_0x39221a['push'](_0x39221a['shift']());}};_0x14644d(++_0xf9c0c2);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5aa992,_0x559ebb){_0x5aa992=_0x5aa992-0x0;var _0x2e2d59=_0x7fbe[_0x5aa992];return _0x2e2d59;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe7fb('0x0'));var _=require(_0xe7fb('0x1'));var squel=require(_0xe7fb('0x2'));var Redis=require(_0xe7fb('0x3'));var qs=require(_0xe7fb('0x4'));var logger=require(_0xe7fb('0x5'))(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var db=require(_0xe7fb('0x8'))['db'];config[_0xe7fb('0x9')]=_[_0xe7fb('0xa')](config[_0xe7fb('0x9')],{'host':_0xe7fb('0xb'),'port':0x18eb});var socket=require(_0xe7fb('0xc'))(new Redis(config['redis']));require(_0xe7fb('0xd'))[_0xe7fb('0xe')](socket);function respondWithStatusCode(_0x1d0741,_0x190a7a){_0x190a7a=_0x190a7a||0xcc;return function(_0x4ba197){if(_0x4ba197){return _0x1d0741['sendStatus'](_0x190a7a);}return _0x1d0741[_0xe7fb('0xf')](_0x190a7a)[_0xe7fb('0x10')]();};}function respondWithResult(_0x41a514,_0x348a73){_0x348a73=_0x348a73||0xc8;return function(_0x2a2223){if(_0x2a2223){return _0x41a514[_0xe7fb('0xf')](_0x348a73)[_0xe7fb('0x11')](_0x2a2223);}};}function respondWithFilteredResult(_0x3c07f3,_0x325035){return function(_0x2fe8ab){if(_0x2fe8ab){var _0x2437d4=typeof _0x325035[_0xe7fb('0x12')]===_0xe7fb('0x13')&&typeof _0x325035[_0xe7fb('0x14')]===_0xe7fb('0x13');var _0x598729=_0x2fe8ab[_0xe7fb('0x15')];var _0x2225e5=_0x2437d4?0x0:_0x325035['offset'];var _0x30015a=_0x2437d4?_0x2fe8ab[_0xe7fb('0x15')]:_0x325035['offset']+_0x325035[_0xe7fb('0x14')];var _0x559129;if(_0x30015a>=_0x598729){_0x30015a=_0x598729;_0x559129=0xc8;}else{_0x559129=0xce;}_0x3c07f3[_0xe7fb('0xf')](_0x559129);return _0x3c07f3[_0xe7fb('0x16')](_0xe7fb('0x17'),_0x2225e5+'-'+_0x30015a+'/'+_0x598729)[_0xe7fb('0x11')](_0x2fe8ab);}return null;};}function saveUpdates(_0x562262){return function(_0x892b0f){if(_0x892b0f){return _0x892b0f['update'](_0x562262)[_0xe7fb('0x18')](function(_0x546463){return _0x546463;});}return null;};}function removeEntity(_0x1e77fd){return function(_0x4708f7){if(_0x4708f7){return _0x4708f7[_0xe7fb('0x19')]()[_0xe7fb('0x18')](function(){var _0x5df1a1=_0x4708f7[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d1c87=[{'name':_0xe7fb('0x1b'),'value':'inbound','ignore':![]},{'name':_0xe7fb('0x1c'),'value':'outbound','ignore':![]}];var _0xa5af01=_(_0x5d1c87)[_0xe7fb('0x1d')]('ignore')[_0xe7fb('0x1e')](_0xe7fb('0x1f'))[_0xe7fb('0x1f')]();if(_['includes'](_0xa5af01,_0x5df1a1[_0xe7fb('0x20')])){return;}var _0x469ead=_['find'](_0x5d1c87,['value',_0x5df1a1['type']])[_0xe7fb('0x21')];return db['UserProfileResource']['destroy']({'where':{'type':_0x469ead,'resourceId':_0x5df1a1['id']}})[_0xe7fb('0x18')](function(){return _0x4708f7;});})[_0xe7fb('0x18')](function(){_0x1e77fd[_0xe7fb('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c930){return function(_0x2b69c4){if(!_0x2b69c4){_0x6c930[_0xe7fb('0x22')](0x194);}return _0x2b69c4;};}function handleError(_0x1ceed8,_0x392d75){_0x392d75=_0x392d75||0x1f4;return function(_0x16237a){logger[_0xe7fb('0x23')](_0x16237a['stack']);if(_0x16237a['name']){delete _0x16237a[_0xe7fb('0x21')];}_0x1ceed8[_0xe7fb('0xf')](_0x392d75)[_0xe7fb('0x24')](_0x16237a);};}exports['index']=function(_0xb1f2f4,_0x251807){var _0xd3fffe={};var _0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x1e')](db[_0xe7fb('0x25')][_0xe7fb('0x26')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x27')],'type':_0x4ce993[_0xe7fb('0x20')][_0xe7fb('0x28')]};});_0xd3fffe=qs['getOptions'](_0x219554,_0xb1f2f4);var _0x517d70={'where':_0xd3fffe[_0xe7fb('0x29')]};return db['VoiceQueue'][_0xe7fb('0x15')](_0x517d70)[_0xe7fb('0x18')](function(_0xe49053){_0x5f265f[_0xe7fb('0x15')]=_0xe49053;_0xd3fffe['include']=qs[_0xe7fb('0x2a')](_0xb1f2f4[_0xe7fb('0x2b')]);return db[_0xe7fb('0x25')][_0xe7fb('0x2c')](_0xd3fffe);})[_0xe7fb('0x18')](function(_0x480819){_0x5f265f[_0xe7fb('0x2d')]=_0x480819;return _0x5f265f;})[_0xe7fb('0x18')](respondWithFilteredResult(_0x251807,_0xd3fffe))[_0xe7fb('0x2e')](handleError(_0x251807,null));};exports[_0xe7fb('0x2f')]=function(_0x46f430,_0x25e925){var _0x1bc72d={'raw':![],'where':{'id':_0x46f430[_0xe7fb('0x30')]['id']}},_0x147eb1={};_0x147eb1['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')][_0xe7fb('0x26')]);_0x147eb1['query']=_[_0xe7fb('0x31')](_0x46f430[_0xe7fb('0x2b')]);_0x147eb1[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],_0x147eb1[_0xe7fb('0x2b')]);_0x1bc72d[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x1bc72d[_0xe7fb('0x35')]=_0x1bc72d[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x1bc72d[_0xe7fb('0x35')]:_0x147eb1[_0xe7fb('0x34')];if(_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x1bc72d['include']=[{'all':!![]}];}_0x1bc72d=_[_0xe7fb('0x39')]({},_0x1bc72d,_0x46f430[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x1bc72d)['then'](handleEntityNotFound(_0x25e925,null))[_0xe7fb('0x18')](respondWithResult(_0x25e925,null))[_0xe7fb('0x2e')](handleError(_0x25e925,null));};exports[_0xe7fb('0x3c')]=function(_0x413a13,_0x49fe9d){return db[_0xe7fb('0x25')][_0xe7fb('0x3c')](_0x413a13[_0xe7fb('0x3d')],{})[_0xe7fb('0x18')](function(_0x468d16){var _0xb729fc=_0x413a13['user'][_0xe7fb('0x1a')]({'plain':!![]});if(!_0xb729fc)throw new Error(_0xe7fb('0x3e'));if(_0xb729fc[_0xe7fb('0x3f')]==='user'){var _0x36a341=_0x468d16[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d42ac=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x900d67=_[_0xe7fb('0x3b')](_0x5d42ac,[_0xe7fb('0x1f'),_0x36a341['type']])[_0xe7fb('0x21')];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x900d67,'userProfileId':_0xb729fc[_0xe7fb('0x40')]},'raw':!![]})['then'](function(_0x108a16){if(_0x108a16&&_0x108a16[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x36a341['name'],'resourceId':_0x36a341['id'],'type':_0x108a16[_0xe7fb('0x21')],'sectionId':_0x108a16['id']},{})[_0xe7fb('0x18')](function(){return _0x468d16;});}else{return _0x468d16;}})[_0xe7fb('0x2e')](function(_0x56a84f){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x56a84f);throw _0x56a84f;});}return _0x468d16;})[_0xe7fb('0x18')](respondWithResult(_0x49fe9d,0xc9))[_0xe7fb('0x2e')](handleError(_0x49fe9d,null));};exports[_0xe7fb('0x44')]=function(_0x5a1ce1,_0x2eb999){var _0x4df4aa={'where':{'id':_0x5a1ce1[_0xe7fb('0x30')]['id']}},_0x2c72dd={};_0x2c72dd[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')]['rawAttributes']);_0x4df4aa[_0xe7fb('0x35')]=_['intersection'](_0x2c72dd['model'],qs[_0xe7fb('0x36')](_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4df4aa['attributes']=_0x4df4aa[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x4df4aa['attributes']:_0x2c72dd['model'];if(_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4df4aa[_0xe7fb('0x2a')]=[{'all':!![]}];}_0x4df4aa=_[_0xe7fb('0x39')]({},_0x4df4aa,_0x5a1ce1[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x4df4aa)[_0xe7fb('0x18')](handleEntityNotFound(_0x2eb999,null))['then'](function(_0x925a5e){if(_0x925a5e){var _0x5cc28f=_0x925a5e[_0xe7fb('0x1a')]({'plain':!![]});_0x5cc28f=qs[_0xe7fb('0x45')](_0x5cc28f,['id','createdAt',_0xe7fb('0x46')]);_0x5a1ce1['body']=_[_0xe7fb('0x45')](_0x5a1ce1['body'],['id',_0xe7fb('0x47'),'updatedAt']);return db[_0xe7fb('0x25')]['create'](_[_0xe7fb('0x39')](_0x5cc28f,_0x5a1ce1[_0xe7fb('0x3d')]),{'include':_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]?[{'all':!![]}]:undefined})[_0xe7fb('0x18')](function(_0x2f959d){var _0x2f4760=_0x5a1ce1['user']['get']({'plain':!![]});if(!_0x2f4760)throw new Error(_0xe7fb('0x3e'));if(_0x2f4760['role']==='user'){var _0x4c3eb7=_0x2f959d['get']({'plain':!![]});var _0x539252=[{'name':_0xe7fb('0x1b'),'value':_0xe7fb('0x48')},{'name':_0xe7fb('0x1c'),'value':_0xe7fb('0x49')}];var _0x59c92d=_[_0xe7fb('0x3b')](_0x539252,[_0xe7fb('0x1f'),_0x4c3eb7[_0xe7fb('0x20')]])['name'];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x59c92d,'userProfileId':_0x2f4760[_0xe7fb('0x40')]},'raw':!![]})[_0xe7fb('0x18')](function(_0x4f4ba3){if(_0x4f4ba3&&_0x4f4ba3[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x4c3eb7[_0xe7fb('0x21')],'resourceId':_0x4c3eb7['id'],'type':_0x4f4ba3['name'],'sectionId':_0x4f4ba3['id']},{})['then'](function(){return _0x2f959d;});}else{return _0x2f959d;}})[_0xe7fb('0x2e')](function(_0x3104c2){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x3104c2);throw _0x3104c2;});}return _0x2f959d;});}})[_0xe7fb('0x18')](respondWithResult(_0x2eb999,0xc9))['catch'](handleError(_0x2eb999,null));};exports[_0xe7fb('0x4a')]=function(_0x349a2a,_0x23755b){if(_0x349a2a['body']['id']){delete _0x349a2a['body']['id'];}return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x349a2a[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23755b,null))[_0xe7fb('0x18')](saveUpdates(_0x349a2a[_0xe7fb('0x3d')],null))['then'](respondWithResult(_0x23755b,null))[_0xe7fb('0x2e')](handleError(_0x23755b,null));};exports[_0xe7fb('0x19')]=function(_0x2cd4e5,_0x1aef59){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x2cd4e5['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1aef59,null))['then'](removeEntity(_0x1aef59,null))[_0xe7fb('0x2e')](handleError(_0x1aef59,null));};exports[_0xe7fb('0x4b')]=function(_0x116c7e,_0x1b24fd){var _0x5925e6={'raw':![],'where':{}};var _0x47ac92={};var _0x2789a4={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x116c7e[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1b24fd,null))['then'](function(_0x4096d4){if(_0x4096d4){_0x47ac92['model']=_[_0xe7fb('0x31')](db['CmHopper']['rawAttributes']);_0x47ac92[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x116c7e[_0xe7fb('0x2b')]);_0x47ac92['filters']=_[_0xe7fb('0x33')](_0x47ac92[_0xe7fb('0x34')],_0x47ac92[_0xe7fb('0x2b')]);_0x5925e6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x47ac92['model'],qs[_0xe7fb('0x36')](_0x116c7e[_0xe7fb('0x2b')]['fields']));_0x5925e6[_0xe7fb('0x35')]=_0x5925e6[_0xe7fb('0x35')]['length']?_0x5925e6[_0xe7fb('0x35')]:_0x47ac92['model'];if(!_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x5925e6['limit']=qs[_0xe7fb('0x14')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x5925e6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0x5925e6[_0xe7fb('0x4f')]=qs['sort'](_0x116c7e['query'][_0xe7fb('0x50')]);_0x5925e6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x116c7e['query'],_0x47ac92[_0xe7fb('0x32')]));_0x5925e6[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4096d4['id'];if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x5925e6[_0xe7fb('0x29')]=_[_0xe7fb('0x39')](_0x5925e6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x5925e6[_0xe7fb('0x35')],function(_0x1ff5e7){var _0xf423ab={};_0xf423ab[_0x1ff5e7]={'$like':'%'+_0x116c7e[_0xe7fb('0x2b')]['filter']+'%'};return _0xf423ab;})});}_0x5925e6=_['merge']({},_0x5925e6,_0x116c7e[_0xe7fb('0x3a')]);return db[_0xe7fb('0x52')][_0xe7fb('0x15')]({'where':_0x5925e6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x562493){_0x2789a4[_0xe7fb('0x15')]=_0x562493;if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x5925e6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x52')][_0xe7fb('0x2c')](_0x5925e6);})[_0xe7fb('0x18')](function(_0x1e6256){_0x2789a4[_0xe7fb('0x2d')]=_0x1e6256;return _0x2789a4;});}})['then'](respondWithFilteredResult(_0x1b24fd,_0x5925e6))[_0xe7fb('0x2e')](handleError(_0x1b24fd,null));};exports['getHopperHistories']=function(_0x279663,_0x2f13f2){var _0x2a2079={'raw':!![],'where':{}};var _0x31c159={};var _0x318d06={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x279663[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x2f13f2,null))[_0xe7fb('0x18')](function(_0x15d881){if(_0x15d881){_0x31c159[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x53')][_0xe7fb('0x26')]);_0x31c159[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x279663[_0xe7fb('0x2b')]);_0x31c159[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x31c159['model'],_0x31c159['query']);_0x2a2079['attributes']=_[_0xe7fb('0x33')](_0x31c159[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x279663[_0xe7fb('0x2b')]['fields']));_0x2a2079[_0xe7fb('0x35')]=_0x2a2079[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2a2079[_0xe7fb('0x35')]:_0x31c159['model'];if(!_0x279663[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2a2079[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2a2079['offset']=qs[_0xe7fb('0x12')](_0x279663['query'][_0xe7fb('0x12')]);}_0x2a2079['order']=qs[_0xe7fb('0x50')](_0x279663[_0xe7fb('0x2b')]['sort']);_0x2a2079[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x279663[_0xe7fb('0x2b')],_0x31c159['filters']));_0x2a2079[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x15d881['id'];if(_0x279663[_0xe7fb('0x2b')]['filter']){_0x2a2079[_0xe7fb('0x29')]=_['merge'](_0x2a2079['where'],{'$or':_['map'](_0x2a2079[_0xe7fb('0x35')],function(_0x27019a){var _0x4a8a65={};_0x4a8a65[_0x27019a]={'$like':'%'+_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4a8a65;})});}_0x2a2079=_[_0xe7fb('0x39')]({},_0x2a2079,_0x279663[_0xe7fb('0x3a')]);return db[_0xe7fb('0x53')][_0xe7fb('0x15')]({'where':_0x2a2079[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x42190e){_0x318d06[_0xe7fb('0x15')]=_0x42190e;if(_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x2a2079[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x53')][_0xe7fb('0x2c')](_0x2a2079);})[_0xe7fb('0x18')](function(_0x3c5bd9){_0x318d06[_0xe7fb('0x2d')]=_0x3c5bd9;return _0x318d06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x2f13f2,_0x2a2079))[_0xe7fb('0x2e')](handleError(_0x2f13f2,null));};exports['getHopperFinals']=function(_0x47568c,_0x185ac0){var _0xc3958f={'raw':!![],'where':{}};var _0x1b8fdb={};var _0x19fe06={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x47568c['params']['id']}})['then'](handleEntityNotFound(_0x185ac0,null))[_0xe7fb('0x18')](function(_0x4e1865){if(_0x4e1865){_0x1b8fdb[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['CmHopperFinal'][_0xe7fb('0x26')]);_0x1b8fdb[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x47568c[_0xe7fb('0x2b')]);_0x1b8fdb[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x1b8fdb['model'],_0x1b8fdb[_0xe7fb('0x2b')]);_0xc3958f[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x1b8fdb[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x47568c[_0xe7fb('0x2b')]['fields']));_0xc3958f['attributes']=_0xc3958f['attributes'][_0xe7fb('0x37')]?_0xc3958f[_0xe7fb('0x35')]:_0x1b8fdb[_0xe7fb('0x34')];if(!_0x47568c['query'][_0xe7fb('0x4d')]('nolimit')){_0xc3958f[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0xc3958f['offset']=qs[_0xe7fb('0x12')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0xc3958f[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0xc3958f[_0xe7fb('0x29')]=qs['filters'](_['pick'](_0x47568c[_0xe7fb('0x2b')],_0x1b8fdb['filters']));_0xc3958f[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4e1865['id'];if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0xc3958f['where']=_['merge'](_0xc3958f[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0xc3958f['attributes'],function(_0x21cb12){var _0x431d21={};_0x431d21[_0x21cb12]={'$like':'%'+_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x431d21;})});}_0xc3958f=_[_0xe7fb('0x39')]({},_0xc3958f,_0x47568c[_0xe7fb('0x3a')]);return db['CmHopperFinal'][_0xe7fb('0x15')]({'where':_0xc3958f[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x2607b9){_0x19fe06[_0xe7fb('0x15')]=_0x2607b9;if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0xc3958f[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x55')][_0xe7fb('0x2c')](_0xc3958f);})[_0xe7fb('0x18')](function(_0x3b1a90){_0x19fe06[_0xe7fb('0x2d')]=_0x3b1a90;return _0x19fe06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x185ac0,_0xc3958f))[_0xe7fb('0x2e')](handleError(_0x185ac0,null));};exports[_0xe7fb('0x56')]=function(_0x27c100,_0x19e86f){var _0x4b4cf6={'raw':!![],'where':{}};var _0x173d85={};var _0xa1368a={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x27c100['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x19e86f,null))[_0xe7fb('0x18')](function(_0x4ca09c){if(_0x4ca09c){_0x173d85[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x57')]['rawAttributes']);_0x173d85[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x27c100['query']);_0x173d85['filters']=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],_0x173d85[_0xe7fb('0x2b')]);_0x4b4cf6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],qs['fields'](_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4b4cf6[_0xe7fb('0x35')]=_0x4b4cf6['attributes'][_0xe7fb('0x37')]?_0x4b4cf6[_0xe7fb('0x35')]:_0x173d85[_0xe7fb('0x34')];if(!_0x27c100[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x4b4cf6[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x27c100['query'][_0xe7fb('0x14')]);_0x4b4cf6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x27c100[_0xe7fb('0x2b')]['offset']);}_0x4b4cf6[_0xe7fb('0x4f')]=qs['sort'](_0x27c100[_0xe7fb('0x2b')]['sort']);_0x4b4cf6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x27c100['query'],_0x173d85[_0xe7fb('0x32')]));_0x4b4cf6['where'][_0xe7fb('0x51')]=_0x4ca09c['id'];if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x4b4cf6[_0xe7fb('0x29')]=_['merge'](_0x4b4cf6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x4b4cf6[_0xe7fb('0x35')],function(_0x27a822){var _0x5505e5={};_0x5505e5[_0x27a822]={'$like':'%'+_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x5505e5;})});}_0x4b4cf6=_[_0xe7fb('0x39')]({},_0x4b4cf6,_0x27c100[_0xe7fb('0x3a')]);return db[_0xe7fb('0x57')]['count']({'where':_0x4b4cf6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x54233){_0xa1368a[_0xe7fb('0x15')]=_0x54233;if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4b4cf6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x57')][_0xe7fb('0x2c')](_0x4b4cf6);})['then'](function(_0x795e32){_0xa1368a[_0xe7fb('0x2d')]=_0x795e32;return _0xa1368a;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x19e86f,_0x4b4cf6))[_0xe7fb('0x2e')](handleError(_0x19e86f,null));};exports[_0xe7fb('0x58')]=function(_0x16f2b1,_0x3a8154){var _0x51335c={};var _0x4f4772={};var _0x4ef7b4;var _0x1bcee7;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x16f2b1['params']['id']}})['then'](handleEntityNotFound(_0x3a8154,null))[_0xe7fb('0x18')](function(_0x5bd869){if(_0x5bd869){_0x4ef7b4=_0x5bd869;_0x4f4772[_0xe7fb('0x34')]=_['keys'](db[_0xe7fb('0x59')][_0xe7fb('0x26')]);_0x4f4772[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x16f2b1[_0xe7fb('0x2b')]);_0x4f4772[_0xe7fb('0x32')]=_['intersection'](_0x4f4772[_0xe7fb('0x34')],_0x4f4772[_0xe7fb('0x2b')]);_0x51335c[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x4f4772[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x16f2b1[_0xe7fb('0x2b')]['fields']));_0x51335c[_0xe7fb('0x35')]=_0x51335c[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x51335c[_0xe7fb('0x35')]:_0x4f4772['model'];_0x51335c[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x51335c[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x16f2b1['query'],_0x4f4772['filters']));if(_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x51335c['where']=_[_0xe7fb('0x39')](_0x51335c['where'],{'$or':_[_0xe7fb('0x1e')](_0x51335c[_0xe7fb('0x35')],function(_0x220d72){var _0x5ea91d={};_0x5ea91d[_0x220d72]={'$like':'%'+_0x16f2b1['query'][_0xe7fb('0x1d')]+'%'};return _0x5ea91d;})});}_0x51335c=_['merge']({},_0x51335c,_0x16f2b1['options']);return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x3b073e){if(_0x3b073e){_0x1bcee7=_0x3b073e[_0xe7fb('0x37')];if(!_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x51335c[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x51335c[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x249d6f){if(_0x249d6f){return _0x249d6f?{'count':_0x1bcee7,'rows':_0x249d6f}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x3a8154,null))['catch'](handleError(_0x3a8154,null));};exports[_0xe7fb('0x5a')]=function(_0x19ebe2,_0x3406ed){var _0x1631cc=_0x19ebe2['body'][_0xe7fb('0x5b')];var _0x21ee89=_[_0xe7fb('0x1e')](_0x1631cc,'id');return db[_0xe7fb('0x59')][_0xe7fb('0x2c')]({'where':{'id':_0x21ee89},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe7fb('0x21'),'online','voicePause','interface'],'raw':!![]}]})[_0xe7fb('0x18')](function(_0x5a97c8){if(_0x5a97c8){var _0x503ae2=_['flatMap'](_0x5a97c8,function(_0x2ccf71){var _0x35be16=_0x2ccf71[_0xe7fb('0x1a')]({'plain':!![]});_0x35be16[_0xe7fb('0x5c')][_0xe7fb('0x5d')](function(_0x1db971){_0x1db971['penalty']=_['find'](_0x1631cc,{'id':_0x35be16['id']})[_0xe7fb('0x5e')];});return _0x35be16['Agents'];});return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x19ebe2[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x3891ed){return db[_0xe7fb('0x5f')]['transaction'](function(_0x4aa499){return _0x3891ed[_0xe7fb('0x5a')](_0x21ee89,{'transaction':_0x4aa499})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x1631cc,function(_0x7a7a6b){return db[_0xe7fb('0x61')][_0xe7fb('0x62')]({'TeamId':_0x7a7a6b['id'],'VoiceQueueId':_0x19ebe2['params']['id'],'penalty':_0x7a7a6b[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x503ae2,function(_0x33d638){return db[_0xe7fb('0x63')]['findOrCreate']({'where':{'UserId':_0x33d638['id'],'VoiceQueueId':_0x19ebe2[_0xe7fb('0x30')]['id']},'defaults':{'penalty':_0x33d638[_0xe7fb('0x5e')]},'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise['each'](_['filter'](_0x503ae2,{'online':!![]}),function(_0x5d30ef){return db[_0xe7fb('0x64')]['upsert']({'membername':_0x5d30ef['name'],'UserId':_0x5d30ef['id'],'queue_name':_0x3891ed[_0xe7fb('0x21')],'VoiceQueueId':_0x3891ed['id'],'interface':_['isNil'](_0x5d30ef[_0xe7fb('0x65')])?util[_0xe7fb('0x66')](_0xe7fb('0x67'),_0x5d30ef[_0xe7fb('0x21')]):_0x5d30ef[_0xe7fb('0x65')],'paused':_0x5d30ef[_0xe7fb('0x68')]||![],'penalty':_0x5d30ef[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})['then'](function(){_0x503ae2[_0xe7fb('0x5d')](function(_0x16e9d4){socket['emit'](_0xe7fb('0x69'),{'UserId':_0x16e9d4['id'],'VoiceQueueId':_0x3891ed['id']});});});});});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x3406ed,null))[_0xe7fb('0x2e')](handleError(_0x3406ed,null));};exports[_0xe7fb('0x6a')]=function(_0x366acb,_0x4d2c92){return db['Team'][_0xe7fb('0x2c')]({'where':{'id':_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xe7fb('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe7fb('0x18')](handleEntityNotFound(_0x4d2c92,null))[_0xe7fb('0x18')](function(_0x2e276c){var _0x4efcdc=_[_0xe7fb('0x1e')](_0x2e276c,'id');var _0x146fc9=[];var _0x470718=[];var _0x55048c=squel[_0xe7fb('0x6d')]();_0x55048c[_0xe7fb('0x6e')]('tq.TeamId')[_0xe7fb('0x6f')](_0xe7fb('0x70'),'tq')['join'](_0xe7fb('0x71'),'ut',_0xe7fb('0x72'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x366acb[_0xe7fb('0x30')]['id']);for(var _0x5d9b58=0x0;_0x5d9b58<_0x2e276c['length'];_0x5d9b58+=0x1){let _0x5986f1=_0x2e276c[_0x5d9b58];for(var _0x23ec12=0x0;_0x23ec12<_0x5986f1[_0xe7fb('0x5c')][_0xe7fb('0x37')];_0x23ec12+=0x1){let _0x36be03=_0x5986f1['Agents'][_0x23ec12];var _0x29de1e=_0x55048c[_0xe7fb('0x44')]();_0x29de1e['where']('ut.UserId\x20=\x20?',_0x36be03['id']);_0x470718[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x29de1e[_0xe7fb('0x75')](),{'type':db[_0xe7fb('0x5f')]['QueryTypes'][_0xe7fb('0x76')]})[_0xe7fb('0x18')](function(_0xe52155){if(_0xe52155['length']===0x1){return _0x36be03['id'];}else{var _0x20b1fc=_[_0xe7fb('0x77')](_['map'](_0xe52155,_0xe7fb('0x78')),function(_0x6ec6b6){return _[_0xe7fb('0x79')](_0x4efcdc,_0x6ec6b6);});if(_0x20b1fc){return _0x36be03['id'];}}}));}}return BPromise[_0xe7fb('0x7a')](_0x470718)['then'](function(_0x4ed327){_0x146fc9=_(_0x146fc9)[_0xe7fb('0x7b')](_0x4ed327)[_0xe7fb('0x7c')]()[_0xe7fb('0x1f')]();return db['VoiceQueue'][_0xe7fb('0x3b')]({'where':{'id':_0x366acb[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x49fb4b){return db[_0xe7fb('0x5f')][_0xe7fb('0x7d')](function(_0x362fe1){return _0x49fb4b['removeTeams'](_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')],{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){if(!_[_0xe7fb('0x7e')](_0x146fc9)){return _0x49fb4b[_0xe7fb('0x7f')](_0x146fc9,{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x366acb['params']['id'],'UserId':_0x146fc9},'transaction':_0x362fe1});});}})[_0xe7fb('0x18')](function(){_0x146fc9[_0xe7fb('0x5d')](function(_0x5dadac){socket['emit'](_0xe7fb('0x80'),{'UserId':_0x5dadac,'VoiceQueueId':_0x49fb4b['id']});});});});});});})[_0xe7fb('0x18')](respondWithStatusCode(_0x4d2c92,null))[_0xe7fb('0x2e')](handleError(_0x4d2c92,null));};exports[_0xe7fb('0x81')]=function(_0x4b58de,_0x4386ea){var _0x41c771,_0x489c9d;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4b58de[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x4386ea,null))[_0xe7fb('0x18')](function(_0x39fef6){if(_0x39fef6){_0x489c9d=_0x39fef6;return _0x39fef6[_0xe7fb('0x81')](_0x4b58de['body'][_0xe7fb('0x6b')],_['omit'](_0x4b58de[_0xe7fb('0x3d')],['ids','id'])||{})['spread'](function(_0x260067){for(var _0xed4af4=0x0;_0xed4af4<_0x4b58de[_0xe7fb('0x3d')][_0xe7fb('0x6b')][_0xe7fb('0x37')];_0xed4af4+=0x1){socket[_0xe7fb('0x82')](_0xe7fb('0x69'),{'UserId':Number(_0x4b58de['body'][_0xe7fb('0x6b')][_0xed4af4]),'VoiceQueueId':Number(_0x4b58de[_0xe7fb('0x30')]['id'])});}return _0x260067;});}})[_0xe7fb('0x18')](function(_0x19a7ec){_0x41c771=_0x19a7ec||[];if(_0x489c9d){return db[_0xe7fb('0x6c')][_0xe7fb('0x2c')]({'where':{'id':_0x4b58de[_0xe7fb('0x3d')]['ids']},'attributes':['id',_0xe7fb('0x21'),_0xe7fb('0x83'),_0xe7fb('0x68'),'interface'],'raw':!![]});}})[_0xe7fb('0x18')](function(_0x52c758){if(!_['isEmpty'](_0x52c758)){var _0x4930c6=[];for(var _0x1a3d44=0x0;_0x1a3d44<_0x52c758[_0xe7fb('0x37')];_0x1a3d44++){if(_0x52c758[_0x1a3d44]['online']){_0x4930c6[_0xe7fb('0x74')](db[_0xe7fb('0x64')]['upsert']({'membername':_0x52c758[_0x1a3d44]['name'],'UserId':_0x52c758[_0x1a3d44]['id'],'queue_name':_0x489c9d[_0xe7fb('0x21')],'VoiceQueueId':_0x489c9d['id'],'interface':_[_0xe7fb('0x84')](_0x52c758[_0x1a3d44][_0xe7fb('0x65')])?util['format'](_0xe7fb('0x67'),_0x52c758[_0x1a3d44][_0xe7fb('0x21')]):_0x52c758[_0x1a3d44]['interface'],'paused':_0x52c758[_0x1a3d44]['voicePause']||![],'penalty':_0x4b58de[_0xe7fb('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4930c6);}})['then'](function(){return _0x41c771;})[_0xe7fb('0x18')](respondWithResult(_0x4386ea,null))[_0xe7fb('0x2e')](handleError(_0x4386ea,null));};exports['removeAgents']=function(_0x35b5ad,_0x55c935){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x35b5ad[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x55c935,null))[_0xe7fb('0x18')](function(_0x4736bf){if(_0x4736bf){return _0x4736bf[_0xe7fb('0x7f')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])[_0xe7fb('0x18')](function(){if(_[_0xe7fb('0x85')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])){for(var _0x5744a8=0x0;_0x5744a8<_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')]['length'];_0x5744a8+=0x1){socket['emit'](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad['query'][_0xe7fb('0x6b')][_0x5744a8]),'VoiceQueueId':Number(_0x35b5ad[_0xe7fb('0x30')]['id'])});}}else{socket[_0xe7fb('0x82')](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad[_0xe7fb('0x2b')]['ids']),'VoiceQueueId':Number(_0x35b5ad['params']['id'])});}});}})[_0xe7fb('0x18')](function(_0x27b153){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x35b5ad[_0xe7fb('0x30')]['id'],'UserId':_0x35b5ad['query'][_0xe7fb('0x6b')]}})['then'](function(){return _0x27b153;});})[_0xe7fb('0x18')](respondWithStatusCode(_0x55c935,null))[_0xe7fb('0x2e')](handleError(_0x55c935,null));};exports['getAgents']=function(_0x5d0f05,_0x519e35){var _0x16ae95={};var _0xb1a3fa={};var _0x59e676;var _0x577895;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x5d0f05['params']['id']}})['then'](handleEntityNotFound(_0x519e35,null))[_0xe7fb('0x18')](function(_0xe1613c){if(_0xe1613c){_0x59e676=_0xe1613c;_0xb1a3fa[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['User'][_0xe7fb('0x26')]);_0xb1a3fa[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x5d0f05[_0xe7fb('0x2b')]);_0xb1a3fa[_0xe7fb('0x32')]=_['intersection'](_0xb1a3fa['model'],_0xb1a3fa[_0xe7fb('0x2b')]);_0x16ae95[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0xb1a3fa[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x5d0f05['query'][_0xe7fb('0x36')]));_0x16ae95['attributes']=_0x16ae95['attributes'][_0xe7fb('0x37')]?_0x16ae95[_0xe7fb('0x35')]:_0xb1a3fa[_0xe7fb('0x34')];_0x16ae95[_0xe7fb('0x4f')]=qs['sort'](_0x5d0f05[_0xe7fb('0x2b')]['sort']);_0x16ae95['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x5d0f05[_0xe7fb('0x2b')],_0xb1a3fa[_0xe7fb('0x32')]));if(_0x5d0f05[_0xe7fb('0x2b')]['filter']){_0x16ae95['where']=_[_0xe7fb('0x39')](_0x16ae95['where'],{'$or':_['map'](_0x16ae95[_0xe7fb('0x35')],function(_0x5763dd){var _0x4cab2f={};_0x4cab2f[_0x5763dd]={'$like':'%'+_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4cab2f;})});}_0x16ae95=_[_0xe7fb('0x39')]({},_0x16ae95,_0x5d0f05[_0xe7fb('0x3a')]);return _0x59e676[_0xe7fb('0x86')](_0x16ae95);}})['then'](function(_0xcf6d2){if(_0xcf6d2){_0x577895=_0xcf6d2['length'];if(!_0x5d0f05['query'][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x16ae95[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x16ae95[_0xe7fb('0x12')]=qs['offset'](_0x5d0f05['query'][_0xe7fb('0x12')]);}return _0x59e676['getAgents'](_0x16ae95);}})[_0xe7fb('0x18')](function(_0x51ff1e){if(_0x51ff1e){return _0x51ff1e?{'count':_0x577895,'rows':_0x51ff1e}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x519e35,null))['catch'](handleError(_0x519e35,null));};exports[_0xe7fb('0x87')]=function(_0x4407ee,_0x56869b){var _0x2139e3={};var _0x2e0e13={};var _0x23e1db;var _0x2a2fa6;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x4407ee[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x56869b,null))[_0xe7fb('0x18')](function(_0x454ef0){if(_0x454ef0){_0x23e1db=_0x454ef0;_0x2e0e13['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x64')][_0xe7fb('0x26')]);_0x2e0e13[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4407ee[_0xe7fb('0x2b')]);_0x2e0e13[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],_0x2e0e13[_0xe7fb('0x2b')]);_0x2139e3[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x4407ee[_0xe7fb('0x2b')]['fields']));_0x2139e3['attributes']=_0x2139e3[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2139e3[_0xe7fb('0x35')]:_0x2e0e13[_0xe7fb('0x34')];_0x2139e3[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x2139e3['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4407ee[_0xe7fb('0x2b')],_0x2e0e13[_0xe7fb('0x32')]));if(_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x2139e3['where']=_[_0xe7fb('0x39')](_0x2139e3[_0xe7fb('0x29')],{'$or':_['map'](_0x2139e3[_0xe7fb('0x35')],function(_0x5dde83){var _0x21d86e={};_0x21d86e[_0x5dde83]={'$like':'%'+_0x4407ee['query'][_0xe7fb('0x1d')]+'%'};return _0x21d86e;})});}_0x2139e3=_[_0xe7fb('0x39')]({},_0x2139e3,_0x4407ee['options']);return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})[_0xe7fb('0x18')](function(_0x5892cd){if(_0x5892cd){_0x2a2fa6=_0x5892cd['length'];if(!_0x4407ee['query']['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2139e3[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2139e3[_0xe7fb('0x12')]=qs['offset'](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})['then'](function(_0x3c56ad){return _0x3c56ad?{'count':_0x2a2fa6,'rows':_0x3c56ad}:null;})['then'](respondWithResult(_0x56869b,null))[_0xe7fb('0x2e')](handleError(_0x56869b,null));};exports['getLists']=function(_0x4880a7,_0x27669f){var _0x3d8b9a={};var _0x3503ac={};var _0x413843;var _0x55ce0f;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x4880a7[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x27669f,null))[_0xe7fb('0x18')](function(_0x21d9b0){if(_0x21d9b0){_0x413843=_0x21d9b0;_0x3503ac[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x3503ac[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4880a7[_0xe7fb('0x2b')]);_0x3503ac[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],_0x3503ac[_0xe7fb('0x2b')]);_0x3d8b9a['attributes']=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],qs['fields'](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x3d8b9a[_0xe7fb('0x35')]=_0x3d8b9a['attributes'][_0xe7fb('0x37')]?_0x3d8b9a[_0xe7fb('0x35')]:_0x3503ac[_0xe7fb('0x34')];_0x3d8b9a[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4880a7[_0xe7fb('0x2b')]['sort']);_0x3d8b9a[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4880a7['query'],_0x3503ac[_0xe7fb('0x32')]));if(_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x3d8b9a[_0xe7fb('0x29')]=_['merge'](_0x3d8b9a[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x3d8b9a[_0xe7fb('0x35')],function(_0x39ffed){var _0x47e833={};_0x47e833[_0x39ffed]={'$like':'%'+_0x4880a7['query'][_0xe7fb('0x1d')]+'%'};return _0x47e833;})});}_0x3d8b9a=_[_0xe7fb('0x39')]({},_0x3d8b9a,_0x4880a7[_0xe7fb('0x3a')]);return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})['then'](function(_0x57750a){if(_0x57750a){_0x55ce0f=_0x57750a[_0xe7fb('0x37')];if(!_0x4880a7['query'][_0xe7fb('0x4d')]('nolimit')){_0x3d8b9a[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x3d8b9a[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})[_0xe7fb('0x18')](function(_0x14014d){if(_0x14014d){return _0x14014d?{'count':_0x55ce0f,'rows':_0x14014d}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x27669f,null))[_0xe7fb('0x2e')](handleError(_0x27669f,null));};exports[_0xe7fb('0x8a')]=function(_0x4d9a76,_0x23a49e){var _0x30651f=moment()[_0xe7fb('0x66')](_0xe7fb('0x8b'));var _0x582862,_0x5b6da5;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4d9a76[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23a49e,null))['then'](function(_0x4e09d8){if(_0x4e09d8){_0x5b6da5=_0x4e09d8;return _0x4e09d8[_0xe7fb('0x8a')](_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x6b')],_[_0xe7fb('0x45')](_0x4d9a76[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x2e2167){var _0xd7f440;_0x582862=_0x2e2167||[];var _0xc8055f=[];if(_0x2e2167){for(var _0x45b449=0x0;_0x45b449<_0x2e2167['length'];_0x45b449+=0x1){var _0x366c06=_0x2e2167[_0x45b449][_0xe7fb('0x1a')]({'plain':!![]});_0x5b6da5[_0xe7fb('0x8d')]=_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]?_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]:_0x5b6da5[_0xe7fb('0x8d')];switch(_0x5b6da5['dialCheckDuplicateType']){case _0xe7fb('0x8e'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))['fromQuery']([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()['field'](_0xe7fb('0x92'),_0xe7fb('0x92'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))['field']('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x4d9a76[_0xe7fb('0x30')]['id']['toString'](),'VoiceQueueId')[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27','createdAt')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')]('cm_contacts')[_0xe7fb('0x29')](_0xe7fb('0x97'))['where'](_0xe7fb('0x98'),_0x366c06['CmListId'][_0xe7fb('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe7fb('0x29')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe7fb('0x6e')](_0xe7fb('0x99'))['from'](_0xe7fb('0x9a'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')]()))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel['select']()['field'](_0xe7fb('0x9c'))['from']('cm_hopper')[_0xe7fb('0x29')]('VoiceQueueId\x20=\x20?',_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;case _0xe7fb('0x9d'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),'scheduledAt',_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x92'),_0xe7fb('0x92'))['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))['field'](_0x4d9a76['params']['id']['toString'](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06['CmListId']['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0'))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x9c'))['from'](_0xe7fb('0x91'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;default:_0xd7f440=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),'ListId',_0xe7fb('0x51'),'createdAt','updatedAt'],squel['select']()[_0xe7fb('0x6e')]('phone','phone')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id','ContactId')[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')]['toString'](),_0xe7fb('0x95'))['field'](_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06[_0xe7fb('0x96')]['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();}_0xc8055f['push'](db[_0xe7fb('0x5f')]['query'](_0xd7f440));}return BPromise[_0xe7fb('0x7a')](_0xc8055f);}})[_0xe7fb('0x18')](function(){var _0x20b22f=[];var _0x2e22c1=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0xa1'))['fromQuery']([_0xe7fb('0xa2'),_0xe7fb('0x92'),_0xe7fb('0xa3'),'createdAt',_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0xa4'))[_0xe7fb('0x6e')]('ci.item')[_0xe7fb('0x6e')](_0xe7fb('0xa5'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0xa6'),'ci')[_0xe7fb('0xa7')]('cm_hopper','h',_0xe7fb('0xa8'))[_0xe7fb('0x29')]('h.scheduledat=?',_0x30651f)[_0xe7fb('0x29')]('ci.ItemClass=?',_0xe7fb('0xa9')))[_0xe7fb('0x75')]();_0x20b22f[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x2e22c1));return BPromise[_0xe7fb('0x7a')](_0x20b22f);})[_0xe7fb('0x18')](function(){return _0x582862;})['then'](respondWithResult(_0x23a49e,null))[_0xe7fb('0x2e')](handleError(_0x23a49e,null));};exports[_0xe7fb('0xaa')]=function(_0x3c04f4,_0x290cc3){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x3c04f4['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x290cc3,null))[_0xe7fb('0x18')](function(_0x3ed48f){if(_0x3ed48f){return _0x3ed48f['removeLists'](_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')]);}})[_0xe7fb('0x18')](function(_0x2eeff4){if(_0x2eeff4){return db[_0xe7fb('0x52')]['destroy']({'where':{'ListId':_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')],'VoiceQueueId':_0x3c04f4[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x2eeff4;});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x290cc3,null))[_0xe7fb('0x2e')](handleError(_0x290cc3,null));};exports[_0xe7fb('0xab')]=function(_0xcaad94,_0x5b88bd){var _0x143dbb={};var _0x715444={};var _0x92a316;var _0x30a834;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0xcaad94[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x5b88bd,null))[_0xe7fb('0x18')](function(_0x1b1818){if(_0x1b1818){_0x92a316=_0x1b1818;_0x715444[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x715444[_0xe7fb('0x2b')]=_['keys'](_0xcaad94[_0xe7fb('0x2b')]);_0x715444[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],_0x715444[_0xe7fb('0x2b')]);_0x143dbb['attributes']=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0xcaad94['query']['fields']));_0x143dbb[_0xe7fb('0x35')]=_0x143dbb[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x143dbb[_0xe7fb('0x35')]:_0x715444['model'];_0x143dbb[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x143dbb['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0xcaad94['query'],_0x715444[_0xe7fb('0x32')]));if(_0xcaad94[_0xe7fb('0x2b')]['filter']){_0x143dbb['where']=_[_0xe7fb('0x39')](_0x143dbb[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x143dbb['attributes'],function(_0x3b2375){var _0x170347={};_0x170347[_0x3b2375]={'$like':'%'+_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x170347;})});}_0x143dbb=_['merge']({},_0x143dbb,_0xcaad94[_0xe7fb('0x3a')]);return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x2a984e){if(_0x2a984e){_0x30a834=_0x2a984e[_0xe7fb('0x37')];if(!_0xcaad94[_0xe7fb('0x2b')]['hasOwnProperty']('nolimit')){_0x143dbb[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x143dbb[_0xe7fb('0x12')]=qs['offset'](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x286382){if(_0x286382){return _0x286382?{'count':_0x30a834,'rows':_0x286382}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x5b88bd,null))[_0xe7fb('0x2e')](handleError(_0x5b88bd,null));};exports[_0xe7fb('0xac')]=function(_0x325c7b,_0x38472b){var _0x1a33f8;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x325c7b[_0xe7fb('0x30')]['id']}})['then'](handleEntityNotFound(_0x38472b,null))[_0xe7fb('0x18')](function(_0x291a8d){if(_0x291a8d){return _0x291a8d['addBlackLists'](_0x325c7b[_0xe7fb('0x3d')]['ids'],_[_0xe7fb('0x45')](_0x325c7b[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x3ade81){var _0x1b9ea2;_0x1a33f8=_0x3ade81||[];var _0x418561=[];if(_0x3ade81){for(var _0x3ec66a=0x0;_0x3ec66a<_0x3ade81[_0xe7fb('0x37')];_0x3ec66a+=0x1){var _0x1c76a1=_0x3ade81[_0x3ec66a][_0xe7fb('0x1a')]({'plain':!![]});_0x1b9ea2=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0xad'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')]('phone',_0xe7fb('0x92'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))['field'](_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x325c7b[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),'VoiceQueueId')[_0xe7fb('0x6e')](_0xe7fb('0xae'),_0xe7fb('0x47'))[_0xe7fb('0x6e')]('NOW()',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))[_0xe7fb('0x29')]('deletedAt\x20IS\x20NULL')[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')]())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();_0x418561[_0xe7fb('0x74')](db[_0xe7fb('0x5f')]['query'](_0x1b9ea2));}return BPromise[_0xe7fb('0x7a')](_0x418561);}})[_0xe7fb('0x18')](function(){return _0x1a33f8;})['then'](respondWithResult(_0x38472b,null))[_0xe7fb('0x2e')](handleError(_0x38472b,null));};exports['removeBlackLists']=function(_0x127051,_0x4d9376){return db[_0xe7fb('0x25')]['find']({'where':{'id':_0x127051['params']['id']}})['then'](handleEntityNotFound(_0x4d9376,null))['then'](function(_0x547d29){if(_0x547d29){return _0x547d29[_0xe7fb('0xaf')](_0x127051[_0xe7fb('0x2b')]['ids']);}})[_0xe7fb('0x18')](function(_0x5c0baf){if(_0x5c0baf){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x127051['query'][_0xe7fb('0x6b')],'VoiceQueueId':_0x127051[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x5c0baf;});}})['then'](respondWithStatusCode(_0x4d9376,null))[_0xe7fb('0x2e')](handleError(_0x4d9376,null));}; \ No newline at end of file +var _0x1cb9=['VoiceQueues','inbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','count','include','query','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','find','create','body','user','get','role','QueueCampaigns','outbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','getHoppers','CmHopper','nolimit','order','sort','pick','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','options','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','isEmpty','removeAgents','addAgents','spread','emit','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ContactId','phone','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','scheduledAt','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','offset','Content-Range','update','then','destroy'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4287f7,_0x41477a){_0x4287f7=_0x4287f7-0x0;var _0x3ee440=_0x1cb9[_0x4287f7];return _0x3ee440;};'use strict';var moment=require(_0x91cb('0x0'));var BPromise=require('bluebird');var util=require(_0x91cb('0x1'));var _=require(_0x91cb('0x2'));var squel=require(_0x91cb('0x3'));var Redis=require(_0x91cb('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x91cb('0x5'))(_0x91cb('0x6'));var config=require('../../config/environment');var db=require(_0x91cb('0x7'))['db'];config[_0x91cb('0x8')]=_[_0x91cb('0x9')](config[_0x91cb('0x8')],{'host':_0x91cb('0xa'),'port':0x18eb});var socket=require(_0x91cb('0xb'))(new Redis(config['redis']));require(_0x91cb('0xc'))['register'](socket);function respondWithStatusCode(_0x2fdfce,_0x4cf9ed){_0x4cf9ed=_0x4cf9ed||0xcc;return function(_0xa43e7a){if(_0xa43e7a){return _0x2fdfce[_0x91cb('0xd')](_0x4cf9ed);}return _0x2fdfce[_0x91cb('0xe')](_0x4cf9ed)[_0x91cb('0xf')]();};}function respondWithResult(_0x429928,_0x23ba9a){_0x23ba9a=_0x23ba9a||0xc8;return function(_0x21a0a5){if(_0x21a0a5){return _0x429928[_0x91cb('0xe')](_0x23ba9a)[_0x91cb('0x10')](_0x21a0a5);}};}function respondWithFilteredResult(_0x8c0097,_0x530d92){return function(_0x3c1f56){if(_0x3c1f56){var _0x366f09=typeof _0x530d92['offset']===_0x91cb('0x11')&&typeof _0x530d92[_0x91cb('0x12')]===_0x91cb('0x11');var _0x2c7d40=_0x3c1f56['count'];var _0x4cc6ef=_0x366f09?0x0:_0x530d92[_0x91cb('0x13')];var _0x3d22b7=_0x366f09?_0x3c1f56['count']:_0x530d92['offset']+_0x530d92[_0x91cb('0x12')];var _0xc3629e;if(_0x3d22b7>=_0x2c7d40){_0x3d22b7=_0x2c7d40;_0xc3629e=0xc8;}else{_0xc3629e=0xce;}_0x8c0097[_0x91cb('0xe')](_0xc3629e);return _0x8c0097['set'](_0x91cb('0x14'),_0x4cc6ef+'-'+_0x3d22b7+'/'+_0x2c7d40)[_0x91cb('0x10')](_0x3c1f56);}return null;};}function saveUpdates(_0x4f1554){return function(_0xc594e3){if(_0xc594e3){return _0xc594e3[_0x91cb('0x15')](_0x4f1554)[_0x91cb('0x16')](function(_0xcd1a78){return _0xcd1a78;});}return null;};}function removeEntity(_0x5cc1c3){return function(_0x3fba4f){if(_0x3fba4f){return _0x3fba4f[_0x91cb('0x17')]()['then'](function(){var _0x123847=_0x3fba4f['get']({'plain':!![]});var _0x55042a=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5b385a=_(_0x55042a)[_0x91cb('0x1a')](_0x91cb('0x1b'))[_0x91cb('0x1c')](_0x91cb('0x1d'))['value']();if(_[_0x91cb('0x1e')](_0x5b385a,_0x123847[_0x91cb('0x1f')])){return;}var _0x1fa837=_['find'](_0x55042a,[_0x91cb('0x1d'),_0x123847[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x21')][_0x91cb('0x17')]({'where':{'type':_0x1fa837,'resourceId':_0x123847['id']}})[_0x91cb('0x16')](function(){return _0x3fba4f;});})[_0x91cb('0x16')](function(){_0x5cc1c3[_0x91cb('0xe')](0xcc)[_0x91cb('0xf')]();});}};}function handleEntityNotFound(_0x4c8438){return function(_0x59bf3a){if(!_0x59bf3a){_0x4c8438[_0x91cb('0xd')](0x194);}return _0x59bf3a;};}function handleError(_0x554350,_0x1c67d2){_0x1c67d2=_0x1c67d2||0x1f4;return function(_0x34d372){logger[_0x91cb('0x22')](_0x34d372['stack']);if(_0x34d372[_0x91cb('0x20')]){delete _0x34d372['name'];}_0x554350[_0x91cb('0xe')](_0x1c67d2)[_0x91cb('0x23')](_0x34d372);};}exports[_0x91cb('0x24')]=function(_0x2fb473,_0x468908){var _0x504275={};var _0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x1c')](db[_0x91cb('0x25')][_0x91cb('0x26')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x27')],'type':_0x4944bd[_0x91cb('0x1f')][_0x91cb('0x28')]};});_0x504275=qs[_0x91cb('0x29')](_0x52670a,_0x2fb473);var _0xf296bc={'where':_0x504275[_0x91cb('0x2a')]};return db[_0x91cb('0x25')][_0x91cb('0x2b')](_0xf296bc)[_0x91cb('0x16')](function(_0x5e6ed3){_0x2f04a3[_0x91cb('0x2b')]=_0x5e6ed3;_0x504275[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x2fb473[_0x91cb('0x2d')]);return db[_0x91cb('0x25')]['findAll'](_0x504275);})[_0x91cb('0x16')](function(_0x74b443){_0x2f04a3[_0x91cb('0x2e')]=_0x74b443;return _0x2f04a3;})[_0x91cb('0x16')](respondWithFilteredResult(_0x468908,_0x504275))[_0x91cb('0x2f')](handleError(_0x468908,null));};exports['show']=function(_0x121c37,_0x5927cb){var _0x47fc17={'raw':![],'where':{'id':_0x121c37[_0x91cb('0x30')]['id']}},_0x479968={};_0x479968['model']=_[_0x91cb('0x31')](db['VoiceQueue']['rawAttributes']);_0x479968[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x121c37[_0x91cb('0x2d')]);_0x479968[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x479968['model'],_0x479968[_0x91cb('0x2d')]);_0x47fc17[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x479968[_0x91cb('0x35')],qs['fields'](_0x121c37['query'][_0x91cb('0x36')]));_0x47fc17[_0x91cb('0x34')]=_0x47fc17['attributes'][_0x91cb('0x37')]?_0x47fc17[_0x91cb('0x34')]:_0x479968['model'];if(_0x121c37[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x47fc17['include']=[{'all':!![]}];}_0x47fc17=_[_0x91cb('0x39')]({},_0x47fc17,_0x121c37['options']);return db[_0x91cb('0x25')][_0x91cb('0x3a')](_0x47fc17)[_0x91cb('0x16')](handleEntityNotFound(_0x5927cb,null))[_0x91cb('0x16')](respondWithResult(_0x5927cb,null))[_0x91cb('0x2f')](handleError(_0x5927cb,null));};exports[_0x91cb('0x3b')]=function(_0x5d0e37,_0xa90111){return db[_0x91cb('0x25')]['create'](_0x5d0e37[_0x91cb('0x3c')],{})['then'](function(_0x2c6102){var _0x2eac87=_0x5d0e37[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x2eac87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2eac87[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0x2cf27e=_0x2c6102[_0x91cb('0x3e')]({'plain':!![]});var _0x42a7f3=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19')},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x3cc4c1=_['find'](_0x42a7f3,[_0x91cb('0x1d'),_0x2cf27e['type']])[_0x91cb('0x20')];return db['UserProfileSection'][_0x91cb('0x3a')]({'where':{'name':_0x3cc4c1,'userProfileId':_0x2eac87['userProfileId']},'raw':!![]})[_0x91cb('0x16')](function(_0x477131){if(_0x477131&&_0x477131[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0x2cf27e[_0x91cb('0x20')],'resourceId':_0x2cf27e['id'],'type':_0x477131[_0x91cb('0x20')],'sectionId':_0x477131['id']},{})['then'](function(){return _0x2c6102;});}else{return _0x2c6102;}})[_0x91cb('0x2f')](function(_0x2f1749){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x2f1749);throw _0x2f1749;});}return _0x2c6102;})[_0x91cb('0x16')](respondWithResult(_0xa90111,0xc9))[_0x91cb('0x2f')](handleError(_0xa90111,null));};exports[_0x91cb('0x44')]=function(_0x29d5a1,_0x396b81){var _0x4b26f6={'where':{'id':_0x29d5a1[_0x91cb('0x30')]['id']}},_0x7c22b3={};_0x7c22b3[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x25')][_0x91cb('0x26')]);_0x4b26f6[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x7c22b3['model'],qs[_0x91cb('0x36')](_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4b26f6[_0x91cb('0x34')]=_0x4b26f6['attributes'][_0x91cb('0x37')]?_0x4b26f6[_0x91cb('0x34')]:_0x7c22b3['model'];if(_0x29d5a1[_0x91cb('0x2d')]['includeAll']){_0x4b26f6[_0x91cb('0x2c')]=[{'all':!![]}];}_0x4b26f6=_['merge']({},_0x4b26f6,_0x29d5a1['options']);return db['VoiceQueue'][_0x91cb('0x3a')](_0x4b26f6)[_0x91cb('0x16')](handleEntityNotFound(_0x396b81,null))[_0x91cb('0x16')](function(_0x2f8384){if(_0x2f8384){var _0x333814=_0x2f8384['get']({'plain':!![]});_0x333814=qs['omit'](_0x333814,['id',_0x91cb('0x45'),_0x91cb('0x46')]);_0x29d5a1[_0x91cb('0x3c')]=_[_0x91cb('0x47')](_0x29d5a1['body'],['id','createdAt','updatedAt']);return db[_0x91cb('0x25')]['create'](_[_0x91cb('0x39')](_0x333814,_0x29d5a1['body']),{'include':_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x38')]?[{'all':!![]}]:undefined})[_0x91cb('0x16')](function(_0x649976){var _0x1884bc=_0x29d5a1[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x1884bc)throw new Error(_0x91cb('0x48'));if(_0x1884bc[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0xd8f7c2=_0x649976['get']({'plain':!![]});var _0x1e445a=[{'name':_0x91cb('0x18'),'value':'inbound'},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x4bab7d=_[_0x91cb('0x3a')](_0x1e445a,[_0x91cb('0x1d'),_0xd8f7c2[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x49')][_0x91cb('0x3a')]({'where':{'name':_0x4bab7d,'userProfileId':_0x1884bc[_0x91cb('0x4a')]},'raw':!![]})[_0x91cb('0x16')](function(_0x3320bd){if(_0x3320bd&&_0x3320bd[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0xd8f7c2[_0x91cb('0x20')],'resourceId':_0xd8f7c2['id'],'type':_0x3320bd['name'],'sectionId':_0x3320bd['id']},{})[_0x91cb('0x16')](function(){return _0x649976;});}else{return _0x649976;}})['catch'](function(_0x3dfff9){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x3dfff9);throw _0x3dfff9;});}return _0x649976;});}})['then'](respondWithResult(_0x396b81,0xc9))[_0x91cb('0x2f')](handleError(_0x396b81,null));};exports[_0x91cb('0x15')]=function(_0x48dcf7,_0xef4754){if(_0x48dcf7[_0x91cb('0x3c')]['id']){delete _0x48dcf7[_0x91cb('0x3c')]['id'];}return db[_0x91cb('0x25')]['find']({'where':{'id':_0x48dcf7[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0xef4754,null))[_0x91cb('0x16')](saveUpdates(_0x48dcf7[_0x91cb('0x3c')],null))['then'](respondWithResult(_0xef4754,null))[_0x91cb('0x2f')](handleError(_0xef4754,null));};exports[_0x91cb('0x17')]=function(_0x5c2c01,_0x492b09){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x5c2c01[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x492b09,null))['then'](removeEntity(_0x492b09,null))['catch'](handleError(_0x492b09,null));};exports[_0x91cb('0x4b')]=function(_0x5c468a,_0x1b69ce){var _0x961ebf={'raw':![],'where':{}};var _0x33de58={};var _0x551836={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x5c468a[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1b69ce,null))[_0x91cb('0x16')](function(_0x2c1911){if(_0x2c1911){_0x33de58['model']=_[_0x91cb('0x31')](db[_0x91cb('0x4c')][_0x91cb('0x26')]);_0x33de58[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x5c468a[_0x91cb('0x2d')]);_0x33de58[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x33de58[_0x91cb('0x35')],_0x33de58[_0x91cb('0x2d')]);_0x961ebf[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x33de58['model'],qs[_0x91cb('0x36')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x961ebf[_0x91cb('0x34')]=_0x961ebf[_0x91cb('0x34')][_0x91cb('0x37')]?_0x961ebf[_0x91cb('0x34')]:_0x33de58['model'];if(!_0x5c468a[_0x91cb('0x2d')]['hasOwnProperty'](_0x91cb('0x4d'))){_0x961ebf[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x5c468a[_0x91cb('0x2d')]['limit']);_0x961ebf[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x961ebf[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x5c468a['query'][_0x91cb('0x4f')]);_0x961ebf[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x5c468a[_0x91cb('0x2d')],_0x33de58[_0x91cb('0x32')]));_0x961ebf[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x2c1911['id'];if(_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x961ebf[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x961ebf[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x961ebf[_0x91cb('0x34')],function(_0x2605c3){var _0x1d9ded={};_0x1d9ded[_0x2605c3]={'$like':'%'+_0x5c468a['query'][_0x91cb('0x1a')]+'%'};return _0x1d9ded;})});}_0x961ebf=_[_0x91cb('0x39')]({},_0x961ebf,_0x5c468a['options']);return db[_0x91cb('0x4c')][_0x91cb('0x2b')]({'where':_0x961ebf[_0x91cb('0x2a')]})['then'](function(_0x45e26b){_0x551836[_0x91cb('0x2b')]=_0x45e26b;if(_0x5c468a['query']['includeAll']){_0x961ebf[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopper'][_0x91cb('0x52')](_0x961ebf);})[_0x91cb('0x16')](function(_0x4e11e3){_0x551836[_0x91cb('0x2e')]=_0x4e11e3;return _0x551836;});}})['then'](respondWithFilteredResult(_0x1b69ce,_0x961ebf))[_0x91cb('0x2f')](handleError(_0x1b69ce,null));};exports[_0x91cb('0x53')]=function(_0x4f827e,_0x5d8a7e){var _0x16a21f={'raw':!![],'where':{}};var _0x43be3e={};var _0x37666a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x91cb('0x54')]({'where':{'id':_0x4f827e[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x5d8a7e,null))[_0x91cb('0x16')](function(_0x570f6b){if(_0x570f6b){_0x43be3e[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x55')][_0x91cb('0x26')]);_0x43be3e[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x4f827e['query']);_0x43be3e['filters']=_[_0x91cb('0x33')](_0x43be3e['model'],_0x43be3e[_0x91cb('0x2d')]);_0x16a21f[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x43be3e[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x16a21f['attributes']=_0x16a21f[_0x91cb('0x34')][_0x91cb('0x37')]?_0x16a21f['attributes']:_0x43be3e[_0x91cb('0x35')];if(!_0x4f827e['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x16a21f[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x16a21f[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x16a21f[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x16a21f[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x4f827e[_0x91cb('0x2d')],_0x43be3e['filters']));_0x16a21f[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x570f6b['id'];if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x16a21f[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x16a21f[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x16a21f['attributes'],function(_0xb5c264){var _0xdee7f={};_0xdee7f[_0xb5c264]={'$like':'%'+_0x4f827e['query']['filter']+'%'};return _0xdee7f;})});}_0x16a21f=_[_0x91cb('0x39')]({},_0x16a21f,_0x4f827e['options']);return db['CmHopperHistory'][_0x91cb('0x2b')]({'where':_0x16a21f['where']})[_0x91cb('0x16')](function(_0x498382){_0x37666a[_0x91cb('0x2b')]=_0x498382;if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x16a21f[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x91cb('0x52')](_0x16a21f);})[_0x91cb('0x16')](function(_0x42d07b){_0x37666a[_0x91cb('0x2e')]=_0x42d07b;return _0x37666a;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x5d8a7e,_0x16a21f))[_0x91cb('0x2f')](handleError(_0x5d8a7e,null));};exports[_0x91cb('0x57')]=function(_0x3cf8c5,_0x21dfd3){var _0x24facc={'raw':!![],'where':{}};var _0xafda63={};var _0x32704d={'count':0x0,'rows':[]};return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x3cf8c5[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x21dfd3,null))[_0x91cb('0x16')](function(_0x39fce4){if(_0x39fce4){_0xafda63[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x58')][_0x91cb('0x26')]);_0xafda63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3cf8c5[_0x91cb('0x2d')]);_0xafda63['filters']=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],_0xafda63[_0x91cb('0x2d')]);_0x24facc[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x24facc[_0x91cb('0x34')]=_0x24facc[_0x91cb('0x34')]['length']?_0x24facc[_0x91cb('0x34')]:_0xafda63['model'];if(!_0x3cf8c5['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x24facc[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x24facc[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x24facc['order']=qs[_0x91cb('0x4f')](_0x3cf8c5[_0x91cb('0x2d')]['sort']);_0x24facc[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3cf8c5[_0x91cb('0x2d')],_0xafda63[_0x91cb('0x32')]));_0x24facc[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x39fce4['id'];if(_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x24facc[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x24facc[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x24facc[_0x91cb('0x34')],function(_0x378cd0){var _0x538a8c={};_0x538a8c[_0x378cd0]={'$like':'%'+_0x3cf8c5['query'][_0x91cb('0x1a')]+'%'};return _0x538a8c;})});}_0x24facc=_[_0x91cb('0x39')]({},_0x24facc,_0x3cf8c5[_0x91cb('0x59')]);return db[_0x91cb('0x58')][_0x91cb('0x2b')]({'where':_0x24facc[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x5ac5cc){_0x32704d[_0x91cb('0x2b')]=_0x5ac5cc;if(_0x3cf8c5['query'][_0x91cb('0x38')]){_0x24facc[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x58')][_0x91cb('0x52')](_0x24facc);})[_0x91cb('0x16')](function(_0x4ac4dd){_0x32704d[_0x91cb('0x2e')]=_0x4ac4dd;return _0x32704d;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x21dfd3,_0x24facc))[_0x91cb('0x2f')](handleError(_0x21dfd3,null));};exports[_0x91cb('0x5a')]=function(_0x3a213e,_0x4e4003){var _0x4003c9={'raw':!![],'where':{}};var _0x9cff8f={};var _0x25a779={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a213e['params']['id']}})['then'](handleEntityNotFound(_0x4e4003,null))[_0x91cb('0x16')](function(_0x182aa5){if(_0x182aa5){_0x9cff8f[_0x91cb('0x35')]=_[_0x91cb('0x31')](db['CmHopperBlack'][_0x91cb('0x26')]);_0x9cff8f[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3a213e[_0x91cb('0x2d')]);_0x9cff8f['filters']=_['intersection'](_0x9cff8f[_0x91cb('0x35')],_0x9cff8f[_0x91cb('0x2d')]);_0x4003c9[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9cff8f[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4003c9[_0x91cb('0x34')]=_0x4003c9[_0x91cb('0x34')][_0x91cb('0x37')]?_0x4003c9[_0x91cb('0x34')]:_0x9cff8f[_0x91cb('0x35')];if(!_0x3a213e['query']['hasOwnProperty'](_0x91cb('0x4d'))){_0x4003c9['limit']=qs[_0x91cb('0x12')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x4003c9[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x4003c9[_0x91cb('0x4e')]=qs['sort'](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x4003c9[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x3a213e['query'],_0x9cff8f[_0x91cb('0x32')]));_0x4003c9[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x182aa5['id'];if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x4003c9['where']=_[_0x91cb('0x39')](_0x4003c9[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x4003c9[_0x91cb('0x34')],function(_0x440ef4){var _0x2c2ed8={};_0x2c2ed8[_0x440ef4]={'$like':'%'+_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x2c2ed8;})});}_0x4003c9=_[_0x91cb('0x39')]({},_0x4003c9,_0x3a213e[_0x91cb('0x59')]);return db[_0x91cb('0x5b')][_0x91cb('0x2b')]({'where':_0x4003c9[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x7c84fc){_0x25a779[_0x91cb('0x2b')]=_0x7c84fc;if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x4003c9[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x5b')][_0x91cb('0x52')](_0x4003c9);})[_0x91cb('0x16')](function(_0x275c80){_0x25a779[_0x91cb('0x2e')]=_0x275c80;return _0x25a779;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x4e4003,_0x4003c9))[_0x91cb('0x2f')](handleError(_0x4e4003,null));};exports['getTeams']=function(_0x16cf02,_0x2b8634){var _0x1eb46e={};var _0x261a3a={};var _0x16f334;var _0x5ca377;return db['VoiceQueue']['findOne']({'where':{'id':_0x16cf02['params']['id']}})['then'](handleEntityNotFound(_0x2b8634,null))[_0x91cb('0x16')](function(_0x46a6cc){if(_0x46a6cc){_0x16f334=_0x46a6cc;_0x261a3a[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x5c')][_0x91cb('0x26')]);_0x261a3a[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x16cf02[_0x91cb('0x2d')]);_0x261a3a[_0x91cb('0x32')]=_['intersection'](_0x261a3a[_0x91cb('0x35')],_0x261a3a[_0x91cb('0x2d')]);_0x1eb46e['attributes']=_[_0x91cb('0x33')](_0x261a3a[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x1eb46e[_0x91cb('0x34')]=_0x1eb46e[_0x91cb('0x34')]['length']?_0x1eb46e[_0x91cb('0x34')]:_0x261a3a[_0x91cb('0x35')];_0x1eb46e[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x1eb46e[_0x91cb('0x2a')]=qs['filters'](_[_0x91cb('0x50')](_0x16cf02['query'],_0x261a3a[_0x91cb('0x32')]));if(_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x1eb46e[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x1eb46e[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x1eb46e[_0x91cb('0x34')],function(_0x1c7c10){var _0x570cf0={};_0x570cf0[_0x1c7c10]={'$like':'%'+_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x570cf0;})});}_0x1eb46e=_[_0x91cb('0x39')]({},_0x1eb46e,_0x16cf02[_0x91cb('0x59')]);return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x189a87){if(_0x189a87){_0x5ca377=_0x189a87[_0x91cb('0x37')];if(!_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x1eb46e[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x16cf02['query'][_0x91cb('0x12')]);_0x1eb46e['offset']=qs[_0x91cb('0x13')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x12da14){if(_0x12da14){return _0x12da14?{'count':_0x5ca377,'rows':_0x12da14}:null;}})[_0x91cb('0x16')](respondWithResult(_0x2b8634,null))[_0x91cb('0x2f')](handleError(_0x2b8634,null));};exports['addTeams']=function(_0x3353bf,_0x5b3658){var _0x3c1703=_0x3353bf[_0x91cb('0x3c')][_0x91cb('0x5e')];var _0x598663=_[_0x91cb('0x1c')](_0x3c1703,'id');return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x598663},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]}]})['then'](function(_0x469e62){if(_0x469e62){var _0x1e9441=_[_0x91cb('0x62')](_0x469e62,function(_0x1bb2de){var _0x129ea0=_0x1bb2de[_0x91cb('0x3e')]({'plain':!![]});_0x129ea0[_0x91cb('0x63')][_0x91cb('0x64')](function(_0x50b8d6){_0x50b8d6[_0x91cb('0x65')]=_[_0x91cb('0x3a')](_0x3c1703,{'id':_0x129ea0['id']})[_0x91cb('0x65')];});return _0x129ea0[_0x91cb('0x63')];});return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3353bf['params']['id']}})[_0x91cb('0x16')](function(_0x43b620){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x3b0bd5){return _0x43b620['addTeams'](_0x598663,{'transaction':_0x3b0bd5})[_0x91cb('0x16')](function(){return BPromise['each'](_0x3c1703,function(_0x58608e){return db[_0x91cb('0x68')][_0x91cb('0x69')]({'TeamId':_0x58608e['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id'],'penalty':_0x58608e[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise[_0x91cb('0x6a')](_0x1e9441,function(_0x20ef3d){return db[_0x91cb('0x6b')]['findOrCreate']({'where':{'UserId':_0x20ef3d['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id']},'defaults':{'penalty':_0x20ef3d[_0x91cb('0x65')]},'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise['each'](_['filter'](_0x1e9441,{'online':!![]}),function(_0x530565){return db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x530565[_0x91cb('0x20')],'UserId':_0x530565['id'],'queue_name':_0x43b620['name'],'VoiceQueueId':_0x43b620['id'],'interface':_[_0x91cb('0x6d')](_0x530565[_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x530565['name']):_0x530565[_0x91cb('0x61')],'paused':_0x530565[_0x91cb('0x60')]||![],'penalty':_0x530565[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){_0x1e9441[_0x91cb('0x64')](function(_0x3c788e){socket['emit'](_0x91cb('0x70'),{'UserId':_0x3c788e['id'],'VoiceQueueId':_0x43b620['id']});});});});});}})[_0x91cb('0x16')](respondWithStatusCode(_0x5b3658,null))[_0x91cb('0x2f')](handleError(_0x5b3658,null));};exports[_0x91cb('0x71')]=function(_0x3782cd,_0x4b290e){return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')]},'attributes':['id'],'include':[{'model':db[_0x91cb('0x73')],'as':_0x91cb('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b290e,null))[_0x91cb('0x16')](function(_0x2bafae){var _0x27472a=_['map'](_0x2bafae,'id');var _0x59cb69=[];var _0x5d0f96=[];var _0x174325=squel[_0x91cb('0x74')]();_0x174325[_0x91cb('0x75')](_0x91cb('0x76'))['from'](_0x91cb('0x77'),'tq')[_0x91cb('0x78')](_0x91cb('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91cb('0x2a')]('VoiceQueueId\x20=\x20?',_0x3782cd[_0x91cb('0x30')]['id']);for(var _0x43b2e7=0x0;_0x43b2e7<_0x2bafae['length'];_0x43b2e7+=0x1){let _0x1b47fe=_0x2bafae[_0x43b2e7];for(var _0x1853de=0x0;_0x1853de<_0x1b47fe[_0x91cb('0x63')][_0x91cb('0x37')];_0x1853de+=0x1){let _0x376426=_0x1b47fe['Agents'][_0x1853de];var _0x22a6e6=_0x174325[_0x91cb('0x44')]();_0x22a6e6[_0x91cb('0x2a')](_0x91cb('0x7a'),_0x376426['id']);_0x5d0f96['push'](db[_0x91cb('0x66')]['query'](_0x22a6e6['toString'](),{'type':db['sequelize'][_0x91cb('0x7b')][_0x91cb('0x7c')]})[_0x91cb('0x16')](function(_0x4972c3){if(_0x4972c3[_0x91cb('0x37')]===0x1){return _0x376426['id'];}else{var _0x53dbb2=_[_0x91cb('0x7d')](_[_0x91cb('0x1c')](_0x4972c3,_0x91cb('0x7e')),function(_0x2a2a71){return _[_0x91cb('0x1e')](_0x27472a,_0x2a2a71);});if(_0x53dbb2){return _0x376426['id'];}}}));}}return BPromise[_0x91cb('0x7f')](_0x5d0f96)['then'](function(_0x5bfd2c){_0x59cb69=_(_0x59cb69)[_0x91cb('0x80')](_0x5bfd2c)['compact']()[_0x91cb('0x1d')]();return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x3782cd[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(_0x51d431){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x18ec67){return _0x51d431['removeTeams'](_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')],{'transaction':_0x18ec67})['then'](function(){if(!_[_0x91cb('0x81')](_0x59cb69)){return _0x51d431[_0x91cb('0x82')](_0x59cb69,{'transaction':_0x18ec67})[_0x91cb('0x16')](function(){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0x3782cd[_0x91cb('0x30')]['id'],'UserId':_0x59cb69},'transaction':_0x18ec67});});}})['then'](function(){_0x59cb69[_0x91cb('0x64')](function(_0x5da781){socket['emit']('userVoiceQueue:remove',{'UserId':_0x5da781,'VoiceQueueId':_0x51d431['id']});});});});});});})[_0x91cb('0x16')](respondWithStatusCode(_0x4b290e,null))['catch'](handleError(_0x4b290e,null));};exports['addAgents']=function(_0x3c0211,_0x3710e9){var _0x395e21,_0x52b9af;return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3c0211[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x3710e9,null))[_0x91cb('0x16')](function(_0x3280a5){if(_0x3280a5){_0x52b9af=_0x3280a5;return _0x3280a5[_0x91cb('0x83')](_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x3c0211['body'],[_0x91cb('0x72'),'id'])||{})[_0x91cb('0x84')](function(_0x547b4d){for(var _0x1aef0b=0x0;_0x1aef0b<_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x91cb('0x37')];_0x1aef0b+=0x1){socket[_0x91cb('0x85')]('userVoiceQueue:save',{'UserId':Number(_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x1aef0b]),'VoiceQueueId':Number(_0x3c0211[_0x91cb('0x30')]['id'])});}return _0x547b4d;});}})['then'](function(_0x4ba088){_0x395e21=_0x4ba088||[];if(_0x52b9af){return db[_0x91cb('0x73')][_0x91cb('0x52')]({'where':{'id':_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')]},'attributes':['id',_0x91cb('0x20'),_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]});}})['then'](function(_0x33b7a7){if(!_[_0x91cb('0x81')](_0x33b7a7)){var _0x4ac7b9=[];for(var _0x41c3ff=0x0;_0x41c3ff<_0x33b7a7[_0x91cb('0x37')];_0x41c3ff++){if(_0x33b7a7[_0x41c3ff]['online']){_0x4ac7b9[_0x91cb('0x86')](db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x33b7a7[_0x41c3ff][_0x91cb('0x20')],'UserId':_0x33b7a7[_0x41c3ff]['id'],'queue_name':_0x52b9af[_0x91cb('0x20')],'VoiceQueueId':_0x52b9af['id'],'interface':_['isNil'](_0x33b7a7[_0x41c3ff][_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x33b7a7[_0x41c3ff][_0x91cb('0x20')]):_0x33b7a7[_0x41c3ff]['interface'],'paused':_0x33b7a7[_0x41c3ff][_0x91cb('0x60')]||![],'penalty':_0x3c0211['body'][_0x91cb('0x65')]||0x0}));}}return BPromise[_0x91cb('0x7f')](_0x4ac7b9);}})[_0x91cb('0x16')](function(){return _0x395e21;})[_0x91cb('0x16')](respondWithResult(_0x3710e9,null))[_0x91cb('0x2f')](handleError(_0x3710e9,null));};exports[_0x91cb('0x82')]=function(_0xd572bc,_0x1e7a48){return db[_0x91cb('0x25')]['find']({'where':{'id':_0xd572bc[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1e7a48,null))[_0x91cb('0x16')](function(_0x51ef1c){if(_0x51ef1c){return _0x51ef1c[_0x91cb('0x82')](_0xd572bc['query'][_0x91cb('0x72')])['then'](function(){if(_[_0x91cb('0x87')](_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')])){for(var _0x10fe63=0x0;_0x10fe63<_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x91cb('0x37')];_0x10fe63+=0x1){socket['emit'](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x10fe63]),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}}else{socket[_0x91cb('0x85')](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')]['ids']),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}});}})[_0x91cb('0x16')](function(_0x219b5f){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0xd572bc['params']['id'],'UserId':_0xd572bc['query']['ids']}})[_0x91cb('0x16')](function(){return _0x219b5f;});})[_0x91cb('0x16')](respondWithStatusCode(_0x1e7a48,null))['catch'](handleError(_0x1e7a48,null));};exports['getAgents']=function(_0x471c17,_0x6549a7){var _0x13564d={};var _0x3c1e63={};var _0x1f2d72;var _0x376adc;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x471c17['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x6549a7,null))[_0x91cb('0x16')](function(_0xf15400){if(_0xf15400){_0x1f2d72=_0xf15400;_0x3c1e63['model']=_[_0x91cb('0x31')](db[_0x91cb('0x73')][_0x91cb('0x26')]);_0x3c1e63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x471c17[_0x91cb('0x2d')]);_0x3c1e63[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x3c1e63['model'],_0x3c1e63['query']);_0x13564d[_0x91cb('0x34')]=_['intersection'](_0x3c1e63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x13564d['attributes']=_0x13564d[_0x91cb('0x34')][_0x91cb('0x37')]?_0x13564d[_0x91cb('0x34')]:_0x3c1e63[_0x91cb('0x35')];_0x13564d[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x13564d['where']=qs[_0x91cb('0x32')](_['pick'](_0x471c17[_0x91cb('0x2d')],_0x3c1e63[_0x91cb('0x32')]));if(_0x471c17['query'][_0x91cb('0x1a')]){_0x13564d[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x13564d[_0x91cb('0x2a')],{'$or':_['map'](_0x13564d[_0x91cb('0x34')],function(_0x1bef2b){var _0x5a38f7={};_0x5a38f7[_0x1bef2b]={'$like':'%'+_0x471c17[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x5a38f7;})});}_0x13564d=_[_0x91cb('0x39')]({},_0x13564d,_0x471c17[_0x91cb('0x59')]);return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x2f42ef){if(_0x2f42ef){_0x376adc=_0x2f42ef[_0x91cb('0x37')];if(!_0x471c17[_0x91cb('0x2d')][_0x91cb('0x56')]('nolimit')){_0x13564d[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x13564d[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x31cf76){if(_0x31cf76){return _0x31cf76?{'count':_0x376adc,'rows':_0x31cf76}:null;}})['then'](respondWithResult(_0x6549a7,null))[_0x91cb('0x2f')](handleError(_0x6549a7,null));};exports['getMembers']=function(_0x3a5022,_0x17141e){var _0x3e2c58={};var _0x11c67c={};var _0xf4b4ab;var _0x2fa5e3;return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a5022[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x17141e,null))[_0x91cb('0x16')](function(_0x4483fb){if(_0x4483fb){_0xf4b4ab=_0x4483fb;_0x11c67c['model']=_['keys'](db['UserVoiceQueueRt'][_0x91cb('0x26')]);_0x11c67c[_0x91cb('0x2d')]=_['keys'](_0x3a5022['query']);_0x11c67c['filters']=_[_0x91cb('0x33')](_0x11c67c[_0x91cb('0x35')],_0x11c67c['query']);_0x3e2c58['attributes']=_['intersection'](_0x11c67c[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a5022['query'][_0x91cb('0x36')]));_0x3e2c58[_0x91cb('0x34')]=_0x3e2c58['attributes']['length']?_0x3e2c58[_0x91cb('0x34')]:_0x11c67c[_0x91cb('0x35')];_0x3e2c58[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x3a5022[_0x91cb('0x2d')]['sort']);_0x3e2c58[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3a5022[_0x91cb('0x2d')],_0x11c67c[_0x91cb('0x32')]));if(_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x3e2c58[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x3e2c58[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x3e2c58[_0x91cb('0x34')],function(_0x1ea132){var _0x3b1d97={};_0x3b1d97[_0x1ea132]={'$like':'%'+_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x3b1d97;})});}_0x3e2c58=_[_0x91cb('0x39')]({},_0x3e2c58,_0x3a5022[_0x91cb('0x59')]);return _0xf4b4ab[_0x91cb('0x8a')](_0x3e2c58);}})[_0x91cb('0x16')](function(_0x5cf6df){if(_0x5cf6df){_0x2fa5e3=_0x5cf6df['length'];if(!_0x3a5022['query'][_0x91cb('0x56')]('nolimit')){_0x3e2c58[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x3e2c58[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0xf4b4ab['getMembers'](_0x3e2c58);}})['then'](function(_0x5f2de0){return _0x5f2de0?{'count':_0x2fa5e3,'rows':_0x5f2de0}:null;})[_0x91cb('0x16')](respondWithResult(_0x17141e,null))[_0x91cb('0x2f')](handleError(_0x17141e,null));};exports[_0x91cb('0x8b')]=function(_0x2b4e25,_0x4c044d){var _0x54c194={};var _0x3cfdcb={};var _0x1624b3;var _0x1e2acd;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2b4e25['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x4c044d,null))['then'](function(_0x1e979e){if(_0x1e979e){_0x1624b3=_0x1e979e;_0x3cfdcb[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x3cfdcb[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x2b4e25[_0x91cb('0x2d')]);_0x3cfdcb['filters']=_[_0x91cb('0x33')](_0x3cfdcb[_0x91cb('0x35')],_0x3cfdcb[_0x91cb('0x2d')]);_0x54c194[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x3cfdcb['model'],qs[_0x91cb('0x36')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x54c194['attributes']=_0x54c194['attributes'][_0x91cb('0x37')]?_0x54c194['attributes']:_0x3cfdcb[_0x91cb('0x35')];_0x54c194[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2b4e25[_0x91cb('0x2d')]['sort']);_0x54c194[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x2b4e25[_0x91cb('0x2d')],_0x3cfdcb[_0x91cb('0x32')]));if(_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x54c194[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x54c194['where'],{'$or':_[_0x91cb('0x1c')](_0x54c194['attributes'],function(_0x283743){var _0x44ffde={};_0x44ffde[_0x283743]={'$like':'%'+_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x44ffde;})});}_0x54c194=_['merge']({},_0x54c194,_0x2b4e25[_0x91cb('0x59')]);return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})[_0x91cb('0x16')](function(_0x5e629){if(_0x5e629){_0x1e2acd=_0x5e629[_0x91cb('0x37')];if(!_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x54c194[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x2b4e25['query'][_0x91cb('0x12')]);_0x54c194['offset']=qs[_0x91cb('0x13')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})['then'](function(_0x87f382){if(_0x87f382){return _0x87f382?{'count':_0x1e2acd,'rows':_0x87f382}:null;}})[_0x91cb('0x16')](respondWithResult(_0x4c044d,null))[_0x91cb('0x2f')](handleError(_0x4c044d,null));};exports['addLists']=function(_0x330123,_0x23bc13){var _0x175d85=moment()[_0x91cb('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x97ba8,_0x4bc382;return db[_0x91cb('0x25')]['find']({'where':{'id':_0x330123[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x23bc13,null))[_0x91cb('0x16')](function(_0x399012){if(_0x399012){_0x4bc382=_0x399012;return _0x399012[_0x91cb('0x8d')](_0x330123['body']['ids'],_[_0x91cb('0x47')](_0x330123[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x571a6f){var _0x19596b;_0x97ba8=_0x571a6f||[];var _0x5b4849=[];if(_0x571a6f){for(var _0x39a183=0x0;_0x39a183<_0x571a6f[_0x91cb('0x37')];_0x39a183+=0x1){var _0x693690=_0x571a6f[_0x39a183][_0x91cb('0x3e')]({'plain':!![]});_0x4bc382[_0x91cb('0x8e')]=_0x330123[_0x91cb('0x3c')][_0x91cb('0x8e')]?_0x330123[_0x91cb('0x3c')]['dialCheckDuplicateType']:_0x4bc382['dialCheckDuplicateType'];switch(_0x4bc382['dialCheckDuplicateType']){case'always':_0x19596b=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')](['phone','scheduledAt',_0x91cb('0x93'),'ListId',_0x91cb('0x51'),_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27','scheduledAt')[_0x91cb('0x75')]('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690[_0x91cb('0x95')]['toString'](),'ListId')['field'](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x9d'))[_0x91cb('0x97')](_0x91cb('0x9e'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id']['toString']()))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa0'))['from'](_0x91cb('0x91'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))['toString']();break;case _0x91cb('0xa1'):_0x19596b=squel[_0x91cb('0x8f')]()['into'](_0x91cb('0x91'))['fromQuery']([_0x91cb('0x94'),'scheduledAt',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))[_0x91cb('0x75')]('id',_0x91cb('0x93'))['field'](_0x693690[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0x91cb('0x97')]('cm_hopper')[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))[_0x91cb('0x96')]();break;default:_0x19596b=squel['insert']()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')]([_0x91cb('0x94'),_0x91cb('0xa3'),_0x91cb('0x93'),_0x91cb('0xa2'),'VoiceQueueId',_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()['field'](_0x91cb('0x94'),'phone')['field']('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))['field']('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690['CmListId'][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))['where'](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())['where'](_0x91cb('0x9b')))[_0x91cb('0x96')]();}_0x5b4849['push'](db[_0x91cb('0x66')]['query'](_0x19596b));}return BPromise[_0x91cb('0x7f')](_0x5b4849);}})['then'](function(){var _0x739447=[];var _0x2deed1=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xa4'))['fromQuery']([_0x91cb('0xa5'),_0x91cb('0x94'),'OrderBy','createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa6'))['field'](_0x91cb('0xa7'))[_0x91cb('0x75')](_0x91cb('0xa8'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))['from'](_0x91cb('0xa9'),'ci')[_0x91cb('0x78')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x91cb('0x2a')](_0x91cb('0xaa'),_0x175d85)[_0x91cb('0x2a')](_0x91cb('0xab'),_0x91cb('0xac')))[_0x91cb('0x96')]();_0x739447[_0x91cb('0x86')](db[_0x91cb('0x66')]['query'](_0x2deed1));return BPromise[_0x91cb('0x7f')](_0x739447);})[_0x91cb('0x16')](function(){return _0x97ba8;})[_0x91cb('0x16')](respondWithResult(_0x23bc13,null))[_0x91cb('0x2f')](handleError(_0x23bc13,null));};exports[_0x91cb('0xad')]=function(_0x554923,_0x2fe556){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x554923[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x2fe556,null))[_0x91cb('0x16')](function(_0x43958a){if(_0x43958a){return _0x43958a[_0x91cb('0xad')](_0x554923['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0x409a36){if(_0x409a36){return db[_0x91cb('0x4c')][_0x91cb('0x17')]({'where':{'ListId':_0x554923[_0x91cb('0x2d')][_0x91cb('0x72')],'VoiceQueueId':_0x554923[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(){return _0x409a36;});}})[_0x91cb('0x16')](respondWithStatusCode(_0x2fe556,null))['catch'](handleError(_0x2fe556,null));};exports[_0x91cb('0xae')]=function(_0x2d870d,_0x173761){var _0x2cf0d8={};var _0x9d63ff={};var _0x720de;var _0x80f0ba;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2d870d[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x173761,null))[_0x91cb('0x16')](function(_0x800860){if(_0x800860){_0x720de=_0x800860;_0x9d63ff[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x9d63ff['query']=_['keys'](_0x2d870d[_0x91cb('0x2d')]);_0x9d63ff[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x9d63ff['model'],_0x9d63ff[_0x91cb('0x2d')]);_0x2cf0d8[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9d63ff[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x2cf0d8[_0x91cb('0x34')]=_0x2cf0d8[_0x91cb('0x34')][_0x91cb('0x37')]?_0x2cf0d8[_0x91cb('0x34')]:_0x9d63ff[_0x91cb('0x35')];_0x2cf0d8[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x2cf0d8[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x2d870d['query'],_0x9d63ff[_0x91cb('0x32')]));if(_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x2cf0d8['where']=_['merge'](_0x2cf0d8['where'],{'$or':_[_0x91cb('0x1c')](_0x2cf0d8[_0x91cb('0x34')],function(_0x4370f6){var _0x5bc712={};_0x5bc712[_0x4370f6]={'$like':'%'+_0x2d870d['query'][_0x91cb('0x1a')]+'%'};return _0x5bc712;})});}_0x2cf0d8=_[_0x91cb('0x39')]({},_0x2cf0d8,_0x2d870d[_0x91cb('0x59')]);return _0x720de[_0x91cb('0xae')](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x182f2c){if(_0x182f2c){_0x80f0ba=_0x182f2c[_0x91cb('0x37')];if(!_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x2cf0d8['limit']=qs['limit'](_0x2d870d[_0x91cb('0x2d')]['limit']);_0x2cf0d8[_0x91cb('0x13')]=qs['offset'](_0x2d870d['query'][_0x91cb('0x13')]);}return _0x720de['getBlackLists'](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x2ac9df){if(_0x2ac9df){return _0x2ac9df?{'count':_0x80f0ba,'rows':_0x2ac9df}:null;}})['then'](respondWithResult(_0x173761,null))[_0x91cb('0x2f')](handleError(_0x173761,null));};exports[_0x91cb('0xaf')]=function(_0x331381,_0x52ce8c){var _0x534968;return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x331381['params']['id']}})['then'](handleEntityNotFound(_0x52ce8c,null))['then'](function(_0x397397){if(_0x397397){return _0x397397[_0x91cb('0xaf')](_0x331381[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x331381[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x2a0c3c){var _0x30ef98;_0x534968=_0x2a0c3c||[];var _0x27d0ab=[];if(_0x2a0c3c){for(var _0x547db7=0x0;_0x547db7<_0x2a0c3c['length'];_0x547db7+=0x1){var _0x38d608=_0x2a0c3c[_0x547db7][_0x91cb('0x3e')]({'plain':!![]});_0x30ef98=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xb0'))[_0x91cb('0x92')](['phone',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel['select']()[_0x91cb('0x75')](_0x91cb('0x94'),'phone')[_0x91cb('0x75')]('id','ContactId')[_0x91cb('0x75')](_0x38d608[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))['field'](_0x331381[_0x91cb('0x30')]['id']['toString'](),_0x91cb('0x51'))['field']('NOW()',_0x91cb('0x45'))[_0x91cb('0x75')](_0x91cb('0xb1'),_0x91cb('0x46'))[_0x91cb('0x97')]('cm_contacts')['where'](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x38d608['CmListId'][_0x91cb('0x96')]())[_0x91cb('0x2a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x27d0ab[_0x91cb('0x86')](db['sequelize'][_0x91cb('0x2d')](_0x30ef98));}return BPromise['all'](_0x27d0ab);}})['then'](function(){return _0x534968;})[_0x91cb('0x16')](respondWithResult(_0x52ce8c,null))[_0x91cb('0x2f')](handleError(_0x52ce8c,null));};exports[_0x91cb('0xb2')]=function(_0x4ef95b,_0x2f0269){return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x4ef95b[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x2f0269,null))['then'](function(_0x5e1b97){if(_0x5e1b97){return _0x5e1b97[_0x91cb('0xb2')](_0x4ef95b['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0xcb3114){if(_0xcb3114){return db[_0x91cb('0x5b')][_0x91cb('0x17')]({'where':{'ListId':_0x4ef95b['query'][_0x91cb('0x72')],'VoiceQueueId':_0x4ef95b['params']['id']}})[_0x91cb('0x16')](function(){return _0xcb3114;});}})['then'](respondWithStatusCode(_0x2f0269,null))[_0x91cb('0x2f')](handleError(_0x2f0269,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 387d17a..4de6d3b 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 _0x3aee=['exports','events','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1087f5,_0x5e8bc2){var _0x2167e6=function(_0x54b9dd){while(--_0x54b9dd){_0x1087f5['push'](_0x1087f5['shift']());}};_0x2167e6(++_0x5e8bc2);}(_0x3aee,0x79));var _0xe3ae=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x3aee[_0x3f3f40];return _0x403b7a;};'use strict';var EventEmitter=require(_0xe3ae('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe3ae('0x1')](0x0);var events={'afterCreate':_0xe3ae('0x2'),'afterUpdate':_0xe3ae('0x3'),'afterDestroy':'remove'};function emitEvent(_0x309f0c){return function(_0x13dd71,_0x5c059e,_0x33f2a3){VoiceQueueEvents[_0xe3ae('0x4')](_0x309f0c+':'+_0x13dd71['id'],_0x13dd71);VoiceQueueEvents[_0xe3ae('0x4')](_0x309f0c,_0x13dd71);_0x33f2a3(null);};}for(var e in events){if(events[_0xe3ae('0x5')](e)){var event=events[e];VoiceQueue[_0xe3ae('0x6')](e,emitEvent(event));}}module[_0xe3ae('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x221b=['hook','events','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x18a276,_0x48c9d5){var _0x3c3cb8=function(_0x1ff0d3){while(--_0x1ff0d3){_0x18a276['push'](_0x18a276['shift']());}};_0x3c3cb8(++_0x48c9d5);}(_0x221b,0x169));var _0xb221=function(_0x4a0b61,_0x26aed2){_0x4a0b61=_0x4a0b61-0x0;var _0x10c705=_0x221b[_0x4a0b61];return _0x10c705;};'use strict';var EventEmitter=require(_0xb221('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xb221('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb221('0x2')](0x0);var events={'afterCreate':_0xb221('0x3'),'afterUpdate':_0xb221('0x4'),'afterDestroy':_0xb221('0x5')};function emitEvent(_0x53ff2b){return function(_0x212d26,_0x4ddb3a,_0x3e996a){VoiceQueueEvents[_0xb221('0x6')](_0x53ff2b+':'+_0x212d26['id'],_0x212d26);VoiceQueueEvents[_0xb221('0x6')](_0x53ff2b,_0x212d26);_0x3e996a(null);};}for(var e in events){if(events[_0xb221('0x7')](e)){var event=events[e];VoiceQueue[_0xb221('0x8')](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 39e2242..5060101 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x5daade,_0x46f849){var _0x355a02=function(_0x3d6fce){while(--_0x3d6fce){_0x5daade['push'](_0x5daade['shift']());}};_0x355a02(++_0x46f849);}(_0xedd9,0xfc));var _0x9edd=function(_0x1cf1ef,_0x15ec50){_0x1cf1ef=_0x1cf1ef-0x0;var _0x260f77=_0xedd9[_0x1cf1ef];return _0x260f77;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x2cd629,_0x4814df){var _0x3da808=function(_0x355357){while(--_0x355357){_0x2cd629['push'](_0x2cd629['shift']());}};_0x3da808(++_0x4814df);}(_0xedd9,0xfc));var _0x9edd=function(_0x4350b7,_0x293f9a){_0x4350b7=_0x4350b7-0x0;var _0x5de98a=_0xedd9[_0x4350b7];return _0x5de98a;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index ab9bee3..9071dc7 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 _0x867d=['VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','defaults','register','request','then','info'];(function(_0x37df25,_0x1b1408){var _0x18a709=function(_0x572a70){while(--_0x572a70){_0x37df25['push'](_0x37df25['shift']());}};_0x18a709(++_0x1b1408);}(_0x867d,0x1a1));var _0xd867=function(_0x1506ff,_0x11bea1){_0x1506ff=_0x1506ff-0x0;var _0x200106=_0x867d[_0x1506ff];return _0x200106;};'use strict';var _=require(_0xd867('0x0'));var util=require(_0xd867('0x1'));var moment=require(_0xd867('0x2'));var BPromise=require(_0xd867('0x3'));var rs=require(_0xd867('0x4'));var fs=require('fs');var Redis=require(_0xd867('0x5'));var db=require(_0xd867('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd867('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd867('0x8'));var client=jayson['client'][_0xd867('0x9')]({'port':0x232a});config['redis']=_[_0xd867('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0xd867('0xb')](socket);function respondWithRpcPromise(_0x5bc980,_0x943374,_0x248da9){return new BPromise(function(_0x3d7c8d,_0xd868ff){return client[_0xd867('0xc')](_0x5bc980,_0x248da9)[_0xd867('0xd')](function(_0x232247){logger[_0xd867('0xe')](_0xd867('0xf'),_0x943374,_0xd867('0x10'));logger[_0xd867('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x943374,_0xd867('0x10'),JSON[_0xd867('0x12')](_0x232247));if(_0x232247[_0xd867('0x13')]){if(_0x232247[_0xd867('0x13')][_0xd867('0x14')]===0x1f4){logger[_0xd867('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x943374,_0x232247['error']['message']);return _0xd868ff(_0x232247[_0xd867('0x13')][_0xd867('0x15')]);}logger[_0xd867('0x13')](_0xd867('0xf'),_0x943374,_0x232247['error']['message']);return _0x3d7c8d(_0x232247[_0xd867('0x13')]['message']);}else{logger[_0xd867('0xe')](_0xd867('0xf'),_0x943374,'request\x20sent');_0x3d7c8d(_0x232247[_0xd867('0x16')]['message']);}})[_0xd867('0x17')](function(_0x2bc263){logger[_0xd867('0x13')](_0xd867('0xf'),_0x943374,_0x2bc263);_0xd868ff(_0x2bc263);});});}exports[_0xd867('0x18')]=function(_0xc71494){var _0x120fa5=this;return new Promise(function(_0xe9263f,_0x5a2b3e){return db[_0xd867('0x19')][_0xd867('0x1a')]({'raw':_0xc71494[_0xd867('0x1b')]?_0xc71494[_0xd867('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xc71494[_0xd867('0x1b')]?_0xc71494['options'][_0xd867('0x1c')]||null:null,'attributes':_0xc71494[_0xd867('0x1b')]?_0xc71494[_0xd867('0x1b')][_0xd867('0x1d')]||null:null,'limit':_0xc71494['options']?_0xc71494['options'][_0xd867('0x1e')]||null:null,'include':_0xc71494['options']?_0xc71494[_0xd867('0x1b')][_0xd867('0x1f')]?_[_0xd867('0x20')](_0xc71494[_0xd867('0x1b')][_0xd867('0x1f')],function(_0x40a033){return{'model':db[_0x40a033[_0xd867('0x21')]],'as':_0x40a033['as'],'attributes':_0x40a033[_0xd867('0x1d')],'include':_0x40a033[_0xd867('0x1f')]?_[_0xd867('0x20')](_0x40a033[_0xd867('0x1f')],function(_0x244797){return{'model':db[_0x244797[_0xd867('0x21')]],'as':_0x244797['as'],'attributes':_0x244797[_0xd867('0x1d')],'include':_0x244797[_0xd867('0x1f')]?_[_0xd867('0x20')](_0x244797[_0xd867('0x1f')],function(_0x5e2d85){return{'model':db[_0x5e2d85[_0xd867('0x21')]],'as':_0x5e2d85['as'],'attributes':_0x5e2d85['attributes']};}):[]};}):[]};}):[]:[]})[_0xd867('0xd')](function(_0x5a1e71){logger[_0xd867('0xe')](_0xd867('0x18'),_0xc71494);logger[_0xd867('0x11')](_0xd867('0x18'),_0xc71494,JSON[_0xd867('0x12')](_0x5a1e71));_0xe9263f(_0x5a1e71);})[_0xd867('0x17')](function(_0x556b06){logger['error'](_0xd867('0x18'),_0x556b06['message'],_0xc71494);_0x5a2b3e(_0x120fa5['error'](0x1f4,_0x556b06[_0xd867('0x15')]));});});};exports['ShowVoiceQueue']=function(_0x214ec4){var _0x9f79a6=this;return new Promise(function(_0x4ad173,_0x211db1){return db[_0xd867('0x19')][_0xd867('0x22')]({'raw':_0x214ec4[_0xd867('0x1b')]?_0x214ec4[_0xd867('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x214ec4[_0xd867('0x1b')]?_0x214ec4[_0xd867('0x1b')][_0xd867('0x1c')]||null:null,'attributes':_0x214ec4[_0xd867('0x1b')]?_0x214ec4[_0xd867('0x1b')][_0xd867('0x1d')]||null:null,'include':_0x214ec4[_0xd867('0x1b')]?_0x214ec4[_0xd867('0x1b')]['include']?_[_0xd867('0x20')](_0x214ec4[_0xd867('0x1b')]['include'],function(_0x42b7b9){return{'model':db[_0x42b7b9['model']],'as':_0x42b7b9['as'],'attributes':_0x42b7b9['attributes'],'include':_0x42b7b9[_0xd867('0x1f')]?_['map'](_0x42b7b9[_0xd867('0x1f')],function(_0x3e7036){return{'model':db[_0x3e7036[_0xd867('0x21')]],'as':_0x3e7036['as'],'attributes':_0x3e7036[_0xd867('0x1d')],'include':_0x3e7036[_0xd867('0x1f')]?_[_0xd867('0x20')](_0x3e7036[_0xd867('0x1f')],function(_0x1433f2){return{'model':db[_0x1433f2[_0xd867('0x21')]],'as':_0x1433f2['as'],'attributes':_0x1433f2[_0xd867('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16741c){logger['info'](_0xd867('0x23'),_0x214ec4);logger['debug'](_0xd867('0x23'),_0x214ec4,JSON[_0xd867('0x12')](_0x16741c));_0x4ad173(_0x16741c);})[_0xd867('0x17')](function(_0x1d9c74){logger[_0xd867('0x13')]('ShowVoiceQueue',_0x1d9c74[_0xd867('0x15')],_0x214ec4);_0x211db1(_0x9f79a6['error'](0x1f4,_0x1d9c74[_0xd867('0x15')]));});});}; \ No newline at end of file +var _0x96b1=['register','request','then','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result','VoiceQueue','findAll','options','raw','attributes','include','map','model','GetVoiceQueue','catch','ShowVoiceQueue','find','where','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./voiceQueue.socket'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x96b1,0x132));var _0x196b=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x96b1[_0x5b8310];return _0xd3ebc1;};'use strict';var _=require('lodash');var util=require(_0x196b('0x0'));var moment=require(_0x196b('0x1'));var BPromise=require(_0x196b('0x2'));var rs=require(_0x196b('0x3'));var fs=require('fs');var Redis=require(_0x196b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x196b('0x5'));var logger=require(_0x196b('0x6'))(_0x196b('0x7'));var config=require(_0x196b('0x8'));var jayson=require(_0x196b('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x196b('0xa')]=_[_0x196b('0xb')](config[_0x196b('0xa')],{'host':_0x196b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x196b('0xa')]));require(_0x196b('0xd'))[_0x196b('0xe')](socket);function respondWithRpcPromise(_0x205e7b,_0x18290c,_0x57290d){return new BPromise(function(_0x22bfef,_0x3c268e){return client[_0x196b('0xf')](_0x205e7b,_0x57290d)[_0x196b('0x10')](function(_0x4afb7e){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x18290c,_0x196b('0x11'));logger[_0x196b('0x12')](_0x196b('0x13'),_0x18290c,'request\x20sent',JSON[_0x196b('0x14')](_0x4afb7e));if(_0x4afb7e['error']){if(_0x4afb7e[_0x196b('0x15')][_0x196b('0x16')]===0x1f4){logger['error'](_0x196b('0x17'),_0x18290c,_0x4afb7e[_0x196b('0x15')][_0x196b('0x18')]);return _0x3c268e(_0x4afb7e[_0x196b('0x15')][_0x196b('0x18')]);}logger[_0x196b('0x15')](_0x196b('0x17'),_0x18290c,_0x4afb7e[_0x196b('0x15')]['message']);return _0x22bfef(_0x4afb7e['error'][_0x196b('0x18')]);}else{logger[_0x196b('0x19')](_0x196b('0x17'),_0x18290c,_0x196b('0x11'));_0x22bfef(_0x4afb7e[_0x196b('0x1a')][_0x196b('0x18')]);}})['catch'](function(_0xfbb5aa){logger['error'](_0x196b('0x17'),_0x18290c,_0xfbb5aa);_0x3c268e(_0xfbb5aa);});});}exports['GetVoiceQueue']=function(_0x219e6b){var _0x388876=this;return new Promise(function(_0x4716e1,_0x41b330){return db[_0x196b('0x1b')][_0x196b('0x1c')]({'raw':_0x219e6b['options']?_0x219e6b[_0x196b('0x1d')][_0x196b('0x1e')]===undefined?!![]:![]:!![],'where':_0x219e6b[_0x196b('0x1d')]?_0x219e6b[_0x196b('0x1d')]['where']||null:null,'attributes':_0x219e6b[_0x196b('0x1d')]?_0x219e6b[_0x196b('0x1d')][_0x196b('0x1f')]||null:null,'limit':_0x219e6b[_0x196b('0x1d')]?_0x219e6b[_0x196b('0x1d')]['limit']||null:null,'include':_0x219e6b[_0x196b('0x1d')]?_0x219e6b[_0x196b('0x1d')][_0x196b('0x20')]?_[_0x196b('0x21')](_0x219e6b[_0x196b('0x1d')][_0x196b('0x20')],function(_0x5c3179){return{'model':db[_0x5c3179[_0x196b('0x22')]],'as':_0x5c3179['as'],'attributes':_0x5c3179[_0x196b('0x1f')],'include':_0x5c3179['include']?_['map'](_0x5c3179[_0x196b('0x20')],function(_0x5615b4){return{'model':db[_0x5615b4[_0x196b('0x22')]],'as':_0x5615b4['as'],'attributes':_0x5615b4[_0x196b('0x1f')],'include':_0x5615b4[_0x196b('0x20')]?_['map'](_0x5615b4[_0x196b('0x20')],function(_0x118054){return{'model':db[_0x118054['model']],'as':_0x118054['as'],'attributes':_0x118054[_0x196b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5de41d){logger[_0x196b('0x19')](_0x196b('0x23'),_0x219e6b);logger[_0x196b('0x12')](_0x196b('0x23'),_0x219e6b,JSON[_0x196b('0x14')](_0x5de41d));_0x4716e1(_0x5de41d);})[_0x196b('0x24')](function(_0x5316cd){logger[_0x196b('0x15')](_0x196b('0x23'),_0x5316cd['message'],_0x219e6b);_0x41b330(_0x388876[_0x196b('0x15')](0x1f4,_0x5316cd[_0x196b('0x18')]));});});};exports[_0x196b('0x25')]=function(_0x1ef46f){var _0x3d35a9=this;return new Promise(function(_0x11027c,_0x1bb69a){return db[_0x196b('0x1b')][_0x196b('0x26')]({'raw':_0x1ef46f[_0x196b('0x1d')]?_0x1ef46f[_0x196b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1ef46f[_0x196b('0x1d')]?_0x1ef46f[_0x196b('0x1d')][_0x196b('0x27')]||null:null,'attributes':_0x1ef46f[_0x196b('0x1d')]?_0x1ef46f['options'][_0x196b('0x1f')]||null:null,'include':_0x1ef46f[_0x196b('0x1d')]?_0x1ef46f[_0x196b('0x1d')]['include']?_[_0x196b('0x21')](_0x1ef46f['options'][_0x196b('0x20')],function(_0x109099){return{'model':db[_0x109099[_0x196b('0x22')]],'as':_0x109099['as'],'attributes':_0x109099[_0x196b('0x1f')],'include':_0x109099[_0x196b('0x20')]?_[_0x196b('0x21')](_0x109099[_0x196b('0x20')],function(_0x426851){return{'model':db[_0x426851[_0x196b('0x22')]],'as':_0x426851['as'],'attributes':_0x426851[_0x196b('0x1f')],'include':_0x426851[_0x196b('0x20')]?_[_0x196b('0x21')](_0x426851[_0x196b('0x20')],function(_0x2ffd9c){return{'model':db[_0x2ffd9c[_0x196b('0x22')]],'as':_0x2ffd9c['as'],'attributes':_0x2ffd9c[_0x196b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22ac68){logger['info'](_0x196b('0x25'),_0x1ef46f);logger[_0x196b('0x12')](_0x196b('0x25'),_0x1ef46f,JSON[_0x196b('0x14')](_0x22ac68));_0x11027c(_0x22ac68);})[_0x196b('0x24')](function(_0x4677a8){logger[_0x196b('0x15')]('ShowVoiceQueue',_0x4677a8['message'],_0x1ef46f);_0x1bb69a(_0x3d35a9[_0x196b('0x15')](0x1f4,_0x4677a8[_0x196b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index a539190..0816d5e 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 _0xdea9=['./voiceQueue.events','save','remove','emit','register','length'];(function(_0x3a6eed,_0x426f61){var _0x71ca41=function(_0x480c14){while(--_0x480c14){_0x3a6eed['push'](_0x3a6eed['shift']());}};_0x71ca41(++_0x426f61);}(_0xdea9,0x14a));var _0x9dea=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdea9[_0x3ab51d];return _0x29a04e;};'use strict';var VoiceQueueEvents=require(_0x9dea('0x0'));var events=[_0x9dea('0x1'),_0x9dea('0x2'),'update'];function createListener(_0x116f2d,_0x46e3cc){return function(_0x4ebd8b){_0x46e3cc[_0x9dea('0x3')](_0x116f2d,_0x4ebd8b);};}function removeListener(_0x569247,_0x7b1c03){return function(){VoiceQueueEvents['removeListener'](_0x569247,_0x7b1c03);};}exports[_0x9dea('0x4')]=function(_0x4acb3d){for(var _0x5990ce=0x0,_0x169677=events[_0x9dea('0x5')];_0x5990ce<_0x169677;_0x5990ce++){var _0x230bba=events[_0x5990ce];var _0x38f432=createListener('voiceQueue:'+_0x230bba,_0x4acb3d);VoiceQueueEvents['on'](_0x230bba,_0x38f432);}}; \ No newline at end of file +var _0xfe87=['emit','removeListener','register','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xfe87,0xac));var _0x7fe8=function(_0x44a328,_0x206b17){_0x44a328=_0x44a328-0x0;var _0x47b295=_0xfe87[_0x44a328];return _0x47b295;};'use strict';var VoiceQueueEvents=require(_0x7fe8('0x0'));var events=[_0x7fe8('0x1'),_0x7fe8('0x2'),_0x7fe8('0x3')];function createListener(_0x1a49f8,_0x5573cb){return function(_0x4b3bfa){_0x5573cb[_0x7fe8('0x4')](_0x1a49f8,_0x4b3bfa);};}function removeListener(_0x22d12f,_0xb1413){return function(){VoiceQueueEvents[_0x7fe8('0x5')](_0x22d12f,_0xb1413);};}exports[_0x7fe8('0x6')]=function(_0x5e4af6){for(var _0x527ae1=0x0,_0x5d698a=events['length'];_0x527ae1<_0x5d698a;_0x527ae1++){var _0x271946=events[_0x527ae1];var _0x53faf8=createListener(_0x7fe8('0x7')+_0x271946,_0x5e4af6);VoiceQueueEvents['on'](_0x271946,_0x53faf8);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 60c021b..757cf11 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 _0xd9c0=['/index','getVoiceQueuesReport','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xd9c0,0x190));var _0x0d9c=function(_0x5c9006,_0x322f08){_0x5c9006=_0x5c9006-0x0;var _0x5284e2=_0xd9c0[_0x5c9006];return _0x5284e2;};'use strict';var multer=require(_0x0d9c('0x0'));var util=require(_0x0d9c('0x1'));var path=require(_0x0d9c('0x2'));var timeout=require(_0x0d9c('0x3'));var express=require(_0x0d9c('0x4'));var router=express[_0x0d9c('0x5')]();var fs_extra=require(_0x0d9c('0x6'));var auth=require(_0x0d9c('0x7'));var interaction=require(_0x0d9c('0x8'));var config=require(_0x0d9c('0x9'));var controller=require(_0x0d9c('0xa'));router[_0x0d9c('0xb')]('/',auth[_0x0d9c('0xc')](),controller['index']);router[_0x0d9c('0xb')](_0x0d9c('0xd'),auth[_0x0d9c('0xc')](),controller['describe']);router[_0x0d9c('0xb')](_0x0d9c('0xe'),auth[_0x0d9c('0xc')](),controller[_0x0d9c('0xf')]);router[_0x0d9c('0xb')]('/:id',auth[_0x0d9c('0xc')](),controller[_0x0d9c('0x10')]);router[_0x0d9c('0x11')]('/',auth[_0x0d9c('0xc')](),controller[_0x0d9c('0x12')]);router[_0x0d9c('0x13')](_0x0d9c('0x14'),auth[_0x0d9c('0xc')](),controller[_0x0d9c('0x15')]);router['delete'](_0x0d9c('0x14'),auth[_0x0d9c('0xc')](),controller[_0x0d9c('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb7d5=['../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','get','describe','/index','getVoiceQueuesReport','/:id','show','create','update','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x57ff3d,_0x551fbd){var _0xf4ab01=function(_0x82ffcb){while(--_0x82ffcb){_0x57ff3d['push'](_0x57ff3d['shift']());}};_0xf4ab01(++_0x551fbd);}(_0xb7d5,0xf6));var _0x5b7d=function(_0x47568b,_0x37fc78){_0x47568b=_0x47568b-0x0;var _0x11c99e=_0xb7d5[_0x47568b];return _0x11c99e;};'use strict';var multer=require(_0x5b7d('0x0'));var util=require(_0x5b7d('0x1'));var path=require(_0x5b7d('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b7d('0x3'));var router=express[_0x5b7d('0x4')]();var fs_extra=require(_0x5b7d('0x5'));var auth=require(_0x5b7d('0x6'));var interaction=require(_0x5b7d('0x7'));var config=require('../../config/environment');var controller=require(_0x5b7d('0x8'));router['get']('/',auth[_0x5b7d('0x9')](),controller[_0x5b7d('0xa')]);router[_0x5b7d('0xb')]('/describe',auth[_0x5b7d('0x9')](),controller[_0x5b7d('0xc')]);router['get'](_0x5b7d('0xd'),auth[_0x5b7d('0x9')](),controller[_0x5b7d('0xe')]);router['get'](_0x5b7d('0xf'),auth[_0x5b7d('0x9')](),controller[_0x5b7d('0x10')]);router['post']('/',auth[_0x5b7d('0x9')](),controller[_0x5b7d('0x11')]);router['put']('/:id',auth[_0x5b7d('0x9')](),controller[_0x5b7d('0x12')]);router[_0x5b7d('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5b7d('0x14')]);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 b4a353e..bb05c4a 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 _0x0161=['queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x0161,0x155));var _0x1016=function(_0x27739f,_0x309b56){_0x27739f=_0x27739f-0x0;var _0x1d9af=_0x0161[_0x27739f];return _0x1d9af;};'use strict';var Sequelize=require(_0x1016('0x0'));var moment=require(_0x1016('0x1'));module['exports']={'type':{'type':Sequelize[_0x1016('0x2')]},'uniqueid':{'type':Sequelize[_0x1016('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1016('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x1016('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x1016('0x3')],'set':function(_0x2b4b55){var _0xdea249=moment(_0x2b4b55);var _0x139498=moment(this[_0x1016('0x4')](_0x1016('0x5')))[_0x1016('0x6')](_0x1016('0x7'));var _0x392510=_0xdea249[_0x1016('0x8')](_0x139498,_0x1016('0x9'));this[_0x1016('0xa')](_0x1016('0xb'),_0x2b4b55);this[_0x1016('0xa')]('holdtime',_0x392510||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x1016('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x1016('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1016('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1016('0x3')]},'queuecallerexit':{'type':Sequelize[_0x1016('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1016('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x1016('0x2')],'comment':_0x1016('0xe')},'originalposition':{'type':Sequelize[_0x1016('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1016('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1016('0x2')]},'context':{'type':Sequelize[_0x1016('0x2')]},'exten':{'type':Sequelize[_0x1016('0x2')]},'priority':{'type':Sequelize[_0x1016('0x2')]},'holdtime':{'type':Sequelize[_0x1016('0xc')]},'mohtime':{'type':Sequelize[_0x1016('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1016('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1016('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1016('0x2')],'comment':_0x1016('0xf')},'transferexten':{'type':Sequelize[_0x1016('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1016('0x2')]},'secondDisposition':{'type':Sequelize[_0x1016('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1016('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x1016('0x2')]}}; \ No newline at end of file +var _0x89c3=['BOOLEAN','moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','INTEGER'];(function(_0x259c6a,_0x5e4856){var _0x491087=function(_0x9499c9){while(--_0x9499c9){_0x259c6a['push'](_0x259c6a['shift']());}};_0x491087(++_0x5e4856);}(_0x89c3,0xc9));var _0x389c=function(_0x175e57,_0x2603af){_0x175e57=_0x175e57-0x0;var _0x3e10ac=_0x89c3[_0x175e57];return _0x3e10ac;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x389c('0x0'));module['exports']={'type':{'type':Sequelize[_0x389c('0x1')]},'uniqueid':{'type':Sequelize[_0x389c('0x1')]},'calleridnum':{'type':Sequelize[_0x389c('0x1')]},'calleridname':{'type':Sequelize[_0x389c('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x389c('0x2')],'set':function(_0x4f76e0){var _0x3b85e8=moment(_0x4f76e0);var _0x40c29d=moment(this['getDataValue']('queuecallerjoinAt'))[_0x389c('0x3')](_0x389c('0x4'));var _0x36c6a8=_0x3b85e8['diff'](_0x40c29d,_0x389c('0x5'));this[_0x389c('0x6')](_0x389c('0x7'),_0x4f76e0);this[_0x389c('0x6')]('holdtime',_0x36c6a8||null);}},'position':{'type':Sequelize[_0x389c('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x389c('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x389c('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x389c('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x389c('0x2')]},'queuecallerexit':{'type':Sequelize[_0x389c('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x389c('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x389c('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x389c('0x1')]},'connectedlinenum':{'type':Sequelize[_0x389c('0x1')]},'connectedlinename':{'type':Sequelize[_0x389c('0x1')]},'accountcode':{'type':Sequelize[_0x389c('0x1')]},'context':{'type':Sequelize[_0x389c('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x389c('0x1')]},'holdtime':{'type':Sequelize[_0x389c('0x8')]},'mohtime':{'type':Sequelize[_0x389c('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x389c('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x389c('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x389c('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x389c('0x1')]},'thirdDisposition':{'type':Sequelize[_0x389c('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x389c('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 9d9399b..ebe2142 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 _0x582a=['path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','VoiceQueueReport','rawAttributes','type','model','query','filters','attributes','intersection','length','hasOwnProperty','order','sort','pick','filter','merge','options','where','includeAll','include','findAll','catch','show','keys','fields','find','create','body','params','describe','getVoiceQueuesReport','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x582a,0x192));var _0xa582=function(_0x36271b,_0x52ef81){_0x36271b=_0x36271b-0x0;var _0x315b6c=_0x582a[_0x36271b];return _0x315b6c;};'use strict';var emlformat=require(_0xa582('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa582('0x1'));var jsonpatch=require(_0xa582('0x2'));var rp=require(_0xa582('0x3'));var moment=require(_0xa582('0x4'));var BPromise=require(_0xa582('0x5'));var Mustache=require(_0xa582('0x6'));var util=require(_0xa582('0x7'));var path=require(_0xa582('0x8'));var sox=require(_0xa582('0x9'));var csv=require(_0xa582('0xa'));var ejs=require(_0xa582('0xb'));var fs=require('fs');var fs_extra=require(_0xa582('0xc'));var _=require('lodash');var squel=require(_0xa582('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa582('0xa'));var querystring=require(_0xa582('0xe'));var Papa=require(_0xa582('0xf'));var Redis=require(_0xa582('0x10'));var authService=require(_0xa582('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa582('0x12'));var hardwareService=require(_0xa582('0x13'));var logger=require(_0xa582('0x14'))(_0xa582('0x15'));var utils=require(_0xa582('0x16'));var config=require(_0xa582('0x17'));var licenseUtil=require(_0xa582('0x18'));var db=require(_0xa582('0x19'))['db'];config[_0xa582('0x1a')]=_['defaults'](config[_0xa582('0x1a')],{'host':_0xa582('0x1b'),'port':0x18eb});var socket=require(_0xa582('0x1c'))(new Redis(config[_0xa582('0x1a')]));require('./voiceQueueReport.socket')[_0xa582('0x1d')](socket);function respondWithStatusCode(_0x369c9d,_0x343031){_0x343031=_0x343031||0xcc;return function(_0x2b9956){if(_0x2b9956){return _0x369c9d['sendStatus'](_0x343031);}return _0x369c9d['status'](_0x343031)[_0xa582('0x1e')]();};}function respondWithResult(_0x1fb799,_0x432090){_0x432090=_0x432090||0xc8;return function(_0x23d3f4){if(_0x23d3f4){return _0x1fb799[_0xa582('0x1f')](_0x432090)[_0xa582('0x20')](_0x23d3f4);}};}function respondWithFilteredResult(_0x62d278,_0x56fb12){return function(_0x2f5231){if(_0x2f5231){var _0x401d90=typeof _0x56fb12[_0xa582('0x21')]===_0xa582('0x22')&&typeof _0x56fb12[_0xa582('0x23')]===_0xa582('0x22');var _0x5b3c51=_0x2f5231[_0xa582('0x24')];var _0x19e881=_0x401d90?0x0:_0x56fb12[_0xa582('0x21')];var _0x5f543f=_0x401d90?_0x2f5231[_0xa582('0x24')]:_0x56fb12[_0xa582('0x21')]+_0x56fb12['limit'];var _0x5db8e8;if(_0x5f543f>=_0x5b3c51){_0x5f543f=_0x5b3c51;_0x5db8e8=0xc8;}else{_0x5db8e8=0xce;}_0x62d278[_0xa582('0x1f')](_0x5db8e8);return _0x62d278[_0xa582('0x25')](_0xa582('0x26'),_0x19e881+'-'+_0x5f543f+'/'+_0x5b3c51)[_0xa582('0x20')](_0x2f5231);}return null;};}function patchUpdates(_0x1061db){return function(_0x8f4134){try{jsonpatch[_0xa582('0x27')](_0x8f4134,_0x1061db,!![]);}catch(_0x268219){return BPromise[_0xa582('0x28')](_0x268219);}return _0x8f4134[_0xa582('0x29')]();};}function saveUpdates(_0x6d099,_0x58569b){return function(_0x2afdf9){if(_0x2afdf9){return _0x2afdf9[_0xa582('0x2a')](_0x6d099)[_0xa582('0x2b')](function(_0x130fef){return _0x130fef;});}return null;};}function removeEntity(_0x498fc8,_0x411fdc){return function(_0x2e04fb){if(_0x2e04fb){return _0x2e04fb[_0xa582('0x2c')]()['then'](function(){_0x498fc8['status'](0xcc)[_0xa582('0x1e')]();});}};}function handleEntityNotFound(_0x558905,_0x3ee3de){return function(_0x1a81d5){if(!_0x1a81d5){_0x558905[_0xa582('0x2d')](0x194);}return _0x1a81d5;};}function handleError(_0x4528ba,_0x554c9d){_0x554c9d=_0x554c9d||0x1f4;return function(_0x17d7fe){logger[_0xa582('0x2e')](_0x17d7fe['stack']);if(_0x17d7fe[_0xa582('0x2f')]){delete _0x17d7fe['name'];}_0x4528ba['status'](_0x554c9d)[_0xa582('0x30')](_0x17d7fe);};}exports[_0xa582('0x31')]=function(_0x430c5d,_0x40c18a){var _0x59cb42={},_0x29e137={},_0x11ab73={'count':0x0,'rows':[]};var _0xe7fe5f=_[_0xa582('0x32')](db[_0xa582('0x33')][_0xa582('0x34')],function(_0x558790){return{'name':_0x558790['fieldName'],'type':_0x558790[_0xa582('0x35')]['key']};});_0x29e137[_0xa582('0x36')]=_[_0xa582('0x32')](_0xe7fe5f,_0xa582('0x2f'));_0x29e137['query']=_['keys'](_0x430c5d[_0xa582('0x37')]);_0x29e137[_0xa582('0x38')]=_['intersection'](_0x29e137[_0xa582('0x36')],_0x29e137[_0xa582('0x37')]);_0x59cb42[_0xa582('0x39')]=_[_0xa582('0x3a')](_0x29e137[_0xa582('0x36')],qs['fields'](_0x430c5d[_0xa582('0x37')]['fields']));_0x59cb42[_0xa582('0x39')]=_0x59cb42[_0xa582('0x39')][_0xa582('0x3b')]?_0x59cb42['attributes']:_0x29e137['model'];if(!_0x430c5d[_0xa582('0x37')][_0xa582('0x3c')]('nolimit')){_0x59cb42[_0xa582('0x23')]=qs[_0xa582('0x23')](_0x430c5d[_0xa582('0x37')][_0xa582('0x23')]);_0x59cb42[_0xa582('0x21')]=qs['offset'](_0x430c5d['query'][_0xa582('0x21')]);}_0x59cb42[_0xa582('0x3d')]=qs[_0xa582('0x3e')](_0x430c5d[_0xa582('0x37')]['sort']);_0x59cb42['where']=qs[_0xa582('0x38')](_[_0xa582('0x3f')](_0x430c5d[_0xa582('0x37')],_0x29e137[_0xa582('0x38')]),_0xe7fe5f);if(_0x430c5d[_0xa582('0x37')][_0xa582('0x40')]){_0x59cb42['where']=_[_0xa582('0x41')](_0x59cb42['where'],{'$or':_[_0xa582('0x32')](_0xe7fe5f,function(_0x4b9db5){if(_0x4b9db5[_0xa582('0x35')]!=='VIRTUAL'){var _0x5666ed={};_0x5666ed[_0x4b9db5['name']]={'$like':'%'+_0x430c5d['query'][_0xa582('0x40')]+'%'};return _0x5666ed;}})});}_0x59cb42=_[_0xa582('0x41')]({},_0x59cb42,_0x430c5d[_0xa582('0x42')]);var _0xffa706={'where':_0x59cb42[_0xa582('0x43')]};return db[_0xa582('0x33')]['count'](_0xffa706)[_0xa582('0x2b')](function(_0xe3e117){_0x11ab73['count']=_0xe3e117;if(_0x430c5d['query'][_0xa582('0x44')]){_0x59cb42[_0xa582('0x45')]=[{'all':!![]}];}return db[_0xa582('0x33')][_0xa582('0x46')](_0x59cb42);})[_0xa582('0x2b')](function(_0x378af6){_0x11ab73['rows']=_0x378af6;return _0x11ab73;})[_0xa582('0x2b')](respondWithFilteredResult(_0x40c18a,_0x59cb42))[_0xa582('0x47')](handleError(_0x40c18a,null));};exports[_0xa582('0x48')]=function(_0x31e128,_0x2524f9){var _0x5edf8e={'raw':![],'where':{'id':_0x31e128['params']['id']}},_0x296693={};_0x296693[_0xa582('0x36')]=_['keys'](db[_0xa582('0x33')][_0xa582('0x34')]);_0x296693[_0xa582('0x37')]=_[_0xa582('0x49')](_0x31e128[_0xa582('0x37')]);_0x296693[_0xa582('0x38')]=_[_0xa582('0x3a')](_0x296693['model'],_0x296693[_0xa582('0x37')]);_0x5edf8e[_0xa582('0x39')]=_[_0xa582('0x3a')](_0x296693[_0xa582('0x36')],qs[_0xa582('0x4a')](_0x31e128[_0xa582('0x37')][_0xa582('0x4a')]));_0x5edf8e[_0xa582('0x39')]=_0x5edf8e['attributes'][_0xa582('0x3b')]?_0x5edf8e[_0xa582('0x39')]:_0x296693[_0xa582('0x36')];if(_0x31e128['query']['includeAll']){_0x5edf8e[_0xa582('0x45')]=[{'all':!![]}];}_0x5edf8e=_[_0xa582('0x41')]({},_0x5edf8e,_0x31e128[_0xa582('0x42')]);return db[_0xa582('0x33')][_0xa582('0x4b')](_0x5edf8e)[_0xa582('0x2b')](handleEntityNotFound(_0x2524f9,null))[_0xa582('0x2b')](respondWithResult(_0x2524f9,null))[_0xa582('0x47')](handleError(_0x2524f9,null));};exports[_0xa582('0x4c')]=function(_0x47104c,_0x553041){return db[_0xa582('0x33')][_0xa582('0x4c')](_0x47104c[_0xa582('0x4d')],{})[_0xa582('0x2b')](respondWithResult(_0x553041,0xc9))[_0xa582('0x47')](handleError(_0x553041,null));};exports[_0xa582('0x2a')]=function(_0x26f268,_0x1e63d6){if(_0x26f268['body']['id']){delete _0x26f268[_0xa582('0x4d')]['id'];}return db['VoiceQueueReport'][_0xa582('0x4b')]({'where':{'id':_0x26f268[_0xa582('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1e63d6,null))[_0xa582('0x2b')](saveUpdates(_0x26f268[_0xa582('0x4d')],null))[_0xa582('0x2b')](respondWithResult(_0x1e63d6,null))['catch'](handleError(_0x1e63d6,null));};exports['destroy']=function(_0x572886,_0x47f96e){return db[_0xa582('0x33')][_0xa582('0x4b')]({'where':{'id':_0x572886[_0xa582('0x4e')]['id']}})['then'](handleEntityNotFound(_0x47f96e,null))[_0xa582('0x2b')](removeEntity(_0x47f96e,null))[_0xa582('0x47')](handleError(_0x47f96e,null));};exports[_0xa582('0x4f')]=function(_0x282002,_0x32ff68){return db[_0xa582('0x33')]['describe']()['then'](respondWithResult(_0x32ff68,null))[_0xa582('0x47')](handleError(_0x32ff68,null));};exports[_0xa582('0x50')]=function(_0x590944,_0x58f02b){var _0x171c62={},_0x1b6123={},_0x15b146={'count':0x0,'rows':[]};_0x1b6123[_0xa582('0x36')]=_['keys'](db[_0xa582('0x33')][_0xa582('0x34')]);_0x1b6123['query']=_[_0xa582('0x49')](_0x590944[_0xa582('0x37')]);_0x1b6123['filters']=_[_0xa582('0x3a')](_0x1b6123['model'],_0x1b6123[_0xa582('0x37')]);_0x171c62['attributes']=_['intersection'](_0x1b6123[_0xa582('0x36')],qs[_0xa582('0x4a')](_0x590944[_0xa582('0x37')][_0xa582('0x4a')]));_0x171c62[_0xa582('0x39')]=_0x171c62[_0xa582('0x39')][_0xa582('0x3b')]?_0x171c62[_0xa582('0x39')]:_0x1b6123[_0xa582('0x36')];if(!_0x590944[_0xa582('0x37')][_0xa582('0x3c')](_0xa582('0x51'))){_0x171c62['limit']=qs[_0xa582('0x23')](_0x590944[_0xa582('0x37')][_0xa582('0x23')]);_0x171c62[_0xa582('0x21')]=qs[_0xa582('0x21')](_0x590944[_0xa582('0x37')][_0xa582('0x21')]);}_0x171c62[_0xa582('0x3d')]=qs['sort'](_0x590944[_0xa582('0x37')][_0xa582('0x3e')]);_0x171c62[_0xa582('0x43')]=qs[_0xa582('0x38')](_['pick'](_0x590944[_0xa582('0x37')],_0x1b6123[_0xa582('0x38')]));if(_0x590944[_0xa582('0x37')][_0xa582('0x40')]){_0x171c62[_0xa582('0x43')]=_[_0xa582('0x41')](_0x171c62['where'],{'$or':_[_0xa582('0x32')](_0x171c62[_0xa582('0x39')],function(_0x579176){var _0x2ff1c0={};_0x2ff1c0[_0x579176]={'$like':'%'+_0x590944[_0xa582('0x37')][_0xa582('0x40')]+'%'};return _0x2ff1c0;})});}_0x171c62=_['merge']({},_0x171c62,_0x590944[_0xa582('0x42')]);var _0x26046b={'where':_0x171c62['where']};return db['VoiceQueueReport'][_0xa582('0x24')](_0x26046b)['then'](function(_0x70dd5d){_0x15b146[_0xa582('0x24')]=_0x70dd5d;if(_0x590944[_0xa582('0x37')]['includeAll']){_0x171c62[_0xa582('0x45')]=[{'all':!![]}];}return db[_0xa582('0x33')][_0xa582('0x46')](_0x171c62);})[_0xa582('0x2b')](function(_0x19e9ea){_0x15b146['rows']=_0x19e9ea;return _0x15b146;})[_0xa582('0x2b')](respondWithFilteredResult(_0x58f02b,_0x171c62,_0xa582('0x50')))[_0xa582('0x47')](handleError(_0x58f02b,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x9902=['include','findAll','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','VoiceQueueReport','rows','catch','show','find','create','body','update','params'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x9902,0xfb));var _0x2990=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9902[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x2990('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2990('0x1'));var rp=require('request-promise');var moment=require(_0x2990('0x2'));var BPromise=require(_0x2990('0x3'));var Mustache=require(_0x2990('0x4'));var util=require(_0x2990('0x5'));var path=require(_0x2990('0x6'));var sox=require(_0x2990('0x7'));var csv=require('to-csv');var ejs=require(_0x2990('0x8'));var fs=require('fs');var fs_extra=require(_0x2990('0x9'));var _=require(_0x2990('0xa'));var squel=require('squel');var crypto=require(_0x2990('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2990('0xc'));var toCsv=require(_0x2990('0xd'));var querystring=require(_0x2990('0xe'));var Papa=require(_0x2990('0xf'));var Redis=require(_0x2990('0x10'));var authService=require(_0x2990('0x11'));var qs=require(_0x2990('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2990('0x13'));var logger=require(_0x2990('0x14'))('api');var utils=require(_0x2990('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2990('0x16'));var db=require('../../mysqldb')['db'];config[_0x2990('0x17')]=_[_0x2990('0x18')](config[_0x2990('0x17')],{'host':_0x2990('0x19'),'port':0x18eb});var socket=require(_0x2990('0x1a'))(new Redis(config[_0x2990('0x17')]));require(_0x2990('0x1b'))[_0x2990('0x1c')](socket);function respondWithStatusCode(_0xbbaca0,_0x40af8b){_0x40af8b=_0x40af8b||0xcc;return function(_0x3e2efd){if(_0x3e2efd){return _0xbbaca0['sendStatus'](_0x40af8b);}return _0xbbaca0[_0x2990('0x1d')](_0x40af8b)[_0x2990('0x1e')]();};}function respondWithResult(_0x1a300c,_0x499dc0){_0x499dc0=_0x499dc0||0xc8;return function(_0x1ed9a7){if(_0x1ed9a7){return _0x1a300c['status'](_0x499dc0)[_0x2990('0x1f')](_0x1ed9a7);}};}function respondWithFilteredResult(_0x1e256f,_0x2b9e30){return function(_0x481c7b){if(_0x481c7b){var _0x376310=typeof _0x2b9e30[_0x2990('0x20')]==='undefined'&&typeof _0x2b9e30[_0x2990('0x21')]===_0x2990('0x22');var _0x44e422=_0x481c7b[_0x2990('0x23')];var _0x5a256b=_0x376310?0x0:_0x2b9e30[_0x2990('0x20')];var _0x25e36a=_0x376310?_0x481c7b[_0x2990('0x23')]:_0x2b9e30[_0x2990('0x20')]+_0x2b9e30[_0x2990('0x21')];var _0x45743b;if(_0x25e36a>=_0x44e422){_0x25e36a=_0x44e422;_0x45743b=0xc8;}else{_0x45743b=0xce;}_0x1e256f[_0x2990('0x1d')](_0x45743b);return _0x1e256f[_0x2990('0x24')](_0x2990('0x25'),_0x5a256b+'-'+_0x25e36a+'/'+_0x44e422)[_0x2990('0x1f')](_0x481c7b);}return null;};}function patchUpdates(_0x9f222){return function(_0x47bbe1){try{jsonpatch[_0x2990('0x26')](_0x47bbe1,_0x9f222,!![]);}catch(_0x29bcb5){return BPromise[_0x2990('0x27')](_0x29bcb5);}return _0x47bbe1[_0x2990('0x28')]();};}function saveUpdates(_0x11c1eb,_0x404673){return function(_0x5555ed){if(_0x5555ed){return _0x5555ed['update'](_0x11c1eb)[_0x2990('0x29')](function(_0x36ca15){return _0x36ca15;});}return null;};}function removeEntity(_0x266df1,_0x2a8197){return function(_0xaecd3b){if(_0xaecd3b){return _0xaecd3b[_0x2990('0x2a')]()[_0x2990('0x29')](function(){_0x266df1[_0x2990('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7fc4,_0x5e814f){return function(_0x2636fe){if(!_0x2636fe){_0x1f7fc4[_0x2990('0x2b')](0x194);}return _0x2636fe;};}function handleError(_0x10d40a,_0x3f30ed){_0x3f30ed=_0x3f30ed||0x1f4;return function(_0x4b49af){logger[_0x2990('0x2c')](_0x4b49af['stack']);if(_0x4b49af['name']){delete _0x4b49af[_0x2990('0x2d')];}_0x10d40a[_0x2990('0x1d')](_0x3f30ed)[_0x2990('0x2e')](_0x4b49af);};}exports[_0x2990('0x2f')]=function(_0x409fe0,_0x3f9af6){var _0x1a9325={},_0xb22e56={},_0x310dd3={'count':0x0,'rows':[]};var _0x1e96d7=_[_0x2990('0x30')](db['VoiceQueueReport'][_0x2990('0x31')],function(_0x1fd97a){return{'name':_0x1fd97a[_0x2990('0x32')],'type':_0x1fd97a[_0x2990('0x33')][_0x2990('0x34')]};});_0xb22e56[_0x2990('0x35')]=_[_0x2990('0x30')](_0x1e96d7,'name');_0xb22e56[_0x2990('0x36')]=_[_0x2990('0x37')](_0x409fe0['query']);_0xb22e56[_0x2990('0x38')]=_[_0x2990('0x39')](_0xb22e56[_0x2990('0x35')],_0xb22e56['query']);_0x1a9325[_0x2990('0x3a')]=_[_0x2990('0x39')](_0xb22e56['model'],qs[_0x2990('0x3b')](_0x409fe0['query'][_0x2990('0x3b')]));_0x1a9325[_0x2990('0x3a')]=_0x1a9325[_0x2990('0x3a')][_0x2990('0x3c')]?_0x1a9325[_0x2990('0x3a')]:_0xb22e56[_0x2990('0x35')];if(!_0x409fe0[_0x2990('0x36')][_0x2990('0x3d')](_0x2990('0x3e'))){_0x1a9325['limit']=qs[_0x2990('0x21')](_0x409fe0[_0x2990('0x36')][_0x2990('0x21')]);_0x1a9325[_0x2990('0x20')]=qs['offset'](_0x409fe0[_0x2990('0x36')]['offset']);}_0x1a9325[_0x2990('0x3f')]=qs[_0x2990('0x40')](_0x409fe0[_0x2990('0x36')][_0x2990('0x40')]);_0x1a9325[_0x2990('0x41')]=qs[_0x2990('0x38')](_[_0x2990('0x42')](_0x409fe0[_0x2990('0x36')],_0xb22e56['filters']),_0x1e96d7);if(_0x409fe0[_0x2990('0x36')][_0x2990('0x43')]){_0x1a9325[_0x2990('0x41')]=_[_0x2990('0x44')](_0x1a9325[_0x2990('0x41')],{'$or':_[_0x2990('0x30')](_0x1e96d7,function(_0x3dc31f){if(_0x3dc31f[_0x2990('0x33')]!==_0x2990('0x45')){var _0x1c2e07={};_0x1c2e07[_0x3dc31f[_0x2990('0x2d')]]={'$like':'%'+_0x409fe0[_0x2990('0x36')][_0x2990('0x43')]+'%'};return _0x1c2e07;}})});}_0x1a9325=_[_0x2990('0x44')]({},_0x1a9325,_0x409fe0[_0x2990('0x46')]);var _0x17d390={'where':_0x1a9325['where']};return db['VoiceQueueReport'][_0x2990('0x23')](_0x17d390)[_0x2990('0x29')](function(_0x3d7147){_0x310dd3[_0x2990('0x23')]=_0x3d7147;if(_0x409fe0[_0x2990('0x36')][_0x2990('0x47')]){_0x1a9325['include']=[{'all':!![]}];}return db[_0x2990('0x48')]['findAll'](_0x1a9325);})['then'](function(_0x281f66){_0x310dd3[_0x2990('0x49')]=_0x281f66;return _0x310dd3;})[_0x2990('0x29')](respondWithFilteredResult(_0x3f9af6,_0x1a9325))[_0x2990('0x4a')](handleError(_0x3f9af6,null));};exports[_0x2990('0x4b')]=function(_0x4bd575,_0x1c086d){var _0x2dcee1={'raw':![],'where':{'id':_0x4bd575['params']['id']}},_0x469b31={};_0x469b31[_0x2990('0x35')]=_[_0x2990('0x37')](db[_0x2990('0x48')][_0x2990('0x31')]);_0x469b31[_0x2990('0x36')]=_[_0x2990('0x37')](_0x4bd575[_0x2990('0x36')]);_0x469b31[_0x2990('0x38')]=_['intersection'](_0x469b31[_0x2990('0x35')],_0x469b31[_0x2990('0x36')]);_0x2dcee1['attributes']=_[_0x2990('0x39')](_0x469b31[_0x2990('0x35')],qs['fields'](_0x4bd575[_0x2990('0x36')][_0x2990('0x3b')]));_0x2dcee1['attributes']=_0x2dcee1['attributes'][_0x2990('0x3c')]?_0x2dcee1[_0x2990('0x3a')]:_0x469b31['model'];if(_0x4bd575[_0x2990('0x36')]['includeAll']){_0x2dcee1['include']=[{'all':!![]}];}_0x2dcee1=_[_0x2990('0x44')]({},_0x2dcee1,_0x4bd575[_0x2990('0x46')]);return db[_0x2990('0x48')][_0x2990('0x4c')](_0x2dcee1)[_0x2990('0x29')](handleEntityNotFound(_0x1c086d,null))[_0x2990('0x29')](respondWithResult(_0x1c086d,null))[_0x2990('0x4a')](handleError(_0x1c086d,null));};exports[_0x2990('0x4d')]=function(_0x568b02,_0x2ed08e){return db[_0x2990('0x48')][_0x2990('0x4d')](_0x568b02[_0x2990('0x4e')],{})[_0x2990('0x29')](respondWithResult(_0x2ed08e,0xc9))['catch'](handleError(_0x2ed08e,null));};exports[_0x2990('0x4f')]=function(_0x5ef8ee,_0xa584a0){if(_0x5ef8ee['body']['id']){delete _0x5ef8ee['body']['id'];}return db[_0x2990('0x48')][_0x2990('0x4c')]({'where':{'id':_0x5ef8ee[_0x2990('0x50')]['id']}})[_0x2990('0x29')](handleEntityNotFound(_0xa584a0,null))[_0x2990('0x29')](saveUpdates(_0x5ef8ee['body'],null))['then'](respondWithResult(_0xa584a0,null))['catch'](handleError(_0xa584a0,null));};exports['destroy']=function(_0x5512a6,_0x5bfbe5){return db[_0x2990('0x48')][_0x2990('0x4c')]({'where':{'id':_0x5512a6['params']['id']}})['then'](handleEntityNotFound(_0x5bfbe5,null))[_0x2990('0x29')](removeEntity(_0x5bfbe5,null))[_0x2990('0x4a')](handleError(_0x5bfbe5,null));};exports['describe']=function(_0xf226d1,_0x2428e4){return db[_0x2990('0x48')]['describe']()[_0x2990('0x29')](respondWithResult(_0x2428e4,null))[_0x2990('0x4a')](handleError(_0x2428e4,null));};exports['getVoiceQueuesReport']=function(_0x5ac09a,_0x3af0fc){var _0x327822={},_0x13d0be={},_0x3725fd={'count':0x0,'rows':[]};_0x13d0be[_0x2990('0x35')]=_[_0x2990('0x37')](db[_0x2990('0x48')][_0x2990('0x31')]);_0x13d0be[_0x2990('0x36')]=_[_0x2990('0x37')](_0x5ac09a['query']);_0x13d0be[_0x2990('0x38')]=_[_0x2990('0x39')](_0x13d0be[_0x2990('0x35')],_0x13d0be[_0x2990('0x36')]);_0x327822['attributes']=_[_0x2990('0x39')](_0x13d0be['model'],qs[_0x2990('0x3b')](_0x5ac09a['query']['fields']));_0x327822[_0x2990('0x3a')]=_0x327822[_0x2990('0x3a')][_0x2990('0x3c')]?_0x327822[_0x2990('0x3a')]:_0x13d0be[_0x2990('0x35')];if(!_0x5ac09a['query'][_0x2990('0x3d')]('nolimit')){_0x327822[_0x2990('0x21')]=qs[_0x2990('0x21')](_0x5ac09a['query'][_0x2990('0x21')]);_0x327822['offset']=qs[_0x2990('0x20')](_0x5ac09a[_0x2990('0x36')][_0x2990('0x20')]);}_0x327822['order']=qs[_0x2990('0x40')](_0x5ac09a[_0x2990('0x36')]['sort']);_0x327822[_0x2990('0x41')]=qs[_0x2990('0x38')](_[_0x2990('0x42')](_0x5ac09a['query'],_0x13d0be[_0x2990('0x38')]));if(_0x5ac09a[_0x2990('0x36')][_0x2990('0x43')]){_0x327822[_0x2990('0x41')]=_['merge'](_0x327822['where'],{'$or':_['map'](_0x327822[_0x2990('0x3a')],function(_0x154ec8){var _0x12ba40={};_0x12ba40[_0x154ec8]={'$like':'%'+_0x5ac09a[_0x2990('0x36')]['filter']+'%'};return _0x12ba40;})});}_0x327822=_[_0x2990('0x44')]({},_0x327822,_0x5ac09a['options']);var _0x42d7c4={'where':_0x327822[_0x2990('0x41')]};return db[_0x2990('0x48')]['count'](_0x42d7c4)[_0x2990('0x29')](function(_0x43c032){_0x3725fd[_0x2990('0x23')]=_0x43c032;if(_0x5ac09a['query'][_0x2990('0x47')]){_0x327822[_0x2990('0x51')]=[{'all':!![]}];}return db[_0x2990('0x48')][_0x2990('0x52')](_0x327822);})['then'](function(_0x113ba9){_0x3725fd[_0x2990('0x49')]=_0x113ba9;return _0x3725fd;})['then'](respondWithFilteredResult(_0x3af0fc,_0x327822,'getVoiceQueuesReport'))[_0x2990('0x4a')](handleError(_0x3af0fc,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6fcbfd5..54ba14e 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 _0x2d2e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x315843,_0x301556){var _0x4fd3bc=function(_0x498e22){while(--_0x498e22){_0x315843['push'](_0x315843['shift']());}};_0x4fd3bc(++_0x301556);}(_0x2d2e,0xcd));var _0xe2d2=function(_0x38f737,_0x54f685){_0x38f737=_0x38f737-0x0;var _0x7afda3=_0x2d2e[_0x38f737];return _0x7afda3;};'use strict';var EventEmitter=require(_0xe2d2('0x0'));var VoiceQueueReport=require(_0xe2d2('0x1'))['db'][_0xe2d2('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe2d2('0x3')](0x0);var events={'afterCreate':_0xe2d2('0x4'),'afterUpdate':'update','afterDestroy':_0xe2d2('0x5')};function emitEvent(_0xdab313){return function(_0x4fdcdc,_0x2eba09,_0x4e009c){VoiceQueueReportEvents[_0xe2d2('0x6')](_0xdab313+':'+_0x4fdcdc['id'],_0x4fdcdc);VoiceQueueReportEvents[_0xe2d2('0x6')](_0xdab313,_0x4fdcdc);_0x4e009c(null);};}for(var e in events){if(events[_0xe2d2('0x7')](e)){var event=events[e];VoiceQueueReport[_0xe2d2('0x8')](e,emitEvent(event));}}module[_0xe2d2('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x2f58=['events','../../mysqldb','VoiceQueueReport','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x2846bb,_0x5103b4){var _0x1f3a62=function(_0x37afa4){while(--_0x37afa4){_0x2846bb['push'](_0x2846bb['shift']());}};_0x1f3a62(++_0x5103b4);}(_0x2f58,0x1d4));var _0x82f5=function(_0x1567dc,_0x507721){_0x1567dc=_0x1567dc-0x0;var _0x3d0ef8=_0x2f58[_0x1567dc];return _0x3d0ef8;};'use strict';var EventEmitter=require(_0x82f5('0x0'));var VoiceQueueReport=require(_0x82f5('0x1'))['db'][_0x82f5('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x82f5('0x3'),'afterUpdate':_0x82f5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e7bdb){return function(_0x1130f1,_0x5966a0,_0x24fbf5){VoiceQueueReportEvents['emit'](_0x2e7bdb+':'+_0x1130f1['id'],_0x1130f1);VoiceQueueReportEvents[_0x82f5('0x5')](_0x2e7bdb,_0x1130f1);_0x24fbf5(null);};}for(var e in events){if(events[_0x82f5('0x6')](e)){var event=events[e];VoiceQueueReport[_0x82f5('0x7')](e,emitEvent(event));}}module[_0x82f5('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 93d7f41..76ea723 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 _0x058f=['calleridnum','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0xd41cd7,_0x5ae3ea){var _0x24b0e1=function(_0x511524){while(--_0x511524){_0xd41cd7['push'](_0xd41cd7['shift']());}};_0x24b0e1(++_0x5ae3ea);}(_0x058f,0xc5));var _0xf058=function(_0x27b94d,_0x5e7b63){_0x27b94d=_0x27b94d-0x0;var _0x101957=_0x058f[_0x27b94d];return _0x101957;};'use strict';var _=require(_0xf058('0x0'));var util=require('util');var logger=require(_0xf058('0x1'))(_0xf058('0x2'));var moment=require(_0xf058('0x3'));var BPromise=require(_0xf058('0x4'));var rp=require(_0xf058('0x5'));var fs=require('fs');var path=require(_0xf058('0x6'));var rimraf=require('rimraf');var config=require(_0xf058('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0xf058('0x8')]=function(_0x5996af,_0x3b5cbe){return _0x5996af[_0xf058('0x9')](_0xf058('0xa'),attributes,{'tableName':_0xf058('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf058('0xc')]},{'fields':[_0xf058('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cc6=['../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x394bf7,_0xa6156e){var _0x1fabef=function(_0x74e3ab){while(--_0x74e3ab){_0x394bf7['push'](_0x394bf7['shift']());}};_0x1fabef(++_0xa6156e);}(_0x4cc6,0x116));var _0x64cc=function(_0x260b48,_0x117977){_0x260b48=_0x260b48-0x0;var _0x3f730b=_0x4cc6[_0x260b48];return _0x3f730b;};'use strict';var _=require(_0x64cc('0x0'));var util=require(_0x64cc('0x1'));var logger=require(_0x64cc('0x2'))(_0x64cc('0x3'));var moment=require(_0x64cc('0x4'));var BPromise=require(_0x64cc('0x5'));var rp=require(_0x64cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x64cc('0x7'));var attributes=require(_0x64cc('0x8'));module[_0x64cc('0x9')]=function(_0x26c565,_0x32025f){return _0x26c565[_0x64cc('0xa')](_0x64cc('0xb'),attributes,{'tableName':_0x64cc('0xc'),'paranoid':![],'indexes':[{'fields':[_0x64cc('0xd')]},{'fields':[_0x64cc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 21b8ca4..cb5a4c2 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 _0xa1f3=['create','body','UpdateVoiceQueueReport','update','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit','map','include','model','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport'];(function(_0x19e536,_0x15caa5){var _0x52b859=function(_0xe06df0){while(--_0xe06df0){_0x19e536['push'](_0x19e536['shift']());}};_0x52b859(++_0x15caa5);}(_0xa1f3,0x154));var _0x3a1f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa1f3[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x3a1f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3a1f('0x1'));var rs=require(_0x3a1f('0x2'));var fs=require('fs');var Redis=require(_0x3a1f('0x3'));var db=require(_0x3a1f('0x4'))['db'];var utils=require(_0x3a1f('0x5'));var logger=require('../../config/logger')(_0x3a1f('0x6'));var config=require(_0x3a1f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3a1f('0x8')]({'port':0x232a});config['redis']=_[_0x3a1f('0x9')](config[_0x3a1f('0xa')],{'host':_0x3a1f('0xb'),'port':0x18eb});var socket=require(_0x3a1f('0xc'))(new Redis(config[_0x3a1f('0xa')]));require(_0x3a1f('0xd'))[_0x3a1f('0xe')](socket);function respondWithRpcPromise(_0x51dbf4,_0xb7be88,_0x473f72){return new BPromise(function(_0x46bc1b,_0x581f4b){return client['request'](_0x51dbf4,_0x473f72)[_0x3a1f('0xf')](function(_0x78c13e){logger[_0x3a1f('0x10')](_0x3a1f('0x11'),_0xb7be88,'request\x20sent');logger[_0x3a1f('0x12')](_0x3a1f('0x13'),_0xb7be88,_0x3a1f('0x14'),JSON[_0x3a1f('0x15')](_0x78c13e));if(_0x78c13e[_0x3a1f('0x16')]){if(_0x78c13e['error'][_0x3a1f('0x17')]===0x1f4){logger[_0x3a1f('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0xb7be88,_0x78c13e['error'][_0x3a1f('0x18')]);return _0x581f4b(_0x78c13e['error'][_0x3a1f('0x18')]);}logger[_0x3a1f('0x16')](_0x3a1f('0x11'),_0xb7be88,_0x78c13e['error'][_0x3a1f('0x18')]);return _0x46bc1b(_0x78c13e['error']['message']);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0xb7be88,_0x3a1f('0x14'));_0x46bc1b(_0x78c13e['result']['message']);}})[_0x3a1f('0x19')](function(_0x1d0628){logger['error'](_0x3a1f('0x11'),_0xb7be88,_0x1d0628);_0x581f4b(_0x1d0628);});});}exports['GetVoiceQueueReport']=function(_0x90a9c4){var _0x3de86d=this;return new Promise(function(_0x3a7f5a,_0x7e6e33){return db['VoiceQueueReport'][_0x3a1f('0x1a')]({'raw':_0x90a9c4[_0x3a1f('0x1b')]?_0x90a9c4[_0x3a1f('0x1b')][_0x3a1f('0x1c')]===undefined?!![]:![]:!![],'where':_0x90a9c4[_0x3a1f('0x1b')]?_0x90a9c4[_0x3a1f('0x1b')][_0x3a1f('0x1d')]||null:null,'attributes':_0x90a9c4['options']?_0x90a9c4[_0x3a1f('0x1b')][_0x3a1f('0x1e')]||null:null,'limit':_0x90a9c4[_0x3a1f('0x1b')]?_0x90a9c4['options'][_0x3a1f('0x1f')]||null:null,'include':_0x90a9c4[_0x3a1f('0x1b')]?_0x90a9c4[_0x3a1f('0x1b')]['include']?_[_0x3a1f('0x20')](_0x90a9c4[_0x3a1f('0x1b')]['include'],function(_0xff1a56){return{'model':db[_0xff1a56['model']],'as':_0xff1a56['as'],'attributes':_0xff1a56[_0x3a1f('0x1e')],'include':_0xff1a56[_0x3a1f('0x21')]?_['map'](_0xff1a56[_0x3a1f('0x21')],function(_0x4c8c81){return{'model':db[_0x4c8c81[_0x3a1f('0x22')]],'as':_0x4c8c81['as'],'attributes':_0x4c8c81[_0x3a1f('0x1e')],'include':_0x4c8c81[_0x3a1f('0x21')]?_[_0x3a1f('0x20')](_0x4c8c81[_0x3a1f('0x21')],function(_0x1d2deb){return{'model':db[_0x1d2deb['model']],'as':_0x1d2deb['as'],'attributes':_0x1d2deb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aa251){logger[_0x3a1f('0x10')](_0x3a1f('0x23'),_0x90a9c4);logger[_0x3a1f('0x12')](_0x3a1f('0x23'),_0x90a9c4,JSON['stringify'](_0x4aa251));_0x3a7f5a(_0x4aa251);})[_0x3a1f('0x19')](function(_0x2a298c){logger[_0x3a1f('0x16')](_0x3a1f('0x23'),_0x2a298c[_0x3a1f('0x18')],_0x90a9c4);_0x7e6e33(_0x3de86d[_0x3a1f('0x16')](0x1f4,_0x2a298c[_0x3a1f('0x18')]));});});};exports[_0x3a1f('0x24')]=function(_0x351c6d){var _0x133db0=this;return new Promise(function(_0x19a25a,_0x4a26a8){return db[_0x3a1f('0x25')][_0x3a1f('0x26')](_0x351c6d[_0x3a1f('0x27')],{'raw':_0x351c6d[_0x3a1f('0x1b')]?_0x351c6d[_0x3a1f('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3a1f('0xf')](function(_0x926021){logger['info']('CreateVoiceQueueReport',_0x351c6d);logger[_0x3a1f('0x12')](_0x3a1f('0x24'),_0x351c6d,JSON[_0x3a1f('0x15')](_0x926021));_0x19a25a(_0x926021);})['catch'](function(_0x37ef22){logger[_0x3a1f('0x16')]('CreateVoiceQueueReport',_0x37ef22[_0x3a1f('0x18')],_0x351c6d);_0x4a26a8(_0x133db0['error'](0x1f4,_0x37ef22[_0x3a1f('0x18')]));});});};exports[_0x3a1f('0x28')]=function(_0x20b42e){var _0x1b8405=this;return new Promise(function(_0x440be9,_0x3f4129){return db['VoiceQueueReport'][_0x3a1f('0x29')](_0x20b42e[_0x3a1f('0x27')],{'raw':_0x20b42e[_0x3a1f('0x1b')]?_0x20b42e[_0x3a1f('0x1b')][_0x3a1f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b42e['options']?_0x20b42e['options'][_0x3a1f('0x1d')]||null:null,'attributes':_0x20b42e['options']?_0x20b42e[_0x3a1f('0x1b')][_0x3a1f('0x1e')]||null:null,'limit':_0x20b42e['options']?_0x20b42e[_0x3a1f('0x1b')]['limit']||null:null})[_0x3a1f('0xf')](function(_0x1a3364){logger[_0x3a1f('0x10')](_0x3a1f('0x28'),_0x20b42e);logger[_0x3a1f('0x12')]('UpdateVoiceQueueReport',_0x20b42e,JSON[_0x3a1f('0x15')](_0x1a3364));_0x440be9(_0x1a3364);})[_0x3a1f('0x19')](function(_0x1e3e35){logger[_0x3a1f('0x16')](_0x3a1f('0x28'),_0x1e3e35['message'],_0x20b42e);_0x3f4129(_0x1b8405['error'](0x1f4,_0x1e3e35[_0x3a1f('0x18')]));});});}; \ No newline at end of file +var _0xaf86=['code','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','model','map','stringify','CreateVoiceQueueReport','raw','UpdateVoiceQueueReport','update','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf86,0x12c));var _0x6af8=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xaf86[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x6af8('0x0'));var util=require('util');var moment=require(_0x6af8('0x1'));var BPromise=require(_0x6af8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6af8('0x3'));var logger=require(_0x6af8('0x4'))(_0x6af8('0x5'));var config=require(_0x6af8('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6af8('0x7')]({'port':0x232a});config[_0x6af8('0x8')]=_[_0x6af8('0x9')](config['redis'],{'host':_0x6af8('0xa'),'port':0x18eb});var socket=require(_0x6af8('0xb'))(new Redis(config[_0x6af8('0x8')]));require(_0x6af8('0xc'))[_0x6af8('0xd')](socket);function respondWithRpcPromise(_0x4f4205,_0xa49443,_0x44a36a){return new BPromise(function(_0x244028,_0x2fb923){return client['request'](_0x4f4205,_0x44a36a)[_0x6af8('0xe')](function(_0x3a9d9d){logger[_0x6af8('0xf')](_0x6af8('0x10'),_0xa49443,'request\x20sent');logger[_0x6af8('0x11')](_0x6af8('0x12'),_0xa49443,_0x6af8('0x13'),JSON['stringify'](_0x3a9d9d));if(_0x3a9d9d['error']){if(_0x3a9d9d['error'][_0x6af8('0x14')]===0x1f4){logger[_0x6af8('0x15')](_0x6af8('0x10'),_0xa49443,_0x3a9d9d[_0x6af8('0x15')][_0x6af8('0x16')]);return _0x2fb923(_0x3a9d9d[_0x6af8('0x15')][_0x6af8('0x16')]);}logger[_0x6af8('0x15')](_0x6af8('0x10'),_0xa49443,_0x3a9d9d[_0x6af8('0x15')][_0x6af8('0x16')]);return _0x244028(_0x3a9d9d['error']['message']);}else{logger[_0x6af8('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0xa49443,'request\x20sent');_0x244028(_0x3a9d9d[_0x6af8('0x17')][_0x6af8('0x16')]);}})[_0x6af8('0x18')](function(_0x12ef58){logger[_0x6af8('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0xa49443,_0x12ef58);_0x2fb923(_0x12ef58);});});}exports[_0x6af8('0x19')]=function(_0x33b39b){var _0x322551=this;return new Promise(function(_0x490203,_0x15ae36){return db[_0x6af8('0x1a')][_0x6af8('0x1b')]({'raw':_0x33b39b['options']?_0x33b39b[_0x6af8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x33b39b[_0x6af8('0x1c')]?_0x33b39b[_0x6af8('0x1c')][_0x6af8('0x1d')]||null:null,'attributes':_0x33b39b['options']?_0x33b39b[_0x6af8('0x1c')][_0x6af8('0x1e')]||null:null,'limit':_0x33b39b['options']?_0x33b39b[_0x6af8('0x1c')][_0x6af8('0x1f')]||null:null,'include':_0x33b39b[_0x6af8('0x1c')]?_0x33b39b[_0x6af8('0x1c')]['include']?_['map'](_0x33b39b[_0x6af8('0x1c')][_0x6af8('0x20')],function(_0x104a15){return{'model':db[_0x104a15[_0x6af8('0x21')]],'as':_0x104a15['as'],'attributes':_0x104a15[_0x6af8('0x1e')],'include':_0x104a15[_0x6af8('0x20')]?_[_0x6af8('0x22')](_0x104a15[_0x6af8('0x20')],function(_0x4c8af2){return{'model':db[_0x4c8af2[_0x6af8('0x21')]],'as':_0x4c8af2['as'],'attributes':_0x4c8af2[_0x6af8('0x1e')],'include':_0x4c8af2[_0x6af8('0x20')]?_['map'](_0x4c8af2[_0x6af8('0x20')],function(_0x13235d){return{'model':db[_0x13235d[_0x6af8('0x21')]],'as':_0x13235d['as'],'attributes':_0x13235d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6af8('0xe')](function(_0x4abdc3){logger['info'](_0x6af8('0x19'),_0x33b39b);logger[_0x6af8('0x11')]('GetVoiceQueueReport',_0x33b39b,JSON[_0x6af8('0x23')](_0x4abdc3));_0x490203(_0x4abdc3);})[_0x6af8('0x18')](function(_0x2b148b){logger[_0x6af8('0x15')](_0x6af8('0x19'),_0x2b148b[_0x6af8('0x16')],_0x33b39b);_0x15ae36(_0x322551[_0x6af8('0x15')](0x1f4,_0x2b148b[_0x6af8('0x16')]));});});};exports[_0x6af8('0x24')]=function(_0x3d8857){var _0x56987f=this;return new Promise(function(_0x23be1b,_0x371878){return db[_0x6af8('0x1a')]['create'](_0x3d8857['body'],{'raw':_0x3d8857[_0x6af8('0x1c')]?_0x3d8857[_0x6af8('0x1c')][_0x6af8('0x25')]===undefined?!![]:![]:!![]})['then'](function(_0x51efdf){logger[_0x6af8('0xf')](_0x6af8('0x24'),_0x3d8857);logger[_0x6af8('0x11')](_0x6af8('0x24'),_0x3d8857,JSON[_0x6af8('0x23')](_0x51efdf));_0x23be1b(_0x51efdf);})[_0x6af8('0x18')](function(_0x3f2a52){logger[_0x6af8('0x15')](_0x6af8('0x24'),_0x3f2a52[_0x6af8('0x16')],_0x3d8857);_0x371878(_0x56987f['error'](0x1f4,_0x3f2a52[_0x6af8('0x16')]));});});};exports[_0x6af8('0x26')]=function(_0x1bb825){var _0x614dbd=this;return new Promise(function(_0x33c802,_0x4f0faa){return db[_0x6af8('0x1a')][_0x6af8('0x27')](_0x1bb825['body'],{'raw':_0x1bb825[_0x6af8('0x1c')]?_0x1bb825[_0x6af8('0x1c')][_0x6af8('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bb825['options']?_0x1bb825[_0x6af8('0x1c')][_0x6af8('0x1d')]||null:null,'attributes':_0x1bb825[_0x6af8('0x1c')]?_0x1bb825['options'][_0x6af8('0x1e')]||null:null,'limit':_0x1bb825[_0x6af8('0x1c')]?_0x1bb825[_0x6af8('0x1c')][_0x6af8('0x1f')]||null:null})['then'](function(_0x3a4db8){logger[_0x6af8('0xf')](_0x6af8('0x26'),_0x1bb825);logger['debug'](_0x6af8('0x26'),_0x1bb825,JSON[_0x6af8('0x23')](_0x3a4db8));_0x33c802(_0x3a4db8);})[_0x6af8('0x18')](function(_0x26ff4b){logger[_0x6af8('0x15')](_0x6af8('0x26'),_0x26ff4b[_0x6af8('0x16')],_0x1bb825);_0x4f0faa(_0x614dbd[_0x6af8('0x15')](0x1f4,_0x26ff4b[_0x6af8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index f92ee1f..51bfe3b 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 _0x4c9e=['save','remove','update','removeListener','length'];(function(_0x667731,_0x3faeeb){var _0x4b788e=function(_0x2b3560){while(--_0x2b3560){_0x667731['push'](_0x667731['shift']());}};_0x4b788e(++_0x3faeeb);}(_0x4c9e,0x145));var _0xe4c9=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x4c9e[_0x1ddedd];return _0xa3e1ac;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xe4c9('0x0'),_0xe4c9('0x1'),_0xe4c9('0x2')];function createListener(_0x2805fd,_0x2b1870){return function(_0x35dd4b){_0x2b1870['emit'](_0x2805fd,_0x35dd4b);};}function removeListener(_0xc933ee,_0x4faaf0){return function(){VoiceQueueReportEvents[_0xe4c9('0x3')](_0xc933ee,_0x4faaf0);};}exports['register']=function(_0x2a2766){for(var _0x4891f4=0x0,_0x45b5b2=events[_0xe4c9('0x4')];_0x4891f4<_0x45b5b2;_0x4891f4++){var _0x515b78=events[_0x4891f4];var _0xf1f832=createListener('voiceQueueReport:'+_0x515b78,_0x2a2766);VoiceQueueReportEvents['on'](_0x515b78,_0xf1f832);}}; \ No newline at end of file +var _0xe444=['./voiceQueueReport.events','save','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x2d3d40,_0x2f6e9e){var _0xec2cee=function(_0x4765fc){while(--_0x4765fc){_0x2d3d40['push'](_0x2d3d40['shift']());}};_0xec2cee(++_0x2f6e9e);}(_0xe444,0xe0));var _0x4e44=function(_0x54d241,_0x527a05){_0x54d241=_0x54d241-0x0;var _0xbe1c65=_0xe444[_0x54d241];return _0xbe1c65;};'use strict';var VoiceQueueReportEvents=require(_0x4e44('0x0'));var events=[_0x4e44('0x1'),'remove','update'];function createListener(_0x234992,_0x31b323){return function(_0x33fde8){_0x31b323[_0x4e44('0x2')](_0x234992,_0x33fde8);};}function removeListener(_0x5aa738,_0x4c8454){return function(){VoiceQueueReportEvents[_0x4e44('0x3')](_0x5aa738,_0x4c8454);};}exports[_0x4e44('0x4')]=function(_0x31b783){for(var _0x59c7d1=0x0,_0x276d09=events[_0x4e44('0x5')];_0x59c7d1<_0x276d09;_0x59c7d1++){var _0x1af927=events[_0x59c7d1];var _0x5c021f=createListener(_0x4e44('0x6')+_0x1af927,_0x31b783);VoiceQueueReportEvents['on'](_0x1af927,_0x5c021f);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c9d69f9..59e60b3 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 _0xfe52=['get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x11361a,_0x438ed5){var _0x261bd7=function(_0x3c30d4){while(--_0x3c30d4){_0x11361a['push'](_0x11361a['shift']());}};_0x261bd7(++_0x438ed5);}(_0xfe52,0x1a8));var _0x2fe5=function(_0x4bab2c,_0x161460){_0x4bab2c=_0x4bab2c-0x0;var _0x3ddbcf=_0xfe52[_0x4bab2c];return _0x3ddbcf;};'use strict';var multer=require(_0x2fe5('0x0'));var util=require(_0x2fe5('0x1'));var path=require(_0x2fe5('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fe5('0x3'));var router=express['Router']();var fs_extra=require(_0x2fe5('0x4'));var auth=require(_0x2fe5('0x5'));var interaction=require(_0x2fe5('0x6'));var config=require(_0x2fe5('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x2fe5('0x8')]('/',auth[_0x2fe5('0x9')](),controller[_0x2fe5('0xa')]);router[_0x2fe5('0x8')](_0x2fe5('0xb'),auth['isAuthenticated'](),controller[_0x2fe5('0xc')]);router[_0x2fe5('0xd')]('/',auth[_0x2fe5('0x9')](),controller['create']);router[_0x2fe5('0xe')]('/:id',auth[_0x2fe5('0x9')](),controller['update']);router[_0x2fe5('0xf')]('/:id',auth[_0x2fe5('0x9')](),controller[_0x2fe5('0x10')]);module[_0x2fe5('0x11')]=router; \ No newline at end of file +var _0xf54c=['isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x5208fa,_0x2e0115){var _0x340255=function(_0x243db1){while(--_0x243db1){_0x5208fa['push'](_0x5208fa['shift']());}};_0x340255(++_0x2e0115);}(_0xf54c,0xa2));var _0xcf54=function(_0x125c6f,_0x2c21c6){_0x125c6f=_0x125c6f-0x0;var _0x10d168=_0xf54c[_0x125c6f];return _0x10d168;};'use strict';var multer=require(_0xcf54('0x0'));var util=require('util');var path=require(_0xcf54('0x1'));var timeout=require(_0xcf54('0x2'));var express=require('express');var router=express[_0xcf54('0x3')]();var fs_extra=require(_0xcf54('0x4'));var auth=require(_0xcf54('0x5'));var interaction=require(_0xcf54('0x6'));var config=require(_0xcf54('0x7'));var controller=require(_0xcf54('0x8'));router['get']('/',auth[_0xcf54('0x9')](),controller['index']);router[_0xcf54('0xa')](_0xcf54('0xb'),auth[_0xcf54('0x9')](),controller[_0xcf54('0xc')]);router[_0xcf54('0xd')]('/',auth[_0xcf54('0x9')](),controller['create']);router[_0xcf54('0xe')](_0xcf54('0xb'),auth['isAuthenticated'](),controller[_0xcf54('0xf')]);router[_0xcf54('0x10')](_0xcf54('0xb'),auth[_0xcf54('0x9')](),controller[_0xcf54('0x11')]);module[_0xcf54('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index add4efc..7b711c1 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 _0x958c=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','STRING','DATE','literal'];(function(_0x96e545,_0x6d2353){var _0x220db4=function(_0x3a4ad1){while(--_0x3a4ad1){_0x96e545['push'](_0x96e545['shift']());}};_0x220db4(++_0x6d2353);}(_0x958c,0x1b1));var _0xc958=function(_0x97db75,_0x3abdb8){_0x97db75=_0x97db75-0x0;var _0x259a53=_0x958c[_0x97db75];return _0x259a53;};'use strict';var Sequelize=require(_0xc958('0x0'));var moment=require(_0xc958('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xc958('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc958('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc958('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc958('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc958('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc958('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc958('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc958('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xc958('0x4')](_0xc958('0x5'))}}; \ No newline at end of file +var _0x370f=['exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x370f,0x1a8));var _0xf370=function(_0x41b683,_0x10e5ab){_0x41b683=_0x41b683-0x0;var _0x3e8d91=_0x370f[_0x41b683];return _0x3e8d91;};'use strict';var Sequelize=require(_0xf370('0x0'));var moment=require(_0xf370('0x1'));module[_0xf370('0x2')]={'time':{'type':Sequelize[_0xf370('0x3')]},'callid':{'type':Sequelize[_0xf370('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf370('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf370('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf370('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf370('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf370('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf370('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xf370('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf370('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf370('0x4')](_0xf370('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index dc9f6ef..39e75b4 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 _0x316c=['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/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','catch','show','params','find','create','body','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x11dc57,_0x150020){var _0x13932c=function(_0x2ee8f7){while(--_0x2ee8f7){_0x11dc57['push'](_0x11dc57['shift']());}};_0x13932c(++_0x150020);}(_0x316c,0x1e2));var _0xc316=function(_0x1705b8,_0x34be4f){_0x1705b8=_0x1705b8-0x0;var _0x170534=_0x316c[_0x1705b8];return _0x170534;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc316('0x0'));var zipdir=require(_0xc316('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc316('0x2'));var moment=require(_0xc316('0x3'));var BPromise=require(_0xc316('0x4'));var Mustache=require(_0xc316('0x5'));var util=require(_0xc316('0x6'));var path=require(_0xc316('0x7'));var sox=require(_0xc316('0x8'));var csv=require(_0xc316('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc316('0xa'));var _=require(_0xc316('0xb'));var squel=require(_0xc316('0xc'));var crypto=require(_0xc316('0xd'));var jsforce=require(_0xc316('0xe'));var deskjs=require(_0xc316('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc316('0x10'));var Papa=require('papaparse');var Redis=require(_0xc316('0x11'));var authService=require(_0xc316('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc316('0x13'));var hardwareService=require(_0xc316('0x14'));var logger=require(_0xc316('0x15'))(_0xc316('0x16'));var utils=require(_0xc316('0x17'));var config=require(_0xc316('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc316('0x19'))['db'];function respondWithStatusCode(_0x5195f6,_0x3ca4b4){_0x3ca4b4=_0x3ca4b4||0xcc;return function(_0x313978){if(_0x313978){return _0x5195f6['sendStatus'](_0x3ca4b4);}return _0x5195f6[_0xc316('0x1a')](_0x3ca4b4)[_0xc316('0x1b')]();};}function respondWithResult(_0x11581b,_0x3a14aa){_0x3a14aa=_0x3a14aa||0xc8;return function(_0xca3b3e){if(_0xca3b3e){return _0x11581b[_0xc316('0x1a')](_0x3a14aa)[_0xc316('0x1c')](_0xca3b3e);}};}function respondWithFilteredResult(_0x1d2bdb,_0x53f2f6){return function(_0x1eb9b7){if(_0x1eb9b7){var _0xe24f69=typeof _0x53f2f6[_0xc316('0x1d')]===_0xc316('0x1e')&&typeof _0x53f2f6['limit']===_0xc316('0x1e');var _0x5b7997=_0x1eb9b7[_0xc316('0x1f')];var _0x430b29=_0xe24f69?0x0:_0x53f2f6[_0xc316('0x1d')];var _0x14abbc=_0xe24f69?_0x1eb9b7[_0xc316('0x1f')]:_0x53f2f6['offset']+_0x53f2f6[_0xc316('0x20')];var _0x56dffc;if(_0x14abbc>=_0x5b7997){_0x14abbc=_0x5b7997;_0x56dffc=0xc8;}else{_0x56dffc=0xce;}_0x1d2bdb['status'](_0x56dffc);return _0x1d2bdb['set'](_0xc316('0x21'),_0x430b29+'-'+_0x14abbc+'/'+_0x5b7997)['json'](_0x1eb9b7);}return null;};}function patchUpdates(_0xb261a){return function(_0x24a2d5){try{jsonpatch['apply'](_0x24a2d5,_0xb261a,!![]);}catch(_0x31a009){return BPromise['reject'](_0x31a009);}return _0x24a2d5['save']();};}function saveUpdates(_0x158fd5,_0x1196d4){return function(_0x443eb7){if(_0x443eb7){return _0x443eb7[_0xc316('0x22')](_0x158fd5)[_0xc316('0x23')](function(_0x499cac){return _0x499cac;});}return null;};}function removeEntity(_0x25a571,_0x49e0a5){return function(_0x30c581){if(_0x30c581){return _0x30c581['destroy']()['then'](function(){_0x25a571['status'](0xcc)[_0xc316('0x1b')]();});}};}function handleEntityNotFound(_0x4319df,_0x58606f){return function(_0x68c20a){if(!_0x68c20a){_0x4319df[_0xc316('0x24')](0x194);}return _0x68c20a;};}function handleError(_0x527968,_0x31d2d4){_0x31d2d4=_0x31d2d4||0x1f4;return function(_0x1c22f8){logger[_0xc316('0x25')](_0x1c22f8[_0xc316('0x26')]);if(_0x1c22f8[_0xc316('0x27')]){delete _0x1c22f8[_0xc316('0x27')];}_0x527968[_0xc316('0x1a')](_0x31d2d4)[_0xc316('0x28')](_0x1c22f8);};}exports[_0xc316('0x29')]=function(_0x44faa6,_0x2453cb){var _0x879061={},_0x4f3364={},_0x900227={'count':0x0,'rows':[]};var _0x1b63cd=_[_0xc316('0x2a')](db[_0xc316('0x2b')][_0xc316('0x2c')],function(_0x2a8deb){return{'name':_0x2a8deb[_0xc316('0x2d')],'type':_0x2a8deb['type'][_0xc316('0x2e')]};});_0x4f3364[_0xc316('0x2f')]=_['map'](_0x1b63cd,_0xc316('0x27'));_0x4f3364[_0xc316('0x30')]=_[_0xc316('0x31')](_0x44faa6[_0xc316('0x30')]);_0x4f3364['filters']=_['intersection'](_0x4f3364[_0xc316('0x2f')],_0x4f3364[_0xc316('0x30')]);_0x879061[_0xc316('0x32')]=_[_0xc316('0x33')](_0x4f3364[_0xc316('0x2f')],qs['fields'](_0x44faa6['query'][_0xc316('0x34')]));_0x879061['attributes']=_0x879061[_0xc316('0x32')][_0xc316('0x35')]?_0x879061[_0xc316('0x32')]:_0x4f3364[_0xc316('0x2f')];if(!_0x44faa6[_0xc316('0x30')]['hasOwnProperty']('nolimit')){_0x879061[_0xc316('0x20')]=qs[_0xc316('0x20')](_0x44faa6['query'][_0xc316('0x20')]);_0x879061[_0xc316('0x1d')]=qs[_0xc316('0x1d')](_0x44faa6[_0xc316('0x30')][_0xc316('0x1d')]);}_0x879061[_0xc316('0x36')]=qs['sort'](_0x44faa6[_0xc316('0x30')][_0xc316('0x37')]);_0x879061[_0xc316('0x38')]=qs[_0xc316('0x39')](_[_0xc316('0x3a')](_0x44faa6[_0xc316('0x30')],_0x4f3364[_0xc316('0x39')]),_0x1b63cd);if(_0x44faa6[_0xc316('0x30')][_0xc316('0x3b')]){_0x879061[_0xc316('0x38')]=_[_0xc316('0x3c')](_0x879061['where'],{'$or':_[_0xc316('0x2a')](_0x1b63cd,function(_0x181f9c){if(_0x181f9c[_0xc316('0x3d')]!==_0xc316('0x3e')){var _0x3d583b={};_0x3d583b[_0x181f9c['name']]={'$like':'%'+_0x44faa6[_0xc316('0x30')][_0xc316('0x3b')]+'%'};return _0x3d583b;}})});}_0x879061=_['merge']({},_0x879061,_0x44faa6['options']);var _0x130de8={'where':_0x879061[_0xc316('0x38')]};return db[_0xc316('0x2b')][_0xc316('0x1f')](_0x130de8)[_0xc316('0x23')](function(_0x280cab){_0x900227[_0xc316('0x1f')]=_0x280cab;if(_0x44faa6[_0xc316('0x30')]['includeAll']){_0x879061['include']=[{'all':!![]}];}return db[_0xc316('0x2b')]['findAll'](_0x879061);})['then'](function(_0x1aba85){_0x900227['rows']=_0x1aba85;return _0x900227;})[_0xc316('0x23')](respondWithFilteredResult(_0x2453cb,_0x879061))[_0xc316('0x3f')](handleError(_0x2453cb,null));};exports[_0xc316('0x40')]=function(_0x267073,_0x29e806){var _0x284313={'raw':!![],'where':{'id':_0x267073[_0xc316('0x41')]['id']}},_0x391b62={};_0x391b62[_0xc316('0x2f')]=_[_0xc316('0x31')](db[_0xc316('0x2b')][_0xc316('0x2c')]);_0x391b62[_0xc316('0x30')]=_[_0xc316('0x31')](_0x267073[_0xc316('0x30')]);_0x391b62[_0xc316('0x39')]=_[_0xc316('0x33')](_0x391b62[_0xc316('0x2f')],_0x391b62[_0xc316('0x30')]);_0x284313['attributes']=_[_0xc316('0x33')](_0x391b62[_0xc316('0x2f')],qs[_0xc316('0x34')](_0x267073['query'][_0xc316('0x34')]));_0x284313['attributes']=_0x284313[_0xc316('0x32')]['length']?_0x284313[_0xc316('0x32')]:_0x391b62[_0xc316('0x2f')];if(_0x267073[_0xc316('0x30')]['includeAll']){_0x284313['include']=[{'all':!![]}];}_0x284313=_[_0xc316('0x3c')]({},_0x284313,_0x267073['options']);return db[_0xc316('0x2b')][_0xc316('0x42')](_0x284313)['then'](handleEntityNotFound(_0x29e806,null))[_0xc316('0x23')](respondWithResult(_0x29e806,null))[_0xc316('0x3f')](handleError(_0x29e806,null));};exports['create']=function(_0x259936,_0x43fc17){return db[_0xc316('0x2b')][_0xc316('0x43')](_0x259936['body'],{})[_0xc316('0x23')](respondWithResult(_0x43fc17,0xc9))[_0xc316('0x3f')](handleError(_0x43fc17,null));};exports[_0xc316('0x22')]=function(_0x48695a,_0x27c1a4){if(_0x48695a[_0xc316('0x44')]['id']){delete _0x48695a['body']['id'];}return db[_0xc316('0x2b')]['find']({'where':{'id':_0x48695a['params']['id']}})['then'](handleEntityNotFound(_0x27c1a4,null))[_0xc316('0x23')](saveUpdates(_0x48695a[_0xc316('0x44')],null))[_0xc316('0x23')](respondWithResult(_0x27c1a4,null))[_0xc316('0x3f')](handleError(_0x27c1a4,null));};exports[_0xc316('0x45')]=function(_0x21b882,_0x54141a){return db[_0xc316('0x2b')][_0xc316('0x42')]({'where':{'id':_0x21b882['params']['id']}})[_0xc316('0x23')](handleEntityNotFound(_0x54141a,null))[_0xc316('0x23')](removeEntity(_0x54141a,null))[_0xc316('0x3f')](handleError(_0x54141a,null));}; \ No newline at end of file +var _0x15f0=['type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','update','destroy','then','end','name','send','index','map','VoiceQueuesLog','rawAttributes'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x15f0,0x189));var _0x015f=function(_0x4b5fdf,_0x38d7ea){_0x4b5fdf=_0x4b5fdf-0x0;var _0x9cdda=_0x15f0[_0x4b5fdf];return _0x9cdda;};'use strict';var emlformat=require(_0x015f('0x0'));var rimraf=require(_0x015f('0x1'));var zipdir=require(_0x015f('0x2'));var jsonpatch=require(_0x015f('0x3'));var rp=require(_0x015f('0x4'));var moment=require(_0x015f('0x5'));var BPromise=require(_0x015f('0x6'));var Mustache=require(_0x015f('0x7'));var util=require('util');var path=require(_0x015f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x015f('0x9'));var _=require('lodash');var squel=require(_0x015f('0xa'));var crypto=require(_0x015f('0xb'));var jsforce=require(_0x015f('0xc'));var deskjs=require(_0x015f('0xd'));var toCsv=require(_0x015f('0xe'));var querystring=require(_0x015f('0xf'));var Papa=require(_0x015f('0x10'));var Redis=require(_0x015f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x015f('0x12'));var as=require(_0x015f('0x13'));var hardwareService=require(_0x015f('0x14'));var logger=require(_0x015f('0x15'))(_0x015f('0x16'));var utils=require('../../config/utils');var config=require(_0x015f('0x17'));var licenseUtil=require(_0x015f('0x18'));var db=require(_0x015f('0x19'))['db'];function respondWithStatusCode(_0x45cbe2,_0x19f6b9){_0x19f6b9=_0x19f6b9||0xcc;return function(_0x148c6f){if(_0x148c6f){return _0x45cbe2[_0x015f('0x1a')](_0x19f6b9);}return _0x45cbe2[_0x015f('0x1b')](_0x19f6b9)['end']();};}function respondWithResult(_0x3680fa,_0x17889f){_0x17889f=_0x17889f||0xc8;return function(_0x38e732){if(_0x38e732){return _0x3680fa[_0x015f('0x1b')](_0x17889f)['json'](_0x38e732);}};}function respondWithFilteredResult(_0x1f3b94,_0x3ee2b9){return function(_0x49cb5e){if(_0x49cb5e){var _0x1a4ea5=typeof _0x3ee2b9[_0x015f('0x1c')]===_0x015f('0x1d')&&typeof _0x3ee2b9[_0x015f('0x1e')]===_0x015f('0x1d');var _0x135b85=_0x49cb5e[_0x015f('0x1f')];var _0x55f24c=_0x1a4ea5?0x0:_0x3ee2b9[_0x015f('0x1c')];var _0x497ad9=_0x1a4ea5?_0x49cb5e[_0x015f('0x1f')]:_0x3ee2b9[_0x015f('0x1c')]+_0x3ee2b9['limit'];var _0x5e05;if(_0x497ad9>=_0x135b85){_0x497ad9=_0x135b85;_0x5e05=0xc8;}else{_0x5e05=0xce;}_0x1f3b94[_0x015f('0x1b')](_0x5e05);return _0x1f3b94[_0x015f('0x20')]('Content-Range',_0x55f24c+'-'+_0x497ad9+'/'+_0x135b85)[_0x015f('0x21')](_0x49cb5e);}return null;};}function patchUpdates(_0x48d27e){return function(_0x3d579c){try{jsonpatch[_0x015f('0x22')](_0x3d579c,_0x48d27e,!![]);}catch(_0x4bf3db){return BPromise['reject'](_0x4bf3db);}return _0x3d579c['save']();};}function saveUpdates(_0x5b5337,_0x5704d7){return function(_0x266a90){if(_0x266a90){return _0x266a90[_0x015f('0x23')](_0x5b5337)['then'](function(_0x524136){return _0x524136;});}return null;};}function removeEntity(_0x35daea,_0x2ce1d7){return function(_0x857bb7){if(_0x857bb7){return _0x857bb7[_0x015f('0x24')]()[_0x015f('0x25')](function(){_0x35daea[_0x015f('0x1b')](0xcc)[_0x015f('0x26')]();});}};}function handleEntityNotFound(_0x3520a6,_0xb97ed4){return function(_0x19006a){if(!_0x19006a){_0x3520a6[_0x015f('0x1a')](0x194);}return _0x19006a;};}function handleError(_0x53718b,_0x38d84a){_0x38d84a=_0x38d84a||0x1f4;return function(_0x1c6782){logger['error'](_0x1c6782['stack']);if(_0x1c6782[_0x015f('0x27')]){delete _0x1c6782['name'];}_0x53718b['status'](_0x38d84a)[_0x015f('0x28')](_0x1c6782);};}exports[_0x015f('0x29')]=function(_0x41644c,_0x19b005){var _0x16e25e={},_0x7307ed={},_0x17e902={'count':0x0,'rows':[]};var _0x19d7fc=_[_0x015f('0x2a')](db[_0x015f('0x2b')][_0x015f('0x2c')],function(_0x5c57df){return{'name':_0x5c57df['fieldName'],'type':_0x5c57df[_0x015f('0x2d')]['key']};});_0x7307ed[_0x015f('0x2e')]=_[_0x015f('0x2a')](_0x19d7fc,_0x015f('0x27'));_0x7307ed[_0x015f('0x2f')]=_[_0x015f('0x30')](_0x41644c['query']);_0x7307ed[_0x015f('0x31')]=_['intersection'](_0x7307ed['model'],_0x7307ed[_0x015f('0x2f')]);_0x16e25e[_0x015f('0x32')]=_[_0x015f('0x33')](_0x7307ed[_0x015f('0x2e')],qs['fields'](_0x41644c[_0x015f('0x2f')][_0x015f('0x34')]));_0x16e25e[_0x015f('0x32')]=_0x16e25e[_0x015f('0x32')]['length']?_0x16e25e[_0x015f('0x32')]:_0x7307ed[_0x015f('0x2e')];if(!_0x41644c[_0x015f('0x2f')][_0x015f('0x35')](_0x015f('0x36'))){_0x16e25e[_0x015f('0x1e')]=qs[_0x015f('0x1e')](_0x41644c[_0x015f('0x2f')][_0x015f('0x1e')]);_0x16e25e[_0x015f('0x1c')]=qs[_0x015f('0x1c')](_0x41644c[_0x015f('0x2f')][_0x015f('0x1c')]);}_0x16e25e[_0x015f('0x37')]=qs[_0x015f('0x38')](_0x41644c['query'][_0x015f('0x38')]);_0x16e25e[_0x015f('0x39')]=qs[_0x015f('0x31')](_['pick'](_0x41644c[_0x015f('0x2f')],_0x7307ed[_0x015f('0x31')]),_0x19d7fc);if(_0x41644c[_0x015f('0x2f')][_0x015f('0x3a')]){_0x16e25e['where']=_[_0x015f('0x3b')](_0x16e25e[_0x015f('0x39')],{'$or':_[_0x015f('0x2a')](_0x19d7fc,function(_0x5382f9){if(_0x5382f9[_0x015f('0x2d')]!==_0x015f('0x3c')){var _0x6b4beb={};_0x6b4beb[_0x5382f9[_0x015f('0x27')]]={'$like':'%'+_0x41644c['query']['filter']+'%'};return _0x6b4beb;}})});}_0x16e25e=_['merge']({},_0x16e25e,_0x41644c[_0x015f('0x3d')]);var _0x38674a={'where':_0x16e25e['where']};return db[_0x015f('0x2b')]['count'](_0x38674a)[_0x015f('0x25')](function(_0x46d870){_0x17e902[_0x015f('0x1f')]=_0x46d870;if(_0x41644c[_0x015f('0x2f')]['includeAll']){_0x16e25e[_0x015f('0x3e')]=[{'all':!![]}];}return db[_0x015f('0x2b')][_0x015f('0x3f')](_0x16e25e);})[_0x015f('0x25')](function(_0x55839e){_0x17e902[_0x015f('0x40')]=_0x55839e;return _0x17e902;})[_0x015f('0x25')](respondWithFilteredResult(_0x19b005,_0x16e25e))[_0x015f('0x41')](handleError(_0x19b005,null));};exports[_0x015f('0x42')]=function(_0x10888c,_0x28d444){var _0x5182d6={'raw':!![],'where':{'id':_0x10888c[_0x015f('0x43')]['id']}},_0x3323f1={};_0x3323f1['model']=_[_0x015f('0x30')](db['VoiceQueuesLog'][_0x015f('0x2c')]);_0x3323f1[_0x015f('0x2f')]=_[_0x015f('0x30')](_0x10888c[_0x015f('0x2f')]);_0x3323f1[_0x015f('0x31')]=_[_0x015f('0x33')](_0x3323f1[_0x015f('0x2e')],_0x3323f1[_0x015f('0x2f')]);_0x5182d6[_0x015f('0x32')]=_['intersection'](_0x3323f1[_0x015f('0x2e')],qs[_0x015f('0x34')](_0x10888c[_0x015f('0x2f')][_0x015f('0x34')]));_0x5182d6[_0x015f('0x32')]=_0x5182d6[_0x015f('0x32')][_0x015f('0x44')]?_0x5182d6[_0x015f('0x32')]:_0x3323f1[_0x015f('0x2e')];if(_0x10888c[_0x015f('0x2f')][_0x015f('0x45')]){_0x5182d6[_0x015f('0x3e')]=[{'all':!![]}];}_0x5182d6=_[_0x015f('0x3b')]({},_0x5182d6,_0x10888c[_0x015f('0x3d')]);return db[_0x015f('0x2b')]['find'](_0x5182d6)[_0x015f('0x25')](handleEntityNotFound(_0x28d444,null))['then'](respondWithResult(_0x28d444,null))[_0x015f('0x41')](handleError(_0x28d444,null));};exports[_0x015f('0x46')]=function(_0x3e54d2,_0x2bd499){return db[_0x015f('0x2b')][_0x015f('0x46')](_0x3e54d2[_0x015f('0x47')],{})[_0x015f('0x25')](respondWithResult(_0x2bd499,0xc9))['catch'](handleError(_0x2bd499,null));};exports[_0x015f('0x23')]=function(_0x1081ba,_0x958587){if(_0x1081ba['body']['id']){delete _0x1081ba['body']['id'];}return db[_0x015f('0x2b')][_0x015f('0x48')]({'where':{'id':_0x1081ba['params']['id']}})[_0x015f('0x25')](handleEntityNotFound(_0x958587,null))[_0x015f('0x25')](saveUpdates(_0x1081ba[_0x015f('0x47')],null))[_0x015f('0x25')](respondWithResult(_0x958587,null))[_0x015f('0x41')](handleError(_0x958587,null));};exports[_0x015f('0x24')]=function(_0x59031f,_0x47f792){return db[_0x015f('0x2b')]['find']({'where':{'id':_0x59031f['params']['id']}})[_0x015f('0x25')](handleEntityNotFound(_0x47f792,null))[_0x015f('0x25')](removeEntity(_0x47f792,null))[_0x015f('0x41')](handleError(_0x47f792,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b0efc27..172cbe9 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 _0x04d0=['event_dtm','dtm','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','VoiceQueuesLog'];(function(_0x21c7a2,_0x36b951){var _0x4419f3=function(_0x576e48){while(--_0x576e48){_0x21c7a2['push'](_0x21c7a2['shift']());}};_0x4419f3(++_0x36b951);}(_0x04d0,0x10a));var _0x004d=function(_0x301374,_0x534ec1){_0x301374=_0x301374-0x0;var _0x372686=_0x04d0[_0x301374];return _0x372686;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x004d('0x0'))(_0x004d('0x1'));var moment=require(_0x004d('0x2'));var BPromise=require(_0x004d('0x3'));var rp=require(_0x004d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x004d('0x5'));var attributes=require('./voiceQueuesLog.attributes');module[_0x004d('0x6')]=function(_0x285754,_0x4a3878){return _0x285754[_0x004d('0x7')](_0x004d('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x004d('0x9'),'fields':['event',_0x004d('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x045f=['moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','api'];(function(_0x4f4b40,_0x1c30c0){var _0x5be11c=function(_0x5e64c1){while(--_0x5e64c1){_0x4f4b40['push'](_0x4f4b40['shift']());}};_0x5be11c(++_0x1c30c0);}(_0x045f,0xce));var _0xf045=function(_0x38bdd1,_0x513da3){_0x38bdd1=_0x38bdd1-0x0;var _0x263b9c=_0x045f[_0x38bdd1];return _0x263b9c;};'use strict';var _=require('lodash');var util=require(_0xf045('0x0'));var logger=require('../../config/logger')(_0xf045('0x1'));var moment=require(_0xf045('0x2'));var BPromise=require('bluebird');var rp=require(_0xf045('0x3'));var fs=require('fs');var path=require(_0xf045('0x4'));var rimraf=require(_0xf045('0x5'));var config=require(_0xf045('0x6'));var attributes=require(_0xf045('0x7'));module['exports']=function(_0x4b10bb,_0x4ff705){return _0x4b10bb[_0xf045('0x8')](_0xf045('0x9'),attributes,{'tableName':_0xf045('0xa'),'paranoid':![],'indexes':[{'name':_0xf045('0xb'),'fields':['event',_0xf045('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index f7f3aec..a64c635 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 _0xb151=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','VoiceQueuesLog,\x20%s,\x20%s','debug'];(function(_0x931827,_0x5f1833){var _0x17a300=function(_0x1a60fe){while(--_0x1a60fe){_0x931827['push'](_0x931827['shift']());}};_0x17a300(++_0x5f1833);}(_0xb151,0x151));var _0x1b15=function(_0x4384cd,_0x2a9ebc){_0x4384cd=_0x4384cd-0x0;var _0x329737=_0xb151[_0x4384cd];return _0x329737;};'use strict';var _=require(_0x1b15('0x0'));var util=require(_0x1b15('0x1'));var moment=require(_0x1b15('0x2'));var BPromise=require(_0x1b15('0x3'));var rs=require(_0x1b15('0x4'));var fs=require('fs');var Redis=require(_0x1b15('0x5'));var db=require(_0x1b15('0x6'))['db'];var utils=require(_0x1b15('0x7'));var logger=require(_0x1b15('0x8'))('rpc');var config=require(_0x1b15('0x9'));var jayson=require(_0x1b15('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31db01,_0x492d3f,_0x3f3fc3){return new BPromise(function(_0x39f171,_0x5a2a35){return client[_0x1b15('0xb')](_0x31db01,_0x3f3fc3)['then'](function(_0x12d0b2){logger[_0x1b15('0xc')](_0x1b15('0xd'),_0x492d3f,'request\x20sent');logger[_0x1b15('0xe')](_0x1b15('0xf'),_0x492d3f,_0x1b15('0x10'),JSON[_0x1b15('0x11')](_0x12d0b2));if(_0x12d0b2['error']){if(_0x12d0b2[_0x1b15('0x12')][_0x1b15('0x13')]===0x1f4){logger[_0x1b15('0x12')](_0x1b15('0xd'),_0x492d3f,_0x12d0b2[_0x1b15('0x12')]['message']);return _0x5a2a35(_0x12d0b2[_0x1b15('0x12')][_0x1b15('0x14')]);}logger[_0x1b15('0x12')](_0x1b15('0xd'),_0x492d3f,_0x12d0b2[_0x1b15('0x12')][_0x1b15('0x14')]);return _0x39f171(_0x12d0b2[_0x1b15('0x12')][_0x1b15('0x14')]);}else{logger['info'](_0x1b15('0xd'),_0x492d3f,_0x1b15('0x10'));_0x39f171(_0x12d0b2['result']['message']);}})[_0x1b15('0x15')](function(_0x36a107){logger[_0x1b15('0x12')](_0x1b15('0xd'),_0x492d3f,_0x36a107);_0x5a2a35(_0x36a107);});});} \ No newline at end of file +var _0x6282=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x36e59d,_0x5c52d8){var _0x433e8a=function(_0x5e4c9c){while(--_0x5e4c9c){_0x36e59d['push'](_0x36e59d['shift']());}};_0x433e8a(++_0x5c52d8);}(_0x6282,0x76));var _0x2628=function(_0x2211d4,_0x592254){_0x2211d4=_0x2211d4-0x0;var _0x565b56=_0x6282[_0x2211d4];return _0x565b56;};'use strict';var _=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var moment=require(_0x2628('0x2'));var BPromise=require(_0x2628('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2628('0x4'))['db'];var utils=require(_0x2628('0x5'));var logger=require('../../config/logger')(_0x2628('0x6'));var config=require(_0x2628('0x7'));var jayson=require(_0x2628('0x8'));var client=jayson[_0x2628('0x9')][_0x2628('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50412a,_0xb6b945,_0x144ae8){return new BPromise(function(_0x2170a7,_0xbae7c3){return client[_0x2628('0xb')](_0x50412a,_0x144ae8)[_0x2628('0xc')](function(_0x403569){logger[_0x2628('0xd')](_0x2628('0xe'),_0xb6b945,_0x2628('0xf'));logger[_0x2628('0x10')](_0x2628('0x11'),_0xb6b945,_0x2628('0xf'),JSON[_0x2628('0x12')](_0x403569));if(_0x403569[_0x2628('0x13')]){if(_0x403569['error']['code']===0x1f4){logger[_0x2628('0x13')](_0x2628('0xe'),_0xb6b945,_0x403569[_0x2628('0x13')][_0x2628('0x14')]);return _0xbae7c3(_0x403569['error']['message']);}logger[_0x2628('0x13')](_0x2628('0xe'),_0xb6b945,_0x403569[_0x2628('0x13')][_0x2628('0x14')]);return _0x2170a7(_0x403569[_0x2628('0x13')]['message']);}else{logger[_0x2628('0xd')](_0x2628('0xe'),_0xb6b945,_0x2628('0xf'));_0x2170a7(_0x403569['result'][_0x2628('0x14')]);}})[_0x2628('0x15')](function(_0x51df16){logger[_0x2628('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0xb6b945,_0x51df16);_0xbae7c3(_0x51df16);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 91d0897..5fa3f3c 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 _0xa434=['show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x1cd5d9,_0x3a75fa){var _0x4c3b86=function(_0x21832d){while(--_0x21832d){_0x1cd5d9['push'](_0x1cd5d9['shift']());}};_0x4c3b86(++_0x3a75fa);}(_0xa434,0xa0));var _0x4a43=function(_0x479f47,_0x3d619a){_0x479f47=_0x479f47-0x0;var _0xc3fac2=_0xa434[_0x479f47];return _0xc3fac2;};'use strict';var multer=require(_0x4a43('0x0'));var util=require(_0x4a43('0x1'));var path=require(_0x4a43('0x2'));var timeout=require(_0x4a43('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4a43('0x4'));var auth=require(_0x4a43('0x5'));var interaction=require(_0x4a43('0x6'));var config=require(_0x4a43('0x7'));var controller=require(_0x4a43('0x8'));router['get']('/',auth[_0x4a43('0x9')](),controller[_0x4a43('0xa')]);router[_0x4a43('0xb')](_0x4a43('0xc'),auth[_0x4a43('0x9')](),controller[_0x4a43('0xd')]);router['get']('/:id',auth[_0x4a43('0x9')](),controller[_0x4a43('0xe')]);router[_0x4a43('0xb')]('/:id/download',auth[_0x4a43('0x9')](),controller[_0x4a43('0xf')]);router[_0x4a43('0xb')](_0x4a43('0x10'),controller[_0x4a43('0x11')]);router[_0x4a43('0xb')](_0x4a43('0x12'),auth[_0x4a43('0x9')](),controller[_0x4a43('0x13')]);router[_0x4a43('0x14')]('/',auth[_0x4a43('0x9')](),controller[_0x4a43('0x15')]);router[_0x4a43('0x14')](_0x4a43('0x12'),auth[_0x4a43('0x9')](),controller[_0x4a43('0x16')]);router[_0x4a43('0x17')](_0x4a43('0x18'),auth[_0x4a43('0x9')](),controller[_0x4a43('0x19')]);router[_0x4a43('0x1a')]('/:id',auth[_0x4a43('0x9')](),controller[_0x4a43('0x1b')]);module[_0x4a43('0x1c')]=router; \ No newline at end of file +var _0xa48e=['multer','util','path','connect-timeout','express','../../components/auth/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','exports'];(function(_0x12ead2,_0x5d1a8d){var _0x1e55e6=function(_0x1bea2e){while(--_0x1bea2e){_0x12ead2['push'](_0x12ead2['shift']());}};_0x1e55e6(++_0x5d1a8d);}(_0xa48e,0x138));var _0xea48=function(_0x10f7c2,_0x43734f){_0x10f7c2=_0x10f7c2-0x0;var _0x3cc4cd=_0xa48e[_0x10f7c2];return _0x3cc4cd;};'use strict';var multer=require(_0xea48('0x0'));var util=require(_0xea48('0x1'));var path=require(_0xea48('0x2'));var timeout=require(_0xea48('0x3'));var express=require(_0xea48('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xea48('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xea48('0x6'));router[_0xea48('0x7')]('/',auth[_0xea48('0x8')](),controller[_0xea48('0x9')]);router[_0xea48('0x7')](_0xea48('0xa'),auth[_0xea48('0x8')](),controller[_0xea48('0xb')]);router[_0xea48('0x7')](_0xea48('0xc'),auth[_0xea48('0x8')](),controller[_0xea48('0xd')]);router[_0xea48('0x7')](_0xea48('0xe'),auth[_0xea48('0x8')](),controller[_0xea48('0xf')]);router['get'](_0xea48('0x10'),controller[_0xea48('0x11')]);router['get'](_0xea48('0x12'),auth[_0xea48('0x8')](),controller[_0xea48('0x13')]);router[_0xea48('0x14')]('/',auth['isAuthenticated'](),controller[_0xea48('0x15')]);router[_0xea48('0x14')](_0xea48('0x12'),auth[_0xea48('0x8')](),controller[_0xea48('0x16')]);router[_0xea48('0x17')](_0xea48('0xc'),auth['isAuthenticated'](),controller[_0xea48('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xea48('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 2091b3e..3f25edb 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(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 c807b83..c3c5dbc 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 _0xf857=['pick','VIRTUAL','filter','merge','VoiceRecording','include','rows','params','length','includeAll','options','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','ValidationError','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where'];(function(_0x262582,_0x12858c){var _0x5753c0=function(_0x47b2ef){while(--_0x47b2ef){_0x262582['push'](_0x262582['shift']());}};_0x5753c0(++_0x12858c);}(_0xf857,0xec));var _0x7f85=function(_0x1972bd,_0x5d0821){_0x1972bd=_0x1972bd-0x0;var _0x3d8ffd=_0xf857[_0x1972bd];return _0x3d8ffd;};'use strict';var emlformat=require(_0x7f85('0x0'));var rimraf=require(_0x7f85('0x1'));var zipdir=require(_0x7f85('0x2'));var jsonpatch=require(_0x7f85('0x3'));var rp=require(_0x7f85('0x4'));var moment=require(_0x7f85('0x5'));var BPromise=require(_0x7f85('0x6'));var Mustache=require(_0x7f85('0x7'));var util=require(_0x7f85('0x8'));var path=require(_0x7f85('0x9'));var sox=require('sox');var csv=require(_0x7f85('0xa'));var ejs=require(_0x7f85('0xb'));var fs=require('fs');var fs_extra=require(_0x7f85('0xc'));var _=require(_0x7f85('0xd'));var squel=require(_0x7f85('0xe'));var crypto=require(_0x7f85('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7f85('0x10'));var toCsv=require(_0x7f85('0xa'));var querystring=require('querystring');var Papa=require(_0x7f85('0x11'));var AWS=require('aws-sdk');var uuidv4=require(_0x7f85('0x12'));var Redis=require(_0x7f85('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7f85('0x14'));var as=require(_0x7f85('0x15'));var hardwareService=require(_0x7f85('0x16'));var logger=require(_0x7f85('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7f85('0x18'));var licenseUtil=require(_0x7f85('0x19'));var db=require(_0x7f85('0x1a'))['db'];function respondWithStatusCode(_0x5ab5ac,_0x2f2f9f){_0x2f2f9f=_0x2f2f9f||0xcc;return function(_0x2bc94d){if(_0x2bc94d){return _0x5ab5ac[_0x7f85('0x1b')](_0x2f2f9f);}return _0x5ab5ac[_0x7f85('0x1c')](_0x2f2f9f)[_0x7f85('0x1d')]();};}function respondWithResult(_0x414dfa,_0x23f86c){_0x23f86c=_0x23f86c||0xc8;return function(_0x317f2a){if(_0x317f2a){return _0x414dfa[_0x7f85('0x1c')](_0x23f86c)[_0x7f85('0x1e')](_0x317f2a);}};}function respondWithFilteredResult(_0x4652a8,_0x4faa4c){return function(_0x4d6489){if(_0x4d6489){var _0x25bcf7=typeof _0x4faa4c[_0x7f85('0x1f')]===_0x7f85('0x20')&&typeof _0x4faa4c['limit']==='undefined';var _0xaec95f=_0x4d6489[_0x7f85('0x21')];var _0x5ea464=_0x25bcf7?0x0:_0x4faa4c[_0x7f85('0x1f')];var _0x412ca2=_0x25bcf7?_0x4d6489[_0x7f85('0x21')]:_0x4faa4c[_0x7f85('0x1f')]+_0x4faa4c['limit'];var _0x9317df;if(_0x412ca2>=_0xaec95f){_0x412ca2=_0xaec95f;_0x9317df=0xc8;}else{_0x9317df=0xce;}_0x4652a8[_0x7f85('0x1c')](_0x9317df);return _0x4652a8['set'](_0x7f85('0x22'),_0x5ea464+'-'+_0x412ca2+'/'+_0xaec95f)['json'](_0x4d6489);}return null;};}function patchUpdates(_0x2028f2){return function(_0x47ab92){try{jsonpatch[_0x7f85('0x23')](_0x47ab92,_0x2028f2,!![]);}catch(_0x2a8b08){return BPromise[_0x7f85('0x24')](_0x2a8b08);}return _0x47ab92[_0x7f85('0x25')]();};}function saveUpdates(_0x584500,_0x4366b1){return function(_0x6fb562){if(_0x6fb562){return _0x6fb562[_0x7f85('0x26')](_0x584500)[_0x7f85('0x27')](function(_0x1ef3e4){return _0x1ef3e4;});}return null;};}function removeEntity(_0x1d6b2c,_0xb44fa3){return function(_0x4ed8f2){if(_0x4ed8f2){return _0x4ed8f2[_0x7f85('0x28')]()['then'](function(){_0x1d6b2c['status'](0xcc)[_0x7f85('0x1d')]();});}};}function handleEntityNotFound(_0x228dbf,_0x480c25){return function(_0x593557){if(!_0x593557){_0x228dbf[_0x7f85('0x1b')](0x194);}return _0x593557;};}function handleError(_0x53ceb3,_0x16ca52){_0x16ca52=_0x16ca52||0x1f4;return function(_0x3f857f){logger[_0x7f85('0x29')](_0x3f857f[_0x7f85('0x2a')]);if(_0x3f857f['name']){delete _0x3f857f[_0x7f85('0x2b')];}_0x53ceb3[_0x7f85('0x1c')](_0x16ca52)[_0x7f85('0x2c')](_0x3f857f);};}exports['index']=function(_0x56233b,_0x1f3aa9){var _0x4cf88a={},_0x4a8b9c={},_0x76891f={'count':0x0,'rows':[]};var _0x28dc38=_[_0x7f85('0x2d')](db['VoiceRecording'][_0x7f85('0x2e')],function(_0x246b15){return{'name':_0x246b15[_0x7f85('0x2f')],'type':_0x246b15[_0x7f85('0x30')][_0x7f85('0x31')]};});_0x4a8b9c[_0x7f85('0x32')]=_[_0x7f85('0x33')](_[_0x7f85('0x2d')](_0x28dc38,_0x7f85('0x2b')),[_0x7f85('0x34')]);_0x4a8b9c[_0x7f85('0x35')]=_[_0x7f85('0x36')](_0x56233b[_0x7f85('0x35')]);_0x4a8b9c[_0x7f85('0x37')]=_[_0x7f85('0x38')](_0x4a8b9c[_0x7f85('0x32')],_0x4a8b9c[_0x7f85('0x35')]);_0x4cf88a[_0x7f85('0x39')]=_[_0x7f85('0x38')](_0x4a8b9c[_0x7f85('0x32')],qs[_0x7f85('0x3a')](_0x56233b[_0x7f85('0x35')][_0x7f85('0x3a')]));_0x4cf88a[_0x7f85('0x39')]=_0x4cf88a[_0x7f85('0x39')]['length']?_0x4cf88a[_0x7f85('0x39')]:_0x4a8b9c[_0x7f85('0x32')];if(!_0x56233b[_0x7f85('0x35')]['hasOwnProperty'](_0x7f85('0x3b'))){_0x4cf88a[_0x7f85('0x3c')]=qs[_0x7f85('0x3c')](_0x56233b[_0x7f85('0x35')][_0x7f85('0x3c')]);_0x4cf88a[_0x7f85('0x1f')]=qs['offset'](_0x56233b['query'][_0x7f85('0x1f')]);}_0x4cf88a[_0x7f85('0x3d')]=qs[_0x7f85('0x3e')](_0x56233b[_0x7f85('0x35')][_0x7f85('0x3e')]);_0x4cf88a[_0x7f85('0x3f')]=qs[_0x7f85('0x37')](_[_0x7f85('0x40')](_0x56233b[_0x7f85('0x35')],_0x4a8b9c[_0x7f85('0x37')]),_0x28dc38);if(_0x56233b[_0x7f85('0x35')]['filter']){_0x4cf88a[_0x7f85('0x3f')]=_['merge'](_0x4cf88a['where'],{'$or':_[_0x7f85('0x2d')](_0x28dc38,function(_0xf49208){if(_0xf49208[_0x7f85('0x30')]!==_0x7f85('0x41')){var _0x5446b7={};_0x5446b7[_0xf49208[_0x7f85('0x2b')]]={'$like':'%'+_0x56233b['query'][_0x7f85('0x42')]+'%'};return _0x5446b7;}})});}_0x4cf88a=_[_0x7f85('0x43')]({},_0x4cf88a,_0x56233b['options']);var _0xf5ee2f={'where':_0x4cf88a[_0x7f85('0x3f')]};return db[_0x7f85('0x44')]['count'](_0xf5ee2f)['then'](function(_0x3f8aaa){_0x76891f[_0x7f85('0x21')]=_0x3f8aaa;if(_0x56233b[_0x7f85('0x35')]['includeAll']){_0x4cf88a[_0x7f85('0x45')]=[{'all':!![]}];}return db[_0x7f85('0x44')]['findAll'](_0x4cf88a);})[_0x7f85('0x27')](function(_0x111236){_0x76891f[_0x7f85('0x46')]=_0x111236;return _0x76891f;})[_0x7f85('0x27')](respondWithFilteredResult(_0x1f3aa9,_0x4cf88a))['catch'](handleError(_0x1f3aa9,null));};exports['show']=function(_0x401dc5,_0x5b3902){var _0x538b2e={'raw':![],'where':{'id':_0x401dc5[_0x7f85('0x47')]['id']}},_0x21ce24={};_0x21ce24[_0x7f85('0x32')]=_[_0x7f85('0x36')](db[_0x7f85('0x44')][_0x7f85('0x2e')]);_0x21ce24[_0x7f85('0x35')]=_[_0x7f85('0x36')](_0x401dc5[_0x7f85('0x35')]);_0x21ce24[_0x7f85('0x37')]=_[_0x7f85('0x38')](_0x21ce24[_0x7f85('0x32')],_0x21ce24[_0x7f85('0x35')]);_0x538b2e[_0x7f85('0x39')]=_['intersection'](_0x21ce24[_0x7f85('0x32')],qs[_0x7f85('0x3a')](_0x401dc5[_0x7f85('0x35')]['fields']));_0x538b2e[_0x7f85('0x39')]=_0x538b2e[_0x7f85('0x39')][_0x7f85('0x48')]?_0x538b2e['attributes']:_0x21ce24['model'];if(_0x401dc5[_0x7f85('0x35')][_0x7f85('0x49')]){_0x538b2e[_0x7f85('0x45')]=[{'all':!![]}];}_0x538b2e=_[_0x7f85('0x43')]({},_0x538b2e,_0x401dc5[_0x7f85('0x4a')]);return db[_0x7f85('0x44')][_0x7f85('0x4b')](_0x538b2e)[_0x7f85('0x27')](handleEntityNotFound(_0x5b3902,null))[_0x7f85('0x27')](respondWithResult(_0x5b3902,null))[_0x7f85('0x4c')](handleError(_0x5b3902,null));};exports['create']=function(_0x51b431,_0x287707){return db[_0x7f85('0x44')][_0x7f85('0x4d')](_0x51b431[_0x7f85('0x4e')],{})['then'](respondWithResult(_0x287707,0xc9))[_0x7f85('0x4c')](handleError(_0x287707,null));};exports[_0x7f85('0x26')]=function(_0x5b9e68,_0xcb2cc4){if(_0x5b9e68[_0x7f85('0x4e')]['id']){delete _0x5b9e68[_0x7f85('0x4e')]['id'];}return db[_0x7f85('0x44')][_0x7f85('0x4b')]({'where':{'id':_0x5b9e68[_0x7f85('0x47')]['id']}})['then'](handleEntityNotFound(_0xcb2cc4,null))['then'](saveUpdates(_0x5b9e68[_0x7f85('0x4e')],null))[_0x7f85('0x27')](respondWithResult(_0xcb2cc4,null))[_0x7f85('0x4c')](handleError(_0xcb2cc4,null));};exports[_0x7f85('0x4f')]=function(_0x41df8a,_0x844691){return db[_0x7f85('0x44')][_0x7f85('0x4f')]()[_0x7f85('0x27')](respondWithResult(_0x844691,null))[_0x7f85('0x4c')](handleError(_0x844691,null));};exports[_0x7f85('0x50')]=function(_0x5c5f76,_0x7b5e7,_0x26c013){var _0x51d388=require(_0x7f85('0x51'));var _0x5b58b9=![];var _0x30ba05={};if(_0x5c5f76[_0x7f85('0x35')][_0x7f85('0x30')]&&_0x5c5f76['query'][_0x7f85('0x30')]===_0x7f85('0x52')){_0x30ba05[_0x7f85('0x52')]=_0x5c5f76['params']['id'];}else{_0x30ba05['id']=_0x5c5f76[_0x7f85('0x47')]['id'];}return db[_0x7f85('0x44')][_0x7f85('0x4b')]({'where':_0x30ba05,'attributes':['id',_0x7f85('0x53')],'raw':!![]})[_0x7f85('0x27')](handleEntityNotFound(_0x7b5e7,null))[_0x7f85('0x27')](function(_0x5b0bab){if(_0x5b0bab){var _0x50b891=_0x5b0bab[_0x7f85('0x53')];var _0x141b5e=util[_0x7f85('0x34')](_0x7f85('0x54'),_0x50b891);if(fs[_0x7f85('0x55')](_0x141b5e)){_0x5b58b9=!![];return _0x51d388[_0x7f85('0x56')](_0x141b5e,_0x50b891,config[_0x7f85('0x57')][_0x7f85('0x58')])[_0x7f85('0x27')](function(){return _0x5b0bab;});}return _0x5b0bab;}})[_0x7f85('0x27')](function(_0x2f04ed){if(_0x2f04ed){var _0x36b09b=_0x2f04ed[_0x7f85('0x53')];if(!fs[_0x7f85('0x55')](_0x36b09b)){throw new db[(_0x7f85('0x59'))]['ValidationError'](_0x7f85('0x5a'));}if(_0x2f04ed['filename']){return _0x7b5e7[_0x7f85('0x50')](_0x36b09b,_0x2f04ed[_0x7f85('0x5b')]+path[_0x7f85('0x5c')](_0x36b09b),function(){if(_0x5b58b9){fs[_0x7f85('0x5d')](_0x36b09b);}});}else{return _0x7b5e7['download'](_0x36b09b,function(_0x5f3df5){if(_0x5b58b9){fs[_0x7f85('0x5d')](_0x36b09b);}});}}})[_0x7f85('0x4c')](function(_0xe78d38){if(_0xe78d38[_0x7f85('0x5e')]==='VoiceRecording\x20not\x20found'){_0x7b5e7[_0x7f85('0x1c')](0x194)[_0x7f85('0x2c')](_0x7f85('0x5f'));}else{return handleError(_0x7b5e7,null);}});};exports['downloads']=function(_0x34e18d,_0xffebb2,_0x477074){var _0x3e4172=require(_0x7f85('0x51'));var _0x14a97c=![];var _0x200875={'$and':[db[_0x7f85('0x60')][_0x7f85('0x3f')](db['sequelize']['fn'](_0x7f85('0x61'),db[_0x7f85('0x60')][_0x7f85('0x62')](_0x7f85('0x52'))),_0x34e18d[_0x7f85('0x35')]['token'])]};if(_0x34e18d[_0x7f85('0x35')][_0x7f85('0x30')]&&_0x34e18d['query']['type']===_0x7f85('0x52')){_0x200875['$and'][_0x7f85('0x63')]({'uniqueid':_0x34e18d[_0x7f85('0x47')]['id']});}else{_0x200875['$and']['push']({'id':_0x34e18d[_0x7f85('0x47')]['id']});}return db[_0x7f85('0x44')][_0x7f85('0x4b')]({'where':_0x200875,'attributes':['id',_0x7f85('0x53')],'raw':!![]})[_0x7f85('0x27')](handleEntityNotFound(_0xffebb2,null))[_0x7f85('0x27')](function(_0x1fe027){if(_0x1fe027){var _0x23072d=util[_0x7f85('0x34')](_0x7f85('0x54'),_0x1fe027[_0x7f85('0x53')]);if(fs[_0x7f85('0x55')](_0x23072d)){_0x14a97c=!![];return _0x3e4172[_0x7f85('0x56')](_0x23072d,_0x1fe027['value'],config[_0x7f85('0x57')][_0x7f85('0x58')])[_0x7f85('0x27')](function(){return _0x1fe027;});}return _0x1fe027;}})[_0x7f85('0x27')](function(_0x195f10){if(_0x195f10){if(!fs[_0x7f85('0x55')](_0x195f10[_0x7f85('0x53')])){throw new db[(_0x7f85('0x59'))]['ValidationError'](_0x7f85('0x5a'));}if(_0x195f10[_0x7f85('0x5b')]){return _0xffebb2['download'](_0x195f10[_0x7f85('0x53')],_0x195f10[_0x7f85('0x5b')]+path['extname'](_0x195f10[_0x7f85('0x53')]),function(){if(_0x14a97c){fs[_0x7f85('0x5d')](_0x195f10[_0x7f85('0x53')]);}});}else{return _0xffebb2[_0x7f85('0x50')](_0x195f10[_0x7f85('0x53')],function(_0x2ebfe3){if(_0x14a97c){fs[_0x7f85('0x5d')](_0x195f10['value']);}});}}})[_0x7f85('0x4c')](handleError(_0xffebb2,null));};exports[_0x7f85('0x28')]=function(_0x2fdf98,_0x502da1){return db[_0x7f85('0x44')]['find']({'where':{'id':_0x2fdf98[_0x7f85('0x47')]['id']}})[_0x7f85('0x27')](function(_0x1541d1){if(_[_0x7f85('0x64')](_0x1541d1)){throw new ReferenceError(_0x7f85('0x65'));}return _0x1541d1;})['then'](function(_0x45604f){var _0x39ed00=_0x45604f[_0x7f85('0x53')];logger[_0x7f85('0x66')](_0x7f85('0x67'),_0x39ed00);if(!_['isNil'](_0x45604f[_0x7f85('0x53')])&&fs[_0x7f85('0x55')](_0x39ed00)){logger[_0x7f85('0x66')](_0x7f85('0x68')+_0x39ed00+_0x7f85('0x69'));fs[_0x7f85('0x6a')](_0x39ed00);}_0x39ed00=_0x39ed00+_0x7f85('0x6b');if(!_['isNil'](_0x45604f['value'])&&fs[_0x7f85('0x55')](_0x39ed00)){logger[_0x7f85('0x66')](_0x7f85('0x68')+_0x39ed00+_0x7f85('0x69'));fs[_0x7f85('0x6a')](_0x39ed00);}return _0x45604f;})[_0x7f85('0x27')](function(_0x4952b3){if(!_0x4952b3)throw new InternalError();return _0x4952b3[_0x7f85('0x28')]();})[_0x7f85('0x27')](function(){_0x502da1[_0x7f85('0x1c')](0xcc)[_0x7f85('0x1d')]();})[_0x7f85('0x4c')](handleError(_0x502da1,null));};function getBucketslist(_0x3142fe,_0x329d33,_0x51bb7e){return new Promise(function(_0x5c0ab5,_0x1f6762){var _0x1aaab2=new AWS['S3']({'accessKeyId':_0x329d33,'secretAccessKey':_0x3142fe,'region':_0x51bb7e});_0x1aaab2[_0x7f85('0x6c')]({},function(_0x161d42,_0x5c5036){if(_0x161d42){return _0x1f6762(_0x161d42);}else{return _0x5c0ab5(_0x5c5036);}});});}function createBucket(_0x131633,_0x4b71e5,_0x1c3b89,_0x529811){return new Promise(function(_0x2dcd12,_0xbf6602){var _0x4ddd2d=new AWS['S3']({'accessKeyId':_0x4b71e5,'secretAccessKey':_0x131633,'region':_0x1c3b89});_0x4ddd2d['createBucket']({'Bucket':_0x529811},function(_0x28015a,_0x6bca5d){if(_0x28015a){return _0xbf6602(_0x28015a);}else{return _0x2dcd12(_0x6bca5d);}});});}function uploadFile(_0x4f8d9e,_0x421efa,_0xfc6cd,_0x1dc921,_0x20648b,_0x12df19){return new Promise(function(_0x3dc591,_0x34a99e){var _0x2d6b75=new AWS['S3']({'accessKeyId':_0x421efa,'secretAccessKey':_0x4f8d9e,'region':_0xfc6cd});_0x2d6b75[_0x7f85('0x6d')]({'Bucket':_0x1dc921,'Key':_0x20648b,'Body':_0x12df19},function(_0x2e65dc,_0x14bafb){if(_0x2e65dc){return _0x34a99e(_0x2e65dc);}else{return _0x3dc591(_0x14bafb);}});});}function startTranscribe(_0x1eeaf5,_0x4e74c7,_0x4dd906,_0x2b30c3,_0x4a7ec3,_0x372ebd){return new Promise(function(_0x26c7ca,_0x2aca63){var _0x2bbd29=new AWS['TranscribeService']({'accessKeyId':_0x4e74c7,'secretAccessKey':_0x1eeaf5,'region':_0x4dd906});_0x2bbd29[_0x7f85('0x6e')]({'TranscriptionJobName':_0x2b30c3,'LanguageCode':_0x4a7ec3,'Media':{'MediaFileUri':_0x372ebd}},function(_0x40a406,_0x2f1ad4){if(_0x40a406){return _0x2aca63(_0x40a406);}else{return _0x26c7ca(_0x2f1ad4);}});});}function transcribe(_0x36c6b0,_0x56499d,_0x5bc12d,_0x4b1d4e,_0xcbd89a,_0xb03403,_0x1ab768){return new Promise(function(_0x1b31bc,_0x271a98){var _0x31db99={};logger[_0x7f85('0x66')](util[_0x7f85('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x36c6b0,_0xcbd89a));return uploadFile(_0x56499d,_0x5bc12d,_0x4b1d4e,_0xcbd89a,path['basename'](_0xb03403),fs[_0x7f85('0x6f')](_0xb03403))[_0x7f85('0x27')](function(_0x5d41c4){logger['info'](util['format'](_0x7f85('0x70'),_0x36c6b0,_0xcbd89a,_0x5d41c4[_0x7f85('0x71')]));_0x31db99[_0x7f85('0x72')]=_0x5d41c4[_0x7f85('0x73')];_0x31db99[_0x7f85('0x74')]=_0x5d41c4[_0x7f85('0x71')];logger[_0x7f85('0x66')](util[_0x7f85('0x34')](_0x7f85('0x75'),_0x36c6b0));return startTranscribe(_0x56499d,_0x5bc12d,_0x4b1d4e,uuidv4(),_0x1ab768,_0x5d41c4[_0x7f85('0x71')]);})[_0x7f85('0x27')](function(_0x480f75){logger['info'](util[_0x7f85('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x36c6b0,_0x480f75[_0x7f85('0x76')][_0x7f85('0x77')]));_0x31db99[_0x7f85('0x78')]=_0x480f75[_0x7f85('0x76')][_0x7f85('0x77')];_0x31db99[_0x7f85('0x79')]=_0x480f75['TranscriptionJob'][_0x7f85('0x7a')];return _0x1b31bc(_0x31db99);})[_0x7f85('0x4c')](function(_0x2e7a9e){return _0x271a98(_0x2e7a9e);});});}exports[_0x7f85('0x7b')]=function(_0x393232,_0x21afef,_0x52ce84){var _0x5000cf;var _0x32bfbf;var _0x50376b;var _0x2429af=require(_0x7f85('0x51'));return db[_0x7f85('0x44')][_0x7f85('0x7c')]({'where':{'id':_0x393232['params']['id']}})[_0x7f85('0x27')](function(_0x2cbe35){if(_0x2cbe35){var _0x42e94d=util[_0x7f85('0x34')](_0x7f85('0x54'),_0x2cbe35[_0x7f85('0x53')]);if(fs[_0x7f85('0x55')](_0x42e94d)){cypher=!![];return _0x2429af[_0x7f85('0x56')](_0x42e94d,_0x2cbe35[_0x7f85('0x53')],config[_0x7f85('0x57')][_0x7f85('0x58')])[_0x7f85('0x27')](function(){return _0x2cbe35;});}return _0x2cbe35;}})[_0x7f85('0x27')](function(_0x7df1fc){if(!_0x7df1fc){throw new db['Sequelize'][(_0x7f85('0x7d'))]('Voice\x20Recording\x20not\x20found');}_0x32bfbf=_0x7df1fc;return db['Setting'][_0x7f85('0x7c')]({'where':{'id':0x1}});})[_0x7f85('0x27')](handleEntityNotFound(_0x21afef,null))[_0x7f85('0x27')](function(_0x3bb2ee){if(_0x3bb2ee){_0x5000cf=_0x3bb2ee;if(!_0x5000cf['transcribe']||!_0x5000cf[_0x7f85('0x7e')]||!_0x5000cf[_0x7f85('0x7f')]||!_0x5000cf[_0x7f85('0x80')]||!_0x5000cf[_0x7f85('0x72')]){throw new db[(_0x7f85('0x59'))]['ValidationError'](_0x7f85('0x81'));}if(_0x393232['body'][_0x7f85('0x82')]&&(!_0x5000cf[_0x7f85('0x83')]||!_0x5000cf[_0x7f85('0x84')]||!_0x5000cf[_0x7f85('0x85')]||!_0x5000cf[_0x7f85('0x80')]||!_0x5000cf[_0x7f85('0x72')])){throw new db['Sequelize'][(_0x7f85('0x7d'))](_0x7f85('0x86'));}return db[_0x7f85('0x87')][_0x7f85('0x7c')]({'where':{'id':_0x5000cf[_0x7f85('0x7e')]}});}})['then'](function(_0x4d74d8){if(!_0x4d74d8){throw new db[(_0x7f85('0x59'))][(_0x7f85('0x7d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4d74d8['data1']||!_0x4d74d8[_0x7f85('0x88')]){throw new db[(_0x7f85('0x59'))][(_0x7f85('0x7d'))](_0x7f85('0x89'));}_0x50376b=_0x4d74d8;return getBucketslist(_0x50376b[_0x7f85('0x8a')],_0x50376b[_0x7f85('0x88')],_0x5000cf[_0x7f85('0x7f')]);})['then'](function(_0x348975){if(_0x348975&&_0x348975['Buckets']){var _0x1654cc=_[_0x7f85('0x4b')](_0x348975[_0x7f85('0x8b')],function(_0x1721ad){return _0x1721ad['Name']===_0x5000cf[_0x7f85('0x72')];});if(!_0x1654cc){logger[_0x7f85('0x66')](util[_0x7f85('0x34')](_0x7f85('0x8c'),_0x393232[_0x7f85('0x47')]['id'],_0x5000cf[_0x7f85('0x72')]));return createBucket(_0x50376b[_0x7f85('0x8a')],_0x50376b['data2'],_0x5000cf[_0x7f85('0x7f')],_0x5000cf[_0x7f85('0x72')]);}logger[_0x7f85('0x66')](util[_0x7f85('0x34')](_0x7f85('0x8d'),_0x393232[_0x7f85('0x47')]['id'],_0x5000cf[_0x7f85('0x72')]));return;}})['then'](function(_0x39d656){if(_0x32bfbf[_0x7f85('0x79')]==='NEW'){return transcribe(_0x393232[_0x7f85('0x47')]['id'],_0x50376b[_0x7f85('0x8a')],_0x50376b['data2'],_0x5000cf[_0x7f85('0x7f')],_0x5000cf[_0x7f85('0x72')],_0x32bfbf[_0x7f85('0x53')],_0x5000cf[_0x7f85('0x80')]);}else{logger[_0x7f85('0x66')](util['format'](_0x7f85('0x8e'),_0x393232[_0x7f85('0x47')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x7f85('0x27')](function(_0x2a1700){if(_0x2a1700){_0x2a1700[_0x7f85('0x8f')]=_0x393232[_0x7f85('0x4e')][_0x7f85('0x82')];return _0x32bfbf['updateAttributes'](_0x2a1700);}})[_0x7f85('0x27')](respondWithResult(_0x21afef,null))[_0x7f85('0x4c')](handleError(_0x21afef,null));};function writeFile(_0x46d7cd,_0x44f6af){return new Promise(function(_0x33a479,_0x20cdd3){fs[_0x7f85('0x90')](_0x44f6af,_0x46d7cd,function(_0x67074,_0x178f90){if(_0x67074){return _0x20cdd3(_0x67074);}else{return _0x33a479(_0x178f90);}});});}exports[_0x7f85('0x91')]=function(_0x72735a,_0x53eed0,_0x200074){return db[_0x7f85('0x44')][_0x7f85('0x7c')]({'where':{'id':_0x72735a[_0x7f85('0x47')]['id']}})[_0x7f85('0x27')](handleEntityNotFound(_0x53eed0))[_0x7f85('0x27')](function(_0x2ac5ca){if(_0x2ac5ca&&_0x2ac5ca[_0x7f85('0x92')]){var _0x4928b0=_0x2ac5ca[_0x7f85('0x92')];var _0x46ea16=config[_0x7f85('0x93')]+'/server/files/transcribes/transcribe_'+_0x2ac5ca['id']+_0x7f85('0x94');if(fs[_0x7f85('0x55')](_0x46ea16)){return _0x46ea16;}return writeFile(_0x4928b0,_0x46ea16)[_0x7f85('0x27')](function(){return _0x46ea16;});}else{throw new db[(_0x7f85('0x59'))][(_0x7f85('0x7d'))](_0x7f85('0x95'));}})[_0x7f85('0x27')](function(_0x4c3ff7){return _0x53eed0[_0x7f85('0x50')](_0x4c3ff7);})[_0x7f85('0x4c')](handleError(_0x53eed0));}; \ No newline at end of file +var _0x0cb4=['Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','language','bucket','ValidationError','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','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','sendStatus','end','status','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','params','keys','length','catch','create','body','find','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','isNil'];(function(_0x47edc1,_0x382cc4){var _0x4534c9=function(_0x19e449){while(--_0x19e449){_0x47edc1['push'](_0x47edc1['shift']());}};_0x4534c9(++_0x382cc4);}(_0x0cb4,0xcd));var _0x40cb=function(_0x197b85,_0x54bac8){_0x197b85=_0x197b85-0x0;var _0x229fcf=_0x0cb4[_0x197b85];return _0x229fcf;};'use strict';var emlformat=require(_0x40cb('0x0'));var rimraf=require(_0x40cb('0x1'));var zipdir=require(_0x40cb('0x2'));var jsonpatch=require(_0x40cb('0x3'));var rp=require(_0x40cb('0x4'));var moment=require(_0x40cb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x40cb('0x6'));var util=require(_0x40cb('0x7'));var path=require(_0x40cb('0x8'));var sox=require(_0x40cb('0x9'));var csv=require('to-csv');var ejs=require(_0x40cb('0xa'));var fs=require('fs');var fs_extra=require(_0x40cb('0xb'));var _=require(_0x40cb('0xc'));var squel=require(_0x40cb('0xd'));var crypto=require(_0x40cb('0xe'));var jsforce=require(_0x40cb('0xf'));var deskjs=require(_0x40cb('0x10'));var toCsv=require('to-csv');var querystring=require(_0x40cb('0x11'));var Papa=require(_0x40cb('0x12'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x40cb('0x13'));var authService=require(_0x40cb('0x14'));var qs=require(_0x40cb('0x15'));var as=require(_0x40cb('0x16'));var hardwareService=require(_0x40cb('0x17'));var logger=require('../../config/logger')(_0x40cb('0x18'));var utils=require('../../config/utils');var config=require(_0x40cb('0x19'));var licenseUtil=require(_0x40cb('0x1a'));var db=require(_0x40cb('0x1b'))['db'];function respondWithStatusCode(_0x464e54,_0xf6dcc6){_0xf6dcc6=_0xf6dcc6||0xcc;return function(_0x5c1f76){if(_0x5c1f76){return _0x464e54[_0x40cb('0x1c')](_0xf6dcc6);}return _0x464e54['status'](_0xf6dcc6)[_0x40cb('0x1d')]();};}function respondWithResult(_0x2c8dbb,_0x4156ee){_0x4156ee=_0x4156ee||0xc8;return function(_0x5cc3ae){if(_0x5cc3ae){return _0x2c8dbb[_0x40cb('0x1e')](_0x4156ee)['json'](_0x5cc3ae);}};}function respondWithFilteredResult(_0x4f253f,_0x553b01){return function(_0x27db28){if(_0x27db28){var _0x3eb782=typeof _0x553b01['offset']==='undefined'&&typeof _0x553b01['limit']===_0x40cb('0x1f');var _0xf78b4c=_0x27db28['count'];var _0x2d44a9=_0x3eb782?0x0:_0x553b01[_0x40cb('0x20')];var _0x4ea135=_0x3eb782?_0x27db28[_0x40cb('0x21')]:_0x553b01[_0x40cb('0x20')]+_0x553b01[_0x40cb('0x22')];var _0x8fde00;if(_0x4ea135>=_0xf78b4c){_0x4ea135=_0xf78b4c;_0x8fde00=0xc8;}else{_0x8fde00=0xce;}_0x4f253f[_0x40cb('0x1e')](_0x8fde00);return _0x4f253f[_0x40cb('0x23')](_0x40cb('0x24'),_0x2d44a9+'-'+_0x4ea135+'/'+_0xf78b4c)['json'](_0x27db28);}return null;};}function patchUpdates(_0x5a9112){return function(_0x477dd9){try{jsonpatch[_0x40cb('0x25')](_0x477dd9,_0x5a9112,!![]);}catch(_0x5ada27){return BPromise['reject'](_0x5ada27);}return _0x477dd9[_0x40cb('0x26')]();};}function saveUpdates(_0x4b237b,_0xa5db29){return function(_0x1e46d7){if(_0x1e46d7){return _0x1e46d7[_0x40cb('0x27')](_0x4b237b)['then'](function(_0x5146aa){return _0x5146aa;});}return null;};}function removeEntity(_0x62cb10,_0x51b4b4){return function(_0x1ca9e4){if(_0x1ca9e4){return _0x1ca9e4[_0x40cb('0x28')]()[_0x40cb('0x29')](function(){_0x62cb10[_0x40cb('0x1e')](0xcc)[_0x40cb('0x1d')]();});}};}function handleEntityNotFound(_0x31adbf,_0x4c8b6d){return function(_0x371917){if(!_0x371917){_0x31adbf[_0x40cb('0x1c')](0x194);}return _0x371917;};}function handleError(_0x129f3d,_0x976140){_0x976140=_0x976140||0x1f4;return function(_0x142dfd){logger[_0x40cb('0x2a')](_0x142dfd[_0x40cb('0x2b')]);if(_0x142dfd['name']){delete _0x142dfd[_0x40cb('0x2c')];}_0x129f3d[_0x40cb('0x1e')](_0x976140)[_0x40cb('0x2d')](_0x142dfd);};}exports[_0x40cb('0x2e')]=function(_0x437f63,_0x5b6f46){var _0x5ce25b={},_0x4fdc06={},_0x508071={'count':0x0,'rows':[]};var _0x59d461=_[_0x40cb('0x2f')](db[_0x40cb('0x30')][_0x40cb('0x31')],function(_0x44ab50){return{'name':_0x44ab50[_0x40cb('0x32')],'type':_0x44ab50[_0x40cb('0x33')][_0x40cb('0x34')]};});_0x4fdc06[_0x40cb('0x35')]=_[_0x40cb('0x36')](_[_0x40cb('0x2f')](_0x59d461,_0x40cb('0x2c')),[_0x40cb('0x37')]);_0x4fdc06['query']=_['keys'](_0x437f63[_0x40cb('0x38')]);_0x4fdc06[_0x40cb('0x39')]=_[_0x40cb('0x3a')](_0x4fdc06[_0x40cb('0x35')],_0x4fdc06[_0x40cb('0x38')]);_0x5ce25b[_0x40cb('0x3b')]=_[_0x40cb('0x3a')](_0x4fdc06[_0x40cb('0x35')],qs[_0x40cb('0x3c')](_0x437f63[_0x40cb('0x38')][_0x40cb('0x3c')]));_0x5ce25b['attributes']=_0x5ce25b[_0x40cb('0x3b')]['length']?_0x5ce25b[_0x40cb('0x3b')]:_0x4fdc06[_0x40cb('0x35')];if(!_0x437f63[_0x40cb('0x38')][_0x40cb('0x3d')]('nolimit')){_0x5ce25b[_0x40cb('0x22')]=qs[_0x40cb('0x22')](_0x437f63[_0x40cb('0x38')][_0x40cb('0x22')]);_0x5ce25b[_0x40cb('0x20')]=qs[_0x40cb('0x20')](_0x437f63[_0x40cb('0x38')][_0x40cb('0x20')]);}_0x5ce25b[_0x40cb('0x3e')]=qs[_0x40cb('0x3f')](_0x437f63['query'][_0x40cb('0x3f')]);_0x5ce25b['where']=qs[_0x40cb('0x39')](_[_0x40cb('0x40')](_0x437f63['query'],_0x4fdc06[_0x40cb('0x39')]),_0x59d461);if(_0x437f63[_0x40cb('0x38')][_0x40cb('0x41')]){_0x5ce25b[_0x40cb('0x42')]=_[_0x40cb('0x43')](_0x5ce25b['where'],{'$or':_[_0x40cb('0x2f')](_0x59d461,function(_0x3ca42e){if(_0x3ca42e[_0x40cb('0x33')]!==_0x40cb('0x44')){var _0x4455e7={};_0x4455e7[_0x3ca42e[_0x40cb('0x2c')]]={'$like':'%'+_0x437f63[_0x40cb('0x38')][_0x40cb('0x41')]+'%'};return _0x4455e7;}})});}_0x5ce25b=_[_0x40cb('0x43')]({},_0x5ce25b,_0x437f63[_0x40cb('0x45')]);var _0x4c1c44={'where':_0x5ce25b[_0x40cb('0x42')]};return db['VoiceRecording'][_0x40cb('0x21')](_0x4c1c44)[_0x40cb('0x29')](function(_0x3831b4){_0x508071[_0x40cb('0x21')]=_0x3831b4;if(_0x437f63[_0x40cb('0x38')][_0x40cb('0x46')]){_0x5ce25b[_0x40cb('0x47')]=[{'all':!![]}];}return db[_0x40cb('0x30')]['findAll'](_0x5ce25b);})[_0x40cb('0x29')](function(_0x584757){_0x508071['rows']=_0x584757;return _0x508071;})[_0x40cb('0x29')](respondWithFilteredResult(_0x5b6f46,_0x5ce25b))['catch'](handleError(_0x5b6f46,null));};exports['show']=function(_0x2dab2e,_0x427d23){var _0x319cf1={'raw':![],'where':{'id':_0x2dab2e[_0x40cb('0x48')]['id']}},_0xe9405e={};_0xe9405e[_0x40cb('0x35')]=_[_0x40cb('0x49')](db[_0x40cb('0x30')]['rawAttributes']);_0xe9405e['query']=_[_0x40cb('0x49')](_0x2dab2e['query']);_0xe9405e['filters']=_[_0x40cb('0x3a')](_0xe9405e[_0x40cb('0x35')],_0xe9405e[_0x40cb('0x38')]);_0x319cf1[_0x40cb('0x3b')]=_[_0x40cb('0x3a')](_0xe9405e['model'],qs[_0x40cb('0x3c')](_0x2dab2e[_0x40cb('0x38')][_0x40cb('0x3c')]));_0x319cf1[_0x40cb('0x3b')]=_0x319cf1['attributes'][_0x40cb('0x4a')]?_0x319cf1[_0x40cb('0x3b')]:_0xe9405e[_0x40cb('0x35')];if(_0x2dab2e['query'][_0x40cb('0x46')]){_0x319cf1[_0x40cb('0x47')]=[{'all':!![]}];}_0x319cf1=_[_0x40cb('0x43')]({},_0x319cf1,_0x2dab2e[_0x40cb('0x45')]);return db[_0x40cb('0x30')]['find'](_0x319cf1)['then'](handleEntityNotFound(_0x427d23,null))[_0x40cb('0x29')](respondWithResult(_0x427d23,null))[_0x40cb('0x4b')](handleError(_0x427d23,null));};exports[_0x40cb('0x4c')]=function(_0x3b8bf6,_0x30fc1b){return db[_0x40cb('0x30')][_0x40cb('0x4c')](_0x3b8bf6[_0x40cb('0x4d')],{})[_0x40cb('0x29')](respondWithResult(_0x30fc1b,0xc9))[_0x40cb('0x4b')](handleError(_0x30fc1b,null));};exports[_0x40cb('0x27')]=function(_0x344516,_0x255560){if(_0x344516[_0x40cb('0x4d')]['id']){delete _0x344516[_0x40cb('0x4d')]['id'];}return db[_0x40cb('0x30')][_0x40cb('0x4e')]({'where':{'id':_0x344516[_0x40cb('0x48')]['id']}})[_0x40cb('0x29')](handleEntityNotFound(_0x255560,null))[_0x40cb('0x29')](saveUpdates(_0x344516['body'],null))['then'](respondWithResult(_0x255560,null))['catch'](handleError(_0x255560,null));};exports[_0x40cb('0x4f')]=function(_0x574aa7,_0x176a0d){return db['VoiceRecording']['describe']()[_0x40cb('0x29')](respondWithResult(_0x176a0d,null))[_0x40cb('0x4b')](handleError(_0x176a0d,null));};exports[_0x40cb('0x50')]=function(_0x428e47,_0x121ac6,_0xab014f){var _0x5be062=require(_0x40cb('0x51'));var _0x63e92d=![];var _0x5a9405={};if(_0x428e47['query'][_0x40cb('0x33')]&&_0x428e47[_0x40cb('0x38')][_0x40cb('0x33')]===_0x40cb('0x52')){_0x5a9405[_0x40cb('0x52')]=_0x428e47[_0x40cb('0x48')]['id'];}else{_0x5a9405['id']=_0x428e47[_0x40cb('0x48')]['id'];}return db[_0x40cb('0x30')]['find']({'where':_0x5a9405,'attributes':['id',_0x40cb('0x53')],'raw':!![]})[_0x40cb('0x29')](handleEntityNotFound(_0x121ac6,null))[_0x40cb('0x29')](function(_0xa3bfe6){if(_0xa3bfe6){var _0x5d09d6=_0xa3bfe6[_0x40cb('0x53')];var _0x52d126=util['format']('%s.cypher',_0x5d09d6);if(fs[_0x40cb('0x54')](_0x52d126)){_0x63e92d=!![];return _0x5be062[_0x40cb('0x55')](_0x52d126,_0x5d09d6,config[_0x40cb('0x56')][_0x40cb('0x57')])[_0x40cb('0x29')](function(){return _0xa3bfe6;});}return _0xa3bfe6;}})['then'](function(_0x4d8a16){if(_0x4d8a16){var _0x299526=_0x4d8a16['value'];if(!fs[_0x40cb('0x54')](_0x299526)){throw new db[(_0x40cb('0x58'))]['ValidationError'](_0x40cb('0x59'));}if(_0x4d8a16[_0x40cb('0x5a')]){return _0x121ac6[_0x40cb('0x50')](_0x299526,_0x4d8a16['filename']+path[_0x40cb('0x5b')](_0x299526),function(){if(_0x63e92d){fs[_0x40cb('0x5c')](_0x299526);}});}else{return _0x121ac6[_0x40cb('0x50')](_0x299526,function(_0x5f264d){if(_0x63e92d){fs[_0x40cb('0x5c')](_0x299526);}});}}})[_0x40cb('0x4b')](function(_0x53c555){if(_0x53c555[_0x40cb('0x5d')]===_0x40cb('0x59')){_0x121ac6[_0x40cb('0x1e')](0x194)[_0x40cb('0x2d')]('Not\x20found');}else{return handleError(_0x121ac6,null);}});};exports[_0x40cb('0x5e')]=function(_0x1f6ff6,_0x1c1abc,_0x568d0f){var _0x56d571=require('../../components/encryptor');var _0x50bc3f=![];var _0x3efc68={'$and':[db[_0x40cb('0x5f')][_0x40cb('0x42')](db[_0x40cb('0x5f')]['fn'](_0x40cb('0x60'),db['sequelize'][_0x40cb('0x61')](_0x40cb('0x52'))),_0x1f6ff6[_0x40cb('0x38')][_0x40cb('0x62')])]};if(_0x1f6ff6[_0x40cb('0x38')][_0x40cb('0x33')]&&_0x1f6ff6[_0x40cb('0x38')][_0x40cb('0x33')]===_0x40cb('0x52')){_0x3efc68[_0x40cb('0x63')][_0x40cb('0x64')]({'uniqueid':_0x1f6ff6[_0x40cb('0x48')]['id']});}else{_0x3efc68[_0x40cb('0x63')][_0x40cb('0x64')]({'id':_0x1f6ff6[_0x40cb('0x48')]['id']});}return db['VoiceRecording'][_0x40cb('0x4e')]({'where':_0x3efc68,'attributes':['id',_0x40cb('0x53')],'raw':!![]})[_0x40cb('0x29')](handleEntityNotFound(_0x1c1abc,null))['then'](function(_0x230804){if(_0x230804){var _0x5d78a7=util['format'](_0x40cb('0x65'),_0x230804['value']);if(fs[_0x40cb('0x54')](_0x5d78a7)){_0x50bc3f=!![];return _0x56d571[_0x40cb('0x55')](_0x5d78a7,_0x230804[_0x40cb('0x53')],config[_0x40cb('0x56')]['recording'])['then'](function(){return _0x230804;});}return _0x230804;}})[_0x40cb('0x29')](function(_0x183ce6){if(_0x183ce6){if(!fs[_0x40cb('0x54')](_0x183ce6[_0x40cb('0x53')])){throw new db[(_0x40cb('0x58'))]['ValidationError'](_0x40cb('0x59'));}if(_0x183ce6['filename']){return _0x1c1abc['download'](_0x183ce6[_0x40cb('0x53')],_0x183ce6['filename']+path[_0x40cb('0x5b')](_0x183ce6[_0x40cb('0x53')]),function(){if(_0x50bc3f){fs[_0x40cb('0x5c')](_0x183ce6['value']);}});}else{return _0x1c1abc[_0x40cb('0x50')](_0x183ce6[_0x40cb('0x53')],function(_0x347222){if(_0x50bc3f){fs[_0x40cb('0x5c')](_0x183ce6['value']);}});}}})['catch'](handleError(_0x1c1abc,null));};exports[_0x40cb('0x28')]=function(_0x1dd216,_0x40b3ea){return db[_0x40cb('0x30')][_0x40cb('0x4e')]({'where':{'id':_0x1dd216['params']['id']}})[_0x40cb('0x29')](function(_0xa3a251){if(_[_0x40cb('0x66')](_0xa3a251)){throw new ReferenceError(_0x40cb('0x67'));}return _0xa3a251;})[_0x40cb('0x29')](function(_0x2b35b7){var _0x4a5454=_0x2b35b7['value'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x4a5454);if(!_['isNil'](_0x2b35b7[_0x40cb('0x53')])&&fs[_0x40cb('0x54')](_0x4a5454)){logger[_0x40cb('0x68')](_0x40cb('0x69')+_0x4a5454+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4a5454);}_0x4a5454=_0x4a5454+'.cypher';if(!_[_0x40cb('0x66')](_0x2b35b7[_0x40cb('0x53')])&&fs[_0x40cb('0x54')](_0x4a5454)){logger[_0x40cb('0x68')](_0x40cb('0x69')+_0x4a5454+_0x40cb('0x6a'));fs[_0x40cb('0x6b')](_0x4a5454);}return _0x2b35b7;})[_0x40cb('0x29')](function(_0x509982){if(!_0x509982)throw new InternalError();return _0x509982[_0x40cb('0x28')]();})[_0x40cb('0x29')](function(){_0x40b3ea[_0x40cb('0x1e')](0xcc)[_0x40cb('0x1d')]();})[_0x40cb('0x4b')](handleError(_0x40b3ea,null));};function getBucketslist(_0x52e729,_0x18a1ba,_0x1bcb57){return new Promise(function(_0x12ae99,_0xc86879){var _0x3530e0=new AWS['S3']({'accessKeyId':_0x18a1ba,'secretAccessKey':_0x52e729,'region':_0x1bcb57});_0x3530e0['listBuckets']({},function(_0x12ad55,_0x209c1b){if(_0x12ad55){return _0xc86879(_0x12ad55);}else{return _0x12ae99(_0x209c1b);}});});}function createBucket(_0x3c2a8c,_0x4b4423,_0x58bd06,_0x4778eb){return new Promise(function(_0x10c8ab,_0x5d7104){var _0x247b37=new AWS['S3']({'accessKeyId':_0x4b4423,'secretAccessKey':_0x3c2a8c,'region':_0x58bd06});_0x247b37[_0x40cb('0x6c')]({'Bucket':_0x4778eb},function(_0x164e8e,_0x5c89ef){if(_0x164e8e){return _0x5d7104(_0x164e8e);}else{return _0x10c8ab(_0x5c89ef);}});});}function uploadFile(_0x1de7f9,_0x367982,_0x2ff3c1,_0x5adf6a,_0x47c7b0,_0x291e8f){return new Promise(function(_0x1b5b25,_0x17979c){var _0x1607a7=new AWS['S3']({'accessKeyId':_0x367982,'secretAccessKey':_0x1de7f9,'region':_0x2ff3c1});_0x1607a7[_0x40cb('0x6d')]({'Bucket':_0x5adf6a,'Key':_0x47c7b0,'Body':_0x291e8f},function(_0x1d6215,_0x964ac1){if(_0x1d6215){return _0x17979c(_0x1d6215);}else{return _0x1b5b25(_0x964ac1);}});});}function startTranscribe(_0xa982cc,_0xa5aa0b,_0x3a9ece,_0x57080a,_0x1f72df,_0x179145){return new Promise(function(_0x152d61,_0x19391b){var _0xb8b3de=new AWS[(_0x40cb('0x6e'))]({'accessKeyId':_0xa5aa0b,'secretAccessKey':_0xa982cc,'region':_0x3a9ece});_0xb8b3de['startTranscriptionJob']({'TranscriptionJobName':_0x57080a,'LanguageCode':_0x1f72df,'Media':{'MediaFileUri':_0x179145}},function(_0x39302b,_0x1362f4){if(_0x39302b){return _0x19391b(_0x39302b);}else{return _0x152d61(_0x1362f4);}});});}function transcribe(_0x444a1f,_0x1ce652,_0x3a7174,_0x10544f,_0x2bd1e9,_0x5d54fc,_0x58bb1e){return new Promise(function(_0x52686d,_0x19f7f2){var _0x2a393f={};logger['info'](util[_0x40cb('0x37')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x444a1f,_0x2bd1e9));return uploadFile(_0x1ce652,_0x3a7174,_0x10544f,_0x2bd1e9,path[_0x40cb('0x6f')](_0x5d54fc),fs[_0x40cb('0x70')](_0x5d54fc))[_0x40cb('0x29')](function(_0x31b8d1){logger[_0x40cb('0x68')](util[_0x40cb('0x37')](_0x40cb('0x71'),_0x444a1f,_0x2bd1e9,_0x31b8d1['Location']));_0x2a393f['bucket']=_0x31b8d1[_0x40cb('0x72')];_0x2a393f[_0x40cb('0x73')]=_0x31b8d1[_0x40cb('0x74')];logger['info'](util[_0x40cb('0x37')](_0x40cb('0x75'),_0x444a1f));return startTranscribe(_0x1ce652,_0x3a7174,_0x10544f,uuidv4(),_0x58bb1e,_0x31b8d1[_0x40cb('0x74')]);})[_0x40cb('0x29')](function(_0x29f4c3){logger['info'](util['format'](_0x40cb('0x76'),_0x444a1f,_0x29f4c3[_0x40cb('0x77')][_0x40cb('0x78')]));_0x2a393f[_0x40cb('0x79')]=_0x29f4c3[_0x40cb('0x77')][_0x40cb('0x78')];_0x2a393f[_0x40cb('0x7a')]=_0x29f4c3['TranscriptionJob'][_0x40cb('0x7b')];return _0x52686d(_0x2a393f);})['catch'](function(_0x7aa5fb){return _0x19f7f2(_0x7aa5fb);});});}exports[_0x40cb('0x7c')]=function(_0x18cd9d,_0x35df5e,_0x1d5e2e){var _0xb2ba6e;var _0x16911f;var _0x1272aa;var _0x1c05a7=require('../../components/encryptor');return db['VoiceRecording'][_0x40cb('0x7d')]({'where':{'id':_0x18cd9d[_0x40cb('0x48')]['id']}})['then'](function(_0x26d7c1){if(_0x26d7c1){var _0x99e511=util[_0x40cb('0x37')](_0x40cb('0x65'),_0x26d7c1['value']);if(fs[_0x40cb('0x54')](_0x99e511)){cypher=!![];return _0x1c05a7['decryptFile'](_0x99e511,_0x26d7c1[_0x40cb('0x53')],config['secrets'][_0x40cb('0x57')])[_0x40cb('0x29')](function(){return _0x26d7c1;});}return _0x26d7c1;}})[_0x40cb('0x29')](function(_0x20705e){if(!_0x20705e){throw new db[(_0x40cb('0x58'))]['ValidationError'](_0x40cb('0x7e'));}_0x16911f=_0x20705e;return db[_0x40cb('0x7f')][_0x40cb('0x7d')]({'where':{'id':0x1}});})[_0x40cb('0x29')](handleEntityNotFound(_0x35df5e,null))['then'](function(_0x399e59){if(_0x399e59){_0xb2ba6e=_0x399e59;if(!_0xb2ba6e['transcribe']||!_0xb2ba6e['transcribeAccountId']||!_0xb2ba6e['transcribeRegion']||!_0xb2ba6e[_0x40cb('0x80')]||!_0xb2ba6e[_0x40cb('0x81')]){throw new db[(_0x40cb('0x58'))][(_0x40cb('0x82'))](_0x40cb('0x83'));}if(_0x18cd9d['body'][_0x40cb('0x84')]&&(!_0xb2ba6e[_0x40cb('0x85')]||!_0xb2ba6e[_0x40cb('0x86')]||!_0xb2ba6e['sentimentRegion']||!_0xb2ba6e[_0x40cb('0x80')]||!_0xb2ba6e['bucket'])){throw new db[(_0x40cb('0x58'))][(_0x40cb('0x82'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x40cb('0x87')][_0x40cb('0x7d')]({'where':{'id':_0xb2ba6e['transcribeAccountId']}});}})[_0x40cb('0x29')](function(_0x2a08b7){if(!_0x2a08b7){throw new db[(_0x40cb('0x58'))][(_0x40cb('0x82'))](_0x40cb('0x88'));}if(!_0x2a08b7[_0x40cb('0x89')]||!_0x2a08b7[_0x40cb('0x8a')]){throw new db[(_0x40cb('0x58'))]['ValidationError'](_0x40cb('0x8b'));}_0x1272aa=_0x2a08b7;return getBucketslist(_0x1272aa[_0x40cb('0x89')],_0x1272aa['data2'],_0xb2ba6e[_0x40cb('0x8c')]);})[_0x40cb('0x29')](function(_0x18bc1e){if(_0x18bc1e&&_0x18bc1e[_0x40cb('0x8d')]){var _0x365047=_['find'](_0x18bc1e[_0x40cb('0x8d')],function(_0x510fad){return _0x510fad['Name']===_0xb2ba6e['bucket'];});if(!_0x365047){logger[_0x40cb('0x68')](util[_0x40cb('0x37')](_0x40cb('0x8e'),_0x18cd9d[_0x40cb('0x48')]['id'],_0xb2ba6e[_0x40cb('0x81')]));return createBucket(_0x1272aa[_0x40cb('0x89')],_0x1272aa[_0x40cb('0x8a')],_0xb2ba6e['transcribeRegion'],_0xb2ba6e[_0x40cb('0x81')]);}logger[_0x40cb('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x18cd9d['params']['id'],_0xb2ba6e['bucket']));return;}})['then'](function(_0x38ed4e){if(_0x16911f['transcribeStatus']===_0x40cb('0x8f')){return transcribe(_0x18cd9d['params']['id'],_0x1272aa['data1'],_0x1272aa[_0x40cb('0x8a')],_0xb2ba6e[_0x40cb('0x8c')],_0xb2ba6e[_0x40cb('0x81')],_0x16911f[_0x40cb('0x53')],_0xb2ba6e[_0x40cb('0x80')]);}else{logger[_0x40cb('0x68')](util[_0x40cb('0x37')](_0x40cb('0x90'),_0x18cd9d[_0x40cb('0x48')]['id']));return{'transcribeStatus':_0x40cb('0x91')};}})['then'](function(_0x188f4b){if(_0x188f4b){_0x188f4b[_0x40cb('0x92')]=_0x18cd9d[_0x40cb('0x4d')]['runSentiment'];return _0x16911f['updateAttributes'](_0x188f4b);}})[_0x40cb('0x29')](respondWithResult(_0x35df5e,null))[_0x40cb('0x4b')](handleError(_0x35df5e,null));};function writeFile(_0x53c4c8,_0x579703){return new Promise(function(_0x2fb5b0,_0x5d229d){fs[_0x40cb('0x93')](_0x579703,_0x53c4c8,function(_0x5f4d43,_0x4e11a6){if(_0x5f4d43){return _0x5d229d(_0x5f4d43);}else{return _0x2fb5b0(_0x4e11a6);}});});}exports[_0x40cb('0x94')]=function(_0x2f9e37,_0x4f1453,_0x5a85a9){return db[_0x40cb('0x30')][_0x40cb('0x7d')]({'where':{'id':_0x2f9e37[_0x40cb('0x48')]['id']}})[_0x40cb('0x29')](handleEntityNotFound(_0x4f1453))[_0x40cb('0x29')](function(_0x576ce5){if(_0x576ce5&&_0x576ce5[_0x40cb('0x95')]){var _0x475104=_0x576ce5[_0x40cb('0x95')];var _0x92355f=config[_0x40cb('0x96')]+_0x40cb('0x97')+_0x576ce5['id']+_0x40cb('0x98');if(fs[_0x40cb('0x54')](_0x92355f)){return _0x92355f;}return writeFile(_0x475104,_0x92355f)[_0x40cb('0x29')](function(){return _0x92355f;});}else{throw new db[(_0x40cb('0x58'))]['ValidationError'](_0x40cb('0x99'));}})['then'](function(_0x28e13a){return _0x4f1453[_0x40cb('0x50')](_0x28e13a);})[_0x40cb('0x4b')](handleError(_0x4f1453));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 13b2547..b950367 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 _0xd58c=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings'];(function(_0x1031e6,_0x3e5b64){var _0x224542=function(_0x539a1c){while(--_0x539a1c){_0x1031e6['push'](_0x1031e6['shift']());}};_0x224542(++_0x3e5b64);}(_0xd58c,0xb6));var _0xcd58=function(_0x5f3c04,_0x15f65d){_0x5f3c04=_0x5f3c04-0x0;var _0x10af27=_0xd58c[_0x5f3c04];return _0x10af27;};'use strict';var attributes=require(_0xcd58('0x0'));module[_0xcd58('0x1')]=function(_0x240323,_0x4dbe25){return _0x240323[_0xcd58('0x2')]('VoiceRecording',attributes,{'tableName':_0xcd58('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcd58('0x4')]},{'name':_0xcd58('0x5'),'fields':[_0xcd58('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x028d=['voice_recordings','uniqueid','transcribeStatus','exports','define','VoiceRecording'];(function(_0x21efc0,_0x834ae1){var _0x336c4f=function(_0xa40b4b){while(--_0xa40b4b){_0x21efc0['push'](_0x21efc0['shift']());}};_0x336c4f(++_0x834ae1);}(_0x028d,0xff));var _0xd028=function(_0x2eec1b,_0x5f4faf){_0x2eec1b=_0x2eec1b-0x0;var _0x3973ef=_0x028d[_0x2eec1b];return _0x3973ef;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xd028('0x0')]=function(_0x124fc2,_0x51288f){return _0x124fc2[_0xd028('0x1')](_0xd028('0x2'),attributes,{'tableName':_0xd028('0x3'),'paranoid':![],'indexes':[{'name':_0xd028('0x4'),'fields':[_0xd028('0x4')]},{'name':_0xd028('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 05cb48e..3448b63 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 _0x781d=['UpdateVoiceRecording','stringify','CreateVoiceRecording','findOne','callRecordingEncryption','format','%s.cypher','value','secrets','recording','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','VoiceRecording','update','body','options','raw','where','attributes'];(function(_0x210a19,_0x2823a6){var _0x37f99c=function(_0x113934){while(--_0x113934){_0x210a19['push'](_0x210a19['shift']());}};_0x37f99c(++_0x2823a6);}(_0x781d,0x14a));var _0xd781=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x781d[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['UpdateVoiceRecording']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')](_0x1407fc[_0xd781('0x19')],{'raw':_0x1407fc[_0xd781('0x1a')]?_0x1407fc['options'][_0xd781('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1407fc[_0xd781('0x1a')]?_0x1407fc[_0xd781('0x1a')][_0xd781('0x1c')]||null:null,'attributes':_0x1407fc[_0xd781('0x1a')]?_0x1407fc[_0xd781('0x1a')][_0xd781('0x1d')]||null:null,'limit':_0x1407fc['options']?_0x1407fc[_0xd781('0x1a')]['limit']||null:null})['then'](function(_0x187a5a){logger['info'](_0xd781('0x1e'),_0x1407fc);logger[_0xd781('0xf')](_0xd781('0x1e'),_0x1407fc,JSON[_0xd781('0x1f')](_0x187a5a));_0x395d9c(_0x187a5a);})[_0xd781('0x16')](function(_0x28f4fe){logger[_0xd781('0x11')](_0xd781('0x1e'),_0x28f4fe[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922['error'](0x1f4,_0x28f4fe['message']));});});};exports[_0xd781('0x20')]=function(_0x849587){var _0xdad0b1=this;return new Promise(function(_0x57b41e,_0xa1349e){var _0x5a431b=require('../../components/encryptor');var _0x1e29c8;return db['Setting'][_0xd781('0x21')]({'attributes':['id',_0xd781('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x5b6b9d){_0x1e29c8=_0x5b6b9d;return db[_0xd781('0x17')]['create'](_0x849587[_0xd781('0x19')]);})['then'](function(_0x21e802){if(_0x1e29c8[_0xd781('0x22')]&&fs['existsSync'](_0x21e802['value'])){var _0x432d14=util[_0xd781('0x23')](_0xd781('0x24'),_0x21e802['value']);return _0x5a431b['encryptFile'](_0x21e802[_0xd781('0x25')],_0x432d14,config[_0xd781('0x26')][_0xd781('0x27')])['then'](function(){fs['unlink'](_0x21e802[_0xd781('0x25')]);logger[_0xd781('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x21e802;});}return _0x21e802;})[_0xd781('0xc')](function(_0x43c322){logger['info'](_0xd781('0x20'),_0x849587);logger[_0xd781('0xf')](_0xd781('0x20'),_0x849587,JSON[_0xd781('0x1f')](_0x43c322));_0x57b41e(_0x43c322);})['catch'](function(_0x23dffb){logger[_0xd781('0x11')](_0xd781('0x20'),_0x23dffb[_0xd781('0x13')],_0x849587);_0xa1349e(_0xdad0b1['error'](0x1f4,_0x23dffb[_0xd781('0x13')]));});});}; \ No newline at end of file +var _0x5464=['UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','format','encryptFile','value','secrets','unlink','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x537883,_0x542802){var _0xacfb01=function(_0x21122f){while(--_0x21122f){_0x537883['push'](_0x537883['shift']());}};_0xacfb01(++_0x542802);}(_0x5464,0x15d));var _0x4546=function(_0x14ac0a,_0x2eebf0){_0x14ac0a=_0x14ac0a-0x0;var _0x39d0cc=_0x5464[_0x14ac0a];return _0x39d0cc;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});}exports[_0x4546('0x14')]=function(_0x57d8de){var _0x4ffd6b=this;return new Promise(function(_0x5780a7,_0x330235){return db[_0x4546('0x15')][_0x4546('0x16')](_0x57d8de[_0x4546('0x17')],{'raw':_0x57d8de[_0x4546('0x18')]?_0x57d8de[_0x4546('0x18')][_0x4546('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d8de[_0x4546('0x18')]?_0x57d8de[_0x4546('0x18')][_0x4546('0x1a')]||null:null,'attributes':_0x57d8de['options']?_0x57d8de[_0x4546('0x18')][_0x4546('0x1b')]||null:null,'limit':_0x57d8de['options']?_0x57d8de[_0x4546('0x18')][_0x4546('0x1c')]||null:null})[_0x4546('0xa')](function(_0x2f065d){logger[_0x4546('0xb')](_0x4546('0x14'),_0x57d8de);logger['debug'](_0x4546('0x14'),_0x57d8de,JSON[_0x4546('0x1d')](_0x2f065d));_0x5780a7(_0x2f065d);})['catch'](function(_0x824698){logger[_0x4546('0x10')](_0x4546('0x14'),_0x824698[_0x4546('0x12')],_0x57d8de);_0x330235(_0x4ffd6b[_0x4546('0x10')](0x1f4,_0x824698['message']));});});};exports[_0x4546('0x1e')]=function(_0x3796fe){var _0x831fa5=this;return new Promise(function(_0x48fc36,_0x4c1dad){var _0x43740e=require(_0x4546('0x1f'));var _0x15611c;return db[_0x4546('0x20')][_0x4546('0x21')]({'attributes':['id',_0x4546('0x22')],'where':{'id':0x1},'raw':!![]})[_0x4546('0xa')](function(_0x586ff1){_0x15611c=_0x586ff1;return db[_0x4546('0x15')]['create'](_0x3796fe[_0x4546('0x17')]);})[_0x4546('0xa')](function(_0x5396c5){if(_0x15611c['callRecordingEncryption']&&fs[_0x4546('0x23')](_0x5396c5['value'])){var _0x3c7c7d=util[_0x4546('0x24')]('%s.cypher',_0x5396c5['value']);return _0x43740e[_0x4546('0x25')](_0x5396c5[_0x4546('0x26')],_0x3c7c7d,config[_0x4546('0x27')]['recording'])[_0x4546('0xa')](function(){fs[_0x4546('0x28')](_0x5396c5['value']);logger[_0x4546('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x5396c5;});}return _0x5396c5;})[_0x4546('0xa')](function(_0x44f604){logger[_0x4546('0xb')](_0x4546('0x1e'),_0x3796fe);logger['debug'](_0x4546('0x1e'),_0x3796fe,JSON[_0x4546('0x1d')](_0x44f604));_0x48fc36(_0x44f604);})[_0x4546('0x13')](function(_0x298bef){logger[_0x4546('0x10')](_0x4546('0x1e'),_0x298bef['message'],_0x3796fe);_0x4c1dad(_0x831fa5[_0x4546('0x10')](0x1f4,_0x298bef[_0x4546('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a13e99a..ef8c4ef 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 _0x03a8=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete'];(function(_0x38b50e,_0x3f596b){var _0x8ffdf3=function(_0x24a2bd){while(--_0x24a2bd){_0x38b50e['push'](_0x38b50e['shift']());}};_0x8ffdf3(++_0x3f596b);}(_0x03a8,0x11e));var _0x803a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03a8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x803a('0x0'));var util=require(_0x803a('0x1'));var path=require(_0x803a('0x2'));var timeout=require(_0x803a('0x3'));var express=require(_0x803a('0x4'));var router=express[_0x803a('0x5')]();var fs_extra=require(_0x803a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x803a('0x7'));var controller=require(_0x803a('0x8'));router['get']('/',auth[_0x803a('0x9')](),controller[_0x803a('0xa')]);router['get'](_0x803a('0xb'),auth[_0x803a('0x9')](),controller[_0x803a('0xc')]);router['get'](_0x803a('0xd'),auth[_0x803a('0x9')](),controller[_0x803a('0xe')]);router[_0x803a('0xf')]('/',auth[_0x803a('0x9')](),controller['create']);router[_0x803a('0x10')](_0x803a('0xd'),auth[_0x803a('0x9')](),controller['update']);router[_0x803a('0x11')]('/:id',auth[_0x803a('0x9')](),controller[_0x803a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x01b3=['exports','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update','destroy'];(function(_0x30027e,_0xc3b99a){var _0xfd367c=function(_0x56cd85){while(--_0x56cd85){_0x30027e['push'](_0x30027e['shift']());}};_0xfd367c(++_0xc3b99a);}(_0x01b3,0x81));var _0x301b=function(_0x5e7b06,_0x173efc){_0x5e7b06=_0x5e7b06-0x0;var _0x58c307=_0x01b3[_0x5e7b06];return _0x58c307;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x301b('0x0'));var router=express['Router']();var fs_extra=require(_0x301b('0x1'));var auth=require(_0x301b('0x2'));var interaction=require(_0x301b('0x3'));var config=require(_0x301b('0x4'));var controller=require(_0x301b('0x5'));router[_0x301b('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x301b('0x7')](),controller[_0x301b('0x8')]);router['get'](_0x301b('0x9'),auth[_0x301b('0x7')](),controller['show']);router[_0x301b('0xa')]('/',auth[_0x301b('0x7')](),controller[_0x301b('0xb')]);router[_0x301b('0xc')](_0x301b('0x9'),auth[_0x301b('0x7')](),controller[_0x301b('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x301b('0xe')]);module[_0x301b('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 26e5807..9f98739 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 _0x2198=['exports','ENUM','blind','attended','STRING','sequelize'];(function(_0x292564,_0x22fef6){var _0x42b293=function(_0xad549a){while(--_0xad549a){_0x292564['push'](_0x292564['shift']());}};_0x42b293(++_0x22fef6);}(_0x2198,0x1d9));var _0x8219=function(_0x516d88,_0x27df32){_0x516d88=_0x516d88-0x0;var _0x27050a=_0x2198[_0x516d88];return _0x27050a;};'use strict';var Sequelize=require(_0x8219('0x0'));var moment=require('moment');module[_0x8219('0x1')]={'type':{'type':Sequelize[_0x8219('0x2')](_0x8219('0x3'),_0x8219('0x4'))},'result':{'type':Sequelize[_0x8219('0x5')]},'transfererchannel':{'type':Sequelize[_0x8219('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x8219('0x5')]},'transferercalleridname':{'type':Sequelize[_0x8219('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8219('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x8219('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x8219('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x8219('0x5')]},'transfereechannel':{'type':Sequelize[_0x8219('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8219('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8219('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8219('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8219('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x8219('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x8219('0x5')]},'isexternal':{'type':Sequelize[_0x8219('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x8219('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdcf7=['Yes','moment','exports','ENUM','blind','attended','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xdcf7,0x1a5));var _0x7dcf=function(_0x2f2b71,_0x5224df){_0x2f2b71=_0x2f2b71-0x0;var _0x3d6936=_0xdcf7[_0x2f2b71];return _0x3d6936;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7dcf('0x0'));module[_0x7dcf('0x1')]={'type':{'type':Sequelize[_0x7dcf('0x2')](_0x7dcf('0x3'),_0x7dcf('0x4'))},'result':{'type':Sequelize[_0x7dcf('0x5')]},'transfererchannel':{'type':Sequelize[_0x7dcf('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x7dcf('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x7dcf('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x7dcf('0x5')]},'transferercontext':{'type':Sequelize[_0x7dcf('0x5')]},'transfererexten':{'type':Sequelize[_0x7dcf('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x7dcf('0x5')]},'transfereechannel':{'type':Sequelize[_0x7dcf('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x7dcf('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7dcf('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x7dcf('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x7dcf('0x5')]},'isexternal':{'type':Sequelize[_0x7dcf('0x2')](_0x7dcf('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7dcf('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 98de69c..18ce62a 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 _0x1635=['status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','catch','show','params','keys','fields','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','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/environment','sendStatus','end'];(function(_0x292e2b,_0x15267e){var _0x3c2f7b=function(_0x706ce2){while(--_0x706ce2){_0x292e2b['push'](_0x292e2b['shift']());}};_0x3c2f7b(++_0x15267e);}(_0x1635,0x1ae));var _0x5163=function(_0x25b78d,_0x825951){_0x25b78d=_0x25b78d-0x0;var _0x58a401=_0x1635[_0x25b78d];return _0x58a401;};'use strict';var emlformat=require(_0x5163('0x0'));var rimraf=require(_0x5163('0x1'));var zipdir=require(_0x5163('0x2'));var jsonpatch=require(_0x5163('0x3'));var rp=require(_0x5163('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5163('0x5'));var sox=require(_0x5163('0x6'));var csv=require(_0x5163('0x7'));var ejs=require(_0x5163('0x8'));var fs=require('fs');var fs_extra=require(_0x5163('0x9'));var _=require(_0x5163('0xa'));var squel=require(_0x5163('0xb'));var crypto=require(_0x5163('0xc'));var jsforce=require(_0x5163('0xd'));var deskjs=require(_0x5163('0xe'));var toCsv=require(_0x5163('0x7'));var querystring=require('querystring');var Papa=require(_0x5163('0xf'));var Redis=require('ioredis');var authService=require(_0x5163('0x10'));var qs=require(_0x5163('0x11'));var as=require(_0x5163('0x12'));var hardwareService=require(_0x5163('0x13'));var logger=require(_0x5163('0x14'))(_0x5163('0x15'));var utils=require(_0x5163('0x16'));var config=require(_0x5163('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c48d9,_0x3d9970){_0x3d9970=_0x3d9970||0xcc;return function(_0x20bcfd){if(_0x20bcfd){return _0x3c48d9[_0x5163('0x18')](_0x3d9970);}return _0x3c48d9['status'](_0x3d9970)[_0x5163('0x19')]();};}function respondWithResult(_0x264a23,_0x11e4f6){_0x11e4f6=_0x11e4f6||0xc8;return function(_0xb807bb){if(_0xb807bb){return _0x264a23[_0x5163('0x1a')](_0x11e4f6)['json'](_0xb807bb);}};}function respondWithFilteredResult(_0x5d5380,_0x476907){return function(_0x35af98){if(_0x35af98){var _0x3b583c=typeof _0x476907[_0x5163('0x1b')]===_0x5163('0x1c')&&typeof _0x476907[_0x5163('0x1d')]==='undefined';var _0xc329bf=_0x35af98[_0x5163('0x1e')];var _0x1e86fb=_0x3b583c?0x0:_0x476907[_0x5163('0x1b')];var _0x32e811=_0x3b583c?_0x35af98[_0x5163('0x1e')]:_0x476907[_0x5163('0x1b')]+_0x476907[_0x5163('0x1d')];var _0x19c860;if(_0x32e811>=_0xc329bf){_0x32e811=_0xc329bf;_0x19c860=0xc8;}else{_0x19c860=0xce;}_0x5d5380['status'](_0x19c860);return _0x5d5380[_0x5163('0x1f')]('Content-Range',_0x1e86fb+'-'+_0x32e811+'/'+_0xc329bf)[_0x5163('0x20')](_0x35af98);}return null;};}function patchUpdates(_0x2f8172){return function(_0x2467b1){try{jsonpatch[_0x5163('0x21')](_0x2467b1,_0x2f8172,!![]);}catch(_0x47ce3d){return BPromise[_0x5163('0x22')](_0x47ce3d);}return _0x2467b1[_0x5163('0x23')]();};}function saveUpdates(_0x57c039,_0x5286d2){return function(_0x48bedc){if(_0x48bedc){return _0x48bedc[_0x5163('0x24')](_0x57c039)[_0x5163('0x25')](function(_0x4ac943){return _0x4ac943;});}return null;};}function removeEntity(_0x159eb1,_0x134253){return function(_0xbe8f13){if(_0xbe8f13){return _0xbe8f13[_0x5163('0x26')]()[_0x5163('0x25')](function(){_0x159eb1[_0x5163('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x338508,_0x26ee92){return function(_0x281c5b){if(!_0x281c5b){_0x338508['sendStatus'](0x194);}return _0x281c5b;};}function handleError(_0x5a5e36,_0x227b4b){_0x227b4b=_0x227b4b||0x1f4;return function(_0x19b5a4){logger[_0x5163('0x27')](_0x19b5a4[_0x5163('0x28')]);if(_0x19b5a4[_0x5163('0x29')]){delete _0x19b5a4[_0x5163('0x29')];}_0x5a5e36[_0x5163('0x1a')](_0x227b4b)[_0x5163('0x2a')](_0x19b5a4);};}exports[_0x5163('0x2b')]=function(_0x1f3186,_0xe1b16b){var _0x1fe9d3={},_0xb9d09e={},_0x134147={'count':0x0,'rows':[]};var _0x399ab5=_[_0x5163('0x2c')](db[_0x5163('0x2d')][_0x5163('0x2e')],function(_0x8f7a27){return{'name':_0x8f7a27[_0x5163('0x2f')],'type':_0x8f7a27[_0x5163('0x30')]['key']};});_0xb9d09e[_0x5163('0x31')]=_[_0x5163('0x2c')](_0x399ab5,_0x5163('0x29'));_0xb9d09e['query']=_['keys'](_0x1f3186[_0x5163('0x32')]);_0xb9d09e[_0x5163('0x33')]=_[_0x5163('0x34')](_0xb9d09e[_0x5163('0x31')],_0xb9d09e['query']);_0x1fe9d3[_0x5163('0x35')]=_[_0x5163('0x34')](_0xb9d09e[_0x5163('0x31')],qs['fields'](_0x1f3186['query']['fields']));_0x1fe9d3[_0x5163('0x35')]=_0x1fe9d3['attributes'][_0x5163('0x36')]?_0x1fe9d3[_0x5163('0x35')]:_0xb9d09e[_0x5163('0x31')];if(!_0x1f3186[_0x5163('0x32')][_0x5163('0x37')](_0x5163('0x38'))){_0x1fe9d3[_0x5163('0x1d')]=qs[_0x5163('0x1d')](_0x1f3186['query'][_0x5163('0x1d')]);_0x1fe9d3[_0x5163('0x1b')]=qs[_0x5163('0x1b')](_0x1f3186[_0x5163('0x32')]['offset']);}_0x1fe9d3[_0x5163('0x39')]=qs[_0x5163('0x3a')](_0x1f3186[_0x5163('0x32')]['sort']);_0x1fe9d3[_0x5163('0x3b')]=qs[_0x5163('0x33')](_[_0x5163('0x3c')](_0x1f3186[_0x5163('0x32')],_0xb9d09e['filters']),_0x399ab5);if(_0x1f3186['query']['filter']){_0x1fe9d3[_0x5163('0x3b')]=_[_0x5163('0x3d')](_0x1fe9d3[_0x5163('0x3b')],{'$or':_[_0x5163('0x2c')](_0x399ab5,function(_0x3f4e47){if(_0x3f4e47['type']!==_0x5163('0x3e')){var _0x1cc054={};_0x1cc054[_0x3f4e47[_0x5163('0x29')]]={'$like':'%'+_0x1f3186[_0x5163('0x32')][_0x5163('0x3f')]+'%'};return _0x1cc054;}})});}_0x1fe9d3=_['merge']({},_0x1fe9d3,_0x1f3186[_0x5163('0x40')]);var _0x42556d={'where':_0x1fe9d3['where']};return db[_0x5163('0x2d')][_0x5163('0x1e')](_0x42556d)[_0x5163('0x25')](function(_0x52ccb7){_0x134147[_0x5163('0x1e')]=_0x52ccb7;if(_0x1f3186[_0x5163('0x32')]['includeAll']){_0x1fe9d3[_0x5163('0x41')]=[{'all':!![]}];}return db[_0x5163('0x2d')]['findAll'](_0x1fe9d3);})[_0x5163('0x25')](function(_0x4dc36d){_0x134147['rows']=_0x4dc36d;return _0x134147;})[_0x5163('0x25')](respondWithFilteredResult(_0xe1b16b,_0x1fe9d3))[_0x5163('0x42')](handleError(_0xe1b16b,null));};exports[_0x5163('0x43')]=function(_0x283500,_0x28b0a6){var _0x25799d={'raw':!![],'where':{'id':_0x283500[_0x5163('0x44')]['id']}},_0x3e2a41={};_0x3e2a41[_0x5163('0x31')]=_[_0x5163('0x45')](db[_0x5163('0x2d')][_0x5163('0x2e')]);_0x3e2a41['query']=_[_0x5163('0x45')](_0x283500[_0x5163('0x32')]);_0x3e2a41[_0x5163('0x33')]=_[_0x5163('0x34')](_0x3e2a41[_0x5163('0x31')],_0x3e2a41[_0x5163('0x32')]);_0x25799d[_0x5163('0x35')]=_['intersection'](_0x3e2a41['model'],qs['fields'](_0x283500[_0x5163('0x32')][_0x5163('0x46')]));_0x25799d[_0x5163('0x35')]=_0x25799d[_0x5163('0x35')][_0x5163('0x36')]?_0x25799d[_0x5163('0x35')]:_0x3e2a41['model'];if(_0x283500[_0x5163('0x32')][_0x5163('0x47')]){_0x25799d['include']=[{'all':!![]}];}_0x25799d=_[_0x5163('0x3d')]({},_0x25799d,_0x283500['options']);return db[_0x5163('0x2d')][_0x5163('0x48')](_0x25799d)[_0x5163('0x25')](handleEntityNotFound(_0x28b0a6,null))[_0x5163('0x25')](respondWithResult(_0x28b0a6,null))[_0x5163('0x42')](handleError(_0x28b0a6,null));};exports[_0x5163('0x49')]=function(_0x5f3777,_0x5d435d){return db[_0x5163('0x2d')][_0x5163('0x49')](_0x5f3777[_0x5163('0x4a')],{})[_0x5163('0x25')](respondWithResult(_0x5d435d,0xc9))[_0x5163('0x42')](handleError(_0x5d435d,null));};exports[_0x5163('0x24')]=function(_0x45f2a3,_0x489017){if(_0x45f2a3[_0x5163('0x4a')]['id']){delete _0x45f2a3[_0x5163('0x4a')]['id'];}return db['VoiceTransferReport'][_0x5163('0x48')]({'where':{'id':_0x45f2a3[_0x5163('0x44')]['id']}})[_0x5163('0x25')](handleEntityNotFound(_0x489017,null))[_0x5163('0x25')](saveUpdates(_0x45f2a3[_0x5163('0x4a')],null))[_0x5163('0x25')](respondWithResult(_0x489017,null))[_0x5163('0x42')](handleError(_0x489017,null));};exports[_0x5163('0x26')]=function(_0x51ab19,_0x760cfc){return db['VoiceTransferReport']['find']({'where':{'id':_0x51ab19[_0x5163('0x44')]['id']}})['then'](handleEntityNotFound(_0x760cfc,null))[_0x5163('0x25')](removeEntity(_0x760cfc,null))[_0x5163('0x42')](handleError(_0x760cfc,null));};exports[_0x5163('0x4b')]=function(_0x5517c6,_0x64fb60){return db[_0x5163('0x2d')][_0x5163('0x4b')]()[_0x5163('0x25')](respondWithResult(_0x64fb60,null))[_0x5163('0x42')](handleError(_0x64fb60,null));}; \ No newline at end of file +var _0x70d0=['stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','params','keys','find','create','body','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x70d0,0xb9));var _0x070d=function(_0x3711e2,_0x1468e1){_0x3711e2=_0x3711e2-0x0;var _0x18a556=_0x70d0[_0x3711e2];return _0x18a556;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x070d('0x0'));var rp=require(_0x070d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x070d('0x2'));var path=require(_0x070d('0x3'));var sox=require(_0x070d('0x4'));var csv=require(_0x070d('0x5'));var ejs=require(_0x070d('0x6'));var fs=require('fs');var fs_extra=require(_0x070d('0x7'));var _=require(_0x070d('0x8'));var squel=require('squel');var crypto=require(_0x070d('0x9'));var jsforce=require(_0x070d('0xa'));var deskjs=require(_0x070d('0xb'));var toCsv=require(_0x070d('0x5'));var querystring=require(_0x070d('0xc'));var Papa=require(_0x070d('0xd'));var Redis=require('ioredis');var authService=require(_0x070d('0xe'));var qs=require(_0x070d('0xf'));var as=require(_0x070d('0x10'));var hardwareService=require(_0x070d('0x11'));var logger=require('../../config/logger')(_0x070d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x070d('0x13'));var db=require(_0x070d('0x14'))['db'];function respondWithStatusCode(_0x110c7a,_0x410267){_0x410267=_0x410267||0xcc;return function(_0x134c37){if(_0x134c37){return _0x110c7a[_0x070d('0x15')](_0x410267);}return _0x110c7a[_0x070d('0x16')](_0x410267)[_0x070d('0x17')]();};}function respondWithResult(_0x21788b,_0x4b3ff1){_0x4b3ff1=_0x4b3ff1||0xc8;return function(_0x5387df){if(_0x5387df){return _0x21788b[_0x070d('0x16')](_0x4b3ff1)[_0x070d('0x18')](_0x5387df);}};}function respondWithFilteredResult(_0x18761e,_0x4985bb){return function(_0x4e6a24){if(_0x4e6a24){var _0x19cd09=typeof _0x4985bb[_0x070d('0x19')]===_0x070d('0x1a')&&typeof _0x4985bb[_0x070d('0x1b')]===_0x070d('0x1a');var _0x476499=_0x4e6a24[_0x070d('0x1c')];var _0x412fe0=_0x19cd09?0x0:_0x4985bb[_0x070d('0x19')];var _0x5140bf=_0x19cd09?_0x4e6a24['count']:_0x4985bb[_0x070d('0x19')]+_0x4985bb[_0x070d('0x1b')];var _0x38d3c2;if(_0x5140bf>=_0x476499){_0x5140bf=_0x476499;_0x38d3c2=0xc8;}else{_0x38d3c2=0xce;}_0x18761e[_0x070d('0x16')](_0x38d3c2);return _0x18761e[_0x070d('0x1d')]('Content-Range',_0x412fe0+'-'+_0x5140bf+'/'+_0x476499)[_0x070d('0x18')](_0x4e6a24);}return null;};}function patchUpdates(_0x5b2a0e){return function(_0x2131c8){try{jsonpatch[_0x070d('0x1e')](_0x2131c8,_0x5b2a0e,!![]);}catch(_0x5abfde){return BPromise[_0x070d('0x1f')](_0x5abfde);}return _0x2131c8[_0x070d('0x20')]();};}function saveUpdates(_0x138cec,_0x17becd){return function(_0x4e7172){if(_0x4e7172){return _0x4e7172[_0x070d('0x21')](_0x138cec)[_0x070d('0x22')](function(_0x178b17){return _0x178b17;});}return null;};}function removeEntity(_0x3ebbe4,_0xc55664){return function(_0x4c1840){if(_0x4c1840){return _0x4c1840[_0x070d('0x23')]()[_0x070d('0x22')](function(){_0x3ebbe4[_0x070d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ea6f,_0x3cfbc4){return function(_0x2b4f5){if(!_0x2b4f5){_0x41ea6f[_0x070d('0x15')](0x194);}return _0x2b4f5;};}function handleError(_0x5107e0,_0x1ad3cd){_0x1ad3cd=_0x1ad3cd||0x1f4;return function(_0x4b14ec){logger[_0x070d('0x24')](_0x4b14ec[_0x070d('0x25')]);if(_0x4b14ec['name']){delete _0x4b14ec[_0x070d('0x26')];}_0x5107e0['status'](_0x1ad3cd)[_0x070d('0x27')](_0x4b14ec);};}exports[_0x070d('0x28')]=function(_0x640bca,_0x2c81f0){var _0x413a2d={},_0x5f4204={},_0x2f476e={'count':0x0,'rows':[]};var _0x44c2ba=_[_0x070d('0x29')](db['VoiceTransferReport'][_0x070d('0x2a')],function(_0x51fcfd){return{'name':_0x51fcfd[_0x070d('0x2b')],'type':_0x51fcfd[_0x070d('0x2c')][_0x070d('0x2d')]};});_0x5f4204['model']=_['map'](_0x44c2ba,'name');_0x5f4204['query']=_['keys'](_0x640bca[_0x070d('0x2e')]);_0x5f4204['filters']=_[_0x070d('0x2f')](_0x5f4204['model'],_0x5f4204[_0x070d('0x2e')]);_0x413a2d[_0x070d('0x30')]=_[_0x070d('0x2f')](_0x5f4204[_0x070d('0x31')],qs[_0x070d('0x32')](_0x640bca[_0x070d('0x2e')]['fields']));_0x413a2d[_0x070d('0x30')]=_0x413a2d[_0x070d('0x30')][_0x070d('0x33')]?_0x413a2d[_0x070d('0x30')]:_0x5f4204[_0x070d('0x31')];if(!_0x640bca[_0x070d('0x2e')][_0x070d('0x34')](_0x070d('0x35'))){_0x413a2d[_0x070d('0x1b')]=qs[_0x070d('0x1b')](_0x640bca[_0x070d('0x2e')][_0x070d('0x1b')]);_0x413a2d[_0x070d('0x19')]=qs['offset'](_0x640bca['query'][_0x070d('0x19')]);}_0x413a2d[_0x070d('0x36')]=qs[_0x070d('0x37')](_0x640bca[_0x070d('0x2e')][_0x070d('0x37')]);_0x413a2d['where']=qs[_0x070d('0x38')](_[_0x070d('0x39')](_0x640bca[_0x070d('0x2e')],_0x5f4204[_0x070d('0x38')]),_0x44c2ba);if(_0x640bca['query'][_0x070d('0x3a')]){_0x413a2d[_0x070d('0x3b')]=_[_0x070d('0x3c')](_0x413a2d[_0x070d('0x3b')],{'$or':_[_0x070d('0x29')](_0x44c2ba,function(_0x1068c0){if(_0x1068c0['type']!==_0x070d('0x3d')){var _0x4980d8={};_0x4980d8[_0x1068c0[_0x070d('0x26')]]={'$like':'%'+_0x640bca[_0x070d('0x2e')][_0x070d('0x3a')]+'%'};return _0x4980d8;}})});}_0x413a2d=_[_0x070d('0x3c')]({},_0x413a2d,_0x640bca[_0x070d('0x3e')]);var _0x1588e1={'where':_0x413a2d[_0x070d('0x3b')]};return db[_0x070d('0x3f')][_0x070d('0x1c')](_0x1588e1)[_0x070d('0x22')](function(_0x5ed0db){_0x2f476e[_0x070d('0x1c')]=_0x5ed0db;if(_0x640bca[_0x070d('0x2e')][_0x070d('0x40')]){_0x413a2d[_0x070d('0x41')]=[{'all':!![]}];}return db[_0x070d('0x3f')][_0x070d('0x42')](_0x413a2d);})[_0x070d('0x22')](function(_0x93d58a){_0x2f476e[_0x070d('0x43')]=_0x93d58a;return _0x2f476e;})['then'](respondWithFilteredResult(_0x2c81f0,_0x413a2d))[_0x070d('0x44')](handleError(_0x2c81f0,null));};exports['show']=function(_0x328107,_0x3c5859){var _0x31ce91={'raw':!![],'where':{'id':_0x328107[_0x070d('0x45')]['id']}},_0x1ea45e={};_0x1ea45e[_0x070d('0x31')]=_[_0x070d('0x46')](db[_0x070d('0x3f')][_0x070d('0x2a')]);_0x1ea45e[_0x070d('0x2e')]=_[_0x070d('0x46')](_0x328107[_0x070d('0x2e')]);_0x1ea45e[_0x070d('0x38')]=_[_0x070d('0x2f')](_0x1ea45e[_0x070d('0x31')],_0x1ea45e[_0x070d('0x2e')]);_0x31ce91[_0x070d('0x30')]=_[_0x070d('0x2f')](_0x1ea45e[_0x070d('0x31')],qs[_0x070d('0x32')](_0x328107['query'][_0x070d('0x32')]));_0x31ce91[_0x070d('0x30')]=_0x31ce91[_0x070d('0x30')][_0x070d('0x33')]?_0x31ce91[_0x070d('0x30')]:_0x1ea45e[_0x070d('0x31')];if(_0x328107[_0x070d('0x2e')][_0x070d('0x40')]){_0x31ce91['include']=[{'all':!![]}];}_0x31ce91=_['merge']({},_0x31ce91,_0x328107['options']);return db[_0x070d('0x3f')][_0x070d('0x47')](_0x31ce91)[_0x070d('0x22')](handleEntityNotFound(_0x3c5859,null))[_0x070d('0x22')](respondWithResult(_0x3c5859,null))[_0x070d('0x44')](handleError(_0x3c5859,null));};exports[_0x070d('0x48')]=function(_0x4b243f,_0x37af02){return db[_0x070d('0x3f')][_0x070d('0x48')](_0x4b243f[_0x070d('0x49')],{})[_0x070d('0x22')](respondWithResult(_0x37af02,0xc9))[_0x070d('0x44')](handleError(_0x37af02,null));};exports[_0x070d('0x21')]=function(_0x11f3b7,_0x1b8156){if(_0x11f3b7[_0x070d('0x49')]['id']){delete _0x11f3b7['body']['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x11f3b7['params']['id']}})[_0x070d('0x22')](handleEntityNotFound(_0x1b8156,null))[_0x070d('0x22')](saveUpdates(_0x11f3b7[_0x070d('0x49')],null))['then'](respondWithResult(_0x1b8156,null))['catch'](handleError(_0x1b8156,null));};exports['destroy']=function(_0x54463d,_0x885a8a){return db[_0x070d('0x3f')]['find']({'where':{'id':_0x54463d['params']['id']}})['then'](handleEntityNotFound(_0x885a8a,null))[_0x070d('0x22')](removeEntity(_0x885a8a,null))[_0x070d('0x44')](handleError(_0x885a8a,null));};exports['describe']=function(_0x90939b,_0x121cbe){return db[_0x070d('0x3f')]['describe']()[_0x070d('0x22')](respondWithResult(_0x121cbe,null))[_0x070d('0x44')](handleError(_0x121cbe,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 9290b89..a9ea242 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 _0x0bb0=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer'];(function(_0x1ae494,_0x33d5b1){var _0x565639=function(_0x3b980a){while(--_0x3b980a){_0x1ae494['push'](_0x1ae494['shift']());}};_0x565639(++_0x33d5b1);}(_0x0bb0,0x11e));var _0x00bb=function(_0x5e235a,_0x18d36f){_0x5e235a=_0x5e235a-0x0;var _0x56bbd0=_0x0bb0[_0x5e235a];return _0x56bbd0;};'use strict';var _=require(_0x00bb('0x0'));var util=require(_0x00bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x00bb('0x2'));var BPromise=require(_0x00bb('0x3'));var rp=require(_0x00bb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00bb('0x5'));var config=require(_0x00bb('0x6'));var attributes=require(_0x00bb('0x7'));module['exports']=function(_0x120225,_0x11b13e){return _0x120225[_0x00bb('0x8')](_0x00bb('0x9'),attributes,{'tableName':_0x00bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x028f=['util','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','lodash'];(function(_0x5ed5e8,_0x59d51f){var _0x846bb6=function(_0x250735){while(--_0x250735){_0x5ed5e8['push'](_0x5ed5e8['shift']());}};_0x846bb6(++_0x59d51f);}(_0x028f,0xe5));var _0xf028=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x028f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf028('0x0'));var util=require(_0xf028('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf028('0x2'));var BPromise=require(_0xf028('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf028('0x4'));var rimraf=require(_0xf028('0x5'));var config=require(_0xf028('0x6'));var attributes=require(_0xf028('0x7'));module['exports']=function(_0x378878,_0x56500c){return _0x378878[_0xf028('0x8')](_0xf028('0x9'),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 9c18499..31825f9 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 _0x218b=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','stringify','catch','lodash','util','moment','bluebird'];(function(_0x1c1b8c,_0x4c253d){var _0x1ee4c4=function(_0xb9bff5){while(--_0xb9bff5){_0x1c1b8c['push'](_0x1c1b8c['shift']());}};_0x1ee4c4(++_0x4c253d);}(_0x218b,0xef));var _0xb218=function(_0x341043,_0x212d54){_0x341043=_0x341043-0x0;var _0x14eafc=_0x218b[_0x341043];return _0x14eafc;};'use strict';var _=require(_0xb218('0x0'));var util=require(_0xb218('0x1'));var moment=require(_0xb218('0x2'));var BPromise=require(_0xb218('0x3'));var rs=require(_0xb218('0x4'));var fs=require('fs');var Redis=require(_0xb218('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb218('0x6'));var logger=require(_0xb218('0x7'))(_0xb218('0x8'));var config=require(_0xb218('0x9'));var jayson=require(_0xb218('0xa'));var client=jayson['client'][_0xb218('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe07e47,_0xf1f3ec,_0x5a7f8e){return new BPromise(function(_0xbaf1b4,_0x128c5a){return client['request'](_0xe07e47,_0x5a7f8e)[_0xb218('0xc')](function(_0x3d11ce){logger[_0xb218('0xd')](_0xb218('0xe'),_0xf1f3ec,_0xb218('0xf'));logger['debug'](_0xb218('0x10'),_0xf1f3ec,_0xb218('0xf'),JSON['stringify'](_0x3d11ce));if(_0x3d11ce[_0xb218('0x11')]){if(_0x3d11ce['error'][_0xb218('0x12')]===0x1f4){logger[_0xb218('0x11')](_0xb218('0xe'),_0xf1f3ec,_0x3d11ce[_0xb218('0x11')]['message']);return _0x128c5a(_0x3d11ce[_0xb218('0x11')]['message']);}logger['error'](_0xb218('0xe'),_0xf1f3ec,_0x3d11ce[_0xb218('0x11')][_0xb218('0x13')]);return _0xbaf1b4(_0x3d11ce[_0xb218('0x11')][_0xb218('0x13')]);}else{logger[_0xb218('0xd')](_0xb218('0xe'),_0xf1f3ec,'request\x20sent');_0xbaf1b4(_0x3d11ce['result'][_0xb218('0x13')]);}})['catch'](function(_0x42953f){logger[_0xb218('0x11')](_0xb218('0xe'),_0xf1f3ec,_0x42953f);_0x128c5a(_0x42953f);});});}exports[_0xb218('0x14')]=function(_0x1f43c1){var _0x4548da=this;return new Promise(function(_0x2752ea,_0x2e3c83){return db[_0xb218('0x15')][_0xb218('0x16')](_0x1f43c1[_0xb218('0x17')],{'raw':_0x1f43c1[_0xb218('0x18')]?_0x1f43c1[_0xb218('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4239a7){logger['info'](_0xb218('0x14'),_0x1f43c1);logger['debug'](_0xb218('0x14'),_0x1f43c1,JSON[_0xb218('0x19')](_0x4239a7));_0x2752ea(_0x4239a7);})[_0xb218('0x1a')](function(_0xb747e8){logger[_0xb218('0x11')]('CreateVoiceTransferReport',_0xb747e8[_0xb218('0x13')],_0x1f43c1);_0x2e3c83(_0x4548da[_0xb218('0x11')](0x1f4,_0xb747e8[_0xb218('0x13')]));});});}; \ No newline at end of file +var _0x2730=['../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x3362e4,_0x284643){var _0x216b86=function(_0x3919af){while(--_0x3919af){_0x3362e4['push'](_0x3362e4['shift']());}};_0x216b86(++_0x284643);}(_0x2730,0x174));var _0x0273=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2730[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0273('0x0'));var util=require(_0x0273('0x1'));var moment=require('moment');var BPromise=require(_0x0273('0x2'));var rs=require(_0x0273('0x3'));var fs=require('fs');var Redis=require(_0x0273('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0273('0x5'))('rpc');var config=require(_0x0273('0x6'));var jayson=require(_0x0273('0x7'));var client=jayson[_0x0273('0x8')][_0x0273('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x555c27,_0xd68c2f,_0x5b057c){return new BPromise(function(_0x1b4592,_0x524f78){return client['request'](_0x555c27,_0x5b057c)['then'](function(_0x4f35c9){logger[_0x0273('0xa')](_0x0273('0xb'),_0xd68c2f,_0x0273('0xc'));logger[_0x0273('0xd')](_0x0273('0xe'),_0xd68c2f,'request\x20sent',JSON[_0x0273('0xf')](_0x4f35c9));if(_0x4f35c9[_0x0273('0x10')]){if(_0x4f35c9[_0x0273('0x10')][_0x0273('0x11')]===0x1f4){logger[_0x0273('0x10')](_0x0273('0xb'),_0xd68c2f,_0x4f35c9[_0x0273('0x10')]['message']);return _0x524f78(_0x4f35c9[_0x0273('0x10')][_0x0273('0x12')]);}logger[_0x0273('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0xd68c2f,_0x4f35c9[_0x0273('0x10')][_0x0273('0x12')]);return _0x1b4592(_0x4f35c9['error'][_0x0273('0x12')]);}else{logger[_0x0273('0xa')](_0x0273('0xb'),_0xd68c2f,_0x0273('0xc'));_0x1b4592(_0x4f35c9[_0x0273('0x13')][_0x0273('0x12')]);}})[_0x0273('0x14')](function(_0x2b1509){logger[_0x0273('0x10')](_0x0273('0xb'),_0xd68c2f,_0x2b1509);_0x524f78(_0x2b1509);});});}exports[_0x0273('0x15')]=function(_0x107670){var _0x3b1f32=this;return new Promise(function(_0x4644f6,_0x272c6f){return db[_0x0273('0x16')]['create'](_0x107670[_0x0273('0x17')],{'raw':_0x107670['options']?_0x107670[_0x0273('0x18')][_0x0273('0x19')]===undefined?!![]:![]:!![]})[_0x0273('0x1a')](function(_0x268718){logger[_0x0273('0xa')](_0x0273('0x15'),_0x107670);logger['debug'](_0x0273('0x15'),_0x107670,JSON[_0x0273('0xf')](_0x268718));_0x4644f6(_0x268718);})[_0x0273('0x14')](function(_0x41353b){logger[_0x0273('0x10')](_0x0273('0x15'),_0x41353b['message'],_0x107670);_0x272c6f(_0x3b1f32[_0x0273('0x10')](0x1f4,_0x41353b[_0x0273('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 0c53dc6..488cd46 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 _0xe5b3=['transfer','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer'];(function(_0x49ea0a,_0x365e34){var _0x2695c1=function(_0x5dd441){while(--_0x5dd441){_0x49ea0a['push'](_0x49ea0a['shift']());}};_0x2695c1(++_0x365e34);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5ecee1,_0x26cce1){_0x5ecee1=_0x5ecee1-0x0;var _0x4e2229=_0xe5b3[_0x5ecee1];return _0x4e2229;};'use strict';var express=require('express');var router=express[_0x3e5b('0x0')]();var auth=require(_0x3e5b('0x1'));var controller=require(_0x3e5b('0x2'));router[_0x3e5b('0x3')](_0x3e5b('0x4'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0x7')]);router[_0x3e5b('0x3')](_0x3e5b('0x8'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x9')]);router[_0x3e5b('0x3')]('/answer',auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xa')]);router[_0x3e5b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0x3')](_0x3e5b('0xc'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0xd')]);router['post'](_0x3e5b('0xe'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x3')](_0x3e5b('0x10'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5645ad,_0x580ea3){_0x5645ad=_0x5645ad-0x0;var _0x17d292=_0xf3cd[_0x5645ad];return _0x17d292;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index e80bcda..6d3f896 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 _0x8a6e=['webbar:unhold','unhold\x20executed!','calls\x20fired:','UserId','conference\x20fired:','webbar:conference','transfer','transferNumber','webbar:transfer','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','log','error','stack','status','name','send','NotFound','request','then','code','message','result','catch','User','agent','VoiceChannels','all','filter','rows','length','originate','originate\x20fired:','body','json','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','userId','sessionId','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:'];(function(_0x5a6451,_0x1841fd){var _0x404b6a=function(_0x2bd7f1){while(--_0x2bd7f1){_0x5a6451['push'](_0x5a6451['shift']());}};_0x404b6a(++_0x1841fd);}(_0x8a6e,0x16c));var _0xe8a6=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x8a6e[_0x2763f2];return _0x3ef471;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0xe8a6('0x0'))['db'];var config=require(_0xe8a6('0x1'));var util=require(_0xe8a6('0x2'));var BPromise=require(_0xe8a6('0x3'));var jayson=require(_0xe8a6('0x4'));var amiClient=jayson[_0xe8a6('0x5')][_0xe8a6('0x6')]({'port':0x232a});var logger=require(_0xe8a6('0x7'))('webbarapi');var Redis=require(_0xe8a6('0x8'));config[_0xe8a6('0x9')]=_[_0xe8a6('0xa')](config['redis'],{'host':_0xe8a6('0xb'),'port':0x18eb});var io=require(_0xe8a6('0xc'))(new Redis(config[_0xe8a6('0x9')]));var Schema=require(_0xe8a6('0xd'));var originateValidation=new Schema({'userId':{'type':_0xe8a6('0xe'),'required':[!![],_0xe8a6('0xf')]},'callNumber':{'type':_0xe8a6('0x10'),'required':[!![],_0xe8a6('0x11')]},'callerId':{'type':_0xe8a6('0x10')},'callbackUrl':{'type':_0xe8a6('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xe8a6('0xe'),'required':[!![],_0xe8a6('0xf')]},'sessionId':{'type':_0xe8a6('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe8a6('0xe'),'required':[!![],_0xe8a6('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe8a6('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0xe8a6('0x12')]},'transferNumber':{'type':_0xe8a6('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xe8a6('0xe'),'required':[!![],_0xe8a6('0xf')]},'sessionId':{'type':_0xe8a6('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe8a6('0xe'),'required':[!![],_0xe8a6('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe8a6('0xe'),'required':[!![],_0xe8a6('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xe8a6('0xe'),'required':[!![],_0xe8a6('0xf')]}});function emit(_0x35ee4d,_0x52b2c1,_0x2042db){logger[_0xe8a6('0x13')](_0x35ee4d,_0x52b2c1,JSON['stringify'](_0x2042db));io['to'](_0x35ee4d)['emit'](_0x52b2c1,_0x2042db);}function handleError(_0x24f5e4){return function(_0x437e63){console[_0xe8a6('0x14')]('handleError:',_0x437e63,_0x437e63 instanceof RangeError);logger[_0xe8a6('0x15')](_0x437e63[_0xe8a6('0x16')]);if(_0x437e63 instanceof RangeError){if(_0x437e63['name']){delete _0x437e63['name'];}_0x24f5e4[_0xe8a6('0x17')](0x194)['send'](_0x437e63);}else{if(_0x437e63[_0xe8a6('0x18')]){delete _0x437e63[_0xe8a6('0x18')];}_0x24f5e4[_0xe8a6('0x17')](0x1f4)[_0xe8a6('0x19')](_0x437e63);}};}function checkError(){return function(_0x34c5b7){if(!_0x34c5b7){throw new RangeError(_0xe8a6('0x1a'));}return _0x34c5b7;};}function respondWithRpcPromise(_0x139f5e,_0x5f536d){return new BPromise(function(_0x50e6a0,_0x3e1d30){var _0x22a31e=amiClient;return _0x22a31e[_0xe8a6('0x1b')](_0x139f5e,_0x5f536d)[_0xe8a6('0x1c')](function(_0x494868){if(_0x494868[_0xe8a6('0x15')]){if(_0x494868[_0xe8a6('0x15')][_0xe8a6('0x1d')]===0x1f4){return _0x3e1d30(_0x494868[_0xe8a6('0x15')][_0xe8a6('0x1e')]);}return _0x50e6a0(_0x494868['error']['message']);}else{_0x50e6a0(_0x494868[_0xe8a6('0x1f')]);}})[_0xe8a6('0x20')](function(_0x13de99){_0x3e1d30(_0x13de99);});});}function getAgent(_0x46639d){return db[_0xe8a6('0x21')]['findOne']({'where':{'id':_0x46639d,'role':_0xe8a6('0x22')}})[_0xe8a6('0x1c')](checkError());}function getAgentCheckSession(_0x2c69d6,_0x345aab){return new BPromise(function(_0x3675ff,_0x41d7b5){var _0x1c81f5=respondWithRpcPromise(_0xe8a6('0x23'));var _0x495a8b=getAgent(_0x2c69d6);Promise[_0xe8a6('0x24')]([_0x1c81f5,_0x495a8b])[_0xe8a6('0x1c')](function(_0x45939d){var _0x3cf56d=_0x45939d[0x0];var _0xf176c0=_0x45939d[0x1];var _0x19f01a=_[_0xe8a6('0x25')](_0x3cf56d[_0xe8a6('0x26')],function(_0x21d97c){return _0x21d97c['UserId']==_0xf176c0['id']&&_0x21d97c['sessionId']==_0x345aab;});if(_0x19f01a[_0xe8a6('0x27')]==0x1){_0x3675ff(_0xf176c0);}else{_0x41d7b5(new RangeError('sessionId\x20'+_0x345aab+'\x20not\x20found!'));}});});}exports[_0xe8a6('0x28')]=function(_0x535b78,_0x42974b){logger[_0xe8a6('0x13')](_0xe8a6('0x29'),_0x535b78['body']);var _0x50efd1=originateValidation[_0xe8a6('0xd')](_0x535b78[_0xe8a6('0x2a')]);if(_0x50efd1[_0xe8a6('0x27')]>0x0){return _0x42974b[_0xe8a6('0x17')](0x190)[_0xe8a6('0x2b')](_0x50efd1);}var _0x521469=_0x535b78[_0xe8a6('0x2a')]['userId'];var _0x13445d=_0x535b78[_0xe8a6('0x2a')]['callNumber'];var _0x4bd7c9=_0x535b78[_0xe8a6('0x2a')][_0xe8a6('0x2c')];var _0x11683b=_0x535b78['body'][_0xe8a6('0x2d')];return getAgent(_0x521469)[_0xe8a6('0x1c')](function(_0x579acb){logger[_0xe8a6('0x13')](_0xe8a6('0x2e'),_0x579acb[_0xe8a6('0x18')]);emit(util[_0xe8a6('0x2f')](_0xe8a6('0x30'),_0x579acb[_0xe8a6('0x18')]),_0xe8a6('0x31'),{'callNumber':_0x13445d,'callerId':_0x4bd7c9,'callbackUrl':_0x11683b});return _0x42974b['status'](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x42974b));};exports['hangup']=function(_0x1df6cd,_0x130bd0){logger[_0xe8a6('0x13')](_0xe8a6('0x32'),_0x1df6cd[_0xe8a6('0x2a')]);var _0x192d86=hangupValidation[_0xe8a6('0xd')](_0x1df6cd['body']);if(_0x192d86[_0xe8a6('0x27')]>0x0){return _0x130bd0[_0xe8a6('0x17')](0x190)[_0xe8a6('0x2b')](_0x192d86);}var _0xb8686=_0x1df6cd['body'][_0xe8a6('0x33')];var _0x3389c1=_0x1df6cd[_0xe8a6('0x2a')][_0xe8a6('0x34')];return getAgent(_0xb8686)['then'](function(_0x411318){logger[_0xe8a6('0x13')](_0xe8a6('0x2e'),_0x411318[_0xe8a6('0x18')]);emit(util[_0xe8a6('0x2f')](_0xe8a6('0x30'),_0x411318[_0xe8a6('0x18')]),'webbar:hangup',{'sessionId':_0x3389c1});return _0x130bd0[_0xe8a6('0x17')](0xc8)[_0xe8a6('0x2b')]({'error':![],'message':_0xe8a6('0x35')});})[_0xe8a6('0x20')](handleError(_0x130bd0));};exports['answer']=function(_0x5d9db2,_0x282d9c){logger['info'](_0xe8a6('0x36'),_0x5d9db2['body']);var _0x190d2c=answerValidation[_0xe8a6('0xd')](_0x5d9db2['body']);if(_0x190d2c[_0xe8a6('0x27')]>0x0){return _0x282d9c[_0xe8a6('0x17')](0x190)['json'](_0x190d2c);}var _0x2376f0=_0x5d9db2['body'][_0xe8a6('0x33')];var _0x5dcc0e=_0x5d9db2[_0xe8a6('0x2a')][_0xe8a6('0x34')];return getAgent(_0x2376f0)['then'](function(_0x3b78fa){logger[_0xe8a6('0x13')](_0xe8a6('0x2e'),_0x3b78fa[_0xe8a6('0x18')]);emit(util[_0xe8a6('0x2f')](_0xe8a6('0x30'),_0x3b78fa[_0xe8a6('0x18')]),_0xe8a6('0x37'),{'sessionId':_0x5dcc0e});return _0x282d9c[_0xe8a6('0x17')](0xc8)[_0xe8a6('0x2b')]({'error':![],'message':_0xe8a6('0x38')});})[_0xe8a6('0x20')](handleError(_0x282d9c));};exports[_0xe8a6('0x39')]=function(_0x10f599,_0x418b74){logger[_0xe8a6('0x13')](_0xe8a6('0x3a'),_0x10f599['body']);var _0x47d666=holdValidation[_0xe8a6('0xd')](_0x10f599[_0xe8a6('0x2a')]);if(_0x47d666[_0xe8a6('0x27')]>0x0){return _0x418b74[_0xe8a6('0x17')](0x190)[_0xe8a6('0x2b')](_0x47d666);}var _0x14d7ce=_0x10f599[_0xe8a6('0x2a')][_0xe8a6('0x33')];var _0x2ac8d7=_0x10f599[_0xe8a6('0x2a')][_0xe8a6('0x34')];return getAgent(_0x14d7ce)[_0xe8a6('0x1c')](function(_0xdce69d){logger['info'](_0xe8a6('0x2e'),_0xdce69d[_0xe8a6('0x18')]);emit(util['format'](_0xe8a6('0x30'),_0xdce69d['name']),_0xe8a6('0x3b'),{'sessionId':_0x2ac8d7});return _0x418b74[_0xe8a6('0x17')](0xc8)[_0xe8a6('0x2b')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x418b74));};exports[_0xe8a6('0x3c')]=function(_0x22c5d3,_0x41a1c7){logger[_0xe8a6('0x13')](_0xe8a6('0x3d'),_0x22c5d3[_0xe8a6('0x2a')]);var _0x17427f=unholdValidation[_0xe8a6('0xd')](_0x22c5d3[_0xe8a6('0x2a')]);if(_0x17427f[_0xe8a6('0x27')]>0x0){return _0x41a1c7['status'](0x190)['json'](_0x17427f);}var _0x85ca45=_0x22c5d3[_0xe8a6('0x2a')]['userId'];var _0x2d6693=_0x22c5d3['body'][_0xe8a6('0x34')];return getAgent(_0x85ca45)['then'](function(_0x5a7e85){logger['info'](_0xe8a6('0x2e'),_0x5a7e85[_0xe8a6('0x18')]);emit(util['format'](_0xe8a6('0x30'),_0x5a7e85['name']),_0xe8a6('0x3e'),{'sessionId':_0x2d6693});return _0x41a1c7[_0xe8a6('0x17')](0xc8)[_0xe8a6('0x2b')]({'error':![],'message':_0xe8a6('0x3f')});})[_0xe8a6('0x20')](handleError(_0x41a1c7));};exports['calls']=function(_0x12c181,_0x5820eb){logger[_0xe8a6('0x13')](_0xe8a6('0x40'),_0x5820eb[_0xe8a6('0x2a')]);var _0x39c237=callsValidation[_0xe8a6('0xd')](_0x12c181[_0xe8a6('0x2a')]);if(_0x39c237[_0xe8a6('0x27')]>0x0){return _0x5820eb['status'](0x190)[_0xe8a6('0x2b')](_0x39c237);}var _0x5ec60c=_0x12c181[_0xe8a6('0x2a')][_0xe8a6('0x33')];var _0x293bd=respondWithRpcPromise(_0xe8a6('0x23'));var _0xe87658=getAgent(_0x5ec60c);return Promise[_0xe8a6('0x24')]([_0x293bd,_0xe87658])['then'](function(_0x2ab5e0){var _0x254f64=_0x2ab5e0[0x0];var _0x37cbe1=_0x2ab5e0[0x1];var _0x1c7d98=_[_0xe8a6('0x25')](_0x254f64[_0xe8a6('0x26')],function(_0x22449e){return _0x22449e[_0xe8a6('0x41')]==_0x37cbe1['id'];});return _0x5820eb['status'](0xc8)['json']({'count':_0x1c7d98[_0xe8a6('0x27')],'rows':_0x1c7d98});})[_0xe8a6('0x20')](handleError(_0x5820eb));};exports['conference']=function(_0x4a17bb,_0x5d8a73){logger[_0xe8a6('0x13')](_0xe8a6('0x42'),_0x4a17bb[_0xe8a6('0x2a')]);var _0x4cc6fb=conferenceValidation[_0xe8a6('0xd')](_0x4a17bb[_0xe8a6('0x2a')]);if(_0x4cc6fb[_0xe8a6('0x27')]>0x0){return _0x5d8a73[_0xe8a6('0x17')](0x190)[_0xe8a6('0x2b')](_0x4cc6fb);}var _0x4f80cb=_0x4a17bb[_0xe8a6('0x2a')][_0xe8a6('0x33')];return getAgent(_0x4f80cb)[_0xe8a6('0x1c')](function(_0x2b5eba){logger[_0xe8a6('0x13')]('entityFound:',_0x2b5eba['name']);emit(util[_0xe8a6('0x2f')](_0xe8a6('0x30'),_0x2b5eba[_0xe8a6('0x18')]),_0xe8a6('0x43'));return _0x5d8a73['status'](0xc8)[_0xe8a6('0x2b')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x5d8a73));};exports[_0xe8a6('0x44')]=function(_0x247136,_0x4b8f25){logger[_0xe8a6('0x13')]('transfer\x20fired:',_0x247136[_0xe8a6('0x2a')]);var _0x4429fb=transferValidation[_0xe8a6('0xd')](_0x247136[_0xe8a6('0x2a')]);if(_0x4429fb[_0xe8a6('0x27')]>0x0){return _0x4b8f25['status'](0x190)['json'](_0x4429fb);}var _0x3ec7ee=_0x247136[_0xe8a6('0x2a')]['userId'];var _0x2f87f4=_0x247136['body'][_0xe8a6('0x34')];var _0x2182c6=_0x247136['body'][_0xe8a6('0x45')];return getAgent(_0x3ec7ee)['then'](function(_0xb66b8b){logger['info'](_0xe8a6('0x2e'),_0xb66b8b[_0xe8a6('0x18')]);emit(util[_0xe8a6('0x2f')](_0xe8a6('0x30'),_0xb66b8b[_0xe8a6('0x18')]),_0xe8a6('0x46'),{'sessionId':_0x2f87f4,'transferNumber':_0x2182c6});return _0x4b8f25[_0xe8a6('0x17')](0xc8)[_0xe8a6('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0xe8a6('0x20')](handleError(_0x4b8f25));}; \ No newline at end of file +var _0xf88a=['answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','info','stringify','emit','stack','name','send','NotFound','request','then','error','code','message','catch','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','validate','status','userId','format','hangup\x20executed!','answer\x20fired:','webbar:answer'];(function(_0xf8dca4,_0x108077){var _0x554055=function(_0x253606){while(--_0x253606){_0xf8dca4['push'](_0xf8dca4['shift']());}};_0x554055(++_0x108077);}(_0xf88a,0x1e0));var _0xaf88=function(_0x16f73d,_0x574564){_0x16f73d=_0x16f73d-0x0;var _0x39bbcf=_0xf88a[_0x16f73d];return _0x39bbcf;};'use strict';var path=require(_0xaf88('0x0'));var fs=require('fs');var _=require(_0xaf88('0x1'));var db=require(_0xaf88('0x2'))['db'];var config=require(_0xaf88('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xaf88('0x4'));var amiClient=jayson[_0xaf88('0x5')][_0xaf88('0x6')]({'port':0x232a});var logger=require(_0xaf88('0x7'))('webbarapi');var Redis=require(_0xaf88('0x8'));config[_0xaf88('0x9')]=_[_0xaf88('0xa')](config['redis'],{'host':_0xaf88('0xb'),'port':0x18eb});var io=require(_0xaf88('0xc'))(new Redis(config[_0xaf88('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xaf88('0xd'),'required':[!![],_0xaf88('0xe')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xaf88('0xf')},'callbackUrl':{'type':_0xaf88('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xaf88('0xd'),'required':[!![],_0xaf88('0xe')]},'sessionId':{'type':_0xaf88('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xaf88('0xd'),'required':[!![],_0xaf88('0xe')]},'sessionId':{'type':_0xaf88('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaf88('0xe')]},'sessionId':{'type':_0xaf88('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xaf88('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xaf88('0xd'),'required':[!![],_0xaf88('0xe')]},'sessionId':{'type':_0xaf88('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xaf88('0xd'),'required':[!![],_0xaf88('0xe')]},'sessionId':{'type':_0xaf88('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaf88('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaf88('0xe')]}});function emit(_0x4df1a2,_0x7a25a3,_0x26e920){logger[_0xaf88('0x10')](_0x4df1a2,_0x7a25a3,JSON[_0xaf88('0x11')](_0x26e920));io['to'](_0x4df1a2)[_0xaf88('0x12')](_0x7a25a3,_0x26e920);}function handleError(_0x984e1a){return function(_0x3d760b){console['log']('handleError:',_0x3d760b,_0x3d760b instanceof RangeError);logger['error'](_0x3d760b[_0xaf88('0x13')]);if(_0x3d760b instanceof RangeError){if(_0x3d760b[_0xaf88('0x14')]){delete _0x3d760b[_0xaf88('0x14')];}_0x984e1a['status'](0x194)[_0xaf88('0x15')](_0x3d760b);}else{if(_0x3d760b[_0xaf88('0x14')]){delete _0x3d760b[_0xaf88('0x14')];}_0x984e1a['status'](0x1f4)[_0xaf88('0x15')](_0x3d760b);}};}function checkError(){return function(_0x2b640b){if(!_0x2b640b){throw new RangeError(_0xaf88('0x16'));}return _0x2b640b;};}function respondWithRpcPromise(_0x106a91,_0x9b69d4){return new BPromise(function(_0x1fafae,_0x1c1fc4){var _0x2182a1=amiClient;return _0x2182a1[_0xaf88('0x17')](_0x106a91,_0x9b69d4)[_0xaf88('0x18')](function(_0x3b643d){if(_0x3b643d['error']){if(_0x3b643d[_0xaf88('0x19')][_0xaf88('0x1a')]===0x1f4){return _0x1c1fc4(_0x3b643d['error'][_0xaf88('0x1b')]);}return _0x1fafae(_0x3b643d[_0xaf88('0x19')][_0xaf88('0x1b')]);}else{_0x1fafae(_0x3b643d['result']);}})[_0xaf88('0x1c')](function(_0x381755){_0x1c1fc4(_0x381755);});});}function getAgent(_0x5c796d){return db['User'][_0xaf88('0x1d')]({'where':{'id':_0x5c796d,'role':_0xaf88('0x1e')}})[_0xaf88('0x18')](checkError());}function getAgentCheckSession(_0x975730,_0xbb28f4){return new BPromise(function(_0x406571,_0x3f543c){var _0x50ed01=respondWithRpcPromise(_0xaf88('0x1f'));var _0x4aba1a=getAgent(_0x975730);Promise[_0xaf88('0x20')]([_0x50ed01,_0x4aba1a])['then'](function(_0x9eb2db){var _0x135537=_0x9eb2db[0x0];var _0xc3f744=_0x9eb2db[0x1];var _0x1d56b0=_[_0xaf88('0x21')](_0x135537[_0xaf88('0x22')],function(_0x7bd9f9){return _0x7bd9f9['UserId']==_0xc3f744['id']&&_0x7bd9f9[_0xaf88('0x23')]==_0xbb28f4;});if(_0x1d56b0[_0xaf88('0x24')]==0x1){_0x406571(_0xc3f744);}else{_0x3f543c(new RangeError(_0xaf88('0x25')+_0xbb28f4+_0xaf88('0x26')));}});});}exports[_0xaf88('0x27')]=function(_0x444aa1,_0x1b2814){logger[_0xaf88('0x10')](_0xaf88('0x28'),_0x444aa1['body']);var _0x4e0751=originateValidation['validate'](_0x444aa1[_0xaf88('0x29')]);if(_0x4e0751[_0xaf88('0x24')]>0x0){return _0x1b2814['status'](0x190)[_0xaf88('0x2a')](_0x4e0751);}var _0x3003f8=_0x444aa1[_0xaf88('0x29')]['userId'];var _0x226849=_0x444aa1['body'][_0xaf88('0x2b')];var _0x2e6377=_0x444aa1[_0xaf88('0x29')][_0xaf88('0x2c')];var _0x5b539c=_0x444aa1[_0xaf88('0x29')][_0xaf88('0x2d')];return getAgent(_0x3003f8)[_0xaf88('0x18')](function(_0x5d90c9){logger['info'](_0xaf88('0x2e'),_0x5d90c9[_0xaf88('0x14')]);emit(util['format'](_0xaf88('0x2f'),_0x5d90c9[_0xaf88('0x14')]),_0xaf88('0x30'),{'callNumber':_0x226849,'callerId':_0x2e6377,'callbackUrl':_0x5b539c});return _0x1b2814['status'](0xc8)[_0xaf88('0x2a')]({'error':![],'message':_0xaf88('0x31')});})['catch'](handleError(_0x1b2814));};exports[_0xaf88('0x32')]=function(_0x4500a1,_0x4dcedc){logger[_0xaf88('0x10')](_0xaf88('0x33'),_0x4500a1[_0xaf88('0x29')]);var _0x23d19d=hangupValidation[_0xaf88('0x34')](_0x4500a1[_0xaf88('0x29')]);if(_0x23d19d['length']>0x0){return _0x4dcedc[_0xaf88('0x35')](0x190)[_0xaf88('0x2a')](_0x23d19d);}var _0x5d9420=_0x4500a1[_0xaf88('0x29')][_0xaf88('0x36')];var _0x3689c1=_0x4500a1[_0xaf88('0x29')][_0xaf88('0x23')];return getAgent(_0x5d9420)[_0xaf88('0x18')](function(_0x29a773){logger[_0xaf88('0x10')]('entityFound:',_0x29a773['name']);emit(util[_0xaf88('0x37')](_0xaf88('0x2f'),_0x29a773['name']),'webbar:hangup',{'sessionId':_0x3689c1});return _0x4dcedc['status'](0xc8)[_0xaf88('0x2a')]({'error':![],'message':_0xaf88('0x38')});})['catch'](handleError(_0x4dcedc));};exports['answer']=function(_0x1fcb25,_0x438fe9){logger[_0xaf88('0x10')](_0xaf88('0x39'),_0x1fcb25[_0xaf88('0x29')]);var _0x337902=answerValidation['validate'](_0x1fcb25[_0xaf88('0x29')]);if(_0x337902['length']>0x0){return _0x438fe9[_0xaf88('0x35')](0x190)[_0xaf88('0x2a')](_0x337902);}var _0x3ad774=_0x1fcb25[_0xaf88('0x29')][_0xaf88('0x36')];var _0x3e0795=_0x1fcb25['body'][_0xaf88('0x23')];return getAgent(_0x3ad774)['then'](function(_0x2ae64b){logger[_0xaf88('0x10')](_0xaf88('0x2e'),_0x2ae64b['name']);emit(util['format']('user:%s',_0x2ae64b[_0xaf88('0x14')]),_0xaf88('0x3a'),{'sessionId':_0x3e0795});return _0x438fe9['status'](0xc8)[_0xaf88('0x2a')]({'error':![],'message':_0xaf88('0x3b')});})[_0xaf88('0x1c')](handleError(_0x438fe9));};exports[_0xaf88('0x3c')]=function(_0x434d05,_0x5c4c45){logger['info'](_0xaf88('0x3d'),_0x434d05['body']);var _0x13afe4=holdValidation[_0xaf88('0x34')](_0x434d05[_0xaf88('0x29')]);if(_0x13afe4['length']>0x0){return _0x5c4c45[_0xaf88('0x35')](0x190)[_0xaf88('0x2a')](_0x13afe4);}var _0x299a04=_0x434d05[_0xaf88('0x29')][_0xaf88('0x36')];var _0x2a3613=_0x434d05[_0xaf88('0x29')][_0xaf88('0x23')];return getAgent(_0x299a04)[_0xaf88('0x18')](function(_0xcd22d){logger[_0xaf88('0x10')]('entityFound:',_0xcd22d['name']);emit(util[_0xaf88('0x37')](_0xaf88('0x2f'),_0xcd22d['name']),_0xaf88('0x3e'),{'sessionId':_0x2a3613});return _0x5c4c45[_0xaf88('0x35')](0xc8)['json']({'error':![],'message':_0xaf88('0x3f')});})[_0xaf88('0x1c')](handleError(_0x5c4c45));};exports[_0xaf88('0x40')]=function(_0x5ae8ad,_0x33ec50){logger['info'](_0xaf88('0x41'),_0x5ae8ad[_0xaf88('0x29')]);var _0x9bf951=unholdValidation[_0xaf88('0x34')](_0x5ae8ad[_0xaf88('0x29')]);if(_0x9bf951[_0xaf88('0x24')]>0x0){return _0x33ec50[_0xaf88('0x35')](0x190)['json'](_0x9bf951);}var _0x33c56b=_0x5ae8ad[_0xaf88('0x29')]['userId'];var _0x2eb003=_0x5ae8ad['body']['sessionId'];return getAgent(_0x33c56b)[_0xaf88('0x18')](function(_0x35cfdc){logger[_0xaf88('0x10')](_0xaf88('0x2e'),_0x35cfdc[_0xaf88('0x14')]);emit(util['format'](_0xaf88('0x2f'),_0x35cfdc[_0xaf88('0x14')]),_0xaf88('0x42'),{'sessionId':_0x2eb003});return _0x33ec50['status'](0xc8)[_0xaf88('0x2a')]({'error':![],'message':_0xaf88('0x43')});})[_0xaf88('0x1c')](handleError(_0x33ec50));};exports[_0xaf88('0x44')]=function(_0x4ef310,_0x5af475){logger[_0xaf88('0x10')]('calls\x20fired:',_0x5af475[_0xaf88('0x29')]);var _0x5e8282=callsValidation[_0xaf88('0x34')](_0x4ef310[_0xaf88('0x29')]);if(_0x5e8282[_0xaf88('0x24')]>0x0){return _0x5af475['status'](0x190)['json'](_0x5e8282);}var _0x100117=_0x4ef310['body'][_0xaf88('0x36')];var _0xf2fa1=respondWithRpcPromise(_0xaf88('0x1f'));var _0x2d86d2=getAgent(_0x100117);return Promise[_0xaf88('0x20')]([_0xf2fa1,_0x2d86d2])[_0xaf88('0x18')](function(_0x31905b){var _0x3c9509=_0x31905b[0x0];var _0x1722b0=_0x31905b[0x1];var _0x2eb2cd=_[_0xaf88('0x21')](_0x3c9509[_0xaf88('0x22')],function(_0x3337db){return _0x3337db['UserId']==_0x1722b0['id'];});return _0x5af475[_0xaf88('0x35')](0xc8)[_0xaf88('0x2a')]({'count':_0x2eb2cd['length'],'rows':_0x2eb2cd});})[_0xaf88('0x1c')](handleError(_0x5af475));};exports[_0xaf88('0x45')]=function(_0x38dcbf,_0x4ecf7d){logger['info'](_0xaf88('0x46'),_0x38dcbf[_0xaf88('0x29')]);var _0x4945a2=conferenceValidation['validate'](_0x38dcbf[_0xaf88('0x29')]);if(_0x4945a2['length']>0x0){return _0x4ecf7d['status'](0x190)[_0xaf88('0x2a')](_0x4945a2);}var _0x100d14=_0x38dcbf['body'][_0xaf88('0x36')];return getAgent(_0x100d14)[_0xaf88('0x18')](function(_0x54f3c2){logger[_0xaf88('0x10')](_0xaf88('0x2e'),_0x54f3c2[_0xaf88('0x14')]);emit(util['format'](_0xaf88('0x2f'),_0x54f3c2['name']),_0xaf88('0x47'));return _0x4ecf7d[_0xaf88('0x35')](0xc8)[_0xaf88('0x2a')]({'error':![],'message':_0xaf88('0x48')});})[_0xaf88('0x1c')](handleError(_0x4ecf7d));};exports[_0xaf88('0x49')]=function(_0x2c705b,_0x42534d){logger[_0xaf88('0x10')](_0xaf88('0x4a'),_0x2c705b[_0xaf88('0x29')]);var _0x43ca5f=transferValidation[_0xaf88('0x34')](_0x2c705b[_0xaf88('0x29')]);if(_0x43ca5f[_0xaf88('0x24')]>0x0){return _0x42534d[_0xaf88('0x35')](0x190)[_0xaf88('0x2a')](_0x43ca5f);}var _0x52be3b=_0x2c705b[_0xaf88('0x29')][_0xaf88('0x36')];var _0x18d5f1=_0x2c705b[_0xaf88('0x29')]['sessionId'];var _0x5894e6=_0x2c705b[_0xaf88('0x29')][_0xaf88('0x4b')];return getAgent(_0x52be3b)[_0xaf88('0x18')](function(_0x212124){logger['info']('entityFound:',_0x212124[_0xaf88('0x14')]);emit(util[_0xaf88('0x37')](_0xaf88('0x2f'),_0x212124[_0xaf88('0x14')]),'webbar:transfer',{'sessionId':_0x18d5f1,'transferNumber':_0x5894e6});return _0x42534d[_0xaf88('0x35')](0xc8)['json']({'error':![],'message':_0xaf88('0x4c')});})['catch'](handleError(_0x42534d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index f22967c..1242511 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 _0x0012=['addApplications','/:id/send','send','put','update','delete','destroy','removeDispositions','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications'];(function(_0x418117,_0x5de9f2){var _0x2c4e0b=function(_0x941e07){while(--_0x941e07){_0x418117['push'](_0x418117['shift']());}};_0x2c4e0b(++_0x5de9f2);}(_0x0012,0x78));var _0x2001=function(_0x5755fa,_0x142e3a){_0x5755fa=_0x5755fa-0x0;var _0x64bd04=_0x0012[_0x5755fa];return _0x64bd04;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2001('0x0'));var timeout=require(_0x2001('0x1'));var express=require(_0x2001('0x2'));var router=express[_0x2001('0x3')]();var fs_extra=require(_0x2001('0x4'));var auth=require(_0x2001('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2001('0x6'));var controller=require(_0x2001('0x7'));router[_0x2001('0x8')]('/',auth[_0x2001('0x9')](),controller[_0x2001('0xa')]);router[_0x2001('0x8')](_0x2001('0xb'),auth[_0x2001('0x9')](),controller[_0x2001('0xc')]);router[_0x2001('0x8')](_0x2001('0xd'),auth[_0x2001('0x9')](),controller[_0x2001('0xe')]);router[_0x2001('0x8')](_0x2001('0xf'),auth[_0x2001('0x9')](),controller[_0x2001('0x10')]);router[_0x2001('0x8')](_0x2001('0x11'),auth['isAuthenticated'](),controller[_0x2001('0x12')]);router[_0x2001('0x8')](_0x2001('0x13'),auth[_0x2001('0x9')](),controller[_0x2001('0x14')]);router[_0x2001('0x8')]('/:id/applications',auth[_0x2001('0x9')](),controller[_0x2001('0x15')]);router[_0x2001('0x16')]('/',auth[_0x2001('0x9')](),controller[_0x2001('0x17')]);router[_0x2001('0x16')](_0x2001('0xf'),auth[_0x2001('0x9')](),controller[_0x2001('0x18')]);router['post'](_0x2001('0x11'),auth['isAuthenticated'](),controller[_0x2001('0x19')]);router['post']('/:id/users',auth[_0x2001('0x9')](),controller[_0x2001('0x1a')]);router[_0x2001('0x16')](_0x2001('0x1b'),auth[_0x2001('0x9')](),controller[_0x2001('0x1c')]);router[_0x2001('0x16')]('/:id/notify',controller['notify']);router[_0x2001('0x16')](_0x2001('0x1d'),auth['isAuthenticated'](),controller[_0x2001('0x1e')]);router[_0x2001('0x1f')](_0x2001('0xd'),auth[_0x2001('0x9')](),controller[_0x2001('0x20')]);router[_0x2001('0x21')](_0x2001('0xd'),auth['isAuthenticated'](),controller[_0x2001('0x22')]);router[_0x2001('0x21')](_0x2001('0xf'),auth[_0x2001('0x9')](),controller[_0x2001('0x23')]);router[_0x2001('0x21')](_0x2001('0x11'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x2001('0x21')]('/:id/users',auth[_0x2001('0x9')](),controller['removeAgents']);module[_0x2001('0x24')]=router; \ No newline at end of file +var _0x90b5=['util','path','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x197558,_0x496781){var _0x363141=function(_0x49f8d9){while(--_0x49f8d9){_0x197558['push'](_0x197558['shift']());}};_0x363141(++_0x496781);}(_0x90b5,0x127));var _0x590b=function(_0x563eb4,_0x29bbae){_0x563eb4=_0x563eb4-0x0;var _0x97db86=_0x90b5[_0x563eb4];return _0x97db86;};'use strict';var multer=require(_0x590b('0x0'));var util=require(_0x590b('0x1'));var path=require(_0x590b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x590b('0x3'));var auth=require(_0x590b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x590b('0x5'));var controller=require(_0x590b('0x6'));router[_0x590b('0x7')]('/',auth[_0x590b('0x8')](),controller[_0x590b('0x9')]);router['get'](_0x590b('0xa'),auth['isAuthenticated'](),controller[_0x590b('0xb')]);router['get']('/:id',auth[_0x590b('0x8')](),controller[_0x590b('0xc')]);router[_0x590b('0x7')](_0x590b('0xd'),auth[_0x590b('0x8')](),controller[_0x590b('0xe')]);router[_0x590b('0x7')]('/:id/canned_answers',auth[_0x590b('0x8')](),controller[_0x590b('0xf')]);router[_0x590b('0x7')]('/:id/users',auth[_0x590b('0x8')](),controller[_0x590b('0x10')]);router[_0x590b('0x7')](_0x590b('0x11'),auth[_0x590b('0x8')](),controller['getApplications']);router['post']('/',auth[_0x590b('0x8')](),controller['create']);router[_0x590b('0x12')](_0x590b('0xd'),auth[_0x590b('0x8')](),controller[_0x590b('0x13')]);router[_0x590b('0x12')](_0x590b('0x14'),auth[_0x590b('0x8')](),controller[_0x590b('0x15')]);router[_0x590b('0x12')](_0x590b('0x16'),auth[_0x590b('0x8')](),controller['addAgents']);router['post'](_0x590b('0x11'),auth['isAuthenticated'](),controller[_0x590b('0x17')]);router['post'](_0x590b('0x18'),controller[_0x590b('0x19')]);router['post'](_0x590b('0x1a'),auth[_0x590b('0x8')](),controller[_0x590b('0x1b')]);router[_0x590b('0x1c')]('/:id',auth[_0x590b('0x8')](),controller[_0x590b('0x1d')]);router[_0x590b('0x1e')](_0x590b('0x1f'),auth[_0x590b('0x8')](),controller[_0x590b('0x20')]);router[_0x590b('0x1e')](_0x590b('0xd'),auth[_0x590b('0x8')](),controller[_0x590b('0x21')]);router[_0x590b('0x1e')]('/:id/canned_answers',auth[_0x590b('0x8')](),controller[_0x590b('0x22')]);router[_0x590b('0x1e')](_0x590b('0x16'),auth[_0x590b('0x8')](),controller[_0x590b('0x23')]);module[_0x590b('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ea95f9c..0ddd762 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 _0x61d2=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x290546,_0x1d0e4f){var _0x4796e1=function(_0x2b44a4){while(--_0x2b44a4){_0x290546['push'](_0x290546['shift']());}};_0x4796e1(++_0x1d0e4f);}(_0x61d2,0x13c));var _0x261d=function(_0x3adae1,_0x4aaf06){_0x3adae1=_0x3adae1-0x0;var _0x23e896=_0x61d2[_0x3adae1];return _0x23e896;};'use strict';var Sequelize=require(_0x261d('0x0'));var rs=require(_0x261d('0x1'));module[_0x261d('0x2')]={'name':{'type':Sequelize[_0x261d('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x261d('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x261d('0x3')],'defaultValue':function(){return rs[_0x261d('0x4')]();}},'phone':{'type':Sequelize[_0x261d('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0x261d('0x5'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x261d('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x261d('0x6');}},'notificationSound':{'type':Sequelize[_0x261d('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x261d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x261d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x261d('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x261d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x261d('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x261d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x261d('0x8')],'comment':_0x261d('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x261d('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x57cafe){if(!_0x57cafe){this[_0x261d('0xa')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x261d('0xb'),_0x57cafe);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5d8d=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x3d613e,_0x511d0c){var _0x411507=function(_0xf286d9){while(--_0xf286d9){_0x3d613e['push'](_0x3d613e['shift']());}};_0x411507(++_0x511d0c);}(_0x5d8d,0xe3));var _0xd5d8=function(_0x81ef7c,_0x21a871){_0x81ef7c=_0x81ef7c-0x0;var _0x35de12=_0x5d8d[_0x81ef7c];return _0x35de12;};'use strict';var Sequelize=require(_0xd5d8('0x0'));var rs=require(_0xd5d8('0x1'));module[_0xd5d8('0x2')]={'name':{'type':Sequelize[_0xd5d8('0x3')],'unique':_0xd5d8('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xd5d8('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xd5d8('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd5d8('0x3')]},'type':{'type':Sequelize[_0xd5d8('0x5')](_0xd5d8('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0xd5d8('0x3')]},'baseUrl':{'type':Sequelize[_0xd5d8('0x3')]},'authToken':{'type':Sequelize[_0xd5d8('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd5d8('0x7')],'defaultValue':function(){return _0xd5d8('0x8');}},'notificationSound':{'type':Sequelize[_0xd5d8('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd5d8('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd5d8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd5d8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd5d8('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd5d8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd5d8('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd5d8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd5d8('0xa')],'comment':_0xd5d8('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xd5d8('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x503e9b){if(!_0x503e9b){this['setDataValue'](_0xd5d8('0xc'),null);}this[_0xd5d8('0xd')]('mandatoryDisposition',_0x503e9b);}},'description':{'type':Sequelize[_0xd5d8('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index e8edbea..a42d8c1 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 _0x05d0=['type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','Pause','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','WhatsappAccountId','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','getApplications','whatsapp','Applications','account','sinch','statuses','state','applications','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','from','From','whatsapp:','Body','MessageSid','notifications','messageId','message_id','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','list','Contacts','contact','WhatsappInteraction','spread','interaction','push','*,*,*,*','created','WhatsappMessage','ContactId','UserId','agent','queueId','WhatsappQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','info','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','user','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','jayson/promise','client','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName'];(function(_0x192b07,_0x2dfdfd){var _0x589903=function(_0x4d02ed){while(--_0x4d02ed){_0x192b07['push'](_0x192b07['shift']());}};_0x589903(++_0x2dfdfd);}(_0x05d0,0x85));var _0x005d=function(_0x83bb10,_0x541f70){_0x83bb10=_0x83bb10-0x0;var _0x36ac0d=_0x05d0[_0x83bb10];return _0x36ac0d;};'use strict';var emlformat=require(_0x005d('0x0'));var rimraf=require(_0x005d('0x1'));var zipdir=require(_0x005d('0x2'));var jsonpatch=require(_0x005d('0x3'));var rp=require(_0x005d('0x4'));var moment=require(_0x005d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x005d('0x6'));var util=require(_0x005d('0x7'));var path=require(_0x005d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x005d('0x9'));var _=require(_0x005d('0xa'));var squel=require('squel');var crypto=require(_0x005d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x005d('0xc'));var toCsv=require(_0x005d('0xd'));var querystring=require(_0x005d('0xe'));var Papa=require(_0x005d('0xf'));var Redis=require(_0x005d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x005d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x005d('0x12'));var utils=require(_0x005d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x005d('0x14'));var db=require(_0x005d('0x15'))['db'];config['redis']=_[_0x005d('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x005d('0x17'))(new Redis(config[_0x005d('0x18')]));require('./whatsappAccount.socket')[_0x005d('0x19')](socket);var jayson=require(_0x005d('0x1a'));var client=jayson[_0x005d('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x19f99c,_0x1477a0,_0x331f50,_0x29148e){return new BPromise(function(_0x4cbdc7,_0x33fe08){var _0x54b486=_0x29148e||client;return _0x54b486[_0x005d('0x1c')](_0x19f99c,_0x331f50)[_0x005d('0x1d')](function(_0x5f3633){logger['info'](_0x005d('0x1e'),_0x1477a0,_0x005d('0x1f'));logger['debug'](_0x005d('0x20'),_0x1477a0,'request\x20sent',JSON['stringify'](_0x5f3633));if(_0x5f3633['error']){if(_0x5f3633['error'][_0x005d('0x21')]===0x1f4){logger[_0x005d('0x22')](_0x005d('0x1e'),_0x1477a0,_0x5f3633['error'][_0x005d('0x23')]);return _0x33fe08(_0x5f3633[_0x005d('0x22')][_0x005d('0x23')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1477a0,_0x5f3633[_0x005d('0x22')][_0x005d('0x23')]);return _0x4cbdc7(_0x5f3633['error'][_0x005d('0x23')]);}else{logger['info'](_0x005d('0x1e'),_0x1477a0,_0x005d('0x1f'));_0x4cbdc7(_0x5f3633[_0x005d('0x24')][_0x005d('0x23')]);}})['catch'](function(_0x28b31c){logger[_0x005d('0x22')](_0x005d('0x1e'),_0x1477a0,_0x28b31c);_0x33fe08(_0x28b31c);});});}function respondWithStatusCode(_0x55a95c,_0x211ad2){_0x211ad2=_0x211ad2||0xcc;return function(_0x16c626){if(_0x16c626){return _0x55a95c[_0x005d('0x25')](_0x211ad2);}return _0x55a95c[_0x005d('0x26')](_0x211ad2)['end']();};}function respondWithResult(_0x4f1ccd,_0x3c6a20){_0x3c6a20=_0x3c6a20||0xc8;return function(_0x3558f3){if(_0x3558f3){return _0x4f1ccd[_0x005d('0x26')](_0x3c6a20)[_0x005d('0x27')](_0x3558f3);}};}function respondWithFilteredResult(_0x1696d5,_0x16c228){return function(_0x5b49f3){if(_0x5b49f3){var _0x1bcd0c=typeof _0x16c228[_0x005d('0x28')]===_0x005d('0x29')&&typeof _0x16c228[_0x005d('0x2a')]===_0x005d('0x29');var _0x31e88c=_0x5b49f3['count'];var _0x2926a1=_0x1bcd0c?0x0:_0x16c228['offset'];var _0x31726c=_0x1bcd0c?_0x5b49f3[_0x005d('0x2b')]:_0x16c228[_0x005d('0x28')]+_0x16c228[_0x005d('0x2a')];var _0x433f05;if(_0x31726c>=_0x31e88c){_0x31726c=_0x31e88c;_0x433f05=0xc8;}else{_0x433f05=0xce;}_0x1696d5[_0x005d('0x26')](_0x433f05);return _0x1696d5[_0x005d('0x2c')](_0x005d('0x2d'),_0x2926a1+'-'+_0x31726c+'/'+_0x31e88c)[_0x005d('0x27')](_0x5b49f3);}return null;};}function patchUpdates(_0x202236){return function(_0x182f29){try{jsonpatch[_0x005d('0x2e')](_0x182f29,_0x202236,!![]);}catch(_0x2e3ac1){return BPromise[_0x005d('0x2f')](_0x2e3ac1);}return _0x182f29[_0x005d('0x30')]();};}function saveUpdates(_0x41b440,_0x42d04c){return function(_0x2b136d){if(_0x2b136d){return _0x2b136d[_0x005d('0x31')](_0x41b440)['then'](function(_0x2565ca){return _0x2565ca;});}return null;};}function removeEntity(_0x8f2398,_0x3a39eb){return function(_0x592222){if(_0x592222){return _0x592222[_0x005d('0x32')]()[_0x005d('0x1d')](function(){var _0x884309=_0x592222['get']({'plain':!![]});var _0x3a345b=_0x005d('0x33');return db[_0x005d('0x34')][_0x005d('0x32')]({'where':{'type':_0x3a345b,'resourceId':_0x884309['id']}})[_0x005d('0x1d')](function(){return _0x592222;});})[_0x005d('0x1d')](function(){_0x8f2398[_0x005d('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51fff7,_0x5a693d){return function(_0x9931c8){if(!_0x9931c8){_0x51fff7['sendStatus'](0x194);}return _0x9931c8;};}function handleError(_0x5c7138,_0x4744c0){_0x4744c0=_0x4744c0||0x1f4;return function(_0x47e4a5){logger[_0x005d('0x22')](_0x47e4a5[_0x005d('0x35')]);if(_0x47e4a5[_0x005d('0x36')]){delete _0x47e4a5['name'];}_0x5c7138[_0x005d('0x26')](_0x4744c0)[_0x005d('0x37')](_0x47e4a5);};}exports[_0x005d('0x38')]=function(_0x9f32f2,_0x338010){var _0x2944ab={'include':[{'model':db['Pause'],'as':_0x005d('0x39')}]},_0x1a604a={},_0x15c014={'count':0x0,'rows':[]};var _0x14cd08=_[_0x005d('0x3a')](db[_0x005d('0x3b')][_0x005d('0x3c')],function(_0x492304){return{'name':_0x492304[_0x005d('0x3d')],'type':_0x492304[_0x005d('0x3e')][_0x005d('0x3f')]};});_0x1a604a[_0x005d('0x40')]=_['map'](_0x14cd08,_0x005d('0x36'));_0x1a604a[_0x005d('0x41')]=_['keys'](_0x9f32f2[_0x005d('0x41')]);_0x1a604a['filters']=_[_0x005d('0x42')](_0x1a604a['model'],_0x1a604a['query']);_0x2944ab['attributes']=_[_0x005d('0x42')](_0x1a604a[_0x005d('0x40')],qs[_0x005d('0x43')](_0x9f32f2['query'][_0x005d('0x43')]));_0x2944ab[_0x005d('0x44')]=_0x2944ab[_0x005d('0x44')][_0x005d('0x45')]?_0x2944ab[_0x005d('0x44')]:_0x1a604a[_0x005d('0x40')];if(!_0x9f32f2[_0x005d('0x41')][_0x005d('0x46')]('nolimit')){_0x2944ab['limit']=qs[_0x005d('0x2a')](_0x9f32f2[_0x005d('0x41')][_0x005d('0x2a')]);_0x2944ab[_0x005d('0x28')]=qs[_0x005d('0x28')](_0x9f32f2[_0x005d('0x41')][_0x005d('0x28')]);}_0x2944ab[_0x005d('0x47')]=qs[_0x005d('0x48')](_0x9f32f2['query'][_0x005d('0x48')]);_0x2944ab[_0x005d('0x49')]=qs[_0x005d('0x4a')](_[_0x005d('0x4b')](_0x9f32f2[_0x005d('0x41')],_0x1a604a[_0x005d('0x4a')]),_0x14cd08);if(_0x9f32f2['query'][_0x005d('0x4c')]){_0x2944ab[_0x005d('0x49')]=_[_0x005d('0x4d')](_0x2944ab[_0x005d('0x49')],{'$or':_[_0x005d('0x3a')](_0x14cd08,function(_0x37c316){if(_0x37c316['type']!==_0x005d('0x4e')){var _0x190867={};_0x190867[_0x37c316['name']]={'$like':'%'+_0x9f32f2[_0x005d('0x41')][_0x005d('0x4c')]+'%'};return _0x190867;}})});}_0x2944ab=_[_0x005d('0x4d')]({},_0x2944ab,_0x9f32f2[_0x005d('0x4f')]);var _0x2b8ebf={'where':_0x2944ab['where']};return db[_0x005d('0x3b')][_0x005d('0x2b')](_0x2b8ebf)[_0x005d('0x1d')](function(_0x54e635){_0x15c014['count']=_0x54e635;if(_0x9f32f2[_0x005d('0x41')][_0x005d('0x50')]){_0x2944ab[_0x005d('0x51')]=[{'all':!![]}];}return db[_0x005d('0x3b')][_0x005d('0x52')](_0x2944ab);})['then'](function(_0x1c3540){_0x15c014['rows']=_0x1c3540;return _0x15c014;})[_0x005d('0x1d')](respondWithFilteredResult(_0x338010,_0x2944ab))[_0x005d('0x53')](handleError(_0x338010,null));};exports['show']=function(_0x175eea,_0x490e43){var _0x5b10f5={'raw':![],'where':{'id':_0x175eea[_0x005d('0x54')]['id']},'include':[{'model':db[_0x005d('0x55')],'as':_0x005d('0x39')}]},_0x1e6f58={};_0x1e6f58[_0x005d('0x40')]=_[_0x005d('0x56')](db['WhatsappAccount']['rawAttributes']);_0x1e6f58[_0x005d('0x41')]=_[_0x005d('0x56')](_0x175eea[_0x005d('0x41')]);_0x1e6f58[_0x005d('0x4a')]=_[_0x005d('0x42')](_0x1e6f58[_0x005d('0x40')],_0x1e6f58[_0x005d('0x41')]);_0x5b10f5['attributes']=_[_0x005d('0x42')](_0x1e6f58['model'],qs['fields'](_0x175eea[_0x005d('0x41')][_0x005d('0x43')]));_0x5b10f5['attributes']=_0x5b10f5[_0x005d('0x44')][_0x005d('0x45')]?_0x5b10f5[_0x005d('0x44')]:_0x1e6f58['model'];if(_0x175eea['query'][_0x005d('0x50')]){_0x5b10f5['include']=[{'all':!![]}];}_0x5b10f5=_['merge']({},_0x5b10f5,_0x175eea['options']);return db[_0x005d('0x3b')][_0x005d('0x57')](_0x5b10f5)[_0x005d('0x1d')](handleEntityNotFound(_0x490e43,null))['then'](respondWithResult(_0x490e43,null))['catch'](handleError(_0x490e43,null));};exports['create']=function(_0x458cbe,_0x36b74e){return db['WhatsappAccount'][_0x005d('0x58')](_0x458cbe[_0x005d('0x59')],{})[_0x005d('0x1d')](function(_0x4ffc09){var _0x147ca6=_0x458cbe['user']['get']({'plain':!![]});if(!_0x147ca6)throw new Error(_0x005d('0x5a'));if(_0x147ca6[_0x005d('0x5b')]==='user'){var _0x2242d6=_0x4ffc09[_0x005d('0x5c')]({'plain':!![]});var _0x33f1a0=_0x005d('0x33');return db[_0x005d('0x5d')][_0x005d('0x57')]({'where':{'name':_0x33f1a0,'userProfileId':_0x147ca6['userProfileId']},'raw':!![]})[_0x005d('0x1d')](function(_0x29cb3f){if(_0x29cb3f&&_0x29cb3f[_0x005d('0x5e')]===0x0){return db[_0x005d('0x34')]['create']({'name':_0x2242d6['name'],'resourceId':_0x2242d6['id'],'type':_0x29cb3f[_0x005d('0x36')],'sectionId':_0x29cb3f['id']},{})['then'](function(){return _0x4ffc09;});}else{return _0x4ffc09;}})[_0x005d('0x53')](function(_0x15063a){logger[_0x005d('0x22')](_0x005d('0x5f'),_0x15063a);throw _0x15063a;});}return _0x4ffc09;})['then'](respondWithResult(_0x36b74e,0xc9))[_0x005d('0x53')](handleError(_0x36b74e,null));};exports['update']=function(_0x1ad017,_0x4de0d7){if(_0x1ad017[_0x005d('0x59')]['id']){delete _0x1ad017[_0x005d('0x59')]['id'];}return db[_0x005d('0x3b')]['find']({'where':{'id':_0x1ad017['params']['id']},'include':[{'model':db[_0x005d('0x55')],'as':_0x005d('0x39')}]})[_0x005d('0x1d')](handleEntityNotFound(_0x4de0d7,null))[_0x005d('0x1d')](saveUpdates(_0x1ad017[_0x005d('0x59')],null))[_0x005d('0x1d')](respondWithResult(_0x4de0d7,null))['catch'](handleError(_0x4de0d7,null));};exports[_0x005d('0x32')]=function(_0x5a98ad,_0x233fa7){return db['WhatsappAccount'][_0x005d('0x57')]({'where':{'id':_0x5a98ad[_0x005d('0x54')]['id']}})[_0x005d('0x1d')](handleEntityNotFound(_0x233fa7,null))[_0x005d('0x1d')](removeEntity(_0x233fa7,null))['catch'](handleError(_0x233fa7,null));};exports['describe']=function(_0x5cdaf1,_0x14a4a4){return db[_0x005d('0x3b')][_0x005d('0x60')]()[_0x005d('0x1d')](respondWithResult(_0x14a4a4,null))[_0x005d('0x53')](handleError(_0x14a4a4,null));};exports['addDisposition']=function(_0x54f4a3,_0x289649,_0x1d53df){if(_0x54f4a3['body']['id']){delete _0x54f4a3['body']['id'];}return db[_0x005d('0x3b')][_0x005d('0x57')]({'where':{'id':_0x54f4a3[_0x005d('0x54')]['id']}})[_0x005d('0x1d')](handleEntityNotFound(_0x289649,null))['then'](function(_0x47037f){if(_0x47037f){_0x54f4a3[_0x005d('0x59')]['WhatsappAccountId']=_0x47037f['id'];return db[_0x005d('0x61')]['create'](_0x54f4a3['body']);}})[_0x005d('0x1d')](respondWithResult(_0x289649,null))['catch'](handleError(_0x289649,null));};exports['getDispositions']=function(_0x25fe8f,_0x2c4d1f,_0x566503){var _0xe9c8d2={'raw':![],'where':{}};var _0x2d5694={};var _0x1cc259={'count':0x0,'rows':[]};return db[_0x005d('0x3b')][_0x005d('0x62')]({'where':{'id':_0x25fe8f[_0x005d('0x54')]['id']}})[_0x005d('0x1d')](handleEntityNotFound(_0x2c4d1f,null))[_0x005d('0x1d')](function(_0x2015fd){if(_0x2015fd){_0x2d5694['model']=_[_0x005d('0x56')](db[_0x005d('0x61')][_0x005d('0x3c')]);_0x2d5694[_0x005d('0x41')]=_[_0x005d('0x56')](_0x25fe8f[_0x005d('0x41')]);_0x2d5694[_0x005d('0x4a')]=_[_0x005d('0x42')](_0x2d5694[_0x005d('0x40')],_0x2d5694['query']);_0xe9c8d2[_0x005d('0x44')]=_[_0x005d('0x42')](_0x2d5694[_0x005d('0x40')],qs[_0x005d('0x43')](_0x25fe8f[_0x005d('0x41')][_0x005d('0x43')]));_0xe9c8d2[_0x005d('0x44')]=_0xe9c8d2['attributes']['length']?_0xe9c8d2[_0x005d('0x44')]:_0x2d5694[_0x005d('0x40')];if(!_0x25fe8f[_0x005d('0x41')][_0x005d('0x46')]('nolimit')){_0xe9c8d2[_0x005d('0x2a')]=qs[_0x005d('0x2a')](_0x25fe8f['query'][_0x005d('0x2a')]);_0xe9c8d2[_0x005d('0x28')]=qs[_0x005d('0x28')](_0x25fe8f['query'][_0x005d('0x28')]);}_0xe9c8d2[_0x005d('0x47')]=qs[_0x005d('0x48')](_0x25fe8f['query'][_0x005d('0x48')]);_0xe9c8d2[_0x005d('0x49')]=qs['filters'](_[_0x005d('0x4b')](_0x25fe8f['query'],_0x2d5694[_0x005d('0x4a')]));_0xe9c8d2[_0x005d('0x49')]['WhatsappAccountId']=_0x2015fd['id'];if(_0x25fe8f[_0x005d('0x41')][_0x005d('0x4c')]){_0xe9c8d2[_0x005d('0x49')]=_[_0x005d('0x4d')](_0xe9c8d2[_0x005d('0x49')],{'$or':_[_0x005d('0x3a')](_0xe9c8d2['attributes'],function(_0x3cbb63){var _0x541f0f={};_0x541f0f[_0x3cbb63]={'$like':'%'+_0x25fe8f['query'][_0x005d('0x4c')]+'%'};return _0x541f0f;})});}_0xe9c8d2=_[_0x005d('0x4d')]({},_0xe9c8d2,_0x25fe8f[_0x005d('0x4f')]);return db[_0x005d('0x61')][_0x005d('0x2b')]({'where':_0xe9c8d2[_0x005d('0x49')]})[_0x005d('0x1d')](function(_0x8e31a9){_0x1cc259[_0x005d('0x2b')]=_0x8e31a9;if(_0x25fe8f[_0x005d('0x41')][_0x005d('0x50')]){_0xe9c8d2[_0x005d('0x51')]=[{'all':!![]}];}return db[_0x005d('0x61')][_0x005d('0x52')](_0xe9c8d2);})[_0x005d('0x1d')](function(_0x5d4c89){_0x1cc259[_0x005d('0x63')]=_0x5d4c89;return _0x1cc259;});}})['then'](respondWithFilteredResult(_0x2c4d1f,_0xe9c8d2))[_0x005d('0x53')](handleError(_0x2c4d1f,null));};exports[_0x005d('0x64')]=function(_0x116bf8,_0x454507,_0x1d5ef8){return db[_0x005d('0x3b')][_0x005d('0x57')]({'where':{'id':_0x116bf8['params']['id']}})[_0x005d('0x1d')](handleEntityNotFound(_0x454507,null))['then'](function(_0x1febca){if(_0x1febca){return _0x1febca[_0x005d('0x64')](_0x116bf8['query'][_0x005d('0x65')]);}})[_0x005d('0x1d')](respondWithStatusCode(_0x454507,null))[_0x005d('0x53')](handleError(_0x454507,null));};exports[_0x005d('0x66')]=function(_0x59065d,_0xce8d86,_0x48d27e){if(_0x59065d[_0x005d('0x59')]['id']){delete _0x59065d[_0x005d('0x59')]['id'];}return db['WhatsappAccount'][_0x005d('0x57')]({'where':{'id':_0x59065d[_0x005d('0x54')]['id']}})['then'](handleEntityNotFound(_0xce8d86,null))[_0x005d('0x1d')](function(_0x4e2f78){if(_0x4e2f78){_0x59065d[_0x005d('0x59')]['WhatsappAccountId']=_0x4e2f78['id'];return db[_0x005d('0x67')]['create'](_0x59065d[_0x005d('0x59')]);}})[_0x005d('0x1d')](respondWithResult(_0xce8d86,null))[_0x005d('0x53')](handleError(_0xce8d86,null));};exports[_0x005d('0x68')]=function(_0x51c517,_0x190583,_0x2b4af9){var _0x5eee94={'raw':![],'where':{}};var _0x36cda2={};var _0x1e306b={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x005d('0x62')]({'where':{'id':_0x51c517['params']['id']}})[_0x005d('0x1d')](handleEntityNotFound(_0x190583,null))[_0x005d('0x1d')](function(_0x227625){if(_0x227625){_0x36cda2[_0x005d('0x40')]=_[_0x005d('0x56')](db[_0x005d('0x67')][_0x005d('0x3c')]);_0x36cda2['query']=_['keys'](_0x51c517[_0x005d('0x41')]);_0x36cda2[_0x005d('0x4a')]=_[_0x005d('0x42')](_0x36cda2[_0x005d('0x40')],_0x36cda2['query']);_0x5eee94['attributes']=_['intersection'](_0x36cda2[_0x005d('0x40')],qs[_0x005d('0x43')](_0x51c517[_0x005d('0x41')][_0x005d('0x43')]));_0x5eee94[_0x005d('0x44')]=_0x5eee94[_0x005d('0x44')][_0x005d('0x45')]?_0x5eee94[_0x005d('0x44')]:_0x36cda2[_0x005d('0x40')];if(!_0x51c517[_0x005d('0x41')][_0x005d('0x46')](_0x005d('0x69'))){_0x5eee94['limit']=qs['limit'](_0x51c517[_0x005d('0x41')][_0x005d('0x2a')]);_0x5eee94[_0x005d('0x28')]=qs[_0x005d('0x28')](_0x51c517['query'][_0x005d('0x28')]);}_0x5eee94[_0x005d('0x47')]=qs['sort'](_0x51c517['query'][_0x005d('0x48')]);_0x5eee94[_0x005d('0x49')]=qs[_0x005d('0x4a')](_[_0x005d('0x4b')](_0x51c517[_0x005d('0x41')],_0x36cda2[_0x005d('0x4a')]));_0x5eee94[_0x005d('0x49')][_0x005d('0x6a')]=_0x227625['id'];if(_0x51c517['query']['filter']){_0x5eee94['where']=_[_0x005d('0x4d')](_0x5eee94[_0x005d('0x49')],{'$or':_[_0x005d('0x3a')](_0x5eee94[_0x005d('0x44')],function(_0x481643){var _0x24b750={};_0x24b750[_0x481643]={'$like':'%'+_0x51c517[_0x005d('0x41')]['filter']+'%'};return _0x24b750;})});}_0x5eee94=_['merge']({},_0x5eee94,_0x51c517['options']);return db[_0x005d('0x67')]['count']({'where':_0x5eee94['where']})[_0x005d('0x1d')](function(_0x26242c){_0x1e306b[_0x005d('0x2b')]=_0x26242c;if(_0x51c517[_0x005d('0x41')][_0x005d('0x50')]){_0x5eee94[_0x005d('0x51')]=[{'all':!![]}];}return db[_0x005d('0x67')][_0x005d('0x52')](_0x5eee94);})[_0x005d('0x1d')](function(_0x5abc77){_0x1e306b['rows']=_0x5abc77;return _0x1e306b;});}})['then'](respondWithFilteredResult(_0x190583,_0x5eee94))[_0x005d('0x53')](handleError(_0x190583,null));};exports[_0x005d('0x6b')]=function(_0x185c7d,_0x982230,_0xaa1bef){return db[_0x005d('0x3b')][_0x005d('0x57')]({'where':{'id':_0x185c7d[_0x005d('0x54')]['id']}})[_0x005d('0x1d')](handleEntityNotFound(_0x982230,null))[_0x005d('0x1d')](function(_0x159d44){if(_0x159d44){return _0x159d44[_0x005d('0x6b')](_0x185c7d[_0x005d('0x41')][_0x005d('0x65')]);}})[_0x005d('0x1d')](respondWithStatusCode(_0x982230,null))['catch'](handleError(_0x982230,null));};exports[_0x005d('0x6c')]=function(_0x33c3b2,_0x2dcb6c,_0x12ea90){return db['WhatsappAccount'][_0x005d('0x57')]({'where':{'id':_0x33c3b2['params']['id']}})[_0x005d('0x1d')](handleEntityNotFound(_0x2dcb6c,null))[_0x005d('0x1d')](function(_0x1c3ce3){if(_0x1c3ce3){return _0x1c3ce3[_0x005d('0x6c')](_0x33c3b2[_0x005d('0x59')]['ids'],_[_0x005d('0x6d')](_0x33c3b2[_0x005d('0x59')],[_0x005d('0x65'),'id'])||{})['spread'](function(_0x1da2b7){for(var _0x3f179e=0x0;_0x3f179e<_0x33c3b2['body'][_0x005d('0x65')][_0x005d('0x45')];_0x3f179e+=0x1){socket['emit'](_0x005d('0x6e'),{'UserId':Number(_0x33c3b2[_0x005d('0x59')]['ids'][_0x3f179e]),'WhatsappAccountId':Number(_0x33c3b2['params']['id'])});}return _0x1da2b7;});}})['then'](respondWithResult(_0x2dcb6c,null))[_0x005d('0x53')](handleError(_0x2dcb6c,null));};exports[_0x005d('0x6f')]=function(_0x50e8c5,_0x528f23,_0x38ecfe){return db[_0x005d('0x3b')][_0x005d('0x57')]({'where':{'id':_0x50e8c5[_0x005d('0x54')]['id']}})[_0x005d('0x1d')](handleEntityNotFound(_0x528f23,null))[_0x005d('0x1d')](function(_0x36f2c3){if(_0x36f2c3){return _0x36f2c3['removeAgents'](_0x50e8c5['query'][_0x005d('0x65')])[_0x005d('0x1d')](function(){if(_[_0x005d('0x70')](_0x50e8c5[_0x005d('0x41')]['ids'])){for(var _0x975a9f=0x0;_0x975a9f<_0x50e8c5[_0x005d('0x41')][_0x005d('0x65')][_0x005d('0x45')];_0x975a9f+=0x1){socket[_0x005d('0x71')](_0x005d('0x72'),{'UserId':Number(_0x50e8c5[_0x005d('0x41')][_0x005d('0x65')][_0x975a9f]),'WhatsappAccountId':Number(_0x50e8c5['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x50e8c5[_0x005d('0x41')][_0x005d('0x65')]),'WhatsappAccountId':Number(_0x50e8c5[_0x005d('0x54')]['id'])});}});}})[_0x005d('0x1d')](respondWithStatusCode(_0x528f23,null))['catch'](handleError(_0x528f23,null));};exports[_0x005d('0x73')]=function(_0x469c7c,_0x47ff36,_0x3f5f5e){var _0x49a7af={};var _0x1d3334={};var _0x385e35;var _0x82668a;return db[_0x005d('0x3b')]['findOne']({'where':{'id':_0x469c7c[_0x005d('0x54')]['id']}})[_0x005d('0x1d')](handleEntityNotFound(_0x47ff36,null))[_0x005d('0x1d')](function(_0x1e83a4){if(_0x1e83a4){_0x385e35=_0x1e83a4;_0x1d3334['model']=_['keys'](db[_0x005d('0x74')][_0x005d('0x3c')]);_0x1d3334[_0x005d('0x41')]=_[_0x005d('0x56')](_0x469c7c['query']);_0x1d3334[_0x005d('0x4a')]=_[_0x005d('0x42')](_0x1d3334[_0x005d('0x40')],_0x1d3334[_0x005d('0x41')]);_0x49a7af[_0x005d('0x44')]=_[_0x005d('0x42')](_0x1d3334[_0x005d('0x40')],qs[_0x005d('0x43')](_0x469c7c['query'][_0x005d('0x43')]));_0x49a7af[_0x005d('0x44')]=_0x49a7af[_0x005d('0x44')]['length']?_0x49a7af[_0x005d('0x44')]:_0x1d3334[_0x005d('0x40')];_0x49a7af[_0x005d('0x47')]=qs[_0x005d('0x48')](_0x469c7c[_0x005d('0x41')][_0x005d('0x48')]);_0x49a7af['where']=qs[_0x005d('0x4a')](_[_0x005d('0x4b')](_0x469c7c[_0x005d('0x41')],_0x1d3334[_0x005d('0x4a')]));if(_0x469c7c['query'][_0x005d('0x4c')]){_0x49a7af[_0x005d('0x49')]=_['merge'](_0x49a7af[_0x005d('0x49')],{'$or':_[_0x005d('0x3a')](_0x49a7af[_0x005d('0x44')],function(_0x123fb7){var _0x462ae3={};_0x462ae3[_0x123fb7]={'$like':'%'+_0x469c7c[_0x005d('0x41')]['filter']+'%'};return _0x462ae3;})});}_0x49a7af=_[_0x005d('0x4d')]({},_0x49a7af,_0x469c7c[_0x005d('0x4f')]);return _0x385e35[_0x005d('0x73')](_0x49a7af);}})[_0x005d('0x1d')](function(_0xf82da0){if(_0xf82da0){_0x82668a=_0xf82da0[_0x005d('0x45')];if(!_0x469c7c['query'][_0x005d('0x46')](_0x005d('0x69'))){_0x49a7af[_0x005d('0x2a')]=qs['limit'](_0x469c7c[_0x005d('0x41')]['limit']);_0x49a7af[_0x005d('0x28')]=qs[_0x005d('0x28')](_0x469c7c[_0x005d('0x41')][_0x005d('0x28')]);}return _0x385e35[_0x005d('0x73')](_0x49a7af);}})['then'](function(_0x42db77){if(_0x42db77){return _0x42db77?{'count':_0x82668a,'rows':_0x42db77}:null;}})[_0x005d('0x1d')](respondWithResult(_0x47ff36,null))[_0x005d('0x53')](handleError(_0x47ff36,null));};exports['addApplications']=function(_0x1b23c9,_0x156da1){var _0x428172=_0x1b23c9[_0x005d('0x54')]['id'];var _0x332d4a=_0x1b23c9[_0x005d('0x59')];var _0x418b50=0xc8;var _0x2eeeab=null;return db[_0x005d('0x75')][_0x005d('0x76')]({'isolationLevel':db['sequelize'][_0x005d('0x77')][_0x005d('0x78')][_0x005d('0x79')]},function(_0x274c4b){return db['WhatsappAccount'][_0x005d('0x62')]({'where':{'id':_0x428172},'transaction':_0x274c4b})[_0x005d('0x1d')](function(_0x1b3df4){if(_0x1b3df4){return db[_0x005d('0x7a')][_0x005d('0x32')]({'where':{'WhatsappAccountId':_0x428172},'transaction':_0x274c4b})[_0x005d('0x1d')](function(){var _0x199444=_['map'](_0x332d4a,function(_0x26219d){_0x26219d[_0x005d('0x6a')]=_0x428172;return _0x26219d;});return db[_0x005d('0x7a')][_0x005d('0x7b')](_0x199444,{'transaction':_0x274c4b});});}else{_0x418b50=0x194;_0x2eeeab=[];}});})[_0x005d('0x1d')](function(){if(_0x418b50!==0x194){return db[_0x005d('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x428172},'order':_0x005d('0x7c')})[_0x005d('0x1d')](function(_0x1e9655){_0x2eeeab=_0x1e9655;});}})[_0x005d('0x53')](function(_0x401ebf){_0x418b50=0x1f4;logger[_0x005d('0x22')](_0x401ebf[_0x005d('0x35')]);if(_0x401ebf['name']){delete _0x401ebf[_0x005d('0x36')];}_0x2eeeab=_0x401ebf;})[_0x005d('0x7d')](function(){if(_0x2eeeab===null){_0x156da1[_0x005d('0x25')](_0x418b50);}else{if(_0x418b50===0x1f4){_0x156da1[_0x005d('0x26')](_0x418b50)[_0x005d('0x37')](_0x2eeeab);}else{_0x156da1[_0x005d('0x26')](_0x418b50)['json'](_0x2eeeab);}}});};exports['getApplications']=function(_0xaa7efa,_0x2b8eee,_0x4040a6){var _0x36f227={};var _0x5ae76={};var _0x5452f6;var _0xd041b4;return db[_0x005d('0x3b')]['findOne']({'where':{'id':_0xaa7efa['params']['id']}})['then'](handleEntityNotFound(_0x2b8eee,null))[_0x005d('0x1d')](function(_0x53df0c){if(_0x53df0c){_0x5452f6=_0x53df0c;_0x5ae76[_0x005d('0x40')]=_[_0x005d('0x56')](db[_0x005d('0x7a')][_0x005d('0x3c')]);_0x5ae76[_0x005d('0x41')]=_[_0x005d('0x56')](_0xaa7efa[_0x005d('0x41')]);_0x5ae76['filters']=_[_0x005d('0x42')](_0x5ae76[_0x005d('0x40')],_0x5ae76[_0x005d('0x41')]);_0x36f227[_0x005d('0x44')]=_[_0x005d('0x42')](_0x5ae76[_0x005d('0x40')],qs[_0x005d('0x43')](_0xaa7efa[_0x005d('0x41')][_0x005d('0x43')]));_0x36f227['attributes']=_0x36f227[_0x005d('0x44')][_0x005d('0x45')]?_0x36f227['attributes']:_0x5ae76[_0x005d('0x40')];_0x36f227['order']=qs[_0x005d('0x48')](_0xaa7efa[_0x005d('0x41')][_0x005d('0x48')]);_0x36f227[_0x005d('0x49')]=qs['filters'](_[_0x005d('0x4b')](_0xaa7efa['query'],_0x5ae76[_0x005d('0x4a')]));if(_0xaa7efa[_0x005d('0x41')][_0x005d('0x4c')]){_0x36f227[_0x005d('0x49')]=_[_0x005d('0x4d')](_0x36f227['where'],{'$or':_[_0x005d('0x3a')](_0x36f227[_0x005d('0x44')],function(_0x71aafb){var _0x3dad45={};_0x3dad45[_0x71aafb]={'$like':'%'+_0xaa7efa[_0x005d('0x41')][_0x005d('0x4c')]+'%'};return _0x3dad45;})});}_0x36f227=_[_0x005d('0x4d')]({},_0x36f227,_0xaa7efa[_0x005d('0x4f')]);return _0x5452f6[_0x005d('0x7e')](_0x36f227);}})[_0x005d('0x1d')](function(_0x390c32){if(_0x390c32){_0xd041b4=_0x390c32['length'];if(!_0xaa7efa[_0x005d('0x41')]['hasOwnProperty'](_0x005d('0x69'))){_0x36f227[_0x005d('0x2a')]=qs[_0x005d('0x2a')](_0xaa7efa['query']['limit']);_0x36f227[_0x005d('0x28')]=qs[_0x005d('0x28')](_0xaa7efa[_0x005d('0x41')]['offset']);}return _0x5452f6[_0x005d('0x7e')](_0x36f227);}})['then'](function(_0x4ea643){if(_0x4ea643){return _0x4ea643?{'count':_0xd041b4,'rows':_0x4ea643}:null;}})[_0x005d('0x1d')](respondWithResult(_0x2b8eee,null))[_0x005d('0x53')](handleError(_0x2b8eee,null));};exports['notify']=function(_0x456b80,_0x2b6aa9,_0x50fdad){var _0x52dc3b={'channel':_0x005d('0x7f')};var _0x2974b3=[];var _0x93888c=[];var _0xd1fa6={};return db[_0x005d('0x3b')][_0x005d('0x57')]({'where':{'id':_0x456b80[_0x005d('0x54')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x005d('0x80')}]})[_0x005d('0x1d')](handleEntityNotFound(_0x2b6aa9,null))[_0x005d('0x1d')](function(_0x33aca3){_0x52dc3b[_0x005d('0x81')]=_0x33aca3;if(_0x52dc3b['account']&&_0x52dc3b[_0x005d('0x81')][_0x005d('0x3e')]===_0x005d('0x82')&&_0x456b80[_0x005d('0x59')][_0x005d('0x83')]){if(_0x456b80[_0x005d('0x59')][_0x005d('0x83')][_0x005d('0x45')]===0x0)return;if(_0x456b80[_0x005d('0x59')][_0x005d('0x83')][0x0][_0x005d('0x84')]!=='read')return;return db['WhatsappMessage'][_0x005d('0x31')]({'read':!![],'readAt':_0x456b80[_0x005d('0x59')][_0x005d('0x83')][0x0]['timestamp']},{'where':{'messageId':_0x456b80['body'][_0x005d('0x83')][0x0]['message_id']},'individualHooks':!![]})[_0x005d('0x1d')](function(_0x308e39){return _0x2b6aa9[_0x005d('0x26')](0xc8)[_0x005d('0x27')](_0x308e39);});}_0x52dc3b[_0x005d('0x85')]=_[_0x005d('0x86')](_0x33aca3[_0x005d('0x80')],[_0x005d('0x7c')],['asc']);if(_0x52dc3b[_0x005d('0x81')][_0x005d('0x80')]){delete _0x52dc3b[_0x005d('0x81')][_0x005d('0x80')];}return db[_0x005d('0x87')]['describe']()['then'](function(_0xe8954b){if(!_0xe8954b){throw new db[(_0x005d('0x88'))][(_0x005d('0x89'))](_0x005d('0x8a'));}_0x2974b3=_[_0x005d('0x8b')](_[_0x005d('0x56')](_0xe8954b),[_0x005d('0x8c'),_0x005d('0x8d')]);_0x93888c=_[_0x005d('0x8b')](_[_0x005d('0x56')](_0xe8954b),[_0x005d('0x8c'),_0x005d('0x8d'),'CompanyId','ListId']);_0x52dc3b['body']={'mapKey':_0x005d('0x8e')};if(_0x52dc3b['account']&&_0x52dc3b['account'][_0x005d('0x3e')]===_0x005d('0x8f')){_0x52dc3b[_0x005d('0x59')][_0x005d('0x90')]=_0x456b80[_0x005d('0x59')][_0x005d('0x91')]['replace'](_0x005d('0x92'),'');_0x52dc3b[_0x005d('0x59')][_0x005d('0x59')]=_0x456b80[_0x005d('0x59')][_0x005d('0x93')];_0x52dc3b[_0x005d('0x59')]['messageId']=_0x456b80[_0x005d('0x59')][_0x005d('0x94')];}if(_0x52dc3b[_0x005d('0x81')]&&_0x52dc3b[_0x005d('0x81')][_0x005d('0x3e')]===_0x005d('0x82')){_0x52dc3b[_0x005d('0x59')][_0x005d('0x90')]=_0x456b80['body'][_0x005d('0x95')][0x0]['from'];_0x52dc3b[_0x005d('0x59')][_0x005d('0x59')]=_0x456b80[_0x005d('0x59')][_0x005d('0x95')][0x0][_0x005d('0x23')]['body'];_0x52dc3b[_0x005d('0x59')][_0x005d('0x96')]=_0x456b80[_0x005d('0x59')][_0x005d('0x95')][0x0][_0x005d('0x97')];}if(_0x52dc3b[_0x005d('0x59')]['id']){delete _0x52dc3b[_0x005d('0x59')]['id'];}if(_[_0x005d('0x98')](_0x52dc3b['body']['from'])){throw new db[(_0x005d('0x88'))][(_0x005d('0x89'))](_0x005d('0x99'));}if(_[_0x005d('0x98')](_0x52dc3b[_0x005d('0x59')][_0x005d('0x59')])||_0x52dc3b['body'][_0x005d('0x59')]===''){throw new db[(_0x005d('0x88'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x005d('0x98')](_0x52dc3b[_0x005d('0x59')]['mapKey'])){throw new db[(_0x005d('0x88'))][(_0x005d('0x89'))](_0x005d('0x9a')+_0x93888c);}if(!_[_0x005d('0x9b')](_0x93888c,_0x52dc3b[_0x005d('0x59')][_0x005d('0x9c')])){throw new db['Sequelize'][(_0x005d('0x89'))](_0x005d('0x9d')+_0x93888c);}_0xd1fa6[_0x52dc3b[_0x005d('0x59')][_0x005d('0x9c')]]=_0x52dc3b[_0x005d('0x59')][_0x005d('0x90')];return db[_0x005d('0x9e')][_0x005d('0x57')]({'where':{'id':_0x52dc3b[_0x005d('0x81')][_0x005d('0x9f')]},'include':[{'model':db[_0x005d('0x87')],'as':'Contacts','where':_0xd1fa6,'limit':0x1,'order':[[_0x005d('0x8d'),'DESC']]}]});})[_0x005d('0x1d')](handleEntityNotFound(_0x2b6aa9,null))[_0x005d('0x1d')](function(_0x3c90d4){if(_0x3c90d4){_0x52dc3b[_0x005d('0xa0')]=_[_0x005d('0x6d')](_0x3c90d4,[_0x005d('0xa1')]);if(_0x3c90d4[_0x005d('0xa1')][_0x005d('0x45')]){return _0x3c90d4[_0x005d('0xa1')][0x0];}var _0x575b60=_[_0x005d('0x16')](_0x52dc3b[_0x005d('0x59')],{'firstName':_0x52dc3b[_0x005d('0x59')][_0x005d('0x90')],'ListId':_0x3c90d4['id']});_0x575b60[_0x52dc3b[_0x005d('0x59')][_0x005d('0x9c')]]=_0x52dc3b['body'][_0x005d('0x90')];return db[_0x005d('0x87')][_0x005d('0x58')](_0x575b60,{'fields':_0x2974b3,'raw':!![]});}})[_0x005d('0x1d')](handleEntityNotFound(_0x2b6aa9,null))[_0x005d('0x1d')](function(_0x2a63fe){if(_0x2a63fe){_0x52dc3b[_0x005d('0xa2')]=_0x2a63fe;var _0x170f7a={'ContactId':_0x2a63fe['id'],'phone':_0x52dc3b['body'][_0x005d('0x90')],'WhatsappAccountId':_0x456b80['params']['id']};var _0x165d10={'ContactId':_0x2a63fe['id'],'WhatsappAccountId':_0x456b80['params']['id'],'closed':![]};return db[_0x005d('0xa3')]['find']({'where':_0x165d10})[_0x005d('0x1d')](function(_0x598b67){if(_0x598b67){return[_0x598b67,![]];}return db['WhatsappInteraction'][_0x005d('0x58')](_0x170f7a)[_0x005d('0x1d')](function(_0x37d0b2){return[_0x37d0b2,!![]];});});}})[_0x005d('0xa4')](function(_0x28a2e4,_0x3003e8){_0x52dc3b[_0x005d('0xa5')]=_0x28a2e4[_0x005d('0x5c')]({'plain':!![]});_0x52dc3b[_0x005d('0xa5')]['created']=![];if(_0x3003e8){if(_0x52dc3b[_0x005d('0x81')]['autoclose']){_0x52dc3b['applications'][_0x005d('0xa6')]({'id':0x0,'priority':_0x52dc3b[_0x005d('0x85')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x005d('0xa7')});}_0x52dc3b[_0x005d('0xa5')][_0x005d('0xa8')]=!![];}return db[_0x005d('0xa9')][_0x005d('0x58')]({'phone':_0x52dc3b[_0x005d('0x59')][_0x005d('0x90')],'messageId':_0x52dc3b[_0x005d('0x59')]['messageId'],'body':_0x52dc3b[_0x005d('0x59')]['body'],'WhatsappAccountId':_0x456b80[_0x005d('0x54')]['id'],'WhatsappInteractionId':_0x28a2e4['id'],'direction':'in','ContactId':_0x28a2e4[_0x005d('0xaa')],'AttachmentId':_0x52dc3b[_0x005d('0x59')]['AttachmentId']});})[_0x005d('0x1d')](function(_0xd06ec1){_0x52dc3b[_0x005d('0x23')]=_0xd06ec1;if(!_0x52dc3b['interaction'][_0x005d('0xab')])return;return db[_0x005d('0x74')]['find']({'attributes':['id',_0x005d('0x36')],'where':{'id':_0x52dc3b[_0x005d('0xa5')]['UserId']}});})[_0x005d('0x1d')](function(_0x2746f7){if(_0x2746f7){_0x52dc3b['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x005d('0xac'),'appdata':_0x2746f7[_0x005d('0x36')]+','+(_0x52dc3b[_0x005d('0x81')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x52dc3b[_0x005d('0xa5')][_0x005d('0xad')])return;return db[_0x005d('0xae')][_0x005d('0x57')]({'attributes':['id','name'],'where':{'id':_0x52dc3b[_0x005d('0xa5')]['queueId']}});})[_0x005d('0x1d')](function(_0x59abc1){if(_0x59abc1){_0x52dc3b[_0x005d('0x85')][_0x005d('0xaf')]({'id':0x0,'priority':0x1,'app':_0x005d('0xb0'),'appdata':_0x59abc1[_0x005d('0x36')]+','+(_0x52dc3b[_0x005d('0x81')][_0x005d('0xb1')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x005d('0xb2'),_0x005d('0xb3'),_0x52dc3b);})[_0x005d('0x1d')](function(_0x37ada8){if(_0x37ada8){var _0x5b17ca=0xc8;var _0x1c417f=_0x005d('0xb4');logger[_0x005d('0xb5')](_0x005d('0x20'),_0x1c417f,_0x5b17ca,_0x005d('0xb6'));logger[_0x005d('0xb7')](_0x005d('0xb8'),_0x1c417f,_0x5b17ca,_0x005d('0xb6'),JSON['stringify'](_0x37ada8));if(_0x52dc3b['account'][_0x005d('0x3e')]===_0x005d('0x8f')){return _0x2b6aa9['status'](_0x5b17ca)['set'](_0x005d('0xb9'),_0x005d('0xba'))[_0x005d('0x37')](_0x005d('0xbb'));}else{return _0x2b6aa9[_0x005d('0x26')](_0x5b17ca)['json'](_0x37ada8);}}});})[_0x005d('0x53')](handleError(_0x2b6aa9,null));};exports[_0x005d('0x37')]=function(_0x2d995e,_0x41c43f,_0x47651a){var _0x153381,_0x3c6068,_0x45820b;if(_[_0x005d('0x98')](_0x2d995e['body'][_0x005d('0x59')])||_0x2d995e[_0x005d('0x59')][_0x005d('0x59')]===''){throw new db['Sequelize'][(_0x005d('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x005d('0x98')](_0x2d995e[_0x005d('0x59')]['to'])){throw new db[(_0x005d('0x88'))][(_0x005d('0x89'))](_0x005d('0xbc'));}_0x153381=_0x2d995e[_0x005d('0x59')]['to'];return db[_0x005d('0x3b')][_0x005d('0x57')]({'where':{'id':_0x2d995e['params']['id']},'include':[{'model':db[_0x005d('0x9e')],'as':_0x005d('0xbd'),'include':[{'model':db[_0x005d('0x87')],'as':_0x005d('0xa1'),'where':{'mobile':_0x153381},'limit':0x1,'order':[[_0x005d('0x8d'),_0x005d('0xbe')]]}]}]})['then'](handleEntityNotFound(_0x41c43f,null))[_0x005d('0x1d')](function(_0x2a1e6c){if(_0x2a1e6c&&_0x2a1e6c['List']){_0x3c6068=_0x2a1e6c[_0x005d('0x5c')]({'plain':!![]});if(_0x3c6068[_0x005d('0xbd')]&&_0x3c6068['List'][_0x005d('0xa1')][_0x005d('0x45')]){return _0x3c6068[_0x005d('0xbd')]['Contacts'][0x0];}return db[_0x005d('0x87')][_0x005d('0x58')](_['defaults'](_0x2d995e['body'],{'firstName':_0x153381,'mobile':_0x153381,'phone':_0x153381,'ListId':_0x3c6068[_0x005d('0x9f')]}));}})[_0x005d('0x1d')](handleEntityNotFound(_0x41c43f,null))['then'](function(_0xf86dea){if(_0xf86dea){_0x45820b=_0xf86dea;return db[_0x005d('0xa3')]['find']({'where':{'ContactId':_0x45820b['id'],'closed':![],'WhatsappAccountId':_0x3c6068['id']}})['then'](function(_0x1f0e67){if(_0x1f0e67){return[_0x1f0e67,![]];}return db[_0x005d('0xa3')]['create']({'UserId':_0x2d995e['user']['id'],'ContactId':_0x45820b['id'],'WhatsappAccountId':_0x3c6068['id'],'phone':_0x153381,'firstMsgDirection':_0x005d('0xbf'),'Messages':[_['merge'](_0x2d995e[_0x005d('0x59')],{'read':![],'body':_0x2d995e[_0x005d('0x59')]['body'],'phone':_0x153381,'WhatsappAccountId':_0x3c6068['id'],'UserId':_0x2d995e[_0x005d('0xc0')]['id'],'ContactId':_0x45820b['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x005d('0xc1')}]})[_0x005d('0x1d')](function(_0x1a4f99){return[_0x1a4f99,!![]];});});}})[_0x005d('0xa4')](function(_0x16162a,_0x3e4403){if(_0x3e4403){return _0x16162a;}return db['WhatsappMessage'][_0x005d('0x58')](_[_0x005d('0x4d')](_0x2d995e['body'],{'read':![],'body':_0x2d995e[_0x005d('0x59')][_0x005d('0x59')],'phone':_0x153381,'WhatsappAccountId':_0x3c6068['id'],'WhatsappInteractionId':_0x16162a['id'],'UserId':_0x2d995e['user']['id'],'ContactId':_0x45820b['id']}))[_0x005d('0x1d')](function(_0x1ca8b4){_0x16162a[_0x005d('0xc2')][_0x005d('0xc1')]=[];_0x16162a['dataValues'][_0x005d('0xc1')]['push'](_0x1ca8b4[_0x005d('0xc2')]);return _0x16162a;});})[_0x005d('0x1d')](respondWithResult(_0x41c43f,null))[_0x005d('0x53')](handleError(_0x41c43f,null));}; \ No newline at end of file +var _0x3535=['then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','get','WhatsappAccounts','UserProfileResource','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','name','query','keys','filters','intersection','attributes','model','fields','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','rows','params','length','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','destroy','describe','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','stack','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','priority','asc','Applications','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','from\x20is\x20mandatory','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','Contacts','defaults','contact','WhatsappInteraction','interaction','created','push','applications','unmanaged','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','isNil','List','DESC','out','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request'];(function(_0x381d66,_0x4f5b0c){var _0x2ea77b=function(_0x70c383){while(--_0x70c383){_0x381d66['push'](_0x381d66['shift']());}};_0x2ea77b(++_0x4f5b0c);}(_0x3535,0xa7));var _0x5353=function(_0x3f0f73,_0x417270){_0x3f0f73=_0x3f0f73-0x0;var _0x14f2d7=_0x3535[_0x3f0f73];return _0x14f2d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5353('0x0'));var zipdir=require(_0x5353('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5353('0x2'));var moment=require(_0x5353('0x3'));var BPromise=require(_0x5353('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5353('0x5'));var csv=require(_0x5353('0x6'));var ejs=require(_0x5353('0x7'));var fs=require('fs');var fs_extra=require(_0x5353('0x8'));var _=require(_0x5353('0x9'));var squel=require('squel');var crypto=require(_0x5353('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5353('0x6'));var querystring=require(_0x5353('0xb'));var Papa=require(_0x5353('0xc'));var Redis=require('ioredis');var authService=require(_0x5353('0xd'));var qs=require(_0x5353('0xe'));var as=require(_0x5353('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5353('0x10'))(_0x5353('0x11'));var utils=require(_0x5353('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5353('0x13'));var db=require(_0x5353('0x14'))['db'];config[_0x5353('0x15')]=_['defaults'](config[_0x5353('0x15')],{'host':_0x5353('0x16'),'port':0x18eb});var socket=require(_0x5353('0x17'))(new Redis(config[_0x5353('0x15')]));require(_0x5353('0x18'))[_0x5353('0x19')](socket);var jayson=require(_0x5353('0x1a'));var client=jayson[_0x5353('0x1b')][_0x5353('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x1fb51,_0x4ead35,_0x57e963,_0x4b5894){return new BPromise(function(_0x25b7cc,_0x1e7efb){var _0x2bcad7=_0x4b5894||client;return _0x2bcad7[_0x5353('0x1d')](_0x1fb51,_0x57e963)[_0x5353('0x1e')](function(_0x5d2ab6){logger[_0x5353('0x1f')](_0x5353('0x20'),_0x4ead35,_0x5353('0x21'));logger['debug'](_0x5353('0x22'),_0x4ead35,_0x5353('0x21'),JSON[_0x5353('0x23')](_0x5d2ab6));if(_0x5d2ab6['error']){if(_0x5d2ab6[_0x5353('0x24')][_0x5353('0x25')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4ead35,_0x5d2ab6['error']['message']);return _0x1e7efb(_0x5d2ab6[_0x5353('0x24')]['message']);}logger[_0x5353('0x24')](_0x5353('0x20'),_0x4ead35,_0x5d2ab6['error'][_0x5353('0x26')]);return _0x25b7cc(_0x5d2ab6[_0x5353('0x24')][_0x5353('0x26')]);}else{logger[_0x5353('0x1f')](_0x5353('0x20'),_0x4ead35,_0x5353('0x21'));_0x25b7cc(_0x5d2ab6[_0x5353('0x27')][_0x5353('0x26')]);}})[_0x5353('0x28')](function(_0x4a9d4c){logger[_0x5353('0x24')](_0x5353('0x20'),_0x4ead35,_0x4a9d4c);_0x1e7efb(_0x4a9d4c);});});}function respondWithStatusCode(_0xcfe4c5,_0x2fd34b){_0x2fd34b=_0x2fd34b||0xcc;return function(_0x3b6468){if(_0x3b6468){return _0xcfe4c5[_0x5353('0x29')](_0x2fd34b);}return _0xcfe4c5[_0x5353('0x2a')](_0x2fd34b)[_0x5353('0x2b')]();};}function respondWithResult(_0x4cc75a,_0xb154ba){_0xb154ba=_0xb154ba||0xc8;return function(_0x936fee){if(_0x936fee){return _0x4cc75a[_0x5353('0x2a')](_0xb154ba)[_0x5353('0x2c')](_0x936fee);}};}function respondWithFilteredResult(_0x1dff5a,_0x319106){return function(_0xb45f32){if(_0xb45f32){var _0x3a7cc7=typeof _0x319106[_0x5353('0x2d')]===_0x5353('0x2e')&&typeof _0x319106['limit']===_0x5353('0x2e');var _0x3e4fd2=_0xb45f32['count'];var _0x4eeb10=_0x3a7cc7?0x0:_0x319106[_0x5353('0x2d')];var _0x2cb1c2=_0x3a7cc7?_0xb45f32[_0x5353('0x2f')]:_0x319106[_0x5353('0x2d')]+_0x319106['limit'];var _0x4776a4;if(_0x2cb1c2>=_0x3e4fd2){_0x2cb1c2=_0x3e4fd2;_0x4776a4=0xc8;}else{_0x4776a4=0xce;}_0x1dff5a[_0x5353('0x2a')](_0x4776a4);return _0x1dff5a[_0x5353('0x30')](_0x5353('0x31'),_0x4eeb10+'-'+_0x2cb1c2+'/'+_0x3e4fd2)['json'](_0xb45f32);}return null;};}function patchUpdates(_0x3171c){return function(_0x5187e4){try{jsonpatch[_0x5353('0x32')](_0x5187e4,_0x3171c,!![]);}catch(_0x129357){return BPromise['reject'](_0x129357);}return _0x5187e4[_0x5353('0x33')]();};}function saveUpdates(_0x406009,_0x3ab8e6){return function(_0x57db67){if(_0x57db67){return _0x57db67[_0x5353('0x34')](_0x406009)[_0x5353('0x1e')](function(_0x422c62){return _0x422c62;});}return null;};}function removeEntity(_0x3d4b6c,_0x141539){return function(_0x1b6cdc){if(_0x1b6cdc){return _0x1b6cdc['destroy']()[_0x5353('0x1e')](function(){var _0x16206f=_0x1b6cdc[_0x5353('0x35')]({'plain':!![]});var _0x4fbf84=_0x5353('0x36');return db[_0x5353('0x37')]['destroy']({'where':{'type':_0x4fbf84,'resourceId':_0x16206f['id']}})['then'](function(){return _0x1b6cdc;});})[_0x5353('0x1e')](function(){_0x3d4b6c[_0x5353('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x193ee6,_0x13ce84){return function(_0x12809d){if(!_0x12809d){_0x193ee6[_0x5353('0x29')](0x194);}return _0x12809d;};}function handleError(_0x5f14d0,_0xb327cc){_0xb327cc=_0xb327cc||0x1f4;return function(_0x43c99e){logger[_0x5353('0x24')](_0x43c99e['stack']);if(_0x43c99e['name']){delete _0x43c99e['name'];}_0x5f14d0['status'](_0xb327cc)[_0x5353('0x38')](_0x43c99e);};}exports[_0x5353('0x39')]=function(_0x2db9f7,_0x11767e){var _0x1a1d94={'include':[{'model':db[_0x5353('0x3a')],'as':_0x5353('0x3b')}]},_0x28df16={},_0x15acc9={'count':0x0,'rows':[]};var _0x2e8a63=_[_0x5353('0x3c')](db[_0x5353('0x3d')][_0x5353('0x3e')],function(_0x304f9a){return{'name':_0x304f9a[_0x5353('0x3f')],'type':_0x304f9a[_0x5353('0x40')]['key']};});_0x28df16['model']=_[_0x5353('0x3c')](_0x2e8a63,_0x5353('0x41'));_0x28df16[_0x5353('0x42')]=_[_0x5353('0x43')](_0x2db9f7[_0x5353('0x42')]);_0x28df16[_0x5353('0x44')]=_[_0x5353('0x45')](_0x28df16['model'],_0x28df16[_0x5353('0x42')]);_0x1a1d94[_0x5353('0x46')]=_['intersection'](_0x28df16[_0x5353('0x47')],qs[_0x5353('0x48')](_0x2db9f7[_0x5353('0x42')][_0x5353('0x48')]));_0x1a1d94[_0x5353('0x46')]=_0x1a1d94[_0x5353('0x46')]['length']?_0x1a1d94[_0x5353('0x46')]:_0x28df16[_0x5353('0x47')];if(!_0x2db9f7[_0x5353('0x42')]['hasOwnProperty'](_0x5353('0x49'))){_0x1a1d94[_0x5353('0x4a')]=qs[_0x5353('0x4a')](_0x2db9f7[_0x5353('0x42')][_0x5353('0x4a')]);_0x1a1d94[_0x5353('0x2d')]=qs[_0x5353('0x2d')](_0x2db9f7[_0x5353('0x42')]['offset']);}_0x1a1d94[_0x5353('0x4b')]=qs[_0x5353('0x4c')](_0x2db9f7[_0x5353('0x42')][_0x5353('0x4c')]);_0x1a1d94[_0x5353('0x4d')]=qs[_0x5353('0x44')](_[_0x5353('0x4e')](_0x2db9f7['query'],_0x28df16[_0x5353('0x44')]),_0x2e8a63);if(_0x2db9f7[_0x5353('0x42')][_0x5353('0x4f')]){_0x1a1d94[_0x5353('0x4d')]=_[_0x5353('0x50')](_0x1a1d94[_0x5353('0x4d')],{'$or':_[_0x5353('0x3c')](_0x2e8a63,function(_0x17bc35){if(_0x17bc35[_0x5353('0x40')]!=='VIRTUAL'){var _0x25d8b8={};_0x25d8b8[_0x17bc35[_0x5353('0x41')]]={'$like':'%'+_0x2db9f7[_0x5353('0x42')][_0x5353('0x4f')]+'%'};return _0x25d8b8;}})});}_0x1a1d94=_['merge']({},_0x1a1d94,_0x2db9f7['options']);var _0x5e9067={'where':_0x1a1d94[_0x5353('0x4d')]};return db[_0x5353('0x3d')][_0x5353('0x2f')](_0x5e9067)['then'](function(_0x112db0){_0x15acc9[_0x5353('0x2f')]=_0x112db0;if(_0x2db9f7['query'][_0x5353('0x51')]){_0x1a1d94[_0x5353('0x52')]=[{'all':!![]}];}return db[_0x5353('0x3d')]['findAll'](_0x1a1d94);})[_0x5353('0x1e')](function(_0xeaf113){_0x15acc9[_0x5353('0x53')]=_0xeaf113;return _0x15acc9;})[_0x5353('0x1e')](respondWithFilteredResult(_0x11767e,_0x1a1d94))['catch'](handleError(_0x11767e,null));};exports['show']=function(_0x4bbf7d,_0x487942){var _0x3fa46c={'raw':![],'where':{'id':_0x4bbf7d[_0x5353('0x54')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3a89a0={};_0x3a89a0[_0x5353('0x47')]=_[_0x5353('0x43')](db[_0x5353('0x3d')]['rawAttributes']);_0x3a89a0['query']=_['keys'](_0x4bbf7d[_0x5353('0x42')]);_0x3a89a0['filters']=_[_0x5353('0x45')](_0x3a89a0[_0x5353('0x47')],_0x3a89a0[_0x5353('0x42')]);_0x3fa46c[_0x5353('0x46')]=_[_0x5353('0x45')](_0x3a89a0['model'],qs['fields'](_0x4bbf7d[_0x5353('0x42')][_0x5353('0x48')]));_0x3fa46c['attributes']=_0x3fa46c['attributes'][_0x5353('0x55')]?_0x3fa46c[_0x5353('0x46')]:_0x3a89a0['model'];if(_0x4bbf7d[_0x5353('0x42')][_0x5353('0x51')]){_0x3fa46c['include']=[{'all':!![]}];}_0x3fa46c=_['merge']({},_0x3fa46c,_0x4bbf7d[_0x5353('0x56')]);return db[_0x5353('0x3d')][_0x5353('0x57')](_0x3fa46c)['then'](handleEntityNotFound(_0x487942,null))['then'](respondWithResult(_0x487942,null))[_0x5353('0x28')](handleError(_0x487942,null));};exports[_0x5353('0x58')]=function(_0x1767ff,_0x5617a6){return db[_0x5353('0x3d')]['create'](_0x1767ff[_0x5353('0x59')],{})[_0x5353('0x1e')](function(_0xac41f8){var _0x4688a1=_0x1767ff[_0x5353('0x5a')][_0x5353('0x35')]({'plain':!![]});if(!_0x4688a1)throw new Error(_0x5353('0x5b'));if(_0x4688a1[_0x5353('0x5c')]===_0x5353('0x5a')){var _0x6f7ebe=_0xac41f8['get']({'plain':!![]});var _0x2661e5=_0x5353('0x36');return db[_0x5353('0x5d')][_0x5353('0x57')]({'where':{'name':_0x2661e5,'userProfileId':_0x4688a1[_0x5353('0x5e')]},'raw':!![]})[_0x5353('0x1e')](function(_0x2748cd){if(_0x2748cd&&_0x2748cd[_0x5353('0x5f')]===0x0){return db[_0x5353('0x37')][_0x5353('0x58')]({'name':_0x6f7ebe['name'],'resourceId':_0x6f7ebe['id'],'type':_0x2748cd['name'],'sectionId':_0x2748cd['id']},{})['then'](function(){return _0xac41f8;});}else{return _0xac41f8;}})[_0x5353('0x28')](function(_0x21a3e0){logger[_0x5353('0x24')](_0x5353('0x60'),_0x21a3e0);throw _0x21a3e0;});}return _0xac41f8;})['then'](respondWithResult(_0x5617a6,0xc9))[_0x5353('0x28')](handleError(_0x5617a6,null));};exports[_0x5353('0x34')]=function(_0x23e7fe,_0x50e0e1){if(_0x23e7fe['body']['id']){delete _0x23e7fe[_0x5353('0x59')]['id'];}return db[_0x5353('0x3d')][_0x5353('0x57')]({'where':{'id':_0x23e7fe[_0x5353('0x54')]['id']},'include':[{'model':db[_0x5353('0x3a')],'as':_0x5353('0x3b')}]})[_0x5353('0x1e')](handleEntityNotFound(_0x50e0e1,null))['then'](saveUpdates(_0x23e7fe[_0x5353('0x59')],null))[_0x5353('0x1e')](respondWithResult(_0x50e0e1,null))[_0x5353('0x28')](handleError(_0x50e0e1,null));};exports[_0x5353('0x61')]=function(_0x1d5b21,_0xda02f9){return db[_0x5353('0x3d')][_0x5353('0x57')]({'where':{'id':_0x1d5b21[_0x5353('0x54')]['id']}})[_0x5353('0x1e')](handleEntityNotFound(_0xda02f9,null))[_0x5353('0x1e')](removeEntity(_0xda02f9,null))['catch'](handleError(_0xda02f9,null));};exports['describe']=function(_0x6c18c1,_0x3b5522){return db[_0x5353('0x3d')][_0x5353('0x62')]()[_0x5353('0x1e')](respondWithResult(_0x3b5522,null))[_0x5353('0x28')](handleError(_0x3b5522,null));};exports['addDisposition']=function(_0x1bd63b,_0x277d9b,_0x7865e7){if(_0x1bd63b[_0x5353('0x59')]['id']){delete _0x1bd63b[_0x5353('0x59')]['id'];}return db[_0x5353('0x3d')][_0x5353('0x57')]({'where':{'id':_0x1bd63b['params']['id']}})[_0x5353('0x1e')](handleEntityNotFound(_0x277d9b,null))[_0x5353('0x1e')](function(_0x3d89b5){if(_0x3d89b5){_0x1bd63b[_0x5353('0x59')][_0x5353('0x63')]=_0x3d89b5['id'];return db[_0x5353('0x64')][_0x5353('0x58')](_0x1bd63b[_0x5353('0x59')]);}})['then'](respondWithResult(_0x277d9b,null))['catch'](handleError(_0x277d9b,null));};exports[_0x5353('0x65')]=function(_0x5e5892,_0x1374cb,_0x4c4424){var _0x506e11={'raw':![],'where':{}};var _0x3c9881={};var _0x47c380={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x5e5892[_0x5353('0x54')]['id']}})['then'](handleEntityNotFound(_0x1374cb,null))[_0x5353('0x1e')](function(_0x707bc9){if(_0x707bc9){_0x3c9881[_0x5353('0x47')]=_[_0x5353('0x43')](db[_0x5353('0x64')][_0x5353('0x3e')]);_0x3c9881[_0x5353('0x42')]=_['keys'](_0x5e5892['query']);_0x3c9881[_0x5353('0x44')]=_[_0x5353('0x45')](_0x3c9881[_0x5353('0x47')],_0x3c9881[_0x5353('0x42')]);_0x506e11[_0x5353('0x46')]=_[_0x5353('0x45')](_0x3c9881[_0x5353('0x47')],qs[_0x5353('0x48')](_0x5e5892['query'][_0x5353('0x48')]));_0x506e11['attributes']=_0x506e11[_0x5353('0x46')][_0x5353('0x55')]?_0x506e11[_0x5353('0x46')]:_0x3c9881[_0x5353('0x47')];if(!_0x5e5892[_0x5353('0x42')][_0x5353('0x66')](_0x5353('0x49'))){_0x506e11[_0x5353('0x4a')]=qs[_0x5353('0x4a')](_0x5e5892[_0x5353('0x42')][_0x5353('0x4a')]);_0x506e11[_0x5353('0x2d')]=qs[_0x5353('0x2d')](_0x5e5892[_0x5353('0x42')][_0x5353('0x2d')]);}_0x506e11['order']=qs[_0x5353('0x4c')](_0x5e5892['query']['sort']);_0x506e11['where']=qs['filters'](_[_0x5353('0x4e')](_0x5e5892[_0x5353('0x42')],_0x3c9881['filters']));_0x506e11[_0x5353('0x4d')][_0x5353('0x63')]=_0x707bc9['id'];if(_0x5e5892[_0x5353('0x42')][_0x5353('0x4f')]){_0x506e11['where']=_['merge'](_0x506e11[_0x5353('0x4d')],{'$or':_[_0x5353('0x3c')](_0x506e11[_0x5353('0x46')],function(_0x215e19){var _0x3d0969={};_0x3d0969[_0x215e19]={'$like':'%'+_0x5e5892['query']['filter']+'%'};return _0x3d0969;})});}_0x506e11=_[_0x5353('0x50')]({},_0x506e11,_0x5e5892[_0x5353('0x56')]);return db[_0x5353('0x64')][_0x5353('0x2f')]({'where':_0x506e11['where']})[_0x5353('0x1e')](function(_0x1b9598){_0x47c380[_0x5353('0x2f')]=_0x1b9598;if(_0x5e5892[_0x5353('0x42')]['includeAll']){_0x506e11[_0x5353('0x52')]=[{'all':!![]}];}return db[_0x5353('0x64')]['findAll'](_0x506e11);})[_0x5353('0x1e')](function(_0x3585a7){_0x47c380['rows']=_0x3585a7;return _0x47c380;});}})[_0x5353('0x1e')](respondWithFilteredResult(_0x1374cb,_0x506e11))[_0x5353('0x28')](handleError(_0x1374cb,null));};exports[_0x5353('0x67')]=function(_0x9a6723,_0x587bef,_0x1cfc81){return db[_0x5353('0x3d')][_0x5353('0x57')]({'where':{'id':_0x9a6723[_0x5353('0x54')]['id']}})[_0x5353('0x1e')](handleEntityNotFound(_0x587bef,null))[_0x5353('0x1e')](function(_0xb8f96c){if(_0xb8f96c){return _0xb8f96c[_0x5353('0x67')](_0x9a6723['query'][_0x5353('0x68')]);}})[_0x5353('0x1e')](respondWithStatusCode(_0x587bef,null))['catch'](handleError(_0x587bef,null));};exports[_0x5353('0x69')]=function(_0x18329a,_0x40b0e5,_0x561c5e){if(_0x18329a[_0x5353('0x59')]['id']){delete _0x18329a[_0x5353('0x59')]['id'];}return db[_0x5353('0x3d')][_0x5353('0x57')]({'where':{'id':_0x18329a['params']['id']}})[_0x5353('0x1e')](handleEntityNotFound(_0x40b0e5,null))[_0x5353('0x1e')](function(_0x48cf46){if(_0x48cf46){_0x18329a[_0x5353('0x59')][_0x5353('0x63')]=_0x48cf46['id'];return db[_0x5353('0x6a')][_0x5353('0x58')](_0x18329a[_0x5353('0x59')]);}})[_0x5353('0x1e')](respondWithResult(_0x40b0e5,null))['catch'](handleError(_0x40b0e5,null));};exports[_0x5353('0x6b')]=function(_0xbc9a74,_0x472af6,_0x54dafa){var _0x235589={'raw':![],'where':{}};var _0x289178={};var _0x413887={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x5353('0x6c')]({'where':{'id':_0xbc9a74[_0x5353('0x54')]['id']}})[_0x5353('0x1e')](handleEntityNotFound(_0x472af6,null))[_0x5353('0x1e')](function(_0x409337){if(_0x409337){_0x289178['model']=_['keys'](db['CannedAnswer'][_0x5353('0x3e')]);_0x289178[_0x5353('0x42')]=_[_0x5353('0x43')](_0xbc9a74[_0x5353('0x42')]);_0x289178[_0x5353('0x44')]=_['intersection'](_0x289178[_0x5353('0x47')],_0x289178[_0x5353('0x42')]);_0x235589[_0x5353('0x46')]=_[_0x5353('0x45')](_0x289178[_0x5353('0x47')],qs[_0x5353('0x48')](_0xbc9a74[_0x5353('0x42')][_0x5353('0x48')]));_0x235589[_0x5353('0x46')]=_0x235589[_0x5353('0x46')][_0x5353('0x55')]?_0x235589[_0x5353('0x46')]:_0x289178[_0x5353('0x47')];if(!_0xbc9a74[_0x5353('0x42')]['hasOwnProperty'](_0x5353('0x49'))){_0x235589[_0x5353('0x4a')]=qs[_0x5353('0x4a')](_0xbc9a74[_0x5353('0x42')][_0x5353('0x4a')]);_0x235589[_0x5353('0x2d')]=qs[_0x5353('0x2d')](_0xbc9a74[_0x5353('0x42')][_0x5353('0x2d')]);}_0x235589[_0x5353('0x4b')]=qs[_0x5353('0x4c')](_0xbc9a74[_0x5353('0x42')][_0x5353('0x4c')]);_0x235589['where']=qs[_0x5353('0x44')](_[_0x5353('0x4e')](_0xbc9a74['query'],_0x289178[_0x5353('0x44')]));_0x235589['where'][_0x5353('0x63')]=_0x409337['id'];if(_0xbc9a74['query'][_0x5353('0x4f')]){_0x235589[_0x5353('0x4d')]=_['merge'](_0x235589[_0x5353('0x4d')],{'$or':_[_0x5353('0x3c')](_0x235589['attributes'],function(_0x534644){var _0x31c8a4={};_0x31c8a4[_0x534644]={'$like':'%'+_0xbc9a74['query'][_0x5353('0x4f')]+'%'};return _0x31c8a4;})});}_0x235589=_[_0x5353('0x50')]({},_0x235589,_0xbc9a74[_0x5353('0x56')]);return db[_0x5353('0x6a')][_0x5353('0x2f')]({'where':_0x235589[_0x5353('0x4d')]})['then'](function(_0x2878c5){_0x413887['count']=_0x2878c5;if(_0xbc9a74[_0x5353('0x42')]['includeAll']){_0x235589[_0x5353('0x52')]=[{'all':!![]}];}return db[_0x5353('0x6a')]['findAll'](_0x235589);})['then'](function(_0x307e27){_0x413887[_0x5353('0x53')]=_0x307e27;return _0x413887;});}})[_0x5353('0x1e')](respondWithFilteredResult(_0x472af6,_0x235589))['catch'](handleError(_0x472af6,null));};exports[_0x5353('0x6d')]=function(_0x4ae0cc,_0x5e95fd,_0x5486a5){return db[_0x5353('0x3d')][_0x5353('0x57')]({'where':{'id':_0x4ae0cc[_0x5353('0x54')]['id']}})['then'](handleEntityNotFound(_0x5e95fd,null))[_0x5353('0x1e')](function(_0x47cab8){if(_0x47cab8){return _0x47cab8['removeAnswers'](_0x4ae0cc[_0x5353('0x42')][_0x5353('0x68')]);}})[_0x5353('0x1e')](respondWithStatusCode(_0x5e95fd,null))[_0x5353('0x28')](handleError(_0x5e95fd,null));};exports['addAgents']=function(_0x235c7f,_0x417629,_0x353396){return db['WhatsappAccount'][_0x5353('0x57')]({'where':{'id':_0x235c7f['params']['id']}})['then'](handleEntityNotFound(_0x417629,null))[_0x5353('0x1e')](function(_0xd7a6e4){if(_0xd7a6e4){return _0xd7a6e4[_0x5353('0x6e')](_0x235c7f[_0x5353('0x59')][_0x5353('0x68')],_[_0x5353('0x6f')](_0x235c7f['body'],['ids','id'])||{})[_0x5353('0x70')](function(_0x395efb){for(var _0xbf641b=0x0;_0xbf641b<_0x235c7f['body'][_0x5353('0x68')]['length'];_0xbf641b+=0x1){socket[_0x5353('0x71')](_0x5353('0x72'),{'UserId':Number(_0x235c7f['body']['ids'][_0xbf641b]),'WhatsappAccountId':Number(_0x235c7f['params']['id'])});}return _0x395efb;});}})[_0x5353('0x1e')](respondWithResult(_0x417629,null))['catch'](handleError(_0x417629,null));};exports[_0x5353('0x73')]=function(_0x101dcd,_0x48fb5d,_0x40b2f7){return db['WhatsappAccount'][_0x5353('0x57')]({'where':{'id':_0x101dcd[_0x5353('0x54')]['id']}})['then'](handleEntityNotFound(_0x48fb5d,null))[_0x5353('0x1e')](function(_0x22fabb){if(_0x22fabb){return _0x22fabb[_0x5353('0x73')](_0x101dcd[_0x5353('0x42')][_0x5353('0x68')])['then'](function(){if(_[_0x5353('0x74')](_0x101dcd[_0x5353('0x42')][_0x5353('0x68')])){for(var _0x56987e=0x0;_0x56987e<_0x101dcd[_0x5353('0x42')]['ids'][_0x5353('0x55')];_0x56987e+=0x1){socket[_0x5353('0x71')](_0x5353('0x75'),{'UserId':Number(_0x101dcd[_0x5353('0x42')][_0x5353('0x68')][_0x56987e]),'WhatsappAccountId':Number(_0x101dcd[_0x5353('0x54')]['id'])});}}else{socket[_0x5353('0x71')](_0x5353('0x75'),{'UserId':Number(_0x101dcd[_0x5353('0x42')][_0x5353('0x68')]),'WhatsappAccountId':Number(_0x101dcd[_0x5353('0x54')]['id'])});}});}})[_0x5353('0x1e')](respondWithStatusCode(_0x48fb5d,null))['catch'](handleError(_0x48fb5d,null));};exports[_0x5353('0x76')]=function(_0x3a8815,_0x1be131,_0x4ea4fd){var _0x50d604={};var _0x25493f={};var _0x336390;var _0x13f8c6;return db[_0x5353('0x3d')][_0x5353('0x6c')]({'where':{'id':_0x3a8815['params']['id']}})[_0x5353('0x1e')](handleEntityNotFound(_0x1be131,null))['then'](function(_0x3f9112){if(_0x3f9112){_0x336390=_0x3f9112;_0x25493f[_0x5353('0x47')]=_[_0x5353('0x43')](db[_0x5353('0x77')][_0x5353('0x3e')]);_0x25493f['query']=_[_0x5353('0x43')](_0x3a8815[_0x5353('0x42')]);_0x25493f[_0x5353('0x44')]=_['intersection'](_0x25493f['model'],_0x25493f['query']);_0x50d604[_0x5353('0x46')]=_[_0x5353('0x45')](_0x25493f['model'],qs[_0x5353('0x48')](_0x3a8815[_0x5353('0x42')]['fields']));_0x50d604['attributes']=_0x50d604[_0x5353('0x46')][_0x5353('0x55')]?_0x50d604[_0x5353('0x46')]:_0x25493f['model'];_0x50d604[_0x5353('0x4b')]=qs[_0x5353('0x4c')](_0x3a8815[_0x5353('0x42')][_0x5353('0x4c')]);_0x50d604[_0x5353('0x4d')]=qs[_0x5353('0x44')](_[_0x5353('0x4e')](_0x3a8815[_0x5353('0x42')],_0x25493f[_0x5353('0x44')]));if(_0x3a8815[_0x5353('0x42')]['filter']){_0x50d604[_0x5353('0x4d')]=_[_0x5353('0x50')](_0x50d604[_0x5353('0x4d')],{'$or':_['map'](_0x50d604[_0x5353('0x46')],function(_0x398146){var _0x23f29a={};_0x23f29a[_0x398146]={'$like':'%'+_0x3a8815[_0x5353('0x42')][_0x5353('0x4f')]+'%'};return _0x23f29a;})});}_0x50d604=_['merge']({},_0x50d604,_0x3a8815['options']);return _0x336390['getAgents'](_0x50d604);}})[_0x5353('0x1e')](function(_0x532ac9){if(_0x532ac9){_0x13f8c6=_0x532ac9[_0x5353('0x55')];if(!_0x3a8815[_0x5353('0x42')]['hasOwnProperty'](_0x5353('0x49'))){_0x50d604[_0x5353('0x4a')]=qs['limit'](_0x3a8815[_0x5353('0x42')]['limit']);_0x50d604['offset']=qs[_0x5353('0x2d')](_0x3a8815['query'][_0x5353('0x2d')]);}return _0x336390[_0x5353('0x76')](_0x50d604);}})[_0x5353('0x1e')](function(_0x92c76b){if(_0x92c76b){return _0x92c76b?{'count':_0x13f8c6,'rows':_0x92c76b}:null;}})[_0x5353('0x1e')](respondWithResult(_0x1be131,null))['catch'](handleError(_0x1be131,null));};exports['addApplications']=function(_0x17e7b3,_0x4cae53){var _0x50c481=_0x17e7b3[_0x5353('0x54')]['id'];var _0x4ebd03=_0x17e7b3[_0x5353('0x59')];var _0x3d3851=0xc8;var _0x16568d=null;return db[_0x5353('0x78')][_0x5353('0x79')]({'isolationLevel':db[_0x5353('0x78')]['Transaction']['ISOLATION_LEVELS'][_0x5353('0x7a')]},function(_0xca853e){return db[_0x5353('0x3d')][_0x5353('0x6c')]({'where':{'id':_0x50c481},'transaction':_0xca853e})[_0x5353('0x1e')](function(_0x55c46d){if(_0x55c46d){return db[_0x5353('0x7b')][_0x5353('0x61')]({'where':{'WhatsappAccountId':_0x50c481},'transaction':_0xca853e})[_0x5353('0x1e')](function(){var _0x58033d=_[_0x5353('0x3c')](_0x4ebd03,function(_0x528b2f){_0x528b2f[_0x5353('0x63')]=_0x50c481;return _0x528b2f;});return db[_0x5353('0x7b')][_0x5353('0x7c')](_0x58033d,{'transaction':_0xca853e});});}else{_0x3d3851=0x194;_0x16568d=[];}});})[_0x5353('0x1e')](function(){if(_0x3d3851!==0x194){return db[_0x5353('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x50c481},'order':'priority'})['then'](function(_0x53dc84){_0x16568d=_0x53dc84;});}})[_0x5353('0x28')](function(_0x53b782){_0x3d3851=0x1f4;logger[_0x5353('0x24')](_0x53b782[_0x5353('0x7d')]);if(_0x53b782[_0x5353('0x41')]){delete _0x53b782[_0x5353('0x41')];}_0x16568d=_0x53b782;})[_0x5353('0x7e')](function(){if(_0x16568d===null){_0x4cae53[_0x5353('0x29')](_0x3d3851);}else{if(_0x3d3851===0x1f4){_0x4cae53[_0x5353('0x2a')](_0x3d3851)[_0x5353('0x38')](_0x16568d);}else{_0x4cae53[_0x5353('0x2a')](_0x3d3851)[_0x5353('0x2c')](_0x16568d);}}});};exports[_0x5353('0x7f')]=function(_0x1ab8fc,_0x21bb43,_0x43b5c6){var _0x5cbd8c={};var _0x7ec483={};var _0x18508d;var _0x460c36;return db[_0x5353('0x3d')][_0x5353('0x6c')]({'where':{'id':_0x1ab8fc[_0x5353('0x54')]['id']}})[_0x5353('0x1e')](handleEntityNotFound(_0x21bb43,null))['then'](function(_0xe92d89){if(_0xe92d89){_0x18508d=_0xe92d89;_0x7ec483['model']=_[_0x5353('0x43')](db[_0x5353('0x7b')][_0x5353('0x3e')]);_0x7ec483[_0x5353('0x42')]=_[_0x5353('0x43')](_0x1ab8fc[_0x5353('0x42')]);_0x7ec483['filters']=_[_0x5353('0x45')](_0x7ec483['model'],_0x7ec483[_0x5353('0x42')]);_0x5cbd8c['attributes']=_[_0x5353('0x45')](_0x7ec483[_0x5353('0x47')],qs['fields'](_0x1ab8fc[_0x5353('0x42')][_0x5353('0x48')]));_0x5cbd8c['attributes']=_0x5cbd8c['attributes']['length']?_0x5cbd8c[_0x5353('0x46')]:_0x7ec483['model'];_0x5cbd8c[_0x5353('0x4b')]=qs[_0x5353('0x4c')](_0x1ab8fc[_0x5353('0x42')][_0x5353('0x4c')]);_0x5cbd8c[_0x5353('0x4d')]=qs[_0x5353('0x44')](_[_0x5353('0x4e')](_0x1ab8fc[_0x5353('0x42')],_0x7ec483[_0x5353('0x44')]));if(_0x1ab8fc['query'][_0x5353('0x4f')]){_0x5cbd8c[_0x5353('0x4d')]=_[_0x5353('0x50')](_0x5cbd8c['where'],{'$or':_[_0x5353('0x3c')](_0x5cbd8c[_0x5353('0x46')],function(_0xd74da2){var _0x1d2de9={};_0x1d2de9[_0xd74da2]={'$like':'%'+_0x1ab8fc['query'][_0x5353('0x4f')]+'%'};return _0x1d2de9;})});}_0x5cbd8c=_['merge']({},_0x5cbd8c,_0x1ab8fc[_0x5353('0x56')]);return _0x18508d['getApplications'](_0x5cbd8c);}})['then'](function(_0x27c5ff){if(_0x27c5ff){_0x460c36=_0x27c5ff['length'];if(!_0x1ab8fc[_0x5353('0x42')][_0x5353('0x66')](_0x5353('0x49'))){_0x5cbd8c[_0x5353('0x4a')]=qs[_0x5353('0x4a')](_0x1ab8fc['query'][_0x5353('0x4a')]);_0x5cbd8c['offset']=qs[_0x5353('0x2d')](_0x1ab8fc['query']['offset']);}return _0x18508d['getApplications'](_0x5cbd8c);}})[_0x5353('0x1e')](function(_0x421a4b){if(_0x421a4b){return _0x421a4b?{'count':_0x460c36,'rows':_0x421a4b}:null;}})[_0x5353('0x1e')](respondWithResult(_0x21bb43,null))[_0x5353('0x28')](handleError(_0x21bb43,null));};exports[_0x5353('0x80')]=function(_0x1572c9,_0x1a5532,_0x1e3a34){var _0xe3b651={'channel':_0x5353('0x81')};var _0x3b8202=[];var _0x5bfce5=[];var _0x479409={};return db['WhatsappAccount'][_0x5353('0x57')]({'where':{'id':_0x1572c9['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x5353('0x1e')](handleEntityNotFound(_0x1a5532,null))[_0x5353('0x1e')](function(_0x5362de){_0xe3b651['account']=_0x5362de;if(_0xe3b651[_0x5353('0x82')]&&_0xe3b651[_0x5353('0x82')]['type']===_0x5353('0x83')&&_0x1572c9[_0x5353('0x59')][_0x5353('0x84')]){if(_0x1572c9[_0x5353('0x59')][_0x5353('0x84')][_0x5353('0x55')]===0x0)return;if(_0x1572c9[_0x5353('0x59')][_0x5353('0x84')][0x0][_0x5353('0x85')]!==_0x5353('0x86'))return;return db[_0x5353('0x87')][_0x5353('0x34')]({'read':!![],'readAt':_0x1572c9[_0x5353('0x59')]['statuses'][0x0][_0x5353('0x88')]},{'where':{'messageId':_0x1572c9['body'][_0x5353('0x84')][0x0][_0x5353('0x89')]},'individualHooks':!![]})[_0x5353('0x1e')](function(_0x84cdbf){return _0x1a5532[_0x5353('0x2a')](0xc8)['json'](_0x84cdbf);});}_0xe3b651['applications']=_[_0x5353('0x8a')](_0x5362de['Applications'],[_0x5353('0x8b')],[_0x5353('0x8c')]);if(_0xe3b651[_0x5353('0x82')][_0x5353('0x8d')]){delete _0xe3b651['account'][_0x5353('0x8d')];}return db[_0x5353('0x8e')][_0x5353('0x62')]()[_0x5353('0x1e')](function(_0x5b126a){if(!_0x5b126a){throw new db[(_0x5353('0x8f'))]['ValidationError']('no\x20available\x20attributes');}_0x3b8202=_[_0x5353('0x90')](_['keys'](_0x5b126a),[_0x5353('0x91'),_0x5353('0x92')]);_0x5bfce5=_[_0x5353('0x90')](_[_0x5353('0x43')](_0x5b126a),[_0x5353('0x91'),'updatedAt',_0x5353('0x93'),_0x5353('0x94')]);_0xe3b651[_0x5353('0x59')]={'mapKey':_0x5353('0x95')};if(_0xe3b651[_0x5353('0x82')]&&_0xe3b651['account'][_0x5353('0x40')]===_0x5353('0x96')){_0xe3b651['body'][_0x5353('0x97')]=_0x1572c9[_0x5353('0x59')][_0x5353('0x98')][_0x5353('0x99')](_0x5353('0x9a'),'');_0xe3b651['body'][_0x5353('0x59')]=_0x1572c9[_0x5353('0x59')][_0x5353('0x9b')];_0xe3b651[_0x5353('0x59')][_0x5353('0x9c')]=_0x1572c9[_0x5353('0x59')][_0x5353('0x9d')];}if(_0xe3b651[_0x5353('0x82')]&&_0xe3b651[_0x5353('0x82')][_0x5353('0x40')]===_0x5353('0x83')){_0xe3b651[_0x5353('0x59')][_0x5353('0x97')]=_0x1572c9['body']['notifications'][0x0][_0x5353('0x97')];_0xe3b651[_0x5353('0x59')][_0x5353('0x59')]=_0x1572c9['body'][_0x5353('0x9e')][0x0]['message'][_0x5353('0x59')];_0xe3b651['body'][_0x5353('0x9c')]=_0x1572c9[_0x5353('0x59')][_0x5353('0x9e')][0x0]['message_id'];}if(_0xe3b651['body']['id']){delete _0xe3b651['body']['id'];}if(_['isNil'](_0xe3b651[_0x5353('0x59')][_0x5353('0x97')])){throw new db[(_0x5353('0x8f'))]['ValidationError'](_0x5353('0x9f'));}if(_['isNil'](_0xe3b651[_0x5353('0x59')]['body'])||_0xe3b651[_0x5353('0x59')][_0x5353('0x59')]===''){throw new db['Sequelize'][(_0x5353('0xa0'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xe3b651[_0x5353('0x59')]['mapKey'])){throw new db[(_0x5353('0x8f'))][(_0x5353('0xa0'))](_0x5353('0xa1')+_0x5bfce5);}if(!_['includes'](_0x5bfce5,_0xe3b651[_0x5353('0x59')][_0x5353('0xa2')])){throw new db[(_0x5353('0x8f'))][(_0x5353('0xa0'))](_0x5353('0xa3')+_0x5bfce5);}_0x479409[_0xe3b651[_0x5353('0x59')][_0x5353('0xa2')]]=_0xe3b651[_0x5353('0x59')][_0x5353('0x97')];return db[_0x5353('0xa4')][_0x5353('0x57')]({'where':{'id':_0xe3b651[_0x5353('0x82')][_0x5353('0x94')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x479409,'limit':0x1,'order':[[_0x5353('0x92'),'DESC']]}]});})[_0x5353('0x1e')](handleEntityNotFound(_0x1a5532,null))['then'](function(_0x2da00c){if(_0x2da00c){_0xe3b651[_0x5353('0xa5')]=_['omit'](_0x2da00c,[_0x5353('0xa6')]);if(_0x2da00c[_0x5353('0xa6')]['length']){return _0x2da00c[_0x5353('0xa6')][0x0];}var _0x15c824=_[_0x5353('0xa7')](_0xe3b651[_0x5353('0x59')],{'firstName':_0xe3b651['body'][_0x5353('0x97')],'ListId':_0x2da00c['id']});_0x15c824[_0xe3b651[_0x5353('0x59')]['mapKey']]=_0xe3b651[_0x5353('0x59')][_0x5353('0x97')];return db['CmContact']['create'](_0x15c824,{'fields':_0x3b8202,'raw':!![]});}})[_0x5353('0x1e')](handleEntityNotFound(_0x1a5532,null))[_0x5353('0x1e')](function(_0x558ed5){if(_0x558ed5){_0xe3b651[_0x5353('0xa8')]=_0x558ed5;var _0x5e5dc5={'ContactId':_0x558ed5['id'],'phone':_0xe3b651[_0x5353('0x59')]['from'],'WhatsappAccountId':_0x1572c9[_0x5353('0x54')]['id']};var _0x513d28={'ContactId':_0x558ed5['id'],'WhatsappAccountId':_0x1572c9[_0x5353('0x54')]['id'],'closed':![]};return db[_0x5353('0xa9')][_0x5353('0x57')]({'where':_0x513d28})[_0x5353('0x1e')](function(_0x10def4){if(_0x10def4){return[_0x10def4,![]];}return db[_0x5353('0xa9')]['create'](_0x5e5dc5)[_0x5353('0x1e')](function(_0xa4446f){return[_0xa4446f,!![]];});});}})['spread'](function(_0x137f8d,_0x5ea932){_0xe3b651['interaction']=_0x137f8d[_0x5353('0x35')]({'plain':!![]});_0xe3b651[_0x5353('0xaa')][_0x5353('0xab')]=![];if(_0x5ea932){if(_0xe3b651[_0x5353('0x82')]['autoclose']){_0xe3b651['applications'][_0x5353('0xac')]({'id':0x0,'priority':_0xe3b651[_0x5353('0xad')]['length']+0x1,'app':'close','appdata':_0x5353('0xae'),'interval':_0x5353('0xaf')});}_0xe3b651[_0x5353('0xaa')][_0x5353('0xab')]=!![];}return db[_0x5353('0x87')][_0x5353('0x58')]({'phone':_0xe3b651[_0x5353('0x59')][_0x5353('0x97')],'messageId':_0xe3b651['body'][_0x5353('0x9c')],'body':_0xe3b651[_0x5353('0x59')][_0x5353('0x59')],'WhatsappAccountId':_0x1572c9[_0x5353('0x54')]['id'],'WhatsappInteractionId':_0x137f8d['id'],'direction':'in','ContactId':_0x137f8d['ContactId'],'AttachmentId':_0xe3b651[_0x5353('0x59')]['AttachmentId']});})[_0x5353('0x1e')](function(_0x3f7512){_0xe3b651[_0x5353('0x26')]=_0x3f7512;if(!_0xe3b651[_0x5353('0xaa')]['UserId'])return;return db[_0x5353('0x77')][_0x5353('0x57')]({'attributes':['id',_0x5353('0x41')],'where':{'id':_0xe3b651[_0x5353('0xaa')][_0x5353('0xb0')]}});})[_0x5353('0x1e')](function(_0x2be760){if(_0x2be760){_0xe3b651[_0x5353('0xad')][_0x5353('0xb1')]({'id':0x0,'priority':0x0,'app':_0x5353('0xb2'),'appdata':_0x2be760[_0x5353('0x41')]+','+(_0xe3b651[_0x5353('0x82')][_0x5353('0xb3')]||0xa),'interval':_0x5353('0xaf')});}if(!_0xe3b651[_0x5353('0xaa')][_0x5353('0xb4')])return;return db[_0x5353('0xb5')]['find']({'attributes':['id',_0x5353('0x41')],'where':{'id':_0xe3b651['interaction']['queueId']}});})[_0x5353('0x1e')](function(_0x3472fc){if(_0x3472fc){_0xe3b651[_0x5353('0xad')][_0x5353('0xb1')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3472fc[_0x5353('0x41')]+','+(_0xe3b651['account'][_0x5353('0xb6')]||0x12c),'interval':_0x5353('0xaf')});}return respondWithRpcPromise(_0x5353('0xb7'),_0x5353('0xb8'),_0xe3b651);})[_0x5353('0x1e')](function(_0x9fdabc){if(_0x9fdabc){var _0x12acff=0xc8;var _0x2dcf43=_0x5353('0xb9');logger[_0x5353('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2dcf43,_0x12acff,_0x5353('0xba'));logger[_0x5353('0xbb')](_0x5353('0xbc'),_0x2dcf43,_0x12acff,_0x5353('0xba'),JSON[_0x5353('0x23')](_0x9fdabc));if(_0xe3b651[_0x5353('0x82')][_0x5353('0x40')]==='twilio'){return _0x1a5532['status'](_0x12acff)[_0x5353('0x30')](_0x5353('0xbd'),_0x5353('0xbe'))[_0x5353('0x38')](_0x5353('0xbf'));}else{return _0x1a5532[_0x5353('0x2a')](_0x12acff)[_0x5353('0x2c')](_0x9fdabc);}}});})['catch'](handleError(_0x1a5532,null));};exports['send']=function(_0x41a2ea,_0x2e2dde,_0x3ed3fd){var _0x4e9b90,_0x2b6559,_0xeba15c;if(_['isNil'](_0x41a2ea[_0x5353('0x59')]['body'])||_0x41a2ea[_0x5353('0x59')][_0x5353('0x59')]===''){throw new db[(_0x5353('0x8f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5353('0xc0')](_0x41a2ea[_0x5353('0x59')]['to'])){throw new db[(_0x5353('0x8f'))]['ValidationError']('to\x20is\x20mandatory');}_0x4e9b90=_0x41a2ea[_0x5353('0x59')]['to'];return db[_0x5353('0x3d')][_0x5353('0x57')]({'where':{'id':_0x41a2ea[_0x5353('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x5353('0xc1'),'include':[{'model':db[_0x5353('0x8e')],'as':'Contacts','where':{'mobile':_0x4e9b90},'limit':0x1,'order':[['updatedAt',_0x5353('0xc2')]]}]}]})[_0x5353('0x1e')](handleEntityNotFound(_0x2e2dde,null))[_0x5353('0x1e')](function(_0x36663b){if(_0x36663b&&_0x36663b[_0x5353('0xc1')]){_0x2b6559=_0x36663b[_0x5353('0x35')]({'plain':!![]});if(_0x2b6559[_0x5353('0xc1')]&&_0x2b6559[_0x5353('0xc1')][_0x5353('0xa6')][_0x5353('0x55')]){return _0x2b6559[_0x5353('0xc1')][_0x5353('0xa6')][0x0];}return db[_0x5353('0x8e')][_0x5353('0x58')](_['defaults'](_0x41a2ea[_0x5353('0x59')],{'firstName':_0x4e9b90,'mobile':_0x4e9b90,'phone':_0x4e9b90,'ListId':_0x2b6559[_0x5353('0x94')]}));}})[_0x5353('0x1e')](handleEntityNotFound(_0x2e2dde,null))[_0x5353('0x1e')](function(_0x4a5487){if(_0x4a5487){_0xeba15c=_0x4a5487;return db[_0x5353('0xa9')]['find']({'where':{'ContactId':_0xeba15c['id'],'closed':![],'WhatsappAccountId':_0x2b6559['id']}})[_0x5353('0x1e')](function(_0x402960){if(_0x402960){return[_0x402960,![]];}return db['WhatsappInteraction'][_0x5353('0x58')]({'UserId':_0x41a2ea['user']['id'],'ContactId':_0xeba15c['id'],'WhatsappAccountId':_0x2b6559['id'],'phone':_0x4e9b90,'firstMsgDirection':_0x5353('0xc3'),'Messages':[_['merge'](_0x41a2ea[_0x5353('0x59')],{'read':![],'body':_0x41a2ea[_0x5353('0x59')][_0x5353('0x59')],'phone':_0x4e9b90,'WhatsappAccountId':_0x2b6559['id'],'UserId':_0x41a2ea[_0x5353('0x5a')]['id'],'ContactId':_0xeba15c['id']})]},{'include':[{'model':db[_0x5353('0x87')],'as':'Messages'}]})[_0x5353('0x1e')](function(_0x17a3fd){return[_0x17a3fd,!![]];});});}})[_0x5353('0x70')](function(_0x1886f1,_0x5ab632){if(_0x5ab632){return _0x1886f1;}return db['WhatsappMessage'][_0x5353('0x58')](_['merge'](_0x41a2ea[_0x5353('0x59')],{'read':![],'body':_0x41a2ea['body'][_0x5353('0x59')],'phone':_0x4e9b90,'WhatsappAccountId':_0x2b6559['id'],'WhatsappInteractionId':_0x1886f1['id'],'UserId':_0x41a2ea[_0x5353('0x5a')]['id'],'ContactId':_0xeba15c['id']}))[_0x5353('0x1e')](function(_0x29e19d){_0x1886f1[_0x5353('0xc4')]['Messages']=[];_0x1886f1[_0x5353('0xc4')]['Messages']['push'](_0x29e19d[_0x5353('0xc4')]);return _0x1886f1;});})[_0x5353('0x1e')](respondWithResult(_0x2e2dde,null))['catch'](handleError(_0x2e2dde,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 5856468..64934a4 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 _0x8b2b=['../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x2c895a,_0xe949fd){var _0x2b9c0e=function(_0x43b9d0){while(--_0x43b9d0){_0x2c895a['push'](_0x2c895a['shift']());}};_0x2b9c0e(++_0xe949fd);}(_0x8b2b,0x18b));var _0xb8b2=function(_0x45253a,_0x3dae9e){_0x45253a=_0x45253a-0x0;var _0x1cec98=_0x8b2b[_0x45253a];return _0x1cec98;};'use strict';var EventEmitter=require(_0xb8b2('0x0'));var WhatsappAccount=require(_0xb8b2('0x1'))['db'][_0xb8b2('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb8b2('0x3')](0x0);var events={'afterCreate':_0xb8b2('0x4'),'afterUpdate':'update','afterDestroy':_0xb8b2('0x5')};function emitEvent(_0x4cb8ec){return function(_0x478bdf,_0x2a8c6c,_0x861d06){WhatsappAccountEvents[_0xb8b2('0x6')](_0x4cb8ec+':'+_0x478bdf['id'],_0x478bdf);WhatsappAccountEvents[_0xb8b2('0x6')](_0x4cb8ec,_0x478bdf);_0x861d06(null);};}for(var e in events){if(events[_0xb8b2('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xb8b2('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x948e=['hook','exports','../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x29c493,_0x55f019){var _0x58b033=function(_0x7dcb05){while(--_0x7dcb05){_0x29c493['push'](_0x29c493['shift']());}};_0x58b033(++_0x55f019);}(_0x948e,0x1e8));var _0xe948=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x948e[_0x2b31a8];return _0x1175a5;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xe948('0x0'))['db'][_0xe948('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe948('0x2'),'afterUpdate':_0xe948('0x3'),'afterDestroy':_0xe948('0x4')};function emitEvent(_0x22e620){return function(_0x16bc38,_0x206fba,_0x201395){WhatsappAccountEvents[_0xe948('0x5')](_0x22e620+':'+_0x16bc38['id'],_0x16bc38);WhatsappAccountEvents[_0xe948('0x5')](_0x22e620,_0x16bc38);_0x201395(null);};}for(var e in events){if(events[_0xe948('0x6')](e)){var event=events[e];WhatsappAccount[_0xe948('0x7')](e,emitEvent(event));}}module[_0xe948('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 0aef678..21c2d2f 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 _0x2e93=['path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4ce4ac,_0x53faf4){var _0x5e4413=function(_0x35321f){while(--_0x35321f){_0x4ce4ac['push'](_0x4ce4ac['shift']());}};_0x5e4413(++_0x53faf4);}(_0x2e93,0x132));var _0x32e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x32e9('0x0'));var util=require(_0x32e9('0x1'));var logger=require('../../config/logger')(_0x32e9('0x2'));var moment=require(_0x32e9('0x3'));var BPromise=require(_0x32e9('0x4'));var rp=require(_0x32e9('0x5'));var fs=require('fs');var path=require(_0x32e9('0x6'));var rimraf=require(_0x32e9('0x7'));var config=require(_0x32e9('0x8'));var attributes=require(_0x32e9('0x9'));module['exports']=function(_0x380483,_0x359e6e){return _0x380483[_0x32e9('0xa')](_0x32e9('0xb'),attributes,{'tableName':_0x32e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6eb8=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3f769d,_0xf168b1){var _0x4de2c5=function(_0x4aca5d){while(--_0x4aca5d){_0x3f769d['push'](_0x3f769d['shift']());}};_0x4de2c5(++_0xf168b1);}(_0x6eb8,0xd0));var _0x86eb=function(_0x3dd721,_0x4a6266){_0x3dd721=_0x3dd721-0x0;var _0x2842d5=_0x6eb8[_0x3dd721];return _0x2842d5;};'use strict';var _=require(_0x86eb('0x0'));var util=require(_0x86eb('0x1'));var logger=require(_0x86eb('0x2'))('api');var moment=require('moment');var BPromise=require(_0x86eb('0x3'));var rp=require(_0x86eb('0x4'));var fs=require('fs');var path=require(_0x86eb('0x5'));var rimraf=require(_0x86eb('0x6'));var config=require(_0x86eb('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x86eb('0x8')]=function(_0x480794,_0x22a1cf){return _0x480794[_0x86eb('0x9')](_0x86eb('0xa'),attributes,{'tableName':_0x86eb('0xb'),'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 f72ab6f..e1a10d9 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 _0x1a3f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowWhatsappAccount','WhatsappAccount','options','where','attributes','include','map','model','stringify','lodash','moment','bluebird','randomstring'];(function(_0xb1bba4,_0x283699){var _0x30b67f=function(_0x2307d1){while(--_0x2307d1){_0xb1bba4['push'](_0xb1bba4['shift']());}};_0x30b67f(++_0x283699);}(_0x1a3f,0x68));var _0xf1a3=function(_0x8cdd36,_0x5d0e6b){_0x8cdd36=_0x8cdd36-0x0;var _0x5cfa23=_0x1a3f[_0x8cdd36];return _0x5cfa23;};'use strict';var _=require(_0xf1a3('0x0'));var util=require('util');var moment=require(_0xf1a3('0x1'));var BPromise=require(_0xf1a3('0x2'));var rs=require(_0xf1a3('0x3'));var fs=require('fs');var Redis=require(_0xf1a3('0x4'));var db=require(_0xf1a3('0x5'))['db'];var utils=require(_0xf1a3('0x6'));var logger=require(_0xf1a3('0x7'))(_0xf1a3('0x8'));var config=require('../../config/environment');var jayson=require(_0xf1a3('0x9'));var client=jayson[_0xf1a3('0xa')][_0xf1a3('0xb')]({'port':0x232a});config['redis']=_[_0xf1a3('0xc')](config['redis'],{'host':_0xf1a3('0xd'),'port':0x18eb});var socket=require(_0xf1a3('0xe'))(new Redis(config['redis']));require(_0xf1a3('0xf'))['register'](socket);function respondWithRpcPromise(_0x59a085,_0x200838,_0x22db8){return new BPromise(function(_0x1dba8f,_0x17fb82){return client[_0xf1a3('0x10')](_0x59a085,_0x22db8)[_0xf1a3('0x11')](function(_0x21c8fd){logger[_0xf1a3('0x12')](_0xf1a3('0x13'),_0x200838,_0xf1a3('0x14'));logger[_0xf1a3('0x15')](_0xf1a3('0x16'),_0x200838,_0xf1a3('0x14'),JSON['stringify'](_0x21c8fd));if(_0x21c8fd[_0xf1a3('0x17')]){if(_0x21c8fd[_0xf1a3('0x17')][_0xf1a3('0x18')]===0x1f4){logger[_0xf1a3('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x200838,_0x21c8fd['error'][_0xf1a3('0x19')]);return _0x17fb82(_0x21c8fd[_0xf1a3('0x17')][_0xf1a3('0x19')]);}logger[_0xf1a3('0x17')](_0xf1a3('0x13'),_0x200838,_0x21c8fd[_0xf1a3('0x17')]['message']);return _0x1dba8f(_0x21c8fd[_0xf1a3('0x17')][_0xf1a3('0x19')]);}else{logger[_0xf1a3('0x12')](_0xf1a3('0x13'),_0x200838,'request\x20sent');_0x1dba8f(_0x21c8fd['result'][_0xf1a3('0x19')]);}})[_0xf1a3('0x1a')](function(_0x1234f2){logger[_0xf1a3('0x17')](_0xf1a3('0x13'),_0x200838,_0x1234f2);_0x17fb82(_0x1234f2);});});}exports[_0xf1a3('0x1b')]=function(_0x2c72d4){var _0x5b7e05=this;return new Promise(function(_0xfac46a,_0x5e4c64){return db[_0xf1a3('0x1c')]['find']({'raw':_0x2c72d4['options']?_0x2c72d4[_0xf1a3('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2c72d4['options']?_0x2c72d4[_0xf1a3('0x1d')][_0xf1a3('0x1e')]||null:null,'attributes':_0x2c72d4[_0xf1a3('0x1d')]?_0x2c72d4[_0xf1a3('0x1d')][_0xf1a3('0x1f')]||null:null,'include':_0x2c72d4[_0xf1a3('0x1d')]?_0x2c72d4[_0xf1a3('0x1d')][_0xf1a3('0x20')]?_[_0xf1a3('0x21')](_0x2c72d4[_0xf1a3('0x1d')][_0xf1a3('0x20')],function(_0x3f981d){return{'model':db[_0x3f981d['model']],'as':_0x3f981d['as'],'attributes':_0x3f981d['attributes'],'include':_0x3f981d['include']?_[_0xf1a3('0x21')](_0x3f981d['include'],function(_0x2c2999){return{'model':db[_0x2c2999[_0xf1a3('0x22')]],'as':_0x2c2999['as'],'attributes':_0x2c2999[_0xf1a3('0x1f')],'include':_0x2c2999['include']?_[_0xf1a3('0x21')](_0x2c2999[_0xf1a3('0x20')],function(_0x5979bd){return{'model':db[_0x5979bd['model']],'as':_0x5979bd['as'],'attributes':_0x5979bd[_0xf1a3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf1a3('0x11')](function(_0x3fd2cc){logger['info'](_0xf1a3('0x1b'),_0x2c72d4);logger[_0xf1a3('0x15')](_0xf1a3('0x1b'),_0x2c72d4,JSON[_0xf1a3('0x23')](_0x3fd2cc));_0xfac46a(_0x3fd2cc);})[_0xf1a3('0x1a')](function(_0x517283){logger[_0xf1a3('0x17')](_0xf1a3('0x1b'),_0x517283[_0xf1a3('0x19')],_0x2c72d4);_0x5e4c64(_0x5b7e05[_0xf1a3('0x17')](0x1f4,_0x517283[_0xf1a3('0x19')]));});});}; \ No newline at end of file +var _0xbc20=['socket.io-emitter','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','attributes','model','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbc20,0x1c7));var _0x0bc2=function(_0x386306,_0x1363c9){_0x386306=_0x386306-0x0;var _0xcb23d=_0xbc20[_0x386306];return _0xcb23d;};'use strict';var _=require(_0x0bc2('0x0'));var util=require(_0x0bc2('0x1'));var moment=require(_0x0bc2('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bc2('0x3'));var fs=require('fs');var Redis=require(_0x0bc2('0x4'));var db=require(_0x0bc2('0x5'))['db'];var utils=require(_0x0bc2('0x6'));var logger=require('../../config/logger')(_0x0bc2('0x7'));var config=require(_0x0bc2('0x8'));var jayson=require(_0x0bc2('0x9'));var client=jayson[_0x0bc2('0xa')][_0x0bc2('0xb')]({'port':0x232a});config[_0x0bc2('0xc')]=_['defaults'](config[_0x0bc2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0bc2('0xd'))(new Redis(config[_0x0bc2('0xc')]));require('./whatsappAccount.socket')[_0x0bc2('0xe')](socket);function respondWithRpcPromise(_0x48b4f1,_0x357bf9,_0x1d5234){return new BPromise(function(_0x2d14b0,_0x2a1900){return client[_0x0bc2('0xf')](_0x48b4f1,_0x1d5234)['then'](function(_0xc56a3b){logger[_0x0bc2('0x10')](_0x0bc2('0x11'),_0x357bf9,_0x0bc2('0x12'));logger[_0x0bc2('0x13')](_0x0bc2('0x14'),_0x357bf9,_0x0bc2('0x12'),JSON[_0x0bc2('0x15')](_0xc56a3b));if(_0xc56a3b[_0x0bc2('0x16')]){if(_0xc56a3b['error']['code']===0x1f4){logger['error'](_0x0bc2('0x11'),_0x357bf9,_0xc56a3b[_0x0bc2('0x16')][_0x0bc2('0x17')]);return _0x2a1900(_0xc56a3b[_0x0bc2('0x16')][_0x0bc2('0x17')]);}logger['error'](_0x0bc2('0x11'),_0x357bf9,_0xc56a3b[_0x0bc2('0x16')][_0x0bc2('0x17')]);return _0x2d14b0(_0xc56a3b['error'][_0x0bc2('0x17')]);}else{logger[_0x0bc2('0x10')](_0x0bc2('0x11'),_0x357bf9,_0x0bc2('0x12'));_0x2d14b0(_0xc56a3b[_0x0bc2('0x18')]['message']);}})[_0x0bc2('0x19')](function(_0x38c4ad){logger[_0x0bc2('0x16')](_0x0bc2('0x11'),_0x357bf9,_0x38c4ad);_0x2a1900(_0x38c4ad);});});}exports[_0x0bc2('0x1a')]=function(_0x402436){var _0x248ee0=this;return new Promise(function(_0x3fb876,_0x3ca2f2){return db[_0x0bc2('0x1b')][_0x0bc2('0x1c')]({'raw':_0x402436['options']?_0x402436[_0x0bc2('0x1d')][_0x0bc2('0x1e')]===undefined?!![]:![]:!![],'where':_0x402436[_0x0bc2('0x1d')]?_0x402436[_0x0bc2('0x1d')][_0x0bc2('0x1f')]||null:null,'attributes':_0x402436[_0x0bc2('0x1d')]?_0x402436['options']['attributes']||null:null,'include':_0x402436['options']?_0x402436['options'][_0x0bc2('0x20')]?_['map'](_0x402436[_0x0bc2('0x1d')][_0x0bc2('0x20')],function(_0x5315be){return{'model':db[_0x5315be['model']],'as':_0x5315be['as'],'attributes':_0x5315be[_0x0bc2('0x21')],'include':_0x5315be['include']?_['map'](_0x5315be[_0x0bc2('0x20')],function(_0x361174){return{'model':db[_0x361174[_0x0bc2('0x22')]],'as':_0x361174['as'],'attributes':_0x361174[_0x0bc2('0x21')],'include':_0x361174[_0x0bc2('0x20')]?_[_0x0bc2('0x23')](_0x361174[_0x0bc2('0x20')],function(_0x3b41b1){return{'model':db[_0x3b41b1['model']],'as':_0x3b41b1['as'],'attributes':_0x3b41b1[_0x0bc2('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x262ebc){logger[_0x0bc2('0x10')](_0x0bc2('0x1a'),_0x402436);logger['debug'](_0x0bc2('0x1a'),_0x402436,JSON[_0x0bc2('0x15')](_0x262ebc));_0x3fb876(_0x262ebc);})[_0x0bc2('0x19')](function(_0x1992f2){logger[_0x0bc2('0x16')](_0x0bc2('0x1a'),_0x1992f2['message'],_0x402436);_0x3ca2f2(_0x248ee0[_0x0bc2('0x16')](0x1f4,_0x1992f2[_0x0bc2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d99c328..1f4a620 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 _0xca13=['update','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x28017a,_0x3994fe){var _0x57cd42=function(_0xea3fd7){while(--_0xea3fd7){_0x28017a['push'](_0x28017a['shift']());}};_0x57cd42(++_0x3994fe);}(_0xca13,0xb2));var _0x3ca1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca13[_0x321bb2];return _0x9c12ed;};'use strict';var WhatsappAccountEvents=require(_0x3ca1('0x0'));var events=[_0x3ca1('0x1'),'remove',_0x3ca1('0x2')];function createListener(_0xf34dc,_0x7ffe2b){return function(_0x5a0915){_0x7ffe2b['emit'](_0xf34dc,_0x5a0915);};}function removeListener(_0x2a8f67,_0x1cdf56){return function(){WhatsappAccountEvents['removeListener'](_0x2a8f67,_0x1cdf56);};}exports[_0x3ca1('0x3')]=function(_0x46c23a){for(var _0xa625a4=0x0,_0x26feb7=events[_0x3ca1('0x4')];_0xa625a4<_0x26feb7;_0xa625a4++){var _0x3a73c3=events[_0xa625a4];var _0x2d4d90=createListener(_0x3ca1('0x5')+_0x3a73c3,_0x46c23a);WhatsappAccountEvents['on'](_0x3a73c3,_0x2d4d90);}}; \ No newline at end of file +var _0xdbde=['remove','update','emit','removeListener','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x5dace2,_0x2e3de6){var _0x1762bf=function(_0x1b7fe6){while(--_0x1b7fe6){_0x5dace2['push'](_0x5dace2['shift']());}};_0x1762bf(++_0x2e3de6);}(_0xdbde,0xe6));var _0xedbd=function(_0x4b7430,_0x1a8721){_0x4b7430=_0x4b7430-0x0;var _0x4412bd=_0xdbde[_0x4b7430];return _0x4412bd;};'use strict';var WhatsappAccountEvents=require(_0xedbd('0x0'));var events=[_0xedbd('0x1'),_0xedbd('0x2'),_0xedbd('0x3')];function createListener(_0x173086,_0x1efe7f){return function(_0x508eed){_0x1efe7f[_0xedbd('0x4')](_0x173086,_0x508eed);};}function removeListener(_0x393033,_0x10bcb7){return function(){WhatsappAccountEvents[_0xedbd('0x5')](_0x393033,_0x10bcb7);};}exports['register']=function(_0x5c03a4){for(var _0x220e90=0x0,_0xff6b30=events[_0xedbd('0x6')];_0x220e90<_0xff6b30;_0x220e90++){var _0x32ccdb=events[_0x220e90];var _0x175d46=createListener(_0xedbd('0x7')+_0x32ccdb,_0x5c03a4);WhatsappAccountEvents['on'](_0x32ccdb,_0x175d46);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 46055a3..2facbac 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 _0x8380=['/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','index'];(function(_0x10eb6b,_0x3fe155){var _0x3a3ab1=function(_0x467f24){while(--_0x467f24){_0x10eb6b['push'](_0x10eb6b['shift']());}};_0x3a3ab1(++_0x3fe155);}(_0x8380,0x117));var _0x0838=function(_0x41cce2,_0x20868d){_0x41cce2=_0x41cce2-0x0;var _0x318b0d=_0x8380[_0x41cce2];return _0x318b0d;};'use strict';var multer=require(_0x0838('0x0'));var util=require('util');var path=require(_0x0838('0x1'));var timeout=require(_0x0838('0x2'));var express=require('express');var router=express[_0x0838('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0838('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0838('0x5'));var controller=require(_0x0838('0x6'));router[_0x0838('0x7')]('/',auth['isAuthenticated'](),controller[_0x0838('0x8')]);router[_0x0838('0x7')](_0x0838('0x9'),auth[_0x0838('0xa')](),controller[_0x0838('0xb')]);router[_0x0838('0xc')]('/',auth[_0x0838('0xa')](),controller['create']);router[_0x0838('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x0838('0xe')]);router[_0x0838('0xf')]('/:id',auth[_0x0838('0xa')](),controller[_0x0838('0x10')]);module[_0x0838('0x11')]=router; \ No newline at end of file +var _0x8446=['get','index','isAuthenticated','show','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x35fc79,_0x43f389){var _0x4c327b=function(_0x1448da){while(--_0x1448da){_0x35fc79['push'](_0x35fc79['shift']());}};_0x4c327b(++_0x43f389);}(_0x8446,0xc8));var _0x6844=function(_0x15ea0e,_0x40b159){_0x15ea0e=_0x15ea0e-0x0;var _0x4bf109=_0x8446[_0x15ea0e];return _0x4bf109;};'use strict';var multer=require(_0x6844('0x0'));var util=require(_0x6844('0x1'));var path=require(_0x6844('0x2'));var timeout=require(_0x6844('0x3'));var express=require(_0x6844('0x4'));var router=express[_0x6844('0x5')]();var fs_extra=require(_0x6844('0x6'));var auth=require(_0x6844('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6844('0x8'));var controller=require('./whatsappApplication.controller');router[_0x6844('0x9')]('/',auth['isAuthenticated'](),controller[_0x6844('0xa')]);router[_0x6844('0x9')]('/:id',auth[_0x6844('0xb')](),controller[_0x6844('0xc')]);router['post']('/',auth[_0x6844('0xb')](),controller[_0x6844('0xd')]);router[_0x6844('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6844('0xf')]);router[_0x6844('0x10')](_0x6844('0x11'),auth[_0x6844('0xb')](),controller['destroy']);module[_0x6844('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 35ccd73..66b0559 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 _0x6b89=['STRING','*,*,*,*','exports','INTEGER','noop','TEXT'];(function(_0x7d94e2,_0x1e7366){var _0x30be3e=function(_0x29d93e){while(--_0x29d93e){_0x7d94e2['push'](_0x7d94e2['shift']());}};_0x30be3e(++_0x1e7366);}(_0x6b89,0xce));var _0x96b8=function(_0x8cc54,_0x22881d){_0x8cc54=_0x8cc54-0x0;var _0x3c5226=_0x6b89[_0x8cc54];return _0x3c5226;};'use strict';var Sequelize=require('sequelize');module[_0x96b8('0x0')]={'priority':{'type':Sequelize[_0x96b8('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x96b8('0x2')},'appdata':{'type':Sequelize[_0x96b8('0x3')]()},'description':{'type':Sequelize[_0x96b8('0x4')]},'interval':{'type':Sequelize[_0x96b8('0x4')],'defaultValue':_0x96b8('0x5')}}; \ No newline at end of file +var _0x9026=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x38bce7,_0x366405){var _0x4f8b4e=function(_0x565158){while(--_0x565158){_0x38bce7['push'](_0x38bce7['shift']());}};_0x4f8b4e(++_0x366405);}(_0x9026,0x171));var _0x6902=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9026[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0x6902('0x0')]={'priority':{'type':Sequelize[_0x6902('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6902('0x2')],'allowNull':![],'defaultValue':_0x6902('0x3')},'appdata':{'type':Sequelize[_0x6902('0x4')]()},'description':{'type':Sequelize[_0x6902('0x2')]},'interval':{'type':Sequelize[_0x6902('0x2')],'defaultValue':_0x6902('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 75b4e48..8e010af 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 _0xa1cc=['ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','index','map','WhatsappApplication','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0xe626c5,_0x4594e8){var _0x6343d1=function(_0x445293){while(--_0x445293){_0xe626c5['push'](_0xe626c5['shift']());}};_0x6343d1(++_0x4594e8);}(_0xa1cc,0x10f));var _0xca1c=function(_0x380a45,_0x4be188){_0x380a45=_0x380a45-0x0;var _0x3285e4=_0xa1cc[_0x380a45];return _0x3285e4;};'use strict';var emlformat=require(_0xca1c('0x0'));var rimraf=require(_0xca1c('0x1'));var zipdir=require(_0xca1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca1c('0x3'));var moment=require(_0xca1c('0x4'));var BPromise=require(_0xca1c('0x5'));var Mustache=require('mustache');var util=require(_0xca1c('0x6'));var path=require('path');var sox=require(_0xca1c('0x7'));var csv=require(_0xca1c('0x8'));var ejs=require(_0xca1c('0x9'));var fs=require('fs');var fs_extra=require(_0xca1c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xca1c('0xb'));var jsforce=require(_0xca1c('0xc'));var deskjs=require(_0xca1c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca1c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xca1c('0xf'));var as=require(_0xca1c('0x10'));var hardwareService=require(_0xca1c('0x11'));var logger=require(_0xca1c('0x12'))(_0xca1c('0x13'));var utils=require('../../config/utils');var config=require(_0xca1c('0x14'));var licenseUtil=require(_0xca1c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3029fd,_0x5d60df){_0x5d60df=_0x5d60df||0xcc;return function(_0x292272){if(_0x292272){return _0x3029fd[_0xca1c('0x16')](_0x5d60df);}return _0x3029fd[_0xca1c('0x17')](_0x5d60df)['end']();};}function respondWithResult(_0x344d4c,_0x222a56){_0x222a56=_0x222a56||0xc8;return function(_0x5c7c21){if(_0x5c7c21){return _0x344d4c['status'](_0x222a56)[_0xca1c('0x18')](_0x5c7c21);}};}function respondWithFilteredResult(_0x2b55fd,_0x196a66){return function(_0x18e6ac){if(_0x18e6ac){var _0x2644f0=typeof _0x196a66[_0xca1c('0x19')]===_0xca1c('0x1a')&&typeof _0x196a66[_0xca1c('0x1b')]===_0xca1c('0x1a');var _0x882fd4=_0x18e6ac[_0xca1c('0x1c')];var _0x10b126=_0x2644f0?0x0:_0x196a66[_0xca1c('0x19')];var _0x447547=_0x2644f0?_0x18e6ac[_0xca1c('0x1c')]:_0x196a66[_0xca1c('0x19')]+_0x196a66['limit'];var _0x1b2d8d;if(_0x447547>=_0x882fd4){_0x447547=_0x882fd4;_0x1b2d8d=0xc8;}else{_0x1b2d8d=0xce;}_0x2b55fd[_0xca1c('0x17')](_0x1b2d8d);return _0x2b55fd['set']('Content-Range',_0x10b126+'-'+_0x447547+'/'+_0x882fd4)[_0xca1c('0x18')](_0x18e6ac);}return null;};}function patchUpdates(_0x10f801){return function(_0x31aa79){try{jsonpatch[_0xca1c('0x1d')](_0x31aa79,_0x10f801,!![]);}catch(_0x140e90){return BPromise[_0xca1c('0x1e')](_0x140e90);}return _0x31aa79[_0xca1c('0x1f')]();};}function saveUpdates(_0x5d23ac,_0x115b4d){return function(_0x540596){if(_0x540596){return _0x540596[_0xca1c('0x20')](_0x5d23ac)[_0xca1c('0x21')](function(_0x3fac0d){return _0x3fac0d;});}return null;};}function removeEntity(_0x40b169,_0x5f2d76){return function(_0x1c06dc){if(_0x1c06dc){return _0x1c06dc[_0xca1c('0x22')]()['then'](function(){_0x40b169[_0xca1c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1639da,_0x13ff50){return function(_0x2868c4){if(!_0x2868c4){_0x1639da[_0xca1c('0x16')](0x194);}return _0x2868c4;};}function handleError(_0x4aacb8,_0x1c3056){_0x1c3056=_0x1c3056||0x1f4;return function(_0xa1a686){logger[_0xca1c('0x23')](_0xa1a686[_0xca1c('0x24')]);if(_0xa1a686[_0xca1c('0x25')]){delete _0xa1a686[_0xca1c('0x25')];}_0x4aacb8[_0xca1c('0x17')](_0x1c3056)['send'](_0xa1a686);};}exports[_0xca1c('0x26')]=function(_0x5408c6,_0x573fc){var _0x31042a={},_0x4a2406={},_0xb2db36={'count':0x0,'rows':[]};var _0x3ffa43=_[_0xca1c('0x27')](db[_0xca1c('0x28')]['rawAttributes'],function(_0x404579){return{'name':_0x404579[_0xca1c('0x29')],'type':_0x404579[_0xca1c('0x2a')][_0xca1c('0x2b')]};});_0x4a2406['model']=_[_0xca1c('0x27')](_0x3ffa43,'name');_0x4a2406['query']=_[_0xca1c('0x2c')](_0x5408c6[_0xca1c('0x2d')]);_0x4a2406[_0xca1c('0x2e')]=_[_0xca1c('0x2f')](_0x4a2406[_0xca1c('0x30')],_0x4a2406['query']);_0x31042a['attributes']=_[_0xca1c('0x2f')](_0x4a2406[_0xca1c('0x30')],qs[_0xca1c('0x31')](_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x31')]));_0x31042a['attributes']=_0x31042a[_0xca1c('0x32')]['length']?_0x31042a[_0xca1c('0x32')]:_0x4a2406[_0xca1c('0x30')];if(!_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x33')]('nolimit')){_0x31042a[_0xca1c('0x1b')]=qs[_0xca1c('0x1b')](_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x1b')]);_0x31042a[_0xca1c('0x19')]=qs[_0xca1c('0x19')](_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x19')]);}_0x31042a[_0xca1c('0x34')]=qs[_0xca1c('0x35')](_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x35')]);_0x31042a['where']=qs[_0xca1c('0x2e')](_[_0xca1c('0x36')](_0x5408c6['query'],_0x4a2406[_0xca1c('0x2e')]),_0x3ffa43);if(_0x5408c6[_0xca1c('0x2d')]['filter']){_0x31042a[_0xca1c('0x37')]=_[_0xca1c('0x38')](_0x31042a[_0xca1c('0x37')],{'$or':_['map'](_0x3ffa43,function(_0x2f3a87){if(_0x2f3a87[_0xca1c('0x2a')]!=='VIRTUAL'){var _0x2ffdab={};_0x2ffdab[_0x2f3a87['name']]={'$like':'%'+_0x5408c6['query'][_0xca1c('0x39')]+'%'};return _0x2ffdab;}})});}_0x31042a=_[_0xca1c('0x38')]({},_0x31042a,_0x5408c6[_0xca1c('0x3a')]);var _0x56e943={'where':_0x31042a[_0xca1c('0x37')]};return db[_0xca1c('0x28')][_0xca1c('0x1c')](_0x56e943)[_0xca1c('0x21')](function(_0x2c37b8){_0xb2db36[_0xca1c('0x1c')]=_0x2c37b8;if(_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x3b')]){_0x31042a[_0xca1c('0x3c')]=[{'all':!![]}];}return db[_0xca1c('0x28')][_0xca1c('0x3d')](_0x31042a);})[_0xca1c('0x21')](function(_0x15fd6f){_0xb2db36[_0xca1c('0x3e')]=_0x15fd6f;return _0xb2db36;})[_0xca1c('0x21')](respondWithFilteredResult(_0x573fc,_0x31042a))[_0xca1c('0x3f')](handleError(_0x573fc,null));};exports['show']=function(_0x248722,_0x3f81ae){var _0x55fb2a={'raw':!![],'where':{'id':_0x248722[_0xca1c('0x40')]['id']}},_0x34609c={};_0x34609c[_0xca1c('0x30')]=_[_0xca1c('0x2c')](db[_0xca1c('0x28')][_0xca1c('0x41')]);_0x34609c[_0xca1c('0x2d')]=_['keys'](_0x248722['query']);_0x34609c[_0xca1c('0x2e')]=_[_0xca1c('0x2f')](_0x34609c[_0xca1c('0x30')],_0x34609c['query']);_0x55fb2a[_0xca1c('0x32')]=_[_0xca1c('0x2f')](_0x34609c['model'],qs[_0xca1c('0x31')](_0x248722[_0xca1c('0x2d')][_0xca1c('0x31')]));_0x55fb2a[_0xca1c('0x32')]=_0x55fb2a['attributes'][_0xca1c('0x42')]?_0x55fb2a['attributes']:_0x34609c[_0xca1c('0x30')];if(_0x248722['query'][_0xca1c('0x3b')]){_0x55fb2a[_0xca1c('0x3c')]=[{'all':!![]}];}_0x55fb2a=_['merge']({},_0x55fb2a,_0x248722['options']);return db[_0xca1c('0x28')][_0xca1c('0x43')](_0x55fb2a)[_0xca1c('0x21')](handleEntityNotFound(_0x3f81ae,null))[_0xca1c('0x21')](respondWithResult(_0x3f81ae,null))[_0xca1c('0x3f')](handleError(_0x3f81ae,null));};exports[_0xca1c('0x44')]=function(_0x26d107,_0x227a80){return db['WhatsappApplication'][_0xca1c('0x44')](_0x26d107[_0xca1c('0x45')],{})[_0xca1c('0x21')](respondWithResult(_0x227a80,0xc9))[_0xca1c('0x3f')](handleError(_0x227a80,null));};exports[_0xca1c('0x20')]=function(_0x166d45,_0x26c8cf){if(_0x166d45[_0xca1c('0x45')]['id']){delete _0x166d45[_0xca1c('0x45')]['id'];}return db[_0xca1c('0x28')][_0xca1c('0x43')]({'where':{'id':_0x166d45['params']['id']}})[_0xca1c('0x21')](handleEntityNotFound(_0x26c8cf,null))[_0xca1c('0x21')](saveUpdates(_0x166d45[_0xca1c('0x45')],null))['then'](respondWithResult(_0x26c8cf,null))['catch'](handleError(_0x26c8cf,null));};exports[_0xca1c('0x22')]=function(_0x43c0c1,_0x2b4eb4){return db['WhatsappApplication']['find']({'where':{'id':_0x43c0c1[_0xca1c('0x40')]['id']}})[_0xca1c('0x21')](handleEntityNotFound(_0x2b4eb4,null))['then'](removeEntity(_0x2b4eb4,null))[_0xca1c('0x3f')](handleError(_0x2b4eb4,null));}; \ No newline at end of file +var _0x804d=['offset','undefined','limit','set','apply','reject','destroy','end','error','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','filter','count','includeAll','include','findAll','then','rows','catch','show','intersection','options','find','create','body','update','params','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x5d9bab,_0x1e8c76){var _0x42d454=function(_0x241ec2){while(--_0x241ec2){_0x5d9bab['push'](_0x5d9bab['shift']());}};_0x42d454(++_0x1e8c76);}(_0x804d,0x116));var _0xd804=function(_0x135b11,_0x8b8b53){_0x135b11=_0x135b11-0x0;var _0x7abc52=_0x804d[_0x135b11];return _0x7abc52;};'use strict';var emlformat=require(_0xd804('0x0'));var rimraf=require(_0xd804('0x1'));var zipdir=require(_0xd804('0x2'));var jsonpatch=require(_0xd804('0x3'));var rp=require(_0xd804('0x4'));var moment=require(_0xd804('0x5'));var BPromise=require(_0xd804('0x6'));var Mustache=require(_0xd804('0x7'));var util=require('util');var path=require(_0xd804('0x8'));var sox=require(_0xd804('0x9'));var csv=require(_0xd804('0xa'));var ejs=require(_0xd804('0xb'));var fs=require('fs');var fs_extra=require(_0xd804('0xc'));var _=require(_0xd804('0xd'));var squel=require(_0xd804('0xe'));var crypto=require(_0xd804('0xf'));var jsforce=require(_0xd804('0x10'));var deskjs=require(_0xd804('0x11'));var toCsv=require(_0xd804('0xa'));var querystring=require(_0xd804('0x12'));var Papa=require('papaparse');var Redis=require(_0xd804('0x13'));var authService=require(_0xd804('0x14'));var qs=require(_0xd804('0x15'));var as=require(_0xd804('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd804('0x17'));var utils=require(_0xd804('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd804('0x19'));var db=require(_0xd804('0x1a'))['db'];function respondWithStatusCode(_0x4fff76,_0x1d5594){_0x1d5594=_0x1d5594||0xcc;return function(_0x2dd4e5){if(_0x2dd4e5){return _0x4fff76[_0xd804('0x1b')](_0x1d5594);}return _0x4fff76['status'](_0x1d5594)['end']();};}function respondWithResult(_0x31b189,_0x3298f5){_0x3298f5=_0x3298f5||0xc8;return function(_0xcec83){if(_0xcec83){return _0x31b189[_0xd804('0x1c')](_0x3298f5)[_0xd804('0x1d')](_0xcec83);}};}function respondWithFilteredResult(_0x5ee270,_0x18c4a0){return function(_0x30be96){if(_0x30be96){var _0x597be3=typeof _0x18c4a0[_0xd804('0x1e')]===_0xd804('0x1f')&&typeof _0x18c4a0[_0xd804('0x20')]==='undefined';var _0x335203=_0x30be96['count'];var _0x421ddb=_0x597be3?0x0:_0x18c4a0[_0xd804('0x1e')];var _0x13fa46=_0x597be3?_0x30be96['count']:_0x18c4a0[_0xd804('0x1e')]+_0x18c4a0[_0xd804('0x20')];var _0x398f79;if(_0x13fa46>=_0x335203){_0x13fa46=_0x335203;_0x398f79=0xc8;}else{_0x398f79=0xce;}_0x5ee270[_0xd804('0x1c')](_0x398f79);return _0x5ee270[_0xd804('0x21')]('Content-Range',_0x421ddb+'-'+_0x13fa46+'/'+_0x335203)['json'](_0x30be96);}return null;};}function patchUpdates(_0x37021f){return function(_0x5425f0){try{jsonpatch[_0xd804('0x22')](_0x5425f0,_0x37021f,!![]);}catch(_0x103f52){return BPromise[_0xd804('0x23')](_0x103f52);}return _0x5425f0['save']();};}function saveUpdates(_0x29a3b4,_0x5dd939){return function(_0x18d28c){if(_0x18d28c){return _0x18d28c['update'](_0x29a3b4)['then'](function(_0x52c85c){return _0x52c85c;});}return null;};}function removeEntity(_0x51b191,_0x2cde57){return function(_0x2fc18b){if(_0x2fc18b){return _0x2fc18b[_0xd804('0x24')]()['then'](function(){_0x51b191[_0xd804('0x1c')](0xcc)[_0xd804('0x25')]();});}};}function handleEntityNotFound(_0x2a2502,_0x35bfef){return function(_0x5045a1){if(!_0x5045a1){_0x2a2502[_0xd804('0x1b')](0x194);}return _0x5045a1;};}function handleError(_0x11d2c4,_0x5da178){_0x5da178=_0x5da178||0x1f4;return function(_0x38a6f6){logger[_0xd804('0x26')](_0x38a6f6['stack']);if(_0x38a6f6['name']){delete _0x38a6f6['name'];}_0x11d2c4[_0xd804('0x1c')](_0x5da178)[_0xd804('0x27')](_0x38a6f6);};}exports[_0xd804('0x28')]=function(_0x570990,_0x225615){var _0x28a26f={},_0x1858f0={},_0x1f4234={'count':0x0,'rows':[]};var _0x473588=_[_0xd804('0x29')](db[_0xd804('0x2a')][_0xd804('0x2b')],function(_0x5b197a){return{'name':_0x5b197a[_0xd804('0x2c')],'type':_0x5b197a[_0xd804('0x2d')][_0xd804('0x2e')]};});_0x1858f0[_0xd804('0x2f')]=_[_0xd804('0x29')](_0x473588,_0xd804('0x30'));_0x1858f0[_0xd804('0x31')]=_[_0xd804('0x32')](_0x570990[_0xd804('0x31')]);_0x1858f0[_0xd804('0x33')]=_['intersection'](_0x1858f0['model'],_0x1858f0[_0xd804('0x31')]);_0x28a26f[_0xd804('0x34')]=_['intersection'](_0x1858f0['model'],qs[_0xd804('0x35')](_0x570990['query']['fields']));_0x28a26f[_0xd804('0x34')]=_0x28a26f[_0xd804('0x34')][_0xd804('0x36')]?_0x28a26f[_0xd804('0x34')]:_0x1858f0[_0xd804('0x2f')];if(!_0x570990[_0xd804('0x31')][_0xd804('0x37')](_0xd804('0x38'))){_0x28a26f['limit']=qs[_0xd804('0x20')](_0x570990['query'][_0xd804('0x20')]);_0x28a26f[_0xd804('0x1e')]=qs[_0xd804('0x1e')](_0x570990[_0xd804('0x31')][_0xd804('0x1e')]);}_0x28a26f['order']=qs['sort'](_0x570990['query'][_0xd804('0x39')]);_0x28a26f['where']=qs[_0xd804('0x33')](_[_0xd804('0x3a')](_0x570990[_0xd804('0x31')],_0x1858f0[_0xd804('0x33')]),_0x473588);if(_0x570990[_0xd804('0x31')]['filter']){_0x28a26f['where']=_[_0xd804('0x3b')](_0x28a26f[_0xd804('0x3c')],{'$or':_[_0xd804('0x29')](_0x473588,function(_0x46018c){if(_0x46018c['type']!=='VIRTUAL'){var _0x24c0a1={};_0x24c0a1[_0x46018c[_0xd804('0x30')]]={'$like':'%'+_0x570990[_0xd804('0x31')][_0xd804('0x3d')]+'%'};return _0x24c0a1;}})});}_0x28a26f=_['merge']({},_0x28a26f,_0x570990['options']);var _0x5628cf={'where':_0x28a26f[_0xd804('0x3c')]};return db[_0xd804('0x2a')][_0xd804('0x3e')](_0x5628cf)['then'](function(_0x293aee){_0x1f4234['count']=_0x293aee;if(_0x570990[_0xd804('0x31')][_0xd804('0x3f')]){_0x28a26f[_0xd804('0x40')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xd804('0x41')](_0x28a26f);})[_0xd804('0x42')](function(_0xd13bf0){_0x1f4234[_0xd804('0x43')]=_0xd13bf0;return _0x1f4234;})['then'](respondWithFilteredResult(_0x225615,_0x28a26f))[_0xd804('0x44')](handleError(_0x225615,null));};exports[_0xd804('0x45')]=function(_0x14099b,_0xadfde0){var _0x45c011={'raw':!![],'where':{'id':_0x14099b['params']['id']}},_0x409278={};_0x409278['model']=_[_0xd804('0x32')](db['WhatsappApplication'][_0xd804('0x2b')]);_0x409278[_0xd804('0x31')]=_[_0xd804('0x32')](_0x14099b[_0xd804('0x31')]);_0x409278[_0xd804('0x33')]=_[_0xd804('0x46')](_0x409278[_0xd804('0x2f')],_0x409278[_0xd804('0x31')]);_0x45c011[_0xd804('0x34')]=_['intersection'](_0x409278['model'],qs[_0xd804('0x35')](_0x14099b[_0xd804('0x31')][_0xd804('0x35')]));_0x45c011[_0xd804('0x34')]=_0x45c011['attributes']['length']?_0x45c011[_0xd804('0x34')]:_0x409278['model'];if(_0x14099b[_0xd804('0x31')][_0xd804('0x3f')]){_0x45c011[_0xd804('0x40')]=[{'all':!![]}];}_0x45c011=_[_0xd804('0x3b')]({},_0x45c011,_0x14099b[_0xd804('0x47')]);return db[_0xd804('0x2a')][_0xd804('0x48')](_0x45c011)[_0xd804('0x42')](handleEntityNotFound(_0xadfde0,null))['then'](respondWithResult(_0xadfde0,null))[_0xd804('0x44')](handleError(_0xadfde0,null));};exports[_0xd804('0x49')]=function(_0x504f76,_0x12a15b){return db[_0xd804('0x2a')]['create'](_0x504f76[_0xd804('0x4a')],{})['then'](respondWithResult(_0x12a15b,0xc9))[_0xd804('0x44')](handleError(_0x12a15b,null));};exports[_0xd804('0x4b')]=function(_0x514eb2,_0x2f0146){if(_0x514eb2[_0xd804('0x4a')]['id']){delete _0x514eb2['body']['id'];}return db[_0xd804('0x2a')][_0xd804('0x48')]({'where':{'id':_0x514eb2[_0xd804('0x4c')]['id']}})[_0xd804('0x42')](handleEntityNotFound(_0x2f0146,null))[_0xd804('0x42')](saveUpdates(_0x514eb2[_0xd804('0x4a')],null))[_0xd804('0x42')](respondWithResult(_0x2f0146,null))[_0xd804('0x44')](handleError(_0x2f0146,null));};exports[_0xd804('0x24')]=function(_0x4d988d,_0x187cf2){return db['WhatsappApplication'][_0xd804('0x48')]({'where':{'id':_0x4d988d[_0xd804('0x4c')]['id']}})[_0xd804('0x42')](handleEntityNotFound(_0x187cf2,null))[_0xd804('0x42')](removeEntity(_0x187cf2,null))[_0xd804('0x44')](handleError(_0x187cf2,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index a4869eb..ebc34b0 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 _0xb2b5=['utf8mb4_unicode_ci','moment','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4'];(function(_0x4dbdda,_0x11f07c){var _0x1acbf1=function(_0x1a9fc8){while(--_0x1a9fc8){_0x4dbdda['push'](_0x4dbdda['shift']());}};_0x1acbf1(++_0x11f07c);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb2b5[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b2b('0x0'));var BPromise=require(_0x5b2b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5b2b('0x2'));var config=require(_0x5b2b('0x3'));var attributes=require(_0x5b2b('0x4'));module[_0x5b2b('0x5')]=function(_0x49d9f6,_0x30c3e2){return _0x49d9f6[_0x5b2b('0x6')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b2b('0x7'),'collate':_0x5b2b('0x8')});}; \ No newline at end of file +var _0x4876=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','WhatsappApplication','whatsapp_applications'];(function(_0xab107f,_0x42096e){var _0x3cd09c=function(_0x54ccc){while(--_0x54ccc){_0xab107f['push'](_0xab107f['shift']());}};_0x3cd09c(++_0x42096e);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6487('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6487('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6487('0x2'));var rimraf=require(_0x6487('0x3'));var config=require(_0x6487('0x4'));var attributes=require(_0x6487('0x5'));module['exports']=function(_0x23e50b,_0x856b1c){return _0x23e50b['define'](_0x6487('0x6'),attributes,{'tableName':_0x6487('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6487('0x8'),'collate':_0x6487('0x9')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index e07fa46..4d6fff8 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x56f7df,_0x5788f0){var _0x4cd371=function(_0x2e70bb){while(--_0x2e70bb){_0x56f7df['push'](_0x56f7df['shift']());}};_0x4cd371(++_0x5788f0);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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']('WhatsappApplication,\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 _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7bae,0x13b));var _0xe7ba=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x7bae[_0x2d7f0e];return _0x110b07;};'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});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 38971c4..d0bf01f 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 _0xa498=['put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','addTags'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xa498,0x1d6));var _0x8a49=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0xa498[_0x2dc96f];return _0xd012da;};'use strict';var multer=require('multer');var util=require(_0x8a49('0x0'));var path=require(_0x8a49('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8a49('0x2')]();var fs_extra=require(_0x8a49('0x3'));var auth=require(_0x8a49('0x4'));var interaction=require(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x8a49('0x7')]('/',auth['isAuthenticated'](),controller[_0x8a49('0x8')]);router[_0x8a49('0x7')](_0x8a49('0x9'),auth['isAuthenticated'](),controller[_0x8a49('0xa')]);router[_0x8a49('0x7')](_0x8a49('0xb'),auth[_0x8a49('0xc')](),controller[_0x8a49('0xd')]);router[_0x8a49('0x7')]('/:id/messages',auth[_0x8a49('0xc')](),controller[_0x8a49('0xe')]);router[_0x8a49('0x7')](_0x8a49('0xf'),auth[_0x8a49('0xc')](),controller[_0x8a49('0x10')]);router[_0x8a49('0x11')]('/',auth[_0x8a49('0xc')](),controller[_0x8a49('0x12')]);router['post'](_0x8a49('0x13'),auth[_0x8a49('0xc')](),controller[_0x8a49('0x14')]);router['post'](_0x8a49('0x15'),auth['isAuthenticated'](),interaction[_0x8a49('0x16')](_0x8a49('0x17'),'whatsappinteraction:addtags'),controller[_0x8a49('0x18')]);router[_0x8a49('0x19')](_0x8a49('0xb'),auth[_0x8a49('0xc')](),interaction['tracked']('whatsapp',_0x8a49('0x1a')),controller[_0x8a49('0x1b')]);router[_0x8a49('0x1c')](_0x8a49('0xb'),auth['isAuthenticated'](),interaction[_0x8a49('0x16')](_0x8a49('0x17'),_0x8a49('0x1d')),controller[_0x8a49('0x1e')]);router[_0x8a49('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8a49('0x1f')]);module[_0x8a49('0x20')]=router; \ No newline at end of file +var _0x6eed=['put','update','/:id','whatsappinteraction:destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x6eed,0xff));var _0xd6ee=function(_0x4da61c,_0x4f3c93){_0x4da61c=_0x4da61c-0x0;var _0x3403e9=_0x6eed[_0x4da61c];return _0x3403e9;};'use strict';var multer=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var path=require(_0xd6ee('0x2'));var timeout=require(_0xd6ee('0x3'));var express=require(_0xd6ee('0x4'));var router=express['Router']();var fs_extra=require(_0xd6ee('0x5'));var auth=require(_0xd6ee('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd6ee('0x7'));router[_0xd6ee('0x8')]('/',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0xa')]);router[_0xd6ee('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd6ee('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd6ee('0xc')]);router[_0xd6ee('0x8')]('/:id/messages',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0xd')]);router[_0xd6ee('0x8')](_0xd6ee('0xe'),auth['isAuthenticated'](),controller[_0xd6ee('0xf')]);router[_0xd6ee('0x10')]('/',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0x11')]);router[_0xd6ee('0x10')](_0xd6ee('0x12'),auth['isAuthenticated'](),controller[_0xd6ee('0x13')]);router[_0xd6ee('0x10')]('/:id/tags',auth[_0xd6ee('0x9')](),interaction[_0xd6ee('0x14')](_0xd6ee('0x15'),_0xd6ee('0x16')),controller[_0xd6ee('0x17')]);router[_0xd6ee('0x18')]('/:id',auth[_0xd6ee('0x9')](),interaction[_0xd6ee('0x14')](_0xd6ee('0x15'),'whatsappinteraction:update'),controller[_0xd6ee('0x19')]);router['delete'](_0xd6ee('0x1a'),auth[_0xd6ee('0x9')](),interaction[_0xd6ee('0x14')]('whatsapp',_0xd6ee('0x1b')),controller['destroy']);router[_0xd6ee('0x1c')]('/:id/tags',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0x1d')]);module[_0xd6ee('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 919e077..ddeb20a 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 _0x1280=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x9a7796,_0xe30784){var _0x2e73a0=function(_0x120615){while(--_0x120615){_0x9a7796['push'](_0x9a7796['shift']());}};_0x2e73a0(++_0xe30784);}(_0x1280,0xac));var _0x0128=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0x1280[_0x230951];return _0xeb26b1;};'use strict';var Sequelize=require(_0x0128('0x0'));var moment=require('moment');module[_0x0128('0x1')]={'closed':{'type':Sequelize[_0x0128('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0128('0x3')]},'disposition':{'type':Sequelize[_0x0128('0x4')]},'secondDisposition':{'type':Sequelize[_0x0128('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0128('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0128('0x4')]},'read1stAt':{'type':Sequelize[_0x0128('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0128('0x5')]('in',_0x0128('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0128('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0128('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0128('0x7')]}}; \ No newline at end of file +var _0x02a7=['STRING','out','moment','exports','BOOLEAN','DATE'];(function(_0x189d3c,_0x5efebf){var _0x485959=function(_0x1161da){while(--_0x1161da){_0x189d3c['push'](_0x189d3c['shift']());}};_0x485959(++_0x5efebf);}(_0x02a7,0x1a6));var _0x702a=function(_0x5617eb,_0x58a1a4){_0x5617eb=_0x5617eb-0x0;var _0x2617fb=_0x02a7[_0x5617eb];return _0x2617fb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x702a('0x0'));module[_0x702a('0x1')]={'closed':{'type':Sequelize[_0x702a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x702a('0x3')]},'disposition':{'type':Sequelize[_0x702a('0x4')]},'secondDisposition':{'type':Sequelize[_0x702a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x702a('0x4')]},'note':{'type':Sequelize[_0x702a('0x4')]},'phone':{'type':Sequelize[_0x702a('0x4')]},'read1stAt':{'type':Sequelize[_0x702a('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x702a('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x702a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x702a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c3a8dd4..22bff5e 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 _0xcd94=['filters','attributes','intersection','fields','length','include','merge','create','body','update','find','describe','addMessage','WhatsappMessage','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','addTags','setTags','ids','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','root','server','join','files','push','User','fullname','CmContact','firstName','Attachment','createdAt','secret','read','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','Messages','createReadStream','pipe','createWriteStream','basename','direction','System','Contact','lastName','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','then','destroy','end','error','name','send','map','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','catch','show','params','model','WhatsappInteraction','keys'];(function(_0x2521b5,_0x46be51){var _0x1f12a5=function(_0x9b675f){while(--_0x9b675f){_0x2521b5['push'](_0x2521b5['shift']());}};_0x1f12a5(++_0x46be51);}(_0xcd94,0x1d0));var _0x4cd9=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0xcd94[_0x32729c];return _0x482cfd;};'use strict';var rimraf=require(_0x4cd9('0x0'));var zipdir=require(_0x4cd9('0x1'));var moment=require('moment');var BPromise=require(_0x4cd9('0x2'));var util=require(_0x4cd9('0x3'));var path=require(_0x4cd9('0x4'));var ejs=require(_0x4cd9('0x5'));var fs=require('fs');var _=require(_0x4cd9('0x6'));var Redis=require(_0x4cd9('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x4cd9('0x8'));var pdf=require(_0x4cd9('0x9'));var logger=require(_0x4cd9('0xa'))(_0x4cd9('0xb'));var config=require(_0x4cd9('0xc'));var db=require(_0x4cd9('0xd'))['db'];config['redis']=_[_0x4cd9('0xe')](config[_0x4cd9('0xf')],{'host':_0x4cd9('0x10'),'port':0x18eb});var socket=require(_0x4cd9('0x11'))(new Redis(config[_0x4cd9('0xf')]));require('./whatsappInteraction.socket')[_0x4cd9('0x12')](socket);function respondWithStatusCode(_0x19b609,_0x1e9bc5){_0x1e9bc5=_0x1e9bc5||0xcc;return function(_0x41643c){if(_0x41643c){return _0x19b609[_0x4cd9('0x13')](_0x1e9bc5);}return _0x19b609[_0x4cd9('0x14')](_0x1e9bc5)['end']();};}function respondWithResult(_0xc2a406,_0x42d6f4){_0x42d6f4=_0x42d6f4||0xc8;return function(_0x252732){if(_0x252732){return _0xc2a406[_0x4cd9('0x14')](_0x42d6f4)[_0x4cd9('0x15')](_0x252732);}};}function respondWithFilteredResult(_0x100e82,_0x397d56){return function(_0x26c25e){if(_0x26c25e){var _0x13d3ff=typeof _0x397d56[_0x4cd9('0x16')]===_0x4cd9('0x17')&&typeof _0x397d56['limit']==='undefined';var _0x541143=_0x26c25e[_0x4cd9('0x18')];var _0x2de7ce=_0x13d3ff?0x0:_0x397d56[_0x4cd9('0x16')];var _0x2bec80=_0x13d3ff?_0x26c25e[_0x4cd9('0x18')]:_0x397d56['offset']+_0x397d56[_0x4cd9('0x19')];var _0x31d57b;if(_0x2bec80>=_0x541143){_0x2bec80=_0x541143;_0x31d57b=0xc8;}else{_0x31d57b=0xce;}_0x100e82[_0x4cd9('0x14')](_0x31d57b);return _0x100e82[_0x4cd9('0x1a')](_0x4cd9('0x1b'),_0x2de7ce+'-'+_0x2bec80+'/'+_0x541143)['json'](_0x26c25e);}return null;};}function saveUpdates(_0x3babd5){return function(_0x46886f){if(_0x46886f){return _0x46886f['update'](_0x3babd5)[_0x4cd9('0x1c')](function(_0x4359bd){return _0x4359bd;});}return null;};}function removeEntity(_0x53de2a){return function(_0x4be869){if(_0x4be869){return _0x4be869[_0x4cd9('0x1d')]()[_0x4cd9('0x1c')](function(){_0x53de2a[_0x4cd9('0x14')](0xcc)[_0x4cd9('0x1e')]();});}};}function handleEntityNotFound(_0x52127c){return function(_0x3e489f){if(!_0x3e489f){_0x52127c[_0x4cd9('0x13')](0x194);}return _0x3e489f;};}function handleError(_0x4f57f2,_0x431c43){_0x431c43=_0x431c43||0x1f4;return function(_0x18af96){logger[_0x4cd9('0x1f')](_0x18af96['stack']);if(_0x18af96[_0x4cd9('0x20')]){delete _0x18af96[_0x4cd9('0x20')];}_0x4f57f2[_0x4cd9('0x14')](_0x431c43)[_0x4cd9('0x21')](_0x18af96);};}exports['index']=function(_0x74ef7c,_0x3c95ff){var _0x2cd9ab={};var _0x1b49ae=_[_0x4cd9('0x22')](db['WhatsappInteraction'][_0x4cd9('0x23')],function(_0x11cbc1){return{'name':_0x11cbc1[_0x4cd9('0x24')],'type':_0x11cbc1['type'][_0x4cd9('0x25')]};});_0x2cd9ab=qs[_0x4cd9('0x26')](_0x1b49ae,_0x74ef7c);return interaction[_0x4cd9('0x27')](_0x4cd9('0x28'),_0x74ef7c[_0x4cd9('0x29')],_0x74ef7c['user'],_0x2cd9ab,_0x1b49ae)[_0x4cd9('0x1c')](respondWithFilteredResult(_0x3c95ff,_0x2cd9ab))[_0x4cd9('0x2a')](handleError(_0x3c95ff,null));};exports[_0x4cd9('0x2b')]=function(_0x574d3c,_0x17c27b){var _0x577b9d={'raw':![],'where':{'id':_0x574d3c[_0x4cd9('0x2c')]['id']}},_0x3751c0={};_0x3751c0[_0x4cd9('0x2d')]=_['keys'](db[_0x4cd9('0x2e')][_0x4cd9('0x23')]);_0x3751c0[_0x4cd9('0x29')]=_[_0x4cd9('0x2f')](_0x574d3c['query']);_0x3751c0[_0x4cd9('0x30')]=_['intersection'](_0x3751c0[_0x4cd9('0x2d')],_0x3751c0[_0x4cd9('0x29')]);_0x577b9d[_0x4cd9('0x31')]=_[_0x4cd9('0x32')](_0x3751c0[_0x4cd9('0x2d')],qs[_0x4cd9('0x33')](_0x574d3c[_0x4cd9('0x29')][_0x4cd9('0x33')]));_0x577b9d['attributes']=_0x577b9d[_0x4cd9('0x31')][_0x4cd9('0x34')]?_0x577b9d[_0x4cd9('0x31')]:_0x3751c0['model'];if(_0x574d3c['query']['includeAll']){_0x577b9d[_0x4cd9('0x35')]=[{'all':!![]}];}_0x577b9d=_[_0x4cd9('0x36')]({},_0x577b9d,_0x574d3c['options']);return db[_0x4cd9('0x2e')]['find'](_0x577b9d)[_0x4cd9('0x1c')](handleEntityNotFound(_0x17c27b,null))['then'](respondWithResult(_0x17c27b,null))[_0x4cd9('0x2a')](handleError(_0x17c27b,null));};exports[_0x4cd9('0x37')]=function(_0x12e73d,_0x586968){return db[_0x4cd9('0x2e')][_0x4cd9('0x37')](_0x12e73d[_0x4cd9('0x38')],{})[_0x4cd9('0x1c')](respondWithResult(_0x586968,0xc9))[_0x4cd9('0x2a')](handleError(_0x586968,null));};exports[_0x4cd9('0x39')]=function(_0x1ac0db,_0x7f6cbc){if(_0x1ac0db['body']['id']){delete _0x1ac0db[_0x4cd9('0x38')]['id'];}return db[_0x4cd9('0x2e')][_0x4cd9('0x3a')]({'where':{'id':_0x1ac0db[_0x4cd9('0x2c')]['id']}})[_0x4cd9('0x1c')](handleEntityNotFound(_0x7f6cbc,null))[_0x4cd9('0x1c')](saveUpdates(_0x1ac0db[_0x4cd9('0x38')],null))[_0x4cd9('0x1c')](respondWithResult(_0x7f6cbc,null))['catch'](handleError(_0x7f6cbc,null));};exports[_0x4cd9('0x1d')]=function(_0xd0ad1a,_0x720a2a){return db[_0x4cd9('0x2e')]['find']({'where':{'id':_0xd0ad1a[_0x4cd9('0x2c')]['id']}})[_0x4cd9('0x1c')](handleEntityNotFound(_0x720a2a,null))[_0x4cd9('0x1c')](removeEntity(_0x720a2a,null))[_0x4cd9('0x2a')](handleError(_0x720a2a,null));};exports[_0x4cd9('0x3b')]=function(_0x3ae65b,_0x3876b7){return db[_0x4cd9('0x2e')]['describe']()[_0x4cd9('0x1c')](respondWithResult(_0x3876b7,null))[_0x4cd9('0x2a')](handleError(_0x3876b7,null));};exports[_0x4cd9('0x3c')]=function(_0x577bf2,_0x2f0245){return db[_0x4cd9('0x3d')]['find']({'where':{'id':_0x577bf2[_0x4cd9('0x2c')]['id']}})[_0x4cd9('0x1c')](handleEntityNotFound(_0x2f0245,null))[_0x4cd9('0x1c')](function(_0x26629b){if(_0x26629b){return _0x26629b[_0x4cd9('0x3c')](_0x577bf2['body']['ids'],_[_0x4cd9('0x3e')](_0x577bf2[_0x4cd9('0x38')],['ids','id'])||{});}})[_0x4cd9('0x1c')](respondWithResult(_0x2f0245,null))[_0x4cd9('0x2a')](handleError(_0x2f0245,null));};exports[_0x4cd9('0x3f')]=function(_0x5a2809,_0x2660a8){var _0x5b009b={'raw':![],'where':{}};var _0x5443a8={};var _0x32fd7b={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x4cd9('0x40')]({'where':{'id':_0x5a2809[_0x4cd9('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2660a8,null))[_0x4cd9('0x1c')](function(_0x20dc51){if(_0x20dc51){_0x5443a8['model']=_[_0x4cd9('0x2f')](db[_0x4cd9('0x3d')][_0x4cd9('0x23')]);_0x5443a8[_0x4cd9('0x29')]=_['keys'](_0x5a2809['query']);_0x5443a8[_0x4cd9('0x30')]=_[_0x4cd9('0x32')](_0x5443a8[_0x4cd9('0x2d')],_0x5443a8['query']);_0x5b009b[_0x4cd9('0x31')]=_[_0x4cd9('0x32')](_0x5443a8[_0x4cd9('0x2d')],qs[_0x4cd9('0x33')](_0x5a2809['query']['fields']));_0x5b009b[_0x4cd9('0x31')]=_0x5b009b[_0x4cd9('0x31')][_0x4cd9('0x34')]?_0x5b009b[_0x4cd9('0x31')]:_0x5443a8[_0x4cd9('0x2d')];if(!_0x5a2809[_0x4cd9('0x29')][_0x4cd9('0x41')](_0x4cd9('0x42'))){_0x5b009b[_0x4cd9('0x19')]=qs[_0x4cd9('0x19')](_0x5a2809[_0x4cd9('0x29')][_0x4cd9('0x19')]);_0x5b009b[_0x4cd9('0x16')]=qs['offset'](_0x5a2809['query']['offset']);}_0x5b009b[_0x4cd9('0x43')]=qs[_0x4cd9('0x44')](_0x5a2809['query']['sort']);_0x5b009b[_0x4cd9('0x45')]=qs[_0x4cd9('0x30')](_[_0x4cd9('0x46')](_0x5a2809[_0x4cd9('0x29')],_0x5443a8['filters']));_0x5b009b[_0x4cd9('0x45')][_0x4cd9('0x47')]=_0x20dc51['id'];if(_0x5a2809[_0x4cd9('0x29')]['filter']){_0x5b009b[_0x4cd9('0x45')]=_[_0x4cd9('0x36')](_0x5b009b[_0x4cd9('0x45')],{'$or':_[_0x4cd9('0x22')](_0x5b009b[_0x4cd9('0x31')],function(_0x2aadf0){var _0x230645={};_0x230645[_0x2aadf0]={'$like':'%'+_0x5a2809[_0x4cd9('0x29')][_0x4cd9('0x48')]+'%'};return _0x230645;})});}if(_0x5a2809[_0x4cd9('0x29')]['$gte']){var _0x5a29cd=_0x5a2809[_0x4cd9('0x29')][_0x4cd9('0x49')][_0x4cd9('0x4a')](',');var _0x2208d6={};_0x2208d6[_0x5a29cd[0x0]]={'$gte':moment(_0x5a29cd[0x1])[_0x4cd9('0x4b')](_0x4cd9('0x4c'))};_0x5b009b[_0x4cd9('0x45')]=_['merge'](_0x5b009b[_0x4cd9('0x45')],_0x2208d6);}_0x5b009b=_[_0x4cd9('0x36')]({},_0x5b009b,_0x5a2809[_0x4cd9('0x4d')]);return db[_0x4cd9('0x3d')][_0x4cd9('0x18')]({'where':_0x5b009b[_0x4cd9('0x45')]})[_0x4cd9('0x1c')](function(_0x4cd09f){_0x32fd7b[_0x4cd9('0x18')]=_0x4cd09f;if(_0x5a2809['query'][_0x4cd9('0x4e')]){_0x5b009b['include']=[{'all':!![]}];}return db[_0x4cd9('0x3d')][_0x4cd9('0x27')](_0x5b009b);})[_0x4cd9('0x1c')](function(_0x39e722){_0x32fd7b[_0x4cd9('0x4f')]=_0x39e722;return _0x32fd7b;});}})['then'](respondWithFilteredResult(_0x2660a8,_0x5b009b))[_0x4cd9('0x2a')](handleError(_0x2660a8,null));};exports[_0x4cd9('0x50')]=function(_0x4898d6,_0x21e46e){return db[_0x4cd9('0x2e')][_0x4cd9('0x3a')]({'where':{'id':_0x4898d6[_0x4cd9('0x2c')]['id']}})[_0x4cd9('0x1c')](handleEntityNotFound(_0x21e46e,null))[_0x4cd9('0x1c')](function(_0x1c93db){if(_0x1c93db){return _0x1c93db[_0x4cd9('0x51')](_0x4898d6[_0x4cd9('0x38')][_0x4cd9('0x52')],_[_0x4cd9('0x3e')](_0x4898d6[_0x4cd9('0x38')],[_0x4cd9('0x52'),'id'])||{})[_0x4cd9('0x53')](function(){return db[_0x4cd9('0x54')][_0x4cd9('0x27')]({'attributes':['id',_0x4cd9('0x20'),_0x4cd9('0x55')],'where':{'id':_0x4898d6[_0x4cd9('0x38')][_0x4cd9('0x52')]}});})[_0x4cd9('0x1c')](function(_0x1ac84e){socket[_0x4cd9('0x56')](_0x4cd9('0x57'),{'id':Number(_0x4898d6[_0x4cd9('0x2c')]['id']),'tags':_0x1ac84e||[]});return{'id':Number(_0x4898d6['params']['id']),'tags':_0x1ac84e||[]};});}})['then'](respondWithResult(_0x21e46e,null))[_0x4cd9('0x2a')](handleError(_0x21e46e,null));};exports['removeTags']=function(_0x59f259,_0x561a6b){return db[_0x4cd9('0x2e')]['find']({'where':{'id':_0x59f259['params']['id']}})[_0x4cd9('0x1c')](handleEntityNotFound(_0x561a6b,null))['then'](function(_0x3f0dbc){if(_0x3f0dbc){return _0x3f0dbc[_0x4cd9('0x58')](_0x59f259['query'][_0x4cd9('0x52')]);}})['then'](respondWithStatusCode(_0x561a6b,null))[_0x4cd9('0x2a')](handleError(_0x561a6b,null));};exports['download']=function(_0xfd8c90,_0x323b26){var _0x4838bb=moment()[_0x4cd9('0x59')]()[_0x4cd9('0x5a')]();var _0x400fb3=path['join'](config[_0x4cd9('0x5b')],_0x4cd9('0x5c'),'files','tmp');var _0x54ff06=path[_0x4cd9('0x5d')](config['root'],_0x4cd9('0x5c'),_0x4cd9('0x5e'),'attachments');var _0x3d29b2=path[_0x4cd9('0x5d')](_0x400fb3,_0x4838bb);var _0xbb61b=util[_0x4cd9('0x4b')]('transcript-%d-%s.zip',_0xfd8c90[_0x4cd9('0x2c')]['id'],_0x4838bb);var _0x43db7b=path[_0x4cd9('0x5d')](_0x400fb3,_0xbb61b);var _0x170a9d=[];_0x170a9d[_0x4cd9('0x5f')]({'model':db['User'],'as':_0x4cd9('0x60'),'attributes':['id',_0x4cd9('0x61')],'raw':!![]});_0x170a9d['push']({'model':db[_0x4cd9('0x62')],'as':'Contact','attributes':['id',_0x4cd9('0x63'),'lastName'],'raw':!![]});if(_0xfd8c90[_0x4cd9('0x29')]['attachments']){_0x170a9d[_0x4cd9('0x5f')]({'model':db[_0x4cd9('0x64')],'as':'Attachment','raw':!![]});}var _0x4df686=[{'model':db[_0x4cd9('0x3d')],'as':'Messages','attributes':['id',_0x4cd9('0x38'),_0x4cd9('0x65'),'direction',_0x4cd9('0x66'),_0x4cd9('0x67')],'include':_0x170a9d}];_0x4df686['push']({'model':db['WhatsappAccount'],'as':_0x4cd9('0x68'),'attributes':['id',_0x4cd9('0x20')]});_0x4df686[_0x4cd9('0x5f')]({'model':db['User'],'as':_0x4cd9('0x69'),'attributes':['id',_0x4cd9('0x61')]});return db[_0x4cd9('0x2e')][_0x4cd9('0x3a')]({'where':{'id':_0xfd8c90['params']['id']},'include':_0x4df686})[_0x4cd9('0x1c')](handleEntityNotFound(_0x323b26,null))[_0x4cd9('0x1c')](function(_0x1cff59){if(_0x1cff59){var _0x3ac22c=_0x1cff59[_0x4cd9('0x6a')]({'plain':!![]});fs[_0x4cd9('0x6b')](_0x3d29b2);var _0x5ca8b5={'channel':_0x4cd9('0x6c'),'account':_0x3ac22c[_0x4cd9('0x68')][_0x4cd9('0x20')],'agent':_0x3ac22c[_0x4cd9('0x69')]?_0x3ac22c[_0x4cd9('0x69')][_0x4cd9('0x61')]:_0x4cd9('0x6d'),'createdAt':moment(_0x3ac22c[_0x4cd9('0x65')])[_0x4cd9('0x4b')](_0x4cd9('0x4c'))[_0x4cd9('0x5a')](),'closedAt':_0x3ac22c[_0x4cd9('0x6e')]?moment(_0x3ac22c['closedAt'])[_0x4cd9('0x4b')](_0x4cd9('0x4c'))[_0x4cd9('0x5a')]():'','disposition':_0x3ac22c['disposition'],'messages':_(_0x3ac22c[_0x4cd9('0x6f')])[_0x4cd9('0x48')]({'secret':![]})['map'](function(_0x24e70b){if(_0x24e70b['Attachment']){var _0x1d955e=path[_0x4cd9('0x5d')](_0x54ff06,_0x24e70b['Attachment']['basename']);if(fs['existsSync'](_0x1d955e)){fs[_0x4cd9('0x70')](_0x1d955e)[_0x4cd9('0x71')](fs[_0x4cd9('0x72')](path[_0x4cd9('0x5d')](_0x3d29b2,_0x24e70b[_0x4cd9('0x64')][_0x4cd9('0x73')])));}}return{'date':moment(_0x24e70b[_0x4cd9('0x65')])[_0x4cd9('0x4b')](_0x4cd9('0x4c'))[_0x4cd9('0x5a')](),'sender':_0x24e70b[_0x4cd9('0x74')]==='out'?_0x24e70b['User']?_0x24e70b[_0x4cd9('0x60')][_0x4cd9('0x61')]:_0x4cd9('0x75'):_0x24e70b[_0x4cd9('0x76')][_0x4cd9('0x63')]+(_0x24e70b['Contact']['lastName']?'\x20'+_0x24e70b['Contact'][_0x4cd9('0x77')]:''),'body':_0x24e70b['Attachment']?_0x24e70b[_0x4cd9('0x64')]['basename']:_0x24e70b[_0x4cd9('0x38')],'direction':_0x24e70b['direction']==='out'?'A':'C','secret':_0x24e70b[_0x4cd9('0x66')],'read':_0x24e70b[_0x4cd9('0x67')],'attachment':_0x24e70b[_0x4cd9('0x64')]};})[_0x4cd9('0x78')]()};return ejs['renderFile'](path[_0x4cd9('0x5d')](config['root'],_0x4cd9('0x5c'),_0x4cd9('0x79'),_0x4cd9('0x7a')),{'interaction':_0x5ca8b5})[_0x4cd9('0x1c')](function(_0x33069d){var _0x3291df=path[_0x4cd9('0x5d')](_0x3d29b2,_0x4cd9('0x7b')+_0x3ac22c['id']+'-'+_0x4838bb+'.pdf');var _0x50c8f6={'path':_0x3291df,'channel':_0x4cd9('0x6c'),'interactionId':_0x3ac22c['id']};return pdf[_0x4cd9('0x7c')](_0x33069d,_0x50c8f6);})[_0x4cd9('0x1c')](function(){return new BPromise(function(_0x417c7d,_0x1632a3){zipdir(_0x3d29b2,{'saveTo':_0x43db7b},function(_0x2ccaf8,_0x45bfe3){if(_0x2ccaf8)return _0x1632a3(_0x2ccaf8);return _0x417c7d(_0x45bfe3);});})['then'](function(){return new BPromise(function(_0x510497,_0x1de422){rimraf(_0x3d29b2,function(_0x8b7805){if(_0x8b7805)_0x1de422(_0x8b7805);return _0x510497();});});})[_0x4cd9('0x1c')](function(){return _0x323b26['download'](_0x43db7b,_0xbb61b,function(_0x1e33ca){if(_0x1e33ca){console[_0x4cd9('0x7d')](_0x4cd9('0x7e'),_0x1e33ca);}else{fs[_0x4cd9('0x7f')](_0x43db7b);}});});});}else{return _0x323b26[_0x4cd9('0x13')](0xc8);}})[_0x4cd9('0x2a')](handleError(_0x323b26,null));}; \ No newline at end of file +var _0x19a7=['firstName','lastName','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','toString','disposition','Attachment','basename','existsSync','createReadStream','pipe','out','System','value','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync','rimraf','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','user','catch','show','model','keys','query','filters','intersection','attributes','length','includeAll','merge','options','find','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','fields','hasOwnProperty','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact'];(function(_0x3b6f58,_0x5870de){var _0x987c61=function(_0x3a9281){while(--_0x3a9281){_0x3b6f58['push'](_0x3b6f58['shift']());}};_0x987c61(++_0x5870de);}(_0x19a7,0x1a1));var _0x719a=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x19a7[_0xf50820];return _0x2a9b10;};'use strict';var rimraf=require(_0x719a('0x0'));var zipdir=require('zip-dir');var moment=require(_0x719a('0x1'));var BPromise=require(_0x719a('0x2'));var util=require(_0x719a('0x3'));var path=require(_0x719a('0x4'));var ejs=require(_0x719a('0x5'));var fs=require('fs');var _=require(_0x719a('0x6'));var Redis=require(_0x719a('0x7'));var interaction=require(_0x719a('0x8'));var qs=require(_0x719a('0x9'));var pdf=require(_0x719a('0xa'));var logger=require('../../config/logger')(_0x719a('0xb'));var config=require(_0x719a('0xc'));var db=require(_0x719a('0xd'))['db'];config[_0x719a('0xe')]=_[_0x719a('0xf')](config[_0x719a('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x719a('0x10'))(new Redis(config[_0x719a('0xe')]));require(_0x719a('0x11'))[_0x719a('0x12')](socket);function respondWithStatusCode(_0xf5062a,_0xd6514b){_0xd6514b=_0xd6514b||0xcc;return function(_0x189b3f){if(_0x189b3f){return _0xf5062a[_0x719a('0x13')](_0xd6514b);}return _0xf5062a[_0x719a('0x14')](_0xd6514b)[_0x719a('0x15')]();};}function respondWithResult(_0x4bbd02,_0x2ca05e){_0x2ca05e=_0x2ca05e||0xc8;return function(_0x295a43){if(_0x295a43){return _0x4bbd02[_0x719a('0x14')](_0x2ca05e)[_0x719a('0x16')](_0x295a43);}};}function respondWithFilteredResult(_0x2c90c5,_0x340ae1){return function(_0x5e2253){if(_0x5e2253){var _0x26d4ba=typeof _0x340ae1[_0x719a('0x17')]===_0x719a('0x18')&&typeof _0x340ae1[_0x719a('0x19')]===_0x719a('0x18');var _0x19ad9a=_0x5e2253[_0x719a('0x1a')];var _0x1e8525=_0x26d4ba?0x0:_0x340ae1[_0x719a('0x17')];var _0x303069=_0x26d4ba?_0x5e2253[_0x719a('0x1a')]:_0x340ae1['offset']+_0x340ae1[_0x719a('0x19')];var _0x22bbc1;if(_0x303069>=_0x19ad9a){_0x303069=_0x19ad9a;_0x22bbc1=0xc8;}else{_0x22bbc1=0xce;}_0x2c90c5[_0x719a('0x14')](_0x22bbc1);return _0x2c90c5[_0x719a('0x1b')](_0x719a('0x1c'),_0x1e8525+'-'+_0x303069+'/'+_0x19ad9a)[_0x719a('0x16')](_0x5e2253);}return null;};}function saveUpdates(_0x208c76){return function(_0x358fab){if(_0x358fab){return _0x358fab[_0x719a('0x1d')](_0x208c76)[_0x719a('0x1e')](function(_0x2436dd){return _0x2436dd;});}return null;};}function removeEntity(_0x293b16){return function(_0xaf8a12){if(_0xaf8a12){return _0xaf8a12[_0x719a('0x1f')]()[_0x719a('0x1e')](function(){_0x293b16[_0x719a('0x14')](0xcc)[_0x719a('0x15')]();});}};}function handleEntityNotFound(_0x5b2228){return function(_0xe5e96){if(!_0xe5e96){_0x5b2228[_0x719a('0x13')](0x194);}return _0xe5e96;};}function handleError(_0x338113,_0x501790){_0x501790=_0x501790||0x1f4;return function(_0x1006aa){logger['error'](_0x1006aa[_0x719a('0x20')]);if(_0x1006aa[_0x719a('0x21')]){delete _0x1006aa[_0x719a('0x21')];}_0x338113[_0x719a('0x14')](_0x501790)[_0x719a('0x22')](_0x1006aa);};}exports[_0x719a('0x23')]=function(_0x18188e,_0x24f006){var _0x1c98f6={};var _0x1dc07a=_[_0x719a('0x24')](db[_0x719a('0x25')][_0x719a('0x26')],function(_0x2f7f1a){return{'name':_0x2f7f1a[_0x719a('0x27')],'type':_0x2f7f1a[_0x719a('0x28')][_0x719a('0x29')]};});_0x1c98f6=qs[_0x719a('0x2a')](_0x1dc07a,_0x18188e);return interaction[_0x719a('0x2b')]('whatsapp',_0x18188e['query'],_0x18188e[_0x719a('0x2c')],_0x1c98f6,_0x1dc07a)[_0x719a('0x1e')](respondWithFilteredResult(_0x24f006,_0x1c98f6))[_0x719a('0x2d')](handleError(_0x24f006,null));};exports[_0x719a('0x2e')]=function(_0x4a8a00,_0x5b7eed){var _0x7dafd={'raw':![],'where':{'id':_0x4a8a00['params']['id']}},_0x24f722={};_0x24f722[_0x719a('0x2f')]=_[_0x719a('0x30')](db[_0x719a('0x25')][_0x719a('0x26')]);_0x24f722['query']=_[_0x719a('0x30')](_0x4a8a00[_0x719a('0x31')]);_0x24f722[_0x719a('0x32')]=_[_0x719a('0x33')](_0x24f722[_0x719a('0x2f')],_0x24f722[_0x719a('0x31')]);_0x7dafd[_0x719a('0x34')]=_[_0x719a('0x33')](_0x24f722[_0x719a('0x2f')],qs['fields'](_0x4a8a00['query']['fields']));_0x7dafd[_0x719a('0x34')]=_0x7dafd['attributes'][_0x719a('0x35')]?_0x7dafd[_0x719a('0x34')]:_0x24f722[_0x719a('0x2f')];if(_0x4a8a00[_0x719a('0x31')][_0x719a('0x36')]){_0x7dafd['include']=[{'all':!![]}];}_0x7dafd=_[_0x719a('0x37')]({},_0x7dafd,_0x4a8a00[_0x719a('0x38')]);return db[_0x719a('0x25')][_0x719a('0x39')](_0x7dafd)[_0x719a('0x1e')](handleEntityNotFound(_0x5b7eed,null))['then'](respondWithResult(_0x5b7eed,null))[_0x719a('0x2d')](handleError(_0x5b7eed,null));};exports[_0x719a('0x3a')]=function(_0x35de56,_0x19a59f){return db[_0x719a('0x25')][_0x719a('0x3a')](_0x35de56[_0x719a('0x3b')],{})[_0x719a('0x1e')](respondWithResult(_0x19a59f,0xc9))[_0x719a('0x2d')](handleError(_0x19a59f,null));};exports[_0x719a('0x1d')]=function(_0x5e2e5a,_0x3858ff){if(_0x5e2e5a[_0x719a('0x3b')]['id']){delete _0x5e2e5a[_0x719a('0x3b')]['id'];}return db[_0x719a('0x25')][_0x719a('0x39')]({'where':{'id':_0x5e2e5a[_0x719a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3858ff,null))[_0x719a('0x1e')](saveUpdates(_0x5e2e5a['body'],null))[_0x719a('0x1e')](respondWithResult(_0x3858ff,null))[_0x719a('0x2d')](handleError(_0x3858ff,null));};exports[_0x719a('0x1f')]=function(_0x4cb9c0,_0x1d02c8){return db[_0x719a('0x25')][_0x719a('0x39')]({'where':{'id':_0x4cb9c0['params']['id']}})[_0x719a('0x1e')](handleEntityNotFound(_0x1d02c8,null))[_0x719a('0x1e')](removeEntity(_0x1d02c8,null))[_0x719a('0x2d')](handleError(_0x1d02c8,null));};exports[_0x719a('0x3d')]=function(_0x5a0ad5,_0x23da82){return db['WhatsappInteraction']['describe']()['then'](respondWithResult(_0x23da82,null))[_0x719a('0x2d')](handleError(_0x23da82,null));};exports[_0x719a('0x3e')]=function(_0x22a2c9,_0x2075cf){return db['WhatsappMessage'][_0x719a('0x39')]({'where':{'id':_0x22a2c9['params']['id']}})[_0x719a('0x1e')](handleEntityNotFound(_0x2075cf,null))[_0x719a('0x1e')](function(_0x5b92ad){if(_0x5b92ad){return _0x5b92ad[_0x719a('0x3e')](_0x22a2c9[_0x719a('0x3b')][_0x719a('0x3f')],_[_0x719a('0x40')](_0x22a2c9[_0x719a('0x3b')],[_0x719a('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x2075cf,null))[_0x719a('0x2d')](handleError(_0x2075cf,null));};exports[_0x719a('0x41')]=function(_0x5e1ea3,_0x2a912e){var _0x44ba18={'raw':![],'where':{}};var _0x532cbf={};var _0xd5162={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x719a('0x42')]({'where':{'id':_0x5e1ea3[_0x719a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2a912e,null))[_0x719a('0x1e')](function(_0x165531){if(_0x165531){_0x532cbf['model']=_['keys'](db[_0x719a('0x43')][_0x719a('0x26')]);_0x532cbf[_0x719a('0x31')]=_['keys'](_0x5e1ea3['query']);_0x532cbf[_0x719a('0x32')]=_['intersection'](_0x532cbf['model'],_0x532cbf[_0x719a('0x31')]);_0x44ba18['attributes']=_[_0x719a('0x33')](_0x532cbf['model'],qs[_0x719a('0x44')](_0x5e1ea3['query'][_0x719a('0x44')]));_0x44ba18[_0x719a('0x34')]=_0x44ba18[_0x719a('0x34')]['length']?_0x44ba18[_0x719a('0x34')]:_0x532cbf[_0x719a('0x2f')];if(!_0x5e1ea3['query'][_0x719a('0x45')]('nolimit')){_0x44ba18[_0x719a('0x19')]=qs[_0x719a('0x19')](_0x5e1ea3['query'][_0x719a('0x19')]);_0x44ba18['offset']=qs[_0x719a('0x17')](_0x5e1ea3[_0x719a('0x31')][_0x719a('0x17')]);}_0x44ba18[_0x719a('0x46')]=qs['sort'](_0x5e1ea3['query'][_0x719a('0x47')]);_0x44ba18[_0x719a('0x48')]=qs[_0x719a('0x32')](_['pick'](_0x5e1ea3[_0x719a('0x31')],_0x532cbf[_0x719a('0x32')]));_0x44ba18['where'][_0x719a('0x49')]=_0x165531['id'];if(_0x5e1ea3[_0x719a('0x31')][_0x719a('0x4a')]){_0x44ba18[_0x719a('0x48')]=_[_0x719a('0x37')](_0x44ba18[_0x719a('0x48')],{'$or':_[_0x719a('0x24')](_0x44ba18[_0x719a('0x34')],function(_0x2b5c54){var _0xf04f3d={};_0xf04f3d[_0x2b5c54]={'$like':'%'+_0x5e1ea3[_0x719a('0x31')][_0x719a('0x4a')]+'%'};return _0xf04f3d;})});}if(_0x5e1ea3[_0x719a('0x31')][_0x719a('0x4b')]){var _0x134a22=_0x5e1ea3[_0x719a('0x31')][_0x719a('0x4b')][_0x719a('0x4c')](',');var _0x4c901e={};_0x4c901e[_0x134a22[0x0]]={'$gte':moment(_0x134a22[0x1])[_0x719a('0x4d')](_0x719a('0x4e'))};_0x44ba18['where']=_[_0x719a('0x37')](_0x44ba18[_0x719a('0x48')],_0x4c901e);}_0x44ba18=_['merge']({},_0x44ba18,_0x5e1ea3[_0x719a('0x38')]);return db[_0x719a('0x43')]['count']({'where':_0x44ba18['where']})[_0x719a('0x1e')](function(_0x13d818){_0xd5162[_0x719a('0x1a')]=_0x13d818;if(_0x5e1ea3['query']['includeAll']){_0x44ba18['include']=[{'all':!![]}];}return db[_0x719a('0x43')]['findAll'](_0x44ba18);})[_0x719a('0x1e')](function(_0x4ed028){_0xd5162[_0x719a('0x4f')]=_0x4ed028;return _0xd5162;});}})[_0x719a('0x1e')](respondWithFilteredResult(_0x2a912e,_0x44ba18))['catch'](handleError(_0x2a912e,null));};exports[_0x719a('0x50')]=function(_0x28dfd4,_0x5116b6){return db['WhatsappInteraction'][_0x719a('0x39')]({'where':{'id':_0x28dfd4[_0x719a('0x3c')]['id']}})[_0x719a('0x1e')](handleEntityNotFound(_0x5116b6,null))[_0x719a('0x1e')](function(_0x3094e9){if(_0x3094e9){return _0x3094e9['setTags'](_0x28dfd4['body'][_0x719a('0x3f')],_[_0x719a('0x40')](_0x28dfd4[_0x719a('0x3b')],['ids','id'])||{})[_0x719a('0x51')](function(){return db[_0x719a('0x52')]['findAll']({'attributes':['id',_0x719a('0x21'),'color'],'where':{'id':_0x28dfd4['body'][_0x719a('0x3f')]}});})[_0x719a('0x1e')](function(_0x107f79){socket['emit'](_0x719a('0x53'),{'id':Number(_0x28dfd4['params']['id']),'tags':_0x107f79||[]});return{'id':Number(_0x28dfd4[_0x719a('0x3c')]['id']),'tags':_0x107f79||[]};});}})['then'](respondWithResult(_0x5116b6,null))[_0x719a('0x2d')](handleError(_0x5116b6,null));};exports[_0x719a('0x54')]=function(_0x2e615e,_0x23c479){return db[_0x719a('0x25')][_0x719a('0x39')]({'where':{'id':_0x2e615e['params']['id']}})['then'](handleEntityNotFound(_0x23c479,null))[_0x719a('0x1e')](function(_0x136ffd){if(_0x136ffd){return _0x136ffd[_0x719a('0x54')](_0x2e615e[_0x719a('0x31')][_0x719a('0x3f')]);}})[_0x719a('0x1e')](respondWithStatusCode(_0x23c479,null))['catch'](handleError(_0x23c479,null));};exports[_0x719a('0x55')]=function(_0x2476d3,_0x4731df){var _0x1a267f=moment()[_0x719a('0x56')]()['toString']();var _0x1e9094=path[_0x719a('0x57')](config[_0x719a('0x58')],_0x719a('0x59'),_0x719a('0x5a'),_0x719a('0x5b'));var _0x1bba63=path[_0x719a('0x57')](config[_0x719a('0x58')],_0x719a('0x59'),_0x719a('0x5a'),_0x719a('0x5c'));var _0x2a3f5a=path[_0x719a('0x57')](_0x1e9094,_0x1a267f);var _0xb0cbab=util[_0x719a('0x4d')](_0x719a('0x5d'),_0x2476d3[_0x719a('0x3c')]['id'],_0x1a267f);var _0x2c08b0=path[_0x719a('0x57')](_0x1e9094,_0xb0cbab);var _0x5b2e5c=[];_0x5b2e5c[_0x719a('0x5e')]({'model':db['User'],'as':_0x719a('0x5f'),'attributes':['id',_0x719a('0x60')],'raw':!![]});_0x5b2e5c[_0x719a('0x5e')]({'model':db[_0x719a('0x61')],'as':_0x719a('0x62'),'attributes':['id',_0x719a('0x63'),_0x719a('0x64')],'raw':!![]});if(_0x2476d3['query']['attachments']){_0x5b2e5c['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x2436b0=[{'model':db['WhatsappMessage'],'as':_0x719a('0x65'),'attributes':['id',_0x719a('0x3b'),_0x719a('0x66'),_0x719a('0x67'),_0x719a('0x68'),_0x719a('0x69')],'include':_0x5b2e5c}];_0x2436b0[_0x719a('0x5e')]({'model':db['WhatsappAccount'],'as':_0x719a('0x6a'),'attributes':['id',_0x719a('0x21')]});_0x2436b0[_0x719a('0x5e')]({'model':db['User'],'as':_0x719a('0x6b'),'attributes':['id',_0x719a('0x60')]});return db[_0x719a('0x25')][_0x719a('0x39')]({'where':{'id':_0x2476d3[_0x719a('0x3c')]['id']},'include':_0x2436b0})[_0x719a('0x1e')](handleEntityNotFound(_0x4731df,null))['then'](function(_0x38f6bb){if(_0x38f6bb){var _0x26519e=_0x38f6bb[_0x719a('0x6c')]({'plain':!![]});fs[_0x719a('0x6d')](_0x2a3f5a);var _0x38961f={'channel':_0x719a('0x6e'),'account':_0x26519e[_0x719a('0x6a')]['name'],'agent':_0x26519e[_0x719a('0x6b')]?_0x26519e[_0x719a('0x6b')]['fullname']:_0x719a('0x6f'),'createdAt':moment(_0x26519e['createdAt'])[_0x719a('0x4d')](_0x719a('0x4e'))['toString'](),'closedAt':_0x26519e[_0x719a('0x70')]?moment(_0x26519e[_0x719a('0x71')])[_0x719a('0x4d')](_0x719a('0x4e'))[_0x719a('0x72')]():'','disposition':_0x26519e[_0x719a('0x73')],'messages':_(_0x26519e['Messages'])[_0x719a('0x4a')]({'secret':![]})[_0x719a('0x24')](function(_0x44b3f8){if(_0x44b3f8[_0x719a('0x74')]){var _0x266e50=path['join'](_0x1bba63,_0x44b3f8['Attachment'][_0x719a('0x75')]);if(fs[_0x719a('0x76')](_0x266e50)){fs[_0x719a('0x77')](_0x266e50)[_0x719a('0x78')](fs['createWriteStream'](path[_0x719a('0x57')](_0x2a3f5a,_0x44b3f8[_0x719a('0x74')][_0x719a('0x75')])));}}return{'date':moment(_0x44b3f8[_0x719a('0x66')])[_0x719a('0x4d')](_0x719a('0x4e'))[_0x719a('0x72')](),'sender':_0x44b3f8[_0x719a('0x67')]===_0x719a('0x79')?_0x44b3f8[_0x719a('0x5f')]?_0x44b3f8[_0x719a('0x5f')][_0x719a('0x60')]:_0x719a('0x7a'):_0x44b3f8[_0x719a('0x62')][_0x719a('0x63')]+(_0x44b3f8['Contact'][_0x719a('0x64')]?'\x20'+_0x44b3f8[_0x719a('0x62')][_0x719a('0x64')]:''),'body':_0x44b3f8[_0x719a('0x74')]?_0x44b3f8[_0x719a('0x74')][_0x719a('0x75')]:_0x44b3f8[_0x719a('0x3b')],'direction':_0x44b3f8[_0x719a('0x67')]===_0x719a('0x79')?'A':'C','secret':_0x44b3f8['secret'],'read':_0x44b3f8[_0x719a('0x69')],'attachment':_0x44b3f8['Attachment']};})[_0x719a('0x7b')]()};return ejs['renderFile'](path[_0x719a('0x57')](config[_0x719a('0x58')],_0x719a('0x59'),_0x719a('0x7c'),_0x719a('0x7d')),{'interaction':_0x38961f})[_0x719a('0x1e')](function(_0x334c0e){var _0x5c85ca=path[_0x719a('0x57')](_0x2a3f5a,'transcript-'+_0x26519e['id']+'-'+_0x1a267f+_0x719a('0x7e'));var _0x487b4e={'path':_0x5c85ca,'channel':'Whatsapp','interactionId':_0x26519e['id']};return pdf[_0x719a('0x7f')](_0x334c0e,_0x487b4e);})[_0x719a('0x1e')](function(){return new BPromise(function(_0x2b95da,_0x2b0722){zipdir(_0x2a3f5a,{'saveTo':_0x2c08b0},function(_0x1ede71,_0x550a26){if(_0x1ede71)return _0x2b0722(_0x1ede71);return _0x2b95da(_0x550a26);});})[_0x719a('0x1e')](function(){return new BPromise(function(_0x23aca2,_0xdf080c){rimraf(_0x2a3f5a,function(_0x43ecf5){if(_0x43ecf5)_0xdf080c(_0x43ecf5);return _0x23aca2();});});})['then'](function(){return _0x4731df['download'](_0x2c08b0,_0xb0cbab,function(_0x47d844){if(_0x47d844){console['log']('err',_0x47d844);}else{fs[_0x719a('0x80')](_0x2c08b0);}});});});}else{return _0x4731df[_0x719a('0x13')](0xc8);}})[_0x719a('0x2d')](handleError(_0x4731df,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 11d7277..5894072 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 _0x515d=['unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll'];(function(_0x110ffc,_0x186eb4){var _0x20543d=function(_0x22507c){while(--_0x22507c){_0x110ffc['push'](_0x110ffc['shift']());}};_0x20543d(++_0x186eb4);}(_0x515d,0x104));var _0xd515=function(_0x5846d1,_0x30e080){_0x5846d1=_0x5846d1-0x0;var _0x18cca3=_0x515d[_0x5846d1];return _0x18cca3;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xd515('0x0'))['db'][_0xd515('0x1')];var WhatsappMessage=require(_0xd515('0x0'))['db'][_0xd515('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd515('0x3')](0x0);var events={'afterCreate':_0xd515('0x4'),'afterUpdate':_0xd515('0x5'),'afterDestroy':_0xd515('0x6')};function emitEvent(_0x51e08b){return function(_0x1bd639,_0x544f53,_0x4d578b){_0x1bd639[_0xd515('0x7')]({'attributes':['id'],'raw':!![]})[_0xd515('0x8')](function(_0x43d633){_0x1bd639[_0xd515('0x9')](_0xd515('0xa'),_0x43d633['map'](function(_0x31d6b6){return{'id':_0x31d6b6['id']};}));return WhatsappMessage[_0xd515('0xb')]({'where':{'WhatsappInteractionId':_0x1bd639['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd515('0x8')](function(_0x423156){_0x1bd639[_0xd515('0x9')](_0xd515('0xc'),_0x423156['length']);WhatsappInteractionEvents[_0xd515('0xd')](_0x51e08b+':'+_0x1bd639['id'],_0x1bd639);WhatsappInteractionEvents[_0xd515('0xd')](_0x51e08b,_0x1bd639);_0x4d578b(null);})[_0xd515('0xe')](_0x4d578b(null));};}for(var e in events){if(events[_0xd515('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xd515('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x0834=['map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','WhatsappInteraction','../../mysqldb','update','remove','getUsers','setDataValue','Users'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x0834,0x18e));var _0x4083=function(_0x35dca4,_0x27b637){_0x35dca4=_0x35dca4-0x0;var _0x1b42b3=_0x0834[_0x35dca4];return _0x1b42b3;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x4083('0x0')];var WhatsappMessage=require(_0x4083('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4083('0x2'),'afterDestroy':_0x4083('0x3')};function emitEvent(_0x4e3837){return function(_0x3579bb,_0x32ea06,_0x50a894){_0x3579bb[_0x4083('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x31c7ef){_0x3579bb[_0x4083('0x5')](_0x4083('0x6'),_0x31c7ef[_0x4083('0x7')](function(_0x129337){return{'id':_0x129337['id']};}));return WhatsappMessage[_0x4083('0x8')]({'where':{'WhatsappInteractionId':_0x3579bb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4083('0x9')](function(_0x6db0e5){_0x3579bb[_0x4083('0x5')](_0x4083('0xa'),_0x6db0e5[_0x4083('0xb')]);WhatsappInteractionEvents[_0x4083('0xc')](_0x4e3837+':'+_0x3579bb['id'],_0x3579bb);WhatsappInteractionEvents[_0x4083('0xc')](_0x4e3837,_0x3579bb);_0x50a894(null);})[_0x4083('0xd')](_0x50a894(null));};}for(var e in events){if(events[_0x4083('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](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 a60990f..4aaaaa1 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 _0x4444=['define','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x4444,0x17e));var _0x4444=function(_0x4c3ac3,_0x7177d8){_0x4c3ac3=_0x4c3ac3-0x0;var _0xd7ff02=_0x4444[_0x4c3ac3];return _0xd7ff02;};'use strict';var _=require(_0x4444('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4444('0x1'));var BPromise=require(_0x4444('0x2'));var rp=require(_0x4444('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4444('0x4'));var config=require(_0x4444('0x5'));var attributes=require(_0x4444('0x6'));module[_0x4444('0x7')]=function(_0xbd770e,_0x51c6d6){return _0xbd770e[_0x4444('0x8')]('WhatsappInteraction',attributes,{'tableName':_0x4444('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ff5a7,_0x1426fc,_0x5ba64f){if(_0x4ff5a7['changed'](_0x4444('0xa'))){_0x4ff5a7['closedAt']=moment()[_0x4444('0xb')](_0x4444('0xc'));}_0x5ba64f(null,_0x4ff5a7);}}});}; \ No newline at end of file +var _0x2ec8=['api','moment','path','rimraf','../../config/environment','exports','define','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x2ec8,0xfd));var _0x82ec=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2ec8[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x82ec('0x0'));var util=require('util');var logger=require(_0x82ec('0x1'))(_0x82ec('0x2'));var moment=require(_0x82ec('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x82ec('0x4'));var rimraf=require(_0x82ec('0x5'));var config=require(_0x82ec('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0x82ec('0x7')]=function(_0x4c820c,_0x3ac4ef){return _0x4c820c[_0x82ec('0x8')]('WhatsappInteraction',attributes,{'tableName':_0x82ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5cf97f,_0x33fcd3,_0x52385f){if(_0x5cf97f[_0x82ec('0xa')](_0x82ec('0xb'))){_0x5cf97f[_0x82ec('0xc')]=moment()[_0x82ec('0xd')](_0x82ec('0xe'));}_0x52385f(null,_0x5cf97f);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c6a5eb0..78eb5cf 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 _0xbc6b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','options','raw','then','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','body','ids','omit','spread','AddTags','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbc6b,0xf5));var _0xbbc6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xbc6b[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xbbc6('0x0'));var util=require(_0xbbc6('0x1'));var moment=require(_0xbbc6('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbc6('0x3'));var fs=require('fs');var Redis=require(_0xbbc6('0x4'));var db=require(_0xbbc6('0x5'))['db'];var utils=require(_0xbbc6('0x6'));var logger=require(_0xbbc6('0x7'))(_0xbbc6('0x8'));var config=require(_0xbbc6('0x9'));var jayson=require(_0xbbc6('0xa'));var client=jayson[_0xbbc6('0xb')][_0xbbc6('0xc')]({'port':0x232a});config['redis']=_[_0xbbc6('0xd')](config[_0xbbc6('0xe')],{'host':_0xbbc6('0xf'),'port':0x18eb});var socket=require(_0xbbc6('0x10'))(new Redis(config['redis']));require(_0xbbc6('0x11'))[_0xbbc6('0x12')](socket);function respondWithRpcPromise(_0x56368e,_0x1c3f6a,_0x36fdfa){return new BPromise(function(_0x2b2bdb,_0x184f2c){return client[_0xbbc6('0x13')](_0x56368e,_0x36fdfa)['then'](function(_0x22a475){logger[_0xbbc6('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x1c3f6a,_0xbbc6('0x15'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1c3f6a,_0xbbc6('0x15'),JSON[_0xbbc6('0x16')](_0x22a475));if(_0x22a475['error']){if(_0x22a475[_0xbbc6('0x17')][_0xbbc6('0x18')]===0x1f4){logger[_0xbbc6('0x17')](_0xbbc6('0x19'),_0x1c3f6a,_0x22a475[_0xbbc6('0x17')]['message']);return _0x184f2c(_0x22a475[_0xbbc6('0x17')][_0xbbc6('0x1a')]);}logger[_0xbbc6('0x17')](_0xbbc6('0x19'),_0x1c3f6a,_0x22a475[_0xbbc6('0x17')][_0xbbc6('0x1a')]);return _0x2b2bdb(_0x22a475['error'][_0xbbc6('0x1a')]);}else{logger[_0xbbc6('0x14')](_0xbbc6('0x19'),_0x1c3f6a,'request\x20sent');_0x2b2bdb(_0x22a475['result'][_0xbbc6('0x1a')]);}})[_0xbbc6('0x1b')](function(_0x22f487){logger[_0xbbc6('0x17')](_0xbbc6('0x19'),_0x1c3f6a,_0x22f487);_0x184f2c(_0x22f487);});});}exports[_0xbbc6('0x1c')]=function(_0xf649e4){var _0x9f1e8e=this;return new Promise(function(_0x11c7da,_0x1f9ea1){return db['WhatsappInteraction']['update'](_0xf649e4['body'],{'raw':_0xf649e4[_0xbbc6('0x1d')]?_0xf649e4[_0xbbc6('0x1d')][_0xbbc6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf649e4[_0xbbc6('0x1d')]?_0xf649e4['options']['where']||null:null,'attributes':_0xf649e4['options']?_0xf649e4[_0xbbc6('0x1d')]['attributes']||null:null,'limit':_0xf649e4[_0xbbc6('0x1d')]?_0xf649e4[_0xbbc6('0x1d')]['limit']||null:null})[_0xbbc6('0x1f')](function(_0x20caa4){logger['info'](_0xbbc6('0x1c'),_0xf649e4);logger['debug'](_0xbbc6('0x1c'),_0xf649e4,JSON[_0xbbc6('0x16')](_0x20caa4));_0x11c7da(_0x20caa4);})[_0xbbc6('0x1b')](function(_0x377e9c){logger['error'](_0xbbc6('0x1c'),_0x377e9c[_0xbbc6('0x1a')],_0xf649e4);_0x1f9ea1(_0x9f1e8e[_0xbbc6('0x17')](0x1f4,_0x377e9c[_0xbbc6('0x1a')]));});});};exports[_0xbbc6('0x20')]=function(_0x24249a){return new Promise(function(_0x2b4f66,_0x4aa21b){return db[_0xbbc6('0x21')][_0xbbc6('0x22')]({'where':_0x24249a[_0xbbc6('0x1d')]?_0x24249a[_0xbbc6('0x1d')]['where']||null:null})[_0xbbc6('0x1f')](function(_0x4b72b0){if(_0x4b72b0){return _0x4b72b0[_0xbbc6('0x23')](_0x24249a[_0xbbc6('0x24')][_0xbbc6('0x25')],_[_0xbbc6('0x26')](_0x24249a[_0xbbc6('0x24')],[_0xbbc6('0x25'),'id'])||{});}})[_0xbbc6('0x27')](function(_0x147c91){logger[_0xbbc6('0x14')](_0xbbc6('0x28'),_0x24249a);logger[_0xbbc6('0x29')]('AddTags',_0x24249a,JSON[_0xbbc6('0x16')](_0x147c91));_0x2b4f66(_0x147c91);})[_0xbbc6('0x1b')](function(_0x4306eb){logger[_0xbbc6('0x17')](_0xbbc6('0x28'),_0x4306eb[_0xbbc6('0x1a')],_0x24249a);_0x4aa21b(_this[_0xbbc6('0x17')](0x1f4,_0x4306eb[_0xbbc6('0x1a')]));});});}; \ No newline at end of file +var _0xcc1d=['jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','limit','info','AddTagsToWhatsappInteraction','where','then','addTags','omit','ids','spread','AddTags','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2ef1a5,_0x316aac){var _0x268769=function(_0x28d1c5){while(--_0x28d1c5){_0x2ef1a5['push'](_0x2ef1a5['shift']());}};_0x268769(++_0x316aac);}(_0xcc1d,0x131));var _0xdcc1=function(_0x4eebd9,_0x57afb9){_0x4eebd9=_0x4eebd9-0x0;var _0x1d6117=_0xcc1d[_0x4eebd9];return _0x1d6117;};'use strict';var _=require(_0xdcc1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcc1('0x1'));var db=require(_0xdcc1('0x2'))['db'];var utils=require(_0xdcc1('0x3'));var logger=require(_0xdcc1('0x4'))(_0xdcc1('0x5'));var config=require(_0xdcc1('0x6'));var jayson=require(_0xdcc1('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xdcc1('0x8')]=_[_0xdcc1('0x9')](config['redis'],{'host':_0xdcc1('0xa'),'port':0x18eb});var socket=require(_0xdcc1('0xb'))(new Redis(config[_0xdcc1('0x8')]));require(_0xdcc1('0xc'))[_0xdcc1('0xd')](socket);function respondWithRpcPromise(_0x5e3ab0,_0x347a09,_0x2689e6){return new BPromise(function(_0x3cf570,_0x5a7172){return client[_0xdcc1('0xe')](_0x5e3ab0,_0x2689e6)['then'](function(_0x5df808){logger['info'](_0xdcc1('0xf'),_0x347a09,_0xdcc1('0x10'));logger[_0xdcc1('0x11')](_0xdcc1('0x12'),_0x347a09,'request\x20sent',JSON[_0xdcc1('0x13')](_0x5df808));if(_0x5df808[_0xdcc1('0x14')]){if(_0x5df808[_0xdcc1('0x14')]['code']===0x1f4){logger['error'](_0xdcc1('0xf'),_0x347a09,_0x5df808[_0xdcc1('0x14')][_0xdcc1('0x15')]);return _0x5a7172(_0x5df808[_0xdcc1('0x14')][_0xdcc1('0x15')]);}logger[_0xdcc1('0x14')](_0xdcc1('0xf'),_0x347a09,_0x5df808['error'][_0xdcc1('0x15')]);return _0x3cf570(_0x5df808[_0xdcc1('0x14')]['message']);}else{logger['info'](_0xdcc1('0xf'),_0x347a09,_0xdcc1('0x10'));_0x3cf570(_0x5df808[_0xdcc1('0x16')][_0xdcc1('0x15')]);}})[_0xdcc1('0x17')](function(_0x376fd2){logger[_0xdcc1('0x14')](_0xdcc1('0xf'),_0x347a09,_0x376fd2);_0x5a7172(_0x376fd2);});});}exports[_0xdcc1('0x18')]=function(_0x562393){var _0xa7d1b1=this;return new Promise(function(_0x46a6b7,_0x502306){return db[_0xdcc1('0x19')]['update'](_0x562393[_0xdcc1('0x1a')],{'raw':_0x562393[_0xdcc1('0x1b')]?_0x562393[_0xdcc1('0x1b')][_0xdcc1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x562393[_0xdcc1('0x1b')]?_0x562393[_0xdcc1('0x1b')]['where']||null:null,'attributes':_0x562393[_0xdcc1('0x1b')]?_0x562393[_0xdcc1('0x1b')]['attributes']||null:null,'limit':_0x562393[_0xdcc1('0x1b')]?_0x562393[_0xdcc1('0x1b')][_0xdcc1('0x1d')]||null:null})['then'](function(_0x2abfe1){logger[_0xdcc1('0x1e')]('UpdateWhatsappInteraction',_0x562393);logger[_0xdcc1('0x11')](_0xdcc1('0x18'),_0x562393,JSON[_0xdcc1('0x13')](_0x2abfe1));_0x46a6b7(_0x2abfe1);})['catch'](function(_0x2cfe7b){logger[_0xdcc1('0x14')](_0xdcc1('0x18'),_0x2cfe7b['message'],_0x562393);_0x502306(_0xa7d1b1['error'](0x1f4,_0x2cfe7b['message']));});});};exports[_0xdcc1('0x1f')]=function(_0xd736b3){return new Promise(function(_0x42b6a8,_0x4a05d3){return db[_0xdcc1('0x19')]['find']({'where':_0xd736b3[_0xdcc1('0x1b')]?_0xd736b3[_0xdcc1('0x1b')][_0xdcc1('0x20')]||null:null})[_0xdcc1('0x21')](function(_0x393964){if(_0x393964){return _0x393964[_0xdcc1('0x22')](_0xd736b3[_0xdcc1('0x1a')]['ids'],_[_0xdcc1('0x23')](_0xd736b3['body'],[_0xdcc1('0x24'),'id'])||{});}})[_0xdcc1('0x25')](function(_0x5a3aae){logger['info'](_0xdcc1('0x26'),_0xd736b3);logger[_0xdcc1('0x11')](_0xdcc1('0x26'),_0xd736b3,JSON[_0xdcc1('0x13')](_0x5a3aae));_0x42b6a8(_0x5a3aae);})['catch'](function(_0x455eeb){logger['error']('AddTags',_0x455eeb[_0xdcc1('0x15')],_0xd736b3);_0x4a05d3(_this['error'](0x1f4,_0x455eeb[_0xdcc1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index da60aad..019ac0b 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 _0xe97f=['removeListener','save','remove','update','emit'];(function(_0x3184f8,_0x2a8e27){var _0x834302=function(_0x157924){while(--_0x157924){_0x3184f8['push'](_0x3184f8['shift']());}};_0x834302(++_0x2a8e27);}(_0xe97f,0xec));var _0xfe97=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xe97f[_0x3e5086];return _0xfeb102;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xfe97('0x0'),_0xfe97('0x1'),_0xfe97('0x2')];function createListener(_0x2e6f4d,_0x4f46a0){return function(_0x5c1f9d){_0x4f46a0[_0xfe97('0x3')](_0x2e6f4d,_0x5c1f9d);};}function removeListener(_0x369d6f,_0x5ea213){return function(){WhatsappInteractionEvents[_0xfe97('0x4')](_0x369d6f,_0x5ea213);};}exports['register']=function(_0x41f0e4){for(var _0x1a70b0=0x0,_0x2bbae9=events['length'];_0x1a70b0<_0x2bbae9;_0x1a70b0++){var _0x12b5f9=events[_0x1a70b0];var _0x17dda8=createListener('whatsappInteraction:'+_0x12b5f9,_0x41f0e4);WhatsappInteractionEvents['on'](_0x12b5f9,_0x17dda8);}}; \ No newline at end of file +var _0x4358=['register','length','whatsappInteraction:','./whatsappInteraction.events','removeListener'];(function(_0x30a9f3,_0x54a3cc){var _0xd73d56=function(_0x3ff241){while(--_0x3ff241){_0x30a9f3['push'](_0x30a9f3['shift']());}};_0xd73d56(++_0x54a3cc);}(_0x4358,0x12f));var _0x8435=function(_0x5d9ceb,_0x1a49f5){_0x5d9ceb=_0x5d9ceb-0x0;var _0x33ce82=_0x4358[_0x5d9ceb];return _0x33ce82;};'use strict';var WhatsappInteractionEvents=require(_0x8435('0x0'));var events=['save','remove','update'];function createListener(_0x345358,_0x4ba344){return function(_0x2fb8c6){_0x4ba344['emit'](_0x345358,_0x2fb8c6);};}function removeListener(_0x383166,_0x6d79ed){return function(){WhatsappInteractionEvents[_0x8435('0x1')](_0x383166,_0x6d79ed);};}exports[_0x8435('0x2')]=function(_0x47e3ff){for(var _0x454ada=0x0,_0x5f4e0c=events[_0x8435('0x3')];_0x454ada<_0x5f4e0c;_0x454ada++){var _0x28fd52=events[_0x454ada];var _0x4dd55d=createListener(_0x8435('0x4')+_0x28fd52,_0x47e3ff);WhatsappInteractionEvents['on'](_0x28fd52,_0x4dd55d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index f894371..80ac56a 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 _0x5240=['put','update','accept','reject','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','tracked','whatsappmessage:create','/:id/status','status'];(function(_0x3a9c18,_0x3e275a){var _0x5b3938=function(_0x17b831){while(--_0x17b831){_0x3a9c18['push'](_0x3a9c18['shift']());}};_0x5b3938(++_0x3e275a);}(_0x5240,0x6f));var _0x0524=function(_0xa5d896,_0x263a1d){_0xa5d896=_0xa5d896-0x0;var _0x1c31f8=_0x5240[_0xa5d896];return _0x1c31f8;};'use strict';var multer=require('multer');var util=require(_0x0524('0x0'));var path=require(_0x0524('0x1'));var timeout=require('connect-timeout');var express=require(_0x0524('0x2'));var router=express[_0x0524('0x3')]();var fs_extra=require(_0x0524('0x4'));var auth=require(_0x0524('0x5'));var interaction=require(_0x0524('0x6'));var config=require(_0x0524('0x7'));var controller=require(_0x0524('0x8'));router['get']('/',auth[_0x0524('0x9')](),controller['index']);router[_0x0524('0xa')](_0x0524('0xb'),auth[_0x0524('0x9')](),controller[_0x0524('0xc')]);router[_0x0524('0xa')](_0x0524('0xd'),auth[_0x0524('0x9')](),controller[_0x0524('0xe')]);router['post']('/',auth[_0x0524('0x9')](),interaction[_0x0524('0xf')]('whatsapp',_0x0524('0x10')),controller['create']);router['post'](_0x0524('0x11'),controller[_0x0524('0x12')]);router[_0x0524('0x13')](_0x0524('0xd'),auth[_0x0524('0x9')](),controller[_0x0524('0x14')]);router['put']('/:id/accept',auth[_0x0524('0x9')](),controller[_0x0524('0x15')]);router[_0x0524('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x0524('0x16')]);router[_0x0524('0x17')](_0x0524('0xd'),auth[_0x0524('0x9')](),controller[_0x0524('0x18')]);module[_0x0524('0x19')]=router; \ No newline at end of file +var _0xbe05=['accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','tracked','whatsapp','whatsappmessage:create','create','post','put','update','/:id/accept'];(function(_0x547510,_0x30e1c5){var _0x273c31=function(_0x51caf5){while(--_0x51caf5){_0x547510['push'](_0x547510['shift']());}};_0x273c31(++_0x30e1c5);}(_0xbe05,0xa1));var _0x5be0=function(_0x1dedd3,_0x5ce4b0){_0x1dedd3=_0x1dedd3-0x0;var _0x15cba6=_0xbe05[_0x1dedd3];return _0x15cba6;};'use strict';var multer=require('multer');var util=require(_0x5be0('0x0'));var path=require(_0x5be0('0x1'));var timeout=require(_0x5be0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5be0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5be0('0x4'));var config=require(_0x5be0('0x5'));var controller=require(_0x5be0('0x6'));router[_0x5be0('0x7')]('/',auth[_0x5be0('0x8')](),controller[_0x5be0('0x9')]);router[_0x5be0('0x7')](_0x5be0('0xa'),auth[_0x5be0('0x8')](),controller[_0x5be0('0xb')]);router['get'](_0x5be0('0xc'),auth[_0x5be0('0x8')](),controller['show']);router['post']('/',auth[_0x5be0('0x8')](),interaction[_0x5be0('0xd')](_0x5be0('0xe'),_0x5be0('0xf')),controller[_0x5be0('0x10')]);router[_0x5be0('0x11')]('/:id/status',controller['status']);router[_0x5be0('0x12')](_0x5be0('0xc'),auth[_0x5be0('0x8')](),controller[_0x5be0('0x13')]);router['put'](_0x5be0('0x14'),auth['isAuthenticated'](),controller[_0x5be0('0x15')]);router[_0x5be0('0x12')](_0x5be0('0x16'),auth[_0x5be0('0x8')](),controller[_0x5be0('0x17')]);router[_0x5be0('0x18')]('/:id',auth[_0x5be0('0x8')](),controller[_0x5be0('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index dd27531..571dd0e 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 _0xe8cf=['ENUM','out','DATE','BOOLEAN','STRING','TEXT','sequelize','exports'];(function(_0x2895cf,_0x2b0feb){var _0xdd7f19=function(_0x1d3d10){while(--_0x1d3d10){_0x2895cf['push'](_0x2895cf['shift']());}};_0xdd7f19(++_0x2b0feb);}(_0xe8cf,0xb6));var _0xfe8c=function(_0x397cf1,_0xe713f1){_0x397cf1=_0x397cf1-0x0;var _0x608ef9=_0xe8cf[_0x397cf1];return _0x608ef9;};'use strict';var Sequelize=require(_0xfe8c('0x0'));module[_0xfe8c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfe8c('0x2')]('in',_0xfe8c('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xfe8c('0x4')]},'secret':{'type':Sequelize[_0xfe8c('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfe8c('0x6')]},'providerResponse':{'type':Sequelize[_0xfe8c('0x7')]}}; \ No newline at end of file +var _0x8454=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x4d7682,_0x373768){var _0x58af3d=function(_0x15aab8){while(--_0x15aab8){_0x4d7682['push'](_0x4d7682['shift']());}};_0x58af3d(++_0x373768);}(_0x8454,0x1a4));var _0x4845=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x8454[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x4845('0x0'));module[_0x4845('0x1')]={'body':{'type':Sequelize[_0x4845('0x2')](_0x4845('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4845('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4845('0x5')]('in',_0x4845('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x4845('0x7')](0xbe)},'phone':{'type':Sequelize[_0x4845('0x7')]},'readAt':{'type':Sequelize[_0x4845('0x8')]},'secret':{'type':Sequelize[_0x4845('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'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 dde011f..1cdf93b 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 _0x7dd6=['attributes','length','hasOwnProperty','nolimit','sort','filter','where','type','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','create','body','find','describe','accept','whatsapp','acceptMessage','UserId','user','agent','WhatsappInteraction','interaction','info','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','interface','SIP/%s','channel','motionChannel','reject','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','client','http','whatsapp-interactions','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','json','offset','limit','undefined','count','status','set','Content-Range','update','name','send','index','WhatsappMessage','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields'];(function(_0x516336,_0x30394e){var _0x48195c=function(_0x3bfa84){while(--_0x3bfa84){_0x516336['push'](_0x516336['shift']());}};_0x48195c(++_0x30394e);}(_0x7dd6,0xa7));var _0x67dd=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x7dd6[_0x13b8f3];return _0x1a6d06;};'use strict';var util=require(_0x67dd('0x0'));var _=require('lodash');var Redis=require(_0x67dd('0x1'));var interactionService=require(_0x67dd('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x67dd('0x3'))(_0x67dd('0x4'));var config=require(_0x67dd('0x5'));var db=require(_0x67dd('0x6'))['db'];config['redis']=_['defaults'](config[_0x67dd('0x7')],{'host':_0x67dd('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x67dd('0x7')]));require(_0x67dd('0x9'))[_0x67dd('0xa')](socket);var jayson=require('jayson/promise');var client=jayson[_0x67dd('0xb')][_0x67dd('0xc')]({'port':0x232c});var client9002=jayson[_0x67dd('0xb')][_0x67dd('0xc')]({'port':0x232a});var interaction_log=require(_0x67dd('0x3'))(_0x67dd('0xd'));function respondWithRpcPromise(_0x11caf6,_0x37ed58,_0x3f5eae,_0x336032){return new Promise(function(_0x98b3a3,_0x4accd6){var _0x1ccd09=_0x336032||client;return _0x1ccd09[_0x67dd('0xe')](_0x11caf6,_0x3f5eae)[_0x67dd('0xf')](function(_0x33b32f){logger['info'](_0x67dd('0x10'),_0x37ed58,_0x67dd('0x11'));logger[_0x67dd('0x12')](_0x67dd('0x13'),_0x37ed58,_0x67dd('0x11'),JSON['stringify'](_0x33b32f));if(_0x33b32f[_0x67dd('0x14')]){if(_0x33b32f[_0x67dd('0x14')][_0x67dd('0x15')]===0x1f4){logger['error'](_0x67dd('0x10'),_0x37ed58,_0x33b32f[_0x67dd('0x14')]['message']);return _0x4accd6(_0x33b32f[_0x67dd('0x14')][_0x67dd('0x16')]);}logger[_0x67dd('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x37ed58,_0x33b32f[_0x67dd('0x14')]['message']);return _0x98b3a3(_0x33b32f[_0x67dd('0x14')][_0x67dd('0x16')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x37ed58,'request\x20sent');_0x98b3a3(_0x33b32f[_0x67dd('0x17')][_0x67dd('0x16')]);}})['catch'](function(_0x39de84){logger[_0x67dd('0x14')](_0x67dd('0x10'),_0x37ed58,_0x39de84);_0x4accd6(_0x39de84);});});}function respondWithResult(_0x7b17d3,_0x2a6033){_0x2a6033=_0x2a6033||0xc8;return function(_0x16b708){if(_0x16b708){return _0x7b17d3['status'](_0x2a6033)[_0x67dd('0x18')](_0x16b708);}};}function respondWithFilteredResult(_0x5b75b7,_0x339a2e){return function(_0x534f34){if(_0x534f34){var _0x3ab631=typeof _0x339a2e[_0x67dd('0x19')]==='undefined'&&typeof _0x339a2e[_0x67dd('0x1a')]===_0x67dd('0x1b');var _0x17c929=_0x534f34[_0x67dd('0x1c')];var _0x1ec18f=_0x3ab631?0x0:_0x339a2e[_0x67dd('0x19')];var _0x3a5cba=_0x3ab631?_0x534f34[_0x67dd('0x1c')]:_0x339a2e[_0x67dd('0x19')]+_0x339a2e[_0x67dd('0x1a')];var _0x5b3de0;if(_0x3a5cba>=_0x17c929){_0x3a5cba=_0x17c929;_0x5b3de0=0xc8;}else{_0x5b3de0=0xce;}_0x5b75b7[_0x67dd('0x1d')](_0x5b3de0);return _0x5b75b7[_0x67dd('0x1e')](_0x67dd('0x1f'),_0x1ec18f+'-'+_0x3a5cba+'/'+_0x17c929)[_0x67dd('0x18')](_0x534f34);}return null;};}function saveUpdates(_0x5caf3d){return function(_0x471282){if(_0x471282){return _0x471282[_0x67dd('0x20')](_0x5caf3d)[_0x67dd('0xf')](function(_0x38e583){return _0x38e583;});}return null;};}function removeEntity(_0x2bc772){return function(_0x462160){if(_0x462160){return _0x462160['destroy']()['then'](function(){_0x2bc772[_0x67dd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8d04){return function(_0x115c48){if(!_0x115c48){_0x4b8d04['sendStatus'](0x194);}return _0x115c48;};}function handleError(_0x2f2aab,_0x40db53){_0x40db53=_0x40db53||0x1f4;return function(_0x359c9c){logger[_0x67dd('0x14')](_0x359c9c['stack']);if(_0x359c9c[_0x67dd('0x21')]){delete _0x359c9c[_0x67dd('0x21')];}_0x2f2aab[_0x67dd('0x1d')](_0x40db53)[_0x67dd('0x22')](_0x359c9c);};}exports[_0x67dd('0x23')]=function(_0x2d4895,_0xcb02e1){var _0x4a9443={},_0x17a475={},_0x261a6b={'count':0x0,'rows':[]};var _0x58a4d6=_['map'](db[_0x67dd('0x24')][_0x67dd('0x25')],function(_0x2e3142){return{'name':_0x2e3142[_0x67dd('0x26')],'type':_0x2e3142['type'][_0x67dd('0x27')]};});_0x17a475['model']=_[_0x67dd('0x28')](_0x58a4d6,_0x67dd('0x21'));_0x17a475[_0x67dd('0x29')]=_[_0x67dd('0x2a')](_0x2d4895[_0x67dd('0x29')]);_0x17a475[_0x67dd('0x2b')]=_[_0x67dd('0x2c')](_0x17a475[_0x67dd('0x2d')],_0x17a475['query']);_0x4a9443['attributes']=_[_0x67dd('0x2c')](_0x17a475[_0x67dd('0x2d')],qs[_0x67dd('0x2e')](_0x2d4895[_0x67dd('0x29')][_0x67dd('0x2e')]));_0x4a9443[_0x67dd('0x2f')]=_0x4a9443[_0x67dd('0x2f')][_0x67dd('0x30')]?_0x4a9443['attributes']:_0x17a475[_0x67dd('0x2d')];if(!_0x2d4895[_0x67dd('0x29')][_0x67dd('0x31')](_0x67dd('0x32'))){_0x4a9443['limit']=qs[_0x67dd('0x1a')](_0x2d4895[_0x67dd('0x29')][_0x67dd('0x1a')]);_0x4a9443[_0x67dd('0x19')]=qs[_0x67dd('0x19')](_0x2d4895[_0x67dd('0x29')][_0x67dd('0x19')]);}_0x4a9443['order']=qs[_0x67dd('0x33')](_0x2d4895[_0x67dd('0x29')][_0x67dd('0x33')]);_0x4a9443['where']=qs['filters'](_['pick'](_0x2d4895[_0x67dd('0x29')],_0x17a475[_0x67dd('0x2b')]),_0x58a4d6);if(_0x2d4895[_0x67dd('0x29')][_0x67dd('0x34')]){_0x4a9443[_0x67dd('0x35')]=_['merge'](_0x4a9443[_0x67dd('0x35')],{'$or':_['map'](_0x58a4d6,function(_0x43f2e6){if(_0x43f2e6[_0x67dd('0x36')]!==_0x67dd('0x37')){var _0x2bd08b={};_0x2bd08b[_0x43f2e6[_0x67dd('0x21')]]={'$like':'%'+_0x2d4895[_0x67dd('0x29')][_0x67dd('0x34')]+'%'};return _0x2bd08b;}})});}_0x4a9443=_[_0x67dd('0x38')]({},_0x4a9443,_0x2d4895[_0x67dd('0x39')]);var _0x58d0c2={'where':_0x4a9443[_0x67dd('0x35')]};return db[_0x67dd('0x24')][_0x67dd('0x1c')](_0x58d0c2)[_0x67dd('0xf')](function(_0x55af5d){_0x261a6b[_0x67dd('0x1c')]=_0x55af5d;if(_0x2d4895[_0x67dd('0x29')]['includeAll']){_0x4a9443[_0x67dd('0x3a')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x67dd('0x3b')](_0x4a9443);})[_0x67dd('0xf')](function(_0x1ab461){_0x261a6b[_0x67dd('0x3c')]=_0x1ab461;return _0x261a6b;})['then'](respondWithFilteredResult(_0xcb02e1,_0x4a9443))[_0x67dd('0x3d')](handleError(_0xcb02e1,null));};exports['show']=function(_0x1e697f,_0x33594a){var _0x108bab={'raw':!![],'where':{'id':_0x1e697f[_0x67dd('0x3e')]['id']}},_0x4d402a={};_0x4d402a[_0x67dd('0x2d')]=_[_0x67dd('0x2a')](db['WhatsappMessage'][_0x67dd('0x25')]);_0x4d402a[_0x67dd('0x29')]=_[_0x67dd('0x2a')](_0x1e697f[_0x67dd('0x29')]);_0x4d402a[_0x67dd('0x2b')]=_[_0x67dd('0x2c')](_0x4d402a[_0x67dd('0x2d')],_0x4d402a[_0x67dd('0x29')]);_0x108bab[_0x67dd('0x2f')]=_[_0x67dd('0x2c')](_0x4d402a[_0x67dd('0x2d')],qs[_0x67dd('0x2e')](_0x1e697f[_0x67dd('0x29')]['fields']));_0x108bab[_0x67dd('0x2f')]=_0x108bab['attributes'][_0x67dd('0x30')]?_0x108bab[_0x67dd('0x2f')]:_0x4d402a['model'];if(_0x1e697f[_0x67dd('0x29')][_0x67dd('0x3f')]){_0x108bab[_0x67dd('0x3a')]=[{'all':!![]}];}_0x108bab=_[_0x67dd('0x38')]({},_0x108bab,_0x1e697f['options']);return db[_0x67dd('0x24')]['find'](_0x108bab)[_0x67dd('0xf')](handleEntityNotFound(_0x33594a,null))[_0x67dd('0xf')](respondWithResult(_0x33594a,null))[_0x67dd('0x3d')](handleError(_0x33594a,null));};exports[_0x67dd('0x40')]=function(_0x58c04f,_0x43ae05){return db[_0x67dd('0x24')][_0x67dd('0x40')](_0x58c04f[_0x67dd('0x41')],{})[_0x67dd('0xf')](respondWithResult(_0x43ae05,0xc9))[_0x67dd('0x3d')](handleError(_0x43ae05,null));};exports[_0x67dd('0x20')]=function(_0x9b5db1,_0x3c0b70){if(_0x9b5db1[_0x67dd('0x41')]['id']){delete _0x9b5db1[_0x67dd('0x41')]['id'];}return db[_0x67dd('0x24')][_0x67dd('0x42')]({'where':{'id':_0x9b5db1[_0x67dd('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3c0b70,null))[_0x67dd('0xf')](saveUpdates(_0x9b5db1[_0x67dd('0x41')],null))['then'](respondWithResult(_0x3c0b70,null))['catch'](handleError(_0x3c0b70,null));};exports['destroy']=function(_0x561a2b,_0x36fcac){return db[_0x67dd('0x24')][_0x67dd('0x42')]({'where':{'id':_0x561a2b[_0x67dd('0x3e')]['id']}})['then'](handleEntityNotFound(_0x36fcac,null))[_0x67dd('0xf')](removeEntity(_0x36fcac,null))[_0x67dd('0x3d')](handleError(_0x36fcac,null));};exports[_0x67dd('0x43')]=function(_0x1784ab,_0x1a2ec6){return db[_0x67dd('0x24')][_0x67dd('0x43')]()[_0x67dd('0xf')](respondWithResult(_0x1a2ec6,null))[_0x67dd('0x3d')](handleError(_0x1a2ec6,null));};exports[_0x67dd('0x44')]=function(_0x569ef4,_0x48e8b2){var _0x42db93=_0x67dd('0x45');return interactionService[_0x67dd('0x46')](_0x569ef4,_0x42db93)[_0x67dd('0xf')](respondWithResult(_0x48e8b2,null))[_0x67dd('0x3d')](handleError(_0x48e8b2,null));};exports['reject']=function(_0x487635,_0x288b26){var _0x5c62cb={'agent':{},'channel':_0x67dd('0x45')};if(_0x487635[_0x67dd('0x41')]['id']){delete _0x487635[_0x67dd('0x41')]['id'];}_0x487635['body'][_0x67dd('0x47')]=_0x487635[_0x67dd('0x41')]['UserId']||_0x487635[_0x67dd('0x48')]['id'];_0x5c62cb[_0x67dd('0x49')]['id']=_0x487635[_0x67dd('0x41')][_0x67dd('0x47')];return db[_0x67dd('0x24')][_0x67dd('0x42')]({'where':{'id':_0x487635[_0x67dd('0x3e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x288b26,null))[_0x67dd('0xf')](function(_0x3e0fbb){if(_0x3e0fbb){_0x5c62cb[_0x67dd('0x16')]=_0x3e0fbb['get']({'plain':!![]});return db[_0x67dd('0x4a')][_0x67dd('0x42')]({'where':{'id':_0x3e0fbb['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x288b26,null))[_0x67dd('0xf')](function(_0x49e735){if(_0x49e735){_0x5c62cb[_0x67dd('0x4b')]=_0x49e735['get']({'plain':!![]});interaction_log[_0x67dd('0x4c')](_0x67dd('0x4d'),_0x487635[_0x67dd('0x48')]['id'],_0x487635[_0x67dd('0x48')][_0x67dd('0x21')],_0x487635[_0x67dd('0x48')][_0x67dd('0x4e')],_0x5c62cb[_0x67dd('0x4b')]['id'],_0x487635[_0x67dd('0x41')]?JSON['stringify'](_0x487635['body']):'null');return respondWithRpcPromise(_0x67dd('0x4f'),_0x67dd('0x50'),_0x5c62cb);}return null;})[_0x67dd('0xf')](function(_0x38745f){var _0x3efe65='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x38745f[_0x67dd('0x16')][_0x67dd('0x51')];return db[_0x67dd('0x52')][_0x67dd('0x29')](_0x3efe65,{'type':db[_0x67dd('0x53')][_0x67dd('0x54')]['SELECT'],'raw':!![]})['then'](function(_0x4a0591){return _0x4a0591;});})[_0x67dd('0xf')](function(_0x3a92db){if(_0x3a92db){_0x5c62cb[_0x67dd('0x16')][_0x67dd('0x55')]=_0x3a92db[0x0];if(!_0x487635[_0x67dd('0x41')]['UserId'])return;return db['User'][_0x67dd('0x42')]({'where':{'id':_0x487635['body']['UserId'],'role':'agent'},'attributes':['id',_0x67dd('0x21'),_0x67dd('0x56'),_0x67dd('0x57'),_0x67dd('0x58')],'raw':!![]});}return null;})[_0x67dd('0xf')](function(_0x277c0d){if(!_0x277c0d)return null;_0x5c62cb[_0x67dd('0x16')][_0x67dd('0x49')]=_0x277c0d;return _0x5c62cb;})[_0x67dd('0xf')](function(_0x582ed4){if(_0x582ed4){_0x582ed4[_0x67dd('0x16')][_0x67dd('0x59')]=util['format'](_0x67dd('0x5a'),_0x487635[_0x67dd('0x48')][_0x67dd('0x21')]);_0x582ed4['message']['channel']=_0x5c62cb[_0x67dd('0x5b')];_0x582ed4[_0x67dd('0x16')][_0x67dd('0x5c')]=_0x5c62cb[_0x67dd('0x5b')];_0x582ed4[_0x67dd('0x16')]['event']=_0x67dd('0x5d');respondWithRpcPromise(_0x67dd('0x5e'),'EventManager',{'event':_0x67dd('0x5f'),'message':_0x582ed4[_0x67dd('0x16')]},client9002);return _0x5c62cb;}return null;})['then'](respondWithResult(_0x288b26,null))[_0x67dd('0x3d')](handleError(_0x288b26,null));};exports[_0x67dd('0x1d')]=function(_0x25db82,_0xa3393b){if(_0x25db82[_0x67dd('0x41')]['id']){delete _0x25db82[_0x67dd('0x41')]['id'];}var _0x2dc824;return db[_0x67dd('0x24')][_0x67dd('0x42')]({'where':{'id':_0x25db82[_0x67dd('0x3e')]['id']}})[_0x67dd('0xf')](handleEntityNotFound(_0xa3393b,null))[_0x67dd('0xf')](function(_0xfe3c5e){if(_0xfe3c5e){_0x2dc824=_0xfe3c5e;return db[_0x67dd('0x60')]['find']({'where':{'id':_0xfe3c5e[_0x67dd('0x61')]}});}})[_0x67dd('0xf')](handleEntityNotFound(_0xa3393b,null))[_0x67dd('0xf')](function(_0x412162){if(_0x412162){logger[_0x67dd('0x12')](_0x67dd('0x62'),_0x67dd('0x1d'),_0x67dd('0x63'),_0x412162[_0x67dd('0x36')],util[_0x67dd('0x64')](_0x25db82[_0x67dd('0x41')],{'showHidden':![],'depth':null}));switch(_0x412162[_0x67dd('0x36')]){case _0x67dd('0x65'):if(_0x25db82[_0x67dd('0x41')][_0x67dd('0x66')]&&_0x25db82[_0x67dd('0x41')][_0x67dd('0x66')]===_0x2dc824[_0x67dd('0x67')]&&_0x25db82[_0x67dd('0x41')]['MessageStatus']&&_0x25db82[_0x67dd('0x41')][_0x67dd('0x68')]===_0x67dd('0x69')){return _0x2dc824[_0x67dd('0x20')]({'read':!![]});}else{logger['error'](_0x67dd('0x6a'),_0x67dd('0x1d'),_0x67dd('0x65'),util[_0x67dd('0x64')](_0x25db82['body'],{'showHidden':![],'depth':null}));}break;}return _0x2dc824;}})[_0x67dd('0xf')](respondWithResult(_0xa3393b,null))['catch'](handleError(_0xa3393b,null));}; \ No newline at end of file +var _0x834c=['request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','offset','undefined','limit','count','Content-Range','destroy','status','sendStatus','stack','name','send','map','WhatsappMessage','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','show','params','length','create','body','update','find','describe','accept','whatsapp','reject','UserId','user','get','WhatsappInteraction','interaction','role','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','./whatsappMessage.socket','register','jayson/promise','client','whatsapp-interactions','request','info','WhatsappMessage,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x834c,0x194));var _0xc834=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x834c[_0x55969b];return _0x3d7fc1;};'use strict';var util=require(_0xc834('0x0'));var _=require(_0xc834('0x1'));var Redis=require(_0xc834('0x2'));var interactionService=require(_0xc834('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xc834('0x4'))(_0xc834('0x5'));var config=require(_0xc834('0x6'));var db=require('../../mysqldb')['db'];config[_0xc834('0x7')]=_['defaults'](config[_0xc834('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc834('0x7')]));require(_0xc834('0x8'))[_0xc834('0x9')](socket);var jayson=require(_0xc834('0xa'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc834('0xb')]['http']({'port':0x232a});var interaction_log=require(_0xc834('0x4'))(_0xc834('0xc'));function respondWithRpcPromise(_0x367f20,_0x1b76c2,_0xce9724,_0x14c699){return new Promise(function(_0x510871,_0x523c9d){var _0x28fc64=_0x14c699||client;return _0x28fc64[_0xc834('0xd')](_0x367f20,_0xce9724)['then'](function(_0x2c0d5a){logger[_0xc834('0xe')](_0xc834('0xf'),_0x1b76c2,_0xc834('0x10'));logger[_0xc834('0x11')](_0xc834('0x12'),_0x1b76c2,_0xc834('0x10'),JSON['stringify'](_0x2c0d5a));if(_0x2c0d5a[_0xc834('0x13')]){if(_0x2c0d5a[_0xc834('0x13')][_0xc834('0x14')]===0x1f4){logger['error'](_0xc834('0xf'),_0x1b76c2,_0x2c0d5a[_0xc834('0x13')]['message']);return _0x523c9d(_0x2c0d5a[_0xc834('0x13')][_0xc834('0x15')]);}logger[_0xc834('0x13')](_0xc834('0xf'),_0x1b76c2,_0x2c0d5a[_0xc834('0x13')][_0xc834('0x15')]);return _0x510871(_0x2c0d5a[_0xc834('0x13')][_0xc834('0x15')]);}else{logger[_0xc834('0xe')](_0xc834('0xf'),_0x1b76c2,_0xc834('0x10'));_0x510871(_0x2c0d5a[_0xc834('0x16')][_0xc834('0x15')]);}})[_0xc834('0x17')](function(_0x31fd02){logger[_0xc834('0x13')](_0xc834('0xf'),_0x1b76c2,_0x31fd02);_0x523c9d(_0x31fd02);});});}function respondWithResult(_0x4365d6,_0x4f84f4){_0x4f84f4=_0x4f84f4||0xc8;return function(_0x4117d7){if(_0x4117d7){return _0x4365d6['status'](_0x4f84f4)[_0xc834('0x18')](_0x4117d7);}};}function respondWithFilteredResult(_0x25ac36,_0x54b739){return function(_0x45f572){if(_0x45f572){var _0x54ca1c=typeof _0x54b739[_0xc834('0x19')]===_0xc834('0x1a')&&typeof _0x54b739[_0xc834('0x1b')]===_0xc834('0x1a');var _0x3bd514=_0x45f572[_0xc834('0x1c')];var _0x2de747=_0x54ca1c?0x0:_0x54b739[_0xc834('0x19')];var _0x3d5704=_0x54ca1c?_0x45f572[_0xc834('0x1c')]:_0x54b739[_0xc834('0x19')]+_0x54b739['limit'];var _0x4e01be;if(_0x3d5704>=_0x3bd514){_0x3d5704=_0x3bd514;_0x4e01be=0xc8;}else{_0x4e01be=0xce;}_0x25ac36['status'](_0x4e01be);return _0x25ac36['set'](_0xc834('0x1d'),_0x2de747+'-'+_0x3d5704+'/'+_0x3bd514)[_0xc834('0x18')](_0x45f572);}return null;};}function saveUpdates(_0x330e7a){return function(_0x370414){if(_0x370414){return _0x370414['update'](_0x330e7a)['then'](function(_0x16c634){return _0x16c634;});}return null;};}function removeEntity(_0x4bbbe3){return function(_0x1ed926){if(_0x1ed926){return _0x1ed926[_0xc834('0x1e')]()['then'](function(){_0x4bbbe3[_0xc834('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4df80c){return function(_0xe66467){if(!_0xe66467){_0x4df80c[_0xc834('0x20')](0x194);}return _0xe66467;};}function handleError(_0x3af46b,_0x4d1a24){_0x4d1a24=_0x4d1a24||0x1f4;return function(_0x30d0e2){logger[_0xc834('0x13')](_0x30d0e2[_0xc834('0x21')]);if(_0x30d0e2[_0xc834('0x22')]){delete _0x30d0e2[_0xc834('0x22')];}_0x3af46b['status'](_0x4d1a24)[_0xc834('0x23')](_0x30d0e2);};}exports['index']=function(_0x123e02,_0x5ca160){var _0xa0889e={},_0x1bae44={},_0x1bfa8e={'count':0x0,'rows':[]};var _0x1ab75c=_[_0xc834('0x24')](db[_0xc834('0x25')][_0xc834('0x26')],function(_0x16702c){return{'name':_0x16702c['fieldName'],'type':_0x16702c[_0xc834('0x27')]['key']};});_0x1bae44[_0xc834('0x28')]=_[_0xc834('0x24')](_0x1ab75c,'name');_0x1bae44[_0xc834('0x29')]=_[_0xc834('0x2a')](_0x123e02['query']);_0x1bae44[_0xc834('0x2b')]=_['intersection'](_0x1bae44['model'],_0x1bae44[_0xc834('0x29')]);_0xa0889e[_0xc834('0x2c')]=_[_0xc834('0x2d')](_0x1bae44['model'],qs[_0xc834('0x2e')](_0x123e02[_0xc834('0x29')]['fields']));_0xa0889e[_0xc834('0x2c')]=_0xa0889e[_0xc834('0x2c')]['length']?_0xa0889e[_0xc834('0x2c')]:_0x1bae44[_0xc834('0x28')];if(!_0x123e02[_0xc834('0x29')][_0xc834('0x2f')](_0xc834('0x30'))){_0xa0889e[_0xc834('0x1b')]=qs[_0xc834('0x1b')](_0x123e02[_0xc834('0x29')]['limit']);_0xa0889e[_0xc834('0x19')]=qs[_0xc834('0x19')](_0x123e02[_0xc834('0x29')][_0xc834('0x19')]);}_0xa0889e['order']=qs[_0xc834('0x31')](_0x123e02[_0xc834('0x29')][_0xc834('0x31')]);_0xa0889e[_0xc834('0x32')]=qs['filters'](_[_0xc834('0x33')](_0x123e02[_0xc834('0x29')],_0x1bae44['filters']),_0x1ab75c);if(_0x123e02['query'][_0xc834('0x34')]){_0xa0889e[_0xc834('0x32')]=_[_0xc834('0x35')](_0xa0889e[_0xc834('0x32')],{'$or':_[_0xc834('0x24')](_0x1ab75c,function(_0x11e46a){if(_0x11e46a[_0xc834('0x27')]!==_0xc834('0x36')){var _0x3f187b={};_0x3f187b[_0x11e46a[_0xc834('0x22')]]={'$like':'%'+_0x123e02[_0xc834('0x29')][_0xc834('0x34')]+'%'};return _0x3f187b;}})});}_0xa0889e=_[_0xc834('0x35')]({},_0xa0889e,_0x123e02[_0xc834('0x37')]);var _0x4fe546={'where':_0xa0889e['where']};return db[_0xc834('0x25')]['count'](_0x4fe546)['then'](function(_0x30cb34){_0x1bfa8e[_0xc834('0x1c')]=_0x30cb34;if(_0x123e02[_0xc834('0x29')][_0xc834('0x38')]){_0xa0889e[_0xc834('0x39')]=[{'all':!![]}];}return db[_0xc834('0x25')][_0xc834('0x3a')](_0xa0889e);})[_0xc834('0x3b')](function(_0x4d9f50){_0x1bfa8e[_0xc834('0x3c')]=_0x4d9f50;return _0x1bfa8e;})[_0xc834('0x3b')](respondWithFilteredResult(_0x5ca160,_0xa0889e))[_0xc834('0x17')](handleError(_0x5ca160,null));};exports[_0xc834('0x3d')]=function(_0x2c733e,_0x24d027){var _0x10870b={'raw':!![],'where':{'id':_0x2c733e[_0xc834('0x3e')]['id']}},_0x327ace={};_0x327ace[_0xc834('0x28')]=_['keys'](db[_0xc834('0x25')][_0xc834('0x26')]);_0x327ace[_0xc834('0x29')]=_[_0xc834('0x2a')](_0x2c733e['query']);_0x327ace[_0xc834('0x2b')]=_[_0xc834('0x2d')](_0x327ace[_0xc834('0x28')],_0x327ace[_0xc834('0x29')]);_0x10870b[_0xc834('0x2c')]=_[_0xc834('0x2d')](_0x327ace[_0xc834('0x28')],qs[_0xc834('0x2e')](_0x2c733e[_0xc834('0x29')][_0xc834('0x2e')]));_0x10870b['attributes']=_0x10870b[_0xc834('0x2c')][_0xc834('0x3f')]?_0x10870b['attributes']:_0x327ace[_0xc834('0x28')];if(_0x2c733e[_0xc834('0x29')][_0xc834('0x38')]){_0x10870b[_0xc834('0x39')]=[{'all':!![]}];}_0x10870b=_['merge']({},_0x10870b,_0x2c733e[_0xc834('0x37')]);return db[_0xc834('0x25')]['find'](_0x10870b)['then'](handleEntityNotFound(_0x24d027,null))[_0xc834('0x3b')](respondWithResult(_0x24d027,null))[_0xc834('0x17')](handleError(_0x24d027,null));};exports[_0xc834('0x40')]=function(_0x233e31,_0x252c0b){return db[_0xc834('0x25')][_0xc834('0x40')](_0x233e31[_0xc834('0x41')],{})['then'](respondWithResult(_0x252c0b,0xc9))[_0xc834('0x17')](handleError(_0x252c0b,null));};exports[_0xc834('0x42')]=function(_0x5e1f73,_0x5b5716){if(_0x5e1f73[_0xc834('0x41')]['id']){delete _0x5e1f73['body']['id'];}return db[_0xc834('0x25')][_0xc834('0x43')]({'where':{'id':_0x5e1f73[_0xc834('0x3e')]['id']}})[_0xc834('0x3b')](handleEntityNotFound(_0x5b5716,null))['then'](saveUpdates(_0x5e1f73[_0xc834('0x41')],null))[_0xc834('0x3b')](respondWithResult(_0x5b5716,null))[_0xc834('0x17')](handleError(_0x5b5716,null));};exports[_0xc834('0x1e')]=function(_0x9a320d,_0x9f32ab){return db['WhatsappMessage'][_0xc834('0x43')]({'where':{'id':_0x9a320d[_0xc834('0x3e')]['id']}})[_0xc834('0x3b')](handleEntityNotFound(_0x9f32ab,null))[_0xc834('0x3b')](removeEntity(_0x9f32ab,null))[_0xc834('0x17')](handleError(_0x9f32ab,null));};exports[_0xc834('0x44')]=function(_0x27f4ec,_0x3eeecf){return db[_0xc834('0x25')]['describe']()[_0xc834('0x3b')](respondWithResult(_0x3eeecf,null))[_0xc834('0x17')](handleError(_0x3eeecf,null));};exports[_0xc834('0x45')]=function(_0x3221d0,_0x2db545){var _0x39eb96=_0xc834('0x46');return interactionService['acceptMessage'](_0x3221d0,_0x39eb96)[_0xc834('0x3b')](respondWithResult(_0x2db545,null))[_0xc834('0x17')](handleError(_0x2db545,null));};exports[_0xc834('0x47')]=function(_0x3fba31,_0x41637d){var _0xfb83d1={'agent':{},'channel':'whatsapp'};if(_0x3fba31[_0xc834('0x41')]['id']){delete _0x3fba31[_0xc834('0x41')]['id'];}_0x3fba31[_0xc834('0x41')][_0xc834('0x48')]=_0x3fba31[_0xc834('0x41')][_0xc834('0x48')]||_0x3fba31[_0xc834('0x49')]['id'];_0xfb83d1['agent']['id']=_0x3fba31['body'][_0xc834('0x48')];return db[_0xc834('0x25')][_0xc834('0x43')]({'where':{'id':_0x3fba31[_0xc834('0x3e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x41637d,null))[_0xc834('0x3b')](function(_0x5e7669){if(_0x5e7669){_0xfb83d1[_0xc834('0x15')]=_0x5e7669[_0xc834('0x4a')]({'plain':!![]});return db[_0xc834('0x4b')]['find']({'where':{'id':_0x5e7669['WhatsappInteractionId']}});}return null;})[_0xc834('0x3b')](handleEntityNotFound(_0x41637d,null))[_0xc834('0x3b')](function(_0x1bfbc9){if(_0x1bfbc9){_0xfb83d1[_0xc834('0x4c')]=_0x1bfbc9['get']({'plain':!![]});interaction_log[_0xc834('0xe')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3fba31[_0xc834('0x49')]['id'],_0x3fba31[_0xc834('0x49')][_0xc834('0x22')],_0x3fba31[_0xc834('0x49')][_0xc834('0x4d')],_0xfb83d1[_0xc834('0x4c')]['id'],_0x3fba31[_0xc834('0x41')]?JSON[_0xc834('0x4e')](_0x3fba31[_0xc834('0x41')]):'null');return respondWithRpcPromise(_0xc834('0x4f'),_0xc834('0x50'),_0xfb83d1);}return null;})[_0xc834('0x3b')](function(_0x588455){var _0x51f0ac=_0xc834('0x51')+_0x588455[_0xc834('0x15')]['ContactId'];return db[_0xc834('0x52')]['query'](_0x51f0ac,{'type':db[_0xc834('0x53')][_0xc834('0x54')][_0xc834('0x55')],'raw':!![]})[_0xc834('0x3b')](function(_0x5db3b4){return _0x5db3b4;});})[_0xc834('0x3b')](function(_0x1183da){if(_0x1183da){_0xfb83d1['message'][_0xc834('0x56')]=_0x1183da[0x0];if(!_0x3fba31[_0xc834('0x41')][_0xc834('0x48')])return;return db[_0xc834('0x57')][_0xc834('0x43')]({'where':{'id':_0x3fba31[_0xc834('0x41')]['UserId'],'role':'agent'},'attributes':['id',_0xc834('0x22'),'fullname','email',_0xc834('0x58')],'raw':!![]});}return null;})['then'](function(_0x20b3ce){if(!_0x20b3ce)return null;_0xfb83d1[_0xc834('0x15')]['agent']=_0x20b3ce;return _0xfb83d1;})['then'](function(_0x290e8b){if(_0x290e8b){_0x290e8b[_0xc834('0x15')][_0xc834('0x59')]=util[_0xc834('0x5a')](_0xc834('0x5b'),_0x3fba31[_0xc834('0x49')][_0xc834('0x22')]);_0x290e8b[_0xc834('0x15')][_0xc834('0x5c')]=_0xfb83d1[_0xc834('0x5c')];_0x290e8b['message'][_0xc834('0x5d')]=_0xfb83d1[_0xc834('0x5c')];_0x290e8b['message'][_0xc834('0x5e')]=_0xc834('0x47');respondWithRpcPromise('EventManager',_0xc834('0x5f'),{'event':_0xc834('0x60'),'message':_0x290e8b[_0xc834('0x15')]},client9002);return _0xfb83d1;}return null;})[_0xc834('0x3b')](respondWithResult(_0x41637d,null))['catch'](handleError(_0x41637d,null));};exports[_0xc834('0x1f')]=function(_0x50a3b9,_0x17bfaf){if(_0x50a3b9[_0xc834('0x41')]['id']){delete _0x50a3b9['body']['id'];}var _0x6c4c25;return db[_0xc834('0x25')][_0xc834('0x43')]({'where':{'id':_0x50a3b9[_0xc834('0x3e')]['id']}})[_0xc834('0x3b')](handleEntityNotFound(_0x17bfaf,null))['then'](function(_0x1bf1b9){if(_0x1bf1b9){_0x6c4c25=_0x1bf1b9;return db[_0xc834('0x61')][_0xc834('0x43')]({'where':{'id':_0x1bf1b9['WhatsappAccountId']}});}})[_0xc834('0x3b')](handleEntityNotFound(_0x17bfaf,null))[_0xc834('0x3b')](function(_0x1d0337){if(_0x1d0337){logger[_0xc834('0x11')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xc834('0x1f'),_0xc834('0x62'),_0x1d0337[_0xc834('0x27')],util[_0xc834('0x63')](_0x50a3b9[_0xc834('0x41')],{'showHidden':![],'depth':null}));switch(_0x1d0337['type']){case _0xc834('0x64'):if(_0x50a3b9[_0xc834('0x41')][_0xc834('0x65')]&&_0x50a3b9[_0xc834('0x41')][_0xc834('0x65')]===_0x6c4c25['messageId']&&_0x50a3b9[_0xc834('0x41')][_0xc834('0x66')]&&_0x50a3b9[_0xc834('0x41')]['MessageStatus']===_0xc834('0x67')){return _0x6c4c25['update']({'read':!![]});}else{logger[_0xc834('0x13')](_0xc834('0x68'),'status',_0xc834('0x64'),util[_0xc834('0x63')](_0x50a3b9[_0xc834('0x41')],{'showHidden':![],'depth':null}));}break;}return _0x6c4c25;}})[_0xc834('0x3b')](respondWithResult(_0x17bfaf,null))['catch'](handleError(_0x17bfaf,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 0c54fa8..c8d51ab 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 _0x76dc=['emit','hasOwnProperty','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove'];(function(_0x1394ad,_0x5815bb){var _0x538563=function(_0x556591){while(--_0x556591){_0x1394ad['push'](_0x1394ad['shift']());}};_0x538563(++_0x5815bb);}(_0x76dc,0x1f2));var _0xc76d=function(_0x3b5ac5,_0x25e1ac){_0x3b5ac5=_0x3b5ac5-0x0;var _0x18cc48=_0x76dc[_0x3b5ac5];return _0x18cc48;};'use strict';var EventEmitter=require(_0xc76d('0x0'));var WhatsappMessage=require(_0xc76d('0x1'))['db'][_0xc76d('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc76d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc76d('0x4'),'afterDestroy':_0xc76d('0x5')};function emitEvent(_0x5cff74){return function(_0x300f11,_0x50ed3a,_0x507ea7){WhatsappMessageEvents[_0xc76d('0x6')](_0x5cff74+':'+_0x300f11['id'],_0x300f11);WhatsappMessageEvents[_0xc76d('0x6')](_0x5cff74,_0x300f11);_0x507ea7(null);};}for(var e in events){if(events[_0xc76d('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xd4f4=['update','remove','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x41c937,_0x94c2da){_0x41c937=_0x41c937-0x0;var _0x339344=_0xd4f4[_0x41c937];return _0x339344;};'use strict';var EventEmitter=require(_0x4d4f('0x0'));var WhatsappMessage=require(_0x4d4f('0x1'))['db'][_0x4d4f('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4d4f('0x3')](0x0);var events={'afterCreate':_0x4d4f('0x4'),'afterUpdate':_0x4d4f('0x5'),'afterDestroy':_0x4d4f('0x6')};function emitEvent(_0x2c43da){return function(_0x25087a,_0xa53cb8,_0x15585){WhatsappMessageEvents['emit'](_0x2c43da+':'+_0x25087a['id'],_0x25087a);WhatsappMessageEvents['emit'](_0x2c43da,_0x25087a);_0x15585(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x4d4f('0x7')](e,emitEvent(event));}}module[_0x4d4f('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 4e9f03c..624ad6b 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 _0xd6a2=['baseUrl','/messages/','text','POST','Bearer\x20','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','update','createdAt','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','token','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch'];(function(_0x4cf013,_0xc2bff1){var _0x55be0e=function(_0x37b47a){while(--_0x37b47a){_0x4cf013['push'](_0x4cf013['shift']());}};_0x55be0e(++_0xc2bff1);}(_0xd6a2,0x84));var _0x2d6a=function(_0x2f4f9b,_0x4b2730){_0x2f4f9b=_0x2f4f9b-0x0;var _0xab190a=_0xd6a2[_0x2f4f9b];return _0xab190a;};'use strict';var _=require(_0x2d6a('0x0'));var util=require(_0x2d6a('0x1'));var logger=require(_0x2d6a('0x2'))(_0x2d6a('0x3'));var moment=require(_0x2d6a('0x4'));var BPromise=require(_0x2d6a('0x5'));var rp=require(_0x2d6a('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x2d6a('0x7'));var rimraf=require(_0x2d6a('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x2d6a('0x9')]=function(_0x3ac0e7,_0x3b7c68){return _0x3ac0e7[_0x2d6a('0xa')](_0x2d6a('0xb'),attributes,{'tableName':_0x2d6a('0xc'),'paranoid':![],'indexes':[{'name':_0x2d6a('0xd'),'fields':[_0x2d6a('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0x2d6a('0xe')],'type':_0x2d6a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25f7ed,_0x234609,_0x180479){var _0x3bf901=_0x3ac0e7[_0x2d6a('0x10')];var _0xe11821=_0x25f7ed[_0x2d6a('0x11')]({'plain':!![]});if(_0xe11821[_0x2d6a('0x12')]['toLowerCase']()==='in'||_0xe11821[_0x2d6a('0x12')][_0x2d6a('0x13')]()===_0x2d6a('0x14')&&!_0xe11821[_0x2d6a('0x15')]&&!_[_0x2d6a('0x16')](_0xe11821[_0x2d6a('0x17')])){_0x3bf901['WhatsappInteraction'][_0x2d6a('0x18')]({'where':{'id':_0xe11821['WhatsappInteractionId']}})['then'](function(_0x27c5d8){if(_0x27c5d8){_0x27c5d8[_0x2d6a('0x19')]({'lastMsgAt':_0xe11821[_0x2d6a('0x1a')],'lastMsgDirection':_0xe11821['direction']['toLowerCase']()});}})['catch'](function(_0x9e371d){console['error'](_0x9e371d);});}if(_0xe11821['direction']==='out'&&!_0xe11821[_0x2d6a('0x15')]){var _0x206d8f;_0x3bf901[_0x2d6a('0x1b')][_0x2d6a('0x1c')]({'where':{'id':_0xe11821[_0x2d6a('0x1d')]},'raw':!![]})[_0x2d6a('0x1e')](function(_0x503669){_0x206d8f=_0x503669;if(_0x206d8f&&_0x206d8f[_0x2d6a('0x1f')]){switch(_0x206d8f['type']){case _0x2d6a('0x20'):var _0x56af4d=require(_0x2d6a('0x20'));if(_0x206d8f[_0x2d6a('0x21')]&&_0x206d8f[_0x2d6a('0x22')]&&_0x206d8f[_0x2d6a('0x23')]){var _0x33b6aa=new _0x56af4d(_0x206d8f[_0x2d6a('0x21')],_0x206d8f['authToken']);_0x33b6aa[_0x2d6a('0x24')][_0x2d6a('0x25')]({'body':_0xe11821[_0x2d6a('0xe')],'to':_0x2d6a('0x26')+_0xe11821[_0x2d6a('0x23')],'from':_0x2d6a('0x26')+_0x206d8f['phone'],'statusCallback':_0x206d8f['remote']+'/api/whatsapp/messages/'+_0xe11821['id']+'/status?token='+_0x206d8f[_0x2d6a('0x27')]})['then'](function(_0x22095){if(_0x22095[_0x2d6a('0x28')]){return _0x25f7ed[_0x2d6a('0x19')]({'messageId':_0x22095[_0x2d6a('0x28')]});}})[_0x2d6a('0x29')](function(_0x49fb06){logger[_0x2d6a('0x2a')](_0x2d6a('0x2b'),_0x2d6a('0x2c'),_0x2d6a('0x20'),util[_0x2d6a('0x2d')](_0x49fb06,{'showHidden':![],'depth':null}));});}else{logger[_0x2d6a('0x2a')](_0x2d6a('0x2b'),'afterCreate','twilio',_0x2d6a('0x2e'));}break;case _0x2d6a('0x2f'):var _0x5e7ef4=_0x206d8f[_0x2d6a('0x21')];var _0x2a539c=_0x206d8f[_0x2d6a('0x22')];var _0x296399=_0x206d8f[_0x2d6a('0x30')]+'/whatsapp/v1/'+_0x5e7ef4+_0x2d6a('0x31');var _0x1cb23a={'to':[_0xe11821[_0x2d6a('0x23')]],'message':{'type':_0x2d6a('0x32'),'text':_0xe11821['body']}};var _0x32993a={'method':_0x2d6a('0x33'),'uri':_0x296399,'headers':{'Authorization':_0x2d6a('0x34')+_0x2a539c,'Content-Type':_0x2d6a('0x35')},'body':_0x1cb23a,'json':!![]};rp(_0x32993a)[_0x2d6a('0x1e')](function(_0x1f08ae){if(_0x1f08ae['statuses'][0x0][_0x2d6a('0x36')]){return _0x25f7ed[_0x2d6a('0x19')]({'messageId':_0x1f08ae[_0x2d6a('0x37')][0x0]['message_id']});}})[_0x2d6a('0x29')](function(_0x35b96d){logger[_0x2d6a('0x38')](_0x2d6a('0x39'),_0x35b96d);});break;}}})[_0x2d6a('0x3a')](function(){_0x180479();});}else{_0x180479();}}},'charset':_0x2d6a('0x3b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2318=['isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','WhatsappAccount','find','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','lodash','util','moment','bluebird','request-promise','rimraf','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret'];(function(_0x3e885c,_0x4f295b){var _0x29278c=function(_0x3fb14a){while(--_0x3fb14a){_0x3e885c['push'](_0x3e885c['shift']());}};_0x29278c(++_0x4f295b);}(_0x2318,0x149));var _0x8231=function(_0x43fea8,_0x3107ab){_0x43fea8=_0x43fea8-0x0;var _0x119a41=_0x2318[_0x43fea8];return _0x119a41;};'use strict';var _=require(_0x8231('0x0'));var util=require(_0x8231('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8231('0x2'));var BPromise=require(_0x8231('0x3'));var rp=require(_0x8231('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0x8231('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x8231('0x6')]=function(_0x20535f,_0x3b702){return _0x20535f[_0x8231('0x7')](_0x8231('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x8231('0x9'),'fields':[_0x8231('0x9')]},{'name':_0x8231('0xa'),'fields':[_0x8231('0xb')],'type':_0x8231('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x54e21f,_0xe35422,_0x3f9763){var _0x506b30=_0x20535f[_0x8231('0xd')];var _0x18067c=_0x54e21f[_0x8231('0xe')]({'plain':!![]});if(_0x18067c['direction'][_0x8231('0xf')]()==='in'||_0x18067c[_0x8231('0x10')]['toLowerCase']()===_0x8231('0x11')&&!_0x18067c[_0x8231('0x12')]&&!_[_0x8231('0x13')](_0x18067c[_0x8231('0x14')])){_0x506b30['WhatsappInteraction'][_0x8231('0x15')]({'where':{'id':_0x18067c[_0x8231('0x16')]}})[_0x8231('0x17')](function(_0x554c8c){if(_0x554c8c){_0x554c8c[_0x8231('0x18')]({'lastMsgAt':_0x18067c[_0x8231('0x19')],'lastMsgDirection':_0x18067c[_0x8231('0x10')][_0x8231('0xf')]()});}})['catch'](function(_0x1f575d){console['error'](_0x1f575d);});}if(_0x18067c[_0x8231('0x10')]===_0x8231('0x11')&&!_0x18067c[_0x8231('0x12')]){var _0x432592;_0x506b30[_0x8231('0x1a')][_0x8231('0x1b')]({'where':{'id':_0x18067c['WhatsappAccountId']},'raw':!![]})[_0x8231('0x17')](function(_0x206959){_0x432592=_0x206959;if(_0x432592&&_0x432592[_0x8231('0x1c')]){switch(_0x432592[_0x8231('0x1c')]){case _0x8231('0x1d'):var _0x4a2c43=require(_0x8231('0x1d'));if(_0x432592[_0x8231('0x1e')]&&_0x432592[_0x8231('0x1f')]&&_0x432592['phone']){var _0x8e7403=new _0x4a2c43(_0x432592['accountSid'],_0x432592[_0x8231('0x1f')]);_0x8e7403[_0x8231('0x20')][_0x8231('0x21')]({'body':_0x18067c['body'],'to':_0x8231('0x22')+_0x18067c[_0x8231('0x23')],'from':'whatsapp:'+_0x432592[_0x8231('0x23')],'statusCallback':_0x432592['remote']+_0x8231('0x24')+_0x18067c['id']+_0x8231('0x25')+_0x432592[_0x8231('0x26')]})[_0x8231('0x17')](function(_0x5dd11d){if(_0x5dd11d[_0x8231('0x27')]){return _0x54e21f['update']({'messageId':_0x5dd11d[_0x8231('0x27')]});}})[_0x8231('0x28')](function(_0x10975d){logger[_0x8231('0x29')](_0x8231('0x2a'),_0x8231('0x2b'),'twilio',util[_0x8231('0x2c')](_0x10975d,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x8231('0x2b'),_0x8231('0x1d'),_0x8231('0x2d'));}break;case _0x8231('0x2e'):var _0x4e4a92=_0x432592[_0x8231('0x1e')];var _0x400385=_0x432592[_0x8231('0x1f')];var _0x5a8840=_0x432592[_0x8231('0x2f')]+_0x8231('0x30')+_0x4e4a92+_0x8231('0x31');var _0xa8d5e5={'to':[_0x18067c['phone']],'message':{'type':_0x8231('0x32'),'text':_0x18067c['body']}};var _0x53da65={'method':_0x8231('0x33'),'uri':_0x5a8840,'headers':{'Authorization':_0x8231('0x34')+_0x400385,'Content-Type':_0x8231('0x35')},'body':_0xa8d5e5,'json':!![]};rp(_0x53da65)['then'](function(_0x40d540){if(_0x40d540[_0x8231('0x36')][0x0][_0x8231('0x37')]){return _0x54e21f[_0x8231('0x18')]({'messageId':_0x40d540[_0x8231('0x36')][0x0][_0x8231('0x37')]});}})[_0x8231('0x28')](function(_0x3ec700){logger[_0x8231('0x38')](_0x8231('0x39'),_0x3ec700);});break;}}})['finally'](function(){_0x3f9763();});}else{_0x3f9763();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 8609c50..f91ed24 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 _0x6c04=['code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x6c04,0xd4));var _0x46c0=function(_0x53e490,_0x3c021a){_0x53e490=_0x53e490-0x0;var _0xd4063=_0x6c04[_0x53e490];return _0xd4063;};'use strict';var _=require(_0x46c0('0x0'));var util=require('util');var moment=require(_0x46c0('0x1'));var BPromise=require(_0x46c0('0x2'));var rs=require(_0x46c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46c0('0x4'))['db'];var utils=require(_0x46c0('0x5'));var logger=require(_0x46c0('0x6'))(_0x46c0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x46c0('0x8')][_0x46c0('0x9')]({'port':0x232a});config[_0x46c0('0xa')]=_[_0x46c0('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x46c0('0xc'))(new Redis(config[_0x46c0('0xa')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3dd3a8,_0x15f92f,_0x14da52){return new BPromise(function(_0x245f3a,_0x43a3cb){return client[_0x46c0('0xd')](_0x3dd3a8,_0x14da52)[_0x46c0('0xe')](function(_0x4a19d9){logger[_0x46c0('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x15f92f,_0x46c0('0x10'));logger[_0x46c0('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x15f92f,_0x46c0('0x10'),JSON[_0x46c0('0x12')](_0x4a19d9));if(_0x4a19d9['error']){if(_0x4a19d9[_0x46c0('0x13')][_0x46c0('0x14')]===0x1f4){logger[_0x46c0('0x13')](_0x46c0('0x15'),_0x15f92f,_0x4a19d9['error'][_0x46c0('0x16')]);return _0x43a3cb(_0x4a19d9[_0x46c0('0x13')]['message']);}logger['error'](_0x46c0('0x15'),_0x15f92f,_0x4a19d9[_0x46c0('0x13')][_0x46c0('0x16')]);return _0x245f3a(_0x4a19d9[_0x46c0('0x13')][_0x46c0('0x16')]);}else{logger[_0x46c0('0xf')](_0x46c0('0x15'),_0x15f92f,'request\x20sent');_0x245f3a(_0x4a19d9[_0x46c0('0x17')][_0x46c0('0x16')]);}})[_0x46c0('0x18')](function(_0x3d5fff){logger[_0x46c0('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x15f92f,_0x3d5fff);_0x43a3cb(_0x3d5fff);});});}exports[_0x46c0('0x19')]=function(_0x5ba669){var _0x5b865f=this;return new Promise(function(_0x16b1ae,_0x226e8c){return db[_0x46c0('0x1a')]['create'](_0x5ba669[_0x46c0('0x1b')],{'raw':_0x5ba669['options']?_0x5ba669[_0x46c0('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1b406b){logger['info'](_0x46c0('0x19'),_0x5ba669);logger['debug'](_0x46c0('0x19'),_0x5ba669,JSON['stringify'](_0x1b406b));_0x16b1ae(_0x1b406b);})[_0x46c0('0x18')](function(_0x2bc919){logger[_0x46c0('0x13')]('CreateWhatsappMessage',_0x2bc919[_0x46c0('0x16')],_0x5ba669);_0x226e8c(_0x5b865f['error'](0x1f4,_0x2bc919[_0x46c0('0x16')]));});});}; \ No newline at end of file +var _0x3c6f=['error','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x76c36d,_0x3fd4ec){var _0x15a4ae=function(_0x467817){while(--_0x467817){_0x76c36d['push'](_0x76c36d['shift']());}};_0x15a4ae(++_0x3fd4ec);}(_0x3c6f,0x135));var _0xf3c6=function(_0x42608a,_0x149a88){_0x42608a=_0x42608a-0x0;var _0xa4375f=_0x3c6f[_0x42608a];return _0xa4375f;};'use strict';var _=require(_0xf3c6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf3c6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3c6('0x2'))['db'];var utils=require(_0xf3c6('0x3'));var logger=require(_0xf3c6('0x4'))(_0xf3c6('0x5'));var config=require(_0xf3c6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf3c6('0x7')][_0xf3c6('0x8')]({'port':0x232a});config[_0xf3c6('0x9')]=_[_0xf3c6('0xa')](config[_0xf3c6('0x9')],{'host':_0xf3c6('0xb'),'port':0x18eb});var socket=require(_0xf3c6('0xc'))(new Redis(config['redis']));require(_0xf3c6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5a73b8,_0x5f37b1,_0x59bae7){return new BPromise(function(_0xd85dbd,_0x26763d){return client['request'](_0x5a73b8,_0x59bae7)[_0xf3c6('0xe')](function(_0x1d27eb){logger[_0xf3c6('0xf')](_0xf3c6('0x10'),_0x5f37b1,_0xf3c6('0x11'));logger[_0xf3c6('0x12')](_0xf3c6('0x13'),_0x5f37b1,'request\x20sent',JSON[_0xf3c6('0x14')](_0x1d27eb));if(_0x1d27eb[_0xf3c6('0x15')]){if(_0x1d27eb['error']['code']===0x1f4){logger[_0xf3c6('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5f37b1,_0x1d27eb['error'][_0xf3c6('0x16')]);return _0x26763d(_0x1d27eb[_0xf3c6('0x15')]['message']);}logger[_0xf3c6('0x15')](_0xf3c6('0x10'),_0x5f37b1,_0x1d27eb[_0xf3c6('0x15')][_0xf3c6('0x16')]);return _0xd85dbd(_0x1d27eb['error'][_0xf3c6('0x16')]);}else{logger[_0xf3c6('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x5f37b1,_0xf3c6('0x11'));_0xd85dbd(_0x1d27eb['result'][_0xf3c6('0x16')]);}})[_0xf3c6('0x17')](function(_0x3df5d0){logger[_0xf3c6('0x15')](_0xf3c6('0x10'),_0x5f37b1,_0x3df5d0);_0x26763d(_0x3df5d0);});});}exports[_0xf3c6('0x18')]=function(_0x295789){var _0x131511=this;return new Promise(function(_0x5aa63d,_0x257277){return db[_0xf3c6('0x19')][_0xf3c6('0x1a')](_0x295789[_0xf3c6('0x1b')],{'raw':_0x295789['options']?_0x295789[_0xf3c6('0x1c')][_0xf3c6('0x1d')]===undefined?!![]:![]:!![]})[_0xf3c6('0xe')](function(_0x46040f){logger[_0xf3c6('0xf')](_0xf3c6('0x18'),_0x295789);logger['debug']('CreateWhatsappMessage',_0x295789,JSON[_0xf3c6('0x14')](_0x46040f));_0x5aa63d(_0x46040f);})[_0xf3c6('0x17')](function(_0x533387){logger[_0xf3c6('0x15')](_0xf3c6('0x18'),_0x533387[_0xf3c6('0x16')],_0x295789);_0x257277(_0x131511[_0xf3c6('0x15')](0x1f4,_0x533387['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 7dd7f8c..93a5d2a 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 _0x7b30=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','register'];(function(_0x5f4aa6,_0x4b77eb){var _0x361e8d=function(_0x4523d1){while(--_0x4523d1){_0x5f4aa6['push'](_0x5f4aa6['shift']());}};_0x361e8d(++_0x4b77eb);}(_0x7b30,0x1ca));var _0x07b3=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x7b30[_0x4bb66f];return _0xf2772f;};'use strict';var WhatsappMessageEvents=require(_0x07b3('0x0'));var events=[_0x07b3('0x1'),_0x07b3('0x2'),_0x07b3('0x3')];function createListener(_0x48d43e,_0x138c6b){return function(_0x58db3a){_0x138c6b[_0x07b3('0x4')](_0x48d43e,_0x58db3a);};}function removeListener(_0x50e50b,_0x391e19){return function(){WhatsappMessageEvents['removeListener'](_0x50e50b,_0x391e19);};}exports[_0x07b3('0x5')]=function(_0x69a474){for(var _0x3be61b=0x0,_0x5028e2=events[_0x07b3('0x6')];_0x3be61b<_0x5028e2;_0x3be61b++){var _0x44744b=events[_0x3be61b];var _0x2a7412=createListener(_0x07b3('0x7')+_0x44744b,_0x69a474);WhatsappMessageEvents['on'](_0x44744b,_0x2a7412);}}; \ No newline at end of file +var _0xdae8=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x5d3dca,_0x2d8c8b){var _0x3336f7=function(_0xfa5bf2){while(--_0xfa5bf2){_0x5d3dca['push'](_0x5d3dca['shift']());}};_0x3336f7(++_0x2d8c8b);}(_0xdae8,0x12c));var _0x8dae=function(_0x27897f,_0x14bcc2){_0x27897f=_0x27897f-0x0;var _0x3f79d6=_0xdae8[_0x27897f];return _0x3f79d6;};'use strict';var WhatsappMessageEvents=require(_0x8dae('0x0'));var events=[_0x8dae('0x1'),_0x8dae('0x2'),_0x8dae('0x3')];function createListener(_0x547763,_0x22d959){return function(_0x4d10ca){_0x22d959[_0x8dae('0x4')](_0x547763,_0x4d10ca);};}function removeListener(_0x1f3720,_0x564c96){return function(){WhatsappMessageEvents[_0x8dae('0x5')](_0x1f3720,_0x564c96);};}exports[_0x8dae('0x6')]=function(_0x3b3926){for(var _0x2e47ae=0x0,_0x3d0d0b=events[_0x8dae('0x7')];_0x2e47ae<_0x3d0d0b;_0x2e47ae++){var _0xbbcf3b=events[_0x2e47ae];var _0x581f73=createListener(_0x8dae('0x8')+_0xbbcf3b,_0x3b3926);WhatsappMessageEvents['on'](_0xbbcf3b,_0x581f73);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 14b1b03..05f309c 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 _0xadb5=['/:id/users','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','getTeams','getAgents','post','create','/:id/teams'];(function(_0x2f0244,_0x5c752b){var _0x1699a1=function(_0x32d4f9){while(--_0x32d4f9){_0x2f0244['push'](_0x2f0244['shift']());}};_0x1699a1(++_0x5c752b);}(_0xadb5,0x172));var _0x5adb=function(_0x2f56d3,_0x5e566a){_0x2f56d3=_0x2f56d3-0x0;var _0x30f3f3=_0xadb5[_0x2f56d3];return _0x30f3f3;};'use strict';var multer=require(_0x5adb('0x0'));var util=require(_0x5adb('0x1'));var path=require(_0x5adb('0x2'));var timeout=require(_0x5adb('0x3'));var express=require('express');var router=express[_0x5adb('0x4')]();var fs_extra=require(_0x5adb('0x5'));var auth=require(_0x5adb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5adb('0x7'));var controller=require(_0x5adb('0x8'));router[_0x5adb('0x9')]('/',auth[_0x5adb('0xa')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x9')](_0x5adb('0xc'),auth[_0x5adb('0xa')](),controller[_0x5adb('0xd')]);router['get'](_0x5adb('0xe'),auth[_0x5adb('0xa')](),controller[_0x5adb('0xf')]);router[_0x5adb('0x9')]('/:id/members',auth[_0x5adb('0xa')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x9')]('/:id/teams',auth[_0x5adb('0xa')](),controller[_0x5adb('0x11')]);router[_0x5adb('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/',auth[_0x5adb('0xa')](),controller[_0x5adb('0x14')]);router[_0x5adb('0x13')](_0x5adb('0x15'),auth['isAuthenticated'](),controller['addTeams']);router[_0x5adb('0x13')](_0x5adb('0x16'),auth[_0x5adb('0xa')](),controller['addAgents']);router[_0x5adb('0x17')](_0x5adb('0xe'),auth[_0x5adb('0xa')](),controller[_0x5adb('0x18')]);router[_0x5adb('0x19')](_0x5adb('0xe'),auth['isAuthenticated'](),controller[_0x5adb('0x1a')]);router[_0x5adb('0x19')]('/:id/teams',auth[_0x5adb('0xa')](),controller['removeTeams']);router[_0x5adb('0x19')]('/:id/users',auth[_0x5adb('0xa')](),controller['removeAgents']);module[_0x5adb('0x1b')]=router; \ No newline at end of file +var _0x2f0e=['addTeams','addAgents','put','update','delete','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','/:id','show','getMembers','/:id/teams','getTeams','post','create'];(function(_0x5d0300,_0x240cbe){var _0x495566=function(_0x268391){while(--_0x268391){_0x5d0300['push'](_0x5d0300['shift']());}};_0x495566(++_0x240cbe);}(_0x2f0e,0x133));var _0xe2f0=function(_0x4f637a,_0xfb82be){_0x4f637a=_0x4f637a-0x0;var _0x4fa1c2=_0x2f0e[_0x4f637a];return _0x4fa1c2;};'use strict';var multer=require(_0xe2f0('0x0'));var util=require(_0xe2f0('0x1'));var path=require(_0xe2f0('0x2'));var timeout=require('connect-timeout');var express=require(_0xe2f0('0x3'));var router=express[_0xe2f0('0x4')]();var fs_extra=require(_0xe2f0('0x5'));var auth=require(_0xe2f0('0x6'));var interaction=require(_0xe2f0('0x7'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0xe2f0('0x8')](),controller['index']);router[_0xe2f0('0x9')](_0xe2f0('0xa'),auth[_0xe2f0('0x8')](),controller['describe']);router[_0xe2f0('0x9')](_0xe2f0('0xb'),auth['isAuthenticated'](),controller[_0xe2f0('0xc')]);router[_0xe2f0('0x9')]('/:id/members',auth[_0xe2f0('0x8')](),controller[_0xe2f0('0xd')]);router[_0xe2f0('0x9')](_0xe2f0('0xe'),auth['isAuthenticated'](),controller[_0xe2f0('0xf')]);router[_0xe2f0('0x9')]('/:id/users',auth[_0xe2f0('0x8')](),controller['getAgents']);router[_0xe2f0('0x10')]('/',auth['isAuthenticated'](),controller[_0xe2f0('0x11')]);router['post'](_0xe2f0('0xe'),auth[_0xe2f0('0x8')](),controller[_0xe2f0('0x12')]);router[_0xe2f0('0x10')]('/:id/users',auth[_0xe2f0('0x8')](),controller[_0xe2f0('0x13')]);router[_0xe2f0('0x14')](_0xe2f0('0xb'),auth[_0xe2f0('0x8')](),controller[_0xe2f0('0x15')]);router[_0xe2f0('0x16')](_0xe2f0('0xb'),auth[_0xe2f0('0x8')](),controller['destroy']);router[_0xe2f0('0x16')]('/:id/teams',auth[_0xe2f0('0x8')](),controller['removeTeams']);router[_0xe2f0('0x16')]('/:id/users',auth[_0xe2f0('0x8')](),controller[_0xe2f0('0x17')]);module[_0xe2f0('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 04fcf67..08dff00 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 _0xc368=['ENUM','rrmemory','beepall','STRING','exports','name','INTEGER'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xc368,0x7b));var _0x8c36=function(_0x54bb2f,_0x42ff56){_0x54bb2f=_0x54bb2f-0x0;var _0x573917=_0xc368[_0x54bb2f];return _0x573917;};'use strict';var Sequelize=require('sequelize');module[_0x8c36('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8c36('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8c36('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8c36('0x3')](_0x8c36('0x4'),_0x8c36('0x5'),'roundrobin')},'description':{'type':Sequelize[_0x8c36('0x6')]}}; \ No newline at end of file +var _0x9532=['INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x2ce1f2,_0x1337df){var _0x5319a9=function(_0x5b8b97){while(--_0x5b8b97){_0x2ce1f2['push'](_0x2ce1f2['shift']());}};_0x5319a9(++_0x1337df);}(_0x9532,0x8c));var _0x2953=function(_0x4ba47e,_0xac322a){_0x4ba47e=_0x4ba47e-0x0;var _0x22109f=_0x9532[_0x4ba47e];return _0x22109f;};'use strict';var Sequelize=require(_0x2953('0x0'));module[_0x2953('0x1')]={'name':{'type':Sequelize[_0x2953('0x2')],'unique':_0x2953('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2953('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2953('0x5')]('rrmemory',_0x2953('0x6'),_0x2953('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index e4ef0b0..818c757 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 _0xbdb6=['../../config/logger','api','defaults','redis','localhost','register','sendStatus','end','status','json','offset','undefined','count','limit','set','update','then','destroy','get','WhatsappQueues','stack','name','map','WhatsappQueue','fieldName','type','getOptions','where','findAll','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserWhatsappQueue','hasOwnProperty','order','sort','pick','filter','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','nolimit','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','lodash','squel','ioredis','../../components/parsers/qs'];(function(_0x3130c8,_0x9eab09){var _0x401630=function(_0x219dab){while(--_0x219dab){_0x3130c8['push'](_0x3130c8['shift']());}};_0x401630(++_0x9eab09);}(_0xbdb6,0xe2));var _0x6bdb=function(_0x5000f5,_0x549e98){_0x5000f5=_0x5000f5-0x0;var _0x34ca60=_0xbdb6[_0x5000f5];return _0x34ca60;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x6bdb('0x0'));var squel=require(_0x6bdb('0x1'));var Redis=require(_0x6bdb('0x2'));var qs=require(_0x6bdb('0x3'));var logger=require(_0x6bdb('0x4'))(_0x6bdb('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x6bdb('0x6')](config[_0x6bdb('0x7')],{'host':_0x6bdb('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6bdb('0x7')]));require('./whatsappQueue.socket')[_0x6bdb('0x9')](socket);function respondWithStatusCode(_0x14685f,_0x3b21a7){_0x3b21a7=_0x3b21a7||0xcc;return function(_0x5115bd){if(_0x5115bd){return _0x14685f[_0x6bdb('0xa')](_0x3b21a7);}return _0x14685f['status'](_0x3b21a7)[_0x6bdb('0xb')]();};}function respondWithResult(_0x12d07c,_0x401184){_0x401184=_0x401184||0xc8;return function(_0x3e7135){if(_0x3e7135){return _0x12d07c[_0x6bdb('0xc')](_0x401184)[_0x6bdb('0xd')](_0x3e7135);}};}function respondWithFilteredResult(_0x4e06b5,_0x4aeefd){return function(_0x1aad13){if(_0x1aad13){var _0x47ae63=typeof _0x4aeefd[_0x6bdb('0xe')]===_0x6bdb('0xf')&&typeof _0x4aeefd['limit']===_0x6bdb('0xf');var _0x1577d3=_0x1aad13[_0x6bdb('0x10')];var _0x30a7a5=_0x47ae63?0x0:_0x4aeefd[_0x6bdb('0xe')];var _0x4fc832=_0x47ae63?_0x1aad13[_0x6bdb('0x10')]:_0x4aeefd[_0x6bdb('0xe')]+_0x4aeefd[_0x6bdb('0x11')];var _0x4b6a31;if(_0x4fc832>=_0x1577d3){_0x4fc832=_0x1577d3;_0x4b6a31=0xc8;}else{_0x4b6a31=0xce;}_0x4e06b5[_0x6bdb('0xc')](_0x4b6a31);return _0x4e06b5[_0x6bdb('0x12')]('Content-Range',_0x30a7a5+'-'+_0x4fc832+'/'+_0x1577d3)[_0x6bdb('0xd')](_0x1aad13);}return null;};}function saveUpdates(_0x5b1547){return function(_0x194819){if(_0x194819){return _0x194819[_0x6bdb('0x13')](_0x5b1547)[_0x6bdb('0x14')](function(_0x4d127a){return _0x4d127a;});}return null;};}function removeEntity(_0x3e6ea7){return function(_0x24d6da){if(_0x24d6da){return _0x24d6da[_0x6bdb('0x15')]()[_0x6bdb('0x14')](function(){var _0x366be6=_0x24d6da[_0x6bdb('0x16')]({'plain':!![]});var _0xee1e79=_0x6bdb('0x17');return db['UserProfileResource'][_0x6bdb('0x15')]({'where':{'type':_0xee1e79,'resourceId':_0x366be6['id']}})['then'](function(){return _0x24d6da;});})[_0x6bdb('0x14')](function(){_0x3e6ea7[_0x6bdb('0xc')](0xcc)[_0x6bdb('0xb')]();});}};}function handleEntityNotFound(_0x3ad4c6){return function(_0x464131){if(!_0x464131){_0x3ad4c6[_0x6bdb('0xa')](0x194);}return _0x464131;};}function handleError(_0x40ec40,_0xff2551){_0xff2551=_0xff2551||0x1f4;return function(_0x401f9a){logger['error'](_0x401f9a[_0x6bdb('0x18')]);if(_0x401f9a[_0x6bdb('0x19')]){delete _0x401f9a[_0x6bdb('0x19')];}_0x40ec40[_0x6bdb('0xc')](_0xff2551)['send'](_0x401f9a);};}exports['index']=function(_0x37fed8,_0x4bdd79){var _0xb51c7f={};var _0x461f94={'count':0x0,'rows':[]};var _0x1a8dc9=_[_0x6bdb('0x1a')](db[_0x6bdb('0x1b')]['rawAttributes'],function(_0xf65cb1){return{'name':_0xf65cb1[_0x6bdb('0x1c')],'type':_0xf65cb1[_0x6bdb('0x1d')]['key']};});_0xb51c7f=qs[_0x6bdb('0x1e')](_0x1a8dc9,_0x37fed8);var _0x564c32={'where':_0xb51c7f[_0x6bdb('0x1f')]};return db[_0x6bdb('0x1b')]['count'](_0x564c32)[_0x6bdb('0x14')](function(_0xccbc28){_0x461f94[_0x6bdb('0x10')]=_0xccbc28;_0xb51c7f['include']=qs['include'](_0x37fed8['query']);return db[_0x6bdb('0x1b')][_0x6bdb('0x20')](_0xb51c7f);})[_0x6bdb('0x14')](function(_0x43dde1){_0x461f94['rows']=_0x43dde1;return _0x461f94;})['then'](respondWithFilteredResult(_0x4bdd79,_0xb51c7f))[_0x6bdb('0x21')](handleError(_0x4bdd79,null));};exports[_0x6bdb('0x22')]=function(_0xaff42d,_0x1858dc){var _0xb3bb0e={'raw':!![],'where':{'id':_0xaff42d[_0x6bdb('0x23')]['id']}},_0x31a5cd={};_0x31a5cd[_0x6bdb('0x24')]=_[_0x6bdb('0x25')](db['WhatsappQueue'][_0x6bdb('0x26')]);_0x31a5cd[_0x6bdb('0x27')]=_[_0x6bdb('0x25')](_0xaff42d[_0x6bdb('0x27')]);_0x31a5cd[_0x6bdb('0x28')]=_[_0x6bdb('0x29')](_0x31a5cd[_0x6bdb('0x24')],_0x31a5cd['query']);_0xb3bb0e[_0x6bdb('0x2a')]=_['intersection'](_0x31a5cd[_0x6bdb('0x24')],qs[_0x6bdb('0x2b')](_0xaff42d[_0x6bdb('0x27')][_0x6bdb('0x2b')]));_0xb3bb0e[_0x6bdb('0x2a')]=_0xb3bb0e[_0x6bdb('0x2a')][_0x6bdb('0x2c')]?_0xb3bb0e[_0x6bdb('0x2a')]:_0x31a5cd[_0x6bdb('0x24')];if(_0xaff42d['query'][_0x6bdb('0x2d')]){_0xb3bb0e['include']=[{'all':!![]}];}_0xb3bb0e=_[_0x6bdb('0x2e')]({},_0xb3bb0e,_0xaff42d[_0x6bdb('0x2f')]);return db[_0x6bdb('0x1b')][_0x6bdb('0x30')](_0xb3bb0e)['then'](handleEntityNotFound(_0x1858dc,null))[_0x6bdb('0x14')](respondWithResult(_0x1858dc,null))[_0x6bdb('0x21')](handleError(_0x1858dc,null));};exports['create']=function(_0x5370e4,_0x1c761a){return db[_0x6bdb('0x1b')][_0x6bdb('0x31')](_0x5370e4['body'],{})[_0x6bdb('0x14')](function(_0x5565c0){var _0x29201a=_0x5370e4[_0x6bdb('0x32')][_0x6bdb('0x16')]({'plain':!![]});if(!_0x29201a)throw new Error(_0x6bdb('0x33'));if(_0x29201a[_0x6bdb('0x34')]==='user'){var _0x33703b=_0x5565c0[_0x6bdb('0x16')]({'plain':!![]});var _0xddedd1=_0x6bdb('0x17');return db['UserProfileSection'][_0x6bdb('0x30')]({'where':{'name':_0xddedd1,'userProfileId':_0x29201a[_0x6bdb('0x35')]},'raw':!![]})[_0x6bdb('0x14')](function(_0xd9f84){if(_0xd9f84&&_0xd9f84[_0x6bdb('0x36')]===0x0){return db[_0x6bdb('0x37')][_0x6bdb('0x31')]({'name':_0x33703b[_0x6bdb('0x19')],'resourceId':_0x33703b['id'],'type':_0xd9f84[_0x6bdb('0x19')],'sectionId':_0xd9f84['id']},{})[_0x6bdb('0x14')](function(){return _0x5565c0;});}else{return _0x5565c0;}})[_0x6bdb('0x21')](function(_0x2d3af4){logger[_0x6bdb('0x38')](_0x6bdb('0x39'),_0x2d3af4);throw _0x2d3af4;});}return _0x5565c0;})[_0x6bdb('0x14')](respondWithResult(_0x1c761a,0xc9))['catch'](handleError(_0x1c761a,null));};exports[_0x6bdb('0x13')]=function(_0x392944,_0x3b6bc7){if(_0x392944['body']['id']){delete _0x392944[_0x6bdb('0x3a')]['id'];}return db[_0x6bdb('0x1b')][_0x6bdb('0x30')]({'where':{'id':_0x392944[_0x6bdb('0x23')]['id']}})[_0x6bdb('0x14')](handleEntityNotFound(_0x3b6bc7,null))[_0x6bdb('0x14')](saveUpdates(_0x392944[_0x6bdb('0x3a')],null))[_0x6bdb('0x14')](respondWithResult(_0x3b6bc7,null))[_0x6bdb('0x21')](handleError(_0x3b6bc7,null));};exports[_0x6bdb('0x15')]=function(_0x2f1162,_0x3ab3fe){return db['WhatsappQueue']['find']({'where':{'id':_0x2f1162[_0x6bdb('0x23')]['id']}})[_0x6bdb('0x14')](handleEntityNotFound(_0x3ab3fe,null))['then'](removeEntity(_0x3ab3fe,null))['catch'](handleError(_0x3ab3fe,null));};exports[_0x6bdb('0x3b')]=function(_0x380217,_0x587208){return db[_0x6bdb('0x1b')]['describe']()['then'](respondWithResult(_0x587208,null))[_0x6bdb('0x21')](handleError(_0x587208,null));};exports[_0x6bdb('0x3c')]=function(_0x4f5743,_0x1a63cd){var _0x156087={'raw':!![],'where':{}},_0x364451={},_0x427edc;return db[_0x6bdb('0x1b')]['findOne']({'where':{'id':_0x4f5743['params']['id']}})[_0x6bdb('0x14')](handleEntityNotFound(_0x1a63cd,null))[_0x6bdb('0x14')](function(_0x45f7e7){if(_0x45f7e7){_0x427edc=_0x45f7e7[_0x6bdb('0x16')]({'plain':!![]});_0x364451[_0x6bdb('0x24')]=_[_0x6bdb('0x25')](db[_0x6bdb('0x3d')][_0x6bdb('0x26')]);_0x364451[_0x6bdb('0x27')]=_[_0x6bdb('0x25')](_0x4f5743[_0x6bdb('0x27')]);_0x364451[_0x6bdb('0x28')]=_[_0x6bdb('0x29')](_0x364451[_0x6bdb('0x24')],_0x364451['query']);_0x156087[_0x6bdb('0x2a')]=_['intersection'](_0x364451['model'],qs[_0x6bdb('0x2b')](_0x4f5743[_0x6bdb('0x27')][_0x6bdb('0x2b')]));_0x156087[_0x6bdb('0x2a')]=_0x156087[_0x6bdb('0x2a')][_0x6bdb('0x2c')]?_0x156087['attributes']:_0x364451['model'];if(!_0x4f5743[_0x6bdb('0x27')][_0x6bdb('0x3e')]('nolimit')){_0x156087['limit']=qs[_0x6bdb('0x11')](_0x4f5743[_0x6bdb('0x27')][_0x6bdb('0x11')]);_0x156087[_0x6bdb('0xe')]=qs[_0x6bdb('0xe')](_0x4f5743[_0x6bdb('0x27')][_0x6bdb('0xe')]);}_0x156087[_0x6bdb('0x3f')]=qs[_0x6bdb('0x40')](_0x4f5743['query'][_0x6bdb('0x40')]);_0x156087[_0x6bdb('0x1f')]=qs[_0x6bdb('0x28')](_[_0x6bdb('0x41')](_0x4f5743[_0x6bdb('0x27')],_0x364451[_0x6bdb('0x28')]));_0x156087['where']['WhatsappQueueId']=_0x45f7e7['id'];if(_0x4f5743[_0x6bdb('0x27')]['filter']){_0x156087[_0x6bdb('0x1f')]=_[_0x6bdb('0x2e')](_0x156087[_0x6bdb('0x1f')],{'$or':_[_0x6bdb('0x1a')](_0x156087[_0x6bdb('0x2a')],function(_0x3d0303){var _0x22b687={};_0x22b687[_0x3d0303]={'$like':'%'+_0x4f5743[_0x6bdb('0x27')][_0x6bdb('0x42')]+'%'};return _0x22b687;})});}_0x156087=_['merge']({},_0x156087,_0x4f5743['options']);return db[_0x6bdb('0x3d')][_0x6bdb('0x20')](_0x156087);}})[_0x6bdb('0x14')](function(_0x5b9ae5){if(_0x5b9ae5){return db[_0x6bdb('0x43')][_0x6bdb('0x44')]({'where':{'id':_[_0x6bdb('0x1a')](_0x5b9ae5,_0x6bdb('0x45')),'role':'agent'},'attributes':['id',_0x6bdb('0x19'),_0x6bdb('0x46'),_0x6bdb('0x47'),_0x6bdb('0x48')]});}})[_0x6bdb('0x14')](function(_0x57036f){if(_0x57036f){return{'count':_0x57036f['count'],'rows':_['map'](_0x57036f['rows'],function(_0x51423e){return{'membername':_0x51423e[_0x6bdb('0x19')],'UserId':_0x51423e['id'],'queue_name':_0x427edc[_0x6bdb('0x19')],'WhatsappQueueId':_0x427edc['id'],'interface':util[_0x6bdb('0x49')](_0x6bdb('0x4a'),_0x6bdb('0x4b'),_0x51423e[_0x6bdb('0x19')]),'penalty':0x0,'paused':_0x51423e['whatsappPause'],'createdAt':_0x51423e[_0x6bdb('0x48')],'updatedAt':_0x51423e[_0x6bdb('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6bdb('0x14')](respondWithFilteredResult(_0x1a63cd,_0x156087))[_0x6bdb('0x21')](handleError(_0x1a63cd,null));};exports['getTeams']=function(_0x34d158,_0x22edff){var _0x22baba={};var _0x1b5fe8={};var _0x3828cf;var _0x5dd163;return db['WhatsappQueue'][_0x6bdb('0x4c')]({'where':{'id':_0x34d158[_0x6bdb('0x23')]['id']}})[_0x6bdb('0x14')](handleEntityNotFound(_0x22edff,null))[_0x6bdb('0x14')](function(_0x9f80ec){if(_0x9f80ec){_0x3828cf=_0x9f80ec;_0x1b5fe8['model']=_[_0x6bdb('0x25')](db['Team'][_0x6bdb('0x26')]);_0x1b5fe8[_0x6bdb('0x27')]=_[_0x6bdb('0x25')](_0x34d158[_0x6bdb('0x27')]);_0x1b5fe8[_0x6bdb('0x28')]=_['intersection'](_0x1b5fe8['model'],_0x1b5fe8['query']);_0x22baba[_0x6bdb('0x2a')]=_[_0x6bdb('0x29')](_0x1b5fe8[_0x6bdb('0x24')],qs[_0x6bdb('0x2b')](_0x34d158[_0x6bdb('0x27')][_0x6bdb('0x2b')]));_0x22baba['attributes']=_0x22baba[_0x6bdb('0x2a')]['length']?_0x22baba[_0x6bdb('0x2a')]:_0x1b5fe8[_0x6bdb('0x24')];_0x22baba[_0x6bdb('0x3f')]=qs[_0x6bdb('0x40')](_0x34d158['query']['sort']);_0x22baba[_0x6bdb('0x1f')]=qs[_0x6bdb('0x28')](_[_0x6bdb('0x41')](_0x34d158[_0x6bdb('0x27')],_0x1b5fe8[_0x6bdb('0x28')]));if(_0x34d158['query'][_0x6bdb('0x42')]){_0x22baba[_0x6bdb('0x1f')]=_[_0x6bdb('0x2e')](_0x22baba[_0x6bdb('0x1f')],{'$or':_[_0x6bdb('0x1a')](_0x22baba['attributes'],function(_0x59b42a){var _0x539405={};_0x539405[_0x59b42a]={'$like':'%'+_0x34d158['query'][_0x6bdb('0x42')]+'%'};return _0x539405;})});}_0x22baba=_['merge']({},_0x22baba,_0x34d158['options']);return _0x3828cf['getTeams'](_0x22baba);}})[_0x6bdb('0x14')](function(_0x752636){if(_0x752636){_0x5dd163=_0x752636['length'];if(!_0x34d158[_0x6bdb('0x27')][_0x6bdb('0x3e')](_0x6bdb('0x4d'))){_0x22baba[_0x6bdb('0x11')]=qs[_0x6bdb('0x11')](_0x34d158['query'][_0x6bdb('0x11')]);_0x22baba[_0x6bdb('0xe')]=qs['offset'](_0x34d158[_0x6bdb('0x27')][_0x6bdb('0xe')]);}return _0x3828cf[_0x6bdb('0x4e')](_0x22baba);}})[_0x6bdb('0x14')](function(_0x121789){if(_0x121789){return _0x121789?{'count':_0x5dd163,'rows':_0x121789}:null;}})[_0x6bdb('0x14')](respondWithResult(_0x22edff,null))['catch'](handleError(_0x22edff,null));};exports[_0x6bdb('0x4f')]=function(_0x3e22bf,_0x1246d8){var _0x2e68ac=_0x3e22bf[_0x6bdb('0x3a')][_0x6bdb('0x50')];return db[_0x6bdb('0x51')]['findAll']({'where':{'id':_0x2e68ac},'attributes':['id'],'include':[{'model':db[_0x6bdb('0x43')],'as':_0x6bdb('0x52'),'attributes':['id',_0x6bdb('0x19'),_0x6bdb('0x53'),_0x6bdb('0x54'),_0x6bdb('0x55')],'raw':!![]}]})['then'](function(_0x3aa255){if(_0x3aa255){var _0x2783c2=_['flatMap'](_0x3aa255,function(_0x551324){var _0x443b83=_0x551324[_0x6bdb('0x16')]({'plain':!![]});return _0x443b83[_0x6bdb('0x52')];});return db[_0x6bdb('0x1b')][_0x6bdb('0x30')]({'where':{'id':_0x3e22bf['params']['id']}})[_0x6bdb('0x14')](function(_0x5e5532){return db[_0x6bdb('0x56')][_0x6bdb('0x57')](function(_0x17c482){return _0x5e5532['addTeams'](_0x2e68ac,{'transaction':_0x17c482})['then'](function(){return BPromise[_0x6bdb('0x58')](_0x2783c2,function(_0x5b89ae){return db[_0x6bdb('0x3d')][_0x6bdb('0x59')]({'where':{'UserId':_0x5b89ae['id'],'WhatsappQueueId':_0x3e22bf['params']['id']},'transaction':_0x17c482});});})[_0x6bdb('0x14')](function(){_0x2783c2[_0x6bdb('0x5a')](function(_0x5718fb){socket[_0x6bdb('0x5b')]('userWhatsappQueue:save',{'UserId':_0x5718fb['id'],'WhatsappQueueId':_0x5e5532['id']});});});});});}})[_0x6bdb('0x14')](respondWithStatusCode(_0x1246d8,null))['catch'](handleError(_0x1246d8,null));};exports[_0x6bdb('0x5c')]=function(_0x1e298d,_0x14916b){return db['Team'][_0x6bdb('0x20')]({'where':{'id':_0x1e298d[_0x6bdb('0x27')][_0x6bdb('0x50')]},'attributes':['id'],'include':[{'model':db[_0x6bdb('0x43')],'as':_0x6bdb('0x52'),'attributes':['id'],'raw':!![]}]})[_0x6bdb('0x14')](handleEntityNotFound(_0x14916b,null))[_0x6bdb('0x14')](function(_0x47c5e7){var _0x2bbe91=_[_0x6bdb('0x1a')](_0x47c5e7,'id');var _0x1ef4ef=[];var _0x4884a3=[];var _0x3f472b=squel[_0x6bdb('0x5d')]();_0x3f472b[_0x6bdb('0x5e')](_0x6bdb('0x5f'))['from'](_0x6bdb('0x60'),'tq')[_0x6bdb('0x61')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6bdb('0x1f')](_0x6bdb('0x62'),_0x1e298d[_0x6bdb('0x23')]['id']);for(var _0xb7c9c6=0x0;_0xb7c9c6<_0x47c5e7[_0x6bdb('0x2c')];_0xb7c9c6+=0x1){let _0x465787=_0x47c5e7[_0xb7c9c6];for(var _0x12a88c=0x0;_0x12a88c<_0x465787[_0x6bdb('0x52')][_0x6bdb('0x2c')];_0x12a88c+=0x1){let _0x4a5f22=_0x465787[_0x6bdb('0x52')][_0x12a88c];var _0x453eee=_0x3f472b[_0x6bdb('0x63')]();_0x453eee[_0x6bdb('0x1f')]('ut.UserId\x20=\x20?',_0x4a5f22['id']);_0x4884a3[_0x6bdb('0x64')](db[_0x6bdb('0x56')]['query'](_0x453eee[_0x6bdb('0x65')](),{'type':db[_0x6bdb('0x56')][_0x6bdb('0x66')][_0x6bdb('0x67')]})[_0x6bdb('0x14')](function(_0x5450de){if(_0x5450de[_0x6bdb('0x2c')]===0x1){return _0x4a5f22['id'];}else{var _0x371378=_[_0x6bdb('0x68')](_['map'](_0x5450de,_0x6bdb('0x69')),function(_0x5cc07a){return _['includes'](_0x2bbe91,_0x5cc07a);});if(_0x371378){return _0x4a5f22['id'];}}}));}}return BPromise['all'](_0x4884a3)[_0x6bdb('0x14')](function(_0x5e521b){_0x1ef4ef=_(_0x1ef4ef)['union'](_0x5e521b)[_0x6bdb('0x6a')]()[_0x6bdb('0x6b')]();return db['WhatsappQueue']['find']({'where':{'id':_0x1e298d[_0x6bdb('0x23')]['id']}})[_0x6bdb('0x14')](function(_0x510f17){return db[_0x6bdb('0x56')][_0x6bdb('0x57')](function(_0x342e3a){return _0x510f17[_0x6bdb('0x5c')](_0x1e298d[_0x6bdb('0x27')][_0x6bdb('0x50')],{'transaction':_0x342e3a})[_0x6bdb('0x14')](function(){if(!_[_0x6bdb('0x6c')](_0x1ef4ef)){return _0x510f17[_0x6bdb('0x6d')](_0x1ef4ef,{'transaction':_0x342e3a});}})[_0x6bdb('0x14')](function(){_0x1ef4ef[_0x6bdb('0x5a')](function(_0x1bb129){socket[_0x6bdb('0x5b')](_0x6bdb('0x6e'),{'UserId':_0x1bb129,'WhatsappQueueId':_0x510f17['id']});});});});});});})[_0x6bdb('0x14')](respondWithStatusCode(_0x14916b,null))[_0x6bdb('0x21')](handleError(_0x14916b,null));};exports[_0x6bdb('0x6f')]=function(_0x29ecc9,_0x53bb3e){return db[_0x6bdb('0x1b')][_0x6bdb('0x30')]({'where':{'id':_0x29ecc9[_0x6bdb('0x23')]['id']}})[_0x6bdb('0x14')](handleEntityNotFound(_0x53bb3e,null))[_0x6bdb('0x14')](function(_0x254d52){if(_0x254d52){return _0x254d52['addAgents'](_0x29ecc9[_0x6bdb('0x3a')][_0x6bdb('0x50')],_[_0x6bdb('0x70')](_0x29ecc9[_0x6bdb('0x3a')],[_0x6bdb('0x50'),'id'])||{})[_0x6bdb('0x71')](function(_0x584ce3){for(var _0x411529=0x0;_0x411529<_0x29ecc9[_0x6bdb('0x3a')]['ids'][_0x6bdb('0x2c')];_0x411529+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x29ecc9[_0x6bdb('0x3a')]['ids'][_0x411529]),'WhatsappQueueId':Number(_0x29ecc9[_0x6bdb('0x23')]['id'])});}return _0x584ce3;});}})['then'](respondWithResult(_0x53bb3e,null))['catch'](handleError(_0x53bb3e,null));};exports[_0x6bdb('0x6d')]=function(_0x554b3d,_0x4733bd){return db[_0x6bdb('0x1b')][_0x6bdb('0x30')]({'where':{'id':_0x554b3d[_0x6bdb('0x23')]['id']}})['then'](handleEntityNotFound(_0x4733bd,null))['then'](function(_0x263fa0){if(_0x263fa0){return _0x263fa0[_0x6bdb('0x6d')](_0x554b3d['query'][_0x6bdb('0x50')])['then'](function(){if(_['isArray'](_0x554b3d[_0x6bdb('0x27')][_0x6bdb('0x50')])){for(var _0x444aff=0x0;_0x444aff<_0x554b3d['query'][_0x6bdb('0x50')][_0x6bdb('0x2c')];_0x444aff+=0x1){socket['emit'](_0x6bdb('0x6e'),{'UserId':Number(_0x554b3d[_0x6bdb('0x27')][_0x6bdb('0x50')][_0x444aff]),'WhatsappQueueId':Number(_0x554b3d[_0x6bdb('0x23')]['id'])});}}else{socket['emit'](_0x6bdb('0x6e'),{'UserId':Number(_0x554b3d[_0x6bdb('0x27')][_0x6bdb('0x50')]),'WhatsappQueueId':Number(_0x554b3d[_0x6bdb('0x23')]['id'])});}});}})[_0x6bdb('0x14')](respondWithStatusCode(_0x4733bd,null))[_0x6bdb('0x21')](handleError(_0x4733bd,null));};exports[_0x6bdb('0x72')]=function(_0x2e9cd6,_0x48a7a0){var _0x5bd189={};var _0x519967={};var _0x2b5ea0;var _0x18039b;return db[_0x6bdb('0x1b')][_0x6bdb('0x4c')]({'where':{'id':_0x2e9cd6[_0x6bdb('0x23')]['id']}})[_0x6bdb('0x14')](handleEntityNotFound(_0x48a7a0,null))[_0x6bdb('0x14')](function(_0x4eed6a){if(_0x4eed6a){_0x2b5ea0=_0x4eed6a;_0x519967[_0x6bdb('0x24')]=_[_0x6bdb('0x25')](db['User'][_0x6bdb('0x26')]);_0x519967[_0x6bdb('0x27')]=_[_0x6bdb('0x25')](_0x2e9cd6['query']);_0x519967[_0x6bdb('0x28')]=_[_0x6bdb('0x29')](_0x519967[_0x6bdb('0x24')],_0x519967[_0x6bdb('0x27')]);_0x5bd189[_0x6bdb('0x2a')]=_[_0x6bdb('0x29')](_0x519967['model'],qs['fields'](_0x2e9cd6[_0x6bdb('0x27')][_0x6bdb('0x2b')]));_0x5bd189['attributes']=_0x5bd189['attributes']['length']?_0x5bd189[_0x6bdb('0x2a')]:_0x519967[_0x6bdb('0x24')];_0x5bd189['order']=qs[_0x6bdb('0x40')](_0x2e9cd6[_0x6bdb('0x27')][_0x6bdb('0x40')]);_0x5bd189[_0x6bdb('0x1f')]=qs[_0x6bdb('0x28')](_[_0x6bdb('0x41')](_0x2e9cd6[_0x6bdb('0x27')],_0x519967['filters']));if(_0x2e9cd6[_0x6bdb('0x27')][_0x6bdb('0x42')]){_0x5bd189[_0x6bdb('0x1f')]=_[_0x6bdb('0x2e')](_0x5bd189[_0x6bdb('0x1f')],{'$or':_[_0x6bdb('0x1a')](_0x5bd189[_0x6bdb('0x2a')],function(_0x3b3352){var _0x159522={};_0x159522[_0x3b3352]={'$like':'%'+_0x2e9cd6[_0x6bdb('0x27')][_0x6bdb('0x42')]+'%'};return _0x159522;})});}_0x5bd189=_[_0x6bdb('0x2e')]({},_0x5bd189,_0x2e9cd6[_0x6bdb('0x2f')]);return _0x2b5ea0[_0x6bdb('0x72')](_0x5bd189);}})['then'](function(_0xd36125){if(_0xd36125){_0x18039b=_0xd36125[_0x6bdb('0x2c')];if(!_0x2e9cd6[_0x6bdb('0x27')][_0x6bdb('0x3e')]('nolimit')){_0x5bd189[_0x6bdb('0x11')]=qs[_0x6bdb('0x11')](_0x2e9cd6['query'][_0x6bdb('0x11')]);_0x5bd189[_0x6bdb('0xe')]=qs['offset'](_0x2e9cd6[_0x6bdb('0x27')][_0x6bdb('0xe')]);}return _0x2b5ea0['getAgents'](_0x5bd189);}})['then'](function(_0x5eebb3){if(_0x5eebb3){return _0x5eebb3?{'count':_0x18039b,'rows':_0x5eebb3}:null;}})[_0x6bdb('0x14')](respondWithResult(_0x48a7a0,null))[_0x6bdb('0x21')](handleError(_0x48a7a0,null));}; \ No newline at end of file +var _0xb241=['localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','catch','keys','query','intersection','model','fields','attributes','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','hasOwnProperty','nolimit','sort','filters','pick','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','agent','updatedAt','createdAt','format','SIP','whatsappPause','order','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeTeams','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','../../config/environment','redis','defaults'];(function(_0x444b03,_0x41f971){var _0x2bcd94=function(_0x23d3ae){while(--_0x23d3ae){_0x444b03['push'](_0x444b03['shift']());}};_0x2bcd94(++_0x41f971);}(_0xb241,0x1f3));var _0x1b24=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb241[_0x21a9d9];return _0x46adce;};'use strict';var BPromise=require(_0x1b24('0x0'));var util=require(_0x1b24('0x1'));var _=require(_0x1b24('0x2'));var squel=require(_0x1b24('0x3'));var Redis=require(_0x1b24('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x1b24('0x5'))('api');var config=require(_0x1b24('0x6'));var db=require('../../mysqldb')['db'];config[_0x1b24('0x7')]=_[_0x1b24('0x8')](config['redis'],{'host':_0x1b24('0x9'),'port':0x18eb});var socket=require(_0x1b24('0xa'))(new Redis(config[_0x1b24('0x7')]));require(_0x1b24('0xb'))[_0x1b24('0xc')](socket);function respondWithStatusCode(_0x55a521,_0x461874){_0x461874=_0x461874||0xcc;return function(_0x3e1893){if(_0x3e1893){return _0x55a521[_0x1b24('0xd')](_0x461874);}return _0x55a521['status'](_0x461874)['end']();};}function respondWithResult(_0x420f98,_0x2c764f){_0x2c764f=_0x2c764f||0xc8;return function(_0x3ff3a4){if(_0x3ff3a4){return _0x420f98[_0x1b24('0xe')](_0x2c764f)[_0x1b24('0xf')](_0x3ff3a4);}};}function respondWithFilteredResult(_0x4bb6b5,_0x480024){return function(_0x1fe5b7){if(_0x1fe5b7){var _0x25927f=typeof _0x480024[_0x1b24('0x10')]===_0x1b24('0x11')&&typeof _0x480024[_0x1b24('0x12')]===_0x1b24('0x11');var _0x477e06=_0x1fe5b7[_0x1b24('0x13')];var _0x417858=_0x25927f?0x0:_0x480024[_0x1b24('0x10')];var _0x25b107=_0x25927f?_0x1fe5b7[_0x1b24('0x13')]:_0x480024[_0x1b24('0x10')]+_0x480024[_0x1b24('0x12')];var _0x43fc5e;if(_0x25b107>=_0x477e06){_0x25b107=_0x477e06;_0x43fc5e=0xc8;}else{_0x43fc5e=0xce;}_0x4bb6b5['status'](_0x43fc5e);return _0x4bb6b5[_0x1b24('0x14')](_0x1b24('0x15'),_0x417858+'-'+_0x25b107+'/'+_0x477e06)[_0x1b24('0xf')](_0x1fe5b7);}return null;};}function saveUpdates(_0x31646d){return function(_0x24bd09){if(_0x24bd09){return _0x24bd09[_0x1b24('0x16')](_0x31646d)[_0x1b24('0x17')](function(_0x5c800d){return _0x5c800d;});}return null;};}function removeEntity(_0x2f9bf5){return function(_0x47d172){if(_0x47d172){return _0x47d172[_0x1b24('0x18')]()[_0x1b24('0x17')](function(){var _0x2a7999=_0x47d172[_0x1b24('0x19')]({'plain':!![]});var _0x1c9fb7=_0x1b24('0x1a');return db[_0x1b24('0x1b')][_0x1b24('0x18')]({'where':{'type':_0x1c9fb7,'resourceId':_0x2a7999['id']}})[_0x1b24('0x17')](function(){return _0x47d172;});})[_0x1b24('0x17')](function(){_0x2f9bf5['status'](0xcc)[_0x1b24('0x1c')]();});}};}function handleEntityNotFound(_0xac537d){return function(_0x4d5488){if(!_0x4d5488){_0xac537d[_0x1b24('0xd')](0x194);}return _0x4d5488;};}function handleError(_0x51aa48,_0x345c88){_0x345c88=_0x345c88||0x1f4;return function(_0x14f766){logger[_0x1b24('0x1d')](_0x14f766[_0x1b24('0x1e')]);if(_0x14f766[_0x1b24('0x1f')]){delete _0x14f766['name'];}_0x51aa48['status'](_0x345c88)[_0x1b24('0x20')](_0x14f766);};}exports[_0x1b24('0x21')]=function(_0x4d7c16,_0xaaffaf){var _0xe2c294={};var _0x21c11a={'count':0x0,'rows':[]};var _0x5b1485=_[_0x1b24('0x22')](db[_0x1b24('0x23')][_0x1b24('0x24')],function(_0x4c1e5b){return{'name':_0x4c1e5b[_0x1b24('0x25')],'type':_0x4c1e5b[_0x1b24('0x26')][_0x1b24('0x27')]};});_0xe2c294=qs[_0x1b24('0x28')](_0x5b1485,_0x4d7c16);var _0x443749={'where':_0xe2c294[_0x1b24('0x29')]};return db[_0x1b24('0x23')]['count'](_0x443749)[_0x1b24('0x17')](function(_0x5d53ae){_0x21c11a[_0x1b24('0x13')]=_0x5d53ae;_0xe2c294[_0x1b24('0x2a')]=qs[_0x1b24('0x2a')](_0x4d7c16['query']);return db[_0x1b24('0x23')][_0x1b24('0x2b')](_0xe2c294);})[_0x1b24('0x17')](function(_0x3cb5b2){_0x21c11a[_0x1b24('0x2c')]=_0x3cb5b2;return _0x21c11a;})[_0x1b24('0x17')](respondWithFilteredResult(_0xaaffaf,_0xe2c294))[_0x1b24('0x2d')](handleError(_0xaaffaf,null));};exports['show']=function(_0x5a595,_0x30292b){var _0x3d20e7={'raw':!![],'where':{'id':_0x5a595['params']['id']}},_0x29d1f0={};_0x29d1f0['model']=_[_0x1b24('0x2e')](db[_0x1b24('0x23')][_0x1b24('0x24')]);_0x29d1f0['query']=_[_0x1b24('0x2e')](_0x5a595[_0x1b24('0x2f')]);_0x29d1f0['filters']=_[_0x1b24('0x30')](_0x29d1f0[_0x1b24('0x31')],_0x29d1f0[_0x1b24('0x2f')]);_0x3d20e7['attributes']=_[_0x1b24('0x30')](_0x29d1f0[_0x1b24('0x31')],qs[_0x1b24('0x32')](_0x5a595['query'][_0x1b24('0x32')]));_0x3d20e7[_0x1b24('0x33')]=_0x3d20e7[_0x1b24('0x33')][_0x1b24('0x34')]?_0x3d20e7[_0x1b24('0x33')]:_0x29d1f0[_0x1b24('0x31')];if(_0x5a595[_0x1b24('0x2f')]['includeAll']){_0x3d20e7[_0x1b24('0x2a')]=[{'all':!![]}];}_0x3d20e7=_[_0x1b24('0x35')]({},_0x3d20e7,_0x5a595[_0x1b24('0x36')]);return db['WhatsappQueue']['find'](_0x3d20e7)[_0x1b24('0x17')](handleEntityNotFound(_0x30292b,null))['then'](respondWithResult(_0x30292b,null))[_0x1b24('0x2d')](handleError(_0x30292b,null));};exports[_0x1b24('0x37')]=function(_0x17c643,_0x46ac04){return db[_0x1b24('0x23')][_0x1b24('0x37')](_0x17c643[_0x1b24('0x38')],{})[_0x1b24('0x17')](function(_0x4682b1){var _0x5892cf=_0x17c643[_0x1b24('0x39')][_0x1b24('0x19')]({'plain':!![]});if(!_0x5892cf)throw new Error(_0x1b24('0x3a'));if(_0x5892cf[_0x1b24('0x3b')]===_0x1b24('0x39')){var _0x5a0cab=_0x4682b1[_0x1b24('0x19')]({'plain':!![]});var _0x21daf5=_0x1b24('0x1a');return db[_0x1b24('0x3c')][_0x1b24('0x3d')]({'where':{'name':_0x21daf5,'userProfileId':_0x5892cf['userProfileId']},'raw':!![]})[_0x1b24('0x17')](function(_0x90ef87){if(_0x90ef87&&_0x90ef87[_0x1b24('0x3e')]===0x0){return db[_0x1b24('0x1b')][_0x1b24('0x37')]({'name':_0x5a0cab[_0x1b24('0x1f')],'resourceId':_0x5a0cab['id'],'type':_0x90ef87['name'],'sectionId':_0x90ef87['id']},{})[_0x1b24('0x17')](function(){return _0x4682b1;});}else{return _0x4682b1;}})[_0x1b24('0x2d')](function(_0x4b9ac2){logger[_0x1b24('0x1d')](_0x1b24('0x3f'),_0x4b9ac2);throw _0x4b9ac2;});}return _0x4682b1;})[_0x1b24('0x17')](respondWithResult(_0x46ac04,0xc9))['catch'](handleError(_0x46ac04,null));};exports[_0x1b24('0x16')]=function(_0x5727e7,_0x5325a0){if(_0x5727e7[_0x1b24('0x38')]['id']){delete _0x5727e7[_0x1b24('0x38')]['id'];}return db[_0x1b24('0x23')][_0x1b24('0x3d')]({'where':{'id':_0x5727e7[_0x1b24('0x40')]['id']}})['then'](handleEntityNotFound(_0x5325a0,null))[_0x1b24('0x17')](saveUpdates(_0x5727e7[_0x1b24('0x38')],null))[_0x1b24('0x17')](respondWithResult(_0x5325a0,null))[_0x1b24('0x2d')](handleError(_0x5325a0,null));};exports[_0x1b24('0x18')]=function(_0x44d1ac,_0x1dc2a4){return db[_0x1b24('0x23')][_0x1b24('0x3d')]({'where':{'id':_0x44d1ac[_0x1b24('0x40')]['id']}})[_0x1b24('0x17')](handleEntityNotFound(_0x1dc2a4,null))[_0x1b24('0x17')](removeEntity(_0x1dc2a4,null))[_0x1b24('0x2d')](handleError(_0x1dc2a4,null));};exports[_0x1b24('0x41')]=function(_0x329b3c,_0x2420ea){return db[_0x1b24('0x23')][_0x1b24('0x41')]()[_0x1b24('0x17')](respondWithResult(_0x2420ea,null))[_0x1b24('0x2d')](handleError(_0x2420ea,null));};exports[_0x1b24('0x42')]=function(_0x3fe29a,_0x52c094){var _0x4938d6={'raw':!![],'where':{}},_0x4e881f={},_0x3d12ed;return db['WhatsappQueue'][_0x1b24('0x43')]({'where':{'id':_0x3fe29a[_0x1b24('0x40')]['id']}})['then'](handleEntityNotFound(_0x52c094,null))[_0x1b24('0x17')](function(_0x3dbc70){if(_0x3dbc70){_0x3d12ed=_0x3dbc70[_0x1b24('0x19')]({'plain':!![]});_0x4e881f['model']=_[_0x1b24('0x2e')](db['UserWhatsappQueue'][_0x1b24('0x24')]);_0x4e881f[_0x1b24('0x2f')]=_[_0x1b24('0x2e')](_0x3fe29a[_0x1b24('0x2f')]);_0x4e881f['filters']=_[_0x1b24('0x30')](_0x4e881f['model'],_0x4e881f[_0x1b24('0x2f')]);_0x4938d6['attributes']=_['intersection'](_0x4e881f[_0x1b24('0x31')],qs[_0x1b24('0x32')](_0x3fe29a['query'][_0x1b24('0x32')]));_0x4938d6[_0x1b24('0x33')]=_0x4938d6['attributes'][_0x1b24('0x34')]?_0x4938d6[_0x1b24('0x33')]:_0x4e881f[_0x1b24('0x31')];if(!_0x3fe29a[_0x1b24('0x2f')][_0x1b24('0x44')](_0x1b24('0x45'))){_0x4938d6['limit']=qs[_0x1b24('0x12')](_0x3fe29a[_0x1b24('0x2f')][_0x1b24('0x12')]);_0x4938d6['offset']=qs[_0x1b24('0x10')](_0x3fe29a['query'][_0x1b24('0x10')]);}_0x4938d6['order']=qs[_0x1b24('0x46')](_0x3fe29a[_0x1b24('0x2f')][_0x1b24('0x46')]);_0x4938d6[_0x1b24('0x29')]=qs[_0x1b24('0x47')](_[_0x1b24('0x48')](_0x3fe29a[_0x1b24('0x2f')],_0x4e881f[_0x1b24('0x47')]));_0x4938d6[_0x1b24('0x29')][_0x1b24('0x49')]=_0x3dbc70['id'];if(_0x3fe29a[_0x1b24('0x2f')][_0x1b24('0x4a')]){_0x4938d6[_0x1b24('0x29')]=_['merge'](_0x4938d6[_0x1b24('0x29')],{'$or':_[_0x1b24('0x22')](_0x4938d6[_0x1b24('0x33')],function(_0xc2eda5){var _0x9a53d3={};_0x9a53d3[_0xc2eda5]={'$like':'%'+_0x3fe29a[_0x1b24('0x2f')][_0x1b24('0x4a')]+'%'};return _0x9a53d3;})});}_0x4938d6=_['merge']({},_0x4938d6,_0x3fe29a[_0x1b24('0x36')]);return db[_0x1b24('0x4b')][_0x1b24('0x2b')](_0x4938d6);}})[_0x1b24('0x17')](function(_0x54f39b){if(_0x54f39b){return db[_0x1b24('0x4c')][_0x1b24('0x4d')]({'where':{'id':_['map'](_0x54f39b,'UserId'),'role':_0x1b24('0x4e')},'attributes':['id',_0x1b24('0x1f'),'whatsappPause',_0x1b24('0x4f'),_0x1b24('0x50')]});}})[_0x1b24('0x17')](function(_0x33152b){if(_0x33152b){return{'count':_0x33152b[_0x1b24('0x13')],'rows':_['map'](_0x33152b[_0x1b24('0x2c')],function(_0x276ced){return{'membername':_0x276ced[_0x1b24('0x1f')],'UserId':_0x276ced['id'],'queue_name':_0x3d12ed['name'],'WhatsappQueueId':_0x3d12ed['id'],'interface':util[_0x1b24('0x51')]('%s/%s',_0x1b24('0x52'),_0x276ced[_0x1b24('0x1f')]),'penalty':0x0,'paused':_0x276ced[_0x1b24('0x53')],'createdAt':_0x276ced[_0x1b24('0x50')],'updatedAt':_0x276ced['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1b24('0x17')](respondWithFilteredResult(_0x52c094,_0x4938d6))[_0x1b24('0x2d')](handleError(_0x52c094,null));};exports['getTeams']=function(_0xf7d52,_0x4cac70){var _0x13817f={};var _0x1f2359={};var _0x5b4418;var _0x1a2add;return db[_0x1b24('0x23')]['findOne']({'where':{'id':_0xf7d52['params']['id']}})[_0x1b24('0x17')](handleEntityNotFound(_0x4cac70,null))[_0x1b24('0x17')](function(_0x50b9da){if(_0x50b9da){_0x5b4418=_0x50b9da;_0x1f2359[_0x1b24('0x31')]=_[_0x1b24('0x2e')](db['Team'][_0x1b24('0x24')]);_0x1f2359[_0x1b24('0x2f')]=_[_0x1b24('0x2e')](_0xf7d52[_0x1b24('0x2f')]);_0x1f2359[_0x1b24('0x47')]=_[_0x1b24('0x30')](_0x1f2359[_0x1b24('0x31')],_0x1f2359['query']);_0x13817f[_0x1b24('0x33')]=_['intersection'](_0x1f2359[_0x1b24('0x31')],qs['fields'](_0xf7d52['query'][_0x1b24('0x32')]));_0x13817f[_0x1b24('0x33')]=_0x13817f[_0x1b24('0x33')][_0x1b24('0x34')]?_0x13817f[_0x1b24('0x33')]:_0x1f2359[_0x1b24('0x31')];_0x13817f[_0x1b24('0x54')]=qs['sort'](_0xf7d52[_0x1b24('0x2f')]['sort']);_0x13817f['where']=qs[_0x1b24('0x47')](_['pick'](_0xf7d52[_0x1b24('0x2f')],_0x1f2359[_0x1b24('0x47')]));if(_0xf7d52[_0x1b24('0x2f')][_0x1b24('0x4a')]){_0x13817f[_0x1b24('0x29')]=_[_0x1b24('0x35')](_0x13817f['where'],{'$or':_[_0x1b24('0x22')](_0x13817f[_0x1b24('0x33')],function(_0x313500){var _0x15e0c9={};_0x15e0c9[_0x313500]={'$like':'%'+_0xf7d52[_0x1b24('0x2f')][_0x1b24('0x4a')]+'%'};return _0x15e0c9;})});}_0x13817f=_[_0x1b24('0x35')]({},_0x13817f,_0xf7d52[_0x1b24('0x36')]);return _0x5b4418[_0x1b24('0x55')](_0x13817f);}})[_0x1b24('0x17')](function(_0x125faa){if(_0x125faa){_0x1a2add=_0x125faa['length'];if(!_0xf7d52[_0x1b24('0x2f')][_0x1b24('0x44')](_0x1b24('0x45'))){_0x13817f[_0x1b24('0x12')]=qs[_0x1b24('0x12')](_0xf7d52[_0x1b24('0x2f')][_0x1b24('0x12')]);_0x13817f[_0x1b24('0x10')]=qs['offset'](_0xf7d52[_0x1b24('0x2f')][_0x1b24('0x10')]);}return _0x5b4418[_0x1b24('0x55')](_0x13817f);}})['then'](function(_0x1819cb){if(_0x1819cb){return _0x1819cb?{'count':_0x1a2add,'rows':_0x1819cb}:null;}})[_0x1b24('0x17')](respondWithResult(_0x4cac70,null))[_0x1b24('0x2d')](handleError(_0x4cac70,null));};exports[_0x1b24('0x56')]=function(_0x2bede5,_0x5378ee){var _0x2413f7=_0x2bede5[_0x1b24('0x38')][_0x1b24('0x57')];return db[_0x1b24('0x58')][_0x1b24('0x2b')]({'where':{'id':_0x2413f7},'attributes':['id'],'include':[{'model':db[_0x1b24('0x4c')],'as':'Agents','attributes':['id',_0x1b24('0x1f'),_0x1b24('0x59'),_0x1b24('0x5a'),_0x1b24('0x5b')],'raw':!![]}]})[_0x1b24('0x17')](function(_0xec08a){if(_0xec08a){var _0xc451ec=_[_0x1b24('0x5c')](_0xec08a,function(_0x5596b5){var _0x2b1c49=_0x5596b5[_0x1b24('0x19')]({'plain':!![]});return _0x2b1c49[_0x1b24('0x5d')];});return db[_0x1b24('0x23')][_0x1b24('0x3d')]({'where':{'id':_0x2bede5[_0x1b24('0x40')]['id']}})[_0x1b24('0x17')](function(_0x5bc73a){return db[_0x1b24('0x5e')][_0x1b24('0x5f')](function(_0x1bcdae){return _0x5bc73a['addTeams'](_0x2413f7,{'transaction':_0x1bcdae})[_0x1b24('0x17')](function(){return BPromise[_0x1b24('0x60')](_0xc451ec,function(_0x466e1b){return db[_0x1b24('0x4b')][_0x1b24('0x61')]({'where':{'UserId':_0x466e1b['id'],'WhatsappQueueId':_0x2bede5[_0x1b24('0x40')]['id']},'transaction':_0x1bcdae});});})['then'](function(){_0xc451ec[_0x1b24('0x62')](function(_0x6a9cfb){socket[_0x1b24('0x63')](_0x1b24('0x64'),{'UserId':_0x6a9cfb['id'],'WhatsappQueueId':_0x5bc73a['id']});});});});});}})['then'](respondWithStatusCode(_0x5378ee,null))[_0x1b24('0x2d')](handleError(_0x5378ee,null));};exports['removeTeams']=function(_0x4bfe23,_0x10415a){return db[_0x1b24('0x58')][_0x1b24('0x2b')]({'where':{'id':_0x4bfe23['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x1b24('0x4c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x10415a,null))[_0x1b24('0x17')](function(_0x187ecb){var _0x30c968=_[_0x1b24('0x22')](_0x187ecb,'id');var _0x13d8d8=[];var _0x2f7804=[];var _0xa66fe5=squel[_0x1b24('0x65')]();_0xa66fe5[_0x1b24('0x66')](_0x1b24('0x67'))[_0x1b24('0x68')]('team_has_whatsapp_queues','tq')[_0x1b24('0x69')](_0x1b24('0x6a'),'ut',_0x1b24('0x6b'))[_0x1b24('0x29')](_0x1b24('0x6c'),_0x4bfe23[_0x1b24('0x40')]['id']);for(var _0x5a539f=0x0;_0x5a539f<_0x187ecb[_0x1b24('0x34')];_0x5a539f+=0x1){let _0x3c4225=_0x187ecb[_0x5a539f];for(var _0x2c5a61=0x0;_0x2c5a61<_0x3c4225['Agents']['length'];_0x2c5a61+=0x1){let _0x10b10e=_0x3c4225['Agents'][_0x2c5a61];var _0x2bd21e=_0xa66fe5[_0x1b24('0x6d')]();_0x2bd21e[_0x1b24('0x29')](_0x1b24('0x6e'),_0x10b10e['id']);_0x2f7804[_0x1b24('0x6f')](db[_0x1b24('0x5e')][_0x1b24('0x2f')](_0x2bd21e[_0x1b24('0x70')](),{'type':db[_0x1b24('0x5e')][_0x1b24('0x71')][_0x1b24('0x72')]})[_0x1b24('0x17')](function(_0x169b33){if(_0x169b33[_0x1b24('0x34')]===0x1){return _0x10b10e['id'];}else{var _0x3467da=_['every'](_['map'](_0x169b33,_0x1b24('0x73')),function(_0x2f8485){return _[_0x1b24('0x74')](_0x30c968,_0x2f8485);});if(_0x3467da){return _0x10b10e['id'];}}}));}}return BPromise['all'](_0x2f7804)['then'](function(_0x564c73){_0x13d8d8=_(_0x13d8d8)[_0x1b24('0x75')](_0x564c73)[_0x1b24('0x76')]()[_0x1b24('0x77')]();return db[_0x1b24('0x23')][_0x1b24('0x3d')]({'where':{'id':_0x4bfe23[_0x1b24('0x40')]['id']}})[_0x1b24('0x17')](function(_0x16f469){return db[_0x1b24('0x5e')]['transaction'](function(_0x4598a5){return _0x16f469[_0x1b24('0x78')](_0x4bfe23[_0x1b24('0x2f')][_0x1b24('0x57')],{'transaction':_0x4598a5})[_0x1b24('0x17')](function(){if(!_['isEmpty'](_0x13d8d8)){return _0x16f469[_0x1b24('0x79')](_0x13d8d8,{'transaction':_0x4598a5});}})[_0x1b24('0x17')](function(){_0x13d8d8[_0x1b24('0x62')](function(_0x12dcb5){socket[_0x1b24('0x63')](_0x1b24('0x7a'),{'UserId':_0x12dcb5,'WhatsappQueueId':_0x16f469['id']});});});});});});})['then'](respondWithStatusCode(_0x10415a,null))['catch'](handleError(_0x10415a,null));};exports['addAgents']=function(_0x275b79,_0x2047a9){return db[_0x1b24('0x23')][_0x1b24('0x3d')]({'where':{'id':_0x275b79[_0x1b24('0x40')]['id']}})[_0x1b24('0x17')](handleEntityNotFound(_0x2047a9,null))[_0x1b24('0x17')](function(_0x135eaf){if(_0x135eaf){return _0x135eaf[_0x1b24('0x7b')](_0x275b79[_0x1b24('0x38')][_0x1b24('0x57')],_[_0x1b24('0x7c')](_0x275b79[_0x1b24('0x38')],[_0x1b24('0x57'),'id'])||{})['spread'](function(_0xf05221){for(var _0x231373=0x0;_0x231373<_0x275b79['body'][_0x1b24('0x57')][_0x1b24('0x34')];_0x231373+=0x1){socket['emit'](_0x1b24('0x64'),{'UserId':Number(_0x275b79['body']['ids'][_0x231373]),'WhatsappQueueId':Number(_0x275b79[_0x1b24('0x40')]['id'])});}return _0xf05221;});}})[_0x1b24('0x17')](respondWithResult(_0x2047a9,null))[_0x1b24('0x2d')](handleError(_0x2047a9,null));};exports[_0x1b24('0x79')]=function(_0x307717,_0x494b28){return db[_0x1b24('0x23')][_0x1b24('0x3d')]({'where':{'id':_0x307717['params']['id']}})[_0x1b24('0x17')](handleEntityNotFound(_0x494b28,null))[_0x1b24('0x17')](function(_0x4a5f23){if(_0x4a5f23){return _0x4a5f23[_0x1b24('0x79')](_0x307717[_0x1b24('0x2f')][_0x1b24('0x57')])[_0x1b24('0x17')](function(){if(_[_0x1b24('0x7d')](_0x307717[_0x1b24('0x2f')]['ids'])){for(var _0x3416ff=0x0;_0x3416ff<_0x307717['query'][_0x1b24('0x57')][_0x1b24('0x34')];_0x3416ff+=0x1){socket['emit'](_0x1b24('0x7a'),{'UserId':Number(_0x307717['query'][_0x1b24('0x57')][_0x3416ff]),'WhatsappQueueId':Number(_0x307717[_0x1b24('0x40')]['id'])});}}else{socket[_0x1b24('0x63')](_0x1b24('0x7a'),{'UserId':Number(_0x307717[_0x1b24('0x2f')][_0x1b24('0x57')]),'WhatsappQueueId':Number(_0x307717['params']['id'])});}});}})[_0x1b24('0x17')](respondWithStatusCode(_0x494b28,null))[_0x1b24('0x2d')](handleError(_0x494b28,null));};exports[_0x1b24('0x7e')]=function(_0x137bac,_0x16e1c2){var _0xa7f248={};var _0x595226={};var _0x59141e;var _0x422215;return db[_0x1b24('0x23')]['findOne']({'where':{'id':_0x137bac[_0x1b24('0x40')]['id']}})[_0x1b24('0x17')](handleEntityNotFound(_0x16e1c2,null))[_0x1b24('0x17')](function(_0x27bc42){if(_0x27bc42){_0x59141e=_0x27bc42;_0x595226['model']=_[_0x1b24('0x2e')](db['User'][_0x1b24('0x24')]);_0x595226[_0x1b24('0x2f')]=_[_0x1b24('0x2e')](_0x137bac[_0x1b24('0x2f')]);_0x595226[_0x1b24('0x47')]=_['intersection'](_0x595226[_0x1b24('0x31')],_0x595226[_0x1b24('0x2f')]);_0xa7f248[_0x1b24('0x33')]=_[_0x1b24('0x30')](_0x595226[_0x1b24('0x31')],qs[_0x1b24('0x32')](_0x137bac['query'][_0x1b24('0x32')]));_0xa7f248[_0x1b24('0x33')]=_0xa7f248[_0x1b24('0x33')]['length']?_0xa7f248[_0x1b24('0x33')]:_0x595226[_0x1b24('0x31')];_0xa7f248['order']=qs[_0x1b24('0x46')](_0x137bac['query']['sort']);_0xa7f248['where']=qs[_0x1b24('0x47')](_[_0x1b24('0x48')](_0x137bac[_0x1b24('0x2f')],_0x595226[_0x1b24('0x47')]));if(_0x137bac[_0x1b24('0x2f')][_0x1b24('0x4a')]){_0xa7f248[_0x1b24('0x29')]=_[_0x1b24('0x35')](_0xa7f248[_0x1b24('0x29')],{'$or':_[_0x1b24('0x22')](_0xa7f248[_0x1b24('0x33')],function(_0x1df832){var _0x340645={};_0x340645[_0x1df832]={'$like':'%'+_0x137bac['query'][_0x1b24('0x4a')]+'%'};return _0x340645;})});}_0xa7f248=_[_0x1b24('0x35')]({},_0xa7f248,_0x137bac['options']);return _0x59141e['getAgents'](_0xa7f248);}})[_0x1b24('0x17')](function(_0x458013){if(_0x458013){_0x422215=_0x458013[_0x1b24('0x34')];if(!_0x137bac[_0x1b24('0x2f')][_0x1b24('0x44')]('nolimit')){_0xa7f248['limit']=qs[_0x1b24('0x12')](_0x137bac[_0x1b24('0x2f')][_0x1b24('0x12')]);_0xa7f248['offset']=qs[_0x1b24('0x10')](_0x137bac['query'][_0x1b24('0x10')]);}return _0x59141e[_0x1b24('0x7e')](_0xa7f248);}})[_0x1b24('0x17')](function(_0x5f162f){if(_0x5f162f){return _0x5f162f?{'count':_0x422215,'rows':_0x5f162f}:null;}})['then'](respondWithResult(_0x16e1c2,null))[_0x1b24('0x2d')](handleError(_0x16e1c2,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6b15a5c..e6ed60e 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 _0x1bba=['WhatsappQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x58ba53,_0x57dba6){var _0x4f0785=function(_0x5c363f){while(--_0x5c363f){_0x58ba53['push'](_0x58ba53['shift']());}};_0x4f0785(++_0x57dba6);}(_0x1bba,0x7d));var _0xa1bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bba[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa1bb('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xa1bb('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa1bb('0x2')](0x0);var events={'afterCreate':_0xa1bb('0x3'),'afterUpdate':'update','afterDestroy':_0xa1bb('0x4')};function emitEvent(_0x5d0292){return function(_0x5df206,_0x2e8c24,_0x3a6080){WhatsappQueueEvents[_0xa1bb('0x5')](_0x5d0292+':'+_0x5df206['id'],_0x5df206);WhatsappQueueEvents[_0xa1bb('0x5')](_0x5d0292,_0x5df206);_0x3a6080(null);};}for(var e in events){if(events[_0xa1bb('0x6')](e)){var event=events[e];WhatsappQueue[_0xa1bb('0x7')](e,emitEvent(event));}}module[_0xa1bb('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x75a3=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x55cac7,_0x120442){var _0x2e9d19=function(_0x53c624){while(--_0x53c624){_0x55cac7['push'](_0x55cac7['shift']());}};_0x2e9d19(++_0x120442);}(_0x75a3,0x11e));var _0x375a=function(_0x1db9e7,_0xc84467){_0x1db9e7=_0x1db9e7-0x0;var _0x8109c8=_0x75a3[_0x1db9e7];return _0x8109c8;};'use strict';var EventEmitter=require(_0x375a('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x375a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x375a('0x2'),'afterDestroy':_0x375a('0x3')};function emitEvent(_0x49c5eb){return function(_0x11b04d,_0x540b24,_0x5042a1){WhatsappQueueEvents[_0x375a('0x4')](_0x49c5eb+':'+_0x11b04d['id'],_0x11b04d);WhatsappQueueEvents[_0x375a('0x4')](_0x49c5eb,_0x11b04d);_0x5042a1(null);};}for(var e in events){if(events[_0x375a('0x5')](e)){var event=events[e];WhatsappQueue[_0x375a('0x6')](e,emitEvent(event));}}module[_0x375a('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index aac5a00..f348f73 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 _0xea11=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x2055a7,_0x415a4c){var _0x42a14d=function(_0x83139b){while(--_0x83139b){_0x2055a7['push'](_0x2055a7['shift']());}};_0x42a14d(++_0x415a4c);}(_0xea11,0x136));var _0x1ea1=function(_0x47f55f,_0x5b097c){_0x47f55f=_0x47f55f-0x0;var _0x310668=_0xea11[_0x47f55f];return _0x310668;};'use strict';var _=require(_0x1ea1('0x0'));var util=require(_0x1ea1('0x1'));var logger=require(_0x1ea1('0x2'))(_0x1ea1('0x3'));var moment=require(_0x1ea1('0x4'));var BPromise=require(_0x1ea1('0x5'));var rp=require(_0x1ea1('0x6'));var fs=require('fs');var path=require(_0x1ea1('0x7'));var rimraf=require(_0x1ea1('0x8'));var config=require('../../config/environment');var attributes=require(_0x1ea1('0x9'));module[_0x1ea1('0xa')]=function(_0x46e9a5,_0xb0a43b){return _0x46e9a5['define'](_0x1ea1('0xb'),attributes,{'tableName':_0x1ea1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcced=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','whatsapp_queues'];(function(_0x576277,_0x48d969){var _0x30701d=function(_0x4d54b3){while(--_0x4d54b3){_0x576277['push'](_0x576277['shift']());}};_0x30701d(++_0x48d969);}(_0xcced,0x1a2));var _0xdcce=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0xcced[_0x2f4c1c];return _0x25e0f2;};'use strict';var _=require('lodash');var util=require(_0xdcce('0x0'));var logger=require(_0xdcce('0x1'))(_0xdcce('0x2'));var moment=require(_0xdcce('0x3'));var BPromise=require(_0xdcce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcce('0x5'));var rimraf=require(_0xdcce('0x6'));var config=require(_0xdcce('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0xdcce('0x8')]=function(_0x202264,_0x25cba3){return _0x202264[_0xdcce('0x9')]('WhatsappQueue',attributes,{'tableName':_0xdcce('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 3a8058e..c54bd95 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 _0x31d7=['message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','error','WhatsappQueue,\x20%s,\x20%s'];(function(_0x1c3289,_0xea2c06){var _0x285de2=function(_0x3195ee){while(--_0x3195ee){_0x1c3289['push'](_0x1c3289['shift']());}};_0x285de2(++_0xea2c06);}(_0x31d7,0x8e));var _0x731d=function(_0x431d14,_0x2da966){_0x431d14=_0x431d14-0x0;var _0x55a82e=_0x31d7[_0x431d14];return _0x55a82e;};'use strict';var _=require(_0x731d('0x0'));var util=require(_0x731d('0x1'));var moment=require(_0x731d('0x2'));var BPromise=require(_0x731d('0x3'));var rs=require(_0x731d('0x4'));var fs=require('fs');var Redis=require(_0x731d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x731d('0x6'));var logger=require(_0x731d('0x7'))(_0x731d('0x8'));var config=require(_0x731d('0x9'));var jayson=require(_0x731d('0xa'));var client=jayson[_0x731d('0xb')][_0x731d('0xc')]({'port':0x232a});config[_0x731d('0xd')]=_[_0x731d('0xe')](config[_0x731d('0xd')],{'host':_0x731d('0xf'),'port':0x18eb});var socket=require(_0x731d('0x10'))(new Redis(config['redis']));require(_0x731d('0x11'))[_0x731d('0x12')](socket);function respondWithRpcPromise(_0x108616,_0x4d86d4,_0x267efa){return new BPromise(function(_0x4be933,_0x58263b){return client[_0x731d('0x13')](_0x108616,_0x267efa)[_0x731d('0x14')](function(_0x2307c1){logger[_0x731d('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4d86d4,_0x731d('0x16'));logger[_0x731d('0x17')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4d86d4,_0x731d('0x16'),JSON['stringify'](_0x2307c1));if(_0x2307c1[_0x731d('0x18')]){if(_0x2307c1['error']['code']===0x1f4){logger['error'](_0x731d('0x19'),_0x4d86d4,_0x2307c1[_0x731d('0x18')][_0x731d('0x1a')]);return _0x58263b(_0x2307c1[_0x731d('0x18')][_0x731d('0x1a')]);}logger[_0x731d('0x18')](_0x731d('0x19'),_0x4d86d4,_0x2307c1[_0x731d('0x18')][_0x731d('0x1a')]);return _0x4be933(_0x2307c1[_0x731d('0x18')][_0x731d('0x1a')]);}else{logger['info'](_0x731d('0x19'),_0x4d86d4,_0x731d('0x16'));_0x4be933(_0x2307c1[_0x731d('0x1b')][_0x731d('0x1a')]);}})[_0x731d('0x1c')](function(_0xab4ec0){logger['error'](_0x731d('0x19'),_0x4d86d4,_0xab4ec0);_0x58263b(_0xab4ec0);});});}exports[_0x731d('0x1d')]=function(_0x134240){var _0x5d7a94=this;return new Promise(function(_0x41f1f0,_0x4b1f7c){return db[_0x731d('0x1e')][_0x731d('0x1f')]({'raw':_0x134240['options']?_0x134240[_0x731d('0x20')][_0x731d('0x21')]===undefined?!![]:![]:!![],'where':_0x134240[_0x731d('0x20')]?_0x134240['options'][_0x731d('0x22')]||null:null,'attributes':_0x134240[_0x731d('0x20')]?_0x134240['options'][_0x731d('0x23')]||null:null,'limit':_0x134240[_0x731d('0x20')]?_0x134240[_0x731d('0x20')][_0x731d('0x24')]||null:null,'include':_0x134240['options']?_0x134240[_0x731d('0x20')][_0x731d('0x25')]?_[_0x731d('0x26')](_0x134240[_0x731d('0x20')][_0x731d('0x25')],function(_0x28418c){return{'model':db[_0x28418c['model']],'as':_0x28418c['as'],'attributes':_0x28418c[_0x731d('0x23')],'include':_0x28418c['include']?_[_0x731d('0x26')](_0x28418c[_0x731d('0x25')],function(_0x19e148){return{'model':db[_0x19e148['model']],'as':_0x19e148['as'],'attributes':_0x19e148['attributes'],'include':_0x19e148[_0x731d('0x25')]?_['map'](_0x19e148['include'],function(_0x4488db){return{'model':db[_0x4488db[_0x731d('0x27')]],'as':_0x4488db['as'],'attributes':_0x4488db[_0x731d('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcd633e){logger['info'](_0x731d('0x1d'),_0x134240);logger[_0x731d('0x17')](_0x731d('0x1d'),_0x134240,JSON['stringify'](_0xcd633e));_0x41f1f0(_0xcd633e);})[_0x731d('0x1c')](function(_0x34c2a0){logger[_0x731d('0x18')]('GetWhatsappQueue',_0x34c2a0[_0x731d('0x1a')],_0x134240);_0x4b1f7c(_0x5d7a94[_0x731d('0x18')](0x1f4,_0x34c2a0[_0x731d('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x886b9d){var _0x42d520=this;return new Promise(function(_0x821e8b,_0x2b2ce2){return db[_0x731d('0x1e')]['find']({'raw':_0x886b9d[_0x731d('0x20')]?_0x886b9d[_0x731d('0x20')][_0x731d('0x21')]===undefined?!![]:![]:!![],'where':_0x886b9d[_0x731d('0x20')]?_0x886b9d[_0x731d('0x20')][_0x731d('0x22')]||null:null,'attributes':_0x886b9d[_0x731d('0x20')]?_0x886b9d[_0x731d('0x20')]['attributes']||null:null,'include':_0x886b9d['options']?_0x886b9d[_0x731d('0x20')][_0x731d('0x25')]?_[_0x731d('0x26')](_0x886b9d[_0x731d('0x20')][_0x731d('0x25')],function(_0x38bd59){return{'model':db[_0x38bd59[_0x731d('0x27')]],'as':_0x38bd59['as'],'attributes':_0x38bd59['attributes'],'include':_0x38bd59[_0x731d('0x25')]?_[_0x731d('0x26')](_0x38bd59[_0x731d('0x25')],function(_0x3e05f4){return{'model':db[_0x3e05f4[_0x731d('0x27')]],'as':_0x3e05f4['as'],'attributes':_0x3e05f4[_0x731d('0x23')],'include':_0x3e05f4[_0x731d('0x25')]?_[_0x731d('0x26')](_0x3e05f4['include'],function(_0x43a47b){return{'model':db[_0x43a47b['model']],'as':_0x43a47b['as'],'attributes':_0x43a47b[_0x731d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x731d('0x14')](function(_0x4fd294){logger[_0x731d('0x15')](_0x731d('0x28'),_0x886b9d);logger['debug'](_0x731d('0x28'),_0x886b9d,JSON[_0x731d('0x29')](_0x4fd294));_0x821e8b(_0x4fd294);})[_0x731d('0x1c')](function(_0x536388){logger[_0x731d('0x18')](_0x731d('0x28'),_0x536388[_0x731d('0x1a')],_0x886b9d);_0x2b2ce2(_0x42d520['error'](0x1f4,_0x536388[_0x731d('0x1a')]));});});}; \ No newline at end of file +var _0xb106=['defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','WhatsappQueue','findAll','options','attributes','limit','include','map','model','GetWhatsappQueue','find','raw','where','ShowWhatsappQueue','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x57353a,_0x24120a){var _0x11c8d0=function(_0x40b012){while(--_0x40b012){_0x57353a['push'](_0x57353a['shift']());}};_0x11c8d0(++_0x24120a);}(_0xb106,0xe2));var _0x6b10=function(_0x54be4c,_0x46690a){_0x54be4c=_0x54be4c-0x0;var _0x37ee45=_0xb106[_0x54be4c];return _0x37ee45;};'use strict';var _=require(_0x6b10('0x0'));var util=require('util');var moment=require(_0x6b10('0x1'));var BPromise=require(_0x6b10('0x2'));var rs=require(_0x6b10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6b10('0x4'))('rpc');var config=require(_0x6b10('0x5'));var jayson=require(_0x6b10('0x6'));var client=jayson[_0x6b10('0x7')]['http']({'port':0x232a});config['redis']=_[_0x6b10('0x8')](config[_0x6b10('0x9')],{'host':_0x6b10('0xa'),'port':0x18eb});var socket=require(_0x6b10('0xb'))(new Redis(config[_0x6b10('0x9')]));require(_0x6b10('0xc'))[_0x6b10('0xd')](socket);function respondWithRpcPromise(_0x3b2785,_0xae3174,_0x29d278){return new BPromise(function(_0x415286,_0x2ed99f){return client[_0x6b10('0xe')](_0x3b2785,_0x29d278)[_0x6b10('0xf')](function(_0x27814c){logger[_0x6b10('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0xae3174,'request\x20sent');logger[_0x6b10('0x11')](_0x6b10('0x12'),_0xae3174,'request\x20sent',JSON[_0x6b10('0x13')](_0x27814c));if(_0x27814c[_0x6b10('0x14')]){if(_0x27814c['error'][_0x6b10('0x15')]===0x1f4){logger[_0x6b10('0x14')](_0x6b10('0x16'),_0xae3174,_0x27814c[_0x6b10('0x14')][_0x6b10('0x17')]);return _0x2ed99f(_0x27814c[_0x6b10('0x14')][_0x6b10('0x17')]);}logger[_0x6b10('0x14')](_0x6b10('0x16'),_0xae3174,_0x27814c[_0x6b10('0x14')]['message']);return _0x415286(_0x27814c[_0x6b10('0x14')]['message']);}else{logger[_0x6b10('0x10')](_0x6b10('0x16'),_0xae3174,'request\x20sent');_0x415286(_0x27814c[_0x6b10('0x18')][_0x6b10('0x17')]);}})[_0x6b10('0x19')](function(_0x59afc4){logger['error'](_0x6b10('0x16'),_0xae3174,_0x59afc4);_0x2ed99f(_0x59afc4);});});}exports['GetWhatsappQueue']=function(_0xd45415){var _0x324882=this;return new Promise(function(_0x22073d,_0x40738f){return db[_0x6b10('0x1a')][_0x6b10('0x1b')]({'raw':_0xd45415[_0x6b10('0x1c')]?_0xd45415[_0x6b10('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xd45415[_0x6b10('0x1c')]?_0xd45415[_0x6b10('0x1c')]['where']||null:null,'attributes':_0xd45415[_0x6b10('0x1c')]?_0xd45415['options'][_0x6b10('0x1d')]||null:null,'limit':_0xd45415[_0x6b10('0x1c')]?_0xd45415[_0x6b10('0x1c')][_0x6b10('0x1e')]||null:null,'include':_0xd45415[_0x6b10('0x1c')]?_0xd45415['options'][_0x6b10('0x1f')]?_['map'](_0xd45415[_0x6b10('0x1c')][_0x6b10('0x1f')],function(_0x5a9fef){return{'model':db[_0x5a9fef['model']],'as':_0x5a9fef['as'],'attributes':_0x5a9fef['attributes'],'include':_0x5a9fef[_0x6b10('0x1f')]?_[_0x6b10('0x20')](_0x5a9fef['include'],function(_0xfb1231){return{'model':db[_0xfb1231[_0x6b10('0x21')]],'as':_0xfb1231['as'],'attributes':_0xfb1231[_0x6b10('0x1d')],'include':_0xfb1231[_0x6b10('0x1f')]?_['map'](_0xfb1231[_0x6b10('0x1f')],function(_0xe11c5d){return{'model':db[_0xe11c5d['model']],'as':_0xe11c5d['as'],'attributes':_0xe11c5d[_0x6b10('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x737fcc){logger[_0x6b10('0x10')](_0x6b10('0x22'),_0xd45415);logger[_0x6b10('0x11')](_0x6b10('0x22'),_0xd45415,JSON[_0x6b10('0x13')](_0x737fcc));_0x22073d(_0x737fcc);})[_0x6b10('0x19')](function(_0x1befaf){logger[_0x6b10('0x14')](_0x6b10('0x22'),_0x1befaf[_0x6b10('0x17')],_0xd45415);_0x40738f(_0x324882[_0x6b10('0x14')](0x1f4,_0x1befaf[_0x6b10('0x17')]));});});};exports['ShowWhatsappQueue']=function(_0x39daf6){var _0x183db4=this;return new Promise(function(_0x2743a2,_0x1149ef){return db[_0x6b10('0x1a')][_0x6b10('0x23')]({'raw':_0x39daf6[_0x6b10('0x1c')]?_0x39daf6[_0x6b10('0x1c')][_0x6b10('0x24')]===undefined?!![]:![]:!![],'where':_0x39daf6[_0x6b10('0x1c')]?_0x39daf6['options'][_0x6b10('0x25')]||null:null,'attributes':_0x39daf6[_0x6b10('0x1c')]?_0x39daf6[_0x6b10('0x1c')][_0x6b10('0x1d')]||null:null,'include':_0x39daf6[_0x6b10('0x1c')]?_0x39daf6[_0x6b10('0x1c')][_0x6b10('0x1f')]?_[_0x6b10('0x20')](_0x39daf6['options'][_0x6b10('0x1f')],function(_0x489d60){return{'model':db[_0x489d60[_0x6b10('0x21')]],'as':_0x489d60['as'],'attributes':_0x489d60['attributes'],'include':_0x489d60[_0x6b10('0x1f')]?_['map'](_0x489d60[_0x6b10('0x1f')],function(_0x4fd4e8){return{'model':db[_0x4fd4e8['model']],'as':_0x4fd4e8['as'],'attributes':_0x4fd4e8[_0x6b10('0x1d')],'include':_0x4fd4e8[_0x6b10('0x1f')]?_[_0x6b10('0x20')](_0x4fd4e8['include'],function(_0x243ec4){return{'model':db[_0x243ec4[_0x6b10('0x21')]],'as':_0x243ec4['as'],'attributes':_0x243ec4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x613476){logger[_0x6b10('0x10')](_0x6b10('0x26'),_0x39daf6);logger[_0x6b10('0x11')](_0x6b10('0x26'),_0x39daf6,JSON[_0x6b10('0x13')](_0x613476));_0x2743a2(_0x613476);})[_0x6b10('0x19')](function(_0x738f3){logger[_0x6b10('0x14')](_0x6b10('0x26'),_0x738f3[_0x6b10('0x17')],_0x39daf6);_0x1149ef(_0x183db4[_0x6b10('0x14')](0x1f4,_0x738f3[_0x6b10('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 300a952..a0ed7e5 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 _0xe307=['whatsappQueue:','remove','update','emit','removeListener','register','length'];(function(_0xe47fd2,_0x5d6aa8){var _0x41034c=function(_0x40994c){while(--_0x40994c){_0xe47fd2['push'](_0xe47fd2['shift']());}};_0x41034c(++_0x5d6aa8);}(_0xe307,0x16d));var _0x7e30=function(_0x220a60,_0x4e37f7){_0x220a60=_0x220a60-0x0;var _0x571f14=_0xe307[_0x220a60];return _0x571f14;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x7e30('0x0'),_0x7e30('0x1')];function createListener(_0xb3a47b,_0x1f8f3b){return function(_0x12f96d){_0x1f8f3b[_0x7e30('0x2')](_0xb3a47b,_0x12f96d);};}function removeListener(_0xbb36e6,_0xf575ea){return function(){WhatsappQueueEvents[_0x7e30('0x3')](_0xbb36e6,_0xf575ea);};}exports[_0x7e30('0x4')]=function(_0x4d41fd){for(var _0x2cc308=0x0,_0xecc52b=events[_0x7e30('0x5')];_0x2cc308<_0xecc52b;_0x2cc308++){var _0x4612b1=events[_0x2cc308];var _0xcf2f36=createListener(_0x7e30('0x6')+_0x4612b1,_0x4d41fd);WhatsappQueueEvents['on'](_0x4612b1,_0xcf2f36);}}; \ No newline at end of file +var _0x7e77=['save','update','emit','register','length','whatsappQueue:'];(function(_0x8a500c,_0x200848){var _0x117e7b=function(_0x5dace8){while(--_0x5dace8){_0x8a500c['push'](_0x8a500c['shift']());}};_0x117e7b(++_0x200848);}(_0x7e77,0xba));var _0x77e7=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x7e77[_0x36ed3c];return _0x52a2e0;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x77e7('0x0'),'remove',_0x77e7('0x1')];function createListener(_0x3a254b,_0x49f8d4){return function(_0x27fb67){_0x49f8d4[_0x77e7('0x2')](_0x3a254b,_0x27fb67);};}function removeListener(_0x555532,_0x119ca0){return function(){WhatsappQueueEvents['removeListener'](_0x555532,_0x119ca0);};}exports[_0x77e7('0x3')]=function(_0x5f328d){for(var _0x363774=0x0,_0x355a54=events[_0x77e7('0x4')];_0x363774<_0x355a54;_0x363774++){var _0x5e8b75=events[_0x363774];var _0x1b0bd8=createListener(_0x77e7('0x5')+_0x5e8b75,_0x5f328d);WhatsappQueueEvents['on'](_0x5e8b75,_0x1b0bd8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5ca47c3..554da05 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 _0x0490=['delete','destroy','multer','Router','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0xd050c6,_0x58ffb4){var _0x7278a=function(_0x16d03e){while(--_0x16d03e){_0xd050c6['push'](_0xd050c6['shift']());}};_0x7278a(++_0x58ffb4);}(_0x0490,0xfe));var _0x0049=function(_0x50c5b5,_0x24e480){_0x50c5b5=_0x50c5b5-0x0;var _0x46c94a=_0x0490[_0x50c5b5];return _0x46c94a;};'use strict';var multer=require(_0x0049('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0049('0x1')]();var fs_extra=require(_0x0049('0x2'));var auth=require(_0x0049('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0049('0x4'));router[_0x0049('0x5')]('/',auth[_0x0049('0x6')](),controller[_0x0049('0x7')]);router[_0x0049('0x5')](_0x0049('0x8'),auth[_0x0049('0x6')](),controller[_0x0049('0x9')]);router[_0x0049('0x5')](_0x0049('0xa'),auth['isAuthenticated'](),controller[_0x0049('0xb')]);router[_0x0049('0xc')]('/',auth[_0x0049('0x6')](),controller[_0x0049('0xd')]);router[_0x0049('0xe')](_0x0049('0xa'),auth[_0x0049('0x6')](),controller[_0x0049('0xf')]);router[_0x0049('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0049('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3656=['show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x372efe,_0x641cea){var _0x2b0b2d=function(_0x44b8ae){while(--_0x44b8ae){_0x372efe['push'](_0x372efe['shift']());}};_0x2b0b2d(++_0x641cea);}(_0x3656,0x1a8));var _0x6365=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x3656[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x6365('0x0'));var util=require(_0x6365('0x1'));var path=require(_0x6365('0x2'));var timeout=require(_0x6365('0x3'));var express=require(_0x6365('0x4'));var router=express[_0x6365('0x5')]();var fs_extra=require(_0x6365('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6365('0x7'));var config=require(_0x6365('0x8'));var controller=require(_0x6365('0x9'));router[_0x6365('0xa')]('/',auth[_0x6365('0xb')](),controller[_0x6365('0xc')]);router[_0x6365('0xa')](_0x6365('0xd'),auth[_0x6365('0xb')](),controller[_0x6365('0xe')]);router[_0x6365('0xa')](_0x6365('0xf'),auth[_0x6365('0xb')](),controller[_0x6365('0x10')]);router[_0x6365('0x11')]('/',auth[_0x6365('0xb')](),controller['create']);router[_0x6365('0x12')](_0x6365('0xf'),auth['isAuthenticated'](),controller[_0x6365('0x13')]);router['delete']('/:id',auth[_0x6365('0xb')](),controller[_0x6365('0x14')]);module[_0x6365('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 22c51c0..8c31ead 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(_0x16289e,_0x2cb79f){var _0x160af4=function(_0x21e97f){while(--_0x21e97f){_0x16289e['push'](_0x16289e['shift']());}};_0x160af4(++_0x2cb79f);}(_0x7a54,0x106));var _0x47a5=function(_0x3bd77c,_0x523a32){_0x3bd77c=_0x3bd77c-0x0;var _0x1d885c=_0x7a54[_0x3bd77c];return _0x1d885c;};'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(_0x4d70cc,_0x4860ca){var _0x485bb4=function(_0x4210f3){while(--_0x4210f3){_0x4d70cc['push'](_0x4d70cc['shift']());}};_0x485bb4(++_0x4860ca);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 b9b4394..34ab944 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 _0xb9a7=['include','rows','catch','show','params','rawAttributes','intersection','create','body','describe','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','stack','map','WhatsappQueueReport','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll'];(function(_0x25f5e4,_0x5d4541){var _0x27ebba=function(_0x1256f7){while(--_0x1256f7){_0x25f5e4['push'](_0x25f5e4['shift']());}};_0x27ebba(++_0x5d4541);}(_0xb9a7,0x112));var _0x7b9a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xb9a7[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)[_0x7b9a('0x15')]();});}};}function handleEntityNotFound(_0x23219e,_0x5809f5){return function(_0x39b7ec){if(!_0x39b7ec){_0x23219e['sendStatus'](0x194);}return _0x39b7ec;};}function handleError(_0x31eb67,_0x3091ab){_0x3091ab=_0x3091ab||0x1f4;return function(_0x4c2271){logger['error'](_0x4c2271[_0x7b9a('0x20')]);if(_0x4c2271['name']){delete _0x4c2271['name'];}_0x31eb67[_0x7b9a('0x14')](_0x3091ab)['send'](_0x4c2271);};}exports['index']=function(_0x3847b4,_0x4d5880){var _0x5c89b6={},_0x314b6d={},_0x4fee38={'count':0x0,'rows':[]};var _0x1553ae=_[_0x7b9a('0x21')](db[_0x7b9a('0x22')]['rawAttributes'],function(_0x45ccf5){return{'name':_0x45ccf5[_0x7b9a('0x23')],'type':_0x45ccf5[_0x7b9a('0x24')][_0x7b9a('0x25')]};});_0x314b6d[_0x7b9a('0x26')]=_[_0x7b9a('0x21')](_0x1553ae,'name');_0x314b6d['query']=_[_0x7b9a('0x27')](_0x3847b4[_0x7b9a('0x28')]);_0x314b6d[_0x7b9a('0x29')]=_['intersection'](_0x314b6d[_0x7b9a('0x26')],_0x314b6d[_0x7b9a('0x28')]);_0x5c89b6['attributes']=_['intersection'](_0x314b6d[_0x7b9a('0x26')],qs[_0x7b9a('0x2a')](_0x3847b4['query'][_0x7b9a('0x2a')]));_0x5c89b6[_0x7b9a('0x2b')]=_0x5c89b6[_0x7b9a('0x2b')][_0x7b9a('0x2c')]?_0x5c89b6[_0x7b9a('0x2b')]:_0x314b6d['model'];if(!_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x2d')](_0x7b9a('0x2e'))){_0x5c89b6[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x3847b4[_0x7b9a('0x28')]['limit']);_0x5c89b6['offset']=qs[_0x7b9a('0x17')](_0x3847b4[_0x7b9a('0x28')]['offset']);}_0x5c89b6[_0x7b9a('0x2f')]=qs[_0x7b9a('0x30')](_0x3847b4[_0x7b9a('0x28')]['sort']);_0x5c89b6[_0x7b9a('0x31')]=qs[_0x7b9a('0x29')](_['pick'](_0x3847b4['query'],_0x314b6d[_0x7b9a('0x29')]),_0x1553ae);if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]){_0x5c89b6[_0x7b9a('0x31')]=_[_0x7b9a('0x33')](_0x5c89b6[_0x7b9a('0x31')],{'$or':_[_0x7b9a('0x21')](_0x1553ae,function(_0x380f4b){if(_0x380f4b['type']!==_0x7b9a('0x34')){var _0x5ac175={};_0x5ac175[_0x380f4b[_0x7b9a('0x35')]]={'$like':'%'+_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]+'%'};return _0x5ac175;}})});}_0x5c89b6=_[_0x7b9a('0x33')]({},_0x5c89b6,_0x3847b4[_0x7b9a('0x36')]);var _0x89951b={'where':_0x5c89b6['where']};return db[_0x7b9a('0x22')][_0x7b9a('0x19')](_0x89951b)[_0x7b9a('0x1e')](function(_0x1bc1f0){_0x4fee38['count']=_0x1bc1f0;if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x5c89b6[_0x7b9a('0x38')]=[{'all':!![]}];}return db[_0x7b9a('0x22')]['findAll'](_0x5c89b6);})[_0x7b9a('0x1e')](function(_0x53d89a){_0x4fee38[_0x7b9a('0x39')]=_0x53d89a;return _0x4fee38;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x4d5880,_0x5c89b6))[_0x7b9a('0x3a')](handleError(_0x4d5880,null));};exports[_0x7b9a('0x3b')]=function(_0x43fad0,_0x41f541){var _0x56e274={'raw':!![],'where':{'id':_0x43fad0[_0x7b9a('0x3c')]['id']}},_0x33edc6={};_0x33edc6[_0x7b9a('0x26')]=_['keys'](db['WhatsappQueueReport'][_0x7b9a('0x3d')]);_0x33edc6[_0x7b9a('0x28')]=_[_0x7b9a('0x27')](_0x43fad0[_0x7b9a('0x28')]);_0x33edc6[_0x7b9a('0x29')]=_[_0x7b9a('0x3e')](_0x33edc6['model'],_0x33edc6['query']);_0x56e274['attributes']=_[_0x7b9a('0x3e')](_0x33edc6[_0x7b9a('0x26')],qs['fields'](_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x2a')]));_0x56e274[_0x7b9a('0x2b')]=_0x56e274['attributes'][_0x7b9a('0x2c')]?_0x56e274['attributes']:_0x33edc6[_0x7b9a('0x26')];if(_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x56e274[_0x7b9a('0x38')]=[{'all':!![]}];}_0x56e274=_[_0x7b9a('0x33')]({},_0x56e274,_0x43fad0['options']);return db[_0x7b9a('0x22')]['find'](_0x56e274)[_0x7b9a('0x1e')](handleEntityNotFound(_0x41f541,null))['then'](respondWithResult(_0x41f541,null))['catch'](handleError(_0x41f541,null));};exports[_0x7b9a('0x3f')]=function(_0x3727ef,_0x717d08){return db[_0x7b9a('0x22')][_0x7b9a('0x3f')](_0x3727ef[_0x7b9a('0x40')],{})[_0x7b9a('0x1e')](respondWithResult(_0x717d08,0xc9))[_0x7b9a('0x3a')](handleError(_0x717d08,null));};exports[_0x7b9a('0x1d')]=function(_0x5088c7,_0x1d7957){if(_0x5088c7[_0x7b9a('0x40')]['id']){delete _0x5088c7['body']['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x5088c7[_0x7b9a('0x3c')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1d7957,null))[_0x7b9a('0x1e')](saveUpdates(_0x5088c7[_0x7b9a('0x40')],null))['then'](respondWithResult(_0x1d7957,null))[_0x7b9a('0x3a')](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1f')]=function(_0x287dea,_0x33b200){return db[_0x7b9a('0x22')]['find']({'where':{'id':_0x287dea[_0x7b9a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x33b200,null))[_0x7b9a('0x1e')](removeEntity(_0x33b200,null))[_0x7b9a('0x3a')](handleError(_0x33b200,null));};exports[_0x7b9a('0x41')]=function(_0x3f42a2,_0x52f2ca){return db[_0x7b9a('0x22')][_0x7b9a('0x41')]()[_0x7b9a('0x1e')](respondWithResult(_0x52f2ca,null))[_0x7b9a('0x3a')](handleError(_0x52f2ca,null));}; \ No newline at end of file +var _0xb58b=['save','update','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject'];(function(_0x4817d4,_0x30e445){var _0x1a1c93=function(_0x4bdfa7){while(--_0x4bdfa7){_0x4817d4['push'](_0x4817d4['shift']());}};_0x1a1c93(++_0x30e445);}(_0xb58b,0x1f1));var _0xbb58=function(_0x277e8c,_0x1b3092){_0x277e8c=_0x277e8c-0x0;var _0x5bb34b=_0xb58b[_0x277e8c];return _0x5bb34b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe88799,_0x18810f){_0x18810f=_0x18810f||0xcc;return function(_0x4cda21){if(_0x4cda21){return _0xe88799[_0xbb58('0x18')](_0x18810f);}return _0xe88799[_0xbb58('0x19')](_0x18810f)[_0xbb58('0x1a')]();};}function respondWithResult(_0x3b9406,_0x19ceda){_0x19ceda=_0x19ceda||0xc8;return function(_0x58245f){if(_0x58245f){return _0x3b9406[_0xbb58('0x19')](_0x19ceda)[_0xbb58('0x1b')](_0x58245f);}};}function respondWithFilteredResult(_0x5f4751,_0x4ba30e){return function(_0x33c20f){if(_0x33c20f){var _0x445b1f=typeof _0x4ba30e[_0xbb58('0x1c')]==='undefined'&&typeof _0x4ba30e['limit']==='undefined';var _0x55156e=_0x33c20f[_0xbb58('0x1d')];var _0x3134ea=_0x445b1f?0x0:_0x4ba30e['offset'];var _0xbee66=_0x445b1f?_0x33c20f['count']:_0x4ba30e[_0xbb58('0x1c')]+_0x4ba30e[_0xbb58('0x1e')];var _0x3c33d9;if(_0xbee66>=_0x55156e){_0xbee66=_0x55156e;_0x3c33d9=0xc8;}else{_0x3c33d9=0xce;}_0x5f4751[_0xbb58('0x19')](_0x3c33d9);return _0x5f4751[_0xbb58('0x1f')](_0xbb58('0x20'),_0x3134ea+'-'+_0xbee66+'/'+_0x55156e)[_0xbb58('0x1b')](_0x33c20f);}return null;};}function patchUpdates(_0x497fd0){return function(_0x84f34){try{jsonpatch[_0xbb58('0x21')](_0x84f34,_0x497fd0,!![]);}catch(_0x3e64fe){return BPromise[_0xbb58('0x22')](_0x3e64fe);}return _0x84f34[_0xbb58('0x23')]();};}function saveUpdates(_0x5d4a91,_0x49453a){return function(_0x350be7){if(_0x350be7){return _0x350be7[_0xbb58('0x24')](_0x5d4a91)['then'](function(_0x27806d){return _0x27806d;});}return null;};}function removeEntity(_0x53b693,_0x21964d){return function(_0x287822){if(_0x287822){return _0x287822[_0xbb58('0x25')]()[_0xbb58('0x26')](function(){_0x53b693[_0xbb58('0x19')](0xcc)[_0xbb58('0x1a')]();});}};}function handleEntityNotFound(_0x2d556a,_0x15e4c5){return function(_0x4e0303){if(!_0x4e0303){_0x2d556a[_0xbb58('0x18')](0x194);}return _0x4e0303;};}function handleError(_0x3bd550,_0x1be0ae){_0x1be0ae=_0x1be0ae||0x1f4;return function(_0x129094){logger[_0xbb58('0x27')](_0x129094[_0xbb58('0x28')]);if(_0x129094[_0xbb58('0x29')]){delete _0x129094[_0xbb58('0x29')];}_0x3bd550[_0xbb58('0x19')](_0x1be0ae)[_0xbb58('0x2a')](_0x129094);};}exports[_0xbb58('0x2b')]=function(_0x28b3a3,_0x2a0481){var _0x4157c4={},_0x3559b6={},_0x573cca={'count':0x0,'rows':[]};var _0x2b0f73=_[_0xbb58('0x2c')](db[_0xbb58('0x2d')][_0xbb58('0x2e')],function(_0x3304b9){return{'name':_0x3304b9[_0xbb58('0x2f')],'type':_0x3304b9[_0xbb58('0x30')][_0xbb58('0x31')]};});_0x3559b6[_0xbb58('0x32')]=_['map'](_0x2b0f73,_0xbb58('0x29'));_0x3559b6[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x28b3a3[_0xbb58('0x33')]);_0x3559b6[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3559b6[_0xbb58('0x32')],_0x3559b6[_0xbb58('0x33')]);_0x4157c4[_0xbb58('0x37')]=_[_0xbb58('0x36')](_0x3559b6[_0xbb58('0x32')],qs[_0xbb58('0x38')](_0x28b3a3[_0xbb58('0x33')]['fields']));_0x4157c4['attributes']=_0x4157c4['attributes'][_0xbb58('0x39')]?_0x4157c4[_0xbb58('0x37')]:_0x3559b6[_0xbb58('0x32')];if(!_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3a')](_0xbb58('0x3b'))){_0x4157c4[_0xbb58('0x1e')]=qs[_0xbb58('0x1e')](_0x28b3a3['query'][_0xbb58('0x1e')]);_0x4157c4[_0xbb58('0x1c')]=qs['offset'](_0x28b3a3[_0xbb58('0x33')]['offset']);}_0x4157c4[_0xbb58('0x3c')]=qs['sort'](_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3d')]);_0x4157c4['where']=qs[_0xbb58('0x35')](_[_0xbb58('0x3e')](_0x28b3a3[_0xbb58('0x33')],_0x3559b6[_0xbb58('0x35')]),_0x2b0f73);if(_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3f')]){_0x4157c4[_0xbb58('0x40')]=_[_0xbb58('0x41')](_0x4157c4['where'],{'$or':_[_0xbb58('0x2c')](_0x2b0f73,function(_0x31aa4b){if(_0x31aa4b[_0xbb58('0x30')]!=='VIRTUAL'){var _0x4dbd5e={};_0x4dbd5e[_0x31aa4b[_0xbb58('0x29')]]={'$like':'%'+_0x28b3a3['query'][_0xbb58('0x3f')]+'%'};return _0x4dbd5e;}})});}_0x4157c4=_[_0xbb58('0x41')]({},_0x4157c4,_0x28b3a3[_0xbb58('0x42')]);var _0x560911={'where':_0x4157c4['where']};return db[_0xbb58('0x2d')][_0xbb58('0x1d')](_0x560911)[_0xbb58('0x26')](function(_0x24d82d){_0x573cca[_0xbb58('0x1d')]=_0x24d82d;if(_0x28b3a3[_0xbb58('0x33')]['includeAll']){_0x4157c4[_0xbb58('0x43')]=[{'all':!![]}];}return db[_0xbb58('0x2d')][_0xbb58('0x44')](_0x4157c4);})[_0xbb58('0x26')](function(_0x1185b3){_0x573cca[_0xbb58('0x45')]=_0x1185b3;return _0x573cca;})['then'](respondWithFilteredResult(_0x2a0481,_0x4157c4))[_0xbb58('0x46')](handleError(_0x2a0481,null));};exports['show']=function(_0x22f1c3,_0x285ad4){var _0x29fb1c={'raw':!![],'where':{'id':_0x22f1c3['params']['id']}},_0x45817f={};_0x45817f[_0xbb58('0x32')]=_[_0xbb58('0x34')](db[_0xbb58('0x2d')][_0xbb58('0x2e')]);_0x45817f['query']=_[_0xbb58('0x34')](_0x22f1c3['query']);_0x45817f[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x45817f[_0xbb58('0x32')],_0x45817f[_0xbb58('0x33')]);_0x29fb1c[_0xbb58('0x37')]=_[_0xbb58('0x36')](_0x45817f[_0xbb58('0x32')],qs[_0xbb58('0x38')](_0x22f1c3[_0xbb58('0x33')][_0xbb58('0x38')]));_0x29fb1c[_0xbb58('0x37')]=_0x29fb1c[_0xbb58('0x37')][_0xbb58('0x39')]?_0x29fb1c['attributes']:_0x45817f[_0xbb58('0x32')];if(_0x22f1c3['query']['includeAll']){_0x29fb1c[_0xbb58('0x43')]=[{'all':!![]}];}_0x29fb1c=_[_0xbb58('0x41')]({},_0x29fb1c,_0x22f1c3[_0xbb58('0x42')]);return db[_0xbb58('0x2d')][_0xbb58('0x47')](_0x29fb1c)[_0xbb58('0x26')](handleEntityNotFound(_0x285ad4,null))[_0xbb58('0x26')](respondWithResult(_0x285ad4,null))[_0xbb58('0x46')](handleError(_0x285ad4,null));};exports[_0xbb58('0x48')]=function(_0x39995e,_0x440fb3){return db['WhatsappQueueReport'][_0xbb58('0x48')](_0x39995e[_0xbb58('0x49')],{})['then'](respondWithResult(_0x440fb3,0xc9))[_0xbb58('0x46')](handleError(_0x440fb3,null));};exports[_0xbb58('0x24')]=function(_0xf94897,_0xdb0ff7){if(_0xf94897['body']['id']){delete _0xf94897[_0xbb58('0x49')]['id'];}return db['WhatsappQueueReport'][_0xbb58('0x47')]({'where':{'id':_0xf94897[_0xbb58('0x4a')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0xdb0ff7,null))['then'](saveUpdates(_0xf94897[_0xbb58('0x49')],null))[_0xbb58('0x26')](respondWithResult(_0xdb0ff7,null))['catch'](handleError(_0xdb0ff7,null));};exports[_0xbb58('0x25')]=function(_0x4ca201,_0x28301d){return db[_0xbb58('0x2d')][_0xbb58('0x47')]({'where':{'id':_0x4ca201[_0xbb58('0x4a')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x28301d,null))[_0xbb58('0x26')](removeEntity(_0x28301d,null))[_0xbb58('0x46')](handleError(_0x28301d,null));};exports['describe']=function(_0x449088,_0x1fd892){return db['WhatsappQueueReport'][_0xbb58('0x4b')]()[_0xbb58('0x26')](respondWithResult(_0x1fd892,null))['catch'](handleError(_0x1fd892,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 1dac261..573df97 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 _0x432a=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define'];(function(_0xcfebe8,_0x3ecd28){var _0x1bfea3=function(_0x5a25b4){while(--_0x5a25b4){_0xcfebe8['push'](_0xcfebe8['shift']());}};_0x1bfea3(++_0x3ecd28);}(_0x432a,0x10d));var _0xa432=function(_0x4ac31f,_0x3bf843){_0x4ac31f=_0x4ac31f-0x0;var _0x1f1926=_0x432a[_0x4ac31f];return _0x1f1926;};'use strict';var _=require(_0xa432('0x0'));var util=require(_0xa432('0x1'));var logger=require(_0xa432('0x2'))(_0xa432('0x3'));var moment=require(_0xa432('0x4'));var BPromise=require(_0xa432('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa432('0x6'));var config=require(_0xa432('0x7'));var attributes=require(_0xa432('0x8'));module[_0xa432('0x9')]=function(_0x3f42ec,_0x19df1e){return _0x3f42ec[_0xa432('0xa')](_0xa432('0xb'),attributes,{'tableName':_0xa432('0xc'),'paranoid':![],'indexes':[{'name':_0xa432('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe504=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','moment','bluebird'];(function(_0x1f0c55,_0x5c11ca){var _0x4c4ea4=function(_0x196e8a){while(--_0x196e8a){_0x1f0c55['push'](_0x1f0c55['shift']());}};_0x4c4ea4(++_0x5c11ca);}(_0xe504,0x18f));var _0x4e50=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe504[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x4e50('0x0'));var util=require(_0x4e50('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4e50('0x2'));var BPromise=require(_0x4e50('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e50('0x4'));var rimraf=require(_0x4e50('0x5'));var config=require(_0x4e50('0x6'));var attributes=require(_0x4e50('0x7'));module[_0x4e50('0x8')]=function(_0x5e3e27,_0x1a426c){return _0x5e3e27[_0x4e50('0x9')](_0x4e50('0xa'),attributes,{'tableName':_0x4e50('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4e50('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index cf3cd3f..d3b24ba 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 _0x45d0=['limit','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappQueueReport','options','raw','CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','update','body','attributes'];(function(_0x32a9d2,_0x43db6e){var _0x409990=function(_0x5ba374){while(--_0x5ba374){_0x32a9d2['push'](_0x32a9d2['shift']());}};_0x409990(++_0x43db6e);}(_0x45d0,0x12d));var _0x045d=function(_0x3ea995,_0x1f0903){_0x3ea995=_0x3ea995-0x0;var _0x5852b3=_0x45d0[_0x3ea995];return _0x5852b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x045d('0x0'));var BPromise=require('bluebird');var rs=require(_0x045d('0x1'));var fs=require('fs');var Redis=require(_0x045d('0x2'));var db=require(_0x045d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x045d('0x4'))(_0x045d('0x5'));var config=require(_0x045d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x045d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x428885,_0x54c9fc,_0x237770){return new BPromise(function(_0x2525c6,_0x296890){return client[_0x045d('0x8')](_0x428885,_0x237770)[_0x045d('0x9')](function(_0x26fc8b){logger[_0x045d('0xa')](_0x045d('0xb'),_0x54c9fc,_0x045d('0xc'));logger[_0x045d('0xd')](_0x045d('0xe'),_0x54c9fc,_0x045d('0xc'),JSON[_0x045d('0xf')](_0x26fc8b));if(_0x26fc8b['error']){if(_0x26fc8b[_0x045d('0x10')][_0x045d('0x11')]===0x1f4){logger[_0x045d('0x10')](_0x045d('0xb'),_0x54c9fc,_0x26fc8b[_0x045d('0x10')][_0x045d('0x12')]);return _0x296890(_0x26fc8b[_0x045d('0x10')]['message']);}logger[_0x045d('0x10')](_0x045d('0xb'),_0x54c9fc,_0x26fc8b[_0x045d('0x10')]['message']);return _0x2525c6(_0x26fc8b['error'][_0x045d('0x12')]);}else{logger[_0x045d('0xa')](_0x045d('0xb'),_0x54c9fc,_0x045d('0xc'));_0x2525c6(_0x26fc8b[_0x045d('0x13')][_0x045d('0x12')]);}})['catch'](function(_0x5ad2ca){logger[_0x045d('0x10')](_0x045d('0xb'),_0x54c9fc,_0x5ad2ca);_0x296890(_0x5ad2ca);});});}exports['CreateWhatsappQueueReport']=function(_0x40dbc4){var _0x375d26=this;return new Promise(function(_0x25dde2,_0x6f509b){return db[_0x045d('0x14')]['create'](_0x40dbc4['body'],{'raw':_0x40dbc4[_0x045d('0x15')]?_0x40dbc4[_0x045d('0x15')][_0x045d('0x16')]===undefined?!![]:![]:!![]})[_0x045d('0x9')](function(_0x4400c9){logger['info'](_0x045d('0x17'),_0x40dbc4);logger[_0x045d('0xd')](_0x045d('0x17'),_0x40dbc4,JSON[_0x045d('0xf')](_0x4400c9));_0x25dde2(_0x4400c9);})[_0x045d('0x18')](function(_0x3bc967){logger[_0x045d('0x10')]('CreateWhatsappQueueReport',_0x3bc967[_0x045d('0x12')],_0x40dbc4);_0x6f509b(_0x375d26[_0x045d('0x10')](0x1f4,_0x3bc967[_0x045d('0x12')]));});});};exports[_0x045d('0x19')]=function(_0x11ec62){var _0x4ae55c=this;return new Promise(function(_0x49faa5,_0xfa13f1){return db[_0x045d('0x14')][_0x045d('0x1a')](_0x11ec62[_0x045d('0x1b')],{'raw':_0x11ec62[_0x045d('0x15')]?_0x11ec62[_0x045d('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11ec62[_0x045d('0x15')]?_0x11ec62[_0x045d('0x15')]['where']||null:null,'attributes':_0x11ec62[_0x045d('0x15')]?_0x11ec62[_0x045d('0x15')][_0x045d('0x1c')]||null:null,'limit':_0x11ec62[_0x045d('0x15')]?_0x11ec62['options'][_0x045d('0x1d')]||null:null})[_0x045d('0x9')](function(_0x4dbe8b){logger['info']('UpdateWhatsappQueueReport',_0x11ec62);logger['debug'](_0x045d('0x19'),_0x11ec62,JSON[_0x045d('0xf')](_0x4dbe8b));_0x49faa5(_0x4dbe8b);})[_0x045d('0x18')](function(_0x11a34d){logger[_0x045d('0x10')](_0x045d('0x19'),_0x11a34d[_0x045d('0x12')],_0x11ec62);_0xfa13f1(_0x4ae55c[_0x045d('0x10')](0x1f4,_0x11a34d[_0x045d('0x12')]));});});}; \ No newline at end of file +var _0xd3aa=['where','attributes','limit','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','catch','UpdateWhatsappQueueReport','update'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0xd3aa,0x157));var _0xad3a=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0xd3aa[_0x596f6e];return _0x1e0803;};'use strict';var _=require('lodash');var util=require(_0xad3a('0x0'));var moment=require(_0xad3a('0x1'));var BPromise=require('bluebird');var rs=require(_0xad3a('0x2'));var fs=require('fs');var Redis=require(_0xad3a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xad3a('0x4'));var logger=require('../../config/logger')(_0xad3a('0x5'));var config=require(_0xad3a('0x6'));var jayson=require(_0xad3a('0x7'));var client=jayson[_0xad3a('0x8')][_0xad3a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x357568,_0x30df7a,_0xcc4880){return new BPromise(function(_0x3d0375,_0x4ababf){return client[_0xad3a('0xa')](_0x357568,_0xcc4880)[_0xad3a('0xb')](function(_0xfd403a){logger[_0xad3a('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x30df7a,'request\x20sent');logger[_0xad3a('0xd')](_0xad3a('0xe'),_0x30df7a,_0xad3a('0xf'),JSON[_0xad3a('0x10')](_0xfd403a));if(_0xfd403a['error']){if(_0xfd403a[_0xad3a('0x11')][_0xad3a('0x12')]===0x1f4){logger[_0xad3a('0x11')](_0xad3a('0x13'),_0x30df7a,_0xfd403a[_0xad3a('0x11')]['message']);return _0x4ababf(_0xfd403a['error'][_0xad3a('0x14')]);}logger[_0xad3a('0x11')](_0xad3a('0x13'),_0x30df7a,_0xfd403a[_0xad3a('0x11')][_0xad3a('0x14')]);return _0x3d0375(_0xfd403a[_0xad3a('0x11')][_0xad3a('0x14')]);}else{logger[_0xad3a('0xc')](_0xad3a('0x13'),_0x30df7a,'request\x20sent');_0x3d0375(_0xfd403a[_0xad3a('0x15')][_0xad3a('0x14')]);}})['catch'](function(_0xdab591){logger['error'](_0xad3a('0x13'),_0x30df7a,_0xdab591);_0x4ababf(_0xdab591);});});}exports[_0xad3a('0x16')]=function(_0x48e07c){var _0x391754=this;return new Promise(function(_0x181cf6,_0x562ec7){return db[_0xad3a('0x17')][_0xad3a('0x18')](_0x48e07c[_0xad3a('0x19')],{'raw':_0x48e07c[_0xad3a('0x1a')]?_0x48e07c[_0xad3a('0x1a')][_0xad3a('0x1b')]===undefined?!![]:![]:!![]})[_0xad3a('0xb')](function(_0x5d0693){logger['info']('CreateWhatsappQueueReport',_0x48e07c);logger[_0xad3a('0xd')]('CreateWhatsappQueueReport',_0x48e07c,JSON[_0xad3a('0x10')](_0x5d0693));_0x181cf6(_0x5d0693);})[_0xad3a('0x1c')](function(_0x3d5c56){logger[_0xad3a('0x11')]('CreateWhatsappQueueReport',_0x3d5c56['message'],_0x48e07c);_0x562ec7(_0x391754[_0xad3a('0x11')](0x1f4,_0x3d5c56['message']));});});};exports[_0xad3a('0x1d')]=function(_0x717a41){var _0x5e6394=this;return new Promise(function(_0x28ad40,_0x23a225){return db[_0xad3a('0x17')][_0xad3a('0x1e')](_0x717a41[_0xad3a('0x19')],{'raw':_0x717a41['options']?_0x717a41['options'][_0xad3a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x717a41[_0xad3a('0x1a')]?_0x717a41[_0xad3a('0x1a')][_0xad3a('0x1f')]||null:null,'attributes':_0x717a41[_0xad3a('0x1a')]?_0x717a41[_0xad3a('0x1a')][_0xad3a('0x20')]||null:null,'limit':_0x717a41['options']?_0x717a41[_0xad3a('0x1a')][_0xad3a('0x21')]||null:null})['then'](function(_0x5291ca){logger[_0xad3a('0xc')](_0xad3a('0x1d'),_0x717a41);logger[_0xad3a('0xd')](_0xad3a('0x1d'),_0x717a41,JSON[_0xad3a('0x10')](_0x5291ca));_0x28ad40(_0x5291ca);})[_0xad3a('0x1c')](function(_0xe88559){logger[_0xad3a('0x11')](_0xad3a('0x1d'),_0xe88559[_0xad3a('0x14')],_0x717a41);_0x23a225(_0x5e6394[_0xad3a('0x11')](0x1f4,_0xe88559[_0xad3a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4476780..b021339 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 _0x464b=['destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','show','post','create','put','/:id','delete'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x464b,0xab));var _0xb464=function(_0x4cd078,_0x14a6f7){_0x4cd078=_0x4cd078-0x0;var _0x2ca7f5=_0x464b[_0x4cd078];return _0x2ca7f5;};'use strict';var multer=require(_0xb464('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb464('0x1'));var router=express['Router']();var fs_extra=require(_0xb464('0x2'));var auth=require(_0xb464('0x3'));var interaction=require(_0xb464('0x4'));var config=require(_0xb464('0x5'));var controller=require(_0xb464('0x6'));router[_0xb464('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb464('0x7')](_0xb464('0x8'),auth[_0xb464('0x9')](),controller['describe']);router[_0xb464('0x7')]('/:id',auth[_0xb464('0x9')](),controller[_0xb464('0xa')]);router[_0xb464('0xb')]('/',auth[_0xb464('0x9')](),controller[_0xb464('0xc')]);router[_0xb464('0xd')](_0xb464('0xe'),auth[_0xb464('0x9')](),controller['update']);router[_0xb464('0xf')](_0xb464('0xe'),auth[_0xb464('0x9')](),controller[_0xb464('0x10')]);module['exports']=router; \ No newline at end of file +var _0x01b6=['update','destroy','exports','multer','path','express','Router','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated','describe','show','post','create','/:id'];(function(_0x3307bc,_0x382756){var _0x43496d=function(_0x5e2a0f){while(--_0x5e2a0f){_0x3307bc['push'](_0x3307bc['shift']());}};_0x43496d(++_0x382756);}(_0x01b6,0x123));var _0x601b=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0x01b6[_0x1b4c04];return _0x374f5d;};'use strict';var multer=require(_0x601b('0x0'));var util=require('util');var path=require(_0x601b('0x1'));var timeout=require('connect-timeout');var express=require(_0x601b('0x2'));var router=express[_0x601b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x601b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x601b('0x5'));router[_0x601b('0x6')]('/',auth[_0x601b('0x7')](),controller['index']);router[_0x601b('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x601b('0x8')]);router[_0x601b('0x6')]('/:id',auth[_0x601b('0x7')](),controller[_0x601b('0x9')]);router[_0x601b('0xa')]('/',auth[_0x601b('0x7')](),controller[_0x601b('0xb')]);router['put'](_0x601b('0xc'),auth[_0x601b('0x7')](),controller[_0x601b('0xd')]);router['delete'](_0x601b('0xc'),auth[_0x601b('0x7')](),controller[_0x601b('0xe')]);module[_0x601b('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index ce192a6..1e59b78 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 _0xcefd=['account','agent','queue','DATE','exports','STRING','ENUM'];(function(_0x53ec0b,_0x1f98d5){var _0xff5848=function(_0x5cefe5){while(--_0x5cefe5){_0x53ec0b['push'](_0x53ec0b['shift']());}};_0xff5848(++_0x1f98d5);}(_0xcefd,0x1bd));var _0xdcef=function(_0x7bfe1b,_0x3eb3c3){_0x7bfe1b=_0x7bfe1b-0x0;var _0x24e555=_0xcefd[_0x7bfe1b];return _0x24e555;};'use strict';var Sequelize=require('sequelize');module[_0xdcef('0x0')]={'uniqueid':{'type':Sequelize[_0xdcef('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xdcef('0x2')](_0xdcef('0x3'),_0xdcef('0x4'),_0xdcef('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xdcef('0x6')]}}; \ No newline at end of file +var _0xea5b=['queue','DATE','sequelize','exports','STRING','agent'];(function(_0x19b280,_0x12ec81){var _0x11de51=function(_0x18f7b3){while(--_0x18f7b3){_0x19b280['push'](_0x19b280['shift']());}};_0x11de51(++_0x12ec81);}(_0xea5b,0x152));var _0xbea5=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xea5b[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require(_0xbea5('0x0'));module[_0xbea5('0x1')]={'uniqueid':{'type':Sequelize[_0xbea5('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xbea5('0x3'),_0xbea5('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbea5('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d6e325f..84f4a00 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 _0x62cc=['findAll','rows','catch','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','json','apply','reject','update','then','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','options','where','includeAll','include'];(function(_0x2068ee,_0x42966a){var _0xa36814=function(_0x35dba2){while(--_0x35dba2){_0x2068ee['push'](_0x2068ee['shift']());}};_0xa36814(++_0x42966a);}(_0x62cc,0xf4));var _0xc62c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x62cc[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xc62c('0x0'));var rimraf=require(_0xc62c('0x1'));var zipdir=require(_0xc62c('0x2'));var jsonpatch=require(_0xc62c('0x3'));var rp=require(_0xc62c('0x4'));var moment=require(_0xc62c('0x5'));var BPromise=require(_0xc62c('0x6'));var Mustache=require(_0xc62c('0x7'));var util=require(_0xc62c('0x8'));var path=require(_0xc62c('0x9'));var sox=require('sox');var csv=require(_0xc62c('0xa'));var ejs=require(_0xc62c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc62c('0xc'));var squel=require(_0xc62c('0xd'));var crypto=require(_0xc62c('0xe'));var jsforce=require(_0xc62c('0xf'));var deskjs=require(_0xc62c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc62c('0x11'));var Papa=require(_0xc62c('0x12'));var Redis=require('ioredis');var authService=require(_0xc62c('0x13'));var qs=require(_0xc62c('0x14'));var as=require(_0xc62c('0x15'));var hardwareService=require(_0xc62c('0x16'));var logger=require('../../config/logger')(_0xc62c('0x17'));var utils=require(_0xc62c('0x18'));var config=require(_0xc62c('0x19'));var licenseUtil=require(_0xc62c('0x1a'));var db=require(_0xc62c('0x1b'))['db'];function respondWithStatusCode(_0x3ee986,_0xd26a3d){_0xd26a3d=_0xd26a3d||0xcc;return function(_0x1e6460){if(_0x1e6460){return _0x3ee986[_0xc62c('0x1c')](_0xd26a3d);}return _0x3ee986['status'](_0xd26a3d)[_0xc62c('0x1d')]();};}function respondWithResult(_0x5d4f19,_0x42f577){_0x42f577=_0x42f577||0xc8;return function(_0x31ffcb){if(_0x31ffcb){return _0x5d4f19[_0xc62c('0x1e')](_0x42f577)['json'](_0x31ffcb);}};}function respondWithFilteredResult(_0x30b524,_0x530862){return function(_0x3b8c73){if(_0x3b8c73){var _0x46ab12=typeof _0x530862[_0xc62c('0x1f')]==='undefined'&&typeof _0x530862[_0xc62c('0x20')]===_0xc62c('0x21');var _0x373019=_0x3b8c73[_0xc62c('0x22')];var _0x5711ef=_0x46ab12?0x0:_0x530862[_0xc62c('0x1f')];var _0x585b79=_0x46ab12?_0x3b8c73[_0xc62c('0x22')]:_0x530862['offset']+_0x530862[_0xc62c('0x20')];var _0x37659d;if(_0x585b79>=_0x373019){_0x585b79=_0x373019;_0x37659d=0xc8;}else{_0x37659d=0xce;}_0x30b524[_0xc62c('0x1e')](_0x37659d);return _0x30b524['set']('Content-Range',_0x5711ef+'-'+_0x585b79+'/'+_0x373019)[_0xc62c('0x23')](_0x3b8c73);}return null;};}function patchUpdates(_0x481ebd){return function(_0x220f8e){try{jsonpatch[_0xc62c('0x24')](_0x220f8e,_0x481ebd,!![]);}catch(_0x444718){return BPromise[_0xc62c('0x25')](_0x444718);}return _0x220f8e['save']();};}function saveUpdates(_0x5567e2,_0x2c0d5a){return function(_0x2acb9f){if(_0x2acb9f){return _0x2acb9f[_0xc62c('0x26')](_0x5567e2)['then'](function(_0x558c02){return _0x558c02;});}return null;};}function removeEntity(_0x50c9da,_0x18591b){return function(_0x1abe43){if(_0x1abe43){return _0x1abe43['destroy']()[_0xc62c('0x27')](function(){_0x50c9da['status'](0xcc)[_0xc62c('0x1d')]();});}};}function handleEntityNotFound(_0x40a35a,_0x527856){return function(_0x44dcab){if(!_0x44dcab){_0x40a35a[_0xc62c('0x1c')](0x194);}return _0x44dcab;};}function handleError(_0x3c06ca,_0x2a7252){_0x2a7252=_0x2a7252||0x1f4;return function(_0x2360c2){logger[_0xc62c('0x28')](_0x2360c2[_0xc62c('0x29')]);if(_0x2360c2[_0xc62c('0x2a')]){delete _0x2360c2[_0xc62c('0x2a')];}_0x3c06ca[_0xc62c('0x1e')](_0x2a7252)[_0xc62c('0x2b')](_0x2360c2);};}exports[_0xc62c('0x2c')]=function(_0x305e6a,_0x4e32bb){var _0x1e4aa9={},_0x12bfae={},_0x358cbe={'count':0x0,'rows':[]};var _0x359e31=_[_0xc62c('0x2d')](db[_0xc62c('0x2e')][_0xc62c('0x2f')],function(_0x2a28a0){return{'name':_0x2a28a0['fieldName'],'type':_0x2a28a0['type'][_0xc62c('0x30')]};});_0x12bfae[_0xc62c('0x31')]=_[_0xc62c('0x2d')](_0x359e31,_0xc62c('0x2a'));_0x12bfae['query']=_[_0xc62c('0x32')](_0x305e6a[_0xc62c('0x33')]);_0x12bfae[_0xc62c('0x34')]=_['intersection'](_0x12bfae[_0xc62c('0x31')],_0x12bfae[_0xc62c('0x33')]);_0x1e4aa9[_0xc62c('0x35')]=_[_0xc62c('0x36')](_0x12bfae[_0xc62c('0x31')],qs[_0xc62c('0x37')](_0x305e6a['query'][_0xc62c('0x37')]));_0x1e4aa9[_0xc62c('0x35')]=_0x1e4aa9[_0xc62c('0x35')]['length']?_0x1e4aa9['attributes']:_0x12bfae[_0xc62c('0x31')];if(!_0x305e6a[_0xc62c('0x33')][_0xc62c('0x38')](_0xc62c('0x39'))){_0x1e4aa9[_0xc62c('0x20')]=qs[_0xc62c('0x20')](_0x305e6a[_0xc62c('0x33')]['limit']);_0x1e4aa9[_0xc62c('0x1f')]=qs[_0xc62c('0x1f')](_0x305e6a[_0xc62c('0x33')][_0xc62c('0x1f')]);}_0x1e4aa9[_0xc62c('0x3a')]=qs[_0xc62c('0x3b')](_0x305e6a[_0xc62c('0x33')][_0xc62c('0x3b')]);_0x1e4aa9['where']=qs[_0xc62c('0x34')](_[_0xc62c('0x3c')](_0x305e6a[_0xc62c('0x33')],_0x12bfae[_0xc62c('0x34')]),_0x359e31);if(_0x305e6a['query'][_0xc62c('0x3d')]){_0x1e4aa9['where']=_[_0xc62c('0x3e')](_0x1e4aa9['where'],{'$or':_[_0xc62c('0x2d')](_0x359e31,function(_0x170ea8){if(_0x170ea8[_0xc62c('0x3f')]!=='VIRTUAL'){var _0x38dbd2={};_0x38dbd2[_0x170ea8[_0xc62c('0x2a')]]={'$like':'%'+_0x305e6a[_0xc62c('0x33')][_0xc62c('0x3d')]+'%'};return _0x38dbd2;}})});}_0x1e4aa9=_['merge']({},_0x1e4aa9,_0x305e6a[_0xc62c('0x40')]);var _0x3e397d={'where':_0x1e4aa9[_0xc62c('0x41')]};return db[_0xc62c('0x2e')][_0xc62c('0x22')](_0x3e397d)[_0xc62c('0x27')](function(_0xa89888){_0x358cbe['count']=_0xa89888;if(_0x305e6a[_0xc62c('0x33')][_0xc62c('0x42')]){_0x1e4aa9[_0xc62c('0x43')]=[{'all':!![]}];}return db[_0xc62c('0x2e')][_0xc62c('0x44')](_0x1e4aa9);})[_0xc62c('0x27')](function(_0x3e6236){_0x358cbe[_0xc62c('0x45')]=_0x3e6236;return _0x358cbe;})[_0xc62c('0x27')](respondWithFilteredResult(_0x4e32bb,_0x1e4aa9))[_0xc62c('0x46')](handleError(_0x4e32bb,null));};exports['show']=function(_0x90a1ca,_0x4b47d0){var _0x2a9491={'raw':!![],'where':{'id':_0x90a1ca[_0xc62c('0x47')]['id']}},_0x258211={};_0x258211[_0xc62c('0x31')]=_[_0xc62c('0x32')](db[_0xc62c('0x2e')][_0xc62c('0x2f')]);_0x258211[_0xc62c('0x33')]=_[_0xc62c('0x32')](_0x90a1ca[_0xc62c('0x33')]);_0x258211[_0xc62c('0x34')]=_[_0xc62c('0x36')](_0x258211['model'],_0x258211[_0xc62c('0x33')]);_0x2a9491[_0xc62c('0x35')]=_[_0xc62c('0x36')](_0x258211[_0xc62c('0x31')],qs[_0xc62c('0x37')](_0x90a1ca[_0xc62c('0x33')][_0xc62c('0x37')]));_0x2a9491[_0xc62c('0x35')]=_0x2a9491[_0xc62c('0x35')][_0xc62c('0x48')]?_0x2a9491[_0xc62c('0x35')]:_0x258211['model'];if(_0x90a1ca['query'][_0xc62c('0x42')]){_0x2a9491[_0xc62c('0x43')]=[{'all':!![]}];}_0x2a9491=_[_0xc62c('0x3e')]({},_0x2a9491,_0x90a1ca[_0xc62c('0x40')]);return db[_0xc62c('0x2e')][_0xc62c('0x49')](_0x2a9491)['then'](handleEntityNotFound(_0x4b47d0,null))[_0xc62c('0x27')](respondWithResult(_0x4b47d0,null))[_0xc62c('0x46')](handleError(_0x4b47d0,null));};exports['create']=function(_0x12a611,_0x3f11ca){return db[_0xc62c('0x2e')][_0xc62c('0x4a')](_0x12a611[_0xc62c('0x4b')],{})[_0xc62c('0x27')](respondWithResult(_0x3f11ca,0xc9))[_0xc62c('0x46')](handleError(_0x3f11ca,null));};exports[_0xc62c('0x26')]=function(_0x1b88bf,_0x312ea1){if(_0x1b88bf[_0xc62c('0x4b')]['id']){delete _0x1b88bf['body']['id'];}return db['WhatsappTransferReport'][_0xc62c('0x49')]({'where':{'id':_0x1b88bf['params']['id']}})[_0xc62c('0x27')](handleEntityNotFound(_0x312ea1,null))[_0xc62c('0x27')](saveUpdates(_0x1b88bf[_0xc62c('0x4b')],null))[_0xc62c('0x27')](respondWithResult(_0x312ea1,null))[_0xc62c('0x46')](handleError(_0x312ea1,null));};exports[_0xc62c('0x4c')]=function(_0x4faf73,_0x26d55b){return db['WhatsappTransferReport'][_0xc62c('0x49')]({'where':{'id':_0x4faf73['params']['id']}})[_0xc62c('0x27')](handleEntityNotFound(_0x26d55b,null))['then'](removeEntity(_0x26d55b,null))[_0xc62c('0x46')](handleError(_0x26d55b,null));};exports[_0xc62c('0x4d')]=function(_0x2d41f3,_0x1ef795){return db[_0xc62c('0x2e')]['describe']()[_0xc62c('0x27')](respondWithResult(_0x1ef795,null))[_0xc62c('0x46')](handleError(_0x1ef795,null));}; \ No newline at end of file +var _0xf65d=['VIRTUAL','options','includeAll','rows','show','include','find','catch','create','body','destroy','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','sendStatus','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where'];(function(_0x4470b4,_0x555349){var _0x509116=function(_0x2b309c){while(--_0x2b309c){_0x4470b4['push'](_0x4470b4['shift']());}};_0x509116(++_0x555349);}(_0xf65d,0x9f));var _0xdf65=function(_0x2fea3f,_0x143c24){_0x2fea3f=_0x2fea3f-0x0;var _0xe7b365=_0xf65d[_0x2fea3f];return _0xe7b365;};'use strict';var emlformat=require(_0xdf65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf65('0x1'));var jsonpatch=require(_0xdf65('0x2'));var rp=require(_0xdf65('0x3'));var moment=require(_0xdf65('0x4'));var BPromise=require(_0xdf65('0x5'));var Mustache=require(_0xdf65('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdf65('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf65('0x8'));var _=require(_0xdf65('0x9'));var squel=require('squel');var crypto=require(_0xdf65('0xa'));var jsforce=require(_0xdf65('0xb'));var deskjs=require(_0xdf65('0xc'));var toCsv=require(_0xdf65('0x7'));var querystring=require(_0xdf65('0xd'));var Papa=require(_0xdf65('0xe'));var Redis=require('ioredis');var authService=require(_0xdf65('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdf65('0x10'));var hardwareService=require(_0xdf65('0x11'));var logger=require(_0xdf65('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xdf65('0x13'));var licenseUtil=require(_0xdf65('0x14'));var db=require(_0xdf65('0x15'))['db'];function respondWithStatusCode(_0x389a24,_0x20162f){_0x20162f=_0x20162f||0xcc;return function(_0x42cfce){if(_0x42cfce){return _0x389a24['sendStatus'](_0x20162f);}return _0x389a24[_0xdf65('0x16')](_0x20162f)[_0xdf65('0x17')]();};}function respondWithResult(_0x51f281,_0x50de22){_0x50de22=_0x50de22||0xc8;return function(_0x5a0ae1){if(_0x5a0ae1){return _0x51f281[_0xdf65('0x16')](_0x50de22)[_0xdf65('0x18')](_0x5a0ae1);}};}function respondWithFilteredResult(_0x11f0e3,_0x1b6d10){return function(_0x1d6f22){if(_0x1d6f22){var _0x9bcb1c=typeof _0x1b6d10[_0xdf65('0x19')]===_0xdf65('0x1a')&&typeof _0x1b6d10[_0xdf65('0x1b')]===_0xdf65('0x1a');var _0x54e0b2=_0x1d6f22[_0xdf65('0x1c')];var _0x532215=_0x9bcb1c?0x0:_0x1b6d10[_0xdf65('0x19')];var _0x3a175b=_0x9bcb1c?_0x1d6f22[_0xdf65('0x1c')]:_0x1b6d10[_0xdf65('0x19')]+_0x1b6d10[_0xdf65('0x1b')];var _0x30a521;if(_0x3a175b>=_0x54e0b2){_0x3a175b=_0x54e0b2;_0x30a521=0xc8;}else{_0x30a521=0xce;}_0x11f0e3['status'](_0x30a521);return _0x11f0e3[_0xdf65('0x1d')]('Content-Range',_0x532215+'-'+_0x3a175b+'/'+_0x54e0b2)[_0xdf65('0x18')](_0x1d6f22);}return null;};}function patchUpdates(_0x299ed3){return function(_0xd57bc8){try{jsonpatch[_0xdf65('0x1e')](_0xd57bc8,_0x299ed3,!![]);}catch(_0x2042a5){return BPromise['reject'](_0x2042a5);}return _0xd57bc8[_0xdf65('0x1f')]();};}function saveUpdates(_0x326995,_0x5ee78d){return function(_0x45fb5f){if(_0x45fb5f){return _0x45fb5f[_0xdf65('0x20')](_0x326995)[_0xdf65('0x21')](function(_0x12e935){return _0x12e935;});}return null;};}function removeEntity(_0x529bf0,_0x2c6900){return function(_0x2eff40){if(_0x2eff40){return _0x2eff40['destroy']()['then'](function(){_0x529bf0[_0xdf65('0x16')](0xcc)[_0xdf65('0x17')]();});}};}function handleEntityNotFound(_0x3d0aea,_0x59f046){return function(_0x5ea71f){if(!_0x5ea71f){_0x3d0aea[_0xdf65('0x22')](0x194);}return _0x5ea71f;};}function handleError(_0x1c958a,_0x513807){_0x513807=_0x513807||0x1f4;return function(_0x513d12){logger['error'](_0x513d12[_0xdf65('0x23')]);if(_0x513d12['name']){delete _0x513d12[_0xdf65('0x24')];}_0x1c958a['status'](_0x513807)[_0xdf65('0x25')](_0x513d12);};}exports[_0xdf65('0x26')]=function(_0x501b53,_0x2cca76){var _0xe7fbc3={},_0x166060={},_0x220402={'count':0x0,'rows':[]};var _0x41c1d6=_[_0xdf65('0x27')](db[_0xdf65('0x28')][_0xdf65('0x29')],function(_0x5581da){return{'name':_0x5581da['fieldName'],'type':_0x5581da[_0xdf65('0x2a')][_0xdf65('0x2b')]};});_0x166060[_0xdf65('0x2c')]=_['map'](_0x41c1d6,_0xdf65('0x24'));_0x166060['query']=_[_0xdf65('0x2d')](_0x501b53[_0xdf65('0x2e')]);_0x166060['filters']=_[_0xdf65('0x2f')](_0x166060[_0xdf65('0x2c')],_0x166060[_0xdf65('0x2e')]);_0xe7fbc3[_0xdf65('0x30')]=_[_0xdf65('0x2f')](_0x166060[_0xdf65('0x2c')],qs['fields'](_0x501b53['query'][_0xdf65('0x31')]));_0xe7fbc3['attributes']=_0xe7fbc3[_0xdf65('0x30')][_0xdf65('0x32')]?_0xe7fbc3[_0xdf65('0x30')]:_0x166060['model'];if(!_0x501b53[_0xdf65('0x2e')][_0xdf65('0x33')](_0xdf65('0x34'))){_0xe7fbc3[_0xdf65('0x1b')]=qs[_0xdf65('0x1b')](_0x501b53['query'][_0xdf65('0x1b')]);_0xe7fbc3[_0xdf65('0x19')]=qs[_0xdf65('0x19')](_0x501b53['query'][_0xdf65('0x19')]);}_0xe7fbc3[_0xdf65('0x35')]=qs[_0xdf65('0x36')](_0x501b53[_0xdf65('0x2e')][_0xdf65('0x36')]);_0xe7fbc3['where']=qs['filters'](_[_0xdf65('0x37')](_0x501b53[_0xdf65('0x2e')],_0x166060[_0xdf65('0x38')]),_0x41c1d6);if(_0x501b53['query'][_0xdf65('0x39')]){_0xe7fbc3['where']=_[_0xdf65('0x3a')](_0xe7fbc3[_0xdf65('0x3b')],{'$or':_[_0xdf65('0x27')](_0x41c1d6,function(_0x583c87){if(_0x583c87[_0xdf65('0x2a')]!==_0xdf65('0x3c')){var _0x1a1912={};_0x1a1912[_0x583c87[_0xdf65('0x24')]]={'$like':'%'+_0x501b53[_0xdf65('0x2e')][_0xdf65('0x39')]+'%'};return _0x1a1912;}})});}_0xe7fbc3=_[_0xdf65('0x3a')]({},_0xe7fbc3,_0x501b53[_0xdf65('0x3d')]);var _0x596002={'where':_0xe7fbc3[_0xdf65('0x3b')]};return db[_0xdf65('0x28')][_0xdf65('0x1c')](_0x596002)['then'](function(_0x4cc99a){_0x220402[_0xdf65('0x1c')]=_0x4cc99a;if(_0x501b53['query'][_0xdf65('0x3e')]){_0xe7fbc3['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0xe7fbc3);})[_0xdf65('0x21')](function(_0x352e21){_0x220402[_0xdf65('0x3f')]=_0x352e21;return _0x220402;})['then'](respondWithFilteredResult(_0x2cca76,_0xe7fbc3))['catch'](handleError(_0x2cca76,null));};exports[_0xdf65('0x40')]=function(_0x526d32,_0x2bb2fc){var _0x2d3aea={'raw':!![],'where':{'id':_0x526d32['params']['id']}},_0x2e3e35={};_0x2e3e35[_0xdf65('0x2c')]=_['keys'](db[_0xdf65('0x28')][_0xdf65('0x29')]);_0x2e3e35['query']=_[_0xdf65('0x2d')](_0x526d32[_0xdf65('0x2e')]);_0x2e3e35[_0xdf65('0x38')]=_['intersection'](_0x2e3e35[_0xdf65('0x2c')],_0x2e3e35[_0xdf65('0x2e')]);_0x2d3aea[_0xdf65('0x30')]=_[_0xdf65('0x2f')](_0x2e3e35[_0xdf65('0x2c')],qs[_0xdf65('0x31')](_0x526d32[_0xdf65('0x2e')]['fields']));_0x2d3aea[_0xdf65('0x30')]=_0x2d3aea[_0xdf65('0x30')][_0xdf65('0x32')]?_0x2d3aea[_0xdf65('0x30')]:_0x2e3e35[_0xdf65('0x2c')];if(_0x526d32['query']['includeAll']){_0x2d3aea[_0xdf65('0x41')]=[{'all':!![]}];}_0x2d3aea=_[_0xdf65('0x3a')]({},_0x2d3aea,_0x526d32[_0xdf65('0x3d')]);return db[_0xdf65('0x28')][_0xdf65('0x42')](_0x2d3aea)[_0xdf65('0x21')](handleEntityNotFound(_0x2bb2fc,null))[_0xdf65('0x21')](respondWithResult(_0x2bb2fc,null))[_0xdf65('0x43')](handleError(_0x2bb2fc,null));};exports[_0xdf65('0x44')]=function(_0x2f8adf,_0x4ec5d8){return db[_0xdf65('0x28')][_0xdf65('0x44')](_0x2f8adf['body'],{})[_0xdf65('0x21')](respondWithResult(_0x4ec5d8,0xc9))[_0xdf65('0x43')](handleError(_0x4ec5d8,null));};exports[_0xdf65('0x20')]=function(_0x502716,_0x39be69){if(_0x502716[_0xdf65('0x45')]['id']){delete _0x502716[_0xdf65('0x45')]['id'];}return db['WhatsappTransferReport'][_0xdf65('0x42')]({'where':{'id':_0x502716['params']['id']}})['then'](handleEntityNotFound(_0x39be69,null))['then'](saveUpdates(_0x502716[_0xdf65('0x45')],null))[_0xdf65('0x21')](respondWithResult(_0x39be69,null))['catch'](handleError(_0x39be69,null));};exports[_0xdf65('0x46')]=function(_0x2f4c75,_0x2ff5fe){return db['WhatsappTransferReport'][_0xdf65('0x42')]({'where':{'id':_0x2f4c75[_0xdf65('0x47')]['id']}})[_0xdf65('0x21')](handleEntityNotFound(_0x2ff5fe,null))[_0xdf65('0x21')](removeEntity(_0x2ff5fe,null))['catch'](handleError(_0x2ff5fe,null));};exports[_0xdf65('0x48')]=function(_0x446a2d,_0x456e05){return db[_0xdf65('0x28')][_0xdf65('0x48')]()[_0xdf65('0x21')](respondWithResult(_0x456e05,null))[_0xdf65('0x43')](handleError(_0x456e05,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a039786..2df7c95 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 _0x10c2=['uniqueid','lodash','util','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer'];(function(_0x19f98d,_0x3e1c0a){var _0x4f9a0d=function(_0x16dd54){while(--_0x16dd54){_0x19f98d['push'](_0x19f98d['shift']());}};_0x4f9a0d(++_0x3e1c0a);}(_0x10c2,0x105));var _0x210c=function(_0x6af839,_0x289f2d){_0x6af839=_0x6af839-0x0;var _0x3a783e=_0x10c2[_0x6af839];return _0x3a783e;};'use strict';var _=require(_0x210c('0x0'));var util=require(_0x210c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x210c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x210c('0x3'));var rimraf=require(_0x210c('0x4'));var config=require(_0x210c('0x5'));var attributes=require(_0x210c('0x6'));module[_0x210c('0x7')]=function(_0xc1c5cf,_0x190f27){return _0xc1c5cf['define']('WhatsappTransferReport',attributes,{'tableName':_0x210c('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x210c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac3e=['api','moment','request-promise','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xac3e,0x1e5));var _0xeac3=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xac3e[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0xeac3('0x0'));var logger=require('../../config/logger')(_0xeac3('0x1'));var moment=require(_0xeac3('0x2'));var BPromise=require('bluebird');var rp=require(_0xeac3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeac3('0x4'));var attributes=require(_0xeac3('0x5'));module['exports']=function(_0xadc1af,_0x45c019){return _0xadc1af[_0xeac3('0x6')](_0xeac3('0x7'),attributes,{'tableName':_0xeac3('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 02fc292..7478da4 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 _0x763e=['../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1a6970,_0xecaee2){var _0x21d9cd=function(_0x5c5794){while(--_0x5c5794){_0x1a6970['push'](_0x1a6970['shift']());}};_0x21d9cd(++_0xecaee2);}(_0x763e,0x7b));var _0xe763=function(_0x3eeb88,_0x1ecc29){_0x3eeb88=_0x3eeb88-0x0;var _0x9cc515=_0x763e[_0x3eeb88];return _0x9cc515;};'use strict';var _=require(_0xe763('0x0'));var util=require(_0xe763('0x1'));var moment=require(_0xe763('0x2'));var BPromise=require(_0xe763('0x3'));var rs=require(_0xe763('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe763('0x5'))['db'];var utils=require(_0xe763('0x6'));var logger=require(_0xe763('0x7'))(_0xe763('0x8'));var config=require(_0xe763('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe763('0xa')][_0xe763('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x348443,_0x462a81,_0x30d719){return new BPromise(function(_0x5a9554,_0x4139b3){return client[_0xe763('0xc')](_0x348443,_0x30d719)[_0xe763('0xd')](function(_0x49c266){logger[_0xe763('0xe')](_0xe763('0xf'),_0x462a81,_0xe763('0x10'));logger['debug'](_0xe763('0x11'),_0x462a81,'request\x20sent',JSON[_0xe763('0x12')](_0x49c266));if(_0x49c266[_0xe763('0x13')]){if(_0x49c266[_0xe763('0x13')]['code']===0x1f4){logger['error'](_0xe763('0xf'),_0x462a81,_0x49c266[_0xe763('0x13')][_0xe763('0x14')]);return _0x4139b3(_0x49c266[_0xe763('0x13')][_0xe763('0x14')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x462a81,_0x49c266[_0xe763('0x13')][_0xe763('0x14')]);return _0x5a9554(_0x49c266[_0xe763('0x13')]['message']);}else{logger[_0xe763('0xe')](_0xe763('0xf'),_0x462a81,'request\x20sent');_0x5a9554(_0x49c266['result']['message']);}})[_0xe763('0x15')](function(_0x567e05){logger[_0xe763('0x13')](_0xe763('0xf'),_0x462a81,_0x567e05);_0x4139b3(_0x567e05);});});} \ No newline at end of file +var _0xa71f=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x5a45c2,_0x1dcad9){var _0x9c7c1=function(_0x3d4739){while(--_0x3d4739){_0x5a45c2['push'](_0x5a45c2['shift']());}};_0x9c7c1(++_0x1dcad9);}(_0xa71f,0xab));var _0xfa71=function(_0x404640,_0x1c127b){_0x404640=_0x404640-0x0;var _0x30ee11=_0xa71f[_0x404640];return _0x30ee11;};'use strict';var _=require(_0xfa71('0x0'));var util=require(_0xfa71('0x1'));var moment=require(_0xfa71('0x2'));var BPromise=require(_0xfa71('0x3'));var rs=require(_0xfa71('0x4'));var fs=require('fs');var Redis=require(_0xfa71('0x5'));var db=require(_0xfa71('0x6'))['db'];var utils=require(_0xfa71('0x7'));var logger=require(_0xfa71('0x8'))(_0xfa71('0x9'));var config=require(_0xfa71('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfa71('0xb')][_0xfa71('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55e47c,_0x3c0362,_0x3d2e38){return new BPromise(function(_0x1d5281,_0x1a9239){return client[_0xfa71('0xd')](_0x55e47c,_0x3d2e38)[_0xfa71('0xe')](function(_0x2a8e8d){logger[_0xfa71('0xf')](_0xfa71('0x10'),_0x3c0362,'request\x20sent');logger[_0xfa71('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x3c0362,_0xfa71('0x12'),JSON[_0xfa71('0x13')](_0x2a8e8d));if(_0x2a8e8d[_0xfa71('0x14')]){if(_0x2a8e8d[_0xfa71('0x14')]['code']===0x1f4){logger['error'](_0xfa71('0x10'),_0x3c0362,_0x2a8e8d['error']['message']);return _0x1a9239(_0x2a8e8d[_0xfa71('0x14')][_0xfa71('0x15')]);}logger[_0xfa71('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3c0362,_0x2a8e8d['error'][_0xfa71('0x15')]);return _0x1d5281(_0x2a8e8d['error']['message']);}else{logger[_0xfa71('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3c0362,_0xfa71('0x12'));_0x1d5281(_0x2a8e8d[_0xfa71('0x16')]['message']);}})[_0xfa71('0x17')](function(_0x6ec9a0){logger[_0xfa71('0x14')](_0xfa71('0x10'),_0x3c0362,_0x6ec9a0);_0x1a9239(_0x6ec9a0);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 132d0ac..a5ae71d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce22=['./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','map','pm2_env','name','online','join','Offline\x20apps:','status','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xce22,0xea));var _0x2ce2=function(_0x4b0bb7,_0x585341){_0x4b0bb7=_0x4b0bb7-0x0;var _0x154e65=_0xce22[_0x4b0bb7];return _0x154e65;};'use strict';var _=require(_0x2ce2('0x0'));var db=require(_0x2ce2('0x1'))['db'];var seedDb=require(_0x2ce2('0x2'));var checkLicense=require(_0x2ce2('0x3'));var rpc=require(_0x2ce2('0x4'));var config=require('./config/environment');var logger=require(_0x2ce2('0x5'))('app');var pm2=require(_0x2ce2('0x6'));var pm2Config=require(_0x2ce2('0x7'));var schedule=require(_0x2ce2('0x8'));var chat=require(_0x2ce2('0x9'));var whatsapp=require(_0x2ce2('0xa'));var transcribe=require(_0x2ce2('0xb'));var provider=require(_0x2ce2('0xc'));function main(){return db['sequelize'][_0x2ce2('0xd')]()[_0x2ce2('0xe')](function(){if(config[_0x2ce2('0xf')]){return seedDb[_0x2ce2('0x10')]();}})[_0x2ce2('0xe')](function(){return checkLicense[_0x2ce2('0x10')]();})['then'](function(){return rpc[_0x2ce2('0x11')]();})[_0x2ce2('0xe')](function(_0x561dae){logger[_0x2ce2('0x12')](_0x561dae);return chat[_0x2ce2('0x13')]();})['then'](function(){return whatsapp[_0x2ce2('0x13')]();})[_0x2ce2('0xe')](function(){return schedule[_0x2ce2('0x13')]();})[_0x2ce2('0xe')](function(){return transcribe['start']();})[_0x2ce2('0xe')](function(){return provider[_0x2ce2('0x13')]();})[_0x2ce2('0xe')](function(_0x5efaa1){logger[_0x2ce2('0x12')](_0x5efaa1);return pm2['start'](pm2Config);})['then'](function(_0x7b8036){var _0x1a759e=_0x7b8036[_0x2ce2('0x14')](function(_0x17120f){return typeof _0x17120f[_0x2ce2('0x15')]===_0x2ce2('0x16')&&_0x17120f[_0x2ce2('0x15')]>=0x0;});if(_0x1a759e['length']>0x0){throw new Error(_0x1a759e['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x2ce2('0x17')](_0x1a759e,function(_0xa229b7){return'\x22'+_0xa229b7[_0x2ce2('0x18')][_0x2ce2('0x19')]+'\x22';}));}logger[_0x2ce2('0x12')]('Online\x20apps:',_[_0x2ce2('0x17')](_['filter'](_0x7b8036,{'status':_0x2ce2('0x1a')}),_0x2ce2('0x19'))[_0x2ce2('0x1b')]());logger[_0x2ce2('0x12')](_0x2ce2('0x1c'),_[_0x2ce2('0x17')](_['filter'](_0x7b8036,function(_0x4d3a37){return _0x4d3a37[_0x2ce2('0x1d')]!==_0x2ce2('0x1a');}),_0x2ce2('0x19'))[_0x2ce2('0x1b')]()||'None');console['log']('App\x20Ready!');})[_0x2ce2('0x1e')](function(_0x2ccd5f){console['log'](_0x2ce2('0x1f'),_0x2ccd5f);logger[_0x2ce2('0x20')](_0x2ce2('0x21'),_0x2ccd5f);process[_0x2ce2('0x22')](0x1);});}main(); \ No newline at end of file +var _0x3bd7=['pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./config/seedDB','./config/license','./rpc','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','default','then','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x3bd7,0x199));var _0x73bd=function(_0x10b317,_0x2adf32){_0x10b317=_0x10b317-0x0;var _0x1e3054=_0x3bd7[_0x10b317];return _0x1e3054;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0x73bd('0x0'));var checkLicense=require(_0x73bd('0x1'));var rpc=require(_0x73bd('0x2'));var config=require('./config/environment');var logger=require(_0x73bd('0x3'))(_0x73bd('0x4'));var pm2=require(_0x73bd('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x73bd('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x73bd('0x7'));var transcribe=require(_0x73bd('0x8'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x73bd('0x9')]['sync']()['then'](function(){if(config['seedDB']){return seedDb[_0x73bd('0xa')]();}})['then'](function(){return checkLicense['default']();})[_0x73bd('0xb')](function(){return rpc['listen']();})[_0x73bd('0xb')](function(_0x84ae1e){logger[_0x73bd('0xc')](_0x84ae1e);return chat[_0x73bd('0xd')]();})[_0x73bd('0xb')](function(){return whatsapp[_0x73bd('0xd')]();})['then'](function(){return schedule[_0x73bd('0xd')]();})[_0x73bd('0xb')](function(){return transcribe[_0x73bd('0xd')]();})[_0x73bd('0xb')](function(){return provider[_0x73bd('0xd')]();})[_0x73bd('0xb')](function(_0x50ec11){logger[_0x73bd('0xc')](_0x50ec11);return pm2['start'](pm2Config);})[_0x73bd('0xb')](function(_0x3eab86){var _0x125ad1=_0x3eab86[_0x73bd('0xe')](function(_0x3e628a){return typeof _0x3e628a['exitCode']===_0x73bd('0xf')&&_0x3e628a[_0x73bd('0x10')]>=0x0;});if(_0x125ad1[_0x73bd('0x11')]>0x0){throw new Error(_0x125ad1[_0x73bd('0x11')]+_0x73bd('0x12')+_[_0x73bd('0x13')](_0x125ad1,function(_0x10e371){return'\x22'+_0x10e371[_0x73bd('0x14')][_0x73bd('0x15')]+'\x22';}));}logger['info'](_0x73bd('0x16'),_[_0x73bd('0x13')](_[_0x73bd('0xe')](_0x3eab86,{'status':_0x73bd('0x17')}),_0x73bd('0x15'))[_0x73bd('0x18')]());logger[_0x73bd('0xc')](_0x73bd('0x19'),_[_0x73bd('0x13')](_['filter'](_0x3eab86,function(_0x459965){return _0x459965[_0x73bd('0x1a')]!==_0x73bd('0x17');}),'name')['join']()||'None');console[_0x73bd('0x1b')](_0x73bd('0x1c'));})['catch'](function(_0xd30228){console[_0x73bd('0x1b')](_0x73bd('0x1d'),_0xd30228);logger[_0x73bd('0x1e')](_0x73bd('0x1f'),_0xd30228);process[_0x73bd('0x20')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 6a6fc33..4d25fb9 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 _0x5116=['whatsappAutoanswer','messengerSoundNotification','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','query','json','unmanaged','Unmanaged.','Forbidden.','startsWith','headers','User','authenticate','Wrong\x20credentials.','authorization','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','find','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','status','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','minutes','Invalid\x20API\x20access\x20key','use','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','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.','decryptString','length','splice','unshift','join','promisify','sign','secret','payload','options','catch','session','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','bluebird','util','moment','secrets','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswerDelay'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x5116,0x16e));var _0x6511=function(_0x3c01eb,_0x48216c){_0x3c01eb=_0x3c01eb-0x0;var _0xf2b347=_0x5116[_0x3c01eb];return _0xf2b347;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x6511('0x0'));var hardwareConf=require(_0x6511('0x1'));var licenseUtil=require(_0x6511('0x2'));var encryptor=require(_0x6511('0x3'));var _=require(_0x6511('0x4'));var jwt=require(_0x6511('0x5'));var expressJwt=require(_0x6511('0x6'));var compose=require(_0x6511('0x7'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x6511('0x8'));var util=require(_0x6511('0x9'));var moment=require(_0x6511('0xa'));var validateJwt=expressJwt({'secret':config[_0x6511('0xb')]['session']});var userAttributes=['id',_0x6511('0xc'),_0x6511('0xd'),_0x6511('0xe'),_0x6511('0xf'),_0x6511('0x10'),_0x6511('0x11'),_0x6511('0x12'),_0x6511('0x13'),_0x6511('0x14'),_0x6511('0x15'),_0x6511('0x16'),_0x6511('0x17'),'smsPause',_0x6511('0x18'),_0x6511('0x19'),_0x6511('0x1a'),_0x6511('0x1b'),_0x6511('0x1c'),'crudPermissions','allowmessenger','passwordResetAt',_0x6511('0x1d'),_0x6511('0x1e'),_0x6511('0x1f'),_0x6511('0x20'),_0x6511('0x21'),_0x6511('0x22'),'phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl',_0x6511('0x23'),_0x6511('0x24'),_0x6511('0x25'),_0x6511('0x26'),_0x6511('0x27'),_0x6511('0x28'),_0x6511('0x29'),_0x6511('0x2a'),_0x6511('0x2b'),_0x6511('0x2c'),_0x6511('0x2d'),_0x6511('0x2e'),'chatAutoanswer',_0x6511('0x2f'),_0x6511('0x30'),_0x6511('0x31'),_0x6511('0x32'),_0x6511('0x33'),'openchannelAutoanswer',_0x6511('0x34'),'faxAutoanswer',_0x6511('0x35'),_0x6511('0x36'),'whatsappAutoanswerDelay',_0x6511('0x37')];exports['isChatInteractionAuthorized']=function(){return this[_0x6511('0x38')](!![])['use'](function(_0x4964bb,_0x4d3c87,_0x49fdcf){if(_0x4964bb[_0x6511('0x39')]){_0x49fdcf();}else{return db[_0x6511('0x3a')][_0x6511('0x3b')]({'where':{'id':_0x4964bb[_0x6511('0x3c')]['id']},'attributes':['id',_0x6511('0x3d'),_0x6511('0x3e')],'raw':!![]})[_0x6511('0x3f')](function(_0x58185f){if(_0x58185f&&_0x58185f[_0x6511('0x3d')]&&!_0x4964bb[_0x6511('0x40')]['forceDownload']){return _0x4d3c87['status'](_0x58185f[_0x6511('0x3e')]==='unmanaged'?0x195:0x193)[_0x6511('0x41')]({'message':_0x58185f[_0x6511('0x3e')]===_0x6511('0x42')?_0x6511('0x43'):_0x6511('0x44')});}else{_0x49fdcf();}})['catch'](function(_0x619b98){_0x49fdcf(_0x619b98);});}});};exports[_0x6511('0x38')]=function isAuthenticated(_0x3facb5){return compose()['use'](function(_0x398442,_0x54812f,_0x5580a2){var _0x216ed0;if(_0x398442['headers']['authorization']){if(_[_0x6511('0x45')](_0x398442[_0x6511('0x46')]['authorization'],'Basic')){var _0x326841=basicAuth(_0x398442);db[_0x6511('0x47')]['find']({'where':{'name':_0x326841[_0x6511('0xe')]}})['then'](function(_0x545eff){if(!_0x545eff||!_0x545eff[_0x6511('0x48')](_0x326841['pass'])){return _0x54812f['status'](0x191)[_0x6511('0x41')]({'message':_0x6511('0x49')});}_0x398442[_0x6511('0x39')]={'id':_0x545eff['id']};_0x5580a2();})['catch'](function(_0x1f50db){_0x5580a2(_0x1f50db);});}else if(_['startsWith'](_0x398442[_0x6511('0x46')][_0x6511('0x4a')],_0x6511('0x4b'))){validateJwt(_0x398442,_0x54812f,_0x5580a2);}else{if(_0x3facb5){_0x5580a2();}else{return _0x54812f['status'](0x193)[_0x6511('0x41')]({'message':_0x6511('0x4c')});}}}else if(_0x398442[_0x6511('0x40')][_0x6511('0x4d')]){try{var _0x50695b={'audience':hardwareConf[_0x6511('0x4e')](),'issuer':hardwareConf[_0x6511('0x4e')]()};verifyJwt(_0x398442['query'][_0x6511('0x4d')],_0x50695b)[_0x6511('0x3f')](function(_0x368ff3){return db[_0x6511('0x47')][_0x6511('0x4f')]({'where':{'id':_0x368ff3['sub']}})[_0x6511('0x3f')](function(_0x2d3c87){_0x216ed0=_0x2d3c87;return db[_0x6511('0x50')][_0x6511('0x3b')]({'where':{'id':0x1},'attributes':[_0x6511('0x51'),_0x6511('0x52')],'raw':!![]});})['then'](function(_0x27d284){if(!_0x216ed0||!_[_0x6511('0x53')](_0x216ed0[_0x6511('0x54')],_0x368ff3[_0x6511('0x55')])){return _0x54812f[_0x6511('0x56')](0x191)[_0x6511('0x41')]({'message':_0x6511('0x57')});}if(_0x216ed0[_0x6511('0x58')]){return _0x54812f[_0x6511('0x56')](0x191)[_0x6511('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x216ed0[_0x6511('0x59')]){if(_0x27d284[_0x6511('0x52')]>0x0){if(moment(_0x216ed0[_0x6511('0x5a')])['add'](_0x27d284[_0x6511('0x52')],_0x6511('0x5b'))>moment()){return _0x54812f['status'](0x191)[_0x6511('0x41')]({'message':_0x6511('0x5c')});}}else{return _0x54812f[_0x6511('0x56')](0x191)[_0x6511('0x41')]({'message':_0x6511('0x5c')});}}_0x398442[_0x6511('0x39')]={'id':_0x216ed0['id']};_0x5580a2();});})['catch'](function(){return _0x54812f['status'](0x191)[_0x6511('0x41')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x42cc95){_0x5580a2(_0x42cc95);}}else if(_0x3facb5){_0x5580a2();}else{return _0x54812f['status'](0x193)[_0x6511('0x41')]({'message':_0x6511('0x4c')});}})[_0x6511('0x5d')](function(_0x6926c9,_0x3022f5,_0x309418){if(_0x6926c9['user']){db[_0x6511('0x47')][_0x6511('0x4f')]({'where':{'id':_0x6926c9[_0x6511('0x39')]['id']},'attributes':userAttributes})[_0x6511('0x3f')](function(_0x4be009){if(!_0x4be009){return _0x3022f5[_0x6511('0x56')](0x194)[_0x6511('0x41')]({'message':_0x6511('0x5e')});}_0x6926c9[_0x6511('0x39')]=_0x4be009;_0x309418();})['catch'](function(_0x561937){_0x309418(_0x561937);});}else if(_0x3facb5){_0x309418();}else{return _0x3022f5[_0x6511('0x56')](0x194)[_0x6511('0x41')]({'message':_0x6511('0x5f')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x6511('0x5d')](function(_0x78bc99,_0x6cf58,_0x57365a){return licenseUtil[_0x6511('0x60')]()[_0x6511('0x3f')](function(_0x374dfb){if(_0x374dfb[_0x6511('0x61')]){_0x57365a();}else{return _0x6cf58[_0x6511('0x56')](0x193)[_0x6511('0x41')]({'message':_0x6511('0x62')});}})['catch'](function(_0x495db4){_0x57365a(_0x495db4);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x6511('0x5d')](function(_0x51ac0c,_0x20f10b,_0x171d60){return licenseUtil[_0x6511('0x60')]()[_0x6511('0x3f')](function(_0x301607){if(_0x301607[_0x6511('0x63')]){_0x171d60();}else{return _0x20f10b[_0x6511('0x56')](0x193)[_0x6511('0x41')]({'message':_0x6511('0x62')});}})['catch'](function(_0x1e0559){_0x171d60(_0x1e0559);});});};exports[_0x6511('0x64')]=function(_0x388b5d,_0x51b74b,_0x412051){_0x388b5d[_0x6511('0x64')]=!![];return _0x412051();};exports[_0x6511('0x65')]=function signToken(_0x4e4e81){return signJwt(_0x4e4e81);};exports[_0x6511('0x66')]=function(_0x563dbc,_0x21d9d3){if(!_0x563dbc['user']){return _0x21d9d3[_0x6511('0x56')](0x194)[_0x6511('0x41')]({'message':_0x6511('0x67')});}var _0x3f5c12={'payload':{'id':_0x563dbc[_0x6511('0x39')]['id'],'role':_0x563dbc[_0x6511('0x39')][_0x6511('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3f5c12)[_0x6511('0x3f')](function(_0xfc64e){_0x21d9d3[_0x6511('0x68')](_0x6511('0x69'),_0xfc64e);_0x21d9d3[_0x6511('0x6a')](_0x6511('0x6b'));})['catch'](function(_0x1c8643){return _0x21d9d3['status'](0x1f4)[_0x6511('0x6c')](_0x1c8643);});};exports[_0x6511('0x6d')]=function(_0x3fc1ed){if(_['isNil'](_0x3fc1ed['apiKeyNonce'])||_['isNil'](_0x3fc1ed[_0x6511('0x6e')])){return null;}else{return createJwt(_0x3fc1ed);}};exports[_0x6511('0x6f')]=function(_0x376044){_0x376044['apiKeyNonce']=generateNonce();_0x376044[_0x6511('0x6e')]=generateIssuedAt();return createJwt(_0x376044);};exports[_0x6511('0x70')]=function(_0x2ce4ee,_0x240b87){var _0x43808c=_0x2ce4ee[_0x6511('0x40')][_0x6511('0x4d')];if(_0x43808c){var _0x360b8c={'nonce':_0x240b87[_0x6511('0x54')],'iat':_0x240b87[_0x6511('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x6511('0x4e')]()};return verifyJwt(_0x43808c,_0x360b8c)[_0x6511('0x3f')](function(){return generateApiKey(_0x240b87);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x6511('0x71')]=function(_0x554656){var _0x3abb28=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3abb28['test'](_0x554656))throw new db[(_0x6511('0x72'))]['ValidationError'](_0x6511('0x73'));return;};exports[_0x6511('0x74')]=function(_0x16fba3,_0x43fe65,_0x165e5b){var _0x5f28aa=encryptor['decryptString'](_0x43fe65)[_0x6511('0x75')](',');for(var _0x451ea0=0x0;_0x451ea0<_0x165e5b;_0x451ea0++){if(!_0x5f28aa[_0x451ea0])break;if(_0x16fba3[_0x6511('0x76')]()===_0x5f28aa[_0x451ea0][_0x6511('0x76')]()){var _0x556936=util[_0x6511('0x77')](_0x6511('0x78'),_0x165e5b);if(_0x165e5b===0x1){_0x556936=_0x6511('0x79');}throw new db[(_0x6511('0x72'))]['ValidationError'](_0x556936);}}return;};exports['updatePasswordsHistory']=function(_0x37e25f,_0x38d4df){var _0x4e99d2=_0x38d4df?encryptor[_0x6511('0x7a')](_0x38d4df)[_0x6511('0x75')](','):[];if(_0x4e99d2[_0x6511('0x7b')]===0x5){_0x4e99d2[_0x6511('0x7c')](-0x1,0x1);}_0x4e99d2[_0x6511('0x7d')](_0x37e25f);return encryptor['encryptString'](_0x4e99d2[_0x6511('0x7e')](','));};function signJwt(_0x37d667){var _0x4f039a=BPromise[_0x6511('0x7f')](jwt[_0x6511('0x80')],{'context':jwt});var _0x57290c=_0x37d667[_0x6511('0x81')]||config[_0x6511('0xb')]['session'];return new BPromise(function(_0x59ca03,_0xdcfe48){_0x4f039a(_0x37d667[_0x6511('0x82')],_0x57290c,_0x37d667[_0x6511('0x83')])['then'](function(_0x2bcecf){_0x59ca03(_0x2bcecf);})[_0x6511('0x84')](function(_0x317540){_0xdcfe48(_0x317540);});});}function verifyJwt(_0x45b46c,_0x4e360d,_0x4f3717){var _0x59a622=BPromise[_0x6511('0x7f')](jwt['verify'],{'context':jwt});var _0x4f811a=_0x4f3717||config[_0x6511('0xb')][_0x6511('0x85')];return new BPromise(function(_0x50c808,_0x220ea1){_0x59a622(_0x45b46c,_0x4f811a,_0x4e360d)['then'](function(_0x5ab89a){_0x50c808(_0x5ab89a);})[_0x6511('0x84')](function(_0x2710e7){_0x220ea1(_0x2710e7);});});}function generateNonce(){return crypto[_0x6511('0x86')](0x10)[_0x6511('0x87')](_0x6511('0x88'));}function generateIssuedAt(){return Math[_0x6511('0x89')](Date[_0x6511('0x8a')]()/0x3e8)[_0x6511('0x87')]();}function createJwt(_0x409287){var _0x3c4206={'payload':{'iat':_0x409287['apiKeyIat'],'nonce':_0x409287[_0x6511('0x54')]},'options':{'algorithm':_0x6511('0x8b'),'subject':_0x409287['id'][_0x6511('0x87')](),'issuer':hardwareConf[_0x6511('0x4e')](),'audience':hardwareConf[_0x6511('0x4e')]()}};return signJwt(_0x3c4206)[_0x6511('0x3f')](function(_0x2cbe02){return{'iat':_0x409287[_0x6511('0x6e')],'nonce':_0x409287[_0x6511('0x54')],'token':_0x2cbe02};});} \ No newline at end of file +var _0x1dc5=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','updatePasswordsHistory','length','splice','encryptString','join','promisify','sign','secret','secrets','payload','verify','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','moment','session','role','fullname','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','closed','disposition','query','forceDownload','json','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','find','then','authenticate','status','Unknown\x20authorization\x20format','apikey','getUuid','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','User\x20not\x20found.','catch','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x1dc5,0x1bb));var _0x51dc=function(_0x5dbf8a,_0x59c7a5){_0x5dbf8a=_0x5dbf8a-0x0;var _0x308cb9=_0x1dc5[_0x5dbf8a];return _0x308cb9;};'use strict';var db=require(_0x51dc('0x0'))['db'];var config=require(_0x51dc('0x1'));var hardwareConf=require(_0x51dc('0x2'));var licenseUtil=require(_0x51dc('0x3'));var encryptor=require(_0x51dc('0x4'));var _=require(_0x51dc('0x5'));var jwt=require(_0x51dc('0x6'));var expressJwt=require(_0x51dc('0x7'));var compose=require(_0x51dc('0x8'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require('bluebird');var util=require('util');var moment=require(_0x51dc('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x51dc('0xa')]});var userAttributes=['id',_0x51dc('0xb'),_0x51dc('0xc'),_0x51dc('0xd'),_0x51dc('0xe'),_0x51dc('0xf'),_0x51dc('0x10'),_0x51dc('0x11'),'md5secret',_0x51dc('0x12'),_0x51dc('0x13'),_0x51dc('0x14'),_0x51dc('0x15'),'smsPause',_0x51dc('0x16'),_0x51dc('0x17'),_0x51dc('0x18'),_0x51dc('0x19'),_0x51dc('0x1a'),_0x51dc('0x1b'),_0x51dc('0x1c'),_0x51dc('0x1d'),'alias',_0x51dc('0x1e'),_0x51dc('0x1f'),'phoneBarDnd',_0x51dc('0x20'),_0x51dc('0x21'),'phoneBarEnableSettings',_0x51dc('0x22'),_0x51dc('0x23'),_0x51dc('0x24'),_0x51dc('0x25'),_0x51dc('0x26'),_0x51dc('0x27'),_0x51dc('0x28'),_0x51dc('0x29'),_0x51dc('0x2a'),_0x51dc('0x2b'),'downloadVoiceRecordings',_0x51dc('0x2c'),_0x51dc('0x2d'),'ignorePauseForPreviewCalls',_0x51dc('0x2e'),_0x51dc('0x2f'),_0x51dc('0x30'),_0x51dc('0x31'),'emailAutoanswerDelay','smsAutoanswer',_0x51dc('0x32'),_0x51dc('0x33'),_0x51dc('0x34'),_0x51dc('0x35'),'faxAutoanswerDelay',_0x51dc('0x36'),_0x51dc('0x37'),_0x51dc('0x38')];exports[_0x51dc('0x39')]=function(){return this[_0x51dc('0x3a')](!![])[_0x51dc('0x3b')](function(_0x23f326,_0x686393,_0x14a040){if(_0x23f326[_0x51dc('0x3c')]){_0x14a040();}else{return db[_0x51dc('0x3d')]['findOne']({'where':{'id':_0x23f326['params']['id']},'attributes':['id',_0x51dc('0x3e'),_0x51dc('0x3f')],'raw':!![]})['then'](function(_0x21167a){if(_0x21167a&&_0x21167a[_0x51dc('0x3e')]&&!_0x23f326[_0x51dc('0x40')][_0x51dc('0x41')]){return _0x686393['status'](_0x21167a[_0x51dc('0x3f')]==='unmanaged'?0x195:0x193)[_0x51dc('0x42')]({'message':_0x21167a[_0x51dc('0x3f')]===_0x51dc('0x43')?_0x51dc('0x44'):_0x51dc('0x45')});}else{_0x14a040();}})['catch'](function(_0x52037b){_0x14a040(_0x52037b);});}});};exports[_0x51dc('0x3a')]=function isAuthenticated(_0x309f72){return compose()['use'](function(_0x12915b,_0x981b62,_0x44bb58){var _0x223cef;if(_0x12915b[_0x51dc('0x46')][_0x51dc('0x47')]){if(_[_0x51dc('0x48')](_0x12915b[_0x51dc('0x46')]['authorization'],_0x51dc('0x49'))){var _0x4334e5=basicAuth(_0x12915b);db[_0x51dc('0x4a')][_0x51dc('0x4b')]({'where':{'name':_0x4334e5[_0x51dc('0xd')]}})[_0x51dc('0x4c')](function(_0x2afc54){if(!_0x2afc54||!_0x2afc54[_0x51dc('0x4d')](_0x4334e5['pass'])){return _0x981b62[_0x51dc('0x4e')](0x191)[_0x51dc('0x42')]({'message':'Wrong\x20credentials.'});}_0x12915b['user']={'id':_0x2afc54['id']};_0x44bb58();})['catch'](function(_0x568498){_0x44bb58(_0x568498);});}else if(_['startsWith'](_0x12915b[_0x51dc('0x46')][_0x51dc('0x47')],'Bearer')){validateJwt(_0x12915b,_0x981b62,_0x44bb58);}else{if(_0x309f72){_0x44bb58();}else{return _0x981b62[_0x51dc('0x4e')](0x193)[_0x51dc('0x42')]({'message':_0x51dc('0x4f')});}}}else if(_0x12915b[_0x51dc('0x40')][_0x51dc('0x50')]){try{var _0x2f5bbe={'audience':hardwareConf[_0x51dc('0x51')](),'issuer':hardwareConf[_0x51dc('0x51')]()};verifyJwt(_0x12915b[_0x51dc('0x40')][_0x51dc('0x50')],_0x2f5bbe)['then'](function(_0x17a2c0){return db[_0x51dc('0x4a')][_0x51dc('0x4b')]({'where':{'id':_0x17a2c0['sub']}})[_0x51dc('0x4c')](function(_0xe18bed){_0x223cef=_0xe18bed;return db[_0x51dc('0x52')][_0x51dc('0x53')]({'where':{'id':0x1},'attributes':[_0x51dc('0x54'),_0x51dc('0x55')],'raw':!![]});})['then'](function(_0x4a3fbe){if(!_0x223cef||!_[_0x51dc('0x56')](_0x223cef[_0x51dc('0x57')],_0x17a2c0['nonce'])){return _0x981b62[_0x51dc('0x4e')](0x191)[_0x51dc('0x42')]({'message':_0x51dc('0x58')});}if(_0x223cef[_0x51dc('0x59')]){return _0x981b62[_0x51dc('0x4e')](0x191)[_0x51dc('0x42')]({'message':_0x51dc('0x5a')});}if(_0x223cef[_0x51dc('0x5b')]){if(_0x4a3fbe['blockDuration']>0x0){if(moment(_0x223cef[_0x51dc('0x5c')])[_0x51dc('0x5d')](_0x4a3fbe[_0x51dc('0x55')],'minutes')>moment()){return _0x981b62[_0x51dc('0x4e')](0x191)[_0x51dc('0x42')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x981b62[_0x51dc('0x4e')](0x191)['json']({'message':_0x51dc('0x5a')});}}_0x12915b['user']={'id':_0x223cef['id']};_0x44bb58();});})['catch'](function(){return _0x981b62[_0x51dc('0x4e')](0x191)['json']({'message':_0x51dc('0x5a')});});}catch(_0x5544a5){_0x44bb58(_0x5544a5);}}else if(_0x309f72){_0x44bb58();}else{return _0x981b62['status'](0x193)[_0x51dc('0x42')]({'message':_0x51dc('0x4f')});}})[_0x51dc('0x3b')](function(_0x6a6cef,_0x27b64c,_0x46e9c1){if(_0x6a6cef['user']){db[_0x51dc('0x4a')]['find']({'where':{'id':_0x6a6cef['user']['id']},'attributes':userAttributes})[_0x51dc('0x4c')](function(_0x3bfaeb){if(!_0x3bfaeb){return _0x27b64c['status'](0x194)['json']({'message':_0x51dc('0x5e')});}_0x6a6cef['user']=_0x3bfaeb;_0x46e9c1();})[_0x51dc('0x5f')](function(_0x3e992f){_0x46e9c1(_0x3e992f);});}else if(_0x309f72){_0x46e9c1();}else{return _0x27b64c[_0x51dc('0x4e')](0x194)[_0x51dc('0x42')]({'message':_0x51dc('0x60')});}});};exports[_0x51dc('0x61')]=function canUpdate(){return compose()['use'](function(_0x19766c,_0xaca694,_0x284a98){return licenseUtil[_0x51dc('0x62')]()['then'](function(_0x45da9b){if(_0x45da9b['update']){_0x284a98();}else{return _0xaca694[_0x51dc('0x4e')](0x193)[_0x51dc('0x42')]({'message':_0x51dc('0x63')});}})[_0x51dc('0x5f')](function(_0x15c4a0){_0x284a98(_0x15c4a0);});});};exports[_0x51dc('0x64')]=function isWebrtcLicence(){return compose()[_0x51dc('0x3b')](function(_0x11da3f,_0x259929,_0x4d55ba){return licenseUtil[_0x51dc('0x62')]()['then'](function(_0xb4ca2f){if(_0xb4ca2f[_0x51dc('0x65')]){_0x4d55ba();}else{return _0x259929['status'](0x193)[_0x51dc('0x42')]({'message':_0x51dc('0x63')});}})[_0x51dc('0x5f')](function(_0x17baf9){_0x4d55ba(_0x17baf9);});});};exports[_0x51dc('0x66')]=function(_0x161d42,_0x19aeae,_0x39d5ae){_0x161d42[_0x51dc('0x66')]=!![];return _0x39d5ae();};exports[_0x51dc('0x67')]=function signToken(_0x95a6fc){return signJwt(_0x95a6fc);};exports[_0x51dc('0x68')]=function(_0x36facc,_0x17881e){if(!_0x36facc[_0x51dc('0x3c')]){return _0x17881e[_0x51dc('0x4e')](0x194)[_0x51dc('0x42')]({'message':_0x51dc('0x69')});}var _0x21b8c4={'payload':{'id':_0x36facc[_0x51dc('0x3c')]['id'],'role':_0x36facc[_0x51dc('0x3c')][_0x51dc('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x21b8c4)['then'](function(_0x331cc8){_0x17881e[_0x51dc('0x6a')](_0x51dc('0x6b'),_0x331cc8);_0x17881e['redirect'](_0x51dc('0x6c'));})[_0x51dc('0x5f')](function(_0x1a3b21){return _0x17881e[_0x51dc('0x4e')](0x1f4)[_0x51dc('0x6d')](_0x1a3b21);});};exports[_0x51dc('0x6e')]=function(_0xa2bd26){if(_[_0x51dc('0x6f')](_0xa2bd26[_0x51dc('0x57')])||_[_0x51dc('0x6f')](_0xa2bd26[_0x51dc('0x70')])){return null;}else{return createJwt(_0xa2bd26);}};exports[_0x51dc('0x71')]=function(_0x21e69e){_0x21e69e[_0x51dc('0x57')]=generateNonce();_0x21e69e[_0x51dc('0x70')]=generateIssuedAt();return createJwt(_0x21e69e);};exports['regenerateApiKey']=function(_0x57d290,_0x416394){var _0x4c548d=_0x57d290[_0x51dc('0x40')][_0x51dc('0x50')];if(_0x4c548d){var _0x21cc0e={'nonce':_0x416394[_0x51dc('0x57')],'iat':_0x416394['apiKeyIat'],'audience':hardwareConf[_0x51dc('0x51')](),'issuer':hardwareConf[_0x51dc('0x51')]()};return verifyJwt(_0x4c548d,_0x21cc0e)[_0x51dc('0x4c')](function(){return generateApiKey(_0x416394);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x51dc('0x72')]=function(_0x2a3557){var _0x463504=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x463504[_0x51dc('0x73')](_0x2a3557))throw new db['Sequelize'][(_0x51dc('0x74'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x51dc('0x75')]=function(_0x36dd61,_0x257f20,_0xa2b5aa){var _0x26c276=encryptor[_0x51dc('0x76')](_0x257f20)[_0x51dc('0x77')](',');for(var _0x3141fe=0x0;_0x3141fe<_0xa2b5aa;_0x3141fe++){if(!_0x26c276[_0x3141fe])break;if(_0x36dd61[_0x51dc('0x78')]()===_0x26c276[_0x3141fe][_0x51dc('0x78')]()){var _0x3484dc=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xa2b5aa);if(_0xa2b5aa===0x1){_0x3484dc='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x51dc('0x74'))](_0x3484dc);}}return;};exports[_0x51dc('0x79')]=function(_0x4fd562,_0x3455b2){var _0x5c1dc9=_0x3455b2?encryptor[_0x51dc('0x76')](_0x3455b2)['split'](','):[];if(_0x5c1dc9[_0x51dc('0x7a')]===0x5){_0x5c1dc9[_0x51dc('0x7b')](-0x1,0x1);}_0x5c1dc9['unshift'](_0x4fd562);return encryptor[_0x51dc('0x7c')](_0x5c1dc9[_0x51dc('0x7d')](','));};function signJwt(_0x4b7dca){var _0x299e71=BPromise[_0x51dc('0x7e')](jwt[_0x51dc('0x7f')],{'context':jwt});var _0x20ef5c=_0x4b7dca[_0x51dc('0x80')]||config[_0x51dc('0x81')][_0x51dc('0xa')];return new BPromise(function(_0x2674a6,_0x443df6){_0x299e71(_0x4b7dca[_0x51dc('0x82')],_0x20ef5c,_0x4b7dca['options'])[_0x51dc('0x4c')](function(_0x401274){_0x2674a6(_0x401274);})['catch'](function(_0x26623f){_0x443df6(_0x26623f);});});}function verifyJwt(_0xf99e12,_0x592921,_0x171c53){var _0x1e68b5=BPromise[_0x51dc('0x7e')](jwt[_0x51dc('0x83')],{'context':jwt});var _0x546e75=_0x171c53||config[_0x51dc('0x81')][_0x51dc('0xa')];return new BPromise(function(_0x4c8204,_0xbf115b){_0x1e68b5(_0xf99e12,_0x546e75,_0x592921)[_0x51dc('0x4c')](function(_0x1d219e){_0x4c8204(_0x1d219e);})[_0x51dc('0x5f')](function(_0x4c37c6){_0xbf115b(_0x4c37c6);});});}function generateNonce(){return crypto[_0x51dc('0x84')](0x10)[_0x51dc('0x85')](_0x51dc('0x86'));}function generateIssuedAt(){return Math[_0x51dc('0x87')](Date['now']()/0x3e8)[_0x51dc('0x85')]();}function createJwt(_0x174832){var _0x213812={'payload':{'iat':_0x174832[_0x51dc('0x70')],'nonce':_0x174832[_0x51dc('0x57')]},'options':{'algorithm':_0x51dc('0x88'),'subject':_0x174832['id'][_0x51dc('0x85')](),'issuer':hardwareConf[_0x51dc('0x51')](),'audience':hardwareConf[_0x51dc('0x51')]()}};return signJwt(_0x213812)[_0x51dc('0x4c')](function(_0x3489ba){return{'iat':_0x174832[_0x51dc('0x70')],'nonce':_0x174832['apiKeyNonce'],'token':_0x3489ba};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index f9cf6d3..7515761 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60b2=['search','parseQueryParameters','where','default','filter','user','clause','tags','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','rows','describe','CmContact','cf_','CmCustomField','findOne','slice','all','length','fieldType','map','type','catch','lodash','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','then'];(function(_0xc16321,_0x4cfdfe){var _0x4deacf=function(_0x353855){while(--_0x353855){_0xc16321['push'](_0xc16321['shift']());}};_0x4deacf(++_0x4cfdfe);}(_0x60b2,0xa8));var _0x260b=function(_0x5cf3d7,_0x26611b){_0x5cf3d7=_0x5cf3d7-0x0;var _0x318db5=_0x60b2[_0x5cf3d7];return _0x318db5;};'use strict';var _=require(_0x260b('0x0'));var sqlUtils=require(_0x260b('0x1'));var db=require(_0x260b('0x2'))['db'];exports[_0x260b('0x3')]=function(_0x40df3e,_0x1c30bc,_0x2d67d0,_0x379fdc){var _0x2d2369={'count':0x0,'rows':[]};var _0x3b5233=sqlUtils['skipContactsQuery'](_0x1c30bc,_0x40df3e);if(_0x3b5233){return Promise[_0x260b('0x4')](_0x2d2369);}var _0x46b4dd=sqlUtils[_0x260b('0x5')]();var _0xe925a={};var _0x54bbb0=![];var _0x26002c=![];return Promise[_0x260b('0x4')]()[_0x260b('0x6')](function(){if(_0x40df3e[_0x260b('0x7')]){return sqlUtils['parseAdvancedSearchFilter'](_0x40df3e[_0x260b('0x7')],_0x379fdc);}else{return sqlUtils[_0x260b('0x8')](_0x40df3e,_0x379fdc);}})[_0x260b('0x6')](function(_0x43ceb9){_0x46b4dd[_0x260b('0x9')](_0x43ceb9[_0x260b('0xa')]);_0x46b4dd['where'](_0x43ceb9['fields']);_0x46b4dd[_0x260b('0x9')](_0x43ceb9[_0x260b('0xb')]);_0x46b4dd['where'](_0x43ceb9[_0x260b('0xc')][_0x260b('0xd')]);_0xe925a=_0x43ceb9[_0x260b('0xe')];_0x26002c=_0x43ceb9[_0x260b('0xc')]['skip'];return sqlUtils[_0x260b('0xf')](_0x1c30bc,_0x40df3e,_0x26002c);})[_0x260b('0x6')](function(_0x50faeb){_0x46b4dd['where'](_0x50faeb);var _0x4d8f59=_0x40df3e[_0x260b('0x7')]?_0xe925a[_0x260b('0x10')]:_0x40df3e[_0x260b('0x11')];_0x54bbb0=_0x4d8f59?!![]:![];return sqlUtils[_0x260b('0x12')](_0x46b4dd,_0x4d8f59);})[_0x260b('0x6')](function(_0x475c5a){_0x2d2369[_0x260b('0x13')]=_0x475c5a;if(_0x2d2369[_0x260b('0x13')]===0x0){return;}if(_0x40df3e[_0x260b('0x14')]){_0x26002c=!![];}return sqlUtils[_0x260b('0x15')](_0x46b4dd,_0x40df3e['fields'],_0x2d67d0,_0x54bbb0,_0xe925a[_0x260b('0xd')],_0x26002c);})['then'](function(_0x234ae1){if(!_0x234ae1){return[];}return sqlUtils['getFilteredContacts'](_0x234ae1,_0x40df3e,_0x2d67d0);})[_0x260b('0x6')](function(_0x1e876f){_0x2d2369[_0x260b('0x16')]=_0x1e876f;return _0x2d2369;})['catch'](function(_0x30295a){throw _0x30295a;});};exports[_0x260b('0x17')]=function(){var _0x40d476={};var _0x3a4402=[];return db[_0x260b('0x18')][_0x260b('0x17')]()[_0x260b('0x6')](function(_0x475e9e){_0x40d476=_0x475e9e;var _0xbaf04b=Object['keys'](_0x40d476)[_0x260b('0xb')](function(_0x575b80){return _['startsWith'](_0x575b80,_0x260b('0x19'))?_0x575b80:undefined;});var _0x127109=_0xbaf04b['map'](function(_0x3c8cf4){return db[_0x260b('0x1a')][_0x260b('0x1b')]({'where':{'id':_0x3c8cf4[_0x260b('0x1c')](0x3)},'raw':!![]});});return Promise[_0x260b('0x1d')](_0x127109);})['then'](function(_0x54332a){for(var _0x3c7ec1=0x0;_0x3c7ec1<_0x54332a[_0x260b('0x1e')];_0x3c7ec1++){if(_0x54332a[_0x3c7ec1]){var _0x42f5f4=_0x260b('0x19')+_0x54332a[_0x3c7ec1]['id'];_0x40d476[_0x42f5f4][_0x260b('0x1f')]=_0x54332a[_0x3c7ec1]['type'];}}_0x3a4402=_[_0x260b('0x20')](Object['keys'](_0x40d476),function(_0x4ad549){return{'name':_0x4ad549,'type':_0x40d476[_0x4ad549][_0x260b('0x21')]};});return _0x3a4402;})[_0x260b('0x22')](function(_0x53d352){throw _0x53d352;});}; \ No newline at end of file +var _0xfa15=['all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','search','where','default','fields','filter','clause','tags','user','skip','checkListsRestrictions','ids','tag','then','count','buildContactsQuery','rows','catch','describe','keys','startsWith','cf_','map','findOne'];(function(_0x37fffb,_0x581ac0){var _0x34a7d8=function(_0xe31898){while(--_0xe31898){_0x37fffb['push'](_0x37fffb['shift']());}};_0x34a7d8(++_0x581ac0);}(_0xfa15,0x1d2));var _0x5fa1=function(_0x38fee8,_0x4c3aae){_0x38fee8=_0x38fee8-0x0;var _0x567d26=_0xfa15[_0x38fee8];return _0x567d26;};'use strict';var _=require('lodash');var sqlUtils=require(_0x5fa1('0x0'));var db=require(_0x5fa1('0x1'))['db'];exports[_0x5fa1('0x2')]=function(_0x3b93ce,_0x2c6a44,_0x5a92a0,_0x21cdd5){var _0x473e75={'count':0x0,'rows':[]};var _0x57cc5b=sqlUtils[_0x5fa1('0x3')](_0x2c6a44,_0x3b93ce);if(_0x57cc5b){return Promise[_0x5fa1('0x4')](_0x473e75);}var _0xff8c1d=sqlUtils[_0x5fa1('0x5')]();var _0x4c7a8d={};var _0xb3c3ac=![];var _0x5db2a1=![];return Promise['resolve']()['then'](function(){if(_0x3b93ce['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x3b93ce[_0x5fa1('0x6')],_0x21cdd5);}else{return sqlUtils['parseQueryParameters'](_0x3b93ce,_0x21cdd5);}})['then'](function(_0x3ee6a1){_0xff8c1d[_0x5fa1('0x7')](_0x3ee6a1[_0x5fa1('0x8')]);_0xff8c1d[_0x5fa1('0x7')](_0x3ee6a1[_0x5fa1('0x9')]);_0xff8c1d[_0x5fa1('0x7')](_0x3ee6a1[_0x5fa1('0xa')]);_0xff8c1d[_0x5fa1('0x7')](_0x3ee6a1['user'][_0x5fa1('0xb')]);_0x4c7a8d=_0x3ee6a1[_0x5fa1('0xc')];_0x5db2a1=_0x3ee6a1[_0x5fa1('0xd')][_0x5fa1('0xe')];return sqlUtils[_0x5fa1('0xf')](_0x2c6a44,_0x3b93ce,_0x5db2a1);})['then'](function(_0x5df041){_0xff8c1d[_0x5fa1('0x7')](_0x5df041);var _0x1e2996=_0x3b93ce[_0x5fa1('0x6')]?_0x4c7a8d[_0x5fa1('0x10')]:_0x3b93ce[_0x5fa1('0x11')];_0xb3c3ac=_0x1e2996?!![]:![];return sqlUtils['countFilteredContacts'](_0xff8c1d,_0x1e2996);})[_0x5fa1('0x12')](function(_0x338a14){_0x473e75['count']=_0x338a14;if(_0x473e75[_0x5fa1('0x13')]===0x0){return;}if(_0x3b93ce['User']){_0x5db2a1=!![];}return sqlUtils[_0x5fa1('0x14')](_0xff8c1d,_0x3b93ce['fields'],_0x5a92a0,_0xb3c3ac,_0x4c7a8d[_0x5fa1('0xb')],_0x5db2a1);})[_0x5fa1('0x12')](function(_0xc84ec0){if(!_0xc84ec0){return[];}return sqlUtils['getFilteredContacts'](_0xc84ec0,_0x3b93ce,_0x5a92a0);})[_0x5fa1('0x12')](function(_0x543099){_0x473e75[_0x5fa1('0x15')]=_0x543099;return _0x473e75;})[_0x5fa1('0x16')](function(_0x15b42e){throw _0x15b42e;});};exports[_0x5fa1('0x17')]=function(){var _0x4bb211={};var _0x357f92=[];return db['CmContact'][_0x5fa1('0x17')]()[_0x5fa1('0x12')](function(_0x175763){_0x4bb211=_0x175763;var _0x42c13=Object[_0x5fa1('0x18')](_0x4bb211)['filter'](function(_0xae2031){return _[_0x5fa1('0x19')](_0xae2031,_0x5fa1('0x1a'))?_0xae2031:undefined;});var _0x424f56=_0x42c13[_0x5fa1('0x1b')](function(_0x157f31){return db['CmCustomField'][_0x5fa1('0x1c')]({'where':{'id':_0x157f31['slice'](0x3)},'raw':!![]});});return Promise[_0x5fa1('0x1d')](_0x424f56);})[_0x5fa1('0x12')](function(_0x5d7fbd){for(var _0x2e9027=0x0;_0x2e9027<_0x5d7fbd[_0x5fa1('0x1e')];_0x2e9027++){if(_0x5d7fbd[_0x2e9027]){var _0x3e42da=_0x5fa1('0x1a')+_0x5d7fbd[_0x2e9027]['id'];_0x4bb211[_0x3e42da][_0x5fa1('0x1f')]=_0x5d7fbd[_0x2e9027][_0x5fa1('0x20')];}}_0x357f92=_['map'](Object[_0x5fa1('0x18')](_0x4bb211),function(_0x284f3e){return{'name':_0x284f3e,'type':_0x4bb211[_0x284f3e][_0x5fa1('0x20')]};});return _0x357f92;})[_0x5fa1('0x16')](function(_0x28d8d0){throw _0x28d8d0;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 3c2a42f..42316b3 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49b1=['find','dateOfBirth','fieldType','datetime','DATE','type','value','start','end','Tag','tags','clause','and','ids','User','user','skip','map','name','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','fields','tag','filter','search','getLists','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','toString','Tags','clone','COUNT(*)','where','t.id\x20IN\x20?','query','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','ListId','autocomplete','true','select','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','length','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?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions'];(function(_0xae9a79,_0x4dc03c){var _0x44e692=function(_0x575fd5){while(--_0x575fd5){_0xae9a79['push'](_0xae9a79['shift']());}};_0x44e692(++_0x4dc03c);}(_0x49b1,0x1e9));var _0x149b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x49b1[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x149b('0x0'));var squel=require(_0x149b('0x1'));var as=require(_0x149b('0x2'));var qs=require('../parsers/qs');var utils=require(_0x149b('0x3'));var db=require(_0x149b('0x4'))['db'];function skipContactsQuery(_0x24b196,_0x49bece){var _0x15d677=![];if(_0x24b196[_0x149b('0x5')]===_0x149b('0x6')&&!_0x49bece['search']&&!_0x49bece[_0x149b('0x7')]&&_0x49bece[_0x149b('0x8')]!==_0x149b('0x9')){_0x15d677=!![];}return _0x15d677;}function getContactsSubquery(){return squel[_0x149b('0xa')]()['from']('cm_contacts','c')['where'](_0x149b('0xb'));}function applyJoinClauses(_0x5e9bb4,_0x37725f){var _0x580dbe=_0x37725f?'c':_0x149b('0xc');_0x5e9bb4['left_join'](_0x149b('0xd'),'uc','uc.CmContactId\x20=\x20'+_0x580dbe+'.id')[_0x149b('0xe')](_0x149b('0xf'),'ct',_0x149b('0x10')+_0x580dbe+_0x149b('0x11'))['left_join'](_0x149b('0x12'),'t',_0x149b('0x13'));return _0x5e9bb4;}function addFieldsToQuery(_0x46ae9e,_0x1ae972,_0x31dbc3,_0x8c7b20,_0x4fe797){var _0x1afc87=_0x4fe797?'c':_0x149b('0xc');if(!_0x1ae972){_0x1ae972=['id',_0x149b('0x14'),_0x149b('0x15'),_0x149b('0x16'),_0x149b('0x17'),_0x149b('0x18'),'email','ListId',_0x149b('0x19'),_0x149b('0x1a'),_0x149b('0x1b'),_0x149b('0x1c'),_0x149b('0x1d')];}else if(!_0x1ae972['includes']('id')){_0x1ae972[_0x149b('0x1e')]('id');}var _0x202956=_0x31dbc3&&_0x4fe797||!_0x31dbc3&&!_0x4fe797;if(_0x8c7b20){_0x202956=_0x8c7b20&&_0x4fe797||!_0x8c7b20&&!_0x4fe797;}_0x1ae972[_0x149b('0x1f')](function(_0x2a55b3){if(_0x2a55b3==='TagIds'){if(_0x202956){_0x46ae9e[_0x149b('0x20')](_0x149b('0x21'),_0x2a55b3);}else if(_0x31dbc3||_0x8c7b20){_0x46ae9e[_0x149b('0x20')](_0x1afc87+'.'+_0x2a55b3);}}else{_0x46ae9e[_0x149b('0x20')](_0x1afc87+'.'+_0x2a55b3);}});return _0x46ae9e;}function getSqlClauses(){var _0x2bb44e={'default':squel[_0x149b('0x22')](),'fields':squel['expr'](),'filter':squel[_0x149b('0x22')](),'tags':{'clause':squel[_0x149b('0x22')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x2bb44e;}function parseTagParameter(_0x5ee696){var _0x525feb=squel[_0x149b('0x22')]();if(_0x5ee696){var _0x36a88e=utils[_0x149b('0x23')](_0x5ee696);_0x36a88e[_0x149b('0x1f')](function(_0x507753){_0x525feb['or'](_0x149b('0x24'),'%,'+_0x507753+',%');});}return _0x525feb;}function parseSearchFilter(_0x88c9c6){var _0x425762=squel[_0x149b('0x22')]();if(_0x88c9c6){var _0x852243=_0x88c9c6[_0x149b('0x25')]('\x5c','\x5c\x5c')[_0x149b('0x25')](/'/g,'\x27\x27');var _0x2611bf=qs[_0x149b('0x26')](_0x852243);if(_0x852243[_0x149b('0x27')]('\x20')[_0x149b('0x28')]>0x1){_0x425762['or'](_0x149b('0x29'),qs[_0x149b('0x2a')](_0x852243,!![]),null);}else{if(qs[_0x149b('0x2b')](_0x852243)){_0x425762['or'](_0x149b('0x2c'),_0x2611bf+'%');_0x425762['or'](_0x149b('0x2d'),_0x2611bf+'%');_0x425762['or']('c.mobile\x20LIKE\x20?',_0x2611bf+'%');_0x425762['or']('c.fax\x20LIKE\x20?',_0x2611bf+'%');}else if(qs[_0x149b('0x2e')](_0x852243)){_0x425762['or'](_0x149b('0x2f'),_0x2611bf+'%');}else{_0x425762['or']('c.firstName\x20LIKE\x20?','%'+_0x2611bf+'%');_0x425762['or'](_0x149b('0x30'),'%'+_0x2611bf+'%');_0x425762['or'](_0x149b('0x2f'),'%'+_0x2611bf+'%');}}}return _0x425762;}function parseAdvancedSearchFilter(_0x381b5d,_0xd23f04){var _0x151630=getSqlClauses();var _0x3556b7=as['parseSearch'](_0x381b5d);var _0x419ac2=_0x3556b7[_0x149b('0x31')];for(var _0x1d3038=0x0;_0x1d3038<_0x3556b7[_0x149b('0x32')][_0x149b('0x28')];_0x1d3038++){var _0x53b79e=_0x3556b7[_0x149b('0x32')][_0x1d3038];var _0x5d127='c';var _0x4bcf21=_[_0x149b('0x33')](_0xd23f04,['name',_0x53b79e[_0x149b('0x20')]]);if(_0x4bcf21){if(_0x53b79e['field']===_0x149b('0x34')||_0x4bcf21[_0x149b('0x35')]===_0x149b('0x36')){_0x53b79e['castTo']=_0x149b('0x37');}var _0x699e25=as['buildExpression'](_0x5d127,_0x4bcf21[_0x149b('0x38')],_0x53b79e);_0x151630['default'][_0x419ac2](_0x699e25['text'],_0x699e25[_0x149b('0x39')][_0x149b('0x3a')],_0x699e25[_0x149b('0x39')][_0x149b('0x3b')]);}else{if(_0x53b79e[_0x149b('0x20')]===_0x149b('0x3c')){var _0x35970b=_0x53b79e[_0x149b('0x39')][_0x149b('0x27')](',')['map'](function(_0x58a3d2){return Number(_0x58a3d2);});var _0x3efd19=parseTagParameter(_0x35970b);_0x151630[_0x149b('0x3d')][_0x149b('0x3e')][_0x149b('0x3f')](_0x3efd19);_0x151630[_0x149b('0x3d')][_0x149b('0x40')]=_0x35970b;}else if(_0x53b79e[_0x149b('0x20')]===_0x149b('0x41')){_0x151630['user']['clause'][_0x149b('0x3f')]('uc.UserId\x20=\x20?',_0x53b79e[_0x149b('0x39')]);_0x151630[_0x149b('0x42')][_0x149b('0x43')]=!![];}}}return _0x151630;}function parseModelFields(_0x46ce51,_0x585630){var _0x195468=squel[_0x149b('0x22')]();var _0x540dac=_(_0x46ce51)['keys']()[_0x149b('0x44')](function(_0x116f22){return _['some'](_0x585630,[_0x149b('0x45'),_0x116f22])?_0x116f22:undefined;})[_0x149b('0x46')]()[_0x149b('0x39')]();if(_0x46ce51[_0x149b('0x47')]){_0x540dac[_0x149b('0x1e')](_0x149b('0x47'));}if(_0x46ce51[_0x149b('0x41')]){_0x540dac['push']('User');}if(_0x540dac[_0x149b('0x28')]>0x0){_0x540dac[_0x149b('0x1f')](function(_0x22be09){if(_0x22be09===_0x149b('0x7')){_0x195468['and']('c.ListId\x20IN\x20?',[][_0x149b('0x48')](_0x46ce51[_0x22be09]));}else if(_0x22be09===_0x149b('0x47')){var _0xa41e='%'+_0x46ce51[_0x22be09]+'%';_0x195468[_0x149b('0x3f')](_0x149b('0x49'),_0xa41e);}else if(_0x22be09===_0x149b('0x41')){_0x195468[_0x149b('0x3f')](_0x149b('0x4a'),_0x46ce51[_0x22be09]);}else{_0x195468[_0x149b('0x3f')]('c.'+_0x22be09+_0x149b('0x4b'),_0x46ce51[_0x22be09]);}});}return _0x195468;}function parseQueryParameters(_0x4604b4,_0x5da486){var _0x5e06b9=getSqlClauses();return Promise[_0x149b('0x4c')]()[_0x149b('0x4d')](function(){return parseModelFields(_0x4604b4,_0x5da486);})[_0x149b('0x4d')](function(_0x4ec633){_0x5e06b9[_0x149b('0x4e')][_0x149b('0x3f')](_0x4ec633);return parseTagParameter(_0x4604b4[_0x149b('0x4f')]);})[_0x149b('0x4d')](function(_0x5d41b0){_0x5e06b9[_0x149b('0x3d')][_0x149b('0x3e')][_0x149b('0x3f')](_0x5d41b0);return parseSearchFilter(_0x4604b4[_0x149b('0x50')]);})['then'](function(_0x36be9d){_0x5e06b9[_0x149b('0x50')]=_0x36be9d;return _0x5e06b9;});}function checkListsRestrictions(_0x47c61e,_0x12c85a,_0x24da3a){var _0x34a869=squel[_0x149b('0x22')]();return Promise[_0x149b('0x4c')]()[_0x149b('0x4d')](function(){if(_0x12c85a[_0x149b('0x51')]&&_0x47c61e['role']===_0x149b('0x6')&&!_0x24da3a){return _0x47c61e[_0x149b('0x52')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4ecfc9){if(_0x4ecfc9){if(_0x4ecfc9[_0x149b('0x28')]===0x0){_0x34a869[_0x149b('0x3f')]('c.ListId\x20IS\x20NULL');}else{_0x34a869[_0x149b('0x3f')](_0x149b('0x53'),_[_0x149b('0x44')](_0x4ecfc9,'id'));}}})[_0x149b('0x4d')](function(){return _0x34a869;});}function buildContactsQuery(_0x9cfbf7,_0x53c893,_0x2c2bce,_0x127f9b,_0x4363f6,_0x77dc58){if(_0x53c893){_0x53c893=_0x2c2bce[_0x149b('0x54')];}_0x9cfbf7=addFieldsToQuery(_0x9cfbf7,_0x53c893,_0x127f9b,_0x77dc58,!![]);var _0x28fc42=squel[_0x149b('0xa')]();_0x28fc42=addFieldsToQuery(_0x28fc42,_0x53c893,_0x127f9b,_0x77dc58,![]);if(_0x127f9b||_0x77dc58){_0x9cfbf7=applyJoinClauses(_0x9cfbf7,!![]);_0x9cfbf7[_0x149b('0x55')](_0x149b('0x56'));if(_0x2c2bce[_0x149b('0x57')]){_0x28fc42[_0x149b('0x57')](_0x2c2bce['limit']);}if(_0x2c2bce[_0x149b('0x58')]){_0x28fc42[_0x149b('0x58')](_0x2c2bce[_0x149b('0x58')]);}}else{_0x28fc42=applyJoinClauses(_0x28fc42,![]);_0x28fc42[_0x149b('0x55')](_0x149b('0x59'));if(_0x2c2bce['limit']){_0x9cfbf7[_0x149b('0x57')](_0x2c2bce[_0x149b('0x57')]);}if(_0x2c2bce['offset']){_0x9cfbf7[_0x149b('0x58')](_0x2c2bce[_0x149b('0x58')]);}}_0x28fc42[_0x149b('0x5a')](_0x4363f6);if(_0x2c2bce[_0x149b('0x5b')]){_0x2c2bce['order'][_0x149b('0x1f')](function(_0x4ddc59){_0x9cfbf7['order']('c.'+_0x4ddc59[0x0],_0x4ddc59[0x1]===_0x149b('0x5c')?![]:!![]);_0x28fc42['order']('subqry.'+_0x4ddc59[0x0],_0x4ddc59[0x1]==='DESC'?![]:!![]);});}_0x28fc42[_0x149b('0x5d')](_0x9cfbf7,'subqry');return _0x28fc42;}function getFilteredContacts(_0x2615c5){var _0x416183=[];return db[_0x149b('0x3c')][_0x149b('0x5e')]({'attributes':['id',_0x149b('0x45'),_0x149b('0x5f')],'raw':!![]})['then'](function(_0x4729d4){_0x416183=_[_0x149b('0x60')](_0x4729d4,'id');var _0x3fc402={'type':db[_0x149b('0x61')][_0x149b('0x62')][_0x149b('0x63')],'model':db[_0x149b('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize']['query'](_0x2615c5[_0x149b('0x65')](),_0x3fc402);})[_0x149b('0x4d')](function(_0x1ef257){_0x1ef257[_0x149b('0x1f')](function(_0x2a5dc0){if(_0x2a5dc0[_0x149b('0x1d')]){_0x2a5dc0['Tags']=[];_0x2a5dc0[_0x149b('0x1d')][_0x149b('0x27')](',')[_0x149b('0x1f')](function(_0x32866f){_0x2a5dc0[_0x149b('0x66')]['push'](_0x416183[_0x32866f]);});}delete _0x2a5dc0[_0x149b('0x1d')];});return _0x1ef257;});}function countFilteredContacts(_0x2ae24e,_0x22e0bd){var _0x4b517e=_0x2ae24e[_0x149b('0x67')]();_0x4b517e[_0x149b('0x20')](_0x149b('0x68'));_0x4b517e=applyJoinClauses(_0x4b517e,!![]);_0x2ae24e['group']('c.id');var _0x4c67d0=utils[_0x149b('0x23')](_0x22e0bd);if(!_['isEmpty'](_0x4c67d0)){_0x4b517e[_0x149b('0x69')](_0x149b('0x6a'),_0x4c67d0);}var _0x3c0925={'type':db['Sequelize'][_0x149b('0x62')][_0x149b('0x63')],'raw':!![]};return db['sequelize'][_0x149b('0x6b')](_0x4b517e[_0x149b('0x65')](),_0x3c0925)['then'](function(_0xf4fd59){return _0xf4fd59[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x984e=['cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','phone','mobile','fax','email','CompanyId','createdAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','fieldType','datetime','castTo','DATE','buildExpression','text','start','end','Tag','value','clause','and','ids','user','uc.UserId\x20=\x20?','skip','keys','map','some','name','compact','Contact','User','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','tags','filter','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','limit','offset','group','subqry.id','having','order','DESC','findAll','color','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','c.id','getSelectedTags','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20'];(function(_0x55b280,_0x169d77){var _0x161bea=function(_0x17e6b8){while(--_0x17e6b8){_0x55b280['push'](_0x55b280['shift']());}};_0x161bea(++_0x169d77);}(_0x984e,0x1b5));var _0xe984=function(_0x274497,_0x39b6e2){_0x274497=_0x274497-0x0;var _0x2eaae8=_0x984e[_0x274497];return _0x2eaae8;};'use strict';var _=require(_0xe984('0x0'));var squel=require(_0xe984('0x1'));var as=require(_0xe984('0x2'));var qs=require(_0xe984('0x3'));var utils=require(_0xe984('0x4'));var db=require(_0xe984('0x5'))['db'];function skipContactsQuery(_0x53ab6f,_0x3b4d2e){var _0x284e03=![];if(_0x53ab6f[_0xe984('0x6')]===_0xe984('0x7')&&!_0x3b4d2e[_0xe984('0x8')]&&!_0x3b4d2e[_0xe984('0x9')]&&_0x3b4d2e[_0xe984('0xa')]!==_0xe984('0xb')){_0x284e03=!![];}return _0x284e03;}function getContactsSubquery(){return squel[_0xe984('0xc')]()[_0xe984('0xd')](_0xe984('0xe'),'c')['where'](_0xe984('0xf'));}function applyJoinClauses(_0x55bc8f,_0x18982b){var _0x438744=_0x18982b?'c':'subqry';_0x55bc8f[_0xe984('0x10')](_0xe984('0x11'),'uc',_0xe984('0x12')+_0x438744+'.id')['left_join'](_0xe984('0x13'),'ct',_0xe984('0x14')+_0x438744+_0xe984('0x15'))[_0xe984('0x10')](_0xe984('0x16'),'t',_0xe984('0x17'));return _0x55bc8f;}function addFieldsToQuery(_0x1e8adb,_0x53a6e6,_0x279872,_0x28ab3d,_0x2fb6f8){var _0x4200a2=_0x2fb6f8?'c':_0xe984('0x18');if(!_0x53a6e6){_0x53a6e6=['id',_0xe984('0x19'),'lastName',_0xe984('0x1a'),_0xe984('0x1b'),_0xe984('0x1c'),_0xe984('0x1d'),_0xe984('0x9'),_0xe984('0x1e'),_0xe984('0x1f'),'updatedAt',_0xe984('0x20'),_0xe984('0x21')];}else if(!_0x53a6e6[_0xe984('0x22')]('id')){_0x53a6e6[_0xe984('0x23')]('id');}var _0x12d1f9=_0x279872&&_0x2fb6f8||!_0x279872&&!_0x2fb6f8;if(_0x28ab3d){_0x12d1f9=_0x28ab3d&&_0x2fb6f8||!_0x28ab3d&&!_0x2fb6f8;}_0x53a6e6[_0xe984('0x24')](function(_0x19df10){if(_0x19df10===_0xe984('0x21')){if(_0x12d1f9){_0x1e8adb[_0xe984('0x25')](_0xe984('0x26'),_0x19df10);}else if(_0x279872||_0x28ab3d){_0x1e8adb[_0xe984('0x25')](_0x4200a2+'.'+_0x19df10);}}else{_0x1e8adb['field'](_0x4200a2+'.'+_0x19df10);}});return _0x1e8adb;}function getSqlClauses(){var _0x391628={'default':squel[_0xe984('0x27')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x391628;}function parseTagParameter(_0x507cf7){var _0x276531=squel[_0xe984('0x27')]();if(_0x507cf7){var _0x46bee2=utils['getSelectedTags'](_0x507cf7);_0x46bee2[_0xe984('0x24')](function(_0x5f28bc){_0x276531['or'](_0xe984('0x28'),'%,'+_0x5f28bc+',%');});}return _0x276531;}function parseSearchFilter(_0x13741d){var _0xa1edd1=squel['expr']();if(_0x13741d){var _0x235935=_0x13741d[_0xe984('0x29')]('\x5c','\x5c\x5c')[_0xe984('0x29')](/'/g,'\x27\x27');var _0x1d60e3=qs[_0xe984('0x2a')](_0x235935);if(_0x235935[_0xe984('0x2b')]('\x20')[_0xe984('0x2c')]>0x1){_0xa1edd1['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe984('0x2d')](_0x235935,!![]),null);}else{if(qs[_0xe984('0x2e')](_0x235935)){_0xa1edd1['or'](_0xe984('0x2f'),_0x1d60e3+'%');_0xa1edd1['or'](_0xe984('0x30'),_0x1d60e3+'%');_0xa1edd1['or'](_0xe984('0x31'),_0x1d60e3+'%');_0xa1edd1['or'](_0xe984('0x32'),_0x1d60e3+'%');}else if(qs[_0xe984('0x33')](_0x235935)){_0xa1edd1['or'](_0xe984('0x34'),_0x1d60e3+'%');}else{_0xa1edd1['or']('c.firstName\x20LIKE\x20?','%'+_0x1d60e3+'%');_0xa1edd1['or'](_0xe984('0x35'),'%'+_0x1d60e3+'%');_0xa1edd1['or']('c.email\x20LIKE\x20?','%'+_0x1d60e3+'%');}}}return _0xa1edd1;}function parseAdvancedSearchFilter(_0x1a3c75,_0x5c1acb){var _0x574907=getSqlClauses();var _0x6a283c=as['parseSearch'](_0x1a3c75);var _0x38dac2=_0x6a283c[_0xe984('0x36')];for(var _0x5ae126=0x0;_0x5ae126<_0x6a283c['conditions']['length'];_0x5ae126++){var _0x27eb64=_0x6a283c[_0xe984('0x37')][_0x5ae126];var _0x48fa1f='c';var _0x4f9a55=_[_0xe984('0x38')](_0x5c1acb,['name',_0x27eb64[_0xe984('0x25')]]);if(_0x4f9a55){if(_0x27eb64[_0xe984('0x25')]==='dateOfBirth'||_0x4f9a55[_0xe984('0x39')]===_0xe984('0x3a')){_0x27eb64[_0xe984('0x3b')]=_0xe984('0x3c');}var _0x5c4abe=as[_0xe984('0x3d')](_0x48fa1f,_0x4f9a55['type'],_0x27eb64);_0x574907['default'][_0x38dac2](_0x5c4abe[_0xe984('0x3e')],_0x5c4abe['value'][_0xe984('0x3f')],_0x5c4abe['value'][_0xe984('0x40')]);}else{if(_0x27eb64[_0xe984('0x25')]===_0xe984('0x41')){var _0x136121=_0x27eb64[_0xe984('0x42')][_0xe984('0x2b')](',')['map'](function(_0x4d3be8){return Number(_0x4d3be8);});var _0x49ca4b=parseTagParameter(_0x136121);_0x574907['tags'][_0xe984('0x43')][_0xe984('0x44')](_0x49ca4b);_0x574907['tags'][_0xe984('0x45')]=_0x136121;}else if(_0x27eb64[_0xe984('0x25')]==='User'){_0x574907[_0xe984('0x46')][_0xe984('0x43')][_0xe984('0x44')](_0xe984('0x47'),_0x27eb64[_0xe984('0x42')]);_0x574907[_0xe984('0x46')][_0xe984('0x48')]=!![];}}}return _0x574907;}function parseModelFields(_0x592eda,_0x28b8f3){var _0x5c36ba=squel[_0xe984('0x27')]();var _0x10af79=_(_0x592eda)[_0xe984('0x49')]()[_0xe984('0x4a')](function(_0x223847){return _[_0xe984('0x4b')](_0x28b8f3,[_0xe984('0x4c'),_0x223847])?_0x223847:undefined;})[_0xe984('0x4d')]()[_0xe984('0x42')]();if(_0x592eda[_0xe984('0x4e')]){_0x10af79[_0xe984('0x23')]('Contact');}if(_0x592eda[_0xe984('0x4f')]){_0x10af79[_0xe984('0x23')](_0xe984('0x4f'));}if(_0x10af79[_0xe984('0x2c')]>0x0){_0x10af79[_0xe984('0x24')](function(_0x171ea2){if(_0x171ea2===_0xe984('0x9')){_0x5c36ba[_0xe984('0x44')]('c.ListId\x20IN\x20?',[][_0xe984('0x50')](_0x592eda[_0x171ea2]));}else if(_0x171ea2===_0xe984('0x4e')){var _0x4a9777='%'+_0x592eda[_0x171ea2]+'%';_0x5c36ba[_0xe984('0x44')](_0xe984('0x51'),_0x4a9777);}else if(_0x171ea2===_0xe984('0x4f')){_0x5c36ba['and'](_0xe984('0x47'),_0x592eda[_0x171ea2]);}else{_0x5c36ba[_0xe984('0x44')]('c.'+_0x171ea2+_0xe984('0x52'),_0x592eda[_0x171ea2]);}});}return _0x5c36ba;}function parseQueryParameters(_0x47d616,_0x144276){var _0x2b27d6=getSqlClauses();return Promise[_0xe984('0x53')]()[_0xe984('0x54')](function(){return parseModelFields(_0x47d616,_0x144276);})[_0xe984('0x54')](function(_0x3bb091){_0x2b27d6['fields']['and'](_0x3bb091);return parseTagParameter(_0x47d616[_0xe984('0x55')]);})[_0xe984('0x54')](function(_0x4e2227){_0x2b27d6[_0xe984('0x56')][_0xe984('0x43')]['and'](_0x4e2227);return parseSearchFilter(_0x47d616[_0xe984('0x57')]);})[_0xe984('0x54')](function(_0x1f4ccd){_0x2b27d6[_0xe984('0x57')]=_0x1f4ccd;return _0x2b27d6;});}function checkListsRestrictions(_0x2313cb,_0x2c5981,_0x3cf30a){var _0x48d046=squel[_0xe984('0x27')]();return Promise['resolve']()[_0xe984('0x54')](function(){if(_0x2c5981[_0xe984('0x8')]&&_0x2313cb[_0xe984('0x6')]===_0xe984('0x7')&&!_0x3cf30a){return _0x2313cb[_0xe984('0x58')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x406118){if(_0x406118){if(_0x406118[_0xe984('0x2c')]===0x0){_0x48d046[_0xe984('0x44')](_0xe984('0x59'));}else{_0x48d046['and'](_0xe984('0x5a'),_['map'](_0x406118,'id'));}}})[_0xe984('0x54')](function(){return _0x48d046;});}function buildContactsQuery(_0x4800a3,_0x371aea,_0x39d2fb,_0x96ca09,_0xe013ca,_0x5a4662){if(_0x371aea){_0x371aea=_0x39d2fb['attributes'];}_0x4800a3=addFieldsToQuery(_0x4800a3,_0x371aea,_0x96ca09,_0x5a4662,!![]);var _0x3c03d0=squel[_0xe984('0xc')]();_0x3c03d0=addFieldsToQuery(_0x3c03d0,_0x371aea,_0x96ca09,_0x5a4662,![]);if(_0x96ca09||_0x5a4662){_0x4800a3=applyJoinClauses(_0x4800a3,!![]);_0x4800a3['group']('c.id');if(_0x39d2fb[_0xe984('0x5b')]){_0x3c03d0[_0xe984('0x5b')](_0x39d2fb[_0xe984('0x5b')]);}if(_0x39d2fb[_0xe984('0x5c')]){_0x3c03d0[_0xe984('0x5c')](_0x39d2fb[_0xe984('0x5c')]);}}else{_0x3c03d0=applyJoinClauses(_0x3c03d0,![]);_0x3c03d0[_0xe984('0x5d')](_0xe984('0x5e'));if(_0x39d2fb[_0xe984('0x5b')]){_0x4800a3[_0xe984('0x5b')](_0x39d2fb['limit']);}if(_0x39d2fb[_0xe984('0x5c')]){_0x4800a3[_0xe984('0x5c')](_0x39d2fb['offset']);}}_0x3c03d0[_0xe984('0x5f')](_0xe013ca);if(_0x39d2fb[_0xe984('0x60')]){_0x39d2fb[_0xe984('0x60')][_0xe984('0x24')](function(_0x3bcfa2){_0x4800a3[_0xe984('0x60')]('c.'+_0x3bcfa2[0x0],_0x3bcfa2[0x1]==='DESC'?![]:!![]);_0x3c03d0['order']('subqry.'+_0x3bcfa2[0x0],_0x3bcfa2[0x1]===_0xe984('0x61')?![]:!![]);});}_0x3c03d0['from'](_0x4800a3,_0xe984('0x18'));return _0x3c03d0;}function getFilteredContacts(_0x3cb518){var _0x3fa691=[];return db['Tag'][_0xe984('0x62')]({'attributes':['id','name',_0xe984('0x63')],'raw':!![]})[_0xe984('0x54')](function(_0x1f030a){_0x3fa691=_['keyBy'](_0x1f030a,'id');var _0x5c8340={'type':db[_0xe984('0x64')][_0xe984('0x65')][_0xe984('0x66')],'model':db[_0xe984('0x67')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xe984('0x68')]['query'](_0x3cb518[_0xe984('0x69')](),_0x5c8340);})[_0xe984('0x54')](function(_0x165778){_0x165778[_0xe984('0x24')](function(_0x382e39){if(_0x382e39[_0xe984('0x21')]){_0x382e39[_0xe984('0x6a')]=[];_0x382e39[_0xe984('0x21')][_0xe984('0x2b')](',')[_0xe984('0x24')](function(_0x3a985a){_0x382e39[_0xe984('0x6a')][_0xe984('0x23')](_0x3fa691[_0x3a985a]);});}delete _0x382e39['TagIds'];});return _0x165778;});}function countFilteredContacts(_0x2a24aa,_0x3e3d4e){var _0x35baf0=_0x2a24aa[_0xe984('0x6b')]();_0x35baf0[_0xe984('0x25')](_0xe984('0x6c'));_0x35baf0=applyJoinClauses(_0x35baf0,!![]);_0x2a24aa[_0xe984('0x5d')](_0xe984('0x6d'));var _0x2066e0=utils[_0xe984('0x6e')](_0x3e3d4e);if(!_[_0xe984('0x6f')](_0x2066e0)){_0x35baf0['where'](_0xe984('0x70'),_0x2066e0);}var _0x5cb7cb={'type':db[_0xe984('0x64')][_0xe984('0x65')][_0xe984('0x66')],'raw':!![]};return db['sequelize']['query'](_0x35baf0[_0xe984('0x69')](),_0x5cb7cb)[_0xe984('0x54')](function(_0x341a19){return _0x341a19[0x0]['COUNT(*)'];});}module[_0xe984('0x71')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index c61a5fa..c3f3ebc 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 _0xbe91=['filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbe91,0x14f));var _0x1be9=function(_0x131060,_0x2bd42e){_0x131060=_0x131060-0x0;var _0x2258e7=_0xbe91[_0x131060];return _0x2258e7;};'use strict';var crypto=require(_0x1be9('0x0'));var fs=require('fs');var BPromise=require(_0x1be9('0x1'));var _=require(_0x1be9('0x2'));var config=require(_0x1be9('0x3'));var logger=require('../../config/logger')(_0x1be9('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x1be9('0x5')][_0x1be9('0x6')],'algorithm':_0x1be9('0x7')};const fileOptions={'algorithm':_0x1be9('0x8')};if(config[_0x1be9('0x9')]&&config['encrypt'][_0x1be9('0xa')]){var isSupported=isAlgorithmSupported(config[_0x1be9('0x9')][_0x1be9('0xa')]);if(isSupported){fileOptions[_0x1be9('0xa')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x1be9('0xb')](',\x20');logger[_0x1be9('0xc')](config[_0x1be9('0x9')][_0x1be9('0xa')],_0x1be9('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x17b28f){return AES_SUPPORTED_RX['test'](_0x17b28f);}function getSupportedCiphers(){return crypto[_0x1be9('0xe')]()[_0x1be9('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x140021){return getSupportedCiphers()['indexOf'](_0x140021)>-0x1;}function combineOptions(_0x367ab5){var _0x483c6c={};for(var _0x5a7810 in fileOptions){if(fileOptions[_0x1be9('0x10')](_0x5a7810)){_0x483c6c[_0x5a7810]=fileOptions[_0x5a7810];}}if(_0x367ab5){for(var _0x38439b in _0x367ab5){if(_0x367ab5['hasOwnProperty'](_0x38439b)){_0x483c6c[_0x38439b]=_0x367ab5[_0x38439b];}}}return _0x483c6c;}exports[_0x1be9('0x11')]=function(_0x6bc2ff,_0x4cfc94,_0x199ea9,_0x299cd0){return new BPromise(function(_0x590202,_0x273eeb){_0x299cd0=combineOptions(_0x299cd0);var _0x39a912=new Buffer(_0x199ea9);var _0x33897e=fs[_0x1be9('0x12')](_0x6bc2ff);var _0x1954f2=fs[_0x1be9('0x13')](_0x4cfc94);var _0x2fb7a6=crypto[_0x1be9('0x14')](_0x299cd0[_0x1be9('0xa')],_0x39a912);_0x33897e['on'](_0x1be9('0x15'),function(_0x15c6c5){var _0x401acb=new Buffer(_0x2fb7a6[_0x1be9('0x16')](_0x15c6c5),_0x1be9('0x17'));_0x1954f2[_0x1be9('0x18')](_0x401acb);});_0x33897e['on'](_0x1be9('0x19'),function(){try{var _0x4c6f12=new Buffer(_0x2fb7a6[_0x1be9('0x1a')](_0x1be9('0x17')),_0x1be9('0x17'));_0x1954f2[_0x1be9('0x18')](_0x4c6f12);_0x1954f2['end']();_0x1954f2['on'](_0x1be9('0x1b'),function(){return _0x590202(_0x4cfc94);});}catch(_0x4b9349){fs[_0x1be9('0x1c')](_0x4cfc94);return _0x273eeb(_0x4b9349);}});});};exports[_0x1be9('0x1d')]=function(_0x73ad42,_0x202a2e,_0x324209,_0x28d91d){return new BPromise(function(_0x26d506,_0xd98dff){_0x28d91d=combineOptions(_0x28d91d);var _0x5bb582=new Buffer(_0x324209);var _0x45e57b=fs[_0x1be9('0x12')](_0x73ad42);var _0x1763f2=fs[_0x1be9('0x13')](_0x202a2e);var _0x4e1813=crypto[_0x1be9('0x1e')](_0x28d91d[_0x1be9('0xa')],_0x5bb582);_0x45e57b['on'](_0x1be9('0x15'),function(_0x417835){var _0x16f53b=new Buffer(_0x4e1813['update'](_0x417835),_0x1be9('0x17'));_0x1763f2[_0x1be9('0x18')](_0x16f53b);});_0x45e57b['on'](_0x1be9('0x19'),function(){try{var _0x4cd384=new Buffer(_0x4e1813[_0x1be9('0x1a')]('binary'),_0x1be9('0x17'));_0x1763f2['write'](_0x4cd384);_0x1763f2[_0x1be9('0x19')]();_0x1763f2['on'](_0x1be9('0x1b'),function(){return _0x26d506(_0x202a2e);});}catch(_0x2df309){fs['unlink'](_0x202a2e);return _0xd98dff(_0x2df309);}});});};exports['encryptString']=function(_0x1c17ca,_0x243a65,_0x5de04e){var _0x3ef10c=_0x5de04e||stringOptions[_0x1be9('0xa')];var _0x4dc3ac=_0x243a65||stringOptions[_0x1be9('0x1f')];var _0x534666=crypto[_0x1be9('0x14')](_0x3ef10c,_0x4dc3ac);var _0x228946=_0x534666[_0x1be9('0x16')](_0x1c17ca,_0x1be9('0x20'),'base64');_0x228946+=_0x534666['final'](_0x1be9('0x21'));return _0x228946;};exports[_0x1be9('0x22')]=function(_0x507107,_0x14bc9f,_0x5955a2){var _0x59e6a0=_0x5955a2||stringOptions[_0x1be9('0xa')];var _0x2f52b8=_0x14bc9f||stringOptions[_0x1be9('0x1f')];var _0x4a4bb5=crypto[_0x1be9('0x1e')](_0x59e6a0,_0x2f52b8);var _0x26432a=_0x4a4bb5[_0x1be9('0x16')](_0x507107,'base64',_0x1be9('0x20'));_0x26432a+=_0x4a4bb5[_0x1be9('0x1a')](_0x1be9('0x20'));return _0x26432a;}; \ No newline at end of file +var _0x5b95=['write','end','close','unlink','decryptFile','createReadStream','createWriteStream','createDecipher','final','encryptString','secret','base64','decryptString','utf8','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','encryptFile','createCipher','data','update','binary'];(function(_0x35e1b3,_0x464aa6){var _0x472a30=function(_0x53b1c5){while(--_0x53b1c5){_0x35e1b3['push'](_0x35e1b3['shift']());}};_0x472a30(++_0x464aa6);}(_0x5b95,0xe6));var _0x55b9=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x5b95[_0x47aa64];return _0x549c7a;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x55b9('0x0'));var _=require(_0x55b9('0x1'));var config=require(_0x55b9('0x2'));var logger=require(_0x55b9('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x55b9('0x4')][_0x55b9('0x5')],'algorithm':_0x55b9('0x6')};const fileOptions={'algorithm':_0x55b9('0x7')};if(config[_0x55b9('0x8')]&&config[_0x55b9('0x8')][_0x55b9('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x55b9('0x9')]);if(isSupported){fileOptions[_0x55b9('0x9')]=config['encrypt'][_0x55b9('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x55b9('0xa')](',\x20');logger[_0x55b9('0xb')](config[_0x55b9('0x8')][_0x55b9('0x9')],_0x55b9('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x3b2f4e){return AES_SUPPORTED_RX[_0x55b9('0xd')](_0x3b2f4e);}function getSupportedCiphers(){return crypto[_0x55b9('0xe')]()[_0x55b9('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x2673ee){return getSupportedCiphers()[_0x55b9('0x10')](_0x2673ee)>-0x1;}function combineOptions(_0x3f7a5c){var _0x4cc59c={};for(var _0x4436ea in fileOptions){if(fileOptions['hasOwnProperty'](_0x4436ea)){_0x4cc59c[_0x4436ea]=fileOptions[_0x4436ea];}}if(_0x3f7a5c){for(var _0x411047 in _0x3f7a5c){if(_0x3f7a5c['hasOwnProperty'](_0x411047)){_0x4cc59c[_0x411047]=_0x3f7a5c[_0x411047];}}}return _0x4cc59c;}exports[_0x55b9('0x11')]=function(_0x2bb327,_0x4a0fa6,_0x2a782e,_0x231ea1){return new BPromise(function(_0x51f260,_0x369e15){_0x231ea1=combineOptions(_0x231ea1);var _0x3284fd=new Buffer(_0x2a782e);var _0x170ab7=fs['createReadStream'](_0x2bb327);var _0x3b70f9=fs['createWriteStream'](_0x4a0fa6);var _0xa9a0a7=crypto[_0x55b9('0x12')](_0x231ea1[_0x55b9('0x9')],_0x3284fd);_0x170ab7['on'](_0x55b9('0x13'),function(_0x49e6ef){var _0x58f626=new Buffer(_0xa9a0a7[_0x55b9('0x14')](_0x49e6ef),_0x55b9('0x15'));_0x3b70f9[_0x55b9('0x16')](_0x58f626);});_0x170ab7['on'](_0x55b9('0x17'),function(){try{var _0x3088d2=new Buffer(_0xa9a0a7['final'](_0x55b9('0x15')),_0x55b9('0x15'));_0x3b70f9[_0x55b9('0x16')](_0x3088d2);_0x3b70f9[_0x55b9('0x17')]();_0x3b70f9['on'](_0x55b9('0x18'),function(){return _0x51f260(_0x4a0fa6);});}catch(_0xf3400b){fs[_0x55b9('0x19')](_0x4a0fa6);return _0x369e15(_0xf3400b);}});});};exports[_0x55b9('0x1a')]=function(_0x48522d,_0x2084df,_0x4e5be6,_0x4af354){return new BPromise(function(_0x1d962d,_0x17732e){_0x4af354=combineOptions(_0x4af354);var _0x1d11f6=new Buffer(_0x4e5be6);var _0x2c22c4=fs[_0x55b9('0x1b')](_0x48522d);var _0x541bb1=fs[_0x55b9('0x1c')](_0x2084df);var _0x5f5d43=crypto[_0x55b9('0x1d')](_0x4af354[_0x55b9('0x9')],_0x1d11f6);_0x2c22c4['on'](_0x55b9('0x13'),function(_0x44419f){var _0x5f5af5=new Buffer(_0x5f5d43[_0x55b9('0x14')](_0x44419f),_0x55b9('0x15'));_0x541bb1['write'](_0x5f5af5);});_0x2c22c4['on'](_0x55b9('0x17'),function(){try{var _0x4ab293=new Buffer(_0x5f5d43[_0x55b9('0x1e')](_0x55b9('0x15')),_0x55b9('0x15'));_0x541bb1['write'](_0x4ab293);_0x541bb1[_0x55b9('0x17')]();_0x541bb1['on'](_0x55b9('0x18'),function(){return _0x1d962d(_0x2084df);});}catch(_0x14c0b4){fs['unlink'](_0x2084df);return _0x17732e(_0x14c0b4);}});});};exports[_0x55b9('0x1f')]=function(_0x45e2a6,_0xb2178d,_0x1ab658){var _0x171571=_0x1ab658||stringOptions[_0x55b9('0x9')];var _0x4e246a=_0xb2178d||stringOptions[_0x55b9('0x20')];var _0x3b2490=crypto['createCipher'](_0x171571,_0x4e246a);var _0x3e33fe=_0x3b2490['update'](_0x45e2a6,'utf8','base64');_0x3e33fe+=_0x3b2490['final'](_0x55b9('0x21'));return _0x3e33fe;};exports[_0x55b9('0x22')]=function(_0x39e7c8,_0x85b3b4,_0x224142){var _0x5ac434=_0x224142||stringOptions[_0x55b9('0x9')];var _0x53c94b=_0x85b3b4||stringOptions['secret'];var _0x2586cd=crypto[_0x55b9('0x1d')](_0x5ac434,_0x53c94b);var _0x2c5680=_0x2586cd[_0x55b9('0x14')](_0x39e7c8,_0x55b9('0x21'),_0x55b9('0x23'));_0x2c5680+=_0x2586cd['final'](_0x55b9('0x23'));return _0x2c5680;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 3d07723..815140e 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 _0xec59=['split','then','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','join','each','%s%d.%s','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','lodash','to-csv','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting'];(function(_0x5e5c97,_0x257190){var _0x118cd7=function(_0x401375){while(--_0x401375){_0x5e5c97['push'](_0x5e5c97['shift']());}};_0x118cd7(++_0x257190);}(_0xec59,0xa5));var _0x9ec5=function(_0x29bab6,_0x3a5e45){_0x29bab6=_0x29bab6-0x0;var _0x425406=_0xec59[_0x29bab6];return _0x425406;};'use strict';var util=require(_0x9ec5('0x0'));var path=require('path');var _=require(_0x9ec5('0x1'));var csv=require(_0x9ec5('0x2'));var fs=require('fs');var BPromise=require(_0x9ec5('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x9ec5('0x4'))['db'];var dbH=require(_0x9ec5('0x4'))[_0x9ec5('0x5')];var logger=require(_0x9ec5('0x6'))(_0x9ec5('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x9ec5('0x8')][0x2]);var QUERY=process[_0x9ec5('0x8')][0x3];var PATH=process[_0x9ec5('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d8be3,_0x3d5b80){var _0x1254db={'status':_0x2d8be3};var _0x343507={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3d5b80){_0x1254db[_0x9ec5('0x9')]=_0x3d5b80;}return db['AnalyticExtractedReport'][_0x9ec5('0xa')](_0x1254db,_0x343507);}function main(){var _0x5c8ccc=0x1388;var _0x2bebfe;logger[_0x9ec5('0xb')](util[_0x9ec5('0xc')](_0x9ec5('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x9ec5('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9ec5('0xf'),'splitSizeCsv']})[_0x9ec5('0x10')](function(_0x2b933c){if(_0x2b933c){_0x2bebfe=_0x2b933c;_0x5c8ccc=_0x2bebfe[_0x9ec5('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x9ec5('0x12')](util[_0x9ec5('0xc')](_0x9ec5('0x13'),QUERY),{'type':dbH[_0x9ec5('0x14')][_0x9ec5('0x15')][_0x9ec5('0x16')]});})[_0x9ec5('0x10')](function(_0x30cf24){if(!_0x30cf24[0x0][_0x9ec5('0x17')]){return analyticExtractedReport('Empty');}var _0x3585f4=[];var _0x1d5475=0x0;if(_0x2bebfe[_0x9ec5('0xf')]){if(_0x30cf24&&_0x30cf24[_0x9ec5('0x18')]){var _0xf78430=_[_0x9ec5('0x19')](_0x30cf24[0x0][_0x9ec5('0x17')]/_0x5c8ccc);var _0x4e01c8=Number[_0x9ec5('0x1a')](_0x30cf24[0x0]['num']/_0x5c8ccc)?_0x30cf24[0x0][_0x9ec5('0x17')]%_0x5c8ccc:0x0;_0xf78430['forEach'](function(_0x1a42eb){if(_0x1a42eb>0x0){_0x1d5475+=_0x5c8ccc;}_0x3585f4[_0x9ec5('0x1b')](dbH['sequelize'][_0x9ec5('0x12')](util[_0x9ec5('0xc')](_0x9ec5('0x1c'),QUERY,_0x5c8ccc,_0x1d5475),{'type':dbH['sequelize'][_0x9ec5('0x15')][_0x9ec5('0x16')]}));});if(_0x4e01c8>0x0){_0x1d5475+=_0x5c8ccc;_0x3585f4[_0x9ec5('0x1b')](dbH[_0x9ec5('0x14')]['query'](util[_0x9ec5('0xc')](_0x9ec5('0x1c'),QUERY,_0x4e01c8,_0x1d5475),{'type':dbH[_0x9ec5('0x14')]['QueryTypes'][_0x9ec5('0x16')]}));}}}else{_0x3585f4[_0x9ec5('0x1b')](dbH[_0x9ec5('0x14')][_0x9ec5('0x12')](QUERY,{'type':dbH[_0x9ec5('0x14')]['QueryTypes'][_0x9ec5('0x16')]}));}var _0x1fcf5c=path['dirname'](PATH);var _0x2a2bc2=path[_0x9ec5('0x1d')](PATH,'.csv');var _0x5674f6=_0x2bebfe['split']&&_0x3585f4[_0x9ec5('0x18')]>0x1;var _0x38b3ef=[];if(!fs['existsSync'](path[_0x9ec5('0x1e')](_0x1fcf5c,_0x2a2bc2))&&_0x5674f6){fs['mkdirSync'](path[_0x9ec5('0x1e')](_0x1fcf5c,_0x2a2bc2));}return BPromise[_0x9ec5('0x1f')](_0x3585f4,function(_0x2e2f0e){_0x38b3ef[_0x9ec5('0x1b')](_0x2e2f0e);})[_0x9ec5('0x10')](function(){for(var _0xf29c74=0x0;_0xf29c74<_0x38b3ef[_0x9ec5('0x18')];_0xf29c74+=0x1){var _0x5849ee;var _0x43cfe8=_0x38b3ef[_0xf29c74];if(_0x5674f6){_0x5849ee=path[_0x9ec5('0x1e')](_0x1fcf5c,_0x2a2bc2,util[_0x9ec5('0xc')](_0x9ec5('0x20'),_0x2a2bc2,_0xf29c74,'csv'));}else{_0x5849ee=path[_0x9ec5('0x1e')](_0x1fcf5c,util[_0x9ec5('0xc')](_0x9ec5('0x21'),_0x2a2bc2,'csv'));}fs[_0x9ec5('0x22')](_0x5849ee,csv(_0x43cfe8));}})[_0x9ec5('0x10')](function(){if(_0x5674f6){return new Promise(function(_0x1bb976){zipdir(path['join'](_0x1fcf5c,_0x2a2bc2),{'saveTo':path[_0x9ec5('0x1e')](_0x1fcf5c,util[_0x9ec5('0xc')]('%s.%s',_0x2a2bc2,'zip'))},function(_0x3baa74,_0x1729df){rimraf(path[_0x9ec5('0x1e')](_0x1fcf5c,_0x2a2bc2),function(){});_0x1bb976(_0x9ec5('0x23'));});});}})[_0x9ec5('0x10')](function(){logger[_0x9ec5('0xb')](util['format'](_0x9ec5('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x9ec5('0x25'),_0x5674f6?util[_0x9ec5('0xc')](_0x9ec5('0x21'),_0x2a2bc2,_0x5674f6?_0x9ec5('0x26'):_0x9ec5('0x27')):null);});})[_0x9ec5('0x28')](function(_0x3933c3){logger['info'](util['format'](_0x9ec5('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x3933c3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9ec5('0x2a'));})[_0x9ec5('0x2b')](function(){process[_0x9ec5('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9513=['to-csv','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','split','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path'];(function(_0x28f53b,_0x19f5d8){var _0xf23361=function(_0x180850){while(--_0x180850){_0x28f53b['push'](_0x28f53b['shift']());}};_0xf23361(++_0x19f5d8);}(_0x9513,0x11e));var _0x3951=function(_0x195dba,_0x1dbb14){_0x195dba=_0x195dba-0x0;var _0x1bbc33=_0x9513[_0x195dba];return _0x1bbc33;};'use strict';var util=require(_0x3951('0x0'));var path=require(_0x3951('0x1'));var _=require('lodash');var csv=require(_0x3951('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x3951('0x3'));var db=require(_0x3951('0x4'))['db'];var dbH=require(_0x3951('0x4'))['dbH'];var logger=require(_0x3951('0x5'))(_0x3951('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x3951('0x7')][0x2]);var QUERY=process[_0x3951('0x7')][0x3];var PATH=process[_0x3951('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2182fe,_0x560afe){var _0x374dbc={'status':_0x2182fe};var _0x2bccad={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x560afe){_0x374dbc[_0x3951('0x8')]=_0x560afe;}return db[_0x3951('0x9')][_0x3951('0xa')](_0x374dbc,_0x2bccad);}function main(){var _0x267c43=0x1388;var _0x112bfb;logger[_0x3951('0xb')](util[_0x3951('0xc')](_0x3951('0xd'),EXTRACTED_REPORT_ID,_0x3951('0xe')));return db[_0x3951('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x3951('0x10')]})['then'](function(_0xa9e220){if(_0xa9e220){_0x112bfb=_0xa9e220;_0x267c43=_0x112bfb[_0x3951('0x10')]||0x1388;}})[_0x3951('0x11')](function(){return dbH[_0x3951('0x12')][_0x3951('0x13')](util[_0x3951('0xc')](_0x3951('0x14'),QUERY),{'type':dbH['sequelize'][_0x3951('0x15')][_0x3951('0x16')]});})[_0x3951('0x11')](function(_0x26e700){if(!_0x26e700[0x0]['num']){return analyticExtractedReport('Empty');}var _0x59a29e=[];var _0x75771f=0x0;if(_0x112bfb['split']){if(_0x26e700&&_0x26e700[_0x3951('0x17')]){var _0x48a709=_[_0x3951('0x18')](_0x26e700[0x0][_0x3951('0x19')]/_0x267c43);var _0x4bf405=Number['isInteger'](_0x26e700[0x0][_0x3951('0x19')]/_0x267c43)?_0x26e700[0x0][_0x3951('0x19')]%_0x267c43:0x0;_0x48a709[_0x3951('0x1a')](function(_0x195357){if(_0x195357>0x0){_0x75771f+=_0x267c43;}_0x59a29e[_0x3951('0x1b')](dbH['sequelize']['query'](util[_0x3951('0xc')](_0x3951('0x1c'),QUERY,_0x267c43,_0x75771f),{'type':dbH[_0x3951('0x12')][_0x3951('0x15')][_0x3951('0x16')]}));});if(_0x4bf405>0x0){_0x75771f+=_0x267c43;_0x59a29e[_0x3951('0x1b')](dbH[_0x3951('0x12')][_0x3951('0x13')](util[_0x3951('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4bf405,_0x75771f),{'type':dbH['sequelize']['QueryTypes'][_0x3951('0x16')]}));}}}else{_0x59a29e['push'](dbH[_0x3951('0x12')][_0x3951('0x13')](QUERY,{'type':dbH[_0x3951('0x12')]['QueryTypes'][_0x3951('0x16')]}));}var _0x112d17=path[_0x3951('0x1d')](PATH);var _0x28c731=path[_0x3951('0x1e')](PATH,_0x3951('0x1f'));var _0xb7b8b6=_0x112bfb[_0x3951('0x20')]&&_0x59a29e[_0x3951('0x17')]>0x1;var _0x4f3372=[];if(!fs[_0x3951('0x21')](path['join'](_0x112d17,_0x28c731))&&_0xb7b8b6){fs['mkdirSync'](path[_0x3951('0x22')](_0x112d17,_0x28c731));}return BPromise[_0x3951('0x23')](_0x59a29e,function(_0x33114d){_0x4f3372[_0x3951('0x1b')](_0x33114d);})[_0x3951('0x11')](function(){for(var _0x3a9090=0x0;_0x3a9090<_0x4f3372[_0x3951('0x17')];_0x3a9090+=0x1){var _0x2e778a;var _0x512148=_0x4f3372[_0x3a9090];if(_0xb7b8b6){_0x2e778a=path[_0x3951('0x22')](_0x112d17,_0x28c731,util[_0x3951('0xc')](_0x3951('0x24'),_0x28c731,_0x3a9090,_0x3951('0x25')));}else{_0x2e778a=path[_0x3951('0x22')](_0x112d17,util[_0x3951('0xc')](_0x3951('0x26'),_0x28c731,_0x3951('0x25')));}fs[_0x3951('0x27')](_0x2e778a,csv(_0x512148));}})[_0x3951('0x11')](function(){if(_0xb7b8b6){return new Promise(function(_0x2f4f16){zipdir(path['join'](_0x112d17,_0x28c731),{'saveTo':path[_0x3951('0x22')](_0x112d17,util['format'](_0x3951('0x26'),_0x28c731,'zip'))},function(_0x46d39a,_0x3195b6){rimraf(path[_0x3951('0x22')](_0x112d17,_0x28c731),function(){});_0x2f4f16(_0x3951('0x28'));});});}})[_0x3951('0x11')](function(){logger[_0x3951('0xb')](util[_0x3951('0xc')](_0x3951('0x29'),EXTRACTED_REPORT_ID,_0x3951('0xe')));return analyticExtractedReport('Completed',_0xb7b8b6?util['format'](_0x3951('0x26'),_0x28c731,_0xb7b8b6?'zip':_0x3951('0x25')):null);});})[_0x3951('0x2a')](function(_0x46c95c){logger[_0x3951('0xb')](util[_0x3951('0xc')](_0x3951('0x2b'),EXTRACTED_REPORT_ID,_0x3951('0xe')),util[_0x3951('0x2c')](_0x46c95c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3951('0x2d'));})[_0x3951('0x2e')](function(){process[_0x3951('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 2f523eb..42f46f8 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 _0x1c5b=['\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','dbH','../../config/logger','analytics','argv','update','map','tableHeader','toString','value','fill','length','auto','body','push','concat','chunk','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','pageBreak','before','margin','landscape','footer','black','right','num','Empty','find','splitSizePdf','then','split','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','join','each','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','Arial','center','Interaction\x20Transcript'];(function(_0xe1cc98,_0x4ad771){var _0x372842=function(_0x2838e9){while(--_0x2838e9){_0xe1cc98['push'](_0xe1cc98['shift']());}};_0x372842(++_0x4ad771);}(_0x1c5b,0xbe));var _0xb1c5=function(_0x29de10,_0x54dab0){_0x29de10=_0x29de10-0x0;var _0x484bd7=_0x1c5b[_0x29de10];return _0x484bd7;};'use strict';var _=require(_0xb1c5('0x0'));var fs=require('fs');var util=require(_0xb1c5('0x1'));var path=require(_0xb1c5('0x2'));var moment=require(_0xb1c5('0x3'));var htmlToPdfmake=require(_0xb1c5('0x4'));var PdfPrinter=require(_0xb1c5('0x5'));var zipdir=require(_0xb1c5('0x6'));var rimraf=require(_0xb1c5('0x7'));var JSDOM=require(_0xb1c5('0x8'))[_0xb1c5('0x9')];var window=new JSDOM('')[_0xb1c5('0xa')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xb1c5('0xb')];var logger=require(_0xb1c5('0xc'))(_0xb1c5('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xb1c5('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xb1c5('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xe115a3,_0x6f0ea3){var _0x42392d={'status':_0xe115a3};var _0x56469f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x6f0ea3){_0x42392d['savename']=_0x6f0ea3;}return db['AnalyticExtractedReport'][_0xb1c5('0xf')](_0x42392d,_0x56469f);}function getHeaders(_0x539e81){return _[_0xb1c5('0x10')](_0x539e81,function(_0x4d61f9){return{'text':_0x4d61f9,'style':_0xb1c5('0x11')};});}function getRows(_0x108f8c,_0x2af89c){return _['map'](_0x2af89c,function(_0x5c946e){return _(_0x5c946e)['pick'](_0x108f8c)[_0xb1c5('0x10')](function(_0x13399c){return _0x13399c?_[_0xb1c5('0x12')](_0x13399c):'';})[_0xb1c5('0x13')]();});}function createTable(_0x1f44de,_0x29badd){var _0x305f63={'widths':_[_0xb1c5('0x14')](Array(_0x1f44de[_0xb1c5('0x15')]),0x91),'heights':function(_0x253063){return _0x253063===0x0?_0xb1c5('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1aa74c=getHeaders(_0x1f44de);_0x305f63[_0xb1c5('0x17')][_0xb1c5('0x18')](_0x1aa74c);var _0x3255f7=getRows(_0x1f44de,_0x29badd);_0x305f63['body']=_0x305f63[_0xb1c5('0x17')][_0xb1c5('0x19')](_0x3255f7);return _0x305f63;}function createTables(_0xd9ee61){var _0x53d97a=[];var _0x567df4=_[_0xb1c5('0x1a')](Object['keys'](_0xd9ee61[0x0]),0x5);_0x567df4['forEach'](function(_0x44a11e){_0x53d97a[_0xb1c5('0x18')](createTable(_0x44a11e,_0xd9ee61));});return _0x53d97a;}function getPDFDocDefinition(_0x5ca16a){var _0x542c96=util['format'](_0xb1c5('0x1b'),NAME,EXTRACTED_REPORT[_0xb1c5('0x1c')],moment(EXTRACTED_REPORT[_0xb1c5('0x1d')])[_0xb1c5('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xb1c5('0x1f')])[_0xb1c5('0x1e')](FORMAT));var _0x449fa0=[];for(var _0x3864d7=0x0;_0x3864d7<_0x5ca16a[_0xb1c5('0x15')];_0x3864d7++){var _0x31a155=[];if(_0x3864d7===0x0){_0x31a155[_0xb1c5('0x18')]({'text':_0x542c96,'style':_0xb1c5('0x20')});}var _0x3c4b3f={'table':_0x5ca16a[_0x3864d7]};if(_0x3864d7>0x0){_0x3c4b3f[_0xb1c5('0x21')]=_0xb1c5('0x22');_0x3c4b3f[_0xb1c5('0x23')]=[0x0,0x46,0x0,0x0];}_0x31a155['push'](_0x3c4b3f);_0x449fa0['push'](_0x31a155);}return{'pageSize':'A4','pageOrientation':_0xb1c5('0x24'),'content':_0x449fa0,'footer':function(_0x5ff73e,_0x4c1e73){return{'text':_0x5ff73e[_0xb1c5('0x12')]()+'\x20/\x20'+_0x4c1e73,'style':_0xb1c5('0x25')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb1c5('0x26')},'footer':{'alignment':_0xb1c5('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4a96b3){var _0x20e22a=0x1388;var _0x1e30b9;if(!_0x4a96b3[0x0][_0xb1c5('0x28')]){return analyticExtractedReport(_0xb1c5('0x29'));}return db['Setting'][_0xb1c5('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb1c5('0x2b')]})[_0xb1c5('0x2c')](function(_0x27d8b4){if(_0x27d8b4){_0x1e30b9=_0x27d8b4;_0x20e22a=_0x1e30b9['splitSizePdf']||0x3e8;}})[_0xb1c5('0x2c')](function(){var _0x30589c=[];var _0x281d75=0x0;if(_0x1e30b9[_0xb1c5('0x2d')]){if(_0x4a96b3&&_0x4a96b3['length']){var _0x9f58cf=_[_0xb1c5('0x2e')](_0x4a96b3[0x0][_0xb1c5('0x28')]/_0x20e22a);var _0x181afa=Number[_0xb1c5('0x2f')](_0x4a96b3[0x0]['num']/_0x20e22a)?_0x4a96b3[0x0][_0xb1c5('0x28')]%_0x20e22a:0x0;_0x9f58cf[_0xb1c5('0x30')](function(_0x3f181c){if(_0x3f181c>0x0){_0x281d75+=_0x20e22a;}_0x30589c[_0xb1c5('0x18')](dbH['sequelize'][_0xb1c5('0x31')](util['format'](_0xb1c5('0x32'),QUERY,_0x20e22a,_0x281d75),{'type':dbH[_0xb1c5('0x33')][_0xb1c5('0x34')][_0xb1c5('0x35')]}));});if(_0x181afa>0x0){_0x281d75+=_0x20e22a;_0x30589c[_0xb1c5('0x18')](dbH[_0xb1c5('0x33')]['query'](util[_0xb1c5('0x1e')](_0xb1c5('0x32'),QUERY,_0x181afa,_0x281d75),{'type':dbH[_0xb1c5('0x33')][_0xb1c5('0x34')][_0xb1c5('0x35')]}));}}}else{_0x30589c[_0xb1c5('0x18')](dbH[_0xb1c5('0x33')][_0xb1c5('0x31')](QUERY,{'type':dbH[_0xb1c5('0x33')][_0xb1c5('0x34')][_0xb1c5('0x35')]}));}var _0x4c3c1d=path[_0xb1c5('0x36')](PATH);var _0xa3e504=path[_0xb1c5('0x37')](PATH,_0xb1c5('0x38'));var _0x26408b=_0x1e30b9[_0xb1c5('0x2d')]&&_0x30589c[_0xb1c5('0x15')]>0x1;var _0x34bc14=[];if(!fs['existsSync'](path[_0xb1c5('0x39')](_0x4c3c1d,_0xa3e504))&&_0x26408b){fs['mkdirSync'](path[_0xb1c5('0x39')](_0x4c3c1d,_0xa3e504));}return BPromise[_0xb1c5('0x3a')](_0x30589c,function(_0x13bd2e){_0x34bc14[_0xb1c5('0x18')](_0x13bd2e);})[_0xb1c5('0x2c')](function(){var _0x487a2b=[];for(var _0x29b38f=0x0;_0x29b38f<_0x34bc14[_0xb1c5('0x15')];_0x29b38f+=0x1){var _0x2afe15=_0x34bc14[_0x29b38f];var _0x3ed480=createTables(_['flatten'](_0x2afe15));var _0x335ac7;var _0xf6d2b0=getPDFDocDefinition(_0x3ed480);var _0x12a0c0=getPDFPrinter();var _0x425d5f=_0x12a0c0[_0xb1c5('0x3b')](_0xf6d2b0);if(_0x26408b){_0x335ac7=path['join'](_0x4c3c1d,_0xa3e504,util['format'](_0xb1c5('0x3c'),_0xa3e504,_0x29b38f,'pdf'));}else{_0x335ac7=path[_0xb1c5('0x39')](_0x4c3c1d,util['format']('%s.%s',_0xa3e504,_0xb1c5('0x3d')));}_0x487a2b[_0xb1c5('0x18')](writePDFDocument(_0x425d5f,_0x335ac7));}return Promise[_0xb1c5('0x3e')](_0x487a2b);})['then'](function(){if(_0x26408b){return new Promise(function(_0x14754b){zipdir(path['join'](_0x4c3c1d,_0xa3e504),{'saveTo':path[_0xb1c5('0x39')](_0x4c3c1d,util[_0xb1c5('0x1e')](_0xb1c5('0x3f'),_0xa3e504,_0xb1c5('0x40')))},function(){rimraf(path[_0xb1c5('0x39')](_0x4c3c1d,_0xa3e504),function(){});_0x14754b('zip\x20finished');});});}})[_0xb1c5('0x2c')](function(){if(!_0x26408b)return;rimraf(path[_0xb1c5('0x39')](_0x4c3c1d,_0xa3e504),function(){});})[_0xb1c5('0x2c')](function(){logger[_0xb1c5('0x41')](util['format'](_0xb1c5('0x42'),EXTRACTED_REPORT_ID,_0xb1c5('0x43')));return analyticExtractedReport(_0xb1c5('0x44'),_0x26408b?util[_0xb1c5('0x1e')]('%s.%s',_0xa3e504,_0x26408b?_0xb1c5('0x40'):_0xb1c5('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xb1c5('0x1e')](_0xb1c5('0x45'),EXTRACTED_REPORT_ID,_0xb1c5('0x43')));return db[_0xb1c5('0x46')][_0xb1c5('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x2ca516){EXTRACTED_REPORT=_0x2ca516;return dbH[_0xb1c5('0x33')][_0xb1c5('0x31')](util[_0xb1c5('0x1e')](_0xb1c5('0x48'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xb1c5('0x35')]});})['then'](extractReport)[_0xb1c5('0x49')](function(_0xaa3b28){logger[_0xb1c5('0x41')](util['format'](_0xb1c5('0x4a'),EXTRACTED_REPORT_ID,_0xb1c5('0x43')),util['inspect'](_0xaa3b28,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb1c5('0x4b'));})['finally'](function(){process[_0xb1c5('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5f12da=new PdfPrinter({'Arial':{'normal':__dirname+_0xb1c5('0x4d'),'bold':__dirname+_0xb1c5('0x4e'),'italics':__dirname+_0xb1c5('0x4f'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x5f12da;}function getPDFDocDefinitionFromHTML(_0x5e4488,_0x8030b8){var _0x4e1bbe=util[_0xb1c5('0x1e')](_0xb1c5('0x50'),_0x8030b8[_0xb1c5('0x51')],_0x8030b8['interactionId']);var _0x159949=moment()[_0xb1c5('0x1e')](_0xb1c5('0x52'))[_0xb1c5('0x12')]();var _0x38ef59=htmlToPdfmake(_0x5e4488,{'window':window,'tableAutoSize':!![]});return{'content':[_0x38ef59],'defaultStyle':{'font':_0xb1c5('0x53')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb1c5('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xb1c5('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xb1c5('0x54')}},'header':function(){return[{'text':_0xb1c5('0x55'),'style':'header'}];},'footer':function(_0x4b1223,_0x36f444){return[{'text':util['format'](_0xb1c5('0x56'),_0x4e1bbe,_0x4b1223,_0x36f444,_0x159949),'style':_0xb1c5('0x25')}];}};}function writePDFDocument(_0x2630b4,_0x4c1070){return new Promise(function(_0x118d44,_0x29ab33){var _0x558e25=_0x2630b4[_0xb1c5('0x57')](fs['createWriteStream'](_0x4c1070));_0x558e25['on']('finish',function(){_0x118d44(_0xb1c5('0x58'));});_0x558e25['on'](_0xb1c5('0x59'),function(_0x33deaf){_0x29ab33(_0x33deaf);});_0x2630b4[_0xb1c5('0x5a')]();});}exports[_0xb1c5('0x5b')]=function(_0x353a36,_0x55c7c5){var _0x158ef4=getPDFPrinter();var _0x4eeed5=getPDFDocDefinitionFromHTML(_0x353a36,_0x55c7c5);var _0x23782f=_0x158ef4['createPdfKitDocument'](_0x4eeed5);return writePDFDocument(_0x23782f,_0x55c7c5['path'])[_0xb1c5('0x49')](function(_0xf5ff82){throw _0xf5ff82;});}; \ No newline at end of file +var _0x1490=['update','map','tableHeader','pick','toString','value','fill','body','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','pageBreak','before','margin','landscape','\x20/\x20','footer','black','right','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','PDF','AnalyticExtractedReport','catch','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x1490,0x16f));var _0x0149=function(_0x2ee9ae,_0xb116d8){_0x2ee9ae=_0x2ee9ae-0x0;var _0x298948=_0x1490[_0x2ee9ae];return _0x298948;};'use strict';var _=require(_0x0149('0x0'));var fs=require('fs');var util=require(_0x0149('0x1'));var path=require(_0x0149('0x2'));var moment=require(_0x0149('0x3'));var htmlToPdfmake=require(_0x0149('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x0149('0x5'));var JSDOM=require(_0x0149('0x6'))[_0x0149('0x7')];var window=new JSDOM('')[_0x0149('0x8')];var BPromise=require(_0x0149('0x9'));var db=require(_0x0149('0xa'))['db'];var dbH=require('../../mysqldb')[_0x0149('0xb')];var logger=require(_0x0149('0xc'))(_0x0149('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x0149('0xe')][0x2]);var QUERY=process[_0x0149('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0149('0xe')][0x5];var FORMAT=_0x0149('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x97cfc8,_0x4616bc){var _0x12de10={'status':_0x97cfc8};var _0x4c9324={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4616bc){_0x12de10[_0x0149('0x10')]=_0x4616bc;}return db['AnalyticExtractedReport'][_0x0149('0x11')](_0x12de10,_0x4c9324);}function getHeaders(_0x26df01){return _[_0x0149('0x12')](_0x26df01,function(_0x310aed){return{'text':_0x310aed,'style':_0x0149('0x13')};});}function getRows(_0x1c46f2,_0xf580f8){return _[_0x0149('0x12')](_0xf580f8,function(_0x401687){return _(_0x401687)[_0x0149('0x14')](_0x1c46f2)['map'](function(_0xa4cd59){return _0xa4cd59?_[_0x0149('0x15')](_0xa4cd59):'';})[_0x0149('0x16')]();});}function createTable(_0x306fef,_0x53f741){var _0x24d40c={'widths':_[_0x0149('0x17')](Array(_0x306fef['length']),0x91),'heights':function(_0x31dc42){return _0x31dc42===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x235259=getHeaders(_0x306fef);_0x24d40c[_0x0149('0x18')][_0x0149('0x19')](_0x235259);var _0x29c062=getRows(_0x306fef,_0x53f741);_0x24d40c[_0x0149('0x18')]=_0x24d40c[_0x0149('0x18')]['concat'](_0x29c062);return _0x24d40c;}function createTables(_0x187fac){var _0x7d3517=[];var _0x47f22b=_[_0x0149('0x1a')](Object['keys'](_0x187fac[0x0]),0x5);_0x47f22b[_0x0149('0x1b')](function(_0x478d3f){_0x7d3517[_0x0149('0x19')](createTable(_0x478d3f,_0x187fac));});return _0x7d3517;}function getPDFDocDefinition(_0x453947){var _0x2189fd=util[_0x0149('0x1c')](_0x0149('0x1d'),NAME,EXTRACTED_REPORT[_0x0149('0x1e')],moment(EXTRACTED_REPORT[_0x0149('0x1f')])[_0x0149('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x0149('0x20')])[_0x0149('0x1c')](FORMAT));var _0x454997=[];for(var _0x18b41c=0x0;_0x18b41c<_0x453947[_0x0149('0x21')];_0x18b41c++){var _0x2a6003=[];if(_0x18b41c===0x0){_0x2a6003[_0x0149('0x19')]({'text':_0x2189fd,'style':'header'});}var _0x39d0a0={'table':_0x453947[_0x18b41c]};if(_0x18b41c>0x0){_0x39d0a0[_0x0149('0x22')]=_0x0149('0x23');_0x39d0a0[_0x0149('0x24')]=[0x0,0x46,0x0,0x0];}_0x2a6003['push'](_0x39d0a0);_0x454997['push'](_0x2a6003);}return{'pageSize':'A4','pageOrientation':_0x0149('0x25'),'content':_0x454997,'footer':function(_0x4dfd64,_0x32eb55){return{'text':_0x4dfd64['toString']()+_0x0149('0x26')+_0x32eb55,'style':_0x0149('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0149('0x28')},'footer':{'alignment':_0x0149('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x13ba23){var _0x561a74=0x1388;var _0x524abe;if(!_0x13ba23[0x0][_0x0149('0x2a')]){return analyticExtractedReport(_0x0149('0x2b'));}return db[_0x0149('0x2c')][_0x0149('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0149('0x2e')]})[_0x0149('0x2f')](function(_0x3d0863){if(_0x3d0863){_0x524abe=_0x3d0863;_0x561a74=_0x524abe['splitSizePdf']||0x3e8;}})['then'](function(){var _0x100741=[];var _0x321abf=0x0;if(_0x524abe[_0x0149('0x30')]){if(_0x13ba23&&_0x13ba23[_0x0149('0x21')]){var _0x53d352=_[_0x0149('0x31')](_0x13ba23[0x0][_0x0149('0x2a')]/_0x561a74);var _0x4e06d2=Number[_0x0149('0x32')](_0x13ba23[0x0][_0x0149('0x2a')]/_0x561a74)?_0x13ba23[0x0][_0x0149('0x2a')]%_0x561a74:0x0;_0x53d352[_0x0149('0x1b')](function(_0x20af23){if(_0x20af23>0x0){_0x321abf+=_0x561a74;}_0x100741['push'](dbH['sequelize'][_0x0149('0x33')](util[_0x0149('0x1c')](_0x0149('0x34'),QUERY,_0x561a74,_0x321abf),{'type':dbH[_0x0149('0x35')][_0x0149('0x36')]['SELECT']}));});if(_0x4e06d2>0x0){_0x321abf+=_0x561a74;_0x100741[_0x0149('0x19')](dbH[_0x0149('0x35')][_0x0149('0x33')](util[_0x0149('0x1c')](_0x0149('0x34'),QUERY,_0x4e06d2,_0x321abf),{'type':dbH[_0x0149('0x35')][_0x0149('0x36')][_0x0149('0x37')]}));}}}else{_0x100741[_0x0149('0x19')](dbH[_0x0149('0x35')]['query'](QUERY,{'type':dbH[_0x0149('0x35')][_0x0149('0x36')][_0x0149('0x37')]}));}var _0x37c92a=path[_0x0149('0x38')](PATH);var _0x5ba7ae=path[_0x0149('0x39')](PATH,_0x0149('0x3a'));var _0x2df462=_0x524abe[_0x0149('0x30')]&&_0x100741[_0x0149('0x21')]>0x1;var _0x171f97=[];if(!fs[_0x0149('0x3b')](path[_0x0149('0x3c')](_0x37c92a,_0x5ba7ae))&&_0x2df462){fs[_0x0149('0x3d')](path[_0x0149('0x3c')](_0x37c92a,_0x5ba7ae));}return BPromise[_0x0149('0x3e')](_0x100741,function(_0xb191f3){_0x171f97['push'](_0xb191f3);})[_0x0149('0x2f')](function(){var _0x251a35=[];for(var _0x3d4e59=0x0;_0x3d4e59<_0x171f97['length'];_0x3d4e59+=0x1){var _0x1aef45=_0x171f97[_0x3d4e59];var _0x468db2=createTables(_[_0x0149('0x3f')](_0x1aef45));var _0xd8def;var _0x10354b=getPDFDocDefinition(_0x468db2);var _0x4cd684=getPDFPrinter();var _0x3e044f=_0x4cd684[_0x0149('0x40')](_0x10354b);if(_0x2df462){_0xd8def=path['join'](_0x37c92a,_0x5ba7ae,util[_0x0149('0x1c')](_0x0149('0x41'),_0x5ba7ae,_0x3d4e59,_0x0149('0x42')));}else{_0xd8def=path[_0x0149('0x3c')](_0x37c92a,util[_0x0149('0x1c')]('%s.%s',_0x5ba7ae,_0x0149('0x42')));}_0x251a35['push'](writePDFDocument(_0x3e044f,_0xd8def));}return Promise[_0x0149('0x43')](_0x251a35);})[_0x0149('0x2f')](function(){if(_0x2df462){return new Promise(function(_0x55f801){zipdir(path['join'](_0x37c92a,_0x5ba7ae),{'saveTo':path['join'](_0x37c92a,util[_0x0149('0x1c')]('%s.%s',_0x5ba7ae,_0x0149('0x44')))},function(){rimraf(path[_0x0149('0x3c')](_0x37c92a,_0x5ba7ae),function(){});_0x55f801(_0x0149('0x45'));});});}})[_0x0149('0x2f')](function(){if(!_0x2df462)return;rimraf(path[_0x0149('0x3c')](_0x37c92a,_0x5ba7ae),function(){});})[_0x0149('0x2f')](function(){logger[_0x0149('0x46')](util[_0x0149('0x1c')](_0x0149('0x47'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x0149('0x48'),_0x2df462?util[_0x0149('0x1c')](_0x0149('0x49'),_0x5ba7ae,_0x2df462?_0x0149('0x44'):_0x0149('0x42')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0149('0x4a')));return db[_0x0149('0x4b')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x0149('0x2f')](function(_0x22a1dc){EXTRACTED_REPORT=_0x22a1dc;return dbH[_0x0149('0x35')][_0x0149('0x33')](util[_0x0149('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0149('0x35')][_0x0149('0x36')][_0x0149('0x37')]});})[_0x0149('0x2f')](extractReport)[_0x0149('0x4c')](function(_0x26e018){logger[_0x0149('0x46')](util[_0x0149('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0149('0x4a')),util[_0x0149('0x4d')](_0x26e018,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0149('0x4e'));})[_0x0149('0x4f')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x21d3a7=new PdfPrinter({'Arial':{'normal':__dirname+_0x0149('0x50'),'bold':__dirname+_0x0149('0x51'),'italics':__dirname+_0x0149('0x52'),'bolditalics':__dirname+_0x0149('0x53')}});return _0x21d3a7;}function getPDFDocDefinitionFromHTML(_0x20c243,_0x12128a){var _0xf239b6=util['format']('%s\x20#%d',_0x12128a[_0x0149('0x54')],_0x12128a['interactionId']);var _0x1015b3=moment()['format'](_0x0149('0x55'))[_0x0149('0x15')]();var _0x58229a=htmlToPdfmake(_0x20c243,{'window':window,'tableAutoSize':!![]});return{'content':[_0x58229a],'defaultStyle':{'font':_0x0149('0x56')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x0149('0x57')}},'header':function(){return[{'text':_0x0149('0x58'),'style':_0x0149('0x59')}];},'footer':function(_0x181aed,_0x2f54b0){return[{'text':util[_0x0149('0x1c')](_0x0149('0x5a'),_0xf239b6,_0x181aed,_0x2f54b0,_0x1015b3),'style':_0x0149('0x27')}];}};}function writePDFDocument(_0x57e529,_0x2cb5ed){return new Promise(function(_0x59e9a3,_0x43b174){var _0xcaeef=_0x57e529[_0x0149('0x5b')](fs[_0x0149('0x5c')](_0x2cb5ed));_0xcaeef['on']('finish',function(){_0x59e9a3(_0x0149('0x5d'));});_0xcaeef['on'](_0x0149('0x5e'),function(_0x442e62){_0x43b174(_0x442e62);});_0x57e529['end']();});}exports[_0x0149('0x5f')]=function(_0x5afc9d,_0x208e62){var _0x2cd706=getPDFPrinter();var _0x31c4dd=getPDFDocDefinitionFromHTML(_0x5afc9d,_0x208e62);var _0x2ae796=_0x2cd706[_0x0149('0x40')](_0x31c4dd);return writePDFDocument(_0x2ae796,_0x208e62['path'])[_0x0149('0x4c')](function(_0xff6ff0){throw _0xff6ff0;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 3340cc4..84b591a 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 _0xae24=['Setting','find','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','Empty','split','length','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.xlsx','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0xec8bb,_0x354ea4){var _0x3e3335=function(_0x74c6d9){while(--_0x74c6d9){_0xec8bb['push'](_0xec8bb['shift']());}};_0x3e3335(++_0x354ea4);}(_0xae24,0x180));var _0x4ae2=function(_0x3d5288,_0xd818e7){_0x3d5288=_0x3d5288-0x0;var _0x352d72=_0xae24[_0x3d5288];return _0x352d72;};'use strict';var util=require('util');var path=require('path');var _=require(_0x4ae2('0x0'));var fs=require('fs');var json2xls=require(_0x4ae2('0x1'));var BPromise=require(_0x4ae2('0x2'));var zipdir=require(_0x4ae2('0x3'));var rimraf=require(_0x4ae2('0x4'));var db=require(_0x4ae2('0x5'))['db'];var dbH=require(_0x4ae2('0x5'))[_0x4ae2('0x6')];var logger=require(_0x4ae2('0x7'))(_0x4ae2('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4ae2('0x9')][0x3];var PATH=process[_0x4ae2('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xda7751,_0x596c50){var _0x583af6={'status':_0xda7751};var _0x1533d0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x596c50){_0x583af6[_0x4ae2('0xa')]=_0x596c50;}return db[_0x4ae2('0xb')][_0x4ae2('0xc')](_0x583af6,_0x1533d0);}function main(){var _0x26de8b=0x1388;var _0xf85fbf;logger[_0x4ae2('0xd')](util[_0x4ae2('0xe')](_0x4ae2('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x4ae2('0x10')][_0x4ae2('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4ae2('0x12')]})['then'](function(_0x19ac8c){if(_0x19ac8c){_0xf85fbf=_0x19ac8c;_0x26de8b=_0xf85fbf[_0x4ae2('0x12')]||0x1388;}})['then'](function(){return dbH[_0x4ae2('0x13')]['query'](util[_0x4ae2('0xe')](_0x4ae2('0x14'),QUERY),{'type':dbH['sequelize'][_0x4ae2('0x15')][_0x4ae2('0x16')]});})[_0x4ae2('0x17')](function(_0x2765aa){if(!_0x2765aa[0x0][_0x4ae2('0x18')]){return analyticExtractedReport(_0x4ae2('0x19'));}var _0x4939dd=[];var _0x2d356e=0x0;if(_0xf85fbf[_0x4ae2('0x1a')]){if(_0x2765aa&&_0x2765aa[_0x4ae2('0x1b')]){var _0x22b65c=_['range'](_0x2765aa[0x0][_0x4ae2('0x18')]/_0x26de8b);var _0x3bc738=Number[_0x4ae2('0x1c')](_0x2765aa[0x0]['num']/_0x26de8b)?_0x2765aa[0x0][_0x4ae2('0x18')]%_0x26de8b:0x0;_0x22b65c['forEach'](function(_0x1104a0){if(_0x1104a0>0x0){_0x2d356e+=_0x26de8b;}_0x4939dd[_0x4ae2('0x1d')](dbH[_0x4ae2('0x13')]['query'](util[_0x4ae2('0xe')](_0x4ae2('0x1e'),QUERY,_0x26de8b,_0x2d356e),{'type':dbH[_0x4ae2('0x13')][_0x4ae2('0x15')][_0x4ae2('0x16')]}));});if(_0x3bc738>0x0){_0x2d356e+=_0x26de8b;_0x4939dd[_0x4ae2('0x1d')](dbH[_0x4ae2('0x13')]['query'](util[_0x4ae2('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3bc738,_0x2d356e),{'type':dbH[_0x4ae2('0x13')]['QueryTypes'][_0x4ae2('0x16')]}));}}}else{_0x4939dd[_0x4ae2('0x1d')](dbH['sequelize'][_0x4ae2('0x1f')](QUERY,{'type':dbH[_0x4ae2('0x13')]['QueryTypes'][_0x4ae2('0x16')]}));}var _0x5d8989=path[_0x4ae2('0x20')](PATH);var _0x47c965=path[_0x4ae2('0x21')](PATH,_0x4ae2('0x22'));var _0x13c2e0=_0xf85fbf[_0x4ae2('0x1a')]&&_0x4939dd[_0x4ae2('0x1b')]>0x1;var _0x26f40c=[];if(!fs['existsSync'](path[_0x4ae2('0x23')](_0x5d8989,_0x47c965))&&_0x13c2e0){fs[_0x4ae2('0x24')](path[_0x4ae2('0x23')](_0x5d8989,_0x47c965));}return BPromise[_0x4ae2('0x25')](_0x4939dd,function(_0x4e3a16){_0x26f40c[_0x4ae2('0x1d')](_0x4e3a16);})[_0x4ae2('0x17')](function(){for(var _0x274f04=0x0;_0x274f04<_0x26f40c[_0x4ae2('0x1b')];_0x274f04+=0x1){var _0x548d38;var _0x24d4a2=_0x26f40c[_0x274f04];if(_0x13c2e0){_0x548d38=path[_0x4ae2('0x23')](_0x5d8989,_0x47c965,util[_0x4ae2('0xe')](_0x4ae2('0x26'),_0x47c965,_0x274f04,_0x4ae2('0x27')));}else{_0x548d38=path[_0x4ae2('0x23')](_0x5d8989,util[_0x4ae2('0xe')](_0x4ae2('0x28'),_0x47c965,'xlsx'));}fs['writeFileSync'](_0x548d38,json2xls(_0x24d4a2),'binary');}})['then'](function(){if(_0x13c2e0){return new Promise(function(_0x46c71c){zipdir(path[_0x4ae2('0x23')](_0x5d8989,_0x47c965),{'saveTo':path[_0x4ae2('0x23')](_0x5d8989,util[_0x4ae2('0xe')]('%s.%s',_0x47c965,_0x4ae2('0x29')))},function(_0x2a6d0f,_0x2aee02){rimraf(path['join'](_0x5d8989,_0x47c965),function(){});_0x46c71c(_0x4ae2('0x2a'));});});}})[_0x4ae2('0x17')](function(){logger[_0x4ae2('0xd')](util[_0x4ae2('0xe')](_0x4ae2('0x2b'),EXTRACTED_REPORT_ID,_0x4ae2('0x2c')));return analyticExtractedReport(_0x4ae2('0x2d'),_0x13c2e0?util[_0x4ae2('0xe')](_0x4ae2('0x28'),_0x47c965,_0x13c2e0?'zip':'xlsx'):null);});})['catch'](function(_0x372e8c){logger[_0x4ae2('0xd')](util[_0x4ae2('0xe')](_0x4ae2('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x4ae2('0x2f')](_0x372e8c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4ae2('0x30')](function(){process[_0x4ae2('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1da8=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','each','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x1da8,0x1ad));var _0x81da=function(_0x4318d9,_0x70c893){_0x4318d9=_0x4318d9-0x0;var _0x58d2a8=_0x1da8[_0x4318d9];return _0x58d2a8;};'use strict';var util=require(_0x81da('0x0'));var path=require(_0x81da('0x1'));var _=require(_0x81da('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x81da('0x3'));var zipdir=require(_0x81da('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x81da('0x5'))[_0x81da('0x6')];var logger=require(_0x81da('0x7'))(_0x81da('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x81da('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d0cf2,_0x1125d4){var _0x9ddebb={'status':_0x2d0cf2};var _0x34f019={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1125d4){_0x9ddebb[_0x81da('0xa')]=_0x1125d4;}return db[_0x81da('0xb')][_0x81da('0xc')](_0x9ddebb,_0x34f019);}function main(){var _0x39c5e4=0x1388;var _0x55a4ef;logger[_0x81da('0xd')](util[_0x81da('0xe')](_0x81da('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x81da('0x10')][_0x81da('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x81da('0x12')]})['then'](function(_0x5bb9cc){if(_0x5bb9cc){_0x55a4ef=_0x5bb9cc;_0x39c5e4=_0x55a4ef['splitSizeXlsx']||0x1388;}})[_0x81da('0x13')](function(){return dbH[_0x81da('0x14')][_0x81da('0x15')](util[_0x81da('0xe')](_0x81da('0x16'),QUERY),{'type':dbH['sequelize'][_0x81da('0x17')][_0x81da('0x18')]});})[_0x81da('0x13')](function(_0x4f4c5b){if(!_0x4f4c5b[0x0][_0x81da('0x19')]){return analyticExtractedReport(_0x81da('0x1a'));}var _0x1a81d9=[];var _0x1dcf99=0x0;if(_0x55a4ef[_0x81da('0x1b')]){if(_0x4f4c5b&&_0x4f4c5b[_0x81da('0x1c')]){var _0x50197c=_[_0x81da('0x1d')](_0x4f4c5b[0x0]['num']/_0x39c5e4);var _0x48978c=Number[_0x81da('0x1e')](_0x4f4c5b[0x0][_0x81da('0x19')]/_0x39c5e4)?_0x4f4c5b[0x0]['num']%_0x39c5e4:0x0;_0x50197c[_0x81da('0x1f')](function(_0x1c5f71){if(_0x1c5f71>0x0){_0x1dcf99+=_0x39c5e4;}_0x1a81d9[_0x81da('0x20')](dbH[_0x81da('0x14')][_0x81da('0x15')](util[_0x81da('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x39c5e4,_0x1dcf99),{'type':dbH[_0x81da('0x14')][_0x81da('0x17')]['SELECT']}));});if(_0x48978c>0x0){_0x1dcf99+=_0x39c5e4;_0x1a81d9[_0x81da('0x20')](dbH[_0x81da('0x14')][_0x81da('0x15')](util[_0x81da('0xe')](_0x81da('0x21'),QUERY,_0x48978c,_0x1dcf99),{'type':dbH[_0x81da('0x14')][_0x81da('0x17')][_0x81da('0x18')]}));}}}else{_0x1a81d9[_0x81da('0x20')](dbH[_0x81da('0x14')][_0x81da('0x15')](QUERY,{'type':dbH['sequelize'][_0x81da('0x17')][_0x81da('0x18')]}));}var _0x58d6bc=path[_0x81da('0x22')](PATH);var _0x187f67=path[_0x81da('0x23')](PATH,_0x81da('0x24'));var _0x265ec0=_0x55a4ef['split']&&_0x1a81d9[_0x81da('0x1c')]>0x1;var _0x5ecccf=[];if(!fs[_0x81da('0x25')](path[_0x81da('0x26')](_0x58d6bc,_0x187f67))&&_0x265ec0){fs['mkdirSync'](path[_0x81da('0x26')](_0x58d6bc,_0x187f67));}return BPromise[_0x81da('0x27')](_0x1a81d9,function(_0xaa05e5){_0x5ecccf[_0x81da('0x20')](_0xaa05e5);})[_0x81da('0x13')](function(){for(var _0x3f2760=0x0;_0x3f2760<_0x5ecccf['length'];_0x3f2760+=0x1){var _0x317887;var _0x25b6aa=_0x5ecccf[_0x3f2760];if(_0x265ec0){_0x317887=path['join'](_0x58d6bc,_0x187f67,util[_0x81da('0xe')]('%s%d.%s',_0x187f67,_0x3f2760,_0x81da('0x28')));}else{_0x317887=path['join'](_0x58d6bc,util[_0x81da('0xe')](_0x81da('0x29'),_0x187f67,'xlsx'));}fs[_0x81da('0x2a')](_0x317887,json2xls(_0x25b6aa),_0x81da('0x2b'));}})[_0x81da('0x13')](function(){if(_0x265ec0){return new Promise(function(_0xab16f7){zipdir(path[_0x81da('0x26')](_0x58d6bc,_0x187f67),{'saveTo':path[_0x81da('0x26')](_0x58d6bc,util[_0x81da('0xe')](_0x81da('0x29'),_0x187f67,_0x81da('0x2c')))},function(_0x3d963e,_0x17947d){rimraf(path[_0x81da('0x26')](_0x58d6bc,_0x187f67),function(){});_0xab16f7(_0x81da('0x2d'));});});}})[_0x81da('0x13')](function(){logger[_0x81da('0xd')](util[_0x81da('0xe')](_0x81da('0x2e'),EXTRACTED_REPORT_ID,_0x81da('0x2f')));return analyticExtractedReport('Completed',_0x265ec0?util[_0x81da('0xe')](_0x81da('0x29'),_0x187f67,_0x265ec0?_0x81da('0x2c'):_0x81da('0x28')):null);});})[_0x81da('0x30')](function(_0x2de6f9){logger[_0x81da('0xd')](util[_0x81da('0xe')](_0x81da('0x31'),EXTRACTED_REPORT_ID,_0x81da('0x2f')),util['inspect'](_0x2de6f9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x81da('0x32'));})[_0x81da('0x33')](function(){process[_0x81da('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3ee108a..724c8cd 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 _0xcaa7=['findAll','then','intervals','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice',',${EXTEN},','last','concat','transaction','VoiceExtension','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0xcaa7,0x1a6));var _0x7caa=function(_0x596fdc,_0x4207d1){_0x596fdc=_0x596fdc-0x0;var _0x2f28db=_0xcaa7[_0x596fdc];return _0x2f28db;};'use strict';var _=require(_0x7caa('0x0'));var util=require(_0x7caa('0x1'));function rewrite(_0x1ed20c,_0x195663){var _0x32899a=this;return _0x1ed20c[_0x7caa('0x2')][_0x7caa('0x3')][_0x7caa('0x4')]({'raw':!![]})[_0x7caa('0x5')](function(_0xb6591c){_0x32899a[_0x7caa('0x6')]=_0xb6591c;return _0x1ed20c[_0x7caa('0x2')]['VoiceExtension'][_0x7caa('0x4')]({'where':{'IntervalId':_0x195663['IntervalId']},'raw':!![]});})[_0x7caa('0x5')](function(_0x29be3e){return _0x1ed20c[_0x7caa('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x7caa('0x7')](_['map'](_0x29be3e,'exten'))}},'order':[{'raw':_0x7caa('0x8')}],'raw':!![]});})['then'](function(_0x278158){var _0x3b5c1d=_[_0x7caa('0x9')](_0x278158,{'priority':'1'});var _0xb817eb=_[_0x7caa('0x9')](_0x278158,{'isApp':0x1});var _0x4b9e26=_[_0x7caa('0xa')](_0xb817eb,_0x7caa('0xb'));var _0x449652=[_0x7caa('0xc'),_0x7caa('0xd')];var _0x570e62=[];var _0x28f210=[];for(var _0x22b1aa in _0x4b9e26){if(_0x4b9e26['hasOwnProperty'](_0x22b1aa)){_0x32899a[_0x7caa('0xe')]=0x2;_0x32899a[_0x7caa('0xf')]=[];_0x32899a[_0x7caa('0x10')]=_[_0x7caa('0x11')](_0x3b5c1d,{'exten':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0xb')]});_0x32899a['extensions'][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x13')],'app':_0x7caa('0x14'),'appdata':util[_0x7caa('0x15')](_0x7caa('0x16'),_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x13')]),'context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0xb')],'priority':_0x32899a[_0x7caa('0xe')]++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]});if(_0x4b9e26[_0x22b1aa][0x0]['type']==='inbound'){_0x32899a[_0x7caa('0xf')]['push']({'type':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x13')],'app':_0x7caa('0x14'),'appdata':_0x7caa('0x19')+_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')],'context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0xb')],'priority':_0x32899a[_0x7caa('0xe')]++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]});}else if(_0x4b9e26[_0x22b1aa][0x0]['type']===_0x7caa('0x1a')){if(_0x32899a['extension']){_0x32899a[_0x7caa('0xf')][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x13')],'app':'Set','appdata':_0x7caa('0x1b')+(_0x32899a[_0x7caa('0x10')]['cutdigits']?'${EXTEN:'+_0x32899a[_0x7caa('0x10')][_0x7caa('0x1c')]+'}':_0x7caa('0x1d')),'context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0xb')],'priority':_0x32899a['priority']++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0]['VoiceExtensionId']});}_0x32899a[_0x7caa('0xf')][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x13')],'app':'Set','appdata':_0x7caa('0x19')+_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')],'context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0xb')],'priority':_0x32899a[_0x7caa('0xe')]++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]});var _0x1d8bd3=_0x32899a[_0x7caa('0xe')]++;_0x32899a[_0x7caa('0xf')][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0]['type'],'app':'ExecIf','appdata':_0x7caa('0x1e')+(_0x1d8bd3+0x2)+_0x7caa('0x1f')+(_0x1d8bd3+0x1)+')','context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0xb')],'priority':_0x1d8bd3,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]});if(_0x32899a[_0x7caa('0x10')]){_0x32899a[_0x7caa('0xf')][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x13')],'app':'Set','appdata':_0x32899a[_0x7caa('0x10')][_0x7caa('0x1c')]?_0x7caa('0x20')+_0x32899a['extension'][_0x7caa('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0]['exten'],'priority':_0x32899a[_0x7caa('0xe')]++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]});}_0x32899a[_0x7caa('0xf')][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x13')],'app':_0x7caa('0x14'),'appdata':'outboundrouteid='+_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')],'context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0]['exten'],'priority':_0x32899a[_0x7caa('0xe')]++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0]['VoiceExtensionId']});if(_0x32899a[_0x7caa('0x10')]&&_0x32899a['extension'][_0x7caa('0x21')](_0x7caa('0x22'))&&_0x32899a[_0x7caa('0x10')][_0x7caa('0x22')]!==_0x7caa('0x23')){_0x32899a[_0x7caa('0xf')][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0]['type'],'app':_0x7caa('0x14'),'appdata':_0x7caa('0x24'),'context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0xb')],'priority':_0x32899a[_0x7caa('0xe')]++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0]['VoiceExtensionId']});_0x32899a[_0x7caa('0xf')][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x13')],'app':_0x7caa('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x32899a['extension'][_0x7caa('0x22')]||_0x7caa('0x25'),'context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0]['exten'],'priority':_0x32899a[_0x7caa('0xe')]++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0]['VoiceExtensionId']});}}_0x32899a['extensions'][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x13')],'app':_0x7caa('0x14'),'appdata':_0x7caa('0x26'),'context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0xb')],'priority':_0x32899a[_0x7caa('0xe')]++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]});_0x32899a[_0x7caa('0xf')][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0]['type'],'app':_0x7caa('0x14'),'appdata':_0x7caa('0x27'),'context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'exten':_0x4b9e26[_0x22b1aa][0x0]['exten'],'priority':_0x32899a[_0x7caa('0xe')]++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]});_0x32899a[_0x7caa('0xf')]['push']({'type':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x13')],'app':'Set','appdata':_0x7caa('0x28'),'context':_0x4b9e26[_0x22b1aa][0x0]['context'],'exten':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0xb')],'priority':_0x32899a['priority']++,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]});for(var _0x573f9c=0x0,_0x4d1743=0x0;_0x573f9c<_0x4b9e26[_0x22b1aa]['length'];_0x573f9c+=0x1,_0x4d1743=0x0){var _0x4a9660=_0x4b9e26[_0x22b1aa][_0x573f9c];if(_0x4a9660[_0x7caa('0x13')]){_0x4a9660[_0x7caa('0x13')]=_0x4a9660[_0x7caa('0x13')][_0x7caa('0x29')]();}var _0x31046e=[];var _0x4e2897=[];delete _0x4a9660['id'];delete _0x4a9660[_0x7caa('0x2a')];delete _0x4a9660[_0x7caa('0x2b')];var _0x142e87=_0x4a9660[_0x7caa('0x2c')]!==_0x7caa('0x2d')?[_0x4a9660[_0x7caa('0x2c')]]:_0x4a9660[_0x7caa('0x2e')]?_['map'](_[_0x7caa('0x9')](_0x32899a['intervals'],{'IntervalId':_0x4a9660[_0x7caa('0x2e')]}),'interval'):[];if(_0x4a9660['hasOwnProperty'](_0x7caa('0x2f'))){if(_0x4a9660[_0x7caa('0x2f')]&&_0x4a9660['tag']!=='--'){_0x31046e['push']({'type':_0x4a9660[_0x7caa('0x13')],'app':_0x7caa('0x14'),'appdata':_0x7caa('0x30')+_0x4a9660[_0x7caa('0x2f')],'context':_0x4a9660[_0x7caa('0x17')],'exten':_0x4a9660[_0x7caa('0xb')],'priority':_0x142e87[_0x7caa('0x31')]+_0x32899a[_0x7caa('0xe')]+_0x4d1743++,'VoiceExtensionId':_0x4a9660[_0x7caa('0x18')]});}}if(_0x4a9660[_0x7caa('0x13')]===_0x7caa('0x1a')&&_0x4a9660[_0x7caa('0x21')](_0x7caa('0x32'))){if(_0x4a9660[_0x7caa('0x32')]){_0x31046e['push']({'type':_0x4a9660[_0x7caa('0x13')],'app':_0x7caa('0x33'),'appdata':_0x7caa('0x34')+_0x4a9660[_0x7caa('0x32')]+')','context':_0x4a9660[_0x7caa('0x17')],'exten':_0x4a9660[_0x7caa('0xb')],'priority':_0x142e87['length']+_0x32899a[_0x7caa('0xe')]+_0x4d1743++,'VoiceExtensionId':_0x4a9660[_0x7caa('0x18')]});}else{_0x31046e[_0x7caa('0x12')]({'type':_0x4a9660[_0x7caa('0x13')],'app':_0x7caa('0x33'),'appdata':_0x7caa('0x35'),'context':_0x4a9660['context'],'exten':_0x4a9660[_0x7caa('0xb')],'priority':_0x142e87['length']+_0x32899a['priority']+_0x4d1743++,'VoiceExtensionId':_0x4a9660['VoiceExtensionId']});}}if(_0x4a9660[_0x7caa('0x21')](_0x7caa('0x36'))){if(_0x449652['indexOf'](_0x4a9660[_0x7caa('0x37')][_0x7caa('0x29')]())>=0x0&&_0x4a9660[_0x7caa('0x38')]!==_0x7caa('0x39')){if(_0x4a9660[_0x7caa('0x36')]){_0x31046e['push']({'type':_0x4a9660[_0x7caa('0x13')],'app':'ExecIf','appdata':_0x7caa('0x3a'),'context':_0x4a9660[_0x7caa('0x17')],'exten':_0x4a9660[_0x7caa('0xb')],'priority':_0x142e87['length']+_0x32899a[_0x7caa('0xe')]+_0x4d1743++,'VoiceExtensionId':_0x4a9660[_0x7caa('0x18')]});_0x31046e['push']({'type':_0x4a9660[_0x7caa('0x13')],'app':_0x7caa('0x14'),'appdata':_0x7caa('0x3b'),'context':_0x4a9660[_0x7caa('0x17')],'exten':_0x4a9660[_0x7caa('0xb')],'priority':_0x142e87[_0x7caa('0x31')]+_0x32899a[_0x7caa('0xe')]+_0x4d1743++,'VoiceExtensionId':_0x4a9660[_0x7caa('0x18')]});}else{_0x31046e[_0x7caa('0x12')]({'type':_0x4a9660[_0x7caa('0x13')],'app':_0x7caa('0x33'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4a9660[_0x7caa('0x17')],'exten':_0x4a9660[_0x7caa('0xb')],'priority':_0x142e87[_0x7caa('0x31')]+_0x32899a['priority']+_0x4d1743++,'VoiceExtensionId':_0x4a9660[_0x7caa('0x18')]});_0x31046e[_0x7caa('0x12')]({'type':_0x4a9660[_0x7caa('0x13')],'app':_0x7caa('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4a9660['context'],'exten':_0x4a9660['exten'],'priority':_0x142e87[_0x7caa('0x31')]+_0x32899a[_0x7caa('0xe')]+_0x4d1743++,'VoiceExtensionId':_0x4a9660[_0x7caa('0x18')]});}}}for(var _0x4449dc=0x0;_0x4449dc<_0x142e87[_0x7caa('0x31')];_0x4449dc+=0x1){var _0x4cf029=_0x32899a['priority']+_0x142e87[_0x7caa('0x31')];var _0x4bf091=_0x4449dc===_0x142e87[_0x7caa('0x31')]-0x1?_0x32899a['priority']+_0x31046e[_0x7caa('0x31')]+_0x4e2897[_0x7caa('0x31')]+0x2:_0x32899a[_0x7caa('0xe')]+_0x4449dc+0x1;_0x31046e[_0x7caa('0x3c')](_0x4449dc,0x0,{'type':_0x4a9660[_0x7caa('0x13')],'app':'GotoIfTime','appdata':_0x142e87[_0x4449dc]+'?'+_0x4a9660[_0x7caa('0x17')]+',${EXTEN},'+_0x4cf029+':'+_0x4a9660[_0x7caa('0x17')]+_0x7caa('0x3d')+_0x4bf091,'exten':_0x4a9660[_0x7caa('0xb')],'context':_0x4a9660[_0x7caa('0x17')],'priority':_0x32899a[_0x7caa('0xe')]+_0x4449dc,'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]});}_0x4a9660[_0x7caa('0xe')]=_0x31046e[_0x7caa('0x31')]?_[_0x7caa('0x3e')](_0x31046e)[_0x7caa('0xe')]+0x1:_0x32899a[_0x7caa('0xe')];_0x32899a[_0x7caa('0xe')]=(_0x4e2897[_0x7caa('0x31')]?_[_0x7caa('0x3e')](_0x4e2897)['priority']:_0x4a9660[_0x7caa('0xe')])+0x1;_0x32899a['extensions']=_[_0x7caa('0x3f')](_0x32899a[_0x7caa('0xf')],_0x31046e,[_0x4a9660],_0x4e2897);}_0x32899a[_0x7caa('0xf')][_0x7caa('0x12')]({'type':_0x4b9e26[_0x22b1aa][0x0]['type'],'app':'Hangup','exten':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0xb')],'context':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x17')],'priority':_0x32899a['priority'],'VoiceExtensionId':_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]});_0x570e62[_0x7caa('0x12')](_0x4b9e26[_0x22b1aa][0x0][_0x7caa('0x18')]);_0x28f210=_[_0x7caa('0x3f')](_0x28f210,_0x32899a[_0x7caa('0xf')]);}}return _0x1ed20c[_0x7caa('0x40')](function(_0x510baa){return _0x1ed20c[_0x7caa('0x2')][_0x7caa('0x41')][_0x7caa('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x570e62}},'transaction':_0x510baa})[_0x7caa('0x5')](function(_0x392939){return _0x1ed20c[_0x7caa('0x2')][_0x7caa('0x41')][_0x7caa('0x43')](_[_0x7caa('0x44')](_0x28f210,_0x7caa('0xe')),{'transaction':_0x510baa});});});})['catch'](function(_0x2bdcae){console[_0x7caa('0x45')](_0x2bdcae);});}exports[_0x7caa('0x46')]=rewrite; \ No newline at end of file +var _0xdd8b=['CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','priority','extension','extensions','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','transaction','destroy','sortBy','catch','error','rewrite','util','models','Interval','then','VoiceExtension','findAll','IntervalId','uniq','map','exten'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdd8b,0xc5));var _0xbdd8=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xdd8b[_0x1f1e31];return _0x229b56;};'use strict';var _=require('lodash');var util=require(_0xbdd8('0x0'));function rewrite(_0x94ad53,_0x4fdb43){var _0x732b6a=this;return _0x94ad53[_0xbdd8('0x1')][_0xbdd8('0x2')]['findAll']({'raw':!![]})[_0xbdd8('0x3')](function(_0x26038f){_0x732b6a['intervals']=_0x26038f;return _0x94ad53[_0xbdd8('0x1')][_0xbdd8('0x4')][_0xbdd8('0x5')]({'where':{'IntervalId':_0x4fdb43[_0xbdd8('0x6')]},'raw':!![]});})[_0xbdd8('0x3')](function(_0x5ae54b){return _0x94ad53[_0xbdd8('0x1')][_0xbdd8('0x4')][_0xbdd8('0x5')]({'where':{'exten':{'$in':_[_0xbdd8('0x7')](_[_0xbdd8('0x8')](_0x5ae54b,_0xbdd8('0x9')))}},'order':[{'raw':_0xbdd8('0xa')}],'raw':!![]});})['then'](function(_0x316cfb){var _0x762492=_[_0xbdd8('0xb')](_0x316cfb,{'priority':'1'});var _0x332877=_[_0xbdd8('0xb')](_0x316cfb,{'isApp':0x1});var _0x189b81=_[_0xbdd8('0xc')](_0x332877,_0xbdd8('0x9'));var _0x11edb3=['queue',_0xbdd8('0xd')];var _0x1c9463=[];var _0x536ead=[];for(var _0x18822f in _0x189b81){if(_0x189b81['hasOwnProperty'](_0x18822f)){_0x732b6a[_0xbdd8('0xe')]=0x2;_0x732b6a['extensions']=[];_0x732b6a[_0xbdd8('0xf')]=_['find'](_0x762492,{'exten':_0x189b81[_0x18822f][0x0]['exten']});_0x732b6a[_0xbdd8('0x10')][_0xbdd8('0x11')]({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':_0xbdd8('0x13'),'appdata':util['format'](_0xbdd8('0x14'),_0x189b81[_0x18822f][0x0]['type']),'context':_0x189b81[_0x18822f][0x0][_0xbdd8('0x15')],'exten':_0x189b81[_0x18822f][0x0][_0xbdd8('0x9')],'priority':_0x732b6a[_0xbdd8('0xe')]++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});if(_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')]===_0xbdd8('0x17')){_0x732b6a['extensions']['push']({'type':_0x189b81[_0x18822f][0x0]['type'],'app':_0xbdd8('0x13'),'appdata':_0xbdd8('0x18')+_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')],'context':_0x189b81[_0x18822f][0x0][_0xbdd8('0x15')],'exten':_0x189b81[_0x18822f][0x0][_0xbdd8('0x9')],'priority':_0x732b6a[_0xbdd8('0xe')]++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});}else if(_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')]===_0xbdd8('0x19')){if(_0x732b6a[_0xbdd8('0xf')]){_0x732b6a[_0xbdd8('0x10')][_0xbdd8('0x11')]({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':'Set','appdata':_0xbdd8('0x1a')+(_0x732b6a['extension'][_0xbdd8('0x1b')]?'${EXTEN:'+_0x732b6a[_0xbdd8('0xf')][_0xbdd8('0x1b')]+'}':'${EXTEN}'),'context':_0x189b81[_0x18822f][0x0][_0xbdd8('0x15')],'exten':_0x189b81[_0x18822f][0x0][_0xbdd8('0x9')],'priority':_0x732b6a[_0xbdd8('0xe')]++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0]['VoiceExtensionId']});}_0x732b6a[_0xbdd8('0x10')]['push']({'type':_0x189b81[_0x18822f][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')],'context':_0x189b81[_0x18822f][0x0][_0xbdd8('0x15')],'exten':_0x189b81[_0x18822f][0x0]['exten'],'priority':_0x732b6a[_0xbdd8('0xe')]++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});var _0x1bcc38=_0x732b6a[_0xbdd8('0xe')]++;_0x732b6a['extensions'][_0xbdd8('0x11')]({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':_0xbdd8('0x1c'),'appdata':_0xbdd8('0x1d')+(_0x1bcc38+0x2)+_0xbdd8('0x1e')+(_0x1bcc38+0x1)+')','context':_0x189b81[_0x18822f][0x0][_0xbdd8('0x15')],'exten':_0x189b81[_0x18822f][0x0][_0xbdd8('0x9')],'priority':_0x1bcc38,'VoiceExtensionId':_0x189b81[_0x18822f][0x0]['VoiceExtensionId']});if(_0x732b6a[_0xbdd8('0xf')]){_0x732b6a['extensions']['push']({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':_0xbdd8('0x13'),'appdata':_0x732b6a[_0xbdd8('0xf')][_0xbdd8('0x1b')]?_0xbdd8('0x1f')+_0x732b6a['extension'][_0xbdd8('0x1b')]+'}':_0xbdd8('0x20'),'context':_0x189b81[_0x18822f][0x0][_0xbdd8('0x15')],'exten':_0x189b81[_0x18822f][0x0]['exten'],'priority':_0x732b6a['priority']++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});}_0x732b6a[_0xbdd8('0x10')][_0xbdd8('0x11')]({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':'Set','appdata':_0xbdd8('0x21')+_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')],'context':_0x189b81[_0x18822f][0x0]['context'],'exten':_0x189b81[_0x18822f][0x0]['exten'],'priority':_0x732b6a[_0xbdd8('0xe')]++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});if(_0x732b6a['extension']&&_0x732b6a[_0xbdd8('0xf')][_0xbdd8('0x22')](_0xbdd8('0x23'))&&_0x732b6a['extension'][_0xbdd8('0x23')]!==_0xbdd8('0x24')){_0x732b6a['extensions'][_0xbdd8('0x11')]({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':_0xbdd8('0x13'),'appdata':_0xbdd8('0x25'),'context':_0x189b81[_0x18822f][0x0][_0xbdd8('0x15')],'exten':_0x189b81[_0x18822f][0x0][_0xbdd8('0x9')],'priority':_0x732b6a['priority']++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});_0x732b6a[_0xbdd8('0x10')][_0xbdd8('0x11')]({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':_0xbdd8('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x732b6a[_0xbdd8('0xf')][_0xbdd8('0x23')]||_0xbdd8('0x26'),'context':_0x189b81[_0x18822f][0x0][_0xbdd8('0x15')],'exten':_0x189b81[_0x18822f][0x0]['exten'],'priority':_0x732b6a[_0xbdd8('0xe')]++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});}}_0x732b6a['extensions'][_0xbdd8('0x11')]({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x189b81[_0x18822f][0x0]['context'],'exten':_0x189b81[_0x18822f][0x0]['exten'],'priority':_0x732b6a[_0xbdd8('0xe')]++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});_0x732b6a[_0xbdd8('0x10')][_0xbdd8('0x11')]({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':'Set','appdata':_0xbdd8('0x27'),'context':_0x189b81[_0x18822f][0x0]['context'],'exten':_0x189b81[_0x18822f][0x0][_0xbdd8('0x9')],'priority':_0x732b6a[_0xbdd8('0xe')]++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});_0x732b6a[_0xbdd8('0x10')][_0xbdd8('0x11')]({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':_0xbdd8('0x13'),'appdata':_0xbdd8('0x28'),'context':_0x189b81[_0x18822f][0x0][_0xbdd8('0x15')],'exten':_0x189b81[_0x18822f][0x0][_0xbdd8('0x9')],'priority':_0x732b6a[_0xbdd8('0xe')]++,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});for(var _0x1e2693=0x0,_0x2a13c8=0x0;_0x1e2693<_0x189b81[_0x18822f][_0xbdd8('0x29')];_0x1e2693+=0x1,_0x2a13c8=0x0){var _0x3fa6c6=_0x189b81[_0x18822f][_0x1e2693];if(_0x3fa6c6[_0xbdd8('0x12')]){_0x3fa6c6[_0xbdd8('0x12')]=_0x3fa6c6[_0xbdd8('0x12')][_0xbdd8('0x2a')]();}var _0x50d0f9=[];var _0x37b620=[];delete _0x3fa6c6['id'];delete _0x3fa6c6[_0xbdd8('0x2b')];delete _0x3fa6c6[_0xbdd8('0x2c')];var _0x726279=_0x3fa6c6['interval']!==_0xbdd8('0x2d')?[_0x3fa6c6[_0xbdd8('0x2e')]]:_0x3fa6c6['IntervalId']?_['map'](_[_0xbdd8('0xb')](_0x732b6a[_0xbdd8('0x2f')],{'IntervalId':_0x3fa6c6['IntervalId']}),'interval'):[];if(_0x3fa6c6[_0xbdd8('0x22')](_0xbdd8('0x30'))){if(_0x3fa6c6['tag']&&_0x3fa6c6['tag']!=='--'){_0x50d0f9['push']({'type':_0x3fa6c6[_0xbdd8('0x12')],'app':_0xbdd8('0x13'),'appdata':_0xbdd8('0x31')+_0x3fa6c6['tag'],'context':_0x3fa6c6['context'],'exten':_0x3fa6c6[_0xbdd8('0x9')],'priority':_0x726279[_0xbdd8('0x29')]+_0x732b6a[_0xbdd8('0xe')]+_0x2a13c8++,'VoiceExtensionId':_0x3fa6c6['VoiceExtensionId']});}}if(_0x3fa6c6[_0xbdd8('0x12')]===_0xbdd8('0x19')&&_0x3fa6c6[_0xbdd8('0x22')]('callerID')){if(_0x3fa6c6[_0xbdd8('0x32')]){_0x50d0f9['push']({'type':_0x3fa6c6[_0xbdd8('0x12')],'app':_0xbdd8('0x1c'),'appdata':_0xbdd8('0x33')+_0x3fa6c6['callerID']+')','context':_0x3fa6c6[_0xbdd8('0x15')],'exten':_0x3fa6c6[_0xbdd8('0x9')],'priority':_0x726279[_0xbdd8('0x29')]+_0x732b6a[_0xbdd8('0xe')]+_0x2a13c8++,'VoiceExtensionId':_0x3fa6c6[_0xbdd8('0x16')]});}else{_0x50d0f9['push']({'type':_0x3fa6c6[_0xbdd8('0x12')],'app':_0xbdd8('0x1c'),'appdata':_0xbdd8('0x34'),'context':_0x3fa6c6[_0xbdd8('0x15')],'exten':_0x3fa6c6[_0xbdd8('0x9')],'priority':_0x726279[_0xbdd8('0x29')]+_0x732b6a[_0xbdd8('0xe')]+_0x2a13c8++,'VoiceExtensionId':_0x3fa6c6[_0xbdd8('0x16')]});}}if(_0x3fa6c6[_0xbdd8('0x22')](_0xbdd8('0x35'))){if(_0x11edb3[_0xbdd8('0x36')](_0x3fa6c6[_0xbdd8('0x37')][_0xbdd8('0x2a')]())>=0x0&&_0x3fa6c6[_0xbdd8('0x38')]!==_0xbdd8('0x39')){if(_0x3fa6c6[_0xbdd8('0x35')]){_0x50d0f9[_0xbdd8('0x11')]({'type':_0x3fa6c6['type'],'app':'ExecIf','appdata':_0xbdd8('0x3a'),'context':_0x3fa6c6['context'],'exten':_0x3fa6c6[_0xbdd8('0x9')],'priority':_0x726279[_0xbdd8('0x29')]+_0x732b6a['priority']+_0x2a13c8++,'VoiceExtensionId':_0x3fa6c6['VoiceExtensionId']});_0x50d0f9[_0xbdd8('0x11')]({'type':_0x3fa6c6[_0xbdd8('0x12')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3fa6c6['context'],'exten':_0x3fa6c6[_0xbdd8('0x9')],'priority':_0x726279[_0xbdd8('0x29')]+_0x732b6a[_0xbdd8('0xe')]+_0x2a13c8++,'VoiceExtensionId':_0x3fa6c6['VoiceExtensionId']});}else{_0x50d0f9[_0xbdd8('0x11')]({'type':_0x3fa6c6['type'],'app':_0xbdd8('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3fa6c6['context'],'exten':_0x3fa6c6['exten'],'priority':_0x726279[_0xbdd8('0x29')]+_0x732b6a[_0xbdd8('0xe')]+_0x2a13c8++,'VoiceExtensionId':_0x3fa6c6[_0xbdd8('0x16')]});_0x50d0f9[_0xbdd8('0x11')]({'type':_0x3fa6c6[_0xbdd8('0x12')],'app':_0xbdd8('0x13'),'appdata':_0xbdd8('0x3b'),'context':_0x3fa6c6['context'],'exten':_0x3fa6c6['exten'],'priority':_0x726279[_0xbdd8('0x29')]+_0x732b6a[_0xbdd8('0xe')]+_0x2a13c8++,'VoiceExtensionId':_0x3fa6c6['VoiceExtensionId']});}}}for(var _0x5ca321=0x0;_0x5ca321<_0x726279[_0xbdd8('0x29')];_0x5ca321+=0x1){var _0x543e99=_0x732b6a[_0xbdd8('0xe')]+_0x726279[_0xbdd8('0x29')];var _0x26bf1f=_0x5ca321===_0x726279[_0xbdd8('0x29')]-0x1?_0x732b6a[_0xbdd8('0xe')]+_0x50d0f9[_0xbdd8('0x29')]+_0x37b620[_0xbdd8('0x29')]+0x2:_0x732b6a[_0xbdd8('0xe')]+_0x5ca321+0x1;_0x50d0f9['splice'](_0x5ca321,0x0,{'type':_0x3fa6c6['type'],'app':'GotoIfTime','appdata':_0x726279[_0x5ca321]+'?'+_0x3fa6c6[_0xbdd8('0x15')]+_0xbdd8('0x3c')+_0x543e99+':'+_0x3fa6c6[_0xbdd8('0x15')]+_0xbdd8('0x3c')+_0x26bf1f,'exten':_0x3fa6c6['exten'],'context':_0x3fa6c6[_0xbdd8('0x15')],'priority':_0x732b6a[_0xbdd8('0xe')]+_0x5ca321,'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});}_0x3fa6c6[_0xbdd8('0xe')]=_0x50d0f9[_0xbdd8('0x29')]?_['last'](_0x50d0f9)['priority']+0x1:_0x732b6a[_0xbdd8('0xe')];_0x732b6a[_0xbdd8('0xe')]=(_0x37b620[_0xbdd8('0x29')]?_[_0xbdd8('0x3d')](_0x37b620)[_0xbdd8('0xe')]:_0x3fa6c6[_0xbdd8('0xe')])+0x1;_0x732b6a[_0xbdd8('0x10')]=_[_0xbdd8('0x3e')](_0x732b6a['extensions'],_0x50d0f9,[_0x3fa6c6],_0x37b620);}_0x732b6a['extensions']['push']({'type':_0x189b81[_0x18822f][0x0][_0xbdd8('0x12')],'app':'Hangup','exten':_0x189b81[_0x18822f][0x0][_0xbdd8('0x9')],'context':_0x189b81[_0x18822f][0x0]['context'],'priority':_0x732b6a[_0xbdd8('0xe')],'VoiceExtensionId':_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]});_0x1c9463[_0xbdd8('0x11')](_0x189b81[_0x18822f][0x0][_0xbdd8('0x16')]);_0x536ead=_[_0xbdd8('0x3e')](_0x536ead,_0x732b6a[_0xbdd8('0x10')]);}}return _0x94ad53[_0xbdd8('0x3f')](function(_0x2e3ab7){return _0x94ad53[_0xbdd8('0x1')][_0xbdd8('0x4')][_0xbdd8('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x1c9463}},'transaction':_0x2e3ab7})[_0xbdd8('0x3')](function(_0x415bad){return _0x94ad53[_0xbdd8('0x1')][_0xbdd8('0x4')]['bulkCreate'](_[_0xbdd8('0x41')](_0x536ead,'priority'),{'transaction':_0x2e3ab7});});});})[_0xbdd8('0x42')](function(_0x4bb733){console[_0xbdd8('0x43')](_0x4bb733);});}exports[_0xbdd8('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 78f4cb7..c03f07e 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 _0xb9d3=['Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','createReadStream','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','scheduledAt','ContactId','createdAt','updatedAt','select','NOW()','field','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper','\x20=\x20?','fromQuery','str','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','id\x20IN\x20?','VoiceQueue','outbound','dialCheckDuplicateType','CmList','always','push','VoiceQueueId','onlyIfOpen','sequelize','query','all','BlackLists','get','Campaign','findAll','Lists','CampaignId'];(function(_0x1729ec,_0x27214b){var _0x358fd3=function(_0x3858ac){while(--_0x3858ac){_0x1729ec['push'](_0x1729ec['shift']());}};_0x358fd3(++_0x27214b);}(_0xb9d3,0x7a));var _0x3b9d=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xb9d3[_0x36ed48];return _0x51c63a;};'use strict';var BPromise=require(_0x3b9d('0x0'));var util=require(_0x3b9d('0x1'));var _=require(_0x3b9d('0x2'));var fs=require('fs');var squel=require(_0x3b9d('0x3'));var Papa=require(_0x3b9d('0x4'));var Redis=require('ioredis');var db=require(_0x3b9d('0x5'))['db'];var config=require(_0x3b9d('0x6'));var logger=require(_0x3b9d('0x7'))(_0x3b9d('0x8'));config[_0x3b9d('0x9')]=_[_0x3b9d('0xa')](config[_0x3b9d('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b9d('0x9')]));require(_0x3b9d('0xb'))[_0x3b9d('0xc')](socket);try{if(!process[_0x3b9d('0xd')][0x2]||process['argv'][0x2]===_0x3b9d('0xe')||process[_0x3b9d('0xd')][0x2]===_0x3b9d('0xf')){throw new Error(_0x3b9d('0x10'));}var FILEPATH=process[_0x3b9d('0xd')][0x2];if(!process[_0x3b9d('0xd')][0x3]||process[_0x3b9d('0xd')][0x3]===_0x3b9d('0xe')||process[_0x3b9d('0xd')][0x3]===_0x3b9d('0xf')||!process[_0x3b9d('0xd')][0x4]||process[_0x3b9d('0xd')][0x4]==='undefined'||process[_0x3b9d('0xd')][0x4]===_0x3b9d('0xf')){throw new Error(_0x3b9d('0x11'));}var FIELDS=_[_0x3b9d('0x12')](process[_0x3b9d('0xd')][0x3][_0x3b9d('0x13')](','),process[_0x3b9d('0xd')][0x4][_0x3b9d('0x13')](','));if(!process[_0x3b9d('0xd')][0x5]||process[_0x3b9d('0xd')][0x5]==='undefined'||process[_0x3b9d('0xd')][0x5]==='null'){throw new Error(_0x3b9d('0x14'));}var LISTID=process[_0x3b9d('0xd')][0x5];var COMPANYID=process[_0x3b9d('0xd')][0x6]&&process[_0x3b9d('0xd')][0x6]!==_0x3b9d('0xe')&&process[_0x3b9d('0xd')][0x6]!==_0x3b9d('0xf')?process[_0x3b9d('0xd')][0x6]:null;var DUPLICATES=process[_0x3b9d('0xd')][0x7]&&process['argv'][0x7]!==_0x3b9d('0xe')&&process[_0x3b9d('0xd')][0x7]!=='null'?process[_0x3b9d('0xd')][0x7]:null;if(!process[_0x3b9d('0xd')][0x8]||process[_0x3b9d('0xd')][0x8]===_0x3b9d('0xe')||process['argv'][0x8]===_0x3b9d('0xf')){throw new Error(_0x3b9d('0x15'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x4e40cd){logger[_0x3b9d('0x16')](_0x4e40cd);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(_0x2f4c89,_0x212594,_0x3be67a,_0x493df5){var _0x4bb776={'message':_0x212594};_0x4bb776[_0x2f4c89]=!![];if(_0x3be67a){_0x4bb776[_0x3b9d('0x17')]=_0x3be67a;}if(_0x493df5){_0x4bb776[_0x3b9d('0x18')]=_0x493df5;}return _0x4bb776;}function isEmail(_0x3e135e){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3e135e);}function checkRow(_0x542e66,_0xf90e89,_0x5d91de){return new BPromise(function(_0x4eab02,_0x56d5a7){if(_['isNil'](_0x542e66)){return _0x56d5a7(handleCheckRowError(_0x3b9d('0x16'),_0x3b9d('0x19'),null,_0x5d91de));}if(_0x542e66[_0x3b9d('0x1a')]&&_0x542e66[_0x3b9d('0x1a')][_0x3b9d('0x1b')]){var _0x49db68=_['map'](_0x542e66[_0x3b9d('0x1a')],_0x3b9d('0x1c'))['join'](';');return _0x56d5a7(handleCheckRowError('error',_0x49db68,null,_0x5d91de));}var _0x2a24c7={};for(var _0x1e89cb in FIELDS){if(FIELDS['hasOwnProperty'](_0x1e89cb)&&FIELDS[_0x1e89cb]){_0x2a24c7[_0x1e89cb]=_0x542e66[_0x3b9d('0x1d')][0x0][FIELDS[_0x1e89cb]]||_0x542e66[_0x3b9d('0x1d')][0x0]['\ufeff'+FIELDS[_0x1e89cb]];}}if(!_0x2a24c7[_0x3b9d('0x1e')]){return _0x56d5a7(handleCheckRowError(_0x3b9d('0x16'),_0x3b9d('0x1f'),null,_0x5d91de));}if(!_0x2a24c7[_0x3b9d('0x20')]){return _0x56d5a7(handleCheckRowError(_0x3b9d('0x16'),_0x3b9d('0x21'),null,_0x5d91de));}if(_0x2a24c7[_0x3b9d('0x22')]){var _0x30b06d=moment(_0x2a24c7[_0x3b9d('0x22')],_0x3b9d('0x23'));if(!_0x30b06d[_0x3b9d('0x24')]()){return _0x56d5a7(handleCheckRowError('error',_0x3b9d('0x25'),null,_0x5d91de));}}if(_0x2a24c7['email']){if(!isEmail(_0x2a24c7[_0x3b9d('0x26')])){return _0x56d5a7(handleCheckRowError('error',_0x3b9d('0x27'),null,_0x5d91de));}}_0x2a24c7[_0x3b9d('0x28')]=LISTID;_0x2a24c7[_0x3b9d('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3b9d('0x1b')]&&_0xf90e89){var _0x753c70={};for(var _0x4331c1=0x0,_0x1c3ff5=DUPLICATES['length'];_0x4331c1<_0x1c3ff5;_0x4331c1+=0x1){_0x753c70[DUPLICATES[_0x4331c1]]=_0x2a24c7[DUPLICATES[_0x4331c1]];}var _0x4dd5de=_[_0x3b9d('0x2a')](_0xf90e89,_0x753c70);if(_0x4dd5de){return _0x56d5a7(handleCheckRowError(_0x3b9d('0x2b'),_0x3b9d('0x2c'),_0x4dd5de,_0x5d91de));}}return db[_0x3b9d('0x2d')]['create'](_0x2a24c7,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2a24c7)})[_0x3b9d('0x2e')](function(_0x549c09){if(DUPLICATES&&DUPLICATES[_0x3b9d('0x1b')]&&_0xf90e89){_0xf90e89['push'](_[_0x3b9d('0x2f')](_0x2a24c7,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x549c09['id'];return _0x4eab02();})[_0x3b9d('0x30')](function(_0x51f0ca){return _0x56d5a7(handleCheckRowError(_0x3b9d('0x16'),_0x3b9d('0x31')+(_0x51f0ca[_0x3b9d('0x1c')]||JSON[_0x3b9d('0x32')](_0x51f0ca)),null,_0x5d91de));});});}function checkHopper(){function _0x935513(){return function(_0x2dd0ae){logger['error'](_0x3b9d('0x33'),'checkHopper',util[_0x3b9d('0x34')](_0x2dd0ae,{'showHidden':![],'depth':null}));};}var _0xdc8a3a=function(_0x2d5113,_0xc8523f){var _0x2b57ec=squel[_0x3b9d('0x35')]()[_0x3b9d('0x36')]('cm_hopper')['fromQuery']([_0x3b9d('0x20'),_0x3b9d('0x37'),_0x3b9d('0x38'),_0x3b9d('0x28'),_0xc8523f,_0x3b9d('0x39'),_0x3b9d('0x3a')],squel[_0x3b9d('0x3b')]()['field']('phone',_0x3b9d('0x20'))['field'](_0x3b9d('0x3c'),_0x3b9d('0x37'))[_0x3b9d('0x3d')]('id',_0x3b9d('0x38'))[_0x3b9d('0x3d')](LISTID['toString'](),_0x3b9d('0x28'))[_0x3b9d('0x3d')](_0x2d5113['id'][_0x3b9d('0x3e')](),_0xc8523f)[_0x3b9d('0x3d')](_0x3b9d('0x3c'),_0x3b9d('0x39'))[_0x3b9d('0x3d')](_0x3b9d('0x3c'),'updatedAt')[_0x3b9d('0x3f')](_0x3b9d('0x40'))[_0x3b9d('0x41')](_0x3b9d('0x42'))[_0x3b9d('0x41')]('ListId\x20=\x20?',LISTID[_0x3b9d('0x3e')]())[_0x3b9d('0x41')](_0x3b9d('0x43'))[_0x3b9d('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3b9d('0x3b')]()[_0x3b9d('0x3d')]('phone')['from'](_0x3b9d('0x44'))[_0x3b9d('0x41')](_0xc8523f+_0x3b9d('0x45'),_0x2d5113['id'][_0x3b9d('0x3e')]())))[_0x3b9d('0x3e')]();return _0x2b57ec;};var _0x1d1c5b=function(_0x1d5e98,_0x3f724d){var _0x10ca2f=squel[_0x3b9d('0x35')]()[_0x3b9d('0x36')](_0x3b9d('0x44'))[_0x3b9d('0x46')]([_0x3b9d('0x20'),_0x3b9d('0x37'),_0x3b9d('0x38'),_0x3b9d('0x28'),_0x3f724d,_0x3b9d('0x39'),_0x3b9d('0x3a')],squel[_0x3b9d('0x3b')]()[_0x3b9d('0x3d')](_0x3b9d('0x20'),_0x3b9d('0x20'))[_0x3b9d('0x3d')](_0x3b9d('0x3c'),_0x3b9d('0x37'))[_0x3b9d('0x3d')]('id','ContactId')[_0x3b9d('0x3d')](LISTID[_0x3b9d('0x3e')](),_0x3b9d('0x28'))[_0x3b9d('0x3d')](_0x1d5e98['id']['toString'](),_0x3f724d)[_0x3b9d('0x3d')](_0x3b9d('0x3c'),_0x3b9d('0x39'))[_0x3b9d('0x3d')]('NOW()',_0x3b9d('0x3a'))[_0x3b9d('0x3f')](_0x3b9d('0x40'))[_0x3b9d('0x41')](_0x3b9d('0x42'))[_0x3b9d('0x41')]('ListId\x20=\x20?',LISTID[_0x3b9d('0x3e')]())['where']('id\x20IN\x20?',squel[_0x3b9d('0x47')](hopperContacts))[_0x3b9d('0x41')](_0x3b9d('0x43'))[_0x3b9d('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x3b9d('0x48'))[_0x3b9d('0x3f')](_0x3b9d('0x49'))[_0x3b9d('0x41')](_0x3f724d+'\x20=\x20?',_0x1d5e98['id'][_0x3b9d('0x3e')]()))[_0x3b9d('0x41')](_0x3b9d('0x4a'),squel[_0x3b9d('0x3b')]()[_0x3b9d('0x3d')](_0x3b9d('0x20'))[_0x3b9d('0x3f')]('cm_hopper')[_0x3b9d('0x41')](_0x3f724d+_0x3b9d('0x45'),_0x1d5e98['id'][_0x3b9d('0x3e')]())))[_0x3b9d('0x3e')]();return _0x10ca2f;};function _0x181325(_0x4feb8e,_0x4dbe1d){var _0x19868d=squel[_0x3b9d('0x35')]()[_0x3b9d('0x36')](_0x3b9d('0x44'))[_0x3b9d('0x46')]([_0x3b9d('0x20'),'scheduledAt',_0x3b9d('0x38'),_0x3b9d('0x28'),_0x4dbe1d,_0x3b9d('0x39'),_0x3b9d('0x3a')],squel[_0x3b9d('0x3b')]()[_0x3b9d('0x3d')]('phone','phone')[_0x3b9d('0x3d')](_0x3b9d('0x3c'),_0x3b9d('0x37'))[_0x3b9d('0x3d')]('id',_0x3b9d('0x38'))[_0x3b9d('0x3d')](LISTID[_0x3b9d('0x3e')](),_0x3b9d('0x28'))[_0x3b9d('0x3d')](_0x4feb8e['id'][_0x3b9d('0x3e')](),_0x4dbe1d)[_0x3b9d('0x3d')](_0x3b9d('0x3c'),'createdAt')[_0x3b9d('0x3d')](_0x3b9d('0x3c'),_0x3b9d('0x3a'))[_0x3b9d('0x3f')](_0x3b9d('0x40'))['where'](_0x3b9d('0x42'))[_0x3b9d('0x41')](_0x3b9d('0x4b'),LISTID[_0x3b9d('0x3e')]())[_0x3b9d('0x41')](_0x3b9d('0x4c'),squel[_0x3b9d('0x47')](hopperContacts))['where'](_0x3b9d('0x43')))[_0x3b9d('0x3e')]();return _0x19868d;}function _0x23a166(_0x324d83,_0x35a59c){var _0x232137=squel[_0x3b9d('0x35')]()['into']('cm_hopper_black')[_0x3b9d('0x46')]([_0x3b9d('0x20'),_0x3b9d('0x38'),'ListId',_0x35a59c,'createdAt','updatedAt'],squel['select']()[_0x3b9d('0x3d')](_0x3b9d('0x20'),_0x3b9d('0x20'))[_0x3b9d('0x3d')]('id','ContactId')[_0x3b9d('0x3d')](LISTID[_0x3b9d('0x3e')](),_0x3b9d('0x28'))['field'](_0x324d83['id'][_0x3b9d('0x3e')](),_0x35a59c)['field'](_0x3b9d('0x3c'),'createdAt')['field']('NOW()',_0x3b9d('0x3a'))['from'](_0x3b9d('0x40'))[_0x3b9d('0x41')](_0x3b9d('0x42'))['where'](_0x3b9d('0x4b'),LISTID[_0x3b9d('0x3e')]())['where'](_0x3b9d('0x4c'),squel[_0x3b9d('0x47')](hopperContacts))[_0x3b9d('0x41')](_0x3b9d('0x43')))[_0x3b9d('0x3e')]();return _0x232137;}return db[_0x3b9d('0x4d')]['findAll']({'where':{'type':_0x3b9d('0x4e')},'attributes':['id',_0x3b9d('0x4f')],'include':[{'model':db[_0x3b9d('0x50')],'as':'Lists','where':{'id':LISTID}}]})[_0x3b9d('0x2e')](function(_0x3d8d2e){var _0x3ed741=[];if(_0x3d8d2e){var _0x148cb4;for(var _0x304b25=0x0,_0x2f12c9;_0x304b25<_0x3d8d2e['length'];_0x304b25+=0x1){_0x2f12c9=_0x3d8d2e[_0x304b25]['get']({'plain':!![]});switch(_0x2f12c9[_0x3b9d('0x4f')]){case _0x3b9d('0x51'):_0x3ed741[_0x3b9d('0x52')](db['sequelize']['query'](_0x1d1c5b(_0x2f12c9,_0x3b9d('0x53')))[_0x3b9d('0x2e')](function(){})[_0x3b9d('0x30')](_0x935513()));break;case _0x3b9d('0x54'):_0x3ed741[_0x3b9d('0x52')](db[_0x3b9d('0x55')][_0x3b9d('0x56')](_0xdc8a3a(_0x2f12c9,'VoiceQueueId'))[_0x3b9d('0x2e')](function(){})[_0x3b9d('0x30')](_0x935513()));break;default:_0x3ed741[_0x3b9d('0x52')](db[_0x3b9d('0x55')][_0x3b9d('0x56')](_0x181325(_0x2f12c9,_0x3b9d('0x53')))[_0x3b9d('0x2e')](function(){})[_0x3b9d('0x30')](_0x935513()));}}}return _0x3ed741;})[_0x3b9d('0x57')]()['then'](function(){return db[_0x3b9d('0x4d')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x3b9d('0x58'),'where':{'id':LISTID}}]})[_0x3b9d('0x2e')](function(_0x41c6ed){var _0x30c4d6=[];if(_0x41c6ed){var _0x16ba54;for(var _0x288587=0x0,_0x5138ce;_0x288587<_0x41c6ed[_0x3b9d('0x1b')];_0x288587+=0x1){_0x5138ce=_0x41c6ed[_0x288587][_0x3b9d('0x59')]({'plain':!![]});_0x30c4d6[_0x3b9d('0x52')](db['sequelize']['query'](_0x23a166(_0x5138ce,_0x3b9d('0x53')))[_0x3b9d('0x2e')](function(){})[_0x3b9d('0x30')](_0x935513()));}}return _0x30c4d6;})['all']();})[_0x3b9d('0x2e')](function(){return db[_0x3b9d('0x5a')][_0x3b9d('0x5b')]({'attributes':['id',_0x3b9d('0x4f')],'include':[{'model':db['CmList'],'as':_0x3b9d('0x5c'),'where':{'id':LISTID}}]})[_0x3b9d('0x2e')](function(_0x3fd9c4){var _0x6f7c0a=[];if(_0x3fd9c4){for(var _0x23ad46=0x0,_0x33b42e;_0x23ad46<_0x3fd9c4['length'];_0x23ad46+=0x1){_0x33b42e=_0x3fd9c4[_0x23ad46][_0x3b9d('0x59')]({'plain':!![]});switch(_0x33b42e[_0x3b9d('0x4f')]){case _0x3b9d('0x51'):_0x6f7c0a[_0x3b9d('0x52')](db[_0x3b9d('0x55')][_0x3b9d('0x56')](_0x1d1c5b(_0x33b42e,_0x3b9d('0x5d')))['then'](function(){})['catch'](_0x935513()));break;case _0x3b9d('0x54'):_0x6f7c0a[_0x3b9d('0x52')](db[_0x3b9d('0x55')]['query'](_0xdc8a3a(_0x33b42e,_0x3b9d('0x5d')))[_0x3b9d('0x2e')](function(){})['catch'](_0x935513()));break;default:_0x6f7c0a[_0x3b9d('0x52')](db['sequelize'][_0x3b9d('0x56')](_0x181325(_0x33b42e,'CampaignId'))[_0x3b9d('0x2e')](function(){})[_0x3b9d('0x30')](_0x935513()));}}}return _0x6f7c0a;})[_0x3b9d('0x57')]();})[_0x3b9d('0x2e')](function(){return db[_0x3b9d('0x5a')][_0x3b9d('0x5b')]({'attributes':['id'],'include':[{'model':db[_0x3b9d('0x50')],'as':_0x3b9d('0x58'),'where':{'id':LISTID}}]})[_0x3b9d('0x2e')](function(_0x37269c){var _0x5a846=[];if(_0x37269c){for(var _0x260e5e=0x0,_0x3d3354;_0x260e5e<_0x37269c[_0x3b9d('0x1b')];_0x260e5e+=0x1){_0x3d3354=_0x37269c[_0x260e5e][_0x3b9d('0x59')]({'plain':!![]});_0x5a846[_0x3b9d('0x52')](db['sequelize'][_0x3b9d('0x56')](_0x23a166(_0x3d3354,_0x3b9d('0x5d')))[_0x3b9d('0x2e')](function(){})[_0x3b9d('0x30')](_0x935513()));}}return _0x5a846;})[_0x3b9d('0x57')]();})['catch'](function(_0x1f156a){logger[_0x3b9d('0x16')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x1f156a[_0x3b9d('0x1c')]);});}var processPromises=function(_0x413759){return BPromise['all'](promises)[_0x3b9d('0x2e')](function(_0xac57d5){})[_0x3b9d('0x30')](function(_0x1788d4){logger[_0x3b9d('0x16')](_0x3b9d('0x5e'),JSON[_0x3b9d('0x32')](_0x1788d4));})['finally'](function(){socket[_0x3b9d('0x5f')](_0x3b9d('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x413759){return _0x413759[_0x3b9d('0x61')]();}});};var endCsv=function(){return BPromise[_0x3b9d('0x62')]()[_0x3b9d('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3b9d('0x5f')](_0x3b9d('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x4743cb){logger[_0x3b9d('0x16')](_0x3b9d('0x63'),JSON['stringify'](_0x4743cb));}finally{process[_0x3b9d('0x64')](0x0);}});};process['on'](_0x3b9d('0x65'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x3b9d('0x62')]()[_0x3b9d('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0x3b9d('0x5b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3b9d('0x2e')](function(_0xd7932e){var _0x1ae13b=fs[_0x3b9d('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x1ae13b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1fc49e,_0x1457a5){total+=0x1;var _0x4dc967=total;promises['push'](checkRow(_0x1fc49e,_0xd7932e,_0x4dc967)[_0x3b9d('0x2e')](function(){success+=0x1;})[_0x3b9d('0x30')](function(_0x2c7e37){if(_0x2c7e37[_0x3b9d('0x16')]){errors+=0x1;delete _0x2c7e37[_0x3b9d('0x16')];}else if(_0x2c7e37[_0x3b9d('0x2b')]){duplicates+=0x1;delete _0x2c7e37[_0x3b9d('0x2b')];}rows[_0x3b9d('0x52')](_0x2c7e37);}));if(total%0xc8===0x0){_0x1457a5[_0x3b9d('0x67')]();return processPromises(_0x1457a5);}},'complete':function(){return processPromises()[_0x3b9d('0x2e')](function(){logger[_0x3b9d('0x68')](_0x3b9d('0x69'));endCsv();});},'error':function(_0x425ccf,_0x50ccd8){logger[_0x3b9d('0x68')](_0x3b9d('0x6a'),JSON[_0x3b9d('0x32')](_0x425ccf));endCsv();}});})[_0x3b9d('0x30')](function(_0x5aa591){logger['error'](_0x3b9d('0x6b'),JSON[_0x3b9d('0x32')](_0x5aa591));});}main(); \ No newline at end of file +var _0x34b6=['keys','then','push','catch','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','ListId','updatedAt','field','ContactId','toString','NOW()','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','select','\x20=\x20?','insert','scheduledAt','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','query','VoiceQueueId','onlyIfOpen','sequelize','all','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CmContact','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','duplicate'];(function(_0x523c0f,_0xc5c925){var _0x1f8d75=function(_0x5caef7){while(--_0x5caef7){_0x523c0f['push'](_0x523c0f['shift']());}};_0x1f8d75(++_0xc5c925);}(_0x34b6,0x181));var _0x634b=function(_0x292e30,_0x23eae2){_0x292e30=_0x292e30-0x0;var _0x47258c=_0x34b6[_0x292e30];return _0x47258c;};'use strict';var BPromise=require(_0x634b('0x0'));var util=require(_0x634b('0x1'));var _=require(_0x634b('0x2'));var fs=require('fs');var squel=require(_0x634b('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0x634b('0x4'))['db'];var config=require(_0x634b('0x5'));var logger=require(_0x634b('0x6'))(_0x634b('0x7'));config['redis']=_[_0x634b('0x8')](config['redis'],{'host':_0x634b('0x9'),'port':0x18eb});var socket=require(_0x634b('0xa'))(new Redis(config['redis']));require(_0x634b('0xb'))['register'](socket);try{if(!process[_0x634b('0xc')][0x2]||process['argv'][0x2]==='undefined'||process[_0x634b('0xc')][0x2]===_0x634b('0xd')){throw new Error(_0x634b('0xe'));}var FILEPATH=process[_0x634b('0xc')][0x2];if(!process[_0x634b('0xc')][0x3]||process[_0x634b('0xc')][0x3]===_0x634b('0xf')||process[_0x634b('0xc')][0x3]===_0x634b('0xd')||!process[_0x634b('0xc')][0x4]||process[_0x634b('0xc')][0x4]===_0x634b('0xf')||process[_0x634b('0xc')][0x4]===_0x634b('0xd')){throw new Error(_0x634b('0x10'));}var FIELDS=_[_0x634b('0x11')](process[_0x634b('0xc')][0x3][_0x634b('0x12')](','),process['argv'][0x4]['split'](','));if(!process[_0x634b('0xc')][0x5]||process[_0x634b('0xc')][0x5]===_0x634b('0xf')||process[_0x634b('0xc')][0x5]===_0x634b('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x634b('0xc')][0x5];var COMPANYID=process[_0x634b('0xc')][0x6]&&process[_0x634b('0xc')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x634b('0xd')?process[_0x634b('0xc')][0x6]:null;var DUPLICATES=process[_0x634b('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x634b('0xc')][0x7]!=='null'?process[_0x634b('0xc')][0x7]:null;if(!process[_0x634b('0xc')][0x8]||process['argv'][0x8]==='undefined'||process['argv'][0x8]===_0x634b('0xd')){throw new Error(_0x634b('0x13'));}var SOCKET_TIMESTAMP=process[_0x634b('0xc')][0x8];}catch(_0x3c729c){logger[_0x634b('0x14')](_0x3c729c);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(_0x26291a,_0xbebd8b,_0x47cb20,_0x241327){var _0xd019f={'message':_0xbebd8b};_0xd019f[_0x26291a]=!![];if(_0x47cb20){_0xd019f[_0x634b('0x15')]=_0x47cb20;}if(_0x241327){_0xd019f[_0x634b('0x16')]=_0x241327;}return _0xd019f;}function isEmail(_0x5002d6){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))*$/[_0x634b('0x17')](_0x5002d6);}function checkRow(_0x5da167,_0x33b599,_0x1d28b4){return new BPromise(function(_0x396cc3,_0x26ca78){if(_[_0x634b('0x18')](_0x5da167)){return _0x26ca78(handleCheckRowError(_0x634b('0x14'),_0x634b('0x19'),null,_0x1d28b4));}if(_0x5da167['errors']&&_0x5da167[_0x634b('0x1a')]['length']){var _0x56b6a3=_[_0x634b('0x1b')](_0x5da167[_0x634b('0x1a')],_0x634b('0x1c'))['join'](';');return _0x26ca78(handleCheckRowError(_0x634b('0x14'),_0x56b6a3,null,_0x1d28b4));}var _0x21e565={};for(var _0x53f22f in FIELDS){if(FIELDS[_0x634b('0x1d')](_0x53f22f)&&FIELDS[_0x53f22f]){_0x21e565[_0x53f22f]=_0x5da167[_0x634b('0x1e')][0x0][FIELDS[_0x53f22f]]||_0x5da167[_0x634b('0x1e')][0x0]['\ufeff'+FIELDS[_0x53f22f]];}}if(!_0x21e565[_0x634b('0x1f')]){return _0x26ca78(handleCheckRowError(_0x634b('0x14'),'firstName\x20not\x20specified!',null,_0x1d28b4));}if(!_0x21e565[_0x634b('0x20')]){return _0x26ca78(handleCheckRowError(_0x634b('0x14'),_0x634b('0x21'),null,_0x1d28b4));}if(_0x21e565[_0x634b('0x22')]){var _0x51f5f4=moment(_0x21e565['birthDate'],_0x634b('0x23'));if(!_0x51f5f4[_0x634b('0x24')]()){return _0x26ca78(handleCheckRowError(_0x634b('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x1d28b4));}}if(_0x21e565[_0x634b('0x25')]){if(!isEmail(_0x21e565['email'])){return _0x26ca78(handleCheckRowError('error',_0x634b('0x26'),null,_0x1d28b4));}}_0x21e565['ListId']=LISTID;_0x21e565[_0x634b('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x33b599){var _0xcc9a16={};for(var _0x30ef9d=0x0,_0x5bd815=DUPLICATES[_0x634b('0x28')];_0x30ef9d<_0x5bd815;_0x30ef9d+=0x1){_0xcc9a16[DUPLICATES[_0x30ef9d]]=_0x21e565[DUPLICATES[_0x30ef9d]];}var _0x5b53ce=_[_0x634b('0x29')](_0x33b599,_0xcc9a16);if(_0x5b53ce){return _0x26ca78(handleCheckRowError(_0x634b('0x2a'),'Duplicate\x20Contact',_0x5b53ce,_0x1d28b4));}}return db['CmContact']['create'](_0x21e565,{'raw':!![],'hooks':![],'fields':_[_0x634b('0x2b')](_0x21e565)})[_0x634b('0x2c')](function(_0x368b98){if(DUPLICATES&&DUPLICATES[_0x634b('0x28')]&&_0x33b599){_0x33b599[_0x634b('0x2d')](_['pick'](_0x21e565,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x368b98['id'];return _0x396cc3();})[_0x634b('0x2e')](function(_0x2ce5e3){return _0x26ca78(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x2ce5e3[_0x634b('0x1c')]||JSON[_0x634b('0x2f')](_0x2ce5e3)),null,_0x1d28b4));});});}function checkHopper(){function _0x19dad3(){return function(_0x512d54){logger[_0x634b('0x14')](_0x634b('0x30'),_0x634b('0x31'),util[_0x634b('0x32')](_0x512d54,{'showHidden':![],'depth':null}));};}var _0x399eb4=function(_0x58b906,_0x137bfb){var _0x5230f2=squel['insert']()[_0x634b('0x33')](_0x634b('0x34'))[_0x634b('0x35')]([_0x634b('0x20'),'scheduledAt','ContactId',_0x634b('0x36'),_0x137bfb,'createdAt',_0x634b('0x37')],squel['select']()[_0x634b('0x38')](_0x634b('0x20'),'phone')[_0x634b('0x38')]('NOW()','scheduledAt')['field']('id',_0x634b('0x39'))[_0x634b('0x38')](LISTID['toString'](),_0x634b('0x36'))[_0x634b('0x38')](_0x58b906['id'][_0x634b('0x3a')](),_0x137bfb)[_0x634b('0x38')](_0x634b('0x3b'),_0x634b('0x3c'))[_0x634b('0x38')](_0x634b('0x3b'),'updatedAt')[_0x634b('0x3d')](_0x634b('0x3e'))[_0x634b('0x3f')](_0x634b('0x40'))[_0x634b('0x3f')](_0x634b('0x41'),LISTID[_0x634b('0x3a')]())[_0x634b('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x634b('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x634b('0x42')]()[_0x634b('0x38')](_0x634b('0x20'))[_0x634b('0x3d')](_0x634b('0x34'))[_0x634b('0x3f')](_0x137bfb+_0x634b('0x43'),_0x58b906['id'][_0x634b('0x3a')]())))[_0x634b('0x3a')]();return _0x5230f2;};var _0x599594=function(_0x47a32,_0x562012){var _0x31bb04=squel[_0x634b('0x44')]()[_0x634b('0x33')](_0x634b('0x34'))[_0x634b('0x35')]([_0x634b('0x20'),_0x634b('0x45'),'ContactId',_0x634b('0x36'),_0x562012,_0x634b('0x3c'),_0x634b('0x37')],squel[_0x634b('0x42')]()[_0x634b('0x38')](_0x634b('0x20'),_0x634b('0x20'))[_0x634b('0x38')]('NOW()',_0x634b('0x45'))[_0x634b('0x38')]('id',_0x634b('0x39'))['field'](LISTID[_0x634b('0x3a')](),_0x634b('0x36'))[_0x634b('0x38')](_0x47a32['id']['toString'](),_0x562012)[_0x634b('0x38')](_0x634b('0x3b'),_0x634b('0x3c'))[_0x634b('0x38')]('NOW()','updatedAt')[_0x634b('0x3d')](_0x634b('0x3e'))[_0x634b('0x3f')]('deletedAt\x20IS\x20NULL')[_0x634b('0x3f')](_0x634b('0x41'),LISTID[_0x634b('0x3a')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0x634b('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x634b('0x3f')](_0x634b('0x46'),squel['select']()[_0x634b('0x38')](_0x634b('0x47'))[_0x634b('0x3d')](_0x634b('0x48'))['where'](_0x562012+'\x20=\x20?',_0x47a32['id']['toString']()))['where'](_0x634b('0x46'),squel[_0x634b('0x42')]()[_0x634b('0x38')](_0x634b('0x20'))[_0x634b('0x3d')](_0x634b('0x34'))[_0x634b('0x3f')](_0x562012+_0x634b('0x43'),_0x47a32['id'][_0x634b('0x3a')]())))[_0x634b('0x3a')]();return _0x31bb04;};function _0x2b0a80(_0x26c9a2,_0x2e4bdc){var _0x7dcf5b=squel[_0x634b('0x44')]()[_0x634b('0x33')](_0x634b('0x34'))[_0x634b('0x35')]([_0x634b('0x20'),_0x634b('0x45'),_0x634b('0x39'),_0x634b('0x36'),_0x2e4bdc,_0x634b('0x3c'),_0x634b('0x37')],squel[_0x634b('0x42')]()[_0x634b('0x38')](_0x634b('0x20'),_0x634b('0x20'))['field']('NOW()',_0x634b('0x45'))[_0x634b('0x38')]('id','ContactId')['field'](LISTID[_0x634b('0x3a')](),_0x634b('0x36'))['field'](_0x26c9a2['id'][_0x634b('0x3a')](),_0x2e4bdc)[_0x634b('0x38')](_0x634b('0x3b'),_0x634b('0x3c'))[_0x634b('0x38')](_0x634b('0x3b'),'updatedAt')[_0x634b('0x3d')]('cm_contacts')[_0x634b('0x3f')](_0x634b('0x40'))[_0x634b('0x3f')](_0x634b('0x41'),LISTID[_0x634b('0x3a')]())['where'](_0x634b('0x49'),squel[_0x634b('0x4a')](hopperContacts))['where'](_0x634b('0x4b')))['toString']();return _0x7dcf5b;}function _0x138318(_0x9aa107,_0x512503){var _0x5cd3ea=squel[_0x634b('0x44')]()[_0x634b('0x33')](_0x634b('0x4c'))[_0x634b('0x35')]([_0x634b('0x20'),_0x634b('0x39'),_0x634b('0x36'),_0x512503,_0x634b('0x3c'),'updatedAt'],squel['select']()[_0x634b('0x38')]('phone',_0x634b('0x20'))[_0x634b('0x38')]('id',_0x634b('0x39'))['field'](LISTID[_0x634b('0x3a')](),'ListId')[_0x634b('0x38')](_0x9aa107['id'][_0x634b('0x3a')](),_0x512503)['field'](_0x634b('0x3b'),_0x634b('0x3c'))['field'](_0x634b('0x3b'),_0x634b('0x37'))[_0x634b('0x3d')](_0x634b('0x3e'))['where']('deletedAt\x20IS\x20NULL')[_0x634b('0x3f')]('ListId\x20=\x20?',LISTID['toString']())[_0x634b('0x3f')](_0x634b('0x49'),squel[_0x634b('0x4a')](hopperContacts))[_0x634b('0x3f')](_0x634b('0x4b')))[_0x634b('0x3a')]();return _0x5cd3ea;}return db[_0x634b('0x4d')][_0x634b('0x4e')]({'where':{'type':'outbound'},'attributes':['id',_0x634b('0x4f')],'include':[{'model':db[_0x634b('0x50')],'as':_0x634b('0x51'),'where':{'id':LISTID}}]})[_0x634b('0x2c')](function(_0xf88eec){var _0xc7b444=[];if(_0xf88eec){var _0x4d12b9;for(var _0x5d20bb=0x0,_0xc68ec3;_0x5d20bb<_0xf88eec['length'];_0x5d20bb+=0x1){_0xc68ec3=_0xf88eec[_0x5d20bb][_0x634b('0x52')]({'plain':!![]});switch(_0xc68ec3[_0x634b('0x4f')]){case'always':_0xc7b444['push'](db['sequelize'][_0x634b('0x53')](_0x599594(_0xc68ec3,_0x634b('0x54')))[_0x634b('0x2c')](function(){})[_0x634b('0x2e')](_0x19dad3()));break;case _0x634b('0x55'):_0xc7b444[_0x634b('0x2d')](db[_0x634b('0x56')]['query'](_0x399eb4(_0xc68ec3,_0x634b('0x54')))[_0x634b('0x2c')](function(){})['catch'](_0x19dad3()));break;default:_0xc7b444[_0x634b('0x2d')](db[_0x634b('0x56')][_0x634b('0x53')](_0x2b0a80(_0xc68ec3,_0x634b('0x54')))[_0x634b('0x2c')](function(){})[_0x634b('0x2e')](_0x19dad3()));}}}return _0xc7b444;})[_0x634b('0x57')]()[_0x634b('0x2c')](function(){return db[_0x634b('0x4d')][_0x634b('0x4e')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x634b('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x634b('0x2c')](function(_0x3349c9){var _0xa6bf31=[];if(_0x3349c9){var _0x5dffae;for(var _0x9c95db=0x0,_0x899e43;_0x9c95db<_0x3349c9[_0x634b('0x28')];_0x9c95db+=0x1){_0x899e43=_0x3349c9[_0x9c95db][_0x634b('0x52')]({'plain':!![]});_0xa6bf31['push'](db['sequelize'][_0x634b('0x53')](_0x138318(_0x899e43,_0x634b('0x54')))[_0x634b('0x2c')](function(){})[_0x634b('0x2e')](_0x19dad3()));}}return _0xa6bf31;})[_0x634b('0x57')]();})[_0x634b('0x2c')](function(){return db[_0x634b('0x58')]['findAll']({'attributes':['id',_0x634b('0x4f')],'include':[{'model':db[_0x634b('0x50')],'as':_0x634b('0x51'),'where':{'id':LISTID}}]})[_0x634b('0x2c')](function(_0x530fc1){var _0x3365bd=[];if(_0x530fc1){for(var _0x3cfa37=0x0,_0x2e3ce1;_0x3cfa37<_0x530fc1[_0x634b('0x28')];_0x3cfa37+=0x1){_0x2e3ce1=_0x530fc1[_0x3cfa37]['get']({'plain':!![]});switch(_0x2e3ce1[_0x634b('0x4f')]){case _0x634b('0x59'):_0x3365bd[_0x634b('0x2d')](db[_0x634b('0x56')]['query'](_0x599594(_0x2e3ce1,'CampaignId'))[_0x634b('0x2c')](function(){})[_0x634b('0x2e')](_0x19dad3()));break;case _0x634b('0x55'):_0x3365bd[_0x634b('0x2d')](db[_0x634b('0x56')][_0x634b('0x53')](_0x399eb4(_0x2e3ce1,_0x634b('0x5a')))[_0x634b('0x2c')](function(){})[_0x634b('0x2e')](_0x19dad3()));break;default:_0x3365bd[_0x634b('0x2d')](db[_0x634b('0x56')][_0x634b('0x53')](_0x2b0a80(_0x2e3ce1,'CampaignId'))[_0x634b('0x2c')](function(){})[_0x634b('0x2e')](_0x19dad3()));}}}return _0x3365bd;})[_0x634b('0x57')]();})[_0x634b('0x2c')](function(){return db[_0x634b('0x58')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x634b('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x634b('0x2c')](function(_0x567702){var _0x5d2bc9=[];if(_0x567702){for(var _0x33fece=0x0,_0x473ee6;_0x33fece<_0x567702[_0x634b('0x28')];_0x33fece+=0x1){_0x473ee6=_0x567702[_0x33fece][_0x634b('0x52')]({'plain':!![]});_0x5d2bc9[_0x634b('0x2d')](db[_0x634b('0x56')][_0x634b('0x53')](_0x138318(_0x473ee6,_0x634b('0x5a')))[_0x634b('0x2c')](function(){})['catch'](_0x19dad3()));}}return _0x5d2bc9;})[_0x634b('0x57')]();})['catch'](function(_0x9994e5){logger['error'](_0x634b('0x5b'),'generalCheckHopper',_0x9994e5[_0x634b('0x1c')]);});}var processPromises=function(_0x1a770b){return BPromise[_0x634b('0x57')](promises)[_0x634b('0x2c')](function(_0x59c05f){})['catch'](function(_0x1c831a){logger['error']('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x1c831a));})[_0x634b('0x5c')](function(){socket[_0x634b('0x5d')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1a770b){return _0x1a770b[_0x634b('0x5e')]();}});};var endCsv=function(){return BPromise[_0x634b('0x5f')]()[_0x634b('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0x634b('0x2c')](function(){socket[_0x634b('0x5d')](_0x634b('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x634b('0x61')](FILEPATH);}catch(_0x38e454){logger['error'](_0x634b('0x62'),JSON[_0x634b('0x2f')](_0x38e454));}finally{process[_0x634b('0x63')](0x0);}});};process['on'](_0x634b('0x64'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x634b('0x5f')]()[_0x634b('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x634b('0x12')](',');return db[_0x634b('0x65')][_0x634b('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x48f9a5){var _0x457c86=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x634b('0x66')](_0x457c86,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4f9967,_0x4131b4){total+=0x1;var _0x50565b=total;promises[_0x634b('0x2d')](checkRow(_0x4f9967,_0x48f9a5,_0x50565b)[_0x634b('0x2c')](function(){success+=0x1;})['catch'](function(_0x4ecbd3){if(_0x4ecbd3[_0x634b('0x14')]){errors+=0x1;delete _0x4ecbd3[_0x634b('0x14')];}else if(_0x4ecbd3[_0x634b('0x2a')]){duplicates+=0x1;delete _0x4ecbd3[_0x634b('0x2a')];}rows['push'](_0x4ecbd3);}));if(total%0xc8===0x0){_0x4131b4[_0x634b('0x67')]();return processPromises(_0x4131b4);}},'complete':function(){return processPromises()['then'](function(){logger[_0x634b('0x68')](_0x634b('0x69'));endCsv();});},'error':function(_0x5ee2d1,_0x3de292){logger[_0x634b('0x68')](_0x634b('0x6a'),JSON['stringify'](_0x5ee2d1));endCsv();}});})['catch'](function(_0x157fe7){logger[_0x634b('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x634b('0x2f')](_0x157fe7));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index b7c6e38..13f0729 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 _0x7207=['isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','\x20not\x20specified','itemTypeId','description','appendFileSync','contact:import:','abort','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','emit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','firstName','firstName\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','CmContactHasItem','update','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','cm_contacts.ListId\x20=\x20','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.createdAt','.CmListId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','exit','code','message','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','utcOffset','set','offset','query','send','start','socket_timestamp','root','server/files/tmp','.csv','keys','ContactItemType','name','header','parse','createReadStream','data','rows','errors','find','_description','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)'];(function(_0x2c3feb,_0x235d58){var _0x2e650b=function(_0x2b377e){while(--_0x2b377e){_0x2c3feb['push'](_0x2c3feb['shift']());}};_0x2e650b(++_0x235d58);}(_0x7207,0xe1));var _0x7720=function(_0x55d6c0,_0x470ec7){_0x55d6c0=_0x55d6c0-0x0;var _0x3b6a7c=_0x7207[_0x55d6c0];return _0x3b6a7c;};'use strict';var fs=require('fs');var path=require(_0x7720('0x0'));var _=require(_0x7720('0x1'));var Papa=require(_0x7720('0x2'));var util=require(_0x7720('0x3'));var BPromise=require(_0x7720('0x4'));var moment=require(_0x7720('0x5'));var squel=require('squel');var Redis=require(_0x7720('0x6'));var db=require(_0x7720('0x7'))['db'];var config=require(_0x7720('0x8'));var shared=require(_0x7720('0x9'));var logger=require(_0x7720('0xa'))(_0x7720('0xb'));config[_0x7720('0xc')]=_[_0x7720('0xd')](config[_0x7720('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7720('0xe'))(new Redis(config[_0x7720('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7720('0xf')](_0x7720('0x10'));function isEmail(_0x366a53){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))*$/[_0x7720('0x11')](_0x366a53);}function selectNotIn(_0x53e51d,_0x358729,_0xf4d3fa,_0x4de679,_0x2cbe7d){return squel[_0x7720('0x12')]()[_0x7720('0x13')](_0x7720('0x14'))[_0x7720('0x15')](_0x4de679)[_0x7720('0x16')](_0x358729,null,_0x358729+_0x7720('0x17')+_0x4de679+'.'+_0xf4d3fa)[_0x7720('0x18')](_0x4de679+'.'+_0xf4d3fa+_0x7720('0x19')+_0x53e51d+'.'+_0xf4d3fa)[_0x7720('0x18')](_0x358729+'.dialCheckDuplicateType\x20IN\x20('+_0x2cbe7d[_0x7720('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1b88c9,_0x2d32b2){promisesAdditionalPhones=[];return db[_0x7720('0x1a')][_0x7720('0x1b')]({'raw':!![],'attributes':['id',_0x7720('0x1c')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7720('0x1d')](function(_0x54b38f){if(_0x54b38f!==null){var _0x195e6f=[];for(var _0x4f2459=0x0;_0x4f2459<_0x54b38f[_0x7720('0x1e')];_0x4f2459++){var _0x96a4fa=_0x54b38f[_0x4f2459];_0x195e6f[_0x7720('0x1f')](insertAdditionalPhones(_0x96a4fa));}}Promise[_0x7720('0x20')](_0x195e6f)['then'](function(){_0x1b88c9({'val':0x1});});});});}function insertAdditionalPhones(_0x3681b8){return new Promise(function(_0x1f76bb,_0xe771cb){var _0x5cb9a2=_0x3681b8[_0x7720('0x1c')];var _0x5bc646=_0x5cb9a2[_0x7720('0x21')](';');var _0x532823=[];orderBy=0x0;for(var _0x3bae3d=0x0;_0x3bae3d<_0x5bc646['length'];_0x3bae3d++){_0x532823[_0x7720('0x1f')](splitAdditionalPhone(_0x3681b8['id'],_0x5bc646[_0x3bae3d]));}Promise[_0x7720('0x20')](_0x532823)[_0x7720('0x1d')](function(){_0x1f76bb({'val':_0x5bc646['length']});});});}function splitAdditionalPhone(_0x4b1243,_0x19ab72){return new Promise(function(_0x44b715,_0x1283a8){var _0x1cb936=_0x19ab72['split'](':');var _0x1bcff6=_0x1cb936[0x0];var _0x6c2862=_0x1cb936[0x1];if(!_[_0x7720('0x22')](_0x6c2862)){var _0x8996c6=_0x6c2862[_0x7720('0x21')]('|');var _0x4681bf=[];for(var _0x5f3a03=0x0;_0x5f3a03<_0x8996c6['length'];_0x5f3a03++){if(_0x8996c6[_0x5f3a03]!==''){var _0x17fba3=_['filter'](promisesAdditionalPhones,{'contactId':_0x4b1243,'phone':_0x8996c6[_0x5f3a03]});if(_0x17fba3[_0x7720('0x1e')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x4b1243,'contactTypeId':_0x1bcff6,'phone':_0x8996c6[_0x5f3a03],'orderBy':orderBy});}}}_0x44b715({'ok':0x1});}else _0x44b715({'res':0x0});});}function createAdditionalPhone(_0x4df1f5,_0x315c81,_0x5e26a6,_0x160f06){var _0x46dd40='';var _0x21dafc='';var _0x25a169=_0x5e26a6['split']('§');_0x46dd40=_0x25a169[0x0];if(_0x25a169['length']==0x2)_0x21dafc=_0x25a169[0x1];return new Promise(function(_0x1c738f,_0x4f4cf2){return db[_0x7720('0x23')]['findOne']({'where':{'CmContactId':_0x4df1f5,'item':_0x46dd40}})[_0x7720('0x1d')](function(_0x3721d1){if(_0x3721d1){return db['CmContactHasItem'][_0x7720('0x24')]({'ItemTypeId':_0x315c81,'description':_0x21dafc,'OrderBy':_0x160f06},{'where':{'CmContactId':_0x4df1f5,'item':_0x46dd40}})[_0x7720('0x1d')](function(_0x500da9){_0x1c738f({'res':'updated'});});}else{return db[_0x7720('0x23')][_0x7720('0x25')]({'CmContactId':_0x4df1f5,'item':_0x46dd40,'description':_0x21dafc,'ItemTypeId':_0x315c81,'OrderBy':_0x160f06,'ItemClass':_0x7720('0x26')})['then'](function(_0x484a40){_0x1c738f({'res':_0x7720('0x27')});});}});});}function insertCmHopper(_0x5a9d73,_0xcc081c,_0x900d07,_0x792243,_0x54ff78){var _0x2f413c=['cm_contacts.phone',_0x7720('0x28'),_0x7720('0x29'),_0x7720('0x2a'),_0xcc081c+'.'+_0x792243,'cm_contacts.createdAt',_0x7720('0x2b'),_0x7720('0x2c'),_0x7720('0x2d'),'\x22'+_0x54ff78+'\x22'];return squel[_0x7720('0x2e')]()[_0x7720('0x2f')](_0x7720('0x30'))[_0x7720('0x31')]([_0x7720('0x14'),_0x7720('0x32'),_0x7720('0x33'),_0x7720('0x34'),_0x792243,_0x7720('0x35'),_0x7720('0x36'),_0x7720('0x37'),_0x7720('0x38'),_0x7720('0x39')],squel['select']()[_0x7720('0x3a')](_0x2f413c)[_0x7720('0x15')](_0xcc081c)[_0x7720('0x16')](_0x7720('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0xcc081c+'.CmListId')[_0x7720('0x16')](_0x900d07,null,_0x900d07+_0x7720('0x17')+_0xcc081c+'.'+_0x792243)[_0x7720('0x18')](_0xcc081c+_0x7720('0x3c'),_0x5a9d73)[_0x7720('0x18')](_0x7720('0x3d'),NOW)[_0x7720('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xcc081c,_0x900d07,_0x792243,_0x7720('0x30'),[_0x7720('0x3e'),_0x7720('0x3f')]))[_0x7720('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xcc081c,_0x900d07,_0x792243,_0x7720('0x30'),[_0x7720('0x3e')])))[_0x7720('0x40')]();}function insertCmHopperBlack(_0x5a2bd5,_0x553e78,_0x1649ca,_0x5d54bb){var _0x4c3156=['cm_contacts.phone',_0x7720('0x29'),'cm_contacts.ListId',_0x553e78+'.'+_0x5d54bb,'cm_contacts.createdAt',_0x7720('0x2b')];return squel[_0x7720('0x2e')]()['into'](_0x7720('0x41'))[_0x7720('0x31')](['phone',_0x7720('0x33'),_0x7720('0x34'),_0x5d54bb,'createdAt',_0x7720('0x36')],squel[_0x7720('0x12')]()['fields'](_0x4c3156)[_0x7720('0x15')](_0x553e78)['join'](_0x7720('0x3b'),null,_0x7720('0x42')+_0x553e78+'.CmListId')[_0x7720('0x16')](_0x1649ca,null,_0x1649ca+_0x7720('0x17')+_0x553e78+'.'+_0x5d54bb)['where'](_0x553e78+_0x7720('0x3c'),_0x5a2bd5)[_0x7720('0x18')](_0x7720('0x3d'),NOW)[_0x7720('0x18')](_0x7720('0x43'),squel[_0x7720('0x12')]()[_0x7720('0x13')](_0x7720('0x14'))['from'](_0x7720('0x41'))[_0x7720('0x18')](_0x7720('0x44'),_0x5a2bd5)[_0x7720('0x18')](_0x5d54bb+_0x7720('0x19')+_0x553e78+'.'+_0x5d54bb)))[_0x7720('0x40')]();}function insertTzCmHopper(_0x50fd39,_0x43bd63,_0x1de30d,_0x3d8abd,_0x54a89d,_0x5b0b5b){var _0x103f63=['cm_contacts.phone',_0x7720('0x45')+_0x5b0b5b+_0x7720('0x46'),_0x7720('0x29'),_0x7720('0x2a'),_0x43bd63+'.'+_0x3d8abd,_0x7720('0x47'),_0x7720('0x2b'),_0x7720('0x2c'),'cm_contacts.UserId','\x22'+_0x54a89d+'\x22'];var _0x1e771d=squel[_0x7720('0x2e')]()[_0x7720('0x2f')](_0x7720('0x30'))[_0x7720('0x31')]([_0x7720('0x14'),_0x7720('0x32'),_0x7720('0x33'),'ListId',_0x3d8abd,_0x7720('0x35'),_0x7720('0x36'),_0x7720('0x37'),_0x7720('0x38'),_0x7720('0x39')],squel[_0x7720('0x12')]()[_0x7720('0x3a')](_0x103f63)[_0x7720('0x15')](_0x43bd63)['join'](_0x7720('0x3b'),null,_0x7720('0x42')+_0x43bd63+_0x7720('0x48'))[_0x7720('0x16')](_0x1de30d,null,_0x1de30d+_0x7720('0x17')+_0x43bd63+'.'+_0x3d8abd)['join'](_0x5b0b5b,null,_0x5b0b5b+_0x7720('0x17')+_0x43bd63+'.'+_0x3d8abd)[_0x7720('0x18')](_0x43bd63+_0x7720('0x3c'),_0x50fd39)[_0x7720('0x18')](_0x7720('0x3d'),NOW)[_0x7720('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x43bd63,_0x1de30d,_0x3d8abd,_0x7720('0x30'),[_0x7720('0x3e'),_0x7720('0x3f')]))['where'](_0x7720('0x43'),selectNotIn(_0x43bd63,_0x1de30d,_0x3d8abd,_0x7720('0x30'),[_0x7720('0x3e')])))[_0x7720('0x40')]();return _0x1e771d;}function insertTzCmHopperBlack(_0x1f3860,_0x59eba9,_0x2d1f13,_0x414f4f){var _0x1e2f9f=['cm_contacts.phone',_0x7720('0x29'),_0x7720('0x2a'),_0x59eba9+'.'+_0x414f4f,'cm_contacts.createdAt',_0x7720('0x2b')];return squel[_0x7720('0x2e')]()[_0x7720('0x2f')](_0x7720('0x41'))['fromQuery']([_0x7720('0x14'),'ContactId','ListId',_0x414f4f,_0x7720('0x35'),_0x7720('0x36')],squel[_0x7720('0x12')]()[_0x7720('0x3a')](_0x1e2f9f)['from'](_0x59eba9)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x59eba9+_0x7720('0x48'))[_0x7720('0x16')](_0x2d1f13,null,_0x2d1f13+_0x7720('0x17')+_0x59eba9+'.'+_0x414f4f)[_0x7720('0x18')](_0x59eba9+_0x7720('0x3c'),_0x1f3860)[_0x7720('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7720('0x12')]()['field'](_0x7720('0x14'))['from'](_0x7720('0x41'))[_0x7720('0x18')](_0x7720('0x44'),_0x1f3860)[_0x7720('0x18')](_0x414f4f+_0x7720('0x19')+_0x59eba9+'.'+_0x414f4f)))[_0x7720('0x40')]();}function insertCmHopperAdditionalPhones(_0x4ed8f5){var _0x1c1336=[_0x7720('0x49'),_0x7720('0x4a'),'cm_contact_has_items.OrderBy',_0x7720('0x4b'),_0x7720('0x4c')];return squel[_0x7720('0x2e')]()[_0x7720('0x2f')](_0x7720('0x4d'))[_0x7720('0x31')]([_0x7720('0x4e'),_0x7720('0x14'),'OrderBy',_0x7720('0x35'),_0x7720('0x36')],squel[_0x7720('0x12')]()[_0x7720('0x3a')](_0x1c1336)[_0x7720('0x15')](_0x7720('0x30'))[_0x7720('0x16')](_0x7720('0x3b'),null,_0x7720('0x4f'))[_0x7720('0x16')](_0x7720('0x50'),null,_0x7720('0x51'))[_0x7720('0x18')]('cm_hopper.ListId\x20=\x20?',_0x4ed8f5)['where'](_0x7720('0x3d'),NOW))[_0x7720('0x40')]();}function insertCmContact(_0x482e91,_0xdf9a67,_0x2f1553,_0x20267d){var _0x3e047a=_[_0x7720('0x52')](_['keys'](_0x20267d),[_0x7720('0x34'),'CompanyId','createdAt','updatedAt',_0x7720('0x53')]);return squel[_0x7720('0x2e')]()[_0x7720('0x2f')]('cm_contacts')[_0x7720('0x31')](_0x3e047a,squel[_0x7720('0x12')]()[_0x7720('0x3a')](_0x3e047a)[_0x7720('0x15')](_0xdf9a67)[_0x7720('0x18')]('('+_0x2f1553[_0x7720('0x16')](',')+_0x7720('0x54'),squel[_0x7720('0x12')]()[_0x7720('0x3a')](_0x2f1553)[_0x7720('0x15')](_0x7720('0x3b'))['where'](_0x7720('0x44'),_0x482e91)['where'](_0x7720('0x55')))[_0x7720('0x18')](_0x7720('0x56'),squel[_0x7720('0x12')]()[_0x7720('0x13')]('MIN(id)',_0x7720('0x57'))[_0x7720('0x15')](_0xdf9a67)[_0x7720('0x58')](_0x2f1553[_0x7720('0x16')](','))))[_0x7720('0x40')]();}function handleStop(){logger[_0x7720('0x59')](_0x7720('0x5a'));stopped=!![];}function handleUncaughtException(_0x5126b8){logger[_0x7720('0x5b')](_0x5126b8['message']);process[_0x7720('0x5c')](0x1);}function handleError(_0x2accc6,_0xafe6db){stats['errors'][_0x7720('0x1f')]({'name':_0xafe6db[_0x7720('0x5d')],'message':_0xafe6db[_0x7720('0x5e')],'row':_0x2accc6});}function handleQuery(_0x3fefec){logger[_0x7720('0x59')](_0x3fefec);return db[_0x7720('0x5f')]['query'](_0x3fefec)[_0x7720('0x60')](function(_0x1bfe97){results[_0x7720('0x1f')](_0x1bfe97);})[_0x7720('0x61')](function(_0x1bfce0){logger[_0x7720('0x5b')](_0x1bfce0[_0x7720('0x5e')]);});}function updateTzCampaigns(_0xb527ab){return new Promise(function(_0x11075f,_0x3f9cb9){var _0x550d73=squel[_0x7720('0x12')]()['fields']([_0x7720('0x62'),_0x7720('0x63')])[_0x7720('0x15')](_0x7720('0x64'))[_0x7720('0x16')](_0x7720('0x65'),null,_0x7720('0x66'))['where'](_0x7720('0x67')+_0xb527ab);db[_0x7720('0x5f')]['query'](_0x550d73['toString']())[_0x7720('0x60')](function(_0x2fb17a){var _0x21fa0d=[];for(var _0x31f284=0x0;_0x31f284<_0x2fb17a['length'];_0x31f284++){_0x21fa0d[_0x7720('0x1f')](getTimezoneData(_0x2fb17a[_0x31f284],tmp_campaigns));}BPromise[_0x7720('0x20')](_0x21fa0d)[_0x7720('0x1d')](function(){_0x11075f({'val':0x1});});})[_0x7720('0x61')](function(_0xaae6de){logger['error'](_0xaae6de[_0x7720('0x5e')]);_0x11075f({'val':0x0});});});}function updateTzVoiceQueues(_0x5f1d61){return new Promise(function(_0x3f9f2c,_0x547632){var _0x51c0da=squel[_0x7720('0x12')]()[_0x7720('0x3a')]([_0x7720('0x68'),_0x7720('0x69')])[_0x7720('0x15')](_0x7720('0x6a'))[_0x7720('0x16')](_0x7720('0x6b'),null,_0x7720('0x6c'))['where'](_0x7720('0x6d')+_0x5f1d61);db[_0x7720('0x5f')]['query'](_0x51c0da['toString']())[_0x7720('0x60')](function(_0x5c45a0){var _0x1da66d=[];for(var _0x157461=0x0;_0x157461<_0x5c45a0[_0x7720('0x1e')];_0x157461++){_0x1da66d[_0x7720('0x1f')](getTimezoneData(_0x5c45a0[_0x157461],tmp_voice_queues));}BPromise[_0x7720('0x20')](_0x1da66d)[_0x7720('0x1d')](function(){_0x3f9f2c({'val':0x1});});})['catch'](function(_0x3be73e){logger[_0x7720('0x5b')](_0x3be73e[_0x7720('0x5e')]);_0x3f9f2c({'val':0x0});});});}function getTimezoneData(_0x3de782,_0xdbf2fd){return new Promise(function(_0x353de5,_0x1e065f){var _0x2783bd=shared['timezones'];var _0x212dde=_0x2783bd[_0x3de782[_0x7720('0x6e')]];if(_[_0x7720('0x22')](_0x212dde)){_0x353de5({'ret':0x1});}else{var _0x2d1364=_0x212dde[_0x7720('0x6f')];var _0x3ed2a1=squel[_0x7720('0x2e')]()[_0x7720('0x2f')](_0xdbf2fd)[_0x7720('0x70')]('id',_0x3de782['id'])[_0x7720('0x70')](_0x7720('0x71'),_0x2d1364)[_0x7720('0x70')](_0x7720('0x6e'),_0x3de782[_0x7720('0x6e')])['toString']();return db[_0x7720('0x5f')][_0x7720('0x72')](_0x3ed2a1)['spread'](function(_0x2ec1c2){_0x353de5({'ret':0x1});})[_0x7720('0x61')](function(_0x193f43){logger[_0x7720('0x5b')](_0x193f43[_0x7720('0x5e')]);_0x1e065f({'ret':0x1});});}});}function handleTZQuery(_0x179597){logger[_0x7720('0x59')](_0x179597);return db[_0x7720('0x5f')][_0x7720('0x72')](_0x179597)[_0x7720('0x60')](function(_0x403b66){})['catch'](function(_0x53d354){logger[_0x7720('0x5b')](_0x53d354['message']);});}function main(_0x283607,_0xd776b1,_0x3f4864,_0x572292){logger[_0x7720('0x59')]('main',_0x283607,JSON['stringify'](_0xd776b1));process[_0x7720('0x73')](_0x7720('0x74'));var _0x3fec45=_0xd776b1['binding'];var _0x4f9cde=_['clone'](_0x3fec45);var _0x455a27=_0xd776b1[_0x7720('0x75')];var _0x5ac8e6=path[_0x7720('0x16')](config[_0x7720('0x76')],_0x7720('0x77'),_0x455a27+_0x7720('0x78'));hasTZ=_[_0x7720('0x79')](_0x3fec45)['includes'](_0x7720('0x6e'));var _0x98ee98=_['keys'](_0x3fec45)['join']();logger[_0x7720('0x59')]('header',_0x98ee98);db[_0x7720('0x7a')][_0x7720('0x1b')]({'raw':!![],'attributes':['id',_0x7720('0x7b')]})[_0x7720('0x1d')](function(_0x3dd063){for(var _0x367fc6=0x0;_0x367fc6<_0x3dd063['length'];_0x367fc6++){if(_0x3dd063[_0x367fc6]['name']in _0x3fec45){contactItemTypes['push'](_0x3dd063[_0x367fc6]);delete _0x4f9cde[_0x3dd063[_0x367fc6][_0x7720('0x7b')]];hasAdditionalPhones=!![];}for(var _0x6a53a8 in _0x3fec45){if(_0x3dd063[_0x367fc6]['name']+'_description'===_0x6a53a8){phoneDescriptions['push']({'itemTypeId':_0x3dd063[_0x367fc6]['id'],'description':_0x6a53a8});delete _0x4f9cde[_0x6a53a8];}}}if(hasAdditionalPhones)_0x4f9cde[_0x7720('0x1c')]='';var _0x3879ae=_[_0x7720('0x79')](_0x4f9cde)[_0x7720('0x16')]();logger['info'](_0x7720('0x7c'),_0x3879ae);fs['writeFileSync'](_0x5ac8e6,_0x3879ae+'\x0a');Papa[_0x7720('0x7d')](fs[_0x7720('0x7e')](_0x283607),{'header':!![],'skipEmptyLines':!![],'step':function(_0x372891,_0x6a751c){try{for(var _0x87ef8=0x0,_0x3a2961=[];_0x87ef8<_0x372891[_0x7720('0x7f')][_0x7720('0x1e')];_0x87ef8++){stats[_0x7720('0x80')]+=0x1;if(_0x372891[_0x7720('0x81')][_0x87ef8]){handleError(_0x372891[_0x7720('0x7f')][_0x87ef8],_0x372891[_0x7720('0x81')][_0x87ef8]);}else{var _0x412610=[];var _0x166640=[];var _0x1dfa32={};for(var _0x2626da in _0x3fec45){let _0x196fc3=contactItemTypes['find'](_0x29203d=>_0x29203d[_0x7720('0x7b')]===_0x2626da);let _0x2030c9=contactItemTypes[_0x7720('0x82')](_0x256c0b=>_0x256c0b['name']+_0x7720('0x83')===_0x2626da);if(_[_0x7720('0x22')](_0x196fc3)&&_[_0x7720('0x22')](_0x2030c9)){if(_0x3fec45[_0x7720('0x84')](_0x2626da)){if(_0x372891['data'][_0x87ef8][_0x3fec45[_0x2626da]]){var _0x3bd6c7=_[_0x7720('0x85')](_0x372891[_0x7720('0x7f')][_0x87ef8][_0x3fec45[_0x2626da]][_0x7720('0x86')](/"/g,'\x27'));switch(_0x2626da){case _0x7720('0x32'):var _0x379f01=moment(_0x3bd6c7,_0x7720('0x10'),!![]);if(_0x379f01[_0x7720('0x87')]()){_0x3a2961[_0x7720('0x1f')]('\x22'+_0x3bd6c7+'\x22');}else{_0x412610[_0x7720('0x1f')](_0x7720('0x88'));}break;case _0x7720('0x37'):var _0x4e2c48=parseInt(_0x3bd6c7);_0x3bd6c7=_[_0x7720('0x89')](_0x4e2c48)||_0x4e2c48<0x0||_0x4e2c48>0x4?_0x572292?0x3:0x2:_0x4e2c48;_0x3a2961[_0x7720('0x1f')]('\x22'+_0x3bd6c7+'\x22');break;case _0x7720('0x38'):var _0x43bdd7=parseInt(_0x3bd6c7);if(_[_0x7720('0x8a')](_0x43bdd7)&&_[_0x7720('0x8b')](_0x3f4864,_0x43bdd7)){_0x3a2961[_0x7720('0x1f')]('\x22'+_0x43bdd7+'\x22');}else{_0x412610[_0x7720('0x1f')](_0x7720('0x8c'));}break;case _0x7720('0x8d'):if(isEmail(_0x3bd6c7)){_0x3a2961[_0x7720('0x1f')]('\x22'+_0x3bd6c7+'\x22');}else{_0x412610['push']('email\x20wrong\x20format');}break;case _0x7720('0x8e'):var _0xcece2e=moment(_0x3bd6c7,'YYYY-MM-DD',!![]);if(_0xcece2e[_0x7720('0x87')]()){_0x3a2961['push']('\x22'+_0x3bd6c7+'\x22');}else{_0x412610[_0x7720('0x1f')](_0x7720('0x8f'));}break;case'dialTimezone':var _0xdde105=shared[_0x7720('0x90')];var _0x3a209a=_0xdde105[_0x3bd6c7];if(!_[_0x7720('0x22')](_0x3a209a)){var _0x85e00=_0x3a209a[_0x7720('0x6f')];_0x3a2961['push']('\x22'+_0x3bd6c7+'\x22');_0x3a2961[_0x7720('0x1f')]('\x22'+_0x85e00+'\x22');}break;default:_0x3a2961[_0x7720('0x1f')]('\x22'+_0x3bd6c7+'\x22');}}else{switch(_0x2626da){case'firstName':case _0x7720('0x14'):_0x412610['push'](_0x2626da+_0x7720('0x91'));break;default:_0x3a2961[_0x7720('0x1f')]('\x22\x22');}}}}else{var _0x184645='';if(!_[_0x7720('0x22')](_0x196fc3)){if(!_0x1dfa32[_0x7720('0x84')](_0x196fc3['id'])){if(!_[_0x7720('0x22')](_0x372891[_0x7720('0x7f')][_0x87ef8][_0x3fec45[_0x2626da]])){var _0x3bd6c7=_[_0x7720('0x85')](_0x372891[_0x7720('0x7f')][_0x87ef8][_0x3fec45[_0x2626da]][_0x7720('0x86')](/"/g,'\x27'));var _0x172788=phoneDescriptions[_0x7720('0x82')](_0x5b7807=>_0x5b7807[_0x7720('0x92')]===_0x196fc3['id']);if(!_[_0x7720('0x22')](_0x172788)){var _0x5efeda=_[_0x7720('0x85')](_0x372891[_0x7720('0x7f')][_0x87ef8][_0x3fec45[_0x172788[_0x7720('0x93')]]][_0x7720('0x86')](/"/g,'\x27'));if(!_[_0x7720('0x22')](_0x5efeda))_0x3bd6c7=_0x3bd6c7+'§'+_0x5efeda;}if(_0x184645=='')_0x184645=_0x3bd6c7;else _0x184645+='|'+_0x3bd6c7;}_0x166640[_0x7720('0x1f')](_0x196fc3['id']+':'+_0x184645);_0x1dfa32[_0x196fc3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3a2961[_0x7720('0x1f')]('\x22'+_0x166640[_0x7720('0x16')](';')+'\x22');}if(_0x412610['length']){handleError(_0x372891[_0x7720('0x7f')][_0x87ef8],{'code':'SystemRow','message':_0x412610[_0x7720('0x16')]()});}else{fs[_0x7720('0x94')](_0x5ac8e6,_0x3a2961['join']()+'\x0a');}_0x3a2961=[];}if(!(stats[_0x7720('0x80')]%0xc8)){socket['emit'](_0x7720('0x95')+_0x455a27,stats);stats[_0x7720('0x81')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x6a751c[_0x7720('0x96')]();}}catch(_0x300de5){handleError(_0x372891[_0x7720('0x7f')][_0x87ef8],{'code':'SystemError','message':_0x300de5[_0x7720('0x5e')]});logger[_0x7720('0x5b')]('step',_0x300de5['message']);}},'complete':function(){try{var _0x2e0d4e=[];var _0x28db7e=[];var _0x43edf6=_0x7720('0x3b');if(_0xd776b1[_0x7720('0x97')]&&_0xd776b1[_0x7720('0x97')][_0x7720('0x1e')]){_0x43edf6=_0x7720('0x98')+_0x455a27;_0x2e0d4e[_0x7720('0x1f')](_0x7720('0x99')+_0x43edf6+_0x7720('0x9a'));}tmp_campaigns=_0x7720('0x9b')+_0x455a27;tmp_voice_queues=_0x7720('0x9c')+_0x455a27;_0x28db7e[_0x7720('0x1f')](_0x7720('0x99')+tmp_campaigns+_0x7720('0x9d'));_0x28db7e[_0x7720('0x1f')](_0x7720('0x99')+tmp_voice_queues+_0x7720('0x9d'));BPromise['each'](_0x28db7e,handleTZQuery)[_0x7720('0x1d')](function(_0x2a7951){updateTzCampaigns(_0xd776b1[_0x7720('0x34')])['then'](function(_0x5d81fe){updateTzVoiceQueues(_0xd776b1[_0x7720('0x34')])[_0x7720('0x1d')](function(_0x74eefa){if(hasTZ)_0x3879ae=_0x3879ae[_0x7720('0x86')](_0x7720('0x6e'),'dialTimezone,utcOffset');var _0x13b347=util[_0x7720('0xf')]('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',_0x5ac8e6,_0x43edf6,_0x3879ae,_0xd776b1['ListId'],_0xd776b1[_0x7720('0x9e')]||null,NOW,NOW);if(_[_0x7720('0x22')](_0x3fec45[_0x7720('0x32')])){_0x13b347+=_0x7720('0x9f');}_0x2e0d4e[_0x7720('0x1f')](_0x13b347);if(_0xd776b1[_0x7720('0x97')]&&_0xd776b1[_0x7720('0x97')][_0x7720('0x1e')]){_0x2e0d4e[_0x7720('0x1f')](insertCmContact(_0xd776b1[_0x7720('0x34')],_0x43edf6,_0xd776b1[_0x7720('0x97')],_0x3fec45));_0x2e0d4e[_0x7720('0x1f')]('DROP\x20TABLE\x20'+_0x43edf6+';');}BPromise[_0x7720('0xa0')](_0x2e0d4e,handleQuery)[_0x7720('0x1d')](function(_0x37ca30){BPromise[_0x7720('0x20')]([handleAdditionalPhones()])[_0x7720('0x1d')](function(){_0x2e0d4e=[];for(var _0x3e4f50=0x0;_0x3e4f50\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','all','then','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','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','cm_hopper','fromQuery','ContactId','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper_black'];(function(_0x2fb0e5,_0x45e57a){var _0x584d1f=function(_0x551080){while(--_0x551080){_0x2fb0e5['push'](_0x2fb0e5['shift']());}};_0x584d1f(++_0x45e57a);}(_0x821d,0x131));var _0xd821=function(_0x2c0ae5,_0x1a90c9){_0x2c0ae5=_0x2c0ae5-0x0;var _0x1bc277=_0x821d[_0x2c0ae5];return _0x1bc277;};'use strict';var fs=require('fs');var path=require(_0xd821('0x0'));var _=require(_0xd821('0x1'));var Papa=require(_0xd821('0x2'));var util=require(_0xd821('0x3'));var BPromise=require('bluebird');var moment=require(_0xd821('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0xd821('0x5'));var logger=require(_0xd821('0x6'))(_0xd821('0x7'));config[_0xd821('0x8')]=_[_0xd821('0x9')](config[_0xd821('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd821('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xd821('0xa')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xd821('0xa')](_0xd821('0xb'));function isEmail(_0x6310fa){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))*$/[_0xd821('0xc')](_0x6310fa);}function selectNotIn(_0x497908,_0x45d709,_0x6685aa,_0x5274c0,_0x1e278b){return squel[_0xd821('0xd')]()[_0xd821('0xe')](_0xd821('0xf'))['from'](_0x5274c0)[_0xd821('0x10')](_0x45d709,null,_0x45d709+_0xd821('0x11')+_0x5274c0+'.'+_0x6685aa)[_0xd821('0x12')](_0x5274c0+'.'+_0x6685aa+_0xd821('0x13')+_0x497908+'.'+_0x6685aa)[_0xd821('0x12')](_0x45d709+_0xd821('0x14')+_0x1e278b['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0xd2b6ea,_0x3b9587){promisesAdditionalPhones=[];return db[_0xd821('0x15')][_0xd821('0x16')]({'raw':!![],'attributes':['id',_0xd821('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x27099e){if(_0x27099e!==null){var _0x4df37f=[];for(var _0x38dfa2=0x0;_0x38dfa2<_0x27099e[_0xd821('0x18')];_0x38dfa2++){var _0x2041d3=_0x27099e[_0x38dfa2];_0x4df37f[_0xd821('0x19')](insertAdditionalPhones(_0x2041d3));}}Promise[_0xd821('0x1a')](_0x4df37f)[_0xd821('0x1b')](function(){_0xd2b6ea({'val':0x1});});});});}function insertAdditionalPhones(_0x4aa5c6){return new Promise(function(_0x45f135,_0x5dc757){var _0x588ea1=_0x4aa5c6['AdditionalPhones'];var _0x14d88f=_0x588ea1['split'](';');var _0x3c33f8=[];orderBy=0x0;for(var _0x2ca1fc=0x0;_0x2ca1fc<_0x14d88f['length'];_0x2ca1fc++){_0x3c33f8[_0xd821('0x19')](splitAdditionalPhone(_0x4aa5c6['id'],_0x14d88f[_0x2ca1fc]));}Promise[_0xd821('0x1a')](_0x3c33f8)['then'](function(){_0x45f135({'val':_0x14d88f['length']});});});}function splitAdditionalPhone(_0x3bf26c,_0x189991){return new Promise(function(_0x5eb536,_0x2c524e){var _0x23a994=_0x189991[_0xd821('0x1c')](':');var _0x3e40b3=_0x23a994[0x0];var _0x3ac7dd=_0x23a994[0x1];if(!_[_0xd821('0x1d')](_0x3ac7dd)){var _0x5c6fbe=_0x3ac7dd[_0xd821('0x1c')]('|');var _0x4e3741=[];for(var _0x6bf0c5=0x0;_0x6bf0c5<_0x5c6fbe['length'];_0x6bf0c5++){if(_0x5c6fbe[_0x6bf0c5]!==''){var _0x4fefd1=_[_0xd821('0x1e')](promisesAdditionalPhones,{'contactId':_0x3bf26c,'phone':_0x5c6fbe[_0x6bf0c5]});if(_0x4fefd1['length']==0x0){orderBy++;promisesAdditionalPhones[_0xd821('0x19')]({'contactId':_0x3bf26c,'contactTypeId':_0x3e40b3,'phone':_0x5c6fbe[_0x6bf0c5],'orderBy':orderBy});}}}_0x5eb536({'ok':0x1});}else _0x5eb536({'res':0x0});});}function createAdditionalPhone(_0x4950e2,_0x307173,_0x3b9d90,_0x427c52){var _0x4c6d13='';var _0x208861='';var _0x6831f2=_0x3b9d90[_0xd821('0x1c')]('§');_0x4c6d13=_0x6831f2[0x0];if(_0x6831f2[_0xd821('0x18')]==0x2)_0x208861=_0x6831f2[0x1];return new Promise(function(_0x5d8e29,_0x3e5933){return db[_0xd821('0x1f')][_0xd821('0x20')]({'where':{'CmContactId':_0x4950e2,'item':_0x4c6d13}})[_0xd821('0x1b')](function(_0x20c954){if(_0x20c954){return db[_0xd821('0x1f')][_0xd821('0x21')]({'ItemTypeId':_0x307173,'description':_0x208861,'OrderBy':_0x427c52},{'where':{'CmContactId':_0x4950e2,'item':_0x4c6d13}})[_0xd821('0x1b')](function(_0x485d03){_0x5d8e29({'res':_0xd821('0x22')});});}else{return db[_0xd821('0x1f')][_0xd821('0x23')]({'CmContactId':_0x4950e2,'item':_0x4c6d13,'description':_0x208861,'ItemTypeId':_0x307173,'OrderBy':_0x427c52,'ItemClass':_0xd821('0x24')})[_0xd821('0x1b')](function(_0x47ffbe){_0x5d8e29({'res':'inserted'});});}});});}function insertCmHopper(_0x494311,_0x3abd5e,_0x2ab4cd,_0x146cb5,_0x450d2b){var _0x3f19b7=[_0xd821('0x25'),_0xd821('0x26'),_0xd821('0x27'),_0xd821('0x28'),_0x3abd5e+'.'+_0x146cb5,_0xd821('0x29'),_0xd821('0x2a'),_0xd821('0x2b'),_0xd821('0x2c'),'\x22'+_0x450d2b+'\x22'];return squel[_0xd821('0x2d')]()[_0xd821('0x2e')](_0xd821('0x2f'))[_0xd821('0x30')]([_0xd821('0xf'),'scheduledat',_0xd821('0x31'),'ListId',_0x146cb5,'createdAt',_0xd821('0x32'),_0xd821('0x33'),_0xd821('0x34'),_0xd821('0x35')],squel[_0xd821('0xd')]()[_0xd821('0x36')](_0x3f19b7)[_0xd821('0x37')](_0x3abd5e)[_0xd821('0x10')](_0xd821('0x38'),null,_0xd821('0x39')+_0x3abd5e+'.CmListId')['join'](_0x2ab4cd,null,_0x2ab4cd+_0xd821('0x11')+_0x3abd5e+'.'+_0x146cb5)[_0xd821('0x12')](_0x3abd5e+_0xd821('0x3a'),_0x494311)[_0xd821('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xd821('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3abd5e,_0x2ab4cd,_0x146cb5,_0xd821('0x2f'),[_0xd821('0x3b'),_0xd821('0x3c')]))[_0xd821('0x12')](_0xd821('0x3d'),selectNotIn(_0x3abd5e,_0x2ab4cd,_0x146cb5,'cm_hopper',[_0xd821('0x3b')])))['toString']();}function insertCmHopperBlack(_0x33d27a,_0x2ad6dc,_0x2b37c5,_0x1a2ab0){var _0x34ee0c=[_0xd821('0x25'),_0xd821('0x27'),_0xd821('0x28'),_0x2ad6dc+'.'+_0x1a2ab0,'cm_contacts.createdAt',_0xd821('0x2a')];return squel[_0xd821('0x2d')]()[_0xd821('0x2e')](_0xd821('0x3e'))['fromQuery']([_0xd821('0xf'),_0xd821('0x31'),_0xd821('0x3f'),_0x1a2ab0,_0xd821('0x40'),'updatedAt'],squel[_0xd821('0xd')]()[_0xd821('0x36')](_0x34ee0c)[_0xd821('0x37')](_0x2ad6dc)[_0xd821('0x10')](_0xd821('0x38'),null,_0xd821('0x39')+_0x2ad6dc+_0xd821('0x41'))[_0xd821('0x10')](_0x2b37c5,null,_0x2b37c5+_0xd821('0x11')+_0x2ad6dc+'.'+_0x1a2ab0)[_0xd821('0x12')](_0x2ad6dc+_0xd821('0x3a'),_0x33d27a)['where'](_0xd821('0x42'),NOW)[_0xd821('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xd821('0xd')]()[_0xd821('0xe')](_0xd821('0xf'))[_0xd821('0x37')](_0xd821('0x3e'))['where']('ListId\x20=\x20?',_0x33d27a)['where'](_0x1a2ab0+_0xd821('0x13')+_0x2ad6dc+'.'+_0x1a2ab0)))['toString']();}function insertTzCmHopper(_0x39d086,_0x331e08,_0x1ddf46,_0x1bc17e,_0xf2d098,_0x49fe58){var _0x778590=[_0xd821('0x25'),_0xd821('0x43')+_0x49fe58+_0xd821('0x44'),_0xd821('0x27'),_0xd821('0x28'),_0x331e08+'.'+_0x1bc17e,_0xd821('0x29'),_0xd821('0x2a'),_0xd821('0x2b'),_0xd821('0x2c'),'\x22'+_0xf2d098+'\x22'];var _0x40f310=squel[_0xd821('0x2d')]()[_0xd821('0x2e')](_0xd821('0x2f'))['fromQuery']([_0xd821('0xf'),_0xd821('0x45'),_0xd821('0x31'),_0xd821('0x3f'),_0x1bc17e,_0xd821('0x40'),_0xd821('0x32'),'priority',_0xd821('0x34'),_0xd821('0x35')],squel[_0xd821('0xd')]()[_0xd821('0x36')](_0x778590)[_0xd821('0x37')](_0x331e08)[_0xd821('0x10')](_0xd821('0x38'),null,_0xd821('0x39')+_0x331e08+_0xd821('0x41'))[_0xd821('0x10')](_0x1ddf46,null,_0x1ddf46+_0xd821('0x11')+_0x331e08+'.'+_0x1bc17e)[_0xd821('0x10')](_0x49fe58,null,_0x49fe58+'.id\x20=\x20'+_0x331e08+'.'+_0x1bc17e)[_0xd821('0x12')](_0x331e08+_0xd821('0x3a'),_0x39d086)[_0xd821('0x12')](_0xd821('0x42'),NOW)['where'](_0xd821('0x3d'),selectNotIn(_0x331e08,_0x1ddf46,_0x1bc17e,_0xd821('0x2f'),[_0xd821('0x3b'),_0xd821('0x3c')]))[_0xd821('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x331e08,_0x1ddf46,_0x1bc17e,'cm_hopper',[_0xd821('0x3b')])))[_0xd821('0x46')]();return _0x40f310;}function insertTzCmHopperBlack(_0x15516a,_0x306d00,_0x4ce42c,_0x2d4e71){var _0x4e1093=[_0xd821('0x25'),_0xd821('0x27'),'cm_contacts.ListId',_0x306d00+'.'+_0x2d4e71,_0xd821('0x29'),_0xd821('0x2a')];return squel[_0xd821('0x2d')]()[_0xd821('0x2e')](_0xd821('0x3e'))[_0xd821('0x30')]([_0xd821('0xf'),_0xd821('0x31'),_0xd821('0x3f'),_0x2d4e71,_0xd821('0x40'),'updatedAt'],squel[_0xd821('0xd')]()['fields'](_0x4e1093)[_0xd821('0x37')](_0x306d00)[_0xd821('0x10')](_0xd821('0x38'),null,_0xd821('0x39')+_0x306d00+_0xd821('0x41'))['join'](_0x4ce42c,null,_0x4ce42c+_0xd821('0x11')+_0x306d00+'.'+_0x2d4e71)['where'](_0x306d00+_0xd821('0x3a'),_0x15516a)[_0xd821('0x12')](_0xd821('0x42'),NOW)['where'](_0xd821('0x3d'),squel['select']()[_0xd821('0xe')](_0xd821('0xf'))[_0xd821('0x37')]('cm_hopper_black')[_0xd821('0x12')](_0xd821('0x47'),_0x15516a)['where'](_0x2d4e71+_0xd821('0x13')+_0x306d00+'.'+_0x2d4e71)))[_0xd821('0x46')]();}function insertCmHopperAdditionalPhones(_0x55703c){var _0x5bdede=[_0xd821('0x48'),_0xd821('0x49'),_0xd821('0x4a'),'cm_contact_has_items.createdAt',_0xd821('0x4b')];return squel[_0xd821('0x2d')]()[_0xd821('0x2e')](_0xd821('0x4c'))[_0xd821('0x30')]([_0xd821('0x4d'),_0xd821('0xf'),_0xd821('0x4e'),'createdAt',_0xd821('0x32')],squel[_0xd821('0xd')]()[_0xd821('0x36')](_0x5bdede)[_0xd821('0x37')]('cm_hopper')[_0xd821('0x10')](_0xd821('0x38'),null,_0xd821('0x4f'))[_0xd821('0x10')](_0xd821('0x50'),null,_0xd821('0x51'))[_0xd821('0x12')](_0xd821('0x52'),_0x55703c)[_0xd821('0x12')](_0xd821('0x42'),NOW))['toString']();}function insertCmContact(_0x31cd20,_0x5bd864,_0x2edf0b,_0x59fdb8){var _0xfb641a=_['concat'](_[_0xd821('0x53')](_0x59fdb8),[_0xd821('0x3f'),'CompanyId',_0xd821('0x40'),_0xd821('0x32'),_0xd821('0x54')]);return squel[_0xd821('0x2d')]()[_0xd821('0x2e')](_0xd821('0x38'))[_0xd821('0x30')](_0xfb641a,squel[_0xd821('0xd')]()['fields'](_0xfb641a)[_0xd821('0x37')](_0x5bd864)[_0xd821('0x12')]('('+_0x2edf0b['join'](',')+_0xd821('0x55'),squel['select']()[_0xd821('0x36')](_0x2edf0b)[_0xd821('0x37')](_0xd821('0x38'))[_0xd821('0x12')](_0xd821('0x47'),_0x31cd20)[_0xd821('0x12')](_0xd821('0x56')))['where']('id\x20IN\x20?',squel[_0xd821('0xd')]()[_0xd821('0xe')](_0xd821('0x57'),_0xd821('0x58'))[_0xd821('0x37')](_0x5bd864)[_0xd821('0x59')](_0x2edf0b[_0xd821('0x10')](','))))[_0xd821('0x46')]();}function handleStop(){logger['info'](_0xd821('0x5a'));stopped=!![];}function handleUncaughtException(_0x170577){logger[_0xd821('0x5b')](_0x170577[_0xd821('0x5c')]);process[_0xd821('0x5d')](0x1);}function handleError(_0xdc9cad,_0x206baf){stats[_0xd821('0x5e')]['push']({'name':_0x206baf[_0xd821('0x5f')],'message':_0x206baf[_0xd821('0x5c')],'row':_0xdc9cad});}function handleQuery(_0x519434){logger['info'](_0x519434);return db[_0xd821('0x60')][_0xd821('0x61')](_0x519434)[_0xd821('0x62')](function(_0xa67bbc){results['push'](_0xa67bbc);})[_0xd821('0x63')](function(_0x90d45f){logger[_0xd821('0x5b')](_0x90d45f[_0xd821('0x5c')]);});}function updateTzCampaigns(_0x2d5e69){return new Promise(function(_0x5c5d6c,_0x179ea3){var _0x4fa011=squel[_0xd821('0xd')]()[_0xd821('0x36')]([_0xd821('0x64'),_0xd821('0x65')])[_0xd821('0x37')](_0xd821('0x66'))[_0xd821('0x10')](_0xd821('0x67'),null,_0xd821('0x68'))[_0xd821('0x12')](_0xd821('0x69')+_0x2d5e69);db['sequelize'][_0xd821('0x61')](_0x4fa011['toString']())[_0xd821('0x62')](function(_0x4d1f84){var _0x246df5=[];for(var _0x3dc2f2=0x0;_0x3dc2f2<_0x4d1f84[_0xd821('0x18')];_0x3dc2f2++){_0x246df5[_0xd821('0x19')](getTimezoneData(_0x4d1f84[_0x3dc2f2],tmp_campaigns));}BPromise['all'](_0x246df5)[_0xd821('0x1b')](function(){_0x5c5d6c({'val':0x1});});})[_0xd821('0x63')](function(_0x4eb273){logger[_0xd821('0x5b')](_0x4eb273['message']);_0x5c5d6c({'val':0x0});});});}function updateTzVoiceQueues(_0x1751b0){return new Promise(function(_0x58dd5f,_0x14460d){var _0x31686b=squel['select']()['fields']([_0xd821('0x6a'),_0xd821('0x6b')])[_0xd821('0x37')](_0xd821('0x6c'))['join'](_0xd821('0x6d'),null,_0xd821('0x6e'))[_0xd821('0x12')](_0xd821('0x6f')+_0x1751b0);db[_0xd821('0x60')][_0xd821('0x61')](_0x31686b['toString']())[_0xd821('0x62')](function(_0x3b25f8){var _0x2fad50=[];for(var _0x2f23e0=0x0;_0x2f23e0<_0x3b25f8[_0xd821('0x18')];_0x2f23e0++){_0x2fad50['push'](getTimezoneData(_0x3b25f8[_0x2f23e0],tmp_voice_queues));}BPromise[_0xd821('0x1a')](_0x2fad50)[_0xd821('0x1b')](function(){_0x58dd5f({'val':0x1});});})[_0xd821('0x63')](function(_0xab9871){logger[_0xd821('0x5b')](_0xab9871[_0xd821('0x5c')]);_0x58dd5f({'val':0x0});});});}function getTimezoneData(_0x393cb4,_0x39b036){return new Promise(function(_0x19c118,_0x2de2cd){var _0xf9df01=shared[_0xd821('0x70')];var _0x4fcfe5=_0xf9df01[_0x393cb4['dialTimezone']];if(_[_0xd821('0x1d')](_0x4fcfe5)){_0x19c118({'ret':0x1});}else{var _0x43aef2=_0x4fcfe5[_0xd821('0x71')];var _0x4486e9=squel[_0xd821('0x2d')]()['into'](_0x39b036)['set']('id',_0x393cb4['id'])['set'](_0xd821('0x72'),_0x43aef2)[_0xd821('0x73')](_0xd821('0x74'),_0x393cb4[_0xd821('0x74')])['toString']();return db[_0xd821('0x60')]['query'](_0x4486e9)[_0xd821('0x62')](function(_0x3c5c3f){_0x19c118({'ret':0x1});})['catch'](function(_0x5155f1){logger[_0xd821('0x5b')](_0x5155f1[_0xd821('0x5c')]);_0x2de2cd({'ret':0x1});});}});}function handleTZQuery(_0x2b67b7){logger[_0xd821('0x75')](_0x2b67b7);return db[_0xd821('0x60')][_0xd821('0x61')](_0x2b67b7)[_0xd821('0x62')](function(_0x5a704c){})['catch'](function(_0x48b0a4){logger[_0xd821('0x5b')](_0x48b0a4[_0xd821('0x5c')]);});}function main(_0x587515,_0x41c115,_0x4e71bf,_0x456588){logger[_0xd821('0x75')](_0xd821('0x76'),_0x587515,JSON['stringify'](_0x41c115));process['send']('start');var _0x396495=_0x41c115['binding'];var _0x2867f9=_[_0xd821('0x77')](_0x396495);var _0x240169=_0x41c115['socket_timestamp'];var _0x2b14ee=path[_0xd821('0x10')](config[_0xd821('0x78')],_0xd821('0x79'),_0x240169+_0xd821('0x7a'));hasTZ=_[_0xd821('0x53')](_0x396495)[_0xd821('0x7b')](_0xd821('0x74'));var _0x2c9f1a=_[_0xd821('0x53')](_0x396495)['join']();logger['info']('header',_0x2c9f1a);db[_0xd821('0x7c')][_0xd821('0x16')]({'raw':!![],'attributes':['id',_0xd821('0x7d')]})[_0xd821('0x1b')](function(_0x52532c){for(var _0x4dd55e=0x0;_0x4dd55e<_0x52532c[_0xd821('0x18')];_0x4dd55e++){if(_0x52532c[_0x4dd55e][_0xd821('0x7d')]in _0x396495){contactItemTypes['push'](_0x52532c[_0x4dd55e]);delete _0x2867f9[_0x52532c[_0x4dd55e][_0xd821('0x7d')]];hasAdditionalPhones=!![];}for(var _0x58ed4c in _0x396495){if(_0x52532c[_0x4dd55e]['name']+_0xd821('0x7e')===_0x58ed4c){phoneDescriptions[_0xd821('0x19')]({'itemTypeId':_0x52532c[_0x4dd55e]['id'],'description':_0x58ed4c});delete _0x2867f9[_0x58ed4c];}}}if(hasAdditionalPhones)_0x2867f9[_0xd821('0x17')]='';var _0x263fb8=_['keys'](_0x2867f9)['join']();logger[_0xd821('0x75')](_0xd821('0x7f'),_0x263fb8);fs[_0xd821('0x80')](_0x2b14ee,_0x263fb8+'\x0a');Papa[_0xd821('0x81')](fs['createReadStream'](_0x587515),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4bedf9,_0x2ed2a8){try{for(var _0xa56593=0x0,_0x1f5d78=[];_0xa56593<_0x4bedf9['data'][_0xd821('0x18')];_0xa56593++){stats[_0xd821('0x82')]+=0x1;if(_0x4bedf9[_0xd821('0x5e')][_0xa56593]){handleError(_0x4bedf9['data'][_0xa56593],_0x4bedf9['errors'][_0xa56593]);}else{var _0x111f78=[];var _0x45adda=[];var _0x43232e={};for(var _0x237466 in _0x396495){let _0x1c67dd=contactItemTypes[_0xd821('0x83')](_0x3910e=>_0x3910e[_0xd821('0x7d')]===_0x237466);let _0x4dde88=contactItemTypes[_0xd821('0x83')](_0x28ff8c=>_0x28ff8c[_0xd821('0x7d')]+'_description'===_0x237466);if(_[_0xd821('0x1d')](_0x1c67dd)&&_['isNil'](_0x4dde88)){if(_0x396495[_0xd821('0x84')](_0x237466)){if(_0x4bedf9[_0xd821('0x85')][_0xa56593][_0x396495[_0x237466]]){var _0x3d30dc=_['trim'](_0x4bedf9[_0xd821('0x85')][_0xa56593][_0x396495[_0x237466]][_0xd821('0x86')](/"/g,'\x27'));switch(_0x237466){case'scheduledat':var _0x1d2f9d=moment(_0x3d30dc,_0xd821('0xb'),!![]);if(_0x1d2f9d[_0xd821('0x87')]()){_0x1f5d78[_0xd821('0x19')]('\x22'+_0x3d30dc+'\x22');}else{_0x111f78[_0xd821('0x19')](_0xd821('0x88'));}break;case _0xd821('0x33'):var _0x21df59=parseInt(_0x3d30dc);_0x3d30dc=_[_0xd821('0x89')](_0x21df59)||_0x21df59<0x0||_0x21df59>0x4?_0x456588?0x3:0x2:_0x21df59;_0x1f5d78[_0xd821('0x19')]('\x22'+_0x3d30dc+'\x22');break;case _0xd821('0x34'):var _0x5999e5=parseInt(_0x3d30dc);if(_[_0xd821('0x8a')](_0x5999e5)&&_[_0xd821('0x7b')](_0x4e71bf,_0x5999e5)){_0x1f5d78['push']('\x22'+_0x5999e5+'\x22');}else{_0x111f78[_0xd821('0x19')](_0xd821('0x8b'));}break;case'email':if(isEmail(_0x3d30dc)){_0x1f5d78['push']('\x22'+_0x3d30dc+'\x22');}else{_0x111f78['push'](_0xd821('0x8c'));}break;case'dateOfBirth':var _0x18f481=moment(_0x3d30dc,'YYYY-MM-DD',!![]);if(_0x18f481['isValid']()){_0x1f5d78[_0xd821('0x19')]('\x22'+_0x3d30dc+'\x22');}else{_0x111f78['push'](_0xd821('0x8d'));}break;case'dialTimezone':var _0x42f5bb=shared['timezones'];var _0x13a09c=_0x42f5bb[_0x3d30dc];if(!_[_0xd821('0x1d')](_0x13a09c)){var _0x49662e=_0x13a09c[_0xd821('0x71')];_0x1f5d78[_0xd821('0x19')]('\x22'+_0x3d30dc+'\x22');_0x1f5d78[_0xd821('0x19')]('\x22'+_0x49662e+'\x22');}break;default:_0x1f5d78['push']('\x22'+_0x3d30dc+'\x22');}}else{switch(_0x237466){case'firstName':case'phone':_0x111f78[_0xd821('0x19')](_0x237466+_0xd821('0x8e'));break;default:_0x1f5d78[_0xd821('0x19')]('\x22\x22');}}}}else{var _0x46d3fe='';if(!_[_0xd821('0x1d')](_0x1c67dd)){if(!_0x43232e[_0xd821('0x84')](_0x1c67dd['id'])){if(!_['isNil'](_0x4bedf9[_0xd821('0x85')][_0xa56593][_0x396495[_0x237466]])){var _0x3d30dc=_['trim'](_0x4bedf9[_0xd821('0x85')][_0xa56593][_0x396495[_0x237466]][_0xd821('0x86')](/"/g,'\x27'));var _0x461f08=phoneDescriptions[_0xd821('0x83')](_0x514f2f=>_0x514f2f[_0xd821('0x8f')]===_0x1c67dd['id']);if(!_['isNil'](_0x461f08)){var _0x19385b=_[_0xd821('0x90')](_0x4bedf9['data'][_0xa56593][_0x396495[_0x461f08[_0xd821('0x91')]]][_0xd821('0x86')](/"/g,'\x27'));if(!_['isNil'](_0x19385b))_0x3d30dc=_0x3d30dc+'§'+_0x19385b;}if(_0x46d3fe=='')_0x46d3fe=_0x3d30dc;else _0x46d3fe+='|'+_0x3d30dc;}_0x45adda['push'](_0x1c67dd['id']+':'+_0x46d3fe);_0x43232e[_0x1c67dd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1f5d78[_0xd821('0x19')]('\x22'+_0x45adda['join'](';')+'\x22');}if(_0x111f78['length']){handleError(_0x4bedf9[_0xd821('0x85')][_0xa56593],{'code':'SystemRow','message':_0x111f78[_0xd821('0x10')]()});}else{fs[_0xd821('0x92')](_0x2b14ee,_0x1f5d78['join']()+'\x0a');}_0x1f5d78=[];}if(!(stats[_0xd821('0x82')]%0xc8)){socket[_0xd821('0x93')](_0xd821('0x94')+_0x240169,stats);stats['errors']=[];}}if(stopped){logger[_0xd821('0x75')](_0xd821('0x95'));_0x2ed2a8['abort']();}}catch(_0x20526b){handleError(_0x4bedf9[_0xd821('0x85')][_0xa56593],{'code':'SystemError','message':_0x20526b[_0xd821('0x5c')]});logger['error'](_0xd821('0x96'),_0x20526b['message']);}},'complete':function(){try{var _0x3431ee=[];var _0x54e6c1=[];var _0x1b72c3=_0xd821('0x38');if(_0x41c115[_0xd821('0x97')]&&_0x41c115[_0xd821('0x97')][_0xd821('0x18')]){_0x1b72c3=_0xd821('0x98')+_0x240169;_0x3431ee[_0xd821('0x19')](_0xd821('0x99')+_0x1b72c3+_0xd821('0x9a'));}tmp_campaigns=_0xd821('0x9b')+_0x240169;tmp_voice_queues='voice_queues_'+_0x240169;_0x54e6c1[_0xd821('0x19')](_0xd821('0x99')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x54e6c1[_0xd821('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xd821('0x9c'));BPromise['each'](_0x54e6c1,handleTZQuery)['then'](function(_0x9a31c7){updateTzCampaigns(_0x41c115[_0xd821('0x3f')])['then'](function(_0x555b36){updateTzVoiceQueues(_0x41c115[_0xd821('0x3f')])[_0xd821('0x1b')](function(_0x2f0221){if(hasTZ)_0x263fb8=_0x263fb8[_0xd821('0x86')](_0xd821('0x74'),_0xd821('0x9d'));var _0xc984c2=util[_0xd821('0xa')](_0xd821('0x9e'),_0x2b14ee,_0x1b72c3,_0x263fb8,_0x41c115['ListId'],_0x41c115[_0xd821('0x9f')]||null,NOW,NOW);if(_['isNil'](_0x396495[_0xd821('0x45')])){_0xc984c2+=',\x20scheduledAt\x20=\x20NOW()';}_0x3431ee['push'](_0xc984c2);if(_0x41c115[_0xd821('0x97')]&&_0x41c115[_0xd821('0x97')][_0xd821('0x18')]){_0x3431ee['push'](insertCmContact(_0x41c115[_0xd821('0x3f')],_0x1b72c3,_0x41c115['duplicates'],_0x396495));_0x3431ee[_0xd821('0x19')](_0xd821('0xa0')+_0x1b72c3+';');}BPromise[_0xd821('0xa1')](_0x3431ee,handleQuery)[_0xd821('0x1b')](function(_0x123698){BPromise[_0xd821('0x1a')]([handleAdditionalPhones()])[_0xd821('0x1b')](function(){_0x3431ee=[];for(var _0x2c52b9=0x0;_0x2c52b9\x20\x20','existsSync','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','then','catch','error','split','all','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','priority','UserId','select','fields','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?'];(function(_0x3feb8a,_0x47c784){var _0x4523ca=function(_0x4fba86){while(--_0x4fba86){_0x3feb8a['push'](_0x3feb8a['shift']());}};_0x4523ca(++_0x47c784);}(_0xd10f,0x198));var _0xfd10=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd10f[_0x3bf83f];return _0x22c4a9;};'use strict';var fs=require('fs');var path=require(_0xfd10('0x0'));var _=require(_0xfd10('0x1'));var Papa=require(_0xfd10('0x2'));var util=require(_0xfd10('0x3'));var BPromise=require(_0xfd10('0x4'));var moment=require('moment');var squel=require(_0xfd10('0x5'));var Redis=require(_0xfd10('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xfd10('0x7'))(_0xfd10('0x8'));config[_0xfd10('0x9')]=_[_0xfd10('0xa')](config[_0xfd10('0x9')],{'host':_0xfd10('0xb'),'port':0x18eb});var socket=require(_0xfd10('0xc'))(new Redis(config[_0xfd10('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xfd10('0xd'));var tempTableName=_0xfd10('0xe')+moment()['format'](_0xfd10('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x389df3){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))*$/[_0xfd10('0x10')](_0x389df3);}function selectNotIn(_0x213f4e,_0x4c4097,_0x4b16ea,_0x8f5192,_0x28b71c){return squel['select']()[_0xfd10('0x11')](_0xfd10('0x12'))[_0xfd10('0x13')](_0x8f5192)[_0xfd10('0x14')](_0x4c4097,null,_0x4c4097+_0xfd10('0x15')+_0x8f5192+'.'+_0x4b16ea)[_0xfd10('0x16')](_0x8f5192+'.'+_0x4b16ea+_0xfd10('0x17')+_0x213f4e+'.'+_0x4b16ea)[_0xfd10('0x16')](_0x4c4097+_0xfd10('0x18')+_0x28b71c[_0xfd10('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x250cb0,_0x35dc13){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfd10('0x19')][_0xfd10('0x1a')](_0xfd10('0x1b')+tempTableName)[_0xfd10('0x1c')](function(_0x1dcd95){if(_0x1dcd95!==null){var _0x14a97d=[];for(var _0x38be53=0x0;_0x38be53<_0x1dcd95[_0xfd10('0x1d')];_0x38be53++){var _0xde87a3=_0x1dcd95[_0x38be53];if(!_[_0xfd10('0x1e')](_0xde87a3[_0xfd10('0x12')])){if(!_['isNil'](_0xde87a3[_0xfd10('0x1f')]))_0x14a97d['push'](insertAdditionalPhones(_0xde87a3));promisesContact[_0xfd10('0x20')]({'contact':_0xde87a3});}}}Promise['all'](_0x14a97d)[_0xfd10('0x21')](function(){_0x250cb0({'val':0x1});});})[_0xfd10('0x22')](function(_0x474b1c){logger[_0xfd10('0x23')](_0x474b1c['message']);});});}function insertAdditionalPhones(_0x3a1667){return new Promise(function(_0x1dcc7a,_0x546537){var _0x33b7e2=_0x3a1667[_0xfd10('0x1f')];if(_['isNil'](_0x33b7e2))_0x546537({'val':0x0});else{var _0x2362af=_0x33b7e2[_0xfd10('0x24')](';');var _0x4014a3=[];orderBy=0x0;for(var _0x52e614=0x0;_0x52e614<_0x2362af[_0xfd10('0x1d')];_0x52e614++){_0x4014a3[_0xfd10('0x20')](splitAdditionalPhone(_0x3a1667['id'],_0x2362af[_0x52e614]));}Promise[_0xfd10('0x25')](_0x4014a3)['then'](function(){_0x1dcc7a({'val':_0x2362af[_0xfd10('0x1d')]});});}});}function splitAdditionalPhone(_0x4a57fd,_0x43d488){return new Promise(function(_0x4e12e6,_0x59af0c){var _0x497224=_0x43d488[_0xfd10('0x24')](':');var _0x1fab8a=_0x497224[0x0];var _0x54980d=_0x497224[0x1];if(_0x54980d!==''){var _0x3cc74f=_0x54980d[_0xfd10('0x24')]('|');var _0x2ef962=[];for(var _0x1152c9=0x0;_0x1152c9<_0x3cc74f[_0xfd10('0x1d')];_0x1152c9++){if(_0x3cc74f[_0x1152c9]!==''){var _0x105ec4=_['filter'](promisesAdditionalPhones,{'contactId':_0x4a57fd,'phone':_0x3cc74f[_0x1152c9]});if(_0x105ec4[_0xfd10('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0xfd10('0x20')]({'contactId':_0x4a57fd,'contactTypeId':_0x1fab8a,'phone':_0x3cc74f[_0x1152c9],'orderBy':orderBy});}}}_0x4e12e6({'ok':0x1});}else _0x4e12e6({'res':0x0});});}function createAdditionalPhone(_0x881ace,_0x49d8d2,_0x77aa08,_0x127980){var _0x314061='';var _0x42c62f='';var _0x597f4b=_0x77aa08['split']('§');_0x314061=_0x597f4b[0x0];if(_0x597f4b[_0xfd10('0x1d')]==0x2)_0x42c62f=_0x597f4b[0x1];return new Promise(function(_0x301b5c,_0x542962){return db[_0xfd10('0x26')][_0xfd10('0x27')]({'where':{'CmContactId':_0x881ace,'item':_0x314061}})['then'](function(_0x545ad1){if(_0x545ad1){return db[_0xfd10('0x26')][_0xfd10('0x28')]({'ItemTypeId':_0x49d8d2,'description':_0x42c62f,'OrderBy':_0x127980},{'where':{'CmContactId':_0x881ace,'item':_0x314061}})[_0xfd10('0x21')](function(_0x270886){_0x301b5c({'res':_0xfd10('0x29')});});}else{return db['CmContactHasItem'][_0xfd10('0x2a')]({'CmContactId':_0x881ace,'item':_0x314061,'ItemTypeId':_0x49d8d2,'description':_0x42c62f,'OrderBy':_0x127980,'ItemClass':_0xfd10('0x2b')})[_0xfd10('0x21')](function(_0x228149){_0x301b5c({'res':_0xfd10('0x2c')});});}});});}function updateContact(_0xddca97){return new Promise(function(_0x43b505,_0x4bf570){var _0x4d2cfd=_0xddca97['id'];delete _0xddca97['id'];return db[_0xfd10('0x2d')]['update'](_0xddca97,{'where':{'id':_0x4d2cfd}})[_0xfd10('0x21')](function(_0x5421b1){updatedRows+=0x1;return db[_0xfd10('0x2e')][_0xfd10('0x28')]({'phone':_0xddca97[_0xfd10('0x12')]},{'where':{'ContactId':_0x4d2cfd}})['then'](function(_0x177f70){_0x43b505({'ret':'OK'});});});});}function insertCmHopper(_0x2e7e49,_0x3d93f5,_0x2a93d8,_0x1296ab,_0x1acc07){var _0x3d3425=[_0xfd10('0x2f'),'cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0x3d93f5+'.'+_0x1296ab,_0xfd10('0x30'),_0xfd10('0x31'),_0xfd10('0x32'),_0xfd10('0x33'),'\x22'+_0x1acc07+'\x22'];return squel[_0xfd10('0x34')]()[_0xfd10('0x35')](_0xfd10('0x36'))['fromQuery']([_0xfd10('0x12'),_0xfd10('0x37'),_0xfd10('0x38'),_0xfd10('0x39'),_0x1296ab,_0xfd10('0x3a'),'updatedAt',_0xfd10('0x3b'),_0xfd10('0x3c'),'recallme'],squel[_0xfd10('0x3d')]()[_0xfd10('0x3e')](_0x3d3425)[_0xfd10('0x13')](_0x3d93f5)[_0xfd10('0x14')](_0xfd10('0x3f'),null,'cm_contacts.ListId\x20=\x20'+_0x3d93f5+_0xfd10('0x40'))[_0xfd10('0x14')](_0x2a93d8,null,_0x2a93d8+_0xfd10('0x15')+_0x3d93f5+'.'+_0x1296ab)[_0xfd10('0x16')](_0x3d93f5+'.CmListId\x20=\x20?',_0x2e7e49)[_0xfd10('0x16')](_0xfd10('0x41'),NOW)[_0xfd10('0x16')](_0xfd10('0x42'),selectNotIn(_0x3d93f5,_0x2a93d8,_0x1296ab,_0xfd10('0x36'),[_0xfd10('0x43'),_0xfd10('0x44')]))[_0xfd10('0x16')](_0xfd10('0x42'),selectNotIn(_0x3d93f5,_0x2a93d8,_0x1296ab,_0xfd10('0x36'),[_0xfd10('0x43')])))['toString']();}function insertCmHopperBlack(_0x38202e,_0xec5ef,_0x211057,_0x52a50e){var _0x13a14b=[_0xfd10('0x2f'),_0xfd10('0x45'),_0xfd10('0x46'),_0xec5ef+'.'+_0x52a50e,_0xfd10('0x30'),_0xfd10('0x31')];return squel['insert']()[_0xfd10('0x35')](_0xfd10('0x47'))[_0xfd10('0x48')]([_0xfd10('0x12'),_0xfd10('0x38'),_0xfd10('0x39'),_0x52a50e,_0xfd10('0x3a'),_0xfd10('0x49')],squel[_0xfd10('0x3d')]()[_0xfd10('0x3e')](_0x13a14b)['from'](_0xec5ef)[_0xfd10('0x14')](_0xfd10('0x3f'),null,'cm_contacts.ListId\x20=\x20'+_0xec5ef+_0xfd10('0x40'))[_0xfd10('0x14')](_0x211057,null,_0x211057+_0xfd10('0x15')+_0xec5ef+'.'+_0x52a50e)[_0xfd10('0x16')](_0xec5ef+_0xfd10('0x4a'),_0x38202e)[_0xfd10('0x16')](_0xfd10('0x41'),NOW)[_0xfd10('0x16')](_0xfd10('0x42'),squel[_0xfd10('0x3d')]()[_0xfd10('0x11')](_0xfd10('0x12'))[_0xfd10('0x13')](_0xfd10('0x47'))[_0xfd10('0x16')]('ListId\x20=\x20?',_0x38202e)[_0xfd10('0x16')](_0x52a50e+'\x20=\x20?',_0xec5ef+'.'+_0x52a50e)))['toString']();}function insertCmHopperAdditionalPhones(_0x73d564){var _0x5e8c7e=[_0xfd10('0x4b'),_0xfd10('0x4c'),_0xfd10('0x4d'),_0xfd10('0x4e'),_0xfd10('0x4f')];return squel['insert']()['into']('cm_hopper_additional_phones')[_0xfd10('0x48')](['CmHopperId',_0xfd10('0x12'),_0xfd10('0x50'),_0xfd10('0x3a'),_0xfd10('0x49')],squel[_0xfd10('0x3d')]()[_0xfd10('0x3e')](_0x5e8c7e)[_0xfd10('0x13')](_0xfd10('0x36'))[_0xfd10('0x14')](_0xfd10('0x3f'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xfd10('0x14')](_0xfd10('0x51'),null,_0xfd10('0x52'))[_0xfd10('0x16')](_0xfd10('0x53'),_0x73d564)[_0xfd10('0x16')](_0xfd10('0x41'),NOW))[_0xfd10('0x54')]();}function insertCmContact(_0x27c1a4,_0x5bd83e,_0x442ca5,_0x4fdce0){var _0xbb6eb1=_[_0xfd10('0x55')](_[_0xfd10('0x56')](_0x4fdce0),[_0xfd10('0x39'),'CompanyId',_0xfd10('0x3a'),_0xfd10('0x49')]);return squel[_0xfd10('0x34')]()[_0xfd10('0x35')](_0xfd10('0x3f'))['fromQuery'](_0xbb6eb1,squel[_0xfd10('0x3d')]()[_0xfd10('0x3e')](_0xbb6eb1)[_0xfd10('0x13')](_0x5bd83e)[_0xfd10('0x16')]('('+_0x442ca5[_0xfd10('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0xfd10('0x3d')]()[_0xfd10('0x3e')](_0x442ca5)[_0xfd10('0x13')](_0xfd10('0x3f'))[_0xfd10('0x16')]('ListId\x20=\x20?',_0x27c1a4))[_0xfd10('0x16')]('id\x20IN\x20?',squel['select']()['field'](_0xfd10('0x57'),_0xfd10('0x58'))[_0xfd10('0x13')](_0x5bd83e)[_0xfd10('0x59')](_0x442ca5[_0xfd10('0x14')](','))))['toString']();}function handleStop(){logger[_0xfd10('0x5a')](_0xfd10('0x5b'));stopped=!![];}function handleUncaughtException(_0x95a58){logger[_0xfd10('0x23')](_0x95a58[_0xfd10('0x5c')]);process[_0xfd10('0x5d')](0x1);}function handleError(_0x27329e,_0x30ca61){stats[_0xfd10('0x5e')][_0xfd10('0x20')]({'name':_0x30ca61[_0xfd10('0x5f')],'message':_0x30ca61[_0xfd10('0x5c')],'row':_0x27329e});}function handleQuery(_0x5d8475){logger['info'](_0x5d8475);return db['sequelize'][_0xfd10('0x1a')](_0x5d8475)['spread'](function(_0xae547){results[_0xfd10('0x20')](_0xae547);})[_0xfd10('0x22')](function(_0x13a4b6){logger[_0xfd10('0x23')](_0x13a4b6[_0xfd10('0x5c')]);});}function main(_0x1ba89c,_0x69c073,_0x490a53,_0x101560){logger[_0xfd10('0x5a')](_0xfd10('0x60'),_0x1ba89c,JSON[_0xfd10('0x61')](_0x69c073));process[_0xfd10('0x62')](_0xfd10('0x63'));var _0x3c0147=_0x69c073['binding'];var _0xd5446c=_[_0xfd10('0x64')](_0x3c0147);var _0x354917=_0x69c073['socket_timestamp'];var _0x244345=path['join'](config[_0xfd10('0x65')],_0xfd10('0x66'),_0x354917+_0xfd10('0x67'));logger['info'](_0xfd10('0x68'),_0x69c073);db['ContactItemType'][_0xfd10('0x69')]({'raw':!![],'attributes':['id',_0xfd10('0x6a')]})[_0xfd10('0x21')](function(_0x535264){for(var _0x2dbfa9=0x0;_0x2dbfa9<_0x535264[_0xfd10('0x1d')];_0x2dbfa9++){if(_0x535264[_0x2dbfa9][_0xfd10('0x6a')]in _0x3c0147){contactItemTypes[_0xfd10('0x20')](_0x535264[_0x2dbfa9]);delete _0xd5446c[_0x535264[_0x2dbfa9][_0xfd10('0x6a')]];hasAdditionalPhones=!![];}for(var _0x348e0b in _0x3c0147){if(_0x535264[_0x2dbfa9][_0xfd10('0x6a')]+'_description'===_0x348e0b){phoneDescriptions[_0xfd10('0x20')]({'itemTypeId':_0x535264[_0x2dbfa9]['id'],'description':_0x348e0b});delete _0xd5446c[_0x348e0b];}}}if(hasAdditionalPhones)_0xd5446c[_0xfd10('0x1f')]='';var _0x58a33f=_['keys'](_0xd5446c)[_0xfd10('0x14')]();logger[_0xfd10('0x5a')]('header',_0x58a33f);fs[_0xfd10('0x6b')](_0x244345,_0x58a33f+'\x0a');Papa[_0xfd10('0x6c')](fs[_0xfd10('0x6d')](_0x1ba89c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x669431,_0x2a089a){try{for(var _0x13e68e=0x0,_0x3bfbfb=[];_0x13e68e<_0x669431[_0xfd10('0x6e')][_0xfd10('0x1d')];_0x13e68e++){stats[_0xfd10('0x6f')]+=0x1;if(_0x669431[_0xfd10('0x5e')][_0x13e68e]){handleError(_0x669431[_0xfd10('0x6e')][_0x13e68e],_0x669431[_0xfd10('0x5e')][_0x13e68e]);}else{var _0x2b2db7=[];var _0x7cfc0c=[];var _0x194d93={};for(var _0x20518d in _0x3c0147){let _0x404f25=contactItemTypes[_0xfd10('0x70')](_0x154891=>_0x154891[_0xfd10('0x6a')]===_0x20518d);let _0x4eb6cc=contactItemTypes[_0xfd10('0x70')](_0x236fbf=>_0x236fbf['name']+'_description'===_0x20518d);if(_[_0xfd10('0x1e')](_0x404f25)&&_['isNil'](_0x4eb6cc)){if(_0x3c0147['hasOwnProperty'](_0x20518d)){if(_0x669431[_0xfd10('0x6e')][_0x13e68e][_0x3c0147[_0x20518d]]){var _0x5cf579=_['trim'](_0x669431[_0xfd10('0x6e')][_0x13e68e][_0x3c0147[_0x20518d]][_0xfd10('0x71')](/"/g,'\x27'));switch(_0x20518d){case _0xfd10('0x37'):var _0x27548a=moment(_0x5cf579,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x27548a['isValid']()){_0x3bfbfb[_0xfd10('0x20')]('\x22'+_0x5cf579+'\x22');}else{_0x2b2db7[_0xfd10('0x20')](_0xfd10('0x72'));}break;case _0xfd10('0x3b'):var _0x50ff6a=parseInt(_0x5cf579);_0x5cf579=_[_0xfd10('0x73')](_0x50ff6a)||_0x50ff6a<0x0||_0x50ff6a>0x4?_0x101560?0x3:0x2:_0x50ff6a;_0x3bfbfb[_0xfd10('0x20')]('\x22'+_0x5cf579+'\x22');break;case _0xfd10('0x3c'):var _0x356ee6=parseInt(_0x5cf579);if(_[_0xfd10('0x74')](_0x356ee6)&&_[_0xfd10('0x75')](_0x490a53,_0x356ee6)){_0x3bfbfb['push']('\x22'+_0x356ee6+'\x22');}else{_0x2b2db7[_0xfd10('0x20')](_0xfd10('0x76'));}break;case _0xfd10('0x77'):if(isEmail(_0x5cf579)){_0x3bfbfb[_0xfd10('0x20')]('\x22'+_0x5cf579+'\x22');}else{_0x2b2db7['push'](_0xfd10('0x78'));}break;case _0xfd10('0x79'):var _0x3ec587=moment(_0x5cf579,'YYYY-MM-DD',!![]);if(_0x3ec587[_0xfd10('0x7a')]()){_0x3bfbfb[_0xfd10('0x20')]('\x22'+_0x5cf579+'\x22');}else{_0x2b2db7[_0xfd10('0x20')](_0xfd10('0x7b'));}break;default:_0x3bfbfb[_0xfd10('0x20')]('\x22'+_0x5cf579+'\x22');}}else{switch(_0x20518d){case _0xfd10('0x7c'):case'phone':_0x2b2db7[_0xfd10('0x20')](_0x20518d+_0xfd10('0x7d'));break;default:_0x3bfbfb[_0xfd10('0x20')]('\x22\x22');}}}}else{var _0x452888='';if(!_[_0xfd10('0x1e')](_0x404f25)){if(!_0x194d93[_0xfd10('0x7e')](_0x404f25['id'])){for(var _0x3ca11e=0x0;_0x3ca11e<_0x3c0147[_0x20518d][_0xfd10('0x1d')];_0x3ca11e++){var _0x5cf579=_[_0xfd10('0x7f')](_0x669431[_0xfd10('0x6e')][_0x13e68e][_0x3c0147[_0x20518d][_0x3ca11e]][_0xfd10('0x71')](/"/g,'\x27'));var _0x44229d=phoneDescriptions['find'](_0x1b3cb9=>_0x1b3cb9['itemTypeId']===_0x404f25['id']);if(!_[_0xfd10('0x1e')](_0x44229d)){var _0x4ece84=_['trim'](_0x669431[_0xfd10('0x6e')][_0x13e68e][_0x3c0147[_0x44229d[_0xfd10('0x80')]][0x0]][_0xfd10('0x71')](/"/g,'\x27'));if(!_[_0xfd10('0x1e')](_0x4ece84))_0x5cf579=_0x5cf579+'§'+_0x4ece84;}if(_0x452888=='')_0x452888=_0x5cf579;else _0x452888+='|'+_0x5cf579;}_0x7cfc0c[_0xfd10('0x20')](_0x404f25['id']+':'+_0x452888);_0x194d93[_0x404f25['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3bfbfb[_0xfd10('0x20')]('\x22'+_0x7cfc0c['join'](';')+'\x22');}if(_0x2b2db7[_0xfd10('0x1d')]){handleError(_0x669431[_0xfd10('0x6e')][_0x13e68e],{'code':_0xfd10('0x81'),'message':_0x2b2db7[_0xfd10('0x14')]()});}else{fs[_0xfd10('0x82')](_0x244345,_0x3bfbfb[_0xfd10('0x14')]()+'\x0a');}_0x3bfbfb=[];}if(!(stats[_0xfd10('0x6f')]%0xc8)){socket[_0xfd10('0x83')](_0xfd10('0x84')+_0x354917,stats);stats[_0xfd10('0x5e')]=[];}}if(stopped){logger[_0xfd10('0x5a')](_0xfd10('0x85'));_0x2a089a[_0xfd10('0x86')]();}}catch(_0x287310){handleError(_0x669431[_0xfd10('0x6e')][_0x13e68e],{'code':'SystemError','message':_0x287310[_0xfd10('0x5c')]});logger['error'](_0xfd10('0x87'),_0x287310[_0xfd10('0x5c')]);}},'complete':function(){try{var _0x322e41=[];var _0x585360=tempTableName;_0x322e41[_0xfd10('0x20')](_0xfd10('0x88')+_0x585360+_0xfd10('0x89'));logger[_0xfd10('0x5a')]('CIS\x20len',contactItemTypes[_0xfd10('0x1d')]);var _0x1051ee=util[_0xfd10('0x8a')](_0xfd10('0x8b'),_0x244345,_0x585360,_0x58a33f,_0x69c073['ListId'],_0x69c073[_0xfd10('0x8c')]||null,NOW,NOW);if(_['isNil'](_0x3c0147['scheduledat'])){_0x1051ee+=_0xfd10('0x8d');}_0x322e41[_0xfd10('0x20')](_0x1051ee);BPromise['each'](_0x322e41,handleQuery)[_0xfd10('0x21')](function(_0x54ff8c){BPromise[_0xfd10('0x25')]([handleAdditionalPhones()])[_0xfd10('0x21')](function(){_0x322e41=[];for(var _0x1b2f90=0x0;_0x1b2f90\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','query','spread','length','isNil','AdditionalPhones','push','all','error','message','split','then','filter','findOne','CmContactHasItem','update','PHONE','inserted','CmContact','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId'];(function(_0x46dfe4,_0x7f472b){var _0x12ae97=function(_0x42780d){while(--_0x42780d){_0x46dfe4['push'](_0x46dfe4['shift']());}};_0x12ae97(++_0x7f472b);}(_0x87d5,0x6b));var _0x587d=function(_0x3b8eb9,_0x55fcb0){_0x3b8eb9=_0x3b8eb9-0x0;var _0x975fee=_0x87d5[_0x3b8eb9];return _0x975fee;};'use strict';var fs=require('fs');var path=require(_0x587d('0x0'));var _=require('lodash');var Papa=require(_0x587d('0x1'));var util=require('util');var BPromise=require(_0x587d('0x2'));var moment=require(_0x587d('0x3'));var squel=require(_0x587d('0x4'));var Redis=require(_0x587d('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x587d('0x6'));var logger=require(_0x587d('0x7'))(_0x587d('0x8'));config['redis']=_[_0x587d('0x9')](config[_0x587d('0xa')],{'host':_0x587d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x587d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x587d('0xc')](_0x587d('0xd'));var tempTableName=_0x587d('0xe')+moment()[_0x587d('0xc')](_0x587d('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4b72c1){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))*$/[_0x587d('0x10')](_0x4b72c1);}function selectNotIn(_0x26230e,_0x5c1818,_0xc2246b,_0x2c435d,_0x5c57b4){return squel['select']()[_0x587d('0x11')](_0x587d('0x12'))[_0x587d('0x13')](_0x2c435d)['join'](_0x5c1818,null,_0x5c1818+_0x587d('0x14')+_0x2c435d+'.'+_0xc2246b)[_0x587d('0x15')](_0x2c435d+'.'+_0xc2246b+_0x587d('0x16')+_0x26230e+'.'+_0xc2246b)[_0x587d('0x15')](_0x5c1818+_0x587d('0x17')+_0x5c57b4[_0x587d('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x12f2e8,_0x380e7a){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x587d('0x19')]('select\x20*\x20from\x20'+tempTableName)[_0x587d('0x1a')](function(_0x4e53a8){if(_0x4e53a8!==null){var _0x5c9000=[];for(var _0x5053e8=0x0;_0x5053e8<_0x4e53a8[_0x587d('0x1b')];_0x5053e8++){var _0x2dcb03=_0x4e53a8[_0x5053e8];if(!_[_0x587d('0x1c')](_0x2dcb03[_0x587d('0x12')])){if(!_[_0x587d('0x1c')](_0x2dcb03[_0x587d('0x1d')]))_0x5c9000['push'](insertAdditionalPhones(_0x2dcb03));promisesContact[_0x587d('0x1e')]({'contact':_0x2dcb03});}}}Promise[_0x587d('0x1f')](_0x5c9000)['then'](function(){_0x12f2e8({'val':0x1});});})['catch'](function(_0x5721eb){logger[_0x587d('0x20')](_0x5721eb[_0x587d('0x21')]);});});}function insertAdditionalPhones(_0x524556){return new Promise(function(_0x197efc,_0x4c3e48){var _0x3b84e4=_0x524556[_0x587d('0x1d')];if(_['isNil'](_0x3b84e4))_0x4c3e48({'val':0x0});else{var _0x3036ec=_0x3b84e4[_0x587d('0x22')](';');var _0x4f0f25=[];orderBy=0x0;for(var _0x5f46f6=0x0;_0x5f46f6<_0x3036ec[_0x587d('0x1b')];_0x5f46f6++){_0x4f0f25[_0x587d('0x1e')](splitAdditionalPhone(_0x524556['id'],_0x3036ec[_0x5f46f6]));}Promise[_0x587d('0x1f')](_0x4f0f25)[_0x587d('0x23')](function(){_0x197efc({'val':_0x3036ec[_0x587d('0x1b')]});});}});}function splitAdditionalPhone(_0x481b7b,_0x2cba42){return new Promise(function(_0x146988,_0x312904){var _0x4195ef=_0x2cba42[_0x587d('0x22')](':');var _0x34e339=_0x4195ef[0x0];var _0x5a074d=_0x4195ef[0x1];if(_0x5a074d!==''){var _0x3569eb=_0x5a074d['split']('|');var _0x3b13bd=[];for(var _0x25d64d=0x0;_0x25d64d<_0x3569eb['length'];_0x25d64d++){if(_0x3569eb[_0x25d64d]!==''){var _0xbb6a89=_[_0x587d('0x24')](promisesAdditionalPhones,{'contactId':_0x481b7b,'phone':_0x3569eb[_0x25d64d]});if(_0xbb6a89[_0x587d('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x481b7b,'contactTypeId':_0x34e339,'phone':_0x3569eb[_0x25d64d],'orderBy':orderBy});}}}_0x146988({'ok':0x1});}else _0x146988({'res':0x0});});}function createAdditionalPhone(_0x69e892,_0x763bf5,_0x4831c7,_0x3d2182){var _0x2a23c5='';var _0x5d3136='';var _0x161f7f=_0x4831c7['split']('§');_0x2a23c5=_0x161f7f[0x0];if(_0x161f7f[_0x587d('0x1b')]==0x2)_0x5d3136=_0x161f7f[0x1];return new Promise(function(_0xa2b2a6,_0x531857){return db['CmContactHasItem'][_0x587d('0x25')]({'where':{'CmContactId':_0x69e892,'item':_0x2a23c5}})[_0x587d('0x23')](function(_0x5622b0){if(_0x5622b0){return db[_0x587d('0x26')][_0x587d('0x27')]({'ItemTypeId':_0x763bf5,'description':_0x5d3136,'OrderBy':_0x3d2182},{'where':{'CmContactId':_0x69e892,'item':_0x2a23c5}})[_0x587d('0x23')](function(_0x4e4af9){_0xa2b2a6({'res':'updated'});});}else{return db[_0x587d('0x26')]['create']({'CmContactId':_0x69e892,'item':_0x2a23c5,'ItemTypeId':_0x763bf5,'description':_0x5d3136,'OrderBy':_0x3d2182,'ItemClass':_0x587d('0x28')})[_0x587d('0x23')](function(_0x2f5623){_0xa2b2a6({'res':_0x587d('0x29')});});}});});}function updateContact(_0x2ec9b6){return new Promise(function(_0x5e79a5,_0x583372){var _0x353e1c=_0x2ec9b6['id'];delete _0x2ec9b6['id'];return db[_0x587d('0x2a')]['update'](_0x2ec9b6,{'where':{'id':_0x353e1c}})[_0x587d('0x23')](function(_0x1924f1){updatedRows+=0x1;return db[_0x587d('0x2b')][_0x587d('0x27')]({'phone':_0x2ec9b6[_0x587d('0x12')]},{'where':{'ContactId':_0x353e1c}})['then'](function(_0x3b215c){_0x5e79a5({'ret':'OK'});});});});}function insertCmHopper(_0x4d9596,_0x1f550d,_0x41b34c,_0x508ad1,_0x1f698c){var _0x36950b=['cm_contacts.phone',_0x587d('0x2c'),_0x587d('0x2d'),_0x587d('0x2e'),_0x1f550d+'.'+_0x508ad1,_0x587d('0x2f'),'cm_contacts.updatedAt','cm_contacts.priority',_0x587d('0x30'),'\x22'+_0x1f698c+'\x22'];return squel['insert']()[_0x587d('0x31')]('cm_hopper')['fromQuery']([_0x587d('0x12'),_0x587d('0x32'),_0x587d('0x33'),_0x587d('0x34'),_0x508ad1,_0x587d('0x35'),_0x587d('0x36'),_0x587d('0x37'),_0x587d('0x38'),_0x587d('0x39')],squel[_0x587d('0x3a')]()['fields'](_0x36950b)[_0x587d('0x13')](_0x1f550d)[_0x587d('0x18')](_0x587d('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x1f550d+_0x587d('0x3c'))[_0x587d('0x18')](_0x41b34c,null,_0x41b34c+_0x587d('0x14')+_0x1f550d+'.'+_0x508ad1)['where'](_0x1f550d+_0x587d('0x3d'),_0x4d9596)[_0x587d('0x15')](_0x587d('0x3e'),NOW)[_0x587d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1f550d,_0x41b34c,_0x508ad1,'cm_hopper',['\x22always\x22',_0x587d('0x3f')]))[_0x587d('0x15')](_0x587d('0x40'),selectNotIn(_0x1f550d,_0x41b34c,_0x508ad1,_0x587d('0x41'),['\x22always\x22'])))[_0x587d('0x42')]();}function insertCmHopperBlack(_0x39e7fd,_0x5bf007,_0x668cda,_0x2c603e){var _0x2bb4fc=[_0x587d('0x43'),_0x587d('0x2d'),_0x587d('0x2e'),_0x5bf007+'.'+_0x2c603e,_0x587d('0x2f'),'cm_contacts.updatedAt'];return squel[_0x587d('0x44')]()[_0x587d('0x31')]('cm_hopper_black')['fromQuery']([_0x587d('0x12'),_0x587d('0x33'),_0x587d('0x34'),_0x2c603e,_0x587d('0x35'),_0x587d('0x36')],squel[_0x587d('0x3a')]()[_0x587d('0x45')](_0x2bb4fc)[_0x587d('0x13')](_0x5bf007)[_0x587d('0x18')](_0x587d('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x5bf007+_0x587d('0x3c'))[_0x587d('0x18')](_0x668cda,null,_0x668cda+'.id\x20=\x20'+_0x5bf007+'.'+_0x2c603e)['where'](_0x5bf007+_0x587d('0x3d'),_0x39e7fd)[_0x587d('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x587d('0x40'),squel['select']()[_0x587d('0x11')](_0x587d('0x12'))[_0x587d('0x13')](_0x587d('0x46'))[_0x587d('0x15')]('ListId\x20=\x20?',_0x39e7fd)[_0x587d('0x15')](_0x2c603e+'\x20=\x20?',_0x5bf007+'.'+_0x2c603e)))[_0x587d('0x42')]();}function insertCmHopperAdditionalPhones(_0x4391b5){var _0x574208=[_0x587d('0x47'),_0x587d('0x48'),_0x587d('0x49'),_0x587d('0x4a'),_0x587d('0x4b')];return squel[_0x587d('0x44')]()[_0x587d('0x31')](_0x587d('0x4c'))['fromQuery']([_0x587d('0x4d'),_0x587d('0x12'),'OrderBy',_0x587d('0x35'),'updatedAt'],squel[_0x587d('0x3a')]()[_0x587d('0x45')](_0x574208)['from'](_0x587d('0x41'))[_0x587d('0x18')](_0x587d('0x3b'),null,_0x587d('0x4e'))['join'](_0x587d('0x4f'),null,_0x587d('0x50'))[_0x587d('0x15')](_0x587d('0x51'),_0x4391b5)['where'](_0x587d('0x3e'),NOW))[_0x587d('0x42')]();}function insertCmContact(_0x1fce5f,_0x18d2e0,_0x16c2cc,_0x18e6f7){var _0x1324ed=_['concat'](_['keys'](_0x18e6f7),[_0x587d('0x34'),_0x587d('0x52'),_0x587d('0x35'),_0x587d('0x36')]);return squel['insert']()['into']('cm_contacts')[_0x587d('0x53')](_0x1324ed,squel[_0x587d('0x3a')]()[_0x587d('0x45')](_0x1324ed)['from'](_0x18d2e0)[_0x587d('0x15')]('('+_0x16c2cc[_0x587d('0x18')](',')+_0x587d('0x54'),squel[_0x587d('0x3a')]()[_0x587d('0x45')](_0x16c2cc)[_0x587d('0x13')](_0x587d('0x3b'))[_0x587d('0x15')]('ListId\x20=\x20?',_0x1fce5f))[_0x587d('0x15')]('id\x20IN\x20?',squel[_0x587d('0x3a')]()[_0x587d('0x11')](_0x587d('0x55'),_0x587d('0x56'))[_0x587d('0x13')](_0x18d2e0)['group'](_0x16c2cc[_0x587d('0x18')](','))))[_0x587d('0x42')]();}function handleStop(){logger[_0x587d('0x57')](_0x587d('0x58'));stopped=!![];}function handleUncaughtException(_0x112cb9){logger[_0x587d('0x20')](_0x112cb9[_0x587d('0x21')]);process['exit'](0x1);}function handleError(_0x5ba3f4,_0x123c52){stats[_0x587d('0x59')][_0x587d('0x1e')]({'name':_0x123c52[_0x587d('0x5a')],'message':_0x123c52['message'],'row':_0x5ba3f4});}function handleQuery(_0x3ce08b){logger['info'](_0x3ce08b);return db[_0x587d('0x5b')]['query'](_0x3ce08b)['spread'](function(_0x36935c){results[_0x587d('0x1e')](_0x36935c);})['catch'](function(_0x401f69){logger[_0x587d('0x20')](_0x401f69['message']);});}function main(_0x4d0a7a,_0x47a451,_0xf93849,_0x2a808f){logger[_0x587d('0x57')]('main',_0x4d0a7a,JSON[_0x587d('0x5c')](_0x47a451));process[_0x587d('0x5d')](_0x587d('0x5e'));var _0x1259e6=_0x47a451['binding'];var _0x3fa982=_['clone'](_0x1259e6);var _0x5841ab=_0x47a451[_0x587d('0x5f')];var _0x697381=path[_0x587d('0x18')](config[_0x587d('0x60')],_0x587d('0x61'),_0x5841ab+_0x587d('0x62'));logger[_0x587d('0x57')](_0x587d('0x63'),_0x47a451);db[_0x587d('0x64')][_0x587d('0x65')]({'raw':!![],'attributes':['id',_0x587d('0x66')]})['then'](function(_0x1e09d9){for(var _0x53ae60=0x0;_0x53ae60<_0x1e09d9[_0x587d('0x1b')];_0x53ae60++){if(_0x1e09d9[_0x53ae60][_0x587d('0x66')]in _0x1259e6){contactItemTypes[_0x587d('0x1e')](_0x1e09d9[_0x53ae60]);delete _0x3fa982[_0x1e09d9[_0x53ae60][_0x587d('0x66')]];hasAdditionalPhones=!![];}for(var _0x41592e in _0x1259e6){if(_0x1e09d9[_0x53ae60][_0x587d('0x66')]+_0x587d('0x67')===_0x41592e){phoneDescriptions[_0x587d('0x1e')]({'itemTypeId':_0x1e09d9[_0x53ae60]['id'],'description':_0x41592e});delete _0x3fa982[_0x41592e];}}}if(hasAdditionalPhones)_0x3fa982[_0x587d('0x1d')]='';var _0x4f45db=_[_0x587d('0x68')](_0x3fa982)['join']();logger['info'](_0x587d('0x69'),_0x4f45db);fs[_0x587d('0x6a')](_0x697381,_0x4f45db+'\x0a');Papa[_0x587d('0x6b')](fs['createReadStream'](_0x4d0a7a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2aef23,_0x1b4026){try{for(var _0x1b441e=0x0,_0x51cc64=[];_0x1b441e<_0x2aef23[_0x587d('0x6c')]['length'];_0x1b441e++){stats[_0x587d('0x6d')]+=0x1;if(_0x2aef23[_0x587d('0x59')][_0x1b441e]){handleError(_0x2aef23['data'][_0x1b441e],_0x2aef23[_0x587d('0x59')][_0x1b441e]);}else{var _0x574854=[];var _0x6b5db7=[];var _0x372112={};for(var _0x523780 in _0x1259e6){let _0x520e8d=contactItemTypes[_0x587d('0x6e')](_0x235d8b=>_0x235d8b[_0x587d('0x66')]===_0x523780);let _0x4ae8ed=contactItemTypes[_0x587d('0x6e')](_0x5c7179=>_0x5c7179[_0x587d('0x66')]+_0x587d('0x67')===_0x523780);if(_['isNil'](_0x520e8d)&&_[_0x587d('0x1c')](_0x4ae8ed)){if(_0x1259e6['hasOwnProperty'](_0x523780)){if(_0x2aef23[_0x587d('0x6c')][_0x1b441e][_0x1259e6[_0x523780]]){var _0xd760dc=_['trim'](_0x2aef23[_0x587d('0x6c')][_0x1b441e][_0x1259e6[_0x523780]][_0x587d('0x6f')](/"/g,'\x27'));switch(_0x523780){case _0x587d('0x32'):var _0x21db9c=moment(_0xd760dc,_0x587d('0xd'),!![]);if(_0x21db9c['isValid']()){_0x51cc64[_0x587d('0x1e')]('\x22'+_0xd760dc+'\x22');}else{_0x574854[_0x587d('0x1e')](_0x587d('0x70'));}break;case _0x587d('0x37'):var _0x2d2daa=parseInt(_0xd760dc);_0xd760dc=_[_0x587d('0x71')](_0x2d2daa)||_0x2d2daa<0x0||_0x2d2daa>0x4?_0x2a808f?0x3:0x2:_0x2d2daa;_0x51cc64[_0x587d('0x1e')]('\x22'+_0xd760dc+'\x22');break;case'UserId':var _0x172f4d=parseInt(_0xd760dc);if(_['isNumber'](_0x172f4d)&&_[_0x587d('0x72')](_0xf93849,_0x172f4d)){_0x51cc64[_0x587d('0x1e')]('\x22'+_0x172f4d+'\x22');}else{_0x574854[_0x587d('0x1e')](_0x587d('0x73'));}break;case _0x587d('0x74'):if(isEmail(_0xd760dc)){_0x51cc64[_0x587d('0x1e')]('\x22'+_0xd760dc+'\x22');}else{_0x574854['push'](_0x587d('0x75'));}break;case _0x587d('0x76'):var _0x32ad01=moment(_0xd760dc,_0x587d('0x77'),!![]);if(_0x32ad01['isValid']()){_0x51cc64[_0x587d('0x1e')]('\x22'+_0xd760dc+'\x22');}else{_0x574854[_0x587d('0x1e')](_0x587d('0x78'));}break;default:_0x51cc64[_0x587d('0x1e')]('\x22'+_0xd760dc+'\x22');}}else{switch(_0x523780){case _0x587d('0x79'):case _0x587d('0x12'):_0x574854[_0x587d('0x1e')](_0x523780+_0x587d('0x7a'));break;default:_0x51cc64['push']('\x22\x22');}}}}else{var _0x222a2b='';if(!_[_0x587d('0x1c')](_0x520e8d)){if(!_0x372112['hasOwnProperty'](_0x520e8d['id'])){for(var _0x2ae970=0x0;_0x2ae970<_0x1259e6[_0x523780][_0x587d('0x1b')];_0x2ae970++){var _0xd760dc=_[_0x587d('0x7b')](_0x2aef23['data'][_0x1b441e][_0x1259e6[_0x523780][_0x2ae970]]['replace'](/"/g,'\x27'));var _0x592a20=phoneDescriptions[_0x587d('0x6e')](_0x85b843=>_0x85b843[_0x587d('0x7c')]===_0x520e8d['id']);if(!_[_0x587d('0x1c')](_0x592a20)){var _0x5714b6=_[_0x587d('0x7b')](_0x2aef23[_0x587d('0x6c')][_0x1b441e][_0x1259e6[_0x592a20['description']][0x0]][_0x587d('0x6f')](/"/g,'\x27'));if(!_[_0x587d('0x1c')](_0x5714b6))_0xd760dc=_0xd760dc+'§'+_0x5714b6;}if(_0x222a2b=='')_0x222a2b=_0xd760dc;else _0x222a2b+='|'+_0xd760dc;}_0x6b5db7[_0x587d('0x1e')](_0x520e8d['id']+':'+_0x222a2b);_0x372112[_0x520e8d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x51cc64[_0x587d('0x1e')]('\x22'+_0x6b5db7[_0x587d('0x18')](';')+'\x22');}if(_0x574854[_0x587d('0x1b')]){handleError(_0x2aef23[_0x587d('0x6c')][_0x1b441e],{'code':'SystemRow','message':_0x574854['join']()});}else{fs[_0x587d('0x7d')](_0x697381,_0x51cc64[_0x587d('0x18')]()+'\x0a');}_0x51cc64=[];}if(!(stats['rows']%0xc8)){socket[_0x587d('0x7e')](_0x587d('0x7f')+_0x5841ab,stats);stats[_0x587d('0x59')]=[];}}if(stopped){logger[_0x587d('0x57')](_0x587d('0x80'));_0x1b4026[_0x587d('0x81')]();}}catch(_0x7d9e4e){handleError(_0x2aef23[_0x587d('0x6c')][_0x1b441e],{'code':_0x587d('0x82'),'message':_0x7d9e4e[_0x587d('0x21')]});logger['error'](_0x587d('0x83'),_0x7d9e4e['message']);}},'complete':function(){try{var _0x798f1f=[];var _0x37ace1=tempTableName;_0x798f1f[_0x587d('0x1e')](_0x587d('0x84')+_0x37ace1+_0x587d('0x85'));logger[_0x587d('0x57')]('CIS\x20len',contactItemTypes[_0x587d('0x1b')]);var _0x199ca0=util[_0x587d('0xc')](_0x587d('0x86'),_0x697381,_0x37ace1,_0x4f45db,_0x47a451[_0x587d('0x34')],_0x47a451[_0x587d('0x52')]||null,NOW,NOW);if(_[_0x587d('0x1c')](_0x1259e6[_0x587d('0x32')])){_0x199ca0+=_0x587d('0x87');}_0x798f1f[_0x587d('0x1e')](_0x199ca0);BPromise['each'](_0x798f1f,handleQuery)[_0x587d('0x23')](function(_0x2332b0){BPromise['all']([handleAdditionalPhones()])[_0x587d('0x23')](function(){_0x798f1f=[];for(var _0x521df3=0x0;_0x521df3\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.to'];(function(_0x346d52,_0x1be5ec){var _0x247aea=function(_0x5912d2){while(--_0x5912d2){_0x346d52['push'](_0x346d52['shift']());}};_0x247aea(++_0x1be5ec);}(_0xf417,0x15a));var _0x7f41=function(_0x2fcadf,_0x401da6){_0x2fcadf=_0x2fcadf-0x0;var _0x2a2c05=_0xf417[_0x2fcadf];return _0x2a2c05;};'use strict';var _=require(_0x7f41('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0x7f41('0x1'));var updateInteraction=require(_0x7f41('0x2'))['updateInteraction'];var utils=require(_0x7f41('0x3'));var db=require(_0x7f41('0x4'))['db'];function skipInteractionsQuery(_0x170635,_0x51bb7f,_0x549016){var _0x3953dd=![];var _0x26b513=utils[_0x7f41('0x5')](_0x170635);if(_0x51bb7f['role']===_0x7f41('0x6')&&!_0x549016[_0x7f41('0x7')]&&!_0x549016[_0x26b513]){_0x3953dd=!![];}return _0x3953dd;}function getTagsQuery(){return squel[_0x7f41('0x8')]()[_0x7f41('0x9')]('id')[_0x7f41('0x9')](_0x7f41('0xa'))[_0x7f41('0x9')](_0x7f41('0xb'))[_0x7f41('0xc')](_0x7f41('0xd'));}function getUsersQuery(_0x2dee0e,_0x8f452c){var _0x3c600f=utils[_0x7f41('0xe')](_0x2dee0e);var _0x59d009='user_has_'+_0x2dee0e+_0x7f41('0xf');var _0x19138d=squel[_0x7f41('0x8')]()['field'](_0x7f41('0x10'))['field'](_0x7f41('0x11'))['field']('ui.'+_0x3c600f)[_0x7f41('0xc')](_0x59d009,'ui')[_0x7f41('0x12')](_0x7f41('0x13'),'u',_0x7f41('0x14'));if(_0x8f452c['length']>0x0){_0x19138d['where'](_0x7f41('0x15')+_0x3c600f+'\x20IN\x20?',_['map'](_0x8f452c,'id'));}return _0x19138d;}function getInteractionsQuery(_0x2f79c1){var _0x5bed6c=utils[_0x7f41('0x16')](_0x2f79c1);var _0x1b52da=utils[_0x7f41('0x5')](_0x2f79c1);var _0xccafd1=utils[_0x7f41('0xe')](_0x2f79c1);return squel['select']()[_0x7f41('0xc')](_0x5bed6c['interactions'],'i')['left_join'](_0x7f41('0x17'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x7f41('0x12')]('users','o',_0x7f41('0x18'))[_0x7f41('0x12')](_0x5bed6c['accounts'],'a','a.id\x20=\x20i.'+_0x1b52da)[_0x7f41('0x12')](_0x5bed6c[_0x7f41('0x19')],'me','me.'+_0xccafd1+_0x7f41('0x1a'))['left_join'](_0x5bed6c[_0x7f41('0x1b')],'it',_0x7f41('0x1c')+_0xccafd1+_0x7f41('0x1a'))['left_join']('tools_tags','t',_0x7f41('0x1d'));}function getSqlClauses(){var _0x5894aa={'body':squel[_0x7f41('0x1e')](),'contact':squel[_0x7f41('0x1e')](),'default':squel[_0x7f41('0x1e')](),'fields':squel[_0x7f41('0x1e')](),'filter':squel[_0x7f41('0x1e')](),'read':squel[_0x7f41('0x1e')](),'tags':{'clause':squel[_0x7f41('0x1e')](),'ids':null},'user':squel[_0x7f41('0x1e')]()};return _0x5894aa;}function parseTagParameter(_0x1a736d){var _0x587ff1=squel['expr']();if(_0x1a736d){var _0x43b92a=utils[_0x7f41('0x1f')](_0x1a736d);_0x43b92a[_0x7f41('0x20')](function(_0x2ab8f6){_0x587ff1['or'](_0x7f41('0x21'),'%,'+_0x2ab8f6+',%');});}return _0x587ff1;}function parseReadParameter(_0x3d6e08){var _0x3814f9='';if(_0x3d6e08){_0x3814f9=_0x7f41('0x22');if(_0x3d6e08==='1'){_0x3814f9=_0x3814f9['replace'](_0x7f41('0x23'),'=');}else{_0x3814f9=_0x3814f9[_0x7f41('0x24')](_0x7f41('0x23'),'>');}}return _0x3814f9;}function parseSearchFilter(_0x4c0f05,_0x218a6b){var _0x92ae28=squel[_0x7f41('0x1e')]();if(_0x218a6b){var _0x2afc8b=_0x218a6b[_0x7f41('0x24')]('\x5c','\x5c\x5c')[_0x7f41('0x24')](/'/g,'\x27\x27');var _0x35dd43=qs[_0x7f41('0x25')](_0x2afc8b);if(qs[_0x7f41('0x26')](_0x2afc8b)){_0x92ae28['or'](_0x7f41('0x27'),_0x35dd43+'%');if([_0x7f41('0x28'),_0x7f41('0x29')]['includes'](_0x4c0f05)){_0x92ae28['or'](_0x7f41('0x2a'),_0x35dd43+'%');}else if(_0x4c0f05==='fax'){_0x92ae28['or']('i.fax\x20LIKE\x20?',_0x35dd43+'%');}else if(_0x4c0f05===_0x7f41('0x2b')){_0x92ae28['or']('i.from\x20LIKE\x20?',_0x35dd43+'%');}}else if(_0x4c0f05===_0x7f41('0x2c')&&qs[_0x7f41('0x2d')](_0x2afc8b)){_0x92ae28['or'](_0x7f41('0x2e'),_0x35dd43+'%');}else{if(_0x4c0f05==='mail'){_0x92ae28['or'](_0x7f41('0x2f'),qs[_0x7f41('0x30')](_0x2afc8b,!![]))['or'](_0x7f41('0x31'),qs[_0x7f41('0x30')](_0x2afc8b));}else if(_0x4c0f05!==_0x7f41('0x32')){_0x92ae28['or'](_0x7f41('0x33'),qs['getFullTextValue'](_0x2afc8b));}_0x92ae28['or'](_0x7f41('0x34'),qs[_0x7f41('0x30')](_0x2afc8b,!![]),null);}}return _0x92ae28;}function parseAdvancedSearchFilter(_0x55b0c6,_0x46bc75){var _0x2483a1=getSqlClauses();var _0x2c3a94=as[_0x7f41('0x35')](_0x55b0c6);var _0x173f4a=_0x2c3a94['sqlOperator'];for(var _0xcfd294=0x0;_0xcfd294<_0x2c3a94['conditions'][_0x7f41('0x36')];_0xcfd294++){var _0x22e3af=_0x2c3a94[_0x7f41('0x37')][_0xcfd294];var _0x5576b6='i';var _0x807e71=_[_0x7f41('0x38')](_0x46bc75,[_0x7f41('0xa'),_0x22e3af[_0x7f41('0x9')]]);if(_0x807e71){var _0x23ea8b=as['buildExpression'](_0x5576b6,_0x807e71['type'],_0x22e3af);_0x2483a1[_0x7f41('0x39')][_0x173f4a](_0x23ea8b[_0x7f41('0x3a')],_0x23ea8b[_0x7f41('0x3b')][_0x7f41('0x3c')],_0x23ea8b['value']['end']);}else{switch(_0x22e3af['field']){case _0x7f41('0x3d'):var _0x4dda73=parseReadParameter(_0x22e3af['value']);_0x2483a1[_0x7f41('0x3e')]['and'](_0x4dda73);break;case _0x7f41('0x3f'):if(_0x22e3af[_0x7f41('0x40')]===_0x7f41('0x41')){if(_0x22e3af[_0x7f41('0x3b')][_0x7f41('0x42')]('\x20')['length']>0x1){_0x2483a1[_0x7f41('0x43')][_0x173f4a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x22e3af[_0x7f41('0x3b')],!![]),null);}else{var _0x1914c7='%'+_0x22e3af[_0x7f41('0x3b')]+'%';_0x2483a1[_0x7f41('0x43')][_0x173f4a](_0x7f41('0x44'),_0x1914c7,_0x1914c7,_0x1914c7);}}else{_0x807e71=_[_0x7f41('0x38')](_0x46bc75,[_0x7f41('0xa'),_0x7f41('0x45')]);_0x22e3af['field']=_0x7f41('0x45');_0x23ea8b=as[_0x7f41('0x46')](_0x5576b6,_0x807e71[_0x7f41('0x47')],_0x22e3af);_0x2483a1['contact'][_0x173f4a](_0x23ea8b[_0x7f41('0x3a')],_0x23ea8b[_0x7f41('0x3b')]['start'],_0x23ea8b[_0x7f41('0x3b')]['end']);}break;case _0x7f41('0x48'):var _0x8c7e0b=_0x22e3af['value'][_0x7f41('0x42')](',')[_0x7f41('0x49')](function(_0x4bdabb){return Number(_0x4bdabb);});var _0x59c9e0=parseTagParameter(_0x8c7e0b);_0x2483a1[_0x7f41('0x4a')][_0x7f41('0x4b')]['and'](_0x59c9e0);_0x2483a1['tags'][_0x7f41('0x4c')]=_0x8c7e0b;break;case _0x7f41('0x4d'):if(_0x22e3af['operator']===_0x7f41('0x41')){_0x2483a1[_0x7f41('0x4e')][_0x173f4a](_0x7f41('0x4f'),'%'+_0x22e3af[_0x7f41('0x3b')]+'%',null);}else{_0x807e71=_[_0x7f41('0x38')](_0x46bc75,['name',_0x7f41('0x50')]);_0x22e3af[_0x7f41('0x9')]='UserId';_0x23ea8b=as['buildExpression'](_0x5576b6,_0x807e71[_0x7f41('0x47')],_0x22e3af);_0x2483a1[_0x7f41('0x4e')][_0x173f4a](_0x23ea8b[_0x7f41('0x3a')],_0x23ea8b[_0x7f41('0x3b')][_0x7f41('0x3c')],_0x23ea8b['value'][_0x7f41('0x51')]);}break;case _0x7f41('0x52'):case'plainBody':_0x23ea8b=as[_0x7f41('0x46')]('me',null,_0x22e3af);_0x2483a1[_0x7f41('0x52')][_0x173f4a](_0x23ea8b[_0x7f41('0x3a')],_0x23ea8b[_0x7f41('0x3b')][_0x7f41('0x3c')],_0x23ea8b['value'][_0x7f41('0x51')]);break;}}}return _0x2483a1;}function parseModelFields(_0x5b2577,_0xaa46b6,_0x307fd1){var _0x32f4c7=utils[_0x7f41('0x5')](_0x5b2577);var _0x558107=squel[_0x7f41('0x1e')]();var _0x3a6c54=_(_0xaa46b6)[_0x7f41('0x53')]()[_0x7f41('0x49')](function(_0x2bb6d7){return _[_0x7f41('0x54')](_0x307fd1,[_0x7f41('0xa'),_0x2bb6d7])?_0x2bb6d7:undefined;})['compact']()[_0x7f41('0x3b')]();if(_0x3a6c54[_0x7f41('0x36')]>0x0){_0x3a6c54[_0x7f41('0x20')](function(_0x219cb1){if(_0x219cb1===_0x32f4c7){_0x558107[_0x7f41('0x55')]('i.'+_0x32f4c7+'\x20IN\x20?',[]['concat'](_0xaa46b6[_0x219cb1]));}else if(_0x219cb1===_0x7f41('0x56')){var _0x5aee7e=JSON[_0x7f41('0x57')](_0xaa46b6[_0x219cb1])[_0x7f41('0x58')];var _0x3b7446=JSON['parse'](_0xaa46b6[_0x219cb1])[_0x7f41('0x59')];_0x558107['and'](_0x7f41('0x5a'),_0x5aee7e,_0x3b7446);}else{if(_0xaa46b6[_0x219cb1]==='null'){_0x558107[_0x7f41('0x55')]('i.'+_0x219cb1+_0x7f41('0x5b'));}else{_0x558107[_0x7f41('0x55')]('i.'+_0x219cb1+_0x7f41('0x5c'),_0xaa46b6[_0x219cb1]);}}});}return _0x558107;}function parseQueryParameters(_0x14e3bc,_0x2aee8b,_0x3f44bf){var _0x316fa7=getSqlClauses();return Promise[_0x7f41('0x5d')]()[_0x7f41('0x5e')](function(){return parseModelFields(_0x14e3bc,_0x2aee8b,_0x3f44bf);})[_0x7f41('0x5e')](function(_0x372d9){_0x316fa7[_0x7f41('0x5f')][_0x7f41('0x55')](_0x372d9);return parseReadParameter(_0x2aee8b[_0x7f41('0x3e')]);})['then'](function(_0x2357f7){_0x316fa7[_0x7f41('0x3e')][_0x7f41('0x55')](_0x2357f7);return parseTagParameter(_0x2aee8b[_0x7f41('0x60')]);})[_0x7f41('0x5e')](function(_0x45c307){_0x316fa7[_0x7f41('0x4a')][_0x7f41('0x4b')][_0x7f41('0x55')](_0x45c307);return parseSearchFilter(_0x14e3bc,_0x2aee8b[_0x7f41('0x61')]);})[_0x7f41('0x5e')](function(_0x2262d6){_0x316fa7[_0x7f41('0x61')]=_0x2262d6;return _0x316fa7;});}function checkAccountsRestrictions(_0xef9572,_0x27c943,_0x38c7c2){var _0x121d66=utils[_0x7f41('0x5')](_0xef9572);var _0x3c8223=_0x7f41('0x62')+_[_0x7f41('0x63')](_0xef9572)+(_0xef9572===_0x7f41('0x64')?_0x7f41('0x65'):_0x7f41('0x66'));var _0x75a583=squel[_0x7f41('0x1e')]();return Promise[_0x7f41('0x5d')]()[_0x7f41('0x5e')](function(){if(_0x38c7c2[_0x7f41('0x7')]&&_0x27c943[_0x7f41('0x67')]===_0x7f41('0x6')){return _0x27c943[_0x3c8223]({'attributes':['id'],'raw':!![]});}})[_0x7f41('0x5e')](function(_0xb35c08){if(_0xb35c08){if(_0xb35c08[_0x7f41('0x36')]===0x0){_0x75a583[_0x7f41('0x55')]('i.'+_0x121d66+'\x20IS\x20NULL');}else{_0x75a583[_0x7f41('0x55')]('i.'+_0x121d66+_0x7f41('0x68'),_['map'](_0xb35c08,'id'));}}else if(!_0x38c7c2[_0x121d66]){_0x75a583['and']('i.'+_0x121d66+'\x20IS\x20NOT\x20NULL');}})[_0x7f41('0x5e')](function(){return _0x75a583;});}function getClosedOrderClause(_0x40bdd6,_0x42eb1c){var _0x3d8be8='';var _0x9f2698=[_0x7f41('0x69'),_0x7f41('0x6a'),_0x7f41('0x6b')];if(_0x40bdd6==='mail'){_0x9f2698[_0x7f41('0x6c')]('i.substatus');}if(_0x42eb1c['closed']==='0'&&_0x40bdd6===_0x7f41('0x2c')){_0x3d8be8=_0x7f41('0x6d');}else{if(_0x42eb1c[_0x7f41('0x6e')]==='1'){_0x9f2698[_0x7f41('0x6f')]();}_0x3d8be8='CONCAT_WS(\x27\x27,\x20'+_0x9f2698[_0x7f41('0x70')](',\x20')+')';}return _0x3d8be8;}function getFilteredInteractions(_0x4604f3,_0x44a31a,_0x4e33a3,_0x22f599){var _0x116932=utils[_0x7f41('0xe')](_0x4604f3);var _0x3bb2b9=_[_0x7f41('0x63')](_0x4604f3)+_0x7f41('0x71');var _0x43e09d=[];var _0x5c7057=getTagsQuery();var _0x34741b={'type':db[_0x7f41('0x72')]['QueryTypes'][_0x7f41('0x73')],'raw':!![]};var _0x607c46=[];var _0x39f0b8=[];return db['sequelize']['query'](_0x5c7057[_0x7f41('0x74')](),_0x34741b)[_0x7f41('0x5e')](function(_0x5031a7){_0x43e09d=_[_0x7f41('0x75')](_0x5031a7,'id');_0x34741b=_[_0x7f41('0x76')](_0x34741b,{'model':db[_0x3bb2b9],'mapToModel':!![],'nest':!![]});if(_0x4e33a3[_0x7f41('0x5f')]){_0x22f599['attributes'][_0x7f41('0x20')](function(_0x1fe76d){_0x44a31a[_0x7f41('0x9')]('i.'+_0x1fe76d);});}else{_0x44a31a[_0x7f41('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7f41('0x3d'));_0x44a31a[_0x7f41('0x9')]('a.key',_0x7f41('0x77'));_0x44a31a['field'](_0x7f41('0x78'),'Account.mandatoryDisposition');if(_0x4604f3===_0x7f41('0x2c')){_0x44a31a[_0x7f41('0x9')](_0x7f41('0x79'),'Account.email');_0x44a31a[_0x7f41('0x9')](_0x7f41('0x7a'),'contactName');_0x44a31a[_0x7f41('0x9')](_0x7f41('0x7b'));_0x44a31a['field'](_0x7f41('0x7c'));_0x44a31a[_0x7f41('0x9')](_0x7f41('0x7d'));_0x44a31a[_0x7f41('0x9')](_0x7f41('0x7e'));_0x44a31a[_0x7f41('0x9')](_0x7f41('0x7f'));_0x44a31a['field']('i.attach');_0x44a31a[_0x7f41('0x9')](_0x7f41('0x80'));_0x44a31a['field'](_0x7f41('0x81'));_0x44a31a[_0x7f41('0x9')]('i.subject');_0x44a31a[_0x7f41('0x9')](_0x7f41('0x6b'));_0x44a31a[_0x7f41('0x9')](_0x7f41('0x6a'));_0x44a31a[_0x7f41('0x9')](_0x7f41('0x69'));_0x44a31a[_0x7f41('0x9')](_0x7f41('0x6d'));_0x44a31a['field'](_0x7f41('0x82'));_0x44a31a[_0x7f41('0x9')]('i.ContactId');_0x44a31a[_0x7f41('0x9')](_0x7f41('0x83'));_0x44a31a[_0x7f41('0x9')](_0x7f41('0x84'));}else if(_0x4604f3===_0x7f41('0x2b')){_0x44a31a['field']('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');}else{_0x44a31a[_0x7f41('0x9')]('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',_0x7f41('0x85'));}if(_0x4604f3!==_0x7f41('0x2c')){_0x44a31a[_0x7f41('0x9')](_0x7f41('0x86'));}_0x44a31a[_0x7f41('0x9')](_0x7f41('0x87'),'Contact.firstName');_0x44a31a[_0x7f41('0x9')](_0x7f41('0x88'),_0x7f41('0x89'));_0x44a31a['field'](_0x7f41('0x8a'),'Contact.email');_0x44a31a['field'](_0x7f41('0x8b'),'Contact.phone');_0x44a31a[_0x7f41('0x9')](_0x7f41('0x8c'),_0x7f41('0x8d'));_0x44a31a[_0x7f41('0x9')](_0x7f41('0x8e'),_0x7f41('0x8f'));_0x44a31a[_0x7f41('0x9')](_0x7f41('0x90'),_0x7f41('0x91'));_0x44a31a[_0x7f41('0x9')]('o.internal','Owner.internal');_0x44a31a[_0x7f41('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x22f599[_0x7f41('0x92')]){_0x44a31a[_0x7f41('0x92')](_0x22f599['limit']);}if(_0x22f599[_0x7f41('0x93')]){_0x44a31a['offset'](_0x22f599['offset']);}return db['sequelize'][_0x7f41('0x94')](_0x44a31a[_0x7f41('0x74')](),_0x34741b);})[_0x7f41('0x5e')](function(_0x302787){_0x607c46=_0x302787;var _0x40112e=getUsersQuery(_0x4604f3,_0x607c46);return db[_0x7f41('0x95')][_0x7f41('0x94')](_0x40112e[_0x7f41('0x74')](),_0x34741b);})[_0x7f41('0x5e')](function(_0x4c7675){_0x39f0b8=_[_0x7f41('0x96')](_0x4c7675,_0x116932);if(_0x4604f3===_0x7f41('0x2c')){return db[_0x7f41('0x97')][_0x7f41('0x98')]({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x5e98b7){var _0x4520e5=_0x5e98b7?_0x5e98b7['enableEmailPreview']:undefined;var _0xf9dcc1=_0x607c46['map'](function(_0x2d8ed2){return updateInteraction(_0x2d8ed2,_0x43e09d,_0x39f0b8,_0x4520e5);});return Promise[_0x7f41('0x99')](_0xf9dcc1);});}function countFilteredInteractions(_0x5ceefe,_0x3fc013){var _0x144b91=_0x5ceefe[_0x7f41('0x9a')]();_0x144b91[_0x7f41('0x9')](_0x7f41('0x9b'));_0x144b91[_0x7f41('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7f41('0x3d'));var _0x19690e=utils[_0x7f41('0x1f')](_0x3fc013);if(!_[_0x7f41('0x9c')](_0x19690e)){_0x144b91['where'](_0x7f41('0x9d'),_0x19690e);}var _0x186ad8={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return db[_0x7f41('0x95')][_0x7f41('0x94')](_0x144b91['toString'](),_0x186ad8);}module[_0x7f41('0x9e')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x11d6=['$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','filter','get','chat','Accounts','agent','\x20IS\x20NOT\x20NULL','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','capitalize','Sequelize','SELECT','sequelize','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.secondDisposition','i.thirdDisposition','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','query','toString','groupBy','Setting','enableEmailPreview','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','QueryTypes','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','search','select','field','color','from','getInteractionFK','_interactions','u.id','u.fullname','users','map','getInteractionsTables','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','\x20=\x20i.id','it.','tools_tags','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length','find','name','buildExpression','default','text','value','start','unreadMessages','read','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','end','Tag','tags','clause','and','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','keys','some','compact','\x20IN\x20?','createdAt','parse'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x11d6,0xef));var _0x611d=function(_0x5aabe3,_0x31013d){_0x5aabe3=_0x5aabe3-0x0;var _0x103764=_0x11d6[_0x5aabe3];return _0x103764;};'use strict';var _=require(_0x611d('0x0'));var squel=require('squel');var as=require(_0x611d('0x1'));var qs=require(_0x611d('0x2'));var updateInteraction=require(_0x611d('0x3'))['updateInteraction'];var utils=require(_0x611d('0x4'));var db=require(_0x611d('0x5'))['db'];function skipInteractionsQuery(_0x511956,_0x47eae8,_0x60d65b){var _0x2c97dc=![];var _0x184ea9=utils[_0x611d('0x6')](_0x511956);if(_0x47eae8[_0x611d('0x7')]==='agent'&&!_0x60d65b[_0x611d('0x8')]&&!_0x60d65b[_0x184ea9]){_0x2c97dc=!![];}return _0x2c97dc;}function getTagsQuery(){return squel[_0x611d('0x9')]()[_0x611d('0xa')]('id')[_0x611d('0xa')]('name')['field'](_0x611d('0xb'))[_0x611d('0xc')]('tools_tags');}function getUsersQuery(_0x264fa3,_0x3eb433){var _0x26de21=utils[_0x611d('0xd')](_0x264fa3);var _0x5aac7b='user_has_'+_0x264fa3+_0x611d('0xe');var _0xf41249=squel['select']()[_0x611d('0xa')](_0x611d('0xf'))[_0x611d('0xa')](_0x611d('0x10'))[_0x611d('0xa')]('ui.'+_0x26de21)[_0x611d('0xc')](_0x5aac7b,'ui')['left_join'](_0x611d('0x11'),'u','u.id\x20=\x20ui.UserId');if(_0x3eb433['length']>0x0){_0xf41249['where']('ui.'+_0x26de21+'\x20IN\x20?',_[_0x611d('0x12')](_0x3eb433,'id'));}return _0xf41249;}function getInteractionsQuery(_0x414163){var _0x47d344=utils[_0x611d('0x13')](_0x414163);var _0x4b3ffa=utils['getAccountFK'](_0x414163);var _0x5997d6=utils[_0x611d('0xd')](_0x414163);return squel[_0x611d('0x9')]()['from'](_0x47d344[_0x611d('0x14')],'i')[_0x611d('0x15')](_0x611d('0x16'),'c',_0x611d('0x17'))['left_join'](_0x611d('0x11'),'o',_0x611d('0x18'))[_0x611d('0x15')](_0x47d344[_0x611d('0x19')],'a','a.id\x20=\x20i.'+_0x4b3ffa)[_0x611d('0x15')](_0x47d344[_0x611d('0x1a')],'me','me.'+_0x5997d6+_0x611d('0x1b'))[_0x611d('0x15')](_0x47d344['interactionsTags'],'it',_0x611d('0x1c')+_0x5997d6+_0x611d('0x1b'))[_0x611d('0x15')](_0x611d('0x1d'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x2f5409={'body':squel[_0x611d('0x1e')](),'contact':squel[_0x611d('0x1e')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x611d('0x1e')](),'read':squel[_0x611d('0x1e')](),'tags':{'clause':squel[_0x611d('0x1e')](),'ids':null},'user':squel[_0x611d('0x1e')]()};return _0x2f5409;}function parseTagParameter(_0x311670){var _0x29bc04=squel[_0x611d('0x1e')]();if(_0x311670){var _0x41c1da=utils[_0x611d('0x1f')](_0x311670);_0x41c1da[_0x611d('0x20')](function(_0x4a013e){_0x29bc04['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4a013e+',%');});}return _0x29bc04;}function parseReadParameter(_0x44e560){var _0x271a94='';if(_0x44e560){_0x271a94=_0x611d('0x21');if(_0x44e560==='1'){_0x271a94=_0x271a94[_0x611d('0x22')](_0x611d('0x23'),'=');}else{_0x271a94=_0x271a94[_0x611d('0x22')](_0x611d('0x23'),'>');}}return _0x271a94;}function parseSearchFilter(_0xd5e1db,_0x5377ae){var _0x4504ad=squel[_0x611d('0x1e')]();if(_0x5377ae){var _0x4e36cd=_0x5377ae[_0x611d('0x22')]('\x5c','\x5c\x5c')[_0x611d('0x22')](/'/g,'\x27\x27');var _0x29ba0c=qs[_0x611d('0x24')](_0x4e36cd);if(qs[_0x611d('0x25')](_0x4e36cd)){_0x4504ad['or'](_0x611d('0x26'),_0x29ba0c+'%');if([_0x611d('0x27'),_0x611d('0x28')][_0x611d('0x29')](_0xd5e1db)){_0x4504ad['or'](_0x611d('0x2a'),_0x29ba0c+'%');}else if(_0xd5e1db===_0x611d('0x2b')){_0x4504ad['or']('i.fax\x20LIKE\x20?',_0x29ba0c+'%');}else if(_0xd5e1db===_0x611d('0x2c')){_0x4504ad['or'](_0x611d('0x2d'),_0x29ba0c+'%');}}else if(_0xd5e1db===_0x611d('0x2e')&&qs[_0x611d('0x2f')](_0x4e36cd)){_0x4504ad['or'](_0x611d('0x30'),_0x29ba0c+'%');}else{if(_0xd5e1db===_0x611d('0x2e')){_0x4504ad['or'](_0x611d('0x31'),qs[_0x611d('0x32')](_0x4e36cd,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x611d('0x32')](_0x4e36cd));}else if(_0xd5e1db!=='fax'){_0x4504ad['or'](_0x611d('0x33'),qs[_0x611d('0x32')](_0x4e36cd));}_0x4504ad['or'](_0x611d('0x34'),qs[_0x611d('0x32')](_0x4e36cd,!![]),null);}}return _0x4504ad;}function parseAdvancedSearchFilter(_0x1f70f2,_0x56984b){var _0x44a791=getSqlClauses();var _0x43907c=as[_0x611d('0x35')](_0x1f70f2);var _0x5275bd=_0x43907c[_0x611d('0x36')];for(var _0x5bd281=0x0;_0x5bd281<_0x43907c[_0x611d('0x37')][_0x611d('0x38')];_0x5bd281++){var _0x3fc669=_0x43907c[_0x611d('0x37')][_0x5bd281];var _0x457e4a='i';var _0x2bfee5=_[_0x611d('0x39')](_0x56984b,[_0x611d('0x3a'),_0x3fc669['field']]);if(_0x2bfee5){var _0x5f0c56=as[_0x611d('0x3b')](_0x457e4a,_0x2bfee5['type'],_0x3fc669);_0x44a791[_0x611d('0x3c')][_0x5275bd](_0x5f0c56[_0x611d('0x3d')],_0x5f0c56[_0x611d('0x3e')][_0x611d('0x3f')],_0x5f0c56[_0x611d('0x3e')]['end']);}else{switch(_0x3fc669[_0x611d('0xa')]){case _0x611d('0x40'):var _0x50e756=parseReadParameter(_0x3fc669[_0x611d('0x3e')]);_0x44a791[_0x611d('0x41')]['and'](_0x50e756);break;case _0x611d('0x42'):if(_0x3fc669[_0x611d('0x43')]===_0x611d('0x44')){if(_0x3fc669['value'][_0x611d('0x45')]('\x20')['length']>0x1){_0x44a791[_0x611d('0x46')][_0x5275bd]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x611d('0x32')](_0x3fc669[_0x611d('0x3e')],!![]),null);}else{var _0x39bbbe='%'+_0x3fc669[_0x611d('0x3e')]+'%';_0x44a791['contact'][_0x5275bd](_0x611d('0x47'),_0x39bbbe,_0x39bbbe,_0x39bbbe);}}else{_0x2bfee5=_[_0x611d('0x39')](_0x56984b,[_0x611d('0x3a'),_0x611d('0x48')]);_0x3fc669[_0x611d('0xa')]='ContactId';_0x5f0c56=as[_0x611d('0x3b')](_0x457e4a,_0x2bfee5[_0x611d('0x49')],_0x3fc669);_0x44a791['contact'][_0x5275bd](_0x5f0c56[_0x611d('0x3d')],_0x5f0c56[_0x611d('0x3e')][_0x611d('0x3f')],_0x5f0c56['value'][_0x611d('0x4a')]);}break;case _0x611d('0x4b'):var _0x1f6ef3=_0x3fc669['value']['split'](',')[_0x611d('0x12')](function(_0x5db2d6){return Number(_0x5db2d6);});var _0x292fe8=parseTagParameter(_0x1f6ef3);_0x44a791[_0x611d('0x4c')][_0x611d('0x4d')][_0x611d('0x4e')](_0x292fe8);_0x44a791[_0x611d('0x4c')][_0x611d('0x4f')]=_0x1f6ef3;break;case _0x611d('0x50'):if(_0x3fc669[_0x611d('0x43')]===_0x611d('0x44')){_0x44a791[_0x611d('0x51')][_0x5275bd](_0x611d('0x52'),'%'+_0x3fc669[_0x611d('0x3e')]+'%',null);}else{_0x2bfee5=_[_0x611d('0x39')](_0x56984b,[_0x611d('0x3a'),_0x611d('0x53')]);_0x3fc669[_0x611d('0xa')]=_0x611d('0x53');_0x5f0c56=as[_0x611d('0x3b')](_0x457e4a,_0x2bfee5[_0x611d('0x49')],_0x3fc669);_0x44a791[_0x611d('0x51')][_0x5275bd](_0x5f0c56[_0x611d('0x3d')],_0x5f0c56['value'][_0x611d('0x3f')],_0x5f0c56[_0x611d('0x3e')][_0x611d('0x4a')]);}break;case'body':case'plainBody':_0x5f0c56=as['buildExpression']('me',null,_0x3fc669);_0x44a791[_0x611d('0x54')][_0x5275bd](_0x5f0c56[_0x611d('0x3d')],_0x5f0c56[_0x611d('0x3e')][_0x611d('0x3f')],_0x5f0c56[_0x611d('0x3e')][_0x611d('0x4a')]);break;}}}return _0x44a791;}function parseModelFields(_0x1e445a,_0x47623a,_0xf709d1){var _0x3ca2f9=utils[_0x611d('0x6')](_0x1e445a);var _0x3b38a5=squel[_0x611d('0x1e')]();var _0x323fcc=_(_0x47623a)[_0x611d('0x55')]()['map'](function(_0xd95e62){return _[_0x611d('0x56')](_0xf709d1,['name',_0xd95e62])?_0xd95e62:undefined;})[_0x611d('0x57')]()[_0x611d('0x3e')]();if(_0x323fcc[_0x611d('0x38')]>0x0){_0x323fcc['forEach'](function(_0x4d7975){if(_0x4d7975===_0x3ca2f9){_0x3b38a5['and']('i.'+_0x3ca2f9+_0x611d('0x58'),[]['concat'](_0x47623a[_0x4d7975]));}else if(_0x4d7975===_0x611d('0x59')){var _0x5d8133=JSON[_0x611d('0x5a')](_0x47623a[_0x4d7975])[_0x611d('0x5b')];var _0x3eacf3=JSON[_0x611d('0x5a')](_0x47623a[_0x4d7975])['$lte'];_0x3b38a5[_0x611d('0x4e')](_0x611d('0x5c'),_0x5d8133,_0x3eacf3);}else{if(_0x47623a[_0x4d7975]===_0x611d('0x5d')){_0x3b38a5[_0x611d('0x4e')]('i.'+_0x4d7975+_0x611d('0x5e'));}else{_0x3b38a5[_0x611d('0x4e')]('i.'+_0x4d7975+'\x20=\x20?',_0x47623a[_0x4d7975]);}}});}return _0x3b38a5;}function parseQueryParameters(_0xd2f516,_0x27dc95,_0x1d00c9){var _0x26969f=getSqlClauses();return Promise[_0x611d('0x5f')]()['then'](function(){return parseModelFields(_0xd2f516,_0x27dc95,_0x1d00c9);})[_0x611d('0x60')](function(_0x1ed0fe){_0x26969f[_0x611d('0x61')]['and'](_0x1ed0fe);return parseReadParameter(_0x27dc95[_0x611d('0x41')]);})['then'](function(_0x26f313){_0x26969f['read']['and'](_0x26f313);return parseTagParameter(_0x27dc95['tag']);})[_0x611d('0x60')](function(_0x57efaa){_0x26969f[_0x611d('0x4c')][_0x611d('0x4d')][_0x611d('0x4e')](_0x57efaa);return parseSearchFilter(_0xd2f516,_0x27dc95['filter']);})[_0x611d('0x60')](function(_0x41c80c){_0x26969f[_0x611d('0x62')]=_0x41c80c;return _0x26969f;});}function checkAccountsRestrictions(_0x52b1b8,_0x230170,_0x174013){var _0xcaa219=utils[_0x611d('0x6')](_0x52b1b8);var _0x4c1999=_0x611d('0x63')+_['capitalize'](_0x52b1b8)+(_0x52b1b8===_0x611d('0x64')?'Websites':_0x611d('0x65'));var _0xc1dfb0=squel[_0x611d('0x1e')]();return Promise[_0x611d('0x5f')]()[_0x611d('0x60')](function(){if(_0x174013[_0x611d('0x8')]&&_0x230170['role']===_0x611d('0x66')){return _0x230170[_0x4c1999]({'attributes':['id'],'raw':!![]});}})[_0x611d('0x60')](function(_0x4d5021){if(_0x4d5021){if(_0x4d5021[_0x611d('0x38')]===0x0){_0xc1dfb0[_0x611d('0x4e')]('i.'+_0xcaa219+_0x611d('0x5e'));}else{_0xc1dfb0[_0x611d('0x4e')]('i.'+_0xcaa219+_0x611d('0x58'),_[_0x611d('0x12')](_0x4d5021,'id'));}}else if(!_0x174013[_0xcaa219]){_0xc1dfb0[_0x611d('0x4e')]('i.'+_0xcaa219+_0x611d('0x67'));}})[_0x611d('0x60')](function(){return _0xc1dfb0;});}function getClosedOrderClause(_0x30df78,_0x62379a){var _0x5f864a='';var _0x35d8c0=['i.thirdDisposition','i.secondDisposition',_0x611d('0x68')];if(_0x30df78==='mail'){_0x35d8c0[_0x611d('0x69')](_0x611d('0x6a'));}if(_0x62379a[_0x611d('0x6b')]==='0'&&_0x30df78===_0x611d('0x2e')){_0x5f864a=_0x611d('0x6a');}else{if(_0x62379a[_0x611d('0x6b')]==='1'){_0x35d8c0[_0x611d('0x6c')]();}_0x5f864a=_0x611d('0x6d')+_0x35d8c0[_0x611d('0x6e')](',\x20')+')';}return _0x5f864a;}function getFilteredInteractions(_0x5f457b,_0x462db5,_0x39ad52,_0x521771){var _0x406746=utils['getInteractionFK'](_0x5f457b);var _0x2dbac4=_[_0x611d('0x6f')](_0x5f457b)+'Interaction';var _0x426378=[];var _0x16b575=getTagsQuery();var _0x102e54={'type':db[_0x611d('0x70')]['QueryTypes'][_0x611d('0x71')],'raw':!![]};var _0x25da88=[];var _0x30ab99=[];return db[_0x611d('0x72')]['query'](_0x16b575['toString'](),_0x102e54)[_0x611d('0x60')](function(_0x5834c9){_0x426378=_[_0x611d('0x73')](_0x5834c9,'id');_0x102e54=_['merge'](_0x102e54,{'model':db[_0x2dbac4],'mapToModel':!![],'nest':!![]});if(_0x39ad52[_0x611d('0x61')]){_0x521771[_0x611d('0x74')]['forEach'](function(_0x3bc389){_0x462db5[_0x611d('0xa')]('i.'+_0x3bc389);});}else{_0x462db5[_0x611d('0xa')](_0x611d('0x75'),'unreadMessages');_0x462db5[_0x611d('0xa')](_0x611d('0x76'),_0x611d('0x77'));_0x462db5[_0x611d('0xa')](_0x611d('0x78'),_0x611d('0x79'));if(_0x5f457b===_0x611d('0x2e')){_0x462db5[_0x611d('0xa')](_0x611d('0x7a'),_0x611d('0x7b'));_0x462db5['field'](_0x611d('0x7c'),_0x611d('0x7d'));_0x462db5['field']('i.id');_0x462db5['field'](_0x611d('0x7e'));_0x462db5['field'](_0x611d('0x7f'));_0x462db5[_0x611d('0xa')](_0x611d('0x80'));_0x462db5['field'](_0x611d('0x81'));_0x462db5['field'](_0x611d('0x82'));_0x462db5[_0x611d('0xa')]('i.lastMsgAt');_0x462db5[_0x611d('0xa')]('i.lastMsgDirection');_0x462db5[_0x611d('0xa')]('i.subject');_0x462db5[_0x611d('0xa')](_0x611d('0x68'));_0x462db5[_0x611d('0xa')](_0x611d('0x83'));_0x462db5['field'](_0x611d('0x84'));_0x462db5[_0x611d('0xa')](_0x611d('0x6a'));_0x462db5['field']('i.to');_0x462db5[_0x611d('0xa')]('i.ContactId');_0x462db5[_0x611d('0xa')](_0x611d('0x85'));_0x462db5[_0x611d('0xa')](_0x611d('0x86'));}else if(_0x5f457b===_0x611d('0x2c')){_0x462db5[_0x611d('0xa')](_0x611d('0x87'),'contactName');}else{_0x462db5[_0x611d('0xa')](_0x611d('0x88'),'contactName');}if(_0x5f457b!==_0x611d('0x2e')){_0x462db5[_0x611d('0xa')](_0x611d('0x89'));}_0x462db5[_0x611d('0xa')](_0x611d('0x8a'),_0x611d('0x8b'));_0x462db5['field'](_0x611d('0x8c'),_0x611d('0x8d'));_0x462db5['field'](_0x611d('0x8e'),_0x611d('0x8f'));_0x462db5[_0x611d('0xa')]('c.phone','Contact.phone');_0x462db5[_0x611d('0xa')](_0x611d('0x90'),_0x611d('0x91'));_0x462db5['field']('c.fax',_0x611d('0x92'));_0x462db5[_0x611d('0xa')](_0x611d('0x93'),_0x611d('0x94'));_0x462db5[_0x611d('0xa')](_0x611d('0x95'),_0x611d('0x96'));_0x462db5[_0x611d('0xa')](_0x611d('0x97'),'TagIds');}if(_0x521771['limit']){_0x462db5[_0x611d('0x98')](_0x521771[_0x611d('0x98')]);}if(_0x521771[_0x611d('0x99')]){_0x462db5['offset'](_0x521771[_0x611d('0x99')]);}return db[_0x611d('0x72')][_0x611d('0x9a')](_0x462db5[_0x611d('0x9b')](),_0x102e54);})[_0x611d('0x60')](function(_0x7f5f47){_0x25da88=_0x7f5f47;var _0x64570=getUsersQuery(_0x5f457b,_0x25da88);return db['sequelize']['query'](_0x64570['toString'](),_0x102e54);})[_0x611d('0x60')](function(_0x39de2f){_0x30ab99=_[_0x611d('0x9c')](_0x39de2f,_0x406746);if(_0x5f457b===_0x611d('0x2e')){return db[_0x611d('0x9d')]['findOne']({'attributes':[_0x611d('0x9e')],'raw':!![]});}})['then'](function(_0x42793c){var _0x55993d=_0x42793c?_0x42793c[_0x611d('0x9e')]:undefined;var _0x358962=_0x25da88[_0x611d('0x12')](function(_0x2d98c1){return updateInteraction(_0x2d98c1,_0x426378,_0x30ab99,_0x55993d);});return Promise['all'](_0x358962);});}function countFilteredInteractions(_0x319d24,_0x30694b){var _0x273147=_0x319d24[_0x611d('0x9f')]();_0x273147['field'](_0x611d('0xa0'));_0x273147[_0x611d('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x4096a7=utils[_0x611d('0x1f')](_0x30694b);if(!_[_0x611d('0xa1')](_0x4096a7)){_0x273147[_0x611d('0xa2')](_0x611d('0xa3'),_0x4096a7);}var _0x4bbdb8={'type':db[_0x611d('0x70')][_0x611d('0xa4')][_0x611d('0x71')],'raw':!![]};return db[_0x611d('0x72')][_0x611d('0x9a')](_0x273147[_0x611d('0x9b')](),_0x4bbdb8);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 4de72db..8e4abd5 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3540=['catch','updateInteraction','then','Users','TagIds','lodash','../../mysqldb','map','fullname','push','waiting','unmanaged','abandoned','closed','disposition','UserId','talking','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart'];(function(_0x195830,_0x519a07){var _0x59cf09=function(_0x10566a){while(--_0x10566a){_0x195830['push'](_0x195830['shift']());}};_0x59cf09(++_0x519a07);}(_0x3540,0x155));var _0x0354=function(_0x1190c2,_0x2c078b){_0x1190c2=_0x1190c2-0x0;var _0x6ec988=_0x3540[_0x1190c2];return _0x6ec988;};'use strict';var _=require(_0x0354('0x0'));var db=require(_0x0354('0x1'))['db'];function getInteractionUsers(_0x29f483,_0x32ed1d){return new Promise(function(_0x5d3152,_0x24a86b){try{var _0x3ad281=[];if(_0x32ed1d[_0x29f483]){_0x3ad281=_0x32ed1d[_0x29f483][_0x0354('0x2')](function(_0xe601d3){return{'id':_0xe601d3['id'],'fullname':_0xe601d3[_0x0354('0x3')]};});}return _0x5d3152(_0x3ad281);}catch(_0x227cc){_0x24a86b(_0x227cc);}});}function getInteractionTags(_0x986d07,_0x37661f){var _0x51e338=[];if(_0x986d07){_0x986d07['split'](',')['forEach'](function(_0x88cfc){_0x51e338[_0x0354('0x4')](_0x37661f[_0x88cfc]);});}return _0x51e338;}function updateWaitingCounter(_0x1e4e57){if(_0x1e4e57[_0x0354('0x5')]){_0x1e4e57[_0x0354('0x5')]-=0x1;}}function updateInteractionCounters(_0x53095d){_0x53095d[_0x0354('0x5')]=0x0;_0x53095d['talking']=0x0;_0x53095d['answered']=0x0;_0x53095d[_0x0354('0x6')]=0x0;_0x53095d[_0x0354('0x7')]=0x0;_0x53095d['total']=0x0;if(_0x53095d[_0x0354('0x8')]){if(_0x53095d[_0x0354('0x9')]===_0x0354('0x7')){_0x53095d[_0x0354('0x7')]+=0x1;updateWaitingCounter(_0x53095d);}if(_0x53095d[_0x0354('0xa')]){_0x53095d['answered']+=0x1;if(_0x53095d[_0x0354('0xb')]){_0x53095d[_0x0354('0xb')]-=0x1;}}else{if(_0x53095d[_0x0354('0x9')]){_0x53095d[_0x0354('0x6')]+=0x1;updateWaitingCounter(_0x53095d);}}}else{if(!_0x53095d[_0x0354('0xa')]){_0x53095d[_0x0354('0x5')]+=0x1;}if(_0x53095d[_0x0354('0xa')]){_0x53095d[_0x0354('0xb')]+=0x1;updateWaitingCounter(_0x53095d);}}_0x53095d['total']+=0x1;return _0x53095d;}function getLastMessageText(_0x1c4dab){return db[_0x0354('0xc')][_0x0354('0xd')]({'where':{'$and':[{'MailInteractionId':_0x1c4dab['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0354('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0354('0xf')],'order':_0x0354('0x10'),'raw':!![]})['then'](function(_0xca8d85){if(_0xca8d85&&_0xca8d85[_0x0354('0xf')]){_0x1c4dab[_0x0354('0x11')]=_[_0x0354('0x12')](_0xca8d85[_0x0354('0xf')]);}return _0x1c4dab;})[_0x0354('0x13')](function(_0x186ac8){throw _0x186ac8;});}exports[_0x0354('0x14')]=function(_0x371575,_0x4f3e5f,_0xd70dbc,_0x3ed15f){return new Promise(function(_0x4a535d,_0x306c77){return getInteractionUsers(_0x371575['id'],_0xd70dbc)[_0x0354('0x15')](function(_0x540e4e){_0x371575[_0x0354('0x16')]=_0x540e4e;return getInteractionTags(_0x371575[_0x0354('0x17')],_0x4f3e5f);})[_0x0354('0x15')](function(_0x767525){_0x371575['Tags']=_0x767525;delete _0x371575['TagIds'];return updateInteractionCounters(_0x371575);})[_0x0354('0x15')](function(_0x218f4b){if(_0x3ed15f){return getLastMessageText(_0x218f4b);}else{return _0x218f4b;}})[_0x0354('0x15')](function(_0x4bf0d6){_0x4a535d(_0x4bf0d6);})[_0x0354('0x13')](function(_0x10e2fa){_0x306c77(_0x10e2fa);});});}; \ No newline at end of file +var _0x3b59=['disposition','UserId','unmanaged','total','MailMessage','findOne','out','plainBody','-id','then','trimStart','catch','Users','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','abandoned','closed'];(function(_0x2515a3,_0x356de5){var _0xe8bbb=function(_0x18876b){while(--_0x18876b){_0x2515a3['push'](_0x2515a3['shift']());}};_0xe8bbb(++_0x356de5);}(_0x3b59,0x175));var _0x93b5=function(_0xcf7764,_0x4dc7c8){_0xcf7764=_0xcf7764-0x0;var _0x454db4=_0x3b59[_0xcf7764];return _0x454db4;};'use strict';var _=require('lodash');var db=require(_0x93b5('0x0'))['db'];function getInteractionUsers(_0x76e641,_0x437410){return new Promise(function(_0x24618b,_0x7a6818){try{var _0x33ad18=[];if(_0x437410[_0x76e641]){_0x33ad18=_0x437410[_0x76e641][_0x93b5('0x1')](function(_0x5e37cd){return{'id':_0x5e37cd['id'],'fullname':_0x5e37cd[_0x93b5('0x2')]};});}return _0x24618b(_0x33ad18);}catch(_0x5e3d68){_0x7a6818(_0x5e3d68);}});}function getInteractionTags(_0x2558f8,_0x59f5ba){var _0x5334d3=[];if(_0x2558f8){_0x2558f8[_0x93b5('0x3')](',')[_0x93b5('0x4')](function(_0x32f53a){_0x5334d3[_0x93b5('0x5')](_0x59f5ba[_0x32f53a]);});}return _0x5334d3;}function updateWaitingCounter(_0x59a16b){if(_0x59a16b[_0x93b5('0x6')]){_0x59a16b[_0x93b5('0x6')]-=0x1;}}function updateInteractionCounters(_0x36b2e5){_0x36b2e5[_0x93b5('0x6')]=0x0;_0x36b2e5[_0x93b5('0x7')]=0x0;_0x36b2e5[_0x93b5('0x8')]=0x0;_0x36b2e5['unmanaged']=0x0;_0x36b2e5[_0x93b5('0x9')]=0x0;_0x36b2e5['total']=0x0;if(_0x36b2e5[_0x93b5('0xa')]){if(_0x36b2e5[_0x93b5('0xb')]===_0x93b5('0x9')){_0x36b2e5['abandoned']+=0x1;updateWaitingCounter(_0x36b2e5);}if(_0x36b2e5[_0x93b5('0xc')]){_0x36b2e5[_0x93b5('0x8')]+=0x1;if(_0x36b2e5['talking']){_0x36b2e5['talking']-=0x1;}}else{if(_0x36b2e5['disposition']){_0x36b2e5[_0x93b5('0xd')]+=0x1;updateWaitingCounter(_0x36b2e5);}}}else{if(!_0x36b2e5[_0x93b5('0xc')]){_0x36b2e5[_0x93b5('0x6')]+=0x1;}if(_0x36b2e5[_0x93b5('0xc')]){_0x36b2e5[_0x93b5('0x7')]+=0x1;updateWaitingCounter(_0x36b2e5);}}_0x36b2e5[_0x93b5('0xe')]+=0x1;return _0x36b2e5;}function getLastMessageText(_0xd02627){return db[_0x93b5('0xf')][_0x93b5('0x10')]({'where':{'$and':[{'MailInteractionId':_0xd02627['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x93b5('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x93b5('0x12')],'order':_0x93b5('0x13'),'raw':!![]})[_0x93b5('0x14')](function(_0x176c7f){if(_0x176c7f&&_0x176c7f['plainBody']){_0xd02627['lastMsgText']=_[_0x93b5('0x15')](_0x176c7f[_0x93b5('0x12')]);}return _0xd02627;})[_0x93b5('0x16')](function(_0x1007df){throw _0x1007df;});}exports['updateInteraction']=function(_0x482725,_0x40a2b5,_0x127fed,_0x1a5d82){return new Promise(function(_0x278931,_0x3e4d64){return getInteractionUsers(_0x482725['id'],_0x127fed)['then'](function(_0x295fff){_0x482725[_0x93b5('0x17')]=_0x295fff;return getInteractionTags(_0x482725['TagIds'],_0x40a2b5);})[_0x93b5('0x14')](function(_0x46c3b6){_0x482725['Tags']=_0x46c3b6;delete _0x482725['TagIds'];return updateInteractionCounters(_0x482725);})['then'](function(_0x14657c){if(_0x1a5d82){return getLastMessageText(_0x14657c);}else{return _0x14657c;}})['then'](function(_0x34f441){_0x278931(_0x34f441);})['catch'](function(_0x164864){_0x3e4d64(_0x164864);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 6a08434..cb182ca 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4723=['capitalize','chat','Account','InteractionId','upperFirst','unknown','websites','_interaction_has_tags','_interactions','toLowerCase','toUpperCase','name','role','stringify','Interaction','findOne','then','update','error','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20interaction=','\x20body=','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','whatsapp-interactions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4723,0xea));var _0x3472=function(_0x2f1ee0,_0x4ca1f4){_0x2f1ee0=_0x2f1ee0-0x0;var _0x576314=_0x4723[_0x2f1ee0];return _0x576314;};'use strict';var _=require('lodash');var db=require(_0x3472('0x0'))['db'];var loggers={'openchannel':require(_0x3472('0x1'))(_0x3472('0x2')),'mail':require(_0x3472('0x1'))(_0x3472('0x3')),'fax':require(_0x3472('0x1'))(_0x3472('0x4')),'sms':require(_0x3472('0x1'))('sms-interactions'),'chat':require(_0x3472('0x1'))('chat-interactions'),'whatsapp':require(_0x3472('0x1'))(_0x3472('0x5'))};function getAccountFK(_0x49869b){return _[_0x3472('0x6')](_0x49869b)+(_0x49869b===_0x3472('0x7')?'Website':_0x3472('0x8'))+'Id';}function getInteractionFK(_0x2468f2){return _[_0x3472('0x6')](_0x2468f2)+_0x3472('0x9');}function getInteractionId(_0x368dde,_0x541af8,_0x4d1abf){if(_0x368dde&&_0x368dde[_[_0x3472('0xa')](_0x4d1abf)+_0x3472('0x9')]){return _0x368dde[_[_0x3472('0xa')](_0x4d1abf)+_0x3472('0x9')];}else if(_0x368dde&&_0x368dde['id']){return _0x368dde['id'];}else if(_0x541af8&&_0x541af8['id']){return _0x541af8['id'];}else{return _0x3472('0xb');}}function getInteractionsTables(_0x18035a){return{'accounts':_0x18035a+'_'+(_0x18035a===_0x3472('0x7')?_0x3472('0xc'):'accounts'),'interactions':_0x18035a+'_interactions','interactionsTags':_0x18035a+_0x3472('0xd'),'messages':_0x18035a+'_messages','userInteractions':'user_has_'+_0x18035a+_0x3472('0xe')};}function getSelectedTags(_0x6f9ab3){var _0x3c1862=[];if(_0x6f9ab3){_0x3c1862=Array['isArray'](_0x6f9ab3)?_0x6f9ab3:[_0x6f9ab3];}return _0x3c1862;}function log(_0x29efee,_0xc5932e,_0x58a5c3,_0x57276d,_0x5801d6,_0xa70064){loggers[_0x5801d6[_0x3472('0xf')]()][_0x29efee]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa70064[_0x3472('0x10')](),_0xc5932e?_0xc5932e['id']:null,_0xc5932e?_0xc5932e[_0x3472('0x11')]:null,_0xc5932e?_0xc5932e[_0x3472('0x12')]:null,getInteractionId(_0x58a5c3,_0x57276d,_0x5801d6),_0x58a5c3?JSON[_0x3472('0x13')](_0x58a5c3):'null');}function updateUser(_0x78ce53,_0x32abb8,_0x35a8c9,_0x204f32,_0x3eeea9){db[_[_0x3472('0xa')](_0x204f32)+_0x3472('0x14')][_0x3472('0x15')]({'where':{'id':getInteractionId(_0x32abb8,_0x35a8c9,_0x204f32)}})[_0x3472('0x16')](function(_0x5487d6){if(_0x5487d6){return _0x5487d6[_0x3472('0x17')]({'UserId':_0x78ce53?_0x78ce53['id']:null});}})[_0x3472('0x16')](function(_0x4364ad){if(_0x4364ad){log('info',_0x78ce53,_0x32abb8,_0x35a8c9,_0x204f32,_0x3eeea9);}})['catch'](function(){log(_0x3472('0x18'),_0x78ce53,_0x32abb8,_0x35a8c9,_0x204f32,_0x3eeea9);});}function logAcceptMessage(_0xf2657b,_0x2c6f7f,_0x42f533,_0x25f6de){var _0x74b15e=loggers[_0xf2657b[_0x3472('0xf')]()];var _0xbc874b=_0x2c6f7f['id'];var _0x226ad2=_0x2c6f7f['name'];var _0x162764=_0x2c6f7f[_0x3472('0x12')];var _0x22e626=JSON[_0x3472('0x13')](_0x25f6de||null);_0x74b15e['info']('['+_0xf2657b[_0x3472('0x10')]()+_0x3472('0x19')+_0xbc874b+_0x3472('0x1a')+_0x226ad2+_0x3472('0x1b')+_0x162764+_0x3472('0x1c')+_0x42f533+_0x3472('0x1d')+_0x22e626);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x3646=['lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','name','role','stringify','Interaction','findOne','then','toLowerCase','toUpperCase','MESSAGE:ACCEPT]\x20id=','\x20interaction=','\x20body=','exports'];(function(_0x18c487,_0x45d9ca){var _0x30cd31=function(_0x5dd551){while(--_0x5dd551){_0x18c487['push'](_0x18c487['shift']());}};_0x30cd31(++_0x45d9ca);}(_0x3646,0xc0));var _0x6364=function(_0x51c8be,_0x445547){_0x51c8be=_0x51c8be-0x0;var _0x6a1b55=_0x3646[_0x51c8be];return _0x6a1b55;};'use strict';var _=require(_0x6364('0x0'));var db=require(_0x6364('0x1'))['db'];var loggers={'openchannel':require(_0x6364('0x2'))(_0x6364('0x3')),'mail':require(_0x6364('0x2'))('mail-interactions'),'fax':require(_0x6364('0x2'))(_0x6364('0x4')),'sms':require(_0x6364('0x2'))(_0x6364('0x5')),'chat':require(_0x6364('0x2'))(_0x6364('0x6')),'whatsapp':require(_0x6364('0x2'))(_0x6364('0x7'))};function getAccountFK(_0x314d90){return _[_0x6364('0x8')](_0x314d90)+(_0x314d90==='chat'?_0x6364('0x9'):_0x6364('0xa'))+'Id';}function getInteractionFK(_0x4a697d){return _[_0x6364('0x8')](_0x4a697d)+'InteractionId';}function getInteractionId(_0x2addd1,_0x42a8cc,_0x231438){if(_0x2addd1&&_0x2addd1[_[_0x6364('0xb')](_0x231438)+_0x6364('0xc')]){return _0x2addd1[_[_0x6364('0xb')](_0x231438)+'InteractionId'];}else if(_0x2addd1&&_0x2addd1['id']){return _0x2addd1['id'];}else if(_0x42a8cc&&_0x42a8cc['id']){return _0x42a8cc['id'];}else{return _0x6364('0xd');}}function getInteractionsTables(_0x2a591e){return{'accounts':_0x2a591e+'_'+(_0x2a591e==='chat'?_0x6364('0xe'):_0x6364('0xf')),'interactions':_0x2a591e+_0x6364('0x10'),'interactionsTags':_0x2a591e+_0x6364('0x11'),'messages':_0x2a591e+'_messages','userInteractions':_0x6364('0x12')+_0x2a591e+_0x6364('0x10')};}function getSelectedTags(_0xa43502){var _0x594db2=[];if(_0xa43502){_0x594db2=Array[_0x6364('0x13')](_0xa43502)?_0xa43502:[_0xa43502];}return _0x594db2;}function log(_0x371abc,_0xa1a90c,_0x4ab63c,_0x39f080,_0x303401,_0x329628){loggers[_0x303401['toLowerCase']()][_0x371abc]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x329628['toUpperCase'](),_0xa1a90c?_0xa1a90c['id']:null,_0xa1a90c?_0xa1a90c[_0x6364('0x14')]:null,_0xa1a90c?_0xa1a90c[_0x6364('0x15')]:null,getInteractionId(_0x4ab63c,_0x39f080,_0x303401),_0x4ab63c?JSON[_0x6364('0x16')](_0x4ab63c):'null');}function updateUser(_0x59055e,_0x826856,_0x36be4f,_0x24149f,_0xa4f4c9){db[_[_0x6364('0xb')](_0x24149f)+_0x6364('0x17')][_0x6364('0x18')]({'where':{'id':getInteractionId(_0x826856,_0x36be4f,_0x24149f)}})[_0x6364('0x19')](function(_0x3dfc02){if(_0x3dfc02){return _0x3dfc02['update']({'UserId':_0x59055e?_0x59055e['id']:null});}})[_0x6364('0x19')](function(_0xe23f2a){if(_0xe23f2a){log('info',_0x59055e,_0x826856,_0x36be4f,_0x24149f,_0xa4f4c9);}})['catch'](function(){log('error',_0x59055e,_0x826856,_0x36be4f,_0x24149f,_0xa4f4c9);});}function logAcceptMessage(_0x2739d0,_0x51b572,_0x239eb5,_0x1eedc1){var _0x19f321=loggers[_0x2739d0[_0x6364('0x1a')]()];var _0x2d1e37=_0x51b572['id'];var _0x439a8a=_0x51b572[_0x6364('0x14')];var _0x54f087=_0x51b572[_0x6364('0x15')];var _0x1bf959=JSON['stringify'](_0x1eedc1||null);_0x19f321['info']('['+_0x2739d0[_0x6364('0x1b')]()+_0x6364('0x1c')+_0x2d1e37+'\x20name='+_0x439a8a+'\x20role='+_0x54f087+_0x6364('0x1d')+_0x239eb5+_0x6364('0x1e')+_0x1bf959);}module[_0x6364('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 068990d..60d113a 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 _0xeaac=['hasOwnProperty','use','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','base64','utf8','final','parse'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xeaac,0xa7));var _0xceaa=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xeaac[_0x3bf83f];return _0x22c4a9;};'use strict';var crypto=require(_0xceaa('0x0'));var util=require(_0xceaa('0x1'));var compose=require(_0xceaa('0x2'));var db=require(_0xceaa('0x3'))['db'];var config=require(_0xceaa('0x4'));function getValueFromLicense(_0x1586c7,_0x315474){if(_0x1586c7&&_0x315474){if(_0x315474[_0xceaa('0x5')]&&_0x315474[_0xceaa('0x6')]){var _0x233cfa=_0x315474[_0xceaa('0x5')];var _0x52824b=_0x315474[_0xceaa('0x6')];var _0x5c0c28=_0x233cfa[_0xceaa('0x7')]('-')[0x4];var _0x41ceb1=_0x233cfa[_0xceaa('0x7')]('-')[0x0];var _0x4fbfd0=crypto[_0xceaa('0x8')]('aes-256-ctr',util[_0xceaa('0x9')](_0xceaa('0xa'),_0x5c0c28,_0x233cfa,_0x41ceb1));var _0x3e0528=_0x4fbfd0['update'](_0x52824b,_0xceaa('0xb'),_0xceaa('0xc'));_0x3e0528+=_0x4fbfd0[_0xceaa('0xd')]('utf8');var _0x55c359=JSON[_0xceaa('0xe')](_0x3e0528);return _0x55c359[_0xceaa('0xf')](_0x1586c7)?_0x55c359[_0x1586c7]:null;}}return null;}function isLimit(_0x23fcf6,_0x35e2fe,_0x2cc012,_0x37f5e6){var _0x29283a=_0x35e2fe;return compose()[_0xceaa('0x10')](function(_0x1ced28,_0x1ef0a9,_0x335c04){return db['License'][_0xceaa('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x560eda){var _0x5ca760=getValueFromLicense(_0x23fcf6,_0x560eda);return _0x5ca760?_0x5ca760:_0x29283a;})[_0xceaa('0x12')](function(_0x157c4e){_0x29283a=_0x157c4e;return _0x2cc012[_0xceaa('0x13')](_0x37f5e6);})[_0xceaa('0x12')](function(_0x3a3fa9){if(_0x3a3fa9>=_0x29283a){return _0x1ef0a9[_0xceaa('0x14')](0x193)['json']({'message':util[_0xceaa('0x9')](_0xceaa('0x15'),_0x23fcf6)});}_0x335c04();})[_0xceaa('0x16')](function(_0x2b3d95){_0x335c04(_0x2b3d95);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xceaa('0x17')],{'where':{'$or':[{'role':_0xceaa('0x18')},{'role':'user'}]}});}exports[_0xceaa('0x19')]=isUserLimit; \ No newline at end of file +var _0xf16f=['data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License','then','count','status','json','catch','admin','user','crypto','util','composable-middleware','../../mysqldb'];(function(_0x22e907,_0x3bffbd){var _0x2dae48=function(_0x1ab740){while(--_0x1ab740){_0x22e907['push'](_0x22e907['shift']());}};_0x2dae48(++_0x3bffbd);}(_0xf16f,0x141));var _0xff16=function(_0x2e8a43,_0x355f4f){_0x2e8a43=_0x2e8a43-0x0;var _0x8ebf50=_0xf16f[_0x2e8a43];return _0x8ebf50;};'use strict';var crypto=require(_0xff16('0x0'));var util=require(_0xff16('0x1'));var compose=require(_0xff16('0x2'));var db=require(_0xff16('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x35cf50,_0xdfb659){if(_0x35cf50&&_0xdfb659){if(_0xdfb659[_0xff16('0x4')]&&_0xdfb659[_0xff16('0x5')]){var _0x253031=_0xdfb659[_0xff16('0x4')];var _0x262279=_0xdfb659[_0xff16('0x5')];var _0x2adb0f=_0x253031[_0xff16('0x6')]('-')[0x4];var _0x1dbeb9=_0x253031[_0xff16('0x6')]('-')[0x0];var _0x15712a=crypto[_0xff16('0x7')](_0xff16('0x8'),util[_0xff16('0x9')](_0xff16('0xa'),_0x2adb0f,_0x253031,_0x1dbeb9));var _0x3efa2d=_0x15712a[_0xff16('0xb')](_0x262279,_0xff16('0xc'),_0xff16('0xd'));_0x3efa2d+=_0x15712a[_0xff16('0xe')](_0xff16('0xd'));var _0x505ed7=JSON[_0xff16('0xf')](_0x3efa2d);return _0x505ed7[_0xff16('0x10')](_0x35cf50)?_0x505ed7[_0x35cf50]:null;}}return null;}function isLimit(_0x5b7b4b,_0x38434a,_0x4923b6,_0x1ac800){var _0x54c92b=_0x38434a;return compose()['use'](function(_0x4a5298,_0x1606a3,_0x88f6c1){return db[_0xff16('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xff16('0x12')](function(_0x189493){var _0x5f219a=getValueFromLicense(_0x5b7b4b,_0x189493);return _0x5f219a?_0x5f219a:_0x54c92b;})[_0xff16('0x12')](function(_0x2fe003){_0x54c92b=_0x2fe003;return _0x4923b6[_0xff16('0x13')](_0x1ac800);})[_0xff16('0x12')](function(_0x377970){if(_0x377970>=_0x54c92b){return _0x1606a3[_0xff16('0x14')](0x193)[_0xff16('0x15')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x5b7b4b)});}_0x88f6c1();})[_0xff16('0x16')](function(_0x19513b){_0x88f6c1(_0x19513b);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0xff16('0x17')},{'role':_0xff16('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ddde55b..2896088 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 _0x0bfa=['castTo','CAST(','field','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','length','split','forEach','shift','match','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','days','format','YYYY-MM-DD'];(function(_0x5d43e2,_0x1d38e3){var _0x31539b=function(_0x5931a9){while(--_0x5931a9){_0x5d43e2['push'](_0x5d43e2['shift']());}};_0x31539b(++_0x1d38e3);}(_0x0bfa,0xf9));var _0xa0bf=function(_0x1c9f7b,_0x2dc4b0){_0x1c9f7b=_0x1c9f7b-0x0;var _0x580a06=_0x0bfa[_0x1c9f7b];return _0x580a06;};'use strict';var _=require(_0xa0bf('0x0'));var moment=require(_0xa0bf('0x1'));exports[_0xa0bf('0x2')]=function(_0x59ba05){var _0x21f705={'conditions':[]};_0x21f705[_0xa0bf('0x3')]=_['startsWith'](_0x59ba05,_0xa0bf('0x4'))?'or':_0xa0bf('0x5');var _0x29874f=_0x59ba05[_0xa0bf('0x6')](_0xa0bf('0x7'),'')[_0xa0bf('0x6')]('[$or]','')['split']('||');for(var _0x1f862a=0x0;_0x1f862a<_0x29874f[_0xa0bf('0x8')];_0x1f862a++){var _0x3a94ba=_0x29874f[_0x1f862a][_0xa0bf('0x9')](':=');var _0x38e74c=_0x3a94ba[0x0];var _0x5d7f61=_0x3a94ba['slice'](0x1);_0x5d7f61[_0xa0bf('0xa')](function(_0x437e59){var _0x33af23=_0x437e59[_0xa0bf('0x9')]('[')[_0xa0bf('0xb')]();var _0x38aa04=_0x437e59[_0xa0bf('0xc')](/\[(.*?)\]/g);_0x38aa04[_0xa0bf('0xa')](function(_0x3461d0){var _0x45f837=_0x3461d0[_0xa0bf('0x9')]('[')['filter'](function(_0x355a6f){return _0x355a6f['indexOf'](']')>-0x1;})['map'](function(_0x37e4a1){return _0x37e4a1[_0xa0bf('0x9')](']')[0x0];})[0x0];_0x21f705[_0xa0bf('0xd')][_0xa0bf('0xe')]({'field':_0x38e74c,'operator':_0x33af23,'value':_0x45f837});});});}return _0x21f705;};exports[_0xa0bf('0xf')]=function(_0x5a821e,_0x8fcab7,_0x16d11d){var _0x1712d0={};if(_0x8fcab7===_0xa0bf('0x10')){if(_0x16d11d[_0xa0bf('0x11')]===_0xa0bf('0x12')){_0x16d11d['operator']='$between';_0x16d11d[_0xa0bf('0x13')]+=','+_0x16d11d[_0xa0bf('0x13')];}else if(_[_0xa0bf('0x14')]([_0xa0bf('0x15'),_0xa0bf('0x16')],_0x16d11d[_0xa0bf('0x11')])){_0x16d11d[_0xa0bf('0x13')]=moment(_0x16d11d[_0xa0bf('0x13')])['add'](0x1,_0xa0bf('0x17'))[_0xa0bf('0x18')](_0xa0bf('0x19'));}}if(_0x16d11d['castTo']){_0x8fcab7=_0x16d11d[_0xa0bf('0x1a')];_0x1712d0['text']=_0xa0bf('0x1b')+_0x5a821e+'.'+_0x16d11d[_0xa0bf('0x1c')]+'\x20AS\x20'+_0x16d11d[_0xa0bf('0x1a')]+')\x20'+parseOperator(_0x16d11d[_0xa0bf('0x11')]);}else{_0x1712d0['text']=_0x5a821e+'.'+_0x16d11d[_0xa0bf('0x1c')]+'\x20'+parseOperator(_0x16d11d[_0xa0bf('0x11')]);}if(_['includes']([_0xa0bf('0x1d'),_0xa0bf('0x1e')],_0x16d11d[_0xa0bf('0x11')]))_0x1712d0[_0xa0bf('0x1f')]='('+_0x1712d0[_0xa0bf('0x1f')]+_0xa0bf('0x20')+_0x5a821e+'.'+_0x16d11d[_0xa0bf('0x1c')]+_0xa0bf('0x21');_0x1712d0[_0xa0bf('0x13')]=parseValue(_0x8fcab7,_0x16d11d[_0xa0bf('0x11')],_0x16d11d[_0xa0bf('0x13')]);return _0x1712d0;};function parseOperator(_0x2a1723){var _0x476eaf;switch(_0x2a1723){case _0xa0bf('0x22'):_0x476eaf=_0xa0bf('0x23');break;case'$notIn':_0x476eaf=_0xa0bf('0x24');break;case _0xa0bf('0x12'):_0x476eaf=_0xa0bf('0x25');break;case _0xa0bf('0x1d'):_0x476eaf=_0xa0bf('0x26');break;case'$substring':case _0xa0bf('0x27'):case _0xa0bf('0x28'):_0x476eaf=_0xa0bf('0x29');break;case'$lt':_0x476eaf='<\x20?';break;case _0xa0bf('0x15'):_0x476eaf=_0xa0bf('0x2a');break;case'$lte':_0x476eaf=_0xa0bf('0x2b');break;case _0xa0bf('0x2c'):_0x476eaf=_0xa0bf('0x2d');break;case _0xa0bf('0x2e'):_0x476eaf=_0xa0bf('0x2f');break;}return _0x476eaf;}function parseValue(_0x5448ea,_0x208988,_0x599e40){var _0x1f517c={'start':undefined,'end':undefined};switch(_0x208988){case'$in':case'$notIn':_0x1f517c[_0xa0bf('0x30')]=_0x599e40[_0xa0bf('0x9')](',');break;case _0xa0bf('0x31'):_0x1f517c[_0xa0bf('0x30')]='%'+_0x599e40+'%';break;case _0xa0bf('0x27'):_0x1f517c['start']=_0x599e40+'%';break;case _0xa0bf('0x28'):_0x1f517c[_0xa0bf('0x30')]='%'+_0x599e40;break;case'$between':var _0x527bd5=_0x599e40[_0xa0bf('0x9')](',');var _0x599e40=_0x527bd5[_0xa0bf('0xb')]();var _0x57e6e4=_0x527bd5['pop']();if(_0x5448ea===_0xa0bf('0x10')){_0x599e40=moment(_0x599e40)[_0xa0bf('0x32')](0x0,!![])[_0xa0bf('0x18')]();_0x57e6e4=moment(_0x57e6e4)[_0xa0bf('0x32')](0x0,!![])[_0xa0bf('0x33')](0x17,_0xa0bf('0x34'))[_0xa0bf('0x33')](0x3b,_0xa0bf('0x35'))[_0xa0bf('0x33')](0x3b,_0xa0bf('0x36'))[_0xa0bf('0x18')]();}_0x1f517c={'start':_0x599e40,'end':_0x57e6e4};break;default:_0x1f517c[_0xa0bf('0x30')]=_0x599e40;break;}return _0x1f517c;} \ No newline at end of file +var _0x9404=['\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','DATE','utcOffset','format','lodash','parseSearch','startsWith','and','replace','split','slice','forEach','shift','match','filter','map','push','buildExpression','$eq','operator','$between','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20'];(function(_0x375268,_0x34b572){var _0x24d351=function(_0x1dd29d){while(--_0x1dd29d){_0x375268['push'](_0x375268['shift']());}};_0x24d351(++_0x34b572);}(_0x9404,0x13e));var _0x4940=function(_0x4600fd,_0x2d9ce9){_0x4600fd=_0x4600fd-0x0;var _0xba2596=_0x9404[_0x4600fd];return _0xba2596;};'use strict';var _=require(_0x4940('0x0'));var moment=require('moment');exports[_0x4940('0x1')]=function(_0x580b2b){var _0x489b1d={'conditions':[]};_0x489b1d['sqlOperator']=_[_0x4940('0x2')](_0x580b2b,'[$or]')?'or':_0x4940('0x3');var _0x314e78=_0x580b2b[_0x4940('0x4')]('[$and]','')[_0x4940('0x4')]('[$or]','')[_0x4940('0x5')]('||');for(var _0x3d40f3=0x0;_0x3d40f3<_0x314e78['length'];_0x3d40f3++){var _0x52c04f=_0x314e78[_0x3d40f3][_0x4940('0x5')](':=');var _0x217a48=_0x52c04f[0x0];var _0x18bd63=_0x52c04f[_0x4940('0x6')](0x1);_0x18bd63[_0x4940('0x7')](function(_0x748448){var _0x2a00f0=_0x748448['split']('[')[_0x4940('0x8')]();var _0xfe0afe=_0x748448[_0x4940('0x9')](/\[(.*?)\]/g);_0xfe0afe['forEach'](function(_0x404a53){var _0x267743=_0x404a53[_0x4940('0x5')]('[')[_0x4940('0xa')](function(_0x3a5ffd){return _0x3a5ffd['indexOf'](']')>-0x1;})[_0x4940('0xb')](function(_0xdf3efa){return _0xdf3efa['split'](']')[0x0];})[0x0];_0x489b1d['conditions'][_0x4940('0xc')]({'field':_0x217a48,'operator':_0x2a00f0,'value':_0x267743});});});}return _0x489b1d;};exports[_0x4940('0xd')]=function(_0x30a2c8,_0xfd810d,_0x1b7592){var _0x2cfba9={};if(_0xfd810d==='DATE'){if(_0x1b7592['operator']===_0x4940('0xe')){_0x1b7592[_0x4940('0xf')]=_0x4940('0x10');_0x1b7592[_0x4940('0x11')]+=','+_0x1b7592[_0x4940('0x11')];}else if(_[_0x4940('0x12')]([_0x4940('0x13'),_0x4940('0x14')],_0x1b7592[_0x4940('0xf')])){_0x1b7592[_0x4940('0x11')]=moment(_0x1b7592[_0x4940('0x11')])[_0x4940('0x15')](0x1,_0x4940('0x16'))['format'](_0x4940('0x17'));}}if(_0x1b7592[_0x4940('0x18')]){_0xfd810d=_0x1b7592['castTo'];_0x2cfba9[_0x4940('0x19')]=_0x4940('0x1a')+_0x30a2c8+'.'+_0x1b7592[_0x4940('0x1b')]+_0x4940('0x1c')+_0x1b7592[_0x4940('0x18')]+')\x20'+parseOperator(_0x1b7592['operator']);}else{_0x2cfba9['text']=_0x30a2c8+'.'+_0x1b7592[_0x4940('0x1b')]+'\x20'+parseOperator(_0x1b7592[_0x4940('0xf')]);}if(_[_0x4940('0x12')]([_0x4940('0x1d'),_0x4940('0x1e')],_0x1b7592[_0x4940('0xf')]))_0x2cfba9[_0x4940('0x19')]='('+_0x2cfba9['text']+_0x4940('0x1f')+_0x30a2c8+'.'+_0x1b7592[_0x4940('0x1b')]+_0x4940('0x20');_0x2cfba9[_0x4940('0x11')]=parseValue(_0xfd810d,_0x1b7592[_0x4940('0xf')],_0x1b7592[_0x4940('0x11')]);return _0x2cfba9;};function parseOperator(_0x3a547c){var _0x199c67;switch(_0x3a547c){case _0x4940('0x21'):_0x199c67=_0x4940('0x22');break;case _0x4940('0x1e'):_0x199c67='NOT\x20IN\x20?';break;case _0x4940('0xe'):_0x199c67=_0x4940('0x23');break;case _0x4940('0x1d'):_0x199c67=_0x4940('0x24');break;case _0x4940('0x25'):case _0x4940('0x26'):case'$endsWith':_0x199c67=_0x4940('0x27');break;case _0x4940('0x28'):_0x199c67=_0x4940('0x29');break;case _0x4940('0x13'):_0x199c67='>\x20?';break;case _0x4940('0x14'):_0x199c67='<=\x20?';break;case'$gte':_0x199c67=_0x4940('0x2a');break;case _0x4940('0x10'):_0x199c67=_0x4940('0x2b');break;}return _0x199c67;}function parseValue(_0x4d76ce,_0x1b0d24,_0x10bf2d){var _0x2fd8b4={'start':undefined,'end':undefined};switch(_0x1b0d24){case _0x4940('0x21'):case'$notIn':_0x2fd8b4[_0x4940('0x2c')]=_0x10bf2d['split'](',');break;case'$substring':_0x2fd8b4['start']='%'+_0x10bf2d+'%';break;case _0x4940('0x26'):_0x2fd8b4[_0x4940('0x2c')]=_0x10bf2d+'%';break;case _0x4940('0x2d'):_0x2fd8b4['start']='%'+_0x10bf2d;break;case'$between':var _0x33c3fb=_0x10bf2d[_0x4940('0x5')](',');var _0x10bf2d=_0x33c3fb[_0x4940('0x8')]();var _0x47c53e=_0x33c3fb[_0x4940('0x2e')]();if(_0x4d76ce===_0x4940('0x2f')){_0x10bf2d=moment(_0x10bf2d)[_0x4940('0x30')](0x0,!![])[_0x4940('0x31')]();_0x47c53e=moment(_0x47c53e)[_0x4940('0x30')](0x0,!![])['add'](0x17,'hours')[_0x4940('0x15')](0x3b,'minutes')[_0x4940('0x15')](0x3b,'seconds')[_0x4940('0x31')]();}_0x2fd8b4={'start':_0x10bf2d,'end':_0x47c53e};break;default:_0x2fd8b4[_0x4940('0x2c')]=_0x10bf2d;break;}return _0x2fd8b4;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 983787d..ef5e398 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 _0x6bac=['model','intersection','attributes','nolimit','limit','where','filter','object','columns','value','lower','options','include','includeAll','escapeLIKESpecialChars','lodash','moment','../../mysqldb','keys','includes','parse','fields','split','filters','isEmpty','forOwn','type','$gte','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','cast','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','replace','push','join','getOptions','$id','query'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x6bac,0x183));var _0xc6ba=function(_0x22d1a1,_0x17872d){_0x22d1a1=_0x22d1a1-0x0;var _0x17f5d2=_0x6bac[_0x22d1a1];return _0x17f5d2;};'use strict';var _=require(_0xc6ba('0x0'));var sequelize=require('sequelize');var moment=require(_0xc6ba('0x1'));var db=require(_0xc6ba('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2cd15a){var _0x18de28=['ne'];try{var _0xf94137=JSON['parse'](_0x2cd15a);var _0x54469e=Object[_0xc6ba('0x3')](_0xf94137)[0x0];return _0x18de28[_0xc6ba('0x4')](_0x54469e);}catch(_0x5797f3){return![];}}function getOperatorValue(_0xc57a9b){var _0x89ea75=JSON[_0xc6ba('0x5')](_0xc57a9b);var _0x47a11a=Object[_0xc6ba('0x3')](_0x89ea75)[0x0];var _0x208e4b=_0x89ea75[_0x47a11a];return{['$'+_0x47a11a]:_0x208e4b};}function parseIncludeModel(_0x45581f){var _0x4fca59=JSON[_0xc6ba('0x5')](_0x45581f);return{'model':db[_0x4fca59['model']],'as':_0x4fca59['alias'],'attributes':_0x4fca59[_0xc6ba('0x6')],'raw':_0x4fca59['raw']};}exports[_0xc6ba('0x6')]=function(_0x32dcf){var _0x50b13c=null;if(_0x32dcf){_0x50b13c=_0x32dcf[_0xc6ba('0x7')](',');}return _0x50b13c;};exports[_0xc6ba('0x8')]=function(_0x3698bd,_0x33f843){var _0x3843b4={};if(!_[_0xc6ba('0x9')](_0x3698bd)){_[_0xc6ba('0xa')](_0x3698bd,function(_0x28e212,_0xd57bd4){try{if(_0x33f843){var _0x556b9d=_['find'](_0x33f843,{'name':_0xd57bd4})||{};if(hasSequelizeOperator(_0x28e212)){_0x3843b4[_0xd57bd4]=getOperatorValue(_0x28e212);}else if(_0x556b9d[_0xc6ba('0xb')]==='DATE'&&_['isPlainObject'](_0x28e212)){var _0x2ab73f=JSON['parse'](_0x28e212);var _0xb50e2c={'$gte':moment(moment(_0x2ab73f[_0xc6ba('0xc')])[_0xc6ba('0xd')](_0xc6ba('0xe')))[_0xc6ba('0xf')]()[_0xc6ba('0xd')](),'$lte':moment(moment(_0x2ab73f[_0xc6ba('0x10')])[_0xc6ba('0xd')](_0xc6ba('0xe')))[_0xc6ba('0xf')]()['subtract'](0x1,'s')[_0xc6ba('0xd')]()};_0x3843b4[_0xd57bd4]=_0xb50e2c;}else if(_0x556b9d[_0xc6ba('0x11')]===_0xc6ba('0x12')){_0x3843b4[_0xd57bd4]=_0x28e212;}else{_0x3843b4[_0xd57bd4]=_[_0xc6ba('0x13')](_0x28e212)?_0x28e212:JSON[_0xc6ba('0x5')](_0x28e212);}}else{_0x3843b4[_0xd57bd4]=_['isArray'](_0x28e212)?_0x28e212:JSON['parse'](_0x28e212);}}catch(_0x1a4a13){_0x3843b4[_0xd57bd4]=_0x28e212['split'](',');}});}return _0x3843b4;};exports['limit']=function(_0xad2026){_0xad2026=parseInt(_0xad2026,0xa);if(!_0xad2026||_0xad2026<0x0){_0xad2026=LIMIT_VALUE;}return _0xad2026;};exports[_0xc6ba('0x14')]=function(_0x586850){_0x586850=parseInt(_0x586850,0xa);if(!_0x586850||_0x586850<0x0){_0x586850=0x0;}return _0x586850;};exports[_0xc6ba('0x15')]=function(_0x116936){var _0x52d2ca,_0xa92a41=null;if(_0x116936){_0x52d2ca=_0x116936[_0xc6ba('0x7')](',');_0xa92a41=_[_0xc6ba('0x16')](_0x52d2ca,function(_0x8e6550){if(_0x8e6550[_0xc6ba('0x17')]('-')===0x0){return[_0x8e6550===_0xc6ba('0x18')?sequelize['cast'](sequelize[_0xc6ba('0x19')](_0xc6ba('0x18')),_0xc6ba('0x1a')):_0x8e6550[_0xc6ba('0x1b')](0x1),_0xc6ba('0x1c')];}else{return[_0x8e6550==='priority'?sequelize[_0xc6ba('0x1d')](sequelize[_0xc6ba('0x19')](_0xc6ba('0x18')),_0xc6ba('0x1a')):_0x8e6550,'ASC'];}});}return _0xa92a41;};exports[_0xc6ba('0x1e')]=function(_0x40e90f,_0x16a71d){if(_[_0xc6ba('0x9')](_0x40e90f)){return _0x40e90f;}if(_['isArray'](_0x40e90f)){for(var _0x3c2ea8=0x0;_0x3c2ea8<_0x40e90f[_0xc6ba('0x1f')];_0x3c2ea8+=0x1){_0x40e90f[_0x3c2ea8]=this[_0xc6ba('0x1e')](_0x40e90f[_0x3c2ea8],_0x16a71d);}return _0x40e90f;}if(!_[_0xc6ba('0x20')](_0x40e90f)){return _0x40e90f;}if(_[_0xc6ba('0x21')](_0x16a71d)){_0x16a71d=[_0x16a71d];}if(!_[_0xc6ba('0x13')](_0x16a71d)){return _0x40e90f;}for(var _0x30442d=0x0;_0x30442d<_0x16a71d[_0xc6ba('0x1f')];_0x30442d+=0x1){_['unset'](_0x40e90f,_0x16a71d[_0x30442d]);}for(var _0x23a3da in _0x40e90f){if(_0x40e90f[_0xc6ba('0x22')](_0x23a3da)){_0x40e90f[_0x23a3da]=this[_0xc6ba('0x1e')](_0x40e90f[_0x23a3da],_0x16a71d);}}return _0x40e90f;};exports[_0xc6ba('0x23')]=function(_0x4aca81){return _0x4aca81[_0xc6ba('0x24')](RegExp(_0xc6ba('0x25')))?!![]:![];};exports[_0xc6ba('0x26')]=function(_0xc2d4bd){return _0xc2d4bd[_0xc6ba('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xc6ba('0x27')]=function(_0x283af4,_0x4d408c){var _0x2c5680=[];var _0x3cfc56=/([^:]")"+/g;var _0x14ca88=/[*<>~@-]/g;var _0x10906b=/[ `!@#$%^&*()_\-?~<>]/;var _0xa14d28=/[ ,]+/;var _0x272641=_0x4d408c?'\x22{EXPR}\x22':_0xc6ba('0x28');if(_0x4d408c){_0x283af4=_0x283af4[_0xc6ba('0x29')](_0x14ca88,'\x20')['trim']();}_0x283af4[_0xc6ba('0x7')](_0xa14d28)['forEach'](function(_0xd6c93b){_0xd6c93b=_0xd6c93b[_0xc6ba('0x29')](_0x3cfc56,'$1');_0xd6c93b='+'+_0xd6c93b+'*';var _0x5ba7e9=_0xd6c93b[_0xc6ba('0x24')](_0x10906b);if(_0x5ba7e9){_0xd6c93b='\x22'+_0xd6c93b+'\x22';}_0x2c5680[_0xc6ba('0x2a')](_0xd6c93b);});_0x272641=_0x272641[_0xc6ba('0x29')](_0xc6ba('0x28'),_0x2c5680[_0xc6ba('0x2b')]('\x20'));return _0x272641;};exports[_0xc6ba('0x2c')]=function(_0x5a838a,_0x1ef8dd,_0x34e611){var _0x1171cc={},_0x4b75ec={};if(_0x1ef8dd['query'][_0xc6ba('0x2d')]){_0x1ef8dd[_0xc6ba('0x2e')]['id']=_0x1ef8dd[_0xc6ba('0x2e')][_0xc6ba('0x2d')];delete _0x1ef8dd[_0xc6ba('0x2e')]['$id'];}_0x1171cc[_0xc6ba('0x2f')]=_[_0xc6ba('0x16')](_0x5a838a,_0xc6ba('0x11'));_0x1171cc[_0xc6ba('0x2e')]=_[_0xc6ba('0x3')](_0x1ef8dd[_0xc6ba('0x2e')]);_0x1171cc['filters']=_[_0xc6ba('0x30')](_0x1171cc[_0xc6ba('0x2f')],_0x1171cc[_0xc6ba('0x2e')]);_0x4b75ec[_0xc6ba('0x31')]=_[_0xc6ba('0x30')](_0x1171cc[_0xc6ba('0x2f')],this[_0xc6ba('0x6')](_0x1ef8dd['query'][_0xc6ba('0x6')]));_0x4b75ec[_0xc6ba('0x31')]=_0x4b75ec['attributes']['length']?_0x4b75ec[_0xc6ba('0x31')]:_0x1171cc[_0xc6ba('0x2f')];if(!_0x1ef8dd[_0xc6ba('0x2e')]['hasOwnProperty'](_0xc6ba('0x32'))){_0x4b75ec[_0xc6ba('0x33')]=this[_0xc6ba('0x33')](_0x1ef8dd[_0xc6ba('0x2e')]['limit']);_0x4b75ec[_0xc6ba('0x14')]=this[_0xc6ba('0x14')](_0x1ef8dd[_0xc6ba('0x2e')][_0xc6ba('0x14')]);}_0x4b75ec['order']=this[_0xc6ba('0x15')](_0x1ef8dd['query'][_0xc6ba('0x15')]);_0x4b75ec[_0xc6ba('0x34')]=this[_0xc6ba('0x8')](_['pick'](_0x1ef8dd[_0xc6ba('0x2e')],_0x1171cc[_0xc6ba('0x8')]),_0x5a838a);if(_0x1ef8dd[_0xc6ba('0x2e')][_0xc6ba('0x35')]){var _0x5202db=_0x5a838a;var _0x19e10f=_0x1ef8dd[_0xc6ba('0x2e')][_0xc6ba('0x35')];if(typeof _0x19e10f===_0xc6ba('0x36')){_0x5202db=_['filter'](_0x5a838a,function(_0x2eb98c){return _[_0xc6ba('0x4')](_0x19e10f[_0xc6ba('0x37')],_0x2eb98c[_0xc6ba('0x11')]);});_0x19e10f=_0x19e10f[_0xc6ba('0x38')];}_0x4b75ec[_0xc6ba('0x34')]=_['merge'](_0x4b75ec[_0xc6ba('0x34')],{'$or':_[_0xc6ba('0x16')](_0x5202db,function(_0x369902){if(_0x369902[_0xc6ba('0xb')]!=='VIRTUAL'){if(_0x34e611){return sequelize[_0xc6ba('0x34')](sequelize['fn']('lower',sequelize['col'](_0x369902['name'])),{'$like':sequelize['fn'](_0xc6ba('0x39'),'%'+_0x1ef8dd[_0xc6ba('0x2e')][_0xc6ba('0x35')]+'%')});}else{var _0x10839f={};_0x10839f[_0x369902[_0xc6ba('0x11')]]={'$like':'%'+_0x1ef8dd[_0xc6ba('0x2e')]['filter']+'%'};return _0x10839f;}}})});}_0x4b75ec=_['merge']({},_0x4b75ec,_0x1ef8dd[_0xc6ba('0x3a')]);return _0x4b75ec;};exports[_0xc6ba('0x3b')]=function(_0x3b2456){var _0x15035d=[];if(_0x3b2456[_0xc6ba('0x3c')]){_0x15035d[_0xc6ba('0x2a')]({'all':!![]});}else if(_0x3b2456[_0xc6ba('0x3b')]){if(Array['isArray'](_0x3b2456[_0xc6ba('0x3b')])){_0x15035d=Object[_0xc6ba('0x3')](_0x3b2456['include'])[_0xc6ba('0x16')](function(_0x26cc4c){return parseIncludeModel(_0x3b2456[_0xc6ba('0x3b')][_0x26cc4c]);});}else{var _0x982159=parseIncludeModel(_0x3b2456[_0xc6ba('0x3b')]);_0x15035d[_0xc6ba('0x2a')](_0x982159);}}return _0x15035d;};exports[_0xc6ba('0x3d')]=function(_0x447086){return _0x447086[_0xc6ba('0x29')](/[%_^-]/g,function(_0x125737){return'\x5c'+_0x125737;});}; \ No newline at end of file +var _0xe750=['fields','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','isArray','limit','sort','map','priority','cast','col','substr','DESC','unsigned','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','trim','getOptions','query','$id','intersection','attributes','nolimit','offset','order','where','pick','filter','columns','value','merge','lower','options','include','includeAll','push','escapeLIKESpecialChars','lodash','sequelize','moment','parse','keys','includes','model','alias'];(function(_0x11a53c,_0x486647){var _0x119348=function(_0x416318){while(--_0x416318){_0x11a53c['push'](_0x11a53c['shift']());}};_0x119348(++_0x486647);}(_0xe750,0x19c));var _0x0e75=function(_0x5010c6,_0x29f70b){_0x5010c6=_0x5010c6-0x0;var _0x30658a=_0xe750[_0x5010c6];return _0x30658a;};'use strict';var _=require(_0x0e75('0x0'));var sequelize=require(_0x0e75('0x1'));var moment=require(_0x0e75('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x49036b){var _0x39c36d=['ne'];try{var _0x5247e5=JSON[_0x0e75('0x3')](_0x49036b);var _0x1b0a6a=Object[_0x0e75('0x4')](_0x5247e5)[0x0];return _0x39c36d[_0x0e75('0x5')](_0x1b0a6a);}catch(_0x382ead){return![];}}function getOperatorValue(_0x6983d9){var _0x3f0348=JSON['parse'](_0x6983d9);var _0x50f32a=Object[_0x0e75('0x4')](_0x3f0348)[0x0];var _0x50823b=_0x3f0348[_0x50f32a];return{['$'+_0x50f32a]:_0x50823b};}function parseIncludeModel(_0x53c1be){var _0x4b52fa=JSON['parse'](_0x53c1be);return{'model':db[_0x4b52fa[_0x0e75('0x6')]],'as':_0x4b52fa[_0x0e75('0x7')],'attributes':_0x4b52fa[_0x0e75('0x8')],'raw':_0x4b52fa['raw']};}exports['fields']=function(_0x3ae573){var _0x1e237f=null;if(_0x3ae573){_0x1e237f=_0x3ae573[_0x0e75('0x9')](',');}return _0x1e237f;};exports[_0x0e75('0xa')]=function(_0x5c3291,_0x56700a){var _0x7c1cc7={};if(!_[_0x0e75('0xb')](_0x5c3291)){_[_0x0e75('0xc')](_0x5c3291,function(_0x58857a,_0x5b7a7f){try{if(_0x56700a){var _0x5aa710=_[_0x0e75('0xd')](_0x56700a,{'name':_0x5b7a7f})||{};if(hasSequelizeOperator(_0x58857a)){_0x7c1cc7[_0x5b7a7f]=getOperatorValue(_0x58857a);}else if(_0x5aa710[_0x0e75('0xe')]==='DATE'&&_[_0x0e75('0xf')](_0x58857a)){var _0x3f9507=JSON[_0x0e75('0x3')](_0x58857a);var _0x3072dc={'$gte':moment(moment(_0x3f9507[_0x0e75('0x10')])[_0x0e75('0x11')](_0x0e75('0x12')))['utc']()[_0x0e75('0x11')](),'$lte':moment(moment(_0x3f9507[_0x0e75('0x13')])[_0x0e75('0x11')](_0x0e75('0x12')))[_0x0e75('0x14')]()[_0x0e75('0x15')](0x1,'s')[_0x0e75('0x11')]()};_0x7c1cc7[_0x5b7a7f]=_0x3072dc;}else if(_0x5aa710[_0x0e75('0x16')]===_0x0e75('0x17')){_0x7c1cc7[_0x5b7a7f]=_0x58857a;}else{_0x7c1cc7[_0x5b7a7f]=_[_0x0e75('0x18')](_0x58857a)?_0x58857a:JSON[_0x0e75('0x3')](_0x58857a);}}else{_0x7c1cc7[_0x5b7a7f]=_[_0x0e75('0x18')](_0x58857a)?_0x58857a:JSON[_0x0e75('0x3')](_0x58857a);}}catch(_0x5be18b){_0x7c1cc7[_0x5b7a7f]=_0x58857a[_0x0e75('0x9')](',');}});}return _0x7c1cc7;};exports[_0x0e75('0x19')]=function(_0x2cdcf1){_0x2cdcf1=parseInt(_0x2cdcf1,0xa);if(!_0x2cdcf1||_0x2cdcf1<0x0){_0x2cdcf1=LIMIT_VALUE;}return _0x2cdcf1;};exports['offset']=function(_0x4cb3b6){_0x4cb3b6=parseInt(_0x4cb3b6,0xa);if(!_0x4cb3b6||_0x4cb3b6<0x0){_0x4cb3b6=0x0;}return _0x4cb3b6;};exports[_0x0e75('0x1a')]=function(_0x53d5c4){var _0x19ae73,_0x17bfd1=null;if(_0x53d5c4){_0x19ae73=_0x53d5c4[_0x0e75('0x9')](',');_0x17bfd1=_[_0x0e75('0x1b')](_0x19ae73,function(_0x518b1c){if(_0x518b1c['indexOf']('-')===0x0){return[_0x518b1c===_0x0e75('0x1c')?sequelize[_0x0e75('0x1d')](sequelize[_0x0e75('0x1e')](_0x0e75('0x1c')),'unsigned'):_0x518b1c[_0x0e75('0x1f')](0x1),_0x0e75('0x20')];}else{return[_0x518b1c==='priority'?sequelize['cast'](sequelize[_0x0e75('0x1e')](_0x0e75('0x1c')),_0x0e75('0x21')):_0x518b1c,_0x0e75('0x22')];}});}return _0x17bfd1;};exports[_0x0e75('0x23')]=function(_0x343ce9,_0x5087dc){if(_[_0x0e75('0xb')](_0x343ce9)){return _0x343ce9;}if(_['isArray'](_0x343ce9)){for(var _0x314d39=0x0;_0x314d39<_0x343ce9[_0x0e75('0x24')];_0x314d39+=0x1){_0x343ce9[_0x314d39]=this['omit'](_0x343ce9[_0x314d39],_0x5087dc);}return _0x343ce9;}if(!_[_0x0e75('0x25')](_0x343ce9)){return _0x343ce9;}if(_[_0x0e75('0x26')](_0x5087dc)){_0x5087dc=[_0x5087dc];}if(!_[_0x0e75('0x18')](_0x5087dc)){return _0x343ce9;}for(var _0x59a3e2=0x0;_0x59a3e2<_0x5087dc[_0x0e75('0x24')];_0x59a3e2+=0x1){_[_0x0e75('0x27')](_0x343ce9,_0x5087dc[_0x59a3e2]);}for(var _0x2abe8a in _0x343ce9){if(_0x343ce9[_0x0e75('0x28')](_0x2abe8a)){_0x343ce9[_0x2abe8a]=this['omit'](_0x343ce9[_0x2abe8a],_0x5087dc);}}return _0x343ce9;};exports[_0x0e75('0x29')]=function(_0x1c4534){return _0x1c4534[_0x0e75('0x2a')](RegExp(_0x0e75('0x2b')))?!![]:![];};exports[_0x0e75('0x2c')]=function(_0x553d8f){return _0x553d8f[_0x0e75('0x2a')](/^\S+@\S+$/)?!![]:![];};exports[_0x0e75('0x2d')]=function(_0x6e169d,_0x539317){var _0x2b321e=[];var _0x3f3816=/([^:]")"+/g;var _0xb0d561=/[*<>~@-]/g;var _0x29c628=/[ `!@#$%^&*()_\-?~<>]/;var _0x5846b5=/[ ,]+/;var _0x52e0ef=_0x539317?_0x0e75('0x2e'):_0x0e75('0x2f');if(_0x539317){_0x6e169d=_0x6e169d[_0x0e75('0x30')](_0xb0d561,'\x20')[_0x0e75('0x31')]();}_0x6e169d[_0x0e75('0x9')](_0x5846b5)['forEach'](function(_0x47f67e){_0x47f67e=_0x47f67e[_0x0e75('0x30')](_0x3f3816,'$1');_0x47f67e='+'+_0x47f67e+'*';var _0x10f6df=_0x47f67e[_0x0e75('0x2a')](_0x29c628);if(_0x10f6df){_0x47f67e='\x22'+_0x47f67e+'\x22';}_0x2b321e['push'](_0x47f67e);});_0x52e0ef=_0x52e0ef[_0x0e75('0x30')](_0x0e75('0x2f'),_0x2b321e['join']('\x20'));return _0x52e0ef;};exports[_0x0e75('0x32')]=function(_0x32e813,_0x463d66,_0x30eca0){var _0x4f1fb1={},_0x17f966={};if(_0x463d66[_0x0e75('0x33')][_0x0e75('0x34')]){_0x463d66[_0x0e75('0x33')]['id']=_0x463d66[_0x0e75('0x33')][_0x0e75('0x34')];delete _0x463d66[_0x0e75('0x33')][_0x0e75('0x34')];}_0x4f1fb1[_0x0e75('0x6')]=_[_0x0e75('0x1b')](_0x32e813,_0x0e75('0x16'));_0x4f1fb1['query']=_[_0x0e75('0x4')](_0x463d66[_0x0e75('0x33')]);_0x4f1fb1['filters']=_[_0x0e75('0x35')](_0x4f1fb1['model'],_0x4f1fb1[_0x0e75('0x33')]);_0x17f966[_0x0e75('0x36')]=_[_0x0e75('0x35')](_0x4f1fb1[_0x0e75('0x6')],this[_0x0e75('0x8')](_0x463d66['query'][_0x0e75('0x8')]));_0x17f966['attributes']=_0x17f966[_0x0e75('0x36')][_0x0e75('0x24')]?_0x17f966[_0x0e75('0x36')]:_0x4f1fb1[_0x0e75('0x6')];if(!_0x463d66[_0x0e75('0x33')]['hasOwnProperty'](_0x0e75('0x37'))){_0x17f966[_0x0e75('0x19')]=this['limit'](_0x463d66[_0x0e75('0x33')][_0x0e75('0x19')]);_0x17f966['offset']=this[_0x0e75('0x38')](_0x463d66[_0x0e75('0x33')]['offset']);}_0x17f966[_0x0e75('0x39')]=this['sort'](_0x463d66[_0x0e75('0x33')][_0x0e75('0x1a')]);_0x17f966[_0x0e75('0x3a')]=this[_0x0e75('0xa')](_[_0x0e75('0x3b')](_0x463d66[_0x0e75('0x33')],_0x4f1fb1[_0x0e75('0xa')]),_0x32e813);if(_0x463d66[_0x0e75('0x33')][_0x0e75('0x3c')]){var _0x3a4db4=_0x32e813;var _0x503b27=_0x463d66['query'][_0x0e75('0x3c')];if(typeof _0x503b27==='object'){_0x3a4db4=_[_0x0e75('0x3c')](_0x32e813,function(_0x579dc3){return _['includes'](_0x503b27[_0x0e75('0x3d')],_0x579dc3[_0x0e75('0x16')]);});_0x503b27=_0x503b27[_0x0e75('0x3e')];}_0x17f966[_0x0e75('0x3a')]=_[_0x0e75('0x3f')](_0x17f966[_0x0e75('0x3a')],{'$or':_[_0x0e75('0x1b')](_0x3a4db4,function(_0x2daaec){if(_0x2daaec[_0x0e75('0xe')]!=='VIRTUAL'){if(_0x30eca0){return sequelize[_0x0e75('0x3a')](sequelize['fn'](_0x0e75('0x40'),sequelize['col'](_0x2daaec[_0x0e75('0x16')])),{'$like':sequelize['fn'](_0x0e75('0x40'),'%'+_0x463d66[_0x0e75('0x33')][_0x0e75('0x3c')]+'%')});}else{var _0x2ce4fb={};_0x2ce4fb[_0x2daaec['name']]={'$like':'%'+_0x463d66[_0x0e75('0x33')][_0x0e75('0x3c')]+'%'};return _0x2ce4fb;}}})});}_0x17f966=_[_0x0e75('0x3f')]({},_0x17f966,_0x463d66[_0x0e75('0x41')]);return _0x17f966;};exports[_0x0e75('0x42')]=function(_0x4c4897){var _0x3d9c30=[];if(_0x4c4897[_0x0e75('0x43')]){_0x3d9c30[_0x0e75('0x44')]({'all':!![]});}else if(_0x4c4897[_0x0e75('0x42')]){if(Array['isArray'](_0x4c4897[_0x0e75('0x42')])){_0x3d9c30=Object[_0x0e75('0x4')](_0x4c4897[_0x0e75('0x42')])[_0x0e75('0x1b')](function(_0x458274){return parseIncludeModel(_0x4c4897[_0x0e75('0x42')][_0x458274]);});}else{var _0x2e11d1=parseIncludeModel(_0x4c4897[_0x0e75('0x42')]);_0x3d9c30[_0x0e75('0x44')](_0x2e11d1);}}return _0x3d9c30;};exports[_0x0e75('0x45')]=function(_0x1d6e2b){return _0x1d6e2b[_0x0e75('0x30')](/[%_^-]/g,function(_0xb50034){return'\x5c'+_0xb50034;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 708d125..06acca9 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ff5=['getAgentIdsByStatus','resolve','User','findAll','fullname','chatPause','smsPause','pauseType','find','getSortedAgentsIdsByStatus','fields','globalStatus','order','startsWith','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','role','mailStatusTime','faxCapacity','whatsappCapacity','onhold','queue','getRealtimeAgentsQueryFields','jayson/promise','../../mysqldb','http','client','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','voiceStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','Queue','map','getAgents','flatten','uniq','value','getAgentIdsByQueues','includes'];(function(_0x1fa3e2,_0x58020c){var _0x1261fc=function(_0x439e3b){while(--_0x439e3b){_0x1fa3e2['push'](_0x1fa3e2['shift']());}};_0x1261fc(++_0x58020c);}(_0x2ff5,0x1d5));var _0x52ff=function(_0xec24f8,_0x3ec72a){_0xec24f8=_0xec24f8-0x0;var _0x60f49f=_0x2ff5[_0xec24f8];return _0x60f49f;};'use strict';var _=require('lodash');var jayson=require(_0x52ff('0x0'));var db=require(_0x52ff('0x1'))['db'];var amiClient=jayson['client'][_0x52ff('0x2')]({'port':0x232a});var routingClient=jayson[_0x52ff('0x3')][_0x52ff('0x2')]({'port':0x232c});function isAgentPaused(_0x36b0e9,_0x190df8){var _0xbfba62=[_0x36b0e9['chatPause'],_0x36b0e9[_0x52ff('0x4')],_0x36b0e9[_0x52ff('0x5')],_0x36b0e9[_0x52ff('0x6')],_0x36b0e9['smsPause'],_0x36b0e9[_0x52ff('0x7')],_0x36b0e9[_0x52ff('0x8')]];if(!_0x190df8)return _[_0x52ff('0x9')](_0xbfba62);var _0x17ca0b=_[_0x52ff('0xa')](_0xbfba62);return _0x17ca0b[_0x52ff('0xb')]>0x0&&_0x17ca0b[_0x52ff('0xb')]<_0xbfba62[_0x52ff('0xb')]?!![]:![];}function isIdle(_0x5e127e){return _0x5e127e===_0x52ff('0xc')||_0x5e127e===_0x52ff('0xd')||_0x5e127e===_0x52ff('0xe')||_0x5e127e===_0x52ff('0xf')||_[_0x52ff('0x10')](_0x5e127e);}function isAgentIdle(_0x300409){if(_0x300409['voiceStatus']!=='idle'&&_0x300409['voicePause']){_0x300409['voiceStatus']=_0x52ff('0x11');return![];}return _['every']([_0x300409[_0x52ff('0x12')],_0x300409[_0x52ff('0x13')],_0x300409['mailStatus'],_0x300409[_0x52ff('0x14')],_0x300409[_0x52ff('0x15')],_0x300409[_0x52ff('0x16')],_0x300409[_0x52ff('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x52ff('0x18')](_0x52ff('0x19'),{})['then'](function(_0x3a1a83){if(_0x3a1a83[_0x52ff('0x1a')]){throw new Error(_0x52ff('0x1b'));}var _0x4c83f=_0x3a1a83[_0x52ff('0x1c')];return routingClient[_0x52ff('0x18')]('Agents',{})[_0x52ff('0x1d')](function(_0x154419){if(_0x154419[_0x52ff('0x1a')]){throw new Error(_0x52ff('0x1e'));}var _0x5a87ac=_0x154419[_0x52ff('0x1c')];return _[_0x52ff('0x1f')]({},_0x4c83f,_0x5a87ac);});})[_0x52ff('0x20')](function(_0x58efb4){throw _0x58efb4;});}exports[_0x52ff('0x21')]=getRealtimeAgents;function getAgentStatus(_0x10ad04){var _0x2ba460=_0x52ff('0xd');if(isAgentPaused(_0x10ad04))_0x2ba460=_0x52ff('0x11');else if(isAgentPaused(_0x10ad04,!![]))_0x2ba460=_0x52ff('0x22');else if(isAgentIdle(_0x10ad04))_0x2ba460=_0x52ff('0xc');else _0x2ba460=_0x52ff('0x23');return _0x2ba460;}exports[_0x52ff('0x24')]=getAgentStatus;function getAgentIdsByQueues(_0x439011,_0x174a01){var _0xe68eb5=_[_0x52ff('0x25')](_0x439011)?_0x439011:[_0x439011];var _0x3e441b=_['startCase'](_0x174a01)+_0x52ff('0x26');var _0x27b209=_[_0x52ff('0x27')](_0xe68eb5,function(_0x3accd4){return db[_0x3e441b]['findOne']({'where':{'id':_0x3accd4}})[_0x52ff('0x1d')](function(_0xc68d3b){if(!_0xc68d3b)return[];return _0xc68d3b[_0x52ff('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x27b209)['then'](function(_0x1ac770){var _0x3f5e22=_(_0x1ac770)[_0x52ff('0x29')]()[_0x52ff('0x27')]('id')[_0x52ff('0x2a')]()[_0x52ff('0x2b')]();return _0x3f5e22;});}exports[_0x52ff('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x322260,_0x1a706c,_0x3a049f){try{if(_0x1a706c[_0x52ff('0xb')]>0x0){_0x322260=_0x322260[_0x52ff('0xa')](function(_0x406343){return _0x1a706c[_0x52ff('0x2d')](_0x406343['id']);});}var _0x4e4571=_0x322260[_0x52ff('0xa')](function(_0x5cc35d){var _0x233a3e=_0x52ff('0x23');if(isAgentIdle(_0x5cc35d)){_0x233a3e='idle';}return _0x233a3e===_0x3a049f;});return _[_0x52ff('0x27')](_0x4e4571,'id');}catch(_0x326d23){throw _0x326d23;}}exports[_0x52ff('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2e6c9a,_0x50fd8b,_0x320c07){return Promise[_0x52ff('0x2f')]()['then'](function(){if(_0x50fd8b[_0x52ff('0xb')]>0x0){_0x2e6c9a=_0x2e6c9a[_0x52ff('0xa')](function(_0xef339d){return _0x50fd8b[_0x52ff('0x2d')](_0xef339d['id']);});}return _0x2e6c9a;})['then'](function(){return db[_0x52ff('0x30')][_0x52ff('0x31')]({'attributes':['id','name',_0x52ff('0x32'),_0x52ff('0x33'),_0x52ff('0x4'),_0x52ff('0x5'),'openchannelPause',_0x52ff('0x34'),'voicePause',_0x52ff('0x8'),_0x52ff('0x35')],'where':{'id':{'$in':_['map'](_0x2e6c9a,'id')}},'raw':!![]});})[_0x52ff('0x1d')](function(_0x10cfdd){return _0x10cfdd[_0x52ff('0x27')](function(_0x5e5ac1){var _0x4f3d97=_[_0x52ff('0x36')](_0x2e6c9a,['id',_0x5e5ac1['id']]);var _0x4b72cd=filterAgentAttributes(_0x4f3d97);_[_0x52ff('0x1f')](_0x5e5ac1,_0x4b72cd);_0x5e5ac1['globalStatus']=getAgentStatus(_0x5e5ac1);return _0x5e5ac1;});})[_0x52ff('0x1d')](function(_0x2a5653){var _0x59643f=sortAgentsByStatus(_0x2a5653,_0x320c07);return _[_0x52ff('0x27')](_0x59643f,'id');})[_0x52ff('0x20')](function(_0x2b38b7){throw _0x2b38b7;});}exports[_0x52ff('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xcb5b6c){var _0x3dc9bb={'fields':[],'order':null};var _0x45d059=_0xcb5b6c['split'](',');_0x3dc9bb[_0x52ff('0x38')]=_[_0x52ff('0xa')](_0x45d059,function(_0x422c95){if(!_0x422c95[_0x52ff('0x2d')](_0x52ff('0x39'))){return!![];}_0x3dc9bb[_0x52ff('0x3a')]=_[_0x52ff('0x3b')](_0x422c95,'-')?'DESC':_0x52ff('0x3c');return![];});return _0x3dc9bb;}exports[_0x52ff('0x3d')]=getUpdatedSortOptions;function validateSortParameter(_0xf2f766){if(!_0xf2f766){_0xf2f766='fullname,internal';}if(_0xf2f766['includes'](_0x52ff('0x32'))&&!_0xf2f766['includes'](_0x52ff('0x3e'))){var _0xbbfef8=_0xf2f766[_0x52ff('0x3f')](0x0,_0xf2f766[_0x52ff('0x40')](_0x52ff('0x32')));_0xf2f766+=','+_0xbbfef8+_0x52ff('0x3e');}return _0xf2f766;}exports[_0x52ff('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x18a780,_0x379684){var _0x501a2f=_0x18a780[_0x52ff('0x42')](function(_0x1cf8ee,_0x5a5c37){if(_0x1cf8ee[_0x52ff('0x39')]===_0x5a5c37[_0x52ff('0x39')]){if(_0x1cf8ee[_0x52ff('0x39')]===_0x52ff('0x11')){if(_0x379684===_0x52ff('0x43')){return(_0x1cf8ee[_0x52ff('0x35')]||'')<(_0x5a5c37[_0x52ff('0x35')]||'')||_0x1cf8ee['fullname'][_0x52ff('0x44')]()>_0x5a5c37[_0x52ff('0x32')][_0x52ff('0x44')]()?0x1:-0x1;}else{return(_0x1cf8ee[_0x52ff('0x35')]||'')<(_0x5a5c37['pauseType']||'')||_0x1cf8ee['fullname'][_0x52ff('0x44')]()>_0x5a5c37[_0x52ff('0x32')][_0x52ff('0x44')]()?-0x1:0x1;}}else{if(_0x379684===_0x52ff('0x43')){return _0x1cf8ee[_0x52ff('0x32')]['toLowerCase']()<_0x5a5c37[_0x52ff('0x32')][_0x52ff('0x44')]()?0x1:-0x1;}else{return _0x1cf8ee[_0x52ff('0x32')][_0x52ff('0x44')]()<_0x5a5c37[_0x52ff('0x32')][_0x52ff('0x44')]()?-0x1:0x1;}}}else{if(_0x379684===_0x52ff('0x43')){return _0x1cf8ee[_0x52ff('0x39')]<_0x5a5c37[_0x52ff('0x39')]?0x1:-0x1;}else{return _0x1cf8ee[_0x52ff('0x39')]<_0x5a5c37['globalStatus']?-0x1:0x1;}}});return _0x501a2f;}exports[_0x52ff('0x45')]=sortAgentsByStatus;function filterAgentAttributes(_0xdcb5d){var _0x41930f=[_0x52ff('0x46'),_0x52ff('0x47'),'lastLoginAt',_0x52ff('0x48'),_0x52ff('0x35'),'lastPauseAt',_0x52ff('0x3e'),_0x52ff('0x49'),_0x52ff('0x33'),_0x52ff('0x6'),'mailPause','smsPause',_0x52ff('0x8'),_0x52ff('0x4'),_0x52ff('0x7'),_0x52ff('0x4a'),_0x52ff('0x4b'),_0x52ff('0x4c'),_0x52ff('0x4d'),'whatsappCapacity','faxCapacity',_0x52ff('0x4e'),_0x52ff('0x4f'),_0x52ff('0x50'),_0x52ff('0x51'),_0x52ff('0x52'),_0x52ff('0x53'),_0x52ff('0x12'),_0x52ff('0x14'),_0x52ff('0x54'),'smsStatus',_0x52ff('0x17'),_0x52ff('0x13'),_0x52ff('0x16'),_0x52ff('0x55'),_0x52ff('0x56'),'mailStatusTime',_0x52ff('0x57'),_0x52ff('0x58'),_0x52ff('0x59'),_0x52ff('0x5a'),'queue',_0x52ff('0x5b'),_0x52ff('0x5c'),_0x52ff('0x5d'),_0x52ff('0x5e')];var _0x4479c1=[_0x52ff('0x33'),'openchannelPause',_0x52ff('0x5'),'smsPause',_0x52ff('0x8'),_0x52ff('0x4'),_0x52ff('0x7'),_0x52ff('0x47')];var _0x4a1e3c=_(_0xdcb5d)[_0x52ff('0x5f')](_0x4479c1)['pick'](_0x41930f)[_0x52ff('0x2b')]();return _0x4a1e3c;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x52ff('0x32'),_0x52ff('0x60'),'internal',_0x52ff('0x47'),'globalStatus',_0x52ff('0x46'),'lastLoginAt',_0x52ff('0x35'),_0x52ff('0x48'),_0x52ff('0x4'),_0x52ff('0x33'),'mailPause',_0x52ff('0x6'),_0x52ff('0x34'),_0x52ff('0x7'),_0x52ff('0x8'),_0x52ff('0x12'),_0x52ff('0x13'),_0x52ff('0x54'),'openchannelStatus','smsStatus','voiceStatus','whatsappStatus',_0x52ff('0x55'),_0x52ff('0x59'),_0x52ff('0x61'),_0x52ff('0x56'),_0x52ff('0x57'),_0x52ff('0x5a'),'whatsappStatusTime',_0x52ff('0x4a'),_0x52ff('0x62'),_0x52ff('0x4c'),_0x52ff('0x4b'),_0x52ff('0x4d'),_0x52ff('0x63'),'chatCurrentCapacity',_0x52ff('0x53'),_0x52ff('0x50'),_0x52ff('0x4f'),_0x52ff('0x51'),_0x52ff('0x52'),_0x52ff('0x5d'),_0x52ff('0x5e'),_0x52ff('0x5b'),_0x52ff('0x64'),_0x52ff('0x65'),_0x52ff('0x5c')];}exports[_0x52ff('0x66')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x8a9a=['openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatus','smsStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','whatsappCapacity','openchannelCurrentCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','whatsappPause','every','filter','length','unknown','ringing','isNil','voiceStatus','idle','voicePause','pause','faxStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','error','result','then','getRealtimeAgents','*pause','busy','startCase','findOne','all','flatten','map','value','resolve','User','findAll','fullname','openchannelPause','pauseType','merge','globalStatus','getSortedAgentsIdsByStatus','fields','order','startsWith','ASC','includes','internal','substring','validateSortParameter','sort','toLowerCase','DESC','userpic','online','lastLoginAt','lastPauseAt','chatCapacity'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x8a9a[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var jayson=require(_0xa8a9('0x0'));var db=require(_0xa8a9('0x1'))['db'];var amiClient=jayson[_0xa8a9('0x2')][_0xa8a9('0x3')]({'port':0x232a});var routingClient=jayson[_0xa8a9('0x2')][_0xa8a9('0x3')]({'port':0x232c});function isAgentPaused(_0x2d782d,_0x9570dc){var _0x3fcb8c=[_0x2d782d[_0xa8a9('0x4')],_0x2d782d[_0xa8a9('0x5')],_0x2d782d[_0xa8a9('0x6')],_0x2d782d['openchannelPause'],_0x2d782d[_0xa8a9('0x7')],_0x2d782d['voicePause'],_0x2d782d[_0xa8a9('0x8')]];if(!_0x9570dc)return _[_0xa8a9('0x9')](_0x3fcb8c);var _0x1477b0=_[_0xa8a9('0xa')](_0x3fcb8c);return _0x1477b0[_0xa8a9('0xb')]>0x0&&_0x1477b0['length']<_0x3fcb8c[_0xa8a9('0xb')]?!![]:![];}function isIdle(_0x50071a){return _0x50071a==='idle'||_0x50071a===_0xa8a9('0xc')||_0x50071a==='unavailable'||_0x50071a===_0xa8a9('0xd')||_[_0xa8a9('0xe')](_0x50071a);}function isAgentIdle(_0x5815e4){if(_0x5815e4[_0xa8a9('0xf')]!==_0xa8a9('0x10')&&_0x5815e4[_0xa8a9('0x11')]){_0x5815e4[_0xa8a9('0xf')]=_0xa8a9('0x12');return![];}return _[_0xa8a9('0x9')]([_0x5815e4['chatStatus'],_0x5815e4[_0xa8a9('0x13')],_0x5815e4[_0xa8a9('0x14')],_0x5815e4[_0xa8a9('0x15')],_0x5815e4['smsStatus'],_0x5815e4['voiceStatus'],_0x5815e4[_0xa8a9('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xa8a9('0x17')](_0xa8a9('0x18'),{})['then'](function(_0x2efd94){if(_0x2efd94[_0xa8a9('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x4b7219=_0x2efd94[_0xa8a9('0x1a')];return routingClient[_0xa8a9('0x17')](_0xa8a9('0x18'),{})[_0xa8a9('0x1b')](function(_0x46a89d){if(_0x46a89d[_0xa8a9('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x499e5b=_0x46a89d[_0xa8a9('0x1a')];return _['merge']({},_0x4b7219,_0x499e5b);});})['catch'](function(_0x133d0e){throw _0x133d0e;});}exports[_0xa8a9('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x20c543){var _0x3a2207=_0xa8a9('0xc');if(isAgentPaused(_0x20c543))_0x3a2207=_0xa8a9('0x12');else if(isAgentPaused(_0x20c543,!![]))_0x3a2207=_0xa8a9('0x1d');else if(isAgentIdle(_0x20c543))_0x3a2207=_0xa8a9('0x10');else _0x3a2207=_0xa8a9('0x1e');return _0x3a2207;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x102301,_0x481a34){var _0x32721b=_['isArray'](_0x102301)?_0x102301:[_0x102301];var _0xc3bf62=_[_0xa8a9('0x1f')](_0x481a34)+'Queue';var _0x58f832=_['map'](_0x32721b,function(_0x4b2ad1){return db[_0xc3bf62][_0xa8a9('0x20')]({'where':{'id':_0x4b2ad1}})['then'](function(_0x46d765){if(!_0x46d765)return[];return _0x46d765['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xa8a9('0x21')](_0x58f832)[_0xa8a9('0x1b')](function(_0x32f687){var _0x46b030=_(_0x32f687)[_0xa8a9('0x22')]()[_0xa8a9('0x23')]('id')['uniq']()[_0xa8a9('0x24')]();return _0x46b030;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x45578f,_0x1f748a,_0x476365){try{if(_0x1f748a[_0xa8a9('0xb')]>0x0){_0x45578f=_0x45578f[_0xa8a9('0xa')](function(_0x343c80){return _0x1f748a['includes'](_0x343c80['id']);});}var _0x24021c=_0x45578f[_0xa8a9('0xa')](function(_0x183878){var _0x572418=_0xa8a9('0x1e');if(isAgentIdle(_0x183878)){_0x572418=_0xa8a9('0x10');}return _0x572418===_0x476365;});return _['map'](_0x24021c,'id');}catch(_0x4d42fc){throw _0x4d42fc;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5b4022,_0x294137,_0x58b2af){return Promise[_0xa8a9('0x25')]()[_0xa8a9('0x1b')](function(){if(_0x294137[_0xa8a9('0xb')]>0x0){_0x5b4022=_0x5b4022[_0xa8a9('0xa')](function(_0x4de441){return _0x294137['includes'](_0x4de441['id']);});}return _0x5b4022;})[_0xa8a9('0x1b')](function(){return db[_0xa8a9('0x26')][_0xa8a9('0x27')]({'attributes':['id','name',_0xa8a9('0x28'),_0xa8a9('0x4'),_0xa8a9('0x5'),_0xa8a9('0x6'),_0xa8a9('0x29'),'smsPause',_0xa8a9('0x11'),_0xa8a9('0x8'),_0xa8a9('0x2a')],'where':{'id':{'$in':_['map'](_0x5b4022,'id')}},'raw':!![]});})[_0xa8a9('0x1b')](function(_0x5d851b){return _0x5d851b['map'](function(_0x56a443){var _0x30e70c=_['find'](_0x5b4022,['id',_0x56a443['id']]);var _0x21426f=filterAgentAttributes(_0x30e70c);_[_0xa8a9('0x2b')](_0x56a443,_0x21426f);_0x56a443[_0xa8a9('0x2c')]=getAgentStatus(_0x56a443);return _0x56a443;});})['then'](function(_0x45106d){var _0x23629c=sortAgentsByStatus(_0x45106d,_0x58b2af);return _['map'](_0x23629c,'id');})['catch'](function(_0x1b4cf4){throw _0x1b4cf4;});}exports[_0xa8a9('0x2d')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x52325c){var _0x3d39c6={'fields':[],'order':null};var _0x53a589=_0x52325c['split'](',');_0x3d39c6[_0xa8a9('0x2e')]=_[_0xa8a9('0xa')](_0x53a589,function(_0x41e1f0){if(!_0x41e1f0['includes'](_0xa8a9('0x2c'))){return!![];}_0x3d39c6[_0xa8a9('0x2f')]=_[_0xa8a9('0x30')](_0x41e1f0,'-')?'DESC':_0xa8a9('0x31');return![];});return _0x3d39c6;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0xcbbac8){if(!_0xcbbac8){_0xcbbac8='fullname,internal';}if(_0xcbbac8[_0xa8a9('0x32')]('fullname')&&!_0xcbbac8[_0xa8a9('0x32')](_0xa8a9('0x33'))){var _0x57fc5b=_0xcbbac8[_0xa8a9('0x34')](0x0,_0xcbbac8['indexOf'](_0xa8a9('0x28')));_0xcbbac8+=','+_0x57fc5b+_0xa8a9('0x33');}return _0xcbbac8;}exports[_0xa8a9('0x35')]=validateSortParameter;function sortAgentsByStatus(_0x1aaeda,_0xb2534b){var _0x271f54=_0x1aaeda[_0xa8a9('0x36')](function(_0x47cb9e,_0x1e05f6){if(_0x47cb9e[_0xa8a9('0x2c')]===_0x1e05f6[_0xa8a9('0x2c')]){if(_0x47cb9e['globalStatus']==='pause'){if(_0xb2534b==='DESC'){return(_0x47cb9e[_0xa8a9('0x2a')]||'')<(_0x1e05f6[_0xa8a9('0x2a')]||'')||_0x47cb9e[_0xa8a9('0x28')][_0xa8a9('0x37')]()>_0x1e05f6[_0xa8a9('0x28')][_0xa8a9('0x37')]()?0x1:-0x1;}else{return(_0x47cb9e[_0xa8a9('0x2a')]||'')<(_0x1e05f6[_0xa8a9('0x2a')]||'')||_0x47cb9e['fullname'][_0xa8a9('0x37')]()>_0x1e05f6[_0xa8a9('0x28')][_0xa8a9('0x37')]()?-0x1:0x1;}}else{if(_0xb2534b===_0xa8a9('0x38')){return _0x47cb9e[_0xa8a9('0x28')][_0xa8a9('0x37')]()<_0x1e05f6['fullname'][_0xa8a9('0x37')]()?0x1:-0x1;}else{return _0x47cb9e[_0xa8a9('0x28')][_0xa8a9('0x37')]()<_0x1e05f6['fullname'][_0xa8a9('0x37')]()?-0x1:0x1;}}}else{if(_0xb2534b===_0xa8a9('0x38')){return _0x47cb9e[_0xa8a9('0x2c')]<_0x1e05f6[_0xa8a9('0x2c')]?0x1:-0x1;}else{return _0x47cb9e['globalStatus']<_0x1e05f6[_0xa8a9('0x2c')]?-0x1:0x1;}}});return _0x271f54;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x2302d1){var _0x20e800=[_0xa8a9('0x39'),_0xa8a9('0x3a'),_0xa8a9('0x3b'),_0xa8a9('0x3c'),'pauseType',_0xa8a9('0x3c'),_0xa8a9('0x33'),'address',_0xa8a9('0x4'),'openchannelPause',_0xa8a9('0x6'),'smsPause',_0xa8a9('0x8'),_0xa8a9('0x5'),_0xa8a9('0x11'),_0xa8a9('0x3d'),_0xa8a9('0x3e'),_0xa8a9('0x3f'),_0xa8a9('0x40'),'whatsappCapacity',_0xa8a9('0x41'),_0xa8a9('0x42'),'openchannelCurrentCapacity',_0xa8a9('0x43'),_0xa8a9('0x44'),'whatsappCurrentCapacity',_0xa8a9('0x45'),_0xa8a9('0x46'),_0xa8a9('0x15'),_0xa8a9('0x14'),_0xa8a9('0x47'),'whatsappStatus',_0xa8a9('0x13'),_0xa8a9('0xf'),'chatStatusTime',_0xa8a9('0x48'),_0xa8a9('0x49'),_0xa8a9('0x4a'),_0xa8a9('0x4b'),_0xa8a9('0x4c'),_0xa8a9('0x4d'),_0xa8a9('0x4e'),_0xa8a9('0x4f'),_0xa8a9('0x50'),'phoneBarEnableScreenRecordingByAgent',_0xa8a9('0x51')];var _0x3c8f3b=[_0xa8a9('0x4'),_0xa8a9('0x29'),_0xa8a9('0x6'),_0xa8a9('0x7'),_0xa8a9('0x8'),_0xa8a9('0x5'),'voicePause','online'];var _0x1f2dc4=_(_0x2302d1)[_0xa8a9('0x52')](_0x3c8f3b)['pick'](_0x20e800)['value']();return _0x1f2dc4;}exports[_0xa8a9('0x53')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0xa8a9('0x28'),'role',_0xa8a9('0x33'),_0xa8a9('0x3a'),_0xa8a9('0x2c'),_0xa8a9('0x39'),_0xa8a9('0x3b'),'pauseType',_0xa8a9('0x3c'),_0xa8a9('0x5'),_0xa8a9('0x4'),'mailPause','openchannelPause',_0xa8a9('0x7'),_0xa8a9('0x11'),_0xa8a9('0x8'),'chatStatus',_0xa8a9('0x13'),_0xa8a9('0x14'),_0xa8a9('0x15'),'smsStatus',_0xa8a9('0xf'),_0xa8a9('0x16'),'chatStatusTime',_0xa8a9('0x4c'),_0xa8a9('0x49'),_0xa8a9('0x48'),_0xa8a9('0x4a'),_0xa8a9('0x4d'),_0xa8a9('0x4b'),_0xa8a9('0x3d'),_0xa8a9('0x41'),_0xa8a9('0x3f'),_0xa8a9('0x3e'),_0xa8a9('0x40'),_0xa8a9('0x54'),_0xa8a9('0x42'),_0xa8a9('0x45'),_0xa8a9('0x43'),_0xa8a9('0x55'),_0xa8a9('0x44'),_0xa8a9('0x56'),_0xa8a9('0x57'),'phoneBarEnableAutomaticScreenRecording',_0xa8a9('0x4f'),_0xa8a9('0x58'),'queue',_0xa8a9('0x50')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 8096ea8..a5786e5 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x249f=['erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','error','format','result','getRealtimeQueues','voice','inbound','concat','outbound','paused','loggedIn','busy','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','waiting','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x249f,0x12b));var _0xf249=function(_0x46f2d1,_0x5117fc){_0x46f2d1=_0x46f2d1-0x0;var _0x5063b9=_0x249f[_0x46f2d1];return _0x5063b9;};'use strict';var _=require(_0xf249('0x0'));var jayson=require(_0xf249('0x1'));var util=require(_0xf249('0x2'));var amiClient=jayson[_0xf249('0x3')][_0xf249('0x4')]({'port':0x232a});var routingClient=jayson[_0xf249('0x3')][_0xf249('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xf249('0x5'),'loggedIn','paused',_0xf249('0x6')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0xf249('0x7'),_0xf249('0x8'),_0xf249('0x9'),_0xf249('0xa'),_0xf249('0xb'),_0xf249('0xc'),_0xf249('0xd'),_0xf249('0xe'),_0xf249('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xf249('0x10'),_0xf249('0x11'),_0xf249('0x12'),_0xf249('0x13'),_0xf249('0x14'),_0xf249('0x15'),_0xf249('0x16'),_0xf249('0x17'),_0xf249('0x18'),_0xf249('0x19'),_0xf249('0x1a'),_0xf249('0x1b'),_0xf249('0x1c'),'dialPredictiveInterval',_0xf249('0x1d'),_0xf249('0x1e'),_0xf249('0x1f'),_0xf249('0x20'),_0xf249('0x21'),_0xf249('0x22'),_0xf249('0x23'),_0xf249('0x24'),_0xf249('0x25')];function getRealtimeQueues(_0x5f086a,_0x2760bf){var _0x6f01f8=_0x2760bf==='voice'?amiClient:routingClient;return _0x6f01f8[_0xf249('0x26')](_[_0xf249('0x27')](_0x2760bf)+'Queues',_0x5f086a)['then'](function(_0x2a2898){if(_0x2a2898[_0xf249('0x28')])throw new Error(util[_0xf249('0x29')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x2760bf));return _0x2a2898[_0xf249('0x2a')];})['catch'](function(_0x29b02f){throw _0x29b02f;});}exports[_0xf249('0x2b')]=getRealtimeQueues;function initializeQueues(_0x28a3b9,_0x3f6708,_0x3e5398,_0x15af73){var _0x475584=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3e5398===_0xf249('0x2c')){if(_0x15af73===_0xf249('0x2d')){_0x475584=_0x475584[_0xf249('0x2e')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x15af73===_0xf249('0x2f')){_0x475584=_0x475584[_0xf249('0x2e')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x28a3b9['map'](function(_0x1ee305){var _0x5a34c3=_0x1ee305['get']({'plain':!![]});_0x5a34c3[_0xf249('0x30')]=0x0;_0x5a34c3[_0xf249('0x8')]=0x0;_0x5a34c3[_0xf249('0x31')]=0x0;_0x5a34c3['available']=0x0;_0x5a34c3['waiting']=0x0;if(_0x3e5398===_0xf249('0x2c')){_0x5a34c3['talking']=0x0;_0x5a34c3[_0xf249('0x32')]=0x0;if(_0x15af73==='outbound'){_0x5a34c3[_0xf249('0x10')]=0x0;_0x5a34c3['originated']=0x0;}}var _0x2b06df=_['find'](_0x3f6708,['id',_0x5a34c3['id']]);if(_0x2b06df){_[_0xf249('0x33')](_0x5a34c3,_[_0xf249('0x34')](_0x2b06df,_0x475584));}return _0x5a34c3;});}exports[_0xf249('0x35')]=initializeQueues; \ No newline at end of file +var _0xb952=['outbound','map','available','find','merge','pick','initializeQueues','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','startPredictive','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','voice','request','Queues','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat'];(function(_0x170f7e,_0x1f444a){var _0x54aca1=function(_0x3fce86){while(--_0x3fce86){_0x170f7e['push'](_0x170f7e['shift']());}};_0x54aca1(++_0x1f444a);}(_0xb952,0x197));var _0x2b95=function(_0x3d7fde,_0x1daad7){_0x3d7fde=_0x3d7fde-0x0;var _0xc3c7b5=_0xb952[_0x3d7fde];return _0xc3c7b5;};'use strict';var _=require('lodash');var jayson=require(_0x2b95('0x0'));var util=require(_0x2b95('0x1'));var amiClient=jayson[_0x2b95('0x2')][_0x2b95('0x3')]({'port':0x232a});var routingClient=jayson[_0x2b95('0x2')][_0x2b95('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x2b95('0x4'),_0x2b95('0x5'),_0x2b95('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x2b95('0x7'),_0x2b95('0x8'),_0x2b95('0x9'),_0x2b95('0xa'),_0x2b95('0xb'),_0x2b95('0xc'),_0x2b95('0xd'),'ringInUse',_0x2b95('0xe'),_0x2b95('0xf'),_0x2b95('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x2b95('0x11'),_0x2b95('0x12'),_0x2b95('0x13'),_0x2b95('0x14'),_0x2b95('0x15'),'dialMethod','Trunk',_0x2b95('0x16'),_0x2b95('0x17'),'erlangCalls',_0x2b95('0x18'),'erlangAbandonmentRate',_0x2b95('0x19'),_0x2b95('0x1a'),_0x2b95('0x1b'),_0x2b95('0x1c'),_0x2b95('0x1d'),_0x2b95('0x1e'),_0x2b95('0x1f'),_0x2b95('0x20'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x42526e,_0x56ccde){var _0x5eeec4=_0x56ccde===_0x2b95('0x21')?amiClient:routingClient;return _0x5eeec4[_0x2b95('0x22')](_['startCase'](_0x56ccde)+_0x2b95('0x23'),_0x42526e)['then'](function(_0xc9104c){if(_0xc9104c[_0x2b95('0x24')])throw new Error(util['format'](_0x2b95('0x25'),_0x56ccde));return _0xc9104c[_0x2b95('0x26')];})[_0x2b95('0x27')](function(_0xdfcf7e){throw _0xdfcf7e;});}exports[_0x2b95('0x28')]=getRealtimeQueues;function initializeQueues(_0x2ba4d0,_0x15e9b0,_0x25ff9f,_0x56d20d){var _0x26a2a8=DEFAULT_QUEUE_ATTRIBUTES;if(_0x25ff9f===_0x2b95('0x21')){if(_0x56d20d===_0x2b95('0x29')){_0x26a2a8=_0x26a2a8[_0x2b95('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x56d20d===_0x2b95('0x2b')){_0x26a2a8=_0x26a2a8[_0x2b95('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2ba4d0[_0x2b95('0x2c')](function(_0x5c3277){var _0xdffa30=_0x5c3277['get']({'plain':!![]});_0xdffa30['paused']=0x0;_0xdffa30[_0x2b95('0xa')]=0x0;_0xdffa30[_0x2b95('0x4')]=0x0;_0xdffa30[_0x2b95('0x2d')]=0x0;_0xdffa30[_0x2b95('0x6')]=0x0;if(_0x25ff9f==='voice'){_0xdffa30[_0x2b95('0xe')]=0x0;_0xdffa30[_0x2b95('0x7')]=0x0;if(_0x56d20d==='outbound'){_0xdffa30[_0x2b95('0x11')]=0x0;_0xdffa30['originated']=0x0;}}var _0x56c1ba=_[_0x2b95('0x2e')](_0x15e9b0,['id',_0xdffa30['id']]);if(_0x56c1ba){_[_0x2b95('0x2f')](_0xdffa30,_[_0x2b95('0x30')](_0x56c1ba,_0x26a2a8));}return _0xdffa30;});}exports[_0x2b95('0x31')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ad75319..a64099b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x592a9d,_0x434abb){var _0x59d2b3=function(_0x4661dc){while(--_0x4661dc){_0x592a9d['push'](_0x592a9d['shift']());}};_0x59d2b3(++_0x434abb);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x28ea86,_0x15dee1){var _0x45bf56=function(_0x20013f){while(--_0x20013f){_0x28ea86['push'](_0x28ea86['shift']());}};_0x45bf56(++_0x15dee1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 3c0fd85..f172be9 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 _0x95d0=['replace','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','utf8'];(function(_0x1420d0,_0x28f9cb){var _0x16e4de=function(_0xcde37d){while(--_0xcde37d){_0x1420d0['push'](_0x1420d0['shift']());}};_0x16e4de(++_0x28f9cb);}(_0x95d0,0x143));var _0x095d=function(_0x4f8f72,_0x3f42b1){_0x4f8f72=_0x4f8f72-0x0;var _0xeb05a6=_0x95d0[_0x4f8f72];return _0xeb05a6;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x095d('0x0'));var machine=require(_0x095d('0x1'));var exec=require(_0x095d('0x2'))[_0x095d('0x3')];var config=require('../environment');function getInterfaces(){var _0x197e6f=[];var _0x429cb5=os[_0x095d('0x4')]();var _0x3c09aa=_['orderBy'](_[_0x095d('0x5')](_0x429cb5));for(var _0x39fe5c=0x0;_0x39fe5c<_0x3c09aa[_0x095d('0x6')];_0x39fe5c++){var _0x55d686=_0x429cb5[_0x3c09aa[_0x39fe5c]][_0x095d('0x7')](function(_0x362d3b){return _0x362d3b[_0x095d('0x8')]===_0x095d('0x9')&&_0x362d3b['internal']===![];});_0x197e6f=_0x197e6f[_0x095d('0xa')](_0x55d686);}return _0x197e6f;}function getFirstInterface(){var _0x14d388=_[_0x095d('0xb')](getInterfaces());return{'macAddress':_0x14d388&&_0x14d388[_0x095d('0xc')]?_0x14d388[_0x095d('0xc')]:_0x095d('0xd'),'ipAddress':_0x14d388&&_0x14d388[_0x095d('0xe')]?_0x14d388[_0x095d('0xe')]:'127.0.0.1'};}exports[_0x095d('0xf')]=getFirstInterface;function getCPUhash(){var _0x24c290=_[_0x095d('0x10')](os['cpus']()['map'](function(_0x52dc17){return _0x52dc17['model'];}))[_0x095d('0x11')](':');return crypto[_0x095d('0x12')](_0x095d('0x13'))[_0x095d('0x14')](_0x24c290)[_0x095d('0x15')](_0x095d('0x16'));}exports[_0x095d('0x17')]=function(){var _0x222a76=os[_0x095d('0x18')]();var _0x1d7cb7=/[0-9a-f-]{36}/;if(config[_0x095d('0x19')]&&_0x1d7cb7[_0x095d('0x1a')](config['licenseToken'])){return config[_0x095d('0x19')];}else if(_0x222a76===_0x095d('0x1b')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x095d('0x1c')})[_0x095d('0x1d')]('\x0d\x0a','');}else{var _0x48dbad=getFirstInterface();var _0x7d5337=getCPUhash();var _0x1399aa=_0x7d5337+'|'+os['hostname']()+'|'+_0x48dbad['macAddress']+'|'+_0x48dbad[_0x095d('0x1e')];var _0x3112dc=crypto[_0x095d('0x12')](_0x095d('0x13'))['update'](_0x1399aa)[_0x095d('0x15')](_0x095d('0x16'));return _0x3112dc[_0x095d('0x1f')](0x0,0x8)+'-'+_0x3112dc[_0x095d('0x1f')](0x8,0xc)+'-'+_0x3112dc['substring'](0xc,0x10)+'-'+_0x3112dc['substring'](0x10,0x14)+'-'+_0x3112dc[_0x095d('0x1f')](0x14);}}; \ No newline at end of file +var _0xce22=['lodash','crypto','bimedia-machine-uuid','child_process','../environment','orderBy','keys','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','md5','digest','hex','platform','licenseToken','test','win32','hostname','macAddress','ipAddress','update','substring'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0xce22,0xd9));var _0x2ce2=function(_0x2fe268,_0xe19daa){_0x2fe268=_0x2fe268-0x0;var _0xc664e9=_0xce22[_0x2fe268];return _0xc664e9;};'use strict';var _=require(_0x2ce2('0x0'));var os=require('os');var crypto=require(_0x2ce2('0x1'));var machine=require(_0x2ce2('0x2'));var exec=require(_0x2ce2('0x3'))['execSync'];var config=require(_0x2ce2('0x4'));function getInterfaces(){var _0x35643f=[];var _0x187b34=os['networkInterfaces']();var _0x272d0a=_[_0x2ce2('0x5')](_[_0x2ce2('0x6')](_0x187b34));for(var _0x5efa34=0x0;_0x5efa34<_0x272d0a['length'];_0x5efa34++){var _0x38d990=_0x187b34[_0x272d0a[_0x5efa34]]['filter'](function(_0x2aeba8){return _0x2aeba8[_0x2ce2('0x7')]===_0x2ce2('0x8')&&_0x2aeba8[_0x2ce2('0x9')]===![];});_0x35643f=_0x35643f['concat'](_0x38d990);}return _0x35643f;}function getFirstInterface(){var _0x47d6d4=_[_0x2ce2('0xa')](getInterfaces());return{'macAddress':_0x47d6d4&&_0x47d6d4[_0x2ce2('0xb')]?_0x47d6d4['mac']:_0x2ce2('0xc'),'ipAddress':_0x47d6d4&&_0x47d6d4[_0x2ce2('0xd')]?_0x47d6d4[_0x2ce2('0xd')]:'127.0.0.1'};}exports[_0x2ce2('0xe')]=getFirstInterface;function getCPUhash(){var _0x327197=_['orderBy'](os[_0x2ce2('0xf')]()[_0x2ce2('0x10')](function(_0x533391){return _0x533391[_0x2ce2('0x11')];}))[_0x2ce2('0x12')](':');return crypto['createHash'](_0x2ce2('0x13'))['update'](_0x327197)[_0x2ce2('0x14')](_0x2ce2('0x15'));}exports['getUuid']=function(){var _0x1db1b6=os[_0x2ce2('0x16')]();var _0x51f198=/[0-9a-f-]{36}/;if(config[_0x2ce2('0x17')]&&_0x51f198[_0x2ce2('0x18')](config[_0x2ce2('0x17')])){return config[_0x2ce2('0x17')];}else if(_0x1db1b6===_0x2ce2('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x3b4d89=getFirstInterface();var _0x46f511=getCPUhash();var _0x392a05=_0x46f511+'|'+os[_0x2ce2('0x1a')]()+'|'+_0x3b4d89[_0x2ce2('0x1b')]+'|'+_0x3b4d89[_0x2ce2('0x1c')];var _0x210619=crypto['createHash'](_0x2ce2('0x13'))[_0x2ce2('0x1d')](_0x392a05)['digest'](_0x2ce2('0x15'));return _0x210619[_0x2ce2('0x1e')](0x0,0x8)+'-'+_0x210619[_0x2ce2('0x1e')](0x8,0xc)+'-'+_0x210619[_0x2ce2('0x1e')](0xc,0x10)+'-'+_0x210619[_0x2ce2('0x1e')](0x10,0x14)+'-'+_0x210619[_0x2ce2('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index aac6177..566fdad 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 _0xb954=['SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','then','error','message','getUuid','findOrCreate','spread'];(function(_0x5e611f,_0x4b64f7){var _0xcbad9d=function(_0x5b4b23){while(--_0x5b4b23){_0x5e611f['push'](_0x5e611f['shift']());}};_0xcbad9d(++_0x4b64f7);}(_0xb954,0xf2));var _0x4b95=function(_0x2b395a,_0x35db69){_0x2b395a=_0x2b395a-0x0;var _0x1beba0=_0xb954[_0x2b395a];return _0x1beba0;};'use strict';var util=require('util');var moment=require(_0x4b95('0x0'));var rp=require(_0x4b95('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x4b95('0x2'))(module,_0x4b95('0x3'));var db=require(_0x4b95('0x4'))['db'];var encryptor=require(_0x4b95('0x5'));var hardware=require(_0x4b95('0x6'));var logger=require('../logger')(_0x4b95('0x7'));var HOST=_0x4b95('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5e4236){return new BPromise(function(_0xcc383b,_0x344e44){var _0x189db4=util[_0x4b95('0x9')](_0x4b95('0xa'),HOST,_0x5e4236,module[_0x4b95('0xb')][_0x4b95('0x3')]);if(oldToken){_0x189db4=util[_0x4b95('0x9')](_0x4b95('0xc'),HOST,_0x5e4236,module['exports'][_0x4b95('0x3')],oldToken);}var _0x7d3ed3={'uri':_0x189db4,'method':_0x4b95('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x7d3ed3)['then'](function(_0x2ce4a6){_0xcc383b(_0x2ce4a6);})[_0x4b95('0xe')](function(_0x3e27e5){_0x344e44(_0x3e27e5);});});}function manageLicense(_0x5c0a93,_0x506148){var _0x5ee900=_0x506148['get']({'plain':!![]});if(!isOldTokenSent&&_0x5ee900['data1']!==_0x5c0a93&&!_0x5ee900['data2']){oldToken=_0x5ee900[_0x4b95('0xf')];}httpRequest(_0x5c0a93)['then'](function(_0x562492){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x562492[_0x4b95('0x10')]){isOldTokenSent=![];if(!_0x5ee900[_0x4b95('0x7')]&&_0x5ee900[_0x4b95('0x7')]!=_0x562492[_0x4b95('0x7')]||_0x5ee900[_0x4b95('0x7')]&&_0x5ee900[_0x4b95('0x11')]){logger[_0x4b95('0x12')](_0x4b95('0x13'));}if(_0x5ee900[_0x4b95('0x7')]&&!_0x5ee900[_0x4b95('0x11')]&&_0x5ee900[_0x4b95('0x7')]!=_0x562492['license']){logger[_0x4b95('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5ee900['license']&&!_0x5ee900['data2']&&_0x5ee900['license']==_0x562492[_0x4b95('0x7')]){return _0x506148;}return _0x506148[_0x4b95('0x14')]({'data1':_0x5c0a93,'data2':null,'license':_0x562492[_0x4b95('0x7')]});}else{if(_0x562492[_0x4b95('0x7')]||_0x5ee900[_0x4b95('0x7')]){if(!_0x5ee900[_0x4b95('0x11')]){if(_0x5ee900['data1']==_0x5c0a93){GRAY_PERIOD_REASON=_0x4b95('0x15');logger['info'](_0x4b95('0x16'));}else{GRAY_PERIOD_REASON=_0x4b95('0x17');logger[_0x4b95('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5ee900[_0x4b95('0xf')],_0x5c0a93);}logger[_0x4b95('0x12')](_0x4b95('0x18'),GRAY_PERIOD_REASON[_0x4b95('0x19')](),moment()[_0x4b95('0x9')](_0x4b95('0x1a')));return _0x506148[_0x4b95('0x14')]({'data2':encryptor[_0x4b95('0x1b')](moment()[_0x4b95('0x9')](_0x4b95('0x1a')))});}else{if(moment()[_0x4b95('0x1c')](encryptor[_0x4b95('0x1d')](_0x5ee900[_0x4b95('0x11')]),_0x4b95('0x1e'))>DAYS){logger[_0x4b95('0x12')](_0x4b95('0x1f'),moment()['format'](_0x4b95('0x1a')));isOldTokenSent=![];return _0x506148[_0x4b95('0x14')]({'data1':_0x5c0a93,'data2':null,'license':null});}}}else{if(_0x5ee900[_0x4b95('0xf')]!=_0x5c0a93){logger[_0x4b95('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5ee900[_0x4b95('0xf')],_0x5c0a93);return _0x506148[_0x4b95('0x14')]({'data1':_0x5c0a93,'data2':null,'license':null});}}}return _0x506148;})[_0x4b95('0x20')](function(_0x327b9c){_0x506148=_0x327b9c;})[_0x4b95('0xe')](function(_0x6f44b5){logger[_0x4b95('0x21')](_0x6f44b5[_0x4b95('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x4b95('0x23')](),_0x506148);},TIME);});}function defaultLicense(){var _0x686fb0=hardware['getUuid']();if(_0x686fb0){return db['License'][_0x4b95('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x686fb0}})[_0x4b95('0x25')](function(_0x25659a,_0x1442a5){logger[_0x4b95('0x12')](_0x4b95('0x26'),_0x686fb0);manageLicense(_0x686fb0,_0x25659a);})[_0x4b95('0xe')](function(_0x3f52c4){logger['error'](_0x3f52c4[_0x4b95('0x22')]);});}}exports[_0x4b95('0x27')]=defaultLicense; \ No newline at end of file +var _0x9bf9=['%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','data1','error','finally','getUuid','License','spread','default','moment','request-promise','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x9bf9,0x167));var _0x99bf=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9bf9[_0x2dea24];return _0x309d58;};'use strict';var util=require('util');var moment=require(_0x99bf('0x0'));var rp=require(_0x99bf('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x99bf('0x2'))(module,_0x99bf('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x99bf('0x4'));var hardware=require(_0x99bf('0x5'));var logger=require(_0x99bf('0x6'))(_0x99bf('0x7'));var HOST=_0x99bf('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1b7ab0){return new BPromise(function(_0x2689a7,_0x2c9789){var _0x27109f=util[_0x99bf('0x9')](_0x99bf('0xa'),HOST,_0x1b7ab0,module[_0x99bf('0xb')][_0x99bf('0x3')]);if(oldToken){_0x27109f=util[_0x99bf('0x9')](_0x99bf('0xc'),HOST,_0x1b7ab0,module[_0x99bf('0xb')][_0x99bf('0x3')],oldToken);}var _0x3f2b1d={'uri':_0x27109f,'method':_0x99bf('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3f2b1d)[_0x99bf('0xe')](function(_0x463ab4){_0x2689a7(_0x463ab4);})[_0x99bf('0xf')](function(_0xb6e8ba){_0x2c9789(_0xb6e8ba);});});}function manageLicense(_0x3594b1,_0x3e7871){var _0x38e415=_0x3e7871['get']({'plain':!![]});if(!isOldTokenSent&&_0x38e415['data1']!==_0x3594b1&&!_0x38e415[_0x99bf('0x10')]){oldToken=_0x38e415['data1'];}httpRequest(_0x3594b1)[_0x99bf('0xe')](function(_0x18a987){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x18a987[_0x99bf('0x11')]){isOldTokenSent=![];if(!_0x38e415['license']&&_0x38e415[_0x99bf('0x7')]!=_0x18a987[_0x99bf('0x7')]||_0x38e415[_0x99bf('0x7')]&&_0x38e415['data2']){logger[_0x99bf('0x12')](_0x99bf('0x13'));}if(_0x38e415[_0x99bf('0x7')]&&!_0x38e415[_0x99bf('0x10')]&&_0x38e415['license']!=_0x18a987[_0x99bf('0x7')]){logger['info'](_0x99bf('0x14'));}if(_0x38e415[_0x99bf('0x7')]&&!_0x38e415[_0x99bf('0x10')]&&_0x38e415[_0x99bf('0x7')]==_0x18a987['license']){return _0x3e7871;}return _0x3e7871[_0x99bf('0x15')]({'data1':_0x3594b1,'data2':null,'license':_0x18a987['license']});}else{if(_0x18a987[_0x99bf('0x7')]||_0x38e415['license']){if(!_0x38e415['data2']){if(_0x38e415['data1']==_0x3594b1){GRAY_PERIOD_REASON=_0x99bf('0x16');logger[_0x99bf('0x12')](_0x99bf('0x17'));}else{GRAY_PERIOD_REASON=_0x99bf('0x18');logger['info'](_0x99bf('0x19'),_0x38e415['data1'],_0x3594b1);}logger['info'](_0x99bf('0x1a'),GRAY_PERIOD_REASON[_0x99bf('0x1b')](),moment()[_0x99bf('0x9')](_0x99bf('0x1c')));return _0x3e7871[_0x99bf('0x15')]({'data2':encryptor[_0x99bf('0x1d')](moment()[_0x99bf('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x99bf('0x1e')](encryptor[_0x99bf('0x1f')](_0x38e415['data2']),_0x99bf('0x20'))>DAYS){logger[_0x99bf('0x12')](_0x99bf('0x21'),moment()[_0x99bf('0x9')](_0x99bf('0x1c')));isOldTokenSent=![];return _0x3e7871[_0x99bf('0x15')]({'data1':_0x3594b1,'data2':null,'license':null});}}}else{if(_0x38e415[_0x99bf('0x22')]!=_0x3594b1){logger['info'](_0x99bf('0x19'),_0x38e415[_0x99bf('0x22')],_0x3594b1);return _0x3e7871[_0x99bf('0x15')]({'data1':_0x3594b1,'data2':null,'license':null});}}}return _0x3e7871;})['then'](function(_0x4fce8c){_0x3e7871=_0x4fce8c;})[_0x99bf('0xf')](function(_0x38a283){logger[_0x99bf('0x23')](_0x38a283['message']);})[_0x99bf('0x24')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3e7871);},TIME);});}function defaultLicense(){var _0x2af3a4=hardware[_0x99bf('0x25')]();if(_0x2af3a4){return db[_0x99bf('0x26')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2af3a4}})[_0x99bf('0x27')](function(_0x9dbbef,_0x349625){logger[_0x99bf('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x2af3a4);manageLicense(_0x2af3a4,_0x9dbbef);})[_0x99bf('0xf')](function(_0x533415){logger[_0x99bf('0x23')](_0x533415['message']);});}}exports[_0x99bf('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 2f08e1a..f71c6d8 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 _0xdd94=['days','changed','disabled','message','role','sequelize','COUNT','col','count','admin','user','users','telephones','catch','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','defaults','then','uuid','data1','license','data2','format','parse','demo','machineUuid','decryptString','gray','deadline','add'];(function(_0x4d453c,_0x311b8c){var _0x4c80ac=function(_0x5548c0){while(--_0x5548c0){_0x4d453c['push'](_0x4d453c['shift']());}};_0x4c80ac(++_0x311b8c);}(_0xdd94,0xc4));var _0x4dd9=function(_0x102dd6,_0x48697d){_0x102dd6=_0x102dd6-0x0;var _0x207d7=_0xdd94[_0x102dd6];return _0x207d7;};'use strict';var util=require('util');var _=require(_0x4dd9('0x0'));var moment=require(_0x4dd9('0x1'));var BPromise=require('bluebird');var hardware=require(_0x4dd9('0x2'));var encryptor=require(_0x4dd9('0x3'));var db=require(_0x4dd9('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4dd9('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4dd9('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4dd9('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4dd9('0x7'),'machineUuid':hardware[_0x4dd9('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3fc31a){return new BPromise(function(_0x1e18d1,_0x3a4fee){return db[_0x4dd9('0x9')]['find'](_[_0x4dd9('0xa')](_0x3fc31a,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xc8581f){return checkLicense(_0xc8581f,null);})[_0x4dd9('0xb')](function(_0x200916){_0x1e18d1(_0x200916);return;})['catch'](function(_0x49a87f){_0x3a4fee(_0x49a87f);});});}function checkLicense(_0x47c46a,_0x3bb647){if(!_0x47c46a){demoLicense[_0x4dd9('0xc')]=_0x47c46a[_0x4dd9('0xd')];return demoLicense;}try{var _0x1501b9=_0x3bb647||_0x47c46a[_0x4dd9('0xe')];if(_['isEmpty'](_0x1501b9)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5633af=_0x47c46a[_0x4dd9('0xd')];var _0x225e6e=_0x47c46a[_0x4dd9('0xf')];var _0xac1dd3=_0x5633af['split']('-')[0x4];var _0x4fa599=_0x5633af['split']('-')[0x0];var _0xed0e0d=encryptor['decryptString'](_0x1501b9,util[_0x4dd9('0x10')]('%s:%s:%s',_0xac1dd3,_0x5633af,_0x4fa599));var _0x4c5570=JSON[_0x4dd9('0x11')](_0xed0e0d);_0x4c5570[_0x4dd9('0x12')]=![];_0x4c5570[_0x4dd9('0xc')]=_0x5633af;_0x4c5570[_0x4dd9('0x13')]=hardware['getUuid']();if(_0x225e6e){var _0x51eed4=encryptor[_0x4dd9('0x14')](_0x225e6e);_0x4c5570[_0x4dd9('0x15')]=_0x51eed4;_0x4c5570[_0x4dd9('0x16')]=moment(_0x51eed4)[_0x4dd9('0x17')](0x7,_0x4dd9('0x18'))[_0x4dd9('0x10')]();_0x4c5570['grayReason']=_0x4c5570[_0x4dd9('0xc')]!=_0x4c5570[_0x4dd9('0x13')]?_0x4dd9('0x19'):_0x4dd9('0x1a');}return _0x4c5570;}catch(_0x5353a9){breakingLicense[_0x4dd9('0xc')]=_0x47c46a[_0x4dd9('0xd')];breakingLicense[_0x4dd9('0x1b')]=_0x5353a9[_0x4dd9('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2294bf,_0x138619){getLicense()[_0x4dd9('0xb')](function(_0x411c97){return db['User']['findAll']({'attributes':[_0x4dd9('0x1c'),[db[_0x4dd9('0x1d')]['fn'](_0x4dd9('0x1e'),db[_0x4dd9('0x1d')][_0x4dd9('0x1f')](_0x4dd9('0x1c'))),_0x4dd9('0x20')]],'group':_0x4dd9('0x1c'),'where':{'role':{'$or':[_0x4dd9('0x21'),_0x4dd9('0x22'),'telephone']}},'raw':!![]})['then'](function(_0x1f9f5a){var _0x2224f1={'user':_0x411c97[_0x4dd9('0x23')]||0x0,'telephone':_0x411c97[_0x4dd9('0x24')]||0x0};_0x1f9f5a['forEach'](function(_0x2e0679){var _0x200534=_0x2e0679[_0x4dd9('0x1c')]===_0x4dd9('0x21')?_0x4dd9('0x22'):_0x2e0679[_0x4dd9('0x1c')];_0x2224f1[_0x200534]-=_0x2e0679[_0x4dd9('0x20')];if(_0x2224f1[_0x200534]<0x0)_0x2224f1[_0x200534]=0x0;});_0x2294bf(_0x2224f1);return;});})[_0x4dd9('0x25')](function(_0x4d58bb){_0x138619(_0x4d58bb);});});}function checkUserLimits(_0x20ffe7){return new BPromise(function(_0x31bc6c,_0x1c57f1){getLimits()['then'](function(_0x389485){var _0x496762=_[_0x4dd9('0x26')](_[_0x4dd9('0x27')](_0x20ffe7,_0x4dd9('0x1c')),[_0x4dd9('0x21'),_0x4dd9('0x22'),_0x4dd9('0x28')]);var _0x4b1e3e=(_0x496762[_0x4dd9('0x21')]||0x0)+(_0x496762[_0x4dd9('0x22')]||0x0);var _0x5bb0a8=_0x496762[_0x4dd9('0x28')]||0x0;if(_0x4b1e3e>_0x389485['user'])return _0x1c57f1(_0x4dd9('0x29'));if(_0x5bb0a8>_0x389485['telephone'])return _0x1c57f1(_0x4dd9('0x2a'));return _0x31bc6c();})[_0x4dd9('0x25')](function(_0xa4177f){_0x1c57f1(_0xa4177f);});});}module[_0x4dd9('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6ea9=['Demo\x20license','Breaking\x20license','getUuid','License','find','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','gray','deadline','add','days','machineUuid','changed','message','then','findAll','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','role','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z'];(function(_0x368568,_0x1ed75a){var _0x4cd552=function(_0x56bc21){while(--_0x56bc21){_0x368568['push'](_0x368568['shift']());}};_0x4cd552(++_0x1ed75a);}(_0x6ea9,0x136));var _0x96ea=function(_0x5f2ced,_0x48e36a){_0x5f2ced=_0x5f2ced-0x0;var _0x5aad90=_0x6ea9[_0x5f2ced];return _0x5aad90;};'use strict';var util=require(_0x96ea('0x0'));var _=require(_0x96ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x96ea('0x2'));var db=require(_0x96ea('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x96ea('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x96ea('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x96ea('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x96ea('0x6'),'machineUuid':hardware[_0x96ea('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x173c9b){return new BPromise(function(_0x236ecc,_0xc6e909){return db[_0x96ea('0x8')][_0x96ea('0x9')](_['defaults'](_0x173c9b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x443ae5){return checkLicense(_0x443ae5,null);})['then'](function(_0x586b78){_0x236ecc(_0x586b78);return;})[_0x96ea('0xa')](function(_0x53889a){_0xc6e909(_0x53889a);});});}function checkLicense(_0x2890ef,_0x580433){if(!_0x2890ef){demoLicense[_0x96ea('0xb')]=_0x2890ef[_0x96ea('0xc')];return demoLicense;}try{var _0x2c29ca=_0x580433||_0x2890ef[_0x96ea('0xd')];if(_['isEmpty'](_0x2c29ca)){throw new Error(_0x96ea('0xe'));}var _0x19ed91=_0x2890ef['data1'];var _0x55d84b=_0x2890ef[_0x96ea('0xf')];var _0x5b6a28=_0x19ed91[_0x96ea('0x10')]('-')[0x4];var _0x2d9847=_0x19ed91[_0x96ea('0x10')]('-')[0x0];var _0x48d9a2=encryptor[_0x96ea('0x11')](_0x2c29ca,util[_0x96ea('0x12')](_0x96ea('0x13'),_0x5b6a28,_0x19ed91,_0x2d9847));var _0x442662=JSON[_0x96ea('0x14')](_0x48d9a2);_0x442662[_0x96ea('0x15')]=![];_0x442662[_0x96ea('0xb')]=_0x19ed91;_0x442662['machineUuid']=hardware['getUuid']();if(_0x55d84b){var _0x344056=encryptor[_0x96ea('0x11')](_0x55d84b);_0x442662[_0x96ea('0x16')]=_0x344056;_0x442662[_0x96ea('0x17')]=moment(_0x344056)[_0x96ea('0x18')](0x7,_0x96ea('0x19'))['format']();_0x442662['grayReason']=_0x442662[_0x96ea('0xb')]!=_0x442662[_0x96ea('0x1a')]?_0x96ea('0x1b'):'disabled';}return _0x442662;}catch(_0x181765){breakingLicense[_0x96ea('0xb')]=_0x2890ef[_0x96ea('0xc')];breakingLicense[_0x96ea('0x1c')]=_0x181765['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xfabf9,_0x5e5dfe){getLicense()[_0x96ea('0x1d')](function(_0x25e130){return db['User'][_0x96ea('0x1e')]({'attributes':['role',[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')][_0x96ea('0x21')]('role')),_0x96ea('0x22')]],'group':'role','where':{'role':{'$or':[_0x96ea('0x23'),'user',_0x96ea('0x24')]}},'raw':!![]})[_0x96ea('0x1d')](function(_0x493bab){var _0x3a6bb0={'user':_0x25e130[_0x96ea('0x25')]||0x0,'telephone':_0x25e130[_0x96ea('0x26')]||0x0};_0x493bab[_0x96ea('0x27')](function(_0x349196){var _0x3e72b1=_0x349196[_0x96ea('0x28')]===_0x96ea('0x23')?'user':_0x349196[_0x96ea('0x28')];_0x3a6bb0[_0x3e72b1]-=_0x349196[_0x96ea('0x22')];if(_0x3a6bb0[_0x3e72b1]<0x0)_0x3a6bb0[_0x3e72b1]=0x0;});_0xfabf9(_0x3a6bb0);return;});})['catch'](function(_0x4d1112){_0x5e5dfe(_0x4d1112);});});}function checkUserLimits(_0x2a5f7e){return new BPromise(function(_0x28c2c9,_0x58837d){getLimits()[_0x96ea('0x1d')](function(_0x2e2d50){var _0x299c10=_['pick'](_['countBy'](_0x2a5f7e,_0x96ea('0x28')),[_0x96ea('0x23'),_0x96ea('0x29'),_0x96ea('0x24')]);var _0x44190c=(_0x299c10['admin']||0x0)+(_0x299c10[_0x96ea('0x29')]||0x0);var _0x256d68=_0x299c10['telephone']||0x0;if(_0x44190c>_0x2e2d50[_0x96ea('0x29')])return _0x58837d(_0x96ea('0x2a'));if(_0x256d68>_0x2e2d50[_0x96ea('0x24')])return _0x58837d(_0x96ea('0x2b'));return _0x28c2c9();})['catch'](function(_0x232c7d){_0x58837d(_0x232c7d);});});}module[_0x96ea('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index f70e2b4..64e799d 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 _0x1a85=['secret','myappanuglar-secret','app-id'];(function(_0xdeb36f,_0x3b0ac6){var _0x9b7cf0=function(_0x427748){while(--_0x427748){_0xdeb36f['push'](_0xdeb36f['shift']());}};_0x9b7cf0(++_0x3b0ac6);}(_0x1a85,0x178));var _0x51a8=function(_0x5887ec,_0x504c12){_0x5887ec=_0x5887ec-0x0;var _0x23b637=_0x1a85[_0x5887ec];return _0x23b637;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x51a8('0x0'),'GOOGLE_ID':_0x51a8('0x1'),'GOOGLE_SECRET':_0x51a8('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x1893=['myappanuglar-secret','app-id','secret'];(function(_0x2fde14,_0xb161dc){var _0x36bc78=function(_0xbd2420){while(--_0xbd2420){_0x2fde14['push'](_0x2fde14['shift']());}};_0x36bc78(++_0xb161dc);}(_0x1893,0xa2));var _0x3189=function(_0x36cff7,_0x5cb048){_0x36cff7=_0x36cff7-0x0;var _0x21c697=_0x1893[_0x36cff7];return _0x21c697;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3189('0x0'),'GOOGLE_ID':_0x3189('0x1'),'GOOGLE_SECRET':_0x3189('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 5d4cd06..6ba53d7 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x801f=['fileLogger','exports','../utils/loggers'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x801f,0x1e2));var _0xf801=function(_0x1ac34f,_0x29671e){_0x1ac34f=_0x1ac34f-0x0;var _0x5a22db=_0x801f[_0x1ac34f];return _0x5a22db;};'use strict';var fileLogger=require(_0xf801('0x0'))[_0xf801('0x1')];module[_0xf801('0x2')]=fileLogger; \ No newline at end of file +var _0x7738=['../utils/loggers','fileLogger'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7738,0x1c8));var _0x8773=function(_0x11a1a6,_0x3bb701){_0x11a1a6=_0x11a1a6-0x0;var _0x38f91e=_0x7738[_0x11a1a6];return _0x38f91e;};'use strict';var fileLogger=require(_0x8773('0x0'))[_0x8773('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 5de8b97..4f09041 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 _0x2528=['root','legacy-libs','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','../../services/xdr/index.js','exports','path','resolve','join'];(function(_0x6c55ff,_0x5c564a){var _0x18afb0=function(_0x472cc0){while(--_0x472cc0){_0x6c55ff['push'](_0x6c55ff['shift']());}};_0x18afb0(++_0x5c564a);}(_0x2528,0x176));var _0x8252=function(_0x27e20d,_0x2f5956){_0x27e20d=_0x27e20d-0x0;var _0xc1195e=_0x2528[_0x27e20d];return _0xc1195e;};'use strict';var path=require(_0x8252('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x8252('0x1')](path[_0x8252('0x2')](cfg[_0x8252('0x3')],_0x8252('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x8252('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x8252('0x5'),'script':path[_0x8252('0x2')](__dirname,_0x8252('0x6')),'env':env},{'name':'agi','script':path['join'](__dirname,_0x8252('0x7')),'env':env},{'name':_0x8252('0x8'),'script':path[_0x8252('0x2')](__dirname,_0x8252('0x9')),'env':env},{'name':'routing','script':path[_0x8252('0x2')](__dirname,_0x8252('0xa')),'env':env},{'name':'xdr','script':path[_0x8252('0x2')](__dirname,_0x8252('0xb')),'env':env}]};module[_0x8252('0xc')]=pm2config; \ No newline at end of file +var _0x92ea=['../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','resolve','root','legacy-libs','express','join','../../services/express/index.js','../../services/ami/index.js','agi'];(function(_0x685346,_0x3ef2e5){var _0x52e15b=function(_0x4435da){while(--_0x4435da){_0x685346['push'](_0x685346['shift']());}};_0x52e15b(++_0x3ef2e5);}(_0x92ea,0xf7));var _0xa92e=function(_0x37de50,_0x27f82a){_0x37de50=_0x37de50-0x0;var _0x2c37dc=_0x92ea[_0x37de50];return _0x2c37dc;};'use strict';var path=require(_0xa92e('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xa92e('0x1')](path['join'](cfg[_0xa92e('0x2')],_0xa92e('0x3')))};var pm2config={'apps':[{'name':_0xa92e('0x4'),'script':path[_0xa92e('0x5')](__dirname,_0xa92e('0x6')),'env':env},{'name':'ami','script':path[_0xa92e('0x5')](__dirname,_0xa92e('0x7')),'env':env},{'name':_0xa92e('0x8'),'script':path[_0xa92e('0x5')](__dirname,_0xa92e('0x9')),'env':env},{'name':_0xa92e('0xa'),'script':path[_0xa92e('0x5')](__dirname,_0xa92e('0xb')),'env':env},{'name':_0xa92e('0xc'),'script':path[_0xa92e('0x5')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xa92e('0xd'),'script':path['join'](__dirname,_0xa92e('0xe')),'env':env}]};module[_0xa92e('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 031354e..753aab4 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 _0x6c6b=['delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe'];(function(_0x20beb7,_0x36fbb8){var _0x39d921=function(_0xfc75fb){while(--_0xfc75fb){_0x20beb7['push'](_0x20beb7['shift']());}};_0x39d921(++_0x36fbb8);}(_0x6c6b,0xe4));var _0xb6c6=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x6c6b[_0x1203f];return _0x365f0a;};'use strict';var pm2=require(_0xb6c6('0x0'));var BPromise=require(_0xb6c6('0x1'));var config=require(_0xb6c6('0x2'));function connect(){return new BPromise(function(_0x3c845c,_0x553ec5){return pm2[_0xb6c6('0x3')](function(_0x46b7b2){if(_0x46b7b2){return _0x553ec5(_0x46b7b2);}return _0x3c845c(_0xb6c6('0x4'));});});};exports[_0xb6c6('0x5')]=function(_0x3132b1){return connect()[_0xb6c6('0x6')](function(){return new BPromise(function(_0x2540a4,_0x4954c4){return pm2[_0xb6c6('0x5')](_0x3132b1,function(_0x562b52,_0x5dfe96){if(_0x562b52){return _0x4954c4(_0x562b52);}pm2[_0xb6c6('0x7')]();return _0x2540a4(_0x5dfe96);});});});};exports[_0xb6c6('0x8')]=function(_0x36f645){return connect()[_0xb6c6('0x6')](function(){return new BPromise(function(_0x344cb2,_0x105625){return pm2[_0xb6c6('0x8')](_0x36f645,function(_0x45ddab,_0x195946){if(_0x45ddab){return _0x105625(_0x45ddab);}pm2['disconnect']();return _0x344cb2(_0x195946);});});});};exports[_0xb6c6('0x9')]=function(_0x641cbd){return connect()[_0xb6c6('0x6')](function(){return new BPromise(function(_0x5bca8e,_0x19c9ff){return pm2['restart'](_0x641cbd,function(_0x18b700,_0x5cda08){if(_0x18b700){return _0x19c9ff(_0x18b700);}pm2[_0xb6c6('0x7')]();return _0x5bca8e(_0x5cda08);});});});};exports[_0xb6c6('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1c2944,_0x1b44a3){return pm2[_0xb6c6('0xa')](function(_0x134c71,_0x3070b1){if(_0x134c71){return _0x1b44a3(_0x134c71);}pm2[_0xb6c6('0x7')]();return _0x1c2944(_0x3070b1);});});});};exports[_0xb6c6('0xb')]=function(_0x4318ea){return connect()[_0xb6c6('0x6')](function(){return new BPromise(function(_0x14dffd,_0x6c306){return pm2[_0xb6c6('0xb')](_0x4318ea,function(_0x120538,_0x4871ec){if(_0x120538){return _0x6c306(_0x120538);}pm2[_0xb6c6('0x7')]();return _0x14dffd(_0x4871ec);});});});};exports[_0xb6c6('0xc')]=function(_0xdca8dd){return connect()[_0xb6c6('0x6')](function(){return new BPromise(function(_0x363431,_0x47b0be){return pm2[_0xb6c6('0xc')](_0xdca8dd,function(_0x29d5ab,_0x176c54){if(_0x29d5ab){return _0x47b0be(_0x29d5ab);}pm2['disconnect']();return _0x363431(_0x176c54);});});});};exports[_0xb6c6('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x364469,_0x18fbea){return pm2[_0xb6c6('0xd')](function(_0x2be2a6){if(_0x2be2a6){return _0x18fbea(_0x2be2a6);}return _0x364469(_0xb6c6('0xe'));});});});}; \ No newline at end of file +var _0xceff=['then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config','connect','connected'];(function(_0x3a16d4,_0x23ecda){var _0x31ea9c=function(_0x35fea8){while(--_0x35fea8){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x31ea9c(++_0x23ecda);}(_0xceff,0x1e6));var _0xfcef=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xceff[_0x4a747d];return _0x3a5b5c;};'use strict';var pm2=require(_0xfcef('0x0'));var BPromise=require('bluebird');var config=require(_0xfcef('0x1'));function connect(){return new BPromise(function(_0x9d4fd,_0x3ac120){return pm2[_0xfcef('0x2')](function(_0x581261){if(_0x581261){return _0x3ac120(_0x581261);}return _0x9d4fd(_0xfcef('0x3'));});});};exports['start']=function(_0x33e962){return connect()[_0xfcef('0x4')](function(){return new BPromise(function(_0x448554,_0xe04955){return pm2[_0xfcef('0x5')](_0x33e962,function(_0x194fa3,_0x3fd8c8){if(_0x194fa3){return _0xe04955(_0x194fa3);}pm2[_0xfcef('0x6')]();return _0x448554(_0x3fd8c8);});});});};exports[_0xfcef('0x7')]=function(_0x1ed642){return connect()['then'](function(){return new BPromise(function(_0x119746,_0x1cf552){return pm2[_0xfcef('0x7')](_0x1ed642,function(_0x46e4d9,_0x30e59b){if(_0x46e4d9){return _0x1cf552(_0x46e4d9);}pm2[_0xfcef('0x6')]();return _0x119746(_0x30e59b);});});});};exports[_0xfcef('0x8')]=function(_0x7e702a){return connect()[_0xfcef('0x4')](function(){return new BPromise(function(_0x24c760,_0x1eca79){return pm2['restart'](_0x7e702a,function(_0x308c84,_0x5aa58c){if(_0x308c84){return _0x1eca79(_0x308c84);}pm2['disconnect']();return _0x24c760(_0x5aa58c);});});});};exports['list']=function(){return connect()[_0xfcef('0x4')](function(){return new BPromise(function(_0x5280d7,_0x44ae97){return pm2[_0xfcef('0x9')](function(_0x43dd2c,_0x15b6ae){if(_0x43dd2c){return _0x44ae97(_0x43dd2c);}pm2['disconnect']();return _0x5280d7(_0x15b6ae);});});});};exports[_0xfcef('0xa')]=function(_0x556efb){return connect()['then'](function(){return new BPromise(function(_0x594ad5,_0x3df3e9){return pm2['describe'](_0x556efb,function(_0x45e16d,_0xa49e8c){if(_0x45e16d){return _0x3df3e9(_0x45e16d);}pm2[_0xfcef('0x6')]();return _0x594ad5(_0xa49e8c);});});});};exports[_0xfcef('0xb')]=function(_0x263084){return connect()[_0xfcef('0x4')](function(){return new BPromise(function(_0x557787,_0x4e2489){return pm2[_0xfcef('0xb')](_0x263084,function(_0x462534,_0x7cdb5c){if(_0x462534){return _0x4e2489(_0x462534);}pm2[_0xfcef('0x6')]();return _0x557787(_0x7cdb5c);});});});};exports[_0xfcef('0xc')]=function(){return connect()[_0xfcef('0x4')](function(){return new BPromise(function(_0x28e2e8,_0x4c7a97){return pm2[_0xfcef('0xc')](function(_0x56191d){if(_0x56191d){return _0x4c7a97(_0x56191d);}return _0x28e2e8(_0xfcef('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d354ec9..cad56b4 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 _0xadd8=['lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','find','chatTimeout','ChatInteraction','findAll'];(function(_0x3ed1cd,_0x3dae9b){var _0x294bd1=function(_0x53284f){while(--_0x53284f){_0x3ed1cd['push'](_0x3ed1cd['shift']());}};_0x294bd1(++_0x3dae9b);}(_0xadd8,0xc6));var _0x8add=function(_0x190022,_0x5da6cf){_0x190022=_0x190022-0x0;var _0x578da9=_0xadd8[_0x190022];return _0x578da9;};'use strict';var _=require('lodash');var moment=require(_0x8add('0x0'));var Redis=require('ioredis');var util=require(_0x8add('0x1'));var config=require('../../config/environment');var db=require(_0x8add('0x2'))['db'];var logger=require(_0x8add('0x3'))(_0x8add('0x4'));config[_0x8add('0x5')]=_['defaults'](config[_0x8add('0x5')],{'host':_0x8add('0x6'),'port':0x18eb});var io=require(_0x8add('0x7'))(new Redis(config[_0x8add('0x5')]));function closeInteractions(){var _0x43f4ef=0x0;var _0x437b37=[];return db['Setting'][_0x8add('0x8')]({'raw':!![],'attributes':['id',_0x8add('0x9')],'where':{'id':0x1}})['then'](function(_0xfe43ca){_0x43f4ef=_0xfe43ca['chatTimeout'];if(_0x43f4ef){return db[_0x8add('0xa')][_0x8add('0xb')]({'raw':!![],'attributes':['id',_0x8add('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8add('0xd')](_0xfe43ca['chatTimeout'],_0x8add('0xe'))}}});}else{return[];}})['then'](function(_0x1a92b3){if(_0x1a92b3&&_0x1a92b3[_0x8add('0xf')]){_0x437b37=_[_0x8add('0x10')](_0x1a92b3||[],'id');logger[_0x8add('0x11')](_0x8add('0x12'),_0x437b37[_0x8add('0x13')]());return db[_0x8add('0xa')]['update']({'closeReason':_0x8add('0x14'),'disposition':_0x8add('0x15'),'closed':!![],'closedAt':moment()[_0x8add('0x16')](_0x8add('0x17'))},{'where':{'id':_0x437b37}});}})[_0x8add('0x18')](function(){if(_0x437b37&&_0x437b37[_0x8add('0xf')]){logger['info'](_0x8add('0x19'),_0x437b37[_0x8add('0x13')]());for(var _0x1dad31=0x0;_0x1dad31<_0x437b37[_0x8add('0xf')];_0x1dad31++){io['emit']('chatInteraction:update',{'id':_0x437b37[_0x1dad31],'closed':!![]});}}})[_0x8add('0x1a')](function(_0x2defe0){logger['error'](_0x8add('0x1b'),_0x2defe0?util[_0x8add('0x1c')](_0x2defe0,{'showHidden':![],'depth':null}):'');});}exports[_0x8add('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2551=['socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost'];(function(_0x453279,_0x9c3e93){var _0x307087=function(_0x5aafb6){while(--_0x5aafb6){_0x453279['push'](_0x453279['shift']());}};_0x307087(++_0x9c3e93);}(_0x2551,0xe7));var _0x1255=function(_0x52bfa5,_0x42cf21){_0x52bfa5=_0x52bfa5-0x0;var _0x26f80b=_0x2551[_0x52bfa5];return _0x26f80b;};'use strict';var _=require(_0x1255('0x0'));var moment=require('moment');var Redis=require(_0x1255('0x1'));var util=require(_0x1255('0x2'));var config=require(_0x1255('0x3'));var db=require(_0x1255('0x4'))['db'];var logger=require(_0x1255('0x5'))(_0x1255('0x6'));config[_0x1255('0x7')]=_['defaults'](config[_0x1255('0x7')],{'host':_0x1255('0x8'),'port':0x18eb});var io=require(_0x1255('0x9'))(new Redis(config[_0x1255('0x7')]));function closeInteractions(){var _0x4703c4=0x0;var _0x19d705=[];return db[_0x1255('0xa')][_0x1255('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x1255('0xc')](function(_0x349fb8){_0x4703c4=_0x349fb8[_0x1255('0xd')];if(_0x4703c4){return db[_0x1255('0xe')][_0x1255('0xf')]({'raw':!![],'attributes':['id',_0x1255('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x1255('0x11')](_0x349fb8['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0x1f7a8b){if(_0x1f7a8b&&_0x1f7a8b[_0x1255('0x12')]){_0x19d705=_['map'](_0x1f7a8b||[],'id');logger[_0x1255('0x13')](_0x1255('0x14'),_0x19d705[_0x1255('0x15')]());return db[_0x1255('0xe')][_0x1255('0x16')]({'closeReason':_0x1255('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x19d705}});}})[_0x1255('0xc')](function(){if(_0x19d705&&_0x19d705['length']){logger['info'](_0x1255('0x18'),_0x19d705[_0x1255('0x15')]());for(var _0x25ba80=0x0;_0x25ba80<_0x19d705[_0x1255('0x12')];_0x25ba80++){io['emit'](_0x1255('0x19'),{'id':_0x19d705[_0x25ba80],'closed':!![]});}}})[_0x1255('0x1a')](function(_0x362053){logger[_0x1255('0x1b')](_0x1255('0x1c'),_0x362053?util['inspect'](_0x362053,{'showHidden':![],'depth':null}):'');});}exports[_0x1255('0x1d')]=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 d4c237b..7a30da8 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 _0x3da5=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0x3da5,0x103));var _0x53da=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x3da5[_0x40220a];return _0x3903cc;};'use strict';function start(){var _0x16fe99=require(_0x53da('0x0'));return _0x16fe99[_0x53da('0x1')]();}module[_0x53da('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x59a8=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x2c4877,_0x150126){var _0x1e37de=function(_0x2fb5a1){while(--_0x2fb5a1){_0x2c4877['push'](_0x2c4877['shift']());}};_0x1e37de(++_0x150126);}(_0x59a8,0x127));var _0x859a=function(_0x18d490,_0x83a69a){_0x18d490=_0x18d490-0x0;var _0x297d5f=_0x59a8[_0x18d490];return _0x297d5f;};'use strict';function start(){var _0x382946=require(_0x859a('0x0'));return _0x382946[_0x859a('0x1')]();}module[_0x859a('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 836bb28..b1ef590 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 _0x575f=['attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Failed','[handleSendEmail]\x20Unrecognized\x20status:','request','email\x20sent','case\x20loading','retryOptions','data','stop','operation','still\x20loading','job','case\x20empty','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','resolve','run\x20job','active','isBetween','startAt','endAt','add','cron','start','update','update\x20cron','stop\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','then','catch','error','MailAccount','getSmtpOptions','format','name','email','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','existsSync','Sent','message'];(function(_0x35717d,_0x1fad98){var _0xafb902=function(_0x1339c0){while(--_0x1339c0){_0x35717d['push'](_0x35717d['shift']());}};_0xafb902(++_0x1fad98);}(_0x575f,0xb1));var _0xf575=function(_0x571354,_0x353b0a){_0x571354=_0x571354-0x0;var _0x45dd17=_0x575f[_0x571354];return _0x45dd17;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xf575('0x0'));var _=require(_0xf575('0x1'));var moment=require(_0xf575('0x2'));var CronJobManager=require(_0xf575('0x3'));var jayson=require(_0xf575('0x4'));var BPromise=require(_0xf575('0x5'));var logger=require(_0xf575('0x6'))('schedule');var db=require(_0xf575('0x7'))['db'];const retry=require(_0xf575('0x8'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xf575('0x9'));var client=jayson[_0xf575('0xa')][_0xf575('0xb')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x5999f1){const _0x14231d={};if(typeof _0x5999f1===_0xf575('0xc')){_0x14231d['id']=_0x5999f1;}return db[_0xf575('0xd')][_0xf575('0xe')]({'where':_0x14231d})[_0xf575('0xf')](function(_0x2e4ab8){return _0x2e4ab8;})[_0xf575('0x10')](function(_0x2dd47f){logger[_0xf575('0x11')](_0x2dd47f);});}function handleSendEmail(_0x42fa9d,_0x148fca){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x42fa9d['email']);var _0x22a9ae=!![];var _0xa4970e=_0x42fa9d[_0xf575('0x12')][_0xf575('0x13')]();var _0x1481cd={'account':_0xa4970e,'message':{'from':util[_0xf575('0x14')]('\x22%s\x22\x20<%s>',_0x42fa9d[_0xf575('0x12')][_0xf575('0x15')],_0x42fa9d['MailAccount'][_0xf575('0x16')]||_0x42fa9d[_0xf575('0x12')][_0xf575('0x17')][_0xf575('0x18')]),'to':_0x42fa9d[_0xf575('0x16')],'cc':_0x42fa9d['cc'],'bcc':_0x42fa9d[_0xf575('0x19')],'subject':util[_0xf575('0x14')](_0xf575('0x1a'),_0x148fca[_0xf575('0x15')],_0x42fa9d[_0xf575('0x1b')],_0x42fa9d[_0xf575('0x1c')])}};var _0x52baff=path[_0xf575('0x1d')](__dirname,'../../files/reports');var _0x150286=_0x148fca[_0xf575('0x1e')];var _0x424695=util[_0xf575('0x14')](_0xf575('0x1f'),path[_0xf575('0x20')](_0x148fca[_0xf575('0x1e')],path[_0xf575('0x21')](_0x148fca[_0xf575('0x1e')])),'zip');var _0x598fbf=path[_0xf575('0x1d')](_0x52baff,_0x150286);var _0x1ec1d7=path[_0xf575('0x1d')](_0x52baff,_0x424695);if(fs[_0xf575('0x22')](_0x598fbf)){_0x148fca['status']=_0xf575('0x23');_0x1481cd[_0xf575('0x24')][_0xf575('0x25')]=[{'filename':_0x150286,'path':_0x598fbf}];_0x1481cd['message'][_0xf575('0x26')]=util[_0xf575('0x14')](_0xf575('0x27'),JSON[_0xf575('0x28')](_0x148fca,null,0x2));}else if(fs[_0xf575('0x22')](_0x1ec1d7)){_0x148fca['status']=_0xf575('0x23');_0x1481cd[_0xf575('0x24')]['attachments']=[{'filename':_0x424695,'path':_0x1ec1d7}];}else{if(_0x148fca[_0xf575('0x29')]===_0xf575('0x2a')){_0x1481cd[_0xf575('0x24')][_0xf575('0x26')]=_0xf575('0x2b');if(!_0x42fa9d[_0xf575('0x2c')]){_0x22a9ae=![];logger[_0xf575('0x2d')](_0xf575('0x2e'));}}else if(_0x148fca[_0xf575('0x29')]==='Loading'){_0x1481cd[_0xf575('0x24')]['text']=_0xf575('0x2f');}else if(_0x148fca[_0xf575('0x29')]===_0xf575('0x30')){_0x1481cd['message'][_0xf575('0x26')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x148fca[_0xf575('0x29')]===_0xf575('0x31')){_0x1481cd['message'][_0xf575('0x26')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0xf575('0x11')](_0xf575('0x32'),_0x148fca[_0xf575('0x29')]);}}if(_0x22a9ae){return client[_0xf575('0x33')]('SendMail',_0x1481cd)[_0xf575('0xf')](function(_0x1ef6f5){if(_0x1ef6f5[_0xf575('0x11')]){return logger['error']('error\x20mail',JSON['stringify'](_0x1ef6f5));}return logger[_0xf575('0x2d')](_0xf575('0x34'));})['catch'](function(_0x158f61){return logger[_0xf575('0x11')]('error\x20mail',JSON[_0xf575('0x28')](_0x158f61));});}}function handleError(){return function(_0x5b9b2a){return logger[_0xf575('0x11')](JSON[_0xf575('0x28')](_0x5b9b2a));};}function loading(_0x4082ab){logger[_0xf575('0x2d')](_0xf575('0x35'));if(_0x4082ab['currentAttempt']===_0x4082ab[_0xf575('0x36')]['retries']){handleSendEmail(_0x4082ab['job'],_0x4082ab[_0xf575('0x37')]);_0x4082ab['operation'][_0xf575('0x38')]();}else{_0x4082ab[_0xf575('0x39')]['retry'](_0xf575('0x3a'));}}function completed(_0x817569){logger[_0xf575('0x2d')]('case\x20completed');handleSendEmail(_0x817569[_0xf575('0x3b')],_0x817569['data']);_0x817569[_0xf575('0x39')][_0xf575('0x38')]();}function empty(_0xaec2ac){logger[_0xf575('0x2d')](_0xf575('0x3c'));handleSendEmail(_0xaec2ac[_0xf575('0x3b')],_0xaec2ac[_0xf575('0x37')]);_0xaec2ac[_0xf575('0x39')][_0xf575('0x38')]();}function failed(_0xd9590e){logger[_0xf575('0x2d')]('case\x20failed');handleSendEmail(_0xd9590e['job'],_0xd9590e[_0xf575('0x37')]);_0xd9590e['operation']['stop']();}function urecognized(_0x1b8b07){logger[_0xf575('0x11')]('Unrecognized\x20status:',_0x1b8b07[_0xf575('0x3d')][_0xf575('0x3e')][_0xf575('0x29')]);_0x1b8b07[_0xf575('0x39')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x284fb6,_0x26a821){const _0x5f2620={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x509f9a=retry[_0xf575('0x39')](_0x5f2620);_0x509f9a['attempt'](_0x122180=>{logger['info'](_0xf575('0x3f')+_0x284fb6['id']+_0xf575('0x40')+_0x122180);try{getReportData(_0x26a821['id'])[_0xf575('0xf')](function(_0x4cd52d){_0x26a821=_0x4cd52d;logger['info'](_0xf575('0x41'),_0x4cd52d[_0xf575('0x3e')][_0xf575('0x29')]);if(!reportStatusStrategies[_0x4cd52d[_0xf575('0x3e')][_0xf575('0x29')]]){logger[_0xf575('0x11')](_0xf575('0x41'),_0x4cd52d['dataValues'][_0xf575('0x29')]);_0x509f9a[_0xf575('0x8')]();}reportStatusStrategies[_0x4cd52d[_0xf575('0x3e')][_0xf575('0x29')]]({'operation':_0x509f9a,'currentAttempt':_0x122180,'retryOptions':_0x5f2620,'job':_0x284fb6,'data':_0x26a821,'entity':_0x4cd52d});});}catch(_0x7a8808){_0x509f9a[_0xf575('0x8')](_0x7a8808);}});}function handleResult(_0x2106f5){return function(_0x44e5b9){if(_0x2106f5[_0xf575('0x42')]&&_0x2106f5[_0xf575('0x12')]&&_0x2106f5[_0xf575('0x12')][_0xf575('0x17')]&&!_['isNil'](_0x2106f5['email'])){retryer(_0x2106f5,_0x44e5b9);}};}function handleJob(_0x1f9066){return function(){try{if(_[_0xf575('0x43')](_0x1f9066[_0xf575('0x1b')])){return logger[_0xf575('0x2d')](_0xf575('0x44'));}if(_[_0xf575('0x43')](_0x1f9066[_0xf575('0x1c')])){return logger[_0xf575('0x2d')](_0xf575('0x45'));}var _0x3a95ca={'startDate':moment()['subtract'](_0x1f9066['subtractNumber'],_0x1f9066[_0xf575('0x1c')])[_0xf575('0x14')](_0xf575('0x46')),'endDate':moment()['format'](_0xf575('0x46')),'type':_0xf575('0x47'),'output':_0x1f9066[_0xf575('0x48')],'name':_0x1f9066['name']};if(!_['isNil'](_0x1f9066[_0xf575('0x49')])){logger['info'](_0xf575('0x4a'),_0x1f9066[_0xf575('0x49')]);return analyticDefaultReportController[_0xf575('0x4b')]({'id':_0x1f9066[_0xf575('0x49')]},_0x3a95ca)[_0xf575('0xf')](handleResult(_0x1f9066))['catch'](handleError());}if(!_['isNil'](_0x1f9066[_0xf575('0x4c')])){logger[_0xf575('0x2d')](_0xf575('0x4d'),_0x1f9066[_0xf575('0x4c')]);return analyticCustomReportController[_0xf575('0x4b')]({'id':_0x1f9066['CustomReportId']},_0x3a95ca)[_0xf575('0xf')](handleResult(_0x1f9066))[_0xf575('0x10')](handleError());}}catch(_0x4e62b7){logger[_0xf575('0x11')](JSON[_0xf575('0x28')](_0x4e62b7));}return logger[_0xf575('0x2d')](_0xf575('0x4e'));};}function getJobs(_0x1386d7){var _0x28c7d5={};if(_0x1386d7){_0x28c7d5['id']=_0x1386d7;}return db[_0xf575('0x4f')][_0xf575('0x50')]({'where':_0x28c7d5,'include':[{'model':db[_0xf575('0x12')],'attributes':['id','name',_0xf575('0x16')],'include':[{'model':db[_0xf575('0x51')],'as':_0xf575('0x17'),'include':[{'model':db['CloudProvider'],'as':_0xf575('0x52')}]}]}]})[_0xf575('0xf')](function(_0x9980f6){var _0x219b18=_['keys'](manager[_0xf575('0x53')]);var _0x1df474=_[_0xf575('0x54')](_0x9980f6,function(_0xc6d95c){return _0xc6d95c['id']['toString']();});var _0x13e04d=_[_0xf575('0x55')](_0x9980f6,function(_0x13d262){return _0x13d262['id'][_0xf575('0x56')]();});var _0x512632=_0x1386d7?_0x1df474:_[_0xf575('0x57')](_0x1df474,_0x219b18);var _0x4bfdea=_[_0xf575('0x58')](_0x1df474,_0x219b18);var _0x58c0f1=_['difference'](_0x219b18,_0x1df474);var _0x4f9a8e;var _0x248082;for(_0x4f9a8e=0x0;_0x4f9a8e<_0x58c0f1[_0xf575('0x59')]&&!_0x1386d7;_0x4f9a8e+=0x1){_0x248082=_0x58c0f1[_0x4f9a8e][_0xf575('0x56')]();if(manager[_0xf575('0x5a')](_0x248082)){manager[_0xf575('0x38')](_0x248082);manager[_0xf575('0x5b')](_0x248082);logger['info'](_0xf575('0x5c'),_0x248082);}}logger[_0xf575('0x2d')](_0xf575('0x5d'),JSON[_0xf575('0x28')](_0x512632));for(_0x4f9a8e=0x0;_0x4f9a8e<_0x512632[_0xf575('0x59')];_0x4f9a8e+=0x1){_0x248082=_0x512632[_0x4f9a8e][_0xf575('0x56')]();if(_0x1386d7){logger[_0xf575('0x2d')](JSON['stringify'](_0x13e04d[_0x248082]));BPromise[_0xf575('0x5e')]()[_0xf575('0xf')](handleJob(_0x13e04d[_0x248082]));logger[_0xf575('0x2d')](_0xf575('0x5f'),_0x13e04d[_0x248082][_0xf575('0x15')],_0x13e04d[_0x248082]['cron']);}else if(_0x13e04d[_0x248082]['cron']&&_0x13e04d[_0x248082][_0xf575('0x60')]&&moment()[_0xf575('0x61')](_0x13e04d[_0x248082][_0xf575('0x62')],_0x13e04d[_0x248082][_0xf575('0x63')])){manager[_0xf575('0x64')](_0x248082,_0x13e04d[_0x248082][_0xf575('0x65')],handleJob(_0x13e04d[_0x248082]));manager[_0xf575('0x66')](_0x248082);logger[_0xf575('0x2d')]('add\x20cron',_0x13e04d[_0x248082][_0xf575('0x15')],_0x13e04d[_0x248082][_0xf575('0x65')]);}else if(manager[_0xf575('0x5a')](_0x248082)){manager[_0xf575('0x38')](_0x248082);manager['deleteJob'](_0x248082);logger['info']('stop\x20cron',_0x13e04d[_0x248082][_0xf575('0x15')],_0x13e04d[_0x248082][_0xf575('0x65')]);}}for(_0x4f9a8e=0x0,_0x248082;_0x4f9a8e<_0x4bfdea[_0xf575('0x59')]&&!_0x1386d7;_0x4f9a8e+=0x1){_0x248082=_0x4bfdea[_0x4f9a8e]['toString']();if(manager['exists'](_0x248082)){if(_0x13e04d[_0x248082][_0xf575('0x65')]&&_0x13e04d[_0x248082][_0xf575('0x60')]&&moment()[_0xf575('0x61')](_0x13e04d[_0x248082][_0xf575('0x62')],_0x13e04d[_0x248082][_0xf575('0x63')])){manager[_0xf575('0x67')](_0x248082,_0x13e04d[_0x248082][_0xf575('0x65')],handleJob(_0x13e04d[_0x248082]));logger['info'](_0xf575('0x68'),_0x13e04d[_0x248082][_0xf575('0x15')],_0x13e04d[_0x248082][_0xf575('0x65')]);}else{manager[_0xf575('0x38')](_0x248082);manager[_0xf575('0x5b')](_0x248082);logger[_0xf575('0x2d')](_0xf575('0x69'),_0x13e04d[_0x248082][_0xf575('0x15')],_0x13e04d[_0x248082][_0xf575('0x65')]);}}}})[_0xf575('0x10')](function(_0x4d4ab6){logger[_0xf575('0x11')](JSON[_0xf575('0x28')](_0x4d4ab6));});}exports[_0xf575('0x6a')]=function(_0x235ceb){return getJobs(_0x235ceb);};exports[_0xf575('0x66')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4e09=['scheduled','output','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','delete\x20cron','cron','active','isBetween','startAt','endAt','start','add\x20cron','exists','deleteJob','stop\x20cron','length','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','../../files/reports','%s.%s','basename','savename','extname','zip','join','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','error\x20mail','case\x20loading','currentAttempt','retryOptions','retries','data','operation','stop','still\x20loading','case\x20completed','case\x20empty','job','Unrecognized\x20status:','entity','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','dataValues','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x336526,_0x36b7f0){var _0x209f8d=function(_0xd266ac){while(--_0xd266ac){_0x336526['push'](_0x336526['shift']());}};_0x209f8d(++_0x36b7f0);}(_0x4e09,0x1c1));var _0x94e0=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4e09[_0x2c91e9];return _0x13f0ff;};'use strict';var fs=require('fs');var util=require(_0x94e0('0x0'));var path=require(_0x94e0('0x1'));var _=require(_0x94e0('0x2'));var moment=require('moment');var CronJobManager=require(_0x94e0('0x3'));var jayson=require(_0x94e0('0x4'));var BPromise=require(_0x94e0('0x5'));var logger=require(_0x94e0('0x6'))(_0x94e0('0x7'));var db=require(_0x94e0('0x8'))['db'];const retry=require(_0x94e0('0x9'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x94e0('0xa'));var client=jayson[_0x94e0('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x2e9166){const _0x2cddbc={};if(typeof _0x2e9166===_0x94e0('0xc')){_0x2cddbc['id']=_0x2e9166;}return db[_0x94e0('0xd')][_0x94e0('0xe')]({'where':_0x2cddbc})[_0x94e0('0xf')](function(_0x20a48f){return _0x20a48f;})[_0x94e0('0x10')](function(_0x333d3e){logger[_0x94e0('0x11')](_0x333d3e);});}function handleSendEmail(_0x1cfef8,_0x49d008){logger[_0x94e0('0x12')](_0x94e0('0x13'),_0x1cfef8[_0x94e0('0x14')]);var _0x4fd42a=!![];var _0x4d3b0b=_0x1cfef8[_0x94e0('0x15')][_0x94e0('0x16')]();var _0x7f7d1f={'account':_0x4d3b0b,'message':{'from':util[_0x94e0('0x17')](_0x94e0('0x18'),_0x1cfef8[_0x94e0('0x15')][_0x94e0('0x19')],_0x1cfef8[_0x94e0('0x15')][_0x94e0('0x14')]||_0x1cfef8[_0x94e0('0x15')][_0x94e0('0x1a')]['user']),'to':_0x1cfef8[_0x94e0('0x14')],'cc':_0x1cfef8['cc'],'bcc':_0x1cfef8[_0x94e0('0x1b')],'subject':util[_0x94e0('0x17')](_0x94e0('0x1c'),_0x49d008[_0x94e0('0x19')],_0x1cfef8[_0x94e0('0x1d')],_0x1cfef8['subtractUnit'])}};var _0x81f5eb=path['join'](__dirname,_0x94e0('0x1e'));var _0x4693e7=_0x49d008['savename'];var _0x278dff=util['format'](_0x94e0('0x1f'),path[_0x94e0('0x20')](_0x49d008[_0x94e0('0x21')],path[_0x94e0('0x22')](_0x49d008[_0x94e0('0x21')])),_0x94e0('0x23'));var _0x43b61c=path[_0x94e0('0x24')](_0x81f5eb,_0x4693e7);var _0xe9c1cc=path['join'](_0x81f5eb,_0x278dff);if(fs[_0x94e0('0x25')](_0x43b61c)){_0x49d008[_0x94e0('0x26')]=_0x94e0('0x27');_0x7f7d1f[_0x94e0('0x28')]['attachments']=[{'filename':_0x4693e7,'path':_0x43b61c}];_0x7f7d1f[_0x94e0('0x28')][_0x94e0('0x29')]=util['format'](_0x94e0('0x2a'),JSON[_0x94e0('0x2b')](_0x49d008,null,0x2));}else if(fs['existsSync'](_0xe9c1cc)){_0x49d008['status']=_0x94e0('0x27');_0x7f7d1f[_0x94e0('0x28')]['attachments']=[{'filename':_0x278dff,'path':_0xe9c1cc}];}else{if(_0x49d008[_0x94e0('0x26')]===_0x94e0('0x2c')){_0x7f7d1f['message'][_0x94e0('0x29')]=_0x94e0('0x2d');if(!_0x1cfef8[_0x94e0('0x2e')]){_0x4fd42a=![];logger[_0x94e0('0x12')](_0x94e0('0x2f'));}}else if(_0x49d008['status']==='Loading'){_0x7f7d1f['message'][_0x94e0('0x29')]='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x49d008[_0x94e0('0x26')]==='Completed'){_0x7f7d1f['message'][_0x94e0('0x29')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x49d008[_0x94e0('0x26')]==='Failed'){_0x7f7d1f[_0x94e0('0x28')]['text']=_0x94e0('0x30');}else{logger[_0x94e0('0x11')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x49d008[_0x94e0('0x26')]);}}if(_0x4fd42a){return client[_0x94e0('0x31')](_0x94e0('0x32'),_0x7f7d1f)[_0x94e0('0xf')](function(_0x69a662){if(_0x69a662[_0x94e0('0x11')]){return logger[_0x94e0('0x11')](_0x94e0('0x33'),JSON[_0x94e0('0x2b')](_0x69a662));}return logger[_0x94e0('0x12')]('email\x20sent');})[_0x94e0('0x10')](function(_0x41e392){return logger['error'](_0x94e0('0x33'),JSON[_0x94e0('0x2b')](_0x41e392));});}}function handleError(){return function(_0x588f32){return logger[_0x94e0('0x11')](JSON[_0x94e0('0x2b')](_0x588f32));};}function loading(_0x287a75){logger[_0x94e0('0x12')](_0x94e0('0x34'));if(_0x287a75[_0x94e0('0x35')]===_0x287a75[_0x94e0('0x36')][_0x94e0('0x37')]){handleSendEmail(_0x287a75['job'],_0x287a75[_0x94e0('0x38')]);_0x287a75[_0x94e0('0x39')][_0x94e0('0x3a')]();}else{_0x287a75[_0x94e0('0x39')]['retry'](_0x94e0('0x3b'));}}function completed(_0x3b279e){logger[_0x94e0('0x12')](_0x94e0('0x3c'));handleSendEmail(_0x3b279e['job'],_0x3b279e[_0x94e0('0x38')]);_0x3b279e[_0x94e0('0x39')][_0x94e0('0x3a')]();}function empty(_0x38b2dc){logger['info'](_0x94e0('0x3d'));handleSendEmail(_0x38b2dc[_0x94e0('0x3e')],_0x38b2dc[_0x94e0('0x38')]);_0x38b2dc[_0x94e0('0x39')]['stop']();}function failed(_0x31650b){logger['info']('case\x20failed');handleSendEmail(_0x31650b['job'],_0x31650b[_0x94e0('0x38')]);_0x31650b[_0x94e0('0x39')][_0x94e0('0x3a')]();}function urecognized(_0x1d5b05){logger[_0x94e0('0x11')](_0x94e0('0x3f'),_0x1d5b05[_0x94e0('0x40')]['dataValues'][_0x94e0('0x26')]);_0x1d5b05['operation'][_0x94e0('0x3a')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0xf13a9b,_0x45feb0){const _0x2c8576={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x54fcee=retry[_0x94e0('0x39')](_0x2c8576);_0x54fcee[_0x94e0('0x41')](_0x1fcd94=>{logger[_0x94e0('0x12')](_0x94e0('0x42')+_0xf13a9b['id']+_0x94e0('0x43')+_0x1fcd94);try{getReportData(_0x45feb0['id'])['then'](function(_0x11dae5){_0x45feb0=_0x11dae5;logger[_0x94e0('0x12')]('report\x20status:',_0x11dae5['dataValues'][_0x94e0('0x26')]);if(!reportStatusStrategies[_0x11dae5['dataValues'][_0x94e0('0x26')]]){logger[_0x94e0('0x11')](_0x94e0('0x44'),_0x11dae5[_0x94e0('0x45')]['status']);_0x54fcee[_0x94e0('0x9')]();}reportStatusStrategies[_0x11dae5[_0x94e0('0x45')][_0x94e0('0x26')]]({'operation':_0x54fcee,'currentAttempt':_0x1fcd94,'retryOptions':_0x2c8576,'job':_0xf13a9b,'data':_0x45feb0,'entity':_0x11dae5});});}catch(_0x3cc579){_0x54fcee[_0x94e0('0x9')](_0x3cc579);}});}function handleResult(_0x625953){return function(_0x2cbab3){if(_0x625953[_0x94e0('0x46')]&&_0x625953[_0x94e0('0x15')]&&_0x625953['MailAccount'][_0x94e0('0x1a')]&&!_[_0x94e0('0x47')](_0x625953[_0x94e0('0x14')])){retryer(_0x625953,_0x2cbab3);}};}function handleJob(_0x355839){return function(){try{if(_[_0x94e0('0x47')](_0x355839[_0x94e0('0x1d')])){return logger['info'](_0x94e0('0x48'));}if(_['isNil'](_0x355839[_0x94e0('0x49')])){return logger[_0x94e0('0x12')](_0x94e0('0x4a'));}var _0x5ec790={'startDate':moment()['subtract'](_0x355839[_0x94e0('0x1d')],_0x355839[_0x94e0('0x49')])[_0x94e0('0x17')](_0x94e0('0x4b')),'endDate':moment()[_0x94e0('0x17')](_0x94e0('0x4b')),'type':_0x94e0('0x4c'),'output':_0x355839[_0x94e0('0x4d')],'name':_0x355839[_0x94e0('0x19')]};if(!_[_0x94e0('0x47')](_0x355839[_0x94e0('0x4e')])){logger[_0x94e0('0x12')]('exec\x20defaul\x20report\x20id:%s',_0x355839[_0x94e0('0x4e')]);return analyticDefaultReportController[_0x94e0('0x4f')]({'id':_0x355839[_0x94e0('0x4e')]},_0x5ec790)['then'](handleResult(_0x355839))[_0x94e0('0x10')](handleError());}if(!_[_0x94e0('0x47')](_0x355839[_0x94e0('0x50')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x355839['CustomReportId']);return analyticCustomReportController[_0x94e0('0x4f')]({'id':_0x355839[_0x94e0('0x50')]},_0x5ec790)[_0x94e0('0xf')](handleResult(_0x355839))[_0x94e0('0x10')](handleError());}}catch(_0x2029b7){logger['error'](JSON['stringify'](_0x2029b7));}return logger[_0x94e0('0x12')](_0x94e0('0x51'));};}function getJobs(_0xa6e9b6){var _0x345920={};if(_0xa6e9b6){_0x345920['id']=_0xa6e9b6;}return db['Schedule'][_0x94e0('0x52')]({'where':_0x345920,'include':[{'model':db['MailAccount'],'attributes':['id',_0x94e0('0x19'),_0x94e0('0x14')],'include':[{'model':db[_0x94e0('0x53')],'as':_0x94e0('0x1a'),'include':[{'model':db['CloudProvider'],'as':_0x94e0('0x54')}]}]}]})[_0x94e0('0xf')](function(_0x23dcc6){var _0x2962d8=_[_0x94e0('0x55')](manager[_0x94e0('0x56')]);var _0x28bb75=_[_0x94e0('0x57')](_0x23dcc6,function(_0x20626b){return _0x20626b['id'][_0x94e0('0x58')]();});var _0x1898df=_[_0x94e0('0x59')](_0x23dcc6,function(_0x512bab){return _0x512bab['id'][_0x94e0('0x58')]();});var _0x133b4a=_0xa6e9b6?_0x28bb75:_[_0x94e0('0x5a')](_0x28bb75,_0x2962d8);var _0x13c5f4=_[_0x94e0('0x5b')](_0x28bb75,_0x2962d8);var _0x13d505=_['difference'](_0x2962d8,_0x28bb75);var _0x410dac;var _0x271db1;for(_0x410dac=0x0;_0x410dac<_0x13d505['length']&&!_0xa6e9b6;_0x410dac+=0x1){_0x271db1=_0x13d505[_0x410dac][_0x94e0('0x58')]();if(manager['exists'](_0x271db1)){manager['stop'](_0x271db1);manager['deleteJob'](_0x271db1);logger[_0x94e0('0x12')](_0x94e0('0x5c'),_0x271db1);}}logger[_0x94e0('0x12')]('toRun',JSON[_0x94e0('0x2b')](_0x133b4a));for(_0x410dac=0x0;_0x410dac<_0x133b4a['length'];_0x410dac+=0x1){_0x271db1=_0x133b4a[_0x410dac][_0x94e0('0x58')]();if(_0xa6e9b6){logger[_0x94e0('0x12')](JSON[_0x94e0('0x2b')](_0x1898df[_0x271db1]));BPromise['resolve']()[_0x94e0('0xf')](handleJob(_0x1898df[_0x271db1]));logger['info']('run\x20job',_0x1898df[_0x271db1][_0x94e0('0x19')],_0x1898df[_0x271db1][_0x94e0('0x5d')]);}else if(_0x1898df[_0x271db1][_0x94e0('0x5d')]&&_0x1898df[_0x271db1][_0x94e0('0x5e')]&&moment()[_0x94e0('0x5f')](_0x1898df[_0x271db1][_0x94e0('0x60')],_0x1898df[_0x271db1][_0x94e0('0x61')])){manager['add'](_0x271db1,_0x1898df[_0x271db1][_0x94e0('0x5d')],handleJob(_0x1898df[_0x271db1]));manager[_0x94e0('0x62')](_0x271db1);logger[_0x94e0('0x12')](_0x94e0('0x63'),_0x1898df[_0x271db1]['name'],_0x1898df[_0x271db1][_0x94e0('0x5d')]);}else if(manager[_0x94e0('0x64')](_0x271db1)){manager[_0x94e0('0x3a')](_0x271db1);manager[_0x94e0('0x65')](_0x271db1);logger[_0x94e0('0x12')](_0x94e0('0x66'),_0x1898df[_0x271db1][_0x94e0('0x19')],_0x1898df[_0x271db1][_0x94e0('0x5d')]);}}for(_0x410dac=0x0,_0x271db1;_0x410dac<_0x13c5f4[_0x94e0('0x67')]&&!_0xa6e9b6;_0x410dac+=0x1){_0x271db1=_0x13c5f4[_0x410dac][_0x94e0('0x58')]();if(manager[_0x94e0('0x64')](_0x271db1)){if(_0x1898df[_0x271db1][_0x94e0('0x5d')]&&_0x1898df[_0x271db1][_0x94e0('0x5e')]&&moment()['isBetween'](_0x1898df[_0x271db1]['startAt'],_0x1898df[_0x271db1][_0x94e0('0x61')])){manager['update'](_0x271db1,_0x1898df[_0x271db1][_0x94e0('0x5d')],handleJob(_0x1898df[_0x271db1]));logger[_0x94e0('0x12')]('update\x20cron',_0x1898df[_0x271db1][_0x94e0('0x19')],_0x1898df[_0x271db1]['cron']);}else{manager[_0x94e0('0x3a')](_0x271db1);manager[_0x94e0('0x65')](_0x271db1);logger[_0x94e0('0x12')]('stop\x20cron',_0x1898df[_0x271db1][_0x94e0('0x19')],_0x1898df[_0x271db1][_0x94e0('0x5d')]);}}}})[_0x94e0('0x10')](function(_0x4a5394){logger['error'](JSON[_0x94e0('0x2b')](_0x4a5394));});}exports[_0x94e0('0x68')]=function(_0x2e530e){return getJobs(_0x2e530e);};exports[_0x94e0('0x62')]=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 b971852..6f4e2e3 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 _0x19c3=['Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','resolve','Cloud\x20Provider\x20not\x20configured','Neutral','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','SequelizeValidationError','start','lodash','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket'];(function(_0x887c1f,_0x57b1c3){var _0x5b44b7=function(_0x443c83){while(--_0x443c83){_0x887c1f['push'](_0x887c1f['shift']());}};_0x5b44b7(++_0x57b1c3);}(_0x19c3,0xf9));var _0x319c=function(_0x22a6e0,_0x3e5be9){_0x22a6e0=_0x22a6e0-0x0;var _0x1ab0f8=_0x19c3[_0x22a6e0];return _0x1ab0f8;};var _=require(_0x319c('0x0'));var AWS=require('aws-sdk');var rp=require(_0x319c('0x1'));var util=require(_0x319c('0x2'));var BPromise=require('bluebird');var db=require(_0x319c('0x3'))['db'];var logger=require(_0x319c('0x4'))(_0x319c('0x5'));function getTranscriptionJob(_0x350517,_0x3a96b1,_0x290261,_0x4c35fe){return new Promise(function(_0x20f77e,_0x53a1de){var _0x2e38c4=new AWS[(_0x319c('0x6'))]({'accessKeyId':_0x3a96b1,'secretAccessKey':_0x350517,'region':_0x290261});_0x2e38c4[_0x319c('0x7')]({'TranscriptionJobName':_0x4c35fe},function(_0x306a4b,_0x3662ed){if(_0x306a4b){return _0x53a1de(_0x306a4b);}else{return _0x20f77e(_0x3662ed);}});});}function sentiment(_0x57e6c8,_0x160d2a,_0x1b7ffd,_0x3491c3,_0x462c4c){return new Promise(function(_0x475438,_0x3cb3ff){var _0x4911e3=new AWS[(_0x319c('0x8'))]({'accessKeyId':_0x160d2a,'secretAccessKey':_0x57e6c8,'region':_0x1b7ffd});_0x4911e3['detectSentiment']({'Text':_0x3491c3,'LanguageCode':_0x462c4c[_0x319c('0x9')](0x0,0x2)},function(_0x151ab5,_0x3adb44){if(_0x151ab5){return _0x3cb3ff(_0x151ab5);}else{return _0x475438(_0x3adb44);}});});}function checkTranscribeJob(_0x3c995c,_0x362f44,_0x3be537){var _0x401fdb;return new BPromise(function(_0x4b67ba,_0x494ec0){logger[_0x319c('0xa')](util[_0x319c('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3c995c['id'],_0x3c995c[_0x319c('0xc')]));return getTranscriptionJob(_0x3be537[_0x319c('0xd')],_0x3be537[_0x319c('0xe')],_0x362f44[_0x319c('0xf')],_0x3c995c[_0x319c('0xc')])[_0x319c('0x10')](function(_0x29b26c){logger['info'](util['format'](_0x319c('0x11'),_0x3c995c['id'],_0x3c995c[_0x319c('0xc')],_0x29b26c['TranscriptionJob'][_0x319c('0x12')]));if(!_0x3c995c['fileText']){switch(_0x29b26c[_0x319c('0x13')][_0x319c('0x12')]){case _0x319c('0x14'):var _0x347081={'transcribeStatus':_0x29b26c[_0x319c('0x13')][_0x319c('0x12')],'fileUri':_0x29b26c[_0x319c('0x13')]['Transcript'][_0x319c('0x15')]};logger[_0x319c('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x3c995c['id']));return rp({'uri':_0x29b26c[_0x319c('0x13')][_0x319c('0x16')][_0x319c('0x15')],'json':!![]})['then'](function(_0x3bc070){logger[_0x319c('0xa')](util[_0x319c('0xb')](_0x319c('0x17'),_0x3c995c['id']));if(_0x3bc070&&_0x3bc070[_0x319c('0x18')]&&_0x3bc070['results'][_0x319c('0x19')]&&_0x3bc070[_0x319c('0x18')][_0x319c('0x19')][_0x319c('0x1a')]){_0x347081[_0x319c('0x1b')]='';for(var _0x4a8ee8=0x0;_0x4a8ee8<_0x3bc070[_0x319c('0x18')]['transcripts'][_0x319c('0x1a')];_0x4a8ee8++){_0x347081[_0x319c('0x1b')]+=_0x3bc070['results'][_0x319c('0x19')][_0x4a8ee8]['transcript']+'';}}return _0x3c995c[_0x319c('0x1c')](_0x347081);})[_0x319c('0x10')](function(){logger[_0x319c('0xa')](util[_0x319c('0xb')](_0x319c('0x1d'),_0x3c995c['id']));if(!_0x3c995c[_0x319c('0x1e')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x21'));}if(!_0x362f44[_0x319c('0x22')]||!_0x362f44[_0x319c('0x23')]||!_0x362f44[_0x319c('0x24')]||!_0x362f44[_0x319c('0x25')]||!_0x362f44[_0x319c('0x26')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x27'));}if(!_0x347081[_0x319c('0x1b')]){throw new Error(_0x319c('0x28'));}if(_0x362f44['sentimentAccountId']===_0x3be537['id']){return _0x3be537;}else{return db[_0x319c('0x29')][_0x319c('0x2a')]({'where':{'id':_settings[_0x319c('0x23')]}});}})[_0x319c('0x10')](function(_0x570940){if(!_0x570940){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x2b'));}if(!_0x570940['data1']||!_0x570940[_0x319c('0xe')]){throw new db['Sequelize'][(_0x319c('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x401fdb=_0x570940;logger[_0x319c('0xa')](util[_0x319c('0xb')](_0x319c('0x2c'),_0x3c995c['id']));return sentiment(_0x401fdb['data1'],_0x401fdb[_0x319c('0xe')],_0x362f44[_0x319c('0x24')],_0x347081['fileText'],_0x362f44[_0x319c('0x25')]);})[_0x319c('0x10')](function(_0x2ed8c1){logger[_0x319c('0xa')](util[_0x319c('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3c995c['id']));return _0x3c995c[_0x319c('0x1c')]({'sentiment':_0x2ed8c1[_0x319c('0x2d')],'sPositive':_0x2ed8c1[_0x319c('0x2e')][_0x319c('0x2f')],'sNegative':_0x2ed8c1[_0x319c('0x2e')][_0x319c('0x30')],'sMixed':_0x2ed8c1[_0x319c('0x2e')][_0x319c('0x31')],'sNeutral':_0x2ed8c1[_0x319c('0x2e')]['Neutral']});})[_0x319c('0x10')](function(){logger[_0x319c('0xa')](util[_0x319c('0xb')](_0x319c('0x1d'),_0x3c995c['id']));_0x4b67ba();});case'FAILED':return _0x3c995c[_0x319c('0x1c')]({'transcribeStatus':_0x319c('0x32'),'failureReason':_0x29b26c[_0x319c('0x13')][_0x319c('0x33')]})[_0x319c('0x10')](function(){logger[_0x319c('0xa')](util['format'](_0x319c('0x1d'),_0x3c995c['id']));_0x4b67ba();});default:logger[_0x319c('0xa')](util[_0x319c('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3c995c['id']));break;}}else{return BPromise[_0x319c('0x34')]()[_0x319c('0x10')](function(){if(!_0x3c995c[_0x319c('0x1e')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x21'));}if(!_0x362f44[_0x319c('0x22')]||!_0x362f44[_0x319c('0x23')]||!_0x362f44[_0x319c('0x24')]||!_0x362f44[_0x319c('0x25')]||!_0x362f44['bucket']){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x27'));}if(!_0x3c995c[_0x319c('0x1b')]){throw new Error(_0x319c('0x28'));}if(_0x362f44['sentimentAccountId']===_0x3be537['id']){return _0x3be537;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x319c('0x23')]}});}})[_0x319c('0x10')](function(_0x43c527){if(!_0x43c527){throw new db['Sequelize'][(_0x319c('0x20'))](_0x319c('0x2b'));}if(!_0x43c527[_0x319c('0xd')]||!_0x43c527[_0x319c('0xe')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x35'));}_0x401fdb=_0x43c527;logger[_0x319c('0xa')](util['format'](_0x319c('0x2c'),_0x3c995c['id']));return sentiment(_0x401fdb[_0x319c('0xd')],_0x401fdb['data2'],_0x362f44[_0x319c('0x24')],_0x3c995c[_0x319c('0x1b')],_0x362f44[_0x319c('0x25')]);})[_0x319c('0x10')](function(_0x2ae778){logger[_0x319c('0xa')](util[_0x319c('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3c995c['id']));return _0x3c995c[_0x319c('0x1c')]({'sentiment':_0x2ae778[_0x319c('0x2d')],'sPositive':_0x2ae778[_0x319c('0x2e')][_0x319c('0x2f')],'sNegative':_0x2ae778['SentimentScore'][_0x319c('0x30')],'sMixed':_0x2ae778[_0x319c('0x2e')][_0x319c('0x31')],'sNeutral':_0x2ae778['SentimentScore'][_0x319c('0x36')],'transcribeStatus':'COMPLETED'});})[_0x319c('0x10')](function(){logger['info'](util[_0x319c('0xb')](_0x319c('0x1d'),_0x3c995c['id']));_0x4b67ba();});}})[_0x319c('0x37')](function(_0x39a10){if(_0x39a10){if(!_0x39a10[_0x319c('0x38')]||_0x39a10[_0x319c('0x38')]!=='SequelizeValidationError'){logger[_0x319c('0x39')](util[_0x319c('0xb')](_0x319c('0x3a'),_0x3c995c['id']),util[_0x319c('0x3b')](_0x39a10,{'showHidden':![],'depth':null}));}}_0x4b67ba();});});}function checkTranscribe(){var _0x201906;var _0x1a3491;var _0x57308b;return db[_0x319c('0x3c')][_0x319c('0x3d')]({'where':{'transcribeStatus':_0x319c('0x3e')}})['then'](function(_0x3502e6){if(!_0x3502e6||!_0x3502e6[_0x319c('0x1a')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x3f'));}_0x201906=_0x3502e6;return db[_0x319c('0x40')][_0x319c('0x2a')]({'where':{'id':0x1}});})[_0x319c('0x10')](function(_0x14cbdc){if(!_0x14cbdc){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x41'));}_0x1a3491=_0x14cbdc;if(!_0x1a3491[_0x319c('0x5')]||!_0x1a3491['transcribeAccountId']||!_0x1a3491[_0x319c('0xf')]||!_0x1a3491[_0x319c('0x25')]||!_0x1a3491[_0x319c('0x26')]){throw new db['Sequelize'][(_0x319c('0x20'))](_0x319c('0x42'));}return db[_0x319c('0x29')][_0x319c('0x2a')]({'where':{'id':_0x1a3491[_0x319c('0x43')]}});})['then'](function(_0x112b2f){if(!_0x112b2f){throw new db['Sequelize'][(_0x319c('0x20'))](_0x319c('0x2b'));}if(!_0x112b2f[_0x319c('0xd')]||!_0x112b2f[_0x319c('0xe')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x57308b=_0x112b2f;var _0x1b1a78=[];_0x201906[_0x319c('0x44')](function(_0x46fce7){_0x1b1a78[_0x319c('0x45')](checkTranscribeJob(_0x46fce7,_0x1a3491,_0x57308b));});return BPromise['all'](_0x1b1a78);})[_0x319c('0x37')](function(_0xe063f9){if(_0xe063f9){if(!_0xe063f9[_0x319c('0x38')]||_0xe063f9[_0x319c('0x38')]!==_0x319c('0x46')){logger[_0x319c('0x39')](util['inspect'](_0xe063f9,{'showHidden':![],'depth':null}));}}});}exports[_0x319c('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x4d5a=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment','Negative','Neutral','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','forEach','push','all','inspect','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4d5a[_0x397e5f];return _0x5302b8;};var _=require('lodash');var AWS=require(_0xa4d5('0x0'));var rp=require(_0xa4d5('0x1'));var util=require(_0xa4d5('0x2'));var BPromise=require('bluebird');var db=require(_0xa4d5('0x3'))['db'];var logger=require(_0xa4d5('0x4'))(_0xa4d5('0x5'));function getTranscriptionJob(_0x384fb0,_0x512629,_0x30a0d8,_0x56769c){return new Promise(function(_0x5e25a5,_0x32d194){var _0x1856aa=new AWS[(_0xa4d5('0x6'))]({'accessKeyId':_0x512629,'secretAccessKey':_0x384fb0,'region':_0x30a0d8});_0x1856aa[_0xa4d5('0x7')]({'TranscriptionJobName':_0x56769c},function(_0x408db0,_0x3bed6b){if(_0x408db0){return _0x32d194(_0x408db0);}else{return _0x5e25a5(_0x3bed6b);}});});}function sentiment(_0x155e4d,_0x5a5da1,_0x5586de,_0x22eb1f,_0x3600ea){return new Promise(function(_0x8e0171,_0x25bfeb){var _0x22dd6f=new AWS[(_0xa4d5('0x8'))]({'accessKeyId':_0x5a5da1,'secretAccessKey':_0x155e4d,'region':_0x5586de});_0x22dd6f[_0xa4d5('0x9')]({'Text':_0x22eb1f,'LanguageCode':_0x3600ea[_0xa4d5('0xa')](0x0,0x2)},function(_0x59b0b7,_0x54e1c7){if(_0x59b0b7){return _0x25bfeb(_0x59b0b7);}else{return _0x8e0171(_0x54e1c7);}});});}function checkTranscribeJob(_0x100182,_0x17a587,_0x1384d3){var _0x22df52;return new BPromise(function(_0x5db9ab,_0x5b3965){logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0xd'),_0x100182['id'],_0x100182[_0xa4d5('0xe')]));return getTranscriptionJob(_0x1384d3[_0xa4d5('0xf')],_0x1384d3[_0xa4d5('0x10')],_0x17a587['transcribeRegion'],_0x100182['transcribeName'])[_0xa4d5('0x11')](function(_0x138112){logger['info'](util[_0xa4d5('0xc')](_0xa4d5('0x12'),_0x100182['id'],_0x100182[_0xa4d5('0xe')],_0x138112[_0xa4d5('0x13')][_0xa4d5('0x14')]));if(!_0x100182[_0xa4d5('0x15')]){switch(_0x138112['TranscriptionJob'][_0xa4d5('0x14')]){case'COMPLETED':var _0x59b63f={'transcribeStatus':_0x138112[_0xa4d5('0x13')]['TranscriptionJobStatus'],'fileUri':_0x138112[_0xa4d5('0x13')][_0xa4d5('0x16')][_0xa4d5('0x17')]};logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x18'),_0x100182['id']));return rp({'uri':_0x138112['TranscriptionJob'][_0xa4d5('0x16')][_0xa4d5('0x17')],'json':!![]})[_0xa4d5('0x11')](function(_0x519d3f){logger['info'](util['format'](_0xa4d5('0x19'),_0x100182['id']));if(_0x519d3f&&_0x519d3f[_0xa4d5('0x1a')]&&_0x519d3f['results']['transcripts']&&_0x519d3f[_0xa4d5('0x1a')][_0xa4d5('0x1b')][_0xa4d5('0x1c')]){_0x59b63f[_0xa4d5('0x15')]='';for(var _0x3edb76=0x0;_0x3edb76<_0x519d3f[_0xa4d5('0x1a')][_0xa4d5('0x1b')]['length'];_0x3edb76++){_0x59b63f['fileText']+=_0x519d3f['results'][_0xa4d5('0x1b')][_0x3edb76][_0xa4d5('0x1d')]+'';}}return _0x100182[_0xa4d5('0x1e')](_0x59b63f);})[_0xa4d5('0x11')](function(){logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x1f'),_0x100182['id']));if(!_0x100182[_0xa4d5('0x20')]){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x23'));}if(!_0x17a587[_0xa4d5('0x24')]||!_0x17a587[_0xa4d5('0x25')]||!_0x17a587[_0xa4d5('0x26')]||!_0x17a587[_0xa4d5('0x27')]||!_0x17a587[_0xa4d5('0x28')]){throw new db['Sequelize'][(_0xa4d5('0x22'))](_0xa4d5('0x29'));}if(!_0x59b63f['fileText']){throw new Error(_0xa4d5('0x2a'));}if(_0x17a587[_0xa4d5('0x25')]===_0x1384d3['id']){return _0x1384d3;}else{return db[_0xa4d5('0x2b')][_0xa4d5('0x2c')]({'where':{'id':_settings[_0xa4d5('0x25')]}});}})[_0xa4d5('0x11')](function(_0xfc080a){if(!_0xfc080a){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x2d'));}if(!_0xfc080a['data1']||!_0xfc080a['data2']){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x2e'));}_0x22df52=_0xfc080a;logger[_0xa4d5('0xb')](util['format'](_0xa4d5('0x2f'),_0x100182['id']));return sentiment(_0x22df52['data1'],_0x22df52[_0xa4d5('0x10')],_0x17a587[_0xa4d5('0x26')],_0x59b63f[_0xa4d5('0x15')],_0x17a587[_0xa4d5('0x27')]);})[_0xa4d5('0x11')](function(_0x39b331){logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x30'),_0x100182['id']));return _0x100182[_0xa4d5('0x1e')]({'sentiment':_0x39b331['Sentiment'],'sPositive':_0x39b331[_0xa4d5('0x31')][_0xa4d5('0x32')],'sNegative':_0x39b331[_0xa4d5('0x31')]['Negative'],'sMixed':_0x39b331['SentimentScore'][_0xa4d5('0x33')],'sNeutral':_0x39b331[_0xa4d5('0x31')]['Neutral']});})[_0xa4d5('0x11')](function(){logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x100182['id']));_0x5db9ab();});case _0xa4d5('0x34'):return _0x100182['update']({'transcribeStatus':_0xa4d5('0x34'),'failureReason':_0x138112['TranscriptionJob'][_0xa4d5('0x35')]})[_0xa4d5('0x11')](function(){logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x1f'),_0x100182['id']));_0x5db9ab();});default:logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x36'),_0x100182['id']));break;}}else{return BPromise['resolve']()[_0xa4d5('0x11')](function(){if(!_0x100182[_0xa4d5('0x20')]){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x23'));}if(!_0x17a587['sentiment']||!_0x17a587['sentimentAccountId']||!_0x17a587['sentimentRegion']||!_0x17a587[_0xa4d5('0x27')]||!_0x17a587[_0xa4d5('0x28')]){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x29'));}if(!_0x100182[_0xa4d5('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x17a587['sentimentAccountId']===_0x1384d3['id']){return _0x1384d3;}else{return db['CloudProvider'][_0xa4d5('0x2c')]({'where':{'id':_settings[_0xa4d5('0x25')]}});}})[_0xa4d5('0x11')](function(_0x343cfe){if(!_0x343cfe){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x2d'));}if(!_0x343cfe['data1']||!_0x343cfe['data2']){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x2e'));}_0x22df52=_0x343cfe;logger[_0xa4d5('0xb')](util[_0xa4d5('0xc')](_0xa4d5('0x2f'),_0x100182['id']));return sentiment(_0x22df52[_0xa4d5('0xf')],_0x22df52[_0xa4d5('0x10')],_0x17a587[_0xa4d5('0x26')],_0x100182['fileText'],_0x17a587[_0xa4d5('0x27')]);})[_0xa4d5('0x11')](function(_0x1aa857){logger[_0xa4d5('0xb')](util['format'](_0xa4d5('0x30'),_0x100182['id']));return _0x100182[_0xa4d5('0x1e')]({'sentiment':_0x1aa857[_0xa4d5('0x37')],'sPositive':_0x1aa857[_0xa4d5('0x31')][_0xa4d5('0x32')],'sNegative':_0x1aa857[_0xa4d5('0x31')][_0xa4d5('0x38')],'sMixed':_0x1aa857[_0xa4d5('0x31')][_0xa4d5('0x33')],'sNeutral':_0x1aa857[_0xa4d5('0x31')][_0xa4d5('0x39')],'transcribeStatus':_0xa4d5('0x3a')});})[_0xa4d5('0x11')](function(){logger[_0xa4d5('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x100182['id']));_0x5db9ab();});}})[_0xa4d5('0x3b')](function(_0x392ab6){if(_0x392ab6){if(!_0x392ab6[_0xa4d5('0x3c')]||_0x392ab6[_0xa4d5('0x3c')]!==_0xa4d5('0x3d')){logger[_0xa4d5('0x3e')](util['format'](_0xa4d5('0x3f'),_0x100182['id']),util['inspect'](_0x392ab6,{'showHidden':![],'depth':null}));}}_0x5db9ab();});});}function checkTranscribe(){var _0x5deccd;var _0x51cf6e;var _0x2afc25;return db['VoiceRecording'][_0xa4d5('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x1efa4a){if(!_0x1efa4a||!_0x1efa4a[_0xa4d5('0x1c')]){throw new db[(_0xa4d5('0x21'))]['ValidationError'](_0xa4d5('0x41'));}_0x5deccd=_0x1efa4a;return db[_0xa4d5('0x42')][_0xa4d5('0x2c')]({'where':{'id':0x1}});})['then'](function(_0x2ff4ff){if(!_0x2ff4ff){throw new db[(_0xa4d5('0x21'))]['ValidationError'](_0xa4d5('0x43'));}_0x51cf6e=_0x2ff4ff;if(!_0x51cf6e[_0xa4d5('0x5')]||!_0x51cf6e[_0xa4d5('0x44')]||!_0x51cf6e[_0xa4d5('0x45')]||!_0x51cf6e[_0xa4d5('0x27')]||!_0x51cf6e[_0xa4d5('0x28')]){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xa4d5('0x2c')]({'where':{'id':_0x51cf6e[_0xa4d5('0x44')]}});})[_0xa4d5('0x11')](function(_0x5e9af7){if(!_0x5e9af7){throw new db[(_0xa4d5('0x21'))][(_0xa4d5('0x22'))](_0xa4d5('0x2d'));}if(!_0x5e9af7[_0xa4d5('0xf')]||!_0x5e9af7['data2']){throw new db['Sequelize'][(_0xa4d5('0x22'))](_0xa4d5('0x2e'));}_0x2afc25=_0x5e9af7;var _0x2201fa=[];_0x5deccd[_0xa4d5('0x46')](function(_0x33de2b){_0x2201fa[_0xa4d5('0x47')](checkTranscribeJob(_0x33de2b,_0x51cf6e,_0x2afc25));});return BPromise[_0xa4d5('0x48')](_0x2201fa);})['catch'](function(_0x2c819b){if(_0x2c819b){if(!_0x2c819b[_0xa4d5('0x3c')]||_0x2c819b[_0xa4d5('0x3c')]!=='SequelizeValidationError'){logger[_0xa4d5('0x3e')](util[_0xa4d5('0x49')](_0x2c819b,{'showHidden':![],'depth':null}));}}});}exports[_0xa4d5('0x4a')]=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 d55bd4f..178e183 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 _0xcfa5=['schedule','redis','defaults','localhost','WhatsappInteraction','findAll','subtract','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment'];(function(_0x58e8b4,_0x18bd81){var _0x469fe0=function(_0xce8700){while(--_0xce8700){_0x58e8b4['push'](_0x58e8b4['shift']());}};_0x469fe0(++_0x18bd81);}(_0xcfa5,0xbb));var _0x5cfa=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcfa5[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x5cfa('0x0'));var moment=require(_0x5cfa('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x5cfa('0x2'));config[_0x5cfa('0x3')]=_[_0x5cfa('0x4')](config[_0x5cfa('0x3')],{'host':_0x5cfa('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5cfa('0x3')]));function closeInteractions(){var _0x4c2f83=[];return db[_0x5cfa('0x6')][_0x5cfa('0x7')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5cfa('0x8')](0x18,'hours')}}})[_0x5cfa('0x9')](function(_0x2455a7){if(_0x2455a7&&_0x2455a7['length']){_0x4c2f83=_[_0x5cfa('0xa')](_0x2455a7||[],'id');logger[_0x5cfa('0xb')](_0x5cfa('0xc'),_0x4c2f83[_0x5cfa('0xd')]());return db['WhatsappInteraction'][_0x5cfa('0xe')]({'closeReason':_0x5cfa('0xf'),'disposition':_0x5cfa('0x10'),'closed':!![],'closedAt':moment()[_0x5cfa('0x11')](_0x5cfa('0x12'))},{'where':{'id':_0x4c2f83}});}})['then'](function(){if(_0x4c2f83&&_0x4c2f83[_0x5cfa('0x13')]){logger[_0x5cfa('0xb')](_0x5cfa('0x14'),_0x4c2f83['join']());for(var _0x546260=0x0;_0x546260<_0x4c2f83['length'];_0x546260++){io['emit'](_0x5cfa('0x15'),{'id':_0x4c2f83[_0x546260],'closed':!![]});}}})[_0x5cfa('0x16')](function(_0x22ff2e){logger[_0x5cfa('0x17')](_0x5cfa('0x18'),_0x22ff2e?util[_0x5cfa('0x19')](_0x22ff2e,{'showHidden':![],'depth':null}):'');});}exports[_0x5cfa('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9330=['schedule','redis','defaults','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','start','lodash','moment','util','../../mysqldb','../logger'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9330,0xd3));var _0x0933=function(_0x24d299,_0x44d1da){_0x24d299=_0x24d299-0x0;var _0x2a11be=_0x9330[_0x24d299];return _0x2a11be;};'use strict';var _=require(_0x0933('0x0'));var moment=require(_0x0933('0x1'));var Redis=require('ioredis');var util=require(_0x0933('0x2'));var config=require('../../config/environment');var db=require(_0x0933('0x3'))['db'];var logger=require(_0x0933('0x4'))(_0x0933('0x5'));config[_0x0933('0x6')]=_[_0x0933('0x7')](config[_0x0933('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x4ad0a0=[];return db[_0x0933('0x8')][_0x0933('0x9')]({'raw':!![],'attributes':['id',_0x0933('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0933('0xb')](0x18,_0x0933('0xc'))}}})[_0x0933('0xd')](function(_0x5c7468){if(_0x5c7468&&_0x5c7468['length']){_0x4ad0a0=_['map'](_0x5c7468||[],'id');logger[_0x0933('0xe')](_0x0933('0xf'),_0x4ad0a0[_0x0933('0x10')]());return db[_0x0933('0x8')]['update']({'closeReason':_0x0933('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x0933('0x12')](_0x0933('0x13'))},{'where':{'id':_0x4ad0a0}});}})[_0x0933('0xd')](function(){if(_0x4ad0a0&&_0x4ad0a0[_0x0933('0x14')]){logger[_0x0933('0xe')](_0x0933('0x15'),_0x4ad0a0[_0x0933('0x10')]());for(var _0x53f15a=0x0;_0x53f15a<_0x4ad0a0[_0x0933('0x14')];_0x53f15a++){io[_0x0933('0x16')](_0x0933('0x17'),{'id':_0x4ad0a0[_0x53f15a],'closed':!![]});}}})[_0x0933('0x18')](function(_0x37735c){logger[_0x0933('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x37735c?util['inspect'](_0x37735c,{'showHidden':![],'depth':null}):'');});}exports[_0x0933('0x1a')]=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 fb8f3bf..1dcc20a 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb694=['catch','../mysqldb','push','Biondo','now','Innocenzo','innocenzo.biondo','@xcally.com','CmContact','destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2'];(function(_0x484d2e,_0x3e93ec){var _0x3ee308=function(_0x17633d){while(--_0x17633d){_0x484d2e['push'](_0x484d2e['shift']());}};_0x3ee308(++_0x3e93ec);}(_0xb694,0x1c3));var _0x4b69=function(_0xfc9e49,_0x3346b6){_0xfc9e49=_0xfc9e49-0x0;var _0x483d68=_0xb694[_0xfc9e49];return _0x483d68;};'use strict';var util=require('util');var db=require(_0x4b69('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4b69('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4b69('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4b69('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x4b69('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4b69('0x3')](),'updatedAt':Date[_0x4b69('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4b69('0x1')]({'id':i,'firstName':_0x4b69('0x4')+i,'lastName':_0x4b69('0x2')+i,'phone':0xf879fb460+i,'email':_0x4b69('0x5')+i+_0x4b69('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x4b69('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4b69('0x3')](),'updatedAt':Date[_0x4b69('0x3')]()});}db[_0x4b69('0x7')][_0x4b69('0x8')]({'where':{}})[_0x4b69('0x9')](function(){return db[_0x4b69('0x7')][_0x4b69('0xa')](contacts);})[_0x4b69('0x9')](function(){console[_0x4b69('0xb')]('finished\x20populating',_0x4b69('0xc'));return db[_0x4b69('0xd')][_0x4b69('0x8')]({'where':{}});})[_0x4b69('0x9')](function(){return db[_0x4b69('0xd')][_0x4b69('0xa')](hopper);})[_0x4b69('0x9')](function(){console[_0x4b69('0xb')](_0x4b69('0xe'),_0x4b69('0xf'));return db[_0x4b69('0x7')]['bulkCreate'](contacts2);})[_0x4b69('0x9')](function(){console[_0x4b69('0xb')]('finished\x20populating',_0x4b69('0x10'));return db[_0x4b69('0xd')][_0x4b69('0xa')](hopper2);})[_0x4b69('0x9')](function(){console[_0x4b69('0xb')](_0x4b69('0xe'),'hopper2');})[_0x4b69('0x11')](function(_0xbb2c37){console[_0x4b69('0xb')](_0xbb2c37);}); \ No newline at end of file +var _0xbfe5=['CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now'];(function(_0x58e87d,_0x48b3fa){var _0x3d276c=function(_0x431b91){while(--_0x431b91){_0x58e87d['push'](_0x58e87d['shift']());}};_0x3d276c(++_0x48b3fa);}(_0xbfe5,0x102));var _0x5bfe=function(_0x3fe49a,_0x4985df){_0x3fe49a=_0x3fe49a-0x0;var _0x1b87da=_0xbfe5[_0x3fe49a];return _0x1b87da;};'use strict';var util=require(_0x5bfe('0x0'));var db=require(_0x5bfe('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5bfe('0x2')]({'id':i,'firstName':_0x5bfe('0x3')+i,'lastName':_0x5bfe('0x4')+i,'phone':0xf879fb460+i,'email':_0x5bfe('0x5')+i+_0x5bfe('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5bfe('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5bfe('0x7')](),'updatedAt':Date[_0x5bfe('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x5bfe('0x4')+i,'phone':0xf879fb460+i,'email':_0x5bfe('0x5')+i+_0x5bfe('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x5bfe('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5bfe('0x7')](),'updatedAt':Date[_0x5bfe('0x7')]()});}db[_0x5bfe('0x8')][_0x5bfe('0x9')]({'where':{}})['then'](function(){return db[_0x5bfe('0x8')][_0x5bfe('0xa')](contacts);})[_0x5bfe('0xb')](function(){console[_0x5bfe('0xc')](_0x5bfe('0xd'),_0x5bfe('0xe'));return db[_0x5bfe('0xf')][_0x5bfe('0x9')]({'where':{}});})[_0x5bfe('0xb')](function(){return db['CmHopper'][_0x5bfe('0xa')](hopper);})[_0x5bfe('0xb')](function(){console[_0x5bfe('0xc')](_0x5bfe('0xd'),_0x5bfe('0x10'));return db[_0x5bfe('0x8')][_0x5bfe('0xa')](contacts2);})['then'](function(){console[_0x5bfe('0xc')](_0x5bfe('0xd'),'contacts2');return db[_0x5bfe('0xf')][_0x5bfe('0xa')](hopper2);})[_0x5bfe('0xb')](function(){console[_0x5bfe('0xc')]('finished\x20populating',_0x5bfe('0x11'));})[_0x5bfe('0x12')](function(_0x2f1538){console[_0x5bfe('0xc')](_0x2f1538);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e838a75..18f1793 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9da=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','udp','wss'];(function(_0x10c879,_0x503a81){var _0x4cfe75=function(_0x30627f){while(--_0x30627f){_0x10c879['push'](_0x10c879['shift']());}};_0x4cfe75(++_0x503a81);}(_0xd9da,0xe7));var _0xad9d=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xd9da[_0x1caf6a];return _0x1bf493;};'use strict';var util=require(_0xad9d('0x0'));var db=require(_0xad9d('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xad9d('0x2')](_0xad9d('0x3'),_0xad9d('0x4'),i),'fullname':util[_0xad9d('0x2')](_0xad9d('0x3'),_0xad9d('0x4'),i),'email':util[_0xad9d('0x2')](_0xad9d('0x5'),_0xad9d('0x4'),i),'role':_0xad9d('0x4'),'password':_0xad9d('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xad9d('0x7'),'ws',_0xad9d('0x8')],'disallow':[_0xad9d('0x9')],'allow':[_0xad9d('0xa')],'defaultuser':util[_0xad9d('0x2')](_0xad9d('0x3'),_0xad9d('0x4'),i),'encryption':_0xad9d('0xb'),'avpf':_0xad9d('0xb'),'force_avp':_0xad9d('0xb'),'icesupport':_0xad9d('0xb'),'dtlsenable':_0xad9d('0xb'),'dtlsverify':'no','dtlscertfile':_0xad9d('0xc'),'dtlsprivatekey':_0xad9d('0xd'),'dtlssetup':_0xad9d('0xe'),'callerid':util[_0xad9d('0x2')](_0xad9d('0xf'),util[_0xad9d('0x2')](_0xad9d('0x3'),'agent',i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0xad9d('0x10')](function(){console[_0xad9d('0x11')](_0xad9d('0x12'));})[_0xad9d('0x13')](function(_0x4d333e){console[_0xad9d('0x11')](_0x4d333e);}); \ No newline at end of file +var _0x342c=['%s%s','agent','format','password','friend','udp','ulaw','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util','../mysqldb','push'];(function(_0x4bdb2e,_0x53ae98){var _0x372646=function(_0x23b355){while(--_0x23b355){_0x4bdb2e['push'](_0x4bdb2e['shift']());}};_0x372646(++_0x53ae98);}(_0x342c,0x9f));var _0xc342=function(_0x15c160,_0x5ce836){_0x15c160=_0x15c160-0x0;var _0x151c5c=_0x342c[_0x15c160];return _0x151c5c;};'use strict';var util=require(_0xc342('0x0'));var db=require(_0xc342('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xc342('0x2')]({'name':util['format'](_0xc342('0x3'),_0xc342('0x4'),i),'fullname':util['format'](_0xc342('0x3'),_0xc342('0x4'),i),'email':util[_0xc342('0x5')]('%s%s@xcally.com',_0xc342('0x4'),i),'role':_0xc342('0x4'),'password':_0xc342('0x6'),'internal':0xfa0+i,'type':_0xc342('0x7'),'transport':[_0xc342('0x8'),'ws','wss'],'disallow':['all'],'allow':[_0xc342('0x9')],'defaultuser':util[_0xc342('0x5')](_0xc342('0x3'),_0xc342('0x4'),i),'encryption':_0xc342('0xa'),'avpf':_0xc342('0xa'),'force_avp':_0xc342('0xa'),'icesupport':_0xc342('0xa'),'dtlsenable':_0xc342('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xc342('0xb'),'dtlssetup':'actpass','callerid':util[_0xc342('0x5')](_0xc342('0xc'),util[_0xc342('0x5')](_0xc342('0x3'),'agent',i),0xfa0+i)});}db[_0xc342('0xd')][_0xc342('0xe')](users)[_0xc342('0xf')](function(){console[_0xc342('0x10')]('add\x20user');})[_0xc342('0x11')](function(_0x35da24){console[_0xc342('0x10')](_0x35da24);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d668a94..b101d49 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd290=['%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteractions','FaxInteractions','OpenchannelInteraction','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','VoiceQueues','FaxQueues','WhatsappQueue','Telephones','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','chat','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','map','removeMailInteractions','user_has_mail_interactions:remove','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','WhatsappInteractions','catch','log','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','Agents','User','name','role','agent','telephone','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','then','resourceId','where','Campaign','type','format'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xd290,0x165));var _0x0d29=function(_0x5c1af9,_0x43e2f4){_0x5c1af9=_0x5c1af9-0x0;var _0x222b1f=_0xd290[_0x5c1af9];return _0x222b1f;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var BPromise=require('bluebird');var db=require(_0x0d29('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x0d29('0x3'),'model':db[_0x0d29('0x4')],'attributes':['id',_0x0d29('0x5'),_0x0d29('0x6')],'raw':!![],'where':{'role':_0x0d29('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x0d29('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0d29('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x0d29('0x5')],'where':{'role':_0x0d29('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0d29('0x5'),'type'],'where':{'type':_0x0d29('0x9')}};function getAssociatedResources(_0x3c7b70,_0xbc7500,_0x4b876e){return db[_0x0d29('0xa')][_0x0d29('0xb')]({'where':{'name':_0x3c7b70,'userProfileId':_0xbc7500},'raw':!![]})['then'](function(_0x3b5660){if(_0x3b5660){if(_0x3b5660[_0x0d29('0xc')]){switch(_0x3c7b70){case'VoiceQueues':case _0x0d29('0xd'):case'FaxQueues':case _0x0d29('0xe'):case _0x0d29('0xf'):case _0x0d29('0x10'):case _0x0d29('0x11'):return db[_0x4b876e][_0x0d29('0x12')](queryQueues);case'Telephones':return db[_0x4b876e][_0x0d29('0x12')](queryTelephones);case _0x0d29('0x13'):return db[_0x4b876e][_0x0d29('0x12')](queryTrunks);case _0x0d29('0x14'):return db[_0x4b876e][_0x0d29('0x12')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x3b5660['id']},'raw':!![]})[_0x0d29('0x15')](function(_0x4acfd6){if(_0x4acfd6){var _0x44fe29={'where':{'id':_['map'](_0x4acfd6,_0x0d29('0x16'))},'raw':!![]};switch(_0x4b876e){case _0x0d29('0x4'):_0x44fe29[_0x0d29('0x17')][_0x0d29('0x6')]=_0x0d29('0x8');break;case _0x0d29('0x18'):_0x44fe29['where'][_0x0d29('0x19')]=_0x0d29('0x9');break;}return db[_0x4b876e][_0x0d29('0x12')](_0x44fe29);}else{return[];}});}}else{return[];}})[_0x0d29('0x15')](function(_0xd3ccf3){return _0xd3ccf3;});}function joinOrLeaveQueues(_0x244351,_0x37dbc5,_0x5c6607,_0x39722d){_0x244351[_0x37dbc5](util[_0x0d29('0x1a')](_0x0d29('0x1b'),_0x5c6607,_0x39722d[_0x0d29('0x5')]));if(_0x39722d[_0x0d29('0x3')]){for(var _0x20b278=0x0;_0x20b278<_0x39722d[_0x0d29('0x3')][_0x0d29('0x1c')];_0x20b278+=0x1){_0x244351[_0x37dbc5](util[_0x0d29('0x1a')](_0x0d29('0x1d'),_0x39722d[_0x0d29('0x3')][_0x20b278][_0x0d29('0x5')]));}}}function joinOrLeave(_0xb9fffc,_0x5856df,_0x30e109){var _0x1b78b7;if(_0xb9fffc[_0x0d29('0x1e')][_0x0d29('0x1f')]['id']){db['User'][_0x0d29('0x20')]({'attributes':['id',_0x0d29('0x5'),_0x0d29('0x6'),_0x0d29('0x21')],'where':{'id':_0xb9fffc[_0x0d29('0x1e')][_0x0d29('0x1f')]['id']},'include':[{'model':db[_0x0d29('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x0d29('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x0d29('0x24'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0d29('0x25')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0d29('0x26')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x0d29('0x15')](function(_0x2f7202){if(_0x2f7202){_0x1b78b7=_0x2f7202;_0xb9fffc[_0x5856df](util['format'](_0x0d29('0x1d'),_0x2f7202[_0x0d29('0x5')]));var _0x362ad9=[];switch(_0x2f7202['role']){case _0x0d29('0x27'):_0xb9fffc[_0x5856df](_0x0d29('0x28'));_0xb9fffc[_0x5856df](_0x0d29('0x29'));if(queryQueues[_0x0d29('0x2a')](_0x0d29('0x2b'))){delete queryQueues[_0x0d29('0x2b')];}_0x362ad9[_0x0d29('0x2c')](db[_0x0d29('0x2d')][_0x0d29('0x12')](queryQueues));_0x362ad9[_0x0d29('0x2c')](db['ChatQueue'][_0x0d29('0x12')](queryQueues));_0x362ad9[_0x0d29('0x2c')](db[_0x0d29('0x2e')][_0x0d29('0x12')](queryQueues));_0x362ad9[_0x0d29('0x2c')](db[_0x0d29('0x2f')]['findAll'](queryQueues));_0x362ad9[_0x0d29('0x2c')](db[_0x0d29('0x30')][_0x0d29('0x12')](queryQueues));_0x362ad9[_0x0d29('0x2c')](db[_0x0d29('0x31')][_0x0d29('0x12')](queryQueues));_0x362ad9[_0x0d29('0x2c')](db['WhatsappQueue'][_0x0d29('0x12')](queryQueues));_0x362ad9[_0x0d29('0x2c')](db[_0x0d29('0x4')][_0x0d29('0x12')](queryTelephones));_0x362ad9[_0x0d29('0x2c')](db[_0x0d29('0x32')]['findAll'](queryTrunks));_0x362ad9[_0x0d29('0x2c')](db['Campaign'][_0x0d29('0x12')](queryCampaigns));_0x362ad9[_0x0d29('0x2c')](db[_0x0d29('0x4')][_0x0d29('0x12')](queryAgents));break;case _0x0d29('0x33'):_0xb9fffc[_0x5856df]('voice:inbound');_0xb9fffc[_0x5856df](_0x0d29('0x29'));_0x362ad9[_0x0d29('0x2c')](getAssociatedResources(_0x0d29('0x34'),_0x2f7202['userProfileId'],_0x0d29('0x2d')));_0x362ad9[_0x0d29('0x2c')](getAssociatedResources(_0x0d29('0xd'),_0x2f7202['userProfileId'],'ChatQueue'));_0x362ad9[_0x0d29('0x2c')](getAssociatedResources(_0x0d29('0x35'),_0x2f7202[_0x0d29('0x21')],_0x0d29('0x2e')));_0x362ad9['push'](getAssociatedResources(_0x0d29('0xe'),_0x2f7202[_0x0d29('0x21')],_0x0d29('0x2f')));_0x362ad9['push'](getAssociatedResources('MailQueues',_0x2f7202['userProfileId'],'MailQueue'));_0x362ad9[_0x0d29('0x2c')](getAssociatedResources(_0x0d29('0x10'),_0x2f7202['userProfileId'],_0x0d29('0x31')));_0x362ad9[_0x0d29('0x2c')](getAssociatedResources(_0x0d29('0x11'),_0x2f7202[_0x0d29('0x21')],_0x0d29('0x36')));_0x362ad9[_0x0d29('0x2c')](getAssociatedResources(_0x0d29('0x37'),_0x2f7202[_0x0d29('0x21')],_0x0d29('0x4')));_0x362ad9['push'](getAssociatedResources(_0x0d29('0x13'),_0x2f7202['userProfileId'],_0x0d29('0x32')));_0x362ad9[_0x0d29('0x2c')](getAssociatedResources(_0x0d29('0x14'),_0x2f7202[_0x0d29('0x21')],_0x0d29('0x18')));_0x362ad9[_0x0d29('0x2c')](db[_0x0d29('0x4')][_0x0d29('0x12')](queryAgents));break;case _0x0d29('0x7'):_0xb9fffc[_0x5856df](_0x0d29('0x28'));_0xb9fffc[_0x5856df]('voice:outbound');_0x362ad9[_0x0d29('0x2c')](_0x2f7202['getVoiceQueues']({'attributes':['id','name']}));_0x362ad9[_0x0d29('0x2c')](_0x2f7202['getChatQueues']({'attributes':['id',_0x0d29('0x5')]}));_0x362ad9[_0x0d29('0x2c')](_0x2f7202[_0x0d29('0x38')]({'attributes':['id',_0x0d29('0x5')]}));_0x362ad9[_0x0d29('0x2c')](_0x2f7202[_0x0d29('0x39')]({'attributes':['id',_0x0d29('0x5')]}));_0x362ad9['push'](_0x2f7202[_0x0d29('0x3a')]({'attributes':['id','name']}));_0x362ad9[_0x0d29('0x2c')](_0x2f7202['getOpenchannelQueues']({'attributes':['id','name']}));_0x362ad9[_0x0d29('0x2c')](_0x2f7202[_0x0d29('0x3b')]({'attributes':['id',_0x0d29('0x5')]}));break;}return BPromise[_0x0d29('0x3c')](_0x362ad9);}})[_0x0d29('0x15')](function(_0x35a95b){if(_0x35a95b&&_0x35a95b['length']){for(var _0x1cdd60=0x0;_0x1cdd60<_0x35a95b['length'];_0x1cdd60+=0x1){for(var _0x51f2c4=0x0;_0x51f2c4<_0x35a95b[_0x1cdd60][_0x0d29('0x1c')];_0x51f2c4+=0x1){switch(_0x1cdd60){case 0x0:joinOrLeaveQueues(_0xb9fffc,_0x5856df,_0x0d29('0x3d'),_0x35a95b[_0x1cdd60][_0x51f2c4]);break;case 0x1:joinOrLeaveQueues(_0xb9fffc,_0x5856df,_0x0d29('0x3e'),_0x35a95b[_0x1cdd60][_0x51f2c4]);break;case 0x2:joinOrLeaveQueues(_0xb9fffc,_0x5856df,'fax',_0x35a95b[_0x1cdd60][_0x51f2c4]);break;case 0x3:joinOrLeaveQueues(_0xb9fffc,_0x5856df,'sms',_0x35a95b[_0x1cdd60][_0x51f2c4]);break;case 0x4:joinOrLeaveQueues(_0xb9fffc,_0x5856df,_0x0d29('0x3f'),_0x35a95b[_0x1cdd60][_0x51f2c4]);break;case 0x5:joinOrLeaveQueues(_0xb9fffc,_0x5856df,_0x0d29('0x40'),_0x35a95b[_0x1cdd60][_0x51f2c4]);break;case 0x6:joinOrLeaveQueues(_0xb9fffc,_0x5856df,_0x0d29('0x41'),_0x35a95b[_0x1cdd60][_0x51f2c4]);break;case 0x7:if(_0x1b78b7[_0x0d29('0x6')]!=='agent')_0xb9fffc[_0x5856df](util[_0x0d29('0x1a')](_0x0d29('0x42'),_0x35a95b[_0x1cdd60][_0x51f2c4]['name']));break;case 0x8:if(_0x1b78b7[_0x0d29('0x6')]!==_0x0d29('0x7'))_0xb9fffc[_0x5856df](util[_0x0d29('0x1a')](_0x0d29('0x43'),_0x35a95b[_0x1cdd60][_0x51f2c4]['name']));break;case 0x9:if(_0x1b78b7[_0x0d29('0x6')]!=='agent')_0xb9fffc[_0x5856df](util[_0x0d29('0x1a')](_0x0d29('0x44'),_0x35a95b[_0x1cdd60][_0x51f2c4][_0x0d29('0x19')],_0x35a95b[_0x1cdd60][_0x51f2c4][_0x0d29('0x5')]));break;case 0xa:_0xb9fffc[_0x5856df](util[_0x0d29('0x1a')](_0x0d29('0x1d'),_0x35a95b[_0x1cdd60][_0x51f2c4][_0x0d29('0x5')]));break;}}}}})[_0x0d29('0x15')](function(){if(_0x5856df===_0x0d29('0x45')){var _0x44847d=_['map'](_0x1b78b7[_0x0d29('0x46')],'id');return _0x1b78b7[_0x0d29('0x47')](_0x44847d)[_0x0d29('0x15')](function(){for(var _0xd2b30b=0x0;_0xd2b30b<_0x44847d['length'];_0xd2b30b+=0x1){_0x30e109['emit'](_0x0d29('0x48'),{'ChatInteractionId':Number(_0x44847d[_0xd2b30b]),'UserId':Number(_0x1b78b7['id'])});}});}})['then'](function(){if(_0x5856df==='leave'){var _0x2ad4e3=_[_0x0d29('0x49')](_0x1b78b7['MailInteractions'],'id');return _0x1b78b7[_0x0d29('0x4a')](_0x2ad4e3)[_0x0d29('0x15')](function(){for(var _0x5f4397=0x0;_0x5f4397<_0x2ad4e3[_0x0d29('0x1c')];_0x5f4397+=0x1){_0x30e109['emit'](_0x0d29('0x4b'),{'MailInteractionId':Number(_0x2ad4e3[_0x5f4397]),'UserId':Number(_0x1b78b7['id'])});}});}})[_0x0d29('0x15')](function(){if(_0x5856df==='leave'){var _0x3f28a2=_[_0x0d29('0x49')](_0x1b78b7[_0x0d29('0x24')],'id');return _0x1b78b7['removeFaxInteractions'](_0x3f28a2)[_0x0d29('0x15')](function(){for(var _0x5cb03f=0x0;_0x5cb03f<_0x3f28a2['length'];_0x5cb03f+=0x1){_0x30e109[_0x0d29('0x4c')](_0x0d29('0x4d'),{'FaxInteractionId':Number(_0x3f28a2[_0x5cb03f]),'UserId':Number(_0x1b78b7['id'])});}});}})[_0x0d29('0x15')](function(){if(_0x5856df==='leave'){var _0x1aadcf=_[_0x0d29('0x49')](_0x1b78b7['SmsInteractions'],'id');return _0x1b78b7[_0x0d29('0x4e')](_0x1aadcf)[_0x0d29('0x15')](function(){for(var _0x4691c7=0x0;_0x4691c7<_0x1aadcf['length'];_0x4691c7+=0x1){_0x30e109[_0x0d29('0x4c')](_0x0d29('0x4f'),{'SmsInteractionId':Number(_0x1aadcf[_0x4691c7]),'UserId':Number(_0x1b78b7['id'])});}});}})[_0x0d29('0x15')](function(){if(_0x5856df==='leave'){var _0x5f09d2=_[_0x0d29('0x49')](_0x1b78b7[_0x0d29('0x50')],'id');return _0x1b78b7['removeOpenchannelInteractions'](_0x5f09d2)[_0x0d29('0x15')](function(){for(var _0x499e6a=0x0;_0x499e6a<_0x5f09d2[_0x0d29('0x1c')];_0x499e6a+=0x1){_0x30e109[_0x0d29('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x5f09d2[_0x499e6a]),'UserId':Number(_0x1b78b7['id'])});}});}})[_0x0d29('0x15')](function(){if(_0x5856df===_0x0d29('0x45')){var _0x1ec7d2=_['map'](_0x1b78b7[_0x0d29('0x51')],'id');return _0x1b78b7['removeWhatsappInteractions'](_0x1ec7d2)[_0x0d29('0x15')](function(){for(var _0x31dbed=0x0;_0x31dbed<_0x1ec7d2[_0x0d29('0x1c')];_0x31dbed+=0x1){_0x30e109[_0x0d29('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1ec7d2[_0x31dbed]),'UserId':Number(_0x1b78b7['id'])});}});}})[_0x0d29('0x52')](function(_0x576dcb){_0xb9fffc[_0x0d29('0x53')](_0x576dcb);});}}function onDisconnect(_0x412f6c,_0x12caa5){joinOrLeave(_0x412f6c,_0x0d29('0x45'),_0x12caa5);}function onConnect(_0x58dd19){joinOrLeave(_0x58dd19,'join');}exports['default']=function(_0x5bc895){_0x5bc895['on'](_0x0d29('0x54'),function(_0x3e7f03){_0x3e7f03[_0x0d29('0x55')](0x0);_0x3e7f03[_0x0d29('0x56')]=_0x3e7f03[_0x0d29('0x57')][_0x0d29('0x54')][_0x0d29('0x58')]+':'+_0x3e7f03['request'][_0x0d29('0x54')][_0x0d29('0x59')];_0x3e7f03[_0x0d29('0x5a')]=new Date();_0x3e7f03['log']=function(_0x2362c9){console[_0x0d29('0x53')](_0x0d29('0x5b')+_0x3e7f03[_0x0d29('0x5c')][_0x0d29('0x5')]+'['+_0x3e7f03[_0x0d29('0x56')]+']',_0x2362c9);};_0x3e7f03['on'](_0x0d29('0x5d'),function(){onDisconnect(_0x3e7f03,_0x5bc895);_0x3e7f03['log'](_0x0d29('0x5e'));});onConnect(_0x3e7f03);_0x3e7f03['log'](_0x0d29('0x5f'));});}; \ No newline at end of file +var _0xc1dc=['campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','bluebird','./environment','Agents','User','role','agent','name','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','map','resourceId','where','Campaign','format','%s:queue:%s','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','FaxQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0xc1dc,0x84));var _0xcc1d=function(_0x540813,_0x1c8ff7){_0x540813=_0x540813-0x0;var _0x5dbe4d=_0xc1dc[_0x540813];return _0x5dbe4d;};'use strict';var _=require(_0xcc1d('0x0'));var util=require(_0xcc1d('0x1'));var BPromise=require(_0xcc1d('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xcc1d('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xcc1d('0x4'),'model':db[_0xcc1d('0x5')],'attributes':['id','name',_0xcc1d('0x6')],'raw':!![],'where':{'role':_0xcc1d('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xcc1d('0x8')],'where':{'role':_0xcc1d('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xcc1d('0x8')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xcc1d('0x8'),_0xcc1d('0xa')],'where':{'type':_0xcc1d('0xb')}};function getAssociatedResources(_0x3154cf,_0x16afac,_0x171592){return db['UserProfileSection'][_0xcc1d('0xc')]({'where':{'name':_0x3154cf,'userProfileId':_0x16afac},'raw':!![]})[_0xcc1d('0xd')](function(_0x2e0fa4){if(_0x2e0fa4){if(_0x2e0fa4[_0xcc1d('0xe')]){switch(_0x3154cf){case _0xcc1d('0xf'):case _0xcc1d('0x10'):case'FaxQueues':case _0xcc1d('0x11'):case _0xcc1d('0x12'):case'OpenchannelQueues':case _0xcc1d('0x13'):return db[_0x171592][_0xcc1d('0x14')](queryQueues);case _0xcc1d('0x15'):return db[_0x171592][_0xcc1d('0x14')](queryTelephones);case _0xcc1d('0x16'):return db[_0x171592][_0xcc1d('0x14')](queryTrunks);case _0xcc1d('0x17'):return db[_0x171592]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0xcc1d('0x14')]({'attributes':['resourceId'],'where':{'sectionId':_0x2e0fa4['id']},'raw':!![]})[_0xcc1d('0xd')](function(_0x452772){if(_0x452772){var _0x35f147={'where':{'id':_[_0xcc1d('0x18')](_0x452772,_0xcc1d('0x19'))},'raw':!![]};switch(_0x171592){case _0xcc1d('0x5'):_0x35f147[_0xcc1d('0x1a')][_0xcc1d('0x6')]=_0xcc1d('0x9');break;case _0xcc1d('0x1b'):_0x35f147['where']['type']=_0xcc1d('0xb');break;}return db[_0x171592]['findAll'](_0x35f147);}else{return[];}});}}else{return[];}})[_0xcc1d('0xd')](function(_0x44770d){return _0x44770d;});}function joinOrLeaveQueues(_0xf44327,_0x104c54,_0x17dd9b,_0xcc6350){_0xf44327[_0x104c54](util[_0xcc1d('0x1c')](_0xcc1d('0x1d'),_0x17dd9b,_0xcc6350[_0xcc1d('0x8')]));if(_0xcc6350['Agents']){for(var _0x23189c=0x0;_0x23189c<_0xcc6350['Agents'][_0xcc1d('0x1e')];_0x23189c+=0x1){_0xf44327[_0x104c54](util[_0xcc1d('0x1c')](_0xcc1d('0x1f'),_0xcc6350['Agents'][_0x23189c][_0xcc1d('0x8')]));}}}function joinOrLeave(_0x1b5502,_0x31a006,_0x451523){var _0xac9e86;if(_0x1b5502['handshake'][_0xcc1d('0x20')]['id']){db['User'][_0xcc1d('0x21')]({'attributes':['id',_0xcc1d('0x8'),_0xcc1d('0x6'),_0xcc1d('0x22')],'where':{'id':_0x1b5502[_0xcc1d('0x23')]['query']['id']},'include':[{'model':db[_0xcc1d('0x24')],'as':_0xcc1d('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xcc1d('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xcc1d('0x27')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xcc1d('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xcc1d('0x29')],'as':_0xcc1d('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xcc1d('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xcc1d('0xd')](function(_0x10f5d3){if(_0x10f5d3){_0xac9e86=_0x10f5d3;_0x1b5502[_0x31a006](util[_0xcc1d('0x1c')]('user:%s',_0x10f5d3[_0xcc1d('0x8')]));var _0x4c8b99=[];switch(_0x10f5d3[_0xcc1d('0x6')]){case _0xcc1d('0x2c'):_0x1b5502[_0x31a006](_0xcc1d('0x2d'));_0x1b5502[_0x31a006](_0xcc1d('0x2e'));if(queryQueues[_0xcc1d('0x2f')]('include')){delete queryQueues[_0xcc1d('0x30')];}_0x4c8b99[_0xcc1d('0x31')](db['VoiceQueue'][_0xcc1d('0x14')](queryQueues));_0x4c8b99['push'](db[_0xcc1d('0x32')]['findAll'](queryQueues));_0x4c8b99['push'](db[_0xcc1d('0x33')]['findAll'](queryQueues));_0x4c8b99[_0xcc1d('0x31')](db[_0xcc1d('0x34')][_0xcc1d('0x14')](queryQueues));_0x4c8b99[_0xcc1d('0x31')](db[_0xcc1d('0x35')][_0xcc1d('0x14')](queryQueues));_0x4c8b99['push'](db[_0xcc1d('0x36')]['findAll'](queryQueues));_0x4c8b99[_0xcc1d('0x31')](db[_0xcc1d('0x37')][_0xcc1d('0x14')](queryQueues));_0x4c8b99[_0xcc1d('0x31')](db['User'][_0xcc1d('0x14')](queryTelephones));_0x4c8b99[_0xcc1d('0x31')](db[_0xcc1d('0x38')][_0xcc1d('0x14')](queryTrunks));_0x4c8b99[_0xcc1d('0x31')](db[_0xcc1d('0x1b')][_0xcc1d('0x14')](queryCampaigns));_0x4c8b99[_0xcc1d('0x31')](db[_0xcc1d('0x5')][_0xcc1d('0x14')](queryAgents));break;case'user':_0x1b5502[_0x31a006]('voice:inbound');_0x1b5502[_0x31a006](_0xcc1d('0x2e'));_0x4c8b99[_0xcc1d('0x31')](getAssociatedResources('VoiceQueues',_0x10f5d3['userProfileId'],'VoiceQueue'));_0x4c8b99[_0xcc1d('0x31')](getAssociatedResources(_0xcc1d('0x10'),_0x10f5d3[_0xcc1d('0x22')],_0xcc1d('0x32')));_0x4c8b99[_0xcc1d('0x31')](getAssociatedResources(_0xcc1d('0x39'),_0x10f5d3[_0xcc1d('0x22')],'FaxQueue'));_0x4c8b99[_0xcc1d('0x31')](getAssociatedResources('SmsQueues',_0x10f5d3['userProfileId'],'SmsQueue'));_0x4c8b99[_0xcc1d('0x31')](getAssociatedResources(_0xcc1d('0x12'),_0x10f5d3['userProfileId'],'MailQueue'));_0x4c8b99[_0xcc1d('0x31')](getAssociatedResources('OpenchannelQueues',_0x10f5d3[_0xcc1d('0x22')],_0xcc1d('0x36')));_0x4c8b99[_0xcc1d('0x31')](getAssociatedResources('WhatsappQueues',_0x10f5d3[_0xcc1d('0x22')],_0xcc1d('0x37')));_0x4c8b99[_0xcc1d('0x31')](getAssociatedResources(_0xcc1d('0x15'),_0x10f5d3[_0xcc1d('0x22')],_0xcc1d('0x5')));_0x4c8b99[_0xcc1d('0x31')](getAssociatedResources('Trunks',_0x10f5d3[_0xcc1d('0x22')],'Trunk'));_0x4c8b99[_0xcc1d('0x31')](getAssociatedResources(_0xcc1d('0x17'),_0x10f5d3[_0xcc1d('0x22')],_0xcc1d('0x1b')));_0x4c8b99[_0xcc1d('0x31')](db[_0xcc1d('0x5')][_0xcc1d('0x14')](queryAgents));break;case _0xcc1d('0x7'):_0x1b5502[_0x31a006](_0xcc1d('0x2d'));_0x1b5502[_0x31a006](_0xcc1d('0x2e'));_0x4c8b99[_0xcc1d('0x31')](_0x10f5d3[_0xcc1d('0x3a')]({'attributes':['id','name']}));_0x4c8b99[_0xcc1d('0x31')](_0x10f5d3[_0xcc1d('0x3b')]({'attributes':['id',_0xcc1d('0x8')]}));_0x4c8b99[_0xcc1d('0x31')](_0x10f5d3[_0xcc1d('0x3c')]({'attributes':['id',_0xcc1d('0x8')]}));_0x4c8b99[_0xcc1d('0x31')](_0x10f5d3[_0xcc1d('0x3d')]({'attributes':['id',_0xcc1d('0x8')]}));_0x4c8b99[_0xcc1d('0x31')](_0x10f5d3[_0xcc1d('0x3e')]({'attributes':['id','name']}));_0x4c8b99[_0xcc1d('0x31')](_0x10f5d3[_0xcc1d('0x3f')]({'attributes':['id',_0xcc1d('0x8')]}));_0x4c8b99[_0xcc1d('0x31')](_0x10f5d3[_0xcc1d('0x40')]({'attributes':['id',_0xcc1d('0x8')]}));break;}return BPromise[_0xcc1d('0x41')](_0x4c8b99);}})[_0xcc1d('0xd')](function(_0x2f3031){if(_0x2f3031&&_0x2f3031[_0xcc1d('0x1e')]){for(var _0x24d167=0x0;_0x24d167<_0x2f3031[_0xcc1d('0x1e')];_0x24d167+=0x1){for(var _0x1f5c55=0x0;_0x1f5c55<_0x2f3031[_0x24d167][_0xcc1d('0x1e')];_0x1f5c55+=0x1){switch(_0x24d167){case 0x0:joinOrLeaveQueues(_0x1b5502,_0x31a006,_0xcc1d('0x42'),_0x2f3031[_0x24d167][_0x1f5c55]);break;case 0x1:joinOrLeaveQueues(_0x1b5502,_0x31a006,_0xcc1d('0x43'),_0x2f3031[_0x24d167][_0x1f5c55]);break;case 0x2:joinOrLeaveQueues(_0x1b5502,_0x31a006,_0xcc1d('0x44'),_0x2f3031[_0x24d167][_0x1f5c55]);break;case 0x3:joinOrLeaveQueues(_0x1b5502,_0x31a006,_0xcc1d('0x45'),_0x2f3031[_0x24d167][_0x1f5c55]);break;case 0x4:joinOrLeaveQueues(_0x1b5502,_0x31a006,_0xcc1d('0x46'),_0x2f3031[_0x24d167][_0x1f5c55]);break;case 0x5:joinOrLeaveQueues(_0x1b5502,_0x31a006,_0xcc1d('0x47'),_0x2f3031[_0x24d167][_0x1f5c55]);break;case 0x6:joinOrLeaveQueues(_0x1b5502,_0x31a006,'whatsapp',_0x2f3031[_0x24d167][_0x1f5c55]);break;case 0x7:if(_0xac9e86[_0xcc1d('0x6')]!=='agent')_0x1b5502[_0x31a006](util[_0xcc1d('0x1c')](_0xcc1d('0x48'),_0x2f3031[_0x24d167][_0x1f5c55]['name']));break;case 0x8:if(_0xac9e86['role']!==_0xcc1d('0x7'))_0x1b5502[_0x31a006](util[_0xcc1d('0x1c')](_0xcc1d('0x49'),_0x2f3031[_0x24d167][_0x1f5c55][_0xcc1d('0x8')]));break;case 0x9:if(_0xac9e86[_0xcc1d('0x6')]!==_0xcc1d('0x7'))_0x1b5502[_0x31a006](util['format'](_0xcc1d('0x4a'),_0x2f3031[_0x24d167][_0x1f5c55][_0xcc1d('0xa')],_0x2f3031[_0x24d167][_0x1f5c55]['name']));break;case 0xa:_0x1b5502[_0x31a006](util[_0xcc1d('0x1c')](_0xcc1d('0x1f'),_0x2f3031[_0x24d167][_0x1f5c55][_0xcc1d('0x8')]));break;}}}}})['then'](function(){if(_0x31a006===_0xcc1d('0x4b')){var _0xc31fda=_[_0xcc1d('0x18')](_0xac9e86['ChatInteractions'],'id');return _0xac9e86[_0xcc1d('0x4c')](_0xc31fda)[_0xcc1d('0xd')](function(){for(var _0x3ab4b4=0x0;_0x3ab4b4<_0xc31fda[_0xcc1d('0x1e')];_0x3ab4b4+=0x1){_0x451523[_0xcc1d('0x4d')](_0xcc1d('0x4e'),{'ChatInteractionId':Number(_0xc31fda[_0x3ab4b4]),'UserId':Number(_0xac9e86['id'])});}});}})[_0xcc1d('0xd')](function(){if(_0x31a006===_0xcc1d('0x4b')){var _0x518eed=_[_0xcc1d('0x18')](_0xac9e86[_0xcc1d('0x4f')],'id');return _0xac9e86['removeMailInteractions'](_0x518eed)[_0xcc1d('0xd')](function(){for(var _0x17a0a1=0x0;_0x17a0a1<_0x518eed[_0xcc1d('0x1e')];_0x17a0a1+=0x1){_0x451523[_0xcc1d('0x4d')](_0xcc1d('0x50'),{'MailInteractionId':Number(_0x518eed[_0x17a0a1]),'UserId':Number(_0xac9e86['id'])});}});}})[_0xcc1d('0xd')](function(){if(_0x31a006===_0xcc1d('0x4b')){var _0x688361=_[_0xcc1d('0x18')](_0xac9e86[_0xcc1d('0x51')],'id');return _0xac9e86[_0xcc1d('0x52')](_0x688361)[_0xcc1d('0xd')](function(){for(var _0x7bc2ec=0x0;_0x7bc2ec<_0x688361[_0xcc1d('0x1e')];_0x7bc2ec+=0x1){_0x451523[_0xcc1d('0x4d')](_0xcc1d('0x53'),{'FaxInteractionId':Number(_0x688361[_0x7bc2ec]),'UserId':Number(_0xac9e86['id'])});}});}})[_0xcc1d('0xd')](function(){if(_0x31a006===_0xcc1d('0x4b')){var _0x47ba98=_[_0xcc1d('0x18')](_0xac9e86['SmsInteractions'],'id');return _0xac9e86[_0xcc1d('0x54')](_0x47ba98)[_0xcc1d('0xd')](function(){for(var _0x4f0316=0x0;_0x4f0316<_0x47ba98[_0xcc1d('0x1e')];_0x4f0316+=0x1){_0x451523[_0xcc1d('0x4d')](_0xcc1d('0x55'),{'SmsInteractionId':Number(_0x47ba98[_0x4f0316]),'UserId':Number(_0xac9e86['id'])});}});}})['then'](function(){if(_0x31a006===_0xcc1d('0x4b')){var _0x5e3550=_[_0xcc1d('0x18')](_0xac9e86['OpenchannelInteractions'],'id');return _0xac9e86[_0xcc1d('0x56')](_0x5e3550)[_0xcc1d('0xd')](function(){for(var _0x3d340f=0x0;_0x3d340f<_0x5e3550[_0xcc1d('0x1e')];_0x3d340f+=0x1){_0x451523[_0xcc1d('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x5e3550[_0x3d340f]),'UserId':Number(_0xac9e86['id'])});}});}})['then'](function(){if(_0x31a006===_0xcc1d('0x4b')){var _0x3118e5=_[_0xcc1d('0x18')](_0xac9e86[_0xcc1d('0x57')],'id');return _0xac9e86[_0xcc1d('0x58')](_0x3118e5)[_0xcc1d('0xd')](function(){for(var _0x5ec46b=0x0;_0x5ec46b<_0x3118e5[_0xcc1d('0x1e')];_0x5ec46b+=0x1){_0x451523[_0xcc1d('0x4d')](_0xcc1d('0x59'),{'WhatsappInteractionId':Number(_0x3118e5[_0x5ec46b]),'UserId':Number(_0xac9e86['id'])});}});}})[_0xcc1d('0x5a')](function(_0x3471f4){_0x1b5502[_0xcc1d('0x5b')](_0x3471f4);});}}function onDisconnect(_0x303d68,_0x576b93){joinOrLeave(_0x303d68,'leave',_0x576b93);}function onConnect(_0x418ce7){joinOrLeave(_0x418ce7,_0xcc1d('0x5c'));}exports[_0xcc1d('0x5d')]=function(_0x8d7299){_0x8d7299['on'](_0xcc1d('0x5e'),function(_0x4fbd07){_0x4fbd07['setMaxListeners'](0x0);_0x4fbd07[_0xcc1d('0x5f')]=_0x4fbd07[_0xcc1d('0x60')][_0xcc1d('0x5e')][_0xcc1d('0x61')]+':'+_0x4fbd07[_0xcc1d('0x60')][_0xcc1d('0x5e')]['remotePort'];_0x4fbd07[_0xcc1d('0x62')]=new Date();_0x4fbd07['log']=function(_0x10047d){console[_0xcc1d('0x5b')](_0xcc1d('0x63')+_0x4fbd07[_0xcc1d('0x64')][_0xcc1d('0x8')]+'['+_0x4fbd07[_0xcc1d('0x5f')]+']',_0x10047d);};_0x4fbd07['on'](_0xcc1d('0x65'),function(){onDisconnect(_0x4fbd07,_0x8d7299);_0x4fbd07['log']('DISCONNECTED');});onConnect(_0x4fbd07);_0x4fbd07['log'](_0xcc1d('0x66'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 12f3ee4..54200ed 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 _0x3d77=['then','info','Trigger,\x20%s','EventManager','error','code','catch','get','channel','motionChannel','event','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','undefined','interface','format','SIP/%s','name','incomingmessage','outgoingmessage','AfterCreateMessage','opened','AfterCreate','changed','closed','agent','AfterUpdate','find','email','internal','length','hasOwnProperty','model','hook','toLowerCase','condition','util','../logger','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','afterCreate','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Mail','Openchannel','OpenchannelInteraction','request'];(function(_0x143230,_0x440c7a){var _0x4c197a=function(_0x30a05e){while(--_0x30a05e){_0x143230['push'](_0x143230['shift']());}};_0x4c197a(++_0x440c7a);}(_0x3d77,0x18a));var _0x73d7=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x3d77[_0x4d8ed9];return _0x1e2140;};'use strict';var util=require(_0x73d7('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0x73d7('0x1'))('triggers');var client=jayson[_0x73d7('0x2')][_0x73d7('0x3')]({'port':0x232a});var triggers=[{'channel':_0x73d7('0x4'),'model':_0x73d7('0x5'),'event':'afterCreate','condition':_0x73d7('0x6'),'callback':afterCreate},{'channel':_0x73d7('0x4'),'model':_0x73d7('0x5'),'event':_0x73d7('0x7'),'condition':_0x73d7('0x8'),'callback':afterUpdate},{'channel':_0x73d7('0x4'),'model':_0x73d7('0x9'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':_0x73d7('0xa'),'event':_0x73d7('0xb'),'condition':_0x73d7('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x73d7('0xd'),'model':_0x73d7('0xe'),'event':_0x73d7('0xb'),'condition':_0x73d7('0x6'),'callback':afterCreate},{'channel':'Sms','model':_0x73d7('0xe'),'event':'afterUpdate','condition':_0x73d7('0x8'),'callback':afterUpdate},{'channel':_0x73d7('0xd'),'model':_0x73d7('0xf'),'event':'afterCreate','condition':_0x73d7('0xc'),'callback':afterCreateMessage},{'channel':_0x73d7('0x10'),'model':_0x73d7('0x11'),'event':_0x73d7('0xb'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x73d7('0x10'),'model':_0x73d7('0x11'),'event':_0x73d7('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x73d7('0x10'),'model':_0x73d7('0x12'),'event':_0x73d7('0xb'),'condition':_0x73d7('0xc'),'callback':afterCreateMessage},{'channel':_0x73d7('0x13'),'model':_0x73d7('0x14'),'event':'afterCreate','condition':_0x73d7('0x6'),'callback':afterCreate},{'channel':'Fax','model':_0x73d7('0x14'),'event':_0x73d7('0x7'),'condition':_0x73d7('0x8'),'callback':afterUpdate},{'channel':_0x73d7('0x13'),'model':'FaxMessage','event':_0x73d7('0xb'),'condition':_0x73d7('0xc'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x73d7('0x15'),'event':'afterCreate','condition':_0x73d7('0x6'),'callback':afterCreate},{'channel':_0x73d7('0x16'),'model':_0x73d7('0x15'),'event':_0x73d7('0x7'),'condition':_0x73d7('0x8'),'callback':afterUpdate},{'channel':_0x73d7('0x16'),'model':'MailMessage','event':_0x73d7('0xb'),'condition':_0x73d7('0xc'),'callback':afterCreateMessage},{'channel':_0x73d7('0x17'),'model':_0x73d7('0x18'),'event':_0x73d7('0xb'),'condition':_0x73d7('0x6'),'callback':afterCreate},{'channel':_0x73d7('0x17'),'model':_0x73d7('0x18'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x73d7('0x17'),'model':'OpenchannelMessage','event':_0x73d7('0xb'),'condition':_0x73d7('0xc'),'callback':afterCreateMessage}];function request(_0x369f44){return client[_0x73d7('0x19')]('EventManager',_0x369f44)[_0x73d7('0x1a')](function(_0x3af928){logger[_0x73d7('0x1b')](_0x73d7('0x1c'),_0x73d7('0x1d'),_0x3af928);if(_0x3af928[_0x73d7('0x1e')]){if(_0x3af928[_0x73d7('0x1e')][_0x73d7('0x1f')]===0x1f4){logger[_0x73d7('0x1e')](_0x73d7('0x1c'),_0x73d7('0x1d'),_0x3af928['error']);}}})[_0x73d7('0x20')](function(_0x2095ad){logger['error'](_0x73d7('0x1c'),_0x73d7('0x1d'),_0x2095ad);});}function afterCreateMessage(_0x107cef){return function(_0x17b03c){_0x17b03c=_0x17b03c[_0x73d7('0x21')]({'plain':!![]});_0x17b03c[_0x73d7('0x22')]=_0x107cef;_0x17b03c[_0x73d7('0x23')]=_0x107cef;_0x17b03c[_0x73d7('0x24')]=_0x17b03c['direction'];Promise[_0x73d7('0x25')]()[_0x73d7('0x1a')](function(){if(typeof _0x17b03c['ContactId']==='undefined')return null;var _0x22bf23=_0x73d7('0x26')+_0x17b03c[_0x73d7('0x27')];return db[_0x73d7('0x28')][_0x73d7('0x29')](_0x22bf23,{'type':db[_0x73d7('0x2a')][_0x73d7('0x2b')][_0x73d7('0x2c')],'raw':!![]});})[_0x73d7('0x1a')](function(_0x4e9b6b){if(_0x4e9b6b){_0x17b03c[_0x73d7('0x2d')]=_0x4e9b6b[0x0];}if(typeof _0x17b03c[_0x73d7('0x2e')]===_0x73d7('0x2f'))return;return getAgent(_0x17b03c[_0x73d7('0x2e')]);})[_0x73d7('0x1a')](function(_0x699836){if(_0x699836){_0x17b03c[_0x73d7('0x30')]=util[_0x73d7('0x31')](_0x73d7('0x32'),_0x699836[_0x73d7('0x33')]);_0x17b03c['agent']=_0x699836;_0x17b03c['channel']=_0x107cef;return request({'event':_0x73d7('0x34'),'message':_0x17b03c});}else{return request({'event':_0x73d7('0x35'),'message':_0x17b03c});}})[_0x73d7('0x20')](function(_0x21c9ef){logger[_0x73d7('0x1e')](_0x73d7('0x1c'),_0x73d7('0x36'),_0x21c9ef);});};}function afterCreateOfflineMessage(_0x30ab2d){return function(_0x289c94){_0x289c94=_0x289c94[_0x73d7('0x21')]({'plain':!![]});_0x289c94[_0x73d7('0x22')]=_0x30ab2d;_0x289c94[_0x73d7('0x23')]=_0x30ab2d;_0x289c94['event']='offlineMessage';return request({'event':_0x289c94[_0x73d7('0x24')],'message':_0x289c94});};}function afterCreate(_0x2f49ea,_0x43b575){return function(_0x219605){var _0x41b2a7=_0x219605[_0x73d7('0x21')]({'plain':!![]});_0x41b2a7[_0x73d7('0x22')]=_0x2f49ea;_0x41b2a7[_0x73d7('0x23')]=_0x2f49ea;_0x41b2a7['event']=_0x73d7('0x37');Promise[_0x73d7('0x25')]()[_0x73d7('0x1a')](function(){var _0x1d2ea9=_0x73d7('0x26')+_0x41b2a7[_0x73d7('0x27')];return db[_0x73d7('0x28')][_0x73d7('0x29')](_0x1d2ea9,{'type':db[_0x73d7('0x2a')][_0x73d7('0x2b')][_0x73d7('0x2c')],'raw':!![]});})[_0x73d7('0x1a')](function(_0x2d651c){if(_0x2d651c){_0x41b2a7['contact']=_0x2d651c[0x0];}if(_0x41b2a7[_0x73d7('0x2e')]){return getAgent(_0x41b2a7[_0x73d7('0x2e')]);}return;})[_0x73d7('0x1a')](function(_0x18c63c){if(_0x18c63c){_0x41b2a7[_0x73d7('0x30')]=util[_0x73d7('0x31')](_0x73d7('0x32'),_0x18c63c[_0x73d7('0x33')]);_0x41b2a7['agent']=_0x18c63c;}return request({'event':_0x43b575,'message':_0x41b2a7});})[_0x73d7('0x20')](function(_0x4536c3){logger[_0x73d7('0x1e')](_0x73d7('0x1c'),_0x73d7('0x38'),_0x4536c3);});};}function afterUpdate(_0x34e446){return function(_0x37c347){var _0xda0169=_0x37c347[_0x73d7('0x39')](_0x73d7('0x3a'))&&_0x37c347[_0x73d7('0x3a')];var _0x47d516=_0x37c347[_0x73d7('0x39')]('substatus');if(_0xda0169||_0x47d516){var _0x570e20=_0xda0169?_0x73d7('0x8'):'substatus';var _0x330b73=_0x37c347['get']({'plain':!![]});_0x330b73[_0x73d7('0x22')]=_0x34e446;_0x330b73['motionChannel']=_0x34e446;_0x330b73[_0x73d7('0x24')]=_0xda0169?_0x73d7('0x3a'):'substatus';var _0x4f4521='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x330b73[_0x73d7('0x27')];return db['sequelize']['query'](_0x4f4521,{'type':db['Sequelize'][_0x73d7('0x2b')][_0x73d7('0x2c')],'raw':!![]})[_0x73d7('0x1a')](function(_0x4bb976){if(_0x4bb976){_0x330b73[_0x73d7('0x2d')]=_0x4bb976[0x0];}if(typeof _0x330b73[_0x73d7('0x2e')]==='undefined')return;return getAgent(_0x330b73[_0x73d7('0x2e')]);})[_0x73d7('0x1a')](function(_0x156457){if(_0x156457){_0x330b73[_0x73d7('0x30')]=util['format'](_0x73d7('0x32'),_0x156457[_0x73d7('0x33')]);_0x330b73[_0x73d7('0x3b')]=_0x156457;}return request({'event':_0x570e20,'message':_0x330b73});})[_0x73d7('0x20')](function(_0x4f9e07){logger[_0x73d7('0x1e')](_0x73d7('0x1c'),_0x73d7('0x3c'),_0x4f9e07);});}};}function getAgent(_0x138d2d){return db['User'][_0x73d7('0x3d')]({'where':{'id':_0x138d2d},'attributes':['id',_0x73d7('0x33'),'fullname',_0x73d7('0x3e'),_0x73d7('0x3f')],'raw':!![]})['then'](function(_0x531379){return _0x531379;});}exports['default']=function(){for(var _0x3075aa=0x0;_0x3075aa=_0x423392[_0xfa8d('0xf')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3fec53(_0x3c4546);})[_0xfa8d('0x10')](function(_0x240851){_0x2562c4(_0x240851);});});}; \ No newline at end of file +var _0x3e02=['agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','voice','mail','fax','sms','whatsapp','openchannel','getChannels','toLowerCase','clearBlockUser','isUndefined','blockedAt','getLicense'];(function(_0x31fdaa,_0x40e6f1){var _0x4e544e=function(_0x5a4b36){while(--_0x5a4b36){_0x31fdaa['push'](_0x31fdaa['shift']());}};_0x4e544e(++_0x40e6f1);}(_0x3e02,0x8a));var _0x23e0=function(_0x34d6cb,_0x1ae55c){_0x34d6cb=_0x34d6cb-0x0;var _0x4372cb=_0x3e02[_0x34d6cb];return _0x4372cb;};'use strict';var _=require(_0x23e0('0x0'));var BPromise=require(_0x23e0('0x1'));var db=require(_0x23e0('0x2'))['db'];var util=require(_0x23e0('0x3'));var channels=[_0x23e0('0x4'),_0x23e0('0x5'),'chat',_0x23e0('0x6'),_0x23e0('0x7'),_0x23e0('0x8'),_0x23e0('0x9')];exports[_0x23e0('0xa')]=function(){return channels;};exports['isValidChannel']=function(_0x3f1ead){_0x3f1ead=_0x3f1ead[_0x23e0('0xb')]();return _['includes'](channels,_0x3f1ead);};exports[_0x23e0('0xc')]=function(_0x3f96c5,_0xad7042,_0x23db3f,_0xe4d1e5){var _0x2f21ce={'loginAttempts':_0xad7042,'blocked':_0x23db3f};if(!_[_0x23e0('0xd')](_0xe4d1e5)){_0x2f21ce[_0x23e0('0xe')]=_0xe4d1e5;}return _0x3f96c5['updateAttributes'](_0x2f21ce);};exports[_0x23e0('0xf')]=function(_0x2e69c8){return new BPromise(function(_0x381066,_0x4973cc){var _0x3ec22d=0x0;if(_0x2e69c8['role']!==_0x23e0('0x10')){_0x381066(_0x2e69c8);}db[_0x23e0('0x11')][_0x23e0('0x12')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2e69c8['id']}}})[_0x23e0('0x13')](function(_0x4e5cce){_0x3ec22d=_0x4e5cce;return util[_0x23e0('0xf')]();})[_0x23e0('0x13')](function(_0x4cf981){if(_0x4cf981&&_0x4cf981[_0x23e0('0x14')]&&_0x3ec22d>=_0x4cf981[_0x23e0('0x14')]){throw Error(_0x23e0('0x15'));}_0x381066(_0x2e69c8);})['catch'](function(_0x5b0993){_0x4973cc(_0x5b0993);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index a4b988b..0df1fef 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3734=['Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Conflict','error','statusMessage','status','send','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','message'];(function(_0x202e81,_0x4df3bd){var _0x43fd3b=function(_0x12b0e3){while(--_0x12b0e3){_0x202e81['push'](_0x202e81['shift']());}};_0x43fd3b(++_0x4df3bd);}(_0x3734,0xf5));var _0x4373=function(_0x45e44a,_0x5cd4af){_0x45e44a=_0x45e44a-0x0;var _0x5c8e1b=_0x3734[_0x45e44a];return _0x5c8e1b;};'use strict';var util=require(_0x4373('0x0'));var logger=require(_0x4373('0x1'))(_0x4373('0x2'));var APIError=function(_0x1cc5ad,_0x2b6873){this['message']=_0x1cc5ad||_0x4373('0x3');this[_0x4373('0x4')]=_0x2b6873||_0x4373('0x5');util[_0x4373('0x6')](APIError,Error);};var APIBadRequestError=function(_0x5c9fa7){this[_0x4373('0x7')]=_0x5c9fa7||'Bad\x20Request';this['name']=_0x4373('0x8');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3287ae){this[_0x4373('0x7')]=_0x3287ae||_0x4373('0x9');this[_0x4373('0x4')]='Forbidden';util[_0x4373('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x8e9609){this[_0x4373('0x7')]=_0x8e9609||_0x4373('0xa');this[_0x4373('0x4')]=_0x4373('0xb');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x40b89d){this[_0x4373('0x7')]=_0x40b89d||_0x4373('0xc');this['name']=_0x4373('0xd');this[_0x4373('0xe')]=0x193;this[_0x4373('0xf')]={'type':_0x4373('0x10')};util[_0x4373('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x39621c){this[_0x4373('0x7')]=_0x39621c||'Resource\x20Conflict';this['name']=_0x4373('0x11');util[_0x4373('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x5e1f98){switch(_0x5e1f98){case'Bad\x20Request':return 0x190;case _0x4373('0x9'),_0x4373('0xd'):return 0x193;case _0x4373('0xb'):return 0x194;case _0x4373('0x11'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x514d65){if(_0x514d65==='Out\x20Of\x20Interval')return _0x514d65;return null;}function handleError(_0x66a3a7){return function(_0x2ebbe7){logger[_0x4373('0x12')](_0x2ebbe7['stack']);var _0x517bb2=getStatusCode(_0x2ebbe7['name']);var _0x32bf04=getCustomStatusMessage(_0x2ebbe7['name']);if(_0x2ebbe7[_0x4373('0x4')]){delete _0x2ebbe7[_0x4373('0x4')];}if(_0x32bf04){_0x66a3a7[_0x4373('0x13')]=_0x32bf04;}return _0x66a3a7[_0x4373('0x14')](_0x517bb2)[_0x4373('0x15')](_0x2ebbe7);};}module[_0x4373('0x16')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xd054=['message','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','details','OutOfInterval','Resource\x20Conflict','Out\x20Of\x20Interval','Conflict','error','stack','statusMessage','status','send','exports','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x261dc2,_0xbd3c6e){var _0x5b35d0=function(_0x162ba4){while(--_0x162ba4){_0x261dc2['push'](_0x261dc2['shift']());}};_0x5b35d0(++_0xbd3c6e);}(_0xd054,0xa2));var _0x4d05=function(_0x3eddcc,_0x2b2955){_0x3eddcc=_0x3eddcc-0x0;var _0x3a55c9=_0xd054[_0x3eddcc];return _0x3a55c9;};'use strict';var util=require('util');var logger=require(_0x4d05('0x0'))(_0x4d05('0x1'));var APIError=function(_0x3f4255,_0x4ebebd){this['message']=_0x3f4255||_0x4d05('0x2');this[_0x4d05('0x3')]=_0x4ebebd||_0x4d05('0x4');util[_0x4d05('0x5')](APIError,Error);};var APIBadRequestError=function(_0xafc2a){this[_0x4d05('0x6')]=_0xafc2a||'Bad\x20Request';this[_0x4d05('0x3')]=_0x4d05('0x7');util[_0x4d05('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x30422f){this[_0x4d05('0x6')]=_0x30422f||_0x4d05('0x8');this[_0x4d05('0x3')]='Forbidden';util[_0x4d05('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x107d5e){this[_0x4d05('0x6')]=_0x107d5e||_0x4d05('0x9');this[_0x4d05('0x3')]=_0x4d05('0xa');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x1cbf1f){this[_0x4d05('0x6')]=_0x1cbf1f||_0x4d05('0xb');this[_0x4d05('0x3')]='Out\x20Of\x20Interval';this[_0x4d05('0xc')]=0x193;this[_0x4d05('0xd')]={'type':_0x4d05('0xe')};util[_0x4d05('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x488509){this['message']=_0x488509||_0x4d05('0xf');this[_0x4d05('0x3')]='Conflict';util[_0x4d05('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x242b6f){switch(_0x242b6f){case _0x4d05('0x7'):return 0x190;case _0x4d05('0x8'),_0x4d05('0x10'):return 0x193;case _0x4d05('0xa'):return 0x194;case _0x4d05('0x11'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x59bf04){if(_0x59bf04==='Out\x20Of\x20Interval')return _0x59bf04;return null;}function handleError(_0x34d280){return function(_0x382572){logger[_0x4d05('0x12')](_0x382572[_0x4d05('0x13')]);var _0x636798=getStatusCode(_0x382572[_0x4d05('0x3')]);var _0x259b1b=getCustomStatusMessage(_0x382572['name']);if(_0x382572['name']){delete _0x382572[_0x4d05('0x3')];}if(_0x259b1b){_0x34d280[_0x4d05('0x14')]=_0x259b1b;}return _0x34d280[_0x4d05('0x15')](_0x636798)[_0x4d05('0x16')](_0x382572);};}module[_0x4d05('0x17')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 8955dc3..3e8f043 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c2c=['exports','status','json','send'];(function(_0x35c7c4,_0x3ebba6){var _0x452ec9=function(_0x163628){while(--_0x163628){_0x35c7c4['push'](_0x35c7c4['shift']());}};_0x452ec9(++_0x3ebba6);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xc9c2('0x0')][0x194]=function pageNotFound(_0x3e0a9c,_0x4ac695){var _0x507004='404';var _0x31a779=0x194;var _0x4ac3bb={'status':_0x31a779};_0x4ac695[_0xc9c2('0x1')](_0x4ac3bb[_0xc9c2('0x1')]);_0x4ac695['render'](_0x507004,{},function(_0x4db342,_0x35818b){if(_0x4db342){return _0x4ac695['status'](_0x4ac3bb[_0xc9c2('0x1')])[_0xc9c2('0x2')](_0x4ac3bb);}_0x4ac695[_0xc9c2('0x3')](_0x35818b);});}; \ No newline at end of file +var _0x8af4=['status','render','json','send','exports','404'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x8af4,0x88));var _0x48af=function(_0x227b64,_0x1c6f72){_0x227b64=_0x227b64-0x0;var _0xc84cb5=_0x8af4[_0x227b64];return _0xc84cb5;};'use strict';module[_0x48af('0x0')][0x194]=function pageNotFound(_0x59a317,_0x431d5b){var _0x11628e=_0x48af('0x1');var _0x423229=0x194;var _0x495ec3={'status':_0x423229};_0x431d5b[_0x48af('0x2')](_0x495ec3[_0x48af('0x2')]);_0x431d5b[_0x48af('0x3')](_0x11628e,{},function(_0x218d29,_0x471cc2){if(_0x218d29){return _0x431d5b['status'](_0x495ec3[_0x48af('0x2')])[_0x48af('0x4')](_0x495ec3);}_0x431d5b[_0x48af('0x5')](_0x471cc2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 88f8a23..246aead 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ef6=['../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','cascade','userSetting','UserId','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','UserProfile','belongsToMany','ChatGroup','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','UserVoiceQueue','VoicePrefixes','UserVoicePrefix','ChatQueues','UserFaxQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sound','moh_has_sounds','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','ContactId','CloudProviderId','restrict','MailAccountId','Imap','Smtp','Disposition','Dispositions','MailMessage','List','TemplateId','team_has_mail_queues','MailInteractionId','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','Account','ChatWebsiteId','ListId','MailQueueReport','Items','FaxAccountId','Answers','FaxApplication','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','Attachment','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccount','SmsAccountId','SmsMessage','Interactions','SmsInteractionId','sms_interaction_has_tags','SmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueue','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','ChatGroupId','Phones','CmContactId','Company','CompanyId','cm_contact_has_tags','AdditionalPhones','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','Intervals','MailApplication','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','ContactItemType','ItemTypeId','Hopper','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','SalesforceAccount','Configurations','SubjectId','Descriptions','FieldId','AccountId','VariableId','SugarcrmField','DescriptionId','Subject','Description','int_desk_configuration_has_tags','Field','ZendeskAccount','ZendeskConfiguration','Subjects','ZendeskField','int_zendesk_configuration_has_tags','Dynamics365Account','Dynamics365Field','FromId','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','MailQueues','FaxQueues','team_has_whatsapp_queues','campaigns_has_cm_lists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','ToQueue','ToChatWebsiteId','ToFaxQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CmCustomField','CustomFields','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','xcall','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9ef6,0x1ca));var _0x69ef=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x9ef6[_0x2a238a];return _0xeef802;};'use strict';var config=require(_0x69ef('0x0'));var Sequelize=require(_0x69ef('0x1'));var _=require('lodash');var jstz=require(_0x69ef('0x2'));var timezone=jstz[_0x69ef('0x3')]();config[_0x69ef('0x1')]=_[_0x69ef('0x4')](config[_0x69ef('0x1')],{'database':_0x69ef('0x5'),'username':'xcall','password':_0x69ef('0x6'),'options':{'host':_0x69ef('0x7'),'port':0xcea,'dialect':_0x69ef('0x8'),'dialectOptions':{'charset':_0x69ef('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x69ef('0xa'),'collate':'utf8_general_ci'}}});config[_0x69ef('0xb')]=_[_0x69ef('0x4')](config[_0x69ef('0xb')],{'database':_0x69ef('0x5'),'username':_0x69ef('0xc'),'password':_0x69ef('0x6'),'options':{'host':_0x69ef('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x69ef('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x69ef('0xa'),'collate':_0x69ef('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x69ef('0x1')][_0x69ef('0xe')],config['sequelize'][_0x69ef('0xf')],config[_0x69ef('0x1')][_0x69ef('0x10')],config[_0x69ef('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x69ef('0xb')][_0x69ef('0xf')],config[_0x69ef('0xb')][_0x69ef('0x10')],config[_0x69ef('0xb')][_0x69ef('0x11')])};db[_0x69ef('0x12')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x14'));db[_0x69ef('0x15')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x69ef('0x16')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x17'));db['VoiceExtension']=db[_0x69ef('0x1')]['import']('../api/voiceExtension/voiceExtension.model');db[_0x69ef('0x18')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x19'));db[_0x69ef('0x1a')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x1b'));db[_0x69ef('0x1c')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x1d'));db[_0x69ef('0x1e')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x1f'));db[_0x69ef('0x20')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x21'));db[_0x69ef('0x22')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x23'));db[_0x69ef('0x24')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0x69ef('0x25')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x69ef('0x26')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x27'));db[_0x69ef('0x28')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/memberReport/memberReport.model');db[_0x69ef('0x29')]=db[_0x69ef('0x1')]['import']('../api/trunk/trunk.model');db[_0x69ef('0x2a')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x2b'));db[_0x69ef('0x2c')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x2d'));db['UserVoiceQueue']=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x2e'));db[_0x69ef('0x2f')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x30'));db[_0x69ef('0x31')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x32'));db['UserFaxQueue']=db[_0x69ef('0x1')]['import'](_0x69ef('0x33'));db['UserSmsQueue']=db['sequelize']['import']('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x34'));db[_0x69ef('0x35')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x36'));db[_0x69ef('0x37')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0x69ef('0x38')]=db['sequelize']['import'](_0x69ef('0x39'));db['MailAccount']=db['sequelize']['import'](_0x69ef('0x3a'));db[_0x69ef('0x3b')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x3c'));db[_0x69ef('0x3d')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x3e'));db[_0x69ef('0x3f')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x40'));db['MailMessage']=db[_0x69ef('0x1')]['import'](_0x69ef('0x41'));db['MailApplication']=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x42'));db['MailQueueReport']=db[_0x69ef('0x1')]['import'](_0x69ef('0x43'));db[_0x69ef('0x44')]=db['sequelize'][_0x69ef('0x13')]('../api/dashboard/dashboard.model');db[_0x69ef('0x45')]=db[_0x69ef('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x69ef('0x46')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x47'));db['FaxApplication']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x48'));db[_0x69ef('0x49')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x4a'));db[_0x69ef('0x4b')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x4c'));db[_0x69ef('0x4d')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x4e'));db['SmsAccount']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x4f'));db[_0x69ef('0x50')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x51'));db[_0x69ef('0x52')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x53'));db['SmsMessage']=db[_0x69ef('0x1')]['import']('../api/smsMessage/smsMessage.model');db['SmsQueue']=db['sequelize']['import'](_0x69ef('0x54'));db[_0x69ef('0x55')]=db['sequelize']['import'](_0x69ef('0x56'));db[_0x69ef('0x57')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x58'));db[_0x69ef('0x59')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x5a'));db[_0x69ef('0x5b')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x5c'));db['OpenchannelQueue']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x5d'));db[_0x69ef('0x5e')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x69ef('0x5f')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x60'));db[_0x69ef('0x61')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x62'));db[_0x69ef('0x63')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x69ef('0x64')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x65'));db[_0x69ef('0x66')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x67'));db[_0x69ef('0x68')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x69'));db['ChatGroup']=db['sequelize']['import'](_0x69ef('0x6a'));db[_0x69ef('0x6b')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x6c'));db[_0x69ef('0x6d')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x6e'));db['CmContact']=db[_0x69ef('0x1')]['import'](_0x69ef('0x6f'));db[_0x69ef('0x70')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/cmHopper/cmHopper.model');db[_0x69ef('0x71')]=db[_0x69ef('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x69ef('0x72')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x73'));db['CmHopperHistory']=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x69ef('0x74')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x75'));db['Action']=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/action/action.model');db[_0x69ef('0x76')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x77'));db[_0x69ef('0x78')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x79'));db['Disposition']=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x7a'));db[_0x69ef('0x7b')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x7c'));db[_0x69ef('0x7d')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x7e'));db['Pause']=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x7f'));db[_0x69ef('0x80')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x81'));db[_0x69ef('0x82')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x83'));db[_0x69ef('0x84')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x85'));db['Sound']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x86'));db[_0x69ef('0x87')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x88'));db['ContactItemType']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x89'));db[_0x69ef('0x8a')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x8b'));db[_0x69ef('0x8c')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x8d'));db[_0x69ef('0x8e')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x8f'));db['Trigger']=db['sequelize'][_0x69ef('0x13')]('../api/trigger/trigger.model');db[_0x69ef('0x90')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x91'));db['Integration']=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x92'));db[_0x69ef('0x93')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x94'));db[_0x69ef('0x95')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x69ef('0x96')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x97'));db['AnalyticExtractedReport']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x98'));db[_0x69ef('0x99')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x9a'));db[_0x69ef('0x9b')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x69ef('0x9c')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x9d'));db['SalesforceAccount']=db[_0x69ef('0x1')]['import'](_0x69ef('0x9e'));db[_0x69ef('0x9f')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xa0'));db[_0x69ef('0xa1')]=db[_0x69ef('0x1')]['import'](_0x69ef('0xa2'));db[_0x69ef('0xa3')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x69ef('0xa4')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xa5'));db['SugarcrmField']=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x69ef('0xa6')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x69ef('0xa7')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xa8'));db[_0x69ef('0xa9')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xaa'));db[_0x69ef('0xab')]=db['sequelize'][_0x69ef('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x69ef('0xac')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xad'));db[_0x69ef('0xae')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xaf'));db['ZendeskAccount']=db[_0x69ef('0x1')]['import'](_0x69ef('0xb0'));db['ZendeskConfiguration']=db['sequelize']['import'](_0x69ef('0xb1'));db['ZendeskField']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xb2'));db[_0x69ef('0xb3')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xb4'));db[_0x69ef('0xb5')]=db['sequelize'][_0x69ef('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x69ef('0xb6')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xb7'));db[_0x69ef('0xb8')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xb9'));db[_0x69ef('0xba')]=db['sequelize']['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x69ef('0xbb')]=db[_0x69ef('0x1')]['import'](_0x69ef('0xbc'));db[_0x69ef('0xbd')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xbe'));db[_0x69ef('0xbf')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xc0'));db[_0x69ef('0xc1')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xc2'));db['Dynamics365Account']=db[_0x69ef('0x1')]['import'](_0x69ef('0xc3'));db[_0x69ef('0xc4')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xc5'));db['Dynamics365Field']=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xc6'));db[_0x69ef('0xc7')]=db['sequelize'][_0x69ef('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x69ef('0xc8')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xc9'));db[_0x69ef('0xca')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xcb'));db[_0x69ef('0xcc')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/integration/integration.model');db[_0x69ef('0xcd')]=db['sequelize']['import']('../api/network/network.model');db[_0x69ef('0xce')]=db['sequelize'][_0x69ef('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x69ef('0xcf')]=db[_0x69ef('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x69ef('0xd0')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xd1'));db['JscriptyQuestionReport']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xd2'));db[_0x69ef('0xd3')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xd4'));db['SmsQueueReport']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xd5'));db[_0x69ef('0xd6')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xd7'));db['SquareDetailsReport']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xd8'));db[_0x69ef('0xd9')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xda'));db[_0x69ef('0xdb')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0xdc'));db[_0x69ef('0xdd')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xde'));db[_0x69ef('0xdf')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/squareProject/squareProject.model');db[_0x69ef('0xe0')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xe1'));db[_0x69ef('0xe2')]=db[_0x69ef('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0x69ef('0xe3')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xe4'));db[_0x69ef('0xe5')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xe6'));db[_0x69ef('0xe7')]=db[_0x69ef('0x1')]['import']('../api/campaign/campaign.model');db['Migration']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xe8'));db['Attachment']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xe9'));db[_0x69ef('0xea')]=db['sequelize']['import'](_0x69ef('0xeb'));db[_0x69ef('0xec')]=db[_0x69ef('0x1')]['import'](_0x69ef('0xed'));db[_0x69ef('0xee')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xef'));db[_0x69ef('0xf0')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xf1'));db[_0x69ef('0xf2')]=db[_0x69ef('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x69ef('0xf3')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x69ef('0xf4')]=db[_0x69ef('0x1')]['import'](_0x69ef('0xf5'));db[_0x69ef('0xf6')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xf7'));db['UserProfile']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xf8'));db[_0x69ef('0xf9')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xfa'));db[_0x69ef('0xfb')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xfc'));db[_0x69ef('0xfd')]=db[_0x69ef('0x1')]['import']('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0xfe'));db[_0x69ef('0xff')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x100'));db[_0x69ef('0x101')]=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x102'));db[_0x69ef('0x103')]=db['sequelize'][_0x69ef('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x69ef('0x104')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x105'));db[_0x69ef('0x106')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x107'));db['WhatsappQueue']=db[_0x69ef('0x1')][_0x69ef('0x13')](_0x69ef('0x108'));db[_0x69ef('0x109')]=db['sequelize']['import'](_0x69ef('0x10a'));db['TeamVoiceQueue']=db[_0x69ef('0x1')]['import'](_0x69ef('0x10b'));db[_0x69ef('0x10c')]=db['sequelize'][_0x69ef('0x13')](_0x69ef('0x10d'));db['UserVoicePrefix']=db['sequelize'][_0x69ef('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x69ef('0x10e')]=db[_0x69ef('0x1')]['import'](_0x69ef('0x10f'));db[_0x69ef('0x110')]=db[_0x69ef('0x1')][_0x69ef('0x13')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0x69ef('0x12')][_0x69ef('0x111')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x69ef('0x112'),'foreignKey':'UserId'});db['User'][_0x69ef('0x111')](db[_0x69ef('0x10e')],{'as':_0x69ef('0x113'),'onDelete':'cascade','foreignKey':_0x69ef('0x114')});db[_0x69ef('0x12')][_0x69ef('0x115')](db['VoiceRecording'],{'as':_0x69ef('0x116'),'foreignKey':_0x69ef('0x114')});db['User'][_0x69ef('0x115')](db[_0x69ef('0x2c')],{'as':_0x69ef('0x117'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x12')][_0x69ef('0x115')](db[_0x69ef('0x118')],{'as':_0x69ef('0x119'),'onDelete':_0x69ef('0x112'),'hooks':!![]});db[_0x69ef('0x12')][_0x69ef('0x115')](db[_0x69ef('0x72')],{'as':'HopperFinals','foreignKey':_0x69ef('0x114')});db[_0x69ef('0x12')][_0x69ef('0x115')](db[_0x69ef('0x11a')],{'as':_0x69ef('0x11b'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x12')][_0x69ef('0x115')](db[_0x69ef('0x74')],{'as':_0x69ef('0x74'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x12')][_0x69ef('0x115')](db[_0x69ef('0x59')],{'as':_0x69ef('0x11c'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x12')][_0x69ef('0x115')](db['ChatInteraction'],{'as':_0x69ef('0x11d'),'foreignKey':_0x69ef('0x114')});db['User'][_0x69ef('0x115')](db['SmsInteraction'],{'as':_0x69ef('0x11e'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x12')][_0x69ef('0x115')](db[_0x69ef('0x49')],{'as':_0x69ef('0x11f'),'foreignKey':'UserId'});db[_0x69ef('0x12')][_0x69ef('0x115')](db[_0x69ef('0x3f')],{'as':_0x69ef('0x120'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x12')]['hasMany'](db[_0x69ef('0x101')],{'as':_0x69ef('0x121'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x12')][_0x69ef('0x115')](db[_0x69ef('0xfd')],{'as':_0x69ef('0x122'),'foreignKey':_0x69ef('0x123')});db['User'][_0x69ef('0x115')](db[_0x69ef('0x70')],{'as':_0x69ef('0x124'),'foreignKey':_0x69ef('0x114'),'onDelete':_0x69ef('0x125')});db[_0x69ef('0x12')][_0x69ef('0x126')](db[_0x69ef('0x127')],{'as':_0x69ef('0x127'),'foreignKey':'userProfileId'});db[_0x69ef('0x12')][_0x69ef('0x128')](db[_0x69ef('0x129')],{'as':_0x69ef('0x12a'),'through':_0x69ef('0x12b')});db[_0x69ef('0x12')][_0x69ef('0x128')](db[_0x69ef('0x12c')],{'as':_0x69ef('0x12d'),'through':_0x69ef('0x12e')});db[_0x69ef('0x12')][_0x69ef('0x128')](db[_0x69ef('0xf4')],{'as':_0x69ef('0x12f'),'through':_0x69ef('0x130')});db['User']['belongsToMany'](db[_0x69ef('0xe3')],{'through':_0x69ef('0x131')});db[_0x69ef('0x12')][_0x69ef('0x128')](db[_0x69ef('0x3f')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x69ef('0x12')]['belongsToMany'](db['ChatInteraction'],{'as':_0x69ef('0x11d'),'through':_0x69ef('0x132')});db[_0x69ef('0x12')]['belongsToMany'](db[_0x69ef('0x49')],{'as':_0x69ef('0x11f'),'through':_0x69ef('0x133')});db[_0x69ef('0x12')][_0x69ef('0x128')](db[_0x69ef('0x52')],{'as':'SmsInteractions','through':_0x69ef('0x134')});db['User'][_0x69ef('0x128')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x69ef('0x135')});db['User'][_0x69ef('0x128')](db[_0x69ef('0x101')],{'as':_0x69ef('0x121'),'through':_0x69ef('0x136')});db['User'][_0x69ef('0x128')](db[_0x69ef('0x137')],{'as':_0x69ef('0x138'),'through':_0x69ef('0x139'),'required':![]});db[_0x69ef('0x12')][_0x69ef('0x128')](db[_0x69ef('0xf6')],{'as':_0x69ef('0x13a'),'through':_0x69ef('0x13b'),'required':![]});db['User'][_0x69ef('0x128')](db['MailQueue'],{'as':'MailQueues','through':_0x69ef('0x31'),'required':![]});db['User'][_0x69ef('0x128')](db[_0x69ef('0x68')],{'as':_0x69ef('0x13c'),'through':_0x69ef('0x2f'),'required':![],'hooks':!![]});db['User'][_0x69ef('0x128')](db[_0x69ef('0x4d')],{'as':'FaxQueues','through':_0x69ef('0x13d'),'required':![]});db['User']['belongsToMany'](db['SmsQueue'],{'as':_0x69ef('0x13e'),'through':_0x69ef('0x13f'),'required':![]});db['User'][_0x69ef('0x128')](db['OpenchannelQueue'],{'as':_0x69ef('0x140'),'through':_0x69ef('0x141'),'required':![]});db[_0x69ef('0x12')]['belongsToMany'](db[_0x69ef('0x142')],{'as':_0x69ef('0x143'),'through':_0x69ef('0x35'),'required':![]});db[_0x69ef('0x12')][_0x69ef('0x128')](db[_0x69ef('0xf4')],{'through':_0x69ef('0x130')});db[_0x69ef('0x12')]['belongsToMany'](db['ChatWebsite'],{'as':_0x69ef('0x144'),'through':_0x69ef('0x145')});db[_0x69ef('0x12')]['belongsToMany'](db[_0x69ef('0x46')],{'as':_0x69ef('0x146'),'through':_0x69ef('0x147')});db['User'][_0x69ef('0x128')](db[_0x69ef('0x148')],{'as':_0x69ef('0x149'),'through':_0x69ef('0x14a')});db['User'][_0x69ef('0x128')](db[_0x69ef('0x55')],{'as':_0x69ef('0x14b'),'through':'user_has_openchannel_accounts'});db['User'][_0x69ef('0x128')](db['SmsAccount'],{'as':_0x69ef('0x14c'),'through':_0x69ef('0x14d')});db[_0x69ef('0x12')][_0x69ef('0x128')](db['WhatsappAccount'],{'as':_0x69ef('0x14e'),'through':_0x69ef('0x14f')});db[_0x69ef('0x15')][_0x69ef('0x115')](db['VoiceExtension'],{'as':_0x69ef('0x150'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x151')});db['VoiceContext'][_0x69ef('0x115')](db[_0x69ef('0x118')],{'onDelete':_0x69ef('0x112')});db[_0x69ef('0x118')]['hasMany'](db[_0x69ef('0x118')],{'as':_0x69ef('0x152'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x18')][_0x69ef('0x128')](db[_0x69ef('0x153')],{'as':'Sounds','through':_0x69ef('0x154')});db['VoiceQueue']['hasMany'](db[_0x69ef('0x2c')],{'as':'Members','foreignKey':_0x69ef('0x155')});db[_0x69ef('0x137')]['hasMany'](db[_0x69ef('0x70')],{'as':_0x69ef('0x124'),'foreignKey':_0x69ef('0x155')});db[_0x69ef('0x137')][_0x69ef('0x115')](db[_0x69ef('0x72')],{'as':_0x69ef('0x156'),'foreignKey':_0x69ef('0x155')});db[_0x69ef('0x137')]['hasMany'](db[_0x69ef('0x11a')],{'as':_0x69ef('0x157'),'foreignKey':'VoiceQueueId'});db[_0x69ef('0x137')][_0x69ef('0x115')](db['ReportAgentPreview'],{'as':_0x69ef('0x74'),'foreignKey':_0x69ef('0x155')});db[_0x69ef('0x137')][_0x69ef('0x115')](db[_0x69ef('0x71')],{'as':_0x69ef('0x158'),'foreignKey':_0x69ef('0x155')});db['VoiceQueue'][_0x69ef('0x115')](db[_0x69ef('0xd3')],{'as':_0x69ef('0x159'),'foreignKey':'VoiceQueueId'});db[_0x69ef('0x137')]['belongsTo'](db[_0x69ef('0x29')],{'as':'Trunk','foreignKey':_0x69ef('0x15a')});db[_0x69ef('0x137')][_0x69ef('0x126')](db[_0x69ef('0x29')],{'as':'TrunkBackup','foreignKey':_0x69ef('0x15b')});db['VoiceQueue']['belongsTo'](db['Interval'],{'as':_0x69ef('0x7d'),'foreignKey':_0x69ef('0x15c')});db['VoiceQueue'][_0x69ef('0x126')](db[_0x69ef('0x15d')],{'as':_0x69ef('0x15e'),'foreignKey':_0x69ef('0x15f')});db[_0x69ef('0x137')][_0x69ef('0x128')](db['CmList'],{'as':_0x69ef('0x12f'),'through':_0x69ef('0x160')});db['VoiceQueue'][_0x69ef('0x128')](db[_0x69ef('0x12')],{'as':_0x69ef('0x161'),'through':'UserVoiceQueue'});db[_0x69ef('0x137')][_0x69ef('0x128')](db['Team'],{'as':_0x69ef('0x162'),'through':_0x69ef('0x163')});db['VoiceQueue'][_0x69ef('0x128')](db[_0x69ef('0xf4')],{'as':_0x69ef('0x164'),'through':_0x69ef('0x165')});db[_0x69ef('0x1a')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0x69ef('0x114')});db[_0x69ef('0x1c')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'as':'User','foreignKey':'UserId'});db[_0x69ef('0x1e')]['hasMany'](db[_0x69ef('0x20')],{'as':_0x69ef('0x166'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x167'),'sourceKey':_0x69ef('0x168')});db[_0x69ef('0x20')][_0x69ef('0x126')](db[_0x69ef('0x1e')],{'foreignKey':_0x69ef('0x167'),'targetKey':_0x69ef('0x168')});db['VoiceCallReport'][_0x69ef('0x115')](db['VoiceQueueReport'],{'as':_0x69ef('0x169'),'foreignKey':_0x69ef('0x16a'),'constraints':![]});db['VoiceCallReport']['hasMany'](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x69ef('0x16a'),'constraints':![]});db[_0x69ef('0x22')][_0x69ef('0x126')](db['User'],{'as':'User','foreignKey':'UserId'});db[_0x69ef('0x22')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x37')][_0x69ef('0x126')](db[_0x69ef('0x148')],{'as':_0x69ef('0x148'),'foreignKey':'MailAccountId'});db[_0x69ef('0x37')]['belongsTo'](db[_0x69ef('0x109')],{'as':_0x69ef('0x109'),'foreignKey':_0x69ef('0x16c'),'onDelete':_0x69ef('0x16d')});db[_0x69ef('0x38')]['belongsTo'](db[_0x69ef('0x148')],{'as':_0x69ef('0x148'),'foreignKey':_0x69ef('0x16e')});db[_0x69ef('0x38')][_0x69ef('0x126')](db[_0x69ef('0x109')],{'as':'CloudProvider','foreignKey':_0x69ef('0x16c'),'onDelete':_0x69ef('0x16d')});db[_0x69ef('0x148')][_0x69ef('0x111')](db[_0x69ef('0x37')],{'as':_0x69ef('0x16f'),'onDelete':'cascade'});db[_0x69ef('0x148')][_0x69ef('0x111')](db[_0x69ef('0x38')],{'as':_0x69ef('0x170'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x69ef('0x171')],{'as':_0x69ef('0x172'),'foreignKey':_0x69ef('0x16e'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x148')][_0x69ef('0x115')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x69ef('0x16e')});db['MailAccount'][_0x69ef('0x115')](db[_0x69ef('0x173')],{'as':'Messages','foreignKey':_0x69ef('0x16e')});db['MailAccount'][_0x69ef('0x115')](db[_0x69ef('0x3f')],{'as':'Interactions'});db[_0x69ef('0x148')]['hasMany'](db['MailApplication'],{'as':'Applications','foreignKey':_0x69ef('0x16e'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x148')][_0x69ef('0x126')](db[_0x69ef('0xf4')],{'as':_0x69ef('0x174'),'foreignKey':'ListId'});db[_0x69ef('0x148')][_0x69ef('0x126')](db[_0x69ef('0x8e')],{'as':'Template','foreignKey':_0x69ef('0x175')});db['MailAccount'][_0x69ef('0x126')](db['Pause'],{'as':_0x69ef('0x15e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x69ef('0x148')][_0x69ef('0x128')](db['User'],{'as':'Agents','through':_0x69ef('0x14a')});db[_0x69ef('0x3b')][_0x69ef('0x128')](db[_0x69ef('0x12')],{'as':_0x69ef('0x161'),'through':_0x69ef('0x31')});db[_0x69ef('0x3b')][_0x69ef('0x128')](db[_0x69ef('0xe3')],{'through':_0x69ef('0x176'),'as':'Teams'});db[_0x69ef('0x3f')][_0x69ef('0x115')](db['MailMessage'],{'as':_0x69ef('0x166'),'onDelete':'cascade','foreignKey':_0x69ef('0x177')});db['MailInteraction'][_0x69ef('0x126')](db[_0x69ef('0x148')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x69ef('0x3f')][_0x69ef('0x126')](db[_0x69ef('0x12c')],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x3f')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'as':_0x69ef('0x179'),'foreignKey':'UserId'});db['MailInteraction']['belongsToMany'](db[_0x69ef('0x87')],{'through':_0x69ef('0x17a'),'as':_0x69ef('0x17b')});db[_0x69ef('0x3f')][_0x69ef('0x128')](db['Tag'],{'through':_0x69ef('0x17a'),'as':_0x69ef('0x17c')});db[_0x69ef('0x3f')]['belongsToMany'](db[_0x69ef('0x12')],{'as':_0x69ef('0x17d'),'through':_0x69ef('0x17e'),'foreignKey':_0x69ef('0x177')});db[_0x69ef('0x173')]['hasMany'](db['Attachment'],{'as':_0x69ef('0x17f'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x173')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'as':'User'});db['MailMessage'][_0x69ef('0x126')](db[_0x69ef('0x12c')],{'onDelete':_0x69ef('0x112'),'as':'Contact'});db[_0x69ef('0x173')][_0x69ef('0x126')](db[_0x69ef('0x3f')],{'as':_0x69ef('0x180'),'foreignKey':_0x69ef('0x177')});db['MailMessage'][_0x69ef('0x126')](db['MailAccount'],{'as':_0x69ef('0x181'),'foreignKey':'MailAccountId'});db[_0x69ef('0x173')][_0x69ef('0x126')](db[_0x69ef('0x5e')],{'as':_0x69ef('0x5e'),'foreignKey':_0x69ef('0x182')});db[_0x69ef('0x173')][_0x69ef('0x126')](db[_0x69ef('0x66')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db['MailApplication']['belongsTo'](db[_0x69ef('0x12')],{'onDelete':_0x69ef('0x16d')});db['MailApplication']['belongsTo'](db['MailQueue'],{'onDelete':_0x69ef('0x16d')});db['MailApplication'][_0x69ef('0x126')](db[_0x69ef('0x148')],{'onDelete':'restrict'});db['MailApplication'][_0x69ef('0x126')](db[_0x69ef('0x7d')],{'onDelete':_0x69ef('0x16d'),'foreignKey':_0x69ef('0x15c')});db['MailApplication']['belongsTo'](db[_0x69ef('0x87')],{'onDelete':_0x69ef('0x16d'),'foreignKey':'TagId'});db['MailQueueReport'][_0x69ef('0x126')](db['MailAccount'],{});db['MailQueueReport'][_0x69ef('0x126')](db[_0x69ef('0xf4')],{'as':_0x69ef('0x174'),'foreignKey':_0x69ef('0x183')});db[_0x69ef('0x184')][_0x69ef('0x126')](db['CmContact'],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db['MailQueueReport'][_0x69ef('0x126')](db[_0x69ef('0x3f')],{});db[_0x69ef('0x184')][_0x69ef('0x126')](db[_0x69ef('0x173')],{});db[_0x69ef('0x184')]['belongsTo'](db[_0x69ef('0x12')],{});db[_0x69ef('0x184')][_0x69ef('0x126')](db[_0x69ef('0x3b')],{});db[_0x69ef('0x44')][_0x69ef('0x115')](db[_0x69ef('0x45')],{'as':_0x69ef('0x185'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x46')][_0x69ef('0x115')](db[_0x69ef('0x171')],{'as':_0x69ef('0x172'),'foreignKey':_0x69ef('0x186'),'onDelete':'cascade'});db[_0x69ef('0x46')]['hasMany'](db[_0x69ef('0x78')],{'as':_0x69ef('0x187'),'foreignKey':'FaxAccountId'});db[_0x69ef('0x46')][_0x69ef('0x115')](db[_0x69ef('0x49')],{'as':'Interactions'});db[_0x69ef('0x46')][_0x69ef('0x115')](db[_0x69ef('0x188')],{'as':_0x69ef('0x152'),'foreignKey':'FaxAccountId','onDelete':_0x69ef('0x112')});db['FaxAccount'][_0x69ef('0x115')](db[_0x69ef('0x118')],{'as':_0x69ef('0x189'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x46')]['hasMany'](db[_0x69ef('0x4b')],{'as':_0x69ef('0x166')});db[_0x69ef('0x46')][_0x69ef('0x126')](db['Trunk'],{'as':'Trunk'});db[_0x69ef('0x46')]['belongsTo'](db[_0x69ef('0xf4')],{'as':_0x69ef('0x174'),'foreignKey':_0x69ef('0x183')});db[_0x69ef('0x46')][_0x69ef('0x126')](db[_0x69ef('0x15d')],{'as':_0x69ef('0x15e'),'foreignKey':_0x69ef('0x15f')});db['FaxAccount'][_0x69ef('0x128')](db[_0x69ef('0x12')],{'as':'Agents','through':_0x69ef('0x147')});db[_0x69ef('0x188')]['belongsTo'](db[_0x69ef('0x12')],{'onDelete':_0x69ef('0x16d')});db[_0x69ef('0x188')][_0x69ef('0x126')](db[_0x69ef('0x4d')],{'onDelete':_0x69ef('0x16d')});db[_0x69ef('0x188')]['belongsTo'](db[_0x69ef('0x46')],{'onDelete':_0x69ef('0x16d')});db['FaxApplication'][_0x69ef('0x126')](db[_0x69ef('0x87')],{'onDelete':'restrict','foreignKey':_0x69ef('0x18a')});db[_0x69ef('0x49')][_0x69ef('0x115')](db[_0x69ef('0x4b')],{'as':'Messages','onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x18b')});db[_0x69ef('0x49')][_0x69ef('0x126')](db[_0x69ef('0x46')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x69ef('0x49')][_0x69ef('0x126')](db[_0x69ef('0x12c')],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x49')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'as':_0x69ef('0x179'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x49')][_0x69ef('0x128')](db[_0x69ef('0x87')],{'through':'fax_interaction_has_tags','as':_0x69ef('0x17b')});db[_0x69ef('0x49')][_0x69ef('0x128')](db[_0x69ef('0x87')],{'through':_0x69ef('0x18c'),'as':'ThroughTags'});db[_0x69ef('0x49')][_0x69ef('0x128')](db['User'],{'as':_0x69ef('0x17d'),'through':_0x69ef('0x133'),'foreignKey':'FaxInteractionId'});db[_0x69ef('0x4b')][_0x69ef('0x126')](db['User'],{'onDelete':'cascade','as':_0x69ef('0x12')});db[_0x69ef('0x4b')][_0x69ef('0x126')](db['FaxInteraction'],{'as':_0x69ef('0x180'),'foreignKey':_0x69ef('0x18b')});db[_0x69ef('0x4b')][_0x69ef('0x126')](db[_0x69ef('0x12c')],{'onDelete':_0x69ef('0x112'),'as':_0x69ef('0x178')});db[_0x69ef('0x4b')]['belongsTo'](db[_0x69ef('0x18d')],{'as':_0x69ef('0x18d'),'foreignKey':_0x69ef('0x18e')});db['FaxMessage'][_0x69ef('0x126')](db[_0x69ef('0x46')],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x186')});db['FaxQueue']['belongsToMany'](db['User'],{'as':_0x69ef('0x161'),'through':'UserFaxQueue'});db[_0x69ef('0x4d')][_0x69ef('0x128')](db[_0x69ef('0xe3')],{'through':_0x69ef('0x18f'),'as':'Teams'});db['FaxQueueReport'][_0x69ef('0x126')](db[_0x69ef('0x46')],{});db[_0x69ef('0x190')][_0x69ef('0x126')](db['CmList'],{'as':_0x69ef('0x174'),'foreignKey':_0x69ef('0x183')});db[_0x69ef('0x190')][_0x69ef('0x126')](db[_0x69ef('0x12c')],{'as':_0x69ef('0x178'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x69ef('0x126')](db[_0x69ef('0x49')],{});db[_0x69ef('0x190')][_0x69ef('0x126')](db['FaxMessage'],{});db[_0x69ef('0x190')][_0x69ef('0x126')](db[_0x69ef('0x12')],{});db['FaxQueueReport'][_0x69ef('0x126')](db['FaxQueue'],{});db[_0x69ef('0x191')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x69ef('0x192'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x191')][_0x69ef('0x115')](db[_0x69ef('0x78')],{'as':_0x69ef('0x187'),'foreignKey':'SmsAccountId'});db[_0x69ef('0x191')][_0x69ef('0x115')](db[_0x69ef('0x193')],{'as':_0x69ef('0x166'),'foreignKey':_0x69ef('0x192')});db[_0x69ef('0x191')]['hasMany'](db[_0x69ef('0x52')],{'as':_0x69ef('0x194')});db[_0x69ef('0x191')][_0x69ef('0x115')](db[_0x69ef('0x50')],{'as':_0x69ef('0x152'),'foreignKey':_0x69ef('0x192'),'onDelete':_0x69ef('0x112')});db['SmsAccount'][_0x69ef('0x126')](db[_0x69ef('0xf4')],{'as':_0x69ef('0x174'),'foreignKey':_0x69ef('0x183')});db[_0x69ef('0x191')][_0x69ef('0x126')](db[_0x69ef('0x15d')],{'as':_0x69ef('0x15e'),'foreignKey':_0x69ef('0x15f')});db[_0x69ef('0x191')]['belongsToMany'](db[_0x69ef('0x12')],{'as':_0x69ef('0x161'),'through':'user_has_sms_accounts'});db[_0x69ef('0x50')][_0x69ef('0x126')](db['User'],{'onDelete':_0x69ef('0x16d')});db[_0x69ef('0x50')][_0x69ef('0x126')](db['SmsQueue'],{'onDelete':'restrict'});db[_0x69ef('0x50')][_0x69ef('0x126')](db[_0x69ef('0x191')],{'onDelete':_0x69ef('0x16d')});db['SmsApplication']['belongsTo'](db['Interval'],{'onDelete':_0x69ef('0x16d'),'foreignKey':_0x69ef('0x15c')});db[_0x69ef('0x50')][_0x69ef('0x126')](db[_0x69ef('0x87')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x69ef('0x52')][_0x69ef('0x115')](db[_0x69ef('0x193')],{'as':_0x69ef('0x166'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x195')});db[_0x69ef('0x52')][_0x69ef('0x126')](db['SmsAccount'],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x192')});db[_0x69ef('0x52')][_0x69ef('0x126')](db[_0x69ef('0x12c')],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x52')]['belongsTo'](db[_0x69ef('0x12')],{'as':_0x69ef('0x179'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x52')][_0x69ef('0x128')](db[_0x69ef('0x87')],{'through':_0x69ef('0x196'),'as':_0x69ef('0x17b')});db[_0x69ef('0x52')]['belongsToMany'](db[_0x69ef('0x87')],{'through':_0x69ef('0x196'),'as':_0x69ef('0x17c')});db[_0x69ef('0x52')][_0x69ef('0x128')](db['User'],{'as':'Users','through':_0x69ef('0x134'),'foreignKey':_0x69ef('0x195')});db[_0x69ef('0x193')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'as':_0x69ef('0x12')});db[_0x69ef('0x193')][_0x69ef('0x126')](db[_0x69ef('0x12c')],{'onDelete':_0x69ef('0x112'),'as':_0x69ef('0x178')});db['SmsMessage'][_0x69ef('0x126')](db[_0x69ef('0x52')],{'onDelete':_0x69ef('0x112'),'as':'Interaction','foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db['SmsAccount'],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x192')});db[_0x69ef('0x197')][_0x69ef('0x128')](db[_0x69ef('0x12')],{'as':_0x69ef('0x161'),'through':_0x69ef('0x13f'),'foreignKey':_0x69ef('0x198')});db[_0x69ef('0x197')]['belongsToMany'](db['Team'],{'through':_0x69ef('0x199'),'as':_0x69ef('0x162')});db[_0x69ef('0x55')][_0x69ef('0x115')](db[_0x69ef('0x171')],{'as':_0x69ef('0x172'),'foreignKey':_0x69ef('0x19a'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x55')]['hasMany'](db[_0x69ef('0x78')],{'as':_0x69ef('0x187'),'foreignKey':_0x69ef('0x19a')});db[_0x69ef('0x55')][_0x69ef('0x115')](db[_0x69ef('0x59')],{'as':_0x69ef('0x194'),'foreignKey':_0x69ef('0x19a')});db['OpenchannelAccount'][_0x69ef('0x115')](db[_0x69ef('0x5b')],{'as':_0x69ef('0x166'),'foreignKey':_0x69ef('0x19a')});db['OpenchannelAccount'][_0x69ef('0x115')](db[_0x69ef('0x57')],{'as':_0x69ef('0x152'),'foreignKey':_0x69ef('0x19a'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x55')][_0x69ef('0x126')](db[_0x69ef('0xf4')],{'as':_0x69ef('0x174'),'foreignKey':_0x69ef('0x183')});db['OpenchannelAccount'][_0x69ef('0x126')](db['Pause'],{'as':_0x69ef('0x15e'),'foreignKey':_0x69ef('0x15f')});db[_0x69ef('0x55')]['belongsToMany'](db[_0x69ef('0x12')],{'as':_0x69ef('0x161'),'through':_0x69ef('0x19b')});db[_0x69ef('0x57')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'onDelete':_0x69ef('0x16d')});db['OpenchannelApplication'][_0x69ef('0x126')](db[_0x69ef('0x19c')],{'onDelete':_0x69ef('0x16d'),'foreignKey':_0x69ef('0x19d')});db['OpenchannelApplication'][_0x69ef('0x126')](db[_0x69ef('0x55')],{'onDelete':'restrict','foreignKey':_0x69ef('0x19a')});db[_0x69ef('0x57')][_0x69ef('0x126')](db[_0x69ef('0x7d')],{'onDelete':_0x69ef('0x16d'),'foreignKey':_0x69ef('0x15c')});db[_0x69ef('0x57')][_0x69ef('0x126')](db[_0x69ef('0x87')],{'onDelete':'restrict','foreignKey':_0x69ef('0x18a')});db[_0x69ef('0x59')][_0x69ef('0x115')](db[_0x69ef('0x5b')],{'as':_0x69ef('0x166'),'onDelete':_0x69ef('0x112'),'foreignKey':'OpenchannelInteractionId'});db[_0x69ef('0x59')]['belongsTo'](db[_0x69ef('0x55')],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x19a')});db[_0x69ef('0x59')][_0x69ef('0x126')](db[_0x69ef('0x12c')],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x59')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'as':_0x69ef('0x179'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x59')][_0x69ef('0x128')](db[_0x69ef('0x87')],{'through':'openchannel_interaction_has_tags','as':_0x69ef('0x17b')});db[_0x69ef('0x59')][_0x69ef('0x128')](db['Tag'],{'through':_0x69ef('0x19e'),'as':_0x69ef('0x17c')});db[_0x69ef('0x59')]['belongsToMany'](db[_0x69ef('0x12')],{'as':_0x69ef('0x17d'),'through':_0x69ef('0x135'),'foreignKey':_0x69ef('0x19f')});db['OpenchannelMessage'][_0x69ef('0x126')](db[_0x69ef('0x12')],{'onDelete':_0x69ef('0x112'),'as':_0x69ef('0x12')});db[_0x69ef('0x5b')]['belongsTo'](db[_0x69ef('0x12c')],{'onDelete':_0x69ef('0x112'),'as':_0x69ef('0x178')});db[_0x69ef('0x5b')][_0x69ef('0x126')](db[_0x69ef('0x59')],{'onDelete':_0x69ef('0x112'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x69ef('0x126')](db['Attachment'],{'as':'Attachment','foreignKey':_0x69ef('0x18e')});db[_0x69ef('0x5b')][_0x69ef('0x126')](db[_0x69ef('0x55')],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x19a')});db['OpenchannelQueue']['belongsToMany'](db['User'],{'as':_0x69ef('0x161'),'through':_0x69ef('0x141'),'foreignKey':'OpenchannelQueueId'});db[_0x69ef('0x19c')][_0x69ef('0x128')](db[_0x69ef('0xe3')],{'through':_0x69ef('0x1a0'),'as':_0x69ef('0x162')});db[_0x69ef('0x5e')][_0x69ef('0x115')](db['Disposition'],{'as':_0x69ef('0x172'),'foreignKey':_0x69ef('0x182'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x5e')][_0x69ef('0x115')](db[_0x69ef('0x78')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0x69ef('0x5e')][_0x69ef('0x115')](db['ChatProactiveAction'],{'as':_0x69ef('0x1a1')});db[_0x69ef('0x5e')][_0x69ef('0x115')](db[_0x69ef('0x63')],{'as':_0x69ef('0x194')});db['ChatWebsite']['hasMany'](db[_0x69ef('0x61')],{'as':_0x69ef('0x152'),'foreignKey':_0x69ef('0x182'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x5e')][_0x69ef('0x115')](db['ChatMessage'],{'as':'Messages'});db[_0x69ef('0x5e')][_0x69ef('0x126')](db['CmList'],{'as':_0x69ef('0x174'),'foreignKey':_0x69ef('0x183')});db[_0x69ef('0x5e')][_0x69ef('0x126')](db[_0x69ef('0x7d')],{'as':_0x69ef('0x7d'),'foreignKey':_0x69ef('0x15c')});db[_0x69ef('0x5e')][_0x69ef('0x126')](db['MailAccount'],{'as':_0x69ef('0x148'),'foreignKey':'MailAccountId'});db[_0x69ef('0x5e')][_0x69ef('0x126')](db[_0x69ef('0x15d')],{'as':_0x69ef('0x15e'),'foreignKey':_0x69ef('0x15f')});db['ChatWebsite']['belongsToMany'](db['User'],{'as':_0x69ef('0x161'),'through':_0x69ef('0x145')});db['OpenchannelQueueReport']['belongsTo'](db[_0x69ef('0x55')],{});db[_0x69ef('0x5f')]['belongsTo'](db[_0x69ef('0xf4')],{'as':'List','foreignKey':_0x69ef('0x183')});db[_0x69ef('0x5f')][_0x69ef('0x126')](db['CmContact'],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db['OpenchannelQueueReport'][_0x69ef('0x126')](db[_0x69ef('0x59')],{});db[_0x69ef('0x5f')]['belongsTo'](db[_0x69ef('0x5b')],{});db[_0x69ef('0x5f')][_0x69ef('0x126')](db['User'],{});db['OpenchannelQueueReport'][_0x69ef('0x126')](db[_0x69ef('0x19c')],{});db[_0x69ef('0x61')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'as':_0x69ef('0x1a2'),'foreignKey':'UserId','onDelete':'restrict'});db[_0x69ef('0x61')][_0x69ef('0x126')](db[_0x69ef('0x68')],{'as':'Queue','foreignKey':_0x69ef('0x1a3'),'onDelete':_0x69ef('0x16d')});db[_0x69ef('0x61')][_0x69ef('0x126')](db[_0x69ef('0x5e')],{'as':_0x69ef('0x1a4'),'foreignKey':_0x69ef('0x182'),'onDelete':_0x69ef('0x16d')});db[_0x69ef('0x61')]['belongsTo'](db['Tag'],{'onDelete':_0x69ef('0x16d'),'foreignKey':_0x69ef('0x18a')});db['ChatInteraction'][_0x69ef('0x115')](db[_0x69ef('0x64')],{'as':_0x69ef('0x166'),'onDelete':'cascade','foreignKey':_0x69ef('0x1a5')});db[_0x69ef('0x63')]['belongsTo'](db[_0x69ef('0x5e')],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x182')});db['ChatInteraction']['belongsTo'](db[_0x69ef('0x12c')],{'as':'Contact','foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x63')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x69ef('0x114')});db[_0x69ef('0x63')][_0x69ef('0x128')](db[_0x69ef('0x87')],{'through':'chat_interaction_has_tags','as':_0x69ef('0x17b')});db[_0x69ef('0x63')][_0x69ef('0x128')](db[_0x69ef('0x87')],{'through':_0x69ef('0x1a6'),'as':_0x69ef('0x17c')});db[_0x69ef('0x63')][_0x69ef('0x128')](db[_0x69ef('0x12')],{'as':'Users','through':_0x69ef('0x132'),'foreignKey':_0x69ef('0x1a5')});db[_0x69ef('0x64')]['belongsTo'](db['User'],{'onDelete':_0x69ef('0x112'),'as':'User'});db[_0x69ef('0x64')]['belongsTo'](db[_0x69ef('0x12c')],{'onDelete':'cascade','as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x64')][_0x69ef('0x126')](db[_0x69ef('0x63')],{'onDelete':_0x69ef('0x112'),'as':_0x69ef('0x180'),'foreignKey':_0x69ef('0x1a5')});db['ChatMessage'][_0x69ef('0x126')](db[_0x69ef('0x18d')],{'as':'Attachment','foreignKey':_0x69ef('0x18e')});db[_0x69ef('0x64')][_0x69ef('0x126')](db['ChatWebsite'],{'as':_0x69ef('0x181'),'foreignKey':'ChatWebsiteId'});db[_0x69ef('0x66')][_0x69ef('0x115')](db[_0x69ef('0x18d')],{'as':_0x69ef('0x17f'),'foreignKey':_0x69ef('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x69ef('0x66')]['belongsTo'](db[_0x69ef('0x12c')],{'onDelete':_0x69ef('0x112'),'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x66')][_0x69ef('0x126')](db[_0x69ef('0x5e')],{'as':'Account','foreignKey':_0x69ef('0x182')});db[_0x69ef('0x68')]['belongsToMany'](db[_0x69ef('0x12')],{'as':_0x69ef('0x161'),'through':'UserChatQueue','hooks':!![]});db[_0x69ef('0x68')][_0x69ef('0x128')](db[_0x69ef('0xe3')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x69ef('0x129')][_0x69ef('0x115')](db['ChatInternalMessage'],{'as':_0x69ef('0x166'),'foreignKey':_0x69ef('0x1a8'),'onDelete':'cascade'});db['ChatGroup'][_0x69ef('0x128')](db[_0x69ef('0x12')],{'as':'Members','through':_0x69ef('0x12b')});db[_0x69ef('0x6b')][_0x69ef('0x126')](db[_0x69ef('0x5e')],{'as':_0x69ef('0x1a4'),'foreignKey':_0x69ef('0x182')});db[_0x69ef('0x6d')][_0x69ef('0x115')](db['CmContact'],{'as':_0x69ef('0x12d'),'foreignKey':'CompanyId'});db[_0x69ef('0x12c')][_0x69ef('0x115')](db[_0x69ef('0x8a')],{'as':_0x69ef('0x1a9'),'foreignKey':_0x69ef('0x1aa')});db[_0x69ef('0x12c')][_0x69ef('0x115')](db[_0x69ef('0x70')],{'as':_0x69ef('0x124'),'foreignKey':'ContactId'});db[_0x69ef('0x12c')][_0x69ef('0x115')](db['CmHopperFinal'],{'as':_0x69ef('0x156'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x12c')][_0x69ef('0x115')](db[_0x69ef('0x11a')],{'as':_0x69ef('0x157'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x12c')][_0x69ef('0x115')](db[_0x69ef('0x74')],{'as':_0x69ef('0x74'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x12c')]['hasMany'](db['JscriptySessionReport'],{'as':_0x69ef('0x159'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x12c')][_0x69ef('0x115')](db['OpenchannelInteraction'],{'as':_0x69ef('0x11c'),'foreignKey':_0x69ef('0x16b'),'onDelete':'restrict'});db[_0x69ef('0x12c')][_0x69ef('0x115')](db[_0x69ef('0x63')],{'as':_0x69ef('0x11d'),'foreignKey':_0x69ef('0x16b'),'onDelete':_0x69ef('0x16d')});db['CmContact'][_0x69ef('0x115')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x69ef('0x16d')});db['CmContact'][_0x69ef('0x115')](db[_0x69ef('0x49')],{'as':_0x69ef('0x11f'),'foreignKey':_0x69ef('0x16b'),'onDelete':_0x69ef('0x16d')});db['CmContact'][_0x69ef('0x115')](db['MailInteraction'],{'as':_0x69ef('0x120'),'foreignKey':_0x69ef('0x16b'),'onDelete':_0x69ef('0x16d')});db['CmContact'][_0x69ef('0x126')](db[_0x69ef('0x6d')],{'as':_0x69ef('0x1ab'),'foreignKey':_0x69ef('0x1ac')});db['CmContact'][_0x69ef('0x126')](db[_0x69ef('0xf4')],{'as':'List','foreignKey':_0x69ef('0x183'),'onDelete':'cascade'});db[_0x69ef('0x12c')]['belongsToMany'](db[_0x69ef('0x12')],{'as':'Users','through':_0x69ef('0x12e')});db[_0x69ef('0x12c')][_0x69ef('0x128')](db[_0x69ef('0x87')],{'as':_0x69ef('0x17b'),'through':_0x69ef('0x1ad')});db['CmContact'][_0x69ef('0x128')](db[_0x69ef('0x87')],{'through':_0x69ef('0x1ad'),'as':_0x69ef('0x17c')});db[_0x69ef('0x70')][_0x69ef('0x115')](db[_0x69ef('0x8c')],{'as':_0x69ef('0x1ae'),'foreignKey':'CmHopperId'});db[_0x69ef('0x70')][_0x69ef('0x126')](db['CmContact'],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x70')]['belongsTo'](db[_0x69ef('0xf4')],{'as':_0x69ef('0x174'),'foreignKey':_0x69ef('0x183'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x70')][_0x69ef('0x126')](db['User'],{'as':_0x69ef('0x1a2'),'foreignKey':_0x69ef('0x114')});db[_0x69ef('0x70')][_0x69ef('0x126')](db['VoiceQueue'],{'as':_0x69ef('0x1af'),'foreignKey':_0x69ef('0x155'),'onDelete':_0x69ef('0x112')});db['CmHopper'][_0x69ef('0x126')](db[_0x69ef('0xe7')],{'as':'Campaign','foreignKey':_0x69ef('0x1b0'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x70')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'as':'Owner','foreignKey':_0x69ef('0x1b1')});db[_0x69ef('0x71')][_0x69ef('0x126')](db['CmContact'],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x71')][_0x69ef('0x126')](db[_0x69ef('0xf4')],{'as':'List','foreignKey':_0x69ef('0x183'),'onDelete':'cascade'});db[_0x69ef('0x71')]['belongsTo'](db[_0x69ef('0x137')],{'as':_0x69ef('0x1af'),'foreignKey':'VoiceQueueId','onDelete':_0x69ef('0x112')});db[_0x69ef('0x71')][_0x69ef('0x126')](db['Campaign'],{'as':_0x69ef('0xe7'),'foreignKey':_0x69ef('0x1b0'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x76')]['hasMany'](db['Condition'],{'as':{'plural':_0x69ef('0x1b2'),'singular':_0x69ef('0x1b3')},'foreignKey':_0x69ef('0x1b4'),'onDelete':_0x69ef('0x112'),'hooks':!![]});db[_0x69ef('0x76')]['hasMany'](db[_0x69ef('0x7b')],{'as':{'plural':'Any','singular':_0x69ef('0x1b5')},'foreignKey':_0x69ef('0x1b6'),'onDelete':_0x69ef('0x112'),'hooks':!![]});db[_0x69ef('0x76')][_0x69ef('0x115')](db['Action'],{'as':_0x69ef('0x1b7'),'foreignKey':'AutomationId','onDelete':_0x69ef('0x112'),'hooks':!![]});db[_0x69ef('0x171')][_0x69ef('0x115')](db[_0x69ef('0x171')],{'as':_0x69ef('0x172'),'foreignKey':'ParentId','onDelete':_0x69ef('0x112')});db['Interval'][_0x69ef('0x115')](db['Interval'],{'as':_0x69ef('0x1b8'),'foreignKey':_0x69ef('0x15c'),'onDelete':_0x69ef('0x112'),'hooks':!![],'required':![]});db['Interval'][_0x69ef('0x115')](db[_0x69ef('0x118')],{'as':_0x69ef('0x119'),'foreignKey':_0x69ef('0x15c'),'onDelete':'restrict'});db['Interval'][_0x69ef('0x115')](db[_0x69ef('0x1b9')],{'as':_0x69ef('0x1ba'),'foreignKey':'IntervalId'});db[_0x69ef('0x7d')][_0x69ef('0x115')](db[_0x69ef('0x61')],{'as':_0x69ef('0x1bb'),'foreignKey':_0x69ef('0x15c')});db[_0x69ef('0x7d')][_0x69ef('0x115')](db[_0x69ef('0x188')],{'as':_0x69ef('0x1bc'),'foreignKey':_0x69ef('0x15c')});db[_0x69ef('0x7d')]['hasMany'](db[_0x69ef('0x50')],{'as':_0x69ef('0x1bd'),'foreignKey':_0x69ef('0x15c')});db[_0x69ef('0x84')][_0x69ef('0x126')](db[_0x69ef('0x148')],{});db[_0x69ef('0x84')][_0x69ef('0x126')](db[_0x69ef('0x96')],{'foreignKey':_0x69ef('0x1be')});db[_0x69ef('0x84')][_0x69ef('0x126')](db['AnalyticCustomReport'],{'foreignKey':_0x69ef('0x1bf')});db[_0x69ef('0x153')][_0x69ef('0x128')](db[_0x69ef('0x18')],{'as':_0x69ef('0x1c0'),'through':_0x69ef('0x154'),'onDelete':_0x69ef('0x16d')});db[_0x69ef('0x87')][_0x69ef('0x128')](db[_0x69ef('0x12c')],{'through':_0x69ef('0x1ad')});db['Tag'][_0x69ef('0x128')](db['ChatInteraction'],{'through':_0x69ef('0x1a6')});db[_0x69ef('0x87')][_0x69ef('0x128')](db[_0x69ef('0x3f')],{'through':_0x69ef('0x17a')});db['Tag'][_0x69ef('0x128')](db[_0x69ef('0x52')],{'through':_0x69ef('0x196')});db[_0x69ef('0x87')][_0x69ef('0x128')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db['Tag'][_0x69ef('0x128')](db[_0x69ef('0x59')],{'through':_0x69ef('0x19e')});db[_0x69ef('0x87')][_0x69ef('0x128')](db[_0x69ef('0x101')],{'through':'whatsapp_interaction_has_tags'});db[_0x69ef('0x8a')][_0x69ef('0x126')](db[_0x69ef('0x1c1')],{'as':'ItemType','foreignKey':_0x69ef('0x1c2')});db[_0x69ef('0x8c')][_0x69ef('0x126')](db[_0x69ef('0x70')],{'as':_0x69ef('0x1c3'),'foreignKey':'CmHopperId'});db[_0x69ef('0x8a')][_0x69ef('0x126')](db['CmContact'],{'as':_0x69ef('0x178'),'foreignKey':'CmContactId'});db[_0x69ef('0x1c4')]['hasMany'](db[_0x69ef('0x7b')],{'as':{'plural':_0x69ef('0x1c5'),'singular':'AllCondition'},'foreignKey':_0x69ef('0x1c6'),'onDelete':'cascade','hooks':!![]});db[_0x69ef('0x1c4')][_0x69ef('0x115')](db[_0x69ef('0x7b')],{'as':{'plural':_0x69ef('0x1c7'),'singular':_0x69ef('0x1c8')},'foreignKey':_0x69ef('0x1c9'),'onDelete':_0x69ef('0x112'),'hooks':!![]});db[_0x69ef('0x1c4')][_0x69ef('0x115')](db['Action'],{'as':_0x69ef('0x1b7'),'foreignKey':_0x69ef('0x1ca'),'onDelete':'cascade','hooks':!![]});db[_0x69ef('0x95')][_0x69ef('0x115')](db[_0x69ef('0x9b')],{'as':_0x69ef('0x1cb'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1bf'),'hooks':!![]});db[_0x69ef('0x96')][_0x69ef('0x115')](db[_0x69ef('0x9b')],{'as':'Fields','onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1be')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':_0x69ef('0x1cb'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x69ef('0x9b')][_0x69ef('0x126')](db[_0x69ef('0x99')],{'foreignKey':'MetricId'});db[_0x69ef('0x1cc')][_0x69ef('0x115')](db[_0x69ef('0x9f')],{'as':_0x69ef('0x1cd'),'onDelete':_0x69ef('0x112'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x69ef('0x115')](db[_0x69ef('0xa1')],{'as':'Subjects','onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1ce')});db[_0x69ef('0x9f')][_0x69ef('0x115')](db[_0x69ef('0xa1')],{'as':_0x69ef('0x1cf'),'onDelete':_0x69ef('0x112'),'foreignKey':'DescriptionId'});db[_0x69ef('0x9f')][_0x69ef('0x115')](db[_0x69ef('0xa1')],{'as':_0x69ef('0x1cb'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d0')});db[_0x69ef('0x9f')]['belongsTo'](db[_0x69ef('0x1cc')],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xa1')][_0x69ef('0x115')](db[_0x69ef('0xa1')],{'as':'Subject','foreignKey':'SubjectId'});db['SalesforceField'][_0x69ef('0x115')](db['SalesforceField'],{'as':'Description','foreignKey':'DescriptionId'});db['SalesforceField'][_0x69ef('0x115')](db[_0x69ef('0xa1')],{'as':'Field','foreignKey':'FieldId'});db[_0x69ef('0xa1')][_0x69ef('0x126')](db[_0x69ef('0x90')],{'as':_0x69ef('0x90'),'foreignKey':_0x69ef('0x1d2')});db[_0x69ef('0xa3')][_0x69ef('0x115')](db[_0x69ef('0xa4')],{'as':_0x69ef('0x1cd'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xa4')]['hasMany'](db[_0x69ef('0x1d3')],{'as':'Subjects','onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1ce')});db[_0x69ef('0xa4')]['hasMany'](db[_0x69ef('0x1d3')],{'as':_0x69ef('0x1cf'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0xa4')][_0x69ef('0x115')](db['SugarcrmField'],{'as':'Fields','onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d0')});db[_0x69ef('0xa4')][_0x69ef('0x126')](db[_0x69ef('0xa3')],{'as':'Account','foreignKey':'AccountId'});db['SugarcrmField']['hasMany'](db[_0x69ef('0x1d3')],{'as':_0x69ef('0x1d5'),'foreignKey':_0x69ef('0x1ce')});db[_0x69ef('0x1d3')][_0x69ef('0x115')](db[_0x69ef('0x1d3')],{'as':_0x69ef('0x1d6'),'foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0x1d3')]['hasMany'](db[_0x69ef('0x1d3')],{'as':'Field','foreignKey':_0x69ef('0x1d0')});db[_0x69ef('0x1d3')][_0x69ef('0x126')](db[_0x69ef('0x90')],{'as':_0x69ef('0x90'),'foreignKey':'VariableId'});db[_0x69ef('0xa6')][_0x69ef('0x115')](db['DeskConfiguration'],{'as':_0x69ef('0x1cd'),'onDelete':'cascade','foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xa7')]['hasMany'](db['DeskField'],{'as':'Subjects','onDelete':_0x69ef('0x112'),'foreignKey':'SubjectId'});db[_0x69ef('0xa7')]['hasMany'](db[_0x69ef('0xa9')],{'as':_0x69ef('0x1cf'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0xa7')][_0x69ef('0x115')](db[_0x69ef('0xa9')],{'as':_0x69ef('0x1cb'),'onDelete':'cascade','foreignKey':_0x69ef('0x1d0')});db[_0x69ef('0xa7')][_0x69ef('0x126')](db[_0x69ef('0xa6')],{'as':'Account','foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xa7')][_0x69ef('0x128')](db[_0x69ef('0x87')],{'through':_0x69ef('0x1d7')});db[_0x69ef('0xa9')][_0x69ef('0x115')](db['DeskField'],{'as':_0x69ef('0x1d5'),'foreignKey':_0x69ef('0x1ce')});db[_0x69ef('0xa9')][_0x69ef('0x115')](db[_0x69ef('0xa9')],{'as':'Description','foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0xa9')][_0x69ef('0x115')](db[_0x69ef('0xa9')],{'as':'Field','foreignKey':_0x69ef('0x1d0')});db['DeskField'][_0x69ef('0x126')](db[_0x69ef('0x90')],{'as':_0x69ef('0x90'),'foreignKey':_0x69ef('0x1d2')});db[_0x69ef('0xab')]['hasMany'](db['ZohoConfiguration'],{'as':_0x69ef('0x1cd'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xac')][_0x69ef('0x115')](db[_0x69ef('0xae')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x69ef('0x1ce')});db['ZohoConfiguration']['hasMany'](db[_0x69ef('0xae')],{'as':_0x69ef('0x1cf'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d4')});db['ZohoConfiguration']['hasMany'](db[_0x69ef('0xae')],{'as':_0x69ef('0x1cb'),'onDelete':_0x69ef('0x112'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0x69ef('0x126')](db['ZohoAccount'],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xae')]['hasMany'](db['ZohoField'],{'as':_0x69ef('0x1d5'),'foreignKey':'SubjectId'});db[_0x69ef('0xae')][_0x69ef('0x115')](db[_0x69ef('0xae')],{'as':_0x69ef('0x1d6'),'foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0xae')][_0x69ef('0x115')](db[_0x69ef('0xae')],{'as':_0x69ef('0x1d8'),'foreignKey':'FieldId'});db[_0x69ef('0xae')][_0x69ef('0x126')](db[_0x69ef('0x90')],{'as':_0x69ef('0x90'),'foreignKey':_0x69ef('0x1d2')});db[_0x69ef('0x1d9')]['hasMany'](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0x1da')][_0x69ef('0x115')](db['ZendeskField'],{'as':_0x69ef('0x1db'),'foreignKey':_0x69ef('0x1ce')});db[_0x69ef('0x1da')][_0x69ef('0x115')](db['ZendeskField'],{'as':_0x69ef('0x1cf'),'foreignKey':'DescriptionId'});db[_0x69ef('0x1da')][_0x69ef('0x115')](db[_0x69ef('0x1dc')],{'as':_0x69ef('0x1cb'),'foreignKey':_0x69ef('0x1d0')});db[_0x69ef('0x1da')][_0x69ef('0x126')](db[_0x69ef('0x1d9')],{'as':_0x69ef('0x181'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x69ef('0x128')](db[_0x69ef('0x87')],{'through':_0x69ef('0x1dd')});db[_0x69ef('0x1dc')][_0x69ef('0x115')](db[_0x69ef('0x1dc')],{'as':_0x69ef('0x1d5'),'foreignKey':_0x69ef('0x1ce')});db['ZendeskField']['hasMany'](db[_0x69ef('0x1dc')],{'as':_0x69ef('0x1d6'),'foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0x1dc')]['hasMany'](db[_0x69ef('0x1dc')],{'as':'Field','foreignKey':_0x69ef('0x1d0')});db[_0x69ef('0x1dc')][_0x69ef('0x126')](db[_0x69ef('0x90')],{'as':'Variable','foreignKey':_0x69ef('0x1d2')});db['FreshdeskAccount'][_0x69ef('0x115')](db[_0x69ef('0xb5')],{'as':_0x69ef('0x1cd'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d1')});db['FreshdeskConfiguration']['hasMany'](db[_0x69ef('0xb6')],{'as':_0x69ef('0x1db'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1ce')});db[_0x69ef('0xb5')]['hasMany'](db[_0x69ef('0xb6')],{'as':_0x69ef('0x1cf'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d4')});db['FreshdeskConfiguration']['hasMany'](db[_0x69ef('0xb6')],{'as':_0x69ef('0x1cb'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d0')});db['FreshdeskConfiguration'][_0x69ef('0x126')](db[_0x69ef('0xb3')],{'as':'Account','foreignKey':'AccountId'});db[_0x69ef('0xb5')][_0x69ef('0x128')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x69ef('0x115')](db[_0x69ef('0xb6')],{'as':_0x69ef('0x1d5'),'foreignKey':'SubjectId'});db[_0x69ef('0xb6')]['hasMany'](db[_0x69ef('0xb6')],{'as':_0x69ef('0x1d6'),'foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0xb6')][_0x69ef('0x115')](db['FreshdeskField'],{'as':_0x69ef('0x1d8'),'foreignKey':'FieldId'});db[_0x69ef('0xb6')][_0x69ef('0x126')](db[_0x69ef('0x90')],{'as':_0x69ef('0x90'),'foreignKey':'VariableId'});db[_0x69ef('0xb8')][_0x69ef('0x115')](db['VtigerConfiguration'],{'as':_0x69ef('0x1cd'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xba')][_0x69ef('0x115')](db['VtigerField'],{'as':_0x69ef('0x1db'),'foreignKey':_0x69ef('0x1ce')});db['VtigerConfiguration'][_0x69ef('0x115')](db['VtigerField'],{'as':_0x69ef('0x1cf'),'foreignKey':_0x69ef('0x1d4')});db['VtigerConfiguration'][_0x69ef('0x115')](db[_0x69ef('0xbb')],{'as':'Fields','foreignKey':_0x69ef('0x1d0')});db[_0x69ef('0xba')][_0x69ef('0x126')](db[_0x69ef('0xb8')],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xbb')]['hasMany'](db[_0x69ef('0xbb')],{'as':_0x69ef('0x1d5'),'foreignKey':'SubjectId'});db['VtigerField'][_0x69ef('0x115')](db[_0x69ef('0xbb')],{'as':_0x69ef('0x1d6'),'foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0xbb')][_0x69ef('0x115')](db[_0x69ef('0xbb')],{'as':_0x69ef('0x1d8'),'foreignKey':_0x69ef('0x1d0')});db['VtigerField'][_0x69ef('0x126')](db['Variable'],{'as':_0x69ef('0x90'),'foreignKey':_0x69ef('0x1d2')});db['ServicenowAccount'][_0x69ef('0x115')](db[_0x69ef('0xbf')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xbf')][_0x69ef('0x115')](db[_0x69ef('0xc1')],{'as':'Subjects','foreignKey':_0x69ef('0x1ce')});db[_0x69ef('0xbf')][_0x69ef('0x115')](db[_0x69ef('0xc1')],{'as':_0x69ef('0x1cf'),'foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0xbf')][_0x69ef('0x115')](db['ServicenowField'],{'as':_0x69ef('0x1cb'),'foreignKey':_0x69ef('0x1d0')});db[_0x69ef('0xbf')][_0x69ef('0x126')](db[_0x69ef('0xbd')],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xc1')][_0x69ef('0x115')](db['ServicenowField'],{'as':_0x69ef('0x1d5'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0x69ef('0xc1')],{'as':_0x69ef('0x1d6'),'foreignKey':_0x69ef('0x1d4')});db['ServicenowField']['hasMany'](db[_0x69ef('0xc1')],{'as':'Field','foreignKey':_0x69ef('0x1d0')});db['ServicenowField']['belongsTo'](db[_0x69ef('0x90')],{'as':_0x69ef('0x90'),'foreignKey':_0x69ef('0x1d2')});db[_0x69ef('0x1de')]['hasMany'](db[_0x69ef('0xc4')],{'as':_0x69ef('0x1cd'),'onDelete':'cascade','foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0x1de')][_0x69ef('0x126')](db[_0x69ef('0x109')],{'as':_0x69ef('0x109'),'foreignKey':_0x69ef('0x16c')});db[_0x69ef('0xc4')][_0x69ef('0x115')](db[_0x69ef('0x1df')],{'as':_0x69ef('0x1db'),'onDelete':'cascade','foreignKey':_0x69ef('0x1ce')});db['Dynamics365Configuration'][_0x69ef('0x115')](db['Dynamics365Field'],{'as':_0x69ef('0x1cf'),'onDelete':_0x69ef('0x112'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0x69ef('0x1cb'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d0')});db[_0x69ef('0xc4')]['belongsTo'](db['Dynamics365Account'],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x1d1')});db['Dynamics365Field'][_0x69ef('0x115')](db[_0x69ef('0x1df')],{'as':_0x69ef('0x1d5'),'foreignKey':_0x69ef('0x1ce')});db[_0x69ef('0x1df')][_0x69ef('0x115')](db[_0x69ef('0x1df')],{'as':_0x69ef('0x1d6'),'foreignKey':'DescriptionId'});db[_0x69ef('0x1df')]['hasMany'](db[_0x69ef('0x1df')],{'as':'Field','foreignKey':_0x69ef('0x1d0')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0x69ef('0x90'),'foreignKey':_0x69ef('0x1d2')});db['FreshsalesAccount'][_0x69ef('0x115')](db['FreshsalesConfiguration'],{'as':_0x69ef('0x1cd'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xc8')]['hasMany'](db[_0x69ef('0xca')],{'as':_0x69ef('0x1db'),'foreignKey':_0x69ef('0x1ce')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x69ef('0x1cf'),'foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0xc8')][_0x69ef('0x115')](db[_0x69ef('0xca')],{'as':'Fields','foreignKey':_0x69ef('0x1d0')});db[_0x69ef('0xc8')][_0x69ef('0x126')](db[_0x69ef('0xc7')],{'as':_0x69ef('0x181'),'foreignKey':_0x69ef('0x1d1')});db[_0x69ef('0xca')][_0x69ef('0x115')](db['FreshsalesField'],{'as':_0x69ef('0x1d5'),'foreignKey':_0x69ef('0x1ce')});db[_0x69ef('0xca')][_0x69ef('0x115')](db[_0x69ef('0xca')],{'as':_0x69ef('0x1d6'),'foreignKey':_0x69ef('0x1d4')});db[_0x69ef('0xca')][_0x69ef('0x115')](db[_0x69ef('0xca')],{'as':_0x69ef('0x1d8'),'foreignKey':_0x69ef('0x1d0')});db['FreshsalesField'][_0x69ef('0x126')](db[_0x69ef('0x90')],{'as':_0x69ef('0x90'),'foreignKey':_0x69ef('0x1d2')});db[_0x69ef('0xce')][_0x69ef('0x126')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x69ef('0x126')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x69ef('0xce')][_0x69ef('0x126')](db['CmContact'],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0xce')]['belongsTo'](db[_0x69ef('0x63')],{});db[_0x69ef('0xce')][_0x69ef('0x126')](db[_0x69ef('0x64')],{});db[_0x69ef('0xce')][_0x69ef('0x126')](db['User'],{});db[_0x69ef('0xce')]['belongsTo'](db[_0x69ef('0x68')],{});db[_0x69ef('0xcf')][_0x69ef('0x126')](db['User'],{'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1e0')});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x1e1')});db[_0x69ef('0xd3')]['hasMany'](db[_0x69ef('0x1e2')],{'foreignKey':_0x69ef('0x1e3'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0xd3')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x69ef('0x1e3'),'onDelete':'cascade'});db[_0x69ef('0x1e4')][_0x69ef('0x126')](db[_0x69ef('0x191')],{});db[_0x69ef('0x1e4')][_0x69ef('0x126')](db[_0x69ef('0xf4')],{'as':_0x69ef('0x174'),'foreignKey':_0x69ef('0x183')});db['SmsQueueReport'][_0x69ef('0x126')](db[_0x69ef('0x12c')],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x1e4')][_0x69ef('0x126')](db[_0x69ef('0x52')],{});db[_0x69ef('0x1e4')][_0x69ef('0x126')](db['SmsMessage'],{});db[_0x69ef('0x1e4')][_0x69ef('0x126')](db[_0x69ef('0x12')],{});db[_0x69ef('0x1e4')][_0x69ef('0x126')](db['SmsQueue'],{});db['JscriptyProject']['hasMany'](db[_0x69ef('0xd3')],{'foreignKey':_0x69ef('0x1e5')});db[_0x69ef('0xd9')][_0x69ef('0x115')](db[_0x69ef('0x1e2')],{'foreignKey':_0x69ef('0x1e5')});db[_0x69ef('0xd9')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x69ef('0x1e5')});db[_0x69ef('0xe3')][_0x69ef('0x128')](db[_0x69ef('0x12')],{'as':'Agents','through':'user_has_teams'});db[_0x69ef('0xe3')][_0x69ef('0x128')](db[_0x69ef('0x137')],{'through':_0x69ef('0x163'),'as':'VoiceQueues'});db[_0x69ef('0xe3')][_0x69ef('0x128')](db[_0x69ef('0x3b')],{'through':_0x69ef('0x176'),'as':_0x69ef('0x1e6')});db[_0x69ef('0xe3')][_0x69ef('0x128')](db[_0x69ef('0x68')],{'through':'team_has_chat_queues','as':_0x69ef('0x13c')});db[_0x69ef('0xe3')][_0x69ef('0x128')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0x69ef('0x1e7')});db[_0x69ef('0xe3')]['belongsToMany'](db['SmsQueue'],{'through':_0x69ef('0x199'),'as':'SmsQueues'});db[_0x69ef('0xe3')][_0x69ef('0x128')](db['OpenchannelQueue'],{'through':_0x69ef('0x1a0'),'as':_0x69ef('0x140')});db[_0x69ef('0xe3')][_0x69ef('0x128')](db[_0x69ef('0x142')],{'through':_0x69ef('0x1e8'),'as':_0x69ef('0x143')});db['Team']['belongsToMany'](db[_0x69ef('0xf6')],{'through':_0x69ef('0x10c'),'as':_0x69ef('0x13a')});db['Campaign'][_0x69ef('0x115')](db[_0x69ef('0x70')],{'as':'Hoppers','foreignKey':_0x69ef('0x1b0')});db[_0x69ef('0xe7')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x69ef('0x1b0')});db['Campaign']['hasMany'](db['CmHopperHistory'],{'as':_0x69ef('0x157'),'foreignKey':'CampaignId'});db[_0x69ef('0xe7')][_0x69ef('0x115')](db[_0x69ef('0x71')],{'as':_0x69ef('0x158'),'foreignKey':_0x69ef('0x1b0')});db[_0x69ef('0xe7')][_0x69ef('0x126')](db['Trunk'],{'as':_0x69ef('0x29'),'foreignKey':_0x69ef('0x15a')});db[_0x69ef('0xe7')][_0x69ef('0x126')](db[_0x69ef('0x29')],{'as':'TrunkBackup','foreignKey':_0x69ef('0x15b')});db[_0x69ef('0xe7')][_0x69ef('0x126')](db[_0x69ef('0x7d')],{'as':_0x69ef('0x7d'),'foreignKey':_0x69ef('0x15c')});db[_0x69ef('0xe7')][_0x69ef('0x126')](db[_0x69ef('0xdf')],{'as':_0x69ef('0xdf'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x69ef('0x128')](db['CmList'],{'as':_0x69ef('0x12f'),'through':_0x69ef('0x1e9')});db[_0x69ef('0xe7')][_0x69ef('0x128')](db[_0x69ef('0xf4')],{'as':_0x69ef('0x164'),'through':'campaigns_has_cm_blacklists'});db['Attachment']['belongsTo'](db[_0x69ef('0x66')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x69ef('0xec')]['belongsTo'](db['MailMessage'],{});db['MailTransferReport']['belongsTo'](db[_0x69ef('0x3f')],{});db[_0x69ef('0xec')]['belongsTo'](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0x69ef('0x1ea')});db['MailTransferReport'][_0x69ef('0x126')](db[_0x69ef('0x12')],{'foreignKey':_0x69ef('0x1eb'),'as':_0x69ef('0x1ec')});db['MailTransferReport'][_0x69ef('0x126')](db[_0x69ef('0x12')],{'foreignKey':_0x69ef('0x1ed'),'as':_0x69ef('0x1ee')});db['MailTransferReport']['belongsTo'](db[_0x69ef('0x3b')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x69ef('0xec')][_0x69ef('0x126')](db[_0x69ef('0x148')],{'foreignKey':_0x69ef('0x1ef'),'as':_0x69ef('0x1f0')});db['ChatTransferReport'][_0x69ef('0x126')](db['ChatMessage'],{});db['ChatTransferReport'][_0x69ef('0x126')](db['ChatInteraction'],{});db['ChatTransferReport'][_0x69ef('0x126')](db[_0x69ef('0x5e')],{'foreignKey':_0x69ef('0x1f1'),'as':_0x69ef('0x1ea')});db[_0x69ef('0xee')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'foreignKey':'FromUserId','as':_0x69ef('0x1ec')});db[_0x69ef('0xee')]['belongsTo'](db['User'],{'foreignKey':_0x69ef('0x1ed'),'as':_0x69ef('0x1ee')});db[_0x69ef('0xee')][_0x69ef('0x126')](db[_0x69ef('0x68')],{'foreignKey':'ToChatQueueId','as':_0x69ef('0x1f2')});db[_0x69ef('0xee')][_0x69ef('0x126')](db[_0x69ef('0x5e')],{'foreignKey':_0x69ef('0x1f3'),'as':_0x69ef('0x1f0')});db[_0x69ef('0xf0')]['belongsTo'](db['FaxMessage'],{});db[_0x69ef('0xf0')][_0x69ef('0x126')](db['FaxInteraction'],{});db[_0x69ef('0xf0')][_0x69ef('0x126')](db[_0x69ef('0x46')],{'foreignKey':'FromFaxAccountId','as':_0x69ef('0x1ea')});db[_0x69ef('0xf0')][_0x69ef('0x126')](db['User'],{'foreignKey':_0x69ef('0x1eb'),'as':_0x69ef('0x1ec')});db[_0x69ef('0xf0')][_0x69ef('0x126')](db['User'],{'foreignKey':'ToUserId','as':_0x69ef('0x1ee')});db[_0x69ef('0xf0')]['belongsTo'](db[_0x69ef('0x4d')],{'foreignKey':_0x69ef('0x1f4'),'as':_0x69ef('0x1f2')});db['FaxTransferReport'][_0x69ef('0x126')](db[_0x69ef('0x46')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0x69ef('0x126')](db[_0x69ef('0x5b')],{});db[_0x69ef('0xf2')][_0x69ef('0x126')](db[_0x69ef('0x59')],{});db[_0x69ef('0xf2')][_0x69ef('0x126')](db[_0x69ef('0x55')],{'foreignKey':'FromOpenchannelAccountId','as':_0x69ef('0x1ea')});db[_0x69ef('0xf2')]['belongsTo'](db['User'],{'foreignKey':_0x69ef('0x1eb'),'as':_0x69ef('0x1ec')});db['OpenchannelTransferReport'][_0x69ef('0x126')](db[_0x69ef('0x12')],{'foreignKey':_0x69ef('0x1ed'),'as':_0x69ef('0x1ee')});db[_0x69ef('0xf2')][_0x69ef('0x126')](db[_0x69ef('0x19c')],{'foreignKey':'ToOpenchannelQueueId','as':_0x69ef('0x1f2')});db[_0x69ef('0xf2')][_0x69ef('0x126')](db['OpenchannelAccount'],{'foreignKey':_0x69ef('0x1f5'),'as':'ToAccount'});db[_0x69ef('0xf3')][_0x69ef('0x126')](db[_0x69ef('0x193')],{});db['SmsTransferReport'][_0x69ef('0x126')](db[_0x69ef('0x52')],{});db[_0x69ef('0xf3')][_0x69ef('0x126')](db[_0x69ef('0x191')],{'foreignKey':_0x69ef('0x1f6'),'as':_0x69ef('0x1ea')});db['SmsTransferReport'][_0x69ef('0x126')](db[_0x69ef('0x12')],{'foreignKey':_0x69ef('0x1eb'),'as':_0x69ef('0x1ec')});db[_0x69ef('0xf3')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'foreignKey':'ToUserId','as':_0x69ef('0x1ee')});db['SmsTransferReport'][_0x69ef('0x126')](db[_0x69ef('0x197')],{'foreignKey':'ToSmsQueueId','as':_0x69ef('0x1f2')});db[_0x69ef('0xf3')]['belongsTo'](db[_0x69ef('0x191')],{'foreignKey':_0x69ef('0x1f7'),'as':_0x69ef('0x1f0')});db['CmList']['hasMany'](db[_0x69ef('0x171')],{'as':_0x69ef('0x172'),'foreignKey':'ListId','onDelete':_0x69ef('0x112')});db[_0x69ef('0xf4')][_0x69ef('0x115')](db[_0x69ef('0x1f8')],{'as':_0x69ef('0x1f9'),'foreignKey':_0x69ef('0x183')});db[_0x69ef('0xf4')][_0x69ef('0x115')](db['CmContact'],{'as':'Contacts','onDelete':_0x69ef('0x112'),'foreignKey':'ListId'});db[_0x69ef('0xf4')]['hasMany'](db[_0x69ef('0x72')],{'as':_0x69ef('0x156'),'foreignKey':'ListId'});db[_0x69ef('0xf4')][_0x69ef('0x115')](db[_0x69ef('0x11a')],{'as':_0x69ef('0x11b'),'foreignKey':_0x69ef('0x183')});db[_0x69ef('0xf4')][_0x69ef('0x115')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x69ef('0x183')});db[_0x69ef('0xf4')]['belongsToMany'](db[_0x69ef('0x137')],{'as':'Queues','through':_0x69ef('0x160')});db['CmList'][_0x69ef('0x128')](db['User'],{'as':_0x69ef('0x161'),'through':_0x69ef('0x130')});db['VoicePrefix'][_0x69ef('0x115')](db[_0x69ef('0x118')],{'as':'Extensions','onDelete':'cascade'});db[_0x69ef('0xf6')]['belongsToMany'](db[_0x69ef('0x12')],{'as':_0x69ef('0x161'),'through':_0x69ef('0x13b')});db[_0x69ef('0xf6')]['belongsToMany'](db[_0x69ef('0xe3')],{'through':_0x69ef('0x10c'),'as':_0x69ef('0x162')});db['UserProfile'][_0x69ef('0x115')](db[_0x69ef('0x12')],{'as':'Users','foreignKey':_0x69ef('0x1fa')});db[_0x69ef('0x127')][_0x69ef('0x115')](db[_0x69ef('0xf9')],{'as':_0x69ef('0x1fb'),'foreignKey':_0x69ef('0x1fa'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0xf9')][_0x69ef('0x115')](db['UserProfileResource'],{'as':_0x69ef('0x1fc'),'foreignKey':_0x69ef('0x1fd'),'onDelete':_0x69ef('0x112')});db[_0x69ef('0x1fe')][_0x69ef('0x115')](db['Disposition'],{'as':_0x69ef('0x172'),'foreignKey':_0x69ef('0x1ff'),'onDelete':_0x69ef('0x112')});db['WhatsappAccount'][_0x69ef('0x115')](db[_0x69ef('0x78')],{'as':_0x69ef('0x187'),'foreignKey':_0x69ef('0x1ff')});db['WhatsappAccount'][_0x69ef('0x115')](db['WhatsappMessage'],{'as':_0x69ef('0x166'),'foreignKey':'WhatsappAccountId'});db[_0x69ef('0x1fe')][_0x69ef('0x115')](db[_0x69ef('0x101')],{'as':'Interactions'});db[_0x69ef('0x1fe')][_0x69ef('0x115')](db[_0x69ef('0xff')],{'as':_0x69ef('0x152'),'foreignKey':_0x69ef('0x1ff'),'onDelete':'cascade'});db[_0x69ef('0x1fe')][_0x69ef('0x126')](db[_0x69ef('0xf4')],{'as':_0x69ef('0x174'),'foreignKey':'ListId'});db[_0x69ef('0x1fe')][_0x69ef('0x126')](db[_0x69ef('0x15d')],{'as':_0x69ef('0x15e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x69ef('0x1fe')]['belongsToMany'](db[_0x69ef('0x12')],{'as':'Agents','through':_0x69ef('0x14f')});db[_0x69ef('0xff')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'onDelete':_0x69ef('0x16d')});db[_0x69ef('0xff')][_0x69ef('0x126')](db[_0x69ef('0x142')],{'onDelete':_0x69ef('0x16d')});db[_0x69ef('0xff')][_0x69ef('0x126')](db[_0x69ef('0x1fe')],{'onDelete':_0x69ef('0x16d')});db[_0x69ef('0xff')][_0x69ef('0x126')](db[_0x69ef('0x7d')],{'onDelete':_0x69ef('0x16d'),'foreignKey':_0x69ef('0x15c')});db[_0x69ef('0xff')][_0x69ef('0x126')](db['Tag'],{'onDelete':_0x69ef('0x16d'),'foreignKey':_0x69ef('0x18a')});db[_0x69ef('0x101')]['hasMany'](db[_0x69ef('0x103')],{'as':_0x69ef('0x166'),'onDelete':_0x69ef('0x112'),'foreignKey':_0x69ef('0x200')});db[_0x69ef('0x101')]['belongsTo'](db['WhatsappAccount'],{'as':_0x69ef('0x181'),'foreignKey':'WhatsappAccountId'});db[_0x69ef('0x101')][_0x69ef('0x126')](db[_0x69ef('0x12c')],{'as':'Contact','foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x101')][_0x69ef('0x126')](db['User'],{'as':'Owner','foreignKey':_0x69ef('0x114')});db[_0x69ef('0x101')][_0x69ef('0x128')](db['Tag'],{'through':_0x69ef('0x201'),'as':'Tags'});db[_0x69ef('0x101')][_0x69ef('0x128')](db[_0x69ef('0x87')],{'through':_0x69ef('0x201'),'as':_0x69ef('0x17c')});db[_0x69ef('0x101')][_0x69ef('0x128')](db[_0x69ef('0x12')],{'as':_0x69ef('0x17d'),'through':'user_has_whatsapp_interactions','foreignKey':_0x69ef('0x200')});db['WhatsappMessage'][_0x69ef('0x126')](db[_0x69ef('0x12')],{'as':'User'});db[_0x69ef('0x103')][_0x69ef('0x126')](db['CmContact'],{'onDelete':_0x69ef('0x112'),'as':_0x69ef('0x178')});db[_0x69ef('0x103')][_0x69ef('0x126')](db[_0x69ef('0x101')],{'onDelete':_0x69ef('0x112'),'as':_0x69ef('0x180'),'foreignKey':_0x69ef('0x200')});db['WhatsappMessage'][_0x69ef('0x126')](db[_0x69ef('0x1fe')],{'as':_0x69ef('0x181'),'foreignKey':'WhatsappAccountId'});db[_0x69ef('0x104')][_0x69ef('0x126')](db[_0x69ef('0x1fe')],{});db[_0x69ef('0x104')][_0x69ef('0x126')](db[_0x69ef('0xf4')],{'as':_0x69ef('0x174'),'foreignKey':'ListId'});db[_0x69ef('0x104')][_0x69ef('0x126')](db['CmContact'],{'as':_0x69ef('0x178'),'foreignKey':_0x69ef('0x16b')});db[_0x69ef('0x104')][_0x69ef('0x126')](db[_0x69ef('0x101')],{});db[_0x69ef('0x104')][_0x69ef('0x126')](db[_0x69ef('0x142')],{});db[_0x69ef('0x104')]['belongsTo'](db[_0x69ef('0x103')],{});db[_0x69ef('0x104')][_0x69ef('0x126')](db[_0x69ef('0x12')],{});db[_0x69ef('0x106')][_0x69ef('0x126')](db['WhatsappMessage'],{});db[_0x69ef('0x106')][_0x69ef('0x126')](db['WhatsappInteraction'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x69ef('0x1fe')],{'foreignKey':'FromWhatsappAccountId','as':_0x69ef('0x1ea')});db['WhatsappTransferReport'][_0x69ef('0x126')](db[_0x69ef('0x1fe')],{'foreignKey':'ToWhatsappAccountId','as':_0x69ef('0x1f0')});db[_0x69ef('0x106')]['belongsTo'](db[_0x69ef('0x142')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x69ef('0x106')][_0x69ef('0x126')](db[_0x69ef('0x12')],{'foreignKey':_0x69ef('0x1eb'),'as':_0x69ef('0x1ec')});db[_0x69ef('0x106')][_0x69ef('0x126')](db['User'],{'foreignKey':_0x69ef('0x1ed'),'as':_0x69ef('0x1ee')});db[_0x69ef('0x142')][_0x69ef('0x128')](db[_0x69ef('0x12')],{'as':_0x69ef('0x161'),'through':_0x69ef('0x35'),'foreignKey':'WhatsappQueueId'});db[_0x69ef('0x142')][_0x69ef('0x128')](db[_0x69ef('0xe3')],{'through':_0x69ef('0x1e8'),'as':_0x69ef('0x162')});db['UserSetting'][_0x69ef('0x126')](db[_0x69ef('0x12')],{'as':_0x69ef('0x202'),'foreignKey':_0x69ef('0x114'),'onDelete':_0x69ef('0x112'),'hooks':!![]});db[_0x69ef('0x109')]['hasOne'](db['Dynamics365Account'],{'as':_0x69ef('0x1de'),'onDelete':_0x69ef('0x16d')});db[_0x69ef('0x109')][_0x69ef('0x111')](db[_0x69ef('0x37')],{'as':_0x69ef('0x16f'),'onDelete':_0x69ef('0x16d')});db[_0x69ef('0x109')][_0x69ef('0x111')](db['MailServerOut'],{'as':_0x69ef('0x170'),'onDelete':_0x69ef('0x16d')});module[_0x69ef('0x203')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x89f4=['../api/template/template.model','Variable','../api/integration/integration.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../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','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','MailInteractions','WhatsappInteractions','SenderId','Hoppers','SET\x20NULL','belongsTo','UserProfile','userProfileId','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','FaxInteraction','FaxInteractions','user_has_fax_interactions','SmsInteractions','user_has_openchannel_interactions','WhatsappInteraction','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','UserMailQueue','ChatQueue','SmsQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Sound','Sounds','moh_has_sounds','UserVoiceQueueRt','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','CloudProviderId','MailAccountId','Imap','Dispositions','CannedAnswer','Answers','Applications','List','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Account','Tags','ThroughTags','Users','Attachments','ChatWebsite','ChatWebsiteId','ChatOfflineMessage','restrict','ListId','Items','FaxAccountId','Interactions','FaxApplication','FaxInteractionId','ContactId','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsInteractionId','Owner','sms_interaction_has_tags','user_has_sms_interactions','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','TagId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','CmCompany','CompanyId','Phones','HopperHistories','Company','cm_contact_has_tags','Campaign','CampaignId','Condition','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','mail_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','CmContactId','Trigger','AllConditions','AllCondition','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','AnalyticDefaultReport','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','SugarcrmAccount','FieldId','VariableId','DeskAccount','DeskConfiguration','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskAccount','int_freshdesk_configuration_has_tags','FreshsalesField','FromId','ToId','ProjectId','team_has_fax_queues','FaxQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappApplication','WhatsappInteractionId','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','Smtp','exports','sequelize','lodash','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','mysql','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxMessage','FaxQueue','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template'];(function(_0x499c28,_0x302e1c){var _0xf47fed=function(_0x44dcd0){while(--_0x44dcd0){_0x499c28['push'](_0x499c28['shift']());}};_0xf47fed(++_0x302e1c);}(_0x89f4,0x17a));var _0x489f=function(_0x55a47d,_0x1608e0){_0x55a47d=_0x55a47d-0x0;var _0x5d583f=_0x89f4[_0x55a47d];return _0x5d583f;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x489f('0x0'));var _=require(_0x489f('0x1'));var jstz=require('jstz');var timezone=jstz[_0x489f('0x2')]();config[_0x489f('0x0')]=_[_0x489f('0x3')](config[_0x489f('0x0')],{'database':_0x489f('0x4'),'username':_0x489f('0x5'),'password':_0x489f('0x6'),'options':{'host':_0x489f('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x489f('0x8')},'logging':![],'timezone':timezone[_0x489f('0x9')](),'define':{'charset':_0x489f('0xa'),'collate':_0x489f('0xb')}}});config[_0x489f('0xc')]=_['defaultsDeep'](config[_0x489f('0xc')],{'database':_0x489f('0x4'),'username':_0x489f('0x5'),'password':_0x489f('0x6'),'options':{'host':_0x489f('0x7'),'port':0xcea,'dialect':_0x489f('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x489f('0xa'),'collate':_0x489f('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x489f('0xe')],config[_0x489f('0x0')][_0x489f('0xf')],config[_0x489f('0x0')][_0x489f('0x10')],config['sequelize'][_0x489f('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x489f('0xc')][_0x489f('0xe')],config[_0x489f('0xc')][_0x489f('0xf')],config[_0x489f('0xc')][_0x489f('0x10')],config[_0x489f('0xc')][_0x489f('0x11')])};db[_0x489f('0x12')]=db['sequelize'][_0x489f('0x13')]('../api/user/user.model');db[_0x489f('0x14')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x15'));db['VoiceContext']=db['sequelize'][_0x489f('0x13')](_0x489f('0x16'));db[_0x489f('0x17')]=db['sequelize'][_0x489f('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x489f('0x18')]=db[_0x489f('0x0')]['import'](_0x489f('0x19'));db['VoiceQueue']=db[_0x489f('0x0')]['import']('../api/voiceQueue/voiceQueue.model');db[_0x489f('0x1a')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x1b'));db[_0x489f('0x1c')]=db[_0x489f('0x0')]['import']('../api/screenRecording/screenRecording.model');db[_0x489f('0x1d')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/voiceMail/voiceMail.model');db[_0x489f('0x1e')]=db[_0x489f('0x0')]['import'](_0x489f('0x1f'));db[_0x489f('0x20')]=db[_0x489f('0x0')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x489f('0x21')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0x489f('0x22')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x23'));db[_0x489f('0x24')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x489f('0x25')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x26'));db[_0x489f('0x27')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x28'));db[_0x489f('0x29')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x2a'));db['UserVoiceQueueRt']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x2b'));db[_0x489f('0x2c')]=db[_0x489f('0x0')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x489f('0x2d')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x2e'));db['UserMailQueue']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x2f'));db[_0x489f('0x30')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x31'));db[_0x489f('0x32')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x33'));db[_0x489f('0x34')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x489f('0x35')]=db[_0x489f('0x0')]['import'](_0x489f('0x36'));db[_0x489f('0x37')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db['sequelize'][_0x489f('0x13')](_0x489f('0x38'));db['MailQueue']=db[_0x489f('0x0')]['import'](_0x489f('0x39'));db['MailSubstatus']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x3a'));db[_0x489f('0x3b')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x489f('0x3c')]=db[_0x489f('0x0')]['import'](_0x489f('0x3d'));db[_0x489f('0x3e')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x3f'));db[_0x489f('0x40')]=db['sequelize'][_0x489f('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0x489f('0x41')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x42'));db[_0x489f('0x43')]=db['sequelize']['import'](_0x489f('0x44'));db[_0x489f('0x45')]=db['sequelize']['import'](_0x489f('0x46'));db['FaxApplication']=db[_0x489f('0x0')][_0x489f('0x13')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0x489f('0x0')][_0x489f('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x489f('0x47')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/faxMessage/faxMessage.model');db[_0x489f('0x48')]=db['sequelize'][_0x489f('0x13')]('../api/faxQueue/faxQueue.model');db[_0x489f('0x49')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0x489f('0x4a')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x4b'));db[_0x489f('0x4c')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x4d'));db[_0x489f('0x4e')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/smsInteraction/smsInteraction.model');db[_0x489f('0x4f')]=db[_0x489f('0x0')]['import'](_0x489f('0x50'));db['SmsQueue']=db[_0x489f('0x0')][_0x489f('0x13')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x51'));db[_0x489f('0x52')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x53'));db[_0x489f('0x54')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x55'));db[_0x489f('0x56')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x57'));db[_0x489f('0x58')]=db[_0x489f('0x0')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db['sequelize'][_0x489f('0x13')](_0x489f('0x59'));db[_0x489f('0x5a')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x5b'));db[_0x489f('0x5c')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x5d'));db[_0x489f('0x5e')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x5f'));db[_0x489f('0x60')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x61'));db['ChatOfflineMessage']=db[_0x489f('0x0')][_0x489f('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x489f('0x0')][_0x489f('0x13')]('../api/chatQueue/chatQueue.model');db[_0x489f('0x62')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x63'));db[_0x489f('0x64')]=db[_0x489f('0x0')]['import'](_0x489f('0x65'));db['CmCompany']=db[_0x489f('0x0')][_0x489f('0x13')]('../api/cmCompany/cmCompany.model');db[_0x489f('0x66')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x67'));db[_0x489f('0x68')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/cmHopper/cmHopper.model');db[_0x489f('0x69')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x6a'));db[_0x489f('0x6b')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x6c'));db['CmHopperHistory']=db['sequelize'][_0x489f('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x489f('0x6d')]=db['sequelize'][_0x489f('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x489f('0x6e')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x489f('0x6f')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x70'));db[_0x489f('0x71')]=db[_0x489f('0x0')]['import'](_0x489f('0x72'));db['CannedAnswer']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x73'));db[_0x489f('0x74')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x75'));db['Condition']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x76'));db[_0x489f('0x77')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/interval/interval.model');db[_0x489f('0x78')]=db[_0x489f('0x0')]['import'](_0x489f('0x79'));db['Cdr']=db['sequelize'][_0x489f('0x13')](_0x489f('0x7a'));db[_0x489f('0x7b')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x489f('0x7c')]=db['sequelize']['import'](_0x489f('0x7d'));db['Sound']=db['sequelize']['import'](_0x489f('0x7e'));db[_0x489f('0x7f')]=db['sequelize']['import'](_0x489f('0x80'));db[_0x489f('0x81')]=db['sequelize']['import'](_0x489f('0x82'));db['CmContactHasItem']=db[_0x489f('0x0')]['import'](_0x489f('0x83'));db[_0x489f('0x84')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x85'));db[_0x489f('0x86')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x87'));db['Trigger']=db['sequelize'][_0x489f('0x13')]('../api/trigger/trigger.model');db[_0x489f('0x88')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/variable/variable.model');db['Integration']=db[_0x489f('0x0')]['import'](_0x489f('0x89'));db['IntegrationReport']=db[_0x489f('0x0')]['import']('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x489f('0x0')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db['sequelize'][_0x489f('0x13')](_0x489f('0x8a'));db[_0x489f('0x8b')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x8c'));db[_0x489f('0x8d')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x8e'));db[_0x489f('0x8f')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x90'));db['AnalyticTreeReport']=db[_0x489f('0x0')][_0x489f('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x489f('0x91')]=db[_0x489f('0x0')]['import'](_0x489f('0x92'));db[_0x489f('0x93')]=db[_0x489f('0x0')]['import'](_0x489f('0x94'));db[_0x489f('0x95')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x96'));db['SugarcrmAccount']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x97'));db[_0x489f('0x98')]=db[_0x489f('0x0')]['import'](_0x489f('0x99'));db[_0x489f('0x9a')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x9b'));db['DeskAccount']=db['sequelize'][_0x489f('0x13')](_0x489f('0x9c'));db['DeskConfiguration']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x9d'));db[_0x489f('0x9e')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/intDeskField/intDeskField.model');db[_0x489f('0x9f')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xa0'));db[_0x489f('0xa1')]=db['sequelize']['import'](_0x489f('0xa2'));db['ZohoField']=db['sequelize']['import'](_0x489f('0xa3'));db[_0x489f('0xa4')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xa5'));db[_0x489f('0xa6')]=db[_0x489f('0x0')]['import'](_0x489f('0xa7'));db[_0x489f('0xa8')]=db['sequelize']['import'](_0x489f('0xa9'));db['FreshdeskAccount']=db['sequelize']['import'](_0x489f('0xaa'));db['FreshdeskConfiguration']=db[_0x489f('0x0')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x489f('0xab')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xac'));db[_0x489f('0xad')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xae'));db[_0x489f('0xaf')]=db['sequelize'][_0x489f('0x13')](_0x489f('0xb0'));db[_0x489f('0xb1')]=db['sequelize']['import'](_0x489f('0xb2'));db[_0x489f('0xb3')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xb4'));db[_0x489f('0xb5')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x489f('0xb6')]=db['sequelize'][_0x489f('0x13')](_0x489f('0xb7'));db[_0x489f('0xb8')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xb9'));db[_0x489f('0xba')]=db['sequelize'][_0x489f('0x13')](_0x489f('0xbb'));db[_0x489f('0xbc')]=db[_0x489f('0x0')]['import'](_0x489f('0xbd'));db[_0x489f('0xbe')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xbf'));db[_0x489f('0xc0')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xc1'));db['FreshsalesField']=db[_0x489f('0x0')][_0x489f('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x489f('0xc2')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x89'));db[_0x489f('0xc3')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xc4'));db[_0x489f('0xc5')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xc6'));db[_0x489f('0xc7')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xc8'));db[_0x489f('0xc9')]=db[_0x489f('0x0')]['import'](_0x489f('0xca'));db[_0x489f('0xcb')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xcc'));db[_0x489f('0xcd')]=db[_0x489f('0x0')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x489f('0xce')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xcf'));db[_0x489f('0xd0')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xd1'));db[_0x489f('0xd2')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xd3'));db[_0x489f('0xd4')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xd5'));db[_0x489f('0xd6')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xd7'));db[_0x489f('0xd8')]=db[_0x489f('0x0')]['import'](_0x489f('0xd9'));db[_0x489f('0xda')]=db[_0x489f('0x0')]['import'](_0x489f('0xdb'));db[_0x489f('0xdc')]=db[_0x489f('0x0')]['import'](_0x489f('0xdd'));db[_0x489f('0xde')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xdf'));db[_0x489f('0xe0')]=db[_0x489f('0x0')]['import']('../api/team/team.model');db[_0x489f('0xe1')]=db['sequelize'][_0x489f('0x13')](_0x489f('0xe2'));db['Campaign']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xe3'));db[_0x489f('0xe4')]=db[_0x489f('0x0')][_0x489f('0x13')]('../api/migration/migration.model');db[_0x489f('0xe5')]=db['sequelize']['import'](_0x489f('0xe6'));db['Plugin']=db['sequelize'][_0x489f('0x13')](_0x489f('0xe7'));db[_0x489f('0xe8')]=db[_0x489f('0x0')]['import'](_0x489f('0xe9'));db[_0x489f('0xea')]=db['sequelize'][_0x489f('0x13')](_0x489f('0xeb'));db[_0x489f('0xec')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xed'));db[_0x489f('0xee')]=db[_0x489f('0x0')]['import'](_0x489f('0xef'));db[_0x489f('0xf0')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xf1'));db[_0x489f('0xf2')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xf3'));db[_0x489f('0xf4')]=db['sequelize']['import']('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0x489f('0x0')]['import']('../api/userProfile/userProfile.model');db[_0x489f('0xf5')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xf6'));db[_0x489f('0xf7')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xf8'));db[_0x489f('0xf9')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xfa'));db[_0x489f('0xfb')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xfc'));db['WhatsappApplication']=db[_0x489f('0x0')]['import']('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0xfd'));db[_0x489f('0xfe')]=db[_0x489f('0x0')]['import'](_0x489f('0xff'));db[_0x489f('0x100')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x101'));db['WhatsappTransferReport']=db['sequelize']['import'](_0x489f('0x102'));db[_0x489f('0x103')]=db['sequelize'][_0x489f('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0x489f('0x104')]=db[_0x489f('0x0')]['import'](_0x489f('0x105'));db[_0x489f('0x106')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x107'));db[_0x489f('0x108')]=db[_0x489f('0x0')][_0x489f('0x13')](_0x489f('0x109'));db[_0x489f('0x10a')]=db[_0x489f('0x0')]['import'](_0x489f('0x10b'));db[_0x489f('0x10c')]=db['sequelize'][_0x489f('0x13')](_0x489f('0x10d'));db['MailInteractionHasTag']=db['sequelize'][_0x489f('0x13')](_0x489f('0x10e'));db[_0x489f('0x12')][_0x489f('0x10f')](db[_0x489f('0x1d')],{'as':_0x489f('0x1d'),'onDelete':_0x489f('0x110'),'foreignKey':'UserId'});db[_0x489f('0x12')][_0x489f('0x10f')](db['UserSetting'],{'as':'userSetting','onDelete':_0x489f('0x110'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x489f('0x1a')],{'as':'Recordings','foreignKey':_0x489f('0x111')});db['User'][_0x489f('0x112')](db['UserVoiceQueueRt'],{'as':_0x489f('0x113'),'foreignKey':_0x489f('0x111')});db[_0x489f('0x12')][_0x489f('0x112')](db['VoiceExtension'],{'as':_0x489f('0x114'),'onDelete':_0x489f('0x110'),'hooks':!![]});db['User'][_0x489f('0x112')](db['CmHopperFinal'],{'as':_0x489f('0x115'),'foreignKey':'UserId'});db[_0x489f('0x12')]['hasMany'](db[_0x489f('0x116')],{'as':_0x489f('0x117'),'foreignKey':_0x489f('0x111')});db[_0x489f('0x12')][_0x489f('0x112')](db[_0x489f('0x6d')],{'as':_0x489f('0x6d'),'foreignKey':'UserId'});db[_0x489f('0x12')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x489f('0x118'),'foreignKey':'UserId'});db[_0x489f('0x12')][_0x489f('0x112')](db['ChatInteraction'],{'as':_0x489f('0x119'),'foreignKey':_0x489f('0x111')});db['User']['hasMany'](db[_0x489f('0x4e')],{'as':'SmsInteractions','foreignKey':_0x489f('0x111')});db['User'][_0x489f('0x112')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x489f('0x12')][_0x489f('0x112')](db['MailInteraction'],{'as':_0x489f('0x11a'),'foreignKey':_0x489f('0x111')});db[_0x489f('0x12')][_0x489f('0x112')](db['WhatsappInteraction'],{'as':_0x489f('0x11b'),'foreignKey':_0x489f('0x111')});db['User']['hasMany'](db[_0x489f('0xf9')],{'as':'UserNotifications','foreignKey':_0x489f('0x11c')});db[_0x489f('0x12')][_0x489f('0x112')](db[_0x489f('0x68')],{'as':_0x489f('0x11d'),'foreignKey':_0x489f('0x111'),'onDelete':_0x489f('0x11e')});db[_0x489f('0x12')][_0x489f('0x11f')](db[_0x489f('0x120')],{'as':_0x489f('0x120'),'foreignKey':_0x489f('0x121')});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x62')],{'as':'Groups','through':'chat_group_has_users'});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x66')],{'as':_0x489f('0x123'),'through':_0x489f('0x124')});db['User'][_0x489f('0x122')](db['CmList'],{'as':_0x489f('0x125'),'through':_0x489f('0x126')});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0xe0')],{'through':_0x489f('0x127')});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x3b')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x489f('0x12')][_0x489f('0x122')](db['ChatInteraction'],{'as':_0x489f('0x119'),'through':'user_has_chat_interactions'});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x128')],{'as':_0x489f('0x129'),'through':_0x489f('0x12a')});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x4e')],{'as':_0x489f('0x12b'),'through':'user_has_sms_interactions'});db[_0x489f('0x12')][_0x489f('0x122')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x489f('0x12c')});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x12d')],{'as':_0x489f('0x11b'),'through':_0x489f('0x12e')});db['User'][_0x489f('0x122')](db[_0x489f('0x12f')],{'as':_0x489f('0x130'),'through':_0x489f('0x2c'),'required':![]});db[_0x489f('0x12')]['belongsToMany'](db[_0x489f('0xf4')],{'as':_0x489f('0x131'),'through':_0x489f('0x10a'),'required':![]});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x132')],{'as':_0x489f('0x133'),'through':_0x489f('0x134'),'required':![]});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x135')],{'as':'ChatQueues','through':_0x489f('0x2d'),'required':![],'hooks':!![]});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x48')],{'as':'FaxQueues','through':_0x489f('0x30'),'required':![]});db[_0x489f('0x12')]['belongsToMany'](db[_0x489f('0x136')],{'as':_0x489f('0x137'),'through':_0x489f('0x32'),'required':![]});db['User'][_0x489f('0x122')](db[_0x489f('0x58')],{'as':_0x489f('0x138'),'through':_0x489f('0x139'),'required':![]});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x103')],{'as':_0x489f('0x13a'),'through':_0x489f('0x34'),'required':![]});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0xf2')],{'through':_0x489f('0x126')});db['User'][_0x489f('0x122')](db['ChatWebsite'],{'as':_0x489f('0x13b'),'through':_0x489f('0x13c')});db[_0x489f('0x12')]['belongsToMany'](db[_0x489f('0x45')],{'as':_0x489f('0x13d'),'through':_0x489f('0x13e')});db['User']['belongsToMany'](db[_0x489f('0x13f')],{'as':_0x489f('0x140'),'through':_0x489f('0x141')});db[_0x489f('0x12')][_0x489f('0x122')](db[_0x489f('0x142')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db['User'][_0x489f('0x122')](db[_0x489f('0x4a')],{'as':_0x489f('0x143'),'through':_0x489f('0x144')});db[_0x489f('0x12')]['belongsToMany'](db[_0x489f('0xfb')],{'as':_0x489f('0x145'),'through':'user_has_whatsapp_accounts'});db[_0x489f('0x14')][_0x489f('0x112')](db[_0x489f('0x17')],{'as':_0x489f('0x146'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x147')});db['VoiceContext'][_0x489f('0x112')](db[_0x489f('0x17')],{'onDelete':_0x489f('0x110')});db[_0x489f('0x17')][_0x489f('0x112')](db['VoiceExtension'],{'as':'Applications','onDelete':_0x489f('0x110')});db[_0x489f('0x18')]['belongsToMany'](db[_0x489f('0x148')],{'as':_0x489f('0x149'),'through':_0x489f('0x14a')});db[_0x489f('0x12f')][_0x489f('0x112')](db[_0x489f('0x14b')],{'as':'Members','foreignKey':_0x489f('0x14c')});db[_0x489f('0x12f')]['hasMany'](db[_0x489f('0x68')],{'as':_0x489f('0x11d'),'foreignKey':_0x489f('0x14c')});db['VoiceQueue']['hasMany'](db[_0x489f('0x6b')],{'as':'HopperFinals','foreignKey':_0x489f('0x14c')});db[_0x489f('0x12f')][_0x489f('0x112')](db[_0x489f('0x116')],{'as':'HopperHistories','foreignKey':_0x489f('0x14c')});db[_0x489f('0x12f')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x489f('0x12f')][_0x489f('0x112')](db['CmHopperBlack'],{'as':_0x489f('0x14d'),'foreignKey':_0x489f('0x14c')});db['VoiceQueue'][_0x489f('0x112')](db[_0x489f('0xcd')],{'as':_0x489f('0x14e'),'foreignKey':_0x489f('0x14c')});db[_0x489f('0x12f')][_0x489f('0x11f')](db[_0x489f('0x27')],{'as':_0x489f('0x27'),'foreignKey':_0x489f('0x14f')});db[_0x489f('0x12f')][_0x489f('0x11f')](db[_0x489f('0x27')],{'as':_0x489f('0x150'),'foreignKey':_0x489f('0x151')});db[_0x489f('0x12f')][_0x489f('0x11f')](db[_0x489f('0x77')],{'as':_0x489f('0x77'),'foreignKey':_0x489f('0x152')});db[_0x489f('0x12f')][_0x489f('0x11f')](db[_0x489f('0x78')],{'as':_0x489f('0x153'),'foreignKey':_0x489f('0x154')});db[_0x489f('0x12f')][_0x489f('0x122')](db[_0x489f('0xf2')],{'as':_0x489f('0x125'),'through':_0x489f('0x155')});db[_0x489f('0x12f')]['belongsToMany'](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':_0x489f('0x2c')});db[_0x489f('0x12f')][_0x489f('0x122')](db['Team'],{'as':'Teams','through':_0x489f('0x106')});db[_0x489f('0x12f')][_0x489f('0x122')](db['CmList'],{'as':_0x489f('0x157'),'through':_0x489f('0x158')});db['VoiceRecording'][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':_0x489f('0x12'),'foreignKey':_0x489f('0x111')});db[_0x489f('0x1c')][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':_0x489f('0x12'),'foreignKey':_0x489f('0x111')});db[_0x489f('0x1d')][_0x489f('0x112')](db[_0x489f('0x1e')],{'as':_0x489f('0x159'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x489f('0x15a')});db[_0x489f('0x1e')][_0x489f('0x11f')](db[_0x489f('0x1d')],{'foreignKey':_0x489f('0x15b'),'targetKey':_0x489f('0x15a')});db[_0x489f('0x20')]['hasMany'](db[_0x489f('0x24')],{'as':_0x489f('0x15c'),'foreignKey':_0x489f('0x15d'),'constraints':![]});db[_0x489f('0x20')][_0x489f('0x112')](db['VoiceAgentReport'],{'as':_0x489f('0x15e'),'foreignKey':_0x489f('0x15d'),'constraints':![]});db[_0x489f('0x20')][_0x489f('0x11f')](db['User'],{'as':_0x489f('0x12'),'foreignKey':_0x489f('0x111')});db['VoiceCallReport'][_0x489f('0x11f')](db[_0x489f('0x66')],{'as':_0x489f('0x15f'),'foreignKey':'ContactId'});db['MailServerIn']['belongsTo'](db[_0x489f('0x13f')],{'as':_0x489f('0x13f'),'foreignKey':'MailAccountId'});db['MailServerIn']['belongsTo'](db[_0x489f('0x104')],{'as':'CloudProvider','foreignKey':_0x489f('0x160'),'onDelete':'restrict'});db[_0x489f('0x37')][_0x489f('0x11f')](db[_0x489f('0x13f')],{'as':_0x489f('0x13f'),'foreignKey':_0x489f('0x161')});db[_0x489f('0x37')]['belongsTo'](db[_0x489f('0x104')],{'as':_0x489f('0x104'),'foreignKey':_0x489f('0x160'),'onDelete':'restrict'});db['MailAccount'][_0x489f('0x10f')](db[_0x489f('0x35')],{'as':_0x489f('0x162'),'onDelete':_0x489f('0x110')});db[_0x489f('0x13f')][_0x489f('0x10f')](db[_0x489f('0x37')],{'as':'Smtp','onDelete':_0x489f('0x110')});db[_0x489f('0x13f')][_0x489f('0x112')](db[_0x489f('0x74')],{'as':_0x489f('0x163'),'foreignKey':_0x489f('0x161'),'onDelete':_0x489f('0x110')});db['MailAccount']['hasMany'](db[_0x489f('0x164')],{'as':_0x489f('0x165'),'foreignKey':_0x489f('0x161')});db[_0x489f('0x13f')][_0x489f('0x112')](db[_0x489f('0x3c')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x489f('0x13f')][_0x489f('0x112')](db[_0x489f('0x3b')],{'as':'Interactions'});db[_0x489f('0x13f')][_0x489f('0x112')](db[_0x489f('0x3e')],{'as':_0x489f('0x166'),'foreignKey':_0x489f('0x161'),'onDelete':_0x489f('0x110')});db[_0x489f('0x13f')]['belongsTo'](db[_0x489f('0xf2')],{'as':_0x489f('0x167'),'foreignKey':'ListId'});db[_0x489f('0x13f')][_0x489f('0x11f')](db['Template'],{'as':_0x489f('0x86'),'foreignKey':_0x489f('0x168')});db[_0x489f('0x13f')][_0x489f('0x11f')](db[_0x489f('0x78')],{'as':_0x489f('0x153'),'foreignKey':_0x489f('0x154')});db[_0x489f('0x13f')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':_0x489f('0x141')});db['MailQueue'][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':_0x489f('0x134')});db['MailQueue']['belongsToMany'](db[_0x489f('0xe0')],{'through':_0x489f('0x169'),'as':_0x489f('0x16a')});db['MailInteraction'][_0x489f('0x112')](db[_0x489f('0x3c')],{'as':_0x489f('0x159'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x16b')});db[_0x489f('0x3b')][_0x489f('0x11f')](db['MailAccount'],{'as':_0x489f('0x16c'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x489f('0x11f')](db[_0x489f('0x66')],{'as':'Contact','foreignKey':'ContactId'});db[_0x489f('0x3b')][_0x489f('0x11f')](db['User'],{'as':'Owner','foreignKey':_0x489f('0x111')});db['MailInteraction'][_0x489f('0x122')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x489f('0x16d')});db[_0x489f('0x3b')][_0x489f('0x122')](db[_0x489f('0x7f')],{'through':'mail_interaction_has_tags','as':_0x489f('0x16e')});db[_0x489f('0x3b')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x16f'),'through':'user_has_mail_interactions','foreignKey':_0x489f('0x16b')});db[_0x489f('0x3c')][_0x489f('0x112')](db[_0x489f('0xe5')],{'as':_0x489f('0x170'),'onDelete':'cascade'});db[_0x489f('0x3c')][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':_0x489f('0x12')});db[_0x489f('0x3c')]['belongsTo'](db['CmContact'],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x15f')});db[_0x489f('0x3c')][_0x489f('0x11f')](db[_0x489f('0x3b')],{'as':'Interaction','foreignKey':_0x489f('0x16b')});db[_0x489f('0x3c')]['belongsTo'](db['MailAccount'],{'as':_0x489f('0x16c'),'foreignKey':'MailAccountId'});db[_0x489f('0x3c')][_0x489f('0x11f')](db[_0x489f('0x171')],{'as':_0x489f('0x171'),'foreignKey':_0x489f('0x172')});db[_0x489f('0x3c')][_0x489f('0x11f')](db[_0x489f('0x173')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x489f('0x11f')](db[_0x489f('0x12')],{'onDelete':_0x489f('0x174')});db[_0x489f('0x3e')][_0x489f('0x11f')](db[_0x489f('0x132')],{'onDelete':_0x489f('0x174')});db[_0x489f('0x3e')]['belongsTo'](db['MailAccount'],{'onDelete':'restrict'});db[_0x489f('0x3e')][_0x489f('0x11f')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x489f('0x152')});db[_0x489f('0x3e')][_0x489f('0x11f')](db[_0x489f('0x7f')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport'][_0x489f('0x11f')](db['MailAccount'],{});db[_0x489f('0x40')][_0x489f('0x11f')](db[_0x489f('0xf2')],{'as':_0x489f('0x167'),'foreignKey':_0x489f('0x175')});db['MailQueueReport'][_0x489f('0x11f')](db['CmContact'],{'as':_0x489f('0x15f'),'foreignKey':'ContactId'});db[_0x489f('0x40')]['belongsTo'](db['MailInteraction'],{});db[_0x489f('0x40')][_0x489f('0x11f')](db[_0x489f('0x3c')],{});db[_0x489f('0x40')][_0x489f('0x11f')](db[_0x489f('0x12')],{});db[_0x489f('0x40')]['belongsTo'](db[_0x489f('0x132')],{});db['Dashboard'][_0x489f('0x112')](db[_0x489f('0x43')],{'as':_0x489f('0x176'),'onDelete':_0x489f('0x110')});db[_0x489f('0x45')][_0x489f('0x112')](db[_0x489f('0x74')],{'as':'Dispositions','foreignKey':_0x489f('0x177'),'onDelete':'cascade'});db[_0x489f('0x45')][_0x489f('0x112')](db[_0x489f('0x164')],{'as':_0x489f('0x165'),'foreignKey':_0x489f('0x177')});db[_0x489f('0x45')]['hasMany'](db['FaxInteraction'],{'as':_0x489f('0x178')});db[_0x489f('0x45')][_0x489f('0x112')](db['FaxApplication'],{'as':'Applications','foreignKey':_0x489f('0x177'),'onDelete':'cascade'});db[_0x489f('0x45')][_0x489f('0x112')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0x489f('0x110')});db[_0x489f('0x45')][_0x489f('0x112')](db[_0x489f('0x47')],{'as':'Messages'});db[_0x489f('0x45')][_0x489f('0x11f')](db['Trunk'],{'as':_0x489f('0x27')});db[_0x489f('0x45')][_0x489f('0x11f')](db[_0x489f('0xf2')],{'as':'List','foreignKey':'ListId'});db[_0x489f('0x45')][_0x489f('0x11f')](db['Pause'],{'as':_0x489f('0x153'),'foreignKey':_0x489f('0x154')});db[_0x489f('0x45')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':_0x489f('0x13e')});db[_0x489f('0x179')][_0x489f('0x11f')](db[_0x489f('0x12')],{'onDelete':_0x489f('0x174')});db[_0x489f('0x179')]['belongsTo'](db[_0x489f('0x48')],{'onDelete':_0x489f('0x174')});db['FaxApplication'][_0x489f('0x11f')](db[_0x489f('0x45')],{'onDelete':_0x489f('0x174')});db[_0x489f('0x179')][_0x489f('0x11f')](db[_0x489f('0x7f')],{'onDelete':_0x489f('0x174'),'foreignKey':'TagId'});db[_0x489f('0x128')][_0x489f('0x112')](db[_0x489f('0x47')],{'as':_0x489f('0x159'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x17a')});db['FaxInteraction'][_0x489f('0x11f')](db[_0x489f('0x45')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x489f('0x128')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x489f('0x17b')});db[_0x489f('0x128')]['belongsTo'](db[_0x489f('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x489f('0x128')]['belongsToMany'](db[_0x489f('0x7f')],{'through':'fax_interaction_has_tags','as':_0x489f('0x16d')});db[_0x489f('0x128')]['belongsToMany'](db[_0x489f('0x7f')],{'through':_0x489f('0x17c'),'as':_0x489f('0x16e')});db[_0x489f('0x128')][_0x489f('0x122')](db['User'],{'as':_0x489f('0x16f'),'through':'user_has_fax_interactions','foreignKey':_0x489f('0x17a')});db[_0x489f('0x47')][_0x489f('0x11f')](db[_0x489f('0x12')],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x12')});db[_0x489f('0x47')]['belongsTo'](db[_0x489f('0x128')],{'as':'Interaction','foreignKey':_0x489f('0x17a')});db['FaxMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x489f('0x110'),'as':'Contact'});db['FaxMessage']['belongsTo'](db[_0x489f('0xe5')],{'as':_0x489f('0xe5'),'foreignKey':_0x489f('0x17d')});db[_0x489f('0x47')][_0x489f('0x11f')](db[_0x489f('0x45')],{'as':_0x489f('0x16c'),'foreignKey':'FaxAccountId'});db[_0x489f('0x48')][_0x489f('0x122')](db['User'],{'as':_0x489f('0x156'),'through':'UserFaxQueue'});db[_0x489f('0x48')]['belongsToMany'](db[_0x489f('0xe0')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x489f('0x49')][_0x489f('0x11f')](db[_0x489f('0x45')],{});db[_0x489f('0x49')][_0x489f('0x11f')](db['CmList'],{'as':_0x489f('0x167'),'foreignKey':_0x489f('0x175')});db[_0x489f('0x49')][_0x489f('0x11f')](db[_0x489f('0x66')],{'as':_0x489f('0x15f'),'foreignKey':_0x489f('0x17b')});db[_0x489f('0x49')][_0x489f('0x11f')](db[_0x489f('0x128')],{});db['FaxQueueReport'][_0x489f('0x11f')](db[_0x489f('0x47')],{});db[_0x489f('0x49')]['belongsTo'](db[_0x489f('0x12')],{});db['FaxQueueReport'][_0x489f('0x11f')](db[_0x489f('0x48')],{});db['SmsAccount'][_0x489f('0x112')](db[_0x489f('0x74')],{'as':_0x489f('0x163'),'foreignKey':'SmsAccountId','onDelete':_0x489f('0x110')});db['SmsAccount'][_0x489f('0x112')](db[_0x489f('0x164')],{'as':_0x489f('0x165'),'foreignKey':_0x489f('0x17e')});db[_0x489f('0x4a')][_0x489f('0x112')](db[_0x489f('0x4f')],{'as':_0x489f('0x159'),'foreignKey':_0x489f('0x17e')});db[_0x489f('0x4a')][_0x489f('0x112')](db[_0x489f('0x4e')],{'as':_0x489f('0x178')});db[_0x489f('0x4a')]['hasMany'](db['SmsApplication'],{'as':_0x489f('0x166'),'foreignKey':_0x489f('0x17e'),'onDelete':_0x489f('0x110')});db[_0x489f('0x4a')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db['SmsAccount'][_0x489f('0x11f')](db[_0x489f('0x78')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x489f('0x4a')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':_0x489f('0x144')});db[_0x489f('0x4c')][_0x489f('0x11f')](db[_0x489f('0x12')],{'onDelete':_0x489f('0x174')});db[_0x489f('0x4c')][_0x489f('0x11f')](db['SmsQueue'],{'onDelete':_0x489f('0x174')});db[_0x489f('0x4c')][_0x489f('0x11f')](db['SmsAccount'],{'onDelete':_0x489f('0x174')});db['SmsApplication'][_0x489f('0x11f')](db['Interval'],{'onDelete':_0x489f('0x174'),'foreignKey':_0x489f('0x152')});db['SmsApplication']['belongsTo'](db[_0x489f('0x7f')],{'onDelete':'restrict','foreignKey':'TagId'});db['SmsInteraction'][_0x489f('0x112')](db[_0x489f('0x4f')],{'as':_0x489f('0x159'),'onDelete':'cascade','foreignKey':_0x489f('0x17f')});db['SmsInteraction'][_0x489f('0x11f')](db[_0x489f('0x4a')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x17e')});db['SmsInteraction']['belongsTo'](db[_0x489f('0x66')],{'as':_0x489f('0x15f'),'foreignKey':_0x489f('0x17b')});db[_0x489f('0x4e')][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':_0x489f('0x180'),'foreignKey':_0x489f('0x111')});db[_0x489f('0x4e')][_0x489f('0x122')](db['Tag'],{'through':_0x489f('0x181'),'as':'Tags'});db['SmsInteraction'][_0x489f('0x122')](db['Tag'],{'through':_0x489f('0x181'),'as':_0x489f('0x16e')});db['SmsInteraction'][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x16f'),'through':_0x489f('0x182'),'foreignKey':_0x489f('0x17f')});db['SmsMessage'][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':_0x489f('0x12')});db[_0x489f('0x4f')]['belongsTo'](db['CmContact'],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x15f')});db['SmsMessage'][_0x489f('0x11f')](db[_0x489f('0x4e')],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x183'),'foreignKey':_0x489f('0x17f')});db[_0x489f('0x4f')][_0x489f('0x11f')](db[_0x489f('0x4a')],{'as':'Account','foreignKey':_0x489f('0x17e')});db[_0x489f('0x136')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':'UserSmsQueue','foreignKey':_0x489f('0x184')});db[_0x489f('0x136')][_0x489f('0x122')](db['Team'],{'through':_0x489f('0x185'),'as':_0x489f('0x16a')});db[_0x489f('0x142')][_0x489f('0x112')](db[_0x489f('0x74')],{'as':_0x489f('0x163'),'foreignKey':_0x489f('0x186'),'onDelete':_0x489f('0x110')});db['OpenchannelAccount'][_0x489f('0x112')](db[_0x489f('0x164')],{'as':_0x489f('0x165'),'foreignKey':_0x489f('0x186')});db[_0x489f('0x142')][_0x489f('0x112')](db['OpenchannelInteraction'],{'as':_0x489f('0x178'),'foreignKey':_0x489f('0x186')});db['OpenchannelAccount'][_0x489f('0x112')](db[_0x489f('0x56')],{'as':_0x489f('0x159'),'foreignKey':_0x489f('0x186')});db[_0x489f('0x142')][_0x489f('0x112')](db[_0x489f('0x52')],{'as':_0x489f('0x166'),'foreignKey':'OpenchannelAccountId','onDelete':_0x489f('0x110')});db[_0x489f('0x142')]['belongsTo'](db[_0x489f('0xf2')],{'as':_0x489f('0x167'),'foreignKey':_0x489f('0x175')});db['OpenchannelAccount'][_0x489f('0x11f')](db[_0x489f('0x78')],{'as':_0x489f('0x153'),'foreignKey':_0x489f('0x154')});db[_0x489f('0x142')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x489f('0x11f')](db['User'],{'onDelete':_0x489f('0x174')});db[_0x489f('0x52')][_0x489f('0x11f')](db[_0x489f('0x58')],{'onDelete':_0x489f('0x174'),'foreignKey':_0x489f('0x187')});db[_0x489f('0x52')][_0x489f('0x11f')](db[_0x489f('0x142')],{'onDelete':_0x489f('0x174'),'foreignKey':_0x489f('0x186')});db['OpenchannelApplication']['belongsTo'](db[_0x489f('0x77')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x489f('0x52')][_0x489f('0x11f')](db[_0x489f('0x7f')],{'onDelete':'restrict','foreignKey':_0x489f('0x188')});db[_0x489f('0x54')]['hasMany'](db[_0x489f('0x56')],{'as':'Messages','onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x189')});db[_0x489f('0x54')][_0x489f('0x11f')](db[_0x489f('0x142')],{'as':_0x489f('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0x489f('0x54')][_0x489f('0x11f')](db[_0x489f('0x66')],{'as':_0x489f('0x15f'),'foreignKey':'ContactId'});db[_0x489f('0x54')][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':_0x489f('0x180'),'foreignKey':_0x489f('0x111')});db[_0x489f('0x54')][_0x489f('0x122')](db[_0x489f('0x7f')],{'through':_0x489f('0x18a'),'as':'Tags'});db[_0x489f('0x54')][_0x489f('0x122')](db[_0x489f('0x7f')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x489f('0x54')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0x489f('0x189')});db[_0x489f('0x56')]['belongsTo'](db[_0x489f('0x12')],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x12')});db['OpenchannelMessage'][_0x489f('0x11f')](db[_0x489f('0x66')],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x15f')});db['OpenchannelMessage'][_0x489f('0x11f')](db[_0x489f('0x54')],{'onDelete':_0x489f('0x110'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0x489f('0x56')][_0x489f('0x11f')](db[_0x489f('0xe5')],{'as':_0x489f('0xe5'),'foreignKey':_0x489f('0x17d')});db['OpenchannelMessage'][_0x489f('0x11f')](db[_0x489f('0x142')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x186')});db[_0x489f('0x58')][_0x489f('0x122')](db['User'],{'as':_0x489f('0x156'),'through':_0x489f('0x139'),'foreignKey':'OpenchannelQueueId'});db[_0x489f('0x58')][_0x489f('0x122')](db[_0x489f('0xe0')],{'through':_0x489f('0x18b'),'as':'Teams'});db[_0x489f('0x171')]['hasMany'](db[_0x489f('0x74')],{'as':_0x489f('0x163'),'foreignKey':'ChatWebsiteId','onDelete':_0x489f('0x110')});db['ChatWebsite'][_0x489f('0x112')](db['CannedAnswer'],{'as':_0x489f('0x165'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x489f('0x112')](db[_0x489f('0x64')],{'as':_0x489f('0x18c')});db[_0x489f('0x171')][_0x489f('0x112')](db[_0x489f('0x5e')],{'as':_0x489f('0x178')});db[_0x489f('0x171')][_0x489f('0x112')](db[_0x489f('0x5c')],{'as':'Applications','foreignKey':'ChatWebsiteId','onDelete':_0x489f('0x110')});db['ChatWebsite'][_0x489f('0x112')](db['ChatMessage'],{'as':_0x489f('0x159')});db[_0x489f('0x171')]['belongsTo'](db[_0x489f('0xf2')],{'as':_0x489f('0x167'),'foreignKey':_0x489f('0x175')});db[_0x489f('0x171')]['belongsTo'](db[_0x489f('0x77')],{'as':_0x489f('0x77'),'foreignKey':_0x489f('0x152')});db[_0x489f('0x171')][_0x489f('0x11f')](db['MailAccount'],{'as':_0x489f('0x13f'),'foreignKey':_0x489f('0x161')});db['ChatWebsite'][_0x489f('0x11f')](db[_0x489f('0x78')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x489f('0x171')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0x489f('0x11f')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0x489f('0x11f')](db['CmList'],{'as':_0x489f('0x167'),'foreignKey':'ListId'});db[_0x489f('0x5a')]['belongsTo'](db[_0x489f('0x66')],{'as':_0x489f('0x15f'),'foreignKey':_0x489f('0x17b')});db[_0x489f('0x5a')][_0x489f('0x11f')](db[_0x489f('0x54')],{});db[_0x489f('0x5a')][_0x489f('0x11f')](db[_0x489f('0x56')],{});db['OpenchannelQueueReport'][_0x489f('0x11f')](db['User'],{});db[_0x489f('0x5a')]['belongsTo'](db[_0x489f('0x58')],{});db[_0x489f('0x5c')]['belongsTo'](db[_0x489f('0x12')],{'as':_0x489f('0x18d'),'foreignKey':'UserId','onDelete':_0x489f('0x174')});db[_0x489f('0x5c')]['belongsTo'](db[_0x489f('0x135')],{'as':_0x489f('0x18e'),'foreignKey':_0x489f('0x18f'),'onDelete':_0x489f('0x174')});db['ChatApplication']['belongsTo'](db[_0x489f('0x171')],{'as':_0x489f('0x190'),'foreignKey':_0x489f('0x172'),'onDelete':'restrict'});db['ChatApplication'][_0x489f('0x11f')](db['Tag'],{'onDelete':_0x489f('0x174'),'foreignKey':_0x489f('0x188')});db[_0x489f('0x5e')][_0x489f('0x112')](db[_0x489f('0x60')],{'as':_0x489f('0x159'),'onDelete':'cascade','foreignKey':_0x489f('0x191')});db[_0x489f('0x5e')][_0x489f('0x11f')](db[_0x489f('0x171')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x172')});db['ChatInteraction'][_0x489f('0x11f')](db['CmContact'],{'as':_0x489f('0x15f'),'foreignKey':_0x489f('0x17b')});db[_0x489f('0x5e')][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':'Owner','foreignKey':'UserId'});db['ChatInteraction'][_0x489f('0x122')](db['Tag'],{'through':_0x489f('0x192'),'as':_0x489f('0x16d')});db[_0x489f('0x5e')][_0x489f('0x122')](db[_0x489f('0x7f')],{'through':'chat_interaction_has_tags','as':_0x489f('0x16e')});db[_0x489f('0x5e')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x16f'),'through':_0x489f('0x193'),'foreignKey':_0x489f('0x191')});db[_0x489f('0x60')][_0x489f('0x11f')](db[_0x489f('0x12')],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x12')});db[_0x489f('0x60')][_0x489f('0x11f')](db['CmContact'],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x15f'),'foreignKey':_0x489f('0x17b')});db[_0x489f('0x60')]['belongsTo'](db[_0x489f('0x5e')],{'onDelete':_0x489f('0x110'),'as':'Interaction','foreignKey':_0x489f('0x191')});db[_0x489f('0x60')]['belongsTo'](db[_0x489f('0xe5')],{'as':_0x489f('0xe5'),'foreignKey':_0x489f('0x17d')});db[_0x489f('0x60')][_0x489f('0x11f')](db[_0x489f('0x171')],{'as':'Account','foreignKey':_0x489f('0x172')});db[_0x489f('0x173')][_0x489f('0x112')](db['Attachment'],{'as':_0x489f('0x170'),'foreignKey':_0x489f('0x194'),'onDelete':_0x489f('0x110'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x15f'),'foreignKey':_0x489f('0x17b')});db[_0x489f('0x173')]['belongsTo'](db[_0x489f('0x171')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x172')});db[_0x489f('0x135')][_0x489f('0x122')](db['User'],{'as':_0x489f('0x156'),'through':_0x489f('0x2d'),'hooks':!![]});db[_0x489f('0x135')][_0x489f('0x122')](db['Team'],{'through':_0x489f('0x195'),'as':_0x489f('0x16a')});db[_0x489f('0x62')][_0x489f('0x112')](db[_0x489f('0xc7')],{'as':'Messages','foreignKey':_0x489f('0x196'),'onDelete':_0x489f('0x110')});db[_0x489f('0x62')]['belongsToMany'](db[_0x489f('0x12')],{'as':_0x489f('0x197'),'through':_0x489f('0x198')});db[_0x489f('0x64')][_0x489f('0x11f')](db[_0x489f('0x171')],{'as':_0x489f('0x190'),'foreignKey':_0x489f('0x172')});db[_0x489f('0x199')][_0x489f('0x112')](db[_0x489f('0x66')],{'as':_0x489f('0x123'),'foreignKey':_0x489f('0x19a')});db[_0x489f('0x66')]['hasMany'](db['CmContactHasItem'],{'as':_0x489f('0x19b'),'foreignKey':'CmContactId'});db[_0x489f('0x66')][_0x489f('0x112')](db[_0x489f('0x68')],{'as':'Hoppers','foreignKey':_0x489f('0x17b')});db[_0x489f('0x66')]['hasMany'](db['CmHopperFinal'],{'as':_0x489f('0x115'),'foreignKey':_0x489f('0x17b')});db[_0x489f('0x66')][_0x489f('0x112')](db[_0x489f('0x116')],{'as':_0x489f('0x19c'),'foreignKey':_0x489f('0x17b')});db[_0x489f('0x66')][_0x489f('0x112')](db[_0x489f('0x6d')],{'as':'ReportAgentPreview','foreignKey':_0x489f('0x17b')});db['CmContact']['hasMany'](db[_0x489f('0xcd')],{'as':_0x489f('0x14e'),'foreignKey':'ContactId'});db[_0x489f('0x66')][_0x489f('0x112')](db['OpenchannelInteraction'],{'as':_0x489f('0x118'),'foreignKey':_0x489f('0x17b'),'onDelete':'restrict'});db[_0x489f('0x66')][_0x489f('0x112')](db[_0x489f('0x5e')],{'as':_0x489f('0x119'),'foreignKey':_0x489f('0x17b'),'onDelete':_0x489f('0x174')});db[_0x489f('0x66')][_0x489f('0x112')](db['SmsInteraction'],{'as':_0x489f('0x12b'),'foreignKey':'ContactId','onDelete':_0x489f('0x174')});db[_0x489f('0x66')][_0x489f('0x112')](db[_0x489f('0x128')],{'as':'FaxInteractions','foreignKey':_0x489f('0x17b'),'onDelete':_0x489f('0x174')});db[_0x489f('0x66')][_0x489f('0x112')](db[_0x489f('0x3b')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x489f('0x174')});db['CmContact'][_0x489f('0x11f')](db['CmCompany'],{'as':_0x489f('0x19d'),'foreignKey':_0x489f('0x19a')});db['CmContact'][_0x489f('0x11f')](db[_0x489f('0xf2')],{'as':_0x489f('0x167'),'foreignKey':_0x489f('0x175'),'onDelete':_0x489f('0x110')});db['CmContact']['belongsToMany'](db[_0x489f('0x12')],{'as':_0x489f('0x16f'),'through':'cm_user_has_contacts'});db['CmContact'][_0x489f('0x122')](db[_0x489f('0x7f')],{'as':_0x489f('0x16d'),'through':_0x489f('0x19e')});db['CmContact'][_0x489f('0x122')](db[_0x489f('0x7f')],{'through':'cm_contact_has_tags','as':_0x489f('0x16e')});db['CmHopper'][_0x489f('0x112')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db['CmHopper'][_0x489f('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x489f('0x110')});db[_0x489f('0x68')][_0x489f('0x11f')](db[_0x489f('0xf2')],{'as':_0x489f('0x167'),'foreignKey':_0x489f('0x175'),'onDelete':_0x489f('0x110')});db['CmHopper'][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':_0x489f('0x18d'),'foreignKey':_0x489f('0x111')});db['CmHopper']['belongsTo'](db[_0x489f('0x12f')],{'as':_0x489f('0x18e'),'foreignKey':'VoiceQueueId','onDelete':_0x489f('0x110')});db[_0x489f('0x68')]['belongsTo'](db[_0x489f('0x19f')],{'as':_0x489f('0x19f'),'foreignKey':_0x489f('0x1a0'),'onDelete':'cascade'});db[_0x489f('0x68')][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':_0x489f('0x180'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x489f('0x11f')](db[_0x489f('0x66')],{'as':'Contact','foreignKey':_0x489f('0x17b'),'onDelete':_0x489f('0x110')});db['CmHopperBlack'][_0x489f('0x11f')](db[_0x489f('0xf2')],{'as':'List','foreignKey':'ListId','onDelete':_0x489f('0x110')});db[_0x489f('0x69')][_0x489f('0x11f')](db[_0x489f('0x12f')],{'as':_0x489f('0x18e'),'foreignKey':_0x489f('0x14c'),'onDelete':_0x489f('0x110')});db[_0x489f('0x69')][_0x489f('0x11f')](db[_0x489f('0x19f')],{'as':_0x489f('0x19f'),'foreignKey':_0x489f('0x1a0'),'onDelete':_0x489f('0x110')});db[_0x489f('0x71')][_0x489f('0x112')](db[_0x489f('0x1a1')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x489f('0x1a2'),'onDelete':_0x489f('0x110'),'hooks':!![]});db[_0x489f('0x71')]['hasMany'](db['Condition'],{'as':{'plural':_0x489f('0x1a3'),'singular':_0x489f('0x1a4')},'foreignKey':_0x489f('0x1a5'),'onDelete':_0x489f('0x110'),'hooks':!![]});db[_0x489f('0x71')]['hasMany'](db['Action'],{'as':'Actions','foreignKey':_0x489f('0x1a6'),'onDelete':_0x489f('0x110'),'hooks':!![]});db[_0x489f('0x74')][_0x489f('0x112')](db[_0x489f('0x74')],{'as':_0x489f('0x163'),'foreignKey':_0x489f('0x1a7'),'onDelete':_0x489f('0x110')});db['Interval'][_0x489f('0x112')](db[_0x489f('0x77')],{'as':_0x489f('0x1a8'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x489f('0x77')]['hasMany'](db[_0x489f('0x17')],{'as':_0x489f('0x114'),'foreignKey':'IntervalId','onDelete':_0x489f('0x174')});db[_0x489f('0x77')][_0x489f('0x112')](db['MailApplication'],{'as':_0x489f('0x1a9'),'foreignKey':_0x489f('0x152')});db['Interval'][_0x489f('0x112')](db[_0x489f('0x5c')],{'as':_0x489f('0x1aa'),'foreignKey':_0x489f('0x152')});db['Interval'][_0x489f('0x112')](db['FaxApplication'],{'as':_0x489f('0x1ab'),'foreignKey':_0x489f('0x152')});db['Interval'][_0x489f('0x112')](db['SmsApplication'],{'as':_0x489f('0x1ac'),'foreignKey':_0x489f('0x152')});db[_0x489f('0x7c')]['belongsTo'](db[_0x489f('0x13f')],{});db[_0x489f('0x7c')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0x489f('0x1ad')});db[_0x489f('0x7c')][_0x489f('0x11f')](db[_0x489f('0x1ae')],{'foreignKey':_0x489f('0x1af')});db[_0x489f('0x148')]['belongsToMany'](db[_0x489f('0x18')],{'as':_0x489f('0x1b0'),'through':'moh_has_sounds','onDelete':_0x489f('0x174')});db[_0x489f('0x7f')][_0x489f('0x122')](db[_0x489f('0x66')],{'through':'cm_contact_has_tags'});db[_0x489f('0x7f')][_0x489f('0x122')](db[_0x489f('0x5e')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x489f('0x122')](db[_0x489f('0x3b')],{'through':_0x489f('0x1b1')});db[_0x489f('0x7f')]['belongsToMany'](db['SmsInteraction'],{'through':_0x489f('0x181')});db[_0x489f('0x7f')][_0x489f('0x122')](db[_0x489f('0x128')],{'through':_0x489f('0x17c')});db[_0x489f('0x7f')][_0x489f('0x122')](db[_0x489f('0x54')],{'through':_0x489f('0x18a')});db[_0x489f('0x7f')][_0x489f('0x122')](db[_0x489f('0x12d')],{'through':_0x489f('0x1b2')});db[_0x489f('0x1b3')][_0x489f('0x11f')](db['ContactItemType'],{'as':_0x489f('0x1b4'),'foreignKey':_0x489f('0x1b5')});db[_0x489f('0x84')]['belongsTo'](db[_0x489f('0x68')],{'as':_0x489f('0x1b6'),'foreignKey':'CmHopperId'});db['CmContactHasItem'][_0x489f('0x11f')](db[_0x489f('0x66')],{'as':_0x489f('0x15f'),'foreignKey':_0x489f('0x1b7')});db[_0x489f('0x1b8')][_0x489f('0x112')](db['Condition'],{'as':{'plural':_0x489f('0x1b9'),'singular':_0x489f('0x1ba')},'foreignKey':'TriggerAllId','onDelete':_0x489f('0x110'),'hooks':!![]});db[_0x489f('0x1b8')]['hasMany'](db[_0x489f('0x1a1')],{'as':{'plural':'AnyConditions','singular':_0x489f('0x1bb')},'foreignKey':_0x489f('0x1bc'),'onDelete':'cascade','hooks':!![]});db[_0x489f('0x1b8')]['hasMany'](db[_0x489f('0x6f')],{'as':_0x489f('0x1bd'),'foreignKey':_0x489f('0x1be'),'onDelete':'cascade','hooks':!![]});db[_0x489f('0x1ae')][_0x489f('0x112')](db[_0x489f('0x8f')],{'as':_0x489f('0x1bf'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1af'),'hooks':!![]});db[_0x489f('0x1c0')][_0x489f('0x112')](db['AnalyticFieldReport'],{'as':_0x489f('0x1bf'),'onDelete':'cascade','foreignKey':_0x489f('0x1ad')});db[_0x489f('0x8d')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x489f('0x1bf'),'onDelete':'cascade','foreignKey':_0x489f('0x1c1')});db[_0x489f('0x8f')]['belongsTo'](db[_0x489f('0x8d')],{'foreignKey':_0x489f('0x1c1')});db['SalesforceAccount'][_0x489f('0x112')](db[_0x489f('0x93')],{'as':_0x489f('0x1c2'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c3')});db[_0x489f('0x93')][_0x489f('0x112')](db[_0x489f('0x95')],{'as':_0x489f('0x1c4'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c5')});db['SalesforceConfiguration'][_0x489f('0x112')](db[_0x489f('0x95')],{'as':_0x489f('0x1c6'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c7')});db[_0x489f('0x93')][_0x489f('0x112')](db['SalesforceField'],{'as':'Fields','onDelete':_0x489f('0x110'),'foreignKey':'FieldId'});db[_0x489f('0x93')][_0x489f('0x11f')](db[_0x489f('0x91')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x1c3')});db[_0x489f('0x95')]['hasMany'](db[_0x489f('0x95')],{'as':_0x489f('0x1c8'),'foreignKey':_0x489f('0x1c5')});db[_0x489f('0x95')][_0x489f('0x112')](db['SalesforceField'],{'as':_0x489f('0x1c9'),'foreignKey':_0x489f('0x1c7')});db[_0x489f('0x95')]['hasMany'](db['SalesforceField'],{'as':_0x489f('0x1ca'),'foreignKey':'FieldId'});db['SalesforceField']['belongsTo'](db[_0x489f('0x88')],{'as':_0x489f('0x88'),'foreignKey':'VariableId'});db[_0x489f('0x1cb')][_0x489f('0x112')](db[_0x489f('0x98')],{'as':_0x489f('0x1c2'),'onDelete':'cascade','foreignKey':_0x489f('0x1c3')});db[_0x489f('0x98')]['hasMany'](db[_0x489f('0x9a')],{'as':'Subjects','onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c5')});db[_0x489f('0x98')][_0x489f('0x112')](db[_0x489f('0x9a')],{'as':'Descriptions','onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c7')});db[_0x489f('0x98')][_0x489f('0x112')](db['SugarcrmField'],{'as':_0x489f('0x1bf'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0x98')][_0x489f('0x11f')](db[_0x489f('0x1cb')],{'as':_0x489f('0x16c'),'foreignKey':'AccountId'});db[_0x489f('0x9a')]['hasMany'](db[_0x489f('0x9a')],{'as':_0x489f('0x1c8'),'foreignKey':'SubjectId'});db[_0x489f('0x9a')][_0x489f('0x112')](db[_0x489f('0x9a')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x489f('0x9a')][_0x489f('0x112')](db[_0x489f('0x9a')],{'as':_0x489f('0x1ca'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0x9a')]['belongsTo'](db[_0x489f('0x88')],{'as':'Variable','foreignKey':_0x489f('0x1cd')});db[_0x489f('0x1ce')]['hasMany'](db[_0x489f('0x1cf')],{'as':_0x489f('0x1c2'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c3')});db['DeskConfiguration'][_0x489f('0x112')](db[_0x489f('0x9e')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x489f('0x1c5')});db['DeskConfiguration'][_0x489f('0x112')](db[_0x489f('0x9e')],{'as':_0x489f('0x1c6'),'onDelete':_0x489f('0x110'),'foreignKey':'DescriptionId'});db[_0x489f('0x1cf')][_0x489f('0x112')](db[_0x489f('0x9e')],{'as':_0x489f('0x1bf'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0x1cf')][_0x489f('0x11f')](db[_0x489f('0x1ce')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x1c3')});db[_0x489f('0x1cf')][_0x489f('0x122')](db[_0x489f('0x7f')],{'through':_0x489f('0x1d0')});db['DeskField']['hasMany'](db[_0x489f('0x9e')],{'as':_0x489f('0x1c8'),'foreignKey':_0x489f('0x1c5')});db['DeskField'][_0x489f('0x112')](db[_0x489f('0x9e')],{'as':_0x489f('0x1c9'),'foreignKey':_0x489f('0x1c7')});db[_0x489f('0x9e')]['hasMany'](db['DeskField'],{'as':_0x489f('0x1ca'),'foreignKey':'FieldId'});db['DeskField'][_0x489f('0x11f')](db[_0x489f('0x88')],{'as':'Variable','foreignKey':'VariableId'});db['ZohoAccount'][_0x489f('0x112')](db[_0x489f('0xa1')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x489f('0x1c3')});db[_0x489f('0xa1')][_0x489f('0x112')](db[_0x489f('0x1d1')],{'as':_0x489f('0x1c4'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c5')});db[_0x489f('0xa1')]['hasMany'](db[_0x489f('0x1d1')],{'as':_0x489f('0x1c6'),'onDelete':_0x489f('0x110'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x489f('0x112')](db[_0x489f('0x1d1')],{'as':_0x489f('0x1bf'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0xa1')][_0x489f('0x11f')](db[_0x489f('0x9f')],{'as':_0x489f('0x16c'),'foreignKey':'AccountId'});db[_0x489f('0x1d1')][_0x489f('0x112')](db[_0x489f('0x1d1')],{'as':_0x489f('0x1c8'),'foreignKey':'SubjectId'});db[_0x489f('0x1d1')][_0x489f('0x112')](db['ZohoField'],{'as':'Description','foreignKey':_0x489f('0x1c7')});db['ZohoField'][_0x489f('0x112')](db[_0x489f('0x1d1')],{'as':_0x489f('0x1ca'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0x1d1')][_0x489f('0x11f')](db[_0x489f('0x88')],{'as':_0x489f('0x88'),'foreignKey':_0x489f('0x1cd')});db[_0x489f('0xa4')][_0x489f('0x112')](db[_0x489f('0xa6')],{'as':_0x489f('0x1c2'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c3')});db['ZendeskConfiguration'][_0x489f('0x112')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x489f('0x1c5')});db[_0x489f('0xa6')][_0x489f('0x112')](db[_0x489f('0xa8')],{'as':_0x489f('0x1c6'),'foreignKey':_0x489f('0x1c7')});db[_0x489f('0xa6')][_0x489f('0x112')](db[_0x489f('0xa8')],{'as':_0x489f('0x1bf'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0xa6')][_0x489f('0x11f')](db[_0x489f('0xa4')],{'as':'Account','foreignKey':_0x489f('0x1c3')});db['ZendeskConfiguration'][_0x489f('0x122')](db[_0x489f('0x7f')],{'through':_0x489f('0x1d2')});db['ZendeskField'][_0x489f('0x112')](db[_0x489f('0xa8')],{'as':_0x489f('0x1c8'),'foreignKey':_0x489f('0x1c5')});db[_0x489f('0xa8')][_0x489f('0x112')](db['ZendeskField'],{'as':_0x489f('0x1c9'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x489f('0x112')](db[_0x489f('0xa8')],{'as':_0x489f('0x1ca'),'foreignKey':_0x489f('0x1cc')});db['ZendeskField'][_0x489f('0x11f')](db['Variable'],{'as':_0x489f('0x88'),'foreignKey':_0x489f('0x1cd')});db['FreshdeskAccount']['hasMany'](db['FreshdeskConfiguration'],{'as':_0x489f('0x1c2'),'onDelete':'cascade','foreignKey':_0x489f('0x1c3')});db[_0x489f('0x1d3')]['hasMany'](db[_0x489f('0xab')],{'as':_0x489f('0x1c4'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c5')});db[_0x489f('0x1d3')][_0x489f('0x112')](db[_0x489f('0xab')],{'as':_0x489f('0x1c6'),'onDelete':_0x489f('0x110'),'foreignKey':'DescriptionId'});db[_0x489f('0x1d3')][_0x489f('0x112')](db[_0x489f('0xab')],{'as':_0x489f('0x1bf'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x489f('0x1d3')][_0x489f('0x11f')](db[_0x489f('0x1d4')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x1c3')});db[_0x489f('0x1d3')]['belongsToMany'](db[_0x489f('0x7f')],{'through':_0x489f('0x1d5')});db[_0x489f('0xab')][_0x489f('0x112')](db[_0x489f('0xab')],{'as':_0x489f('0x1c8'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x489f('0x112')](db[_0x489f('0xab')],{'as':_0x489f('0x1c9'),'foreignKey':_0x489f('0x1c7')});db['FreshdeskField']['hasMany'](db[_0x489f('0xab')],{'as':_0x489f('0x1ca'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0xab')]['belongsTo'](db[_0x489f('0x88')],{'as':_0x489f('0x88'),'foreignKey':_0x489f('0x1cd')});db['VtigerAccount'][_0x489f('0x112')](db[_0x489f('0xaf')],{'as':'Configurations','onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c3')});db[_0x489f('0xaf')]['hasMany'](db['VtigerField'],{'as':_0x489f('0x1c4'),'foreignKey':'SubjectId'});db[_0x489f('0xaf')][_0x489f('0x112')](db[_0x489f('0xb1')],{'as':_0x489f('0x1c6'),'foreignKey':_0x489f('0x1c7')});db[_0x489f('0xaf')][_0x489f('0x112')](db[_0x489f('0xb1')],{'as':_0x489f('0x1bf'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0xaf')][_0x489f('0x11f')](db['VtigerAccount'],{'as':_0x489f('0x16c'),'foreignKey':'AccountId'});db[_0x489f('0xb1')][_0x489f('0x112')](db[_0x489f('0xb1')],{'as':_0x489f('0x1c8'),'foreignKey':_0x489f('0x1c5')});db[_0x489f('0xb1')]['hasMany'](db[_0x489f('0xb1')],{'as':'Description','foreignKey':_0x489f('0x1c7')});db[_0x489f('0xb1')][_0x489f('0x112')](db[_0x489f('0xb1')],{'as':_0x489f('0x1ca'),'foreignKey':'FieldId'});db[_0x489f('0xb1')]['belongsTo'](db[_0x489f('0x88')],{'as':_0x489f('0x88'),'foreignKey':'VariableId'});db[_0x489f('0xb3')]['hasMany'](db[_0x489f('0xb5')],{'as':_0x489f('0x1c2'),'onDelete':'cascade','foreignKey':_0x489f('0x1c3')});db[_0x489f('0xb5')]['hasMany'](db[_0x489f('0xb6')],{'as':'Subjects','foreignKey':_0x489f('0x1c5')});db[_0x489f('0xb5')][_0x489f('0x112')](db[_0x489f('0xb6')],{'as':_0x489f('0x1c6'),'foreignKey':'DescriptionId'});db[_0x489f('0xb5')][_0x489f('0x112')](db[_0x489f('0xb6')],{'as':_0x489f('0x1bf'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0xb5')][_0x489f('0x11f')](db[_0x489f('0xb3')],{'as':'Account','foreignKey':_0x489f('0x1c3')});db[_0x489f('0xb6')][_0x489f('0x112')](db[_0x489f('0xb6')],{'as':_0x489f('0x1c8'),'foreignKey':'SubjectId'});db[_0x489f('0xb6')][_0x489f('0x112')](db[_0x489f('0xb6')],{'as':_0x489f('0x1c9'),'foreignKey':_0x489f('0x1c7')});db['ServicenowField'][_0x489f('0x112')](db[_0x489f('0xb6')],{'as':_0x489f('0x1ca'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0xb6')][_0x489f('0x11f')](db[_0x489f('0x88')],{'as':_0x489f('0x88'),'foreignKey':_0x489f('0x1cd')});db['Dynamics365Account'][_0x489f('0x112')](db['Dynamics365Configuration'],{'as':_0x489f('0x1c2'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c3')});db[_0x489f('0xb8')][_0x489f('0x11f')](db[_0x489f('0x104')],{'as':_0x489f('0x104'),'foreignKey':_0x489f('0x160')});db[_0x489f('0xba')]['hasMany'](db[_0x489f('0xbc')],{'as':'Subjects','onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c5')});db[_0x489f('0xba')]['hasMany'](db[_0x489f('0xbc')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x489f('0xba')][_0x489f('0x112')](db[_0x489f('0xbc')],{'as':_0x489f('0x1bf'),'onDelete':'cascade','foreignKey':_0x489f('0x1cc')});db[_0x489f('0xba')][_0x489f('0x11f')](db[_0x489f('0xb8')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x1c3')});db[_0x489f('0xbc')]['hasMany'](db[_0x489f('0xbc')],{'as':_0x489f('0x1c8'),'foreignKey':_0x489f('0x1c5')});db[_0x489f('0xbc')][_0x489f('0x112')](db[_0x489f('0xbc')],{'as':_0x489f('0x1c9'),'foreignKey':_0x489f('0x1c7')});db[_0x489f('0xbc')][_0x489f('0x112')](db[_0x489f('0xbc')],{'as':_0x489f('0x1ca'),'foreignKey':'FieldId'});db[_0x489f('0xbc')][_0x489f('0x11f')](db['Variable'],{'as':_0x489f('0x88'),'foreignKey':_0x489f('0x1cd')});db[_0x489f('0xbe')][_0x489f('0x112')](db[_0x489f('0xc0')],{'as':'Configurations','onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1c3')});db[_0x489f('0xc0')][_0x489f('0x112')](db[_0x489f('0x1d6')],{'as':_0x489f('0x1c4'),'foreignKey':'SubjectId'});db[_0x489f('0xc0')][_0x489f('0x112')](db[_0x489f('0x1d6')],{'as':_0x489f('0x1c6'),'foreignKey':_0x489f('0x1c7')});db['FreshsalesConfiguration'][_0x489f('0x112')](db[_0x489f('0x1d6')],{'as':_0x489f('0x1bf'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0xc0')][_0x489f('0x11f')](db[_0x489f('0xbe')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x1c3')});db[_0x489f('0x1d6')][_0x489f('0x112')](db[_0x489f('0x1d6')],{'as':_0x489f('0x1c8'),'foreignKey':'SubjectId'});db[_0x489f('0x1d6')][_0x489f('0x112')](db['FreshsalesField'],{'as':_0x489f('0x1c9'),'foreignKey':_0x489f('0x1c7')});db[_0x489f('0x1d6')][_0x489f('0x112')](db[_0x489f('0x1d6')],{'as':_0x489f('0x1ca'),'foreignKey':_0x489f('0x1cc')});db[_0x489f('0x1d6')][_0x489f('0x11f')](db[_0x489f('0x88')],{'as':_0x489f('0x88'),'foreignKey':_0x489f('0x1cd')});db[_0x489f('0xc5')][_0x489f('0x11f')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x489f('0x11f')](db[_0x489f('0xf2')],{'as':_0x489f('0x167'),'foreignKey':_0x489f('0x175')});db[_0x489f('0xc5')][_0x489f('0x11f')](db[_0x489f('0x66')],{'as':'Contact','foreignKey':_0x489f('0x17b')});db[_0x489f('0xc5')][_0x489f('0x11f')](db[_0x489f('0x5e')],{});db[_0x489f('0xc5')][_0x489f('0x11f')](db[_0x489f('0x60')],{});db[_0x489f('0xc5')]['belongsTo'](db[_0x489f('0x12')],{});db[_0x489f('0xc5')]['belongsTo'](db[_0x489f('0x135')],{});db[_0x489f('0xc7')]['belongsTo'](db[_0x489f('0x12')],{'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1d7')});db[_0x489f('0xc7')][_0x489f('0x11f')](db[_0x489f('0x12')],{'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1d8')});db[_0x489f('0xcd')]['hasMany'](db[_0x489f('0xcb')],{'foreignKey':'SessionId','onDelete':_0x489f('0x110')});db[_0x489f('0xcd')][_0x489f('0x112')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db['SmsQueueReport'][_0x489f('0x11f')](db[_0x489f('0x4a')],{});db[_0x489f('0xce')]['belongsTo'](db[_0x489f('0xf2')],{'as':'List','foreignKey':'ListId'});db['SmsQueueReport'][_0x489f('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':_0x489f('0x17b')});db['SmsQueueReport']['belongsTo'](db[_0x489f('0x4e')],{});db[_0x489f('0xce')][_0x489f('0x11f')](db[_0x489f('0x4f')],{});db[_0x489f('0xce')][_0x489f('0x11f')](db[_0x489f('0x12')],{});db[_0x489f('0xce')][_0x489f('0x11f')](db[_0x489f('0x136')],{});db[_0x489f('0xd4')]['hasMany'](db[_0x489f('0xcd')],{'foreignKey':'ProjectId'});db[_0x489f('0xd4')][_0x489f('0x112')](db[_0x489f('0xcb')],{'foreignKey':_0x489f('0x1d9')});db[_0x489f('0xd4')][_0x489f('0x112')](db[_0x489f('0xc9')],{'foreignKey':_0x489f('0x1d9')});db[_0x489f('0xe0')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':'Agents','through':_0x489f('0x127')});db[_0x489f('0xe0')]['belongsToMany'](db[_0x489f('0x12f')],{'through':_0x489f('0x106'),'as':_0x489f('0x130')});db['Team'][_0x489f('0x122')](db[_0x489f('0x132')],{'through':_0x489f('0x169'),'as':_0x489f('0x133')});db[_0x489f('0xe0')][_0x489f('0x122')](db[_0x489f('0x135')],{'through':_0x489f('0x195'),'as':'ChatQueues'});db['Team'][_0x489f('0x122')](db['FaxQueue'],{'through':_0x489f('0x1da'),'as':_0x489f('0x1db')});db[_0x489f('0xe0')][_0x489f('0x122')](db['SmsQueue'],{'through':'team_has_sms_queues','as':_0x489f('0x137')});db[_0x489f('0xe0')][_0x489f('0x122')](db[_0x489f('0x58')],{'through':_0x489f('0x18b'),'as':_0x489f('0x138')});db[_0x489f('0xe0')][_0x489f('0x122')](db['WhatsappQueue'],{'through':_0x489f('0x1dc'),'as':_0x489f('0x13a')});db[_0x489f('0xe0')][_0x489f('0x122')](db[_0x489f('0xf4')],{'through':_0x489f('0x108'),'as':_0x489f('0x131')});db[_0x489f('0x19f')]['hasMany'](db[_0x489f('0x68')],{'as':_0x489f('0x11d'),'foreignKey':_0x489f('0x1a0')});db[_0x489f('0x19f')]['hasMany'](db['CmHopperFinal'],{'as':_0x489f('0x115'),'foreignKey':'CampaignId'});db[_0x489f('0x19f')][_0x489f('0x112')](db[_0x489f('0x116')],{'as':_0x489f('0x19c'),'foreignKey':_0x489f('0x1a0')});db['Campaign'][_0x489f('0x112')](db[_0x489f('0x69')],{'as':_0x489f('0x14d'),'foreignKey':_0x489f('0x1a0')});db[_0x489f('0x19f')][_0x489f('0x11f')](db[_0x489f('0x27')],{'as':'Trunk','foreignKey':_0x489f('0x14f')});db[_0x489f('0x19f')][_0x489f('0x11f')](db[_0x489f('0x27')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x489f('0x19f')][_0x489f('0x11f')](db[_0x489f('0x77')],{'as':_0x489f('0x77'),'foreignKey':'IntervalId'});db['Campaign']['belongsTo'](db[_0x489f('0xda')],{'as':'SquareProject','foreignKey':_0x489f('0x1dd')});db[_0x489f('0x19f')][_0x489f('0x122')](db['CmList'],{'as':_0x489f('0x125'),'through':_0x489f('0x1de')});db[_0x489f('0x19f')][_0x489f('0x122')](db[_0x489f('0xf2')],{'as':_0x489f('0x157'),'through':_0x489f('0x1df')});db[_0x489f('0xe5')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x489f('0x173'),'foreignKey':'ChatOfflineMessageId'});db[_0x489f('0xe8')][_0x489f('0x11f')](db[_0x489f('0x3c')],{});db['MailTransferReport'][_0x489f('0x11f')](db[_0x489f('0x3b')],{});db[_0x489f('0xe8')][_0x489f('0x11f')](db[_0x489f('0x13f')],{'foreignKey':_0x489f('0x1e0'),'as':'FromAccount'});db[_0x489f('0xe8')]['belongsTo'](db[_0x489f('0x12')],{'foreignKey':_0x489f('0x1e1'),'as':_0x489f('0x1e2')});db['MailTransferReport'][_0x489f('0x11f')](db[_0x489f('0x12')],{'foreignKey':'ToUserId','as':_0x489f('0x1e3')});db[_0x489f('0xe8')]['belongsTo'](db[_0x489f('0x132')],{'foreignKey':'ToMailQueueId','as':_0x489f('0x1e4')});db[_0x489f('0xe8')][_0x489f('0x11f')](db[_0x489f('0x13f')],{'foreignKey':_0x489f('0x1e5'),'as':_0x489f('0x1e6')});db[_0x489f('0xea')]['belongsTo'](db[_0x489f('0x60')],{});db[_0x489f('0xea')][_0x489f('0x11f')](db[_0x489f('0x5e')],{});db[_0x489f('0xea')][_0x489f('0x11f')](db[_0x489f('0x171')],{'foreignKey':_0x489f('0x1e7'),'as':'FromAccount'});db[_0x489f('0xea')][_0x489f('0x11f')](db['User'],{'foreignKey':_0x489f('0x1e1'),'as':'FromAgent'});db[_0x489f('0xea')]['belongsTo'](db[_0x489f('0x12')],{'foreignKey':_0x489f('0x1e8'),'as':'ToAgent'});db[_0x489f('0xea')][_0x489f('0x11f')](db[_0x489f('0x135')],{'foreignKey':_0x489f('0x1e9'),'as':_0x489f('0x1e4')});db[_0x489f('0xea')][_0x489f('0x11f')](db[_0x489f('0x171')],{'foreignKey':_0x489f('0x1ea'),'as':_0x489f('0x1e6')});db['FaxTransferReport'][_0x489f('0x11f')](db[_0x489f('0x47')],{});db[_0x489f('0xec')]['belongsTo'](db[_0x489f('0x128')],{});db[_0x489f('0xec')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x489f('0x1eb'),'as':_0x489f('0x1ec')});db[_0x489f('0xec')][_0x489f('0x11f')](db[_0x489f('0x12')],{'foreignKey':_0x489f('0x1e1'),'as':'FromAgent'});db[_0x489f('0xec')][_0x489f('0x11f')](db[_0x489f('0x12')],{'foreignKey':'ToUserId','as':_0x489f('0x1e3')});db[_0x489f('0xec')][_0x489f('0x11f')](db[_0x489f('0x48')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0x489f('0xec')][_0x489f('0x11f')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0x489f('0x11f')](db[_0x489f('0x56')],{});db[_0x489f('0xee')][_0x489f('0x11f')](db[_0x489f('0x54')],{});db[_0x489f('0xee')][_0x489f('0x11f')](db[_0x489f('0x142')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x489f('0x12')],{'foreignKey':_0x489f('0x1e1'),'as':_0x489f('0x1e2')});db[_0x489f('0xee')][_0x489f('0x11f')](db[_0x489f('0x12')],{'foreignKey':_0x489f('0x1e8'),'as':'ToAgent'});db[_0x489f('0xee')][_0x489f('0x11f')](db[_0x489f('0x58')],{'foreignKey':_0x489f('0x1ed'),'as':_0x489f('0x1e4')});db[_0x489f('0xee')]['belongsTo'](db[_0x489f('0x142')],{'foreignKey':_0x489f('0x1ee'),'as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x489f('0x4f')],{});db['SmsTransferReport'][_0x489f('0x11f')](db[_0x489f('0x4e')],{});db['SmsTransferReport'][_0x489f('0x11f')](db['SmsAccount'],{'foreignKey':_0x489f('0x1ef'),'as':_0x489f('0x1ec')});db['SmsTransferReport'][_0x489f('0x11f')](db[_0x489f('0x12')],{'foreignKey':_0x489f('0x1e1'),'as':_0x489f('0x1e2')});db[_0x489f('0xf0')][_0x489f('0x11f')](db[_0x489f('0x12')],{'foreignKey':_0x489f('0x1e8'),'as':_0x489f('0x1e3')});db[_0x489f('0xf0')][_0x489f('0x11f')](db[_0x489f('0x136')],{'foreignKey':_0x489f('0x1f0'),'as':_0x489f('0x1e4')});db[_0x489f('0xf0')][_0x489f('0x11f')](db[_0x489f('0x4a')],{'foreignKey':_0x489f('0x1f1'),'as':_0x489f('0x1e6')});db['CmList']['hasMany'](db[_0x489f('0x74')],{'as':_0x489f('0x163'),'foreignKey':_0x489f('0x175'),'onDelete':_0x489f('0x110')});db[_0x489f('0xf2')][_0x489f('0x112')](db['CmCustomField'],{'as':_0x489f('0x1f2'),'foreignKey':'ListId'});db[_0x489f('0xf2')]['hasMany'](db['CmContact'],{'as':_0x489f('0x123'),'onDelete':'cascade','foreignKey':_0x489f('0x175')});db[_0x489f('0xf2')][_0x489f('0x112')](db[_0x489f('0x6b')],{'as':_0x489f('0x115'),'foreignKey':_0x489f('0x175')});db[_0x489f('0xf2')][_0x489f('0x112')](db[_0x489f('0x116')],{'as':_0x489f('0x117'),'foreignKey':_0x489f('0x175')});db['CmList'][_0x489f('0x112')](db['ReportAgentPreview'],{'as':_0x489f('0x6d'),'foreignKey':'ListId'});db['CmList'][_0x489f('0x122')](db['VoiceQueue'],{'as':_0x489f('0x1f3'),'through':'voice_queues_has_cm_lists'});db['CmList']['belongsToMany'](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':_0x489f('0x126')});db[_0x489f('0xf4')][_0x489f('0x112')](db['VoiceExtension'],{'as':_0x489f('0x114'),'onDelete':_0x489f('0x110')});db['VoicePrefix']['belongsToMany'](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':_0x489f('0x10a')});db[_0x489f('0xf4')]['belongsToMany'](db[_0x489f('0xe0')],{'through':_0x489f('0x108'),'as':'Teams'});db[_0x489f('0x120')]['hasMany'](db[_0x489f('0x12')],{'as':_0x489f('0x16f'),'foreignKey':_0x489f('0x121')});db[_0x489f('0x120')][_0x489f('0x112')](db['UserProfileSection'],{'as':_0x489f('0x1f4'),'foreignKey':_0x489f('0x121'),'onDelete':_0x489f('0x110')});db[_0x489f('0xf5')][_0x489f('0x112')](db[_0x489f('0xf7')],{'as':_0x489f('0x1f5'),'foreignKey':_0x489f('0x1f6'),'onDelete':_0x489f('0x110')});db['WhatsappAccount'][_0x489f('0x112')](db[_0x489f('0x74')],{'as':_0x489f('0x163'),'foreignKey':_0x489f('0x1f7'),'onDelete':_0x489f('0x110')});db[_0x489f('0xfb')][_0x489f('0x112')](db[_0x489f('0x164')],{'as':_0x489f('0x165'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x489f('0x112')](db[_0x489f('0xfe')],{'as':'Messages','foreignKey':_0x489f('0x1f7')});db[_0x489f('0xfb')][_0x489f('0x112')](db[_0x489f('0x12d')],{'as':_0x489f('0x178')});db[_0x489f('0xfb')][_0x489f('0x112')](db['WhatsappApplication'],{'as':_0x489f('0x166'),'foreignKey':_0x489f('0x1f7'),'onDelete':_0x489f('0x110')});db[_0x489f('0xfb')][_0x489f('0x11f')](db[_0x489f('0xf2')],{'as':_0x489f('0x167'),'foreignKey':_0x489f('0x175')});db[_0x489f('0xfb')]['belongsTo'](db[_0x489f('0x78')],{'as':_0x489f('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x489f('0xfb')][_0x489f('0x122')](db[_0x489f('0x12')],{'as':_0x489f('0x156'),'through':_0x489f('0x1f8')});db[_0x489f('0x1f9')][_0x489f('0x11f')](db[_0x489f('0x12')],{'onDelete':_0x489f('0x174')});db[_0x489f('0x1f9')][_0x489f('0x11f')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0x489f('0x1f9')][_0x489f('0x11f')](db['WhatsappAccount'],{'onDelete':_0x489f('0x174')});db[_0x489f('0x1f9')][_0x489f('0x11f')](db[_0x489f('0x77')],{'onDelete':'restrict','foreignKey':_0x489f('0x152')});db[_0x489f('0x1f9')][_0x489f('0x11f')](db[_0x489f('0x7f')],{'onDelete':_0x489f('0x174'),'foreignKey':'TagId'});db[_0x489f('0x12d')][_0x489f('0x112')](db[_0x489f('0xfe')],{'as':_0x489f('0x159'),'onDelete':_0x489f('0x110'),'foreignKey':_0x489f('0x1fa')});db['WhatsappInteraction']['belongsTo'](db[_0x489f('0xfb')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x1f7')});db[_0x489f('0x12d')][_0x489f('0x11f')](db['CmContact'],{'as':_0x489f('0x15f'),'foreignKey':_0x489f('0x17b')});db[_0x489f('0x12d')]['belongsTo'](db[_0x489f('0x12')],{'as':_0x489f('0x180'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x489f('0x122')](db[_0x489f('0x7f')],{'through':_0x489f('0x1b2'),'as':_0x489f('0x16d')});db['WhatsappInteraction'][_0x489f('0x122')](db['Tag'],{'through':_0x489f('0x1b2'),'as':_0x489f('0x16e')});db[_0x489f('0x12d')]['belongsToMany'](db[_0x489f('0x12')],{'as':'Users','through':_0x489f('0x12e'),'foreignKey':_0x489f('0x1fa')});db[_0x489f('0xfe')][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':_0x489f('0x12')});db[_0x489f('0xfe')][_0x489f('0x11f')](db['CmContact'],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x15f')});db['WhatsappMessage'][_0x489f('0x11f')](db[_0x489f('0x12d')],{'onDelete':_0x489f('0x110'),'as':_0x489f('0x183'),'foreignKey':_0x489f('0x1fa')});db[_0x489f('0xfe')][_0x489f('0x11f')](db[_0x489f('0xfb')],{'as':_0x489f('0x16c'),'foreignKey':_0x489f('0x1f7')});db[_0x489f('0x100')][_0x489f('0x11f')](db[_0x489f('0xfb')],{});db[_0x489f('0x100')]['belongsTo'](db[_0x489f('0xf2')],{'as':'List','foreignKey':_0x489f('0x175')});db[_0x489f('0x100')][_0x489f('0x11f')](db['CmContact'],{'as':_0x489f('0x15f'),'foreignKey':_0x489f('0x17b')});db['WhatsappQueueReport']['belongsTo'](db[_0x489f('0x12d')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x489f('0x103')],{});db[_0x489f('0x100')][_0x489f('0x11f')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x489f('0x11f')](db[_0x489f('0x12')],{});db[_0x489f('0x1fb')][_0x489f('0x11f')](db['WhatsappMessage'],{});db[_0x489f('0x1fb')][_0x489f('0x11f')](db[_0x489f('0x12d')],{});db['WhatsappTransferReport'][_0x489f('0x11f')](db[_0x489f('0xfb')],{'foreignKey':'FromWhatsappAccountId','as':_0x489f('0x1ec')});db[_0x489f('0x1fb')][_0x489f('0x11f')](db['WhatsappAccount'],{'foreignKey':_0x489f('0x1fc'),'as':'ToAccount'});db[_0x489f('0x1fb')][_0x489f('0x11f')](db['WhatsappQueue'],{'foreignKey':_0x489f('0x1fd'),'as':_0x489f('0x1e4')});db[_0x489f('0x1fb')][_0x489f('0x11f')](db[_0x489f('0x12')],{'foreignKey':_0x489f('0x1e1'),'as':_0x489f('0x1e2')});db[_0x489f('0x1fb')][_0x489f('0x11f')](db[_0x489f('0x12')],{'foreignKey':_0x489f('0x1e8'),'as':_0x489f('0x1e3')});db['WhatsappQueue']['belongsToMany'](db[_0x489f('0x12')],{'as':'Agents','through':_0x489f('0x34'),'foreignKey':_0x489f('0x1fe')});db[_0x489f('0x103')][_0x489f('0x122')](db[_0x489f('0xe0')],{'through':'team_has_whatsapp_queues','as':'Teams'});db['UserSetting'][_0x489f('0x11f')](db[_0x489f('0x12')],{'as':'user','foreignKey':_0x489f('0x111'),'onDelete':_0x489f('0x110'),'hooks':!![]});db[_0x489f('0x104')][_0x489f('0x10f')](db[_0x489f('0xb8')],{'as':_0x489f('0xb8'),'onDelete':_0x489f('0x174')});db[_0x489f('0x104')][_0x489f('0x10f')](db[_0x489f('0x35')],{'as':_0x489f('0x162'),'onDelete':_0x489f('0x174')});db[_0x489f('0x104')][_0x489f('0x10f')](db[_0x489f('0x37')],{'as':_0x489f('0x1ff'),'onDelete':_0x489f('0x174')});module[_0x489f('0x200')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 4e3c729..525ad2c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9582=['./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.13.0','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts'];(function(_0x5538d5,_0x190032){var _0x323b1a=function(_0x179caa){while(--_0x179caa){_0x5538d5['push'](_0x5538d5['shift']());}};_0x323b1a(++_0x190032);}(_0x9582,0x95));var _0x2958=function(_0x50b3c4,_0x49ac85){_0x50b3c4=_0x50b3c4-0x0;var _0xd6409d=_0x9582[_0x50b3c4];return _0xd6409d;};'use strict';var path=require(_0x2958('0x0'));var express=require(_0x2958('0x1'));var errors=require(_0x2958('0x2'));var config=require(_0x2958('0x3'));var setupLoggers=require(_0x2958('0x4'))[_0x2958('0x5')];var clientSideLogs=require('./api/client-side-logs');exports[_0x2958('0x6')]=function(_0x3b907e){return setupLoggers(_0x3b907e)[_0x2958('0x7')](function(){_0x3b907e[_0x2958('0x8')](_0x2958('0x9'),require(_0x2958('0xa')));_0x3b907e[_0x2958('0x8')](_0x2958('0xb'),require(_0x2958('0xc')));_0x3b907e[_0x2958('0x8')]('/api/voice/contexts',require('./api/voiceContext'));_0x3b907e[_0x2958('0x8')]('/api/voice/extensions',require(_0x2958('0xd')));_0x3b907e['use'](_0x2958('0xe'),require('./api/voiceMusicOnHold'));_0x3b907e[_0x2958('0x8')](_0x2958('0xf'),require(_0x2958('0x10')));_0x3b907e[_0x2958('0x8')](_0x2958('0x11'),require('./api/voiceRecording'));_0x3b907e[_0x2958('0x8')](_0x2958('0x12'),require(_0x2958('0x13')));_0x3b907e[_0x2958('0x8')](_0x2958('0x14'),require(_0x2958('0x15')));_0x3b907e[_0x2958('0x8')](_0x2958('0x16'),require('./api/voiceMailMessage'));_0x3b907e[_0x2958('0x8')](_0x2958('0x17'),require('./api/voiceCallReport'));_0x3b907e['use'](_0x2958('0x18'),require(_0x2958('0x19')));_0x3b907e['use'](_0x2958('0x1a'),require('./api/voiceAgentReport'));_0x3b907e['use'](_0x2958('0x1b'),require(_0x2958('0x1c')));_0x3b907e['use']('/api/members/reports',require(_0x2958('0x1d')));_0x3b907e[_0x2958('0x8')](_0x2958('0x1e'),require(_0x2958('0x1f')));_0x3b907e[_0x2958('0x8')]('/api/voice/transfers/reports',require(_0x2958('0x20')));_0x3b907e[_0x2958('0x8')](_0x2958('0x21'),require('./api/mailServerOut'));_0x3b907e[_0x2958('0x8')]('/api/mail/accounts',require(_0x2958('0x22')));_0x3b907e['use']('/api/mail/queues',require(_0x2958('0x23')));_0x3b907e[_0x2958('0x8')](_0x2958('0x24'),require(_0x2958('0x25')));_0x3b907e[_0x2958('0x8')](_0x2958('0x26'),require(_0x2958('0x27')));_0x3b907e[_0x2958('0x8')](_0x2958('0x28'),require(_0x2958('0x29')));_0x3b907e[_0x2958('0x8')](_0x2958('0x2a'),require(_0x2958('0x2b')));_0x3b907e[_0x2958('0x8')](_0x2958('0x2c'),require('./api/mailQueueReport'));_0x3b907e['use'](_0x2958('0x2d'),require(_0x2958('0x2e')));_0x3b907e[_0x2958('0x8')](_0x2958('0x2f'),require('./api/dashboardItem'));_0x3b907e[_0x2958('0x8')]('/api/fax/accounts',require(_0x2958('0x30')));_0x3b907e[_0x2958('0x8')](_0x2958('0x31'),require(_0x2958('0x32')));_0x3b907e[_0x2958('0x8')](_0x2958('0x33'),require(_0x2958('0x34')));_0x3b907e['use'](_0x2958('0x35'),require('./api/faxMessage'));_0x3b907e['use'](_0x2958('0x36'),require(_0x2958('0x37')));_0x3b907e[_0x2958('0x8')](_0x2958('0x38'),require(_0x2958('0x39')));_0x3b907e[_0x2958('0x8')](_0x2958('0x3a'),require(_0x2958('0x3b')));_0x3b907e['use'](_0x2958('0x3c'),require(_0x2958('0x3d')));_0x3b907e['use'](_0x2958('0x3e'),require('./api/smsInteraction'));_0x3b907e[_0x2958('0x8')]('/api/sms/messages',require(_0x2958('0x3f')));_0x3b907e['use'](_0x2958('0x40'),require(_0x2958('0x41')));_0x3b907e[_0x2958('0x8')](_0x2958('0x42'),require(_0x2958('0x43')));_0x3b907e[_0x2958('0x8')](_0x2958('0x44'),require(_0x2958('0x45')));_0x3b907e[_0x2958('0x8')]('/api/openchannel/interactions',require(_0x2958('0x46')));_0x3b907e['use'](_0x2958('0x47'),require('./api/openchannelMessage'));_0x3b907e[_0x2958('0x8')](_0x2958('0x48'),require(_0x2958('0x49')));_0x3b907e[_0x2958('0x8')](_0x2958('0x4a'),require(_0x2958('0x4b')));_0x3b907e[_0x2958('0x8')](_0x2958('0x4c'),require(_0x2958('0x4d')));_0x3b907e[_0x2958('0x8')](_0x2958('0x4e'),require(_0x2958('0x4f')));_0x3b907e[_0x2958('0x8')]('/api/chat/interactions',require(_0x2958('0x50')));_0x3b907e[_0x2958('0x8')](_0x2958('0x51'),require(_0x2958('0x52')));_0x3b907e['use'](_0x2958('0x53'),require(_0x2958('0x54')));_0x3b907e[_0x2958('0x8')](_0x2958('0x55'),require(_0x2958('0x56')));_0x3b907e[_0x2958('0x8')](_0x2958('0x57'),require(_0x2958('0x58')));_0x3b907e[_0x2958('0x8')](_0x2958('0x59'),require(_0x2958('0x5a')));_0x3b907e[_0x2958('0x8')](_0x2958('0x5b'),require('./api/cmCompany'));_0x3b907e[_0x2958('0x8')](_0x2958('0x5c'),require('./api/cmContact'));_0x3b907e['use'](_0x2958('0x5d'),require(_0x2958('0x5e')));_0x3b907e[_0x2958('0x8')](_0x2958('0x5f'),require(_0x2958('0x60')));_0x3b907e[_0x2958('0x8')](_0x2958('0x61'),require(_0x2958('0x62')));_0x3b907e[_0x2958('0x8')](_0x2958('0x63'),require(_0x2958('0x64')));_0x3b907e[_0x2958('0x8')](_0x2958('0x65'),require('./api/cmCustomField'));_0x3b907e[_0x2958('0x8')](_0x2958('0x66'),require(_0x2958('0x67')));_0x3b907e[_0x2958('0x8')]('/api/automations',require(_0x2958('0x68')));_0x3b907e['use']('/api/canned_answers',require(_0x2958('0x69')));_0x3b907e[_0x2958('0x8')](_0x2958('0x6a'),require(_0x2958('0x6b')));_0x3b907e[_0x2958('0x8')](_0x2958('0x6c'),require('./api/condition'));_0x3b907e[_0x2958('0x8')]('/api/intervals',require('./api/interval'));_0x3b907e[_0x2958('0x8')]('/api/pauses',require(_0x2958('0x6d')));_0x3b907e[_0x2958('0x8')](_0x2958('0x6e'),require(_0x2958('0x6f')));_0x3b907e[_0x2958('0x8')](_0x2958('0x70'),require(_0x2958('0x71')));_0x3b907e[_0x2958('0x8')]('/api/schedules',require(_0x2958('0x72')));_0x3b907e[_0x2958('0x8')](_0x2958('0x73'),require(_0x2958('0x74')));_0x3b907e['use'](_0x2958('0x75'),require(_0x2958('0x76')));_0x3b907e['use'](_0x2958('0x77'),require(_0x2958('0x78')));_0x3b907e[_0x2958('0x8')](_0x2958('0x79'),require(_0x2958('0x7a')));_0x3b907e[_0x2958('0x8')]('/api/cm_hopper_additional_phones',require(_0x2958('0x7b')));_0x3b907e[_0x2958('0x8')](_0x2958('0x7c'),require(_0x2958('0x7d')));_0x3b907e[_0x2958('0x8')](_0x2958('0x7e'),require(_0x2958('0x7f')));_0x3b907e[_0x2958('0x8')](_0x2958('0x80'),require(_0x2958('0x81')));_0x3b907e[_0x2958('0x8')](_0x2958('0x82'),require(_0x2958('0x83')));_0x3b907e[_0x2958('0x8')](_0x2958('0x84'),require(_0x2958('0x85')));_0x3b907e[_0x2958('0x8')]('/api/analytics/custom_reports',require(_0x2958('0x86')));_0x3b907e['use'](_0x2958('0x87'),require(_0x2958('0x88')));_0x3b907e[_0x2958('0x8')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x3b907e[_0x2958('0x8')](_0x2958('0x89'),require(_0x2958('0x8a')));_0x3b907e['use']('/api/analytics/field_reports',require(_0x2958('0x8b')));_0x3b907e[_0x2958('0x8')](_0x2958('0x8c'),require(_0x2958('0x8d')));_0x3b907e[_0x2958('0x8')](_0x2958('0x8e'),require(_0x2958('0x8f')));_0x3b907e[_0x2958('0x8')](_0x2958('0x90'),require('./api/intSalesforceConfiguration'));_0x3b907e[_0x2958('0x8')](_0x2958('0x91'),require('./api/intSalesforceField'));_0x3b907e[_0x2958('0x8')](_0x2958('0x92'),require(_0x2958('0x93')));_0x3b907e[_0x2958('0x8')](_0x2958('0x94'),require(_0x2958('0x95')));_0x3b907e['use'](_0x2958('0x96'),require(_0x2958('0x97')));_0x3b907e[_0x2958('0x8')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x3b907e[_0x2958('0x8')]('/api/integrations/desk/configurations',require(_0x2958('0x98')));_0x3b907e['use'](_0x2958('0x99'),require(_0x2958('0x9a')));_0x3b907e[_0x2958('0x8')](_0x2958('0x9b'),require(_0x2958('0x9c')));_0x3b907e['use']('/api/integrations/zoho/configurations',require(_0x2958('0x9d')));_0x3b907e[_0x2958('0x8')](_0x2958('0x9e'),require('./api/intZohoField'));_0x3b907e['use'](_0x2958('0x9f'),require(_0x2958('0xa0')));_0x3b907e[_0x2958('0x8')](_0x2958('0xa1'),require(_0x2958('0xa2')));_0x3b907e[_0x2958('0x8')](_0x2958('0xa3'),require(_0x2958('0xa4')));_0x3b907e[_0x2958('0x8')](_0x2958('0xa5'),require(_0x2958('0xa6')));_0x3b907e[_0x2958('0x8')](_0x2958('0xa7'),require('./api/intFreshdeskConfiguration'));_0x3b907e[_0x2958('0x8')](_0x2958('0xa8'),require(_0x2958('0xa9')));_0x3b907e[_0x2958('0x8')](_0x2958('0xaa'),require(_0x2958('0xab')));_0x3b907e[_0x2958('0x8')](_0x2958('0xac'),require(_0x2958('0xad')));_0x3b907e['use'](_0x2958('0xae'),require('./api/intVtigerField'));_0x3b907e[_0x2958('0x8')](_0x2958('0xaf'),require(_0x2958('0xb0')));_0x3b907e['use']('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x3b907e[_0x2958('0x8')](_0x2958('0xb1'),require(_0x2958('0xb2')));_0x3b907e[_0x2958('0x8')](_0x2958('0xb3'),require(_0x2958('0xb4')));_0x3b907e[_0x2958('0x8')](_0x2958('0xb5'),require('./api/intDynamics365Configuration'));_0x3b907e['use'](_0x2958('0xb6'),require(_0x2958('0xb7')));_0x3b907e[_0x2958('0x8')](_0x2958('0xb8'),require('./api/intFreshsalesAccount'));_0x3b907e[_0x2958('0x8')](_0x2958('0xb9'),require(_0x2958('0xba')));_0x3b907e[_0x2958('0x8')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x3b907e['use']('/api/networks',require(_0x2958('0xbb')));_0x3b907e[_0x2958('0x8')]('/api/chat/reports/queue',require(_0x2958('0xbc')));_0x3b907e[_0x2958('0x8')](_0x2958('0xbd'),require(_0x2958('0xbe')));_0x3b907e[_0x2958('0x8')](_0x2958('0xbf'),require('./api/jscriptyAnswerReport'));_0x3b907e[_0x2958('0x8')](_0x2958('0xc0'),require(_0x2958('0xc1')));_0x3b907e['use'](_0x2958('0xc2'),require('./api/jscriptySessionReport'));_0x3b907e['use']('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x3b907e[_0x2958('0x8')]('/api/square/reports',require(_0x2958('0xc3')));_0x3b907e[_0x2958('0x8')](_0x2958('0xc4'),require(_0x2958('0xc5')));_0x3b907e[_0x2958('0x8')](_0x2958('0xc6'),require('./api/jscriptyProject'));_0x3b907e[_0x2958('0x8')](_0x2958('0xc7'),require(_0x2958('0xc8')));_0x3b907e[_0x2958('0x8')](_0x2958('0xc9'),require(_0x2958('0xca')));_0x3b907e[_0x2958('0x8')](_0x2958('0xcb'),require(_0x2958('0xcc')));_0x3b907e[_0x2958('0x8')](_0x2958('0xcd'),require(_0x2958('0xce')));_0x3b907e[_0x2958('0x8')](_0x2958('0xcf'),require(_0x2958('0xd0')));_0x3b907e[_0x2958('0x8')](_0x2958('0xd1'),require(_0x2958('0xd2')));_0x3b907e[_0x2958('0x8')](_0x2958('0xd3'),require(_0x2958('0xd4')));_0x3b907e['use'](_0x2958('0xd5'),require(_0x2958('0xd6')));_0x3b907e[_0x2958('0x8')](_0x2958('0xd7'),require(_0x2958('0xd8')));_0x3b907e['use'](_0x2958('0xd9'),require(_0x2958('0xda')));_0x3b907e[_0x2958('0x8')](_0x2958('0xdb'),require(_0x2958('0xdc')));_0x3b907e[_0x2958('0x8')](_0x2958('0xdd'),require(_0x2958('0xde')));_0x3b907e[_0x2958('0x8')](_0x2958('0xdf'),require(_0x2958('0xe0')));_0x3b907e[_0x2958('0x8')](_0x2958('0xe1'),require(_0x2958('0xe2')));_0x3b907e[_0x2958('0x8')](_0x2958('0xe3'),require(_0x2958('0xe4')));_0x3b907e[_0x2958('0x8')](_0x2958('0xe5'),require(_0x2958('0xe6')));_0x3b907e[_0x2958('0x8')](_0x2958('0xe7'),require(_0x2958('0xe8')));_0x3b907e[_0x2958('0x8')]('/api/voice/prefixes',require(_0x2958('0xe9')));_0x3b907e[_0x2958('0x8')](_0x2958('0xea'),require(_0x2958('0xeb')));_0x3b907e[_0x2958('0x8')](_0x2958('0xec'),require(_0x2958('0xed')));_0x3b907e[_0x2958('0x8')](_0x2958('0xee'),require(_0x2958('0xef')));_0x3b907e[_0x2958('0x8')](_0x2958('0xf0'),require('./api/userNotification'));_0x3b907e[_0x2958('0x8')](_0x2958('0xf1'),require(_0x2958('0xf2')));_0x3b907e[_0x2958('0x8')](_0x2958('0xf3'),require(_0x2958('0xf4')));_0x3b907e['use'](_0x2958('0xf5'),require(_0x2958('0xf6')));_0x3b907e[_0x2958('0x8')](_0x2958('0xf7'),require(_0x2958('0xf8')));_0x3b907e['use'](_0x2958('0xf9'),require(_0x2958('0xfa')));_0x3b907e[_0x2958('0x8')](_0x2958('0xfb'),require(_0x2958('0xfc')));_0x3b907e[_0x2958('0x8')](_0x2958('0xfd'),require(_0x2958('0xfe')));_0x3b907e[_0x2958('0x8')](_0x2958('0xff'),require(_0x2958('0x100')));_0x3b907e['use'](_0x2958('0x101'),require(_0x2958('0x102')));_0x3b907e['use']('/api/user-settings',require(_0x2958('0x103')));_0x3b907e[_0x2958('0x8')]('/api/mail_interaction_has_tags',require(_0x2958('0x104')));_0x3b907e[_0x2958('0x8')](_0x2958('0x105'),require('./api/authLocal'));_0x3b907e[_0x2958('0x8')](_0x2958('0x106'),require(_0x2958('0x107')));_0x3b907e[_0x2958('0x8')](_0x2958('0x108'),require(_0x2958('0x109')));_0x3b907e['use'](_0x2958('0x10a'),require(_0x2958('0x10b')));_0x3b907e[_0x2958('0x8')](_0x2958('0x10c'),require('./api/rpc'));_0x3b907e['use']('/api/version',require(_0x2958('0x10d')));_0x3b907e['use'](_0x2958('0x10e'),require('./api/system'));_0x3b907e['use'](_0x2958('0x10f'),require(_0x2958('0x110')));_0x3b907e['use'](_0x2958('0x111'),require(_0x2958('0x112')));_0x3b907e[_0x2958('0x8')](_0x2958('0x113'),clientSideLogs);_0x3b907e[_0x2958('0x8')]('/apidoc',express[_0x2958('0x114')](path[_0x2958('0x115')](config[_0x2958('0x116')],_0x2958('0x117'))));_0x3b907e[_0x2958('0x8')](_0x2958('0x118'),express[_0x2958('0x114')](path[_0x2958('0x115')](config[_0x2958('0x116')],'/www')));_0x3b907e[_0x2958('0x8')](_0x2958('0x119'),express[_0x2958('0x114')](path['join'](config[_0x2958('0x116')],_0x2958('0x119'))));_0x3b907e[_0x2958('0x8')](_0x2958('0x11a'),express[_0x2958('0x114')](path[_0x2958('0x115')](config[_0x2958('0x116')],_0x2958('0x11b'),_0x2958('0x11c'))));_0x3b907e[_0x2958('0x8')]('/plugins',express[_0x2958('0x114')](path['join'](config['root'],_0x2958('0x11d'))));_0x3b907e[_0x2958('0x11e')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x3b907e['route']('/*')[_0x2958('0x11f')](function(_0x8ca614,_0x486650){_0x486650[_0x2958('0x120')](path[_0x2958('0x121')](_0x3b907e[_0x2958('0x11f')](_0x2958('0x122'))+_0x2958('0x123')));});return _0x3b907e;});}; \ No newline at end of file +var _0xed1c=['./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/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/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperHistory','./api/cmCustomField','/api/actions','/api/automations','./api/disposition','/api/conditions','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareProject','/api/square/messages','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','root','static','join','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','path','express','./api/client-side-logs','default','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports'];(function(_0x4756ec,_0x169708){var _0x55e9dc=function(_0x5508ed){while(--_0x5508ed){_0x4756ec['push'](_0x4756ec['shift']());}};_0x55e9dc(++_0x169708);}(_0xed1c,0xe4));var _0xced1=function(_0x4f9023,_0x5ad732){_0x4f9023=_0x4f9023-0x0;var _0x55f6a0=_0xed1c[_0x4f9023];return _0x55f6a0;};'use strict';var path=require(_0xced1('0x0'));var express=require(_0xced1('0x1'));var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0xced1('0x2'));exports[_0xced1('0x3')]=function(_0x79202e){return setupLoggers(_0x79202e)['then'](function(){_0x79202e[_0xced1('0x4')](_0xced1('0x5'),require(_0xced1('0x6')));_0x79202e[_0xced1('0x4')]('/api/voice/chanspy',require(_0xced1('0x7')));_0x79202e[_0xced1('0x4')](_0xced1('0x8'),require(_0xced1('0x9')));_0x79202e[_0xced1('0x4')](_0xced1('0xa'),require(_0xced1('0xb')));_0x79202e[_0xced1('0x4')]('/api/voice/mohs',require(_0xced1('0xc')));_0x79202e['use'](_0xced1('0xd'),require(_0xced1('0xe')));_0x79202e[_0xced1('0x4')](_0xced1('0xf'),require(_0xced1('0x10')));_0x79202e[_0xced1('0x4')](_0xced1('0x11'),require('./api/screenRecording'));_0x79202e[_0xced1('0x4')](_0xced1('0x12'),require(_0xced1('0x13')));_0x79202e[_0xced1('0x4')]('/api/voice/mails/messages',require(_0xced1('0x14')));_0x79202e[_0xced1('0x4')]('/api/voice/calls/reports',require(_0xced1('0x15')));_0x79202e[_0xced1('0x4')](_0xced1('0x16'),require(_0xced1('0x17')));_0x79202e['use']('/api/voice/agents/reports',require(_0xced1('0x18')));_0x79202e[_0xced1('0x4')](_0xced1('0x19'),require(_0xced1('0x1a')));_0x79202e[_0xced1('0x4')](_0xced1('0x1b'),require('./api/memberReport'));_0x79202e['use'](_0xced1('0x1c'),require(_0xced1('0x1d')));_0x79202e[_0xced1('0x4')]('/api/voice/transfers/reports',require(_0xced1('0x1e')));_0x79202e[_0xced1('0x4')](_0xced1('0x1f'),require('./api/mailServerOut'));_0x79202e[_0xced1('0x4')](_0xced1('0x20'),require(_0xced1('0x21')));_0x79202e['use'](_0xced1('0x22'),require(_0xced1('0x23')));_0x79202e[_0xced1('0x4')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x79202e[_0xced1('0x4')](_0xced1('0x24'),require(_0xced1('0x25')));_0x79202e[_0xced1('0x4')](_0xced1('0x26'),require('./api/mailMessage'));_0x79202e[_0xced1('0x4')](_0xced1('0x27'),require('./api/mailApplication'));_0x79202e['use'](_0xced1('0x28'),require(_0xced1('0x29')));_0x79202e[_0xced1('0x4')](_0xced1('0x2a'),require(_0xced1('0x2b')));_0x79202e[_0xced1('0x4')]('/api/dashboards/items',require(_0xced1('0x2c')));_0x79202e[_0xced1('0x4')](_0xced1('0x2d'),require(_0xced1('0x2e')));_0x79202e[_0xced1('0x4')](_0xced1('0x2f'),require(_0xced1('0x30')));_0x79202e['use'](_0xced1('0x31'),require('./api/faxInteraction'));_0x79202e[_0xced1('0x4')](_0xced1('0x32'),require(_0xced1('0x33')));_0x79202e[_0xced1('0x4')]('/api/fax/queues',require('./api/faxQueue'));_0x79202e[_0xced1('0x4')](_0xced1('0x34'),require(_0xced1('0x35')));_0x79202e['use']('/api/sms/accounts',require('./api/smsAccount'));_0x79202e[_0xced1('0x4')](_0xced1('0x36'),require(_0xced1('0x37')));_0x79202e[_0xced1('0x4')]('/api/sms/interactions',require(_0xced1('0x38')));_0x79202e[_0xced1('0x4')](_0xced1('0x39'),require(_0xced1('0x3a')));_0x79202e[_0xced1('0x4')](_0xced1('0x3b'),require(_0xced1('0x3c')));_0x79202e['use']('/api/openchannel/accounts',require(_0xced1('0x3d')));_0x79202e[_0xced1('0x4')](_0xced1('0x3e'),require(_0xced1('0x3f')));_0x79202e[_0xced1('0x4')](_0xced1('0x40'),require('./api/openchannelInteraction'));_0x79202e['use']('/api/openchannel/messages',require('./api/openchannelMessage'));_0x79202e[_0xced1('0x4')](_0xced1('0x41'),require(_0xced1('0x42')));_0x79202e[_0xced1('0x4')](_0xced1('0x43'),require(_0xced1('0x44')));_0x79202e[_0xced1('0x4')](_0xced1('0x45'),require(_0xced1('0x46')));_0x79202e[_0xced1('0x4')](_0xced1('0x47'),require(_0xced1('0x48')));_0x79202e[_0xced1('0x4')]('/api/chat/interactions',require(_0xced1('0x49')));_0x79202e[_0xced1('0x4')](_0xced1('0x4a'),require(_0xced1('0x4b')));_0x79202e[_0xced1('0x4')](_0xced1('0x4c'),require('./api/chatOfflineMessage'));_0x79202e[_0xced1('0x4')](_0xced1('0x4d'),require(_0xced1('0x4e')));_0x79202e[_0xced1('0x4')](_0xced1('0x4f'),require(_0xced1('0x50')));_0x79202e[_0xced1('0x4')](_0xced1('0x51'),require(_0xced1('0x52')));_0x79202e[_0xced1('0x4')](_0xced1('0x53'),require('./api/cmCompany'));_0x79202e['use'](_0xced1('0x54'),require(_0xced1('0x55')));_0x79202e[_0xced1('0x4')]('/api/cm/hopper',require(_0xced1('0x56')));_0x79202e[_0xced1('0x4')](_0xced1('0x57'),require('./api/cmHopperBlack'));_0x79202e[_0xced1('0x4')](_0xced1('0x58'),require('./api/cmHopperFinal'));_0x79202e[_0xced1('0x4')]('/api/cm/hopper_history',require(_0xced1('0x59')));_0x79202e[_0xced1('0x4')]('/api/cm/custom_fields',require(_0xced1('0x5a')));_0x79202e[_0xced1('0x4')](_0xced1('0x5b'),require('./api/action'));_0x79202e[_0xced1('0x4')](_0xced1('0x5c'),require('./api/automation'));_0x79202e[_0xced1('0x4')]('/api/canned_answers',require('./api/cannedAnswer'));_0x79202e[_0xced1('0x4')]('/api/dispositions',require(_0xced1('0x5d')));_0x79202e[_0xced1('0x4')](_0xced1('0x5e'),require('./api/condition'));_0x79202e[_0xced1('0x4')]('/api/intervals',require(_0xced1('0x5f')));_0x79202e[_0xced1('0x4')](_0xced1('0x60'),require(_0xced1('0x61')));_0x79202e['use'](_0xced1('0x62'),require(_0xced1('0x63')));_0x79202e['use'](_0xced1('0x64'),require(_0xced1('0x65')));_0x79202e['use'](_0xced1('0x66'),require(_0xced1('0x67')));_0x79202e[_0xced1('0x4')]('/api/sounds',require(_0xced1('0x68')));_0x79202e[_0xced1('0x4')](_0xced1('0x69'),require(_0xced1('0x6a')));_0x79202e[_0xced1('0x4')]('/api/contact_item_types',require(_0xced1('0x6b')));_0x79202e['use'](_0xced1('0x6c'),require(_0xced1('0x6d')));_0x79202e[_0xced1('0x4')](_0xced1('0x6e'),require(_0xced1('0x6f')));_0x79202e[_0xced1('0x4')]('/api/templates',require(_0xced1('0x70')));_0x79202e[_0xced1('0x4')]('/api/triggers',require(_0xced1('0x71')));_0x79202e['use']('/api/variables',require(_0xced1('0x72')));_0x79202e[_0xced1('0x4')](_0xced1('0x73'),require(_0xced1('0x74')));_0x79202e['use'](_0xced1('0x75'),require(_0xced1('0x76')));_0x79202e[_0xced1('0x4')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x79202e[_0xced1('0x4')](_0xced1('0x77'),require(_0xced1('0x78')));_0x79202e[_0xced1('0x4')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x79202e['use'](_0xced1('0x79'),require(_0xced1('0x7a')));_0x79202e[_0xced1('0x4')](_0xced1('0x7b'),require(_0xced1('0x7c')));_0x79202e[_0xced1('0x4')](_0xced1('0x7d'),require(_0xced1('0x7e')));_0x79202e[_0xced1('0x4')]('/api/integrations/salesforce/accounts',require(_0xced1('0x7f')));_0x79202e[_0xced1('0x4')](_0xced1('0x80'),require('./api/intSalesforceConfiguration'));_0x79202e[_0xced1('0x4')](_0xced1('0x81'),require(_0xced1('0x82')));_0x79202e[_0xced1('0x4')]('/api/integrations/sugarcrm/accounts',require(_0xced1('0x83')));_0x79202e['use']('/api/integrations/sugarcrm/configurations',require(_0xced1('0x84')));_0x79202e[_0xced1('0x4')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x79202e['use'](_0xced1('0x85'),require('./api/intDeskAccount'));_0x79202e[_0xced1('0x4')](_0xced1('0x86'),require(_0xced1('0x87')));_0x79202e[_0xced1('0x4')](_0xced1('0x88'),require(_0xced1('0x89')));_0x79202e[_0xced1('0x4')](_0xced1('0x8a'),require('./api/intZohoAccount'));_0x79202e['use'](_0xced1('0x8b'),require(_0xced1('0x8c')));_0x79202e[_0xced1('0x4')](_0xced1('0x8d'),require('./api/intZohoField'));_0x79202e[_0xced1('0x4')](_0xced1('0x8e'),require(_0xced1('0x8f')));_0x79202e[_0xced1('0x4')]('/api/integrations/zendesk/configurations',require(_0xced1('0x90')));_0x79202e[_0xced1('0x4')](_0xced1('0x91'),require(_0xced1('0x92')));_0x79202e[_0xced1('0x4')](_0xced1('0x93'),require(_0xced1('0x94')));_0x79202e[_0xced1('0x4')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x79202e['use'](_0xced1('0x95'),require('./api/intFreshdeskField'));_0x79202e[_0xced1('0x4')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x79202e[_0xced1('0x4')](_0xced1('0x96'),require(_0xced1('0x97')));_0x79202e[_0xced1('0x4')](_0xced1('0x98'),require(_0xced1('0x99')));_0x79202e[_0xced1('0x4')](_0xced1('0x9a'),require(_0xced1('0x9b')));_0x79202e[_0xced1('0x4')](_0xced1('0x9c'),require('./api/intServicenowConfiguration'));_0x79202e[_0xced1('0x4')](_0xced1('0x9d'),require('./api/intServicenowField'));_0x79202e[_0xced1('0x4')](_0xced1('0x9e'),require('./api/intDynamics365Account'));_0x79202e[_0xced1('0x4')](_0xced1('0x9f'),require(_0xced1('0xa0')));_0x79202e[_0xced1('0x4')](_0xced1('0xa1'),require('./api/intDynamics365Field'));_0x79202e['use']('/api/integrations/freshsales/accounts',require(_0xced1('0xa2')));_0x79202e[_0xced1('0x4')]('/api/integrations/freshsales/configurations',require(_0xced1('0xa3')));_0x79202e[_0xced1('0x4')](_0xced1('0xa4'),require('./api/intFreshsalesField'));_0x79202e[_0xced1('0x4')](_0xced1('0xa5'),require('./api/network'));_0x79202e[_0xced1('0x4')]('/api/chat/reports/queue',require(_0xced1('0xa6')));_0x79202e[_0xced1('0x4')](_0xced1('0xa7'),require(_0xced1('0xa8')));_0x79202e[_0xced1('0x4')](_0xced1('0xa9'),require(_0xced1('0xaa')));_0x79202e['use'](_0xced1('0xab'),require(_0xced1('0xac')));_0x79202e[_0xced1('0x4')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x79202e[_0xced1('0x4')](_0xced1('0xad'),require('./api/smsQueueReport'));_0x79202e[_0xced1('0x4')](_0xced1('0xae'),require(_0xced1('0xaf')));_0x79202e['use']('/api/square/details/reports',require(_0xced1('0xb0')));_0x79202e[_0xced1('0x4')](_0xced1('0xb1'),require(_0xced1('0xb2')));_0x79202e[_0xced1('0x4')](_0xced1('0xb3'),require('./api/setting'));_0x79202e[_0xced1('0x4')]('/api/square/odbc',require('./api/squareOdbc'));_0x79202e['use']('/api/square/projects',require(_0xced1('0xb4')));_0x79202e[_0xced1('0x4')]('/api/square/recordings',require('./api/squareRecording'));_0x79202e[_0xced1('0x4')](_0xced1('0xb5'),require('./api/squareMessage'));_0x79202e['use'](_0xced1('0xb6'),require(_0xced1('0xb7')));_0x79202e['use']('/api/license',require('./api/license'));_0x79202e['use'](_0xced1('0xb8'),require(_0xced1('0xb9')));_0x79202e[_0xced1('0x4')](_0xced1('0xba'),require(_0xced1('0xbb')));_0x79202e[_0xced1('0x4')]('/api/attachments',require(_0xced1('0xbc')));_0x79202e[_0xced1('0x4')](_0xced1('0xbd'),require(_0xced1('0xbe')));_0x79202e[_0xced1('0x4')](_0xced1('0xbf'),require(_0xced1('0xc0')));_0x79202e[_0xced1('0x4')](_0xced1('0xc1'),require('./api/chatTransferReport'));_0x79202e['use'](_0xced1('0xc2'),require('./api/faxTransferReport'));_0x79202e[_0xced1('0x4')]('/api/openchannel/reports/transfer',require(_0xced1('0xc3')));_0x79202e[_0xced1('0x4')](_0xced1('0xc4'),require(_0xced1('0xc5')));_0x79202e[_0xced1('0x4')](_0xced1('0xc6'),require('./api/cmList'));_0x79202e[_0xced1('0x4')](_0xced1('0xc7'),require(_0xced1('0xc8')));_0x79202e[_0xced1('0x4')](_0xced1('0xc9'),require(_0xced1('0xca')));_0x79202e['use']('/api/userProfile/sections',require(_0xced1('0xcb')));_0x79202e[_0xced1('0x4')](_0xced1('0xcc'),require(_0xced1('0xcd')));_0x79202e[_0xced1('0x4')]('/api/userNotifications',require(_0xced1('0xce')));_0x79202e[_0xced1('0x4')](_0xced1('0xcf'),require(_0xced1('0xd0')));_0x79202e['use'](_0xced1('0xd1'),require(_0xced1('0xd2')));_0x79202e['use'](_0xced1('0xd3'),require('./api/whatsappInteraction'));_0x79202e[_0xced1('0x4')](_0xced1('0xd4'),require(_0xced1('0xd5')));_0x79202e[_0xced1('0x4')](_0xced1('0xd6'),require(_0xced1('0xd7')));_0x79202e[_0xced1('0x4')](_0xced1('0xd8'),require(_0xced1('0xd9')));_0x79202e[_0xced1('0x4')]('/api/whatsapp/queues',require(_0xced1('0xda')));_0x79202e[_0xced1('0x4')](_0xced1('0xdb'),require(_0xced1('0xdc')));_0x79202e['use'](_0xced1('0xdd'),require(_0xced1('0xde')));_0x79202e[_0xced1('0x4')](_0xced1('0xdf'),require('./api/user-setting'));_0x79202e[_0xced1('0x4')](_0xced1('0xe0'),require(_0xced1('0xe1')));_0x79202e[_0xced1('0x4')](_0xced1('0xe2'),require('./api/authLocal'));_0x79202e[_0xced1('0x4')]('/api/auth/google',require(_0xced1('0xe3')));_0x79202e[_0xced1('0x4')](_0xced1('0xe4'),require('./api/authActiveDirectory'));_0x79202e[_0xced1('0x4')](_0xced1('0xe5'),require('./api/jira'));_0x79202e[_0xced1('0x4')]('/api/rpc',require(_0xced1('0xe6')));_0x79202e[_0xced1('0x4')](_0xced1('0xe7'),require('./api/version'));_0x79202e['use'](_0xced1('0xe8'),require(_0xced1('0xe9')));_0x79202e[_0xced1('0x4')](_0xced1('0xea'),require(_0xced1('0xeb')));_0x79202e['use']('/api/webbar',require(_0xced1('0xec')));_0x79202e[_0xced1('0x4')](_0xced1('0xed'),clientSideLogs);_0x79202e['use'](_0xced1('0xee'),express['static'](path['join'](config[_0xced1('0xef')],'/apidoc')));_0x79202e[_0xced1('0x4')]('/www',express[_0xced1('0xf0')](path[_0xced1('0xf1')](config[_0xced1('0xef')],_0xced1('0xf2'))));_0x79202e[_0xced1('0x4')](_0xced1('0xf3'),express[_0xced1('0xf0')](path['join'](config['root'],_0xced1('0xf3'))));_0x79202e[_0xced1('0x4')](_0xced1('0xf4'),express[_0xced1('0xf0')](path['join'](config['root'],_0xced1('0xf5'),'3.13.0')));_0x79202e[_0xced1('0x4')](_0xced1('0xf6'),express[_0xced1('0xf0')](path['join'](config[_0xced1('0xef')],_0xced1('0xf7'))));_0x79202e['route'](_0xced1('0xf8'))[_0xced1('0xf9')](errors[0x194]);_0x79202e[_0xced1('0xfa')]('/*')['get'](function(_0x2f4f7a,_0x13fc12){_0x13fc12[_0xced1('0xfb')](path[_0xced1('0xfc')](_0x79202e[_0xced1('0xf9')](_0xced1('0xfd'))+'/index.html'));});return _0x79202e;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 71b73b1..44464f0 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad1b=['../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc'];(function(_0x4ed48a,_0x5217ff){var _0x1e7be0=function(_0x4add36){while(--_0x4add36){_0x4ed48a['push'](_0x4ed48a['shift']());}};_0x1e7be0(++_0x5217ff);}(_0xad1b,0x12f));var _0xbad1=function(_0x3e0ddc,_0x2f89d1){_0x3e0ddc=_0x3e0ddc-0x0;var _0x4d6ece=_0xad1b[_0x3e0ddc];return _0x4d6ece;};'use strict';var jayson=require(_0xbad1('0x0'));var _=require(_0xbad1('0x1'));var config=require(_0xbad1('0x2'));exports[_0xbad1('0x3')]=function(){return new Promise(function(_0x18b5a0,_0x1a3a91){var _0x45c0bf={};_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x5')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x6')));_0x45c0bf=_['merge'](_0x45c0bf,require('../api/voiceQueue/voiceQueue.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x7')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x8')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x9')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0xa')));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0xb')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/trunk/trunk.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0xc')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0xd')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0xe')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0xf')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x10')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x11')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/mailApplication/mailApplication.rpc'));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x12')));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x13')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x14')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x15')));_0x45c0bf=_['merge'](_0x45c0bf,require('../api/faxMessage/faxMessage.rpc'));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x16')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x17')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x18')));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x19')));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x1a')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x1b')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x1c')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x1d')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x1e')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x1f')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x20')));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x21')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x22')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x23')));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x24')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x25')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x26')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x27')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x28')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/interval/interval.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x29')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/sound/sound.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x45c0bf=_['merge'](_0x45c0bf,require('../api/template/template.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x2a')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x2b')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x2c')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x2d')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x2e')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x2f')));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x30')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x31')));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x32')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x33')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/squareReport/squareReport.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x34')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x35')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x36')));_0x45c0bf=_['merge'](_0x45c0bf,require(_0xbad1('0x37')));_0x45c0bf=_['merge'](_0x45c0bf,require('../api/squareMessage/squareMessage.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x38')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x39')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x3a')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x3b')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x3c')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x3d')));_0x45c0bf=_[_0xbad1('0x4')](_0x45c0bf,require(_0xbad1('0x3e')));var _0x4f2ad8=jayson[_0xbad1('0x3f')](_0x45c0bf)[_0xbad1('0x40')]();var _0xdc7b14=config['rpc']['port']||config['port']+0x1;var _0x19d5e0=config[_0xbad1('0x41')]['ip']||_0xbad1('0x42');_0x4f2ad8['on'](_0xbad1('0x43'),function(_0x28f45a){return _0x1a3a91(_0x28f45a);});_0x4f2ad8[_0xbad1('0x3')](_0xdc7b14,_0x19d5e0,function(){console['log'](_0xbad1('0x44'),_0x19d5e0,_0xdc7b14);require(_0xbad1('0x45'))[_0xbad1('0x46')]();return _0x18b5a0(_0xbad1('0x47')+_0x19d5e0+':'+_0xdc7b14);});});}; \ No newline at end of file +var _0x6d67=['../config/triggers','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','server','http','rpc'];(function(_0x2e1387,_0x2fd52a){var _0xda65a6=function(_0x59d3f5){while(--_0x59d3f5){_0x2e1387['push'](_0x2e1387['shift']());}};_0xda65a6(++_0x2fd52a);}(_0x6d67,0xb5));var _0x76d6=function(_0x219c32,_0x2e5c63){_0x219c32=_0x219c32-0x0;var _0x442f4e=_0x6d67[_0x219c32];return _0x442f4e;};'use strict';var jayson=require(_0x76d6('0x0'));var _=require(_0x76d6('0x1'));var config=require(_0x76d6('0x2'));exports[_0x76d6('0x3')]=function(){return new Promise(function(_0x58da38,_0x2063e5){var _0x3eba8f={};_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x4')));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x5')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x7')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/voiceRecording/voiceRecording.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x8')));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x9')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0xa')));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0xb')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0xc')));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0xd')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0xe')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/mailAccount/mailAccount.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0xf')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/mailInteraction/mailInteraction.rpc'));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x10')));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x11')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x12')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x13')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/faxApplication/faxApplication.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x14')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x15')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/faxQueue/faxQueue.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x16')));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x17')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/smsInteraction/smsInteraction.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x18')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/smsQueue/smsQueue.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x19')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x1a')));_0x3eba8f=_['merge'](_0x3eba8f,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x1b')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x1c')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/chatInteraction/chatInteraction.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x1d')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/chatQueue/chatQueue.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x1e')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x1f')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x20')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x21')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x22')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x23')));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x24')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x25')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/template/template.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x26')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/variable/variable.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x27')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x28')));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x29')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x2a')));_0x3eba8f=_['merge'](_0x3eba8f,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x2b')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x2c')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x2d')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x2e')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x2f')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x30')));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x31')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/setting/setting.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/squareOdbc/squareOdbc.rpc'));_0x3eba8f=_['merge'](_0x3eba8f,require(_0x76d6('0x32')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x33')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/squareMessage/squareMessage.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/campaign/campaign.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x34')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x35')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x36')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require(_0x76d6('0x37')));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3eba8f=_[_0x76d6('0x6')](_0x3eba8f,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0xba1d5b=jayson[_0x76d6('0x38')](_0x3eba8f)[_0x76d6('0x39')]();var _0x4e7ff9=config[_0x76d6('0x3a')]['port']||config['port']+0x1;var _0x206423=config[_0x76d6('0x3a')]['ip']||'localhost';_0xba1d5b['on']('error',function(_0x18ba23){return _0x2063e5(_0x18ba23);});_0xba1d5b['listen'](_0x4e7ff9,_0x206423,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x206423,_0x4e7ff9);require(_0x76d6('0x3b'))['default']();return _0x58da38('RPC\x20listening\x20on\x20'+_0x206423+':'+_0x4e7ff9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f3e2530..58a3b25 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 _0xcd40=['exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','HANGUP','setVariable','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./reply','./error','call','utf8','setEncoding','emit','ready','line','toLowerCase','hangup','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','substring','length','match','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22'];(function(_0x2a9153,_0x44fd73){var _0x2f6615=function(_0x3d50c9){while(--_0x3d50c9){_0x2a9153['push'](_0x2a9153['shift']());}};_0x2f6615(++_0x44fd73);}(_0xcd40,0x101));var _0x0cd4=function(_0xce8183,_0x567545){_0xce8183=_0xce8183-0x0;var _0x27c555=_0xcd40[_0xce8183];return _0x27c555;};'use strict';var util=require(_0x0cd4('0x0'));var _=require(_0x0cd4('0x1'));var EventEmitter=require(_0x0cd4('0x2'))['EventEmitter'];var AGIReply=require(_0x0cd4('0x3'));var AGIError=require(_0x0cd4('0x4'));function AGIChannel(_0xc2328a){var _0x330d96=this,_0x58ea00=new AGIReply(),_0x3669b8=![],_0x314596={};EventEmitter[_0x0cd4('0x5')](_0x330d96);_0xc2328a['setEncoding'](_0x0cd4('0x6'));_0xc2328a['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x58ea00[_0x0cd4('0x7')](_0x0cd4('0x6'));_0x58ea00['on']('headers',function(_0x23a9b2){for(var _0x4a7688 in _0x23a9b2){_0x330d96[_0x4a7688]=_0x23a9b2[_0x4a7688];}_0x330d96[_0x0cd4('0x8')](_0x0cd4('0x9'));});_0x58ea00['on'](_0x0cd4('0xa'),function(_0x719e98){if(_0x719e98[_0x0cd4('0xb')]()==_0x0cd4('0xc')){_0x330d96[_0x0cd4('0x8')]('hangup');return;}if(_0x719e98['substring'](0x0,0xb)=='520-Invalid'){_0x3669b8=!![];}if(_0x3669b8){_0x314596['rx']+=_0x719e98+'\x0a';if(_0x719e98['search'](_0x0cd4('0xd'))!=-0x1){_0x3669b8=![];}}else{_0x314596['rx']=_0x719e98;}if(_0x3669b8){return;}if(typeof _0x314596['cb']==_0x0cd4('0xe')){var _0x2aec0c=_0x314596['rx']['substring'](0x0,0x3),_0x4656fa=null,_0x419596=null;_0x2aec0c=parseInt(_0x2aec0c);if(isNaN(_0x2aec0c)){_0x314596['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x0cd4('0xf')});return;}if(_0x2aec0c!=0xc8){_0x314596['cb'](null,{'code':_0x2aec0c,'result':-0x1,'extra':'KO'});return;}_0x4656fa=_0x314596['rx']['substring'](0x4)[_0x0cd4('0x10')](_0x0cd4('0x11'),'');if(_0x4656fa[_0x0cd4('0x12')]('\x20')!=-0x1){_0x4656fa=_0x4656fa[_0x0cd4('0x13')](0x0,_0x4656fa[_0x0cd4('0x12')]('\x20'));}if(_[_0x0cd4('0x14')](_0x4656fa,'-1')){_0x4656fa=parseInt(_0x4656fa);}_0x419596=_0x314596['rx']['split']('\x20');if(_0x419596['length']==0x3){_0x419596=_0x419596[0x2][_0x0cd4('0x15')](0x1,_0x419596[0x2][_0x0cd4('0x16')]-0x1);}else if(_0x419596['length']>0x3){var _0x3d91b9=/\((.+)\)/;var _0x4c95ae=_0x314596['rx'][_0x0cd4('0x17')](_0x3d91b9);if(_0x4c95ae){_0x419596=_0x4c95ae[0x1];}else{_0x419596=null;}}else{_0x419596=null;}_0x314596['cb'](null,{'code':_0x2aec0c,'result':_0x4656fa,'extra':_0x419596});}});_0xc2328a['on'](_0x0cd4('0x18'),function(_0x1d7d7c){_0x330d96['emit'](_0x0cd4('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x1d7d7c['code']));});_0xc2328a['on'](_0x0cd4('0x19'),function(){_0x330d96[_0x0cd4('0x8')](_0x0cd4('0x19'),new AGIError(_0x0cd4('0x1a')));});_0xc2328a['on'](_0x0cd4('0x1b'),function(){_0x330d96[_0x0cd4('0x8')]('timeout',new AGIError(_0x0cd4('0x1c')));_0xc2328a[_0x0cd4('0x1d')]();});_0xc2328a[_0x0cd4('0x1e')](_0x58ea00);this[_0x0cd4('0x1f')]=function(_0x2861f2,_0x3d9396){var _0x2861f2=_0x2861f2||'',_0x3d9396=typeof _0x3d9396=='function'?_0x3d9396:new Function();_0x314596={'tx':_0x2861f2,'rx':'','cb':_0x3d9396};_0xc2328a[_0x0cd4('0x20')](_0x2861f2+'\x0a');},this[_0x0cd4('0x19')]=function(){_0xc2328a[_0x0cd4('0x1d')]();};}util[_0x0cd4('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x0cd4('0x22')][_0x0cd4('0x23')]=function(_0x3ec908){return this[_0x0cd4('0x1f')][_0x0cd4('0x24')](this,_0x3ec908);};AGIChannel[_0x0cd4('0x22')]['answer']=function(){return this[_0x0cd4('0x23')](_0x0cd4('0x25'));};AGIChannel[_0x0cd4('0x22')]['getData']=function(_0x26acc1,_0x4df2d6,_0x1e1447){_0x26acc1=_0x26acc1===undefined?_0x0cd4('0x26'):_0x26acc1;_0x4df2d6=_0x4df2d6===undefined?'5':_0x4df2d6;_0x1e1447=_0x1e1447===undefined?'1':_0x1e1447;return this[_0x0cd4('0x23')](util['format'](_0x0cd4('0x27'),_0x26acc1,_0x4df2d6*0x3e8,_0x1e1447));};AGIChannel[_0x0cd4('0x22')]['noop']=function(_0x48bdfc){_0x48bdfc=_0x48bdfc||_0x0cd4('0x28');return this[_0x0cd4('0x23')](util[_0x0cd4('0x29')](_0x0cd4('0x2a'),_0x48bdfc));};AGIChannel['prototype'][_0x0cd4('0x2b')]=function(_0x107c95,_0x38a5d3){if(_['isArray'](_0x38a5d3)){return this[_0x0cd4('0x23')](util[_0x0cd4('0x29')](_0x0cd4('0x2c'),_0x107c95,_0x38a5d3[_0x0cd4('0x2d')](',')));}return this[_0x0cd4('0x23')](util[_0x0cd4('0x29')](_0x0cd4('0x2c'),_0x107c95,_0x38a5d3));};AGIChannel[_0x0cd4('0x22')][_0x0cd4('0x2e')]=function(_0x16f754){return this[_0x0cd4('0x23')](util[_0x0cd4('0x29')](_0x0cd4('0x2f'),_0x16f754));};AGIChannel[_0x0cd4('0x22')][_0x0cd4('0x30')]=function(_0x163be7){return this[_0x0cd4('0x23')](util['format'](_0x0cd4('0x31'),_0x163be7));};AGIChannel[_0x0cd4('0x22')]['setPriority']=function(_0x14e2a7){return this[_0x0cd4('0x23')](util[_0x0cd4('0x29')]('SET\x20PRIORITY\x20%s',_0x14e2a7));};AGIChannel[_0x0cd4('0x22')]['hangup']=function(){return this[_0x0cd4('0x23')](_0x0cd4('0x32'));};AGIChannel[_0x0cd4('0x22')][_0x0cd4('0x33')]=function(_0x152a3c,_0x10e7c1){var _0x46985e=_['isBoolean'](_0x10e7c1)||_['isNumber'](_0x10e7c1)?_0x10e7c1[_0x0cd4('0x34')]():_0x10e7c1;return this[_0x0cd4('0x23')](util['format'](_0x0cd4('0x35'),_0x152a3c,_0x46985e?_0x46985e['toString']()[_0x0cd4('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0cd4('0x22')][_0x0cd4('0x36')]=function(_0x3e1fe9,_0x257bda){return this[_0x0cd4('0x23')](util[_0x0cd4('0x29')](_0x0cd4('0x37'),_0x3e1fe9,_0x257bda));};AGIChannel[_0x0cd4('0x22')][_0x0cd4('0x38')]=function(_0xaa0fc2,_0x27250f){return this[_0x0cd4('0x23')](util[_0x0cd4('0x29')](_0x0cd4('0x39'),_0xaa0fc2,_0x27250f));};AGIChannel[_0x0cd4('0x22')]['sayPhonetic']=function(_0xd2cdf6,_0x4b12df){return this['sendRequest'](util[_0x0cd4('0x29')](_0x0cd4('0x3a'),_0xd2cdf6,_0x4b12df));};AGIChannel[_0x0cd4('0x22')]['continueAt']=function(_0x3bb3ce,_0x40a98f,_0x365f17){_0x40a98f=_0x40a98f||this[_0x0cd4('0x3b')];_0x365f17=_0x365f17||0x1;this[_0x0cd4('0x2e')](_0x3bb3ce);this[_0x0cd4('0x30')](_0x40a98f);this[_0x0cd4('0x3c')](_0x365f17);return this[_0x0cd4('0x3d')](util[_0x0cd4('0x29')](_0x0cd4('0x3e'),_0x3bb3ce,_0x40a98f,_0x365f17));};AGIChannel[_0x0cd4('0x22')][_0x0cd4('0x3f')]=function(_0x55cf01){return this['sendRequest'](util[_0x0cd4('0x29')](_0x0cd4('0x40'),_0x55cf01));};AGIChannel[_0x0cd4('0x22')]['recordFile']=function(_0x4de5e0,_0x45108d,_0x3f5d76,_0x41a74d,_0xa86c89,_0x2fd89c){_0x45108d=_0x45108d||_0x0cd4('0x41');_0x3f5d76=_0x3f5d76||'';_0x41a74d=_0x41a74d===undefined?-0x1:_0x41a74d==='-1'?-0x1:_0x41a74d*0x3e8;_0xa86c89=_0xa86c89===undefined?'':'s='+_0xa86c89;_0x2fd89c=_0x2fd89c?_0x0cd4('0x42'):'';return this[_0x0cd4('0x23')](util[_0x0cd4('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x4de5e0,_0x45108d,_0x3f5d76,_0x41a74d,_0x2fd89c,_0xa86c89));};AGIChannel[_0x0cd4('0x22')][_0x0cd4('0x43')]=function(_0x2517cf,_0x421ee5){_0x421ee5=_0x421ee5||'';return this[_0x0cd4('0x23')](util[_0x0cd4('0x29')](_0x0cd4('0x44'),_0x2517cf,_0x421ee5));};AGIChannel['prototype'][_0x0cd4('0x45')]=function(_0x1fe354){return this[_0x0cd4('0x2b')](_0x0cd4('0x46'),_0x1fe354);};AGIChannel['prototype']['wait']=function(_0x2c3d21){return this['exec'](_0x0cd4('0x47'),_0x2c3d21);};AGIChannel[_0x0cd4('0x22')][_0x0cd4('0x18')]=function(_0x2aa03c,_0x76a54b){this[_0x0cd4('0x3d')](util[_0x0cd4('0x29')](_0x0cd4('0x48'),_0x2aa03c['id'],_0x2aa03c[_0x0cd4('0x49')],_0x76a54b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0cd4('0x4a')]=AGIChannel; \ No newline at end of file +var _0xcb2c=['label','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','prototype','sendRequest','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','HANGUP','isBoolean','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','exec','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xcb2c,0x1c9));var _0xccb2=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xcb2c[_0x2576d7];return _0x16a08c;};'use strict';var util=require('util');var _=require(_0xccb2('0x0'));var EventEmitter=require('events')[_0xccb2('0x1')];var AGIReply=require(_0xccb2('0x2'));var AGIError=require(_0xccb2('0x3'));function AGIChannel(_0x57e57b){var _0x379406=this,_0x33e104=new AGIReply(),_0x2c413e=![],_0x4d1f2a={};EventEmitter[_0xccb2('0x4')](_0x379406);_0x57e57b[_0xccb2('0x5')](_0xccb2('0x6'));_0x57e57b[_0xccb2('0x7')](0x8*0x3c*0x3c*0x3e8);_0x33e104[_0xccb2('0x5')](_0xccb2('0x6'));_0x33e104['on'](_0xccb2('0x8'),function(_0xd69b8f){for(var _0x30ecb0 in _0xd69b8f){_0x379406[_0x30ecb0]=_0xd69b8f[_0x30ecb0];}_0x379406[_0xccb2('0x9')](_0xccb2('0xa'));});_0x33e104['on'](_0xccb2('0xb'),function(_0x1ec191){if(_0x1ec191['toLowerCase']()==_0xccb2('0xc')){_0x379406[_0xccb2('0x9')](_0xccb2('0xc'));return;}if(_0x1ec191['substring'](0x0,0xb)==_0xccb2('0xd')){_0x2c413e=!![];}if(_0x2c413e){_0x4d1f2a['rx']+=_0x1ec191+'\x0a';if(_0x1ec191[_0xccb2('0xe')](_0xccb2('0xf'))!=-0x1){_0x2c413e=![];}}else{_0x4d1f2a['rx']=_0x1ec191;}if(_0x2c413e){return;}if(typeof _0x4d1f2a['cb']==_0xccb2('0x10')){var _0x1213a2=_0x4d1f2a['rx'][_0xccb2('0x11')](0x0,0x3),_0xda4446=null,_0x48d987=null;_0x1213a2=parseInt(_0x1213a2);if(isNaN(_0x1213a2)){_0x4d1f2a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xccb2('0x12')});return;}if(_0x1213a2!=0xc8){_0x4d1f2a['cb'](null,{'code':_0x1213a2,'result':-0x1,'extra':'KO'});return;}_0xda4446=_0x4d1f2a['rx'][_0xccb2('0x11')](0x4)[_0xccb2('0x13')]('result=','');if(_0xda4446['indexOf']('\x20')!=-0x1){_0xda4446=_0xda4446[_0xccb2('0x14')](0x0,_0xda4446['indexOf']('\x20'));}if(_[_0xccb2('0x15')](_0xda4446,'-1')){_0xda4446=parseInt(_0xda4446);}_0x48d987=_0x4d1f2a['rx'][_0xccb2('0x16')]('\x20');if(_0x48d987[_0xccb2('0x17')]==0x3){_0x48d987=_0x48d987[0x2]['substring'](0x1,_0x48d987[0x2][_0xccb2('0x17')]-0x1);}else if(_0x48d987['length']>0x3){var _0x576ce6=/\((.+)\)/;var _0x45df9d=_0x4d1f2a['rx'][_0xccb2('0x18')](_0x576ce6);if(_0x45df9d){_0x48d987=_0x45df9d[0x1];}else{_0x48d987=null;}}else{_0x48d987=null;}_0x4d1f2a['cb'](null,{'code':_0x1213a2,'result':_0xda4446,'extra':_0x48d987});}});_0x57e57b['on']('error',function(_0x3255d9){_0x379406[_0xccb2('0x9')](_0xccb2('0x19'),new AGIError(_0xccb2('0x1a'),_0x3255d9[_0xccb2('0x1b')]));});_0x57e57b['on'](_0xccb2('0x1c'),function(){_0x379406[_0xccb2('0x9')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x57e57b['on'](_0xccb2('0x1d'),function(){_0x379406[_0xccb2('0x9')](_0xccb2('0x1d'),new AGIError(_0xccb2('0x1e')));_0x57e57b['destroy']();});_0x57e57b[_0xccb2('0x1f')](_0x33e104);this[_0xccb2('0x20')]=function(_0x551939,_0xdbbdce){var _0x551939=_0x551939||'',_0xdbbdce=typeof _0xdbbdce==_0xccb2('0x10')?_0xdbbdce:new Function();_0x4d1f2a={'tx':_0x551939,'rx':'','cb':_0xdbbdce};_0x57e57b[_0xccb2('0x21')](_0x551939+'\x0a');},this[_0xccb2('0x1c')]=function(){_0x57e57b[_0xccb2('0x22')]();};}util[_0xccb2('0x23')](AGIChannel,EventEmitter);AGIChannel[_0xccb2('0x24')][_0xccb2('0x25')]=function(_0x49350d){return this[_0xccb2('0x20')]['sync'](this,_0x49350d);};AGIChannel[_0xccb2('0x24')][_0xccb2('0x26')]=function(){return this['sendRequest'](_0xccb2('0x27'));};AGIChannel[_0xccb2('0x24')][_0xccb2('0x28')]=function(_0x1c6f14,_0x56e540,_0x55e011){_0x1c6f14=_0x1c6f14===undefined?'beep':_0x1c6f14;_0x56e540=_0x56e540===undefined?'5':_0x56e540;_0x55e011=_0x55e011===undefined?'1':_0x55e011;return this[_0xccb2('0x25')](util[_0xccb2('0x29')](_0xccb2('0x2a'),_0x1c6f14,_0x56e540*0x3e8,_0x55e011));};AGIChannel['prototype'][_0xccb2('0x2b')]=function(_0x133fde){_0x133fde=_0x133fde||_0xccb2('0x2c');return this['sendRequest'](util[_0xccb2('0x29')](_0xccb2('0x2d'),_0x133fde));};AGIChannel[_0xccb2('0x24')]['exec']=function(_0x5b6374,_0x1fd39a){if(_[_0xccb2('0x2e')](_0x1fd39a)){return this['sendRequest'](util[_0xccb2('0x29')](_0xccb2('0x2f'),_0x5b6374,_0x1fd39a[_0xccb2('0x30')](',')));}return this[_0xccb2('0x25')](util['format'](_0xccb2('0x2f'),_0x5b6374,_0x1fd39a));};AGIChannel['prototype'][_0xccb2('0x31')]=function(_0x347650){return this[_0xccb2('0x25')](util[_0xccb2('0x29')](_0xccb2('0x32'),_0x347650));};AGIChannel[_0xccb2('0x24')]['setExtension']=function(_0x589f52){return this['sendRequest'](util[_0xccb2('0x29')](_0xccb2('0x33'),_0x589f52));};AGIChannel[_0xccb2('0x24')][_0xccb2('0x34')]=function(_0x4f9241){return this[_0xccb2('0x25')](util[_0xccb2('0x29')]('SET\x20PRIORITY\x20%s',_0x4f9241));};AGIChannel[_0xccb2('0x24')][_0xccb2('0xc')]=function(){return this[_0xccb2('0x25')](_0xccb2('0x35'));};AGIChannel[_0xccb2('0x24')]['setVariable']=function(_0xf7bc09,_0x462eb1){var _0x20b68c=_[_0xccb2('0x36')](_0x462eb1)||_[_0xccb2('0x37')](_0x462eb1)?_0x462eb1[_0xccb2('0x38')]():_0x462eb1;return this[_0xccb2('0x25')](util[_0xccb2('0x29')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf7bc09,_0x20b68c?_0x20b68c[_0xccb2('0x38')]()[_0xccb2('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x2b1f5a,_0x4ab3f3){return this[_0xccb2('0x25')](util['format'](_0xccb2('0x39'),_0x2b1f5a,_0x4ab3f3));};AGIChannel[_0xccb2('0x24')]['sayDigits']=function(_0x202d8c,_0x49af41){return this[_0xccb2('0x25')](util[_0xccb2('0x29')](_0xccb2('0x3a'),_0x202d8c,_0x49af41));};AGIChannel['prototype'][_0xccb2('0x3b')]=function(_0x3cad94,_0xe35ad9){return this[_0xccb2('0x25')](util[_0xccb2('0x29')](_0xccb2('0x3c'),_0x3cad94,_0xe35ad9));};AGIChannel[_0xccb2('0x24')]['continueAt']=function(_0x2af362,_0x178367,_0x57c64f){_0x178367=_0x178367||this[_0xccb2('0x3d')];_0x57c64f=_0x57c64f||0x1;this[_0xccb2('0x31')](_0x2af362);this[_0xccb2('0x3e')](_0x178367);this[_0xccb2('0x34')](_0x57c64f);return this['noop'](util['format'](_0xccb2('0x3f'),_0x2af362,_0x178367,_0x57c64f));};AGIChannel[_0xccb2('0x24')][_0xccb2('0x40')]=function(_0x48266d){return this[_0xccb2('0x25')](util[_0xccb2('0x29')](_0xccb2('0x41'),_0x48266d));};AGIChannel['prototype'][_0xccb2('0x42')]=function(_0x24dc11,_0x29de9c,_0x4bc77e,_0x2b6a22,_0x17ec1c,_0x5689a9){_0x29de9c=_0x29de9c||'wav';_0x4bc77e=_0x4bc77e||'';_0x2b6a22=_0x2b6a22===undefined?-0x1:_0x2b6a22==='-1'?-0x1:_0x2b6a22*0x3e8;_0x17ec1c=_0x17ec1c===undefined?'':'s='+_0x17ec1c;_0x5689a9=_0x5689a9?_0xccb2('0x43'):'';return this['sendRequest'](util['format'](_0xccb2('0x44'),_0x24dc11,_0x29de9c,_0x4bc77e,_0x2b6a22,_0x5689a9,_0x17ec1c));};AGIChannel[_0xccb2('0x24')][_0xccb2('0x45')]=function(_0x57fb75,_0x54a77f){_0x54a77f=_0x54a77f||'';return this[_0xccb2('0x25')](util[_0xccb2('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x57fb75,_0x54a77f));};AGIChannel[_0xccb2('0x24')][_0xccb2('0x46')]=function(_0x2368f3){return this[_0xccb2('0x47')]('AGI',_0x2368f3);};AGIChannel[_0xccb2('0x24')][_0xccb2('0x48')]=function(_0x41d46d){return this[_0xccb2('0x47')](_0xccb2('0x49'),_0x41d46d);};AGIChannel[_0xccb2('0x24')][_0xccb2('0x19')]=function(_0x1140da,_0x1091b3){this[_0xccb2('0x2b')](util[_0xccb2('0x29')](_0xccb2('0x4a'),_0x1140da['id'],_0x1140da[_0xccb2('0x4b')],_0x1091b3));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 2262e9c..2de5350 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 _0xb930=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x230b4e,_0x319d05){var _0x574180=function(_0x1697ac){while(--_0x1697ac){_0x230b4e['push'](_0x230b4e['shift']());}};_0x574180(++_0x319d05);}(_0xb930,0xbe));var _0x0b93=function(_0x33422b,_0x25ed26){_0x33422b=_0x33422b-0x0;var _0x11ee15=_0xb930[_0x33422b];return _0x11ee15;};'use strict';var util=require(_0x0b93('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x0b93('0x1'),'E_AGI_SERVER_ERROR':_0x0b93('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x0b93('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x0b93('0x4'),'E_AGI_SOCKET_ERROR':_0x0b93('0x5'),'E_AGI_SOCKET_CLOSE':_0x0b93('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x0b93('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0b93('0x8'),'E_AGI_IVR_ENTRY':_0x0b93('0x9')};function AGIError(_0x299d1d){var _0x299d1d=_0x299d1d||null,_0x4cbe81=_0x4cbe81||[],_0x6b29a3=0x1,_0x229b7c='';if(!error[_0x299d1d]){_0x299d1d=_0x0b93('0xa');}_0x4cbe81['push'](error[_0x299d1d]);while(arguments[_0x6b29a3]){_0x4cbe81[_0x0b93('0xb')](arguments[_0x6b29a3]);_0x6b29a3++;}_0x229b7c=util['format'][_0x0b93('0xc')](util,_0x4cbe81);this['message']=_0x229b7c;this[_0x0b93('0xd')]=_0x299d1d;}module[_0x0b93('0xe')]=AGIError; \ No newline at end of file +var _0x8b72=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','name','exports','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\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x29169f,_0x3d1fae){var _0x26c303=function(_0x12345e){while(--_0x12345e){_0x29169f['push'](_0x29169f['shift']());}};_0x26c303(++_0x3d1fae);}(_0x8b72,0x165));var _0x28b7=function(_0x5ac89f,_0x4c5588){_0x5ac89f=_0x5ac89f-0x0;var _0x3142a0=_0x8b72[_0x5ac89f];return _0x3142a0;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x28b7('0x0'),'E_AGI_ARGUMENT_PORT':_0x28b7('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x28b7('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x28b7('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x28b7('0x4'),'E_AGI_SOCKET_ERROR':_0x28b7('0x5'),'E_AGI_SOCKET_CLOSE':_0x28b7('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x28b7('0x7'),'E_AGI_IVR_ENTRY':_0x28b7('0x8')};function AGIError(_0x28731a){var _0x28731a=_0x28731a||null,_0x512d43=_0x512d43||[],_0x34544e=0x1,_0x4091fc='';if(!error[_0x28731a]){_0x28731a=_0x28b7('0x9');}_0x512d43['push'](error[_0x28731a]);while(arguments[_0x34544e]){_0x512d43['push'](arguments[_0x34544e]);_0x34544e++;}_0x4091fc=util[_0x28b7('0xa')][_0x28b7('0xb')](util,_0x512d43);this['message']=_0x4091fc;this[_0x28b7('0xc')]=_0x28731a;}module[_0x28b7('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 57fe95b..16bb2ca 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cc4=['parse','projectUpdate','exports','events','EventEmitter','../../config/environment','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR'];(function(_0x9fb081,_0x48f480){var _0x43f8b0=function(_0x418570){while(--_0x418570){_0x9fb081['push'](_0x9fb081['shift']());}};_0x43f8b0(++_0x48f480);}(_0x1cc4,0x17c));var _0x41cc=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x1cc4[_0x380307];return _0x9ea14b;};'use strict';var _=require('lodash');var EventEmitter=require(_0x41cc('0x0'))[_0x41cc('0x1')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x41cc('0x2'));config['redis']=_['defaults'](config[_0x41cc('0x3')],{'host':_0x41cc('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x41cc('0x3')]);sub[_0x41cc('0x5')](_0x41cc('0x6'),function(_0x22b6c2){if(_0x22b6c2)return eventEmitter[_0x41cc('0x7')](_0x41cc('0x8'),new AGIError(_0x41cc('0x9'),_0x22b6c2));});sub['on']('message',function(_0x34ff3a,_0x49dec7){if(_0x34ff3a!==_0x41cc('0x6'))return;try{var _0x38ef78=JSON[_0x41cc('0xa')](_0x49dec7);eventEmitter[_0x41cc('0x7')](_0x41cc('0xb'),_0x38ef78);}catch(_0x5ea42f){eventEmitter['emit'](_0x41cc('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x5ea42f));}});module[_0x41cc('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xb16d=['localhost','subscribe','error','message','parse','emit','E_AGI_SERVER_ERROR','exports','lodash','events','EventEmitter','ioredis','./error','redis','defaults'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0xb16d,0x80));var _0xdb16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb16d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdb16('0x0'));var EventEmitter=require(_0xdb16('0x1'))[_0xdb16('0x2')];var Redis=require(_0xdb16('0x3'));var AGIError=require(_0xdb16('0x4'));var config=require('../../config/environment');config[_0xdb16('0x5')]=_[_0xdb16('0x6')](config[_0xdb16('0x5')],{'host':_0xdb16('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xdb16('0x5')]);sub[_0xdb16('0x8')]('agi',function(_0x33fecd){if(_0x33fecd)return eventEmitter['emit'](_0xdb16('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x33fecd));});sub['on'](_0xdb16('0xa'),function(_0x1047c9,_0x3028b){if(_0x1047c9!=='agi')return;try{var _0x30aa3c=JSON[_0xdb16('0xb')](_0x3028b);eventEmitter[_0xdb16('0xc')]('projectUpdate',_0x30aa3c);}catch(_0x137ac7){eventEmitter[_0xdb16('0xc')]('error',new AGIError(_0xdb16('0xd'),_0x137ac7));}});module[_0xdb16('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index e0978ef..4d3d4d2 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 _0xb9be=['condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addEdge','push','prototype','size','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','agicommand','default','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach'];(function(_0x498481,_0x112f93){var _0xf868b3=function(_0x2275be){while(--_0x2275be){_0x498481['push'](_0x498481['shift']());}};_0xf868b3(++_0x112f93);}(_0xb9be,0xc5));var _0xeb9b=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xb9be[_0x35007a];return _0x574f68;};'use strict';var _=require(_0xeb9b('0x0'));var logger=require(_0xeb9b('0x1'))(_0xeb9b('0x2'));var verticesWithRetry=[_0xeb9b('0x3'),_0xeb9b('0x4'),_0xeb9b('0x5')];var Graph=function(){this[_0xeb9b('0x6')]={};this[_0xeb9b('0x7')]={};this[_0xeb9b('0x8')]=0x0;};Graph['prototype']['addVertex']=function(_0x2bb681){this[_0xeb9b('0x6')][_0x2bb681['id']]=_0x2bb681;this[_0xeb9b('0x7')][_0x2bb681['id']]=[];};Graph['prototype'][_0xeb9b('0x9')]=function(_0x58ca1d,_0x210eeb,_0x28dc5f){this[_0xeb9b('0x7')][_0x58ca1d][_0xeb9b('0xa')]({'target':_0x210eeb,'condition':_0x28dc5f});this[_0xeb9b('0x8')]+=0x1;};Graph[_0xeb9b('0xb')][_0xeb9b('0xc')]=function(){return _['size'](this[_0xeb9b('0x6')]);};Graph['prototype']['relations']=function(){return this[_0xeb9b('0x8')];};Graph[_0xeb9b('0xb')]['getVertex']=function(_0x2b7405){return this[_0xeb9b('0x6')][_0x2b7405];};Graph[_0xeb9b('0xb')][_0xeb9b('0xd')]=function(_0x51598f,_0x5e94e3){if(!this['vertices'][_0x51598f]){return logger[_0xeb9b('0xe')](_0xeb9b('0xf'));}var _0x2674e6=_0x5e94e3(this['vertices'][_0x51598f]);if(!_0x2674e6){return logger['info']('stop\x20traverse');}if(this[_0xeb9b('0x7')][_0x51598f][_0xeb9b('0x10')]===0x0){return logger[_0xeb9b('0xe')](_0xeb9b('0x11'));}for(var _0x2c9aa6=0x0,_0x10da6e=[],_0x239ccf=![];_0x2c9aa6\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','hasOwnProperty','indexOf','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0xbc81,0x181));var _0x1bc8=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xbc81[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x1bc8('0x0'));var syncho=require(_0x1bc8('0x1'));var util=require(_0x1bc8('0x2'));var config=require(_0x1bc8('0x3'));var logger=require(_0x1bc8('0x4'))(_0x1bc8('0x5'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0x1bc8('0x6'));var AGIEmitter=require(_0x1bc8('0x7'))[_0x1bc8('0x8')];var projects=[];config['agi']=_[_0x1bc8('0x9')](config['agi'],{'ip':_0x1bc8('0xa'),'port':0x11dd});AGIEmitter['on'](_0x1bc8('0xb'),projectUpdateHandler);function connectionHandler(_0x8a3ebe){process[_0x1bc8('0xc')](function(){syncho(function(){try{setChannelVariables(_0x8a3ebe);agiHandler(_0x8a3ebe);}catch(_0x11d2a2){logger[_0x1bc8('0xd')](_0x11d2a2[_0x1bc8('0xe')]);}});});}function projectUpdateHandler(_0x3b1008){try{var _0xa90b3a=_[_0x1bc8('0xf')](projects,['id',_0x3b1008['id']]);if(_0xa90b3a>-0x1){if(_0x3b1008['deleted']===!![]){projects[_0x1bc8('0x10')](_0xa90b3a,0x1);}else{projects[_0xa90b3a]=_0x3b1008;}}else{projects[_0x1bc8('0x11')](_0x3b1008);}}catch(_0xca5ee0){logger['error'](_0xca5ee0[_0x1bc8('0xe')]);}}function listeningHandler(){var _0x3747ba=config[_0x1bc8('0x12')]===_0x1bc8('0x13')||![];console[_0x1bc8('0x14')](_0x1bc8('0x15'),config[_0x1bc8('0x5')][_0x1bc8('0x16')]);logger[_0x1bc8('0x17')](util[_0x1bc8('0x18')](_0x1bc8('0x19'),_0x3747ba?config[_0x1bc8('0x5')]['ip']:_0x1bc8('0x1a'),config[_0x1bc8('0x5')][_0x1bc8('0x16')]));}function errorHandler(_0x523c39){if(_0x523c39&&_0x523c39[_0x1bc8('0x1b')]&&_0x523c39[_0x1bc8('0x1c')]){logger[_0x1bc8('0xd')](util[_0x1bc8('0x18')]('[%s]\x20%s',_0x523c39[_0x1bc8('0x1b')],_0x523c39[_0x1bc8('0x1c')]));}else{logger['error'](util[_0x1bc8('0x18')](_0x1bc8('0x1d'),_0x523c39[_0x1bc8('0xe')]));}}function closeHandler(){logger['info'](util[_0x1bc8('0x18')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1bc8('0x1e')],this[_0x1bc8('0x1f')],this[_0x1bc8('0x20')],this[_0x1bc8('0x21')],this[_0x1bc8('0x22')]));try{createSquareReport(this);}catch(_0x4e494b){logger[_0x1bc8('0xd')](_0x4e494b[_0x1bc8('0xe')]);}}function timeoutHandler(){logger[_0x1bc8('0x17')](util[_0x1bc8('0x18')](_0x1bc8('0x23'),this[_0x1bc8('0x1e')],this[_0x1bc8('0x1f')],this[_0x1bc8('0x20')],this['dnid'],this[_0x1bc8('0x22')]));}function hangupHandler(){logger[_0x1bc8('0x17')](util[_0x1bc8('0x18')](_0x1bc8('0x24'),this[_0x1bc8('0x1e')],this['calleridname'],this['callerid'],this[_0x1bc8('0x21')],this[_0x1bc8('0x22')]));this[_0x1bc8('0x25')]=!![];}function createSquareReport(_0x2c7899,_0x4212e2){rpc[_0x1bc8('0x26')](_0x2c7899)['then'](function(_0x22b299){if(_0x4212e2){_0x4212e2(null,_0x22b299);}})['catch'](function(_0x43430f){if(_0x4212e2){_0x4212e2(null,_0x43430f);}});}function setChannelVariables(_0x2d51d5){for(var _0x193db6 in _0x2d51d5){if(_0x2d51d5[_0x1bc8('0x27')](_0x193db6)){if(_0x193db6[_0x1bc8('0x28')]('agi_')===0x0){_0x2d51d5[_0x193db6[_0x1bc8('0x29')](0x4)]=_0x2d51d5[_0x193db6];delete _0x2d51d5[_0x193db6];}}}}function agiHandler(_0x4824e4){logger['debug'](_0x1bc8('0x2a'),JSON[_0x1bc8('0x2b')](_0x4824e4,null,0x2));logger[_0x1bc8('0x17')](util[_0x1bc8('0x18')](_0x1bc8('0x2c'),_0x4824e4['arg_1'],_0x4824e4[_0x1bc8('0x1f')],_0x4824e4[_0x1bc8('0x20')],_0x4824e4[_0x1bc8('0x21')],_0x4824e4[_0x1bc8('0x22')]));_0x4824e4['on'](_0x1bc8('0xd'),errorHandler);_0x4824e4['on'](_0x1bc8('0x2d'),closeHandler);_0x4824e4['on'](_0x1bc8('0x2e'),timeoutHandler);_0x4824e4['evtHangup']=![];_0x4824e4['on'](_0x1bc8('0x2f'),hangupHandler);var _0x1167f1=_[_0x1bc8('0x30')](projects,[_0x1bc8('0x1b'),_0x4824e4[_0x1bc8('0x1e')]]);if(!_0x1167f1)return Project[_0x1bc8('0x31')](_0x4824e4);if(!_0x1167f1[_0x1bc8('0x13')])return Project['handleUnpublished'](_0x4824e4);return Project['initialize'](_0x1167f1,_0x4824e4);}function main(){var _0x45cbad;return utilLicense[_0x1bc8('0x32')]()[_0x1bc8('0x33')](function(_0x5bbd02){if(!_0x5bbd02)return;if(_0x5bbd02[_0x1bc8('0x34')]){if(_0x5bbd02[_0x1bc8('0x35')]&&_0x5bbd02['callysquare']>0x0){logger[_0x1bc8('0x17')](util[_0x1bc8('0x18')](_0x1bc8('0x36'),_0x5bbd02[_0x1bc8('0x35')]));_0x45cbad=_0x5bbd02[_0x1bc8('0x35')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x1bc8('0x17')](_0x1bc8('0x37'));_0x45cbad=-0x1;}})[_0x1bc8('0x33')](function(){return Project[_0x1bc8('0x38')]();})[_0x1bc8('0x33')](function(_0x152d56){projects=_0x152d56;return;})[_0x1bc8('0x39')](function(_0x5ff11a){logger[_0x1bc8('0xd')]('[LICENSE]',_0x5ff11a[_0x1bc8('0xe')]);})[_0x1bc8('0x3a')](function(){var _0x41cd21=require(_0x1bc8('0x3b'))(config['agi']['port'],config[_0x1bc8('0x5')]['ip'],_0x45cbad);_0x41cd21['on']('error',errorHandler);_0x41cd21['on'](_0x1bc8('0x3c'),listeningHandler);_0x41cd21['on'](_0x1bc8('0x3d'),connectionHandler);_0x41cd21['on'](_0x1bc8('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0xf3e8=['../../config/logger','../../config/license/util','./rpc','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','env','production','format','host.docker.internal','port','message','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','handleNotFound','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','[LICENSE]','./server','listening','close','lodash','syncho','util'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0xf3e8,0xb7));var _0x8f3e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf3e8[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x8f3e('0x0'));var syncho=require(_0x8f3e('0x1'));var util=require(_0x8f3e('0x2'));var config=require('../../config/environment');var logger=require(_0x8f3e('0x3'))('agi');var utilLicense=require(_0x8f3e('0x4'));var rpc=require(_0x8f3e('0x5'));var Project=require('./project');var AGIEmitter=require(_0x8f3e('0x6'))[_0x8f3e('0x7')];var projects=[];config[_0x8f3e('0x8')]=_[_0x8f3e('0x9')](config[_0x8f3e('0x8')],{'ip':_0x8f3e('0xa'),'port':0x11dd});AGIEmitter['on'](_0x8f3e('0xb'),projectUpdateHandler);function connectionHandler(_0x26317f){process[_0x8f3e('0xc')](function(){syncho(function(){try{setChannelVariables(_0x26317f);agiHandler(_0x26317f);}catch(_0x60156c){logger[_0x8f3e('0xd')](_0x60156c[_0x8f3e('0xe')]);}});});}function projectUpdateHandler(_0x56ed70){try{var _0x57315e=_[_0x8f3e('0xf')](projects,['id',_0x56ed70['id']]);if(_0x57315e>-0x1){if(_0x56ed70[_0x8f3e('0x10')]===!![]){projects[_0x8f3e('0x11')](_0x57315e,0x1);}else{projects[_0x57315e]=_0x56ed70;}}else{projects[_0x8f3e('0x12')](_0x56ed70);}}catch(_0x3978e9){logger['error'](_0x3978e9['stack']);}}function listeningHandler(){var _0x2eb793=config[_0x8f3e('0x13')]===_0x8f3e('0x14')||![];console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x8f3e('0x8')]['port']);logger['info'](util[_0x8f3e('0x15')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x2eb793?config[_0x8f3e('0x8')]['ip']:_0x8f3e('0x16'),config[_0x8f3e('0x8')][_0x8f3e('0x17')]));}function errorHandler(_0x34abef){if(_0x34abef&&_0x34abef['name']&&_0x34abef[_0x8f3e('0x18')]){logger['error'](util[_0x8f3e('0x15')](_0x8f3e('0x19'),_0x34abef['name'],_0x34abef[_0x8f3e('0x18')]));}else{logger[_0x8f3e('0xd')](util[_0x8f3e('0x15')](_0x8f3e('0x1a'),_0x34abef[_0x8f3e('0xe')]));}}function closeHandler(){logger['info'](util[_0x8f3e('0x15')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x8f3e('0x1b')],this[_0x8f3e('0x1c')],this[_0x8f3e('0x1d')],this[_0x8f3e('0x1e')],this[_0x8f3e('0x1f')]));try{createSquareReport(this);}catch(_0x138756){logger[_0x8f3e('0xd')](_0x138756['stack']);}}function timeoutHandler(){logger[_0x8f3e('0x20')](util[_0x8f3e('0x15')](_0x8f3e('0x21'),this[_0x8f3e('0x1b')],this[_0x8f3e('0x1c')],this[_0x8f3e('0x1d')],this[_0x8f3e('0x1e')],this['uniqueid']));}function hangupHandler(){logger[_0x8f3e('0x20')](util[_0x8f3e('0x15')](_0x8f3e('0x22'),this[_0x8f3e('0x1b')],this[_0x8f3e('0x1c')],this['callerid'],this[_0x8f3e('0x1e')],this['uniqueid']));this[_0x8f3e('0x23')]=!![];}function createSquareReport(_0x2c29f4,_0x3bfe6c){rpc[_0x8f3e('0x24')](_0x2c29f4)[_0x8f3e('0x25')](function(_0xc9a50d){if(_0x3bfe6c){_0x3bfe6c(null,_0xc9a50d);}})['catch'](function(_0x3ea946){if(_0x3bfe6c){_0x3bfe6c(null,_0x3ea946);}});}function setChannelVariables(_0x35f082){for(var _0x58bfd9 in _0x35f082){if(_0x35f082[_0x8f3e('0x26')](_0x58bfd9)){if(_0x58bfd9[_0x8f3e('0x27')](_0x8f3e('0x28'))===0x0){_0x35f082[_0x58bfd9[_0x8f3e('0x29')](0x4)]=_0x35f082[_0x58bfd9];delete _0x35f082[_0x58bfd9];}}}}function agiHandler(_0x3c1f85){logger[_0x8f3e('0x2a')](_0x8f3e('0x2b'),JSON[_0x8f3e('0x2c')](_0x3c1f85,null,0x2));logger[_0x8f3e('0x20')](util['format'](_0x8f3e('0x2d'),_0x3c1f85[_0x8f3e('0x1b')],_0x3c1f85[_0x8f3e('0x1c')],_0x3c1f85[_0x8f3e('0x1d')],_0x3c1f85[_0x8f3e('0x1e')],_0x3c1f85['uniqueid']));_0x3c1f85['on']('error',errorHandler);_0x3c1f85['on']('close',closeHandler);_0x3c1f85['on'](_0x8f3e('0x2e'),timeoutHandler);_0x3c1f85['evtHangup']=![];_0x3c1f85['on'](_0x8f3e('0x2f'),hangupHandler);var _0x51fddb=_[_0x8f3e('0x30')](projects,['name',_0x3c1f85[_0x8f3e('0x1b')]]);if(!_0x51fddb)return Project[_0x8f3e('0x31')](_0x3c1f85);if(!_0x51fddb[_0x8f3e('0x14')])return Project[_0x8f3e('0x32')](_0x3c1f85);return Project[_0x8f3e('0x33')](_0x51fddb,_0x3c1f85);}function main(){var _0x54b97d;return utilLicense[_0x8f3e('0x34')]()[_0x8f3e('0x25')](function(_0x3a8572){if(!_0x3a8572)return;if(_0x3a8572[_0x8f3e('0x35')]){if(_0x3a8572[_0x8f3e('0x36')]&&_0x3a8572['callysquare']>0x0){logger[_0x8f3e('0x20')](util[_0x8f3e('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x3a8572['callysquare']));_0x54b97d=_0x3a8572['callysquare'];}else{logger['info'](_0x8f3e('0x37'));}}else{logger['info'](_0x8f3e('0x38'));_0x54b97d=-0x1;}})[_0x8f3e('0x25')](function(){return Project['getAll']();})['then'](function(_0x3bf53d){projects=_0x3bf53d;return;})[_0x8f3e('0x39')](function(_0x129ede){logger[_0x8f3e('0xd')](_0x8f3e('0x3a'),_0x129ede[_0x8f3e('0xe')]);})['finally'](function(){var _0x4ef70e=require(_0x8f3e('0x3b'))(config[_0x8f3e('0x8')][_0x8f3e('0x17')],config[_0x8f3e('0x8')]['ip'],_0x54b97d);_0x4ef70e['on'](_0x8f3e('0xd'),errorHandler);_0x4ef70e['on'](_0x8f3e('0x3c'),listeningHandler);_0x4ef70e['on']('connection',connectionHandler);_0x4ef70e['on'](_0x8f3e('0x3d'),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 e5f21b0..b5a2d5e 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 _0x09fb=['message','sendMailMessage','SendMail','http','then','error'];(function(_0x68b1a6,_0xd55cd7){var _0x1a6ade=function(_0x26ecf5){while(--_0x26ecf5){_0x68b1a6['push'](_0x68b1a6['shift']());}};_0x1a6ade(++_0xd55cd7);}(_0x09fb,0x1c5));var _0xb09f=function(_0x510b42,_0x487818){_0x510b42=_0x510b42-0x0;var _0x5417df=_0x09fb[_0x510b42];return _0x5417df;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client'][_0xb09f('0x0')]({'port':0x232b});function request(_0x488398,_0x1b9a36){return new BPromise(function(_0x21cab4,_0x5e3683){return client['request'](_0x488398,_0x1b9a36)[_0xb09f('0x1')](function(_0x4fe234){if(_0x4fe234[_0xb09f('0x2')]){return _0x5e3683(_0x4fe234[_0xb09f('0x2')][_0xb09f('0x3')]);}else{return _0x21cab4(_0x4fe234['result']);}})['catch'](function(_0x29a88b){return _0x5e3683(_0x29a88b);});});}exports[_0xb09f('0x4')]=function(_0x56a933,_0x59345e){return request(_0xb09f('0x5'),{'account':_0x56a933,'message':_0x59345e});}; \ No newline at end of file +var _0x3a37=['client','http','request','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x5c7acc,_0x450f54){var _0x45a81=function(_0x3b43c2){while(--_0x3b43c2){_0x5c7acc['push'](_0x5c7acc['shift']());}};_0x45a81(++_0x450f54);}(_0x3a37,0x95));var _0x73a3=function(_0x489fe3,_0x5ebb81){_0x489fe3=_0x489fe3-0x0;var _0x592190=_0x3a37[_0x489fe3];return _0x592190;};'use strict';var BPromise=require(_0x73a3('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x73a3('0x1')][_0x73a3('0x2')]({'port':0x232b});function request(_0x446ee8,_0x1675d2){return new BPromise(function(_0x3a3a12,_0xc4ea26){return client[_0x73a3('0x3')](_0x446ee8,_0x1675d2)['then'](function(_0x1b930a){if(_0x1b930a[_0x73a3('0x4')]){return _0xc4ea26(_0x1b930a[_0x73a3('0x4')][_0x73a3('0x5')]);}else{return _0x3a3a12(_0x1b930a[_0x73a3('0x6')]);}})[_0x73a3('0x7')](function(_0x1f725c){return _0xc4ea26(_0x1f725c);});});}exports[_0x73a3('0x8')]=function(_0x218fb0,_0x50b79a){return request(_0x73a3('0x9'),{'account':_0x218fb0,'message':_0x50b79a});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 7c97799..0904aab 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe76d=['dnid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','continueAt','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','length','addEdge','source','target','value','toJson','root','inspect','production','stringify','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','traverseBFS','start','clear','debug','vertex','gotoc','info','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid'];(function(_0x3c5e71,_0xfc0c07){var _0x71b974=function(_0x40c7e7){while(--_0x40c7e7){_0x3c5e71['push'](_0x3c5e71['shift']());}};_0x71b974(++_0xfc0c07);}(_0xe76d,0x7b));var _0xde76=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xe76d[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xde76('0x0'));var moment=require(_0xde76('0x1'));var parser=require(_0xde76('0x2'));var util=require(_0xde76('0x3'));var logger=require('../../config/logger')(_0xde76('0x4'));var rpc=require(_0xde76('0x5'));var mailRpc=require(_0xde76('0x6'));var Graph=require(_0xde76('0x7'));var Vertices=require(_0xde76('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xde76('0x9')](function(_0x451fa1){logger[_0xde76('0xa')](_0xde76('0xb'),_0x451fa1[_0xde76('0xc')]);return[];});}function addVertex(_0x1e9519,_0x3551fd,_0x65e57f){_0x3551fd[_0xde76('0xd')]=_0x65e57f;if(_0x3551fd[_0xde76('0xe')](_0xde76('0xf'))){_0x3551fd['maxRetry']=parseInt(_0x3551fd[_0xde76('0xf')],0xa);}_0x1e9519[_0xde76('0x10')](_[_0xde76('0x11')](_0x3551fd,_0xde76('0x12')));}function initGraph(_0xd3de10,_0x137d1f){var _0x245948=new Graph();for(var _0x19513d in _0xd3de10){if(_0xd3de10[_0xde76('0xe')](_0x19513d)){if(_['isArray'](_0xd3de10[_0x19513d])){for(var _0x35ea96=0x0;_0x35ea96<_0xd3de10[_0x19513d][_0xde76('0x13')];_0x35ea96+=0x1){addVertex(_0x245948,_0xd3de10[_0x19513d][_0x35ea96],_0x19513d);}}else{addVertex(_0x245948,_0xd3de10[_0x19513d],_0x19513d);}}}for(var _0x2060e9=0x0;_0x2060e9<_0x137d1f[_0xde76('0x13')];_0x2060e9+=0x1){if(_0x137d1f[_0x2060e9]['source']&&_0x137d1f[_0x2060e9]['target']){_0x245948[_0xde76('0x14')](_0x137d1f[_0x2060e9][_0xde76('0x15')],_0x137d1f[_0x2060e9][_0xde76('0x16')],_0x137d1f[_0x2060e9][_0xde76('0x17')]);}}return _0x245948;}function getRoot(_0x3b1e27){return parser[_0xde76('0x18')](_0x3b1e27,{'object':!![]})['mxGraphModel'][_0xde76('0x19')];}function inspect(_0x4c74d4){return util[_0xde76('0x1a')](_0x4c74d4,{'showHidden':![],'depth':null});}function initialize(_0x3c8291,_0x14c03d){var _0x2a453f=getRoot(_0x3c8291[_0xde76('0x1b')]);if(!_0x2a453f||!_0x2a453f['start'])return;var _0x41797c,_0x5e837a,_0x2d6254;logger['debug'](_0xde76('0x19'),JSON[_0xde76('0x1c')](_0x2a453f,null,0x2));_0x14c03d['joinAt']=moment()[_0xde76('0x1d')](_0xde76('0x1e'));_0x41797c=initGraph(_[_0xde76('0x11')](_0x2a453f,_0xde76('0x12')),_0x2a453f[_0xde76('0x12')]);_0x5e837a=new Vertices(_0x14c03d,rpc,mailRpc);logger['info'](util[_0xde76('0x1d')](_0xde76('0x1f'),_0x14c03d[_0xde76('0x20')],_0x14c03d[_0xde76('0x21')],_0x14c03d['callerid'],_0x14c03d['dnid'],_0x14c03d[_0xde76('0x22')]));_0x41797c[_0xde76('0x23')](_0x2a453f[_0xde76('0x24')]['id'],function(_0x483301){try{_0x483301=_0x5e837a[_0xde76('0x25')](_0x483301);logger[_0xde76('0x26')](_0xde76('0x27'),JSON['stringify'](_0x483301,null,0x2));if(_0x483301[_0xde76('0xd')]===_0xde76('0x28')){logger[_0xde76('0x29')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x14c03d[_0xde76('0x2a')]=_0x483301[_0xde76('0x2a')]||_0x14c03d[_0xde76('0x2a')];_0x14c03d['extension']=_0x483301[_0xde76('0x2b')];_0x14c03d[_0xde76('0x2c')]=_0x483301[_0xde76('0x2c')]?_0x483301[_0xde76('0x2c')]-0x1:0x1;return null;}else if(_0x483301&&_0x5e837a[_0x483301[_0xde76('0xd')]]){_0x2d6254=_0x5e837a[_0x483301['agicommand']](_0x483301);logger[_0xde76('0x29')](_0xde76('0x2d'),JSON['stringify'](_0x2d6254,null,0x2));if(_0x2d6254&&_0x2d6254[_0xde76('0x2e')]===AGI_CODE_SUCCESS&&_0x2d6254[_0xde76('0x2f')]!==AGI_RESULT_ERROR&&!_0x14c03d[_0xde76('0x30')]){logger[_0xde76('0x26')](_0xde76('0x2d'),inspect(_0x2d6254));return _[_0xde76('0x31')](_0x2d6254[_0xde76('0x2f')])?null:_0x2d6254[_0xde76('0x2f')][_0xde76('0x32')]();}else{logger['error'](_0xde76('0x2d'),inspect(_0x2d6254));return null;}}else{logger['error'](_0xde76('0x33'));return null;}}catch(_0x2971c4){logger[_0xde76('0xa')](_0x2971c4[_0xde76('0xc')]);return null;}});if(_0x2a453f['finally']){logger[_0xde76('0x29')](util[_0xde76('0x1d')](_0xde76('0x34'),_0x14c03d[_0xde76('0x20')],_0x14c03d[_0xde76('0x21')],_0x14c03d[_0xde76('0x35')],_0x14c03d[_0xde76('0x36')],_0x14c03d[_0xde76('0x22')]));_0x41797c[_0xde76('0x23')](_0x2a453f['finally']['id'],function(_0x29ee2b){try{_0x29ee2b=_0x5e837a['clear'](_0x29ee2b);logger[_0xde76('0x26')](_0xde76('0x27'),JSON['stringify'](_0x29ee2b,null,0x2));if(_0x29ee2b&&_0x5e837a[_0x29ee2b['agicommand']]){_0x2d6254=_0x5e837a[_0x29ee2b[_0xde76('0xd')]](_0x29ee2b);if(_0x2d6254){logger[_0xde76('0x26')](_0xde76('0x2d'),inspect(_0x2d6254));return _[_0xde76('0x31')](_0x2d6254[_0xde76('0x2f')])?null:_0x2d6254[_0xde76('0x2f')][_0xde76('0x32')]();}else{logger[_0xde76('0xa')](_0xde76('0x2d'),inspect(_0x2d6254));return null;}}else{logger[_0xde76('0xa')](_0xde76('0x33'));return null;}}catch(_0x43655b){logger[_0xde76('0xa')](_0x43655b['stack']);return null;}});}logger[_0xde76('0x29')](util[_0xde76('0x1d')](_0xde76('0x37'),_0x14c03d[_0xde76('0x20')],_0x14c03d['calleridname'],_0x14c03d[_0xde76('0x35')],_0x14c03d[_0xde76('0x36')],_0x14c03d['uniqueid']));logger[_0xde76('0x29')](util[_0xde76('0x1d')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x14c03d['context'],_0x14c03d['extension'],parseInt(_0x14c03d[_0xde76('0x2c')],0xa)+0x1));_0x14c03d['continueAt'](_0x14c03d[_0xde76('0x2a')],_0x14c03d[_0xde76('0x2b')],parseInt(_0x14c03d['priority'],0xa)+0x1);_0x14c03d[_0xde76('0x38')]();}function handleNotFound(_0x3eedde){logger['error'](util[_0xde76('0x1d')]('Project\x20%s\x20not\x20found',_0x3eedde[_0xde76('0x20')]));_0x3eedde[_0xde76('0x39')](_0x3eedde['context'],_0x3eedde['extension'],parseInt(_0x3eedde[_0xde76('0x2c')],0xa)+0x1);_0x3eedde[_0xde76('0x38')]();}function handleUnpublished(_0x52d018){logger[_0xde76('0xa')](util[_0xde76('0x1d')](_0xde76('0x3a'),_0x52d018['arg_1']));_0x52d018[_0xde76('0x39')](_0x52d018[_0xde76('0x2a')],_0x52d018[_0xde76('0x2b')],parseInt(_0x52d018[_0xde76('0x2c')],0xa)+0x1);_0x52d018[_0xde76('0x38')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xbde0=['context','extension','priority','agicommand','response','evtHangup','result','toString','agicommand\x20not\x20found','uniqueid','traverseBFS','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','xml2json','util','agi','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','root','production','start','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','clear','vertex','stringify','gotoc'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xbde0,0x1b8));var _0x0bde=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xbde0[_0x25e7cb];return _0x375d92;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x0bde('0x0'));var util=require(_0x0bde('0x1'));var logger=require('../../config/logger')(_0x0bde('0x2'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x0bde('0x3'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x0bde('0x4')](function(_0x908808){logger[_0x0bde('0x5')](_0x0bde('0x6'),_0x908808[_0x0bde('0x7')]);return[];});}function addVertex(_0x3f3a0e,_0x593ec9,_0x3d5f90){_0x593ec9['agicommand']=_0x3d5f90;if(_0x593ec9[_0x0bde('0x8')]('retry')){_0x593ec9['maxRetry']=parseInt(_0x593ec9[_0x0bde('0x9')],0xa);}_0x3f3a0e[_0x0bde('0xa')](_[_0x0bde('0xb')](_0x593ec9,_0x0bde('0xc')));}function initGraph(_0x1a4704,_0x598567){var _0xa88f41=new Graph();for(var _0x5d14f4 in _0x1a4704){if(_0x1a4704[_0x0bde('0x8')](_0x5d14f4)){if(_[_0x0bde('0xd')](_0x1a4704[_0x5d14f4])){for(var _0x5497a0=0x0;_0x5497a0<_0x1a4704[_0x5d14f4][_0x0bde('0xe')];_0x5497a0+=0x1){addVertex(_0xa88f41,_0x1a4704[_0x5d14f4][_0x5497a0],_0x5d14f4);}}else{addVertex(_0xa88f41,_0x1a4704[_0x5d14f4],_0x5d14f4);}}}for(var _0xcedc2d=0x0;_0xcedc2d<_0x598567[_0x0bde('0xe')];_0xcedc2d+=0x1){if(_0x598567[_0xcedc2d][_0x0bde('0xf')]&&_0x598567[_0xcedc2d][_0x0bde('0x10')]){_0xa88f41[_0x0bde('0x11')](_0x598567[_0xcedc2d][_0x0bde('0xf')],_0x598567[_0xcedc2d][_0x0bde('0x10')],_0x598567[_0xcedc2d][_0x0bde('0x12')]);}}return _0xa88f41;}function getRoot(_0xa52145){return parser[_0x0bde('0x13')](_0xa52145,{'object':!![]})['mxGraphModel'][_0x0bde('0x14')];}function inspect(_0x22cdb8){return util['inspect'](_0x22cdb8,{'showHidden':![],'depth':null});}function initialize(_0x2403f0,_0x4a5828){var _0x9bee7f=getRoot(_0x2403f0[_0x0bde('0x15')]);if(!_0x9bee7f||!_0x9bee7f[_0x0bde('0x16')])return;var _0x2b1fb3,_0x52714d,_0x3f4933;logger[_0x0bde('0x17')](_0x0bde('0x14'),JSON['stringify'](_0x9bee7f,null,0x2));_0x4a5828[_0x0bde('0x18')]=moment()[_0x0bde('0x19')](_0x0bde('0x1a'));_0x2b1fb3=initGraph(_['omit'](_0x9bee7f,_0x0bde('0xc')),_0x9bee7f[_0x0bde('0xc')]);_0x52714d=new Vertices(_0x4a5828,rpc,mailRpc);logger[_0x0bde('0x1b')](util[_0x0bde('0x19')](_0x0bde('0x1c'),_0x4a5828[_0x0bde('0x1d')],_0x4a5828[_0x0bde('0x1e')],_0x4a5828[_0x0bde('0x1f')],_0x4a5828[_0x0bde('0x20')],_0x4a5828['uniqueid']));_0x2b1fb3['traverseBFS'](_0x9bee7f[_0x0bde('0x16')]['id'],function(_0x338b2a){try{_0x338b2a=_0x52714d[_0x0bde('0x21')](_0x338b2a);logger[_0x0bde('0x17')](_0x0bde('0x22'),JSON[_0x0bde('0x23')](_0x338b2a,null,0x2));if(_0x338b2a['agicommand']===_0x0bde('0x24')){logger[_0x0bde('0x1b')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4a5828[_0x0bde('0x25')]=_0x338b2a['context']||_0x4a5828[_0x0bde('0x25')];_0x4a5828[_0x0bde('0x26')]=_0x338b2a[_0x0bde('0x26')];_0x4a5828[_0x0bde('0x27')]=_0x338b2a[_0x0bde('0x27')]?_0x338b2a[_0x0bde('0x27')]-0x1:0x1;return null;}else if(_0x338b2a&&_0x52714d[_0x338b2a['agicommand']]){_0x3f4933=_0x52714d[_0x338b2a[_0x0bde('0x28')]](_0x338b2a);logger[_0x0bde('0x1b')](_0x0bde('0x29'),JSON[_0x0bde('0x23')](_0x3f4933,null,0x2));if(_0x3f4933&&_0x3f4933['code']===AGI_CODE_SUCCESS&&_0x3f4933['result']!==AGI_RESULT_ERROR&&!_0x4a5828[_0x0bde('0x2a')]){logger[_0x0bde('0x17')](_0x0bde('0x29'),inspect(_0x3f4933));return _['isUndefined'](_0x3f4933[_0x0bde('0x2b')])?null:_0x3f4933['result'][_0x0bde('0x2c')]();}else{logger[_0x0bde('0x5')]('response',inspect(_0x3f4933));return null;}}else{logger[_0x0bde('0x5')](_0x0bde('0x2d'));return null;}}catch(_0x332841){logger[_0x0bde('0x5')](_0x332841['stack']);return null;}});if(_0x9bee7f['finally']){logger[_0x0bde('0x1b')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4a5828[_0x0bde('0x1d')],_0x4a5828[_0x0bde('0x1e')],_0x4a5828[_0x0bde('0x1f')],_0x4a5828['dnid'],_0x4a5828[_0x0bde('0x2e')]));_0x2b1fb3[_0x0bde('0x2f')](_0x9bee7f['finally']['id'],function(_0x43242e){try{_0x43242e=_0x52714d[_0x0bde('0x21')](_0x43242e);logger['debug'](_0x0bde('0x22'),JSON[_0x0bde('0x23')](_0x43242e,null,0x2));if(_0x43242e&&_0x52714d[_0x43242e[_0x0bde('0x28')]]){_0x3f4933=_0x52714d[_0x43242e[_0x0bde('0x28')]](_0x43242e);if(_0x3f4933){logger[_0x0bde('0x17')](_0x0bde('0x29'),inspect(_0x3f4933));return _[_0x0bde('0x30')](_0x3f4933['result'])?null:_0x3f4933['result'][_0x0bde('0x2c')]();}else{logger['error'](_0x0bde('0x29'),inspect(_0x3f4933));return null;}}else{logger[_0x0bde('0x5')](_0x0bde('0x2d'));return null;}}catch(_0x484092){logger[_0x0bde('0x5')](_0x484092[_0x0bde('0x7')]);return null;}});}logger[_0x0bde('0x1b')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4a5828['arg_1'],_0x4a5828['calleridname'],_0x4a5828[_0x0bde('0x1f')],_0x4a5828[_0x0bde('0x20')],_0x4a5828[_0x0bde('0x2e')]));logger[_0x0bde('0x1b')](util['format'](_0x0bde('0x31'),_0x4a5828[_0x0bde('0x25')],_0x4a5828['extension'],parseInt(_0x4a5828['priority'],0xa)+0x1));_0x4a5828[_0x0bde('0x32')](_0x4a5828[_0x0bde('0x25')],_0x4a5828[_0x0bde('0x26')],parseInt(_0x4a5828['priority'],0xa)+0x1);_0x4a5828[_0x0bde('0x33')]();}function handleNotFound(_0x3f0ca9){logger[_0x0bde('0x5')](util[_0x0bde('0x19')](_0x0bde('0x34'),_0x3f0ca9[_0x0bde('0x1d')]));_0x3f0ca9[_0x0bde('0x32')](_0x3f0ca9['context'],_0x3f0ca9[_0x0bde('0x26')],parseInt(_0x3f0ca9[_0x0bde('0x27')],0xa)+0x1);_0x3f0ca9[_0x0bde('0x33')]();}function handleUnpublished(_0x21041){logger[_0x0bde('0x5')](util[_0x0bde('0x19')]('Project\x20%s\x20not\x20published',_0x21041['arg_1']));_0x21041[_0x0bde('0x32')](_0x21041[_0x0bde('0x25')],_0x21041['extension'],parseInt(_0x21041[_0x0bde('0x27')],0xa)+0x1);_0x21041[_0x0bde('0x33')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 317c472..25a272e 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 _0xb8ba=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','line','exports','util','Transform','call','_localBuffer','_inBody','prototype','_transform'];(function(_0x481bc0,_0x27fd8e){var _0x538124=function(_0x5f150e){while(--_0x5f150e){_0x481bc0['push'](_0x481bc0['shift']());}};_0x538124(++_0x27fd8e);}(_0xb8ba,0x1a9));var _0xab8b=function(_0x4f02c0,_0x467e08){_0x4f02c0=_0x4f02c0-0x0;var _0x3b16e3=_0xb8ba[_0x4f02c0];return _0x3b16e3;};'use strict';var util=require(_0xab8b('0x0'));var Transform=require('stream')[_0xab8b('0x1')];function AGIReply(_0x4ab208){Transform[_0xab8b('0x2')](this,_0x4ab208);this[_0xab8b('0x3')]='';this[_0xab8b('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xab8b('0x5')][_0xab8b('0x6')]=function(_0x4b32cb,_0x527e7e,_0x3d815d){var _0x4b7c74='\x0a',_0x1ef4b6=['\x0a\x0a',_0xab8b('0x7')],_0x51085a=-0x1,_0x4bcfa6=-0x1,_0xfba0df='',_0x2f8a50=0x0,_0x2fcc41='',_0x3cdbe2='';this[_0xab8b('0x3')]+=_0x4b32cb[_0xab8b('0x8')]();_0x2fcc41=this[_0xab8b('0x3')];if(!this[_0xab8b('0x4')]){_0x2f8a50=0x0;while(_0x1ef4b6[_0x2f8a50]){while((_0x4bcfa6=_0x2fcc41[_0xab8b('0x9')](_0x1ef4b6[_0x2f8a50]))!=-0x1){_0xfba0df=_0x1ef4b6[_0x2f8a50];_0x3cdbe2=_0x2fcc41[_0xab8b('0xa')](0x0,_0x4bcfa6);_0x2fcc41=_0x2fcc41[_0xab8b('0xa')](_0x4bcfa6+_0xfba0df[_0xab8b('0xb')]);var _0x1f1b5d=_0x3cdbe2[_0xab8b('0xc')](_0x4b7c74),_0x37e137=0x0,_0x339680={},_0x4e5eb6='',_0x2ae07e='',_0xd8287f=-0x1;while(_0x1f1b5d[_0x37e137]){_0xd8287f=_0x1f1b5d[_0x37e137]['indexOf'](':');if(_0xd8287f!=-0x1){_0x4e5eb6=_0x1f1b5d[_0x37e137][_0xab8b('0xd')](0x0,_0xd8287f)[_0xab8b('0xe')]();_0x2ae07e=_0x1f1b5d[_0x37e137]['slice'](_0xd8287f+0x1)[_0xab8b('0xe')]();if(_0x4e5eb6['length']>0x0){_0x339680[_0x4e5eb6]=_0x2ae07e;}}else{}_0x37e137++;}this[_0xab8b('0xf')]('headers',_0x339680);this['_inBody']=!![];}_0x2f8a50++;}this[_0xab8b('0x3')]=_0x2fcc41;}else{while((_0x51085a=_0x2fcc41[_0xab8b('0x9')](_0x4b7c74))!=-0x1){_0x3cdbe2=_0x2fcc41[_0xab8b('0xa')](0x0,_0x51085a);this['emit'](_0xab8b('0x10'),_0x3cdbe2);_0x2fcc41=_0x2fcc41[_0xab8b('0xa')](_0x51085a+_0x4b7c74[_0xab8b('0xb')]);}this[_0xab8b('0x3')]=_0x2fcc41;}_0x3d815d();};module[_0xab8b('0x11')]=AGIReply; \ No newline at end of file +var _0x5d31=['substring','length','split','slice','trim','emit','_inBody','line','exports','stream','Transform','_localBuffer','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf'];(function(_0x106085,_0x49ba57){var _0x26d237=function(_0x1e823e){while(--_0x1e823e){_0x106085['push'](_0x106085['shift']());}};_0x26d237(++_0x49ba57);}(_0x5d31,0xf7));var _0x15d3=function(_0x2db82d,_0x2576f7){_0x2db82d=_0x2db82d-0x0;var _0x424948=_0x5d31[_0x2db82d];return _0x424948;};'use strict';var util=require('util');var Transform=require(_0x15d3('0x0'))[_0x15d3('0x1')];function AGIReply(_0xd3d88d){Transform['call'](this,_0xd3d88d);this[_0x15d3('0x2')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x15d3('0x3')][_0x15d3('0x4')]=function(_0x16bee7,_0x242755,_0x5ebd77){var _0x8448c4='\x0a',_0xe5e074=['\x0a\x0a',_0x15d3('0x5')],_0x41a5f4=-0x1,_0x28a293=-0x1,_0x52b238='',_0x3e173c=0x0,_0x511f14='',_0x51718f='';this['_localBuffer']+=_0x16bee7[_0x15d3('0x6')]();_0x511f14=this['_localBuffer'];if(!this['_inBody']){_0x3e173c=0x0;while(_0xe5e074[_0x3e173c]){while((_0x28a293=_0x511f14[_0x15d3('0x7')](_0xe5e074[_0x3e173c]))!=-0x1){_0x52b238=_0xe5e074[_0x3e173c];_0x51718f=_0x511f14[_0x15d3('0x8')](0x0,_0x28a293);_0x511f14=_0x511f14[_0x15d3('0x8')](_0x28a293+_0x52b238[_0x15d3('0x9')]);var _0x147137=_0x51718f[_0x15d3('0xa')](_0x8448c4),_0x3088a7=0x0,_0x4a47f7={},_0x219867='',_0x1397d8='',_0x2811b5=-0x1;while(_0x147137[_0x3088a7]){_0x2811b5=_0x147137[_0x3088a7][_0x15d3('0x7')](':');if(_0x2811b5!=-0x1){_0x219867=_0x147137[_0x3088a7][_0x15d3('0xb')](0x0,_0x2811b5)[_0x15d3('0xc')]();_0x1397d8=_0x147137[_0x3088a7][_0x15d3('0xb')](_0x2811b5+0x1)[_0x15d3('0xc')]();if(_0x219867[_0x15d3('0x9')]>0x0){_0x4a47f7[_0x219867]=_0x1397d8;}}else{}_0x3088a7++;}this[_0x15d3('0xd')]('headers',_0x4a47f7);this[_0x15d3('0xe')]=!![];}_0x3e173c++;}this[_0x15d3('0x2')]=_0x511f14;}else{while((_0x41a5f4=_0x511f14['indexOf'](_0x8448c4))!=-0x1){_0x51718f=_0x511f14[_0x15d3('0x8')](0x0,_0x41a5f4);this[_0x15d3('0xd')](_0x15d3('0xf'),_0x51718f);_0x511f14=_0x511f14[_0x15d3('0x8')](_0x41a5f4+_0x8448c4[_0x15d3('0x9')]);}this[_0x15d3('0x2')]=_0x511f14;}_0x5ebd77();};module[_0x15d3('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index d11f76c..544e00b 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 _0xefbf=['GetSquareProjects','production','getSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','CreateSquareMessage','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','request','then','error','message','result','getSquareProjects'];(function(_0x2262ee,_0x4f549a){var _0x128f16=function(_0x3385be){while(--_0x3385be){_0x2262ee['push'](_0x2262ee['shift']());}};_0x128f16(++_0x4f549a);}(_0xefbf,0xa3));var _0xfefb=function(_0x4f7bad,_0x1f3e15){_0x4f7bad=_0x4f7bad-0x0;var _0x469926=_0xefbf[_0x4f7bad];return _0x469926;};'use strict';var _=require(_0xfefb('0x0'));var moment=require(_0xfefb('0x1'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x2329});function request(_0x24d740,_0x4589ac){return new Promise(function(_0x3837d5,_0x36eb23){return client[_0xfefb('0x2')](_0x24d740,_0x4589ac)[_0xfefb('0x3')](function(_0x4e352c){if(_0x4e352c[_0xfefb('0x4')]){return _0x36eb23(_0x4e352c['error'][_0xfefb('0x5')]);}else{return _0x3837d5(_0x4e352c[_0xfefb('0x6')]);}})['catch'](function(_0x18ffe2){return _0x36eb23(_0x18ffe2);});});}exports[_0xfefb('0x7')]=function(){return request(_0xfefb('0x8'),{'options':{'raw':![],'attributes':['id','name',_0xfefb('0x9')]}});};exports[_0xfefb('0xa')]=function(_0x470bf8){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x470bf8},'attributes':['production']}});};exports['getMailAccountById']=function(_0x1023f7){return request(_0xfefb('0xb'),{'options':{'raw':![],'where':{'id':_0x1023f7},'include':[{'model':_0xfefb('0xc'),'as':_0xfefb('0xd'),'include':[{'model':_0xfefb('0xe'),'as':_0xfefb('0xe')}]}],'attributes':['id',_0xfefb('0xf'),_0xfefb('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0xbd7371){return request(_0xfefb('0x11'),{'options':{'where':{'id':_0xbd7371},'attributes':[_0xfefb('0xf')]}});};exports[_0xfefb('0x12')]=function(_0x8c399c){return request(_0xfefb('0x13'),{'options':{'where':{'id':_0x8c399c},'attributes':[_0xfefb('0xf')]}});};exports[_0xfefb('0x14')]=function(_0x5b3e3d){return request('ShowVariable',{'options':{'where':{'id':_0x5b3e3d},'attributes':[_0xfefb('0xf')]}});};exports['getSquareOdbcById']=function(_0x33d8e1){return request(_0xfefb('0x15'),{'options':{'where':{'id':_0x33d8e1},'attributes':[_0xfefb('0x16')]}});};exports[_0xfefb('0x17')]=function(_0x215351){return request(_0xfefb('0x18'),{'options':{'where':{'id':_0x215351},'attributes':['name']}});};exports[_0xfefb('0x19')]=function(_0x326934){return request('GetContactByPhone',{'options':{'where':{'phone':_0x326934[_0xfefb('0x1a')]},'attributes':['id']}});};exports[_0xfefb('0x1b')]=function(_0x17eacd){return request(_0xfefb('0x1c'),{'options':{'where':{'id':_0x17eacd},'attributes':[_0xfefb('0xf')]}});};exports[_0xfefb('0x1d')]=function(_0x26d4a3){return request('ShowSound',{'options':{'where':{'id':_0x26d4a3},'attributes':[_0xfefb('0x1e')]}});};exports[_0xfefb('0x1f')]=function(_0x5ae994){return request(_0xfefb('0x20'),{'options':{'raw':![],'where':{'id':_0x5ae994},'include':[{'model':_0xfefb('0x21'),'as':_0xfefb('0x22')}]}});};exports[_0xfefb('0x23')]=function(_0x5d4a6c){return request(_0xfefb('0x24'),{'options':{'where':{'id':_0x5d4a6c},'attributes':['id',_0xfefb('0xf')]}});};exports['createSmsMessage']=function(_0x49f6bc){return request(_0xfefb('0x25'),{'body':_0x49f6bc});};exports[_0xfefb('0x26')]=function(_0x53e6cc){return request(_0xfefb('0x27'),{'body':_0x53e6cc});};exports[_0xfefb('0x28')]=function(_0x46ead2){return request(_0xfefb('0x29'),{'body':_['merge'](_0x46ead2,{'project_name':_0x46ead2[_0xfefb('0x2a')],'prev_project_name':_0x46ead2[_0xfefb('0x2b')]||'','is_subproject':_0x46ead2[_0xfefb('0x2b')]?!![]:![],'leaveAt':moment()[_0xfefb('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x1ae0d3){return request(_0xfefb('0x2d'),{'body':_0x1ae0d3});};exports[_0xfefb('0x2e')]=function(_0x57d55e){return request(_0xfefb('0x2f'),{'body':_0x57d55e});};exports['createCmContact']=function(_0x267492){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x267492[_0xfefb('0x1a')],'ListId':_0x267492['ListId']}}})[_0xfefb('0x3')](function(_0x33241a){if(_0x33241a){return _0x33241a;}return request('CreateCmContact',{'body':_0x267492});});};exports[_0xfefb('0x30')]=function(_0x286e09){return request(_0xfefb('0x31'),{'options':{'where':{'id':_0x286e09},'attributes':[_0xfefb('0xf')]}});};exports[_0xfefb('0x32')]=function(_0x338964,_0x5964c8){return request(_0xfefb('0x33'),{'body':{'interface':_0x5964c8},'options':{'where':_0x338964}});};exports[_0xfefb('0x34')]=function(_0x20960c,_0x2c627e,_0x2d9db8){return request(_0xfefb('0x35'),{'body':{'type':_0x2c627e,'uniqueid':_0x2d9db8},'options':{'where':_0x20960c}});};exports['agentUnpause']=function(_0x275a1a){return request(_0xfefb('0x36'),{'body':{},'options':{'where':_0x275a1a}});};exports[_0xfefb('0x37')]=function(_0x474b51){return request(_0xfefb('0x38'),{'body':{},'options':{'where':_0x474b51}});}; \ No newline at end of file +var _0x92e8=['phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentLogout','LogoutUser','lodash','client','request','then','error','message','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage'];(function(_0x2acb64,_0x20de3e){var _0x4e1aae=function(_0x4d3557){while(--_0x4d3557){_0x2acb64['push'](_0x2acb64['shift']());}};_0x4e1aae(++_0x20de3e);}(_0x92e8,0x7f));var _0x892e=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x92e8[_0x41f2f5];return _0x3d49f1;};'use strict';var _=require(_0x892e('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var client=jayson[_0x892e('0x1')]['http']({'port':0x2329});function request(_0x232414,_0x35184e){return new Promise(function(_0x2cb68f,_0xe95e5f){return client[_0x892e('0x2')](_0x232414,_0x35184e)[_0x892e('0x3')](function(_0x547350){if(_0x547350[_0x892e('0x4')]){return _0xe95e5f(_0x547350['error'][_0x892e('0x5')]);}else{return _0x2cb68f(_0x547350['result']);}})[_0x892e('0x6')](function(_0x5bfa77){return _0xe95e5f(_0x5bfa77);});});}exports[_0x892e('0x7')]=function(){return request(_0x892e('0x8'),{'options':{'raw':![],'attributes':['id',_0x892e('0x9'),'production']}});};exports[_0x892e('0xa')]=function(_0x211bbf){return request(_0x892e('0xb'),{'options':{'raw':![],'where':{'name':_0x211bbf},'attributes':[_0x892e('0xc')]}});};exports[_0x892e('0xd')]=function(_0x5c5ef4){return request(_0x892e('0xe'),{'options':{'raw':![],'where':{'id':_0x5c5ef4},'include':[{'model':_0x892e('0xf'),'as':_0x892e('0x10'),'include':[{'model':'CloudProvider','as':_0x892e('0x11')}]}],'attributes':['id','name',_0x892e('0x12')],'smtp':!![]}});};exports[_0x892e('0x13')]=function(_0x20fe60){return request(_0x892e('0xb'),{'options':{'where':{'id':_0x20fe60},'attributes':[_0x892e('0x9')]}});};exports[_0x892e('0x14')]=function(_0x2f727e){return request(_0x892e('0x15'),{'options':{'where':{'id':_0x2f727e},'attributes':[_0x892e('0x9')]}});};exports[_0x892e('0x16')]=function(_0xbd35a5){return request('ShowVariable',{'options':{'where':{'id':_0xbd35a5},'attributes':[_0x892e('0x9')]}});};exports['getSquareOdbcById']=function(_0x1ff7f3){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1ff7f3},'attributes':['dsn']}});};exports[_0x892e('0x17')]=function(_0x111ee2){return request(_0x892e('0x18'),{'options':{'where':{'id':_0x111ee2},'attributes':[_0x892e('0x9')]}});};exports[_0x892e('0x19')]=function(_0x628dc2){return request(_0x892e('0x1a'),{'options':{'where':{'phone':_0x628dc2['phone']},'attributes':['id']}});};exports[_0x892e('0x1b')]=function(_0x31cc52){return request(_0x892e('0x1c'),{'options':{'where':{'id':_0x31cc52},'attributes':[_0x892e('0x9')]}});};exports[_0x892e('0x1d')]=function(_0xc7c673){return request(_0x892e('0x1e'),{'options':{'where':{'id':_0xc7c673},'attributes':[_0x892e('0x1f')]}});};exports[_0x892e('0x20')]=function(_0x3c29b7){return request(_0x892e('0x21'),{'options':{'raw':![],'where':{'id':_0x3c29b7},'include':[{'model':_0x892e('0x22'),'as':_0x892e('0x23')}]}});};exports['getSmsAccountById']=function(_0x49de36){return request(_0x892e('0x24'),{'options':{'where':{'id':_0x49de36},'attributes':['id',_0x892e('0x9')]}});};exports[_0x892e('0x25')]=function(_0x5aacac){return request(_0x892e('0x26'),{'body':_0x5aacac});};exports[_0x892e('0x27')]=function(_0x697285){return request('CreateSquareDetailsReport',{'body':_0x697285});};exports[_0x892e('0x28')]=function(_0x559c34){return request('CreateSquareReport',{'body':_['merge'](_0x559c34,{'project_name':_0x559c34[_0x892e('0x29')],'prev_project_name':_0x559c34[_0x892e('0x2a')]||'','is_subproject':_0x559c34[_0x892e('0x2a')]?!![]:![],'leaveAt':moment()[_0x892e('0x2b')](_0x892e('0x2c'))})});};exports['createSquareRecording']=function(_0x5bf238){return request(_0x892e('0x2d'),{'body':_0x5bf238});};exports[_0x892e('0x2e')]=function(_0x471abd){return request('CreateSquareMessage',{'body':_0x471abd});};exports['createCmContact']=function(_0x1fac3c){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1fac3c[_0x892e('0x2f')],'ListId':_0x1fac3c[_0x892e('0x30')]}}})['then'](function(_0x54f1eb){if(_0x54f1eb){return _0x54f1eb;}return request(_0x892e('0x31'),{'body':_0x1fac3c});});};exports[_0x892e('0x32')]=function(_0x561721){return request(_0x892e('0x33'),{'options':{'where':{'id':_0x561721},'attributes':[_0x892e('0x9')]}});};exports[_0x892e('0x34')]=function(_0x3a6350,_0x2fa776){return request(_0x892e('0x35'),{'body':{'interface':_0x2fa776},'options':{'where':_0x3a6350}});};exports[_0x892e('0x36')]=function(_0xb6c376,_0x350148,_0x40fa3){return request(_0x892e('0x37'),{'body':{'type':_0x350148,'uniqueid':_0x40fa3},'options':{'where':_0xb6c376}});};exports['agentUnpause']=function(_0x573f7c){return request('UnpauseUser',{'body':{},'options':{'where':_0x573f7c}});};exports[_0x892e('0x38')]=function(_0xa0cbaa){return request(_0x892e('0x39'),{'body':{},'options':{'where':_0xa0cbaa}});}; \ 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 13bb892..da6eea8 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 _0x8958=['./lex'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x8958,0x93));var _0x8895=function(_0x1fea28,_0x105d82){_0x1fea28=_0x1fea28-0x0;var _0x15fb79=_0x8958[_0x1fea28];return _0x15fb79;};var polly=require('./polly');var lex=require(_0x8895('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x37cc=['./lex','exports','./polly'];(function(_0x20e24a,_0x5193af){var _0x19d2f0=function(_0x1f40b2){while(--_0x1f40b2){_0x20e24a['push'](_0x20e24a['shift']());}};_0x19d2f0(++_0x5193af);}(_0x37cc,0x185));var _0xc37c=function(_0x84eba7,_0x49c450){_0x84eba7=_0x84eba7-0x0;var _0x289afc=_0x37cc[_0x84eba7];return _0x289afc;};var polly=require(_0xc37c('0x0'));var lex=require(_0xc37c('0x1'));module[_0xc37c('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 898c508..185a426 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 _0x41bb=['exports','./lib/api'];(function(_0x166f43,_0x49eeb3){var _0x21bfcd=function(_0x36503d){while(--_0x36503d){_0x166f43['push'](_0x166f43['shift']());}};_0x21bfcd(++_0x49eeb3);}(_0x41bb,0xc5));var _0xb41b=function(_0x2e1aea,_0x1714cb){_0x2e1aea=_0x2e1aea-0x0;var _0x5c5f99=_0x41bb[_0x2e1aea];return _0x5c5f99;};'use strict';var lex=require(_0xb41b('0x0'));module[_0xb41b('0x1')]=function(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333){return lex(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333);}; \ No newline at end of file +var _0x4483=['exports','./lib/api'];(function(_0x267284,_0x2522a6){var _0x3bbc6d=function(_0x52e54c){while(--_0x52e54c){_0x267284['push'](_0x267284['shift']());}};_0x3bbc6d(++_0x2522a6);}(_0x4483,0x1a3));var _0x3448=function(_0x18d986,_0x3e0b62){_0x18d986=_0x18d986-0x0;var _0x4acbdd=_0x4483[_0x18d986];return _0x4acbdd;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ 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 ca09021..524c8a6 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(_0x43854c,_0x6fb413){var _0x30845c=function(_0x1df498){while(--_0x1df498){_0x43854c['push'](_0x43854c['shift']());}};_0x30845c(++_0x6fb413);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x591644,_0x55add9){var _0x7bd0e9=function(_0x39f646){while(--_0x39f646){_0x591644['push'](_0x591644['shift']());}};_0x7bd0e9(++_0x55add9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 3c02af0..cdb215a 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 _0xe5b1=['./lib/api'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xe5b1,0x1c0));var _0x1e5b=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0xe5b1[_0x2ab365];return _0x49fef3;};'use strict';var polly=require(_0x1e5b('0x0'));module['exports']=function(_0x4f39f8,_0xbc6a21,_0x3bac18,_0x175ef9,_0x1d8ab1,_0x51f9fe,_0x4f1a28){return polly(_0x4f39f8,_0xbc6a21,_0x3bac18,_0x175ef9,_0x1d8ab1,_0x51f9fe,_0x4f1a28);}; \ No newline at end of file +var _0xa103=['./lib/api','exports'];(function(_0x1bc826,_0x55d99b){var _0xea58a1=function(_0x57f68b){while(--_0x57f68b){_0x1bc826['push'](_0x1bc826['shift']());}};_0xea58a1(++_0x55d99b);}(_0xa103,0x1c6));var _0x3a10=function(_0x2dce62,_0xdde9fa){_0x2dce62=_0x2dce62-0x0;var _0xb7c1f5=_0xa103[_0x2dce62];return _0xb7c1f5;};'use strict';var polly=require(_0x3a10('0x0'));module[_0x3a10('0x1')]=function(_0x4358ff,_0x34c38a,_0xf2b803,_0x30c2a2,_0x597a2c,_0x144572,_0x3eb99a){return polly(_0x4358ff,_0x34c38a,_0xf2b803,_0x30c2a2,_0x597a2c,_0x144572,_0x3eb99a);}; \ 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 be96b44..7a0740a 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 _0xed8d=['AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3','path','bluebird','randomstring','synthesizeSpeech','writeFile'];(function(_0x32cd47,_0x374c1c){var _0x13c48b=function(_0x1502f3){while(--_0x1502f3){_0x32cd47['push'](_0x32cd47['shift']());}};_0x13c48b(++_0x374c1c);}(_0xed8d,0x1d8));var _0xded8=function(_0x4c4bc8,_0x1151b8){_0x4c4bc8=_0x4c4bc8-0x0;var _0x5e07f8=_0xed8d[_0x4c4bc8];return _0x5e07f8;};'use strict';var fs=require('fs');var path=require(_0xded8('0x0'));var BPromise=require(_0xded8('0x1'));var rs=require(_0xded8('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x1109e9,_0x46f258,_0x352cdf){return new BPromise(function(_0x2a445b,_0x19a439){_0x1109e9[_0xded8('0x3')](_0x46f258,function(_0x6c2dba,_0xe8d7cb){if(_0x6c2dba){_0x19a439(_0x6c2dba);}else if(_0xe8d7cb){if(_0xe8d7cb['AudioStream']instanceof Buffer){fs[_0xded8('0x4')](_0x352cdf,_0xe8d7cb[_0xded8('0x5')],function(_0x3098ba){if(_0x3098ba){_0x19a439(_0x3098ba);}else{_0x2a445b();}});}else{_0x19a439(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x19a439(new Error(_0xded8('0x6')));}});});}module[_0xded8('0x7')]=function(_0x23fcaf,_0x4e9962,_0x1080a3,_0x3b318d,_0x3ecbaa,_0xcf61bc,_0x3a6bce){var _0x47f5fd=new AWS['Polly']({'accessKeyId':_0x23fcaf,'secretAccessKey':_0x4e9962,'region':_0x1080a3});var _0x2be114={'Text':_0x3ecbaa,'TextType':_0xcf61bc||'text','OutputFormat':_0xded8('0x8'),'VoiceId':_0x3b318d};return pollyResult(_0x47f5fd,_0x2be114,_0x3a6bce);}; \ No newline at end of file +var _0xb6ba=['randomstring','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird'];(function(_0xdd9f41,_0x23cdfa){var _0xa6425c=function(_0xc41dae){while(--_0xc41dae){_0xdd9f41['push'](_0xdd9f41['shift']());}};_0xa6425c(++_0x23cdfa);}(_0xb6ba,0x1d2));var _0xab6b=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0xb6ba[_0xe8129c];return _0x709fc5;};'use strict';var fs=require('fs');var path=require(_0xab6b('0x0'));var BPromise=require(_0xab6b('0x1'));var rs=require(_0xab6b('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x4ba593,_0x43f8a3,_0x52e0a7){return new BPromise(function(_0x4dc897,_0x5c70ff){_0x4ba593[_0xab6b('0x3')](_0x43f8a3,function(_0xeea29e,_0xcd6ecf){if(_0xeea29e){_0x5c70ff(_0xeea29e);}else if(_0xcd6ecf){if(_0xcd6ecf[_0xab6b('0x4')]instanceof Buffer){fs['writeFile'](_0x52e0a7,_0xcd6ecf[_0xab6b('0x4')],function(_0x2564f0){if(_0x2564f0){_0x5c70ff(_0x2564f0);}else{_0x4dc897();}});}else{_0x5c70ff(new Error(_0xab6b('0x5')));}}else{_0x5c70ff(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xab6b('0x6')]=function(_0x14b41c,_0x157070,_0x3aea0a,_0xa03b2d,_0x426896,_0x19f52b,_0x2d02c1){var _0x44e3f7=new AWS[(_0xab6b('0x7'))]({'accessKeyId':_0x14b41c,'secretAccessKey':_0x157070,'region':_0x3aea0a});var _0x5ded52={'Text':_0x426896,'TextType':_0x19f52b||'text','OutputFormat':_0xab6b('0x8'),'VoiceId':_0xa03b2d};return pollyResult(_0x44e3f7,_0x5ded52,_0x2d02c1);}; \ 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 bd3ad79..1b34693 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 _0x6997=['./lib/api'];(function(_0x5979ce,_0xbb9df3){var _0x4e339b=function(_0x2a9b6f){while(--_0x2a9b6f){_0x5979ce['push'](_0x5979ce['shift']());}};_0x4e339b(++_0xbb9df3);}(_0x6997,0x198));var _0x7699=function(_0x432a3d,_0x290afc){_0x432a3d=_0x432a3d-0x0;var _0x3d3c5f=_0x6997[_0x432a3d];return _0x3d3c5f;};'use strict';var asr=require(_0x7699('0x0'));module['exports']=function(_0x35f854,_0x565878,_0x50622e,_0x2f1bf8){return asr(_0x35f854,_0x565878,_0x50622e);}; \ No newline at end of file +var _0xe497=['exports','./lib/api'];(function(_0x55e2b5,_0x41bb0b){var _0x3411bf=function(_0x3b84db){while(--_0x3b84db){_0x55e2b5['push'](_0x55e2b5['shift']());}};_0x3411bf(++_0x41bb0b);}(_0xe497,0xd9));var _0x7e49=function(_0x3ec0c5,_0xd53892){_0x3ec0c5=_0x3ec0c5-0x0;var _0x34c0c8=_0xe497[_0x3ec0c5];return _0x34c0c8;};'use strict';var asr=require(_0x7e49('0x0'));module[_0x7e49('0x1')]=function(_0xbbded3,_0x3274a4,_0x179e0f,_0x5ce3d4){return asr(_0xbbded3,_0x3274a4,_0x179e0f);}; \ 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 db764a9..1574159 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 _0x684c=['url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000'];(function(_0x5e9f76,_0x2c585a){var _0x2c4635=function(_0xc26ee2){while(--_0xc26ee2){_0x5e9f76['push'](_0x5e9f76['shift']());}};_0x2c4635(++_0x2c585a);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var url=require(_0xc684('0x0'));var BPromise=require(_0xc684('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xc684('0x2')]=function(_0x10c3ca,_0x313548,_0x1a0d37){return new BPromise(function(_0x2c50cf,_0x4a3536){var _0x3519e8;if(typeof _0x10c3ca!==_0xc684('0x3')||_0x10c3ca[_0xc684('0x4')]===0x0){return _0x4a3536(_0xc684('0x5'));}if(typeof _0x313548!==_0xc684('0x3')||_0x313548[_0xc684('0x4')]===0x0){return _0x4a3536(_0xc684('0x6'));}if(typeof _0x1a0d37!==_0xc684('0x7')&&(typeof _0x1a0d37!==_0xc684('0x3')||_0x1a0d37[_0xc684('0x4')]===0x0)){return _0x4a3536(_0xc684('0x8'));}try{_0x3519e8=fs[_0xc684('0x9')](_0x10c3ca)[_0xc684('0xa')](_0xc684('0xb'));}catch(_0x11e848){return _0x4a3536(_0x11e848);}return _0x2c50cf({'method':_0xc684('0xc'),'uri':host+_0xc684('0xd')+_0x313548,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xc684('0xe'),'languageCode':_0x1a0d37},'audio':{'content':_0x3519e8}},'json':!![]});});}; \ No newline at end of file +var _0xda65=['LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key='];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xda65,0x1d0));var _0x5da6=function(_0x363f79,_0x589077){_0x363f79=_0x363f79-0x0;var _0xfd9e9a=_0xda65[_0x363f79];return _0xfd9e9a;};'use strict';var url=require(_0x5da6('0x0'));var BPromise=require(_0x5da6('0x1'));var fs=require('fs');var host=_0x5da6('0x2');module['exports']=function(_0x377db8,_0x20415b,_0xd35866){return new BPromise(function(_0x487700,_0x5c80b4){var _0x73d407;if(typeof _0x377db8!==_0x5da6('0x3')||_0x377db8[_0x5da6('0x4')]===0x0){return _0x5c80b4(_0x5da6('0x5'));}if(typeof _0x20415b!==_0x5da6('0x3')||_0x20415b['length']===0x0){return _0x5c80b4(_0x5da6('0x6'));}if(typeof _0xd35866!=='undefined'&&(typeof _0xd35866!=='string'||_0xd35866[_0x5da6('0x4')]===0x0)){return _0x5c80b4('lang\x20should\x20be\x20a\x20string');}try{_0x73d407=fs[_0x5da6('0x7')](_0x377db8)[_0x5da6('0x8')](_0x5da6('0x9'));}catch(_0x28d332){return _0x5c80b4(_0x28d332);}return _0x487700({'method':_0x5da6('0xa'),'uri':host+_0x5da6('0xb')+_0x20415b,'body':{'config':{'encoding':_0x5da6('0xc'),'sampleRateHertz':_0x5da6('0xd'),'languageCode':_0xd35866},'audio':{'content':_0x73d407}},'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 32b8aa1..524a100 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 _0x63c0=['exports','./asr'];(function(_0x4e1d18,_0x1f02c2){var _0x566d9b=function(_0x455b95){while(--_0x455b95){_0x4e1d18['push'](_0x4e1d18['shift']());}};_0x566d9b(++_0x1f02c2);}(_0x63c0,0x123));var _0x063c=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x63c0[_0x15ec4e];return _0xb5e5dd;};var asr=require(_0x063c('0x0'));module[_0x063c('0x1')]={'asr':asr}; \ No newline at end of file +var _0x25c4=['exports','./asr'];(function(_0x5b71ad,_0x567ffa){var _0x32e8cd=function(_0x30d731){while(--_0x30d731){_0x5b71ad['push'](_0x5b71ad['shift']());}};_0x32e8cd(++_0x567ffa);}(_0x25c4,0xef));var _0x425c=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x25c4[_0x56482c];return _0x5aae7a;};var asr=require(_0x425c('0x0'));module[_0x425c('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 8e1bbaa..9dec6fb 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 _0x06f6=['nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','https','md5','querystring','randomstring','sox','url','parse','util','./aws','./google','./sestek','agi','https://api.ispeech.org/api/rest','protocol','host','path','get','statusCode','error','statusMessage','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','https:','WHAT_EVER','request\x20to\x20','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','.mp3','.wav','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA'];(function(_0x44ad4b,_0x13ccad){var _0x4c0516=function(_0x1a841e){while(--_0x1a841e){_0x44ad4b['push'](_0x44ad4b['shift']());}};_0x4c0516(++_0x13ccad);}(_0x06f6,0x92));var _0x606f=function(_0x16ce85,_0x59e720){_0x16ce85=_0x16ce85-0x0;var _0x2f74fe=_0x06f6[_0x16ce85];return _0x2f74fe;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x606f('0x0'));var md5=require(_0x606f('0x1'));var path=require('path');var querystring=require(_0x606f('0x2'));var rp=require('request-promise');var rs=require(_0x606f('0x3'));var sox=require(_0x606f('0x4'));var tts=require('google-tts-api');var urlParse=require(_0x606f('0x5'))[_0x606f('0x6')];var util=require(_0x606f('0x7'));var aws=require(_0x606f('0x8'));var google=require(_0x606f('0x9'));var sestek=require(_0x606f('0xa'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x606f('0xb'));var ISPEECH_API=_0x606f('0xc');function downloadFile(_0x4f6a3b,_0x8d8f4){return new BPromise(function(_0x55343b,_0x491eed){var _0x38c321=urlParse(_0x4f6a3b);var _0x195b9b=_0x38c321[_0x606f('0xd')]==='https:'?https:http;var _0x46659e={'host':_0x38c321[_0x606f('0xe')],'path':_0x38c321[_0x606f('0xf')],'headers':{'user-agent':'WHAT_EVER'}};_0x195b9b[_0x606f('0x10')](_0x46659e,function(_0x22808f){if(_0x22808f[_0x606f('0x11')]!==0xc8){logger[_0x606f('0x12')]('request\x20to\x20'+_0x4f6a3b+'\x20failed,\x20status\x20code\x20=\x20'+_0x22808f[_0x606f('0x11')]+'\x20('+_0x22808f[_0x606f('0x13')]+')');_0x491eed(new Error('request\x20to\x20'+_0x4f6a3b+_0x606f('0x14')+_0x22808f[_0x606f('0x11')]+'\x20('+_0x22808f[_0x606f('0x13')]+')'));return;}var _0x58b14c=fs['createWriteStream'](_0x8d8f4);_0x58b14c['on'](_0x606f('0x15'),function(){logger[_0x606f('0x16')](_0x606f('0x17'));_0x58b14c[_0x606f('0x18')](_0x55343b);});_0x58b14c['on'](_0x606f('0x12'),function(_0x1c55ff){fs[_0x606f('0x19')](_0x8d8f4);logger['error'](_0x606f('0x1a'),_0x1c55ff);_0x491eed(_0x1c55ff);});_0x22808f[_0x606f('0x1b')](_0x58b14c);})['on'](_0x606f('0x12'),function(_0x39e3d7){logger[_0x606f('0x12')](_0x39e3d7);_0x491eed(_0x39e3d7);})[_0x606f('0x1c')]();});}function uploadFile(_0x2ea9d2){return new BPromise(function(_0x2a6b07,_0xe0971f){var _0x59c345=urlParse(_0x2ea9d2);var _0x1b8166=_0x59c345['protocol']===_0x606f('0x1d')?https:http;var _0x3038a1={'host':_0x59c345[_0x606f('0xe')],'path':_0x59c345['path'],'headers':{'user-agent':_0x606f('0x1e')}};_0x1b8166[_0x606f('0x10')](_0x3038a1,function(_0x5bbaf0){if(_0x5bbaf0[_0x606f('0x11')]!==0xc8){_0xe0971f(new Error(_0x606f('0x1f')+_0x2ea9d2+_0x606f('0x14')+_0x5bbaf0['statusCode']+'\x20('+_0x5bbaf0[_0x606f('0x13')]+')'));return;}var _0x3a1d51='';_0x5bbaf0['on'](_0x606f('0x20'),function(_0x2a4340){_0x3a1d51+=_0x2a4340;});_0x5bbaf0['on'](_0x606f('0x1c'),function(){_0x2a6b07(_0x3a1d51);});})['on'](_0x606f('0x12'),function(_0x3cab83){_0xe0971f(_0x3cab83);})[_0x606f('0x1c')]();});}function convertFile(_0x59b319,_0x5def25){return new BPromise(function(_0xfc206c,_0x2ac3f0){var _0x1f65b5=sox[_0x606f('0x21')](_0x59b319,_0x5def25,{'sampleRate':0x1f40,'format':_0x606f('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1f65b5['on']('error',function(_0x25d89a){logger['error'](_0x606f('0x23'),_0x25d89a);_0x2ac3f0(_0x25d89a);});_0x1f65b5['on']('end',function(){logger[_0x606f('0x16')](_0x606f('0x24'));_0xfc206c();});_0x1f65b5[_0x606f('0x25')]();});}function base64Decode(_0x5b2b9d,_0x3ce221){var _0x3a8678=path[_0x606f('0x26')](__dirname,_0x606f('0x27'),rs[_0x606f('0x28')](0x4)+'.wav');fs[_0x606f('0x29')](_0x3a8678,_0x5b2b9d,_0x606f('0x2a'));return convertFile(_0x3a8678,_0x3ce221)[_0x606f('0x2b')](function(){try{fs['unlink'](_0x3a8678);fs[_0x606f('0x2c')](_0x3ce221,_0x606f('0x2d'));}catch(_0x308f55){logger[_0x606f('0x12')](_0x308f55);}return _0x3ce221[_0x606f('0x2e')]('.')[0x0];});}function base64Encode(_0x4b0774){var _0x2ceb53=fs[_0x606f('0x2f')](_0x4b0774);return new Buffer(_0x2ceb53)[_0x606f('0x30')](_0x606f('0x2a'));}exports['googleCloudTTS']=function(_0x4dfbd9,_0x466de0,_0x51fbc0,_0x5d96b9,_0x9cb388,_0x42f15b){var _0x35f1c7,_0x4468e3;var _0xbed0b4=_0x606f('0x31');var _0x5b3509='?key='+_0x4dfbd9;var _0x39f00c={};if(_0x466de0===_0x606f('0x32')){_0x39f00c[_0x606f('0x33')]={'ssml':_0x51fbc0};}else{_0x39f00c[_0x606f('0x33')]={'text':_0x51fbc0};};_0x39f00c[_0x606f('0x34')]={'languageCode':_0x5d96b9,'ssmlGender':_0x9cb388};_0x39f00c[_0x606f('0x35')]={'audioEncoding':_0x606f('0x36'),'sampleRateHertz':0x1f40};var _0x529673={'url':_0xbed0b4+_0x606f('0x37')+_0x5b3509,'method':_0x606f('0x38'),'json':!![],'body':_0x39f00c};return rp(_0x529673)[_0x606f('0x2b')](function(_0x467a0b){return new BPromise(function(_0x562ab5,_0x3b9803){_0x35f1c7=path['resolve'](__dirname,_0x606f('0x27'),rs['generate'](0x4)+'.mp3');var _0x1bbcf4=Buffer[_0x606f('0x39')](_0x467a0b[_0x606f('0x3a')],'base64');return fs[_0x606f('0x3b')](_0x35f1c7,_0x1bbcf4,function(_0x27bf8e){_0x3b9803(_0x27bf8e);},function(_0x3ce0ca){fs[_0x606f('0x2c')](_0x35f1c7,_0x606f('0x2d'));_0x562ab5(_0x3ce0ca);});});})[_0x606f('0x2b')](function(_0x4e1fcb){_0x4468e3=path['resolve'](__dirname,_0x606f('0x27'),rs['generate'](0x4)+'.wav');return convertFile(_0x35f1c7,_0x4468e3);})[_0x606f('0x2b')](function(){try{fs[_0x606f('0x19')](_0x35f1c7);fs[_0x606f('0x2c')](_0x4468e3,_0x606f('0x2d'));}catch(_0x1d80f1){logger[_0x606f('0x12')](_0x1d80f1);}logger[_0x606f('0x16')](_0x606f('0x3c'),_0x4468e3[_0x606f('0x2e')]('.')[0x0]);return _0x4468e3[_0x606f('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x4de004,_0x54234c){var _0x34b511=_0x606f('0x3d');var _0x2e49d8,_0x5194b1;var _0x3e6497;var _0xac66e={'encoding':_0x606f('0x3e'),'method':_0x606f('0x38'),'timeout':0x2710,'url':_0x34b511,'headers':{'Content-Type':_0x606f('0x3f')},'body':_0x606f('0x40')+encodeURIComponent(JSON[_0x606f('0x41')]([[[_0x606f('0x42'),JSON[_0x606f('0x41')]([_0x4de004,_0x54234c||'en',![],_0x606f('0x43')]),null,_0x606f('0x44')]]]))};return rp(_0xac66e)[_0x606f('0x2b')](function(_0x35d435){try{_0x3e6497=eval(_0x35d435[_0x606f('0x45')](0x5))[0x0][0x2];}catch(_0x1f5741){throw new Error(_0x606f('0x46')+_0x35d435[_0x606f('0x20')]);}if(!_0x3e6497){if(_0x4de004['length']>0xc8){throw new Error(_0x606f('0x47'));}else{throw new Error(_0x606f('0x48')+_0x54234c+'\x22\x20might\x20not\x20exist');}}try{_0x3e6497=eval(_0x3e6497)[0x0];}catch(_0xf45790){throw new Error(_0x606f('0x46')+res['data']);}const _0x54ef27=_0x3e6497;_0x2e49d8=path[_0x606f('0x26')](__dirname,_0x606f('0x27'),rs[_0x606f('0x28')](0x4)+_0x606f('0x49'));fs[_0x606f('0x29')](_0x2e49d8,_0x3e6497,{'encoding':_0x606f('0x2a')});_0x5194b1=path['resolve'](__dirname,_0x606f('0x27'),rs[_0x606f('0x28')](0x4)+_0x606f('0x4a'));return convertFile(_0x2e49d8,_0x5194b1);})[_0x606f('0x2b')](function(){try{fs[_0x606f('0x19')](_0x2e49d8);fs['chmodSync'](_0x5194b1,_0x606f('0x2d'));}catch(_0xc9884c){logger[_0x606f('0x12')](_0xc9884c);}logger[_0x606f('0x16')]('goggleTTS\x20path',_0x5194b1[_0x606f('0x2e')]('.')[0x0]);return _0x5194b1[_0x606f('0x2e')]('.')[0x0];});};exports[_0x606f('0x4b')]=function(_0x355721,_0x57f47b,_0x46a11f){return google[_0x606f('0x4c')](_0x355721,_0x57f47b,_0x46a11f)[_0x606f('0x2b')](function(_0x1f6f4c){logger['info'](_0x1f6f4c[_0x606f('0x4d')]);return rp(_0x1f6f4c);})['then'](function(_0x2177ac){var _0x3113f0='';var _0x216452=0x0;try{fs[_0x606f('0x19')](_0x355721);}catch(_0x43ef12){logger[_0x606f('0x12')](_0x43ef12);}if(_0x2177ac&&_0x2177ac[_0x606f('0x4e')]){_0x3113f0=_0x2177ac[_0x606f('0x4e')]['map'](function(_0x35e360){return _0x35e360&&_0x35e360[_0x606f('0x4f')][0x0]&&_0x35e360[_0x606f('0x4f')][0x0][_0x606f('0x50')]?_0x35e360['alternatives'][0x0]['transcript']:'';})[_0x606f('0x51')]('\x0a');_0x216452=_0x2177ac[_0x606f('0x4e')]['map'](function(_0x69b2cd){return _0x69b2cd&&_0x69b2cd[_0x606f('0x4f')][0x0]&&_0x69b2cd[_0x606f('0x4f')][0x0]['confidence']?_0x69b2cd['alternatives'][0x0][_0x606f('0x52')]:0x0;})[_0x606f('0x51')]('\x0a');}logger['info']('googleASR\x20transcription',_0x3113f0);logger['info'](_0x606f('0x53'),_0x216452);return{'transcript':_0x3113f0,'confidence':_0x216452};})[_0x606f('0x54')](function(_0x925bc7){logger[_0x606f('0x12')](_0x606f('0x55'),_0x925bc7[_0x606f('0x11')],_0x925bc7[_0x606f('0x56')],_0x925bc7[_0x606f('0x57')]);});};exports[_0x606f('0x58')]=function(_0x486b0c,_0x3104fa,_0x31c5b0,_0x4a997f){var _0x4ea233=apiai(_0x3104fa,{'language':_0x4a997f||'en'});return _0x4ea233[_0x606f('0x59')](_0x31c5b0,{'sessionId':md5(_0x486b0c)})[_0x606f('0x2b')](function(_0x29dc4a){logger['info'](JSON['stringify'](_0x29dc4a));return{'source':_0x29dc4a[_0x606f('0x5a')]['source'],'resolvedQuery':_0x29dc4a[_0x606f('0x5a')][_0x606f('0x5b')],'action':_0x29dc4a[_0x606f('0x5a')][_0x606f('0x5c')],'actionIncomplete':_0x29dc4a[_0x606f('0x5a')][_0x606f('0x5d')],'speech':_0x29dc4a['result'][_0x606f('0x5e')]['speech'],'score':_0x29dc4a['result']['score'],'statusCode':_0x29dc4a['status'][_0x606f('0x5f')],'endConversation':_0x29dc4a['result'][_0x606f('0x60')][_0x606f('0x61')]||![],'isFallbackIntent':_0x29dc4a['result'][_0x606f('0x60')][_0x606f('0x62')]};});};exports[_0x606f('0x63')]=function(_0x46a3dc,_0x111e61,_0x289f4a,_0x2bbba3,_0x503cd6,_0x58e9e8){var _0x3711f7=_0x2bbba3[_0x606f('0x64')](/\\n/g,'\x0a');var _0x858df={'credentials':{'private_key':_0x3711f7,'client_email':_0x289f4a}};var _0x1494a1=new dialogflow['SessionsClient'](_0x858df);var _0x34e218=_0x1494a1[_0x606f('0x65')](_0x111e61,md5(_0x46a3dc));var _0x36280e={'session':_0x34e218,'queryInput':{'text':{'text':_0x503cd6,'languageCode':_0x58e9e8}}};return _0x1494a1['detectIntent'](_0x36280e)[_0x606f('0x2b')](function(_0xf1ba4c){if(_0xf1ba4c&&_0xf1ba4c['length']){logger[_0x606f('0x16')](_0x606f('0x66'),JSON[_0x606f('0x41')](_0xf1ba4c));var _0x3ecad0=_0xf1ba4c[0x0];if(_0x3ecad0){var _0x2cc89f={'action':_0x3ecad0['queryResult'][_0x606f('0x5c')],'allRequiredParamsPresent':_0x3ecad0[_0x606f('0x67')][_0x606f('0x68')],'endConversation':_0x3ecad0['queryResult'][_0x606f('0x69')]&&_0x3ecad0[_0x606f('0x67')][_0x606f('0x69')][_0x606f('0x6a')]?_0x3ecad0['queryResult'][_0x606f('0x69')][_0x606f('0x6a')][_0x606f('0x6b')][_0x606f('0x6c')]:![],'fulfillmentText':_0x3ecad0['queryResult'][_0x606f('0x6d')],'intentName':_0x3ecad0[_0x606f('0x67')][_0x606f('0x6e')][_0x606f('0x56')],'intentDisplayName':_0x3ecad0[_0x606f('0x67')][_0x606f('0x6e')][_0x606f('0x6f')],'isFallbackIntent':_0x3ecad0['queryResult']['intent'][_0x606f('0x70')],'languageCode':_0x3ecad0[_0x606f('0x67')][_0x606f('0x71')],'queryText':_0x3ecad0['queryResult'][_0x606f('0x72')],'responseId':_0x3ecad0[_0x606f('0x73')],'score':_0x3ecad0['queryResult'][_0x606f('0x74')],'speech':_0x3ecad0[_0x606f('0x67')][_0x606f('0x6d')],'providerResponse':JSON[_0x606f('0x41')](_0xf1ba4c)};return _0x2cc89f;}}});};exports['tildeASR']=function(_0xb0866f,_0x186e89,_0x3f4063,_0xd956ac){return tilde[_0x606f('0x4c')](_0xb0866f,_0x186e89,_0x3f4063,_0xd956ac)['then'](function(_0x2038d6){try{fs[_0x606f('0x19')](_0xb0866f);}catch(_0xcc6c2c){logger[_0x606f('0x12')](_0xcc6c2c);}logger['info'](_0x606f('0x75'),_0x2038d6[_0x606f('0x50')]);logger['info'](_0x606f('0x76'),_0x2038d6['confidence']);return _0x2038d6;});};exports['awsPolly']=function(_0x1494c6,_0x226dcb,_0x12ce86,_0x1b1c40,_0x1a721e,_0x92af9d){var _0x170362=path['resolve'](__dirname,_0x606f('0x27'),rs['generate'](0x4)+_0x606f('0x49'));var _0x47fb28;return aws[_0x606f('0x77')](_0x1494c6,_0x226dcb,_0x12ce86,_0x1b1c40,_0x1a721e,_0x92af9d,_0x170362)[_0x606f('0x2b')](function(){_0x47fb28=path[_0x606f('0x26')](__dirname,_0x606f('0x27'),rs[_0x606f('0x28')](0x4)+_0x606f('0x4a'));return convertFile(_0x170362,_0x47fb28);})[_0x606f('0x2b')](function(){try{fs[_0x606f('0x19')](_0x170362);fs[_0x606f('0x2c')](_0x47fb28,_0x606f('0x2d'));}catch(_0x356d2b){logger[_0x606f('0x12')](_0x356d2b);}return _0x47fb28[_0x606f('0x2e')]('.')[0x0];});};exports[_0x606f('0x78')]=function(_0x3a822b,_0x2b4b8c,_0x5c088c,_0x2394d8,_0x352c1a,_0x1244ae){return aws[_0x606f('0x79')](_0x3a822b,_0x2b4b8c,_0x5c088c,_0x2394d8,_0x352c1a,_0x1244ae)[_0x606f('0x2b')](function(_0xa34843){logger[_0x606f('0x16')](JSON[_0x606f('0x41')](_0xa34843));return _0xa34843;});};exports['ispeechTTS']=function(_0x8f3845,_0x61d81a,_0x197c09,_0x1edf21){var _0x587d0e=util[_0x606f('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x8f3845,encodeURIComponent(_0x61d81a),_0x197c09,_0x1edf21);var _0x467689=path[_0x606f('0x26')](__dirname,_0x606f('0x27'),rs[_0x606f('0x28')](0x4)+'.mp3');var _0x3351fa;return downloadFile(_0x587d0e,_0x467689)[_0x606f('0x2b')](function(){_0x3351fa=path[_0x606f('0x26')](__dirname,'tmp',rs[_0x606f('0x28')](0x4)+_0x606f('0x4a'));return convertFile(_0x467689,_0x3351fa);})[_0x606f('0x2b')](function(){try{fs[_0x606f('0x19')](_0x467689);fs[_0x606f('0x2c')](_0x3351fa,_0x606f('0x2d'));}catch(_0x115919){logger[_0x606f('0x12')](_0x115919);}return _0x3351fa[_0x606f('0x2e')]('.')[0x0];});};exports[_0x606f('0x7b')]=function(_0x2bca71,_0x2e231e,_0x2a6505,_0x385303){var _0x1b870d=util[_0x606f('0x7a')](_0x606f('0x7c'),ISPEECH_API,_0x2e231e,_0x2a6505,base64Encode(_0x2bca71),_0x385303?util[_0x606f('0x7a')](_0x606f('0x7d'),encodeURIComponent(_0x385303)):_0x606f('0x7e'));return uploadFile(_0x1b870d)['then'](function(_0x15ca12){return querystring['parse'](_0x15ca12);});};exports[_0x606f('0x7f')]=function(_0x1ea24e,_0x56c212){return sestek[_0x606f('0x80')](_0x1ea24e,_0x56c212)[_0x606f('0x2b')](function(_0x4af696){logger[_0x606f('0x16')](JSON['stringify'](_0x4af696));var _0x402298={'speech':_0x4af696[_0x606f('0x81')],'action':_0x4af696[_0x606f('0x82')]?_0x4af696[_0x606f('0x82')][_0x606f('0x83')]:undefined,'actiondata':_0x4af696[_0x606f('0x82')]?_0x4af696[_0x606f('0x82')][_0x606f('0x84')]:undefined};if(_0x4af696[_0x606f('0x82')]&&_0x4af696[_0x606f('0x82')]['AudioFromTts']){return base64Decode(_0x4af696[_0x606f('0x82')][_0x606f('0x85')][_0x606f('0x86')],path[_0x606f('0x26')](__dirname,'tmp',rs[_0x606f('0x28')](0x4)+_0x606f('0x4a')))[_0x606f('0x2b')](function(_0x53ab96){_0x402298[_0x606f('0x87')]=_0x53ab96;return _0x402298;});}return _0x402298;});};exports[_0x606f('0x88')]=function(){return __dirname;}; \ No newline at end of file +var _0xda8a=['https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','jQ1olc','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','catch','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','languageCode','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','close','unlink','download\x20error','pipe','end','get','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','info','googleCloudTTS\x20path','googleTTS'];(function(_0x39dea2,_0x229ccc){var _0x31c350=function(_0x2d9f3c){while(--_0x2d9f3c){_0x39dea2['push'](_0x39dea2['shift']());}};_0x31c350(++_0x229ccc);}(_0xda8a,0xce));var _0xada8=function(_0x886576,_0x35c496){_0x886576=_0x886576-0x0;var _0x132c99=_0xda8a[_0x886576];return _0x132c99;};'use strict';var apiai=require(_0xada8('0x0'));var BPromise=require(_0xada8('0x1'));var dialogflow=require(_0xada8('0x2'));var fs=require('fs');var http=require(_0xada8('0x3'));var https=require(_0xada8('0x4'));var md5=require(_0xada8('0x5'));var path=require(_0xada8('0x6'));var querystring=require(_0xada8('0x7'));var rp=require(_0xada8('0x8'));var rs=require('randomstring');var sox=require('sox');var tts=require('google-tts-api');var urlParse=require('url')[_0xada8('0x9')];var util=require(_0xada8('0xa'));var aws=require('./aws');var google=require(_0xada8('0xb'));var sestek=require(_0xada8('0xc'));var tilde=require(_0xada8('0xd'));var logger=require(_0xada8('0xe'))(_0xada8('0xf'));var ISPEECH_API=_0xada8('0x10');function downloadFile(_0x5b4935,_0x479ffb){return new BPromise(function(_0x36b237,_0x33548a){var _0x426b79=urlParse(_0x5b4935);var _0x281c83=_0x426b79[_0xada8('0x11')]===_0xada8('0x12')?https:http;var _0x28603b={'host':_0x426b79[_0xada8('0x13')],'path':_0x426b79[_0xada8('0x6')],'headers':{'user-agent':_0xada8('0x14')}};_0x281c83['get'](_0x28603b,function(_0x1658a9){if(_0x1658a9[_0xada8('0x15')]!==0xc8){logger[_0xada8('0x16')]('request\x20to\x20'+_0x5b4935+'\x20failed,\x20status\x20code\x20=\x20'+_0x1658a9['statusCode']+'\x20('+_0x1658a9[_0xada8('0x17')]+')');_0x33548a(new Error(_0xada8('0x18')+_0x5b4935+_0xada8('0x19')+_0x1658a9['statusCode']+'\x20('+_0x1658a9[_0xada8('0x17')]+')'));return;}var _0x42d128=fs[_0xada8('0x1a')](_0x479ffb);_0x42d128['on'](_0xada8('0x1b'),function(){logger['info']('finish\x20download\x20file');_0x42d128[_0xada8('0x1c')](_0x36b237);});_0x42d128['on'](_0xada8('0x16'),function(_0x255103){fs[_0xada8('0x1d')](_0x479ffb);logger[_0xada8('0x16')](_0xada8('0x1e'),_0x255103);_0x33548a(_0x255103);});_0x1658a9[_0xada8('0x1f')](_0x42d128);})['on']('error',function(_0x11ed8b){logger[_0xada8('0x16')](_0x11ed8b);_0x33548a(_0x11ed8b);})[_0xada8('0x20')]();});}function uploadFile(_0x5e4d1e){return new BPromise(function(_0x60e0ae,_0x2525a2){var _0x50e07a=urlParse(_0x5e4d1e);var _0x5e9ae5=_0x50e07a['protocol']===_0xada8('0x12')?https:http;var _0x5c3b9f={'host':_0x50e07a[_0xada8('0x13')],'path':_0x50e07a['path'],'headers':{'user-agent':_0xada8('0x14')}};_0x5e9ae5[_0xada8('0x21')](_0x5c3b9f,function(_0x1ba965){if(_0x1ba965['statusCode']!==0xc8){_0x2525a2(new Error('request\x20to\x20'+_0x5e4d1e+'\x20failed,\x20status\x20code\x20=\x20'+_0x1ba965['statusCode']+'\x20('+_0x1ba965[_0xada8('0x17')]+')'));return;}var _0x492c71='';_0x1ba965['on'](_0xada8('0x22'),function(_0xbd7c92){_0x492c71+=_0xbd7c92;});_0x1ba965['on'](_0xada8('0x20'),function(){_0x60e0ae(_0x492c71);});})['on']('error',function(_0x5f3c48){_0x2525a2(_0x5f3c48);})[_0xada8('0x20')]();});}function convertFile(_0x24274e,_0x220439){return new BPromise(function(_0x19a58f,_0x45011b){var _0x3c7feb=sox[_0xada8('0x23')](_0x24274e,_0x220439,{'sampleRate':0x1f40,'format':_0xada8('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3c7feb['on'](_0xada8('0x16'),function(_0x3c9787){logger[_0xada8('0x16')](_0xada8('0x25'),_0x3c9787);_0x45011b(_0x3c9787);});_0x3c7feb['on'](_0xada8('0x20'),function(){logger['info'](_0xada8('0x26'));_0x19a58f();});_0x3c7feb[_0xada8('0x27')]();});}function base64Decode(_0x597225,_0x32c341){var _0x74ee20=path[_0xada8('0x28')](__dirname,_0xada8('0x29'),rs['generate'](0x4)+_0xada8('0x2a'));fs[_0xada8('0x2b')](_0x74ee20,_0x597225,_0xada8('0x2c'));return convertFile(_0x74ee20,_0x32c341)[_0xada8('0x2d')](function(){try{fs[_0xada8('0x1d')](_0x74ee20);fs[_0xada8('0x2e')](_0x32c341,_0xada8('0x2f'));}catch(_0x3a0e83){logger[_0xada8('0x16')](_0x3a0e83);}return _0x32c341[_0xada8('0x30')]('.')[0x0];});}function base64Encode(_0x349e4c){var _0x25c39c=fs['readFileSync'](_0x349e4c);return new Buffer(_0x25c39c)[_0xada8('0x31')](_0xada8('0x2c'));}exports['googleCloudTTS']=function(_0x551299,_0x2f26a0,_0x161f24,_0x4c4f7a,_0x3c00d1,_0x5c993f){var _0x4bd562,_0x3d8c0e;var _0x5af78a=_0xada8('0x32');var _0x4a3fa6=_0xada8('0x33')+_0x551299;var _0x57f6b8={};if(_0x2f26a0==='ssml'){_0x57f6b8[_0xada8('0x34')]={'ssml':_0x161f24};}else{_0x57f6b8[_0xada8('0x34')]={'text':_0x161f24};};_0x57f6b8[_0xada8('0x35')]={'languageCode':_0x4c4f7a,'ssmlGender':_0x3c00d1};_0x57f6b8[_0xada8('0x36')]={'audioEncoding':_0xada8('0x37'),'sampleRateHertz':0x1f40};var _0x5dde80={'url':_0x5af78a+_0xada8('0x38')+_0x4a3fa6,'method':_0xada8('0x39'),'json':!![],'body':_0x57f6b8};return rp(_0x5dde80)[_0xada8('0x2d')](function(_0x385ea7){return new BPromise(function(_0xb1a630,_0x725b7f){_0x4bd562=path[_0xada8('0x28')](__dirname,_0xada8('0x29'),rs[_0xada8('0x3a')](0x4)+_0xada8('0x3b'));var _0x14a595=Buffer[_0xada8('0x3c')](_0x385ea7[_0xada8('0x3d')],_0xada8('0x2c'));return fs[_0xada8('0x3e')](_0x4bd562,_0x14a595,function(_0xd9392c){_0x725b7f(_0xd9392c);},function(_0x1622f3){fs[_0xada8('0x2e')](_0x4bd562,_0xada8('0x2f'));_0xb1a630(_0x1622f3);});});})['then'](function(_0x26ba63){_0x3d8c0e=path[_0xada8('0x28')](__dirname,_0xada8('0x29'),rs[_0xada8('0x3a')](0x4)+'.wav');return convertFile(_0x4bd562,_0x3d8c0e);})[_0xada8('0x2d')](function(){try{fs[_0xada8('0x1d')](_0x4bd562);fs[_0xada8('0x2e')](_0x3d8c0e,_0xada8('0x2f'));}catch(_0x888cda){logger[_0xada8('0x16')](_0x888cda);}logger[_0xada8('0x3f')](_0xada8('0x40'),_0x3d8c0e['split']('.')[0x0]);return _0x3d8c0e[_0xada8('0x30')]('.')[0x0];});};exports[_0xada8('0x41')]=function(_0x2570ec,_0x22e8e8){var _0x2fb0d8=_0xada8('0x42');var _0x3d2e74,_0x1d0eb8;var _0x11c71d;var _0x376cf9={'encoding':'utf8','method':_0xada8('0x39'),'timeout':0x2710,'url':_0x2fb0d8,'headers':{'Content-Type':_0xada8('0x43')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xada8('0x44'),JSON[_0xada8('0x45')]([_0x2570ec,_0x22e8e8||'en',![],'null']),null,_0xada8('0x46')]]]))};return rp(_0x376cf9)['then'](function(_0x38b5a9){try{_0x11c71d=eval(_0x38b5a9[_0xada8('0x47')](0x5))[0x0][0x2];}catch(_0x423f1f){throw new Error(_0xada8('0x48')+_0x38b5a9[_0xada8('0x22')]);}if(!_0x11c71d){if(_0x2570ec[_0xada8('0x49')]>0xc8){throw new Error(_0xada8('0x4a'));}else{throw new Error(_0xada8('0x4b')+_0x22e8e8+_0xada8('0x4c'));}}try{_0x11c71d=eval(_0x11c71d)[0x0];}catch(_0x16310e){throw new Error(_0xada8('0x48')+res[_0xada8('0x22')]);}const _0x2993b5=_0x11c71d;_0x3d2e74=path[_0xada8('0x28')](__dirname,_0xada8('0x29'),rs[_0xada8('0x3a')](0x4)+'.mp3');fs[_0xada8('0x2b')](_0x3d2e74,_0x11c71d,{'encoding':'base64'});_0x1d0eb8=path[_0xada8('0x28')](__dirname,_0xada8('0x29'),rs['generate'](0x4)+_0xada8('0x2a'));return convertFile(_0x3d2e74,_0x1d0eb8);})[_0xada8('0x2d')](function(){try{fs[_0xada8('0x1d')](_0x3d2e74);fs[_0xada8('0x2e')](_0x1d0eb8,_0xada8('0x2f'));}catch(_0x56ae19){logger[_0xada8('0x16')](_0x56ae19);}logger[_0xada8('0x3f')](_0xada8('0x4d'),_0x1d0eb8[_0xada8('0x30')]('.')[0x0]);return _0x1d0eb8['split']('.')[0x0];});};exports[_0xada8('0x4e')]=function(_0xaaa78e,_0x305c3a,_0x4eebdc){return google[_0xada8('0x4f')](_0xaaa78e,_0x305c3a,_0x4eebdc)[_0xada8('0x2d')](function(_0xebe9b3){logger[_0xada8('0x3f')](_0xebe9b3['uri']);return rp(_0xebe9b3);})['then'](function(_0x2fd458){var _0x18e41d='';var _0x3527f7=0x0;try{fs[_0xada8('0x1d')](_0xaaa78e);}catch(_0x4c01cd){logger[_0xada8('0x16')](_0x4c01cd);}if(_0x2fd458&&_0x2fd458[_0xada8('0x50')]){_0x18e41d=_0x2fd458[_0xada8('0x50')][_0xada8('0x51')](function(_0x24946f){return _0x24946f&&_0x24946f[_0xada8('0x52')][0x0]&&_0x24946f[_0xada8('0x52')][0x0][_0xada8('0x53')]?_0x24946f['alternatives'][0x0][_0xada8('0x53')]:'';})['join']('\x0a');_0x3527f7=_0x2fd458[_0xada8('0x50')][_0xada8('0x51')](function(_0x333435){return _0x333435&&_0x333435['alternatives'][0x0]&&_0x333435[_0xada8('0x52')][0x0][_0xada8('0x54')]?_0x333435[_0xada8('0x52')][0x0][_0xada8('0x54')]:0x0;})[_0xada8('0x55')]('\x0a');}logger[_0xada8('0x3f')]('googleASR\x20transcription',_0x18e41d);logger['info'](_0xada8('0x56'),_0x3527f7);return{'transcript':_0x18e41d,'confidence':_0x3527f7};})[_0xada8('0x57')](function(_0x1e9bc1){logger[_0xada8('0x16')]('[%s]\x20%s:%s',_0x1e9bc1[_0xada8('0x15')],_0x1e9bc1['name'],_0x1e9bc1[_0xada8('0x58')]);});};exports[_0xada8('0x59')]=function(_0x5b9f06,_0x1bb5b1,_0x26663f,_0x1e75e9){var _0x50f24f=apiai(_0x1bb5b1,{'language':_0x1e75e9||'en'});return _0x50f24f[_0xada8('0x5a')](_0x26663f,{'sessionId':md5(_0x5b9f06)})[_0xada8('0x2d')](function(_0x5a35fe){logger[_0xada8('0x3f')](JSON[_0xada8('0x45')](_0x5a35fe));return{'source':_0x5a35fe[_0xada8('0x5b')]['source'],'resolvedQuery':_0x5a35fe[_0xada8('0x5b')][_0xada8('0x5c')],'action':_0x5a35fe['result'][_0xada8('0x5d')],'actionIncomplete':_0x5a35fe[_0xada8('0x5b')][_0xada8('0x5e')],'speech':_0x5a35fe['result'][_0xada8('0x5f')][_0xada8('0x60')],'score':_0x5a35fe[_0xada8('0x5b')][_0xada8('0x61')],'statusCode':_0x5a35fe['status'][_0xada8('0x62')],'endConversation':_0x5a35fe['result'][_0xada8('0x63')][_0xada8('0x64')]||![],'isFallbackIntent':_0x5a35fe[_0xada8('0x5b')][_0xada8('0x63')][_0xada8('0x65')]};});};exports[_0xada8('0x66')]=function(_0x1a19f4,_0x4460fe,_0x509170,_0x5780b2,_0x45a2ae,_0x21d71f){var _0x5179db=_0x5780b2['replace'](/\\n/g,'\x0a');var _0x1b83bc={'credentials':{'private_key':_0x5179db,'client_email':_0x509170}};var _0x58b526=new dialogflow[(_0xada8('0x67'))](_0x1b83bc);var _0x30efae=_0x58b526['sessionPath'](_0x4460fe,md5(_0x1a19f4));var _0x46a3d3={'session':_0x30efae,'queryInput':{'text':{'text':_0x45a2ae,'languageCode':_0x21d71f}}};return _0x58b526[_0xada8('0x68')](_0x46a3d3)[_0xada8('0x2d')](function(_0x53cb36){if(_0x53cb36&&_0x53cb36[_0xada8('0x49')]){logger['info'](_0xada8('0x69'),JSON['stringify'](_0x53cb36));var _0x14e35c=_0x53cb36[0x0];if(_0x14e35c){var _0x4d34ef={'action':_0x14e35c[_0xada8('0x6a')][_0xada8('0x5d')],'allRequiredParamsPresent':_0x14e35c[_0xada8('0x6a')][_0xada8('0x6b')],'endConversation':_0x14e35c[_0xada8('0x6a')][_0xada8('0x6c')]&&_0x14e35c[_0xada8('0x6a')][_0xada8('0x6c')][_0xada8('0x6d')]?_0x14e35c[_0xada8('0x6a')][_0xada8('0x6c')]['fields'][_0xada8('0x6e')][_0xada8('0x6f')]:![],'fulfillmentText':_0x14e35c[_0xada8('0x6a')][_0xada8('0x70')],'intentName':_0x14e35c['queryResult'][_0xada8('0x71')][_0xada8('0x72')],'intentDisplayName':_0x14e35c['queryResult']['intent'][_0xada8('0x73')],'isFallbackIntent':_0x14e35c[_0xada8('0x6a')][_0xada8('0x71')]['isFallback'],'languageCode':_0x14e35c[_0xada8('0x6a')][_0xada8('0x74')],'queryText':_0x14e35c[_0xada8('0x6a')]['queryText'],'responseId':_0x14e35c[_0xada8('0x75')],'score':_0x14e35c[_0xada8('0x6a')]['intentDetectionConfidence'],'speech':_0x14e35c[_0xada8('0x6a')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x53cb36)};return _0x4d34ef;}}});};exports[_0xada8('0x76')]=function(_0x3d98b6,_0x33de58,_0x2902a3,_0x1a6403){return tilde[_0xada8('0x4f')](_0x3d98b6,_0x33de58,_0x2902a3,_0x1a6403)[_0xada8('0x2d')](function(_0x1990dc){try{fs[_0xada8('0x1d')](_0x3d98b6);}catch(_0x5d69ff){logger[_0xada8('0x16')](_0x5d69ff);}logger[_0xada8('0x3f')](_0xada8('0x77'),_0x1990dc[_0xada8('0x53')]);logger[_0xada8('0x3f')](_0xada8('0x78'),_0x1990dc[_0xada8('0x54')]);return _0x1990dc;});};exports[_0xada8('0x79')]=function(_0x4232a2,_0x5555b9,_0x457860,_0xeae606,_0x119a17,_0x23f2a0){var _0x534d2c=path[_0xada8('0x28')](__dirname,_0xada8('0x29'),rs['generate'](0x4)+'.mp3');var _0x4471da;return aws['polly'](_0x4232a2,_0x5555b9,_0x457860,_0xeae606,_0x119a17,_0x23f2a0,_0x534d2c)['then'](function(){_0x4471da=path['resolve'](__dirname,_0xada8('0x29'),rs[_0xada8('0x3a')](0x4)+_0xada8('0x2a'));return convertFile(_0x534d2c,_0x4471da);})[_0xada8('0x2d')](function(){try{fs[_0xada8('0x1d')](_0x534d2c);fs[_0xada8('0x2e')](_0x4471da,'777');}catch(_0x419b37){logger[_0xada8('0x16')](_0x419b37);}return _0x4471da[_0xada8('0x30')]('.')[0x0];});};exports[_0xada8('0x7a')]=function(_0x22da62,_0x943f3f,_0x408264,_0x2b67b2,_0x3acc9d,_0x4e3527){return aws['lex'](_0x22da62,_0x943f3f,_0x408264,_0x2b67b2,_0x3acc9d,_0x4e3527)[_0xada8('0x2d')](function(_0x47ae38){logger[_0xada8('0x3f')](JSON[_0xada8('0x45')](_0x47ae38));return _0x47ae38;});};exports[_0xada8('0x7b')]=function(_0x2dec34,_0x21b589,_0x2bbe43,_0x2b0ad1){var _0x548ff6=util[_0xada8('0x7c')](_0xada8('0x7d'),ISPEECH_API,_0x2dec34,encodeURIComponent(_0x21b589),_0x2bbe43,_0x2b0ad1);var _0x14820c=path[_0xada8('0x28')](__dirname,'tmp',rs[_0xada8('0x3a')](0x4)+_0xada8('0x3b'));var _0x16a9ac;return downloadFile(_0x548ff6,_0x14820c)['then'](function(){_0x16a9ac=path[_0xada8('0x28')](__dirname,_0xada8('0x29'),rs[_0xada8('0x3a')](0x4)+_0xada8('0x2a'));return convertFile(_0x14820c,_0x16a9ac);})['then'](function(){try{fs[_0xada8('0x1d')](_0x14820c);fs[_0xada8('0x2e')](_0x16a9ac,_0xada8('0x2f'));}catch(_0x3c23f2){logger['error'](_0x3c23f2);}return _0x16a9ac[_0xada8('0x30')]('.')[0x0];});};exports[_0xada8('0x7e')]=function(_0x50f43a,_0x1b568a,_0x366238,_0x1c3f82){var _0x36c755=util['format'](_0xada8('0x7f'),ISPEECH_API,_0x1b568a,_0x366238,base64Encode(_0x50f43a),_0x1c3f82?util[_0xada8('0x7c')](_0xada8('0x80'),encodeURIComponent(_0x1c3f82)):'freeform=3');return uploadFile(_0x36c755)[_0xada8('0x2d')](function(_0x51b880){return querystring['parse'](_0x51b880);});};exports[_0xada8('0x81')]=function(_0x45471b,_0x4028d3){return sestek[_0xada8('0x82')](_0x45471b,_0x4028d3)[_0xada8('0x2d')](function(_0x2feda3){logger[_0xada8('0x3f')](JSON['stringify'](_0x2feda3));var _0x730600={'speech':_0x2feda3[_0xada8('0x83')],'action':_0x2feda3[_0xada8('0x84')]?_0x2feda3['channelData']['CustomAction']:undefined,'actiondata':_0x2feda3[_0xada8('0x84')]?_0x2feda3['channelData']['CustomActionData']:undefined};if(_0x2feda3['channelData']&&_0x2feda3['channelData']['AudioFromTts']){return base64Decode(_0x2feda3[_0xada8('0x84')][_0xada8('0x85')][_0xada8('0x86')],path[_0xada8('0x28')](__dirname,_0xada8('0x29'),rs[_0xada8('0x3a')](0x4)+_0xada8('0x2a')))[_0xada8('0x2d')](function(_0x468bcb){_0x730600[_0xada8('0x87')]=_0x468bcb;return _0x730600;});}return _0x730600;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 060ae3b..3d2b52f 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 _0xcd73=['./nda','exports'];(function(_0x549235,_0x4e066f){var _0x484cce=function(_0x407ce6){while(--_0x407ce6){_0x549235['push'](_0x549235['shift']());}};_0x484cce(++_0x4e066f);}(_0xcd73,0xf2));var _0x3cd7=function(_0x45f61f,_0x14232a){_0x45f61f=_0x45f61f-0x0;var _0x1264ce=_0xcd73[_0x45f61f];return _0x1264ce;};var nda=require(_0x3cd7('0x0'));module[_0x3cd7('0x1')]={'nda':nda}; \ No newline at end of file +var _0x43cf=['./nda','exports'];(function(_0xe8834c,_0x4e87de){var _0x28ba1a=function(_0x5a6e10){while(--_0x5a6e10){_0xe8834c['push'](_0xe8834c['shift']());}};_0x28ba1a(++_0x4e87de);}(_0x43cf,0x106));var _0xf43c=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0x43cf[_0x581249];return _0x284bae;};var nda=require(_0xf43c('0x0'));module[_0xf43c('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 0633ae3..068f500 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 _0xb688=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','audio/wav','custom_action','CustomActionData','custom_action_data','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','then'];(function(_0x47d336,_0x6fbfd4){var _0xad985d=function(_0x345bdc){while(--_0x345bdc){_0x47d336['push'](_0x47d336['shift']());}};_0xad985d(++_0x6fbfd4);}(_0xb688,0xcf));var _0x8b68=function(_0x152fec,_0x1e38b0){_0x152fec=_0x152fec-0x0;var _0x2cf7cc=_0xb688[_0x152fec];return _0x2cf7cc;};'use strict';var rp=require('request-promise');var url=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));module[_0x8b68('0x3')]=function(_0x23bbaa,_0x446b17){var _0x4e281c={'method':_0x8b68('0x4'),'uri':url[_0x8b68('0x5')](_0x446b17[_0x8b68('0x6')],_0x8b68('0x7')),'form':{'grant_type':'password','username':_0x446b17[_0x8b68('0x8')],'password':_0x446b17['password']},'json':!![]};return rp(_0x4e281c)[_0x8b68('0x9')](function(_0x2bbffd){var _0x130892={'method':_0x8b68('0x4'),'uri':url[_0x8b68('0x5')](_0x446b17[_0x8b68('0xa')],_0x8b68('0xb')),'body':{'type':_0x446b17[_0x8b68('0xc')]||_0x8b68('0xd'),'channelId':_0x8b68('0xe'),'conversation':{'id':_0x23bbaa[_0x8b68('0xf')]},'from':{'id':_0x23bbaa[_0x8b68('0x10')],'name':_0x23bbaa[_0x8b68('0x11')]},'recipient':{'id':_0x23bbaa['dnid'],'name':_0x23bbaa[_0x8b68('0x12')]},'text':_0x446b17[_0x8b68('0x13')],'channelData':{}},'headers':{'Authorization':_0x8b68('0x14')+_0x2bbffd[_0x8b68('0x15')]},'json':!![]};if(_0x446b17[_0x8b68('0x16')]){_0x130892[_0x8b68('0x17')][_0x8b68('0x18')][_0x8b68('0x19')]=_0x446b17[_0x8b68('0x16')];}if(_0x446b17['ndagenerate_audio']=='1'){_0x130892[_0x8b68('0x17')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8b68('0x1a')};}if(_0x446b17[_0x8b68('0x1b')]){_0x130892[_0x8b68('0x17')]['channelData']['CustomAction']=_0x446b17[_0x8b68('0x1b')];if(_0x446b17['custom_action_data']){_0x130892[_0x8b68('0x17')][_0x8b68('0x18')][_0x8b68('0x1c')]=_0x446b17[_0x8b68('0x1d')];}}logger['info'](JSON[_0x8b68('0x1e')](_0x130892));return rp(_0x130892);});}; \ No newline at end of file +var _0x702d=['message','Nda','uniqueid','callerid','calleridname','dnid','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','body','audio/wav','custom_action','custom_action_data','CustomActionData','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','/token','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0xe5d7c6,_0x2779d4){var _0x35dfb8=function(_0x485689){while(--_0x485689){_0xe5d7c6['push'](_0xe5d7c6['shift']());}};_0x35dfb8(++_0x2779d4);}(_0x702d,0x147));var _0xd702=function(_0x1a6bc3,_0x35ef26){_0x1a6bc3=_0x1a6bc3-0x0;var _0xe7571=_0x702d[_0x1a6bc3];return _0xe7571;};'use strict';var rp=require(_0xd702('0x0'));var url=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));module[_0xd702('0x4')]=function(_0x5c2b9e,_0x20c11a){var _0xebbd7c={'method':_0xd702('0x5'),'uri':url[_0xd702('0x6')](_0x20c11a['ndauth_url'],_0xd702('0x7')),'form':{'grant_type':'password','username':_0x20c11a[_0xd702('0x8')],'password':_0x20c11a[_0xd702('0x9')]},'json':!![]};return rp(_0xebbd7c)[_0xd702('0xa')](function(_0x5af246){var _0x12bb75={'method':'POST','uri':url[_0xd702('0x6')](_0x20c11a[_0xd702('0xb')],_0xd702('0xc')),'body':{'type':_0x20c11a[_0xd702('0xd')]||_0xd702('0xe'),'channelId':_0xd702('0xf'),'conversation':{'id':_0x5c2b9e[_0xd702('0x10')]},'from':{'id':_0x5c2b9e[_0xd702('0x11')],'name':_0x5c2b9e[_0xd702('0x12')]},'recipient':{'id':_0x5c2b9e[_0xd702('0x13')],'name':_0x5c2b9e['extension']},'text':_0x20c11a['text'],'channelData':{}},'headers':{'Authorization':_0xd702('0x14')+_0x5af246[_0xd702('0x15')]},'json':!![]};if(_0x20c11a[_0xd702('0x16')]){_0x12bb75['body'][_0xd702('0x17')][_0xd702('0x18')]=_0x20c11a[_0xd702('0x16')];}if(_0x20c11a[_0xd702('0x19')]=='1'){_0x12bb75[_0xd702('0x1a')][_0xd702('0x17')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xd702('0x1b')};}if(_0x20c11a[_0xd702('0x1c')]){_0x12bb75['body'][_0xd702('0x17')]['CustomAction']=_0x20c11a[_0xd702('0x1c')];if(_0x20c11a[_0xd702('0x1d')]){_0x12bb75['body'][_0xd702('0x17')][_0xd702('0x1e')]=_0x20c11a[_0xd702('0x1d')];}}logger['info'](JSON['stringify'](_0x12bb75));return rp(_0x12bb75);});}; \ 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 efc265f..17637eb 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 _0x4405=['exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4405,0x15c));var _0x5440=function(_0x30c596,_0x42fb84){_0x30c596=_0x30c596-0x0;var _0x1daa1c=_0x4405[_0x30c596];return _0x1daa1c;};'use strict';var asr=require('./lib/api');module[_0x5440('0x0')]=function(_0x1ba7ab,_0x252445,_0x5223b0,_0x1c7f71){return asr(_0x1ba7ab,_0x252445,_0x5223b0,_0x1c7f71);}; \ No newline at end of file +var _0xa2c5=['./lib/api','exports'];(function(_0x5132b6,_0x28cbe1){var _0x5355fd=function(_0x5ab8a4){while(--_0x5ab8a4){_0x5132b6['push'](_0x5132b6['shift']());}};_0x5355fd(++_0x28cbe1);}(_0xa2c5,0xce));var _0x5a2c=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xa2c5[_0x3e44fa];return _0x2a0aba;};'use strict';var asr=require(_0x5a2c('0x0'));module[_0x5a2c('0x1')]=function(_0x29370d,_0x2ff935,_0xc65442,_0x58a3a4){return asr(_0x29370d,_0x2ff935,_0xc65442,_0x58a3a4);}; \ 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 945d767..b8af82a 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 _0x3e7b=['hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses'];(function(_0x33011a,_0x124605){var _0x4228d8=function(_0x2e8f40){while(--_0x2e8f40){_0x33011a['push'](_0x33011a['shift']());}};_0x4228d8(++_0x124605);}(_0x3e7b,0x88));var _0xb3e7=function(_0x817041,_0x149055){_0x817041=_0x817041-0x0;var _0x25e725=_0x3e7b[_0x817041];return _0x25e725;};'use strict';var BPromise=require(_0xb3e7('0x0'));var _=require(_0xb3e7('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb3e7('0x2'));var crypto=require('crypto');var logger=require(_0xb3e7('0x3'))(_0xb3e7('0x4'));module[_0xb3e7('0x5')]=function(_0x25c1c7,_0x19d2ef,_0x314335,_0x2c82c5){return new BPromise(function(_0x4278ff,_0x538894){logger[_0xb3e7('0x6')]('Tilde\x20URI',_0x2c82c5||_0xb3e7('0x7'));var _0x43ccb3=new WebSocket(_0x2c82c5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5e140b='';var _0x5adbbd='0';var _0x26e61c='1';var _0x1586cd=_0xb3e7('0x8');function _0x10e4a3(_0x20f601){var _0x509341=crypto[_0xb3e7('0x9')](_0xb3e7('0xa'));_0x509341[_0xb3e7('0xb')](_0x20f601);return _0x509341['digest'](_0xb3e7('0xc'));}function _0x16a6cc(){try{logger[_0xb3e7('0x6')](_0xb3e7('0xd'));var _0x5da342=moment()[_0xb3e7('0xe')]();var _0x4e2d52=_0x10e4a3(_0x5da342+_0x19d2ef+_0x314335);_0x43ccb3[_0xb3e7('0xf')](JSON[_0xb3e7('0x10')]({'appID':_0x19d2ef,'timestamp':_0x5da342,'appKey':_0x4e2d52}));var _0x39ec7f=fs[_0xb3e7('0x11')](_0x25c1c7);_0x39ec7f['on'](_0xb3e7('0x12'),function(_0x56806c){_0x43ccb3['send'](_0x56806c);});_0x39ec7f['on'](_0xb3e7('0x13'),function(){_0x43ccb3[_0xb3e7('0xf')]('EOS');});}catch(_0xf62e59){logger[_0xb3e7('0x14')](_0xb3e7('0x15'),JSON[_0xb3e7('0x10')](_0xf62e59));_0x43ccb3[_0xb3e7('0x16')]();}}function _0x40cf25(_0x199620){try{if(_0x199620){var _0x4ef623=JSON[_0xb3e7('0x17')](_0x199620);switch(_0x4ef623[_0xb3e7('0x18')]){case 0x0:if(_0x4ef623[_0xb3e7('0x19')]){if(_0x4ef623[_0xb3e7('0x19')][_0xb3e7('0x1a')]){logger[_0xb3e7('0x6')](_0xb3e7('0x1b'),JSON['stringify'](_0x4ef623[_0xb3e7('0x19')][_0xb3e7('0x1c')]));_0x5e140b=_0x4ef623['result']['hypotheses'][0x0]['transcript'];_0x5adbbd=_0x4ef623[_0xb3e7('0x19')][_0xb3e7('0x1c')][0x0][_0xb3e7('0x1d')];_0x26e61c='0';_0x1586cd=_0xb3e7('0x1e');_0x43ccb3[_0xb3e7('0x16')]();}}break;case 0x1:logger[_0xb3e7('0x6')](_0xb3e7('0x8'));_0x26e61c='1';_0x1586cd='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xb3e7('0x6')](_0xb3e7('0x1f'));_0x26e61c='2';_0x1586cd='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xb3e7('0x6')](_0xb3e7('0x20'));_0x26e61c='9';_0x1586cd=_0xb3e7('0x20');break;case 0xa:logger[_0xb3e7('0x6')]('Authentication\x20failed.');_0x26e61c='10';_0x1586cd=_0xb3e7('0x21');break;case 0xb:logger[_0xb3e7('0x6')](_0xb3e7('0x22'));_0x26e61c='11';_0x1586cd=_0xb3e7('0x22');}}}catch(_0x29d556){logger['error'](_0xb3e7('0x23'),JSON[_0xb3e7('0x10')](_0x29d556));_0x43ccb3[_0xb3e7('0x16')]();}}function _0x4d4b13(){logger[_0xb3e7('0x6')](_0xb3e7('0x24'));_0x4278ff({'transcript':_0x5e140b,'confidence':_0x5adbbd,'status':_0x26e61c,'status_message':_0x1586cd});}function _0x5e95ed(_0x4e4b04){logger[_0xb3e7('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xb3e7('0x25')](_0x4e4b04)){logger[_0xb3e7('0x14')](_[_0xb3e7('0x26')](_0x4e4b04)?JSON[_0xb3e7('0x10')](_0x4e4b04):_0x4e4b04);}}_0x43ccb3['on'](_0xb3e7('0x27'),_0x16a6cc);_0x43ccb3['on'](_0xb3e7('0x28'),_0x40cf25);_0x43ccb3['on'](_0xb3e7('0x13'),_0x4d4b13);_0x43ccb3['on']('error',_0x5e95ed);});}; \ No newline at end of file +var _0xecf3=['likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript'];(function(_0x5cb508,_0x2cb3bd){var _0x44d4f5=function(_0x51502f){while(--_0x51502f){_0x5cb508['push'](_0x5cb508['shift']());}};_0x44d4f5(++_0x2cb3bd);}(_0xecf3,0x130));var _0x3ecf=function(_0x1e949b,_0x403cbf){_0x1e949b=_0x1e949b-0x0;var _0x24483d=_0xecf3[_0x1e949b];return _0x24483d;};'use strict';var BPromise=require(_0x3ecf('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3ecf('0x1'));var crypto=require(_0x3ecf('0x2'));var logger=require(_0x3ecf('0x3'))(_0x3ecf('0x4'));module[_0x3ecf('0x5')]=function(_0x6a19f7,_0x35f793,_0x31a1d8,_0x168da4){return new BPromise(function(_0x16f079,_0x127779){logger['info'](_0x3ecf('0x6'),_0x168da4||_0x3ecf('0x7'));var _0x218ced=new WebSocket(_0x168da4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x44b4c6='';var _0xc120d0='0';var _0x3597b0='1';var _0x3b4191=_0x3ecf('0x8');function _0x450891(_0x49669b){var _0x157248=crypto[_0x3ecf('0x9')](_0x3ecf('0xa'));_0x157248[_0x3ecf('0xb')](_0x49669b);return _0x157248[_0x3ecf('0xc')](_0x3ecf('0xd'));}function _0x8d120f(){try{logger['info'](_0x3ecf('0xe'));var _0x2482be=moment()[_0x3ecf('0xf')]();var _0xf7782c=_0x450891(_0x2482be+_0x35f793+_0x31a1d8);_0x218ced[_0x3ecf('0x10')](JSON[_0x3ecf('0x11')]({'appID':_0x35f793,'timestamp':_0x2482be,'appKey':_0xf7782c}));var _0x53c04a=fs[_0x3ecf('0x12')](_0x6a19f7);_0x53c04a['on'](_0x3ecf('0x13'),function(_0x138477){_0x218ced[_0x3ecf('0x10')](_0x138477);});_0x53c04a['on'](_0x3ecf('0x14'),function(){_0x218ced[_0x3ecf('0x10')](_0x3ecf('0x15'));});}catch(_0x101aba){logger[_0x3ecf('0x16')](_0x3ecf('0x17'),JSON[_0x3ecf('0x11')](_0x101aba));_0x218ced['terminate']();}}function _0xd438fb(_0x7b18ef){try{if(_0x7b18ef){var _0x3aa746=JSON[_0x3ecf('0x18')](_0x7b18ef);switch(_0x3aa746[_0x3ecf('0x19')]){case 0x0:if(_0x3aa746['result']){if(_0x3aa746[_0x3ecf('0x1a')][_0x3ecf('0x1b')]){logger[_0x3ecf('0x1c')](_0x3ecf('0x1d'),JSON[_0x3ecf('0x11')](_0x3aa746[_0x3ecf('0x1a')][_0x3ecf('0x1e')]));_0x44b4c6=_0x3aa746[_0x3ecf('0x1a')][_0x3ecf('0x1e')][0x0][_0x3ecf('0x1f')];_0xc120d0=_0x3aa746[_0x3ecf('0x1a')][_0x3ecf('0x1e')][0x0][_0x3ecf('0x20')];_0x3597b0='0';_0x3b4191=_0x3ecf('0x21');_0x218ced['terminate']();}}break;case 0x1:logger['info'](_0x3ecf('0x8'));_0x3597b0='1';_0x3b4191=_0x3ecf('0x8');break;case 0x2:logger[_0x3ecf('0x1c')](_0x3ecf('0x22'));_0x3597b0='2';_0x3b4191=_0x3ecf('0x22');break;case 0x9:logger[_0x3ecf('0x1c')](_0x3ecf('0x23'));_0x3597b0='9';_0x3b4191=_0x3ecf('0x23');break;case 0xa:logger[_0x3ecf('0x1c')]('Authentication\x20failed.');_0x3597b0='10';_0x3b4191='Authentication\x20failed.';break;case 0xb:logger[_0x3ecf('0x1c')](_0x3ecf('0x24'));_0x3597b0='11';_0x3b4191=_0x3ecf('0x24');}}}catch(_0x4b804d){logger[_0x3ecf('0x16')](_0x3ecf('0x25'),JSON[_0x3ecf('0x11')](_0x4b804d));_0x218ced['terminate']();}}function _0x4b3e69(){logger[_0x3ecf('0x1c')]('Close\x20Tilde\x20ASR\x20socket');_0x16f079({'transcript':_0x44b4c6,'confidence':_0xc120d0,'status':_0x3597b0,'status_message':_0x3b4191});}function _0x2520da(_0x19722a){logger['error'](_0x3ecf('0x26'));if(!_['isNil'](_0x19722a)){logger[_0x3ecf('0x16')](_[_0x3ecf('0x27')](_0x19722a)?JSON[_0x3ecf('0x11')](_0x19722a):_0x19722a);}}_0x218ced['on'](_0x3ecf('0x28'),_0x8d120f);_0x218ced['on'](_0x3ecf('0x29'),_0xd438fb);_0x218ced['on'](_0x3ecf('0x14'),_0x4b3e69);_0x218ced['on'](_0x3ecf('0x16'),_0x2520da);});}; \ 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 ac66daa..b48aa35 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 _0x3c0d=['exports'];(function(_0x2067e8,_0x466b5b){var _0x790798=function(_0x1bc0d6){while(--_0x1bc0d6){_0x2067e8['push'](_0x2067e8['shift']());}};_0x790798(++_0x466b5b);}(_0x3c0d,0x96));var _0xd3c0=function(_0x230343,_0x241481){_0x230343=_0x230343-0x0;var _0x2fbd01=_0x3c0d[_0x230343];return _0x2fbd01;};var asr=require('./asr');module[_0xd3c0('0x0')]={'asr':asr}; \ No newline at end of file +var _0xd83b=['exports'];(function(_0x1c5a48,_0x3e9491){var _0x483e37=function(_0x1efc3f){while(--_0x1efc3f){_0x1c5a48['push'](_0x1c5a48['shift']());}};_0x483e37(++_0x3e9491);}(_0xd83b,0xac));var _0xbd83=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0xd83b[_0x324e86];return _0x592846;};var asr=require('./asr');module[_0xbd83('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 3780022..4178355 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0xe706,0xa3));var _0x6e70=function(_0x4b89d9,_0x3a4a59){_0x4b89d9=_0x4b89d9-0x0;var _0x5648ac=_0xe706[_0x4b89d9];return _0x5648ac;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0xe706,0xa3));var _0x6e70=function(_0x1903aa,_0x343458){_0x1903aa=_0x1903aa-0x0;var _0x51fe28=_0xe706[_0x1903aa];return _0x51fe28;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 7ae6698..ceb2650 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 _0x32ef=['LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','toUpperCase','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','getdigits','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','XMCS-QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','answer','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','%s/sounds/converted/%s','getQueryOdbc','open','error','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','isNil','callback_','random','isEmpty','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','shellCommand','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','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','uri','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','key','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','isPlainObject','isArray','recursiveNodeIndex','isString','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','exec','MRCPRecog','result','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','delay','minutes','phone','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x32ef,0xf9));var _0xf32e=function(_0x30c65e,_0x15a2a0){_0x30c65e=_0x30c65e-0x0;var _0x47cb36=_0x32ef[_0x30c65e];return _0x47cb36;};'use strict';var fs=require('fs');var util=require(_0xf32e('0x0'));var _=require(_0xf32e('0x1'));var sh=require(_0xf32e('0x2'));var odbc=require(_0xf32e('0x3'))();var rs=require(_0xf32e('0x4'));var moment=require(_0xf32e('0x5'));var Mustache=require('mustache');var rp=require(_0xf32e('0x6'));var logger=require(_0xf32e('0x7'))('agi');var config=require(_0xf32e('0x8'));var scripts=require(_0xf32e('0x9'));var FILES_PATH=_0xf32e('0xa');var recursiveMapAttributes=[_0xf32e('0xb'),_0xf32e('0xc')];var verticesWithRetry=[_0xf32e('0xd'),'getdigits',_0xf32e('0xe')];var AGIVertices=function(_0x5b3463,_0x384f27,_0x18a947){this[_0xf32e('0xf')]=_0x5b3463;this[_0xf32e('0x10')]=_0x384f27;this[_0xf32e('0x11')]=_0x18a947;};AGIVertices['prototype'][_0xf32e('0x12')]=function(_0x111794,_0x468a6d){this[_0xf32e('0x10')][_0xf32e('0x13')](_0x111794)[_0xf32e('0x14')](function(_0x591580){_0x468a6d(null,_0x591580?_0x591580[_0xf32e('0x15')]:![]);})[_0xf32e('0x16')](function(_0x1c1f52){_0x468a6d(_0x1c1f52);});};AGIVertices[_0xf32e('0x17')]['getVoiceQueue']=function(_0x3c21ad,_0x16a7ce){this[_0xf32e('0x10')][_0xf32e('0x18')](_0x3c21ad)[_0xf32e('0x14')](function(_0x458002){_0x16a7ce(null,_0x458002?_0x458002['name']:![]);})[_0xf32e('0x16')](function(_0x299efa){_0x16a7ce(_0x299efa);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x19')]=function(_0x43eedf,_0x417def){this[_0xf32e('0x10')][_0xf32e('0x1a')](_0x43eedf)[_0xf32e('0x14')](function(_0x4caac5){_0x417def(null,_0x4caac5?_0x4caac5[_0xf32e('0x15')]:![]);})[_0xf32e('0x16')](function(_0xb828b8){_0x417def(_0xb828b8);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x1b')]=function(_0x1f7a5e,_0x2f909b){this[_0xf32e('0x10')][_0xf32e('0x1c')](_0x1f7a5e)[_0xf32e('0x14')](function(_0x1dda77){_0x2f909b(null,_0x1dda77?_0x1dda77[_0xf32e('0x1d')]:![]);})[_0xf32e('0x16')](function(_0x3c0d43){_0x2f909b(_0x3c0d43);});};AGIVertices[_0xf32e('0x17')]['getUser']=function(_0x23552d,_0x57a8cb){this[_0xf32e('0x10')][_0xf32e('0x1e')](_0x23552d)[_0xf32e('0x14')](function(_0x4195a4){_0x57a8cb(null,_0x4195a4?_0x4195a4[_0xf32e('0x15')]:![]);})['catch'](function(_0x227405){_0x57a8cb(_0x227405);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x1f')]=function(_0x2ad1a3,_0x5e62eb){this[_0xf32e('0x10')][_0xf32e('0x20')](_0x2ad1a3)[_0xf32e('0x14')](function(_0xe0a285){_0x5e62eb(null,_0xe0a285?_0xe0a285[_0xf32e('0x15')]:![]);})[_0xf32e('0x16')](function(_0x2f925b){_0x5e62eb(_0x2f925b);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x21')]=function(_0x29be62,_0x488489){var _0x3e6e6f=this;this[_0xf32e('0x10')][_0xf32e('0x22')](_0x29be62)['then'](function(_0x419d13){_0x488489(null,_0x419d13?_0x3e6e6f['getSoundPath'](_0x419d13[_0xf32e('0x23')]):![]);})['catch'](function(_0x439143){_0x488489(_0x439143);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x24')]=function(_0xf42594,_0x32a74b){this['rpc'][_0xf32e('0x25')](_0xf42594)[_0xf32e('0x14')](function(_0x175096){_0x32a74b(null,_0x175096?_0x175096:![]);})['catch'](function(_0x2fa18d){_0x32a74b(_0x2fa18d);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x26')]=function(_0x3b87d3,_0x3e0c1e,_0x3f4362){this[_0xf32e('0x11')][_0xf32e('0x26')](_0x3b87d3,_0x3e0c1e)[_0xf32e('0x14')](function(){_0x3f4362(null);})[_0xf32e('0x16')](function(_0x177727){_0x3f4362(_0x177727);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x27')]=function(_0x5c04ae,_0x7b643e){this['rpc'][_0xf32e('0x28')](_0x5c04ae)['then'](function(_0x565552){if(_0x565552){if(_0x565552[_0xf32e('0x29')]){_0x7b643e(null,[_0x565552[_0xf32e('0x2a')]]);}else{_0x7b643e(null,_[_0xf32e('0x2b')](_0x565552[_0xf32e('0x2c')],_0xf32e('0x2a')));}}else{_0x7b643e(null,![]);}})['catch'](function(_0x4432de){_0x7b643e(_0x4432de);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x2d')]=function(_0xc9b274){return util['format'](_0xf32e('0x2e'),FILES_PATH,_0xc9b274);};AGIVertices[_0xf32e('0x17')][_0xf32e('0x2f')]=function(_0x2afe86,_0xbefb6d,_0x576f37){odbc[_0xf32e('0x30')](_0x2afe86,function(_0x6d2794){if(_0x6d2794){logger[_0xf32e('0x31')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x6d2794);_0x576f37(_0x6d2794);}else{logger[_0xf32e('0x32')]('ODBC\x20connection\x20successfully');odbc[_0xf32e('0x33')](_0xbefb6d,function(_0x113b11,_0x1566d9){if(_0x113b11){logger['info'](_0xf32e('0x34'),_0xbefb6d);_0x576f37(_0x113b11);}else{logger[_0xf32e('0x32')](_0xf32e('0x35'),_0xbefb6d);odbc[_0xf32e('0x36')](function(_0x25e0b4){if(_0x25e0b4){logger[_0xf32e('0x31')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x25e0b4);}_0x576f37(null,_0x1566d9);});}});}});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x37')]=function(_0x477a98,_0x1f258b){this[_0xf32e('0x10')][_0xf32e('0x38')](_0x477a98)[_0xf32e('0x14')](function(_0x56bf88){_0x1f258b(null,_0x56bf88?_0x56bf88:![]);})[_0xf32e('0x16')](function(_0x160a30){_0x1f258b(_0x160a30);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x39')]=function(_0x1576a1,_0x45c026){this[_0xf32e('0x10')]['createSmsMessage'](_0x1576a1)[_0xf32e('0x14')](function(_0x43882c){_0x45c026(null,_0x43882c);})[_0xf32e('0x16')](function(_0x1ad978){_0x45c026(_0x1ad978);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x3a')]=function(_0x1bff7b,_0x3ce422,_0x3d2536){this[_0xf32e('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0xf32e('0xf')][_0xf32e('0x3b')],'node':_0x1bff7b[_0xf32e('0x3c')],'application':_0x1bff7b[_0xf32e('0x3d')],'data':_0x3ce422||null,'project_name':this[_0xf32e('0xf')][_0xf32e('0x3e')],'callerid':this['channel'][_0xf32e('0x3f')]})[_0xf32e('0x14')](function(_0x2b87be){if(_0x3d2536){_0x3d2536(null,_0x2b87be);}})[_0xf32e('0x16')](function(_0x3cbb85){if(_0x3d2536){_0x3d2536(_0x3cbb85);}});};AGIVertices['prototype'][_0xf32e('0x40')]=function(_0x568e6e,_0xd81744,_0x1f236d,_0x48ba02){this[_0xf32e('0x10')]['createSquareRecording']({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xf32e('0xf')][_0xf32e('0x3f')],'calleridname':this[_0xf32e('0xf')][_0xf32e('0x41')],'context':this[_0xf32e('0xf')][_0xf32e('0x42')],'extension':this[_0xf32e('0xf')][_0xf32e('0x43')],'priority':this[_0xf32e('0xf')][_0xf32e('0x44')],'accountcode':this[_0xf32e('0xf')][_0xf32e('0x45')],'dnid':this[_0xf32e('0xf')][_0xf32e('0x46')],'projectName':this['channel'][_0xf32e('0x3e')],'saveName':_0xd81744,'filename':_0x568e6e[_0xf32e('0x47')]||_0xd81744,'savePath':_0x1f236d})[_0xf32e('0x14')](function(_0x4b15be){_0x48ba02(null,_0x4b15be);})['catch'](function(_0x49e5a1){_0x48ba02(_0x49e5a1);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x48')]=function(_0x5194e8,_0x436b8a,_0x16a69b,_0x50d492,_0x5b1841){this[_0xf32e('0x10')][_0xf32e('0x48')]({'uniqueid':this[_0xf32e('0xf')][_0xf32e('0x3b')],'body':_0x5194e8,'direction':_0x436b8a,'providerName':_0x16a69b,'providerResponse':_0x50d492})[_0xf32e('0x14')](function(_0x5ec996){if(_0x5b1841){_0x5b1841(null,_0x5ec996);}})[_0xf32e('0x16')](function(_0xcd2fc2){if(_0x5b1841){_0x5b1841(_0xcd2fc2);}});};AGIVertices[_0xf32e('0x17')]['createCmContact']=function(_0x15017b,_0xfd3f05){this[_0xf32e('0x10')]['createCmContact']({'firstName':_['isEmpty'](_0x15017b['name'])||_[_0xf32e('0x49')](_0x15017b[_0xf32e('0x15')])?_0xf32e('0x4a')+Math[_0xf32e('0x4b')]():_0x15017b['name'],'lastName':_[_0xf32e('0x4c')](_0x15017b[_0xf32e('0x4d')])||_[_0xf32e('0x49')](_0x15017b[_0xf32e('0x4d')])?null:_0x15017b[_0xf32e('0x4d')],'phone':_0x15017b['phone'],'ListId':_0x15017b[_0xf32e('0x4e')],'scheduledat':_0x15017b[_0xf32e('0x4f')],'callbackUniqueid':this[_0xf32e('0xf')][_0xf32e('0x3b')],'tags':'callback','description':_0xf32e('0x50')+_0x15017b['scheduledAt']['toString'](),'priority':_0x15017b[_0xf32e('0x51')]})[_0xf32e('0x14')](function(_0x1a485b){_0xfd3f05(null,_0x1a485b);})[_0xf32e('0x16')](function(_0x1d58fa){_0xfd3f05(_0x1d58fa);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x52')]=function(_0x25533f,_0x186c9d){this[_0xf32e('0x10')][_0xf32e('0x53')](_0x25533f)[_0xf32e('0x14')](function(_0x51224f){_0x186c9d(null,_0x51224f?_0x51224f[_0xf32e('0x15')]:![]);})['catch'](function(_0x3ae9df){_0x186c9d(_0x3ae9df);});};AGIVertices['prototype'][_0xf32e('0x54')]=function(_0x2b179e,_0xff3522,_0x576e08){var _0x103a11={'role':_0xf32e('0x55')};_0x103a11[_0x2b179e]=this['channel']['callerid'];this['rpc'][_0xf32e('0x54')](_0x103a11,_0xff3522,this[_0xf32e('0xf')][_0xf32e('0x3b')])[_0xf32e('0x14')](function(_0xef37e5){_0x576e08(null,_[_0xf32e('0x49')](_0xef37e5)?![]:!![]);})['catch'](function(_0x2c558e){logger['error'](_0x2c558e);_0x576e08(null,![]);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x56')]=function(_0x1978a4,_0x5018a7){var _0x5e3963={'role':_0xf32e('0x55')};_0x5e3963[_0x1978a4]=this[_0xf32e('0xf')]['callerid'];this[_0xf32e('0x10')]['agentUnpause'](_0x5e3963)[_0xf32e('0x14')](function(_0x3b1b99){_0x5018a7(null,_[_0xf32e('0x49')](_0x3b1b99)?![]:!![]);})[_0xf32e('0x16')](function(_0xeceb76){logger['error'](_0xeceb76);_0x5018a7(null,![]);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x57')]=function(_0x107f96,_0x30bdbe){var _0x4c035a={'role':_0xf32e('0x55')};_0x4c035a[_0x107f96]=this[_0xf32e('0xf')][_0xf32e('0x3f')];this['rpc'][_0xf32e('0x57')](_0x4c035a)['then'](function(_0x419ec1){_0x30bdbe(null,_[_0xf32e('0x49')](_0x419ec1)?![]:!![]);})[_0xf32e('0x16')](function(_0x20adaa){logger[_0xf32e('0x31')](_0x20adaa);_0x30bdbe(null,![]);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x58')]=function(_0x1da28c,_0x54832b){var _0x164edf={'role':_0xf32e('0x55')};_0x164edf[_0x1da28c]=this['channel'][_0xf32e('0x3f')];var _0x42cb2a=_0x1da28c!=_0xf32e('0x59')?util[_0xf32e('0x5a')]('%s/%s@from-sip/n','LOCAL',this['channel']['callerid']):undefined;this[_0xf32e('0x10')][_0xf32e('0x58')](_0x164edf,_0x42cb2a)[_0xf32e('0x14')](function(_0x356741){_0x54832b(null,_[_0xf32e('0x49')](_0x356741)?![]:!![]);})[_0xf32e('0x16')](function(_0x5a91ba){logger[_0xf32e('0x31')](_0x5a91ba);_0x54832b(null,![]);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x5b')]=function(_0x4b0234,_0x4d3c2e){sh['exec'](_['trim'](_0x4b0234),function(_0x40fdfc,_0x144ff8){var _0x39c215=_0x144ff8[_0xf32e('0x5c')](/(\r\n|\n|\r)/gm,'');_0x4d3c2e(null,_0x39c215);});};AGIVertices['prototype'][_0xf32e('0x5d')]=function(_0x24ca20,_0x30fbbd){scripts[_0xf32e('0x5d')](_0x24ca20['apiKey'],_0x24ca20[_0xf32e('0x5e')]||_0xf32e('0x5f'),_0x24ca20[_0xf32e('0x5f')],_0x24ca20[_0xf32e('0x60')]||_0xf32e('0x61'),_0x24ca20[_0xf32e('0x62')]||_0xf32e('0x63'),_0x24ca20['audioEncoding']||'MP3')[_0xf32e('0x14')](function(_0x2a1713){_0x30fbbd(null,_0x2a1713);})[_0xf32e('0x16')](function(_0x3b4c24){_0x30fbbd(_0x3b4c24);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x64')]=function(_0x3c2066,_0x509b9f){scripts[_0xf32e('0x64')](_0x3c2066[_0xf32e('0x5f')],_0x3c2066[_0xf32e('0x65')]||'en',0x1)[_0xf32e('0x14')](function(_0x53e610){_0x509b9f(null,_0x53e610);})[_0xf32e('0x16')](function(_0x14e9a4){_0x509b9f(_0x14e9a4);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x66')]=function(_0x5b1423,_0x39bed2){var _0x37b93b={'uri':_0x5b1423[_0xf32e('0x67')],'method':_0x5b1423[_0xf32e('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5b1423[_0xf32e('0x69')])===_0xf32e('0x6a')&&parseInt(_0x5b1423[_0xf32e('0x69')])>=0x1?parseInt(_0x5b1423['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xf32e('0x6b')]([_0xf32e('0x6c'),_0xf32e('0x6d')],_0x37b93b[_0xf32e('0x68')]['toUpperCase']())){try{_0x37b93b[_0xf32e('0x6e')]=_0x5b1423['rawBody']?JSON[_0xf32e('0x6f')](_0x5b1423[_0xf32e('0xc')]):{};}catch(_0x25052c){logger[_0xf32e('0x31')](_0xf32e('0x70'),_0x25052c);}}try{_0x37b93b[_0xf32e('0x71')]=_0x5b1423[_0xf32e('0xb')]?JSON['parse'](_0x5b1423[_0xf32e('0xb')]):{};}catch(_0x53250f){logger[_0xf32e('0x31')](_0xf32e('0x72'),_0x53250f);}if(_0x5b1423[_0xf32e('0x73')]){try{var _0x439fde=require(_0x5b1423[_0xf32e('0x73')])[_0xf32e('0x74')](this,_0x37b93b);_0x37b93b[_0xf32e('0x75')]=Mustache[_0xf32e('0x76')](_0x5b1423[_0xf32e('0x67')],_0x439fde,{},['$$','$$']);if(_0x37b93b['headers']){_0x37b93b['headers']=JSON['parse'](Mustache['render'](JSON[_0xf32e('0x77')](_0x37b93b[_0xf32e('0x71')]),_0x439fde,{},['$$','$$']));}if(_0x37b93b[_0xf32e('0x6e')]){_0x37b93b['body']=JSON[_0xf32e('0x6f')](Mustache[_0xf32e('0x76')](JSON[_0xf32e('0x77')](_0x37b93b[_0xf32e('0x6e')]),_0x439fde,{},['$$','$$']));}}catch(_0x39dd31){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x39dd31);}}rp(_0x37b93b)[_0xf32e('0x14')](function(_0xee8286){var _0x21455d={'statusCode':_0xee8286[_0xf32e('0x78')]||0xc8,'statusMessage':_0xee8286['statusMessage']||'OK','headers':_0xee8286[_0xf32e('0x71')]||{},'body':_0xee8286['body']||{}};_0x39bed2(null,_0x21455d);})[_0xf32e('0x16')](function(_0x5eb773){var _0x38f77c={'statusCode':_0x5eb773[_0xf32e('0x78')]||0x1f4,'statusMessage':_0x5eb773[_0xf32e('0x79')]||_0xf32e('0x7a'),'headers':_0x5eb773[_0xf32e('0x7b')][_0xf32e('0x71')]||{},'body':_0x5eb773[_0xf32e('0x7b')]['body']||{}};_0x39bed2(null,_0x38f77c);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x7c')]=function(_0x4ea87a,_0x2e58c6){scripts[_0xf32e('0x7c')](this[_0xf32e('0xf')][_0xf32e('0x3b')],_0x4ea87a['key'],_0x4ea87a['text'],_0x4ea87a[_0xf32e('0x7d')]||'en')[_0xf32e('0x14')](function(_0x16369f){_0x2e58c6(null,_0x16369f);})[_0xf32e('0x16')](function(_0x2c5abe){_0x2e58c6(_0x2c5abe);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x7e')]=function(_0x5c0c0b,_0x2f517d){scripts[_0xf32e('0x7e')](this[_0xf32e('0xf')]['uniqueid'],_0x5c0c0b[_0xf32e('0x7f')],_0x5c0c0b['client_email'],_0x5c0c0b['private_key'],_0x5c0c0b[_0xf32e('0x5f')],_0x5c0c0b[_0xf32e('0x80')]||'en')[_0xf32e('0x14')](function(_0x279a60){_0x2f517d(null,_0x279a60);})[_0xf32e('0x16')](function(_0x36fa23){_0x2f517d(_0x36fa23);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x81')]=function(_0x28467f,_0x17bbc9){scripts[_0xf32e('0x81')](this[_0xf32e('0xf')],_0x28467f)['then'](function(_0x1edc70){_0x17bbc9(null,_0x1edc70);})[_0xf32e('0x16')](function(_0x35f8e3){_0x17bbc9(_0x35f8e3);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x82')]=function(_0x2da912,_0x855a5){scripts[_0xf32e('0x82')](_0x2da912['key'],_0x2da912[_0xf32e('0x5f')],_0x2da912[_0xf32e('0x83')]||_0xf32e('0x61'),_0x2da912[_0xf32e('0x84')])['then'](function(_0x241ec7){_0x855a5(null,_0x241ec7);})[_0xf32e('0x16')](function(_0x119924){_0x855a5(_0x119924);});};AGIVertices[_0xf32e('0x17')]['ispeechASR']=function(_0x4f2fcc,_0xbc7cec,_0x3a2c5c){scripts[_0xf32e('0x85')](_0xbc7cec,_0x4f2fcc[_0xf32e('0x86')],_0x4f2fcc['ispeech_asr_language']||'en-US',this[_0xf32e('0x87')](_0x4f2fcc['model'])?_0x4f2fcc[_0xf32e('0x88')]:undefined)['then'](function(_0x4ce025){_0x3a2c5c(null,_0x4ce025);})[_0xf32e('0x16')](function(_0x5c07d1){_0x3a2c5c(_0x5c07d1);});};AGIVertices['prototype'][_0xf32e('0x89')]=function(_0x52ad4e,_0x13e051){scripts['awsPolly'](_0x52ad4e[_0xf32e('0x8a')],_0x52ad4e['aws_secret_access_key'],_0x52ad4e[_0xf32e('0x8b')],_0x52ad4e[_0xf32e('0x8c')]||_0xf32e('0x8d'),_0x52ad4e[_0xf32e('0x5f')],_0x52ad4e[_0xf32e('0x8e')]||_0xf32e('0x5f'))[_0xf32e('0x14')](function(_0x4e60e4){_0x13e051(null,_0x4e60e4);})[_0xf32e('0x16')](function(_0x41949f){_0x13e051(_0x41949f);});};AGIVertices['prototype'][_0xf32e('0x8f')]=function(_0x5b3a17,_0x9ea422){scripts[_0xf32e('0x8f')](this[_0xf32e('0xf')][_0xf32e('0x3b')],_0x5b3a17['aws_access_key_id'],_0x5b3a17['aws_secret_access_key'],_0x5b3a17[_0xf32e('0x90')],_0x5b3a17[_0xf32e('0x5f')],_0x5b3a17[_0xf32e('0x91')])['then'](function(_0x1e1e02){_0x9ea422(null,_0x1e1e02);})[_0xf32e('0x16')](function(_0x1bc96d){_0x9ea422(_0x1bc96d);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x92')]=function(_0x5bf533,_0x2414c1,_0x33d7c3){scripts[_0xf32e('0x92')](_0x2414c1,_0x5bf533[_0xf32e('0x86')],_0x5bf533[_0xf32e('0x93')]||_0xf32e('0x61'))[_0xf32e('0x14')](function(_0x1a618a){_0x33d7c3(null,_0x1a618a);})[_0xf32e('0x16')](function(_0x2a00bd){_0x33d7c3(_0x2a00bd);});};AGIVertices[_0xf32e('0x17')][_0xf32e('0x94')]=function(_0x4e186c,_0x1491c0,_0x5b1a1e){scripts[_0xf32e('0x94')](_0x1491c0,_0x4e186c[_0xf32e('0x95')],_0x4e186c[_0xf32e('0x96')],_0x4e186c[_0xf32e('0x75')])[_0xf32e('0x14')](function(_0x3e78f8){_0x5b1a1e(null,_0x3e78f8);})[_0xf32e('0x16')](function(_0xf42ca7){_0x5b1a1e(_0xf42ca7);});};AGIVertices[_0xf32e('0x17')]['clear']=function(_0x491dfe){var _0x329e69=_[_0xf32e('0x6b')](verticesWithRetry,_0x491dfe[_0xf32e('0x3d')])?_0x491dfe:_[_0xf32e('0x97')](_0x491dfe);for(var _0x3fa4fd in _0x329e69){if(_0x329e69[_0xf32e('0x98')](_0x3fa4fd)){if(_0x329e69[_0x3fa4fd]&&_['isString'](_0x329e69[_0x3fa4fd])){if(_[_0xf32e('0x6b')](recursiveMapAttributes,_0x3fa4fd)){_0x329e69[_0x3fa4fd]=this[_0xf32e('0x99')](_0x329e69[_0x3fa4fd]);}else{_0x329e69[_0x3fa4fd]=this[_0xf32e('0x9a')](_0x329e69[_0x3fa4fd]);}}}}return _0x329e69;};AGIVertices[_0xf32e('0x17')]['recursiveNodeIndex']=function(_0x2eaaf3){for(var _0x57b789 in _0x2eaaf3){if(_0x2eaaf3[_0xf32e('0x98')](_0x57b789)){if(_[_0xf32e('0x9b')](_0x2eaaf3[_0x57b789])){this['recursiveNodeIndex'](_0x2eaaf3[_0x57b789]);}else if(_[_0xf32e('0x9c')](_0x2eaaf3[_0x57b789])){for(var _0x26a851=0x0;_0x26a851<_0x2eaaf3[_0x57b789]['length'];_0x26a851++){this[_0xf32e('0x9d')](_0x2eaaf3[_0x57b789][_0x26a851]);}}else if(_[_0xf32e('0x9e')](_0x2eaaf3[_0x57b789])){_0x2eaaf3[_0x57b789]=this['replaceAllVariables'](_0x2eaaf3[_0x57b789]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x421a36,_0x16b410){for(var _0x22aa71 in _0x421a36){if(_0x421a36[_0xf32e('0x98')](_0x22aa71)){if(_[_0xf32e('0x9b')](_0x421a36[_0x22aa71])){if(!_[_0xf32e('0x4c')](_0x421a36[_0x22aa71])){this['saveRestApiResult'](_0x421a36[_0x22aa71],util['format']('%s.%s',_0x16b410,_0x22aa71));}}else if(_[_0xf32e('0x9c')](_0x421a36[_0x22aa71])){for(var _0x41f091=0x0;_0x41f091<_0x421a36[_0x22aa71][_0xf32e('0x9f')];_0x41f091++){this[_0xf32e('0xa0')](_0x421a36[_0x22aa71][_0x41f091],util['format'](_0xf32e('0xa1'),_0x16b410,_0x22aa71+'['+_0x41f091+']'));}}else{if(!_[_0xf32e('0x49')](_0x421a36[_0x22aa71])){this[_0xf32e('0xf')][_0xf32e('0xa2')](util[_0xf32e('0x5a')](_0xf32e('0xa1'),_0x16b410,_0x22aa71),_0x421a36[_0x22aa71]);}}}}};AGIVertices[_0xf32e('0x17')][_0xf32e('0x99')]=function(_0x11d4d6){try{var _0x476b01=JSON[_0xf32e('0x6f')](_0x11d4d6);this[_0xf32e('0x9d')](_0x476b01);return JSON[_0xf32e('0x77')](_0x476b01);}catch(_0x495e82){return this[_0xf32e('0x9a')](_0x11d4d6);}};AGIVertices[_0xf32e('0x17')]['replaceAllVariables']=function(_0x48353a){var _0x423601=_0x48353a['split']('{');for(var _0x102eb7=0x1;_0x102eb7<_0x423601[_0xf32e('0x9f')];_0x102eb7+=0x1){var _0x5f2973=_0x423601[_0x102eb7][_0xf32e('0xa3')]('}');if(_0x5f2973[_0xf32e('0x9f')]>0x1){_0x48353a=_0x48353a[_0xf32e('0xa4')]('{'+_0x5f2973[0x0]+'}',this[_0xf32e('0xf')]['getVariable'](_0x5f2973[0x0])[_0xf32e('0xa5')]||_0x5f2973[0x0]);}}if(_0x423601['length']===0x1){return _0x48353a[_0xf32e('0xa6')]();}return this[_0xf32e('0x9a')](_0x48353a);};AGIVertices[_0xf32e('0x17')][_0xf32e('0xa7')]=function(_0xa1b345,_0x121683){var _0x368ba0=this[_0xf32e('0xf')][_0xf32e('0x12')](_0xa1b345);if(_0x368ba0['result']===-0x1){return _0x368ba0;}logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0xa8'),_0x121683,_0x368ba0[_0xf32e('0xa5')]));return this[_0xf32e('0xf')][_0xf32e('0xa2')](_0x121683,_0x368ba0[_0xf32e('0xa5')]);};AGIVertices[_0xf32e('0x17')][_0xf32e('0x87')]=function(_0x52c806){return _0x52c806&&_0x52c806!=='0'&&_0x52c806!=='-1'&&_0x52c806!=='';};AGIVertices[_0xf32e('0x17')][_0xf32e('0xa9')]=function(_0x8fa484){this[_0xf32e('0x3a')][_0xf32e('0x74')](this,_0x8fa484,'-');_0x8fa484[_0xf32e('0xaa')]=_0x8fa484['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xf32e('0x17')][_0xf32e('0xab')]=function(_0x44922d){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0xac'),_0x44922d['label']));if(!this['isConfigured'](_0x44922d[_0xf32e('0x5f')])){return this['channel'][_0xf32e('0xad')](_0xf32e('0xae'));}var _0x4ef2e3='\x22'+_0x44922d[_0xf32e('0x5f')]+'\x22';if(this['isConfigured'](_0x44922d['options'])){_0x4ef2e3+=','+_0x44922d[_0xf32e('0x7b')];}var _0x3b600a=this[_0xf32e('0xf')]['exec'](_0xf32e('0xaf'),_0x4ef2e3);if(_0x3b600a['result']===-0x1){return _0x3b600a;}return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0xb0'),_0x4ef2e3));};AGIVertices['prototype'][_0xf32e('0xb1')]=function(_0x18b538){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0xb2'),_0x18b538['label']));if(!this['isConfigured'](_0x18b538[_0xf32e('0xb3')])){return this[_0xf32e('0xf')][_0xf32e('0xad')]('no\x20grammar\x20configured');}var _0x4e2a0a=_0x18b538[_0xf32e('0xb3')];if(this[_0xf32e('0x87')](_0x18b538[_0xf32e('0x7b')])){_0x4e2a0a+=','+_0x18b538[_0xf32e('0x7b')];}var _0x5cf29a=this[_0xf32e('0xf')][_0xf32e('0xb4')](_0xf32e('0xb5'),_0x4e2a0a);if(_0x5cf29a[_0xf32e('0xb6')]===-0x1){return _0x5cf29a;}var _0x8f713b=this[_0xf32e('0xa7')](_0xf32e('0xb7'),_0xf32e('0xb8'));if(_0x8f713b['result']===-0x1){return _0x8f713b;}var _0x3f7814=this[_0xf32e('0xa7')](_0xf32e('0xb9'),_0xf32e('0xba'));if(_0x3f7814[_0xf32e('0xb6')]===-0x1){return _0x3f7814;}var _0x312916=this[_0xf32e('0xa7')](_0xf32e('0xbb'),_0xf32e('0xbc'));if(_0x312916[_0xf32e('0xb6')]===-0x1){return _0x312916;}return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0xbd'),_0x4e2a0a));};AGIVertices['prototype'][_0xf32e('0xbe')]=function(_0xc00b17){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0xbf'),_0xc00b17[_0xf32e('0x3c')]));return this['channel'][_0xf32e('0xbe')]([_0xc00b17[_0xf32e('0xc0')],_0xc00b17[_0xf32e('0xc1')]]);};AGIVertices['prototype']['answer']=function(_0x2bc69a){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0xc2'),_0x2bc69a['label']));if(this['isConfigured'](_0x2bc69a[_0xf32e('0x69')])){logger[_0xf32e('0x32')](util['format'](_0xf32e('0xc3'),_0x2bc69a[_0xf32e('0x69')]));var _0x4f44c5=this[_0xf32e('0xf')][_0xf32e('0xc4')](_0x2bc69a[_0xf32e('0x69')]);if(_0x4f44c5[_0xf32e('0xb6')]===-0x1){return _0x4f44c5;}}return this['channel']['answer']();};AGIVertices['prototype'][_0xf32e('0xc5')]=function(_0x3e40cc){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0xc6'),_0x3e40cc[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x3e40cc['list_id'])){return this['channel'][_0xf32e('0x31')](_0x3e40cc,'no\x20list\x20selected');}_0x3e40cc[_0xf32e('0x4f')]=moment();if(this[_0xf32e('0x87')](_0x3e40cc['delay'])){_0x3e40cc['scheduledAt']=moment()[_0xf32e('0xc7')](_0x3e40cc[_0xf32e('0xc8')],_0xf32e('0xc9'));}if(!this['isConfigured'](_0x3e40cc['callback_priority'])){_0x3e40cc[_0xf32e('0x51')]=0x2;}this['createCmContact']['sync'](this,_0x3e40cc);return this['channel']['noop'](util[_0xf32e('0x5a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x3e40cc[_0xf32e('0xca')],_0x3e40cc['list_id'],_0x3e40cc[_0xf32e('0x4f')]));};AGIVertices[_0xf32e('0x17')][_0xf32e('0xcb')]=function(_0x39dd8a){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x39dd8a[_0xf32e('0x3c')]));var _0x15a70e=this['channel'][_0xf32e('0xb4')](_0x39dd8a[_0xf32e('0xcc')],_0x39dd8a[_0xf32e('0x7b')]);if(_0x15a70e[_0xf32e('0xb6')]===-0x1){return _0x15a70e;}return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')]('Executed\x20command\x20%s\x20%s',_0x39dd8a['application'],_0x39dd8a[_0xf32e('0x7b')]));};AGIVertices[_0xf32e('0x17')][_0xf32e('0xcd')]=function(_0x18e6ce){logger[_0xf32e('0x32')](util['format'](_0xf32e('0xce'),_0x18e6ce[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x18e6ce['text'])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0xae'));}var _0x1b1241='\x22'+_0x18e6ce[_0xf32e('0x5f')]+'\x22';if(this[_0xf32e('0x87')](_0x18e6ce[_0xf32e('0x7b')])){_0x1b1241+=','+_0x18e6ce[_0xf32e('0x7b')];}var _0x26c4d6=this['channel'][_0xf32e('0xb4')]('MRCPSynth',_0x1b1241);if(_0x26c4d6[_0xf32e('0xb6')]===-0x1){return _0x26c4d6;}return this['channel']['noop'](util[_0xf32e('0x5a')](_0xf32e('0xb0'),_0x1b1241));};AGIVertices[_0xf32e('0x17')][_0xf32e('0xcf')]=function(_0x3c946b){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0xd0'),_0x3c946b[_0xf32e('0x3c')]));if(!this['isConfigured'](_0x3c946b[_0xf32e('0x5f')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0xae'));}var _0x24c40a='\x22'+_0x3c946b[_0xf32e('0x5f')]+'\x22';if(this[_0xf32e('0x87')](_0x3c946b['options'])){_0x24c40a+=','+_0x3c946b[_0xf32e('0x7b')];}var _0x4c1459=this['channel'][_0xf32e('0xb4')]('MRCPSynth',_0x24c40a);if(_0x4c1459['result']===-0x1){return _0x4c1459;}return this[_0xf32e('0xf')]['noop'](util[_0xf32e('0x5a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x24c40a));};AGIVertices[_0xf32e('0x17')][_0xf32e('0xd1')]=function(_0x176dc5){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0xd2'),_0x176dc5[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x176dc5[_0xf32e('0xb3')])){return this['channel']['noop'](_0xf32e('0xd3'));}var _0x502e9a=_0x176dc5[_0xf32e('0xb3')];if(this[_0xf32e('0x87')](_0x176dc5[_0xf32e('0x7b')])){_0x502e9a+=','+_0x176dc5[_0xf32e('0x7b')];}var _0x3c992b=this[_0xf32e('0xf')][_0xf32e('0xb4')](_0xf32e('0xb5'),_0x502e9a);if(_0x3c992b[_0xf32e('0xb6')]===-0x1){return _0x3c992b;}var _0x5ea87d=this['getAndSetVariable'](_0xf32e('0xb7'),_0xf32e('0xd4'));if(_0x5ea87d['result']===-0x1){return _0x5ea87d;}var _0x4071a9=this[_0xf32e('0xa7')](_0xf32e('0xb9'),_0xf32e('0xd5'));if(_0x4071a9['result']===-0x1){return _0x4071a9;}var _0x2ebeff=this[_0xf32e('0xa7')](_0xf32e('0xbb'),_0xf32e('0xd6'));if(_0x2ebeff[_0xf32e('0xb6')]===-0x1){return _0x2ebeff;}return this[_0xf32e('0xf')][_0xf32e('0xad')](util['format'](_0xf32e('0xbd'),_0x502e9a));};AGIVertices[_0xf32e('0x17')][_0xf32e('0xd7')]=function(_0x1f50e9){logger['info'](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1f50e9['label']));if(!this[_0xf32e('0x87')](_0x1f50e9[_0xf32e('0xb3')])){return this['channel'][_0xf32e('0xad')](_0xf32e('0xd3'));}var _0x378134=_0x1f50e9['grammar'];if(this['isConfigured'](_0x1f50e9[_0xf32e('0x7b')])){_0x378134+=','+_0x1f50e9['options'];}var _0x26f5d8=this[_0xf32e('0xf')][_0xf32e('0xb4')](_0xf32e('0xb5'),_0x378134);if(_0x26f5d8[_0xf32e('0xb6')]===-0x1){return _0x26f5d8;}var _0x18b9a6=this[_0xf32e('0xa7')]('RECOG_CONFIDENCE()',_0xf32e('0xd8'));if(_0x18b9a6['result']===-0x1){return _0x18b9a6;}var _0x57cfcc=this[_0xf32e('0xa7')](_0xf32e('0xb9'),'SESTEK_ASR_TRANSCRIPT');if(_0x57cfcc['result']===-0x1){return _0x57cfcc;}var _0x471bb4=this[_0xf32e('0xa7')](_0xf32e('0xbb'),_0xf32e('0xd9'));if(_0x471bb4[_0xf32e('0xb6')]===-0x1){return _0x471bb4;}return this[_0xf32e('0xf')]['noop'](util[_0xf32e('0x5a')](_0xf32e('0xbd'),_0x378134));};AGIVertices[_0xf32e('0x17')]['database']=function(_0x53fd38){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0xda'),_0x53fd38[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x53fd38[_0xf32e('0xdb')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x53fd38,_0xf32e('0xdc'));}var _0x15d5f2=this[_0xf32e('0x1b')][_0xf32e('0x74')](this,_0x53fd38[_0xf32e('0xdb')]);if(!_0x15d5f2){return this[_0xf32e('0xf')]['error'](_0x53fd38,'no\x20odbc\x20database\x20found');}if(!this[_0xf32e('0x87')](_0x53fd38[_0xf32e('0x33')])){return this[_0xf32e('0xf')]['error'](_0x53fd38,_0xf32e('0xdd'));}var _0x5cf37e=_0x53fd38[_0xf32e('0x33')][_0xf32e('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0xde'),_0x5cf37e));var _0x4fa6e2=this[_0xf32e('0x2f')][_0xf32e('0x74')](this,_0x15d5f2,_0x5cf37e);this[_0xf32e('0x3a')][_0xf32e('0x74')](this,_0x53fd38,_0x5cf37e);if(!this['isConfigured'](_0x53fd38['variable_id'])){return this['channel'][_0xf32e('0xad')](_0xf32e('0xdf'));}var _0x4cb721=this[_0xf32e('0x12')]['sync'](this,_0x53fd38[_0xf32e('0xe0')]);if(!_0x4cb721){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x53fd38,'no\x20variable\x20found');}var _0x2d1bfc=this;_0x4fa6e2['forEach'](function(_0x8a56a5,_0x1f79e0){Object[_0xf32e('0xe1')](_0x8a56a5)[_0xf32e('0xe2')](function(_0x1be5e4){_0x2d1bfc[_0xf32e('0xf')]['setVariable'](util['format'](_0xf32e('0xe3'),_0x4cb721,_0x1f79e0,_0x1be5e4),_0x8a56a5[_0x1be5e4]);});});this['channel']['setVariable'](util['format'](_0xf32e('0xe4'),_0x4cb721),_0x4fa6e2['length']);return this[_0xf32e('0xf')][_0xf32e('0xad')](util['format'](_0xf32e('0xe5'),_0x4cb721));};AGIVertices[_0xf32e('0x17')]['dial']=function(_0x2d6792){logger['debug'](util[_0xf32e('0x5a')](_0xf32e('0xe6'),_0x2d6792['label']));if(!this['isConfigured'](_0x2d6792[_0xf32e('0xe7')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x2d6792,_0xf32e('0xe8'));}var _0x2083ff=this[_0xf32e('0xe9')]['sync'](this,_0x2d6792['sip_id']);if(!_0x2083ff){return this['channel']['error'](_0x2d6792,_0xf32e('0xea'));}var _0x4a1574=this['channel'][_0xf32e('0xb4')](_0xf32e('0xeb'),[util[_0xf32e('0x5a')](_0xf32e('0xec'),_0x2083ff),_0x2d6792['timeout'],_0x2d6792[_0xf32e('0xed')],_0x2d6792[_0xf32e('0x67')]]);if(_0x4a1574[_0xf32e('0xb6')]===-0x1){return _0x4a1574;}return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0xee'),_0xf32e('0xeb')));};AGIVertices[_0xf32e('0x17')][_0xf32e('0xef')]=function(_0x230654){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0xf0'),_0x230654['label']));if(!this[_0xf32e('0x87')](_0x230654[_0xf32e('0x86')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0xf1'));}if(!this[_0xf32e('0x87')](_0x230654['text'])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0xae'));}this[_0xf32e('0xf')][_0xf32e('0xf2')]=!![];this['createSquareDetailsReport'](_0x230654);this['createSquareMessage'](_0x230654['text'],'in','','');this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0xf3'),_0x230654[_0xf32e('0x5f')]));var _0x8025f7=this['googleDialogflow']['sync'](this,_0x230654);if(_0x8025f7){for(var _0x5f2481 in _0x8025f7){if(_0x8025f7[_0xf32e('0x98')](_0x5f2481)){this[_0xf32e('0xf')]['setVariable'](util[_0xf32e('0x5a')](_0xf32e('0xf4'),_0x5f2481['toUpperCase']()),_0x8025f7[_0x5f2481]);}}this[_0xf32e('0x48')](_0x8025f7[_0xf32e('0xf5')],'out',_0xf32e('0xef'),'');return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')]('Dialogflow\x20Result\x20%s',_0x8025f7[_0xf32e('0xf5')]));}return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x230654,_0xf32e('0xf6'));};AGIVertices[_0xf32e('0x17')][_0xf32e('0xf7')]=function(_0x4bdd7d){logger[_0xf32e('0x32')](util['format'](_0xf32e('0xf8'),_0x4bdd7d[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x4bdd7d[_0xf32e('0x7f')])){return this[_0xf32e('0xf')]['noop'](_0xf32e('0xf9'));}if(!this[_0xf32e('0x87')](_0x4bdd7d[_0xf32e('0xfa')])){return this[_0xf32e('0xf')]['noop'](_0xf32e('0xfb'));}if(!this['isConfigured'](_0x4bdd7d[_0xf32e('0xfc')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0xfd'));}if(!this[_0xf32e('0x87')](_0x4bdd7d[_0xf32e('0x80')])){return this[_0xf32e('0xf')]['noop'](_0xf32e('0xfe'));}if(!this['isConfigured'](_0x4bdd7d['text'])){return this[_0xf32e('0xf')][_0xf32e('0xad')]('no\x20text\x20configured');}this[_0xf32e('0xf')][_0xf32e('0xf2')]=!![];this[_0xf32e('0x3a')](_0x4bdd7d);this[_0xf32e('0x48')](_0x4bdd7d[_0xf32e('0x5f')],'in','','');this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0xff'),_0x4bdd7d[_0xf32e('0x5f')]));var _0x3f5d18=this['googleDialogflowV2'][_0xf32e('0x74')](this,_0x4bdd7d);if(_0x3f5d18){for(var _0xfdd33e in _0x3f5d18){if(_0x3f5d18['hasOwnProperty'](_0xfdd33e)){if(_0xfdd33e!=='providerResponse'){this[_0xf32e('0xf')]['setVariable'](util[_0xf32e('0x5a')](_0xf32e('0xf4'),_0xfdd33e[_0xf32e('0x100')]()),_0x3f5d18[_0xfdd33e]);}}}this[_0xf32e('0x48')](_0x3f5d18[_0xf32e('0xf5')],_0xf32e('0x101'),_0xf32e('0xf7'),_0x3f5d18['providerResponse']);return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x102'),_0x3f5d18['speech']));}return this[_0xf32e('0xf')]['error'](_0x4bdd7d,_0xf32e('0x103'));};AGIVertices[_0xf32e('0x17')]['sesteknda']=function(_0x27b2f8){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x104'),_0x27b2f8['label']));if(!this[_0xf32e('0x87')](_0x27b2f8['ndauth_url'])){return this[_0xf32e('0xf')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0xf32e('0x87')](_0x27b2f8[_0xf32e('0x105')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x106'));}if(!this[_0xf32e('0x87')](_0x27b2f8['password'])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x107'));}if(!this[_0xf32e('0x87')](_0x27b2f8[_0xf32e('0x108')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0xae'));}this[_0xf32e('0xf')][_0xf32e('0xf2')]=!![];this[_0xf32e('0x3a')](_0x27b2f8);this[_0xf32e('0x48')](_0x27b2f8[_0xf32e('0x5f')],'in','','');this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x109'),_0x27b2f8[_0xf32e('0x5f')]));var _0x26de8e=this[_0xf32e('0x81')][_0xf32e('0x74')](this,_0x27b2f8);if(_0x26de8e){for(var _0x3d6f97 in _0x26de8e){if(_0x26de8e[_0xf32e('0x98')](_0x3d6f97)){this[_0xf32e('0xf')][_0xf32e('0xa2')](util[_0xf32e('0x5a')](_0xf32e('0x10a'),_0x3d6f97[_0xf32e('0x100')]()),_0x26de8e[_0x3d6f97]);}}this[_0xf32e('0x48')](_0x26de8e['speech'],_0xf32e('0x101'),'sesteknda','');if(_0x26de8e[_0xf32e('0x10b')]){this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x10c'),_0x26de8e[_0xf32e('0x10b')]));var _0x417699=this[_0xf32e('0xf')][_0xf32e('0x10d')](_0x26de8e[_0xf32e('0x10b')]);try{fs['unlink'](_0x26de8e[_0xf32e('0x10b')]+_0xf32e('0x10e'));}catch(_0xb841ef){logger[_0xf32e('0x31')](_0xb841ef);}return _0x417699;}else{return this['channel']['noop'](util[_0xf32e('0x5a')](_0xf32e('0x10f'),_0x26de8e[_0xf32e('0xf5')]));}}return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x27b2f8,_0xf32e('0x110'));};AGIVertices['prototype']['end']=function(_0x2da2b7){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x111'),_0x2da2b7['label']));return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x112'));};AGIVertices[_0xf32e('0x17')]['ext_dial']=function(_0x4e5044){logger['info'](util[_0xf32e('0x5a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4e5044[_0xf32e('0x3c')]));var _0x26af16='';if(_0x4e5044[_0xf32e('0x113')]){if(!this[_0xf32e('0x87')](_0x4e5044[_0xf32e('0x113')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x4e5044,_0xf32e('0x114'));}else{var _0xc186dd=parseInt(_0x4e5044[_0xf32e('0x113')],0xa);if(isNaN(_0xc186dd)){_0x26af16=_0x4e5044['trunk_id'];}else{_0x26af16=this[_0xf32e('0x1f')]['sync'](this,_0x4e5044['trunk_id']);if(!_0x26af16){return this['channel'][_0xf32e('0x31')](_0x4e5044,_0xf32e('0x115'));}}}}else if(_0x4e5044[_0xf32e('0x116')]){_0x26af16=_0x4e5044[_0xf32e('0x116')];}else{return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x4e5044,_0xf32e('0x114'));}var _0x12be66=this['channel'][_0xf32e('0xb4')]('DIAL',[util[_0xf32e('0x5a')](_0xf32e('0x117'),_0x26af16,_0x4e5044[_0xf32e('0xca')]),_0x4e5044[_0xf32e('0x69')],_0x4e5044[_0xf32e('0xed')],_0x4e5044[_0xf32e('0x67')]]);if(_0x12be66[_0xf32e('0xb6')]===-0x1){return _0x12be66;}return this[_0xf32e('0xf')]['noop'](util[_0xf32e('0x5a')](_0xf32e('0xee'),'DIAL'));};AGIVertices[_0xf32e('0x17')]['finally']=function(_0x1e62ec){logger[_0xf32e('0x32')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1e62ec[_0xf32e('0x3c')]));return this[_0xf32e('0xf')][_0xf32e('0xad')]('finally');};AGIVertices[_0xf32e('0x17')]['getdigits']=function(_0x3c33bd){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x118'),_0x3c33bd[_0xf32e('0x3c')]));if(_0x3c33bd[_0xf32e('0xaa')]===0x0){return this[_0xf32e('0xa9')](_0x3c33bd);}_0x3c33bd[_0xf32e('0xaa')]-=0x1;if(!this[_0xf32e('0x87')](_0x3c33bd[_0xf32e('0x119')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x3c33bd,_0xf32e('0x11a'));}var _0x4b922b=this[_0xf32e('0x21')]['sync'](this,_0x3c33bd[_0xf32e('0x119')]);if(!_0x4b922b){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x3c33bd,_0xf32e('0x11b'));}if(!this[_0xf32e('0x87')](_0x3c33bd[_0xf32e('0xe0')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0xf32e('0xdf'));}var _0x21b344=this[_0xf32e('0xf')][_0xf32e('0x11c')](_0x4b922b,_0x3c33bd[_0xf32e('0x11d')],_0x3c33bd[_0xf32e('0x11e')]);var _0x584c62=_0x21b344[_0xf32e('0xb6')]?_0x21b344[_0xf32e('0xb6')][_0xf32e('0xa6')]():'';logger[_0xf32e('0x32')](_0xf32e('0x11f'),JSON[_0xf32e('0x77')](_0x21b344));if(_0x21b344[_0xf32e('0xb6')]===-0x1){this[_0xf32e('0x3a')][_0xf32e('0x74')](this,_0x3c33bd,_0x584c62);return _0x21b344;}else if(_0x21b344[_0xf32e('0xa5')]===_0xf32e('0x69')){_0x21b344[_0xf32e('0xb6')]=_0x584c62[_0xf32e('0x9f')]>=parseInt(_0x3c33bd['mindigit'])?'x':'i';}else{_0x21b344[_0xf32e('0xb6')]=_0x584c62[_0xf32e('0x9f')]>=parseInt(_0x3c33bd[_0xf32e('0x120')])&&_0x584c62[_0xf32e('0x9f')]<=parseInt(_0x3c33bd[_0xf32e('0x11e')])?'x':'i';}var _0x3f25a0=this[_0xf32e('0x12')]['sync'](this,_0x3c33bd[_0xf32e('0xe0')]);if(!_0x3f25a0){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x3c33bd,_0xf32e('0x121'));}this[_0xf32e('0xf')][_0xf32e('0xa2')](_0x3f25a0,_0x584c62);if(this[_0xf32e('0x87')](_0x3c33bd[_0xf32e('0x122')])){var _0x1557af=parseInt(_0x3c33bd[_0xf32e('0x122')],0xa);var _0x1e9cf0=rs[_0xf32e('0x123')]({'charset':'*','length':_0x1557af});var _0x2493b6=_0x584c62[_0xf32e('0x9f')];if(_0x2493b6>0x0){if(_0x2493b6>_0x1557af){this['createSquareDetailsReport'][_0xf32e('0x74')](this,_0x3c33bd,_0x3c33bd[_0xf32e('0x124')]==='first'?_0x1e9cf0+_0x584c62[_0xf32e('0x125')](_0x1557af):_0x584c62[_0xf32e('0x125')](0x0,_0x2493b6-_0x1557af)+_0x1e9cf0);}else{this[_0xf32e('0x3a')][_0xf32e('0x74')](this,_0x3c33bd,rs[_0xf32e('0x123')]({'charset':'*','length':_0x2493b6}));}}else{this[_0xf32e('0x3a')][_0xf32e('0x74')](this,_0x3c33bd,'');}}else{this[_0xf32e('0x3a')][_0xf32e('0x74')](this,_0x3c33bd,_0x584c62);}return _0x21b344;};AGIVertices[_0xf32e('0x17')][_0xf32e('0xe')]=function(_0x539937){logger['info'](util[_0xf32e('0x5a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x539937[_0xf32e('0x3c')]));return this[_0xf32e('0x126')](_0x539937);};AGIVertices[_0xf32e('0x17')]['goal']=function(_0x42102c){logger['info'](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x42102c[_0xf32e('0x3c')]));this['createSquareDetailsReport']['sync'](this,_0x42102c,_0x42102c[_0xf32e('0x127')]);return this[_0xf32e('0xf')][_0xf32e('0xad')](util['format']('GOAL\x20%s',_0x42102c[_0xf32e('0x127')]));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x128')]=function(_0x5863c1){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x129'),_0x5863c1[_0xf32e('0x3c')]));if(!this['isConfigured'](_0x5863c1[_0xf32e('0x8a')])||!this[_0xf32e('0x87')](_0x5863c1[_0xf32e('0x12a')])){return this[_0xf32e('0xf')][_0xf32e('0xad')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x5863c1[_0xf32e('0x5f')])){return this[_0xf32e('0xf')][_0xf32e('0xad')]('no\x20text\x20configured');}this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x12b'),_0x5863c1[_0xf32e('0x5f')]));var _0x166336=this['awsPolly']['sync'](this,_0x5863c1);if(_0x166336){this['channel'][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x12c'),_0x166336));var _0x437999=this[_0xf32e('0xf')]['streamFile'](_0x166336);try{fs[_0xf32e('0x12d')](_0x166336+_0xf32e('0x10e'));}catch(_0x5b8e60){logger['error'](_0x5b8e60);}return _0x437999;}return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x5863c1,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xf32e('0x17')][_0xf32e('0x12e')]=function(_0x32470f){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x12f'),_0x32470f['label']));if(!this['isConfigured'](_0x32470f[_0xf32e('0x8a')])||!this[_0xf32e('0x87')](_0x32470f[_0xf32e('0x12a')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x130'));}if(!this[_0xf32e('0x87')](_0x32470f[_0xf32e('0x91')])){return this[_0xf32e('0xf')][_0xf32e('0xad')]('no\x20bot\x20name\x20configured');}if(!this[_0xf32e('0x87')](_0x32470f[_0xf32e('0x5f')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0xae'));}this[_0xf32e('0xf')]['bot']=!![];this[_0xf32e('0x3a')](_0x32470f);this[_0xf32e('0x48')](_0x32470f[_0xf32e('0x5f')],'in','','');this[_0xf32e('0xf')][_0xf32e('0xad')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x32470f['text']));var _0xe7b07b=this[_0xf32e('0x8f')][_0xf32e('0x74')](this,_0x32470f);if(_0xe7b07b){for(var _0x110512 in _0xe7b07b){if(_0xe7b07b[_0xf32e('0x98')](_0x110512)&&_[_0xf32e('0x9e')](_0xe7b07b[_0x110512])){this['channel'][_0xf32e('0xa2')](util[_0xf32e('0x5a')]('AWS_LEX_%s',_0x110512['toUpperCase']()),_0xe7b07b[_0x110512]);}}if(_[_0xf32e('0x49')](_0xe7b07b[_0xf32e('0x79')])){return this['channel'][_0xf32e('0xad')](_0xf32e('0x131'));}else{this['createSquareMessage'](_0xe7b07b['message'],'out',_0xf32e('0x132'),'');return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')]('Amazon\x20Lex\x20Result\x20%s',_0xe7b07b[_0xf32e('0x79')]));}}return this['channel'][_0xf32e('0x31')](_0x32470f,_0xf32e('0x133'));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x134')]=function(_0x66dd81){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x66dd81[_0xf32e('0x3c')],_0x66dd81['timeout']));if(!this['isConfigured'](_0x66dd81[_0xf32e('0x86')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x57bd20=_0xf32e('0x135');var _0x145395=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x227b10=util[_0xf32e('0x5a')]('%s.%s',_0x145395,_0x57bd20);var _0x779871=!![];if(_0x66dd81[_0xf32e('0x136')]===_0xf32e('0x137')){_0x779871=![];}var _0x381064=this[_0xf32e('0xf')]['recordFile'](_0x145395,_0x57bd20,_0x66dd81[_0xf32e('0x138')],_0x66dd81[_0xf32e('0x69')],undefined,_0x779871);if(_0x381064[_0xf32e('0xb6')]!==-0x1){this['channel'][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x139'),_0x227b10));var _0x541032=this[_0xf32e('0x92')]['sync'](this,_0x66dd81,_0x227b10);if(_0x541032){for(var _0x325d35 in _0x541032){if(_0x541032[_0xf32e('0x98')](_0x325d35)){this[_0xf32e('0xf')]['setVariable'](util[_0xf32e('0x5a')](_0xf32e('0x13a'),_0x325d35[_0xf32e('0x100')]()),_0x541032[_0x325d35]);}}return this[_0xf32e('0xf')][_0xf32e('0xad')](util['format']('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x541032)));}}return _0x381064;};AGIVertices[_0xf32e('0x17')][_0xf32e('0x13b')]=function(_0x1f8a21){logger['info'](util[_0xf32e('0x5a')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1f8a21[_0xf32e('0x3c')]));if(!this['isConfigured'](_0x1f8a21[_0xf32e('0x95')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x13c'));}if(!this[_0xf32e('0x87')](_0x1f8a21[_0xf32e('0x96')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x13d'));}var _0x2af5df=_0xf32e('0x135');var _0x144379=util['format'](_0xf32e('0x13e'),FILES_PATH,rs[_0xf32e('0x123')](0x4));var _0x310197=util[_0xf32e('0x5a')]('%s.%s',_0x144379,_0x2af5df);var _0x567993=!![];if(_0x1f8a21['beep']===_0xf32e('0x137')){_0x567993=![];}var _0x1aac02=this['channel'][_0xf32e('0x13f')](_0x144379,_0x2af5df,_0x1f8a21[_0xf32e('0x138')],_0x1f8a21[_0xf32e('0x69')],undefined,_0x567993);if(_0x1aac02[_0xf32e('0xb6')]!==-0x1){this[_0xf32e('0xf')][_0xf32e('0xad')](util['format']('tilde\x20%s\x20file\x20created',_0x310197));var _0x26f251=this[_0xf32e('0x94')]['sync'](this,_0x1f8a21,_0x310197);if(_0x26f251){for(var _0xb121f0 in _0x26f251){if(_0x26f251[_0xf32e('0x98')](_0xb121f0)){this[_0xf32e('0xf')][_0xf32e('0xa2')](util[_0xf32e('0x5a')](_0xf32e('0x140'),_0xb121f0['toUpperCase']()),_0x26f251[_0xb121f0]);}}return this['channel'][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x141'),JSON[_0xf32e('0x77')](_0x26f251)));}}return _0x1aac02;};AGIVertices['prototype']['gotoc']=function(_0x575014){logger['info'](util[_0xf32e('0x5a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x575014[_0xf32e('0x3c')]));return this['channel'][_0xf32e('0x142')](_0x575014[_0xf32e('0x42')],_0x575014[_0xf32e('0x43')],_0x575014[_0xf32e('0x44')]);};AGIVertices[_0xf32e('0x17')][_0xf32e('0x143')]=function(_0x14c363){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x144'),_0x14c363['label']));if(!this['isConfigured'](_0x14c363[_0xf32e('0x145')])){return this[_0xf32e('0xf')]['error'](_0x14c363,_0xf32e('0x146'));}try{var _0x3027ff=eval(_0x14c363[_0xf32e('0x145')])?'true':'false';this['channel']['noop'](util[_0xf32e('0x5a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x14c363['condition'],_0x3027ff));return{'code':0xc8,'result':_0x3027ff};}catch(_0x4595fd){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xf32e('0x17')][_0xf32e('0x147')]=function(_0x26854b){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x148'),_0x26854b[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x26854b['interval_id'])){return this['channel'][_0xf32e('0x31')](_0x26854b,_0xf32e('0x149'));}var _0x25ea09=this[_0xf32e('0x27')][_0xf32e('0x74')](this,_0x26854b[_0xf32e('0x14a')]);if(!_0x25ea09){return this['channel'][_0xf32e('0x31')](_0x26854b,_0xf32e('0x14b'));}for(var _0x1775bb=0x0;_0x1775bb<_0x25ea09[_0xf32e('0x9f')];_0x1775bb+=0x1){var _0x3dc523=this[_0xf32e('0xf')][_0xf32e('0x12')](util[_0xf32e('0x5a')](_0xf32e('0x14c'),_0x25ea09[_0x1775bb]));if(_0x3dc523['result']===-0x1){return _0x3dc523;}logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x14d'),_0x25ea09[_0x1775bb],_0x3dc523[_0xf32e('0xa5')]));if(_0x3dc523['extra']===_0xf32e('0x14e')){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x14d'),_0x25ea09[_0x1775bb],'true'));this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')]('IFTIME\x20%s\x20%s',_0x25ea09[_0x1775bb],'true'));return{'code':0xc8,'result':_0xf32e('0x14e')};}else{logger[_0xf32e('0x32')](util['format'](_0xf32e('0x14d'),_0x25ea09[_0x1775bb],_0xf32e('0x14f')));this[_0xf32e('0xf')][_0xf32e('0xad')](util['format'](_0xf32e('0x14d'),_0x25ea09[_0x1775bb],_0xf32e('0x14f')));}}return{'code':0xc8,'result':_0xf32e('0x14f')};};AGIVertices[_0xf32e('0x17')][_0xf32e('0x150')]=function(_0x5e07df){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x151'),_0x5e07df[_0xf32e('0x3c')]));return this[_0xf32e('0xf')]['hangup']();};AGIVertices[_0xf32e('0x17')][_0xf32e('0x152')]=function(_0x24c8a3){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x24c8a3['label']));if(!this[_0xf32e('0x87')](_0x24c8a3['key'])){return this['channel'][_0xf32e('0xad')](_0xf32e('0xf1'));}var _0x5de89b='wav';var _0x3a917c=util[_0xf32e('0x5a')](_0xf32e('0x13e'),FILES_PATH,rs[_0xf32e('0x123')](0x4));var _0x286b46=util['format'](_0xf32e('0xa1'),_0x3a917c,_0x5de89b);var _0x10e4d0=!![];if(_0x24c8a3[_0xf32e('0x136')]===_0xf32e('0x137')){_0x10e4d0=![];}var _0x149ba0=this[_0xf32e('0xf')]['recordFile'](_0x3a917c,_0x5de89b,_0x24c8a3[_0xf32e('0x138')],_0x24c8a3[_0xf32e('0x69')],undefined,_0x10e4d0);if(_0x149ba0[_0xf32e('0xb6')]!==-0x1){this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x153'),_0x286b46));var _0x1cc045=this['ispeechASR'][_0xf32e('0x74')](this,_0x24c8a3,_0x286b46);if(_0x1cc045){for(var _0x41c1d4 in _0x1cc045){if(_0x1cc045[_0xf32e('0x98')](_0x41c1d4)){this[_0xf32e('0xf')][_0xf32e('0xa2')](util[_0xf32e('0x5a')](_0xf32e('0x154'),_0x41c1d4[_0xf32e('0x100')]()),_0x1cc045[_0x41c1d4]);}}return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x155'),JSON[_0xf32e('0x77')](_0x1cc045)));}}return _0x149ba0;};AGIVertices[_0xf32e('0x17')][_0xf32e('0x156')]=function(_0x152146){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x157'),_0x152146[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x152146[_0xf32e('0x86')])){return this['channel']['noop'](_0xf32e('0xf1'));}if(!this[_0xf32e('0x87')](_0x152146[_0xf32e('0x5f')])){return this['channel'][_0xf32e('0xad')](_0xf32e('0xae'));}this[_0xf32e('0xf')][_0xf32e('0xad')](util['format'](_0xf32e('0x158'),_0x152146['text']));var _0xed94b8=this[_0xf32e('0x82')][_0xf32e('0x74')](this,_0x152146);if(_0xed94b8){this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x153'),_0xed94b8));var _0x59eb9e=this['channel'][_0xf32e('0x10d')](_0xed94b8,_0x152146['intKey']);try{fs[_0xf32e('0x12d')](_0xed94b8+_0xf32e('0x10e'));}catch(_0x5bea57){logger[_0xf32e('0x31')](_0x5bea57);}return _0x59eb9e;}return this[_0xf32e('0xf')]['error'](_0x152146,_0xf32e('0x159'));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x15a')]=function(_0x1c063e){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x15b'),_0x1c063e[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x1c063e[_0xf32e('0x15c')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x1c063e,_0xf32e('0x15d'));}logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x15e'),this[_0xf32e('0xf')][_0xf32e('0x3f')],_0x1c063e[_0xf32e('0x15c')]));var _0x396b5b=this[_0xf32e('0x58')][_0xf32e('0x74')](this,_0x1c063e[_0xf32e('0x15c')]);if(_0x396b5b){logger[_0xf32e('0x32')](util['format'](_0xf32e('0x15f'),this[_0xf32e('0xf')][_0xf32e('0x3f')],_0x1c063e[_0xf32e('0x15c')]));this[_0xf32e('0xf')][_0xf32e('0xad')](util['format'](_0xf32e('0x15f'),this[_0xf32e('0xf')][_0xf32e('0x3f')],_0x1c063e[_0xf32e('0x15c')]));return{'code':0xc8,'result':_0xf32e('0x160')};}else{logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x161'),this[_0xf32e('0xf')][_0xf32e('0x3f')],_0x1c063e['findBy']));this[_0xf32e('0xf')]['noop'](util[_0xf32e('0x5a')](_0xf32e('0x161'),this[_0xf32e('0xf')]['callerid'],_0x1c063e[_0xf32e('0x15c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xf32e('0x17')][_0xf32e('0x162')]=function(_0x415ae8){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x163'),_0x415ae8[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x415ae8[_0xf32e('0x15c')])){return this[_0xf32e('0xf')]['error'](_0x415ae8,'no\x20find\x20by\x20configured');}logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x15e'),this['channel'][_0xf32e('0x3f')],_0x415ae8[_0xf32e('0x15c')]));var _0x2018ca=this[_0xf32e('0x57')][_0xf32e('0x74')](this,_0x415ae8[_0xf32e('0x15c')]);if(_0x2018ca){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf32e('0xf')][_0xf32e('0x3f')],_0x415ae8[_0xf32e('0x15c')]));this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf32e('0xf')][_0xf32e('0x3f')],_0x415ae8[_0xf32e('0x15c')]));return{'code':0xc8,'result':_0xf32e('0x160')};}else{logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x161'),this[_0xf32e('0xf')]['callerid'],_0x415ae8[_0xf32e('0x15c')]));this[_0xf32e('0xf')]['noop'](util[_0xf32e('0x5a')](_0xf32e('0x161'),this[_0xf32e('0xf')][_0xf32e('0x3f')],_0x415ae8[_0xf32e('0x15c')]));return{'code':0xc8,'result':_0xf32e('0x164')};}};AGIVertices[_0xf32e('0x17')]['math']=function(_0x361293){logger[_0xf32e('0x32')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x361293[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x361293[_0xf32e('0x165')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x361293,_0xf32e('0x166'));}this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')]('math\x20%s',_0x361293['operation']));var _0x485672=eval(_0x361293[_0xf32e('0x165')]);if(!this[_0xf32e('0x87')](_0x361293[_0xf32e('0xe0')])){return this[_0xf32e('0xf')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x591747=this[_0xf32e('0x12')][_0xf32e('0x74')](this,_0x361293['variable_id']);if(!_0x591747){return this[_0xf32e('0xf')]['error'](_0x361293,_0xf32e('0x121'));}if(_[_0xf32e('0x9c')](_0x485672)){var _0x1520e4=this;_0x485672[_0xf32e('0xe2')](function(_0x4bfcd6,_0x147ac7){_0x1520e4[_0xf32e('0xf')][_0xf32e('0xa2')](util[_0xf32e('0x5a')](_0xf32e('0x167'),_0x591747,_0x147ac7),_0x4bfcd6);});return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x168'),_0x591747));}else{return this[_0xf32e('0xf')][_0xf32e('0xa2')](_0x591747,_0x485672);}};AGIVertices[_0xf32e('0x17')]['menu']=function(_0x3aa2cf){logger[_0xf32e('0x32')](util['format'](_0xf32e('0x169'),_0x3aa2cf[_0xf32e('0x3c')]));if(_0x3aa2cf[_0xf32e('0xaa')]===0x0){return this[_0xf32e('0xa9')](_0x3aa2cf);}_0x3aa2cf['retry']-=0x1;if(!this[_0xf32e('0x87')](_0x3aa2cf[_0xf32e('0x119')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x3aa2cf,_0xf32e('0x11a'));}var _0x1bdfe5=this[_0xf32e('0x21')][_0xf32e('0x74')](this,_0x3aa2cf['file_id']);if(!_0x1bdfe5){return this[_0xf32e('0xf')]['error'](_0x3aa2cf,_0xf32e('0x11b'));}var _0x413344=this['channel'][_0xf32e('0x11c')](_0x1bdfe5,_0x3aa2cf[_0xf32e('0x11d')],_0x3aa2cf[_0xf32e('0x16a')]);var _0x650303=_0x413344[_0xf32e('0xb6')];if(_0x413344['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x3aa2cf,'-1');return _0x413344;}else if(_0x413344['extra']===_0xf32e('0x69')){_0x413344['result']=_0x413344[_0xf32e('0xb6')]['length']>0x0?_0x413344[_0xf32e('0xb6')]:'t';}else if(_[_0xf32e('0x4c')](_0x413344[_0xf32e('0xb6')])){_0x413344[_0xf32e('0xb6')]='#';_0x650303='#';}if(!this['isConfigured'](_0x3aa2cf[_0xf32e('0xe0')])){this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0xdf'));}else{var _0x5ac202=this['getVariable'][_0xf32e('0x74')](this,_0x3aa2cf['variable_id']);if(!_0x5ac202){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x3aa2cf,'no\x20variable\x20found');}this[_0xf32e('0xf')][_0xf32e('0xa2')](_0x5ac202,_0x650303);}this[_0xf32e('0x3a')][_0xf32e('0x74')](this,_0x3aa2cf,_0x650303);return _0x413344;};AGIVertices[_0xf32e('0x17')][_0xf32e('0xad')]=function(_0x4059bf){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4059bf[_0xf32e('0x3c')]));return this[_0xf32e('0xf')]['noop'](_0x4059bf[_0xf32e('0x16b')]||_0x4059bf[_0xf32e('0x3c')]);};AGIVertices[_0xf32e('0x17')][_0xf32e('0x16c')]=function(_0xa4a89a){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0xa4a89a[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0xa4a89a['findBy'])){return this[_0xf32e('0xf')]['error'](_0xa4a89a,_0xf32e('0x15d'));}logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x15e'),this['channel'][_0xf32e('0x3f')],_0xa4a89a['findBy']));var _0x13be10=this[_0xf32e('0x52')][_0xf32e('0x74')](this,_0xa4a89a[_0xf32e('0x16d')]);var _0x4b1b06=this[_0xf32e('0x54')][_0xf32e('0x74')](this,_0xa4a89a[_0xf32e('0x15c')],_0x13be10);if(_0x4b1b06){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x15f'),this[_0xf32e('0xf')]['callerid'],_0xa4a89a[_0xf32e('0x15c')]));this['channel']['noop'](util[_0xf32e('0x5a')](_0xf32e('0x15f'),this[_0xf32e('0xf')]['callerid'],_0xa4a89a[_0xf32e('0x15c')]));return{'code':0xc8,'result':_0xf32e('0x160')};}else{logger['info'](util['format'](_0xf32e('0x161'),this[_0xf32e('0xf')][_0xf32e('0x3f')],_0xa4a89a[_0xf32e('0x15c')]));this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf32e('0xf')][_0xf32e('0x3f')],_0xa4a89a['findBy']));return{'code':0xc8,'result':_0xf32e('0x164')};}};AGIVertices[_0xf32e('0x17')][_0xf32e('0x16e')]=function(_0x1e0a0a){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x16f'),_0x1e0a0a[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x1e0a0a[_0xf32e('0x119')])){return this[_0xf32e('0xf')]['error'](_0x1e0a0a,'no\x20file\x20audio\x20selected');}var _0x1e695a=this[_0xf32e('0x21')][_0xf32e('0x74')](this,_0x1e0a0a[_0xf32e('0x119')]);if(!_0x1e695a){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x1e0a0a,'no\x20file\x20audio\x20found');}var _0xa2d9cc=this[_0xf32e('0xf')][_0xf32e('0xb4')]('PLAYBACK',[_0x1e695a,_0x1e0a0a[_0xf32e('0xed')]]);if(_0xa2d9cc['result']===-0x1){return _0xa2d9cc;}return this[_0xf32e('0xf')][_0xf32e('0xad')](util['format'](_0xf32e('0x170'),_0xf32e('0x171'),_0x1e695a));};AGIVertices['prototype'][_0xf32e('0x172')]=function(_0x4d4a46){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x173'),_0x4d4a46[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x4d4a46[_0xf32e('0x174')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x4d4a46,_0xf32e('0x175'));}var _0x50c3dd='';var _0x31cfd3=parseInt(_0x4d4a46[_0xf32e('0x174')],0xa);if(isNaN(_0x31cfd3)){_0x50c3dd=_0x4d4a46[_0xf32e('0x174')];}else{_0x50c3dd=this[_0xf32e('0x176')][_0xf32e('0x74')](this,_0x4d4a46[_0xf32e('0x174')]);if(!_0x50c3dd){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x4d4a46,'no\x20queue\x20found');}}var _0x295b5d='';if(this['isConfigured'](_0x4d4a46['file_id'])){var _0x51f3ea=this[_0xf32e('0x21')][_0xf32e('0x74')](this,_0x4d4a46[_0xf32e('0x119')]);if(_0x51f3ea){_0x295b5d=_0x51f3ea;}}this['createSquareDetailsReport']['sync'](this,_0x4d4a46,_0x50c3dd);if(_0x4d4a46[_0xf32e('0xed')][_0xf32e('0x177')]('x')<0x0){_0x4d4a46['opts']+='x';}if(_0x4d4a46['opts'][_0xf32e('0x177')]('X')<0x0){_0x4d4a46[_0xf32e('0xed')]+='X';}this[_0xf32e('0xf')]['setVariable'](_0xf32e('0x178'),_0x50c3dd?_0x50c3dd['toLowerCase']():'');var _0x29f636=this[_0xf32e('0xf')]['exec']('QUEUE',[_0x50c3dd,_0x4d4a46[_0xf32e('0xed')],_0x4d4a46[_0xf32e('0x67')],_0x295b5d,_0x4d4a46[_0xf32e('0x69')],_0x4d4a46[_0xf32e('0xbe')],_0x4d4a46[_0xf32e('0x179')],_0x4d4a46[_0xf32e('0x17a')],'',_0x4d4a46[_0xf32e('0x17b')]]);if(_0x29f636['result']===-0x1){return _0x29f636;}return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x170'),'QUEUE',_0x50c3dd));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x17c')]=function(_0x563c48){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x17d'),_0x563c48['label']));var _0x5f4382=_0x563c48[_0xf32e('0x17e')]||_0xf32e('0x135');var _0xe136f3=util[_0xf32e('0x5a')](_0xf32e('0x17f'),this[_0xf32e('0xf')]['uniqueid'],rs['generate'](0x5));var _0x4627c=util['format']('%s/recordings/%s.%s',FILES_PATH,_0xe136f3,_0x5f4382);var _0x1a5d3f=util[_0xf32e('0x5a')](_0xf32e('0x13e'),FILES_PATH,_0xe136f3);this[_0xf32e('0x40')]['sync'](this,_0x563c48,_0xe136f3,_0x4627c);this[_0xf32e('0xf')][_0xf32e('0xa2')]('RECORDING_SAVENAME',_0xe136f3);logger[_0xf32e('0x32')](_0xf32e('0x180'),_0x1a5d3f,_0x5f4382,_0x563c48['escape_digits'],_0x563c48[_0xf32e('0x69')]);return this[_0xf32e('0xf')]['recordFile'](_0x1a5d3f,_0x5f4382,_0x563c48[_0xf32e('0x181')],_0x563c48['timeout'],undefined,!![]);};AGIVertices[_0xf32e('0x17')]['restapi']=function(_0x3960){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x3960[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x3960[_0xf32e('0x67')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x182'));}var _0x593f3e=this['restAPI'][_0xf32e('0x74')](this,_0x3960);logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x183'),util[_0xf32e('0x184')](_0x593f3e,{'showHidden':![],'depth':null})));if(!this[_0xf32e('0x87')](_0x3960[_0xf32e('0xe0')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x185'));}var _0x23d0df=this[_0xf32e('0x12')][_0xf32e('0x74')](this,_0x3960['variable_id']);if(!_0x23d0df){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x3960,_0xf32e('0x121'));}this[_0xf32e('0xf')][_0xf32e('0xa2')](util['format'](_0xf32e('0x186'),_0x23d0df),_0x593f3e[_0xf32e('0x78')]?_0x593f3e[_0xf32e('0x78')]:_0xf32e('0x187'));this[_0xf32e('0xf')]['setVariable'](util[_0xf32e('0x5a')](_0xf32e('0x188'),_0x23d0df),_0x593f3e[_0xf32e('0x189')]?_0x593f3e['statusMessage']:'OK');if(_0x593f3e[_0xf32e('0x6e')]){try{this[_0xf32e('0xa0')](_0x593f3e[_0xf32e('0x6e')],_0x23d0df);}catch(_0x57bed2){logger[_0xf32e('0x31')](util[_0xf32e('0x5a')](_0xf32e('0x18a'),_0x23d0df));}}return this['channel'][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0xe5'),_0x23d0df));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x18b')]=function(_0x31d6a2){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x18c'),_0x31d6a2[_0xf32e('0x3c')]));return this[_0xf32e('0xf')][_0xf32e('0x18d')](_0x31d6a2[_0xf32e('0x18e')]['replace'](/\s+/g,''),_0x31d6a2[_0xf32e('0x181')]);};AGIVertices[_0xf32e('0x17')]['saynumber']=function(_0x10b925){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x18f'),_0x10b925[_0xf32e('0x3c')]));return this[_0xf32e('0xf')]['sayNumber'](_0x10b925[_0xf32e('0x6a')][_0xf32e('0x5c')](/\s+/g,''),_0x10b925['escape_digits']);};AGIVertices[_0xf32e('0x17')][_0xf32e('0x190')]=function(_0x7c1c2){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x191'),_0x7c1c2['label']));return this[_0xf32e('0xf')]['sayPhonetic'](_0x7c1c2[_0xf32e('0x5f')],_0x7c1c2[_0xf32e('0x181')]);};AGIVertices['prototype']['sendMail']=function(_0x4956a4){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x192'),_0x4956a4[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x4956a4['account_id'])){return this['channel']['noop'](_0xf32e('0x193'));}var _0x4aee96=this[_0xf32e('0x24')][_0xf32e('0x74')](this,_0x4956a4[_0xf32e('0x194')]);if(!_0x4aee96||!_0x4aee96[_0xf32e('0x195')]){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x4956a4,_0xf32e('0x196'));}var _0x126954={'from':util[_0xf32e('0x5a')](_0xf32e('0x197'),_0x4aee96[_0xf32e('0x15')],_0x4aee96[_0xf32e('0x198')]||_0x4aee96['Smtp'][_0xf32e('0x199')]),'to':_0x4956a4['to']||'','cc':_0x4956a4['cc']||'','bcc':_0x4956a4[_0xf32e('0x19a')]||'','subject':_0x4956a4[_0xf32e('0x19b')],'html':_0x4956a4['text'],'text':_0x4956a4[_0xf32e('0x5f')]};if(this['isConfigured'](_0x4956a4[_0xf32e('0x19c')])){}logger[_0xf32e('0x19d')]('sendMail\x20message',JSON[_0xf32e('0x77')](_0x126954));this[_0xf32e('0x3a')][_0xf32e('0x74')](this,_0x4956a4,_0x4956a4[_0xf32e('0x194')]);this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x19e'),_0x4aee96[_0xf32e('0x15')]));this[_0xf32e('0x26')]['sync'](this,_0x4aee96[_0xf32e('0x19f')],_0x126954);return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x1a0'));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x1a1')]=function(_0x5d05ef){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x1a2'),_0x5d05ef[_0xf32e('0x3c')]));return this[_0xf32e('0xf')]['noop'](_0xf32e('0x1a3'));};AGIVertices['prototype']['sendSMS']=function(_0x484762){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x484762['label']));if(!this[_0xf32e('0x87')](_0x484762['sms_account_id'])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x1a4'));}var _0x5d79fe=this[_0xf32e('0x37')][_0xf32e('0x74')](this,_0x484762[_0xf32e('0x1a5')]);if(!_0x5d79fe){return this['channel'][_0xf32e('0x31')](_0x484762,'no\x20sms\x20account\x20found');}var _0x550b39={'body':_0x484762[_0xf32e('0x1a6')],'phone':_0x484762['to']||'','SmsAccountId':_0x5d79fe['id']};logger['debug'](_0xf32e('0x1a7'),JSON[_0xf32e('0x77')](_0x550b39));this[_0xf32e('0x3a')][_0xf32e('0x74')](this,_0x484762,_0x484762['sms_account_id']);this['channel']['noop'](util[_0xf32e('0x5a')](_0xf32e('0x1a8'),_0x5d79fe[_0xf32e('0x15')]));this[_0xf32e('0x39')][_0xf32e('0x74')](this,_0x550b39);return this[_0xf32e('0xf')]['noop'](_0xf32e('0x1a9'));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x1aa')]=function(_0x5c43a1){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x1ab'),_0x5c43a1[_0xf32e('0x3c')]));if(!this['isConfigured'](_0x5c43a1[_0xf32e('0xe0')])){return this[_0xf32e('0xf')]['error'](_0x5c43a1,_0xf32e('0x1ac'));}var _0x16335d=this['getVariable'][_0xf32e('0x74')](this,_0x5c43a1[_0xf32e('0xe0')]);if(!_0x16335d){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x5c43a1,_0xf32e('0x121'));}return this[_0xf32e('0xf')][_0xf32e('0xa2')](_0x16335d,_0x5c43a1['variable_value']);};AGIVertices['prototype']['start']=function(_0x3f7135){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3f7135[_0xf32e('0x3c')]));this['channel'][_0xf32e('0xad')](_0xf32e('0x1ad'));var _0x2a10f5=this['channel'][_0xf32e('0x12')](_0xf32e('0x1ae'));if(!_['isEmpty'](_0x2a10f5['extra'])){this['channel'][_0xf32e('0x3b')]=_0x2a10f5['extra'];}if(_0x3f7135[_0xf32e('0x1af')]==='yes'){this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x1b0'));return this[_0xf32e('0xf')]['answer']();}return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0x1b1'));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x1b2')]=function(_0x3f16fa){logger['info'](util['format'](_0xf32e('0x1b3'),_0x3f16fa[_0xf32e('0x3c')]));if(!this[_0xf32e('0x87')](_0x3f16fa[_0xf32e('0x1b4')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x3f16fa,_0xf32e('0x1b5'));}var _0x2775fa=this[_0xf32e('0x19')][_0xf32e('0x74')](this,_0x3f16fa['project_id']);if(!this[_0xf32e('0x87')](_0x2775fa)){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x3f16fa,util[_0xf32e('0x5a')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x3f16fa[_0xf32e('0x1b4')]));}if(_0x2775fa===this[_0xf32e('0xf')][_0xf32e('0x3e')]){return this[_0xf32e('0xf')]['error'](_0x3f16fa,_0xf32e('0x1b6'));}this[_0xf32e('0x3a')]['sync'](this,_0x3f16fa,_0x2775fa);var _0x14b23c=this[_0xf32e('0xf')]['exec'](_0xf32e('0x1b7'),util[_0xf32e('0x5a')](_0xf32e('0x1b8'),config['agi'][_0xf32e('0x1b9')]||_0xf32e('0x1ba'),_0x2775fa,this[_0xf32e('0xf')][_0xf32e('0x3e')]));if(_0x14b23c['result']===-0x1){return _0x14b23c;}return this[_0xf32e('0xf')][_0xf32e('0xad')](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0x2775fa));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x1bb')]=function(_0x45bfb2){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x1bc'),_0x45bfb2[_0xf32e('0x3c')]));var _0x13afdc=this[_0xf32e('0x5b')][_0xf32e('0x74')](this,_0x45bfb2[_0xf32e('0xc0')]);this[_0xf32e('0x3a')]['sync'](this,_0x45bfb2,_0x45bfb2[_0xf32e('0xc0')]);if(this[_0xf32e('0x87')](_0x45bfb2[_0xf32e('0xe0')])){var _0x43ee2f=this[_0xf32e('0x12')][_0xf32e('0x74')](this,_0x45bfb2[_0xf32e('0xe0')]);if(_0x43ee2f){this[_0xf32e('0xf')]['setVariable'](_0x43ee2f,_0x13afdc);return this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x1bd'),_0x45bfb2[_0xf32e('0xc0')],_0x43ee2f));}}return this[_0xf32e('0xf')]['noop'](util[_0xf32e('0x5a')](_0xf32e('0x1be'),_0x45bfb2[_0xf32e('0xc0')]));};AGIVertices[_0xf32e('0x17')]['google_cloud_tts']=function(_0x759e0e){logger[_0xf32e('0x32')](util['format'](_0xf32e('0x1bf'),_0x759e0e[_0xf32e('0x3c')]));_0x759e0e['text']=_0x759e0e[_0xf32e('0x5f')][_0xf32e('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x759e0e[_0xf32e('0x1c0')])){return this['channel'][_0xf32e('0xad')]('no\x20apiKey\x20configured');}if(!this[_0xf32e('0x87')](_0x759e0e[_0xf32e('0x5f')])){return this[_0xf32e('0xf')]['noop'](_0xf32e('0xae'));}this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x1c1'),_0x759e0e[_0xf32e('0x5f')]));var _0x20f801=this[_0xf32e('0x5d')][_0xf32e('0x74')](this,_0x759e0e);if(_0x20f801){this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x1c2'),_0x20f801));var _0x29d689=this[_0xf32e('0xf')][_0xf32e('0x10d')](_0x20f801);try{fs[_0xf32e('0x12d')](_0x20f801+_0xf32e('0x10e'));}catch(_0x396c59){logger['error'](_0x396c59);}return _0x29d689;}return this[_0xf32e('0xf')]['error'](_0x759e0e,_0xf32e('0x1c3'));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x1c4')]=function(_0x52f5d6){logger[_0xf32e('0x32')](util['format'](_0xf32e('0x1c5'),_0x52f5d6[_0xf32e('0x3c')]));_0x52f5d6[_0xf32e('0x5f')]=_0x52f5d6[_0xf32e('0x5f')][_0xf32e('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf32e('0x87')](_0x52f5d6[_0xf32e('0x5f')])){return this[_0xf32e('0xf')][_0xf32e('0xad')](_0xf32e('0xae'));}this['channel'][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x1c6'),_0x52f5d6['text']));var _0x8099d=this[_0xf32e('0x64')][_0xf32e('0x74')](this,_0x52f5d6);if(_0x8099d){this['channel'][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x1c7'),_0x8099d));var _0x4de948=this[_0xf32e('0xf')][_0xf32e('0x10d')](_0x8099d);try{fs['unlink'](_0x8099d+_0xf32e('0x10e'));}catch(_0x3e4238){logger[_0xf32e('0x31')](_0x3e4238);}return _0x4de948;}return this['channel']['error'](_0x52f5d6,_0xf32e('0x1c8'));};AGIVertices['prototype'][_0xf32e('0x1c9')]=function(_0x3a84cb){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3a84cb['label']));if(!this[_0xf32e('0x87')](_0x3a84cb['findBy'])){return this['channel'][_0xf32e('0x31')](_0x3a84cb,_0xf32e('0x15d'));}logger[_0xf32e('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf32e('0xf')]['callerid'],_0x3a84cb[_0xf32e('0x15c')]));var _0x47d4e9=this[_0xf32e('0x56')][_0xf32e('0x74')](this,_0x3a84cb[_0xf32e('0x15c')]);if(_0x47d4e9){logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x15f'),this[_0xf32e('0xf')][_0xf32e('0x3f')],_0x3a84cb['findBy']));this[_0xf32e('0xf')][_0xf32e('0xad')](util[_0xf32e('0x5a')](_0xf32e('0x15f'),this[_0xf32e('0xf')][_0xf32e('0x3f')],_0x3a84cb['findBy']));return{'code':0xc8,'result':_0xf32e('0x160')};}else{logger[_0xf32e('0x32')](util[_0xf32e('0x5a')](_0xf32e('0x161'),this[_0xf32e('0xf')]['callerid'],_0x3a84cb[_0xf32e('0x15c')]));this[_0xf32e('0xf')][_0xf32e('0xad')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xf32e('0x3f')],_0x3a84cb[_0xf32e('0x15c')]));return{'code':0xc8,'result':_0xf32e('0x164')};}};AGIVertices['prototype']['voicemail']=function(_0x44f6a5){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x1ca'),_0x44f6a5[_0xf32e('0x3c')]));var _0x423b9d=this['channel'][_0xf32e('0xb4')](_0xf32e('0x1cb'),[_0x44f6a5['mailbox'],_0x44f6a5[_0xf32e('0x7b')]]);if(_0x423b9d['result']===-0x1){return _0x423b9d;}return this[_0xf32e('0xf')]['noop'](util[_0xf32e('0x5a')](_0xf32e('0x170'),_0xf32e('0x1cb'),_0x44f6a5['mailbox']));};AGIVertices[_0xf32e('0x17')][_0xf32e('0x1cc')]=function(_0x26297c){logger['info'](util[_0xf32e('0x5a')](_0xf32e('0x1cd'),_0x26297c['label']));if(!this['isConfigured'](_0x26297c[_0xf32e('0xe0')])){return this[_0xf32e('0xf')][_0xf32e('0x31')](_0x26297c,_0xf32e('0x1ac'));}var _0xe10c7a=this['getVariable'][_0xf32e('0x74')](this,_0x26297c[_0xf32e('0xe0')]);if(!_0xe10c7a){return this[_0xf32e('0xf')]['error'](_0x26297c,'no\x20variable\x20found');}var _0x371bd9=this[_0xf32e('0xf')][_0xf32e('0x12')](_0xe10c7a);return{'code':0xc8,'result':_0x371bd9[_0xf32e('0xa5')]?_0x371bd9['extra']:'-'};};String['prototype'][_0xf32e('0xa4')]=function(_0x329a5e,_0xfcb229){return this[_0xf32e('0xa3')](_0x329a5e)[_0xf32e('0x1ce')](_0xfcb229);};module['exports']=AGIVertices; \ No newline at end of file +var _0x4b19=['info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','MP3','googleTTS','google_tts_language','method','timeout','number','POST','PUT','parse','headers','computedVariables','sync','uri','url','body','render','stringify','statusMessage','statusCode','message','options','googleDialogflow','key','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','includes','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','%s.%s','isArray','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','no\x20trunk\x20selected','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s/recordings/%s','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','condition','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','../../config/environment','./scripts','rawHeaders','rawBody','getdigits','getsecretdigits','mailRpc','prototype','getVariable','rpc','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getUser','getUserById','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error'];(function(_0x1559c2,_0x2ef12b){var _0x1d0d6b=function(_0x2ef1c0){while(--_0x2ef1c0){_0x1559c2['push'](_0x1559c2['shift']());}};_0x1d0d6b(++_0x2ef12b);}(_0x4b19,0x195));var _0x94b1=function(_0x2d7fd5,_0x38785f){_0x2d7fd5=_0x2d7fd5-0x0;var _0xdd134f=_0x4b19[_0x2d7fd5];return _0xdd134f;};'use strict';var fs=require('fs');var util=require(_0x94b1('0x0'));var _=require('lodash');var sh=require(_0x94b1('0x1'));var odbc=require(_0x94b1('0x2'))();var rs=require(_0x94b1('0x3'));var moment=require('moment');var Mustache=require(_0x94b1('0x4'));var rp=require(_0x94b1('0x5'));var logger=require(_0x94b1('0x6'))('agi');var config=require(_0x94b1('0x7'));var scripts=require(_0x94b1('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x94b1('0x9'),_0x94b1('0xa')];var verticesWithRetry=['menu',_0x94b1('0xb'),_0x94b1('0xc')];var AGIVertices=function(_0xad0a85,_0x5aee5f,_0x15c0a9){this['channel']=_0xad0a85;this['rpc']=_0x5aee5f;this[_0x94b1('0xd')]=_0x15c0a9;};AGIVertices[_0x94b1('0xe')][_0x94b1('0xf')]=function(_0x8ddf47,_0x162995){this[_0x94b1('0x10')]['getVariableById'](_0x8ddf47)[_0x94b1('0x11')](function(_0x360aea){_0x162995(null,_0x360aea?_0x360aea[_0x94b1('0x12')]:![]);})[_0x94b1('0x13')](function(_0x5cbf96){_0x162995(_0x5cbf96);});};AGIVertices['prototype'][_0x94b1('0x14')]=function(_0x1365a9,_0x57de2f){this['rpc'][_0x94b1('0x15')](_0x1365a9)[_0x94b1('0x11')](function(_0x48a13c){_0x57de2f(null,_0x48a13c?_0x48a13c[_0x94b1('0x12')]:![]);})['catch'](function(_0x4ea6a4){_0x57de2f(_0x4ea6a4);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x16')]=function(_0x258e98,_0x1977f4){this['rpc'][_0x94b1('0x17')](_0x258e98)[_0x94b1('0x11')](function(_0xa29b90){_0x1977f4(null,_0xa29b90?_0xa29b90[_0x94b1('0x12')]:![]);})[_0x94b1('0x13')](function(_0x1abb7f){_0x1977f4(_0x1abb7f);});};AGIVertices[_0x94b1('0xe')]['getSquareOdbc']=function(_0x30f969,_0x447b8f){this[_0x94b1('0x10')]['getSquareOdbcById'](_0x30f969)[_0x94b1('0x11')](function(_0x32f329){_0x447b8f(null,_0x32f329?_0x32f329['dsn']:![]);})[_0x94b1('0x13')](function(_0x310b9f){_0x447b8f(_0x310b9f);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x18')]=function(_0x3a9c3c,_0x38448d){this[_0x94b1('0x10')][_0x94b1('0x19')](_0x3a9c3c)[_0x94b1('0x11')](function(_0xeb777){_0x38448d(null,_0xeb777?_0xeb777['name']:![]);})[_0x94b1('0x13')](function(_0xa112b1){_0x38448d(_0xa112b1);});};AGIVertices[_0x94b1('0xe')]['getTrunk']=function(_0x374611,_0x5af4f5){this[_0x94b1('0x10')][_0x94b1('0x1a')](_0x374611)[_0x94b1('0x11')](function(_0x109a81){_0x5af4f5(null,_0x109a81?_0x109a81['name']:![]);})['catch'](function(_0x1d6ea6){_0x5af4f5(_0x1d6ea6);});};AGIVertices['prototype'][_0x94b1('0x1b')]=function(_0x5c3a9a,_0x4694de){var _0x2f06b1=this;this[_0x94b1('0x10')]['getSoundById'](_0x5c3a9a)[_0x94b1('0x11')](function(_0x1d86bd){_0x4694de(null,_0x1d86bd?_0x2f06b1[_0x94b1('0x1c')](_0x1d86bd[_0x94b1('0x1d')]):![]);})[_0x94b1('0x13')](function(_0x43b67c){_0x4694de(_0x43b67c);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x1e')]=function(_0x1e79e2,_0x597af3){this[_0x94b1('0x10')][_0x94b1('0x1f')](_0x1e79e2)['then'](function(_0x42630a){_0x597af3(null,_0x42630a?_0x42630a:![]);})[_0x94b1('0x13')](function(_0xab9ac5){_0x597af3(_0xab9ac5);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x20')]=function(_0x1386d7,_0x5a5148,_0x1a26eb){this['mailRpc'][_0x94b1('0x20')](_0x1386d7,_0x5a5148)['then'](function(){_0x1a26eb(null);})['catch'](function(_0x202116){_0x1a26eb(_0x202116);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x21')]=function(_0x44e595,_0x35b97c){this[_0x94b1('0x10')][_0x94b1('0x22')](_0x44e595)[_0x94b1('0x11')](function(_0x288ae5){if(_0x288ae5){if(_0x288ae5[_0x94b1('0x23')]){_0x35b97c(null,[_0x288ae5[_0x94b1('0x24')]]);}else{_0x35b97c(null,_[_0x94b1('0x25')](_0x288ae5['Intervals'],'interval'));}}else{_0x35b97c(null,![]);}})[_0x94b1('0x13')](function(_0x14a182){_0x35b97c(_0x14a182);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x1c')]=function(_0x2c7e43){return util[_0x94b1('0x26')](_0x94b1('0x27'),FILES_PATH,_0x2c7e43);};AGIVertices[_0x94b1('0xe')][_0x94b1('0x28')]=function(_0x586eaa,_0x173bec,_0x4d18e8){odbc[_0x94b1('0x29')](_0x586eaa,function(_0x38c90f){if(_0x38c90f){logger[_0x94b1('0x2a')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x38c90f);_0x4d18e8(_0x38c90f);}else{logger[_0x94b1('0x2b')](_0x94b1('0x2c'));odbc[_0x94b1('0x2d')](_0x173bec,function(_0x5628eb,_0x39e85e){if(_0x5628eb){logger[_0x94b1('0x2b')](_0x94b1('0x2e'),_0x173bec);_0x4d18e8(_0x5628eb);}else{logger[_0x94b1('0x2b')](_0x94b1('0x2f'),_0x173bec);odbc[_0x94b1('0x30')](function(_0x292964){if(_0x292964){logger[_0x94b1('0x2a')](_0x94b1('0x31'),_0x292964);}_0x4d18e8(null,_0x39e85e);});}});}});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x32')]=function(_0xfb5e55,_0x235a44){this['rpc'][_0x94b1('0x33')](_0xfb5e55)[_0x94b1('0x11')](function(_0xf29a10){_0x235a44(null,_0xf29a10?_0xf29a10:![]);})[_0x94b1('0x13')](function(_0x2e6d0f){_0x235a44(_0x2e6d0f);});};AGIVertices['prototype'][_0x94b1('0x34')]=function(_0x158d1a,_0x186575){this[_0x94b1('0x10')][_0x94b1('0x34')](_0x158d1a)[_0x94b1('0x11')](function(_0x51bc6b){_0x186575(null,_0x51bc6b);})[_0x94b1('0x13')](function(_0x39b0b7){_0x186575(_0x39b0b7);});};AGIVertices['prototype'][_0x94b1('0x35')]=function(_0x19d4e4,_0x59311b,_0x2c7359){this[_0x94b1('0x10')][_0x94b1('0x35')]({'uniqueid':this['channel'][_0x94b1('0x36')],'node':_0x19d4e4[_0x94b1('0x37')],'application':_0x19d4e4[_0x94b1('0x38')],'data':_0x59311b||null,'project_name':this[_0x94b1('0x39')][_0x94b1('0x3a')],'callerid':this[_0x94b1('0x39')][_0x94b1('0x3b')]})['then'](function(_0x413d1f){if(_0x2c7359){_0x2c7359(null,_0x413d1f);}})[_0x94b1('0x13')](function(_0x163b8e){if(_0x2c7359){_0x2c7359(_0x163b8e);}});};AGIVertices['prototype'][_0x94b1('0x3c')]=function(_0x3a957c,_0x5323c2,_0x1c6f7f,_0x392d3c){this[_0x94b1('0x10')][_0x94b1('0x3c')]({'uniqueid':this[_0x94b1('0x39')][_0x94b1('0x36')],'callerid':this[_0x94b1('0x39')][_0x94b1('0x3b')],'calleridname':this[_0x94b1('0x39')][_0x94b1('0x3d')],'context':this[_0x94b1('0x39')][_0x94b1('0x3e')],'extension':this[_0x94b1('0x39')][_0x94b1('0x3f')],'priority':this[_0x94b1('0x39')][_0x94b1('0x40')],'accountcode':this[_0x94b1('0x39')][_0x94b1('0x41')],'dnid':this[_0x94b1('0x39')]['dnid'],'projectName':this[_0x94b1('0x39')]['arg_1'],'saveName':_0x5323c2,'filename':_0x3a957c[_0x94b1('0x42')]||_0x5323c2,'savePath':_0x1c6f7f})[_0x94b1('0x11')](function(_0x1d8e57){_0x392d3c(null,_0x1d8e57);})['catch'](function(_0x4dacb2){_0x392d3c(_0x4dacb2);});};AGIVertices['prototype'][_0x94b1('0x43')]=function(_0x43f072,_0x276ab1,_0x5ed93a,_0x491128,_0x4d2af3){this[_0x94b1('0x10')][_0x94b1('0x43')]({'uniqueid':this[_0x94b1('0x39')][_0x94b1('0x36')],'body':_0x43f072,'direction':_0x276ab1,'providerName':_0x5ed93a,'providerResponse':_0x491128})[_0x94b1('0x11')](function(_0xf5f20c){if(_0x4d2af3){_0x4d2af3(null,_0xf5f20c);}})[_0x94b1('0x13')](function(_0x4ba0ad){if(_0x4d2af3){_0x4d2af3(_0x4ba0ad);}});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x44')]=function(_0x46d98e,_0x1d9648){this[_0x94b1('0x10')][_0x94b1('0x44')]({'firstName':_[_0x94b1('0x45')](_0x46d98e[_0x94b1('0x12')])||_[_0x94b1('0x46')](_0x46d98e[_0x94b1('0x12')])?_0x94b1('0x47')+Math[_0x94b1('0x48')]():_0x46d98e[_0x94b1('0x12')],'lastName':_[_0x94b1('0x45')](_0x46d98e['lastName'])||_[_0x94b1('0x46')](_0x46d98e[_0x94b1('0x49')])?null:_0x46d98e[_0x94b1('0x49')],'phone':_0x46d98e[_0x94b1('0x4a')],'ListId':_0x46d98e[_0x94b1('0x4b')],'scheduledat':_0x46d98e[_0x94b1('0x4c')],'callbackUniqueid':this[_0x94b1('0x39')][_0x94b1('0x36')],'tags':_0x94b1('0x4d'),'description':'Callback\x20scheduled\x20at\x20'+_0x46d98e[_0x94b1('0x4c')][_0x94b1('0x4e')](),'priority':_0x46d98e[_0x94b1('0x4f')]})[_0x94b1('0x11')](function(_0x3105da){_0x1d9648(null,_0x3105da);})[_0x94b1('0x13')](function(_0x572657){_0x1d9648(_0x572657);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x50')]=function(_0x344b4a,_0x2e663c){this[_0x94b1('0x10')][_0x94b1('0x51')](_0x344b4a)[_0x94b1('0x11')](function(_0x15b80c){_0x2e663c(null,_0x15b80c?_0x15b80c[_0x94b1('0x12')]:![]);})['catch'](function(_0x4eec6c){_0x2e663c(_0x4eec6c);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x52')]=function(_0x13228e,_0x25b504,_0x21caaa){var _0x2c240a={'role':_0x94b1('0x53')};_0x2c240a[_0x13228e]=this[_0x94b1('0x39')][_0x94b1('0x3b')];this[_0x94b1('0x10')][_0x94b1('0x52')](_0x2c240a,_0x25b504,this[_0x94b1('0x39')][_0x94b1('0x36')])['then'](function(_0x3bc6f9){_0x21caaa(null,_[_0x94b1('0x46')](_0x3bc6f9)?![]:!![]);})[_0x94b1('0x13')](function(_0x5918fe){logger[_0x94b1('0x2a')](_0x5918fe);_0x21caaa(null,![]);});};AGIVertices['prototype'][_0x94b1('0x54')]=function(_0x478117,_0x37e951){var _0xe67ea3={'role':_0x94b1('0x53')};_0xe67ea3[_0x478117]=this['channel']['callerid'];this[_0x94b1('0x10')][_0x94b1('0x54')](_0xe67ea3)[_0x94b1('0x11')](function(_0x4ec432){_0x37e951(null,_[_0x94b1('0x46')](_0x4ec432)?![]:!![]);})[_0x94b1('0x13')](function(_0x49fed1){logger['error'](_0x49fed1);_0x37e951(null,![]);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x55')]=function(_0x3fe6c6,_0x3b2603){var _0x282081={'role':_0x94b1('0x53')};_0x282081[_0x3fe6c6]=this[_0x94b1('0x39')][_0x94b1('0x3b')];this['rpc'][_0x94b1('0x55')](_0x282081)['then'](function(_0x3d2bcc){_0x3b2603(null,_[_0x94b1('0x46')](_0x3d2bcc)?![]:!![]);})[_0x94b1('0x13')](function(_0x4e4bdd){logger[_0x94b1('0x2a')](_0x4e4bdd);_0x3b2603(null,![]);});};AGIVertices['prototype'][_0x94b1('0x56')]=function(_0x2cce5d,_0x137a37){var _0x44c824={'role':_0x94b1('0x53')};_0x44c824[_0x2cce5d]=this['channel']['callerid'];var _0x333068=_0x2cce5d!=_0x94b1('0x57')?util[_0x94b1('0x26')](_0x94b1('0x58'),_0x94b1('0x59'),this[_0x94b1('0x39')][_0x94b1('0x3b')]):undefined;this[_0x94b1('0x10')]['agentLogin'](_0x44c824,_0x333068)['then'](function(_0x1578c9){_0x137a37(null,_['isNil'](_0x1578c9)?![]:!![]);})[_0x94b1('0x13')](function(_0x587d9f){logger[_0x94b1('0x2a')](_0x587d9f);_0x137a37(null,![]);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x5a')]=function(_0x3d222e,_0x1a3298){sh[_0x94b1('0x5b')](_['trim'](_0x3d222e),function(_0x444a3f,_0x161980){var _0x35d832=_0x161980[_0x94b1('0x5c')](/(\r\n|\n|\r)/gm,'');_0x1a3298(null,_0x35d832);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x5d')]=function(_0x86c758,_0x5db422){scripts[_0x94b1('0x5d')](_0x86c758[_0x94b1('0x5e')],_0x86c758[_0x94b1('0x5f')]||_0x94b1('0x60'),_0x86c758[_0x94b1('0x60')],_0x86c758[_0x94b1('0x61')]||_0x94b1('0x62'),_0x86c758['ssmlGender']||_0x94b1('0x63'),_0x86c758['audioEncoding']||_0x94b1('0x64'))[_0x94b1('0x11')](function(_0xc88bee){_0x5db422(null,_0xc88bee);})[_0x94b1('0x13')](function(_0x47bc66){_0x5db422(_0x47bc66);});};AGIVertices['prototype'][_0x94b1('0x65')]=function(_0xbecafd,_0x49ffcd){scripts[_0x94b1('0x65')](_0xbecafd[_0x94b1('0x60')],_0xbecafd[_0x94b1('0x66')]||'en',0x1)['then'](function(_0x14e930){_0x49ffcd(null,_0x14e930);})[_0x94b1('0x13')](function(_0x40874c){_0x49ffcd(_0x40874c);});};AGIVertices[_0x94b1('0xe')]['restAPI']=function(_0x46893d,_0x486841){var _0x53faf9={'uri':_0x46893d['url'],'method':_0x46893d[_0x94b1('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x46893d[_0x94b1('0x68')])===_0x94b1('0x69')&&parseInt(_0x46893d['timeout'])>=0x1?parseInt(_0x46893d['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x94b1('0x6a'),_0x94b1('0x6b')],_0x53faf9['method']['toUpperCase']())){try{_0x53faf9['body']=_0x46893d[_0x94b1('0xa')]?JSON[_0x94b1('0x6c')](_0x46893d[_0x94b1('0xa')]):{};}catch(_0x1d6ce0){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1d6ce0);}}try{_0x53faf9[_0x94b1('0x6d')]=_0x46893d[_0x94b1('0x9')]?JSON[_0x94b1('0x6c')](_0x46893d[_0x94b1('0x9')]):{};}catch(_0x4a759d){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4a759d);}if(_0x46893d[_0x94b1('0x6e')]){try{var _0x1dab3f=require(_0x46893d[_0x94b1('0x6e')])[_0x94b1('0x6f')](this,_0x53faf9);_0x53faf9[_0x94b1('0x70')]=Mustache['render'](_0x46893d[_0x94b1('0x71')],_0x1dab3f,{},['$$','$$']);if(_0x53faf9[_0x94b1('0x6d')]){_0x53faf9['headers']=JSON[_0x94b1('0x6c')](Mustache['render'](JSON['stringify'](_0x53faf9[_0x94b1('0x6d')]),_0x1dab3f,{},['$$','$$']));}if(_0x53faf9['body']){_0x53faf9[_0x94b1('0x72')]=JSON[_0x94b1('0x6c')](Mustache[_0x94b1('0x73')](JSON[_0x94b1('0x74')](_0x53faf9[_0x94b1('0x72')]),_0x1dab3f,{},['$$','$$']));}}catch(_0x4f182c){logger[_0x94b1('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4f182c);}}rp(_0x53faf9)[_0x94b1('0x11')](function(_0x2cb915){var _0x148ffa={'statusCode':_0x2cb915['statusCode']||0xc8,'statusMessage':_0x2cb915[_0x94b1('0x75')]||'OK','headers':_0x2cb915[_0x94b1('0x6d')]||{},'body':_0x2cb915['body']||{}};_0x486841(null,_0x148ffa);})['catch'](function(_0x260c9b){var _0x28cbfe={'statusCode':_0x260c9b[_0x94b1('0x76')]||0x1f4,'statusMessage':_0x260c9b[_0x94b1('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x260c9b[_0x94b1('0x78')]['headers']||{},'body':_0x260c9b[_0x94b1('0x78')]['body']||{}};_0x486841(null,_0x28cbfe);});};AGIVertices[_0x94b1('0xe')]['googleDialogflow']=function(_0x497c2f,_0x3f0958){scripts[_0x94b1('0x79')](this['channel'][_0x94b1('0x36')],_0x497c2f[_0x94b1('0x7a')],_0x497c2f[_0x94b1('0x60')],_0x497c2f['dialogflow_language']||'en')[_0x94b1('0x11')](function(_0x4a7083){_0x3f0958(null,_0x4a7083);})[_0x94b1('0x13')](function(_0x5d722e){_0x3f0958(_0x5d722e);});};AGIVertices[_0x94b1('0xe')]['googleDialogflowV2']=function(_0x595ae3,_0x238963){scripts['googleDialogflowV2'](this[_0x94b1('0x39')]['uniqueid'],_0x595ae3[_0x94b1('0x7b')],_0x595ae3['client_email'],_0x595ae3[_0x94b1('0x7c')],_0x595ae3['text'],_0x595ae3[_0x94b1('0x7d')]||'en')[_0x94b1('0x11')](function(_0x367431){_0x238963(null,_0x367431);})[_0x94b1('0x13')](function(_0x16ce3d){_0x238963(_0x16ce3d);});};AGIVertices[_0x94b1('0xe')]['sestekNDA']=function(_0x21e68e,_0x21c3b2){scripts[_0x94b1('0x7e')](this[_0x94b1('0x39')],_0x21e68e)[_0x94b1('0x11')](function(_0x470955){_0x21c3b2(null,_0x470955);})['catch'](function(_0x1e2f75){_0x21c3b2(_0x1e2f75);});};AGIVertices[_0x94b1('0xe')]['ispeechTTS']=function(_0x275f4a,_0xe8cf17){scripts[_0x94b1('0x7f')](_0x275f4a[_0x94b1('0x7a')],_0x275f4a[_0x94b1('0x60')],_0x275f4a[_0x94b1('0x80')]||_0x94b1('0x62'),_0x275f4a[_0x94b1('0x81')])[_0x94b1('0x11')](function(_0x100504){_0xe8cf17(null,_0x100504);})[_0x94b1('0x13')](function(_0x285d03){_0xe8cf17(_0x285d03);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x82')]=function(_0x22165b,_0x11638f,_0x40e78b){scripts[_0x94b1('0x82')](_0x11638f,_0x22165b[_0x94b1('0x7a')],_0x22165b[_0x94b1('0x83')]||_0x94b1('0x62'),this[_0x94b1('0x84')](_0x22165b[_0x94b1('0x85')])?_0x22165b[_0x94b1('0x85')]:undefined)[_0x94b1('0x11')](function(_0x293527){_0x40e78b(null,_0x293527);})[_0x94b1('0x13')](function(_0x1a75e6){_0x40e78b(_0x1a75e6);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x86')]=function(_0xa35c47,_0x472378){scripts['awsPolly'](_0xa35c47[_0x94b1('0x87')],_0xa35c47[_0x94b1('0x88')],_0xa35c47['aws_polly_region'],_0xa35c47['aws_polly_voice']||_0x94b1('0x89'),_0xa35c47['text'],_0xa35c47[_0x94b1('0x8a')]||'text')[_0x94b1('0x11')](function(_0x8e54eb){_0x472378(null,_0x8e54eb);})[_0x94b1('0x13')](function(_0x531170){_0x472378(_0x531170);});};AGIVertices['prototype'][_0x94b1('0x8b')]=function(_0x43f2c0,_0x43a3d2){scripts[_0x94b1('0x8b')](this[_0x94b1('0x39')][_0x94b1('0x36')],_0x43f2c0[_0x94b1('0x87')],_0x43f2c0['aws_secret_access_key'],_0x43f2c0[_0x94b1('0x8c')],_0x43f2c0[_0x94b1('0x60')],_0x43f2c0[_0x94b1('0x8d')])[_0x94b1('0x11')](function(_0x16b8c4){_0x43a3d2(null,_0x16b8c4);})[_0x94b1('0x13')](function(_0x516659){_0x43a3d2(_0x516659);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x8e')]=function(_0x5a73b1,_0x22e08e,_0x38939b){scripts['googleASR'](_0x22e08e,_0x5a73b1[_0x94b1('0x7a')],_0x5a73b1[_0x94b1('0x8f')]||_0x94b1('0x62'))['then'](function(_0x3415df){_0x38939b(null,_0x3415df);})[_0x94b1('0x13')](function(_0x4e6621){_0x38939b(_0x4e6621);});};AGIVertices['prototype'][_0x94b1('0x90')]=function(_0x3d1e1e,_0x26c84a,_0x4e44c4){scripts[_0x94b1('0x90')](_0x26c84a,_0x3d1e1e[_0x94b1('0x91')],_0x3d1e1e[_0x94b1('0x92')],_0x3d1e1e[_0x94b1('0x70')])[_0x94b1('0x11')](function(_0x3f5182){_0x4e44c4(null,_0x3f5182);})['catch'](function(_0x308a17){_0x4e44c4(_0x308a17);});};AGIVertices[_0x94b1('0xe')][_0x94b1('0x93')]=function(_0x3f5384){var _0x1a2952=_['includes'](verticesWithRetry,_0x3f5384[_0x94b1('0x38')])?_0x3f5384:_['clone'](_0x3f5384);for(var _0x4cc29e in _0x1a2952){if(_0x1a2952[_0x94b1('0x94')](_0x4cc29e)){if(_0x1a2952[_0x4cc29e]&&_[_0x94b1('0x95')](_0x1a2952[_0x4cc29e])){if(_[_0x94b1('0x96')](recursiveMapAttributes,_0x4cc29e)){_0x1a2952[_0x4cc29e]=this[_0x94b1('0x97')](_0x1a2952[_0x4cc29e]);}else{_0x1a2952[_0x4cc29e]=this['replaceAllVariables'](_0x1a2952[_0x4cc29e]);}}}}return _0x1a2952;};AGIVertices[_0x94b1('0xe')][_0x94b1('0x98')]=function(_0x2ba0fb){for(var _0x528f1e in _0x2ba0fb){if(_0x2ba0fb[_0x94b1('0x94')](_0x528f1e)){if(_[_0x94b1('0x99')](_0x2ba0fb[_0x528f1e])){this[_0x94b1('0x98')](_0x2ba0fb[_0x528f1e]);}else if(_['isArray'](_0x2ba0fb[_0x528f1e])){for(var _0x20f8f4=0x0;_0x20f8f4<_0x2ba0fb[_0x528f1e][_0x94b1('0x9a')];_0x20f8f4++){this['recursiveNodeIndex'](_0x2ba0fb[_0x528f1e][_0x20f8f4]);}}else if(_[_0x94b1('0x95')](_0x2ba0fb[_0x528f1e])){_0x2ba0fb[_0x528f1e]=this[_0x94b1('0x9b')](_0x2ba0fb[_0x528f1e]);}}}};AGIVertices[_0x94b1('0xe')][_0x94b1('0x9c')]=function(_0x3bfeee,_0x4a0b5a){for(var _0x5b9a71 in _0x3bfeee){if(_0x3bfeee['hasOwnProperty'](_0x5b9a71)){if(_[_0x94b1('0x99')](_0x3bfeee[_0x5b9a71])){if(!_[_0x94b1('0x45')](_0x3bfeee[_0x5b9a71])){this[_0x94b1('0x9c')](_0x3bfeee[_0x5b9a71],util['format'](_0x94b1('0x9d'),_0x4a0b5a,_0x5b9a71));}}else if(_[_0x94b1('0x9e')](_0x3bfeee[_0x5b9a71])){for(var _0x5257dd=0x0;_0x5257dd<_0x3bfeee[_0x5b9a71][_0x94b1('0x9a')];_0x5257dd++){this[_0x94b1('0x9c')](_0x3bfeee[_0x5b9a71][_0x5257dd],util[_0x94b1('0x26')](_0x94b1('0x9d'),_0x4a0b5a,_0x5b9a71+'['+_0x5257dd+']'));}}else{if(!_[_0x94b1('0x46')](_0x3bfeee[_0x5b9a71])){this[_0x94b1('0x39')][_0x94b1('0x9f')](util['format'](_0x94b1('0x9d'),_0x4a0b5a,_0x5b9a71),_0x3bfeee[_0x5b9a71]);}}}}};AGIVertices[_0x94b1('0xe')][_0x94b1('0x97')]=function(_0x3a408a){try{var _0x30e89d=JSON[_0x94b1('0x6c')](_0x3a408a);this[_0x94b1('0x98')](_0x30e89d);return JSON[_0x94b1('0x74')](_0x30e89d);}catch(_0x7a1040){return this['replaceAllVariables'](_0x3a408a);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x9b211c){var _0x95fa91=_0x9b211c[_0x94b1('0xa0')]('{');for(var _0x1e751f=0x1;_0x1e751f<_0x95fa91[_0x94b1('0x9a')];_0x1e751f+=0x1){var _0x1057de=_0x95fa91[_0x1e751f][_0x94b1('0xa0')]('}');if(_0x1057de[_0x94b1('0x9a')]>0x1){_0x9b211c=_0x9b211c[_0x94b1('0xa1')]('{'+_0x1057de[0x0]+'}',this[_0x94b1('0x39')][_0x94b1('0xf')](_0x1057de[0x0])['extra']||_0x1057de[0x0]);}}if(_0x95fa91['length']===0x1){return _0x9b211c['toString']();}return this['replaceAllVariables'](_0x9b211c);};AGIVertices[_0x94b1('0xe')][_0x94b1('0xa2')]=function(_0x213bcd,_0x45ad88){var _0x193aec=this[_0x94b1('0x39')][_0x94b1('0xf')](_0x213bcd);if(_0x193aec[_0x94b1('0xa3')]===-0x1){return _0x193aec;}logger['info'](util[_0x94b1('0x26')](_0x94b1('0xa4'),_0x45ad88,_0x193aec[_0x94b1('0xa5')]));return this['channel'][_0x94b1('0x9f')](_0x45ad88,_0x193aec[_0x94b1('0xa5')]);};AGIVertices[_0x94b1('0xe')][_0x94b1('0x84')]=function(_0x3c6575){return _0x3c6575&&_0x3c6575!=='0'&&_0x3c6575!=='-1'&&_0x3c6575!=='';};AGIVertices['prototype'][_0x94b1('0xa6')]=function(_0x2944bb){this[_0x94b1('0x35')][_0x94b1('0x6f')](this,_0x2944bb,'-');_0x2944bb[_0x94b1('0xa7')]=_0x2944bb[_0x94b1('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x94b1('0xe')][_0x94b1('0xa8')]=function(_0x162313){logger[_0x94b1('0x2b')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x162313[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x162313[_0x94b1('0x60')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0xaa'));}var _0x585f51='\x22'+_0x162313[_0x94b1('0x60')]+'\x22';if(this[_0x94b1('0x84')](_0x162313[_0x94b1('0x78')])){_0x585f51+=','+_0x162313['options'];}var _0x473483=this['channel'][_0x94b1('0x5b')](_0x94b1('0xab'),_0x585f51);if(_0x473483[_0x94b1('0xa3')]===-0x1){return _0x473483;}return this['channel'][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0xac'),_0x585f51));};AGIVertices[_0x94b1('0xe')][_0x94b1('0xad')]=function(_0x5e4d58){logger['info'](util[_0x94b1('0x26')](_0x94b1('0xae'),_0x5e4d58[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x5e4d58[_0x94b1('0xaf')])){return this['channel']['noop'](_0x94b1('0xb0'));}var _0x9f1e38=_0x5e4d58[_0x94b1('0xaf')];if(this[_0x94b1('0x84')](_0x5e4d58['options'])){_0x9f1e38+=','+_0x5e4d58['options'];}var _0x38d3cb=this[_0x94b1('0x39')]['exec'](_0x94b1('0xb1'),_0x9f1e38);if(_0x38d3cb[_0x94b1('0xa3')]===-0x1){return _0x38d3cb;}var _0x33bfc1=this[_0x94b1('0xa2')](_0x94b1('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x33bfc1[_0x94b1('0xa3')]===-0x1){return _0x33bfc1;}var _0x5e4296=this['getAndSetVariable'](_0x94b1('0xb3'),_0x94b1('0xb4'));if(_0x5e4296[_0x94b1('0xa3')]===-0x1){return _0x5e4296;}var _0x1079c5=this[_0x94b1('0xa2')](_0x94b1('0xb5'),_0x94b1('0xb6'));if(_0x1079c5[_0x94b1('0xa3')]===-0x1){return _0x1079c5;}return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x9f1e38));};AGIVertices[_0x94b1('0xe')]['agi']=function(_0x46ea92){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0xb7'),_0x46ea92[_0x94b1('0x37')]));return this['channel'][_0x94b1('0xb8')]([_0x46ea92[_0x94b1('0xb9')],_0x46ea92[_0x94b1('0xba')]]);};AGIVertices[_0x94b1('0xe')]['answer']=function(_0x4bf828){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0xbb'),_0x4bf828['label']));if(this[_0x94b1('0x84')](_0x4bf828[_0x94b1('0x68')])){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0xbc'),_0x4bf828[_0x94b1('0x68')]));var _0x2b551f=this[_0x94b1('0x39')][_0x94b1('0xbd')](_0x4bf828['timeout']);if(_0x2b551f[_0x94b1('0xa3')]===-0x1){return _0x2b551f;}}return this['channel'][_0x94b1('0xbe')]();};AGIVertices['prototype'][_0x94b1('0x4d')]=function(_0x1edb79){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0xbf'),_0x1edb79[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x1edb79[_0x94b1('0x4b')])){return this['channel']['error'](_0x1edb79,'no\x20list\x20selected');}_0x1edb79[_0x94b1('0x4c')]=moment();if(this[_0x94b1('0x84')](_0x1edb79[_0x94b1('0xc0')])){_0x1edb79['scheduledAt']=moment()[_0x94b1('0xc1')](_0x1edb79[_0x94b1('0xc0')],_0x94b1('0xc2'));}if(!this[_0x94b1('0x84')](_0x1edb79[_0x94b1('0x4f')])){_0x1edb79['callback_priority']=0x2;}this[_0x94b1('0x44')][_0x94b1('0x6f')](this,_0x1edb79);return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0xc3'),_0x1edb79[_0x94b1('0x4a')],_0x1edb79[_0x94b1('0x4b')],_0x1edb79[_0x94b1('0x4c')]));};AGIVertices[_0x94b1('0xe')][_0x94b1('0xc4')]=function(_0x3f8d7e){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x3f8d7e[_0x94b1('0x37')]));var _0x7e2ebe=this[_0x94b1('0x39')][_0x94b1('0x5b')](_0x3f8d7e[_0x94b1('0xc5')],_0x3f8d7e[_0x94b1('0x78')]);if(_0x7e2ebe[_0x94b1('0xa3')]===-0x1){return _0x7e2ebe;}return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0xc6'),_0x3f8d7e['application'],_0x3f8d7e[_0x94b1('0x78')]));};AGIVertices[_0x94b1('0xe')][_0x94b1('0xc7')]=function(_0x557d65){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0xc8'),_0x557d65[_0x94b1('0x37')]));if(!this['isConfigured'](_0x557d65[_0x94b1('0x60')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')]('no\x20text\x20configured');}var _0x36d72a='\x22'+_0x557d65['text']+'\x22';if(this[_0x94b1('0x84')](_0x557d65[_0x94b1('0x78')])){_0x36d72a+=','+_0x557d65[_0x94b1('0x78')];}var _0xd04785=this[_0x94b1('0x39')]['exec'](_0x94b1('0xab'),_0x36d72a);if(_0xd04785[_0x94b1('0xa3')]===-0x1){return _0xd04785;}return this['channel'][_0x94b1('0xa9')](util['format'](_0x94b1('0xac'),_0x36d72a));};AGIVertices[_0x94b1('0xe')][_0x94b1('0xc9')]=function(_0x1e75c6){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0xca'),_0x1e75c6[_0x94b1('0x37')]));if(!this['isConfigured'](_0x1e75c6['text'])){return this[_0x94b1('0x39')][_0x94b1('0xa9')]('no\x20text\x20configured');}var _0x32dac7='\x22'+_0x1e75c6['text']+'\x22';if(this[_0x94b1('0x84')](_0x1e75c6['options'])){_0x32dac7+=','+_0x1e75c6['options'];}var _0x56d4b8=this['channel'][_0x94b1('0x5b')]('MRCPSynth',_0x32dac7);if(_0x56d4b8[_0x94b1('0xa3')]===-0x1){return _0x56d4b8;}return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x32dac7));};AGIVertices[_0x94b1('0xe')][_0x94b1('0xcb')]=function(_0x32e0cf){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x32e0cf[_0x94b1('0x37')]));if(!this['isConfigured'](_0x32e0cf[_0x94b1('0xaf')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0xb0'));}var _0x4ef13c=_0x32e0cf['grammar'];if(this[_0x94b1('0x84')](_0x32e0cf['options'])){_0x4ef13c+=','+_0x32e0cf[_0x94b1('0x78')];}var _0xf0521e=this[_0x94b1('0x39')]['exec'](_0x94b1('0xb1'),_0x4ef13c);if(_0xf0521e[_0x94b1('0xa3')]===-0x1){return _0xf0521e;}var _0x5e4556=this['getAndSetVariable'](_0x94b1('0xb2'),_0x94b1('0xcc'));if(_0x5e4556['result']===-0x1){return _0x5e4556;}var _0xd822e7=this[_0x94b1('0xa2')](_0x94b1('0xb3'),_0x94b1('0xcd'));if(_0xd822e7[_0x94b1('0xa3')]===-0x1){return _0xd822e7;}var _0x13d8fa=this[_0x94b1('0xa2')](_0x94b1('0xb5'),_0x94b1('0xce'));if(_0x13d8fa[_0x94b1('0xa3')]===-0x1){return _0x13d8fa;}return this[_0x94b1('0x39')][_0x94b1('0xa9')](util['format'](_0x94b1('0xcf'),_0x4ef13c));};AGIVertices['prototype'][_0x94b1('0xd0')]=function(_0x2556a8){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2556a8[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x2556a8['grammar'])){return this[_0x94b1('0x39')][_0x94b1('0xa9')]('no\x20grammar\x20configured');}var _0x429e54=_0x2556a8['grammar'];if(this[_0x94b1('0x84')](_0x2556a8['options'])){_0x429e54+=','+_0x2556a8[_0x94b1('0x78')];}var _0x53b701=this[_0x94b1('0x39')][_0x94b1('0x5b')](_0x94b1('0xb1'),_0x429e54);if(_0x53b701[_0x94b1('0xa3')]===-0x1){return _0x53b701;}var _0x4e6bb3=this[_0x94b1('0xa2')](_0x94b1('0xb2'),'SESTEK_ASR_CONFIDENCE');if(_0x4e6bb3[_0x94b1('0xa3')]===-0x1){return _0x4e6bb3;}var _0x4393de=this[_0x94b1('0xa2')](_0x94b1('0xb3'),_0x94b1('0xd1'));if(_0x4393de[_0x94b1('0xa3')]===-0x1){return _0x4393de;}var _0x2d8d52=this[_0x94b1('0xa2')](_0x94b1('0xb5'),_0x94b1('0xd2'));if(_0x2d8d52[_0x94b1('0xa3')]===-0x1){return _0x2d8d52;}return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0xcf'),_0x429e54));};AGIVertices['prototype'][_0x94b1('0xd3')]=function(_0x8f14ca){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0xd4'),_0x8f14ca[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x8f14ca[_0x94b1('0xd5')])){return this['channel'][_0x94b1('0x2a')](_0x8f14ca,_0x94b1('0xd6'));}var _0x2e63e7=this[_0x94b1('0xd7')][_0x94b1('0x6f')](this,_0x8f14ca[_0x94b1('0xd5')]);if(!_0x2e63e7){return this[_0x94b1('0x39')]['error'](_0x8f14ca,_0x94b1('0xd8'));}if(!this['isConfigured'](_0x8f14ca[_0x94b1('0x2d')])){return this['channel'][_0x94b1('0x2a')](_0x8f14ca,'no\x20query\x20configured');}var _0x599966=_0x8f14ca[_0x94b1('0x2d')][_0x94b1('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')]('query:\x20%s',_0x599966));var _0x11664a=this[_0x94b1('0x28')][_0x94b1('0x6f')](this,_0x2e63e7,_0x599966);this['createSquareDetailsReport'][_0x94b1('0x6f')](this,_0x8f14ca,_0x599966);if(!this[_0x94b1('0x84')](_0x8f14ca[_0x94b1('0xd9')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0xda'));}var _0x41d113=this['getVariable'][_0x94b1('0x6f')](this,_0x8f14ca[_0x94b1('0xd9')]);if(!_0x41d113){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x8f14ca,_0x94b1('0xdb'));}var _0x3e7b9b=this;_0x11664a[_0x94b1('0xdc')](function(_0x1c08ef,_0x5f504d){Object[_0x94b1('0xdd')](_0x1c08ef)['forEach'](function(_0x33c020){_0x3e7b9b[_0x94b1('0x39')][_0x94b1('0x9f')](util[_0x94b1('0x26')](_0x94b1('0xde'),_0x41d113,_0x5f504d,_0x33c020),_0x1c08ef[_0x33c020]);});});this[_0x94b1('0x39')][_0x94b1('0x9f')](util['format'](_0x94b1('0xdf'),_0x41d113),_0x11664a[_0x94b1('0x9a')]);return this['channel'][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0xe0'),_0x41d113));};AGIVertices[_0x94b1('0xe')][_0x94b1('0xe1')]=function(_0x24d74e){logger['debug'](util[_0x94b1('0x26')](_0x94b1('0xe2'),_0x24d74e['label']));if(!this[_0x94b1('0x84')](_0x24d74e[_0x94b1('0xe3')])){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x24d74e,_0x94b1('0xe4'));}var _0x562687=this['getUser'][_0x94b1('0x6f')](this,_0x24d74e['sip_id']);if(!_0x562687){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x24d74e,_0x94b1('0xe5'));}var _0x3ce2c2=this[_0x94b1('0x39')]['exec'](_0x94b1('0xe6'),[util[_0x94b1('0x26')]('SIP/%s',_0x562687),_0x24d74e[_0x94b1('0x68')],_0x24d74e['opts'],_0x24d74e[_0x94b1('0x71')]]);if(_0x3ce2c2['result']===-0x1){return _0x3ce2c2;}return this['channel'][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0xe7'),_0x94b1('0xe6')));};AGIVertices[_0x94b1('0xe')][_0x94b1('0xe8')]=function(_0x2793a8){logger['info'](util[_0x94b1('0x26')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2793a8[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x2793a8['key'])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0xe9'));}if(!this[_0x94b1('0x84')](_0x2793a8[_0x94b1('0x60')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')]('no\x20text\x20configured');}this[_0x94b1('0x39')][_0x94b1('0xea')]=!![];this[_0x94b1('0x35')](_0x2793a8);this[_0x94b1('0x43')](_0x2793a8[_0x94b1('0x60')],'in','','');this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')](_0x94b1('0xeb'),_0x2793a8[_0x94b1('0x60')]));var _0x20509e=this['googleDialogflow']['sync'](this,_0x2793a8);if(_0x20509e){for(var _0x3fcb77 in _0x20509e){if(_0x20509e[_0x94b1('0x94')](_0x3fcb77)){this['channel'][_0x94b1('0x9f')](util[_0x94b1('0x26')](_0x94b1('0xec'),_0x3fcb77[_0x94b1('0xed')]()),_0x20509e[_0x3fcb77]);}}this[_0x94b1('0x43')](_0x20509e[_0x94b1('0xee')],_0x94b1('0xef'),_0x94b1('0xe8'),'');return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0xf0'),_0x20509e[_0x94b1('0xee')]));}return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x2793a8,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x94b1('0xe')][_0x94b1('0xf1')]=function(_0x350d21){logger['info'](util[_0x94b1('0x26')](_0x94b1('0xf2'),_0x350d21['label']));if(!this[_0x94b1('0x84')](_0x350d21['dialogflowV2_project_id'])){return this['channel'][_0x94b1('0xa9')](_0x94b1('0xf3'));}if(!this[_0x94b1('0x84')](_0x350d21[_0x94b1('0xf4')])){return this['channel'][_0x94b1('0xa9')]('no\x20client_email\x20configured');}if(!this[_0x94b1('0x84')](_0x350d21['private_key'])){return this['channel']['noop'](_0x94b1('0xf5'));}if(!this[_0x94b1('0x84')](_0x350d21[_0x94b1('0x7d')])){return this['channel'][_0x94b1('0xa9')](_0x94b1('0xf6'));}if(!this[_0x94b1('0x84')](_0x350d21[_0x94b1('0x60')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0xaa'));}this[_0x94b1('0x39')]['bot']=!![];this[_0x94b1('0x35')](_0x350d21);this['createSquareMessage'](_0x350d21[_0x94b1('0x60')],'in','','');this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0xf7'),_0x350d21[_0x94b1('0x60')]));var _0x2e1cbe=this[_0x94b1('0xf8')][_0x94b1('0x6f')](this,_0x350d21);if(_0x2e1cbe){for(var _0x52583c in _0x2e1cbe){if(_0x2e1cbe[_0x94b1('0x94')](_0x52583c)){if(_0x52583c!==_0x94b1('0xf9')){this['channel'][_0x94b1('0x9f')](util[_0x94b1('0x26')]('DIALOGFLOW_%s',_0x52583c[_0x94b1('0xed')]()),_0x2e1cbe[_0x52583c]);}}}this[_0x94b1('0x43')](_0x2e1cbe[_0x94b1('0xee')],_0x94b1('0xef'),_0x94b1('0xf1'),_0x2e1cbe[_0x94b1('0xf9')]);return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0xfa'),_0x2e1cbe[_0x94b1('0xee')]));}return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x350d21,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x94b1('0xe')][_0x94b1('0xfb')]=function(_0x4f542a){logger['info'](util[_0x94b1('0x26')](_0x94b1('0xfc'),_0x4f542a[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x4f542a[_0x94b1('0xfd')])){return this[_0x94b1('0x39')]['noop'](_0x94b1('0xfe'));}if(!this['isConfigured'](_0x4f542a[_0x94b1('0xff')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')]('no\x20username\x20configured');}if(!this[_0x94b1('0x84')](_0x4f542a[_0x94b1('0x100')])){return this['channel'][_0x94b1('0xa9')](_0x94b1('0x101'));}if(!this[_0x94b1('0x84')](_0x4f542a[_0x94b1('0x102')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0xaa'));}this['channel'][_0x94b1('0xea')]=!![];this['createSquareDetailsReport'](_0x4f542a);this[_0x94b1('0x43')](_0x4f542a['text'],'in','','');this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')](_0x94b1('0x103'),_0x4f542a[_0x94b1('0x60')]));var _0x27c54f=this[_0x94b1('0x7e')][_0x94b1('0x6f')](this,_0x4f542a);if(_0x27c54f){for(var _0x248302 in _0x27c54f){if(_0x27c54f[_0x94b1('0x94')](_0x248302)){this['channel'][_0x94b1('0x9f')](util[_0x94b1('0x26')](_0x94b1('0x104'),_0x248302['toUpperCase']()),_0x27c54f[_0x248302]);}}this[_0x94b1('0x43')](_0x27c54f[_0x94b1('0xee')],_0x94b1('0xef'),_0x94b1('0xfb'),'');if(_0x27c54f[_0x94b1('0x105')]){this[_0x94b1('0x39')][_0x94b1('0xa9')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x27c54f[_0x94b1('0x105')]));var _0x2b32d3=this[_0x94b1('0x39')][_0x94b1('0x106')](_0x27c54f[_0x94b1('0x105')]);try{fs[_0x94b1('0x107')](_0x27c54f[_0x94b1('0x105')]+_0x94b1('0x108'));}catch(_0x1af87f){logger[_0x94b1('0x2a')](_0x1af87f);}return _0x2b32d3;}else{return this[_0x94b1('0x39')][_0x94b1('0xa9')](util['format']('SestekNDA\x20Result\x20%s',_0x27c54f[_0x94b1('0xee')]));}}return this['channel']['error'](_0x4f542a,_0x94b1('0x109'));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x10a')]=function(_0x1dd25b){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x10b'),_0x1dd25b[_0x94b1('0x37')]));return this[_0x94b1('0x39')]['noop']('end');};AGIVertices[_0x94b1('0xe')][_0x94b1('0x10c')]=function(_0x1d515d){logger['info'](util[_0x94b1('0x26')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x1d515d[_0x94b1('0x37')]));var _0x41ee06='';if(_0x1d515d['trunk_id']){if(!this[_0x94b1('0x84')](_0x1d515d['trunk_id'])){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x1d515d,_0x94b1('0x10d'));}else{var _0x9c463c=parseInt(_0x1d515d[_0x94b1('0x10e')],0xa);if(isNaN(_0x9c463c)){_0x41ee06=_0x1d515d[_0x94b1('0x10e')];}else{_0x41ee06=this[_0x94b1('0x10f')][_0x94b1('0x6f')](this,_0x1d515d['trunk_id']);if(!_0x41ee06){return this['channel'][_0x94b1('0x2a')](_0x1d515d,_0x94b1('0x110'));}}}}else if(_0x1d515d[_0x94b1('0x111')]){_0x41ee06=_0x1d515d[_0x94b1('0x111')];}else{return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x1d515d,_0x94b1('0x10d'));}var _0x56cb65=this['channel'][_0x94b1('0x5b')]('DIAL',[util['format']('SIP/%s/%s',_0x41ee06,_0x1d515d[_0x94b1('0x4a')]),_0x1d515d[_0x94b1('0x68')],_0x1d515d[_0x94b1('0x112')],_0x1d515d[_0x94b1('0x71')]]);if(_0x56cb65[_0x94b1('0xa3')]===-0x1){return _0x56cb65;}return this['channel'][_0x94b1('0xa9')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x113')]=function(_0x26ca67){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x114'),_0x26ca67[_0x94b1('0x37')]));return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0x113'));};AGIVertices[_0x94b1('0xe')][_0x94b1('0xb')]=function(_0x64e990){logger[_0x94b1('0x2b')](util['format'](_0x94b1('0x115'),_0x64e990[_0x94b1('0x37')]));if(_0x64e990[_0x94b1('0xa7')]===0x0){return this[_0x94b1('0xa6')](_0x64e990);}_0x64e990['retry']-=0x1;if(!this[_0x94b1('0x84')](_0x64e990[_0x94b1('0x116')])){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x64e990,_0x94b1('0x117'));}var _0x30deb7=this[_0x94b1('0x1b')][_0x94b1('0x6f')](this,_0x64e990[_0x94b1('0x116')]);if(!_0x30deb7){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x64e990,_0x94b1('0x118'));}if(!this[_0x94b1('0x84')](_0x64e990[_0x94b1('0xd9')])){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x94b1('0xda'));}var _0x53e4c5=this['channel'][_0x94b1('0x119')](_0x30deb7,_0x64e990[_0x94b1('0x11a')],_0x64e990[_0x94b1('0x11b')]);var _0x2d753a=_0x53e4c5['result']?_0x53e4c5[_0x94b1('0xa3')][_0x94b1('0x4e')]():'';logger[_0x94b1('0x2b')](_0x94b1('0x11c'),JSON[_0x94b1('0x74')](_0x53e4c5));if(_0x53e4c5[_0x94b1('0xa3')]===-0x1){this[_0x94b1('0x35')]['sync'](this,_0x64e990,_0x2d753a);return _0x53e4c5;}else if(_0x53e4c5[_0x94b1('0xa5')]===_0x94b1('0x68')){_0x53e4c5[_0x94b1('0xa3')]=_0x2d753a[_0x94b1('0x9a')]>=parseInt(_0x64e990['mindigit'])?'x':'i';}else{_0x53e4c5[_0x94b1('0xa3')]=_0x2d753a['length']>=parseInt(_0x64e990[_0x94b1('0x11d')])&&_0x2d753a[_0x94b1('0x9a')]<=parseInt(_0x64e990[_0x94b1('0x11b')])?'x':'i';}var _0x2a980c=this[_0x94b1('0xf')][_0x94b1('0x6f')](this,_0x64e990['variable_id']);if(!_0x2a980c){return this[_0x94b1('0x39')]['error'](_0x64e990,_0x94b1('0xdb'));}this[_0x94b1('0x39')][_0x94b1('0x9f')](_0x2a980c,_0x2d753a);if(this[_0x94b1('0x84')](_0x64e990[_0x94b1('0x11e')])){var _0x2c2102=parseInt(_0x64e990[_0x94b1('0x11e')],0xa);var _0x3150fa=rs[_0x94b1('0x11f')]({'charset':'*','length':_0x2c2102});var _0x40c1ea=_0x2d753a['length'];if(_0x40c1ea>0x0){if(_0x40c1ea>_0x2c2102){this[_0x94b1('0x35')][_0x94b1('0x6f')](this,_0x64e990,_0x64e990[_0x94b1('0x120')]===_0x94b1('0x121')?_0x3150fa+_0x2d753a[_0x94b1('0x122')](_0x2c2102):_0x2d753a[_0x94b1('0x122')](0x0,_0x40c1ea-_0x2c2102)+_0x3150fa);}else{this[_0x94b1('0x35')][_0x94b1('0x6f')](this,_0x64e990,rs[_0x94b1('0x11f')]({'charset':'*','length':_0x40c1ea}));}}else{this[_0x94b1('0x35')]['sync'](this,_0x64e990,'');}}else{this[_0x94b1('0x35')][_0x94b1('0x6f')](this,_0x64e990,_0x2d753a);}return _0x53e4c5;};AGIVertices[_0x94b1('0xe')][_0x94b1('0xc')]=function(_0x335be9){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x123'),_0x335be9[_0x94b1('0x37')]));return this[_0x94b1('0xb')](_0x335be9);};AGIVertices[_0x94b1('0xe')][_0x94b1('0x124')]=function(_0x1588fe){logger[_0x94b1('0x2b')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1588fe[_0x94b1('0x37')]));this['createSquareDetailsReport'][_0x94b1('0x6f')](this,_0x1588fe,_0x1588fe[_0x94b1('0x125')]);return this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')](_0x94b1('0x126'),_0x1588fe[_0x94b1('0x125')]));};AGIVertices['prototype'][_0x94b1('0x127')]=function(_0xde34ca){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x128'),_0xde34ca[_0x94b1('0x37')]));if(!this['isConfigured'](_0xde34ca[_0x94b1('0x87')])||!this[_0x94b1('0x84')](_0xde34ca[_0x94b1('0x88')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0x129'));}if(!this[_0x94b1('0x84')](_0xde34ca[_0x94b1('0x60')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0xaa'));}this['channel'][_0x94b1('0xa9')](util[_0x94b1('0x26')]('Trying\x20aws\x20Polly\x20%s',_0xde34ca['text']));var _0x21a20f=this['awsPolly'][_0x94b1('0x6f')](this,_0xde34ca);if(_0x21a20f){this['channel'][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x12a'),_0x21a20f));var _0x2ab69f=this[_0x94b1('0x39')]['streamFile'](_0x21a20f);try{fs[_0x94b1('0x107')](_0x21a20f+'.wav');}catch(_0x5c3d6d){logger[_0x94b1('0x2a')](_0x5c3d6d);}return _0x2ab69f;}return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0xde34ca,_0x94b1('0x12b'));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x12c')]=function(_0x1baca5){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x12d'),_0x1baca5['label']));if(!this[_0x94b1('0x84')](_0x1baca5[_0x94b1('0x87')])||!this['isConfigured'](_0x1baca5[_0x94b1('0x88')])){return this['channel'][_0x94b1('0xa9')](_0x94b1('0x129'));}if(!this['isConfigured'](_0x1baca5[_0x94b1('0x8d')])){return this[_0x94b1('0x39')]['noop'](_0x94b1('0x12e'));}if(!this[_0x94b1('0x84')](_0x1baca5[_0x94b1('0x60')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0xaa'));}this[_0x94b1('0x39')][_0x94b1('0xea')]=!![];this[_0x94b1('0x35')](_0x1baca5);this['createSquareMessage'](_0x1baca5[_0x94b1('0x60')],'in','','');this[_0x94b1('0x39')][_0x94b1('0xa9')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x1baca5[_0x94b1('0x60')]));var _0x55dbea=this[_0x94b1('0x8b')][_0x94b1('0x6f')](this,_0x1baca5);if(_0x55dbea){for(var _0x160d66 in _0x55dbea){if(_0x55dbea['hasOwnProperty'](_0x160d66)&&_[_0x94b1('0x95')](_0x55dbea[_0x160d66])){this['channel'][_0x94b1('0x9f')](util[_0x94b1('0x26')]('AWS_LEX_%s',_0x160d66[_0x94b1('0xed')]()),_0x55dbea[_0x160d66]);}}if(_[_0x94b1('0x46')](_0x55dbea['message'])){return this[_0x94b1('0x39')]['noop'](_0x94b1('0x12f'));}else{this['createSquareMessage'](_0x55dbea[_0x94b1('0x77')],_0x94b1('0xef'),_0x94b1('0x130'),'');return this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')](_0x94b1('0x131'),_0x55dbea[_0x94b1('0x77')]));}}return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x1baca5,_0x94b1('0x132'));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x133')]=function(_0x3936f5){logger['info'](util[_0x94b1('0x26')](_0x94b1('0x134'),_0x3936f5[_0x94b1('0x37')],_0x3936f5[_0x94b1('0x68')]));if(!this[_0x94b1('0x84')](_0x3936f5['key'])){return this[_0x94b1('0x39')]['noop'](_0x94b1('0xe9'));}var _0x838dc1='wav';var _0x753331=util[_0x94b1('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0x94b1('0x11f')](0x4));var _0x2cad3e=util['format'](_0x94b1('0x9d'),_0x753331,_0x838dc1);var _0x5cdc6c=!![];if(_0x3936f5['beep']===_0x94b1('0x135')){_0x5cdc6c=![];}var _0x114141=this['channel'][_0x94b1('0x136')](_0x753331,_0x838dc1,_0x3936f5[_0x94b1('0x137')],_0x3936f5['timeout'],undefined,_0x5cdc6c);if(_0x114141[_0x94b1('0xa3')]!==-0x1){this[_0x94b1('0x39')][_0x94b1('0xa9')](util['format'](_0x94b1('0x138'),_0x2cad3e));var _0x5ca5f7=this[_0x94b1('0x8e')]['sync'](this,_0x3936f5,_0x2cad3e);if(_0x5ca5f7){for(var _0x3c4b86 in _0x5ca5f7){if(_0x5ca5f7[_0x94b1('0x94')](_0x3c4b86)){this[_0x94b1('0x39')][_0x94b1('0x9f')](util[_0x94b1('0x26')](_0x94b1('0x139'),_0x3c4b86[_0x94b1('0xed')]()),_0x5ca5f7[_0x3c4b86]);}}return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')]('GoogleASR\x20Result\x20%s',JSON[_0x94b1('0x74')](_0x5ca5f7)));}}return _0x114141;};AGIVertices['prototype']['tildeasr']=function(_0x2c18c5){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x13a'),_0x2c18c5[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x2c18c5[_0x94b1('0x91')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0x13b'));}if(!this[_0x94b1('0x84')](_0x2c18c5['appsecret'])){return this['channel']['noop'](_0x94b1('0x13c'));}var _0x130961=_0x94b1('0x13d');var _0x2ecb8e=util['format'](_0x94b1('0x13e'),FILES_PATH,rs[_0x94b1('0x11f')](0x4));var _0xb027ed=util['format'](_0x94b1('0x9d'),_0x2ecb8e,_0x130961);var _0x3e1349=!![];if(_0x2c18c5['beep']===_0x94b1('0x135')){_0x3e1349=![];}var _0x3290f4=this['channel'][_0x94b1('0x136')](_0x2ecb8e,_0x130961,_0x2c18c5[_0x94b1('0x137')],_0x2c18c5[_0x94b1('0x68')],undefined,_0x3e1349);if(_0x3290f4['result']!==-0x1){this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x13f'),_0xb027ed));var _0x22f429=this[_0x94b1('0x90')][_0x94b1('0x6f')](this,_0x2c18c5,_0xb027ed);if(_0x22f429){for(var _0xe228b5 in _0x22f429){if(_0x22f429[_0x94b1('0x94')](_0xe228b5)){this[_0x94b1('0x39')][_0x94b1('0x9f')](util[_0x94b1('0x26')]('TILDE_ASR_%s',_0xe228b5['toUpperCase']()),_0x22f429[_0xe228b5]);}}return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x22f429)));}}return _0x3290f4;};AGIVertices['prototype'][_0x94b1('0x140')]=function(_0x325b56){logger[_0x94b1('0x2b')](util['format'](_0x94b1('0x141'),_0x325b56[_0x94b1('0x37')]));return this[_0x94b1('0x39')][_0x94b1('0x142')](_0x325b56[_0x94b1('0x3e')],_0x325b56[_0x94b1('0x3f')],_0x325b56[_0x94b1('0x40')]);};AGIVertices[_0x94b1('0xe')][_0x94b1('0x143')]=function(_0x137556){logger['info'](util['format'](_0x94b1('0x144'),_0x137556[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x137556['condition'])){return this['channel'][_0x94b1('0x2a')](_0x137556,_0x94b1('0x145'));}try{var _0x28aeee=eval(_0x137556['condition'])?'true':'false';this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')](_0x94b1('0x146'),_0x137556[_0x94b1('0x147')],_0x28aeee));return{'code':0xc8,'result':_0x28aeee};}catch(_0x1ddc7d){return{'code':0xc8,'result':_0x94b1('0x148')};}};AGIVertices[_0x94b1('0xe')][_0x94b1('0x149')]=function(_0x3b26c1){logger[_0x94b1('0x2b')](util['format'](_0x94b1('0x14a'),_0x3b26c1[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x3b26c1[_0x94b1('0x14b')])){return this[_0x94b1('0x39')]['error'](_0x3b26c1,'no\x20interval\x20configured');}var _0x4a3ce0=this[_0x94b1('0x21')]['sync'](this,_0x3b26c1[_0x94b1('0x14b')]);if(!_0x4a3ce0){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x3b26c1,_0x94b1('0x14c'));}for(var _0x1d366d=0x0;_0x1d366d<_0x4a3ce0[_0x94b1('0x9a')];_0x1d366d+=0x1){var _0x71c966=this[_0x94b1('0x39')][_0x94b1('0xf')](util[_0x94b1('0x26')](_0x94b1('0x14d'),_0x4a3ce0[_0x1d366d]));if(_0x71c966[_0x94b1('0xa3')]===-0x1){return _0x71c966;}logger[_0x94b1('0x2b')](util[_0x94b1('0x26')]('IFTIME\x20%s\x20%s',_0x4a3ce0[_0x1d366d],_0x71c966[_0x94b1('0xa5')]));if(_0x71c966['extra']===_0x94b1('0x14e')){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x14f'),_0x4a3ce0[_0x1d366d],_0x94b1('0x14e')));this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x14f'),_0x4a3ce0[_0x1d366d],_0x94b1('0x14e')));return{'code':0xc8,'result':_0x94b1('0x14e')};}else{logger['info'](util[_0x94b1('0x26')]('IFTIME\x20%s\x20%s',_0x4a3ce0[_0x1d366d],_0x94b1('0x148')));this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')]('IFTIME\x20%s\x20%s',_0x4a3ce0[_0x1d366d],_0x94b1('0x148')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x94b1('0xe')][_0x94b1('0x150')]=function(_0x12bc65){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x151'),_0x12bc65[_0x94b1('0x37')]));return this[_0x94b1('0x39')][_0x94b1('0x150')]();};AGIVertices['prototype']['ispeechasr']=function(_0x425a80){logger[_0x94b1('0x2b')](util['format'](_0x94b1('0x152'),_0x425a80[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x425a80[_0x94b1('0x7a')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0xe9'));}var _0x4d5526=_0x94b1('0x13d');var _0x361b3f=util[_0x94b1('0x26')](_0x94b1('0x13e'),FILES_PATH,rs[_0x94b1('0x11f')](0x4));var _0x3ebc79=util['format'](_0x94b1('0x9d'),_0x361b3f,_0x4d5526);var _0x44afde=!![];if(_0x425a80[_0x94b1('0x153')]===_0x94b1('0x135')){_0x44afde=![];}var _0x2e4358=this[_0x94b1('0x39')][_0x94b1('0x136')](_0x361b3f,_0x4d5526,_0x425a80[_0x94b1('0x137')],_0x425a80['timeout'],undefined,_0x44afde);if(_0x2e4358[_0x94b1('0xa3')]!==-0x1){this['channel'][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x154'),_0x3ebc79));var _0x5496e7=this[_0x94b1('0x82')][_0x94b1('0x6f')](this,_0x425a80,_0x3ebc79);if(_0x5496e7){for(var _0x2dd5ab in _0x5496e7){if(_0x5496e7['hasOwnProperty'](_0x2dd5ab)){this[_0x94b1('0x39')][_0x94b1('0x9f')](util[_0x94b1('0x26')](_0x94b1('0x155'),_0x2dd5ab[_0x94b1('0xed')]()),_0x5496e7[_0x2dd5ab]);}}return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x156'),JSON[_0x94b1('0x74')](_0x5496e7)));}}return _0x2e4358;};AGIVertices[_0x94b1('0xe')]['ispeechtts']=function(_0x14110c){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x14110c[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x14110c[_0x94b1('0x7a')])){return this['channel'][_0x94b1('0xa9')](_0x94b1('0xe9'));}if(!this[_0x94b1('0x84')](_0x14110c['text'])){return this[_0x94b1('0x39')][_0x94b1('0xa9')]('no\x20text\x20configured');}this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')]('Trying\x20ispeech\x20TTS\x20%s',_0x14110c[_0x94b1('0x60')]));var _0x121225=this['ispeechTTS'][_0x94b1('0x6f')](this,_0x14110c);if(_0x121225){this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x154'),_0x121225));var _0x5b7623=this[_0x94b1('0x39')][_0x94b1('0x106')](_0x121225,_0x14110c[_0x94b1('0x137')]);try{fs[_0x94b1('0x107')](_0x121225+'.wav');}catch(_0x680607){logger[_0x94b1('0x2a')](_0x680607);}return _0x5b7623;}return this['channel'][_0x94b1('0x2a')](_0x14110c,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['login']=function(_0x59153f){logger[_0x94b1('0x2b')](util['format'](_0x94b1('0x157'),_0x59153f[_0x94b1('0x37')]));if(!this['isConfigured'](_0x59153f['findBy'])){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x59153f,'no\x20find\x20by\x20configured');}logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x158'),this[_0x94b1('0x39')]['callerid'],_0x59153f[_0x94b1('0x159')]));var _0x388a6c=this[_0x94b1('0x56')]['sync'](this,_0x59153f['findBy']);if(_0x388a6c){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x15a'),this['channel']['callerid'],_0x59153f[_0x94b1('0x159')]));this['channel'][_0x94b1('0xa9')](util[_0x94b1('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x94b1('0x39')]['callerid'],_0x59153f[_0x94b1('0x159')]));return{'code':0xc8,'result':_0x94b1('0x15b')};}else{logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x15c'),this[_0x94b1('0x39')][_0x94b1('0x3b')],_0x59153f[_0x94b1('0x159')]));this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')](_0x94b1('0x15c'),this[_0x94b1('0x39')][_0x94b1('0x3b')],_0x59153f['findBy']));return{'code':0xc8,'result':_0x94b1('0x15d')};}};AGIVertices[_0x94b1('0xe')][_0x94b1('0x15e')]=function(_0xadff7a){logger['info'](util[_0x94b1('0x26')](_0x94b1('0x15f'),_0xadff7a[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0xadff7a['findBy'])){return this[_0x94b1('0x39')]['error'](_0xadff7a,_0x94b1('0x160'));}logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x158'),this[_0x94b1('0x39')]['callerid'],_0xadff7a[_0x94b1('0x159')]));var _0x31fd40=this['agentLogout'][_0x94b1('0x6f')](this,_0xadff7a[_0x94b1('0x159')]);if(_0x31fd40){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x94b1('0x39')]['callerid'],_0xadff7a[_0x94b1('0x159')]));this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x15a'),this[_0x94b1('0x39')][_0x94b1('0x3b')],_0xadff7a[_0x94b1('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x94b1('0x2b')](util[_0x94b1('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x94b1('0x3b')],_0xadff7a[_0x94b1('0x159')]));this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x15c'),this[_0x94b1('0x39')][_0x94b1('0x3b')],_0xadff7a['findBy']));return{'code':0xc8,'result':_0x94b1('0x15d')};}};AGIVertices[_0x94b1('0xe')]['math']=function(_0x2899a2){logger['info'](util[_0x94b1('0x26')](_0x94b1('0x161'),_0x2899a2['label']));if(!this[_0x94b1('0x84')](_0x2899a2['operation'])){return this[_0x94b1('0x39')]['error'](_0x2899a2,_0x94b1('0x162'));}this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')]('math\x20%s',_0x2899a2[_0x94b1('0x163')]));var _0x5a3bfc=eval(_0x2899a2[_0x94b1('0x163')]);if(!this['isConfigured'](_0x2899a2[_0x94b1('0xd9')])){return this[_0x94b1('0x39')]['noop'](_0x94b1('0xda'));}var _0x55ed87=this[_0x94b1('0xf')][_0x94b1('0x6f')](this,_0x2899a2[_0x94b1('0xd9')]);if(!_0x55ed87){return this[_0x94b1('0x39')]['error'](_0x2899a2,_0x94b1('0xdb'));}if(_[_0x94b1('0x9e')](_0x5a3bfc)){var _0x158136=this;_0x5a3bfc[_0x94b1('0xdc')](function(_0x1a4673,_0x5323e8){_0x158136[_0x94b1('0x39')][_0x94b1('0x9f')](util[_0x94b1('0x26')](_0x94b1('0x164'),_0x55ed87,_0x5323e8),_0x1a4673);});return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x165'),_0x55ed87));}else{return this[_0x94b1('0x39')]['setVariable'](_0x55ed87,_0x5a3bfc);}};AGIVertices[_0x94b1('0xe')]['menu']=function(_0xe95188){logger['info'](util[_0x94b1('0x26')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0xe95188[_0x94b1('0x37')]));if(_0xe95188[_0x94b1('0xa7')]===0x0){return this['maxRetry'](_0xe95188);}_0xe95188[_0x94b1('0xa7')]-=0x1;if(!this[_0x94b1('0x84')](_0xe95188[_0x94b1('0x116')])){return this['channel'][_0x94b1('0x2a')](_0xe95188,_0x94b1('0x117'));}var _0x304cdd=this[_0x94b1('0x1b')][_0x94b1('0x6f')](this,_0xe95188[_0x94b1('0x116')]);if(!_0x304cdd){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0xe95188,_0x94b1('0x118'));}var _0xb4742b=this['channel'][_0x94b1('0x119')](_0x304cdd,_0xe95188[_0x94b1('0x11a')],_0xe95188['digit']);var _0x1784c9=_0xb4742b[_0x94b1('0xa3')];if(_0xb4742b[_0x94b1('0xa3')]===-0x1){this[_0x94b1('0x35')][_0x94b1('0x6f')](this,_0xe95188,'-1');return _0xb4742b;}else if(_0xb4742b['extra']==='timeout'){_0xb4742b[_0x94b1('0xa3')]=_0xb4742b[_0x94b1('0xa3')][_0x94b1('0x9a')]>0x0?_0xb4742b['result']:'t';}else if(_[_0x94b1('0x45')](_0xb4742b[_0x94b1('0xa3')])){_0xb4742b[_0x94b1('0xa3')]='#';_0x1784c9='#';}if(!this[_0x94b1('0x84')](_0xe95188[_0x94b1('0xd9')])){this[_0x94b1('0x39')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x51cd31=this[_0x94b1('0xf')][_0x94b1('0x6f')](this,_0xe95188[_0x94b1('0xd9')]);if(!_0x51cd31){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0xe95188,_0x94b1('0xdb'));}this['channel'][_0x94b1('0x9f')](_0x51cd31,_0x1784c9);}this[_0x94b1('0x35')][_0x94b1('0x6f')](this,_0xe95188,_0x1784c9);return _0xb4742b;};AGIVertices[_0x94b1('0xe')][_0x94b1('0xa9')]=function(_0x42bcbd){logger[_0x94b1('0x2b')](util['format'](_0x94b1('0x166'),_0x42bcbd[_0x94b1('0x37')]));return this[_0x94b1('0x39')]['noop'](_0x42bcbd[_0x94b1('0x167')]||_0x42bcbd[_0x94b1('0x37')]);};AGIVertices[_0x94b1('0xe')][_0x94b1('0x168')]=function(_0x191fd7){logger['info'](util[_0x94b1('0x26')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x191fd7[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x191fd7['findBy'])){return this[_0x94b1('0x39')]['error'](_0x191fd7,_0x94b1('0x160'));}logger[_0x94b1('0x2b')](util['format'](_0x94b1('0x158'),this['channel'][_0x94b1('0x3b')],_0x191fd7[_0x94b1('0x159')]));var _0x2d8ef2=this['getPause'][_0x94b1('0x6f')](this,_0x191fd7['pause_id']);var _0x5a18c7=this[_0x94b1('0x52')][_0x94b1('0x6f')](this,_0x191fd7['findBy'],_0x2d8ef2);if(_0x5a18c7){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x15a'),this[_0x94b1('0x39')]['callerid'],_0x191fd7[_0x94b1('0x159')]));this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x15a'),this[_0x94b1('0x39')][_0x94b1('0x3b')],_0x191fd7[_0x94b1('0x159')]));return{'code':0xc8,'result':_0x94b1('0x15b')};}else{logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x15c'),this['channel'][_0x94b1('0x3b')],_0x191fd7[_0x94b1('0x159')]));this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x94b1('0x39')][_0x94b1('0x3b')],_0x191fd7['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x94b1('0xe')]['playback']=function(_0x167c35){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x169'),_0x167c35[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x167c35['file_id'])){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x167c35,_0x94b1('0x117'));}var _0x4dec4e=this[_0x94b1('0x1b')][_0x94b1('0x6f')](this,_0x167c35[_0x94b1('0x116')]);if(!_0x4dec4e){return this['channel']['error'](_0x167c35,_0x94b1('0x118'));}var _0x72d5e9=this[_0x94b1('0x39')][_0x94b1('0x5b')]('PLAYBACK',[_0x4dec4e,_0x167c35['opts']]);if(_0x72d5e9[_0x94b1('0xa3')]===-0x1){return _0x72d5e9;}return this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x4dec4e));};AGIVertices['prototype']['queue']=function(_0x34b0e0){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x34b0e0[_0x94b1('0x37')]));if(!this['isConfigured'](_0x34b0e0[_0x94b1('0x16a')])){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x34b0e0,_0x94b1('0x16b'));}var _0x4155f5='';var _0x4d7f3f=parseInt(_0x34b0e0[_0x94b1('0x16a')],0xa);if(isNaN(_0x4d7f3f)){_0x4155f5=_0x34b0e0[_0x94b1('0x16a')];}else{_0x4155f5=this[_0x94b1('0x14')][_0x94b1('0x6f')](this,_0x34b0e0['queue_id']);if(!_0x4155f5){return this['channel'][_0x94b1('0x2a')](_0x34b0e0,_0x94b1('0x16c'));}}var _0x44ce92='';if(this[_0x94b1('0x84')](_0x34b0e0[_0x94b1('0x116')])){var _0xc0f55a=this[_0x94b1('0x1b')][_0x94b1('0x6f')](this,_0x34b0e0[_0x94b1('0x116')]);if(_0xc0f55a){_0x44ce92=_0xc0f55a;}}this['createSquareDetailsReport'][_0x94b1('0x6f')](this,_0x34b0e0,_0x4155f5);if(_0x34b0e0[_0x94b1('0x112')]['indexOf']('x')<0x0){_0x34b0e0[_0x94b1('0x112')]+='x';}if(_0x34b0e0['opts'][_0x94b1('0x16d')]('X')<0x0){_0x34b0e0[_0x94b1('0x112')]+='X';}this[_0x94b1('0x39')][_0x94b1('0x9f')]('XMCS-QUEUE',_0x4155f5?_0x4155f5[_0x94b1('0x16e')]():'');var _0x21b27c=this['channel']['exec'](_0x94b1('0x16f'),[_0x4155f5,_0x34b0e0[_0x94b1('0x112')],_0x34b0e0[_0x94b1('0x71')],_0x44ce92,_0x34b0e0['timeout'],_0x34b0e0['agi'],_0x34b0e0['macro'],_0x34b0e0['gosub'],'',_0x34b0e0[_0x94b1('0x170')]]);if(_0x21b27c['result']===-0x1){return _0x21b27c;}return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0xc6'),_0x94b1('0x16f'),_0x4155f5));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x171')]=function(_0x5b631c){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x172'),_0x5b631c['label']));var _0x109f9f=_0x5b631c['recordingFormat']||'wav';var _0x31c70a=util['format'](_0x94b1('0x173'),this['channel']['uniqueid'],rs[_0x94b1('0x11f')](0x5));var _0x54321d=util[_0x94b1('0x26')](_0x94b1('0x174'),FILES_PATH,_0x31c70a,_0x109f9f);var _0xd1c513=util[_0x94b1('0x26')](_0x94b1('0x13e'),FILES_PATH,_0x31c70a);this['createSquareRecording'][_0x94b1('0x6f')](this,_0x5b631c,_0x31c70a,_0x54321d);this[_0x94b1('0x39')]['setVariable']('RECORDING_SAVENAME',_0x31c70a);logger[_0x94b1('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xd1c513,_0x109f9f,_0x5b631c[_0x94b1('0x175')],_0x5b631c[_0x94b1('0x68')]);return this[_0x94b1('0x39')][_0x94b1('0x136')](_0xd1c513,_0x109f9f,_0x5b631c[_0x94b1('0x175')],_0x5b631c[_0x94b1('0x68')],undefined,!![]);};AGIVertices['prototype'][_0x94b1('0x176')]=function(_0x4f936d){logger['info'](util[_0x94b1('0x26')](_0x94b1('0x177'),_0x4f936d[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x4f936d[_0x94b1('0x71')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')]('no\x20url\x20configured');}var _0x4451d9=this[_0x94b1('0x178')][_0x94b1('0x6f')](this,_0x4f936d);logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x179'),util[_0x94b1('0x17a')](_0x4451d9,{'showHidden':![],'depth':null})));if(!this[_0x94b1('0x84')](_0x4f936d[_0x94b1('0xd9')])){return this['channel']['noop'](_0x94b1('0x17b'));}var _0x405556=this[_0x94b1('0xf')]['sync'](this,_0x4f936d[_0x94b1('0xd9')]);if(!_0x405556){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x4f936d,'no\x20variable\x20found');}this[_0x94b1('0x39')][_0x94b1('0x9f')](util[_0x94b1('0x26')](_0x94b1('0x17c'),_0x405556),_0x4451d9[_0x94b1('0x76')]?_0x4451d9['statusCode']:'200');this['channel'][_0x94b1('0x9f')](util[_0x94b1('0x26')]('%s_STATUS_MESSAGE',_0x405556),_0x4451d9[_0x94b1('0x75')]?_0x4451d9[_0x94b1('0x75')]:'OK');if(_0x4451d9[_0x94b1('0x72')]){try{this['saveRestApiResult'](_0x4451d9[_0x94b1('0x72')],_0x405556);}catch(_0x4bc95b){logger[_0x94b1('0x2a')](util[_0x94b1('0x26')](_0x94b1('0x17d'),_0x405556));}}return this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')](_0x94b1('0xe0'),_0x405556));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x17e')]=function(_0x24ce65){logger['info'](util[_0x94b1('0x26')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x24ce65['label']));return this[_0x94b1('0x39')]['sayDigits'](_0x24ce65[_0x94b1('0x17f')][_0x94b1('0x5c')](/\s+/g,''),_0x24ce65[_0x94b1('0x175')]);};AGIVertices[_0x94b1('0xe')][_0x94b1('0x180')]=function(_0x520202){logger['info'](util['format'](_0x94b1('0x181'),_0x520202[_0x94b1('0x37')]));return this[_0x94b1('0x39')][_0x94b1('0x182')](_0x520202[_0x94b1('0x69')][_0x94b1('0x5c')](/\s+/g,''),_0x520202[_0x94b1('0x175')]);};AGIVertices[_0x94b1('0xe')]['sayphonetic']=function(_0xd20db5){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0xd20db5[_0x94b1('0x37')]));return this[_0x94b1('0x39')]['sayPhonetic'](_0xd20db5['text'],_0xd20db5[_0x94b1('0x175')]);};AGIVertices[_0x94b1('0xe')][_0x94b1('0x183')]=function(_0x244bd5){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x184'),_0x244bd5[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x244bd5[_0x94b1('0x185')])){return this[_0x94b1('0x39')]['noop'](_0x94b1('0x186'));}var _0x21d54f=this[_0x94b1('0x1e')][_0x94b1('0x6f')](this,_0x244bd5[_0x94b1('0x185')]);if(!_0x21d54f||!_0x21d54f[_0x94b1('0x187')]){return this[_0x94b1('0x39')]['error'](_0x244bd5,_0x94b1('0x188'));}var _0x38549c={'from':util[_0x94b1('0x26')](_0x94b1('0x189'),_0x21d54f[_0x94b1('0x12')],_0x21d54f[_0x94b1('0x18a')]||_0x21d54f[_0x94b1('0x187')][_0x94b1('0x18b')]),'to':_0x244bd5['to']||'','cc':_0x244bd5['cc']||'','bcc':_0x244bd5[_0x94b1('0x18c')]||'','subject':_0x244bd5[_0x94b1('0x18d')],'html':_0x244bd5[_0x94b1('0x60')],'text':_0x244bd5[_0x94b1('0x60')]};if(this[_0x94b1('0x84')](_0x244bd5[_0x94b1('0x18e')])){}logger['debug']('sendMail\x20message',JSON[_0x94b1('0x74')](_0x38549c));this[_0x94b1('0x35')][_0x94b1('0x6f')](this,_0x244bd5,_0x244bd5[_0x94b1('0x185')]);this[_0x94b1('0x39')][_0x94b1('0xa9')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x21d54f[_0x94b1('0x12')]));this[_0x94b1('0x20')][_0x94b1('0x6f')](this,_0x21d54f[_0x94b1('0x18f')],_0x38549c);return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0x190'));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x191')]=function(_0x53b9b7){logger['info'](util[_0x94b1('0x26')](_0x94b1('0x192'),_0x53b9b7['label']));return this[_0x94b1('0x39')][_0x94b1('0xa9')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x94b1('0xe')][_0x94b1('0x193')]=function(_0x38481c){logger[_0x94b1('0x2b')](util['format'](_0x94b1('0x194'),_0x38481c[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x38481c[_0x94b1('0x195')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')]('no\x20sms\x20account\x20configured');}var _0x27a477=this[_0x94b1('0x32')]['sync'](this,_0x38481c[_0x94b1('0x195')]);if(!_0x27a477){return this[_0x94b1('0x39')]['error'](_0x38481c,_0x94b1('0x196'));}var _0x503f51={'body':_0x38481c['sms_text'],'phone':_0x38481c['to']||'','SmsAccountId':_0x27a477['id']};logger[_0x94b1('0x197')](_0x94b1('0x198'),JSON[_0x94b1('0x74')](_0x503f51));this[_0x94b1('0x35')][_0x94b1('0x6f')](this,_0x38481c,_0x38481c[_0x94b1('0x195')]);this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x199'),_0x27a477['name']));this['createSmsMessage'][_0x94b1('0x6f')](this,_0x503f51);return this[_0x94b1('0x39')]['noop'](_0x94b1('0x19a'));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x19b')]=function(_0x3ae5fc){logger['info'](util['format'](_0x94b1('0x19c'),_0x3ae5fc[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x3ae5fc[_0x94b1('0xd9')])){return this[_0x94b1('0x39')]['error'](_0x3ae5fc,_0x94b1('0x19d'));}var _0x25faa8=this[_0x94b1('0xf')][_0x94b1('0x6f')](this,_0x3ae5fc[_0x94b1('0xd9')]);if(!_0x25faa8){return this[_0x94b1('0x39')]['error'](_0x3ae5fc,_0x94b1('0xdb'));}return this[_0x94b1('0x39')][_0x94b1('0x9f')](_0x25faa8,_0x3ae5fc[_0x94b1('0x19e')]);};AGIVertices[_0x94b1('0xe')][_0x94b1('0x19f')]=function(_0x3358e5){logger['info'](util[_0x94b1('0x26')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3358e5['label']));this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0x1a0'));var _0x44c6a3=this['channel']['getVariable'](_0x94b1('0x1a1'));if(!_[_0x94b1('0x45')](_0x44c6a3[_0x94b1('0xa5')])){this[_0x94b1('0x39')][_0x94b1('0x36')]=_0x44c6a3[_0x94b1('0xa5')];}if(_0x3358e5[_0x94b1('0xbe')]===_0x94b1('0x1a2')){this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0x1a3'));return this[_0x94b1('0x39')][_0x94b1('0xbe')]();}return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0x1a4'));};AGIVertices['prototype'][_0x94b1('0x1a5')]=function(_0x2a6163){logger['info'](util[_0x94b1('0x26')](_0x94b1('0x1a6'),_0x2a6163[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x2a6163[_0x94b1('0x1a7')])){return this[_0x94b1('0x39')]['error'](_0x2a6163,_0x94b1('0x1a8'));}var _0x3ac5e1=this['getSquareProject'][_0x94b1('0x6f')](this,_0x2a6163['project_id']);if(!this['isConfigured'](_0x3ac5e1)){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x2a6163,util[_0x94b1('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2a6163[_0x94b1('0x1a7')]));}if(_0x3ac5e1===this['channel'][_0x94b1('0x3a')]){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x2a6163,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x94b1('0x35')][_0x94b1('0x6f')](this,_0x2a6163,_0x3ac5e1);var _0x28d8f1=this[_0x94b1('0x39')][_0x94b1('0x5b')](_0x94b1('0x1a9'),util['format'](_0x94b1('0x1aa'),config[_0x94b1('0xb8')][_0x94b1('0x1ab')]||'127.0.0.1',_0x3ac5e1,this[_0x94b1('0x39')][_0x94b1('0x3a')]));if(_0x28d8f1['result']===-0x1){return _0x28d8f1;}return this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')](_0x94b1('0xc6'),'AGI',_0x3ac5e1));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x1ac')]=function(_0x405e77){logger['info'](util[_0x94b1('0x26')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x405e77[_0x94b1('0x37')]));var _0x18d74b=this[_0x94b1('0x5a')][_0x94b1('0x6f')](this,_0x405e77['command']);this[_0x94b1('0x35')]['sync'](this,_0x405e77,_0x405e77['command']);if(this['isConfigured'](_0x405e77[_0x94b1('0xd9')])){var _0x1a2477=this[_0x94b1('0xf')][_0x94b1('0x6f')](this,_0x405e77[_0x94b1('0xd9')]);if(_0x1a2477){this[_0x94b1('0x39')][_0x94b1('0x9f')](_0x1a2477,_0x18d74b);return this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')](_0x94b1('0x1ad'),_0x405e77[_0x94b1('0xb9')],_0x1a2477));}}return this[_0x94b1('0x39')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x405e77[_0x94b1('0xb9')]));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x1ae')]=function(_0x4408fd){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x1af'),_0x4408fd[_0x94b1('0x37')]));_0x4408fd['text']=_0x4408fd[_0x94b1('0x60')][_0x94b1('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x94b1('0x84')](_0x4408fd[_0x94b1('0x5e')])){return this['channel'][_0x94b1('0xa9')]('no\x20apiKey\x20configured');}if(!this[_0x94b1('0x84')](_0x4408fd[_0x94b1('0x60')])){return this['channel'][_0x94b1('0xa9')](_0x94b1('0xaa'));}this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x1b0'),_0x4408fd[_0x94b1('0x60')]));var _0x424d09=this[_0x94b1('0x5d')][_0x94b1('0x6f')](this,_0x4408fd);if(_0x424d09){this[_0x94b1('0x39')]['noop'](util[_0x94b1('0x26')](_0x94b1('0x1b1'),_0x424d09));var _0x10be5c=this[_0x94b1('0x39')]['streamFile'](_0x424d09);try{fs['unlink'](_0x424d09+_0x94b1('0x108'));}catch(_0x54d53f){logger['error'](_0x54d53f);}return _0x10be5c;}return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x4408fd,_0x94b1('0x1b2'));};AGIVertices['prototype']['tts']=function(_0x432adc){logger['info'](util[_0x94b1('0x26')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x432adc['label']));_0x432adc['text']=_0x432adc['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x94b1('0x84')](_0x432adc[_0x94b1('0x60')])){return this[_0x94b1('0x39')][_0x94b1('0xa9')](_0x94b1('0xaa'));}this['channel']['noop'](util[_0x94b1('0x26')](_0x94b1('0x1b3'),_0x432adc[_0x94b1('0x60')]));var _0x497e20=this[_0x94b1('0x65')][_0x94b1('0x6f')](this,_0x432adc);if(_0x497e20){this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x1b4'),_0x497e20));var _0x6c76e=this[_0x94b1('0x39')][_0x94b1('0x106')](_0x497e20);try{fs[_0x94b1('0x107')](_0x497e20+'.wav');}catch(_0x2fc8e2){logger['error'](_0x2fc8e2);}return _0x6c76e;}return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x432adc,_0x94b1('0x1b5'));};AGIVertices[_0x94b1('0xe')][_0x94b1('0x1b6')]=function(_0x5554b6){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x1b7'),_0x5554b6[_0x94b1('0x37')]));if(!this[_0x94b1('0x84')](_0x5554b6['findBy'])){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x5554b6,_0x94b1('0x160'));}logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x158'),this[_0x94b1('0x39')][_0x94b1('0x3b')],_0x5554b6[_0x94b1('0x159')]));var _0x4b5b64=this['agentUnpause'][_0x94b1('0x6f')](this,_0x5554b6[_0x94b1('0x159')]);if(_0x4b5b64){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x15a'),this[_0x94b1('0x39')]['callerid'],_0x5554b6['findBy']));this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x15a'),this[_0x94b1('0x39')]['callerid'],_0x5554b6['findBy']));return{'code':0xc8,'result':_0x94b1('0x15b')};}else{logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x15c'),this[_0x94b1('0x39')][_0x94b1('0x3b')],_0x5554b6[_0x94b1('0x159')]));this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')](_0x94b1('0x15c'),this['channel'][_0x94b1('0x3b')],_0x5554b6[_0x94b1('0x159')]));return{'code':0xc8,'result':_0x94b1('0x15d')};}};AGIVertices['prototype'][_0x94b1('0x1b8')]=function(_0x5bbf52){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x1b9'),_0x5bbf52[_0x94b1('0x37')]));var _0x596bf3=this['channel'][_0x94b1('0x5b')]('VOICEMAIL',[_0x5bbf52[_0x94b1('0x1ba')],_0x5bbf52[_0x94b1('0x78')]]);if(_0x596bf3[_0x94b1('0xa3')]===-0x1){return _0x596bf3;}return this[_0x94b1('0x39')][_0x94b1('0xa9')](util[_0x94b1('0x26')]('Executed\x20command\x20%s\x20%s',_0x94b1('0x1bb'),_0x5bbf52[_0x94b1('0x1ba')]));};AGIVertices['prototype'][_0x94b1('0x1bc')]=function(_0x2f9b4e){logger[_0x94b1('0x2b')](util[_0x94b1('0x26')](_0x94b1('0x1bd'),_0x2f9b4e['label']));if(!this[_0x94b1('0x84')](_0x2f9b4e[_0x94b1('0xd9')])){return this[_0x94b1('0x39')]['error'](_0x2f9b4e,_0x94b1('0x19d'));}var _0xbc1332=this['getVariable']['sync'](this,_0x2f9b4e[_0x94b1('0xd9')]);if(!_0xbc1332){return this[_0x94b1('0x39')][_0x94b1('0x2a')](_0x2f9b4e,_0x94b1('0xdb'));}var _0x47d46e=this['channel'][_0x94b1('0xf')](_0xbc1332);return{'code':0xc8,'result':_0x47d46e[_0x94b1('0xa5')]?_0x47d46e[_0x94b1('0xa5')]:'-'};};String['prototype'][_0x94b1('0xa1')]=function(_0x1b3ac1,_0x17c3cc){return this[_0x94b1('0xa0')](_0x1b3ac1)[_0x94b1('0x1be')](_0x17c3cc);};module[_0x94b1('0x1bf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2506948..37bde3b 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 _0xa553=['pauseType','saveUnpause','[%s][UPDATE][ACWTIME:%s]','error','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','interface','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','bind','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','uniqueid','then','info','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','format','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xa553,0x183));var _0x3a55=function(_0x1fde39,_0x1fdc5f){_0x1fde39=_0x1fde39-0x0;var _0x36cdc5=_0xa553[_0x1fde39];return _0x36cdc5;};'use strict';var _=require('lodash');var moment=require(_0x3a55('0x0'));var ami=require(_0x3a55('0x1'));var logger=require('../../../config/logger')(_0x3a55('0x2'));var RpcUser=require(_0x3a55('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x483724){this[_0x3a55('0x4')]=_0x483724[_0x3a55('0x4')];this[_0x3a55('0x5')]=_0x483724['agents'];this[_0x3a55('0x6')]=_0x483724['timers'];this['channels']={};ami['on']('agentconnect',this['syncAgentConnect'][_0x3a55('0x7')](this));ami['on']('hanguprequest',this[_0x3a55('0x8')]['bind'](this));ami['on']('hangup',this[_0x3a55('0x9')][_0x3a55('0x7')](this));ami['on'](_0x3a55('0xa'),this[_0x3a55('0xb')][_0x3a55('0x7')](this));ami['on'](_0x3a55('0xc'),this[_0x3a55('0xd')][_0x3a55('0x7')](this));ami['on'](_0x3a55('0xe'),this[_0x3a55('0xf')][_0x3a55('0x7')](this));ami['on'](_0x3a55('0x10'),this['syncAgentConnectPreview'][_0x3a55('0x7')](this));}function getDiff(_0x3ef5e5){var _0x5b7d40=moment()[_0x3a55('0x11')](0x0);var _0x55590e=moment(_0x3ef5e5)[_0x3a55('0x11')](0x0);return _0x5b7d40[_0x3a55('0x12')](_0x55590e,_0x3a55('0x13'));}Acw[_0x3a55('0x14')][_0x3a55('0x15')]=function(_0x13093e,_0x342934){var _0x4e1943=this;var _0x58e27b=getDiff(_0x4e1943[_0x3a55('0x6')][_0x13093e][_0x3a55('0x16')]);clearTimeout(_0x4e1943['timers'][_0x13093e][_0x3a55('0x17')]);_0x4e1943[_0x3a55('0x6')][_0x13093e][_0x3a55('0x17')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x58e27b},_0x4e1943[_0x3a55('0x6')][_0x13093e][_0x3a55('0x18')],_0x13093e)[_0x3a55('0x19')](function(_0x2c712b){logger[_0x3a55('0x1a')]('[%s][UPDATE][ACWTIME:%s]',_0x342934,_0x58e27b,_0x2c712b);})[_0x3a55('0x1b')](function(_0x478843){logger['error'](_0x3a55('0x1c'),_0x342934,_0x478843);})[_0x3a55('0x1d')](function(){delete _0x4e1943[_0x3a55('0x6')][_0x13093e];});};Acw[_0x3a55('0x14')][_0x3a55('0x1e')]=function(_0x281d96){try{var _0x1f109f=this;var _0x14b89a=this[_0x3a55('0x1f')][_0x281d96]['interface'];var _0x490152=this[_0x3a55('0x1f')][_0x281d96][_0x3a55('0x20')];var _0x3ace4e=this[_0x3a55('0x4')][_0x490152];var _0x3dbf75=![];var _0x36c6e4=_0x3a55('0x21');if(_0x3ace4e[_0x3a55('0x22')]&&_0x3ace4e[_0x3a55('0x23')][_0x3a55('0x24')]){_0x3dbf75=!![];_0x36c6e4=_0x3ace4e['mandatoryDispositionPause'][_0x3a55('0x24')];}return ami[_0x3a55('0x25')]({'action':'QueuePause','interface':_0x14b89a,'paused':!![],'reason':_0x36c6e4})[_0x3a55('0x19')](function(){if(_0x1f109f[_0x3a55('0x5')][_0x14b89a]){return RpcUser[_0x3a55('0x26')](_0x1f109f['agents'][_0x14b89a]['id'])[_0x3a55('0x19')](function(_0x35ba43){if(!_0x35ba43||_0x35ba43[_0x3a55('0x27')]){logger[_0x3a55('0x1a')](_0x3a55('0x28'),_0x281d96,_0x14b89a,_0x490152);return;}logger['info'](_0x3a55('0x29'),_0x281d96,_0x14b89a,_0x490152);var _0x1d3d8c=_0x1f109f['channels'][_0x281d96][_0x3a55('0x2a')]&&_0x1f109f[_0x3a55('0x1f')][_0x281d96][_0x3a55('0x2b')]?_0x1f109f['channels'][_0x281d96][_0x3a55('0x2b')]:_0x281d96;return RpcUser[_0x3a55('0x2c')](_0x1f109f['agents'][_0x14b89a],_0x36c6e4,_0x1d3d8c)[_0x3a55('0x19')](function(_0x5dcc68){_0x1f109f[_0x3a55('0x4')][_0x490152]['available']-=0x1;_0x1f109f[_0x3a55('0x4')][_0x490152][_0x3a55('0x2d')]+=0x1;return _0x5dcc68;});})[_0x3a55('0x19')](function(_0x336d91){if(_0x3dbf75||!_0x336d91){return;}_0x1f109f[_0x3a55('0x6')][_0x14b89a]={};logger[_0x3a55('0x1a')](_0x3a55('0x2e'),_0x281d96,_0x1f109f[_0x3a55('0x4')][_0x490152]['acwTimeout'],_0x14b89a,_0x490152);_0x1f109f[_0x3a55('0x6')][_0x14b89a][_0x3a55('0x17')]=setTimeout(_0x1f109f[_0x3a55('0x2f')]['bind'](_0x1f109f,_0x14b89a),_0x1f109f['voiceQueues'][_0x490152][_0x3a55('0x30')]*0x3e8);_0x1f109f[_0x3a55('0x6')][_0x14b89a][_0x3a55('0x16')]=moment()[_0x3a55('0x31')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f109f[_0x3a55('0x6')][_0x14b89a][_0x3a55('0x18')]=_0x281d96;_0x1f109f[_0x3a55('0x6')][_0x14b89a][_0x3a55('0x20')]=_0x490152;_0x1f109f[_0x3a55('0x6')][_0x14b89a][_0x3a55('0x15')]=_0x1f109f['updateAcw'][_0x3a55('0x7')](_0x1f109f,_0x14b89a,_0x281d96);});}})[_0x3a55('0x1b')](function(){logger['error'](_0x3a55('0x2e'),_0x281d96,_0x1f109f[_0x3a55('0x4')][_0x490152]['acwTimeout'],_0x14b89a,_0x490152);})[_0x3a55('0x1d')](function(){delete _0x1f109f['channels'][_0x281d96];});}catch(_0x5311e2){logger['error'](_0x3a55('0x32'),_0x5311e2[_0x3a55('0x33')]);}};Acw[_0x3a55('0x14')][_0x3a55('0x2f')]=function(_0x4ceca2){try{var _0x491f3d=this;if(_0x491f3d[_0x3a55('0x6')][_0x4ceca2]){_0x491f3d[_0x3a55('0x6')][_0x4ceca2][_0x3a55('0x17')]=![];var _0x5d8bb9=_0x491f3d['timers'][_0x4ceca2]['uniqueid'];var _0x373b8b=_0x491f3d[_0x3a55('0x6')][_0x4ceca2][_0x3a55('0x20')];var _0x4a4ea0=_0x491f3d[_0x3a55('0x4')][_0x373b8b]['acwTimeout'];logger['info'](_0x3a55('0x34'),_0x5d8bb9,_0x4ceca2);RpcUser[_0x3a55('0x26')](this[_0x3a55('0x5')][_0x4ceca2]['id'])[_0x3a55('0x19')](function(_0x3cdf99){if(_0x3cdf99[_0x3a55('0x35')]===_0x3a55('0x21')){return RpcUser[_0x3a55('0x36')](_0x491f3d[_0x3a55('0x5')][_0x4ceca2]);}});RpcVoiceAgentReport['update']({'acwtime':_0x4a4ea0,'agentacw':!![]},_0x5d8bb9,_0x4ceca2)[_0x3a55('0x19')](function(_0x408aaf){logger[_0x3a55('0x1a')](_0x3a55('0x37'),_0x5d8bb9,_0x4a4ea0,_0x408aaf);})[_0x3a55('0x1b')](function(_0x289385){logger['error'](_0x3a55('0x1c'),_0x5d8bb9,_0x289385);});}else{logger[_0x3a55('0x38')](_0x3a55('0x39'),_0x4ceca2);if(_0x491f3d[_0x3a55('0x6')]){logger[_0x3a55('0x1a')](_0x3a55('0x3a'),JSON[_0x3a55('0x3b')](_0x491f3d[_0x3a55('0x6')]));}}}catch(_0x639873){logger[_0x3a55('0x38')](_0x3a55('0x3c'),_0x639873['message']);}};Acw['prototype'][_0x3a55('0x3d')]=function(_0x22b3f7){try{if(this['voiceQueues'][_0x22b3f7[_0x3a55('0x20')]]&&(this[_0x3a55('0x4')][_0x22b3f7['queue']][_0x3a55('0x2')]||this['voiceQueues'][_0x22b3f7[_0x3a55('0x20')]][_0x3a55('0x22')])){if(this['agents'][_0x22b3f7['interface']]){this[_0x3a55('0x1f')][_0x22b3f7[_0x3a55('0x18')]]={'queue':_0x22b3f7[_0x3a55('0x20')],'interface':_0x22b3f7['interface'],'destlinkedid':_0x22b3f7[_0x3a55('0x2b')]};}}}catch(_0xdb0cfa){logger[_0x3a55('0x38')](_0x3a55('0x3e'),_0xdb0cfa[_0x3a55('0x33')]);}};Acw[_0x3a55('0x14')][_0x3a55('0x3f')]=function(_0x4a0ad3){try{if(this[_0x3a55('0x4')][_0x4a0ad3['queue']]&&(this[_0x3a55('0x4')][_0x4a0ad3['queue']][_0x3a55('0x2')]||this[_0x3a55('0x4')][_0x4a0ad3[_0x3a55('0x20')]][_0x3a55('0x22')])){if(this['agents'][_0x4a0ad3[_0x3a55('0x40')]]){this['channels'][_0x4a0ad3[_0x3a55('0x18')]]={'queue':_0x4a0ad3[_0x3a55('0x20')],'interface':_0x4a0ad3['interface']};}}}catch(_0x55897b){logger[_0x3a55('0x38')]('[ACW][syncAgentConnectPreview]\x20%s',_0x55897b['message']);}};Acw['prototype'][_0x3a55('0x8')]=function(_0x40e6c1){try{if(this['channels'][_0x40e6c1[_0x3a55('0x18')]]&&_[_0x3a55('0x41')](this['channels'][_0x40e6c1['uniqueid']][_0x3a55('0x2a')])){logger[_0x3a55('0x1a')](_0x3a55('0x42'),_0x40e6c1[_0x3a55('0x18')]);this['startAcw'](_0x40e6c1[_0x3a55('0x18')]);}else if(this[_0x3a55('0x1f')][_0x40e6c1[_0x3a55('0x43')]]&&_['isUndefined'](this[_0x3a55('0x1f')][_0x40e6c1[_0x3a55('0x43')]][_0x3a55('0x2a')])){logger[_0x3a55('0x1a')](_0x3a55('0x44'),_0x40e6c1[_0x3a55('0x43')]);this[_0x3a55('0x1e')](_0x40e6c1['linkedid']);}}catch(_0x55c2b0){logger['error'](_0x3a55('0x45'),_0x55c2b0[_0x3a55('0x33')]);}};Acw['prototype']['syncHangup']=function(_0x3cf271){try{if(this[_0x3a55('0x1f')][_0x3cf271[_0x3a55('0x18')]]&&this['channels'][_0x3cf271[_0x3a55('0x18')]][_0x3a55('0x2a')]){logger['info'](_0x3a55('0x46'),_0x3cf271[_0x3a55('0x18')]);this['startAcw'](_0x3cf271[_0x3a55('0x18')]);}else if(this['channels'][_0x3cf271[_0x3a55('0x43')]]&&this['channels'][_0x3cf271[_0x3a55('0x43')]][_0x3a55('0x2a')]){logger['info'](_0x3a55('0x47'),_0x3cf271[_0x3a55('0x43')]);this[_0x3a55('0x1e')](_0x3cf271[_0x3a55('0x43')]);}}catch(_0x16fef3){logger['error']('[ACW][syncHangup]\x20%s',_0x16fef3[_0x3a55('0x33')]);}};Acw['prototype'][_0x3a55('0xd')]=function(_0xd729c5){try{if(!_['isNil'](this['channels'][_0xd729c5[_0x3a55('0x48')]])){this[_0x3a55('0x1e')](_0xd729c5[_0x3a55('0x48')]);if(this[_0x3a55('0x1f')][_0xd729c5[_0x3a55('0x49')]]){this[_0x3a55('0x1f')][_0xd729c5[_0x3a55('0x49')]]['attended']=!![];this[_0x3a55('0x1f')][_0xd729c5[_0x3a55('0x4a')]]=this[_0x3a55('0x1f')][_0xd729c5[_0x3a55('0x49')]];this[_0x3a55('0x4b')](_0xd729c5[_0x3a55('0x49')]);}}else if(!_[_0x3a55('0x4c')](this[_0x3a55('0x1f')][_0xd729c5[_0x3a55('0x4a')]])){this[_0x3a55('0x1e')](_0xd729c5[_0x3a55('0x4a')]);if(this[_0x3a55('0x1f')][_0xd729c5[_0x3a55('0x4d')]]){this[_0x3a55('0x1f')][_0xd729c5[_0x3a55('0x4d')]][_0x3a55('0x2a')]=!![];this[_0x3a55('0x1f')][_0xd729c5[_0x3a55('0x48')]]=this[_0x3a55('0x1f')][_0xd729c5[_0x3a55('0x4d')]];this[_0x3a55('0x4b')](_0xd729c5[_0x3a55('0x4d')]);}}}catch(_0x22310e){logger[_0x3a55('0x38')](_0x3a55('0x4e'),_0x22310e[_0x3a55('0x33')]);}};Acw[_0x3a55('0x14')]['syncBlindTransfer']=function(_0x404f2f){try{if(this[_0x3a55('0x1f')][_0x404f2f['transfereruniqueid']]){logger[_0x3a55('0x1a')](_0x3a55('0x4f'),JSON[_0x3a55('0x3b')](_0x404f2f[_0x3a55('0x50')]));this['startAcw'](_0x404f2f[_0x3a55('0x50')]);}else if(this[_0x3a55('0x1f')][_0x404f2f[_0x3a55('0x51')]]){logger[_0x3a55('0x1a')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x3a55('0x3b')](_0x404f2f[_0x3a55('0x51')]));this[_0x3a55('0x1e')](_0x404f2f[_0x3a55('0x51')]);}}catch(_0x2d519e){logger[_0x3a55('0x38')](_0x3a55('0x52'),_0x2d519e['message']);}};Acw[_0x3a55('0x14')][_0x3a55('0xb')]=function(_0x364c20){try{if(this[_0x3a55('0x4')][_0x364c20['queue']]&&this['voiceQueues'][_0x364c20[_0x3a55('0x20')]]['autopause']===_0x3a55('0x53')){if(this[_0x3a55('0x5')][_0x364c20[_0x3a55('0x40')]]){logger[_0x3a55('0x1a')](_0x3a55('0x54'),_0x364c20['uniqueid'],_0x364c20[_0x3a55('0x40')],_0x364c20[_0x3a55('0x20')]);return RpcUser[_0x3a55('0x2c')](this[_0x3a55('0x5')][_0x364c20[_0x3a55('0x40')]],_0x3a55('0x55'),_0x364c20[_0x3a55('0x18')]);}}}catch(_0x29283c){logger[_0x3a55('0x38')](_0x3a55('0x56'),_0x29283c[_0x3a55('0x33')]);}};Acw['prototype'][_0x3a55('0x4b')]=function(_0x496760,_0x404f8f=0x2710){if(this[_0x3a55('0x1f')][_0x496760]){setTimeout(()=>{delete this[_0x3a55('0x1f')][_0x496760];},_0x404f8f);}};module[_0x3a55('0x57')]=Acw; \ No newline at end of file +var _0x802e=['autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','prototype','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','mandatoryDispositionPause','name','Action','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','lastPauseAt','format','acwTimeout','message','[%s][TIMER][STOP][AGENT:%s]','ACW','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','origtransfereruniqueid','deleteChannelAfterTimeout','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]'];(function(_0x2fe52f,_0x3c048){var _0x42567a=function(_0x1e842f){while(--_0x1e842f){_0x2fe52f['push'](_0x2fe52f['shift']());}};_0x42567a(++_0x3c048);}(_0x802e,0x1df));var _0xe802=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x802e[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0xe802('0x0'));var moment=require(_0xe802('0x1'));var ami=require('../ami');var logger=require('../../../config/logger')(_0xe802('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xe802('0x3'));function Acw(_0x4d3405){this[_0xe802('0x4')]=_0x4d3405[_0xe802('0x4')];this[_0xe802('0x5')]=_0x4d3405[_0xe802('0x5')];this[_0xe802('0x6')]=_0x4d3405[_0xe802('0x6')];this[_0xe802('0x7')]={};ami['on'](_0xe802('0x8'),this[_0xe802('0x9')][_0xe802('0xa')](this));ami['on']('hanguprequest',this[_0xe802('0xb')]['bind'](this));ami['on'](_0xe802('0xc'),this[_0xe802('0xd')][_0xe802('0xa')](this));ami['on'](_0xe802('0xe'),this[_0xe802('0xf')][_0xe802('0xa')](this));ami['on'](_0xe802('0x10'),this[_0xe802('0x11')][_0xe802('0xa')](this));ami['on'](_0xe802('0x12'),this[_0xe802('0x13')]['bind'](this));ami['on'](_0xe802('0x14'),this[_0xe802('0x15')][_0xe802('0xa')](this));}function getDiff(_0x20eb8f){var _0x48a9e1=moment()['milliseconds'](0x0);var _0x46f88f=moment(_0x20eb8f)['milliseconds'](0x0);return _0x48a9e1[_0xe802('0x16')](_0x46f88f,_0xe802('0x17'));}Acw[_0xe802('0x18')][_0xe802('0x19')]=function(_0x1e9f54,_0x4207db){var _0x3a06c8=this;var _0x4f8668=getDiff(_0x3a06c8[_0xe802('0x6')][_0x1e9f54]['lastPauseAt']);clearTimeout(_0x3a06c8[_0xe802('0x6')][_0x1e9f54][_0xe802('0x1a')]);_0x3a06c8[_0xe802('0x6')][_0x1e9f54]['timer']=![];return RpcVoiceAgentReport[_0xe802('0x1b')]({'acwtime':_0x4f8668},_0x3a06c8['timers'][_0x1e9f54][_0xe802('0x1c')],_0x1e9f54)['then'](function(_0x217093){logger['info'](_0xe802('0x1d'),_0x4207db,_0x4f8668,_0x217093);})[_0xe802('0x1e')](function(_0x51dba3){logger[_0xe802('0x1f')](_0xe802('0x20'),_0x4207db,_0x51dba3);})['finally'](function(){delete _0x3a06c8[_0xe802('0x6')][_0x1e9f54];});};Acw[_0xe802('0x18')][_0xe802('0x21')]=function(_0x14604d){try{var _0x56a9eb=this;var _0x2b6dc8=this[_0xe802('0x7')][_0x14604d][_0xe802('0x22')];var _0x588ba4=this[_0xe802('0x7')][_0x14604d][_0xe802('0x23')];var _0x4f1055=this[_0xe802('0x4')][_0x588ba4];var _0x2e8ac3=![];var _0x483bc0='ACW';if(_0x4f1055['mandatoryDisposition']&&_0x4f1055[_0xe802('0x24')][_0xe802('0x25')]){_0x2e8ac3=!![];_0x483bc0=_0x4f1055[_0xe802('0x24')]['name'];}return ami[_0xe802('0x26')]({'action':'QueuePause','interface':_0x2b6dc8,'paused':!![],'reason':_0x483bc0})[_0xe802('0x27')](function(){if(_0x56a9eb[_0xe802('0x5')][_0x2b6dc8]){return RpcUser['getAgent'](_0x56a9eb[_0xe802('0x5')][_0x2b6dc8]['id'])[_0xe802('0x27')](function(_0x4061c1){if(!_0x4061c1||_0x4061c1[_0xe802('0x28')]){logger['info'](_0xe802('0x29'),_0x14604d,_0x2b6dc8,_0x588ba4);return;}logger[_0xe802('0x2a')](_0xe802('0x2b'),_0x14604d,_0x2b6dc8,_0x588ba4);var _0x280144=_0x56a9eb['channels'][_0x14604d][_0xe802('0x2c')]&&_0x56a9eb[_0xe802('0x7')][_0x14604d][_0xe802('0x2d')]?_0x56a9eb[_0xe802('0x7')][_0x14604d]['destlinkedid']:_0x14604d;return RpcUser['savePause'](_0x56a9eb[_0xe802('0x5')][_0x2b6dc8],_0x483bc0,_0x280144)[_0xe802('0x27')](function(_0x222a65){_0x56a9eb[_0xe802('0x4')][_0x588ba4][_0xe802('0x2e')]-=0x1;_0x56a9eb[_0xe802('0x4')][_0x588ba4]['paused']+=0x1;return _0x222a65;});})[_0xe802('0x27')](function(_0x31b13d){if(_0x2e8ac3||!_0x31b13d){return;}_0x56a9eb[_0xe802('0x6')][_0x2b6dc8]={};logger['info'](_0xe802('0x2f'),_0x14604d,_0x56a9eb[_0xe802('0x4')][_0x588ba4]['acwTimeout'],_0x2b6dc8,_0x588ba4);_0x56a9eb[_0xe802('0x6')][_0x2b6dc8][_0xe802('0x1a')]=setTimeout(_0x56a9eb[_0xe802('0x30')][_0xe802('0xa')](_0x56a9eb,_0x2b6dc8),_0x56a9eb[_0xe802('0x4')][_0x588ba4]['acwTimeout']*0x3e8);_0x56a9eb[_0xe802('0x6')][_0x2b6dc8][_0xe802('0x31')]=moment()[_0xe802('0x32')]('YYYY-MM-DD\x20HH:mm:ss');_0x56a9eb[_0xe802('0x6')][_0x2b6dc8][_0xe802('0x1c')]=_0x14604d;_0x56a9eb[_0xe802('0x6')][_0x2b6dc8][_0xe802('0x23')]=_0x588ba4;_0x56a9eb[_0xe802('0x6')][_0x2b6dc8][_0xe802('0x19')]=_0x56a9eb[_0xe802('0x19')][_0xe802('0xa')](_0x56a9eb,_0x2b6dc8,_0x14604d);});}})['catch'](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x14604d,_0x56a9eb['voiceQueues'][_0x588ba4][_0xe802('0x33')],_0x2b6dc8,_0x588ba4);})['finally'](function(){delete _0x56a9eb[_0xe802('0x7')][_0x14604d];});}catch(_0x512986){logger[_0xe802('0x1f')]('[ACW][START]\x20%s',_0x512986[_0xe802('0x34')]);}};Acw[_0xe802('0x18')]['stopAcw']=function(_0xde06dc){try{var _0x4821ec=this;if(_0x4821ec[_0xe802('0x6')][_0xde06dc]){_0x4821ec['timers'][_0xde06dc]['timer']=![];var _0x246eca=_0x4821ec['timers'][_0xde06dc]['uniqueid'];var _0x56034b=_0x4821ec['timers'][_0xde06dc][_0xe802('0x23')];var _0x5170b0=_0x4821ec['voiceQueues'][_0x56034b][_0xe802('0x33')];logger[_0xe802('0x2a')](_0xe802('0x35'),_0x246eca,_0xde06dc);RpcUser['getAgent'](this[_0xe802('0x5')][_0xde06dc]['id'])['then'](function(_0x4883e8){if(_0x4883e8['pauseType']===_0xe802('0x36')){return RpcUser[_0xe802('0x37')](_0x4821ec['agents'][_0xde06dc]);}});RpcVoiceAgentReport[_0xe802('0x1b')]({'acwtime':_0x5170b0,'agentacw':!![]},_0x246eca,_0xde06dc)[_0xe802('0x27')](function(_0x296bde){logger['info'](_0xe802('0x1d'),_0x246eca,_0x5170b0,_0x296bde);})['catch'](function(_0x45cae5){logger['error'](_0xe802('0x20'),_0x246eca,_0x45cae5);});}else{logger['error'](_0xe802('0x38'),_0xde06dc);if(_0x4821ec[_0xe802('0x6')]){logger[_0xe802('0x2a')](_0xe802('0x39'),JSON[_0xe802('0x3a')](_0x4821ec[_0xe802('0x6')]));}}}catch(_0x2977b2){logger['error'](_0xe802('0x3b'),_0x2977b2['message']);}};Acw['prototype']['syncAgentConnect']=function(_0x3be60b){try{if(this[_0xe802('0x4')][_0x3be60b[_0xe802('0x23')]]&&(this['voiceQueues'][_0x3be60b[_0xe802('0x23')]][_0xe802('0x2')]||this['voiceQueues'][_0x3be60b[_0xe802('0x23')]][_0xe802('0x3c')])){if(this['agents'][_0x3be60b[_0xe802('0x22')]]){this[_0xe802('0x7')][_0x3be60b[_0xe802('0x1c')]]={'queue':_0x3be60b[_0xe802('0x23')],'interface':_0x3be60b[_0xe802('0x22')],'destlinkedid':_0x3be60b[_0xe802('0x2d')]};}}}catch(_0x6f9b39){logger[_0xe802('0x1f')]('[ACW][syncAgentConnect]\x20%s',_0x6f9b39[_0xe802('0x34')]);}};Acw[_0xe802('0x18')][_0xe802('0x15')]=function(_0x33c772){try{if(this['voiceQueues'][_0x33c772[_0xe802('0x23')]]&&(this[_0xe802('0x4')][_0x33c772[_0xe802('0x23')]][_0xe802('0x2')]||this['voiceQueues'][_0x33c772[_0xe802('0x23')]][_0xe802('0x3c')])){if(this['agents'][_0x33c772[_0xe802('0x22')]]){this['channels'][_0x33c772[_0xe802('0x1c')]]={'queue':_0x33c772['queue'],'interface':_0x33c772[_0xe802('0x22')]};}}}catch(_0x31e86a){logger[_0xe802('0x1f')](_0xe802('0x3d'),_0x31e86a[_0xe802('0x34')]);}};Acw[_0xe802('0x18')]['syncHangupRequest']=function(_0x48e612){try{if(this[_0xe802('0x7')][_0x48e612[_0xe802('0x1c')]]&&_[_0xe802('0x3e')](this[_0xe802('0x7')][_0x48e612[_0xe802('0x1c')]][_0xe802('0x2c')])){logger[_0xe802('0x2a')](_0xe802('0x3f'),_0x48e612[_0xe802('0x1c')]);this['startAcw'](_0x48e612[_0xe802('0x1c')]);}else if(this[_0xe802('0x7')][_0x48e612[_0xe802('0x40')]]&&_[_0xe802('0x3e')](this['channels'][_0x48e612['linkedid']]['attended'])){logger[_0xe802('0x2a')]('[%s][HANGUP:LINKEDID]',_0x48e612['linkedid']);this['startAcw'](_0x48e612[_0xe802('0x40')]);}}catch(_0x3c3560){logger[_0xe802('0x1f')]('[ACW][syncHangupRequest]\x20%s',_0x3c3560[_0xe802('0x34')]);}};Acw[_0xe802('0x18')][_0xe802('0xd')]=function(_0x56120f){try{if(this[_0xe802('0x7')][_0x56120f[_0xe802('0x1c')]]&&this[_0xe802('0x7')][_0x56120f[_0xe802('0x1c')]][_0xe802('0x2c')]){logger[_0xe802('0x2a')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x56120f[_0xe802('0x1c')]);this['startAcw'](_0x56120f[_0xe802('0x1c')]);}else if(this['channels'][_0x56120f[_0xe802('0x40')]]&&this[_0xe802('0x7')][_0x56120f[_0xe802('0x40')]][_0xe802('0x2c')]){logger[_0xe802('0x2a')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x56120f[_0xe802('0x40')]);this[_0xe802('0x21')](_0x56120f[_0xe802('0x40')]);}}catch(_0x565838){logger[_0xe802('0x1f')](_0xe802('0x41'),_0x565838[_0xe802('0x34')]);}};Acw[_0xe802('0x18')][_0xe802('0x11')]=function(_0x587f56){try{if(!_['isNil'](this['channels'][_0x587f56[_0xe802('0x42')]])){this[_0xe802('0x21')](_0x587f56[_0xe802('0x42')]);if(this[_0xe802('0x7')][_0x587f56[_0xe802('0x43')]]){this[_0xe802('0x7')][_0x587f56[_0xe802('0x43')]][_0xe802('0x2c')]=!![];this['channels'][_0x587f56['transfertargetuniqueid']]=this['channels'][_0x587f56[_0xe802('0x43')]];this['deleteChannelAfterTimeout'](_0x587f56[_0xe802('0x43')]);}}else if(!_['isNil'](this[_0xe802('0x7')][_0x587f56['transfertargetuniqueid']])){this[_0xe802('0x21')](_0x587f56['transfertargetuniqueid']);if(this['channels'][_0x587f56[_0xe802('0x44')]]){this[_0xe802('0x7')][_0x587f56[_0xe802('0x44')]][_0xe802('0x2c')]=!![];this[_0xe802('0x7')][_0x587f56[_0xe802('0x42')]]=this[_0xe802('0x7')][_0x587f56[_0xe802('0x44')]];this[_0xe802('0x45')](_0x587f56[_0xe802('0x44')]);}}}catch(_0x30a38b){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x30a38b[_0xe802('0x34')]);}};Acw['prototype'][_0xe802('0x13')]=function(_0x18a29a){try{if(this[_0xe802('0x7')][_0x18a29a['transfereruniqueid']]){logger[_0xe802('0x2a')](_0xe802('0x46'),JSON[_0xe802('0x3a')](_0x18a29a[_0xe802('0x47')]));this[_0xe802('0x21')](_0x18a29a['transfereruniqueid']);}else if(this['channels'][_0x18a29a[_0xe802('0x48')]]){logger[_0xe802('0x2a')](_0xe802('0x49'),JSON['stringify'](_0x18a29a[_0xe802('0x48')]));this['startAcw'](_0x18a29a[_0xe802('0x48')]);}}catch(_0x7461a1){logger[_0xe802('0x1f')]('[ACW][syncBlindTransfer]\x20%s',_0x7461a1[_0xe802('0x34')]);}};Acw[_0xe802('0x18')][_0xe802('0xf')]=function(_0x3b63f6){try{if(this[_0xe802('0x4')][_0x3b63f6[_0xe802('0x23')]]&&this[_0xe802('0x4')][_0x3b63f6[_0xe802('0x23')]][_0xe802('0x4a')]===_0xe802('0x4b')){if(this[_0xe802('0x5')][_0x3b63f6[_0xe802('0x22')]]){logger[_0xe802('0x2a')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3b63f6[_0xe802('0x1c')],_0x3b63f6[_0xe802('0x22')],_0x3b63f6[_0xe802('0x23')]);return RpcUser['savePause'](this['agents'][_0x3b63f6['interface']],_0xe802('0x4c'),_0x3b63f6[_0xe802('0x1c')]);}}}catch(_0x47fd42){logger['error'](_0xe802('0x4d'),_0x47fd42['message']);}};Acw['prototype']['deleteChannelAfterTimeout']=function(_0x855e82,_0x5bfbac=0x2710){if(this[_0xe802('0x7')][_0x855e82]){setTimeout(()=>{delete this[_0xe802('0x7')][_0x855e82];},_0x5bfbac);}};module[_0xe802('0x4e')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 642a413..5434ff7 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 _0xf82f=['actionCoreShowChannels','coreshowchannels','info','once','close','connect','shutdown','fullybooted','resolve','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','util','../../config/logger','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry','devicestatelist','actionSipPeerStatus','actionQueueSummary'];(function(_0x43f3ee,_0x4b3678){var _0x18c1fd=function(_0x2d84c2){while(--_0x2d84c2){_0x43f3ee['push'](_0x43f3ee['shift']());}};_0x18c1fd(++_0x4b3678);}(_0xf82f,0x6d));var _0xff82=function(_0x3ecb,_0x2a3e24){_0x3ecb=_0x3ecb-0x0;var _0x2f29d5=_0xf82f[_0x3ecb];return _0x2f29d5;};'use strict';var Manager=require(_0xff82('0x0'));var BPromise=require('bluebird');var util=require(_0xff82('0x1'));var logger=require(_0xff82('0x2'))('ami');var config=require(_0xff82('0x3'));var ami=new Manager(config[_0xff82('0x4')]['port'],config[_0xff82('0x4')]['ip'],config[_0xff82('0x4')][_0xff82('0x5')],config[_0xff82('0x4')][_0xff82('0x6')],!![]);ami[_0xff82('0x7')]();ami[_0xff82('0x8')]=BPromise[_0xff82('0x9')](ami['action']);function error(_0x3e17d5){logger[_0xff82('0xa')](util[_0xff82('0xb')](_0xff82('0xc'),config[_0xff82('0x4')][_0xff82('0x5')],config[_0xff82('0x4')]['ip'],config[_0xff82('0x4')][_0xff82('0xd')],util[_0xff82('0xe')](_0x3e17d5,![],null)));}function close(){logger[_0xff82('0xa')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xff82('0x4')][_0xff82('0x5')],config[_0xff82('0x4')]['ip'],config['asterisk'][_0xff82('0xd')]));}ami[_0xff82('0xf')]=function(){return function(){return ami[_0xff82('0x8')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0xff82('0x10')});};};ami[_0xff82('0x11')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xff82('0x12')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0xff82('0x13')]=function(){return function(){return ami['Action']({'action':_0xff82('0x14')});};};function connect(){logger[_0xff82('0x15')](util[_0xff82('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0xff82('0x5')],config[_0xff82('0x4')]['ip'],config[_0xff82('0x4')][_0xff82('0xd')]));ami[_0xff82('0x16')](_0xff82('0xa'),error);ami['once'](_0xff82('0x17'),close);}ami['on'](_0xff82('0x18'),connect);ami['on'](_0xff82('0x19'),function(_0x1778c1){logger[_0xff82('0x15')](util[_0xff82('0xb')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xff82('0x4')][_0xff82('0x5')],config[_0xff82('0x4')]['ip'],config[_0xff82('0x4')][_0xff82('0xd')],util[_0xff82('0xe')](_0x1778c1,![],null)));});ami['on'](_0xff82('0x1a'),function(){logger['info'](util[_0xff82('0xb')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0xff82('0x5')],config[_0xff82('0x4')]['ip'],config[_0xff82('0x4')][_0xff82('0xd')]));return Promise[_0xff82('0x1b')]()['then'](ami[_0xff82('0xf')]())[_0xff82('0x1c')](ami['actionDeviceStateList']())[_0xff82('0x1c')](ami[_0xff82('0x11')]())[_0xff82('0x1c')](ami[_0xff82('0x12')]())[_0xff82('0x1c')](ami[_0xff82('0x13')]())[_0xff82('0x1d')](function(_0x1cc2c2){logger[_0xff82('0xa')](_0xff82('0x1e'),util['inspect'](_0x1cc2c2,{'showHidden':![],'depth':null}));});});ami[_0xff82('0x16')](_0xff82('0xa'),error);ami[_0xff82('0x16')](_0xff82('0x17'),close);module[_0xff82('0x1f')]=ami; \ No newline at end of file +var _0x6302=['then','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','util','../../config/logger','ami','../../config/environment','asterisk','username','password','Action','promisify','action','error','format','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','once','connect','shutdown','info','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve'];(function(_0x5583b0,_0x3ce4ba){var _0x27c056=function(_0x128e20){while(--_0x128e20){_0x5583b0['push'](_0x5583b0['shift']());}};_0x27c056(++_0x3ce4ba);}(_0x6302,0x140));var _0x2630=function(_0x1b6d4d,_0x1a4e17){_0x1b6d4d=_0x1b6d4d-0x0;var _0x5a0a19=_0x6302[_0x1b6d4d];return _0x5a0a19;};'use strict';var Manager=require(_0x2630('0x0'));var BPromise=require('bluebird');var util=require(_0x2630('0x1'));var logger=require(_0x2630('0x2'))(_0x2630('0x3'));var config=require(_0x2630('0x4'));var ami=new Manager(config[_0x2630('0x5')]['port'],config['asterisk']['ip'],config['asterisk'][_0x2630('0x6')],config[_0x2630('0x5')][_0x2630('0x7')],!![]);ami['keepConnected']();ami[_0x2630('0x8')]=BPromise[_0x2630('0x9')](ami[_0x2630('0xa')]);function error(_0x1a77f6){logger[_0x2630('0xb')](util[_0x2630('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2630('0x5')][_0x2630('0x6')],config[_0x2630('0x5')]['ip'],config[_0x2630('0x5')][_0x2630('0xd')],util[_0x2630('0xe')](_0x1a77f6,![],null)));}function close(){logger[_0x2630('0xb')](util[_0x2630('0xc')](_0x2630('0xf'),config[_0x2630('0x5')][_0x2630('0x6')],config[_0x2630('0x5')]['ip'],config[_0x2630('0x5')]['port']));}ami[_0x2630('0x10')]=function(){return function(){return ami[_0x2630('0x8')]({'action':_0x2630('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x2630('0x12')});};};ami[_0x2630('0x13')]=function(){return function(){return ami[_0x2630('0x8')]({'action':'sippeerstatus'});};};ami[_0x2630('0x14')]=function(){return function(){return ami[_0x2630('0x8')]({'action':'queuesummary'});};};ami[_0x2630('0x15')]=function(){return function(){return ami[_0x2630('0x8')]({'action':_0x2630('0x16')});};};function connect(){logger['info'](util[_0x2630('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x2630('0x5')][_0x2630('0x6')],config[_0x2630('0x5')]['ip'],config['asterisk'][_0x2630('0xd')]));ami[_0x2630('0x17')]('error',error);ami['once']('close',close);}ami['on'](_0x2630('0x18'),connect);ami['on'](_0x2630('0x19'),function(_0xf63770){logger[_0x2630('0x1a')](util[_0x2630('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0x2630('0x5')]['ip'],config[_0x2630('0x5')]['port'],util['inspect'](_0xf63770,![],null)));});ami['on'](_0x2630('0x1b'),function(){logger[_0x2630('0x1a')](util[_0x2630('0xc')](_0x2630('0x1c'),config[_0x2630('0x5')]['username'],config[_0x2630('0x5')]['ip'],config[_0x2630('0x5')]['port']));return Promise[_0x2630('0x1d')]()[_0x2630('0x1e')](ami[_0x2630('0x10')]())['then'](ami[_0x2630('0x1f')]())[_0x2630('0x1e')](ami[_0x2630('0x13')]())[_0x2630('0x1e')](ami[_0x2630('0x14')]())[_0x2630('0x1e')](ami[_0x2630('0x15')]())[_0x2630('0x20')](function(_0x4e3c9c){logger[_0x2630('0xb')](_0x2630('0x21'),util['inspect'](_0x4e3c9c,{'showHidden':![],'depth':null}));});});ami[_0x2630('0x17')](_0x2630('0xb'),error);ami[_0x2630('0x17')]('close',close);module[_0x2630('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 332bd47..fd08e09 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x4018d0,_0x10df66){var _0x229c58=function(_0x35a8de){while(--_0x35a8de){_0x4018d0['push'](_0x4018d0['shift']());}};_0x229c58(++_0x10df66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0xcb91[_0x3ccdf8];return _0x243dab;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 91c28f7..2fc7dd6 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 _0x3bbf=['[booked][RR]','Agent:\x20','pick','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','getQueue','[syncOriginateResponse]','[callProgressDetecting]\x20','exten','xcally-motion-dialer','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','outboundAnswerCallsDay','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','[syncHangup]','ivrAnswerCallsDay','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangup2]','cause-txt','[syncAgentComplete][createHistory]','[syncAgentComplete]','[syncHangup][createHistory]','queuesSummary','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','startPredictive','available','inUse','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','[actions]','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','isOutboundQueue','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','dialAgentRejectRetryFrequency','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','talking','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalHitRate','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','loggedIn','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[checkContactBlack]','scheduledat','dialRecallMeTimeout','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','originated','temp','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]','[handleIvr]','dialLimitQueue','[countReScheduled]\x20','checkIsBlackList','[actionOriginate]','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','getContactDialer','dialOrderByScheduledAt','checkContactLowerLimitOriginate','countReScheduled','[actionOriginatePredictive]','[getContactCampaign2]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','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','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','state','endtime','starttime','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','queueStatusComplete','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','INACTIVE','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','Error','prototype','isTrunkReachable','active','status','reachable','SIP/%s','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','Action','command','iftime\x20%s,%s','interval','timezones','indexOf','catch','push','content','true','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','Interval','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','Queue','method\x20not\x20recognized','dialTimezone','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','decrementOriginate','answertime','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncQueueCallerAbandon]','getSeconds','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','rescheduleContact','add','minutes','ContactId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','strategy','rrmemory','roundrobin','isNil','actionid','locked','paused','stateinterface','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3bbf,0x130));var _0xf3bb=function(_0x3c1617,_0x158b25){_0x3c1617=_0x3c1617-0x0;var _0x15c9bb=_0x3bbf[_0x3c1617];return _0x15c9bb;};'use strict';var util=require('util');var _=require(_0xf3bb('0x0'));var uuid=require(_0xf3bb('0x1'));var moment=require(_0xf3bb('0x2'));var rr=require('rr');var Redis=require(_0xf3bb('0x3'));var utils=require(_0xf3bb('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0xf3bb('0x5'));var config=require(_0xf3bb('0x6'));var logger=require('../../../config/logger')(_0xf3bb('0x7'));var loggerBooked=require(_0xf3bb('0x8'))(_0xf3bb('0x9'));var loggerPredictive=require(_0xf3bb('0x8'))(_0xf3bb('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xf3bb('0xb'));var loggerSyncQueueSummary=require(_0xf3bb('0x8'))(_0xf3bb('0xc'));var ami=require('../ami');config[_0xf3bb('0xd')]=_[_0xf3bb('0xe')](config[_0xf3bb('0xd')],{'host':_0xf3bb('0xf'),'port':0x18eb});var io=require(_0xf3bb('0x10'))(new Redis(config[_0xf3bb('0xd')]));var cmHopper=require(_0xf3bb('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xf3bb('0x12'));var Interval=require(_0xf3bb('0x13'));var Action=require(_0xf3bb('0x14'));var History=require('./models/history');var Final=require(_0xf3bb('0x15'));var AgentComplete=require(_0xf3bb('0x16'));var QueueCallerAbandon=require(_0xf3bb('0x17'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0xf3bb('0x18')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xf3bb('0x19')]=function(_0x175b3d){this[_0xf3bb('0x1a')]=this[_0xf3bb('0x1a')]?this[_0xf3bb('0x1a')][_0xf3bb('0x1b')](_0x175b3d):_0x175b3d();};function Dialer(_0x37b286,_0x125240){this[_0xf3bb('0x1c')]=new Sequence();this[_0xf3bb('0x1d')]=_0x125240;this[_0xf3bb('0x1e')]=_0x37b286[_0xf3bb('0x1e')];this[_0xf3bb('0x1f')]=_0x37b286[_0xf3bb('0x1f')];this[_0xf3bb('0x20')]=_0x37b286[_0xf3bb('0x20')];this['trunks']=_0x37b286[_0xf3bb('0x21')];this[_0xf3bb('0x22')]=config[_0xf3bb('0x22')]||0x2;this[_0xf3bb('0x23')]={};this[_0xf3bb('0x24')]={};this[_0xf3bb('0x25')]={};this[_0xf3bb('0x26')]={};this[_0xf3bb('0x27')]={};this['startPredictive']={};this[_0xf3bb('0x28')]={};this[_0xf3bb('0x29')]={};this[_0xf3bb('0x2a')]={};this[_0xf3bb('0x2b')]={};this['queuesSummary']={};ami['on'](_0xf3bb('0x2c'),this[_0xf3bb('0x2d')]['bind'](this));ami['on'](_0xf3bb('0x2e'),this[_0xf3bb('0x2f')][_0xf3bb('0x30')](this));ami['on'](_0xf3bb('0x31'),this['syncOriginateResponse'][_0xf3bb('0x30')](this));ami['on'](_0xf3bb('0x32'),this[_0xf3bb('0x33')][_0xf3bb('0x30')](this));ami['on'](_0xf3bb('0x34'),this[_0xf3bb('0xc')][_0xf3bb('0x30')](this));ami['on'](_0xf3bb('0x35'),this[_0xf3bb('0x36')][_0xf3bb('0x30')](this));ami['on'](_0xf3bb('0x37'),this[_0xf3bb('0x38')][_0xf3bb('0x30')](this));ami['on'](_0xf3bb('0x39'),this[_0xf3bb('0x3a')][_0xf3bb('0x30')](this));ami['on'](_0xf3bb('0x3b'),this[_0xf3bb('0x3c')][_0xf3bb('0x30')](this));ami['on'](_0xf3bb('0x3d'),this[_0xf3bb('0x3e')][_0xf3bb('0x30')](this));ami['on']('queuestatuscomplete',this[_0xf3bb('0x3f')][_0xf3bb('0x30')](this));this[_0xf3bb('0x40')]();this[_0xf3bb('0x41')]();RpcSetting[_0xf3bb('0x42')]()[_0xf3bb('0x43')](function(_0xb8d4a3){previewRecallmeReminderInterval=_0xb8d4a3[_0xf3bb('0x44')];});}function isNotNull(_0x405f07){return _0x405f07!==null&&!_[_0xf3bb('0x45')](_0x405f07);}function msgResponse(_0x302406,_0x27be6e,_0x378e1a){return{'action':_0x302406,'response':_0x27be6e,'message':_0x378e1a,'stack':_0x378e1a};}function emit(_0x3d4f20,_0x414e22,_0x3f990d){io['to'](_0x3d4f20)[_0xf3bb('0x46')](_0x414e22,_0x3f990d);}function emitOutboundVoiceQueueSummary(_0xa0291b){if(_0xa0291b[_0xf3bb('0x47')]===_0xf3bb('0x48')){logger[_0xf3bb('0x49')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xf3bb('0x4a')](_0xa0291b,{'showHidden':![],'depth':null}));emit(util[_0xf3bb('0x4b')](_0xf3bb('0x4c'),_0xa0291b[_0xf3bb('0x4d')]),_0xf3bb('0x4e'),_0xa0291b);}}function checkGetDataPredictive(_0x5beae4){if(isNotNull(_0x5beae4)&&!_[_0xf3bb('0x4f')](_0x5beae4)){loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x51'));loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x52'),_0x5beae4['predictiveIntervalTotalCalls']);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x53'),_0x5beae4['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xf3bb('0x50')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5beae4[_0xf3bb('0x54')]);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x55'),_0x5beae4[_0xf3bb('0x56')]);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x57'),_0x5beae4[_0xf3bb('0x58')]);loggerPredictive[_0xf3bb('0x50')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5beae4[_0xf3bb('0x59')]);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x5a'));if(_0x5beae4[_0xf3bb('0x5b')]>0x0){if(!_[_0xf3bb('0x45')](_0x5beae4['predictiveIntervalAvgTalktime'])&&_0x5beae4['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xf3bb('0x45')](_0x5beae4[_0xf3bb('0x58')])&&_0x5beae4['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x5c'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xf3bb('0x50')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x4a6982){return function(_0xb95a03){loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x5d'));loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x5e'),_0xb95a03[_0xf3bb('0x5f')]);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x60'),_0xb95a03[_0xf3bb('0x61')]);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x62'),_0xb95a03[_0xf3bb('0x63')]);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x64'),_0xb95a03[_0xf3bb('0x65')]);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x62'),_0xb95a03['erlangAbandonmentRate']);loggerPredictive[_0xf3bb('0x50')]('---------------------------');_[_0xf3bb('0x66')](_0x4a6982,_0xb95a03);};}function ifInterval(_0x1f5808,_0x25972f){if(_[_0xf3bb('0x45')](_0x25972f)){return![];}return utils['getSeconds'](undefined,_0x25972f)<_0x1f5808*0x3c;}function clearPredictiveAttributes(_0x2064b1){if(_0x2064b1[_0xf3bb('0x28')]){_0x2064b1[_0xf3bb('0x28')]=undefined;loggerPredictive[_0xf3bb('0x49')](_0x2064b1[_0xf3bb('0x4d')],_0xf3bb('0x67'));}if(_0x2064b1['startPredictive']){_0x2064b1['startPredictive']=undefined;loggerPredictive[_0xf3bb('0x49')](_0x2064b1[_0xf3bb('0x4d')],_0xf3bb('0x68'));}if(_0x2064b1[_0xf3bb('0x69')]){clearInterval(_0x2064b1[_0xf3bb('0x69')]);_0x2064b1['handlePredictive']=undefined;loggerPredictive['debug'](_0x2064b1[_0xf3bb('0x4d')],_0xf3bb('0x6a'));}}function loggerCatchPredictive(_0x5e2ad3,_0x2c9a81){return function(_0x322eea){loggerPredictive[_0xf3bb('0x6b')](_0x2c9a81[_0xf3bb('0x4d')],_0x5e2ad3);loggerPredictive['error'](_0x322eea[_0xf3bb('0x6c')]);clearPredictiveAttributes(_0x2c9a81);};}function loggerCatch(_0x35af6c){return function(_0x482548){logger[_0xf3bb('0x6b')](_0x35af6c,util[_0xf3bb('0x4a')](_0x482548,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x132daa){return function(_0x5686d3){if(isNotNull(_0x5686d3)&&isNotNull(_0x5686d3[0x0])){if(_0x5686d3[0x0]['contactsRescheduled']>0x0){_0x132daa[_0xf3bb('0x6d')]=utils[_0xf3bb('0x6e')]['CONTACTS_RESCHEDULED'];logger[_0xf3bb('0x50')](_0xf3bb('0x6f')+_0x132daa[_0xf3bb('0x4d')],_0x5686d3[0x0][_0xf3bb('0x70')],_0xf3bb('0x71'));}else{_0x132daa[_0xf3bb('0x6d')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactDialer2][Empty]'+_0x132daa['name']);}}};}function createObjHistory(_0x25bf07,_0x144d52,_0x71738c,_0x2a41d1,_0x1ca5a7){_0x25bf07['message']=_0x71738c;var _0x3762f0=new Action(_0x25bf07,_0x144d52);var _0x40e64b=new History(_0x3762f0);_0x40e64b[_0xf3bb('0x72')]=_0x2a41d1;_0x40e64b['statedesc']=_0x1ca5a7;_0x40e64b[_0xf3bb('0x73')]=_0x3762f0[_0xf3bb('0x74')];return _0x40e64b;}function unlockQueueStatus(_0x497d00,_0x2af21a){setTimeout(function(){if(_[_0xf3bb('0x45')](_0x497d00['queueStatusComplete'])){loggerBooked[_0xf3bb('0x6b')](_0xf3bb('0x75'),_0x2af21a);}_0x497d00['queueStatusComplete']=!![];loggerBooked[_0xf3bb('0x50')](_0xf3bb('0x76'),_0x2af21a,JSON[_0xf3bb('0x77')](_['pick'](_0x497d00,[_0xf3bb('0x4d'),_0xf3bb('0x78')])));},0x1f3);}function checkInterval(_0x4126be){return function(){if(!isNotNull(_0x4126be['Interval'])){_0x4126be[_0xf3bb('0x6d')]=utils[_0xf3bb('0x6e')][_0xf3bb('0x79')];throw _0x4126be[_0xf3bb('0x4d')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4126be['Interval']['Intervals'])){_0x4126be[_0xf3bb('0x6d')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x4126be[_0xf3bb('0x4d')]+_0xf3bb('0x7a');}if(!isNotNull(_[_0xf3bb('0x4f')](_0x4126be['Interval'][_0xf3bb('0x7b')]))){_0x4126be[_0xf3bb('0x6d')]=utils[_0xf3bb('0x6e')][_0xf3bb('0x79')];throw _0x4126be[_0xf3bb('0x4d')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0xca4d0b){return function(){if(!utils[_0xf3bb('0x7c')](_0xca4d0b)){_0xca4d0b['message']=utils[_0xf3bb('0x6e')]['INACTIVE'];throw _0xca4d0b[_0xf3bb('0x4d')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x4ca17e){if(utils[_0xf3bb('0x7d')](_0x4ca17e)){emit(util['format'](_0xf3bb('0x7e'),_0x4ca17e[_0xf3bb('0x4d')]),_0xf3bb('0x7f'),_0x4ca17e);}}function loggerCatchQueueSummary(_0x2080b2,_0x54232d){return function(_0x46deda){clearPredictiveAttributes(_0x54232d);emitCampaignSummary(_0x54232d);loggerSyncQueueSummary['debug'](_0x2080b2,util[_0xf3bb('0x4a')](_0x46deda,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2c773a){if(_0x2c773a['sendMessageOneNotActive']){if(_0x2c773a['originated']===0x0){_0x2c773a[_0xf3bb('0x80')]=![];_0x2c773a[_0xf3bb('0x6d')]=utils[_0xf3bb('0x6e')][_0xf3bb('0x81')];loggerSyncQueueSummary[_0xf3bb('0x49')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2c773a[_0xf3bb('0x4d')],_0xf3bb('0x82'));}else{_0x2c773a[_0xf3bb('0x6d')]=utils[_0xf3bb('0x6e')][_0xf3bb('0x83')];loggerSyncQueueSummary[_0xf3bb('0x49')](_0xf3bb('0x84'),_0x2c773a[_0xf3bb('0x4d')],'is\x20deactivated');}emitCampaignSummary(_0x2c773a);}}function myreject(_0x4d2ddd){return function(_0x43c98c){return _0x4d2ddd(msgResponse('[ifTime][Action]',_0xf3bb('0x85'),JSON['stringify'](_0x43c98c)));};}Dialer[_0xf3bb('0x86')][_0xf3bb('0x87')]=function(_0xb97a58){return!_[_0xf3bb('0x45')](_0xb97a58)&&_0xb97a58&&!_['isUndefined'](_0xb97a58[_0xf3bb('0x4d')])&&!_['isUndefined'](_0xb97a58[_0xf3bb('0x88')])&&_0xb97a58[_0xf3bb('0x88')]&&(this[_0xf3bb('0x21')][util['format']('SIP/%s',_0xb97a58['name'])][_0xf3bb('0x89')]===_0xf3bb('0x8a')||this[_0xf3bb('0x21')][util['format'](_0xf3bb('0x8b'),_0xb97a58[_0xf3bb('0x4d')])][_0xf3bb('0x89')]==='unmonitored');};Dialer[_0xf3bb('0x86')][_0xf3bb('0x8c')]=function(_0x4b2ddb){var _0x489a26=this;return function(){if(!_0x489a26['isTrunkReachable'](_0x4b2ddb[_0xf3bb('0x8d')])){if(!_0x489a26[_0xf3bb('0x87')](_0x4b2ddb[_0xf3bb('0x8e')])){_0x4b2ddb[_0xf3bb('0x6d')]=utils[_0xf3bb('0x6e')][_0xf3bb('0x8f')];throw _0x4b2ddb[_0xf3bb('0x4d')]+_0xf3bb('0x90');}}};};Dialer[_0xf3bb('0x86')][_0xf3bb('0x91')]=function(_0x56b9aa,_0x21a297,_0x27f5ff,_0x4e05fd){var _0x81fa3c=this;return function(){var _0x460656=!![];return _0x81fa3c[_0xf3bb('0x92')](_0x56b9aa,_0x21a297,_0x27f5ff,_0x4e05fd,_0x460656);};};Dialer['prototype'][_0xf3bb('0x93')]=function(_0x4a4d8a,_0x419377,_0x2168ba,_0x48fe2a){var _0x2c6ec4=this;return function(){var _0x7da0b1=![];return _0x2c6ec4[_0xf3bb('0x92')](_0x4a4d8a[_0xf3bb('0x7b')],_0x419377,_0x2168ba,_0x48fe2a,_0x7da0b1);};};Dialer[_0xf3bb('0x86')]['ifTimeIvr']=function(_0x1cb460,_0x26ece9,_0x28c0ca,_0x1b9ced,_0xee7ef9){var _0x19e5af=[];return new Promise(function(_0x52d148,_0x16a2fb){if(!isNotNull(_0x1cb460)){_0x1b9ced['message']=utils[_0xf3bb('0x6e')]['NULL_INTERVAL'];return _0x16a2fb(msgResponse(_0xf3bb('0x94'),_0xf3bb('0x95'),_0x28c0ca+_0xf3bb('0x96')));}if(_[_0xf3bb('0x4f')](_0x1cb460)){_0x1b9ced[_0xf3bb('0x6d')]=utils[_0xf3bb('0x6e')][_0xf3bb('0x97')];return _0x16a2fb(msgResponse(_0xf3bb('0x94'),_0xf3bb('0x95'),_0x28c0ca+_0xf3bb('0x98')));}if(_0x26ece9&&_[_0xf3bb('0x45')](config['timezones'][_0x26ece9])){_0x1b9ced[_0xf3bb('0x6d')]=utils[_0xf3bb('0x6e')][_0xf3bb('0x99')];return _0x16a2fb(msgResponse('ifTime',_0xf3bb('0x95'),_0x28c0ca+_0xf3bb('0x9a')+_0x26ece9));}if(_[_0xf3bb('0x9b')](_0x1cb460)){for(var _0x254c5f=0x0;_0x254c5f<_0x1cb460[_0xf3bb('0x9c')];_0x254c5f+=0x1){_0x19e5af['push'](ami[_0xf3bb('0x9d')]({'action':_0xf3bb('0x9e'),'command':util[_0xf3bb('0x4b')](_0xf3bb('0x9f'),_0x1cb460[_0x254c5f][_0xf3bb('0xa0')],!_[_0xf3bb('0x45')](config[_0xf3bb('0xa1')][_0x26ece9])?_0x26ece9:'')})['then'](function(_0x4d0f74){return _0x4d0f74['content'][_0xf3bb('0xa2')]('true')>=0x0;})[_0xf3bb('0xa3')](myreject(_0x16a2fb)));}}else{_0x19e5af[_0xf3bb('0xa4')](ami[_0xf3bb('0x9d')]({'action':_0xf3bb('0x9e'),'command':util[_0xf3bb('0x4b')]('iftime\x20%s,%s',_0x1cb460,!_['isUndefined'](config[_0xf3bb('0xa1')][_0x26ece9])?_0x26ece9:'')})['then'](function(_0x21e8fb){return _0x21e8fb[_0xf3bb('0xa5')]['indexOf'](_0xf3bb('0xa6'))>=0x0;})[_0xf3bb('0xa3')](myreject(_0x16a2fb)));}Promise[_0xf3bb('0xa7')](_0x19e5af)['then'](function(_0x127e09){var _0x558ade=_[_0xf3bb('0xa8')](_0x127e09);if(_0x558ade){return _0x52d148(_0x558ade);}else{_0x1b9ced[_0xf3bb('0x6d')]=_0xee7ef9?utils[_0xf3bb('0x6e')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xf3bb('0x6e')][_0xf3bb('0xa9')];return _0x16a2fb(msgResponse(_0xf3bb('0xaa'),_0xf3bb('0x95'),_0xf3bb('0xab')+_0xee7ef9+'\x20'+_0x28c0ca+_0xf3bb('0xac')+util['inspect'](_0x1cb460,{'showHidden':![],'depth':null})+_0xf3bb('0xad')+_0x26ece9));}})['catch'](function(_0x2cbab8){return _0x16a2fb(msgResponse(_0xf3bb('0x94'),'Failure',JSON[_0xf3bb('0x77')](_0x2cbab8)));});});};Dialer[_0xf3bb('0x86')][_0xf3bb('0x40')]=function(){var _0x7352d9=this;return cmHopper[_0xf3bb('0xae')]({'active':![]},{'where':{'active':!![]}})[_0xf3bb('0x43')](function(){setInterval(function(){_0x7352d9[_0xf3bb('0xaf')]();},0x3e8);});};Dialer[_0xf3bb('0x86')][_0xf3bb('0xaf')]=function(){var _0x464d20=this;var _0xd59530;for(var _0x364248 in this[_0xf3bb('0x1f')]){if(typeof this[_0xf3bb('0x1f')][_0x364248]!==_0xf3bb('0xb0')){_0xd59530=this['campaigns'][_0x364248];if(utils['isIVRCampaign'](_0xd59530)&&utils[_0xf3bb('0x7c')](_0xd59530)){_0xd59530['sendMessageOneNotActive']=!![];Promise[_0xf3bb('0xb1')]()['then'](checkIsIVRCampaignActive(_0xd59530))[_0xf3bb('0x43')](checkInterval(_0xd59530))[_0xf3bb('0x43')](_0x464d20[_0xf3bb('0x8c')](_0xd59530))[_0xf3bb('0x43')](_0x464d20['checkIfTime'](_0xd59530['dialGlobalInterval'],_0xd59530['dialTimezone'],_0xd59530[_0xf3bb('0x4d')],_0xd59530))['then'](_0x464d20[_0xf3bb('0x93')](_0xd59530[_0xf3bb('0xb2')],_0xd59530['dialTimezone'],_0xd59530[_0xf3bb('0x4d')],_0xd59530))[_0xf3bb('0x43')](_0x464d20[_0xf3bb('0xb3')](_0xd59530))[_0xf3bb('0xa3')](loggerCatchQueueSummary(_0xf3bb('0xb4'),_0xd59530));}else{notSendMessagesCampaign(_0xd59530);}}}};Dialer[_0xf3bb('0x86')][_0xf3bb('0xb5')]=function(_0x4ec733){if(_0x4ec733[_0xf3bb('0xb6')]!==_0xf3bb('0xa')){clearPredictiveAttributes(_0x4ec733);}switch(_0x4ec733['dialMethod']){case'progressive':this[_0xf3bb('0xb7')](_0x4ec733,0x1);break;case _0xf3bb('0xb8'):this[_0xf3bb('0xb7')](_0x4ec733,_0x4ec733['dialPowerLevel']);break;case _0xf3bb('0xa'):this[_0xf3bb('0xa')](_0x4ec733);break;case _0xf3bb('0x9'):this[_0xf3bb('0xb7')](_0x4ec733,0x1);break;default:logger[_0xf3bb('0x6b')](_0xf3bb('0xb9'),_0x4ec733[_0xf3bb('0x4d')],_0xf3bb('0xba'));}};Dialer[_0xf3bb('0x86')]['ifTime']=function(_0xe05b3c,_0x8c8901){var _0x5bf0d1=_0xe05b3c[_0xf3bb('0xbb')];var _0x3fb125=_0x8c8901?_0xe05b3c[_0xf3bb('0xbc')]:_0xe05b3c['Interval'][_0xf3bb('0x7b')];logger['silly'](_0xf3bb('0xbd'),_0x3fb125,_0x5bf0d1,_0xe05b3c[_0xf3bb('0x4d')],util[_0xf3bb('0x4b')](_0xf3bb('0xbe'),_0xe05b3c[_0xf3bb('0x4d')],_0xe05b3c['id']));var _0x46c27f=null;return Interval[_0xf3bb('0xbf')](_0x3fb125,_0x5bf0d1)[_0xf3bb('0x43')](function(_0xb01533){if(_0xb01533===!![]){return _0xb01533;}else{_0xe05b3c[_0xf3bb('0x6d')]=_0x8c8901?utils['CAMPAIGN_STATUS'][_0xf3bb('0xc0')]:utils[_0xf3bb('0x6e')][_0xf3bb('0xa9')];_0x46c27f=msgResponse(_0xf3bb('0xaa'),_0xf3bb('0x95'),'Global:\x20'+_0x8c8901+'\x20'+_0xe05b3c[_0xf3bb('0x4d')]+_0xf3bb('0xac')+util[_0xf3bb('0x4a')](_0x3fb125,{'showHidden':![],'depth':null})+_0xf3bb('0xad')+_0x5bf0d1);}if(_0x46c27f!==null){logger['silly'](_0xf3bb('0xc1'),_0x46c27f);_0x46c27f[_0xf3bb('0xc2')]=_0x8c8901;throw _0x46c27f;}})[_0xf3bb('0xa3')](function(_0x3a1b8b){logger['error'](_0xf3bb('0xc3'),_0x3a1b8b);throw msgResponse(_0xf3bb('0xc4'),'Error',util[_0xf3bb('0x4a')](_0x3a1b8b,{'showHidden':![],'depth':null}));});};Dialer[_0xf3bb('0x86')][_0xf3bb('0x2d')]=function(_0x31f366){if(this[_0xf3bb('0x1e')][_0x31f366[_0xf3bb('0xc5')]]){if(this['uniqueId'][_0x31f366[_0xf3bb('0xc6')]]&&this[_0xf3bb('0x26')][_0x31f366[_0xf3bb('0xc6')]][_0xf3bb('0x47')]!==_0xf3bb('0xc7')){utils[_0xf3bb('0xc8')](this[_0xf3bb('0x1e')][_0x31f366[_0xf3bb('0xc5')]],'[syncAgentConnect]');this[_0xf3bb('0x26')][_0x31f366[_0xf3bb('0xc6')]][_0xf3bb('0xc9')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0xf3bb('0x33')]=function(_0x19401c){var _0x57921f=this['uniqueId'][_0x19401c[_0xf3bb('0xc6')]];if(this[_0xf3bb('0x1e')][_0x19401c['queue']]){if(_0x57921f&&_0x57921f[_0xf3bb('0x47')]!==_0xf3bb('0xc7')){delete this[_0xf3bb('0x26')][_0x19401c['uniqueid']];this[_0xf3bb('0x1e')][_0x19401c[_0xf3bb('0xc5')]]['outboundAnswerCallsDay']+=0x1;var _0xee79b6=new AgentComplete(_0x57921f,_0x19401c);if(_0x19401c['reason']===_0xf3bb('0xca')){_0xee79b6[_0xf3bb('0xcb')]=this['voiceQueues'][_0x19401c['queue']][_0xf3bb('0xcc')]&&this[_0xf3bb('0x1e')][_0x19401c[_0xf3bb('0xc5')]][_0xf3bb('0xcd')]?moment()[_0xf3bb('0x4b')](_0xf3bb('0xce')):undefined;}hopperUtils[_0xf3bb('0xcf')](_0xee79b6)[_0xf3bb('0xa3')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0xee79b6)[_0xf3bb('0xa3')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xf3bb('0x2f')]=function(_0x5310c8){var _0x4f4cda=this[_0xf3bb('0x26')][_0x5310c8[_0xf3bb('0xc6')]];var _0x5ea3fd=this;var _0x4a9d41=![];var _0x3d304b;var _0x2a3f01;if(this[_0xf3bb('0x1e')][_0x5310c8[_0xf3bb('0xc5')]]){if(_0x4f4cda&&_0x4f4cda[_0xf3bb('0x47')]!=='ivr'){delete this[_0xf3bb('0x26')][_0x5310c8[_0xf3bb('0xc6')]];utils[_0xf3bb('0xc8')](this[_0xf3bb('0x1e')][_0x5310c8[_0xf3bb('0xc5')]],_0xf3bb('0xd0'));_0x4f4cda['droptime']=moment()[_0xf3bb('0x4b')](_0xf3bb('0xce'));var _0x3a48ea=new QueueCallerAbandon(_0x4f4cda,_0x5310c8);if(utils[_0xf3bb('0xd1')](_0x4f4cda[_0xf3bb('0xd2')],_0x4f4cda[_0xf3bb('0xd3')])>=_0x4f4cda[_0xf3bb('0xd4')]){this['voiceQueues'][_0x5310c8[_0xf3bb('0xc5')]][_0xf3bb('0x54')]+=0x1;this[_0xf3bb('0x1e')][_0x5310c8[_0xf3bb('0xc5')]][_0xf3bb('0xd5')]+=0x1;this[_0xf3bb('0x1e')][_0x5310c8[_0xf3bb('0xc5')]][_0xf3bb('0xd6')]+=0x1;_0x3a48ea[_0xf3bb('0x72')]=0xa;_0x3a48ea[_0xf3bb('0xd7')]=_0xf3bb('0xd8');_0x3a48ea[_0xf3bb('0xd9')]=_0xf3bb('0xda');_0x3a48ea[_0xf3bb('0xcb')]=this[_0xf3bb('0x1e')][_0x5310c8['queue']][_0xf3bb('0xcc')]?moment()['format'](_0xf3bb('0xce')):undefined;_0x3a48ea[_0xf3bb('0xdb')]+=0x1;_0x3a48ea[_0xf3bb('0xdc')]+=0x1;_0x3d304b=this[_0xf3bb('0x1e')][_0x5310c8[_0xf3bb('0xc5')]][_0xf3bb('0xdd')];_0x2a3f01=this[_0xf3bb('0x1e')][_0x5310c8[_0xf3bb('0xc5')]][_0xf3bb('0xde')];hopperUtils[_0xf3bb('0xdf')](_0x3a48ea,_0x3a48ea[_0xf3bb('0x72')],_0x4f4cda[_0xf3bb('0xe0')])['then'](function(_0x4ab0d6){_0x4a9d41=_0x4ab0d6[_0xf3bb('0xe1')]==0x1;if(_0x3a48ea[_0xf3bb('0xdb')]>=_0x5ea3fd[_0xf3bb('0x1e')][_0x5310c8['queue']]['dialDropMaxRetry']){_0x5ea3fd[_0xf3bb('0xe2')](_0x3a48ea,_0x4ab0d6[_0xf3bb('0xe1')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x3a48ea[_0xf3bb('0xdb')],'scheduledat':moment()['add'](_0x5ea3fd[_0xf3bb('0x1e')][_0x5310c8[_0xf3bb('0xc5')]][_0xf3bb('0xdd')],'minutes')[_0xf3bb('0x4b')](_0xf3bb('0xce')),'ContactId':_0x4f4cda['ContactId'],'ListId':_0x4f4cda[_0xf3bb('0xe3')],'VoiceQueueId':_0x4f4cda[_0xf3bb('0xe4')]||undefined,'CampaignId':_0x4f4cda[_0xf3bb('0xe5')]||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0xe6')));var _0x1bd34b=new History(_0x3a48ea);_0x1bd34b['state']=0xa;_0x1bd34b['statedesc']=_0xf3bb('0xd8');_0x1bd34b[_0xf3bb('0x74')]=moment()['format'](_0xf3bb('0xce'));_0x1bd34b[_0xf3bb('0x73')]=_0x1bd34b[_0xf3bb('0x74')];_0x1bd34b[_0xf3bb('0xe7')]=_0x3a48ea[_0xf3bb('0xe7')];_0x1bd34b[_0xf3bb('0xe8')]=_0x3a48ea[_0xf3bb('0xe8')];hopperUtils[_0xf3bb('0xcf')](_0x1bd34b)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0xe9')));}})['then'](function(){if(_0x4a9d41)hopperUtils['swapAdditionalPhones'](_0x3a48ea,_0x3d304b,_0x2a3f01)[_0xf3bb('0x43')](function(){return 0x1;});});}else{this['voiceQueues'][_0x5310c8[_0xf3bb('0xc5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xf3bb('0x1e')][_0x5310c8[_0xf3bb('0xc5')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3a48ea[_0xf3bb('0x72')]=0xb;_0x3a48ea['statedesc']=_0xf3bb('0xea');_0x3a48ea[_0xf3bb('0xd9')]=_0xf3bb('0xeb');_0x3a48ea[_0xf3bb('0xec')]+=0x1;_0x3a48ea[_0xf3bb('0xdc')]+=0x1;_0x3d304b=this[_0xf3bb('0x1e')][_0x5310c8['queue']][_0xf3bb('0xed')];_0x2a3f01=this['voiceQueues'][_0x5310c8['queue']][_0xf3bb('0xde')];hopperUtils['verifyAdditionalPhones'](_0x3a48ea,_0x3a48ea[_0xf3bb('0x72')],_0x4f4cda[_0xf3bb('0xe0')])[_0xf3bb('0x43')](function(_0x31201e){if(_0x3a48ea['countabandonedretry']>=_0x5ea3fd[_0xf3bb('0x1e')][_0x5310c8[_0xf3bb('0xc5')]]['dialAbandonedMaxRetry']){_0x5ea3fd[_0xf3bb('0xe2')](_0x3a48ea,_0x31201e[_0xf3bb('0xe1')]);}else{hopperUtils[_0xf3bb('0xee')]({'active':![],'countabandonedretry':_0x3a48ea[_0xf3bb('0xec')],'scheduledat':moment()[_0xf3bb('0xef')](_0x5ea3fd[_0xf3bb('0x1e')][_0x5310c8[_0xf3bb('0xc5')]][_0xf3bb('0xed')],_0xf3bb('0xf0'))[_0xf3bb('0x4b')](_0xf3bb('0xce')),'ContactId':_0x4f4cda[_0xf3bb('0xf1')],'ListId':_0x4f4cda[_0xf3bb('0xe3')],'VoiceQueueId':_0x4f4cda['VoiceQueueId']||undefined,'CampaignId':_0x4f4cda[_0xf3bb('0xe5')]||undefined})['catch'](loggerCatch(_0xf3bb('0xf2')));var _0x2e7bd1=new History(_0x3a48ea);_0x2e7bd1[_0xf3bb('0x72')]=0xb;_0x2e7bd1[_0xf3bb('0xd7')]='Abandoned';_0x2e7bd1['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2e7bd1[_0xf3bb('0x73')]=_0x2e7bd1[_0xf3bb('0x74')];_0x2e7bd1[_0xf3bb('0xe7')]=_0x3a48ea[_0xf3bb('0xe7')];_0x2e7bd1[_0xf3bb('0xe8')]=_0x3a48ea[_0xf3bb('0xe8')];hopperUtils[_0xf3bb('0xcf')](_0x2e7bd1)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0xf3')));}})[_0xf3bb('0x43')](function(){if(_0x4a9d41)hopperUtils[_0xf3bb('0xf4')](_0x3a48ea,_0x3d304b,_0x2a3f01)['then'](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0x105262){if(this[_0xf3bb('0x24')][_0x105262[_0xf3bb('0xc6')]]){this[_0xf3bb('0x24')][_0x105262[_0xf3bb('0xc6')]][_0xf3bb('0xf5')]=_0x105262[_0xf3bb('0xf5')];}if(this['uniqueId'][_0x105262[_0xf3bb('0xc6')]]){this[_0xf3bb('0x26')][_0x105262[_0xf3bb('0xc6')]][_0xf3bb('0xf5')]=_0x105262['channel'];}};Dialer['prototype'][_0xf3bb('0x3e')]=function(_0x4882d4){if(!this[_0xf3bb('0x24')][_0x4882d4['actionid']]){return;}var _0x40518b=this['voiceQueues'][this['actions'][_0x4882d4['actionid']][_0xf3bb('0xc5')]][_0xf3bb('0xf6')]||_0xf3bb('0xf7');if(_0x40518b===_0xf3bb('0xf8')){if(this[_0xf3bb('0x24')][_0x4882d4['actionid']]&&_[_0xf3bb('0xf9')](this['actions'][_0x4882d4[_0xf3bb('0xfa')]][_0xf3bb('0xfb')])&&_0x4882d4['status']==='1'&&_0x4882d4[_0xf3bb('0xfc')]==='0'){if(this[_0xf3bb('0x20')][_0x4882d4[_0xf3bb('0xfd')]]){if(!this[_0xf3bb('0x20')][_0x4882d4[_0xf3bb('0xfd')]][_0xf3bb('0xfb')]){this[_0xf3bb('0x20')][_0x4882d4[_0xf3bb('0xfd')]][_0xf3bb('0xfb')]=!![];this[_0xf3bb('0x24')][_0x4882d4[_0xf3bb('0xfa')]][_0xf3bb('0xfb')]=!![];this['actions'][_0x4882d4[_0xf3bb('0xfa')]]['stateinterface']=_0x4882d4[_0xf3bb('0xfd')];}}}}else if(_0x40518b==='rrmemory'){if(this[_0xf3bb('0x24')][_0x4882d4[_0xf3bb('0xfa')]]){if(this[_0xf3bb('0x20')][_0x4882d4['stateinterface']]){this[_0xf3bb('0x24')][_0x4882d4['actionid']]['stateinterface']=_0x4882d4[_0xf3bb('0xfd')];if(_[_0xf3bb('0xf9')](this[_0xf3bb('0x2a')][this[_0xf3bb('0x24')][_0x4882d4['actionid']][_0xf3bb('0xc5')]])){this[_0xf3bb('0x2a')][this['actions'][_0x4882d4['actionid']][_0xf3bb('0xc5')]]=[];}this['queueBooked'][this[_0xf3bb('0x24')][_0x4882d4[_0xf3bb('0xfa')]]['queue']][_0xf3bb('0xa4')](_[_0xf3bb('0x66')](_['pick'](this['actions'][_0x4882d4[_0xf3bb('0xfa')]],[_0xf3bb('0xfe'),_0xf3bb('0xfd')]),{'status':_0x4882d4[_0xf3bb('0x89')],'paused':_0x4882d4[_0xf3bb('0xfc')]}));}}}};Dialer['prototype'][_0xf3bb('0x3f')]=function(_0x4e338d){if(!this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]]){return;}var _0x5c3e78=this;var _0xbc572c=this[_0xf3bb('0x1e')][this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xc5')]];var _0x55fd91=_0xbc572c[_0xf3bb('0xf6')]||_0xf3bb('0xf7');if(_0x55fd91===_0xf3bb('0xf8')){if(this[_0xf3bb('0x24')][_0x4e338d['actionid']]&&this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xfd')]){this['preview'][_0xf3bb('0xff')](this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]]['idHopper'],this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xfd')])[_0xf3bb('0xa3')](function(_0x1c5667){logger['error'](_0xf3bb('0x100'),util['inspect'](_0x1c5667,{'showHidden':![],'depth':null}));})[_0xf3bb('0x1b')](function(){utils[_0xf3bb('0xc8')](_0x5c3e78[_0xf3bb('0x1e')][_0x5c3e78[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xc5')]],_0xf3bb('0x101'));_0x5c3e78[_0xf3bb('0x20')][_0x5c3e78[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]]['stateinterface']][_0xf3bb('0xfb')]=![];delete _0x5c3e78[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]];unlockQueueStatus(_0xbc572c);});}else{utils[_0xf3bb('0xc8')](this[_0xf3bb('0x1e')][this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xc5')]],_0xf3bb('0x101'));hopperUtils[_0xf3bb('0xee')]({'active':![],'ContactId':this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xf1')],'ListId':this[_0xf3bb('0x24')][_0x4e338d['actionid']]['ListId'],'VoiceQueueId':this[_0xf3bb('0x24')][_0x4e338d['actionid']][_0xf3bb('0xe4')]||undefined,'CampaignId':this['actions'][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xe5')]||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x102')));delete this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]];unlockQueueStatus(_0xbc572c);}}else if(_0x55fd91==='rrmemory'){var _0x56de89;if(this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]]&&!_[_0xf3bb('0x4f')](this[_0xf3bb('0x2a')][this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xc5')]])){if(this['queueBookedRR'][_0x5c3e78[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xc5')]]){this[_0xf3bb('0x2b')][_0x5c3e78['actions'][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xc5')]]=this['queueBookedRR'][this['actions'][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xc5')]]?this['queueBookedRR'][this['actions'][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xc5')]]:this[_0xf3bb('0x2a')][this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]]['queue']]?this[_0xf3bb('0x2a')][this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xc5')]]['_rr']||0x0:0x0;}this[_0xf3bb('0x2a')][this[_0xf3bb('0x24')][_0x4e338d[_0xf3bb('0xfa')]]['queue']]['_rr']=this[_0xf3bb('0x2b')][this['actions'][_0x4e338d[_0xf3bb('0xfa')]][_0xf3bb('0xc5')]];for(var _0xa23ad=0x0;_0xa23ad=_0x6ce0bc[_0xf3bb('0x125')]){_0x58cb5d[_0xf3bb('0x126')](_0x2fb577,_0x136c82,_0xd4c5d4,_0xf3bb('0x127'));}else{if(_0x2fb577[_0xf3bb('0x121')]>=_0x6ce0bc[_0xf3bb('0x128')]){_0x58cb5d[_0xf3bb('0x129')](_0x2fb577,_0x136c82,_0xd4c5d4,_0xf3bb('0x12a'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2fb577[_0xf3bb('0x121')],'scheduledat':moment()[_0xf3bb('0xef')](_0x6ce0bc[_0xf3bb('0x12b')],_0xf3bb('0xf0'))[_0xf3bb('0x4b')](_0xf3bb('0xce')),'ContactId':_0x2fb577[_0xf3bb('0xf1')],'ListId':_0x2fb577[_0xf3bb('0xe3')],'VoiceQueueId':_0x2fb577['VoiceQueueId']||undefined,'CampaignId':_0x2fb577['CampaignId']||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x12c')));_0x136c82({'reschedule':0x1});}}});}if(_0x587252[_0xf3bb('0x47')]===_0xf3bb('0xc7')&&this[_0xf3bb('0x1f')][_0x587252[_0xf3bb('0xc5')]][_0xf3bb('0x11d')]&&_0x3a211c[_0xf3bb('0x111')]===_0xf3bb('0x112')){delete this[_0xf3bb('0x26')][_0x3a211c[_0xf3bb('0xc6')]];utils[_0xf3bb('0xc8')](this[_0xf3bb('0x1f')][_0x587252[_0xf3bb('0xc5')]],_0xf3bb('0x113'));_0x2279fd=new Hangup(_0x587252,_0x3a211c);_0x2279fd['state']=0x12;_0x2279fd[_0xf3bb('0xd7')]=_0xf3bb('0x115');_0x2279fd[_0xf3bb('0x116')]='AMD';ami['emit'](_0xf3bb('0x118'),ut[_0xf3bb('0x119')](_0x2279fd,'amd'));this[_0xf3bb('0x12d')](_0x2279fd,_0xf3bb('0x12e'),_0xf3bb('0x12f'));}if(_0x587252['type']==='ivr'&&this[_0xf3bb('0x1f')][_0x587252['queue']][_0xf3bb('0x11d')]&&_0x3a211c['value']==='MACHINE'){return new Promise(function(_0x5c01cf,_0x3356dd){delete _0x58cb5d['uniqueId'][_0x3a211c['uniqueid']];utils['decrementOriginate'](_0x58cb5d[_0xf3bb('0x1f')][_0x587252['queue']],_0xf3bb('0x113'));_0x58cb5d['campaigns'][_0x587252['queue']][_0xf3bb('0x11f')]+=0x1;_0x58cb5d[_0xf3bb('0x1f')][_0x587252['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x4a0c57=_0x58cb5d[_0xf3bb('0x1f')][_0x587252[_0xf3bb('0xc5')]];var _0x455bf2=new Hangup(_0x587252,_0x3a211c);_0x455bf2['state']=0x13;_0x455bf2[_0xf3bb('0xd7')]='Machine';_0x455bf2[_0xf3bb('0x116')]=_0xf3bb('0x117');_0x455bf2[_0xf3bb('0x121')]+=0x1;_0x455bf2[_0xf3bb('0xdc')]+=0x1;_0x455bf2[_0xf3bb('0x11a')]=!![];ami[_0xf3bb('0x46')](_0xf3bb('0x118'),ut['buildObj'](_0x455bf2,_0xf3bb('0x11a')));hopperUtils[_0xf3bb('0xcf')](_0x455bf2)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x122')));if(_0x455bf2['countbusyretry']+_0x455bf2[_0xf3bb('0x130')]+_0x455bf2[_0xf3bb('0x131')]+_0x455bf2[_0xf3bb('0x132')]+_0x455bf2[_0xf3bb('0xdb')]+_0x455bf2[_0xf3bb('0xec')]+_0x455bf2[_0xf3bb('0x121')]+_0x455bf2[_0xf3bb('0x124')]>=_0x4a0c57['dialGlobalMaxRetry']){_0x58cb5d[_0xf3bb('0x126')](_0x455bf2,_0x5c01cf,_0x3356dd,'reason19\x20machine....');}else{if(_0x455bf2['countmachineretry']>=_0x4a0c57[_0xf3bb('0x128')]){_0x58cb5d[_0xf3bb('0x129')](_0x455bf2,_0x5c01cf,_0x3356dd,_0xf3bb('0x12a'));}else{hopperUtils[_0xf3bb('0xee')]({'active':![],'countmachineretry':_0x455bf2['countmachineretry'],'scheduledat':moment()[_0xf3bb('0xef')](_0x4a0c57[_0xf3bb('0x12b')],_0xf3bb('0xf0'))[_0xf3bb('0x4b')](_0xf3bb('0xce')),'ContactId':_0x455bf2[_0xf3bb('0xf1')],'ListId':_0x455bf2['ListId'],'VoiceQueueId':_0x455bf2[_0xf3bb('0xe4')]||undefined,'CampaignId':_0x455bf2[_0xf3bb('0xe5')]||undefined})[_0xf3bb('0xa3')](loggerCatch('[rescheduleContact][Machine]'));_0x5c01cf({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xf3bb('0x38')]=function(_0x1e51a9){var _0x1cebdc=this[_0xf3bb('0x26')][_0x1e51a9[_0xf3bb('0xc6')]];var _0x36d6e9;if(!_0x1cebdc){return;}if(_0x1cebdc[_0xf3bb('0x47')]==='ivr'){delete this[_0xf3bb('0x26')][_0x1e51a9[_0xf3bb('0xc6')]];utils['decrementOriginate'](this[_0xf3bb('0x1f')][_0x1cebdc['queue']],_0xf3bb('0x133'));this[_0xf3bb('0x1f')][_0x1cebdc['queue']][_0xf3bb('0x134')]+=0x1;if(_0x1e51a9['cause-txt']===_0xf3bb('0x135')){const _0x2aa681=new AgentComplete(_0x1cebdc,_0x1e51a9);_0x2aa681['CampaignId']=this[_0xf3bb('0x1f')][_0x1cebdc[_0xf3bb('0xc5')]]['id'];hopperUtils[_0xf3bb('0xcf')](_0x2aa681)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x136')));hopperUtils[_0xf3bb('0x137')](_0x2aa681)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x138')));}else{_0x36d6e9=new Hangup(_0x1cebdc,_0x1e51a9);hopperUtils['createHistory'](_0x36d6e9)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x139')));hopperUtils[_0xf3bb('0x137')](_0x36d6e9)['catch'](loggerCatch(_0xf3bb('0x13a')));}}else{if(isNotNull(this['voiceQueues'][_0x1cebdc[_0xf3bb('0xc5')]][_0xf3bb('0x13b')])){delete this[_0xf3bb('0x26')][_0x1e51a9['uniqueid']];utils['decrementOriginate'](this[_0xf3bb('0x1e')][_0x1cebdc[_0xf3bb('0xc5')]],_0xf3bb('0x133'));this['voiceQueues'][_0x1cebdc[_0xf3bb('0xc5')]]['outboundAnswerCallsDay']+=0x1;this[_0xf3bb('0x1e')][_0x1cebdc[_0xf3bb('0xc5')]]['outboundAnswerAgiCallsDay']+=0x1;_0x36d6e9=new Hangup(_0x1cebdc,_0x1e51a9);_0x36d6e9[_0xf3bb('0x72')]=0x10;_0x36d6e9['statedesc']=_0xf3bb('0x13c');_0x36d6e9[_0xf3bb('0x116')]=_0xf3bb('0x13d');hopperUtils[_0xf3bb('0xcf')](_0x36d6e9)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x139')));hopperUtils['moveContactManagedDialer'](_0x36d6e9)['catch'](loggerCatch('[syncHangupIvr]'));}else{delete this['uniqueId'][_0x1e51a9[_0xf3bb('0xc6')]];utils[_0xf3bb('0xc8')](this[_0xf3bb('0x1e')][_0x1cebdc['queue']],_0xf3bb('0x13e'));if(_0x1e51a9[_0xf3bb('0x13f')]==='Normal\x20Clearing'){this['voiceQueues'][_0x1cebdc[_0xf3bb('0xc5')]][_0xf3bb('0x11f')]+=0x1;const _0x11ff0b=new AgentComplete(_0x1cebdc,_0x1e51a9);_0x11ff0b['VoiceQueueId']=this[_0xf3bb('0x1e')][_0x1cebdc['queue']]['id'];hopperUtils[_0xf3bb('0xcf')](_0x11ff0b)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x140')));hopperUtils['moveContactManagedDialer'](_0x11ff0b)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x141')));}else{this[_0xf3bb('0x1e')][_0x1cebdc['queue']]['outboundUnknownCallsDay']+=0x1;_0x36d6e9=new Hangup(_0x1cebdc,_0x1e51a9);_0x36d6e9[_0xf3bb('0x72')]=0xc;_0x36d6e9[_0xf3bb('0xd7')]=_0x1e51a9[_0xf3bb('0x13f')];_0x36d6e9[_0xf3bb('0x116')]='Unknown';hopperUtils[_0xf3bb('0xcf')](_0x36d6e9)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x142')));hopperUtils[_0xf3bb('0x137')](_0x36d6e9)['catch'](loggerCatch(_0xf3bb('0x133')));}}}};Dialer[_0xf3bb('0x86')][_0xf3bb('0xc')]=function(_0x2b5668){var _0x349951=this;if(!_0x349951[_0xf3bb('0x143')][_0x2b5668[_0xf3bb('0x4d')]]){_0x349951['queuesSummary'][_0x2b5668[_0xf3bb('0x4d')]]={'running':![]};}else if(_0x349951[_0xf3bb('0x143')][_0x2b5668['name']][_0xf3bb('0x144')]===!![]){return;}else if(_0x349951[_0xf3bb('0x143')][_0x2b5668['name']][_0xf3bb('0x144')]===![]){_0x349951[_0xf3bb('0x143')][_0x2b5668[_0xf3bb('0x4d')]][_0xf3bb('0x144')]=!![];}var _0x3fc9fd=_0x349951['voiceQueues'][_0x2b5668[_0xf3bb('0x4d')]];var _0x1dd17c=_0x3fc9fd[_0xf3bb('0x6d')]!==utils[_0xf3bb('0x6e')]['INACTIVE'];var _0x3c4df2=utils[_0xf3bb('0x145')](_0x3fc9fd);_0x3fc9fd['statusMessage']=utils[_0xf3bb('0x146')](_0x3fc9fd,_0x349951['trunks']);Promise[_0xf3bb('0xb1')]()[_0xf3bb('0x43')](function(){if(_0x3fc9fd[_0xf3bb('0x147')]===utils[_0xf3bb('0x6e')]['INACTIVE']){if(_0x1dd17c){clearPredictiveAttributes(_0x3fc9fd);_0x2b5668[_0xf3bb('0x148')]=undefined;_0x2b5668[_0xf3bb('0x28')]=undefined;}if(_0x3fc9fd[_0xf3bb('0x147')]===utils[_0xf3bb('0x6e')][_0xf3bb('0x81')]){_0x2b5668[_0xf3bb('0x149')]=0x0;_0x2b5668[_0xf3bb('0xfc')]=0x0;_0x2b5668[_0xf3bb('0x14a')]=0x0;_0x2b5668['talking']=0x0;_0x2b5668[_0xf3bb('0x14b')]=0x0;}}else if(_0x3fc9fd[_0xf3bb('0x147')]===utils['CAMPAIGN_STATUS'][_0xf3bb('0x14c')]&&!_0x3c4df2){return _0x349951[_0xf3bb('0x94')](_0x3fc9fd,!![])[_0xf3bb('0x43')](function(){return _0x349951[_0xf3bb('0x94')](_0x3fc9fd,![]);})['then'](function(){return _0x349951[_0xf3bb('0xb5')](_0x3fc9fd);})[_0xf3bb('0xa3')](function(_0x1c8751){loggerSyncQueueSummary[_0xf3bb('0x49')](_0xf3bb('0x14d'),util[_0xf3bb('0x4a')](_0x1c8751,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3fc9fd);});}else{clearPredictiveAttributes(_0x3fc9fd);}})['then'](function(){var _0xc38343=_0x2b5668[_0xf3bb('0x14e')](_0x3fc9fd);if(_0xc38343||_0x3fc9fd[_0xf3bb('0x14f')]){_0x3fc9fd[_0xf3bb('0x14f')]=![];_0x2b5668[_0xf3bb('0x150')](_0x3fc9fd);Object[_0xf3bb('0x151')](_0x3fc9fd,_0x2b5668);emitOutboundVoiceQueueSummary(_0x2b5668);}_0x349951[_0xf3bb('0x143')][_0x3fc9fd[_0xf3bb('0x4d')]]['running']=![];})[_0xf3bb('0xa3')](function(_0x30a0cc){logger[_0xf3bb('0x6b')](_0xf3bb('0x14d'),util['inspect'](_0x30a0cc,{'showHidden':![],'depth':null}));_0x349951['queuesSummary'][_0x3fc9fd[_0xf3bb('0x4d')]][_0xf3bb('0x144')]=![];});};Dialer['prototype'][_0xf3bb('0x36')]=_[_0xf3bb('0x152')](function(){var _0xbdaeeb=_[_0xf3bb('0x153')](this[_0xf3bb('0x1e')],function(_0x5a1700){return _0x5a1700[_0xf3bb('0x154')];});var _0x4429e9=_[_0xf3bb('0x153')](this[_0xf3bb('0x20')],function(_0x4d9eca){return _0x4d9eca[_0xf3bb('0x155')]&&_0x4d9eca[_0xf3bb('0x89')]===_0xf3bb('0x8a');});if(_0xbdaeeb[_0xf3bb('0x9c')]>0x0&&_0x4429e9[_0xf3bb('0x9c')]>0x0){return Promise[_0xf3bb('0xb1')]()[_0xf3bb('0x43')](cmHopper[_0xf3bb('0x156')](_[_0xf3bb('0x157')](_0xbdaeeb,'id'),previewRecallmeReminderInterval,_[_0xf3bb('0x157')](_0x4429e9,'id')))[_0xf3bb('0x43')](function(_0x15489a){for(var _0x81c5e9=0x0;_0x81c5e9<_0x15489a['length'];_0x81c5e9++){var _0x267c9a=_0x15489a[_0x81c5e9][_0xf3bb('0x158')]['name'];if(_0x267c9a)io['to'](util[_0xf3bb('0x4b')](_0xf3bb('0x159'),_0x267c9a))[_0xf3bb('0x46')](_0xf3bb('0x15a'),{'hopper':_0x15489a[_0x81c5e9]});}})['catch'](function(_0x117862){logger['error'](_0xf3bb('0x15b'),_0x117862);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xf3bb('0x86')][_0xf3bb('0x41')]=function(){var _0x171418=this;setInterval(function(){_0x171418['clearZombieChannels'](_0x171418[_0xf3bb('0x26')],_0xf3bb('0x15c'));_0x171418['clearZombieChannels'](_0x171418['actions'],_0xf3bb('0x15d'));},0x32c8);};Dialer[_0xf3bb('0x86')]['clearZombieChannels']=function(_0x282c73,_0x1de429){var _0x4304fb=this;for(var _0x334b5f in _0x282c73){if(typeof _0x282c73[_0x334b5f]!==_0xf3bb('0xb0')){this[_0xf3bb('0x1c')][_0xf3bb('0x19')](function(){if(!_['isNil'](_0x282c73[_0x334b5f])){return ami['Action']({'action':_0xf3bb('0x89'),'channel':_0x282c73[_0x334b5f][_0xf3bb('0xf5')]})['catch'](function(_0x463a85){if(_0x463a85[_0xf3bb('0x6d')]===_0xf3bb('0x15e')){setTimeout(function(){if(_0x282c73[_0x334b5f]&&_0x282c73[_0x334b5f][_0xf3bb('0x47')]!==_0xf3bb('0xc7')){utils[_0xf3bb('0xc8')](_0x4304fb[_0xf3bb('0x1e')][_0x282c73[_0x334b5f]['queue']],_0xf3bb('0x15f'));logger[_0xf3bb('0x6b')](_0xf3bb('0x160'),_0x1de429,_0x334b5f,_0x282c73[_0x334b5f][_0xf3bb('0xc5')]);delete _0x282c73[_0x334b5f];}if(_0x282c73[_0x334b5f]&&_0x282c73[_0x334b5f][_0xf3bb('0x47')]===_0xf3bb('0xc7')){utils[_0xf3bb('0xc8')](_0x4304fb['campaigns'][_0x282c73[_0x334b5f][_0xf3bb('0xc5')]],_0xf3bb('0x15f'));logger[_0xf3bb('0x6b')](_0xf3bb('0x161'),_0x1de429,_0x334b5f,_0x282c73[_0x334b5f][_0xf3bb('0xc5')]);delete _0x282c73[_0x334b5f];}},0x2328);}});}});}}};Dialer[_0xf3bb('0x86')]['getVoiceQueueRtPauses']=function(_0x5b398e){return Promise['resolve']()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x5b398e))[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x162')));};Dialer[_0xf3bb('0x86')][_0xf3bb('0x163')]=function(_0x932a60,_0x2458a9,_0x7a486b){var _0x4a92f1={'state':0x19,'statedesc':_0xf3bb('0x164')};utils[_0xf3bb('0xc8')](_0x2458a9,_0xf3bb('0x165')+_0x932a60);this['saveInDb'](_[_0xf3bb('0x66')](_0x4a92f1,_[_0xf3bb('0x107')](_0x7a486b,[_0xf3bb('0xf1'),_0xf3bb('0xe3'),_0xf3bb('0x166'),'VoiceQueueId','CampaignId'])),_0xf3bb('0x167'),_0xf3bb('0x165'));logger['error'](_0x932a60);};Dialer[_0xf3bb('0x86')][_0xf3bb('0x12d')]=function(_0x160597,_0x7febe2,_0x419f1f){hopperUtils[_0xf3bb('0xcf')](_0x160597)['catch'](loggerCatch(_0x7febe2));hopperUtils[_0xf3bb('0x137')](_0x160597)['catch'](loggerCatch(_0x419f1f));};Dialer[_0xf3bb('0x86')]['queueCallerAbandonCreateState']=function(_0x3cd2c3,_0x2fb65c){hopperUtils['createHistory'](_0x3cd2c3)[_0xf3bb('0xa3')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x2fb65c==0x0){hopperUtils[_0xf3bb('0x137')](_0x3cd2c3)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x168')));}};Dialer[_0xf3bb('0x86')][_0xf3bb('0x15b')]=function(_0x2c21d7){return Promise[_0xf3bb('0xb1')]()[_0xf3bb('0x43')](cmHopper[_0xf3bb('0x156')](_0x2c21d7['id'],previewRecallmeReminderInterval))[_0xf3bb('0x43')](function(_0x39d560){for(var _0x492343=0x0;_0x492343<_0x39d560[_0xf3bb('0x9c')];_0x492343++){var _0x471f4c=_0x39d560[_0x492343][_0xf3bb('0x158')]['name'];if(_0x471f4c)io['to'](util[_0xf3bb('0x4b')](_0xf3bb('0x159'),_0x471f4c))[_0xf3bb('0x46')](_0xf3bb('0x15a'),{'hopper':_0x39d560[_0x492343]});}})[_0xf3bb('0xa3')](function(){});};Dialer[_0xf3bb('0x86')]['launchHandleIvr']=function(_0x291d86){var _0x5bf5a0=this;return function(){_0x5bf5a0[_0xf3bb('0x169')](_0x291d86);};};Dialer['prototype'][_0xf3bb('0x16a')]=function(_0x13c1b9,_0x371a6f){var _0x56bb6c=this;var _0x3128f5=uuid['v4']();this[_0xf3bb('0x24')][_0x3128f5]=new Action(_0x13c1b9,_0x371a6f,_0x3128f5);return new Promise(function(_0x154ea1,_0x4333a2){if(_[_0xf3bb('0x45')](_0x13c1b9)&&typeof _0x13c1b9!==_0xf3bb('0x16b')){return _0x4333a2(msgResponse(_0xf3bb('0x16c'),_0xf3bb('0x95'),_0xf3bb('0x16d')));}if(_[_0xf3bb('0x45')](_0x371a6f[_0xf3bb('0x16e')])||_0x371a6f['phone']===null){return _0x4333a2(msgResponse('originate','Failure',_0xf3bb('0x16f')));}var _0x1219ba={'XMD-CALLERID':_0x56bb6c[_0xf3bb('0x24')][_0x3128f5][_0xf3bb('0x170')](),'XMD-AGI':_0x13c1b9[_0xf3bb('0x13b')]?util[_0xf3bb('0x4b')](_0xf3bb('0x171'),ipAgi,_0x13c1b9[_0xf3bb('0x13b')]):'NONE','XMD-AGIAFTER':_0x13c1b9['dialQueueProject2']?util[_0xf3bb('0x4b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x13c1b9[_0xf3bb('0xcc')]):_0xf3bb('0x172'),'XMD-QUEUE':utils['isOutboundQueue'](_0x13c1b9)?util[_0xf3bb('0x4b')](_0xf3bb('0x173'),_0x13c1b9[_0xf3bb('0x4d')],_0x13c1b9['dialQueueOptions']||'',_0x13c1b9['dialAgiAfterHangupAgent']?'c':'',_0x13c1b9[_0xf3bb('0xd4')]||0x3):'NONE','XMD-CONTACTID':_0x371a6f[_0xf3bb('0xf1')],'XMD-CDRTYPE':_0xf3bb('0x7'),'CALLERID(all)':_0x56bb6c[_0xf3bb('0x24')][_0x3128f5][_0xf3bb('0x170')](),'XMD-AMD':_0x13c1b9[_0xf3bb('0x11d')]?'ACTIVE':_0xf3bb('0x172'),'XMD-DESTINATION':_0xf3bb('0x110')};if(_0x13c1b9['dialAMDActive']){_0x1219ba['XMD-AMDINITIALSILENCE']=_0x13c1b9[_0xf3bb('0x174')]||0x9c4;_0x1219ba[_0xf3bb('0x175')]=_0x13c1b9[_0xf3bb('0x176')]||0x5dc;_0x1219ba[_0xf3bb('0x177')]=_0x13c1b9['dialAMDAfterGreetingSilence']||0x320;_0x1219ba[_0xf3bb('0x178')]=_0x13c1b9['dialAMDTotalAnalysisTime']||0x1388;_0x1219ba[_0xf3bb('0x179')]=_0x13c1b9[_0xf3bb('0x17a')]||0x64;_0x1219ba['XMD-AMDBETWEENWORDSSILENCE']=_0x13c1b9[_0xf3bb('0x17b')]||0x32;_0x1219ba[_0xf3bb('0x17c')]=_0x13c1b9['dialAMDMaximumNumberOfWords']||0x3;_0x1219ba[_0xf3bb('0x17d')]=_0x13c1b9[_0xf3bb('0x17e')]||0x100;_0x1219ba[_0xf3bb('0x17f')]=_0x13c1b9['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xf3bb('0x180')](_0x13c1b9)){_0x1219ba[_0xf3bb('0x181')]=_0x371a6f[_0xf3bb('0xe4')];}else{_0x1219ba['XMD-CAMPAIGNID']=_0x371a6f[_0xf3bb('0xe5')];}var _0x5781ec=utils[_0xf3bb('0x182')](_0x371a6f[_0xf3bb('0x183')]);Object[_0xf3bb('0x151')](_0x1219ba,_0x5781ec);var _0x13499a=_0x56bb6c[_0xf3bb('0x87')](_0x13c1b9[_0xf3bb('0x8d')])?utils[_0xf3bb('0x184')](_0x13c1b9[_0xf3bb('0x8d')][_0xf3bb('0x185')],_0x13c1b9[_0xf3bb('0x186')],_0x13c1b9['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xf3bb('0x187')](_0x13c1b9[_0xf3bb('0x188')],_0x13c1b9['dialRandomLastDigitCallerIdNumber']):_0x13c1b9[_0xf3bb('0x188')]):utils['getCallerId'](_[_0xf3bb('0xf9')](_0x13c1b9[_0xf3bb('0x8e')])?_0x13c1b9[_0xf3bb('0x8d')][_0xf3bb('0x185')]:_0x13c1b9['TrunkBackup'][_0xf3bb('0x185')],_0x13c1b9['dialOriginateCallerIdName'],_0x13c1b9[_0xf3bb('0x189')]>0x0?utils['getCallerIdRandom'](_0x13c1b9[_0xf3bb('0x188')],_0x13c1b9[_0xf3bb('0x189')]):_0x13c1b9[_0xf3bb('0x188')]);if(_0x13499a){_0x1219ba['XMD-ORIGINATECALLERIDNAME']=_0x56bb6c[_0xf3bb('0x24')][_0x3128f5][_0xf3bb('0x18a')]=utils['extractCalleridName'](_0x13499a);_0x1219ba[_0xf3bb('0x18b')]=_0x371a6f['phone'];}_0x13c1b9['variables']=_0x1219ba;return ami[_0xf3bb('0x9d')]({'actionid':_0x3128f5,'action':_0xf3bb('0x16c'),'channel':_0x56bb6c[_0xf3bb('0x87')](_0x13c1b9[_0xf3bb('0x8d')])?util['format']('SIP/%s/%s%s',_0x13c1b9['Trunk'][_0xf3bb('0x4d')],isNotNull(_0x13c1b9[_0xf3bb('0x18c')])?_0x13c1b9[_0xf3bb('0x18c')][_0xf3bb('0x18d')]()||'':'',_0x13c1b9[_0xf3bb('0x18e')]>0x0?_0x371a6f[_0xf3bb('0x16e')][_0xf3bb('0x18f')](_0x13c1b9['dialCutDigit']):_0x371a6f[_0xf3bb('0x16e')]):util['format'](_0xf3bb('0x190'),_[_0xf3bb('0xf9')](_0x13c1b9['TrunkBackup'])?_0x13c1b9['Trunk'][_0xf3bb('0x4d')]:_0x13c1b9['TrunkBackup'][_0xf3bb('0x4d')],isNotNull(_0x13c1b9[_0xf3bb('0x18c')])?_0x13c1b9[_0xf3bb('0x18c')][_0xf3bb('0x18d')]()||'':'',_0x13c1b9[_0xf3bb('0x18e')]>0x0?_0x371a6f[_0xf3bb('0x16e')][_0xf3bb('0x18f')](_0x13c1b9[_0xf3bb('0x18e')]):_0x371a6f[_0xf3bb('0x16e')]),'callerid':_0x13499a,'Exten':_0xf3bb('0x110'),'Context':'from-sip','Priority':'1','variable':_0x1219ba,'timeout':(_0x13c1b9[_0xf3bb('0x191')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3128f5})[_0xf3bb('0x43')](function(_0x43f264){return _0x154ea1(_0x43f264);})['catch'](function(_0x36bc50){_0x13c1b9[_0xf3bb('0x192')]+=0x1;var _0x1058ea=new History(_0x56bb6c[_0xf3bb('0x24')][_0x3128f5]);logger[_0xf3bb('0x6b')](util[_0xf3bb('0x4b')]('[originateError]:\x20%s',JSON['stringify'](_0x36bc50)));_0x1058ea['state']=0xe;_0x1058ea[_0xf3bb('0xd7')]=_0xf3bb('0x193');_0x1058ea[_0xf3bb('0x74')]=moment()[_0xf3bb('0x4b')](_0xf3bb('0xce'));_0x1058ea['endtime']=_0x1058ea['starttime'];hopperUtils[_0xf3bb('0xcf')](_0x1058ea)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x194')));_0x56bb6c[_0xf3bb('0x137')](_0x1058ea)[_0xf3bb('0xa3')](loggerCatch('[originate][error]'))[_0xf3bb('0x1b')](function(){delete _0x56bb6c[_0xf3bb('0x24')][_0x3128f5];return _0x4333a2(msgResponse(_0xf3bb('0x16c'),_0xf3bb('0x85'),_0xf3bb('0x195')));});});});};Dialer[_0xf3bb('0x86')]['checkRetriveMax']=function(_0x5c502f,_0x1912e2,_0x13e390){var _0x2e5c01=new History(_0x1912e2);if(_0x2e5c01[_0xf3bb('0x123')]+_0x2e5c01['countcongestionretry']+_0x2e5c01[_0xf3bb('0x131')]+_0x2e5c01[_0xf3bb('0x132')]+_0x2e5c01[_0xf3bb('0xdb')]+_0x2e5c01['countabandonedretry']+_0x2e5c01['countmachineretry']+_0x2e5c01[_0xf3bb('0x124')]>=_0x13e390[_0xf3bb('0x125')]-0x1){return!![];}switch(_0x5c502f){case 0x3:if(_0x2e5c01[_0xf3bb('0x131')]>=_0x13e390[_0xf3bb('0x196')]-0x1){return!![];}hopperUtils[_0xf3bb('0xee')]({'active':![],'countnoanswerretry':_0x2e5c01[_0xf3bb('0x131')]+=0x1,'scheduledat':moment()[_0xf3bb('0xef')](_0x13e390[_0xf3bb('0x197')],_0xf3bb('0xf0'))[_0xf3bb('0x4b')](_0xf3bb('0xce')),'ContactId':_0x2e5c01[_0xf3bb('0xf1')],'ListId':_0x2e5c01[_0xf3bb('0xe3')],'VoiceQueueId':_0x2e5c01[_0xf3bb('0xe4')]||undefined,'CampaignId':_0x2e5c01['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2e5c01[_0xf3bb('0x123')]>=_0x13e390[_0xf3bb('0x198')]-0x1){return!![];}hopperUtils[_0xf3bb('0xee')]({'active':![],'countbusyretry':_0x2e5c01['countbusyretry']+=0x1,'scheduledat':moment()[_0xf3bb('0xef')](_0x13e390[_0xf3bb('0x199')],'minutes')['format'](_0xf3bb('0xce')),'ContactId':_0x2e5c01[_0xf3bb('0xf1')],'ListId':_0x2e5c01['ListId'],'VoiceQueueId':_0x2e5c01[_0xf3bb('0xe4')]||undefined,'CampaignId':_0x2e5c01['CampaignId']||undefined})[_0xf3bb('0xa3')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2e5c01[_0xf3bb('0x130')]>=_0x13e390[_0xf3bb('0x19a')]-0x1){return!![];}hopperUtils[_0xf3bb('0xee')]({'active':![],'countcongestionretry':_0x2e5c01['countcongestionretry']+=0x1,'scheduledat':moment()[_0xf3bb('0xef')](_0x13e390[_0xf3bb('0x19b')],_0xf3bb('0xf0'))[_0xf3bb('0x4b')](_0xf3bb('0xce')),'ContactId':_0x2e5c01[_0xf3bb('0xf1')],'ListId':_0x2e5c01['ListId'],'VoiceQueueId':_0x2e5c01[_0xf3bb('0xe4')]||undefined,'CampaignId':_0x2e5c01[_0xf3bb('0xe5')]||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x19c')));break;case 0x0:if(_0x2e5c01[_0xf3bb('0x132')]>=_0x13e390[_0xf3bb('0x19d')]-0x1){return!![];}else{hopperUtils[_0xf3bb('0xee')]({'active':![],'countnosuchnumberretry':_0x2e5c01[_0xf3bb('0x132')]+=0x1,'scheduledat':moment()['add'](_0x13e390[_0xf3bb('0x19e')],_0xf3bb('0xf0'))[_0xf3bb('0x4b')](_0xf3bb('0xce')),'ContactId':_0x2e5c01[_0xf3bb('0xf1')],'ListId':_0x2e5c01['ListId'],'VoiceQueueId':_0x2e5c01['VoiceQueueId']||undefined,'CampaignId':_0x2e5c01[_0xf3bb('0xe5')]||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x19f')));}break;case 0xa:if(_0x2e5c01['countdropretry']>=_0x13e390[_0xf3bb('0x1a0')]-0x1){return!![];}hopperUtils[_0xf3bb('0xee')]({'active':![],'countdropretry':_0x2e5c01[_0xf3bb('0xdb')]+=0x1,'scheduledat':moment()['add'](_0x13e390['dialDropRetryFrequency'],_0xf3bb('0xf0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e5c01[_0xf3bb('0xf1')],'ListId':_0x2e5c01[_0xf3bb('0xe3')],'VoiceQueueId':_0x2e5c01['VoiceQueueId']||undefined,'CampaignId':_0x2e5c01['CampaignId']||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0xe6')));break;case 0xb:if(_0x2e5c01['countabandonedretry']>=_0x13e390[_0xf3bb('0x1a1')]-0x1){return!![];}hopperUtils[_0xf3bb('0xee')]({'active':![],'countabandonedretry':_0x2e5c01['countabandonedretry']+=0x1,'scheduledat':moment()[_0xf3bb('0xef')](_0x13e390[_0xf3bb('0xed')],_0xf3bb('0xf0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e5c01[_0xf3bb('0xf1')],'ListId':_0x2e5c01['ListId'],'VoiceQueueId':_0x2e5c01['VoiceQueueId']||undefined,'CampaignId':_0x2e5c01[_0xf3bb('0xe5')]||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0xf2')));break;case 0x13:if(_0x2e5c01['countmachineretry']>=_0x13e390['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xf3bb('0xee')]({'active':![],'countmachineretry':_0x2e5c01[_0xf3bb('0x121')]+=0x1,'scheduledat':moment()['add'](_0x13e390[_0xf3bb('0x12b')],_0xf3bb('0xf0'))[_0xf3bb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e5c01['ContactId'],'ListId':_0x2e5c01['ListId'],'VoiceQueueId':_0x2e5c01[_0xf3bb('0xe4')]||undefined,'CampaignId':_0x2e5c01[_0xf3bb('0xe5')]||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x12c')));break;case 0x14:if(_0x2e5c01[_0xf3bb('0x124')]>=_0x13e390[_0xf3bb('0x1a2')]-0x1){return!![];}hopperUtils[_0xf3bb('0xee')]({'active':![],'countagentrejectretry':_0x2e5c01[_0xf3bb('0x124')]+=0x1,'scheduledat':moment()[_0xf3bb('0xef')](_0x13e390['dialAgentRejectRetryFrequency'],_0xf3bb('0xf0'))[_0xf3bb('0x4b')](_0xf3bb('0xce')),'ContactId':_0x2e5c01['ContactId'],'ListId':_0x2e5c01['ListId'],'VoiceQueueId':_0x2e5c01['VoiceQueueId']||undefined,'CampaignId':_0x2e5c01['CampaignId']||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x1a3')));break;default:return!![];}};Dialer[_0xf3bb('0x86')][_0xf3bb('0x1a4')]=function(_0x1bec90,_0x4ab2f7,_0x1c753d){var _0x56fd01=this;var _0x2ce88a=new History(_0x1bec90);var _0x21eb44=![];var _0x32589c;var _0x254a38;return new Promise(function(_0x3a82ef,_0x3df523){if(_[_0xf3bb('0x45')](_0x4ab2f7)&&typeof _0x4ab2f7!==_0xf3bb('0x16b')){return _0x3df523(msgResponse(_0xf3bb('0x1a5'),_0xf3bb('0x95'),_0xf3bb('0x1a6')));}if(_[_0xf3bb('0x45')](_0x1c753d)&&typeof _0x1c753d!==_0xf3bb('0x16b')){return _0x3df523(msgResponse(_0xf3bb('0x1a5'),_0xf3bb('0x95'),'evt\x20is\x20undefine'));}hopperUtils[_0xf3bb('0xdf')](_0x2ce88a,_0x1c753d[_0xf3bb('0x1a7')],_0x4ab2f7)[_0xf3bb('0x43')](function(_0x2e1bdd){if(_0x2e1bdd[_0xf3bb('0xe1')]==0x1)_0x21eb44=!![];switch(_0x1c753d[_0xf3bb('0x1a7')]){case'0':_0x4ab2f7[_0xf3bb('0x1a8')]+=0x1;_0x2ce88a[_0xf3bb('0x72')]=0x0;_0x2ce88a[_0xf3bb('0xd7')]=_0xf3bb('0x1a9');_0x2ce88a[_0xf3bb('0x132')]+=0x1;_0x2ce88a[_0xf3bb('0xdc')]+=0x1;ami[_0xf3bb('0x46')](_0xf3bb('0x1aa'),ut['buildObj'](_0x1bec90,_0xf3bb('0x1ab')));_0x32589c=_0x4ab2f7['dialNoSuchNumberRetryFrequency'];_0x254a38=_0x4ab2f7['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x2ce88a)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x122')));if(_0x56fd01[_0xf3bb('0x1ac')](0x0,_0x1bec90,_0x4ab2f7)&&!_0x21eb44){if(_0x2ce88a[_0xf3bb('0x132')]>=_0x4ab2f7[_0xf3bb('0x19d')]){_0x56fd01['createStateFinal'](_0x2ce88a,_0x3a82ef,_0x3df523,_0xf3bb('0x1ad'));}else{_0x56fd01[_0xf3bb('0x126')](_0x2ce88a,_0x3a82ef,_0x3df523,_0xf3bb('0x1ad'));}}break;case'3':_0x4ab2f7[_0xf3bb('0x1ae')]+=0x1;_0x2ce88a[_0xf3bb('0x72')]=0x3;_0x2ce88a['statedesc']=_0xf3bb('0x1af');_0x2ce88a['countnoanswerretry']+=0x1;_0x2ce88a[_0xf3bb('0xdc')]+=0x1;var _0x5ac293=ut[_0xf3bb('0x1b0')](_0x1bec90,_0x4ab2f7);ami[_0xf3bb('0x46')](_0xf3bb('0x1b1'),_0x5ac293);_0x32589c=_0x4ab2f7['dialNoAnswerRetryFrequency'];_0x254a38=_0x4ab2f7['callAdditionalPhoneAfterMin'];hopperUtils[_0xf3bb('0xcf')](_0x2ce88a)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x1b2')));if(_0x56fd01[_0xf3bb('0x1ac')](0x3,_0x1bec90,_0x4ab2f7)&&!_0x21eb44){if(_0x2ce88a['countnoanswerretry']>=_0x4ab2f7[_0xf3bb('0x196')]){_0x56fd01[_0xf3bb('0x129')](_0x2ce88a,_0x3a82ef,_0x3df523,_0xf3bb('0x1b3'));}else{_0x56fd01[_0xf3bb('0x126')](_0x2ce88a,_0x3a82ef,_0x3df523,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x4ab2f7[_0xf3bb('0x1b4')]+=0x1;_0x2ce88a[_0xf3bb('0x72')]=0x5;_0x2ce88a[_0xf3bb('0xd7')]=_0xf3bb('0x1b5');_0x2ce88a[_0xf3bb('0x123')]+=0x1;_0x2ce88a[_0xf3bb('0xdc')]+=0x1;ami[_0xf3bb('0x46')](_0xf3bb('0x1b6'),ut[_0xf3bb('0x119')](_0x1bec90,'busy'));_0x32589c=_0x4ab2f7[_0xf3bb('0x199')];_0x254a38=_0x4ab2f7['callAdditionalPhoneAfterMin'];hopperUtils[_0xf3bb('0xcf')](_0x2ce88a)[_0xf3bb('0xa3')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x56fd01['checkRetriveMax'](0x5,_0x1bec90,_0x4ab2f7)&&!_0x21eb44){if(_0x2ce88a[_0xf3bb('0x123')]>=_0x4ab2f7[_0xf3bb('0x198')]){_0x56fd01[_0xf3bb('0x129')](_0x2ce88a,_0x3a82ef,_0x3df523,_0xf3bb('0x1b7'));}else{_0x56fd01['stateGlobal'](_0x2ce88a,_0x3a82ef,_0x3df523,_0xf3bb('0x1b7'));}}break;case'8':_0x4ab2f7[_0xf3bb('0x1b8')]+=0x1;_0x2ce88a[_0xf3bb('0x72')]=0x8;_0x2ce88a[_0xf3bb('0xd7')]=_0xf3bb('0x1b9');_0x2ce88a[_0xf3bb('0x130')]+=0x1;_0x2ce88a[_0xf3bb('0xdc')]+=0x1;_0x32589c=_0x4ab2f7[_0xf3bb('0x19b')];_0x254a38=_0x4ab2f7['callAdditionalPhoneAfterMin'];ami[_0xf3bb('0x46')](_0xf3bb('0x1ba'),ut['buildObj'](_0x1bec90,_0xf3bb('0x1bb')));hopperUtils[_0xf3bb('0xcf')](_0x2ce88a)['catch'](loggerCatch(_0xf3bb('0x1bc')));if(_0x56fd01[_0xf3bb('0x1ac')](0x8,_0x1bec90,_0x4ab2f7)&&!_0x21eb44){if(_0x2ce88a[_0xf3bb('0x130')]>=_0x4ab2f7['dialCongestionMaxRetry']){_0x56fd01[_0xf3bb('0x129')](_0x2ce88a,_0x3a82ef,_0x3df523,_0xf3bb('0x1bd'));}else{_0x56fd01[_0xf3bb('0x126')](_0x2ce88a,_0x3a82ef,_0x3df523,'reason\x208\x20congestion');}}break;case'11':_0x4ab2f7[_0xf3bb('0x1be')]+=0x1;_0x2ce88a[_0xf3bb('0x72')]=0xb;_0x2ce88a[_0xf3bb('0xd7')]=_0xf3bb('0xea');_0x2ce88a['countabandonedretry']+=0x1;_0x2ce88a[_0xf3bb('0xdc')]+=0x1;_0x32589c=_0x4ab2f7[_0xf3bb('0xed')];_0x254a38=_0x4ab2f7['callAdditionalPhoneAfterMin'];hopperUtils[_0xf3bb('0xcf')](_0x2ce88a)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0xf3')));if(_0x56fd01[_0xf3bb('0x1ac')](0xb,_0x1bec90,_0x4ab2f7)&&!_0x21eb44){if(_0x2ce88a[_0xf3bb('0xec')]>=_0x4ab2f7[_0xf3bb('0x1a1')]){_0x56fd01[_0xf3bb('0x129')](_0x2ce88a,_0x3a82ef,_0x3df523,_0xf3bb('0x1bf'));}else{_0x56fd01[_0xf3bb('0x126')](_0x2ce88a,_0x3a82ef,_0x3df523,_0xf3bb('0x1bf'));}}break;case'20':_0x4ab2f7[_0xf3bb('0x1c0')]+=0x1;_0x2ce88a['state']=0x14;_0x2ce88a[_0xf3bb('0xd7')]=_0xf3bb('0x1c1');_0x2ce88a['countagentrejectretry']+=0x1;_0x2ce88a[_0xf3bb('0xdc')]+=0x1;_0x32589c=_0x4ab2f7['dialAgentRejectRetryFrequency'];_0x254a38=_0x4ab2f7[_0xf3bb('0xde')];ami[_0xf3bb('0x46')](_0xf3bb('0x1c2'),ut[_0xf3bb('0x119')](_0x1bec90,_0xf3bb('0x1c3')));hopperUtils['createHistory'](_0x2ce88a)[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x1c4')));if(_0x56fd01['checkRetriveMax'](0x14,_0x1bec90,_0x4ab2f7)&&!_0x21eb44){if(_0x2ce88a[_0xf3bb('0x124')]>=_0x4ab2f7[_0xf3bb('0x1a2')]){_0x56fd01[_0xf3bb('0x129')](_0x2ce88a,_0x3a82ef,_0x3df523,_0xf3bb('0x1c5'));}else{_0x56fd01[_0xf3bb('0x126')](_0x2ce88a,_0x3a82ef,_0x3df523,_0xf3bb('0x1c5'));}}break;default:_0x4ab2f7[_0xf3bb('0x1c6')]+=0x1;_0x2ce88a[_0xf3bb('0x72')]=0xc;_0x2ce88a[_0xf3bb('0xd7')]=_0x1c753d['reason'];_0x32589c=_0x4ab2f7[_0xf3bb('0x1c7')];_0x254a38=_0x4ab2f7[_0xf3bb('0xde')];hopperUtils[_0xf3bb('0xcf')](_0x2ce88a)[_0xf3bb('0xa3')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x56fd01[_0xf3bb('0x1ac')](_0x1c753d[_0xf3bb('0x1a7')],_0x1bec90,_0x4ab2f7)&&!_0x21eb44){if(_0x2ce88a['countbusyretry']+_0x2ce88a[_0xf3bb('0x130')]+_0x2ce88a[_0xf3bb('0x131')]+_0x2ce88a['countnosuchnumberretry']+_0x2ce88a[_0xf3bb('0xdb')]+_0x2ce88a['countabandonedretry']+_0x2ce88a[_0xf3bb('0x121')]+_0x2ce88a['countagentrejectretry']>=_0x4ab2f7['dialGlobalMaxRetry']){_0x56fd01[_0xf3bb('0x126')](_0x2ce88a,_0x3a82ef,_0x3df523,_0x1c753d['reason']);}else{_0x56fd01['createStateFinal'](_0x2ce88a,_0x3a82ef,_0x3df523,_0x1c753d[_0xf3bb('0x1a7')]);}}}})[_0xf3bb('0x43')](function(){if(_0x21eb44){hopperUtils[_0xf3bb('0xf4')](_0x2ce88a,_0x32589c,_0x254a38)[_0xf3bb('0x43')](function(){return _0x3a82ef(0x1);});}});});};Dialer[_0xf3bb('0x86')][_0xf3bb('0x126')]=function(_0x4155ac,_0x33ca99,_0x1435db,_0x3feec7){var _0x1ded9a=new Final(_0x4155ac);_0x1ded9a[_0xf3bb('0x72')]=0xf;_0x1ded9a[_0xf3bb('0xd7')]='Global';this[_0xf3bb('0x129')](_0x1ded9a,_0x33ca99,_0x1435db,_0x3feec7);};Dialer[_0xf3bb('0x86')]['createStateFinal']=function(_0x32e55e,_0x22d9db,_0x5df01a,_0x351f5f){hopperUtils[_0xf3bb('0x137')](_0x32e55e)['then'](function(){return _0x22d9db(msgResponse(_0xf3bb('0x1a5'),'Success',_0x351f5f));})[_0xf3bb('0xa3')](function(){return _0x5df01a(msgResponse('[moveContactManagedDialer][0]',_0xf3bb('0x95'),_0xf3bb('0x1c8')));});};Dialer[_0xf3bb('0x86')][_0xf3bb('0xa')]=function(_0x39da68){var _0x2337b1=_0x39da68['dialPredictiveOptimizationPercentage']/0x64;var _0x3f6f21=_0x39da68[_0xf3bb('0xd5')]/(_0x39da68[_0xf3bb('0xd5')]+_0x39da68[_0xf3bb('0x11f')]);var _0xee141a=Math[_0xf3bb('0x1c9')](_0x39da68[_0xf3bb('0x1ca')]*(_0x39da68[_0xf3bb('0x1cb')]/0x64));var _0x4f4862=Math['round'](_0x39da68[_0xf3bb('0x1ca')]*(_0x39da68['predictiveIntervalMinThreshold']/0x64));var _0x447b2e=_0x39da68[_0xf3bb('0x149')]+_0x39da68[_0xf3bb('0x1cc')];var _0xbd38a8=Math[_0xf3bb('0x1cd')](_0x39da68['erlangCalls']*_0x39da68[_0xf3bb('0x63')]*_0x39da68['predictiveIntervalHitRate']*_0x39da68[_0xf3bb('0x1ce')]);if(_[_0xf3bb('0x45')](_0x39da68[_0xf3bb('0x28')])){if(!_[_0xf3bb('0x45')](_0x39da68[_0xf3bb('0x148')])){_0x39da68[_0xf3bb('0x148')]=undefined;loggerPredictive[_0xf3bb('0x6b')](_0xf3bb('0x1cf'),_0xf3bb('0x1d0'));}if(!_[_0xf3bb('0x45')](_0x39da68[_0xf3bb('0x69')])){loggerPredictive[_0xf3bb('0x6b')](_0xf3bb('0x1cf'),_0xf3bb('0x1d1'));clearInterval(_0x39da68['handlePredictive']);_0x39da68[_0xf3bb('0x69')]=undefined;}_0x39da68[_0xf3bb('0x28')]=moment()[_0xf3bb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf3bb('0x50')](_0x39da68[_0xf3bb('0x4d')],_0xf3bb('0x1d2'),_0x39da68[_0xf3bb('0x28')]);this['handlePower'](_0x39da68,0x1);}else if(ifInterval(_0x39da68[_0xf3bb('0x1d3')],_0x39da68[_0xf3bb('0x28')])){this[_0xf3bb('0xb7')](_0x39da68,0x1);loggerPredictiveCalls[_0xf3bb('0x50')](_0xf3bb('0x1d4'),_0x39da68['startProgressive'],_0x39da68[_0xf3bb('0x4d')]);_0x39da68[_0xf3bb('0x5f')]=0x0;_0x39da68['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2337b1<_0x3f6f21&&_0x39da68[_0xf3bb('0x1d5')]===_0xf3bb('0x1d6')){clearPredictiveAttributes(_0x39da68);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x1d7'),_0xf3bb('0x1d8'),_0x3f6f21,_0xf3bb('0x28'),_0x39da68[_0xf3bb('0x4d')]);}else if(_0xbd38a8<_0x39da68[_0xf3bb('0xd6')]&&_0x39da68[_0xf3bb('0x1d5')]===_0xf3bb('0x1d6')){clearPredictiveAttributes(_0x39da68);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x1d9'),_0xf3bb('0x1da'),_0xbd38a8,_0xf3bb('0x1db'),_0x39da68[_0xf3bb('0xd6')],_0xf3bb('0x28'),_0x39da68['name']);}else if(!ifInterval(_0x39da68[_0xf3bb('0x1d3')],_0x39da68['startProgressive'])&&_[_0xf3bb('0x45')](_0x39da68[_0xf3bb('0x148')])&&!_[_0xf3bb('0x45')](_0x39da68[_0xf3bb('0x28')])){_0x39da68[_0xf3bb('0x148')]=moment()[_0xf3bb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf3bb('0x50')](_0x39da68[_0xf3bb('0x4d')],_0xf3bb('0x1dc'),_0x39da68[_0xf3bb('0x148')]);hopperUtils[_0xf3bb('0x1dd')](_0x39da68['dialPredictiveInterval'])[_0xf3bb('0x43')](this['getDataPredictive'](_0x39da68))[_0xf3bb('0x43')](mergeDataErlangB(_0x39da68))[_0xf3bb('0x43')](this[_0xf3bb('0x1de')](_0x39da68))[_0xf3bb('0xa3')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x39da68));}else if(!ifInterval(_0x39da68[_0xf3bb('0x1d3')],_0x39da68['startPredictive'])){_0x39da68['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x39da68[_0xf3bb('0x148')]=moment()[_0xf3bb('0x4b')](_0xf3bb('0xce'));loggerPredictive[_0xf3bb('0x50')](_0x39da68[_0xf3bb('0x4d')],'recalculate\x20predictive\x20at',_0x39da68[_0xf3bb('0x148')]);clearInterval(_0x39da68['handlePredictive']);_0x39da68['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x39da68[_0xf3bb('0x1d3')])[_0xf3bb('0x43')](this[_0xf3bb('0x1df')](_0x39da68))[_0xf3bb('0x43')](mergeDataErlangB(_0x39da68))['then'](this['startMethodPredictive'](_0x39da68))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x39da68));}else if(_0x39da68[_0xf3bb('0x1ca')]&&_0x447b2e<_0x39da68[_0xf3bb('0x1ca')]-_0x4f4862){clearPredictiveAttributes(_0x39da68);loggerPredictive[_0xf3bb('0x50')](_0x39da68[_0xf3bb('0x4d')],_0xf3bb('0x1e0'),_0x447b2e,_0xf3bb('0x1e1'),_0x39da68[_0xf3bb('0x1ca')],'-',_0x4f4862,'=',_0x39da68[_0xf3bb('0x1ca')]-_0x4f4862,')');}else if(_0x39da68[_0xf3bb('0x1ca')]&&_0x447b2e>_0x39da68[_0xf3bb('0x1ca')]+_0xee141a){clearPredictiveAttributes(_0x39da68);loggerPredictive[_0xf3bb('0x50')](_0x39da68[_0xf3bb('0x4d')],_0xf3bb('0x1e0'),_0x447b2e,_0xf3bb('0x1e2'),_0x39da68['predictiveIntervalAvailable'],'+',_0xee141a,'=',_0x39da68[_0xf3bb('0x1ca')]+_0xee141a,')');}};Dialer[_0xf3bb('0x86')][_0xf3bb('0x1df')]=function(_0x4ac549){var _0x4cc958=this;return function(_0x25fe6d){return new Promise(function(_0x1a0778,_0x865330){_[_0xf3bb('0x66')](_0x4ac549,_0x25fe6d[0x0]);if(checkGetDataPredictive(_0x25fe6d[0x0])){var _0x5750d8=_0x4ac549[_0xf3bb('0x1ca')]=_0x4ac549[_0xf3bb('0x1cc')]+_0x4ac549['available'];var _0x2780a1=_0x4ac549[_0xf3bb('0x1d3')]*0x3c;var _0xd3e895=_0x25fe6d[0x0][_0xf3bb('0x59')]+_0x25fe6d[0x0][_0xf3bb('0x58')];var _0x514c63=(_0x25fe6d[0x0][_0xf3bb('0x1e3')]+_0x25fe6d[0x0][_0xf3bb('0x54')]+_0x25fe6d[0x0][_0xf3bb('0x56')])/_0x25fe6d[0x0][_0xf3bb('0x5b')];_0x4ac549[_0xf3bb('0x1e4')]=_0x514c63>0x0?_0x514c63:0x1;switch(_0x4ac549[_0xf3bb('0x1d5')]){case _0xf3bb('0x1d6'):var _0x2bf784=_0x4ac549[_0xf3bb('0x1e5')]/0x64;return _0x4cc958[_0xf3bb('0x1e6')](_0x5750d8,_0x2780a1,_0xd3e895,_0x514c63,_0x2bf784)[_0xf3bb('0x43')](function(_0xb3250c){return _0x1a0778(_0xb3250c);});case _0xf3bb('0x1e7'):var _0x2d8cf7=_0x4ac549[_0xf3bb('0x1e5')]/0x64;return _0x4cc958[_0xf3bb('0x1e8')](_0x5750d8,_0x2780a1,_0xd3e895,_0x514c63,_0x2d8cf7)[_0xf3bb('0x43')](function(_0x28ae50){return _0x1a0778(_0x28ae50);});default:return _0x865330(msgResponse(_0xf3bb('0x1e9'),'Failure',_0xf3bb('0x1ea')));}}else{return _0x865330(msgResponse(_0xf3bb('0x1e9'),_0xf3bb('0x95'),_0xf3bb('0x1eb')));}});};};Dialer[_0xf3bb('0x86')][_0xf3bb('0x1ec')]=function(_0x10203b){var _0x5ca48e=this;return function(_0x1ae336){return new Promise(function(_0x34177a,_0x179ead){_['merge'](_0x10203b,_0x1ae336[0x0]);if(checkGetDataPredictive(_0x1ae336[0x0])){loggerPredictive[_0xf3bb('0x50')](JSON['stringify'](_0x1ae336[0x0]));if(_0x10203b[_0xf3bb('0x1d5')]===_0xf3bb('0x1d6')){return _0x5ca48e['getVoiceQueueRtPauses'](_0x10203b['id'])[_0xf3bb('0x43')](function(_0x4f26c7){var _0x55f811=_0x10203b['loggedIn']-_0x4f26c7[0x0][_0xf3bb('0x1ed')];var _0x5788da=_0x10203b['dialPredictiveInterval']*0x3c;var _0x22e744=_0x1ae336[0x0][_0xf3bb('0x59')]+_0x1ae336[0x0][_0xf3bb('0x58')];var _0x4f8930=(_0x1ae336[0x0]['predictiveIntervalAnsweredCalls']+_0x1ae336[0x0][_0xf3bb('0x54')]+_0x1ae336[0x0][_0xf3bb('0x56')])/_0x1ae336[0x0]['predictiveIntervalTotalCalls'];var _0x167786=_0x10203b[_0xf3bb('0x1e5')]/0x64;_0x10203b['predictiveIntervalPauses']=_0x4f26c7[0x0][_0xf3bb('0x1ed')]||0x0;_0x10203b[_0xf3bb('0x1e4')]=_0x4f8930>0x0?_0x4f8930:0x1;return _0x5ca48e['abandonmentRate'](_0x55f811,_0x5788da,_0x22e744,_0x4f8930,_0x167786);})[_0xf3bb('0x43')](function(_0x5b1a55){return _0x34177a(_0x5b1a55);})[_0xf3bb('0xa3')](function(_0x49fe9f){return _0x179ead(msgResponse(_0xf3bb('0x1ee'),'Failure',JSON[_0xf3bb('0x77')](_0x49fe9f)));});}if(_0x10203b[_0xf3bb('0x1d5')]===_0xf3bb('0x1e7')){return _0x5ca48e['getVoiceQueueRtPauses'](_0x10203b['id'])[_0xf3bb('0x43')](function(_0x1cef0a){var _0x4606a7=_0x10203b[_0xf3bb('0x1ef')]-_0x1cef0a[0x0][_0xf3bb('0x1ed')];var _0x221623=_0x10203b[_0xf3bb('0x1d3')]*0x3c;var _0xe281fa=_0x1ae336[0x0][_0xf3bb('0x59')]+_0x1ae336[0x0]['predictiveIntervalAvgHoldtime'];var _0x4870cd=(_0x1ae336[0x0][_0xf3bb('0x1e3')]+_0x1ae336[0x0][_0xf3bb('0x54')]+_0x1ae336[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1ae336[0x0][_0xf3bb('0x5b')];var _0x3a6d98=_0x10203b[_0xf3bb('0x1e5')]/0x64;_0x10203b['predictiveIntervalPauses']=_0x1cef0a[0x0][_0xf3bb('0x1ed')]||0x0;_0x10203b[_0xf3bb('0x1e4')]=_0x4870cd>0x0?_0x4870cd:0x1;return _0x5ca48e[_0xf3bb('0x1e8')](_0x4606a7,_0x221623,_0xe281fa,_0x4870cd,_0x3a6d98);})['then'](function(_0x2d590d){return _0x34177a(_0x2d590d);})[_0xf3bb('0xa3')](function(_0x24e004){return _0x179ead(msgResponse(_0xf3bb('0x1ee'),_0xf3bb('0x95'),JSON[_0xf3bb('0x77')](_0x24e004)));});}}else{return _0x179ead(msgResponse(_0xf3bb('0x1e9'),_0xf3bb('0x95'),_0xf3bb('0x1eb')));}});};};Dialer['prototype'][_0xf3bb('0x1de')]=function(_0x5b44e5){var _0x2ed062=this;return function(){var _0x3ef5d6=0x0;var _0x5c1271=Math[_0xf3bb('0x1cd')](_0x5b44e5[_0xf3bb('0x61')]*0x3e8);if(_0x5c1271>0x0){_0x5c1271=_0x5c1271<0x64?0x64:_0x5c1271;loggerPredictive[_0xf3bb('0x50')](_0x5b44e5[_0xf3bb('0x4d')],_0xf3bb('0x1f0'),_0x5c1271,_0xf3bb('0x1f1'));_0x5b44e5[_0xf3bb('0x69')]=setInterval(function(){_0x2ed062[_0xf3bb('0x69')](_0x5b44e5);loggerPredictiveCalls[_0xf3bb('0x50')](_0xf3bb('0x1f2'),_0x3ef5d6+=0x1);},_0x5c1271);}else{loggerPredictive[_0xf3bb('0x50')](_0x5b44e5['name'],_0xf3bb('0x1f3'));}};};Dialer[_0xf3bb('0x86')]['checkContactBlack']=function(_0xeac9f2,_0x46a105){var _0x234ce3=this;return function(_0x5e5d94){if(_[_0xf3bb('0x4f')](_0x5e5d94)){if(_[_0xf3bb('0xf9')](_0x46a105[_0xf3bb('0x166')])||!_0x46a105[_0xf3bb('0x1f4')]){if(_0xeac9f2[_0xf3bb('0xb6')]===_0xf3bb('0x9')){_0xeac9f2[_0xf3bb('0x78')]=_[_0xf3bb('0x45')](_0xeac9f2['queueStatusComplete'])?!![]:_0xeac9f2[_0xf3bb('0x78')];var _0x43086a=uuid['v4']();_0x234ce3['actions'][_0x43086a]=new Action(_0xeac9f2,_0x46a105,_0x43086a);loggerBooked[_0xf3bb('0x50')](_0xf3bb('0x1f5'),_0x43086a,_0xf3bb('0x1f6'),JSON[_0xf3bb('0x77')](_0xeac9f2['queueStatusComplete']),_0xf3bb('0x1f7'),_0xeac9f2[_0xf3bb('0x4d')]);if(_0xeac9f2['queueStatusComplete']){_0xeac9f2[_0xf3bb('0x78')]=![];_0x234ce3[_0xf3bb('0x2a')][_0x234ce3[_0xf3bb('0x24')][_0x43086a][_0xf3bb('0xc5')]]=[];ami[_0xf3bb('0x9d')]({'actionid':_0x43086a,'action':_0xf3bb('0x1f8'),'queue':_0xeac9f2[_0xf3bb('0x4d')]})[_0xf3bb('0xa3')](function(){utils['decrementOriginate'](_0xeac9f2,'[checkContactBlack]');hopperUtils[_0xf3bb('0xee')]({'active':![],'ContactId':_0x234ce3[_0xf3bb('0x24')][_0x43086a]['ContactId'],'ListId':_0x234ce3[_0xf3bb('0x24')][_0x43086a][_0xf3bb('0xe3')],'VoiceQueueId':_0x234ce3[_0xf3bb('0x24')][_0x43086a][_0xf3bb('0xe4')]||undefined,'CampaignId':_0x234ce3[_0xf3bb('0x24')][_0x43086a][_0xf3bb('0xe5')]||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x1f9')));delete _0x234ce3[_0xf3bb('0x24')][_0x43086a];});}else{loggerBooked[_0xf3bb('0x50')]('[booked][checkContactBlack][else]',JSON[_0xf3bb('0x77')](_0xeac9f2[_0xf3bb('0x78')]),'Queue:\x20',_0xeac9f2['name']);utils[_0xf3bb('0xc8')](_0xeac9f2,_0xf3bb('0x1fa'));hopperUtils[_0xf3bb('0xee')]({'active':![],'ContactId':_0x234ce3[_0xf3bb('0x24')][_0x43086a]['ContactId'],'ListId':_0x234ce3[_0xf3bb('0x24')][_0x43086a][_0xf3bb('0xe3')],'VoiceQueueId':_0x234ce3[_0xf3bb('0x24')][_0x43086a]['VoiceQueueId']||undefined,'CampaignId':_0x234ce3['actions'][_0x43086a]['CampaignId']||undefined})[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x1f9')));delete _0x234ce3[_0xf3bb('0x24')][_0x43086a];}}else{return _0x234ce3[_0xf3bb('0x16a')](_0xeac9f2,_0x46a105);}}else{if(utils[_0xf3bb('0xd1')](undefined,_0x46a105[_0xf3bb('0x1fb')])<_0xeac9f2[_0xf3bb('0x1fc')]*0x3c){if(_0x46a105[_0xf3bb('0x158')]&&!_0x46a105[_0xf3bb('0x158')]['voicePause']){_0x234ce3[_0xf3bb('0x1d')]['run'](_0x46a105['id'])[_0xf3bb('0x1b')](function(){utils[_0xf3bb('0xc8')](_0xeac9f2,'[checkContactBlack]');});}else{hopperUtils[_0xf3bb('0x1fd')]({'active':![]},_0x46a105['id'],0x1)['finally'](function(){utils[_0xf3bb('0xc8')](_0xeac9f2,_0xf3bb('0x1fa'));});}}else{_0xeac9f2['outboundReCallsDay']+=0x1;utils[_0xf3bb('0xc8')](_0xeac9f2,'[checkContactBlack]');if(_0xeac9f2[_0xf3bb('0x1fe')]){hopperUtils[_0xf3bb('0xee')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x46a105[_0xf3bb('0xf1')],'ListId':_0x46a105[_0xf3bb('0xe3')],'VoiceQueueId':_0x46a105[_0xf3bb('0xe4')]||undefined,'CampaignId':_0x46a105[_0xf3bb('0xe5')]||undefined})['catch'](loggerCatch(_0xf3bb('0x1ff')));hopperUtils[_0xf3bb('0xcf')](createObjHistory(_0xeac9f2,_0x46a105,utils[_0xf3bb('0x6e')][_0xf3bb('0x200')],0x17,_0xf3bb('0x201')))[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x202')));}else{_0x234ce3[_0xf3bb('0x12d')](createObjHistory(_0xeac9f2,_0x46a105,utils[_0xf3bb('0x6e')][_0xf3bb('0x203')],0x16,_0xf3bb('0x204')),_0xf3bb('0x205'),_0xf3bb('0x206'));}}}}else{_0xeac9f2[_0xf3bb('0x207')]+=0x1;_0x234ce3['saveInDb'](createObjHistory(_0xeac9f2,_0x46a105,utils[_0xf3bb('0x6e')]['BLACKLIST'],0xd,_0xf3bb('0x208')),_0xf3bb('0x209'),_0xf3bb('0x20a'));throw _0xf3bb('0x20b');}};};Dialer['prototype'][_0xf3bb('0x169')]=function(_0x53884e){var _0x36f711=this;var _0x2b4d04=_0x53884e[_0xf3bb('0x20c')]-_0x53884e[_0xf3bb('0x20d')];emitCampaignSummary(_0x53884e);if(_0x2b4d04>0x0&&_0x53884e[_0xf3bb('0x20e')]==0x0){if(_0x2b4d04>this[_0xf3bb('0x22')]){_0x2b4d04=this[_0xf3bb('0x22')];}_0x53884e[_0xf3bb('0x20e')]=0x1;hopperUtils['getContactDialerIvr'](_0x53884e,_0x2b4d04)[_0xf3bb('0x43')](function(_0xdb5a1f){_0x53884e[_0xf3bb('0x20e')]=0x0;if(_0xdb5a1f){if(!utils[_0xf3bb('0x20f')](_0xdb5a1f)){_0x53884e[_0xf3bb('0x6d')]=utils['CAMPAIGN_STATUS'][_0xf3bb('0x210')];logger[_0xf3bb('0x50')](_0xf3bb('0x211')+_0x53884e[_0xf3bb('0x4d')]);}else{_0x53884e[_0xf3bb('0x20d')]+=_0xdb5a1f[_0xf3bb('0x9c')];_0x53884e['message']=utils[_0xf3bb('0x6e')][_0xf3bb('0x212')];for(var _0x511232=0x0;_0x511232<_0xdb5a1f['length'];_0x511232+=0x1){_0x53884e['ivrTotalCallsDays']+=0x1;if(_[_0xf3bb('0xf9')](_0xdb5a1f[_0x511232])||_[_0xf3bb('0xf9')](_0xdb5a1f[_0x511232][_0xf3bb('0x183')])||_[_0xf3bb('0xf9')](_0xdb5a1f[_0x511232][_0xf3bb('0x16e')])){_0x36f711[_0xf3bb('0x163')](_0xf3bb('0x213'),_0x53884e,_0xdb5a1f[_0x511232]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xf3bb('0x107')](_0xdb5a1f[_0x511232],['CampaignId','phone']))['then'](_0x36f711[_0xf3bb('0x214')](_0x53884e,_0xdb5a1f[_0x511232]))['catch'](function(_0x3fdeff){logger[_0xf3bb('0x6b')](_0xf3bb('0x215'),_0x3fdeff);utils[_0xf3bb('0xc8')](_0x53884e,_0xf3bb('0x216'));});}}}}})['catch'](function(_0x13326e){_0x53884e[_0xf3bb('0x20e')]=0x0;logger[_0xf3bb('0x6b')]('[getContactCampaign2]',_0x13326e);});}};Dialer['prototype']['handlePower']=function(_0x1d154d,_0x5dae30){var _0x5daad5=this;var _0x567a71=[];if(_0x5dae30<0x1||_0x1d154d[_0xf3bb('0xb6')]===_0xf3bb('0x9')){_0x5dae30=0x1;}var _0x5d53d1=Math[_0xf3bb('0x1cd')](_0x1d154d[_0xf3bb('0x149')]*_0x5dae30)-_0x1d154d[_0xf3bb('0x20d')];if(_0x1d154d[_0xf3bb('0x217')]>0x0){var _0x30d282=_0x1d154d['dialLimitQueue']-_0x1d154d[_0xf3bb('0x20d')]-_0x1d154d[_0xf3bb('0x1cc')]-_0x1d154d['pTalking'];if(_0x5d53d1>_0x30d282){_0x5d53d1=_0x30d282;}}if(_0x5d53d1>0x0&&_0x1d154d['temp']==0x0){if(_0x1d154d[_0xf3bb('0xb6')]===_0xf3bb('0x9')){_0x5d53d1=0x1;}if(_0x5d53d1>this[_0xf3bb('0x22')]){_0x5d53d1=this[_0xf3bb('0x22')];}for(var _0xd2a0d4 in this[_0xf3bb('0x20')]){if(typeof this['agents'][_0xd2a0d4]!==_0xf3bb('0xb0')){if(this[_0xf3bb('0x20')][_0xd2a0d4][_0xf3bb('0x72')]==='not_inuse'&&this[_0xf3bb('0x20')][_0xd2a0d4][_0xf3bb('0x89')]==='reachable'){_0x567a71[_0xf3bb('0xa4')](this[_0xf3bb('0x20')][_0xd2a0d4]['id']);}}}_0x1d154d[_0xf3bb('0x20e')]=0x1;hopperUtils['getContactDialer'](_0x1d154d,_0x567a71,_0x5d53d1)[_0xf3bb('0x43')](function(_0x5065cf){_0x1d154d[_0xf3bb('0x20e')]=0x0;if(_0x5065cf){if(!utils['checkContactEmpty'](_0x5065cf)){hopperUtils['countReScheduled'](_0x1d154d)[_0xf3bb('0x43')](sendMessageReschedule(_0x1d154d))[_0xf3bb('0xa3')](loggerCatch(_0xf3bb('0x218')));}else{_0x1d154d[_0xf3bb('0x20d')]+=_0x5065cf[_0xf3bb('0x9c')];_0x1d154d[_0xf3bb('0x6d')]=_0x1d154d[_0xf3bb('0xb6')]===_0xf3bb('0x9')?utils[_0xf3bb('0x6e')][_0xf3bb('0x14c')]:utils[_0xf3bb('0x6e')]['RUNNING'];for(var _0x6a0ed=0x0;_0x6a0ed<_0x5065cf[_0xf3bb('0x9c')];_0x6a0ed+=0x1){if(_[_0xf3bb('0xf9')](_0x5065cf[_0x6a0ed])||_[_0xf3bb('0xf9')](_0x5065cf[_0x6a0ed]['Contact'])||_[_0xf3bb('0xf9')](_0x5065cf[_0x6a0ed][_0xf3bb('0x16e')])){_0x5daad5[_0xf3bb('0x163')]('[actionOriginate]\x20',_0x1d154d,_0x5065cf[_0x6a0ed]);}else{hopperUtils[_0xf3bb('0x219')](_[_0xf3bb('0x107')](_0x5065cf[_0x6a0ed],['VoiceQueueId','phone']))['then'](_0x5daad5[_0xf3bb('0x214')](_0x1d154d,_0x5065cf[_0x6a0ed]))['catch'](function(_0x523716){logger['error'](_0xf3bb('0x21a'),_0x523716);utils['decrementOriginate'](_0x1d154d,_0xf3bb('0x21b'));});}}}}})['catch'](function(_0x146cc9){_0x1d154d[_0xf3bb('0x20e')]=0x0;logger[_0xf3bb('0x6b')]('[getContactCampaign2]',_0x146cc9);});}};Dialer['prototype'][_0xf3bb('0x69')]=function(_0x11c02e){if(_0x11c02e[_0xf3bb('0x217')]>0x0){var _0x5bd682=_0x11c02e[_0xf3bb('0x217')]-_0x11c02e[_0xf3bb('0x20d')]-_0x11c02e['talking'];if(_0x5bd682>0x0&&_0x11c02e['temp']==0x0){this[_0xf3bb('0x21c')](_0x11c02e);}else{loggerPredictiveCalls[_0xf3bb('0x50')](_0xf3bb('0x21d'));}}else{this[_0xf3bb('0x21c')](_0x11c02e);}};Dialer[_0xf3bb('0x86')][_0xf3bb('0x21c')]=function(_0x4896c4){var _0x30d102=this;var _0x51be81=[];_0x4896c4[_0xf3bb('0x20d')]+=0x1;for(var _0x264d3c in this[_0xf3bb('0x20')]){if(typeof this[_0xf3bb('0x20')][_0x264d3c]!=='undefined'){if(this[_0xf3bb('0x20')][_0x264d3c][_0xf3bb('0x72')]===_0xf3bb('0x21e')&&this[_0xf3bb('0x20')][_0x264d3c][_0xf3bb('0x89')]===_0xf3bb('0x8a')){_0x51be81['push'](this[_0xf3bb('0x20')][_0x264d3c]['id']);}}}_0x4896c4[_0xf3bb('0x20e')]=0x1;return this[_0xf3bb('0x21f')](_0x4896c4['id'],_0x51be81,0x1,_0x4896c4[_0xf3bb('0x220')],_0x4896c4)[_0xf3bb('0x43')](function(_0x1dd97c){_0x4896c4['temp']=0x1;if(_0x1dd97c){if(!utils[_0xf3bb('0x20f')](_0x1dd97c)){utils[_0xf3bb('0x221')](_0x4896c4,0x1,0x0);return hopperUtils[_0xf3bb('0x222')](_0x4896c4)[_0xf3bb('0x43')](sendMessageReschedule(_0x4896c4))[_0xf3bb('0xa3')](loggerCatch('[countReScheduled]\x20'));}else{_0x4896c4[_0xf3bb('0x6d')]=utils[_0xf3bb('0x6e')]['RUNNING'];if(_[_0xf3bb('0xf9')](_0x1dd97c[0x0])||_['isNil'](_0x1dd97c[0x0][_0xf3bb('0x183')])||_[_0xf3bb('0xf9')](_0x1dd97c[0x0][_0xf3bb('0x16e')])){_0x30d102['emptyContact'](_0xf3bb('0x213'),_0x4896c4,_0x1dd97c[0x0]);}else{return hopperUtils[_0xf3bb('0x219')](_['pick'](_0x1dd97c[0x0],[_0xf3bb('0xe4'),_0xf3bb('0x16e')]))[_0xf3bb('0x43')](_0x30d102['checkContactBlack'](_0x4896c4,_0x1dd97c[0x0]))[_0xf3bb('0xa3')](function(_0x38afef){logger[_0xf3bb('0x6b')](_0xf3bb('0x223'),_0x38afef);utils[_0xf3bb('0xc8')](_0x4896c4,'[actionOriginatePredictive]');});}}}})[_0xf3bb('0xa3')](function(_0x534574){_0x4896c4[_0xf3bb('0x20e')]=0x0;logger[_0xf3bb('0x6b')](_0xf3bb('0x224'),_0x534574);});};Dialer[_0xf3bb('0x86')][_0xf3bb('0x1e6')]=function(_0xfc2c77,_0x25eca0,_0x5bd045,_0x36e50a,_0x53cf61,_0x840657){loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x225'));loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x226'),_0xfc2c77);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x227'),_0x25eca0);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x228'),_0x5bd045);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x229'),_0x36e50a);loggerPredictive[_0xf3bb('0x50')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53cf61);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x5a'));return new Promise(function(_0x5a5a73,_0x2d6365){if(_0xfc2c77<=0x0||isNaN(_0xfc2c77)){return _0x2d6365(msgResponse(_0xf3bb('0x22a'),_0xf3bb('0x85'),_0xf3bb('0x22b')+_0xfc2c77));}if(_0x5bd045<=0x0||isNaN(_0x5bd045)){return _0x2d6365(msgResponse(_0xf3bb('0x22a'),_0xf3bb('0x85'),'Ts\x20=\x20'+_0x5bd045));}if(_0x36e50a<=0x0||isNaN(_0x36e50a)){return _0x2d6365(msgResponse('[abandonmentRate]',_0xf3bb('0x85'),_0xf3bb('0x22c')+_0x36e50a));}if(_0x25eca0<=0x0||isNaN(_0x25eca0)){return _0x2d6365(msgResponse(_0xf3bb('0x22a'),_0xf3bb('0x85'),_0xf3bb('0x22d')+_0x25eca0));}if(_0x53cf61<=0x0||isNaN(_0x53cf61)){return _0x2d6365(msgResponse(_0xf3bb('0x22a'),_0xf3bb('0x85'),_0xf3bb('0x22e')+_0x53cf61));}_0x840657=_0x840657||0x0;var _0x398429=0x1/_0x5bd045;var _0x4a9d32=0x0;var _0x3d9a22=0x0;var _0x16ff8a=0x0;var _0x24af2b=0x0;for(var _0x29a35e=0x0;_0x16ff8a<_0x53cf61;_0x29a35e+=0x1){_0x3d9a22=_0x29a35e/_0x25eca0;_0x4a9d32=(_0x36e50a*_0x3d9a22+_0x840657)/_0x398429;_0x16ff8a=utils[_0xf3bb('0x22f')](_0x4a9d32,_0xfc2c77);_0x24af2b=_0x4a9d32/_0xfc2c77*(0x1-utils[_0xf3bb('0x22f')](_0x4a9d32,_0xfc2c77));}return _0x5a5a73({'erlangCalls':_0x29a35e,'erlangCallToSecond':_0x25eca0/_0x29a35e,'erlangAbandonmentRate':_0x16ff8a,'erlangBusyFactor':_0x24af2b});});};Dialer['prototype'][_0xf3bb('0x1e8')]=function(_0x27d569,_0x1b9c33,_0x229688,_0x26f214,_0xd5a2a1,_0x578e9){loggerPredictive[_0xf3bb('0x50')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xf3bb('0x50')]('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',_0x27d569);loggerPredictive['info'](_0xf3bb('0x227'),_0x1b9c33);loggerPredictive[_0xf3bb('0x50')]('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',_0x229688);loggerPredictive['info'](_0xf3bb('0x229'),_0x26f214);loggerPredictive[_0xf3bb('0x50')](_0xf3bb('0x230'),_0xd5a2a1);loggerPredictive['info'](_0xf3bb('0x5a'));return new Promise(function(_0xd9307f,_0x22db26){if(_0x27d569<=0x0||isNaN(_0x27d569)){return _0x22db26(msgResponse('[busyFactor]',_0xf3bb('0x85'),_0xf3bb('0x22b')+_0x27d569));}if(_0x229688<=0x0||isNaN(_0x229688)){return _0x22db26(msgResponse(_0xf3bb('0x231'),_0xf3bb('0x85'),_0xf3bb('0x232')+_0x229688));}if(_0x26f214<=0x0||isNaN(_0x26f214)){return _0x22db26(msgResponse(_0xf3bb('0x231'),_0xf3bb('0x85'),_0xf3bb('0x22c')+_0x26f214));}if(_0x1b9c33<=0x0||isNaN(_0x1b9c33)){return _0x22db26(msgResponse(_0xf3bb('0x231'),_0xf3bb('0x85'),_0xf3bb('0x22d')+_0x1b9c33));}if(_0xd5a2a1<=0x0||isNaN(_0xd5a2a1)){return _0x22db26(msgResponse(_0xf3bb('0x231'),_0xf3bb('0x85'),_0xf3bb('0x233')+_0xd5a2a1));}_0x578e9=_0x578e9||0x0;var _0x44d3ad=0x1/_0x229688;var _0x1e53a9=0x0;var _0x150e4f=0x0;var _0x2e132b=0x0;var _0x4b2ad9=0x0;for(var _0x339f03=0x0;_0x4b2ad9<_0xd5a2a1;_0x339f03+=0x1){_0x150e4f=_0x339f03/_0x1b9c33;_0x1e53a9=(_0x26f214*_0x150e4f+_0x578e9)/_0x44d3ad;_0x2e132b=utils[_0xf3bb('0x22f')](_0x1e53a9,_0x27d569);_0x4b2ad9=_0x1e53a9/_0x27d569*(0x1-utils[_0xf3bb('0x22f')](_0x1e53a9,_0x27d569));}return _0xd9307f({'erlangCalls':_0x339f03,'erlangCallToSecond':_0x1b9c33/_0x339f03,'erlangAbandonmentRate':_0x2e132b,'erlangBusyFactor':_0x4b2ad9});});};module[_0xf3bb('0x234')]=Dialer; \ No newline at end of file +var _0x08e1=['[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','countabandonedretry','countglobal','voiceQueue','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','minutes','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','[unlock][syncQueueStatusComplete]','queueBookedRR','length','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','decrementOriginate','[syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncOriginateResponse','getQueue','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','custom:amd','buildObj','[syncHangupInAMD]','MACHINE','[syncVarSet]','Machine','membername','AMD','countmachineretry','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','reason\x2019\x20machine....','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','Unknown','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','map','Agent','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','undefined','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','user:dialPreviewRecallReminder','launchHandleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','callerid','dialOriginateCallerIdName','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','object','outboundNoSuchCallsDay','custom:agentnosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','outboundBusyCallsDay','Busy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','loggedIn','[CatchErlangB]','floor','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','voicePause','run','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','checkIsBlackList','[actionOriginate]','[handlePower]','tryOriginatePredictive','getContactDialer','checkContactLowerLimitOriginate','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','predictive','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','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','erlangAbandonmentRate','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','NULL_INTERVAL','isEmpty','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20deactivated','[ifTime][Action]','Error','prototype','isTrunkReachable','active','format','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','ifTime','Failure','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','interval','timezones','then','content','indexOf','catch','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','isIVRCampaign','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Global:\x20','Timezone:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','moveContactManagedDialer','[syncAgentComplete]','ivr'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x08e1,0x15b));var _0x108e=function(_0x4ac424,_0x554b5d){_0x4ac424=_0x4ac424-0x0;var _0xe1b890=_0x08e1[_0x4ac424];return _0xe1b890;};'use strict';var util=require(_0x108e('0x0'));var _=require('lodash');var uuid=require(_0x108e('0x1'));var moment=require(_0x108e('0x2'));var rr=require('rr');var Redis=require(_0x108e('0x3'));var utils=require(_0x108e('0x4'));var hopperUtils=require(_0x108e('0x5'));var ut=require(_0x108e('0x6'));var config=require('../../../config/environment/');var logger=require(_0x108e('0x7'))(_0x108e('0x8'));var loggerBooked=require(_0x108e('0x7'))('booked');var loggerPredictive=require(_0x108e('0x7'))(_0x108e('0x9'));var loggerPredictiveCalls=require(_0x108e('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x108e('0xa'));var ami=require(_0x108e('0xb'));config[_0x108e('0xc')]=_['defaults'](config[_0x108e('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x108e('0xd'))(new Redis(config[_0x108e('0xc')]));var cmHopper=require(_0x108e('0xe'));var voiceQueueRt=require(_0x108e('0xf'));var RpcSetting=require(_0x108e('0x10'));var Interval=require(_0x108e('0x11'));var Action=require('./models/action');var History=require(_0x108e('0x12'));var Final=require(_0x108e('0x13'));var AgentComplete=require(_0x108e('0x14'));var QueueCallerAbandon=require(_0x108e('0x15'));var Hangup=require(_0x108e('0x16'));var ipAgi=process[_0x108e('0x17')][_0x108e('0x18')]||_0x108e('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x3eef2a){this[_0x108e('0x1a')]=this[_0x108e('0x1a')]?this[_0x108e('0x1a')][_0x108e('0x1b')](_0x3eef2a):_0x3eef2a();};function Dialer(_0x183551,_0xb1b8e7){this[_0x108e('0x1c')]=new Sequence();this[_0x108e('0x1d')]=_0xb1b8e7;this[_0x108e('0x1e')]=_0x183551[_0x108e('0x1e')];this[_0x108e('0x1f')]=_0x183551[_0x108e('0x1f')];this[_0x108e('0x20')]=_0x183551[_0x108e('0x20')];this[_0x108e('0x21')]=_0x183551[_0x108e('0x21')];this[_0x108e('0x22')]=config['maxNumberOriginate']||0x2;this[_0x108e('0x23')]={};this[_0x108e('0x24')]={};this[_0x108e('0x25')]={};this[_0x108e('0x26')]={};this[_0x108e('0x27')]={};this[_0x108e('0x28')]={};this[_0x108e('0x29')]={};this[_0x108e('0x2a')]={};this[_0x108e('0x2b')]={};this['queueBookedRR']={};this[_0x108e('0x2c')]={};ami['on'](_0x108e('0x2d'),this[_0x108e('0x2e')][_0x108e('0x2f')](this));ami['on'](_0x108e('0x30'),this[_0x108e('0x31')][_0x108e('0x2f')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x108e('0x2f')](this));ami['on'](_0x108e('0x32'),this['syncAgentComplete'][_0x108e('0x2f')](this));ami['on'](_0x108e('0x33'),this[_0x108e('0xa')][_0x108e('0x2f')](this));ami['on']('custom:queuesummarycomplete',this[_0x108e('0x34')]['bind'](this));ami['on'](_0x108e('0x35'),this[_0x108e('0x36')][_0x108e('0x2f')](this));ami['on'](_0x108e('0x37'),this[_0x108e('0x38')]['bind'](this));ami['on'](_0x108e('0x39'),this[_0x108e('0x3a')][_0x108e('0x2f')](this));ami['on'](_0x108e('0x3b'),this[_0x108e('0x3c')][_0x108e('0x2f')](this));ami['on'](_0x108e('0x3d'),this[_0x108e('0x3e')]['bind'](this));this[_0x108e('0x3f')]();this[_0x108e('0x40')]();RpcSetting[_0x108e('0x41')]()['then'](function(_0x5164f4){previewRecallmeReminderInterval=_0x5164f4[_0x108e('0x42')];});}function isNotNull(_0x2856f1){return _0x2856f1!==null&&!_[_0x108e('0x43')](_0x2856f1);}function msgResponse(_0x24db53,_0x2a6277,_0xe16edb){return{'action':_0x24db53,'response':_0x2a6277,'message':_0xe16edb,'stack':_0xe16edb};}function emit(_0x496566,_0x5ef21c,_0x12206b){io['to'](_0x496566)[_0x108e('0x44')](_0x5ef21c,_0x12206b);}function emitOutboundVoiceQueueSummary(_0x3dd27e){if(_0x3dd27e[_0x108e('0x45')]===_0x108e('0x46')){logger[_0x108e('0x47')](_0x108e('0x48'),util[_0x108e('0x49')](_0x3dd27e,{'showHidden':![],'depth':null}));emit(util['format'](_0x108e('0x4a'),_0x3dd27e[_0x108e('0x4b')]),_0x108e('0x4c'),_0x3dd27e);}}function checkGetDataPredictive(_0x2a6c91){if(isNotNull(_0x2a6c91)&&!_['isEmpty'](_0x2a6c91)){loggerPredictive[_0x108e('0x4d')](_0x108e('0x4e'));loggerPredictive[_0x108e('0x4d')](_0x108e('0x4f'),_0x2a6c91[_0x108e('0x50')]);loggerPredictive[_0x108e('0x4d')](_0x108e('0x51'),_0x2a6c91[_0x108e('0x52')]);loggerPredictive[_0x108e('0x4d')](_0x108e('0x53'),_0x2a6c91[_0x108e('0x54')]);loggerPredictive['info'](_0x108e('0x55'),_0x2a6c91[_0x108e('0x56')]);loggerPredictive[_0x108e('0x4d')](_0x108e('0x57'),_0x2a6c91[_0x108e('0x58')]);loggerPredictive['info'](_0x108e('0x59'),_0x2a6c91[_0x108e('0x5a')]);loggerPredictive['info'](_0x108e('0x5b'));if(_0x2a6c91[_0x108e('0x50')]>0x0){if(!_[_0x108e('0x43')](_0x2a6c91[_0x108e('0x5a')])&&_0x2a6c91[_0x108e('0x5a')]>0x0){return!![];}loggerPredictive['info'](_0x108e('0x5c'));if(!_[_0x108e('0x43')](_0x2a6c91[_0x108e('0x58')])&&_0x2a6c91[_0x108e('0x58')]>0x0){return!![];}loggerPredictive[_0x108e('0x4d')](_0x108e('0x5d'));}else{loggerPredictive[_0x108e('0x4d')](_0x108e('0x5e'));}}else{loggerPredictive[_0x108e('0x4d')](_0x108e('0x5f'));}return![];}function mergeDataErlangB(_0x138d32){return function(_0x18141e){loggerPredictive['info'](_0x108e('0x60'));loggerPredictive[_0x108e('0x4d')](_0x108e('0x61'),_0x18141e['erlangCalls']);loggerPredictive[_0x108e('0x4d')](_0x108e('0x62'),_0x18141e['erlangCallToSecond']);loggerPredictive[_0x108e('0x4d')](_0x108e('0x63'),_0x18141e['erlangAbandonmentRate']);loggerPredictive[_0x108e('0x4d')](_0x108e('0x64'),_0x18141e['erlangBusyFactor']);loggerPredictive[_0x108e('0x4d')](_0x108e('0x63'),_0x18141e[_0x108e('0x65')]);loggerPredictive[_0x108e('0x4d')](_0x108e('0x5b'));_[_0x108e('0x66')](_0x138d32,_0x18141e);};}function ifInterval(_0x4169a2,_0x2df3dd){if(_[_0x108e('0x43')](_0x2df3dd)){return![];}return utils[_0x108e('0x67')](undefined,_0x2df3dd)<_0x4169a2*0x3c;}function clearPredictiveAttributes(_0x19cb71){if(_0x19cb71[_0x108e('0x29')]){_0x19cb71[_0x108e('0x29')]=undefined;loggerPredictive['debug'](_0x19cb71[_0x108e('0x4b')],'startProgressive\x20value\x20cleared');}if(_0x19cb71[_0x108e('0x28')]){_0x19cb71[_0x108e('0x28')]=undefined;loggerPredictive[_0x108e('0x47')](_0x19cb71[_0x108e('0x4b')],_0x108e('0x68'));}if(_0x19cb71['handlePredictive']){clearInterval(_0x19cb71[_0x108e('0x69')]);_0x19cb71[_0x108e('0x69')]=undefined;loggerPredictive[_0x108e('0x47')](_0x19cb71['name'],_0x108e('0x6a'));}}function loggerCatchPredictive(_0x52e10d,_0x1b6f9c){return function(_0x140d72){loggerPredictive[_0x108e('0x6b')](_0x1b6f9c[_0x108e('0x4b')],_0x52e10d);loggerPredictive['error'](_0x140d72[_0x108e('0x6c')]);clearPredictiveAttributes(_0x1b6f9c);};}function loggerCatch(_0x4f75aa){return function(_0x5a9c6b){logger['error'](_0x4f75aa,util[_0x108e('0x49')](_0x5a9c6b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x551f43){return function(_0x49421c){if(isNotNull(_0x49421c)&&isNotNull(_0x49421c[0x0])){if(_0x49421c[0x0][_0x108e('0x6d')]>0x0){_0x551f43[_0x108e('0x6e')]=utils[_0x108e('0x6f')]['CONTACTS_RESCHEDULED'];logger['info'](_0x108e('0x70')+_0x551f43['name'],_0x49421c[0x0][_0x108e('0x6d')],_0x108e('0x71'));}else{_0x551f43[_0x108e('0x6e')]=utils['CAMPAIGN_STATUS'][_0x108e('0x72')];logger[_0x108e('0x4d')]('[getContactDialer2][Empty]'+_0x551f43[_0x108e('0x4b')]);}}};}function createObjHistory(_0x163c53,_0x5f4587,_0x3f8460,_0x41e22c,_0x2564c8){_0x163c53[_0x108e('0x6e')]=_0x3f8460;var _0xf6e9d=new Action(_0x163c53,_0x5f4587);var _0x3c976e=new History(_0xf6e9d);_0x3c976e[_0x108e('0x73')]=_0x41e22c;_0x3c976e[_0x108e('0x74')]=_0x2564c8;_0x3c976e[_0x108e('0x75')]=_0xf6e9d[_0x108e('0x76')];return _0x3c976e;}function unlockQueueStatus(_0x54c205,_0x28d0f3){setTimeout(function(){if(_[_0x108e('0x43')](_0x54c205[_0x108e('0x77')])){loggerBooked[_0x108e('0x6b')](_0x108e('0x78'),_0x28d0f3);}_0x54c205[_0x108e('0x77')]=!![];loggerBooked[_0x108e('0x4d')](_0x108e('0x79'),_0x28d0f3,JSON[_0x108e('0x7a')](_[_0x108e('0x7b')](_0x54c205,[_0x108e('0x4b'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x18fdb5){return function(){if(!isNotNull(_0x18fdb5[_0x108e('0x7c')])){_0x18fdb5[_0x108e('0x6e')]=utils[_0x108e('0x6f')]['NULL_INTERVAL'];throw _0x18fdb5[_0x108e('0x4b')]+_0x108e('0x7d');}if(!isNotNull(_0x18fdb5[_0x108e('0x7c')]['Intervals'])){_0x18fdb5[_0x108e('0x6e')]=utils[_0x108e('0x6f')][_0x108e('0x7e')];throw _0x18fdb5[_0x108e('0x4b')]+_0x108e('0x7d');}if(!isNotNull(_[_0x108e('0x7f')](_0x18fdb5[_0x108e('0x7c')][_0x108e('0x80')]))){_0x18fdb5[_0x108e('0x6e')]=utils[_0x108e('0x6f')]['NULL_INTERVAL'];throw _0x18fdb5[_0x108e('0x4b')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x263297){return function(){if(!utils[_0x108e('0x81')](_0x263297)){_0x263297[_0x108e('0x6e')]=utils[_0x108e('0x6f')][_0x108e('0x82')];throw _0x263297['name']+_0x108e('0x83');}};}function emitCampaignSummary(_0x5d2f32){if(utils['isIVRCampaign'](_0x5d2f32)){emit(util['format'](_0x108e('0x84'),_0x5d2f32[_0x108e('0x4b')]),_0x108e('0x85'),_0x5d2f32);}}function loggerCatchQueueSummary(_0x352522,_0x3d2066){return function(_0x58e205){clearPredictiveAttributes(_0x3d2066);emitCampaignSummary(_0x3d2066);loggerSyncQueueSummary[_0x108e('0x47')](_0x352522,util[_0x108e('0x49')](_0x58e205,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x523819){if(_0x523819[_0x108e('0x86')]){if(_0x523819[_0x108e('0x87')]===0x0){_0x523819[_0x108e('0x86')]=![];_0x523819[_0x108e('0x6e')]=utils[_0x108e('0x6f')][_0x108e('0x82')];loggerSyncQueueSummary[_0x108e('0x47')](_0x108e('0x88'),_0x523819[_0x108e('0x4b')],_0x108e('0x89'));}else{_0x523819[_0x108e('0x6e')]=utils[_0x108e('0x6f')][_0x108e('0x8a')];loggerSyncQueueSummary[_0x108e('0x47')](_0x108e('0x88'),_0x523819[_0x108e('0x4b')],_0x108e('0x8b'));}emitCampaignSummary(_0x523819);}}function myreject(_0x8177e9){return function(_0x54a02c){return _0x8177e9(msgResponse(_0x108e('0x8c'),_0x108e('0x8d'),JSON[_0x108e('0x7a')](_0x54a02c)));};}Dialer[_0x108e('0x8e')][_0x108e('0x8f')]=function(_0x13a87f){return!_[_0x108e('0x43')](_0x13a87f)&&_0x13a87f&&!_[_0x108e('0x43')](_0x13a87f['name'])&&!_[_0x108e('0x43')](_0x13a87f[_0x108e('0x90')])&&_0x13a87f['active']&&(this[_0x108e('0x21')][util[_0x108e('0x91')](_0x108e('0x92'),_0x13a87f['name'])][_0x108e('0x93')]===_0x108e('0x94')||this[_0x108e('0x21')][util[_0x108e('0x91')](_0x108e('0x92'),_0x13a87f[_0x108e('0x4b')])][_0x108e('0x93')]===_0x108e('0x95'));};Dialer[_0x108e('0x8e')][_0x108e('0x96')]=function(_0x3d6114){var _0x4a0e0d=this;return function(){if(!_0x4a0e0d[_0x108e('0x8f')](_0x3d6114[_0x108e('0x97')])){if(!_0x4a0e0d[_0x108e('0x8f')](_0x3d6114[_0x108e('0x98')])){_0x3d6114[_0x108e('0x6e')]=utils['CAMPAIGN_STATUS'][_0x108e('0x99')];throw _0x3d6114[_0x108e('0x4b')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x108e('0x8e')][_0x108e('0x9a')]=function(_0x105af3,_0x2b9a2a,_0x541626,_0x28ac2a){var _0x3e465c=this;return function(){var _0x146af3=!![];return _0x3e465c[_0x108e('0x9b')](_0x105af3,_0x2b9a2a,_0x541626,_0x28ac2a,_0x146af3);};};Dialer[_0x108e('0x8e')]['checkIfTimeIntervals']=function(_0x3afb29,_0x39bac6,_0x4f098e,_0x14e5e0){var _0x476998=this;return function(){var _0xc6119a=![];return _0x476998[_0x108e('0x9b')](_0x3afb29[_0x108e('0x80')],_0x39bac6,_0x4f098e,_0x14e5e0,_0xc6119a);};};Dialer[_0x108e('0x8e')][_0x108e('0x9b')]=function(_0x41f397,_0x10881f,_0x551275,_0x455290,_0x4e96b5){var _0x1c3068=[];return new Promise(function(_0x10d6d4,_0x10f32c){if(!isNotNull(_0x41f397)){_0x455290['message']=utils[_0x108e('0x6f')][_0x108e('0x7e')];return _0x10f32c(msgResponse(_0x108e('0x9c'),_0x108e('0x9d'),_0x551275+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x108e('0x7f')](_0x41f397)){_0x455290[_0x108e('0x6e')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x10f32c(msgResponse(_0x108e('0x9c'),_0x108e('0x9d'),_0x551275+'\x20Intervals\x20is\x20empty\x20'));}if(_0x10881f&&_['isUndefined'](config['timezones'][_0x10881f])){_0x455290[_0x108e('0x6e')]=utils[_0x108e('0x6f')][_0x108e('0x9e')];return _0x10f32c(msgResponse(_0x108e('0x9c'),_0x108e('0x9d'),_0x551275+_0x108e('0x9f')+_0x10881f));}if(_[_0x108e('0xa0')](_0x41f397)){for(var _0x462062=0x0;_0x462062<_0x41f397['length'];_0x462062+=0x1){_0x1c3068[_0x108e('0xa1')](ami[_0x108e('0xa2')]({'action':_0x108e('0xa3'),'command':util[_0x108e('0x91')](_0x108e('0xa4'),_0x41f397[_0x462062][_0x108e('0xa5')],!_['isUndefined'](config[_0x108e('0xa6')][_0x10881f])?_0x10881f:'')})[_0x108e('0xa7')](function(_0x392378){return _0x392378[_0x108e('0xa8')][_0x108e('0xa9')]('true')>=0x0;})[_0x108e('0xaa')](myreject(_0x10f32c)));}}else{_0x1c3068[_0x108e('0xa1')](ami['Action']({'action':'command','command':util[_0x108e('0x91')]('iftime\x20%s,%s',_0x41f397,!_[_0x108e('0x43')](config[_0x108e('0xa6')][_0x10881f])?_0x10881f:'')})[_0x108e('0xa7')](function(_0x12989e){return _0x12989e[_0x108e('0xa8')][_0x108e('0xa9')]('true')>=0x0;})[_0x108e('0xaa')](myreject(_0x10f32c)));}Promise[_0x108e('0xab')](_0x1c3068)[_0x108e('0xa7')](function(_0x584a4f){var _0x521885=_['some'](_0x584a4f);if(_0x521885){return _0x10d6d4(_0x521885);}else{_0x455290['message']=_0x4e96b5?utils[_0x108e('0x6f')][_0x108e('0xac')]:utils['CAMPAIGN_STATUS'][_0x108e('0xad')];return _0x10f32c(msgResponse(_0x108e('0xae'),_0x108e('0x9d'),'Global:\x20'+_0x4e96b5+'\x20'+_0x551275+_0x108e('0xaf')+util[_0x108e('0x49')](_0x41f397,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x10881f));}})['catch'](function(_0x32e890){return _0x10f32c(msgResponse(_0x108e('0x9c'),_0x108e('0x9d'),JSON[_0x108e('0x7a')](_0x32e890)));});});};Dialer['prototype'][_0x108e('0x3f')]=function(){var _0x2195a1=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x108e('0xa7')](function(){setInterval(function(){_0x2195a1[_0x108e('0xb0')]();},0x3e8);});};Dialer['prototype'][_0x108e('0xb0')]=function(){var _0x4495e2=this;var _0x5d0bd8;for(var _0x5d01af in this['campaigns']){if(typeof this['campaigns'][_0x5d01af]!=='undefined'){_0x5d0bd8=this[_0x108e('0x1f')][_0x5d01af];if(utils[_0x108e('0xb1')](_0x5d0bd8)&&utils[_0x108e('0x81')](_0x5d0bd8)){_0x5d0bd8[_0x108e('0x86')]=!![];Promise[_0x108e('0xb2')]()[_0x108e('0xa7')](checkIsIVRCampaignActive(_0x5d0bd8))['then'](checkInterval(_0x5d0bd8))[_0x108e('0xa7')](_0x4495e2[_0x108e('0x96')](_0x5d0bd8))['then'](_0x4495e2[_0x108e('0x9a')](_0x5d0bd8[_0x108e('0xb3')],_0x5d0bd8[_0x108e('0xb4')],_0x5d0bd8[_0x108e('0x4b')],_0x5d0bd8))[_0x108e('0xa7')](_0x4495e2[_0x108e('0xb5')](_0x5d0bd8[_0x108e('0x7c')],_0x5d0bd8['dialTimezone'],_0x5d0bd8[_0x108e('0x4b')],_0x5d0bd8))[_0x108e('0xa7')](_0x4495e2['launchHandleIvr'](_0x5d0bd8))['catch'](loggerCatchQueueSummary(_0x108e('0xb6'),_0x5d0bd8));}else{notSendMessagesCampaign(_0x5d0bd8);}}}};Dialer['prototype'][_0x108e('0xb7')]=function(_0x300210){if(_0x300210[_0x108e('0xb8')]!==_0x108e('0x9')){clearPredictiveAttributes(_0x300210);}switch(_0x300210[_0x108e('0xb8')]){case'progressive':this[_0x108e('0xb9')](_0x300210,0x1);break;case _0x108e('0xba'):this[_0x108e('0xb9')](_0x300210,_0x300210[_0x108e('0xbb')]);break;case _0x108e('0x9'):this[_0x108e('0x9')](_0x300210);break;case _0x108e('0xbc'):this['handlePower'](_0x300210,0x1);break;default:logger[_0x108e('0x6b')](_0x108e('0xbd'),_0x300210[_0x108e('0x4b')],_0x108e('0xbe'));}};Dialer[_0x108e('0x8e')][_0x108e('0x9c')]=function(_0x463e1a,_0xee6fab){var _0x547f7b=_0x463e1a[_0x108e('0xb4')];var _0x26edc7=_0xee6fab?_0x463e1a['dialGlobalInterval']:_0x463e1a['Interval'][_0x108e('0x80')];logger['silly'](_0x108e('0xbf'),_0x26edc7,_0x547f7b,_0x463e1a['name'],util[_0x108e('0x91')](_0x108e('0xc0'),_0x463e1a[_0x108e('0x4b')],_0x463e1a['id']));var _0x5908e2=null;return Interval[_0x108e('0xc1')](_0x26edc7,_0x547f7b)[_0x108e('0xa7')](function(_0x8a1d23){if(_0x8a1d23===!![]){return _0x8a1d23;}else{_0x463e1a['message']=_0xee6fab?utils[_0x108e('0x6f')][_0x108e('0xac')]:utils[_0x108e('0x6f')][_0x108e('0xad')];_0x5908e2=msgResponse(_0x108e('0xae'),_0x108e('0x9d'),_0x108e('0xc2')+_0xee6fab+'\x20'+_0x463e1a['name']+_0x108e('0xaf')+util[_0x108e('0x49')](_0x26edc7,{'showHidden':![],'depth':null})+_0x108e('0xc3')+_0x547f7b);}if(_0x5908e2!==null){logger[_0x108e('0xc4')](_0x108e('0xc5'),_0x5908e2);_0x5908e2[_0x108e('0xc6')]=_0xee6fab;throw _0x5908e2;}})[_0x108e('0xaa')](function(_0x81a008){logger[_0x108e('0x6b')]('AMI\x20IfTime',_0x81a008);throw msgResponse(_0x108e('0x8c'),'Error',util['inspect'](_0x81a008,{'showHidden':![],'depth':null}));});};Dialer[_0x108e('0x8e')]['syncAgentConnect']=function(_0xf2fba0){if(this['voiceQueues'][_0xf2fba0[_0x108e('0xc7')]]){if(this[_0x108e('0x26')][_0xf2fba0[_0x108e('0xc8')]]&&this[_0x108e('0x26')][_0xf2fba0['uniqueid']][_0x108e('0x45')]!=='ivr'){utils['decrementOriginate'](this[_0x108e('0x1e')][_0xf2fba0['queue']],_0x108e('0xc9'));this[_0x108e('0x26')][_0xf2fba0[_0x108e('0xc8')]][_0x108e('0xca')]=moment()[_0x108e('0x91')](_0x108e('0xcb'));}}};Dialer[_0x108e('0x8e')][_0x108e('0xcc')]=function(_0x23d1f4){var _0x2baeaf=this[_0x108e('0x26')][_0x23d1f4['uniqueid']];if(this['voiceQueues'][_0x23d1f4['queue']]){if(_0x2baeaf&&_0x2baeaf[_0x108e('0x45')]!=='ivr'){delete this['uniqueId'][_0x23d1f4['uniqueid']];this['voiceQueues'][_0x23d1f4[_0x108e('0xc7')]]['outboundAnswerCallsDay']+=0x1;var _0x4166fb=new AgentComplete(_0x2baeaf,_0x23d1f4);if(_0x23d1f4[_0x108e('0xcd')]===_0x108e('0xce')){_0x4166fb[_0x108e('0xcf')]=this[_0x108e('0x1e')][_0x23d1f4[_0x108e('0xc7')]][_0x108e('0xd0')]&&this[_0x108e('0x1e')][_0x23d1f4[_0x108e('0xc7')]][_0x108e('0xd1')]?moment()[_0x108e('0x91')](_0x108e('0xcb')):undefined;}hopperUtils['createHistory'](_0x4166fb)[_0x108e('0xaa')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x108e('0xd2')](_0x4166fb)['catch'](loggerCatch(_0x108e('0xd3')));}}};Dialer['prototype'][_0x108e('0x31')]=function(_0xc75674){var _0xd6cdce=this[_0x108e('0x26')][_0xc75674['uniqueid']];var _0x2107bd=this;var _0x4c7754=![];var _0x56f0e0;var _0x5fa277;if(this[_0x108e('0x1e')][_0xc75674[_0x108e('0xc7')]]){if(_0xd6cdce&&_0xd6cdce[_0x108e('0x45')]!==_0x108e('0xd4')){delete this[_0x108e('0x26')][_0xc75674['uniqueid']];utils['decrementOriginate'](this[_0x108e('0x1e')][_0xc75674['queue']],_0x108e('0xd5'));_0xd6cdce['droptime']=moment()['format'](_0x108e('0xcb'));var _0x5c3e8a=new QueueCallerAbandon(_0xd6cdce,_0xc75674);if(utils[_0x108e('0x67')](_0xd6cdce[_0x108e('0xd6')],_0xd6cdce[_0x108e('0xd7')])>=_0xd6cdce[_0x108e('0xd8')]){this[_0x108e('0x1e')][_0xc75674[_0x108e('0xc7')]][_0x108e('0x54')]+=0x1;this['voiceQueues'][_0xc75674[_0x108e('0xc7')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x108e('0x1e')][_0xc75674[_0x108e('0xc7')]][_0x108e('0xd9')]+=0x1;_0x5c3e8a[_0x108e('0x73')]=0xa;_0x5c3e8a[_0x108e('0x74')]=_0x108e('0xda');_0x5c3e8a['dropreason']=_0x108e('0xdb');_0x5c3e8a[_0x108e('0xcf')]=this[_0x108e('0x1e')][_0xc75674['queue']]['dialQueueProject2']?moment()[_0x108e('0x91')](_0x108e('0xcb')):undefined;_0x5c3e8a[_0x108e('0xdc')]+=0x1;_0x5c3e8a['countglobal']+=0x1;_0x56f0e0=this[_0x108e('0x1e')][_0xc75674[_0x108e('0xc7')]][_0x108e('0xdd')];_0x5fa277=this[_0x108e('0x1e')][_0xc75674[_0x108e('0xc7')]][_0x108e('0xde')];hopperUtils[_0x108e('0xdf')](_0x5c3e8a,_0x5c3e8a['state'],_0xd6cdce['voiceQueue'])[_0x108e('0xa7')](function(_0xdd6a70){_0x4c7754=_0xdd6a70[_0x108e('0xe0')]==0x1;if(_0x5c3e8a['countdropretry']>=_0x2107bd[_0x108e('0x1e')][_0xc75674['queue']][_0x108e('0xe1')]){_0x2107bd[_0x108e('0xe2')](_0x5c3e8a,_0xdd6a70[_0x108e('0xe0')]);}else{hopperUtils[_0x108e('0xe3')]({'active':![],'countdropretry':_0x5c3e8a[_0x108e('0xdc')],'scheduledat':moment()[_0x108e('0xe4')](_0x2107bd[_0x108e('0x1e')][_0xc75674[_0x108e('0xc7')]]['dialDropRetryFrequency'],'minutes')[_0x108e('0x91')](_0x108e('0xcb')),'ContactId':_0xd6cdce[_0x108e('0xe5')],'ListId':_0xd6cdce[_0x108e('0xe6')],'VoiceQueueId':_0xd6cdce[_0x108e('0xe7')]||undefined,'CampaignId':_0xd6cdce[_0x108e('0xe8')]||undefined})['catch'](loggerCatch(_0x108e('0xe9')));var _0x528a90=new History(_0x5c3e8a);_0x528a90[_0x108e('0x73')]=0xa;_0x528a90[_0x108e('0x74')]=_0x108e('0xda');_0x528a90[_0x108e('0x76')]=moment()[_0x108e('0x91')](_0x108e('0xcb'));_0x528a90[_0x108e('0x75')]=_0x528a90[_0x108e('0x76')];_0x528a90['calleridname']=_0x5c3e8a['calleridname'];_0x528a90[_0x108e('0xea')]=_0x5c3e8a[_0x108e('0xea')];hopperUtils[_0x108e('0xeb')](_0x528a90)[_0x108e('0xaa')](loggerCatch(_0x108e('0xec')));}})[_0x108e('0xa7')](function(){if(_0x4c7754)hopperUtils['swapAdditionalPhones'](_0x5c3e8a,_0x56f0e0,_0x5fa277)[_0x108e('0xa7')](function(){return 0x1;});});}else{this['voiceQueues'][_0xc75674['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0xc75674[_0x108e('0xc7')]][_0x108e('0xed')]+=0x1;_0x5c3e8a['state']=0xb;_0x5c3e8a[_0x108e('0x74')]=_0x108e('0xee');_0x5c3e8a[_0x108e('0xef')]='CALLEREXIT';_0x5c3e8a[_0x108e('0xf0')]+=0x1;_0x5c3e8a[_0x108e('0xf1')]+=0x1;_0x56f0e0=this[_0x108e('0x1e')][_0xc75674[_0x108e('0xc7')]]['dialAbandonedRetryFrequency'];_0x5fa277=this['voiceQueues'][_0xc75674[_0x108e('0xc7')]][_0x108e('0xde')];hopperUtils[_0x108e('0xdf')](_0x5c3e8a,_0x5c3e8a['state'],_0xd6cdce[_0x108e('0xf2')])[_0x108e('0xa7')](function(_0x20bf3){if(_0x5c3e8a[_0x108e('0xf0')]>=_0x2107bd[_0x108e('0x1e')][_0xc75674[_0x108e('0xc7')]][_0x108e('0xf3')]){_0x2107bd['queueCallerAbandonCreateState'](_0x5c3e8a,_0x20bf3[_0x108e('0xe0')]);}else{hopperUtils[_0x108e('0xe3')]({'active':![],'countabandonedretry':_0x5c3e8a[_0x108e('0xf0')],'scheduledat':moment()[_0x108e('0xe4')](_0x2107bd[_0x108e('0x1e')][_0xc75674[_0x108e('0xc7')]][_0x108e('0xf4')],_0x108e('0xf5'))[_0x108e('0x91')](_0x108e('0xcb')),'ContactId':_0xd6cdce['ContactId'],'ListId':_0xd6cdce[_0x108e('0xe6')],'VoiceQueueId':_0xd6cdce[_0x108e('0xe7')]||undefined,'CampaignId':_0xd6cdce[_0x108e('0xe8')]||undefined})[_0x108e('0xaa')](loggerCatch(_0x108e('0xf6')));var _0x50a59b=new History(_0x5c3e8a);_0x50a59b['state']=0xb;_0x50a59b[_0x108e('0x74')]=_0x108e('0xee');_0x50a59b[_0x108e('0x76')]=moment()[_0x108e('0x91')](_0x108e('0xcb'));_0x50a59b[_0x108e('0x75')]=_0x50a59b['starttime'];_0x50a59b[_0x108e('0xf7')]=_0x5c3e8a['calleridname'];_0x50a59b[_0x108e('0xea')]=_0x5c3e8a['calleridnum'];hopperUtils[_0x108e('0xeb')](_0x50a59b)[_0x108e('0xaa')](loggerCatch(_0x108e('0xf8')));}})[_0x108e('0xa7')](function(){if(_0x4c7754)hopperUtils[_0x108e('0xf9')](_0x5c3e8a,_0x56f0e0,_0x5fa277)[_0x108e('0xa7')](function(){return 0x1;});});}}}};Dialer[_0x108e('0x8e')][_0x108e('0x38')]=function(_0x4ed666){if(this[_0x108e('0x24')][_0x4ed666[_0x108e('0xc8')]]){this[_0x108e('0x24')][_0x4ed666[_0x108e('0xc8')]][_0x108e('0xfa')]=_0x4ed666[_0x108e('0xfa')];}if(this[_0x108e('0x26')][_0x4ed666[_0x108e('0xc8')]]){this[_0x108e('0x26')][_0x4ed666[_0x108e('0xc8')]][_0x108e('0xfa')]=_0x4ed666[_0x108e('0xfa')];}};Dialer[_0x108e('0x8e')][_0x108e('0x3c')]=function(_0x30ced0){if(!this[_0x108e('0x24')][_0x30ced0[_0x108e('0xfb')]]){return;}var _0x553aa6=this[_0x108e('0x1e')][this[_0x108e('0x24')][_0x30ced0[_0x108e('0xfb')]][_0x108e('0xc7')]][_0x108e('0xfc')]||_0x108e('0xfd');if(_0x553aa6===_0x108e('0xfe')){if(this[_0x108e('0x24')][_0x30ced0[_0x108e('0xfb')]]&&_[_0x108e('0xff')](this[_0x108e('0x24')][_0x30ced0[_0x108e('0xfb')]][_0x108e('0x100')])&&_0x30ced0[_0x108e('0x93')]==='1'&&_0x30ced0[_0x108e('0x101')]==='0'){if(this['agents'][_0x30ced0[_0x108e('0x102')]]){if(!this[_0x108e('0x20')][_0x30ced0['stateinterface']]['locked']){this[_0x108e('0x20')][_0x30ced0[_0x108e('0x102')]][_0x108e('0x100')]=!![];this[_0x108e('0x24')][_0x30ced0[_0x108e('0xfb')]][_0x108e('0x100')]=!![];this[_0x108e('0x24')][_0x30ced0['actionid']][_0x108e('0x102')]=_0x30ced0[_0x108e('0x102')];}}}}else if(_0x553aa6===_0x108e('0xfd')){if(this['actions'][_0x30ced0[_0x108e('0xfb')]]){if(this[_0x108e('0x20')][_0x30ced0[_0x108e('0x102')]]){this[_0x108e('0x24')][_0x30ced0[_0x108e('0xfb')]][_0x108e('0x102')]=_0x30ced0['stateinterface'];if(_[_0x108e('0xff')](this[_0x108e('0x2b')][this[_0x108e('0x24')][_0x30ced0['actionid']][_0x108e('0xc7')]])){this[_0x108e('0x2b')][this[_0x108e('0x24')][_0x30ced0['actionid']][_0x108e('0xc7')]]=[];}this[_0x108e('0x2b')][this[_0x108e('0x24')][_0x30ced0[_0x108e('0xfb')]][_0x108e('0xc7')]][_0x108e('0xa1')](_['merge'](_[_0x108e('0x7b')](this[_0x108e('0x24')][_0x30ced0[_0x108e('0xfb')]],[_0x108e('0x103'),_0x108e('0x102')]),{'status':_0x30ced0['status'],'paused':_0x30ced0[_0x108e('0x101')]}));}}}};Dialer[_0x108e('0x8e')][_0x108e('0x3e')]=function(_0x54c886){if(!this[_0x108e('0x24')][_0x54c886['actionid']]){return;}var _0x41b7fb=this;var _0x146c52=this[_0x108e('0x1e')][this[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]][_0x108e('0xc7')]];var _0x3ad5ce=_0x146c52[_0x108e('0xfc')]||_0x108e('0xfd');if(_0x3ad5ce===_0x108e('0xfe')){if(this[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]]&&this[_0x108e('0x24')][_0x54c886['actionid']]['stateinterface']){this[_0x108e('0x1d')]['run'](this['actions'][_0x54c886['actionid']][_0x108e('0x103')],this[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]]['stateinterface'])[_0x108e('0xaa')](function(_0x2d15f5){logger[_0x108e('0x6b')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x108e('0x49')](_0x2d15f5,{'showHidden':![],'depth':null}));})[_0x108e('0x1b')](function(){utils['decrementOriginate'](_0x41b7fb[_0x108e('0x1e')][_0x41b7fb['actions'][_0x54c886[_0x108e('0xfb')]]['queue']],'[syncQueueStatusComplete]');_0x41b7fb[_0x108e('0x20')][_0x41b7fb[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]][_0x108e('0x102')]][_0x108e('0x100')]=![];delete _0x41b7fb['actions'][_0x54c886[_0x108e('0xfb')]];unlockQueueStatus(_0x146c52);});}else{utils['decrementOriginate'](this[_0x108e('0x1e')][this[_0x108e('0x24')][_0x54c886['actionid']][_0x108e('0xc7')]],'[syncQueueStatusComplete]');hopperUtils[_0x108e('0xe3')]({'active':![],'ContactId':this[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]][_0x108e('0xe5')],'ListId':this[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]]['ListId'],'VoiceQueueId':this[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x108e('0x24')][_0x54c886['actionid']][_0x108e('0xe8')]||undefined})[_0x108e('0xaa')](loggerCatch(_0x108e('0x104')));delete this[_0x108e('0x24')][_0x54c886['actionid']];unlockQueueStatus(_0x146c52);}}else if(_0x3ad5ce===_0x108e('0xfd')){var _0x5dbef6;if(this[_0x108e('0x24')][_0x54c886['actionid']]&&!_[_0x108e('0x7f')](this[_0x108e('0x2b')][this[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]]['queue']])){if(this[_0x108e('0x105')][_0x41b7fb['actions'][_0x54c886[_0x108e('0xfb')]][_0x108e('0xc7')]]){this['queueBookedRR'][_0x41b7fb[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]][_0x108e('0xc7')]]=this[_0x108e('0x105')][this[_0x108e('0x24')][_0x54c886['actionid']][_0x108e('0xc7')]]?this[_0x108e('0x105')][this['actions'][_0x54c886['actionid']]['queue']]:this[_0x108e('0x2b')][this['actions'][_0x54c886[_0x108e('0xfb')]][_0x108e('0xc7')]]?this[_0x108e('0x2b')][this['actions'][_0x54c886[_0x108e('0xfb')]]['queue']]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]]['queue']]['_rr']=this[_0x108e('0x105')][this[_0x108e('0x24')][_0x54c886[_0x108e('0xfb')]][_0x108e('0xc7')]];for(var _0x5baa33=0x0;_0x5baa33=_0x266af2[_0x108e('0x130')]){_0x27921c[_0x108e('0x131')](_0x21f75f,_0xdc7c88,_0x3b1248,'reason19\x20machine....');}else{if(_0x21f75f[_0x108e('0x129')]>=_0x266af2[_0x108e('0x132')]){_0x27921c[_0x108e('0x133')](_0x21f75f,_0xdc7c88,_0x3b1248,'reason\x2019\x20machine....');}else{hopperUtils[_0x108e('0xe3')]({'active':![],'countmachineretry':_0x21f75f[_0x108e('0x129')],'scheduledat':moment()[_0x108e('0xe4')](_0x266af2[_0x108e('0x134')],'minutes')[_0x108e('0x91')](_0x108e('0xcb')),'ContactId':_0x21f75f['ContactId'],'ListId':_0x21f75f[_0x108e('0xe6')],'VoiceQueueId':_0x21f75f[_0x108e('0xe7')]||undefined,'CampaignId':_0x21f75f[_0x108e('0xe8')]||undefined})[_0x108e('0xaa')](loggerCatch(_0x108e('0x135')));_0xdc7c88({'reschedule':0x1});}}});}if(_0x556fcd['type']===_0x108e('0xd4')&&this[_0x108e('0x1f')][_0x556fcd[_0x108e('0xc7')]][_0x108e('0x11c')]&&_0x1d71ec[_0x108e('0x11d')]===_0x108e('0x11e')){delete this[_0x108e('0x26')][_0x1d71ec[_0x108e('0xc8')]];utils['decrementOriginate'](this['campaigns'][_0x556fcd[_0x108e('0xc7')]],_0x108e('0x125'));_0x269fbf=new Hangup(_0x556fcd,_0x1d71ec);_0x269fbf[_0x108e('0x73')]=0x12;_0x269fbf['statedesc']=_0x108e('0x136');_0x269fbf[_0x108e('0x127')]=_0x108e('0x128');ami[_0x108e('0x44')](_0x108e('0x121'),ut[_0x108e('0x122')](_0x269fbf,_0x108e('0x12a')));this[_0x108e('0x137')](_0x269fbf,_0x108e('0x138'),_0x108e('0x139'));}if(_0x556fcd['type']===_0x108e('0xd4')&&this[_0x108e('0x1f')][_0x556fcd[_0x108e('0xc7')]]['dialAMDActive']&&_0x1d71ec[_0x108e('0x11d')]===_0x108e('0x124')){return new Promise(function(_0x3488bc,_0x3b8dc9){delete _0x27921c['uniqueId'][_0x1d71ec[_0x108e('0xc8')]];utils[_0x108e('0x10c')](_0x27921c['campaigns'][_0x556fcd[_0x108e('0xc7')]],'[syncVarSet]');_0x27921c[_0x108e('0x1f')][_0x556fcd[_0x108e('0xc7')]][_0x108e('0x11f')]+=0x1;_0x27921c[_0x108e('0x1f')][_0x556fcd[_0x108e('0xc7')]][_0x108e('0x120')]+=0x1;var _0x2ab57c=_0x27921c['campaigns'][_0x556fcd['queue']];var _0x25f2f3=new Hangup(_0x556fcd,_0x1d71ec);_0x25f2f3[_0x108e('0x73')]=0x13;_0x25f2f3['statedesc']=_0x108e('0x126');_0x25f2f3[_0x108e('0x127')]=_0x108e('0x128');_0x25f2f3[_0x108e('0x129')]+=0x1;_0x25f2f3['countglobal']+=0x1;_0x25f2f3[_0x108e('0x12a')]=!![];ami[_0x108e('0x44')](_0x108e('0x121'),ut[_0x108e('0x122')](_0x25f2f3,_0x108e('0x12a')));hopperUtils['createHistory'](_0x25f2f3)[_0x108e('0xaa')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x25f2f3[_0x108e('0x12b')]+_0x25f2f3[_0x108e('0x12c')]+_0x25f2f3[_0x108e('0x12d')]+_0x25f2f3['countnosuchnumberretry']+_0x25f2f3[_0x108e('0xdc')]+_0x25f2f3['countabandonedretry']+_0x25f2f3[_0x108e('0x129')]+_0x25f2f3[_0x108e('0x12f')]>=_0x2ab57c['dialGlobalMaxRetry']){_0x27921c['stateGlobal'](_0x25f2f3,_0x3488bc,_0x3b8dc9,'reason19\x20machine....');}else{if(_0x25f2f3[_0x108e('0x129')]>=_0x2ab57c[_0x108e('0x132')]){_0x27921c[_0x108e('0x133')](_0x25f2f3,_0x3488bc,_0x3b8dc9,_0x108e('0x13a'));}else{hopperUtils[_0x108e('0xe3')]({'active':![],'countmachineretry':_0x25f2f3['countmachineretry'],'scheduledat':moment()[_0x108e('0xe4')](_0x2ab57c[_0x108e('0x134')],_0x108e('0xf5'))[_0x108e('0x91')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x25f2f3[_0x108e('0xe5')],'ListId':_0x25f2f3['ListId'],'VoiceQueueId':_0x25f2f3[_0x108e('0xe7')]||undefined,'CampaignId':_0x25f2f3['CampaignId']||undefined})[_0x108e('0xaa')](loggerCatch('[rescheduleContact][Machine]'));_0x3488bc({'reschedule':0x1});}}});}}};Dialer[_0x108e('0x8e')]['syncHangup']=function(_0x3761b2){var _0x4d2db2=this[_0x108e('0x26')][_0x3761b2[_0x108e('0xc8')]];var _0x1c14da;if(!_0x4d2db2){return;}if(_0x4d2db2['type']===_0x108e('0xd4')){delete this[_0x108e('0x26')][_0x3761b2['uniqueid']];utils[_0x108e('0x10c')](this[_0x108e('0x1f')][_0x4d2db2[_0x108e('0xc7')]],_0x108e('0x13b'));this[_0x108e('0x1f')][_0x4d2db2[_0x108e('0xc7')]][_0x108e('0x13c')]+=0x1;if(_0x3761b2[_0x108e('0x13d')]===_0x108e('0x13e')){const _0x2d4f72=new AgentComplete(_0x4d2db2,_0x3761b2);_0x2d4f72[_0x108e('0xe8')]=this[_0x108e('0x1f')][_0x4d2db2[_0x108e('0xc7')]]['id'];hopperUtils['createHistory'](_0x2d4f72)[_0x108e('0xaa')](loggerCatch(_0x108e('0x13f')));hopperUtils['moveContactManagedDialer'](_0x2d4f72)[_0x108e('0xaa')](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x1c14da=new Hangup(_0x4d2db2,_0x3761b2);hopperUtils[_0x108e('0xeb')](_0x1c14da)[_0x108e('0xaa')](loggerCatch(_0x108e('0x140')));hopperUtils[_0x108e('0xd2')](_0x1c14da)[_0x108e('0xaa')](loggerCatch(_0x108e('0x141')));}}else{if(isNotNull(this[_0x108e('0x1e')][_0x4d2db2[_0x108e('0xc7')]][_0x108e('0x142')])){delete this[_0x108e('0x26')][_0x3761b2[_0x108e('0xc8')]];utils[_0x108e('0x10c')](this['voiceQueues'][_0x4d2db2[_0x108e('0xc7')]],_0x108e('0x13b'));this[_0x108e('0x1e')][_0x4d2db2['queue']][_0x108e('0x11f')]+=0x1;this[_0x108e('0x1e')][_0x4d2db2[_0x108e('0xc7')]][_0x108e('0x120')]+=0x1;_0x1c14da=new Hangup(_0x4d2db2,_0x3761b2);_0x1c14da[_0x108e('0x73')]=0x10;_0x1c14da[_0x108e('0x74')]=_0x108e('0x143');_0x1c14da[_0x108e('0x127')]=_0x108e('0x144');hopperUtils[_0x108e('0xeb')](_0x1c14da)['catch'](loggerCatch(_0x108e('0x140')));hopperUtils[_0x108e('0xd2')](_0x1c14da)[_0x108e('0xaa')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0x108e('0x26')][_0x3761b2['uniqueid']];utils[_0x108e('0x10c')](this[_0x108e('0x1e')][_0x4d2db2[_0x108e('0xc7')]],'[syncHangup2]');if(_0x3761b2[_0x108e('0x13d')]===_0x108e('0x13e')){this[_0x108e('0x1e')][_0x4d2db2[_0x108e('0xc7')]][_0x108e('0x11f')]+=0x1;const _0x5deb20=new AgentComplete(_0x4d2db2,_0x3761b2);_0x5deb20[_0x108e('0xe7')]=this[_0x108e('0x1e')][_0x4d2db2['queue']]['id'];hopperUtils[_0x108e('0xeb')](_0x5deb20)['catch'](loggerCatch(_0x108e('0x145')));hopperUtils[_0x108e('0xd2')](_0x5deb20)[_0x108e('0xaa')](loggerCatch(_0x108e('0xd3')));}else{this['voiceQueues'][_0x4d2db2[_0x108e('0xc7')]][_0x108e('0x146')]+=0x1;_0x1c14da=new Hangup(_0x4d2db2,_0x3761b2);_0x1c14da[_0x108e('0x73')]=0xc;_0x1c14da[_0x108e('0x74')]=_0x3761b2[_0x108e('0x13d')];_0x1c14da[_0x108e('0x127')]=_0x108e('0x147');hopperUtils[_0x108e('0xeb')](_0x1c14da)[_0x108e('0xaa')](loggerCatch('[syncHangup][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x1c14da)[_0x108e('0xaa')](loggerCatch('[syncHangup]'));}}}};Dialer[_0x108e('0x8e')]['syncQueueSummary']=function(_0x5e5590){var _0x19d47=this;if(!_0x19d47[_0x108e('0x2c')][_0x5e5590[_0x108e('0x4b')]]){_0x19d47[_0x108e('0x2c')][_0x5e5590[_0x108e('0x4b')]]={'running':![]};}else if(_0x19d47[_0x108e('0x2c')][_0x5e5590['name']][_0x108e('0x148')]===!![]){return;}else if(_0x19d47[_0x108e('0x2c')][_0x5e5590[_0x108e('0x4b')]]['running']===![]){_0x19d47[_0x108e('0x2c')][_0x5e5590[_0x108e('0x4b')]][_0x108e('0x148')]=!![];}var _0x2e9bb2=_0x19d47[_0x108e('0x1e')][_0x5e5590[_0x108e('0x4b')]];var _0x294a02=_0x2e9bb2[_0x108e('0x6e')]!==utils[_0x108e('0x6f')]['INACTIVE'];var _0x34b138=utils[_0x108e('0x149')](_0x2e9bb2);_0x2e9bb2['statusMessage']=utils[_0x108e('0x14a')](_0x2e9bb2,_0x19d47[_0x108e('0x21')]);Promise[_0x108e('0xb2')]()['then'](function(){if(_0x2e9bb2[_0x108e('0x14b')]===utils['CAMPAIGN_STATUS'][_0x108e('0x82')]){if(_0x294a02){clearPredictiveAttributes(_0x2e9bb2);_0x5e5590[_0x108e('0x28')]=undefined;_0x5e5590[_0x108e('0x29')]=undefined;}if(_0x2e9bb2['statusMessage']===utils[_0x108e('0x6f')][_0x108e('0x82')]){_0x5e5590['available']=0x0;_0x5e5590[_0x108e('0x101')]=0x0;_0x5e5590['inUse']=0x0;_0x5e5590[_0x108e('0x14c')]=0x0;_0x5e5590[_0x108e('0x14d')]=0x0;}}else if(_0x2e9bb2[_0x108e('0x14b')]===utils[_0x108e('0x6f')][_0x108e('0x14e')]&&!_0x34b138){return _0x19d47[_0x108e('0x9c')](_0x2e9bb2,!![])[_0x108e('0xa7')](function(){return _0x19d47[_0x108e('0x9c')](_0x2e9bb2,![]);})[_0x108e('0xa7')](function(){return _0x19d47[_0x108e('0xb7')](_0x2e9bb2);})[_0x108e('0xaa')](function(_0x331762){loggerSyncQueueSummary[_0x108e('0x47')]('[syncQueueSummary]',util['inspect'](_0x331762,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2e9bb2);});}else{clearPredictiveAttributes(_0x2e9bb2);}})['then'](function(){var _0xf44f49=_0x5e5590[_0x108e('0x14f')](_0x2e9bb2);if(_0xf44f49||_0x2e9bb2[_0x108e('0x150')]){_0x2e9bb2[_0x108e('0x150')]=![];_0x5e5590[_0x108e('0x151')](_0x2e9bb2);Object[_0x108e('0x152')](_0x2e9bb2,_0x5e5590);emitOutboundVoiceQueueSummary(_0x5e5590);}_0x19d47['queuesSummary'][_0x2e9bb2[_0x108e('0x4b')]][_0x108e('0x148')]=![];})['catch'](function(_0x201b5b){logger[_0x108e('0x6b')]('[syncQueueSummary]',util[_0x108e('0x49')](_0x201b5b,{'showHidden':![],'depth':null}));_0x19d47[_0x108e('0x2c')][_0x2e9bb2['name']]['running']=![];});};Dialer[_0x108e('0x8e')][_0x108e('0x34')]=_[_0x108e('0x153')](function(){var _0x4a7f7b=_[_0x108e('0x154')](this['voiceQueues'],function(_0xb2e3db){return _0xb2e3db[_0x108e('0x155')];});var _0x3ee648=_['filter'](this[_0x108e('0x20')],function(_0xae262){return _0xae262[_0x108e('0x156')]&&_0xae262[_0x108e('0x93')]===_0x108e('0x94');});if(_0x4a7f7b[_0x108e('0x106')]>0x0&&_0x3ee648[_0x108e('0x106')]>0x0){return Promise[_0x108e('0xb2')]()[_0x108e('0xa7')](cmHopper['handlePreviewRecallNotifications'](_[_0x108e('0x157')](_0x4a7f7b,'id'),previewRecallmeReminderInterval,_['map'](_0x3ee648,'id')))[_0x108e('0xa7')](function(_0x2a9c72){for(var _0x1f7b84=0x0;_0x1f7b84<_0x2a9c72[_0x108e('0x106')];_0x1f7b84++){var _0xb0bb82=_0x2a9c72[_0x1f7b84][_0x108e('0x158')][_0x108e('0x4b')];if(_0xb0bb82)io['to'](util['format'](_0x108e('0x159'),_0xb0bb82))[_0x108e('0x44')]('user:dialPreviewRecallReminder',{'hopper':_0x2a9c72[_0x1f7b84]});}})[_0x108e('0xaa')](function(_0x224869){logger[_0x108e('0x6b')](_0x108e('0x15a'),_0x224869);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x108e('0x8e')][_0x108e('0x40')]=function(){var _0x378b1d=this;setInterval(function(){_0x378b1d[_0x108e('0x15b')](_0x378b1d['uniqueId'],_0x108e('0x15c'));_0x378b1d[_0x108e('0x15b')](_0x378b1d[_0x108e('0x24')],_0x108e('0x15d'));},0x32c8);};Dialer[_0x108e('0x8e')][_0x108e('0x15b')]=function(_0x22c8f2,_0x585360){var _0x547357=this;for(var _0x4e48aa in _0x22c8f2){if(typeof _0x22c8f2[_0x4e48aa]!==_0x108e('0x15e')){this[_0x108e('0x1c')]['enqueue'](function(){if(!_['isNil'](_0x22c8f2[_0x4e48aa])){return ami['Action']({'action':_0x108e('0x93'),'channel':_0x22c8f2[_0x4e48aa][_0x108e('0xfa')]})[_0x108e('0xaa')](function(_0x175608){if(_0x175608['message']===_0x108e('0x15f')){setTimeout(function(){if(_0x22c8f2[_0x4e48aa]&&_0x22c8f2[_0x4e48aa]['type']!==_0x108e('0xd4')){utils[_0x108e('0x10c')](_0x547357['voiceQueues'][_0x22c8f2[_0x4e48aa][_0x108e('0xc7')]],'[clearZombieChannels]');logger[_0x108e('0x6b')](_0x108e('0x160'),_0x585360,_0x4e48aa,_0x22c8f2[_0x4e48aa]['queue']);delete _0x22c8f2[_0x4e48aa];}if(_0x22c8f2[_0x4e48aa]&&_0x22c8f2[_0x4e48aa][_0x108e('0x45')]===_0x108e('0xd4')){utils['decrementOriginate'](_0x547357[_0x108e('0x1f')][_0x22c8f2[_0x4e48aa]['queue']],'[clearZombieChannels]');logger[_0x108e('0x6b')](_0x108e('0x161'),_0x585360,_0x4e48aa,_0x22c8f2[_0x4e48aa][_0x108e('0xc7')]);delete _0x22c8f2[_0x4e48aa];}},0x2328);}});}});}}};Dialer['prototype'][_0x108e('0x162')]=function(_0xb2ebf7){return Promise[_0x108e('0xb2')]()[_0x108e('0xa7')](voiceQueueRt['getVoiceQueueRtPauses'](_0xb2ebf7))[_0x108e('0xaa')](loggerCatch(_0x108e('0x163')));};Dialer[_0x108e('0x8e')][_0x108e('0x164')]=function(_0x25f0d9,_0x557324,_0x1dfce5){var _0x54e199={'state':0x19,'statedesc':_0x108e('0x165')};utils[_0x108e('0x10c')](_0x557324,_0x108e('0x166')+_0x25f0d9);this[_0x108e('0x137')](_[_0x108e('0x66')](_0x54e199,_[_0x108e('0x7b')](_0x1dfce5,[_0x108e('0xe5'),_0x108e('0xe6'),_0x108e('0x167'),_0x108e('0xe7'),_0x108e('0xe8')])),_0x108e('0x168'),_0x108e('0x166'));logger['error'](_0x25f0d9);};Dialer['prototype']['saveInDb']=function(_0x1c101c,_0x1fa6ea,_0x58bad4){hopperUtils['createHistory'](_0x1c101c)['catch'](loggerCatch(_0x1fa6ea));hopperUtils[_0x108e('0xd2')](_0x1c101c)[_0x108e('0xaa')](loggerCatch(_0x58bad4));};Dialer['prototype'][_0x108e('0xe2')]=function(_0x4205fe,_0x4df608){hopperUtils['createHistory'](_0x4205fe)[_0x108e('0xaa')](loggerCatch(_0x108e('0x145')));if(_0x4df608==0x0){hopperUtils[_0x108e('0xd2')](_0x4205fe)[_0x108e('0xaa')](loggerCatch(_0x108e('0x169')));}};Dialer[_0x108e('0x8e')]['checkPreviewRecallReminder']=function(_0x3092dd){return Promise['resolve']()[_0x108e('0xa7')](cmHopper[_0x108e('0x16a')](_0x3092dd['id'],previewRecallmeReminderInterval))[_0x108e('0xa7')](function(_0x27c513){for(var _0x2ab994=0x0;_0x2ab994<_0x27c513['length'];_0x2ab994++){var _0x496e45=_0x27c513[_0x2ab994][_0x108e('0x158')]['name'];if(_0x496e45)io['to'](util['format'](_0x108e('0x159'),_0x496e45))['emit'](_0x108e('0x16b'),{'hopper':_0x27c513[_0x2ab994]});}})[_0x108e('0xaa')](function(){});};Dialer[_0x108e('0x8e')][_0x108e('0x16c')]=function(_0xe6a2c7){var _0x713bc7=this;return function(){_0x713bc7['handleIvr'](_0xe6a2c7);};};Dialer['prototype'][_0x108e('0x16d')]=function(_0x550597,_0x1c305b){var _0x2c5c4a=this;var _0x4044a1=uuid['v4']();this[_0x108e('0x24')][_0x4044a1]=new Action(_0x550597,_0x1c305b,_0x4044a1);return new Promise(function(_0x8cac7d,_0x452b5b){if(_[_0x108e('0x43')](_0x550597)&&typeof _0x550597!=='object'){return _0x452b5b(msgResponse(_0x108e('0x16e'),'Failure',_0x108e('0x16f')));}if(_['isUndefined'](_0x1c305b[_0x108e('0x170')])||_0x1c305b['phone']===null){return _0x452b5b(msgResponse(_0x108e('0x16e'),'Failure',_0x108e('0x171')));}var _0x391a53={'XMD-CALLERID':_0x2c5c4a['actions'][_0x4044a1][_0x108e('0x172')](),'XMD-AGI':_0x550597[_0x108e('0x142')]?util['format'](_0x108e('0x173'),ipAgi,_0x550597[_0x108e('0x142')]):_0x108e('0x174'),'XMD-AGIAFTER':_0x550597[_0x108e('0xd0')]?util['format'](_0x108e('0x173'),ipAgi,_0x550597[_0x108e('0xd0')]):_0x108e('0x174'),'XMD-QUEUE':utils['isOutboundQueue'](_0x550597)?util[_0x108e('0x91')](_0x108e('0x175'),_0x550597['name'],_0x550597[_0x108e('0x176')]||'',_0x550597[_0x108e('0xd1')]?'c':'',_0x550597[_0x108e('0xd8')]||0x3):_0x108e('0x174'),'XMD-CONTACTID':_0x1c305b['ContactId'],'XMD-CDRTYPE':_0x108e('0x8'),'CALLERID(all)':_0x2c5c4a['actions'][_0x4044a1][_0x108e('0x172')](),'XMD-AMD':_0x550597[_0x108e('0x11c')]?_0x108e('0x14e'):_0x108e('0x174'),'XMD-DESTINATION':_0x108e('0x177')};if(_0x550597[_0x108e('0x11c')]){_0x391a53['XMD-AMDINITIALSILENCE']=_0x550597[_0x108e('0x178')]||0x9c4;_0x391a53['XMD-AMDGREETING']=_0x550597[_0x108e('0x179')]||0x5dc;_0x391a53[_0x108e('0x17a')]=_0x550597['dialAMDAfterGreetingSilence']||0x320;_0x391a53[_0x108e('0x17b')]=_0x550597[_0x108e('0x17c')]||0x1388;_0x391a53[_0x108e('0x17d')]=_0x550597[_0x108e('0x17e')]||0x64;_0x391a53[_0x108e('0x17f')]=_0x550597[_0x108e('0x180')]||0x32;_0x391a53[_0x108e('0x181')]=_0x550597['dialAMDMaximumNumberOfWords']||0x3;_0x391a53['XMD-AMDSILENCETHRESHOLD']=_0x550597[_0x108e('0x182')]||0x100;_0x391a53[_0x108e('0x183')]=_0x550597[_0x108e('0x184')]||0x1388;}if(utils[_0x108e('0x185')](_0x550597)){_0x391a53[_0x108e('0x186')]=_0x1c305b[_0x108e('0xe7')];}else{_0x391a53[_0x108e('0x187')]=_0x1c305b[_0x108e('0xe8')];}var _0x21934f=utils[_0x108e('0x188')](_0x1c305b['Contact']);Object[_0x108e('0x152')](_0x391a53,_0x21934f);var _0x9ab674=_0x2c5c4a[_0x108e('0x8f')](_0x550597['Trunk'])?utils[_0x108e('0x189')](_0x550597[_0x108e('0x97')]['callerid'],_0x550597['dialOriginateCallerIdName'],_0x550597[_0x108e('0x18a')]>0x0?utils[_0x108e('0x18b')](_0x550597['dialOriginateCallerIdNumber'],_0x550597[_0x108e('0x18a')]):_0x550597['dialOriginateCallerIdNumber']):utils[_0x108e('0x189')](_[_0x108e('0xff')](_0x550597['TrunkBackup'])?_0x550597[_0x108e('0x97')][_0x108e('0x18c')]:_0x550597[_0x108e('0x98')][_0x108e('0x18c')],_0x550597[_0x108e('0x18d')],_0x550597[_0x108e('0x18a')]>0x0?utils[_0x108e('0x18b')](_0x550597['dialOriginateCallerIdNumber'],_0x550597[_0x108e('0x18a')]):_0x550597[_0x108e('0x18e')]);if(_0x9ab674){_0x391a53[_0x108e('0x18f')]=_0x2c5c4a[_0x108e('0x24')][_0x4044a1][_0x108e('0x190')]=utils[_0x108e('0x191')](_0x9ab674);_0x391a53[_0x108e('0x192')]=_0x1c305b[_0x108e('0x170')];}_0x550597[_0x108e('0x193')]=_0x391a53;return ami[_0x108e('0xa2')]({'actionid':_0x4044a1,'action':_0x108e('0x16e'),'channel':_0x2c5c4a[_0x108e('0x8f')](_0x550597['Trunk'])?util['format'](_0x108e('0x194'),_0x550597[_0x108e('0x97')][_0x108e('0x4b')],isNotNull(_0x550597[_0x108e('0x195')])?_0x550597[_0x108e('0x195')]['trim']()||'':'',_0x550597[_0x108e('0x196')]>0x0?_0x1c305b[_0x108e('0x170')][_0x108e('0x197')](_0x550597[_0x108e('0x196')]):_0x1c305b[_0x108e('0x170')]):util[_0x108e('0x91')](_0x108e('0x194'),_[_0x108e('0xff')](_0x550597[_0x108e('0x98')])?_0x550597[_0x108e('0x97')]['name']:_0x550597['TrunkBackup'][_0x108e('0x4b')],isNotNull(_0x550597[_0x108e('0x195')])?_0x550597[_0x108e('0x195')][_0x108e('0x198')]()||'':'',_0x550597[_0x108e('0x196')]>0x0?_0x1c305b[_0x108e('0x170')]['substring'](_0x550597[_0x108e('0x196')]):_0x1c305b[_0x108e('0x170')]),'callerid':_0x9ab674,'Exten':'xcally-motion-dialer','Context':_0x108e('0x199'),'Priority':'1','variable':_0x391a53,'timeout':(_0x550597[_0x108e('0x19a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4044a1})[_0x108e('0xa7')](function(_0x2f1c28){return _0x8cac7d(_0x2f1c28);})[_0x108e('0xaa')](function(_0x34fb29){_0x550597['outboundOriginateFailureCallsDay']+=0x1;var _0x266c73=new History(_0x2c5c4a[_0x108e('0x24')][_0x4044a1]);logger[_0x108e('0x6b')](util['format'](_0x108e('0x19b'),JSON[_0x108e('0x7a')](_0x34fb29)));_0x266c73[_0x108e('0x73')]=0xe;_0x266c73[_0x108e('0x74')]=_0x108e('0x19c');_0x266c73[_0x108e('0x76')]=moment()[_0x108e('0x91')](_0x108e('0xcb'));_0x266c73['endtime']=_0x266c73[_0x108e('0x76')];hopperUtils[_0x108e('0xeb')](_0x266c73)[_0x108e('0xaa')](loggerCatch(_0x108e('0x19d')));_0x2c5c4a[_0x108e('0xd2')](_0x266c73)[_0x108e('0xaa')](loggerCatch(_0x108e('0x19d')))[_0x108e('0x1b')](function(){delete _0x2c5c4a[_0x108e('0x24')][_0x4044a1];return _0x452b5b(msgResponse('originate',_0x108e('0x8d'),_0x108e('0x19e')));});});});};Dialer[_0x108e('0x8e')][_0x108e('0x19f')]=function(_0x32f5ae,_0x517071,_0xe9e8f9){var _0x110dc4=new History(_0x517071);if(_0x110dc4['countbusyretry']+_0x110dc4[_0x108e('0x12c')]+_0x110dc4['countnoanswerretry']+_0x110dc4[_0x108e('0x12e')]+_0x110dc4[_0x108e('0xdc')]+_0x110dc4[_0x108e('0xf0')]+_0x110dc4[_0x108e('0x129')]+_0x110dc4[_0x108e('0x12f')]>=_0xe9e8f9[_0x108e('0x130')]-0x1){return!![];}switch(_0x32f5ae){case 0x3:if(_0x110dc4['countnoanswerretry']>=_0xe9e8f9[_0x108e('0x1a0')]-0x1){return!![];}hopperUtils[_0x108e('0xe3')]({'active':![],'countnoanswerretry':_0x110dc4[_0x108e('0x12d')]+=0x1,'scheduledat':moment()[_0x108e('0xe4')](_0xe9e8f9[_0x108e('0x1a1')],_0x108e('0xf5'))['format'](_0x108e('0xcb')),'ContactId':_0x110dc4[_0x108e('0xe5')],'ListId':_0x110dc4['ListId'],'VoiceQueueId':_0x110dc4['VoiceQueueId']||undefined,'CampaignId':_0x110dc4['CampaignId']||undefined})[_0x108e('0xaa')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x110dc4[_0x108e('0x12b')]>=_0xe9e8f9['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x110dc4[_0x108e('0x12b')]+=0x1,'scheduledat':moment()[_0x108e('0xe4')](_0xe9e8f9['dialBusyRetryFrequency'],'minutes')[_0x108e('0x91')](_0x108e('0xcb')),'ContactId':_0x110dc4[_0x108e('0xe5')],'ListId':_0x110dc4[_0x108e('0xe6')],'VoiceQueueId':_0x110dc4[_0x108e('0xe7')]||undefined,'CampaignId':_0x110dc4[_0x108e('0xe8')]||undefined})[_0x108e('0xaa')](loggerCatch(_0x108e('0x1a2')));break;case 0x8:if(_0x110dc4[_0x108e('0x12c')]>=_0xe9e8f9[_0x108e('0x1a3')]-0x1){return!![];}hopperUtils[_0x108e('0xe3')]({'active':![],'countcongestionretry':_0x110dc4['countcongestionretry']+=0x1,'scheduledat':moment()[_0x108e('0xe4')](_0xe9e8f9[_0x108e('0x1a4')],_0x108e('0xf5'))[_0x108e('0x91')](_0x108e('0xcb')),'ContactId':_0x110dc4[_0x108e('0xe5')],'ListId':_0x110dc4[_0x108e('0xe6')],'VoiceQueueId':_0x110dc4[_0x108e('0xe7')]||undefined,'CampaignId':_0x110dc4['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x110dc4[_0x108e('0x12e')]>=_0xe9e8f9[_0x108e('0x1a5')]-0x1){return!![];}else{hopperUtils[_0x108e('0xe3')]({'active':![],'countnosuchnumberretry':_0x110dc4[_0x108e('0x12e')]+=0x1,'scheduledat':moment()[_0x108e('0xe4')](_0xe9e8f9[_0x108e('0x1a6')],_0x108e('0xf5'))[_0x108e('0x91')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x110dc4['ContactId'],'ListId':_0x110dc4['ListId'],'VoiceQueueId':_0x110dc4['VoiceQueueId']||undefined,'CampaignId':_0x110dc4['CampaignId']||undefined})[_0x108e('0xaa')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x110dc4['countdropretry']>=_0xe9e8f9[_0x108e('0xe1')]-0x1){return!![];}hopperUtils[_0x108e('0xe3')]({'active':![],'countdropretry':_0x110dc4[_0x108e('0xdc')]+=0x1,'scheduledat':moment()[_0x108e('0xe4')](_0xe9e8f9[_0x108e('0xdd')],_0x108e('0xf5'))[_0x108e('0x91')](_0x108e('0xcb')),'ContactId':_0x110dc4[_0x108e('0xe5')],'ListId':_0x110dc4[_0x108e('0xe6')],'VoiceQueueId':_0x110dc4[_0x108e('0xe7')]||undefined,'CampaignId':_0x110dc4[_0x108e('0xe8')]||undefined})[_0x108e('0xaa')](loggerCatch(_0x108e('0xe9')));break;case 0xb:if(_0x110dc4[_0x108e('0xf0')]>=_0xe9e8f9[_0x108e('0xf3')]-0x1){return!![];}hopperUtils[_0x108e('0xe3')]({'active':![],'countabandonedretry':_0x110dc4[_0x108e('0xf0')]+=0x1,'scheduledat':moment()['add'](_0xe9e8f9['dialAbandonedRetryFrequency'],_0x108e('0xf5'))[_0x108e('0x91')](_0x108e('0xcb')),'ContactId':_0x110dc4[_0x108e('0xe5')],'ListId':_0x110dc4[_0x108e('0xe6')],'VoiceQueueId':_0x110dc4['VoiceQueueId']||undefined,'CampaignId':_0x110dc4[_0x108e('0xe8')]||undefined})[_0x108e('0xaa')](loggerCatch(_0x108e('0xf6')));break;case 0x13:if(_0x110dc4[_0x108e('0x129')]>=_0xe9e8f9[_0x108e('0x132')]-0x1){return!![];}hopperUtils[_0x108e('0xe3')]({'active':![],'countmachineretry':_0x110dc4[_0x108e('0x129')]+=0x1,'scheduledat':moment()[_0x108e('0xe4')](_0xe9e8f9[_0x108e('0x134')],_0x108e('0xf5'))[_0x108e('0x91')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x110dc4['ContactId'],'ListId':_0x110dc4[_0x108e('0xe6')],'VoiceQueueId':_0x110dc4[_0x108e('0xe7')]||undefined,'CampaignId':_0x110dc4[_0x108e('0xe8')]||undefined})[_0x108e('0xaa')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x110dc4[_0x108e('0x12f')]>=_0xe9e8f9[_0x108e('0x1a7')]-0x1){return!![];}hopperUtils[_0x108e('0xe3')]({'active':![],'countagentrejectretry':_0x110dc4['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0xe9e8f9[_0x108e('0x1a8')],'minutes')['format'](_0x108e('0xcb')),'ContactId':_0x110dc4[_0x108e('0xe5')],'ListId':_0x110dc4['ListId'],'VoiceQueueId':_0x110dc4[_0x108e('0xe7')]||undefined,'CampaignId':_0x110dc4['CampaignId']||undefined})[_0x108e('0xaa')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x108e('0x8e')][_0x108e('0x117')]=function(_0x1cfe3e,_0x3fb42b,_0x1342ce){var _0xd7810a=this;var _0x107629=new History(_0x1cfe3e);var _0x3279cf=![];var _0x2f092d;var _0x45ae4a;return new Promise(function(_0x2094e0,_0x4c9624){if(_[_0x108e('0x43')](_0x3fb42b)&&typeof _0x3fb42b!=='object'){return _0x4c9624(msgResponse('[callProgressDetecting]','Failure',_0x108e('0x1a9')));}if(_[_0x108e('0x43')](_0x1342ce)&&typeof _0x1342ce!==_0x108e('0x1aa')){return _0x4c9624(msgResponse('[callProgressDetecting]','Failure','evt\x20is\x20undefine'));}hopperUtils[_0x108e('0xdf')](_0x107629,_0x1342ce[_0x108e('0xcd')],_0x3fb42b)[_0x108e('0xa7')](function(_0x224a1d){if(_0x224a1d[_0x108e('0xe0')]==0x1)_0x3279cf=!![];switch(_0x1342ce[_0x108e('0xcd')]){case'0':_0x3fb42b[_0x108e('0x1ab')]+=0x1;_0x107629[_0x108e('0x73')]=0x0;_0x107629[_0x108e('0x74')]='NoSuchNumber';_0x107629[_0x108e('0x12e')]+=0x1;_0x107629[_0x108e('0xf1')]+=0x1;ami[_0x108e('0x44')](_0x108e('0x1ac'),ut['buildObj'](_0x1cfe3e,'nosuchnumber'));_0x2f092d=_0x3fb42b[_0x108e('0x1a6')];_0x45ae4a=_0x3fb42b['callAdditionalPhoneAfterMin'];hopperUtils[_0x108e('0xeb')](_0x107629)[_0x108e('0xaa')](loggerCatch(_0x108e('0x1ad')));if(_0xd7810a[_0x108e('0x19f')](0x0,_0x1cfe3e,_0x3fb42b)&&!_0x3279cf){if(_0x107629[_0x108e('0x12e')]>=_0x3fb42b['dialNoSuchNumberMaxRetry']){_0xd7810a[_0x108e('0x133')](_0x107629,_0x2094e0,_0x4c9624,_0x108e('0x1ae'));}else{_0xd7810a[_0x108e('0x131')](_0x107629,_0x2094e0,_0x4c9624,_0x108e('0x1ae'));}}break;case'3':_0x3fb42b[_0x108e('0x1af')]+=0x1;_0x107629[_0x108e('0x73')]=0x3;_0x107629['statedesc']=_0x108e('0x1b0');_0x107629[_0x108e('0x12d')]+=0x1;_0x107629[_0x108e('0xf1')]+=0x1;var _0xf21940=ut[_0x108e('0x1b1')](_0x1cfe3e,_0x3fb42b);ami[_0x108e('0x44')](_0x108e('0x1b2'),_0xf21940);_0x2f092d=_0x3fb42b[_0x108e('0x1a1')];_0x45ae4a=_0x3fb42b[_0x108e('0xde')];hopperUtils[_0x108e('0xeb')](_0x107629)[_0x108e('0xaa')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0xd7810a['checkRetriveMax'](0x3,_0x1cfe3e,_0x3fb42b)&&!_0x3279cf){if(_0x107629[_0x108e('0x12d')]>=_0x3fb42b['dialNoAnswerMaxRetry']){_0xd7810a['createStateFinal'](_0x107629,_0x2094e0,_0x4c9624,'reason\x203\x20ringing\x20no\x20answer');}else{_0xd7810a[_0x108e('0x131')](_0x107629,_0x2094e0,_0x4c9624,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3fb42b[_0x108e('0x1b3')]+=0x1;_0x107629[_0x108e('0x73')]=0x5;_0x107629[_0x108e('0x74')]=_0x108e('0x1b4');_0x107629[_0x108e('0x12b')]+=0x1;_0x107629['countglobal']+=0x1;ami[_0x108e('0x44')]('custom:agentbusy',ut['buildObj'](_0x1cfe3e,_0x108e('0x1b5')));_0x2f092d=_0x3fb42b[_0x108e('0x1b6')];_0x45ae4a=_0x3fb42b[_0x108e('0xde')];hopperUtils[_0x108e('0xeb')](_0x107629)[_0x108e('0xaa')](loggerCatch(_0x108e('0x1b7')));if(_0xd7810a[_0x108e('0x19f')](0x5,_0x1cfe3e,_0x3fb42b)&&!_0x3279cf){if(_0x107629[_0x108e('0x12b')]>=_0x3fb42b[_0x108e('0x1b8')]){_0xd7810a[_0x108e('0x133')](_0x107629,_0x2094e0,_0x4c9624,_0x108e('0x1b9'));}else{_0xd7810a[_0x108e('0x131')](_0x107629,_0x2094e0,_0x4c9624,_0x108e('0x1b9'));}}break;case'8':_0x3fb42b[_0x108e('0x1ba')]+=0x1;_0x107629[_0x108e('0x73')]=0x8;_0x107629[_0x108e('0x74')]=_0x108e('0x1bb');_0x107629[_0x108e('0x12c')]+=0x1;_0x107629['countglobal']+=0x1;_0x2f092d=_0x3fb42b['dialCongestionRetryFrequency'];_0x45ae4a=_0x3fb42b[_0x108e('0xde')];ami['emit'](_0x108e('0x1bc'),ut['buildObj'](_0x1cfe3e,_0x108e('0x1bd')));hopperUtils[_0x108e('0xeb')](_0x107629)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0xd7810a['checkRetriveMax'](0x8,_0x1cfe3e,_0x3fb42b)&&!_0x3279cf){if(_0x107629[_0x108e('0x12c')]>=_0x3fb42b[_0x108e('0x1a3')]){_0xd7810a[_0x108e('0x133')](_0x107629,_0x2094e0,_0x4c9624,_0x108e('0x1be'));}else{_0xd7810a[_0x108e('0x131')](_0x107629,_0x2094e0,_0x4c9624,_0x108e('0x1be'));}}break;case'11':_0x3fb42b[_0x108e('0x1bf')]+=0x1;_0x107629[_0x108e('0x73')]=0xb;_0x107629['statedesc']=_0x108e('0xee');_0x107629[_0x108e('0xf0')]+=0x1;_0x107629['countglobal']+=0x1;_0x2f092d=_0x3fb42b[_0x108e('0xf4')];_0x45ae4a=_0x3fb42b['callAdditionalPhoneAfterMin'];hopperUtils[_0x108e('0xeb')](_0x107629)[_0x108e('0xaa')](loggerCatch(_0x108e('0xf8')));if(_0xd7810a[_0x108e('0x19f')](0xb,_0x1cfe3e,_0x3fb42b)&&!_0x3279cf){if(_0x107629[_0x108e('0xf0')]>=_0x3fb42b['dialAbandonedMaxRetry']){_0xd7810a['createStateFinal'](_0x107629,_0x2094e0,_0x4c9624,_0x108e('0x1c0'));}else{_0xd7810a[_0x108e('0x131')](_0x107629,_0x2094e0,_0x4c9624,'reason\x2011\x20abandoned');}}break;case'20':_0x3fb42b[_0x108e('0x1c1')]+=0x1;_0x107629[_0x108e('0x73')]=0x14;_0x107629[_0x108e('0x74')]=_0x108e('0x1c2');_0x107629[_0x108e('0x12f')]+=0x1;_0x107629['countglobal']+=0x1;_0x2f092d=_0x3fb42b[_0x108e('0x1a8')];_0x45ae4a=_0x3fb42b[_0x108e('0xde')];ami['emit']('custom:agentreject',ut[_0x108e('0x122')](_0x1cfe3e,'agentreject'));hopperUtils[_0x108e('0xeb')](_0x107629)[_0x108e('0xaa')](loggerCatch(_0x108e('0x1c3')));if(_0xd7810a[_0x108e('0x19f')](0x14,_0x1cfe3e,_0x3fb42b)&&!_0x3279cf){if(_0x107629['countagentrejectretry']>=_0x3fb42b[_0x108e('0x1a7')]){_0xd7810a[_0x108e('0x133')](_0x107629,_0x2094e0,_0x4c9624,'reason\x2020\x20agentreject');}else{_0xd7810a['stateGlobal'](_0x107629,_0x2094e0,_0x4c9624,_0x108e('0x1c4'));}}break;default:_0x3fb42b['outboundUnknownCallsDay']+=0x1;_0x107629['state']=0xc;_0x107629[_0x108e('0x74')]=_0x1342ce[_0x108e('0xcd')];_0x2f092d=_0x3fb42b['dialAgentRejectRetryFrequency'];_0x45ae4a=_0x3fb42b[_0x108e('0xde')];hopperUtils[_0x108e('0xeb')](_0x107629)[_0x108e('0xaa')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0xd7810a[_0x108e('0x19f')](_0x1342ce[_0x108e('0xcd')],_0x1cfe3e,_0x3fb42b)&&!_0x3279cf){if(_0x107629[_0x108e('0x12b')]+_0x107629['countcongestionretry']+_0x107629['countnoanswerretry']+_0x107629[_0x108e('0x12e')]+_0x107629['countdropretry']+_0x107629['countabandonedretry']+_0x107629[_0x108e('0x129')]+_0x107629[_0x108e('0x12f')]>=_0x3fb42b[_0x108e('0x130')]){_0xd7810a['stateGlobal'](_0x107629,_0x2094e0,_0x4c9624,_0x1342ce[_0x108e('0xcd')]);}else{_0xd7810a[_0x108e('0x133')](_0x107629,_0x2094e0,_0x4c9624,_0x1342ce[_0x108e('0xcd')]);}}}})[_0x108e('0xa7')](function(){if(_0x3279cf){hopperUtils[_0x108e('0xf9')](_0x107629,_0x2f092d,_0x45ae4a)['then'](function(){return _0x2094e0(0x1);});}});});};Dialer[_0x108e('0x8e')][_0x108e('0x131')]=function(_0x55f501,_0x5d7200,_0x2444d6,_0x4e7939){var _0x5def3b=new Final(_0x55f501);_0x5def3b['state']=0xf;_0x5def3b[_0x108e('0x74')]=_0x108e('0x1c5');this[_0x108e('0x133')](_0x5def3b,_0x5d7200,_0x2444d6,_0x4e7939);};Dialer[_0x108e('0x8e')]['createStateFinal']=function(_0x5f6981,_0x1f7344,_0x10dccd,_0x15d422){hopperUtils[_0x108e('0xd2')](_0x5f6981)[_0x108e('0xa7')](function(){return _0x1f7344(msgResponse(_0x108e('0x1c6'),_0x108e('0x115'),_0x15d422));})[_0x108e('0xaa')](function(){return _0x10dccd(msgResponse(_0x108e('0x1c7'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x108e('0x8e')][_0x108e('0x9')]=function(_0x1b8c27){var _0xcb6e1b=_0x1b8c27[_0x108e('0x1c8')]/0x64;var _0x4ee8ed=_0x1b8c27['outboundDropCallsDayTimeout']/(_0x1b8c27[_0x108e('0x1c9')]+_0x1b8c27['outboundAnswerCallsDay']);var _0x2a205a=Math[_0x108e('0x1ca')](_0x1b8c27[_0x108e('0x1cb')]*(_0x1b8c27[_0x108e('0x1cc')]/0x64));var _0x4716ad=Math[_0x108e('0x1ca')](_0x1b8c27[_0x108e('0x1cb')]*(_0x1b8c27[_0x108e('0x1cd')]/0x64));var _0x37a55b=_0x1b8c27[_0x108e('0x1ce')]+_0x1b8c27[_0x108e('0x14c')];var _0x550344=Math['floor'](_0x1b8c27[_0x108e('0x1cf')]*_0x1b8c27['erlangAbandonmentRate']*_0x1b8c27[_0x108e('0x1d0')]*_0x1b8c27[_0x108e('0x1d1')]);if(_[_0x108e('0x43')](_0x1b8c27[_0x108e('0x29')])){if(!_[_0x108e('0x43')](_0x1b8c27[_0x108e('0x28')])){_0x1b8c27[_0x108e('0x28')]=undefined;loggerPredictive['error'](_0x108e('0x1d2'),_0x108e('0x1d3'));}if(!_[_0x108e('0x43')](_0x1b8c27[_0x108e('0x69')])){loggerPredictive[_0x108e('0x6b')](_0x108e('0x1d2'),_0x108e('0x1d4'));clearInterval(_0x1b8c27['handlePredictive']);_0x1b8c27['handlePredictive']=undefined;}_0x1b8c27[_0x108e('0x29')]=moment()[_0x108e('0x91')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x108e('0x4d')](_0x1b8c27[_0x108e('0x4b')],_0x108e('0x1d5'),_0x1b8c27['startProgressive']);this['handlePower'](_0x1b8c27,0x1);}else if(ifInterval(_0x1b8c27[_0x108e('0x1d6')],_0x1b8c27['startProgressive'])){this[_0x108e('0xb9')](_0x1b8c27,0x1);loggerPredictiveCalls[_0x108e('0x4d')]('[startMethodPredictive][StartProgressive][Loop]',_0x1b8c27['startProgressive'],_0x1b8c27[_0x108e('0x4b')]);_0x1b8c27[_0x108e('0x1cf')]=0x0;_0x1b8c27[_0x108e('0xd9')]=0x0;}else if(_0xcb6e1b<_0x4ee8ed&&_0x1b8c27[_0x108e('0x1d7')]===_0x108e('0x1d8')){clearPredictiveAttributes(_0x1b8c27);loggerPredictive[_0x108e('0x4d')](_0x108e('0x1d9'),_0x108e('0x1da'),_0x4ee8ed,_0x108e('0x29'),_0x1b8c27['name']);}else if(_0x550344<_0x1b8c27[_0x108e('0xd9')]&&_0x1b8c27[_0x108e('0x1d7')]===_0x108e('0x1d8')){clearPredictiveAttributes(_0x1b8c27);loggerPredictive[_0x108e('0x4d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x108e('0x1db'),_0x550344,'Drop\x20in\x20this\x20interval',_0x1b8c27[_0x108e('0xd9')],_0x108e('0x29'),_0x1b8c27['name']);}else if(!ifInterval(_0x1b8c27['dialPredictiveInterval'],_0x1b8c27[_0x108e('0x29')])&&_[_0x108e('0x43')](_0x1b8c27[_0x108e('0x28')])&&!_[_0x108e('0x43')](_0x1b8c27[_0x108e('0x29')])){_0x1b8c27[_0x108e('0x28')]=moment()[_0x108e('0x91')](_0x108e('0xcb'));loggerPredictive[_0x108e('0x4d')](_0x1b8c27[_0x108e('0x4b')],_0x108e('0x1dc'),_0x1b8c27[_0x108e('0x28')]);hopperUtils[_0x108e('0x1dd')](_0x1b8c27['dialPredictiveInterval'])['then'](this[_0x108e('0x1de')](_0x1b8c27))['then'](mergeDataErlangB(_0x1b8c27))['then'](this[_0x108e('0x1df')](_0x1b8c27))[_0x108e('0xaa')](loggerCatchPredictive(_0x108e('0x1e0'),_0x1b8c27));}else if(!ifInterval(_0x1b8c27['dialPredictiveInterval'],_0x1b8c27[_0x108e('0x28')])){_0x1b8c27[_0x108e('0xd9')]=0x0;_0x1b8c27[_0x108e('0x28')]=moment()[_0x108e('0x91')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x108e('0x4d')](_0x1b8c27['name'],_0x108e('0x1e1'),_0x1b8c27['startPredictive']);clearInterval(_0x1b8c27['handlePredictive']);_0x1b8c27[_0x108e('0x69')]=undefined;hopperUtils[_0x108e('0x1dd')](_0x1b8c27[_0x108e('0x1d6')])['then'](this[_0x108e('0x1de')](_0x1b8c27))['then'](mergeDataErlangB(_0x1b8c27))[_0x108e('0xa7')](this[_0x108e('0x1df')](_0x1b8c27))[_0x108e('0xaa')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x1b8c27));}else if(_0x1b8c27[_0x108e('0x1cb')]&&_0x37a55b<_0x1b8c27[_0x108e('0x1cb')]-_0x4716ad){clearPredictiveAttributes(_0x1b8c27);loggerPredictive['info'](_0x1b8c27[_0x108e('0x4b')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x37a55b,_0x108e('0x1e2'),_0x1b8c27[_0x108e('0x1cb')],'-',_0x4716ad,'=',_0x1b8c27['predictiveIntervalAvailable']-_0x4716ad,')');}else if(_0x1b8c27[_0x108e('0x1cb')]&&_0x37a55b>_0x1b8c27[_0x108e('0x1cb')]+_0x2a205a){clearPredictiveAttributes(_0x1b8c27);loggerPredictive[_0x108e('0x4d')](_0x1b8c27[_0x108e('0x4b')],_0x108e('0x1e3'),_0x37a55b,_0x108e('0x1e4'),_0x1b8c27['predictiveIntervalAvailable'],'+',_0x2a205a,'=',_0x1b8c27[_0x108e('0x1cb')]+_0x2a205a,')');}};Dialer['prototype']['getDataPredictive']=function(_0x7c71d){var _0x118c49=this;return function(_0x19dc0a){return new Promise(function(_0x4080b0,_0x3e8857){_[_0x108e('0x66')](_0x7c71d,_0x19dc0a[0x0]);if(checkGetDataPredictive(_0x19dc0a[0x0])){var _0x170720=_0x7c71d['predictiveIntervalAvailable']=_0x7c71d['talking']+_0x7c71d[_0x108e('0x1ce')];var _0x378b12=_0x7c71d[_0x108e('0x1d6')]*0x3c;var _0x15d56e=_0x19dc0a[0x0][_0x108e('0x5a')]+_0x19dc0a[0x0][_0x108e('0x58')];var _0x1fff45=(_0x19dc0a[0x0][_0x108e('0x52')]+_0x19dc0a[0x0][_0x108e('0x54')]+_0x19dc0a[0x0][_0x108e('0x56')])/_0x19dc0a[0x0][_0x108e('0x50')];_0x7c71d['predictiveIntervalHitRate']=_0x1fff45>0x0?_0x1fff45:0x1;switch(_0x7c71d[_0x108e('0x1d7')]){case'dropRate':var _0x32b73a=_0x7c71d['dialPredictiveOptimizationPercentage']/0x64;return _0x118c49['abandonmentRate'](_0x170720,_0x378b12,_0x15d56e,_0x1fff45,_0x32b73a)[_0x108e('0xa7')](function(_0x194cf7){return _0x4080b0(_0x194cf7);});case _0x108e('0x1e5'):var _0x2fa30e=_0x7c71d[_0x108e('0x1c8')]/0x64;return _0x118c49[_0x108e('0x1e6')](_0x170720,_0x378b12,_0x15d56e,_0x1fff45,_0x2fa30e)['then'](function(_0x23a051){return _0x4080b0(_0x23a051);});default:return _0x3e8857(msgResponse(_0x108e('0x1e7'),'Failure','Unknown\x20Predictive'));}}else{return _0x3e8857(msgResponse('[getDataPredictive]','Failure',_0x108e('0x1e8')));}});};};Dialer[_0x108e('0x8e')]['getDataPredictiveOld']=function(_0x395017){var _0x1d1349=this;return function(_0x4983bc){return new Promise(function(_0x21b7d4,_0x4debfe){_[_0x108e('0x66')](_0x395017,_0x4983bc[0x0]);if(checkGetDataPredictive(_0x4983bc[0x0])){loggerPredictive[_0x108e('0x4d')](JSON[_0x108e('0x7a')](_0x4983bc[0x0]));if(_0x395017[_0x108e('0x1d7')]===_0x108e('0x1d8')){return _0x1d1349[_0x108e('0x162')](_0x395017['id'])[_0x108e('0xa7')](function(_0x8e9057){var _0x117c6b=_0x395017['loggedIn']-_0x8e9057[0x0][_0x108e('0x1e9')];var _0x4c2c59=_0x395017[_0x108e('0x1d6')]*0x3c;var _0x29ca53=_0x4983bc[0x0][_0x108e('0x5a')]+_0x4983bc[0x0][_0x108e('0x58')];var _0x17d766=(_0x4983bc[0x0][_0x108e('0x52')]+_0x4983bc[0x0][_0x108e('0x54')]+_0x4983bc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4983bc[0x0][_0x108e('0x50')];var _0x3c60a2=_0x395017[_0x108e('0x1c8')]/0x64;_0x395017[_0x108e('0x1ea')]=_0x8e9057[0x0][_0x108e('0x1e9')]||0x0;_0x395017['predictiveIntervalHitRate']=_0x17d766>0x0?_0x17d766:0x1;return _0x1d1349[_0x108e('0x1eb')](_0x117c6b,_0x4c2c59,_0x29ca53,_0x17d766,_0x3c60a2);})[_0x108e('0xa7')](function(_0x4aac38){return _0x21b7d4(_0x4aac38);})['catch'](function(_0x2a94d1){return _0x4debfe(msgResponse('[CatchErlangB]',_0x108e('0x9d'),JSON[_0x108e('0x7a')](_0x2a94d1)));});}if(_0x395017[_0x108e('0x1d7')]===_0x108e('0x1e5')){return _0x1d1349[_0x108e('0x162')](_0x395017['id'])[_0x108e('0xa7')](function(_0x40389f){var _0xb0fd13=_0x395017[_0x108e('0x1ec')]-_0x40389f[0x0][_0x108e('0x1e9')];var _0x5be540=_0x395017[_0x108e('0x1d6')]*0x3c;var _0x5e2475=_0x4983bc[0x0][_0x108e('0x5a')]+_0x4983bc[0x0][_0x108e('0x58')];var _0x29d522=(_0x4983bc[0x0][_0x108e('0x52')]+_0x4983bc[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4983bc[0x0][_0x108e('0x56')])/_0x4983bc[0x0][_0x108e('0x50')];var _0x2ed6ac=_0x395017['dialPredictiveOptimizationPercentage']/0x64;_0x395017['predictiveIntervalPauses']=_0x40389f[0x0][_0x108e('0x1e9')]||0x0;_0x395017[_0x108e('0x1d0')]=_0x29d522>0x0?_0x29d522:0x1;return _0x1d1349['busyFactor'](_0xb0fd13,_0x5be540,_0x5e2475,_0x29d522,_0x2ed6ac);})[_0x108e('0xa7')](function(_0x233970){return _0x21b7d4(_0x233970);})[_0x108e('0xaa')](function(_0x5102b8){return _0x4debfe(msgResponse(_0x108e('0x1ed'),_0x108e('0x9d'),JSON[_0x108e('0x7a')](_0x5102b8)));});}}else{return _0x4debfe(msgResponse(_0x108e('0x1e7'),_0x108e('0x9d'),_0x108e('0x1e8')));}});};};Dialer['prototype'][_0x108e('0x1df')]=function(_0x32b794){var _0x3c9f6b=this;return function(){var _0x1ec365=0x0;var _0x3a3de1=Math[_0x108e('0x1ee')](_0x32b794[_0x108e('0x1ef')]*0x3e8);if(_0x3a3de1>0x0){_0x3a3de1=_0x3a3de1<0x64?0x64:_0x3a3de1;loggerPredictive[_0x108e('0x4d')](_0x32b794[_0x108e('0x4b')],_0x108e('0x1f0'),_0x3a3de1,_0x108e('0x1f1'));_0x32b794[_0x108e('0x69')]=setInterval(function(){_0x3c9f6b[_0x108e('0x69')](_0x32b794);loggerPredictiveCalls[_0x108e('0x4d')](_0x108e('0x1f2'),_0x1ec365+=0x1);},_0x3a3de1);}else{loggerPredictive[_0x108e('0x4d')](_0x32b794['name'],_0x108e('0x1f3'));}};};Dialer[_0x108e('0x8e')][_0x108e('0x1f4')]=function(_0x2d9bc3,_0x4dc3d7){var _0x2874b7=this;return function(_0x9f3cb5){if(_[_0x108e('0x7f')](_0x9f3cb5)){if(_[_0x108e('0xff')](_0x4dc3d7[_0x108e('0x167')])||!_0x4dc3d7['recallme']){if(_0x2d9bc3[_0x108e('0xb8')]===_0x108e('0xbc')){_0x2d9bc3[_0x108e('0x77')]=_[_0x108e('0x43')](_0x2d9bc3['queueStatusComplete'])?!![]:_0x2d9bc3['queueStatusComplete'];var _0x4d0359=uuid['v4']();_0x2874b7['actions'][_0x4d0359]=new Action(_0x2d9bc3,_0x4dc3d7,_0x4d0359);loggerBooked['info'](_0x108e('0x1f5'),_0x4d0359,_0x108e('0x1f6'),JSON[_0x108e('0x7a')](_0x2d9bc3[_0x108e('0x77')]),'Queue:\x20',_0x2d9bc3['name']);if(_0x2d9bc3['queueStatusComplete']){_0x2d9bc3[_0x108e('0x77')]=![];_0x2874b7[_0x108e('0x2b')][_0x2874b7[_0x108e('0x24')][_0x4d0359][_0x108e('0xc7')]]=[];ami['Action']({'actionid':_0x4d0359,'action':'queuestatus','queue':_0x2d9bc3[_0x108e('0x4b')]})[_0x108e('0xaa')](function(){utils[_0x108e('0x10c')](_0x2d9bc3,_0x108e('0x1f7'));hopperUtils[_0x108e('0xe3')]({'active':![],'ContactId':_0x2874b7[_0x108e('0x24')][_0x4d0359][_0x108e('0xe5')],'ListId':_0x2874b7['actions'][_0x4d0359][_0x108e('0xe6')],'VoiceQueueId':_0x2874b7[_0x108e('0x24')][_0x4d0359][_0x108e('0xe7')]||undefined,'CampaignId':_0x2874b7[_0x108e('0x24')][_0x4d0359]['CampaignId']||undefined})[_0x108e('0xaa')](loggerCatch(_0x108e('0x1f8')));delete _0x2874b7['actions'][_0x4d0359];});}else{loggerBooked[_0x108e('0x4d')](_0x108e('0x1f9'),JSON[_0x108e('0x7a')](_0x2d9bc3['queueStatusComplete']),_0x108e('0x1fa'),_0x2d9bc3[_0x108e('0x4b')]);utils[_0x108e('0x10c')](_0x2d9bc3,'[checkContactBlack]');hopperUtils[_0x108e('0xe3')]({'active':![],'ContactId':_0x2874b7[_0x108e('0x24')][_0x4d0359][_0x108e('0xe5')],'ListId':_0x2874b7[_0x108e('0x24')][_0x4d0359][_0x108e('0xe6')],'VoiceQueueId':_0x2874b7[_0x108e('0x24')][_0x4d0359][_0x108e('0xe7')]||undefined,'CampaignId':_0x2874b7[_0x108e('0x24')][_0x4d0359][_0x108e('0xe8')]||undefined})['catch'](loggerCatch(_0x108e('0x1f8')));delete _0x2874b7['actions'][_0x4d0359];}}else{return _0x2874b7[_0x108e('0x16d')](_0x2d9bc3,_0x4dc3d7);}}else{if(utils['getSeconds'](undefined,_0x4dc3d7[_0x108e('0x1fb')])<_0x2d9bc3['dialRecallMeTimeout']*0x3c){if(_0x4dc3d7[_0x108e('0x158')]&&!_0x4dc3d7[_0x108e('0x158')][_0x108e('0x1fc')]){_0x2874b7[_0x108e('0x1d')][_0x108e('0x1fd')](_0x4dc3d7['id'])[_0x108e('0x1b')](function(){utils[_0x108e('0x10c')](_0x2d9bc3,'[checkContactBlack]');});}else{hopperUtils['unlockContact']({'active':![]},_0x4dc3d7['id'],0x1)['finally'](function(){utils[_0x108e('0x10c')](_0x2d9bc3,_0x108e('0x1f7'));});}}else{_0x2d9bc3['outboundReCallsDay']+=0x1;utils[_0x108e('0x10c')](_0x2d9bc3,'[checkContactBlack]');if(_0x2d9bc3[_0x108e('0x1fe')]){hopperUtils[_0x108e('0xe3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4dc3d7[_0x108e('0xe5')],'ListId':_0x4dc3d7[_0x108e('0xe6')],'VoiceQueueId':_0x4dc3d7['VoiceQueueId']||undefined,'CampaignId':_0x4dc3d7[_0x108e('0xe8')]||undefined})['catch'](loggerCatch(_0x108e('0x1ff')));hopperUtils[_0x108e('0xeb')](createObjHistory(_0x2d9bc3,_0x4dc3d7,utils[_0x108e('0x6f')]['QUEUE_RECALL'],0x17,_0x108e('0x200')))[_0x108e('0xaa')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x2874b7[_0x108e('0x137')](createObjHistory(_0x2d9bc3,_0x4dc3d7,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0x108e('0x201')),_0x108e('0x202'),'[Originate][HistoryRecallClose]');}}}}else{_0x2d9bc3[_0x108e('0x203')]+=0x1;_0x2874b7[_0x108e('0x137')](createObjHistory(_0x2d9bc3,_0x4dc3d7,utils['CAMPAIGN_STATUS'][_0x108e('0x204')],0xd,_0x108e('0x205')),'[Originate][historyBlacklist]',_0x108e('0x206'));throw _0x108e('0x207');}};};Dialer['prototype'][_0x108e('0x208')]=function(_0x5e582a){var _0x50d471=this;var _0x2309b5=_0x5e582a[_0x108e('0x209')]-_0x5e582a[_0x108e('0x87')];emitCampaignSummary(_0x5e582a);if(_0x2309b5>0x0&&_0x5e582a['temp']==0x0){if(_0x2309b5>this[_0x108e('0x22')]){_0x2309b5=this[_0x108e('0x22')];}_0x5e582a[_0x108e('0x20a')]=0x1;hopperUtils[_0x108e('0x20b')](_0x5e582a,_0x2309b5)[_0x108e('0xa7')](function(_0x3fa589){_0x5e582a['temp']=0x0;if(_0x3fa589){if(!utils[_0x108e('0x20c')](_0x3fa589)){_0x5e582a[_0x108e('0x6e')]=utils[_0x108e('0x6f')]['NO_AVAILABLE_CONTACTS'];logger[_0x108e('0x4d')](_0x108e('0x20d')+_0x5e582a[_0x108e('0x4b')]);}else{_0x5e582a[_0x108e('0x87')]+=_0x3fa589[_0x108e('0x106')];_0x5e582a[_0x108e('0x6e')]=utils[_0x108e('0x6f')][_0x108e('0x20e')];for(var _0x5e20ac=0x0;_0x5e20ac<_0x3fa589[_0x108e('0x106')];_0x5e20ac+=0x1){_0x5e582a['ivrTotalCallsDays']+=0x1;if(_[_0x108e('0xff')](_0x3fa589[_0x5e20ac])||_['isNil'](_0x3fa589[_0x5e20ac][_0x108e('0x20f')])||_[_0x108e('0xff')](_0x3fa589[_0x5e20ac][_0x108e('0x170')])){_0x50d471['emptyContact'](_0x108e('0x210'),_0x5e582a,_0x3fa589[_0x5e20ac]);}else{hopperUtils[_0x108e('0x211')](_[_0x108e('0x7b')](_0x3fa589[_0x5e20ac],['CampaignId',_0x108e('0x170')]))[_0x108e('0xa7')](_0x50d471['checkContactBlack'](_0x5e582a,_0x3fa589[_0x5e20ac]))['catch'](function(_0x366b34){logger['error'](_0x108e('0x212'),_0x366b34);utils[_0x108e('0x10c')](_0x5e582a,_0x108e('0x213'));});}}}}})[_0x108e('0xaa')](function(_0x329280){_0x5e582a[_0x108e('0x20a')]=0x0;logger[_0x108e('0x6b')](_0x108e('0x214'),_0x329280);});}};Dialer['prototype'][_0x108e('0xb9')]=function(_0x477ef5,_0xc44727){var _0x12ce32=this;var _0x34ae22=[];if(_0xc44727<0x1||_0x477ef5[_0x108e('0xb8')]===_0x108e('0xbc')){_0xc44727=0x1;}var _0x132067=Math[_0x108e('0x1ee')](_0x477ef5[_0x108e('0x1ce')]*_0xc44727)-_0x477ef5[_0x108e('0x87')];if(_0x477ef5[_0x108e('0x215')]>0x0){var _0x2035ea=_0x477ef5[_0x108e('0x215')]-_0x477ef5['originated']-_0x477ef5['talking']-_0x477ef5[_0x108e('0x14d')];if(_0x132067>_0x2035ea){_0x132067=_0x2035ea;}}if(_0x132067>0x0&&_0x477ef5[_0x108e('0x20a')]==0x0){if(_0x477ef5['dialMethod']==='booked'){_0x132067=0x1;}if(_0x132067>this[_0x108e('0x22')]){_0x132067=this[_0x108e('0x22')];}for(var _0x49ce27 in this[_0x108e('0x20')]){if(typeof this[_0x108e('0x20')][_0x49ce27]!==_0x108e('0x15e')){if(this[_0x108e('0x20')][_0x49ce27][_0x108e('0x73')]===_0x108e('0x216')&&this[_0x108e('0x20')][_0x49ce27][_0x108e('0x93')]===_0x108e('0x94')){_0x34ae22[_0x108e('0xa1')](this[_0x108e('0x20')][_0x49ce27]['id']);}}}_0x477ef5['temp']=0x1;hopperUtils['getContactDialer'](_0x477ef5,_0x34ae22,_0x132067)[_0x108e('0xa7')](function(_0x2c05c3){_0x477ef5['temp']=0x0;if(_0x2c05c3){if(!utils[_0x108e('0x20c')](_0x2c05c3)){hopperUtils[_0x108e('0x217')](_0x477ef5)[_0x108e('0xa7')](sendMessageReschedule(_0x477ef5))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x477ef5['originated']+=_0x2c05c3[_0x108e('0x106')];_0x477ef5['message']=_0x477ef5['dialMethod']===_0x108e('0xbc')?utils[_0x108e('0x6f')][_0x108e('0x14e')]:utils[_0x108e('0x6f')]['RUNNING'];for(var _0x6dc09b=0x0;_0x6dc09b<_0x2c05c3[_0x108e('0x106')];_0x6dc09b+=0x1){if(_[_0x108e('0xff')](_0x2c05c3[_0x6dc09b])||_[_0x108e('0xff')](_0x2c05c3[_0x6dc09b][_0x108e('0x20f')])||_[_0x108e('0xff')](_0x2c05c3[_0x6dc09b]['phone'])){_0x12ce32[_0x108e('0x164')](_0x108e('0x210'),_0x477ef5,_0x2c05c3[_0x6dc09b]);}else{hopperUtils[_0x108e('0x218')](_[_0x108e('0x7b')](_0x2c05c3[_0x6dc09b],[_0x108e('0xe7'),_0x108e('0x170')]))[_0x108e('0xa7')](_0x12ce32[_0x108e('0x1f4')](_0x477ef5,_0x2c05c3[_0x6dc09b]))[_0x108e('0xaa')](function(_0x1635e2){logger[_0x108e('0x6b')](_0x108e('0x219'),_0x1635e2);utils[_0x108e('0x10c')](_0x477ef5,_0x108e('0x21a'));});}}}}})[_0x108e('0xaa')](function(_0x2eba86){_0x477ef5[_0x108e('0x20a')]=0x0;logger['error']('[getContactCampaign2]',_0x2eba86);});}};Dialer[_0x108e('0x8e')][_0x108e('0x69')]=function(_0x1585f0){if(_0x1585f0['dialLimitQueue']>0x0){var _0x3fc678=_0x1585f0[_0x108e('0x215')]-_0x1585f0[_0x108e('0x87')]-_0x1585f0['talking'];if(_0x3fc678>0x0&&_0x1585f0[_0x108e('0x20a')]==0x0){this[_0x108e('0x21b')](_0x1585f0);}else{loggerPredictiveCalls[_0x108e('0x4d')]('[handlePredictive][limitChannel]');}}else{this[_0x108e('0x21b')](_0x1585f0);}};Dialer[_0x108e('0x8e')][_0x108e('0x21b')]=function(_0x26e504){var _0x2068f4=this;var _0x5203c3=[];_0x26e504[_0x108e('0x87')]+=0x1;for(var _0x208229 in this[_0x108e('0x20')]){if(typeof this[_0x108e('0x20')][_0x208229]!==_0x108e('0x15e')){if(this['agents'][_0x208229]['state']===_0x108e('0x216')&&this[_0x108e('0x20')][_0x208229][_0x108e('0x93')]==='reachable'){_0x5203c3[_0x108e('0xa1')](this['agents'][_0x208229]['id']);}}}_0x26e504[_0x108e('0x20a')]=0x1;return this[_0x108e('0x21c')](_0x26e504['id'],_0x5203c3,0x1,_0x26e504['dialOrderByScheduledAt'],_0x26e504)[_0x108e('0xa7')](function(_0x47c55c){_0x26e504['temp']=0x1;if(_0x47c55c){if(!utils['checkContactEmpty'](_0x47c55c)){utils[_0x108e('0x21d')](_0x26e504,0x1,0x0);return hopperUtils['countReScheduled'](_0x26e504)['then'](sendMessageReschedule(_0x26e504))[_0x108e('0xaa')](loggerCatch('[countReScheduled]\x20'));}else{_0x26e504[_0x108e('0x6e')]=utils[_0x108e('0x6f')][_0x108e('0x20e')];if(_[_0x108e('0xff')](_0x47c55c[0x0])||_[_0x108e('0xff')](_0x47c55c[0x0][_0x108e('0x20f')])||_[_0x108e('0xff')](_0x47c55c[0x0][_0x108e('0x170')])){_0x2068f4[_0x108e('0x164')](_0x108e('0x210'),_0x26e504,_0x47c55c[0x0]);}else{return hopperUtils[_0x108e('0x218')](_[_0x108e('0x7b')](_0x47c55c[0x0],['VoiceQueueId',_0x108e('0x170')]))[_0x108e('0xa7')](_0x2068f4[_0x108e('0x1f4')](_0x26e504,_0x47c55c[0x0]))[_0x108e('0xaa')](function(_0xf845ad){logger[_0x108e('0x6b')]('[actionOriginatePredictive]',_0xf845ad);utils[_0x108e('0x10c')](_0x26e504,_0x108e('0x21e'));});}}}})[_0x108e('0xaa')](function(_0x140a9f){_0x26e504[_0x108e('0x20a')]=0x0;logger[_0x108e('0x6b')](_0x108e('0x214'),_0x140a9f);});};Dialer[_0x108e('0x8e')][_0x108e('0x1eb')]=function(_0x577e9d,_0x4d082e,_0x2ba9f3,_0xa47c5,_0x34b042,_0x736ffe){loggerPredictive[_0x108e('0x4d')](_0x108e('0x21f'));loggerPredictive['info'](_0x108e('0x220'),_0x577e9d);loggerPredictive[_0x108e('0x4d')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d082e);loggerPredictive[_0x108e('0x4d')](_0x108e('0x221'),_0x2ba9f3);loggerPredictive[_0x108e('0x4d')](_0x108e('0x222'),_0xa47c5);loggerPredictive[_0x108e('0x4d')](_0x108e('0x223'),_0x34b042);loggerPredictive['info'](_0x108e('0x5b'));return new Promise(function(_0x5753f8,_0x2e89f3){if(_0x577e9d<=0x0||isNaN(_0x577e9d)){return _0x2e89f3(msgResponse('[abandonmentRate]',_0x108e('0x8d'),_0x108e('0x224')+_0x577e9d));}if(_0x2ba9f3<=0x0||isNaN(_0x2ba9f3)){return _0x2e89f3(msgResponse(_0x108e('0x225'),_0x108e('0x8d'),_0x108e('0x226')+_0x2ba9f3));}if(_0xa47c5<=0x0||isNaN(_0xa47c5)){return _0x2e89f3(msgResponse(_0x108e('0x225'),_0x108e('0x8d'),'p\x20=\x20'+_0xa47c5));}if(_0x4d082e<=0x0||isNaN(_0x4d082e)){return _0x2e89f3(msgResponse(_0x108e('0x225'),_0x108e('0x8d'),_0x108e('0x227')+_0x4d082e));}if(_0x34b042<=0x0||isNaN(_0x34b042)){return _0x2e89f3(msgResponse(_0x108e('0x225'),_0x108e('0x8d'),_0x108e('0x228')+_0x34b042));}_0x736ffe=_0x736ffe||0x0;var _0x5567aa=0x1/_0x2ba9f3;var _0x5c77fa=0x0;var _0x4028e6=0x0;var _0x2bc78e=0x0;var _0x2d29eb=0x0;for(var _0x269590=0x0;_0x2bc78e<_0x34b042;_0x269590+=0x1){_0x4028e6=_0x269590/_0x4d082e;_0x5c77fa=(_0xa47c5*_0x4028e6+_0x736ffe)/_0x5567aa;_0x2bc78e=utils['erlangb'](_0x5c77fa,_0x577e9d);_0x2d29eb=_0x5c77fa/_0x577e9d*(0x1-utils[_0x108e('0x229')](_0x5c77fa,_0x577e9d));}return _0x5753f8({'erlangCalls':_0x269590,'erlangCallToSecond':_0x4d082e/_0x269590,'erlangAbandonmentRate':_0x2bc78e,'erlangBusyFactor':_0x2d29eb});});};Dialer[_0x108e('0x8e')][_0x108e('0x1e6')]=function(_0x450f76,_0x296161,_0xeed1d9,_0x94900d,_0x5f50bd,_0x308e7b){loggerPredictive[_0x108e('0x4d')](_0x108e('0x22a'));loggerPredictive['info'](_0x108e('0x220'),_0x450f76);loggerPredictive['info'](_0x108e('0x22b'),_0x296161);loggerPredictive['info'](_0x108e('0x221'),_0xeed1d9);loggerPredictive[_0x108e('0x4d')](_0x108e('0x222'),_0x94900d);loggerPredictive['info'](_0x108e('0x22c'),_0x5f50bd);loggerPredictive['info']('---------------------------');return new Promise(function(_0x3f560b,_0x55dcd6){if(_0x450f76<=0x0||isNaN(_0x450f76)){return _0x55dcd6(msgResponse(_0x108e('0x22d'),_0x108e('0x8d'),_0x108e('0x224')+_0x450f76));}if(_0xeed1d9<=0x0||isNaN(_0xeed1d9)){return _0x55dcd6(msgResponse(_0x108e('0x22d'),_0x108e('0x8d'),_0x108e('0x226')+_0xeed1d9));}if(_0x94900d<=0x0||isNaN(_0x94900d)){return _0x55dcd6(msgResponse(_0x108e('0x22d'),_0x108e('0x8d'),'p\x20=\x20'+_0x94900d));}if(_0x296161<=0x0||isNaN(_0x296161)){return _0x55dcd6(msgResponse(_0x108e('0x22d'),'Error','interval\x20=\x20'+_0x296161));}if(_0x5f50bd<=0x0||isNaN(_0x5f50bd)){return _0x55dcd6(msgResponse(_0x108e('0x22d'),'Error',_0x108e('0x22e')+_0x5f50bd));}_0x308e7b=_0x308e7b||0x0;var _0x29b389=0x1/_0xeed1d9;var _0x528cca=0x0;var _0x361a87=0x0;var _0x2b47cd=0x0;var _0x5d7c81=0x0;for(var _0x3292e2=0x0;_0x5d7c81<_0x5f50bd;_0x3292e2+=0x1){_0x361a87=_0x3292e2/_0x296161;_0x528cca=(_0x94900d*_0x361a87+_0x308e7b)/_0x29b389;_0x2b47cd=utils['erlangb'](_0x528cca,_0x450f76);_0x5d7c81=_0x528cca/_0x450f76*(0x1-utils[_0x108e('0x229')](_0x528cca,_0x450f76));}return _0x3f560b({'erlangCalls':_0x3292e2,'erlangCallToSecond':_0x296161/_0x3292e2,'erlangAbandonmentRate':_0x2b47cd,'erlangBusyFactor':_0x5d7c81});});};module[_0x108e('0x22f')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index a8e69de..baf013a 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe40=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','number','substring','dialCutDigit','getQueue','exports','lodash','moment','isNil','Contact','firstName','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName'];(function(_0x219805,_0x5754c4){var _0x13e16a=function(_0x4a3926){while(--_0x4a3926){_0x219805['push'](_0x219805['shift']());}};_0x13e16a(++_0x5754c4);}(_0xbe40,0x67));var _0x0be4=function(_0x19b5e6,_0x9b2bb3){_0x19b5e6=_0x19b5e6-0x0;var _0x50cda2=_0xbe40[_0x19b5e6];return _0x50cda2;};'use strict';var util=require('util');var _=require(_0x0be4('0x0'));var moment=require(_0x0be4('0x1'));function checkNameSurname(_0x146014,_0x4039b3,_0x260dbe){var _0x3b5880='';if(!_['isNil'](_0x4039b3)&&'string'===typeof _0x4039b3){_0x3b5880+=_0x4039b3;}if(!_[_0x0be4('0x2')](_0x260dbe)&&'string'===typeof _0x260dbe){_0x3b5880+='\x20'+_0x260dbe;}if(_0x3b5880!==''){return _0x3b5880;}return _0x146014;}function Action(_0x1e5af6,_0x4feb1b,_0x2f4736){this['voiceQueue']=_0x1e5af6;this['uniqueid']=_0x2f4736||undefined;this['name']=checkNameSurname(_0x4feb1b[_0x0be4('0x3')]['phone'],_0x4feb1b[_0x0be4('0x3')][_0x0be4('0x4')],_0x4feb1b[_0x0be4('0x3')]['lastName']);this['number']=_0x4feb1b[_0x0be4('0x5')];this[_0x0be4('0x6')]=_0x1e5af6[_0x0be4('0x7')];this[_0x0be4('0x8')]=_0x4feb1b[_0x0be4('0x8')]||![];this[_0x0be4('0x9')]=_0x1e5af6['type'];this[_0x0be4('0xa')]=_0x1e5af6[_0x0be4('0xa')]||0x3;this[_0x0be4('0xb')]=_0x4feb1b[_0x0be4('0xb')];this[_0x0be4('0xc')]=_0x4feb1b[_0x0be4('0xc')];this['countcongestionretry']=_0x4feb1b[_0x0be4('0xd')];this[_0x0be4('0xe')]=_0x4feb1b[_0x0be4('0xe')];this[_0x0be4('0xf')]=_0x4feb1b[_0x0be4('0xf')];this[_0x0be4('0x10')]=_0x4feb1b[_0x0be4('0x10')];this[_0x0be4('0x11')]=_0x4feb1b[_0x0be4('0x11')];this[_0x0be4('0x12')]=_0x4feb1b[_0x0be4('0x12')];this['countagentrejectretry']=_0x4feb1b['countagentrejectretry'];this[_0x0be4('0x13')]=_0x4feb1b['ContactId'];this[_0x0be4('0x14')]=_0x4feb1b['ListId'];this[_0x0be4('0x15')]=_0x4feb1b['UserId'];this[_0x0be4('0x16')]=_0x4feb1b[_0x0be4('0x16')];this[_0x0be4('0x17')]=_0x4feb1b['CampaignId'];this[_0x0be4('0x18')]=_0x4feb1b['id'];this[_0x0be4('0x19')]=_0x4feb1b[_0x0be4('0x3')]['firstName']||'';this[_0x0be4('0x1a')]=moment()[_0x0be4('0x1b')](_0x0be4('0x1c'));this[_0x0be4('0x1d')]=_0x4feb1b['callback'];this[_0x0be4('0x1e')]=_0x4feb1b[_0x0be4('0x1e')];this[_0x0be4('0x1f')]=_0x4feb1b[_0x0be4('0x1f')];this['recallme']=_0x4feb1b[_0x0be4('0x20')];this['originatecalleridnum']='';this[_0x0be4('0x21')]='';}Action[_0x0be4('0x22')][_0x0be4('0x23')]=function(){return util[_0x0be4('0x1b')](_0x0be4('0x24'),this['name'],this[_0x0be4('0x25')]['dialCutDigit']>0x0?this[_0x0be4('0x26')][_0x0be4('0x27')](this[_0x0be4('0x25')][_0x0be4('0x28')]):this[_0x0be4('0x26')]);};Action[_0x0be4('0x22')][_0x0be4('0x29')]=function(){return this[_0x0be4('0x6')];};module[_0x0be4('0x2a')]=Action; \ No newline at end of file +var _0xa539=['CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','name','phone','Contact','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x2de9de,_0xd46ad){var _0x34be8c=function(_0x294df0){while(--_0x294df0){_0x2de9de['push'](_0x2de9de['shift']());}};_0x34be8c(++_0xd46ad);}(_0xa539,0xc2));var _0x9a53=function(_0x4bcc87,_0x39e20){_0x4bcc87=_0x4bcc87-0x0;var _0x22f46e=_0xa539[_0x4bcc87];return _0x22f46e;};'use strict';var util=require(_0x9a53('0x0'));var _=require(_0x9a53('0x1'));var moment=require(_0x9a53('0x2'));function checkNameSurname(_0x5f1fa4,_0x656bc3,_0x525780){var _0x45f57c='';if(!_[_0x9a53('0x3')](_0x656bc3)&&_0x9a53('0x4')===typeof _0x656bc3){_0x45f57c+=_0x656bc3;}if(!_[_0x9a53('0x3')](_0x525780)&&_0x9a53('0x4')===typeof _0x525780){_0x45f57c+='\x20'+_0x525780;}if(_0x45f57c!==''){return _0x45f57c;}return _0x5f1fa4;}function Action(_0x150022,_0x48ecfc,_0x272654){this[_0x9a53('0x5')]=_0x150022;this['uniqueid']=_0x272654||undefined;this[_0x9a53('0x6')]=checkNameSurname(_0x48ecfc['Contact'][_0x9a53('0x7')],_0x48ecfc['Contact']['firstName'],_0x48ecfc[_0x9a53('0x8')]['lastName']);this[_0x9a53('0x9')]=_0x48ecfc['phone'];this[_0x9a53('0xa')]=_0x150022[_0x9a53('0x6')];this['active']=_0x48ecfc[_0x9a53('0xb')]||![];this[_0x9a53('0xc')]=_0x150022['type'];this[_0x9a53('0xd')]=_0x150022[_0x9a53('0xd')]||0x3;this[_0x9a53('0xe')]=_0x48ecfc['scheduledat'];this[_0x9a53('0xf')]=_0x48ecfc['countbusyretry'];this[_0x9a53('0x10')]=_0x48ecfc['countcongestionretry'];this['countnoanswerretry']=_0x48ecfc[_0x9a53('0x11')];this[_0x9a53('0x12')]=_0x48ecfc[_0x9a53('0x12')];this['countdropretry']=_0x48ecfc['countdropretry'];this[_0x9a53('0x13')]=_0x48ecfc[_0x9a53('0x13')];this[_0x9a53('0x14')]=_0x48ecfc[_0x9a53('0x14')];this['countagentrejectretry']=_0x48ecfc[_0x9a53('0x15')];this[_0x9a53('0x16')]=_0x48ecfc['ContactId'];this[_0x9a53('0x17')]=_0x48ecfc[_0x9a53('0x17')];this['UserId']=_0x48ecfc[_0x9a53('0x18')];this[_0x9a53('0x19')]=_0x48ecfc[_0x9a53('0x19')];this[_0x9a53('0x1a')]=_0x48ecfc[_0x9a53('0x1a')];this[_0x9a53('0x1b')]=_0x48ecfc['id'];this[_0x9a53('0x1c')]=_0x48ecfc[_0x9a53('0x8')][_0x9a53('0x1d')]||'';this[_0x9a53('0x1e')]=moment()[_0x9a53('0x1f')](_0x9a53('0x20'));this[_0x9a53('0x21')]=_0x48ecfc[_0x9a53('0x21')];this[_0x9a53('0x22')]=_0x48ecfc['callbackuniqueid'];this[_0x9a53('0x23')]=_0x48ecfc[_0x9a53('0x23')];this['recallme']=_0x48ecfc[_0x9a53('0x24')];this[_0x9a53('0x25')]='';this[_0x9a53('0x26')]='';}Action[_0x9a53('0x27')]['getCaller']=function(){return util[_0x9a53('0x1f')]('\x22%s\x22\x20<%s>',this['name'],this[_0x9a53('0x5')][_0x9a53('0x28')]>0x0?this[_0x9a53('0x9')][_0x9a53('0x29')](this['voiceQueue'][_0x9a53('0x28')]):this[_0x9a53('0x9')]);};Action[_0x9a53('0x27')][_0x9a53('0x2a')]=function(){return this[_0x9a53('0xa')];};module[_0x9a53('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 7d81a6b..ef5119c 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d37=['YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format'];(function(_0x411efd,_0x1ee17f){var _0x42f89c=function(_0x40550e){while(--_0x40550e){_0x411efd['push'](_0x411efd['shift']());}};_0x42f89c(++_0x1ee17f);}(_0x5d37,0xa4));var _0x75d3=function(_0x570d3c,_0x14ceae){_0x570d3c=_0x570d3c-0x0;var _0xa75d3e=_0x5d37[_0x570d3c];return _0xa75d3e;};'use strict';var moment=require(_0x75d3('0x0'));var utils=require(_0x75d3('0x1'));function AgentComplete(_0x491634,_0x14a73a){this[_0x75d3('0x2')]=0x4;this[_0x75d3('0x3')]=_0x75d3('0x4');this[_0x75d3('0x5')]=_0x491634[_0x75d3('0x5')];this['type']=_0x491634[_0x75d3('0x6')];this[_0x75d3('0x7')]=_0x491634['type']==='outbound'?_0x75d3('0x8'):_0x491634[_0x75d3('0x6')];this[_0x75d3('0x9')]=_0x491634['countbusyretry'];this['countcongestionretry']=_0x491634[_0x75d3('0xa')];this[_0x75d3('0xb')]=_0x491634['countnoanswerretry'];this[_0x75d3('0xc')]=_0x491634[_0x75d3('0x9')]+_0x491634[_0x75d3('0xa')]+_0x491634[_0x75d3('0xb')]+_0x491634[_0x75d3('0xd')]+_0x491634[_0x75d3('0xe')]+_0x491634[_0x75d3('0xf')]+_0x491634[_0x75d3('0x10')]+_0x491634[_0x75d3('0x11')];this[_0x75d3('0xd')]=_0x491634[_0x75d3('0xd')];this[_0x75d3('0xe')]=_0x491634[_0x75d3('0xe')];this['countabandonedretry']=_0x491634['countabandonedretry'];this[_0x75d3('0x10')]=_0x491634['countmachineretry'];this['countagentrejectretry']=_0x491634['countagentrejectretry'];this[_0x75d3('0x12')]=_0x14a73a[_0x75d3('0x12')];this[_0x75d3('0x13')]=_0x491634[_0x75d3('0x14')];this[_0x75d3('0x15')]=_0x491634[_0x75d3('0x16')];this['starttime']=_0x491634[_0x75d3('0x17')];this[_0x75d3('0x18')]=_0x491634[_0x75d3('0x18')];this['answertime']=_0x491634[_0x75d3('0x19')];this[_0x75d3('0x1a')]=moment()[_0x75d3('0x1b')](_0x75d3('0x1c'));this[_0x75d3('0x1d')]=utils['getSeconds'](_0x491634[_0x75d3('0x18')],_0x491634[_0x75d3('0x17')]);this[_0x75d3('0x1e')]=utils[_0x75d3('0x1f')](_0x491634['answertime'],_0x491634['responsetime']);this[_0x75d3('0x20')]=utils[_0x75d3('0x1f')](this['endtime'],_0x491634[_0x75d3('0x19')]);this[_0x75d3('0x8')]=_0x14a73a[_0x75d3('0x8')];this[_0x75d3('0x21')]=_0x14a73a[_0x75d3('0x21')];this[_0x75d3('0x22')]=_0x14a73a['reason'];this['callback']=_0x491634[_0x75d3('0x23')];this[_0x75d3('0x24')]=_0x491634[_0x75d3('0x24')];this[_0x75d3('0x25')]=_0x491634[_0x75d3('0x25')];this[_0x75d3('0x26')]=_0x491634['recallme'];this[_0x75d3('0x27')]=_0x491634[_0x75d3('0x27')];this[_0x75d3('0x28')]=_0x491634[_0x75d3('0x28')];this['UserId']=_0x491634[_0x75d3('0x29')];this[_0x75d3('0x2a')]=_0x491634[_0x75d3('0x2a')];this[_0x75d3('0x2b')]=_0x491634[_0x75d3('0x2b')];this[_0x75d3('0x2c')]=_0x491634[_0x75d3('0x2c')]||'';this[_0x75d3('0x2d')]=_0x491634[_0x75d3('0x2d')]||'';this[_0x75d3('0x2e')]=_0x491634['agiafterat'];}module[_0x75d3('0x2f')]=AgentComplete; \ No newline at end of file +var _0xfb2d=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','getSeconds','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0xfb2d,0xa6));var _0xdfb2=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0xfb2d[_0x576d8a];return _0x3dc3ef;};'use strict';var moment=require('moment');var utils=require(_0xdfb2('0x0'));function AgentComplete(_0x3a2020,_0x45c3c3){this[_0xdfb2('0x1')]=0x4;this[_0xdfb2('0x2')]='Answer';this[_0xdfb2('0x3')]=_0x3a2020[_0xdfb2('0x3')];this['type']=_0x3a2020[_0xdfb2('0x4')];this[_0xdfb2('0x5')]=_0x3a2020[_0xdfb2('0x4')]===_0xdfb2('0x6')?_0xdfb2('0x7'):_0x3a2020[_0xdfb2('0x4')];this[_0xdfb2('0x8')]=_0x3a2020[_0xdfb2('0x8')];this['countcongestionretry']=_0x3a2020[_0xdfb2('0x9')];this[_0xdfb2('0xa')]=_0x3a2020['countnoanswerretry'];this[_0xdfb2('0xb')]=_0x3a2020[_0xdfb2('0x8')]+_0x3a2020['countcongestionretry']+_0x3a2020[_0xdfb2('0xa')]+_0x3a2020[_0xdfb2('0xc')]+_0x3a2020[_0xdfb2('0xd')]+_0x3a2020[_0xdfb2('0xe')]+_0x3a2020[_0xdfb2('0xf')]+_0x3a2020[_0xdfb2('0x10')];this[_0xdfb2('0xc')]=_0x3a2020[_0xdfb2('0xc')];this[_0xdfb2('0xd')]=_0x3a2020[_0xdfb2('0xd')];this[_0xdfb2('0xe')]=_0x3a2020['countabandonedretry'];this[_0xdfb2('0xf')]=_0x3a2020['countmachineretry'];this[_0xdfb2('0x10')]=_0x3a2020[_0xdfb2('0x10')];this[_0xdfb2('0x11')]=_0x45c3c3[_0xdfb2('0x11')];this[_0xdfb2('0x12')]=_0x3a2020['name'];this[_0xdfb2('0x13')]=_0x3a2020[_0xdfb2('0x14')];this['starttime']=_0x3a2020[_0xdfb2('0x15')];this[_0xdfb2('0x16')]=_0x3a2020[_0xdfb2('0x16')];this[_0xdfb2('0x17')]=_0x3a2020[_0xdfb2('0x17')];this[_0xdfb2('0x18')]=moment()[_0xdfb2('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0xdfb2('0x1a')](_0x3a2020[_0xdfb2('0x16')],_0x3a2020[_0xdfb2('0x15')]);this['holdtime']=utils[_0xdfb2('0x1a')](_0x3a2020[_0xdfb2('0x17')],_0x3a2020[_0xdfb2('0x16')]);this['talktime']=utils['getSeconds'](this[_0xdfb2('0x18')],_0x3a2020[_0xdfb2('0x17')]);this[_0xdfb2('0x7')]=_0x45c3c3[_0xdfb2('0x7')];this['membername']=_0x45c3c3['membername'];this[_0xdfb2('0x1b')]=_0x45c3c3[_0xdfb2('0x1b')];this[_0xdfb2('0x1c')]=_0x3a2020[_0xdfb2('0x1c')];this[_0xdfb2('0x1d')]=_0x3a2020[_0xdfb2('0x1d')];this[_0xdfb2('0x1e')]=_0x3a2020[_0xdfb2('0x1e')];this['recallme']=_0x3a2020[_0xdfb2('0x1f')];this[_0xdfb2('0x20')]=_0x3a2020[_0xdfb2('0x20')];this['ListId']=_0x3a2020['ListId'];this[_0xdfb2('0x21')]=_0x3a2020['UserId'];this[_0xdfb2('0x22')]=_0x3a2020[_0xdfb2('0x22')];this[_0xdfb2('0x23')]=_0x3a2020[_0xdfb2('0x23')];this[_0xdfb2('0x24')]=_0x3a2020['originatecalleridnum']||'';this[_0xdfb2('0x25')]=_0x3a2020[_0xdfb2('0x25')]||'';this[_0xdfb2('0x26')]=_0x3a2020[_0xdfb2('0x26')];}module[_0xdfb2('0x27')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 28d7e8d..4e78273 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4c0=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x572ee8,_0x24ea07){var _0xb87b08=function(_0x114c89){while(--_0x114c89){_0x572ee8['push'](_0x572ee8['shift']());}};_0xb87b08(++_0x24ea07);}(_0xc4c0,0x127));var _0x0c4c=function(_0x458eef,_0x551783){_0x458eef=_0x458eef-0x0;var _0x2fb384=_0xc4c0[_0x458eef];return _0x2fb384;};'use strict';function Final(_0x113d1f){this[_0x0c4c('0x0')]=_0x113d1f[_0x0c4c('0x0')];this[_0x0c4c('0x1')]=_0x113d1f[_0x0c4c('0x1')];this[_0x0c4c('0x2')]=_0x113d1f['type'];this[_0x0c4c('0x3')]=_0x113d1f[_0x0c4c('0x2')]===_0x0c4c('0x4')?_0x0c4c('0x5'):_0x113d1f[_0x0c4c('0x2')];this['countbusyretry']=_0x113d1f[_0x0c4c('0x6')];this['countcongestionretry']=_0x113d1f[_0x0c4c('0x7')];this[_0x0c4c('0x8')]=_0x113d1f[_0x0c4c('0x8')];this[_0x0c4c('0x9')]=_0x113d1f[_0x0c4c('0x6')]+_0x113d1f[_0x0c4c('0x7')]+_0x113d1f[_0x0c4c('0x8')]+_0x113d1f[_0x0c4c('0xa')]+_0x113d1f[_0x0c4c('0xb')]+_0x113d1f[_0x0c4c('0xc')]+_0x113d1f['countmachineretry']+_0x113d1f[_0x0c4c('0xd')];this['countnosuchnumberretry']=_0x113d1f[_0x0c4c('0xa')];this[_0x0c4c('0xb')]=_0x113d1f[_0x0c4c('0xb')];this[_0x0c4c('0xc')]=_0x113d1f[_0x0c4c('0xc')];this[_0x0c4c('0xe')]=_0x113d1f[_0x0c4c('0xe')];this[_0x0c4c('0xd')]=_0x113d1f[_0x0c4c('0xd')];this[_0x0c4c('0x5')]=_0x113d1f[_0x0c4c('0x5')];this['calleridname']=_0x113d1f[_0x0c4c('0xf')];this['calleridnum']=_0x113d1f[_0x0c4c('0x10')];this[_0x0c4c('0x11')]=_0x113d1f['starttime'];this[_0x0c4c('0x12')]=_0x113d1f['responsetime'];this['endtime']=_0x113d1f[_0x0c4c('0x12')];this[_0x0c4c('0x13')]=_0x113d1f[_0x0c4c('0x13')]||0x0;this[_0x0c4c('0x14')]=_0x113d1f['holdtime']||0x0;this[_0x0c4c('0x15')]=_0x113d1f['talktime']||0x0;this[_0x0c4c('0x16')]=_0x113d1f[_0x0c4c('0x16')];this[_0x0c4c('0x17')]=_0x113d1f['callbackuniqueid'];this[_0x0c4c('0x18')]=_0x113d1f[_0x0c4c('0x18')];this['recallme']=_0x113d1f[_0x0c4c('0x19')];this[_0x0c4c('0x1a')]=_0x113d1f['ContactId'];this[_0x0c4c('0x1b')]=_0x113d1f[_0x0c4c('0x1b')];this[_0x0c4c('0x1c')]=_0x113d1f[_0x0c4c('0x1c')];this[_0x0c4c('0x1d')]=_0x113d1f['VoiceQueueId'];this['CampaignId']=_0x113d1f[_0x0c4c('0x1e')];this['originatecalleridnum']=_0x113d1f['originatecalleridnum']||'';this[_0x0c4c('0x1f')]=_0x113d1f['originatecalleridname']||'';this[_0x0c4c('0x20')]=_0x113d1f[_0x0c4c('0x20')];this[_0x0c4c('0x21')]=_0x113d1f['statedesc'];}module['exports']=Final; \ No newline at end of file +var _0x4ab3=['countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x1f83ac,_0x8016fc){var _0x1985de=function(_0x1d5947){while(--_0x1d5947){_0x1f83ac['push'](_0x1f83ac['shift']());}};_0x1985de(++_0x8016fc);}(_0x4ab3,0x84));var _0x34ab=function(_0x4854d6,_0x2f1264){_0x4854d6=_0x4854d6-0x0;var _0x3885c0=_0x4ab3[_0x4854d6];return _0x3885c0;};'use strict';function Final(_0x2a1834){this[_0x34ab('0x0')]=_0x2a1834[_0x34ab('0x0')];this[_0x34ab('0x1')]=_0x2a1834['scheduledat'];this[_0x34ab('0x2')]=_0x2a1834['type'];this[_0x34ab('0x3')]=_0x2a1834[_0x34ab('0x2')]===_0x34ab('0x4')?_0x34ab('0x5'):_0x2a1834[_0x34ab('0x2')];this[_0x34ab('0x6')]=_0x2a1834[_0x34ab('0x6')];this[_0x34ab('0x7')]=_0x2a1834[_0x34ab('0x7')];this[_0x34ab('0x8')]=_0x2a1834[_0x34ab('0x8')];this['countglobal']=_0x2a1834[_0x34ab('0x6')]+_0x2a1834[_0x34ab('0x7')]+_0x2a1834[_0x34ab('0x8')]+_0x2a1834[_0x34ab('0x9')]+_0x2a1834[_0x34ab('0xa')]+_0x2a1834['countabandonedretry']+_0x2a1834[_0x34ab('0xb')]+_0x2a1834['countagentrejectretry'];this[_0x34ab('0x9')]=_0x2a1834[_0x34ab('0x9')];this[_0x34ab('0xa')]=_0x2a1834[_0x34ab('0xa')];this[_0x34ab('0xc')]=_0x2a1834[_0x34ab('0xc')];this['countmachineretry']=_0x2a1834[_0x34ab('0xb')];this[_0x34ab('0xd')]=_0x2a1834[_0x34ab('0xd')];this[_0x34ab('0x5')]=_0x2a1834['queue'];this[_0x34ab('0xe')]=_0x2a1834['calleridname'];this[_0x34ab('0xf')]=_0x2a1834[_0x34ab('0xf')];this[_0x34ab('0x10')]=_0x2a1834[_0x34ab('0x10')];this[_0x34ab('0x11')]=_0x2a1834[_0x34ab('0x11')];this[_0x34ab('0x12')]=_0x2a1834['responsetime'];this[_0x34ab('0x13')]=_0x2a1834['ringtime']||0x0;this['holdtime']=_0x2a1834[_0x34ab('0x14')]||0x0;this[_0x34ab('0x15')]=_0x2a1834[_0x34ab('0x15')]||0x0;this['callback']=_0x2a1834[_0x34ab('0x16')];this[_0x34ab('0x17')]=_0x2a1834[_0x34ab('0x17')];this[_0x34ab('0x18')]=_0x2a1834[_0x34ab('0x18')];this[_0x34ab('0x19')]=_0x2a1834['recallme'];this[_0x34ab('0x1a')]=_0x2a1834[_0x34ab('0x1a')];this[_0x34ab('0x1b')]=_0x2a1834[_0x34ab('0x1b')];this[_0x34ab('0x1c')]=_0x2a1834[_0x34ab('0x1c')];this['VoiceQueueId']=_0x2a1834[_0x34ab('0x1d')];this[_0x34ab('0x1e')]=_0x2a1834[_0x34ab('0x1e')];this[_0x34ab('0x1f')]=_0x2a1834[_0x34ab('0x1f')]||'';this[_0x34ab('0x20')]=_0x2a1834['originatecalleridname']||'';this[_0x34ab('0x21')]=_0x2a1834[_0x34ab('0x21')];this[_0x34ab('0x22')]=_0x2a1834[_0x34ab('0x22')];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 383a42e..8caabac 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x012d=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','endtime','membername','IVR','cause-txt','callback','callbackuniqueid'];(function(_0x8f1d96,_0x41a4f6){var _0xee7f2=function(_0x2cd675){while(--_0x2cd675){_0x8f1d96['push'](_0x8f1d96['shift']());}};_0xee7f2(++_0x41a4f6);}(_0x012d,0x1a2));var _0xd012=function(_0x440064,_0x15230d){_0x440064=_0x440064-0x0;var _0x4f32c7=_0x012d[_0x440064];return _0x4f32c7;};'use strict';var moment=require(_0xd012('0x0'));var utils=require(_0xd012('0x1'));function Hangup(_0x1d52b5,_0x1ddb30){this[_0xd012('0x2')]=0x4;this['statedesc']=_0xd012('0x3');this[_0xd012('0x4')]=_0x1d52b5['scheduledat'];this[_0xd012('0x5')]=_0x1d52b5['type'];this['campaigntype']=_0x1d52b5[_0xd012('0x5')]===_0xd012('0x6')?_0xd012('0x7'):_0x1d52b5[_0xd012('0x5')];this[_0xd012('0x8')]=_0x1d52b5['amd']||![];this[_0xd012('0x9')]=_0x1d52b5[_0xd012('0x9')];this[_0xd012('0xa')]=_0x1d52b5[_0xd012('0xa')];this[_0xd012('0xb')]=_0x1d52b5[_0xd012('0xb')];this['countglobal']=_0x1d52b5[_0xd012('0x9')]+_0x1d52b5[_0xd012('0xa')]+_0x1d52b5[_0xd012('0xb')]+_0x1d52b5[_0xd012('0xc')]+_0x1d52b5[_0xd012('0xd')]+_0x1d52b5['countabandonedretry']+_0x1d52b5['countmachineretry']+_0x1d52b5['countagentrejectretry'];this[_0xd012('0xc')]=_0x1d52b5[_0xd012('0xc')];this[_0xd012('0xd')]=_0x1d52b5[_0xd012('0xd')];this[_0xd012('0xe')]=_0x1d52b5[_0xd012('0xe')];this[_0xd012('0xf')]=_0x1d52b5[_0xd012('0xf')];this[_0xd012('0x10')]=_0x1d52b5[_0xd012('0x10')];this[_0xd012('0x11')]=_0x1ddb30['uniqueid'];this['calleridname']=_0x1d52b5['name'];this[_0xd012('0x12')]=_0x1d52b5[_0xd012('0x13')];this[_0xd012('0x14')]=_0x1d52b5[_0xd012('0x14')];this['responsetime']=_0x1d52b5[_0xd012('0x15')];this['endtime']=moment()[_0xd012('0x16')](_0xd012('0x17'));this[_0xd012('0x18')]=utils['getSeconds'](_0x1d52b5[_0xd012('0x15')],_0x1d52b5[_0xd012('0x14')]);this[_0xd012('0x19')]=0x0;this['talktime']=utils[_0xd012('0x1a')](this[_0xd012('0x1b')],_0x1d52b5['responsetime']);this[_0xd012('0x7')]=_0x1d52b5['queue'];this[_0xd012('0x1c')]=_0xd012('0x1d');this['reason']=_0x1ddb30[_0xd012('0x1e')];this['callback']=_0x1d52b5[_0xd012('0x1f')];this[_0xd012('0x20')]=_0x1d52b5[_0xd012('0x20')];this[_0xd012('0x21')]=_0x1d52b5[_0xd012('0x21')];this[_0xd012('0x22')]=_0x1d52b5[_0xd012('0x22')];this['ContactId']=_0x1d52b5[_0xd012('0x23')];this[_0xd012('0x24')]=_0x1d52b5['ListId'];this[_0xd012('0x25')]=_0x1d52b5[_0xd012('0x25')];this[_0xd012('0x26')]=_0x1d52b5[_0xd012('0x26')];this['CampaignId']=_0x1d52b5[_0xd012('0x27')];}module[_0xd012('0x28')]=Hangup; \ No newline at end of file +var _0x1ba9=['scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','moment','../utils','statedesc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ba9,0x1b5));var _0x91ba=function(_0x153a58,_0x47bff1){_0x153a58=_0x153a58-0x0;var _0x26146d=_0x1ba9[_0x153a58];return _0x26146d;};'use strict';var moment=require(_0x91ba('0x0'));var utils=require(_0x91ba('0x1'));function Hangup(_0xa11975,_0x14d5f9){this['state']=0x4;this[_0x91ba('0x2')]='Answer';this[_0x91ba('0x3')]=_0xa11975[_0x91ba('0x3')];this[_0x91ba('0x4')]=_0xa11975[_0x91ba('0x4')];this[_0x91ba('0x5')]=_0xa11975[_0x91ba('0x4')]===_0x91ba('0x6')?_0x91ba('0x7'):_0xa11975[_0x91ba('0x4')];this[_0x91ba('0x8')]=_0xa11975['amd']||![];this[_0x91ba('0x9')]=_0xa11975[_0x91ba('0x9')];this['countcongestionretry']=_0xa11975[_0x91ba('0xa')];this[_0x91ba('0xb')]=_0xa11975[_0x91ba('0xb')];this[_0x91ba('0xc')]=_0xa11975['countbusyretry']+_0xa11975[_0x91ba('0xa')]+_0xa11975[_0x91ba('0xb')]+_0xa11975[_0x91ba('0xd')]+_0xa11975[_0x91ba('0xe')]+_0xa11975[_0x91ba('0xf')]+_0xa11975['countmachineretry']+_0xa11975['countagentrejectretry'];this[_0x91ba('0xd')]=_0xa11975[_0x91ba('0xd')];this[_0x91ba('0xe')]=_0xa11975[_0x91ba('0xe')];this[_0x91ba('0xf')]=_0xa11975[_0x91ba('0xf')];this[_0x91ba('0x10')]=_0xa11975[_0x91ba('0x10')];this[_0x91ba('0x11')]=_0xa11975[_0x91ba('0x11')];this['uniqueid']=_0x14d5f9[_0x91ba('0x12')];this[_0x91ba('0x13')]=_0xa11975['name'];this['calleridnum']=_0xa11975[_0x91ba('0x14')];this[_0x91ba('0x15')]=_0xa11975['starttime'];this[_0x91ba('0x16')]=_0xa11975[_0x91ba('0x16')];this[_0x91ba('0x17')]=moment()['format'](_0x91ba('0x18'));this[_0x91ba('0x19')]=utils[_0x91ba('0x1a')](_0xa11975[_0x91ba('0x16')],_0xa11975['starttime']);this[_0x91ba('0x1b')]=0x0;this[_0x91ba('0x1c')]=utils[_0x91ba('0x1a')](this['endtime'],_0xa11975[_0x91ba('0x16')]);this[_0x91ba('0x7')]=_0xa11975[_0x91ba('0x7')];this[_0x91ba('0x1d')]=_0x91ba('0x1e');this[_0x91ba('0x1f')]=_0x14d5f9['cause-txt'];this['callback']=_0xa11975[_0x91ba('0x20')];this[_0x91ba('0x21')]=_0xa11975[_0x91ba('0x21')];this[_0x91ba('0x22')]=_0xa11975['callbackat'];this[_0x91ba('0x23')]=_0xa11975[_0x91ba('0x23')];this[_0x91ba('0x24')]=_0xa11975[_0x91ba('0x24')];this['ListId']=_0xa11975['ListId'];this['UserId']=_0xa11975[_0x91ba('0x25')];this[_0x91ba('0x26')]=_0xa11975[_0x91ba('0x26')];this['CampaignId']=_0xa11975[_0x91ba('0x27')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 0842610..547af7b 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13d4=['../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc'];(function(_0xb49d1d,_0xc3d8c5){var _0x25bd0e=function(_0x467f19){while(--_0x467f19){_0xb49d1d['push'](_0xb49d1d['shift']());}};_0x25bd0e(++_0xc3d8c5);}(_0x13d4,0x130));var _0x413d=function(_0x19668f,_0x2606d5){_0x19668f=_0x19668f-0x0;var _0x38c261=_0x13d4[_0x19668f];return _0x38c261;};'use strict';var utils=require(_0x413d('0x0'));function History(_0x2be475){this[_0x413d('0x1')]=_0x2be475['uniqueid'];this['scheduledat']=_0x2be475[_0x413d('0x2')]||undefined;this[_0x413d('0x3')]=_0x2be475[_0x413d('0x3')];this[_0x413d('0x4')]=_0x2be475[_0x413d('0x3')]===_0x413d('0x5')?_0x413d('0x6'):_0x2be475['type'];this[_0x413d('0x7')]=_0x2be475[_0x413d('0x7')];this['countcongestionretry']=_0x2be475[_0x413d('0x8')];this['countnoanswerretry']=_0x2be475[_0x413d('0x9')];this[_0x413d('0xa')]=_0x2be475[_0x413d('0x7')]+_0x2be475[_0x413d('0x8')]+_0x2be475['countnoanswerretry']+_0x2be475[_0x413d('0xb')]+_0x2be475[_0x413d('0xc')]+_0x2be475[_0x413d('0xd')]+_0x2be475[_0x413d('0xe')]+_0x2be475['countagentrejectretry'];this[_0x413d('0xb')]=_0x2be475[_0x413d('0xb')];this['countdropretry']=_0x2be475[_0x413d('0xc')];this[_0x413d('0xd')]=_0x2be475[_0x413d('0xd')];this[_0x413d('0xe')]=_0x2be475['countmachineretry'];this[_0x413d('0xf')]=_0x2be475[_0x413d('0xf')];this['queue']=_0x2be475['queue'];this[_0x413d('0x10')]=_0x2be475[_0x413d('0x11')];this[_0x413d('0x12')]=_0x2be475[_0x413d('0x13')];this['starttime']=_0x2be475[_0x413d('0x14')];this['responsetime']=_0x2be475[_0x413d('0x15')];this[_0x413d('0x16')]=_0x2be475[_0x413d('0x15')];this[_0x413d('0x17')]=utils['getSeconds'](_0x2be475['responsetime'],_0x2be475['starttime']);this['holdtime']=0x0;this[_0x413d('0x18')]=0x0;this[_0x413d('0x19')]=_0x2be475['callback'];this[_0x413d('0x1a')]=_0x2be475[_0x413d('0x1a')];this[_0x413d('0x1b')]=_0x2be475[_0x413d('0x1b')];this['recallme']=_0x2be475[_0x413d('0x1c')];this[_0x413d('0x1d')]=_0x2be475[_0x413d('0x1d')];this[_0x413d('0x1e')]=_0x2be475[_0x413d('0x1e')];this[_0x413d('0x1f')]=_0x2be475['UserId'];this[_0x413d('0x20')]=_0x2be475[_0x413d('0x20')];this[_0x413d('0x21')]=_0x2be475['CampaignId'];this[_0x413d('0x22')]=_0x2be475[_0x413d('0x22')]||'';this[_0x413d('0x23')]=_0x2be475[_0x413d('0x23')]||'';this[_0x413d('0x24')]=_0x2be475[_0x413d('0x24')];this[_0x413d('0x25')]=_0x2be475[_0x413d('0x25')];}module['exports']=History; \ No newline at end of file +var _0x6d99=['calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d99,0x1a7));var _0x96d9=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x6d99[_0x23c73d];return _0x36ba47;};'use strict';var utils=require(_0x96d9('0x0'));function History(_0x10b4c3){this[_0x96d9('0x1')]=_0x10b4c3[_0x96d9('0x1')];this[_0x96d9('0x2')]=_0x10b4c3[_0x96d9('0x2')]||undefined;this[_0x96d9('0x3')]=_0x10b4c3['type'];this[_0x96d9('0x4')]=_0x10b4c3[_0x96d9('0x3')]===_0x96d9('0x5')?_0x96d9('0x6'):_0x10b4c3[_0x96d9('0x3')];this[_0x96d9('0x7')]=_0x10b4c3[_0x96d9('0x7')];this[_0x96d9('0x8')]=_0x10b4c3[_0x96d9('0x8')];this['countnoanswerretry']=_0x10b4c3['countnoanswerretry'];this[_0x96d9('0x9')]=_0x10b4c3[_0x96d9('0x7')]+_0x10b4c3[_0x96d9('0x8')]+_0x10b4c3[_0x96d9('0xa')]+_0x10b4c3['countnosuchnumberretry']+_0x10b4c3[_0x96d9('0xb')]+_0x10b4c3[_0x96d9('0xc')]+_0x10b4c3[_0x96d9('0xd')]+_0x10b4c3['countagentrejectretry'];this['countnosuchnumberretry']=_0x10b4c3[_0x96d9('0xe')];this[_0x96d9('0xb')]=_0x10b4c3[_0x96d9('0xb')];this[_0x96d9('0xc')]=_0x10b4c3['countabandonedretry'];this[_0x96d9('0xd')]=_0x10b4c3['countmachineretry'];this[_0x96d9('0xf')]=_0x10b4c3[_0x96d9('0xf')];this[_0x96d9('0x6')]=_0x10b4c3[_0x96d9('0x6')];this[_0x96d9('0x10')]=_0x10b4c3['name'];this[_0x96d9('0x11')]=_0x10b4c3[_0x96d9('0x12')];this[_0x96d9('0x13')]=_0x10b4c3[_0x96d9('0x13')];this[_0x96d9('0x14')]=_0x10b4c3['responsetime'];this[_0x96d9('0x15')]=_0x10b4c3[_0x96d9('0x14')];this[_0x96d9('0x16')]=utils[_0x96d9('0x17')](_0x10b4c3[_0x96d9('0x14')],_0x10b4c3['starttime']);this[_0x96d9('0x18')]=0x0;this[_0x96d9('0x19')]=0x0;this[_0x96d9('0x1a')]=_0x10b4c3['callback'];this[_0x96d9('0x1b')]=_0x10b4c3[_0x96d9('0x1b')];this[_0x96d9('0x1c')]=_0x10b4c3['callbackat'];this[_0x96d9('0x1d')]=_0x10b4c3[_0x96d9('0x1d')];this[_0x96d9('0x1e')]=_0x10b4c3['ContactId'];this[_0x96d9('0x1f')]=_0x10b4c3[_0x96d9('0x1f')];this['UserId']=_0x10b4c3[_0x96d9('0x20')];this[_0x96d9('0x21')]=_0x10b4c3['VoiceQueueId'];this[_0x96d9('0x22')]=_0x10b4c3[_0x96d9('0x22')];this[_0x96d9('0x23')]=_0x10b4c3[_0x96d9('0x23')]||'';this['originatecalleridname']=_0x10b4c3[_0x96d9('0x24')]||'';this[_0x96d9('0x25')]=_0x10b4c3[_0x96d9('0x25')];this[_0x96d9('0x26')]=_0x10b4c3['statedesc'];}module[_0x96d9('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index b54014c..c39529e 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x987c=['talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','getSeconds','holdtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x987c,0xe5));var _0xc987=function(_0x522ceb,_0x5f493b){_0x522ceb=_0x522ceb-0x0;var _0x58dbb2=_0x987c[_0x522ceb];return _0x58dbb2;};'use strict';var utils=require(_0xc987('0x0'));function QueueCallerAbandon(_0x3962ee,_0xcf1698){this[_0xc987('0x1')]=_0x3962ee[_0xc987('0x1')];this[_0xc987('0x2')]=_0x3962ee[_0xc987('0x2')];this['campaigntype']=_0x3962ee[_0xc987('0x2')]==='outbound'?'queue':_0x3962ee[_0xc987('0x2')];this[_0xc987('0x3')]=_0x3962ee['countbusyretry'];this[_0xc987('0x4')]=_0x3962ee[_0xc987('0x4')];this[_0xc987('0x5')]=_0x3962ee[_0xc987('0x5')];this[_0xc987('0x6')]=_0x3962ee[_0xc987('0x3')]+_0x3962ee[_0xc987('0x4')]+_0x3962ee['countnoanswerretry']+_0x3962ee[_0xc987('0x7')]+_0x3962ee[_0xc987('0x8')]+_0x3962ee[_0xc987('0x9')]+_0x3962ee[_0xc987('0xa')]+_0x3962ee[_0xc987('0xb')];this['countnosuchnumberretry']=_0x3962ee[_0xc987('0x7')];this['countdropretry']=_0x3962ee['countdropretry'];this['countabandonedretry']=_0x3962ee[_0xc987('0x9')];this['countmachineretry']=_0x3962ee[_0xc987('0xa')];this['countagentrejectretry']=_0x3962ee[_0xc987('0xb')];this[_0xc987('0xc')]=_0xcf1698[_0xc987('0xc')];this[_0xc987('0xd')]=_0x3962ee[_0xc987('0xe')];this[_0xc987('0xf')]=_0x3962ee[_0xc987('0x10')];this[_0xc987('0x11')]=_0x3962ee[_0xc987('0x11')];this[_0xc987('0x12')]=_0x3962ee[_0xc987('0x12')];this[_0xc987('0x13')]=_0x3962ee[_0xc987('0x13')];this['dropreason']=_0x3962ee['dropreason'];this[_0xc987('0x14')]=this[_0xc987('0x13')];this['ringtime']=utils[_0xc987('0x15')](_0x3962ee['responsetime'],_0x3962ee[_0xc987('0x11')]);this[_0xc987('0x16')]=utils[_0xc987('0x15')](this[_0xc987('0x13')],_0x3962ee['responsetime']);this[_0xc987('0x17')]=0x0;this[_0xc987('0x18')]=_0xcf1698[_0xc987('0x18')];this[_0xc987('0x19')]=_0xcf1698['connectedlinename'];this[_0xc987('0x1a')]=_0xcf1698['reason'];this[_0xc987('0x1b')]=_0x3962ee[_0xc987('0x1b')];this[_0xc987('0x1c')]=_0x3962ee[_0xc987('0x1c')];this[_0xc987('0x1d')]=_0x3962ee[_0xc987('0x1d')];this['recallme']=_0x3962ee[_0xc987('0x1e')];this[_0xc987('0x1f')]=_0x3962ee[_0xc987('0x1f')];this[_0xc987('0x20')]=_0x3962ee[_0xc987('0x20')];this[_0xc987('0x21')]=_0x3962ee[_0xc987('0x21')];this[_0xc987('0x22')]=_0x3962ee[_0xc987('0x22')];this['CampaignId']=_0x3962ee[_0xc987('0x23')];this['originatecalleridnum']=_0x3962ee[_0xc987('0x24')]||'';this['originatecalleridname']=_0x3962ee[_0xc987('0x25')]||'';this[_0xc987('0x26')]=_0x3962ee[_0xc987('0x26')];this[_0xc987('0x27')]=_0x3962ee['state'];this['statedesc']=_0x3962ee[_0xc987('0x28')];}module[_0xc987('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xa0e0=['originatecalleridname','agiafterat','state','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x5cb052,_0x44f6df){var _0x337f47=function(_0x36c236){while(--_0x36c236){_0x5cb052['push'](_0x5cb052['shift']());}};_0x337f47(++_0x44f6df);}(_0xa0e0,0x106));var _0x0a0e=function(_0x24d8ac,_0x499232){_0x24d8ac=_0x24d8ac-0x0;var _0x973555=_0xa0e0[_0x24d8ac];return _0x973555;};'use strict';var utils=require(_0x0a0e('0x0'));function QueueCallerAbandon(_0x33b912,_0x466a3e){this[_0x0a0e('0x1')]=_0x33b912[_0x0a0e('0x1')];this[_0x0a0e('0x2')]=_0x33b912[_0x0a0e('0x2')];this[_0x0a0e('0x3')]=_0x33b912['type']===_0x0a0e('0x4')?_0x0a0e('0x5'):_0x33b912[_0x0a0e('0x2')];this[_0x0a0e('0x6')]=_0x33b912[_0x0a0e('0x6')];this[_0x0a0e('0x7')]=_0x33b912[_0x0a0e('0x7')];this[_0x0a0e('0x8')]=_0x33b912[_0x0a0e('0x8')];this['countglobal']=_0x33b912[_0x0a0e('0x6')]+_0x33b912[_0x0a0e('0x7')]+_0x33b912[_0x0a0e('0x8')]+_0x33b912['countnosuchnumberretry']+_0x33b912['countdropretry']+_0x33b912[_0x0a0e('0x9')]+_0x33b912[_0x0a0e('0xa')]+_0x33b912[_0x0a0e('0xb')];this[_0x0a0e('0xc')]=_0x33b912[_0x0a0e('0xc')];this[_0x0a0e('0xd')]=_0x33b912[_0x0a0e('0xd')];this[_0x0a0e('0x9')]=_0x33b912[_0x0a0e('0x9')];this[_0x0a0e('0xa')]=_0x33b912[_0x0a0e('0xa')];this['countagentrejectretry']=_0x33b912['countagentrejectretry'];this[_0x0a0e('0xe')]=_0x466a3e[_0x0a0e('0xe')];this['calleridname']=_0x33b912[_0x0a0e('0xf')];this[_0x0a0e('0x10')]=_0x33b912[_0x0a0e('0x11')];this[_0x0a0e('0x12')]=_0x33b912['starttime'];this[_0x0a0e('0x13')]=_0x33b912[_0x0a0e('0x13')];this[_0x0a0e('0x14')]=_0x33b912['droptime'];this[_0x0a0e('0x15')]=_0x33b912[_0x0a0e('0x15')];this[_0x0a0e('0x16')]=this['droptime'];this[_0x0a0e('0x17')]=utils[_0x0a0e('0x18')](_0x33b912[_0x0a0e('0x13')],_0x33b912[_0x0a0e('0x12')]);this[_0x0a0e('0x19')]=utils[_0x0a0e('0x18')](this['droptime'],_0x33b912['responsetime']);this[_0x0a0e('0x1a')]=0x0;this[_0x0a0e('0x5')]=_0x466a3e[_0x0a0e('0x5')];this[_0x0a0e('0x1b')]=_0x466a3e[_0x0a0e('0x1c')];this[_0x0a0e('0x1d')]=_0x466a3e[_0x0a0e('0x1d')];this[_0x0a0e('0x1e')]=_0x33b912[_0x0a0e('0x1e')];this[_0x0a0e('0x1f')]=_0x33b912['callbackuniqueid'];this[_0x0a0e('0x20')]=_0x33b912[_0x0a0e('0x20')];this[_0x0a0e('0x21')]=_0x33b912['recallme'];this['ContactId']=_0x33b912['ContactId'];this[_0x0a0e('0x22')]=_0x33b912['ListId'];this['UserId']=_0x33b912[_0x0a0e('0x23')];this['VoiceQueueId']=_0x33b912[_0x0a0e('0x24')];this[_0x0a0e('0x25')]=_0x33b912[_0x0a0e('0x25')];this[_0x0a0e('0x26')]=_0x33b912[_0x0a0e('0x26')]||'';this[_0x0a0e('0x27')]=_0x33b912[_0x0a0e('0x27')]||'';this[_0x0a0e('0x28')]=_0x33b912['agiafterat'];this[_0x0a0e('0x29')]=_0x33b912[_0x0a0e('0x29')];this['statedesc']=_0x33b912['statedesc'];}module[_0x0a0e('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 043d5d7..7f74944 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6b0=['[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x44e285,_0x403ae1){_0x44e285=_0x44e285-0x0;var _0x198a0d=_0xa6b0[_0x44e285];return _0x198a0d;};'use strict';var util=require(_0x0a6b('0x0'));var logger=require(_0x0a6b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x0a6b('0x2'));var cmHopperBlack=require(_0x0a6b('0x3'));var cmHopperHistory=require(_0x0a6b('0x4'));function inspectError(_0x4c9a84){return util[_0x0a6b('0x5')](_0x4c9a84,{'showHidden':![],'depth':null});}function getContactDialer(_0x33e8c3,_0x195697,_0xc7140c){return cmHopper[_0x0a6b('0x6')](_0x33e8c3['id'],_0x195697,_0xc7140c,_0x33e8c3[_0x0a6b('0x7')])[_0x0a6b('0x8')](function(_0xa908dd){_0x33e8c3[_0x0a6b('0x9')]=0x0;logger[_0x0a6b('0xa')](_0x0a6b('0xb'),inspectError(_0xa908dd));});}exports[_0x0a6b('0x6')]=getContactDialer;function getContactDialerIvr(_0x5046d8,_0x493948){return cmHopper[_0x0a6b('0xc')](_0x5046d8['id'],_0x493948,_0x5046d8[_0x0a6b('0x7')])[_0x0a6b('0x8')](function(_0x25ad47){_0x5046d8[_0x0a6b('0x9')]=0x0;logger[_0x0a6b('0xa')](_0x0a6b('0xd'),inspectError(_0x25ad47));});}exports[_0x0a6b('0xc')]=getContactDialerIvr;function countReScheduled(_0x8bbed9){return cmHopper[_0x0a6b('0xe')](_0x8bbed9)[_0x0a6b('0x8')](function(_0x890493){logger[_0x0a6b('0xa')](_0x0a6b('0xf'),inspectError(_0x890493));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x5e59a5){return cmHopper[_0x0a6b('0x10')](_0x5e59a5)[_0x0a6b('0x8')](function(_0x2abc4e){logger[_0x0a6b('0xa')](_0x0a6b('0x11'),inspectError(_0x2abc4e));});}exports[_0x0a6b('0x10')]=rescheduleContact;function unlockContact(_0x9bb98e,_0x19e84c,_0x1205a3){return cmHopper[_0x0a6b('0x12')](_0x9bb98e,_0x19e84c,_0x1205a3)['catch'](function(_0xa36d75){logger[_0x0a6b('0xa')]('[unlockContact]',inspectError(_0xa36d75));});}exports[_0x0a6b('0x12')]=unlockContact;function moveContactManagedDialer(_0x4d0e3b){return cmHopper[_0x0a6b('0x13')](_0x4d0e3b)[_0x0a6b('0x8')](function(_0x2cb10b){logger[_0x0a6b('0xa')]('[moveContactManagedDialer]',inspectError(_0x2cb10b));});}exports[_0x0a6b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x296162){return cmHopperBlack['checkIsBlackList'](_0x296162)[_0x0a6b('0x8')](function(_0x3f23b4){logger[_0x0a6b('0xa')]('[checkIsBlackList]',inspectError(_0x3f23b4));});}exports[_0x0a6b('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x93a465){return cmHopperBlack[_0x0a6b('0x15')](_0x93a465)['catch'](function(_0x220d3e){logger[_0x0a6b('0xa')](_0x0a6b('0x16'),inspectError(_0x220d3e));});}exports[_0x0a6b('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x122c19,_0x53848c,_0x1e5065){return cmHopperAdditionalPhone[_0x0a6b('0x17')](_0x122c19,_0x53848c,_0x1e5065)[_0x0a6b('0x8')](function(_0x5c77fb){logger[_0x0a6b('0xa')](_0x0a6b('0x18'),inspectError(_0x5c77fb));});}exports[_0x0a6b('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1b8b78,_0x3b12a2,_0x5b2229){return cmHopperAdditionalPhone[_0x0a6b('0x19')](_0x1b8b78,_0x3b12a2,_0x5b2229)[_0x0a6b('0x8')](function(_0x19a653){logger['error'](_0x0a6b('0x1a'),inspectError(_0x19a653));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0xecbf0c){return cmHopperHistory[_0x0a6b('0x1b')](_0xecbf0c)[_0x0a6b('0x8')](function(_0x4884a1){logger['error'](_0x0a6b('0x1c'),inspectError(_0x4884a1));});}exports[_0x0a6b('0x1b')]=avgHandleTime;function createHistory(_0x1aecc7){return cmHopperHistory[_0x0a6b('0x1d')](_0x1aecc7)[_0x0a6b('0x8')](function(_0x2bbcb1){logger['error'](_0x0a6b('0x1e'),inspectError(_0x2bbcb1));});}exports[_0x0a6b('0x1d')]=createHistory; \ No newline at end of file +var _0x6a55=['temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','util','../../rpc/cmHopperAdditionalPhone','getContactDialer','dialOrderByScheduledAt','catch'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0x6a55,0xdb));var _0x56a5=function(_0xc4ea75,_0x273753){_0xc4ea75=_0xc4ea75-0x0;var _0x52ea5e=_0x6a55[_0xc4ea75];return _0x52ea5e;};'use strict';var util=require(_0x56a5('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x56a5('0x1'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x116199){return util['inspect'](_0x116199,{'showHidden':![],'depth':null});}function getContactDialer(_0x3ff76a,_0x5171fa,_0x28bb2b){return cmHopper[_0x56a5('0x2')](_0x3ff76a['id'],_0x5171fa,_0x28bb2b,_0x3ff76a[_0x56a5('0x3')])[_0x56a5('0x4')](function(_0x444c65){_0x3ff76a[_0x56a5('0x5')]=0x0;logger[_0x56a5('0x6')](_0x56a5('0x7'),inspectError(_0x444c65));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1c9e7a,_0xf15490){return cmHopper[_0x56a5('0x8')](_0x1c9e7a['id'],_0xf15490,_0x1c9e7a[_0x56a5('0x3')])[_0x56a5('0x4')](function(_0x3a721d){_0x1c9e7a[_0x56a5('0x5')]=0x0;logger[_0x56a5('0x6')](_0x56a5('0x9'),inspectError(_0x3a721d));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x49711d){return cmHopper[_0x56a5('0xa')](_0x49711d)[_0x56a5('0x4')](function(_0x2b9d7d){logger[_0x56a5('0x6')](_0x56a5('0xb'),inspectError(_0x2b9d7d));});}exports[_0x56a5('0xa')]=countReScheduled;function rescheduleContact(_0x4db11b){return cmHopper['rescheduleContact'](_0x4db11b)[_0x56a5('0x4')](function(_0x1e416f){logger[_0x56a5('0x6')](_0x56a5('0xc'),inspectError(_0x1e416f));});}exports[_0x56a5('0xd')]=rescheduleContact;function unlockContact(_0x2db112,_0xe3091f,_0x5c4028){return cmHopper[_0x56a5('0xe')](_0x2db112,_0xe3091f,_0x5c4028)['catch'](function(_0x41e8b6){logger['error'](_0x56a5('0xf'),inspectError(_0x41e8b6));});}exports[_0x56a5('0xe')]=unlockContact;function moveContactManagedDialer(_0x173c65){return cmHopper[_0x56a5('0x10')](_0x173c65)[_0x56a5('0x4')](function(_0x143f3d){logger[_0x56a5('0x6')]('[moveContactManagedDialer]',inspectError(_0x143f3d));});}exports[_0x56a5('0x10')]=moveContactManagedDialer;function checkIsBlackList(_0x3db687){return cmHopperBlack[_0x56a5('0x11')](_0x3db687)[_0x56a5('0x4')](function(_0x52eee2){logger[_0x56a5('0x6')](_0x56a5('0x12'),inspectError(_0x52eee2));});}exports[_0x56a5('0x11')]=checkIsBlackList;function checkIsBlackListIvr(_0x15e469){return cmHopperBlack[_0x56a5('0x13')](_0x15e469)['catch'](function(_0x55579d){logger[_0x56a5('0x6')](_0x56a5('0x14'),inspectError(_0x55579d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1556eb,_0x309fa5,_0x615d49){return cmHopperAdditionalPhone[_0x56a5('0x15')](_0x1556eb,_0x309fa5,_0x615d49)[_0x56a5('0x4')](function(_0x616922){logger[_0x56a5('0x6')](_0x56a5('0x16'),inspectError(_0x616922));});}exports[_0x56a5('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2035c7,_0xcf212,_0x2f203f){return cmHopperAdditionalPhone[_0x56a5('0x17')](_0x2035c7,_0xcf212,_0x2f203f)['catch'](function(_0x5c76a7){logger[_0x56a5('0x6')](_0x56a5('0x18'),inspectError(_0x5c76a7));});}exports[_0x56a5('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x43a815){return cmHopperHistory['avgHandleTime'](_0x43a815)[_0x56a5('0x4')](function(_0x54ec36){logger[_0x56a5('0x6')](_0x56a5('0x19'),inspectError(_0x54ec36));});}exports[_0x56a5('0x1a')]=avgHandleTime;function createHistory(_0x284ee5){return cmHopperHistory['createHistory'](_0x284ee5)[_0x56a5('0x4')](function(_0x1f7aeb){logger[_0x56a5('0x6')]('[createHistory]',inspectError(_0x1f7aeb));});}exports[_0x56a5('0x1b')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 2410845..fc9fa8b 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9b8=['checkContactLowerLimitOriginate','createdAt','undefined','XMD-','substring','toUpperCase','setXMDContactVariables','lodash','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','dialMethod','dialActive','message','available','loggedIn','loggedInDb','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','isEmpty','Intervals','EMPTY_INTERVAL','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','random','toString','getCallerIdRandom','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20'];(function(_0x153e91,_0x25ba85){var _0x10863d=function(_0x23e46e){while(--_0x23e46e){_0x153e91['push'](_0x153e91['shift']());}};_0x10863d(++_0x25ba85);}(_0xe9b8,0xf7));var _0x8e9b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe9b8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8e9b('0x0'));var moment=require('moment');var util=require('util');var logger=require(_0x8e9b('0x1'))(_0x8e9b('0x2'));var timezones=require(_0x8e9b('0x3'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x8e9b('0x4'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x8e9b('0x5'),'DEACTIVATED':_0x8e9b('0x6'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x8e9b('0x7'),'INACTIVE':_0x8e9b('0x8'),'NO_AGENTS_LOGGED':_0x8e9b('0x9'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x8e9b('0xa'),'QUEUE_RECALL':_0x8e9b('0xb'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x8e9b('0xc'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x8e9b('0xd')};exports[_0x8e9b('0xe')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x268c70){return _0x268c70['dialMethod']===_0x8e9b('0xf');}exports[_0x8e9b('0x10')]=isPreviewCampaign;function isIVRCampaign(_0x4fa5d0){return _0x4fa5d0[_0x8e9b('0x11')]==='ivr';}exports[_0x8e9b('0x12')]=isIVRCampaign;function isOutboundQueue(_0x459145){return _0x459145[_0x8e9b('0x11')]===_0x8e9b('0x13');}exports[_0x8e9b('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x4d719a){return _0x4d719a['dialActive'];}exports[_0x8e9b('0x15')]=isQueueCampaignActive;function isIVRCampaignActive(_0x549ae4){return _0x549ae4[_0x8e9b('0x16')];}exports[_0x8e9b('0x17')]=isIVRCampaignActive;function getSeconds(_0x238e9c,_0x54a520){var _0x5c86da=moment(_0x238e9c)['milliseconds'](0x0);var _0x1b6158=moment(_0x54a520)[_0x8e9b('0x18')](0x0);return _0x5c86da[_0x8e9b('0x19')](_0x1b6158,_0x8e9b('0x1a'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x52bdb9,_0x18c47e){var _0x2142d2=![];var _0x560bba=_0x52bdb9[_0x8e9b('0x1b')]!==_0x18c47e[_0x8e9b('0x1b')]||_0x52bdb9[_0x8e9b('0x1c')]!==_0x18c47e['dialActive']||_0x52bdb9[_0x8e9b('0x1d')]!==_0x18c47e[_0x8e9b('0x1d')];var _0x5b3f28=_0x52bdb9['available']!==_0x18c47e[_0x8e9b('0x1e')]||_0x52bdb9[_0x8e9b('0x1f')]!==_0x18c47e['loggedIn']||_0x52bdb9[_0x8e9b('0x20')]!==_0x18c47e[_0x8e9b('0x20')]||_0x52bdb9['paused']!==_0x18c47e['paused']||_0x52bdb9['talking']!==_0x18c47e[_0x8e9b('0x21')]||_0x52bdb9[_0x8e9b('0x22')]!==_0x18c47e[_0x8e9b('0x22')]||_0x52bdb9[_0x8e9b('0x23')]!==_0x18c47e['waiting']||_0x52bdb9[_0x8e9b('0x24')]!==_0x18c47e[_0x8e9b('0x24')]||_0x52bdb9[_0x8e9b('0x25')]!==_0x18c47e[_0x8e9b('0x25')];if(_0x52bdb9[_0x8e9b('0x26')]&&_0x18c47e[_0x8e9b('0x26')]){_0x2142d2=_0x52bdb9[_0x8e9b('0x26')][_0x8e9b('0x27')]!==_0x18c47e['Trunk'][_0x8e9b('0x27')]||_0x52bdb9['Trunk'][_0x8e9b('0x16')]!==_0x18c47e[_0x8e9b('0x26')][_0x8e9b('0x16')];}return _0x560bba||_0x5b3f28||_0x2142d2;}exports[_0x8e9b('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x40e494){var _0x392f47=null;var _0x559041=_0x40e494[_0x8e9b('0x29')];if(_[_0x8e9b('0x2a')](_0x40e494[_0x8e9b('0x2b')])||_[_0x8e9b('0x2a')](_0x40e494[_0x8e9b('0x2c')])||_[_0x8e9b('0x2a')](_0x40e494[_0x8e9b('0x2c')]['Intervals'])){_0x392f47=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_['isEmpty'](_0x40e494[_0x8e9b('0x2b')])||_[_0x8e9b('0x2d')](_0x40e494[_0x8e9b('0x2c')][_0x8e9b('0x2e')])){_0x392f47=CAMPAIGN_STATUS[_0x8e9b('0x2f')];}else if(_0x559041&&!timezones[_0x559041]){_0x392f47=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x392f47;}function checkAnyValidTrunk(_0x588210,_0x53ffa2){var _0x5ada94=null;var _0x2db2ea='SIP/';var _0x242064=[_0x8e9b('0x30'),_0x8e9b('0x31')];var _0x45e096=!![];if(_0x588210[_0x8e9b('0x26')]&&_0x588210[_0x8e9b('0x26')][_0x8e9b('0x16')]){_0x2db2ea+=_0x588210[_0x8e9b('0x26')][_0x8e9b('0x27')];_0x5ada94=_0x53ffa2[_0x2db2ea];_0x45e096=_0x242064[_0x8e9b('0x32')](_0x5ada94[_0x8e9b('0x33')]);}else if(_0x588210[_0x8e9b('0x34')]&&_0x588210['TrunkBackup'][_0x8e9b('0x16')]){_0x2db2ea+=_0x588210[_0x8e9b('0x34')][_0x8e9b('0x27')];_0x5ada94=_0x53ffa2[_0x2db2ea];_0x45e096=_0x242064['includes'](_0x5ada94[_0x8e9b('0x33')]);}return _0x45e096;}function getQueueCampaignStatusMessage(_0x20d4cb,_0x493515){var _0x245fdb=CAMPAIGN_STATUS[_0x8e9b('0x4')];var _0x5873a2=isPreviewCampaign(_0x20d4cb);if(!isQueueCampaignActive(_0x20d4cb)){if(_0x5873a2){_0x245fdb=CAMPAIGN_STATUS[_0x8e9b('0x35')];}else{if(_0x20d4cb['originated']===0x0&&_0x20d4cb['talking']===0x0&&_0x20d4cb['waiting']===0x0&&(_0x20d4cb[_0x8e9b('0x22')]||0x0)===0x0){_0x245fdb=CAMPAIGN_STATUS['INACTIVE'];}else{_0x245fdb=CAMPAIGN_STATUS[_0x8e9b('0x36')];}}}else if(_0x20d4cb[_0x8e9b('0x1f')]===0x0){_0x245fdb=CAMPAIGN_STATUS[_0x8e9b('0x37')];}else if(!checkAnyValidTrunk(_0x20d4cb,_0x493515)){_0x245fdb=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x20d4cb)){var _0x338d8e=checkAnyValidQueueCampaignInterval(_0x20d4cb);if(_0x338d8e){_0x245fdb=_0x338d8e;}}return _0x245fdb;}exports[_0x8e9b('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4267bd){var _0x22e4ae=CAMPAIGN_STATUS[_0x8e9b('0x36')];if(_0x4267bd[_0x8e9b('0x25')]===0x0&&_0x4267bd[_0x8e9b('0x21')]===0x0&&_0x4267bd[_0x8e9b('0x23')]===0x0&&(_0x4267bd[_0x8e9b('0x22')]||0x0)===0x0){_0x22e4ae=CAMPAIGN_STATUS[_0x8e9b('0x35')];}return _0x22e4ae;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5cb4ee){var _0x226ed9=_0x5cb4ee['match'](/"(.*?)"/);return _0x226ed9?_0x226ed9[0x1]:_0x5cb4ee;}exports[_0x8e9b('0x39')]=extractCalleridName;function getCallerId(_0x117e37,_0x3d0fb3,_0x59c871){if(!_['isUndefined'](_0x59c871)&&typeof _0x59c871===_0x8e9b('0x3a')&&!_['isEmpty'](_0x59c871)){if(!_[_0x8e9b('0x3b')](_0x3d0fb3)&&typeof _0x3d0fb3===_0x8e9b('0x3a')&&!_[_0x8e9b('0x2d')](_0x3d0fb3)){return util[_0x8e9b('0x3c')](_0x8e9b('0x3d'),_0x3d0fb3,_0x59c871);}return util['format'](_0x8e9b('0x3d'),_0x59c871,_0x59c871);}if(!_[_0x8e9b('0x3b')](_0x117e37)&&typeof _0x117e37===_0x8e9b('0x3a')&&!_[_0x8e9b('0x2d')](_0x117e37)){return _0x117e37;}return _0x8e9b('0x3e');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x5f1328,_0x44f945){var _0x537e12;var _0x36aacd;var _0x4878c8;if(_0x44f945<=0x0){_0x44f945=0x1;}_0x537e12=new RegExp(_0x8e9b('0x3f')+_0x44f945+'}$');_0x36aacd=Math['pow'](0xa,_0x44f945-0x1);_0x4878c8=Math[_0x8e9b('0x40')](0xa,_0x44f945)-0x1;return util[_0x8e9b('0x3c')]('%s',_['replace'](_0x5f1328,_0x537e12,_[_0x8e9b('0x41')](_0x36aacd,_0x4878c8)[_0x8e9b('0x42')]()));}exports[_0x8e9b('0x43')]=getCallerIdRandom;function decrementOriginate(_0x30b517,_0x53c6da){if(_0x30b517[_0x8e9b('0x25')]&&_0x30b517['originated']>0x0){_0x30b517[_0x8e9b('0x25')]-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value',_0x53c6da);}}exports[_0x8e9b('0x44')]=decrementOriginate;function checkContactEmpty(_0x9e1aa7){return _0x9e1aa7&&_0x9e1aa7[_0x8e9b('0x45')]>0x0;}exports[_0x8e9b('0x46')]=checkContactEmpty;function erlangb(_0x168ccb,_0x2577b3){if(_0x2577b3===0x0){return 0x0;}var _0x288aa3=0x1;for(var _0x3ff026=0x1;_0x3ff026<=_0x2577b3;_0x3ff026+=0x1){_0x288aa3=0x1+_0x288aa3*_0x3ff026/_0x168ccb;}return 0x1/_0x288aa3;}exports[_0x8e9b('0x47')]=erlangb;function checkContactLowerLimitOriginate(_0x388bbd,_0x21ce39,_0xce655f){if(_0x21ce39>_0xce655f){for(var _0x57086e=0x0;_0x57086e<_0x21ce39-_0xce655f;_0x57086e+=0x1){decrementOriginate(_0x388bbd,_0x8e9b('0x48'));}}}exports[_0x8e9b('0x49')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x35449a){var _0x541b3c={};var _0x3bf8a3=['id',_0x8e9b('0x4a'),'tags','updatedAt'];const _0x219321=0xfa;if(_0x35449a){for(var _0x376fea in _0x35449a){if(typeof _0x35449a[_0x376fea]!==_0x8e9b('0x4b')){if(!_[_0x8e9b('0x2a')](_0x35449a[_0x376fea])&&!_0x3bf8a3['includes'](_0x376fea)){if(_0x376fea==='description'&&_0x35449a[_0x376fea][_0x8e9b('0x45')]>_0x219321){_0x541b3c[_0x8e9b('0x4c')+_0x376fea['toUpperCase']()]=_0x35449a[_0x376fea][_0x8e9b('0x42')]()[_0x8e9b('0x4d')](0x0,_0x219321);}else{_0x541b3c[_0x8e9b('0x4c')+_0x376fea[_0x8e9b('0x4e')]()]=_0x35449a[_0x376fea];}}}}}return _0x541b3c;}exports[_0x8e9b('0x4f')]=setXMDContactVariables; \ No newline at end of file +var _0x88d6=['TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','Trunk','name','hasQueueCampaignDataChanged','isNil','Interval','isEmpty','dialGlobalInterval','Intervals','UNKNOWN_TIMEZONE','reachable','includes','status','TrunkBackup','ACTIVE','originated','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','length','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','XMD-','toString','substring','toUpperCase','setXMDContactVariables','lodash','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING'];(function(_0x430794,_0x53b795){var _0x5959c0=function(_0x5c18ae){while(--_0x5c18ae){_0x430794['push'](_0x430794['shift']());}};_0x5959c0(++_0x53b795);}(_0x88d6,0xa2));var _0x688d=function(_0x1fd371,_0x4e27a0){_0x1fd371=_0x1fd371-0x0;var _0x34a6f7=_0x88d6[_0x1fd371];return _0x34a6f7;};'use strict';var _=require(_0x688d('0x0'));var moment=require('moment');var util=require(_0x688d('0x1'));var logger=require(_0x688d('0x2'))(_0x688d('0x3'));var timezones=require(_0x688d('0x4'))[_0x688d('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x688d('0x6'),'CONTACTS_RESCHEDULED':_0x688d('0x7'),'DEACTIVATED':_0x688d('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x688d('0x9'),'INACTIVE':_0x688d('0xa'),'NO_AGENTS_LOGGED':_0x688d('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x688d('0xc'),'OVERTIME_INTERVAL':_0x688d('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x688d('0xe'),'QUEUE_RECALL':_0x688d('0xf'),'RECALL_TIMEOUT':_0x688d('0x10'),'RUNNING':_0x688d('0x11'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x688d('0x12')};exports[_0x688d('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2b9a72){return _0x2b9a72[_0x688d('0x14')]==='preview';}exports[_0x688d('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x321a02){return _0x321a02[_0x688d('0x16')]===_0x688d('0x17');}exports[_0x688d('0x18')]=isIVRCampaign;function isOutboundQueue(_0x2bc4c7){return _0x2bc4c7[_0x688d('0x16')]===_0x688d('0x19');}exports[_0x688d('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x2befbf){return _0x2befbf[_0x688d('0x1b')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x5f25da){return _0x5f25da[_0x688d('0x1c')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x4ec887,_0x29c1fb){var _0x1e45a7=moment(_0x4ec887)['milliseconds'](0x0);var _0x28f586=moment(_0x29c1fb)[_0x688d('0x1d')](0x0);return _0x1e45a7[_0x688d('0x1e')](_0x28f586,_0x688d('0x1f'));}exports[_0x688d('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x44d3d4,_0x1d887f){var _0x58b773=![];var _0x385399=_0x44d3d4[_0x688d('0x14')]!==_0x1d887f['dialMethod']||_0x44d3d4['dialActive']!==_0x1d887f[_0x688d('0x1b')]||_0x44d3d4[_0x688d('0x21')]!==_0x1d887f['message'];var _0x5b0120=_0x44d3d4[_0x688d('0x22')]!==_0x1d887f[_0x688d('0x22')]||_0x44d3d4[_0x688d('0x23')]!==_0x1d887f['loggedIn']||_0x44d3d4[_0x688d('0x24')]!==_0x1d887f[_0x688d('0x24')]||_0x44d3d4[_0x688d('0x25')]!==_0x1d887f[_0x688d('0x25')]||_0x44d3d4[_0x688d('0x26')]!==_0x1d887f['talking']||_0x44d3d4[_0x688d('0x27')]!==_0x1d887f[_0x688d('0x27')]||_0x44d3d4[_0x688d('0x28')]!==_0x1d887f[_0x688d('0x28')]||_0x44d3d4[_0x688d('0x29')]!==_0x1d887f['inUse']||_0x44d3d4['originated']!==_0x1d887f['originated'];if(_0x44d3d4[_0x688d('0x2a')]&&_0x1d887f[_0x688d('0x2a')]){_0x58b773=_0x44d3d4[_0x688d('0x2a')][_0x688d('0x2b')]!==_0x1d887f['Trunk'][_0x688d('0x2b')]||_0x44d3d4['Trunk']['active']!==_0x1d887f[_0x688d('0x2a')][_0x688d('0x1c')];}return _0x385399||_0x5b0120||_0x58b773;}exports[_0x688d('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5e482a){var _0xbdc08e=null;var _0xb46309=_0x5e482a['dialTimezone'];if(_['isNil'](_0x5e482a['dialGlobalInterval'])||_[_0x688d('0x2d')](_0x5e482a[_0x688d('0x2e')])||_[_0x688d('0x2d')](_0x5e482a[_0x688d('0x2e')]['Intervals'])){_0xbdc08e=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x688d('0x2f')](_0x5e482a[_0x688d('0x30')])||_['isEmpty'](_0x5e482a[_0x688d('0x2e')][_0x688d('0x31')])){_0xbdc08e=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0xb46309&&!timezones[_0xb46309]){_0xbdc08e=CAMPAIGN_STATUS[_0x688d('0x32')];}return _0xbdc08e;}function checkAnyValidTrunk(_0x4c5c7b,_0xbba6c6){var _0x37d570=null;var _0x11802b='SIP/';var _0x5df7d4=[_0x688d('0x33'),'unmonitored'];var _0x303b85=!![];if(_0x4c5c7b[_0x688d('0x2a')]&&_0x4c5c7b['Trunk'][_0x688d('0x1c')]){_0x11802b+=_0x4c5c7b[_0x688d('0x2a')][_0x688d('0x2b')];_0x37d570=_0xbba6c6[_0x11802b];_0x303b85=_0x5df7d4[_0x688d('0x34')](_0x37d570[_0x688d('0x35')]);}else if(_0x4c5c7b[_0x688d('0x36')]&&_0x4c5c7b['TrunkBackup']['active']){_0x11802b+=_0x4c5c7b[_0x688d('0x36')][_0x688d('0x2b')];_0x37d570=_0xbba6c6[_0x11802b];_0x303b85=_0x5df7d4[_0x688d('0x34')](_0x37d570[_0x688d('0x35')]);}return _0x303b85;}function getQueueCampaignStatusMessage(_0x5332c6,_0x2b3d5b){var _0x305ea5=CAMPAIGN_STATUS[_0x688d('0x37')];var _0x4599aa=isPreviewCampaign(_0x5332c6);if(!isQueueCampaignActive(_0x5332c6)){if(_0x4599aa){_0x305ea5=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x5332c6[_0x688d('0x38')]===0x0&&_0x5332c6[_0x688d('0x26')]===0x0&&_0x5332c6['waiting']===0x0&&(_0x5332c6['pTalking']||0x0)===0x0){_0x305ea5=CAMPAIGN_STATUS[_0x688d('0x39')];}else{_0x305ea5=CAMPAIGN_STATUS[_0x688d('0x3a')];}}}else if(_0x5332c6['loggedIn']===0x0){_0x305ea5=CAMPAIGN_STATUS[_0x688d('0x3b')];}else if(!checkAnyValidTrunk(_0x5332c6,_0x2b3d5b)){_0x305ea5=CAMPAIGN_STATUS[_0x688d('0x3c')];}else if(!isPreviewCampaign(_0x5332c6)){var _0x2a9ed7=checkAnyValidQueueCampaignInterval(_0x5332c6);if(_0x2a9ed7){_0x305ea5=_0x2a9ed7;}}return _0x305ea5;}exports[_0x688d('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2320c4){var _0x2e96b4=CAMPAIGN_STATUS['DISACTIVED'];if(_0x2320c4['originated']===0x0&&_0x2320c4[_0x688d('0x26')]===0x0&&_0x2320c4[_0x688d('0x28')]===0x0&&(_0x2320c4['pTalking']||0x0)===0x0){_0x2e96b4=CAMPAIGN_STATUS[_0x688d('0x39')];}return _0x2e96b4;}exports[_0x688d('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x53695f){var _0x55f4a4=_0x53695f[_0x688d('0x3f')](/"(.*?)"/);return _0x55f4a4?_0x55f4a4[0x1]:_0x53695f;}exports[_0x688d('0x40')]=extractCalleridName;function getCallerId(_0x3bbb86,_0x4ce20a,_0x36a156){if(!_[_0x688d('0x41')](_0x36a156)&&typeof _0x36a156===_0x688d('0x42')&&!_[_0x688d('0x2f')](_0x36a156)){if(!_['isUndefined'](_0x4ce20a)&&typeof _0x4ce20a===_0x688d('0x42')&&!_[_0x688d('0x2f')](_0x4ce20a)){return util['format']('\x22%s\x22\x20<%s>',_0x4ce20a,_0x36a156);}return util[_0x688d('0x43')](_0x688d('0x44'),_0x36a156,_0x36a156);}if(!_['isUndefined'](_0x3bbb86)&&typeof _0x3bbb86===_0x688d('0x42')&&!_['isEmpty'](_0x3bbb86)){return _0x3bbb86;}return'\x22\x22\x20<>';}exports[_0x688d('0x45')]=getCallerId;function getCallerIdRandom(_0xbbe6fa,_0x3cbcec){var _0x3fb457;var _0x3fc3f3;var _0xf82dea;if(_0x3cbcec<=0x0){_0x3cbcec=0x1;}_0x3fb457=new RegExp(_0x688d('0x46')+_0x3cbcec+'}$');_0x3fc3f3=Math[_0x688d('0x47')](0xa,_0x3cbcec-0x1);_0xf82dea=Math[_0x688d('0x47')](0xa,_0x3cbcec)-0x1;return util[_0x688d('0x43')]('%s',_[_0x688d('0x48')](_0xbbe6fa,_0x3fb457,_[_0x688d('0x49')](_0x3fc3f3,_0xf82dea)['toString']()));}exports[_0x688d('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x79c00d,_0x16a1dd){if(_0x79c00d[_0x688d('0x38')]&&_0x79c00d['originated']>0x0){_0x79c00d[_0x688d('0x38')]-=0x1;}else{logger[_0x688d('0x4b')](_0x688d('0x4c'),_0x16a1dd);}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x55e206){return _0x55e206&&_0x55e206[_0x688d('0x4d')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x667933,_0x506d58){if(_0x506d58===0x0){return 0x0;}var _0x160f07=0x1;for(var _0x450164=0x1;_0x450164<=_0x506d58;_0x450164+=0x1){_0x160f07=0x1+_0x160f07*_0x450164/_0x667933;}return 0x1/_0x160f07;}exports[_0x688d('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x5b95e4,_0xea1c5a,_0x33d224){if(_0xea1c5a>_0x33d224){for(var _0x46d04a=0x0;_0x46d04a<_0xea1c5a-_0x33d224;_0x46d04a+=0x1){decrementOriginate(_0x5b95e4,_0x688d('0x4f'));}}}exports[_0x688d('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x36032f){var _0x19cf7a={};var _0x27a747=['id',_0x688d('0x51'),'tags',_0x688d('0x52')];const _0x50a5fc=0xfa;if(_0x36032f){for(var _0x137cc9 in _0x36032f){if(typeof _0x36032f[_0x137cc9]!==_0x688d('0x53')){if(!_[_0x688d('0x2d')](_0x36032f[_0x137cc9])&&!_0x27a747['includes'](_0x137cc9)){if(_0x137cc9===_0x688d('0x54')&&_0x36032f[_0x137cc9][_0x688d('0x4d')]>_0x50a5fc){_0x19cf7a[_0x688d('0x55')+_0x137cc9['toUpperCase']()]=_0x36032f[_0x137cc9][_0x688d('0x56')]()[_0x688d('0x57')](0x0,_0x50a5fc);}else{_0x19cf7a[_0x688d('0x55')+_0x137cc9[_0x688d('0x58')]()]=_0x36032f[_0x137cc9];}}}}}return _0x19cf7a;}exports[_0x688d('0x59')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 61736c1..b840828 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(_0x4b9c5c,_0x5a0fc4){var _0x5020dc=function(_0x41c656){while(--_0x41c656){_0x4b9c5c['push'](_0x4b9c5c['shift']());}};_0x5020dc(++_0x5a0fc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x58ef64,_0x47c44e){var _0x51584b=function(_0x46640c){while(--_0x46640c){_0x58ef64['push'](_0x58ef64['shift']());}};_0x51584b(++_0x47c44e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 398cb18..1a472c4 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 _0x0c8d=['isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','prototype','context','from-voip-provider','hasOwnProperty','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','logger','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','variablesAction','Action','execOriginate','addVariables'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0c8d,0xfc));var _0xd0c8=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x0c8d[_0x346737];return _0x1ade2e;};'use strict';var util=require(_0xd0c8('0x0'));var _=require(_0xd0c8('0x1'));var BPromise=require(_0xd0c8('0x2'));var uuid=require('uuid');var moment=require(_0xd0c8('0x3'));var path=require(_0xd0c8('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xd0c8('0x5'));var logger=require(_0xd0c8('0x6'))(_0xd0c8('0x7'));var ami=require(_0xd0c8('0x8'));var rpcDb=require(_0xd0c8('0x9'));var Channel=require(_0xd0c8('0xa'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xd0c8('0xb'));var attachment=require(_0xd0c8('0xc'));var faxMessage=require(_0xd0c8('0xd'));function Fax(_0x4003d5){this[_0xd0c8('0xe')]={};this['faxAccounts']=_0x4003d5[_0xd0c8('0xf')];this[_0xd0c8('0x10')]=_0x4003d5[_0xd0c8('0x10')];this[_0xd0c8('0x11')]={};ami['on']('newchannel',this[_0xd0c8('0x12')][_0xd0c8('0x13')](this));ami['on']('varset',this['syncVarSet'][_0xd0c8('0x13')](this));ami['on']('newstate',this[_0xd0c8('0x14')][_0xd0c8('0x13')](this));ami['on'](_0xd0c8('0x15'),this[_0xd0c8('0x16')]['bind'](this));ami['on'](_0xd0c8('0x17'),this[_0xd0c8('0x18')][_0xd0c8('0x13')](this));ami['on'](_0xd0c8('0x19'),this[_0xd0c8('0x1a')][_0xd0c8('0x13')](this));ami['on'](_0xd0c8('0x1b'),this['syncHangup'][_0xd0c8('0x13')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xd0c8('0x13')](this));}Fax[_0xd0c8('0x1c')][_0xd0c8('0x12')]=function(_0x22fb23){if(_0x22fb23[_0xd0c8('0x1d')]===_0xd0c8('0x1e')){for(var _0x520b7c in this['faxAccounts']){if(this['faxAccounts'][_0xd0c8('0x1f')](_0x520b7c)){if(_0x22fb23['exten']===this[_0xd0c8('0xf')][_0x520b7c]['localstationid']){this[_0xd0c8('0xe')][_0x22fb23[_0xd0c8('0x20')]]={};this['channels'][_0x22fb23[_0xd0c8('0x20')]][_0xd0c8('0x21')]=_0x22fb23[_0xd0c8('0x21')];this[_0xd0c8('0xe')][_0x22fb23[_0xd0c8('0x20')]]['id']=this[_0xd0c8('0xf')][_0x520b7c]['id'];this['channels'][_0x22fb23[_0xd0c8('0x20')]][_0xd0c8('0x22')]=this[_0xd0c8('0xf')][_0x520b7c][_0xd0c8('0x22')];logger[_0xd0c8('0x23')](_0x22fb23['uniqueid'],_0xd0c8('0x24'));}}}}if(this[_0xd0c8('0x11')][_0x22fb23['uniqueid']]){this[_0xd0c8('0xe')][_0x22fb23[_0xd0c8('0x20')]]={};this[_0xd0c8('0xe')][_0x22fb23[_0xd0c8('0x20')]][_0xd0c8('0x21')]=_0x22fb23[_0xd0c8('0x21')];logger[_0xd0c8('0x23')](_0x22fb23[_0xd0c8('0x20')],'\x20syncNewchannel\x20');}};Fax[_0xd0c8('0x1c')][_0xd0c8('0x25')]=function(_0x341492){if(this[_0xd0c8('0xe')][_0x341492[_0xd0c8('0x20')]]){for(var _0x1d3ff6 in _0x341492[_0xd0c8('0x26')]){if(_0x341492[_0xd0c8('0x26')]['hasOwnProperty'](_0x1d3ff6)){this[_0xd0c8('0xe')][_0x341492[_0xd0c8('0x20')]][_0x1d3ff6]=_0x341492[_0xd0c8('0x27')];}}}};Fax[_0xd0c8('0x1c')]['syncNewState']=function(_0x38bb12){if(this[_0xd0c8('0xe')][_0x38bb12['uniqueid']]){this['channels'][_0x38bb12[_0xd0c8('0x20')]][_0xd0c8('0x28')]=_0x38bb12[_0xd0c8('0x28')];this[_0xd0c8('0xe')][_0x38bb12['uniqueid']][_0xd0c8('0x29')]=_0x38bb12[_0xd0c8('0x29')];}};Fax[_0xd0c8('0x1c')][_0xd0c8('0x16')]=function(_0x3f2dd6){if(this[_0xd0c8('0xe')][_0x3f2dd6[_0xd0c8('0x20')]]){for(var _0x9771bf in _0x3f2dd6['variable']){if(_0x3f2dd6[_0xd0c8('0x26')]['hasOwnProperty'](_0x9771bf)){this['channels'][_0x3f2dd6['uniqueid']][_0x9771bf]=_0x3f2dd6[_0xd0c8('0x27')];}}}};Fax[_0xd0c8('0x1c')][_0xd0c8('0x18')]=function(_0x38f326){if(this[_0xd0c8('0xe')][_0x38f326[_0xd0c8('0x20')]]){this[_0xd0c8('0xe')][_0x38f326[_0xd0c8('0x20')]][_0xd0c8('0x2a')]=_0x38f326[_0xd0c8('0x2a')];this[_0xd0c8('0xe')][_0x38f326[_0xd0c8('0x20')]][_0xd0c8('0x2b')]=_0x38f326[_0xd0c8('0x2b')];this[_0xd0c8('0xe')][_0x38f326[_0xd0c8('0x20')]][_0xd0c8('0x2c')]=_0x38f326[_0xd0c8('0x2c')];this[_0xd0c8('0xe')][_0x38f326[_0xd0c8('0x20')]][_0xd0c8('0x2d')]=_0x38f326[_0xd0c8('0x2d')];logger[_0xd0c8('0x23')](_0x38f326[_0xd0c8('0x20')],_0xd0c8('0x2e'));}};Fax['prototype']['syncReceiveFax']=function(_0x302ea4){var _0x53ba85=this;if(this[_0xd0c8('0xe')][_0x302ea4[_0xd0c8('0x20')]]){var _0x55269a=this[_0xd0c8('0xe')][_0x302ea4[_0xd0c8('0x20')]]['id'];this[_0xd0c8('0xe')][_0x302ea4['uniqueid']][_0xd0c8('0x2f')]=_0x302ea4['remotestationid'];this[_0xd0c8('0xe')][_0x302ea4[_0xd0c8('0x20')]][_0xd0c8('0x30')]=_0x302ea4[_0xd0c8('0x30')];this[_0xd0c8('0xe')][_0x302ea4[_0xd0c8('0x20')]][_0xd0c8('0x2c')]=_0x302ea4[_0xd0c8('0x2c')];this[_0xd0c8('0xe')][_0x302ea4['uniqueid']][_0xd0c8('0x31')]=_0x302ea4[_0xd0c8('0x31')];this[_0xd0c8('0xe')][_0x302ea4[_0xd0c8('0x20')]][_0xd0c8('0x32')]=_0x302ea4['transferrate'];this[_0xd0c8('0xe')][_0x302ea4[_0xd0c8('0x20')]]['filename']=_0x302ea4['filename'];this['channels'][_0x302ea4[_0xd0c8('0x20')]]['calleridnum']=_0x302ea4[_0xd0c8('0x33')];if(this['channels'][_0x302ea4['uniqueid']][_0xd0c8('0x30')]>0x0){tiff2pdf(_0x302ea4['filename'],_0xd0c8('0x34'),function(_0x3ad579){logger['info'](_0x302ea4[_0xd0c8('0x20')],_0xd0c8('0x35'),_0x3ad579['message']);attachment[_0xd0c8('0x36')]({'name':path[_0xd0c8('0x37')](_0x302ea4[_0xd0c8('0x2d')])[_0xd0c8('0x22')],'basename':path[_0xd0c8('0x37')](_0x302ea4['filename'])[_0xd0c8('0x22')]+_0xd0c8('0x38'),'type':_0xd0c8('0x39')})[_0xd0c8('0x3a')](function(_0x3b57c5){faxAccount[_0xd0c8('0x3b')](_0x55269a,{'from':_0x302ea4['calleridnum'],'mapKey':_0xd0c8('0x7'),'body':path[_0xd0c8('0x37')](_0x302ea4['filename'])[_0xd0c8('0x22')]+_0xd0c8('0x38'),'AttachmentId':_0x3b57c5['id']})[_0xd0c8('0x3c')](function(_0x677072){logger[_0xd0c8('0x3d')](_0x302ea4['uniqueid'],_0xd0c8('0x3e'),JSON[_0xd0c8('0x3f')](_0x677072));});})[_0xd0c8('0x3c')](function(_0x531b70){logger['error'](_0x302ea4[_0xd0c8('0x20')],_0xd0c8('0x40'),JSON[_0xd0c8('0x3f')](_0x531b70));});});}logger[_0xd0c8('0x23')](_0x302ea4[_0xd0c8('0x20')],'\x20receiveFax\x20');}};Fax['prototype'][_0xd0c8('0x41')]=function(_0x41863d){if(this['actions'][_0x41863d['uniqueid']]){_[_0xd0c8('0x42')](this['channels'][_0x41863d[_0xd0c8('0x20')]],_[_0xd0c8('0x43')](_0x41863d,[_0xd0c8('0x44'),_0xd0c8('0x45')]));}};function updateStatus(_0x2e63b0){if(_0x2e63b0[_0xd0c8('0x46')]){faxMessage['update'](_0x2e63b0[_0xd0c8('0x46')],{'failMessage':_0xd0c8('0x47')})['then'](function(_0x37e8f8){ut['logger'](_0xd0c8('0x48'),_0x37e8f8);})[_0xd0c8('0x3c')](function(_0x46d194){ut['logger'](_0xd0c8('0x49'),_0x46d194);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0xd0c8('0x4a')]=function(_0x39791c,_0x2ba4ec,_0x4f0289){var _0x3af610=this;var _0x114603={};if(_0x2ba4ec){_0x114603={'read':_0x2ba4ec};}else{_0x114603={'failMessage':_0x4f0289};}if(this[_0xd0c8('0x11')][_0x39791c][_0xd0c8('0x46')]){faxMessage['update'](this['actions'][_0x39791c][_0xd0c8('0x46')],_0x114603)[_0xd0c8('0x3a')](function(_0x441738){ut[_0xd0c8('0x4b')](_0xd0c8('0x4c'),_0x441738);})[_0xd0c8('0x3c')](function(_0x3772fc){ut[_0xd0c8('0x4b')](_0xd0c8('0x4d'),_0x3772fc);})[_0xd0c8('0x4e')](function(){delete _0x3af610['channels'][_0x39791c];delete _0x3af610[_0xd0c8('0x11')][_0x39791c];});}else{ut[_0xd0c8('0x4b')](_0xd0c8('0x4f'));this[_0xd0c8('0x50')](_0x39791c);delete this[_0xd0c8('0x11')][_0x39791c];}};Fax[_0xd0c8('0x1c')][_0xd0c8('0x51')]=function(_0x36ecd1){var _0x75958e=this;if(this[_0xd0c8('0xe')][_0x36ecd1[_0xd0c8('0x20')]]){if(this['actions'][_0x36ecd1[_0xd0c8('0x20')]]){this[_0xd0c8('0xe')][_0x36ecd1['uniqueid']]['id']=this['actions'][_0x36ecd1[_0xd0c8('0x20')]]['id'];this[_0xd0c8('0xe')][_0x36ecd1[_0xd0c8('0x20')]]['name']=this[_0xd0c8('0x11')][_0x36ecd1[_0xd0c8('0x20')]][_0xd0c8('0x22')];}logger['info'](_0x36ecd1[_0xd0c8('0x20')],this['actions'][_0x36ecd1[_0xd0c8('0x20')]]?_0xd0c8('0x52'):_0xd0c8('0x53'),JSON[_0xd0c8('0x3f')](this[_0xd0c8('0xe')][_0x36ecd1[_0xd0c8('0x20')]]));if(this['actions'][_0x36ecd1[_0xd0c8('0x20')]]){if(this[_0xd0c8('0xe')][_0x36ecd1[_0xd0c8('0x20')]]['faxpages']>0x0&&this[_0xd0c8('0xe')][_0x36ecd1[_0xd0c8('0x20')]]['faxstatus']==='SUCCESS'){this['updateStatus'](_0x36ecd1[_0xd0c8('0x20')],!![]);}else{this[_0xd0c8('0x4a')](_0x36ecd1[_0xd0c8('0x20')],![],this[_0xd0c8('0xe')][_0x36ecd1['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x36ecd1[_0xd0c8('0x20')]][_0xd0c8('0x54')]:_0xd0c8('0x55'));}}}};Fax[_0xd0c8('0x1c')][_0xd0c8('0x56')]=function(_0x3c64d4){var _0x3582a6=this;return new BPromise(function(_0x246389,_0x1dd18f){_0x3582a6['execOriginate'](_0x3c64d4,_0x3582a6[_0xd0c8('0xf')][_0x3c64d4[_0xd0c8('0x57')]])['then'](function(_0x4ef79d){ut['logger'](_0xd0c8('0x58'),_0x4ef79d);_0x246389(ut[_0xd0c8('0x59')](_0xd0c8('0x5a')));})[_0xd0c8('0x3c')](function(_0x26d8ff){ut[_0xd0c8('0x4b')]('[Fax][execOriginate][failure]',_0x26d8ff);updateStatus(_0x3c64d4);_0x1dd18f(ut[_0xd0c8('0x59')](_0xd0c8('0x5b')));});});};Fax[_0xd0c8('0x1c')][_0xd0c8('0x5c')]=function(_0x5ba115){var _0x3e7abf=this;return new BPromise(function(_0x2b5058,_0x556d60){var _0xbf74f1=_0x3e7abf[_0xd0c8('0x5d')](_0x3e7abf[_0xd0c8('0xf')][_0x5ba115[_0xd0c8('0x57')]][_0xd0c8('0x5e')],_0x5ba115);if(_0xbf74f1[_0xd0c8('0x5f')]){_0x2b5058(ut['message']('Trunk\x20Reachable'));}else{_0x556d60(ut[_0xd0c8('0x59')](_0xbf74f1[_0xd0c8('0x59')]));}});};function originate(_0x1a3275,_0x232a91,_0x258cb2){return new BPromise(function(_0x23afcf,_0x3d428b){if(_0x258cb2){var _0x271a4c=util[_0xd0c8('0x60')](_0xd0c8('0x61'),path[_0xd0c8('0x37')](_0x1a3275[_0xd0c8('0x4')])[_0xd0c8('0x22')],_0x1a3275['path']);gs['execute'](_0x271a4c)[_0xd0c8('0x3a')](function(){_0x1a3275[_0xd0c8('0x4')]=util[_0xd0c8('0x60')](_0xd0c8('0x62'),path[_0xd0c8('0x37')](_0x1a3275['path'])[_0xd0c8('0x63')],path[_0xd0c8('0x37')](_0x1a3275[_0xd0c8('0x4')])[_0xd0c8('0x22')]);_0x232a91[_0xd0c8('0x64')]=_0x1a3275[_0xd0c8('0x4')];ut[_0xd0c8('0x4b')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0xd0c8('0x65')](_0x1a3275,_0x232a91))[_0xd0c8('0x3a')](function(_0x5ed170){_0x23afcf(_0x5ed170);})[_0xd0c8('0x3c')](function(_0x1acd13){_0x3d428b(_0x1acd13);});})[_0xd0c8('0x3c')](function(_0x1b8a6e){_0x3d428b(_0x1b8a6e);});}else{ami[_0xd0c8('0x66')](ut['variablesAction'](_0x1a3275,_0x232a91))['then'](function(_0x1fe45d){_0x23afcf(_0x1fe45d);})['catch'](function(_0x2f5bfc){_0x3d428b(_0x2f5bfc);});}});}Fax['prototype'][_0xd0c8('0x67')]=function(_0x3a3227,_0x127ae7){var _0x2164bf=this;return new BPromise(function(_0x4b9f48,_0x27109e){var _0x1cafa4=uuid['v4']();var _0x1a8210=ut[_0xd0c8('0x68')](_0x3a3227,_0x127ae7);_0x2164bf[_0xd0c8('0x11')][_0x1cafa4]=new Action(_0x1cafa4,_0x127ae7,_0x3a3227);var _0x41e5e8=_0x2164bf[_0xd0c8('0x11')][_0x1cafa4];if(path[_0xd0c8('0x37')](_0x3a3227[_0xd0c8('0x4')])['ext']===_0xd0c8('0x38')){originate(_0x41e5e8,_0x1a8210,!![])[_0xd0c8('0x3a')](function(_0x8052b){_0x4b9f48(_0x8052b);})['catch'](function(_0x342f23){_0x27109e(_0x342f23);});}else{originate(_0x41e5e8,_0x1a8210,![])[_0xd0c8('0x3a')](function(_0x4de465){_0x4b9f48(_0x4de465);})[_0xd0c8('0x3c')](function(_0xb366d8){_0x27109e(_0xb366d8);});}});};Fax['prototype'][_0xd0c8('0x69')]=function(_0x1383f5){return!_[_0xd0c8('0x6a')](_0x1383f5)&&!_[_0xd0c8('0x6a')](_0x1383f5[_0xd0c8('0x22')])&&!_[_0xd0c8('0x6a')](_0x1383f5[_0xd0c8('0x6b')])&&_0x1383f5[_0xd0c8('0x6b')]&&!_[_0xd0c8('0x6a')](this['trunks'][util[_0xd0c8('0x60')](_0xd0c8('0x6c'),_0x1383f5[_0xd0c8('0x22')])])&&!_[_0xd0c8('0x6a')](this[_0xd0c8('0x10')][util[_0xd0c8('0x60')](_0xd0c8('0x6c'),_0x1383f5[_0xd0c8('0x22')])][_0xd0c8('0x2b')])&&(this[_0xd0c8('0x10')][util[_0xd0c8('0x60')](_0xd0c8('0x6c'),_0x1383f5[_0xd0c8('0x22')])][_0xd0c8('0x2b')]===_0xd0c8('0x6d')||this[_0xd0c8('0x10')][util[_0xd0c8('0x60')]('SIP/%s',_0x1383f5[_0xd0c8('0x22')])][_0xd0c8('0x2b')]==='unmonitored');};Fax[_0xd0c8('0x1c')][_0xd0c8('0x5d')]=function(_0xdbc4ff,_0x415b68){if(!this[_0xd0c8('0x69')](_0xdbc4ff)){ut['logger'](_0xd0c8('0x6e'),_[_0xd0c8('0x6a')](_0xdbc4ff)?'':_0xdbc4ff[_0xd0c8('0x22')]+_0xd0c8('0x6f'));return{'isValid':![],'message':_0xd0c8('0x70')};}if(_['isNil'](_0x415b68[_0xd0c8('0x7')])){ut['logger'](_0xd0c8('0x71'),JSON['stringify'](_0x415b68));return{'isValid':![],'message':_0xd0c8('0x72')};}if(_[_0xd0c8('0x6a')](_0x415b68[_0xd0c8('0x4')])){ut[_0xd0c8('0x4b')](_0xd0c8('0x73'),JSON[_0xd0c8('0x3f')](_0x415b68));return{'isValid':![],'message':_0xd0c8('0x74')};}return{'isValid':!![],'message':_0xd0c8('0x75')};};Fax[_0xd0c8('0x1c')]['deleteChannelAfterTimeout']=function(_0x1a00d9,_0x17e529=0x2710){if(this['channels'][_0x1a00d9]){setTimeout(()=>{delete this[_0xd0c8('0xe')][_0x1a00d9];},_0x17e529);}};module[_0xd0c8('0x76')]=Fax; \ No newline at end of file +var _0xf4e4=['FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','isValid','Trunk\x20Reachable','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isNil','SIP/%s','reachable','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','fax','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','util','lodash','bluebird','moment','path','tiff2pdf','../../../config/logger','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','varset','syncVarSet','newstate','syncNewState','bind','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','channelstate','channelstatedesc','value','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','notify','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','reason','AttachmentId','update','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate'];(function(_0x6b22e,_0x209c2e){var _0x47173e=function(_0x487282){while(--_0x487282){_0x6b22e['push'](_0x6b22e['shift']());}};_0x47173e(++_0x209c2e);}(_0xf4e4,0x1d9));var _0x4f4e=function(_0x12ebd9,_0x339523){_0x12ebd9=_0x12ebd9-0x0;var _0x50eeff=_0xf4e4[_0x12ebd9];return _0x50eeff;};'use strict';var util=require(_0x4f4e('0x0'));var _=require(_0x4f4e('0x1'));var BPromise=require(_0x4f4e('0x2'));var uuid=require('uuid');var moment=require(_0x4f4e('0x3'));var path=require(_0x4f4e('0x4'));var tiff2pdf=require(_0x4f4e('0x5'));var gs=require('./util/gs');var logger=require(_0x4f4e('0x6'))('fax');var ami=require('../ami');var rpcDb=require(_0x4f4e('0x7'));var Channel=require(_0x4f4e('0x8'));var ut=require(_0x4f4e('0x9'));var Action=require('./action');var faxAccount=require(_0x4f4e('0xa'));var attachment=require(_0x4f4e('0xb'));var faxMessage=require(_0x4f4e('0xc'));function Fax(_0x47ddaf){this[_0x4f4e('0xd')]={};this['faxAccounts']=_0x47ddaf[_0x4f4e('0xe')];this[_0x4f4e('0xf')]=_0x47ddaf[_0x4f4e('0xf')];this[_0x4f4e('0x10')]={};ami['on']('newchannel',this['syncNewchannel']['bind'](this));ami['on'](_0x4f4e('0x11'),this[_0x4f4e('0x12')]['bind'](this));ami['on'](_0x4f4e('0x13'),this[_0x4f4e('0x14')][_0x4f4e('0x15')](this));ami['on']('newexten',this[_0x4f4e('0x16')][_0x4f4e('0x15')](this));ami['on'](_0x4f4e('0x17'),this[_0x4f4e('0x18')][_0x4f4e('0x15')](this));ami['on'](_0x4f4e('0x19'),this['syncReceiveFax'][_0x4f4e('0x15')](this));ami['on']('hangup',this[_0x4f4e('0x1a')][_0x4f4e('0x15')](this));ami['on'](_0x4f4e('0x1b'),this[_0x4f4e('0x1c')]['bind'](this));}Fax[_0x4f4e('0x1d')][_0x4f4e('0x1e')]=function(_0x191bf0){if(_0x191bf0[_0x4f4e('0x1f')]===_0x4f4e('0x20')){for(var _0x92932b in this[_0x4f4e('0xe')]){if(this[_0x4f4e('0xe')]['hasOwnProperty'](_0x92932b)){if(_0x191bf0[_0x4f4e('0x21')]===this[_0x4f4e('0xe')][_0x92932b][_0x4f4e('0x22')]){this['channels'][_0x191bf0[_0x4f4e('0x23')]]={};this[_0x4f4e('0xd')][_0x191bf0['uniqueid']][_0x4f4e('0x24')]=_0x191bf0['channel'];this[_0x4f4e('0xd')][_0x191bf0[_0x4f4e('0x23')]]['id']=this[_0x4f4e('0xe')][_0x92932b]['id'];this['channels'][_0x191bf0[_0x4f4e('0x23')]][_0x4f4e('0x25')]=this['faxAccounts'][_0x92932b][_0x4f4e('0x25')];logger[_0x4f4e('0x26')](_0x191bf0[_0x4f4e('0x23')],_0x4f4e('0x27'));}}}}if(this[_0x4f4e('0x10')][_0x191bf0['uniqueid']]){this['channels'][_0x191bf0[_0x4f4e('0x23')]]={};this[_0x4f4e('0xd')][_0x191bf0[_0x4f4e('0x23')]]['channel']=_0x191bf0[_0x4f4e('0x24')];logger['info'](_0x191bf0[_0x4f4e('0x23')],_0x4f4e('0x27'));}};Fax[_0x4f4e('0x1d')][_0x4f4e('0x12')]=function(_0x19ff7f){if(this['channels'][_0x19ff7f['uniqueid']]){for(var _0x37bb32 in _0x19ff7f['variable']){if(_0x19ff7f[_0x4f4e('0x28')][_0x4f4e('0x29')](_0x37bb32)){this[_0x4f4e('0xd')][_0x19ff7f[_0x4f4e('0x23')]][_0x37bb32]=_0x19ff7f['value'];}}}};Fax['prototype']['syncNewState']=function(_0x293127){if(this[_0x4f4e('0xd')][_0x293127[_0x4f4e('0x23')]]){this['channels'][_0x293127[_0x4f4e('0x23')]][_0x4f4e('0x2a')]=_0x293127['channelstate'];this[_0x4f4e('0xd')][_0x293127['uniqueid']][_0x4f4e('0x2b')]=_0x293127[_0x4f4e('0x2b')];}};Fax[_0x4f4e('0x1d')][_0x4f4e('0x16')]=function(_0x4aa5ba){if(this[_0x4f4e('0xd')][_0x4aa5ba[_0x4f4e('0x23')]]){for(var _0x3603f9 in _0x4aa5ba[_0x4f4e('0x28')]){if(_0x4aa5ba[_0x4f4e('0x28')][_0x4f4e('0x29')](_0x3603f9)){this[_0x4f4e('0xd')][_0x4aa5ba['uniqueid']][_0x3603f9]=_0x4aa5ba[_0x4f4e('0x2c')];}}}};Fax[_0x4f4e('0x1d')][_0x4f4e('0x18')]=function(_0x8ce3d0){if(this[_0x4f4e('0xd')][_0x8ce3d0[_0x4f4e('0x23')]]){this[_0x4f4e('0xd')][_0x8ce3d0[_0x4f4e('0x23')]]['operation']=_0x8ce3d0['operation'];this[_0x4f4e('0xd')][_0x8ce3d0[_0x4f4e('0x23')]][_0x4f4e('0x2d')]=_0x8ce3d0[_0x4f4e('0x2d')];this[_0x4f4e('0xd')][_0x8ce3d0[_0x4f4e('0x23')]][_0x4f4e('0x22')]=_0x8ce3d0['localstationid'];this['channels'][_0x8ce3d0[_0x4f4e('0x23')]][_0x4f4e('0x2e')]=_0x8ce3d0[_0x4f4e('0x2e')];logger[_0x4f4e('0x26')](_0x8ce3d0['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x4f4e('0x2f')]=function(_0x3872dc){var _0x573c0c=this;if(this[_0x4f4e('0xd')][_0x3872dc[_0x4f4e('0x23')]]){var _0x4e3073=this[_0x4f4e('0xd')][_0x3872dc[_0x4f4e('0x23')]]['id'];this[_0x4f4e('0xd')][_0x3872dc[_0x4f4e('0x23')]][_0x4f4e('0x30')]=_0x3872dc['remotestationid'];this[_0x4f4e('0xd')][_0x3872dc[_0x4f4e('0x23')]][_0x4f4e('0x31')]=_0x3872dc['pagestransferred'];this[_0x4f4e('0xd')][_0x3872dc[_0x4f4e('0x23')]][_0x4f4e('0x22')]=_0x3872dc[_0x4f4e('0x22')];this['channels'][_0x3872dc['uniqueid']][_0x4f4e('0x32')]=_0x3872dc[_0x4f4e('0x32')];this['channels'][_0x3872dc[_0x4f4e('0x23')]][_0x4f4e('0x33')]=_0x3872dc[_0x4f4e('0x33')];this[_0x4f4e('0xd')][_0x3872dc[_0x4f4e('0x23')]][_0x4f4e('0x2e')]=_0x3872dc['filename'];this[_0x4f4e('0xd')][_0x3872dc[_0x4f4e('0x23')]][_0x4f4e('0x34')]=_0x3872dc[_0x4f4e('0x34')];if(this['channels'][_0x3872dc[_0x4f4e('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x3872dc['filename'],_0x4f4e('0x35'),function(_0x2cc1){logger['info'](_0x3872dc[_0x4f4e('0x23')],_0x4f4e('0x36'),_0x2cc1[_0x4f4e('0x37')]);attachment['create']({'name':path[_0x4f4e('0x38')](_0x3872dc[_0x4f4e('0x2e')])['name'],'basename':path[_0x4f4e('0x38')](_0x3872dc[_0x4f4e('0x2e')])['name']+'.pdf','type':_0x4f4e('0x39')})[_0x4f4e('0x3a')](function(_0x3fc447){faxAccount[_0x4f4e('0x3b')](_0x4e3073,{'from':_0x3872dc[_0x4f4e('0x34')],'mapKey':'fax','body':path['parse'](_0x3872dc[_0x4f4e('0x2e')])[_0x4f4e('0x25')]+_0x4f4e('0x3c'),'AttachmentId':_0x3fc447['id']})[_0x4f4e('0x3d')](function(_0x3a4b19){logger['error'](_0x3872dc[_0x4f4e('0x23')],_0x4f4e('0x3e'),JSON[_0x4f4e('0x3f')](_0x3a4b19));});})['catch'](function(_0x4bfdc6){logger[_0x4f4e('0x40')](_0x3872dc[_0x4f4e('0x23')],_0x4f4e('0x41'),JSON[_0x4f4e('0x3f')](_0x4bfdc6));});});}logger['info'](_0x3872dc[_0x4f4e('0x23')],_0x4f4e('0x41'));}};Fax[_0x4f4e('0x1d')][_0x4f4e('0x1c')]=function(_0x49b216){if(this[_0x4f4e('0x10')][_0x49b216[_0x4f4e('0x23')]]){_['merge'](this[_0x4f4e('0xd')][_0x49b216[_0x4f4e('0x23')]],_['pick'](_0x49b216,['response',_0x4f4e('0x42')]));}};function updateStatus(_0x439499){if(_0x439499[_0x4f4e('0x43')]){faxMessage[_0x4f4e('0x44')](_0x439499[_0x4f4e('0x43')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x4f4e('0x3a')](function(_0x301c0a){ut['logger'](_0x4f4e('0x45'),_0x301c0a);})[_0x4f4e('0x3d')](function(_0xb35c02){ut[_0x4f4e('0x46')](_0x4f4e('0x47'),_0xb35c02);});}else{ut[_0x4f4e('0x46')](_0x4f4e('0x48'));}}Fax['prototype'][_0x4f4e('0x49')]=function(_0xfcebc4,_0x2ff105,_0x34d872){var _0x21c8c7=this;var _0x48aa03={};if(_0x2ff105){_0x48aa03={'read':_0x2ff105};}else{_0x48aa03={'failMessage':_0x34d872};}if(this[_0x4f4e('0x10')][_0xfcebc4][_0x4f4e('0x43')]){faxMessage[_0x4f4e('0x44')](this[_0x4f4e('0x10')][_0xfcebc4][_0x4f4e('0x43')],_0x48aa03)[_0x4f4e('0x3a')](function(_0x1eaae4){ut['logger'](_0x4f4e('0x4a'),_0x1eaae4);})[_0x4f4e('0x3d')](function(_0x1dfe9f){ut[_0x4f4e('0x46')](_0x4f4e('0x4b'),_0x1dfe9f);})[_0x4f4e('0x4c')](function(){delete _0x21c8c7[_0x4f4e('0xd')][_0xfcebc4];delete _0x21c8c7[_0x4f4e('0x10')][_0xfcebc4];});}else{ut[_0x4f4e('0x46')](_0x4f4e('0x4d'));this[_0x4f4e('0x4e')](_0xfcebc4);delete this[_0x4f4e('0x10')][_0xfcebc4];}};Fax[_0x4f4e('0x1d')]['syncHangup']=function(_0x233051){var _0x47b688=this;if(this['channels'][_0x233051[_0x4f4e('0x23')]]){if(this[_0x4f4e('0x10')][_0x233051[_0x4f4e('0x23')]]){this['channels'][_0x233051['uniqueid']]['id']=this[_0x4f4e('0x10')][_0x233051[_0x4f4e('0x23')]]['id'];this[_0x4f4e('0xd')][_0x233051[_0x4f4e('0x23')]][_0x4f4e('0x25')]=this['actions'][_0x233051[_0x4f4e('0x23')]][_0x4f4e('0x25')];}logger[_0x4f4e('0x26')](_0x233051[_0x4f4e('0x23')],this[_0x4f4e('0x10')][_0x233051[_0x4f4e('0x23')]]?_0x4f4e('0x4f'):_0x4f4e('0x50'),JSON[_0x4f4e('0x3f')](this['channels'][_0x233051['uniqueid']]));if(this[_0x4f4e('0x10')][_0x233051[_0x4f4e('0x23')]]){if(this[_0x4f4e('0xd')][_0x233051['uniqueid']][_0x4f4e('0x51')]>0x0&&this[_0x4f4e('0xd')][_0x233051[_0x4f4e('0x23')]]['faxstatus']==='SUCCESS'){this['updateStatus'](_0x233051[_0x4f4e('0x23')],!![]);}else{this[_0x4f4e('0x49')](_0x233051[_0x4f4e('0x23')],![],this['channels'][_0x233051[_0x4f4e('0x23')]][_0x4f4e('0x52')]?_0x4f4e('0x53')+this[_0x4f4e('0xd')][_0x233051[_0x4f4e('0x23')]][_0x4f4e('0x52')]:_0x4f4e('0x54'));}}}};Fax[_0x4f4e('0x1d')][_0x4f4e('0x55')]=function(_0x16d3d7){var _0x3b28f2=this;return new BPromise(function(_0x20d867,_0x3e1a7c){_0x3b28f2[_0x4f4e('0x56')](_0x16d3d7,_0x3b28f2[_0x4f4e('0xe')][_0x16d3d7[_0x4f4e('0x57')]])['then'](function(_0x39a74c){ut[_0x4f4e('0x46')]('[Fax][execOriginate][success]',_0x39a74c);_0x20d867(ut[_0x4f4e('0x37')](_0x4f4e('0x58')));})['catch'](function(_0x1e0cdb){ut['logger'](_0x4f4e('0x59'),_0x1e0cdb);updateStatus(_0x16d3d7);_0x3e1a7c(ut[_0x4f4e('0x37')](_0x4f4e('0x5a')));});});};Fax[_0x4f4e('0x1d')][_0x4f4e('0x5b')]=function(_0x41044a){var _0x3c7f17=this;return new BPromise(function(_0x53a080,_0x20ee5a){var _0x31d599=_0x3c7f17['checkTrunk'](_0x3c7f17[_0x4f4e('0xe')][_0x41044a[_0x4f4e('0x57')]]['Trunk'],_0x41044a);if(_0x31d599[_0x4f4e('0x5c')]){_0x53a080(ut[_0x4f4e('0x37')](_0x4f4e('0x5d')));}else{_0x20ee5a(ut[_0x4f4e('0x37')](_0x31d599['message']));}});};function originate(_0x2d822e,_0x493af1,_0x5b61ab){return new BPromise(function(_0x361d94,_0x1a79c4){if(_0x5b61ab){var _0x25397b=util[_0x4f4e('0x5e')]('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[_0x4f4e('0x38')](_0x2d822e[_0x4f4e('0x4')])[_0x4f4e('0x25')],_0x2d822e[_0x4f4e('0x4')]);gs['execute'](_0x25397b)[_0x4f4e('0x3a')](function(){_0x2d822e['path']=util[_0x4f4e('0x5e')](_0x4f4e('0x5f'),path[_0x4f4e('0x38')](_0x2d822e[_0x4f4e('0x4')])[_0x4f4e('0x60')],path['parse'](_0x2d822e[_0x4f4e('0x4')])[_0x4f4e('0x25')]);_0x493af1[_0x4f4e('0x61')]=_0x2d822e[_0x4f4e('0x4')];ut[_0x4f4e('0x46')](_0x4f4e('0x62'),'');ami['Action'](ut[_0x4f4e('0x63')](_0x2d822e,_0x493af1))['then'](function(_0x37a3c7){_0x361d94(_0x37a3c7);})['catch'](function(_0x4ba38d){_0x1a79c4(_0x4ba38d);});})[_0x4f4e('0x3d')](function(_0x1f432f){_0x1a79c4(_0x1f432f);});}else{ami[_0x4f4e('0x64')](ut[_0x4f4e('0x63')](_0x2d822e,_0x493af1))[_0x4f4e('0x3a')](function(_0x58edc0){_0x361d94(_0x58edc0);})[_0x4f4e('0x3d')](function(_0x2a7389){_0x1a79c4(_0x2a7389);});}});}Fax['prototype'][_0x4f4e('0x56')]=function(_0x52511b,_0x23581f){var _0x3ce240=this;return new BPromise(function(_0x4ef434,_0x3e5664){var _0x3b8708=uuid['v4']();var _0x2e1602=ut[_0x4f4e('0x65')](_0x52511b,_0x23581f);_0x3ce240[_0x4f4e('0x10')][_0x3b8708]=new Action(_0x3b8708,_0x23581f,_0x52511b);var _0x20352e=_0x3ce240['actions'][_0x3b8708];if(path[_0x4f4e('0x38')](_0x52511b['path'])[_0x4f4e('0x66')]===_0x4f4e('0x3c')){originate(_0x20352e,_0x2e1602,!![])['then'](function(_0x4131cb){_0x4ef434(_0x4131cb);})[_0x4f4e('0x3d')](function(_0x5cdc19){_0x3e5664(_0x5cdc19);});}else{originate(_0x20352e,_0x2e1602,![])[_0x4f4e('0x3a')](function(_0x475aac){_0x4ef434(_0x475aac);})[_0x4f4e('0x3d')](function(_0x5a1782){_0x3e5664(_0x5a1782);});}});};Fax[_0x4f4e('0x1d')]['isTrunkReachable']=function(_0x7724b7){return!_[_0x4f4e('0x67')](_0x7724b7)&&!_[_0x4f4e('0x67')](_0x7724b7['name'])&&!_[_0x4f4e('0x67')](_0x7724b7['active'])&&_0x7724b7['active']&&!_[_0x4f4e('0x67')](this['trunks'][util[_0x4f4e('0x5e')](_0x4f4e('0x68'),_0x7724b7[_0x4f4e('0x25')])])&&!_[_0x4f4e('0x67')](this[_0x4f4e('0xf')][util['format'](_0x4f4e('0x68'),_0x7724b7[_0x4f4e('0x25')])][_0x4f4e('0x2d')])&&(this[_0x4f4e('0xf')][util[_0x4f4e('0x5e')]('SIP/%s',_0x7724b7[_0x4f4e('0x25')])]['status']===_0x4f4e('0x69')||this[_0x4f4e('0xf')][util['format'](_0x4f4e('0x68'),_0x7724b7['name'])][_0x4f4e('0x2d')]==='unmonitored');};Fax[_0x4f4e('0x1d')]['checkTrunk']=function(_0x1b1273,_0x2bf6aa){if(!this[_0x4f4e('0x6a')](_0x1b1273)){ut[_0x4f4e('0x46')](_0x4f4e('0x6b'),_[_0x4f4e('0x67')](_0x1b1273)?'':_0x1b1273[_0x4f4e('0x25')]+_0x4f4e('0x6c'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x4f4e('0x67')](_0x2bf6aa[_0x4f4e('0x6d')])){ut[_0x4f4e('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x4f4e('0x3f')](_0x2bf6aa));return{'isValid':![],'message':_0x4f4e('0x6e')};}if(_['isNil'](_0x2bf6aa[_0x4f4e('0x4')])){ut['logger'](_0x4f4e('0x6f'),JSON['stringify'](_0x2bf6aa));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax['prototype'][_0x4f4e('0x4e')]=function(_0x5574c9,_0x214a2a=0x2710){if(this[_0x4f4e('0xd')][_0x5574c9]){setTimeout(()=>{delete this[_0x4f4e('0xd')][_0x5574c9];},_0x214a2a);}};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 2febab3..1fb5354 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 _0x0818=['resolve','then','catch','util','bluebird','preview','../rpc/faxAccount','error','inspect','notify'];(function(_0x5e2ddd,_0xbb8802){var _0x84f2ff=function(_0x5acc3e){while(--_0x5acc3e){_0x5e2ddd['push'](_0x5e2ddd['shift']());}};_0x84f2ff(++_0xbb8802);}(_0x0818,0x189));var _0x8081=function(_0x14be9e,_0x44e984){_0x14be9e=_0x14be9e-0x0;var _0x11fd99=_0x0818[_0x14be9e];return _0x11fd99;};'use strict';var util=require(_0x8081('0x0'));var BPromise=require(_0x8081('0x1'));var logger=require('../../../config/logger')(_0x8081('0x2'));var _=require('lodash');var faxAccount=require(_0x8081('0x3'));function loggerCatch(_0x1cf752){return function(_0x40b4eb){logger[_0x8081('0x4')](_0x1cf752,util[_0x8081('0x5')](_0x40b4eb,{'showHidden':![],'depth':null}));};}exports[_0x8081('0x6')]=function(_0xcef574,_0x3d42e1){return BPromise[_0x8081('0x7')]()[_0x8081('0x8')](faxAccount[_0x8081('0x6')](_0xcef574,_0x3d42e1))[_0x8081('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xc941=['resolve','catch','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','notify'];(function(_0x485c9f,_0x399a20){var _0x2ba76e=function(_0x3598d4){while(--_0x3598d4){_0x485c9f['push'](_0x485c9f['shift']());}};_0x2ba76e(++_0x399a20);}(_0xc941,0x1bb));var _0x1c94=function(_0x3b095d,_0x169efa){_0x3b095d=_0x3b095d-0x0;var _0x16b905=_0xc941[_0x3b095d];return _0x16b905;};'use strict';var util=require('util');var BPromise=require(_0x1c94('0x0'));var logger=require(_0x1c94('0x1'))(_0x1c94('0x2'));var _=require(_0x1c94('0x3'));var faxAccount=require(_0x1c94('0x4'));function loggerCatch(_0x335fc7){return function(_0x48bcf4){logger['error'](_0x335fc7,util[_0x1c94('0x5')](_0x48bcf4,{'showHidden':![],'depth':null}));};}exports[_0x1c94('0x6')]=function(_0x2bba31,_0x2e0722){return BPromise[_0x1c94('0x7')]()['then'](faxAccount[_0x1c94('0x6')](_0x2bba31,_0x2e0722))[_0x1c94('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index bf1bdff..1a63395 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 _0x3f08=['inspect','bluebird','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x3f08,0x109));var _0x83f0=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x3f08[_0x5bd426];return _0x23a7eb;};'use strict';var util=require('util');var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x83f0('0x0'));var exec=require('child_process')[_0x83f0('0x1')];exports['execute']=function(_0x3d52a9){return new BPromise(function(_0x55782a,_0x3184c9){exec(_0x3d52a9,function(_0x57eea5,_0x281e85,_0x162ed2){logger[_0x83f0('0x2')](_0x83f0('0x3'),_0x281e85);if(_0x57eea5){logger['info'](_0x83f0('0x3'),_0x83f0('0x4'),util[_0x83f0('0x5')](_0x57eea5,{'showHidden':![],'depth':null}),_0x281e85,_0x162ed2);_0x3184c9(_0x57eea5);}_0x55782a(_0x281e85);});});}; \ No newline at end of file +var _0x0132=['execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x0132,0x176));var _0x2013=function(_0xca08fc,_0x45b07d){_0xca08fc=_0xca08fc-0x0;var _0x110b93=_0x0132[_0xca08fc];return _0x110b93;};'use strict';var util=require(_0x2013('0x0'));var logger=require(_0x2013('0x1'))(_0x2013('0x2'));var BPromise=require(_0x2013('0x3'));var exec=require(_0x2013('0x4'))[_0x2013('0x5')];exports[_0x2013('0x6')]=function(_0x55285a){return new BPromise(function(_0x363809,_0x11ffe4){exec(_0x55285a,function(_0x4c0202,_0x5229b0,_0x2d644b){logger[_0x2013('0x7')](_0x2013('0x8'),_0x5229b0);if(_0x4c0202){logger['info'](_0x2013('0x8'),_0x2013('0x9'),util['inspect'](_0x4c0202,{'showHidden':![],'depth':null}),_0x5229b0,_0x2d644b);_0x11ffe4(_0x4c0202);}_0x363809(_0x5229b0);});});}; \ 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 c55992b..f763439 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 _0xeea3=['uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','localstationid','variablesAction'];(function(_0x5d4a6f,_0x139d29){var _0x2d61de=function(_0x4286b9){while(--_0x4286b9){_0x5d4a6f['push'](_0x5d4a6f['shift']());}};_0x2d61de(++_0x139d29);}(_0xeea3,0x156));var _0x3eea=function(_0x127be3,_0x5d01cc){_0x127be3=_0x127be3-0x0;var _0xcb4051=_0xeea3[_0x127be3];return _0xcb4051;};'use strict';var util=require(_0x3eea('0x0'));var _=require(_0x3eea('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x3eea('0x2'));exports[_0x3eea('0x3')]=function(_0x61c917){return{'message':_0x61c917};};exports[_0x3eea('0x4')]=function(_0x5209d1,_0x21a68f){logger[_0x3eea('0x5')](_0x5209d1,util[_0x3eea('0x6')](_0x21a68f,{'showHidden':![],'depth':null}));};exports[_0x3eea('0x7')]=function(_0x1b255b,_0x4924fe){var _0x2f3b96={'XMF-ECM':_0x4924fe[_0x3eea('0x8')],'XMF-HEADERINFO':_0x4924fe[_0x3eea('0x9')],'XMF-MINRATE':_0x4924fe[_0x3eea('0xa')],'XMF-MAXRATE':_0x4924fe[_0x3eea('0xb')],'XMF-MODEM':util[_0x3eea('0xc')](_0x3eea('0xd'),_0x4924fe['modem']),'XMF-GATEWAY':_0x4924fe[_0x3eea('0xe')],'XMF-FAXDETECT':_0x4924fe[_0x3eea('0xf')],'XMF-T38TIMEOUT':_0x4924fe['t38timeout'],'XMF-LOCALSTATIONID':_0x4924fe[_0x3eea('0x10')],'XMF-PATH':_0x1b255b['path']};return _0x2f3b96;};exports[_0x3eea('0x11')]=function(_0x3e1430,_0x163153){return{'actionid':_0x3e1430[_0x3eea('0x12')],'action':_0x3eea('0x13'),'channel':_0x3e1430[_0x3eea('0x14')],'Exten':_0x3eea('0x15'),'Context':_0x3eea('0x16'),'Priority':'1','callerid':util[_0x3eea('0xc')](_0x3eea('0x17'),_0x3e1430[_0x3eea('0x9')]?_0x3e1430[_0x3eea('0x9')]:'',_0x3e1430[_0x3eea('0x10')]),'variable':_0x163153,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3e1430['uniqueid']};}; \ No newline at end of file +var _0x82d2=['util','lodash','moment','../../../../config/logger','fax','message','logger','inspect','minrate','maxrate','modem','faxdetect','t38timeout','localstationid','channel','xcally-motion-fax','from-sip','format','headerinfo'];(function(_0x22cafd,_0x3c98cc){var _0x120344=function(_0x36533a){while(--_0x36533a){_0x22cafd['push'](_0x22cafd['shift']());}};_0x120344(++_0x3c98cc);}(_0x82d2,0x18f));var _0x282d=function(_0x40a574,_0x4ebee0){_0x40a574=_0x40a574-0x0;var _0x42ff8b=_0x82d2[_0x40a574];return _0x42ff8b;};'use strict';var util=require(_0x282d('0x0'));var _=require(_0x282d('0x1'));var moment=require(_0x282d('0x2'));var logger=require(_0x282d('0x3'))(_0x282d('0x4'));exports[_0x282d('0x5')]=function(_0x541a80){return{'message':_0x541a80};};exports[_0x282d('0x6')]=function(_0x54cfd9,_0x5447f0){logger['info'](_0x54cfd9,util[_0x282d('0x7')](_0x5447f0,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1fb842,_0x525b8d){var _0x37b44c={'XMF-ECM':_0x525b8d['ecm'],'XMF-HEADERINFO':_0x525b8d['headerinfo'],'XMF-MINRATE':_0x525b8d[_0x282d('0x8')],'XMF-MAXRATE':_0x525b8d[_0x282d('0x9')],'XMF-MODEM':util['format']('\x22%s\x22',_0x525b8d[_0x282d('0xa')]),'XMF-GATEWAY':_0x525b8d['gateway'],'XMF-FAXDETECT':_0x525b8d[_0x282d('0xb')],'XMF-T38TIMEOUT':_0x525b8d[_0x282d('0xc')],'XMF-LOCALSTATIONID':_0x525b8d[_0x282d('0xd')],'XMF-PATH':_0x1fb842['path']};return _0x37b44c;};exports['variablesAction']=function(_0x6accf0,_0x104b46){return{'actionid':_0x6accf0['uniqueid'],'action':'originate','channel':_0x6accf0[_0x282d('0xe')],'Exten':_0x282d('0xf'),'Context':_0x282d('0x10'),'Priority':'1','callerid':util[_0x282d('0x11')]('\x22%s\x22\x20<%s>',_0x6accf0[_0x282d('0x12')]?_0x6accf0[_0x282d('0x12')]:'',_0x6accf0[_0x282d('0xd')]),'variable':_0x104b46,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x6accf0['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 01c2cfc..1893be5 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 _0xb25a=['getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','[index.js][main]','util','moment','./report','./acw','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents'];(function(_0x426b28,_0x2e066e){var _0x4b37c0=function(_0x32e967){while(--_0x32e967){_0x426b28['push'](_0x426b28['shift']());}};_0x4b37c0(++_0x2e066e);}(_0xb25a,0x18c));var _0xab25=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb25a[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0xab25('0x0'));var moment=require(_0xab25('0x1'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0xab25('0x2'));var Acw=require(_0xab25('0x3'));var Trigger=require(_0xab25('0x4'));var Dialer=require(_0xab25('0x5'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0xab25('0x6'));var voiceQueue=require(_0xab25('0x7'));var voiceQueueReport=require(_0xab25('0x8'));var voiceCallReport=require(_0xab25('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0xab25('0xa'));var template=require(_0xab25('0xb'));var cmHopperHistory=require(_0xab25('0xc'));var campaign=require(_0xab25('0xd'));var voiceExtension=require(_0xab25('0xe'));var faxAccount=require(_0xab25('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xab25('0x10'));var sugarcrm=require(_0xab25('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xab25('0x12'));var zoho=require(_0xab25('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xab25('0x14'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xab25('0x15'));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(_0xab25('0x16'))(_0xab25('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xab25('0x18')](_0xab25('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xab25('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xab25('0x1a')]()[_0xab25('0x1b')](user[_0xab25('0x1c')]())['then'](realtime[_0xab25('0x1d')]())['then'](user[_0xab25('0x1e')]())[_0xab25('0x1b')](realtime['initTelephones']())['then'](trunk[_0xab25('0x1f')]())[_0xab25('0x1b')](realtime[_0xab25('0x20')]())['then'](voiceQueue[_0xab25('0x21')]())[_0xab25('0x1b')](realtime[_0xab25('0x22')]())[_0xab25('0x1b')](trigger[_0xab25('0x23')]())[_0xab25('0x1b')](realtime[_0xab25('0x24')]())[_0xab25('0x1b')](template[_0xab25('0x25')]())[_0xab25('0x1b')](realtime['initTemplates']())[_0xab25('0x1b')](zendesk[_0xab25('0x26')]())[_0xab25('0x1b')](realtime[_0xab25('0x27')]())[_0xab25('0x1b')](salesforce[_0xab25('0x28')]())[_0xab25('0x1b')](realtime[_0xab25('0x29')]())[_0xab25('0x1b')](sugarcrm[_0xab25('0x2a')]())[_0xab25('0x1b')](realtime['initSugarcrmAccounts']())[_0xab25('0x1b')](freshdesk[_0xab25('0x2b')]())[_0xab25('0x1b')](realtime[_0xab25('0x2c')]())[_0xab25('0x1b')](desk[_0xab25('0x2d')]())[_0xab25('0x1b')](realtime['initDeskAccounts']())['then'](zoho[_0xab25('0x2e')]())[_0xab25('0x1b')](realtime[_0xab25('0x2f')]())['then'](vtiger[_0xab25('0x30')]())[_0xab25('0x1b')](realtime['initVtigerAccounts']())[_0xab25('0x1b')](freshsales[_0xab25('0x31')]())[_0xab25('0x1b')](realtime[_0xab25('0x32')]())['then'](servicenow[_0xab25('0x33')]())[_0xab25('0x1b')](realtime[_0xab25('0x34')]())[_0xab25('0x1b')](dynamics365['getDynamics365Accounts']())[_0xab25('0x1b')](realtime[_0xab25('0x35')]())[_0xab25('0x1b')](campaign[_0xab25('0x36')]())[_0xab25('0x1b')](realtime[_0xab25('0x37')]())[_0xab25('0x1b')](voiceExtension['getVoiceExtensions']())[_0xab25('0x1b')](realtime[_0xab25('0x38')]())[_0xab25('0x1b')](faxAccount[_0xab25('0x39')]())[_0xab25('0x1b')](realtime[_0xab25('0x3a')]())[_0xab25('0x1b')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0xab25('0x3b')]())[_0xab25('0x1b')](realtime[_0xab25('0x3c')]())['then'](cmHopperHistory[_0xab25('0x3d')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0xab25('0x1b')](cmHopperHistory[_0xab25('0x3e')]())[_0xab25('0x1b')](realtime[_0xab25('0x3f')]())[_0xab25('0x1b')](voiceCallReport[_0xab25('0x40')]())['then'](realtime['initVoiceCallReports']())[_0xab25('0x41')](function(_0x1d641d){logger[_0xab25('0x42')](_0xab25('0x43'),util[_0xab25('0x44')](_0x1d641d,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xab25('0x1b')](function(){return initRealtime();})[_0xab25('0x1b')](function(){return initParams();})[_0xab25('0x1b')](function(){report[_0xab25('0x45')]();setInterval(initRealtime,0x1388);})[_0xab25('0x41')](function(_0x22a164){logger[_0xab25('0x42')](_0xab25('0x46'),util['inspect'](_0x22a164,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x91d7=['initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks'];(function(_0x1b5b1e,_0x48a911){var _0x50fe28=function(_0x454dcd){while(--_0x454dcd){_0x1b5b1e['push'](_0x1b5b1e['shift']());}};_0x50fe28(++_0x48a911);}(_0x91d7,0x10d));var _0x791d=function(_0xfe07dc,_0x13dde4){_0xfe07dc=_0xfe07dc-0x0;var _0x32021d=_0x91d7[_0xfe07dc];return _0x32021d;};'use strict';var util=require(_0x791d('0x0'));var moment=require(_0x791d('0x1'));var server=require(_0x791d('0x2'));var Realtime=require(_0x791d('0x3'));var Report=require(_0x791d('0x4'));var Acw=require(_0x791d('0x5'));var Trigger=require(_0x791d('0x6'));var Dialer=require(_0x791d('0x7'));var Preview=require(_0x791d('0x8'));var Fax=require(_0x791d('0x9'));var user=require(_0x791d('0xa'));var voiceQueue=require(_0x791d('0xb'));var voiceQueueReport=require(_0x791d('0xc'));var voiceCallReport=require(_0x791d('0xd'));var trunk=require(_0x791d('0xe'));var trigger=require('./rpc/trigger');var template=require(_0x791d('0xf'));var cmHopperHistory=require(_0x791d('0x10'));var campaign=require(_0x791d('0x11'));var voiceExtension=require(_0x791d('0x12'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x791d('0x13'));var salesforce=require(_0x791d('0x14'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x791d('0x15'));var desk=require(_0x791d('0x16'));var zoho=require(_0x791d('0x17'));var vtiger=require(_0x791d('0x18'));var freshsales=require(_0x791d('0x19'));var servicenow=require(_0x791d('0x1a'));var dynamics365=require(_0x791d('0x1b'));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(_0x791d('0x1c'))(_0x791d('0x1d'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x791d('0x1e')](_0x791d('0x1f'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x791d('0x1e')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x791d('0x20')]()[_0x791d('0x21')](user[_0x791d('0x22')]())['then'](realtime[_0x791d('0x23')]())['then'](user[_0x791d('0x24')]())['then'](realtime[_0x791d('0x25')]())['then'](trunk[_0x791d('0x26')]())[_0x791d('0x21')](realtime[_0x791d('0x27')]())[_0x791d('0x21')](voiceQueue[_0x791d('0x28')]())['then'](realtime[_0x791d('0x29')]())[_0x791d('0x21')](trigger[_0x791d('0x2a')]())[_0x791d('0x21')](realtime['initTriggers']())[_0x791d('0x21')](template[_0x791d('0x2b')]())['then'](realtime[_0x791d('0x2c')]())['then'](zendesk['getZendeskAccounts']())[_0x791d('0x21')](realtime[_0x791d('0x2d')]())['then'](salesforce[_0x791d('0x2e')]())[_0x791d('0x21')](realtime[_0x791d('0x2f')]())[_0x791d('0x21')](sugarcrm[_0x791d('0x30')]())[_0x791d('0x21')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x791d('0x31')]())[_0x791d('0x21')](realtime[_0x791d('0x32')]())[_0x791d('0x21')](desk[_0x791d('0x33')]())['then'](realtime[_0x791d('0x34')]())[_0x791d('0x21')](zoho[_0x791d('0x35')]())[_0x791d('0x21')](realtime[_0x791d('0x36')]())[_0x791d('0x21')](vtiger[_0x791d('0x37')]())['then'](realtime[_0x791d('0x38')]())[_0x791d('0x21')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x791d('0x39')]())[_0x791d('0x21')](servicenow[_0x791d('0x3a')]())[_0x791d('0x21')](realtime['initServicenowAccounts']())[_0x791d('0x21')](dynamics365['getDynamics365Accounts']())[_0x791d('0x21')](realtime[_0x791d('0x3b')]())[_0x791d('0x21')](campaign[_0x791d('0x3c')]())['then'](realtime[_0x791d('0x3d')]())[_0x791d('0x21')](voiceExtension['getVoiceExtensions']())[_0x791d('0x21')](realtime[_0x791d('0x3e')]())[_0x791d('0x21')](faxAccount['getFaxAccounts']())['then'](realtime[_0x791d('0x3f')]())[_0x791d('0x21')](function(){return realtime;});}function initParams(){return Promise[_0x791d('0x20')]()['then'](voiceQueueReport[_0x791d('0x40')]())[_0x791d('0x21')](realtime[_0x791d('0x41')]())[_0x791d('0x21')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x791d('0x42')]())[_0x791d('0x21')](cmHopperHistory[_0x791d('0x43')]())[_0x791d('0x21')](realtime[_0x791d('0x44')]())[_0x791d('0x21')](voiceCallReport['getVoiceCallReports']())[_0x791d('0x21')](realtime[_0x791d('0x45')]())[_0x791d('0x46')](function(_0x55ced8){logger['error'](_0x791d('0x47'),util[_0x791d('0x48')](_0x55ced8,{'showHidden':![],'depth':null}));});}function main(){return server[_0x791d('0x49')](realtime,preview,fax)[_0x791d('0x21')](function(){return initRealtime();})[_0x791d('0x21')](function(){return initParams();})[_0x791d('0x21')](function(){report[_0x791d('0x4a')]();setInterval(initRealtime,0x1388);})[_0x791d('0x46')](function(_0x16da78){logger[_0x791d('0x4b')](_0x791d('0x4c'),util[_0x791d('0x48')](_0x16da78,{'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 2636976..a71f6f1 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 _0x4434=['local','prototype','toLowerCase','not_inuse','idle','inuse','talking','toNumber','stringify','format','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold'];(function(_0x3f0b5a,_0x120a7b){var _0x2045a8=function(_0x2d5162){while(--_0x2d5162){_0x3f0b5a['push'](_0x3f0b5a['shift']());}};_0x2045a8(++_0x120a7b);}(_0x4434,0xb4));var _0x4443=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4434[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x4443('0x0'));var util=require(_0x4443('0x1'));var moment=require(_0x4443('0x2'));var md5=require(_0x4443('0x3'));var Redis=require(_0x4443('0x4'));var config=require('../../../config/environment');config[_0x4443('0x5')]=_[_0x4443('0x6')](config['redis'],{'host':_0x4443('0x7'),'port':0x18eb});var io=require(_0x4443('0x8'))(new Redis(config[_0x4443('0x5')]));function Agent(_0x47ace0){this['id']=_0x47ace0['id']||0x0;this['name']=_0x47ace0[_0x4443('0x9')]||'';this[_0x4443('0xa')]=_0x47ace0['email']||'';this[_0x4443('0xb')]=_0x47ace0[_0x4443('0xb')]||'';this[_0x4443('0xc')]=_0x47ace0[_0x4443('0xc')]||'';this[_0x4443('0xd')]=_0x4443('0xe');this[_0x4443('0xf')]=0x0;this['status']='unknown';this[_0x4443('0x10')]='';this['phone']='';this[_0x4443('0x11')]='';this[_0x4443('0x12')]='';this['online']=_0x47ace0[_0x4443('0x13')]||![];this[_0x4443('0x14')]=_0x4443('0xe');this[_0x4443('0x15')]=0x0;this[_0x4443('0x16')]='';this[_0x4443('0x17')]='';this[_0x4443('0x18')]=![];this[_0x4443('0x19')]=![];this['md5']='';}Agent[_0x4443('0x1a')]['updateStatusRealtime']=function(_0x14c27a){var _0x3b0e9e;if(_0x14c27a&&_0x14c27a['state']){_0x3b0e9e=_0x14c27a['state'][_0x4443('0x1b')]();switch(_0x3b0e9e){case _0x4443('0x1c'):_0x3b0e9e=_0x4443('0x1d');break;case _0x4443('0x1e'):_0x3b0e9e=_0x4443('0x1f');break;}}if(_0x3b0e9e&&this[_0x4443('0x14')]!==_0x3b0e9e||_0x14c27a['statePause']){this[_0x4443('0x15')]=_[_0x4443('0x20')](moment()['format']('x'));}if(_0x3b0e9e){this[_0x4443('0x14')]=_0x3b0e9e;}var _0x8eaaf9={'id':this['id'],'name':this['name'],'email':this[_0x4443('0xa')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x4443('0xd')],'stateTime':this[_0x4443('0xf')],'status':this['status'],'address':this[_0x4443('0x10')],'online':this[_0x4443('0x13')],'voiceStatus':this[_0x4443('0x14')],'voiceStatusTime':this[_0x4443('0x15')],'voiceStatusCallerIdNumber':this[_0x4443('0x16')],'voiceStatusQueue':this[_0x4443('0x17')],'interface':this['interface'],'onhold':this[_0x4443('0x18')]};var _0x3f8a88=md5(JSON[_0x4443('0x21')](_0x8eaaf9));if(this[_0x4443('0x3')]!==_0x3f8a88){this['md5']=_0x3f8a88;io['to'](util[_0x4443('0x22')](_0x4443('0x23'),_0x8eaaf9['name']))[_0x4443('0x24')](_0x4443('0x25'),_[_0x4443('0x26')](_0x8eaaf9,['online']));io[_0x4443('0x24')](_0x4443('0x27'),_0x8eaaf9);}};module[_0x4443('0x28')]=Agent; \ No newline at end of file +var _0x72b3=['format','address','interface','user:%s','emit','user:ami:update','omit','exports','util','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','toLowerCase','not_inuse','talking','statePause'];(function(_0x8af759,_0x340c5f){var _0x4268d7=function(_0x4841d){while(--_0x4841d){_0x8af759['push'](_0x8af759['shift']());}};_0x4268d7(++_0x340c5f);}(_0x72b3,0x10b));var _0x372b=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x72b3[_0x32b542];return _0x554d54;};'use strict';var _=require('lodash');var util=require(_0x372b('0x0'));var moment=require('moment');var md5=require(_0x372b('0x1'));var Redis=require(_0x372b('0x2'));var config=require(_0x372b('0x3'));config[_0x372b('0x4')]=_[_0x372b('0x5')](config[_0x372b('0x4')],{'host':_0x372b('0x6'),'port':0x18eb});var io=require(_0x372b('0x7'))(new Redis(config[_0x372b('0x4')]));function Agent(_0x5046b5){this['id']=_0x5046b5['id']||0x0;this[_0x372b('0x8')]=_0x5046b5['name']||'';this[_0x372b('0x9')]=_0x5046b5[_0x372b('0x9')]||'';this[_0x372b('0xa')]=_0x5046b5[_0x372b('0xa')]||'';this[_0x372b('0xb')]=_0x5046b5[_0x372b('0xb')]||'';this[_0x372b('0xc')]=_0x372b('0xd');this[_0x372b('0xe')]=0x0;this[_0x372b('0xf')]=_0x372b('0xd');this['address']='';this[_0x372b('0x10')]='';this['mobile']='';this['interface']='';this[_0x372b('0x11')]=_0x5046b5[_0x372b('0x11')]||![];this[_0x372b('0x12')]=_0x372b('0xd');this[_0x372b('0x13')]=0x0;this[_0x372b('0x14')]='';this[_0x372b('0x15')]='';this[_0x372b('0x16')]=![];this['local']=![];this['md5']='';}Agent[_0x372b('0x17')][_0x372b('0x18')]=function(_0x4ebb38){var _0x47f2f9;if(_0x4ebb38&&_0x4ebb38[_0x372b('0xc')]){_0x47f2f9=_0x4ebb38[_0x372b('0xc')][_0x372b('0x19')]();switch(_0x47f2f9){case _0x372b('0x1a'):_0x47f2f9='idle';break;case'inuse':_0x47f2f9=_0x372b('0x1b');break;}}if(_0x47f2f9&&this[_0x372b('0x12')]!==_0x47f2f9||_0x4ebb38[_0x372b('0x1c')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x372b('0x1d')]('x'));}if(_0x47f2f9){this['voiceStatus']=_0x47f2f9;}var _0x5e409e={'id':this['id'],'name':this['name'],'email':this[_0x372b('0x9')],'accountcode':this[_0x372b('0xa')],'fullname':this['fullname'],'state':this[_0x372b('0xc')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x372b('0x1e')],'online':this[_0x372b('0x11')],'voiceStatus':this[_0x372b('0x12')],'voiceStatusTime':this[_0x372b('0x13')],'voiceStatusCallerIdNumber':this[_0x372b('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x372b('0x1f')],'onhold':this[_0x372b('0x16')]};var _0x33ac41=md5(JSON['stringify'](_0x5e409e));if(this['md5']!==_0x33ac41){this['md5']=_0x33ac41;io['to'](util[_0x372b('0x1d')](_0x372b('0x20'),_0x5e409e[_0x372b('0x8')]))[_0x372b('0x21')](_0x372b('0x22'),_[_0x372b('0x23')](_0x5e409e,[_0x372b('0x11')]));io['emit']('user:presence',_0x5e409e);}};module[_0x372b('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 2f4065c..3d7e18c 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 _0xe064=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject'];(function(_0x118439,_0x1907d9){var _0x209b67=function(_0x51e946){while(--_0x51e946){_0x118439['push'](_0x118439['shift']());}};_0x209b67(++_0x1907d9);}(_0xe064,0x69));var _0x4e06=function(_0x190e94,_0x117fc1){_0x190e94=_0x190e94-0x0;var _0x3012a0=_0xe064[_0x190e94];return _0x3012a0;};'use strict';function Campaign(_0x217dfa){this['id']=_0x217dfa['id']||0x0;this[_0x4e06('0x0')]=_0x217dfa[_0x4e06('0x0')]||'';this[_0x4e06('0x1')]=_0x217dfa[_0x4e06('0x1')]||_0x4e06('0x2');this[_0x4e06('0x3')]=0x0;this[_0x4e06('0x4')]=0x0;this[_0x4e06('0x5')]=0x0;this[_0x4e06('0x6')]=0x0;this[_0x4e06('0x7')]='';this[_0x4e06('0x8')]=!![];this[_0x4e06('0x9')]=_0x217dfa[_0x4e06('0x9')];this[_0x4e06('0xa')]=_0x217dfa[_0x4e06('0xa')];this[_0x4e06('0xb')]=_0x217dfa['dialTimezone']||null;this[_0x4e06('0xc')]=_0x217dfa[_0x4e06('0xc')]?_0x217dfa['dialGlobalInterval']:null;this[_0x4e06('0xd')]=_0x217dfa[_0x4e06('0xd')];this[_0x4e06('0xe')]=_0x217dfa[_0x4e06('0xe')];this['dialOriginateTimeout']=_0x217dfa['dialOriginateTimeout']||0x1e;this[_0x4e06('0xf')]=_0x217dfa[_0x4e06('0xf')];this[_0x4e06('0x10')]=_0x217dfa[_0x4e06('0x10')];this['dialBusyMaxRetry']=_0x217dfa['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x217dfa[_0x4e06('0x11')];this['dialNoAnswerMaxRetry']=_0x217dfa[_0x4e06('0x12')];this['dialNoAnswerRetryFrequency']=_0x217dfa[_0x4e06('0x13')];this[_0x4e06('0x14')]=_0x217dfa[_0x4e06('0x14')];this[_0x4e06('0x15')]=_0x217dfa[_0x4e06('0x15')]||0x3;this[_0x4e06('0x16')]=_0x217dfa[_0x4e06('0x16')]||0x96;this[_0x4e06('0x17')]=_0x217dfa['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x217dfa[_0x4e06('0x18')]||0x96;this[_0x4e06('0x19')]=_0x217dfa['dialAbandonedMaxRetry']||0x3;this[_0x4e06('0x1a')]=_0x217dfa[_0x4e06('0x1a')]||0x96;this[_0x4e06('0x1b')]=_0x217dfa[_0x4e06('0x1b')]||0x3;this[_0x4e06('0x1c')]=_0x217dfa['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x217dfa[_0x4e06('0x1d')]||0x3;this[_0x4e06('0x1e')]=_0x217dfa['dialAgentRejectRetryFrequency']||0x96;this[_0x4e06('0x1f')]=_0x217dfa['dialOrderByScheduledAt']||_0x4e06('0x20');this['dialPrefix']=_0x217dfa[_0x4e06('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x217dfa['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x4e06('0x22')]=_0x217dfa[_0x4e06('0x22')]||undefined;this[_0x4e06('0x23')]=_0x217dfa['TrunkBackup']?_0x217dfa[_0x4e06('0x23')]:undefined;this[_0x4e06('0x24')]=_0x217dfa[_0x4e06('0x24')]?_0x217dfa['Trunk']:undefined;this[_0x4e06('0x25')]=_0x217dfa[_0x4e06('0x25')]?_0x217dfa[_0x4e06('0x25')]:undefined;this[_0x4e06('0x26')]=_0x217dfa[_0x4e06('0x26')]?_0x217dfa['SquareProject']:undefined;this['dialQueueProject']=_0x217dfa[_0x4e06('0x26')]?_0x217dfa[_0x4e06('0x26')][_0x4e06('0x0')]:undefined;this[_0x4e06('0x27')]=_0x217dfa[_0x4e06('0x27')]||![];this[_0x4e06('0x28')]=_0x217dfa[_0x4e06('0x28')];this['dialAMDGreeting']=_0x217dfa[_0x4e06('0x29')];this['dialAMDAfterGreetingSilence']=_0x217dfa[_0x4e06('0x2a')];this['dialAMDTotalAnalysisTime']=_0x217dfa['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x217dfa[_0x4e06('0x2b')];this['dialAMDBetweenWordsSilence']=_0x217dfa['dialAMDBetweenWordsSilence'];this[_0x4e06('0x2c')]=_0x217dfa[_0x4e06('0x2c')];this[_0x4e06('0x2d')]=_0x217dfa[_0x4e06('0x2d')];this[_0x4e06('0x2e')]=_0x217dfa[_0x4e06('0x2e')];}module[_0x4e06('0x2f')]=Campaign; \ No newline at end of file +var _0x7dc6=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','temp','ivrAnswerCallsDay','message','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence'];(function(_0xb40401,_0x17393f){var _0x3569e4=function(_0x13ca54){while(--_0x13ca54){_0xb40401['push'](_0xb40401['shift']());}};_0x3569e4(++_0x17393f);}(_0x7dc6,0x15f));var _0x67dc=function(_0xb17a1a,_0x5919fb){_0xb17a1a=_0xb17a1a-0x0;var _0x3fc41e=_0x7dc6[_0xb17a1a];return _0x3fc41e;};'use strict';function Campaign(_0x3a1414){this['id']=_0x3a1414['id']||0x0;this['name']=_0x3a1414[_0x67dc('0x0')]||'';this[_0x67dc('0x1')]=_0x3a1414[_0x67dc('0x1')]||_0x67dc('0x2');this['originated']=0x0;this[_0x67dc('0x3')]=0x0;this[_0x67dc('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x67dc('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x67dc('0x6')]=_0x3a1414['active'];this[_0x67dc('0x7')]=_0x3a1414[_0x67dc('0x7')];this['dialTimezone']=_0x3a1414['dialTimezone']||null;this['dialGlobalInterval']=_0x3a1414[_0x67dc('0x8')]?_0x3a1414[_0x67dc('0x8')]:null;this[_0x67dc('0x9')]=_0x3a1414[_0x67dc('0x9')];this[_0x67dc('0xa')]=_0x3a1414[_0x67dc('0xa')];this[_0x67dc('0xb')]=_0x3a1414[_0x67dc('0xb')]||0x1e;this[_0x67dc('0xc')]=_0x3a1414[_0x67dc('0xc')];this[_0x67dc('0xd')]=_0x3a1414[_0x67dc('0xd')];this[_0x67dc('0xe')]=_0x3a1414[_0x67dc('0xe')];this['dialBusyRetryFrequency']=_0x3a1414[_0x67dc('0xf')];this[_0x67dc('0x10')]=_0x3a1414[_0x67dc('0x10')];this['dialNoAnswerRetryFrequency']=_0x3a1414[_0x67dc('0x11')];this[_0x67dc('0x12')]=_0x3a1414[_0x67dc('0x12')];this[_0x67dc('0x13')]=_0x3a1414[_0x67dc('0x13')]||0x3;this[_0x67dc('0x14')]=_0x3a1414['dialNoSuchNumberRetryFrequency']||0x96;this[_0x67dc('0x15')]=_0x3a1414[_0x67dc('0x15')]||0x3;this[_0x67dc('0x16')]=_0x3a1414[_0x67dc('0x16')]||0x96;this[_0x67dc('0x17')]=_0x3a1414[_0x67dc('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x3a1414[_0x67dc('0x18')]||0x96;this[_0x67dc('0x19')]=_0x3a1414[_0x67dc('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x3a1414[_0x67dc('0x1a')]||0x96;this[_0x67dc('0x1b')]=_0x3a1414[_0x67dc('0x1b')]||0x3;this[_0x67dc('0x1c')]=_0x3a1414[_0x67dc('0x1c')]||0x96;this[_0x67dc('0x1d')]=_0x3a1414[_0x67dc('0x1d')]||_0x67dc('0x1e');this[_0x67dc('0x1f')]=_0x3a1414['dialPrefix']||undefined;this[_0x67dc('0x20')]=_0x3a1414['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x67dc('0x21')]=_0x3a1414[_0x67dc('0x21')]||undefined;this[_0x67dc('0x22')]=_0x3a1414[_0x67dc('0x22')]?_0x3a1414[_0x67dc('0x22')]:undefined;this[_0x67dc('0x23')]=_0x3a1414[_0x67dc('0x23')]?_0x3a1414[_0x67dc('0x23')]:undefined;this[_0x67dc('0x24')]=_0x3a1414[_0x67dc('0x24')]?_0x3a1414[_0x67dc('0x24')]:undefined;this[_0x67dc('0x25')]=_0x3a1414[_0x67dc('0x25')]?_0x3a1414[_0x67dc('0x25')]:undefined;this[_0x67dc('0x26')]=_0x3a1414[_0x67dc('0x25')]?_0x3a1414['SquareProject'][_0x67dc('0x0')]:undefined;this['dialAMDActive']=_0x3a1414[_0x67dc('0x27')]||![];this[_0x67dc('0x28')]=_0x3a1414[_0x67dc('0x28')];this[_0x67dc('0x29')]=_0x3a1414[_0x67dc('0x29')];this[_0x67dc('0x2a')]=_0x3a1414[_0x67dc('0x2a')];this[_0x67dc('0x2b')]=_0x3a1414['dialAMDTotalAnalysisTime'];this[_0x67dc('0x2c')]=_0x3a1414[_0x67dc('0x2c')];this[_0x67dc('0x2d')]=_0x3a1414['dialAMDBetweenWordsSilence'];this[_0x67dc('0x2e')]=_0x3a1414[_0x67dc('0x2e')];this['dialAMDSilenceThreshold']=_0x3a1414[_0x67dc('0x2f')];this[_0x67dc('0x30')]=_0x3a1414[_0x67dc('0x30')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 1035132..5a017f6 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 _0x97e6=['holdtime','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','duration','billableseconds'];(function(_0x3f0b2a,_0x52f963){var _0x23bd63=function(_0x238936){while(--_0x238936){_0x3f0b2a['push'](_0x3f0b2a['shift']());}};_0x23bd63(++_0x52f963);}(_0x97e6,0x159));var _0x697e=function(_0x2b18d8,_0x21778e){_0x2b18d8=_0x2b18d8-0x0;var _0x2bcce2=_0x97e6[_0x2b18d8];return _0x2bcce2;};'use strict';function Channel(){this[_0x697e('0x0')]=null;this['channel']='';this[_0x697e('0x1')]='';this[_0x697e('0x2')]=0x0;this[_0x697e('0x3')]='';this['connectedlinenum']=undefined;this[_0x697e('0x4')]=undefined;this[_0x697e('0x5')]=0x0;this['context']='';this[_0x697e('0x6')]=0x0;this['linkedid']=0x0;this[_0x697e('0x7')]=0x0;this[_0x697e('0x8')]=![];this[_0x697e('0x9')]=null;this[_0x697e('0xa')]=null;this[_0x697e('0xb')]=![];this[_0x697e('0xc')]=![];this['lastapplication']='';this['lastdata']='';this[_0x697e('0xd')]=0x0;this[_0x697e('0xe')]=0x0;this[_0x697e('0xf')]=0x0;this['type']=null;this[_0x697e('0x10')]=null;this[_0x697e('0x11')]=null;this[_0x697e('0x12')]=![];this[_0x697e('0x13')]=null;this[_0x697e('0x14')]=null;this['monitors']=[];this[_0x697e('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x697e('0x16')]=0x0;}module[_0x697e('0x17')]=Channel; \ No newline at end of file +var _0x390a=['exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','endtime','unmanaged','lastdata','duration','billableseconds','holdtime','type','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','mohtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x390a,0xc9));var _0xa390=function(_0x5e3d4b,_0xb90666){_0x5e3d4b=_0x5e3d4b-0x0;var _0x5d5474=_0x390a[_0x5e3d4b];return _0x5d5474;};'use strict';function Channel(){this[_0xa390('0x0')]=null;this[_0xa390('0x1')]='';this[_0xa390('0x2')]='';this[_0xa390('0x3')]=0x0;this['calleridname']='';this[_0xa390('0x4')]=undefined;this[_0xa390('0x5')]=undefined;this[_0xa390('0x6')]=0x0;this[_0xa390('0x7')]='';this['uniqueid']=0x0;this[_0xa390('0x8')]=0x0;this[_0xa390('0x9')]=0x0;this[_0xa390('0xa')]=![];this['answertime']=null;this[_0xa390('0xb')]=null;this[_0xa390('0xc')]=![];this['abandoned']=![];this['lastapplication']='';this[_0xa390('0xd')]='';this[_0xa390('0xe')]=0x0;this[_0xa390('0xf')]=0x0;this[_0xa390('0x10')]=0x0;this[_0xa390('0x11')]=null;this['tag']=null;this['disposition']=null;this[_0xa390('0x12')]=![];this[_0xa390('0x13')]=null;this[_0xa390('0x14')]=null;this['monitors']=[];this[_0xa390('0x15')]=undefined;this[_0xa390('0x16')]=undefined;this['transferType']=undefined;this[_0xa390('0x17')]=0x0;}module[_0xa390('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 b5f8621..0c1938e 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 _0xc794=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x166624,_0x5ca7fc){var _0x22071e=function(_0x140111){while(--_0x140111){_0x166624['push'](_0x166624['shift']());}};_0x22071e(++_0x5ca7fc);}(_0xc794,0x8c));var _0x4c79=function(_0x314a8b,_0x5bffa0){_0x314a8b=_0x314a8b-0x0;var _0x2fd0bc=_0xc794[_0x314a8b];return _0x2fd0bc;};'use strict';function DeskAccount(_0x4bdab6){this['id']=_0x4bdab6['id']||0x0;this[_0x4c79('0x0')]=_0x4bdab6[_0x4c79('0x0')]||'';this[_0x4c79('0x1')]=_0x4bdab6[_0x4c79('0x1')]||'';this[_0x4c79('0x2')]=_0x4bdab6[_0x4c79('0x2')]||'';this[_0x4c79('0x3')]=_0x4bdab6['authType']||'';this[_0x4c79('0x4')]=_0x4bdab6['password']||'';this[_0x4c79('0x5')]=_0x4bdab6[_0x4c79('0x5')]||'';this[_0x4c79('0x6')]=_0x4bdab6['consumerSecret']||'';this[_0x4c79('0x7')]=_0x4bdab6[_0x4c79('0x7')]||'';this[_0x4c79('0x8')]=_0x4bdab6[_0x4c79('0x8')]||'';this['type']=_0x4bdab6[_0x4c79('0x9')]||'';this[_0x4c79('0xa')]=_0x4bdab6[_0x4c79('0xa')]||'';this[_0x4c79('0xb')]=_0x4bdab6[_0x4c79('0xb')]||{};}module[_0x4c79('0xc')]=DeskAccount; \ No newline at end of file +var _0x9dba=['type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x1cb5e7,_0x4a3373){var _0x28f3b8=function(_0x277479){while(--_0x277479){_0x1cb5e7['push'](_0x1cb5e7['shift']());}};_0x28f3b8(++_0x4a3373);}(_0x9dba,0x16e));var _0xa9db=function(_0x5d42e8,_0x187f25){_0x5d42e8=_0x5d42e8-0x0;var _0x5dcb9f=_0x9dba[_0x5d42e8];return _0x5dcb9f;};'use strict';function DeskAccount(_0xc219b1){this['id']=_0xc219b1['id']||0x0;this[_0xa9db('0x0')]=_0xc219b1[_0xa9db('0x0')]||'';this[_0xa9db('0x1')]=_0xc219b1['username']||'';this[_0xa9db('0x2')]=_0xc219b1['remoteUri']||'';this[_0xa9db('0x3')]=_0xc219b1[_0xa9db('0x3')]||'';this[_0xa9db('0x4')]=_0xc219b1[_0xa9db('0x4')]||'';this[_0xa9db('0x5')]=_0xc219b1['consumerKey']||'';this[_0xa9db('0x6')]=_0xc219b1[_0xa9db('0x6')]||'';this['token']=_0xc219b1[_0xa9db('0x7')]||'';this['tokenSecret']=_0xc219b1['tokenSecret']||'';this['type']=_0xc219b1[_0xa9db('0x8')]||'';this[_0xa9db('0x9')]=_0xc219b1[_0xa9db('0x9')]||'';this[_0xa9db('0xa')]=_0xc219b1[_0xa9db('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 41b3ab2..6eafb38 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 _0x0ccf=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x3c5548,_0x56a36e){var _0x403230=function(_0x4fb54d){while(--_0x4fb54d){_0x3c5548['push'](_0x3c5548['shift']());}};_0x403230(++_0x56a36e);}(_0x0ccf,0x7a));var _0xf0cc=function(_0x4108e9,_0x58da63){_0x4108e9=_0x4108e9-0x0;var _0x369cc4=_0x0ccf[_0x4108e9];return _0x369cc4;};'use strict';function Dynamics365Account(_0x40ce65){this['id']=_0x40ce65['id']||0x0;this[_0xf0cc('0x0')]=_0x40ce65['name']||'';this[_0xf0cc('0x1')]=_0x40ce65[_0xf0cc('0x1')]||'';this[_0xf0cc('0x2')]=_0x40ce65[_0xf0cc('0x2')]||'';this[_0xf0cc('0x3')]=_0x40ce65[_0xf0cc('0x3')]||'';this['tenantId']=_0x40ce65[_0xf0cc('0x4')]||'';this[_0xf0cc('0x5')]=_0x40ce65[_0xf0cc('0x5')]||'';this[_0xf0cc('0x6')]=_0x40ce65[_0xf0cc('0x6')]||{};this['serverUrl']=_0x40ce65[_0xf0cc('0x7')]||'';this[_0xf0cc('0x8')]=_0x40ce65[_0xf0cc('0x8')]||![];this[_0xf0cc('0x9')]=_0x40ce65[_0xf0cc('0x9')]||{};this[_0xf0cc('0xa')]=_0x40ce65[_0xf0cc('0xa')]||{};}module[_0xf0cc('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x172c=['serverUrl','modernAuthentication','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x172c,0xd5));var _0xc172=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x172c[_0x4de877];return _0xb2cfeb;};'use strict';function Dynamics365Account(_0x4e6e4d){this['id']=_0x4e6e4d['id']||0x0;this[_0xc172('0x0')]=_0x4e6e4d[_0xc172('0x0')]||'';this[_0xc172('0x1')]=_0x4e6e4d[_0xc172('0x1')]||'';this['password']=_0x4e6e4d[_0xc172('0x2')]||'';this[_0xc172('0x3')]=_0x4e6e4d[_0xc172('0x3')]||'';this['tenantId']=_0x4e6e4d[_0xc172('0x4')]||'';this[_0xc172('0x5')]=_0x4e6e4d['clientId']||'';this[_0xc172('0x6')]=_0x4e6e4d[_0xc172('0x6')]||{};this['serverUrl']=_0x4e6e4d[_0xc172('0x7')]||'';this['modernAuthentication']=_0x4e6e4d[_0xc172('0x8')]||![];this['Configurations']=_0x4e6e4d['Configurations']||{};this[_0xc172('0x9')]=_0x4e6e4d[_0xc172('0x9')]||{};}module[_0xc172('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ecfb7b8..8f9a317 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 _0x9562=['tech','SIP','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x9562,0x149));var _0x2956=function(_0x60a6f0,_0x2d4964){_0x60a6f0=_0x60a6f0-0x0;var _0x32b728=_0x9562[_0x60a6f0];return _0x32b728;};'use strict';function FaxAccount(_0x38be9c){this['id']=_0x38be9c['id']||0x0;this['name']=_0x38be9c['name']||'';this[_0x2956('0x0')]=_0x38be9c[_0x2956('0x0')];this[_0x2956('0x1')]=_0x38be9c['ecm'];this[_0x2956('0x2')]=_0x38be9c[_0x2956('0x2')];this[_0x2956('0x3')]=_0x38be9c['localstationid'];this[_0x2956('0x4')]=_0x38be9c[_0x2956('0x4')]||0x960;this[_0x2956('0x5')]=_0x38be9c['maxrate']||0x3840;this[_0x2956('0x6')]=_0x38be9c[_0x2956('0x6')]||_0x2956('0x7');this[_0x2956('0x8')]=_0x38be9c[_0x2956('0x8')]||'no';this[_0x2956('0x9')]=_0x38be9c[_0x2956('0x9')]||'no';this[_0x2956('0xa')]=_0x38be9c[_0x2956('0xa')]||0x1388;this[_0x2956('0xb')]=_0x38be9c[_0x2956('0xb')]||_0x2956('0xc');this[_0x2956('0xd')]=_0x38be9c[_0x2956('0xd')]?_0x38be9c[_0x2956('0xd')]:undefined;this[_0x2956('0xe')]=_0x38be9c['ListId'];this[_0x2956('0xf')]=_0x38be9c[_0x2956('0xf')];}module[_0x2956('0x10')]=FaxAccount; \ No newline at end of file +var _0xe12d=['maxrate','modem','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe12d,0x109));var _0xde12=function(_0x482214,_0x4ff70a){_0x482214=_0x482214-0x0;var _0x283386=_0xe12d[_0x482214];return _0x283386;};'use strict';function FaxAccount(_0x52c56e){this['id']=_0x52c56e['id']||0x0;this[_0xde12('0x0')]=_0x52c56e['name']||'';this[_0xde12('0x1')]=_0x52c56e[_0xde12('0x1')];this[_0xde12('0x2')]=_0x52c56e['ecm'];this[_0xde12('0x3')]=_0x52c56e[_0xde12('0x3')];this[_0xde12('0x4')]=_0x52c56e[_0xde12('0x4')];this['minrate']=_0x52c56e['minrate']||0x960;this[_0xde12('0x5')]=_0x52c56e[_0xde12('0x5')]||0x3840;this['modem']=_0x52c56e[_0xde12('0x6')]||'v17,v27,v29';this['gateway']=_0x52c56e[_0xde12('0x7')]||'no';this['faxdetect']=_0x52c56e[_0xde12('0x8')]||'no';this[_0xde12('0x9')]=_0x52c56e['t38timeout']||0x1388;this['tech']=_0x52c56e['tech']||_0xde12('0xa');this[_0xde12('0xb')]=_0x52c56e['Trunk']?_0x52c56e[_0xde12('0xb')]:undefined;this[_0xde12('0xc')]=_0x52c56e[_0xde12('0xc')];this[_0xde12('0xd')]=_0x52c56e['key'];}module[_0xde12('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f47018b..8c06add 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 _0x01f7=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x24553b,_0x4891e6){var _0x9756cf=function(_0x1df919){while(--_0x1df919){_0x24553b['push'](_0x24553b['shift']());}};_0x9756cf(++_0x4891e6);}(_0x01f7,0x14f));var _0x701f=function(_0x40710f,_0x3f145e){_0x40710f=_0x40710f-0x0;var _0x591385=_0x01f7[_0x40710f];return _0x591385;};'use strict';function FreshdeskAccount(_0x3d436d){this['id']=_0x3d436d['id']||0x0;this[_0x701f('0x0')]=_0x3d436d[_0x701f('0x0')]||'';this[_0x701f('0x1')]=_0x3d436d[_0x701f('0x1')]||'';this[_0x701f('0x2')]=_0x3d436d[_0x701f('0x3')]||'';this[_0x701f('0x4')]=_0x3d436d[_0x701f('0x4')]||'';this[_0x701f('0x5')]=_0x3d436d[_0x701f('0x5')]||'';this[_0x701f('0x6')]=_0x3d436d[_0x701f('0x6')]||{};}module[_0x701f('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x4064=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4064,0x1d5));var _0x4406=function(_0x31062a,_0x5a0b35){_0x31062a=_0x31062a-0x0;var _0x5529e6=_0x4064[_0x31062a];return _0x5529e6;};'use strict';function FreshdeskAccount(_0x1b15e4){this['id']=_0x1b15e4['id']||0x0;this['name']=_0x1b15e4[_0x4406('0x0')]||'';this[_0x4406('0x1')]=_0x1b15e4[_0x4406('0x1')]||'';this[_0x4406('0x2')]=_0x1b15e4[_0x4406('0x3')]||'';this[_0x4406('0x4')]=_0x1b15e4[_0x4406('0x4')]||'';this[_0x4406('0x5')]=_0x1b15e4['serverUrl']||'';this[_0x4406('0x6')]=_0x1b15e4[_0x4406('0x6')]||{};}module[_0x4406('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 4dc81b4..0267cc8 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 _0x5577=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x252262,_0xd3d7d7){var _0x1b42b1=function(_0x1a0d3c){while(--_0x1a0d3c){_0x252262['push'](_0x252262['shift']());}};_0x1b42b1(++_0xd3d7d7);}(_0x5577,0x1b4));var _0x7557=function(_0x181d19,_0x46822d){_0x181d19=_0x181d19-0x0;var _0x227c31=_0x5577[_0x181d19];return _0x227c31;};'use strict';function FreshsalesAccount(_0x10e903){this['id']=_0x10e903['id']||0x0;this['name']=_0x10e903[_0x7557('0x0')]||'';this[_0x7557('0x1')]=_0x10e903['username']||'';this[_0x7557('0x2')]=_0x10e903[_0x7557('0x3')]||'';this[_0x7557('0x4')]=_0x10e903[_0x7557('0x4')]||'';this[_0x7557('0x5')]=_0x10e903[_0x7557('0x5')]||'';this['Configurations']=_0x10e903[_0x7557('0x6')]||{};}module[_0x7557('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xfdcd=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x3ea360,_0x4a3b9e){var _0x330457=function(_0x3c221a){while(--_0x3c221a){_0x3ea360['push'](_0x3ea360['shift']());}};_0x330457(++_0x4a3b9e);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfdcd[_0x14add3];return _0x4a174f;};'use strict';function FreshsalesAccount(_0x4bcabd){this['id']=_0x4bcabd['id']||0x0;this[_0xdfdc('0x0')]=_0x4bcabd[_0xdfdc('0x0')]||'';this[_0xdfdc('0x1')]=_0x4bcabd['username']||'';this[_0xdfdc('0x2')]=_0x4bcabd[_0xdfdc('0x3')]||'';this[_0xdfdc('0x4')]=_0x4bcabd[_0xdfdc('0x4')]||'';this[_0xdfdc('0x5')]=_0x4bcabd[_0xdfdc('0x5')]||'';this[_0xdfdc('0x6')]=_0x4bcabd[_0xdfdc('0x6')]||{};}module[_0xdfdc('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index fa5c050..a4454ac 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 _0x769a=['connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x769a,0x15d));var _0xa769=function(_0xd8aad0,_0x4da2cd){_0xd8aad0=_0xd8aad0-0x0;var _0x570860=_0x769a[_0xd8aad0];return _0x570860;};'use strict';function QueueReport(){this[_0xa769('0x0')]=_0xa769('0x1');this[_0xa769('0x2')]='';this[_0xa769('0x3')]='';this[_0xa769('0x4')]='';this['queue']='';this[_0xa769('0x5')]=null;this[_0xa769('0x6')]=null;this[_0xa769('0x7')]=0x1;this[_0xa769('0x8')]=0x1;this['queuecallerabandon']=![];this[_0xa769('0x9')]=null;this[_0xa769('0xa')]=![];this[_0xa769('0xb')]=null;this[_0xa769('0xc')]=![];this[_0xa769('0xd')]=null;this['originalposition']=0x1;this[_0xa769('0xe')]='';this['connectedlinenum']='';this[_0xa769('0xf')]='';this[_0xa769('0x10')]='';this[_0xa769('0x11')]='';this[_0xa769('0x12')]='';this[_0xa769('0x13')]='';this['holdtime']=0x0;this[_0xa769('0x14')]=![];this[_0xa769('0x15')]='';this['motionChannel']=_0xa769('0x16');this[_0xa769('0x17')]=0x0;this[_0xa769('0x18')]={};}module[_0xa769('0x19')]=QueueReport; \ No newline at end of file +var _0x1ff4=['queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','channel','accountcode','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','inbound','uniqueid','queue','queuecallerjoinAt'];(function(_0x38045f,_0x551f77){var _0xfd4f8c=function(_0x362607){while(--_0x362607){_0x38045f['push'](_0x38045f['shift']());}};_0xfd4f8c(++_0x551f77);}(_0x1ff4,0x96));var _0x41ff=function(_0x4f994c,_0x12df20){_0x4f994c=_0x4f994c-0x0;var _0x38625b=_0x1ff4[_0x4f994c];return _0x38625b;};'use strict';function QueueReport(){this['type']=_0x41ff('0x0');this[_0x41ff('0x1')]='';this['calleridnum']='';this['calleridname']='';this[_0x41ff('0x2')]='';this[_0x41ff('0x3')]=null;this[_0x41ff('0x4')]=null;this[_0x41ff('0x5')]=0x1;this[_0x41ff('0x6')]=0x1;this[_0x41ff('0x7')]=![];this[_0x41ff('0x8')]=null;this[_0x41ff('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x41ff('0xa')]=![];this[_0x41ff('0xb')]=null;this['originalposition']=0x1;this[_0x41ff('0xc')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x41ff('0xd')]='';this['context']='';this['exten']='';this[_0x41ff('0xe')]='';this[_0x41ff('0xf')]=0x0;this[_0x41ff('0x10')]=![];this[_0x41ff('0x11')]='';this[_0x41ff('0x12')]=_0x41ff('0x13');this[_0x41ff('0x14')]=0x0;this[_0x41ff('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index cc2be3e..d43258d 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 _0xb2ed=['Configurations','exports','name','username','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x4810a3,_0x354a38){var _0x3c0dc9=function(_0x54a917){while(--_0x54a917){_0x4810a3['push'](_0x4810a3['shift']());}};_0x3c0dc9(++_0x354a38);}(_0xb2ed,0x120));var _0xdb2e=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0xb2ed[_0xf91841];return _0x4b9c44;};'use strict';function SalesforceAccount(_0x39dab2){this['id']=_0x39dab2['id']||0x0;this[_0xdb2e('0x0')]=_0x39dab2['name']||'';this[_0xdb2e('0x1')]=_0x39dab2[_0xdb2e('0x1')]||'';this['remoteUri']=_0x39dab2['remoteUri']||'';this[_0xdb2e('0x2')]=_0x39dab2[_0xdb2e('0x2')]||'';this[_0xdb2e('0x3')]=_0x39dab2[_0xdb2e('0x3')]||'';this[_0xdb2e('0x4')]=_0x39dab2[_0xdb2e('0x4')]||'';this[_0xdb2e('0x5')]=_0x39dab2[_0xdb2e('0x5')]||'';this[_0xdb2e('0x6')]=_0x39dab2['type']||_0xdb2e('0x7');this[_0xdb2e('0x8')]=_0x39dab2[_0xdb2e('0x8')]||'';this[_0xdb2e('0x9')]=_0x39dab2[_0xdb2e('0x9')]||{};}module[_0xdb2e('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x9ac0=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ac0,0x116));var _0x09ac=function(_0x4602fe,_0x35fd0b){_0x4602fe=_0x4602fe-0x0;var _0x4efdf6=_0x9ac0[_0x4602fe];return _0x4efdf6;};'use strict';function SalesforceAccount(_0x263836){this['id']=_0x263836['id']||0x0;this[_0x09ac('0x0')]=_0x263836[_0x09ac('0x0')]||'';this[_0x09ac('0x1')]=_0x263836[_0x09ac('0x1')]||'';this[_0x09ac('0x2')]=_0x263836[_0x09ac('0x2')]||'';this[_0x09ac('0x3')]=_0x263836['password']||'';this[_0x09ac('0x4')]=_0x263836[_0x09ac('0x4')]||'';this[_0x09ac('0x5')]=_0x263836[_0x09ac('0x5')]||'';this[_0x09ac('0x6')]=_0x263836[_0x09ac('0x6')]||'';this[_0x09ac('0x7')]=_0x263836[_0x09ac('0x7')]||_0x09ac('0x8');this[_0x09ac('0x9')]=_0x263836[_0x09ac('0x9')]||'';this[_0x09ac('0xa')]=_0x263836[_0x09ac('0xa')]||{};}module[_0x09ac('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 4e1b62d..32e21e9 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 _0x0e3f=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1d90d9,_0x315775){var _0x51b231=function(_0x129fd0){while(--_0x129fd0){_0x1d90d9['push'](_0x1d90d9['shift']());}};_0x51b231(++_0x315775);}(_0x0e3f,0xff));var _0xf0e3=function(_0x4a94c4,_0x4a9f12){_0x4a94c4=_0x4a94c4-0x0;var _0xf5ec58=_0x0e3f[_0x4a94c4];return _0xf5ec58;};'use strict';function ServicenowAccount(_0x26e68e){this['id']=_0x26e68e['id']||0x0;this[_0xf0e3('0x0')]=_0x26e68e[_0xf0e3('0x0')]||'';this[_0xf0e3('0x1')]=_0x26e68e[_0xf0e3('0x1')]||'';this[_0xf0e3('0x2')]=_0x26e68e['password']||'';this['remoteUri']=_0x26e68e[_0xf0e3('0x3')]||'';this[_0xf0e3('0x4')]=_0x26e68e[_0xf0e3('0x4')]||'';this[_0xf0e3('0x5')]=_0x26e68e[_0xf0e3('0x5')]||{};}module[_0xf0e3('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xb6c5=['remoteUri','serverUrl','Configurations','exports','username','password'];(function(_0x9ba86c,_0x5ee669){var _0x456425=function(_0x3c80b8){while(--_0x3c80b8){_0x9ba86c['push'](_0x9ba86c['shift']());}};_0x456425(++_0x5ee669);}(_0xb6c5,0x1ea));var _0x5b6c=function(_0x437ba0,_0x30b5dd){_0x437ba0=_0x437ba0-0x0;var _0x6fa2ec=_0xb6c5[_0x437ba0];return _0x6fa2ec;};'use strict';function ServicenowAccount(_0x40cba0){this['id']=_0x40cba0['id']||0x0;this['name']=_0x40cba0['name']||'';this[_0x5b6c('0x0')]=_0x40cba0[_0x5b6c('0x0')]||'';this['password']=_0x40cba0[_0x5b6c('0x1')]||'';this[_0x5b6c('0x2')]=_0x40cba0[_0x5b6c('0x2')]||'';this[_0x5b6c('0x3')]=_0x40cba0['serverUrl']||'';this[_0x5b6c('0x4')]=_0x40cba0[_0x5b6c('0x4')]||{};}module[_0x5b6c('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index e12f31f..1de934d 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 _0x844b=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x844b,0x1cd));var _0xb844=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0x844b[_0x28b0a4];return _0x105ce6;};'use strict';function SugarcrmAccount(_0x4280f7){this['id']=_0x4280f7['id']||0x0;this['name']=_0x4280f7[_0xb844('0x0')]||'';this[_0xb844('0x1')]=_0x4280f7[_0xb844('0x1')]||'';this[_0xb844('0x2')]=_0x4280f7[_0xb844('0x2')]||'';this[_0xb844('0x3')]=_0x4280f7['remoteUri']||'';this[_0xb844('0x4')]=_0x4280f7['serverUrl']||'';this['Configurations']=_0x4280f7[_0xb844('0x5')]||{};}module[_0xb844('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xc278=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x41e6d1,_0x2eeddb){var _0x3441f1=function(_0x5eef95){while(--_0x5eef95){_0x41e6d1['push'](_0x41e6d1['shift']());}};_0x3441f1(++_0x2eeddb);}(_0xc278,0xcb));var _0x8c27=function(_0x2659b4,_0x38e84b){_0x2659b4=_0x2659b4-0x0;var _0x116917=_0xc278[_0x2659b4];return _0x116917;};'use strict';function SugarcrmAccount(_0x23acc9){this['id']=_0x23acc9['id']||0x0;this[_0x8c27('0x0')]=_0x23acc9[_0x8c27('0x0')]||'';this[_0x8c27('0x1')]=_0x23acc9['username']||'';this[_0x8c27('0x2')]=_0x23acc9[_0x8c27('0x2')]||'';this[_0x8c27('0x3')]=_0x23acc9[_0x8c27('0x3')]||'';this[_0x8c27('0x4')]=_0x23acc9[_0x8c27('0x4')]||'';this[_0x8c27('0x5')]=_0x23acc9[_0x8c27('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index c9f9843..42d827b 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 _0x32d4=['unknown','stateTime','status','exports','name','accountcode','state'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x32d4,0x82));var _0x432d=function(_0x556614,_0x267680){_0x556614=_0x556614-0x0;var _0x4b6b0f=_0x32d4[_0x556614];return _0x4b6b0f;};'use strict';function Telephone(_0x42d665){this['id']=_0x42d665['id']||0x0;this[_0x432d('0x0')]=_0x42d665['name']||'';this[_0x432d('0x1')]=_0x42d665[_0x432d('0x1')]||'';this[_0x432d('0x2')]=_0x432d('0x3');this[_0x432d('0x4')]=0x0;this[_0x432d('0x5')]=_0x432d('0x3');this['address']='';}module[_0x432d('0x6')]=Telephone; \ No newline at end of file +var _0x09a8=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x09a8,0x13d));var _0x809a=function(_0x58cf39,_0x2d4608){_0x58cf39=_0x58cf39-0x0;var _0x4c4f41=_0x09a8[_0x58cf39];return _0x4c4f41;};'use strict';function Telephone(_0x7acd4b){this['id']=_0x7acd4b['id']||0x0;this['name']=_0x7acd4b[_0x809a('0x0')]||'';this[_0x809a('0x1')]=_0x7acd4b[_0x809a('0x1')]||'';this[_0x809a('0x2')]=_0x809a('0x3');this[_0x809a('0x4')]=0x0;this[_0x809a('0x5')]='unknown';this[_0x809a('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3204015..f11052e 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0xdc19aa,_0x55fb0b){var _0x5aab71=function(_0x55a5cc){while(--_0x55a5cc){_0xdc19aa['push'](_0xdc19aa['shift']());}};_0x5aab71(++_0x55fb0b);}(_0xb10b,0x12a));var _0xbb10=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xb10b[_0xd050c6];return _0x7278a;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x4993f9,_0x27bbda){var _0x24280e=function(_0x3665b5){while(--_0x3665b5){_0x4993f9['push'](_0x4993f9['shift']());}};_0x24280e(++_0x27bbda);}(_0xb10b,0x12a));var _0xbb10=function(_0x52af0b,_0x580c97){_0x52af0b=_0x52af0b-0x0;var _0x40ed35=_0xb10b[_0x52af0b];return _0x40ed35;};'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 74b5653..970881d 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x5ae8bb,_0x3f9abe){var _0x15b9d5=function(_0x448024){while(--_0x448024){_0x5ae8bb['push'](_0x5ae8bb['shift']());}};_0x15b9d5(++_0x3f9abe);}(_0xda3f,0xec));var _0xfda3=function(_0x2e91e6,_0x335342){_0x2e91e6=_0x2e91e6-0x0;var _0x1ef81c=_0xda3f[_0x2e91e6];return _0x1ef81c;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0xb5dc97,_0x44abd3){var _0x3aa6a4=function(_0x32224e){while(--_0x32224e){_0xb5dc97['push'](_0xb5dc97['shift']());}};_0x3aa6a4(++_0x44abd3);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x17933f,_0xc9b83){_0x17933f=_0x17933f-0x0;var _0x55b13f=_0x9ffd[_0x17933f];return _0x55b13f;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 0fe8f10..97d1e0a 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 _0x8c50=['name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domainport','refresh','stateRegistry','defaultuser','active'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c50,0xc2));var _0x08c5=function(_0x2a1eb3,_0x517cc0){_0x2a1eb3=_0x2a1eb3-0x0;var _0x3c3478=_0x8c50[_0x2a1eb3];return _0x3c3478;};'use strict';function Trunk(_0x45f796){this['id']=_0x45f796['id']||0x0;this[_0x08c5('0x0')]=_0x45f796['active']||![];this[_0x08c5('0x1')]=_0x45f796['name']||'';this[_0x08c5('0x2')]=_0x08c5('0x3');this[_0x08c5('0x4')]=0x0;this[_0x08c5('0x5')]='unknown';this[_0x08c5('0x6')]=_0x45f796[_0x08c5('0x6')]&&_0x45f796[_0x08c5('0x6')][_0x08c5('0x7')](':')?_0x45f796[_0x08c5('0x6')][_0x08c5('0x8')](':')[0x0]:'';this[_0x08c5('0x9')]='';this[_0x08c5('0xa')]='';this['domain']='';this[_0x08c5('0xb')]='';this[_0x08c5('0xc')]='';this[_0x08c5('0xd')]=_0x08c5('0x3');this['registrationtime']='';this['address']='';this[_0x08c5('0xe')]=_0x45f796[_0x08c5('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xb1b2=['stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','stateTime','unknown','registry','indexOf','port','domain','domainport','refresh'];(function(_0x48d05a,_0x30a709){var _0x572bd5=function(_0x1b23c0){while(--_0x1b23c0){_0x48d05a['push'](_0x48d05a['shift']());}};_0x572bd5(++_0x30a709);}(_0xb1b2,0x155));var _0x2b1b=function(_0x134778,_0x584bc0){_0x134778=_0x134778-0x0;var _0x3f396=_0xb1b2[_0x134778];return _0x3f396;};'use strict';function Trunk(_0x5179ae){this['id']=_0x5179ae['id']||0x0;this[_0x2b1b('0x0')]=_0x5179ae[_0x2b1b('0x0')]||![];this[_0x2b1b('0x1')]=_0x5179ae[_0x2b1b('0x1')]||'';this[_0x2b1b('0x2')]='unknown';this[_0x2b1b('0x3')]=0x0;this['status']=_0x2b1b('0x4');this[_0x2b1b('0x5')]=_0x5179ae[_0x2b1b('0x5')]&&_0x5179ae['registry'][_0x2b1b('0x6')](':')?_0x5179ae['registry']['split'](':')[0x0]:'';this['host']='';this[_0x2b1b('0x7')]='';this[_0x2b1b('0x8')]='';this[_0x2b1b('0x9')]='';this[_0x2b1b('0xa')]='';this[_0x2b1b('0xb')]='unknown';this[_0x2b1b('0xc')]='';this[_0x2b1b('0xd')]='';this[_0x2b1b('0xe')]=_0x5179ae[_0x2b1b('0xe')]||'';}module[_0x2b1b('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9e75222..5c066a2 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 _0x7099=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x1e84ea,_0x344e42){var _0x2c7576=function(_0x15425b){while(--_0x15425b){_0x1e84ea['push'](_0x1e84ea['shift']());}};_0x2c7576(++_0x344e42);}(_0x7099,0x1a1));var _0x9709=function(_0x35c172,_0x519b4a){_0x35c172=_0x35c172-0x0;var _0x29297d=_0x7099[_0x35c172];return _0x29297d;};'use strict';function voiceExtension(_0x5a277a){this['id']=_0x5a277a['id']||0x0;this[_0x9709('0x0')]=_0x5a277a[_0x9709('0x0')]||'';this[_0x9709('0x1')]=_0x5a277a[_0x9709('0x1')]||_0x9709('0x2');this[_0x9709('0x3')]=_0x5a277a[_0x9709('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x43a3=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x538491,_0x43bae2){var _0x261ffa=function(_0x4307ea){while(--_0x4307ea){_0x538491['push'](_0x538491['shift']());}};_0x261ffa(++_0x43bae2);}(_0x43a3,0xd8));var _0x343a=function(_0x1b44da,_0x9bb6c8){_0x1b44da=_0x1b44da-0x0;var _0x30c423=_0x43a3[_0x1b44da];return _0x30c423;};'use strict';function voiceExtension(_0xbfe2d2){this['id']=_0xbfe2d2['id']||0x0;this[_0x343a('0x0')]=_0xbfe2d2['exten']||'';this[_0x343a('0x1')]=_0xbfe2d2[_0x343a('0x1')]||'none';this[_0x343a('0x2')]=_0xbfe2d2[_0x343a('0x2')]||![];}module[_0x343a('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ef3474c..204bfd4 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 _0x9de1=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav49','gsm','leastrecent','linear','random','ringall','rrmemory','rrordered','monitor_format','type','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','busy','inUse','invalid','notInUse','paused','talking','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout'];(function(_0x524dfa,_0x289537){var _0x1f6e37=function(_0x41ff9a){while(--_0x41ff9a){_0x524dfa['push'](_0x524dfa['shift']());}};_0x1f6e37(++_0x289537);}(_0x9de1,0xc4));var _0x19de=function(_0x283384,_0x1f5799){_0x283384=_0x283384-0x0;var _0x5193e7=_0x9de1[_0x283384];return _0x5193e7;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x19de('0x0'),'gsm':_0x19de('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x19de('0x2'),'linear':_0x19de('0x3'),'random':_0x19de('0x4'),'ringall':_0x19de('0x5'),'rr':'roundrobin','rrmemory':_0x19de('0x6'),'rrordered':_0x19de('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x4b6ab4){this['id']=_0x4b6ab4['id']||0x0;this['name']=_0x4b6ab4['name']||'';this[_0x19de('0x8')]=_0x4b6ab4['monitor_format']||'';this['type']=_0x4b6ab4[_0x19de('0x9')]||'inbound';this[_0x19de('0xa')]=0x0;this[_0x19de('0xb')]=0x0;this[_0x19de('0xc')]=0x0;this['sumDuration']=0x0;this[_0x19de('0xd')]=0x0;this[_0x19de('0xe')]=0x0;this[_0x19de('0xf')]=0x0;this[_0x19de('0x10')]=0x0;this['available']=0x0;this[_0x19de('0x11')]=0x0;this[_0x19de('0x12')]=0x0;this[_0x19de('0x13')]=0x0;this['loggedIn']=0x0;this[_0x19de('0x14')]=0x0;this['onHold']=0x0;this[_0x19de('0x15')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0x19de('0x16')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this['acw']=_0x4b6ab4[_0x19de('0x17')]||![];this[_0x19de('0x18')]=_0x4b6ab4[_0x19de('0x18')]||0xa;this[_0x19de('0x19')]=_0x4b6ab4[_0x19de('0x19')]||'no';this[_0x19de('0x1a')]=!![];this['message']='';this[_0x19de('0x1b')]='';this[_0x19de('0x1c')]=0x0;this[_0x19de('0x1d')]=0x0;this['dialTimezone']=_0x4b6ab4[_0x19de('0x1e')]||null;this['dialGlobalInterval']=_0x4b6ab4[_0x19de('0x1f')]?_0x4b6ab4[_0x19de('0x1f')]:null;this['dialActive']=_0x4b6ab4[_0x19de('0x20')];this['dialMethod']=_0x4b6ab4['dialMethod']||_0x19de('0x21');this[_0x19de('0x22')]=_0x4b6ab4[_0x19de('0x22')]||0x0;this[_0x19de('0x23')]=_0x4b6ab4['dialLimitQueue']||0x0;this[_0x19de('0x24')]=_0x4b6ab4[_0x19de('0x24')]||0x1;this['dialPredictiveOptimization']=_0x4b6ab4[_0x19de('0x25')]||_0x19de('0x26');this[_0x19de('0x27')]=_0x4b6ab4['dialPredictiveOptimizationPercentage']||0.03;this[_0x19de('0x28')]=_0x4b6ab4[_0x19de('0x28')]||0x258;this[_0x19de('0x29')]=_0x4b6ab4[_0x19de('0x29')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x4b6ab4['dialOriginateCallerIdNumber']||_0x19de('0x2a');this[_0x19de('0x2b')]=_0x4b6ab4[_0x19de('0x2b')]||0x1e;this[_0x19de('0x2c')]=_0x4b6ab4[_0x19de('0x2c')]||'tTxX';this[_0x19de('0x2d')]=_0x4b6ab4[_0x19de('0x2d')]||0x3;this[_0x19de('0x2e')]=_0x4b6ab4[_0x19de('0x2e')]||undefined;this[_0x19de('0x2f')]=_0x4b6ab4[_0x19de('0x2f')]||0x3;this[_0x19de('0x30')]=_0x4b6ab4[_0x19de('0x30')]||0x96;this[_0x19de('0x31')]=_0x4b6ab4['dialBusyMaxRetry']||0x3;this[_0x19de('0x32')]=_0x4b6ab4[_0x19de('0x32')]||0x96;this[_0x19de('0x33')]=_0x4b6ab4['dialNoAnswerMaxRetry']||0x3;this[_0x19de('0x34')]=_0x4b6ab4[_0x19de('0x34')]||0x96;this[_0x19de('0x35')]=_0x4b6ab4['dialNoSuchNumberMaxRetry']||0x3;this[_0x19de('0x36')]=_0x4b6ab4[_0x19de('0x36')]||0x96;this[_0x19de('0x37')]=_0x4b6ab4['dialDropMaxRetry']||0x3;this[_0x19de('0x38')]=_0x4b6ab4[_0x19de('0x38')]||0x96;this['dialAbandonedMaxRetry']=_0x4b6ab4[_0x19de('0x39')]||0x3;this[_0x19de('0x3a')]=_0x4b6ab4[_0x19de('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x4b6ab4[_0x19de('0x3b')]||0x3;this[_0x19de('0x3c')]=_0x4b6ab4[_0x19de('0x3c')]||0x96;this[_0x19de('0x3d')]=_0x4b6ab4[_0x19de('0x3d')]||0x3;this[_0x19de('0x3e')]=_0x4b6ab4[_0x19de('0x3e')]||0x96;this[_0x19de('0x3f')]=_0x4b6ab4[_0x19de('0x3f')]||0x3;this[_0x19de('0x40')]=_0x4b6ab4[_0x19de('0x40')]||0x4;this[_0x19de('0x41')]=_0x4b6ab4[_0x19de('0x41')]?_0x4b6ab4[_0x19de('0x41')]:undefined;this[_0x19de('0x42')]=_0x4b6ab4[_0x19de('0x42')]?_0x4b6ab4[_0x19de('0x42')]:undefined;this[_0x19de('0x43')]=_0x4b6ab4[_0x19de('0x43')]||undefined;this['Interval']=_0x4b6ab4[_0x19de('0x44')]?_0x4b6ab4[_0x19de('0x44')]:undefined;this[_0x19de('0x45')]=_0x4b6ab4[_0x19de('0x45')]||_0x19de('0x46');this[_0x19de('0x47')]=_0x4b6ab4['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x19de('0x48')]=_0x4b6ab4[_0x19de('0x48')]||undefined;this[_0x19de('0x49')]=strategy[_0x4b6ab4[_0x19de('0x49')]];this['queueStatusComplete']=!![];this[_0x19de('0x4a')]=_0x4b6ab4[_0x19de('0x4a')]||![];this[_0x19de('0x4b')]=_0x4b6ab4[_0x19de('0x4b')];this[_0x19de('0x4c')]=_0x4b6ab4[_0x19de('0x4c')];this[_0x19de('0x4d')]=_0x4b6ab4['dialAMDAfterGreetingSilence'];this[_0x19de('0x4e')]=_0x4b6ab4[_0x19de('0x4e')];this[_0x19de('0x4f')]=_0x4b6ab4[_0x19de('0x4f')];this['dialAMDBetweenWordsSilence']=_0x4b6ab4[_0x19de('0x50')];this[_0x19de('0x51')]=_0x4b6ab4[_0x19de('0x51')];this['dialAMDSilenceThreshold']=_0x4b6ab4[_0x19de('0x52')];this[_0x19de('0x53')]=_0x4b6ab4[_0x19de('0x53')];this[_0x19de('0x54')]=0x0;this[_0x19de('0x55')]=0x0;this[_0x19de('0x56')]=_0x4b6ab4[_0x19de('0x56')];this['outboundAnswerCallsDay']=0x0;this[_0x19de('0x57')]=0x0;this[_0x19de('0x58')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x19de('0x59')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x19de('0x5a')]=0x0;this[_0x19de('0x5b')]=0x0;this[_0x19de('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x19de('0x5d')]=0x0;this[_0x19de('0x5e')]=0x0;this[_0x19de('0x5f')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x19de('0x60')]=undefined;this['startPredictive']=undefined;this[_0x19de('0x61')]=undefined;this[_0x19de('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x19de('0x63')]=0x0;this[_0x19de('0x64')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x19de('0x65')]=0x0;this[_0x19de('0x66')]=0x0;this[_0x19de('0x67')]=0x0;this[_0x19de('0x68')]=0x0;this[_0x19de('0x69')]=_0x4b6ab4[_0x19de('0x6a')]||0x14;this['predictiveIntervalMinThreshold']=_0x4b6ab4[_0x19de('0x6a')]||0xa;this[_0x19de('0x6b')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x19de('0x6c')]=0x1;this['erlangCalls']=0x0;this[_0x19de('0x6d')]=0x0;this[_0x19de('0x6e')]=0x0;this['erlangBusyFactor']=0x0;this[_0x19de('0x6f')]=_0x4b6ab4[_0x19de('0x6f')]||0x1e;this[_0x19de('0x70')]=_0x4b6ab4['dialRecallInQueue']||![];this[_0x19de('0x71')]=!!_0x4b6ab4[_0x19de('0x71')]||![];this[_0x19de('0x72')]=!!_0x4b6ab4['dialPreviewRecallmeReminder']||![];this[_0x19de('0x73')]=_0x4b6ab4[_0x19de('0x73')]||undefined;this[_0x19de('0x74')]=_0x4b6ab4[_0x19de('0x74')]||![];this[_0x19de('0x75')]=_0x4b6ab4[_0x19de('0x75')]||![];this[_0x19de('0x8')]=monitorFormat[_0x4b6ab4[_0x19de('0x8')]]?monitorFormat[_0x4b6ab4[_0x19de('0x8')]]:undefined;this['mandatoryDisposition']=_0x4b6ab4[_0x19de('0x76')]||![];this[_0x19de('0x77')]=_0x4b6ab4[_0x19de('0x77')]?_0x4b6ab4[_0x19de('0x77')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x19de('0x78')]=VoiceQueue; \ No newline at end of file +var _0x4f96=['dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','wav','wav49','gsm','fewestcalls','leastrecent','linear','ringall','rrordered','name','monitor_format','type','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','loggedIn','notInUse','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x2e5a03,_0x4efb35){var _0x1388e2=function(_0x2be8ae){while(--_0x2be8ae){_0x2e5a03['push'](_0x2e5a03['shift']());}};_0x1388e2(++_0x4efb35);}(_0x4f96,0xb9));var _0x64f9=function(_0x5c671a,_0x36ab87){_0x5c671a=_0x5c671a-0x0;var _0x1bdac7=_0x4f96[_0x5c671a];return _0x1bdac7;};'use strict';var monitorFormat={'wav':_0x64f9('0x0'),'wav49':_0x64f9('0x1'),'gsm':_0x64f9('0x2')};var strategy={'fewestcalls':_0x64f9('0x3'),'leastrecent':_0x64f9('0x4'),'linear':_0x64f9('0x5'),'random':'random','ringall':_0x64f9('0x6'),'rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0x64f9('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x727113){this['id']=_0x727113['id']||0x0;this[_0x64f9('0x8')]=_0x727113[_0x64f9('0x8')]||'';this[_0x64f9('0x9')]=_0x727113[_0x64f9('0x9')]||'';this['type']=_0x727113[_0x64f9('0xa')]||'inbound';this[_0x64f9('0xb')]=0x0;this[_0x64f9('0xc')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x64f9('0xd')]=0x0;this[_0x64f9('0xe')]=0x0;this[_0x64f9('0xf')]=0x0;this[_0x64f9('0x10')]=0x0;this[_0x64f9('0x11')]=0x0;this['busy']=0x0;this[_0x64f9('0x12')]=0x0;this['invalid']=0x0;this[_0x64f9('0x13')]=0x0;this[_0x64f9('0x14')]=0x0;this['onHold']=0x0;this[_0x64f9('0x15')]=0x0;this[_0x64f9('0x16')]=0x0;this[_0x64f9('0x17')]=0x0;this[_0x64f9('0x18')]=0x0;this[_0x64f9('0x19')]=0x0;this['unknown']=0x0;this[_0x64f9('0x1a')]=_0x727113['acw']||![];this['acwTimeout']=_0x727113[_0x64f9('0x1b')]||0xa;this[_0x64f9('0x1c')]=_0x727113['autopause']||'no';this[_0x64f9('0x1d')]=!![];this[_0x64f9('0x1e')]='';this['statusMessage']='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x727113[_0x64f9('0x1f')]||null;this[_0x64f9('0x20')]=_0x727113[_0x64f9('0x20')]?_0x727113[_0x64f9('0x20')]:null;this['dialActive']=_0x727113['dialActive'];this[_0x64f9('0x21')]=_0x727113['dialMethod']||_0x64f9('0x22');this[_0x64f9('0x23')]=_0x727113[_0x64f9('0x23')]||0x0;this[_0x64f9('0x24')]=_0x727113[_0x64f9('0x24')]||0x0;this[_0x64f9('0x25')]=_0x727113[_0x64f9('0x25')]||0x1;this[_0x64f9('0x26')]=_0x727113[_0x64f9('0x26')]||_0x64f9('0x27');this[_0x64f9('0x28')]=_0x727113[_0x64f9('0x28')]||0.03;this['dialPredictiveInterval']=_0x727113[_0x64f9('0x29')]||0x258;this[_0x64f9('0x2a')]=_0x727113[_0x64f9('0x2a')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x727113['dialOriginateCallerIdNumber']||'anonymous';this[_0x64f9('0x2b')]=_0x727113[_0x64f9('0x2b')]||0x1e;this[_0x64f9('0x2c')]=_0x727113[_0x64f9('0x2c')]||_0x64f9('0x2d');this[_0x64f9('0x2e')]=_0x727113['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x727113[_0x64f9('0x2f')]||undefined;this['dialCongestionMaxRetry']=_0x727113['dialCongestionMaxRetry']||0x3;this[_0x64f9('0x30')]=_0x727113['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x727113[_0x64f9('0x31')]||0x3;this[_0x64f9('0x32')]=_0x727113[_0x64f9('0x32')]||0x96;this[_0x64f9('0x33')]=_0x727113[_0x64f9('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x727113[_0x64f9('0x34')]||0x96;this[_0x64f9('0x35')]=_0x727113[_0x64f9('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x727113[_0x64f9('0x36')]||0x96;this[_0x64f9('0x37')]=_0x727113[_0x64f9('0x37')]||0x3;this['dialDropRetryFrequency']=_0x727113['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x727113[_0x64f9('0x38')]||0x3;this[_0x64f9('0x39')]=_0x727113['dialAbandonedRetryFrequency']||0x96;this[_0x64f9('0x3a')]=_0x727113[_0x64f9('0x3a')]||0x3;this[_0x64f9('0x3b')]=_0x727113[_0x64f9('0x3b')]||0x96;this[_0x64f9('0x3c')]=_0x727113[_0x64f9('0x3c')]||0x3;this[_0x64f9('0x3d')]=_0x727113[_0x64f9('0x3d')]||0x96;this[_0x64f9('0x3e')]=_0x727113[_0x64f9('0x3e')]||0x3;this['dialGlobalMaxRetry']=_0x727113[_0x64f9('0x3f')]||0x4;this[_0x64f9('0x40')]=_0x727113[_0x64f9('0x40')]?_0x727113[_0x64f9('0x40')]:undefined;this[_0x64f9('0x41')]=_0x727113['TrunkBackup']?_0x727113[_0x64f9('0x41')]:undefined;this[_0x64f9('0x42')]=_0x727113['dialPrefix']||undefined;this[_0x64f9('0x43')]=_0x727113['Interval']?_0x727113['Interval']:undefined;this[_0x64f9('0x44')]=_0x727113[_0x64f9('0x44')]||_0x64f9('0x45');this[_0x64f9('0x46')]=_0x727113[_0x64f9('0x46')]||undefined;this[_0x64f9('0x47')]=_0x727113[_0x64f9('0x47')]||undefined;this[_0x64f9('0x48')]=strategy[_0x727113['strategy']];this[_0x64f9('0x49')]=!![];this[_0x64f9('0x4a')]=_0x727113[_0x64f9('0x4a')]||![];this[_0x64f9('0x4b')]=_0x727113[_0x64f9('0x4b')];this[_0x64f9('0x4c')]=_0x727113[_0x64f9('0x4c')];this[_0x64f9('0x4d')]=_0x727113[_0x64f9('0x4d')];this[_0x64f9('0x4e')]=_0x727113['dialAMDTotalAnalysisTime'];this[_0x64f9('0x4f')]=_0x727113[_0x64f9('0x4f')];this[_0x64f9('0x50')]=_0x727113['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x727113[_0x64f9('0x51')];this[_0x64f9('0x52')]=_0x727113[_0x64f9('0x52')];this[_0x64f9('0x53')]=_0x727113['dialAMDMaximumWordLength'];this[_0x64f9('0x54')]=0x0;this[_0x64f9('0x55')]=0x0;this[_0x64f9('0x56')]=_0x727113[_0x64f9('0x56')];this[_0x64f9('0x57')]=0x0;this[_0x64f9('0x58')]=0x0;this[_0x64f9('0x59')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x64f9('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x64f9('0x5b')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x64f9('0x5c')]=0x0;this[_0x64f9('0x5d')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x64f9('0x5e')]=0x0;this['outboundReCallsDay']=0x0;this[_0x64f9('0x5f')]=0x0;this[_0x64f9('0x60')]=undefined;this[_0x64f9('0x61')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x64f9('0x62')]=0x0;this[_0x64f9('0x63')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x64f9('0x64')]=0x0;this[_0x64f9('0x65')]=0x0;this[_0x64f9('0x66')]=0x0;this[_0x64f9('0x67')]=0x0;this[_0x64f9('0x68')]=0x0;this[_0x64f9('0x69')]=_0x727113['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x727113[_0x64f9('0x6a')]||0xa;this[_0x64f9('0x6b')]=0x0;this[_0x64f9('0x6c')]=0x0;this[_0x64f9('0x6d')]=0x1;this[_0x64f9('0x6e')]=0x0;this[_0x64f9('0x6f')]=0x0;this[_0x64f9('0x70')]=0x0;this[_0x64f9('0x71')]=0x0;this['dialRecallMeTimeout']=_0x727113[_0x64f9('0x72')]||0x1e;this[_0x64f9('0x73')]=_0x727113[_0x64f9('0x73')]||![];this[_0x64f9('0x74')]=!!_0x727113[_0x64f9('0x74')]||![];this[_0x64f9('0x75')]=!!_0x727113[_0x64f9('0x75')]||![];this[_0x64f9('0x76')]=_0x727113[_0x64f9('0x76')]||undefined;this[_0x64f9('0x77')]=_0x727113[_0x64f9('0x77')]||![];this[_0x64f9('0x78')]=_0x727113[_0x64f9('0x78')]||![];this[_0x64f9('0x9')]=monitorFormat[_0x727113[_0x64f9('0x9')]]?monitorFormat[_0x727113[_0x64f9('0x9')]]:undefined;this['mandatoryDisposition']=_0x727113[_0x64f9('0x79')]||![];this[_0x64f9('0x7a')]=_0x727113[_0x64f9('0x7a')]?_0x727113[_0x64f9('0x7a')]:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index f50bd07..c23152e 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x254a=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','notInUse','loggedin','callers','length','SIP/','online','incall','status','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','available','loggedIn','loggedInDb','ringing','talking','waiting','inUse','originated','outboundAbandonedCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','paused','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x19bcaf,_0x579f2c){var _0x330200=function(_0x29f2cb){while(--_0x29f2cb){_0x19bcaf['push'](_0x19bcaf['shift']());}};_0x330200(++_0x579f2c);}(_0x254a,0x138));var _0xa254=function(_0x2bb612,_0xaedf28){_0x2bb612=_0x2bb612-0x0;var _0x4ef64c=_0x254a[_0x2bb612];return _0x4ef64c;};'use strict';var INBOUND_COUNTERS=[_0xa254('0x0'),_0xa254('0x1'),_0xa254('0x2'),'paused',_0xa254('0x3'),_0xa254('0x4'),_0xa254('0x5')];var OUTBOUND_COUNTERS=[_0xa254('0x0'),'answered',_0xa254('0x6'),'loggedIn',_0xa254('0x2'),_0xa254('0x7'),_0xa254('0x8'),'outboundAnswerCallsDay','outboundBlacklistCallsDay',_0xa254('0x9'),_0xa254('0xa'),'outboundNoAnswerCallsDay',_0xa254('0xb'),'outboundReCallsDay',_0xa254('0xc'),_0xa254('0xd'),'paused','pTalking',_0xa254('0x4'),_0xa254('0xe'),_0xa254('0xf'),_0xa254('0x10'),_0xa254('0x5')];function VoiceQueueSummary(_0x533881){this['id']=_0x533881['id'];this[_0xa254('0x11')]=_0x533881['name'];this['strategy']=_0x533881[_0xa254('0x12')];this[_0xa254('0x13')]=_0x533881['abandoned']||0x0;this[_0xa254('0x14')]=_0x533881[_0xa254('0x14')]||0x0;this[_0xa254('0x0')]=_0x533881[_0xa254('0x0')]||0x0;this[_0xa254('0x15')]=_0x533881['busy']||0x0;this[_0xa254('0x6')]=_0x533881[_0xa254('0x6')]||0x0;this[_0xa254('0x16')]=_0x533881[_0xa254('0x16')]||0x0;this[_0xa254('0x1')]=_0x533881[_0xa254('0x1')]||0x0;this[_0xa254('0x2')]=_0x533881[_0xa254('0x2')]||0x0;this[_0xa254('0x17')]=_0x533881['onHold']||0x0;this['notInUse']=_0x533881['notInUse']||0x0;this[_0xa254('0x18')]=_0x533881[_0xa254('0x18')]||0x0;this[_0xa254('0x3')]=_0x533881[_0xa254('0x3')]||0x0;this[_0xa254('0x19')]=_0x533881[_0xa254('0x19')];this[_0xa254('0xe')]=_0x533881['sumBillable'];this[_0xa254('0xf')]=_0x533881['sumDuration'];this[_0xa254('0x1a')]=_0x533881[_0xa254('0x1a')]||0x0;this['talking']=_0x533881[_0xa254('0x4')]||0x0;this[_0xa254('0x10')]=_0x533881['total']||0x0;this['type']=_0x533881[_0xa254('0x1b')];this[_0xa254('0x1c')]=_0x533881[_0xa254('0x1c')]||0x0;this['unknown']=_0x533881[_0xa254('0x1d')]||0x0;this[_0xa254('0x1e')]=_0x533881[_0xa254('0x1e')]||0x0;this['waiting']=_0x533881['waiting']||0x0;if(_0x533881[_0xa254('0x1b')]===_0xa254('0x1f')){this[_0xa254('0x20')]=_0x533881[_0xa254('0x20')]||0x0;this['dialActive']=_0x533881[_0xa254('0x21')];this[_0xa254('0x22')]=_0x533881[_0xa254('0x22')];this[_0xa254('0x23')]=_0x533881[_0xa254('0x23')];this[_0xa254('0x24')]=_0x533881[_0xa254('0x24')];this[_0xa254('0x25')]=_0x533881[_0xa254('0x25')];this['dialPrefix']=_0x533881[_0xa254('0x26')];this[_0xa254('0x27')]=_0x533881[_0xa254('0x27')];this[_0xa254('0x28')]=_0x533881[_0xa254('0x28')];this['outboundAnswerCallsDay']=_0x533881[_0xa254('0x29')];this[_0xa254('0x2a')]=_0x533881[_0xa254('0x2a')];this[_0xa254('0x9')]=_0x533881['outboundBusyCallsDay'];this[_0xa254('0xa')]=_0x533881[_0xa254('0xa')];this[_0xa254('0x2b')]=_0x533881[_0xa254('0x2b')];this[_0xa254('0x2c')]=_0x533881[_0xa254('0x2c')];this[_0xa254('0x2d')]=_0x533881[_0xa254('0x2d')];this['outboundNoAnswerCallsDay']=_0x533881[_0xa254('0x2e')];this[_0xa254('0xb')]=_0x533881[_0xa254('0xb')];this[_0xa254('0x2f')]=_0x533881['outboundOriginateFailureCallsDay'];this[_0xa254('0x30')]=_0x533881[_0xa254('0x30')];this[_0xa254('0xc')]=_0x533881['outboundRejectCallsDay'];this[_0xa254('0xd')]=_0x533881[_0xa254('0xd')];this[_0xa254('0x31')]=_0x533881['predictiveIntervalAnsweredCalls'];this[_0xa254('0x32')]=_0x533881[_0xa254('0x32')];this[_0xa254('0x33')]=_0x533881[_0xa254('0x33')];this[_0xa254('0x34')]=_0x533881[_0xa254('0x34')];this[_0xa254('0x35')]=_0x533881[_0xa254('0x35')];this[_0xa254('0x36')]=_0x533881['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x533881[_0xa254('0x37')];this[_0xa254('0x38')]=_0x533881['predictiveIntervalHitRate'];this[_0xa254('0x39')]=_0x533881['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x533881[_0xa254('0x3a')];this[_0xa254('0x3b')]=_0x533881[_0xa254('0x3b')];this[_0xa254('0x3c')]=_0x533881['predictiveIntervalTotalCalls'];this[_0xa254('0x7')]=_0x533881[_0xa254('0x7')];this[_0xa254('0x3d')]=_0x533881[_0xa254('0x3d')];this[_0xa254('0x3e')]=_0x533881[_0xa254('0x3e')];this[_0xa254('0x3f')]=_0x533881[_0xa254('0x3f')];this[_0xa254('0x40')]=_0x533881[_0xa254('0x40')];this[_0xa254('0x41')]=_0x533881[_0xa254('0x41')];this[_0xa254('0x42')]=_0x533881['startProgressive'];this['message']=_0x533881[_0xa254('0x43')];this[_0xa254('0x44')]=_0x533881['statusMessage'];}if(_0x533881['Trunk']){this[_0xa254('0x45')]={'id':_0x533881[_0xa254('0x45')]['id'],'name':_0x533881[_0xa254('0x45')][_0xa254('0x11')],'active':_0x533881[_0xa254('0x45')][_0xa254('0x46')],'callerid':_0x533881[_0xa254('0x45')]['callerid']};}}VoiceQueueSummary[_0xa254('0x47')][_0xa254('0x48')]=function(_0x34994d,_0xf1ee69,_0x226209,_0x22414a){this['loggedInDb']=0x0;this[_0xa254('0x4')]=0x0;this[_0xa254('0x18')]=0x0;this[_0xa254('0x1d')]=0x0;this[_0xa254('0x49')]=0x0;this[_0xa254('0x6')]=0x0;this[_0xa254('0x15')]=0x0;this[_0xa254('0x16')]=0x0;this[_0xa254('0x1c')]=0x0;this[_0xa254('0x3')]=0x0;this[_0xa254('0x19')]=0x0;this[_0xa254('0x17')]=0x0;if(_0x226209){if(_0x226209['available']){this['available']=Number(_0x226209[_0xa254('0x0')]);}if(_0x226209[_0xa254('0x4a')]){this[_0xa254('0x1')]=Number(_0x226209['loggedin']);}if(_0x226209[_0xa254('0x4b')]){this['waiting']=Number(_0x226209[_0xa254('0x4b')]);}}for(var _0x1ef195=0x0;_0x1ef195<_0x34994d[_0xa254('0x4c')];_0x1ef195++){var _0x49837e=_0xf1ee69[_0xa254('0x4d')+_0x34994d[_0x1ef195]['name']];if(_0x49837e&&_0x49837e[_0xa254('0x4e')]){this[_0xa254('0x2')]+=0x1;}if(_0x34994d[_0x1ef195][_0xa254('0x4f')]==='1'){this[_0xa254('0x4')]+=0x1;}if(_0x34994d[_0x1ef195][_0xa254('0x18')]==='1'&&!['2','7','8']['includes'](_0x34994d[_0x1ef195][_0xa254('0x50')])){this['paused']+=0x1;}switch(_0x34994d[_0x1ef195][_0xa254('0x50')]){case'0':this[_0xa254('0x1d')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xa254('0x6')]+=0x1;break;case'3':this[_0xa254('0x15')]+=0x1;break;case'4':this[_0xa254('0x16')]+=0x1;break;case'5':this[_0xa254('0x1c')]+=0x1;break;case'6':this[_0xa254('0x3')]+=0x1;break;case'7':this[_0xa254('0x19')]+=0x1;break;case'8':this[_0xa254('0x17')]+=0x1;break;}}if(this[_0xa254('0x22')]==='booked'){var _0x4ed4ec=Object['keys'](_0x22414a);for(var _0xee48bc=0x0;_0xee48bc<_0x4ed4ec['length'];_0xee48bc++){var _0x3591c2=_0x4ed4ec[_0xee48bc];var _0x857a54=_0x22414a[_0x3591c2];if(_0x857a54['queue']===this[_0xa254('0x11')]&&_0x857a54['type']===_0xa254('0x51')&&_0x857a54[_0xa254('0x52')]===_0xa254('0x53')){this[_0xa254('0x4')]+=0x1;}}if(this[_0xa254('0x4')]>this[_0xa254('0x6')]){this[_0xa254('0x4')]=this[_0xa254('0x6')];}this[_0xa254('0x20')]=0x0;}return this;};VoiceQueueSummary[_0xa254('0x47')][_0xa254('0x54')]=function(_0x4e5920){var _0x1d58a5=![];if(_0x4e5920){_0x1d58a5=INBOUND_COUNTERS[_0xa254('0x55')](function(_0x4056e6){return this[_0x4056e6]!==_0x4e5920[_0x4056e6];},this);}return _0x1d58a5;};VoiceQueueSummary[_0xa254('0x47')][_0xa254('0x56')]=function(_0x26deb3){var _0x5765c1=![];var _0x205c16=![];var _0x578233=![];if(_0x26deb3){_0x5765c1=this['dialMethod']!==_0x26deb3[_0xa254('0x22')]||this[_0xa254('0x21')]!==_0x26deb3[_0xa254('0x21')]||this['message']!==_0x26deb3[_0xa254('0x43')]||this['statusMessage']!==_0x26deb3[_0xa254('0x44')];_0x205c16=OUTBOUND_COUNTERS[_0xa254('0x55')](function(_0x3a0bdb){return this[_0x3a0bdb]!==_0x26deb3[_0x3a0bdb];},this);if(this[_0xa254('0x45')]&&_0x26deb3[_0xa254('0x45')]){_0x578233=this['Trunk'][_0xa254('0x11')]!==_0x26deb3[_0xa254('0x45')][_0xa254('0x11')]||this[_0xa254('0x45')][_0xa254('0x46')]!==_0x26deb3[_0xa254('0x45')][_0xa254('0x46')];}}return _0x5765c1||_0x205c16||_0x578233;};VoiceQueueSummary[_0xa254('0x47')]['updateReportFromOutboundQueue']=function(_0x9df09){this[_0xa254('0x14')]=_0x9df09['answered'];this[_0xa254('0x43')]=_0x9df09[_0xa254('0x43')];this[_0xa254('0x44')]=_0x9df09['statusMessage'];this['originated']=_0x9df09[_0xa254('0x7')];this[_0xa254('0x8')]=_0x9df09[_0xa254('0x8')];this[_0xa254('0x29')]=_0x9df09['outboundAnswerCallsDay'];this[_0xa254('0x2a')]=_0x9df09[_0xa254('0x2a')];this[_0xa254('0x9')]=_0x9df09[_0xa254('0x9')];this['outboundCongestionCallsDay']=_0x9df09[_0xa254('0xa')];this[_0xa254('0x2e')]=_0x9df09[_0xa254('0x2e')];this['outboundNoSuchCallsDay']=_0x9df09[_0xa254('0xb')];this[_0xa254('0x30')]=_0x9df09[_0xa254('0x30')];this['outboundRejectCallsDay']=_0x9df09[_0xa254('0xc')];this[_0xa254('0xd')]=_0x9df09[_0xa254('0xd')];this[_0xa254('0xe')]=_0x9df09[_0xa254('0xe')];this['sumDuration']=_0x9df09['sumDuration'];this[_0xa254('0x10')]=_0x9df09[_0xa254('0x10')];if(this[_0xa254('0x22')]==='preview'){this[_0xa254('0x20')]=_0x9df09[_0xa254('0x20')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x9efe=['startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','loggedin','callers','length','SIP/','includes','status','booked','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','preview','exports','loggedIn','loggedInDb','paused','ringing','talking','available','answered','inUse','originated','outboundAbandonedCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','pTalking','sumBillable','total','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0x395667,_0x45593a){var _0x5cdb8f=function(_0x2be0fd){while(--_0x2be0fd){_0x395667['push'](_0x395667['shift']());}};_0x5cdb8f(++_0x45593a);}(_0x9efe,0xca));var _0xe9ef=function(_0x47a768,_0x3357cc){_0x47a768=_0x47a768-0x0;var _0x5d756d=_0x9efe[_0x47a768];return _0x5d756d;};'use strict';var INBOUND_COUNTERS=['available',_0xe9ef('0x0'),_0xe9ef('0x1'),_0xe9ef('0x2'),_0xe9ef('0x3'),_0xe9ef('0x4'),'waiting'];var OUTBOUND_COUNTERS=[_0xe9ef('0x5'),_0xe9ef('0x6'),_0xe9ef('0x7'),_0xe9ef('0x0'),_0xe9ef('0x1'),_0xe9ef('0x8'),_0xe9ef('0x9'),'outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay',_0xe9ef('0xa'),_0xe9ef('0xb'),_0xe9ef('0xc'),'outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused',_0xe9ef('0xd'),_0xe9ef('0x4'),_0xe9ef('0xe'),'sumDuration',_0xe9ef('0xf'),_0xe9ef('0x10')];function VoiceQueueSummary(_0x187a6e){this['id']=_0x187a6e['id'];this[_0xe9ef('0x11')]=_0x187a6e[_0xe9ef('0x11')];this[_0xe9ef('0x12')]=_0x187a6e['strategy'];this[_0xe9ef('0x13')]=_0x187a6e[_0xe9ef('0x13')]||0x0;this[_0xe9ef('0x6')]=_0x187a6e[_0xe9ef('0x6')]||0x0;this[_0xe9ef('0x5')]=_0x187a6e['available']||0x0;this[_0xe9ef('0x14')]=_0x187a6e[_0xe9ef('0x14')]||0x0;this[_0xe9ef('0x7')]=_0x187a6e[_0xe9ef('0x7')]||0x0;this[_0xe9ef('0x15')]=_0x187a6e['invalid']||0x0;this['loggedIn']=_0x187a6e[_0xe9ef('0x0')]||0x0;this['loggedInDb']=_0x187a6e[_0xe9ef('0x1')]||0x0;this[_0xe9ef('0x16')]=_0x187a6e[_0xe9ef('0x16')]||0x0;this['notInUse']=_0x187a6e[_0xe9ef('0x17')]||0x0;this[_0xe9ef('0x2')]=_0x187a6e[_0xe9ef('0x2')]||0x0;this[_0xe9ef('0x3')]=_0x187a6e['ringing']||0x0;this[_0xe9ef('0x18')]=_0x187a6e['ringInUse'];this['sumBillable']=_0x187a6e[_0xe9ef('0xe')];this[_0xe9ef('0x19')]=_0x187a6e['sumDuration'];this[_0xe9ef('0x1a')]=_0x187a6e[_0xe9ef('0x1a')]||0x0;this[_0xe9ef('0x4')]=_0x187a6e['talking']||0x0;this[_0xe9ef('0xf')]=_0x187a6e[_0xe9ef('0xf')]||0x0;this[_0xe9ef('0x1b')]=_0x187a6e[_0xe9ef('0x1b')];this[_0xe9ef('0x1c')]=_0x187a6e['unavailable']||0x0;this[_0xe9ef('0x1d')]=_0x187a6e[_0xe9ef('0x1d')]||0x0;this[_0xe9ef('0x1e')]=_0x187a6e[_0xe9ef('0x1e')]||0x0;this[_0xe9ef('0x10')]=_0x187a6e[_0xe9ef('0x10')]||0x0;if(_0x187a6e[_0xe9ef('0x1b')]==='outbound'){this[_0xe9ef('0xd')]=_0x187a6e['pTalking']||0x0;this['dialActive']=_0x187a6e[_0xe9ef('0x1f')];this[_0xe9ef('0x20')]=_0x187a6e[_0xe9ef('0x20')];this[_0xe9ef('0x21')]=_0x187a6e[_0xe9ef('0x21')];this['dialOriginateCallerIdNumber']=_0x187a6e[_0xe9ef('0x22')];this[_0xe9ef('0x23')]=_0x187a6e[_0xe9ef('0x23')];this[_0xe9ef('0x24')]=_0x187a6e[_0xe9ef('0x24')];this[_0xe9ef('0x25')]=_0x187a6e[_0xe9ef('0x25')];this[_0xe9ef('0x26')]=_0x187a6e[_0xe9ef('0x26')];this[_0xe9ef('0x27')]=_0x187a6e[_0xe9ef('0x27')];this[_0xe9ef('0x28')]=_0x187a6e['outboundBlacklistCallsDay'];this[_0xe9ef('0x29')]=_0x187a6e[_0xe9ef('0x29')];this[_0xe9ef('0xa')]=_0x187a6e[_0xe9ef('0xa')];this[_0xe9ef('0x2a')]=_0x187a6e[_0xe9ef('0x2a')];this[_0xe9ef('0x2b')]=_0x187a6e[_0xe9ef('0x2b')];this[_0xe9ef('0x2c')]=_0x187a6e[_0xe9ef('0x2c')];this[_0xe9ef('0xb')]=_0x187a6e['outboundNoAnswerCallsDay'];this[_0xe9ef('0xc')]=_0x187a6e['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x187a6e[_0xe9ef('0x2d')];this[_0xe9ef('0x2e')]=_0x187a6e[_0xe9ef('0x2e')];this[_0xe9ef('0x2f')]=_0x187a6e[_0xe9ef('0x2f')];this[_0xe9ef('0x30')]=_0x187a6e[_0xe9ef('0x30')];this[_0xe9ef('0x31')]=_0x187a6e[_0xe9ef('0x31')];this[_0xe9ef('0x32')]=_0x187a6e[_0xe9ef('0x32')];this[_0xe9ef('0x33')]=_0x187a6e['predictiveIntervalAvgTalktime'];this[_0xe9ef('0x34')]=_0x187a6e[_0xe9ef('0x34')];this[_0xe9ef('0x35')]=_0x187a6e[_0xe9ef('0x35')];this['predictiveIntervalErlangCalls']=_0x187a6e[_0xe9ef('0x36')];this[_0xe9ef('0x37')]=_0x187a6e[_0xe9ef('0x37')];this[_0xe9ef('0x38')]=_0x187a6e[_0xe9ef('0x38')];this[_0xe9ef('0x39')]=_0x187a6e[_0xe9ef('0x39')];this[_0xe9ef('0x3a')]=_0x187a6e[_0xe9ef('0x3a')];this[_0xe9ef('0x3b')]=_0x187a6e[_0xe9ef('0x3b')];this[_0xe9ef('0x3c')]=_0x187a6e[_0xe9ef('0x3c')];this[_0xe9ef('0x8')]=_0x187a6e[_0xe9ef('0x8')];this[_0xe9ef('0x3d')]=_0x187a6e[_0xe9ef('0x3d')];this[_0xe9ef('0x3e')]=_0x187a6e[_0xe9ef('0x3e')];this[_0xe9ef('0x3f')]=_0x187a6e[_0xe9ef('0x3f')];this[_0xe9ef('0x40')]=_0x187a6e[_0xe9ef('0x40')];this[_0xe9ef('0x41')]=_0x187a6e[_0xe9ef('0x41')];this['startProgressive']=_0x187a6e[_0xe9ef('0x42')];this[_0xe9ef('0x43')]=_0x187a6e['message'];this[_0xe9ef('0x44')]=_0x187a6e['statusMessage'];}if(_0x187a6e[_0xe9ef('0x45')]){this[_0xe9ef('0x45')]={'id':_0x187a6e[_0xe9ef('0x45')]['id'],'name':_0x187a6e[_0xe9ef('0x45')]['name'],'active':_0x187a6e[_0xe9ef('0x45')][_0xe9ef('0x46')],'callerid':_0x187a6e[_0xe9ef('0x45')][_0xe9ef('0x47')]};}}VoiceQueueSummary[_0xe9ef('0x48')]['createReport']=function(_0x484973,_0x413b1b,_0x6c7258,_0x4021f8){this[_0xe9ef('0x1')]=0x0;this[_0xe9ef('0x4')]=0x0;this[_0xe9ef('0x2')]=0x0;this[_0xe9ef('0x1d')]=0x0;this[_0xe9ef('0x17')]=0x0;this['inUse']=0x0;this[_0xe9ef('0x14')]=0x0;this[_0xe9ef('0x15')]=0x0;this['unavailable']=0x0;this[_0xe9ef('0x3')]=0x0;this[_0xe9ef('0x18')]=0x0;this[_0xe9ef('0x16')]=0x0;if(_0x6c7258){if(_0x6c7258[_0xe9ef('0x5')]){this[_0xe9ef('0x5')]=Number(_0x6c7258[_0xe9ef('0x5')]);}if(_0x6c7258[_0xe9ef('0x49')]){this[_0xe9ef('0x0')]=Number(_0x6c7258[_0xe9ef('0x49')]);}if(_0x6c7258[_0xe9ef('0x4a')]){this['waiting']=Number(_0x6c7258['callers']);}}for(var _0x5b0901=0x0;_0x5b0901<_0x484973[_0xe9ef('0x4b')];_0x5b0901++){var _0x666c8a=_0x413b1b[_0xe9ef('0x4c')+_0x484973[_0x5b0901]['name']];if(_0x666c8a&&_0x666c8a['online']){this[_0xe9ef('0x1')]+=0x1;}if(_0x484973[_0x5b0901]['incall']==='1'){this[_0xe9ef('0x4')]+=0x1;}if(_0x484973[_0x5b0901]['paused']==='1'&&!['2','7','8'][_0xe9ef('0x4d')](_0x484973[_0x5b0901][_0xe9ef('0x4e')])){this[_0xe9ef('0x2')]+=0x1;}switch(_0x484973[_0x5b0901][_0xe9ef('0x4e')]){case'0':this[_0xe9ef('0x1d')]+=0x1;break;case'1':this[_0xe9ef('0x17')]+=0x1;break;case'2':this[_0xe9ef('0x7')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xe9ef('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xe9ef('0x16')]+=0x1;break;}}if(this['dialMethod']===_0xe9ef('0x4f')){var _0x17735b=Object[_0xe9ef('0x50')](_0x4021f8);for(var _0x29ed7d=0x0;_0x29ed7d<_0x17735b[_0xe9ef('0x4b')];_0x29ed7d++){var _0xe6bd1d=_0x17735b[_0x29ed7d];var _0x21dc32=_0x4021f8[_0xe6bd1d];if(_0x21dc32['queue']===this['name']&&_0x21dc32[_0xe9ef('0x1b')]===_0xe9ef('0x51')&&_0x21dc32[_0xe9ef('0x52')]===_0xe9ef('0x53')){this[_0xe9ef('0x4')]+=0x1;}}if(this[_0xe9ef('0x4')]>this[_0xe9ef('0x7')]){this[_0xe9ef('0x4')]=this['inUse'];}this[_0xe9ef('0xd')]=0x0;}return this;};VoiceQueueSummary[_0xe9ef('0x48')][_0xe9ef('0x54')]=function(_0x22342e){var _0x11c48e=![];if(_0x22342e){_0x11c48e=INBOUND_COUNTERS[_0xe9ef('0x55')](function(_0x581dab){return this[_0x581dab]!==_0x22342e[_0x581dab];},this);}return _0x11c48e;};VoiceQueueSummary[_0xe9ef('0x48')][_0xe9ef('0x56')]=function(_0x3ae756){var _0x217eb9=![];var _0x2e5a3a=![];var _0x5a2d0c=![];if(_0x3ae756){_0x217eb9=this['dialMethod']!==_0x3ae756[_0xe9ef('0x20')]||this[_0xe9ef('0x1f')]!==_0x3ae756[_0xe9ef('0x1f')]||this[_0xe9ef('0x43')]!==_0x3ae756[_0xe9ef('0x43')]||this['statusMessage']!==_0x3ae756[_0xe9ef('0x44')];_0x2e5a3a=OUTBOUND_COUNTERS[_0xe9ef('0x55')](function(_0x36156a){return this[_0x36156a]!==_0x3ae756[_0x36156a];},this);if(this[_0xe9ef('0x45')]&&_0x3ae756[_0xe9ef('0x45')]){_0x5a2d0c=this[_0xe9ef('0x45')][_0xe9ef('0x11')]!==_0x3ae756[_0xe9ef('0x45')][_0xe9ef('0x11')]||this['Trunk'][_0xe9ef('0x46')]!==_0x3ae756['Trunk'][_0xe9ef('0x46')];}}return _0x217eb9||_0x2e5a3a||_0x5a2d0c;};VoiceQueueSummary[_0xe9ef('0x48')]['updateReportFromOutboundQueue']=function(_0x2c74b7){this['answered']=_0x2c74b7[_0xe9ef('0x6')];this[_0xe9ef('0x43')]=_0x2c74b7[_0xe9ef('0x43')];this[_0xe9ef('0x44')]=_0x2c74b7['statusMessage'];this[_0xe9ef('0x8')]=_0x2c74b7[_0xe9ef('0x8')];this['outboundAbandonedCallsDay']=_0x2c74b7[_0xe9ef('0x9')];this['outboundAnswerCallsDay']=_0x2c74b7[_0xe9ef('0x27')];this[_0xe9ef('0x28')]=_0x2c74b7[_0xe9ef('0x28')];this[_0xe9ef('0x29')]=_0x2c74b7[_0xe9ef('0x29')];this[_0xe9ef('0xa')]=_0x2c74b7[_0xe9ef('0xa')];this['outboundNoAnswerCallsDay']=_0x2c74b7[_0xe9ef('0xb')];this[_0xe9ef('0xc')]=_0x2c74b7[_0xe9ef('0xc')];this[_0xe9ef('0x2e')]=_0x2c74b7[_0xe9ef('0x2e')];this[_0xe9ef('0x2f')]=_0x2c74b7[_0xe9ef('0x2f')];this['outboundUnknownCallsDay']=_0x2c74b7[_0xe9ef('0x30')];this['sumBillable']=_0x2c74b7['sumBillable'];this['sumDuration']=_0x2c74b7[_0xe9ef('0x19')];this[_0xe9ef('0xf')]=_0x2c74b7[_0xe9ef('0xf')];if(this['dialMethod']===_0xe9ef('0x57')){this[_0xe9ef('0xd')]=_0x2c74b7['pTalking'];}};module[_0xe9ef('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d7fca97..d1b04ac 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 _0xf981=['Configurations','name','username','remoteUri','serverUrl'];(function(_0x205e3d,_0x36a4b3){var _0x35962d=function(_0x476d13){while(--_0x476d13){_0x205e3d['push'](_0x205e3d['shift']());}};_0x35962d(++_0x36a4b3);}(_0xf981,0x1af));var _0x1f98=function(_0x25eb87,_0x4eabc6){_0x25eb87=_0x25eb87-0x0;var _0x4df88e=_0xf981[_0x25eb87];return _0x4df88e;};'use strict';function VtigerAccount(_0x3d2165){this['id']=_0x3d2165['id']||0x0;this[_0x1f98('0x0')]=_0x3d2165[_0x1f98('0x0')]||'';this['username']=_0x3d2165[_0x1f98('0x1')]||'';this['accessKey']=_0x3d2165['accessKey']||'';this[_0x1f98('0x2')]=_0x3d2165[_0x1f98('0x2')]||'';this[_0x1f98('0x3')]=_0x3d2165[_0x1f98('0x3')]||'';this[_0x1f98('0x4')]=_0x3d2165[_0x1f98('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x430d=['exports','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x430d,0x18d));var _0xd430=function(_0x3c631f,_0x2629da){_0x3c631f=_0x3c631f-0x0;var _0x5e65a7=_0x430d[_0x3c631f];return _0x5e65a7;};'use strict';function VtigerAccount(_0x80e31c){this['id']=_0x80e31c['id']||0x0;this['name']=_0x80e31c['name']||'';this[_0xd430('0x0')]=_0x80e31c[_0xd430('0x0')]||'';this[_0xd430('0x1')]=_0x80e31c[_0xd430('0x1')]||'';this['remoteUri']=_0x80e31c[_0xd430('0x2')]||'';this[_0xd430('0x3')]=_0x80e31c[_0xd430('0x3')]||'';this[_0xd430('0x4')]=_0x80e31c[_0xd430('0x4')]||{};}module[_0xd430('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e1039c5..4011ad2 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 _0x4dbb=['password','token','remoteUri','type','serverUrl','Configurations','exports','name','username'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0x4dbb,0x1a5));var _0xb4db=function(_0x1f8921,_0x38bd21){_0x1f8921=_0x1f8921-0x0;var _0x2c2f34=_0x4dbb[_0x1f8921];return _0x2c2f34;};'use strict';function ZendeskAccount(_0x4d86ea){this['id']=_0x4d86ea['id']||0x0;this[_0xb4db('0x0')]=_0x4d86ea[_0xb4db('0x0')]||'';this[_0xb4db('0x1')]=_0x4d86ea[_0xb4db('0x1')]||'';this['password']=_0x4d86ea[_0xb4db('0x2')]||'';this[_0xb4db('0x3')]=_0x4d86ea['token']||'';this[_0xb4db('0x4')]=_0x4d86ea[_0xb4db('0x4')]||'';this['authType']=_0x4d86ea['authType']||'';this[_0xb4db('0x5')]=_0x4d86ea[_0xb4db('0x5')]||'integrationTab';this[_0xb4db('0x6')]=_0x4d86ea['serverUrl']||'';this[_0xb4db('0x7')]=_0x4d86ea[_0xb4db('0x7')]||{};}module[_0xb4db('0x8')]=ZendeskAccount; \ No newline at end of file +var _0xd24e=['Configurations','exports','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x8eca89,_0x26e53a){var _0x32956f=function(_0x371481){while(--_0x371481){_0x8eca89['push'](_0x8eca89['shift']());}};_0x32956f(++_0x26e53a);}(_0xd24e,0xac));var _0xed24=function(_0x312c8f,_0x502dbf){_0x312c8f=_0x312c8f-0x0;var _0x49a6ab=_0xd24e[_0x312c8f];return _0x49a6ab;};'use strict';function ZendeskAccount(_0x2867f5){this['id']=_0x2867f5['id']||0x0;this['name']=_0x2867f5['name']||'';this['username']=_0x2867f5[_0xed24('0x0')]||'';this['password']=_0x2867f5[_0xed24('0x1')]||'';this[_0xed24('0x2')]=_0x2867f5[_0xed24('0x2')]||'';this['remoteUri']=_0x2867f5[_0xed24('0x3')]||'';this['authType']=_0x2867f5[_0xed24('0x4')]||'';this[_0xed24('0x5')]=_0x2867f5[_0xed24('0x5')]||_0xed24('0x6');this['serverUrl']=_0x2867f5[_0xed24('0x7')]||'';this[_0xed24('0x8')]=_0x2867f5[_0xed24('0x8')]||{};}module[_0xed24('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 5ad994f..bdd8d30 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 _0xcaef=['clientSecret','serverUrl','code','refreshToken','Configurations','host','zone','clientId'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcaef,0x16d));var _0xfcae=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xcaef[_0x5d2803];return _0xdcad2c;};'use strict';function ZohoAccount(_0x5a3097){this['id']=_0x5a3097['id']||0x0;this['name']=_0x5a3097['name']||'';this['description']=_0x5a3097['description']||'';this[_0xfcae('0x0')]=_0x5a3097['host']||'';this[_0xfcae('0x1')]=_0x5a3097[_0xfcae('0x1')]||'';this['clientId']=_0x5a3097[_0xfcae('0x2')]||'';this[_0xfcae('0x3')]=_0x5a3097[_0xfcae('0x3')]||'';this[_0xfcae('0x4')]=_0x5a3097[_0xfcae('0x4')]||'';this[_0xfcae('0x5')]=_0x5a3097[_0xfcae('0x5')]||'';this['refreshToken']=_0x5a3097[_0xfcae('0x6')]||'';this[_0xfcae('0x7')]=_0x5a3097[_0xfcae('0x7')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x91f9=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x91f9,0xab));var _0x991f=function(_0x146fc2,_0x4beccc){_0x146fc2=_0x146fc2-0x0;var _0x3600ee=_0x91f9[_0x146fc2];return _0x3600ee;};'use strict';function ZohoAccount(_0x886706){this['id']=_0x886706['id']||0x0;this[_0x991f('0x0')]=_0x886706[_0x991f('0x0')]||'';this[_0x991f('0x1')]=_0x886706[_0x991f('0x1')]||'';this[_0x991f('0x2')]=_0x886706['host']||'';this[_0x991f('0x3')]=_0x886706['zone']||'';this[_0x991f('0x4')]=_0x886706[_0x991f('0x4')]||'';this[_0x991f('0x5')]=_0x886706[_0x991f('0x5')]||'';this[_0x991f('0x6')]=_0x886706[_0x991f('0x6')]||'';this['code']=_0x886706[_0x991f('0x7')]||'';this['refreshToken']=_0x886706[_0x991f('0x8')]||'';this['Configurations']=_0x886706[_0x991f('0x9')]||{};}module[_0x991f('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 27c5afb..3ced10f 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 _0x8aad=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','isNil','uniqueid','idContact','queue','name','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x36aba3,_0x5710fa){var _0x4d334f=function(_0x3ec9a4){while(--_0x3ec9a4){_0x36aba3['push'](_0x36aba3['shift']());}};_0x4d334f(++_0x5710fa);}(_0x8aad,0x146));var _0xd8aa=function(_0x5390d7,_0x366e15){_0x5390d7=_0x5390d7-0x0;var _0x372e62=_0x8aad[_0x5390d7];return _0x372e62;};'use strict';var util=require(_0xd8aa('0x0'));var _=require(_0xd8aa('0x1'));var moment=require('moment');function checkNameSurname(_0x11554c,_0x5bcfd1,_0x276f03){var _0xb610c0='';if(!_['isNil'](_0x5bcfd1)&&'string'===typeof _0x5bcfd1){_0xb610c0+=_0x5bcfd1;}if(!_[_0xd8aa('0x2')](_0x276f03)&&'string'===typeof _0x276f03){_0xb610c0+='\x20'+_0x276f03;}if(_0xb610c0!==''){return _0xb610c0;}return _0x11554c;}function Action(_0x53248c,_0x16b648,_0x43ddeb,_0x16ea12,_0x4a4b10){this[_0xd8aa('0x3')]=_0x43ddeb||undefined;this[_0xd8aa('0x4')]=_0x53248c['id'];this[_0xd8aa('0x5')]=_0x16b648[_0xd8aa('0x6')];this['type']=_0x16b648['type'];this[_0xd8aa('0x7')]=_0xd8aa('0x5');this[_0xd8aa('0x8')]=![];this[_0xd8aa('0x9')]=_[_0xd8aa('0x2')](_0x53248c['Agent'])?undefined:_0x53248c[_0xd8aa('0xa')][_0xd8aa('0x6')];this[_0xd8aa('0xb')]=this[_0xd8aa('0x9')]?util[_0xd8aa('0xc')](_0xd8aa('0xd'),this[_0xd8aa('0x9')]):_0x16ea12||undefined;this[_0xd8aa('0xe')]=checkNameSurname(_0x53248c[_0xd8aa('0xf')][_0xd8aa('0x10')],_0x53248c['Contact']['firstName'],_0x53248c[_0xd8aa('0xf')][_0xd8aa('0x11')]);this[_0xd8aa('0x12')]=_0x53248c['active']||![];this[_0xd8aa('0x13')]=_0x53248c[_0xd8aa('0x10')];this[_0xd8aa('0x14')]=_0x53248c[_0xd8aa('0x14')];this['countbusyretry']=_0x53248c[_0xd8aa('0x15')]||0x0;this[_0xd8aa('0x16')]=_0x53248c['countcongestionretry']||0x0;this[_0xd8aa('0x17')]=_0x53248c[_0xd8aa('0x17')]||0x0;this[_0xd8aa('0x18')]=(_0x53248c[_0xd8aa('0x15')]||0x0)+(_0x53248c[_0xd8aa('0x16')]||0x0)+(_0x53248c['countnoanswerretry']||0x0)+(_0x53248c[_0xd8aa('0x19')]||0x0)+(_0x53248c[_0xd8aa('0x1a')]||0x0)+(_0x53248c[_0xd8aa('0x1b')]||0x0)+(_0x53248c[_0xd8aa('0x1c')]||0x0)+(_0x53248c['countagentrejectretry']||0x0);this[_0xd8aa('0x19')]=_0x53248c[_0xd8aa('0x19')]||0x0;this[_0xd8aa('0x1a')]=_0x53248c[_0xd8aa('0x1a')]||0x0;this[_0xd8aa('0x1b')]=_0x53248c['countabandonedretry']||0x0;this[_0xd8aa('0x1c')]=_0x53248c[_0xd8aa('0x1c')]||0x0;this[_0xd8aa('0x1d')]=_0x53248c['countagentrejectretry']||0x0;this[_0xd8aa('0x1e')]=_0x53248c[_0xd8aa('0x1e')];this[_0xd8aa('0x1f')]=_0x53248c[_0xd8aa('0x1f')];this[_0xd8aa('0x20')]=_0x53248c[_0xd8aa('0x20')];this[_0xd8aa('0x21')]=_0x53248c[_0xd8aa('0x21')];this[_0xd8aa('0x22')]=_0x53248c[_0xd8aa('0x22')];this[_0xd8aa('0x23')]=_0x53248c[_0xd8aa('0x23')];this[_0xd8aa('0x24')]=_['isNil'](_0x53248c[_0xd8aa('0xa')])?_0x53248c[_0xd8aa('0x24')]:_0x53248c[_0xd8aa('0xa')]['id'];this[_0xd8aa('0x25')]=_0x53248c[_0xd8aa('0x25')];this[_0xd8aa('0x26')]='';this[_0xd8aa('0x27')]='';}Action[_0xd8aa('0x28')][_0xd8aa('0x29')]=function(){return util[_0xd8aa('0xc')]('\x22%s\x22\x20<%s>',this[_0xd8aa('0xe')],this[_0xd8aa('0x2a')]);};module[_0xd8aa('0x2b')]=Action; \ No newline at end of file +var _0x2542=['UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','ContactId','ListId'];(function(_0x17d079,_0x30db71){var _0x5396f0=function(_0x43994a){while(--_0x43994a){_0x17d079['push'](_0x17d079['shift']());}};_0x5396f0(++_0x30db71);}(_0x2542,0x169));var _0x2254=function(_0xc66474,_0x1155f1){_0xc66474=_0xc66474-0x0;var _0x58596d=_0x2542[_0xc66474];return _0x58596d;};'use strict';var util=require(_0x2254('0x0'));var _=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));function checkNameSurname(_0x20dfee,_0x578407,_0x105910){var _0x47b1da='';if(!_[_0x2254('0x3')](_0x578407)&&_0x2254('0x4')===typeof _0x578407){_0x47b1da+=_0x578407;}if(!_[_0x2254('0x3')](_0x105910)&&_0x2254('0x4')===typeof _0x105910){_0x47b1da+='\x20'+_0x105910;}if(_0x47b1da!==''){return _0x47b1da;}return _0x20dfee;}function Action(_0x76c902,_0x508183,_0x19ad3c,_0xe8ca50,_0x2ee7ee){this[_0x2254('0x5')]=_0x19ad3c||undefined;this[_0x2254('0x6')]=_0x76c902['id'];this[_0x2254('0x7')]=_0x508183[_0x2254('0x8')];this[_0x2254('0x9')]=_0x508183[_0x2254('0x9')];this[_0x2254('0xa')]=_0x2254('0x7');this['dialAnswer']=![];this[_0x2254('0xb')]=_[_0x2254('0x3')](_0x76c902[_0x2254('0xc')])?undefined:_0x76c902[_0x2254('0xc')]['name'];this['channelAgent']=this[_0x2254('0xb')]?util[_0x2254('0xd')](_0x2254('0xe'),this[_0x2254('0xb')]):_0xe8ca50||undefined;this[_0x2254('0xf')]=checkNameSurname(_0x76c902[_0x2254('0x10')]['phone'],_0x76c902[_0x2254('0x10')][_0x2254('0x11')],_0x76c902['Contact'][_0x2254('0x12')]);this[_0x2254('0x13')]=_0x76c902[_0x2254('0x13')]||![];this[_0x2254('0x14')]=_0x76c902[_0x2254('0x15')];this[_0x2254('0x16')]=_0x76c902['scheduledat'];this[_0x2254('0x17')]=_0x76c902['countbusyretry']||0x0;this[_0x2254('0x18')]=_0x76c902[_0x2254('0x18')]||0x0;this[_0x2254('0x19')]=_0x76c902[_0x2254('0x19')]||0x0;this[_0x2254('0x1a')]=(_0x76c902[_0x2254('0x17')]||0x0)+(_0x76c902['countcongestionretry']||0x0)+(_0x76c902['countnoanswerretry']||0x0)+(_0x76c902['countnosuchnumberretry']||0x0)+(_0x76c902[_0x2254('0x1b')]||0x0)+(_0x76c902[_0x2254('0x1c')]||0x0)+(_0x76c902[_0x2254('0x1d')]||0x0)+(_0x76c902[_0x2254('0x1e')]||0x0);this[_0x2254('0x1f')]=_0x76c902[_0x2254('0x1f')]||0x0;this['countdropretry']=_0x76c902[_0x2254('0x1b')]||0x0;this[_0x2254('0x1c')]=_0x76c902[_0x2254('0x1c')]||0x0;this['countmachineretry']=_0x76c902['countmachineretry']||0x0;this['countagentrejectretry']=_0x76c902[_0x2254('0x1e')]||0x0;this[_0x2254('0x20')]=_0x76c902[_0x2254('0x20')];this['callbackuniqueid']=_0x76c902['callbackuniqueid'];this['callbackat']=_0x76c902['callbackat'];this['recallme']=_0x76c902['recallme'];this[_0x2254('0x21')]=_0x76c902[_0x2254('0x21')];this[_0x2254('0x22')]=_0x76c902[_0x2254('0x22')];this[_0x2254('0x23')]=_[_0x2254('0x3')](_0x76c902['Agent'])?_0x76c902['UserId']:_0x76c902[_0x2254('0xc')]['id'];this['VoiceQueueId']=_0x76c902[_0x2254('0x24')];this[_0x2254('0x25')]='';this[_0x2254('0x26')]='';}Action[_0x2254('0x27')][_0x2254('0x28')]=function(){return util['format'](_0x2254('0x29'),this[_0x2254('0xf')],this[_0x2254('0x2a')]);};module[_0x2254('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 17cf58a..460dac8 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 _0x42dd=['syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','Queue','stringify','queue','dialAnswer','pick','contactId','ListId','channel','catch','No\x20such\x20channel','decrementOriginate','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','isNil','length','scheduledat','dialRecallMeTimeout','Agent','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','RecallFailedTimeout','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','mandatoryDisposition','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','pTalking:\x20','linkedid','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','dialNoAnswerMaxRetry','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','createAgentHistory','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','unlockContact','execRun','getContactPreview','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','setXMDContactVariables','assign','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','channelstate','transfer','destuniqueid','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','ioredis','../../../config/logger','preview','./rpcDb','./util/util','../dialer/utils','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','logger','\x20is\x20deactivated'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x42dd,0x107));var _0xd42d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x42dd[_0xbd08b4];return _0x314f1e;};'use strict';var util=require(_0xd42d('0x0'));var _=require(_0xd42d('0x1'));var uuid=require(_0xd42d('0x2'));var moment=require(_0xd42d('0x3'));var Redis=require(_0xd42d('0x4'));var config=require('../../../config/environment');var logger=require(_0xd42d('0x5'))(_0xd42d('0x6'));var loggerAction=require(_0xd42d('0x5'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0xd42d('0x7'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xd42d('0x8'));var utils=require(_0xd42d('0x9'));config[_0xd42d('0xa')]=_[_0xd42d('0xb')](config[_0xd42d('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xd42d('0xc'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xd42d('0xd')][_0xd42d('0xe')]=function(_0x13ae55){this[_0xd42d('0xf')]=this[_0xd42d('0xf')]?this['tail'][_0xd42d('0x10')](_0x13ae55):_0x13ae55();};function Preview(_0x1a9a16){this['sequence']=new Sequence();this[_0xd42d('0x11')]=_0x1a9a16['voiceQueues'];this[_0xd42d('0x12')]=_0x1a9a16['trunks'];this[_0xd42d('0x13')]={};this[_0xd42d('0x14')]=_0x1a9a16[_0xd42d('0x14')];this['clockClearZombieChannels']=0x0;ami['on'](_0xd42d('0x15'),this[_0xd42d('0x16')][_0xd42d('0x17')](this));ami['on'](_0xd42d('0x18'),this[_0xd42d('0x19')][_0xd42d('0x17')](this));ami['on'](_0xd42d('0x1a'),this[_0xd42d('0x1b')][_0xd42d('0x17')](this));ami['on'](_0xd42d('0x1c'),this[_0xd42d('0x1d')][_0xd42d('0x17')](this));ami['on'](_0xd42d('0x1e'),this[_0xd42d('0x1f')]['bind'](this));ami['on'](_0xd42d('0x20'),this[_0xd42d('0x21')][_0xd42d('0x17')](this));ami['on'](_0xd42d('0x22'),this[_0xd42d('0x23')][_0xd42d('0x17')](this));ami['on'](_0xd42d('0x24'),this['syncBlindTransfer'][_0xd42d('0x17')](this));this[_0xd42d('0x25')](this[_0xd42d('0x11')]);}function emit(_0x16c860,_0x43d4c2,_0x1f6a05){io['to'](_0x16c860)[_0xd42d('0x26')](_0x43d4c2,_0x1f6a05);}function emitVoiceQueueChannelRemove(_0x5c9373){logger[_0xd42d('0x27')](_0xd42d('0x28'),JSON['stringify'](_0x5c9373));emit(util[_0xd42d('0x29')](_0xd42d('0x2a'),_0x5c9373[_0xd42d('0x2b')]),_0xd42d('0x2c'),_0x5c9373);io[_0xd42d('0x26')](_0xd42d('0x2d'),_0x5c9373);}function notSendMessagesQueue(_0x3151be){if(_0x3151be[_0xd42d('0x2e')]){if(_0x3151be[_0xd42d('0x2f')]===0x0&&_0x3151be[_0xd42d('0x30')]===0x0){_0x3151be[_0xd42d('0x2e')]=![];_0x3151be[_0xd42d('0x31')]=0x0;_0x3151be['paused']=0x0;_0x3151be[_0xd42d('0x32')]=utils[_0xd42d('0x33')][_0xd42d('0x34')];ut['logger'](_0xd42d('0x35'),_0x3151be[_0xd42d('0x2b')]+_0xd42d('0x36'));}else{_0x3151be[_0xd42d('0x32')]=utils[_0xd42d('0x33')][_0xd42d('0x37')];ut[_0xd42d('0x38')](_0xd42d('0x35'),_0x3151be[_0xd42d('0x2b')]+_0xd42d('0x39'));}}}Preview[_0xd42d('0xd')]['loopCampaigns']=function(){var _0x3e06e0=this;setInterval(function(){_0x3e06e0[_0xd42d('0x3a')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x28c4df=this[_0xd42d('0x11')];this[_0xd42d('0x3b')]+=0x1;for(var _0x18d8bd in _0x28c4df){if(_0x28c4df[_0xd42d('0x3c')](_0x18d8bd)&&(_0x28c4df[_0x18d8bd]['dialMethod']===_0xd42d('0x6')||_0x28c4df[_0x18d8bd][_0xd42d('0x3d')]===_0xd42d('0x3e'))&&_0x28c4df[_0x18d8bd][_0xd42d('0x3f')]===_0xd42d('0x40')){if(this[_0xd42d('0x3b')]>0x7){this[_0xd42d('0x3b')]=0x0;this[_0xd42d('0x41')]();}}if(_0x28c4df[_0xd42d('0x3c')](_0x18d8bd)&&_0x28c4df[_0x18d8bd][_0xd42d('0x3d')]===_0xd42d('0x6')&&_0x28c4df[_0x18d8bd][_0xd42d('0x3f')]==='outbound'){if(_0x28c4df[_0x18d8bd][_0xd42d('0x42')]){this[_0xd42d('0x43')](_0x28c4df[_0x18d8bd]);if(_0x28c4df[_0x18d8bd][_0xd42d('0x44')])this[_0xd42d('0x45')](_0x28c4df[_0x18d8bd]);}else{notSendMessagesQueue(_0x28c4df[_0x18d8bd]);}}}};Preview[_0xd42d('0xd')][_0xd42d('0x46')]=function(_0x2f1c0c){var _0x413a8e=this;this[_0xd42d('0x47')][_0xd42d('0xe')](function(){if(!_['isNil'](_0x413a8e['actions'][_0x2f1c0c])){loggerAction[_0xd42d('0x27')]('[clearZombieChannels][talking]',_0x2f1c0c,_0xd42d('0x48'),_0x413a8e[_0xd42d('0x13')][_0x2f1c0c]['queue'],'originated:\x20',JSON[_0xd42d('0x49')](_0x413a8e['campaignsPreview'][_0x413a8e[_0xd42d('0x13')][_0x2f1c0c][_0xd42d('0x4a')]][_0xd42d('0x2f')]),'pTalking:\x20',JSON['stringify'](_0x413a8e[_0xd42d('0x11')][_0x413a8e[_0xd42d('0x13')][_0x2f1c0c][_0xd42d('0x4a')]][_0xd42d('0x30')]),JSON[_0xd42d('0x49')](_0x413a8e[_0xd42d('0x13')][_0x2f1c0c][_0xd42d('0x4b')]),JSON[_0xd42d('0x49')](_[_0xd42d('0x4c')](_0x413a8e['actions'][_0x2f1c0c],[_0xd42d('0x4d'),'UserId','VoiceQueueId',_0xd42d('0x4e')])));return ami['Action']({'action':'status','channel':_0x413a8e[_0xd42d('0x13')][_0x2f1c0c][_0xd42d('0x4f')]})[_0xd42d('0x50')](function(_0x411f82){if(_0x411f82[_0xd42d('0x32')]===_0xd42d('0x51')){setTimeout(function(){if(_0x413a8e[_0xd42d('0x13')][_0x2f1c0c]){utils[_0xd42d('0x52')](_0x413a8e[_0xd42d('0x11')][_0x413a8e[_0xd42d('0x13')][_0x2f1c0c][_0xd42d('0x4a')]],'[clearZombieChannel]');if(_0x413a8e[_0xd42d('0x13')][_0x2f1c0c]['dialAnswer']===!![]){ut[_0xd42d('0x53')](_0x413a8e[_0xd42d('0x11')][_0x413a8e[_0xd42d('0x13')][_0x2f1c0c]['queue']],'[clearZombieChannel]');ut[_0xd42d('0x54')](_0xd42d('0x55')+_0x2f1c0c,_0x413a8e[_0xd42d('0x13')][_0x2f1c0c]['queue']);}ut[_0xd42d('0x54')](_0xd42d('0x56')+_0x2f1c0c,_0x413a8e['actions'][_0x2f1c0c][_0xd42d('0x4a')]);delete _0x413a8e['actions'][_0x2f1c0c];}},0x2328);}});}});};Preview['prototype'][_0xd42d('0x41')]=function(){var _0x5285b5=this;loggerAction['info'](_0xd42d('0x57'),_[_0xd42d('0x58')](this[_0xd42d('0x13')]));for(var _0x74fa48 in this[_0xd42d('0x13')]){if(_0x5285b5[_0xd42d('0x13')][_0xd42d('0x3c')](_0x74fa48)){_0x5285b5[_0xd42d('0x46')](_0x74fa48);}}};Preview[_0xd42d('0xd')]['recallMe']=function(_0x5f50d3){var _0x442647=this;rpcDb[_0xd42d('0x59')](_0x5f50d3['id'],ut[_0xd42d('0x5a')](this[_0xd42d('0x14')]))['then'](function(_0x412ad6){if(!_[_0xd42d('0x5b')](_0x412ad6)){for(var _0x5f4953=0x0;_0x5f4953<_0x412ad6[_0xd42d('0x5c')];_0x5f4953+=0x1){if(ut['getDiff'](_0x412ad6[_0x5f4953][_0xd42d('0x5d')])<_0x5f50d3[_0xd42d('0x5e')]*0x3c){if(_0x412ad6[_0x5f4953][_0xd42d('0x5f')]&&!_0x412ad6[_0x5f4953][_0xd42d('0x5f')]['voicePause']){_0x442647[_0xd42d('0x60')](_0x412ad6[_0x5f4953]['id'])[_0xd42d('0x61')](ut[_0xd42d('0x62')](_0xd42d('0x63')))[_0xd42d('0x50')](ut[_0xd42d('0x62')](_0xd42d('0x63')));}else{rpcDb[_0xd42d('0x64')](_0x412ad6[_0x5f4953]['id']);}}else{var _0x8433f0=new Action(_0x412ad6[_0x5f4953],_0x5f50d3);_0x8433f0[_0xd42d('0x65')]=moment()[_0xd42d('0x29')](_0xd42d('0x66'));_0x5f50d3[_0xd42d('0x67')]+=0x1;ut[_0xd42d('0x68')](_0x8433f0,0x17,_0xd42d('0x69'));if(_0x5f50d3[_0xd42d('0x6a')]){rpcDb[_0xd42d('0x6b')](ut['createBody'](_0x412ad6[_0x5f4953]));rpcDb[_0xd42d('0x6c')](_0x8433f0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xd42d('0x68')](_0x8433f0,0x16,_0xd42d('0x6d'));rpcDb[_0xd42d('0x6c')](_0x8433f0,'[HistoryRecallClose]');rpcDb[_0xd42d('0x6e')](_0x8433f0,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xd42d('0x62')](_0xd42d('0x6f')));};Preview[_0xd42d('0xd')][_0xd42d('0x43')]=function(_0x545834){_0x545834[_0xd42d('0x2e')]=!![];if(ut[_0xd42d('0x70')](_0x545834[_0xd42d('0x71')])){_0x545834[_0xd42d('0x32')]=utils[_0xd42d('0x33')][_0xd42d('0x72')];}else if(!ut['isActive'](_0x545834[_0xd42d('0x42')])){_0x545834[_0xd42d('0x32')]=utils[_0xd42d('0x33')][_0xd42d('0x34')];}else if(!this[_0xd42d('0x73')](_0x545834['Trunk'])){if(!this['isTrunkReachable'](_0x545834[_0xd42d('0x74')])){_0x545834[_0xd42d('0x32')]=utils[_0xd42d('0x33')][_0xd42d('0x75')];}else{_0x545834[_0xd42d('0x32')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x545834[_0xd42d('0x32')]=utils['CAMPAIGN_STATUS'][_0xd42d('0x76')];}};Preview[_0xd42d('0xd')]['callProgressDetectingCustomer']=function(_0x4797c3,_0x72d1d0,_0x598b42){var _0x21cebb=this;var _0x5352e9=this[_0xd42d('0x13')][_0x72d1d0];var _0x499c65=this['campaignsPreview'][_0x5352e9[_0xd42d('0x4a')]];var _0x4ba6fc;var _0x116dcf=![];var _0xa3a898=0x2;var _0x159d91=0x3;if(_0x499c65){switch(_0x598b42){case'1':_0x499c65[_0xd42d('0x77')]+=0x1;_0x5352e9[_0xd42d('0x78')]+=0x1;_0x5352e9[_0xd42d('0x79')]=ut[_0xd42d('0x7a')](_0x5352e9);ut[_0xd42d('0x68')](_0x5352e9,0x0,_0xd42d('0x7b'));ami[_0xd42d('0x26')]('custom:agentnosuchnumber',ut[_0xd42d('0x7c')](_0x5352e9,_0xd42d('0x7d')));rpcDb[_0xd42d('0x6c')](_0x5352e9,'[callProgressDetectingCustomer][logNoSuch]');_0x21cebb[_0xd42d('0x7e')](_0x5352e9,'0',_0x499c65)['then'](function(_0x6579ec){_0x116dcf=_0x6579ec[_0xd42d('0x7f')]==0x1;_0xa3a898=_0x499c65[_0xd42d('0x80')];_0x159d91=_0x499c65[_0xd42d('0x81')];if(!_0x116dcf){if(ut[_0xd42d('0x7a')](_0x5352e9)>=_0x499c65['dialGlobalMaxRetry']){_0x4ba6fc=ut[_0xd42d('0x82')](_0x5352e9,0xf,_0xd42d('0x83'));rpcDb[_0xd42d('0x6e')](_0x4ba6fc,_0xd42d('0x84'));}else{if(_0x5352e9[_0xd42d('0x78')]>=_0x499c65[_0xd42d('0x85')]){rpcDb[_0xd42d('0x6e')](_0x5352e9,_0xd42d('0x84'));}else{rpcDb[_0xd42d('0x86')](ut[_0xd42d('0x87')](_0x5352e9,_0xd42d('0x78'),_0x499c65['dialNoSuchNumberRetryFrequency']),_0x5352e9[_0xd42d('0x88')],_0x5352e9[_0xd42d('0x89')]);}}delete this[_0xd42d('0x13')][_0x4797c3['linkedid']];}else{_0x5352e9[_0xd42d('0x78')]++;logger['info']('actioncountonusuch',_0x5352e9[_0xd42d('0x78')]);logger[_0xd42d('0x27')]('id',_0x5352e9[_0xd42d('0x8a')]);_0x21cebb[_0xd42d('0x8b')]({'id':_0x5352e9[_0xd42d('0x8a')],'field':{'countnosuchnumberretry':_0x5352e9[_0xd42d('0x78')]}})[_0xd42d('0x61')](function(){_0x21cebb[_0xd42d('0x8c')](_0x5352e9,_0xa3a898,_0x159d91)[_0xd42d('0x61')](function(){});});}});break;case _0xd42d('0x8d'):var _0x262d38=moment()[_0xd42d('0x29')](_0xd42d('0x66'));_0x5352e9[_0xd42d('0x8e')]=_0x262d38;_0x5352e9[_0xd42d('0x8f')]=_0x262d38;_0x5352e9[_0xd42d('0x4b')]=!![];_0x499c65[_0xd42d('0x30')]+=0x1;logger[_0xd42d('0x27')](_0xd42d('0x90'),_0x5352e9[_0xd42d('0x91')],_0xd42d('0x92'),_0x499c65[_0xd42d('0x2b')],'pTalking:\x20',_0x499c65[_0xd42d('0x30')]);ami['emit']('custom:agentconnect',ut[_0xd42d('0x7c')](_0x5352e9,_0xd42d('0x93'),this[_0xd42d('0x11')][_0x5352e9[_0xd42d('0x4a')]]));if(_0x499c65[_0xd42d('0x94')]||_0x499c65[_0xd42d('0x95')]){ami[_0xd42d('0x26')](_0xd42d('0x96'),{'queue':_0x5352e9[_0xd42d('0x4a')],'interface':_0x5352e9['channelAgent'],'uniqueid':_0x5352e9['uniqueid']});}break;case'16':ami['emit'](_0xd42d('0x97'),ut[_0xd42d('0x7c')](_0x5352e9,_0xd42d('0x98'),this[_0xd42d('0x11')][_0x5352e9['queue']]));emitVoiceQueueChannelRemove(ut[_0xd42d('0x7c')](_0x5352e9,_0xd42d('0x98')));_0x499c65[_0xd42d('0x99')]+=0x1;_0x499c65[_0xd42d('0x9a')]+=0x1;_0x499c65['answered']+=0x1;ut[_0xd42d('0x53')](_0x499c65,'[16]');_0x5352e9[_0xd42d('0x79')]=ut[_0xd42d('0x7a')](_0x5352e9);ut[_0xd42d('0x68')](_0x5352e9,0x4,'Answer');rpcDb[_0xd42d('0x6c')](_0x5352e9,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xd42d('0x6e')](_0x5352e9,_0xd42d('0x9b'));rpcDb['crateCustomerReportQueue'](_0x5352e9);_0x499c65[_0xd42d('0x9c')]+=_0x5352e9[_0xd42d('0x9d')];_0x499c65[_0xd42d('0x9e')]+=_0x5352e9[_0xd42d('0x9d')];logger[_0xd42d('0x27')](_0xd42d('0x9f'),_0x5352e9[_0xd42d('0x91')],_0xd42d('0x92'),_0x499c65[_0xd42d('0x2b')],_0xd42d('0xa0'),_0x499c65[_0xd42d('0x30')]);delete this[_0xd42d('0x13')][_0x4797c3[_0xd42d('0xa1')]];break;case _0xd42d('0xa2'):_0x499c65['outboundBusyCallsDay']+=0x1;_0x5352e9[_0xd42d('0xa3')]+=0x1;_0x5352e9[_0xd42d('0x79')]=ut['totalGlobal'](_0x5352e9);ut['logCustomer'](_0x5352e9,0x5,_0xd42d('0xa4'));_0xa3a898=_0x499c65[_0xd42d('0xa5')];_0x159d91=_0x499c65[_0xd42d('0x81')];ami[_0xd42d('0x26')](_0xd42d('0xa6'),ut[_0xd42d('0x7c')](_0x5352e9,_0xd42d('0xa7')));rpcDb['createCustomerHistory'](_0x5352e9,_0xd42d('0xa8'));_0x21cebb[_0xd42d('0x7e')](_0x5352e9,'5',_0x499c65)['then'](function(_0xc3dc09){_0x116dcf=_0xc3dc09[_0xd42d('0x7f')]==0x1;if(!_0x116dcf){if(ut[_0xd42d('0x7a')](_0x5352e9)>=_0x499c65['dialGlobalMaxRetry']){_0x4ba6fc=ut['cloneAction'](_0x5352e9,0xf,_0xd42d('0x83'));rpcDb[_0xd42d('0x6e')](_0x4ba6fc,_0xd42d('0xa9'));}else{if(_0x5352e9[_0xd42d('0xa3')]>=_0x499c65['dialBusyMaxRetry']){rpcDb[_0xd42d('0x6e')](_0x5352e9,_0xd42d('0xa8'));}else{rpcDb[_0xd42d('0x86')](ut[_0xd42d('0x87')](_0x5352e9,_0xd42d('0xa3'),_0x499c65[_0xd42d('0xa5')]),_0x5352e9[_0xd42d('0x88')],_0x5352e9['activeContact']);}}}else{_0x5352e9[_0xd42d('0xa3')]++;_0x21cebb['incrementPreviewCounters']({'id':_0x5352e9[_0xd42d('0x8a')],'field':{'countbusyretry':_0x5352e9[_0xd42d('0xa3')]}})['then'](function(){_0x21cebb[_0xd42d('0x8c')](_0x5352e9,_0xa3a898,_0x159d91)[_0xd42d('0x61')](function(){});});}});break;case'NOANSWER':_0x499c65[_0xd42d('0xaa')]+=0x1;_0x5352e9[_0xd42d('0xab')]+=0x1;_0x5352e9[_0xd42d('0x79')]=ut[_0xd42d('0x7a')](_0x5352e9);ut[_0xd42d('0x68')](_0x5352e9,0x3,'NoAnswer');_0xa3a898=_0x499c65[_0xd42d('0xac')];_0x159d91=_0x499c65[_0xd42d('0x81')];var _0x4b1b32=ut[_0xd42d('0xad')](_0x5352e9,_0x499c65);ami[_0xd42d('0x26')](_0xd42d('0xae'),_0x4b1b32);rpcDb['createCustomerHistory'](_0x5352e9,_0xd42d('0xaf'));_0x21cebb['verifyAdditionalPhones'](_0x5352e9,'3',_0x499c65)['then'](function(_0x32bd90){_0x116dcf=_0x32bd90[_0xd42d('0x7f')]==0x1;if(!_0x116dcf){if(ut[_0xd42d('0x7a')](_0x5352e9)>=_0x499c65[_0xd42d('0xb0')]){_0x4ba6fc=ut[_0xd42d('0x82')](_0x5352e9,0xf,_0xd42d('0x83'));rpcDb[_0xd42d('0x6e')](_0x4ba6fc,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5352e9['countnoanswerretry']>=_0x499c65[_0xd42d('0xb1')]){rpcDb[_0xd42d('0x6e')](_0x5352e9,_0xd42d('0xaf'));}else{rpcDb['rescheduleContact'](ut[_0xd42d('0x87')](_0x5352e9,'countnoanswerretry',_0x499c65['dialNoAnswerRetryFrequency']),_0x5352e9[_0xd42d('0x88')],_0x5352e9[_0xd42d('0x89')]);}}}else{_0x5352e9[_0xd42d('0xab')]++;_0x21cebb[_0xd42d('0x8b')]({'id':_0x5352e9['idContact'],'field':{'countnoanswerretry':_0x5352e9[_0xd42d('0xab')]}})[_0xd42d('0x61')](function(){_0x21cebb[_0xd42d('0x8c')](_0x5352e9,_0xa3a898,_0x159d91)['then'](function(){});});}});break;case'CONGESTION':_0x499c65[_0xd42d('0xb2')]+=0x1;_0x5352e9['countcongestionretry']+=0x1;_0x5352e9['countglobal']=ut['totalGlobal'](_0x5352e9);ut[_0xd42d('0x68')](_0x5352e9,0x8,_0xd42d('0xb3'));_0xa3a898=_0x499c65[_0xd42d('0xb4')];_0x159d91=_0x499c65[_0xd42d('0x81')];ami[_0xd42d('0x26')]('custom:agentcongestion',ut[_0xd42d('0x7c')](_0x5352e9,'congestion'));rpcDb['createCustomerHistory'](_0x5352e9,_0xd42d('0xb5'));_0x21cebb[_0xd42d('0x7e')](_0x5352e9,'8',_0x499c65)[_0xd42d('0x61')](function(_0x551771){_0x116dcf=_0x551771[_0xd42d('0x7f')]==0x1;if(!_0x116dcf){if(ut['totalGlobal'](_0x5352e9)>=_0x499c65[_0xd42d('0xb0')]){_0x4ba6fc=ut[_0xd42d('0x82')](_0x5352e9,0xf,_0xd42d('0x83'));rpcDb['createCustomerFinal'](_0x4ba6fc,_0xd42d('0xb6'));}else{if(_0x5352e9[_0xd42d('0xb7')]>=_0x499c65[_0xd42d('0xb8')]){rpcDb['createCustomerFinal'](_0x5352e9,_0xd42d('0xb5'));}else{rpcDb[_0xd42d('0x86')](ut[_0xd42d('0x87')](_0x5352e9,_0xd42d('0xb7'),_0x499c65[_0xd42d('0xa5')]),_0x5352e9['unlockAgent'],_0x5352e9['activeContact']);}}}else{_0x5352e9['countcongestionretry']++;_0x21cebb[_0xd42d('0x8b')]({'id':_0x5352e9[_0xd42d('0x8a')],'field':{'countcongestionretry':_0x5352e9[_0xd42d('0xb7')]}})['then'](function(){_0x21cebb[_0xd42d('0x8c')](_0x5352e9,_0xa3a898,_0x159d91)['then'](function(){});});}});break;case _0xd42d('0xb9'):_0x499c65[_0xd42d('0xba')]+=0x1;_0x5352e9['countagentrejectretry']+=0x1;_0x5352e9[_0xd42d('0x79')]=ut[_0xd42d('0x7a')](_0x5352e9);ut['logCustomer'](_0x5352e9,0x14,_0xd42d('0xbb'));_0xa3a898=_0x499c65[_0xd42d('0xbc')];_0x159d91=_0x499c65[_0xd42d('0x81')];ami[_0xd42d('0x26')](_0xd42d('0xbd'),ut['buildObj'](_0x5352e9,'agentreject'));rpcDb[_0xd42d('0x6c')](_0x5352e9,_0xd42d('0xbe'));_0x21cebb[_0xd42d('0x7e')](_0x5352e9,'20',_0x499c65)['then'](function(_0xade69){_0x116dcf=_0xade69[_0xd42d('0x7f')]==0x1;if(!_0x116dcf){if(ut[_0xd42d('0x7a')](_0x5352e9)>=_0x499c65['dialGlobalMaxRetry']){_0x4ba6fc=ut[_0xd42d('0x82')](_0x5352e9,0x14,_0xd42d('0xbb'));rpcDb[_0xd42d('0x6e')](_0x4ba6fc,_0xd42d('0xbf'));}else{if(_0x5352e9[_0xd42d('0xc0')]>=_0x499c65[_0xd42d('0xc1')]){rpcDb[_0xd42d('0x6e')](_0x5352e9,_0xd42d('0xbf'));}else{rpcDb['rescheduleContact'](ut[_0xd42d('0x87')](_0x5352e9,_0xd42d('0xc0'),_0x499c65[_0xd42d('0xbc')]),_0x5352e9[_0xd42d('0x88')],_0x5352e9['activeContact']);}}}else{_0x5352e9[_0xd42d('0xab')]++;_0x21cebb[_0xd42d('0x8b')]({'id':_0x5352e9[_0xd42d('0x8a')],'field':{'countnoanswerretry':_0x5352e9[_0xd42d('0xab')]}})[_0xd42d('0x61')](function(){_0x21cebb['swapAdditionalPhones'](_0x5352e9,_0xa3a898,_0x159d91)[_0xd42d('0x61')](function(){});});}});break;case'ABANDONED':_0x499c65[_0xd42d('0xc2')]+=0x1;_0x5352e9[_0xd42d('0xc3')]+=0x1;_0x5352e9[_0xd42d('0x79')]=ut[_0xd42d('0x7a')](_0x5352e9);ut[_0xd42d('0x68')](_0x5352e9,0xb,_0xd42d('0xc4'));rpcDb['createCustomerHistory'](_0x5352e9,_0xd42d('0xc5'));_0x21cebb['verifyAdditionalPhones'](_0x5352e9,'11',_0x499c65)['then'](function(_0x4fa077){_0x116dcf=_0x4fa077['additional']==0x1;if(!_0x116dcf){if(ut[_0xd42d('0x7a')](_0x5352e9)>=_0x499c65[_0xd42d('0xb0')]){_0x4ba6fc=ut['cloneAction'](_0x5352e9,0xf,_0xd42d('0x83'));rpcDb[_0xd42d('0x6e')](_0x4ba6fc,_0xd42d('0xc5'));}else{if(_0x5352e9[_0xd42d('0xc6')]>=_0x499c65['dialAbandonedMaxRety']){rpcDb[_0xd42d('0x6e')](_0x5352e9,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xd42d('0x86')](ut[_0xd42d('0x87')](_0x5352e9,_0xd42d('0xc3'),_0x499c65[_0xd42d('0xc7')]),_0x5352e9[_0xd42d('0x88')],_0x5352e9['activeContact']);}}}else{_0x5352e9[_0xd42d('0xab')]++;_0x21cebb[_0xd42d('0x8b')]({'id':_0x5352e9['idContact'],'field':{'countnoanswerretry':_0x5352e9['countnoanswerretry']}})[_0xd42d('0x61')](function(){_0x21cebb[_0xd42d('0x8c')](_0x5352e9,_0xa3a898,_0x159d91)[_0xd42d('0x61')](function(){});});}});break;case'18':_0x499c65[_0xd42d('0xc8')]+=0x1;_0x5352e9[_0xd42d('0xc9')]+=0x1;_0x5352e9[_0xd42d('0x79')]=ut[_0xd42d('0x7a')](_0x5352e9);ut[_0xd42d('0x68')](_0x5352e9,0x12,_0x4797c3['cause-txt']||_0x4797c3['dialstatus']);ami['emit'](_0xd42d('0xca'),ut[_0xd42d('0x7c')](_0x5352e9,_0xd42d('0xcb')));rpcDb[_0xd42d('0x6c')](_0x5352e9,_0xd42d('0xcc'));_0x21cebb[_0xd42d('0x7e')](_0x5352e9,'18',_0x499c65)[_0xd42d('0x61')](function(_0x4367c8){_0x116dcf=_0x4367c8[_0xd42d('0x7f')]==0x1;if(!_0x116dcf){if(ut[_0xd42d('0x7a')](_0x5352e9)>=_0x499c65[_0xd42d('0xb0')]){_0x4ba6fc=ut['cloneAction'](_0x5352e9,0x12,_0xd42d('0x83'));rpcDb[_0xd42d('0x6e')](_0x4ba6fc,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xd42d('0x6e')](_0x5352e9,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x5352e9['countnoanswerretry']++;_0x21cebb['incrementPreviewCounters']({'id':_0x5352e9[_0xd42d('0x8a')],'field':{'countnoanswerretry':_0x5352e9['countnoanswerretry']}})[_0xd42d('0x61')](function(){_0x21cebb[_0xd42d('0x8c')](_0x5352e9,_0xa3a898,_0x159d91)[_0xd42d('0x61')](function(){});});}});delete this['actions'][_0x4797c3[_0xd42d('0xa1')]];break;case'19':_0x499c65['outboundUnknownCallsDay']+=0x1;_0x5352e9[_0xd42d('0x79')]=ut[_0xd42d('0x7a')](_0x5352e9);ut[_0xd42d('0x68')](_0x5352e9,0x13,_0x4797c3['cause-txt']||_0x4797c3[_0xd42d('0xcd')]);ami[_0xd42d('0x26')](_0xd42d('0xca'),ut['buildObj'](_0x5352e9,_0xd42d('0xcb')));rpcDb[_0xd42d('0x6c')](_0x5352e9,_0xd42d('0xce'));_0x21cebb['verifyAdditionalPhones'](_0x5352e9,'18',_0x499c65)['then'](function(_0x3f6ae8){_0x116dcf=_0x3f6ae8[_0xd42d('0x7f')]==0x1;if(!_0x116dcf){if(ut[_0xd42d('0x7a')](_0x5352e9)>=_0x499c65['dialGlobalMaxRetry']){_0x4ba6fc=ut[_0xd42d('0x82')](_0x5352e9,0xf,_0xd42d('0x83'));rpcDb[_0xd42d('0x6e')](_0x4ba6fc,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xd42d('0x6e')](_0x5352e9,_0xd42d('0xce'));}}else{_0x5352e9[_0xd42d('0xab')]++;_0x21cebb['incrementPreviewCounters']({'id':_0x5352e9[_0xd42d('0x8a')],'field':{'countnoanswerretry':_0x5352e9['countnoanswerretry']}})['then'](function(){_0x21cebb[_0xd42d('0x8c')](_0x5352e9,_0xa3a898,_0x159d91)['then'](function(){});});}});delete this[_0xd42d('0x13')][_0x4797c3[_0xd42d('0xa1')]];break;default:if(_0x5352e9[_0xd42d('0x4b')]){ut['decrementTalking'](_0x499c65,_0xd42d('0xcf'));ut[_0xd42d('0x54')](_0xd42d('0xd0')+_0x499c65[_0xd42d('0x2b')],_0x4797c3);}_0x499c65[_0xd42d('0xc8')]+=0x1;_0x5352e9[_0xd42d('0x79')]=ut[_0xd42d('0x7a')](_0x5352e9);ut[_0xd42d('0x68')](_0x5352e9,0xc,_0x4797c3['cause-txt']||_0x4797c3[_0xd42d('0xcd')]);_0xa3a898=_0x499c65[_0xd42d('0xbc')];_0x159d91=_0x499c65[_0xd42d('0x81')];rpcDb[_0xd42d('0x6c')](_0x5352e9,_0xd42d('0xd1'));_0x21cebb['verifyAdditionalPhones'](_0x5352e9,'20',_0x499c65)['then'](function(_0x338a4a){_0x116dcf=_0x338a4a[_0xd42d('0x7f')]==0x1;if(!_0x116dcf){if(ut[_0xd42d('0x7a')](_0x5352e9)>=_0x499c65[_0xd42d('0xb0')]){_0x4ba6fc=ut[_0xd42d('0x82')](_0x5352e9,0xf,_0xd42d('0x83'));rpcDb['createCustomerFinal'](_0x4ba6fc,_0xd42d('0xd2'));}else{rpcDb[_0xd42d('0x6e')](_0x5352e9,_0xd42d('0xd2'));}delete this[_0xd42d('0x13')][_0x4797c3[_0xd42d('0xa1')]];}else{_0x21cebb[_0xd42d('0x8c')](_0x5352e9,_0xa3a898,_0x159d91)[_0xd42d('0x61')](function(){});}});}if(!(_0x5352e9[_0xd42d('0x4b')]&&_0x598b42==='16')){utils[_0xd42d('0x52')](_0x499c65,_0xd42d('0xd3'));logger[_0xd42d('0x27')](_0xd42d('0xd4'),_0x5352e9[_0xd42d('0x91')],'\x20Queue',_0x499c65[_0xd42d('0x2b')],_0xd42d('0xd5'),_0x499c65[_0xd42d('0x2f')]);}if(_0x598b42!==_0xd42d('0x8d')){delete this[_0xd42d('0x13')][_0x4797c3[_0xd42d('0xa1')]];delete this['actions'][_0x4797c3[_0xd42d('0xd6')]];}_0x499c65[_0xd42d('0xd7')]=!![];}};Preview[_0xd42d('0xd')][_0xd42d('0xd8')]=function(_0x73ab9d,_0x3e5f06,_0x12da95){if(_['isUndefined'](_0x3e5f06)&&_0xd42d('0xd9')!==typeof _0x3e5f06){return;}if(_[_0xd42d('0xda')](_0x12da95)&&'object'!==typeof _0x12da95){return;}switch(_0x12da95['reason']){case'0':ut['logAgent'](_0x73ab9d,0x0,_0xd42d('0x7b'));rpcDb[_0xd42d('0xdb')](_0x73ab9d,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xd42d('0xdc')](_0x73ab9d,0x3,_0xd42d('0xdd'));rpcDb['createAgentHistory'](_0x73ab9d,_0xd42d('0xde'));break;case'5':ut[_0xd42d('0xdc')](_0x73ab9d,0x5,_0xd42d('0xa4'));rpcDb['createAgentHistory'](_0x73ab9d,_0xd42d('0xdf'));break;case'8':ut['logAgent'](_0x73ab9d,0x8,'Congestion');rpcDb[_0xd42d('0xdb')](_0x73ab9d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xd42d('0xdc')](_0x73ab9d,0x16,_0xd42d('0xe0'));rpcDb[_0xd42d('0xdb')](_0x73ab9d,_0xd42d('0xe1'));break;default:ut['logAgent'](_0x73ab9d,0xc,_0x12da95[_0xd42d('0xe2')]);rpcDb['createAgentHistory'](_0x73ab9d,_0xd42d('0xe3'));}utils[_0xd42d('0x52')](_0x3e5f06,'[callProgressDetectingAgent]');logger['info'](_0xd42d('0xe4'),_0x73ab9d['uniqueid'],_0xd42d('0x92'),_0x3e5f06['name'],_0xd42d('0xd5'),_0x3e5f06['originated']);delete this['actions'][_0x73ab9d[_0xd42d('0x91')]];};Preview[_0xd42d('0xd')][_0xd42d('0x7e')]=function(_0x1ef83c,_0x2d85a5,_0x441d36){return cmHopperAdditionalPhone[_0xd42d('0x7e')](_0x1ef83c,_0x2d85a5,_0x441d36)[_0xd42d('0x50')](logger[_0xd42d('0x27')](_0xd42d('0xe5')));};Preview[_0xd42d('0xd')][_0xd42d('0x8c')]=function(_0x4d363,_0x1588db,_0x107c41){return cmHopperAdditionalPhone[_0xd42d('0x8c')](_0x4d363,_0x1588db,_0x107c41)[_0xd42d('0x50')](logger[_0xd42d('0x27')](_0xd42d('0xe6')));};Preview[_0xd42d('0xd')][_0xd42d('0x8b')]=function(_0x1036b0){return Promise[_0xd42d('0xe7')]()[_0xd42d('0x61')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x1036b0))['catch'](logger[_0xd42d('0x27')](_0xd42d('0xe8')));};Preview[_0xd42d('0xd')][_0xd42d('0xe9')]=function(_0x204872,_0x3234f9,_0x2678a3,_0x77318a,_0x5b5bc2){var _0x3419f8=this;return new Promise(function(_0x17e567,_0x1aaba9){if(_[_0xd42d('0x5b')](_0x3234f9)||_[_0xd42d('0x5b')](_0x3234f9[_0xd42d('0xea')])||_['isNil'](_0x3234f9[_0xd42d('0xeb')])||_['isNil'](_0x3234f9[_0xd42d('0xec')])){_0x1aaba9(ut['message'](_0xd42d('0xed'),_0x77318a,_0x5b5bc2));return;}var _0x2226a3=uuid['v4']();var _0x219160=_0x3419f8[_0xd42d('0x11')][_0x3234f9[_0xd42d('0x48')][_0xd42d('0x2b')]];var _0x417f93=_0x2678a3?_0x3419f8[_0xd42d('0x14')][_0x2678a3]['id']:undefined;_0x3419f8[_0xd42d('0x13')][_0x2226a3]=new Action(_0x3234f9,_0x219160,_0x2226a3,_0x2678a3,_0x417f93);var _0x1a908d=_0x3419f8['actions'][_0x2226a3];_0x1a908d[_0xd42d('0x88')]=_0x77318a;_0x1a908d['activeContact']=_0x5b5bc2;_0x1a908d[_0xd42d('0xee')]=_0x2678a3;if(_['isEmpty'](_0x204872)){_0x3419f8['execCall'](_0x1a908d,_0x219160,_0x3234f9,_0x2678a3)[_0xd42d('0x61')](function(_0x41c739){logger[_0xd42d('0x27')](_0xd42d('0xef'),_0xd42d('0xf0')+_0x1a908d[_0xd42d('0x4a')]+_0xd42d('0xf1')+_0x1a908d['idContact'],JSON[_0xd42d('0x49')](_0x41c739));ami[_0xd42d('0x26')](_0xd42d('0xf2'),ut[_0xd42d('0x7c')](_0x1a908d,'called',_0x3419f8['campaignsPreview'][_0x1a908d['queue']]));_0x17e567(ut[_0xd42d('0x32')](_0xd42d('0xf3')));})['catch'](function(_0x30e699){ut['logger'](_0xd42d('0xf4'),_0x30e699);_0x1aaba9(ut[_0xd42d('0x32')](_0xd42d('0xf5'),_0x77318a,_0x5b5bc2));});}else{_0x219160['outboundBlacklistCallsDay']+=0x1;ut[_0xd42d('0xf6')](_0x1a908d);rpcDb[_0xd42d('0xf7')](_0x1a908d,_0xd42d('0xf8'));delete _0x3419f8[_0xd42d('0x13')][_0x2226a3];_0x1aaba9(ut[_0xd42d('0x32')](_0xd42d('0xf9'),_0x77318a,_0x5b5bc2));}});};Preview[_0xd42d('0xd')]['isTrunkReachable']=function(_0x2e29cb){return!_[_0xd42d('0x5b')](_0x2e29cb)&&!_[_0xd42d('0x5b')](_0x2e29cb[_0xd42d('0x2b')])&&!_[_0xd42d('0x5b')](_0x2e29cb[_0xd42d('0xfa')])&&_0x2e29cb[_0xd42d('0xfa')]&&!_[_0xd42d('0x5b')](this[_0xd42d('0x12')][util[_0xd42d('0x29')]('SIP/%s',_0x2e29cb[_0xd42d('0x2b')])])&&!_['isNil'](this[_0xd42d('0x12')][util['format'](_0xd42d('0xfb'),_0x2e29cb['name'])][_0xd42d('0xfc')])&&(this[_0xd42d('0x12')][util['format'](_0xd42d('0xfb'),_0x2e29cb['name'])][_0xd42d('0xfc')]===_0xd42d('0xfd')||this['trunks'][util['format'](_0xd42d('0xfb'),_0x2e29cb[_0xd42d('0x2b')])][_0xd42d('0xfc')]===_0xd42d('0xfe'));};Preview[_0xd42d('0xd')]['run']=function(_0x3af18f,_0x2b11bb){return this['execRun'](_0x3af18f,_0x2b11bb)[_0xd42d('0x61')](function(_0x1096a3){return _[_0xd42d('0x4c')](_0x1096a3,[_0xd42d('0x32')]);})[_0xd42d('0x50')](function(_0x598e29){if(_0x598e29['unlock']){rpcDb[_0xd42d('0xff')](_0x3af18f);}if(_0x598e29[_0xd42d('0xfa')]){rpcDb[_0xd42d('0x64')](_0x3af18f);}throw _['pick'](_0x598e29,[_0xd42d('0x32')]);});};Preview[_0xd42d('0xd')][_0xd42d('0x100')]=function(_0x45e23c,_0x5395ef){var _0x266f20=this;var _0xa872,_0x274f13;return rpcDb[_0xd42d('0x101')](_0x45e23c)[_0xd42d('0x61')](function(_0x40a4f8){if(!_[_0xd42d('0x5b')](_0x40a4f8[0x0])){_0x274f13=_0x40a4f8[0x0][_0xd42d('0x102')]?![]:!![];_0xa872=_0x40a4f8[0x0][_0xd42d('0x102')]?!![]:![];_0xa872=_0x5395ef?!![]:_0xa872;}var _0x5e1d64=_0x266f20[_0xd42d('0x103')](_0x40a4f8);if(_0x5e1d64['isValid']){rpcDb[_0xd42d('0x104')](_[_0xd42d('0x4c')](_0x40a4f8[0x0],[_0xd42d('0xec'),_0xd42d('0xeb')]))[_0xd42d('0x61')](function(_0x35bb9c){_0x266f20[_0xd42d('0xe9')](_0x35bb9c,_0x40a4f8[0x0],_0x5395ef,_0x274f13,_0xa872)[_0xd42d('0x61')](function(_0x2da7ba){return _0x2da7ba;})['catch'](function(_0x1115f4){throw _0x1115f4;});})[_0xd42d('0x50')](function(_0x38739b){ut['logger'](_0xd42d('0x105'),_0x38739b);throw ut[_0xd42d('0x32')](_0xd42d('0x106'),_0x274f13,_0xa872);});}else{throw ut[_0xd42d('0x32')](_0x5e1d64[_0xd42d('0x32')],_0x274f13,_0xa872);}})['catch'](function(_0x1ee0e4){ut['logger'](_0xd42d('0x107'),_0x1ee0e4);throw ut[_0xd42d('0x32')](_0xd42d('0x106'),![],!![]);});};Preview['prototype']['validateContact']=function(_0x331753){if(_[_0xd42d('0x5b')](_0x331753)||_[_0xd42d('0x108')](_0x331753)||!_[_0xd42d('0x5b')](_0x331753[0x0][_0xd42d('0x5f')])&&_[_0xd42d('0x5b')](_0x331753[0x0]['Agent']['name'])){ut[_0xd42d('0x38')](_0xd42d('0x109'),_0x331753);return{'isValid':![],'message':_0xd42d('0x10a')};}var _0x1494fe=this[_0xd42d('0x11')][_0x331753[0x0][_0xd42d('0x48')][_0xd42d('0x2b')]];_0x1494fe[_0xd42d('0x32')]=utils[_0xd42d('0x33')][_0xd42d('0x76')];if(_[_0xd42d('0x5b')](_0x1494fe)){ut[_0xd42d('0x38')](_0xd42d('0x10b'),_0x1494fe);return{'isValid':![],'message':_0xd42d('0x10c')};}if(!this[_0xd42d('0x73')](_0x1494fe[_0xd42d('0x10d')])){ut[_0xd42d('0x38')](_0xd42d('0x10e'),_0xd42d('0x10f')+_0x1494fe[_0xd42d('0x2b')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xd42d('0x73')](_0x1494fe[_0xd42d('0x74')])){ut[_0xd42d('0x38')](_0xd42d('0x10e'),_0x1494fe[_0xd42d('0x2b')]+_0xd42d('0x110'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x1494fe[_0xd42d('0x42')])){ut['logger'](_0xd42d('0x111'),_0x1494fe['name']+_0xd42d('0x112'));return{'isValid':![],'message':_0xd42d('0x10f')+_0x1494fe[_0xd42d('0x2b')]+_0xd42d('0x112')};}return{'isValid':!![],'message':_0xd42d('0x113')};};Preview[_0xd42d('0xd')][_0xd42d('0x114')]=function(_0x5d33e5,_0x418dc0,_0x47dbc5,_0x242717){var _0x2fa92d=this;return new Promise(function(_0x54efa3,_0x27db6e){var _0x24f0ba=_0x5d33e5['uniqueid'];var _0x7ee6bb=_0x2fa92d[_0xd42d('0x73')](_0x418dc0[_0xd42d('0x10d')])?util[_0xd42d('0x29')](_0xd42d('0x115'),_0x418dc0['Trunk']['name'],_[_0xd42d('0x5b')](_0x418dc0[_0xd42d('0x116')])?'':_0x418dc0[_0xd42d('0x116')][_0xd42d('0x117')]()||'',_0x418dc0[_0xd42d('0x118')]>0x0?_0x47dbc5[_0xd42d('0xeb')][_0xd42d('0x119')](_0x418dc0[_0xd42d('0x118')]):_0x47dbc5[_0xd42d('0xeb')]):util[_0xd42d('0x29')](_0xd42d('0x115'),_['isNil'](_0x418dc0[_0xd42d('0x74')])?_0x418dc0['Trunk'][_0xd42d('0x2b')]:_0x418dc0[_0xd42d('0x74')]['name'],_[_0xd42d('0x5b')](_0x418dc0[_0xd42d('0x116')])?'':_0x418dc0[_0xd42d('0x116')][_0xd42d('0x117')]()||'',_0x418dc0[_0xd42d('0x118')]>0x0?_0x47dbc5[_0xd42d('0xeb')]['substring'](_0x418dc0[_0xd42d('0x118')]):_0x47dbc5[_0xd42d('0xeb')]);var _0x1d2aca=_0x2fa92d['isTrunkReachable'](_0x418dc0[_0xd42d('0x10d')])?ut[_0xd42d('0x11a')](_0x418dc0['Trunk'][_0xd42d('0x11b')],_0x418dc0[_0xd42d('0x11c')],_0x418dc0[_0xd42d('0x11d')]>0x0?ut[_0xd42d('0x11e')](_0x418dc0['dialOriginateCallerIdNumber'],_0x418dc0[_0xd42d('0x11d')]):_0x418dc0['dialOriginateCallerIdNumber']):ut[_0xd42d('0x11a')](_[_0xd42d('0x5b')](_0x418dc0[_0xd42d('0x74')])?_0x418dc0['Trunk'][_0xd42d('0x11b')]:_0x418dc0[_0xd42d('0x74')][_0xd42d('0x11b')],_0x418dc0[_0xd42d('0x11c')],_0x418dc0[_0xd42d('0x11d')]>0x0?ut['getCallerIdRandom'](_0x418dc0['dialOriginateCallerIdNumber'],_0x418dc0[_0xd42d('0x11d')]):_0x418dc0['dialOriginateCallerIdNumber']);if(_0x1d2aca){_0x5d33e5[_0xd42d('0x11f')]=ut[_0xd42d('0x120')](_0x1d2aca);_0x5d33e5[_0xd42d('0x121')]=ut['extractCalleridNumber'](_0x1d2aca);}var _0x3276b7=ut['addVariables'](_0x418dc0,_0x47dbc5,_0x7ee6bb,_0x1d2aca,_0x24f0ba,_0x5d33e5);var _0x73dc7d=utils[_0xd42d('0x122')](_0x47dbc5[_0xd42d('0xea')]);Object[_0xd42d('0x123')](_0x3276b7,_0x73dc7d);_['merge'](_0x5d33e5,ut[_0xd42d('0x124')](_0x3276b7));_0x5d33e5[_0xd42d('0x65')]=moment()['format'](_0xd42d('0x66'));_0x418dc0[_0xd42d('0x125')]=_0x3276b7;var _0x3b8ad1=ut[_0xd42d('0x126')](_0x5d33e5,_0x418dc0,_0x3276b7,_0x5d33e5[_0xd42d('0x89')],_0x242717);return ami['Action'](_0x3b8ad1)['then'](function(_0x40146a){_0x418dc0[_0xd42d('0x2f')]+=0x1;logger['info'](_0xd42d('0x127'),_0x24f0ba,_0xd42d('0x92'),_0x418dc0[_0xd42d('0x2b')],_0xd42d('0xd5'),_0x418dc0[_0xd42d('0x2f')]);_0x54efa3(_0x40146a);})[_0xd42d('0x50')](function(_0x4f7b18){ut['logAgent'](_0x5d33e5,0xe,_0xd42d('0x128'));rpcDb['createAgentHistory'](_0x5d33e5,'[originateFailure][logOriginateFailure]');_0x27db6e(_0x4f7b18);});});};Preview[_0xd42d('0xd')][_0xd42d('0x1f')]=function(_0x93406f){if(this[_0xd42d('0x13')][_0x93406f[_0xd42d('0xa1')]]){this['actions'][_0x93406f[_0xd42d('0xa1')]][_0xd42d('0x4f')]=_0x93406f[_0xd42d('0x4f')];}};Preview[_0xd42d('0xd')]['syncOriginateResponse']=function(_0x26e242){var _0xa7f92c=this;var _0xd7f096=this[_0xd42d('0x13')][_0x26e242[_0xd42d('0x129')]];if(_0xd7f096){if(_0xd7f096[_0xd42d('0xee')]&&this['agents'][_0xd7f096[_0xd42d('0xee')]]){ut[_0xd42d('0x12a')](_0xd7f096,this[_0xd42d('0x14')][_0xd7f096['lookAgent']][_0xd42d('0x2b')],this[_0xd42d('0x14')][_0xd7f096[_0xd42d('0xee')]]['id']);}var _0x374403=_[_0xd42d('0x12b')](_0xd7f096);_0x374403[_0xd42d('0x8e')]=moment()[_0xd42d('0x29')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1fd881=_0xa7f92c[_0xd42d('0x11')][_0xd7f096[_0xd42d('0x4a')]];if(ut[_0xd42d('0x12c')](_0x26e242[_0xd42d('0x12d')])){if(_0xd7f096['unlockAgent']){rpcDb[_0xd42d('0xff')](_0xd7f096[_0xd42d('0x8a')]);}if(_0xd7f096[_0xd42d('0x89')]){rpcDb[_0xd42d('0x64')](_0xd7f096['idContact']);}ami[_0xd42d('0x26')](_0xd42d('0x12e'),ut[_0xd42d('0x7c')](_0xd7f096,_0xd42d('0x12f'),this[_0xd42d('0x11')][_0xd7f096[_0xd42d('0x4a')]]));this[_0xd42d('0xd8')](_0x374403,_0x1fd881,_0x26e242);}else{_0xd7f096[_0xd42d('0x65')]=moment()[_0xd42d('0x29')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xd42d('0xdc')](_0x374403,0x4,'Answer');rpcDb[_0xd42d('0xdb')](_0x374403,_0xd42d('0x130'));}}};Preview[_0xd42d('0xd')][_0xd42d('0x19')]=function(_0x32facb){var _0x56057d=this[_0xd42d('0x13')][_0x32facb[_0xd42d('0xa1')]];var _0x3563f0;if(_0x56057d){_0x3563f0=this[_0xd42d('0x11')][_0x56057d[_0xd42d('0x4a')]];logger[_0xd42d('0x27')](_0xd42d('0x131'),_0x32facb['linkedid'],_0xd42d('0x92'),_0x3563f0[_0xd42d('0x2b')],_0xd42d('0xa0'),_0x3563f0[_0xd42d('0x30')]);}if(this['actions'][_0x32facb[_0xd42d('0xa1')]]&&_0x32facb[_0xd42d('0xa1')]!==_0x32facb[_0xd42d('0x91')]){if(_0x32facb[_0xd42d('0x132')]==='16'&&this[_0xd42d('0x13')][_0x32facb[_0xd42d('0xa1')]]['dialAnswer']){this[_0xd42d('0x133')](_0x32facb,_0x32facb['linkedid'],_0x32facb[_0xd42d('0x132')]);}else if(this[_0xd42d('0x13')][_0x32facb['linkedid']][_0xd42d('0x4b')]){logger[_0xd42d('0x27')](_0xd42d('0x134'),_0x32facb[_0xd42d('0xa1')],_0x32facb[_0xd42d('0x132')],'\x20Queue',_0x3563f0[_0xd42d('0x2b')],'pTalking:\x20',_0x3563f0[_0xd42d('0x30')]);this['callProgressDetectingCustomer'](_0x32facb,_0x32facb[_0xd42d('0xa1')],_0x32facb[_0xd42d('0x132')]);}}else if(_0x56057d&&_[_0xd42d('0x5b')](_0x56057d['statedesc'])&&_0x3563f0['dialQueueProject']&&_0x32facb[_0xd42d('0xa1')]===_0x32facb[_0xd42d('0x91')]&&_[_0xd42d('0x5b')](_0x32facb[_0xd42d('0xe2')])&&_0x32facb[_0xd42d('0x132')]==='16'&&_0x32facb[_0xd42d('0x135')]==='6'&&_[_0xd42d('0xda')](_0x56057d[_0xd42d('0x136')])){if(_0x56057d[_0xd42d('0x88')]){rpcDb['unlockContact'](_0x56057d[_0xd42d('0x8a')]);}if(_0x56057d[_0xd42d('0x89')]){rpcDb['disableContact'](_0x56057d[_0xd42d('0x8a')]);}_0x32facb['reason']='22';this['callProgressDetectingAgent'](_0x56057d,_0x3563f0,_0x32facb);}else if(_0x56057d&&_0x56057d[_0xd42d('0x136')]){if(_0x32facb[_0xd42d('0x132')]==='16'&&this[_0xd42d('0x13')][_0x32facb[_0xd42d('0xa1')]][_0xd42d('0x4b')]){logger[_0xd42d('0x27')]('[syncHangup][talking][transfer]',_0x32facb['linkedid'],_0x32facb[_0xd42d('0x132')],_0xd42d('0x92'),_0x3563f0[_0xd42d('0x2b')],'pTalking:\x20',_0x3563f0[_0xd42d('0x30')]);this['callProgressDetectingCustomer'](_0x32facb,_0x32facb[_0xd42d('0xa1')],_0x32facb[_0xd42d('0x132')]);}else if(this['actions'][_0x32facb[_0xd42d('0xa1')]]['dialAnswer']){logger['info'](_0xd42d('0x134'),_0x32facb['linkedid'],_0x32facb[_0xd42d('0x132')],_0xd42d('0x92'),_0x3563f0['name'],_0xd42d('0xa0'),_0x3563f0['pTalking']);this[_0xd42d('0x133')](_0x32facb,_0x32facb[_0xd42d('0xa1')],_0x32facb[_0xd42d('0x132')]);}}};Preview[_0xd42d('0xd')][_0xd42d('0x1d')]=function(_0x553527){if(this[_0xd42d('0x13')][_0x553527[_0xd42d('0xd6')]]&&_0x553527[_0xd42d('0xd6')]!==_0x553527[_0xd42d('0x137')]){this[_0xd42d('0x133')](_0x553527,_0x553527[_0xd42d('0xd6')],_0x553527[_0xd42d('0xcd')]);}};Preview[_0xd42d('0xd')]['syncHangupRequest']=function(_0xb2aeb9){if(this[_0xd42d('0x13')][_0xb2aeb9[_0xd42d('0xa1')]]&&_0xb2aeb9[_0xd42d('0xa1')]!==_0xb2aeb9[_0xd42d('0x91')]&&!this[_0xd42d('0x13')][_0xb2aeb9['linkedid']]['dialAnswer']){if(_0xb2aeb9[_0xd42d('0x132')]==='1'){this[_0xd42d('0x133')](_0xb2aeb9,_0xb2aeb9[_0xd42d('0xa1')],_0xb2aeb9[_0xd42d('0x132')]);}}};Preview[_0xd42d('0xd')][_0xd42d('0x138')]=function(_0x27390a,_0x5cb373,_0x556493){if(this[_0xd42d('0x13')][_0x27390a]){if(_[_0xd42d('0x5b')](this[_0xd42d('0x13')][_0x27390a][_0xd42d('0x125')])){this[_0xd42d('0x13')][_0x27390a]['variables']={};}this['actions'][_0x27390a][_0xd42d('0x125')][_0x5cb373]=_0x556493;}};Preview[_0xd42d('0xd')][_0xd42d('0x21')]=function(_0x391a38){try{if(!_['isNil'](_0x391a38)){if(ut[_0xd42d('0x139')](_[_0xd42d('0x13a')](_0x391a38[_0xd42d('0x13b')])[0x0])){this[_0xd42d('0x138')](_0x391a38[_0xd42d('0x91')],_[_0xd42d('0x13a')](_0x391a38[_0xd42d('0x13b')])[0x0],_0x391a38[_0xd42d('0x13c')]);}}}catch(_0x23a4b9){logger[_0xd42d('0x13d')](_0xd42d('0x13e'),util['inspect'](_0x23a4b9,{'showHidden':![],'depth':null}));}};Preview[_0xd42d('0xd')]['syncAttendedTransfer']=function(_0x5cfe11){if(_0x5cfe11){if(this[_0xd42d('0x13')][_0x5cfe11[_0xd42d('0x13f')]]){this[_0xd42d('0x13')][_0x5cfe11[_0xd42d('0x13f')]]['transfer']=!![];}}};Preview[_0xd42d('0xd')]['syncBlindTransfer']=function(_0x465c3f){if(_0x465c3f){if(this[_0xd42d('0x13')][_0x465c3f[_0xd42d('0x140')]]){this['actions'][_0x465c3f[_0xd42d('0x140')]][_0xd42d('0x136')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x1aae=['dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','outboundCongestionCallsDay','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','originated:\x20','destlinkedid','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','createAgentHistory','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','isValid','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','actionid','logLookAgent','clone','responsetime','unlockContact','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','defaults','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','available','paused','message','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','\x20is\x20deactivated','prototype','hasOwnProperty','dialMethod','preview','booked','outbound','clearZombieChannels','type','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','isNil','actions','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','Action','status','channel','catch','decrementOriginate','[clearZombieChannel]','dialAnswer','decrementTalking','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','length','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x1aae,0x1dc));var _0xe1aa=function(_0x1b568b,_0x116780){_0x1b568b=_0x1b568b-0x0;var _0x33d4cb=_0x1aae[_0x1b568b];return _0x33d4cb;};'use strict';var util=require(_0xe1aa('0x0'));var _=require(_0xe1aa('0x1'));var uuid=require(_0xe1aa('0x2'));var moment=require(_0xe1aa('0x3'));var Redis=require(_0xe1aa('0x4'));var config=require('../../../config/environment');var logger=require(_0xe1aa('0x5'))('preview');var loggerAction=require(_0xe1aa('0x5'))(_0xe1aa('0x6'));var ami=require(_0xe1aa('0x7'));var rpcDb=require(_0xe1aa('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xe1aa('0x9'));var ut=require(_0xe1aa('0xa'));var utils=require(_0xe1aa('0xb'));config['redis']=_[_0xe1aa('0xc')](config[_0xe1aa('0xd')],{'host':_0xe1aa('0xe'),'port':0x18eb});var io=require(_0xe1aa('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x19d35d){this[_0xe1aa('0x10')]=this['tail']?this['tail'][_0xe1aa('0x11')](_0x19d35d):_0x19d35d();};function Preview(_0x3e5a86){this['sequence']=new Sequence();this[_0xe1aa('0x12')]=_0x3e5a86[_0xe1aa('0x13')];this['trunks']=_0x3e5a86[_0xe1aa('0x14')];this['actions']={};this[_0xe1aa('0x15')]=_0x3e5a86['agents'];this[_0xe1aa('0x16')]=0x0;ami['on'](_0xe1aa('0x17'),this['syncOriginateResponse'][_0xe1aa('0x18')](this));ami['on'](_0xe1aa('0x19'),this['syncHangup'][_0xe1aa('0x18')](this));ami['on']('hanguprequest',this[_0xe1aa('0x1a')]['bind'](this));ami['on'](_0xe1aa('0x1b'),this[_0xe1aa('0x1c')][_0xe1aa('0x18')](this));ami['on'](_0xe1aa('0x1d'),this[_0xe1aa('0x1e')]['bind'](this));ami['on'](_0xe1aa('0x1f'),this[_0xe1aa('0x20')][_0xe1aa('0x18')](this));ami['on'](_0xe1aa('0x21'),this[_0xe1aa('0x22')][_0xe1aa('0x18')](this));ami['on'](_0xe1aa('0x23'),this[_0xe1aa('0x24')][_0xe1aa('0x18')](this));this[_0xe1aa('0x25')](this[_0xe1aa('0x12')]);}function emit(_0x47c2a7,_0x26a93f,_0x2c99e7){io['to'](_0x47c2a7)[_0xe1aa('0x26')](_0x26a93f,_0x2c99e7);}function emitVoiceQueueChannelRemove(_0x4d04e1){logger[_0xe1aa('0x27')](_0xe1aa('0x28'),JSON[_0xe1aa('0x29')](_0x4d04e1));emit(util['format'](_0xe1aa('0x2a'),_0x4d04e1['name']),_0xe1aa('0x2b'),_0x4d04e1);io['emit'](_0xe1aa('0x2c'),_0x4d04e1);}function notSendMessagesQueue(_0x24b64f){if(_0x24b64f['sendMessageOneNotActive']){if(_0x24b64f[_0xe1aa('0x2d')]===0x0&&_0x24b64f[_0xe1aa('0x2e')]===0x0){_0x24b64f['sendMessageOneNotActive']=![];_0x24b64f[_0xe1aa('0x2f')]=0x0;_0x24b64f[_0xe1aa('0x30')]=0x0;_0x24b64f[_0xe1aa('0x31')]=utils['CAMPAIGN_STATUS'][_0xe1aa('0x32')];ut[_0xe1aa('0x33')](_0xe1aa('0x34'),_0x24b64f[_0xe1aa('0x35')]+_0xe1aa('0x36'));}else{_0x24b64f[_0xe1aa('0x31')]=utils[_0xe1aa('0x37')][_0xe1aa('0x38')];ut[_0xe1aa('0x33')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x24b64f[_0xe1aa('0x35')]+_0xe1aa('0x39'));}}}Preview['prototype'][_0xe1aa('0x25')]=function(){var _0xbae155=this;setInterval(function(){_0xbae155['syncCampaigns']();},0x7cf);};Preview[_0xe1aa('0x3a')]['syncCampaigns']=function(){var _0x468648=this[_0xe1aa('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x3e311a in _0x468648){if(_0x468648[_0xe1aa('0x3b')](_0x3e311a)&&(_0x468648[_0x3e311a][_0xe1aa('0x3c')]===_0xe1aa('0x3d')||_0x468648[_0x3e311a][_0xe1aa('0x3c')]===_0xe1aa('0x3e'))&&_0x468648[_0x3e311a]['type']===_0xe1aa('0x3f')){if(this['clockClearZombieChannels']>0x7){this[_0xe1aa('0x16')]=0x0;this[_0xe1aa('0x40')]();}}if(_0x468648[_0xe1aa('0x3b')](_0x3e311a)&&_0x468648[_0x3e311a][_0xe1aa('0x3c')]===_0xe1aa('0x3d')&&_0x468648[_0x3e311a][_0xe1aa('0x41')]===_0xe1aa('0x3f')){if(_0x468648[_0x3e311a][_0xe1aa('0x42')]){this[_0xe1aa('0x43')](_0x468648[_0x3e311a]);if(_0x468648[_0x3e311a][_0xe1aa('0x44')])this[_0xe1aa('0x45')](_0x468648[_0x3e311a]);}else{notSendMessagesQueue(_0x468648[_0x3e311a]);}}}};Preview['prototype'][_0xe1aa('0x46')]=function(_0x169c36){var _0x35051c=this;this['sequence'][_0xe1aa('0x47')](function(){if(!_[_0xe1aa('0x48')](_0x35051c[_0xe1aa('0x49')][_0x169c36])){loggerAction[_0xe1aa('0x27')](_0xe1aa('0x4a'),_0x169c36,_0xe1aa('0x4b'),_0x35051c['actions'][_0x169c36]['queue'],'originated:\x20',JSON[_0xe1aa('0x29')](_0x35051c['campaignsPreview'][_0x35051c[_0xe1aa('0x49')][_0x169c36][_0xe1aa('0x4c')]][_0xe1aa('0x2d')]),_0xe1aa('0x4d'),JSON[_0xe1aa('0x29')](_0x35051c[_0xe1aa('0x12')][_0x35051c[_0xe1aa('0x49')][_0x169c36][_0xe1aa('0x4c')]][_0xe1aa('0x2e')]),JSON[_0xe1aa('0x29')](_0x35051c['actions'][_0x169c36]['dialAnswer']),JSON[_0xe1aa('0x29')](_[_0xe1aa('0x4e')](_0x35051c[_0xe1aa('0x49')][_0x169c36],[_0xe1aa('0x4f'),_0xe1aa('0x50'),_0xe1aa('0x51'),'ListId'])));return ami[_0xe1aa('0x52')]({'action':_0xe1aa('0x53'),'channel':_0x35051c['actions'][_0x169c36][_0xe1aa('0x54')]})[_0xe1aa('0x55')](function(_0x1a51d4){if(_0x1a51d4['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x35051c[_0xe1aa('0x49')][_0x169c36]){utils[_0xe1aa('0x56')](_0x35051c[_0xe1aa('0x12')][_0x35051c[_0xe1aa('0x49')][_0x169c36][_0xe1aa('0x4c')]],_0xe1aa('0x57'));if(_0x35051c[_0xe1aa('0x49')][_0x169c36][_0xe1aa('0x58')]===!![]){ut[_0xe1aa('0x59')](_0x35051c['campaignsPreview'][_0x35051c[_0xe1aa('0x49')][_0x169c36]['queue']],_0xe1aa('0x57'));ut[_0xe1aa('0x5a')]('[Dialer][checkChannel][pTalking][Preview]'+_0x169c36,_0x35051c[_0xe1aa('0x49')][_0x169c36][_0xe1aa('0x4c')]);}ut[_0xe1aa('0x5a')](_0xe1aa('0x5b')+_0x169c36,_0x35051c[_0xe1aa('0x49')][_0x169c36][_0xe1aa('0x4c')]);delete _0x35051c['actions'][_0x169c36];}},0x2328);}});}});};Preview[_0xe1aa('0x3a')][_0xe1aa('0x40')]=function(){var _0x22cf2b=this;loggerAction['info'](_0xe1aa('0x5c'),_['size'](this[_0xe1aa('0x49')]));for(var _0x2104b6 in this[_0xe1aa('0x49')]){if(_0x22cf2b[_0xe1aa('0x49')]['hasOwnProperty'](_0x2104b6)){_0x22cf2b[_0xe1aa('0x46')](_0x2104b6);}}};Preview[_0xe1aa('0x3a')]['recallMe']=function(_0x471a69){var _0x4e5a1f=this;rpcDb[_0xe1aa('0x5d')](_0x471a69['id'],ut[_0xe1aa('0x5e')](this[_0xe1aa('0x15')]))[_0xe1aa('0x5f')](function(_0x450b48){if(!_[_0xe1aa('0x48')](_0x450b48)){for(var _0x3360f3=0x0;_0x3360f3<_0x450b48[_0xe1aa('0x60')];_0x3360f3+=0x1){if(ut['getDiff'](_0x450b48[_0x3360f3]['scheduledat'])<_0x471a69[_0xe1aa('0x61')]*0x3c){if(_0x450b48[_0x3360f3][_0xe1aa('0x62')]&&!_0x450b48[_0x3360f3][_0xe1aa('0x62')][_0xe1aa('0x63')]){_0x4e5a1f[_0xe1aa('0x64')](_0x450b48[_0x3360f3]['id'])[_0xe1aa('0x5f')](ut[_0xe1aa('0x65')]('[RecallMe]'))[_0xe1aa('0x55')](ut['logger2'](_0xe1aa('0x66')));}else{rpcDb[_0xe1aa('0x67')](_0x450b48[_0x3360f3]['id']);}}else{var _0x31a1ec=new Action(_0x450b48[_0x3360f3],_0x471a69);_0x31a1ec[_0xe1aa('0x68')]=moment()[_0xe1aa('0x69')](_0xe1aa('0x6a'));_0x471a69['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x31a1ec,0x17,_0xe1aa('0x6b'));if(_0x471a69['dialRecallInQueue']){rpcDb[_0xe1aa('0x6c')](ut[_0xe1aa('0x6d')](_0x450b48[_0x3360f3]));rpcDb['createCustomerHistory'](_0x31a1ec,_0xe1aa('0x6e'));}else{ut[_0xe1aa('0x6f')](_0x31a1ec,0x16,_0xe1aa('0x70'));rpcDb[_0xe1aa('0x71')](_0x31a1ec,_0xe1aa('0x72'));rpcDb['createCustomerFinal'](_0x31a1ec,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xe1aa('0x65')](_0xe1aa('0x73')));};Preview[_0xe1aa('0x3a')][_0xe1aa('0x43')]=function(_0x134581){_0x134581[_0xe1aa('0x74')]=!![];if(ut[_0xe1aa('0x75')](_0x134581['loggedIn'])){_0x134581[_0xe1aa('0x31')]=utils[_0xe1aa('0x37')][_0xe1aa('0x76')];}else if(!ut[_0xe1aa('0x77')](_0x134581[_0xe1aa('0x42')])){_0x134581[_0xe1aa('0x31')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0xe1aa('0x78')](_0x134581['Trunk'])){if(!this[_0xe1aa('0x78')](_0x134581[_0xe1aa('0x79')])){_0x134581['message']=utils[_0xe1aa('0x37')][_0xe1aa('0x7a')];}else{_0x134581['message']=utils[_0xe1aa('0x37')][_0xe1aa('0x7b')];}}else{_0x134581[_0xe1aa('0x31')]=utils[_0xe1aa('0x37')]['ACTIVE'];}};Preview[_0xe1aa('0x3a')][_0xe1aa('0x7c')]=function(_0x37a29a,_0x54148e,_0x5b1089){var _0x58dcde=this;var _0x20191e=this[_0xe1aa('0x49')][_0x54148e];var _0x3fffad=this['campaignsPreview'][_0x20191e['queue']];var _0x280b22;var _0x2d73a9=![];var _0x2f28be=0x2;var _0x456035=0x3;if(_0x3fffad){switch(_0x5b1089){case'1':_0x3fffad[_0xe1aa('0x7d')]+=0x1;_0x20191e[_0xe1aa('0x7e')]+=0x1;_0x20191e[_0xe1aa('0x7f')]=ut[_0xe1aa('0x80')](_0x20191e);ut['logCustomer'](_0x20191e,0x0,_0xe1aa('0x81'));ami['emit'](_0xe1aa('0x82'),ut[_0xe1aa('0x83')](_0x20191e,_0xe1aa('0x84')));rpcDb[_0xe1aa('0x71')](_0x20191e,_0xe1aa('0x85'));_0x58dcde[_0xe1aa('0x86')](_0x20191e,'0',_0x3fffad)[_0xe1aa('0x5f')](function(_0x415d51){_0x2d73a9=_0x415d51[_0xe1aa('0x87')]==0x1;_0x2f28be=_0x3fffad[_0xe1aa('0x88')];_0x456035=_0x3fffad[_0xe1aa('0x89')];if(!_0x2d73a9){if(ut[_0xe1aa('0x80')](_0x20191e)>=_0x3fffad['dialGlobalMaxRetry']){_0x280b22=ut[_0xe1aa('0x8a')](_0x20191e,0xf,'Global');rpcDb[_0xe1aa('0x8b')](_0x280b22,_0xe1aa('0x8c'));}else{if(_0x20191e[_0xe1aa('0x7e')]>=_0x3fffad['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x20191e,_0xe1aa('0x8c'));}else{rpcDb[_0xe1aa('0x8d')](ut[_0xe1aa('0x8e')](_0x20191e,_0xe1aa('0x7e'),_0x3fffad['dialNoSuchNumberRetryFrequency']),_0x20191e[_0xe1aa('0x8f')],_0x20191e[_0xe1aa('0x90')]);}}delete this['actions'][_0x37a29a[_0xe1aa('0x91')]];}else{_0x20191e[_0xe1aa('0x7e')]++;logger[_0xe1aa('0x27')](_0xe1aa('0x92'),_0x20191e[_0xe1aa('0x7e')]);logger[_0xe1aa('0x27')]('id',_0x20191e[_0xe1aa('0x93')]);_0x58dcde[_0xe1aa('0x94')]({'id':_0x20191e[_0xe1aa('0x93')],'field':{'countnosuchnumberretry':_0x20191e[_0xe1aa('0x7e')]}})[_0xe1aa('0x5f')](function(){_0x58dcde[_0xe1aa('0x95')](_0x20191e,_0x2f28be,_0x456035)[_0xe1aa('0x5f')](function(){});});}});break;case _0xe1aa('0x96'):var _0x3bbf50=moment()[_0xe1aa('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x20191e['responsetime']=_0x3bbf50;_0x20191e[_0xe1aa('0x97')]=_0x3bbf50;_0x20191e[_0xe1aa('0x58')]=!![];_0x3fffad[_0xe1aa('0x2e')]+=0x1;logger[_0xe1aa('0x27')](_0xe1aa('0x98'),_0x20191e[_0xe1aa('0x99')],_0xe1aa('0x9a'),_0x3fffad[_0xe1aa('0x35')],_0xe1aa('0x4d'),_0x3fffad[_0xe1aa('0x2e')]);ami[_0xe1aa('0x26')](_0xe1aa('0x9b'),ut['buildObj'](_0x20191e,_0xe1aa('0x9c'),this[_0xe1aa('0x12')][_0x20191e[_0xe1aa('0x4c')]]));if(_0x3fffad[_0xe1aa('0x9d')]||_0x3fffad['mandatoryDisposition']){ami[_0xe1aa('0x26')](_0xe1aa('0x9e'),{'queue':_0x20191e[_0xe1aa('0x4c')],'interface':_0x20191e[_0xe1aa('0x9f')],'uniqueid':_0x20191e['uniqueid']});}break;case'16':ami[_0xe1aa('0x26')](_0xe1aa('0xa0'),ut[_0xe1aa('0x83')](_0x20191e,_0xe1aa('0xa1'),this[_0xe1aa('0x12')][_0x20191e[_0xe1aa('0x4c')]]));emitVoiceQueueChannelRemove(ut[_0xe1aa('0x83')](_0x20191e,_0xe1aa('0xa1')));_0x3fffad[_0xe1aa('0xa2')]+=0x1;_0x3fffad[_0xe1aa('0xa3')]+=0x1;_0x3fffad[_0xe1aa('0xa4')]+=0x1;ut[_0xe1aa('0x59')](_0x3fffad,_0xe1aa('0xa5'));_0x20191e[_0xe1aa('0x7f')]=ut['totalGlobal'](_0x20191e);ut['logCustomer'](_0x20191e,0x4,'Answer');rpcDb[_0xe1aa('0x71')](_0x20191e,_0xe1aa('0xa6'));rpcDb[_0xe1aa('0x8b')](_0x20191e,_0xe1aa('0xa7'));rpcDb[_0xe1aa('0xa8')](_0x20191e);_0x3fffad[_0xe1aa('0xa9')]+=_0x20191e[_0xe1aa('0xaa')];_0x3fffad[_0xe1aa('0xab')]+=_0x20191e[_0xe1aa('0xaa')];logger[_0xe1aa('0x27')](_0xe1aa('0xac'),_0x20191e[_0xe1aa('0x99')],'\x20Queue',_0x3fffad[_0xe1aa('0x35')],_0xe1aa('0x4d'),_0x3fffad[_0xe1aa('0x2e')]);delete this[_0xe1aa('0x49')][_0x37a29a[_0xe1aa('0x91')]];break;case _0xe1aa('0xad'):_0x3fffad['outboundBusyCallsDay']+=0x1;_0x20191e[_0xe1aa('0xae')]+=0x1;_0x20191e[_0xe1aa('0x7f')]=ut[_0xe1aa('0x80')](_0x20191e);ut[_0xe1aa('0x6f')](_0x20191e,0x5,'Busy');_0x2f28be=_0x3fffad['dialBusyRetryFrequency'];_0x456035=_0x3fffad[_0xe1aa('0x89')];ami[_0xe1aa('0x26')](_0xe1aa('0xaf'),ut['buildObj'](_0x20191e,_0xe1aa('0xb0')));rpcDb['createCustomerHistory'](_0x20191e,_0xe1aa('0xb1'));_0x58dcde[_0xe1aa('0x86')](_0x20191e,'5',_0x3fffad)[_0xe1aa('0x5f')](function(_0x3f9df0){_0x2d73a9=_0x3f9df0[_0xe1aa('0x87')]==0x1;if(!_0x2d73a9){if(ut[_0xe1aa('0x80')](_0x20191e)>=_0x3fffad['dialGlobalMaxRetry']){_0x280b22=ut[_0xe1aa('0x8a')](_0x20191e,0xf,_0xe1aa('0xb2'));rpcDb[_0xe1aa('0x8b')](_0x280b22,_0xe1aa('0xb3'));}else{if(_0x20191e[_0xe1aa('0xae')]>=_0x3fffad[_0xe1aa('0xb4')]){rpcDb['createCustomerFinal'](_0x20191e,_0xe1aa('0xb1'));}else{rpcDb[_0xe1aa('0x8d')](ut[_0xe1aa('0x8e')](_0x20191e,'countbusyretry',_0x3fffad[_0xe1aa('0xb5')]),_0x20191e[_0xe1aa('0x8f')],_0x20191e['activeContact']);}}}else{_0x20191e[_0xe1aa('0xae')]++;_0x58dcde['incrementPreviewCounters']({'id':_0x20191e[_0xe1aa('0x93')],'field':{'countbusyretry':_0x20191e[_0xe1aa('0xae')]}})[_0xe1aa('0x5f')](function(){_0x58dcde['swapAdditionalPhones'](_0x20191e,_0x2f28be,_0x456035)[_0xe1aa('0x5f')](function(){});});}});break;case _0xe1aa('0xb6'):_0x3fffad['outboundNoAnswerCallsDay']+=0x1;_0x20191e['countnoanswerretry']+=0x1;_0x20191e[_0xe1aa('0x7f')]=ut[_0xe1aa('0x80')](_0x20191e);ut[_0xe1aa('0x6f')](_0x20191e,0x3,'NoAnswer');_0x2f28be=_0x3fffad[_0xe1aa('0xb7')];_0x456035=_0x3fffad['callAdditionalPhoneAfterMin'];var _0x517581=ut[_0xe1aa('0xb8')](_0x20191e,_0x3fffad);ami[_0xe1aa('0x26')]('custom:agentnoanswer',_0x517581);rpcDb[_0xe1aa('0x71')](_0x20191e,_0xe1aa('0xb9'));_0x58dcde[_0xe1aa('0x86')](_0x20191e,'3',_0x3fffad)[_0xe1aa('0x5f')](function(_0x40856f){_0x2d73a9=_0x40856f['additional']==0x1;if(!_0x2d73a9){if(ut[_0xe1aa('0x80')](_0x20191e)>=_0x3fffad[_0xe1aa('0xba')]){_0x280b22=ut[_0xe1aa('0x8a')](_0x20191e,0xf,'Global');rpcDb[_0xe1aa('0x8b')](_0x280b22,_0xe1aa('0xbb'));}else{if(_0x20191e['countnoanswerretry']>=_0x3fffad['dialNoAnswerMaxRetry']){rpcDb[_0xe1aa('0x8b')](_0x20191e,_0xe1aa('0xb9'));}else{rpcDb[_0xe1aa('0x8d')](ut[_0xe1aa('0x8e')](_0x20191e,_0xe1aa('0xbc'),_0x3fffad[_0xe1aa('0xb7')]),_0x20191e[_0xe1aa('0x8f')],_0x20191e[_0xe1aa('0x90')]);}}}else{_0x20191e['countnoanswerretry']++;_0x58dcde[_0xe1aa('0x94')]({'id':_0x20191e[_0xe1aa('0x93')],'field':{'countnoanswerretry':_0x20191e[_0xe1aa('0xbc')]}})[_0xe1aa('0x5f')](function(){_0x58dcde[_0xe1aa('0x95')](_0x20191e,_0x2f28be,_0x456035)[_0xe1aa('0x5f')](function(){});});}});break;case'CONGESTION':_0x3fffad[_0xe1aa('0xbd')]+=0x1;_0x20191e['countcongestionretry']+=0x1;_0x20191e[_0xe1aa('0x7f')]=ut[_0xe1aa('0x80')](_0x20191e);ut[_0xe1aa('0x6f')](_0x20191e,0x8,'Congestion');_0x2f28be=_0x3fffad[_0xe1aa('0xbe')];_0x456035=_0x3fffad[_0xe1aa('0x89')];ami['emit'](_0xe1aa('0xbf'),ut[_0xe1aa('0x83')](_0x20191e,'congestion'));rpcDb['createCustomerHistory'](_0x20191e,_0xe1aa('0xc0'));_0x58dcde['verifyAdditionalPhones'](_0x20191e,'8',_0x3fffad)['then'](function(_0x117dfb){_0x2d73a9=_0x117dfb[_0xe1aa('0x87')]==0x1;if(!_0x2d73a9){if(ut['totalGlobal'](_0x20191e)>=_0x3fffad['dialGlobalMaxRetry']){_0x280b22=ut[_0xe1aa('0x8a')](_0x20191e,0xf,_0xe1aa('0xb2'));rpcDb['createCustomerFinal'](_0x280b22,_0xe1aa('0xc1'));}else{if(_0x20191e[_0xe1aa('0xc2')]>=_0x3fffad[_0xe1aa('0xc3')]){rpcDb[_0xe1aa('0x8b')](_0x20191e,_0xe1aa('0xc0'));}else{rpcDb[_0xe1aa('0x8d')](ut[_0xe1aa('0x8e')](_0x20191e,_0xe1aa('0xc2'),_0x3fffad[_0xe1aa('0xb5')]),_0x20191e[_0xe1aa('0x8f')],_0x20191e[_0xe1aa('0x90')]);}}}else{_0x20191e[_0xe1aa('0xc2')]++;_0x58dcde[_0xe1aa('0x94')]({'id':_0x20191e[_0xe1aa('0x93')],'field':{'countcongestionretry':_0x20191e['countcongestionretry']}})[_0xe1aa('0x5f')](function(){_0x58dcde[_0xe1aa('0x95')](_0x20191e,_0x2f28be,_0x456035)[_0xe1aa('0x5f')](function(){});});}});break;case _0xe1aa('0xc4'):_0x3fffad[_0xe1aa('0xc5')]+=0x1;_0x20191e['countagentrejectretry']+=0x1;_0x20191e[_0xe1aa('0x7f')]=ut[_0xe1aa('0x80')](_0x20191e);ut[_0xe1aa('0x6f')](_0x20191e,0x14,'AgentReject');_0x2f28be=_0x3fffad[_0xe1aa('0xc6')];_0x456035=_0x3fffad[_0xe1aa('0x89')];ami['emit'](_0xe1aa('0xc7'),ut[_0xe1aa('0x83')](_0x20191e,_0xe1aa('0xc8')));rpcDb[_0xe1aa('0x71')](_0x20191e,_0xe1aa('0xc9'));_0x58dcde['verifyAdditionalPhones'](_0x20191e,'20',_0x3fffad)[_0xe1aa('0x5f')](function(_0x30845a){_0x2d73a9=_0x30845a[_0xe1aa('0x87')]==0x1;if(!_0x2d73a9){if(ut[_0xe1aa('0x80')](_0x20191e)>=_0x3fffad['dialGlobalMaxRetry']){_0x280b22=ut[_0xe1aa('0x8a')](_0x20191e,0x14,_0xe1aa('0xca'));rpcDb['createCustomerFinal'](_0x280b22,_0xe1aa('0xcb'));}else{if(_0x20191e[_0xe1aa('0xcc')]>=_0x3fffad[_0xe1aa('0xcd')]){rpcDb[_0xe1aa('0x8b')](_0x20191e,_0xe1aa('0xcb'));}else{rpcDb[_0xe1aa('0x8d')](ut[_0xe1aa('0x8e')](_0x20191e,'countagentrejectretry',_0x3fffad[_0xe1aa('0xc6')]),_0x20191e[_0xe1aa('0x8f')],_0x20191e[_0xe1aa('0x90')]);}}}else{_0x20191e[_0xe1aa('0xbc')]++;_0x58dcde[_0xe1aa('0x94')]({'id':_0x20191e['idContact'],'field':{'countnoanswerretry':_0x20191e[_0xe1aa('0xbc')]}})[_0xe1aa('0x5f')](function(){_0x58dcde[_0xe1aa('0x95')](_0x20191e,_0x2f28be,_0x456035)[_0xe1aa('0x5f')](function(){});});}});break;case _0xe1aa('0xce'):_0x3fffad['outboundAbandonedCallsDay']+=0x1;_0x20191e[_0xe1aa('0xcf')]+=0x1;_0x20191e[_0xe1aa('0x7f')]=ut['totalGlobal'](_0x20191e);ut[_0xe1aa('0x6f')](_0x20191e,0xb,_0xe1aa('0xd0'));rpcDb[_0xe1aa('0x71')](_0x20191e,_0xe1aa('0xd1'));_0x58dcde[_0xe1aa('0x86')](_0x20191e,'11',_0x3fffad)[_0xe1aa('0x5f')](function(_0x108c4d){_0x2d73a9=_0x108c4d[_0xe1aa('0x87')]==0x1;if(!_0x2d73a9){if(ut[_0xe1aa('0x80')](_0x20191e)>=_0x3fffad[_0xe1aa('0xba')]){_0x280b22=ut[_0xe1aa('0x8a')](_0x20191e,0xf,_0xe1aa('0xb2'));rpcDb[_0xe1aa('0x8b')](_0x280b22,_0xe1aa('0xd1'));}else{if(_0x20191e['countabandonedetry']>=_0x3fffad[_0xe1aa('0xd2')]){rpcDb[_0xe1aa('0x8b')](_0x20191e,_0xe1aa('0xd1'));}else{rpcDb[_0xe1aa('0x8d')](ut[_0xe1aa('0x8e')](_0x20191e,'countabandonedretry',_0x3fffad[_0xe1aa('0xd3')]),_0x20191e['unlockAgent'],_0x20191e['activeContact']);}}}else{_0x20191e[_0xe1aa('0xbc')]++;_0x58dcde[_0xe1aa('0x94')]({'id':_0x20191e[_0xe1aa('0x93')],'field':{'countnoanswerretry':_0x20191e[_0xe1aa('0xbc')]}})[_0xe1aa('0x5f')](function(){_0x58dcde[_0xe1aa('0x95')](_0x20191e,_0x2f28be,_0x456035)[_0xe1aa('0x5f')](function(){});});}});break;case'18':_0x3fffad['outboundUnknownCallsDay']+=0x1;_0x20191e[_0xe1aa('0xd4')]+=0x1;_0x20191e['countglobal']=ut[_0xe1aa('0x80')](_0x20191e);ut[_0xe1aa('0x6f')](_0x20191e,0x12,_0x37a29a[_0xe1aa('0xd5')]||_0x37a29a[_0xe1aa('0xd6')]);ami['emit'](_0xe1aa('0xd7'),ut['buildObj'](_0x20191e,_0xe1aa('0xd8')));rpcDb[_0xe1aa('0x71')](_0x20191e,_0xe1aa('0xd9'));_0x58dcde[_0xe1aa('0x86')](_0x20191e,'18',_0x3fffad)[_0xe1aa('0x5f')](function(_0x109f32){_0x2d73a9=_0x109f32['additional']==0x1;if(!_0x2d73a9){if(ut['totalGlobal'](_0x20191e)>=_0x3fffad['dialGlobalMaxRetry']){_0x280b22=ut[_0xe1aa('0x8a')](_0x20191e,0x12,_0xe1aa('0xb2'));rpcDb[_0xe1aa('0x8b')](_0x280b22,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xe1aa('0x8b')](_0x20191e,_0xe1aa('0xd9'));}}else{_0x20191e[_0xe1aa('0xbc')]++;_0x58dcde[_0xe1aa('0x94')]({'id':_0x20191e[_0xe1aa('0x93')],'field':{'countnoanswerretry':_0x20191e[_0xe1aa('0xbc')]}})['then'](function(){_0x58dcde['swapAdditionalPhones'](_0x20191e,_0x2f28be,_0x456035)[_0xe1aa('0x5f')](function(){});});}});delete this[_0xe1aa('0x49')][_0x37a29a['linkedid']];break;case'19':_0x3fffad[_0xe1aa('0xda')]+=0x1;_0x20191e[_0xe1aa('0x7f')]=ut['totalGlobal'](_0x20191e);ut['logCustomer'](_0x20191e,0x13,_0x37a29a[_0xe1aa('0xd5')]||_0x37a29a[_0xe1aa('0xd6')]);ami[_0xe1aa('0x26')](_0xe1aa('0xd7'),ut[_0xe1aa('0x83')](_0x20191e,_0xe1aa('0xd8')));rpcDb[_0xe1aa('0x71')](_0x20191e,_0xe1aa('0xdb'));_0x58dcde[_0xe1aa('0x86')](_0x20191e,'18',_0x3fffad)[_0xe1aa('0x5f')](function(_0x34781b){_0x2d73a9=_0x34781b[_0xe1aa('0x87')]==0x1;if(!_0x2d73a9){if(ut[_0xe1aa('0x80')](_0x20191e)>=_0x3fffad[_0xe1aa('0xba')]){_0x280b22=ut[_0xe1aa('0x8a')](_0x20191e,0xf,_0xe1aa('0xb2'));rpcDb[_0xe1aa('0x8b')](_0x280b22,_0xe1aa('0xdb'));}else{rpcDb[_0xe1aa('0x8b')](_0x20191e,_0xe1aa('0xdb'));}}else{_0x20191e[_0xe1aa('0xbc')]++;_0x58dcde[_0xe1aa('0x94')]({'id':_0x20191e[_0xe1aa('0x93')],'field':{'countnoanswerretry':_0x20191e[_0xe1aa('0xbc')]}})['then'](function(){_0x58dcde['swapAdditionalPhones'](_0x20191e,_0x2f28be,_0x456035)['then'](function(){});});}});delete this[_0xe1aa('0x49')][_0x37a29a[_0xe1aa('0x91')]];break;default:if(_0x20191e['dialAnswer']){ut[_0xe1aa('0x59')](_0x3fffad,_0xe1aa('0xdc'));ut[_0xe1aa('0x5a')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0x3fffad[_0xe1aa('0x35')],_0x37a29a);}_0x3fffad[_0xe1aa('0xda')]+=0x1;_0x20191e[_0xe1aa('0x7f')]=ut[_0xe1aa('0x80')](_0x20191e);ut[_0xe1aa('0x6f')](_0x20191e,0xc,_0x37a29a['cause-txt']||_0x37a29a['dialstatus']);_0x2f28be=_0x3fffad[_0xe1aa('0xc6')];_0x456035=_0x3fffad[_0xe1aa('0x89')];rpcDb[_0xe1aa('0x71')](_0x20191e,_0xe1aa('0xdd'));_0x58dcde[_0xe1aa('0x86')](_0x20191e,'20',_0x3fffad)[_0xe1aa('0x5f')](function(_0x3cb72a){_0x2d73a9=_0x3cb72a['additional']==0x1;if(!_0x2d73a9){if(ut[_0xe1aa('0x80')](_0x20191e)>=_0x3fffad[_0xe1aa('0xba')]){_0x280b22=ut[_0xe1aa('0x8a')](_0x20191e,0xf,_0xe1aa('0xb2'));rpcDb[_0xe1aa('0x8b')](_0x280b22,_0xe1aa('0xde'));}else{rpcDb['createCustomerFinal'](_0x20191e,_0xe1aa('0xde'));}delete this[_0xe1aa('0x49')][_0x37a29a[_0xe1aa('0x91')]];}else{_0x58dcde[_0xe1aa('0x95')](_0x20191e,_0x2f28be,_0x456035)['then'](function(){});}});}if(!(_0x20191e[_0xe1aa('0x58')]&&_0x5b1089==='16')){utils[_0xe1aa('0x56')](_0x3fffad,'[callProgressDetectingCustomer]');logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x20191e[_0xe1aa('0x99')],_0xe1aa('0x9a'),_0x3fffad[_0xe1aa('0x35')],_0xe1aa('0xdf'),_0x3fffad['originated']);}if(_0x5b1089!==_0xe1aa('0x96')){delete this[_0xe1aa('0x49')][_0x37a29a['linkedid']];delete this[_0xe1aa('0x49')][_0x37a29a[_0xe1aa('0xe0')]];}_0x3fffad[_0xe1aa('0xe1')]=!![];}};Preview[_0xe1aa('0x3a')]['callProgressDetectingAgent']=function(_0x2bbd00,_0x4bf31c,_0x31f613){if(_[_0xe1aa('0xe2')](_0x4bf31c)&&_0xe1aa('0xe3')!==typeof _0x4bf31c){return;}if(_[_0xe1aa('0xe2')](_0x31f613)&&'object'!==typeof _0x31f613){return;}switch(_0x31f613[_0xe1aa('0xe4')]){case'0':ut[_0xe1aa('0xe5')](_0x2bbd00,0x0,'NoSuchNumber');rpcDb[_0xe1aa('0xe6')](_0x2bbd00,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xe1aa('0xe5')](_0x2bbd00,0x3,_0xe1aa('0xe7'));rpcDb[_0xe1aa('0xe6')](_0x2bbd00,_0xe1aa('0xe8'));break;case'5':ut[_0xe1aa('0xe5')](_0x2bbd00,0x5,_0xe1aa('0xe9'));rpcDb[_0xe1aa('0xe6')](_0x2bbd00,_0xe1aa('0xea'));break;case'8':ut[_0xe1aa('0xe5')](_0x2bbd00,0x8,_0xe1aa('0xeb'));rpcDb[_0xe1aa('0xe6')](_0x2bbd00,_0xe1aa('0xec'));break;case'22':ut[_0xe1aa('0xe5')](_0x2bbd00,0x16,'AnswerAGI');rpcDb[_0xe1aa('0xe6')](_0x2bbd00,_0xe1aa('0xed'));break;default:ut[_0xe1aa('0xe5')](_0x2bbd00,0xc,_0x31f613[_0xe1aa('0xe4')]);rpcDb['createAgentHistory'](_0x2bbd00,_0xe1aa('0xec'));}utils['decrementOriginate'](_0x4bf31c,_0xe1aa('0xee'));logger[_0xe1aa('0x27')](_0xe1aa('0xef'),_0x2bbd00[_0xe1aa('0x99')],_0xe1aa('0x9a'),_0x4bf31c[_0xe1aa('0x35')],_0xe1aa('0xdf'),_0x4bf31c[_0xe1aa('0x2d')]);delete this['actions'][_0x2bbd00[_0xe1aa('0x99')]];};Preview[_0xe1aa('0x3a')][_0xe1aa('0x86')]=function(_0x43d640,_0x4a6b3d,_0x1786eb){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x43d640,_0x4a6b3d,_0x1786eb)[_0xe1aa('0x55')](logger[_0xe1aa('0x27')]('[verifyAdditionalPhone]\x20'));};Preview['prototype'][_0xe1aa('0x95')]=function(_0x33c9b9,_0x8c236b,_0x15bdab){return cmHopperAdditionalPhone[_0xe1aa('0x95')](_0x33c9b9,_0x8c236b,_0x15bdab)['catch'](logger[_0xe1aa('0x27')]('[swapAdditionalPhone]\x20'));};Preview[_0xe1aa('0x3a')][_0xe1aa('0x94')]=function(_0x46294a){return Promise[_0xe1aa('0xf0')]()[_0xe1aa('0x5f')](cmHopperAdditionalPhone[_0xe1aa('0x94')](_0x46294a))[_0xe1aa('0x55')](logger[_0xe1aa('0x27')](_0xe1aa('0xf1')));};Preview[_0xe1aa('0x3a')][_0xe1aa('0xf2')]=function(_0x1c5dba,_0x5170a9,_0x1898f7,_0x56f07e,_0x8f7081){var _0x5cbc7f=this;return new Promise(function(_0x53b324,_0x5ad099){if(_[_0xe1aa('0x48')](_0x5170a9)||_[_0xe1aa('0x48')](_0x5170a9[_0xe1aa('0xf3')])||_[_0xe1aa('0x48')](_0x5170a9[_0xe1aa('0xf4')])||_['isNil'](_0x5170a9[_0xe1aa('0x51')])){_0x5ad099(ut['message'](_0xe1aa('0xf5'),_0x56f07e,_0x8f7081));return;}var _0x10e867=uuid['v4']();var _0x41e1bc=_0x5cbc7f[_0xe1aa('0x12')][_0x5170a9[_0xe1aa('0x4b')]['name']];var _0x26aec5=_0x1898f7?_0x5cbc7f[_0xe1aa('0x15')][_0x1898f7]['id']:undefined;_0x5cbc7f['actions'][_0x10e867]=new Action(_0x5170a9,_0x41e1bc,_0x10e867,_0x1898f7,_0x26aec5);var _0xe440f=_0x5cbc7f['actions'][_0x10e867];_0xe440f[_0xe1aa('0x8f')]=_0x56f07e;_0xe440f[_0xe1aa('0x90')]=_0x8f7081;_0xe440f[_0xe1aa('0xf6')]=_0x1898f7;if(_[_0xe1aa('0xf7')](_0x1c5dba)){_0x5cbc7f[_0xe1aa('0xf8')](_0xe440f,_0x41e1bc,_0x5170a9,_0x1898f7)[_0xe1aa('0x5f')](function(_0x1ab5b8){logger['info'](_0xe1aa('0xf9'),_0xe1aa('0xfa')+_0xe440f[_0xe1aa('0x4c')]+_0xe1aa('0xfb')+_0xe440f[_0xe1aa('0x93')],JSON[_0xe1aa('0x29')](_0x1ab5b8));ami['emit'](_0xe1aa('0xfc'),ut[_0xe1aa('0x83')](_0xe440f,_0xe1aa('0xfd'),_0x5cbc7f[_0xe1aa('0x12')][_0xe440f[_0xe1aa('0x4c')]]));_0x53b324(ut[_0xe1aa('0x31')]('Calling'));})[_0xe1aa('0x55')](function(_0x444c85){ut[_0xe1aa('0x33')](_0xe1aa('0xfe'),_0x444c85);_0x5ad099(ut[_0xe1aa('0x31')](_0xe1aa('0xff'),_0x56f07e,_0x8f7081));});}else{_0x41e1bc[_0xe1aa('0x100')]+=0x1;ut['logBlacklist'](_0xe440f);rpcDb['createHistory'](_0xe440f,'[Blacklist][error]');delete _0x5cbc7f[_0xe1aa('0x49')][_0x10e867];_0x5ad099(ut[_0xe1aa('0x31')](_0xe1aa('0x101'),_0x56f07e,_0x8f7081));}});};Preview[_0xe1aa('0x3a')][_0xe1aa('0x78')]=function(_0x30655b){return!_[_0xe1aa('0x48')](_0x30655b)&&!_[_0xe1aa('0x48')](_0x30655b[_0xe1aa('0x35')])&&!_[_0xe1aa('0x48')](_0x30655b[_0xe1aa('0x102')])&&_0x30655b[_0xe1aa('0x102')]&&!_[_0xe1aa('0x48')](this[_0xe1aa('0x14')][util[_0xe1aa('0x69')](_0xe1aa('0x103'),_0x30655b[_0xe1aa('0x35')])])&&!_[_0xe1aa('0x48')](this['trunks'][util['format'](_0xe1aa('0x103'),_0x30655b['name'])][_0xe1aa('0x53')])&&(this[_0xe1aa('0x14')][util[_0xe1aa('0x69')](_0xe1aa('0x103'),_0x30655b['name'])][_0xe1aa('0x53')]===_0xe1aa('0x104')||this[_0xe1aa('0x14')][util[_0xe1aa('0x69')](_0xe1aa('0x103'),_0x30655b[_0xe1aa('0x35')])][_0xe1aa('0x53')]===_0xe1aa('0x105'));};Preview[_0xe1aa('0x3a')][_0xe1aa('0x64')]=function(_0x29d799,_0x24efbe){return this[_0xe1aa('0x106')](_0x29d799,_0x24efbe)[_0xe1aa('0x5f')](function(_0x5c28c4){return _['pick'](_0x5c28c4,[_0xe1aa('0x31')]);})[_0xe1aa('0x55')](function(_0x10e0e2){if(_0x10e0e2[_0xe1aa('0x107')]){rpcDb['unlockContact'](_0x29d799);}if(_0x10e0e2[_0xe1aa('0x102')]){rpcDb[_0xe1aa('0x67')](_0x29d799);}throw _[_0xe1aa('0x4e')](_0x10e0e2,[_0xe1aa('0x31')]);});};Preview['prototype']['execRun']=function(_0x3c2c9c,_0x132cbb){var _0x345652=this;var _0x2c345d,_0x4448d9;return rpcDb[_0xe1aa('0x108')](_0x3c2c9c)[_0xe1aa('0x5f')](function(_0x3fd99b){if(!_[_0xe1aa('0x48')](_0x3fd99b[0x0])){_0x4448d9=_0x3fd99b[0x0][_0xe1aa('0x109')]?![]:!![];_0x2c345d=_0x3fd99b[0x0]['recallme']?!![]:![];_0x2c345d=_0x132cbb?!![]:_0x2c345d;}var _0x37216e=_0x345652['validateContact'](_0x3fd99b);if(_0x37216e[_0xe1aa('0x10a')]){rpcDb['checkIsBlackList'](_[_0xe1aa('0x4e')](_0x3fd99b[0x0],[_0xe1aa('0x51'),_0xe1aa('0xf4')]))[_0xe1aa('0x5f')](function(_0x2e9896){_0x345652[_0xe1aa('0xf2')](_0x2e9896,_0x3fd99b[0x0],_0x132cbb,_0x4448d9,_0x2c345d)[_0xe1aa('0x5f')](function(_0x4d3cb4){return _0x4d3cb4;})[_0xe1aa('0x55')](function(_0x53de52){throw _0x53de52;});})[_0xe1aa('0x55')](function(_0x2b8b70){ut[_0xe1aa('0x33')]('[Preview][checkIsBlackList]',_0x2b8b70);throw ut[_0xe1aa('0x31')](_0xe1aa('0x10b'),_0x4448d9,_0x2c345d);});}else{throw ut[_0xe1aa('0x31')](_0x37216e['message'],_0x4448d9,_0x2c345d);}})[_0xe1aa('0x55')](function(_0x5ac648){ut[_0xe1aa('0x33')]('[Preview][getContactPreview]',_0x5ac648);throw ut[_0xe1aa('0x31')](_0xe1aa('0x10b'),![],!![]);});};Preview[_0xe1aa('0x3a')]['validateContact']=function(_0x51d4cb){if(_[_0xe1aa('0x48')](_0x51d4cb)||_[_0xe1aa('0xf7')](_0x51d4cb)||!_[_0xe1aa('0x48')](_0x51d4cb[0x0][_0xe1aa('0x62')])&&_[_0xe1aa('0x48')](_0x51d4cb[0x0][_0xe1aa('0x62')][_0xe1aa('0x35')])){ut[_0xe1aa('0x33')](_0xe1aa('0x10c'),_0x51d4cb);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5be0f9=this[_0xe1aa('0x12')][_0x51d4cb[0x0]['Queue']['name']];_0x5be0f9['message']=utils[_0xe1aa('0x37')][_0xe1aa('0x7b')];if(_[_0xe1aa('0x48')](_0x5be0f9)){ut[_0xe1aa('0x33')](_0xe1aa('0x10d'),_0x5be0f9);return{'isValid':![],'message':_0xe1aa('0x10e')};}if(!this[_0xe1aa('0x78')](_0x5be0f9[_0xe1aa('0x10f')])){ut['logger'](_0xe1aa('0x110'),_0xe1aa('0x111')+_0x5be0f9['name']+_0xe1aa('0x112'));if(!this[_0xe1aa('0x78')](_0x5be0f9[_0xe1aa('0x79')])){ut[_0xe1aa('0x33')](_0xe1aa('0x110'),_0x5be0f9[_0xe1aa('0x35')]+_0xe1aa('0x113'));return{'isValid':![],'message':_0xe1aa('0x114')};}}if(!ut[_0xe1aa('0x77')](_0x5be0f9[_0xe1aa('0x42')])){ut[_0xe1aa('0x33')](_0xe1aa('0x115'),_0x5be0f9[_0xe1aa('0x35')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xe1aa('0x111')+_0x5be0f9[_0xe1aa('0x35')]+_0xe1aa('0x116')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xe1aa('0x3a')][_0xe1aa('0xf8')]=function(_0x34efdc,_0x1f600e,_0x8c79d7,_0x2e76d0){var _0x598911=this;return new Promise(function(_0x1e3483,_0x154341){var _0x416b19=_0x34efdc[_0xe1aa('0x99')];var _0x191b16=_0x598911[_0xe1aa('0x78')](_0x1f600e[_0xe1aa('0x10f')])?util[_0xe1aa('0x69')]('SIP/%s/%s%s',_0x1f600e[_0xe1aa('0x10f')][_0xe1aa('0x35')],_[_0xe1aa('0x48')](_0x1f600e[_0xe1aa('0x117')])?'':_0x1f600e[_0xe1aa('0x117')][_0xe1aa('0x118')]()||'',_0x1f600e[_0xe1aa('0x119')]>0x0?_0x8c79d7[_0xe1aa('0xf4')]['substring'](_0x1f600e['dialCutDigit']):_0x8c79d7[_0xe1aa('0xf4')]):util[_0xe1aa('0x69')](_0xe1aa('0x11a'),_['isNil'](_0x1f600e[_0xe1aa('0x79')])?_0x1f600e[_0xe1aa('0x10f')]['name']:_0x1f600e[_0xe1aa('0x79')]['name'],_[_0xe1aa('0x48')](_0x1f600e['dialPrefix'])?'':_0x1f600e[_0xe1aa('0x117')][_0xe1aa('0x118')]()||'',_0x1f600e['dialCutDigit']>0x0?_0x8c79d7[_0xe1aa('0xf4')][_0xe1aa('0x11b')](_0x1f600e['dialCutDigit']):_0x8c79d7[_0xe1aa('0xf4')]);var _0x3dfecd=_0x598911[_0xe1aa('0x78')](_0x1f600e[_0xe1aa('0x10f')])?ut['getCallerId'](_0x1f600e[_0xe1aa('0x10f')][_0xe1aa('0x11c')],_0x1f600e[_0xe1aa('0x11d')],_0x1f600e[_0xe1aa('0x11e')]>0x0?ut['getCallerIdRandom'](_0x1f600e[_0xe1aa('0x11f')],_0x1f600e['dialRandomLastDigitCallerIdNumber']):_0x1f600e['dialOriginateCallerIdNumber']):ut[_0xe1aa('0x120')](_['isNil'](_0x1f600e[_0xe1aa('0x79')])?_0x1f600e['Trunk'][_0xe1aa('0x11c')]:_0x1f600e['TrunkBackup'][_0xe1aa('0x11c')],_0x1f600e[_0xe1aa('0x11d')],_0x1f600e['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x1f600e[_0xe1aa('0x11f')],_0x1f600e[_0xe1aa('0x11e')]):_0x1f600e[_0xe1aa('0x11f')]);if(_0x3dfecd){_0x34efdc[_0xe1aa('0x121')]=ut[_0xe1aa('0x122')](_0x3dfecd);_0x34efdc[_0xe1aa('0x123')]=ut[_0xe1aa('0x124')](_0x3dfecd);}var _0x2034e8=ut[_0xe1aa('0x125')](_0x1f600e,_0x8c79d7,_0x191b16,_0x3dfecd,_0x416b19,_0x34efdc);var _0x6393d=utils[_0xe1aa('0x126')](_0x8c79d7['Contact']);Object[_0xe1aa('0x127')](_0x2034e8,_0x6393d);_[_0xe1aa('0x128')](_0x34efdc,ut[_0xe1aa('0x129')](_0x2034e8));_0x34efdc[_0xe1aa('0x68')]=moment()[_0xe1aa('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f600e[_0xe1aa('0x12a')]=_0x2034e8;var _0x58e3d1=ut[_0xe1aa('0x12b')](_0x34efdc,_0x1f600e,_0x2034e8,_0x34efdc[_0xe1aa('0x90')],_0x2e76d0);return ami[_0xe1aa('0x52')](_0x58e3d1)['then'](function(_0x81a5b1){_0x1f600e['originated']+=0x1;logger[_0xe1aa('0x27')](_0xe1aa('0x12c'),_0x416b19,_0xe1aa('0x9a'),_0x1f600e[_0xe1aa('0x35')],'originated:\x20',_0x1f600e[_0xe1aa('0x2d')]);_0x1e3483(_0x81a5b1);})[_0xe1aa('0x55')](function(_0x22fcda){ut[_0xe1aa('0xe5')](_0x34efdc,0xe,_0xe1aa('0x12d'));rpcDb[_0xe1aa('0xe6')](_0x34efdc,'[originateFailure][logOriginateFailure]');_0x154341(_0x22fcda);});});};Preview[_0xe1aa('0x3a')][_0xe1aa('0x1e')]=function(_0x172593){if(this['actions'][_0x172593[_0xe1aa('0x91')]]){this['actions'][_0x172593[_0xe1aa('0x91')]][_0xe1aa('0x54')]=_0x172593[_0xe1aa('0x54')];}};Preview[_0xe1aa('0x3a')]['syncOriginateResponse']=function(_0x4ea414){var _0x571304=this;var _0x5e3168=this['actions'][_0x4ea414[_0xe1aa('0x12e')]];if(_0x5e3168){if(_0x5e3168[_0xe1aa('0xf6')]&&this[_0xe1aa('0x15')][_0x5e3168['lookAgent']]){ut[_0xe1aa('0x12f')](_0x5e3168,this[_0xe1aa('0x15')][_0x5e3168[_0xe1aa('0xf6')]][_0xe1aa('0x35')],this[_0xe1aa('0x15')][_0x5e3168[_0xe1aa('0xf6')]]['id']);}var _0x3993fd=_[_0xe1aa('0x130')](_0x5e3168);_0x3993fd[_0xe1aa('0x131')]=moment()[_0xe1aa('0x69')](_0xe1aa('0x6a'));var _0x14d144=_0x571304[_0xe1aa('0x12')][_0x5e3168[_0xe1aa('0x4c')]];if(ut['isFailure'](_0x4ea414['response'])){if(_0x5e3168[_0xe1aa('0x8f')]){rpcDb[_0xe1aa('0x132')](_0x5e3168['idContact']);}if(_0x5e3168[_0xe1aa('0x90')]){rpcDb[_0xe1aa('0x67')](_0x5e3168['idContact']);}ami[_0xe1aa('0x26')]('custom:agentringnoanswer',ut[_0xe1aa('0x83')](_0x5e3168,_0xe1aa('0x133'),this['campaignsPreview'][_0x5e3168[_0xe1aa('0x4c')]]));this[_0xe1aa('0x134')](_0x3993fd,_0x14d144,_0x4ea414);}else{_0x5e3168[_0xe1aa('0x68')]=moment()[_0xe1aa('0x69')](_0xe1aa('0x6a'));ut['logAgent'](_0x3993fd,0x4,'Answer');rpcDb[_0xe1aa('0xe6')](_0x3993fd,_0xe1aa('0x135'));}}};Preview[_0xe1aa('0x3a')]['syncHangup']=function(_0x245987){var _0x42d229=this[_0xe1aa('0x49')][_0x245987['linkedid']];var _0x1b5fd2;if(_0x42d229){_0x1b5fd2=this['campaignsPreview'][_0x42d229['queue']];logger['info']('[syncHangup][talking]',_0x245987['linkedid'],_0xe1aa('0x9a'),_0x1b5fd2['name'],_0xe1aa('0x4d'),_0x1b5fd2['pTalking']);}if(this[_0xe1aa('0x49')][_0x245987['linkedid']]&&_0x245987[_0xe1aa('0x91')]!==_0x245987[_0xe1aa('0x99')]){if(_0x245987[_0xe1aa('0x136')]==='16'&&this[_0xe1aa('0x49')][_0x245987['linkedid']][_0xe1aa('0x58')]){this['callProgressDetectingCustomer'](_0x245987,_0x245987[_0xe1aa('0x91')],_0x245987[_0xe1aa('0x136')]);}else if(this[_0xe1aa('0x49')][_0x245987[_0xe1aa('0x91')]][_0xe1aa('0x58')]){logger[_0xe1aa('0x27')](_0xe1aa('0x137'),_0x245987[_0xe1aa('0x91')],_0x245987[_0xe1aa('0x136')],_0xe1aa('0x9a'),_0x1b5fd2[_0xe1aa('0x35')],_0xe1aa('0x4d'),_0x1b5fd2['pTalking']);this[_0xe1aa('0x7c')](_0x245987,_0x245987[_0xe1aa('0x91')],_0x245987[_0xe1aa('0x136')]);}}else if(_0x42d229&&_[_0xe1aa('0x48')](_0x42d229[_0xe1aa('0x138')])&&_0x1b5fd2[_0xe1aa('0x139')]&&_0x245987[_0xe1aa('0x91')]===_0x245987[_0xe1aa('0x99')]&&_[_0xe1aa('0x48')](_0x245987[_0xe1aa('0xe4')])&&_0x245987[_0xe1aa('0x136')]==='16'&&_0x245987[_0xe1aa('0x13a')]==='6'&&_[_0xe1aa('0xe2')](_0x42d229[_0xe1aa('0x13b')])){if(_0x42d229['unlockAgent']){rpcDb[_0xe1aa('0x132')](_0x42d229[_0xe1aa('0x93')]);}if(_0x42d229[_0xe1aa('0x90')]){rpcDb[_0xe1aa('0x67')](_0x42d229[_0xe1aa('0x93')]);}_0x245987[_0xe1aa('0xe4')]='22';this[_0xe1aa('0x134')](_0x42d229,_0x1b5fd2,_0x245987);}else if(_0x42d229&&_0x42d229[_0xe1aa('0x13b')]){if(_0x245987['cause']==='16'&&this[_0xe1aa('0x49')][_0x245987[_0xe1aa('0x91')]][_0xe1aa('0x58')]){logger['info'](_0xe1aa('0x13c'),_0x245987[_0xe1aa('0x91')],_0x245987[_0xe1aa('0x136')],'\x20Queue',_0x1b5fd2[_0xe1aa('0x35')],'pTalking:\x20',_0x1b5fd2['pTalking']);this[_0xe1aa('0x7c')](_0x245987,_0x245987[_0xe1aa('0x91')],_0x245987[_0xe1aa('0x136')]);}else if(this[_0xe1aa('0x49')][_0x245987['linkedid']][_0xe1aa('0x58')]){logger[_0xe1aa('0x27')](_0xe1aa('0x137'),_0x245987[_0xe1aa('0x91')],_0x245987[_0xe1aa('0x136')],_0xe1aa('0x9a'),_0x1b5fd2['name'],'pTalking:\x20',_0x1b5fd2[_0xe1aa('0x2e')]);this['callProgressDetectingCustomer'](_0x245987,_0x245987['linkedid'],_0x245987[_0xe1aa('0x136')]);}}};Preview[_0xe1aa('0x3a')][_0xe1aa('0x1c')]=function(_0x2da75f){if(this['actions'][_0x2da75f[_0xe1aa('0xe0')]]&&_0x2da75f[_0xe1aa('0xe0')]!==_0x2da75f[_0xe1aa('0x13d')]){this['callProgressDetectingCustomer'](_0x2da75f,_0x2da75f[_0xe1aa('0xe0')],_0x2da75f[_0xe1aa('0xd6')]);}};Preview[_0xe1aa('0x3a')][_0xe1aa('0x1a')]=function(_0x11909d){if(this['actions'][_0x11909d[_0xe1aa('0x91')]]&&_0x11909d[_0xe1aa('0x91')]!==_0x11909d['uniqueid']&&!this[_0xe1aa('0x49')][_0x11909d[_0xe1aa('0x91')]][_0xe1aa('0x58')]){if(_0x11909d[_0xe1aa('0x136')]==='1'){this[_0xe1aa('0x7c')](_0x11909d,_0x11909d[_0xe1aa('0x91')],_0x11909d[_0xe1aa('0x136')]);}}};Preview[_0xe1aa('0x3a')][_0xe1aa('0x13e')]=function(_0x59aa85,_0x3c42a8,_0x208cfe){if(this[_0xe1aa('0x49')][_0x59aa85]){if(_[_0xe1aa('0x48')](this[_0xe1aa('0x49')][_0x59aa85][_0xe1aa('0x12a')])){this['actions'][_0x59aa85][_0xe1aa('0x12a')]={};}this[_0xe1aa('0x49')][_0x59aa85][_0xe1aa('0x12a')][_0x3c42a8]=_0x208cfe;}};Preview['prototype'][_0xe1aa('0x20')]=function(_0x2b24bf){try{if(!_[_0xe1aa('0x48')](_0x2b24bf)){if(ut[_0xe1aa('0x13f')](_[_0xe1aa('0x140')](_0x2b24bf[_0xe1aa('0x141')])[0x0])){this[_0xe1aa('0x13e')](_0x2b24bf['uniqueid'],_[_0xe1aa('0x140')](_0x2b24bf[_0xe1aa('0x141')])[0x0],_0x2b24bf[_0xe1aa('0x142')]);}}}catch(_0x2a62cc){logger[_0xe1aa('0x143')]('[syncVarSet][Preview]',util[_0xe1aa('0x144')](_0x2a62cc,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xe1aa('0x22')]=function(_0x524f6d){if(_0x524f6d){if(this['actions'][_0x524f6d[_0xe1aa('0x145')]]){this[_0xe1aa('0x49')][_0x524f6d[_0xe1aa('0x145')]][_0xe1aa('0x13b')]=!![];}}};Preview['prototype'][_0xe1aa('0x24')]=function(_0x5b5248){if(_0x5b5248){if(this[_0xe1aa('0x49')][_0x5b5248[_0xe1aa('0x146')]]){this[_0xe1aa('0x49')][_0x5b5248[_0xe1aa('0x146')]][_0xe1aa('0x13b')]=!![];}}};module[_0xe1aa('0x147')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index cb5ea30..67aa261 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 _0x1969=['queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo'];(function(_0x3ffeb2,_0xb5c645){var _0x4cecb6=function(_0x5744d3){while(--_0x5744d3){_0x3ffeb2['push'](_0x3ffeb2['shift']());}};_0x4cecb6(++_0xb5c645);}(_0x1969,0x13d));var _0x9196=function(_0x2829f8,_0x3de32d){_0x2829f8=_0x2829f8-0x0;var _0x54e75a=_0x1969[_0x2829f8];return _0x54e75a;};'use strict';var util=require('util');var BPromise=require(_0x9196('0x0'));var logger=require(_0x9196('0x1'))(_0x9196('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x9196('0x3'));var cmHopperBlack=require(_0x9196('0x4'));var agentReportPreview=require(_0x9196('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x793baf){return function(_0xc9e22c){logger[_0x9196('0x6')](_0x793baf,util[_0x9196('0x7')](_0xc9e22c,{'showHidden':![],'depth':null}));};}function create(_0x4cdd37){return cmHopperHistory[_0x9196('0x8')](_0x4cdd37)['catch'](loggerCatch(_0x9196('0x9')));}function createAgent(_0x287248){return BPromise[_0x9196('0xa')]()[_0x9196('0xb')](agentReportPreview[_0x9196('0x8')](_0x287248))[_0x9196('0xc')](loggerCatch(_0x9196('0x9')));}function moveContact(_0x2126dc){return cmHopper['moveContactManagedDialer'](_0x2126dc,!![])[_0x9196('0xc')](loggerCatch(_0x9196('0xd')));}exports[_0x9196('0xe')]=function(_0x302f10){return cmHopperBlack[_0x9196('0xe')](_0x302f10)['catch'](loggerCatch(_0x9196('0xf')));};exports[_0x9196('0x10')]=function(_0x59c40){return BPromise[_0x9196('0xa')]()[_0x9196('0xb')](cmHopper[_0x9196('0x10')](_0x59c40))[_0x9196('0xc')](loggerCatch(_0x9196('0x11')));};exports['createHistory']=function(_0x130f8d,_0xab8e79){create(_0x130f8d)[_0x9196('0xc')](loggerCatch(_0xab8e79));moveContact(_0x130f8d)[_0x9196('0xc')](loggerCatch(_0xab8e79));};exports[_0x9196('0x12')]=function(_0x1dd50f,_0x13f891){createAgent(_0x1dd50f)[_0x9196('0xc')](loggerCatch(_0x13f891));};exports[_0x9196('0x13')]=function(_0x847cdd,_0x25a011){create(_0x847cdd)['catch'](loggerCatch(_0x25a011));};exports['createCustomerFinal']=function(_0x4a7e78,_0x3edd45){moveContact(_0x4a7e78)[_0x9196('0xc')](loggerCatch(_0x3edd45));};exports['rescheduleContact']=function(_0x705906,_0x1a6c5b,_0x2d0902){if(_0x1a6c5b){_0x705906[_0x9196('0x14')]=null;}if(_0x2d0902){_0x705906[_0x9196('0x15')]=![];}return cmHopper[_0x9196('0x16')](_0x705906)[_0x9196('0xc')](loggerCatch(_0x9196('0x17')));};exports[_0x9196('0x18')]=function(_0xf4eb3b){return cmHopper[_0x9196('0x18')](_0xf4eb3b)[_0x9196('0xc')](loggerCatch(_0x9196('0x19')));};exports['unlockContact']=function(_0x55613b){return cmHopper[_0x9196('0x1a')]({'UserId':null},_0x55613b,0x1)[_0x9196('0xc')](loggerCatch(_0x9196('0x1b')));};exports[_0x9196('0x1c')]=function(_0xe609e){return cmHopper[_0x9196('0x1a')]({'active':![]},_0xe609e,0x1)[_0x9196('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x9196('0x1d')]=function(_0x11abd1){var _0x375313={};_0x375313['type']=_0x11abd1['type'];_0x375313['uniqueid']=_0x11abd1[_0x9196('0x1e')];_0x375313[_0x9196('0x1f')]=_0x11abd1[_0x9196('0x1f')];_0x375313[_0x9196('0x20')]=_0x11abd1[_0x9196('0x20')];_0x375313[_0x9196('0x21')]=_0x11abd1[_0x9196('0x21')];_0x375313[_0x9196('0x22')]=_0x11abd1[_0x9196('0x23')];_0x375313[_0x9196('0x24')]=_0x11abd1['answertime'];_0x375313[_0x9196('0x25')]=0x1;_0x375313[_0x9196('0x26')]=_0x11abd1['endtime'];_0x375313[_0x9196('0x27')]=_0x11abd1[_0x9196('0x28')];_0x375313[_0x9196('0x29')]='from-sip';_0x375313[_0x9196('0x2a')]=_0x9196('0x2b');_0x375313[_0x9196('0x2c')]=0x0;_0x375313[_0x9196('0x2d')]=0x1;_0x375313[_0x9196('0x2e')]=_0x11abd1[_0x9196('0x28')];_0x375313[_0x9196('0x2f')]='COMPLETED';return BPromise[_0x9196('0xa')]()[_0x9196('0xb')](voiceQueueReport[_0x9196('0x30')](_0x375313))['catch'](loggerCatch(_0x9196('0x31')));};exports['getContactRecallMe']=function(_0x4f7704,_0x5dde79){return BPromise['resolve']()[_0x9196('0xb')](cmHopper[_0x9196('0x32')](_0x4f7704,_0x5dde79))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x10d24b){return cmHopper[_0x9196('0x16')](_0x10d24b,!![],!![])[_0x9196('0xc')](loggerCatch(_0x9196('0x33')));}; \ No newline at end of file +var _0x4ef1=['UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0x4ef1,0x1a3));var _0x14ef=function(_0x1b23c1,_0x47f69c){_0x1b23c1=_0x1b23c1-0x0;var _0x2fa49f=_0x4ef1[_0x1b23c1];return _0x2fa49f;};'use strict';var util=require(_0x14ef('0x0'));var BPromise=require('bluebird');var logger=require(_0x14ef('0x1'))(_0x14ef('0x2'));var cmHopper=require(_0x14ef('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x14ef('0x4'));var agentReportPreview=require(_0x14ef('0x5'));var voiceQueueReport=require(_0x14ef('0x6'));function loggerCatch(_0x4ce8cd){return function(_0x413771){logger['error'](_0x4ce8cd,util['inspect'](_0x413771,{'showHidden':![],'depth':null}));};}function create(_0xb73f10){return cmHopperHistory['createHistory'](_0xb73f10)['catch'](loggerCatch(_0x14ef('0x7')));}function createAgent(_0x8c6e32){return BPromise[_0x14ef('0x8')]()[_0x14ef('0x9')](agentReportPreview[_0x14ef('0xa')](_0x8c6e32))['catch'](loggerCatch(_0x14ef('0x7')));}function moveContact(_0x261c3f){return cmHopper[_0x14ef('0xb')](_0x261c3f,!![])['catch'](loggerCatch(_0x14ef('0xc')));}exports[_0x14ef('0xd')]=function(_0x3d55a3){return cmHopperBlack['checkIsBlackList'](_0x3d55a3)[_0x14ef('0xe')](loggerCatch(_0x14ef('0xf')));};exports[_0x14ef('0x10')]=function(_0x64af47){return BPromise[_0x14ef('0x8')]()[_0x14ef('0x9')](cmHopper['getContactPreview'](_0x64af47))[_0x14ef('0xe')](loggerCatch(_0x14ef('0x11')));};exports[_0x14ef('0xa')]=function(_0x2e263f,_0x2fa58d){create(_0x2e263f)[_0x14ef('0xe')](loggerCatch(_0x2fa58d));moveContact(_0x2e263f)[_0x14ef('0xe')](loggerCatch(_0x2fa58d));};exports[_0x14ef('0x12')]=function(_0x4603f7,_0x31920a){createAgent(_0x4603f7)[_0x14ef('0xe')](loggerCatch(_0x31920a));};exports['createCustomerHistory']=function(_0x2aa75e,_0x4d2577){create(_0x2aa75e)[_0x14ef('0xe')](loggerCatch(_0x4d2577));};exports[_0x14ef('0x13')]=function(_0x4628c4,_0x12e3d5){moveContact(_0x4628c4)[_0x14ef('0xe')](loggerCatch(_0x12e3d5));};exports[_0x14ef('0x14')]=function(_0x524342,_0x2ab1e6,_0x39bdbe){if(_0x2ab1e6){_0x524342[_0x14ef('0x15')]=null;}if(_0x39bdbe){_0x524342['active']=![];}return cmHopper[_0x14ef('0x14')](_0x524342)['catch'](loggerCatch(_0x14ef('0x16')));};exports[_0x14ef('0x17')]=function(_0x231ac7){return cmHopper[_0x14ef('0x17')](_0x231ac7)[_0x14ef('0xe')](loggerCatch(_0x14ef('0x18')));};exports[_0x14ef('0x19')]=function(_0x4a77a5){return cmHopper[_0x14ef('0x19')]({'UserId':null},_0x4a77a5,0x1)[_0x14ef('0xe')](loggerCatch(_0x14ef('0x1a')));};exports[_0x14ef('0x1b')]=function(_0x45db89){return cmHopper[_0x14ef('0x19')]({'active':![]},_0x45db89,0x1)[_0x14ef('0xe')](loggerCatch(_0x14ef('0x1c')));};exports[_0x14ef('0x1d')]=function(_0x1c9538){var _0x3e83d2={};_0x3e83d2[_0x14ef('0x1e')]=_0x1c9538[_0x14ef('0x1e')];_0x3e83d2[_0x14ef('0x1f')]=_0x1c9538[_0x14ef('0x1f')];_0x3e83d2[_0x14ef('0x20')]=_0x1c9538[_0x14ef('0x20')];_0x3e83d2[_0x14ef('0x21')]=_0x1c9538[_0x14ef('0x21')];_0x3e83d2[_0x14ef('0x22')]=_0x1c9538['queue'];_0x3e83d2[_0x14ef('0x23')]=_0x1c9538[_0x14ef('0x24')];_0x3e83d2[_0x14ef('0x25')]=_0x1c9538[_0x14ef('0x24')];_0x3e83d2[_0x14ef('0x26')]=0x1;_0x3e83d2['queuecallercompleteAt']=_0x1c9538[_0x14ef('0x27')];_0x3e83d2[_0x14ef('0x28')]=_0x1c9538[_0x14ef('0x29')];_0x3e83d2[_0x14ef('0x2a')]=_0x14ef('0x2b');_0x3e83d2[_0x14ef('0x2c')]='xcally-motion-preview';_0x3e83d2[_0x14ef('0x2d')]=0x0;_0x3e83d2[_0x14ef('0x2e')]=0x1;_0x3e83d2['lastAssignedTo']=_0x1c9538[_0x14ef('0x29')];_0x3e83d2[_0x14ef('0x2f')]=_0x14ef('0x30');return BPromise[_0x14ef('0x8')]()['then'](voiceQueueReport[_0x14ef('0x31')](_0x3e83d2))[_0x14ef('0xe')](loggerCatch(_0x14ef('0x32')));};exports['getContactRecallMe']=function(_0x5a77a3,_0x25055b){return BPromise['resolve']()[_0x14ef('0x9')](cmHopper[_0x14ef('0x33')](_0x5a77a3,_0x25055b))['catch'](loggerCatch(_0x14ef('0x34')));};exports[_0x14ef('0x35')]=function(_0x15f4af){return cmHopper[_0x14ef('0x14')](_0x15f4af,!![],!![])[_0x14ef('0xe')](loggerCatch(_0x14ef('0x36')));}; \ 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 43f29d5..d112b06 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 _0x0922=['Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','responsetime','endtime','logAgent','state','ringtime','getSeconds','logLookAgent','UserId','talktime','answertime','isFailure','Failure','calleridname','BOOKED','channelAgent','from-sip','uniqueid','totalGlobal','countbusyretry','countagentrejectretry','cloneAction','clone','scheduledAt','active','scheduledat','minutes','ListId','decrementTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','motionChannel','voice','mandatoryDisposition','agentReadyId','hasOwnProperty','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','idContact','type','dialAnswer','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqos','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','inspect','logger','info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0922,0x186));var _0x2092=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0922[_0xefd519];return _0x4bb882;};'use strict';var util=require(_0x2092('0x0'));var _=require(_0x2092('0x1'));var moment=require(_0x2092('0x2'));var logger=require(_0x2092('0x3'))('preview');var ipAgi=process[_0x2092('0x4')][_0x2092('0x5')]||_0x2092('0x6');var utils=require(_0x2092('0x7'));exports['loggerCatch']=function(_0xf89639){return function(_0x4ea412){logger[_0x2092('0x8')](_0xf89639,util[_0x2092('0x9')](_0x4ea412,{'showHidden':![],'depth':null}));};};exports[_0x2092('0xa')]=function(_0x5c95a8,_0x40598c){logger[_0x2092('0xb')](_0x5c95a8,util[_0x2092('0x9')](_0x40598c,{'showHidden':![],'depth':null}));};exports[_0x2092('0xc')]=function(_0x4f97d6,_0x80b4f1){logger['error'](_0x4f97d6,util['inspect'](_0x80b4f1,{'showHidden':![],'depth':null}));};exports[_0x2092('0xd')]=function(_0x489494){return function(_0x4a64cd){logger['info'](_0x489494,util[_0x2092('0x9')](_0x4a64cd,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x148524,_0x37c4e0,_0x1de364){return{'message':_0x148524,'unlock':_0x37c4e0,'active':_0x1de364};};exports[_0x2092('0xe')]=function(_0x3ec2b3,_0x25e812,_0x1ea59e){if(!_[_0x2092('0xf')](_0x1ea59e)&&_0x2092('0x10')===typeof _0x1ea59e&&!_[_0x2092('0x11')](_0x1ea59e)){if(!_[_0x2092('0xf')](_0x25e812)&&_0x2092('0x10')===typeof _0x25e812&&!_[_0x2092('0x11')](_0x25e812)){return util['format'](_0x2092('0x12'),_0x25e812,_0x1ea59e);}return util[_0x2092('0x13')](_0x2092('0x12'),_0x1ea59e,_0x1ea59e);}if(!_['isUndefined'](_0x3ec2b3)&&_0x2092('0x10')===typeof _0x3ec2b3&&!_[_0x2092('0x11')](_0x3ec2b3)){return _0x3ec2b3;}return _0x2092('0x14');};exports[_0x2092('0x15')]=function(_0x4c7574){if(_[_0x2092('0x16')](_0x4c7574)){return![];}return _0x4c7574;};exports[_0x2092('0x17')]=function(_0x505471,_0x21b694,_0x1a0ca1,_0x39f5fd,_0x282579,_0x397a10){var _0x4b6995={'XMD-QUEUE':_0x21b694[_0x2092('0x18')]?_0x21b694['Queue'][_0x2092('0x19')]:'','XMD-CALLERID':_0x39f5fd,'XMD-CALLERID-PREVIEW':_0x397a10?util[_0x2092('0x13')]('\x22%s\x22\x20<%s>',_0x397a10['calleridname'],_0x397a10[_0x2092('0x1a')]):_0x39f5fd,'XMD-DIALID':_0x282579,'XMD-CONTACTID':_0x21b694[_0x2092('0x1b')],'XMD-CDRTYPE':_0x2092('0x1c'),'CALLERID(all)':_0x39f5fd,'XMD-VOICEQUEUEID':_0x21b694[_0x2092('0x1d')],'XMD-DIALCHANNEL':_0x1a0ca1,'XMD-DIALTIMEOUT':_0x505471[_0x2092('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x2092('0x13')](_0x2092('0x1f'),_0x505471[_0x2092('0x20')]?'g':'',_[_0x2092('0x11')](_0x505471[_0x2092('0x21')])?'':_0x2092('0x22')),'XMD-DIALURL':_0x505471[_0x2092('0x23')]||'','XMD-AGI':_0x505471[_0x2092('0x24')]?util['format'](_0x2092('0x25'),ipAgi,_0x505471['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x505471['dialQueueProject2']?util[_0x2092('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x505471['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x397a10?_0x397a10[_0x2092('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x397a10?_0x397a10[_0x2092('0x27')]:'','XMD-DESTINATION':_0x2092('0x28'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x2092('0x11')](_0x505471[_0x2092('0x21')])){_0x4b6995[util[_0x2092('0x13')]('%s',_0x2092('0x29'))]=_0x505471['monitor_format'];_0x4b6995[util[_0x2092('0x13')]('%s',_0x2092('0x2a'))]=_0x282579;}return _0x4b6995;};exports[_0x2092('0x2b')]=function(_0x41b6f5){var _0x525127={};for(var _0x458903 in _0x41b6f5){if(_0x41b6f5['hasOwnProperty'](_0x458903)){_0x525127[util['format']('%s',_['toLower'](_0x458903))]=_0x41b6f5[_0x458903];}}return{'variables':_0x525127};};exports[_0x2092('0x2c')]=function(_0x5506e8){var _0x4d5746=moment()['format'](_0x2092('0x2d'));_0x5506e8['state']=0xd;_0x5506e8[_0x2092('0x2e')]='Blacklist';_0x5506e8[_0x2092('0x2f')]=_0x4d5746;_0x5506e8[_0x2092('0x30')]=_0x4d5746;_0x5506e8[_0x2092('0x31')]=_0x4d5746;};exports[_0x2092('0x32')]=function(_0x5b48aa,_0x43e0d1,_0x446bf3){var _0x28ac49=moment()['format'](_0x2092('0x2d'));_0x5b48aa[_0x2092('0x33')]=_0x43e0d1;_0x5b48aa['statedesc']=_0x446bf3;_0x5b48aa[_0x2092('0x30')]=_0x28ac49;_0x5b48aa[_0x2092('0x34')]=utils[_0x2092('0x35')](_0x5b48aa[_0x2092('0x30')],_0x5b48aa[_0x2092('0x2f')]);};exports[_0x2092('0x36')]=function(_0x18cf88,_0x11da33,_0xd058fb){_0x18cf88['membername']=_0x11da33;_0x18cf88[_0x2092('0x37')]=_0xd058fb;};exports['logCustomer']=function(_0x8bc993,_0x24c258,_0x350e08){var _0x4f0376=moment()[_0x2092('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x8bc993['state']=_0x24c258;_0x8bc993[_0x2092('0x2e')]=_0x350e08;_0x8bc993[_0x2092('0x30')]=_0x8bc993['responsetime']?_0x8bc993[_0x2092('0x30')]:_0x4f0376;_0x8bc993[_0x2092('0x31')]=_0x8bc993[_0x2092('0x31')]?_0x8bc993[_0x2092('0x31')]:_0x4f0376;_0x8bc993[_0x2092('0x34')]=utils[_0x2092('0x35')](_0x8bc993[_0x2092('0x30')]||0x0,_0x8bc993[_0x2092('0x2f')]||0x0);_0x8bc993[_0x2092('0x38')]=_0x8bc993[_0x2092('0x39')]?utils[_0x2092('0x35')](_0x8bc993['endtime'],_0x8bc993[_0x2092('0x39')]):0x0;};exports[_0x2092('0x3a')]=function(_0x9f7dab){return _0x9f7dab===_0x2092('0x3b');};exports['variablesAction']=function(_0x25f1cb,_0x1843e4,_0x2461fa,_0xa5974d,_0x4c4439){var _0x13d64b=_0xa5974d?'RECALL':_0x25f1cb[_0x2092('0x3c')];_0x13d64b=_0x4c4439?_0x2092('0x3d'):_0x13d64b;return{'actionid':_0x25f1cb['uniqueid'],'action':'originate','channel':_0x25f1cb[_0x2092('0x3e')],'callerid':util[_0x2092('0x13')](_0x2092('0x12'),_0x13d64b,_0x25f1cb[_0x2092('0x1a')]),'Exten':_0x2092('0x28'),'Context':_0x2092('0x3f'),'Priority':'1','variable':_0x2461fa,'timeout':(_0x1843e4['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x25f1cb[_0x2092('0x40')]};};exports[_0x2092('0x41')]=function(_0x3efd23){return _0x3efd23[_0x2092('0x42')]+_0x3efd23['countcongestionretry']+_0x3efd23['countnoanswerretry']+_0x3efd23[_0x2092('0x43')]+_0x3efd23['countnosuchnumberretry'];};exports[_0x2092('0x44')]=function(_0x550bd1){var _0x4dd14a=_[_0x2092('0x45')](_0x550bd1);_0x4dd14a[_0x2092('0x33')]=0xf;_0x4dd14a['statedesc']='Global';return _0x4dd14a;};exports[_0x2092('0x46')]=function(_0x33482f,_0x272618,_0x57e92f){var _0x37e65d={};_0x37e65d[_0x272618]=_0x33482f[_0x272618];_0x37e65d[_0x2092('0x47')]=![];_0x37e65d[_0x2092('0x48')]=moment()['add'](_0x57e92f,_0x2092('0x49'))['format'](_0x2092('0x2d'));_0x37e65d[_0x2092('0x1b')]=_0x33482f[_0x2092('0x1b')];_0x37e65d[_0x2092('0x4a')]=_0x33482f[_0x2092('0x4a')];_0x37e65d[_0x2092('0x1d')]=_0x33482f[_0x2092('0x1d')]||undefined;return _0x37e65d;};exports[_0x2092('0x4b')]=function(_0xa639fe,_0x46b232){if(!_[_0x2092('0x16')](_0xa639fe)){if(_0xa639fe['pTalking']>0x0){_0xa639fe['pTalking']-=0x1;}else{logger[_0x2092('0xb')](_0x46b232,_0x2092('0x4c'));}}else{logger[_0x2092('0x8')](_0x46b232,_0x2092('0x4d'));}};exports[_0x2092('0x4e')]=function(_0x28b653){if(_0x28b653<=0x0){return!![];}return![];};function buildObj(_0xd0e351,_0x1d56ec,_0x33886e){_0xd0e351[_0x2092('0x4f')]=_0x1d56ec;_0xd0e351['name']=_0xd0e351[_0x2092('0x50')];_0xd0e351['interface']=_0xd0e351['channelAgent'];_0xd0e351[_0x2092('0x51')]=_0x2092('0x52');if(_0x33886e){_0xd0e351[_0x2092('0x53')]=_0x33886e['mandatoryDisposition'];}return _0xd0e351;}exports['buildObj']=buildObj;exports[_0x2092('0x54')]=function(_0x11911f){var _0x3e7921=[];for(var _0x11dd13 in _0x11911f){if(_0x11911f[_0x2092('0x55')](_0x11dd13)){if(!_[_0x2092('0x16')](_0x11911f[_0x11dd13])&&_0x11911f[_0x11dd13][_0x2092('0x33')]==='not_inuse'&&_0x11911f[_0x11dd13][_0x2092('0x56')]===_0x2092('0x57')){_0x3e7921[_0x2092('0x58')](_0x11911f[_0x11dd13]['id']);}}}return _0x3e7921;};exports[_0x2092('0x59')]=function(_0x4a9912){var _0x20d009=moment()['milliseconds'](0x0);var _0x305459=moment(_0x4a9912)[_0x2092('0x5a')](0x0);return _0x20d009[_0x2092('0x5b')](_0x305459,_0x2092('0x5c'));};exports[_0x2092('0x5d')]=function(_0x5f0ce6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5f0ce6['ContactId'],'ListId':_0x5f0ce6['ListId'],'VoiceQueueId':_0x5f0ce6[_0x2092('0x1d')]||undefined,'CampaignId':_0x5f0ce6[_0x2092('0x5e')]||undefined};};exports['filterKey']=function(_0x30c0e0){if(_0x30c0e0===_0x2092('0x40')||_0x30c0e0===_0x2092('0x5f')||_0x30c0e0===_0x2092('0x50')||_0x30c0e0===_0x2092('0x60')||_0x30c0e0==='campaigntype'||_0x30c0e0===_0x2092('0x61')||_0x30c0e0==='membername'||_0x30c0e0===_0x2092('0x3e')||_0x30c0e0===_0x2092('0x3c')||_0x30c0e0===_0x2092('0x47')||_0x30c0e0===_0x2092('0x1a')||_0x30c0e0===_0x2092('0x48')||_0x30c0e0==='countbusyretry'||_0x30c0e0===_0x2092('0x62')||_0x30c0e0===_0x2092('0x63')||_0x30c0e0===_0x2092('0x64')||_0x30c0e0===_0x2092('0x65')||_0x30c0e0===_0x2092('0x66')||_0x30c0e0===_0x2092('0x67')||_0x30c0e0==='recallme'||_0x30c0e0==='ContactId'||_0x30c0e0===_0x2092('0x4a')||_0x30c0e0==='UserId'||_0x30c0e0===_0x2092('0x1d')||_0x30c0e0===_0x2092('0x68')||_0x30c0e0===_0x2092('0x69')||_0x30c0e0===_0x2092('0x6a')||_0x30c0e0===_0x2092('0x6b')||_0x30c0e0===_0x2092('0x6c')||_0x30c0e0===_0x2092('0x6d')||_0x30c0e0===_0x2092('0x6e')||_0x30c0e0==='xmd-dialoptions'||_0x30c0e0===_0x2092('0x6f')||_0x30c0e0==='xmd-dialchannel'||_0x30c0e0===_0x2092('0x70')||_0x30c0e0===_0x2092('0x71')||_0x30c0e0===_0x2092('0x72')||_0x30c0e0===_0x2092('0x73')||_0x30c0e0===_0x2092('0x74')||_0x30c0e0==='rtpaudioqos'||_0x30c0e0===_0x2092('0x75')||_0x30c0e0===_0x2092('0x76')||_0x30c0e0===_0x2092('0x77')||_0x30c0e0===_0x2092('0x78')||_0x30c0e0===_0x2092('0x79')||_0x30c0e0==='rtpaudioqosrtt'||_0x30c0e0==='rtpaudioqosrttbridged'||_0x30c0e0===_0x2092('0x7a')||_0x30c0e0===_0x2092('0x75')||_0x30c0e0===_0x2092('0x76')||_0x30c0e0===_0x2092('0x77')||_0x30c0e0===_0x2092('0x78')||_0x30c0e0===_0x2092('0x79')||_0x30c0e0===_0x2092('0x7b')||_0x30c0e0===_0x2092('0x7c')||_0x30c0e0===_0x2092('0x7d')||_0x30c0e0==='bridgepvtcallid'||_0x30c0e0===_0x2092('0x33')||_0x30c0e0===_0x2092('0x2e')){return![];}return!![];};exports[_0x2092('0x7e')]=function(_0x451d55,_0x4692d4){var _0xe7a47b,_0x1e1319,_0xacc385;if(_0x4692d4<=0x0){_0x4692d4=0x1;}_0xe7a47b=new RegExp(_0x2092('0x7f')+_0x4692d4+'}$');_0x1e1319=Math['pow'](0xa,_0x4692d4-0x1);_0xacc385=Math[_0x2092('0x80')](0xa,_0x4692d4)-0x1;return util['format']('%s',_[_0x2092('0x81')](_0x451d55,_0xe7a47b,_['random'](_0x1e1319,_0xacc385)));};exports[_0x2092('0x82')]=function(_0x593253){var _0x574102=_0x593253[_0x2092('0x83')](/"(.*?)"/);return _0x574102?_0x574102[0x1]:_0x593253;};exports[_0x2092('0x84')]=function(_0x734423){var _0xb7eeb7=_0x734423[_0x2092('0x83')](/<(.*?)>/);return _0xb7eeb7?_0xb7eeb7[0x1]:_0x734423;};function buildNoAnswerEventPayload(_0x5c0f07,_0x53bedd){var _0x3b0902=buildObj(_0x5c0f07,'noanswer');if(!_[_0x2092('0x11')](_0x53bedd[_0x2092('0x85')])){Object[_0x2092('0x86')](_0x53bedd[_0x2092('0x85')])[_0x2092('0x87')](function(_0x2643c7){_0x3b0902[_0x2643c7[_0x2092('0x88')]()]=_0x53bedd[_0x2092('0x85')][_0x2643c7];});}return _0x3b0902;}exports[_0x2092('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xabe0=['xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','extractCalleridNumber','match','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','logger2','message','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','responsetime','endtime','logAgent','ringtime','getSeconds','starttime','UserId','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','from-sip','uniqueid','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','ListId','VoiceQueueId','decrementTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','CampaignId','type','dialAnswer','membername','channelAgent','countbusyretry','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid'];(function(_0x33dbe3,_0x11dd4d){var _0x8794b1=function(_0x212430){while(--_0x212430){_0x33dbe3['push'](_0x33dbe3['shift']());}};_0x8794b1(++_0x11dd4d);}(_0xabe0,0x11e));var _0x0abe=function(_0x4aa3e4,_0x21d477){_0x4aa3e4=_0x4aa3e4-0x0;var _0x1d79f5=_0xabe0[_0x4aa3e4];return _0x1d79f5;};'use strict';var util=require(_0x0abe('0x0'));var _=require(_0x0abe('0x1'));var moment=require(_0x0abe('0x2'));var logger=require(_0x0abe('0x3'))('preview');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x0abe('0x4');var utils=require(_0x0abe('0x5'));exports[_0x0abe('0x6')]=function(_0x22a0b8){return function(_0x1c4072){logger[_0x0abe('0x7')](_0x22a0b8,util[_0x0abe('0x8')](_0x1c4072,{'showHidden':![],'depth':null}));};};exports[_0x0abe('0x9')]=function(_0x4d821a,_0x4740e4){logger[_0x0abe('0xa')](_0x4d821a,util[_0x0abe('0x8')](_0x4740e4,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x48c0c3,_0xf14430){logger[_0x0abe('0x7')](_0x48c0c3,util['inspect'](_0xf14430,{'showHidden':![],'depth':null}));};exports[_0x0abe('0xb')]=function(_0x55f1f2){return function(_0x139af5){logger[_0x0abe('0xa')](_0x55f1f2,util[_0x0abe('0x8')](_0x139af5,{'showHidden':![],'depth':null}));};};exports[_0x0abe('0xc')]=function(_0x187518,_0x2e0d9a,_0x62428c){return{'message':_0x187518,'unlock':_0x2e0d9a,'active':_0x62428c};};exports['getCallerId']=function(_0x5df256,_0x46bf64,_0x330641){if(!_[_0x0abe('0xd')](_0x330641)&&'string'===typeof _0x330641&&!_[_0x0abe('0xe')](_0x330641)){if(!_[_0x0abe('0xd')](_0x46bf64)&&'string'===typeof _0x46bf64&&!_[_0x0abe('0xe')](_0x46bf64)){return util[_0x0abe('0xf')](_0x0abe('0x10'),_0x46bf64,_0x330641);}return util[_0x0abe('0xf')](_0x0abe('0x10'),_0x330641,_0x330641);}if(!_['isUndefined'](_0x5df256)&&_0x0abe('0x11')===typeof _0x5df256&&!_['isEmpty'](_0x5df256)){return _0x5df256;}return _0x0abe('0x12');};exports[_0x0abe('0x13')]=function(_0x54f4e7){if(_[_0x0abe('0x14')](_0x54f4e7)){return![];}return _0x54f4e7;};exports[_0x0abe('0x15')]=function(_0x2850b3,_0x760f68,_0x4239ab,_0x17c3e9,_0x2fa20a,_0x4c3a59){var _0x5bc292={'XMD-QUEUE':_0x760f68[_0x0abe('0x16')]?_0x760f68[_0x0abe('0x16')][_0x0abe('0x17')]:'','XMD-CALLERID':_0x17c3e9,'XMD-CALLERID-PREVIEW':_0x4c3a59?util[_0x0abe('0xf')](_0x0abe('0x10'),_0x4c3a59[_0x0abe('0x18')],_0x4c3a59[_0x0abe('0x19')]):_0x17c3e9,'XMD-DIALID':_0x2fa20a,'XMD-CONTACTID':_0x760f68[_0x0abe('0x1a')],'XMD-CDRTYPE':_0x0abe('0x1b'),'CALLERID(all)':_0x17c3e9,'XMD-VOICEQUEUEID':_0x760f68['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4239ab,'XMD-DIALTIMEOUT':_0x2850b3[_0x0abe('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x0abe('0xf')](_0x0abe('0x1d'),_0x2850b3[_0x0abe('0x1e')]?'g':'',_[_0x0abe('0xe')](_0x2850b3[_0x0abe('0x1f')])?'':_0x0abe('0x20')),'XMD-DIALURL':_0x2850b3['dialPreviewUrl']||'','XMD-AGI':_0x2850b3[_0x0abe('0x21')]?util[_0x0abe('0xf')](_0x0abe('0x22'),ipAgi,_0x2850b3[_0x0abe('0x21')]):_0x0abe('0x23'),'XMD-AGIAFTER':_0x2850b3[_0x0abe('0x1e')]?util[_0x0abe('0xf')](_0x0abe('0x22'),ipAgi,_0x2850b3[_0x0abe('0x1e')]):_0x0abe('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x4c3a59?_0x4c3a59[_0x0abe('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x4c3a59?_0x4c3a59[_0x0abe('0x25')]:'','XMD-DESTINATION':_0x0abe('0x26'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x2850b3[_0x0abe('0x1f')])){_0x5bc292[util[_0x0abe('0xf')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x2850b3[_0x0abe('0x1f')];_0x5bc292[util[_0x0abe('0xf')]('%s',_0x0abe('0x27'))]=_0x2fa20a;}return _0x5bc292;};exports[_0x0abe('0x28')]=function(_0x5db2c9){var _0x67c17c={};for(var _0x19ee2b in _0x5db2c9){if(_0x5db2c9[_0x0abe('0x29')](_0x19ee2b)){_0x67c17c[util[_0x0abe('0xf')]('%s',_[_0x0abe('0x2a')](_0x19ee2b))]=_0x5db2c9[_0x19ee2b];}}return{'variables':_0x67c17c};};exports[_0x0abe('0x2b')]=function(_0x230424){var _0x5e5d05=moment()[_0x0abe('0xf')](_0x0abe('0x2c'));_0x230424[_0x0abe('0x2d')]=0xd;_0x230424[_0x0abe('0x2e')]='Blacklist';_0x230424['starttime']=_0x5e5d05;_0x230424[_0x0abe('0x2f')]=_0x5e5d05;_0x230424[_0x0abe('0x30')]=_0x5e5d05;};exports[_0x0abe('0x31')]=function(_0x459019,_0xce383b,_0x3027ad){var _0x3697a3=moment()[_0x0abe('0xf')](_0x0abe('0x2c'));_0x459019[_0x0abe('0x2d')]=_0xce383b;_0x459019['statedesc']=_0x3027ad;_0x459019['responsetime']=_0x3697a3;_0x459019[_0x0abe('0x32')]=utils[_0x0abe('0x33')](_0x459019[_0x0abe('0x2f')],_0x459019[_0x0abe('0x34')]);};exports['logLookAgent']=function(_0x1a02a3,_0x3d7e13,_0x2f31cc){_0x1a02a3['membername']=_0x3d7e13;_0x1a02a3[_0x0abe('0x35')]=_0x2f31cc;};exports['logCustomer']=function(_0x58830f,_0x4db585,_0x1da534){var _0x58dc6f=moment()[_0x0abe('0xf')](_0x0abe('0x2c'));_0x58830f[_0x0abe('0x2d')]=_0x4db585;_0x58830f['statedesc']=_0x1da534;_0x58830f[_0x0abe('0x2f')]=_0x58830f[_0x0abe('0x2f')]?_0x58830f['responsetime']:_0x58dc6f;_0x58830f[_0x0abe('0x30')]=_0x58830f['endtime']?_0x58830f['endtime']:_0x58dc6f;_0x58830f[_0x0abe('0x32')]=utils[_0x0abe('0x33')](_0x58830f['responsetime']||0x0,_0x58830f[_0x0abe('0x34')]||0x0);_0x58830f['talktime']=_0x58830f[_0x0abe('0x36')]?utils[_0x0abe('0x33')](_0x58830f['endtime'],_0x58830f[_0x0abe('0x36')]):0x0;};exports[_0x0abe('0x37')]=function(_0xe7850b){return _0xe7850b===_0x0abe('0x38');};exports[_0x0abe('0x39')]=function(_0x57c8bf,_0x57998a,_0x4bdab9,_0x341168,_0x391800){var _0x34f4a2=_0x341168?_0x0abe('0x3a'):_0x57c8bf[_0x0abe('0x18')];_0x34f4a2=_0x391800?_0x0abe('0x3b'):_0x34f4a2;return{'actionid':_0x57c8bf['uniqueid'],'action':'originate','channel':_0x57c8bf['channelAgent'],'callerid':util[_0x0abe('0xf')]('\x22%s\x22\x20<%s>',_0x34f4a2,_0x57c8bf[_0x0abe('0x19')]),'Exten':_0x0abe('0x26'),'Context':_0x0abe('0x3c'),'Priority':'1','variable':_0x4bdab9,'timeout':(_0x57998a['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x57c8bf[_0x0abe('0x3d')]};};exports[_0x0abe('0x3e')]=function(_0x405ee1){return _0x405ee1['countbusyretry']+_0x405ee1['countcongestionretry']+_0x405ee1[_0x0abe('0x3f')]+_0x405ee1[_0x0abe('0x40')]+_0x405ee1[_0x0abe('0x41')];};exports[_0x0abe('0x42')]=function(_0x2a9c0b){var _0x5cfc3d=_[_0x0abe('0x43')](_0x2a9c0b);_0x5cfc3d[_0x0abe('0x2d')]=0xf;_0x5cfc3d[_0x0abe('0x2e')]=_0x0abe('0x44');return _0x5cfc3d;};exports[_0x0abe('0x45')]=function(_0x9b8ac9,_0x21c837,_0x1b7f5a){var _0x497e5c={};_0x497e5c[_0x21c837]=_0x9b8ac9[_0x21c837];_0x497e5c[_0x0abe('0x46')]=![];_0x497e5c['scheduledat']=moment()[_0x0abe('0x47')](_0x1b7f5a,'minutes')[_0x0abe('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x497e5c['ContactId']=_0x9b8ac9['ContactId'];_0x497e5c[_0x0abe('0x48')]=_0x9b8ac9['ListId'];_0x497e5c[_0x0abe('0x49')]=_0x9b8ac9['VoiceQueueId']||undefined;return _0x497e5c;};exports[_0x0abe('0x4a')]=function(_0x4c9b36,_0x554c18){if(!_[_0x0abe('0x14')](_0x4c9b36)){if(_0x4c9b36['pTalking']>0x0){_0x4c9b36['pTalking']-=0x1;}else{logger[_0x0abe('0xa')](_0x554c18,_0x0abe('0x4b'));}}else{logger['error'](_0x554c18,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports[_0x0abe('0x4c')]=function(_0x43a982){if(_0x43a982<=0x0){return!![];}return![];};function buildObj(_0x701c74,_0x398ae0,_0x1f54fc){_0x701c74[_0x0abe('0x4d')]=_0x398ae0;_0x701c74['name']=_0x701c74[_0x0abe('0x4e')];_0x701c74['interface']=_0x701c74['channelAgent'];_0x701c74[_0x0abe('0x4f')]=_0x0abe('0x50');if(_0x1f54fc){_0x701c74[_0x0abe('0x51')]=_0x1f54fc['mandatoryDisposition'];}return _0x701c74;}exports[_0x0abe('0x52')]=buildObj;exports[_0x0abe('0x53')]=function(_0x5f172b){var _0x1b6cfa=[];for(var _0x57bde5 in _0x5f172b){if(_0x5f172b[_0x0abe('0x29')](_0x57bde5)){if(!_[_0x0abe('0x14')](_0x5f172b[_0x57bde5])&&_0x5f172b[_0x57bde5][_0x0abe('0x2d')]===_0x0abe('0x54')&&_0x5f172b[_0x57bde5]['status']==='reachable'){_0x1b6cfa[_0x0abe('0x55')](_0x5f172b[_0x57bde5]['id']);}}}return _0x1b6cfa;};exports[_0x0abe('0x56')]=function(_0x57693f){var _0x49a4a9=moment()['milliseconds'](0x0);var _0x2f8e38=moment(_0x57693f)[_0x0abe('0x57')](0x0);return _0x49a4a9[_0x0abe('0x58')](_0x2f8e38,_0x0abe('0x59'));};exports['createBody']=function(_0x1efcc2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1efcc2[_0x0abe('0x1a')],'ListId':_0x1efcc2[_0x0abe('0x48')],'VoiceQueueId':_0x1efcc2[_0x0abe('0x49')]||undefined,'CampaignId':_0x1efcc2[_0x0abe('0x5a')]||undefined};};exports['filterKey']=function(_0x220ff0){if(_0x220ff0==='uniqueid'||_0x220ff0==='idContact'||_0x220ff0==='queue'||_0x220ff0===_0x0abe('0x5b')||_0x220ff0==='campaigntype'||_0x220ff0===_0x0abe('0x5c')||_0x220ff0===_0x0abe('0x5d')||_0x220ff0===_0x0abe('0x5e')||_0x220ff0===_0x0abe('0x18')||_0x220ff0===_0x0abe('0x46')||_0x220ff0===_0x0abe('0x19')||_0x220ff0==='scheduledat'||_0x220ff0===_0x0abe('0x5f')||_0x220ff0===_0x0abe('0x60')||_0x220ff0===_0x0abe('0x3f')||_0x220ff0==='countglobal'||_0x220ff0===_0x0abe('0x61')||_0x220ff0===_0x0abe('0x62')||_0x220ff0===_0x0abe('0x63')||_0x220ff0===_0x0abe('0x64')||_0x220ff0==='ContactId'||_0x220ff0===_0x0abe('0x48')||_0x220ff0===_0x0abe('0x35')||_0x220ff0===_0x0abe('0x49')||_0x220ff0===_0x0abe('0x65')||_0x220ff0===_0x0abe('0x66')||_0x220ff0===_0x0abe('0x67')||_0x220ff0==='xmd-phone'||_0x220ff0===_0x0abe('0x68')||_0x220ff0===_0x0abe('0x69')||_0x220ff0===_0x0abe('0x6a')||_0x220ff0===_0x0abe('0x6b')||_0x220ff0===_0x0abe('0x6c')||_0x220ff0==='xmd-dialchannel'||_0x220ff0===_0x0abe('0x6d')||_0x220ff0==='xmd-cdrtype'||_0x220ff0==='xmd-callerid'||_0x220ff0==='xmd-agiafter'||_0x220ff0===_0x0abe('0x6e')||_0x220ff0==='rtpaudioqos'||_0x220ff0==='rtpaudioqosbridged'||_0x220ff0===_0x0abe('0x6f')||_0x220ff0===_0x0abe('0x70')||_0x220ff0===_0x0abe('0x71')||_0x220ff0===_0x0abe('0x72')||_0x220ff0==='rtpaudioqosrtt'||_0x220ff0===_0x0abe('0x73')||_0x220ff0===_0x0abe('0x74')||_0x220ff0===_0x0abe('0x75')||_0x220ff0===_0x0abe('0x6f')||_0x220ff0===_0x0abe('0x70')||_0x220ff0===_0x0abe('0x71')||_0x220ff0==='rtpaudioqoslossbridged'||_0x220ff0===_0x0abe('0x76')||_0x220ff0===_0x0abe('0x73')||_0x220ff0===_0x0abe('0x77')||_0x220ff0===_0x0abe('0x78')||_0x220ff0===_0x0abe('0x2d')||_0x220ff0===_0x0abe('0x2e')){return![];}return!![];};exports[_0x0abe('0x79')]=function(_0x1b593b,_0x1ec2e3){var _0x175324,_0x193b42,_0x1d9ac6;if(_0x1ec2e3<=0x0){_0x1ec2e3=0x1;}_0x175324=new RegExp(_0x0abe('0x7a')+_0x1ec2e3+'}$');_0x193b42=Math[_0x0abe('0x7b')](0xa,_0x1ec2e3-0x1);_0x1d9ac6=Math[_0x0abe('0x7b')](0xa,_0x1ec2e3)-0x1;return util['format']('%s',_['replace'](_0x1b593b,_0x175324,_['random'](_0x193b42,_0x1d9ac6)));};exports[_0x0abe('0x7c')]=function(_0x25e65f){var _0x48140d=_0x25e65f['match'](/"(.*?)"/);return _0x48140d?_0x48140d[0x1]:_0x25e65f;};exports[_0x0abe('0x7d')]=function(_0x507808){var _0x1fbf01=_0x507808[_0x0abe('0x7e')](/<(.*?)>/);return _0x1fbf01?_0x1fbf01[0x1]:_0x507808;};function buildNoAnswerEventPayload(_0x7cddf5,_0x108028){var _0x20cbbe=buildObj(_0x7cddf5,'noanswer');if(!_[_0x0abe('0xe')](_0x108028[_0x0abe('0x7f')])){Object[_0x0abe('0x80')](_0x108028[_0x0abe('0x7f')])[_0x0abe('0x81')](function(_0x728faf){_0x20cbbe[_0x728faf[_0x0abe('0x82')]()]=_0x108028[_0x0abe('0x7f')][_0x728faf];});}return _0x20cbbe;}exports[_0x0abe('0x83')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8146ce6..23dcb75 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 _0x8877=['queueremove','boolean','reload','voicechannel','voicequeuechannelredirect','queueadd','string','number'];(function(_0x23eaf2,_0x465cfb){var _0x54efb4=function(_0x5f3727){while(--_0x5f3727){_0x23eaf2['push'](_0x23eaf2['shift']());}};_0x54efb4(++_0x465cfb);}(_0x8877,0x105));var _0x7887=function(_0x45ae8c,_0x368f13){_0x45ae8c=_0x45ae8c-0x0;var _0x4a34e0=_0x8877[_0x45ae8c];return _0x4a34e0;};'use strict';exports[_0x7887('0x0')]={'queue':{'type':_0x7887('0x1'),'required':!![]},'interface':{'type':_0x7887('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x7887('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x7887('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x7887('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x7887('0x1'),'required':!![]},'paused':{'type':_0x7887('0x4')},'reason':{'type':_0x7887('0x1'),'required':![]}};exports[_0x7887('0x5')]={'module':{'type':_0x7887('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x7887('0x1'),'required':!![]}};exports[_0x7887('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x7887('0x1')},'mixmonitorid':{'type':_0x7887('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x7887('0x1'),'required':!![]}};exports[_0x7887('0x7')]={'uniqueid':{'type':_0x7887('0x1'),'required':!![]},'exten':{'type':_0x7887('0x1'),'required':!![]},'context':{'type':_0x7887('0x1')}}; \ No newline at end of file +var _0x32d5=['queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x32d5,0xc2));var _0x532d=function(_0x28065c,_0x2f0e3b){_0x28065c=_0x28065c-0x0;var _0x571914=_0x32d5[_0x28065c];return _0x571914;};'use strict';exports[_0x532d('0x0')]={'queue':{'type':_0x532d('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x532d('0x2'),'required':![]},'paused':{'type':_0x532d('0x3'),'required':![]}};exports[_0x532d('0x4')]={'queue':{'type':_0x532d('0x1'),'required':!![]},'interface':{'type':_0x532d('0x1'),'required':!![]}};exports[_0x532d('0x5')]={'interface':{'type':_0x532d('0x1'),'required':!![]},'paused':{'type':_0x532d('0x3')},'reason':{'type':_0x532d('0x1'),'required':![]}};exports[_0x532d('0x6')]={'module':{'type':_0x532d('0x1'),'required':![]}};exports[_0x532d('0x7')]={'uniqueid':{'type':_0x532d('0x1'),'required':!![]}};exports[_0x532d('0x8')]={'uniqueid':{'type':_0x532d('0x1'),'required':!![]},'filename':{'type':_0x532d('0x1')},'format':{'type':_0x532d('0x1')},'mixmonitorid':{'type':_0x532d('0x1')}};exports[_0x532d('0x9')]={'uniqueid':{'type':_0x532d('0x1'),'required':!![]}};exports[_0x532d('0xa')]={'uniqueid':{'type':_0x532d('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index ae6d09f..9fc7924 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x64edb0,_0x4dd13c){var _0x580a4b=function(_0x3e6636){while(--_0x3e6636){_0x64edb0['push'](_0x64edb0['shift']());}};_0x580a4b(++_0x4dd13c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x251535,_0x4a49e8){_0x251535=_0x251535-0x0;var _0x4a7b3e=_0x5f2f[_0x251535];return _0x4a7b3e;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0xa92288,_0x201df2){var _0x1622fb=function(_0x5ea994){while(--_0x5ea994){_0xa92288['push'](_0xa92288['shift']());}};_0x1622fb(++_0x201df2);}(_0x757a,0xde));var _0xa757=function(_0x1f455f,_0x5cd96){_0x1f455f=_0x1f455f-0x0;var _0x366c76=_0x757a[_0x1f455f];return _0x366c76;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index dfcf848..a94e1e6 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9940=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x9faff7,_0x59a564){var _0x4f8043=function(_0x5f060d){while(--_0x5f060d){_0x9faff7['push'](_0x9faff7['shift']());}};_0x4f8043(++_0x59a564);}(_0x9940,0x69));var _0x0994=function(_0x129ed5,_0x4c5b10){_0x129ed5=_0x129ed5-0x0;var _0x46443c=_0x9940[_0x129ed5];return _0x46443c;};'use strict';function mergeDBDataToRealtime(_0x51f02e,_0x2c8d61){var _0x522273=Object['assign']({},_0x51f02e);for(var _0x58f315 in _0x2c8d61){if(_0x522273[_0x0994('0x0')](_0x58f315)){_0x522273[_0x58f315]=_0x2c8d61[_0x58f315];}}return _0x522273;}exports[_0x0994('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xe9e4=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xe9e4,0x82));var _0x4e9e=function(_0x469ba7,_0x570cfe){_0x469ba7=_0x469ba7-0x0;var _0x5ea926=_0xe9e4[_0x469ba7];return _0x5ea926;};'use strict';function mergeDBDataToRealtime(_0x5ec009,_0x30daf4){var _0x1621b7=Object['assign']({},_0x5ec009);for(var _0x23e53f in _0x30daf4){if(_0x1621b7[_0x4e9e('0x0')](_0x23e53f)){_0x1621b7[_0x23e53f]=_0x30daf4[_0x23e53f];}}return _0x1621b7;}exports[_0x4e9e('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index e96a5a2..88c01db 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 _0x4e16=['startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','agents','accountcode','name','isNil','interface','SIP/%s','length','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','destination','exten','type','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','membername','create','filename','createdAt','monitors','calleridname','connectedlinename','xcally-motion-dialer','forEach'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x4e16,0x1d4));var _0x64e1=function(_0x1652b2,_0xebc432){_0x1652b2=_0x1652b2-0x0;var _0x45202c=_0x4e16[_0x1652b2];return _0x45202c;};'use strict';var _=require(_0x64e1('0x0'));var moment=require(_0x64e1('0x1'));var util=require(_0x64e1('0x2'));var config=require(_0x64e1('0x3'));var ami=require(_0x64e1('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x64e1('0x5'));var RpcVoiceDialReport=require(_0x64e1('0x6'));var RpcMemberReport=require(_0x64e1('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x64e1('0x8'));var VoiceQueueReport=require(_0x64e1('0x9'));var VoiceCallReport=require(_0x64e1('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x64e1('0xb'));var UserReport=require(_0x64e1('0xc'));function Report(_0x42f6fa){this[_0x64e1('0xd')]=_0x42f6fa;this['agents']=_0x42f6fa['agents'];this[_0x64e1('0xe')]=_0x42f6fa[_0x64e1('0xe')];}Report[_0x64e1('0xf')][_0x64e1('0x10')]=function(_0x4c428d){var _0x5747f3=new VoiceQueueReport(this['realtime']);var _0xffe670=new VoiceAgentReport(this[_0x64e1('0xd')]);var _0xa53c6a=new VoiceDialReport(this[_0x64e1('0xd')]);var _0x25408d=new VoiceCallReport(this['realtime']);var _0x1d76e2=new UserReport(this[_0x64e1('0xd')]);if(config[_0x64e1('0x11')]&&config[_0x64e1('0x11')]['disabled']){ami['on'](_0x64e1('0x12'),this[_0x64e1('0x13')]['bind'](this));ami['on'](_0x64e1('0x14'),this[_0x64e1('0x15')][_0x64e1('0x16')](this));ami['on']('custom:voiceAgentReport',this[_0x64e1('0x17')][_0x64e1('0x16')](this));ami['on'](_0x64e1('0x18'),this[_0x64e1('0x19')][_0x64e1('0x16')](this));ami['on'](_0x64e1('0x1a'),this['blindTransfer'][_0x64e1('0x16')](this));ami['on'](_0x64e1('0x1b'),this[_0x64e1('0x1c')][_0x64e1('0x16')](this));}};Report[_0x64e1('0xf')][_0x64e1('0x1d')]=function(_0x1f98f5){var _0x295551;_0x295551=_[_0x64e1('0x1e')](this[_0x64e1('0x1f')],function(_0x367319){return _0x367319[_0x64e1('0x20')]==_0x1f98f5||_0x367319[_0x64e1('0x21')]==_0x1f98f5;});if(_[_0x64e1('0x22')](_0x295551)){var _0x2c9ac3=_[_0x64e1('0x1e')](this[_0x64e1('0xe')],function(_0x13cc08){return _0x13cc08['accountcode']==_0x1f98f5||_0x13cc08[_0x64e1('0x21')]==_0x1f98f5;});if(_0x2c9ac3){_0x295551=_[_0x64e1('0x1e')](this[_0x64e1('0x1f')],function(_0x50379a){return _0x50379a[_0x64e1('0x23')]==util['format'](_0x64e1('0x24'),_0x2c9ac3['name']);});}}return _0x295551;};Report[_0x64e1('0xf')][_0x64e1('0x13')]=function(_0x2244dd){for(var _0x3f4011=0x0;_0x3f4011<_0x2244dd[_0x64e1('0x25')];_0x3f4011+=0x1){var _0x52da27=this[_0x64e1('0x1d')](_0x2244dd[_0x3f4011]['connectedlinenum']);if(_0x52da27){_0x2244dd[_0x3f4011][_0x64e1('0x20')]=_0x52da27[_0x64e1('0x20')];_0x2244dd[_0x3f4011][_0x64e1('0x26')]=!![];_0x2244dd[_0x3f4011][_0x64e1('0x27')]=_0x52da27[_0x64e1('0x21')];_0x2244dd[_0x3f4011][_0x64e1('0x23')]=_['isNil'](_0x52da27[_0x64e1('0x23')])?util[_0x64e1('0x28')](_0x64e1('0x24'),_0x52da27['name']):_0x52da27[_0x64e1('0x23')];if(_0x2244dd[_0x3f4011][_0x64e1('0x29')]){_0x2244dd[_0x3f4011][_0x64e1('0x2a')]=moment()[_0x64e1('0x28')](_0x64e1('0x2b'));}if(_0x2244dd[_0x3f4011][_0x64e1('0x2c')]){_0x2244dd[_0x3f4011]['queuecallerexitAt']=moment()[_0x64e1('0x28')](_0x64e1('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x2244dd[_0x3f4011]);}RpcVoiceQueueReport['create'](_0x2244dd[_0x3f4011]);}};function extractCalleridNumber(_0x1c4216){var _0x29b662=_0x1c4216[_0x64e1('0x2d')](/<(.*?)>/);return _0x29b662?_0x29b662[0x1]:_0x1c4216;}Report[_0x64e1('0xf')][_0x64e1('0x2e')]=function(_0x3e1b91){for(var _0x1bdb7a=0x0;_0x1bdb7a/);return _0x39872d?_0x39872d[0x1]:_0x2f6405;}Report['prototype'][_0x857a('0x2d')]=function(_0xe321b){for(var _0x3e747f=0x0;_0x3e747f',_0x579357[_0x857a('0x44')],_0x579357[_0x857a('0x3e')]);}if(RpcVoiceTransferReport[_0x857a('0x45')][_0x579357['linkedid']]){var _0xb35288=RpcVoiceTransferReport[_0x857a('0x45')][_0x579357[_0x857a('0x46')]];_0xb35288[_0x857a('0x47')]=_0x579357[_0x857a('0x48')];RpcVoiceTransferReport['blindTransfer'](_0xb35288);delete RpcVoiceTransferReport[_0x857a('0x45')][_0x579357['linkedid']];}if(_[_0x857a('0x28')](_0x579357[_0x857a('0x36')])){_0x579357[_0x857a('0x36')]=this[_0x857a('0x49')](_0x579357);}if(_[_0x857a('0x28')](_0x579357['UserId'])){var _0x1918fe=_0x579357['channel'][_0x857a('0x30')]('-')[0x0];var _0x5aaeee=this[_0x857a('0xc')][_0x1918fe];if(!_0x5aaeee)_0x5aaeee=this['getAgentByInternal'](_0x579357[_0x857a('0x1f')]);if(_0x5aaeee){_0x579357[_0x857a('0x4a')]=_0x5aaeee['id'];_0x579357['membername']=_0x5aaeee[_0x857a('0x1e')];}}RpcVoiceCallReport[_0x857a('0x4b')](_0x579357);if(_0x579357['monitor']){for(var _0x2f4947=0x0;_0x2f4947<_0x579357[_0x857a('0x4c')][_0x857a('0x23')];_0x2f4947+=0x1){_0x579357[_0x857a('0x4d')]=_0x579357[_0x857a('0x4c')][_0x2f4947][_0x857a('0x4e')];_0x579357[_0x857a('0x4f')]=_0x579357['monitors'][_0x2f4947][_0x857a('0x4f')];if(_0x579357[_0x857a('0x35')]==_0x857a('0x3c')){_0x579357[_0x857a('0x3e')]=_0x579357[_0x857a('0x25')];_0x579357['calleridname']=_0x579357['connectedlinename'];_0x579357['connectedlinenum']=_0x579357[_0x857a('0x1f')];_0x579357[_0x857a('0x50')]=_0x579357[_0x857a('0x51')];_0x579357[_0x857a('0x35')]=_0x579357[_0x857a('0x3f')];}else if(_0x579357[_0x857a('0x35')]==_0x857a('0x52')){_0x579357[_0x857a('0x3e')]=_0x579357[_0x857a('0x34')];_0x579357[_0x857a('0x35')]=_0x579357[_0x857a('0x3f')];}RpcVoiceRecording[_0x857a('0x4b')](_0x579357);}}};Report[_0x857a('0xe')][_0x857a('0x17')]=function(_0x46eb24){if(_['isArray'](_0x46eb24)){_0x46eb24[_0x857a('0x53')](function(_0x545b6a){RpcVoiceAgentReport[_0x857a('0x4b')](_0x545b6a);});}else{RpcVoiceAgentReport[_0x857a('0x4b')](_0x46eb24);}};Report[_0x857a('0xe')][_0x857a('0x19')]=function(_0x23897e){RpcVoiceDialReport[_0x857a('0x4b')](_0x23897e);var _0x1028df;var _0x4e455d;var _0x3ca7be=_0x23897e['channel'];if(_[_0x857a('0x54')](_0x3ca7be,_0x857a('0x55'))){_0x4e455d=_0x3ca7be[_0x857a('0x56')](_0x3ca7be['indexOf']('/')+0x1,_0x3ca7be[_0x857a('0x57')]('@'));_0x1028df=_['find'](this[_0x857a('0xc')],function(_0x113ef8){return _0x113ef8['mobile']==_0x4e455d||_0x113ef8['phone']==_0x4e455d||_0x113ef8[_0x857a('0x1f')]==_0x4e455d;});}else{_0x4e455d=_0x3ca7be['substring'](_0x3ca7be[_0x857a('0x57')]('/')+0x1,_0x3ca7be[_0x857a('0x58')]('-'));_0x1028df=this['findAgent'](_0x4e455d);}if(_0x1028df){_0x23897e[_0x857a('0x20')]=_['isNil'](_0x1028df[_0x857a('0x20')])?util[_0x857a('0x21')](_0x857a('0x22'),_0x1028df[_0x857a('0x1e')]):_0x1028df['interface'];_0x23897e[_0x857a('0x51')]=_0x1028df['name'];_0x23897e[_0x857a('0x1f')]=_0x1028df[_0x857a('0x1f')];RpcMemberReport[_0x857a('0x19')](_0x23897e);}};Report[_0x857a('0xe')][_0x857a('0x1b')]=function(_0x3c6ba1){RpcVoiceTransferReport['transfers'][_0x3c6ba1[_0x857a('0x59')]]=_0x3c6ba1;};Report[_0x857a('0xe')][_0x857a('0x5a')]=function(_0x254eca){RpcVoiceTransferReport[_0x857a('0x5a')](_0x254eca);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 4e2da12..a1a4264 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x923d=['registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','username','state','debug','[userReport][registry]','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','trunk:save','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','name','Local','substring','indexOf','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','peerstatus','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind'];(function(_0x74594c,_0x15bdc4){var _0x5164a9=function(_0x4f9b06){while(--_0x4f9b06){_0x74594c['push'](_0x74594c['shift']());}};_0x5164a9(++_0x15bdc4);}(_0x923d,0x11e));var _0xd923=function(_0x4828ce,_0x2201c1){_0x4828ce=_0x4828ce-0x0;var _0x294c2b=_0x923d[_0x4828ce];return _0x294c2b;};'use strict';var _=require('lodash');var moment=require(_0xd923('0x0'));var util=require('util');var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xd923('0x1'));var logger=require('../../../config/logger')(_0xd923('0x2'));var ami=require(_0xd923('0x3'));config['redis']=_[_0xd923('0x4')](config[_0xd923('0x5')],{'host':_0xd923('0x6'),'port':0x18eb});var io=require(_0xd923('0x7'))(new Redis(config['redis']));function UserReport(_0x2bb0de){this[_0xd923('0x8')]=_0x2bb0de['trunks'];this[_0xd923('0x9')]=_0x2bb0de[_0xd923('0x9')];this['telephones']=_0x2bb0de[_0xd923('0xa')];ami['on'](_0xd923('0xb'),this[_0xd923('0xc')][_0xd923('0xd')](this));ami['on'](_0xd923('0xe'),this[_0xd923('0xc')][_0xd923('0xd')](this));ami['on'](_0xd923('0xf'),this[_0xd923('0x10')][_0xd923('0xd')](this));ami['on']('peerstatus',this[_0xd923('0x11')]['bind'](this));return this[_0xd923('0x12')]();}function showSipRegistrations(){Promise[_0xd923('0x13')]()[_0xd923('0x14')](ami[_0xd923('0x15')]())[_0xd923('0x16')](function(_0x554444){logger[_0xd923('0x17')](_0xd923('0x18'),util['inspect'](_0x554444,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xd923('0x13')]()[_0xd923('0x14')](ami[_0xd923('0x19')]())['catch'](function(_0x37b856){logger['error'](_0xd923('0x1a'),util[_0xd923('0x1b')](_0x37b856,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xd923('0x13')]()[_0xd923('0x14')](ami[_0xd923('0x1c')]())['catch'](function(_0x309f19){logger['error'](_0xd923('0x1d'),util[_0xd923('0x1b')](_0x309f19,{'showHidden':![],'depth':null}));});}UserReport[_0xd923('0x1e')][_0xd923('0x12')]=function(){setInterval(function(){BPromise[_0xd923('0x13')]()[_0xd923('0x14')](showSipRegistrations())[_0xd923('0x14')](listDeviceStates())[_0xd923('0x14')](showPeersStatus());},0x32c8);};UserReport[_0xd923('0x1e')][_0xd923('0x1f')]=function(_0x56c30b){return _0x56c30b!==null&&!_[_0xd923('0x20')](_0x56c30b);};UserReport[_0xd923('0x1e')][_0xd923('0x21')]=function(_0x4fd729,_0x5c542f,_0x18a6d0){io['to'](_0x4fd729)[_0xd923('0x21')](_0x5c542f,_0x18a6d0);};UserReport[_0xd923('0x1e')][_0xd923('0xc')]=function(_0xe67114){try{if(this['isNotNull'](_0xe67114)){logger['info']('[userReport][registry]\x20registry:%s\x20state:%s',_0xe67114[_0xd923('0x22')],_0xe67114[_0xd923('0x23')]);logger[_0xd923('0x24')](_0xd923('0x25'),util[_0xd923('0x1b')](_0xe67114,{'showHidden':![],'depth':null}));var _0x19683e=_['find'](this[_0xd923('0x8')],{'defaultuser':_0xe67114[_0xd923('0x22')]});if(_0x19683e){_0xe67114[_0xd923('0x26')]=_0xe67114[_0xd923('0x23')];_[_0xd923('0x27')](_0x19683e,_[_0xd923('0x28')](_0xe67114,[_0xd923('0x29'),_0xd923('0x2a'),_0xd923('0x22'),'state']));logger[_0xd923('0x24')](_0xd923('0x2b'),util[_0xd923('0x1b')](_0x19683e,{'showHidden':![],'depth':null}));this[_0xd923('0x21')](util[_0xd923('0x2c')](_0xd923('0x2d'),_0x19683e['name']),_0xd923('0x2e'),_0x19683e);}}}catch(_0x21c678){logger[_0xd923('0x17')](_0xd923('0x25'),util['inspect'](_0x21c678,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xd923('0x10')]=function(_0x23cddb){try{if(this[_0xd923('0x1f')](_0x23cddb)){logger[_0xd923('0x2f')](_0xd923('0x30'),_0x23cddb['device'],_0x23cddb[_0xd923('0x23')]);logger[_0xd923('0x24')](_0xd923('0x31'),util[_0xd923('0x1b')](_0x23cddb,{'showHidden':![],'depth':null}));if(this[_0xd923('0x9')][_0x23cddb[_0xd923('0x32')]]){if(!this['agents'][_0x23cddb[_0xd923('0x32')]][_0xd923('0x33')]||_0x23cddb['state'][_0xd923('0x34')]()==_0xd923('0x35')){this[_0xd923('0x9')][_0x23cddb[_0xd923('0x32')]]['local']=![];if(this[_0xd923('0x9')][_0x23cddb['device']][_0xd923('0x23')]!==_0x23cddb[_0xd923('0x23')][_0xd923('0x34')]()){this[_0xd923('0x9')][_0x23cddb[_0xd923('0x32')]][_0xd923('0x36')]=_[_0xd923('0x37')](moment()[_0xd923('0x2c')]('x'));}this['agents'][_0x23cddb[_0xd923('0x32')]][_0xd923('0x23')]=_0x23cddb['state'][_0xd923('0x34')]();this[_0xd923('0x9')][_0x23cddb[_0xd923('0x32')]]['updateStatusRealtime'](_0x23cddb);}}else if(this[_0xd923('0xa')][_0x23cddb[_0xd923('0x32')]]){if(this[_0xd923('0xa')][_0x23cddb[_0xd923('0x32')]][_0xd923('0x23')]!==_0x23cddb[_0xd923('0x23')][_0xd923('0x34')]()){this['telephones'][_0x23cddb[_0xd923('0x32')]][_0xd923('0x36')]=_[_0xd923('0x37')](moment()[_0xd923('0x2c')]('x'));}this['telephones'][_0x23cddb[_0xd923('0x32')]][_0xd923('0x23')]=_0x23cddb[_0xd923('0x23')][_0xd923('0x34')]();logger[_0xd923('0x24')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xd923('0x1b')](this[_0xd923('0xa')][_0x23cddb[_0xd923('0x32')]],{'showHidden':![],'depth':null}));this[_0xd923('0x21')](util[_0xd923('0x2c')]('telephone:%s',this[_0xd923('0xa')][_0x23cddb[_0xd923('0x32')]]['name']),'telephone:save',this[_0xd923('0xa')][_0x23cddb[_0xd923('0x32')]]);}else if(this[_0xd923('0x8')][_0x23cddb[_0xd923('0x32')]]){if(this[_0xd923('0x8')][_0x23cddb['device']]['state']!==_0x23cddb[_0xd923('0x23')]['toLowerCase']()){this['trunks'][_0x23cddb[_0xd923('0x32')]][_0xd923('0x36')]=_[_0xd923('0x37')](moment()[_0xd923('0x2c')]('x'));}this[_0xd923('0x8')][_0x23cddb[_0xd923('0x32')]][_0xd923('0x23')]=_0x23cddb[_0xd923('0x23')][_0xd923('0x34')]();logger[_0xd923('0x24')](_0xd923('0x38'),util[_0xd923('0x1b')](this[_0xd923('0x8')][_0x23cddb[_0xd923('0x32')]],{'showHidden':![],'depth':null}));this[_0xd923('0x21')](util[_0xd923('0x2c')](_0xd923('0x2d'),this[_0xd923('0x8')][_0x23cddb[_0xd923('0x32')]][_0xd923('0x39')]),_0xd923('0x2e'),this[_0xd923('0x8')][_0x23cddb['device']]);}else if(_['startsWith'](_0x23cddb[_0xd923('0x32')],_0xd923('0x3a'))){var _0x2c5952=_0x23cddb[_0xd923('0x32')];var _0x1a8a63=_0x2c5952[_0xd923('0x3b')](_0x2c5952['indexOf']('/')+0x1,_0x2c5952[_0xd923('0x3c')]('@'));var _0x205bde=_['find'](this[_0xd923('0x9')],function(_0x1ded07){return _0x1ded07['mobile']==_0x1a8a63||_0x1ded07[_0xd923('0x3d')]==_0x1a8a63||_0x1ded07[_0xd923('0x3e')]==_0x1a8a63;});if(_0x205bde){if(_0x205bde['state']!==_0x23cddb[_0xd923('0x23')][_0xd923('0x34')]()){_0x205bde['stateTime']=_[_0xd923('0x37')](moment()[_0xd923('0x2c')]('x'));}_0x205bde[_0xd923('0x23')]=_0x23cddb[_0xd923('0x23')]['toLowerCase']();_0x205bde[_0xd923('0x33')]=!![];_0x205bde[_0xd923('0x3f')](_0x23cddb);}}}}catch(_0x35528f){logger['error'](_0xd923('0x31'),util[_0xd923('0x1b')](_0x35528f,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xd923('0x11')]=function(_0x45e520){try{if(this[_0xd923('0x1f')](_0x45e520)&&this['isNotNull'](_0x45e520['peerstatus'])){logger[_0xd923('0x2f')](_0xd923('0x40'),_0x45e520['peer'],_0x45e520[_0xd923('0x41')],_0x45e520['peerstatus']);logger['debug'](_0xd923('0x42'),util[_0xd923('0x1b')](_0x45e520,{'showHidden':![],'depth':null}));if(this['agents'][_0x45e520[_0xd923('0x43')]]){if(!this[_0xd923('0x9')][_0x45e520[_0xd923('0x43')]][_0xd923('0x33')]||_0x45e520['peerstatus']['toLowerCase']()==_0xd923('0x44')){this[_0xd923('0x9')][_0x45e520['peer']]['local']=![];this['agents'][_0x45e520[_0xd923('0x43')]]['status']=_0x45e520[_0xd923('0x45')]['toLowerCase']();this['agents'][_0x45e520[_0xd923('0x43')]][_0xd923('0x41')]=_0x45e520[_0xd923('0x41')];this['agents'][_0x45e520[_0xd923('0x43')]][_0xd923('0x3f')](_0x45e520);}}else if(this[_0xd923('0xa')][_0x45e520[_0xd923('0x43')]]){this['telephones'][_0x45e520[_0xd923('0x43')]][_0xd923('0x46')]=_0x45e520[_0xd923('0x45')][_0xd923('0x34')]();this[_0xd923('0xa')][_0x45e520[_0xd923('0x43')]][_0xd923('0x41')]=_0x45e520[_0xd923('0x41')];logger['debug'](_0xd923('0x47'),util[_0xd923('0x1b')](this[_0xd923('0xa')][_0x45e520[_0xd923('0x43')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('telephone:%s',this[_0xd923('0xa')][_0x45e520[_0xd923('0x43')]][_0xd923('0x39')]),_0xd923('0x48'),this['telephones'][_0x45e520[_0xd923('0x43')]]);}else if(this[_0xd923('0x8')][_0x45e520[_0xd923('0x43')]]){this[_0xd923('0x8')][_0x45e520[_0xd923('0x43')]][_0xd923('0x46')]=_0x45e520[_0xd923('0x45')]['toLowerCase']();this['trunks'][_0x45e520[_0xd923('0x43')]][_0xd923('0x41')]=_0x45e520[_0xd923('0x41')];logger[_0xd923('0x24')](_0xd923('0x49'),util['inspect'](this[_0xd923('0x8')][_0x45e520[_0xd923('0x43')]],{'showHidden':![],'depth':null}));this[_0xd923('0x21')](util[_0xd923('0x2c')](_0xd923('0x2d'),this[_0xd923('0x8')][_0x45e520[_0xd923('0x43')]][_0xd923('0x39')]),_0xd923('0x2e'),this['trunks'][_0x45e520[_0xd923('0x43')]]);}}}catch(_0x20e855){logger[_0xd923('0x17')](_0xd923('0x42'),util[_0xd923('0x1b')](_0x20e855,{'showHidden':![],'depth':null}));}};module[_0xd923('0x4a')]=UserReport; \ No newline at end of file +var _0x5a42=['resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','find','state','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','isNotNull','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','inuse','stateTime','toNumber','format','updateStatusRealtime','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','substring','indexOf','mobile','phone','local','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','util','ioredis','bluebird','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow'];(function(_0x5bac30,_0x118582){var _0x152f17=function(_0x829ae7){while(--_0x829ae7){_0x5bac30['push'](_0x5bac30['shift']());}};_0x152f17(++_0x118582);}(_0x5a42,0x85));var _0x25a4=function(_0x488d7f,_0x5f0242){_0x488d7f=_0x488d7f-0x0;var _0x37f122=_0x5a42[_0x488d7f];return _0x37f122;};'use strict';var _=require(_0x25a4('0x0'));var moment=require('moment');var util=require(_0x25a4('0x1'));var Redis=require(_0x25a4('0x2'));var BPromise=require(_0x25a4('0x3'));var config=require(_0x25a4('0x4'));var logger=require(_0x25a4('0x5'))('ami');var ami=require(_0x25a4('0x6'));config[_0x25a4('0x7')]=_['defaults'](config[_0x25a4('0x7')],{'host':_0x25a4('0x8'),'port':0x18eb});var io=require(_0x25a4('0x9'))(new Redis(config['redis']));function UserReport(_0x1fd855){this[_0x25a4('0xa')]=_0x1fd855[_0x25a4('0xa')];this[_0x25a4('0xb')]=_0x1fd855['agents'];this[_0x25a4('0xc')]=_0x1fd855['telephones'];ami['on'](_0x25a4('0xd'),this[_0x25a4('0xe')][_0x25a4('0xf')](this));ami['on'](_0x25a4('0x10'),this[_0x25a4('0xe')]['bind'](this));ami['on'](_0x25a4('0x11'),this[_0x25a4('0x12')]['bind'](this));ami['on']('peerstatus',this[_0x25a4('0x13')]['bind'](this));return this[_0x25a4('0x14')]();}function showSipRegistrations(){Promise[_0x25a4('0x15')]()['then'](ami[_0x25a4('0x16')]())[_0x25a4('0x17')](function(_0x4d04d0){logger[_0x25a4('0x18')](_0x25a4('0x19'),util[_0x25a4('0x1a')](_0x4d04d0,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x25a4('0x15')]()[_0x25a4('0x1b')](ami['actionDeviceStateList']())[_0x25a4('0x17')](function(_0x4b1845){logger['error'](_0x25a4('0x1c'),util[_0x25a4('0x1a')](_0x4b1845,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x25a4('0x1b')](ami[_0x25a4('0x1d')]())['catch'](function(_0x5bf08b){logger['error'](_0x25a4('0x1e'),util[_0x25a4('0x1a')](_0x5bf08b,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x25a4('0x14')]=function(){setInterval(function(){BPromise['resolve']()[_0x25a4('0x1b')](showSipRegistrations())[_0x25a4('0x1b')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x25a4('0x1f')]['isNotNull']=function(_0x26b363){return _0x26b363!==null&&!_[_0x25a4('0x20')](_0x26b363);};UserReport[_0x25a4('0x1f')][_0x25a4('0x21')]=function(_0x3f0347,_0x5d58a4,_0x2fe3b1){io['to'](_0x3f0347)[_0x25a4('0x21')](_0x5d58a4,_0x2fe3b1);};UserReport[_0x25a4('0x1f')][_0x25a4('0xe')]=function(_0x1cf823){try{if(this['isNotNull'](_0x1cf823)){logger['info'](_0x25a4('0x22'),_0x1cf823[_0x25a4('0x23')],_0x1cf823['state']);logger[_0x25a4('0x24')](_0x25a4('0x25'),util['inspect'](_0x1cf823,{'showHidden':![],'depth':null}));var _0x58a840=_[_0x25a4('0x26')](this['trunks'],{'defaultuser':_0x1cf823[_0x25a4('0x23')]});if(_0x58a840){_0x1cf823['stateRegistry']=_0x1cf823[_0x25a4('0x27')];_['merge'](_0x58a840,_[_0x25a4('0x28')](_0x1cf823,['event',_0x25a4('0x29'),'username',_0x25a4('0x27')]));logger['debug'](_0x25a4('0x2a'),util[_0x25a4('0x1a')](_0x58a840,{'showHidden':![],'depth':null}));this[_0x25a4('0x21')](util['format'](_0x25a4('0x2b'),_0x58a840[_0x25a4('0x2c')]),'trunk:save',_0x58a840);}}}catch(_0x606219){logger['error']('[userReport][registry]',util[_0x25a4('0x1a')](_0x606219,{'showHidden':![],'depth':null}));}};UserReport[_0x25a4('0x1f')][_0x25a4('0x12')]=function(_0x5d15a4){try{if(this[_0x25a4('0x2d')](_0x5d15a4)){logger[_0x25a4('0x2e')](_0x25a4('0x2f'),_0x5d15a4[_0x25a4('0x30')],_0x5d15a4[_0x25a4('0x27')]);logger[_0x25a4('0x24')](_0x25a4('0x31'),util['inspect'](_0x5d15a4,{'showHidden':![],'depth':null}));if(this['agents'][_0x5d15a4[_0x25a4('0x30')]]){if(!this['agents'][_0x5d15a4[_0x25a4('0x30')]]['local']||_0x5d15a4[_0x25a4('0x27')][_0x25a4('0x32')]()==_0x25a4('0x33')){this[_0x25a4('0xb')][_0x5d15a4[_0x25a4('0x30')]]['local']=![];if(this[_0x25a4('0xb')][_0x5d15a4['device']][_0x25a4('0x27')]!==_0x5d15a4[_0x25a4('0x27')][_0x25a4('0x32')]()){this[_0x25a4('0xb')][_0x5d15a4[_0x25a4('0x30')]][_0x25a4('0x34')]=_[_0x25a4('0x35')](moment()[_0x25a4('0x36')]('x'));}this['agents'][_0x5d15a4[_0x25a4('0x30')]]['state']=_0x5d15a4['state'][_0x25a4('0x32')]();this[_0x25a4('0xb')][_0x5d15a4[_0x25a4('0x30')]][_0x25a4('0x37')](_0x5d15a4);}}else if(this[_0x25a4('0xc')][_0x5d15a4[_0x25a4('0x30')]]){if(this['telephones'][_0x5d15a4[_0x25a4('0x30')]][_0x25a4('0x27')]!==_0x5d15a4['state']['toLowerCase']()){this[_0x25a4('0xc')][_0x5d15a4[_0x25a4('0x30')]][_0x25a4('0x34')]=_['toNumber'](moment()[_0x25a4('0x36')]('x'));}this[_0x25a4('0xc')][_0x5d15a4[_0x25a4('0x30')]][_0x25a4('0x27')]=_0x5d15a4[_0x25a4('0x27')][_0x25a4('0x32')]();logger[_0x25a4('0x24')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x25a4('0xc')][_0x5d15a4[_0x25a4('0x30')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x25a4('0x36')](_0x25a4('0x38'),this['telephones'][_0x5d15a4['device']][_0x25a4('0x2c')]),'telephone:save',this[_0x25a4('0xc')][_0x5d15a4[_0x25a4('0x30')]]);}else if(this[_0x25a4('0xa')][_0x5d15a4[_0x25a4('0x30')]]){if(this[_0x25a4('0xa')][_0x5d15a4[_0x25a4('0x30')]][_0x25a4('0x27')]!==_0x5d15a4[_0x25a4('0x27')][_0x25a4('0x32')]()){this[_0x25a4('0xa')][_0x5d15a4[_0x25a4('0x30')]][_0x25a4('0x34')]=_[_0x25a4('0x35')](moment()['format']('x'));}this[_0x25a4('0xa')][_0x5d15a4[_0x25a4('0x30')]]['state']=_0x5d15a4[_0x25a4('0x27')][_0x25a4('0x32')]();logger[_0x25a4('0x24')](_0x25a4('0x39'),util[_0x25a4('0x1a')](this[_0x25a4('0xa')][_0x5d15a4['device']],{'showHidden':![],'depth':null}));this[_0x25a4('0x21')](util[_0x25a4('0x36')](_0x25a4('0x2b'),this['trunks'][_0x5d15a4[_0x25a4('0x30')]][_0x25a4('0x2c')]),_0x25a4('0x3a'),this[_0x25a4('0xa')][_0x5d15a4[_0x25a4('0x30')]]);}else if(_[_0x25a4('0x3b')](_0x5d15a4[_0x25a4('0x30')],_0x25a4('0x3c'))){var _0x402cf4=_0x5d15a4[_0x25a4('0x30')];var _0x42f15=_0x402cf4[_0x25a4('0x3d')](_0x402cf4[_0x25a4('0x3e')]('/')+0x1,_0x402cf4[_0x25a4('0x3e')]('@'));var _0x3d90d1=_[_0x25a4('0x26')](this[_0x25a4('0xb')],function(_0xd56d93){return _0xd56d93[_0x25a4('0x3f')]==_0x42f15||_0xd56d93[_0x25a4('0x40')]==_0x42f15||_0xd56d93['accountcode']==_0x42f15;});if(_0x3d90d1){if(_0x3d90d1[_0x25a4('0x27')]!==_0x5d15a4['state'][_0x25a4('0x32')]()){_0x3d90d1['stateTime']=_[_0x25a4('0x35')](moment()[_0x25a4('0x36')]('x'));}_0x3d90d1['state']=_0x5d15a4[_0x25a4('0x27')][_0x25a4('0x32')]();_0x3d90d1[_0x25a4('0x41')]=!![];_0x3d90d1[_0x25a4('0x37')](_0x5d15a4);}}}}catch(_0x510a58){logger[_0x25a4('0x18')]('[userReport][devicestatechange]',util['inspect'](_0x510a58,{'showHidden':![],'depth':null}));}};UserReport[_0x25a4('0x1f')][_0x25a4('0x13')]=function(_0x2c91f0){try{if(this[_0x25a4('0x2d')](_0x2c91f0)&&this[_0x25a4('0x2d')](_0x2c91f0[_0x25a4('0x42')])){logger[_0x25a4('0x2e')](_0x25a4('0x43'),_0x2c91f0[_0x25a4('0x44')],_0x2c91f0[_0x25a4('0x45')],_0x2c91f0[_0x25a4('0x42')]);logger[_0x25a4('0x24')]('[userReport][peerstatus]',util[_0x25a4('0x1a')](_0x2c91f0,{'showHidden':![],'depth':null}));if(this[_0x25a4('0xb')][_0x2c91f0[_0x25a4('0x44')]]){if(!this[_0x25a4('0xb')][_0x2c91f0[_0x25a4('0x44')]][_0x25a4('0x41')]||_0x2c91f0['peerstatus'][_0x25a4('0x32')]()==_0x25a4('0x46')){this[_0x25a4('0xb')][_0x2c91f0[_0x25a4('0x44')]]['local']=![];this['agents'][_0x2c91f0[_0x25a4('0x44')]][_0x25a4('0x47')]=_0x2c91f0[_0x25a4('0x42')][_0x25a4('0x32')]();this[_0x25a4('0xb')][_0x2c91f0[_0x25a4('0x44')]][_0x25a4('0x45')]=_0x2c91f0[_0x25a4('0x45')];this['agents'][_0x2c91f0['peer']]['updateStatusRealtime'](_0x2c91f0);}}else if(this[_0x25a4('0xc')][_0x2c91f0[_0x25a4('0x44')]]){this[_0x25a4('0xc')][_0x2c91f0[_0x25a4('0x44')]][_0x25a4('0x47')]=_0x2c91f0[_0x25a4('0x42')][_0x25a4('0x32')]();this[_0x25a4('0xc')][_0x2c91f0[_0x25a4('0x44')]][_0x25a4('0x45')]=_0x2c91f0[_0x25a4('0x45')];logger['debug'](_0x25a4('0x48'),util[_0x25a4('0x1a')](this[_0x25a4('0xc')][_0x2c91f0[_0x25a4('0x44')]],{'showHidden':![],'depth':null}));this[_0x25a4('0x21')](util[_0x25a4('0x36')](_0x25a4('0x38'),this[_0x25a4('0xc')][_0x2c91f0['peer']][_0x25a4('0x2c')]),_0x25a4('0x49'),this[_0x25a4('0xc')][_0x2c91f0['peer']]);}else if(this[_0x25a4('0xa')][_0x2c91f0[_0x25a4('0x44')]]){this['trunks'][_0x2c91f0[_0x25a4('0x44')]][_0x25a4('0x47')]=_0x2c91f0[_0x25a4('0x42')][_0x25a4('0x32')]();this[_0x25a4('0xa')][_0x2c91f0[_0x25a4('0x44')]]['address']=_0x2c91f0['address'];logger[_0x25a4('0x24')](_0x25a4('0x4a'),util['inspect'](this[_0x25a4('0xa')][_0x2c91f0['peer']],{'showHidden':![],'depth':null}));this[_0x25a4('0x21')](util[_0x25a4('0x36')]('trunk:%s',this[_0x25a4('0xa')][_0x2c91f0[_0x25a4('0x44')]][_0x25a4('0x2c')]),_0x25a4('0x3a'),this[_0x25a4('0xa')][_0x2c91f0['peer']]);}}}catch(_0x46ddfc){logger[_0x25a4('0x18')](_0x25a4('0x4b'),util['inspect'](_0x46ddfc,{'showHidden':![],'depth':null}));}};module[_0x25a4('0x4c')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 7909daf..e480911 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffdd=['addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','secondtransfereruniqueid','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]','exports','moment','ioredis','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceChannels','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','syncAgentComplete','varset','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','inspect','interface','voiceQueues','called','mandatoryDisposition','type','inbound','assign','omit','event','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','destchannelstatedesc','holdtime','lastevent','connect','merge','pick','accountcode','custom:agentconnect','user:%s','user:agentconnect','agentcomplete','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','name','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acwtime','acwTimeout','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:'];(function(_0x476b5f,_0x1f9952){var _0x5a23d8=function(_0x50b464){while(--_0x50b464){_0x476b5f['push'](_0x476b5f['shift']());}};_0x5a23d8(++_0x1f9952);}(_0xffdd,0x16e));var _0xdffd=function(_0x3e67b6,_0x51e40b){_0x3e67b6=_0x3e67b6-0x0;var _0x934c7e=_0xffdd[_0x3e67b6];return _0x934c7e;};'use strict';var _=require('lodash');var moment=require(_0xdffd('0x0'));var util=require('util');var Redis=require(_0xdffd('0x1'));var config=require(_0xdffd('0x2'));var logger=require(_0xdffd('0x3'))('ami');var ami=require(_0xdffd('0x4'));config['redis']=_[_0xdffd('0x5')](config[_0xdffd('0x6')],{'host':_0xdffd('0x7'),'port':0x18eb});var io=require(_0xdffd('0x8'))(new Redis(config[_0xdffd('0x6')]));function VoiceAgentReport(_0x15c9a0){this[_0xdffd('0x9')]={};this[_0xdffd('0xa')]=_0x15c9a0['channels'];this['voiceQueues']=_0x15c9a0['voiceQueues'];this[_0xdffd('0xb')]=_0x15c9a0[_0xdffd('0xb')];this[_0xdffd('0xc')]={};ami['on'](_0xdffd('0xd'),this[_0xdffd('0xe')][_0xdffd('0xf')](this));ami['on'](_0xdffd('0x10'),this[_0xdffd('0x11')][_0xdffd('0xf')](this));ami['on'](_0xdffd('0x12'),this[_0xdffd('0x13')][_0xdffd('0xf')](this));ami['on']('queuecallerabandon',this[_0xdffd('0x14')][_0xdffd('0xf')](this));ami['on']('agentcomplete',this[_0xdffd('0x15')]['bind'](this));ami['on'](_0xdffd('0x16'),this['syncVarSet'][_0xdffd('0xf')](this));ami['on'](_0xdffd('0x17'),this[_0xdffd('0x18')][_0xdffd('0xf')](this));ami['on']('musiconholdstart',this[_0xdffd('0x19')][_0xdffd('0xf')](this));ami['on'](_0xdffd('0x1a'),this[_0xdffd('0x1b')][_0xdffd('0xf')](this));ami['on'](_0xdffd('0x1c'),this[_0xdffd('0x1d')][_0xdffd('0xf')](this));ami['on'](_0xdffd('0x1e'),this['syncBlindTransfer'][_0xdffd('0xf')](this));}VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x20')]=function(_0x53950b,_0x25ab8e,_0x7b22e7){io['to'](_0x53950b)['emit'](_0x25ab8e,_0x7b22e7);};VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x21')]=function(_0x2e4cba){return _0x2e4cba!==null&&!_[_0xdffd('0x22')](_0x2e4cba);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x67f92f){try{if(this[_0xdffd('0x21')](_0x67f92f)){logger[_0xdffd('0x23')](_0xdffd('0x24'),_0x67f92f[_0xdffd('0x25')],_0x67f92f[_0xdffd('0x26')],_0x67f92f[_0xdffd('0x27')]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20event:',_0x67f92f[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x67f92f,{'showHidden':![],'depth':null}));if(_[_0xdffd('0x22')](this[_0xdffd('0x9')][_0x67f92f[_0xdffd('0x25')]])){this[_0xdffd('0x9')][_0x67f92f[_0xdffd('0x25')]]={};}var _0x16e940=this[_0xdffd('0xb')][_0x67f92f[_0xdffd('0x29')]];var _0x329ea1=this['channels'][_0x67f92f[_0xdffd('0x25')]][_0x67f92f[_0xdffd('0x27')]];var _0x5d78c3=this[_0xdffd('0x2a')][_0x67f92f['queue']];var _0x499119=this[_0xdffd('0xc')][_0x67f92f[_0xdffd('0x25')]];if(_[_0xdffd('0x22')](_0x329ea1)){_0x329ea1={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xdffd('0x2b'),'mandatoryDisposition':_0x5d78c3&&_0x5d78c3['mandatoryDisposition']?_0x5d78c3[_0xdffd('0x2c')]:![],'type':_0x5d78c3&&_0x5d78c3[_0xdffd('0x2d')]?_0x5d78c3[_0xdffd('0x2d')]:_0xdffd('0x2e'),'variables':_0x499119,'motionChannel':'voice'};}Object[_0xdffd('0x2f')](_0x329ea1,_[_0xdffd('0x30')](_0x67f92f,[_0xdffd('0x31'),'privilege']));this[_0xdffd('0x9')][_0x67f92f[_0xdffd('0x25')]][_0x67f92f[_0xdffd('0x27')]]=_0x329ea1;logger[_0xdffd('0x32')](_0xdffd('0x33'),_0x67f92f[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x329ea1,{'showHidden':![],'depth':null}));ami[_0xdffd('0x20')](_0xdffd('0x34'),_0x329ea1);var _0x10fc6f={'id':_0x16e940['id'],'calleridnum':_0x329ea1[_0xdffd('0x35')],'queue':_0x329ea1[_0xdffd('0x36')],'variables':_0x329ea1[_0xdffd('0xc')],'uniqueid':_0x67f92f[_0xdffd('0x25')]};logger[_0xdffd('0x32')](_0xdffd('0x37'),_0x67f92f['uniqueid'],util[_0xdffd('0x28')](_0x10fc6f,{'showHidden':![],'depth':null}));this['emit'](util[_0xdffd('0x38')]('user:%s',_0x67f92f['membername']),_0xdffd('0x39'),_0x10fc6f);}}catch(_0x50c512){logger[_0xdffd('0x3a')](_0xdffd('0x3b'),_0x67f92f['uniqueid'],util[_0xdffd('0x28')](_0x50c512,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x11')]=function(_0x3ee6be){try{if(this[_0xdffd('0x21')](_0x3ee6be)){if(this['channels'][_0x3ee6be[_0xdffd('0x25')]]){for(var _0x4fceeb in this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]]){if(this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0xdffd('0x3c')](_0x4fceeb)){if(_0x3ee6be['destuniqueid']===_0x4fceeb){logger['info'](_0xdffd('0x3d'),_0x3ee6be['uniqueid'],_0x3ee6be['membername'],_0x3ee6be[_0xdffd('0x27')]);this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x3e')]=moment()['format'](_0xdffd('0x3f'));this['channels'][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x40')]=_0x3ee6be[_0xdffd('0x40')];this['channels'][_0x3ee6be['uniqueid']][_0x4fceeb]['connectedlinenum']=_0x3ee6be['connectedlinenum'];this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb]['destchannelstate']=_0x3ee6be['destchannelstate'];this['channels'][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x41')]=_0x3ee6be[_0xdffd('0x41')];this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x42')]=_0x3ee6be[_0xdffd('0x42')];this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x43')]=_0xdffd('0x44');_[_0xdffd('0x45')](this[_0xdffd('0xb')][_0x3ee6be[_0xdffd('0x29')]],_[_0xdffd('0x46')](_0x3ee6be,[_0xdffd('0x36'),'destconnectedlinenum']));var _0x20ee40=this['agents'][_0x3ee6be[_0xdffd('0x29')]];var _0x103955={'id':_0x20ee40['id'],'name':_0x20ee40['name'],'agentconnected':!![],'destaccountcode':_0x20ee40[_0xdffd('0x47')],'destconnectedlinenum':this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x3ee6be[_0xdffd('0x27')]]['exten'],'queue':this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x3ee6be[_0xdffd('0x27')]]['queue'],'uniqueid':this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x3ee6be[_0xdffd('0x27')]]['uniqueid']};ami[_0xdffd('0x20')](_0xdffd('0x48'),this['channels'][_0x3ee6be['uniqueid']][_0x3ee6be[_0xdffd('0x27')]]);this[_0xdffd('0x20')](util['format'](_0xdffd('0x49'),_0x3ee6be[_0xdffd('0x26')]),_0xdffd('0x4a'),_0x103955);}else if(!this['channels'][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x12')]&&!this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x4b')]){logger[_0xdffd('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x3ee6be['uniqueid'],this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x26')],_0x4fceeb);this[_0xdffd('0x9')][_0x3ee6be['uniqueid']][_0x4fceeb][_0xdffd('0x12')]=!![];this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x4c')]=moment()[_0xdffd('0x38')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb]['answeredelsewheredestinationuniqueid']=_0x3ee6be[_0xdffd('0x27')];this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x4d')]=_0x3ee6be[_0xdffd('0x26')];this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x43')]=_0xdffd('0x4e');this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb][_0xdffd('0x4f')]='answered_elsewhere';logger[_0xdffd('0x32')](_0xdffd('0x50'),_0x3ee6be[_0xdffd('0x25')],util[_0xdffd('0x28')](this[_0xdffd('0x9')][_0x3ee6be[_0xdffd('0x25')]][_0x4fceeb],{'showHidden':![],'depth':null}));ami['emit'](_0xdffd('0x51'),this['channels'][_0x3ee6be['uniqueid']][_0x4fceeb]);}else{logger[_0xdffd('0x32')](_0xdffd('0x52'),_0x3ee6be['uniqueid']);}}}}}}catch(_0x352d7e){logger[_0xdffd('0x3a')](_0xdffd('0x53'),_0x3ee6be[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x352d7e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xdffd('0x13')]=function(_0x2c9dfc){try{if(this[_0xdffd('0x21')](_0x2c9dfc)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x2c9dfc[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x2c9dfc,{'showHidden':![],'depth':null}));if(this[_0xdffd('0x9')][_0x2c9dfc[_0xdffd('0x25')]]&&this['channels'][_0x2c9dfc[_0xdffd('0x25')]][_0x2c9dfc[_0xdffd('0x27')]]){logger[_0xdffd('0x23')](_0xdffd('0x54'),_0x2c9dfc[_0xdffd('0x25')],_0x2c9dfc['membername'],_0x2c9dfc['destuniqueid']);var _0x5aefe1=this[_0xdffd('0xb')][_0x2c9dfc[_0xdffd('0x29')]];var _0x31aaea=this[_0xdffd('0x9')][_0x2c9dfc[_0xdffd('0x25')]][_0x2c9dfc[_0xdffd('0x27')]];_0x31aaea[_0xdffd('0x12')]=!![];_0x31aaea[_0xdffd('0x4c')]=moment()[_0xdffd('0x38')](_0xdffd('0x3f'));_0x31aaea[_0xdffd('0x43')]=_0xdffd('0x55');_0x31aaea[_0xdffd('0x4f')]=_0xdffd('0x55');var _0x36c3ea={'id':_0x5aefe1['id'],'name':_0x5aefe1[_0xdffd('0x56')],'queue':_0x31aaea['queue'],'uniqueid':_0x31aaea['uniqueid']};logger[_0xdffd('0x32')](_0xdffd('0x57'),_0x2c9dfc['uniqueid'],util[_0xdffd('0x28')](_0x36c3ea,{'showHidden':![],'depth':null}));this[_0xdffd('0x20')](util[_0xdffd('0x38')](_0xdffd('0x49'),_0x5aefe1[_0xdffd('0x56')]),_0xdffd('0x58'),_0x36c3ea);ami[_0xdffd('0x20')](_0xdffd('0x59'),_0x31aaea);this[_0xdffd('0x9')][_0x2c9dfc['uniqueid']][_0x2c9dfc[_0xdffd('0x27')]]=Object[_0xdffd('0x2f')]({},_0x31aaea);}}}catch(_0x5942b3){logger[_0xdffd('0x3a')](_0xdffd('0x5a'),_0x2c9dfc[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x5942b3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x14')]=function(_0x524e89){try{if(this[_0xdffd('0x21')](_0x524e89)){logger[_0xdffd('0x32')](_0xdffd('0x5b'),_0x524e89[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x524e89,{'showHidden':![],'depth':null}));if(this[_0xdffd('0x9')][_0x524e89['uniqueid']]){for(var _0x4ba7ed in this['channels'][_0x524e89[_0xdffd('0x25')]]){if(this[_0xdffd('0x9')][_0x524e89[_0xdffd('0x25')]]['hasOwnProperty'](_0x4ba7ed)&&!this[_0xdffd('0x9')][_0x524e89[_0xdffd('0x25')]][_0x4ba7ed][_0xdffd('0x12')]&&!this[_0xdffd('0x9')][_0x524e89[_0xdffd('0x25')]][_0x4ba7ed][_0xdffd('0x4b')]){logger[_0xdffd('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x524e89['uniqueid'],this[_0xdffd('0x9')][_0x524e89['uniqueid']][_0x4ba7ed]['membername'],_0x4ba7ed);this['channels'][_0x524e89[_0xdffd('0x25')]][_0x4ba7ed]['agentringnoanswer']=!![];this['channels'][_0x524e89[_0xdffd('0x25')]][_0x4ba7ed]['agentringnoanswerAt']=moment()['format'](_0xdffd('0x3f'));this[_0xdffd('0x9')][_0x524e89[_0xdffd('0x25')]][_0x4ba7ed][_0xdffd('0x43')]=_0xdffd('0x5c');this[_0xdffd('0x9')][_0x524e89['uniqueid']][_0x4ba7ed][_0xdffd('0x4f')]='abandoned';logger[_0xdffd('0x32')](_0xdffd('0x5d'),_0x524e89['uniqueid'],util[_0xdffd('0x28')](this[_0xdffd('0x9')][_0x524e89[_0xdffd('0x25')]][_0x4ba7ed],{'showHidden':![],'depth':null}));ami[_0xdffd('0x20')](_0xdffd('0x5e'),this['channels'][_0x524e89['uniqueid']][_0x4ba7ed]);}}}}}catch(_0x41b20b){logger[_0xdffd('0x3a')](_0xdffd('0x5f'),_0x524e89[_0xdffd('0x25')],util['inspect'](_0x41b20b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x15')]=function(_0x3a7141){try{if(this[_0xdffd('0x21')](_0x3a7141)){logger[_0xdffd('0x32')](_0xdffd('0x60'),_0x3a7141[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x3a7141,{'showHidden':![],'depth':null}));if(this['channels'][_0x3a7141[_0xdffd('0x25')]]){for(var _0x1f5681 in this['channels'][_0x3a7141[_0xdffd('0x25')]]){if(this[_0xdffd('0x9')][_0x3a7141[_0xdffd('0x25')]][_0xdffd('0x3c')](_0x1f5681)){if(this[_0xdffd('0x9')][_0x3a7141[_0xdffd('0x25')]][_0x1f5681][_0xdffd('0x3e')]&&!this[_0xdffd('0x9')][_0x3a7141['uniqueid']][_0x1f5681][_0xdffd('0x4b')]){logger['info']('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3a7141[_0xdffd('0x25')],this[_0xdffd('0x9')][_0x3a7141[_0xdffd('0x25')]][_0x1f5681][_0xdffd('0x26')],_0x1f5681);this[_0xdffd('0x9')][_0x3a7141[_0xdffd('0x25')]][_0x1f5681][_0xdffd('0x4b')]=!![];this[_0xdffd('0x9')][_0x3a7141['uniqueid']][_0x1f5681][_0xdffd('0x61')]=moment()[_0xdffd('0x38')](_0xdffd('0x3f'));this[_0xdffd('0x9')][_0x3a7141['uniqueid']][_0x1f5681][_0xdffd('0x43')]=_0xdffd('0x62');this[_0xdffd('0x9')][_0x3a7141['uniqueid']][_0x1f5681]['reason']=_0x3a7141[_0xdffd('0x4f')]==_0xdffd('0x63')?_0xdffd('0x64'):_0x3a7141['reason'];this[_0xdffd('0x9')][_0x3a7141[_0xdffd('0x25')]][_0x1f5681]['talktime']=_0x3a7141[_0xdffd('0x65')];if(this['voiceQueues'][_0x3a7141[_0xdffd('0x36')]]&&this[_0xdffd('0x2a')][_0x3a7141[_0xdffd('0x36')]]['acw']){this[_0xdffd('0x9')][_0x3a7141['uniqueid']][_0x1f5681][_0xdffd('0x66')]=this[_0xdffd('0x2a')][_0x3a7141[_0xdffd('0x36')]][_0xdffd('0x67')];this[_0xdffd('0x9')][_0x3a7141[_0xdffd('0x25')]][_0x1f5681][_0xdffd('0x68')]=!![];}this['agents'][_0x3a7141[_0xdffd('0x29')]]=_[_0xdffd('0x30')](this['agents'][_0x3a7141[_0xdffd('0x29')]],[_0xdffd('0x36'),_0xdffd('0x69')]);logger[_0xdffd('0x32')](_0xdffd('0x6a'),_0x3a7141[_0xdffd('0x25')],util[_0xdffd('0x28')](this[_0xdffd('0x9')][_0x3a7141[_0xdffd('0x25')]][_0x1f5681],{'showHidden':![],'depth':null}));ami[_0xdffd('0x20')](_0xdffd('0x6b'),this['channels'][_0x3a7141[_0xdffd('0x25')]][_0x1f5681]);logger[_0xdffd('0x32')](_0xdffd('0x6c'),_0x3a7141['uniqueid'],util[_0xdffd('0x28')]({'id':this[_0xdffd('0xb')][_0x3a7141[_0xdffd('0x29')]]['id'],'destaccountcode':_0x3a7141['destaccountcode']},{'showHidden':![],'depth':null}));this[_0xdffd('0x20')](util[_0xdffd('0x38')](_0xdffd('0x49'),_0x3a7141['membername']),_0xdffd('0x6d'),{'id':this['agents'][_0x3a7141[_0xdffd('0x29')]]['id'],'destaccountcode':Number(_0x3a7141[_0xdffd('0x6e')])});}}}}}}catch(_0x1102ce){logger[_0xdffd('0x3a')](_0xdffd('0x6f'),_0x3a7141['uniqueid'],util[_0xdffd('0x28')](_0x1102ce,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x70')]=function(_0x494ea7){try{if(this[_0xdffd('0x21')](_0x494ea7)){logger[_0xdffd('0x32')](_0xdffd('0x71'),_0x494ea7[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x494ea7,{'showHidden':![],'depth':null}));this[_0xdffd('0x72')](_0x494ea7[_0xdffd('0x25')],_[_0xdffd('0x73')](_0x494ea7[_0xdffd('0x74')])[0x0],_0x494ea7[_0xdffd('0x75')]);if(this[_0xdffd('0x9')][_0x494ea7['uniqueid']]){for(var _0x2f84a9 in this[_0xdffd('0x9')][_0x494ea7['uniqueid']]){if(this[_0xdffd('0x9')][_0x494ea7[_0xdffd('0x25')]]['hasOwnProperty'](_0x2f84a9)){logger[_0xdffd('0x23')](_0xdffd('0x76'),_0x494ea7[_0xdffd('0x25')],_0x2f84a9,_[_0xdffd('0x73')](_0x494ea7[_0xdffd('0x74')])[0x0],_0x494ea7[_0xdffd('0x75')]);if(_['isUndefined'](this[_0xdffd('0x9')][_0x494ea7[_0xdffd('0x25')]][_0x2f84a9]['variables'])){this[_0xdffd('0x9')][_0x494ea7[_0xdffd('0x25')]][_0x2f84a9][_0xdffd('0xc')]={};}this[_0xdffd('0x9')][_0x494ea7['uniqueid']][_0x2f84a9][_0xdffd('0xc')]=this[_0xdffd('0xc')][_0x494ea7[_0xdffd('0x25')]];}}}}}catch(_0xbaf395){logger[_0xdffd('0x3a')]('[%s][voiceAgentReport][varset]',_0x494ea7[_0xdffd('0x25')],util['inspect'](_0xbaf395,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x72')]=function(_0x2a20e0,_0x53d431,_0x1d2134){var _0x9a8f20=[_0xdffd('0x77'),_0xdffd('0x78'),_0xdffd('0x79'),_0xdffd('0x7a'),_0xdffd('0x7b'),'rtpaudioqoslossbridged',_0xdffd('0x7c'),_0xdffd('0x7d'),'sipcallid',_0xdffd('0x7e'),_0xdffd('0x7f'),_0xdffd('0x80'),'membercalls',_0xdffd('0x81'),'memberinterface',_0xdffd('0x82'),'membername',_0xdffd('0x83'),_0xdffd('0x84')];if(!_[_0xdffd('0x85')](_0x53d431)&&!_[_0xdffd('0x86')](_0x9a8f20,_0x53d431)){if(_['isUndefined'](this['variables'][_0x2a20e0])){this[_0xdffd('0xc')][_0x2a20e0]={};}this[_0xdffd('0xc')][_0x2a20e0][_0x53d431]=_0x1d2134;}};VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x18')]=function(_0x23ec58){try{if(this[_0xdffd('0x21')](_0x23ec58)){logger[_0xdffd('0x32')](_0xdffd('0x87'),_0x23ec58[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x23ec58,{'showHidden':![],'depth':null}));if(this[_0xdffd('0x9')][_0x23ec58['uniqueid']]){for(var _0x25f274 in this['channels'][_0x23ec58[_0xdffd('0x25')]]){if(this['channels'][_0x23ec58[_0xdffd('0x25')]][_0xdffd('0x3c')](_0x25f274)){if(this[_0xdffd('0x9')][_0x23ec58[_0xdffd('0x25')]][_0x25f274][_0xdffd('0x4f')]==_0xdffd('0x63')&&this[_0xdffd('0x9')][_0x23ec58['uniqueid']][_0x25f274]['agentcomplete']){logger['info'](_0xdffd('0x88'),_0x23ec58[_0xdffd('0x25')],_0x25f274);this['channels'][_0x23ec58[_0xdffd('0x25')]][_0x25f274]['agentcompleteAt']=moment()[_0xdffd('0x38')](_0xdffd('0x3f'));}}}logger[_0xdffd('0x32')](_0xdffd('0x89'),_0x23ec58[_0xdffd('0x25')],util[_0xdffd('0x28')](_[_0xdffd('0x8a')](this[_0xdffd('0x9')][_0x23ec58[_0xdffd('0x25')]]),{'showHidden':![],'depth':null}));ami[_0xdffd('0x20')](_0xdffd('0x8b'),_[_0xdffd('0x8a')](this[_0xdffd('0x9')][_0x23ec58[_0xdffd('0x25')]]));this['deleteChannelAfterTimeout'](_0x23ec58[_0xdffd('0x25')]);}if(this[_0xdffd('0xc')][_0x23ec58[_0xdffd('0x25')]]){delete this[_0xdffd('0xc')][_0x23ec58[_0xdffd('0x25')]];}}}catch(_0x330047){logger[_0xdffd('0x3a')]('[%s][voiceAgentReport][hangup]',_0x23ec58[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x330047,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdffd('0x1f')]['syncAttendedTransfer']=function(_0x14cea3){try{if(this[_0xdffd('0x21')](_0x14cea3)){logger['debug'](_0xdffd('0x8c'),_0x14cea3[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x14cea3,{'showHidden':![],'depth':null}));if(this[_0xdffd('0x9')][_0x14cea3[_0xdffd('0x8d')]]){for(var _0x2bd615 in this[_0xdffd('0x9')][_0x14cea3[_0xdffd('0x8d')]]){if(this[_0xdffd('0x9')][_0x14cea3[_0xdffd('0x8d')]][_0xdffd('0x3c')](_0x2bd615)){if(_0x14cea3[_0xdffd('0x8e')]===_0x2bd615){logger['info'](_0xdffd('0x8f'),_0x14cea3[_0xdffd('0x25')],this['channels'][_0x14cea3[_0xdffd('0x8d')]][_0x2bd615]['membername'],_0x2bd615);var _0x5e92d8=moment();this[_0xdffd('0x9')][_0x14cea3[_0xdffd('0x8d')]][_0x2bd615]['agentcomplete']=!![];this[_0xdffd('0x9')][_0x14cea3['transfereeuniqueid']][_0x2bd615][_0xdffd('0x61')]=moment()[_0xdffd('0x38')](_0xdffd('0x3f'));this[_0xdffd('0x9')][_0x14cea3[_0xdffd('0x8d')]][_0x2bd615][_0xdffd('0x43')]=_0xdffd('0x62');this[_0xdffd('0x9')][_0x14cea3[_0xdffd('0x8d')]][_0x2bd615][_0xdffd('0x4f')]=_0xdffd('0x63');this[_0xdffd('0x9')][_0x14cea3[_0xdffd('0x8d')]][_0x2bd615][_0xdffd('0x65')]=_0x5e92d8['diff'](this[_0xdffd('0x9')][_0x14cea3['transfereeuniqueid']][_0x2bd615][_0xdffd('0x3e')],'seconds');}}}}if(this['channels'][_0x14cea3[_0xdffd('0x90')]]){var _0x36c6aa=this[_0xdffd('0x9')][_0x14cea3['secondtransfereruniqueid']];this['channels'][_0x14cea3[_0xdffd('0x90')]]=this['channels'][_0x14cea3[_0xdffd('0x8d')]];this[_0xdffd('0x9')][_0x14cea3[_0xdffd('0x8d')]]=_0x36c6aa;}}}catch(_0x487e4d){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x14cea3[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x487e4d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x91')]=function(_0x30f24f){try{if(this['isNotNull'](_0x30f24f)){logger['debug'](_0xdffd('0x92'),_0x30f24f[_0xdffd('0x25')],util['inspect'](_0x30f24f,{'showHidden':![],'depth':null}));if(this['channels'][_0x30f24f[_0xdffd('0x8d')]]){for(var _0x30bc92 in this[_0xdffd('0x9')][_0x30f24f['transfereeuniqueid']]){if(this['channels'][_0x30f24f['transfereeuniqueid']][_0xdffd('0x3c')](_0x30bc92)){if(_0x30f24f['transfereruniqueid']===_0x30bc92){logger[_0xdffd('0x23')](_0xdffd('0x93'),_0x30f24f[_0xdffd('0x25')],this[_0xdffd('0x9')][_0x30f24f['transfereeuniqueid']][_0x30bc92][_0xdffd('0x26')],_0x30bc92);var _0x2fe7ad=moment();this[_0xdffd('0x9')][_0x30f24f[_0xdffd('0x8d')]][_0x30bc92][_0xdffd('0x4b')]=!![];this[_0xdffd('0x9')][_0x30f24f[_0xdffd('0x8d')]][_0x30bc92][_0xdffd('0x61')]=_0x2fe7ad;this[_0xdffd('0x9')][_0x30f24f[_0xdffd('0x8d')]][_0x30bc92][_0xdffd('0x43')]=_0xdffd('0x62');this['channels'][_0x30f24f[_0xdffd('0x8d')]][_0x30bc92][_0xdffd('0x4f')]=_0xdffd('0x63');this[_0xdffd('0x9')][_0x30f24f[_0xdffd('0x8d')]][_0x30bc92][_0xdffd('0x65')]=_0x2fe7ad[_0xdffd('0x94')](this[_0xdffd('0x9')][_0x30f24f[_0xdffd('0x8d')]][_0x30bc92][_0xdffd('0x3e')],_0xdffd('0x95'));}}}}}}catch(_0x5dc6bf){logger['error'](_0xdffd('0x96'),_0x30f24f[_0xdffd('0x25')],util['inspect'](_0x5dc6bf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x19')]=function(_0xd5e9b9){var _0x2906a3='';try{if(this[_0xdffd('0x21')](_0xd5e9b9)){logger['debug'](_0xdffd('0x97'),_0xd5e9b9[_0xdffd('0x25')],util[_0xdffd('0x28')](_0xd5e9b9,{'showHidden':![],'depth':null}));if(_0xd5e9b9[_0xdffd('0x98')]){_0x2906a3=_0xd5e9b9[_0xdffd('0x98')][_0xdffd('0x99')](0x0,_0xd5e9b9[_0xdffd('0x98')][_0xdffd('0x9a')]('-'));if(this[_0xdffd('0xb')][_0x2906a3]){logger[_0xdffd('0x23')](_0xdffd('0x9b'),_0xd5e9b9[_0xdffd('0x25')],_0x2906a3);this[_0xdffd('0xb')][_0x2906a3][_0xdffd('0x9c')]=!![];}}}}catch(_0x448072){logger['error'](_0xdffd('0x9d'),_0xd5e9b9[_0xdffd('0x25')],util['inspect'](_0x448072,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdffd('0x1f')][_0xdffd('0x1b')]=function(_0xfdb36e){var _0x27742d='';try{if(this['isNotNull'](_0xfdb36e)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0xfdb36e[_0xdffd('0x25')],util[_0xdffd('0x28')](_0xfdb36e,{'showHidden':![],'depth':null}));if(_0xfdb36e[_0xdffd('0x98')]){_0x27742d=_0xfdb36e['channel'][_0xdffd('0x99')](0x0,_0xfdb36e['channel'][_0xdffd('0x9a')]('-'));if(this[_0xdffd('0xb')][_0x27742d]){logger[_0xdffd('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0xfdb36e['uniqueid'],_0x27742d);this[_0xdffd('0xb')][_0x27742d]['onhold']=![];}}}}catch(_0x59c5ad){logger[_0xdffd('0x3a')](_0xdffd('0x9e'),_0xfdb36e[_0xdffd('0x25')],util[_0xdffd('0x28')](_0x59c5ad,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdffd('0x1f')]['deleteChannelAfterTimeout']=function(_0x526df5,_0x5dfe75=0x2710){if(this[_0xdffd('0x9')][_0x526df5]){setTimeout(()=>{delete this[_0xdffd('0x9')][_0x526df5];},_0x5dfe75);}};module[_0xdffd('0x9f')]=VoiceAgentReport; \ No newline at end of file +var _0x3075=['bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','channel','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','ioredis','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','interface','destuniqueid','queue','format','called','mandatoryDisposition','type','assign','omit','event','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','inspect','user:%s','membername','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','merge','pick','destconnectedlinenum','name','accountcode','custom:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer'];(function(_0x3253f3,_0x1c57d8){var _0x598c26=function(_0x4c1251){while(--_0x4c1251){_0x3253f3['push'](_0x3253f3['shift']());}};_0x598c26(++_0x1c57d8);}(_0x3075,0xc0));var _0x5307=function(_0x363bc5,_0x407361){_0x363bc5=_0x363bc5-0x0;var _0x2b054a=_0x3075[_0x363bc5];return _0x2b054a;};'use strict';var _=require(_0x5307('0x0'));var moment=require(_0x5307('0x1'));var util=require('util');var Redis=require(_0x5307('0x2'));var config=require('../../../config/environment');var logger=require(_0x5307('0x3'))(_0x5307('0x4'));var ami=require(_0x5307('0x5'));config[_0x5307('0x6')]=_[_0x5307('0x7')](config[_0x5307('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5307('0x8'))(new Redis(config[_0x5307('0x6')]));function VoiceAgentReport(_0x10d770){this[_0x5307('0x9')]={};this[_0x5307('0xa')]=_0x10d770[_0x5307('0x9')];this[_0x5307('0xb')]=_0x10d770[_0x5307('0xb')];this[_0x5307('0xc')]=_0x10d770[_0x5307('0xc')];this[_0x5307('0xd')]={};ami['on'](_0x5307('0xe'),this[_0x5307('0xf')]['bind'](this));ami['on'](_0x5307('0x10'),this[_0x5307('0x11')]['bind'](this));ami['on'](_0x5307('0x12'),this[_0x5307('0x13')][_0x5307('0x14')](this));ami['on'](_0x5307('0x15'),this[_0x5307('0x16')][_0x5307('0x14')](this));ami['on'](_0x5307('0x17'),this[_0x5307('0x18')][_0x5307('0x14')](this));ami['on'](_0x5307('0x19'),this['syncVarSet'][_0x5307('0x14')](this));ami['on'](_0x5307('0x1a'),this[_0x5307('0x1b')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x5307('0x14')](this));ami['on'](_0x5307('0x1c'),this[_0x5307('0x1d')][_0x5307('0x14')](this));ami['on'](_0x5307('0x1e'),this[_0x5307('0x1f')][_0x5307('0x14')](this));ami['on'](_0x5307('0x20'),this[_0x5307('0x21')][_0x5307('0x14')](this));}VoiceAgentReport[_0x5307('0x22')][_0x5307('0x23')]=function(_0x35f995,_0x3d3f4a,_0x38d6fd){io['to'](_0x35f995)[_0x5307('0x23')](_0x3d3f4a,_0x38d6fd);};VoiceAgentReport[_0x5307('0x22')][_0x5307('0x24')]=function(_0x52a2c0){return _0x52a2c0!==null&&!_[_0x5307('0x25')](_0x52a2c0);};VoiceAgentReport[_0x5307('0x22')][_0x5307('0xf')]=function(_0x55a079){try{if(this['isNotNull'](_0x55a079)){logger[_0x5307('0x26')](_0x5307('0x27'),_0x55a079['uniqueid'],_0x55a079['membername'],_0x55a079['destuniqueid']);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20event:',_0x55a079[_0x5307('0x28')],util['inspect'](_0x55a079,{'showHidden':![],'depth':null}));if(_[_0x5307('0x25')](this[_0x5307('0x9')][_0x55a079[_0x5307('0x28')]])){this[_0x5307('0x9')][_0x55a079[_0x5307('0x28')]]={};}var _0x216fd6=this[_0x5307('0xc')][_0x55a079[_0x5307('0x29')]];var _0x4a64bd=this['channels'][_0x55a079[_0x5307('0x28')]][_0x55a079[_0x5307('0x2a')]];var _0x598900=this[_0x5307('0xb')][_0x55a079[_0x5307('0x2b')]];var _0x4cab7c=this[_0x5307('0xd')][_0x55a079[_0x5307('0x28')]];if(_[_0x5307('0x25')](_0x4a64bd)){_0x4a64bd={'agentcalledAt':moment()[_0x5307('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x5307('0x2d'),'mandatoryDisposition':_0x598900&&_0x598900['mandatoryDisposition']?_0x598900[_0x5307('0x2e')]:![],'type':_0x598900&&_0x598900['type']?_0x598900[_0x5307('0x2f')]:'inbound','variables':_0x4cab7c,'motionChannel':'voice'};}Object[_0x5307('0x30')](_0x4a64bd,_[_0x5307('0x31')](_0x55a079,[_0x5307('0x32'),'privilege']));this['channels'][_0x55a079['uniqueid']][_0x55a079['destuniqueid']]=_0x4a64bd;logger[_0x5307('0x33')](_0x5307('0x34'),_0x55a079['uniqueid'],util['inspect'](_0x4a64bd,{'showHidden':![],'depth':null}));ami['emit']('custom:agentcalled',_0x4a64bd);var _0x5d3464={'id':_0x216fd6['id'],'calleridnum':_0x4a64bd[_0x5307('0x35')],'queue':_0x4a64bd['queue'],'variables':_0x4a64bd[_0x5307('0xd')],'uniqueid':_0x55a079['uniqueid']};logger[_0x5307('0x33')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x55a079[_0x5307('0x28')],util[_0x5307('0x36')](_0x5d3464,{'showHidden':![],'depth':null}));this[_0x5307('0x23')](util['format'](_0x5307('0x37'),_0x55a079[_0x5307('0x38')]),_0x5307('0x39'),_0x5d3464);}}catch(_0x4f2c51){logger['error'](_0x5307('0x3a'),_0x55a079[_0x5307('0x28')],util[_0x5307('0x36')](_0x4f2c51,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5307('0x11')]=function(_0x46bcec){try{if(this[_0x5307('0x24')](_0x46bcec)){if(this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]]){for(var _0x308d91 in this['channels'][_0x46bcec['uniqueid']]){if(this['channels'][_0x46bcec[_0x5307('0x28')]][_0x5307('0x3b')](_0x308d91)){if(_0x46bcec[_0x5307('0x2a')]===_0x308d91){logger[_0x5307('0x26')](_0x5307('0x3c'),_0x46bcec[_0x5307('0x28')],_0x46bcec[_0x5307('0x38')],_0x46bcec['destuniqueid']);this['channels'][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x3d')]=moment()[_0x5307('0x2c')](_0x5307('0x3e'));this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x3f')]=_0x46bcec[_0x5307('0x3f')];this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x40')]=_0x46bcec[_0x5307('0x40')];this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91]['destchannelstate']=_0x46bcec[_0x5307('0x41')];this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x42')]=_0x46bcec[_0x5307('0x42')];this['channels'][_0x46bcec['uniqueid']][_0x308d91][_0x5307('0x43')]=_0x46bcec[_0x5307('0x43')];this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91]['lastevent']=_0x5307('0x44');_[_0x5307('0x45')](this[_0x5307('0xc')][_0x46bcec[_0x5307('0x29')]],_[_0x5307('0x46')](_0x46bcec,[_0x5307('0x2b'),_0x5307('0x47')]));var _0x49a6b4=this[_0x5307('0xc')][_0x46bcec['interface']];var _0x53a781={'id':_0x49a6b4['id'],'name':_0x49a6b4[_0x5307('0x48')],'agentconnected':!![],'destaccountcode':_0x49a6b4[_0x5307('0x49')],'destconnectedlinenum':this[_0x5307('0x9')][_0x46bcec['uniqueid']][_0x46bcec[_0x5307('0x2a')]]['exten'],'queue':this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x46bcec[_0x5307('0x2a')]][_0x5307('0x2b')],'uniqueid':this['channels'][_0x46bcec[_0x5307('0x28')]][_0x46bcec[_0x5307('0x2a')]][_0x5307('0x28')]};ami[_0x5307('0x23')](_0x5307('0x4a'),this['channels'][_0x46bcec[_0x5307('0x28')]][_0x46bcec[_0x5307('0x2a')]]);this[_0x5307('0x23')](util[_0x5307('0x2c')](_0x5307('0x37'),_0x46bcec[_0x5307('0x38')]),'user:agentconnect',_0x53a781);}else if(!this['channels'][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x12')]&&!this['channels'][_0x46bcec[_0x5307('0x28')]][_0x308d91]['agentcomplete']){logger[_0x5307('0x26')](_0x5307('0x4b'),_0x46bcec[_0x5307('0x28')],this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x38')],_0x308d91);this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x12')]=!![];this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91]['agentringnoanswerAt']=moment()[_0x5307('0x2c')](_0x5307('0x3e'));this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x4c')]=_0x46bcec[_0x5307('0x2a')];this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x4d')]=_0x46bcec['membername'];this['channels'][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x4e')]=_0x5307('0x4f');this['channels'][_0x46bcec[_0x5307('0x28')]][_0x308d91][_0x5307('0x50')]=_0x5307('0x4f');logger[_0x5307('0x33')](_0x5307('0x51'),_0x46bcec[_0x5307('0x28')],util[_0x5307('0x36')](this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91],{'showHidden':![],'depth':null}));ami['emit'](_0x5307('0x52'),this[_0x5307('0x9')][_0x46bcec[_0x5307('0x28')]][_0x308d91]);}else{logger['debug']('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x46bcec[_0x5307('0x28')]);}}}}}}catch(_0x45f38c){logger[_0x5307('0x53')](_0x5307('0x54'),_0x46bcec['uniqueid'],util[_0x5307('0x36')](_0x45f38c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5307('0x22')]['syncAgentRingNoAnswer']=function(_0x46b7bf){try{if(this['isNotNull'](_0x46b7bf)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x46b7bf[_0x5307('0x28')],util[_0x5307('0x36')](_0x46b7bf,{'showHidden':![],'depth':null}));if(this[_0x5307('0x9')][_0x46b7bf[_0x5307('0x28')]]&&this[_0x5307('0x9')][_0x46b7bf['uniqueid']][_0x46b7bf[_0x5307('0x2a')]]){logger[_0x5307('0x26')](_0x5307('0x55'),_0x46b7bf['uniqueid'],_0x46b7bf[_0x5307('0x38')],_0x46b7bf[_0x5307('0x2a')]);var _0x3c17ec=this[_0x5307('0xc')][_0x46b7bf[_0x5307('0x29')]];var _0x404e2c=this[_0x5307('0x9')][_0x46b7bf[_0x5307('0x28')]][_0x46b7bf['destuniqueid']];_0x404e2c['agentringnoanswer']=!![];_0x404e2c[_0x5307('0x56')]=moment()[_0x5307('0x2c')](_0x5307('0x3e'));_0x404e2c['lastevent']=_0x5307('0x57');_0x404e2c[_0x5307('0x50')]='rejected';var _0x1d7a73={'id':_0x3c17ec['id'],'name':_0x3c17ec[_0x5307('0x48')],'queue':_0x404e2c[_0x5307('0x2b')],'uniqueid':_0x404e2c['uniqueid']};logger[_0x5307('0x33')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x46b7bf[_0x5307('0x28')],util[_0x5307('0x36')](_0x1d7a73,{'showHidden':![],'depth':null}));this[_0x5307('0x23')](util[_0x5307('0x2c')](_0x5307('0x37'),_0x3c17ec['name']),'user:agentringnoanswer',_0x1d7a73);ami[_0x5307('0x23')](_0x5307('0x58'),_0x404e2c);this[_0x5307('0x9')][_0x46b7bf['uniqueid']][_0x46b7bf[_0x5307('0x2a')]]=Object[_0x5307('0x30')]({},_0x404e2c);}}}catch(_0x42d81f){logger[_0x5307('0x53')](_0x5307('0x59'),_0x46b7bf['uniqueid'],util[_0x5307('0x36')](_0x42d81f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5307('0x22')][_0x5307('0x16')]=function(_0x57584d){try{if(this['isNotNull'](_0x57584d)){logger['debug'](_0x5307('0x5a'),_0x57584d[_0x5307('0x28')],util[_0x5307('0x36')](_0x57584d,{'showHidden':![],'depth':null}));if(this['channels'][_0x57584d['uniqueid']]){for(var _0xae3c20 in this[_0x5307('0x9')][_0x57584d[_0x5307('0x28')]]){if(this[_0x5307('0x9')][_0x57584d['uniqueid']]['hasOwnProperty'](_0xae3c20)&&!this[_0x5307('0x9')][_0x57584d[_0x5307('0x28')]][_0xae3c20]['agentringnoanswer']&&!this[_0x5307('0x9')][_0x57584d[_0x5307('0x28')]][_0xae3c20][_0x5307('0x17')]){logger[_0x5307('0x26')](_0x5307('0x5b'),_0x57584d[_0x5307('0x28')],this[_0x5307('0x9')][_0x57584d['uniqueid']][_0xae3c20][_0x5307('0x38')],_0xae3c20);this[_0x5307('0x9')][_0x57584d['uniqueid']][_0xae3c20][_0x5307('0x12')]=!![];this[_0x5307('0x9')][_0x57584d['uniqueid']][_0xae3c20][_0x5307('0x56')]=moment()[_0x5307('0x2c')](_0x5307('0x3e'));this['channels'][_0x57584d[_0x5307('0x28')]][_0xae3c20][_0x5307('0x4e')]='abandoned';this[_0x5307('0x9')][_0x57584d[_0x5307('0x28')]][_0xae3c20][_0x5307('0x50')]=_0x5307('0x5c');logger[_0x5307('0x33')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x57584d[_0x5307('0x28')],util[_0x5307('0x36')](this[_0x5307('0x9')][_0x57584d[_0x5307('0x28')]][_0xae3c20],{'showHidden':![],'depth':null}));ami[_0x5307('0x23')](_0x5307('0x5d'),this[_0x5307('0x9')][_0x57584d[_0x5307('0x28')]][_0xae3c20]);}}}}}catch(_0x41b1ca){logger['error'](_0x5307('0x5e'),_0x57584d[_0x5307('0x28')],util['inspect'](_0x41b1ca,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5307('0x22')]['syncAgentComplete']=function(_0x2c7989){try{if(this[_0x5307('0x24')](_0x2c7989)){logger[_0x5307('0x33')](_0x5307('0x5f'),_0x2c7989[_0x5307('0x28')],util['inspect'](_0x2c7989,{'showHidden':![],'depth':null}));if(this[_0x5307('0x9')][_0x2c7989[_0x5307('0x28')]]){for(var _0x1c1220 in this[_0x5307('0x9')][_0x2c7989[_0x5307('0x28')]]){if(this[_0x5307('0x9')][_0x2c7989[_0x5307('0x28')]][_0x5307('0x3b')](_0x1c1220)){if(this[_0x5307('0x9')][_0x2c7989[_0x5307('0x28')]][_0x1c1220][_0x5307('0x3d')]&&!this[_0x5307('0x9')][_0x2c7989['uniqueid']][_0x1c1220][_0x5307('0x17')]){logger['info'](_0x5307('0x60'),_0x2c7989[_0x5307('0x28')],this['channels'][_0x2c7989[_0x5307('0x28')]][_0x1c1220][_0x5307('0x38')],_0x1c1220);this['channels'][_0x2c7989[_0x5307('0x28')]][_0x1c1220][_0x5307('0x17')]=!![];this[_0x5307('0x9')][_0x2c7989[_0x5307('0x28')]][_0x1c1220]['agentcompleteAt']=moment()[_0x5307('0x2c')](_0x5307('0x3e'));this[_0x5307('0x9')][_0x2c7989[_0x5307('0x28')]][_0x1c1220][_0x5307('0x4e')]='complete';this[_0x5307('0x9')][_0x2c7989[_0x5307('0x28')]][_0x1c1220][_0x5307('0x50')]=_0x2c7989[_0x5307('0x50')]==_0x5307('0x61')?_0x5307('0x62'):_0x2c7989[_0x5307('0x50')];this[_0x5307('0x9')][_0x2c7989[_0x5307('0x28')]][_0x1c1220][_0x5307('0x63')]=_0x2c7989[_0x5307('0x63')];if(this[_0x5307('0xb')][_0x2c7989[_0x5307('0x2b')]]&&this[_0x5307('0xb')][_0x2c7989[_0x5307('0x2b')]][_0x5307('0x64')]){this['channels'][_0x2c7989[_0x5307('0x28')]][_0x1c1220][_0x5307('0x65')]=this['voiceQueues'][_0x2c7989[_0x5307('0x2b')]][_0x5307('0x66')];this['channels'][_0x2c7989['uniqueid']][_0x1c1220][_0x5307('0x67')]=!![];}this[_0x5307('0xc')][_0x2c7989[_0x5307('0x29')]]=_[_0x5307('0x31')](this[_0x5307('0xc')][_0x2c7989[_0x5307('0x29')]],[_0x5307('0x2b'),'destconnectedlinenum']);logger[_0x5307('0x33')](_0x5307('0x68'),_0x2c7989[_0x5307('0x28')],util[_0x5307('0x36')](this[_0x5307('0x9')][_0x2c7989[_0x5307('0x28')]][_0x1c1220],{'showHidden':![],'depth':null}));ami[_0x5307('0x23')](_0x5307('0x69'),this[_0x5307('0x9')][_0x2c7989['uniqueid']][_0x1c1220]);logger[_0x5307('0x33')](_0x5307('0x6a'),_0x2c7989[_0x5307('0x28')],util[_0x5307('0x36')]({'id':this[_0x5307('0xc')][_0x2c7989['interface']]['id'],'destaccountcode':_0x2c7989[_0x5307('0x6b')]},{'showHidden':![],'depth':null}));this[_0x5307('0x23')](util[_0x5307('0x2c')](_0x5307('0x37'),_0x2c7989[_0x5307('0x38')]),'user:agentcomplete',{'id':this[_0x5307('0xc')][_0x2c7989[_0x5307('0x29')]]['id'],'destaccountcode':Number(_0x2c7989[_0x5307('0x6b')])});}}}}}}catch(_0x5a9803){logger[_0x5307('0x53')](_0x5307('0x6c'),_0x2c7989[_0x5307('0x28')],util[_0x5307('0x36')](_0x5a9803,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5307('0x22')]['syncVarSet']=function(_0x50929a){try{if(this[_0x5307('0x24')](_0x50929a)){logger[_0x5307('0x33')]('[%s][voiceAgentReport][varset]\x20event:',_0x50929a[_0x5307('0x28')],util[_0x5307('0x36')](_0x50929a,{'showHidden':![],'depth':null}));this[_0x5307('0x6d')](_0x50929a[_0x5307('0x28')],_[_0x5307('0x6e')](_0x50929a[_0x5307('0x6f')])[0x0],_0x50929a[_0x5307('0x70')]);if(this[_0x5307('0x9')][_0x50929a[_0x5307('0x28')]]){for(var _0x393927 in this['channels'][_0x50929a[_0x5307('0x28')]]){if(this[_0x5307('0x9')][_0x50929a[_0x5307('0x28')]][_0x5307('0x3b')](_0x393927)){logger[_0x5307('0x26')](_0x5307('0x71'),_0x50929a['uniqueid'],_0x393927,_[_0x5307('0x6e')](_0x50929a[_0x5307('0x6f')])[0x0],_0x50929a[_0x5307('0x70')]);if(_[_0x5307('0x25')](this[_0x5307('0x9')][_0x50929a[_0x5307('0x28')]][_0x393927][_0x5307('0xd')])){this[_0x5307('0x9')][_0x50929a[_0x5307('0x28')]][_0x393927][_0x5307('0xd')]={};}this[_0x5307('0x9')][_0x50929a[_0x5307('0x28')]][_0x393927][_0x5307('0xd')]=this[_0x5307('0xd')][_0x50929a[_0x5307('0x28')]];}}}}}catch(_0x358feb){logger[_0x5307('0x53')](_0x5307('0x72'),_0x50929a[_0x5307('0x28')],util[_0x5307('0x36')](_0x358feb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5307('0x22')][_0x5307('0x6d')]=function(_0x5c21f1,_0x639b2a,_0x14ade4){var _0x2e35a0=[_0x5307('0x73'),_0x5307('0x74'),'rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss',_0x5307('0x75'),_0x5307('0x76'),_0x5307('0x77'),_0x5307('0x78'),'sipuri',_0x5307('0x79'),_0x5307('0x7a'),_0x5307('0x7b'),'memberdynamic',_0x5307('0x7c'),_0x5307('0x7d'),'membername','memberpenalty',_0x5307('0x7e')];if(!_['isNil'](_0x639b2a)&&!_[_0x5307('0x7f')](_0x2e35a0,_0x639b2a)){if(_[_0x5307('0x25')](this[_0x5307('0xd')][_0x5c21f1])){this[_0x5307('0xd')][_0x5c21f1]={};}this[_0x5307('0xd')][_0x5c21f1][_0x639b2a]=_0x14ade4;}};VoiceAgentReport['prototype'][_0x5307('0x1b')]=function(_0x36edc4){try{if(this[_0x5307('0x24')](_0x36edc4)){logger[_0x5307('0x33')](_0x5307('0x80'),_0x36edc4[_0x5307('0x28')],util[_0x5307('0x36')](_0x36edc4,{'showHidden':![],'depth':null}));if(this['channels'][_0x36edc4['uniqueid']]){for(var _0x6527de in this['channels'][_0x36edc4[_0x5307('0x28')]]){if(this['channels'][_0x36edc4[_0x5307('0x28')]][_0x5307('0x3b')](_0x6527de)){if(this[_0x5307('0x9')][_0x36edc4['uniqueid']][_0x6527de][_0x5307('0x50')]=='transfer'&&this[_0x5307('0x9')][_0x36edc4[_0x5307('0x28')]][_0x6527de]['agentcomplete']){logger[_0x5307('0x26')](_0x5307('0x81'),_0x36edc4[_0x5307('0x28')],_0x6527de);this[_0x5307('0x9')][_0x36edc4['uniqueid']][_0x6527de][_0x5307('0x82')]=moment()[_0x5307('0x2c')](_0x5307('0x3e'));}}}logger['debug'](_0x5307('0x83'),_0x36edc4['uniqueid'],util[_0x5307('0x36')](_[_0x5307('0x84')](this[_0x5307('0x9')][_0x36edc4['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x5307('0x23')](_0x5307('0x85'),_[_0x5307('0x84')](this[_0x5307('0x9')][_0x36edc4[_0x5307('0x28')]]));this[_0x5307('0x86')](_0x36edc4[_0x5307('0x28')]);}if(this[_0x5307('0xd')][_0x36edc4[_0x5307('0x28')]]){delete this[_0x5307('0xd')][_0x36edc4[_0x5307('0x28')]];}}}catch(_0x408382){logger[_0x5307('0x53')](_0x5307('0x87'),_0x36edc4['uniqueid'],util[_0x5307('0x36')](_0x408382,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5307('0x22')][_0x5307('0x1f')]=function(_0x266cf1){try{if(this[_0x5307('0x24')](_0x266cf1)){logger[_0x5307('0x33')](_0x5307('0x88'),_0x266cf1[_0x5307('0x28')],util[_0x5307('0x36')](_0x266cf1,{'showHidden':![],'depth':null}));if(this[_0x5307('0x9')][_0x266cf1['transfereeuniqueid']]){for(var _0x3fc50c in this[_0x5307('0x9')][_0x266cf1[_0x5307('0x89')]]){if(this[_0x5307('0x9')][_0x266cf1[_0x5307('0x89')]][_0x5307('0x3b')](_0x3fc50c)){if(_0x266cf1[_0x5307('0x8a')]===_0x3fc50c){logger[_0x5307('0x26')](_0x5307('0x8b'),_0x266cf1[_0x5307('0x28')],this[_0x5307('0x9')][_0x266cf1[_0x5307('0x89')]][_0x3fc50c][_0x5307('0x38')],_0x3fc50c);var _0x367af7=moment();this[_0x5307('0x9')][_0x266cf1[_0x5307('0x89')]][_0x3fc50c][_0x5307('0x17')]=!![];this['channels'][_0x266cf1[_0x5307('0x89')]][_0x3fc50c][_0x5307('0x82')]=moment()[_0x5307('0x2c')](_0x5307('0x3e'));this[_0x5307('0x9')][_0x266cf1['transfereeuniqueid']][_0x3fc50c][_0x5307('0x4e')]=_0x5307('0x8c');this[_0x5307('0x9')][_0x266cf1[_0x5307('0x89')]][_0x3fc50c][_0x5307('0x50')]='transfer';this['channels'][_0x266cf1[_0x5307('0x89')]][_0x3fc50c][_0x5307('0x63')]=_0x367af7[_0x5307('0x8d')](this[_0x5307('0x9')][_0x266cf1['transfereeuniqueid']][_0x3fc50c][_0x5307('0x3d')],_0x5307('0x8e'));}}}}if(this[_0x5307('0x9')][_0x266cf1[_0x5307('0x8f')]]){var _0x5ad07c=this[_0x5307('0x9')][_0x266cf1[_0x5307('0x8f')]];this[_0x5307('0x9')][_0x266cf1[_0x5307('0x8f')]]=this['channels'][_0x266cf1['transfereeuniqueid']];this[_0x5307('0x9')][_0x266cf1[_0x5307('0x89')]]=_0x5ad07c;}}}catch(_0x3920ea){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x266cf1[_0x5307('0x28')],util[_0x5307('0x36')](_0x3920ea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5307('0x22')]['syncBlindTransfer']=function(_0x3447c8){try{if(this[_0x5307('0x24')](_0x3447c8)){logger[_0x5307('0x33')](_0x5307('0x90'),_0x3447c8[_0x5307('0x28')],util[_0x5307('0x36')](_0x3447c8,{'showHidden':![],'depth':null}));if(this[_0x5307('0x9')][_0x3447c8[_0x5307('0x89')]]){for(var _0xffeeae in this[_0x5307('0x9')][_0x3447c8[_0x5307('0x89')]]){if(this[_0x5307('0x9')][_0x3447c8[_0x5307('0x89')]][_0x5307('0x3b')](_0xffeeae)){if(_0x3447c8[_0x5307('0x91')]===_0xffeeae){logger[_0x5307('0x26')](_0x5307('0x92'),_0x3447c8['uniqueid'],this[_0x5307('0x9')][_0x3447c8[_0x5307('0x89')]][_0xffeeae][_0x5307('0x38')],_0xffeeae);var _0x5b8796=moment();this['channels'][_0x3447c8['transfereeuniqueid']][_0xffeeae][_0x5307('0x17')]=!![];this[_0x5307('0x9')][_0x3447c8[_0x5307('0x89')]][_0xffeeae]['agentcompleteAt']=_0x5b8796;this[_0x5307('0x9')][_0x3447c8['transfereeuniqueid']][_0xffeeae][_0x5307('0x4e')]=_0x5307('0x8c');this['channels'][_0x3447c8[_0x5307('0x89')]][_0xffeeae]['reason']=_0x5307('0x61');this[_0x5307('0x9')][_0x3447c8['transfereeuniqueid']][_0xffeeae][_0x5307('0x63')]=_0x5b8796[_0x5307('0x8d')](this[_0x5307('0x9')][_0x3447c8[_0x5307('0x89')]][_0xffeeae][_0x5307('0x3d')],_0x5307('0x8e'));}}}}}}catch(_0xb2b376){logger[_0x5307('0x53')](_0x5307('0x93'),_0x3447c8[_0x5307('0x28')],util['inspect'](_0xb2b376,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5307('0x22')][_0x5307('0x94')]=function(_0x352d90){var _0x29ac4d='';try{if(this['isNotNull'](_0x352d90)){logger[_0x5307('0x33')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x352d90[_0x5307('0x28')],util[_0x5307('0x36')](_0x352d90,{'showHidden':![],'depth':null}));if(_0x352d90[_0x5307('0x95')]){_0x29ac4d=_0x352d90[_0x5307('0x95')]['substring'](0x0,_0x352d90[_0x5307('0x95')][_0x5307('0x96')]('-'));if(this['agents'][_0x29ac4d]){logger[_0x5307('0x26')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x352d90[_0x5307('0x28')],_0x29ac4d);this[_0x5307('0xc')][_0x29ac4d][_0x5307('0x97')]=!![];}}}}catch(_0x161164){logger[_0x5307('0x53')](_0x5307('0x98'),_0x352d90[_0x5307('0x28')],util['inspect'](_0x161164,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5307('0x1d')]=function(_0x377ba8){var _0x57b087='';try{if(this[_0x5307('0x24')](_0x377ba8)){logger['debug'](_0x5307('0x99'),_0x377ba8['uniqueid'],util[_0x5307('0x36')](_0x377ba8,{'showHidden':![],'depth':null}));if(_0x377ba8['channel']){_0x57b087=_0x377ba8[_0x5307('0x95')][_0x5307('0x9a')](0x0,_0x377ba8[_0x5307('0x95')][_0x5307('0x96')]('-'));if(this[_0x5307('0xc')][_0x57b087]){logger[_0x5307('0x26')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x377ba8[_0x5307('0x28')],_0x57b087);this[_0x5307('0xc')][_0x57b087][_0x5307('0x97')]=![];}}}}catch(_0x325ad1){logger['error'](_0x5307('0x9b'),_0x377ba8[_0x5307('0x28')],util[_0x5307('0x36')](_0x325ad1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5307('0x22')]['deleteChannelAfterTimeout']=function(_0x85beec,_0x50958c=0x2710){if(this['channels'][_0x85beec]){setTimeout(()=>{delete this[_0x5307('0x9')][_0x85beec];},_0x50958c);}};module[_0x5307('0x9c')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 56f79cd..6314f44 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eab=['keys','from-sip','undefined','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','emit','user:%s','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','cdr(','match','type','isNil','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','replace','.wav49','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','user:agentcomplete','transferType','resolve','then','transferToInternal','getSettings','Action','catch','StopMixMonitor','finally','event','BlindTransfer','outbound','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','lodash','moment','util','path','ioredis','ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','isUndefined','merge','pick','context','agents','channel','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate'];(function(_0x637a92,_0x33f5b9){var _0x3485c8=function(_0xb3f7c8){while(--_0xb3f7c8){_0x637a92['push'](_0x637a92['shift']());}};_0x3485c8(++_0x33f5b9);}(_0x1eab,0x7c));var _0xb1ea=function(_0x25c6a4,_0x1be201){_0x25c6a4=_0x25c6a4-0x0;var _0x40e017=_0x1eab[_0x25c6a4];return _0x40e017;};'use strict';var _=require(_0xb1ea('0x0'));var moment=require(_0xb1ea('0x1'));var util=require(_0xb1ea('0x2'));var path=require(_0xb1ea('0x3'));var Redis=require(_0xb1ea('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xb1ea('0x5'));var ami=require('../ami');var Channel=require(_0xb1ea('0x6'));var RpcSetting=require(_0xb1ea('0x7'));var applications=[_0xb1ea('0x8'),_0xb1ea('0x9'),_0xb1ea('0xa'),_0xb1ea('0xb'),_0xb1ea('0xc'),_0xb1ea('0xd')];var dispositions=['NO\x20ANSWER',_0xb1ea('0xe'),_0xb1ea('0xe'),_0xb1ea('0xf'),'NO\x20ANSWER','NO\x20ANSWER',_0xb1ea('0x10'),_0xb1ea('0x11'),_0xb1ea('0xe'),_0xb1ea('0xe'),_0xb1ea('0xe')];config[_0xb1ea('0x12')]=_['defaults'](config[_0xb1ea('0x12')],{'host':_0xb1ea('0x13'),'port':0x18eb});var io=require(_0xb1ea('0x14'))(new Redis(config[_0xb1ea('0x12')]));function VoiceCallReport(_0x278f21){this[_0xb1ea('0x15')]=_0x278f21[_0xb1ea('0x15')];this['agents']=_0x278f21['agents'];this[_0xb1ea('0x16')]={};ami['on'](_0xb1ea('0x17'),this[_0xb1ea('0x18')][_0xb1ea('0x19')](this));ami['on'](_0xb1ea('0x1a'),this[_0xb1ea('0x18')]['bind'](this));ami['on'](_0xb1ea('0x1b'),this[_0xb1ea('0x1c')][_0xb1ea('0x19')](this));ami['on']('newstate',this[_0xb1ea('0x1d')][_0xb1ea('0x19')](this));ami['on'](_0xb1ea('0x1e'),this[_0xb1ea('0x1f')][_0xb1ea('0x19')](this));ami['on'](_0xb1ea('0x20'),this[_0xb1ea('0x21')][_0xb1ea('0x19')](this));ami['on'](_0xb1ea('0x22'),this[_0xb1ea('0x23')]['bind'](this));ami['on'](_0xb1ea('0x24'),this[_0xb1ea('0x25')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xb1ea('0x19')](this));ami['on']('musiconholdstart',this[_0xb1ea('0x26')]['bind'](this));ami['on'](_0xb1ea('0x27'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0xb1ea('0x28')](_0xb1ea('0x29'));ami[_0xb1ea('0x2a')]();}catch(_0x4fd963){logger[_0xb1ea('0x2b')](_0xb1ea('0x2c'),util[_0xb1ea('0x2d')](_0x4fd963,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x13b973){return _0x13b973!==null&&!_['isUndefined'](_0x13b973);};VoiceCallReport[_0xb1ea('0x2e')]['emit']=function(_0xc45311,_0x3f4477,_0x5da594){io['to'](_0xc45311)['emit'](_0x3f4477,_0x5da594);};VoiceCallReport[_0xb1ea('0x2e')][_0xb1ea('0x23')]=function(_0x4a0120){try{if(this[_0xb1ea('0x2f')](_0x4a0120)){logger[_0xb1ea('0x28')](_0xb1ea('0x30'),_0x4a0120['uniqueid'],_0x4a0120[_0xb1ea('0x31')],_0x4a0120['calleridnum']);logger[_0xb1ea('0x32')](_0xb1ea('0x33'),_0x4a0120[_0xb1ea('0x34')],util[_0xb1ea('0x2d')](_0x4a0120,{'showHidden':![],'depth':null}));if(_0x4a0120[_0xb1ea('0x34')]===_0x4a0120['linkedid']){if(!_[_0xb1ea('0x35')](this[_0xb1ea('0x15')][_0x4a0120[_0xb1ea('0x34')]])){_[_0xb1ea('0x36')](this['channels'][_0x4a0120['uniqueid']],_[_0xb1ea('0x37')](_0x4a0120,_['keys'](this[_0xb1ea('0x15')][_0x4a0120[_0xb1ea('0x34')]])));}}if(_0x4a0120[_0xb1ea('0x38')]==='from-sip'){var _0x8ff735=this[_0xb1ea('0x39')][_0x4a0120[_0xb1ea('0x3a')][_0xb1ea('0x3b')]('-')[0x0]];if(_0x8ff735){if(_0x4a0120['exten']==_0xb1ea('0x3c')){_0x8ff735[_0xb1ea('0x3d')]=_0x4a0120[_0xb1ea('0x3e')];this['emit'](util['format']('user:%s',_0x8ff735[_0xb1ea('0x3f')]),_0xb1ea('0x40'),{'id':_0x8ff735['id'],'destaccountcode':_0x8ff735['accountcode'],'destconnectedlinenum':_0x4a0120[_0xb1ea('0x3e')]});}}}}}catch(_0x3cab17){logger[_0xb1ea('0x2b')](_0xb1ea('0x41'),_0x4a0120['uniqueid'],util[_0xb1ea('0x2d')](_0x3cab17,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb1ea('0x1c')]=function(_0x3cb6f6){try{if(this['isNotNull'](_0x3cb6f6)){logger[_0xb1ea('0x32')](_0xb1ea('0x42'),_0x3cb6f6['uniqueid'],util['inspect'](_0x3cb6f6,{'showHidden':![],'depth':null}));if(this['channels'][_0x3cb6f6['uniqueid']]){return;}if(_0x3cb6f6[_0xb1ea('0x3a')]===_0xb1ea('0x43')){return;}if(_0x3cb6f6[_0xb1ea('0x34')]!==_0x3cb6f6[_0xb1ea('0x44')]&&!this['blindTransfers'][_0x3cb6f6[_0xb1ea('0x44')]]){return;}logger[_0xb1ea('0x28')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3cb6f6[_0xb1ea('0x34')],_0x3cb6f6['context'],_0x3cb6f6['exten']);this[_0xb1ea('0x15')][_0x3cb6f6[_0xb1ea('0x34')]]=new Channel();this['channels'][_0x3cb6f6[_0xb1ea('0x34')]][_0xb1ea('0x45')]=moment()[_0xb1ea('0x46')](_0xb1ea('0x47'));this[_0xb1ea('0x15')][_0x3cb6f6[_0xb1ea('0x34')]][_0xb1ea('0x48')]=dispositions[_[_0xb1ea('0x49')](_0x3cb6f6[_0xb1ea('0x4a')])];_['merge'](this[_0xb1ea('0x15')][_0x3cb6f6['uniqueid']],_[_0xb1ea('0x37')](_0x3cb6f6,_[_0xb1ea('0x4b')](this[_0xb1ea('0x15')][_0x3cb6f6['uniqueid']])));if(_0x3cb6f6[_0xb1ea('0x38')]===_0xb1ea('0x4c')){var _0x59f0a8=this[_0xb1ea('0x39')][_0x3cb6f6[_0xb1ea('0x3a')][_0xb1ea('0x3b')]('-')[0x0]];if(_0x59f0a8&&typeof _0x59f0a8[_0xb1ea('0x3d')]===_0xb1ea('0x4d')){_0x59f0a8[_0xb1ea('0x3d')]=_0x3cb6f6[_0xb1ea('0x4e')];logger['debug'](_0xb1ea('0x4f'),_0x3cb6f6[_0xb1ea('0x34')],util[_0xb1ea('0x2d')]({'id':_0x59f0a8['id'],'destaccountcode':_0x59f0a8['accountcode'],'destconnectedlinenum':_0x3cb6f6['exten']},{'showHidden':![],'depth':null}));this[_0xb1ea('0x50')](util[_0xb1ea('0x46')](_0xb1ea('0x51'),_0x59f0a8[_0xb1ea('0x3f')]),_0xb1ea('0x40'),{'id':_0x59f0a8['id'],'destaccountcode':_0x59f0a8[_0xb1ea('0x52')],'destconnectedlinenum':_0x3cb6f6[_0xb1ea('0x4e')]});}}}}catch(_0x354d3a){logger[_0xb1ea('0x2b')](_0xb1ea('0x53'),_0x3cb6f6[_0xb1ea('0x34')],util[_0xb1ea('0x2d')](_0x354d3a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb1ea('0x2e')][_0xb1ea('0x18')]=function(_0xd09814){try{if(this[_0xb1ea('0x2f')](_0xd09814)){logger[_0xb1ea('0x32')](_0xb1ea('0x54'),_0xd09814[_0xb1ea('0x34')],util[_0xb1ea('0x2d')](_0xd09814,{'showHidden':![],'depth':null}));if(_0xd09814[_0xb1ea('0x3a')]===_0xb1ea('0x43')||_0xd09814[_0xb1ea('0x4e')]==='h')return;if(_0xd09814[_0xb1ea('0x34')]===_0xd09814['linkedid']||this[_0xb1ea('0x16')][_0xd09814[_0xb1ea('0x44')]]){_0xd09814[_0xb1ea('0x55')]=_0xd09814[_0xb1ea('0x55')]?_0xd09814[_0xb1ea('0x55')][_0xb1ea('0x56')]():undefined;_0xd09814[_0xb1ea('0x57')]=_0xd09814[_0xb1ea('0x58')]||_0xd09814['applicationdata'];if(_0xd09814[_0xb1ea('0x58')]&&_0xd09814[_0xb1ea('0x55')]!==_0xb1ea('0x9')){_0xd09814[_0xb1ea('0x57')]=_0xd09814[_0xb1ea('0x57')]['toLowerCase']();}logger[_0xb1ea('0x28')](_0xb1ea('0x59'),_0xd09814[_0xb1ea('0x34')],_0xd09814[_0xb1ea('0x55')],_0xd09814[_0xb1ea('0x57')]);if(_['isUndefined'](this['channels'][_0xd09814[_0xb1ea('0x34')]])){this[_0xb1ea('0x15')][_0xd09814[_0xb1ea('0x34')]]=new Channel();this[_0xb1ea('0x15')][_0xd09814[_0xb1ea('0x34')]][_0xb1ea('0x45')]=_0xd09814[_0xb1ea('0x5a')]?moment()['subtract'](moment[_0xb1ea('0x5a')](_0xd09814[_0xb1ea('0x5a')])[_0xb1ea('0x5b')](),_0xb1ea('0x5b'))[_0xb1ea('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xb1ea('0x46')](_0xb1ea('0x47'));this['channels'][_0xd09814['uniqueid']][_0xb1ea('0x48')]=_0xb1ea('0xf');}_[_0xb1ea('0x36')](this[_0xb1ea('0x15')][_0xd09814['uniqueid']],_[_0xb1ea('0x37')](_0xd09814,_['keys'](this[_0xb1ea('0x15')][_0xd09814[_0xb1ea('0x34')]])));if(_[_0xb1ea('0x5c')](applications,_0xd09814[_0xb1ea('0x55')])){this[_0xb1ea('0x15')][_0xd09814[_0xb1ea('0x34')]][_0xb1ea('0x5d')]=_0xd09814['application'];this[_0xb1ea('0x15')][_0xd09814[_0xb1ea('0x34')]]['lastdata']=_0xd09814[_0xb1ea('0x57')];if(_0xd09814['application']===_0xb1ea('0x8')&&_['startsWith'](_0xd09814[_0xb1ea('0x57')]['toLowerCase'](),_0xb1ea('0x5e'))){var _0x522c7e=_0xd09814[_0xb1ea('0x57')][_0xb1ea('0x3b')]('=');var _0x4c2264=_0x522c7e[0x0][_0xb1ea('0x56')]()[_0xb1ea('0x5f')](/cdr\((.*)\)/);if(_0x4c2264){if(_0x4c2264[0x1]===_0xb1ea('0x60')&&!_[_0xb1ea('0x61')](this[_0xb1ea('0x15')][_0xd09814['uniqueid']][_0x4c2264[0x1]]))return;this[_0xb1ea('0x15')][_0xd09814[_0xb1ea('0x34')]][_0x4c2264[0x1]]=_0x522c7e[0x1];}}else if(_0xd09814[_0xb1ea('0x55')]===_0xb1ea('0x9')){this[_0xb1ea('0x15')][_0xd09814['uniqueid']][_0xb1ea('0x9')]=_0xd09814[_0xb1ea('0x57')][_0xb1ea('0x3b')](',')[0x0];}}}}}catch(_0x411e79){logger[_0xb1ea('0x2b')]('[%s][voiceCallReport][newexten]',_0xd09814[_0xb1ea('0x34')],util[_0xb1ea('0x2d')](_0x411e79,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb1ea('0x2e')]['syncNewState']=function(_0x3507f8){try{if(this[_0xb1ea('0x2f')](_0x3507f8)){logger[_0xb1ea('0x28')](_0xb1ea('0x62'),_0x3507f8[_0xb1ea('0x34')],_0x3507f8[_0xb1ea('0x44')],_0x3507f8[_0xb1ea('0x31')],_0x3507f8[_0xb1ea('0x63')]);logger[_0xb1ea('0x32')](_0xb1ea('0x64'),_0x3507f8[_0xb1ea('0x34')],util[_0xb1ea('0x2d')](_0x3507f8,{'showHidden':![],'depth':null}));if(_0x3507f8['channelstate']!=='6')return;var _0x3069eb=this['agents'][_0x3507f8[_0xb1ea('0x3a')]['split']('-')[0x0]];if(_0x3507f8[_0xb1ea('0x34')]!==_0x3507f8[_0xb1ea('0x44')]){var _0x281602=moment();if(this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x44')]]){if(!this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x44')]][_0xb1ea('0x65')]){this[_0xb1ea('0x15')][_0x3507f8['linkedid']]['answered']=!![];this['channels'][_0x3507f8[_0xb1ea('0x44')]][_0xb1ea('0x66')]=_0x281602[_0xb1ea('0x46')](_0xb1ea('0x47'));if(this['channels'][_0x3507f8[_0xb1ea('0x44')]][_0xb1ea('0x45')]){this[_0xb1ea('0x15')][_0x3507f8['linkedid']][_0xb1ea('0x67')]=_0x281602[_0xb1ea('0x68')](this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x44')]][_0xb1ea('0x45')],_0xb1ea('0x5b'));}}this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x44')]][_0xb1ea('0x44')]=_0x3507f8[_0xb1ea('0x34')];if(_0x3507f8['calleridnum']!==_0xb1ea('0x3c')){this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x44')]][_0xb1ea('0x3e')]=_0x3507f8[_0xb1ea('0x63')];}this[_0xb1ea('0x15')][_0x3507f8['linkedid']][_0xb1ea('0x69')]=_0x3507f8[_0xb1ea('0x31')];this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x44')]][_0xb1ea('0x6a')]=_0x3507f8[_0xb1ea('0x3a')];this[_0xb1ea('0x15')][_0x3507f8['linkedid']]['disposition']=dispositions[_[_0xb1ea('0x49')](_0x3507f8[_0xb1ea('0x4a')])];if(_0x3069eb){this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x44')]][_0xb1ea('0x6b')]=_0x3069eb['id'];this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x44')]][_0xb1ea('0x6c')]=_0x3069eb[_0xb1ea('0x3f')];}}if(this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]]){if(!this['channels'][_0x3507f8[_0xb1ea('0x34')]][_0xb1ea('0x65')]){this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]][_0xb1ea('0x65')]=!![];this['channels'][_0x3507f8['uniqueid']][_0xb1ea('0x66')]=_0x281602[_0xb1ea('0x46')](_0xb1ea('0x47'));if(this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]][_0xb1ea('0x45')]){this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]][_0xb1ea('0x67')]=_0x281602['diff'](this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]][_0xb1ea('0x45')],_0xb1ea('0x5b'));}}if(_0x3507f8[_0xb1ea('0x63')]!==_0xb1ea('0x3c')){this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]][_0xb1ea('0x3e')]=_0x3507f8[_0xb1ea('0x63')];}this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]][_0xb1ea('0x69')]=_0x3507f8[_0xb1ea('0x31')];this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]][_0xb1ea('0x6a')]=_0x3507f8[_0xb1ea('0x3a')];this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]][_0xb1ea('0x48')]=dispositions[_['toNumber'](_0x3507f8['channelstate'])];}}else{if(this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]]){if(_0x3069eb){this[_0xb1ea('0x15')][_0x3507f8['uniqueid']][_0xb1ea('0x6b')]=_0x3069eb['id'];this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x34')]]['membername']=_0x3069eb[_0xb1ea('0x3f')];}}}if(_0x3507f8['context']===_0xb1ea('0x4c')){if(_0x3069eb){_0x3069eb[_0xb1ea('0x3d')]=_0x3507f8[_0xb1ea('0x4e')];var _0x2aa456;if(this['channels'][_0x3507f8[_0xb1ea('0x34')]]){_0x2aa456=this[_0xb1ea('0x15')][_0x3507f8['uniqueid']]['queue'];}else if(this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x44')]]){_0x2aa456=this[_0xb1ea('0x15')][_0x3507f8[_0xb1ea('0x44')]][_0xb1ea('0x9')];}_0x3069eb[_0xb1ea('0x9')]=_0x2aa456;var _0x7bf06e={'id':_0x3069eb['id'],'name':_0x3069eb[_0xb1ea('0x3f')],'agentconnected':!![],'destaccountcode':_0x3069eb[_0xb1ea('0x52')],'destconnectedlinenum':_0x3507f8[_0xb1ea('0x4e')],'queue':_0x2aa456||undefined,'uniqueid':_0x3507f8[_0xb1ea('0x44')]};logger[_0xb1ea('0x32')](_0xb1ea('0x6d'),_0x3507f8[_0xb1ea('0x34')],util[_0xb1ea('0x2d')](_0x7bf06e,{'showHidden':![],'depth':null}));this[_0xb1ea('0x50')](util[_0xb1ea('0x46')]('user:%s',_0x3069eb['name']),_0xb1ea('0x40'),_0x7bf06e);}}}}catch(_0x483a0b){logger['error']('[%s][voiceCallReport][newstate]',_0x3507f8['uniqueid'],util[_0xb1ea('0x2d')](_0x483a0b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb1ea('0x2e')][_0xb1ea('0x6e')]=function(_0x1831fd,_0x4f61e0){try{if(this[_0xb1ea('0x15')][_0x1831fd]){logger[_0xb1ea('0x28')](_0xb1ea('0x6f'),_0x1831fd,_0x4f61e0);this[_0xb1ea('0x15')][_0x1831fd][_0xb1ea('0x70')]=!![];if(_['endsWith'](_0x4f61e0,'.wav49')){_0x4f61e0=_0x4f61e0[_0xb1ea('0x71')](_0xb1ea('0x72'),_0xb1ea('0x73'));}this[_0xb1ea('0x15')][_0x1831fd][_0xb1ea('0x74')]=_0x4f61e0;var _0x466d4b=_[_0xb1ea('0x75')](this[_0xb1ea('0x15')][_0x1831fd][_0xb1ea('0x76')],{'filename':_0x4f61e0});if(_[_0xb1ea('0x61')](_0x466d4b)){this['channels'][_0x1831fd]['monitors'][_0xb1ea('0x77')]({'filename':_0x4f61e0,'createdAt':moment()[_0xb1ea('0x46')](_0xb1ea('0x47')),'mixmonitorid':'','status':_0xb1ea('0x78')});}}}catch(_0xf2f453){logger[_0xb1ea('0x2b')](_0xb1ea('0x79'),_0x1831fd,util['inspect'](_0xf2f453,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb1ea('0x2e')][_0xb1ea('0x1f')]=function(_0x1eb7bd){try{if(this[_0xb1ea('0x2f')](_0x1eb7bd)){logger[_0xb1ea('0x32')](_0xb1ea('0x7a'),_0x1eb7bd[_0xb1ea('0x34')],util[_0xb1ea('0x2d')](_0x1eb7bd,{'showHidden':![],'depth':null}));if(this['channels'][_0x1eb7bd[_0xb1ea('0x34')]]&&_0x1eb7bd[_0xb1ea('0x3a')]!='OutgoingSpoolFailed'){if(this[_0xb1ea('0x2f')](_0x1eb7bd[_0xb1ea('0x7b')])){if(this[_0xb1ea('0x2f')](_0x1eb7bd[_0xb1ea('0x7b')][_0xb1ea('0x7c')])){logger[_0xb1ea('0x28')](_0xb1ea('0x7d'),_0x1eb7bd[_0xb1ea('0x34')],_0x1eb7bd['value']);this['syncMixMonitorFilename'](_0x1eb7bd[_0xb1ea('0x34')],_0x1eb7bd[_0xb1ea('0x7e')]);}else if(this[_0xb1ea('0x2f')](_0x1eb7bd[_0xb1ea('0x7b')][_0xb1ea('0x7f')])){logger['info'](_0xb1ea('0x80'),_0x1eb7bd[_0xb1ea('0x34')],_0x1eb7bd[_0xb1ea('0x7e')]);this[_0xb1ea('0x15')][_0x1eb7bd['uniqueid']][_0xb1ea('0x63')]=_0x1eb7bd[_0xb1ea('0x7e')];}else if(this[_0xb1ea('0x2f')](_0x1eb7bd[_0xb1ea('0x7b')]['xmd-callerid'])){logger[_0xb1ea('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x1eb7bd['uniqueid'],_0x1eb7bd['value']);this[_0xb1ea('0x15')][_0x1eb7bd['uniqueid']]['callerid']=_0x1eb7bd[_0xb1ea('0x7e')];}else if(this[_0xb1ea('0x2f')](_0x1eb7bd['variable'][_0xb1ea('0x81')])){logger[_0xb1ea('0x28')](_0xb1ea('0x82'),_0x1eb7bd[_0xb1ea('0x34')],_0x1eb7bd[_0xb1ea('0x7e')]);this[_0xb1ea('0x15')][_0x1eb7bd['uniqueid']]['type']=_0x1eb7bd[_0xb1ea('0x7e')];}else if(this[_0xb1ea('0x2f')](_0x1eb7bd[_0xb1ea('0x7b')][_0xb1ea('0x83')])){logger[_0xb1ea('0x28')](_0xb1ea('0x84'),_0x1eb7bd[_0xb1ea('0x34')],_0x1eb7bd['value']['split'](',')[0x0]);this[_0xb1ea('0x15')][_0x1eb7bd[_0xb1ea('0x34')]][_0xb1ea('0x9')]=_0x1eb7bd[_0xb1ea('0x7e')]['split'](',')[0x0];}else if(this['isNotNull'](_0x1eb7bd[_0xb1ea('0x7b')]['xmd-originatecalleridnum'])){logger['info'](_0xb1ea('0x85'),_0x1eb7bd[_0xb1ea('0x34')],_0x1eb7bd['value']);this['channels'][_0x1eb7bd[_0xb1ea('0x34')]][_0xb1ea('0x86')]=_0x1eb7bd[_0xb1ea('0x7e')];}else if(this[_0xb1ea('0x2f')](_0x1eb7bd[_0xb1ea('0x7b')][_0xb1ea('0x87')])){logger[_0xb1ea('0x28')](_0xb1ea('0x88'),_0x1eb7bd[_0xb1ea('0x34')],_0x1eb7bd[_0xb1ea('0x7e')]);this['channels'][_0x1eb7bd[_0xb1ea('0x34')]][_0xb1ea('0x89')]=_0x1eb7bd[_0xb1ea('0x7e')];}else if(this['isNotNull'](_0x1eb7bd['variable'][_0xb1ea('0x8a')])){logger[_0xb1ea('0x28')](_0xb1ea('0x8b'),_0x1eb7bd[_0xb1ea('0x34')],_0x1eb7bd[_0xb1ea('0x7e')]);this[_0xb1ea('0x15')][_0x1eb7bd[_0xb1ea('0x34')]][_0xb1ea('0x8c')]=_0x1eb7bd['value'];}else if(this['isNotNull'](_0x1eb7bd[_0xb1ea('0x7b')][_0xb1ea('0x8d')])){logger[_0xb1ea('0x28')](_0xb1ea('0x8e'),_0x1eb7bd['uniqueid'],_0x1eb7bd[_0xb1ea('0x7e')]);this[_0xb1ea('0x15')][_0x1eb7bd[_0xb1ea('0x34')]]['queue']=_0x1eb7bd['value'];}else if(this[_0xb1ea('0x2f')](_0x1eb7bd[_0xb1ea('0x7b')][_0xb1ea('0x8f')])){logger[_0xb1ea('0x28')](_0xb1ea('0x90'),_0x1eb7bd[_0xb1ea('0x34')],_0x1eb7bd[_0xb1ea('0x7e')]);this[_0xb1ea('0x15')][_0x1eb7bd[_0xb1ea('0x34')]][_0xb1ea('0x91')]=_0x1eb7bd['value'];}}}else if(this['isNotNull'](_0x1eb7bd[_0xb1ea('0x7b')][_0xb1ea('0x7c')])){if(_0x1eb7bd['value']){var _0x379d3e=path['parse'](_0x1eb7bd['value'])[_0xb1ea('0x3f')];logger[_0xb1ea('0x28')](_0xb1ea('0x7d'),_0x379d3e,_0x1eb7bd['value']);this[_0xb1ea('0x6e')](_0x379d3e,_0x1eb7bd[_0xb1ea('0x7e')]);}}else if(this[_0xb1ea('0x15')][_0x1eb7bd[_0xb1ea('0x44')]]){if(this['isNotNull'](_0x1eb7bd[_0xb1ea('0x7b')])){if(this[_0xb1ea('0x2f')](_0x1eb7bd[_0xb1ea('0x7b')][_0xb1ea('0x8f')])){logger[_0xb1ea('0x28')](_0xb1ea('0x90'),_0x1eb7bd[_0xb1ea('0x44')],_0x1eb7bd[_0xb1ea('0x7e')]);this[_0xb1ea('0x15')][_0x1eb7bd['linkedid']][_0xb1ea('0x92')]=_0x1eb7bd['value'];}}}}}catch(_0x48bb03){logger[_0xb1ea('0x2b')]('[%s][voiceCallReport][varset]',_0x1eb7bd[_0xb1ea('0x34')],util[_0xb1ea('0x2d')](_0x48bb03,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb1ea('0x2e')]['syncHangup']=function(_0x2999f4){try{if(this[_0xb1ea('0x2f')](_0x2999f4)){logger[_0xb1ea('0x32')](_0xb1ea('0x93'),_0x2999f4[_0xb1ea('0x34')],util['inspect'](_0x2999f4,{'showHidden':![],'depth':null}));if(this[_0xb1ea('0x16')][_0x2999f4[_0xb1ea('0x44')]]){if(this['channels'][this['blindTransfers'][_0x2999f4[_0xb1ea('0x44')]]['linkedid']]){this['channels'][this[_0xb1ea('0x16')][_0x2999f4['linkedid']][_0xb1ea('0x44')]][_0xb1ea('0x34')]=_0x2999f4[_0xb1ea('0x34')];this[_0xb1ea('0x15')][this[_0xb1ea('0x16')][_0x2999f4['linkedid']][_0xb1ea('0x44')]]['answered']=this[_0xb1ea('0x15')][_0x2999f4[_0xb1ea('0x34')]][_0xb1ea('0x65')];this[_0xb1ea('0x15')][this[_0xb1ea('0x16')][_0x2999f4['linkedid']][_0xb1ea('0x44')]][_0xb1ea('0x66')]=this[_0xb1ea('0x15')][_0x2999f4['uniqueid']]['answertime'];this[_0xb1ea('0x15')][this[_0xb1ea('0x16')][_0x2999f4[_0xb1ea('0x44')]][_0xb1ea('0x44')]][_0xb1ea('0x6a')]=this[_0xb1ea('0x15')][this['blindTransfers'][_0x2999f4[_0xb1ea('0x44')]][_0xb1ea('0x44')]][_0xb1ea('0x3a')];this['channels'][this[_0xb1ea('0x16')][_0x2999f4['linkedid']][_0xb1ea('0x44')]]['disposition']=this['channels'][_0x2999f4[_0xb1ea('0x34')]][_0xb1ea('0x48')];this[_0xb1ea('0x15')][_0x2999f4[_0xb1ea('0x34')]]=this[_0xb1ea('0x15')][this['blindTransfers'][_0x2999f4[_0xb1ea('0x44')]]['linkedid']];this[_0xb1ea('0x94')](this[_0xb1ea('0x16')][_0x2999f4[_0xb1ea('0x44')]][_0xb1ea('0x44')]);}else if(this[_0xb1ea('0x15')][this[_0xb1ea('0x16')][_0x2999f4[_0xb1ea('0x44')]][_0xb1ea('0x34')]]){this[_0xb1ea('0x15')][this[_0xb1ea('0x16')][_0x2999f4[_0xb1ea('0x44')]][_0xb1ea('0x34')]][_0xb1ea('0x34')]=[this['channels'][this[_0xb1ea('0x16')][_0x2999f4[_0xb1ea('0x44')]][_0xb1ea('0x34')]]['linkedid'],this[_0xb1ea('0x15')][this[_0xb1ea('0x16')][_0x2999f4['linkedid']][_0xb1ea('0x34')]]['linkedid']=this['channels'][this[_0xb1ea('0x16')][_0x2999f4[_0xb1ea('0x44')]][_0xb1ea('0x34')]]['uniqueid']][0x0];this[_0xb1ea('0x15')][this['blindTransfers'][_0x2999f4['linkedid']]['uniqueid']]['answered']=this[_0xb1ea('0x15')][_0x2999f4['uniqueid']][_0xb1ea('0x65')];this[_0xb1ea('0x15')][this[_0xb1ea('0x16')][_0x2999f4['linkedid']]['uniqueid']][_0xb1ea('0x66')]=this['channels'][_0x2999f4[_0xb1ea('0x34')]][_0xb1ea('0x66')];this[_0xb1ea('0x15')][this[_0xb1ea('0x16')][_0x2999f4['linkedid']]['uniqueid']][_0xb1ea('0x6a')]=this[_0xb1ea('0x15')][this[_0xb1ea('0x16')][_0x2999f4['linkedid']][_0xb1ea('0x34')]][_0xb1ea('0x3a')];this[_0xb1ea('0x15')][this['blindTransfers'][_0x2999f4['linkedid']][_0xb1ea('0x34')]][_0xb1ea('0x48')]=this['channels'][_0x2999f4[_0xb1ea('0x34')]]['disposition'];this[_0xb1ea('0x15')][_0x2999f4[_0xb1ea('0x34')]]=this[_0xb1ea('0x15')][this[_0xb1ea('0x16')][_0x2999f4[_0xb1ea('0x44')]]['uniqueid']];this[_0xb1ea('0x94')](this[_0xb1ea('0x16')][_0x2999f4[_0xb1ea('0x44')]]['uniqueid']);}}if(this[_0xb1ea('0x15')][_0x2999f4[_0xb1ea('0x34')]]){logger[_0xb1ea('0x28')](_0xb1ea('0x95'),_0x2999f4[_0xb1ea('0x34')],_0x2999f4[_0xb1ea('0x96')]);var _0x9cd3f3=moment();this['channels'][_0x2999f4[_0xb1ea('0x34')]][_0xb1ea('0x97')]=_0x9cd3f3['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb1ea('0x15')][_0x2999f4[_0xb1ea('0x34')]]['duration']=_0x9cd3f3['diff'](this[_0xb1ea('0x15')][_0x2999f4['uniqueid']][_0xb1ea('0x45')],'seconds');if(this[_0xb1ea('0x15')][_0x2999f4['uniqueid']][_0xb1ea('0x65')]){this[_0xb1ea('0x15')][_0x2999f4[_0xb1ea('0x34')]][_0xb1ea('0x98')]=_0x9cd3f3['diff'](this[_0xb1ea('0x15')][_0x2999f4['uniqueid']][_0xb1ea('0x66')],_0xb1ea('0x5b'));this[_0xb1ea('0x15')][_0x2999f4['uniqueid']][_0xb1ea('0x67')]=this[_0xb1ea('0x15')][_0x2999f4[_0xb1ea('0x34')]][_0xb1ea('0x5a')]-this[_0xb1ea('0x15')][_0x2999f4['uniqueid']]['billableseconds'];}if(_0x2999f4[_0xb1ea('0x38')]==='from-sip'){if(this[_0xb1ea('0x39')][_0x2999f4['channel'][_0xb1ea('0x3b')]('-')[0x0]]){this[_0xb1ea('0x39')][_0x2999f4[_0xb1ea('0x3a')][_0xb1ea('0x3b')]('-')[0x0]]=_[_0xb1ea('0x99')](this[_0xb1ea('0x39')][_0x2999f4[_0xb1ea('0x3a')][_0xb1ea('0x3b')]('-')[0x0]],[_0xb1ea('0x3d')]);logger[_0xb1ea('0x32')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x2999f4[_0xb1ea('0x34')],util[_0xb1ea('0x2d')]({'id':this[_0xb1ea('0x39')][_0x2999f4[_0xb1ea('0x3a')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xb1ea('0x39')][_0x2999f4[_0xb1ea('0x3a')][_0xb1ea('0x3b')]('-')[0x0]][_0xb1ea('0x52')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xb1ea('0x46')]('user:%s',this['agents'][_0x2999f4[_0xb1ea('0x3a')][_0xb1ea('0x3b')]('-')[0x0]][_0xb1ea('0x3f')]),_0xb1ea('0x9a'),{'id':this[_0xb1ea('0x39')][_0x2999f4[_0xb1ea('0x3a')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x2999f4[_0xb1ea('0x3a')][_0xb1ea('0x3b')]('-')[0x0]][_0xb1ea('0x52')]});for(var _0x153bdb=0x0;_0x153bdb{delete this[_0xb1ea('0x15')][_0x4ffbd1];},_0x22f9b2);}};module[_0xb1ea('0xc6')]=VoiceCallReport; \ No newline at end of file +var _0x3ac6=['isNil','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','.WAV','monitorFilename','find','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','syncHangup','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','user:agentcomplete','transferType','transferToInternal','isEmpty','monitors','then','stopRecordingOnTransfer','Action','catch','StopMixMonitor','finally','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','util','path','ioredis','ami','../rpc/setting','set','queue','agi','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','defaults','redis','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','info','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','isUndefined','prototype','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','uniqueid','merge','pick','keys','context','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','channelstate','from-sip','channel','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceCallReport][newchannel]','application','appdata','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastdata','startsWith','cdr(','match','type'];(function(_0x401e89,_0xb2e985){var _0x36a087=function(_0xe4c9f0){while(--_0xe4c9f0){_0x401e89['push'](_0x401e89['shift']());}};_0x36a087(++_0xb2e985);}(_0x3ac6,0x123));var _0x63ac=function(_0x344739,_0x46dc96){_0x344739=_0x344739-0x0;var _0x3a3ebc=_0x3ac6[_0x344739];return _0x3a3ebc;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x63ac('0x0'));var path=require(_0x63ac('0x1'));var Redis=require(_0x63ac('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x63ac('0x3'));var ami=require('../ami');var Channel=require('../model/channel');var RpcSetting=require(_0x63ac('0x4'));var applications=[_0x63ac('0x5'),_0x63ac('0x6'),_0x63ac('0x7'),_0x63ac('0x8'),'playback',_0x63ac('0x9')];var dispositions=['NO\x20ANSWER',_0x63ac('0xa'),'FAILED',_0x63ac('0xb'),_0x63ac('0xb'),_0x63ac('0xb'),_0x63ac('0xc'),_0x63ac('0xd'),_0x63ac('0xa'),_0x63ac('0xa'),'FAILED'];config['redis']=_[_0x63ac('0xe')](config[_0x63ac('0xf')],{'host':_0x63ac('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x53dbfb){this['channels']=_0x53dbfb[_0x63ac('0x11')];this[_0x63ac('0x12')]=_0x53dbfb[_0x63ac('0x12')];this[_0x63ac('0x13')]={};ami['on'](_0x63ac('0x14'),this[_0x63ac('0x15')][_0x63ac('0x16')](this));ami['on'](_0x63ac('0x17'),this[_0x63ac('0x15')]['bind'](this));ami['on'](_0x63ac('0x18'),this[_0x63ac('0x19')][_0x63ac('0x16')](this));ami['on'](_0x63ac('0x1a'),this['syncNewState'][_0x63ac('0x16')](this));ami['on'](_0x63ac('0x1b'),this[_0x63ac('0x1c')]['bind'](this));ami['on'](_0x63ac('0x1d'),this['syncHangup'][_0x63ac('0x16')](this));ami['on']('newcallerid',this[_0x63ac('0x1e')][_0x63ac('0x16')](this));ami['on'](_0x63ac('0x1f'),this[_0x63ac('0x20')][_0x63ac('0x16')](this));ami['on'](_0x63ac('0x21'),this[_0x63ac('0x22')][_0x63ac('0x16')](this));ami['on']('musiconholdstart',this[_0x63ac('0x23')][_0x63ac('0x16')](this));ami['on'](_0x63ac('0x24'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x63ac('0x25')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x63ac('0x26')]();}catch(_0x45fd54){logger['error'](_0x63ac('0x27'),util['inspect'](_0x45fd54,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x36ca96){return _0x36ca96!==null&&!_[_0x63ac('0x28')](_0x36ca96);};VoiceCallReport[_0x63ac('0x29')][_0x63ac('0x2a')]=function(_0x3e67e5,_0x3c036c,_0x4ef975){io['to'](_0x3e67e5)[_0x63ac('0x2a')](_0x3c036c,_0x4ef975);};VoiceCallReport[_0x63ac('0x29')]['syncNewCallerId']=function(_0x2f3837){try{if(this[_0x63ac('0x2b')](_0x2f3837)){logger[_0x63ac('0x25')](_0x63ac('0x2c'),_0x2f3837['uniqueid'],_0x2f3837[_0x63ac('0x2d')],_0x2f3837['calleridnum']);logger[_0x63ac('0x2e')](_0x63ac('0x2f'),_0x2f3837['uniqueid'],util[_0x63ac('0x30')](_0x2f3837,{'showHidden':![],'depth':null}));if(_0x2f3837['uniqueid']===_0x2f3837[_0x63ac('0x31')]){if(!_[_0x63ac('0x28')](this[_0x63ac('0x11')][_0x2f3837[_0x63ac('0x32')]])){_[_0x63ac('0x33')](this['channels'][_0x2f3837[_0x63ac('0x32')]],_[_0x63ac('0x34')](_0x2f3837,_[_0x63ac('0x35')](this[_0x63ac('0x11')][_0x2f3837[_0x63ac('0x32')]])));}}if(_0x2f3837[_0x63ac('0x36')]==='from-sip'){var _0x592d69=this['agents'][_0x2f3837['channel'][_0x63ac('0x37')]('-')[0x0]];if(_0x592d69){if(_0x2f3837[_0x63ac('0x38')]==_0x63ac('0x39')){_0x592d69[_0x63ac('0x3a')]=_0x2f3837[_0x63ac('0x3b')];this['emit'](util[_0x63ac('0x3c')](_0x63ac('0x3d'),_0x592d69[_0x63ac('0x3e')]),'user:agentconnect',{'id':_0x592d69['id'],'destaccountcode':_0x592d69[_0x63ac('0x3f')],'destconnectedlinenum':_0x2f3837[_0x63ac('0x3b')]});}}}}}catch(_0x395b6f){logger[_0x63ac('0x40')](_0x63ac('0x41'),_0x2f3837[_0x63ac('0x32')],util[_0x63ac('0x30')](_0x395b6f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x63ac('0x29')][_0x63ac('0x19')]=function(_0x42da3f){try{if(this['isNotNull'](_0x42da3f)){logger[_0x63ac('0x2e')](_0x63ac('0x42'),_0x42da3f[_0x63ac('0x32')],util[_0x63ac('0x30')](_0x42da3f,{'showHidden':![],'depth':null}));if(this[_0x63ac('0x11')][_0x42da3f['uniqueid']]){return;}if(_0x42da3f['channel']===_0x63ac('0x43')){return;}if(_0x42da3f[_0x63ac('0x32')]!==_0x42da3f[_0x63ac('0x31')]&&!this[_0x63ac('0x13')][_0x42da3f['linkedid']]){return;}logger[_0x63ac('0x25')](_0x63ac('0x44'),_0x42da3f[_0x63ac('0x32')],_0x42da3f[_0x63ac('0x36')],_0x42da3f[_0x63ac('0x38')]);this[_0x63ac('0x11')][_0x42da3f[_0x63ac('0x32')]]=new Channel();this[_0x63ac('0x11')][_0x42da3f['uniqueid']][_0x63ac('0x45')]=moment()[_0x63ac('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x63ac('0x11')][_0x42da3f[_0x63ac('0x32')]][_0x63ac('0x46')]=dispositions[_['toNumber'](_0x42da3f[_0x63ac('0x47')])];_[_0x63ac('0x33')](this[_0x63ac('0x11')][_0x42da3f[_0x63ac('0x32')]],_[_0x63ac('0x34')](_0x42da3f,_[_0x63ac('0x35')](this['channels'][_0x42da3f[_0x63ac('0x32')]])));if(_0x42da3f[_0x63ac('0x36')]===_0x63ac('0x48')){var _0x570c12=this[_0x63ac('0x12')][_0x42da3f[_0x63ac('0x49')]['split']('-')[0x0]];if(_0x570c12&&typeof _0x570c12[_0x63ac('0x3a')]===_0x63ac('0x4a')){_0x570c12[_0x63ac('0x3a')]=_0x42da3f[_0x63ac('0x38')];logger['debug'](_0x63ac('0x4b'),_0x42da3f['uniqueid'],util[_0x63ac('0x30')]({'id':_0x570c12['id'],'destaccountcode':_0x570c12[_0x63ac('0x3f')],'destconnectedlinenum':_0x42da3f[_0x63ac('0x38')]},{'showHidden':![],'depth':null}));this[_0x63ac('0x2a')](util['format'](_0x63ac('0x3d'),_0x570c12['name']),_0x63ac('0x4c'),{'id':_0x570c12['id'],'destaccountcode':_0x570c12['accountcode'],'destconnectedlinenum':_0x42da3f[_0x63ac('0x38')]});}}}}catch(_0x4029de){logger[_0x63ac('0x40')](_0x63ac('0x4d'),_0x42da3f[_0x63ac('0x32')],util[_0x63ac('0x30')](_0x4029de,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x63ac('0x15')]=function(_0xae4dad){try{if(this[_0x63ac('0x2b')](_0xae4dad)){logger[_0x63ac('0x2e')]('[%s][voiceCallReport][newexten]\x20event:',_0xae4dad[_0x63ac('0x32')],util[_0x63ac('0x30')](_0xae4dad,{'showHidden':![],'depth':null}));if(_0xae4dad['channel']==='OutgoingSpoolFailed'||_0xae4dad[_0x63ac('0x38')]==='h')return;if(_0xae4dad['uniqueid']===_0xae4dad['linkedid']||this['blindTransfers'][_0xae4dad[_0x63ac('0x31')]]){_0xae4dad['application']=_0xae4dad[_0x63ac('0x4e')]?_0xae4dad['application']['toLowerCase']():undefined;_0xae4dad['applicationdata']=_0xae4dad[_0x63ac('0x4f')]||_0xae4dad[_0x63ac('0x50')];if(_0xae4dad[_0x63ac('0x4f')]&&_0xae4dad[_0x63ac('0x4e')]!==_0x63ac('0x6')){_0xae4dad[_0x63ac('0x50')]=_0xae4dad[_0x63ac('0x50')][_0x63ac('0x51')]();}logger[_0x63ac('0x25')](_0x63ac('0x52'),_0xae4dad[_0x63ac('0x32')],_0xae4dad[_0x63ac('0x4e')],_0xae4dad[_0x63ac('0x50')]);if(_[_0x63ac('0x28')](this[_0x63ac('0x11')][_0xae4dad['uniqueid']])){this[_0x63ac('0x11')][_0xae4dad[_0x63ac('0x32')]]=new Channel();this['channels'][_0xae4dad[_0x63ac('0x32')]]['starttime']=_0xae4dad[_0x63ac('0x53')]?moment()[_0x63ac('0x54')](moment['duration'](_0xae4dad[_0x63ac('0x53')])[_0x63ac('0x55')](),_0x63ac('0x55'))[_0x63ac('0x3c')](_0x63ac('0x56')):moment()[_0x63ac('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x63ac('0x11')][_0xae4dad[_0x63ac('0x32')]]['disposition']=_0x63ac('0xb');}_['merge'](this[_0x63ac('0x11')][_0xae4dad[_0x63ac('0x32')]],_[_0x63ac('0x34')](_0xae4dad,_[_0x63ac('0x35')](this[_0x63ac('0x11')][_0xae4dad['uniqueid']])));if(_[_0x63ac('0x57')](applications,_0xae4dad['application'])){this[_0x63ac('0x11')][_0xae4dad['uniqueid']]['lastapplication']=_0xae4dad[_0x63ac('0x4e')];this[_0x63ac('0x11')][_0xae4dad[_0x63ac('0x32')]][_0x63ac('0x58')]=_0xae4dad[_0x63ac('0x50')];if(_0xae4dad['application']==='set'&&_[_0x63ac('0x59')](_0xae4dad[_0x63ac('0x50')][_0x63ac('0x51')](),_0x63ac('0x5a'))){var _0x40d464=_0xae4dad['applicationdata'][_0x63ac('0x37')]('=');var _0x3e7921=_0x40d464[0x0][_0x63ac('0x51')]()[_0x63ac('0x5b')](/cdr\((.*)\)/);if(_0x3e7921){if(_0x3e7921[0x1]===_0x63ac('0x5c')&&!_[_0x63ac('0x5d')](this['channels'][_0xae4dad[_0x63ac('0x32')]][_0x3e7921[0x1]]))return;this[_0x63ac('0x11')][_0xae4dad[_0x63ac('0x32')]][_0x3e7921[0x1]]=_0x40d464[0x1];}}else if(_0xae4dad[_0x63ac('0x4e')]===_0x63ac('0x6')){this[_0x63ac('0x11')][_0xae4dad[_0x63ac('0x32')]]['queue']=_0xae4dad[_0x63ac('0x50')][_0x63ac('0x37')](',')[0x0];}}}}}catch(_0x5b8db4){logger[_0x63ac('0x40')](_0x63ac('0x5e'),_0xae4dad[_0x63ac('0x32')],util[_0x63ac('0x30')](_0x5b8db4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x63ac('0x29')][_0x63ac('0x5f')]=function(_0x2007a0){try{if(this[_0x63ac('0x2b')](_0x2007a0)){logger[_0x63ac('0x25')](_0x63ac('0x60'),_0x2007a0[_0x63ac('0x32')],_0x2007a0[_0x63ac('0x31')],_0x2007a0['calleridname'],_0x2007a0[_0x63ac('0x61')]);logger[_0x63ac('0x2e')](_0x63ac('0x62'),_0x2007a0['uniqueid'],util['inspect'](_0x2007a0,{'showHidden':![],'depth':null}));if(_0x2007a0[_0x63ac('0x47')]!=='6')return;var _0x36e015=this[_0x63ac('0x12')][_0x2007a0[_0x63ac('0x49')]['split']('-')[0x0]];if(_0x2007a0[_0x63ac('0x32')]!==_0x2007a0['linkedid']){var _0x4cca47=moment();if(this['channels'][_0x2007a0[_0x63ac('0x31')]]){if(!this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x31')]][_0x63ac('0x63')]){this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x31')]][_0x63ac('0x63')]=!![];this['channels'][_0x2007a0['linkedid']][_0x63ac('0x64')]=_0x4cca47[_0x63ac('0x3c')](_0x63ac('0x56'));if(this['channels'][_0x2007a0[_0x63ac('0x31')]]['starttime']){this['channels'][_0x2007a0[_0x63ac('0x31')]][_0x63ac('0x65')]=_0x4cca47[_0x63ac('0x66')](this[_0x63ac('0x11')][_0x2007a0['linkedid']][_0x63ac('0x45')],_0x63ac('0x55'));}}this['channels'][_0x2007a0['linkedid']]['linkedid']=_0x2007a0[_0x63ac('0x32')];if(_0x2007a0[_0x63ac('0x61')]!=='xcally-motion-preview'){this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x31')]][_0x63ac('0x3b')]=_0x2007a0[_0x63ac('0x61')];}this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x31')]][_0x63ac('0x67')]=_0x2007a0[_0x63ac('0x2d')];this[_0x63ac('0x11')][_0x2007a0['linkedid']][_0x63ac('0x68')]=_0x2007a0[_0x63ac('0x49')];this['channels'][_0x2007a0[_0x63ac('0x31')]][_0x63ac('0x46')]=dispositions[_[_0x63ac('0x69')](_0x2007a0[_0x63ac('0x47')])];if(_0x36e015){this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x31')]][_0x63ac('0x6a')]=_0x36e015['id'];this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x31')]][_0x63ac('0x6b')]=_0x36e015[_0x63ac('0x3e')];}}if(this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x32')]]){if(!this['channels'][_0x2007a0[_0x63ac('0x32')]][_0x63ac('0x63')]){this[_0x63ac('0x11')][_0x2007a0['uniqueid']][_0x63ac('0x63')]=!![];this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x32')]][_0x63ac('0x64')]=_0x4cca47[_0x63ac('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x32')]][_0x63ac('0x45')]){this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x32')]][_0x63ac('0x65')]=_0x4cca47[_0x63ac('0x66')](this['channels'][_0x2007a0[_0x63ac('0x32')]]['starttime'],_0x63ac('0x55'));}}if(_0x2007a0[_0x63ac('0x61')]!==_0x63ac('0x39')){this[_0x63ac('0x11')][_0x2007a0['uniqueid']]['connectedlinenum']=_0x2007a0[_0x63ac('0x61')];}this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x32')]][_0x63ac('0x67')]=_0x2007a0['calleridname'];this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x32')]][_0x63ac('0x68')]=_0x2007a0[_0x63ac('0x49')];this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x32')]][_0x63ac('0x46')]=dispositions[_['toNumber'](_0x2007a0[_0x63ac('0x47')])];}}else{if(this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x32')]]){if(_0x36e015){this['channels'][_0x2007a0['uniqueid']][_0x63ac('0x6a')]=_0x36e015['id'];this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x32')]]['membername']=_0x36e015[_0x63ac('0x3e')];}}}if(_0x2007a0['context']===_0x63ac('0x48')){if(_0x36e015){_0x36e015[_0x63ac('0x3a')]=_0x2007a0[_0x63ac('0x38')];var _0x27f6bd;if(this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x32')]]){_0x27f6bd=this['channels'][_0x2007a0[_0x63ac('0x32')]][_0x63ac('0x6')];}else if(this['channels'][_0x2007a0[_0x63ac('0x31')]]){_0x27f6bd=this[_0x63ac('0x11')][_0x2007a0[_0x63ac('0x31')]][_0x63ac('0x6')];}_0x36e015['queue']=_0x27f6bd;var _0x6e6ac4={'id':_0x36e015['id'],'name':_0x36e015['name'],'agentconnected':!![],'destaccountcode':_0x36e015['accountcode'],'destconnectedlinenum':_0x2007a0['exten'],'queue':_0x27f6bd||undefined,'uniqueid':_0x2007a0['linkedid']};logger[_0x63ac('0x2e')](_0x63ac('0x6c'),_0x2007a0['uniqueid'],util[_0x63ac('0x30')](_0x6e6ac4,{'showHidden':![],'depth':null}));this[_0x63ac('0x2a')](util['format'](_0x63ac('0x3d'),_0x36e015[_0x63ac('0x3e')]),'user:agentconnect',_0x6e6ac4);}}}}catch(_0xfaf526){logger[_0x63ac('0x40')](_0x63ac('0x6d'),_0x2007a0['uniqueid'],util[_0x63ac('0x30')](_0xfaf526,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x63ac('0x29')][_0x63ac('0x6e')]=function(_0x1263cb,_0x5ec03b){try{if(this[_0x63ac('0x11')][_0x1263cb]){logger['info'](_0x63ac('0x6f'),_0x1263cb,_0x5ec03b);this[_0x63ac('0x11')][_0x1263cb]['monitor']=!![];if(_[_0x63ac('0x70')](_0x5ec03b,'.wav49')){_0x5ec03b=_0x5ec03b['replace'](_0x63ac('0x71'),_0x63ac('0x72'));}this[_0x63ac('0x11')][_0x1263cb][_0x63ac('0x73')]=_0x5ec03b;var _0x4f1088=_[_0x63ac('0x74')](this[_0x63ac('0x11')][_0x1263cb]['monitors'],{'filename':_0x5ec03b});if(_['isNil'](_0x4f1088)){this[_0x63ac('0x11')][_0x1263cb]['monitors']['push']({'filename':_0x5ec03b,'createdAt':moment()[_0x63ac('0x3c')](_0x63ac('0x56')),'mixmonitorid':'','status':'rec'});}}}catch(_0x558e06){logger[_0x63ac('0x40')](_0x63ac('0x75'),_0x1263cb,util['inspect'](_0x558e06,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x63ac('0x29')][_0x63ac('0x1c')]=function(_0x4c6f25){try{if(this[_0x63ac('0x2b')](_0x4c6f25)){logger[_0x63ac('0x2e')](_0x63ac('0x76'),_0x4c6f25['uniqueid'],util[_0x63ac('0x30')](_0x4c6f25,{'showHidden':![],'depth':null}));if(this[_0x63ac('0x11')][_0x4c6f25[_0x63ac('0x32')]]&&_0x4c6f25[_0x63ac('0x49')]!=_0x63ac('0x43')){if(this[_0x63ac('0x2b')](_0x4c6f25[_0x63ac('0x77')])){if(this[_0x63ac('0x2b')](_0x4c6f25[_0x63ac('0x77')][_0x63ac('0x78')])){logger[_0x63ac('0x25')](_0x63ac('0x79'),_0x4c6f25[_0x63ac('0x32')],_0x4c6f25['value']);this['syncMixMonitorFilename'](_0x4c6f25[_0x63ac('0x32')],_0x4c6f25['value']);}else if(this['isNotNull'](_0x4c6f25['variable'][_0x63ac('0x7a')])){logger['info'](_0x63ac('0x7b'),_0x4c6f25[_0x63ac('0x32')],_0x4c6f25[_0x63ac('0x7c')]);this[_0x63ac('0x11')][_0x4c6f25[_0x63ac('0x32')]][_0x63ac('0x61')]=_0x4c6f25[_0x63ac('0x7c')];}else if(this[_0x63ac('0x2b')](_0x4c6f25[_0x63ac('0x77')][_0x63ac('0x7d')])){logger['info'](_0x63ac('0x7e'),_0x4c6f25[_0x63ac('0x32')],_0x4c6f25[_0x63ac('0x7c')]);this[_0x63ac('0x11')][_0x4c6f25[_0x63ac('0x32')]][_0x63ac('0x7f')]=_0x4c6f25[_0x63ac('0x7c')];}else if(this['isNotNull'](_0x4c6f25[_0x63ac('0x77')]['xmd-cdrtype'])){logger['info'](_0x63ac('0x80'),_0x4c6f25[_0x63ac('0x32')],_0x4c6f25['value']);this[_0x63ac('0x11')][_0x4c6f25['uniqueid']][_0x63ac('0x5c')]=_0x4c6f25['value'];}else if(this[_0x63ac('0x2b')](_0x4c6f25['variable'][_0x63ac('0x81')])){logger[_0x63ac('0x25')](_0x63ac('0x82'),_0x4c6f25['uniqueid'],_0x4c6f25[_0x63ac('0x7c')][_0x63ac('0x37')](',')[0x0]);this[_0x63ac('0x11')][_0x4c6f25[_0x63ac('0x32')]][_0x63ac('0x6')]=_0x4c6f25[_0x63ac('0x7c')]['split'](',')[0x0];}else if(this[_0x63ac('0x2b')](_0x4c6f25['variable'][_0x63ac('0x83')])){logger[_0x63ac('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4c6f25[_0x63ac('0x32')],_0x4c6f25[_0x63ac('0x7c')]);this['channels'][_0x4c6f25['uniqueid']]['originatecalleridnum']=_0x4c6f25[_0x63ac('0x7c')];}else if(this['isNotNull'](_0x4c6f25[_0x63ac('0x77')]['xmd-destination'])){logger[_0x63ac('0x25')](_0x63ac('0x84'),_0x4c6f25[_0x63ac('0x32')],_0x4c6f25[_0x63ac('0x7c')]);this[_0x63ac('0x11')][_0x4c6f25[_0x63ac('0x32')]][_0x63ac('0x85')]=_0x4c6f25['value'];}else if(this[_0x63ac('0x2b')](_0x4c6f25['variable']['xmd-callerid-preview'])){logger['info'](_0x63ac('0x86'),_0x4c6f25[_0x63ac('0x32')],_0x4c6f25[_0x63ac('0x7c')]);this[_0x63ac('0x11')][_0x4c6f25[_0x63ac('0x32')]][_0x63ac('0x87')]=_0x4c6f25[_0x63ac('0x7c')];}else if(this['isNotNull'](_0x4c6f25[_0x63ac('0x77')]['xmcs-queue'])){logger[_0x63ac('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x4c6f25[_0x63ac('0x32')],_0x4c6f25[_0x63ac('0x7c')]);this['channels'][_0x4c6f25[_0x63ac('0x32')]][_0x63ac('0x6')]=_0x4c6f25[_0x63ac('0x7c')];}else if(this[_0x63ac('0x2b')](_0x4c6f25[_0x63ac('0x77')]['sipcallid'])){logger['info'](_0x63ac('0x88'),_0x4c6f25[_0x63ac('0x32')],_0x4c6f25[_0x63ac('0x7c')]);this[_0x63ac('0x11')][_0x4c6f25[_0x63ac('0x32')]][_0x63ac('0x89')]=_0x4c6f25[_0x63ac('0x7c')];}}}else if(this[_0x63ac('0x2b')](_0x4c6f25['variable'][_0x63ac('0x78')])){if(_0x4c6f25[_0x63ac('0x7c')]){var _0x22702b=path[_0x63ac('0x8a')](_0x4c6f25[_0x63ac('0x7c')])[_0x63ac('0x3e')];logger[_0x63ac('0x25')](_0x63ac('0x79'),_0x22702b,_0x4c6f25['value']);this['syncMixMonitorFilename'](_0x22702b,_0x4c6f25[_0x63ac('0x7c')]);}}else if(this[_0x63ac('0x11')][_0x4c6f25[_0x63ac('0x31')]]){if(this[_0x63ac('0x2b')](_0x4c6f25[_0x63ac('0x77')])){if(this[_0x63ac('0x2b')](_0x4c6f25[_0x63ac('0x77')][_0x63ac('0x8b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4c6f25[_0x63ac('0x31')],_0x4c6f25[_0x63ac('0x7c')]);this[_0x63ac('0x11')][_0x4c6f25[_0x63ac('0x31')]]['sipcalllinkedid']=_0x4c6f25[_0x63ac('0x7c')];}}}}}catch(_0x3a7e50){logger[_0x63ac('0x40')]('[%s][voiceCallReport][varset]',_0x4c6f25[_0x63ac('0x32')],util[_0x63ac('0x30')](_0x3a7e50,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x63ac('0x29')][_0x63ac('0x8c')]=function(_0x12c386){try{if(this['isNotNull'](_0x12c386)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x12c386[_0x63ac('0x32')],util[_0x63ac('0x30')](_0x12c386,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x12c386[_0x63ac('0x31')]]){if(this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x31')]]){this['channels'][this[_0x63ac('0x13')][_0x12c386['linkedid']][_0x63ac('0x31')]]['uniqueid']=_0x12c386[_0x63ac('0x32')];this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]]['linkedid']][_0x63ac('0x63')]=this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]][_0x63ac('0x63')];this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x31')]][_0x63ac('0x64')]=this['channels'][_0x12c386[_0x63ac('0x32')]]['answertime'];this[_0x63ac('0x11')][this['blindTransfers'][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x31')]]['destinationchannel']=this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]]['linkedid']][_0x63ac('0x49')];this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x31')]][_0x63ac('0x46')]=this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]][_0x63ac('0x46')];this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]]=this[_0x63ac('0x11')][this['blindTransfers'][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x31')]];this[_0x63ac('0x8d')](this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x31')]);}else if(this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x32')]]){this[_0x63ac('0x11')][this['blindTransfers'][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x32')]][_0x63ac('0x32')]=[this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x32')]][_0x63ac('0x31')],this[_0x63ac('0x11')][this['blindTransfers'][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x32')]][_0x63ac('0x31')]=this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x32')]]['uniqueid']][0x0];this[_0x63ac('0x11')][this['blindTransfers'][_0x12c386[_0x63ac('0x31')]]['uniqueid']][_0x63ac('0x63')]=this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]][_0x63ac('0x63')];this[_0x63ac('0x11')][this['blindTransfers'][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x32')]][_0x63ac('0x64')]=this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]][_0x63ac('0x64')];this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386['linkedid']][_0x63ac('0x32')]][_0x63ac('0x68')]=this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x32')]]['channel'];this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x32')]][_0x63ac('0x46')]=this['channels'][_0x12c386[_0x63ac('0x32')]][_0x63ac('0x46')];this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]]=this[_0x63ac('0x11')][this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x32')]];this[_0x63ac('0x8d')](this[_0x63ac('0x13')][_0x12c386[_0x63ac('0x31')]][_0x63ac('0x32')]);}}if(this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]]){logger[_0x63ac('0x25')](_0x63ac('0x8e'),_0x12c386[_0x63ac('0x32')],_0x12c386[_0x63ac('0x8f')]);var _0x32c5eb=moment();this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]][_0x63ac('0x90')]=_0x32c5eb[_0x63ac('0x3c')](_0x63ac('0x56'));this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]][_0x63ac('0x53')]=_0x32c5eb[_0x63ac('0x66')](this['channels'][_0x12c386[_0x63ac('0x32')]][_0x63ac('0x45')],_0x63ac('0x55'));if(this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]]['answered']){this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]]['billableseconds']=_0x32c5eb[_0x63ac('0x66')](this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]]['answertime'],_0x63ac('0x55'));this['channels'][_0x12c386[_0x63ac('0x32')]][_0x63ac('0x65')]=this['channels'][_0x12c386['uniqueid']][_0x63ac('0x53')]-this[_0x63ac('0x11')][_0x12c386[_0x63ac('0x32')]]['billableseconds'];}if(_0x12c386['context']==='from-sip'){if(this[_0x63ac('0x12')][_0x12c386[_0x63ac('0x49')][_0x63ac('0x37')]('-')[0x0]]){this[_0x63ac('0x12')][_0x12c386[_0x63ac('0x49')]['split']('-')[0x0]]=_['omit'](this[_0x63ac('0x12')][_0x12c386[_0x63ac('0x49')][_0x63ac('0x37')]('-')[0x0]],[_0x63ac('0x3a')]);logger[_0x63ac('0x2e')](_0x63ac('0x91'),_0x12c386['uniqueid'],util[_0x63ac('0x30')]({'id':this[_0x63ac('0x12')][_0x12c386[_0x63ac('0x49')][_0x63ac('0x37')]('-')[0x0]]['id'],'destaccountcode':this[_0x63ac('0x12')][_0x12c386[_0x63ac('0x49')][_0x63ac('0x37')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x63ac('0x2a')](util[_0x63ac('0x3c')]('user:%s',this[_0x63ac('0x12')][_0x12c386[_0x63ac('0x49')][_0x63ac('0x37')]('-')[0x0]][_0x63ac('0x3e')]),'user:agentcomplete',{'id':this['agents'][_0x12c386[_0x63ac('0x49')][_0x63ac('0x37')]('-')[0x0]]['id'],'destaccountcode':this[_0x63ac('0x12')][_0x12c386[_0x63ac('0x49')][_0x63ac('0x37')]('-')[0x0]]['accountcode']});for(var _0x1616f3=0x0;_0x1616f3{delete this['channels'][_0x371a91];},_0x2ee7d6);}};module[_0x63ac('0xbf')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 4408067..e782b4b 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x599e=['custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','variable','value','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','starttime','seconds','complete','answered','holdtime','diff','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','application','set','applicationdata','appdata','toLowerCase','startsWith','cdr(','match','[%s][voiceDialReport][newexten]','exports','lodash','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','redis','channels','outboundChannels','outbound','applications','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','answertime','format','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','lastIndexOf','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:'];(function(_0x3d3685,_0x289c28){var _0x43d43a=function(_0x392b60){while(--_0x392b60){_0x3d3685['push'](_0x3d3685['shift']());}};_0x43d43a(++_0x289c28);}(_0x599e,0x1a9));var _0xe599=function(_0xd70781,_0x47e57e){_0xd70781=_0xd70781-0x0;var _0x2a8057=_0x599e[_0xd70781];return _0x2a8057;};'use strict';var _=require(_0xe599('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0xe599('0x1'));var config=require(_0xe599('0x2'));var logger=require(_0xe599('0x3'))(_0xe599('0x4'));var ami=require(_0xe599('0x5'));config['redis']=_[_0xe599('0x6')](config['redis'],{'host':_0xe599('0x7'),'port':0x18eb});var io=require(_0xe599('0x8'))(new Redis(config[_0xe599('0x9')]));function VoiceDialReport(_0x266c1f){this[_0xe599('0xa')]=_0x266c1f[_0xe599('0xb')];this[_0xe599('0xc')]=_0x266c1f[_0xe599('0xc')];this[_0xe599('0xd')]={};this['variables']={};ami['on']('dialbegin',this[_0xe599('0xe')][_0xe599('0xf')](this));ami['on']('dialend',this[_0xe599('0x10')][_0xe599('0xf')](this));ami['on'](_0xe599('0x11'),this[_0xe599('0x12')]['bind'](this));ami['on']('hangup',this[_0xe599('0x13')]['bind'](this));}VoiceDialReport[_0xe599('0x14')][_0xe599('0x15')]=function(_0x4ffdb3){return _0x4ffdb3!==null&&!_[_0xe599('0x16')](_0x4ffdb3);};VoiceDialReport[_0xe599('0x14')][_0xe599('0x17')]=function(_0x2decf4,_0x4c1453,_0x35fd9b){io['to'](_0x2decf4)['emit'](_0x4c1453,_0x35fd9b);};VoiceDialReport['prototype'][_0xe599('0xe')]=function(_0x25cd29){try{if(this[_0xe599('0x15')](_0x25cd29)){logger[_0xe599('0x18')](_0xe599('0x19'),_0x25cd29[_0xe599('0x1a')],util[_0xe599('0x1b')](_0x25cd29,{'showHidden':![],'depth':null}));if(this[_0xe599('0xa')][_0x25cd29[_0xe599('0x1a')]]){_[_0xe599('0x1c')](this[_0xe599('0xa')][_0x25cd29[_0xe599('0x1a')]],{'starttime':moment()['format'](_0xe599('0x1d')),'lastevent':_0xe599('0x1e'),'interface':_0x25cd29[_0xe599('0x1f')][_0xe599('0x20')](0x0,_0x25cd29[_0xe599('0x1f')]['lastIndexOf']('-')),'membername':_0x25cd29[_0xe599('0x1f')][_0xe599('0x20')](_0x25cd29['channel']['lastIndexOf']('/')+0x1,_0x25cd29[_0xe599('0x1f')]['lastIndexOf']('-'))},_['omit'](_0x25cd29,[_0xe599('0x21'),_0xe599('0x22')]));logger['info'](_0xe599('0x23'),_0x25cd29[_0xe599('0x1a')],this[_0xe599('0xa')][_0x25cd29['uniqueid']][_0xe599('0x24')],this['channels'][_0x25cd29[_0xe599('0x1a')]]['interface']);logger['debug'](_0xe599('0x25'),_0x25cd29[_0xe599('0x1a')],util[_0xe599('0x1b')](this[_0xe599('0xa')][_0x25cd29['uniqueid']],{'showHidden':![],'depth':null}));if(this['applications'][_0x25cd29[_0xe599('0x1a')]])_[_0xe599('0x1c')](this[_0xe599('0xa')][_0x25cd29['uniqueid']],this[_0xe599('0xd')][_0x25cd29['uniqueid']]);this['emit'](_0xe599('0x26'),_0xe599('0x27'),this['channels'][_0x25cd29[_0xe599('0x1a')]]);logger[_0xe599('0x18')](_0xe599('0x28'),_0x25cd29[_0xe599('0x1a')],util[_0xe599('0x1b')](this['channels'][_0x25cd29[_0xe599('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0xe599('0x29'),this[_0xe599('0xa')][_0x25cd29[_0xe599('0x1a')]]);}}}catch(_0x37c70){logger[_0xe599('0x2a')](_0xe599('0x2b'),_0x25cd29[_0xe599('0x1a')],util[_0xe599('0x1b')](_0x37c70,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe599('0x14')][_0xe599('0x10')]=function(_0x17b2a2){try{if(this[_0xe599('0x15')](_0x17b2a2)){logger[_0xe599('0x18')](_0xe599('0x2c'),_0x17b2a2[_0xe599('0x1a')],util[_0xe599('0x1b')](_0x17b2a2,{'showHidden':![],'depth':null}));if(this[_0xe599('0xa')][_0x17b2a2['uniqueid']]){this[_0xe599('0xa')][_0x17b2a2[_0xe599('0x1a')]][_0xe599('0x2d')]=_0x17b2a2[_0xe599('0x2d')];if(_0x17b2a2[_0xe599('0x2d')]===_0xe599('0x2e')){this[_0xe599('0xa')][_0x17b2a2[_0xe599('0x1a')]]['connectedlinenum']=_0x17b2a2['connectedlinenum'];this[_0xe599('0xa')][_0x17b2a2[_0xe599('0x1a')]]['connectedlinename']=_0x17b2a2['connectedlinename'];this[_0xe599('0xa')][_0x17b2a2[_0xe599('0x1a')]][_0xe599('0x2f')]=moment()[_0xe599('0x30')](_0xe599('0x1d'));this[_0xe599('0xa')][_0x17b2a2[_0xe599('0x1a')]][_0xe599('0x31')]=_0xe599('0x32');logger[_0xe599('0x33')](_0xe599('0x34'),_0x17b2a2['uniqueid'],_0x17b2a2[_0xe599('0x1f')][_0xe599('0x20')](_0x17b2a2[_0xe599('0x1f')][_0xe599('0x35')]('/')+0x1,_0x17b2a2[_0xe599('0x1f')]['lastIndexOf']('-')));logger['debug'](_0xe599('0x36'),_0x17b2a2['uniqueid'],util[_0xe599('0x1b')](this[_0xe599('0xa')][_0x17b2a2[_0xe599('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xe599('0x17')](_0xe599('0x37'),this[_0xe599('0xa')][_0x17b2a2[_0xe599('0x1a')]]);}logger[_0xe599('0x18')](_0xe599('0x38'),_0x17b2a2[_0xe599('0x1a')],util[_0xe599('0x1b')](this[_0xe599('0xa')][_0x17b2a2[_0xe599('0x1a')]],{'showHidden':![],'depth':null}));this[_0xe599('0x17')](_0xe599('0x26'),_0xe599('0x27'),this[_0xe599('0xa')][_0x17b2a2[_0xe599('0x1a')]]);}}}catch(_0x657854){logger['error'](_0xe599('0x39'),_0x17b2a2[_0xe599('0x1a')],util[_0xe599('0x1b')](_0x657854,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xe599('0x12')]=function(_0x22c19c){try{if(this[_0xe599('0x15')](_0x22c19c)){logger[_0xe599('0x18')](_0xe599('0x3a'),_0x22c19c[_0xe599('0x1a')],util[_0xe599('0x1b')](_0x22c19c,{'showHidden':![],'depth':null}));this['addVariable'](_0x22c19c[_0xe599('0x1a')],_['keys'](_0x22c19c[_0xe599('0x3b')])[0x0],_0x22c19c['value']);if(this['isNotNull'](_0x22c19c[_0xe599('0x3b')])&&this[_0xe599('0x15')](_0x22c19c['variable']['outboundrouteid'])){if(_['isUndefined'](this['channels'][_0x22c19c['uniqueid']])){this['channels'][_0x22c19c[_0xe599('0x1a')]]={'routeId':_0x22c19c[_0xe599('0x3c')],'variables':this[_0xe599('0x3d')][_0x22c19c[_0xe599('0x1a')]],'motionChannel':'voice'};logger[_0xe599('0x33')](_0xe599('0x3e'),_0x22c19c['uniqueid'],_0x22c19c[_0xe599('0x3b')][_0xe599('0x3f')],_['keys'](_0x22c19c[_0xe599('0x3b')])[0x0],_0x22c19c[_0xe599('0x3c')]);logger[_0xe599('0x18')](_0xe599('0x40'),_0x22c19c['uniqueid'],util[_0xe599('0x1b')](this[_0xe599('0xa')][_0x22c19c['uniqueid']],{'showHidden':![],'depth':null}));this[_0xe599('0x17')](_0xe599('0x26'),_0xe599('0x27'),this[_0xe599('0xa')][_0x22c19c[_0xe599('0x1a')]]);}}}}catch(_0x544558){logger[_0xe599('0x2a')](_0xe599('0x41'),_0x22c19c['uniqueid'],util['inspect'](_0x544558,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe599('0x14')]['addVariable']=function(_0x173447,_0x157f04,_0x3affe9){var _0x38969a=[_0xe599('0x42'),_0xe599('0x43'),_0xe599('0x44'),_0xe599('0x45'),'rtpaudioqosloss',_0xe599('0x46'),_0xe599('0x47'),_0xe599('0x48'),'sipcallid',_0xe599('0x49'),_0xe599('0x4a'),_0xe599('0x4b'),'membercalls',_0xe599('0x4c'),_0xe599('0x4d'),_0xe599('0x4e'),_0xe599('0x24'),'memberpenalty',_0xe599('0x4f')];if(!_[_0xe599('0x50')](_0x157f04)&&!_['includes'](_0x38969a,_0x157f04)){if(_['isUndefined'](this['variables'][_0x173447])){this[_0xe599('0x3d')][_0x173447]={};}this['variables'][_0x173447][_0x157f04]=_0x3affe9;}};VoiceDialReport['prototype'][_0xe599('0x13')]=function(_0xfb8cad){try{if(this[_0xe599('0x15')](_0xfb8cad)){logger[_0xe599('0x18')](_0xe599('0x51'),_0xfb8cad[_0xe599('0x1a')],util[_0xe599('0x1b')](_0xfb8cad,{'showHidden':![],'depth':null}));if(this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]]){logger[_0xe599('0x33')](_0xe599('0x52'),_0xfb8cad['uniqueid'],_0xfb8cad[_0xe599('0x53')]);this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x54')]=moment()[_0xe599('0x30')](_0xe599('0x1d'));this['channels'][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x55')]=moment(this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]]['endtime'])['diff'](this['channels'][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x56')],_0xe599('0x57'));this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x31')]=_0xe599('0x58');this[_0xe599('0xc')]['total']+=0x1;if(this[_0xe599('0xa')][_0xfb8cad['uniqueid']]['answertime']){this[_0xe599('0xc')][_0xe599('0x59')]+=0x1;this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x5a')]=moment(this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x2f')])[_0xe599('0x5b')](this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x56')],_0xe599('0x57'));this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x5c')]=moment(this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x54')])[_0xe599('0x5b')](this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x2f')],_0xe599('0x57'));this[_0xe599('0xc')][_0xe599('0x5d')]+=this['channels'][_0xfb8cad['uniqueid']][_0xe599('0x5a')]||0x0;this[_0xe599('0xc')][_0xe599('0x5e')]+=this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]][_0xe599('0x5c')];}this[_0xe599('0xc')][_0xe599('0x5f')]+=this[_0xe599('0xa')][_0xfb8cad['uniqueid']][_0xe599('0x55')];logger['debug'](_0xe599('0x60'),_0xfb8cad[_0xe599('0x1a')],util[_0xe599('0x1b')](this[_0xe599('0xa')][_0xfb8cad['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xe599('0x17')](_0xe599('0x61'),this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]]);logger['debug'](_0xe599('0x62'),_0xfb8cad[_0xe599('0x1a')],util['inspect'](this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xe599('0x17')](_0xe599('0x63'),this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]]);logger['debug'](_0xe599('0x64'),_0xfb8cad[_0xe599('0x1a')],util[_0xe599('0x1b')](this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0xe599('0x26'),_0xe599('0x65'),this[_0xe599('0xc')]);logger[_0xe599('0x33')](_0xe599('0x66'),JSON[_0xe599('0x67')](this['channels'][_0xfb8cad[_0xe599('0x1a')]]));logger[_0xe599('0x18')](_0xe599('0x68'),_0xfb8cad[_0xe599('0x1a')],util[_0xe599('0x1b')](this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x1a')]],{'showHidden':![],'depth':null}));this[_0xe599('0x17')](_0xe599('0x26'),_0xe599('0x69'),this['channels'][_0xfb8cad[_0xe599('0x1a')]]);this[_0xe599('0x6a')](_0xfb8cad['uniqueid']);}else if(this[_0xe599('0xa')][_0xfb8cad['linkedid']]){this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x6b')]][_0xe599('0x1a')]=this[_0xe599('0xa')][_0xfb8cad[_0xe599('0x6b')]][_0xe599('0x6c')];}if(this[_0xe599('0x3d')][_0xfb8cad[_0xe599('0x1a')]]){delete this['variables'][_0xfb8cad['uniqueid']];}}}catch(_0x3577d0){logger[_0xe599('0x2a')](_0xe599('0x6d'),_0xfb8cad[_0xe599('0x1a')],util[_0xe599('0x1b')](_0x3577d0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe599('0x14')]['syncNewExten']=function(_0x2a8c8a){try{if(this[_0xe599('0x15')](_0x2a8c8a)){logger[_0xe599('0x18')]('[%s][voiceDialReport][newexten]\x20event:',_0x2a8c8a[_0xe599('0x1a')],util['inspect'](_0x2a8c8a,{'showHidden':![],'depth':null}));if(_0x2a8c8a[_0xe599('0x6e')]['toLowerCase']()===_0xe599('0x6f')){_0x2a8c8a[_0xe599('0x70')]=(_0x2a8c8a[_0xe599('0x71')]||_0x2a8c8a[_0xe599('0x70')])[_0xe599('0x72')]();if(_[_0xe599('0x73')](_0x2a8c8a[_0xe599('0x70')],_0xe599('0x74'))){if(_[_0xe599('0x16')](this[_0xe599('0xd')][_0x2a8c8a[_0xe599('0x1a')]]))this[_0xe599('0xd')][_0x2a8c8a[_0xe599('0x1a')]]={};logger[_0xe599('0x33')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x2a8c8a[_0xe599('0x1a')],_0x2a8c8a['application'],_0x2a8c8a[_0xe599('0x70')]);var _0x2f8ae9=_0x2a8c8a[_0xe599('0x70')]['split']('=');var _0x10439f=_0x2f8ae9[0x0][_0xe599('0x75')](/cdr\((.*)\)/);if(_0x10439f)this[_0xe599('0xd')][_0x2a8c8a[_0xe599('0x1a')]][_0x10439f[0x1]]=_0x2f8ae9[0x1];}}}}catch(_0x277b02){logger['error'](_0xe599('0x76'),_0x2a8c8a[_0xe599('0x1a')],util[_0xe599('0x1b')](_0x277b02,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe599('0x14')]['deleteChannelAfterTimeout']=function(_0x569eae,_0xf60eb=0x2710){if(this['channels'][_0x569eae]){setTimeout(()=>{delete this['channels'][_0x569eae];},_0xf60eb);}};module[_0xe599('0x77')]=VoiceDialReport; \ No newline at end of file +var _0x231f=['startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outbound','applications','variables','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','substring','lastIndexOf','channel','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','starttime','complete','holdtime','diff','seconds','billableseconds','sumHoldTime','sumBillable','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','application','toLowerCase','set','applicationdata','appdata'];(function(_0x567105,_0x5b2d49){var _0x53e5fb=function(_0x16d0b3){while(--_0x16d0b3){_0x567105['push'](_0x567105['shift']());}};_0x53e5fb(++_0x5b2d49);}(_0x231f,0x167));var _0xf231=function(_0x3a3d03,_0x5856fa){_0x3a3d03=_0x3a3d03-0x0;var _0x52dca3=_0x231f[_0x3a3d03];return _0x52dca3;};'use strict';var _=require(_0xf231('0x0'));var moment=require(_0xf231('0x1'));var util=require('util');var Redis=require(_0xf231('0x2'));var config=require(_0xf231('0x3'));var logger=require(_0xf231('0x4'))(_0xf231('0x5'));var ami=require(_0xf231('0x6'));config['redis']=_['defaults'](config[_0xf231('0x7')],{'host':_0xf231('0x8'),'port':0x18eb});var io=require(_0xf231('0x9'))(new Redis(config[_0xf231('0x7')]));function VoiceDialReport(_0x3cf386){this[_0xf231('0xa')]=_0x3cf386['outboundChannels'];this[_0xf231('0xb')]=_0x3cf386[_0xf231('0xb')];this[_0xf231('0xc')]={};this[_0xf231('0xd')]={};ami['on']('dialbegin',this[_0xf231('0xe')][_0xf231('0xf')](this));ami['on'](_0xf231('0x10'),this[_0xf231('0x11')][_0xf231('0xf')](this));ami['on'](_0xf231('0x12'),this[_0xf231('0x13')][_0xf231('0xf')](this));ami['on'](_0xf231('0x14'),this[_0xf231('0x15')]['bind'](this));}VoiceDialReport[_0xf231('0x16')][_0xf231('0x17')]=function(_0x8e6abc){return _0x8e6abc!==null&&!_[_0xf231('0x18')](_0x8e6abc);};VoiceDialReport[_0xf231('0x16')]['emit']=function(_0x3433bc,_0xb32fe2,_0x27f181){io['to'](_0x3433bc)[_0xf231('0x19')](_0xb32fe2,_0x27f181);};VoiceDialReport[_0xf231('0x16')][_0xf231('0xe')]=function(_0x5043db){try{if(this[_0xf231('0x17')](_0x5043db)){logger[_0xf231('0x1a')](_0xf231('0x1b'),_0x5043db[_0xf231('0x1c')],util[_0xf231('0x1d')](_0x5043db,{'showHidden':![],'depth':null}));if(this[_0xf231('0xa')][_0x5043db[_0xf231('0x1c')]]){_[_0xf231('0x1e')](this[_0xf231('0xa')][_0x5043db['uniqueid']],{'starttime':moment()[_0xf231('0x1f')](_0xf231('0x20')),'lastevent':'called','interface':_0x5043db['channel'][_0xf231('0x21')](0x0,_0x5043db['channel'][_0xf231('0x22')]('-')),'membername':_0x5043db[_0xf231('0x23')]['substring'](_0x5043db[_0xf231('0x23')]['lastIndexOf']('/')+0x1,_0x5043db['channel'][_0xf231('0x22')]('-'))},_['omit'](_0x5043db,[_0xf231('0x24'),_0xf231('0x25')]));logger[_0xf231('0x26')](_0xf231('0x27'),_0x5043db[_0xf231('0x1c')],this[_0xf231('0xa')][_0x5043db[_0xf231('0x1c')]][_0xf231('0x28')],this[_0xf231('0xa')][_0x5043db[_0xf231('0x1c')]][_0xf231('0x29')]);logger[_0xf231('0x1a')](_0xf231('0x2a'),_0x5043db['uniqueid'],util[_0xf231('0x1d')](this[_0xf231('0xa')][_0x5043db[_0xf231('0x1c')]],{'showHidden':![],'depth':null}));if(this[_0xf231('0xc')][_0x5043db['uniqueid']])_[_0xf231('0x1e')](this[_0xf231('0xa')][_0x5043db[_0xf231('0x1c')]],this['applications'][_0x5043db[_0xf231('0x1c')]]);this[_0xf231('0x19')](_0xf231('0x2b'),_0xf231('0x2c'),this[_0xf231('0xa')][_0x5043db[_0xf231('0x1c')]]);logger[_0xf231('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x5043db[_0xf231('0x1c')],util['inspect'](this[_0xf231('0xa')][_0x5043db[_0xf231('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xf231('0x19')](_0xf231('0x2d'),this[_0xf231('0xa')][_0x5043db[_0xf231('0x1c')]]);}}}catch(_0x1b769d){logger[_0xf231('0x2e')]('[%s][voiceDialReport][dialbegin]',_0x5043db[_0xf231('0x1c')],util[_0xf231('0x1d')](_0x1b769d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf231('0x16')][_0xf231('0x11')]=function(_0x3e0bc8){try{if(this['isNotNull'](_0x3e0bc8)){logger['debug'](_0xf231('0x2f'),_0x3e0bc8[_0xf231('0x1c')],util[_0xf231('0x1d')](_0x3e0bc8,{'showHidden':![],'depth':null}));if(this[_0xf231('0xa')][_0x3e0bc8[_0xf231('0x1c')]]){this[_0xf231('0xa')][_0x3e0bc8['uniqueid']]['dialstatus']=_0x3e0bc8['dialstatus'];if(_0x3e0bc8[_0xf231('0x30')]===_0xf231('0x31')){this[_0xf231('0xa')][_0x3e0bc8[_0xf231('0x1c')]][_0xf231('0x32')]=_0x3e0bc8['connectedlinenum'];this['channels'][_0x3e0bc8[_0xf231('0x1c')]]['connectedlinename']=_0x3e0bc8['connectedlinename'];this[_0xf231('0xa')][_0x3e0bc8[_0xf231('0x1c')]][_0xf231('0x33')]=moment()[_0xf231('0x1f')](_0xf231('0x20'));this[_0xf231('0xa')][_0x3e0bc8[_0xf231('0x1c')]][_0xf231('0x34')]=_0xf231('0x35');logger['info'](_0xf231('0x36'),_0x3e0bc8['uniqueid'],_0x3e0bc8[_0xf231('0x23')][_0xf231('0x21')](_0x3e0bc8[_0xf231('0x23')][_0xf231('0x22')]('/')+0x1,_0x3e0bc8[_0xf231('0x23')][_0xf231('0x22')]('-')));logger[_0xf231('0x1a')](_0xf231('0x37'),_0x3e0bc8[_0xf231('0x1c')],util[_0xf231('0x1d')](this[_0xf231('0xa')][_0x3e0bc8['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xf231('0x38'),this[_0xf231('0xa')][_0x3e0bc8['uniqueid']]);}logger[_0xf231('0x1a')](_0xf231('0x39'),_0x3e0bc8[_0xf231('0x1c')],util[_0xf231('0x1d')](this[_0xf231('0xa')][_0x3e0bc8[_0xf231('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0xf231('0x2b'),_0xf231('0x2c'),this['channels'][_0x3e0bc8[_0xf231('0x1c')]]);}}}catch(_0x305939){logger['error'](_0xf231('0x3a'),_0x3e0bc8['uniqueid'],util[_0xf231('0x1d')](_0x305939,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf231('0x16')]['syncVarSet']=function(_0x556044){try{if(this['isNotNull'](_0x556044)){logger[_0xf231('0x1a')](_0xf231('0x3b'),_0x556044[_0xf231('0x1c')],util[_0xf231('0x1d')](_0x556044,{'showHidden':![],'depth':null}));this[_0xf231('0x3c')](_0x556044[_0xf231('0x1c')],_[_0xf231('0x3d')](_0x556044[_0xf231('0x3e')])[0x0],_0x556044[_0xf231('0x3f')]);if(this[_0xf231('0x17')](_0x556044[_0xf231('0x3e')])&&this[_0xf231('0x17')](_0x556044['variable'][_0xf231('0x40')])){if(_[_0xf231('0x18')](this['channels'][_0x556044[_0xf231('0x1c')]])){this[_0xf231('0xa')][_0x556044['uniqueid']]={'routeId':_0x556044['value'],'variables':this[_0xf231('0xd')][_0x556044[_0xf231('0x1c')]],'motionChannel':'voice'};logger[_0xf231('0x26')](_0xf231('0x41'),_0x556044[_0xf231('0x1c')],_0x556044[_0xf231('0x3e')][_0xf231('0x40')],_[_0xf231('0x3d')](_0x556044[_0xf231('0x3e')])[0x0],_0x556044['value']);logger[_0xf231('0x1a')](_0xf231('0x42'),_0x556044[_0xf231('0x1c')],util[_0xf231('0x1d')](this[_0xf231('0xa')][_0x556044[_0xf231('0x1c')]],{'showHidden':![],'depth':null}));this[_0xf231('0x19')](_0xf231('0x2b'),_0xf231('0x2c'),this[_0xf231('0xa')][_0x556044['uniqueid']]);}}}}catch(_0x3ca2ca){logger[_0xf231('0x2e')](_0xf231('0x43'),_0x556044[_0xf231('0x1c')],util[_0xf231('0x1d')](_0x3ca2ca,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf231('0x16')][_0xf231('0x3c')]=function(_0x5878f6,_0xf6a3ea,_0x585014){var _0x58ee87=['rtpaudioqos',_0xf231('0x44'),_0xf231('0x45'),'rtpaudioqosjitterbridged',_0xf231('0x46'),'rtpaudioqoslossbridged',_0xf231('0x47'),_0xf231('0x48'),'sipcallid',_0xf231('0x49'),_0xf231('0x4a'),_0xf231('0x4b'),'membercalls',_0xf231('0x4c'),_0xf231('0x4d'),_0xf231('0x4e'),_0xf231('0x28'),'memberpenalty',_0xf231('0x4f')];if(!_[_0xf231('0x50')](_0xf6a3ea)&&!_['includes'](_0x58ee87,_0xf6a3ea)){if(_[_0xf231('0x18')](this[_0xf231('0xd')][_0x5878f6])){this[_0xf231('0xd')][_0x5878f6]={};}this['variables'][_0x5878f6][_0xf6a3ea]=_0x585014;}};VoiceDialReport[_0xf231('0x16')][_0xf231('0x15')]=function(_0x4130e3){try{if(this['isNotNull'](_0x4130e3)){logger[_0xf231('0x1a')](_0xf231('0x51'),_0x4130e3[_0xf231('0x1c')],util[_0xf231('0x1d')](_0x4130e3,{'showHidden':![],'depth':null}));if(this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]]){logger[_0xf231('0x26')](_0xf231('0x52'),_0x4130e3[_0xf231('0x1c')],_0x4130e3[_0xf231('0x53')]);this['channels'][_0x4130e3[_0xf231('0x1c')]][_0xf231('0x54')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]]['duration']=moment(this['channels'][_0x4130e3[_0xf231('0x1c')]]['endtime'])['diff'](this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]][_0xf231('0x55')],'seconds');this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]][_0xf231('0x34')]=_0xf231('0x56');this[_0xf231('0xb')]['total']+=0x1;if(this[_0xf231('0xa')][_0x4130e3['uniqueid']][_0xf231('0x33')]){this[_0xf231('0xb')]['answered']+=0x1;this['channels'][_0x4130e3[_0xf231('0x1c')]][_0xf231('0x57')]=moment(this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]][_0xf231('0x33')])[_0xf231('0x58')](this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]][_0xf231('0x55')],_0xf231('0x59'));this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]][_0xf231('0x5a')]=moment(this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]][_0xf231('0x54')])[_0xf231('0x58')](this['channels'][_0x4130e3[_0xf231('0x1c')]]['answertime'],'seconds');this[_0xf231('0xb')][_0xf231('0x5b')]+=this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]][_0xf231('0x57')]||0x0;this[_0xf231('0xb')][_0xf231('0x5c')]+=this['channels'][_0x4130e3[_0xf231('0x1c')]]['billableseconds'];}this['outbound']['sumDuration']+=this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]][_0xf231('0x5d')];logger['debug'](_0xf231('0x5e'),_0x4130e3['uniqueid'],util[_0xf231('0x1d')](this[_0xf231('0xa')][_0x4130e3['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xf231('0x5f'),this[_0xf231('0xa')][_0x4130e3['uniqueid']]);logger['debug'](_0xf231('0x60'),_0x4130e3['uniqueid'],util['inspect'](this[_0xf231('0xa')][_0x4130e3['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xf231('0x61'),this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]]);logger[_0xf231('0x1a')](_0xf231('0x62'),_0x4130e3[_0xf231('0x1c')],util[_0xf231('0x1d')](this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]],{'showHidden':![],'depth':null}));this[_0xf231('0x19')](_0xf231('0x2b'),'voice_outbound:save',this[_0xf231('0xb')]);logger[_0xf231('0x26')](_0xf231('0x63'),JSON[_0xf231('0x64')](this[_0xf231('0xa')][_0x4130e3['uniqueid']]));logger['debug'](_0xf231('0x65'),_0x4130e3['uniqueid'],util[_0xf231('0x1d')](this[_0xf231('0xa')][_0x4130e3['uniqueid']],{'showHidden':![],'depth':null}));this[_0xf231('0x19')](_0xf231('0x2b'),_0xf231('0x66'),this[_0xf231('0xa')][_0x4130e3[_0xf231('0x1c')]]);this[_0xf231('0x67')](_0x4130e3[_0xf231('0x1c')]);}else if(this[_0xf231('0xa')][_0x4130e3['linkedid']]){this[_0xf231('0xa')][_0x4130e3[_0xf231('0x68')]][_0xf231('0x1c')]=this[_0xf231('0xa')][_0x4130e3[_0xf231('0x68')]][_0xf231('0x69')];}if(this[_0xf231('0xd')][_0x4130e3[_0xf231('0x1c')]]){delete this[_0xf231('0xd')][_0x4130e3[_0xf231('0x1c')]];}}}catch(_0x51a416){logger[_0xf231('0x2e')](_0xf231('0x6a'),_0x4130e3[_0xf231('0x1c')],util['inspect'](_0x51a416,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf231('0x16')][_0xf231('0x6b')]=function(_0x5d4278){try{if(this[_0xf231('0x17')](_0x5d4278)){logger[_0xf231('0x1a')]('[%s][voiceDialReport][newexten]\x20event:',_0x5d4278[_0xf231('0x1c')],util[_0xf231('0x1d')](_0x5d4278,{'showHidden':![],'depth':null}));if(_0x5d4278[_0xf231('0x6c')][_0xf231('0x6d')]()===_0xf231('0x6e')){_0x5d4278[_0xf231('0x6f')]=(_0x5d4278[_0xf231('0x70')]||_0x5d4278[_0xf231('0x6f')])[_0xf231('0x6d')]();if(_[_0xf231('0x71')](_0x5d4278['applicationdata'],_0xf231('0x72'))){if(_[_0xf231('0x18')](this[_0xf231('0xc')][_0x5d4278[_0xf231('0x1c')]]))this['applications'][_0x5d4278[_0xf231('0x1c')]]={};logger[_0xf231('0x26')](_0xf231('0x73'),_0x5d4278[_0xf231('0x1c')],_0x5d4278[_0xf231('0x6c')],_0x5d4278[_0xf231('0x6f')]);var _0x462ad5=_0x5d4278[_0xf231('0x6f')][_0xf231('0x74')]('=');var _0x50401e=_0x462ad5[0x0][_0xf231('0x75')](/cdr\((.*)\)/);if(_0x50401e)this[_0xf231('0xc')][_0x5d4278[_0xf231('0x1c')]][_0x50401e[0x1]]=_0x462ad5[0x1];}}}}catch(_0x31a09d){logger[_0xf231('0x2e')]('[%s][voiceDialReport][newexten]',_0x5d4278[_0xf231('0x1c')],util['inspect'](_0x31a09d,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['deleteChannelAfterTimeout']=function(_0x46a493,_0x2e41ef=0x2710){if(this['channels'][_0x46a493]){setTimeout(()=>{delete this['channels'][_0x46a493];},_0x2e41ef);}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 4ef4456..f3b1584 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce7a=['[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','startsWith','cdr(','[%s][voiceQueueReport][newexten]','moment','util','ioredis','../../../config/logger','ami','../model/queueReport','defaults','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','queueChannels','voiceQueues','campaigns','summary','syncQueueSummary','bind','queuesummarycomplete','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','queuecallerexit','queuecallercomplete','clearZombieChannels','switch','isNil','channels','Action','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','variables','[%s][voiceQueueReport][checkVariables]','clearQueueReport','agents','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][','uniqueid','format','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice:queue:%s','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','isRunning','queuesummary','actionid','queuestatus','createQueueSummaryReport','summaryEvent','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','assign','outbound','custom:queuesummary','statusRequests','syncQueueSummaryComplete','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','then','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','queuecallercompleteAt','holdtime','originalposition','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','last','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','transferexten','destexten','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queuecallerabandonAt','varset','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','length','sumHoldTime','COMPLETEDBYAGENT','sumDuration','milliseconds','diff','total','answered','sumBillable','unmanaged','lastevent','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transferuniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','syncBlindTransfer'];(function(_0x46e138,_0xa722d3){var _0x17ae6a=function(_0x513b35){while(--_0x513b35){_0x46e138['push'](_0x46e138['shift']());}};_0x17ae6a(++_0xa722d3);}(_0xce7a,0x106));var _0xace7=function(_0x1ac2a8,_0x4fb2c9){_0x1ac2a8=_0x1ac2a8-0x0;var _0x18ccd4=_0xce7a[_0x1ac2a8];return _0x18ccd4;};'use strict';var _=require('lodash');var moment=require(_0xace7('0x0'));var util=require(_0xace7('0x1'));var Redis=require(_0xace7('0x2'));var config=require('../../../config/environment');var logger=require(_0xace7('0x3'))(_0xace7('0x4'));var ami=require('../ami');var QueueReport=require(_0xace7('0x5'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config['redis']=_[_0xace7('0x6')](config[_0xace7('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xace7('0x8'))(new Redis(config[_0xace7('0x7')]));var Sequence=function(){};Sequence[_0xace7('0x9')][_0xace7('0xa')]=function(_0x1be368){this[_0xace7('0xb')]=this[_0xace7('0xb')]?this[_0xace7('0xb')][_0xace7('0xc')](_0x1be368):_0x1be368();};function VoiceQueueReport(_0x430d73){this[_0xace7('0xd')]=new Sequence();this[_0xace7('0xe')]={};this['realtime']=_0x430d73;this['agents']=_0x430d73['agents'];this['channels']=_0x430d73[_0xace7('0xf')];this['voiceQueues']=_0x430d73[_0xace7('0x10')];this[_0xace7('0x11')]=_0x430d73[_0xace7('0x11')];this[_0xace7('0x12')]=initializeSummary();this['variables']={};ami['on']('queuesummary',this[_0xace7('0x13')][_0xace7('0x14')](this));ami['on'](_0xace7('0x15'),this['syncQueueSummaryComplete'][_0xace7('0x14')](this));ami['on']('queuemember',this[_0xace7('0x16')][_0xace7('0x14')](this));ami['on'](_0xace7('0x17'),this[_0xace7('0x18')][_0xace7('0x14')](this));ami['on'](_0xace7('0x19'),this[_0xace7('0x1a')][_0xace7('0x14')](this));ami['on'](_0xace7('0x1b'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xace7('0x1c'),this[_0xace7('0x1d')][_0xace7('0x14')](this));ami['on'](_0xace7('0x1e'),this[_0xace7('0x1f')][_0xace7('0x14')](this));ami['on'](_0xace7('0x20'),this[_0xace7('0x21')][_0xace7('0x14')](this));ami['on']('varset',this[_0xace7('0x22')][_0xace7('0x14')](this));ami['on'](_0xace7('0x23'),this[_0xace7('0x24')]['bind'](this));ami['on'](_0xace7('0x25'),this[_0xace7('0x26')][_0xace7('0x14')](this));ami['on']('musiconholdstart',this[_0xace7('0x27')][_0xace7('0x14')](this));ami['on'](_0xace7('0x28'),this[_0xace7('0x29')][_0xace7('0x14')](this));ami['on'](_0xace7('0x2a'),this[_0xace7('0x2b')][_0xace7('0x14')](this));ami['on'](_0xace7('0x2c'),this['syncBlindTransfer'][_0xace7('0x14')](this));this[_0xace7('0x2d')]();this[_0xace7('0x2e')]();}function clearChannels(_0x552f3f){if(!_[_0xace7('0x2f')](_0x552f3f)){for(var _0x248765 in _0x552f3f){if(_0x552f3f[_0xace7('0x30')](_0x248765)){delete _0x552f3f[_0x248765];}}}}function clearCampaigns(_0x282cfa){if(!_['isEmpty'](_0x282cfa)){for(var _0x2d3efd in _0x282cfa){if(_0x282cfa[_0xace7('0x30')](_0x2d3efd)){_0x282cfa[_0x2d3efd][_0xace7('0x31')]=0x0;}}}}function clearVoiceQueues(_0x18e5f2){if(!_[_0xace7('0x2f')](_0x18e5f2)){for(var _0x44fc09 in _0x18e5f2){if(_0x18e5f2[_0xace7('0x30')](_0x44fc09)){_0x18e5f2[_0x44fc09][_0xace7('0x31')]=0x0;_0x18e5f2[_0x44fc09][_0xace7('0x32')]=0x0;_0x18e5f2[_0x44fc09][_0xace7('0x33')]=0x0;_0x18e5f2[_0x44fc09]['waiting']=0x0;_0x18e5f2[_0x44fc09]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x2dc742){if(!_[_0xace7('0x2f')](_0x2dc742)){for(var _0x432b56 in _0x2dc742){if(_0x2dc742[_0xace7('0x30')](_0x432b56)){_0x2dc742[_0x432b56]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x4479b3){return _0x4479b3[_0xace7('0x34')]||_0x4479b3[_0xace7('0x1b')]||_0x4479b3[_0xace7('0x35')];}VoiceQueueReport[_0xace7('0x9')][_0xace7('0x36')]=function(){var _0x148358=this;for(var _0x5cde43 in this['channels']){if(this['channels'][_0xace7('0x30')](_0x5cde43)&&!this['channels'][_0x5cde43][_0xace7('0x37')]){this[_0xace7('0xd')]['enqueue'](function(){if(!_[_0xace7('0x38')](_0x148358[_0xace7('0x39')][_0x5cde43])){return ami[_0xace7('0x3a')]({'action':'status','channel':_0x148358[_0xace7('0x39')][_0x5cde43][_0xace7('0x3b')]})[_0xace7('0x3c')](function(_0x93fdee){if(_0x93fdee[_0xace7('0x3d')]===_0xace7('0x3e')){setTimeout(function(){if(_0x148358[_0xace7('0x39')][_0x5cde43]){delete _0x148358[_0xace7('0x39')][_0x5cde43];logger[_0xace7('0x3f')](_0xace7('0x40'),_0x5cde43,util[_0xace7('0x41')](_0x93fdee,{'showHidden':![],'depth':null}));}if(_0x148358[_0xace7('0xe')][_0x5cde43]){delete _0x148358['queueReports'][_0x5cde43];logger[_0xace7('0x3f')]('[%s][voiceQueueReport][checkQueueReport]',_0x5cde43,util['inspect'](_0x93fdee,{'showHidden':![],'depth':null}));}if(_0x148358[_0xace7('0x42')][_0x5cde43]){delete _0x148358[_0xace7('0x42')][_0x5cde43];logger[_0xace7('0x3f')](_0xace7('0x43'),_0x5cde43,util[_0xace7('0x41')](_0x93fdee,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x26')]=function(){logger[_0xace7('0x3f')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xace7('0x39')]);this[_0xace7('0x44')](this[_0xace7('0xe')]);clearAgentBooked(this[_0xace7('0x45')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xace7('0x11')]);this['summary']=initializeSummary();};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x44')]=function(_0x3562ef){var _0x32fede=this;if(!_[_0xace7('0x2f')](_0x3562ef)){for(var _0x27f62a in _0x3562ef){if(_0x3562ef[_0xace7('0x30')](_0x27f62a)){_0x32fede[_0xace7('0x46')](_0x3562ef[_0x27f62a],_0xace7('0x47'));delete _0x3562ef[_0x27f62a];}}}};VoiceQueueReport['prototype'][_0xace7('0x48')]=function(_0x2004c9,_0x3e6711,_0x414f24){io['to'](_0x2004c9)[_0xace7('0x48')](_0x3e6711,_0x414f24);};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x49')]=function(_0x1d2401,_0x54ce09){logger[_0xace7('0x4a')](_0xace7('0x4b')+_0x54ce09+']\x20sending\x20voice_queue_channel:save\x20event:',_0x1d2401[_0xace7('0x4c')],util[_0xace7('0x41')](_0x1d2401,{'showHidden':![],'depth':null}));this[_0xace7('0x48')](util[_0xace7('0x4d')]('voice:queue:%s',_0x1d2401[_0xace7('0x4e')]),_0xace7('0x4f'),_0x1d2401);io[_0xace7('0x48')](_0xace7('0x50'),_0x1d2401);};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x46')]=function(_0x403adb,_0x2b117e){logger[_0xace7('0x4a')](_0xace7('0x4b')+_0x2b117e+_0xace7('0x51'),_0x403adb[_0xace7('0x4c')],util[_0xace7('0x41')](_0x403adb,{'showHidden':![],'depth':null}));if(_0x403adb[_0xace7('0x52')]===_0xace7('0x53')){return;}this['emit'](util[_0xace7('0x4d')](_0xace7('0x54'),_0x403adb[_0xace7('0x4e')]),'voice_queue_channel:remove',_0x403adb);io[_0xace7('0x48')]('voice_queue_presence:remove',_0x403adb);};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x55')]=function(_0x2d5fae){if(_0x2d5fae[_0xace7('0x56')]===_0xace7('0x57')){logger['debug'](_0xace7('0x58'),util['inspect'](_0x2d5fae,{'showHidden':![],'depth':null}));this[_0xace7('0x48')](util[_0xace7('0x4d')]('voice:queue:%s',_0x2d5fae[_0xace7('0x59')]),_0xace7('0x5a'),_0x2d5fae);}};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x5b')]=function(_0x139e18){return _0x139e18!==null&&!_[_0xace7('0x5c')](_0x139e18);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x5da69a=this;setInterval(function(){_0x5da69a[_0xace7('0x36')]();ami['Action']({'action':_0xace7('0x5d')})[_0xace7('0x3c')](function(_0x15eb70){logger['error'](_0xace7('0x5e'),util[_0xace7('0x41')](_0x15eb70,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x2d')]=function(){var _0x2af7a8=this;setInterval(function(){if(!_0x2af7a8[_0xace7('0x12')][_0xace7('0x5f')]){return ami[_0xace7('0x3a')]({'action':_0xace7('0x60')})['then'](function(_0xf19287){_0x2af7a8[_0xace7('0x12')]['id']=_0xf19287[_0xace7('0x61')];_0x2af7a8['summary'][_0xace7('0x5f')]=!![];_0x2af7a8[_0xace7('0x12')][_0xace7('0x62')][_0xf19287[_0xace7('0x61')]]={};})[_0xace7('0x3c')](function(_0x5946c9){logger[_0xace7('0x3f')]('[voiceQueueReport][queuesummary]',util[_0xace7('0x41')](_0x5946c9,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x63')]=function(_0x3235d9,_0x4f041e){var _0x25f77e;if(this[_0xace7('0x12')]&&this[_0xace7('0x12')][_0xace7('0x5d')]&&this[_0xace7('0x12')]['queues'][_0x3235d9[_0xace7('0x59')]]){_0x25f77e=this[_0xace7('0x12')][_0xace7('0x5d')][_0x3235d9[_0xace7('0x59')]][_0xace7('0x64')];}var _0x58ab90=new VoiceQueueSummary(_0x3235d9);return _0x58ab90[_0xace7('0x65')](_0x4f041e['agents'],this['agents'],_0x25f77e,this[_0xace7('0x66')]['channels']);};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x67')]=function(_0x1fca21,_0x5bb5b9){var _0xe4f3f9=this['createQueueSummaryReport'](_0x1fca21,_0x5bb5b9);var _0x5a0aef=![];_0x5a0aef=_0xe4f3f9[_0xace7('0x68')](_0x1fca21);if(_0x5a0aef){Object[_0xace7('0x69')](_0x1fca21,_0xe4f3f9);this[_0xace7('0x66')][_0xace7('0x10')][_0x1fca21[_0xace7('0x59')]]=_0x1fca21;this[_0xace7('0x55')](_0xe4f3f9);}};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x18')]=function(_0x293cd9){var _0x59d573=null;var _0x36b48d=this['summary']['id'];if(this[_0xace7('0x12')][_0xace7('0x62')][_0x36b48d]){_0x59d573=this[_0xace7('0x12')][_0xace7('0x62')][_0x36b48d][_0x293cd9[_0xace7('0x61')]];}if(!_0x59d573){this[_0xace7('0x12')]=initializeSummary();return;}var _0x45b8ce=this[_0xace7('0x10')][_0x59d573['queue']];if(_0x45b8ce[_0xace7('0x56')]===_0xace7('0x57')){this['handleInboundQueueSummaryReport'](_0x45b8ce,_0x59d573);}else if(_0x45b8ce[_0xace7('0x56')]===_0xace7('0x6a')){var _0x36bdf5=this[_0xace7('0x63')](_0x45b8ce,_0x59d573);ami[_0xace7('0x48')](_0xace7('0x6b'),_0x36bdf5);}this['summary']['statusRequests']-=0x1;var _0x513d35=this[_0xace7('0x12')][_0xace7('0x6c')]>0x0?!![]:![];if(!_0x513d35){return this[_0xace7('0x6d')](this[_0xace7('0x12')][_0xace7('0x6e')]);}};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x16')]=function(_0x31cc8f){var _0x79ae10=this['summary']['id'];if(this[_0xace7('0x12')]['queuestatus'][_0x79ae10]&&this[_0xace7('0x12')][_0xace7('0x62')][_0x79ae10][_0x31cc8f['actionid']]){this[_0xace7('0x12')]['queuestatus'][_0x79ae10][_0x31cc8f[_0xace7('0x61')]][_0xace7('0x45')][_0xace7('0x6f')](_0x31cc8f);}};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x13')]=function(_0x2ff1c3){var _0x4e65c7=this;try{if(this[_0xace7('0x5b')](_0x2ff1c3)&&this['isNotNull'](_0x2ff1c3[_0xace7('0x4e')])){logger[_0xace7('0x4a')](_0xace7('0x70'),util['inspect'](_0x2ff1c3,{'showHidden':![],'depth':null}));var _0x53cda0=this[_0xace7('0x10')][_0x2ff1c3['queue']];if(_0x53cda0){logger[_0xace7('0x4a')](_0xace7('0x71'),_0x53cda0[_0xace7('0x59')]);this[_0xace7('0x12')]['queues'][_0x53cda0[_0xace7('0x59')]]={'summaryEvent':_0x2ff1c3};this[_0xace7('0x12')][_0xace7('0x6c')]+=0x1;return ami[_0xace7('0x3a')]({'action':'queuestatus','queue':_0x53cda0['name']})[_0xace7('0x72')](function(_0x406cab){if(!_0x4e65c7[_0xace7('0x12')][_0xace7('0x62')][_0x2ff1c3[_0xace7('0x61')]]){_0x4e65c7[_0xace7('0x12')]['queuestatus'][_0x2ff1c3[_0xace7('0x61')]]={};}_0x4e65c7[_0xace7('0x12')][_0xace7('0x62')][_0x2ff1c3[_0xace7('0x61')]][_0x406cab[_0xace7('0x61')]]={'queue':_0x53cda0[_0xace7('0x59')],'agents':[]};})[_0xace7('0x3c')](function(_0x4acf9a){throw _0x4acf9a;});}}}catch(_0x9a1770){logger[_0xace7('0x3f')](_0xace7('0x73'),util[_0xace7('0x41')](_0x9a1770,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x6d')]=function(_0xfed1a7){if(this[_0xace7('0x12')][_0xace7('0x6c')]>0x0){this[_0xace7('0x12')][_0xace7('0x6e')]=_0xfed1a7;return;}logger[_0xace7('0x4a')](_0xace7('0x74'),util[_0xace7('0x41')](_0xfed1a7,{'showHidden':![],'depth':null}));this[_0xace7('0x12')]=initializeSummary();ami['emit'](_0xace7('0x75'),{});};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x1a')]=function(_0x3e9677){try{if(this[_0xace7('0x5b')](_0x3e9677)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x3e9677[_0xace7('0x4c')],util['inspect'](_0x3e9677,{'showHidden':![],'depth':null}));if(_[_0xace7('0x5c')](this[_0xace7('0xe')][_0x3e9677[_0xace7('0x4c')]])){this[_0xace7('0xe')][_0x3e9677[_0xace7('0x4c')]]=[];}if(_['isUndefined'](this['channels'][_0x3e9677['uniqueid']])){this['channels'][_0x3e9677['uniqueid']]={};}var _0x36bdaa=new QueueReport();_0x36bdaa[_0xace7('0x4e')]=_0x3e9677[_0xace7('0x4e')];_0x36bdaa[_0xace7('0x56')]=this[_0xace7('0x10')][_0x36bdaa[_0xace7('0x4e')]]&&this['voiceQueues'][_0x36bdaa['queue']][_0xace7('0x56')]?this[_0xace7('0x10')][_0x36bdaa[_0xace7('0x4e')]][_0xace7('0x56')]||_0xace7('0x57'):'inbound';_0x36bdaa[_0xace7('0x76')]=moment()[_0xace7('0x4d')](_0xace7('0x77'));_0x36bdaa[_0xace7('0x78')]=_0x3e9677[_0xace7('0x78')];_0x36bdaa[_0xace7('0x79')]=_0x3e9677['count'];_0x36bdaa[_0xace7('0x4c')]=_0x3e9677[_0xace7('0x4c')];logger[_0xace7('0x7a')](_0xace7('0x7b'),_0x36bdaa['queue'],_0x36bdaa[_0xace7('0x56')]);Object['assign'](_0x36bdaa,_[_0xace7('0x7c')](_0x3e9677,_[_0xace7('0x7d')](_0x36bdaa)));this[_0xace7('0xe')][_0x3e9677['uniqueid']][_0xace7('0x6f')](_0x36bdaa);this['channels'][_0x3e9677[_0xace7('0x4c')]]=_0x36bdaa;this[_0xace7('0x49')](_0x36bdaa,'queuecallerjoin');}}catch(_0x1f452d){logger[_0xace7('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3e9677[_0xace7('0x4c')],util[_0xace7('0x41')](_0x1f452d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xace7('0x9')]['syncQueueCallerAbandon']=function(_0x33dc7a){try{if(this[_0xace7('0x5b')](_0x33dc7a)){logger[_0xace7('0x4a')]('[%s][voiceQueueReport][queuecallerabandon]',_0x33dc7a[_0xace7('0x4c')],util[_0xace7('0x41')](_0x33dc7a,{'showHidden':![],'depth':null}));if(this[_0xace7('0xe')][_0x33dc7a['uniqueid']]){var _0x3b3c3c=_['last'](this[_0xace7('0xe')][_0x33dc7a[_0xace7('0x4c')]]);_0x3b3c3c['queuecallercomplete']=![];_0x3b3c3c[_0xace7('0x7e')]=null;_0x3b3c3c[_0xace7('0x7f')]=_0x33dc7a[_0xace7('0x7f')];_0x3b3c3c['originalposition']=_0x33dc7a[_0xace7('0x80')];_0x3b3c3c[_0xace7('0x1b')]=!![];_0x3b3c3c['queuecallerabandonAt']=moment()[_0xace7('0x4d')](_0xace7('0x77'));_0x3b3c3c[_0xace7('0x52')]=_0xace7('0x81');_0x3b3c3c[_0xace7('0x82')]=null;logger[_0xace7('0x7a')](_0xace7('0x83'),_0x3b3c3c['queue'],_0x3b3c3c[_0xace7('0x56')]);this[_0xace7('0x39')][_0x33dc7a['uniqueid']]=_0x3b3c3c;this['emitVoiceQueueChannelRemove'](_0x3b3c3c,_0xace7('0x1b'));}}}catch(_0x30730c){logger[_0xace7('0x3f')](_0xace7('0x84'),_0x33dc7a[_0xace7('0x4c')],util['inspect'](_0x30730c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x1d')]=function(_0x34c5c4){try{if(this[_0xace7('0x5b')](_0x34c5c4)){logger[_0xace7('0x4a')](_0xace7('0x85'),_0x34c5c4[_0xace7('0x4c')],util[_0xace7('0x41')](_0x34c5c4,{'showHidden':![],'depth':null}));if(this[_0xace7('0xe')][_0x34c5c4[_0xace7('0x4c')]]){var _0x5c6aca=_['last'](this['queueReports'][_0x34c5c4[_0xace7('0x4c')]]);_0x5c6aca['queuecallerleaveAt']=moment()[_0xace7('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c6aca[_0xace7('0x86')]=_0x34c5c4[_0xace7('0x86')];_0x5c6aca[_0xace7('0x87')]=_0x34c5c4[_0xace7('0x87')];logger[_0xace7('0x7a')](_0xace7('0x88'),_0x5c6aca[_0xace7('0x4e')],_0x5c6aca['type'],_0x34c5c4[_0xace7('0x86')],_0x34c5c4[_0xace7('0x87')]);this[_0xace7('0x39')][_0x34c5c4[_0xace7('0x4c')]]=_0x5c6aca;this[_0xace7('0x49')](_0x5c6aca,_0xace7('0x1c'));}}}catch(_0x326160){logger[_0xace7('0x3f')](_0xace7('0x85'),_0x34c5c4[_0xace7('0x4c')],util[_0xace7('0x41')](_0x326160,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xace7('0x21')]=function(_0x4b92a5){try{if(this[_0xace7('0x5b')](_0x4b92a5)){logger[_0xace7('0x4a')](_0xace7('0x89'),_0x4b92a5[_0xace7('0x4c')],util['inspect'](_0x4b92a5,{'showHidden':![],'depth':null}));if(this[_0xace7('0xe')][_0x4b92a5[_0xace7('0x4c')]]){var _0x250c9b=_[_0xace7('0x8a')](this[_0xace7('0xe')][_0x4b92a5[_0xace7('0x4c')]]);_0x250c9b[_0xace7('0x35')]=!![];_0x250c9b['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xace7('0x7a')](_0xace7('0x8b'),_0x250c9b[_0xace7('0x4e')],_0x250c9b[_0xace7('0x56')]);}}}catch(_0x2f6f8b){logger[_0xace7('0x3f')]('[%s][voiceQueueReport][agentconnect]',_0x4b92a5[_0xace7('0x4c')],util[_0xace7('0x41')](_0x2f6f8b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xace7('0x9')]['syncAgentComplete']=function(_0x1db4dc){try{if(this['isNotNull'](_0x1db4dc)){logger['debug'](_0xace7('0x8c'),_0x1db4dc['uniqueid'],util[_0xace7('0x41')](_0x1db4dc,{'showHidden':![],'depth':null}));if(this[_0xace7('0xe')][_0x1db4dc['uniqueid']]){var _0x1595ea=_['last'](this[_0xace7('0xe')][_0x1db4dc[_0xace7('0x4c')]]);_0x1595ea[_0xace7('0x1b')]=![];_0x1595ea['queuecallerabandonAt']=null;_0x1595ea[_0xace7('0x8d')]=!![];_0x1595ea[_0xace7('0x82')]=_0x1db4dc[_0xace7('0x8e')];_0x1595ea[_0xace7('0x7f')]=_0x1db4dc['holdtime'];_0x1595ea[_0xace7('0x35')]=!![];_0x1595ea[_0xace7('0x34')]=![];_0x1595ea[_0xace7('0x8f')]=null;if(!_0x1595ea[_0xace7('0x90')]){if(_0x1db4dc[_0xace7('0x91')]=='transfer'){_0x1595ea[_0xace7('0x52')]=_0xace7('0x92');logger['info'](_0xace7('0x93'),_0x1595ea[_0xace7('0x4e')],_0x1595ea[_0xace7('0x56')]);}else{if(_['startsWith'](_0x1db4dc['channel'][_0xace7('0x94')](),_0xace7('0x95'))){if(this[_0xace7('0xe')][_0x1db4dc[_0xace7('0x96')]]){var _0x11178a=_['last'](this[_0xace7('0xe')][_0x1db4dc[_0xace7('0x96')]]);_0x11178a[_0xace7('0x35')]=![];_0x11178a[_0xace7('0x34')]=!![];_0x11178a[_0xace7('0x8f')]=moment(_0x1595ea[_0xace7('0x76')])['add'](_0x1db4dc['holdtime'],_0xace7('0x97'))[_0xace7('0x4d')](_0xace7('0x77'));_0x11178a['queuecallerexitreason']=_0xace7('0x98');_0x11178a['transfer']=!![];_0x11178a[_0xace7('0x99')]='FORWARD';_0x11178a[_0xace7('0x9a')]=_0x1db4dc[_0xace7('0x9b')];_0x11178a['transferuniqueid']=_0x1db4dc['uniqueid'];logger[_0xace7('0x7a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x11178a[_0xace7('0x4e')],_0x11178a['type']);var _0xd919ef=this['queueReports'][_0x1db4dc[_0xace7('0x96')]];this[_0xace7('0xe')][_0x1db4dc['linkedid']]=this[_0xace7('0xe')][_0x1db4dc[_0xace7('0x4c')]];this['queueReports'][_0x1db4dc[_0xace7('0x4c')]]=_0xd919ef;}}else{_0x1595ea['queuecallerexitreason']=_0xace7('0x9c')+_0x1db4dc[_0xace7('0x91')][_0xace7('0x9d')]();logger['info'](_0xace7('0x9e'),_0x1595ea[_0xace7('0x4e')],_0x1595ea[_0xace7('0x56')],_0x1595ea[_0xace7('0x52')]);}}}this[_0xace7('0x39')][_0x1db4dc[_0xace7('0x4c')]]=_0x1595ea;}}}catch(_0x72f3fb){logger[_0xace7('0x3f')](_0xace7('0x8c'),_0x1db4dc[_0xace7('0x4c')],util[_0xace7('0x41')](_0x72f3fb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xace7('0x9')][_0xace7('0x22')]=function(_0xdb6d82){try{if(this[_0xace7('0x5b')](_0xdb6d82)){logger[_0xace7('0x4a')](_0xace7('0x9f'),_0xdb6d82[_0xace7('0x4c')],util[_0xace7('0x41')](_0xdb6d82,{'showHidden':![],'depth':null}));this[_0xace7('0xa0')](_0xdb6d82[_0xace7('0x4c')],_['keys'](_0xdb6d82['variable'])[0x0],_0xdb6d82['value']);if(this['queueReports'][_0xdb6d82[_0xace7('0x4c')]]){var _0x99cf17=_[_0xace7('0x8a')](this[_0xace7('0xe')][_0xdb6d82[_0xace7('0x4c')]]);if(_0x99cf17){if(this[_0xace7('0x5b')](_0xdb6d82[_0xace7('0xa1')])&&this['isNotNull'](_0xdb6d82[_0xace7('0xa1')][_0xace7('0x62')])){switch(_0xdb6d82[_0xace7('0xa2')]){case _0xace7('0xa3'):_0x99cf17[_0xace7('0x34')]=![];_0x99cf17[_0xace7('0x8f')]=null;break;case _0xace7('0xa4'):_0x99cf17['lastevent']=_0xace7('0xa5');_0x99cf17[_0xace7('0x34')]=!![];_0x99cf17[_0xace7('0x8f')]=moment()[_0xace7('0x4d')](_0xace7('0x77'));_0x99cf17[_0xace7('0xa6')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xace7('0x4a')](_0xace7('0xa7'),_0xdb6d82[_0xace7('0x4c')],util['inspect'](_0x99cf17,{'showHidden':![],'depth':null}));ami[_0xace7('0x48')]('custom:timeout',_0x99cf17);break;default:_0x99cf17[_0xace7('0x34')]=!![];_0x99cf17[_0xace7('0x8f')]=moment()[_0xace7('0x4d')](_0xace7('0x77'));_0x99cf17[_0xace7('0xa6')]=moment()[_0xace7('0x4d')](_0xace7('0x77'));}_0x99cf17[_0xace7('0x1b')]=![];_0x99cf17[_0xace7('0xa8')]=null;_0x99cf17[_0xace7('0x52')]=_0xdb6d82[_0xace7('0xa2')];this['channels'][_0xdb6d82[_0xace7('0x4c')]]=_0x99cf17;this['emitVoiceQueueChannelRemove'](_0x99cf17,_0xace7('0xa9'));}else if(this['isNotNull'](_0xdb6d82[_0xace7('0xa1')])&&this['isNotNull'](_0xdb6d82[_0xace7('0xa1')]['queueposition'])){if(!_0x99cf17[_0xace7('0x1b')]){_0x99cf17['queuecallerexit']=!![];_0x99cf17[_0xace7('0x8f')]=moment()[_0xace7('0x4d')](_0xace7('0x77'));_0x99cf17[_0xace7('0x52')]=_0xace7('0xaa');_0x99cf17[_0xace7('0xa6')]=moment()[_0xace7('0x4d')](_0xace7('0x77'));this[_0xace7('0x39')][_0xdb6d82[_0xace7('0x4c')]]=_0x99cf17;}}logger[_0xace7('0x7a')](_0xace7('0xab'),_0xdb6d82[_0xace7('0x4c')],_0x99cf17[_0xace7('0x4e')],_0x99cf17['type'],_[_0xace7('0x7d')](_0xdb6d82[_0xace7('0xa1')])[0x0],_0xdb6d82['value']);_0x99cf17[_0xace7('0x42')]=this[_0xace7('0x42')][_0xdb6d82['uniqueid']];}}}}catch(_0x1fab66){logger[_0xace7('0x3f')](_0xace7('0x9f'),_0xdb6d82[_0xace7('0x4c')],util[_0xace7('0x41')](_0x1fab66,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xace7('0x9')]['addVariable']=function(_0x1cf2b3,_0x23d785,_0x4de5ec){var _0x51c698=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss',_0xace7('0xac'),_0xace7('0xad'),_0xace7('0xae'),'sipcallid',_0xace7('0xaf'),_0xace7('0xb0'),_0xace7('0xb1'),_0xace7('0xb2'),_0xace7('0xb3'),_0xace7('0xb4'),_0xace7('0xb5'),_0xace7('0x8e'),_0xace7('0xb6'),_0xace7('0xb7')];if(!_[_0xace7('0x38')](_0x23d785)&&!_[_0xace7('0xb8')](_0x51c698,_0x23d785)){if(_[_0xace7('0x5c')](this['variables'][_0x1cf2b3])){this[_0xace7('0x42')][_0x1cf2b3]={};}this['variables'][_0x1cf2b3][_0x23d785]=_0x4de5ec;}};VoiceQueueReport['prototype'][_0xace7('0xb9')]=function(_0x2ebb05,_0x3db586,_0x596d0c){try{var _0x3de85a={};if(this['queueReports'][_0x2ebb05]){for(var _0x2e1c3a=0x0;_0x2e1c3a{delete this[_0xace7('0x39')][_0x40ffe1];},_0x1ee1f6);}};module['exports']=VoiceQueueReport; \ No newline at end of file +var _0xf843=['originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','syncAgentConnect','queuecallercomplete','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','queuecallerexitAt','seconds','FORWARDTRANSFER','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','isUndefined','handleHangup','length','sumHoldTime','diff','ATTENDEDTRANSFER','sumDuration','milliseconds','total','answered','sumBillable','transfer','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','origtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','syncHangup','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','queueReports','agents','queueChannels','voiceQueues','summary','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','queuestatuscomplete','syncQueueStatusComplete','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','varset','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','hasOwnProperty','isEmpty','originated','talking','waiting','queueStatusComplete','unlockRR','queuecallerabandon','clearZombieChannels','channels','switch','sequence','Action','status','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','error','clearQueueReport','campaigns','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','queue','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','format','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','queues','[voiceQueueReport][queues]','queuesummary','then','actionid','isRunning','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','assign','outbound','custom:queuesummary','statusRequests','completeEvent','syncQueueMember','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime'];(function(_0xd80858,_0x596073){var _0x240db9=function(_0x32cbe7){while(--_0x32cbe7){_0xd80858['push'](_0xd80858['shift']());}};_0x240db9(++_0x596073);}(_0xf843,0x7d));var _0x3f84=function(_0x563d16,_0x3b0ff4){_0x563d16=_0x563d16-0x0;var _0x1522fd=_0xf843[_0x563d16];return _0x1522fd;};'use strict';var _=require('lodash');var moment=require(_0x3f84('0x0'));var util=require(_0x3f84('0x1'));var Redis=require(_0x3f84('0x2'));var config=require(_0x3f84('0x3'));var logger=require(_0x3f84('0x4'))(_0x3f84('0x5'));var ami=require(_0x3f84('0x6'));var QueueReport=require(_0x3f84('0x7'));var VoiceQueueSummary=require(_0x3f84('0x8'));config[_0x3f84('0x9')]=_[_0x3f84('0xa')](config[_0x3f84('0x9')],{'host':_0x3f84('0xb'),'port':0x18eb});var io=require(_0x3f84('0xc'))(new Redis(config[_0x3f84('0x9')]));var Sequence=function(){};Sequence[_0x3f84('0xd')][_0x3f84('0xe')]=function(_0x27d093){this[_0x3f84('0xf')]=this[_0x3f84('0xf')]?this[_0x3f84('0xf')][_0x3f84('0x10')](_0x27d093):_0x27d093();};function VoiceQueueReport(_0x5d9e7b){this['sequence']=new Sequence();this[_0x3f84('0x11')]={};this['realtime']=_0x5d9e7b;this['agents']=_0x5d9e7b[_0x3f84('0x12')];this['channels']=_0x5d9e7b[_0x3f84('0x13')];this['voiceQueues']=_0x5d9e7b[_0x3f84('0x14')];this['campaigns']=_0x5d9e7b['campaigns'];this[_0x3f84('0x15')]=initializeSummary();this[_0x3f84('0x16')]={};ami['on']('queuesummary',this[_0x3f84('0x17')][_0x3f84('0x18')](this));ami['on'](_0x3f84('0x19'),this[_0x3f84('0x1a')][_0x3f84('0x18')](this));ami['on'](_0x3f84('0x1b'),this['syncQueueMember']['bind'](this));ami['on'](_0x3f84('0x1c'),this[_0x3f84('0x1d')][_0x3f84('0x18')](this));ami['on']('queuecallerjoin',this[_0x3f84('0x1e')][_0x3f84('0x18')](this));ami['on']('queuecallerabandon',this[_0x3f84('0x1f')]['bind'](this));ami['on'](_0x3f84('0x20'),this['syncQueueCallerLeave'][_0x3f84('0x18')](this));ami['on'](_0x3f84('0x21'),this[_0x3f84('0x22')][_0x3f84('0x18')](this));ami['on'](_0x3f84('0x23'),this['syncAgentConnect'][_0x3f84('0x18')](this));ami['on'](_0x3f84('0x24'),this['syncVarSet'][_0x3f84('0x18')](this));ami['on']('hangup',this['syncHangup'][_0x3f84('0x18')](this));ami['on'](_0x3f84('0x25'),this[_0x3f84('0x26')][_0x3f84('0x18')](this));ami['on'](_0x3f84('0x27'),this[_0x3f84('0x28')][_0x3f84('0x18')](this));ami['on'](_0x3f84('0x29'),this[_0x3f84('0x2a')][_0x3f84('0x18')](this));ami['on'](_0x3f84('0x2b'),this[_0x3f84('0x2c')][_0x3f84('0x18')](this));ami['on']('blindtransfer',this[_0x3f84('0x2d')][_0x3f84('0x18')](this));this[_0x3f84('0x2e')]();this['loopQueueShow']();}function clearChannels(_0x375a81){if(!_['isEmpty'](_0x375a81)){for(var _0x68d264 in _0x375a81){if(_0x375a81[_0x3f84('0x2f')](_0x68d264)){delete _0x375a81[_0x68d264];}}}}function clearCampaigns(_0x3074a9){if(!_[_0x3f84('0x30')](_0x3074a9)){for(var _0x20f5e0 in _0x3074a9){if(_0x3074a9[_0x3f84('0x2f')](_0x20f5e0)){_0x3074a9[_0x20f5e0][_0x3f84('0x31')]=0x0;}}}}function clearVoiceQueues(_0x484699){if(!_[_0x3f84('0x30')](_0x484699)){for(var _0xe32e5c in _0x484699){if(_0x484699[_0x3f84('0x2f')](_0xe32e5c)){_0x484699[_0xe32e5c]['originated']=0x0;_0x484699[_0xe32e5c][_0x3f84('0x32')]=0x0;_0x484699[_0xe32e5c]['pTalking']=0x0;_0x484699[_0xe32e5c][_0x3f84('0x33')]=0x0;_0x484699[_0xe32e5c][_0x3f84('0x34')]=!![];}}}}function clearAgentBooked(_0x19238f){if(!_[_0x3f84('0x30')](_0x19238f)){for(var _0x2b09b1 in _0x19238f){if(_0x19238f[_0x3f84('0x2f')](_0x2b09b1)){_0x19238f[_0x2b09b1][_0x3f84('0x35')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x235299){return _0x235299['queuecallerexit']||_0x235299[_0x3f84('0x36')]||_0x235299['queuecallercomplete'];}VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x37')]=function(){var _0x599416=this;for(var _0x1bc947 in this['channels']){if(this['channels'][_0x3f84('0x2f')](_0x1bc947)&&!this[_0x3f84('0x38')][_0x1bc947][_0x3f84('0x39')]){this[_0x3f84('0x3a')][_0x3f84('0xe')](function(){if(!_['isNil'](_0x599416['channels'][_0x1bc947])){return ami[_0x3f84('0x3b')]({'action':_0x3f84('0x3c'),'channel':_0x599416['channels'][_0x1bc947]['channel']})[_0x3f84('0x3d')](function(_0x47f26c){if(_0x47f26c[_0x3f84('0x3e')]===_0x3f84('0x3f')){setTimeout(function(){if(_0x599416[_0x3f84('0x38')][_0x1bc947]){delete _0x599416[_0x3f84('0x38')][_0x1bc947];logger['error'](_0x3f84('0x40'),_0x1bc947,util[_0x3f84('0x41')](_0x47f26c,{'showHidden':![],'depth':null}));}if(_0x599416[_0x3f84('0x11')][_0x1bc947]){delete _0x599416[_0x3f84('0x11')][_0x1bc947];logger['error'](_0x3f84('0x42'),_0x1bc947,util[_0x3f84('0x41')](_0x47f26c,{'showHidden':![],'depth':null}));}if(_0x599416[_0x3f84('0x16')][_0x1bc947]){delete _0x599416[_0x3f84('0x16')][_0x1bc947];logger['error'](_0x3f84('0x43'),_0x1bc947,util[_0x3f84('0x41')](_0x47f26c,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x26')]=function(){logger[_0x3f84('0x44')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x3f84('0x38')]);this[_0x3f84('0x45')](this[_0x3f84('0x11')]);clearAgentBooked(this[_0x3f84('0x12')]);clearVoiceQueues(this[_0x3f84('0x14')]);clearCampaigns(this[_0x3f84('0x46')]);this[_0x3f84('0x15')]=initializeSummary();};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x45')]=function(_0x1203dc){var _0x411395=this;if(!_[_0x3f84('0x30')](_0x1203dc)){for(var _0x3921cd in _0x1203dc){if(_0x1203dc['hasOwnProperty'](_0x3921cd)){_0x411395[_0x3f84('0x47')](_0x1203dc[_0x3921cd],_0x3f84('0x48'));delete _0x1203dc[_0x3921cd];}}}};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x49')]=function(_0x565f6c,_0x5168ac,_0x1c125a){io['to'](_0x565f6c)[_0x3f84('0x49')](_0x5168ac,_0x1c125a);};VoiceQueueReport['prototype'][_0x3f84('0x4a')]=function(_0x52763c,_0x6b1447){logger['debug'](_0x3f84('0x4b')+_0x6b1447+_0x3f84('0x4c'),_0x52763c[_0x3f84('0x4d')],util[_0x3f84('0x41')](_0x52763c,{'showHidden':![],'depth':null}));this[_0x3f84('0x49')](util['format'](_0x3f84('0x4e'),_0x52763c[_0x3f84('0x4f')]),'voice_queue_channel:save',_0x52763c);io['emit'](_0x3f84('0x50'),_0x52763c);};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x47')]=function(_0x2127b3,_0x4bcd3c){logger[_0x3f84('0x51')](_0x3f84('0x4b')+_0x4bcd3c+_0x3f84('0x52'),_0x2127b3[_0x3f84('0x4d')],util[_0x3f84('0x41')](_0x2127b3,{'showHidden':![],'depth':null}));if(_0x2127b3[_0x3f84('0x53')]==='ATTENDEDTRANSFER'){return;}this[_0x3f84('0x49')](util[_0x3f84('0x54')](_0x3f84('0x4e'),_0x2127b3[_0x3f84('0x4f')]),_0x3f84('0x55'),_0x2127b3);io[_0x3f84('0x49')](_0x3f84('0x56'),_0x2127b3);};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x57')]=function(_0x3812a9){if(_0x3812a9[_0x3f84('0x58')]===_0x3f84('0x59')){logger['debug'](_0x3f84('0x5a'),util['inspect'](_0x3812a9,{'showHidden':![],'depth':null}));this[_0x3f84('0x49')](util['format'](_0x3f84('0x4e'),_0x3812a9[_0x3f84('0x5b')]),_0x3f84('0x5c'),_0x3812a9);}};VoiceQueueReport['prototype'][_0x3f84('0x5d')]=function(_0x5cb7d2){return _0x5cb7d2!==null&&!_['isUndefined'](_0x5cb7d2);};VoiceQueueReport[_0x3f84('0xd')]['loopQueueShow']=function(){var _0x3fb400=this;setInterval(function(){_0x3fb400[_0x3f84('0x37')]();ami[_0x3f84('0x3b')]({'action':_0x3f84('0x5e')})[_0x3f84('0x3d')](function(_0x4e45d1){logger[_0x3f84('0x44')](_0x3f84('0x5f'),util[_0x3f84('0x41')](_0x4e45d1,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x2e')]=function(){var _0x288049=this;setInterval(function(){if(!_0x288049[_0x3f84('0x15')]['isRunning']){return ami[_0x3f84('0x3b')]({'action':_0x3f84('0x60')})[_0x3f84('0x61')](function(_0x1eeb4a){_0x288049[_0x3f84('0x15')]['id']=_0x1eeb4a[_0x3f84('0x62')];_0x288049[_0x3f84('0x15')][_0x3f84('0x63')]=!![];_0x288049[_0x3f84('0x15')][_0x3f84('0x64')][_0x1eeb4a[_0x3f84('0x62')]]={};})['catch'](function(_0x583dfe){logger[_0x3f84('0x44')](_0x3f84('0x65'),util[_0x3f84('0x41')](_0x583dfe,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x66')]=function(_0x53bfd1,_0x4e9c70){var _0x3963b3;if(this[_0x3f84('0x15')]&&this[_0x3f84('0x15')][_0x3f84('0x5e')]&&this[_0x3f84('0x15')][_0x3f84('0x5e')][_0x53bfd1['name']]){_0x3963b3=this[_0x3f84('0x15')]['queues'][_0x53bfd1['name']][_0x3f84('0x67')];}var _0x8a7549=new VoiceQueueSummary(_0x53bfd1);return _0x8a7549[_0x3f84('0x68')](_0x4e9c70['agents'],this[_0x3f84('0x12')],_0x3963b3,this[_0x3f84('0x69')]['channels']);};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x6a')]=function(_0x309a3c,_0x3768bd){var _0x3f5232=this[_0x3f84('0x66')](_0x309a3c,_0x3768bd);var _0x1737a6=![];_0x1737a6=_0x3f5232[_0x3f84('0x6b')](_0x309a3c);if(_0x1737a6){Object[_0x3f84('0x6c')](_0x309a3c,_0x3f5232);this['realtime'][_0x3f84('0x14')][_0x309a3c[_0x3f84('0x5b')]]=_0x309a3c;this[_0x3f84('0x57')](_0x3f5232);}};VoiceQueueReport[_0x3f84('0xd')]['syncQueueStatusComplete']=function(_0x55ee96){var _0x3fa64e=null;var _0x388f3b=this[_0x3f84('0x15')]['id'];if(this[_0x3f84('0x15')]['queuestatus'][_0x388f3b]){_0x3fa64e=this[_0x3f84('0x15')][_0x3f84('0x64')][_0x388f3b][_0x55ee96[_0x3f84('0x62')]];}if(!_0x3fa64e){this[_0x3f84('0x15')]=initializeSummary();return;}var _0x500a76=this[_0x3f84('0x14')][_0x3fa64e[_0x3f84('0x4f')]];if(_0x500a76['type']==='inbound'){this[_0x3f84('0x6a')](_0x500a76,_0x3fa64e);}else if(_0x500a76['type']===_0x3f84('0x6d')){var _0x4cd6b1=this[_0x3f84('0x66')](_0x500a76,_0x3fa64e);ami[_0x3f84('0x49')](_0x3f84('0x6e'),_0x4cd6b1);}this[_0x3f84('0x15')]['statusRequests']-=0x1;var _0x696b44=this['summary'][_0x3f84('0x6f')]>0x0?!![]:![];if(!_0x696b44){return this[_0x3f84('0x1a')](this[_0x3f84('0x15')][_0x3f84('0x70')]);}};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x71')]=function(_0x4af5a8){var _0x3f519e=this['summary']['id'];if(this['summary'][_0x3f84('0x64')][_0x3f519e]&&this[_0x3f84('0x15')][_0x3f84('0x64')][_0x3f519e][_0x4af5a8['actionid']]){this[_0x3f84('0x15')][_0x3f84('0x64')][_0x3f519e][_0x4af5a8['actionid']]['agents'][_0x3f84('0x72')](_0x4af5a8);}};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x17')]=function(_0xe2f057){var _0x50ab43=this;try{if(this[_0x3f84('0x5d')](_0xe2f057)&&this[_0x3f84('0x5d')](_0xe2f057[_0x3f84('0x4f')])){logger[_0x3f84('0x51')](_0x3f84('0x73'),util[_0x3f84('0x41')](_0xe2f057,{'showHidden':![],'depth':null}));var _0x37481f=this[_0x3f84('0x14')][_0xe2f057[_0x3f84('0x4f')]];if(_0x37481f){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0x37481f[_0x3f84('0x5b')]);this['summary']['queues'][_0x37481f[_0x3f84('0x5b')]]={'summaryEvent':_0xe2f057};this['summary'][_0x3f84('0x6f')]+=0x1;return ami[_0x3f84('0x3b')]({'action':_0x3f84('0x64'),'queue':_0x37481f['name']})[_0x3f84('0x61')](function(_0x4c3d88){if(!_0x50ab43[_0x3f84('0x15')][_0x3f84('0x64')][_0xe2f057['actionid']]){_0x50ab43[_0x3f84('0x15')]['queuestatus'][_0xe2f057[_0x3f84('0x62')]]={};}_0x50ab43['summary'][_0x3f84('0x64')][_0xe2f057[_0x3f84('0x62')]][_0x4c3d88['actionid']]={'queue':_0x37481f[_0x3f84('0x5b')],'agents':[]};})[_0x3f84('0x3d')](function(_0x198351){throw _0x198351;});}}}catch(_0x254b32){logger['error'](_0x3f84('0x65'),util[_0x3f84('0x41')](_0x254b32,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f84('0xd')]['syncQueueSummaryComplete']=function(_0x18f246){if(this[_0x3f84('0x15')][_0x3f84('0x6f')]>0x0){this[_0x3f84('0x15')][_0x3f84('0x70')]=_0x18f246;return;}logger[_0x3f84('0x51')](_0x3f84('0x74'),util[_0x3f84('0x41')](_0x18f246,{'showHidden':![],'depth':null}));this[_0x3f84('0x15')]=initializeSummary();ami[_0x3f84('0x49')](_0x3f84('0x75'),{});};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x1e')]=function(_0x2ad7fa){try{if(this[_0x3f84('0x5d')](_0x2ad7fa)){logger[_0x3f84('0x51')](_0x3f84('0x76'),_0x2ad7fa[_0x3f84('0x4d')],util[_0x3f84('0x41')](_0x2ad7fa,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x3f84('0x11')][_0x2ad7fa[_0x3f84('0x4d')]])){this[_0x3f84('0x11')][_0x2ad7fa[_0x3f84('0x4d')]]=[];}if(_['isUndefined'](this[_0x3f84('0x38')][_0x2ad7fa[_0x3f84('0x4d')]])){this[_0x3f84('0x38')][_0x2ad7fa[_0x3f84('0x4d')]]={};}var _0x259a76=new QueueReport();_0x259a76[_0x3f84('0x4f')]=_0x2ad7fa['queue'];_0x259a76['type']=this[_0x3f84('0x14')][_0x259a76[_0x3f84('0x4f')]]&&this[_0x3f84('0x14')][_0x259a76[_0x3f84('0x4f')]]['type']?this[_0x3f84('0x14')][_0x259a76[_0x3f84('0x4f')]][_0x3f84('0x58')]||'inbound':_0x3f84('0x59');_0x259a76[_0x3f84('0x77')]=moment()[_0x3f84('0x54')](_0x3f84('0x78'));_0x259a76['position']=_0x2ad7fa[_0x3f84('0x79')];_0x259a76['count']=_0x2ad7fa['count'];_0x259a76[_0x3f84('0x4d')]=_0x2ad7fa[_0x3f84('0x4d')];logger[_0x3f84('0x7a')](_0x3f84('0x7b'),_0x259a76[_0x3f84('0x4f')],_0x259a76[_0x3f84('0x58')]);Object[_0x3f84('0x6c')](_0x259a76,_[_0x3f84('0x7c')](_0x2ad7fa,_[_0x3f84('0x7d')](_0x259a76)));this[_0x3f84('0x11')][_0x2ad7fa[_0x3f84('0x4d')]][_0x3f84('0x72')](_0x259a76);this[_0x3f84('0x38')][_0x2ad7fa[_0x3f84('0x4d')]]=_0x259a76;this[_0x3f84('0x4a')](_0x259a76,'queuecallerjoin');}}catch(_0x250bea){logger[_0x3f84('0x44')](_0x3f84('0x76'),_0x2ad7fa[_0x3f84('0x4d')],util['inspect'](_0x250bea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x1f')]=function(_0x1992d3){try{if(this[_0x3f84('0x5d')](_0x1992d3)){logger[_0x3f84('0x51')](_0x3f84('0x7e'),_0x1992d3[_0x3f84('0x4d')],util[_0x3f84('0x41')](_0x1992d3,{'showHidden':![],'depth':null}));if(this[_0x3f84('0x11')][_0x1992d3[_0x3f84('0x4d')]]){var _0x45d5ed=_[_0x3f84('0x7f')](this[_0x3f84('0x11')][_0x1992d3[_0x3f84('0x4d')]]);_0x45d5ed['queuecallercomplete']=![];_0x45d5ed[_0x3f84('0x80')]=null;_0x45d5ed[_0x3f84('0x81')]=_0x1992d3[_0x3f84('0x81')];_0x45d5ed['originalposition']=_0x1992d3[_0x3f84('0x82')];_0x45d5ed[_0x3f84('0x36')]=!![];_0x45d5ed[_0x3f84('0x83')]=moment()[_0x3f84('0x54')](_0x3f84('0x78'));_0x45d5ed['queuecallerexitreason']=_0x3f84('0x84');_0x45d5ed[_0x3f84('0x85')]=null;logger['info'](_0x3f84('0x86'),_0x45d5ed[_0x3f84('0x4f')],_0x45d5ed['type']);this[_0x3f84('0x38')][_0x1992d3[_0x3f84('0x4d')]]=_0x45d5ed;this[_0x3f84('0x47')](_0x45d5ed,'queuecallerabandon');}}}catch(_0x1d16b1){logger[_0x3f84('0x44')](_0x3f84('0x7e'),_0x1992d3['uniqueid'],util[_0x3f84('0x41')](_0x1d16b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0x87')]=function(_0x550b00){try{if(this[_0x3f84('0x5d')](_0x550b00)){logger[_0x3f84('0x51')](_0x3f84('0x88'),_0x550b00['uniqueid'],util[_0x3f84('0x41')](_0x550b00,{'showHidden':![],'depth':null}));if(this[_0x3f84('0x11')][_0x550b00[_0x3f84('0x4d')]]){var _0x36f96f=_['last'](this['queueReports'][_0x550b00[_0x3f84('0x4d')]]);_0x36f96f[_0x3f84('0x89')]=moment()['format'](_0x3f84('0x78'));_0x36f96f['connectedlinenum']=_0x550b00[_0x3f84('0x8a')];_0x36f96f[_0x3f84('0x8b')]=_0x550b00['connectedlinename'];logger[_0x3f84('0x7a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x36f96f[_0x3f84('0x4f')],_0x36f96f['type'],_0x550b00['connectedlinenum'],_0x550b00[_0x3f84('0x8b')]);this[_0x3f84('0x38')][_0x550b00['uniqueid']]=_0x36f96f;this[_0x3f84('0x4a')](_0x36f96f,_0x3f84('0x20'));}}}catch(_0x4c3d1b){logger[_0x3f84('0x44')]('[%s][voiceQueueReport][queuecallerleave]',_0x550b00[_0x3f84('0x4d')],util[_0x3f84('0x41')](_0x4c3d1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3f84('0x8c')]=function(_0x24d8be){try{if(this[_0x3f84('0x5d')](_0x24d8be)){logger[_0x3f84('0x51')]('[%s][voiceQueueReport][agentconnect]',_0x24d8be[_0x3f84('0x4d')],util[_0x3f84('0x41')](_0x24d8be,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x24d8be[_0x3f84('0x4d')]]){var _0x5c40ea=_[_0x3f84('0x7f')](this[_0x3f84('0x11')][_0x24d8be[_0x3f84('0x4d')]]);_0x5c40ea[_0x3f84('0x8d')]=!![];_0x5c40ea[_0x3f84('0x53')]=_0x3f84('0x8e');logger['info'](_0x3f84('0x8f'),_0x5c40ea[_0x3f84('0x4f')],_0x5c40ea[_0x3f84('0x58')]);}}}catch(_0x2b16ed){logger[_0x3f84('0x44')](_0x3f84('0x90'),_0x24d8be[_0x3f84('0x4d')],util[_0x3f84('0x41')](_0x2b16ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3f84('0x22')]=function(_0x5592cf){try{if(this[_0x3f84('0x5d')](_0x5592cf)){logger[_0x3f84('0x51')](_0x3f84('0x91'),_0x5592cf[_0x3f84('0x4d')],util['inspect'](_0x5592cf,{'showHidden':![],'depth':null}));if(this[_0x3f84('0x11')][_0x5592cf[_0x3f84('0x4d')]]){var _0x39b1b9=_[_0x3f84('0x7f')](this[_0x3f84('0x11')][_0x5592cf['uniqueid']]);_0x39b1b9[_0x3f84('0x36')]=![];_0x39b1b9[_0x3f84('0x83')]=null;_0x39b1b9[_0x3f84('0x92')]=!![];_0x39b1b9['lastAssignedTo']=_0x5592cf[_0x3f84('0x93')];_0x39b1b9[_0x3f84('0x81')]=_0x5592cf[_0x3f84('0x81')];_0x39b1b9[_0x3f84('0x8d')]=!![];_0x39b1b9[_0x3f84('0x94')]=![];_0x39b1b9['queuecallerexitAt']=null;if(!_0x39b1b9['transfer']){if(_0x5592cf[_0x3f84('0x95')]=='transfer'){_0x39b1b9[_0x3f84('0x53')]=_0x3f84('0x96');logger[_0x3f84('0x7a')](_0x3f84('0x97'),_0x39b1b9[_0x3f84('0x4f')],_0x39b1b9[_0x3f84('0x58')]);}else{if(_[_0x3f84('0x98')](_0x5592cf[_0x3f84('0x99')][_0x3f84('0x9a')](),_0x3f84('0x9b'))){if(this[_0x3f84('0x11')][_0x5592cf[_0x3f84('0x9c')]]){var _0x2f692d=_[_0x3f84('0x7f')](this[_0x3f84('0x11')][_0x5592cf['linkedid']]);_0x2f692d['queuecallercomplete']=![];_0x2f692d[_0x3f84('0x94')]=!![];_0x2f692d[_0x3f84('0x9d')]=moment(_0x39b1b9['queuecallerjoinAt'])['add'](_0x5592cf['holdtime'],_0x3f84('0x9e'))[_0x3f84('0x54')](_0x3f84('0x78'));_0x2f692d[_0x3f84('0x53')]=_0x3f84('0x9f');_0x2f692d['transfer']=!![];_0x2f692d['transfertype']=_0x3f84('0xa0');_0x2f692d[_0x3f84('0xa1')]=_0x5592cf[_0x3f84('0xa2')];_0x2f692d[_0x3f84('0xa3')]=_0x5592cf['uniqueid'];logger[_0x3f84('0x7a')](_0x3f84('0xa4'),_0x2f692d[_0x3f84('0x4f')],_0x2f692d[_0x3f84('0x58')]);var _0xae4705=this[_0x3f84('0x11')][_0x5592cf[_0x3f84('0x9c')]];this[_0x3f84('0x11')][_0x5592cf[_0x3f84('0x9c')]]=this[_0x3f84('0x11')][_0x5592cf[_0x3f84('0x4d')]];this['queueReports'][_0x5592cf['uniqueid']]=_0xae4705;}}else{_0x39b1b9[_0x3f84('0x53')]=_0x3f84('0xa5')+_0x5592cf['reason'][_0x3f84('0xa6')]();logger[_0x3f84('0x7a')](_0x3f84('0xa7'),_0x39b1b9['queue'],_0x39b1b9[_0x3f84('0x58')],_0x39b1b9[_0x3f84('0x53')]);}}}this[_0x3f84('0x38')][_0x5592cf[_0x3f84('0x4d')]]=_0x39b1b9;}}}catch(_0x3216cd){logger[_0x3f84('0x44')]('[%s][voiceQueueReport][agentcomplete]',_0x5592cf[_0x3f84('0x4d')],util[_0x3f84('0x41')](_0x3216cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f84('0xd')][_0x3f84('0xa8')]=function(_0x17a705){try{if(this[_0x3f84('0x5d')](_0x17a705)){logger[_0x3f84('0x51')](_0x3f84('0xa9'),_0x17a705[_0x3f84('0x4d')],util[_0x3f84('0x41')](_0x17a705,{'showHidden':![],'depth':null}));this['addVariable'](_0x17a705[_0x3f84('0x4d')],_[_0x3f84('0x7d')](_0x17a705[_0x3f84('0xaa')])[0x0],_0x17a705[_0x3f84('0xab')]);if(this[_0x3f84('0x11')][_0x17a705[_0x3f84('0x4d')]]){var _0x4e6609=_['last'](this['queueReports'][_0x17a705[_0x3f84('0x4d')]]);if(_0x4e6609){if(this['isNotNull'](_0x17a705[_0x3f84('0xaa')])&&this[_0x3f84('0x5d')](_0x17a705[_0x3f84('0xaa')][_0x3f84('0x64')])){switch(_0x17a705[_0x3f84('0xab')]){case _0x3f84('0xac'):_0x4e6609['queuecallerexit']=![];_0x4e6609[_0x3f84('0x9d')]=null;break;case _0x3f84('0xad'):_0x4e6609[_0x3f84('0xae')]=_0x3f84('0xaf');_0x4e6609['queuecallerexit']=!![];_0x4e6609[_0x3f84('0x9d')]=moment()[_0x3f84('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e6609[_0x3f84('0x89')]=moment()['format'](_0x3f84('0x78'));logger[_0x3f84('0x51')](_0x3f84('0xb0'),_0x17a705[_0x3f84('0x4d')],util['inspect'](_0x4e6609,{'showHidden':![],'depth':null}));ami[_0x3f84('0x49')]('custom:timeout',_0x4e6609);break;default:_0x4e6609[_0x3f84('0x94')]=!![];_0x4e6609[_0x3f84('0x9d')]=moment()[_0x3f84('0x54')](_0x3f84('0x78'));_0x4e6609[_0x3f84('0x89')]=moment()[_0x3f84('0x54')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4e6609['queuecallerabandon']=![];_0x4e6609[_0x3f84('0x83')]=null;_0x4e6609[_0x3f84('0x53')]=_0x17a705['value'];this['channels'][_0x17a705[_0x3f84('0x4d')]]=_0x4e6609;this[_0x3f84('0x47')](_0x4e6609,_0x3f84('0x24'));}else if(this[_0x3f84('0x5d')](_0x17a705[_0x3f84('0xaa')])&&this[_0x3f84('0x5d')](_0x17a705[_0x3f84('0xaa')][_0x3f84('0xb1')])){if(!_0x4e6609['queuecallerabandon']){_0x4e6609[_0x3f84('0x94')]=!![];_0x4e6609[_0x3f84('0x9d')]=moment()['format'](_0x3f84('0x78'));_0x4e6609['queuecallerexitreason']=_0x3f84('0xb2');_0x4e6609[_0x3f84('0x89')]=moment()['format'](_0x3f84('0x78'));this[_0x3f84('0x38')][_0x17a705[_0x3f84('0x4d')]]=_0x4e6609;}}logger[_0x3f84('0x7a')](_0x3f84('0xb3'),_0x17a705[_0x3f84('0x4d')],_0x4e6609['queue'],_0x4e6609[_0x3f84('0x58')],_[_0x3f84('0x7d')](_0x17a705[_0x3f84('0xaa')])[0x0],_0x17a705['value']);_0x4e6609['variables']=this[_0x3f84('0x16')][_0x17a705['uniqueid']];}}}}catch(_0x5ef058){logger[_0x3f84('0x44')](_0x3f84('0xa9'),_0x17a705['uniqueid'],util[_0x3f84('0x41')](_0x5ef058,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f84('0xd')]['addVariable']=function(_0x6274fb,_0x352ba5,_0x13f6e4){var _0x5ad76e=[_0x3f84('0xb4'),_0x3f84('0xb5'),_0x3f84('0xb6'),_0x3f84('0xb7'),_0x3f84('0xb8'),_0x3f84('0xb9'),_0x3f84('0xba'),'rtpaudioqosrttbridged',_0x3f84('0xbb'),_0x3f84('0xbc'),_0x3f84('0xbd'),_0x3f84('0xbe'),'membercalls',_0x3f84('0xbf'),_0x3f84('0xc0'),_0x3f84('0xc1'),_0x3f84('0x93'),_0x3f84('0xc2'),_0x3f84('0xc3')];if(!_[_0x3f84('0xc4')](_0x352ba5)&&!_[_0x3f84('0xc5')](_0x5ad76e,_0x352ba5)){if(_[_0x3f84('0xc6')](this['variables'][_0x6274fb])){this[_0x3f84('0x16')][_0x6274fb]={};}this[_0x3f84('0x16')][_0x6274fb][_0x352ba5]=_0x13f6e4;}};VoiceQueueReport['prototype'][_0x3f84('0xc7')]=function(_0x3c78f7,_0x3d8052,_0x10606e){try{var _0x1664af={};if(this[_0x3f84('0x11')][_0x3c78f7]){for(var _0x7ed0c2=0x0;_0x7ed0c2{delete this['channels'][_0x4cd7ef];},_0x571fd4);}};module[_0x3f84('0xfe')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 9f5ed52..e9a06e2 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd2f=['campaign','queue','CreateReportAgentPreview','../client','createHistory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd2f,0x111));var _0xfbd2=function(_0x11026c,_0x5dc264){_0x11026c=_0x11026c-0x0;var _0x2adb63=_0xbd2f[_0x11026c];return _0x2adb63;};'use strict';var client=require(_0xfbd2('0x0'));exports[_0xfbd2('0x1')]=function(_0x3c86b7){return function(){_0x3c86b7[_0xfbd2('0x2')]=_0x3c86b7[_0xfbd2('0x3')];return client['Request'](_0xfbd2('0x4'),{'body':_0x3c86b7,'log':_0xfbd2('0x4')});};}; \ No newline at end of file +var _0x8e8d=['queue','Request','CreateReportAgentPreview','../client','createHistory','campaign'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0x8e8d,0x19b));var _0xd8e8=function(_0x52b77a,_0xaaf65b){_0x52b77a=_0x52b77a-0x0;var _0x5e7774=_0x8e8d[_0x52b77a];return _0x5e7774;};'use strict';var client=require(_0xd8e8('0x0'));exports[_0xd8e8('0x1')]=function(_0x2970d8){return function(){_0x2970d8[_0xd8e8('0x2')]=_0x2970d8[_0xd8e8('0x3')];return client[_0xd8e8('0x4')](_0xd8e8('0x5'),{'body':_0x2970d8,'log':_0xd8e8('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 3250122..6753eea 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x662c=['CreateAttachment','create','Request'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x662c,0x1e4));var _0xc662=function(_0x44b4fa,_0x364e90){_0x44b4fa=_0x44b4fa-0x0;var _0x2b6733=_0x662c[_0x44b4fa];return _0x2b6733;};'use strict';var client=require('../client');exports[_0xc662('0x0')]=function(_0x372d36){return client[_0xc662('0x1')](_0xc662('0x2'),{'body':_0x372d36,'log':_0xc662('0x2')});}; \ No newline at end of file +var _0xd4f4=['create','Request','CreateAttachment','../client'];(function(_0x5b9950,_0xb246d9){var _0x5445a7=function(_0x535b8c){while(--_0x535b8c){_0x5b9950['push'](_0x5b9950['shift']());}};_0x5445a7(++_0xb246d9);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x1441b7,_0x398efc){_0x1441b7=_0x1441b7-0x0;var _0xc0d6a1=_0xd4f4[_0x1441b7];return _0xc0d6a1;};'use strict';var client=require(_0x4d4f('0x0'));exports[_0x4d4f('0x1')]=function(_0x2cfc72){return client[_0x4d4f('0x2')](_0x4d4f('0x3'),{'body':_0x2cfc72,'log':_0x4d4f('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index b60e7dc..9eb715c 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x100332,_0x4296e1){var _0x308ffc=function(_0x43791b){while(--_0x43791b){_0x100332['push'](_0x100332['shift']());}};_0x308ffc(++_0x4296e1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc4aa[_0x2070da];return _0x4f9fe1;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file +var _0xdb28=['dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','name','callerid','Interval','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt'];(function(_0x4c32e4,_0x441617){var _0x1f618f=function(_0x1e5f84){while(--_0x1e5f84){_0x4c32e4['push'](_0x4c32e4['shift']());}};_0x1f618f(++_0x441617);}(_0xdb28,0x106));var _0x8db2=function(_0x515f5f,_0x1dbd58){_0x515f5f=_0x515f5f-0x0;var _0x13d0a3=_0xdb28[_0x515f5f];return _0x13d0a3;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(){return client[_0x8db2('0x2')](_0x8db2('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'dialOriginateTimeout',_0x8db2('0x9'),_0x8db2('0xa'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'dialAbandonedMaxRetry',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'dialAgentRejectMaxRetry',_0x8db2('0x15'),_0x8db2('0x16'),'dialGlobalInterval',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21'),_0x8db2('0x22')],'include':[{'model':_0x8db2('0x23'),'as':_0x8db2('0x23'),'attributes':['id',_0x8db2('0x24'),'callerid',_0x8db2('0x5')]},{'model':_0x8db2('0x23'),'as':'TrunkBackup','attributes':['id',_0x8db2('0x24'),_0x8db2('0x25'),_0x8db2('0x5')]},{'model':_0x8db2('0x26'),'as':_0x8db2('0x26'),'attributes':['id',_0x8db2('0x24')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x8db2('0x24'),_0x8db2('0x27')]}]},{'model':_0x8db2('0x28'),'as':_0x8db2('0x28'),'attributes':['id','name']}]},'log':_0x8db2('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index acfd817..684309f 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ae2=['../client','createContact','Request','CreateCmContact','getContacts'];(function(_0x4ff414,_0x4f54bc){var _0x286feb=function(_0x563a20){while(--_0x563a20){_0x4ff414['push'](_0x4ff414['shift']());}};_0x286feb(++_0x4f54bc);}(_0x6ae2,0xa0));var _0x26ae=function(_0x4368a1,_0x50704c){_0x4368a1=_0x4368a1-0x0;var _0x1cbf91=_0x6ae2[_0x4368a1];return _0x1cbf91;};'use strict';var client=require(_0x26ae('0x0'));exports[_0x26ae('0x1')]=function(_0x82ca96){return function(){return client[_0x26ae('0x2')]('CreateCmContact',{'body':_0x82ca96,'log':_0x26ae('0x3')});};};exports[_0x26ae('0x4')]=function(_0x33edf0){return function(){return client['Request']('GetCmContact',{'options':_0x33edf0,'log':'GetCmContact'});};}; \ No newline at end of file +var _0x9924=['../client','createContact','Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x4235b3,_0x4295b9){var _0x5a6cc9=function(_0x3cd80d){while(--_0x3cd80d){_0x4235b3['push'](_0x4235b3['shift']());}};_0x5a6cc9(++_0x4295b9);}(_0x9924,0x102));var _0x4992=function(_0x5b95d8,_0x2beb86){_0x5b95d8=_0x5b95d8-0x0;var _0x534dcd=_0x9924[_0x5b95d8];return _0x534dcd;};'use strict';var client=require(_0x4992('0x0'));exports[_0x4992('0x1')]=function(_0x171471){return function(){return client[_0x4992('0x2')](_0x4992('0x3'),{'body':_0x171471,'log':_0x4992('0x3')});};};exports[_0x4992('0x4')]=function(_0x514ac6){return function(){return client[_0x4992('0x2')](_0x4992('0x5'),{'options':_0x514ac6,'log':_0x4992('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 3b19af4..174adc7 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e0f=['CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','Contact','updateContacts','UpdateCmHopper','format','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','YYYY-MM-DD\x20HH:mm:ss','DESC','ASC','getContactDialerIvr','CmContact','scheduledat','GetContactDialerIvr','moveContactManagedDialer','queue','countReScheduled','getContactPreview','GetCmHopperPreview','User','name','VoiceQueue','getCmHopper','unlockContact','getContactRecallMe','GetContactRecallMe','priority','voicePause','resetActiveCalls','ResetActiveCalls'];(function(_0x23e050,_0x479330){var _0x14f71b=function(_0x385b50){while(--_0x385b50){_0x23e050['push'](_0x23e050['shift']());}};_0x14f71b(++_0x479330);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x5c8948,_0x5c5e0a){_0x5c8948=_0x5c8948-0x0;var _0x2af740=_0x8e0f[_0x5c8948];return _0x2af740;};'use strict';var client=require(_0xf8e0('0x0'));var moment=require(_0xf8e0('0x1'));exports[_0xf8e0('0x2')]=function(_0x5103f1,_0x38282a){return function(){return client[_0xf8e0('0x3')](_0xf8e0('0x4'),{'options':{'where':{'VoiceQueueId':_0x5103f1},'include':[{'model':'CmContact','as':_0xf8e0('0x5')}],'limit':_0x38282a,'raw':![]},'log':'getCmHopper'});};};exports[_0xf8e0('0x6')]=function(_0x3d8d42,_0x4f3b30,_0x2921b3){return function(){return client[_0xf8e0('0x3')](_0xf8e0('0x7'),{'body':_0x3d8d42,'options':{'where':{'VoiceQueueId':_0x4f3b30,'scheduledat':{'$lte':moment()[_0xf8e0('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x2921b3},'log':_0xf8e0('0x7')});};};exports[_0xf8e0('0x9')]=function(_0x5c644c){return client['Request'](_0xf8e0('0x7'),{'body':_0x5c644c,'options':{'where':{'ContactId':_0x5c644c[_0xf8e0('0xa')],'ListId':_0x5c644c[_0xf8e0('0xb')],'VoiceQueueId':_0x5c644c[_0xf8e0('0xc')],'CampaignId':_0x5c644c[_0xf8e0('0xd')]}},'log':_0xf8e0('0x9')});};exports[_0xf8e0('0xe')]=function(_0x462994,_0xaf2a8c,_0x5649f6){return function(){return client[_0xf8e0('0x3')](_0xf8e0('0xf'),{'options':{'where':{'VoiceQueueId':_0x462994,'ListId':_0xaf2a8c,'ContactId':_0x5649f6}},'log':_0xf8e0('0xf')});};};exports[_0xf8e0('0x10')]=function(_0x53c08f,_0xf9ec0f,_0x5e958d,_0xea93ae){return client[_0xf8e0('0x3')](_0xf8e0('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x53c08f,'active':![],'scheduledat':{'$lte':moment()['format'](_0xf8e0('0x12'))},'$or':[{'UserId':null},{'UserId':{'$in':_0xf9ec0f}}]},'order':[['priority',_0xf8e0('0x13')],['scheduledat',_0xea93ae],['id',_0xf8e0('0x14')]],'raw':!![],'limit':_0x5e958d},'log':_0xf8e0('0x11')});};exports[_0xf8e0('0x15')]=function(_0x32715f,_0x26a459,_0x49e649){return client[_0xf8e0('0x3')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x32715f,'active':![],'scheduledat':{'$lte':moment()[_0xf8e0('0x8')](_0xf8e0('0x12'))}},'include':[{'model':_0xf8e0('0x16'),'as':_0xf8e0('0x5')}],'order':[['priority','DESC'],[_0xf8e0('0x17'),_0x49e649],['id',_0xf8e0('0x14')]],'raw':!![],'limit':_0x26a459},'log':_0xf8e0('0x18')});};exports[_0xf8e0('0x19')]=function(_0x5e5ad6,_0x21831e){_0x5e5ad6['campaign']=_0x5e5ad6[_0xf8e0('0x1a')];return client[_0xf8e0('0x3')]('MoveContactManagedDialer',{'body':_0x5e5ad6,'options':{'where':{'ContactId':_0x5e5ad6[_0xf8e0('0xa')],'ListId':_0x5e5ad6[_0xf8e0('0xb')],'VoiceQueueId':_0x5e5ad6[_0xf8e0('0xc')],'CampaignId':_0x5e5ad6[_0xf8e0('0xd')],'active':_0x21831e?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports[_0xf8e0('0x1b')]=function(_0x8d9993){return client['Request']('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x8d9993['id']?_0x8d9993['id']||null:null}},'log':'countReScheduled'});};exports[_0xf8e0('0x1c')]=function(_0x2fe292){return function(){return client[_0xf8e0('0x3')](_0xf8e0('0x1d'),{'options':{'where':{'id':_0x2fe292},'include':[{'model':_0xf8e0('0x16'),'as':_0xf8e0('0x5')},{'model':_0xf8e0('0x1e'),'as':'Agent','attributes':['id',_0xf8e0('0x1f')]},{'model':_0xf8e0('0x20'),'as':'Queue','attributes':['id',_0xf8e0('0x1f')]}],'raw':!![]},'log':_0xf8e0('0x21')});};};exports[_0xf8e0('0x22')]=function(_0x257362,_0x585d58,_0x318ca5){return client['Request']('UpdateCmHopper',{'body':_0x257362,'options':{'where':{'id':_0x585d58},'limit':_0x318ca5},'log':_0xf8e0('0x7')});};exports[_0xf8e0('0x23')]=function(_0x376073,_0x19b773){return function(){return client[_0xf8e0('0x3')](_0xf8e0('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x376073,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xf8e0('0x8')](_0xf8e0('0x12'))},'UserId':{'$in':_0x19b773}},'order':[[_0xf8e0('0x25'),_0xf8e0('0x13')],['scheduledat',_0xf8e0('0x13')],['id',_0xf8e0('0x14')]],'include':[{'model':_0xf8e0('0x16'),'as':'Contact'},{'model':_0xf8e0('0x1e'),'as':'Agent','attributes':['id',_0xf8e0('0x1f'),_0xf8e0('0x26')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0xf8e0('0x11')});};};exports[_0xf8e0('0x27')]=function(_0x581a1e,_0x1bac43){return client[_0xf8e0('0x3')]('ResetActiveCalls',{'body':_0x581a1e,'options':_0x1bac43||{},'log':_0xf8e0('0x28')});};exports['handlePreviewRecallNotifications']=function(_0x29242e,_0x59f210,_0x5a0bc3){return function(){return client[_0xf8e0('0x3')](_0xf8e0('0x29'),{'body':{'where':{'voiceQueueIds':_0x29242e,'interval':_0x59f210,'availableAgentsIds':_0x5a0bc3}},'log':_0xf8e0('0x2a')});};}; \ No newline at end of file +var _0x2070=['CmContact','getCmHopper','updateContacts','UpdateCmHopper','format','rescheduleContact','Request','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','priority','DESC','ASC','getContactDialerIvr','YYYY-MM-DD\x20HH:mm:ss','Contact','scheduledat','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','Agent','name','VoiceQueue','unlockContact','getContactRecallMe','User','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','getContacts','GetCmHopper'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2070,0x1a2));var _0x0207=function(_0x54bbfd,_0x1ed496){_0x54bbfd=_0x54bbfd-0x0;var _0x1dd941=_0x2070[_0x54bbfd];return _0x1dd941;};'use strict';var client=require('../client');var moment=require('moment');exports[_0x0207('0x0')]=function(_0x146e2e,_0x37e734){return function(){return client['Request'](_0x0207('0x1'),{'options':{'where':{'VoiceQueueId':_0x146e2e},'include':[{'model':_0x0207('0x2'),'as':'Contact'}],'limit':_0x37e734,'raw':![]},'log':_0x0207('0x3')});};};exports[_0x0207('0x4')]=function(_0x5bce74,_0x5573e8,_0x5cf734){return function(){return client['Request'](_0x0207('0x5'),{'body':_0x5bce74,'options':{'where':{'VoiceQueueId':_0x5573e8,'scheduledat':{'$lte':moment()[_0x0207('0x6')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x5cf734},'log':_0x0207('0x5')});};};exports[_0x0207('0x7')]=function(_0x4bd107){return client[_0x0207('0x8')](_0x0207('0x5'),{'body':_0x4bd107,'options':{'where':{'ContactId':_0x4bd107[_0x0207('0x9')],'ListId':_0x4bd107[_0x0207('0xa')],'VoiceQueueId':_0x4bd107[_0x0207('0xb')],'CampaignId':_0x4bd107[_0x0207('0xc')]}},'log':_0x0207('0x7')});};exports[_0x0207('0xd')]=function(_0x2169c3,_0x4488ba,_0x2706ee){return function(){return client[_0x0207('0x8')](_0x0207('0xe'),{'options':{'where':{'VoiceQueueId':_0x2169c3,'ListId':_0x4488ba,'ContactId':_0x2706ee}},'log':_0x0207('0xe')});};};exports['getContactDialer']=function(_0x34db03,_0x5b2a38,_0xec6d19,_0x3bd0c4){return client[_0x0207('0x8')](_0x0207('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x34db03,'active':![],'scheduledat':{'$lte':moment()[_0x0207('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x5b2a38}}]},'order':[[_0x0207('0x10'),_0x0207('0x11')],['scheduledat',_0x3bd0c4],['id',_0x0207('0x12')]],'raw':!![],'limit':_0xec6d19},'log':_0x0207('0xf')});};exports[_0x0207('0x13')]=function(_0x325eb1,_0x4aac04,_0x1bdc25){return client[_0x0207('0x8')](_0x0207('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x325eb1,'active':![],'scheduledat':{'$lte':moment()[_0x0207('0x6')](_0x0207('0x14'))}},'include':[{'model':_0x0207('0x2'),'as':_0x0207('0x15')}],'order':[[_0x0207('0x10'),_0x0207('0x11')],[_0x0207('0x16'),_0x1bdc25],['id',_0x0207('0x12')]],'raw':!![],'limit':_0x4aac04},'log':_0x0207('0x17')});};exports[_0x0207('0x18')]=function(_0xfc201,_0x3474f3){_0xfc201['campaign']=_0xfc201[_0x0207('0x19')];return client['Request'](_0x0207('0x1a'),{'body':_0xfc201,'options':{'where':{'ContactId':_0xfc201[_0x0207('0x9')],'ListId':_0xfc201[_0x0207('0xa')],'VoiceQueueId':_0xfc201['VoiceQueueId'],'CampaignId':_0xfc201[_0x0207('0xc')],'active':_0x3474f3?undefined:!![]}},'log':_0x0207('0x1a')});};exports['countReScheduled']=function(_0x16bf24){return client[_0x0207('0x8')](_0x0207('0x1b'),{'options':{'where':{'VoiceQueueId':_0x16bf24['id']?_0x16bf24['id']||null:null}},'log':_0x0207('0x1c')});};exports[_0x0207('0x1d')]=function(_0x520a88){return function(){return client[_0x0207('0x8')](_0x0207('0x1e'),{'options':{'where':{'id':_0x520a88},'include':[{'model':'CmContact','as':_0x0207('0x15')},{'model':'User','as':_0x0207('0x1f'),'attributes':['id',_0x0207('0x20')]},{'model':_0x0207('0x21'),'as':'Queue','attributes':['id',_0x0207('0x20')]}],'raw':!![]},'log':_0x0207('0x3')});};};exports[_0x0207('0x22')]=function(_0x35085c,_0x1bc810,_0x5cc816){return client[_0x0207('0x8')]('UpdateCmHopper',{'body':_0x35085c,'options':{'where':{'id':_0x1bc810},'limit':_0x5cc816},'log':_0x0207('0x5')});};exports[_0x0207('0x23')]=function(_0x435e79,_0x4e5e7b){return function(){return client[_0x0207('0x8')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x435e79,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x0207('0x14'))},'UserId':{'$in':_0x4e5e7b}},'order':[[_0x0207('0x10'),_0x0207('0x11')],[_0x0207('0x16'),_0x0207('0x11')],['id','ASC']],'include':[{'model':_0x0207('0x2'),'as':_0x0207('0x15')},{'model':_0x0207('0x24'),'as':_0x0207('0x1f'),'attributes':['id','name',_0x0207('0x25')]}],'group':_0x0207('0x26'),'raw':!![]},'log':_0x0207('0xf')});};};exports[_0x0207('0x27')]=function(_0x1099e6,_0x2b9e2d){return client['Request']('ResetActiveCalls',{'body':_0x1099e6,'options':_0x2b9e2d||{},'log':_0x0207('0x28')});};exports['handlePreviewRecallNotifications']=function(_0x82b166,_0x15afd7,_0x37751f){return function(){return client[_0x0207('0x8')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x82b166,'interval':_0x15afd7,'availableAgentsIds':_0x37751f}},'log':_0x0207('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index a4488db..adb5bac 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f04=['../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters'];(function(_0x21d55d,_0x447ea4){var _0x8bd01e=function(_0x51b15e){while(--_0x51b15e){_0x21d55d['push'](_0x21d55d['shift']());}};_0x8bd01e(++_0x447ea4);}(_0x7f04,0x12d));var _0x47f0=function(_0x32c04b,_0x187085){_0x32c04b=_0x32c04b-0x0;var _0x2947b1=_0x7f04[_0x32c04b];return _0x2947b1;};'use strict';var client=require(_0x47f0('0x0'));exports[_0x47f0('0x1')]=function(_0x2f6140,_0x256d2f,_0xa8022a){return client[_0x47f0('0x2')](_0x47f0('0x3'),{'body':_0x2f6140,'reason':_0x256d2f,'entity':_0xa8022a,'log':_0x47f0('0x3')});};exports['swapAdditionalPhones']=function(_0x1d7856,_0x437f23,_0x5da0dd){return client['Request'](_0x47f0('0x4'),{'body':_0x1d7856,'duration':_0x437f23,'waitTime':_0x5da0dd,'log':'SwapAdditionalPhones'});};exports[_0x47f0('0x5')]=function(_0x31823f){return function(){return client[_0x47f0('0x2')](_0x47f0('0x6'),{'body':_0x31823f,'log':_0x47f0('0x6')});};}; \ No newline at end of file +var _0x3963=['swapAdditionalPhones','Request','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','verifyAdditionalPhones','VerifyAdditionalPhones'];(function(_0x255036,_0xf94145){var _0x3c4c56=function(_0x50a35c){while(--_0x50a35c){_0x255036['push'](_0x255036['shift']());}};_0x3c4c56(++_0xf94145);}(_0x3963,0xfa));var _0x3396=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x3963[_0x40b3f2];return _0x4ce90c;};'use strict';var client=require('../client');exports[_0x3396('0x0')]=function(_0x512ee,_0x3bea0e,_0x5cfeee){return client['Request'](_0x3396('0x1'),{'body':_0x512ee,'reason':_0x3bea0e,'entity':_0x5cfeee,'log':_0x3396('0x1')});};exports[_0x3396('0x2')]=function(_0x106311,_0x58312e,_0x511b60){return client[_0x3396('0x3')](_0x3396('0x4'),{'body':_0x106311,'duration':_0x58312e,'waitTime':_0x511b60,'log':_0x3396('0x4')});};exports[_0x3396('0x5')]=function(_0x2c5c25){return function(){return client[_0x3396('0x3')](_0x3396('0x6'),{'body':_0x2c5c25,'log':_0x3396('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index deea851..243d9f8 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57fd=['phone','GetCmHopperBlack','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','VoiceQueueId'];(function(_0x238e7c,_0x46ee86){var _0x128a39=function(_0x54b983){while(--_0x54b983){_0x238e7c['push'](_0x238e7c['shift']());}};_0x128a39(++_0x46ee86);}(_0x57fd,0x15b));var _0xd57f=function(_0x5f4415,_0x132c23){_0x5f4415=_0x5f4415-0x0;var _0x2ecb62=_0x57fd[_0x5f4415];return _0x2ecb62;};'use strict';var client=require(_0xd57f('0x0'));exports[_0xd57f('0x1')]=function(_0x15f229){return client[_0xd57f('0x2')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x15f229[_0xd57f('0x3')],'phone':_0x15f229[_0xd57f('0x4')]},'raw':![]},'log':_0xd57f('0x5')});};exports[_0xd57f('0x6')]=function(_0x433900){return client['Request'](_0xd57f('0x5'),{'options':{'where':{'CampaignId':_0x433900[_0xd57f('0x7')],'phone':_0x433900[_0xd57f('0x4')]},'raw':![]},'log':_0xd57f('0x8')});}; \ No newline at end of file +var _0xbf95=['Request','VoiceQueueId','phone','checkIsBlackListIvr','GetCmHopperBlack','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0xbf95,0xa9));var _0x5bf9=function(_0x17accc,_0x16f7cb){_0x17accc=_0x17accc-0x0;var _0x45824c=_0xbf95[_0x17accc];return _0x45824c;};'use strict';var client=require(_0x5bf9('0x0'));exports[_0x5bf9('0x1')]=function(_0x51bb33){return client[_0x5bf9('0x2')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x51bb33[_0x5bf9('0x3')],'phone':_0x51bb33[_0x5bf9('0x4')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0x5bf9('0x5')]=function(_0x52fc5b){return client[_0x5bf9('0x2')](_0x5bf9('0x6'),{'options':{'where':{'CampaignId':_0x52fc5b[_0x5bf9('0x7')],'phone':_0x52fc5b['phone']},'raw':![]},'log':_0x5bf9('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 384e35c..433ad42 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7d1=['Request','CreateCmHopperFinal','../client','createContact','campaign'];(function(_0x57bdb0,_0x447639){var _0x5e5f80=function(_0x42afb2){while(--_0x42afb2){_0x57bdb0['push'](_0x57bdb0['shift']());}};_0x5e5f80(++_0x447639);}(_0xd7d1,0x7f));var _0x1d7d=function(_0x2fc25b,_0x4f09d0){_0x2fc25b=_0x2fc25b-0x0;var _0x3b2d8c=_0xd7d1[_0x2fc25b];return _0x3b2d8c;};'use strict';var client=require(_0x1d7d('0x0'));exports[_0x1d7d('0x1')]=function(_0x24eb20){return function(){_0x24eb20[_0x1d7d('0x2')]=_0x24eb20['queue'];return client[_0x1d7d('0x3')](_0x1d7d('0x4'),{'body':_0x24eb20,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0xce8c=['CreateCmHopperFinal','../client','createContact','campaign','queue','Request'];(function(_0x1f51e2,_0x153f98){var _0x2f0bbf=function(_0x3c34e8){while(--_0x3c34e8){_0x1f51e2['push'](_0x1f51e2['shift']());}};_0x2f0bbf(++_0x153f98);}(_0xce8c,0x1cf));var _0xcce8=function(_0x592b6f,_0x35cb77){_0x592b6f=_0x592b6f-0x0;var _0x142f69=_0xce8c[_0x592b6f];return _0x142f69;};'use strict';var client=require(_0xcce8('0x0'));exports[_0xcce8('0x1')]=function(_0x201b03){return function(){_0x201b03[_0xcce8('0x2')]=_0x201b03[_0xcce8('0x3')];return client[_0xcce8('0x4')](_0xcce8('0x5'),{'body':_0x201b03,'log':_0xcce8('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 2b8f5a9..5862637 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3ad=['Request','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','moment','createHistory','campaign','queue','avgHandleTime'];(function(_0x30f224,_0x26c892){var _0x2e5cdd=function(_0x320a7e){while(--_0x320a7e){_0x30f224['push'](_0x30f224['shift']());}};_0x2e5cdd(++_0x26c892);}(_0xf3ad,0x1ee));var _0xdf3a=function(_0x1bb95b,_0x34a06c){_0x1bb95b=_0x1bb95b-0x0;var _0x27e271=_0xf3ad[_0x1bb95b];return _0x27e271;};'use strict';var client=require(_0xdf3a('0x0'));var moment=require(_0xdf3a('0x1'));exports[_0xdf3a('0x2')]=function(_0x416f21){_0x416f21[_0xdf3a('0x3')]=_0x416f21[_0xdf3a('0x4')];return client['Request']('CreateCmHopperHistory',{'body':_0x416f21,'log':'CreateCmHopperHistory'});};exports[_0xdf3a('0x5')]=function(_0x27b919){return client[_0xdf3a('0x6')](_0xdf3a('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0xdf3a('0x8')](_0x27b919,_0xdf3a('0x9'))[_0xdf3a('0xa')](_0xdf3a('0xb')),moment()[_0xdf3a('0xa')](_0xdf3a('0xb'))]}},'raw':![]},'log':_0xdf3a('0xc')});};exports[_0xdf3a('0xd')]=function(){return function(){return client[_0xdf3a('0x6')](_0xdf3a('0xe'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xdf3a('0xf'))[_0xdf3a('0xa')](_0xdf3a('0xb')),moment()[_0xdf3a('0x10')](_0xdf3a('0xf'))['format'](_0xdf3a('0xb'))]},'campaigntype':_0xdf3a('0x4')},'raw':![]},'log':_0xdf3a('0xe')});};};exports[_0xdf3a('0x11')]=function(){return function(){return client['Request'](_0xdf3a('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xdf3a('0xf'))[_0xdf3a('0xa')](_0xdf3a('0xb')),moment()[_0xdf3a('0x10')](_0xdf3a('0xf'))[_0xdf3a('0xa')](_0xdf3a('0xb'))]},'campaigntype':_0xdf3a('0x13')},'raw':![]},'log':_0xdf3a('0x12')});};}; \ No newline at end of file +var _0x9b00=['YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','startOf','endOf','day','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','moment','createHistory','campaign','queue','CreateCmHopperHistory','Request','AvgHandleTime','minutes','format'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x9b00,0x99));var _0x09b0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9b00[_0x432682];return _0x463d05;};'use strict';var client=require('../client');var moment=require(_0x09b0('0x0'));exports[_0x09b0('0x1')]=function(_0x5bf569){_0x5bf569[_0x09b0('0x2')]=_0x5bf569[_0x09b0('0x3')];return client['Request'](_0x09b0('0x4'),{'body':_0x5bf569,'log':_0x09b0('0x4')});};exports['avgHandleTime']=function(_0xb4e3a4){return client[_0x09b0('0x5')](_0x09b0('0x6'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0xb4e3a4,_0x09b0('0x7'))[_0x09b0('0x8')](_0x09b0('0x9')),moment()[_0x09b0('0x8')](_0x09b0('0x9'))]}},'raw':![]},'log':_0x09b0('0xa')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x09b0('0x5')](_0x09b0('0xb'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x09b0('0xc')]('day')[_0x09b0('0x8')](_0x09b0('0x9')),moment()[_0x09b0('0xd')](_0x09b0('0xe'))[_0x09b0('0x8')](_0x09b0('0x9'))]},'campaigntype':'queue'},'raw':![]},'log':_0x09b0('0xb')});};};exports[_0x09b0('0xf')]=function(){return function(){return client[_0x09b0('0x5')](_0x09b0('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x09b0('0xc')](_0x09b0('0xe'))[_0x09b0('0x8')](_0x09b0('0x9')),moment()['endOf'](_0x09b0('0xe'))['format'](_0x09b0('0x9'))]},'campaigntype':_0x09b0('0x11')},'raw':![]},'log':_0x09b0('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 92ebc6c..d17908e 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ab9=['t38timeout','tech','ListId','key','Trunk','callerid','active','getFaxAccount','notify','Request','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','name','description','ecm','headerinfo','maxrate','modem','gateway'];(function(_0x4a5cc0,_0x5cce8a){var _0x41ffa2=function(_0x80efc){while(--_0x80efc){_0x4a5cc0['push'](_0x4a5cc0['shift']());}};_0x41ffa2(++_0x5cce8a);}(_0x6ab9,0x19a));var _0x96ab=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x6ab9[_0x1762b4];return _0x29beda;};'use strict';var client=require(_0x96ab('0x0'));exports[_0x96ab('0x1')]=function(){return function(){return client['Request'](_0x96ab('0x2'),{'options':{'raw':![],'attributes':['id',_0x96ab('0x3'),_0x96ab('0x4'),_0x96ab('0x5'),_0x96ab('0x6'),'localstationid','minrate',_0x96ab('0x7'),_0x96ab('0x8'),_0x96ab('0x9'),'faxdetect',_0x96ab('0xa'),_0x96ab('0xb'),'TrunkId',_0x96ab('0xc'),_0x96ab('0xd')],'include':[{'model':_0x96ab('0xe'),'as':_0x96ab('0xe'),'attributes':['id',_0x96ab('0x3'),_0x96ab('0xf'),_0x96ab('0x10')]}]},'log':_0x96ab('0x11')});};};exports[_0x96ab('0x12')]=function(_0x9a19d7,_0x563948){return client[_0x96ab('0x13')](_0x96ab('0x14'),{'account':{'id':_0x9a19d7},'body':_0x563948,'log':'NotifyFaxAccount'});}; \ No newline at end of file +var _0x09df=['callerid','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','ecm','minrate','maxrate','t38timeout','TrunkId','ListId','key','Trunk','name'];(function(_0x43d78d,_0x28cde1){var _0x52f114=function(_0x94b812){while(--_0x94b812){_0x43d78d['push'](_0x43d78d['shift']());}};_0x52f114(++_0x28cde1);}(_0x09df,0x164));var _0xf09d=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0x09df[_0x4551f6];return _0x581dc2;};'use strict';var client=require(_0xf09d('0x0'));exports[_0xf09d('0x1')]=function(){return function(){return client['Request'](_0xf09d('0x2'),{'options':{'raw':![],'attributes':['id','name','description',_0xf09d('0x3'),'headerinfo','localstationid',_0xf09d('0x4'),_0xf09d('0x5'),'modem','gateway','faxdetect',_0xf09d('0x6'),'tech',_0xf09d('0x7'),_0xf09d('0x8'),_0xf09d('0x9')],'include':[{'model':_0xf09d('0xa'),'as':_0xf09d('0xa'),'attributes':['id',_0xf09d('0xb'),_0xf09d('0xc'),'active']}]},'log':_0xf09d('0xd')});};};exports[_0xf09d('0xe')]=function(_0x56a961,_0x38d929){return client['Request'](_0xf09d('0xf'),{'account':{'id':_0x56a961},'body':_0x38d929,'log':_0xf09d('0xf')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index dbd93dd..5f1de5e 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8ed=['update','UpdateFaxMessage','../client'];(function(_0x227c59,_0x575c83){var _0x35aeac=function(_0x477179){while(--_0x477179){_0x227c59['push'](_0x227c59['shift']());}};_0x35aeac(++_0x575c83);}(_0xa8ed,0x10a));var _0xda8e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa8ed[_0x56482c];return _0x5aae7a;};'use strict';var client=require(_0xda8e('0x0'));exports[_0xda8e('0x1')]=function(_0x30a6ab,_0x418cbf){return client['Request'](_0xda8e('0x2'),{'body':_0x418cbf,'options':{'where':{'AttachmentId':_0x30a6ab}},'log':_0xda8e('0x2')});}; \ No newline at end of file +var _0x86d0=['UpdateFaxMessage','../client','update','Request'];(function(_0x26425a,_0x1b4d6f){var _0x12802a=function(_0x5db8a7){while(--_0x5db8a7){_0x26425a['push'](_0x26425a['shift']());}};_0x12802a(++_0x1b4d6f);}(_0x86d0,0x1d1));var _0x086d=function(_0x563af1,_0x37924c){_0x563af1=_0x563af1-0x0;var _0x58fccb=_0x86d0[_0x563af1];return _0x58fccb;};'use strict';var client=require(_0x086d('0x0'));exports[_0x086d('0x1')]=function(_0x521c9b,_0x265594){return client[_0x086d('0x2')]('UpdateFaxMessage',{'body':_0x265594,'options':{'where':{'AttachmentId':_0x521c9b}},'log':_0x086d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 308ad0b..51bb539 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b8f=['Variable','Descriptions','keyContent','variableName','Fields','idField','customField','Tag','Tags','../../client','Request','GetDeskAccount','name','password','remoteUri','authType','type','serverUrl','Configurations','DeskField','content'];(function(_0x5a6f66,_0x20f8f0){var _0x1e3427=function(_0x940254){while(--_0x940254){_0x5a6f66['push'](_0x5a6f66['shift']());}};_0x1e3427(++_0x20f8f0);}(_0x1b8f,0x1d7));var _0xf1b8=function(_0x3eb17a,_0x34514d){_0x3eb17a=_0x3eb17a-0x0;var _0x34c6ec=_0x1b8f[_0x3eb17a];return _0x34c6ec;};'use strict';var client=require(_0xf1b8('0x0'));exports['getDeskAccounts']=function(){return function(_0x23994a){return client[_0xf1b8('0x1')](_0xf1b8('0x2'),{'options':{'raw':![],'attributes':['id',_0xf1b8('0x3'),'description','username',_0xf1b8('0x4'),_0xf1b8('0x5'),_0xf1b8('0x6'),_0xf1b8('0x7'),_0xf1b8('0x8')],'include':[{'model':'DeskConfiguration','as':_0xf1b8('0x9'),'attributes':['id',_0xf1b8('0x3')],'include':[{'model':_0xf1b8('0xa'),'as':'Subjects','attributes':['id','type',_0xf1b8('0xb'),'variableName'],'include':[{'model':'Variable','as':_0xf1b8('0xc'),'attributes':['id',_0xf1b8('0x3')]}]},{'model':_0xf1b8('0xa'),'as':_0xf1b8('0xd'),'attributes':['id',_0xf1b8('0x7'),_0xf1b8('0xb'),'key','keyType',_0xf1b8('0xe'),_0xf1b8('0xf')],'include':[{'model':_0xf1b8('0xc'),'as':'Variable','attributes':['id','name']}]},{'model':_0xf1b8('0xa'),'as':_0xf1b8('0x10'),'attributes':['id',_0xf1b8('0x7'),_0xf1b8('0xb'),_0xf1b8('0x11'),'nameField',_0xf1b8('0x12'),_0xf1b8('0xf')],'include':[{'model':_0xf1b8('0xc'),'as':_0xf1b8('0xc'),'attributes':['id',_0xf1b8('0x3')]}]},{'model':_0xf1b8('0x13'),'as':_0xf1b8('0x14'),'attributes':['id',_0xf1b8('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0x354c=['getDeskAccounts','name','description','username','password','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','Variable','Descriptions','content','key','keyType','keyContent','variableName','Fields','idField','nameField','Tag','Tags','../../client'];(function(_0x337738,_0x9dc99d){var _0x5905d2=function(_0x5eb390){while(--_0x5eb390){_0x337738['push'](_0x337738['shift']());}};_0x5905d2(++_0x9dc99d);}(_0x354c,0xc7));var _0xc354=function(_0x29b431,_0x25bcdc){_0x29b431=_0x29b431-0x0;var _0x41fc6c=_0x354c[_0x29b431];return _0x41fc6c;};'use strict';var client=require(_0xc354('0x0'));exports[_0xc354('0x1')]=function(){return function(_0x56e4bd){return client['Request']('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0xc354('0x2'),_0xc354('0x3'),_0xc354('0x4'),_0xc354('0x5'),'remoteUri',_0xc354('0x6'),_0xc354('0x7'),_0xc354('0x8')],'include':[{'model':_0xc354('0x9'),'as':_0xc354('0xa'),'attributes':['id',_0xc354('0x2')],'include':[{'model':_0xc354('0xb'),'as':_0xc354('0xc'),'attributes':['id',_0xc354('0x7'),'content','variableName'],'include':[{'model':_0xc354('0xd'),'as':_0xc354('0xd'),'attributes':['id',_0xc354('0x2')]}]},{'model':'DeskField','as':_0xc354('0xe'),'attributes':['id',_0xc354('0x7'),_0xc354('0xf'),_0xc354('0x10'),_0xc354('0x11'),_0xc354('0x12'),_0xc354('0x13')],'include':[{'model':'Variable','as':_0xc354('0xd'),'attributes':['id',_0xc354('0x2')]}]},{'model':_0xc354('0xb'),'as':_0xc354('0x14'),'attributes':['id',_0xc354('0x7'),_0xc354('0xf'),_0xc354('0x15'),_0xc354('0x16'),'customField',_0xc354('0x13')],'include':[{'model':_0xc354('0xd'),'as':'Variable','attributes':['id',_0xc354('0x2')]}]},{'model':_0xc354('0x17'),'as':_0xc354('0x18'),'attributes':['id',_0xc354('0x2')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index d26f0ed..8418058 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ec6=['Descriptions','type','key','keyType','keyContent','Dynamics365Field','idField','CloudProvider','data2','data5','data7','../../client','getDynamics365Accounts','GetDynamics365Account','username','remoteUri','clientId','serverUrl','description','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','Subjects','content','variableName','Variable','name'];(function(_0x5d932b,_0x2699f3){var _0x31068a=function(_0x441858){while(--_0x441858){_0x5d932b['push'](_0x5d932b['shift']());}};_0x31068a(++_0x2699f3);}(_0x5ec6,0x7f));var _0x65ec=function(_0x5e333d,_0x178ee4){_0x5e333d=_0x5e333d-0x0;var _0x4ae0a8=_0x5ec6[_0x5e333d];return _0x4ae0a8;};'use strict';var client=require(_0x65ec('0x0'));exports[_0x65ec('0x1')]=function(){return function(_0x26f68b){return client['Request'](_0x65ec('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x65ec('0x3'),'password',_0x65ec('0x4'),'tenantId',_0x65ec('0x5'),'clientSecret',_0x65ec('0x6'),_0x65ec('0x7'),'modernAuthentication'],'include':[{'model':_0x65ec('0x8'),'as':_0x65ec('0x9'),'attributes':['id','name',_0x65ec('0xa'),_0x65ec('0xb'),_0x65ec('0xc'),'openNewTab'],'include':[{'model':'Dynamics365Field','as':_0x65ec('0xd'),'attributes':['id','type',_0x65ec('0xe'),_0x65ec('0xf')],'include':[{'model':'Variable','as':_0x65ec('0x10'),'attributes':['id',_0x65ec('0x11')]}]},{'model':'Dynamics365Field','as':_0x65ec('0x12'),'attributes':['id',_0x65ec('0x13'),'content',_0x65ec('0x14'),_0x65ec('0x15'),_0x65ec('0x16'),_0x65ec('0xf')],'include':[{'model':_0x65ec('0x10'),'as':_0x65ec('0x10'),'attributes':['id',_0x65ec('0x11')]}]},{'model':_0x65ec('0x17'),'as':'Fields','attributes':['id',_0x65ec('0x13'),_0x65ec('0xe'),_0x65ec('0x18'),'nameField','customField',_0x65ec('0xf')],'include':[{'model':_0x65ec('0x10'),'as':_0x65ec('0x10'),'attributes':['id','name']}]}]},{'model':_0x65ec('0x19'),'as':_0x65ec('0x19'),'attributes':['id',_0x65ec('0x1a'),_0x65ec('0x1b'),_0x65ec('0x1c')]}]},'log':_0x65ec('0x2')});};}; \ No newline at end of file +var _0xd509=['customField','CloudProvider','data2','data5','data7','Request','GetDynamics365Account','password','remoteUri','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','name','ticketType','moduleCreate','additionalSearchContact','Dynamics365Field','content','Variable','Descriptions','type','keyType','variableName','Fields','idField','nameField'];(function(_0x2b0b13,_0x3edfee){var _0x4e4ffc=function(_0x2f2229){while(--_0x2f2229){_0x2b0b13['push'](_0x2b0b13['shift']());}};_0x4e4ffc(++_0x3edfee);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../../client');exports['getDynamics365Accounts']=function(){return function(_0x37fb32){return client[_0x9d50('0x0')](_0x9d50('0x1'),{'options':{'raw':![],'attributes':['id','name','username',_0x9d50('0x2'),_0x9d50('0x3'),'tenantId',_0x9d50('0x4'),_0x9d50('0x5'),_0x9d50('0x6'),'description',_0x9d50('0x7')],'include':[{'model':'Dynamics365Configuration','as':_0x9d50('0x8'),'attributes':['id',_0x9d50('0x9'),_0x9d50('0xa'),_0x9d50('0xb'),_0x9d50('0xc'),'openNewTab'],'include':[{'model':_0x9d50('0xd'),'as':'Subjects','attributes':['id','type',_0x9d50('0xe'),'variableName'],'include':[{'model':_0x9d50('0xf'),'as':_0x9d50('0xf'),'attributes':['id',_0x9d50('0x9')]}]},{'model':_0x9d50('0xd'),'as':_0x9d50('0x10'),'attributes':['id',_0x9d50('0x11'),_0x9d50('0xe'),'key',_0x9d50('0x12'),'keyContent',_0x9d50('0x13')],'include':[{'model':_0x9d50('0xf'),'as':_0x9d50('0xf'),'attributes':['id',_0x9d50('0x9')]}]},{'model':_0x9d50('0xd'),'as':_0x9d50('0x14'),'attributes':['id',_0x9d50('0x11'),_0x9d50('0xe'),_0x9d50('0x15'),_0x9d50('0x16'),_0x9d50('0x17'),_0x9d50('0x13')],'include':[{'model':'Variable','as':_0x9d50('0xf'),'attributes':['id',_0x9d50('0x9')]}]}]},{'model':_0x9d50('0x18'),'as':_0x9d50('0x18'),'attributes':['id',_0x9d50('0x19'),_0x9d50('0x1a'),_0x9d50('0x1b')]}]},'log':_0x9d50('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index c80d73e..71f5a28 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf682=['Tag','Subjects','type','FreshdeskField','Descriptions','content','key','keyType','keyContent','variableName','Variable','Fields','nameField','customField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','Request','username','apiKey','remoteUri','serverUrl','Configurations','name'];(function(_0x5cf113,_0x13f6f4){var _0x931a22=function(_0x36197b){while(--_0x36197b){_0x5cf113['push'](_0x5cf113['shift']());}};_0x931a22(++_0x13f6f4);}(_0xf682,0x12f));var _0x2f68=function(_0x21b9f9,_0x533484){_0x21b9f9=_0x21b9f9-0x0;var _0x35ee09=_0xf682[_0x21b9f9];return _0x35ee09;};'use strict';var client=require(_0x2f68('0x0'));exports[_0x2f68('0x1')]=function(){return function(_0x21557c){return client[_0x2f68('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id','name',_0x2f68('0x3'),_0x2f68('0x4'),_0x2f68('0x5'),_0x2f68('0x6')],'include':[{'model':'FreshdeskConfiguration','as':_0x2f68('0x7'),'attributes':['id',_0x2f68('0x8')],'include':[{'model':_0x2f68('0x9'),'attributes':['id',_0x2f68('0x8')]},{'model':'FreshdeskField','as':_0x2f68('0xa'),'attributes':['id',_0x2f68('0xb'),'content','variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x2f68('0x8')]}]},{'model':_0x2f68('0xc'),'as':_0x2f68('0xd'),'attributes':['id',_0x2f68('0xb'),_0x2f68('0xe'),_0x2f68('0xf'),_0x2f68('0x10'),_0x2f68('0x11'),_0x2f68('0x12')],'include':[{'model':_0x2f68('0x13'),'as':_0x2f68('0x13'),'attributes':['id',_0x2f68('0x8')]}]},{'model':_0x2f68('0xc'),'as':_0x2f68('0x14'),'attributes':['id',_0x2f68('0xb'),_0x2f68('0xe'),'idField',_0x2f68('0x15'),_0x2f68('0x16'),_0x2f68('0x12')],'include':[{'model':_0x2f68('0x13'),'as':_0x2f68('0x13'),'attributes':['id',_0x2f68('0x8')]}]}]}]},'log':_0x2f68('0x17')});};}; \ No newline at end of file +var _0x85d3=['../../client','getFreshdeskAccounts','GetFreshdeskAccount','name','username','apiKey','remoteUri','serverUrl','Configurations','Tag','FreshdeskField','Subjects','content','variableName','Variable','type','keyType','keyContent','idField','nameField'];(function(_0x14a40d,_0x5256c2){var _0x342c0c=function(_0x49759f){while(--_0x49759f){_0x14a40d['push'](_0x14a40d['shift']());}};_0x342c0c(++_0x5256c2);}(_0x85d3,0xc8));var _0x385d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x85d3[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x385d('0x0'));exports[_0x385d('0x1')]=function(){return function(_0x4cb27a){return client['Request'](_0x385d('0x2'),{'options':{'raw':![],'attributes':['id',_0x385d('0x3'),_0x385d('0x4'),_0x385d('0x5'),_0x385d('0x6'),_0x385d('0x7')],'include':[{'model':'FreshdeskConfiguration','as':_0x385d('0x8'),'attributes':['id','name'],'include':[{'model':_0x385d('0x9'),'attributes':['id',_0x385d('0x3')]},{'model':_0x385d('0xa'),'as':_0x385d('0xb'),'attributes':['id','type',_0x385d('0xc'),_0x385d('0xd')],'include':[{'model':_0x385d('0xe'),'as':_0x385d('0xe'),'attributes':['id',_0x385d('0x3')]}]},{'model':_0x385d('0xa'),'as':'Descriptions','attributes':['id',_0x385d('0xf'),'content','key',_0x385d('0x10'),_0x385d('0x11'),_0x385d('0xd')],'include':[{'model':_0x385d('0xe'),'as':_0x385d('0xe'),'attributes':['id',_0x385d('0x3')]}]},{'model':_0x385d('0xa'),'as':'Fields','attributes':['id','type',_0x385d('0xc'),_0x385d('0x12'),_0x385d('0x13'),'customField',_0x385d('0xd')],'include':[{'model':_0x385d('0xe'),'as':_0x385d('0xe'),'attributes':['id',_0x385d('0x3')]}]}]}]},'log':_0x385d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 400287d..02df2d3 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['Subjects','type','content','Variable','key','keyContent','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount','name','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(_0x40a0d0){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),'username','apiKey','remoteUri',_0xac4a('0x5')],'include':[{'model':_0xac4a('0x6'),'as':_0xac4a('0x7'),'attributes':['id',_0xac4a('0x4')],'include':[{'model':_0xac4a('0x8'),'as':_0xac4a('0x9'),'attributes':['id',_0xac4a('0xa'),_0xac4a('0xb'),'variableName'],'include':[{'model':'Variable','as':_0xac4a('0xc'),'attributes':['id',_0xac4a('0x4')]}]},{'model':_0xac4a('0x8'),'as':'Descriptions','attributes':['id',_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xd'),'keyType',_0xac4a('0xe'),'variableName'],'include':[{'model':_0xac4a('0xc'),'as':'Variable','attributes':['id',_0xac4a('0x4')]}]}]}]},'log':_0xac4a('0xf')});};}; \ No newline at end of file +var _0x86f4=['remoteUri','serverUrl','Configurations','FreshsalesField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount','name','username'];(function(_0x28383d,_0x4c101e){var _0x2e919e=function(_0x4080da){while(--_0x4080da){_0x28383d['push'](_0x28383d['shift']());}};_0x2e919e(++_0x4c101e);}(_0x86f4,0x18a));var _0x486f=function(_0x2c07b1,_0x5942e5){_0x2c07b1=_0x2c07b1-0x0;var _0x4fbec4=_0x86f4[_0x2c07b1];return _0x4fbec4;};'use strict';var client=require(_0x486f('0x0'));exports[_0x486f('0x1')]=function(){return function(_0x1417d5){return client[_0x486f('0x2')](_0x486f('0x3'),{'options':{'raw':![],'attributes':['id',_0x486f('0x4'),_0x486f('0x5'),'apiKey',_0x486f('0x6'),_0x486f('0x7')],'include':[{'model':'FreshsalesConfiguration','as':_0x486f('0x8'),'attributes':['id',_0x486f('0x4')],'include':[{'model':_0x486f('0x9'),'as':_0x486f('0xa'),'attributes':['id',_0x486f('0xb'),_0x486f('0xc'),'variableName'],'include':[{'model':_0x486f('0xd'),'as':_0x486f('0xd'),'attributes':['id',_0x486f('0x4')]}]},{'model':_0x486f('0x9'),'as':_0x486f('0xe'),'attributes':['id',_0x486f('0xb'),_0x486f('0xc'),_0x486f('0xf'),_0x486f('0x10'),_0x486f('0x11'),_0x486f('0x12')],'include':[{'model':_0x486f('0xd'),'as':_0x486f('0xd'),'attributes':['id',_0x486f('0x4')]}]}]}]},'log':_0x486f('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 4b98db6..fe10994 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd481=['../../client','Request','name','username','password','clientId','securityToken','serverUrl','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields'];(function(_0x50a087,_0x4b6f60){var _0x34a7de=function(_0x1075fb){while(--_0x1075fb){_0x50a087['push'](_0x50a087['shift']());}};_0x34a7de(++_0x4b6f60);}(_0xd481,0x1e4));var _0x1d48=function(_0x5e4d5b,_0x3acec6){_0x5e4d5b=_0x5e4d5b-0x0;var _0x5348ef=_0xd481[_0x5e4d5b];return _0x5348ef;};'use strict';var client=require(_0x1d48('0x0'));exports['getSalesforceAccounts']=function(){return function(_0x23c6d0){return client[_0x1d48('0x1')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id',_0x1d48('0x2'),_0x1d48('0x3'),_0x1d48('0x4'),'remoteUri',_0x1d48('0x5'),'clientSecret',_0x1d48('0x6'),_0x1d48('0x7'),'type'],'include':[{'model':_0x1d48('0x8'),'as':_0x1d48('0x9'),'attributes':['id',_0x1d48('0x2'),_0x1d48('0xa'),_0x1d48('0xb'),_0x1d48('0xc'),_0x1d48('0xd'),_0x1d48('0xe'),_0x1d48('0xf'),_0x1d48('0x10')],'include':[{'model':_0x1d48('0x11'),'as':_0x1d48('0x12'),'include':[{'model':'Variable','as':_0x1d48('0x13'),'attributes':['id',_0x1d48('0x2')]}]},{'model':_0x1d48('0x11'),'as':_0x1d48('0x14'),'include':[{'model':_0x1d48('0x13'),'as':_0x1d48('0x13'),'attributes':['id',_0x1d48('0x2')]}]},{'model':_0x1d48('0x11'),'as':_0x1d48('0x15'),'include':[{'model':_0x1d48('0x13'),'as':'Variable','attributes':['id',_0x1d48('0x2')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file +var _0x63ad=['Configurations','moduleSearch','ticketType','additionalSearchAccount','additionalSearchContact','additionalSearchLead','Variable','SalesforceField','Descriptions','name','Fields','getSalesforceAccounts','password','remoteUri','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration'];(function(_0x3eb25d,_0x271933){var _0x3451e6=function(_0x34731f){while(--_0x34731f){_0x3eb25d['push'](_0x3eb25d['shift']());}};_0x3451e6(++_0x271933);}(_0x63ad,0x7d));var _0xd63a=function(_0x3d8187,_0x5e3e03){_0x3d8187=_0x3d8187-0x0;var _0x453365=_0x63ad[_0x3d8187];return _0x453365;};'use strict';var client=require('../../client');exports[_0xd63a('0x0')]=function(){return function(_0x1d62e4){return client['Request']('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id','name','username',_0xd63a('0x1'),_0xd63a('0x2'),'clientId',_0xd63a('0x3'),_0xd63a('0x4'),_0xd63a('0x5'),_0xd63a('0x6')],'include':[{'model':_0xd63a('0x7'),'as':_0xd63a('0x8'),'attributes':['id','name',_0xd63a('0x9'),'moduleCreate',_0xd63a('0xa'),'leadId',_0xd63a('0xb'),_0xd63a('0xc'),_0xd63a('0xd')],'include':[{'model':'SalesforceField','as':'Subjects','include':[{'model':'Variable','as':_0xd63a('0xe'),'attributes':['id','name']}]},{'model':_0xd63a('0xf'),'as':_0xd63a('0x10'),'include':[{'model':'Variable','as':_0xd63a('0xe'),'attributes':['id',_0xd63a('0x11')]}]},{'model':_0xd63a('0xf'),'as':_0xd63a('0x12'),'include':[{'model':_0xd63a('0xe'),'as':_0xd63a('0xe'),'attributes':['id',_0xd63a('0x11')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 986cf6a..bd1092d 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['GetServicenowAccount','name','description','username','password','email','remoteUri','ServicenowConfiguration','ServicenowField','Subjects','type','content','variableName','Variable','key','keyType','keyContent','idField','nameField','customField','GetServicenowkAccount','getServicenowAccounts','Request'];(function(_0x4211bb,_0x424082){var _0x36d8e8=function(_0x8665dc){while(--_0x8665dc){_0x4211bb['push'](_0x4211bb['shift']());}};_0x36d8e8(++_0x424082);}(_0x4819,0xcd));var _0x9481=function(_0x2ceb31,_0x40ecf1){_0x2ceb31=_0x2ceb31-0x0;var _0x168859=_0x4819[_0x2ceb31];return _0x168859;};'use strict';var client=require('../../client');exports[_0x9481('0x0')]=function(){return function(_0x3307b0){return client[_0x9481('0x1')](_0x9481('0x2'),{'options':{'raw':![],'attributes':['id',_0x9481('0x3'),_0x9481('0x4'),_0x9481('0x5'),_0x9481('0x6'),_0x9481('0x7'),_0x9481('0x8'),'serverUrl'],'include':[{'model':_0x9481('0x9'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x9481('0xa'),'as':_0x9481('0xb'),'attributes':['id',_0x9481('0xc'),_0x9481('0xd'),_0x9481('0xe')],'include':[{'model':'Variable','as':_0x9481('0xf'),'attributes':['id','name']}]},{'model':_0x9481('0xa'),'as':'Descriptions','attributes':['id',_0x9481('0xc'),_0x9481('0xd'),_0x9481('0x10'),_0x9481('0x11'),_0x9481('0x12'),_0x9481('0xe')],'include':[{'model':_0x9481('0xf'),'as':_0x9481('0xf'),'attributes':['id',_0x9481('0x3')]}]},{'model':'ServicenowField','as':'Fields','attributes':['id',_0x9481('0xc'),_0x9481('0xd'),_0x9481('0x13'),_0x9481('0x14'),_0x9481('0x15'),_0x9481('0xe')],'include':[{'model':_0x9481('0xf'),'as':'Variable','attributes':['id',_0x9481('0x3')]}]}]}]},'log':_0x9481('0x16')});};}; \ No newline at end of file +var _0x4819=['GetServicenowAccount','name','description','username','password','email','remoteUri','ServicenowConfiguration','ServicenowField','Subjects','type','content','variableName','Variable','key','keyType','keyContent','idField','nameField','customField','GetServicenowkAccount','getServicenowAccounts','Request'];(function(_0x5622b2,_0x5dc268){var _0x2c441b=function(_0x3a3f73){while(--_0x3a3f73){_0x5622b2['push'](_0x5622b2['shift']());}};_0x2c441b(++_0x5dc268);}(_0x4819,0xcd));var _0x9481=function(_0x1ed99c,_0x52bb43){_0x1ed99c=_0x1ed99c-0x0;var _0x19c308=_0x4819[_0x1ed99c];return _0x19c308;};'use strict';var client=require('../../client');exports[_0x9481('0x0')]=function(){return function(_0x3307b0){return client[_0x9481('0x1')](_0x9481('0x2'),{'options':{'raw':![],'attributes':['id',_0x9481('0x3'),_0x9481('0x4'),_0x9481('0x5'),_0x9481('0x6'),_0x9481('0x7'),_0x9481('0x8'),'serverUrl'],'include':[{'model':_0x9481('0x9'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x9481('0xa'),'as':_0x9481('0xb'),'attributes':['id',_0x9481('0xc'),_0x9481('0xd'),_0x9481('0xe')],'include':[{'model':'Variable','as':_0x9481('0xf'),'attributes':['id','name']}]},{'model':_0x9481('0xa'),'as':'Descriptions','attributes':['id',_0x9481('0xc'),_0x9481('0xd'),_0x9481('0x10'),_0x9481('0x11'),_0x9481('0x12'),_0x9481('0xe')],'include':[{'model':_0x9481('0xf'),'as':_0x9481('0xf'),'attributes':['id',_0x9481('0x3')]}]},{'model':'ServicenowField','as':'Fields','attributes':['id',_0x9481('0xc'),_0x9481('0xd'),_0x9481('0x13'),_0x9481('0x14'),_0x9481('0x15'),_0x9481('0xe')],'include':[{'model':_0x9481('0xf'),'as':'Variable','attributes':['id',_0x9481('0x3')]}]}]}]},'log':_0x9481('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 59b45a1..24520af 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['GetSugarcrmAccount','getSugarcrmAccounts','Request','name','username','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','key','keyContent','customField'];(function(_0x1d4dbb,_0x11aaa8){var _0x561f54=function(_0x20f09f){while(--_0x20f09f){_0x1d4dbb['push'](_0x1d4dbb['shift']());}};_0x561f54(++_0x11aaa8);}(_0x2032,0xd9));var _0x2203=function(_0x2b71cd,_0x566c0d){_0x2b71cd=_0x2b71cd-0x0;var _0x13a554=_0x2032[_0x2b71cd];return _0x13a554;};'use strict';var client=require('../../client');exports[_0x2203('0x0')]=function(){return function(_0x1e103d){return client[_0x2203('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id',_0x2203('0x2'),_0x2203('0x3'),'password',_0x2203('0x4'),_0x2203('0x5')],'include':[{'model':_0x2203('0x6'),'as':_0x2203('0x7'),'attributes':['id',_0x2203('0x2')],'include':[{'model':_0x2203('0x8'),'as':_0x2203('0x9'),'attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc')],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id','name']}]},{'model':_0x2203('0x8'),'as':'Descriptions','attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xe'),'keyType',_0x2203('0xf'),'variableName'],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id',_0x2203('0x2')]}]},{'model':_0x2203('0x8'),'as':'Fields','attributes':['id','type','content','idField','nameField',_0x2203('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x2203('0xd'),'attributes':['id',_0x2203('0x2')]}]}]}]},'log':_0x2203('0x11')});};}; \ No newline at end of file +var _0x14a0=['variableName','key','keyContent','Variable','SugarcrmField','Fields','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','SugarcrmConfiguration','Configurations','type','content'];(function(_0x58418a,_0x3d9f06){var _0x2716bf=function(_0x36fcfd){while(--_0x36fcfd){_0x58418a['push'](_0x58418a['shift']());}};_0x2716bf(++_0x3d9f06);}(_0x14a0,0x8e));var _0x014a=function(_0x3219b5,_0x238c84){_0x3219b5=_0x3219b5-0x0;var _0xee31b2=_0x14a0[_0x3219b5];return _0xee31b2;};'use strict';var client=require('../../client');exports[_0x014a('0x0')]=function(){return function(_0x451138){return client[_0x014a('0x1')](_0x014a('0x2'),{'options':{'raw':![],'attributes':['id',_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),'remoteUri','serverUrl'],'include':[{'model':_0x014a('0x6'),'as':_0x014a('0x7'),'attributes':['id',_0x014a('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x014a('0x8'),_0x014a('0x9'),_0x014a('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x014a('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id','type','content',_0x014a('0xb'),'keyType',_0x014a('0xc'),_0x014a('0xa')],'include':[{'model':'Variable','as':_0x014a('0xd'),'attributes':['id',_0x014a('0x3')]}]},{'model':_0x014a('0xe'),'as':_0x014a('0xf'),'attributes':['id',_0x014a('0x8'),_0x014a('0x9'),_0x014a('0x10'),_0x014a('0x11'),_0x014a('0x12'),_0x014a('0xa')],'include':[{'model':_0x014a('0xd'),'as':_0x014a('0xd'),'attributes':['id','name']}]}]}]},'log':_0x014a('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 19885ae..5175c62 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76d6=['Subjects','type','variableName','Variable','Descriptions','content','key','keyType','keyContent','Fields','idField','nameField','customField','../../client','Request','GetVtigerAccount','name','username','remoteUri','serverUrl','VtigerConfiguration','VtigerField'];(function(_0x490da9,_0x31214f){var _0x5b9821=function(_0x1423e0){while(--_0x1423e0){_0x490da9['push'](_0x490da9['shift']());}};_0x5b9821(++_0x31214f);}(_0x76d6,0x91));var _0x676d=function(_0x458253,_0x33511e){_0x458253=_0x458253-0x0;var _0x27e4da=_0x76d6[_0x458253];return _0x27e4da;};'use strict';var client=require(_0x676d('0x0'));exports['getVtigerAccounts']=function(){return function(_0x38d6fc){return client[_0x676d('0x1')](_0x676d('0x2'),{'options':{'raw':![],'attributes':['id',_0x676d('0x3'),'description',_0x676d('0x4'),'accessKey',_0x676d('0x5'),_0x676d('0x6')],'include':[{'model':_0x676d('0x7'),'as':'Configurations','attributes':['id',_0x676d('0x3')],'include':[{'model':_0x676d('0x8'),'as':_0x676d('0x9'),'attributes':['id',_0x676d('0xa'),'content',_0x676d('0xb')],'include':[{'model':_0x676d('0xc'),'as':'Variable','attributes':['id',_0x676d('0x3')]}]},{'model':'VtigerField','as':_0x676d('0xd'),'attributes':['id',_0x676d('0xa'),_0x676d('0xe'),_0x676d('0xf'),_0x676d('0x10'),_0x676d('0x11'),_0x676d('0xb')],'include':[{'model':_0x676d('0xc'),'as':_0x676d('0xc'),'attributes':['id',_0x676d('0x3')]}]},{'model':'VtigerField','as':_0x676d('0x12'),'attributes':['id',_0x676d('0xa'),_0x676d('0xe'),_0x676d('0x13'),_0x676d('0x14'),_0x676d('0x15'),_0x676d('0xb')],'include':[{'model':_0x676d('0xc'),'as':_0x676d('0xc'),'attributes':['id',_0x676d('0x3')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file +var _0x6e47=['description','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','Variable','Descriptions','content','key','keyContent','variableName','Fields','idField','nameField','GetVtigerAccount','getVtigerAccounts','Request','name'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6e47,0x184));var _0x76e4=function(_0x44a6bf,_0x38597d){_0x44a6bf=_0x44a6bf-0x0;var _0x4be048=_0x6e47[_0x44a6bf];return _0x4be048;};'use strict';var client=require('../../client');exports[_0x76e4('0x0')]=function(){return function(_0x2d422f){return client[_0x76e4('0x1')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0x76e4('0x2'),_0x76e4('0x3'),_0x76e4('0x4'),_0x76e4('0x5'),_0x76e4('0x6'),_0x76e4('0x7')],'include':[{'model':_0x76e4('0x8'),'as':_0x76e4('0x9'),'attributes':['id',_0x76e4('0x2')],'include':[{'model':_0x76e4('0xa'),'as':_0x76e4('0xb'),'attributes':['id',_0x76e4('0xc'),'content','variableName'],'include':[{'model':_0x76e4('0xd'),'as':_0x76e4('0xd'),'attributes':['id','name']}]},{'model':_0x76e4('0xa'),'as':_0x76e4('0xe'),'attributes':['id',_0x76e4('0xc'),_0x76e4('0xf'),_0x76e4('0x10'),'keyType',_0x76e4('0x11'),_0x76e4('0x12')],'include':[{'model':'Variable','as':_0x76e4('0xd'),'attributes':['id',_0x76e4('0x2')]}]},{'model':_0x76e4('0xa'),'as':_0x76e4('0x13'),'attributes':['id',_0x76e4('0xc'),_0x76e4('0xf'),_0x76e4('0x14'),_0x76e4('0x15'),'customField',_0x76e4('0x12')],'include':[{'model':_0x76e4('0xd'),'as':_0x76e4('0xd'),'attributes':['id',_0x76e4('0x2')]}]}]}]},'log':_0x76e4('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 2d4e4b0..36df6df 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfb9=['username','password','token','remoteUri','serverUrl','name','ZendeskField','Subjects','content','Variable','Descriptions','type','key','keyType','variableName','idField','nameField','customField','../../client','GetZendeskAccount'];(function(_0x12f265,_0x312315){var _0x2a0e75=function(_0x10a971){while(--_0x10a971){_0x12f265['push'](_0x12f265['shift']());}};_0x2a0e75(++_0x312315);}(_0xcfb9,0xc6));var _0x9cfb=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0xcfb9[_0x141e03];return _0x2074e3;};'use strict';var client=require(_0x9cfb('0x0'));exports['getZendeskAccounts']=function(){return function(_0x3bbbdb){return client['Request'](_0x9cfb('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x9cfb('0x2'),_0x9cfb('0x3'),_0x9cfb('0x4'),_0x9cfb('0x5'),'authType',_0x9cfb('0x6'),'type'],'include':[{'model':'ZendeskConfiguration','as':'Configurations','attributes':['id',_0x9cfb('0x7')],'include':[{'model':'Tag','attributes':['id',_0x9cfb('0x7')]},{'model':_0x9cfb('0x8'),'as':_0x9cfb('0x9'),'attributes':['id','type',_0x9cfb('0xa'),'variableName'],'include':[{'model':_0x9cfb('0xb'),'as':_0x9cfb('0xb'),'attributes':['id','name']}]},{'model':'ZendeskField','as':_0x9cfb('0xc'),'attributes':['id',_0x9cfb('0xd'),'content',_0x9cfb('0xe'),_0x9cfb('0xf'),'keyContent',_0x9cfb('0x10')],'include':[{'model':_0x9cfb('0xb'),'as':_0x9cfb('0xb'),'attributes':['id',_0x9cfb('0x7')]}]},{'model':_0x9cfb('0x8'),'as':'Fields','attributes':['id',_0x9cfb('0xd'),_0x9cfb('0xa'),_0x9cfb('0x11'),_0x9cfb('0x12'),_0x9cfb('0x13'),'variableName'],'include':[{'model':'Variable','as':_0x9cfb('0xb'),'attributes':['id',_0x9cfb('0x7')]}]}]}]},'log':_0x9cfb('0x1')});};}; \ No newline at end of file +var _0xcaba=['customField','../../client','Request','GetZendeskAccount','name','username','password','token','remoteUri','serverUrl','type','ZendeskConfiguration','Configurations','Tag','Subjects','content','variableName','Variable','ZendeskField','Descriptions','key','keyContent','Fields','idField','nameField'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcaba,0x15f));var _0xacab=function(_0x161251,_0x19e548){_0x161251=_0x161251-0x0;var _0x22b965=_0xcaba[_0x161251];return _0x22b965;};'use strict';var client=require(_0xacab('0x0'));exports['getZendeskAccounts']=function(){return function(_0x109b36){return client[_0xacab('0x1')](_0xacab('0x2'),{'options':{'raw':![],'attributes':['id',_0xacab('0x3'),_0xacab('0x4'),_0xacab('0x5'),_0xacab('0x6'),_0xacab('0x7'),'authType',_0xacab('0x8'),_0xacab('0x9')],'include':[{'model':_0xacab('0xa'),'as':_0xacab('0xb'),'attributes':['id',_0xacab('0x3')],'include':[{'model':_0xacab('0xc'),'attributes':['id',_0xacab('0x3')]},{'model':'ZendeskField','as':_0xacab('0xd'),'attributes':['id',_0xacab('0x9'),_0xacab('0xe'),_0xacab('0xf')],'include':[{'model':_0xacab('0x10'),'as':_0xacab('0x10'),'attributes':['id',_0xacab('0x3')]}]},{'model':_0xacab('0x11'),'as':_0xacab('0x12'),'attributes':['id',_0xacab('0x9'),_0xacab('0xe'),_0xacab('0x13'),'keyType',_0xacab('0x14'),_0xacab('0xf')],'include':[{'model':_0xacab('0x10'),'as':_0xacab('0x10'),'attributes':['id','name']}]},{'model':_0xacab('0x11'),'as':_0xacab('0x15'),'attributes':['id',_0xacab('0x9'),_0xacab('0xe'),_0xacab('0x16'),_0xacab('0x17'),_0xacab('0x18'),_0xacab('0xf')],'include':[{'model':_0xacab('0x10'),'as':_0xacab('0x10'),'attributes':['id',_0xacab('0x3')]}]}]}]},'log':_0xacab('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 67bd7ff..ce15b80 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x222b=['../../client','Request','name','description','clientId','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','content','variableName','Variable','Descriptions','type','keyContent','Fields','nameField','customField','GetZohoAccount'];(function(_0x22f373,_0xfe4768){var _0x1da590=function(_0x187492){while(--_0x187492){_0x22f373['push'](_0x22f373['shift']());}};_0x1da590(++_0xfe4768);}(_0x222b,0xf0));var _0xb222=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0x222b[_0x46c1d5];return _0x40fe7b;};'use strict';var client=require(_0xb222('0x0'));exports['getZohoAccounts']=function(){return function(_0x36eb13){return client[_0xb222('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0xb222('0x2'),_0xb222('0x3'),'host','zone',_0xb222('0x4'),'clientSecret',_0xb222('0x5'),_0xb222('0x6'),_0xb222('0x7')],'include':[{'model':_0xb222('0x8'),'as':_0xb222('0x9'),'attributes':['id','name',_0xb222('0xa'),_0xb222('0xb'),_0xb222('0x3')],'include':[{'model':_0xb222('0xc'),'as':_0xb222('0xd'),'attributes':['id','type',_0xb222('0xe'),_0xb222('0xf')],'include':[{'model':_0xb222('0x10'),'as':_0xb222('0x10'),'attributes':['id',_0xb222('0x2')]}]},{'model':_0xb222('0xc'),'as':_0xb222('0x11'),'attributes':['id',_0xb222('0x12'),'content','key','keyType',_0xb222('0x13'),_0xb222('0xf')],'include':[{'model':_0xb222('0x10'),'as':_0xb222('0x10'),'attributes':['id','name']}]},{'model':_0xb222('0xc'),'as':_0xb222('0x14'),'attributes':['id',_0xb222('0x12'),_0xb222('0xe'),'idField',_0xb222('0x15'),_0xb222('0x16'),_0xb222('0xf')],'include':[{'model':_0xb222('0x10'),'as':_0xb222('0x10'),'attributes':['id',_0xb222('0x2')]}]}]}]},'log':_0xb222('0x17')});};}; \ No newline at end of file +var _0x1ad1=['keyContent','variableName','Fields','idField','customField','../../client','Request','GetZohoAccount','name','description','host','zone','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','type','content','Variable','key','keyType'];(function(_0x12160c,_0x237bed){var _0xfe024c=function(_0x3ae5a2){while(--_0x3ae5a2){_0x12160c['push'](_0x12160c['shift']());}};_0xfe024c(++_0x237bed);}(_0x1ad1,0x113));var _0x11ad=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1ad1[_0x580576];return _0x3f55a0;};'use strict';var client=require(_0x11ad('0x0'));exports['getZohoAccounts']=function(){return function(_0x5ce3b7){return client[_0x11ad('0x1')](_0x11ad('0x2'),{'options':{'raw':![],'attributes':['id',_0x11ad('0x3'),_0x11ad('0x4'),_0x11ad('0x5'),_0x11ad('0x6'),'clientId',_0x11ad('0x7'),_0x11ad('0x8'),_0x11ad('0x9'),_0x11ad('0xa')],'include':[{'model':_0x11ad('0xb'),'as':_0x11ad('0xc'),'attributes':['id',_0x11ad('0x3'),_0x11ad('0xd'),_0x11ad('0xe'),_0x11ad('0x4')],'include':[{'model':_0x11ad('0xf'),'as':_0x11ad('0x10'),'attributes':['id',_0x11ad('0x11'),_0x11ad('0x12'),'variableName'],'include':[{'model':'Variable','as':_0x11ad('0x13'),'attributes':['id',_0x11ad('0x3')]}]},{'model':_0x11ad('0xf'),'as':'Descriptions','attributes':['id',_0x11ad('0x11'),_0x11ad('0x12'),_0x11ad('0x14'),_0x11ad('0x15'),_0x11ad('0x16'),_0x11ad('0x17')],'include':[{'model':_0x11ad('0x13'),'as':_0x11ad('0x13'),'attributes':['id',_0x11ad('0x3')]}]},{'model':_0x11ad('0xf'),'as':_0x11ad('0x18'),'attributes':['id',_0x11ad('0x11'),'content',_0x11ad('0x19'),'nameField',_0x11ad('0x1a'),'variableName'],'include':[{'model':'Variable','as':_0x11ad('0x13'),'attributes':['id',_0x11ad('0x3')]}]}]}]},'log':_0x11ad('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 8f476ff..1f7c37d 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad62=['length','resolve','every','number','string','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','stack','replace','trim','intervalIftime\x20called\x20with'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0xad62,0x65));var _0x2ad6=function(_0xd4b806,_0x2b8195){_0xd4b806=_0xd4b806-0x0;var _0x5cf7e7=_0xad62[_0xd4b806];return _0x5cf7e7;};var logger=require(_0x2ad6('0x0'))(_0x2ad6('0x1'));var client=require(_0x2ad6('0x2'));function intervalIftime(_0x17e965,_0x47b6cf){const _0xb533c3=new Error()[_0x2ad6('0x3')][_0x2ad6('0x4')](/^Error/,'')[_0x2ad6('0x5')]();logger['silly'](_0x2ad6('0x6'),_0x17e965,_0x47b6cf,_0xb533c3);const _0x331c32=Array['isArray'](_0x17e965);if(!_0x17e965||_0x331c32&&_0x17e965[_0x2ad6('0x7')]===0x0){return Promise[_0x2ad6('0x8')](![]);}else{var _0x11c006=[];var _0x3968ed=[];var _0x47704d=_0x331c32?_0x17e965:[_0x17e965];var _0x4596d2=_0x47704d[_0x2ad6('0x9')](function(_0x208b93){return typeof _0x208b93===_0x2ad6('0xa');});var _0x2f2bf1=_0x47704d[_0x2ad6('0x9')](function(_0x534545){return typeof _0x534545===_0x2ad6('0xb');});if(!_0x4596d2&&!_0x2f2bf1){_0x11c006=_0x47704d[_0x2ad6('0xc')](function(_0x4603ac){return _0x4603ac['id'];});if(_0x11c006[_0x2ad6('0x7')]===0x0){_0x3968ed=_0x47704d[_0x2ad6('0xc')](function(_0x34acd6){return _0x34acd6[_0x2ad6('0xd')];});}}else{if(_0x4596d2){_0x11c006=_0x11c006[_0x2ad6('0xe')](_0x47704d);}if(_0x2f2bf1){_0x3968ed=_0x3968ed[_0x2ad6('0xe')](_0x47704d);}}return client[_0x2ad6('0xf')](_0x2ad6('0x10'),{'intervalIds':_0x11c006,'intervals':_0x3968ed,'timezone':_0x47b6cf,'log':_0x2ad6('0x10')});}}exports[_0x2ad6('0x11')]=intervalIftime; \ No newline at end of file +var _0x2310=['intervalIftime\x20called\x20with','length','resolve','every','number','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','replace','trim'];(function(_0x566eb5,_0x3eb497){var _0x2a9713=function(_0x46fe4e){while(--_0x46fe4e){_0x566eb5['push'](_0x566eb5['shift']());}};_0x2a9713(++_0x3eb497);}(_0x2310,0x1bd));var _0x0231=function(_0x4b223d,_0x1de953){_0x4b223d=_0x4b223d-0x0;var _0x331fd8=_0x2310[_0x4b223d];return _0x331fd8;};var logger=require(_0x0231('0x0'))('dialer');var client=require('../client');function intervalIftime(_0x50dc8a,_0x10b0c4){const _0x4cbc71=new Error()['stack'][_0x0231('0x1')](/^Error/,'')[_0x0231('0x2')]();logger['silly'](_0x0231('0x3'),_0x50dc8a,_0x10b0c4,_0x4cbc71);const _0x2a95e9=Array['isArray'](_0x50dc8a);if(!_0x50dc8a||_0x2a95e9&&_0x50dc8a[_0x0231('0x4')]===0x0){return Promise[_0x0231('0x5')](![]);}else{var _0x317286=[];var _0x2a5698=[];var _0x51b541=_0x2a95e9?_0x50dc8a:[_0x50dc8a];var _0x1cee59=_0x51b541[_0x0231('0x6')](function(_0x4e43a7){return typeof _0x4e43a7===_0x0231('0x7');});var _0x112411=_0x51b541[_0x0231('0x6')](function(_0x16043d){return typeof _0x16043d==='string';});if(!_0x1cee59&&!_0x112411){_0x317286=_0x51b541[_0x0231('0x8')](function(_0xcb2e5a){return _0xcb2e5a['id'];});if(_0x317286['length']===0x0){_0x2a5698=_0x51b541['map'](function(_0x31b5b8){return _0x31b5b8[_0x0231('0x9')];});}}else{if(_0x1cee59){_0x317286=_0x317286['concat'](_0x51b541);}if(_0x112411){_0x2a5698=_0x2a5698[_0x0231('0xa')](_0x51b541);}}return client[_0x0231('0xb')]('IntervalIftime',{'intervalIds':_0x317286,'intervals':_0x2a5698,'timezone':_0x10b0c4,'log':_0x0231('0xc')});}}exports[_0x0231('0xd')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 3545615..58247a2 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7776=['accountcode','toNumber','uniqueid','lodash','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','voiceDialReport','starttime','endtime','diff'];(function(_0xdcbd4c,_0x2c7146){var _0x1b1fe0=function(_0x407fd9){while(--_0x407fd9){_0xdcbd4c['push'](_0xdcbd4c['shift']());}};_0x1b1fe0(++_0x2c7146);}(_0x7776,0x1f1));var _0x6777=function(_0x3bf82e,_0xcd0f43){_0x3bf82e=_0x3bf82e-0x0;var _0x355173=_0x7776[_0x3bf82e];return _0x355173;};'use strict';var moment=require('moment');var _=require(_0x6777('0x0'));var util=require('util');var client=require('../client');exports['voiceQueueReport']=function(_0x37173f){var _0x234413=_0x37173f[_0x6777('0x1')]||_0x37173f[_0x6777('0x2')];return client[_0x6777('0x3')](_0x6777('0x4'),{'body':{'channel':_0x6777('0x5'),'membername':_0x37173f['lastAssignedTo'],'interface':_[_0x6777('0x6')](_0x37173f[_0x6777('0x7')])?util[_0x6777('0x8')](_0x6777('0x9'),_0x37173f[_0x6777('0xa')]):_0x37173f[_0x6777('0x7')],'type':_0x6777('0xb'),'enterAt':_0x37173f[_0x6777('0xc')],'exitAt':_0x234413,'duration':moment(_0x234413)['diff'](_0x37173f[_0x6777('0xc')],_0x6777('0xd')),'data1':_0x6777('0xe'),'data2':_0x37173f[_0x6777('0xf')],'data3':_0x37173f[_0x6777('0x10')],'data4':null,'data5':_0x37173f[_0x6777('0x11')],'role':_0x6777('0x12'),'internal':_0x37173f['accountcode']?_['toNumber'](_0x37173f['accountcode']):undefined,'uniqueid':_0x37173f['uniqueid']},'log':_0x6777('0x4')});};exports[_0x6777('0x13')]=function(_0x2720ee){return client[_0x6777('0x3')]('CreateMemberReport',{'body':{'channel':_0x6777('0x5'),'membername':_0x2720ee['membername'],'interface':_0x2720ee['interface'],'type':_0x6777('0xb'),'enterAt':_0x2720ee[_0x6777('0x14')],'exitAt':_0x2720ee['endtime'],'duration':moment(_0x2720ee[_0x6777('0x15')])[_0x6777('0x16')](_0x2720ee[_0x6777('0x14')],_0x6777('0xd'))>=0x0?moment(_0x2720ee[_0x6777('0x15')])[_0x6777('0x16')](_0x2720ee[_0x6777('0x14')],_0x6777('0xd')):null,'data1':'outbound','data2':_0x2720ee['accountcode'],'data3':_0x2720ee[_0x6777('0x10')],'data4':_0x2720ee['dialstring']||null,'role':_0x6777('0x12'),'internal':_0x2720ee[_0x6777('0x17')]?_[_0x6777('0x18')](_0x2720ee[_0x6777('0x17')]):undefined,'uniqueid':_0x2720ee[_0x6777('0x19')]},'log':_0x6777('0x4')});}; \ No newline at end of file +var _0xd5ab=['queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','voice','membername','starttime','endtime','seconds','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','inbound','exten'];(function(_0x119b0a,_0x228e68){var _0x151de0=function(_0x455295){while(--_0x455295){_0x119b0a['push'](_0x119b0a['shift']());}};_0x151de0(++_0x228e68);}(_0xd5ab,0x16d));var _0xbd5a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd5ab[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0xbd5a('0x0'));var _=require(_0xbd5a('0x1'));var util=require(_0xbd5a('0x2'));var client=require(_0xbd5a('0x3'));exports[_0xbd5a('0x4')]=function(_0x593f12){var _0x1b7d49=_0x593f12[_0xbd5a('0x5')]||_0x593f12[_0xbd5a('0x6')];return client[_0xbd5a('0x7')](_0xbd5a('0x8'),{'body':{'channel':'voice','membername':_0x593f12[_0xbd5a('0x9')],'interface':_[_0xbd5a('0xa')](_0x593f12[_0xbd5a('0xb')])?util[_0xbd5a('0xc')](_0xbd5a('0xd'),_0x593f12[_0xbd5a('0x9')]):_0x593f12[_0xbd5a('0xb')],'type':_0xbd5a('0xe'),'enterAt':_0x593f12[_0xbd5a('0xf')],'exitAt':_0x1b7d49,'duration':moment(_0x1b7d49)[_0xbd5a('0x10')](_0x593f12[_0xbd5a('0xf')],'seconds'),'data1':_0xbd5a('0x11'),'data2':_0x593f12['calleridnum'],'data3':_0x593f12[_0xbd5a('0x12')],'data4':null,'data5':_0x593f12[_0xbd5a('0x13')],'role':_0xbd5a('0x14'),'internal':_0x593f12[_0xbd5a('0x15')]?_[_0xbd5a('0x16')](_0x593f12[_0xbd5a('0x15')]):undefined,'uniqueid':_0x593f12[_0xbd5a('0x17')]},'log':_0xbd5a('0x8')});};exports[_0xbd5a('0x18')]=function(_0x1c51f9){return client[_0xbd5a('0x7')](_0xbd5a('0x8'),{'body':{'channel':_0xbd5a('0x19'),'membername':_0x1c51f9[_0xbd5a('0x1a')],'interface':_0x1c51f9[_0xbd5a('0xb')],'type':_0xbd5a('0xe'),'enterAt':_0x1c51f9[_0xbd5a('0x1b')],'exitAt':_0x1c51f9[_0xbd5a('0x1c')],'duration':moment(_0x1c51f9['endtime'])[_0xbd5a('0x10')](_0x1c51f9[_0xbd5a('0x1b')],_0xbd5a('0x1d'))>=0x0?moment(_0x1c51f9[_0xbd5a('0x1c')])['diff'](_0x1c51f9[_0xbd5a('0x1b')],_0xbd5a('0x1d')):null,'data1':_0xbd5a('0x1e'),'data2':_0x1c51f9['accountcode'],'data3':_0x1c51f9[_0xbd5a('0x12')],'data4':_0x1c51f9[_0xbd5a('0x1f')]||null,'role':_0xbd5a('0x14'),'internal':_0x1c51f9[_0xbd5a('0x15')]?_[_0xbd5a('0x16')](_0x1c51f9['accountcode']):undefined,'uniqueid':_0x1c51f9[_0xbd5a('0x17')]},'log':_0xbd5a('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index c1ff2a0..35c0451 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 _0xf79b=['getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x1a4f1f,_0x168609){var _0x3b2e8b=function(_0x36f363){while(--_0x36f363){_0x1a4f1f['push'](_0x1a4f1f['shift']());}};_0x3b2e8b(++_0x168609);}(_0xf79b,0xa0));var _0xbf79=function(_0x4918b2,_0x142c1b){_0x4918b2=_0x4918b2-0x0;var _0x31e9c2=_0xf79b[_0x4918b2];return _0x31e9c2;};'use strict';var client=require('../client');exports[_0xbf79('0x0')]=function(){return client[_0xbf79('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbf79('0x2'),_0xbf79('0x3')]},'log':_0xbf79('0x4')});}; \ No newline at end of file +var _0x693f=['GetSettings','../client','getSettings','Request','ShowSetting','previewRecallmeReminderInterval'];(function(_0x3cec4c,_0x2c8613){var _0x5e9cca=function(_0x298591){while(--_0x298591){_0x3cec4c['push'](_0x3cec4c['shift']());}};_0x5e9cca(++_0x2c8613);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xf693('0x0'));exports[_0xf693('0x1')]=function(){return client[_0xf693('0x2')](_0xf693('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0xf693('0x4')]},'log':_0xf693('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 7ec114e..0ebe7e2 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 _0xf9fd=['Request','html','GetTemplate','getTemplates'];(function(_0xb1a475,_0x19439f){var _0x70396f=function(_0x3715cf){while(--_0x3715cf){_0xb1a475['push'](_0xb1a475['shift']());}};_0x70396f(++_0x19439f);}(_0xf9fd,0x14f));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0xdf9f('0x0')]=function(_0x3e0a46){return function(_0x3ddfcf){return client[_0xdf9f('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0xdf9f('0x2')]},'log':_0xdf9f('0x3')});};}; \ No newline at end of file +var _0x6827=['Request','name','html','../client','getTemplates'];(function(_0x15c460,_0x337396){var _0xcb7f55=function(_0x289819){while(--_0x289819){_0x15c460['push'](_0x15c460['shift']());}};_0xcb7f55(++_0x337396);}(_0x6827,0xda));var _0x7682=function(_0x328204,_0x586679){_0x328204=_0x328204-0x0;var _0xf600a0=_0x6827[_0x328204];return _0xf600a0;};'use strict';var client=require(_0x7682('0x0'));exports[_0x7682('0x1')]=function(_0x3bb995){return function(_0x25961e){return client[_0x7682('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x7682('0x3'),_0x7682('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 f9cd2e4..cff1b9a 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 _0xfe98=['Action','Actions','action','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','Condition','operator','AnyConditions'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xfe98,0x129));var _0x8fe9=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0xfe98[_0x53b8e0];return _0x10630c;};'use strict';var client=require(_0x8fe9('0x0'));exports[_0x8fe9('0x1')]=function(_0x1ccc5d){return function(_0x18ce9f){return client[_0x8fe9('0x2')](_0x8fe9('0x3'),{'options':{'raw':![],'attributes':['id',_0x8fe9('0x4'),_0x8fe9('0x5'),'status'],'include':[{'model':_0x8fe9('0x6'),'as':'AllConditions','attributes':['id','field',_0x8fe9('0x7'),'value']},{'model':_0x8fe9('0x6'),'as':_0x8fe9('0x8'),'attributes':['id','field',_0x8fe9('0x7'),'value']},{'model':_0x8fe9('0x9'),'as':_0x8fe9('0xa'),'attributes':['id',_0x8fe9('0xb'),'data1','data2',_0x8fe9('0xc'),_0x8fe9('0xd'),_0x8fe9('0xe'),_0x8fe9('0xf'),_0x8fe9('0x10')]}]},'log':_0x8fe9('0x3')});};}; \ No newline at end of file +var _0xea4a=['value','AnyConditions','Action','action','data2','data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','Condition','AllConditions','field','operator'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea4a,0x105));var _0xaea4=function(_0x3489fa,_0x195859){_0x3489fa=_0x3489fa-0x0;var _0x4418b8=_0xea4a[_0x3489fa];return _0x4418b8;};'use strict';var client=require(_0xaea4('0x0'));exports[_0xaea4('0x1')]=function(_0x5cb312){return function(_0x1ae14a){return client[_0xaea4('0x2')](_0xaea4('0x3'),{'options':{'raw':![],'attributes':['id',_0xaea4('0x4'),'channel','status'],'include':[{'model':_0xaea4('0x5'),'as':_0xaea4('0x6'),'attributes':['id',_0xaea4('0x7'),_0xaea4('0x8'),_0xaea4('0x9')]},{'model':_0xaea4('0x5'),'as':_0xaea4('0xa'),'attributes':['id',_0xaea4('0x7'),'operator',_0xaea4('0x9')]},{'model':_0xaea4('0xb'),'as':'Actions','attributes':['id',_0xaea4('0xc'),'data1',_0xaea4('0xd'),_0xaea4('0xe'),'data4',_0xaea4('0xf'),_0xaea4('0x10'),_0xaea4('0x11')]}]},'log':_0xaea4('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 827b10e..f72446c 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 _0x4086=['GetTrunk','name','registry','defaultuser','../client','Request'];(function(_0x2c452f,_0x12cc54){var _0x27d185=function(_0x43589a){while(--_0x43589a){_0x2c452f['push'](_0x2c452f['shift']());}};_0x27d185(++_0x12cc54);}(_0x4086,0x6a));var _0x6408=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4086[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x6408('0x0'));exports['getTrunks']=function(_0x1ed1eb){return function(_0x5af6a9){return client[_0x6408('0x1')](_0x6408('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6408('0x3'),_0x6408('0x4'),_0x6408('0x5')]},'log':_0x6408('0x2')});};}; \ No newline at end of file +var _0x4d33=['getTrunks','name','registry','defaultuser','GetTrunk'];(function(_0x2ccede,_0x44cbb1){var _0x114b13=function(_0x3b6191){while(--_0x3b6191){_0x2ccede['push'](_0x2ccede['shift']());}};_0x114b13(++_0x44cbb1);}(_0x4d33,0x1cc));var _0x34d3=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x4d33[_0x10291b];return _0x1d5fbe;};'use strict';var client=require('../client');exports[_0x34d3('0x0')]=function(_0x4dd23a){return function(_0x344b63){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x34d3('0x1'),_0x34d3('0x2'),_0x34d3('0x3')]},'log':_0x34d3('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 88a8601..eec9a9a 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 _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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe706,0xa3));var _0x6e70=function(_0x360516,_0x4417e9){_0x360516=_0x360516-0x0;var _0x39df49=_0xe706[_0x360516];return _0x39df49;};'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 +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x517a9a,_0x75aa3c){var _0x4f288f=function(_0x4e0308){while(--_0x4e0308){_0x517a9a['push'](_0x517a9a['shift']());}};_0x4f288f(++_0x75aa3c);}(_0xedd9,0xfc));var _0x9edd=function(_0x2af0b9,_0x54fd89){_0x2af0b9=_0x2af0b9-0x0;var _0x342a9a=_0xedd9[_0x2af0b9];return _0x342a9a;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 514949f..c08ec98 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 _0x0ae1=['../client','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x4ac5a4,_0x248114){var _0x35e907=function(_0x325bf4){while(--_0x325bf4){_0x4ac5a4['push'](_0x4ac5a4['shift']());}};_0x35e907(++_0x248114);}(_0x0ae1,0x15e));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x10ae('0x0'));exports['create']=function(_0x2d5d04){return client['Request']('CreateVoiceAgentReport',{'body':_0x2d5d04,'log':_0x10ae('0x1')});};exports[_0x10ae('0x2')]=function(_0x2e7a41,_0x5003df,_0x53bf64){return client[_0x10ae('0x3')]('UpdateVoiceAgentReport',{'body':_0x2e7a41,'options':{'where':{'uniqueid':_0x5003df,'interface':_0x53bf64,'agentcomplete':!![]}},'log':_0x10ae('0x4')});}; \ No newline at end of file +var _0xf8ff=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x18391d,_0x30724f){var _0x5ed00f=function(_0x16142a){while(--_0x16142a){_0x18391d['push'](_0x18391d['shift']());}};_0x5ed00f(++_0x30724f);}(_0xf8ff,0x153));var _0xff8f=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0xf8ff[_0x366388];return _0x41c97e;};'use strict';var client=require('../client');exports[_0xff8f('0x0')]=function(_0x1aa5e8){return client[_0xff8f('0x1')](_0xff8f('0x2'),{'body':_0x1aa5e8,'log':_0xff8f('0x2')});};exports[_0xff8f('0x3')]=function(_0x140890,_0x16eb8b,_0x200ed1){return client[_0xff8f('0x1')](_0xff8f('0x4'),{'body':_0x140890,'options':{'where':{'uniqueid':_0x16eb8b,'interface':_0x200ed1,'agentcomplete':!![]}},'log':_0xff8f('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index ca880be..9cb65cf 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 _0xb278=['calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','util','create','Request','CreateVoiceCallReport'];(function(_0x585180,_0x32b440){var _0x1946df=function(_0x5be7e4){while(--_0x5be7e4){_0x585180['push'](_0x585180['shift']());}};_0x1946df(++_0x32b440);}(_0xb278,0xf8));var _0x8b27=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xb278[_0x2fc012];return _0x2891f9;};'use strict';var moment=require('moment');var util=require(_0x8b27('0x0'));var _=require('lodash');var client=require('../client');exports[_0x8b27('0x1')]=function(_0x38df78){return client[_0x8b27('0x2')](_0x8b27('0x3'),{'body':_['merge'](_0x38df78,{'source':_0x38df78[_0x8b27('0x4')],'destinationcontext':_0x38df78[_0x8b27('0x5')],'callerid':_0x38df78[_0x8b27('0x6')],'amaflags':_0x8b27('0x7')}),'log':_0x8b27('0x3')});};exports[_0x8b27('0x8')]=function(){return function(){return client[_0x8b27('0x2')](_0x8b27('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x8b27('0xa'))[_0x8b27('0xb')](_0x8b27('0xc')),moment()[_0x8b27('0xd')](_0x8b27('0xa'))[_0x8b27('0xb')](_0x8b27('0xc'))]}},'attributes':[_0x8b27('0xe'),_0x8b27('0xf'),_0x8b27('0x10'),'billableseconds']},'log':_0x8b27('0x11')});};}; \ No newline at end of file +var _0xd821=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day'];(function(_0x503936,_0x54e4c8){var _0x41c846=function(_0x4b5b9d){while(--_0x4b5b9d){_0x503936['push'](_0x503936['shift']());}};_0x41c846(++_0x54e4c8);}(_0xd821,0x1e8));var _0x1d82=function(_0x3efd42,_0x197f2e){_0x3efd42=_0x3efd42-0x0;var _0x1b0c02=_0xd821[_0x3efd42];return _0x1b0c02;};'use strict';var moment=require('moment');var util=require(_0x1d82('0x0'));var _=require('lodash');var client=require('../client');exports[_0x1d82('0x1')]=function(_0x3f1495){return client[_0x1d82('0x2')](_0x1d82('0x3'),{'body':_[_0x1d82('0x4')](_0x3f1495,{'source':_0x3f1495[_0x1d82('0x5')],'destinationcontext':_0x3f1495['context'],'callerid':_0x3f1495[_0x1d82('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0x1d82('0x3')});};exports[_0x1d82('0x7')]=function(){return function(){return client[_0x1d82('0x2')](_0x1d82('0x8'),{'options':{'where':{'type':[_0x1d82('0x9')],'createdAt':{'$between':[moment()[_0x1d82('0xa')](_0x1d82('0xb'))[_0x1d82('0xc')](_0x1d82('0xd')),moment()[_0x1d82('0xe')](_0x1d82('0xb'))[_0x1d82('0xc')](_0x1d82('0xd'))]}},'attributes':[_0x1d82('0xf'),_0x1d82('0x10'),_0x1d82('0x11'),_0x1d82('0x12')]},'log':_0x1d82('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f2f30fb..dae5529 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 _0xacca=['CreateVoiceDialReport','../client','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xacca,0x6a));var _0xaacc=function(_0x243618,_0x239f71){_0x243618=_0x243618-0x0;var _0x58b1a6=_0xacca[_0x243618];return _0x58b1a6;};'use strict';var client=require(_0xaacc('0x0'));exports[_0xaacc('0x1')]=function(_0x99ce21){return client['Request'](_0xaacc('0x2'),{'body':_0x99ce21,'log':_0xaacc('0x2')});}; \ No newline at end of file +var _0x14e6=['Request','CreateVoiceDialReport','create'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x14e6,0x1b2));var _0x614e=function(_0x40d80a,_0x5e5089){_0x40d80a=_0x40d80a-0x0;var _0x335bfb=_0x14e6[_0x40d80a];return _0x335bfb;};'use strict';var client=require('../client');exports[_0x614e('0x0')]=function(_0x107dd0){return client[_0x614e('0x1')](_0x614e('0x2'),{'body':_0x107dd0,'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 a0dcbd9..65c8903 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 _0x2f3a=['getVoiceExtensions','../client','GetVoiceExtension','exten','recordingFormat'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x6b390a,_0x27edf3){_0x6b390a=_0x6b390a-0x0;var _0x5e46dc=_0x2f3a[_0x6b390a];return _0x5e46dc;};'use strict';var client=require(_0xa2f3('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xa2f3('0x1'),{'options':{'raw':!![],'attributes':['id',_0xa2f3('0x2'),_0xa2f3('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xa2f3('0x4')});};}; \ No newline at end of file +var _0xe3db=['../client','getVoiceExtensions','GetVoiceExtension','exten','recordingFormat'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe3db,0xc8));var _0xbe3d=function(_0x1d1115,_0x1e3741){_0x1d1115=_0x1d1115-0x0;var _0x5e996c=_0xe3db[_0x1d1115];return _0x5e996c;};'use strict';var client=require(_0xbe3d('0x0'));exports[_0xbe3d('0x1')]=function(){return function(){return client['Request'](_0xbe3d('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbe3d('0x3'),_0xbe3d('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xbe3d('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 04f8bdf..4a93814 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 _0x512b=['dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialPowerLevel','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix'];(function(_0x12725b,_0x371d63){var _0x3a565e=function(_0x1e55a3){while(--_0x1e55a3){_0x12725b['push'](_0x12725b['shift']());}};_0x3a565e(++_0x371d63);}(_0x512b,0x99));var _0xb512=function(_0x510315,_0x4406fb){_0x510315=_0x510315-0x0;var _0x2e5ae3=_0x512b[_0x510315];return _0x2e5ae3;};'use strict';var client=require(_0xb512('0x0'));exports[_0xb512('0x1')]=function(){return function(){return client['Request'](_0xb512('0x2'),{'options':{'raw':![],'attributes':['id',_0xb512('0x3'),_0xb512('0x4'),_0xb512('0x5'),_0xb512('0x6'),_0xb512('0x7'),'type',_0xb512('0x8'),_0xb512('0x9'),'dialLimitChannel','dialLimitQueue',_0xb512('0xa'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0xb512('0xb'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0xb512('0xc'),_0xb512('0xd'),'dialQueueTimeout',_0xb512('0xe'),_0xb512('0xf'),_0xb512('0x10'),_0xb512('0x11'),_0xb512('0x12'),_0xb512('0x13'),'dialNoAnswerRetryFrequency',_0xb512('0x14'),_0xb512('0x15'),_0xb512('0x16'),_0xb512('0x17'),_0xb512('0x18'),_0xb512('0x19'),'dialAMDInitialSilence',_0xb512('0x1a'),_0xb512('0x1b'),_0xb512('0x1c'),_0xb512('0x1d'),'dialAMDBetweenWordsSilence',_0xb512('0x1e'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0xb512('0x1f'),_0xb512('0x20'),_0xb512('0x21'),_0xb512('0x22'),_0xb512('0x23'),_0xb512('0x24'),'dialQueueProject2',_0xb512('0x7'),_0xb512('0x25'),'dialRandomLastDigitCallerIdNumber',_0xb512('0x26'),_0xb512('0x27'),_0xb512('0x28'),_0xb512('0x29'),'dialDropRetryFrequency',_0xb512('0x2a'),_0xb512('0x2b'),'dialMachineMaxRetry',_0xb512('0x2c'),_0xb512('0x2d'),_0xb512('0x2e'),_0xb512('0x2f'),_0xb512('0x30'),_0xb512('0x31'),'dialPreviewAutoRecallMe',_0xb512('0x32')],'include':[{'model':_0xb512('0x33'),'as':_0xb512('0x33'),'attributes':['id',_0xb512('0x3'),_0xb512('0x34'),_0xb512('0x35')]},{'model':_0xb512('0x36'),'as':_0xb512('0x37'),'attributes':['id',_0xb512('0x3')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0xb512('0x3'),_0xb512('0x34'),_0xb512('0x35')]},{'model':'Interval','as':_0xb512('0x38'),'attributes':['id','name'],'include':[{'model':_0xb512('0x38'),'as':_0xb512('0x39'),'attributes':['id','name',_0xb512('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x0772=['name','callerid','active','Pause','Interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk'];(function(_0x53d4bf,_0x18e4d9){var _0x40d32e=function(_0x2d0285){while(--_0x2d0285){_0x53d4bf['push'](_0x53d4bf['shift']());}};_0x40d32e(++_0x18e4d9);}(_0x0772,0x7f));var _0x2077=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x0772[_0x5d4607];return _0x5e4a86;};'use strict';var client=require(_0x2077('0x0'));exports[_0x2077('0x1')]=function(){return function(){return client[_0x2077('0x2')](_0x2077('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2077('0x4'),_0x2077('0x5'),_0x2077('0x6'),_0x2077('0x7'),_0x2077('0x8'),_0x2077('0x9'),_0x2077('0xa'),'dialLimitChannel','dialLimitQueue',_0x2077('0xb'),_0x2077('0xc'),_0x2077('0xd'),_0x2077('0xe'),_0x2077('0xf'),_0x2077('0x10'),_0x2077('0x11'),_0x2077('0x12'),_0x2077('0x13'),'dialQueueProject',_0x2077('0x14'),_0x2077('0x15'),'dialBusyMaxRetry',_0x2077('0x16'),_0x2077('0x17'),'dialNoAnswerRetryFrequency',_0x2077('0x18'),'dialTimezone',_0x2077('0x19'),'dialPrefix',_0x2077('0x1a'),_0x2077('0x1b'),_0x2077('0x1c'),_0x2077('0x1d'),_0x2077('0x1e'),_0x2077('0x1f'),_0x2077('0x20'),_0x2077('0x21'),_0x2077('0x22'),_0x2077('0x23'),'dialAMDMaximumWordLength',_0x2077('0x24'),'dialRecallMeTimeout',_0x2077('0x25'),_0x2077('0x26'),'dialAgiAfterHangupAgent',_0x2077('0x27'),_0x2077('0x28'),_0x2077('0x7'),_0x2077('0x29'),_0x2077('0x2a'),_0x2077('0x2b'),_0x2077('0x2c'),_0x2077('0x2d'),'dialDropMaxRetry',_0x2077('0x2e'),_0x2077('0x2f'),_0x2077('0x30'),_0x2077('0x31'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x2077('0x32'),_0x2077('0x33'),_0x2077('0x34'),'dialPredictiveIntervalMinThreshold',_0x2077('0x35'),_0x2077('0x36')],'include':[{'model':_0x2077('0x37'),'as':'Trunk','attributes':['id',_0x2077('0x38'),_0x2077('0x39'),_0x2077('0x3a')]},{'model':_0x2077('0x3b'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x2077('0x37'),'as':'TrunkBackup','attributes':['id',_0x2077('0x38'),'callerid','active']},{'model':'Interval','as':'Interval','attributes':['id',_0x2077('0x38')],'include':[{'model':_0x2077('0x3c'),'as':'Intervals','attributes':['id',_0x2077('0x38'),'interval']}]}]},'log':_0x2077('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 95c5630..ba7ae67 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(_0x4d31a3,_0x5e920c){var _0x52ca8b=function(_0x1abb33){while(--_0x1abb33){_0x4d31a3['push'](_0x4d31a3['shift']());}};_0x52ca8b(++_0x5e920c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x6e76ca,_0x23f503){var _0x3bacd6=function(_0x203083){while(--_0x203083){_0x6e76ca['push'](_0x6e76ca['shift']());}};_0x3bacd6(++_0x23f503);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 c985827..6fc5a20 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 _0xb132=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x4a79b8,_0x23163f){var _0xc03275=function(_0x1edfe4){while(--_0x1edfe4){_0x4a79b8['push'](_0x4a79b8['shift']());}};_0xc03275(++_0x23163f);}(_0xb132,0x1cf));var _0x2b13=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xb132[_0x425716];return _0x2d39af;};'use strict';var client=require(_0x2b13('0x0'));exports[_0x2b13('0x1')]=function(_0xa2b5f0){return function(){return client['Request'](_0x2b13('0x2'),{'options':{'where':{'VoiceQueueId':_0xa2b5f0,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x6044=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x584ef9,_0x24cb92){var _0x49ad82=function(_0x3e6552){while(--_0x3e6552){_0x584ef9['push'](_0x584ef9['shift']());}};_0x49ad82(++_0x24cb92);}(_0x6044,0xf0));var _0x4604=function(_0x4af2d2,_0x525ac8){_0x4af2d2=_0x4af2d2-0x0;var _0x1704a5=_0x6044[_0x4af2d2];return _0x1704a5;};'use strict';var client=require(_0x4604('0x0'));exports[_0x4604('0x1')]=function(_0x1535c2){return function(){return client['Request'](_0x4604('0x2'),{'options':{'where':{'VoiceQueueId':_0x1535c2,'paused':!![]},'raw':!![]},'log':_0x4604('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index ecda634..1e2b909 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3b1bef,_0x540d0d){var _0xc3c0f9=function(_0x1ef041){while(--_0x1ef041){_0x3b1bef['push'](_0x3b1bef['shift']());}};_0xc3c0f9(++_0x540d0d);}(_0x7a54,0x106));var _0x47a5=function(_0x1fac8c,_0xedcf60){_0x1fac8c=_0x1fac8c-0x0;var _0x3c22a2=_0x7a54[_0x1fac8c];return _0x3c22a2;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x5356f5,_0x412004){var _0x5595a5=function(_0x110437){while(--_0x110437){_0x5356f5['push'](_0x5356f5['shift']());}};_0x5595a5(++_0x412004);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 08f4ea0..d244e31 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 _0xac1e=['transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename'];(function(_0x11668c,_0x1913b1){var _0x354c9b=function(_0x525642){while(--_0x525642){_0x11668c['push'](_0x11668c['shift']());}};_0x354c9b(++_0x1913b1);}(_0xac1e,0x155));var _0xeac1=function(_0x3f8053,_0x56efe5){_0x3f8053=_0x3f8053-0x0;var _0x2eaf4e=_0xac1e[_0x3f8053];return _0x2eaf4e;};'use strict';var client=require(_0xeac1('0x0'));exports[_0xeac1('0x1')]={};exports[_0xeac1('0x2')]=function(_0x1ed951){return client[_0xeac1('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x1ed951[_0xeac1('0x4')],'transfererchannel':_0x1ed951[_0xeac1('0x5')],'transferercalleridnum':_0x1ed951['transferercalleridnum'],'transferercalleridname':_0x1ed951[_0xeac1('0x6')],'transfererconnectedlinenum':_0x1ed951[_0xeac1('0x7')],'transfererconnectedlinename':_0x1ed951[_0xeac1('0x8')],'transfereraccountcode':_0x1ed951[_0xeac1('0x9')],'transferercontext':_0x1ed951['transferercontext'],'transfererexten':_0x1ed951[_0xeac1('0xa')],'transfererlinkedid':_0x1ed951[_0xeac1('0xb')],'transfereechannel':_0x1ed951[_0xeac1('0xc')],'transfereecalleridnum':_0x1ed951[_0xeac1('0xd')],'transfereecalleridname':_0x1ed951[_0xeac1('0xe')],'transfereeconnectedlinenum':_0x1ed951[_0xeac1('0xf')],'transfereeconnectedlinename':_0x1ed951[_0xeac1('0x10')],'transfereeaccountcode':_0x1ed951['transfereeaccountcode'],'transfereecontext':_0x1ed951[_0xeac1('0x11')],'transfereeexten':_0x1ed951[_0xeac1('0x12')],'transfereelinkedid':_0x1ed951[_0xeac1('0x13')],'isexternal':_0x1ed951[_0xeac1('0x14')],'context':_0x1ed951[_0xeac1('0x15')],'extension':_0x1ed951[_0xeac1('0x16')],'type':_0xeac1('0x17')},'log':_0xeac1('0x18')});};exports['attendedTransfer']=function(_0x38faab){return client['Request'](_0xeac1('0x18'),{'body':{'result':_0x38faab['result'],'transfererchannel':_0x38faab[_0xeac1('0x19')],'transferercalleridnum':_0x38faab[_0xeac1('0x1a')],'transferercalleridname':_0x38faab[_0xeac1('0x1b')],'transfererconnectedlinenum':_0x38faab[_0xeac1('0x1c')],'transfererconnectedlinename':_0x38faab[_0xeac1('0x1d')],'transfereraccountcode':_0x38faab[_0xeac1('0x1e')],'transferercontext':_0x38faab[_0xeac1('0x1f')],'transfererexten':_0x38faab['secondtransfererexten'],'transfererlinkedid':_0x38faab[_0xeac1('0x20')],'transfereechannel':_0x38faab[_0xeac1('0x21')],'transfereecalleridnum':_0x38faab[_0xeac1('0x22')],'transfereecalleridname':_0x38faab[_0xeac1('0x23')],'transfereeconnectedlinenum':_0x38faab['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x38faab[_0xeac1('0x24')],'transfereeaccountcode':_0x38faab[_0xeac1('0x25')],'transfereecontext':_0x38faab[_0xeac1('0x26')],'transfereeexten':_0x38faab[_0xeac1('0x27')],'transfereelinkedid':_0x38faab['transfertargetlinkedid'],'isexternal':_0x38faab[_0xeac1('0x14')],'context':_0x38faab['origtransferercontext'],'extension':_0x38faab[_0xeac1('0x28')],'type':_0xeac1('0x29')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xde74=['secondtransfererexten','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext'];(function(_0xad0e77,_0x194af6){var _0x3f8adb=function(_0x52d13c){while(--_0x52d13c){_0xad0e77['push'](_0xad0e77['shift']());}};_0x3f8adb(++_0x194af6);}(_0xde74,0x96));var _0x4de7=function(_0x57df35,_0xf62a56){_0x57df35=_0x57df35-0x0;var _0x25b4b0=_0xde74[_0x57df35];return _0x25b4b0;};'use strict';var client=require(_0x4de7('0x0'));exports['transfers']={};exports[_0x4de7('0x1')]=function(_0x351d11){return client[_0x4de7('0x2')](_0x4de7('0x3'),{'body':{'result':_0x351d11[_0x4de7('0x4')],'transfererchannel':_0x351d11[_0x4de7('0x5')],'transferercalleridnum':_0x351d11[_0x4de7('0x6')],'transferercalleridname':_0x351d11[_0x4de7('0x7')],'transfererconnectedlinenum':_0x351d11['transfererconnectedlinenum'],'transfererconnectedlinename':_0x351d11['transfererconnectedlinename'],'transfereraccountcode':_0x351d11[_0x4de7('0x8')],'transferercontext':_0x351d11[_0x4de7('0x9')],'transfererexten':_0x351d11['transfererexten'],'transfererlinkedid':_0x351d11[_0x4de7('0xa')],'transfereechannel':_0x351d11[_0x4de7('0xb')],'transfereecalleridnum':_0x351d11[_0x4de7('0xc')],'transfereecalleridname':_0x351d11['transfereecalleridname'],'transfereeconnectedlinenum':_0x351d11['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x351d11[_0x4de7('0xd')],'transfereeaccountcode':_0x351d11['transfereeaccountcode'],'transfereecontext':_0x351d11[_0x4de7('0xe')],'transfereeexten':_0x351d11[_0x4de7('0xf')],'transfereelinkedid':_0x351d11[_0x4de7('0x10')],'isexternal':_0x351d11[_0x4de7('0x11')],'context':_0x351d11[_0x4de7('0x12')],'extension':_0x351d11['extension'],'type':_0x4de7('0x13')},'log':_0x4de7('0x3')});};exports['attendedTransfer']=function(_0x5025fb){return client['Request'](_0x4de7('0x3'),{'body':{'result':_0x5025fb[_0x4de7('0x4')],'transfererchannel':_0x5025fb[_0x4de7('0x14')],'transferercalleridnum':_0x5025fb[_0x4de7('0x15')],'transferercalleridname':_0x5025fb['origtransferercalleridname'],'transfererconnectedlinenum':_0x5025fb[_0x4de7('0x16')],'transfererconnectedlinename':_0x5025fb[_0x4de7('0x17')],'transfereraccountcode':_0x5025fb['origtransfereraccountcode'],'transferercontext':_0x5025fb[_0x4de7('0x18')],'transfererexten':_0x5025fb[_0x4de7('0x19')],'transfererlinkedid':_0x5025fb['origtransfererlinkedid'],'transfereechannel':_0x5025fb['transfertargetchannel'],'transfereecalleridnum':_0x5025fb['transfertargetcalleridnum'],'transfereecalleridname':_0x5025fb[_0x4de7('0x1a')],'transfereeconnectedlinenum':_0x5025fb[_0x4de7('0x1b')],'transfereeconnectedlinename':_0x5025fb[_0x4de7('0x1c')],'transfereeaccountcode':_0x5025fb[_0x4de7('0x1d')],'transfereecontext':_0x5025fb[_0x4de7('0x1e')],'transfereeexten':_0x5025fb[_0x4de7('0x1f')],'transfereelinkedid':_0x5025fb['transfertargetlinkedid'],'isexternal':_0x5025fb['isexternal'],'context':_0x5025fb[_0x4de7('0x20')],'extension':_0x5025fb[_0x4de7('0x21')],'type':_0x4de7('0x22')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c1cfb12..2e97c3c 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x26e757,_0x147382){var _0x4d571e=function(_0x4b213c){while(--_0x4b213c){_0x26e757['push'](_0x26e757['shift']());}};_0x4d571e(++_0x147382);}(_0xb10b,0x12a));var _0xbb10=function(_0x29a707,_0x342505){_0x29a707=_0x29a707-0x0;var _0x229e83=_0xb10b[_0x29a707];return _0x229e83;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x172952,_0x1096ff){var _0x34f05c=function(_0x2e21e0){while(--_0x2e21e0){_0x172952['push'](_0x172952['shift']());}};_0x34f05c(++_0x1096ff);}(_0x7a54,0x106));var _0x47a5=function(_0x1b89ef,_0x45aa54){_0x1b89ef=_0x1b89ef-0x0;var _0x4b5233=_0x7a54[_0x1b89ef];return _0x4b5233;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index e64dbfd..b07a958 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 _0xb0c3=['format','user:%s','trigger:%s','toLowerCase','lodash','bluebird','../../../../config/logger','../../rpc/cmContact','redis','localhost','info','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','data4','calleridname','','destcalleridname','Unknown','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','push'];(function(_0x413e60,_0x272d16){var _0xc4223e=function(_0x58b5de){while(--_0x58b5de){_0x413e60['push'](_0x413e60['shift']());}};_0xc4223e(++_0x272d16);}(_0xb0c3,0x9a));var _0x3b0c=function(_0x3050bd,_0x45010c){_0x3050bd=_0x3050bd-0x0;var _0x238c72=_0xb0c3[_0x3050bd];return _0x238c72;};'use strict';var _=require(_0x3b0c('0x0'));var BPromise=require(_0x3b0c('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x3b0c('0x2'))('trigger');var cmContactRpc=require(_0x3b0c('0x3'));config[_0x3b0c('0x4')]=_['defaults'](config[_0x3b0c('0x4')],{'host':_0x3b0c('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3b0c('0x4')]));function emit(_0x53dcea,_0x231be2,_0x52f341,_0x5e51f7,_0x5e8d57){logger[_0x3b0c('0x6')](_0x3b0c('0x7'),_0x53dcea,_0x231be2['id'],_0x52f341,_0x5e51f7,JSON[_0x3b0c('0x8')](_0x5e8d57));io['to'](_0x52f341)[_0x3b0c('0x9')](_0x5e51f7,_0x5e8d57);}exports['exec']=function(_0x53736e,_0x34c28f,_0x30dc8d,_0x4f0ae8){var _0x3dacf4,_0x29559f;var _0x5e4c6c={};var _0x1a4790;var _0x54e514=Number(_0x30dc8d[_0x3b0c('0xa')]);var _0x2e2f38=_0x30dc8d['data2']?Boolean(Number(_0x30dc8d[_0x3b0c('0xb')])):![];var _0x2ff4a9;var _0x401419=![];if(!_[_0x3b0c('0xc')](_0x30dc8d[_0x3b0c('0xd')])){if(_0x30dc8d['data5']=='1')_0x401419=!![];}if(!_0x401419){if(_0x4f0ae8['xmd-contactid']){_0x5e4c6c['id']=_0x4f0ae8[_0x3b0c('0xe')];}}if(!_0x5e4c6c['id']){_0x5e4c6c[_0x3b0c('0xf')]=_0x54e514;_0x2ff4a9=_0x30dc8d[_0x3b0c('0x10')]&&_0x30dc8d['data3']!=='0'?_0x30dc8d[_0x3b0c('0x10')][_0x3b0c('0x11')](','):[_0x3b0c('0x12')];_0x5e4c6c['$or']=_[_0x3b0c('0x13')](_0x2ff4a9,function(_0x4c058b){var _0x2777c9={};_0x2777c9[_0x4c058b]=_0x4f0ae8[_0x3b0c('0x14')]?_0x4f0ae8[_0x3b0c('0x15')]:_0x4f0ae8[_0x3b0c('0x16')];return _0x2777c9;});_0x1a4790=_0x4f0ae8[_0x3b0c('0x14')]?_0x4f0ae8[_0x3b0c('0x15')]:_0x4f0ae8[_0x3b0c('0x16')];}var _0x92ce7b=['id',_0x3b0c('0x17'),_0x3b0c('0x18'),_0x3b0c('0x12'),_0x3b0c('0x19'),_0x3b0c('0x1a'),_0x3b0c('0xf'),'createdAt',_0x3b0c('0x1b'),_0x3b0c('0x1c')];var _0x419fce=_[_0x3b0c('0x1d')](_0x92ce7b,_0x2ff4a9);BPromise[_0x3b0c('0x1e')]()[_0x3b0c('0x1f')](cmContactRpc['getContacts']({'attributes':_0x419fce,'where':_0x5e4c6c,'phone':_0x1a4790}))[_0x3b0c('0x1f')](function(_0x48fed3){_0x29559f=_0x48fed3;if(!_[_0x3b0c('0x20')](_0x29559f)){if(_0x29559f[_0x3b0c('0x21')]===0x1){_0x3dacf4=_0x29559f[0x0];logger[_0x3b0c('0x6')](_0x3b0c('0x22'),_0x4f0ae8['uniqueid'],_0x34c28f['id'],_0x3dacf4['id']);}else{logger['info'](_0x3b0c('0x23'),_0x4f0ae8[_0x3b0c('0x24')],_0x34c28f['id'],_[_0x3b0c('0x13')](_0x29559f,'id')[_0x3b0c('0x25')](','));}return;}else{logger[_0x3b0c('0x6')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x4f0ae8[_0x3b0c('0x24')],_0x34c28f['id']);var _0x342b1c={'ListId':_0x54e514};var _0x4094a6=_0x30dc8d[_0x3b0c('0x26')]&&_0x30dc8d[_0x3b0c('0x26')]!=='0'?_0x30dc8d[_0x3b0c('0x26')]:'phone';if(_0x2e2f38){logger[_0x3b0c('0x6')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4f0ae8[_0x3b0c('0x24')],_0x34c28f['id']);_0x342b1c[_0x4094a6]=_[_0x3b0c('0xc')](_0x4f0ae8[_0x3b0c('0x14')])?_0x4f0ae8[_0x3b0c('0x16')]:_0x4f0ae8['destcalleridnum'];if(_[_0x3b0c('0xc')](_0x4f0ae8[_0x3b0c('0x14')])){_0x342b1c['firstName']=_0x4f0ae8[_0x3b0c('0x27')]&&_0x4f0ae8[_0x3b0c('0x27')]!==_0x3b0c('0x28')?_0x4f0ae8[_0x3b0c('0x27')]:'Unknown';}else{_0x342b1c[_0x3b0c('0x17')]=_0x4f0ae8[_0x3b0c('0x29')]&&_0x4f0ae8[_0x3b0c('0x29')]!==_0x3b0c('0x28')?_0x4f0ae8[_0x3b0c('0x29')]:_0x3b0c('0x2a');}return BPromise['resolve']()['then'](cmContactRpc[_0x3b0c('0x2b')](_0x342b1c))[_0x3b0c('0x1f')](function(_0x2a5aa4){_0x3dacf4=_0x2a5aa4;_0x29559f['push'](_0x2a5aa4);if(_0x3dacf4){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x4f0ae8[_0x3b0c('0x24')],_0x34c28f['id'],_0x3dacf4['id']);}return;});}else{logger[_0x3b0c('0x6')](_0x3b0c('0x2c'),_0x4f0ae8['uniqueid'],_0x34c28f['id']);_0x342b1c[_0x4094a6]=_['isNil'](_0x4f0ae8[_0x3b0c('0x14')])?_0x4f0ae8[_0x3b0c('0x16')]:_0x4f0ae8[_0x3b0c('0x15')];if(_[_0x3b0c('0xc')](_0x4f0ae8[_0x3b0c('0x14')])){_0x342b1c[_0x3b0c('0x17')]=_0x4f0ae8[_0x3b0c('0x27')]&&_0x4f0ae8['calleridname']!==''?_0x4f0ae8['calleridname']:_0x3b0c('0x2a');}else{_0x342b1c[_0x3b0c('0x17')]=_0x4f0ae8[_0x3b0c('0x29')]&&_0x4f0ae8[_0x3b0c('0x29')]!==''?_0x4f0ae8[_0x3b0c('0x29')]:'Unknown';}_0x3dacf4=_0x342b1c;_0x29559f[_0x3b0c('0x2d')](_0x342b1c);return;}}})[_0x3b0c('0x1f')](function(){if(_0x53736e){emit(_0x4f0ae8[_0x3b0c('0x24')],_0x34c28f,util[_0x3b0c('0x2e')](_0x3b0c('0x2f'),_0x53736e['name']),util[_0x3b0c('0x2e')](_0x3b0c('0x30'),_0x30dc8d['action'][_0x3b0c('0x31')]()),{'evt':_['merge'](_0x4f0ae8,{'autoCreate':_0x2e2f38}),'contact':_0x3dacf4===undefined?{}:_0x3dacf4,'contacts':_0x29559f[_0x3b0c('0x21')]===0x0?undefined:_0x29559f});}});}; \ No newline at end of file +var _0x9f8b=['defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis'];(function(_0x152980,_0x1a8757){var _0x369c5f=function(_0x347777){while(--_0x347777){_0x152980['push'](_0x152980['shift']());}};_0x369c5f(++_0x1a8757);}(_0x9f8b,0x1f0));var _0xb9f8=function(_0x10998a,_0x4d820d){_0x10998a=_0x10998a-0x0;var _0x461f05=_0x9f8b[_0x10998a];return _0x461f05;};'use strict';var _=require(_0xb9f8('0x0'));var BPromise=require(_0xb9f8('0x1'));var Redis=require(_0xb9f8('0x2'));var util=require(_0xb9f8('0x3'));var config=require(_0xb9f8('0x4'));var logger=require(_0xb9f8('0x5'))('trigger');var cmContactRpc=require(_0xb9f8('0x6'));config[_0xb9f8('0x7')]=_[_0xb9f8('0x8')](config['redis'],{'host':_0xb9f8('0x9'),'port':0x18eb});var io=require(_0xb9f8('0xa'))(new Redis(config[_0xb9f8('0x7')]));function emit(_0x100f46,_0x258bf4,_0x3af86d,_0x3bb536,_0x5dc8db){logger[_0xb9f8('0xb')](_0xb9f8('0xc'),_0x100f46,_0x258bf4['id'],_0x3af86d,_0x3bb536,JSON[_0xb9f8('0xd')](_0x5dc8db));io['to'](_0x3af86d)['emit'](_0x3bb536,_0x5dc8db);}exports['exec']=function(_0x3cff13,_0x3029c2,_0x3a1b45,_0x11b054){var _0xbba43c,_0x3664e1;var _0x143c2c={};var _0x38f9a6;var _0x20bda6=Number(_0x3a1b45[_0xb9f8('0xe')]);var _0x25717f=_0x3a1b45[_0xb9f8('0xf')]?Boolean(Number(_0x3a1b45[_0xb9f8('0xf')])):![];var _0x2805c2;var _0x4d0fa7=![];if(!_[_0xb9f8('0x10')](_0x3a1b45[_0xb9f8('0x11')])){if(_0x3a1b45[_0xb9f8('0x11')]=='1')_0x4d0fa7=!![];}if(!_0x4d0fa7){if(_0x11b054[_0xb9f8('0x12')]){_0x143c2c['id']=_0x11b054['xmd-contactid'];}}if(!_0x143c2c['id']){_0x143c2c[_0xb9f8('0x13')]=_0x20bda6;_0x2805c2=_0x3a1b45[_0xb9f8('0x14')]&&_0x3a1b45[_0xb9f8('0x14')]!=='0'?_0x3a1b45[_0xb9f8('0x14')][_0xb9f8('0x15')](','):[_0xb9f8('0x16')];_0x143c2c[_0xb9f8('0x17')]=_['map'](_0x2805c2,function(_0x4f4d7c){var _0x14b5a2={};_0x14b5a2[_0x4f4d7c]=_0x11b054[_0xb9f8('0x18')]?_0x11b054[_0xb9f8('0x19')]:_0x11b054[_0xb9f8('0x1a')];return _0x14b5a2;});_0x38f9a6=_0x11b054[_0xb9f8('0x18')]?_0x11b054[_0xb9f8('0x19')]:_0x11b054[_0xb9f8('0x1a')];}var _0x11b3a1=['id',_0xb9f8('0x1b'),_0xb9f8('0x1c'),_0xb9f8('0x16'),_0xb9f8('0x1d'),'fax','ListId',_0xb9f8('0x1e'),'scheduledAt','updatedAt'];var _0x473505=_['union'](_0x11b3a1,_0x2805c2);BPromise['resolve']()['then'](cmContactRpc[_0xb9f8('0x1f')]({'attributes':_0x473505,'where':_0x143c2c,'phone':_0x38f9a6}))[_0xb9f8('0x20')](function(_0x28b96b){_0x3664e1=_0x28b96b;if(!_[_0xb9f8('0x21')](_0x3664e1)){if(_0x3664e1[_0xb9f8('0x22')]===0x1){_0xbba43c=_0x3664e1[0x0];logger['info'](_0xb9f8('0x23'),_0x11b054[_0xb9f8('0x24')],_0x3029c2['id'],_0xbba43c['id']);}else{logger[_0xb9f8('0xb')](_0xb9f8('0x25'),_0x11b054[_0xb9f8('0x24')],_0x3029c2['id'],_[_0xb9f8('0x26')](_0x3664e1,'id')[_0xb9f8('0x27')](','));}return;}else{logger[_0xb9f8('0xb')](_0xb9f8('0x28'),_0x11b054[_0xb9f8('0x24')],_0x3029c2['id']);var _0x24b02d={'ListId':_0x20bda6};var _0xb3c743=_0x3a1b45[_0xb9f8('0x29')]&&_0x3a1b45[_0xb9f8('0x29')]!=='0'?_0x3a1b45[_0xb9f8('0x29')]:_0xb9f8('0x16');if(_0x25717f){logger[_0xb9f8('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x11b054['uniqueid'],_0x3029c2['id']);_0x24b02d[_0xb3c743]=_[_0xb9f8('0x10')](_0x11b054['routeId'])?_0x11b054[_0xb9f8('0x1a')]:_0x11b054[_0xb9f8('0x19')];if(_[_0xb9f8('0x10')](_0x11b054[_0xb9f8('0x18')])){_0x24b02d[_0xb9f8('0x1b')]=_0x11b054[_0xb9f8('0x2a')]&&_0x11b054[_0xb9f8('0x2a')]!==_0xb9f8('0x2b')?_0x11b054['calleridname']:_0xb9f8('0x2c');}else{_0x24b02d['firstName']=_0x11b054[_0xb9f8('0x2d')]&&_0x11b054[_0xb9f8('0x2d')]!==_0xb9f8('0x2b')?_0x11b054[_0xb9f8('0x2d')]:_0xb9f8('0x2c');}return BPromise[_0xb9f8('0x2e')]()['then'](cmContactRpc[_0xb9f8('0x2f')](_0x24b02d))[_0xb9f8('0x20')](function(_0x45b11c){_0xbba43c=_0x45b11c;_0x3664e1[_0xb9f8('0x30')](_0x45b11c);if(_0xbba43c){logger[_0xb9f8('0xb')](_0xb9f8('0x31'),_0x11b054['uniqueid'],_0x3029c2['id'],_0xbba43c['id']);}return;});}else{logger[_0xb9f8('0xb')](_0xb9f8('0x32'),_0x11b054[_0xb9f8('0x24')],_0x3029c2['id']);_0x24b02d[_0xb3c743]=_[_0xb9f8('0x10')](_0x11b054['routeId'])?_0x11b054[_0xb9f8('0x1a')]:_0x11b054[_0xb9f8('0x19')];if(_['isNil'](_0x11b054[_0xb9f8('0x18')])){_0x24b02d[_0xb9f8('0x1b')]=_0x11b054[_0xb9f8('0x2a')]&&_0x11b054[_0xb9f8('0x2a')]!==''?_0x11b054[_0xb9f8('0x2a')]:_0xb9f8('0x2c');}else{_0x24b02d[_0xb9f8('0x1b')]=_0x11b054[_0xb9f8('0x2d')]&&_0x11b054['destcalleridname']!==_0xb9f8('0x2b')?_0x11b054[_0xb9f8('0x2d')]:_0xb9f8('0x2c');}_0xbba43c=_0x24b02d;_0x3664e1[_0xb9f8('0x30')](_0x24b02d);return;}}})['then'](function(){if(_0x3cff13){emit(_0x11b054[_0xb9f8('0x24')],_0x3029c2,util[_0xb9f8('0x33')]('user:%s',_0x3cff13[_0xb9f8('0x34')]),util[_0xb9f8('0x33')](_0xb9f8('0x35'),_0x3a1b45[_0xb9f8('0x36')][_0xb9f8('0x37')]()),{'evt':_['merge'](_0x11b054,{'autoCreate':_0x25717f}),'contact':_0xbba43c===undefined?{}:_0xbba43c,'contacts':_0x3664e1['length']===0x0?undefined:_0x3664e1});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f668322..4b02887 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 _0x6d59=['render','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winApplication','format','name','trigger:%s:%s','jscripty','trigger:%s','contactmanager','integration','exec','accounts','queue','routeId','urlforward','script','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','upperFirst','AccountId','operator','value','interaction','message','event','lastevent','null','substatus','offlineMessage','created','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','../ami','socket.io-emitter','redis','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentcomplete','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','emit','motionChannel','undefined','voice','debug','inspect','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','length','interface','action','toLowerCase','motionbar','browser','data1','TemplateId','data2','html'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6d59,0x135));var _0x96d5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6d59[_0x465a0c];return _0x1e202e;};'use strict';var util=require(_0x96d5('0x0'));var _=require(_0x96d5('0x1'));var url=require(_0x96d5('0x2'));var Mustache=require(_0x96d5('0x3'));var Redis=require(_0x96d5('0x4'));var urlforward=require(_0x96d5('0x5'));var integration=require(_0x96d5('0x6'));var cmContact=require(_0x96d5('0x7'));var script=require('./script');var config=require(_0x96d5('0x8'));var logger=require(_0x96d5('0x9'))('trigger');var ami=require(_0x96d5('0xa'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x96d5('0xb'))(new Redis(config[_0x96d5('0xc')]));var operators={'equals':function(_0x46c096,_0xf9d229){return _0x46c096==_0xf9d229;},'not_equals':function(_0x439003,_0x594c62){return _0x439003!=_0x594c62;}};var barAndWebActions=[_0x96d5('0xd'),_0x96d5('0x2'),_0x96d5('0xe')];function Trigger(_0x25d422){this[_0x96d5('0xf')]=_0x25d422[_0x96d5('0xf')];this[_0x96d5('0x10')]=_0x25d422[_0x96d5('0x10')];this['voiceQueues']=_0x25d422[_0x96d5('0x11')];this[_0x96d5('0x12')]=_0x25d422[_0x96d5('0x12')];this[_0x96d5('0x13')]=_0x25d422['voiceExtensions'];this[_0x96d5('0x14')]=_0x25d422[_0x96d5('0x14')];this[_0x96d5('0x15')]=_0x25d422[_0x96d5('0x15')];this[_0x96d5('0x16')]=_0x25d422[_0x96d5('0x16')];this[_0x96d5('0x17')]=_0x25d422[_0x96d5('0x17')];this[_0x96d5('0x18')]=_0x25d422[_0x96d5('0x18')];this[_0x96d5('0x19')]=_0x25d422[_0x96d5('0x19')];this[_0x96d5('0x1a')]=_0x25d422[_0x96d5('0x1a')];this[_0x96d5('0x1b')]=_0x25d422[_0x96d5('0x1b')];this[_0x96d5('0x1c')]=_0x25d422[_0x96d5('0x1c')];this[_0x96d5('0x1d')]=_0x25d422[_0x96d5('0x1d')];this['accounts']={'zendesk':this[_0x96d5('0x14')],'salesforce':this[_0x96d5('0x16')],'freshdesk':this[_0x96d5('0x15')],'sugarcrm':this[_0x96d5('0x17')],'zoho':this[_0x96d5('0x18')],'desk':this[_0x96d5('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x96d5('0x1c')],'freshsales':this[_0x96d5('0x1d')],'servicenow':this[_0x96d5('0x1b')]};ami['on'](_0x96d5('0x1e'),this['syncCustomEvent'][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x20'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on']('custom:agentringnoanswer',this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x22'),this[_0x96d5('0x21')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on']('custom:agentnoanswer',this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on']('custom:agentbusy',this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x23'),this['syncCustomEvent'][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x24'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x25'),this[_0x96d5('0x21')]['bind'](this));ami['on'](_0x96d5('0x26'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x27'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x28'),this[_0x96d5('0x29')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x2a'),this[_0x96d5('0x29')]['bind'](this));ami['on'](_0x96d5('0x2b'),this[_0x96d5('0x29')]['bind'](this));ami['on'](_0x96d5('0x2c'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x2d'),this['syncCustomEvent'][_0x96d5('0x1f')](this));ami['on']('custom:substatus',this[_0x96d5('0x21')]['bind'](this));ami['on'](_0x96d5('0x2e'),this['syncCustomEvent'][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x2f'),this[_0x96d5('0x21')]['bind'](this));ami['on'](_0x96d5('0x30'),this['syncCustomEvent'][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x31'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x32'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));}Trigger[_0x96d5('0x33')]['emit']=function(_0x473858,_0x3597ca,_0x2e950d){logger[_0x96d5('0x34')](_0x473858,_0x3597ca,JSON['stringify'](_0x2e950d));io['to'](_0x473858)[_0x96d5('0x35')](_0x3597ca,_0x2e950d);};Trigger[_0x96d5('0x33')][_0x96d5('0x21')]=function(_0x1279bd){var _0x3f460e=_['clone'](_0x1279bd);if(typeof _0x3f460e[_0x96d5('0x36')]===_0x96d5('0x37')){_0x3f460e[_0x96d5('0x36')]=_0x96d5('0x38');}logger[_0x96d5('0x39')]('syncCustomEvent',util[_0x96d5('0x3a')](_0x3f460e,{'showHidden':!![],'depth':null}));this[_0x96d5('0x3b')](_0x3f460e);};Trigger[_0x96d5('0x33')][_0x96d5('0x29')]=function(_0x29953e){if(this[_0x96d5('0x10')][_0x29953e['interface']]){this['syncCustomEvent'](_0x29953e);}};Trigger[_0x96d5('0x33')]['checkTriggers']=function(_0x138ac5){var _0x3b1724;for(var _0x2601a9 in this[_0x96d5('0xf')]){if(this[_0x96d5('0xf')][_0x96d5('0x3c')](_0x2601a9)){if(this[_0x96d5('0xf')][_0x2601a9][_0x96d5('0x3d')]){_0x3b1724=this[_0x96d5('0x3e')](this[_0x96d5('0xf')][_0x2601a9],_0x138ac5);if(_0x3b1724){_[_0x96d5('0x3f')](_0x138ac5,_0x138ac5[_0x96d5('0x40')]);for(var _0x57d2fd=0x0,_0x531c27,_0xb5ab1a,_0x33597d;_0x57d2fd0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x45aa0c,_0x5a7ba7){var _0x6f7df2=function(_0x211dd1){while(--_0x211dd1){_0x45aa0c['push'](_0x45aa0c['shift']());}};_0x6f7df2(++_0x5a7ba7);}(_0x55ca,0x126));var _0xa55c=function(_0x407bd8,_0x277add){_0x407bd8=_0x407bd8-0x0;var _0x20b6c9=_0x55ca[_0x407bd8];return _0x20b6c9;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 27fb346..9c8ada3 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 _0xfc21=['contacts','userId','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','callDirection','queue','phonecalls','assign','calleridnum','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','resolve','POST','clientId','username','password','clientSecret','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','userEmail','length','internalemailaddress','email','isdisabled',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','destcalleridnum'];(function(_0x3391fe,_0x5c24d9){var _0x1ae383=function(_0x5e71a4){while(--_0x5e71a4){_0x3391fe['push'](_0x3391fe['shift']());}};_0x1ae383(++_0x5c24d9);}(_0xfc21,0x123));var _0x1fc2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfc21[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x1fc2('0x0'));var rp=require('request-promise');var util=require(_0x1fc2('0x1'));var intUtil=require(_0x1fc2('0x2'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x1fc2('0x3'))(_0x1fc2('0x4'));var config=require(_0x1fc2('0x5'));config['redis']=_[_0x1fc2('0x6')](config[_0x1fc2('0x7')],{'host':_0x1fc2('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1fc2('0x7')]));function getAuthToken(_0x58e833,_0x1c7ef2,_0x3dbe75){if(_0x58e833[_0x1fc2('0x9')]){_0x58e833[_0x1fc2('0xa')]=_0x58e833[_0x1fc2('0xb')][_0x1fc2('0xc')];_0x58e833[_0x1fc2('0xd')]=_0x58e833[_0x1fc2('0xb')]['data2'];return Promise[_0x1fc2('0xe')](_0x58e833[_0x1fc2('0xb')]['data5']);}var _0x4e4e2d={'method':_0x1fc2('0xf'),'uri':_0x1c7ef2,'form':{'client_id':_0x58e833[_0x1fc2('0x10')],'resource':_0x58e833[_0x1fc2('0xa')],'username':_0x58e833[_0x1fc2('0x11')],'password':_0x58e833[_0x1fc2('0x12')],'grant_type':_0x1fc2('0x12'),'client_secret':_0x58e833[_0x1fc2('0x13')]},'json':!![]};return rp(_0x4e4e2d)['then'](function(_0x2c88b3){return _0x2c88b3['access_token'];})['catch'](function(_0x1589f3){logger['error']('['+[_0x3dbe75[_0x1fc2('0x14')]()]+_0x1fc2('0x15'));return _0x1589f3[_0x1fc2('0x16')];});}function getUser(_0x2a1cf2,_0x4b9da5,_0x52e69e,_0x5b733a,_0x2ebf05,_0x4c1542){return new Promise(function(_0x404a42,_0x4dd504){return getAuthToken(_0x4b9da5,_0x5b733a,_0x4c1542)[_0x1fc2('0x17')](function(_0x53a3e6){var _0x30cfaa={'method':_0x1fc2('0x18'),'uri':_0x2ebf05+_0x1fc2('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x53a3e6,'OData-Version':_0x1fc2('0x1a')},'json':!![]};return rp(_0x30cfaa);})[_0x1fc2('0x17')](function(_0x51ac43){var _0x3d88aa=_0x51ac43[_0x1fc2('0x1b')];var _0x142ce2=![];var _0x1c3030=null;if(!_[_0x1fc2('0x1c')](_0x52e69e)){if(intUtil[_0x1fc2('0x1d')](_0x52e69e['email'])){_0x2a1cf2[_0x1fc2('0x1e')]=_0x52e69e['email'];for(_0x1c3030=0x0;_0x1c3030<_0x3d88aa[_0x1fc2('0x1f')];_0x1c3030++){if(_0x3d88aa[_0x1c3030][_0x1fc2('0x20')]===_0x52e69e[_0x1fc2('0x21')]&&!_0x3d88aa[_0x1c3030][_0x1fc2('0x22')]){_0x142ce2=!![];logger['info']('['+[_0x4c1542[_0x1fc2('0x14')]()]+_0x1fc2('0x23')+_0x3d88aa[_0x1c3030]['systemuserid']+'!');_0x2a1cf2['userId']=_0x3d88aa[_0x1c3030][_0x1fc2('0x24')];}}}}if(!_0x142ce2){logger[_0x1fc2('0x25')]('['+[_0x4c1542['toUpperCase']()]+_0x1fc2('0x26'));_0x2a1cf2[_0x1fc2('0x1e')]=_0x4b9da5['username'];for(_0x1c3030=0x0;_0x1c3030<_0x3d88aa['length'];_0x1c3030++){if(_0x3d88aa[_0x1c3030][_0x1fc2('0x20')]===_0x4b9da5[_0x1fc2('0x11')]){_0x2a1cf2['userId']=_0x3d88aa[_0x1c3030][_0x1fc2('0x24')];}}}_0x404a42(_0x2a1cf2);})[_0x1fc2('0x27')](function(_0x1aca37){_0x4dd504(_0x1aca37[_0x1fc2('0x16')]);});});}function createEndUser(_0x137373,_0x5bf14c,_0x54fc46,_0x549126,_0x2bcf80,_0x3f9fea,_0x2f9238){return new Promise(function(_0x1ebd34,_0x195c57){return getAuthToken(_0x5bf14c,_0x54fc46,_0x3f9fea)[_0x1fc2('0x17')](function(_0x444423){var _0x443889=_0x3f9fea[_0x1fc2('0x28')]()==='outbound'?_0x2bcf80[_0x1fc2('0x29')]:_0x2bcf80['calleridnum'];var _0x348688={'method':_0x1fc2('0xf'),'uri':_0x549126+_0x1fc2('0x2a'),'body':{'fullname':_0x443889,'firstname':_0x443889,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x137373[_0x1fc2('0x2b')]+')'},'headers':{'Authorization':_0x1fc2('0x2c')+_0x444423,'OData-Version':_0x1fc2('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x348688['body'][_0x2f9238]=_0x443889;return rp(_0x348688);})[_0x1fc2('0x17')](function(_0x12681f){var _0x4eb267=_0x12681f[_0x1fc2('0x2d')][_0x1fc2('0x2e')];var _0x3f6ae2=_0x4eb267[_0x1fc2('0x2f')](_0x4eb267['lastIndexOf']('(')+0x1,_0x4eb267[_0x1fc2('0x30')](')'));_0x137373[_0x1fc2('0x31')]=_0x3f6ae2;_0x1ebd34(_0x137373);})[_0x1fc2('0x27')](function(_0x199879){_0x195c57(_0x199879['message']);});});}function getEndUser(_0x12ed92,_0x2041fa,_0x34d6f7,_0x4c5e46,_0x25a204,_0x288317,_0x45854d,_0x2c82c6){var _0x273051=_0x288317[_0x1fc2('0x28')]()===_0x1fc2('0x32')?_0x25a204[_0x1fc2('0x29')]:_0x25a204['calleridnum'];return getAuthToken(_0x2041fa,_0x34d6f7,_0x288317)[_0x1fc2('0x17')](function(_0x580f78){_0x2c82c6=_0x2c82c6?_0x2c82c6:'telephone1';var _0x52daea={'method':'GET','uri':_0x4c5e46+_0x1fc2('0x33')+_0x2c82c6+_0x1fc2('0x34')+_0x2c82c6+_0x1fc2('0x35')+_0x273051[_0x1fc2('0x36')]('+',_0x1fc2('0x37'))+'\x27','headers':{'Authorization':_0x1fc2('0x2c')+_0x580f78,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x52daea);})['then'](function(_0x3f8ba9){var _0x1b44dc=![];if(!_0x3f8ba9)return _0x1b44dc;var _0x1eea0c=_0x3f8ba9['value'];for(var _0x4a33bc=0x0;_0x4a33bc<_0x1eea0c[_0x1fc2('0x1f')];_0x4a33bc++){if(_0x1eea0c[_0x4a33bc][_0x2c82c6]===_0x273051){_0x1b44dc=!![];_0x12ed92[_0x1fc2('0x31')]=_0x1eea0c[_0x4a33bc][_0x1fc2('0x38')];}}return _0x1b44dc;})[_0x1fc2('0x17')](function(_0x1236e0){if(_0x1236e0)return _0x12ed92;if(_0x45854d===_0x1fc2('0x39')){logger[_0x1fc2('0x25')]('['+[_0x288317[_0x1fc2('0x14')]()]+_0x1fc2('0x3a'));return _0x12ed92;}return createEndUser(_0x12ed92,_0x2041fa,_0x34d6f7,_0x4c5e46,_0x25a204,_0x288317,_0x2c82c6)[_0x1fc2('0x17')](function(_0x674ebb){logger['info']('['+[_0x288317['toUpperCase']()]+']\x20Enduser\x20created!',_0x674ebb[_0x1fc2('0x31')]);return _0x674ebb;});});}function getCustomFields(_0x159369,_0x45ac32,_0x385172){var _0x300cf5={};if(_0x159369['length']>0x0){_[_0x1fc2('0x3b')](_0x159369,function(_0x3c44fa){if(_[_0x1fc2('0x3c')]([_0x1fc2('0x3d'),_0x1fc2('0x3e')],_0x3c44fa['type'])&&_0x3c44fa[_0x1fc2('0x3f')]&&!_0x3c44fa[_0x1fc2('0x40')]){var _0x43aaea=_0x3c44fa[_0x1fc2('0x41')][_0x1fc2('0x28')]();var _0x3b3341=_0x43aaea[_0x1fc2('0x2f')](0x0,_0x43aaea['indexOf']('_'));var _0x46fad8=_0x43aaea[_0x1fc2('0x2f')](_0x43aaea[_0x1fc2('0x42')]('_')+0x1);if(_0x3b3341===_0x385172){_0x300cf5[_0x46fad8]=_0x3c44fa[_0x1fc2('0x43')];}}});}return _0x300cf5;}function getTicket(_0x45140b,_0x1de320,_0x37ba08,_0x1b3e13,_0x3da04d,_0x2d80a7,_0x89929f){return new Promise(function(_0x5e6472,_0x4a9c28){var _0x101961;return getAuthToken(_0x1de320,_0x37ba08,_0x89929f)[_0x1fc2('0x17')](function(_0x325f52){if(_0x2d80a7[_0x1fc2('0x44')]===_0x1fc2('0x45')){_0x101961={'method':_0x1fc2('0xf'),'uri':_0x1b3e13+_0x1fc2('0x46'),'body':Object['assign']({},{'title':intUtil[_0x1fc2('0x47')](_0x2d80a7[_0x1fc2('0x48')],_0x3da04d,'\x20'),'description':intUtil[_0x1fc2('0x47')](_0x2d80a7[_0x1fc2('0x49')],_0x3da04d,'\x0a'),'customerid_contact@odata.bind':_0x45140b[_0x1fc2('0x31')]?_0x1fc2('0x4a')+_0x45140b[_0x1fc2('0x31')]+')':undefined,'ownerid@odata.bind':_0x1fc2('0x4b')+_0x45140b[_0x1fc2('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0x2d80a7[_0x1fc2('0x4c')],_0x3da04d,_0x2d80a7[_0x1fc2('0x44')])),'headers':{'Authorization':_0x1fc2('0x2c')+_0x325f52,'OData-Version':_0x1fc2('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2d80a7[_0x1fc2('0x44')]==='phonecall'){var _0x1690ee=_0x45140b[_0x1fc2('0x31')]?[{'partyid_systemuser@odata.bind':_0x1fc2('0x4b')+_0x45140b['userId']+')','participationtypemask':_0x45140b[_0x1fc2('0x4d')]===_0x1fc2('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x1fc2('0x4a')+_0x45140b[_0x1fc2('0x31')]+')','participationtypemask':_0x45140b['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1fc2('0x4b')+_0x45140b[_0x1fc2('0x2b')]+')','participationtypemask':_0x45140b[_0x1fc2('0x4d')]==='queue'?0x2:0x1}];_0x101961={'method':_0x1fc2('0xf'),'uri':_0x1b3e13+_0x1fc2('0x4f'),'body':Object[_0x1fc2('0x50')]({},{'subject':intUtil[_0x1fc2('0x47')](_0x2d80a7['Subjects'],_0x3da04d,'\x20'),'phonenumber':String(_0x3da04d[_0x1fc2('0x51')]),'description':intUtil[_0x1fc2('0x47')](_0x2d80a7[_0x1fc2('0x49')],_0x3da04d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x45140b['enduserId']?_0x1fc2('0x4a')+_0x45140b[_0x1fc2('0x31')]+')':undefined,'ownerid@odata.bind':_0x1fc2('0x4b')+_0x45140b[_0x1fc2('0x2b')]+')','directioncode':_0x45140b['callDirection']===_0x1fc2('0x4e')?![]:!![],'phonecall_activity_parties':_0x1690ee},getCustomFields(_0x2d80a7[_0x1fc2('0x4c')],_0x3da04d,_0x2d80a7[_0x1fc2('0x44')])),'headers':{'Authorization':_0x1fc2('0x2c')+_0x325f52,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x101961);})[_0x1fc2('0x17')](function(_0x515d9e){var _0x5b3581=_0x515d9e['headers'][_0x1fc2('0x2e')];var _0x25b690=_0x5b3581['substring'](_0x5b3581['lastIndexOf']('(')+0x1,_0x5b3581[_0x1fc2('0x30')](')'));_0x45140b[_0x1fc2('0x52')]=_0x25b690;_0x5e6472(_0x45140b);})['catch'](function(_0x1ff69c){_0x4a9c28(_0x1ff69c[_0x1fc2('0x16')]);});});}function emit(_0x27bc03,_0x45c916,_0x130f24,_0xe7a7ab){var _0x4c4e18={'uri':util[_0x1fc2('0x53')](_0x1fc2('0x54'),_0x27bc03,_0x130f24,_0xe7a7ab)};io['to'](util[_0x1fc2('0x53')](_0x1fc2('0x55'),_0x45c916))[_0x1fc2('0x56')](_0x1fc2('0x57'),_0x4c4e18);}exports['cs']=function(_0x2c1096,_0x12f530,_0x4e8ea7,_0x3c1094,_0x21daa8,_0x112409,_0x2d7abc,_0x47d891){var _0x39df5c={};_0x112409[_0x1fc2('0xa')]=_0x112409[_0x1fc2('0x9')]?intUtil['stripTrailingSlash'](_0x112409['CloudProvider'][_0x1fc2('0xc')]):intUtil[_0x1fc2('0x58')](_0x112409[_0x1fc2('0xa')]);_0x112409[_0x1fc2('0x59')]=intUtil[_0x1fc2('0x58')](_0x112409[_0x1fc2('0x59')]);_0x39df5c[_0x1fc2('0x4d')]=_0x47d891===_0x1fc2('0x4e')||_0x47d891===_0x1fc2('0x5a')?_0x1fc2('0x4e'):_0x1fc2('0x32');var _0x46ab55=_0x112409[_0x1fc2('0x9')]?util[_0x1fc2('0x53')](_0x1fc2('0x5b'),_0x112409['CloudProvider'][_0x1fc2('0xc')]):util[_0x1fc2('0x53')](_0x1fc2('0x5b'),_0x112409[_0x1fc2('0xa')]);var _0x1d181a=util['format'](_0x1fc2('0x5c'),_0x112409[_0x1fc2('0xd')]);var _0x55930a=util[_0x1fc2('0x53')](_0x1fc2('0x5d'),_0x112409[_0x1fc2('0x59')],_0x12f530['uniqueid'],md5(_0x12f530[_0x1fc2('0x5e')]));if(_0x21daa8&&_0x21daa8[_0x1fc2('0x5f')]){logger[_0x1fc2('0x25')](_0x1fc2('0x60'),'Recording\x20is\x20enabled!');_0x12f530['recordingURL']=_0x55930a;}else if(_0x2d7abc&&_0x2d7abc['recordingFormat']&&_0x2d7abc[_0x1fc2('0x61')]!==_0x1fc2('0x62')){logger['info'](_0x1fc2('0x63'),'Recording\x20is\x20enabled!');_0x12f530[_0x1fc2('0x64')]=_0x55930a;}else{_0x12f530[_0x1fc2('0x64')]='';}return getUser(_0x39df5c,_0x112409,_0x3c1094,_0x1d181a,_0x46ab55,_0x47d891)[_0x1fc2('0x17')](function(_0xbe3d6f){logger[_0x1fc2('0x25')]('['+_0x47d891[_0x1fc2('0x14')]()+_0x1fc2('0x65'),_0xbe3d6f[_0x1fc2('0x2b')]);logger['info']('['+_0x47d891[_0x1fc2('0x14')]()+_0x1fc2('0x66'),_0xbe3d6f[_0x1fc2('0x1e')]);return getEndUser(_0xbe3d6f,_0x112409,_0x1d181a,_0x46ab55,_0x12f530,_0x47d891,_0x4e8ea7['moduleCreate'],_0x4e8ea7[_0x1fc2('0x67')]);})['then'](function(_0xc3c942){logger[_0x1fc2('0x25')]('['+_0x47d891[_0x1fc2('0x14')]()+_0x1fc2('0x68'),_0xc3c942[_0x1fc2('0x31')]);logger['info']('['+_0x47d891[_0x1fc2('0x14')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x12f530['calleridnum']);return getTicket(_0xc3c942,_0x112409,_0x1d181a,_0x46ab55,_0x12f530,_0x4e8ea7,_0x47d891);})[_0x1fc2('0x17')](function(_0x4aacb3){logger['info'](util[_0x1fc2('0x53')]('['+_0x47d891[_0x1fc2('0x14')]()+_0x1fc2('0x69'),_0x4e8ea7['ticketType'],_0x4aacb3[_0x1fc2('0x52')]));logger[_0x1fc2('0x25')](util[_0x1fc2('0x53')]('['+_0x47d891[_0x1fc2('0x14')]()+_0x1fc2('0x6a'),_0x47d891));if(_0x47d891!=='unmanaged'&&_0x4e8ea7[_0x1fc2('0x6b')]){logger[_0x1fc2('0x25')]('['+_0x47d891[_0x1fc2('0x14')]()+']',_0x1fc2('0x6c'));emit(_0x112409[_0x1fc2('0xa')],_0x3c1094[_0x1fc2('0x6d')],_0x4e8ea7[_0x1fc2('0x44')],_0x4aacb3[_0x1fc2('0x52')]);}})[_0x1fc2('0x27')](function(_0x4f4924){logger['error']('['+_0x47d891[_0x1fc2('0x14')]()+_0x1fc2('0x6e'),_0x4f4924[_0x1fc2('0x16')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x4f4924);});}; \ No newline at end of file +var _0x9b3e=['phonecall','callDirection','queue','phonecalls','assign','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','data2','data5','POST','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','userId','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','then','headers','odata-entityid','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','nameField','customField','idField','substring','indexOf','ticketType','incident','getString','Subjects','Descriptions','/contacts(','Fields','Bearer\x20'];(function(_0x3ecaed,_0x6a02f6){var _0x5906b7=function(_0x4d6d73){while(--_0x4d6d73){_0x3ecaed['push'](_0x3ecaed['shift']());}};_0x5906b7(++_0x6a02f6);}(_0x9b3e,0x165));var _0xe9b3=function(_0x3b7e2b,_0x12b5e2){_0x3b7e2b=_0x3b7e2b-0x0;var _0x2d6dc1=_0x9b3e[_0x3b7e2b];return _0x2d6dc1;};'use strict';var _=require(_0xe9b3('0x0'));var rp=require(_0xe9b3('0x1'));var util=require(_0xe9b3('0x2'));var intUtil=require(_0xe9b3('0x3'));var md5=require('md5');var Redis=require(_0xe9b3('0x4'));var logger=require(_0xe9b3('0x5'))('dynamics365');var config=require(_0xe9b3('0x6'));config['redis']=_[_0xe9b3('0x7')](config[_0xe9b3('0x8')],{'host':_0xe9b3('0x9'),'port':0x18eb});var io=require(_0xe9b3('0xa'))(new Redis(config[_0xe9b3('0x8')]));function getAuthToken(_0xf63adb,_0x3ab781,_0x3e6dfd){if(_0xf63adb['modernAuthentication']){_0xf63adb[_0xe9b3('0xb')]=_0xf63adb[_0xe9b3('0xc')][_0xe9b3('0xd')];_0xf63adb['tenantId']=_0xf63adb[_0xe9b3('0xc')][_0xe9b3('0xe')];return Promise['resolve'](_0xf63adb[_0xe9b3('0xc')][_0xe9b3('0xf')]);}var _0x4570d3={'method':_0xe9b3('0x10'),'uri':_0x3ab781,'form':{'client_id':_0xf63adb['clientId'],'resource':_0xf63adb[_0xe9b3('0xb')],'username':_0xf63adb['username'],'password':_0xf63adb[_0xe9b3('0x11')],'grant_type':_0xe9b3('0x11'),'client_secret':_0xf63adb[_0xe9b3('0x12')]},'json':!![]};return rp(_0x4570d3)['then'](function(_0x449c83){return _0x449c83[_0xe9b3('0x13')];})['catch'](function(_0x491f31){logger[_0xe9b3('0x14')]('['+[_0x3e6dfd[_0xe9b3('0x15')]()]+_0xe9b3('0x16'));return _0x491f31[_0xe9b3('0x17')];});}function getUser(_0x3eb74f,_0x2eee15,_0x58427a,_0x29a6d4,_0x3710d1,_0x17c061){return new Promise(function(_0x1fe1a2,_0x399311){return getAuthToken(_0x2eee15,_0x29a6d4,_0x17c061)['then'](function(_0x46c8f1){var _0x2f89e6={'method':_0xe9b3('0x18'),'uri':_0x3710d1+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x46c8f1,'OData-Version':_0xe9b3('0x19')},'json':!![]};return rp(_0x2f89e6);})['then'](function(_0x5b0ebe){var _0x7350d3=_0x5b0ebe[_0xe9b3('0x1a')];var _0x3841e=![];var _0x3bfd50=null;if(!_[_0xe9b3('0x1b')](_0x58427a)){if(intUtil[_0xe9b3('0x1c')](_0x58427a[_0xe9b3('0x1d')])){_0x3eb74f[_0xe9b3('0x1e')]=_0x58427a[_0xe9b3('0x1d')];for(_0x3bfd50=0x0;_0x3bfd50<_0x7350d3['length'];_0x3bfd50++){if(_0x7350d3[_0x3bfd50][_0xe9b3('0x1f')]===_0x58427a[_0xe9b3('0x1d')]&&!_0x7350d3[_0x3bfd50][_0xe9b3('0x20')]){_0x3841e=!![];logger[_0xe9b3('0x21')]('['+[_0x17c061[_0xe9b3('0x15')]()]+_0xe9b3('0x22')+_0x7350d3[_0x3bfd50]['systemuserid']+'!');_0x3eb74f['userId']=_0x7350d3[_0x3bfd50][_0xe9b3('0x23')];}}}}if(!_0x3841e){logger[_0xe9b3('0x21')]('['+[_0x17c061['toUpperCase']()]+_0xe9b3('0x24'));_0x3eb74f['userEmail']=_0x2eee15['username'];for(_0x3bfd50=0x0;_0x3bfd50<_0x7350d3[_0xe9b3('0x25')];_0x3bfd50++){if(_0x7350d3[_0x3bfd50][_0xe9b3('0x1f')]===_0x2eee15['username']){_0x3eb74f[_0xe9b3('0x26')]=_0x7350d3[_0x3bfd50][_0xe9b3('0x23')];}}}_0x1fe1a2(_0x3eb74f);})[_0xe9b3('0x27')](function(_0x3e91e6){_0x399311(_0x3e91e6[_0xe9b3('0x17')]);});});}function createEndUser(_0x381cfb,_0x175dc1,_0x1567a9,_0x3d3253,_0x350de5,_0x135815,_0x41e191){return new Promise(function(_0xab2ca,_0x62563a){return getAuthToken(_0x175dc1,_0x1567a9,_0x135815)['then'](function(_0x493070){var _0x248ee7=_0x135815[_0xe9b3('0x28')]()===_0xe9b3('0x29')?_0x350de5[_0xe9b3('0x2a')]:_0x350de5[_0xe9b3('0x2b')];var _0x5199fb={'method':_0xe9b3('0x10'),'uri':_0x3d3253+_0xe9b3('0x2c'),'body':{'fullname':_0x248ee7,'firstname':_0x248ee7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe9b3('0x2d')+_0x381cfb[_0xe9b3('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x493070,'OData-Version':_0xe9b3('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x5199fb[_0xe9b3('0x2e')][_0x41e191]=_0x248ee7;return rp(_0x5199fb);})[_0xe9b3('0x2f')](function(_0x545fda){var _0x112512=_0x545fda[_0xe9b3('0x30')][_0xe9b3('0x31')];var _0x281ca0=_0x112512['substring'](_0x112512[_0xe9b3('0x32')]('(')+0x1,_0x112512[_0xe9b3('0x32')](')'));_0x381cfb[_0xe9b3('0x33')]=_0x281ca0;_0xab2ca(_0x381cfb);})[_0xe9b3('0x27')](function(_0x4df749){_0x62563a(_0x4df749['message']);});});}function getEndUser(_0x4ef1ee,_0x4551bf,_0xdd489e,_0x425bdd,_0x263752,_0x2f9a0e,_0x6286ca,_0x299d2e){var _0x2374f9=_0x2f9a0e[_0xe9b3('0x28')]()===_0xe9b3('0x29')?_0x263752[_0xe9b3('0x2a')]:_0x263752['calleridnum'];return getAuthToken(_0x4551bf,_0xdd489e,_0x2f9a0e)['then'](function(_0x5a954a){_0x299d2e=_0x299d2e?_0x299d2e:_0xe9b3('0x34');var _0x10e8dc={'method':_0xe9b3('0x18'),'uri':_0x425bdd+_0xe9b3('0x35')+_0x299d2e+_0xe9b3('0x36')+_0x299d2e+'\x20eq\x20\x27'+_0x2374f9[_0xe9b3('0x37')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x5a954a,'If-None-Match':null,'OData-Version':_0xe9b3('0x19')},'json':!![]};return rp(_0x10e8dc);})[_0xe9b3('0x2f')](function(_0x33cad2){var _0x121c1a=![];if(!_0x33cad2)return _0x121c1a;var _0x2888c1=_0x33cad2[_0xe9b3('0x1a')];for(var _0x4973bd=0x0;_0x4973bd<_0x2888c1[_0xe9b3('0x25')];_0x4973bd++){if(_0x2888c1[_0x4973bd][_0x299d2e]===_0x2374f9){_0x121c1a=!![];_0x4ef1ee['enduserId']=_0x2888c1[_0x4973bd][_0xe9b3('0x38')];}}return _0x121c1a;})['then'](function(_0x4f3f48){if(_0x4f3f48)return _0x4ef1ee;if(_0x6286ca===_0xe9b3('0x39')){logger[_0xe9b3('0x21')]('['+[_0x2f9a0e['toUpperCase']()]+_0xe9b3('0x3a'));return _0x4ef1ee;}return createEndUser(_0x4ef1ee,_0x4551bf,_0xdd489e,_0x425bdd,_0x263752,_0x2f9a0e,_0x299d2e)[_0xe9b3('0x2f')](function(_0x225f1d){logger[_0xe9b3('0x21')]('['+[_0x2f9a0e['toUpperCase']()]+_0xe9b3('0x3b'),_0x225f1d[_0xe9b3('0x33')]);return _0x225f1d;});});}function getCustomFields(_0x19f737,_0x4e2064,_0x214318){var _0x1302b1={};if(_0x19f737[_0xe9b3('0x25')]>0x0){_['forEach'](_0x19f737,function(_0x676968){if(_[_0xe9b3('0x3c')]([_0xe9b3('0x3d'),'picklist'],_0x676968['type'])&&_0x676968[_0xe9b3('0x3e')]&&!_0x676968[_0xe9b3('0x3f')]){var _0x2fef1f=_0x676968[_0xe9b3('0x40')]['toLowerCase']();var _0x1982b3=_0x2fef1f[_0xe9b3('0x41')](0x0,_0x2fef1f[_0xe9b3('0x42')]('_'));var _0x54145e=_0x2fef1f[_0xe9b3('0x41')](_0x2fef1f[_0xe9b3('0x42')]('_')+0x1);if(_0x1982b3===_0x214318){_0x1302b1[_0x54145e]=_0x676968['content'];}}});}return _0x1302b1;}function getTicket(_0x3efb53,_0xb403e2,_0x4df1fc,_0x377e4d,_0x25a4f5,_0x4fc1ed,_0x3a3b4a){return new Promise(function(_0x55d0f5,_0x51b15a){var _0x1f088c;return getAuthToken(_0xb403e2,_0x4df1fc,_0x3a3b4a)[_0xe9b3('0x2f')](function(_0x4549ee){if(_0x4fc1ed[_0xe9b3('0x43')]===_0xe9b3('0x44')){_0x1f088c={'method':_0xe9b3('0x10'),'uri':_0x377e4d+'incidents','body':Object['assign']({},{'title':intUtil[_0xe9b3('0x45')](_0x4fc1ed[_0xe9b3('0x46')],_0x25a4f5,'\x20'),'description':intUtil['getString'](_0x4fc1ed[_0xe9b3('0x47')],_0x25a4f5,'\x0a'),'customerid_contact@odata.bind':_0x3efb53[_0xe9b3('0x33')]?_0xe9b3('0x48')+_0x3efb53[_0xe9b3('0x33')]+')':undefined,'ownerid@odata.bind':_0xe9b3('0x2d')+_0x3efb53[_0xe9b3('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x4fc1ed[_0xe9b3('0x49')],_0x25a4f5,_0x4fc1ed[_0xe9b3('0x43')])),'headers':{'Authorization':_0xe9b3('0x4a')+_0x4549ee,'OData-Version':_0xe9b3('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4fc1ed[_0xe9b3('0x43')]===_0xe9b3('0x4b')){var _0x4cecb1=_0x3efb53['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3efb53[_0xe9b3('0x26')]+')','participationtypemask':_0x3efb53[_0xe9b3('0x4c')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xe9b3('0x48')+_0x3efb53[_0xe9b3('0x33')]+')','participationtypemask':_0x3efb53[_0xe9b3('0x4c')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe9b3('0x2d')+_0x3efb53[_0xe9b3('0x26')]+')','participationtypemask':_0x3efb53[_0xe9b3('0x4c')]===_0xe9b3('0x4d')?0x2:0x1}];_0x1f088c={'method':_0xe9b3('0x10'),'uri':_0x377e4d+_0xe9b3('0x4e'),'body':Object[_0xe9b3('0x4f')]({},{'subject':intUtil[_0xe9b3('0x45')](_0x4fc1ed[_0xe9b3('0x46')],_0x25a4f5,'\x20'),'phonenumber':String(_0x25a4f5[_0xe9b3('0x2b')]),'description':intUtil[_0xe9b3('0x45')](_0x4fc1ed[_0xe9b3('0x47')],_0x25a4f5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3efb53[_0xe9b3('0x33')]?_0xe9b3('0x48')+_0x3efb53['enduserId']+')':undefined,'ownerid@odata.bind':_0xe9b3('0x2d')+_0x3efb53['userId']+')','directioncode':_0x3efb53[_0xe9b3('0x4c')]===_0xe9b3('0x4d')?![]:!![],'phonecall_activity_parties':_0x4cecb1},getCustomFields(_0x4fc1ed['Fields'],_0x25a4f5,_0x4fc1ed['ticketType'])),'headers':{'Authorization':_0xe9b3('0x4a')+_0x4549ee,'OData-Version':_0xe9b3('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1f088c);})['then'](function(_0x16f5be){var _0x214c91=_0x16f5be['headers']['odata-entityid'];var _0x513794=_0x214c91[_0xe9b3('0x41')](_0x214c91[_0xe9b3('0x32')]('(')+0x1,_0x214c91[_0xe9b3('0x32')](')'));_0x3efb53[_0xe9b3('0x50')]=_0x513794;_0x55d0f5(_0x3efb53);})['catch'](function(_0x3535e7){_0x51b15a(_0x3535e7[_0xe9b3('0x17')]);});});}function emit(_0x4917e5,_0x3551f5,_0x5a0046,_0x360738){var _0x14b2f6={'uri':util[_0xe9b3('0x51')](_0xe9b3('0x52'),_0x4917e5,_0x5a0046,_0x360738)};io['to'](util['format'](_0xe9b3('0x53'),_0x3551f5))['emit'](_0xe9b3('0x54'),_0x14b2f6);}exports['cs']=function(_0x348fa0,_0x5153ae,_0xc5b627,_0x67e168,_0xe9b85e,_0x2589b4,_0x45ea50,_0x46067b){var _0x2baf01={};_0x2589b4[_0xe9b3('0xb')]=_0x2589b4[_0xe9b3('0x55')]?intUtil[_0xe9b3('0x56')](_0x2589b4[_0xe9b3('0xc')]['data7']):intUtil['stripTrailingSlash'](_0x2589b4[_0xe9b3('0xb')]);_0x2589b4[_0xe9b3('0x57')]=intUtil['stripTrailingSlash'](_0x2589b4['serverUrl']);_0x2baf01['callDirection']=_0x46067b==='queue'||_0x46067b===_0xe9b3('0x58')?_0xe9b3('0x4d'):_0xe9b3('0x29');var _0x2a4833=_0x2589b4['modernAuthentication']?util[_0xe9b3('0x51')](_0xe9b3('0x59'),_0x2589b4[_0xe9b3('0xc')][_0xe9b3('0xd')]):util[_0xe9b3('0x51')](_0xe9b3('0x59'),_0x2589b4[_0xe9b3('0xb')]);var _0x4af2fe=util[_0xe9b3('0x51')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2589b4[_0xe9b3('0x5a')]);var _0x1379b1=util[_0xe9b3('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2589b4[_0xe9b3('0x57')],_0x5153ae[_0xe9b3('0x5b')],md5(_0x5153ae['uniqueid']));if(_0xe9b85e&&_0xe9b85e[_0xe9b3('0x5c')]){logger[_0xe9b3('0x21')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5153ae['recordingURL']=_0x1379b1;}else if(_0x45ea50&&_0x45ea50[_0xe9b3('0x5d')]&&_0x45ea50[_0xe9b3('0x5d')]!==_0xe9b3('0x5e')){logger[_0xe9b3('0x21')](_0xe9b3('0x5f'),_0xe9b3('0x60'));_0x5153ae['recordingURL']=_0x1379b1;}else{_0x5153ae[_0xe9b3('0x61')]='';}return getUser(_0x2baf01,_0x2589b4,_0x67e168,_0x4af2fe,_0x2a4833,_0x46067b)['then'](function(_0x32d884){logger['info']('['+_0x46067b[_0xe9b3('0x15')]()+_0xe9b3('0x62'),_0x32d884[_0xe9b3('0x26')]);logger[_0xe9b3('0x21')]('['+_0x46067b[_0xe9b3('0x15')]()+_0xe9b3('0x63'),_0x32d884[_0xe9b3('0x1e')]);return getEndUser(_0x32d884,_0x2589b4,_0x4af2fe,_0x2a4833,_0x5153ae,_0x46067b,_0xc5b627[_0xe9b3('0x64')],_0xc5b627['additionalSearchContact']);})[_0xe9b3('0x2f')](function(_0x67c429){logger[_0xe9b3('0x21')]('['+_0x46067b['toUpperCase']()+_0xe9b3('0x65'),_0x67c429['enduserId']);logger[_0xe9b3('0x21')]('['+_0x46067b[_0xe9b3('0x15')]()+_0xe9b3('0x66'),_0x5153ae[_0xe9b3('0x2b')]);return getTicket(_0x67c429,_0x2589b4,_0x4af2fe,_0x2a4833,_0x5153ae,_0xc5b627,_0x46067b);})['then'](function(_0x2ea217){logger[_0xe9b3('0x21')](util[_0xe9b3('0x51')]('['+_0x46067b[_0xe9b3('0x15')]()+_0xe9b3('0x67'),_0xc5b627['ticketType'],_0x2ea217['ticketId']));logger[_0xe9b3('0x21')](util[_0xe9b3('0x51')]('['+_0x46067b['toUpperCase']()+_0xe9b3('0x68'),_0x46067b));if(_0x46067b!==_0xe9b3('0x58')&&_0xc5b627[_0xe9b3('0x69')]){logger['info']('['+_0x46067b[_0xe9b3('0x15')]()+']',_0xe9b3('0x6a'));emit(_0x2589b4[_0xe9b3('0xb')],_0x67e168[_0xe9b3('0x6b')],_0xc5b627[_0xe9b3('0x43')],_0x2ea217[_0xe9b3('0x50')]);}})[_0xe9b3('0x27')](function(_0x4a8817){logger['error']('['+_0x46067b[_0xe9b3('0x15')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x4a8817[_0xe9b3('0x17')]);console[_0xe9b3('0x14')]('Error\x20running\x20Dynamics365\x20integration',_0x4a8817);});}; \ 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 b6c8071..c459c01 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 _0x7d11=['util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','remoteUri','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','customField','nameField','toLowerCase','content','idField','push','type','variable','variableName','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','destcalleridname','[OUTBOUND]','unmanaged','lastevent','toUpperCase','md5'];(function(_0x1eaded,_0x4faf87){var _0x415399=function(_0xa28503){while(--_0xa28503){_0x1eaded['push'](_0x1eaded['shift']());}};_0x415399(++_0x4faf87);}(_0x7d11,0x1b7));var _0x17d1=function(_0x2dd471,_0x51a6af){_0x2dd471=_0x2dd471-0x0;var _0x200f68=_0x7d11[_0x2dd471];return _0x200f68;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x17d1('0x0'));var util=require(_0x17d1('0x1'));var Redis=require(_0x17d1('0x2'));var intUtil=require(_0x17d1('0x3'));var config=require(_0x17d1('0x4'));var logger=require(_0x17d1('0x5'))(_0x17d1('0x6'));config[_0x17d1('0x7')]=_[_0x17d1('0x8')](config[_0x17d1('0x7')],{'host':_0x17d1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x17d1('0xa'),'Accept':'application/json'};function emit(_0x1787a5,_0xa052b9,_0x1b020f){io['to'](_0x1787a5)['emit'](_0xa052b9,_0x1b020f);}function getTicket(_0x2aafb6,_0x1775bc,_0x3e097a,_0x2a6ce6,_0x59c232){logger[_0x17d1('0xb')](_0x17d1('0xc'));var _0x1129bd=_[_0x17d1('0xd')]({'responder_id':_0x1775bc['id'],'requester_id':_0x3e097a['id'],'name':util[_0x17d1('0xe')](_0x17d1('0xf'),_0x59c232[_0x17d1('0x10')]),'phone':_0x59c232[_0x17d1('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2a6ce6[_0x17d1('0x12')],_0x59c232,'\x20'),'description':intUtil[_0x17d1('0x13')](_0x2a6ce6[_0x17d1('0x14')],_0x59c232,_0x17d1('0x15')),'tags':getTags(_0x2a6ce6[_0x17d1('0x16')],_0x17d1('0x17'))},getCustomFields(_0x2a6ce6[_0x17d1('0x18')],_0x59c232));_0x1129bd[_0x17d1('0x19')]=_[_0x17d1('0x1a')](_['keyBy'](_0x1129bd[_0x17d1('0x19')],'id'),_0x17d1('0x1b'));return request({'uri':util[_0x17d1('0xe')](_0x17d1('0x1c'),_0x2aafb6['remoteUri']),'method':_0x17d1('0x1d'),'body':_0x1129bd})[_0x17d1('0x1e')](function(_0xcf498f){logger[_0x17d1('0xb')](_0x17d1('0x1f'));return _0xcf498f;});}function getUser(_0x10957c,_0x22fd99){if(intUtil['validateEmail'](_0x22fd99)){return request({'uri':util[_0x17d1('0xe')]('%s/api/v2/agents',_0x10957c['remoteUri']),'qs':{'email':_0x22fd99}})[_0x17d1('0x1e')](function(_0xee0d2e){if(_0xee0d2e[_0x17d1('0x20')]){logger['info'](_0x17d1('0x21'));return _[_0x17d1('0x22')](_0xee0d2e,function(_0x3233f0){return _0x3233f0['contact'][_0x17d1('0x23')]===_0x22fd99;});}else{logger[_0x17d1('0xb')](_0x17d1('0x24'));return request({'uri':util[_0x17d1('0xe')](_0x17d1('0x25'),_0x10957c['remoteUri'])})[_0x17d1('0x1e')](function(_0x28849d){logger[_0x17d1('0xb')](_0x17d1('0x26'));return _0x28849d;});}});}else{logger[_0x17d1('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x17d1('0xe')]('%s/api/v2/agents/me',_0x10957c[_0x17d1('0x27')])})[_0x17d1('0x1e')](function(_0x400bc2){logger[_0x17d1('0xb')](_0x17d1('0x26'));return _0x400bc2;});}}function getEndUser(_0x30af54,_0x5abedf,_0x370bc5){logger[_0x17d1('0xb')](_0x17d1('0x28'),_0x370bc5);return request({'uri':util[_0x17d1('0xe')]('%s/api/v2/contacts',_0x30af54[_0x17d1('0x27')]),'qs':{'phone':_0x370bc5}})[_0x17d1('0x1e')](function(_0x1d5b31){if(_0x1d5b31['length']){logger['info']('Enduser\x20found!');return _['find'](_0x1d5b31,{'phone':_0x370bc5});}else{logger[_0x17d1('0xb')](_0x17d1('0x29'));return request({'uri':util[_0x17d1('0xe')](_0x17d1('0x2a'),_0x30af54[_0x17d1('0x27')]),'method':_0x17d1('0x1d'),'body':{'name':_0x5abedf,'phone':_0x370bc5}})[_0x17d1('0x1e')](function(_0x45523f){logger[_0x17d1('0xb')](_0x17d1('0x2b'));return _0x45523f;});}});}function getAuth(_0xae15cc){return util[_0x17d1('0xe')](_0x17d1('0x2c'),new Buffer(_0xae15cc[_0x17d1('0x2d')]+':X')[_0x17d1('0x2e')]('base64'));}function request(_0x3a946a){logger[_0x17d1('0x2f')](_0x17d1('0x30'),JSON[_0x17d1('0x31')](_0x3a946a));return rp(_[_0x17d1('0x8')](_0x3a946a,{'method':_0x17d1('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x7732e0,_0x572975){var _0x230bd1=[];if(_0x7732e0&&_0x7732e0[_0x17d1('0x20')]>0x0){_0x230bd1=_[_0x17d1('0x33')](_0x7732e0,_0x572975);}return _0x230bd1;}function getCustomFields(_0x2644b2,_0x5e895e){var _0x4cf4e3=[];var _0x2a6580={'custom_fields':[]};if(_0x2644b2[_0x17d1('0x20')]>0x0){_[_0x17d1('0x34')](_0x2644b2,function(_0x3383c1){if(_['includes']([_0x17d1('0x35'),_0x17d1('0x36')],_0x3383c1['type'])&&_0x3383c1['nameField']&&!_0x3383c1[_0x17d1('0x37')]){_0x2a6580[_0x3383c1[_0x17d1('0x38')][_0x17d1('0x39')]()]=_0x3383c1[_0x17d1('0x3a')][_0x17d1('0x2e')]();}else if(_['includes']([_0x17d1('0x35'),'picklist'],_0x3383c1['type'])&&_0x3383c1[_0x17d1('0x3b')]&&_0x3383c1[_0x17d1('0x37')]){_0x2a6580[_0x17d1('0x19')][_0x17d1('0x3c')]({'id':_0x3383c1[_0x17d1('0x3b')],'value':_0x3383c1[_0x17d1('0x3a')]['toString']()});}else if(_0x3383c1[_0x17d1('0x3d')]===_0x17d1('0x3e')&&_0x3383c1[_0x17d1('0x3f')]&&_0x3383c1[_0x17d1('0x3b')]&&_0x3383c1['customField']){_0x5e895e[_0x3383c1[_0x17d1('0x3f')]]&&_0x2a6580[_0x17d1('0x19')][_0x17d1('0x3c')]({'id':_0x3383c1[_0x17d1('0x3b')],'value':_0x5e895e[_0x3383c1[_0x17d1('0x3f')]][_0x17d1('0x2e')]()});}else if(_0x3383c1['type']==='customVariable'&&_0x3383c1[_0x17d1('0x40')]&&_0x3383c1['Variable'][_0x17d1('0x17')]&&_0x3383c1[_0x17d1('0x3b')]&&_0x3383c1[_0x17d1('0x37')]){_0x5e895e[_0x3383c1[_0x17d1('0x40')][_0x17d1('0x17')]['toLowerCase']()]&&_0x2a6580[_0x17d1('0x19')][_0x17d1('0x3c')]({'id':_0x3383c1[_0x17d1('0x3b')],'value':_0x5e895e[_0x3383c1['Variable'][_0x17d1('0x17')][_0x17d1('0x39')]()][_0x17d1('0x2e')]()});}});}return _0x2a6580;}exports['queue']=function(_0x1bcafa,_0x31a123,_0x14164a,_0x4e2c7e,_0x49a7a8,_0x2e3fd9){var _0x2a54a5,_0x54c80e;_0x2e3fd9[_0x17d1('0x27')]=intUtil[_0x17d1('0x41')](_0x2e3fd9[_0x17d1('0x27')]);_0x2e3fd9[_0x17d1('0x42')]=intUtil[_0x17d1('0x41')](_0x2e3fd9[_0x17d1('0x42')]);if(_0x49a7a8&&_0x49a7a8['monitor_format']){logger['info'](_0x17d1('0x43'),_0x17d1('0x44'));_0x31a123[_0x17d1('0x45')]=util['format'](_0x17d1('0x46'),_0x2e3fd9[_0x17d1('0x42')],_0x31a123['uniqueid'],md5(_0x31a123[_0x17d1('0x47')]));}else{_0x31a123[_0x17d1('0x45')]='';}headers[_0x17d1('0x48')]=getAuth(_0x2e3fd9);return getUser(_0x2e3fd9,_0x4e2c7e['email'])['then'](function(_0x5b3d7b){_0x2a54a5=_0x5b3d7b;logger[_0x17d1('0xb')](_0x17d1('0x49'),_0x2a54a5['id']);return getEndUser(_0x2e3fd9,_0x31a123['calleridname'],_0x31a123['calleridnum']);})[_0x17d1('0x1e')](function(_0x452fab){_0x54c80e=_0x452fab;logger[_0x17d1('0xb')](_0x17d1('0x4a'),_0x54c80e['id']);return getTicket(_0x2e3fd9,_0x2a54a5,_0x54c80e,_0x14164a,_0x31a123);})[_0x17d1('0x1e')](function(_0x209285){if(_0x209285&&_0x209285['id']){logger[_0x17d1('0xb')](_0x17d1('0x1f'));logger[_0x17d1('0xb')](_0x17d1('0x4b'),_0x209285['id']);logger['info'](_0x17d1('0x43'),_0x17d1('0x4c'));emit(util[_0x17d1('0xe')](_0x17d1('0x4d'),_0x4e2c7e[_0x17d1('0x17')]),_0x17d1('0x4e'),{'uri':util[_0x17d1('0xe')](_0x17d1('0x4f'),_0x2e3fd9[_0x17d1('0x27')],_0x209285['id'])});}})[_0x17d1('0x50')](function(_0x10b9f3){logger[_0x17d1('0x51')](_0x17d1('0x43'),JSON[_0x17d1('0x31')](_0x10b9f3));});};exports['outbound']=function(_0x3b51b6,_0x2e1b9b,_0x399ce4,_0x3e2e41,_0x1c20cb,_0x2b3892,_0x268e5b){var _0x4e7ae2,_0x2944b0;_0x2b3892['remoteUri']=intUtil[_0x17d1('0x41')](_0x2b3892['remoteUri']);_0x2b3892[_0x17d1('0x42')]=intUtil[_0x17d1('0x41')](_0x2b3892[_0x17d1('0x42')]);if(_0x268e5b&&_0x268e5b[_0x17d1('0x52')]&&_0x268e5b[_0x17d1('0x52')]!=='none'){logger[_0x17d1('0xb')]('[OUTBOUND]',_0x17d1('0x44'));_0x2e1b9b[_0x17d1('0x45')]=util[_0x17d1('0xe')](_0x17d1('0x46'),_0x2b3892[_0x17d1('0x42')],_0x2e1b9b[_0x17d1('0x47')],md5(_0x2e1b9b[_0x17d1('0x47')]));}headers[_0x17d1('0x48')]=getAuth(_0x2b3892);return getUser(_0x2b3892,_0x3e2e41[_0x17d1('0x23')])[_0x17d1('0x1e')](function(_0x2d939e){_0x4e7ae2=_0x2d939e;logger[_0x17d1('0xb')](_0x17d1('0x49'),_0x4e7ae2['id']);return getEndUser(_0x2b3892,_0x2e1b9b[_0x17d1('0x53')],_0x2e1b9b['destcalleridnum']);})[_0x17d1('0x1e')](function(_0x1866f6){_0x2944b0=_0x1866f6;logger['info'](_0x17d1('0x4a'),_0x2944b0['id']);return getTicket(_0x2b3892,_0x4e7ae2,_0x2944b0,_0x399ce4,_0x2e1b9b);})[_0x17d1('0x1e')](function(_0x4cbbe5){if(_0x4cbbe5&&_0x4cbbe5['id']){logger[_0x17d1('0xb')]('Ticket\x20created!');logger['info'](_0x17d1('0x4b'),_0x4cbbe5['id']);logger[_0x17d1('0xb')](_0x17d1('0x54'),_0x17d1('0x4c'));emit(util[_0x17d1('0xe')](_0x17d1('0x4d'),_0x3e2e41[_0x17d1('0x17')]),_0x17d1('0x4e'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x2b3892[_0x17d1('0x27')],_0x4cbbe5['id'])});}})[_0x17d1('0x50')](function(_0x3e59ba){logger[_0x17d1('0x51')](_0x17d1('0x54'),JSON[_0x17d1('0x31')](_0x3e59ba));});};exports[_0x17d1('0x55')]=function(_0xe1f789,_0x5e5250,_0x4ac9af,_0x3d44af,_0x42cf31,_0x1f268d){var _0x372b52,_0x1fb9be;_0x1f268d[_0x17d1('0x27')]=intUtil['stripTrailingSlash'](_0x1f268d[_0x17d1('0x27')]);_0x1f268d[_0x17d1('0x42')]=intUtil[_0x17d1('0x41')](_0x1f268d[_0x17d1('0x42')]);if(_0x42cf31&&_0x42cf31['monitor_format']){logger[_0x17d1('0xb')]('['+_0x5e5250[_0x17d1('0x56')][_0x17d1('0x57')]()+']','Recording\x20is\x20enabled!');_0x5e5250['recordingURL']=util[_0x17d1('0xe')](_0x17d1('0x46'),_0x1f268d[_0x17d1('0x42')],_0x5e5250['uniqueid'],md5(_0x5e5250[_0x17d1('0x47')]));}else{_0x5e5250['recordingURL']='';}headers[_0x17d1('0x48')]=getAuth(_0x1f268d);return getUser(_0x1f268d,'')[_0x17d1('0x1e')](function(_0x5d4e73){_0x372b52=_0x5d4e73;logger['info'](_0x17d1('0x49'),_0x372b52['id']);return getEndUser(_0x1f268d,_0x5e5250[_0x17d1('0x10')],_0x5e5250['calleridnum']);})['then'](function(_0x4dd10c){_0x1fb9be=_0x4dd10c;logger[_0x17d1('0xb')](_0x17d1('0x4a'),_0x1fb9be['id']);return getTicket(_0x1f268d,_0x372b52,_0x1fb9be,_0x4ac9af,_0x5e5250);})[_0x17d1('0x1e')](function(_0x5e0a73){if(_0x5e0a73){logger[_0x17d1('0xb')]('Ticket\x20created!');logger[_0x17d1('0xb')](_0x17d1('0x4b'),_0x5e0a73['id']);}})[_0x17d1('0x50')](function(_0x3bf1cb){logger['error']('['+_0x5e5250[_0x17d1('0x56')]['toUpperCase']()+']',JSON['stringify'](_0x3bf1cb));});}; \ No newline at end of file +var _0xb872=['Descriptions','
','Tags','name','mapValues','value','%s/api/v2/tickets','remoteUri','Ticket\x20created!','%s/api/v2/agents','then','length','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','custom_fields','variable','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','error','recordingFormat','The\x20User\x20ID\x20is:','destcalleridname','[OUTBOUND]','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','Subjects','getString'];(function(_0x1b6c32,_0x4a1c51){var _0x3ed66e=function(_0x3aad06){while(--_0x3aad06){_0x1b6c32['push'](_0x1b6c32['shift']());}};_0x3ed66e(++_0x4a1c51);}(_0xb872,0x9f));var _0x2b87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb872[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2b87('0x0'));var rp=require(_0x2b87('0x1'));var md5=require(_0x2b87('0x2'));var util=require(_0x2b87('0x3'));var Redis=require(_0x2b87('0x4'));var intUtil=require(_0x2b87('0x5'));var config=require(_0x2b87('0x6'));var logger=require(_0x2b87('0x7'))(_0x2b87('0x8'));config[_0x2b87('0x9')]=_['defaults'](config[_0x2b87('0x9')],{'host':_0x2b87('0xa'),'port':0x18eb});var io=require(_0x2b87('0xb'))(new Redis(config['redis']));var headers={'Content-Type':_0x2b87('0xc'),'Accept':_0x2b87('0xc')};function emit(_0x59aa9a,_0x418e5b,_0x16ff4d){io['to'](_0x59aa9a)['emit'](_0x418e5b,_0x16ff4d);}function getTicket(_0x144e0e,_0x1173cd,_0x422cef,_0xfb2a8a,_0x469885){logger[_0x2b87('0xd')](_0x2b87('0xe'));var _0x4d9347=_[_0x2b87('0xf')]({'responder_id':_0x1173cd['id'],'requester_id':_0x422cef['id'],'name':util[_0x2b87('0x10')]('Caller\x20-\x20%s',_0x469885[_0x2b87('0x11')]),'phone':_0x469885[_0x2b87('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0xfb2a8a[_0x2b87('0x13')],_0x469885,'\x20'),'description':intUtil[_0x2b87('0x14')](_0xfb2a8a[_0x2b87('0x15')],_0x469885,_0x2b87('0x16')),'tags':getTags(_0xfb2a8a[_0x2b87('0x17')],_0x2b87('0x18'))},getCustomFields(_0xfb2a8a['Fields'],_0x469885));_0x4d9347['custom_fields']=_[_0x2b87('0x19')](_['keyBy'](_0x4d9347['custom_fields'],'id'),_0x2b87('0x1a'));return request({'uri':util[_0x2b87('0x10')](_0x2b87('0x1b'),_0x144e0e[_0x2b87('0x1c')]),'method':'POST','body':_0x4d9347})['then'](function(_0x272aab){logger[_0x2b87('0xd')](_0x2b87('0x1d'));return _0x272aab;});}function getUser(_0x4e93e6,_0x16febf){if(intUtil['validateEmail'](_0x16febf)){return request({'uri':util[_0x2b87('0x10')](_0x2b87('0x1e'),_0x4e93e6[_0x2b87('0x1c')]),'qs':{'email':_0x16febf}})[_0x2b87('0x1f')](function(_0x5986e7){if(_0x5986e7[_0x2b87('0x20')]){logger['info']('Agent\x20found!');return _[_0x2b87('0x21')](_0x5986e7,function(_0x11d96c){return _0x11d96c['contact'][_0x2b87('0x22')]===_0x16febf;});}else{logger[_0x2b87('0xd')](_0x2b87('0x23'));return request({'uri':util[_0x2b87('0x10')](_0x2b87('0x24'),_0x4e93e6[_0x2b87('0x1c')])})[_0x2b87('0x1f')](function(_0x140ff8){logger['info'](_0x2b87('0x25'));return _0x140ff8;});}});}else{logger[_0x2b87('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2b87('0x10')](_0x2b87('0x24'),_0x4e93e6[_0x2b87('0x1c')])})[_0x2b87('0x1f')](function(_0x41ec7e){logger['info'](_0x2b87('0x25'));return _0x41ec7e;});}}function getEndUser(_0x245fbf,_0x2a1c89,_0x566a56){logger[_0x2b87('0xd')](_0x2b87('0x26'),_0x566a56);return request({'uri':util[_0x2b87('0x10')]('%s/api/v2/contacts',_0x245fbf[_0x2b87('0x1c')]),'qs':{'phone':_0x566a56}})[_0x2b87('0x1f')](function(_0x203a70){if(_0x203a70['length']){logger['info'](_0x2b87('0x27'));return _['find'](_0x203a70,{'phone':_0x566a56});}else{logger['info'](_0x2b87('0x28'));return request({'uri':util[_0x2b87('0x10')](_0x2b87('0x29'),_0x245fbf[_0x2b87('0x1c')]),'method':_0x2b87('0x2a'),'body':{'name':_0x2a1c89,'phone':_0x566a56}})[_0x2b87('0x1f')](function(_0x1a7524){logger[_0x2b87('0xd')](_0x2b87('0x2b'));return _0x1a7524;});}});}function getAuth(_0x5ead0d){return util['format']('Basic\x20%s',new Buffer(_0x5ead0d[_0x2b87('0x2c')]+':X')[_0x2b87('0x2d')](_0x2b87('0x2e')));}function request(_0x34ffdd){logger[_0x2b87('0x2f')](_0x2b87('0x30'),JSON[_0x2b87('0x31')](_0x34ffdd));return rp(_['defaults'](_0x34ffdd,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5553c2,_0x25cdd0){var _0x1a7030=[];if(_0x5553c2&&_0x5553c2['length']>0x0){_0x1a7030=_[_0x2b87('0x32')](_0x5553c2,_0x25cdd0);}return _0x1a7030;}function getCustomFields(_0x2e5e06,_0x56868c){var _0x569ff4=[];var _0x4e99fb={'custom_fields':[]};if(_0x2e5e06[_0x2b87('0x20')]>0x0){_[_0x2b87('0x33')](_0x2e5e06,function(_0x3540b9){if(_['includes']([_0x2b87('0x34'),_0x2b87('0x35')],_0x3540b9[_0x2b87('0x36')])&&_0x3540b9[_0x2b87('0x37')]&&!_0x3540b9[_0x2b87('0x38')]){_0x4e99fb[_0x3540b9[_0x2b87('0x37')][_0x2b87('0x39')]()]=_0x3540b9[_0x2b87('0x3a')][_0x2b87('0x2d')]();}else if(_[_0x2b87('0x3b')]([_0x2b87('0x34'),_0x2b87('0x35')],_0x3540b9[_0x2b87('0x36')])&&_0x3540b9[_0x2b87('0x3c')]&&_0x3540b9[_0x2b87('0x38')]){_0x4e99fb[_0x2b87('0x3d')]['push']({'id':_0x3540b9['idField'],'value':_0x3540b9[_0x2b87('0x3a')]['toString']()});}else if(_0x3540b9[_0x2b87('0x36')]===_0x2b87('0x3e')&&_0x3540b9['variableName']&&_0x3540b9[_0x2b87('0x3c')]&&_0x3540b9[_0x2b87('0x38')]){_0x56868c[_0x3540b9['variableName']]&&_0x4e99fb[_0x2b87('0x3d')]['push']({'id':_0x3540b9[_0x2b87('0x3c')],'value':_0x56868c[_0x3540b9['variableName']][_0x2b87('0x2d')]()});}else if(_0x3540b9[_0x2b87('0x36')]===_0x2b87('0x3f')&&_0x3540b9['Variable']&&_0x3540b9[_0x2b87('0x40')][_0x2b87('0x18')]&&_0x3540b9[_0x2b87('0x3c')]&&_0x3540b9[_0x2b87('0x38')]){_0x56868c[_0x3540b9[_0x2b87('0x40')][_0x2b87('0x18')][_0x2b87('0x39')]()]&&_0x4e99fb[_0x2b87('0x3d')]['push']({'id':_0x3540b9['idField'],'value':_0x56868c[_0x3540b9[_0x2b87('0x40')][_0x2b87('0x18')][_0x2b87('0x39')]()]['toString']()});}});}return _0x4e99fb;}exports[_0x2b87('0x41')]=function(_0x427fe1,_0x2f894e,_0x1901b6,_0x44a4ef,_0x56d31b,_0x61f95f){var _0x1e6592,_0x4aef0b;_0x61f95f[_0x2b87('0x1c')]=intUtil[_0x2b87('0x42')](_0x61f95f[_0x2b87('0x1c')]);_0x61f95f[_0x2b87('0x43')]=intUtil['stripTrailingSlash'](_0x61f95f[_0x2b87('0x43')]);if(_0x56d31b&&_0x56d31b[_0x2b87('0x44')]){logger[_0x2b87('0xd')](_0x2b87('0x45'),_0x2b87('0x46'));_0x2f894e[_0x2b87('0x47')]=util['format'](_0x2b87('0x48'),_0x61f95f[_0x2b87('0x43')],_0x2f894e[_0x2b87('0x49')],md5(_0x2f894e[_0x2b87('0x49')]));}else{_0x2f894e[_0x2b87('0x47')]='';}headers[_0x2b87('0x4a')]=getAuth(_0x61f95f);return getUser(_0x61f95f,_0x44a4ef[_0x2b87('0x22')])[_0x2b87('0x1f')](function(_0x9873ae){_0x1e6592=_0x9873ae;logger['info']('The\x20User\x20ID\x20is:',_0x1e6592['id']);return getEndUser(_0x61f95f,_0x2f894e['calleridname'],_0x2f894e['calleridnum']);})['then'](function(_0x1bb30d){_0x4aef0b=_0x1bb30d;logger[_0x2b87('0xd')](_0x2b87('0x4b'),_0x4aef0b['id']);return getTicket(_0x61f95f,_0x1e6592,_0x4aef0b,_0x1901b6,_0x2f894e);})[_0x2b87('0x1f')](function(_0x33e6a7){if(_0x33e6a7&&_0x33e6a7['id']){logger[_0x2b87('0xd')](_0x2b87('0x1d'));logger[_0x2b87('0xd')](_0x2b87('0x4c'),_0x33e6a7['id']);logger[_0x2b87('0xd')](_0x2b87('0x45'),_0x2b87('0x4d'));emit(util[_0x2b87('0x10')]('user:%s',_0x44a4ef[_0x2b87('0x18')]),'trigger:browser:url',{'uri':util[_0x2b87('0x10')](_0x2b87('0x4e'),_0x61f95f[_0x2b87('0x1c')],_0x33e6a7['id'])});}})[_0x2b87('0x4f')](function(_0x16eca5){logger[_0x2b87('0x50')](_0x2b87('0x45'),JSON[_0x2b87('0x31')](_0x16eca5));});};exports['outbound']=function(_0x3f1dad,_0x5989b8,_0x2765f5,_0x3fb8c9,_0x3bf9d1,_0x38ac4d,_0x3d4192){var _0xcc7d3c,_0x10b5a1;_0x38ac4d['remoteUri']=intUtil[_0x2b87('0x42')](_0x38ac4d[_0x2b87('0x1c')]);_0x38ac4d[_0x2b87('0x43')]=intUtil[_0x2b87('0x42')](_0x38ac4d[_0x2b87('0x43')]);if(_0x3d4192&&_0x3d4192[_0x2b87('0x51')]&&_0x3d4192[_0x2b87('0x51')]!=='none'){logger[_0x2b87('0xd')]('[OUTBOUND]',_0x2b87('0x46'));_0x5989b8[_0x2b87('0x47')]=util[_0x2b87('0x10')](_0x2b87('0x48'),_0x38ac4d[_0x2b87('0x43')],_0x5989b8['uniqueid'],md5(_0x5989b8[_0x2b87('0x49')]));}headers[_0x2b87('0x4a')]=getAuth(_0x38ac4d);return getUser(_0x38ac4d,_0x3fb8c9[_0x2b87('0x22')])[_0x2b87('0x1f')](function(_0x487bc0){_0xcc7d3c=_0x487bc0;logger['info'](_0x2b87('0x52'),_0xcc7d3c['id']);return getEndUser(_0x38ac4d,_0x5989b8[_0x2b87('0x53')],_0x5989b8['destcalleridnum']);})[_0x2b87('0x1f')](function(_0x45e055){_0x10b5a1=_0x45e055;logger['info'](_0x2b87('0x4b'),_0x10b5a1['id']);return getTicket(_0x38ac4d,_0xcc7d3c,_0x10b5a1,_0x2765f5,_0x5989b8);})[_0x2b87('0x1f')](function(_0x2ee0c5){if(_0x2ee0c5&&_0x2ee0c5['id']){logger[_0x2b87('0xd')](_0x2b87('0x1d'));logger['info'](_0x2b87('0x4c'),_0x2ee0c5['id']);logger[_0x2b87('0xd')](_0x2b87('0x54'),_0x2b87('0x4d'));emit(util[_0x2b87('0x10')](_0x2b87('0x55'),_0x3fb8c9[_0x2b87('0x18')]),_0x2b87('0x56'),{'uri':util[_0x2b87('0x10')]('%s/helpdesk/tickets/%d',_0x38ac4d[_0x2b87('0x1c')],_0x2ee0c5['id'])});}})[_0x2b87('0x4f')](function(_0x1bb06e){logger['error']('[OUTBOUND]',JSON[_0x2b87('0x31')](_0x1bb06e));});};exports[_0x2b87('0x57')]=function(_0x20edb9,_0x46e400,_0x24dd51,_0x37a332,_0x44fb2b,_0x25e57e){var _0x3e57d0,_0x4c2274;_0x25e57e[_0x2b87('0x1c')]=intUtil[_0x2b87('0x42')](_0x25e57e[_0x2b87('0x1c')]);_0x25e57e[_0x2b87('0x43')]=intUtil[_0x2b87('0x42')](_0x25e57e[_0x2b87('0x43')]);if(_0x44fb2b&&_0x44fb2b[_0x2b87('0x44')]){logger[_0x2b87('0xd')]('['+_0x46e400[_0x2b87('0x58')][_0x2b87('0x59')]()+']',_0x2b87('0x46'));_0x46e400[_0x2b87('0x47')]=util[_0x2b87('0x10')](_0x2b87('0x48'),_0x25e57e[_0x2b87('0x43')],_0x46e400['uniqueid'],md5(_0x46e400[_0x2b87('0x49')]));}else{_0x46e400[_0x2b87('0x47')]='';}headers[_0x2b87('0x4a')]=getAuth(_0x25e57e);return getUser(_0x25e57e,'')['then'](function(_0x32e513){_0x3e57d0=_0x32e513;logger[_0x2b87('0xd')](_0x2b87('0x52'),_0x3e57d0['id']);return getEndUser(_0x25e57e,_0x46e400[_0x2b87('0x11')],_0x46e400[_0x2b87('0x12')]);})[_0x2b87('0x1f')](function(_0x37ee16){_0x4c2274=_0x37ee16;logger[_0x2b87('0xd')](_0x2b87('0x4b'),_0x4c2274['id']);return getTicket(_0x25e57e,_0x3e57d0,_0x4c2274,_0x24dd51,_0x46e400);})[_0x2b87('0x1f')](function(_0x43bfed){if(_0x43bfed){logger[_0x2b87('0xd')](_0x2b87('0x1d'));logger[_0x2b87('0xd')](_0x2b87('0x4c'),_0x43bfed['id']);}})[_0x2b87('0x4f')](function(_0x1bbeef){logger[_0x2b87('0x50')]('['+_0x46e400[_0x2b87('0x58')]['toUpperCase']()+']',JSON[_0x2b87('0x31')](_0x1bbeef));});}; \ 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 730e809..3ff3cec 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 _0x66a2=['moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','/api/selector/owners','Getting\x20admin\x20information','then','email','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','&f=','find','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%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',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5'];(function(_0x3f88a5,_0x4a173c){var _0x1a4d99=function(_0x2eea79){while(--_0x2eea79){_0x3f88a5['push'](_0x3f88a5['shift']());}};_0x1a4d99(++_0x4a173c);}(_0x66a2,0xff));var _0x266a=function(_0x57915c,_0xf6ecb9){_0x57915c=_0x57915c-0x0;var _0x5b890f=_0x66a2[_0x57915c];return _0x5b890f;};'use strict';var _=require(_0x266a('0x0'));var rp=require(_0x266a('0x1'));var md5=require(_0x266a('0x2'));var util=require('util');var moment=require(_0x266a('0x3'));var Promise=require(_0x266a('0x4'));var Redis=require(_0x266a('0x5'));var intUtil=require(_0x266a('0x6'));var config=require(_0x266a('0x7'));var logger=require(_0x266a('0x8'))(_0x266a('0x9'));config[_0x266a('0xa')]=_['defaults'](config[_0x266a('0xa')],{'host':_0x266a('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x266a('0xa')]));function getAdminId(_0x5aa2dd,_0x2e92f1,_0x5ea1c7,_0x50ffe2){return new Promise(function(_0x1208c9,_0x3fa9a6){var _0x1ca8a8=![];var _0x13fd9d={'method':'GET','uri':_0x50ffe2+_0x266a('0xc'),'json':!![]};_0x13fd9d['headers']=_0x5ea1c7;logger['info'](_0x266a('0xd'));return rp(_0x13fd9d)[_0x266a('0xe')](function(_0x1bf10c){if(_0x1bf10c){var _0x111391=_0x1bf10c['users'];var _0x298284=null;for(_0x298284=0x0;_0x298284<_0x111391['length'];_0x298284++){if(_0x111391[_0x298284][_0x266a('0xf')]===_0x5aa2dd[_0x266a('0x10')]){_0x5aa2dd[_0x266a('0x11')]=_0x111391[_0x298284]['id'];_0x1ca8a8=!![];}}if(_0x1ca8a8){logger[_0x266a('0x12')]('Admin\x20found:',_0x5aa2dd[_0x266a('0x11')]);_0x1208c9(_0x5aa2dd);}else{_0x3fa9a6({'statusCode':0x194,'message':_0x266a('0x13')});}}else{_0x3fa9a6({'statusCode':0x194,'message':_0x266a('0x13')});}})[_0x266a('0x14')](function(_0x27eae5){logger[_0x266a('0x15')]('['+[_0x2e92f1[_0x266a('0x16')]()]+']',_0x27eae5[_0x266a('0x17')]);_0x3fa9a6(_0x27eae5);});});}function getUser(_0x4836a6,_0x35e594,_0x1f49e9){return function(_0x1df02e){return new Promise(function(_0x451b13,_0x7bab27){var _0xe30fcd={'method':'GET','uri':_0x1f49e9+'/api/selector/owners','json':!![]};_0xe30fcd[_0x266a('0x18')]=_0x35e594;logger[_0x266a('0x12')](_0x266a('0x19'));return rp(_0xe30fcd)[_0x266a('0xe')](function(_0x28dcf2){if(_0x28dcf2){var _0x2e6c02=_0x28dcf2[_0x266a('0x1a')];var _0xb616f2=![];var _0x4517c4=null;if(_0x1df02e[_0x266a('0x1b')]!==null){logger[_0x266a('0x12')](_0x266a('0x1c'),_0x1df02e[_0x266a('0x1b')]);_0x1df02e[_0x266a('0x1d')]=_0x1df02e['agentEmail'];for(_0x4517c4=0x0;_0x4517c4<_0x2e6c02[_0x266a('0x1e')];_0x4517c4++){if(_0x2e6c02[_0x4517c4]['email']===_0x1df02e[_0x266a('0x1b')]){_0xb616f2=!![];_0x1df02e[_0x266a('0x1f')]=_0x2e6c02[_0x4517c4]['id'];logger[_0x266a('0x12')](_0x266a('0x20'),_0x1df02e[_0x266a('0x1f')]);}}}if(!_0xb616f2){logger[_0x266a('0x12')](_0x266a('0x21'));_0x1df02e[_0x266a('0x1d')]=_0x1df02e['adminEmail'];_0x1df02e[_0x266a('0x1f')]=_0x1df02e['adminId'];_0xb616f2=!![];}if(_0xb616f2){_0x451b13(_0x1df02e);}else{_0x7bab27({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x7bab27({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x266a('0x14')](function(_0xf3e496){logger[_0x266a('0x15')]('['+[_0x4836a6[_0x266a('0x16')]()]+']',_0xf3e496[_0x266a('0x17')]);_0x7bab27(_0xf3e496);});});};}function searchContact(_0x160748,_0x6f8745,_0x26a4e4,_0x4ae045){return new Promise(function(_0x3c3f0a,_0x566de8){var _0xa7d662={'method':'GET','headers':_0x6f8745,'uri':_0x160748+'/api/lookup?q='+_0x4ae045+_0x266a('0x22')+_0x26a4e4+'&entities=contact','json':!![]};rp(_0xa7d662)['then'](function(_0x3aff1d){var _0x17859a=_[_0x266a('0x23')](_0x3aff1d['contacts']['contacts'],[_0x26a4e4,_0x4ae045]);_0x3c3f0a(_0x17859a);})[_0x266a('0x14')](function(_0x42aabe){_0x566de8(_0x42aabe);});});}function getEndUser(_0x68f432,_0xcc9024,_0x4b251e){return function(_0x2e361c){return new Promise(function(_0x40df2,_0x6d6a77){logger[_0x266a('0x12')](util[_0x266a('0x24')](_0x266a('0x25'),_0x2e361c['contactNumber']));searchContact(_0x4b251e,_0xcc9024,_0x266a('0x26'),_0x2e361c[_0x266a('0x27')])['then'](function(_0x30e06c){if(_0x30e06c){_0x2e361c[_0x266a('0x28')]=_0x30e06c['id'];logger['info'](_0x266a('0x29'),_0x2e361c[_0x266a('0x28')]);return _0x40df2(_0x2e361c);}searchContact(_0x4b251e,_0xcc9024,_0x266a('0x2a'),_0x2e361c[_0x266a('0x27')])['then'](function(_0x5ae432){if(_0x5ae432){_0x2e361c[_0x266a('0x28')]=_0x5ae432['id'];logger[_0x266a('0x12')](_0x266a('0x2b'),_0x2e361c['endUserId']);return _0x40df2(_0x2e361c);}createEndUser(_0x2e361c,_0x68f432,_0xcc9024,_0x4b251e)[_0x266a('0xe')](function(_0x1e567f){logger['info'](_0x266a('0x2c'),_0x1e567f['endUserId']);return _0x40df2(_0x1e567f);});});})[_0x266a('0x14')](function(_0x45be66){_0x6d6a77(_0x45be66);});});};}function createEndUser(_0x5acd5d,_0x195477,_0x56cc64,_0x3b8fa4){return new Promise(function(_0xb2539f,_0x9aa648){var _0x50ac18=moment();var _0xa59fe8={'method':_0x266a('0x2d'),'uri':_0x3b8fa4+'/api/contacts','body':{'contact':{'last_name':_0x5acd5d[_0x266a('0x27')],'work_number':_0x5acd5d[_0x266a('0x27')],'mobile_number':_0x5acd5d[_0x266a('0x27')],'owner_id':_0x5acd5d[_0x266a('0x1f')],'created_at':_0x50ac18[_0x266a('0x24')](_0x266a('0x2e'))}},'json':!![]};_0xa59fe8[_0x266a('0x18')]=_0x56cc64;logger[_0x266a('0x12')](_0x266a('0x2f'));return rp(_0xa59fe8)[_0x266a('0xe')](function(_0x3b54b0){_0x5acd5d['endUserId']=_0x3b54b0[_0x266a('0x30')]['id'];_0xb2539f(_0x5acd5d);})['catch'](function(_0x15b23c){logger[_0x266a('0x15')]('['+[_0x195477['toUpperCase']()]+']',_0x15b23c[_0x266a('0x17')]);_0x9aa648(_0x15b23c[_0x266a('0x17')]);});});}function getTicket(_0x1d119d,_0x71b152,_0x1036a0,_0x260ead,_0x462a98){return function(_0x68cbe2){logger[_0x266a('0x12')](_0x266a('0x31'));return new Promise(function(_0x4ba4f4,_0x52166e){var _0x4e71f4=moment();var _0x1dacae={'method':_0x266a('0x2d'),'uri':_0x1036a0+_0x266a('0x32'),'body':{'title':intUtil[_0x266a('0x33')](_0x260ead[_0x266a('0x34')],_0x462a98,'\x20'),'description':intUtil['getString'](_0x260ead[_0x266a('0x35')],_0x462a98,'\x0a'),'owner_id':_0x68cbe2['userId'],'creater_id':_0x68cbe2[_0x266a('0x11')],'targetable_id':_0x68cbe2[_0x266a('0x28')],'targetable_type':_0x266a('0x36'),'created_at':_0x4e71f4[_0x266a('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4e71f4['add'](0x1e,'m')[_0x266a('0x24')](_0x266a('0x2e'))},'json':!![]};_0x1dacae['headers']=_0x71b152;return rp(_0x1dacae)[_0x266a('0xe')](function(_0x5b72de){_0x68cbe2[_0x266a('0x37')]=_0x5b72de[_0x266a('0x38')]['id'];logger[_0x266a('0x12')](_0x266a('0x39'),_0x68cbe2[_0x266a('0x37')]);_0x4ba4f4(_0x68cbe2);})[_0x266a('0x14')](function(_0x2d40f9){logger['error']('['+[_0x1d119d[_0x266a('0x16')]()]+']',_0x2d40f9['message']);_0x52166e(_0x2d40f9[_0x266a('0x17')]);});});};}function emit(_0x3073bd,_0x782f61,_0x33aa59){var _0x3d078c={'uri':_0x3073bd+_0x266a('0x3a')+_0x33aa59};io['to'](util[_0x266a('0x24')](_0x266a('0x3b'),_0x782f61))[_0x266a('0x3c')](_0x266a('0x3d'),_0x3d078c);}exports['cs']=function(_0x1c6403,_0x21a9c0,_0x58be69,_0x318b05,_0x35b111,_0x3fc0c2,_0x21ffc0,_0x2caa3f){var _0xb3456b={};var _0x286d2c={'Authorization':_0x266a('0x3e')+_0x3fc0c2[_0x266a('0x3f')]};_0x3fc0c2['remoteUri']=intUtil[_0x266a('0x40')](_0x3fc0c2[_0x266a('0x41')]);_0x3fc0c2[_0x266a('0x42')]=intUtil[_0x266a('0x40')](_0x3fc0c2[_0x266a('0x42')]);var _0x352992=_0x3fc0c2[_0x266a('0x41')];_0xb3456b[_0x266a('0x10')]=_0x3fc0c2[_0x266a('0x43')];_0xb3456b[_0x266a('0x27')]=_0x2caa3f['toLowerCase']()==='outbound'?_0x21a9c0[_0x266a('0x44')]:_0x21a9c0[_0x266a('0x45')];_0xb3456b[_0x266a('0x46')]=_0x2caa3f===_0x266a('0x47')||_0x2caa3f===_0x266a('0x48')?_0x266a('0x47'):_0x266a('0x49');if(_0x318b05){_0xb3456b[_0x266a('0x1b')]=_0x318b05[_0x266a('0xf')];}var _0x3f9c60=util[_0x266a('0x24')](_0x266a('0x4a'),_0x3fc0c2[_0x266a('0x42')],_0x21a9c0[_0x266a('0x4b')],md5(_0x21a9c0['uniqueid']));if(_0x35b111&&_0x35b111['monitor_format']){logger[_0x266a('0x12')](_0x266a('0x4c'),_0x266a('0x4d'));_0x21a9c0[_0x266a('0x4e')]=_0x3f9c60;}else if(_0x21ffc0&&_0x21ffc0[_0x266a('0x4f')]&&_0x21ffc0[_0x266a('0x4f')]!==_0x266a('0x50')){logger[_0x266a('0x12')]('[OUTBOUND]',_0x266a('0x4d'));_0x21a9c0[_0x266a('0x4e')]=_0x3f9c60;}else{_0x21a9c0[_0x266a('0x4e')]='';}return getAdminId(_0xb3456b,_0x2caa3f,_0x286d2c,_0x352992)['then'](getUser(_0x2caa3f,_0x286d2c,_0x352992))[_0x266a('0xe')](getEndUser(_0x2caa3f,_0x286d2c,_0x352992))[_0x266a('0xe')](getTicket(_0x2caa3f,_0x286d2c,_0x352992,_0x58be69,_0x21a9c0))[_0x266a('0xe')](function(_0x3d7a11){logger['info'](util[_0x266a('0x24')](_0x266a('0x51'),_0x3d7a11['ticketId']));if(_0x2caa3f!==_0x266a('0x48')){logger[_0x266a('0x12')]('['+[_0x2caa3f[_0x266a('0x16')]()]+']',_0x266a('0x52'));emit(_0x352992,_0x318b05[_0x266a('0x53')],_0x3d7a11[_0x266a('0x28')]);}})[_0x266a('0x14')](function(_0x3524cc){logger[_0x266a('0x15')]('['+[_0x2caa3f[_0x266a('0x16')]()]+_0x266a('0x54'),util[_0x266a('0x55')](_0x3524cc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdfc5=['&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','contact','Creating\x20new\x20task','/api/tasks','getString','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%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','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','userEmail','agentEmail','userId','User\x20found:','Admin\x20selected','error','/api/lookup?q=','&f='];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xdfc5,0x1e4));var _0x5dfc=function(_0x105a01,_0x3bf5a9){_0x105a01=_0x105a01-0x0;var _0x2161e6=_0xdfc5[_0x105a01];return _0x2161e6;};'use strict';var _=require(_0x5dfc('0x0'));var rp=require(_0x5dfc('0x1'));var md5=require(_0x5dfc('0x2'));var util=require(_0x5dfc('0x3'));var moment=require(_0x5dfc('0x4'));var Promise=require(_0x5dfc('0x5'));var Redis=require(_0x5dfc('0x6'));var intUtil=require(_0x5dfc('0x7'));var config=require(_0x5dfc('0x8'));var logger=require('../../../../config/logger')(_0x5dfc('0x9'));config[_0x5dfc('0xa')]=_['defaults'](config[_0x5dfc('0xa')],{'host':_0x5dfc('0xb'),'port':0x18eb});var io=require(_0x5dfc('0xc'))(new Redis(config[_0x5dfc('0xa')]));function getAdminId(_0x1db52b,_0x66c5cc,_0x1a54d4,_0x4e9809){return new Promise(function(_0x40aef6,_0x450b48){var _0x2d5f34=![];var _0xa8b720={'method':_0x5dfc('0xd'),'uri':_0x4e9809+_0x5dfc('0xe'),'json':!![]};_0xa8b720[_0x5dfc('0xf')]=_0x1a54d4;logger[_0x5dfc('0x10')](_0x5dfc('0x11'));return rp(_0xa8b720)[_0x5dfc('0x12')](function(_0x42f5cf){if(_0x42f5cf){var _0x3fe5d7=_0x42f5cf[_0x5dfc('0x13')];var _0x335ce2=null;for(_0x335ce2=0x0;_0x335ce2<_0x3fe5d7[_0x5dfc('0x14')];_0x335ce2++){if(_0x3fe5d7[_0x335ce2][_0x5dfc('0x15')]===_0x1db52b[_0x5dfc('0x16')]){_0x1db52b[_0x5dfc('0x17')]=_0x3fe5d7[_0x335ce2]['id'];_0x2d5f34=!![];}}if(_0x2d5f34){logger['info'](_0x5dfc('0x18'),_0x1db52b[_0x5dfc('0x17')]);_0x40aef6(_0x1db52b);}else{_0x450b48({'statusCode':0x194,'message':_0x5dfc('0x19')});}}else{_0x450b48({'statusCode':0x194,'message':_0x5dfc('0x19')});}})[_0x5dfc('0x1a')](function(_0x3e3b1c){logger['error']('['+[_0x66c5cc[_0x5dfc('0x1b')]()]+']',_0x3e3b1c[_0x5dfc('0x1c')]);_0x450b48(_0x3e3b1c);});});}function getUser(_0x4e0652,_0x5e5f5e,_0x454677){return function(_0x552a10){return new Promise(function(_0x5d0f2f,_0x578520){var _0x23bd5e={'method':_0x5dfc('0xd'),'uri':_0x454677+'/api/selector/owners','json':!![]};_0x23bd5e[_0x5dfc('0xf')]=_0x5e5f5e;logger[_0x5dfc('0x10')](_0x5dfc('0x1d'));return rp(_0x23bd5e)[_0x5dfc('0x12')](function(_0x336752){if(_0x336752){var _0x3c90e2=_0x336752[_0x5dfc('0x13')];var _0x38f08c=![];var _0x1e5353=null;if(_0x552a10['agentEmail']!==null){logger['info']('Getting\x20user\x20with\x20email',_0x552a10['agentEmail']);_0x552a10[_0x5dfc('0x1e')]=_0x552a10[_0x5dfc('0x1f')];for(_0x1e5353=0x0;_0x1e5353<_0x3c90e2[_0x5dfc('0x14')];_0x1e5353++){if(_0x3c90e2[_0x1e5353]['email']===_0x552a10[_0x5dfc('0x1f')]){_0x38f08c=!![];_0x552a10[_0x5dfc('0x20')]=_0x3c90e2[_0x1e5353]['id'];logger[_0x5dfc('0x10')](_0x5dfc('0x21'),_0x552a10['userId']);}}}if(!_0x38f08c){logger[_0x5dfc('0x10')](_0x5dfc('0x22'));_0x552a10['userEmail']=_0x552a10[_0x5dfc('0x16')];_0x552a10[_0x5dfc('0x20')]=_0x552a10[_0x5dfc('0x17')];_0x38f08c=!![];}if(_0x38f08c){_0x5d0f2f(_0x552a10);}else{_0x578520({'statusCode':0x194,'message':_0x5dfc('0x19')});}}else{_0x578520({'statusCode':0x194,'message':_0x5dfc('0x19')});}})[_0x5dfc('0x1a')](function(_0x19c2f7){logger[_0x5dfc('0x23')]('['+[_0x4e0652[_0x5dfc('0x1b')]()]+']',_0x19c2f7[_0x5dfc('0x1c')]);_0x578520(_0x19c2f7);});});};}function searchContact(_0x150e9f,_0x12b3b8,_0xb0f71f,_0x25854a){return new Promise(function(_0xfec02,_0x3ef8f9){var _0x19dec6={'method':_0x5dfc('0xd'),'headers':_0x12b3b8,'uri':_0x150e9f+_0x5dfc('0x24')+_0x25854a+_0x5dfc('0x25')+_0xb0f71f+_0x5dfc('0x26'),'json':!![]};rp(_0x19dec6)[_0x5dfc('0x12')](function(_0x1a9570){var _0x2be06b=_[_0x5dfc('0x27')](_0x1a9570[_0x5dfc('0x28')]['contacts'],[_0xb0f71f,_0x25854a]);_0xfec02(_0x2be06b);})['catch'](function(_0x57f855){_0x3ef8f9(_0x57f855);});});}function getEndUser(_0x51a8bf,_0x43f34c,_0x33ba4d){return function(_0x214d9c){return new Promise(function(_0x5a5d0b,_0x783dbc){logger[_0x5dfc('0x10')](util[_0x5dfc('0x29')](_0x5dfc('0x2a'),_0x214d9c[_0x5dfc('0x2b')]));searchContact(_0x33ba4d,_0x43f34c,'mobile_number',_0x214d9c['contactNumber'])['then'](function(_0x38c4a6){if(_0x38c4a6){_0x214d9c[_0x5dfc('0x2c')]=_0x38c4a6['id'];logger[_0x5dfc('0x10')](_0x5dfc('0x2d'),_0x214d9c[_0x5dfc('0x2c')]);return _0x5a5d0b(_0x214d9c);}searchContact(_0x33ba4d,_0x43f34c,_0x5dfc('0x2e'),_0x214d9c[_0x5dfc('0x2b')])['then'](function(_0x5320aa){if(_0x5320aa){_0x214d9c[_0x5dfc('0x2c')]=_0x5320aa['id'];logger[_0x5dfc('0x10')](_0x5dfc('0x2f'),_0x214d9c[_0x5dfc('0x2c')]);return _0x5a5d0b(_0x214d9c);}createEndUser(_0x214d9c,_0x51a8bf,_0x43f34c,_0x33ba4d)[_0x5dfc('0x12')](function(_0x4ecb11){logger[_0x5dfc('0x10')](_0x5dfc('0x30'),_0x4ecb11['endUserId']);return _0x5a5d0b(_0x4ecb11);});});})[_0x5dfc('0x1a')](function(_0x18ba93){_0x783dbc(_0x18ba93);});});};}function createEndUser(_0x32b16b,_0x44bd64,_0x3dc803,_0xebab01){return new Promise(function(_0xc41c0f,_0x16c38f){var _0x172ff8=moment();var _0x1b7250={'method':'POST','uri':_0xebab01+_0x5dfc('0x31'),'body':{'contact':{'last_name':_0x32b16b[_0x5dfc('0x2b')],'work_number':_0x32b16b['contactNumber'],'mobile_number':_0x32b16b[_0x5dfc('0x2b')],'owner_id':_0x32b16b[_0x5dfc('0x20')],'created_at':_0x172ff8[_0x5dfc('0x29')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x1b7250[_0x5dfc('0xf')]=_0x3dc803;logger[_0x5dfc('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x1b7250)['then'](function(_0x1c719f){_0x32b16b[_0x5dfc('0x2c')]=_0x1c719f[_0x5dfc('0x32')]['id'];_0xc41c0f(_0x32b16b);})[_0x5dfc('0x1a')](function(_0x44da70){logger[_0x5dfc('0x23')]('['+[_0x44bd64['toUpperCase']()]+']',_0x44da70[_0x5dfc('0x1c')]);_0x16c38f(_0x44da70[_0x5dfc('0x1c')]);});});}function getTicket(_0x43ccd5,_0x332636,_0x4217ce,_0x5741e9,_0x4b1040){return function(_0x32d4c2){logger[_0x5dfc('0x10')](_0x5dfc('0x33'));return new Promise(function(_0x41c6b4,_0xe6a20f){var _0x2de343=moment();var _0x4db76d={'method':'POST','uri':_0x4217ce+_0x5dfc('0x34'),'body':{'title':intUtil[_0x5dfc('0x35')](_0x5741e9['Subjects'],_0x4b1040,'\x20'),'description':intUtil[_0x5dfc('0x35')](_0x5741e9['Descriptions'],_0x4b1040,'\x0a'),'owner_id':_0x32d4c2[_0x5dfc('0x20')],'creater_id':_0x32d4c2[_0x5dfc('0x17')],'targetable_id':_0x32d4c2[_0x5dfc('0x2c')],'targetable_type':_0x5dfc('0x36'),'created_at':_0x2de343['format'](_0x5dfc('0x37')),'due_date':_0x2de343['add'](0x1e,'m')[_0x5dfc('0x29')](_0x5dfc('0x37'))},'json':!![]};_0x4db76d['headers']=_0x332636;return rp(_0x4db76d)[_0x5dfc('0x12')](function(_0x2ebace){_0x32d4c2[_0x5dfc('0x38')]=_0x2ebace[_0x5dfc('0x39')]['id'];logger[_0x5dfc('0x10')](_0x5dfc('0x3a'),_0x32d4c2[_0x5dfc('0x38')]);_0x41c6b4(_0x32d4c2);})[_0x5dfc('0x1a')](function(_0x55cf18){logger[_0x5dfc('0x23')]('['+[_0x43ccd5[_0x5dfc('0x1b')]()]+']',_0x55cf18['message']);_0xe6a20f(_0x55cf18[_0x5dfc('0x1c')]);});});};}function emit(_0x3677fb,_0x19b2fc,_0x475806){var _0x4141ed={'uri':_0x3677fb+_0x5dfc('0x3b')+_0x475806};io['to'](util[_0x5dfc('0x29')]('user:%s',_0x19b2fc))[_0x5dfc('0x3c')](_0x5dfc('0x3d'),_0x4141ed);}exports['cs']=function(_0x42163f,_0x580e4b,_0x5642d9,_0x4b3991,_0x21eb2d,_0x1c2058,_0x5a3a38,_0x56eb12){var _0x35ce22={};var _0xb97d7c={'Authorization':_0x5dfc('0x3e')+_0x1c2058[_0x5dfc('0x3f')]};_0x1c2058[_0x5dfc('0x40')]=intUtil['stripTrailingSlash'](_0x1c2058[_0x5dfc('0x40')]);_0x1c2058[_0x5dfc('0x41')]=intUtil[_0x5dfc('0x42')](_0x1c2058[_0x5dfc('0x41')]);var _0x5212cd=_0x1c2058['remoteUri'];_0x35ce22[_0x5dfc('0x16')]=_0x1c2058[_0x5dfc('0x43')];_0x35ce22['contactNumber']=_0x56eb12[_0x5dfc('0x44')]()==='outbound'?_0x580e4b[_0x5dfc('0x45')]:_0x580e4b[_0x5dfc('0x46')];_0x35ce22[_0x5dfc('0x47')]=_0x56eb12===_0x5dfc('0x48')||_0x56eb12===_0x5dfc('0x49')?_0x5dfc('0x48'):_0x5dfc('0x4a');if(_0x4b3991){_0x35ce22[_0x5dfc('0x1f')]=_0x4b3991['email'];}var _0x4c8693=util[_0x5dfc('0x29')](_0x5dfc('0x4b'),_0x1c2058['serverUrl'],_0x580e4b[_0x5dfc('0x4c')],md5(_0x580e4b[_0x5dfc('0x4c')]));if(_0x21eb2d&&_0x21eb2d[_0x5dfc('0x4d')]){logger[_0x5dfc('0x10')](_0x5dfc('0x4e'),_0x5dfc('0x4f'));_0x580e4b[_0x5dfc('0x50')]=_0x4c8693;}else if(_0x5a3a38&&_0x5a3a38[_0x5dfc('0x51')]&&_0x5a3a38[_0x5dfc('0x51')]!==_0x5dfc('0x52')){logger[_0x5dfc('0x10')](_0x5dfc('0x53'),_0x5dfc('0x4f'));_0x580e4b[_0x5dfc('0x50')]=_0x4c8693;}else{_0x580e4b[_0x5dfc('0x50')]='';}return getAdminId(_0x35ce22,_0x56eb12,_0xb97d7c,_0x5212cd)[_0x5dfc('0x12')](getUser(_0x56eb12,_0xb97d7c,_0x5212cd))[_0x5dfc('0x12')](getEndUser(_0x56eb12,_0xb97d7c,_0x5212cd))[_0x5dfc('0x12')](getTicket(_0x56eb12,_0xb97d7c,_0x5212cd,_0x5642d9,_0x580e4b))[_0x5dfc('0x12')](function(_0x2ed130){logger[_0x5dfc('0x10')](util['format'](_0x5dfc('0x54'),_0x2ed130[_0x5dfc('0x38')]));if(_0x56eb12!==_0x5dfc('0x49')){logger['info']('['+[_0x56eb12[_0x5dfc('0x1b')]()]+']',_0x5dfc('0x55'));emit(_0x5212cd,_0x4b3991[_0x5dfc('0x56')],_0x2ed130[_0x5dfc('0x2c')]);}})[_0x5dfc('0x1a')](function(_0x5e0256){logger['error']('['+[_0x56eb12[_0x5dfc('0x1b')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x5e0256,{'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 059bc2f..24a6802 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 _0x0b7b=['data2','find','data3','queue','outbound','log','EVENT\x20UNKNOWN','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x0b7b,0x114));var _0xb0b7=function(_0x55ef14,_0x4a9ecd){_0x55ef14=_0x55ef14-0x0;var _0x66e49c=_0x0b7b[_0x55ef14];return _0x66e49c;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xb0b7('0x0'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xb0b7('0x1'));var zoho=require(_0xb0b7('0x2'));var desk=require(_0xb0b7('0x3'));var vtiger=require(_0xb0b7('0x4'));var servicenow=require(_0xb0b7('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0xb0b7('0x6'));var integrations=[_0xb0b7('0x7'),_0xb0b7('0x8'),_0xb0b7('0x9'),_0xb0b7('0xa'),_0xb0b7('0xb'),_0xb0b7('0xc'),_0xb0b7('0xd'),_0xb0b7('0xe'),_0xb0b7('0xf'),_0xb0b7('0x10')];exports[_0xb0b7('0x11')]=function(_0x13934d,_0x407781,_0x174a60,_0x5ac47e,_0x198e25,_0x1614cd){if(_0x174a60){if(_[_0xb0b7('0x12')](integrations,_0x13934d[_0xb0b7('0x13')][_0xb0b7('0x14')]())){try{var _0x1f02fc=null;var _0x391005='';var _0x5a6d1b=_0x174a60[_0x13934d[_0xb0b7('0x13')]['toLowerCase']()];if(_0x5a6d1b){var _0x8967b=_0x5a6d1b[_0x13934d[_0xb0b7('0x15')]];if(_0x8967b){var _0x5b8215=_[_0xb0b7('0x16')](_0x8967b['Configurations'],{'id':parseInt(_0x13934d[_0xb0b7('0x17')],0xa)});if(_0x5b8215){if(_0x5ac47e){if(_0x198e25&&_0x407781[_0xb0b7('0x18')]){_0x391005=_0xb0b7('0x18');}else if(_0x407781['routeId']){_0x391005=_0xb0b7('0x19');}else{console[_0xb0b7('0x1a')](_0xb0b7('0x1b'),_0x407781);}}else{_0x391005='unmanaged';}switch(_0x13934d[_0xb0b7('0x13')]['toLowerCase']()){case _0xb0b7('0x7'):zendesk[_0x391005](_0x13934d,_0x407781,_0x5b8215,_0x5ac47e,_0x198e25,_0x8967b,_0x1614cd);break;case'salesforce':salesforce[_0x391005](_0x13934d,_0x407781,_0x5b8215,_0x5ac47e,_0x198e25,_0x8967b,_0x1614cd);break;case _0xb0b7('0x9'):sugarcrm[_0x391005](_0x13934d,_0x407781,_0x5b8215,_0x5ac47e,_0x198e25,_0x8967b,_0x1614cd);break;case _0xb0b7('0xa'):freshdesk[_0x391005](_0x13934d,_0x407781,_0x5b8215,_0x5ac47e,_0x198e25,_0x8967b,_0x1614cd);break;case _0xb0b7('0xb'):zoho[_0x391005](_0x13934d,_0x407781,_0x5b8215,_0x5ac47e,_0x198e25,_0x8967b,_0x1614cd);break;case _0xb0b7('0xc'):desk[_0x391005](_0x13934d,_0x407781,_0x5b8215,_0x5ac47e,_0x198e25,_0x8967b,_0x1614cd);break;case _0xb0b7('0xd'):vtiger[_0x391005](_0x13934d,_0x407781,_0x5b8215,_0x5ac47e,_0x198e25,_0x8967b,_0x1614cd);break;case _0xb0b7('0xf'):freshsales['cs'](_0x13934d,_0x407781,_0x5b8215,_0x5ac47e,_0x198e25,_0x8967b,_0x1614cd,_0x391005);break;case _0xb0b7('0x10'):servicenow['cs'](_0x13934d,_0x407781,_0x5b8215,_0x5ac47e,_0x198e25,_0x8967b,_0x1614cd,_0x391005);break;case _0xb0b7('0xe'):dynamics365['cs'](_0x13934d,_0x407781,_0x5b8215,_0x5ac47e,_0x198e25,_0x8967b,_0x1614cd,_0x391005);break;default:console[_0xb0b7('0x1a')]('unknown\x20integration');}}else{_0x1f02fc=require(_0xb0b7('0x1c'))(_0x13934d[_0xb0b7('0x13')]['toLowerCase']());_0x1f02fc[_0xb0b7('0x1d')](_0xb0b7('0x1e'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x13934d[_0xb0b7('0x13')][_0xb0b7('0x14')](),_0x13934d['data3']));}}else{_0x1f02fc=require(_0xb0b7('0x1c'))(_0x13934d[_0xb0b7('0x13')][_0xb0b7('0x14')]());_0x1f02fc[_0xb0b7('0x1d')](_0xb0b7('0x1e'),util[_0xb0b7('0x1f')](_0xb0b7('0x20'),_0x13934d[_0xb0b7('0x13')]['toLowerCase'](),_0x13934d['data2']));}}else{}}catch(_0x33966a){console[_0xb0b7('0x1d')](_0x33966a);}}}}; \ No newline at end of file +var _0xe992=['[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','./salesforce','./sugarcrm','./zoho','./desk','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration','../../../../config/logger','data1','error'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0xe992,0x1e5));var _0x2e99=function(_0x1766f7,_0x3d9b2b){_0x1766f7=_0x1766f7-0x0;var _0x5b8d28=_0xe992[_0x1766f7];return _0x5b8d28;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x2e99('0x0'));var sugarcrm=require(_0x2e99('0x1'));var freshdesk=require('./freshdesk');var zoho=require(_0x2e99('0x2'));var desk=require(_0x2e99('0x3'));var vtiger=require('./vtiger');var servicenow=require(_0x2e99('0x4'));var dynamics365=require(_0x2e99('0x5'));var freshsales=require('./freshsales');var integrations=[_0x2e99('0x6'),_0x2e99('0x7'),_0x2e99('0x8'),_0x2e99('0x9'),_0x2e99('0xa'),'desk',_0x2e99('0xb'),_0x2e99('0xc'),_0x2e99('0xd'),_0x2e99('0xe')];exports[_0x2e99('0xf')]=function(_0xf4adb8,_0x459959,_0x5e738,_0x1ccf26,_0x57b8af,_0x4a59c4){if(_0x5e738){if(_[_0x2e99('0x10')](integrations,_0xf4adb8['data1'][_0x2e99('0x11')]())){try{var _0x37156d=null;var _0x4dbaf7='';var _0x3886a5=_0x5e738[_0xf4adb8['data1'][_0x2e99('0x11')]()];if(_0x3886a5){var _0x12d798=_0x3886a5[_0xf4adb8[_0x2e99('0x12')]];if(_0x12d798){var _0x4c5f37=_[_0x2e99('0x13')](_0x12d798[_0x2e99('0x14')],{'id':parseInt(_0xf4adb8[_0x2e99('0x15')],0xa)});if(_0x4c5f37){if(_0x1ccf26){if(_0x57b8af&&_0x459959[_0x2e99('0x16')]){_0x4dbaf7=_0x2e99('0x16');}else if(_0x459959[_0x2e99('0x17')]){_0x4dbaf7=_0x2e99('0x18');}else{console[_0x2e99('0x19')](_0x2e99('0x1a'),_0x459959);}}else{_0x4dbaf7=_0x2e99('0x1b');}switch(_0xf4adb8['data1'][_0x2e99('0x11')]()){case _0x2e99('0x6'):zendesk[_0x4dbaf7](_0xf4adb8,_0x459959,_0x4c5f37,_0x1ccf26,_0x57b8af,_0x12d798,_0x4a59c4);break;case _0x2e99('0x7'):salesforce[_0x4dbaf7](_0xf4adb8,_0x459959,_0x4c5f37,_0x1ccf26,_0x57b8af,_0x12d798,_0x4a59c4);break;case _0x2e99('0x8'):sugarcrm[_0x4dbaf7](_0xf4adb8,_0x459959,_0x4c5f37,_0x1ccf26,_0x57b8af,_0x12d798,_0x4a59c4);break;case _0x2e99('0x9'):freshdesk[_0x4dbaf7](_0xf4adb8,_0x459959,_0x4c5f37,_0x1ccf26,_0x57b8af,_0x12d798,_0x4a59c4);break;case _0x2e99('0xa'):zoho[_0x4dbaf7](_0xf4adb8,_0x459959,_0x4c5f37,_0x1ccf26,_0x57b8af,_0x12d798,_0x4a59c4);break;case _0x2e99('0x1c'):desk[_0x4dbaf7](_0xf4adb8,_0x459959,_0x4c5f37,_0x1ccf26,_0x57b8af,_0x12d798,_0x4a59c4);break;case _0x2e99('0xb'):vtiger[_0x4dbaf7](_0xf4adb8,_0x459959,_0x4c5f37,_0x1ccf26,_0x57b8af,_0x12d798,_0x4a59c4);break;case _0x2e99('0xd'):freshsales['cs'](_0xf4adb8,_0x459959,_0x4c5f37,_0x1ccf26,_0x57b8af,_0x12d798,_0x4a59c4,_0x4dbaf7);break;case'servicenow':servicenow['cs'](_0xf4adb8,_0x459959,_0x4c5f37,_0x1ccf26,_0x57b8af,_0x12d798,_0x4a59c4,_0x4dbaf7);break;case _0x2e99('0xc'):dynamics365['cs'](_0xf4adb8,_0x459959,_0x4c5f37,_0x1ccf26,_0x57b8af,_0x12d798,_0x4a59c4,_0x4dbaf7);break;default:console[_0x2e99('0x19')](_0x2e99('0x1d'));}}else{_0x37156d=require(_0x2e99('0x1e'))(_0xf4adb8[_0x2e99('0x1f')][_0x2e99('0x11')]());_0x37156d[_0x2e99('0x20')](_0x2e99('0x21'),util[_0x2e99('0x22')](_0x2e99('0x23'),_0xf4adb8[_0x2e99('0x1f')][_0x2e99('0x11')](),_0xf4adb8[_0x2e99('0x15')]));}}else{_0x37156d=require(_0x2e99('0x1e'))(_0xf4adb8['data1'][_0x2e99('0x11')]());_0x37156d[_0x2e99('0x20')]('[EXEC]',util['format'](_0x2e99('0x24'),_0xf4adb8[_0x2e99('0x1f')][_0x2e99('0x11')](),_0xf4adb8[_0x2e99('0x12')]));}}else{}}catch(_0x1c4999){console['error'](_0x1c4999);}}}}; \ 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 d244200..4579709 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 _0x26fb=['toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','includes','string','picklist','idField','toString','variable','variableName','Variable','name','securityToken','remoteUri','https://login.salesforce.com','clientId','username','Connection\x20established.','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','isNil','calleridnum','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','localhost','socket.io-emitter','redis','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','IsReminderSet','IsRecurrence','endUserType','lead','account','Case','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','execute','then','length','Email','info','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','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','$or','Account','Lead','contact','first','Name','Phone','type'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x26fb,0x134));var _0xb26f=function(_0x41e118,_0x413436){_0x41e118=_0x41e118-0x0;var _0xf26001=_0x26fb[_0x41e118];return _0xf26001;};'use strict';var _=require(_0xb26f('0x0'));var rp=require(_0xb26f('0x1'));var moment=require(_0xb26f('0x2'));var BPromise=require('bluebird');var md5=require(_0xb26f('0x3'));var jsforce=require(_0xb26f('0x4'));var util=require(_0xb26f('0x5'));var Redis=require(_0xb26f('0x6'));var intUtil=require('./util');var config=require(_0xb26f('0x7'));var logger=require(_0xb26f('0x8'))(_0xb26f('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0xb26f('0xa'),'port':0x18eb});var io=require(_0xb26f('0xb'))(new Redis(config[_0xb26f('0xc')]));function emit(_0x2f878a,_0x667af8,_0x2333da){io['to'](_0x2f878a)['emit'](_0x667af8,_0x2333da);}function getTicket(_0x2d5a1e,_0x1e87f8,_0x16ad60,_0x3dc9f2,_0x475fd6,_0x41a88a,_0x47fb93,_0x20109a){var _0xd94cc1=Object[_0xb26f('0xd')]({},{'OwnerId':_0x1e87f8['id'],'Subject':intUtil[_0xb26f('0xe')](_0x3dc9f2[_0xb26f('0xf')],_0x475fd6,'\x20'),'Description':intUtil[_0xb26f('0xe')](_0x3dc9f2[_0xb26f('0x10')],_0x475fd6,'\x0a')},getCustomFields(_0x41a88a,_0x475fd6));if(_0x16ad60){if(_0x3dc9f2[_0xb26f('0x11')]==='Task'){_0xd94cc1[_0xb26f('0x12')]=moment['utc']();_0xd94cc1[_0xb26f('0x13')]=![];_0xd94cc1[_0xb26f('0x14')]=![];if(_0x16ad60[_0xb26f('0x15')]==='contact'||_0x16ad60['endUserType']===_0xb26f('0x16')){_0xd94cc1['WhoId']=_0x16ad60['id'];}else if(_0x16ad60['endUserType']===_0xb26f('0x17')){_0xd94cc1['WhatId']=_0x16ad60['id'];}}else if(_0x3dc9f2['ticketType']===_0xb26f('0x18')){if(_0x16ad60[_0xb26f('0x15')]==='contact'){_0xd94cc1['ContactId']=_0x16ad60['id'];}else if(_0x16ad60[_0xb26f('0x15')]===_0xb26f('0x17')){_0xd94cc1[_0xb26f('0x19')]=_0x16ad60['id'];}else if(_0x16ad60[_0xb26f('0x15')]===_0xb26f('0x16')&&_0x3dc9f2[_0xb26f('0x1a')]){_0xd94cc1[_0x3dc9f2[_0xb26f('0x1a')]]=_0x16ad60['id'];}else{logger['info'](_0xb26f('0x1b'));}}}return _0x47fb93[_0xb26f('0x1c')](_0x3dc9f2['ticketType'])[_0xb26f('0x1d')](_0xd94cc1);}function getUser(_0x455c15,_0x4326e4,_0x3aebce){if(!_['isNil'](_0x4326e4)&&intUtil[_0xb26f('0x1e')](_0x4326e4)){var _0x466434={'Email':_0x4326e4};var _0x2a2ee9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3aebce['sobject'](_0xb26f('0x1f'))[_0xb26f('0x20')](_0x466434,_0x2a2ee9)[_0xb26f('0x21')]()[_0xb26f('0x22')](function(_0x437570){if(_0x437570[_0xb26f('0x23')]){var _0x27c0b7=_[_0xb26f('0x20')](_0x437570,function(_0x50c34d){return _0x50c34d[_0xb26f('0x24')]===_0x4326e4;});if(_0x27c0b7){logger[_0xb26f('0x25')]('Agent\x20%s\x20found.',_0x4326e4);return BPromise[_0xb26f('0x26')]({'id':_0x27c0b7['Id'],'name':_0x27c0b7['Name']});}}else{logger[_0xb26f('0x25')](_0xb26f('0x27'),_0x4326e4);return _0x3aebce[_0xb26f('0x28')]()[_0xb26f('0x22')](function(_0x358111){return BPromise[_0xb26f('0x26')]({'id':_0x358111[_0xb26f('0x29')],'name':_0x358111['display_name']});});}});}else{logger[_0xb26f('0x25')](_0xb26f('0x27'),_0x4326e4);return _0x3aebce['identity']()[_0xb26f('0x22')](function(_0xf90a46){return BPromise['resolve']({'id':_0xf90a46[_0xb26f('0x29')],'name':_0xf90a46[_0xb26f('0x2a')]});});}}function getEndUser(_0x2a82e3,_0x12dfff,_0x50fe52,_0x311174,_0x4237a1){var _0x41cc91={'$or':{'Phone':_0x311174}};var _0x38fa1e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info'](_0xb26f('0x2b'),_0x311174,_0x12dfff[_0xb26f('0x2c')]);switch(_0x12dfff['moduleSearch']){case _0xb26f('0x2d'):var _0x30e770=_[_0xb26f('0x2e')](_0x41cc91);if(_0x12dfff['additionalSearchContact']){var _0x50bc2f={};_0x50bc2f[_0x12dfff[_0xb26f('0x2f')]]=_0x311174;_[_0xb26f('0x30')](_0x30e770['$or'],_0x50bc2f);}return _0x4237a1['sobject'](_0xb26f('0x31'))[_0xb26f('0x20')](_0x30e770,_0x38fa1e)[_0xb26f('0x21')]()[_0xb26f('0x22')](function(_0x305da4){if(_0x305da4&&_0x305da4[_0xb26f('0x23')]){return _0x305da4;}else{var _0x3dcb2e=_[_0xb26f('0x2e')](_0x41cc91);if(_0x12dfff[_0xb26f('0x32')]){var _0x231446={};_0x231446[_0x12dfff['additionalSearchLead']]=_0x311174;_[_0xb26f('0x30')](_0x3dcb2e['$or'],_0x231446);}return _0x4237a1[_0xb26f('0x1c')]('Lead')['find'](_0x3dcb2e,_0x38fa1e);}});case _0xb26f('0x33'):var _0x5f0b3c=_[_0xb26f('0x2e')](_0x41cc91);if(_0x12dfff[_0xb26f('0x34')]){var _0x50bc2f={};_0x50bc2f[_0x12dfff[_0xb26f('0x34')]]=_0x311174;_[_0xb26f('0x30')](_0x5f0b3c[_0xb26f('0x35')],_0x50bc2f);}return _0x4237a1[_0xb26f('0x1c')](_0xb26f('0x36'))[_0xb26f('0x20')](_0x5f0b3c,_0x38fa1e)['execute']()['then'](function(_0x4dbd55){if(_0x4dbd55&&_0x4dbd55[_0xb26f('0x23')]){return _0x4dbd55;}else{var _0x1c415c=_[_0xb26f('0x2e')](_0x41cc91);if(_0x12dfff[_0xb26f('0x2f')]){var _0x5408e7={};_0x5408e7[_0x12dfff['additionalSearchContact']]=_0x311174;_[_0xb26f('0x30')](_0x1c415c[_0xb26f('0x35')],_0x5408e7);}return _0x4237a1['sobject'](_0xb26f('0x31'))[_0xb26f('0x20')](_0x1c415c,_0x38fa1e)[_0xb26f('0x22')](function(_0x77ff10){if(_0x77ff10&&_0x77ff10['length']){return _0x77ff10;}else{var _0x19e13e=_[_0xb26f('0x2e')](_0x41cc91);if(_0x12dfff['additionalSearchLead']){var _0x367eba={};_0x367eba[_0x12dfff[_0xb26f('0x32')]]=_0x311174;_[_0xb26f('0x30')](_0x19e13e[_0xb26f('0x35')],_0x367eba);}return _0x4237a1[_0xb26f('0x1c')](_0xb26f('0x37'))[_0xb26f('0x20')](_0x19e13e,_0x38fa1e);}});}});case _0xb26f('0x38'):var _0x30e770=_[_0xb26f('0x2e')](_0x41cc91);if(_0x12dfff[_0xb26f('0x2f')]){var _0x50bc2f={};_0x50bc2f[_0x12dfff[_0xb26f('0x2f')]]=_0x311174;_[_0xb26f('0x30')](_0x30e770['$or'],_0x50bc2f);}return _0x4237a1[_0xb26f('0x1c')](_0xb26f('0x31'))[_0xb26f('0x20')](_0x30e770,_0x38fa1e)[_0xb26f('0x21')]();case _0xb26f('0x16'):var _0x4662bc=_[_0xb26f('0x2e')](_0x41cc91);if(_0x12dfff[_0xb26f('0x32')]){var _0x50bc2f={};_0x50bc2f[_0x12dfff[_0xb26f('0x32')]]=_0x311174;_['merge'](_0x4662bc[_0xb26f('0x35')],_0x50bc2f);}return _0x4237a1[_0xb26f('0x1c')](_0xb26f('0x37'))[_0xb26f('0x20')](_0x4662bc,_0x38fa1e);case _0xb26f('0x17'):var _0x5f0b3c=_[_0xb26f('0x2e')](_0x41cc91);if(_0x12dfff['additionalSearchAccount']){var _0x50bc2f={};_0x50bc2f[_0x12dfff['additionalSearchAccount']]=_0x311174;_['merge'](_0x5f0b3c[_0xb26f('0x35')],_0x50bc2f);}return _0x4237a1[_0xb26f('0x1c')](_0xb26f('0x36'))['find'](_0x5f0b3c,_0x38fa1e);default:return null;}})[_0xb26f('0x22')](function(_0x1c77f0){if(_0x1c77f0&&_0x1c77f0[_0xb26f('0x23')]){var _0x28adf4=_[_0xb26f('0x39')](_0x1c77f0);if(_0x28adf4){return BPromise[_0xb26f('0x26')]({'id':_0x28adf4['Id'],'name':_0x28adf4[_0xb26f('0x3a')],'phone':_0x28adf4[_0xb26f('0x3b')],'endUserType':_0x28adf4['attributes'][_0xb26f('0x3c')][_0xb26f('0x3d')]()});}}})['then'](function(_0x5a86c7){if(_0x5a86c7){logger[_0xb26f('0x25')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x5a86c7['endUserType'],_0x311174);return BPromise[_0xb26f('0x26')](_0x5a86c7);}else{logger[_0xb26f('0x25')](_0xb26f('0x3e'),_0x311174);var _0x275c7c={'Phone':_0x311174};if(_0x12dfff[_0xb26f('0x3f')]){if(_0x12dfff[_0xb26f('0x3f')]===_0xb26f('0x38')){logger[_0xb26f('0x25')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x311174,_0x12dfff[_0xb26f('0x3f')]);_0x275c7c[_0xb26f('0x40')]=_0x50fe52!==_0xb26f('0x41')?_0x50fe52:util[_0xb26f('0x42')](_0xb26f('0x43'),_0x311174);}else if(_0x12dfff[_0xb26f('0x3f')]===_0xb26f('0x16')){logger[_0xb26f('0x25')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x311174,_0x12dfff['moduleCreate']);_0x275c7c[_0xb26f('0x40')]=_0x50fe52!==_0xb26f('0x41')?_0x50fe52:util[_0xb26f('0x42')]('Caller\x20-\x20%s',_0x311174);_0x275c7c[_0xb26f('0x44')]=_0xb26f('0x45');}else if(_0x12dfff['moduleCreate']===_0xb26f('0x17')){logger['info'](_0xb26f('0x46'),_0x311174,_0x12dfff['moduleCreate']);_0x275c7c[_0xb26f('0x3a')]=_0x50fe52!==_0xb26f('0x41')?_0x50fe52:util[_0xb26f('0x42')]('Caller\x20-\x20%s',_0x311174);}else{return null;}}return _0x4237a1['sobject'](_['upperFirst'](_0x12dfff[_0xb26f('0x3f')]))[_0xb26f('0x1d')](_0x275c7c)[_0xb26f('0x22')](function(_0x28f6cf){return BPromise[_0xb26f('0x26')]({'id':_0x28f6cf['id'],'endUserType':_0x12dfff[_0xb26f('0x3f')]});});}});}function getCustomFields(_0x292703,_0x3a8e20){var _0x4cf610={};if(_0x292703['length']>0x0){_['forEach'](_0x292703,function(_0x581638){if(_[_0xb26f('0x47')]([_0xb26f('0x48'),_0xb26f('0x49')],_0x581638[_0xb26f('0x3c')])&&_0x581638[_0xb26f('0x4a')]){_0x4cf610[_0x581638[_0xb26f('0x4a')]]=_0x581638['content'][_0xb26f('0x4b')]();}else if(_0x581638['type']===_0xb26f('0x4c')&&_0x581638[_0xb26f('0x4d')]&&_0x581638['idField']){_0x3a8e20[_0x581638[_0xb26f('0x4d')]]&&(_0x4cf610[_0x581638[_0xb26f('0x4a')]]=_0x3a8e20[_0x581638[_0xb26f('0x4d')]][_0xb26f('0x4b')]());}else if(_0x581638['type']==='customVariable'&&_0x581638[_0xb26f('0x4e')]&&_0x581638[_0xb26f('0x4e')][_0xb26f('0x4f')]&&_0x581638['idField']){_0x3a8e20[_0x581638[_0xb26f('0x4e')][_0xb26f('0x4f')][_0xb26f('0x3d')]()]&&(_0x4cf610[_0x581638[_0xb26f('0x4a')]]=_0x3a8e20[_0x581638[_0xb26f('0x4e')][_0xb26f('0x4f')][_0xb26f('0x3d')]()][_0xb26f('0x4b')]());}});}return _0x4cf610;}function getConnection(_0x3d080c){var _0xb9cd27=_0x3d080c['password']['concat'](_0x3d080c[_0xb26f('0x50')]);var _0x20bf7c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3d080c[_0xb26f('0x51')]||_0xb26f('0x52'),'clientId':_0x3d080c[_0xb26f('0x53')],'clientSecret':_0x3d080c['clientSecret']}});return _0x20bf7c['login'](_0x3d080c[_0xb26f('0x54')],_0xb9cd27)[_0xb26f('0x22')](function(){logger['info'](_0xb26f('0x55'));return _0x20bf7c;});}exports[_0xb26f('0x56')]=function(_0x27db67,_0x45fa7b,_0x3ec951,_0x1da1d7,_0x1d5e1b,_0x53b7ad){var _0x59235a,_0x56840d,_0x141631,_0x179ce4;_0x53b7ad['serverUrl']=intUtil[_0xb26f('0x57')](_0x53b7ad['serverUrl']);_0x53b7ad[_0xb26f('0x51')]=intUtil[_0xb26f('0x57')](_0x53b7ad[_0xb26f('0x51')]);if(_0x1d5e1b&&_0x1d5e1b[_0xb26f('0x58')]){logger[_0xb26f('0x25')](_0xb26f('0x59'),_0xb26f('0x5a'));_0x45fa7b['recordingURL']=util[_0xb26f('0x42')](_0xb26f('0x5b'),_0x53b7ad[_0xb26f('0x5c')],_0x45fa7b[_0xb26f('0x5d')],md5(_0x45fa7b[_0xb26f('0x5d')]));}else{_0x45fa7b[_0xb26f('0x5e')]='';}return getConnection(_0x53b7ad)[_0xb26f('0x22')](function(_0x5a52cf){_0x179ce4=_0x5a52cf;return getUser(_0x53b7ad,_0x1da1d7['email'],_0x179ce4);})[_0xb26f('0x22')](function(_0x1c500a){_0x59235a=_0x1c500a;return getEndUser(_0x53b7ad,_0x3ec951,_0x45fa7b['calleridname'],_0x45fa7b['calleridnum'],_0x179ce4);})['then'](function(_0x316bf3){_0x56840d=_0x316bf3;return getTicket(_0x53b7ad,_0x59235a,_0x56840d,_0x3ec951,_0x45fa7b,_0x3ec951[_0xb26f('0x5f')],_0x179ce4,_0xb26f('0x56'));})['then'](function(_0x5c0f15){_0x141631=_0x5c0f15;logger[_0xb26f('0x25')](_0xb26f('0x60'),_0x141631['id']);logger[_0xb26f('0x25')](_0xb26f('0x61'),_0x141631['id'],_0x1da1d7['name'],_0x53b7ad[_0xb26f('0x3c')]);switch(_0x53b7ad[_0xb26f('0x3c')]){case _0xb26f('0x62'):emit(util[_0xb26f('0x42')](_0xb26f('0x63'),_0x1da1d7['name']),_0xb26f('0x64'),{'recordId':_0x141631['id']});break;case _0xb26f('0x65'):emit(util[_0xb26f('0x42')](_0xb26f('0x63'),_0x1da1d7[_0xb26f('0x4f')]),_0xb26f('0x66'),{'uri':util['format'](_0xb26f('0x67'),_0x179ce4[_0xb26f('0x68')],_0x141631['id'])});break;default:logger['error'](_0xb26f('0x69'));}})[_0xb26f('0x6a')](function(_0x2609e0){logger[_0xb26f('0x6b')]('[QUEUE]',_0x2609e0);});};exports[_0xb26f('0x6c')]=function(_0x444778,_0x46bad9,_0x29f2a7,_0x19ecae,_0x136e0c,_0x326dfa,_0x2c9bd3){var _0x204223,_0x4ffd8c,_0x4d0ce4,_0x30ccae;_0x326dfa[_0xb26f('0x5c')]=intUtil[_0xb26f('0x57')](_0x326dfa['serverUrl']);_0x326dfa[_0xb26f('0x51')]=intUtil['stripTrailingSlash'](_0x326dfa[_0xb26f('0x51')]);if(_0x2c9bd3&&_0x2c9bd3[_0xb26f('0x6d')]&&_0x2c9bd3['recordingFormat']!=='none'){logger[_0xb26f('0x25')](_0xb26f('0x6e'),_0xb26f('0x5a'));_0x46bad9[_0xb26f('0x5e')]=util['format'](_0xb26f('0x5b'),_0x326dfa[_0xb26f('0x5c')],_0x46bad9['uniqueid'],md5(_0x46bad9[_0xb26f('0x5d')]));}return getConnection(_0x326dfa)['then'](function(_0x26d317){_0x30ccae=_0x26d317;return getUser(_0x326dfa,_0x19ecae[_0xb26f('0x6f')],_0x30ccae);})[_0xb26f('0x22')](function(_0x590857){_0x204223=_0x590857;return getEndUser(_0x326dfa,_0x29f2a7,_0x46bad9[_0xb26f('0x70')],_0x46bad9[_0xb26f('0x71')],_0x30ccae);})[_0xb26f('0x22')](function(_0x28ae63){_0x4ffd8c=_0x28ae63;return getTicket(_0x326dfa,_0x204223,_0x4ffd8c,_0x29f2a7,_0x46bad9,_0x29f2a7['Fields'],_0x30ccae,'outbound');})[_0xb26f('0x22')](function(_0x3fd258){_0x4d0ce4=_0x3fd258;logger[_0xb26f('0x25')](_0xb26f('0x72'),_0x4d0ce4['id']);logger['info'](_0xb26f('0x73'),_0x4d0ce4['id'],_0x19ecae[_0xb26f('0x4f')],_0x326dfa[_0xb26f('0x3c')]);switch(_0x326dfa['type']){case _0xb26f('0x62'):emit(util['format']('user:%s',_0x19ecae[_0xb26f('0x4f')]),_0xb26f('0x64'),{'recordId':_0x4d0ce4['id']});break;case'newTab':emit(util[_0xb26f('0x42')]('user:%s',_0x19ecae['name']),'trigger:browser:url',{'uri':util['format'](_0xb26f('0x67'),_0x30ccae[_0xb26f('0x68')],_0x4d0ce4['id'])});break;default:logger[_0xb26f('0x6b')](_0xb26f('0x6e'),_0xb26f('0x74'));}})[_0xb26f('0x6a')](function(_0x5936da){logger[_0xb26f('0x6b')]('[OUTBOUND]',_0x5936da);});};exports[_0xb26f('0x75')]=function(_0xac3ff7,_0x143155,_0x13ffce,_0x11ab31,_0x27a60b,_0x4a81db){var _0x137120,_0x34c934,_0x26d2e1,_0x1876e0;_0x4a81db[_0xb26f('0x5c')]=intUtil['stripTrailingSlash'](_0x4a81db[_0xb26f('0x5c')]);_0x4a81db[_0xb26f('0x51')]=intUtil[_0xb26f('0x57')](_0x4a81db[_0xb26f('0x51')]);if(_0x27a60b&&_0x27a60b['monitor_format']){logger[_0xb26f('0x25')]('['+_0x143155[_0xb26f('0x76')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x143155[_0xb26f('0x5e')]=util[_0xb26f('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a81db['serverUrl'],_0x143155[_0xb26f('0x5d')],md5(_0x143155[_0xb26f('0x5d')]));}else{_0x143155['recordingURL']='';}return getConnection(_0x4a81db)[_0xb26f('0x22')](function(_0x489398){_0x1876e0=_0x489398;if(!_[_0xb26f('0x77')](_0x11ab31)){return getUser(_0x4a81db,_0x11ab31['name'],_0x1876e0);}else{return getUser(_0x4a81db,null,_0x1876e0);}})[_0xb26f('0x22')](function(_0x4a90f6){_0x137120=_0x4a90f6;return getEndUser(_0x4a81db,_0x13ffce,_0x143155['calleridname'],_0x143155[_0xb26f('0x78')],_0x1876e0);})[_0xb26f('0x22')](function(_0x1ae0c6){_0x34c934=_0x1ae0c6;return getTicket(_0x4a81db,_0x137120,_0x34c934,_0x13ffce,_0x143155,_0x13ffce[_0xb26f('0x5f')],_0x1876e0);})[_0xb26f('0x22')](function(_0x56d680){_0x26d2e1=_0x56d680;logger[_0xb26f('0x25')]('['+_0x143155['lastevent'][_0xb26f('0x79')]()+']\x20Ticket\x20%s\x20created.',_0x26d2e1['id']);logger[_0xb26f('0x25')]('['+_0x143155['lastevent'][_0xb26f('0x79')]()+_0xb26f('0x7a'),_0x4a81db[_0xb26f('0x3c')]);})['catch'](function(_0x4ddff7){logger[_0xb26f('0x6b')]('['+_0x143155[_0xb26f('0x76')][_0xb26f('0x79')]()+']',_0x4ddff7);});}; \ No newline at end of file +var _0x86a1=['./util','../../../../config/environment','salesforce','redis','defaults','emit','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','account','WhatId','Case','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','length','Email','resolve','Name','identity','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','contact','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','create','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','instanceUrl','error','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis'];(function(_0x4c785b,_0x5c0e5d){var _0x33722d=function(_0x5d7d38){while(--_0x5d7d38){_0x4c785b['push'](_0x4c785b['shift']());}};_0x33722d(++_0x5c0e5d);}(_0x86a1,0x105));var _0x186a=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x86a1[_0x2d61b2];return _0x12df89;};'use strict';var _=require(_0x186a('0x0'));var rp=require(_0x186a('0x1'));var moment=require('moment');var BPromise=require(_0x186a('0x2'));var md5=require(_0x186a('0x3'));var jsforce=require(_0x186a('0x4'));var util=require(_0x186a('0x5'));var Redis=require(_0x186a('0x6'));var intUtil=require(_0x186a('0x7'));var config=require(_0x186a('0x8'));var logger=require('../../../../config/logger')(_0x186a('0x9'));config[_0x186a('0xa')]=_[_0x186a('0xb')](config[_0x186a('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x186a('0xa')]));function emit(_0x1180d7,_0x358c08,_0x257cb0){io['to'](_0x1180d7)[_0x186a('0xc')](_0x358c08,_0x257cb0);}function getTicket(_0x482467,_0x390d59,_0x2795d7,_0x1ee487,_0x2b4d1b,_0x13a4cb,_0x12d525,_0x310718){var _0xdd2867=Object[_0x186a('0xd')]({},{'OwnerId':_0x390d59['id'],'Subject':intUtil[_0x186a('0xe')](_0x1ee487[_0x186a('0xf')],_0x2b4d1b,'\x20'),'Description':intUtil[_0x186a('0xe')](_0x1ee487['Descriptions'],_0x2b4d1b,'\x0a')},getCustomFields(_0x13a4cb,_0x2b4d1b));if(_0x2795d7){if(_0x1ee487[_0x186a('0x10')]===_0x186a('0x11')){_0xdd2867[_0x186a('0x12')]=moment[_0x186a('0x13')]();_0xdd2867[_0x186a('0x14')]=![];_0xdd2867[_0x186a('0x15')]=![];if(_0x2795d7[_0x186a('0x16')]==='contact'||_0x2795d7[_0x186a('0x16')]==='lead'){_0xdd2867[_0x186a('0x17')]=_0x2795d7['id'];}else if(_0x2795d7['endUserType']===_0x186a('0x18')){_0xdd2867[_0x186a('0x19')]=_0x2795d7['id'];}}else if(_0x1ee487[_0x186a('0x10')]===_0x186a('0x1a')){if(_0x2795d7[_0x186a('0x16')]==='contact'){_0xdd2867['ContactId']=_0x2795d7['id'];}else if(_0x2795d7[_0x186a('0x16')]===_0x186a('0x18')){_0xdd2867[_0x186a('0x1b')]=_0x2795d7['id'];}else if(_0x2795d7['endUserType']===_0x186a('0x1c')&&_0x1ee487[_0x186a('0x1d')]){_0xdd2867[_0x1ee487[_0x186a('0x1d')]]=_0x2795d7['id'];}else{logger[_0x186a('0x1e')](_0x186a('0x1f'));}}}return _0x12d525[_0x186a('0x20')](_0x1ee487[_0x186a('0x10')])['create'](_0xdd2867);}function getUser(_0x34b28a,_0x2596d8,_0x1a13b4){if(!_[_0x186a('0x21')](_0x2596d8)&&intUtil[_0x186a('0x22')](_0x2596d8)){var _0x281e59={'Email':_0x2596d8};var _0x28c3c1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1a13b4[_0x186a('0x20')](_0x186a('0x23'))[_0x186a('0x24')](_0x281e59,_0x28c3c1)[_0x186a('0x25')]()[_0x186a('0x26')](function(_0x337793){if(_0x337793[_0x186a('0x27')]){var _0x10213a=_[_0x186a('0x24')](_0x337793,function(_0x480e51){return _0x480e51[_0x186a('0x28')]===_0x2596d8;});if(_0x10213a){logger[_0x186a('0x1e')]('Agent\x20%s\x20found.',_0x2596d8);return BPromise[_0x186a('0x29')]({'id':_0x10213a['Id'],'name':_0x10213a[_0x186a('0x2a')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2596d8);return _0x1a13b4[_0x186a('0x2b')]()[_0x186a('0x26')](function(_0x1e9fe8){return BPromise[_0x186a('0x29')]({'id':_0x1e9fe8['user_id'],'name':_0x1e9fe8['display_name']});});}});}else{logger['info'](_0x186a('0x2c'),_0x2596d8);return _0x1a13b4['identity']()[_0x186a('0x26')](function(_0x35317d){return BPromise[_0x186a('0x29')]({'id':_0x35317d[_0x186a('0x2d')],'name':_0x35317d[_0x186a('0x2e')]});});}}function getEndUser(_0x5d224e,_0x35570d,_0x94783c,_0x315a8f,_0x266822){var _0x191816={'$or':{'Phone':_0x315a8f}};var _0x41402e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x186a('0x26')](function(){logger[_0x186a('0x1e')](_0x186a('0x2f'),_0x315a8f,_0x35570d['moduleSearch']);switch(_0x35570d[_0x186a('0x30')]){case _0x186a('0x31'):var _0x4e8bd9=_[_0x186a('0x32')](_0x191816);if(_0x35570d[_0x186a('0x33')]){var _0x311896={};_0x311896[_0x35570d[_0x186a('0x33')]]=_0x315a8f;_[_0x186a('0x34')](_0x4e8bd9[_0x186a('0x35')],_0x311896);}return _0x266822[_0x186a('0x20')]('Contact')[_0x186a('0x24')](_0x4e8bd9,_0x41402e)[_0x186a('0x25')]()[_0x186a('0x26')](function(_0x2d2e90){if(_0x2d2e90&&_0x2d2e90['length']){return _0x2d2e90;}else{var _0x102366=_[_0x186a('0x32')](_0x191816);if(_0x35570d[_0x186a('0x36')]){var _0x561b41={};_0x561b41[_0x35570d[_0x186a('0x36')]]=_0x315a8f;_['merge'](_0x102366['$or'],_0x561b41);}return _0x266822[_0x186a('0x20')](_0x186a('0x37'))[_0x186a('0x24')](_0x102366,_0x41402e);}});case _0x186a('0x38'):var _0x11ffec=_[_0x186a('0x32')](_0x191816);if(_0x35570d['additionalSearchAccount']){var _0x311896={};_0x311896[_0x35570d[_0x186a('0x39')]]=_0x315a8f;_[_0x186a('0x34')](_0x11ffec[_0x186a('0x35')],_0x311896);}return _0x266822[_0x186a('0x20')](_0x186a('0x3a'))[_0x186a('0x24')](_0x11ffec,_0x41402e)[_0x186a('0x25')]()[_0x186a('0x26')](function(_0x37de3a){if(_0x37de3a&&_0x37de3a['length']){return _0x37de3a;}else{var _0x4fe1b9=_[_0x186a('0x32')](_0x191816);if(_0x35570d[_0x186a('0x33')]){var _0x34372f={};_0x34372f[_0x35570d['additionalSearchContact']]=_0x315a8f;_[_0x186a('0x34')](_0x4fe1b9[_0x186a('0x35')],_0x34372f);}return _0x266822[_0x186a('0x20')](_0x186a('0x3b'))[_0x186a('0x24')](_0x4fe1b9,_0x41402e)[_0x186a('0x26')](function(_0x1b65b1){if(_0x1b65b1&&_0x1b65b1['length']){return _0x1b65b1;}else{var _0x4dd7ce=_['cloneDeep'](_0x191816);if(_0x35570d[_0x186a('0x36')]){var _0x2ed8d5={};_0x2ed8d5[_0x35570d['additionalSearchLead']]=_0x315a8f;_[_0x186a('0x34')](_0x4dd7ce['$or'],_0x2ed8d5);}return _0x266822[_0x186a('0x20')](_0x186a('0x37'))[_0x186a('0x24')](_0x4dd7ce,_0x41402e);}});}});case _0x186a('0x3c'):var _0x4e8bd9=_[_0x186a('0x32')](_0x191816);if(_0x35570d[_0x186a('0x33')]){var _0x311896={};_0x311896[_0x35570d[_0x186a('0x33')]]=_0x315a8f;_[_0x186a('0x34')](_0x4e8bd9[_0x186a('0x35')],_0x311896);}return _0x266822[_0x186a('0x20')](_0x186a('0x3b'))[_0x186a('0x24')](_0x4e8bd9,_0x41402e)['execute']();case _0x186a('0x1c'):var _0x3358f8=_[_0x186a('0x32')](_0x191816);if(_0x35570d['additionalSearchLead']){var _0x311896={};_0x311896[_0x35570d[_0x186a('0x36')]]=_0x315a8f;_[_0x186a('0x34')](_0x3358f8[_0x186a('0x35')],_0x311896);}return _0x266822['sobject'](_0x186a('0x37'))['find'](_0x3358f8,_0x41402e);case _0x186a('0x18'):var _0x11ffec=_[_0x186a('0x32')](_0x191816);if(_0x35570d['additionalSearchAccount']){var _0x311896={};_0x311896[_0x35570d[_0x186a('0x39')]]=_0x315a8f;_[_0x186a('0x34')](_0x11ffec[_0x186a('0x35')],_0x311896);}return _0x266822['sobject']('Account')['find'](_0x11ffec,_0x41402e);default:return null;}})[_0x186a('0x26')](function(_0x3424bb){if(_0x3424bb&&_0x3424bb['length']){var _0xbe94a3=_[_0x186a('0x3d')](_0x3424bb);if(_0xbe94a3){return BPromise[_0x186a('0x29')]({'id':_0xbe94a3['Id'],'name':_0xbe94a3[_0x186a('0x2a')],'phone':_0xbe94a3[_0x186a('0x3e')],'endUserType':_0xbe94a3[_0x186a('0x3f')][_0x186a('0x40')][_0x186a('0x41')]()});}}})[_0x186a('0x26')](function(_0x1ce23d){if(_0x1ce23d){logger['info'](_0x186a('0x42'),_0x1ce23d[_0x186a('0x16')],_0x315a8f);return BPromise[_0x186a('0x29')](_0x1ce23d);}else{logger['info'](_0x186a('0x43'),_0x315a8f);var _0x5a1c70={'Phone':_0x315a8f};if(_0x35570d[_0x186a('0x44')]){if(_0x35570d[_0x186a('0x44')]==='contact'){logger[_0x186a('0x1e')](_0x186a('0x45'),_0x315a8f,_0x35570d[_0x186a('0x44')]);_0x5a1c70[_0x186a('0x46')]=_0x94783c!==''?_0x94783c:util[_0x186a('0x47')](_0x186a('0x48'),_0x315a8f);}else if(_0x35570d[_0x186a('0x44')]===_0x186a('0x1c')){logger[_0x186a('0x1e')](_0x186a('0x45'),_0x315a8f,_0x35570d[_0x186a('0x44')]);_0x5a1c70[_0x186a('0x46')]=_0x94783c!==_0x186a('0x49')?_0x94783c:util[_0x186a('0x47')](_0x186a('0x48'),_0x315a8f);_0x5a1c70[_0x186a('0x4a')]=_0x186a('0x4b');}else if(_0x35570d[_0x186a('0x44')]==='account'){logger[_0x186a('0x1e')](_0x186a('0x45'),_0x315a8f,_0x35570d[_0x186a('0x44')]);_0x5a1c70['Name']=_0x94783c!==_0x186a('0x49')?_0x94783c:util['format']('Caller\x20-\x20%s',_0x315a8f);}else{return null;}}return _0x266822[_0x186a('0x20')](_['upperFirst'](_0x35570d['moduleCreate']))[_0x186a('0x4c')](_0x5a1c70)[_0x186a('0x26')](function(_0x26ee6c){return BPromise['resolve']({'id':_0x26ee6c['id'],'endUserType':_0x35570d[_0x186a('0x44')]});});}});}function getCustomFields(_0x47080e,_0x3f9f30){var _0x36014f={};if(_0x47080e['length']>0x0){_[_0x186a('0x4d')](_0x47080e,function(_0x18bfe6){if(_[_0x186a('0x4e')]([_0x186a('0x4f'),_0x186a('0x50')],_0x18bfe6[_0x186a('0x40')])&&_0x18bfe6[_0x186a('0x51')]){_0x36014f[_0x18bfe6[_0x186a('0x51')]]=_0x18bfe6[_0x186a('0x52')][_0x186a('0x53')]();}else if(_0x18bfe6[_0x186a('0x40')]===_0x186a('0x54')&&_0x18bfe6[_0x186a('0x55')]&&_0x18bfe6[_0x186a('0x51')]){_0x3f9f30[_0x18bfe6[_0x186a('0x55')]]&&(_0x36014f[_0x18bfe6[_0x186a('0x51')]]=_0x3f9f30[_0x18bfe6[_0x186a('0x55')]][_0x186a('0x53')]());}else if(_0x18bfe6[_0x186a('0x40')]==='customVariable'&&_0x18bfe6[_0x186a('0x56')]&&_0x18bfe6[_0x186a('0x56')][_0x186a('0x57')]&&_0x18bfe6['idField']){_0x3f9f30[_0x18bfe6[_0x186a('0x56')][_0x186a('0x57')][_0x186a('0x41')]()]&&(_0x36014f[_0x18bfe6[_0x186a('0x51')]]=_0x3f9f30[_0x18bfe6['Variable'][_0x186a('0x57')]['toLowerCase']()][_0x186a('0x53')]());}});}return _0x36014f;}function getConnection(_0x44b8d7){var _0x58932f=_0x44b8d7[_0x186a('0x58')]['concat'](_0x44b8d7[_0x186a('0x59')]);var _0x173988=new jsforce[(_0x186a('0x5a'))]({'oauth2':{'loginUrl':_0x44b8d7['remoteUri']||_0x186a('0x5b'),'clientId':_0x44b8d7[_0x186a('0x5c')],'clientSecret':_0x44b8d7[_0x186a('0x5d')]}});return _0x173988[_0x186a('0x5e')](_0x44b8d7[_0x186a('0x5f')],_0x58932f)[_0x186a('0x26')](function(){logger[_0x186a('0x1e')]('Connection\x20established.');return _0x173988;});}exports[_0x186a('0x60')]=function(_0x3f7a9e,_0x48bff8,_0x47e829,_0x4e29b5,_0x2db639,_0x263132){var _0xb2fe63,_0x29a52d,_0xeb5760,_0x9c201c;_0x263132[_0x186a('0x61')]=intUtil[_0x186a('0x62')](_0x263132[_0x186a('0x61')]);_0x263132[_0x186a('0x63')]=intUtil[_0x186a('0x62')](_0x263132[_0x186a('0x63')]);if(_0x2db639&&_0x2db639[_0x186a('0x64')]){logger[_0x186a('0x1e')](_0x186a('0x65'),_0x186a('0x66'));_0x48bff8[_0x186a('0x67')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x263132['serverUrl'],_0x48bff8[_0x186a('0x68')],md5(_0x48bff8[_0x186a('0x68')]));}else{_0x48bff8[_0x186a('0x67')]='';}return getConnection(_0x263132)[_0x186a('0x26')](function(_0x371ce8){_0x9c201c=_0x371ce8;return getUser(_0x263132,_0x4e29b5[_0x186a('0x69')],_0x9c201c);})[_0x186a('0x26')](function(_0x3688d4){_0xb2fe63=_0x3688d4;return getEndUser(_0x263132,_0x47e829,_0x48bff8[_0x186a('0x6a')],_0x48bff8['calleridnum'],_0x9c201c);})[_0x186a('0x26')](function(_0x267529){_0x29a52d=_0x267529;return getTicket(_0x263132,_0xb2fe63,_0x29a52d,_0x47e829,_0x48bff8,_0x47e829['Fields'],_0x9c201c,_0x186a('0x60'));})[_0x186a('0x26')](function(_0x9a328f){_0xeb5760=_0x9a328f;logger[_0x186a('0x1e')](_0x186a('0x6b'),_0xeb5760['id']);logger[_0x186a('0x1e')](_0x186a('0x6c'),_0xeb5760['id'],_0x4e29b5['name'],_0x263132[_0x186a('0x40')]);switch(_0x263132['type']){case'integrationTab':emit(util[_0x186a('0x47')]('user:%s',_0x4e29b5[_0x186a('0x57')]),_0x186a('0x6d'),{'recordId':_0xeb5760['id']});break;case'newTab':emit(util[_0x186a('0x47')]('user:%s',_0x4e29b5[_0x186a('0x57')]),'trigger:browser:url',{'uri':util[_0x186a('0x47')]('%s/%s/e',_0x9c201c[_0x186a('0x6e')],_0xeb5760['id'])});break;default:logger[_0x186a('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x186a('0x70')](function(_0xde11e9){logger[_0x186a('0x6f')]('[QUEUE]',_0xde11e9);});};exports['outbound']=function(_0x452f9a,_0x213c84,_0x4e21e3,_0x1d8a55,_0x3cff8e,_0x427b04,_0x3dae32){var _0x16c359,_0x383fbb,_0x569073,_0x573eaa;_0x427b04[_0x186a('0x61')]=intUtil[_0x186a('0x62')](_0x427b04[_0x186a('0x61')]);_0x427b04[_0x186a('0x63')]=intUtil[_0x186a('0x62')](_0x427b04[_0x186a('0x63')]);if(_0x3dae32&&_0x3dae32[_0x186a('0x71')]&&_0x3dae32[_0x186a('0x71')]!==_0x186a('0x72')){logger[_0x186a('0x1e')](_0x186a('0x73'),_0x186a('0x66'));_0x213c84['recordingURL']=util[_0x186a('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x427b04['serverUrl'],_0x213c84[_0x186a('0x68')],md5(_0x213c84[_0x186a('0x68')]));}return getConnection(_0x427b04)[_0x186a('0x26')](function(_0x4ac4f2){_0x573eaa=_0x4ac4f2;return getUser(_0x427b04,_0x1d8a55[_0x186a('0x69')],_0x573eaa);})[_0x186a('0x26')](function(_0x6a566b){_0x16c359=_0x6a566b;return getEndUser(_0x427b04,_0x4e21e3,_0x213c84[_0x186a('0x74')],_0x213c84[_0x186a('0x75')],_0x573eaa);})[_0x186a('0x26')](function(_0x3d7dd6){_0x383fbb=_0x3d7dd6;return getTicket(_0x427b04,_0x16c359,_0x383fbb,_0x4e21e3,_0x213c84,_0x4e21e3[_0x186a('0x76')],_0x573eaa,_0x186a('0x77'));})[_0x186a('0x26')](function(_0x35b4ba){_0x569073=_0x35b4ba;logger['info'](_0x186a('0x78'),_0x569073['id']);logger['info'](_0x186a('0x79'),_0x569073['id'],_0x1d8a55[_0x186a('0x57')],_0x427b04[_0x186a('0x40')]);switch(_0x427b04[_0x186a('0x40')]){case _0x186a('0x7a'):emit(util[_0x186a('0x47')](_0x186a('0x7b'),_0x1d8a55[_0x186a('0x57')]),_0x186a('0x6d'),{'recordId':_0x569073['id']});break;case _0x186a('0x7c'):emit(util['format']('user:%s',_0x1d8a55['name']),_0x186a('0x7d'),{'uri':util[_0x186a('0x47')](_0x186a('0x7e'),_0x573eaa[_0x186a('0x6e')],_0x569073['id'])});break;default:logger[_0x186a('0x6f')](_0x186a('0x73'),_0x186a('0x7f'));}})['catch'](function(_0xb2c230){logger[_0x186a('0x6f')](_0x186a('0x73'),_0xb2c230);});};exports[_0x186a('0x80')]=function(_0x543179,_0x5e7dfb,_0x3f7736,_0x2b39e6,_0x2b4774,_0x46d8d9){var _0x41db12,_0x3fe46a,_0x4a4379,_0xb56f8d;_0x46d8d9[_0x186a('0x61')]=intUtil[_0x186a('0x62')](_0x46d8d9[_0x186a('0x61')]);_0x46d8d9[_0x186a('0x63')]=intUtil[_0x186a('0x62')](_0x46d8d9[_0x186a('0x63')]);if(_0x2b4774&&_0x2b4774['monitor_format']){logger['info']('['+_0x5e7dfb[_0x186a('0x81')][_0x186a('0x82')]()+']',_0x186a('0x66'));_0x5e7dfb[_0x186a('0x67')]=util[_0x186a('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46d8d9[_0x186a('0x61')],_0x5e7dfb[_0x186a('0x68')],md5(_0x5e7dfb[_0x186a('0x68')]));}else{_0x5e7dfb[_0x186a('0x67')]='';}return getConnection(_0x46d8d9)[_0x186a('0x26')](function(_0x39548b){_0xb56f8d=_0x39548b;if(!_[_0x186a('0x21')](_0x2b39e6)){return getUser(_0x46d8d9,_0x2b39e6[_0x186a('0x57')],_0xb56f8d);}else{return getUser(_0x46d8d9,null,_0xb56f8d);}})[_0x186a('0x26')](function(_0x3cda8e){_0x41db12=_0x3cda8e;return getEndUser(_0x46d8d9,_0x3f7736,_0x5e7dfb['calleridname'],_0x5e7dfb[_0x186a('0x83')],_0xb56f8d);})['then'](function(_0x4dcf43){_0x3fe46a=_0x4dcf43;return getTicket(_0x46d8d9,_0x41db12,_0x3fe46a,_0x3f7736,_0x5e7dfb,_0x3f7736['Fields'],_0xb56f8d);})[_0x186a('0x26')](function(_0x4f49c6){_0x4a4379=_0x4f49c6;logger[_0x186a('0x1e')]('['+_0x5e7dfb[_0x186a('0x81')]['toUpperCase']()+_0x186a('0x84'),_0x4a4379['id']);logger['info']('['+_0x5e7dfb[_0x186a('0x81')][_0x186a('0x82')]()+_0x186a('0x85'),_0x46d8d9[_0x186a('0x40')]);})[_0x186a('0x70')](function(_0x3f51b7){logger[_0x186a('0x6f')]('['+_0x5e7dfb[_0x186a('0x81')][_0x186a('0x82')]()+']',_0x3f51b7);});}; \ 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 3386f19..83f0d9c 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 _0xa1c6=['request-promise','util','md5','./util','../../../../config/environment','servicenow','redis','defaults','GET','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','then','],\x20getEndUser\x20crm','forEach','string','picklist','nameField','customField','toLowerCase','content','toString','includes','type','idField','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','email','destcalleridnum','calleridnum','callDirection','queue','%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','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird'];(function(_0x3f17da,_0x4865c2){var _0x2c6b22=function(_0x3b1b04){while(--_0x3b1b04){_0x3f17da['push'](_0x3f17da['shift']());}};_0x2c6b22(++_0x4865c2);}(_0xa1c6,0x1ae));var _0x6a1c=function(_0x152111,_0x4851cf){_0x152111=_0x152111-0x0;var _0x2ea170=_0xa1c6[_0x152111];return _0x2ea170;};'use strict';var _=require(_0x6a1c('0x0'));var Promise=require(_0x6a1c('0x1'));var rp=require(_0x6a1c('0x2'));var util=require(_0x6a1c('0x3'));var md5=require(_0x6a1c('0x4'));var Redis=require('ioredis');var intUtil=require(_0x6a1c('0x5'));var config=require(_0x6a1c('0x6'));var logger=require('../../../../config/logger')(_0x6a1c('0x7'));config[_0x6a1c('0x8')]=_[_0x6a1c('0x9')](config[_0x6a1c('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a1c('0x8')]));function getAdminUser(_0x35d310,_0x53c2bd,_0x411b9a,_0x2a9580,_0x8db01d,_0x293ca3){return new Promise(function(_0x17c809,_0x9dc420){var _0x1103f5={'method':_0x6a1c('0xa'),'uri':_0x2a9580+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x8db01d+'&'+_0x293ca3,'auth':_0x53c2bd,'json':!![]};return rp(_0x1103f5)['then'](function(_0x5c67fe){if(_0x5c67fe['result'][_0x6a1c('0xb')]>0x0){_0x411b9a[_0x6a1c('0xc')]=_0x5c67fe[_0x6a1c('0xd')][0x0][_0x6a1c('0xe')];}logger[_0x6a1c('0xf')]('['+[_0x35d310[_0x6a1c('0x10')]()]+_0x6a1c('0x11'),_0x411b9a);_0x17c809(_0x411b9a);})[_0x6a1c('0x12')](function(_0x42efe6){logger[_0x6a1c('0x13')]('['+[_0x35d310[_0x6a1c('0x10')]()]+']',_0x42efe6[_0x6a1c('0x14')]);_0x9dc420(_0x42efe6[_0x6a1c('0x14')]);});});}function getUser(_0x19c4f9,_0x3d2ffc,_0x10ef93,_0x21dafb,_0x206e56){return function(_0x578525){logger[_0x6a1c('0xf')]('['+[_0x19c4f9[_0x6a1c('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x578525);return new Promise(function(_0x4d7399,_0x2392b3){if(intUtil[_0x6a1c('0x15')](_0x578525[_0x6a1c('0x16')])){var _0x1d8e7c={'method':_0x6a1c('0xa'),'uri':_0x10ef93+_0x6a1c('0x17')+_0x578525[_0x6a1c('0x16')]+'&'+_0x21dafb+'&'+_0x206e56,'auth':_0x3d2ffc,'json':!![]};logger[_0x6a1c('0xf')]('['+[_0x19c4f9[_0x6a1c('0x10')]()]+_0x6a1c('0x18'),_0x1d8e7c);return rp(_0x1d8e7c)['then'](function(_0x16f013){logger['info']('['+[_0x19c4f9[_0x6a1c('0x10')]()]+'],\x20getUser\x20entity',_0x16f013);if(_0x16f013[_0x6a1c('0xd')]['length']>0x0&&String(_0x16f013[_0x6a1c('0xd')][0x0]['active'])===_0x6a1c('0x19')){_0x578525[_0x6a1c('0x1a')]=_0x16f013[_0x6a1c('0xd')][0x0][_0x6a1c('0xe')];}else{_0x578525[_0x6a1c('0x1a')]=_0x578525[_0x6a1c('0xc')];_0x578525[_0x6a1c('0x16')]=_0x578525[_0x6a1c('0x1b')];}logger[_0x6a1c('0xf')]('['+[_0x19c4f9['toUpperCase']()]+_0x6a1c('0x1c'),_0x578525);_0x4d7399(_0x578525);})[_0x6a1c('0x12')](function(_0x3586c1){logger['error']('['+[_0x19c4f9[_0x6a1c('0x10')]()]+']',_0x3586c1[_0x6a1c('0x14')]);_0x2392b3(_0x3586c1['message']);});}else{logger[_0x6a1c('0xf')]('['+[_0x19c4f9[_0x6a1c('0x10')]()]+_0x6a1c('0x1d'));_0x578525[_0x6a1c('0x1a')]=_0x578525[_0x6a1c('0xc')];_0x578525[_0x6a1c('0x16')]=_0x578525['adminEmail'];_0x4d7399(_0x578525);}});};}function createEndUser(_0x5145fe,_0x3ada9e,_0x3442b5,_0x392a08,_0x5c4de7){logger[_0x6a1c('0xf')]('['+[_0x5145fe[_0x6a1c('0x10')]()]+_0x6a1c('0x1e'),_0x3442b5);return new Promise(function(_0x416ee9,_0x1242ac){var _0x4148b6={'method':_0x6a1c('0x1f'),'uri':_0x392a08+_0x6a1c('0x20')+_0x5c4de7,'body':{'user_name':_0x3442b5[_0x6a1c('0x21')],'roles':_0x6a1c('0x22'),'first_name':_0x3442b5[_0x6a1c('0x21')],'active':_0x6a1c('0x19'),'date_format':_0x6a1c('0x23'),'phone':_0x3442b5['endUserNumber']},'auth':_0x3ada9e,'json':!![]};return rp(_0x4148b6)['then'](function(_0x5eee8f){logger[_0x6a1c('0xf')]('['+[_0x5145fe[_0x6a1c('0x10')]()]+_0x6a1c('0x24'),_0x5eee8f[_0x6a1c('0xd')]);_0x3442b5[_0x6a1c('0x25')]=_0x5eee8f[_0x6a1c('0xd')]['sys_id'];_0x416ee9(_0x3442b5);})[_0x6a1c('0x12')](function(_0x1243c5){logger[_0x6a1c('0x13')]('['+[_0x5145fe[_0x6a1c('0x10')]()]+']',_0x1243c5[_0x6a1c('0x14')]);_0x1242ac(_0x1243c5[_0x6a1c('0x14')]);});});}function getEndUser(_0x18418a,_0x3bc29d,_0x5c85a9,_0x8abe5b,_0x36bcbc){return function(_0x856caa){logger[_0x6a1c('0xf')]('['+[_0x18418a[_0x6a1c('0x10')]()]+_0x6a1c('0x26'),_0x856caa);return new Promise(function(_0x118ede,_0x4b1aaa){var _0x56261f={'method':'GET','uri':_0x5c85a9+'sys_user?sysparm_query=phone%3D'+_0x856caa[_0x6a1c('0x21')]+'&'+_0x8abe5b+'&'+_0x36bcbc,'auth':_0x3bc29d,'json':!![]};return rp(_0x56261f)[_0x6a1c('0x27')](function(_0x223cb8){if(_0x223cb8[_0x6a1c('0xd')][_0x6a1c('0xb')]>0x0){_0x856caa['endUserId']=_0x223cb8[_0x6a1c('0xd')][0x0][_0x6a1c('0xe')];logger[_0x6a1c('0xf')]('['+[_0x18418a[_0x6a1c('0x10')]()]+_0x6a1c('0x28'),_0x856caa);_0x118ede(_0x856caa);}else{return createEndUser(_0x18418a,_0x3bc29d,_0x856caa,_0x5c85a9,_0x8abe5b)['then'](function(_0x24a81a){logger['info']('['+[_0x18418a[_0x6a1c('0x10')]()]+'],\x20createEndUser\x20crm',_0x24a81a);_0x118ede(_0x24a81a);});}})['catch'](function(_0x107eea){logger[_0x6a1c('0x13')]('['+[_0x18418a['toUpperCase']()]+']',_0x107eea[_0x6a1c('0x14')]);_0x4b1aaa(_0x107eea['message']);});});};}function getCustomFields(_0xbb21f3,_0x1e9c95){var _0xdc7b2a={};if(_0xbb21f3[_0x6a1c('0xb')]>0x0){_[_0x6a1c('0x29')](_0xbb21f3,function(_0x36b932){if(_['includes']([_0x6a1c('0x2a'),_0x6a1c('0x2b')],_0x36b932['type'])&&_0x36b932[_0x6a1c('0x2c')]&&!_0x36b932[_0x6a1c('0x2d')]){_0xdc7b2a[_0x36b932[_0x6a1c('0x2c')][_0x6a1c('0x2e')]()]=_0x36b932[_0x6a1c('0x2f')][_0x6a1c('0x30')]();}else if(_[_0x6a1c('0x31')]([_0x6a1c('0x2a'),_0x6a1c('0x2b')],_0x36b932[_0x6a1c('0x32')])&&_0x36b932[_0x6a1c('0x33')]&&_0x36b932[_0x6a1c('0x2d')]){_0xdc7b2a[_0x36b932['idField']['toLowerCase']()]=_0x36b932[_0x6a1c('0x2f')][_0x6a1c('0x30')]();}else if(_0x36b932[_0x6a1c('0x32')]==='variable'&&_0x36b932[_0x6a1c('0x34')]&&_0x36b932[_0x6a1c('0x33')]&&_0x36b932['customField']){_0xdc7b2a[_0x36b932[_0x6a1c('0x33')][_0x6a1c('0x2e')]()]=_0x1e9c95[_0x36b932[_0x6a1c('0x34')]][_0x6a1c('0x30')]();}else if(_0x36b932[_0x6a1c('0x32')]===_0x6a1c('0x35')&&_0x36b932['Variable']&&_0x36b932['Variable']['name']&&_0x36b932['idField']&&_0x36b932['customField']){_0xdc7b2a[_0x36b932[_0x6a1c('0x33')][_0x6a1c('0x2e')]()]=_0x1e9c95[_0x36b932[_0x6a1c('0x36')]['name']['toLowerCase']()][_0x6a1c('0x30')]();}});}return _0xdc7b2a;}function getTicket(_0x243a68,_0x3486db,_0x34397b,_0x196766,_0x2dcdc0,_0xe7fc9e){return function(_0x2d6dfa){logger['info']('['+[_0x243a68[_0x6a1c('0x10')]()]+_0x6a1c('0x37'),_0x2d6dfa);return new Promise(function(_0xb41f7f,_0x318ee6){var _0x3a80d8=_0x243a68[_0x6a1c('0x2e')]()===_0x6a1c('0x38')?_0x2d6dfa[_0x6a1c('0x1a')]:_0x2d6dfa[_0x6a1c('0x25')];var _0x2955d3={'method':_0x6a1c('0x1f'),'uri':_0x34397b+_0x6a1c('0x39')+'?'+_0xe7fc9e,'body':Object[_0x6a1c('0x3a')]({},{'active':_0x6a1c('0x19'),'caller_id':_0x3a80d8,'assigned_to':_0x2d6dfa[_0x6a1c('0x1a')],'short_description':intUtil[_0x6a1c('0x3b')](_0x196766['Subjects'],_0x2dcdc0,'\x20'),'description':intUtil[_0x6a1c('0x3b')](_0x196766[_0x6a1c('0x3c')],_0x2dcdc0,'\x0a')},getCustomFields(_0x196766[_0x6a1c('0x3d')],_0x2dcdc0)),'auth':_0x3486db,'json':!![]};return rp(_0x2955d3)[_0x6a1c('0x27')](function(_0x20f283){logger['info']('['+[_0x243a68['toUpperCase']()]+_0x6a1c('0x3e'),_0x20f283[_0x6a1c('0xd')]);_0x2d6dfa[_0x6a1c('0x3f')]=_0x20f283['result'][_0x6a1c('0xe')];_0x2d6dfa[_0x6a1c('0x40')]=_0x20f283[_0x6a1c('0xd')][_0x6a1c('0x41')];logger[_0x6a1c('0xf')]('['+[_0x243a68[_0x6a1c('0x10')]()]+_0x6a1c('0x42'),_0x2d6dfa);_0xb41f7f(_0x2d6dfa);})['catch'](function(_0x376d00){logger[_0x6a1c('0x13')]('['+[_0x243a68[_0x6a1c('0x10')]()]+']',_0x376d00[_0x6a1c('0x14')]);_0x318ee6(_0x376d00[_0x6a1c('0x14')]);});});};}function createRemoteTag(_0x2b71c6,_0x149f1d,_0x5d8b99,_0x1de2a9){return new Promise(function(_0x301f8d,_0x73567a){var _0x1238bb={'method':_0x6a1c('0x1f'),'uri':_0x5d8b99+_0x6a1c('0x43')+'?'+_0x1de2a9,'body':{'short_description':_0x2b71c6,'global':!![],'active':!![],'name':_0x2b71c6},'auth':_0x149f1d,'json':!![]};return rp(_0x1238bb)[_0x6a1c('0x27')](function(_0x51bfae){var _0x5a6da3=_0x51bfae['result']['sys_id'];_0x301f8d(_0x5a6da3);});});}function getRemoteTag(_0xd44790,_0x108cb9,_0x378b4d,_0x59b9b9,_0x4dfbbb){return new Promise(function(_0x5b1b0a,_0xd67c62){var _0x556317={'method':_0x6a1c('0xa'),'uri':_0x378b4d+_0x6a1c('0x43')+_0x6a1c('0x44')+_0xd44790+'&'+_0x59b9b9,'auth':_0x108cb9,'json':!![]};return rp(_0x556317)['then'](function(_0x5729b2){if(_0x5729b2['result'][_0x6a1c('0xb')]>0x0){var _0x1e6362=_0x5729b2[_0x6a1c('0xd')][0x0][_0x6a1c('0xe')];_0x5b1b0a(_0x1e6362);}else{return createRemoteTag(_0xd44790,_0x108cb9,_0x378b4d,_0x59b9b9)[_0x6a1c('0x27')](function(_0x46ce3b){_0x5b1b0a(_0x46ce3b);});}});});}function assignTagToIncident(_0xbbfe23,_0x5395d7,_0x14fea2,_0x12e609,_0x1e4899){return new Promise(function(_0x37e199,_0x37168b){var _0x232e80={'method':_0x6a1c('0x1f'),'uri':_0x14fea2+_0x6a1c('0x45')+'?'+_0x1e4899,'body':{'label':_0xbbfe23,'table':_0x6a1c('0x39'),'id_type':'Incident','table_key':_0x12e609['ticketId'],'title':_0x6a1c('0x46')+_0x12e609[_0x6a1c('0x40')],'id_display':_0x12e609[_0x6a1c('0x40')]},'auth':_0x5395d7,'json':!![]};return rp(_0x232e80)[_0x6a1c('0x27')](function(_0x1807cd){_0x37e199();})['catch'](function(){_0x37e199();});});}function manageTags(_0x1c5763,_0x20d9bf,_0x2b4484,_0x557573,_0x43088a,_0x272f52,_0x6e6965){return new Promise(function(_0x9b81b4,_0x1c05d6){var _0x93aa82=[];_0x20d9bf[_0x6a1c('0x29')](function(_0x55f233){_0x93aa82[_0x6a1c('0x47')](getRemoteTag(_0x55f233,_0x2b4484,_0x557573,_0x272f52,_0x6e6965));});return Promise[_0x6a1c('0x48')](_0x93aa82)[_0x6a1c('0x27')](function(_0x5ca09d){if(_0x5ca09d['length']){logger[_0x6a1c('0xf')]('['+[_0x1c5763['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5ca09d);var _0x1fb44b=[];_0x5ca09d[_0x6a1c('0x29')](function(_0x1f9a41){_0x1fb44b[_0x6a1c('0x47')](assignTagToIncident(_0x1f9a41,_0x2b4484,_0x557573,_0x43088a,_0x272f52));});return Promise[_0x6a1c('0x48')](_0x1fb44b)['then'](function(){_0x9b81b4();})[_0x6a1c('0x12')](function(){_0x9b81b4();});}else{_0x9b81b4();}});});}function getTags(_0x2f4e4c,_0x374a20,_0x204aa2,_0x17ff70,_0x4dfa0f,_0x302035){return function(_0x56571f){return new Promise(function(_0xc563d1,_0x1c6e8a){var _0x385239=[];var _0xccb569=_0x17ff70[_0x6a1c('0x49')];if(_0xccb569&&_0xccb569[_0x6a1c('0xb')]>0x0){_0x385239=_[_0x6a1c('0x4a')](_0xccb569,'name');}if(_0x385239[_0x6a1c('0xb')]>0x0){return manageTags(_0x2f4e4c,_0x385239,_0x374a20,_0x204aa2,_0x56571f,_0x4dfa0f,_0x302035)[_0x6a1c('0x27')](function(){_0xc563d1(_0x56571f);});}else{_0xc563d1(_0x56571f);}});};}function emit(_0x462ef3,_0x2a0dda,_0x400a5e){var _0x5626c9=_0x6a1c('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x6a1c('0x4c')+_0x6a1c('0x4d');var _0x44360b={'uri':_0x462ef3+_0x6a1c('0x4e')+_0x400a5e+_0x5626c9};io['to'](util['format'](_0x6a1c('0x4f'),_0x2a0dda))['emit']('trigger:browser:url',_0x44360b);}exports['cs']=function(_0x3b3e41,_0x56b431,_0x54ec18,_0x544093,_0x41b37b,_0x324c29,_0x37ea37,_0x5d6926){var _0x439af3={};var _0x39a33e={'user':_0x324c29[_0x6a1c('0x50')],'pass':_0x324c29[_0x6a1c('0x51')]};var _0xbec0ff=_0x6a1c('0x52');var _0x241ef3=_0x6a1c('0x53');_0x324c29[_0x6a1c('0x54')]=intUtil[_0x6a1c('0x55')](_0x324c29[_0x6a1c('0x54')]);_0x324c29[_0x6a1c('0x56')]=intUtil[_0x6a1c('0x55')](_0x324c29['serverUrl']);var _0xd4cce2=util[_0x6a1c('0x57')]('%s/api/now/table/',_0x324c29['remoteUri']);_0x439af3['userEmail']=!_['isNil'](_0x544093)?_0x544093[_0x6a1c('0x58')]:null;_0x439af3[_0x6a1c('0x1b')]=_0x324c29[_0x6a1c('0x58')];_0x439af3[_0x6a1c('0x21')]=_0x5d6926['toLowerCase']()==='outbound'?_0x56b431[_0x6a1c('0x59')]:_0x56b431[_0x6a1c('0x5a')];_0x439af3[_0x6a1c('0x5b')]=_0x5d6926===_0x6a1c('0x5c')||_0x5d6926==='unmanaged'?_0x6a1c('0x5c'):'outbound';var _0x424c77=util[_0x6a1c('0x57')](_0x6a1c('0x5d'),_0x324c29['serverUrl'],_0x56b431[_0x6a1c('0x5e')],md5(_0x56b431[_0x6a1c('0x5e')]));if(_0x41b37b&&_0x41b37b[_0x6a1c('0x5f')]){logger[_0x6a1c('0xf')](_0x6a1c('0x60'),_0x6a1c('0x61'));_0x56b431[_0x6a1c('0x62')]=_0x424c77;}else if(_0x37ea37&&_0x37ea37[_0x6a1c('0x63')]&&_0x37ea37[_0x6a1c('0x63')]!==_0x6a1c('0x64')){logger[_0x6a1c('0xf')](_0x6a1c('0x65'),_0x6a1c('0x61'));_0x56b431[_0x6a1c('0x62')]=_0x424c77;}else{_0x56b431['recordingURL']='';}return getAdminUser(_0x5d6926,_0x39a33e,_0x439af3,_0xd4cce2,_0x241ef3,_0xbec0ff)[_0x6a1c('0x27')](getUser(_0x5d6926,_0x39a33e,_0xd4cce2,_0x241ef3,_0xbec0ff))['then'](getEndUser(_0x5d6926,_0x39a33e,_0xd4cce2,_0x241ef3,_0xbec0ff))[_0x6a1c('0x27')](getTicket(_0x5d6926,_0x39a33e,_0xd4cce2,_0x54ec18,_0x56b431,_0x241ef3))[_0x6a1c('0x27')](function(_0x584b9e){logger['info'](util[_0x6a1c('0x57')](_0x6a1c('0x66'),_0x584b9e[_0x6a1c('0x3f')]));logger[_0x6a1c('0xf')](util['format']('call\x20direction:\x20%s',_0x5d6926));if(_0x5d6926!==_0x6a1c('0x67')){logger[_0x6a1c('0xf')]('['+[_0x5d6926[_0x6a1c('0x10')]()]+']',_0x6a1c('0x68'));emit(_0x324c29['remoteUri'],_0x544093[_0x6a1c('0x69')],_0x584b9e[_0x6a1c('0x3f')]);}})[_0x6a1c('0x12')](function(_0x39c3d5){logger[_0x6a1c('0x13')]('['+[_0x5d6926['toUpperCase']()]+_0x6a1c('0x6a'),util[_0x6a1c('0x6b')](_0x39c3d5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdf34=[']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields','ticketId','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','defaults','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','toString','idField','customField','toLowerCase','variable','customVariable','Variable','name'];(function(_0x386623,_0x4e5b5d){var _0x4588ce=function(_0x47e441){while(--_0x47e441){_0x386623['push'](_0x386623['shift']());}};_0x4588ce(++_0x4e5b5d);}(_0xdf34,0x9d));var _0x4df3=function(_0x1ea1ad,_0x7038cc){_0x1ea1ad=_0x1ea1ad-0x0;var _0x4ec73d=_0xdf34[_0x1ea1ad];return _0x4ec73d;};'use strict';var _=require(_0x4df3('0x0'));var Promise=require('bluebird');var rp=require(_0x4df3('0x1'));var util=require(_0x4df3('0x2'));var md5=require(_0x4df3('0x3'));var Redis=require(_0x4df3('0x4'));var intUtil=require(_0x4df3('0x5'));var config=require(_0x4df3('0x6'));var logger=require('../../../../config/logger')(_0x4df3('0x7'));config['redis']=_[_0x4df3('0x8')](config[_0x4df3('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x4df3('0xa'))(new Redis(config[_0x4df3('0x9')]));function getAdminUser(_0x393fe8,_0x10b3e5,_0x67ca3,_0x422858,_0x26b0b8,_0xbd0ef6){return new Promise(function(_0x3420e3,_0x213336){var _0x1c0857={'method':_0x4df3('0xb'),'uri':_0x422858+_0x4df3('0xc')+'&'+_0x26b0b8+'&'+_0xbd0ef6,'auth':_0x10b3e5,'json':!![]};return rp(_0x1c0857)[_0x4df3('0xd')](function(_0x1aed53){if(_0x1aed53[_0x4df3('0xe')][_0x4df3('0xf')]>0x0){_0x67ca3[_0x4df3('0x10')]=_0x1aed53[_0x4df3('0xe')][0x0][_0x4df3('0x11')];}logger['info']('['+[_0x393fe8[_0x4df3('0x12')]()]+_0x4df3('0x13'),_0x67ca3);_0x3420e3(_0x67ca3);})[_0x4df3('0x14')](function(_0x1c82d2){logger[_0x4df3('0x15')]('['+[_0x393fe8[_0x4df3('0x12')]()]+']',_0x1c82d2[_0x4df3('0x16')]);_0x213336(_0x1c82d2[_0x4df3('0x16')]);});});}function getUser(_0x43d2f7,_0x2e4ec2,_0x2a68d5,_0x1e82b7,_0x45c901){return function(_0x553bb6){logger[_0x4df3('0x17')]('['+[_0x43d2f7['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x553bb6);return new Promise(function(_0x48f30a,_0x16897b){if(intUtil[_0x4df3('0x18')](_0x553bb6[_0x4df3('0x19')])){var _0x217d56={'method':_0x4df3('0xb'),'uri':_0x2a68d5+_0x4df3('0x1a')+_0x553bb6[_0x4df3('0x19')]+'&'+_0x1e82b7+'&'+_0x45c901,'auth':_0x2e4ec2,'json':!![]};logger['info']('['+[_0x43d2f7[_0x4df3('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x217d56);return rp(_0x217d56)[_0x4df3('0xd')](function(_0x38e038){logger['info']('['+[_0x43d2f7[_0x4df3('0x12')]()]+_0x4df3('0x1b'),_0x38e038);if(_0x38e038[_0x4df3('0xe')][_0x4df3('0xf')]>0x0&&String(_0x38e038[_0x4df3('0xe')][0x0]['active'])==='true'){_0x553bb6['userId']=_0x38e038[_0x4df3('0xe')][0x0][_0x4df3('0x11')];}else{_0x553bb6[_0x4df3('0x1c')]=_0x553bb6[_0x4df3('0x10')];_0x553bb6[_0x4df3('0x19')]=_0x553bb6[_0x4df3('0x1d')];}logger[_0x4df3('0x17')]('['+[_0x43d2f7['toUpperCase']()]+_0x4df3('0x1e'),_0x553bb6);_0x48f30a(_0x553bb6);})[_0x4df3('0x14')](function(_0xfce441){logger['error']('['+[_0x43d2f7[_0x4df3('0x12')]()]+']',_0xfce441[_0x4df3('0x16')]);_0x16897b(_0xfce441[_0x4df3('0x16')]);});}else{logger[_0x4df3('0x17')]('['+[_0x43d2f7[_0x4df3('0x12')]()]+_0x4df3('0x1f'));_0x553bb6[_0x4df3('0x1c')]=_0x553bb6[_0x4df3('0x10')];_0x553bb6[_0x4df3('0x19')]=_0x553bb6[_0x4df3('0x1d')];_0x48f30a(_0x553bb6);}});};}function createEndUser(_0x5399aa,_0x1a8873,_0x1234cd,_0x3d01db,_0x603ce0){logger['info']('['+[_0x5399aa[_0x4df3('0x12')]()]+_0x4df3('0x20'),_0x1234cd);return new Promise(function(_0x51eb6f,_0x54eb75){var _0x12b2db={'method':_0x4df3('0x21'),'uri':_0x3d01db+_0x4df3('0x22')+_0x603ce0,'body':{'user_name':_0x1234cd[_0x4df3('0x23')],'roles':_0x4df3('0x24'),'first_name':_0x1234cd['endUserNumber'],'active':_0x4df3('0x25'),'date_format':_0x4df3('0x26'),'phone':_0x1234cd[_0x4df3('0x23')]},'auth':_0x1a8873,'json':!![]};return rp(_0x12b2db)[_0x4df3('0xd')](function(_0x597f32){logger['info']('['+[_0x5399aa['toUpperCase']()]+_0x4df3('0x27'),_0x597f32[_0x4df3('0xe')]);_0x1234cd[_0x4df3('0x28')]=_0x597f32['result']['sys_id'];_0x51eb6f(_0x1234cd);})['catch'](function(_0x34d043){logger[_0x4df3('0x15')]('['+[_0x5399aa[_0x4df3('0x12')]()]+']',_0x34d043[_0x4df3('0x16')]);_0x54eb75(_0x34d043[_0x4df3('0x16')]);});});}function getEndUser(_0x38abd0,_0x1e70b3,_0x458cd0,_0x3aeefa,_0x2c373f){return function(_0x83abda){logger[_0x4df3('0x17')]('['+[_0x38abd0['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x83abda);return new Promise(function(_0x36199a,_0x5a3d93){var _0x4d920f={'method':'GET','uri':_0x458cd0+'sys_user?sysparm_query=phone%3D'+_0x83abda[_0x4df3('0x23')]+'&'+_0x3aeefa+'&'+_0x2c373f,'auth':_0x1e70b3,'json':!![]};return rp(_0x4d920f)[_0x4df3('0xd')](function(_0xb333f3){if(_0xb333f3[_0x4df3('0xe')][_0x4df3('0xf')]>0x0){_0x83abda['endUserId']=_0xb333f3[_0x4df3('0xe')][0x0][_0x4df3('0x11')];logger[_0x4df3('0x17')]('['+[_0x38abd0[_0x4df3('0x12')]()]+'],\x20getEndUser\x20crm',_0x83abda);_0x36199a(_0x83abda);}else{return createEndUser(_0x38abd0,_0x1e70b3,_0x83abda,_0x458cd0,_0x3aeefa)[_0x4df3('0xd')](function(_0x2d0491){logger[_0x4df3('0x17')]('['+[_0x38abd0['toUpperCase']()]+_0x4df3('0x29'),_0x2d0491);_0x36199a(_0x2d0491);});}})['catch'](function(_0x25df4c){logger[_0x4df3('0x15')]('['+[_0x38abd0['toUpperCase']()]+']',_0x25df4c[_0x4df3('0x16')]);_0x5a3d93(_0x25df4c[_0x4df3('0x16')]);});});};}function getCustomFields(_0x1f006c,_0x3fbdd8){var _0x3587b5={};if(_0x1f006c[_0x4df3('0xf')]>0x0){_[_0x4df3('0x2a')](_0x1f006c,function(_0x597b95){if(_[_0x4df3('0x2b')](['string',_0x4df3('0x2c')],_0x597b95[_0x4df3('0x2d')])&&_0x597b95['nameField']&&!_0x597b95['customField']){_0x3587b5[_0x597b95[_0x4df3('0x2e')]['toLowerCase']()]=_0x597b95['content'][_0x4df3('0x2f')]();}else if(_[_0x4df3('0x2b')](['string',_0x4df3('0x2c')],_0x597b95[_0x4df3('0x2d')])&&_0x597b95[_0x4df3('0x30')]&&_0x597b95[_0x4df3('0x31')]){_0x3587b5[_0x597b95[_0x4df3('0x30')][_0x4df3('0x32')]()]=_0x597b95['content'][_0x4df3('0x2f')]();}else if(_0x597b95[_0x4df3('0x2d')]===_0x4df3('0x33')&&_0x597b95['variableName']&&_0x597b95[_0x4df3('0x30')]&&_0x597b95['customField']){_0x3587b5[_0x597b95[_0x4df3('0x30')]['toLowerCase']()]=_0x3fbdd8[_0x597b95['variableName']][_0x4df3('0x2f')]();}else if(_0x597b95['type']===_0x4df3('0x34')&&_0x597b95[_0x4df3('0x35')]&&_0x597b95['Variable'][_0x4df3('0x36')]&&_0x597b95[_0x4df3('0x30')]&&_0x597b95[_0x4df3('0x31')]){_0x3587b5[_0x597b95[_0x4df3('0x30')][_0x4df3('0x32')]()]=_0x3fbdd8[_0x597b95[_0x4df3('0x35')][_0x4df3('0x36')][_0x4df3('0x32')]()][_0x4df3('0x2f')]();}});}return _0x3587b5;}function getTicket(_0x2f6466,_0x54155c,_0x1fe2de,_0x7b2ae5,_0x3418b6,_0x4d79f1){return function(_0x144a93){logger[_0x4df3('0x17')]('['+[_0x2f6466[_0x4df3('0x12')]()]+_0x4df3('0x37'),_0x144a93);return new Promise(function(_0x4b7340,_0x54897c){var _0x3c319f=_0x2f6466[_0x4df3('0x32')]()===_0x4df3('0x38')?_0x144a93['userId']:_0x144a93['endUserId'];var _0x15f737={'method':_0x4df3('0x21'),'uri':_0x1fe2de+'incident'+'?'+_0x4d79f1,'body':Object[_0x4df3('0x39')]({},{'active':_0x4df3('0x25'),'caller_id':_0x3c319f,'assigned_to':_0x144a93[_0x4df3('0x1c')],'short_description':intUtil[_0x4df3('0x3a')](_0x7b2ae5[_0x4df3('0x3b')],_0x3418b6,'\x20'),'description':intUtil['getString'](_0x7b2ae5[_0x4df3('0x3c')],_0x3418b6,'\x0a')},getCustomFields(_0x7b2ae5[_0x4df3('0x3d')],_0x3418b6)),'auth':_0x54155c,'json':!![]};return rp(_0x15f737)[_0x4df3('0xd')](function(_0x297b02){logger['info']('['+[_0x2f6466[_0x4df3('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x297b02[_0x4df3('0xe')]);_0x144a93[_0x4df3('0x3e')]=_0x297b02['result'][_0x4df3('0x11')];_0x144a93['ticketNumber']=_0x297b02[_0x4df3('0xe')][_0x4df3('0x3f')];logger[_0x4df3('0x17')]('['+[_0x2f6466[_0x4df3('0x12')]()]+_0x4df3('0x40'),_0x144a93);_0x4b7340(_0x144a93);})[_0x4df3('0x14')](function(_0x4d13d7){logger['error']('['+[_0x2f6466[_0x4df3('0x12')]()]+']',_0x4d13d7[_0x4df3('0x16')]);_0x54897c(_0x4d13d7[_0x4df3('0x16')]);});});};}function createRemoteTag(_0x2c6502,_0x598048,_0x11656e,_0x72da11){return new Promise(function(_0x59246f,_0x2a350c){var _0x4e4eb2={'method':_0x4df3('0x21'),'uri':_0x11656e+_0x4df3('0x41')+'?'+_0x72da11,'body':{'short_description':_0x2c6502,'global':!![],'active':!![],'name':_0x2c6502},'auth':_0x598048,'json':!![]};return rp(_0x4e4eb2)[_0x4df3('0xd')](function(_0x58d4cc){var _0x41c647=_0x58d4cc['result']['sys_id'];_0x59246f(_0x41c647);});});}function getRemoteTag(_0x4d2c91,_0x5a354f,_0xb90889,_0x69c31d,_0x17b402){return new Promise(function(_0x48843c,_0x1518f3){var _0x167f96={'method':_0x4df3('0xb'),'uri':_0xb90889+_0x4df3('0x41')+'?sysparm_query=name%3D'+_0x4d2c91+'&'+_0x69c31d,'auth':_0x5a354f,'json':!![]};return rp(_0x167f96)[_0x4df3('0xd')](function(_0x4431d3){if(_0x4431d3[_0x4df3('0xe')]['length']>0x0){var _0x130673=_0x4431d3[_0x4df3('0xe')][0x0][_0x4df3('0x11')];_0x48843c(_0x130673);}else{return createRemoteTag(_0x4d2c91,_0x5a354f,_0xb90889,_0x69c31d)[_0x4df3('0xd')](function(_0x5cb0e3){_0x48843c(_0x5cb0e3);});}});});}function assignTagToIncident(_0x508cda,_0x30c30e,_0x3c8ee6,_0x172ad6,_0xcaee8f){return new Promise(function(_0x2e20e5,_0x4d4feb){var _0x3207d2={'method':_0x4df3('0x21'),'uri':_0x3c8ee6+_0x4df3('0x42')+'?'+_0xcaee8f,'body':{'label':_0x508cda,'table':'incident','id_type':_0x4df3('0x43'),'table_key':_0x172ad6[_0x4df3('0x3e')],'title':_0x4df3('0x44')+_0x172ad6['ticketNumber'],'id_display':_0x172ad6[_0x4df3('0x45')]},'auth':_0x30c30e,'json':!![]};return rp(_0x3207d2)[_0x4df3('0xd')](function(_0xe04259){_0x2e20e5();})['catch'](function(){_0x2e20e5();});});}function manageTags(_0x4c9591,_0x59ee53,_0xc5659d,_0x19f709,_0x58a4b8,_0x48824f,_0xd8fd5c){return new Promise(function(_0x429cbf,_0x877fd1){var _0x2df549=[];_0x59ee53[_0x4df3('0x2a')](function(_0x5a30e2){_0x2df549[_0x4df3('0x46')](getRemoteTag(_0x5a30e2,_0xc5659d,_0x19f709,_0x48824f,_0xd8fd5c));});return Promise[_0x4df3('0x47')](_0x2df549)[_0x4df3('0xd')](function(_0x8559db){if(_0x8559db['length']){logger[_0x4df3('0x17')]('['+[_0x4c9591[_0x4df3('0x12')]()]+_0x4df3('0x48'),_0x8559db);var _0xaa70f0=[];_0x8559db[_0x4df3('0x2a')](function(_0x30d47d){_0xaa70f0['push'](assignTagToIncident(_0x30d47d,_0xc5659d,_0x19f709,_0x58a4b8,_0x48824f));});return Promise[_0x4df3('0x47')](_0xaa70f0)[_0x4df3('0xd')](function(){_0x429cbf();})['catch'](function(){_0x429cbf();});}else{_0x429cbf();}});});}function getTags(_0x27fcf2,_0x29631b,_0x1a4699,_0x3da989,_0x4bd8a9,_0x26a352){return function(_0x175e3b){return new Promise(function(_0x3e4b31,_0x1a7581){var _0x5d1758=[];var _0x3058ea=_0x3da989[_0x4df3('0x49')];if(_0x3058ea&&_0x3058ea[_0x4df3('0xf')]>0x0){_0x5d1758=_['map'](_0x3058ea,'name');}if(_0x5d1758[_0x4df3('0xf')]>0x0){return manageTags(_0x27fcf2,_0x5d1758,_0x29631b,_0x1a4699,_0x175e3b,_0x4bd8a9,_0x26a352)[_0x4df3('0xd')](function(){_0x3e4b31(_0x175e3b);});}else{_0x3e4b31(_0x175e3b);}});};}function emit(_0xbc9456,_0x142f71,_0xccdd28){var _0x127299=_0x4df3('0x4a')+_0x4df3('0x4b')+_0x4df3('0x4c')+_0x4df3('0x4d');var _0x422747={'uri':_0xbc9456+'/nav_to.do?uri=incident.do?sys_id%3D'+_0xccdd28+_0x127299};io['to'](util[_0x4df3('0x4e')](_0x4df3('0x4f'),_0x142f71))[_0x4df3('0x50')]('trigger:browser:url',_0x422747);}exports['cs']=function(_0x34f1e6,_0x227d26,_0x22e1f5,_0x3d69a7,_0xe0f3c,_0x463df2,_0x5b53ec,_0x4b036f){var _0x9795c1={};var _0x49f326={'user':_0x463df2['username'],'pass':_0x463df2[_0x4df3('0x51')]};var _0x3c4983=_0x4df3('0x52');var _0x2447fd=_0x4df3('0x53');_0x463df2[_0x4df3('0x54')]=intUtil[_0x4df3('0x55')](_0x463df2[_0x4df3('0x54')]);_0x463df2[_0x4df3('0x56')]=intUtil[_0x4df3('0x55')](_0x463df2['serverUrl']);var _0x31387b=util['format'](_0x4df3('0x57'),_0x463df2[_0x4df3('0x54')]);_0x9795c1[_0x4df3('0x19')]=!_[_0x4df3('0x58')](_0x3d69a7)?_0x3d69a7[_0x4df3('0x59')]:null;_0x9795c1[_0x4df3('0x1d')]=_0x463df2[_0x4df3('0x59')];_0x9795c1[_0x4df3('0x23')]=_0x4b036f[_0x4df3('0x32')]()==='outbound'?_0x227d26[_0x4df3('0x5a')]:_0x227d26[_0x4df3('0x5b')];_0x9795c1[_0x4df3('0x5c')]=_0x4b036f===_0x4df3('0x5d')||_0x4b036f==='unmanaged'?_0x4df3('0x5d'):_0x4df3('0x38');var _0x455a73=util['format'](_0x4df3('0x5e'),_0x463df2[_0x4df3('0x56')],_0x227d26[_0x4df3('0x5f')],md5(_0x227d26[_0x4df3('0x5f')]));if(_0xe0f3c&&_0xe0f3c['monitor_format']){logger[_0x4df3('0x17')](_0x4df3('0x60'),_0x4df3('0x61'));_0x227d26[_0x4df3('0x62')]=_0x455a73;}else if(_0x5b53ec&&_0x5b53ec['recordingFormat']&&_0x5b53ec['recordingFormat']!==_0x4df3('0x63')){logger[_0x4df3('0x17')](_0x4df3('0x64'),_0x4df3('0x61'));_0x227d26[_0x4df3('0x62')]=_0x455a73;}else{_0x227d26['recordingURL']='';}return getAdminUser(_0x4b036f,_0x49f326,_0x9795c1,_0x31387b,_0x2447fd,_0x3c4983)[_0x4df3('0xd')](getUser(_0x4b036f,_0x49f326,_0x31387b,_0x2447fd,_0x3c4983))[_0x4df3('0xd')](getEndUser(_0x4b036f,_0x49f326,_0x31387b,_0x2447fd,_0x3c4983))['then'](getTicket(_0x4b036f,_0x49f326,_0x31387b,_0x22e1f5,_0x227d26,_0x2447fd))[_0x4df3('0xd')](function(_0x95288d){logger[_0x4df3('0x17')](util['format'](_0x4df3('0x65'),_0x95288d[_0x4df3('0x3e')]));logger['info'](util[_0x4df3('0x4e')](_0x4df3('0x66'),_0x4b036f));if(_0x4b036f!=='unmanaged'){logger['info']('['+[_0x4b036f['toUpperCase']()]+']',_0x4df3('0x67'));emit(_0x463df2[_0x4df3('0x54')],_0x3d69a7[_0x4df3('0x36')],_0x95288d['ticketId']);}})[_0x4df3('0x14')](function(_0x443c62){logger[_0x4df3('0x15')]('['+[_0x4b036f['toUpperCase']()]+_0x4df3('0x68'),util[_0x4df3('0x69')](_0x443c62,{'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 3c4b2fb..4603afe 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 _0x18dc=['info','Creating\x20new\x20ticket...','getString','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_name','direction','length','push','variableName','set_entry','JSON','stringify','format','apiKey','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','string','nameField','customField','toLowerCase','toString','idField','custom_fields','content','type','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','destcalleridname','Outbound','Ticket\x20created!','version','catch','unmanaged','lastevent','error','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','defaults','redis','socket.io-emitter','POST','emit'];(function(_0x565071,_0x4166a3){var _0x2ec9c8=function(_0x3ed8f4){while(--_0x3ed8f4){_0x565071['push'](_0x565071['shift']());}};_0x2ec9c8(++_0x4166a3);}(_0x18dc,0xe8));var _0xc18d=function(_0x5c8440,_0x262351){_0x5c8440=_0x5c8440-0x0;var _0x301008=_0x18dc[_0x5c8440];return _0x301008;};'use strict';var _=require('lodash');var rp=require(_0xc18d('0x0'));var BPromise=require('bluebird');var md5=require(_0xc18d('0x1'));var util=require(_0xc18d('0x2'));var Redis=require(_0xc18d('0x3'));var intUtil=require(_0xc18d('0x4'));var config=require('../../../../config/environment');var logger=require(_0xc18d('0x5'))(_0xc18d('0x6'));config['redis']=_[_0xc18d('0x7')](config[_0xc18d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc18d('0x9'))(new Redis(config[_0xc18d('0x8')]));var def={'method':_0xc18d('0xa'),'json':!![]};function emit(_0x20da68,_0x35e86c,_0x5bae97){io['to'](_0x20da68)[_0xc18d('0xb')](_0x35e86c,_0x5bae97);}function getTicket(_0x30c5b0,_0x37b2a4,_0x424292,_0x5e6222,_0x53de91,_0x216950,_0x111365,_0x1e9f5e){logger[_0xc18d('0xc')](_0xc18d('0xd'));var _0x155b88=new Date();var _0x6c46c4=[{'name':'name','value':intUtil[_0xc18d('0xe')](_0x5e6222['Subjects'],_0x53de91,'\x20')},{'name':'assigned_user_id','value':_0x37b2a4['id']},{'name':_0xc18d('0xf'),'value':_0x37b2a4['id']},{'name':_0xc18d('0x10'),'value':intUtil[_0xc18d('0xe')](_0x5e6222[_0xc18d('0x11')],_0x53de91,'\x0a')},{'name':_0xc18d('0x12'),'value':_0x155b88[_0xc18d('0x13')]()[_0xc18d('0x14')](0x0,0x13)[_0xc18d('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xc18d('0x16'),'value':'15'},{'name':_0xc18d('0x17'),'value':_0x424292['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xc18d('0x18'),'value':_0x424292['name']},{'name':_0xc18d('0x19'),'value':_0x1e9f5e}];if(_0x216950[_0xc18d('0x1a')]){_['forEach'](_0x216950,function(_0x1092bd){if(_0x53de91[_0x1092bd['variableName']]){_0x6c46c4[_0xc18d('0x1b')]({'name':_0x1092bd['idField'],'value':_0x53de91[_0x1092bd[_0xc18d('0x1c')]]});}});}return request({'form':{'method':_0xc18d('0x1d'),'input_type':_0xc18d('0x1e'),'response_type':'JSON','rest_data':JSON[_0xc18d('0x1f')]({'session':_0x111365['id'],'module_name':'Calls','name_value_list':_0x6c46c4})}});}function getAuth(_0xbb8072){return util[_0xc18d('0x20')]('Basic\x20%s',new Buffer(_0xbb8072[_0xc18d('0x21')]+':X')['toString']('base64'));}function getServerInfo(_0x2994c3){return request({'form':{'method':'get_server_info','input_type':_0xc18d('0x1e'),'response_type':_0xc18d('0x1e'),'rest_data':JSON[_0xc18d('0x1f')]({'session':_0x2994c3['id']})}});}function getUser(_0x150854,_0x3fda75,_0x4ab0db){if(!_[_0xc18d('0x22')](_0x3fda75)){logger['info'](_0xc18d('0x23'),_0x3fda75);return request({'form':{'method':_0xc18d('0x24'),'input_type':'JSON','response_type':_0xc18d('0x1e'),'rest_data':JSON[_0xc18d('0x1f')]({'session':_0x4ab0db['id'],'module_name':_0xc18d('0x25'),'query':util[_0xc18d('0x20')](_0xc18d('0x26'),_0x3fda75),'order_by':'','offset':'0','select_fields':['id',_0xc18d('0x27'),_0xc18d('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc18d('0x29')](function(_0x2aa785){if(_0x2aa785[_0xc18d('0x2a')]['length']){var _0x524022=_['find'](_0x2aa785['entry_list'],function(_0x4886f9){return _0x4886f9[_0xc18d('0x2b')][_0xc18d('0x28')][_0xc18d('0x2c')]===_0x3fda75;});if(_0x524022){logger[_0xc18d('0xc')](_0xc18d('0x2d'));return BPromise[_0xc18d('0x2e')]({'id':_0x524022[_0xc18d('0x2b')]['id'][_0xc18d('0x2c')],'name':_0x524022[_0xc18d('0x2b')]['name'][_0xc18d('0x2c')]});}}logger[_0xc18d('0xc')](_0xc18d('0x2f'));return BPromise['resolve']({'id':_0x4ab0db[_0xc18d('0x2b')][_0xc18d('0x30')][_0xc18d('0x2c')],'name':_0x4ab0db[_0xc18d('0x2b')][_0xc18d('0x28')][_0xc18d('0x2c')]});});}else{logger[_0xc18d('0xc')](_0xc18d('0x31'));return BPromise[_0xc18d('0x2e')]({'id':_0x4ab0db[_0xc18d('0x2b')]['user_id']['value'],'name':_0x4ab0db[_0xc18d('0x2b')][_0xc18d('0x28')]['value']});}}function getEndUser(_0x338917,_0x154d06,_0x560538,_0x2b1758){logger['info'](_0xc18d('0x32'),_0x560538);return request({'form':{'method':_0xc18d('0x24'),'input_type':'JSON','response_type':_0xc18d('0x1e'),'rest_data':JSON['stringify']({'session':_0x2b1758['id'],'module_name':_0xc18d('0x33'),'query':util[_0xc18d('0x20')](_0xc18d('0x34'),_0x560538),'order_by':'','offset':'0','select_fields':['id','name',_0xc18d('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc18d('0x29')](function(_0x3a583c){if(_0x3a583c[_0xc18d('0x2a')][_0xc18d('0x1a')]){var _0x288a50=_[_0xc18d('0x36')](_0x3a583c[_0xc18d('0x2a')],function(_0x3924cd){return _0x3924cd['name_value_list']['phone_home']['value']===_0x560538;});if(_0x288a50){logger[_0xc18d('0xc')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x288a50[_0xc18d('0x2b')]['id']['value'],'name':_0x288a50[_0xc18d('0x2b')][_0xc18d('0x27')][_0xc18d('0x2c')],'phone':_0x288a50[_0xc18d('0x2b')]['phone_home']['value']});}}else{logger[_0xc18d('0xc')](_0xc18d('0x37'));return request({'form':{'method':'set_entry','input_type':_0xc18d('0x1e'),'response_type':'JSON','rest_data':JSON[_0xc18d('0x1f')]({'session':_0x2b1758['id'],'module_name':'Contacts','name_value_list':[{'name':_0xc18d('0x38'),'value':_0x154d06!==_0xc18d('0x39')?_0x154d06:util[_0xc18d('0x20')](_0xc18d('0x3a'),_0x560538)},{'name':_0xc18d('0x35'),'value':_0x560538}]})}})[_0xc18d('0x29')](function(_0x2ff81c){logger[_0xc18d('0xc')](_0xc18d('0x3b'));return BPromise['resolve']({'id':_0x2ff81c['id'],'name':_0x2ff81c['entry_list']['first_name'][_0xc18d('0x2c')],'phone':_0x2ff81c['entry_list']['phone_home'][_0xc18d('0x2c')]});});}});}function request(_0x1b3b8c){logger[_0xc18d('0x3c')](_0xc18d('0x3d'),JSON[_0xc18d('0x1f')](_0x1b3b8c));return rp(_[_0xc18d('0x3e')](def,_0x1b3b8c));}function getTags(_0x206e8f,_0x1ebb24){var _0x42e1a7=[];if(_0x206e8f&&_0x206e8f['length']>0x0){_0x42e1a7=_[_0xc18d('0x3f')](_0x206e8f,_0x1ebb24);}return _0x42e1a7;}function getCustomFields(_0x412da8,_0x25db43){var _0x8e2bb8=[];var _0x1f7c17={'custom_fields':[]};if(_0x412da8[_0xc18d('0x1a')]>0x0){_[_0xc18d('0x40')](_0x412da8,function(_0x409ab4){if(_0x409ab4['type']===_0xc18d('0x41')&&_0x409ab4[_0xc18d('0x42')]&&!_0x409ab4[_0xc18d('0x43')]){_0x1f7c17[_0x409ab4[_0xc18d('0x42')][_0xc18d('0x44')]()]=_0x409ab4['content'][_0xc18d('0x45')]();}else if(_0x409ab4['type']===_0xc18d('0x41')&&_0x409ab4[_0xc18d('0x46')]&&_0x409ab4[_0xc18d('0x43')]){_0x1f7c17[_0xc18d('0x47')][_0xc18d('0x1b')]({'id':_0x409ab4[_0xc18d('0x46')],'value':_0x409ab4[_0xc18d('0x48')][_0xc18d('0x45')]()});}else if(_0x409ab4['type']==='variable'&&_0x409ab4[_0xc18d('0x1c')]&&_0x409ab4[_0xc18d('0x46')]&&_0x409ab4[_0xc18d('0x43')]){_0x25db43[_0x409ab4[_0xc18d('0x1c')]]&&_0x1f7c17[_0xc18d('0x47')][_0xc18d('0x1b')]({'id':_0x409ab4['idField'],'value':_0x25db43[_0x409ab4[_0xc18d('0x1c')]][_0xc18d('0x45')]()});}else if(_0x409ab4[_0xc18d('0x49')]==='customVariable'&&_0x409ab4[_0xc18d('0x4a')]&&_0x409ab4[_0xc18d('0x4a')][_0xc18d('0x27')]&&_0x409ab4[_0xc18d('0x46')]&&_0x409ab4[_0xc18d('0x43')]){_0x25db43[_0x409ab4['Variable'][_0xc18d('0x27')]['toLowerCase']()]&&_0x1f7c17[_0xc18d('0x47')][_0xc18d('0x1b')]({'id':_0x409ab4[_0xc18d('0x46')],'value':_0x25db43[_0x409ab4[_0xc18d('0x4a')][_0xc18d('0x27')]['toLowerCase']()][_0xc18d('0x45')]()});}});}return _0x1f7c17;}function getConnection(_0x22a224){return request({'method':_0xc18d('0xa'),'form':{'method':_0xc18d('0x4b'),'input_type':'JSON','response_type':_0xc18d('0x1e'),'rest_data':JSON[_0xc18d('0x1f')]({'user_auth':{'user_name':_0x22a224[_0xc18d('0x4c')],'password':_0x22a224[_0xc18d('0x4d')],'encryption':_0xc18d('0x4e')},'application':_0xc18d('0x4f')})}})[_0xc18d('0x29')](function(_0x119f72){var _0x3984e2=_0x119f72;if(_0x3984e2['id']){def[_0xc18d('0x50')]=_0x3984e2['id'];return BPromise[_0xc18d('0x2e')](_0x3984e2);}else{throw new Error(util[_0xc18d('0x20')](_0xc18d('0x51'),_0x22a224['id']));}});}function setRelationship(_0x6a4460,_0x3b91d1,_0x2f47f5,_0x58bd80){return request({'form':{'method':'set_relationship','input_type':_0xc18d('0x1e'),'response_type':_0xc18d('0x1e'),'rest_data':JSON['stringify']({'session':_0x6a4460['id'],'module_name':'Calls','module_id':_0x2f47f5['id'],'link_field_name':_0x58bd80,'related_ids':[_0x3b91d1['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc18d('0x52')]=function(_0x4e5d3e,_0x18c563,_0x2cd179,_0x4e6a5a,_0x3bd483,_0x3debc0){var _0x3df7ab,_0x43a75f,_0x123301,_0x43891b;_0x3debc0[_0xc18d('0x53')]=intUtil[_0xc18d('0x54')](_0x3debc0[_0xc18d('0x53')]);_0x3debc0[_0xc18d('0x55')]=intUtil[_0xc18d('0x54')](_0x3debc0[_0xc18d('0x55')]);def[_0xc18d('0x56')]=util['format'](_0xc18d('0x57'),_0x3debc0[_0xc18d('0x53')]);if(_0x3bd483&&_0x3bd483[_0xc18d('0x58')]){logger[_0xc18d('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x18c563['recordingURL']=util[_0xc18d('0x20')](_0xc18d('0x59'),_0x3debc0[_0xc18d('0x55')],_0x18c563[_0xc18d('0x5a')],md5(_0x18c563[_0xc18d('0x5a')]));}else{_0x18c563['recordingURL']='';}return getConnection(_0x3debc0)[_0xc18d('0x29')](function(_0x21cde3){_0x43891b=_0x21cde3;return getUser(_0x3debc0,_0x4e6a5a[_0xc18d('0x27')],_0x43891b);})[_0xc18d('0x29')](function(_0x3b0391){_0x3df7ab=_0x3b0391;logger[_0xc18d('0xc')](_0xc18d('0x5b'),_0x3df7ab['id']);return getEndUser(_0x3debc0,_0x18c563[_0xc18d('0x5c')],_0x18c563[_0xc18d('0x5d')],_0x43891b);})[_0xc18d('0x29')](function(_0x2cc6b6){_0x43a75f=_0x2cc6b6;logger[_0xc18d('0xc')](_0xc18d('0x5e'),_0x43a75f['id']);return getTicket(_0x3debc0,_0x3df7ab,_0x43a75f,_0x2cd179,_0x18c563,_0x2cd179[_0xc18d('0x5f')],_0x43891b,_0xc18d('0x60'));})['then'](function(_0x139c6e){_0x123301=_0x139c6e;logger[_0xc18d('0xc')]('Ticket\x20created!');logger[_0xc18d('0xc')](_0xc18d('0x61'),_0x123301['id']);return setRelationship(_0x43891b,_0x3df7ab,_0x123301,_0xc18d('0x62'));})[_0xc18d('0x29')](function(){return setRelationship(_0x43891b,_0x43a75f,_0x123301,_0xc18d('0x63'));})['then'](function(){return getServerInfo(_0x43891b);})[_0xc18d('0x29')](function(_0x166f39){var _0x2fe91e=parseInt(_0x166f39['version'][_0xc18d('0x64')](0x0));var _0x407eb0=util[_0xc18d('0x20')](_0xc18d('0x65'),_0x3debc0[_0xc18d('0x53')],_0x123301['id']);if(_0x2fe91e>0x6){_0x407eb0=util[_0xc18d('0x20')](_0xc18d('0x66'),_0x3debc0[_0xc18d('0x53')],_0x123301['id']);}logger['info'](_0xc18d('0x67'),_0xc18d('0x68'));emit(util[_0xc18d('0x20')](_0xc18d('0x69'),_0x4e6a5a[_0xc18d('0x27')]),_0xc18d('0x6a'),{'uri':_0x407eb0});})['catch'](function(_0x1d5d3f){logger['error']('[QUEUE]',JSON[_0xc18d('0x1f')](_0x1d5d3f));});};exports[_0xc18d('0x6b')]=function(_0x4e14dd,_0x2b6615,_0x3b6172,_0x37a08c,_0x55cc61,_0x4a641d,_0x4fd59b){var _0x2980dc,_0x31bef1,_0x3446d7,_0x5170a6;_0x4a641d['remoteUri']=intUtil[_0xc18d('0x54')](_0x4a641d[_0xc18d('0x53')]);_0x4a641d['serverUrl']=intUtil['stripTrailingSlash'](_0x4a641d[_0xc18d('0x55')]);def['uri']=util[_0xc18d('0x20')]('%s/service/v4_1/rest.php',_0x4a641d[_0xc18d('0x53')]);if(_0x4fd59b&&_0x4fd59b[_0xc18d('0x6c')]&&_0x4fd59b[_0xc18d('0x6c')]!==_0xc18d('0x6d')){logger[_0xc18d('0xc')](_0xc18d('0x6e'),_0xc18d('0x6f'));_0x2b6615[_0xc18d('0x70')]=util[_0xc18d('0x20')](_0xc18d('0x59'),_0x4a641d['serverUrl'],_0x2b6615['uniqueid'],md5(_0x2b6615[_0xc18d('0x5a')]));}return getConnection(_0x4a641d)[_0xc18d('0x29')](function(_0x2a112c){_0x5170a6=_0x2a112c;return getUser(_0x4a641d,_0x37a08c[_0xc18d('0x27')],_0x5170a6);})[_0xc18d('0x29')](function(_0x4039c0){_0x2980dc=_0x4039c0;logger[_0xc18d('0xc')](_0xc18d('0x5b'),_0x2980dc['id']);return getEndUser(_0x4a641d,_0x2b6615[_0xc18d('0x71')],_0x2b6615['destcalleridnum'],_0x5170a6);})['then'](function(_0x5e6811){_0x31bef1=_0x5e6811;logger[_0xc18d('0xc')](_0xc18d('0x5e'),_0x31bef1['id']);return getTicket(_0x4a641d,_0x2980dc,_0x31bef1,_0x3b6172,_0x2b6615,_0x3b6172[_0xc18d('0x5f')],_0x5170a6,_0xc18d('0x72'));})['then'](function(_0x45c647){_0x3446d7=_0x45c647;logger[_0xc18d('0xc')](_0xc18d('0x73'));logger[_0xc18d('0xc')](_0xc18d('0x61'),_0x3446d7['id']);return setRelationship(_0x5170a6,_0x2980dc,_0x3446d7,'users');})['then'](function(){return setRelationship(_0x5170a6,_0x31bef1,_0x3446d7,_0xc18d('0x63'));})[_0xc18d('0x29')](function(){return getServerInfo(_0x5170a6);})['then'](function(_0x4e73e0){var _0x13fa2d=parseInt(_0x4e73e0[_0xc18d('0x74')][_0xc18d('0x64')](0x0));var _0x115446=util[_0xc18d('0x20')](_0xc18d('0x65'),_0x4a641d[_0xc18d('0x53')],_0x3446d7['id']);if(_0x13fa2d>0x6){_0x115446=util[_0xc18d('0x20')](_0xc18d('0x66'),_0x4a641d[_0xc18d('0x53')],_0x3446d7['id']);}logger[_0xc18d('0xc')](_0xc18d('0x6e'),_0xc18d('0x68'));emit(util[_0xc18d('0x20')](_0xc18d('0x69'),_0x37a08c[_0xc18d('0x27')]),_0xc18d('0x6a'),{'uri':_0x115446});})[_0xc18d('0x75')](function(_0x17acbe){logger['error']('[OUTBOUND]',JSON[_0xc18d('0x1f')](_0x17acbe));});};exports[_0xc18d('0x76')]=function(_0x1267ab,_0x1d2c88,_0x50f001,_0x4a5098,_0x2aa8e9,_0x713a1a){var _0x5644d0,_0x36b5a5,_0x4750fd,_0x4ce2e6;_0x713a1a[_0xc18d('0x53')]=intUtil[_0xc18d('0x54')](_0x713a1a[_0xc18d('0x53')]);_0x713a1a[_0xc18d('0x55')]=intUtil[_0xc18d('0x54')](_0x713a1a[_0xc18d('0x55')]);def[_0xc18d('0x56')]=util[_0xc18d('0x20')]('%s/service/v4_1/rest.php',_0x713a1a[_0xc18d('0x53')]);if(_0x2aa8e9&&_0x2aa8e9[_0xc18d('0x58')]){logger[_0xc18d('0xc')]('['+_0x1d2c88[_0xc18d('0x77')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1d2c88[_0xc18d('0x70')]=util[_0xc18d('0x20')](_0xc18d('0x59'),_0x713a1a[_0xc18d('0x55')],_0x1d2c88[_0xc18d('0x5a')],md5(_0x1d2c88[_0xc18d('0x5a')]));}else{_0x1d2c88[_0xc18d('0x70')]='';}return getConnection(_0x713a1a)[_0xc18d('0x29')](function(_0x1fedf1){_0x4ce2e6=_0x1fedf1;if(!_['isNil'](_0x4a5098)){return getUser(_0x713a1a,_0x4a5098[_0xc18d('0x27')],_0x4ce2e6);}else{return getUser(_0x713a1a,null,_0x4ce2e6);}})[_0xc18d('0x29')](function(_0x5b03cf){_0x5644d0=_0x5b03cf;logger['info'](_0xc18d('0x5b'),_0x5644d0['id']);return getEndUser(_0x713a1a,_0x1d2c88[_0xc18d('0x5c')],_0x1d2c88['calleridnum'],_0x4ce2e6);})[_0xc18d('0x29')](function(_0x3f8f59){_0x36b5a5=_0x3f8f59;logger[_0xc18d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x36b5a5['id']);return getTicket(_0x713a1a,_0x5644d0,_0x36b5a5,_0x50f001,_0x1d2c88,_0x50f001[_0xc18d('0x5f')],_0x4ce2e6,'Inbound');})[_0xc18d('0x29')](function(_0x34952e){_0x4750fd=_0x34952e;logger[_0xc18d('0xc')](_0xc18d('0x73'));logger[_0xc18d('0xc')](_0xc18d('0x61'),_0x4750fd['id']);return setRelationship(_0x4ce2e6,_0x5644d0,_0x4750fd,_0xc18d('0x62'));})[_0xc18d('0x29')](function(){return setRelationship(_0x4ce2e6,_0x36b5a5,_0x4750fd,_0xc18d('0x63'));})[_0xc18d('0x29')](function(){return getServerInfo(_0x4ce2e6);})[_0xc18d('0x75')](function(_0x90156d){logger[_0xc18d('0x78')]('['+_0x1d2c88[_0xc18d('0x77')][_0xc18d('0x79')]()+']',JSON[_0xc18d('0x1f')](_0x90156d));});}; \ No newline at end of file +var _0x93d8=['destcalleridnum','Fields','Outbound','contacts','unmanaged','lastevent','toUpperCase','calleridname','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','redis','localhost','socket.io-emitter','POST','info','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_name','name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','length','find','entry_list','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','custom_fields','content','variable','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','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','error','stripTrailingSlash','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname'];(function(_0x530443,_0x359ae6){var _0x5f4944=function(_0x1755ca){while(--_0x1755ca){_0x530443['push'](_0x530443['shift']());}};_0x5f4944(++_0x359ae6);}(_0x93d8,0x1e0));var _0x893d=function(_0x543b4b,_0x2bad9e){_0x543b4b=_0x543b4b-0x0;var _0x331ba4=_0x93d8[_0x543b4b];return _0x331ba4;};'use strict';var _=require('lodash');var rp=require(_0x893d('0x0'));var BPromise=require(_0x893d('0x1'));var md5=require(_0x893d('0x2'));var util=require(_0x893d('0x3'));var Redis=require(_0x893d('0x4'));var intUtil=require('./util');var config=require(_0x893d('0x5'));var logger=require('../../../../config/logger')('sugarcrm');config[_0x893d('0x6')]=_['defaults'](config[_0x893d('0x6')],{'host':_0x893d('0x7'),'port':0x18eb});var io=require(_0x893d('0x8'))(new Redis(config[_0x893d('0x6')]));var def={'method':_0x893d('0x9'),'json':!![]};function emit(_0x5573db,_0x306b44,_0x1a712d){io['to'](_0x5573db)['emit'](_0x306b44,_0x1a712d);}function getTicket(_0x3d7610,_0x40adbb,_0x5bb538,_0x133ffa,_0xf0aeac,_0x2f037d,_0x44bac8,_0x4a2292){logger[_0x893d('0xa')]('Creating\x20new\x20ticket...');var _0xbd0172=new Date();var _0x619d9f=[{'name':'name','value':intUtil[_0x893d('0xb')](_0x133ffa[_0x893d('0xc')],_0xf0aeac,'\x20')},{'name':_0x893d('0xd'),'value':_0x40adbb['id']},{'name':_0x893d('0xe'),'value':_0x40adbb['id']},{'name':'description','value':intUtil[_0x893d('0xb')](_0x133ffa[_0x893d('0xf')],_0xf0aeac,'\x0a')},{'name':_0x893d('0x10'),'value':_0xbd0172[_0x893d('0x11')]()[_0x893d('0x12')](0x0,0x13)[_0x893d('0x13')]('T','\x20')},{'name':_0x893d('0x14'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x893d('0x15'),'value':_0x5bb538['id']},{'name':'parent_type','value':'Contacts'},{'name':_0x893d('0x16'),'value':_0x5bb538[_0x893d('0x17')]},{'name':_0x893d('0x18'),'value':_0x4a2292}];if(_0x2f037d['length']){_[_0x893d('0x19')](_0x2f037d,function(_0x5da6a4){if(_0xf0aeac[_0x5da6a4[_0x893d('0x1a')]]){_0x619d9f[_0x893d('0x1b')]({'name':_0x5da6a4[_0x893d('0x1c')],'value':_0xf0aeac[_0x5da6a4[_0x893d('0x1a')]]});}});}return request({'form':{'method':_0x893d('0x1d'),'input_type':_0x893d('0x1e'),'response_type':_0x893d('0x1e'),'rest_data':JSON[_0x893d('0x1f')]({'session':_0x44bac8['id'],'module_name':'Calls','name_value_list':_0x619d9f})}});}function getAuth(_0x5ca9ee){return util[_0x893d('0x20')](_0x893d('0x21'),new Buffer(_0x5ca9ee[_0x893d('0x22')]+':X')[_0x893d('0x23')](_0x893d('0x24')));}function getServerInfo(_0x34b407){return request({'form':{'method':_0x893d('0x25'),'input_type':_0x893d('0x1e'),'response_type':_0x893d('0x1e'),'rest_data':JSON[_0x893d('0x1f')]({'session':_0x34b407['id']})}});}function getUser(_0x5a39c1,_0x391bf7,_0x27beed){if(!_[_0x893d('0x26')](_0x391bf7)){logger[_0x893d('0xa')](_0x893d('0x27'),_0x391bf7);return request({'form':{'method':_0x893d('0x28'),'input_type':_0x893d('0x1e'),'response_type':_0x893d('0x1e'),'rest_data':JSON[_0x893d('0x1f')]({'session':_0x27beed['id'],'module_name':_0x893d('0x29'),'query':util[_0x893d('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x391bf7),'order_by':'','offset':'0','select_fields':['id',_0x893d('0x17'),_0x893d('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x893d('0x2b')](function(_0x419197){if(_0x419197['entry_list'][_0x893d('0x2c')]){var _0x3f8495=_[_0x893d('0x2d')](_0x419197[_0x893d('0x2e')],function(_0x530760){return _0x530760[_0x893d('0x2f')][_0x893d('0x2a')][_0x893d('0x30')]===_0x391bf7;});if(_0x3f8495){logger[_0x893d('0xa')](_0x893d('0x31'));return BPromise['resolve']({'id':_0x3f8495[_0x893d('0x2f')]['id']['value'],'name':_0x3f8495[_0x893d('0x2f')][_0x893d('0x17')][_0x893d('0x30')]});}}logger[_0x893d('0xa')](_0x893d('0x32'));return BPromise[_0x893d('0x33')]({'id':_0x27beed[_0x893d('0x2f')][_0x893d('0x34')]['value'],'name':_0x27beed[_0x893d('0x2f')][_0x893d('0x2a')][_0x893d('0x30')]});});}else{logger[_0x893d('0xa')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x893d('0x33')]({'id':_0x27beed['name_value_list'][_0x893d('0x34')][_0x893d('0x30')],'name':_0x27beed[_0x893d('0x2f')][_0x893d('0x2a')]['value']});}}function getEndUser(_0x336c56,_0x569587,_0x3f63f8,_0x47fdde){logger[_0x893d('0xa')](_0x893d('0x35'),_0x3f63f8);return request({'form':{'method':_0x893d('0x28'),'input_type':_0x893d('0x1e'),'response_type':_0x893d('0x1e'),'rest_data':JSON[_0x893d('0x1f')]({'session':_0x47fdde['id'],'module_name':_0x893d('0x36'),'query':util[_0x893d('0x20')](_0x893d('0x37'),_0x3f63f8),'order_by':'','offset':'0','select_fields':['id',_0x893d('0x17'),_0x893d('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x893d('0x2b')](function(_0x590057){if(_0x590057[_0x893d('0x2e')][_0x893d('0x2c')]){var _0x1ddbd5=_[_0x893d('0x2d')](_0x590057[_0x893d('0x2e')],function(_0x2dacfa){return _0x2dacfa[_0x893d('0x2f')]['phone_home'][_0x893d('0x30')]===_0x3f63f8;});if(_0x1ddbd5){logger[_0x893d('0xa')]('Enduser\x20found!');return BPromise[_0x893d('0x33')]({'id':_0x1ddbd5[_0x893d('0x2f')]['id']['value'],'name':_0x1ddbd5[_0x893d('0x2f')][_0x893d('0x17')][_0x893d('0x30')],'phone':_0x1ddbd5[_0x893d('0x2f')][_0x893d('0x38')]['value']});}}else{logger[_0x893d('0xa')](_0x893d('0x39'));return request({'form':{'method':_0x893d('0x1d'),'input_type':_0x893d('0x1e'),'response_type':_0x893d('0x1e'),'rest_data':JSON['stringify']({'session':_0x47fdde['id'],'module_name':_0x893d('0x36'),'name_value_list':[{'name':_0x893d('0x3a'),'value':_0x569587!==_0x893d('0x3b')?_0x569587:util['format']('Caller\x20-\x20%s',_0x3f63f8)},{'name':_0x893d('0x38'),'value':_0x3f63f8}]})}})[_0x893d('0x2b')](function(_0x329c9d){logger[_0x893d('0xa')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x329c9d['id'],'name':_0x329c9d[_0x893d('0x2e')][_0x893d('0x3a')]['value'],'phone':_0x329c9d[_0x893d('0x2e')]['phone_home'][_0x893d('0x30')]});});}});}function request(_0x1bf6f7){logger[_0x893d('0x3c')](_0x893d('0x3d'),JSON['stringify'](_0x1bf6f7));return rp(_[_0x893d('0x3e')](def,_0x1bf6f7));}function getTags(_0x10752e,_0x4e2e4c){var _0x1188ec=[];if(_0x10752e&&_0x10752e[_0x893d('0x2c')]>0x0){_0x1188ec=_['map'](_0x10752e,_0x4e2e4c);}return _0x1188ec;}function getCustomFields(_0x3a0ca6,_0x2b4988){var _0x4599db=[];var _0x33e714={'custom_fields':[]};if(_0x3a0ca6[_0x893d('0x2c')]>0x0){_[_0x893d('0x19')](_0x3a0ca6,function(_0x39ef6b){if(_0x39ef6b[_0x893d('0x3f')]===_0x893d('0x40')&&_0x39ef6b[_0x893d('0x41')]&&!_0x39ef6b[_0x893d('0x42')]){_0x33e714[_0x39ef6b[_0x893d('0x41')][_0x893d('0x43')]()]=_0x39ef6b['content'][_0x893d('0x23')]();}else if(_0x39ef6b[_0x893d('0x3f')]===_0x893d('0x40')&&_0x39ef6b['idField']&&_0x39ef6b[_0x893d('0x42')]){_0x33e714[_0x893d('0x44')][_0x893d('0x1b')]({'id':_0x39ef6b[_0x893d('0x1c')],'value':_0x39ef6b[_0x893d('0x45')][_0x893d('0x23')]()});}else if(_0x39ef6b[_0x893d('0x3f')]===_0x893d('0x46')&&_0x39ef6b[_0x893d('0x1a')]&&_0x39ef6b['idField']&&_0x39ef6b[_0x893d('0x42')]){_0x2b4988[_0x39ef6b[_0x893d('0x1a')]]&&_0x33e714['custom_fields'][_0x893d('0x1b')]({'id':_0x39ef6b[_0x893d('0x1c')],'value':_0x2b4988[_0x39ef6b[_0x893d('0x1a')]][_0x893d('0x23')]()});}else if(_0x39ef6b[_0x893d('0x3f')]===_0x893d('0x47')&&_0x39ef6b[_0x893d('0x48')]&&_0x39ef6b[_0x893d('0x48')][_0x893d('0x17')]&&_0x39ef6b[_0x893d('0x1c')]&&_0x39ef6b['customField']){_0x2b4988[_0x39ef6b['Variable']['name'][_0x893d('0x43')]()]&&_0x33e714[_0x893d('0x44')]['push']({'id':_0x39ef6b[_0x893d('0x1c')],'value':_0x2b4988[_0x39ef6b[_0x893d('0x48')][_0x893d('0x17')][_0x893d('0x43')]()][_0x893d('0x23')]()});}});}return _0x33e714;}function getConnection(_0x45593a){return request({'method':'POST','form':{'method':_0x893d('0x49'),'input_type':_0x893d('0x1e'),'response_type':_0x893d('0x1e'),'rest_data':JSON[_0x893d('0x1f')]({'user_auth':{'user_name':_0x45593a[_0x893d('0x4a')],'password':_0x45593a[_0x893d('0x4b')],'encryption':'PLAIN'},'application':_0x893d('0x4c')})}})['then'](function(_0x40a530){var _0x287e9e=_0x40a530;if(_0x287e9e['id']){def[_0x893d('0x4d')]=_0x287e9e['id'];return BPromise[_0x893d('0x33')](_0x287e9e);}else{throw new Error(util[_0x893d('0x20')](_0x893d('0x4e'),_0x45593a['id']));}});}function setRelationship(_0x3f8cbd,_0x1c138c,_0x4c8110,_0x58b4ab){return request({'form':{'method':_0x893d('0x4f'),'input_type':_0x893d('0x1e'),'response_type':_0x893d('0x1e'),'rest_data':JSON[_0x893d('0x1f')]({'session':_0x3f8cbd['id'],'module_name':_0x893d('0x50'),'module_id':_0x4c8110['id'],'link_field_name':_0x58b4ab,'related_ids':[_0x1c138c['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2ef3c,_0x353f9b,_0x374b84,_0x21027b,_0x3abc36,_0x13f203){var _0x4abc53,_0xcbe70f,_0x192837,_0x16e44;_0x13f203[_0x893d('0x51')]=intUtil['stripTrailingSlash'](_0x13f203[_0x893d('0x51')]);_0x13f203[_0x893d('0x52')]=intUtil['stripTrailingSlash'](_0x13f203[_0x893d('0x52')]);def[_0x893d('0x53')]=util[_0x893d('0x20')]('%s/service/v4_1/rest.php',_0x13f203[_0x893d('0x51')]);if(_0x3abc36&&_0x3abc36[_0x893d('0x54')]){logger[_0x893d('0xa')](_0x893d('0x55'),_0x893d('0x56'));_0x353f9b[_0x893d('0x57')]=util[_0x893d('0x20')](_0x893d('0x58'),_0x13f203[_0x893d('0x52')],_0x353f9b['uniqueid'],md5(_0x353f9b[_0x893d('0x59')]));}else{_0x353f9b[_0x893d('0x57')]='';}return getConnection(_0x13f203)[_0x893d('0x2b')](function(_0x4e43cd){_0x16e44=_0x4e43cd;return getUser(_0x13f203,_0x21027b[_0x893d('0x17')],_0x16e44);})[_0x893d('0x2b')](function(_0x1a8655){_0x4abc53=_0x1a8655;logger[_0x893d('0xa')](_0x893d('0x5a'),_0x4abc53['id']);return getEndUser(_0x13f203,_0x353f9b['calleridname'],_0x353f9b[_0x893d('0x5b')],_0x16e44);})[_0x893d('0x2b')](function(_0x13f67a){_0xcbe70f=_0x13f67a;logger[_0x893d('0xa')](_0x893d('0x5c'),_0xcbe70f['id']);return getTicket(_0x13f203,_0x4abc53,_0xcbe70f,_0x374b84,_0x353f9b,_0x374b84['Fields'],_0x16e44,_0x893d('0x5d'));})[_0x893d('0x2b')](function(_0xf97d25){_0x192837=_0xf97d25;logger['info'](_0x893d('0x5e'));logger[_0x893d('0xa')](_0x893d('0x5f'),_0x192837['id']);return setRelationship(_0x16e44,_0x4abc53,_0x192837,'users');})[_0x893d('0x2b')](function(){return setRelationship(_0x16e44,_0xcbe70f,_0x192837,'contacts');})['then'](function(){return getServerInfo(_0x16e44);})[_0x893d('0x2b')](function(_0x5b74bf){var _0x557017=parseInt(_0x5b74bf[_0x893d('0x60')][_0x893d('0x61')](0x0));var _0x3d3c98=util['format'](_0x893d('0x62'),_0x13f203['remoteUri'],_0x192837['id']);if(_0x557017>0x6){_0x3d3c98=util[_0x893d('0x20')](_0x893d('0x63'),_0x13f203[_0x893d('0x51')],_0x192837['id']);}logger[_0x893d('0xa')](_0x893d('0x55'),_0x893d('0x64'));emit(util[_0x893d('0x20')](_0x893d('0x65'),_0x21027b[_0x893d('0x17')]),_0x893d('0x66'),{'uri':_0x3d3c98});})['catch'](function(_0x5d3030){logger[_0x893d('0x67')](_0x893d('0x55'),JSON[_0x893d('0x1f')](_0x5d3030));});};exports['outbound']=function(_0x1e38d3,_0x29fa13,_0x13d5a5,_0x2290f3,_0x45cc7b,_0x560422,_0x3fdb16){var _0x31e365,_0x558a69,_0x3b8f77,_0x319453;_0x560422[_0x893d('0x51')]=intUtil['stripTrailingSlash'](_0x560422[_0x893d('0x51')]);_0x560422[_0x893d('0x52')]=intUtil[_0x893d('0x68')](_0x560422['serverUrl']);def[_0x893d('0x53')]=util[_0x893d('0x20')](_0x893d('0x69'),_0x560422[_0x893d('0x51')]);if(_0x3fdb16&&_0x3fdb16[_0x893d('0x6a')]&&_0x3fdb16[_0x893d('0x6a')]!==_0x893d('0x6b')){logger[_0x893d('0xa')](_0x893d('0x6c'),_0x893d('0x56'));_0x29fa13['recordingURL']=util[_0x893d('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x560422[_0x893d('0x52')],_0x29fa13['uniqueid'],md5(_0x29fa13[_0x893d('0x59')]));}return getConnection(_0x560422)[_0x893d('0x2b')](function(_0x56a1bf){_0x319453=_0x56a1bf;return getUser(_0x560422,_0x2290f3[_0x893d('0x17')],_0x319453);})[_0x893d('0x2b')](function(_0x384763){_0x31e365=_0x384763;logger[_0x893d('0xa')](_0x893d('0x5a'),_0x31e365['id']);return getEndUser(_0x560422,_0x29fa13[_0x893d('0x6d')],_0x29fa13[_0x893d('0x6e')],_0x319453);})[_0x893d('0x2b')](function(_0x554fa4){_0x558a69=_0x554fa4;logger[_0x893d('0xa')]('The\x20Enduser\x20ID\x20is:',_0x558a69['id']);return getTicket(_0x560422,_0x31e365,_0x558a69,_0x13d5a5,_0x29fa13,_0x13d5a5[_0x893d('0x6f')],_0x319453,_0x893d('0x70'));})[_0x893d('0x2b')](function(_0x1591d2){_0x3b8f77=_0x1591d2;logger[_0x893d('0xa')](_0x893d('0x5e'));logger[_0x893d('0xa')](_0x893d('0x5f'),_0x3b8f77['id']);return setRelationship(_0x319453,_0x31e365,_0x3b8f77,'users');})[_0x893d('0x2b')](function(){return setRelationship(_0x319453,_0x558a69,_0x3b8f77,_0x893d('0x71'));})[_0x893d('0x2b')](function(){return getServerInfo(_0x319453);})[_0x893d('0x2b')](function(_0x575d0){var _0x36ac8c=parseInt(_0x575d0[_0x893d('0x60')]['charAt'](0x0));var _0x359a0a=util[_0x893d('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x560422[_0x893d('0x51')],_0x3b8f77['id']);if(_0x36ac8c>0x6){_0x359a0a=util[_0x893d('0x20')](_0x893d('0x63'),_0x560422[_0x893d('0x51')],_0x3b8f77['id']);}logger[_0x893d('0xa')](_0x893d('0x6c'),_0x893d('0x64'));emit(util['format'](_0x893d('0x65'),_0x2290f3[_0x893d('0x17')]),_0x893d('0x66'),{'uri':_0x359a0a});})['catch'](function(_0x565192){logger[_0x893d('0x67')](_0x893d('0x6c'),JSON['stringify'](_0x565192));});};exports[_0x893d('0x72')]=function(_0x377490,_0x490661,_0x592211,_0x3ba738,_0x13a71e,_0x57a96a){var _0x2d28dc,_0x5e3a6d,_0x34db20,_0x272305;_0x57a96a[_0x893d('0x51')]=intUtil[_0x893d('0x68')](_0x57a96a['remoteUri']);_0x57a96a[_0x893d('0x52')]=intUtil[_0x893d('0x68')](_0x57a96a[_0x893d('0x52')]);def['uri']=util[_0x893d('0x20')](_0x893d('0x69'),_0x57a96a['remoteUri']);if(_0x13a71e&&_0x13a71e[_0x893d('0x54')]){logger['info']('['+_0x490661[_0x893d('0x73')][_0x893d('0x74')]()+']',_0x893d('0x56'));_0x490661[_0x893d('0x57')]=util['format'](_0x893d('0x58'),_0x57a96a['serverUrl'],_0x490661[_0x893d('0x59')],md5(_0x490661[_0x893d('0x59')]));}else{_0x490661[_0x893d('0x57')]='';}return getConnection(_0x57a96a)[_0x893d('0x2b')](function(_0x482d26){_0x272305=_0x482d26;if(!_[_0x893d('0x26')](_0x3ba738)){return getUser(_0x57a96a,_0x3ba738[_0x893d('0x17')],_0x272305);}else{return getUser(_0x57a96a,null,_0x272305);}})['then'](function(_0x486b2a){_0x2d28dc=_0x486b2a;logger[_0x893d('0xa')]('The\x20User\x20ID\x20is:',_0x2d28dc['id']);return getEndUser(_0x57a96a,_0x490661[_0x893d('0x75')],_0x490661['calleridnum'],_0x272305);})[_0x893d('0x2b')](function(_0x5288b5){_0x5e3a6d=_0x5288b5;logger[_0x893d('0xa')](_0x893d('0x5c'),_0x5e3a6d['id']);return getTicket(_0x57a96a,_0x2d28dc,_0x5e3a6d,_0x592211,_0x490661,_0x592211[_0x893d('0x6f')],_0x272305,_0x893d('0x5d'));})[_0x893d('0x2b')](function(_0x3c5f64){_0x34db20=_0x3c5f64;logger[_0x893d('0xa')]('Ticket\x20created!');logger['info'](_0x893d('0x5f'),_0x34db20['id']);return setRelationship(_0x272305,_0x2d28dc,_0x34db20,'users');})['then'](function(){return setRelationship(_0x272305,_0x5e3a6d,_0x34db20,_0x893d('0x71'));})['then'](function(){return getServerInfo(_0x272305);})['catch'](function(_0x3feec7){logger['error']('['+_0x490661['lastevent'][_0x893d('0x74')]()+']',JSON[_0x893d('0x1f')](_0x3feec7));});}; \ 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 dcb3ca8..79d0feb 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 _0x6c88=['keyValue','keyType','key','format','%s:\x20%s','keyContent','toLowerCase','join','slice','substring','lastIndexOf','validateEmail','test','lodash','util','getString','sortBy','length','type','string','content','variable','variableName','push','toString','customVariable','Variable','name'];(function(_0xc9d70e,_0x36c9e8){var _0x3797fb=function(_0x7ddda4){while(--_0x7ddda4){_0xc9d70e['push'](_0xc9d70e['shift']());}};_0x3797fb(++_0x36c9e8);}(_0x6c88,0x141));var _0x86c8=function(_0x1f02bc,_0x4cdada){_0x1f02bc=_0x1f02bc-0x0;var _0x378387=_0x6c88[_0x1f02bc];return _0x378387;};'use strict';var _=require(_0x86c8('0x0'));var util=require(_0x86c8('0x1'));exports[_0x86c8('0x2')]=function(_0x4d54d5,_0x48e645,_0x3cde85){var _0x3e35e2=[];if(_0x4d54d5['length']>0x0){var _0x24b478=_[_0x86c8('0x3')](_0x4d54d5,['id']);for(var _0x28f34e=0x0;_0x28f34e<_0x24b478[_0x86c8('0x4')];_0x28f34e++){var _0x344fd2=_0x24b478[_0x28f34e];if(_0x344fd2[_0x86c8('0x5')]===_0x86c8('0x6')){_0x3e35e2['push'](_0x344fd2[_0x86c8('0x7')]);}else if(_0x344fd2['type']===_0x86c8('0x8')&&_0x344fd2[_0x86c8('0x9')]){_0x48e645[_0x344fd2['variableName']]&&_0x3e35e2[_0x86c8('0xa')](_0x48e645[_0x344fd2[_0x86c8('0x9')]][_0x86c8('0xb')]());}else if(_0x344fd2['type']===_0x86c8('0xc')&&_0x344fd2[_0x86c8('0xd')]&&_0x344fd2[_0x86c8('0xd')][_0x86c8('0xe')]){_0x48e645[_0x344fd2[_0x86c8('0xd')][_0x86c8('0xe')]['toLowerCase']()]&&_0x3e35e2[_0x86c8('0xa')](_0x48e645[_0x344fd2[_0x86c8('0xd')][_0x86c8('0xe')]['toLowerCase']()]['toString']());}else if(_0x344fd2[_0x86c8('0x5')]===_0x86c8('0xf')){if(_0x344fd2[_0x86c8('0x10')]===_0x86c8('0x6')&&_0x344fd2[_0x86c8('0x11')]){_0x3e35e2[_0x86c8('0xa')](util[_0x86c8('0x12')](_0x86c8('0x13'),_0x344fd2[_0x86c8('0x11')],_0x344fd2[_0x86c8('0x14')]));}else if(_0x344fd2['keyType']===_0x86c8('0x8')&&_0x344fd2[_0x86c8('0x9')]&&_0x344fd2[_0x86c8('0x11')]){_0x48e645[_0x344fd2[_0x86c8('0x9')]]&&_0x3e35e2['push'](util[_0x86c8('0x12')](_0x86c8('0x13'),_0x344fd2[_0x86c8('0x11')],_0x48e645[_0x344fd2[_0x86c8('0x9')]]));}else if(_0x344fd2[_0x86c8('0x10')]===_0x86c8('0xc')&&_0x344fd2[_0x86c8('0xd')]&&_0x344fd2[_0x86c8('0xd')][_0x86c8('0xe')]&&_0x344fd2[_0x86c8('0x11')]){_0x48e645[_0x344fd2[_0x86c8('0xd')][_0x86c8('0xe')][_0x86c8('0x15')]()]&&_0x3e35e2[_0x86c8('0xa')](util[_0x86c8('0x12')]('%s:\x20%s',_0x344fd2[_0x86c8('0x11')],_0x48e645[_0x344fd2[_0x86c8('0xd')][_0x86c8('0xe')][_0x86c8('0x15')]()]));}}}}return _0x3e35e2[_0x86c8('0x16')](_0x3cde85);};exports['stripTrailingSlash']=function(_0x3f0ae4){var _0x279e0c=_0x3f0ae4[_0x86c8('0x17')](-0x1);if(_0x279e0c==='/'){_0x3f0ae4=_0x3f0ae4[_0x86c8('0x18')](0x0,_0x3f0ae4[_0x86c8('0x19')](_0x279e0c));}return _0x3f0ae4;};exports[_0x86c8('0x1a')]=function(_0x4b0acc){if(!_['isNil'](_0x4b0acc)&&_0x4b0acc!==''){var _0x6a8068=/^(([^<>()\[\]\\.,;:\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 _0x6a8068[_0x86c8('0x1b')](String(_0x4b0acc)[_0x86c8('0x15')]());}else{return![];}}; \ No newline at end of file +var _0xfe92=['test','lodash','util','length','sortBy','type','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','customVariable','slice','substring','lastIndexOf','isNil'];(function(_0x2a72e7,_0x9da708){var _0x4dca68=function(_0x16f928){while(--_0x16f928){_0x2a72e7['push'](_0x2a72e7['shift']());}};_0x4dca68(++_0x9da708);}(_0xfe92,0x1d5));var _0x2fe9=function(_0x30a457,_0x2aa6b5){_0x30a457=_0x30a457-0x0;var _0x2ae5cd=_0xfe92[_0x30a457];return _0x2ae5cd;};'use strict';var _=require(_0x2fe9('0x0'));var util=require(_0x2fe9('0x1'));exports['getString']=function(_0x174b30,_0x359511,_0x556c35){var _0x5a7606=[];if(_0x174b30[_0x2fe9('0x2')]>0x0){var _0x57aca2=_[_0x2fe9('0x3')](_0x174b30,['id']);for(var _0x37e55f=0x0;_0x37e55f<_0x57aca2[_0x2fe9('0x2')];_0x37e55f++){var _0x3912fd=_0x57aca2[_0x37e55f];if(_0x3912fd[_0x2fe9('0x4')]==='string'){_0x5a7606[_0x2fe9('0x5')](_0x3912fd[_0x2fe9('0x6')]);}else if(_0x3912fd['type']===_0x2fe9('0x7')&&_0x3912fd[_0x2fe9('0x8')]){_0x359511[_0x3912fd[_0x2fe9('0x8')]]&&_0x5a7606[_0x2fe9('0x5')](_0x359511[_0x3912fd[_0x2fe9('0x8')]][_0x2fe9('0x9')]());}else if(_0x3912fd['type']==='customVariable'&&_0x3912fd['Variable']&&_0x3912fd[_0x2fe9('0xa')][_0x2fe9('0xb')]){_0x359511[_0x3912fd[_0x2fe9('0xa')][_0x2fe9('0xb')][_0x2fe9('0xc')]()]&&_0x5a7606['push'](_0x359511[_0x3912fd[_0x2fe9('0xa')][_0x2fe9('0xb')][_0x2fe9('0xc')]()]['toString']());}else if(_0x3912fd[_0x2fe9('0x4')]===_0x2fe9('0xd')){if(_0x3912fd[_0x2fe9('0xe')]===_0x2fe9('0xf')&&_0x3912fd[_0x2fe9('0x10')]){_0x5a7606[_0x2fe9('0x5')](util[_0x2fe9('0x11')](_0x2fe9('0x12'),_0x3912fd[_0x2fe9('0x10')],_0x3912fd[_0x2fe9('0x13')]));}else if(_0x3912fd[_0x2fe9('0xe')]==='variable'&&_0x3912fd[_0x2fe9('0x8')]&&_0x3912fd[_0x2fe9('0x10')]){_0x359511[_0x3912fd[_0x2fe9('0x8')]]&&_0x5a7606[_0x2fe9('0x5')](util['format']('%s:\x20%s',_0x3912fd['key'],_0x359511[_0x3912fd[_0x2fe9('0x8')]]));}else if(_0x3912fd[_0x2fe9('0xe')]===_0x2fe9('0x14')&&_0x3912fd[_0x2fe9('0xa')]&&_0x3912fd['Variable']['name']&&_0x3912fd[_0x2fe9('0x10')]){_0x359511[_0x3912fd[_0x2fe9('0xa')][_0x2fe9('0xb')]['toLowerCase']()]&&_0x5a7606[_0x2fe9('0x5')](util['format'](_0x2fe9('0x12'),_0x3912fd['key'],_0x359511[_0x3912fd[_0x2fe9('0xa')]['name']['toLowerCase']()]));}}}}return _0x5a7606['join'](_0x556c35);};exports['stripTrailingSlash']=function(_0x3e7b83){var _0x4b4283=_0x3e7b83[_0x2fe9('0x15')](-0x1);if(_0x4b4283==='/'){_0x3e7b83=_0x3e7b83[_0x2fe9('0x16')](0x0,_0x3e7b83[_0x2fe9('0x17')](_0x4b4283));}return _0x3e7b83;};exports['validateEmail']=function(_0x3b182a){if(!_[_0x2fe9('0x18')](_0x3b182a)&&_0x3b182a!==''){var _0x5cb069=/^(([^<>()\[\]\\.,;:\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 _0x5cb069[_0x2fe9('0x19')](String(_0x3b182a)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index d5b2942..bd49335 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 _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(_0x26c143,_0x5f1777){var _0x4e2b50=function(_0x440d3f){while(--_0x440d3f){_0x26c143['push'](_0x26c143['shift']());}};_0x4e2b50(++_0x5f1777);}(_0x34e8,0x12c));var _0x834e=function(_0x54b3c8,_0x2a03d6){_0x54b3c8=_0x54b3c8-0x0;var _0x54ab81=_0x34e8[_0x54b3c8];return _0x54ab81;};'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 +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(_0x5947db,_0x2eac74){var _0x54ae21=function(_0x12f45d){while(--_0x12f45d){_0x5947db['push'](_0x5947db['shift']());}};_0x54ae21(++_0x2eac74);}(_0x34e8,0x12c));var _0x834e=function(_0x4b52f8,_0x5043cb){_0x4b52f8=_0x4b52f8-0x0;var _0x112904=_0x34e8[_0x4b52f8];return _0x112904;};'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 cfca01a..a758bc7 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 _0xf149=['count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','[HTTP]','GET','map','forEach','includes','type','nameField','customField','toLowerCase','content','string','picklist','idField','custom_fields','variable','variableName','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','Authorization','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','newTab','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','calleridnum','The\x20Enduser\x20ID\x20is:','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','%s/tickets.json','Subjects','getString','Descriptions','Fields','ticket','validateEmail','%s/search.json','then'];(function(_0x4aaedd,_0x2a05cd){var _0x39d5b5=function(_0x5568e8){while(--_0x5568e8){_0x4aaedd['push'](_0x4aaedd['shift']());}};_0x39d5b5(++_0x2a05cd);}(_0xf149,0x127));var _0x9f14=function(_0x4d5721,_0x51a33d){_0x4d5721=_0x4d5721-0x0;var _0x88a224=_0xf149[_0x4d5721];return _0x88a224;};'use strict';var _=require('lodash');var rp=require(_0x9f14('0x0'));var md5=require(_0x9f14('0x1'));var util=require(_0x9f14('0x2'));var Redis=require(_0x9f14('0x3'));var intUtil=require('./util');var config=require(_0x9f14('0x4'));var logger=require(_0x9f14('0x5'))('zendesk');config[_0x9f14('0x6')]=_[_0x9f14('0x7')](config['redis'],{'host':_0x9f14('0x8'),'port':0x18eb});var io=require(_0x9f14('0x9'))(new Redis(config[_0x9f14('0x6')]));function emit(_0xd79b7d,_0xe6276a,_0x1656e7){io['to'](_0xd79b7d)[_0x9f14('0xa')](_0xe6276a,_0x1656e7);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x2d2248,_0x3a623c,_0x44c1dc,_0x4a7dbe,_0x25013e){logger[_0x9f14('0xb')](_0x9f14('0xc'));return request({'uri':util[_0x9f14('0xd')](_0x9f14('0xe'),_0x2d2248['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x44c1dc['id'],'submitter_id':_0x3a623c?_0x3a623c['id']:undefined,'assignee_id':_0x3a623c?_0x3a623c['id']:undefined,'tags':getTags(_0x4a7dbe['Tags'],'name'),'subject':intUtil['getString'](_0x4a7dbe[_0x9f14('0xf')],_0x25013e,'\x20'),'description':intUtil[_0x9f14('0x10')](_0x4a7dbe[_0x9f14('0x11')],_0x25013e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9f14('0x10')](_0x4a7dbe[_0x9f14('0x11')],_0x25013e,'\x0a')}},getCustomFields(_0x4a7dbe[_0x9f14('0x12')],_0x25013e))}})['then'](function(_0x543d40){logger[_0x9f14('0xb')]('Ticket\x20created!');return _0x543d40[_0x9f14('0x13')];});}function getUser(_0x2eee11,_0x2e224a){if(intUtil[_0x9f14('0x14')](_0x2e224a)){logger[_0x9f14('0xb')]('Getting\x20agent\x20with\x20email',_0x2e224a);return request({'uri':util[_0x9f14('0xd')](_0x9f14('0x15'),_0x2eee11['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x2e224a)}})[_0x9f14('0x16')](function(_0x3cefef){if(_0x3cefef[_0x9f14('0x17')]){logger[_0x9f14('0xb')](_0x9f14('0x18'));return _[_0x9f14('0x19')](_0x3cefef[_0x9f14('0x1a')],{'email':_0x2e224a,'role':'agent'});}else{logger[_0x9f14('0xb')](_0x9f14('0x1b'));return request({'uri':util[_0x9f14('0xd')]('%s/users/me.json',_0x2eee11[_0x9f14('0x1c')])})['then'](function(_0x1dc6f7){logger[_0x9f14('0xb')](_0x9f14('0x1d'));return _0x1dc6f7[_0x9f14('0x1e')];});}});}else{logger[_0x9f14('0xb')](_0x9f14('0x1b'));return request({'uri':util['format']('%s/users/me.json',_0x2eee11[_0x9f14('0x1c')])})[_0x9f14('0x16')](function(_0x31aeff){logger[_0x9f14('0xb')](_0x9f14('0x1d'));return _0x31aeff['user'];});}}function getEndUser(_0x4f079f,_0x1a36a2,_0x583019){logger[_0x9f14('0xb')](_0x9f14('0x1f'),_0x583019);return request({'uri':util['format'](_0x9f14('0x15'),_0x4f079f['remoteUri']),'qs':{'query':util[_0x9f14('0xd')](_0x9f14('0x20'),_0x583019)}})['then'](function(_0x31120e){var _0x376373;if(_0x31120e[_0x9f14('0x1a')][_0x9f14('0x21')]){_0x31120e[_0x9f14('0x1a')]=_[_0x9f14('0x22')](_0x31120e['results'],{'suspended':![],'role':_0x9f14('0x23')});if(_0x31120e[_0x9f14('0x1a')][_0x9f14('0x21')]){_0x376373=_[_0x9f14('0x24')](_0x31120e['results']);}}if(_0x376373){logger[_0x9f14('0xb')](_0x9f14('0x25'));return _0x376373;}else{logger[_0x9f14('0xb')](_0x9f14('0x26'));return request({'uri':util[_0x9f14('0xd')]('%s/users.json',_0x4f079f[_0x9f14('0x1c')]),'method':_0x9f14('0x27'),'body':{'user':{'role':_0x9f14('0x23'),'name':util[_0x9f14('0xd')]('Caller\x20-\x20%s',_0x1a36a2||_0x583019),'phone':_0x583019}}})[_0x9f14('0x16')](function(_0x3274cf){logger[_0x9f14('0xb')](_0x9f14('0x28'));return _0x3274cf['user'];});}});}function getAuth(_0x2ed49d){var _0x5967e3;if(_0x2ed49d[_0x9f14('0x29')]===_0x9f14('0x2a')){_0x5967e3=util[_0x9f14('0xd')](_0x9f14('0x2b'),_0x2ed49d[_0x9f14('0x2c')],_0x2ed49d[_0x9f14('0x2a')]);}else if(_0x2ed49d['authType']===_0x9f14('0x2d')){_0x5967e3=util[_0x9f14('0xd')](_0x9f14('0x2e'),_0x2ed49d['username'],_0x2ed49d['token']);}return util[_0x9f14('0xd')]('Basic\x20%s',new Buffer(_0x5967e3)[_0x9f14('0x2f')](_0x9f14('0x30')));}function request(_0x27bba7){logger[_0x9f14('0x31')](_0x9f14('0x32'),JSON['stringify'](_0x27bba7));return rp(_[_0x9f14('0x7')](_0x27bba7,{'method':_0x9f14('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x50103e,_0x175a2b){var _0x232584=[];if(_0x50103e&&_0x50103e['length']>0x0){_0x232584=_[_0x9f14('0x34')](_0x50103e,_0x175a2b);}return _0x232584;}function getCustomFields(_0x5b804f,_0x3416d3){var _0x266be4=[];var _0x3aab0d={'custom_fields':[]};if(_0x5b804f[_0x9f14('0x21')]>0x0){_[_0x9f14('0x35')](_0x5b804f,function(_0x4933cf){if(_[_0x9f14('0x36')](['string','picklist'],_0x4933cf[_0x9f14('0x37')])&&_0x4933cf[_0x9f14('0x38')]&&!_0x4933cf[_0x9f14('0x39')]){_0x3aab0d[_0x4933cf['nameField'][_0x9f14('0x3a')]()]=_0x4933cf[_0x9f14('0x3b')]['toString']();}else if(_[_0x9f14('0x36')]([_0x9f14('0x3c'),_0x9f14('0x3d')],_0x4933cf[_0x9f14('0x37')])&&_0x4933cf[_0x9f14('0x3e')]&&_0x4933cf[_0x9f14('0x39')]){_0x3aab0d[_0x9f14('0x3f')]['push']({'id':_0x4933cf[_0x9f14('0x3e')],'value':_0x4933cf[_0x9f14('0x3b')][_0x9f14('0x2f')]()});}else if(_0x4933cf[_0x9f14('0x37')]===_0x9f14('0x40')&&_0x4933cf[_0x9f14('0x41')]&&_0x4933cf[_0x9f14('0x3e')]&&_0x4933cf[_0x9f14('0x39')]){_0x3416d3[_0x4933cf[_0x9f14('0x41')]]&&_0x3aab0d['custom_fields']['push']({'id':_0x4933cf[_0x9f14('0x3e')],'value':_0x3416d3[_0x4933cf[_0x9f14('0x41')]]['toString']()});}else if(_0x4933cf[_0x9f14('0x37')]==='customVariable'&&_0x4933cf[_0x9f14('0x42')]&&_0x4933cf[_0x9f14('0x42')][_0x9f14('0x43')]&&_0x4933cf[_0x9f14('0x3e')]&&_0x4933cf[_0x9f14('0x39')]){_0x3416d3[_0x4933cf[_0x9f14('0x42')][_0x9f14('0x43')]['toLowerCase']()]&&_0x3aab0d[_0x9f14('0x3f')]['push']({'id':_0x4933cf['idField'],'value':_0x3416d3[_0x4933cf[_0x9f14('0x42')][_0x9f14('0x43')]['toLowerCase']()][_0x9f14('0x2f')]()});}});}return _0x3aab0d;}exports[_0x9f14('0x44')]=function(_0x1353dd,_0x6816f1,_0x3994b4,_0x5c28fe,_0x9811db,_0x5bfeb9){var _0x34a2e1,_0x351373;_0x5bfeb9[_0x9f14('0x1c')]=intUtil[_0x9f14('0x45')](_0x5bfeb9['remoteUri']);_0x5bfeb9['serverUrl']=intUtil[_0x9f14('0x45')](_0x5bfeb9[_0x9f14('0x46')]);if(_0x9811db&&_0x9811db[_0x9f14('0x47')]){logger['info'](_0x9f14('0x48'),'Recording\x20is\x20enabled!');_0x6816f1[_0x9f14('0x49')]=util[_0x9f14('0xd')](_0x9f14('0x4a'),_0x5bfeb9[_0x9f14('0x46')],_0x6816f1[_0x9f14('0x4b')],md5(_0x6816f1[_0x9f14('0x4b')]));}else{_0x6816f1[_0x9f14('0x49')]='';}headers['Authorization']=getAuth(_0x5bfeb9);return getUser(_0x5bfeb9,_0x5c28fe[_0x9f14('0x4c')])[_0x9f14('0x16')](function(_0x42ba90){_0x34a2e1=_0x42ba90;logger[_0x9f14('0xb')]('The\x20User\x20ID\x20is:',_0x34a2e1['id']);return getEndUser(_0x5bfeb9,_0x6816f1[_0x9f14('0x4d')],_0x6816f1['calleridnum']);})['then'](function(_0x42df37){_0x351373=_0x42df37;logger[_0x9f14('0xb')]('The\x20Enduser\x20ID\x20is:',_0x351373['id']);return getTicket(_0x5bfeb9,_0x34a2e1,_0x351373,_0x3994b4,_0x6816f1);})[_0x9f14('0x16')](function(_0x1d28a9){if(_0x1d28a9){logger[_0x9f14('0xb')](_0x9f14('0x4e'),_0x1d28a9['id']);switch(_0x5bfeb9['type']){case _0x9f14('0x4f'):logger['info'](_0x9f14('0x48'),_0x9f14('0x50'));return request({'uri':util[_0x9f14('0xd')](_0x9f14('0x51'),_0x5bfeb9[_0x9f14('0x1c')],_0x34a2e1['id'],_0x1d28a9['id']),'method':_0x9f14('0x27')});case'newTab':logger[_0x9f14('0xb')](_0x9f14('0x48'),_0x9f14('0x52'));emit(util[_0x9f14('0xd')](_0x9f14('0x53'),_0x5c28fe[_0x9f14('0x43')]),_0x9f14('0x54'),{'uri':util[_0x9f14('0xd')](_0x9f14('0x55'),_0x5bfeb9[_0x9f14('0x1c')][_0x9f14('0x56')](_0x9f14('0x57'),''),_0x1d28a9['id'])});break;default:logger[_0x9f14('0x58')]('[QUEUE]',_0x9f14('0x59'));}}})['catch'](function(_0x22cbbb){logger[_0x9f14('0x58')](_0x9f14('0x5a'),util['inspect'](_0x22cbbb,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x1a1458,_0x2b70a8,_0xfc1688,_0x3f267e,_0x3d5cf6,_0x384ead,_0x3ab3f4){var _0x2b8fec,_0x44378a;_0x384ead[_0x9f14('0x1c')]=intUtil[_0x9f14('0x45')](_0x384ead['remoteUri']);_0x384ead[_0x9f14('0x46')]=intUtil[_0x9f14('0x45')](_0x384ead[_0x9f14('0x46')]);if(_0x3ab3f4&&_0x3ab3f4[_0x9f14('0x5b')]&&_0x3ab3f4[_0x9f14('0x5b')]!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2b70a8['recordingURL']=util['format'](_0x9f14('0x4a'),_0x384ead[_0x9f14('0x46')],_0x2b70a8['uniqueid'],md5(_0x2b70a8['uniqueid']));}headers[_0x9f14('0x5c')]=getAuth(_0x384ead);return getUser(_0x384ead,_0x3f267e[_0x9f14('0x4c')])[_0x9f14('0x16')](function(_0x3788f9){_0x2b8fec=_0x3788f9;logger[_0x9f14('0xb')](_0x9f14('0x5d'),_0x2b8fec['id']);return getEndUser(_0x384ead,_0x2b70a8['destcalleridname'],_0x2b70a8[_0x9f14('0x5e')]);})[_0x9f14('0x16')](function(_0x44b2af){_0x44378a=_0x44b2af;logger['info']('The\x20Enduser\x20ID\x20is:',_0x44378a['id']);return getTicket(_0x384ead,_0x2b8fec,_0x44378a,_0xfc1688,_0x2b70a8);})[_0x9f14('0x16')](function(_0x3cbe20){if(_0x3cbe20){logger['info'](_0x9f14('0x4e'),_0x3cbe20['id']);switch(_0x384ead[_0x9f14('0x37')]){case _0x9f14('0x4f'):logger[_0x9f14('0xb')](_0x9f14('0x5f'),_0x9f14('0x50'));return request({'uri':util[_0x9f14('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x384ead[_0x9f14('0x1c')],_0x2b8fec['id'],_0x3cbe20['id']),'method':'POST'});case _0x9f14('0x60'):logger[_0x9f14('0xb')](_0x9f14('0x5f'),_0x9f14('0x52'));emit(util[_0x9f14('0xd')]('user:%s',_0x3f267e['name']),'trigger:browser:url',{'uri':util[_0x9f14('0xd')]('%s/agent/tickets/%s',_0x384ead[_0x9f14('0x1c')][_0x9f14('0x56')](_0x9f14('0x57'),''),_0x3cbe20['id'])});break;default:logger[_0x9f14('0x58')](_0x9f14('0x5f'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x9f14('0x61')](function(_0x1ffd2d){logger['error'](_0x9f14('0x62'),util[_0x9f14('0x63')](_0x1ffd2d,{'showHidden':!![],'depth':null}));});};exports[_0x9f14('0x64')]=function(_0x2808ad,_0x579fb6,_0x15eb34,_0x1434ce,_0x5c38c9,_0x1d4b24){var _0x1487fb,_0x231b1b;_0x1d4b24[_0x9f14('0x1c')]=intUtil[_0x9f14('0x45')](_0x1d4b24[_0x9f14('0x1c')]);_0x1d4b24[_0x9f14('0x46')]=intUtil[_0x9f14('0x45')](_0x1d4b24[_0x9f14('0x46')]);if(_0x5c38c9&&_0x5c38c9[_0x9f14('0x47')]){logger[_0x9f14('0xb')]('['+_0x579fb6[_0x9f14('0x65')][_0x9f14('0x66')]()+']',_0x9f14('0x67'));_0x579fb6['recordingURL']=util[_0x9f14('0xd')](_0x9f14('0x4a'),_0x1d4b24[_0x9f14('0x46')],_0x579fb6['uniqueid'],md5(_0x579fb6['uniqueid']));}else{_0x579fb6[_0x9f14('0x49')]='';}headers['Authorization']=getAuth(_0x1d4b24);return getUser(_0x1d4b24)[_0x9f14('0x16')](function(_0xcf512d){_0x1487fb=_0xcf512d;logger[_0x9f14('0xb')]('The\x20User\x20ID\x20is:',_0x1487fb['id']);return getEndUser(_0x1d4b24,_0x579fb6[_0x9f14('0x4d')],_0x579fb6[_0x9f14('0x68')]);})['then'](function(_0x575442){_0x231b1b=_0x575442;logger[_0x9f14('0xb')](_0x9f14('0x69'),_0x231b1b['id']);return getTicket(_0x1d4b24,_0x1487fb,_0x231b1b,_0x15eb34,_0x579fb6);})[_0x9f14('0x16')](function(_0x30f62e){if(_0x30f62e){logger[_0x9f14('0xb')](_0x9f14('0x4e'),_0x30f62e['id']);}})[_0x9f14('0x61')](function(_0x1ca45c){logger['error']('['+_0x579fb6[_0x9f14('0x65')][_0x9f14('0x66')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x9f14('0x63')](_0x1ca45c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf87d=['replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','trigger:browser:url','%s/agent/tickets/%s','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','type:user\x20role:end-user\x20phone:%s','length','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','token','%s/token:%s','username','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','content','customField','push','idField','variableName','custom_fields','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x51f20b,_0x237853){var _0x4d7d68=function(_0x147699){while(--_0x147699){_0x51f20b['push'](_0x51f20b['shift']());}};_0x4d7d68(++_0x237853);}(_0xf87d,0xf5));var _0xdf87=function(_0x3bad8f,_0x40d08f){_0x3bad8f=_0x3bad8f-0x0;var _0x4dc249=_0xf87d[_0x3bad8f];return _0x4dc249;};'use strict';var _=require(_0xdf87('0x0'));var rp=require(_0xdf87('0x1'));var md5=require(_0xdf87('0x2'));var util=require('util');var Redis=require(_0xdf87('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xdf87('0x4'));config[_0xdf87('0x5')]=_[_0xdf87('0x6')](config[_0xdf87('0x5')],{'host':_0xdf87('0x7'),'port':0x18eb});var io=require(_0xdf87('0x8'))(new Redis(config['redis']));function emit(_0x1b1789,_0x47a18a,_0x197ba4){io['to'](_0x1b1789)[_0xdf87('0x9')](_0x47a18a,_0x197ba4);}var headers={'Content-Type':_0xdf87('0xa'),'Accept':_0xdf87('0xa')};function getTicket(_0xe36970,_0x5bf2f5,_0x3bdc4a,_0xf6f091,_0x95fec6){logger[_0xdf87('0xb')](_0xdf87('0xc'));return request({'uri':util[_0xdf87('0xd')](_0xdf87('0xe'),_0xe36970[_0xdf87('0xf')]),'method':_0xdf87('0x10'),'body':{'ticket':_[_0xdf87('0x11')]({'requester_id':_0x3bdc4a['id'],'submitter_id':_0x5bf2f5?_0x5bf2f5['id']:undefined,'assignee_id':_0x5bf2f5?_0x5bf2f5['id']:undefined,'tags':getTags(_0xf6f091[_0xdf87('0x12')],_0xdf87('0x13')),'subject':intUtil['getString'](_0xf6f091[_0xdf87('0x14')],_0x95fec6,'\x20'),'description':intUtil[_0xdf87('0x15')](_0xf6f091[_0xdf87('0x16')],_0x95fec6,'\x0a'),'comment':{'public':![],'body':intUtil[_0xdf87('0x15')](_0xf6f091['Descriptions'],_0x95fec6,'\x0a')}},getCustomFields(_0xf6f091[_0xdf87('0x17')],_0x95fec6))}})[_0xdf87('0x18')](function(_0xeb0a4d){logger['info']('Ticket\x20created!');return _0xeb0a4d[_0xdf87('0x19')];});}function getUser(_0x245d9b,_0x235243){if(intUtil['validateEmail'](_0x235243)){logger[_0xdf87('0xb')](_0xdf87('0x1a'),_0x235243);return request({'uri':util[_0xdf87('0xd')](_0xdf87('0x1b'),_0x245d9b[_0xdf87('0xf')]),'qs':{'query':util[_0xdf87('0xd')](_0xdf87('0x1c'),_0x235243)}})[_0xdf87('0x18')](function(_0x1b9a4f){if(_0x1b9a4f[_0xdf87('0x1d')]){logger[_0xdf87('0xb')](_0xdf87('0x1e'));return _[_0xdf87('0x1f')](_0x1b9a4f[_0xdf87('0x20')],{'email':_0x235243,'role':_0xdf87('0x21')});}else{logger[_0xdf87('0xb')](_0xdf87('0x22'));return request({'uri':util[_0xdf87('0xd')]('%s/users/me.json',_0x245d9b['remoteUri'])})[_0xdf87('0x18')](function(_0x3498a6){logger[_0xdf87('0xb')]('Admin\x20account\x20selected.');return _0x3498a6['user'];});}});}else{logger[_0xdf87('0xb')](_0xdf87('0x22'));return request({'uri':util['format'](_0xdf87('0x23'),_0x245d9b[_0xdf87('0xf')])})[_0xdf87('0x18')](function(_0x337d0c){logger[_0xdf87('0xb')]('Admin\x20account\x20selected.');return _0x337d0c[_0xdf87('0x24')];});}}function getEndUser(_0x2c30bf,_0x19b182,_0x1e2baa){logger[_0xdf87('0xb')]('Searching\x20enduser\x20with\x20phone',_0x1e2baa);return request({'uri':util['format'](_0xdf87('0x1b'),_0x2c30bf[_0xdf87('0xf')]),'qs':{'query':util['format'](_0xdf87('0x25'),_0x1e2baa)}})[_0xdf87('0x18')](function(_0x300d76){var _0x44ae89;if(_0x300d76[_0xdf87('0x20')][_0xdf87('0x26')]){_0x300d76[_0xdf87('0x20')]=_['filter'](_0x300d76['results'],{'suspended':![],'role':_0xdf87('0x27')});if(_0x300d76[_0xdf87('0x20')][_0xdf87('0x26')]){_0x44ae89=_['first'](_0x300d76[_0xdf87('0x20')]);}}if(_0x44ae89){logger[_0xdf87('0xb')](_0xdf87('0x28'));return _0x44ae89;}else{logger[_0xdf87('0xb')](_0xdf87('0x29'));return request({'uri':util[_0xdf87('0xd')](_0xdf87('0x2a'),_0x2c30bf[_0xdf87('0xf')]),'method':_0xdf87('0x10'),'body':{'user':{'role':_0xdf87('0x27'),'name':util[_0xdf87('0xd')](_0xdf87('0x2b'),_0x19b182||_0x1e2baa),'phone':_0x1e2baa}}})[_0xdf87('0x18')](function(_0x361bb3){logger[_0xdf87('0xb')]('Enduser\x20created.');return _0x361bb3['user'];});}});}function getAuth(_0x15e1a1){var _0x54bddd;if(_0x15e1a1[_0xdf87('0x2c')]===_0xdf87('0x2d')){_0x54bddd=util[_0xdf87('0xd')](_0xdf87('0x2e'),_0x15e1a1['username'],_0x15e1a1[_0xdf87('0x2d')]);}else if(_0x15e1a1[_0xdf87('0x2c')]===_0xdf87('0x2f')){_0x54bddd=util[_0xdf87('0xd')](_0xdf87('0x30'),_0x15e1a1[_0xdf87('0x31')],_0x15e1a1['token']);}return util[_0xdf87('0xd')]('Basic\x20%s',new Buffer(_0x54bddd)[_0xdf87('0x32')](_0xdf87('0x33')));}function request(_0x5ca4d3){logger[_0xdf87('0x34')](_0xdf87('0x35'),JSON[_0xdf87('0x36')](_0x5ca4d3));return rp(_[_0xdf87('0x6')](_0x5ca4d3,{'method':_0xdf87('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1570d4,_0x410a45){var _0x13c2d1=[];if(_0x1570d4&&_0x1570d4[_0xdf87('0x26')]>0x0){_0x13c2d1=_[_0xdf87('0x38')](_0x1570d4,_0x410a45);}return _0x13c2d1;}function getCustomFields(_0xa6e5b1,_0x43cd7d){var _0x28f523=[];var _0x1be1db={'custom_fields':[]};if(_0xa6e5b1[_0xdf87('0x26')]>0x0){_[_0xdf87('0x39')](_0xa6e5b1,function(_0x4bfdf3){if(_[_0xdf87('0x3a')]([_0xdf87('0x3b'),_0xdf87('0x3c')],_0x4bfdf3[_0xdf87('0x3d')])&&_0x4bfdf3[_0xdf87('0x3e')]&&!_0x4bfdf3['customField']){_0x1be1db[_0x4bfdf3[_0xdf87('0x3e')]['toLowerCase']()]=_0x4bfdf3[_0xdf87('0x3f')]['toString']();}else if(_[_0xdf87('0x3a')]([_0xdf87('0x3b'),_0xdf87('0x3c')],_0x4bfdf3[_0xdf87('0x3d')])&&_0x4bfdf3['idField']&&_0x4bfdf3[_0xdf87('0x40')]){_0x1be1db['custom_fields'][_0xdf87('0x41')]({'id':_0x4bfdf3[_0xdf87('0x42')],'value':_0x4bfdf3[_0xdf87('0x3f')]['toString']()});}else if(_0x4bfdf3[_0xdf87('0x3d')]==='variable'&&_0x4bfdf3[_0xdf87('0x43')]&&_0x4bfdf3[_0xdf87('0x42')]&&_0x4bfdf3[_0xdf87('0x40')]){_0x43cd7d[_0x4bfdf3[_0xdf87('0x43')]]&&_0x1be1db[_0xdf87('0x44')][_0xdf87('0x41')]({'id':_0x4bfdf3[_0xdf87('0x42')],'value':_0x43cd7d[_0x4bfdf3[_0xdf87('0x43')]][_0xdf87('0x32')]()});}else if(_0x4bfdf3[_0xdf87('0x3d')]===_0xdf87('0x45')&&_0x4bfdf3[_0xdf87('0x46')]&&_0x4bfdf3[_0xdf87('0x46')][_0xdf87('0x13')]&&_0x4bfdf3['idField']&&_0x4bfdf3[_0xdf87('0x40')]){_0x43cd7d[_0x4bfdf3['Variable']['name'][_0xdf87('0x47')]()]&&_0x1be1db['custom_fields'][_0xdf87('0x41')]({'id':_0x4bfdf3[_0xdf87('0x42')],'value':_0x43cd7d[_0x4bfdf3[_0xdf87('0x46')][_0xdf87('0x13')][_0xdf87('0x47')]()][_0xdf87('0x32')]()});}});}return _0x1be1db;}exports[_0xdf87('0x48')]=function(_0x12b65b,_0x59f266,_0x26987b,_0x264262,_0x104ec7,_0x2dad9d){var _0x32d371,_0x4f440f;_0x2dad9d[_0xdf87('0xf')]=intUtil[_0xdf87('0x49')](_0x2dad9d[_0xdf87('0xf')]);_0x2dad9d['serverUrl']=intUtil[_0xdf87('0x49')](_0x2dad9d[_0xdf87('0x4a')]);if(_0x104ec7&&_0x104ec7[_0xdf87('0x4b')]){logger['info'](_0xdf87('0x4c'),_0xdf87('0x4d'));_0x59f266[_0xdf87('0x4e')]=util[_0xdf87('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2dad9d[_0xdf87('0x4a')],_0x59f266[_0xdf87('0x4f')],md5(_0x59f266['uniqueid']));}else{_0x59f266[_0xdf87('0x4e')]='';}headers[_0xdf87('0x50')]=getAuth(_0x2dad9d);return getUser(_0x2dad9d,_0x264262[_0xdf87('0x51')])['then'](function(_0x167b1d){_0x32d371=_0x167b1d;logger['info'](_0xdf87('0x52'),_0x32d371['id']);return getEndUser(_0x2dad9d,_0x59f266[_0xdf87('0x53')],_0x59f266[_0xdf87('0x54')]);})['then'](function(_0x3a619a){_0x4f440f=_0x3a619a;logger[_0xdf87('0xb')]('The\x20Enduser\x20ID\x20is:',_0x4f440f['id']);return getTicket(_0x2dad9d,_0x32d371,_0x4f440f,_0x26987b,_0x59f266);})[_0xdf87('0x18')](function(_0xffb0ab){if(_0xffb0ab){logger[_0xdf87('0xb')](_0xdf87('0x55'),_0xffb0ab['id']);switch(_0x2dad9d[_0xdf87('0x3d')]){case _0xdf87('0x56'):logger[_0xdf87('0xb')](_0xdf87('0x4c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xdf87('0xd')](_0xdf87('0x57'),_0x2dad9d[_0xdf87('0xf')],_0x32d371['id'],_0xffb0ab['id']),'method':'POST'});case _0xdf87('0x58'):logger[_0xdf87('0xb')](_0xdf87('0x4c'),_0xdf87('0x59'));emit(util[_0xdf87('0xd')](_0xdf87('0x5a'),_0x264262['name']),'trigger:browser:url',{'uri':util[_0xdf87('0xd')]('%s/agent/tickets/%s',_0x2dad9d[_0xdf87('0xf')][_0xdf87('0x5b')](_0xdf87('0x5c'),''),_0xffb0ab['id'])});break;default:logger[_0xdf87('0x5d')]('[QUEUE]',_0xdf87('0x5e'));}}})['catch'](function(_0x23976e){logger[_0xdf87('0x5d')](_0xdf87('0x5f'),util[_0xdf87('0x60')](_0x23976e,{'showHidden':!![],'depth':null}));});};exports[_0xdf87('0x61')]=function(_0x39d1d1,_0x4b25c7,_0x1eb6e9,_0x30987f,_0x2982ad,_0x3440c4,_0x2b5da8){var _0x3e9c11,_0xf3cca6;_0x3440c4['remoteUri']=intUtil[_0xdf87('0x49')](_0x3440c4[_0xdf87('0xf')]);_0x3440c4['serverUrl']=intUtil[_0xdf87('0x49')](_0x3440c4[_0xdf87('0x4a')]);if(_0x2b5da8&&_0x2b5da8[_0xdf87('0x62')]&&_0x2b5da8[_0xdf87('0x62')]!==_0xdf87('0x63')){logger['info']('[OUTBOUND]',_0xdf87('0x4d'));_0x4b25c7['recordingURL']=util[_0xdf87('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3440c4[_0xdf87('0x4a')],_0x4b25c7[_0xdf87('0x4f')],md5(_0x4b25c7[_0xdf87('0x4f')]));}headers['Authorization']=getAuth(_0x3440c4);return getUser(_0x3440c4,_0x30987f[_0xdf87('0x51')])['then'](function(_0x25f1c1){_0x3e9c11=_0x25f1c1;logger[_0xdf87('0xb')](_0xdf87('0x52'),_0x3e9c11['id']);return getEndUser(_0x3440c4,_0x4b25c7['destcalleridname'],_0x4b25c7['destcalleridnum']);})['then'](function(_0x246867){_0xf3cca6=_0x246867;logger['info'](_0xdf87('0x64'),_0xf3cca6['id']);return getTicket(_0x3440c4,_0x3e9c11,_0xf3cca6,_0x1eb6e9,_0x4b25c7);})[_0xdf87('0x18')](function(_0x5c4b24){if(_0x5c4b24){logger[_0xdf87('0xb')](_0xdf87('0x55'),_0x5c4b24['id']);switch(_0x3440c4['type']){case _0xdf87('0x56'):logger[_0xdf87('0xb')](_0xdf87('0x65'),_0xdf87('0x66'));return request({'uri':util[_0xdf87('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3440c4[_0xdf87('0xf')],_0x3e9c11['id'],_0x5c4b24['id']),'method':'POST'});case _0xdf87('0x58'):logger[_0xdf87('0xb')](_0xdf87('0x65'),_0xdf87('0x59'));emit(util[_0xdf87('0xd')](_0xdf87('0x5a'),_0x30987f[_0xdf87('0x13')]),_0xdf87('0x67'),{'uri':util[_0xdf87('0xd')](_0xdf87('0x68'),_0x3440c4[_0xdf87('0xf')][_0xdf87('0x5b')](_0xdf87('0x5c'),''),_0x5c4b24['id'])});break;default:logger[_0xdf87('0x5d')](_0xdf87('0x65'),_0xdf87('0x5e'));}}})[_0xdf87('0x69')](function(_0x222504){logger['error'](_0xdf87('0x6a'),util[_0xdf87('0x60')](_0x222504,{'showHidden':!![],'depth':null}));});};exports[_0xdf87('0x6b')]=function(_0x974a99,_0x2ec614,_0x5b4774,_0x23ec66,_0x2f6058,_0x3e1472){var _0x3739a3,_0x2551da;_0x3e1472['remoteUri']=intUtil['stripTrailingSlash'](_0x3e1472['remoteUri']);_0x3e1472[_0xdf87('0x4a')]=intUtil[_0xdf87('0x49')](_0x3e1472['serverUrl']);if(_0x2f6058&&_0x2f6058[_0xdf87('0x4b')]){logger[_0xdf87('0xb')]('['+_0x2ec614[_0xdf87('0x6c')][_0xdf87('0x6d')]()+']',_0xdf87('0x4d'));_0x2ec614['recordingURL']=util[_0xdf87('0xd')](_0xdf87('0x6e'),_0x3e1472['serverUrl'],_0x2ec614[_0xdf87('0x4f')],md5(_0x2ec614[_0xdf87('0x4f')]));}else{_0x2ec614[_0xdf87('0x4e')]='';}headers[_0xdf87('0x50')]=getAuth(_0x3e1472);return getUser(_0x3e1472)[_0xdf87('0x18')](function(_0x23e8fa){_0x3739a3=_0x23e8fa;logger[_0xdf87('0xb')](_0xdf87('0x52'),_0x3739a3['id']);return getEndUser(_0x3e1472,_0x2ec614[_0xdf87('0x53')],_0x2ec614[_0xdf87('0x54')]);})[_0xdf87('0x18')](function(_0x8e8da6){_0x2551da=_0x8e8da6;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2551da['id']);return getTicket(_0x3e1472,_0x3739a3,_0x2551da,_0x5b4774,_0x2ec614);})['then'](function(_0x33b112){if(_0x33b112){logger[_0xdf87('0xb')](_0xdf87('0x55'),_0x33b112['id']);}})[_0xdf87('0x69')](function(_0x393c6f){logger['error']('['+_0x2ec614[_0xdf87('0x6c')][_0xdf87('0x6d')]()+']'+_0xdf87('0x6f'),util[_0xdf87('0x60')](_0x393c6f,{'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 2c12304..b980b4d 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 _0x4125=['https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientSecret','stack','info','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','catch','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Owner','administrator','Subject','getString','Subjects','Description','Full_Name','First_Name','Last_Name','What_Id','Call_Duration','utc','talktime','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','connect','rejected','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','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.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','/api/voice/recordings/','destcalleridname','Outbound','unmanaged','toUpperCase','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x4125,0x72));var _0x5412=function(_0xebb06b,_0x5d23cb){_0xebb06b=_0xebb06b-0x0;var _0x5e52d2=_0x4125[_0xebb06b];return _0x5e52d2;};'use strict';var _=require('lodash');var rp=require(_0x5412('0x0'));var md5=require(_0x5412('0x1'));var util=require(_0x5412('0x2'));var intUtil=require('./util');var moment=require(_0x5412('0x3'));var Redis=require(_0x5412('0x4'));var BPromise=require(_0x5412('0x5'));var config=require(_0x5412('0x6'));var logger=require(_0x5412('0x7'))(_0x5412('0x8'));config[_0x5412('0x9')]=_[_0x5412('0xa')](config[_0x5412('0x9')],{'host':_0x5412('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5412('0x9')]));function emit(_0x55704a,_0x367fa5,_0x2a0c49){io['to'](_0x55704a)[_0x5412('0xc')](_0x367fa5,_0x2a0c49);}function request(_0x1dbb7b){logger[_0x5412('0xd')](_0x5412('0xe'),JSON['stringify'](_0x1dbb7b));return rp(_0x1dbb7b);}function getCustomFields(_0x2c32d8,_0xe46d63){var _0x589ccc={};if(_0x2c32d8[_0x5412('0xf')]>0x0){_[_0x5412('0x10')](_0x2c32d8,function(_0x1213dd){if(_[_0x5412('0x11')]([_0x5412('0x12'),_0x5412('0x13')],_0x1213dd[_0x5412('0x14')])&&_0x1213dd['idField']){_0x589ccc[_0x1213dd[_0x5412('0x15')]]=_0x1213dd['content']['toString']();}else if(_0x1213dd['type']==='variable'&&_0x1213dd['variableName']&&_0x1213dd['idField']&&_0xe46d63[_0x1213dd['variableName']]){_0x589ccc[_0x1213dd[_0x5412('0x15')]]=_0xe46d63[_0x1213dd[_0x5412('0x16')]][_0x5412('0x17')]();}else if(_0x1213dd['type']===_0x5412('0x18')&&_0x1213dd['Variable']&&_0x1213dd[_0x5412('0x19')]['name']&&_0x1213dd[_0x5412('0x15')]&&_0xe46d63[_0x1213dd['Variable'][_0x5412('0x1a')]['toLowerCase']()]){_0x589ccc[_0x1213dd[_0x5412('0x15')]]=_0xe46d63[_0x1213dd[_0x5412('0x19')][_0x5412('0x1a')][_0x5412('0x1b')]()][_0x5412('0x17')]();}});}return _0x589ccc;}function getName(_0x22cb42){if(_0x22cb42[_0x5412('0x1c')]('\x20')>0x0){var _0x54e0cb=_0x22cb42['split'](/ (.+)/);if(_0x54e0cb[0x1]){return _0x54e0cb;}}return[_0x22cb42,_0x22cb42];}var accountsTokens={};function getAccessToken(_0x3038b6){return new Promise(function(_0x4fee21,_0x4e09ed){if(!_[_0x5412('0x1d')](accountsTokens[_0x3038b6['id']])&&!_['isNil'](accountsTokens[_0x3038b6['id']][_0x5412('0x1e')])){if(moment()[_0x5412('0x1f')](accountsTokens[_0x3038b6['id']][_0x5412('0x20')])){_0x4fee21(accountsTokens[_0x3038b6['id']]['access_token']);}}var _0x4b5901;switch(_0x3038b6[_0x5412('0x21')]){case'US':_0x4b5901=_0x5412('0x22');break;case'AU':_0x4b5901='https://accounts.zoho.com.au';break;case'EU':_0x4b5901=_0x5412('0x23');break;case'IN':_0x4b5901=_0x5412('0x24');break;case'CN':_0x4b5901=_0x5412('0x25');break;default:_0x4b5901=_0x5412('0x23');break;}var _0x22caf1={'method':'POST','uri':_0x4b5901+_0x5412('0x26'),'qs':{'refresh_token':_0x3038b6['refreshToken'],'client_id':_0x3038b6['clientId'],'client_secret':_0x3038b6[_0x5412('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x22caf1)['then'](function(_0x2eddbb){accountsTokens[_0x3038b6['id']]={'access_token':_0x2eddbb[_0x5412('0x1e')],'expires_in':moment()['add'](_0x2eddbb['expires_in'],'seconds')};_0x4fee21(_0x2eddbb['access_token']);})['catch'](function(_0x5dfa21){logger['error']('Failing\x20creating\x20the\x20access_token',_0x5dfa21[_0x5412('0x28')]);_0x4e09ed(_0x5dfa21);});});}function getUser(_0x41cfe8,_0x1f1167,_0x4d3ce8,_0x130190){logger[_0x5412('0x29')]('Search\x20user');return request({'method':_0x5412('0x2a'),'uri':util['format'](_0x5412('0x2b'),_0x1f1167),'qs':{'type':_0x5412('0x2c')},'headers':{'Authorization':_0x5412('0x2d')+_0x41cfe8},'json':!![]})[_0x5412('0x2e')](function(_0x5e896a){if(_0x5e896a[_0x5412('0x2f')]){var _0x1e15f1=-0x1;if(_[_0x5412('0x30')](_0x5e896a[_0x5412('0x2f')])){if(!_[_0x5412('0x1d')](_0x130190)){_0x1e15f1=_[_0x5412('0x31')](_0x5e896a[_0x5412('0x2f')],function(_0x1fa3af){return _0x1fa3af[_0x5412('0x32')]===_0x130190;});}if(_0x1e15f1>=0x0){logger[_0x5412('0x29')](_0x5412('0x33'));}else{logger['info'](_0x5412('0x34'));_0x1e15f1=_[_0x5412('0x31')](_0x5e896a[_0x5412('0x2f')],function(_0x42d49f){return _0x42d49f[_0x5412('0x35')]['name']==='Administrator';});}return _0x5e896a['users'][_0x1e15f1];}else{if(_0x5e896a[_0x5412('0x36')]['profile']['name']===_0x5412('0x37')){logger[_0x5412('0x29')](_0x5412('0x34'));user=_0x5e896a[_0x5412('0x36')];return user;}else{logger['error'](_0x5412('0x38'),JSON[_0x5412('0x39')](_0x5e896a));throw new Error(_0x5412('0x3a')+JSON[_0x5412('0x39')](_0x5e896a));}}}else{logger[_0x5412('0x3b')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x5e896a));throw new Error(_0x5412('0x3a')+JSON[_0x5412('0x39')](_0x5e896a));}})['catch'](function(_0x31ca0c){console['error'](_0x31ca0c);});}function getZohoUser(_0x4d6808,_0x3e889c){return new BPromise(function(_0x55238e,_0x3a6161){request(_0x4d6808)['then'](function(_0x43da18){var _0xab5732=null;if(_0x43da18){_0xab5732=_0x43da18[_0x5412('0x3c')][0x0];_0xab5732[_0x5412('0x3d')]=_0x3e889c;}_0x55238e(_0xab5732);})['catch'](function(_0x373153){_0x3a6161(_0x373153);});});}function createEndUser(_0x43945c,_0x3ea82d,_0x92bca6,_0x4108eb,_0x42f894,_0x432c22){var _0x92bca6=getName(_0x92bca6);return request({'method':_0x5412('0x3e'),'uri':_0x5412('0x3f')+_0x3ea82d+_0x5412('0x40')+_[_0x5412('0x41')](_0x432c22[_0x5412('0x42')])+'s','body':{'data':[{'Last_Name':_0x92bca6[0x1],'First_Name':_0x92bca6[0x0],'Phone':_0x4108eb,'Owner':{'name':!_[_0x5412('0x1d')](_0x42f894['role'][_0x5412('0x1a')])?_0x42f894[_0x5412('0x43')]['name']:!_['isNil'](_0x42f894[_0x5412('0x44')])?_0x42f894[_0x5412('0x44')]+'\x20'+_0x42f894[_0x5412('0x45')]:_0x42f894[_0x5412('0x45')],'id':_0x42f894['id']}}]},'headers':{'Authorization':_0x5412('0x2d')+_0x43945c},'json':!![]})['then'](function(_0x1dee1d){if(_0x1dee1d&&_0x1dee1d[_0x5412('0x3c')][0x0][_0x5412('0x46')]==='SUCCESS'){var _0x5ac3b7=_0x1dee1d['data'][0x0][_0x5412('0x47')];_0x5ac3b7[_0x5412('0x3d')]=_[_0x5412('0x41')](_0x432c22[_0x5412('0x42')])+'s';return _0x5ac3b7;}logger[_0x5412('0x3b')](_0x5412('0x38'),JSON[_0x5412('0x39')](data));throw new Error(_0x5412('0x48')+JSON[_0x5412('0x39')](data));})[_0x5412('0x49')](function(_0x33b677){console[_0x5412('0x4a')]('CREATE\x20ERROR',_0x33b677);});}function getEndUser(_0x30832d,_0x346887,_0x593a76,_0x4ac2be,_0x42b165,_0x3f5162,_0x473ef5){var _0xdc4bc={'method':_0x5412('0x2a'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x30832d},'json':!![]};switch(_0x473ef5[_0x5412('0x4b')]){case _0x5412('0x4c'):_0xdc4bc[_0x5412('0x4d')]=_0x5412('0x3f')+_0x346887+_0x5412('0x4e')+_0x42b165+'))';return getZohoUser(_0xdc4bc,_0x5412('0x4f'))['then'](function(_0x52898f){if(_0x52898f)return _0x52898f;_0xdc4bc['uri']=_0x5412('0x3f')+_0x346887+_0x5412('0x50')+_0x42b165+'))';return getZohoUser(_0xdc4bc,_0x5412('0x51'))['then'](function(_0x2565f8){if(_0x2565f8)return _0x2565f8;if(_0x473ef5[_0x5412('0x42')]!=_0x5412('0x52')){return createEndUser(_0x30832d,_0x346887,_0x4ac2be,_0x42b165,_0x3f5162,_0x473ef5);}else{return{};}});});break;case'contact':_0xdc4bc[_0x5412('0x4d')]='https://www.zohoapis.'+_0x346887+_0x5412('0x4e')+_0x42b165+'))';return getZohoUser(_0xdc4bc,_0x5412('0x4f'))[_0x5412('0x2e')](function(_0x1f717e){if(_0x1f717e)return _0x1f717e;if(_0x473ef5[_0x5412('0x42')]!=_0x5412('0x52')){return createEndUser(_0x30832d,_0x346887,_0x4ac2be,_0x42b165,_0x3f5162,_0x473ef5);}else{return{};}});break;case _0x5412('0x53'):_0xdc4bc[_0x5412('0x4d')]=_0x5412('0x3f')+_0x346887+_0x5412('0x50')+_0x42b165+'))';return getZohoUser(_0xdc4bc,_0x5412('0x51'))['then'](function(_0x496499){if(_0x496499)return _0x496499;if(_0x473ef5['moduleCreate']!='nothing'){return createEndUser(_0x30832d,_0x346887,_0x4ac2be,_0x42b165,_0x3f5162,_0x473ef5);}else{return{};}});break;}}function getCall(_0x108b62,_0x17a5d7,_0x50cf5c,_0x59d50d,_0x1b7926,_0x279f93,_0x1628b7,_0x30530e){logger[_0x5412('0x29')]('Creating\x20new\x20call...');var _0x52e58a={};_0x52e58a[_0x5412('0x54')]={'name':!_[_0x5412('0x1d')](_0x59d50d[_0x5412('0x43')][_0x5412('0x1a')])&&!_[_0x5412('0x1d')](_0x59d50d[_0x5412('0x35')][_0x5412('0x1a')])&&_0x59d50d[_0x5412('0x35')][_0x5412('0x1a')]===_0x5412('0x55')?_0x59d50d['role'][_0x5412('0x1a')]:!_['isNil'](_0x59d50d['first_name'])?_0x59d50d[_0x5412('0x44')]+'\x20'+_0x59d50d[_0x5412('0x45')]:_0x59d50d[_0x5412('0x45')],'id':_0x59d50d['id']};_0x52e58a[_0x5412('0x56')]=intUtil[_0x5412('0x57')](_0x279f93[_0x5412('0x58')],_0x1628b7,'\x20');_0x52e58a[_0x5412('0x59')]=intUtil[_0x5412('0x57')](_0x279f93['Descriptions'],_0x1628b7,'\x0a');if(_0x1b7926[_0x5412('0x3d')]===_0x5412('0x4f')){_0x52e58a['Who_Id']={'name':!_[_0x5412('0x1d')](_0x1b7926[_0x5412('0x5a')])?_0x1b7926[_0x5412('0x5a')]:!_['isNil'](_0x1b7926[_0x5412('0x5b')])?_0x1b7926[_0x5412('0x5b')]+'\x20'+_0x1b7926[_0x5412('0x5c')]:_0x1b7926[_0x5412('0x5c')],'id':_0x1b7926['id']};}if(_0x1b7926[_0x5412('0x3d')]===_0x5412('0x51')){_0x52e58a[_0x5412('0x5d')]={'name':!_[_0x5412('0x1d')](_0x1b7926[_0x5412('0x5a')])?_0x1b7926[_0x5412('0x5a')]:!_[_0x5412('0x1d')](_0x1b7926[_0x5412('0x5b')])?_0x1b7926['First_Name']+'\x20'+_0x1b7926[_0x5412('0x5c')]:_0x1b7926[_0x5412('0x5c')],'id':_0x1b7926['id']};_0x52e58a['$se_module']=_[_0x5412('0x41')](_0x1b7926[_0x5412('0x3d')]);}if(_0x1628b7['talktime']){_0x52e58a[_0x5412('0x5e')]=moment[_0x5412('0x5f')](parseInt(_0x1628b7[_0x5412('0x60')])*0x3e8)[_0x5412('0x61')](_0x5412('0x62'));}else if(_0x1628b7['answertime']&&_0x1628b7['endtime']){_0x52e58a[_0x5412('0x5e')]=moment[_0x5412('0x5f')](moment(_0x1628b7[_0x5412('0x63')],_0x5412('0x64'))[_0x5412('0x65')](moment(_0x1628b7[_0x5412('0x66')],'YYYY-MM-DDTHH:mm:ss')))[_0x5412('0x61')](_0x5412('0x62'));}switch(_0x1628b7[_0x5412('0x67')]){case'called':_0x52e58a[_0x5412('0x68')]=_0x5412('0x69');break;case'complete':case _0x5412('0x6a'):_0x52e58a['Call_Result']='Answered';break;case _0x5412('0x6b'):_0x52e58a['Call_Result']='Rejected';break;case'abandoned':_0x52e58a[_0x5412('0x68')]='Abandoned';break;case _0x5412('0x6c'):_0x52e58a['Call_Result']=_0x5412('0x6d');default:}_0x52e58a[_0x5412('0x6e')]=(_0x30530e===_0x5412('0x6f')?moment(_0x1628b7[_0x5412('0x66')])[_0x5412('0x61')](_0x5412('0x64')):moment(_0x1628b7[_0x5412('0x70')])['format'](_0x5412('0x64')))||moment()[_0x5412('0x61')](_0x5412('0x64'));_0x52e58a['Call_Type']=_0x30530e||_0x5412('0x71');_0x52e58a=_[_0x5412('0x72')](_0x52e58a,getCustomFields(_0x279f93[_0x5412('0x73')],_0x1628b7));return request({'method':_0x5412('0x3e'),'uri':_0x5412('0x3f')+_0x17a5d7+_0x5412('0x74'),'headers':{'Authorization':_0x5412('0x2d')+_0x108b62},'body':{'data':[_0x52e58a]},'json':!![]})[_0x5412('0x2e')](function(_0x1a7348){if(_0x1a7348&&_0x1a7348[_0x5412('0x3c')][0x0][_0x5412('0x46')]===_0x5412('0x75')){logger[_0x5412('0x29')](_0x5412('0x76'));return{'id':_0x1a7348[_0x5412('0x3c')][0x0][_0x5412('0x47')]['id']};}})[_0x5412('0x49')](function(_0x2df0b7){logger[_0x5412('0x29')](_0x5412('0x77'),_0x2df0b7[_0x5412('0x28')]);console[_0x5412('0x4a')](_0x5412('0x77'),_0x2df0b7);});}exports[_0x5412('0x78')]=function(_0x410d91,_0x36ef49,_0x449709,_0x1ee9c6,_0x416248,_0x41bb28){var _0x187852,_0x508aca,_0xab4360;_0x41bb28[_0x5412('0x79')]=intUtil[_0x5412('0x7a')](_0x41bb28[_0x5412('0x79')]);_0x41bb28[_0x5412('0x7b')]=intUtil[_0x5412('0x7a')](_0x41bb28[_0x5412('0x7b')]);if(_0x416248&&_0x416248[_0x5412('0x7c')]){logger[_0x5412('0x29')](_0x5412('0x7d'),'Recording\x20is\x20enabled!');_0x36ef49['recordingURL']=_0x41bb28[_0x5412('0x7b')]+'/api/voice/recordings/'+_0x36ef49[_0x5412('0x7e')]+_0x5412('0x7f')+md5(_0x36ef49[_0x5412('0x7e')]);}else{_0x36ef49[_0x5412('0x80')]='';}var _0x2e722a=_0x41bb28[_0x5412('0x79')]===_0x5412('0x81')?'eu':_0x5412('0x82');return getAccessToken(_0x41bb28)[_0x5412('0x2e')](function(_0x170b02){_0xab4360=_0x170b02;return getUser(_0xab4360,_0x2e722a,_0x41bb28,_0x1ee9c6[_0x5412('0x32')]);})[_0x5412('0x2e')](function(_0x47d149){_0x187852=_0x47d149;logger['info'](_0x5412('0x83'),_0x187852['id']);return getEndUser(_0xab4360,_0x2e722a,_0x41bb28,_0x36ef49[_0x5412('0x84')],_0x36ef49[_0x5412('0x85')],_0x187852,_0x449709);})[_0x5412('0x2e')](function(_0x5de859){_0x508aca=_0x5de859;return getCall(_0xab4360,_0x2e722a,_0x41bb28,_0x187852,_0x508aca,_0x449709,_0x36ef49,'Inbound');})[_0x5412('0x2e')](function(_0x15a119){if(_0x15a119){logger['info'](_0x5412('0x86'),_0x15a119['id']);logger[_0x5412('0x29')](_0x5412('0x7d'),_0x5412('0x87'));emit(util[_0x5412('0x61')](_0x5412('0x88'),_0x1ee9c6[_0x5412('0x1a')]),_0x5412('0x89'),{'uri':_0x5412('0x8a')+_0x41bb28[_0x5412('0x79')]+_0x5412('0x8b')+_0x15a119['id']});}})[_0x5412('0x49')](function(_0x590112){logger[_0x5412('0x3b')](_0x5412('0x7d'),JSON[_0x5412('0x39')](_0x590112));});};exports[_0x5412('0x6f')]=function(_0x1b9bc0,_0x1b9277,_0x1989d6,_0x43bb60,_0x218efe,_0x5e0db7,_0x10582f){var _0x29093b,_0x3d6b3f,_0x19d3d4;_0x5e0db7['host']=intUtil['stripTrailingSlash'](_0x5e0db7['host']);_0x5e0db7['serverUrl']=intUtil[_0x5412('0x7a')](_0x5e0db7['serverUrl']);if(_0x10582f&&_0x10582f[_0x5412('0x8c')]&&_0x10582f[_0x5412('0x8c')]!=='none'){logger[_0x5412('0x29')](_0x5412('0x8d'),_0x5412('0x8e'));_0x1b9277[_0x5412('0x80')]=_0x5e0db7[_0x5412('0x7b')]+_0x5412('0x8f')+_0x1b9277['uniqueid']+_0x5412('0x7f')+md5(_0x1b9277['uniqueid']);}var _0x35b4d1=_0x5e0db7[_0x5412('0x79')]==='zoho.eu'?'eu':_0x5412('0x82');return getAccessToken(_0x5e0db7)[_0x5412('0x2e')](function(_0x1516dd){_0x19d3d4=_0x1516dd;return getUser(_0x19d3d4,_0x35b4d1,_0x5e0db7,_0x43bb60[_0x5412('0x32')]);})[_0x5412('0x2e')](function(_0x43b98a){_0x29093b=_0x43b98a;logger[_0x5412('0x29')]('The\x20User\x20ID\x20is:',_0x29093b['id']);return getEndUser(_0x19d3d4,_0x35b4d1,_0x5e0db7,_0x1b9277[_0x5412('0x90')],_0x1b9277['destcalleridnum'],_0x29093b,_0x1989d6);})[_0x5412('0x2e')](function(_0xb2e888){_0x3d6b3f=_0xb2e888;return getCall(_0x19d3d4,_0x35b4d1,_0x5e0db7,_0x29093b,_0x3d6b3f,_0x1989d6,_0x1b9277,_0x5412('0x91'));})['then'](function(_0x1fea7e){if(_0x1fea7e){logger[_0x5412('0x29')](_0x5412('0x86'),_0x1fea7e['id']);logger['info']('[OUTBOUND]',_0x5412('0x87'));emit(util['format'](_0x5412('0x88'),_0x43bb60['name']),_0x5412('0x89'),{'uri':_0x5412('0x8a')+_0x5e0db7[_0x5412('0x79')]+_0x5412('0x8b')+_0x1fea7e['id']});}})[_0x5412('0x49')](function(_0x1d8a88){logger['error'](_0x5412('0x8d'),JSON[_0x5412('0x39')](_0x1d8a88));});};exports[_0x5412('0x92')]=function(_0x26e9b1,_0x2f5fba,_0x275e49,_0x38e6a4,_0xa7967b,_0x5699be){var _0x1321c3,_0x1f4131,_0x50ca52;_0x5699be[_0x5412('0x79')]=intUtil[_0x5412('0x7a')](_0x5699be[_0x5412('0x79')]);_0x5699be[_0x5412('0x7b')]=intUtil[_0x5412('0x7a')](_0x5699be['serverUrl']);if(_0xa7967b&&_0xa7967b['monitor_format']){logger['info']('['+_0x2f5fba[_0x5412('0x67')][_0x5412('0x93')]()+']',_0x5412('0x8e'));_0x2f5fba[_0x5412('0x80')]=_0x5699be['serverUrl']+'/api/voice/recordings/'+_0x2f5fba['uniqueid']+_0x5412('0x7f')+md5(_0x2f5fba[_0x5412('0x7e')]);}else{_0x2f5fba[_0x5412('0x80')]='';}var _0x598758=_0x5699be[_0x5412('0x79')]===_0x5412('0x81')?'eu':_0x5412('0x82');return getAccessToken(_0x5699be)['then'](function(_0x5ae034){_0x50ca52=_0x5ae034;return getUser(_0x50ca52,_0x598758,_0x5699be);})['then'](function(_0x831711){_0x1321c3=_0x831711;logger['info'](_0x5412('0x83'),_0x1321c3['id']);return getEndUser(_0x50ca52,_0x598758,_0x5699be,_0x2f5fba[_0x5412('0x84')],_0x2f5fba['calleridnum'],_0x1321c3,_0x275e49);})[_0x5412('0x2e')](function(_0x3198bf){_0x1f4131=_0x3198bf;return getCall(_0x50ca52,_0x598758,_0x5699be,_0x1321c3,_0x1f4131,_0x275e49,_0x2f5fba,'Inbound');})[_0x5412('0x2e')](function(_0x166814){if(_0x166814){logger[_0x5412('0x29')]('The\x20Call\x20ID\x20is:',_0x166814['id']);}})[_0x5412('0x49')](function(_0x2cdd7d){logger[_0x5412('0x3b')]('['+_0x2f5fba['lastevent'][_0x5412('0x93')]()+']',JSON['stringify'](_0x2cdd7d));});}; \ No newline at end of file +var _0xd887=['calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[OUTBOUND]','zoho.eu','com','email','destcalleridname','destcalleridnum','Outbound','unmanaged','monitor_format','toUpperCase','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','lodash','request-promise','util','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','type','idField','content','toString','variableName','Variable','name','toLowerCase','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','findIndex','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','enduserType','Who_Id','Full_Name','What_Id','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','err','queue','host','stripTrailingSlash','serverUrl','recordingURL','/api/voice/recordings/','uniqueid','The\x20User\x20ID\x20is:'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd887,0x141));var _0x7d88=function(_0x2a8841,_0x355633){_0x2a8841=_0x2a8841-0x0;var _0x164f64=_0xd887[_0x2a8841];return _0x164f64;};'use strict';var _=require(_0x7d88('0x0'));var rp=require(_0x7d88('0x1'));var md5=require('md5');var util=require(_0x7d88('0x2'));var intUtil=require(_0x7d88('0x3'));var moment=require('moment');var Redis=require(_0x7d88('0x4'));var BPromise=require('bluebird');var config=require(_0x7d88('0x5'));var logger=require(_0x7d88('0x6'))(_0x7d88('0x7'));config[_0x7d88('0x8')]=_['defaults'](config[_0x7d88('0x8')],{'host':_0x7d88('0x9'),'port':0x18eb});var io=require(_0x7d88('0xa'))(new Redis(config[_0x7d88('0x8')]));function emit(_0x5ecdaf,_0x94af08,_0x2750a7){io['to'](_0x5ecdaf)[_0x7d88('0xb')](_0x94af08,_0x2750a7);}function request(_0x541367){logger['debug'](_0x7d88('0xc'),JSON[_0x7d88('0xd')](_0x541367));return rp(_0x541367);}function getCustomFields(_0x40d852,_0x650e0a){var _0x2c7679={};if(_0x40d852[_0x7d88('0xe')]>0x0){_[_0x7d88('0xf')](_0x40d852,function(_0x36004b){if(_[_0x7d88('0x10')](['string','picklist'],_0x36004b[_0x7d88('0x11')])&&_0x36004b['idField']){_0x2c7679[_0x36004b[_0x7d88('0x12')]]=_0x36004b[_0x7d88('0x13')][_0x7d88('0x14')]();}else if(_0x36004b[_0x7d88('0x11')]==='variable'&&_0x36004b['variableName']&&_0x36004b[_0x7d88('0x12')]&&_0x650e0a[_0x36004b[_0x7d88('0x15')]]){_0x2c7679[_0x36004b[_0x7d88('0x12')]]=_0x650e0a[_0x36004b['variableName']][_0x7d88('0x14')]();}else if(_0x36004b['type']==='customVariable'&&_0x36004b['Variable']&&_0x36004b[_0x7d88('0x16')]['name']&&_0x36004b[_0x7d88('0x12')]&&_0x650e0a[_0x36004b[_0x7d88('0x16')][_0x7d88('0x17')][_0x7d88('0x18')]()]){_0x2c7679[_0x36004b[_0x7d88('0x12')]]=_0x650e0a[_0x36004b['Variable']['name'][_0x7d88('0x18')]()][_0x7d88('0x14')]();}});}return _0x2c7679;}function getName(_0x1bb4e0){if(_0x1bb4e0['indexOf']('\x20')>0x0){var _0x343f9b=_0x1bb4e0['split'](/ (.+)/);if(_0x343f9b[0x1]){return _0x343f9b;}}return[_0x1bb4e0,_0x1bb4e0];}var accountsTokens={};function getAccessToken(_0x3ba2f3){return new Promise(function(_0x5ad545,_0x5861e2){if(!_['isNil'](accountsTokens[_0x3ba2f3['id']])&&!_[_0x7d88('0x19')](accountsTokens[_0x3ba2f3['id']][_0x7d88('0x1a')])){if(moment()['isBefore'](accountsTokens[_0x3ba2f3['id']][_0x7d88('0x1b')])){_0x5ad545(accountsTokens[_0x3ba2f3['id']][_0x7d88('0x1a')]);}}var _0x4b000c;switch(_0x3ba2f3[_0x7d88('0x1c')]){case'US':_0x4b000c=_0x7d88('0x1d');break;case'AU':_0x4b000c=_0x7d88('0x1e');break;case'EU':_0x4b000c=_0x7d88('0x1f');break;case'IN':_0x4b000c='https://accounts.zoho.in';break;case'CN':_0x4b000c=_0x7d88('0x20');break;default:_0x4b000c='https://accounts.zoho.eu';break;}var _0x20bd0e={'method':'POST','uri':_0x4b000c+_0x7d88('0x21'),'qs':{'refresh_token':_0x3ba2f3[_0x7d88('0x22')],'client_id':_0x3ba2f3[_0x7d88('0x23')],'client_secret':_0x3ba2f3[_0x7d88('0x24')],'grant_type':_0x7d88('0x25')},'json':!![]};return rp(_0x20bd0e)['then'](function(_0x514dbf){accountsTokens[_0x3ba2f3['id']]={'access_token':_0x514dbf[_0x7d88('0x1a')],'expires_in':moment()[_0x7d88('0x26')](_0x514dbf[_0x7d88('0x1b')],'seconds')};_0x5ad545(_0x514dbf[_0x7d88('0x1a')]);})[_0x7d88('0x27')](function(_0x5dfb48){logger[_0x7d88('0x28')](_0x7d88('0x29'),_0x5dfb48[_0x7d88('0x2a')]);_0x5861e2(_0x5dfb48);});});}function getUser(_0x2da6f2,_0x1e9ae2,_0x4aaf08,_0x5d28be){logger[_0x7d88('0x2b')]('Search\x20user');return request({'method':_0x7d88('0x2c'),'uri':util[_0x7d88('0x2d')](_0x7d88('0x2e'),_0x1e9ae2),'qs':{'type':_0x7d88('0x2f')},'headers':{'Authorization':_0x7d88('0x30')+_0x2da6f2},'json':!![]})[_0x7d88('0x31')](function(_0x4d8c00){if(_0x4d8c00[_0x7d88('0x32')]){var _0xd8e9b1=-0x1;if(_['isArrayLikeObject'](_0x4d8c00[_0x7d88('0x32')])){if(!_[_0x7d88('0x19')](_0x5d28be)){_0xd8e9b1=_[_0x7d88('0x33')](_0x4d8c00['users'],function(_0x181ebe){return _0x181ebe['email']===_0x5d28be;});}if(_0xd8e9b1>=0x0){logger[_0x7d88('0x2b')]('Agent\x20found!');}else{logger['info'](_0x7d88('0x34'));_0xd8e9b1=_[_0x7d88('0x33')](_0x4d8c00['users'],function(_0x43640e){return _0x43640e[_0x7d88('0x35')][_0x7d88('0x17')]===_0x7d88('0x36');});}return _0x4d8c00['users'][_0xd8e9b1];}else{if(_0x4d8c00[_0x7d88('0x37')]['profile'][_0x7d88('0x17')]===_0x7d88('0x36')){logger[_0x7d88('0x2b')](_0x7d88('0x34'));user=_0x4d8c00['user'];return user;}else{logger['error'](_0x7d88('0x38'),JSON[_0x7d88('0xd')](_0x4d8c00));throw new Error(_0x7d88('0x39')+JSON['stringify'](_0x4d8c00));}}}else{logger[_0x7d88('0x28')]('The\x20failing\x20result\x20is',JSON[_0x7d88('0xd')](_0x4d8c00));throw new Error(_0x7d88('0x39')+JSON[_0x7d88('0xd')](_0x4d8c00));}})[_0x7d88('0x27')](function(_0x362b61){console['error'](_0x362b61);});}function getZohoUser(_0x580712,_0x12c140){return new BPromise(function(_0xec0ae4,_0x34fd62){request(_0x580712)[_0x7d88('0x31')](function(_0x390efa){var _0x130997=null;if(_0x390efa){_0x130997=_0x390efa[_0x7d88('0x3a')][0x0];_0x130997['enduserType']=_0x12c140;}_0xec0ae4(_0x130997);})[_0x7d88('0x27')](function(_0x11ccda){_0x34fd62(_0x11ccda);});});}function createEndUser(_0x1c1c16,_0x46f206,_0x20bad1,_0x4ce5f7,_0x2d42d2,_0x548f24){var _0x20bad1=getName(_0x20bad1);return request({'method':_0x7d88('0x3b'),'uri':_0x7d88('0x3c')+_0x46f206+'/crm/v2/'+_[_0x7d88('0x3d')](_0x548f24[_0x7d88('0x3e')])+'s','body':{'data':[{'Last_Name':_0x20bad1[0x1],'First_Name':_0x20bad1[0x0],'Phone':_0x4ce5f7,'Owner':{'name':!_[_0x7d88('0x19')](_0x2d42d2[_0x7d88('0x3f')][_0x7d88('0x17')])?_0x2d42d2['role']['name']:!_['isNil'](_0x2d42d2[_0x7d88('0x40')])?_0x2d42d2[_0x7d88('0x40')]+'\x20'+_0x2d42d2[_0x7d88('0x41')]:_0x2d42d2[_0x7d88('0x41')],'id':_0x2d42d2['id']}}]},'headers':{'Authorization':_0x7d88('0x30')+_0x1c1c16},'json':!![]})['then'](function(_0x3cc08f){if(_0x3cc08f&&_0x3cc08f[_0x7d88('0x3a')][0x0]['code']===_0x7d88('0x42')){var _0x4b542d=_0x3cc08f[_0x7d88('0x3a')][0x0][_0x7d88('0x43')];_0x4b542d['enduserType']=_[_0x7d88('0x3d')](_0x548f24[_0x7d88('0x3e')])+'s';return _0x4b542d;}logger[_0x7d88('0x28')](_0x7d88('0x38'),JSON[_0x7d88('0xd')](data));throw new Error(_0x7d88('0x44')+JSON[_0x7d88('0xd')](data));})[_0x7d88('0x27')](function(_0x1c0617){console['log'](_0x7d88('0x45'),_0x1c0617);});}function getEndUser(_0x53759c,_0x3ef918,_0x5bb04c,_0x553fba,_0x117555,_0x3ed26f,_0x280240){var _0x47367c={'method':_0x7d88('0x2c'),'uri':'','headers':{'Authorization':_0x7d88('0x30')+_0x53759c},'json':!![]};switch(_0x280240[_0x7d88('0x46')]){case'contact_lead':_0x47367c[_0x7d88('0x47')]=_0x7d88('0x3c')+_0x3ef918+_0x7d88('0x48')+_0x117555+'))';return getZohoUser(_0x47367c,'Contacts')[_0x7d88('0x31')](function(_0x14999d){if(_0x14999d)return _0x14999d;_0x47367c[_0x7d88('0x47')]=_0x7d88('0x3c')+_0x3ef918+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x117555+'))';return getZohoUser(_0x47367c,_0x7d88('0x49'))[_0x7d88('0x31')](function(_0x5d6ef7){if(_0x5d6ef7)return _0x5d6ef7;if(_0x280240[_0x7d88('0x3e')]!=_0x7d88('0x4a')){return createEndUser(_0x53759c,_0x3ef918,_0x553fba,_0x117555,_0x3ed26f,_0x280240);}else{return{};}});});break;case _0x7d88('0x4b'):_0x47367c['uri']=_0x7d88('0x3c')+_0x3ef918+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x117555+'))';return getZohoUser(_0x47367c,_0x7d88('0x4c'))[_0x7d88('0x31')](function(_0x3ff0f7){if(_0x3ff0f7)return _0x3ff0f7;if(_0x280240[_0x7d88('0x3e')]!=_0x7d88('0x4a')){return createEndUser(_0x53759c,_0x3ef918,_0x553fba,_0x117555,_0x3ed26f,_0x280240);}else{return{};}});break;case'lead':_0x47367c['uri']=_0x7d88('0x3c')+_0x3ef918+_0x7d88('0x4d')+_0x117555+'))';return getZohoUser(_0x47367c,_0x7d88('0x49'))['then'](function(_0x252fd2){if(_0x252fd2)return _0x252fd2;if(_0x280240['moduleCreate']!=_0x7d88('0x4a')){return createEndUser(_0x53759c,_0x3ef918,_0x553fba,_0x117555,_0x3ed26f,_0x280240);}else{return{};}});break;}}function getCall(_0x45cae4,_0x4cb645,_0x1b6666,_0x4042cd,_0x1b9978,_0x237c24,_0x1b8aea,_0x113d14){logger[_0x7d88('0x2b')](_0x7d88('0x4e'));var _0x52f74b={};_0x52f74b[_0x7d88('0x4f')]={'name':!_[_0x7d88('0x19')](_0x4042cd['role'][_0x7d88('0x17')])&&!_['isNil'](_0x4042cd['profile'][_0x7d88('0x17')])&&_0x4042cd[_0x7d88('0x35')]['name']===_0x7d88('0x50')?_0x4042cd[_0x7d88('0x3f')][_0x7d88('0x17')]:!_[_0x7d88('0x19')](_0x4042cd[_0x7d88('0x40')])?_0x4042cd[_0x7d88('0x40')]+'\x20'+_0x4042cd[_0x7d88('0x41')]:_0x4042cd[_0x7d88('0x41')],'id':_0x4042cd['id']};_0x52f74b[_0x7d88('0x51')]=intUtil[_0x7d88('0x52')](_0x237c24[_0x7d88('0x53')],_0x1b8aea,'\x20');_0x52f74b['Description']=intUtil[_0x7d88('0x52')](_0x237c24[_0x7d88('0x54')],_0x1b8aea,'\x0a');if(_0x1b9978[_0x7d88('0x55')]===_0x7d88('0x4c')){_0x52f74b[_0x7d88('0x56')]={'name':!_[_0x7d88('0x19')](_0x1b9978['Full_Name'])?_0x1b9978[_0x7d88('0x57')]:!_[_0x7d88('0x19')](_0x1b9978['First_Name'])?_0x1b9978['First_Name']+'\x20'+_0x1b9978['Last_Name']:_0x1b9978['Last_Name'],'id':_0x1b9978['id']};}if(_0x1b9978[_0x7d88('0x55')]===_0x7d88('0x49')){_0x52f74b[_0x7d88('0x58')]={'name':!_[_0x7d88('0x19')](_0x1b9978[_0x7d88('0x57')])?_0x1b9978[_0x7d88('0x57')]:!_['isNil'](_0x1b9978[_0x7d88('0x59')])?_0x1b9978[_0x7d88('0x59')]+'\x20'+_0x1b9978[_0x7d88('0x5a')]:_0x1b9978[_0x7d88('0x5a')],'id':_0x1b9978['id']};_0x52f74b[_0x7d88('0x5b')]=_[_0x7d88('0x3d')](_0x1b9978[_0x7d88('0x55')]);}if(_0x1b8aea[_0x7d88('0x5c')]){_0x52f74b[_0x7d88('0x5d')]=moment[_0x7d88('0x5e')](parseInt(_0x1b8aea[_0x7d88('0x5c')])*0x3e8)[_0x7d88('0x2d')](_0x7d88('0x5f'));}else if(_0x1b8aea[_0x7d88('0x60')]&&_0x1b8aea[_0x7d88('0x61')]){_0x52f74b[_0x7d88('0x5d')]=moment[_0x7d88('0x5e')](moment(_0x1b8aea[_0x7d88('0x61')],_0x7d88('0x62'))[_0x7d88('0x63')](moment(_0x1b8aea['starttime'],_0x7d88('0x62'))))[_0x7d88('0x2d')](_0x7d88('0x5f'));}switch(_0x1b8aea[_0x7d88('0x64')]){case'called':_0x52f74b[_0x7d88('0x65')]=_0x7d88('0x66');break;case _0x7d88('0x67'):case _0x7d88('0x68'):_0x52f74b[_0x7d88('0x65')]=_0x7d88('0x69');break;case _0x7d88('0x6a'):_0x52f74b['Call_Result']=_0x7d88('0x6b');break;case _0x7d88('0x6c'):_0x52f74b['Call_Result']=_0x7d88('0x6d');break;case'timeout':_0x52f74b['Call_Result']='Timeout';default:}_0x52f74b[_0x7d88('0x6e')]=(_0x113d14===_0x7d88('0x6f')?moment(_0x1b8aea[_0x7d88('0x70')])[_0x7d88('0x2d')](_0x7d88('0x62')):moment(_0x1b8aea[_0x7d88('0x71')])[_0x7d88('0x2d')](_0x7d88('0x62')))||moment()[_0x7d88('0x2d')](_0x7d88('0x62'));_0x52f74b[_0x7d88('0x72')]=_0x113d14||_0x7d88('0x73');_0x52f74b=_[_0x7d88('0x74')](_0x52f74b,getCustomFields(_0x237c24[_0x7d88('0x75')],_0x1b8aea));return request({'method':'POST','uri':_0x7d88('0x3c')+_0x4cb645+_0x7d88('0x76'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x45cae4},'body':{'data':[_0x52f74b]},'json':!![]})[_0x7d88('0x31')](function(_0x5d3f53){if(_0x5d3f53&&_0x5d3f53[_0x7d88('0x3a')][0x0][_0x7d88('0x77')]===_0x7d88('0x42')){logger[_0x7d88('0x2b')]('Call\x20created!');return{'id':_0x5d3f53['data'][0x0][_0x7d88('0x43')]['id']};}})[_0x7d88('0x27')](function(_0x470b85){logger['info'](_0x7d88('0x78'),_0x470b85[_0x7d88('0x2a')]);console['log'](_0x7d88('0x78'),_0x470b85);});}exports[_0x7d88('0x79')]=function(_0x1609ad,_0x40bd61,_0x208ff1,_0x279dec,_0x3dbdb9,_0x57e819){var _0x3ce53b,_0x2408ca,_0x40e229;_0x57e819[_0x7d88('0x7a')]=intUtil[_0x7d88('0x7b')](_0x57e819[_0x7d88('0x7a')]);_0x57e819['serverUrl']=intUtil['stripTrailingSlash'](_0x57e819[_0x7d88('0x7c')]);if(_0x3dbdb9&&_0x3dbdb9['monitor_format']){logger[_0x7d88('0x2b')]('[QUEUE]','Recording\x20is\x20enabled!');_0x40bd61[_0x7d88('0x7d')]=_0x57e819[_0x7d88('0x7c')]+_0x7d88('0x7e')+_0x40bd61['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x40bd61[_0x7d88('0x7f')]);}else{_0x40bd61['recordingURL']='';}var _0x4a5b6d=_0x57e819['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x57e819)[_0x7d88('0x31')](function(_0x1610c8){_0x40e229=_0x1610c8;return getUser(_0x40e229,_0x4a5b6d,_0x57e819,_0x279dec['email']);})[_0x7d88('0x31')](function(_0x206da7){_0x3ce53b=_0x206da7;logger[_0x7d88('0x2b')](_0x7d88('0x80'),_0x3ce53b['id']);return getEndUser(_0x40e229,_0x4a5b6d,_0x57e819,_0x40bd61[_0x7d88('0x81')],_0x40bd61[_0x7d88('0x82')],_0x3ce53b,_0x208ff1);})[_0x7d88('0x31')](function(_0x4fa07d){_0x2408ca=_0x4fa07d;return getCall(_0x40e229,_0x4a5b6d,_0x57e819,_0x3ce53b,_0x2408ca,_0x208ff1,_0x40bd61,_0x7d88('0x73'));})[_0x7d88('0x31')](function(_0x3eca18){if(_0x3eca18){logger[_0x7d88('0x2b')](_0x7d88('0x83'),_0x3eca18['id']);logger[_0x7d88('0x2b')](_0x7d88('0x84'),_0x7d88('0x85'));emit(util[_0x7d88('0x2d')](_0x7d88('0x86'),_0x279dec[_0x7d88('0x17')]),_0x7d88('0x87'),{'uri':_0x7d88('0x88')+_0x57e819[_0x7d88('0x7a')]+_0x7d88('0x89')+_0x3eca18['id']});}})[_0x7d88('0x27')](function(_0x2e95d3){logger['error']('[QUEUE]',JSON[_0x7d88('0xd')](_0x2e95d3));});};exports['outbound']=function(_0x336f9d,_0x742e5b,_0x139ad3,_0x37df66,_0x5e00ce,_0x483ba3,_0x3c3b38){var _0x4037c2,_0x27b782,_0x3e5034;_0x483ba3[_0x7d88('0x7a')]=intUtil[_0x7d88('0x7b')](_0x483ba3[_0x7d88('0x7a')]);_0x483ba3[_0x7d88('0x7c')]=intUtil[_0x7d88('0x7b')](_0x483ba3[_0x7d88('0x7c')]);if(_0x3c3b38&&_0x3c3b38['recordingFormat']&&_0x3c3b38['recordingFormat']!=='none'){logger[_0x7d88('0x2b')](_0x7d88('0x8a'),'Recording\x20is\x20enabled!');_0x742e5b[_0x7d88('0x7d')]=_0x483ba3[_0x7d88('0x7c')]+_0x7d88('0x7e')+_0x742e5b[_0x7d88('0x7f')]+'/downloads?type=uniqueid&token='+md5(_0x742e5b['uniqueid']);}var _0x19440f=_0x483ba3[_0x7d88('0x7a')]===_0x7d88('0x8b')?'eu':_0x7d88('0x8c');return getAccessToken(_0x483ba3)[_0x7d88('0x31')](function(_0x48561c){_0x3e5034=_0x48561c;return getUser(_0x3e5034,_0x19440f,_0x483ba3,_0x37df66[_0x7d88('0x8d')]);})['then'](function(_0x12c71a){_0x4037c2=_0x12c71a;logger[_0x7d88('0x2b')]('The\x20User\x20ID\x20is:',_0x4037c2['id']);return getEndUser(_0x3e5034,_0x19440f,_0x483ba3,_0x742e5b[_0x7d88('0x8e')],_0x742e5b[_0x7d88('0x8f')],_0x4037c2,_0x139ad3);})['then'](function(_0x1ae48c){_0x27b782=_0x1ae48c;return getCall(_0x3e5034,_0x19440f,_0x483ba3,_0x4037c2,_0x27b782,_0x139ad3,_0x742e5b,_0x7d88('0x90'));})[_0x7d88('0x31')](function(_0x5f2a2b){if(_0x5f2a2b){logger['info']('The\x20Call\x20ID\x20is:',_0x5f2a2b['id']);logger['info'](_0x7d88('0x8a'),_0x7d88('0x85'));emit(util[_0x7d88('0x2d')](_0x7d88('0x86'),_0x37df66[_0x7d88('0x17')]),_0x7d88('0x87'),{'uri':_0x7d88('0x88')+_0x483ba3['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x5f2a2b['id']});}})[_0x7d88('0x27')](function(_0x2aa0f0){logger[_0x7d88('0x28')](_0x7d88('0x8a'),JSON['stringify'](_0x2aa0f0));});};exports[_0x7d88('0x91')]=function(_0xb1f105,_0x3e8ed5,_0x4504ed,_0x22e90e,_0x563afc,_0x346ed3){var _0xc99b65,_0x352043,_0x15ceb3;_0x346ed3[_0x7d88('0x7a')]=intUtil[_0x7d88('0x7b')](_0x346ed3[_0x7d88('0x7a')]);_0x346ed3['serverUrl']=intUtil[_0x7d88('0x7b')](_0x346ed3[_0x7d88('0x7c')]);if(_0x563afc&&_0x563afc[_0x7d88('0x92')]){logger['info']('['+_0x3e8ed5['lastevent'][_0x7d88('0x93')]()+']',_0x7d88('0x94'));_0x3e8ed5[_0x7d88('0x7d')]=_0x346ed3[_0x7d88('0x7c')]+_0x7d88('0x7e')+_0x3e8ed5[_0x7d88('0x7f')]+_0x7d88('0x95')+md5(_0x3e8ed5[_0x7d88('0x7f')]);}else{_0x3e8ed5[_0x7d88('0x7d')]='';}var _0x7b0982=_0x346ed3[_0x7d88('0x7a')]===_0x7d88('0x8b')?'eu':_0x7d88('0x8c');return getAccessToken(_0x346ed3)[_0x7d88('0x31')](function(_0x10072f){_0x15ceb3=_0x10072f;return getUser(_0x15ceb3,_0x7b0982,_0x346ed3);})[_0x7d88('0x31')](function(_0x2cd26a){_0xc99b65=_0x2cd26a;logger[_0x7d88('0x2b')](_0x7d88('0x80'),_0xc99b65['id']);return getEndUser(_0x15ceb3,_0x7b0982,_0x346ed3,_0x3e8ed5[_0x7d88('0x81')],_0x3e8ed5[_0x7d88('0x82')],_0xc99b65,_0x4504ed);})[_0x7d88('0x31')](function(_0x5ef619){_0x352043=_0x5ef619;return getCall(_0x15ceb3,_0x7b0982,_0x346ed3,_0xc99b65,_0x352043,_0x4504ed,_0x3e8ed5,_0x7d88('0x73'));})['then'](function(_0x355a13){if(_0x355a13){logger[_0x7d88('0x2b')](_0x7d88('0x83'),_0x355a13['id']);}})[_0x7d88('0x27')](function(_0x9b7a6a){logger['error']('['+_0x3e8ed5[_0x7d88('0x64')][_0x7d88('0x93')]()+']',JSON[_0x7d88('0xd')](_0x9b7a6a));});}; \ 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 645a53a..d85c746 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 _0xeaca=['data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','Script'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0xeaca,0x10a));var _0xaeac=function(_0x3c59d3,_0x5198b4){_0x3c59d3=_0x3c59d3-0x0;var _0x556dab=_0xeaca[_0x3c59d3];return _0x556dab;};'use strict';var util=require(_0xaeac('0x0'));var sh=require(_0xaeac('0x1'));var Mustache=require(_0xaeac('0x2'));var logger=require(_0xaeac('0x3'))('trigger');exports[_0xaeac('0x4')]=function(_0x4bad64,_0x421c35){var _0xba78f5=_0x4bad64[_0xaeac('0x5')]?_0x4bad64[_0xaeac('0x5')]:_0xaeac('0x6');var _0x4c89bc=_0x4bad64[_0xaeac('0x7')]?Mustache[_0xaeac('0x8')](_0x4bad64[_0xaeac('0x7')],_0x421c35):_0x421c35;sh[_0xaeac('0x4')](_0x4c89bc,function(_0x3177f7,_0x3ef5ec,_0x49ffda){if(_0x3177f7!==0x0){logger[_0xaeac('0x9')](util[_0xaeac('0xa')](_0xaeac('0xb'),_0xba78f5,_0x4c89bc,_0x3177f7,_0x49ffda));}else{logger['info'](util[_0xaeac('0xa')](_0xaeac('0xc'),_0xba78f5,_0x4c89bc,_0x3ef5ec));}});}; \ No newline at end of file +var _0x6013=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3','render','error'];(function(_0x42ffc0,_0x314cfb){var _0x48df54=function(_0x33fc8f){while(--_0x33fc8f){_0x42ffc0['push'](_0x42ffc0['shift']());}};_0x48df54(++_0x314cfb);}(_0x6013,0x18a));var _0x3601=function(_0x23f3fe,_0x37a19c){_0x23f3fe=_0x23f3fe-0x0;var _0x1b1cb1=_0x6013[_0x23f3fe];return _0x1b1cb1;};'use strict';var util=require('util');var sh=require(_0x3601('0x0'));var Mustache=require(_0x3601('0x1'));var logger=require(_0x3601('0x2'))(_0x3601('0x3'));exports[_0x3601('0x4')]=function(_0x1f6c6c,_0x4b6569){var _0x1adcbb=_0x1f6c6c[_0x3601('0x5')]?_0x1f6c6c['data2']:'Script';var _0x541709=_0x1f6c6c[_0x3601('0x6')]?Mustache[_0x3601('0x7')](_0x1f6c6c['data3'],_0x4b6569):_0x4b6569;sh[_0x3601('0x4')](_0x541709,function(_0x576cf3,_0x46e358,_0x46a8b5){if(_0x576cf3!==0x0){logger[_0x3601('0x8')](util['format'](_0x3601('0x9'),_0x1adcbb,_0x541709,_0x576cf3,_0x46a8b5));}else{logger[_0x3601('0xa')](util[_0x3601('0xb')](_0x3601('0xc'),_0x1adcbb,_0x541709,_0x46e358));}});}; \ 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 1f0c621..2c143f7 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 _0x9158=[',\x20request\x20body:\x20','object','stringify','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','request-promise','lodash','../../../../config/logger','trigger','data1','toUpperCase','render','data2','number','data5','data6','parse','error','stack','DELETE','POST','PUT','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil'];(function(_0x350079,_0x510691){var _0x220852=function(_0x4e7d34){while(--_0x4e7d34){_0x350079['push'](_0x350079['shift']());}};_0x220852(++_0x510691);}(_0x9158,0x139));var _0x8915=function(_0xec6064,_0x11a6fb){_0xec6064=_0xec6064-0x0;var _0x57634e=_0x9158[_0xec6064];return _0x57634e;};'use strict';var rp=require(_0x8915('0x0'));var util=require('util');var _=require(_0x8915('0x1'));var Mustache=require('mustache');var logger=require(_0x8915('0x2'))(_0x8915('0x3'));exports['exec']=function(_0x433700,_0x5aaabf){var _0x360ce2,_0x384533;var _0x2eb2f0={'method':_0x433700[_0x8915('0x4')][_0x8915('0x5')](),'uri':Mustache[_0x8915('0x6')](_0x433700[_0x8915('0x7')],_0x5aaabf),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x433700['data5'])===_0x8915('0x8')&&parseInt(_0x433700[_0x8915('0x9')])>=0x1&&parseInt(_0x433700['data5'])<=0xa?parseInt(_0x433700[_0x8915('0x9')])*0x3e8:0x5*0x3e8};try{_0x2eb2f0['headers']=_0x433700[_0x8915('0xa')]?JSON[_0x8915('0xb')](Mustache['render'](_0x433700[_0x8915('0xa')],_0x5aaabf)):{};}catch(_0x34ba9e){logger[_0x8915('0xc')](_0x34ba9e[_0x8915('0xd')]);}switch(_0x433700['data1'][_0x8915('0x5')]()){case'GET':case _0x8915('0xe'):_0x360ce2=null;_0x2eb2f0['qs']=_0x5aaabf;break;case _0x8915('0xf'):case _0x8915('0x10'):if(_0x433700['data7']){try{_0x360ce2=JSON[_0x8915('0xb')](Mustache[_0x8915('0x6')](_0x433700[_0x8915('0x11')],_0x5aaabf));_0x2eb2f0[_0x8915('0x12')]=_0x360ce2;}catch(_0xab4b00){logger[_0x8915('0xc')](_0xab4b00[_0x8915('0xd')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x360ce2=_0x5aaabf;_0x2eb2f0[_0x8915('0x12')]=_0x360ce2;}break;}logger[_0x8915('0x13')](util['format'](_0x8915('0x14'),_0x433700['data1'],_0x433700[_0x8915('0x7')],JSON['stringify'](_0x2eb2f0)));rp(_0x2eb2f0)[_0x8915('0x15')](function(_0x37848b){_0x360ce2=!_[_0x8915('0x16')](_0x360ce2)?_0x8915('0x17')+_0x360ce2:'';_0x384533=typeof _0x37848b[_0x8915('0x12')]===_0x8915('0x18')?JSON[_0x8915('0x19')](_0x37848b[_0x8915('0x12')]):_0x37848b[_0x8915('0x12')];logger[_0x8915('0x13')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x433700['data1'],_0x433700['data2'],_0x37848b[_0x8915('0x1a')],_0x384533));})['catch'](function(_0x3b9f69){logger[_0x8915('0xc')](util['format'](_0x8915('0x1b'),_0x433700['data1'],_0x433700[_0x8915('0x7')],_0x3b9f69[_0x8915('0x1a')],_0x3b9f69['name'],_0x3b9f69['message']));});}; \ No newline at end of file +var _0x7d91=['POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','stringify','isNil','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','lodash','mustache','../../../../config/logger','trigger','exec','data2','number','data5','data6','parse','render','error','stack','toUpperCase','GET','DELETE'];(function(_0x4754b9,_0x1fa27e){var _0x13707b=function(_0x262399){while(--_0x262399){_0x4754b9['push'](_0x4754b9['shift']());}};_0x13707b(++_0x1fa27e);}(_0x7d91,0xc2));var _0x17d9=function(_0x1782ea,_0x270194){_0x1782ea=_0x1782ea-0x0;var _0x472577=_0x7d91[_0x1782ea];return _0x472577;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x17d9('0x0'));var Mustache=require(_0x17d9('0x1'));var logger=require(_0x17d9('0x2'))(_0x17d9('0x3'));exports[_0x17d9('0x4')]=function(_0xecde1c,_0x3649e4){var _0x5ea050,_0x14289d;var _0x5f281a={'method':_0xecde1c['data1']['toUpperCase'](),'uri':Mustache['render'](_0xecde1c[_0x17d9('0x5')],_0x3649e4),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xecde1c['data5'])===_0x17d9('0x6')&&parseInt(_0xecde1c[_0x17d9('0x7')])>=0x1&&parseInt(_0xecde1c[_0x17d9('0x7')])<=0xa?parseInt(_0xecde1c[_0x17d9('0x7')])*0x3e8:0x5*0x3e8};try{_0x5f281a['headers']=_0xecde1c[_0x17d9('0x8')]?JSON[_0x17d9('0x9')](Mustache[_0x17d9('0xa')](_0xecde1c['data6'],_0x3649e4)):{};}catch(_0x1d2a59){logger[_0x17d9('0xb')](_0x1d2a59[_0x17d9('0xc')]);}switch(_0xecde1c['data1'][_0x17d9('0xd')]()){case _0x17d9('0xe'):case _0x17d9('0xf'):_0x5ea050=null;_0x5f281a['qs']=_0x3649e4;break;case _0x17d9('0x10'):case'PUT':if(_0xecde1c['data7']){try{_0x5ea050=JSON[_0x17d9('0x9')](Mustache[_0x17d9('0xa')](_0xecde1c[_0x17d9('0x11')],_0x3649e4));_0x5f281a[_0x17d9('0x12')]=_0x5ea050;}catch(_0x478cd6){logger[_0x17d9('0xb')](_0x478cd6[_0x17d9('0xc')]);logger[_0x17d9('0xb')](_0x17d9('0x13'));}}else{_0x5ea050=_0x3649e4;_0x5f281a[_0x17d9('0x12')]=_0x5ea050;}break;}logger['info'](util[_0x17d9('0x14')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0xecde1c['data1'],_0xecde1c[_0x17d9('0x5')],JSON[_0x17d9('0x15')](_0x5f281a)));rp(_0x5f281a)['then'](function(_0x5652f2){_0x5ea050=!_[_0x17d9('0x16')](_0x5ea050)?',\x20request\x20body:\x20'+_0x5ea050:'';_0x14289d=typeof _0x5652f2[_0x17d9('0x12')]===_0x17d9('0x17')?JSON[_0x17d9('0x15')](_0x5652f2[_0x17d9('0x12')]):_0x5652f2[_0x17d9('0x12')];logger[_0x17d9('0x18')](util[_0x17d9('0x14')](_0x17d9('0x19'),_0xecde1c['data1'],_0xecde1c[_0x17d9('0x5')],_0x5652f2['statusCode'],_0x14289d));})['catch'](function(_0x55a38e){logger[_0x17d9('0xb')](util['format'](_0x17d9('0x1a'),_0xecde1c['data1'],_0xecde1c[_0x17d9('0x5')],_0x55a38e[_0x17d9('0x1b')],_0x55a38e[_0x17d9('0x1c')],_0x55a38e[_0x17d9('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index e146c62..bc4d688 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 _0x43e5=['http','request','debug','routing','error','rpc','message','result','catch','exports','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43e5,0x18b));var _0x543e=function(_0x59c725,_0x244fea){_0x59c725=_0x59c725-0x0;var _0x44297b=_0x43e5[_0x59c725];return _0x44297b;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0x543e('0x0')][_0x543e('0x1')]({'port':0x2329});client['Request']=function(_0x5780cb,_0x4afaee){return new BPromise(function(_0x16b900,_0x17ed98){return client[_0x543e('0x2')](_0x5780cb,_0x4afaee)['then'](function(_0x111940){logger[_0x543e('0x3')]('rpc',_0x543e('0x4'),_0x5780cb,_0x4afaee,_0x111940);if(_0x111940[_0x543e('0x5')]){logger[_0x543e('0x5')](_0x543e('0x6'),_0x543e('0x4'),_0x5780cb,_0x111940[_0x543e('0x5')][_0x543e('0x7')],_0x4afaee);return _0x17ed98(_0x111940[_0x543e('0x5')][_0x543e('0x7')]);}else{return _0x16b900(_0x111940[_0x543e('0x8')]);}})[_0x543e('0x9')](function(_0x444028){logger[_0x543e('0x5')](_0x543e('0x6'),_0x543e('0x4'),_0x5780cb,_0x444028,_0x4afaee);return _0x17ed98(_0x444028);});});};module[_0x543e('0xa')]=client; \ No newline at end of file +var _0x4f83=['error','rpc','message','result','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','then','debug'];(function(_0x46c6de,_0xac15c2){var _0x4af97b=function(_0x48cbbe){while(--_0x48cbbe){_0x46c6de['push'](_0x46c6de['shift']());}};_0x4af97b(++_0xac15c2);}(_0x4f83,0x1aa));var _0x34f8=function(_0x1eddf7,_0x171c39){_0x1eddf7=_0x1eddf7-0x0;var _0x230a0f=_0x4f83[_0x1eddf7];return _0x230a0f;};'use strict';var jayson=require(_0x34f8('0x0'));var BPromise=require('bluebird');var logger=require(_0x34f8('0x1'))(_0x34f8('0x2'));var client=jayson[_0x34f8('0x3')][_0x34f8('0x4')]({'port':0x2329});client[_0x34f8('0x5')]=function(_0x11ec83,_0x281f01){return new BPromise(function(_0x127027,_0x33e6c1){return client['request'](_0x11ec83,_0x281f01)[_0x34f8('0x6')](function(_0x297a52){logger[_0x34f8('0x7')]('rpc',_0x34f8('0x2'),_0x11ec83,_0x281f01,_0x297a52);if(_0x297a52[_0x34f8('0x8')]){logger['error'](_0x34f8('0x9'),_0x34f8('0x2'),_0x11ec83,_0x297a52[_0x34f8('0x8')][_0x34f8('0xa')],_0x281f01);return _0x33e6c1(_0x297a52['error'][_0x34f8('0xa')]);}else{return _0x127027(_0x297a52[_0x34f8('0xb')]);}})[_0x34f8('0xc')](function(_0x309cc6){logger[_0x34f8('0x8')](_0x34f8('0x9'),_0x34f8('0x2'),_0x11ec83,_0x309cc6,_0x281f01);return _0x33e6c1(_0x309cc6);});});};module[_0x34f8('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 0c9bbc7..53878bc 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 _0xd60b=['../../config/logger','email','resolve','getMailAccounts','initMailAccounts','then','refresh','mailAccounts','listen','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting'];(function(_0x217c62,_0x515d22){var _0x2809c0=function(_0x3c2ffc){while(--_0x3c2ffc){_0x217c62['push'](_0x217c62['shift']());}};_0x2809c0(++_0x515d22);}(_0xd60b,0xb6));var _0xbd60=function(_0x4989bd,_0x274d7b){_0x4989bd=_0x4989bd-0x0;var _0x3d70f3=_0xd60b[_0x4989bd];return _0x3d70f3;};'use strict';var server=require(_0xbd60('0x0'));var Realtime=require(_0xbd60('0x1'));var EmailChannel=require(_0xbd60('0x2'));var mailAccount=require(_0xbd60('0x3'));var setting=require(_0xbd60('0x4'));var logger=require(_0xbd60('0x5'))(_0xbd60('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xbd60('0x7')]()['then'](mailAccount[_0xbd60('0x8')]())['then'](realtime[_0xbd60('0x9')]())[_0xbd60('0xa')](function(){email[_0xbd60('0xb')](realtime[_0xbd60('0xc')]);return realtime;});}function main(){return server[_0xbd60('0xd')](realtime,email)[_0xbd60('0xa')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0xbd60('0xa')](function(_0x182f21){return setInterval(initRealtime,_0x182f21['loginMailFrequency']*0x3e8);})[_0xbd60('0xe')](function(_0x155946){logger[_0xbd60('0xf')](_0xbd60('0x10'),_0x155946);});}main(); \ No newline at end of file +var _0x92ad=['email','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting'];(function(_0x63de62,_0xe5cc89){var _0x3daddf=function(_0x2a5d79){while(--_0x2a5d79){_0x63de62['push'](_0x63de62['shift']());}};_0x3daddf(++_0xe5cc89);}(_0x92ad,0xfb));var _0xd92a=function(_0x5a1ec5,_0x5035ec){_0x5a1ec5=_0x5a1ec5-0x0;var _0x18cdb7=_0x92ad[_0x5a1ec5];return _0x18cdb7;};'use strict';var server=require(_0xd92a('0x0'));var Realtime=require(_0xd92a('0x1'));var EmailChannel=require(_0xd92a('0x2'));var mailAccount=require(_0xd92a('0x3'));var setting=require(_0xd92a('0x4'));var logger=require('../../config/logger')(_0xd92a('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xd92a('0x6')](mailAccount[_0xd92a('0x7')]())[_0xd92a('0x6')](realtime[_0xd92a('0x8')]())['then'](function(){email[_0xd92a('0x9')](realtime[_0xd92a('0xa')]);return realtime;});}function main(){return server[_0xd92a('0xb')](realtime,email)[_0xd92a('0x6')](function(){return initRealtime();})[_0xd92a('0x6')](function(){return setting[_0xd92a('0xc')]();})[_0xd92a('0x6')](function(_0x11ea9b){return setInterval(initRealtime,_0x11ea9b['loginMailFrequency']*0x3e8);})[_0xd92a('0xd')](function(_0x10fb02){logger[_0xd92a('0xe')](_0xd92a('0xf'),_0x10fb02);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 41d88b3..774d65e 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 _0x6905=['socket.io-emitter','./imap','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','name','key','active','Imap','status','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','service','custom','provider','box','bind','handleImapEmail','end','error','handleImapError','messageStatus','emit','handleImapBox','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','Smtp','verify','verified','exports','moment','bluebird','md5','ioredis','email','redis'];(function(_0x10e218,_0x41d5a4){var _0x539334=function(_0x41b870){while(--_0x41b870){_0x10e218['push'](_0x10e218['shift']());}};_0x539334(++_0x41d5a4);}(_0x6905,0xd6));var _0x5690=function(_0x402731,_0x43c115){_0x402731=_0x402731-0x0;var _0x111736=_0x6905[_0x402731];return _0x111736;};'use strict';var _=require('lodash');var moment=require(_0x5690('0x0'));var BPromise=require(_0x5690('0x1'));var md5=require(_0x5690('0x2'));var Redis=require(_0x5690('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x5690('0x4'));config[_0x5690('0x5')]=_['defaults'](config[_0x5690('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x5690('0x6'))(new Redis(config[_0x5690('0x5')]));var EmailImap=require(_0x5690('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x5690('0x8'));var md5Accounts={};function EmailChannel(_0x11626e){logger['info']('start\x20email\x20channel');this[_0x5690('0x9')]=_0x11626e['mailAccounts'];this[_0x5690('0xa')]={};this[_0x5690('0xb')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x568ddc){var _0x424495=this[_0x5690('0x9')][_0x568ddc];var _0x42482c={'id':_0x424495['id'],'name':_0x424495[_0x5690('0xc')],'key':_0x424495[_0x5690('0xd')],'active':_0x424495[_0x5690('0xe')],'Imap':{'status':_0x424495[_0x5690('0xf')][_0x5690('0x10')],'messageStatus':_0x424495[_0x5690('0xf')]['messageStatus'],'total':_0x424495[_0x5690('0xf')][_0x5690('0x11')]}};if(_[_0x5690('0x12')](md5Accounts[_0x568ddc])){md5Accounts[_0x568ddc]={};}var _0x511c81=md5(JSON[_0x5690('0x13')](_0x42482c));if(md5Accounts[_0x568ddc][_0x5690('0x2')]!==_0x511c81){md5Accounts[_0x568ddc][_0x5690('0x2')]=_0x511c81;io['emit'](_0x5690('0x14'),_0x42482c);}};EmailChannel[_0x5690('0x15')][_0x5690('0x16')]=function(_0x8be744){for(var _0x54df50 in _0x8be744){if(_0x8be744[_0x5690('0x17')](_0x54df50)){if(_0x8be744[_0x54df50]['Imap']&&_0x8be744[_0x54df50][_0x5690('0xe')]){var _0x42b76b=_0x8be744[_0x54df50]['Imap'];if(!_0x42b76b[_0x5690('0x18')]&&_0x8be744[_0x54df50]['provider']!==_0x5690('0x19'))_0x42b76b[_0x5690('0x18')]=_0x8be744[_0x54df50][_0x5690('0x1a')];if(!this[_0x5690('0xa')][_0x5690('0x17')](_0x42b76b['id'])){this[_0x5690('0xa')][_0x42b76b['id']]=new EmailImap(_0x42b76b,_0x8be744[_0x54df50][_0x5690('0x4')]);this[_0x5690('0xa')][_0x42b76b['id']]['on'](_0x5690('0x1b'),this['handleImapBox'][_0x5690('0x1c')](this,_0x54df50));this['imapAccounts'][_0x42b76b['id']]['on'](_0x5690('0x4'),this[_0x5690('0x1d')]['bind'](this,_0x54df50));this[_0x5690('0xa')][_0x42b76b['id']]['on'](_0x5690('0x1e'),this['handleImapEnd'][_0x5690('0x1c')](this,_0x54df50));this[_0x5690('0xa')][_0x42b76b['id']]['on'](_0x5690('0x1f'),this[_0x5690('0x20')][_0x5690('0x1c')](this,_0x54df50));}}else{if(_[_0x5690('0x12')](this[_0x5690('0x9')][_0x54df50][_0x5690('0xf')])){this[_0x5690('0x9')][_0x54df50]['Imap']={};}this[_0x5690('0x9')][_0x54df50][_0x5690('0xf')][_0x5690('0x10')]='disabled';this[_0x5690('0x9')][_0x54df50][_0x5690('0xf')][_0x5690('0x21')]='';this[_0x5690('0x22')](_0x54df50);}}}};EmailChannel[_0x5690('0x15')][_0x5690('0x23')]=function(_0x1e5b1a,_0x5b9726){if(this[_0x5690('0x9')][_0x1e5b1a]){this[_0x5690('0x9')][_0x1e5b1a][_0x5690('0xf')]['status']=_0x5690('0x24');this[_0x5690('0x9')][_0x1e5b1a][_0x5690('0xf')][_0x5690('0x21')]=_0x5b9726[_0x5690('0xc')];if(_0x5b9726[_0x5690('0x25')]){this[_0x5690('0x9')][_0x1e5b1a][_0x5690('0xf')][_0x5690('0x11')]=_0x5b9726[_0x5690('0x25')]['total'];}return this[_0x5690('0x22')](_0x1e5b1a);}};EmailChannel[_0x5690('0x15')][_0x5690('0x1d')]=function(_0x1f471f,_0x6b63ff){logger[_0x5690('0x26')](_0x5690('0x27'),_0x6b63ff[_0x5690('0x28')],_0x6b63ff['lastName'],_0x6b63ff[_0x5690('0x29')],_0x1f471f);if(this[_0x5690('0x9')][_0x1f471f]){return mailAccount[_0x5690('0x2a')](_0x1f471f,_0x6b63ff)[_0x5690('0x2b')](function(_0x270d70){if(_0x270d70){logger[_0x5690('0x26')](_0x5690('0x2c'));}})[_0x5690('0x2d')](function(_0x440b00){logger['error'](_0x5690('0x2e'),JSON[_0x5690('0x13')](_0x440b00));});}};EmailChannel['prototype'][_0x5690('0x2f')]=function(_0x582e34){if(this[_0x5690('0x9')][_0x582e34]&&this[_0x5690('0x9')][_0x582e34][_0x5690('0xf')]){if(this[_0x5690('0xa')][this[_0x5690('0x9')][_0x582e34][_0x5690('0xf')]['id']]){delete this[_0x5690('0xa')][this[_0x5690('0x9')][_0x582e34][_0x5690('0xf')]['id']];}this[_0x5690('0x9')][_0x582e34][_0x5690('0xf')][_0x5690('0x30')]=moment();this['emit'](_0x582e34);}};EmailChannel['prototype'][_0x5690('0x20')]=function(_0x4afd91,_0x472ad8){if(this[_0x5690('0x9')][_0x4afd91]){this['mailAccounts'][_0x4afd91]['Imap']['status']='error';this['mailAccounts'][_0x4afd91][_0x5690('0xf')][_0x5690('0x21')]=_0x472ad8;return this['emit'](_0x4afd91);}};EmailChannel[_0x5690('0x15')][_0x5690('0x31')]=function(_0x2e6799,_0x2334a1){return this[_0x5690('0xb')][_0x5690('0x32')](_0x2e6799,_0x2334a1);};EmailChannel[_0x5690('0x15')]['verifySmtp']=function(_0x473172){var _0x32470d=this;if(this[_0x5690('0x9')][_0x473172['id']]){if(_[_0x5690('0x12')](this[_0x5690('0x9')][_0x473172['id']][_0x5690('0x33')])){this[_0x5690('0x9')][_0x473172['id']][_0x5690('0x33')]={};}this['mailAccounts'][_0x473172['id']][_0x5690('0x33')][_0x5690('0x30')]=moment();return new BPromise(function(_0x3613bb,_0x23cd36){return _0x32470d['smtp'][_0x5690('0x34')](_0x473172)[_0x5690('0x2b')](function(_0x14e14a){_0x32470d['mailAccounts'][_0x473172['id']]['Smtp'][_0x5690('0x10')]=_0x5690('0x35');_0x32470d[_0x5690('0x9')][_0x473172['id']][_0x5690('0x33')][_0x5690('0x21')]='';_0x32470d[_0x5690('0x22')](_0x473172['id']);_0x3613bb(_0x14e14a);})[_0x5690('0x2d')](function(_0x32a1dc){_0x32470d[_0x5690('0x9')][_0x473172['id']][_0x5690('0x33')]['status']='error';_0x32470d[_0x5690('0x9')][_0x473172['id']]['Smtp'][_0x5690('0x21')]=_0x32a1dc;_0x32470d[_0x5690('0x22')](_0x473172['id']);_0x23cd36(_0x32a1dc);});});}return this['smtp'][_0x5690('0x34')](_0x473172);};module[_0x5690('0x36')]=EmailChannel; \ No newline at end of file +var _0xe63c=['isNil','disabled','messageStatus','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','total','stringify','refresh','hasOwnProperty','provider','custom','service','box','handleImapBox','bind','handleImapEmail','error'];(function(_0x1e1191,_0x62c350){var _0x4dcde3=function(_0x8ac5d6){while(--_0x8ac5d6){_0x1e1191['push'](_0x1e1191['shift']());}};_0x4dcde3(++_0x62c350);}(_0xe63c,0x134));var _0xce63=function(_0x102f0a,_0x13474d){_0x102f0a=_0x102f0a-0x0;var _0x35e503=_0xe63c[_0x102f0a];return _0x35e503;};'use strict';var _=require('lodash');var moment=require(_0xce63('0x0'));var BPromise=require(_0xce63('0x1'));var md5=require(_0xce63('0x2'));var Redis=require(_0xce63('0x3'));var config=require(_0xce63('0x4'));var logger=require(_0xce63('0x5'))(_0xce63('0x6'));config[_0xce63('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xce63('0x8'))(new Redis(config['redis']));var EmailImap=require(_0xce63('0x9'));var EmailSmtp=require(_0xce63('0xa'));var mailAccount=require(_0xce63('0xb'));var md5Accounts={};function EmailChannel(_0x29f632){logger['info'](_0xce63('0xc'));this['mailAccounts']=_0x29f632[_0xce63('0xd')];this[_0xce63('0xe')]={};this[_0xce63('0xf')]=new EmailSmtp();}EmailChannel[_0xce63('0x10')][_0xce63('0x11')]=function(_0x446efa){var _0xd15768=this['mailAccounts'][_0x446efa];var _0x57874c={'id':_0xd15768['id'],'name':_0xd15768[_0xce63('0x12')],'key':_0xd15768['key'],'active':_0xd15768[_0xce63('0x13')],'Imap':{'status':_0xd15768[_0xce63('0x14')][_0xce63('0x15')],'messageStatus':_0xd15768[_0xce63('0x14')]['messageStatus'],'total':_0xd15768[_0xce63('0x14')][_0xce63('0x16')]}};if(_['isNil'](md5Accounts[_0x446efa])){md5Accounts[_0x446efa]={};}var _0x5194e2=md5(JSON[_0xce63('0x17')](_0x57874c));if(md5Accounts[_0x446efa]['md5']!==_0x5194e2){md5Accounts[_0x446efa][_0xce63('0x2')]=_0x5194e2;io[_0xce63('0x11')]('mailAccount:update',_0x57874c);}};EmailChannel['prototype'][_0xce63('0x18')]=function(_0x1f610c){for(var _0x48389e in _0x1f610c){if(_0x1f610c[_0xce63('0x19')](_0x48389e)){if(_0x1f610c[_0x48389e][_0xce63('0x14')]&&_0x1f610c[_0x48389e][_0xce63('0x13')]){var _0x231cb2=_0x1f610c[_0x48389e][_0xce63('0x14')];if(!_0x231cb2['service']&&_0x1f610c[_0x48389e][_0xce63('0x1a')]!==_0xce63('0x1b'))_0x231cb2[_0xce63('0x1c')]=_0x1f610c[_0x48389e][_0xce63('0x1a')];if(!this[_0xce63('0xe')]['hasOwnProperty'](_0x231cb2['id'])){this[_0xce63('0xe')][_0x231cb2['id']]=new EmailImap(_0x231cb2,_0x1f610c[_0x48389e][_0xce63('0x6')]);this[_0xce63('0xe')][_0x231cb2['id']]['on'](_0xce63('0x1d'),this[_0xce63('0x1e')][_0xce63('0x1f')](this,_0x48389e));this[_0xce63('0xe')][_0x231cb2['id']]['on'](_0xce63('0x6'),this[_0xce63('0x20')][_0xce63('0x1f')](this,_0x48389e));this[_0xce63('0xe')][_0x231cb2['id']]['on']('end',this['handleImapEnd'][_0xce63('0x1f')](this,_0x48389e));this[_0xce63('0xe')][_0x231cb2['id']]['on'](_0xce63('0x21'),this['handleImapError'][_0xce63('0x1f')](this,_0x48389e));}}else{if(_[_0xce63('0x22')](this['mailAccounts'][_0x48389e][_0xce63('0x14')])){this['mailAccounts'][_0x48389e]['Imap']={};}this[_0xce63('0xd')][_0x48389e]['Imap']['status']=_0xce63('0x23');this['mailAccounts'][_0x48389e][_0xce63('0x14')][_0xce63('0x24')]='';this[_0xce63('0x11')](_0x48389e);}}}};EmailChannel[_0xce63('0x10')][_0xce63('0x1e')]=function(_0x5a1353,_0x196047){if(this['mailAccounts'][_0x5a1353]){this[_0xce63('0xd')][_0x5a1353][_0xce63('0x14')][_0xce63('0x15')]=_0xce63('0x25');this[_0xce63('0xd')][_0x5a1353][_0xce63('0x14')]['messageStatus']=_0x196047[_0xce63('0x12')];if(_0x196047[_0xce63('0x26')]){this['mailAccounts'][_0x5a1353][_0xce63('0x14')][_0xce63('0x16')]=_0x196047[_0xce63('0x26')][_0xce63('0x16')];}return this[_0xce63('0x11')](_0x5a1353);}};EmailChannel[_0xce63('0x10')][_0xce63('0x20')]=function(_0x251666,_0x10c495){logger[_0xce63('0x27')](_0xce63('0x28'),_0x10c495['firstName'],_0x10c495[_0xce63('0x29')],_0x10c495[_0xce63('0x2a')],_0x251666);if(this[_0xce63('0xd')][_0x251666]){return mailAccount[_0xce63('0x2b')](_0x251666,_0x10c495)[_0xce63('0x2c')](function(_0x17dfa4){if(_0x17dfa4){logger['info'](_0xce63('0x2d'));}})[_0xce63('0x2e')](function(_0x4b9e8e){logger[_0xce63('0x21')](_0xce63('0x2f'),JSON[_0xce63('0x17')](_0x4b9e8e));});}};EmailChannel[_0xce63('0x10')]['handleImapEnd']=function(_0x4676f3){if(this['mailAccounts'][_0x4676f3]&&this[_0xce63('0xd')][_0x4676f3][_0xce63('0x14')]){if(this['imapAccounts'][this[_0xce63('0xd')][_0x4676f3][_0xce63('0x14')]['id']]){delete this['imapAccounts'][this[_0xce63('0xd')][_0x4676f3][_0xce63('0x14')]['id']];}this[_0xce63('0xd')][_0x4676f3][_0xce63('0x14')]['lastSync']=moment();this[_0xce63('0x11')](_0x4676f3);}};EmailChannel[_0xce63('0x10')][_0xce63('0x30')]=function(_0x1b691b,_0x2e03c6){if(this[_0xce63('0xd')][_0x1b691b]){this[_0xce63('0xd')][_0x1b691b][_0xce63('0x14')][_0xce63('0x15')]=_0xce63('0x21');this[_0xce63('0xd')][_0x1b691b][_0xce63('0x14')][_0xce63('0x24')]=_0x2e03c6;return this[_0xce63('0x11')](_0x1b691b);}};EmailChannel[_0xce63('0x10')][_0xce63('0x31')]=function(_0x873d3,_0x5b1f8b){return this[_0xce63('0xf')][_0xce63('0x32')](_0x873d3,_0x5b1f8b);};EmailChannel[_0xce63('0x10')][_0xce63('0x33')]=function(_0x4618de){var _0x2d431d=this;if(this[_0xce63('0xd')][_0x4618de['id']]){if(_['isNil'](this[_0xce63('0xd')][_0x4618de['id']][_0xce63('0x34')])){this['mailAccounts'][_0x4618de['id']][_0xce63('0x34')]={};}this[_0xce63('0xd')][_0x4618de['id']]['Smtp'][_0xce63('0x35')]=moment();return new BPromise(function(_0x5b1551,_0x533b3c){return _0x2d431d[_0xce63('0xf')][_0xce63('0x36')](_0x4618de)[_0xce63('0x2c')](function(_0x1d6af1){_0x2d431d[_0xce63('0xd')][_0x4618de['id']][_0xce63('0x34')][_0xce63('0x15')]=_0xce63('0x37');_0x2d431d[_0xce63('0xd')][_0x4618de['id']][_0xce63('0x34')]['messageStatus']='';_0x2d431d[_0xce63('0x11')](_0x4618de['id']);_0x5b1551(_0x1d6af1);})[_0xce63('0x2e')](function(_0x36a8a2){_0x2d431d['mailAccounts'][_0x4618de['id']]['Smtp'][_0xce63('0x15')]=_0xce63('0x21');_0x2d431d['mailAccounts'][_0x4618de['id']][_0xce63('0x34')][_0xce63('0x24')]=_0x36a8a2;_0x2d431d[_0xce63('0x11')](_0x4618de['id']);_0x533b3c(_0x36a8a2);});});}return this[_0xce63('0xf')][_0xce63('0x36')](_0x4618de);};module[_0xce63('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 8e5bf28..ad3b5dd 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 _0x1a69=['ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','getAccount','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','anonymous@xcally.com','host','port','tls','required','openBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','slice','message','handleFetchError','handleFetchEnd','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','html','parser','Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20','\x20bytes,\x20email\x20size:\x20','\x20bytes','\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','\x20bytes]','substring','text','closeBox','stringify','textCode','upperFirst','exports','lodash','imap','mailparser','simpleParser','iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','account','once'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1a69,0x152));var _0x91a6=function(_0x383cc2,_0x395986){_0x383cc2=_0x383cc2-0x0;var _0x432d6a=_0x1a69[_0x383cc2];return _0x432d6a;};'use strict';var _=require(_0x91a6('0x0'));var util=require('util');var Imap=require(_0x91a6('0x1'));var simpleParser=require(_0x91a6('0x2'))[_0x91a6('0x3')];var Iconv=require(_0x91a6('0x4'))['Iconv'];var EventEmitter=require('events')[_0x91a6('0x5')];var utils=require(_0x91a6('0x6'));var logger=require(_0x91a6('0x7'))(_0x91a6('0x8'));var config=require('../../../config/environment');const MAX_HTML_BYTES_SIZE=config['emailMaxHTMLbytesLimit']||0xee6b2800;function EmailImap(_0x33d476,_0x1f2cca){this[_0x91a6('0x9')]=_0x33d476[_0x91a6('0x9')];this[_0x91a6('0xa')]=this['getAccount'](_0x33d476,_0x1f2cca);this[_0x91a6('0x1')]=new Imap(this[_0x91a6('0xa')]);this['imap'][_0x91a6('0xb')](_0x91a6('0xc'),this[_0x91a6('0xd')][_0x91a6('0xe')](this));this[_0x91a6('0x1')][_0x91a6('0xb')](_0x91a6('0xf'),this[_0x91a6('0x10')][_0x91a6('0xe')](this));this[_0x91a6('0x1')]['on'](_0x91a6('0x11'),this[_0x91a6('0x12')][_0x91a6('0xe')](this));this['imap'][_0x91a6('0x13')]();}util[_0x91a6('0x14')](EmailImap,EventEmitter);EmailImap[_0x91a6('0x15')][_0x91a6('0x16')]=function(_0x209482,_0x53d488){var _0x40f497={'connTimeout':_0x209482['connTimeout']?_0x209482['connTimeout']*0x3e8:0x2710,'authTimeout':_0x209482['authTimeout']?_0x209482[_0x91a6('0x17')]*0x3e8:0x1388};if(_0x209482[_0x91a6('0x18')]){_0x40f497['user']=_0x209482[_0x91a6('0x19')];if(_0x209482[_0x91a6('0x1a')]){_0x40f497[_0x91a6('0x1b')]=utils[_0x91a6('0x1c')](_0x209482['CloudProvider'][_0x91a6('0x1d')],_0x209482['user']);}else{_0x40f497[_0x91a6('0x1e')]=_0x209482[_0x91a6('0x1e')];}}else{if(_0x209482['authentication']){_0x40f497[_0x91a6('0x19')]=_0x209482[_0x91a6('0x19')];_0x40f497['password']=_0x209482['password'];}}_0x40f497[_0x91a6('0x8')]=_0x53d488||_0x209482[_0x91a6('0x19')]||_0x91a6('0x1f');_0x40f497[_0x91a6('0x20')]=_0x209482[_0x91a6('0x20')];_0x40f497[_0x91a6('0x21')]=_0x209482['port']||0x3e1;if(_0x209482['tls']){_0x40f497[_0x91a6('0x22')]=!![];}else{_0x40f497[_0x91a6('0x22')]=![];_0x40f497['autotls']=_0x91a6('0x23');}return _0x40f497;};EmailImap['prototype'][_0x91a6('0xd')]=function(){this['imap'][_0x91a6('0x24')](this[_0x91a6('0x9')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x91a6('0x15')]['handleOpenBox']=function(_0x484fa8,_0x47f9bd){if(_0x484fa8){this[_0x91a6('0x12')](_0x484fa8,!![]);}else{this[_0x91a6('0x25')](_0x91a6('0x26'),_0x47f9bd);this[_0x91a6('0x27')]();}};EmailImap[_0x91a6('0x15')][_0x91a6('0x28')]=function(_0x25e42a){if(_0x25e42a){this[_0x91a6('0x12')](_0x25e42a,!![]);}else{this[_0x91a6('0x1')][_0x91a6('0xf')]();}};EmailImap[_0x91a6('0x15')][_0x91a6('0x27')]=function(){this['imap'][_0x91a6('0x29')]([_0x91a6('0x2a')],this[_0x91a6('0x2b')]['bind'](this));};EmailImap[_0x91a6('0x15')][_0x91a6('0x2b')]=function(_0x16b659,_0x2a21cd){if(_0x16b659){this['handleError'](_0x16b659,!![]);}else{if(_0x2a21cd[_0x91a6('0x2c')]){try{var _0x283a4f=this['imap']['fetch'](_0x2a21cd[_0x91a6('0x2d')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x283a4f['on'](_0x91a6('0x2e'),this['handleFetchMessage'][_0x91a6('0xe')](this));_0x283a4f[_0x91a6('0xb')](_0x91a6('0x11'),this[_0x91a6('0x2f')][_0x91a6('0xe')](this));_0x283a4f[_0x91a6('0xb')](_0x91a6('0xf'),this[_0x91a6('0x30')]['bind'](this));}catch(_0x53f4d7){logger[_0x91a6('0x11')](_0x53f4d7);}}else{this['imap']['closeBox'](!![],this[_0x91a6('0x28')][_0x91a6('0xe')](this));}}};EmailImap['prototype'][_0x91a6('0x31')]=function(_0x33e6fb){_0x33e6fb['on'](_0x91a6('0x32'),this['handleMessageBody'][_0x91a6('0xe')](this));_0x33e6fb['once'](_0x91a6('0x33'),this[_0x91a6('0x34')]['bind'](this));_0x33e6fb[_0x91a6('0xb')](_0x91a6('0xf'),this[_0x91a6('0x35')][_0x91a6('0xe')](this));};EmailImap[_0x91a6('0x15')][_0x91a6('0x36')]=function(_0x4e9a44){simpleParser(_0x4e9a44,{'Iconv':Iconv},this['handleSimpleParser'][_0x91a6('0xe')](this));};EmailImap['prototype'][_0x91a6('0x34')]=function(){};EmailImap['prototype'][_0x91a6('0x35')]=function(){};EmailImap[_0x91a6('0x15')][_0x91a6('0x37')]=function(_0x259a65,_0x180aa6){if(_0x259a65){logger['error'](_0x259a65);}else{var _0x3ff23e=this;const _0xdcdcd=_0x180aa6[_0x91a6('0x38')][_0x91a6('0x2c')];if(_0xdcdcdEmpty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger','../../../config/environment','value','address','generate','@xcally.com','head','name','substring','indexOf','split','slice','join','length','isEmpty','anonymous','test','html','includes','attachments','forEach','push','filename','_SRC','replace','_IMG','\x20]','body','textAsHtml','0x1?_0x34e507[_0xb495('0x10')](0x0,-0x1)[_0xb495('0x11')]('\x20'):_0x2a667e[_0xb495('0xc')];}return'Anonymous';}function getLastName(_0x57e816){var _0x444a50=_[_0xb495('0xb')](_0x57e816['value']);if(_0x444a50&&_0x444a50['name']){var _0x32a1f4=_0x444a50[_0xb495('0xc')][_0xb495('0xf')](/\s+/);return _0x32a1f4['length']>0x1?_0x32a1f4['pop']():'';}return'';}function getMails(_0x3aceb9,_0x248f52){var _0x38ef4e='';for(var _0x70c392=0x0;_0x70c392<_0x248f52[_0xb495('0x7')][_0xb495('0x12')];_0x70c392+=0x1){if(_0x248f52[_0xb495('0x7')][_0x70c392][_0xb495('0x8')]!==_0x3aceb9){if(!_[_0xb495('0x13')](_0x38ef4e)){_0x38ef4e+=',';}_0x38ef4e+=_0x248f52['value'][_0x70c392][_0xb495('0xc')]||_0x248f52[_0xb495('0x7')][_0x70c392][_0xb495('0x8')]||'';_0x38ef4e+='\x20<';_0x38ef4e+=_0x248f52[_0xb495('0x7')][_0x70c392][_0xb495('0x8')]?_0x248f52['value'][_0x70c392]['address']:_0xb495('0x14')+random[_0xb495('0x9')](0x6)+'@xcally.com';_0x38ef4e+='>';}}return _0x38ef4e;}function parseEmail(_0x4c1be2,_0x36daf2,_0x5354e8){if(_0x36daf2['html']){var _0x3cc95b=/)<[^<]*)*<\/script>/gi;while(_0x3cc95b[_0xb495('0x15')](_0x36daf2[_0xb495('0x16')])){_0x36daf2[_0xb495('0x16')]=_0x36daf2['html']['replace'](_0x3cc95b,'');}if(_0x36daf2[_0xb495('0x16')][_0xb495('0x17')]('{_0x466775[_0xb495('0x1a')](_0x5d520e[_0xb495('0x1b')]);});var _0x18686a=/]+>/g;var _0x123403=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x308579=_0x36daf2[_0xb495('0x16')]['replace'](_0x123403,_0xb495('0x1c'));var _0x1c375e=_0x308579[_0xb495('0x1d')](_0x18686a,_0xb495('0x1e'));for(let _0x52d61b=0x0;_0x52d61b<_0x466775['length'];_0x52d61b++){var _0x1d5ef3=_0x1c375e[_0xb495('0x1d')](_0xb495('0x1e'),'\x20[Attachment:\x20'+_0x466775[_0x52d61b]+_0xb495('0x1f'));_0x1c375e=_0x1d5ef3;}_0x36daf2[_0xb495('0x16')]=_0x1c375e;}_0x5354e8[_0xb495('0x20')]=_0x36daf2[_0xb495('0x16')];}else{_0x5354e8['body']=_0x36daf2[_0xb495('0x21')];}if(_0x5354e8['body']){_0x5354e8['body']=_0x5354e8[_0xb495('0x20')]['replace'](/0x0){var _0x363554=[_0xb495('0x30'),_0xb495('0x31'),_0xb495('0x32')];for(var _0x169fad=0x0;_0x169fad<_0x36daf2['headerLines'][_0xb495('0x12')];_0x169fad++){var _0xc8a9b9=_['indexOf'](_0x363554,_0x36daf2[_0xb495('0x2f')][_0x169fad][_0xb495('0x33')]);if(_0xc8a9b9>=0x0){_0x5354e8['isAutoreply']=!![];}}}return _0x5354e8;}exports['parser']=function(_0x3fcf22,_0x48daf8,_0x363a74){var _0x8033b4={'from':getAddress(_0x48daf8[_0xb495('0x34')]),'firstName':getFirstName(_0x48daf8['from']),'lastName':getLastName(_0x48daf8[_0xb495('0x34')]),'mapKey':_0xb495('0x25'),'message':{'from':getMails(_0x3fcf22['email'],_0x48daf8[_0xb495('0x34')]),'to':_0x3fcf22[_0xb495('0x25')],'cc':'','subject':_0x48daf8[_0xb495('0x35')]||'','messageId':_0x48daf8[_0xb495('0x36')],'inReplyTo':_0x48daf8[_0xb495('0x37')],'sentAt':moment(_0x48daf8['date'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x48daf8[_0xb495('0x16')]&&!_0x48daf8['textAsHtml']){var _0x5a0777=_[_0xb495('0x38')](_0x48daf8[_0xb495('0x18')],{'contentType':_0xb495('0x39')});if(_0x5a0777[_0xb495('0x12')]){logger['info'](util[_0xb495('0x3a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x48daf8['messageId']));tnef[_0xb495('0x3b')](_[_0xb495('0x3c')](_0x5a0777)[_0xb495('0x2e')],function(_0x3479c0,_0x16f1c3){if(_0x16f1c3){_0x48daf8[_0xb495('0x16')]=_0x16f1c3[_0xb495('0x3d')]||_0xb495('0x3e');if(_0x16f1c3[_0xb495('0x3f')]){for(var _0x25d37c=0x0;_0x25d37c<_0x16f1c3['Attachments'][_0xb495('0x12')];_0x25d37c++){var _0x4aa0eb=_0x16f1c3['Attachments'][_0x25d37c];_0x8033b4[_0xb495('0x23')]['attachments'][_0xb495('0x1a')]({'filename':_0x4aa0eb[_0xb495('0x40')],'content':Buffer[_0xb495('0x34')](_0x4aa0eb[_0xb495('0x41')])});}}}_0x363a74(parseEmail(_0x3fcf22,_0x48daf8,_0x8033b4));});}else{_0x48daf8[_0xb495('0x16')]=_0xb495('0x3e');_0x363a74(parseEmail(_0x3fcf22,_0x48daf8,_0x8033b4));}}else{_0x363a74(parseEmail(_0x3fcf22,_0x48daf8,_0x8033b4));}};exports[_0xb495('0x42')]=function(_0x2efb38,_0xa35075){var _0x3121bc=[_0xb495('0x43')+(_0xa35075||''),_0xb495('0x44')+_0x2efb38,'',''];return Buffer['from'](_0x3121bc[_0xb495('0x11')](''),'utf-8')[_0xb495('0x45')](_0xb495('0x46'));}; \ No newline at end of file +var _0xa8eb=['Anonymous','pop','isEmpty','html','replace','includes','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','indexOf','split','length','join'];(function(_0x3f412f,_0x206c25){var _0x2b85f8=function(_0x3b3dbd){while(--_0x3b3dbd){_0x3f412f['push'](_0x3f412f['shift']());}};_0x2b85f8(++_0x206c25);}(_0xa8eb,0x1e4));var _0xba8e=function(_0x339859,_0x5a5843){_0x339859=_0x339859-0x0;var _0x427def=_0xa8eb[_0x339859];return _0x427def;};'use strict';var _=require(_0xba8e('0x0'));var moment=require(_0xba8e('0x1'));var random=require(_0xba8e('0x2'));var fs=require('fs');var path=require(_0xba8e('0x3'));var util=require(_0xba8e('0x4'));var tnef=require(_0xba8e('0x5'));var logger=require(_0xba8e('0x6'))(_0xba8e('0x7'));var config=require(_0xba8e('0x8'));function getAddress(_0x156be4){var _0x1fac5a=_[_0xba8e('0x9')](_0x156be4[_0xba8e('0xa')]);return _0x1fac5a&&_0x1fac5a[_0xba8e('0xb')]?_0x1fac5a[_0xba8e('0xb')]:_0xba8e('0xc')+random[_0xba8e('0xd')](0x6)+_0xba8e('0xe');}function getFirstName(_0x4c3e2a){var _0x32d550=_[_0xba8e('0x9')](_0x4c3e2a['value']);if(_0x32d550&&_0x32d550['name']){if(_0x32d550[_0xba8e('0xf')]==_0x32d550[_0xba8e('0xb')]){return _0x32d550['name']['substring'](0x0,_0x32d550[_0xba8e('0xf')][_0xba8e('0x10')]('@'));}var _0x3601d4=_0x32d550[_0xba8e('0xf')][_0xba8e('0x11')](/\s+/);return _0x3601d4[_0xba8e('0x12')]>0x1?_0x3601d4['slice'](0x0,-0x1)[_0xba8e('0x13')]('\x20'):_0x32d550[_0xba8e('0xf')];}return _0xba8e('0x14');}function getLastName(_0x51e83f){var _0x1d2bb4=_[_0xba8e('0x9')](_0x51e83f[_0xba8e('0xa')]);if(_0x1d2bb4&&_0x1d2bb4['name']){var _0x1ffb74=_0x1d2bb4[_0xba8e('0xf')]['split'](/\s+/);return _0x1ffb74[_0xba8e('0x12')]>0x1?_0x1ffb74[_0xba8e('0x15')]():'';}return'';}function getMails(_0x2f5c3c,_0x5805ce){var _0x5c863f='';for(var _0x93401a=0x0;_0x93401a<_0x5805ce[_0xba8e('0xa')][_0xba8e('0x12')];_0x93401a+=0x1){if(_0x5805ce[_0xba8e('0xa')][_0x93401a][_0xba8e('0xb')]!==_0x2f5c3c){if(!_[_0xba8e('0x16')](_0x5c863f)){_0x5c863f+=',';}_0x5c863f+=_0x5805ce[_0xba8e('0xa')][_0x93401a][_0xba8e('0xf')]||_0x5805ce[_0xba8e('0xa')][_0x93401a][_0xba8e('0xb')]||'';_0x5c863f+='\x20<';_0x5c863f+=_0x5805ce[_0xba8e('0xa')][_0x93401a][_0xba8e('0xb')]?_0x5805ce[_0xba8e('0xa')][_0x93401a][_0xba8e('0xb')]:_0xba8e('0xc')+random[_0xba8e('0xd')](0x6)+_0xba8e('0xe');_0x5c863f+='>';}}return _0x5c863f;}function parseEmail(_0x4a8abf,_0x3d7655,_0x2f0bd2){if(_0x3d7655[_0xba8e('0x17')]){var _0x42b1b1=/)<[^<]*)*<\/script>/gi;while(_0x42b1b1['test'](_0x3d7655[_0xba8e('0x17')])){_0x3d7655[_0xba8e('0x17')]=_0x3d7655[_0xba8e('0x17')][_0xba8e('0x18')](_0x42b1b1,'');}if(_0x3d7655[_0xba8e('0x17')][_0xba8e('0x19')](_0xba8e('0x1a'))){var _0x427ead=[];_0x3d7655[_0xba8e('0x1b')]['forEach'](_0x49a6a6=>{_0x427ead[_0xba8e('0x1c')](_0x49a6a6[_0xba8e('0x1d')]);});var _0x2ef7a7=/]+>/g;var _0x11d5f6=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x17efa9=_0x3d7655['html'][_0xba8e('0x18')](_0x11d5f6,_0xba8e('0x1e'));var _0x150e08=_0x17efa9[_0xba8e('0x18')](_0x2ef7a7,_0xba8e('0x1f'));for(let _0x9373ed=0x0;_0x9373ed<_0x427ead[_0xba8e('0x12')];_0x9373ed++){var _0x1a9bbf=_0x150e08[_0xba8e('0x18')](_0xba8e('0x1f'),'\x20[Attachment:\x20'+_0x427ead[_0x9373ed]+'\x20]');_0x150e08=_0x1a9bbf;}_0x3d7655['html']=_0x150e08;}_0x2f0bd2[_0xba8e('0x20')]=_0x3d7655['html'];}else{_0x2f0bd2[_0xba8e('0x20')]=_0x3d7655[_0xba8e('0x21')];}if(_0x2f0bd2['body']){_0x2f0bd2['body']=_0x2f0bd2[_0xba8e('0x20')][_0xba8e('0x18')](/0x0){var _0x37d91a=[_0xba8e('0x30'),_0xba8e('0x31'),'Precedence:\x20auto_reply'];for(var _0x44ffcd=0x0;_0x44ffcd<_0x3d7655['headerLines'][_0xba8e('0x12')];_0x44ffcd++){var _0x6be3c9=_[_0xba8e('0x10')](_0x37d91a,_0x3d7655['headerLines'][_0x44ffcd][_0xba8e('0x32')]);if(_0x6be3c9>=0x0){_0x2f0bd2[_0xba8e('0x33')]=!![];}}}return _0x2f0bd2;}exports[_0xba8e('0x34')]=function(_0x45579c,_0x3b3833,_0x1a1319){var _0xbf6d4c={'from':getAddress(_0x3b3833['from']),'firstName':getFirstName(_0x3b3833[_0xba8e('0x35')]),'lastName':getLastName(_0x3b3833[_0xba8e('0x35')]),'mapKey':_0xba8e('0x7'),'message':{'from':getMails(_0x45579c[_0xba8e('0x7')],_0x3b3833[_0xba8e('0x35')]),'to':_0x45579c['email'],'cc':'','subject':_0x3b3833[_0xba8e('0x36')]||'','messageId':_0x3b3833[_0xba8e('0x37')],'inReplyTo':_0x3b3833[_0xba8e('0x38')],'sentAt':moment(_0x3b3833[_0xba8e('0x39')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3b3833[_0xba8e('0x17')]&&!_0x3b3833[_0xba8e('0x21')]){var _0x2c3fef=_[_0xba8e('0x3a')](_0x3b3833[_0xba8e('0x1b')],{'contentType':_0xba8e('0x3b')});if(_0x2c3fef[_0xba8e('0x12')]){logger[_0xba8e('0x3c')](util[_0xba8e('0x29')](_0xba8e('0x3d'),_0x3b3833[_0xba8e('0x37')]));tnef[_0xba8e('0x3e')](_[_0xba8e('0x3f')](_0x2c3fef)[_0xba8e('0x2d')],function(_0x1e7f48,_0x2dbcc2){if(_0x2dbcc2){_0x3b3833[_0xba8e('0x17')]=_0x2dbcc2[_0xba8e('0x40')]||_0xba8e('0x41');if(_0x2dbcc2[_0xba8e('0x42')]){for(var _0x34a1e3=0x0;_0x34a1e3<_0x2dbcc2[_0xba8e('0x42')][_0xba8e('0x12')];_0x34a1e3++){var _0x286425=_0x2dbcc2[_0xba8e('0x42')][_0x34a1e3];_0xbf6d4c[_0xba8e('0x23')][_0xba8e('0x1b')][_0xba8e('0x1c')]({'filename':_0x286425[_0xba8e('0x43')],'content':Buffer[_0xba8e('0x35')](_0x286425[_0xba8e('0x44')])});}}}_0x1a1319(parseEmail(_0x45579c,_0x3b3833,_0xbf6d4c));});}else{_0x3b3833[_0xba8e('0x17')]=_0xba8e('0x41');_0x1a1319(parseEmail(_0x45579c,_0x3b3833,_0xbf6d4c));}}else{_0x1a1319(parseEmail(_0x45579c,_0x3b3833,_0xbf6d4c));}};exports[_0xba8e('0x45')]=function(_0x4bf9c1,_0x44da1a){var _0x5b00dd=[_0xba8e('0x46')+(_0x44da1a||''),'auth=Bearer\x20'+_0x4bf9c1,'',''];return Buffer[_0xba8e('0x35')](_0x5b00dd['join'](''),'utf-8')['toString'](_0xba8e('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 5586065..a5b1a22 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 _0xc3d9=['exports','Service','key','SERV','active','Imap'];(function(_0x586538,_0x308b52){var _0x586e60=function(_0x193491){while(--_0x193491){_0x586538['push'](_0x586538['shift']());}};_0x586e60(++_0x308b52);}(_0xc3d9,0x19f));var _0x9c3d=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xc3d9[_0x547456];return _0xc1fd7b;};'use strict';var _=require('lodash');function MailAccount(_0x757853){this['id']=_0x757853['id']||0x0;this['name']=_0x757853['name']||_0x9c3d('0x0');this[_0x9c3d('0x1')]=_0x757853[_0x9c3d('0x1')]||_0x9c3d('0x2');this[_0x9c3d('0x3')]=_0x757853['active']||![];this[_0x9c3d('0x4')]=_0x757853['Imap']||[];this['Smtp']=_0x757853['Smtp']||[];}module[_0x9c3d('0x5')]=MailAccount; \ No newline at end of file +var _0xe192=['key','SERV','Imap','exports','lodash','name','Service'];(function(_0xdb6398,_0x2d07b3){var _0x5dd76b=function(_0x40136a){while(--_0x40136a){_0xdb6398['push'](_0xdb6398['shift']());}};_0x5dd76b(++_0x2d07b3);}(_0xe192,0x1e0));var _0x2e19=function(_0x483405,_0x5e4132){_0x483405=_0x483405-0x0;var _0xf0b73d=_0xe192[_0x483405];return _0xf0b73d;};'use strict';var _=require(_0x2e19('0x0'));function MailAccount(_0x34ec8b){this['id']=_0x34ec8b['id']||0x0;this[_0x2e19('0x1')]=_0x34ec8b[_0x2e19('0x1')]||_0x2e19('0x2');this[_0x2e19('0x3')]=_0x34ec8b['key']||_0x2e19('0x4');this['active']=_0x34ec8b['active']||![];this[_0x2e19('0x5')]=_0x34ec8b[_0x2e19('0x5')]||[];this['Smtp']=_0x34ec8b['Smtp']||[];}module[_0x2e19('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 7aaf211..a54ec71 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 _0xa034=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined','merge'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa034,0x1b9));var _0x4a03=function(_0x439ee4,_0x48aa5e){_0x439ee4=_0x439ee4-0x0;var _0x3f0f50=_0xa034[_0x439ee4];return _0x3f0f50;};'use strict';var _=require(_0x4a03('0x0'));var MailAccount=require(_0x4a03('0x1'));var Realtime=function(){this[_0x4a03('0x2')]={};};function freeIsNotKey(_0x407285,_0x1c0873,_0x543436){var _0x5e7f78=_[_0x4a03('0x3')](_0x407285,function(_0xba26b4,_0x33f387){return _0xba26b4[_0x543436];});for(var _0x1396a6 in _0x1c0873){if(_0x1c0873[_0x4a03('0x4')](_0x1396a6)){if(!_0x5e7f78[_0x1396a6]){delete _0x1c0873[_0x1396a6];}}}}Realtime[_0x4a03('0x5')][_0x4a03('0x6')]=function(_0xf036c7,_0x52c282){for(var _0x4fda92 in _0x52c282){if(_0xf036c7[_0x4a03('0x4')](_0x4fda92)){_0xf036c7[_0x4fda92]=_0x52c282[_0x4fda92];}}};Realtime['prototype'][_0x4a03('0x7')]=function(){var _0x3fe893=this;return function(_0x4a9384){if(_0x4a9384){freeIsNotKey(_0x4a9384,_0x3fe893['mailAccounts'],'id');for(var _0x86dc9d=0x0,_0x3a72c7={},_0x193848={};_0x86dc9d<_0x4a9384['length'];_0x86dc9d+=0x1){_0x3a72c7=_0x4a9384[_0x86dc9d];if(_[_0x4a03('0x8')](_0x3fe893[_0x4a03('0x2')][_0x3a72c7['id']])){_0x3fe893['mailAccounts'][_0x3a72c7['id']]=new MailAccount(_0x3a72c7);}else{_[_0x4a03('0x9')](_0x3fe893['mailAccounts'][_0x3a72c7['id']],_0x3a72c7);}}}return _0x3fe893[_0x4a03('0x2')];};};module[_0x4a03('0xa')]=Realtime; \ No newline at end of file +var _0xc0dd=['mergeFromDatabase','initMailAccounts','length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype'];(function(_0x52f535,_0x13124d){var _0x4580b5=function(_0x2558bd){while(--_0x2558bd){_0x52f535['push'](_0x52f535['shift']());}};_0x4580b5(++_0x13124d);}(_0xc0dd,0x14f));var _0xdc0d=function(_0x994e62,_0x426597){_0x994e62=_0x994e62-0x0;var _0x415627=_0xc0dd[_0x994e62];return _0x415627;};'use strict';var _=require(_0xdc0d('0x0'));var MailAccount=require(_0xdc0d('0x1'));var Realtime=function(){this[_0xdc0d('0x2')]={};};function freeIsNotKey(_0x40caef,_0x18e13e,_0x2f52d8){var _0x5cda64=_[_0xdc0d('0x3')](_0x40caef,function(_0x1a6e5c,_0x5a3bfb){return _0x1a6e5c[_0x2f52d8];});for(var _0x37dbf9 in _0x18e13e){if(_0x18e13e['hasOwnProperty'](_0x37dbf9)){if(!_0x5cda64[_0x37dbf9]){delete _0x18e13e[_0x37dbf9];}}}}Realtime[_0xdc0d('0x4')][_0xdc0d('0x5')]=function(_0x241be4,_0x1564d7){for(var _0x129f75 in _0x1564d7){if(_0x241be4['hasOwnProperty'](_0x129f75)){_0x241be4[_0x129f75]=_0x1564d7[_0x129f75];}}};Realtime[_0xdc0d('0x4')][_0xdc0d('0x6')]=function(){var _0x2ee853=this;return function(_0x56d279){if(_0x56d279){freeIsNotKey(_0x56d279,_0x2ee853[_0xdc0d('0x2')],'id');for(var _0x3351b3=0x0,_0x132db8={},_0x289551={};_0x3351b3<_0x56d279[_0xdc0d('0x7')];_0x3351b3+=0x1){_0x132db8=_0x56d279[_0x3351b3];if(_[_0xdc0d('0x8')](_0x2ee853[_0xdc0d('0x2')][_0x132db8['id']])){_0x2ee853[_0xdc0d('0x2')][_0x132db8['id']]=new MailAccount(_0x132db8);}else{_[_0xdc0d('0x9')](_0x2ee853['mailAccounts'][_0x132db8['id']],_0x132db8);}}}return _0x2ee853[_0xdc0d('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ccc8f3b..45769b1 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 _0xd48e=['email','active','key','TemplateId','MailServerIn','Imap','service','MailServerOut','Smtp','CloudProvider','type','data5','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','provider'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xd48e,0x93));var _0xed48=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xd48e[_0xdea41a];return _0x15d0d8;};'use strict';var client=require('../client');exports[_0xed48('0x0')]=function(){return function(){return client[_0xed48('0x1')](_0xed48('0x2'),{'options':{'attributes':['id',_0xed48('0x3'),_0xed48('0x4'),'service',_0xed48('0x5'),_0xed48('0x6'),_0xed48('0x7'),'ListId',_0xed48('0x8')],'raw':![],'include':[{'model':_0xed48('0x9'),'as':_0xed48('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0xed48('0x3'),_0xed48('0xb'),'type','data5'],'as':'CloudProvider'}]},{'model':_0xed48('0xc'),'as':_0xed48('0xd'),'include':[{'model':_0xed48('0xe'),'attributes':['id','name','service',_0xed48('0xf'),_0xed48('0x10')],'as':_0xed48('0xe')}]}]},'log':'getMailAccount'});};};exports[_0xed48('0x11')]=function(_0x3a61d1,_0x2ff0a9){return client[_0xed48('0x1')](_0xed48('0x12'),{'account':{'id':_0x3a61d1},'body':_0x2ff0a9,'log':_0xed48('0x12')});}; \ No newline at end of file +var _0xb89c=['../client','getMailAccounts','Request','GetMailAccount','provider','service','active','key','ListId','Imap','CloudProvider','name','type','data5','Smtp','getMailAccount','NotifyMailAccount'];(function(_0x399efa,_0x3b10b7){var _0x4a1d68=function(_0x116818){while(--_0x116818){_0x399efa['push'](_0x399efa['shift']());}};_0x4a1d68(++_0x3b10b7);}(_0xb89c,0x198));var _0xcb89=function(_0x569073,_0x1ed3fb){_0x569073=_0x569073-0x0;var _0x392032=_0xb89c[_0x569073];return _0x392032;};'use strict';var client=require(_0xcb89('0x0'));exports[_0xcb89('0x1')]=function(){return function(){return client[_0xcb89('0x2')](_0xcb89('0x3'),{'options':{'attributes':['id','name',_0xcb89('0x4'),_0xcb89('0x5'),'email',_0xcb89('0x6'),_0xcb89('0x7'),_0xcb89('0x8'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0xcb89('0x9'),'include':[{'model':_0xcb89('0xa'),'attributes':['id',_0xcb89('0xb'),'service',_0xcb89('0xc'),_0xcb89('0xd')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xcb89('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0xcb89('0xb'),_0xcb89('0x5'),_0xcb89('0xc'),_0xcb89('0xd')],'as':_0xcb89('0xa')}]}]},'log':_0xcb89('0xf')});};};exports['notify']=function(_0x2a5bf9,_0x5b1cdd){return client[_0xcb89('0x2')](_0xcb89('0x10'),{'account':{'id':_0x2a5bf9},'body':_0x5b1cdd,'log':_0xcb89('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 00f71ed..47914ea 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 _0x3748=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0xf8adda,_0x1335f5){var _0x1df69c=function(_0x4b9588){while(--_0x4b9588){_0xf8adda['push'](_0xf8adda['shift']());}};_0x1df69c(++_0x1335f5);}(_0x3748,0x1e1));var _0x8374=function(_0x348fb9,_0x285860){_0x348fb9=_0x348fb9-0x0;var _0x5e13f9=_0x3748[_0x348fb9];return _0x5e13f9;};'use strict';var client=require(_0x8374('0x0'));exports[_0x8374('0x1')]=function(){return client[_0x8374('0x2')](_0x8374('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x8374('0x4')});}; \ No newline at end of file +var _0x7713=['loginMailFrequency','../client','getSettings','Request','ShowSetting'];(function(_0xbd8e89,_0x1229e9){var _0x4588eb=function(_0x5d85cd){while(--_0x5d85cd){_0xbd8e89['push'](_0xbd8e89['shift']());}};_0x4588eb(++_0x1229e9);}(_0x7713,0x146));var _0x3771=function(_0x1af07b,_0x1aa449){_0x1af07b=_0x1af07b-0x0;var _0x300ad6=_0x7713[_0x1af07b];return _0x300ad6;};'use strict';var client=require(_0x3771('0x0'));exports[_0x3771('0x1')]=function(){return client[_0x3771('0x2')](_0x3771('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3771('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index c7ea007..23c8e90 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 b95e5fd..ffdb047 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 _0x4b00=['../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','exports','http','sticky-session','../../config/environment','createServer','port','websocket','redis','defaults','localhost','adapter','socket.io-redis'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x4b00,0x15e));var _0x04b0=function(_0x48864b,_0x2b0a2d){_0x48864b=_0x48864b-0x0;var _0x1cd3d5=_0x4b00[_0x48864b];return _0x1cd3d5;};'use strict';var _=require('lodash');var http=require(_0x04b0('0x0'));var express=require('express');var sticky=require(_0x04b0('0x1'));var Redis=require('ioredis');var config=require(_0x04b0('0x2'));var app=express();var server=http[_0x04b0('0x3')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x04b0('0x4')])){var socketio=require('socket.io')(server,{'transports':[_0x04b0('0x5'),'polling']});config[_0x04b0('0x6')]=_[_0x04b0('0x7')](config['redis'],{'host':_0x04b0('0x8'),'port':0x18eb});socketio[_0x04b0('0x9')](require(_0x04b0('0xa'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x04b0('0x6')])}));require(_0x04b0('0xb'))[_0x04b0('0xc')]();require(_0x04b0('0xd'))[_0x04b0('0xc')](socketio);require(_0x04b0('0xe'))[_0x04b0('0xc')](app);require(_0x04b0('0xf'))[_0x04b0('0xc')](app);}else{server[_0x04b0('0x10')](_0x04b0('0x11'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0x04b0('0x12')]=app; \ No newline at end of file +var _0xfa33=['Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','redis','localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening'];(function(_0x5c8f88,_0x575128){var _0x5d21be=function(_0x528b68){while(--_0x528b68){_0x5c8f88['push'](_0x5c8f88['shift']());}};_0x5d21be(++_0x575128);}(_0xfa33,0x7a));var _0x3fa3=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xfa33[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x3fa3('0x0'));var http=require(_0x3fa3('0x1'));var express=require(_0x3fa3('0x2'));var sticky=require(_0x3fa3('0x3'));var Redis=require(_0x3fa3('0x4'));var config=require(_0x3fa3('0x5'));var app=express();var server=http[_0x3fa3('0x6')](app);server[_0x3fa3('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0x3fa3('0x8')])){var socketio=require(_0x3fa3('0x9'))(server,{'transports':[_0x3fa3('0xa'),_0x3fa3('0xb')]});config['redis']=_['defaults'](config[_0x3fa3('0xc')],{'host':_0x3fa3('0xd'),'port':0x18eb});socketio[_0x3fa3('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0x3fa3('0xc')]),'subClient':new Redis(config[_0x3fa3('0xc')])}));require(_0x3fa3('0xf'))[_0x3fa3('0x10')]();require(_0x3fa3('0x11'))[_0x3fa3('0x10')](socketio);require(_0x3fa3('0x12'))[_0x3fa3('0x10')](app);require(_0x3fa3('0x13'))[_0x3fa3('0x10')](app);}else{server[_0x3fa3('0x14')](_0x3fa3('0x15'),function(){console['log'](_0x3fa3('0x16'),config[_0x3fa3('0x8')]);});}exports=module[_0x3fa3('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 917d712..c9615a1 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 _0x9209=['debug','routing','error','message','result','catch','jayson/promise','../../config/logger','client','http','Request','request'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0x9209,0xea));var _0x9920=function(_0x281597,_0xc262dd){_0x281597=_0x281597-0x0;var _0x2e4d90=_0x9209[_0x281597];return _0x2e4d90;};'use strict';var jayson=require(_0x9920('0x0'));var BPromise=require('bluebird');var logger=require(_0x9920('0x1'))('routing');var client=jayson[_0x9920('0x2')][_0x9920('0x3')]({'port':0x2329});client[_0x9920('0x4')]=function(_0x28d87f,_0x39ff40){return new BPromise(function(_0xe312e3,_0x579f24){return client[_0x9920('0x5')](_0x28d87f,_0x39ff40)['then'](function(_0x336dc3){logger[_0x9920('0x6')]('rpc',_0x9920('0x7'),_0x28d87f,_0x39ff40,_0x336dc3);if(_0x336dc3['error']){logger[_0x9920('0x8')]('rpc','routing',_0x28d87f,_0x336dc3[_0x9920('0x8')][_0x9920('0x9')],_0x39ff40);return _0x579f24(_0x336dc3[_0x9920('0x8')]['message']);}else{return _0xe312e3(_0x336dc3[_0x9920('0xa')]);}})[_0x9920('0xb')](function(_0x2cc616){logger['error']('rpc',_0x9920('0x7'),_0x28d87f,_0x2cc616,_0x39ff40);return _0x579f24(_0x2cc616);});});};module['exports']=client; \ No newline at end of file +var _0xe7d5=['message','result','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','rpc','error'];(function(_0x1522be,_0x4cc0a8){var _0x14f18d=function(_0xe439bc){while(--_0xe439bc){_0x1522be['push'](_0x1522be['shift']());}};_0x14f18d(++_0x4cc0a8);}(_0xe7d5,0xfa));var _0x5e7d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe7d5[_0x19e35c];return _0x3e1fe8;};'use strict';var jayson=require(_0x5e7d('0x0'));var BPromise=require('bluebird');var logger=require(_0x5e7d('0x1'))(_0x5e7d('0x2'));var client=jayson[_0x5e7d('0x3')][_0x5e7d('0x4')]({'port':0x2329});client[_0x5e7d('0x5')]=function(_0xa30a27,_0x376139){return new BPromise(function(_0x2e2c7d,_0x21d90e){return client[_0x5e7d('0x6')](_0xa30a27,_0x376139)[_0x5e7d('0x7')](function(_0x66721d){logger['debug'](_0x5e7d('0x8'),_0x5e7d('0x2'),_0xa30a27,_0x376139,_0x66721d);if(_0x66721d[_0x5e7d('0x9')]){logger[_0x5e7d('0x9')](_0x5e7d('0x8'),'routing',_0xa30a27,_0x66721d[_0x5e7d('0x9')][_0x5e7d('0xa')],_0x376139);return _0x21d90e(_0x66721d[_0x5e7d('0x9')][_0x5e7d('0xa')]);}else{return _0x2e2c7d(_0x66721d[_0x5e7d('0xb')]);}})['catch'](function(_0x30a659){logger[_0x5e7d('0x9')](_0x5e7d('0x8'),'routing',_0xa30a27,_0x30a659,_0x376139);return _0x21d90e(_0x30a659);});});};module[_0x5e7d('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ff612f6..0556f81 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 _0x388a=['initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals'];(function(_0x2a49e9,_0x5b0194){var _0x383ab4=function(_0x548827){while(--_0x548827){_0x2a49e9['push'](_0x2a49e9['shift']());}};_0x383ab4(++_0x5b0194);}(_0x388a,0x139));var _0xa388=function(_0x1632f8,_0x10d804){_0x1632f8=_0x1632f8-0x0;var _0x5eabdd=_0x388a[_0x1632f8];return _0x5eabdd;};'use strict';var BPromise=require(_0xa388('0x0'));var server=require('./server');var Realtime=require(_0xa388('0x1'));var user=require(_0xa388('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xa388('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xa388('0x4'));var mailQueue=require(_0xa388('0x5'));var faxQueue=require(_0xa388('0x6'));var whatsappQueue=require(_0xa388('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xa388('0x8')]()[_0xa388('0x9')](user[_0xa388('0xa')]())['then'](realtime['initAgents']())[_0xa388('0x9')](interval[_0xa388('0xb')]())[_0xa388('0x9')](realtime[_0xa388('0xc')]())[_0xa388('0x9')](openchannelQueue['getOpenchannelQueues']())[_0xa388('0x9')](realtime[_0xa388('0xd')]())['then'](chatQueue[_0xa388('0xe')]())[_0xa388('0x9')](realtime[_0xa388('0xf')]())[_0xa388('0x9')](smsQueue[_0xa388('0x10')]())['then'](realtime[_0xa388('0x11')]())[_0xa388('0x9')](mailQueue['getMailQueues']())[_0xa388('0x9')](realtime[_0xa388('0x12')]())[_0xa388('0x9')](faxQueue[_0xa388('0x13')]())[_0xa388('0x9')](realtime[_0xa388('0x14')]())[_0xa388('0x9')](whatsappQueue[_0xa388('0x15')]())[_0xa388('0x9')](realtime[_0xa388('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0xa388('0x17')](realtime)[_0xa388('0x9')](function(_0x5b9c5f){return initRealtime();})[_0xa388('0x9')](function(_0xec71f9){return setInterval(initRealtime,0x1388);})[_0xa388('0x18')](function(_0x26a0c8){console['log'](_0x26a0c8);});}main(); \ No newline at end of file +var _0x4c13=['initMailQueues','getFaxQueues','getWhatsappQueues','catch','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues'];(function(_0x382555,_0x23636a){var _0x17efc1=function(_0x41c6cd){while(--_0x41c6cd){_0x382555['push'](_0x382555['shift']());}};_0x17efc1(++_0x23636a);}(_0x4c13,0x94));var _0x34c1=function(_0x3a0e3e,_0x22f06f){_0x3a0e3e=_0x3a0e3e-0x0;var _0x4005bb=_0x4c13[_0x3a0e3e];return _0x4005bb;};'use strict';var BPromise=require(_0x34c1('0x0'));var server=require(_0x34c1('0x1'));var Realtime=require(_0x34c1('0x2'));var user=require('./rpc/user');var interval=require(_0x34c1('0x3'));var openchannelQueue=require(_0x34c1('0x4'));var chatQueue=require(_0x34c1('0x5'));var smsQueue=require(_0x34c1('0x6'));var mailQueue=require(_0x34c1('0x7'));var faxQueue=require(_0x34c1('0x8'));var whatsappQueue=require(_0x34c1('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x34c1('0xa')](user[_0x34c1('0xb')]())[_0x34c1('0xa')](realtime[_0x34c1('0xc')]())[_0x34c1('0xa')](interval[_0x34c1('0xd')]())['then'](realtime[_0x34c1('0xe')]())[_0x34c1('0xa')](openchannelQueue[_0x34c1('0xf')]())[_0x34c1('0xa')](realtime['initOpenchannelQueues']())[_0x34c1('0xa')](chatQueue[_0x34c1('0x10')]())[_0x34c1('0xa')](realtime[_0x34c1('0x11')]())[_0x34c1('0xa')](smsQueue[_0x34c1('0x12')]())[_0x34c1('0xa')](realtime[_0x34c1('0x13')]())[_0x34c1('0xa')](mailQueue['getMailQueues']())[_0x34c1('0xa')](realtime[_0x34c1('0x14')]())[_0x34c1('0xa')](faxQueue[_0x34c1('0x15')]())[_0x34c1('0xa')](realtime['initFaxQueues']())[_0x34c1('0xa')](whatsappQueue[_0x34c1('0x16')]())[_0x34c1('0xa')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x34c1('0xa')](function(_0x1b1dc6){return initRealtime();})['then'](function(_0x4a1556){return setInterval(initRealtime,0x1388);})[_0x34c1('0x17')](function(_0x119cc4){console['log'](_0x119cc4);});}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 6b00be8..8519077 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0xf23ae0,_0x13041f){var _0x441c81=function(_0x3964c9){while(--_0x3964c9){_0xf23ae0['push'](_0xf23ae0['shift']());}};_0x441c81(++_0x13041f);}(_0x326f,0xd1));var _0xf326=function(_0x4f92f9,_0x403d67){_0x4f92f9=_0x4f92f9-0x0;var _0x58692c=_0x326f[_0x4f92f9];return _0x58692c;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x16d7a6,_0x4dac64){var _0x397bc1=function(_0x60f652){while(--_0x60f652){_0x16d7a6['push'](_0x16d7a6['shift']());}};_0x397bc1(++_0x4dac64);}(_0x814b,0x1a2));var _0xb814=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x814b[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index fad8e05..d83eb08 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 _0xe925=['client','http','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x2e8d71,_0x351880){var _0x537e0f=function(_0x20eb7c){while(--_0x20eb7c){_0x2e8d71['push'](_0x2e8d71['shift']());}};_0x537e0f(++_0x351880);}(_0xe925,0x1b8));var _0x5e92=function(_0x51fd98,_0x2a355d){_0x51fd98=_0x51fd98-0x0;var _0x33d2bd=_0xe925[_0x51fd98];return _0x33d2bd;};'use strict';var BPromise=require(_0x5e92('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x5e92('0x1')][_0x5e92('0x2')]({'port':0x232b});function request(_0x493c1e,_0x2eef9c){return new BPromise(function(_0x1f1463,_0x346632){return client['request'](_0x493c1e,_0x2eef9c)['then'](function(_0xabce57){if(_0xabce57['error']){return _0x346632(_0xabce57[_0x5e92('0x3')][_0x5e92('0x4')]);}else{return _0x1f1463(_0xabce57[_0x5e92('0x5')]);}})[_0x5e92('0x6')](function(_0x3a0c2c){return _0x346632(_0x3a0c2c);});});}exports[_0x5e92('0x7')]=function(_0x4f07f4,_0x2f076b){return request(_0x5e92('0x8'),{'account':_0x4f07f4,'message':_0x2f076b});}; \ No newline at end of file +var _0xbcff=['http','error','message','catch','SendMail','bluebird','jayson/promise','client'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xbcff,0x16d));var _0xfbcf=function(_0x9875a2,_0x4dd13c){_0x9875a2=_0x9875a2-0x0;var _0x4bc357=_0xbcff[_0x9875a2];return _0x4bc357;};'use strict';var BPromise=require(_0xfbcf('0x0'));var jayson=require(_0xfbcf('0x1'));var client=jayson[_0xfbcf('0x2')][_0xfbcf('0x3')]({'port':0x232b});function request(_0x5c0f51,_0x4d0c68){return new BPromise(function(_0x1d37c4,_0x576ddb){return client['request'](_0x5c0f51,_0x4d0c68)['then'](function(_0x1788c6){if(_0x1788c6[_0xfbcf('0x4')]){return _0x576ddb(_0x1788c6[_0xfbcf('0x4')][_0xfbcf('0x5')]);}else{return _0x1d37c4(_0x1788c6['result']);}})[_0xfbcf('0x6')](function(_0x29100d){return _0x576ddb(_0x29100d);});});}exports['sendMailMessage']=function(_0x31d55a,_0xf7bcb3){return request(_0xfbcf('0x7'),{'account':_0x31d55a,'message':_0xf7bcb3});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 9e1c407..58d42ee 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 _0xc6ac=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','fax','sms','length','StatusTime','toNumber','format','chatCurrentCapacity','mailCapacity','smsStatusTime','stringify','emit','user:routing:update','omit','exports','lodash','md5','moment'];(function(_0x80f729,_0x510c4c){var _0xa3df8b=function(_0x65912f){while(--_0x65912f){_0x80f729['push'](_0x80f729['shift']());}};_0xa3df8b(++_0x510c4c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2498a1,_0x55ecee){_0x2498a1=_0x2498a1-0x0;var _0x25e94f=_0xc6ac[_0x2498a1];return _0x25e94f;};'use strict';var _=require(_0xcc6a('0x0'));var md5=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var Redis=require(_0xcc6a('0x3'));var config=require(_0xcc6a('0x4'));config[_0xcc6a('0x5')]=_[_0xcc6a('0x6')](config[_0xcc6a('0x5')],{'host':_0xcc6a('0x7'),'port':0x18eb});var io=require(_0xcc6a('0x8'))(new Redis(config[_0xcc6a('0x5')]));function Agent(_0x188b05){this['id']=_0x188b05['id']||0x0;this[_0xcc6a('0x9')]=_0x188b05[_0xcc6a('0x9')]||'';this['online']=_0x188b05[_0xcc6a('0xa')]||!![];this[_0xcc6a('0xb')]=_0x188b05[_0xcc6a('0xb')]||![];this['chatPause']=_0x188b05[_0xcc6a('0xc')]||![];this[_0xcc6a('0xd')]=_0x188b05[_0xcc6a('0xd')]||![];this[_0xcc6a('0xe')]=_0x188b05[_0xcc6a('0xe')]||![];this['smsPause']=_0x188b05[_0xcc6a('0xf')]||![];this[_0xcc6a('0x10')]=_0x188b05[_0xcc6a('0x10')]||![];this['chatStatus']=_0xcc6a('0x11');this[_0xcc6a('0x12')]=0x0;this[_0xcc6a('0x13')]=_0x188b05['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xcc6a('0x14')]=_0xcc6a('0x11');this[_0xcc6a('0x15')]=0x0;this['mailCapacity']=_0x188b05['mailCapacity']||0x0;this[_0xcc6a('0x16')]=0x0;this[_0xcc6a('0x17')]=_0xcc6a('0x11');this[_0xcc6a('0x18')]=0x0;this[_0xcc6a('0x19')]=_0x188b05[_0xcc6a('0x19')]||0x0;this[_0xcc6a('0x1a')]=0x0;this[_0xcc6a('0x1b')]='unknown';this['smsStatusTime']=0x0;this['smsCapacity']=_0x188b05[_0xcc6a('0x1c')]||0x0;this[_0xcc6a('0x1d')]=0x0;this[_0xcc6a('0x1e')]=_0xcc6a('0x11');this[_0xcc6a('0x1f')]=0x0;this[_0xcc6a('0x20')]=_0x188b05[_0xcc6a('0x20')]||0x0;this[_0xcc6a('0x21')]=0x0;this[_0xcc6a('0x22')]=_0xcc6a('0x11');this[_0xcc6a('0x23')]=0x0;this['openchannelCapacity']=_0x188b05[_0xcc6a('0x24')]||0x0;this[_0xcc6a('0x25')]=0x0;this[_0xcc6a('0x26')]=![];this[_0xcc6a('0x27')]=undefined;this[_0xcc6a('0x1')]='';this[_0xcc6a('0x28')]={};this[_0xcc6a('0x29')]={};this[_0xcc6a('0x2a')]={};this[_0xcc6a('0x2b')]={};this[_0xcc6a('0x2c')]={};this[_0xcc6a('0x2d')]={};this[_0xcc6a('0x2e')]();}Agent['prototype'][_0xcc6a('0x2f')]=function(_0x3a081e){if(this[_0x3a081e+_0xcc6a('0x30')]>0x0){if(this[_0x3a081e+'Capacity']>0x0&&this[_0x3a081e+_0xcc6a('0x30')]>=this[_0x3a081e+_0xcc6a('0x31')]){return _0xcc6a('0x32');}else{return _0xcc6a('0x33');}}else{return _0xcc6a('0x34');}};Agent[_0xcc6a('0x35')]['updateRealtime']=function(){var _0x26def8=[_0xcc6a('0x36'),_0xcc6a('0x37'),'openchannel',_0xcc6a('0x38'),_0xcc6a('0x39'),'whatsapp'];for(var _0xb377de=0x0;_0xb377de<_0x26def8[_0xcc6a('0x3a')];_0xb377de+=0x1){var _0x3233d1=this[_0xcc6a('0x2f')](_0x26def8[_0xb377de]);if(this[_0x26def8[_0xb377de]+'Status']!==_0x3233d1){this[_0x26def8[_0xb377de]+_0xcc6a('0x3b')]=_[_0xcc6a('0x3c')](moment()[_0xcc6a('0x3d')]('x'));}this[_0x26def8[_0xb377de]+'Status']=_0x3233d1;}var _0x2590a2={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xcc6a('0xb')],'chatPause':this[_0xcc6a('0xc')],'mailPause':this[_0xcc6a('0xd')],'smsPause':this[_0xcc6a('0xf')],'faxPause':this[_0xcc6a('0xe')],'openchannelPause':this[_0xcc6a('0x10')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xcc6a('0x12')],'chatCapacity':this[_0xcc6a('0x13')],'chatCurrentCapacity':this[_0xcc6a('0x3e')],'mailStatus':this[_0xcc6a('0x14')],'mailStatusTime':this[_0xcc6a('0x15')],'mailCapacity':this[_0xcc6a('0x3f')],'mailCurrentCapacity':this[_0xcc6a('0x16')],'faxStatus':this[_0xcc6a('0x17')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xcc6a('0x19')],'faxCurrentCapacity':this[_0xcc6a('0x1a')],'smsStatus':this[_0xcc6a('0x1b')],'smsStatusTime':this[_0xcc6a('0x40')],'smsCapacity':this[_0xcc6a('0x1c')],'smsCurrentCapacity':this[_0xcc6a('0x1d')],'whatsappStatus':this[_0xcc6a('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xcc6a('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xcc6a('0x24')],'openchannelCurrentCapacity':this[_0xcc6a('0x25')],'busy':this[_0xcc6a('0x26')],'busyQueue':this[_0xcc6a('0x27')],'chatWaitingInteractions':this[_0xcc6a('0x28')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xcc6a('0x2b')],'smsWaitingInteractions':this[_0xcc6a('0x2c')],'whatsappWaitingInteractions':this[_0xcc6a('0x2d')]};var _0x538ea5=md5(JSON[_0xcc6a('0x41')](_0x2590a2));if(this[_0xcc6a('0x1')]!==_0x538ea5){this[_0xcc6a('0x1')]=_0x538ea5;io[_0xcc6a('0x42')](_0xcc6a('0x43'),_[_0xcc6a('0x44')](_0x2590a2,[_0xcc6a('0xa')]));}};module[_0xcc6a('0x45')]=Agent; \ No newline at end of file +var _0x958a=['openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','chatPause','mailCurrentCapacity','faxStatusTime','whatsappStatus','whatsappStatusTime','whatsappCurrentCapacity','busyQueue','mailWaitingInteractions','whatsappWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','chatWaitingInteractions','faxWaitingInteractions'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0x958a,0x128));var _0xa958=function(_0x552026,_0x456ebb){_0x552026=_0x552026-0x0;var _0x212108=_0x958a[_0x552026];return _0x212108;};'use strict';var _=require(_0xa958('0x0'));var md5=require(_0xa958('0x1'));var moment=require('moment');var Redis=require(_0xa958('0x2'));var config=require(_0xa958('0x3'));config[_0xa958('0x4')]=_[_0xa958('0x5')](config[_0xa958('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xa958('0x6'))(new Redis(config['redis']));function Agent(_0x2024b8){this['id']=_0x2024b8['id']||0x0;this[_0xa958('0x7')]=_0x2024b8[_0xa958('0x7')]||'';this[_0xa958('0x8')]=_0x2024b8[_0xa958('0x8')]||!![];this[_0xa958('0x9')]=_0x2024b8[_0xa958('0x9')]||![];this['chatPause']=_0x2024b8['chatPause']||![];this[_0xa958('0xa')]=_0x2024b8[_0xa958('0xa')]||![];this[_0xa958('0xb')]=_0x2024b8[_0xa958('0xb')]||![];this[_0xa958('0xc')]=_0x2024b8[_0xa958('0xc')]||![];this[_0xa958('0xd')]=_0x2024b8[_0xa958('0xd')]||![];this[_0xa958('0xe')]=_0xa958('0xf');this[_0xa958('0x10')]=0x0;this[_0xa958('0x11')]=_0x2024b8[_0xa958('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']='unknown';this[_0xa958('0x12')]=0x0;this[_0xa958('0x13')]=_0x2024b8[_0xa958('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xa958('0x14')]='unknown';this['faxStatusTime']=0x0;this['faxCapacity']=_0x2024b8[_0xa958('0x15')]||0x0;this[_0xa958('0x16')]=0x0;this[_0xa958('0x17')]=_0xa958('0xf');this[_0xa958('0x18')]=0x0;this[_0xa958('0x19')]=_0x2024b8[_0xa958('0x19')]||0x0;this[_0xa958('0x1a')]=0x0;this['whatsappStatus']=_0xa958('0xf');this['whatsappStatusTime']=0x0;this[_0xa958('0x1b')]=_0x2024b8[_0xa958('0x1b')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xa958('0x1c')]=_0xa958('0xf');this[_0xa958('0x1d')]=0x0;this[_0xa958('0x1e')]=_0x2024b8[_0xa958('0x1e')]||0x0;this[_0xa958('0x1f')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0xa958('0x1')]='';this[_0xa958('0x20')]={};this[_0xa958('0x21')]={};this['mailWaitingInteractions']={};this[_0xa958('0x22')]={};this[_0xa958('0x23')]={};this['whatsappWaitingInteractions']={};this[_0xa958('0x24')]();}Agent[_0xa958('0x25')]['getChannelStatus']=function(_0x5c5a2b){if(this[_0x5c5a2b+_0xa958('0x26')]>0x0){if(this[_0x5c5a2b+_0xa958('0x27')]>0x0&&this[_0x5c5a2b+'CurrentCapacity']>=this[_0x5c5a2b+_0xa958('0x27')]){return _0xa958('0x28');}else{return _0xa958('0x29');}}else{return _0xa958('0x2a');}};Agent[_0xa958('0x25')][_0xa958('0x24')]=function(){var _0x50fdb1=[_0xa958('0x2b'),'chat',_0xa958('0x2c'),_0xa958('0x2d'),_0xa958('0x2e'),_0xa958('0x2f')];for(var _0x21541f=0x0;_0x21541f<_0x50fdb1[_0xa958('0x30')];_0x21541f+=0x1){var _0x2c970b=this[_0xa958('0x31')](_0x50fdb1[_0x21541f]);if(this[_0x50fdb1[_0x21541f]+_0xa958('0x32')]!==_0x2c970b){this[_0x50fdb1[_0x21541f]+_0xa958('0x33')]=_['toNumber'](moment()['format']('x'));}this[_0x50fdb1[_0x21541f]+_0xa958('0x32')]=_0x2c970b;}var _0x4ef4f6={'id':this['id'],'name':this[_0xa958('0x7')],'online':this[_0xa958('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0xa958('0x34')],'mailPause':this[_0xa958('0xa')],'smsPause':this[_0xa958('0xc')],'faxPause':this[_0xa958('0xb')],'openchannelPause':this[_0xa958('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xa958('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xa958('0x12')],'mailCapacity':this[_0xa958('0x13')],'mailCurrentCapacity':this[_0xa958('0x35')],'faxStatus':this[_0xa958('0x14')],'faxStatusTime':this[_0xa958('0x36')],'faxCapacity':this[_0xa958('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xa958('0x17')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xa958('0x1a')],'whatsappStatus':this[_0xa958('0x37')],'whatsappStatusTime':this[_0xa958('0x38')],'whatsappCapacity':this[_0xa958('0x1b')],'whatsappCurrentCapacity':this[_0xa958('0x39')],'openchannelStatus':this[_0xa958('0x1c')],'openchannelStatusTime':this[_0xa958('0x1d')],'openchannelCapacity':this[_0xa958('0x1e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0xa958('0x3a')],'chatWaitingInteractions':this[_0xa958('0x20')],'faxWaitingInteractions':this[_0xa958('0x21')],'mailWaitingInteractions':this[_0xa958('0x3b')],'openchannelWaitingInteractions':this[_0xa958('0x22')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xa958('0x3c')]};var _0x3d7802=md5(JSON[_0xa958('0x3d')](_0x4ef4f6));if(this[_0xa958('0x1')]!==_0x3d7802){this['md5']=_0x3d7802;io[_0xa958('0x3e')](_0xa958('0x3f'),_[_0xa958('0x40')](_0x4ef4f6,[_0xa958('0x8')]));}};module[_0xa958('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index f81b874..f0eb650 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 _0xe270=['paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','loggedIn'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe270,0x1dd));var _0x0e27=function(_0x2d4501,_0x328b79){_0x2d4501=_0x2d4501-0x0;var _0x4725b4=_0xe270[_0x2d4501];return _0x4725b4;};'use strict';var _=require(_0x0e27('0x0'));var md5=require(_0x0e27('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x0e27('0x2'));config['redis']=_[_0x0e27('0x3')](config[_0x0e27('0x4')],{'host':_0x0e27('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0e27('0x4')]));function ChatQueue(_0x1f4eb1){this['id']=_0x1f4eb1['id']||0x0;this[_0x0e27('0x6')]=_0x1f4eb1[_0x0e27('0x6')]||'';this[_0x0e27('0x7')]=_0x1f4eb1['timeout']||0xa;this[_0x0e27('0x8')]=_0x1f4eb1[_0x0e27('0x8')]||_0x0e27('0x9');this[_0x0e27('0xa')]=_0x1f4eb1['Agents'];this[_0x0e27('0xb')]={};this[_0x0e27('0xc')]=0x0;this[_0x0e27('0x1')]='';this[_0x0e27('0xd')]();this[_0x0e27('0xe')]();}ChatQueue[_0x0e27('0xf')][_0x0e27('0xd')]=function(){var _0x47c8c0=this[_0x0e27('0xb')]['_rr'];this[_0x0e27('0xb')]=_['map'](this[_0x0e27('0xa')],'id');this[_0x0e27('0xb')]['_rr']=_0x47c8c0;};ChatQueue[_0x0e27('0xf')]['updateRealtime']=function(){this[_0x0e27('0x10')]=0x0;this[_0x0e27('0x11')]=0x0;for(var _0x1f14b8=0x0;_0x1f14b8=0x0?this['available']:0x0;var _0x32ed99={'id':this['id'],'available':this[_0x0e27('0x14')],'loggedIn':this[_0x0e27('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x0e27('0xc')]};var _0x20d713=md5(JSON[_0x0e27('0x15')](_0x32ed99));if(this[_0x0e27('0x1')]!==_0x20d713){this[_0x0e27('0x1')]=_0x20d713;io['to'](util[_0x0e27('0x16')](_0x0e27('0x17'),_0x32ed99[_0x0e27('0x6')]))[_0x0e27('0x18')](_0x0e27('0x19'),_0x32ed99);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x8e42=['updateRouting','mapAgentsId','map','_rr','updateRealtime','paused','online','chatPause','available','loggedIn','waiting','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','prototype'];(function(_0x361be1,_0x2a3ddc){var _0x2213bc=function(_0x320f6e){while(--_0x320f6e){_0x361be1['push'](_0x361be1['shift']());}};_0x2213bc(++_0x2a3ddc);}(_0x8e42,0x127));var _0x28e4=function(_0x5e5f5a,_0x5cb19a){_0x5e5f5a=_0x5e5f5a-0x0;var _0x4141ae=_0x8e42[_0x5e5f5a];return _0x4141ae;};'use strict';var _=require(_0x28e4('0x0'));var md5=require(_0x28e4('0x1'));var util=require(_0x28e4('0x2'));var Redis=require(_0x28e4('0x3'));var config=require(_0x28e4('0x4'));config[_0x28e4('0x5')]=_[_0x28e4('0x6')](config[_0x28e4('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x28e4('0x7'))(new Redis(config[_0x28e4('0x5')]));function ChatQueue(_0x37a7b7){this['id']=_0x37a7b7['id']||0x0;this[_0x28e4('0x8')]=_0x37a7b7[_0x28e4('0x8')]||'';this[_0x28e4('0x9')]=_0x37a7b7[_0x28e4('0x9')]||0xa;this[_0x28e4('0xa')]=_0x37a7b7[_0x28e4('0xa')]||'beepall';this[_0x28e4('0xb')]=_0x37a7b7[_0x28e4('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x28e4('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x28e4('0xc')][_0x28e4('0xd')]=function(){var _0x5432d8=this[_0x28e4('0xe')]['_rr'];this['mapAgentsId']=_[_0x28e4('0xf')](this[_0x28e4('0xb')],'id');this[_0x28e4('0xe')][_0x28e4('0x10')]=_0x5432d8;};ChatQueue['prototype'][_0x28e4('0x11')]=function(){this['loggedIn']=0x0;this[_0x28e4('0x12')]=0x0;for(var _0xe6b533=0x0;_0xe6b533=0x0?this[_0x28e4('0x15')]:0x0;var _0x7223a1={'id':this['id'],'available':this[_0x28e4('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x28e4('0x8')],'paused':this[_0x28e4('0x12')],'waiting':this[_0x28e4('0x17')]};var _0x3fe3b6=md5(JSON['stringify'](_0x7223a1));if(this[_0x28e4('0x1')]!==_0x3fe3b6){this[_0x28e4('0x1')]=_0x3fe3b6;io['to'](util[_0x28e4('0x18')](_0x28e4('0x19'),_0x7223a1['name']))['emit'](_0x28e4('0x1a'),_0x7223a1);}};module[_0x28e4('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 7c2d508..7022351 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 _0x58d8=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','faxPause','paused','available','format','emit','fax_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x565577,_0x34555d){var _0x3c6b98=function(_0x524a3c){while(--_0x524a3c){_0x565577['push'](_0x565577['shift']());}};_0x3c6b98(++_0x34555d);}(_0x58d8,0x1a0));var _0x858d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x58d8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x858d('0x0'));var md5=require(_0x858d('0x1'));var util=require(_0x858d('0x2'));var Redis=require(_0x858d('0x3'));var config=require('../../../config/environment');config[_0x858d('0x4')]=_[_0x858d('0x5')](config[_0x858d('0x4')],{'host':_0x858d('0x6'),'port':0x18eb});var io=require(_0x858d('0x7'))(new Redis(config[_0x858d('0x4')]));function FaxQueue(_0x26a368){this['id']=_0x26a368['id']||0x0;this[_0x858d('0x8')]=_0x26a368[_0x858d('0x8')]||'';this['timeout']=_0x26a368[_0x858d('0x9')]||0xa;this[_0x858d('0xa')]=_0x26a368[_0x858d('0xa')]||_0x858d('0xb');this[_0x858d('0xc')]=_0x26a368[_0x858d('0xc')];this['mapAgentsId']={};this[_0x858d('0xd')]=0x0;this[_0x858d('0x1')]='';this[_0x858d('0xe')]();this[_0x858d('0xf')]();}FaxQueue[_0x858d('0x10')][_0x858d('0xe')]=function(){var _0x518bae=this[_0x858d('0x11')][_0x858d('0x12')];this[_0x858d('0x11')]=_[_0x858d('0x13')](this[_0x858d('0xc')],'id');this[_0x858d('0x11')][_0x858d('0x12')]=_0x518bae;};FaxQueue[_0x858d('0x10')][_0x858d('0xf')]=function(){this[_0x858d('0x14')]=0x0;this['paused']=0x0;for(var _0x1f59b2=0x0;_0x1f59b2=0x0?this[_0x858d('0x17')]:0x0;var _0x2b225d={'id':this['id'],'available':this[_0x858d('0x17')],'loggedIn':this[_0x858d('0x14')],'name':this[_0x858d('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x4b8f8e=md5(JSON['stringify'](_0x2b225d));if(this[_0x858d('0x1')]!==_0x4b8f8e){this['md5']=_0x4b8f8e;io['to'](util[_0x858d('0x18')]('fax:queue:%s',_0x2b225d['name']))[_0x858d('0x19')](_0x858d('0x1a'),_0x2b225d);}};module[_0x858d('0x1b')]=FaxQueue; \ No newline at end of file +var _0xb3a9=['fax_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','length','faxPause','paused','available','stringify','format','fax:queue:%s','emit'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xb3a9,0x17a));var _0x9b3a=function(_0x46b3e5,_0x563e8f){_0x46b3e5=_0x46b3e5-0x0;var _0x4e82e9=_0xb3a9[_0x46b3e5];return _0x4e82e9;};'use strict';var _=require(_0x9b3a('0x0'));var md5=require(_0x9b3a('0x1'));var util=require('util');var Redis=require(_0x9b3a('0x2'));var config=require(_0x9b3a('0x3'));config[_0x9b3a('0x4')]=_[_0x9b3a('0x5')](config[_0x9b3a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x9b3a('0x6'))(new Redis(config[_0x9b3a('0x4')]));function FaxQueue(_0x3a9db2){this['id']=_0x3a9db2['id']||0x0;this['name']=_0x3a9db2[_0x9b3a('0x7')]||'';this[_0x9b3a('0x8')]=_0x3a9db2[_0x9b3a('0x8')]||0xa;this[_0x9b3a('0x9')]=_0x3a9db2['strategy']||_0x9b3a('0xa');this['Agents']=_0x3a9db2[_0x9b3a('0xb')];this['mapAgentsId']={};this[_0x9b3a('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x9b3a('0xd')]();}FaxQueue[_0x9b3a('0xe')][_0x9b3a('0xf')]=function(){var _0x4f42c4=this[_0x9b3a('0x10')][_0x9b3a('0x11')];this['mapAgentsId']=_[_0x9b3a('0x12')](this[_0x9b3a('0xb')],'id');this[_0x9b3a('0x10')][_0x9b3a('0x11')]=_0x4f42c4;};FaxQueue['prototype'][_0x9b3a('0xd')]=function(){this[_0x9b3a('0x13')]=0x0;this['paused']=0x0;for(var _0x519790=0x0;_0x519790=0x0?this[_0x9b3a('0x17')]:0x0;var _0x1620ba={'id':this['id'],'available':this[_0x9b3a('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x9b3a('0x7')],'paused':this[_0x9b3a('0x16')],'waiting':this[_0x9b3a('0xc')]};var _0x17629d=md5(JSON[_0x9b3a('0x18')](_0x1620ba));if(this[_0x9b3a('0x1')]!==_0x17629d){this[_0x9b3a('0x1')]=_0x17629d;io['to'](util[_0x9b3a('0x19')](_0x9b3a('0x1a'),_0x1620ba[_0x9b3a('0x7')]))[_0x9b3a('0x1b')](_0x9b3a('0x1c'),_0x1620ba);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 97cedc9..f32e967 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 _0x1c44=['name','Intervals'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x1c44,0xf4));var _0x41c4=function(_0x444432,_0x8279f7){_0x444432=_0x444432-0x0;var _0x4bacbb=_0x1c44[_0x444432];return _0x4bacbb;};'use strict';function Interval(_0x1affc6){this['id']=_0x1affc6['id']||0x0;this[_0x41c4('0x0')]=_0x1affc6['name']||'';this[_0x41c4('0x1')]=_0x1affc6[_0x41c4('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xeac4=['name','Intervals'];(function(_0xb4478,_0x2da56e){var _0x244278=function(_0x4e6d48){while(--_0x4e6d48){_0xb4478['push'](_0xb4478['shift']());}};_0x244278(++_0x2da56e);}(_0xeac4,0xd0));var _0x4eac=function(_0x2f3f72,_0x49057e){_0x2f3f72=_0x2f3f72-0x0;var _0x31f206=_0xeac4[_0x2f3f72];return _0x31f206;};'use strict';function Interval(_0x32f70f){this['id']=_0x32f70f['id']||0x0;this[_0x4eac('0x0')]=_0x32f70f[_0x4eac('0x0')]||'';this[_0x4eac('0x1')]=_0x32f70f['Intervals']||{};}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 ba6fd94..089950e 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 _0x1af8=['md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1af8,0x13e));var _0x81af=function(_0x384ff6,_0x46aa64){_0x384ff6=_0x384ff6-0x0;var _0x19e674=_0x1af8[_0x384ff6];return _0x19e674;};'use strict';var _=require(_0x81af('0x0'));var md5=require(_0x81af('0x1'));var util=require(_0x81af('0x2'));var Redis=require(_0x81af('0x3'));var config=require(_0x81af('0x4'));config[_0x81af('0x5')]=_['defaults'](config['redis'],{'host':_0x81af('0x6'),'port':0x18eb});var io=require(_0x81af('0x7'))(new Redis(config[_0x81af('0x5')]));function MailQueue(_0x50f1eb){this['id']=_0x50f1eb['id']||0x0;this[_0x81af('0x8')]=_0x50f1eb[_0x81af('0x8')]||'';this['timeout']=_0x50f1eb[_0x81af('0x9')]||0xa;this['strategy']=_0x50f1eb[_0x81af('0xa')]||_0x81af('0xb');this[_0x81af('0xc')]=_0x50f1eb[_0x81af('0xc')];this[_0x81af('0xd')]={};this[_0x81af('0xe')]=0x0;this[_0x81af('0x1')]='';this[_0x81af('0xf')]();this['updateRealtime']();}MailQueue['prototype'][_0x81af('0xf')]=function(){var _0x22590c=this[_0x81af('0xd')][_0x81af('0x10')];this[_0x81af('0xd')]=_[_0x81af('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x81af('0x10')]=_0x22590c;};MailQueue[_0x81af('0x12')][_0x81af('0x13')]=function(){this[_0x81af('0x14')]=0x0;this[_0x81af('0x15')]=0x0;for(var _0x458ee2=0x0;_0x458ee2=0x0?this['available']:0x0;var _0xad3f6b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x81af('0x14')],'name':this[_0x81af('0x8')],'paused':this['paused'],'waiting':this[_0x81af('0xe')]};var _0x21f1eb=md5(JSON[_0x81af('0x1a')](_0xad3f6b));if(this[_0x81af('0x1')]!==_0x21f1eb){this[_0x81af('0x1')]=_0x21f1eb;io['to'](util[_0x81af('0x1b')](_0x81af('0x1c'),_0xad3f6b[_0x81af('0x8')]))['emit']('mail_queue:save',_0xad3f6b);}};module['exports']=MailQueue; \ No newline at end of file +var _0xeba8=['mail:queue:%s','emit','mail_queue:save','lodash','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','paused','length','loggedIn','mailPause','available','md5','format'];(function(_0x3ce5ab,_0x2d7de6){var _0x194b25=function(_0xf81d8f){while(--_0xf81d8f){_0x3ce5ab['push'](_0x3ce5ab['shift']());}};_0x194b25(++_0x2d7de6);}(_0xeba8,0x1f1));var _0x8eba=function(_0x45977c,_0x7eaed0){_0x45977c=_0x45977c-0x0;var _0x399413=_0xeba8[_0x45977c];return _0x399413;};'use strict';var _=require(_0x8eba('0x0'));var md5=require('md5');var util=require(_0x8eba('0x1'));var Redis=require(_0x8eba('0x2'));var config=require(_0x8eba('0x3'));config['redis']=_['defaults'](config[_0x8eba('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8eba('0x5'))(new Redis(config[_0x8eba('0x4')]));function MailQueue(_0xcffd8b){this['id']=_0xcffd8b['id']||0x0;this[_0x8eba('0x6')]=_0xcffd8b[_0x8eba('0x6')]||'';this['timeout']=_0xcffd8b['timeout']||0xa;this[_0x8eba('0x7')]=_0xcffd8b[_0x8eba('0x7')]||_0x8eba('0x8');this[_0x8eba('0x9')]=_0xcffd8b[_0x8eba('0x9')];this[_0x8eba('0xa')]={};this[_0x8eba('0xb')]=0x0;this['md5']='';this[_0x8eba('0xc')]();this['updateRealtime']();}MailQueue[_0x8eba('0xd')][_0x8eba('0xc')]=function(){var _0x5ceb86=this['mapAgentsId'][_0x8eba('0xe')];this[_0x8eba('0xa')]=_[_0x8eba('0xf')](this[_0x8eba('0x9')],'id');this[_0x8eba('0xa')]['_rr']=_0x5ceb86;};MailQueue[_0x8eba('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x8eba('0x10')]=0x0;for(var _0x1e9fca=0x0;_0x1e9fca=0x0?this[_0x8eba('0x14')]:0x0;var _0x42c847={'id':this['id'],'available':this[_0x8eba('0x14')],'loggedIn':this[_0x8eba('0x12')],'name':this[_0x8eba('0x6')],'paused':this[_0x8eba('0x10')],'waiting':this['waiting']};var _0x3561bd=md5(JSON['stringify'](_0x42c847));if(this['md5']!==_0x3561bd){this[_0x8eba('0x15')]=_0x3561bd;io['to'](util[_0x8eba('0x16')](_0x8eba('0x17'),_0x42c847[_0x8eba('0x6')]))[_0x8eba('0x18')](_0x8eba('0x19'),_0x42c847);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 4be3633..0f210fd 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 _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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc4aa[_0x346737];return _0x1ade2e;};'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 +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(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x7a54,0x106));var _0x47a5=function(_0xea0b92,_0x426e32){_0xea0b92=_0xea0b92-0x0;var _0x281e50=_0x7a54[_0xea0b92];return _0x281e50;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 4c12a2e..c613d4c 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 _0xa7b4=['redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','loggedIn','paused','length','online','smsPause','available','format','emit','sms_queue:save','md5','util','../../../config/environment'];(function(_0x7428cd,_0x1a1b89){var _0x5a2b8e=function(_0x580470){while(--_0x580470){_0x7428cd['push'](_0x7428cd['shift']());}};_0x5a2b8e(++_0x1a1b89);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x12fad5,_0x1fe693){_0x12fad5=_0x12fad5-0x0;var _0x27a1ab=_0xa7b4[_0x12fad5];return _0x27a1ab;};'use strict';var _=require('lodash');var md5=require(_0x4a7b('0x0'));var util=require(_0x4a7b('0x1'));var Redis=require('ioredis');var config=require(_0x4a7b('0x2'));config[_0x4a7b('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4a7b('0x4'))(new Redis(config[_0x4a7b('0x3')]));function SmsQueue(_0x5b5038){this['id']=_0x5b5038['id']||0x0;this[_0x4a7b('0x5')]=_0x5b5038[_0x4a7b('0x5')]||'';this[_0x4a7b('0x6')]=_0x5b5038[_0x4a7b('0x6')]||0xa;this[_0x4a7b('0x7')]=_0x5b5038[_0x4a7b('0x7')]||_0x4a7b('0x8');this[_0x4a7b('0x9')]=_0x5b5038[_0x4a7b('0x9')];this[_0x4a7b('0xa')]={};this[_0x4a7b('0xb')]=0x0;this[_0x4a7b('0x0')]='';this[_0x4a7b('0xc')]();this['updateRealtime']();}SmsQueue[_0x4a7b('0xd')]['updateRouting']=function(){var _0x1eaaf9=this[_0x4a7b('0xa')][_0x4a7b('0xe')];this[_0x4a7b('0xa')]=_['map'](this['Agents'],'id');this[_0x4a7b('0xa')][_0x4a7b('0xe')]=_0x1eaaf9;};SmsQueue['prototype']['updateRealtime']=function(){this[_0x4a7b('0xf')]=0x0;this[_0x4a7b('0x10')]=0x0;for(var _0x304264=0x0;_0x304264=0x0?this['available']:0x0;var _0x556151={'id':this['id'],'available':this[_0x4a7b('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4a7b('0xb')]};var _0x1d6f8d=md5(JSON['stringify'](_0x556151));if(this['md5']!==_0x1d6f8d){this[_0x4a7b('0x0')]=_0x1d6f8d;io['to'](util[_0x4a7b('0x15')]('sms:queue:%s',_0x556151[_0x4a7b('0x5')]))[_0x4a7b('0x16')](_0x4a7b('0x17'),_0x556151);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xf120=['format','sms_queue:save','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','smsPause','available'];(function(_0xc0bde9,_0x355373){var _0x3483f9=function(_0x5820a2){while(--_0x5820a2){_0xc0bde9['push'](_0xc0bde9['shift']());}};_0x3483f9(++_0x355373);}(_0xf120,0x179));var _0x0f12=function(_0x134c78,_0x4968ac){_0x134c78=_0x134c78-0x0;var _0x3999aa=_0xf120[_0x134c78];return _0x3999aa;};'use strict';var _=require('lodash');var md5=require(_0x0f12('0x0'));var util=require(_0x0f12('0x1'));var Redis=require(_0x0f12('0x2'));var config=require('../../../config/environment');config[_0x0f12('0x3')]=_[_0x0f12('0x4')](config[_0x0f12('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x0f12('0x5'))(new Redis(config[_0x0f12('0x3')]));function SmsQueue(_0x2dbf82){this['id']=_0x2dbf82['id']||0x0;this[_0x0f12('0x6')]=_0x2dbf82[_0x0f12('0x6')]||'';this[_0x0f12('0x7')]=_0x2dbf82[_0x0f12('0x7')]||0xa;this[_0x0f12('0x8')]=_0x2dbf82['strategy']||_0x0f12('0x9');this['Agents']=_0x2dbf82[_0x0f12('0xa')];this[_0x0f12('0xb')]={};this[_0x0f12('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x0f12('0xd')]();}SmsQueue[_0x0f12('0xe')][_0x0f12('0xf')]=function(){var _0xd85187=this[_0x0f12('0xb')][_0x0f12('0x10')];this[_0x0f12('0xb')]=_['map'](this[_0x0f12('0xa')],'id');this[_0x0f12('0xb')][_0x0f12('0x10')]=_0xd85187;};SmsQueue[_0x0f12('0xe')][_0x0f12('0xd')]=function(){this[_0x0f12('0x11')]=0x0;this[_0x0f12('0x12')]=0x0;for(var _0x7f1ae7=0x0;_0x7f1ae7=0x0?this[_0x0f12('0x16')]:0x0;var _0x60daff={'id':this['id'],'available':this[_0x0f12('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x0f12('0x6')],'paused':this['paused'],'waiting':this[_0x0f12('0xc')]};var _0x56c1f1=md5(JSON['stringify'](_0x60daff));if(this[_0x0f12('0x0')]!==_0x56c1f1){this[_0x0f12('0x0')]=_0x56c1f1;io['to'](util[_0x0f12('0x17')]('sms:queue:%s',_0x60daff[_0x0f12('0x6')]))['emit'](_0x0f12('0x18'),_0x60daff);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 5ed7337..9c4017c 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 _0x6474=['whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','md5','prototype','updateRouting','map','_rr','updateRealtime','loggedIn','paused','online','whatsappPause','available','waiting','stringify','whatsapp:queue:%s','emit'];(function(_0x29ba73,_0x541c39){var _0x172149=function(_0x295aeb){while(--_0x295aeb){_0x29ba73['push'](_0x29ba73['shift']());}};_0x172149(++_0x541c39);}(_0x6474,0xa9));var _0x4647=function(_0x308f23,_0x205adb){_0x308f23=_0x308f23-0x0;var _0x546871=_0x6474[_0x308f23];return _0x546871;};'use strict';var _=require(_0x4647('0x0'));var md5=require('md5');var util=require(_0x4647('0x1'));var Redis=require(_0x4647('0x2'));var config=require(_0x4647('0x3'));config[_0x4647('0x4')]=_[_0x4647('0x5')](config[_0x4647('0x4')],{'host':_0x4647('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x48e4df){this['id']=_0x48e4df['id']||0x0;this[_0x4647('0x7')]=_0x48e4df[_0x4647('0x7')]||'';this[_0x4647('0x8')]=_0x48e4df[_0x4647('0x8')]||0xa;this[_0x4647('0x9')]=_0x48e4df['strategy']||'beepall';this[_0x4647('0xa')]=_0x48e4df['Agents'];this[_0x4647('0xb')]={};this['waiting']=0x0;this[_0x4647('0xc')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x4647('0xd')][_0x4647('0xe')]=function(){var _0x4017c1=this[_0x4647('0xb')]['_rr'];this['mapAgentsId']=_[_0x4647('0xf')](this[_0x4647('0xa')],'id');this['mapAgentsId'][_0x4647('0x10')]=_0x4017c1;};WhatsappQueue[_0x4647('0xd')][_0x4647('0x11')]=function(){this[_0x4647('0x12')]=0x0;this[_0x4647('0x13')]=0x0;for(var _0x17aa70=0x0;_0x17aa70=0x0?this[_0x4647('0x16')]:0x0;var _0x1c2c7e={'id':this['id'],'available':this[_0x4647('0x16')],'loggedIn':this[_0x4647('0x12')],'name':this[_0x4647('0x7')],'paused':this[_0x4647('0x13')],'waiting':this[_0x4647('0x17')]};var _0x58dd2d=md5(JSON[_0x4647('0x18')](_0x1c2c7e));if(this[_0x4647('0xc')]!==_0x58dd2d){this[_0x4647('0xc')]=_0x58dd2d;io['to'](util['format'](_0x4647('0x19'),_0x1c2c7e[_0x4647('0x7')]))[_0x4647('0x1a')](_0x4647('0x1b'),_0x1c2c7e);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x8abb=['stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','defaults','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','loggedIn','paused','length','online','available'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8abb,0x131));var _0xb8ab=function(_0x14ea60,_0x4e1fc0){_0x14ea60=_0x14ea60-0x0;var _0x5f08c0=_0x8abb[_0x14ea60];return _0x5f08c0;};'use strict';var _=require(_0xb8ab('0x0'));var md5=require(_0xb8ab('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xb8ab('0x2')](config[_0xb8ab('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xb8ab('0x4'))(new Redis(config['redis']));function WhatsappQueue(_0x36871a){this['id']=_0x36871a['id']||0x0;this[_0xb8ab('0x5')]=_0x36871a[_0xb8ab('0x5')]||'';this[_0xb8ab('0x6')]=_0x36871a[_0xb8ab('0x6')]||0xa;this[_0xb8ab('0x7')]=_0x36871a[_0xb8ab('0x7')]||'beepall';this[_0xb8ab('0x8')]=_0x36871a[_0xb8ab('0x8')];this[_0xb8ab('0x9')]={};this[_0xb8ab('0xa')]=0x0;this[_0xb8ab('0x1')]='';this['updateRouting']();this[_0xb8ab('0xb')]();}WhatsappQueue[_0xb8ab('0xc')][_0xb8ab('0xd')]=function(){var _0x461e73=this[_0xb8ab('0x9')]['_rr'];this[_0xb8ab('0x9')]=_[_0xb8ab('0xe')](this['Agents'],'id');this[_0xb8ab('0x9')]['_rr']=_0x461e73;};WhatsappQueue['prototype'][_0xb8ab('0xb')]=function(){this[_0xb8ab('0xf')]=0x0;this[_0xb8ab('0x10')]=0x0;for(var _0x151331=0x0;_0x151331=0x0?this[_0xb8ab('0x13')]:0x0;var _0x26818e={'id':this['id'],'available':this[_0xb8ab('0x13')],'loggedIn':this[_0xb8ab('0xf')],'name':this[_0xb8ab('0x5')],'paused':this['paused'],'waiting':this[_0xb8ab('0xa')]};var _0x44061c=md5(JSON[_0xb8ab('0x14')](_0x26818e));if(this[_0xb8ab('0x1')]!==_0x44061c){this[_0xb8ab('0x1')]=_0x44061c;io['to'](util[_0xb8ab('0x15')](_0xb8ab('0x16'),_0x26818e[_0xb8ab('0x5')]))[_0xb8ab('0x17')](_0xb8ab('0x18'),_0x26818e);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index e02c45e..cc4538f 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(_0x21944d,_0x2dacef){var _0x256936=function(_0x100ed5){while(--_0x100ed5){_0x21944d['push'](_0x21944d['shift']());}};_0x256936(++_0x2dacef);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b8b81,_0xb30fc5){_0x1b8b81=_0x1b8b81-0x0;var _0x4a84ca=_0xb10b[_0x1b8b81];return _0x4a84ca;};'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(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 328c643..7cc5e17 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 _0x22ae=['UpdateChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x22ae,0x1f1));var _0xe22a=function(_0x33de88,_0x581346){_0x33de88=_0x33de88-0x0;var _0x105957=_0x22ae[_0x33de88];return _0x105957;};'use strict';var client=require(_0xe22a('0x0'));exports[_0xe22a('0x1')]=function(_0x4edb89,_0x312f21){return client[_0xe22a('0x2')](_0xe22a('0x3'),{'body':_0x312f21,'options':{'where':{'id':_0x4edb89}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x1f6199,_0x30e173){return client[_0xe22a('0x2')]('AddTagsToChatInteraction',{'body':_0x30e173,'options':{'where':{'id':_0x1f6199}},'log':_0xe22a('0x4')});}; \ No newline at end of file +var _0x487c=['addTags','AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x4fc583,_0x1c9563){var _0x3b884d=function(_0xe8ac6f){while(--_0xe8ac6f){_0x4fc583['push'](_0x4fc583['shift']());}};_0x3b884d(++_0x1c9563);}(_0x487c,0x74));var _0xc487=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x487c[_0x5d80de];return _0x1c7556;};'use strict';var client=require(_0xc487('0x0'));exports[_0xc487('0x1')]=function(_0x605989,_0x29eaee){return client[_0xc487('0x2')](_0xc487('0x3'),{'body':_0x29eaee,'options':{'where':{'id':_0x605989}},'log':'updateChatInteraction'});};exports[_0xc487('0x4')]=function(_0x1ac34a,_0x1c3662){return client['Request'](_0xc487('0x5'),{'body':_0x1c3662,'options':{'where':{'id':_0x1ac34a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 481549c..8bdd2d0 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 _0x8b4f=['../client','create','Request','CreateChatMessage'];(function(_0x2ec0cc,_0x21c744){var _0x3d662=function(_0x1fc2ae){while(--_0x1fc2ae){_0x2ec0cc['push'](_0x2ec0cc['shift']());}};_0x3d662(++_0x21c744);}(_0x8b4f,0x1d8));var _0xf8b4=function(_0x39d711,_0xe11eb7){_0x39d711=_0x39d711-0x0;var _0xee1d0c=_0x8b4f[_0x39d711];return _0xee1d0c;};'use strict';var client=require(_0xf8b4('0x0'));exports[_0xf8b4('0x1')]=function(_0xeb9ce2){return client[_0xf8b4('0x2')](_0xf8b4('0x3'),{'body':_0xeb9ce2,'log':'createChatMessage'});}; \ No newline at end of file +var _0x8624=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8624,0x1be));var _0x4862=function(_0x46640c,_0x4d27c5){_0x46640c=_0x46640c-0x0;var _0x32fb77=_0x8624[_0x46640c];return _0x32fb77;};'use strict';var client=require(_0x4862('0x0'));exports[_0x4862('0x1')]=function(_0x1ca45d){return client[_0x4862('0x2')](_0x4862('0x3'),{'body':_0x1ca45d,'log':_0x4862('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 08fd485..75653b4 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 _0xe8f7=['getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy','User','Agents','chatPause'];(function(_0x29a16b,_0x53e3a5){var _0x21ce5b=function(_0x4d14dc){while(--_0x4d14dc){_0x29a16b['push'](_0x29a16b['shift']());}};_0x21ce5b(++_0x53e3a5);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7e8f('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x7e8f('0x1')](_0x7e8f('0x2'),{'options':{'raw':![],'attributes':['id',_0x7e8f('0x3'),_0x7e8f('0x4'),_0x7e8f('0x5')],'include':[{'model':_0x7e8f('0x6'),'as':_0x7e8f('0x7'),'attributes':['id','name','online',_0x7e8f('0x8')]}]},'log':_0x7e8f('0x9')});};}; \ No newline at end of file +var _0xc73a=['online','chatPause','getChatQueues','Request','GetChatQueue','strategy','User','Agents'];(function(_0x4e1f17,_0x55df44){var _0x26f359=function(_0x145dd9){while(--_0x145dd9){_0x4e1f17['push'](_0x4e1f17['shift']());}};_0x26f359(++_0x55df44);}(_0xc73a,0x72));var _0xac73=function(_0x2a4c8d,_0x10d67a){_0x2a4c8d=_0x2a4c8d-0x0;var _0x171512=_0xc73a[_0x2a4c8d];return _0x171512;};'use strict';var client=require('../client');exports[_0xac73('0x0')]=function(){return function(){return client[_0xac73('0x1')](_0xac73('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xac73('0x3')],'include':[{'model':_0xac73('0x4'),'as':_0xac73('0x5'),'attributes':['id','name',_0xac73('0x6'),_0xac73('0x7')]}]},'log':_0xac73('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d5825f5..5088a1c 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 _0x25a3=['DESC','../client','create','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x582269,_0x529ef3){var _0x506c1f=function(_0x361bc0){while(--_0x361bc0){_0x582269['push'](_0x582269['shift']());}};_0x506c1f(++_0x529ef3);}(_0x25a3,0x121));var _0x325a=function(_0x434ad8,_0x34ae11){_0x434ad8=_0x434ad8-0x0;var _0xc7cf86=_0x25a3[_0x434ad8];return _0xc7cf86;};'use strict';var client=require(_0x325a('0x0'));exports[_0x325a('0x1')]=function(_0x236732){return client['Request'](_0x325a('0x2'),{'body':_0x236732,'log':'CreateChatQueueReport'});};exports[_0x325a('0x3')]=function(_0x3b887a,_0x1f6e3d){return client['Request'](_0x325a('0x4'),{'body':_0x1f6e3d,'options':{'where':{'uniqueid':_0x3b887a},'order':[['id',_0x325a('0x5')]],'limit':0x1},'log':_0x325a('0x4')});}; \ No newline at end of file +var _0xeddd=['CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x1da7ca,_0x2d3c9a){var _0x3f89ac=function(_0x52a47d){while(--_0x52a47d){_0x1da7ca['push'](_0x1da7ca['shift']());}};_0x3f89ac(++_0x2d3c9a);}(_0xeddd,0x69));var _0xdedd=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xeddd[_0x35885a];return _0xe86249;};'use strict';var client=require(_0xdedd('0x0'));exports[_0xdedd('0x1')]=function(_0x161609){return client[_0xdedd('0x2')]('CreateChatQueueReport',{'body':_0x161609,'log':_0xdedd('0x3')});};exports['update']=function(_0x10de65,_0xd2ff49){return client['Request'](_0xdedd('0x4'),{'body':_0xd2ff49,'options':{'where':{'uniqueid':_0x10de65},'order':[['id',_0xdedd('0x5')]],'limit':0x1},'log':_0xdedd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index f4affca..86c47bf 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x254999,_0x53e726){var _0x48ffe8=function(_0x33b7d0){while(--_0x33b7d0){_0x254999['push'](_0x254999['shift']());}};_0x48ffe8(++_0x53e726);}(_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 +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x7a54,0x106));var _0x47a5=function(_0x21728a,_0x5906ad){_0x21728a=_0x21728a-0x0;var _0x459807=_0x7a54[_0x21728a];return _0x459807;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2573f23..9455d25 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 _0xb8d2=['CreateFaxMessage','createFaxMessage','../client','Request'];(function(_0x1515e9,_0x548b0c){var _0x58cf44=function(_0x1d9ef6){while(--_0x1d9ef6){_0x1515e9['push'](_0x1515e9['shift']());}};_0x58cf44(++_0x548b0c);}(_0xb8d2,0xae));var _0x2b8d=function(_0x150792,_0x187824){_0x150792=_0x150792-0x0;var _0x5f2974=_0xb8d2[_0x150792];return _0x5f2974;};'use strict';var client=require(_0x2b8d('0x0'));exports['create']=function(_0x2ac35d){return client[_0x2b8d('0x1')](_0x2b8d('0x2'),{'body':_0x2ac35d,'log':_0x2b8d('0x3')});}; \ No newline at end of file +var _0xe442=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x21e38c,_0x5cd897){var _0x2ba423=function(_0x49c365){while(--_0x49c365){_0x21e38c['push'](_0x21e38c['shift']());}};_0x2ba423(++_0x5cd897);}(_0xe442,0xd4));var _0x2e44=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe442[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x2e44('0x0'));exports['create']=function(_0x3b36ad){return client[_0x2e44('0x1')](_0x2e44('0x2'),{'body':_0x3b36ad,'log':_0x2e44('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 03edc1a..91d76b4 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 _0x3432=['../client','getFaxQueues','Request','name','strategy','Agents','online','faxPause'];(function(_0x551be0,_0x3372c1){var _0x112d08=function(_0x4c82b9){while(--_0x4c82b9){_0x551be0['push'](_0x551be0['shift']());}};_0x112d08(++_0x3372c1);}(_0x3432,0xf8));var _0x2343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3432[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x2343('0x0'));exports[_0x2343('0x1')]=function(){return function(){return client[_0x2343('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x2343('0x3'),'timeout',_0x2343('0x4')],'include':[{'model':'User','as':_0x2343('0x5'),'attributes':['id','name',_0x2343('0x6'),_0x2343('0x7')]}]},'log':_0x2343('0x1')});};}; \ No newline at end of file +var _0x24ad=['../client','Request','GetFaxQueue','strategy','User','Agents','getFaxQueues'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x24ad,0xe7));var _0xd24a=function(_0x18576d,_0x578c01){_0x18576d=_0x18576d-0x0;var _0x498102=_0x24ad[_0x18576d];return _0x498102;};'use strict';var client=require(_0xd24a('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xd24a('0x1')](_0xd24a('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xd24a('0x3')],'include':[{'model':_0xd24a('0x4'),'as':_0xd24a('0x5'),'attributes':['id','name','online','faxPause']}]},'log':_0xd24a('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2c93ddf..02616e7 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 _0x539c=['../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC'];(function(_0x16bc08,_0x4e226a){var _0xd46bd2=function(_0x3bb21a){while(--_0x3bb21a){_0x16bc08['push'](_0x16bc08['shift']());}};_0xd46bd2(++_0x4e226a);}(_0x539c,0x138));var _0xc539=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x539c[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xc539('0x0'));exports[_0xc539('0x1')]=function(_0x1ac573){return client[_0xc539('0x2')](_0xc539('0x3'),{'body':_0x1ac573,'log':_0xc539('0x3')});};exports['update']=function(_0x18f62d,_0x45dde5){return client[_0xc539('0x2')](_0xc539('0x4'),{'body':_0x45dde5,'options':{'where':{'uniqueid':_0x18f62d},'order':[['id',_0xc539('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x74d8=['create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','../client'];(function(_0x333755,_0x47aadf){var _0x1335ce=function(_0x370044){while(--_0x370044){_0x333755['push'](_0x333755['shift']());}};_0x1335ce(++_0x47aadf);}(_0x74d8,0xe6));var _0x874d=function(_0x303f87,_0x55d2e4){_0x303f87=_0x303f87-0x0;var _0x408972=_0x74d8[_0x303f87];return _0x408972;};'use strict';var client=require(_0x874d('0x0'));exports[_0x874d('0x1')]=function(_0x4c7e90){return client[_0x874d('0x2')](_0x874d('0x3'),{'body':_0x4c7e90,'log':_0x874d('0x3')});};exports[_0x874d('0x4')]=function(_0x43a5f7,_0x5f205c){return client['Request']('UpdateFaxQueueReport',{'body':_0x5f205c,'options':{'where':{'uniqueid':_0x43a5f7},'order':[['id',_0x874d('0x5')]],'limit':0x1},'log':_0x874d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 67e138b..7e30f3e 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 _0xe471=['name','Interval','Intervals','interval','../client','getIntervals','Request','GetInterval'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe471,0x174));var _0x1e47=function(_0x3368a3,_0x4dc22b){_0x3368a3=_0x3368a3-0x0;var _0xb8c49f=_0xe471[_0x3368a3];return _0xb8c49f;};'use strict';var client=require(_0x1e47('0x0'));exports[_0x1e47('0x1')]=function(){return function(){return client[_0x1e47('0x2')](_0x1e47('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1e47('0x4')],'include':[{'model':_0x1e47('0x5'),'as':_0x1e47('0x6'),'attributes':['id',_0x1e47('0x4'),_0x1e47('0x7')]}]},'log':_0x1e47('0x1')});};}; \ No newline at end of file +var _0x2ecd=['../client','getIntervals','Request','GetInterval','name','Interval','interval'];(function(_0x84c711,_0x54cd54){var _0x3e9c59=function(_0x4324e0){while(--_0x4324e0){_0x84c711['push'](_0x84c711['shift']());}};_0x3e9c59(++_0x54cd54);}(_0x2ecd,0x103));var _0xd2ec=function(_0x4722bb,_0x575648){_0x4722bb=_0x4722bb-0x0;var _0x10b392=_0x2ecd[_0x4722bb];return _0x10b392;};'use strict';var client=require(_0xd2ec('0x0'));exports[_0xd2ec('0x1')]=function(){return function(){return client[_0xd2ec('0x2')](_0xd2ec('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd2ec('0x4')],'include':[{'model':_0xd2ec('0x5'),'as':'Intervals','attributes':['id',_0xd2ec('0x4'),_0xd2ec('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index d58ea60..380a16c 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 _0x955f=['update','Request','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x3b7b42,_0x31badd){var _0x1ebaad=function(_0x3655d9){while(--_0x3655d9){_0x3b7b42['push'](_0x3b7b42['shift']());}};_0x1ebaad(++_0x31badd);}(_0x955f,0x1eb));var _0xf955=function(_0x42f176,_0xfee904){_0x42f176=_0x42f176-0x0;var _0x235fbe=_0x955f[_0x42f176];return _0x235fbe;};'use strict';var client=require(_0xf955('0x0'));exports[_0xf955('0x1')]=function(_0x438668,_0x382225){return client[_0xf955('0x2')]('UpdateMailInteraction',{'body':_0x382225,'options':{'where':{'id':_0x438668}},'log':_0xf955('0x3')});};exports['addTags']=function(_0x5d0c95,_0x1db0dd){return client['Request'](_0xf955('0x4'),{'body':_0x1db0dd,'options':{'where':{'id':_0x5d0c95}},'log':_0xf955('0x5')});}; \ No newline at end of file +var _0x6d38=['updateMailInteraction','Request','addTagsToChatInteraction','update'];(function(_0x81fc31,_0x151260){var _0x3c1234=function(_0x45ccc5){while(--_0x45ccc5){_0x81fc31['push'](_0x81fc31['shift']());}};_0x3c1234(++_0x151260);}(_0x6d38,0x1ef));var _0x86d3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6d38[_0x36eaaa];return _0x461349;};'use strict';var client=require('../client');exports[_0x86d3('0x0')]=function(_0x4c9c06,_0x3db243){return client['Request']('UpdateMailInteraction',{'body':_0x3db243,'options':{'where':{'id':_0x4c9c06}},'log':_0x86d3('0x1')});};exports['addTags']=function(_0xe9198a,_0x455b9d){return client[_0x86d3('0x2')]('AddTagsToMailInteraction',{'body':_0x455b9d,'options':{'where':{'id':_0xe9198a}},'log':_0x86d3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 65ff8b8..53e68b5 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 _0xa548=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x469df0,_0x1ccafe){var _0x3b3eef=function(_0x5107e1){while(--_0x5107e1){_0x469df0['push'](_0x469df0['shift']());}};_0x3b3eef(++_0x1ccafe);}(_0xa548,0xd6));var _0x8a54=function(_0x2071b0,_0x2310db){_0x2071b0=_0x2071b0-0x0;var _0x39c1fc=_0xa548[_0x2071b0];return _0x39c1fc;};'use strict';var client=require(_0x8a54('0x0'));exports[_0x8a54('0x1')]=function(_0x224791){return client[_0x8a54('0x2')](_0x8a54('0x3'),{'body':_0x224791,'log':_0x8a54('0x4')});}; \ No newline at end of file +var _0x04ce=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x49cf31,_0x43ec02){var _0x2bafec=function(_0x4a8212){while(--_0x4a8212){_0x49cf31['push'](_0x49cf31['shift']());}};_0x2bafec(++_0x43ec02);}(_0x04ce,0x1d1));var _0xe04c=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x04ce[_0x2a6809];return _0x11c371;};'use strict';var client=require(_0xe04c('0x0'));exports[_0xe04c('0x1')]=function(_0x384c10){return client[_0xe04c('0x2')](_0xe04c('0x3'),{'body':_0x384c10,'log':_0xe04c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index afcbd76..0d19a58 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 _0x0e8a=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy','User','Agents'];(function(_0xf35d37,_0xa81793){var _0x5df397=function(_0x32bd99){while(--_0x32bd99){_0xf35d37['push'](_0xf35d37['shift']());}};_0x5df397(++_0xa81793);}(_0x0e8a,0x17e));var _0xa0e8=function(_0x4fb930,_0x4141c4){_0x4fb930=_0x4fb930-0x0;var _0x59adc4=_0x0e8a[_0x4fb930];return _0x59adc4;};'use strict';var client=require(_0xa0e8('0x0'));exports[_0xa0e8('0x1')]=function(){return function(){return client[_0xa0e8('0x2')](_0xa0e8('0x3'),{'options':{'raw':![],'attributes':['id',_0xa0e8('0x4'),'timeout',_0xa0e8('0x5')],'include':[{'model':_0xa0e8('0x6'),'as':_0xa0e8('0x7'),'attributes':['id',_0xa0e8('0x4'),_0xa0e8('0x8'),_0xa0e8('0x9')]}]},'log':_0xa0e8('0x1')});};}; \ No newline at end of file +var _0x498b=['GetMailQueue','name','timeout','User','Agents','online','mailPause','getMailQueues','Request'];(function(_0x38a68a,_0x1d8296){var _0x5d6a6e=function(_0xd9bc41){while(--_0xd9bc41){_0x38a68a['push'](_0x38a68a['shift']());}};_0x5d6a6e(++_0x1d8296);}(_0x498b,0x154));var _0xb498=function(_0x2d0fb5,_0x40136f){_0x2d0fb5=_0x2d0fb5-0x0;var _0x55a990=_0x498b[_0x2d0fb5];return _0x55a990;};'use strict';var client=require('../client');exports[_0xb498('0x0')]=function(){return function(){return client[_0xb498('0x1')](_0xb498('0x2'),{'options':{'raw':![],'attributes':['id',_0xb498('0x3'),_0xb498('0x4'),'strategy'],'include':[{'model':_0xb498('0x5'),'as':_0xb498('0x6'),'attributes':['id',_0xb498('0x3'),_0xb498('0x7'),_0xb498('0x8')]}]},'log':_0xb498('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 227cb13..a6b6983 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 _0xbfc0=['DESC','UpdateMailQueueReport','../client','CreateMailQueueReport','update','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbfc0,0x1c4));var _0x0bfc=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xbfc0[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0x0bfc('0x0'));exports['create']=function(_0x4d1dda){return client['Request'](_0x0bfc('0x1'),{'body':_0x4d1dda,'log':'CreateMailQueueReport'});};exports[_0x0bfc('0x2')]=function(_0x252c86,_0x4857f6){return client[_0x0bfc('0x3')]('UpdateMailQueueReport',{'body':_0x4857f6,'options':{'where':{'uniqueid':_0x252c86},'order':[['id',_0x0bfc('0x4')]],'limit':0x1},'log':_0x0bfc('0x5')});}; \ No newline at end of file +var _0x2524=['UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2524,0xbc));var _0x4252=function(_0x28d0e1,_0x5771d2){_0x28d0e1=_0x28d0e1-0x0;var _0x33f82f=_0x2524[_0x28d0e1];return _0x33f82f;};'use strict';var client=require('../client');exports[_0x4252('0x0')]=function(_0x2074f5){return client[_0x4252('0x1')](_0x4252('0x2'),{'body':_0x2074f5,'log':_0x4252('0x2')});};exports[_0x4252('0x3')]=function(_0x1639bf,_0x1b0599){return client[_0x4252('0x1')](_0x4252('0x4'),{'body':_0x1b0599,'options':{'where':{'uniqueid':_0x1639bf},'order':[['id',_0x4252('0x5')]],'limit':0x1},'log':_0x4252('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 894bd7c..57d8458 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 _0x8b0e=['addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x8b0e,0x16d));var _0xe8b0=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0x8b0e[_0x130d82];return _0x112070;};'use strict';var client=require('../client');exports[_0xe8b0('0x0')]=function(_0x1f2049,_0xeb25b3){return client[_0xe8b0('0x1')](_0xe8b0('0x2'),{'body':_0xeb25b3,'options':{'where':{'id':_0x1f2049}},'log':_0xe8b0('0x3')});};exports[_0xe8b0('0x4')]=function(_0x72c178,_0x16cedd){return client['Request'](_0xe8b0('0x5'),{'body':_0x16cedd,'options':{'where':{'id':_0x72c178}},'log':_0xe8b0('0x6')});}; \ No newline at end of file +var _0x7b27=['Request','addTagsToChatInteraction','../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x219e41,_0x5e0ac6){var _0x275c89=function(_0x23e1ff){while(--_0x23e1ff){_0x219e41['push'](_0x219e41['shift']());}};_0x275c89(++_0x5e0ac6);}(_0x7b27,0x1d0));var _0x77b2=function(_0x3e8297,_0x59ab3e){_0x3e8297=_0x3e8297-0x0;var _0x4b055c=_0x7b27[_0x3e8297];return _0x4b055c;};'use strict';var client=require(_0x77b2('0x0'));exports['update']=function(_0x935b4f,_0x3e78c4){return client['Request'](_0x77b2('0x1'),{'body':_0x3e78c4,'options':{'where':{'id':_0x935b4f}},'log':_0x77b2('0x2')});};exports[_0x77b2('0x3')]=function(_0x5a2863,_0x236fe5){return client[_0x77b2('0x4')]('AddTagsToOpenchannelInteraction',{'body':_0x236fe5,'options':{'where':{'id':_0x5a2863}},'log':_0x77b2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 32fcb7a..7095dde 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 _0x583e=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x1db9e2,_0x404040){var _0x18bb46=function(_0x45001d){while(--_0x45001d){_0x1db9e2['push'](_0x1db9e2['shift']());}};_0x18bb46(++_0x404040);}(_0x583e,0xec));var _0xe583=function(_0x1b558b,_0x82f953){_0x1b558b=_0x1b558b-0x0;var _0x54ce8d=_0x583e[_0x1b558b];return _0x54ce8d;};'use strict';var client=require(_0xe583('0x0'));exports[_0xe583('0x1')]=function(_0x28bf95){return client[_0xe583('0x2')](_0xe583('0x3'),{'body':_0x28bf95,'log':_0xe583('0x4')});}; \ No newline at end of file +var _0x30de=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x5ff7c6,_0x3fe56b){var _0x8e9ed7=function(_0x380b48){while(--_0x380b48){_0x5ff7c6['push'](_0x5ff7c6['shift']());}};_0x8e9ed7(++_0x3fe56b);}(_0x30de,0xfd));var _0xe30d=function(_0x55fe99,_0x1edf8c){_0x55fe99=_0x55fe99-0x0;var _0x5d8246=_0x30de[_0x55fe99];return _0x5d8246;};'use strict';var client=require(_0xe30d('0x0'));exports[_0xe30d('0x1')]=function(_0x4a7455){return client[_0xe30d('0x2')](_0xe30d('0x3'),{'body':_0x4a7455,'log':_0xe30d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 0c91115..7c8aa90 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 _0x380a=['../client','getOpenchannelQueues','Request','name','User','online','openchannelPause'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x380a,0x16c));var _0xa380=function(_0x1d7bc0,_0x50a455){_0x1d7bc0=_0x1d7bc0-0x0;var _0x15a179=_0x380a[_0x1d7bc0];return _0x15a179;};'use strict';var client=require(_0xa380('0x0'));exports[_0xa380('0x1')]=function(){return function(){return client[_0xa380('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xa380('0x3'),'timeout','strategy'],'include':[{'model':_0xa380('0x4'),'as':'Agents','attributes':['id','name',_0xa380('0x5'),_0xa380('0x6')]}]},'log':_0xa380('0x1')});};}; \ No newline at end of file +var _0xf951=['Agents','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','name','strategy','User'];(function(_0x1bd07d,_0x2c505f){var _0xb82db4=function(_0x1af4d7){while(--_0x1af4d7){_0x1bd07d['push'](_0x1bd07d['shift']());}};_0xb82db4(++_0x2c505f);}(_0xf951,0x1f3));var _0x1f95=function(_0x29d530,_0x5da0d7){_0x29d530=_0x29d530-0x0;var _0x242905=_0xf951[_0x29d530];return _0x242905;};'use strict';var client=require('../client');exports[_0x1f95('0x0')]=function(){return function(){return client['Request'](_0x1f95('0x1'),{'options':{'raw':![],'attributes':['id',_0x1f95('0x2'),'timeout',_0x1f95('0x3')],'include':[{'model':_0x1f95('0x4'),'as':_0x1f95('0x5'),'attributes':['id',_0x1f95('0x2'),'online',_0x1f95('0x6')]}]},'log':_0x1f95('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c2b0fba..b1c2942 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 _0xab26=['../client','create','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0xab26,0xd2));var _0x6ab2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xab26[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x6ab2('0x0'));exports[_0x6ab2('0x1')]=function(_0x18e2d0){return client['Request'](_0x6ab2('0x2'),{'body':_0x18e2d0,'log':_0x6ab2('0x2')});};exports['update']=function(_0x4fcec3,_0x4c8cf){return client['Request'](_0x6ab2('0x3'),{'body':_0x4c8cf,'options':{'where':{'uniqueid':_0x4fcec3},'order':[['id',_0x6ab2('0x4')]],'limit':0x1},'log':_0x6ab2('0x3')});}; \ No newline at end of file +var _0x13fd=['DESC','../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x55ffa0,_0x3c8d0e){var _0x644bfc=function(_0x36e6e4){while(--_0x36e6e4){_0x55ffa0['push'](_0x55ffa0['shift']());}};_0x644bfc(++_0x3c8d0e);}(_0x13fd,0x1d5));var _0xd13f=function(_0x4fa5eb,_0x2677d6){_0x4fa5eb=_0x4fa5eb-0x0;var _0x3dac04=_0x13fd[_0x4fa5eb];return _0x3dac04;};'use strict';var client=require(_0xd13f('0x0'));exports['create']=function(_0x2f7089){return client[_0xd13f('0x1')](_0xd13f('0x2'),{'body':_0x2f7089,'log':_0xd13f('0x2')});};exports[_0xd13f('0x3')]=function(_0x57e387,_0x12caab){return client[_0xd13f('0x1')](_0xd13f('0x4'),{'body':_0x12caab,'options':{'where':{'uniqueid':_0x57e387},'order':[['id',_0xd13f('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 f4de976..f055e6d 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 _0xbacb=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbacb,0x1a6));var _0xbbac=function(_0x35651f,_0x2bac03){_0x35651f=_0x35651f-0x0;var _0x180866=_0xbacb[_0x35651f];return _0x180866;};'use strict';var client=require(_0xbbac('0x0'));exports[_0xbbac('0x1')]=function(_0x5a971f,_0x399452){return client[_0xbbac('0x2')](_0xbbac('0x3'),{'body':_0x399452,'options':{'where':{'id':_0x5a971f}},'log':_0xbbac('0x4')});};exports[_0xbbac('0x5')]=function(_0x97ea61,_0x4e3698){return client['Request'](_0xbbac('0x6'),{'body':_0x4e3698,'options':{'where':{'id':_0x97ea61}},'log':_0xbbac('0x7')});}; \ No newline at end of file +var _0x5f10=['addTags','Request','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f10,0xd5));var _0x05f1=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x5f10[_0x2d8d69];return _0x39ae22;};'use strict';var client=require(_0x05f1('0x0'));exports[_0x05f1('0x1')]=function(_0x4ce609,_0x4fabca){return client['Request'](_0x05f1('0x2'),{'body':_0x4fabca,'options':{'where':{'id':_0x4ce609}},'log':_0x05f1('0x3')});};exports[_0x05f1('0x4')]=function(_0xcb88e1,_0xa8d3b9){return client[_0x05f1('0x5')]('AddTagsToSmsInteraction',{'body':_0xa8d3b9,'options':{'where':{'id':_0xcb88e1}},'log':_0x05f1('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f067b7c..8a9d96c 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 _0x8b6f=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x8b6f,0xf1));var _0xf8b6=function(_0x17be35,_0x24728a){_0x17be35=_0x17be35-0x0;var _0x3d3bcc=_0x8b6f[_0x17be35];return _0x3d3bcc;};'use strict';var client=require(_0xf8b6('0x0'));exports[_0xf8b6('0x1')]=function(_0x8ac728){return client[_0xf8b6('0x2')](_0xf8b6('0x3'),{'body':_0x8ac728,'log':_0xf8b6('0x4')});}; \ No newline at end of file +var _0xfde2=['create','CreateSmsMessage','createSmsMessage','../client'];(function(_0x12080f,_0x376514){var _0x5ca83b=function(_0x41171f){while(--_0x41171f){_0x12080f['push'](_0x12080f['shift']());}};_0x5ca83b(++_0x376514);}(_0xfde2,0x113));var _0x2fde=function(_0x11babf,_0x2a02bb){_0x11babf=_0x11babf-0x0;var _0x3bcc27=_0xfde2[_0x11babf];return _0x3bcc27;};'use strict';var client=require(_0x2fde('0x0'));exports[_0x2fde('0x1')]=function(_0x88ede5){return client['Request'](_0x2fde('0x2'),{'body':_0x88ede5,'log':_0x2fde('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a62a3bb..dda520f 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x40d0e9,_0x28ea45){var _0x432c34=function(_0x2f0adf){while(--_0x2f0adf){_0x40d0e9['push'](_0x40d0e9['shift']());}};_0x432c34(++_0x28ea45);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0xcb91[_0x5e8c32];return _0x595f7b;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x368080,_0x48145e){var _0x5d8bb0=function(_0xae18af){while(--_0xae18af){_0x368080['push'](_0x368080['shift']());}};_0x5d8bb0(++_0x48145e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xcb91[_0x352e09];return _0x1b7094;};'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 9636c87..b1bb1a2 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x488081,_0xba730b){var _0x492b11=function(_0x478dd8){while(--_0x478dd8){_0x488081['push'](_0x488081['shift']());}};_0x492b11(++_0xba730b);}(_0x55ca,0x126));var _0xa55c=function(_0x42572b,_0x259433){_0x42572b=_0x42572b-0x0;var _0x4d50b3=_0x55ca[_0x42572b];return _0x4d50b3;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0xf2cf12,_0x2f5916){var _0xf99c45=function(_0x2d6da9){while(--_0x2d6da9){_0xf2cf12['push'](_0xf2cf12['shift']());}};_0xf99c45(++_0x2f5916);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2ae97c0..facdf61 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(_0x2e2f65,_0x3fff64){var _0x485810=function(_0x231447){while(--_0x231447){_0x2e2f65['push'](_0x2e2f65['shift']());}};_0x485810(++_0x3fff64);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x2abf2a,_0x253b08){var _0x5aba30=function(_0xab22f7){while(--_0xab22f7){_0x2abf2a['push'](_0x2abf2a['shift']());}};_0x5aba30(++_0x253b08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 ce1fc0b..557f8a4 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 _0xb182=['addTagsToWhatsappInteraction','update','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction'];(function(_0x4a3ee3,_0x304512){var _0x56d16d=function(_0x280251){while(--_0x280251){_0x4a3ee3['push'](_0x4a3ee3['shift']());}};_0x56d16d(++_0x304512);}(_0xb182,0x121));var _0x2b18=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0xb182[_0x2fbcf6];return _0x3e7265;};'use strict';var client=require('../client');exports[_0x2b18('0x0')]=function(_0x211fdb,_0x438d78){return client['Request']('UpdateWhatsappInteraction',{'body':_0x438d78,'options':{'where':{'id':_0x211fdb}},'log':_0x2b18('0x1')});};exports[_0x2b18('0x2')]=function(_0x36ffa7,_0x4b2145){return client[_0x2b18('0x3')](_0x2b18('0x4'),{'body':_0x4b2145,'options':{'where':{'id':_0x36ffa7}},'log':_0x2b18('0x5')});}; \ No newline at end of file +var _0xdb70=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0xa2ecb9,_0x4b3fda){var _0x489ad0=function(_0x4223e6){while(--_0x4223e6){_0xa2ecb9['push'](_0xa2ecb9['shift']());}};_0x489ad0(++_0x4b3fda);}(_0xdb70,0xa0));var _0x0db7=function(_0x31d7be,_0x59b13c){_0x31d7be=_0x31d7be-0x0;var _0x3066d4=_0xdb70[_0x31d7be];return _0x3066d4;};'use strict';var client=require(_0x0db7('0x0'));exports[_0x0db7('0x1')]=function(_0x44c749,_0x53cf0e){return client[_0x0db7('0x2')](_0x0db7('0x3'),{'body':_0x53cf0e,'options':{'where':{'id':_0x44c749}},'log':_0x0db7('0x4')});};exports[_0x0db7('0x5')]=function(_0x3be0be,_0x38eed1){return client[_0x0db7('0x2')](_0x0db7('0x6'),{'body':_0x38eed1,'options':{'where':{'id':_0x3be0be}},'log':_0x0db7('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2073c5c..823a410 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 _0xe9a3=['CreateWhatsappMessage','create','Request'];(function(_0x38754b,_0x284d1f){var _0x594cd3=function(_0x717db7){while(--_0x717db7){_0x38754b['push'](_0x38754b['shift']());}};_0x594cd3(++_0x284d1f);}(_0xe9a3,0x8e));var _0x3e9a=function(_0x14b189,_0x17bc86){_0x14b189=_0x14b189-0x0;var _0x25793a=_0xe9a3[_0x14b189];return _0x25793a;};'use strict';var client=require('../client');exports[_0x3e9a('0x0')]=function(_0x5f8202){return client[_0x3e9a('0x1')](_0x3e9a('0x2'),{'body':_0x5f8202,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xb2c3=['Request','createWhatsappMessage','../client'];(function(_0x2e9e11,_0x2f9ea3){var _0x1b7ef7=function(_0x420a77){while(--_0x420a77){_0x2e9e11['push'](_0x2e9e11['shift']());}};_0x1b7ef7(++_0x2f9ea3);}(_0xb2c3,0x7a));var _0x3b2c=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xb2c3[_0x3cea78];return _0x33b66b;};'use strict';var client=require(_0x3b2c('0x0'));exports['create']=function(_0x332b4){return client[_0x3b2c('0x1')]('CreateWhatsappMessage',{'body':_0x332b4,'log':_0x3b2c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 1091834..17dd7c5 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 _0x558f=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause','../client'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x558f,0x9f));var _0xf558=function(_0x238caa,_0xc685a1){_0x238caa=_0x238caa-0x0;var _0x5b0829=_0x558f[_0x238caa];return _0x5b0829;};'use strict';var client=require(_0xf558('0x0'));exports[_0xf558('0x1')]=function(){return function(){return client[_0xf558('0x2')](_0xf558('0x3'),{'options':{'raw':![],'attributes':['id',_0xf558('0x4'),_0xf558('0x5'),_0xf558('0x6')],'include':[{'model':_0xf558('0x7'),'as':'Agents','attributes':['id',_0xf558('0x4'),_0xf558('0x8'),_0xf558('0x9')]}]},'log':_0xf558('0x1')});};}; \ No newline at end of file +var _0x4596=['Agents','online','getWhatsappQueues','Request','name','strategy','User'];(function(_0x1418a5,_0x19c106){var _0x22c849=function(_0x266e90){while(--_0x266e90){_0x1418a5['push'](_0x1418a5['shift']());}};_0x22c849(++_0x19c106);}(_0x4596,0x1d0));var _0x6459=function(_0x335f41,_0xb425cc){_0x335f41=_0x335f41-0x0;var _0x30fb62=_0x4596[_0x335f41];return _0x30fb62;};'use strict';var client=require('../client');exports[_0x6459('0x0')]=function(){return function(){return client[_0x6459('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x6459('0x2'),'timeout',_0x6459('0x3')],'include':[{'model':_0x6459('0x4'),'as':_0x6459('0x5'),'attributes':['id','name',_0x6459('0x6'),'whatsappPause']}]},'log':_0x6459('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e6ceeb0..1deeac6 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 _0x1e23=['create','Request','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x34b709,_0x5dc8af){var _0x20dda4=function(_0x33eaef){while(--_0x33eaef){_0x34b709['push'](_0x34b709['shift']());}};_0x20dda4(++_0x5dc8af);}(_0x1e23,0xe0));var _0x31e2=function(_0x4c5aa3,_0x3d35f6){_0x4c5aa3=_0x4c5aa3-0x0;var _0x4a0fe4=_0x1e23[_0x4c5aa3];return _0x4a0fe4;};'use strict';var client=require(_0x31e2('0x0'));exports[_0x31e2('0x1')]=function(_0x2dbe3f){return client[_0x31e2('0x2')]('CreateWhatsappQueueReport',{'body':_0x2dbe3f,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x3a9249,_0x302e7d){return client[_0x31e2('0x2')](_0x31e2('0x3'),{'body':_0x302e7d,'options':{'where':{'uniqueid':_0x3a9249},'order':[['id',_0x31e2('0x4')]],'limit':0x1},'log':_0x31e2('0x3')});}; \ No newline at end of file +var _0xaa25=['CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0xaa25,0x1a8));var _0x5aa2=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xaa25[_0x46698a];return _0x356db0;};'use strict';var client=require(_0x5aa2('0x0'));exports[_0x5aa2('0x1')]=function(_0x3e4b42){return client[_0x5aa2('0x2')](_0x5aa2('0x3'),{'body':_0x3e4b42,'log':_0x5aa2('0x3')});};exports[_0x5aa2('0x4')]=function(_0x3f706a,_0x3b4ea1){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x3b4ea1,'options':{'where':{'uniqueid':_0x3f706a},'order':[['id',_0x5aa2('0x5')]],'limit':0x1},'log':_0x5aa2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 2aea4e1..6093fd3 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 _0x93b4=['error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','createQueue','atimeout','channel','format','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length'];(function(_0x3c1186,_0x4be0d8){var _0x2cca7f=function(_0x2cccac){while(--_0x2cccac){_0x3c1186['push'](_0x3c1186['shift']());}};_0x2cca7f(++_0x4be0d8);}(_0x93b4,0x1a1));var _0x493b=function(_0xc43be5,_0x5e3a31){_0xc43be5=_0xc43be5-0x0;var _0x45658d=_0x93b4[_0xc43be5];return _0x45658d;};'use strict';var schema=require('validate');var _=require(_0x493b('0x0'));var util=require(_0x493b('0x1'));var seqqueue=require(_0x493b('0x2'));var logger=require(_0x493b('0x3'))('routing');var strategy=require(_0x493b('0x4'));var queue=schema({'name':{'type':_0x493b('0x5'),'required':!![],'message':_0x493b('0x6')},'timeout':{'type':_0x493b('0x7'),'message':_0x493b('0x8')}});function writeLog(_0x3f10ab,_0x2383f1,_0x34c62d){return logger[_0x493b('0x9')](util['format'](_0x493b('0xa'),_0x3f10ab,_0x2383f1[_0x493b('0xb')],_0x34c62d));}function handleFindAgent(_0x55b0ea){return function(_0x47530f){return _0x47530f[_0x493b('0xb')][_0x493b('0xc')]()===_0x55b0ea[_0x493b('0xc')]();};}exports[_0x493b('0xd')]=function(_0x574fd0,_0x26a5e9,_0x1c39d1,_0x3badb7){return function(_0x209af9){try{var _0x2a925c={'name':_0x26a5e9[0x0],'timeout':_0x26a5e9[0x1]};var _0x1459f4=queue['validate'](_0x2a925c,{'typecast':!![]});if(_0x1459f4[_0x493b('0xe')]){logger[_0x493b('0xf')](_0x493b('0x10'),_0x574fd0,_[_0x493b('0x11')](_0x1459f4,_0x493b('0x12'))[_0x493b('0x13')](',\x20'));_0x209af9[_0x493b('0x14')]();}else{var _0x18257f=_[_0x493b('0x15')](_0x1c39d1[_0x493b('0x16')],handleFindAgent(_0x2a925c[_0x493b('0xb')]));if(_0x18257f){var _0x14bcc1=(_0x2a925c['timeout']||0xa)*0x3e8;var _0x522e39,_0x286e50;var _0x3d4aa0=seqqueue[_0x493b('0x17')](_0x14bcc1);_0x3d4aa0['id']=_0x574fd0;_0x3d4aa0[_0x493b('0x18')]=_0x14bcc1;_0x3d4aa0[_0x493b('0x19')]=_0x3badb7[_0x493b('0x19')];writeLog(_0x574fd0,_0x18257f,util[_0x493b('0x1a')]('START:%s',_0x14bcc1));_0x1c39d1[_0x493b('0x1b')][_0x574fd0]['on'](_0x493b('0x1c'),function(){logger['info'](_0x493b('0x1d'),_0x574fd0);clearTimeout(_0x286e50);_0x286e50=undefined;_0x3d4aa0[_0x493b('0x1e')]();if(_0x1c39d1[_0x493b('0x1b')][_0x574fd0]){delete _0x1c39d1[_0x493b('0x1b')][_0x574fd0];}_0x209af9[_0x493b('0x14')]();});_0x1c39d1[_0x493b('0x1b')][_0x574fd0]['on'](_0x493b('0x1f'),function(){if(_0x1c39d1[_0x493b('0x1b')][_0x574fd0]){delete _0x1c39d1[_0x493b('0x1b')][_0x574fd0];}});_0x286e50=setTimeout(function(){logger['info'](_0x493b('0x20'),_0x574fd0);clearTimeout(_0x286e50);_0x3d4aa0[_0x493b('0x1e')]();_0x209af9['next']();},_0x14bcc1);strategy['agent'](_0x3d4aa0,_0x18257f,_0x1c39d1,_0x3badb7);}else{logger[_0x493b('0xf')](_0x493b('0x21'),_0x574fd0,_0x2a925c['name']);_0x209af9['stop']();}}}catch(_0x4f978f){console[_0x493b('0x22')](_0x4f978f);logger[_0x493b('0xf')]('[%s][QUEUE]\x20%s',_0x574fd0,_0x4f978f[_0x493b('0x23')]);_0x209af9[_0x493b('0x14')]();}};}; \ No newline at end of file +var _0x2404=['stop','find','agents','timeout','atimeout','channel','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message'];(function(_0x6fb58d,_0x3f64ee){var _0x37b856=function(_0x39e429){while(--_0x39e429){_0x6fb58d['push'](_0x6fb58d['shift']());}};_0x37b856(++_0x3f64ee);}(_0x2404,0x140));var _0x4240=function(_0x128106,_0x4301dc){_0x128106=_0x128106-0x0;var _0x438d0b=_0x2404[_0x128106];return _0x438d0b;};'use strict';var schema=require(_0x4240('0x0'));var _=require(_0x4240('0x1'));var util=require(_0x4240('0x2'));var seqqueue=require(_0x4240('0x3'));var logger=require(_0x4240('0x4'))(_0x4240('0x5'));var strategy=require(_0x4240('0x6'));var queue=schema({'name':{'type':_0x4240('0x7'),'required':!![],'message':_0x4240('0x8')},'timeout':{'type':_0x4240('0x9'),'message':_0x4240('0xa')}});function writeLog(_0x510e2f,_0x895cd6,_0x44517e){return logger[_0x4240('0xb')](util[_0x4240('0xc')](_0x4240('0xd'),_0x510e2f,_0x895cd6[_0x4240('0xe')],_0x44517e));}function handleFindAgent(_0x2a431f){return function(_0x338339){return _0x338339[_0x4240('0xe')][_0x4240('0xf')]()===_0x2a431f[_0x4240('0xf')]();};}exports[_0x4240('0x10')]=function(_0x3867ec,_0x3fac07,_0x2fb75d,_0x266688){return function(_0x17a765){try{var _0xfb1a78={'name':_0x3fac07[0x0],'timeout':_0x3fac07[0x1]};var _0x51e244=queue[_0x4240('0x0')](_0xfb1a78,{'typecast':!![]});if(_0x51e244[_0x4240('0x11')]){logger[_0x4240('0x12')](_0x4240('0x13'),_0x3867ec,_[_0x4240('0x14')](_0x51e244,_0x4240('0x15'))['join'](',\x20'));_0x17a765[_0x4240('0x16')]();}else{var _0x5cc76b=_[_0x4240('0x17')](_0x2fb75d[_0x4240('0x18')],handleFindAgent(_0xfb1a78[_0x4240('0xe')]));if(_0x5cc76b){var _0x1f8323=(_0xfb1a78[_0x4240('0x19')]||0xa)*0x3e8;var _0x3607d8,_0x465a69;var _0x179d02=seqqueue['createQueue'](_0x1f8323);_0x179d02['id']=_0x3867ec;_0x179d02[_0x4240('0x1a')]=_0x1f8323;_0x179d02['channel']=_0x266688[_0x4240('0x1b')];writeLog(_0x3867ec,_0x5cc76b,util[_0x4240('0xc')](_0x4240('0x1c'),_0x1f8323));_0x2fb75d[_0x4240('0x1d')][_0x3867ec]['on'](_0x4240('0x1e'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3867ec);clearTimeout(_0x465a69);_0x465a69=undefined;_0x179d02[_0x4240('0x1f')]();if(_0x2fb75d[_0x4240('0x1d')][_0x3867ec]){delete _0x2fb75d[_0x4240('0x1d')][_0x3867ec];}_0x17a765[_0x4240('0x16')]();});_0x2fb75d[_0x4240('0x1d')][_0x3867ec]['on'](_0x4240('0x20'),function(){if(_0x2fb75d[_0x4240('0x1d')][_0x3867ec]){delete _0x2fb75d['rules'][_0x3867ec];}});_0x465a69=setTimeout(function(){logger[_0x4240('0xb')](_0x4240('0x21'),_0x3867ec);clearTimeout(_0x465a69);_0x179d02[_0x4240('0x1f')]();_0x17a765[_0x4240('0x22')]();},_0x1f8323);strategy[_0x4240('0x23')](_0x179d02,_0x5cc76b,_0x2fb75d,_0x266688);}else{logger['error'](_0x4240('0x24'),_0x3867ec,_0xfb1a78[_0x4240('0xe')]);_0x17a765['stop']();}}}catch(_0x3c14c4){console['log'](_0x3c14c4);logger[_0x4240('0x12')](_0x4240('0x25'),_0x3867ec,_0x3c14c4['stack']);_0x17a765['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 8fdf95c..d45ed0b 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 _0x16eb=['whatsapp','phone','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','toString','postText','message','amazonlex','providerName','then','dialogState','catch','lodash','aws-sdk','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms'];(function(_0x41aa13,_0x3a1ec6){var _0x1f32ae=function(_0x6580ae){while(--_0x6580ae){_0x41aa13['push'](_0x41aa13['shift']());}};_0x1f32ae(++_0x3a1ec6);}(_0x16eb,0x1c9));var _0xb16e=function(_0x23ad7b,_0x2cac4a){_0x23ad7b=_0x23ad7b-0x0;var _0x438d2a=_0x16eb[_0x23ad7b];return _0x438d2a;};'use strict';var _=require(_0xb16e('0x0'));var moment=require('moment');var AWS=require(_0xb16e('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb16e('0x2')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb16e('0x3')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xb16e('0x4')]=function(_0x1af656,_0x9f2961){return function(_0xefb7fd){try{if(!_[_0xb16e('0x5')](this[_0xb16e('0x6')]['UserId'])){logger[_0xb16e('0x7')](_0xb16e('0x8'),_0x1af656,_0xb16e('0x9'));return _0xefb7fd[_0xb16e('0xa')]();}var _0xcd959a={'ContactId':this['contact']['id'],'sentAt':moment()[_0xb16e('0xb')](_0xb16e('0xc')),'direction':_0xb16e('0xd')};if(this[_0xb16e('0xe')]===_0xb16e('0xf')||this[_0xb16e('0xe')]===_0xb16e('0x10')){_0xcd959a[_0xb16e('0x11')]=this[_0xb16e('0x6')][_0xb16e('0x11')];}var _0x540fdf=this['channel'];if(_0x540fdf==='chat'){_0xcd959a[_0xb16e('0x12')]=this['account']['id'];}else{_0xcd959a[_[_0xb16e('0x13')](_0x540fdf)+'AccountId']=this[_0xb16e('0x14')]['id'];}_0xcd959a[_['upperFirst'](_0x540fdf)+_0xb16e('0x15')]=this[_0xb16e('0x6')]['id'];if(this[_0xb16e('0x6')][_0xb16e('0x16')]){var _0xd4acb3=_0x9f2961[0x4];if(!_[_0xb16e('0x17')](_0xd4acb3)){_0xcd959a[_0xb16e('0x18')]=utils[_0xb16e('0x19')](_0xd4acb3,this);return rpc[_0x540fdf+_0xb16e('0x1a')][_0xb16e('0x1b')](_0xcd959a)['then'](function(_0x17551d){logger[_0xb16e('0x7')](_0xb16e('0x8'),_0x1af656,_0xcd959a[_0xb16e('0x18')]);})['catch'](function(_0x20dc99){logger[_0xb16e('0x1c')](_0xb16e('0x8'),_0x1af656,JSON[_0xb16e('0x1d')](_0x20dc99));})[_0xb16e('0x1e')](function(){logger[_0xb16e('0x7')](_0xb16e('0x1f'),_0x1af656);_0xefb7fd[_0xb16e('0x20')]();});}else{logger['info'](_0xb16e('0x21'),_0x1af656);_0xefb7fd[_0xb16e('0x20')]();}}else{var _0x4243e4=this;var _0x233d25=new AWS['LexRuntime']({'accessKeyId':_0x9f2961[0x0],'secretAccessKey':_0x9f2961[0x1],'region':_0x9f2961[0x2]});var _0x1de3f1={'botAlias':_0xb16e('0x22'),'botName':_0x9f2961[0x3],'inputText':this['message'][_0xb16e('0x18')],'userId':this['channel']+':'+this[_0xb16e('0x6')]['id'][_0xb16e('0x23')]()};_0x233d25[_0xb16e('0x24')](_0x1de3f1,function(_0x63d271,_0x2c29ef){if(_0x63d271){logger['error'](_0xb16e('0x8'),_0x1af656,_0x63d271[_0xb16e('0x25')]);_0xefb7fd[_0xb16e('0xa')]();}else if(_0x2c29ef&&_0x2c29ef[_0xb16e('0x25')]){_0x4243e4['body'][_0xb16e('0x26')]=_0x2c29ef;_0xcd959a['body']=_0x2c29ef[_0xb16e('0x25')];_0xcd959a[_0xb16e('0x27')]=_0xb16e('0x26');_0xcd959a['providerResponse']=JSON['stringify'](_0x2c29ef);return rpc[_0x540fdf+_0xb16e('0x1a')][_0xb16e('0x1b')](_0xcd959a)[_0xb16e('0x28')](function(_0x6d2bb5){logger['info'](_0xb16e('0x8'),_0x1af656,_0xcd959a[_0xb16e('0x18')]);if(_0x2c29ef[_0xb16e('0x29')]=='Failed'){_0xefb7fd[_0xb16e('0xa')]();}else{_0xefb7fd[_0xb16e('0x20')]();}})[_0xb16e('0x2a')](function(_0x52e9a9){logger[_0xb16e('0x1c')]('[%s][AMAZONLEX]\x20%s',_0x1af656,JSON[_0xb16e('0x1d')](_0x52e9a9));_0xefb7fd[_0xb16e('0xa')]();});}else{_0xefb7fd['next']();}});}}catch(_0x282ccf){logger[_0xb16e('0x1c')](_0xb16e('0x8'),_0x1af656,JSON[_0xb16e('0x1d')](_0x282ccf));_0xefb7fd[_0xb16e('0x20')]();}};}; \ No newline at end of file +var _0x0250=['stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','message','toString','postText','amazonlex','providerName','providerResponse','Failed','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','account','upperFirst','InteractionId','getMustacheRender','Message','then','body','catch','error'];(function(_0x513ef9,_0x45bf45){var _0x40462f=function(_0x142801){while(--_0x142801){_0x513ef9['push'](_0x513ef9['shift']());}};_0x40462f(++_0x45bf45);}(_0x0250,0x101));var _0x0025=function(_0x4fa672,_0x356d32){_0x4fa672=_0x4fa672-0x0;var _0x1974ac=_0x0250[_0x4fa672];return _0x1974ac;};'use strict';var _=require('lodash');var moment=require(_0x0025('0x0'));var AWS=require('aws-sdk');var utils=require(_0x0025('0x1'));var logger=require(_0x0025('0x2'))(_0x0025('0x3'));var rpc={'chatMessage':require(_0x0025('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0025('0x5')),'faxMessage':require(_0x0025('0x6')),'whatsappMessage':require(_0x0025('0x7'))};exports['consequence']=function(_0x3d74b3,_0x3b9405){return function(_0x15cdc8){try{if(!_[_0x0025('0x8')](this[_0x0025('0x9')][_0x0025('0xa')])){logger[_0x0025('0xb')](_0x0025('0xc'),_0x3d74b3,_0x0025('0xd'));return _0x15cdc8[_0x0025('0xe')]();}var _0x2674cc={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x0025('0xf')),'direction':_0x0025('0x10')};if(this[_0x0025('0x11')]===_0x0025('0x12')||this['channel']==='whatsapp'){_0x2674cc[_0x0025('0x13')]=this[_0x0025('0x9')][_0x0025('0x13')];}var _0xf4588c=this['channel'];if(_0xf4588c===_0x0025('0x14')){_0x2674cc['ChatWebsiteId']=this[_0x0025('0x15')]['id'];}else{_0x2674cc[_[_0x0025('0x16')](_0xf4588c)+'AccountId']=this[_0x0025('0x15')]['id'];}_0x2674cc[_[_0x0025('0x16')](_0xf4588c)+_0x0025('0x17')]=this['interaction']['id'];if(this[_0x0025('0x9')]['created']){var _0x5e03c1=_0x3b9405[0x4];if(!_['isEmpty'](_0x5e03c1)){_0x2674cc['body']=utils[_0x0025('0x18')](_0x5e03c1,this);return rpc[_0xf4588c+_0x0025('0x19')]['create'](_0x2674cc)[_0x0025('0x1a')](function(_0x12e042){logger[_0x0025('0xb')]('[%s][AMAZONLEX]\x20%s',_0x3d74b3,_0x2674cc[_0x0025('0x1b')]);})[_0x0025('0x1c')](function(_0x5788c8){logger[_0x0025('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x3d74b3,JSON[_0x0025('0x1e')](_0x5788c8));})['finally'](function(){logger[_0x0025('0xb')](_0x0025('0x1f'),_0x3d74b3);_0x15cdc8[_0x0025('0x20')]();});}else{logger[_0x0025('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3d74b3);_0x15cdc8['stop']();}}else{var _0x1473e6=this;var _0x6c8196=new AWS[(_0x0025('0x21'))]({'accessKeyId':_0x3b9405[0x0],'secretAccessKey':_0x3b9405[0x1],'region':_0x3b9405[0x2]});var _0x550c20={'botAlias':'$LATEST','botName':_0x3b9405[0x3],'inputText':this[_0x0025('0x22')][_0x0025('0x1b')],'userId':this[_0x0025('0x11')]+':'+this[_0x0025('0x9')]['id'][_0x0025('0x23')]()};_0x6c8196[_0x0025('0x24')](_0x550c20,function(_0x127dc7,_0x47dd85){if(_0x127dc7){logger[_0x0025('0x1d')](_0x0025('0xc'),_0x3d74b3,_0x127dc7[_0x0025('0x22')]);_0x15cdc8[_0x0025('0xe')]();}else if(_0x47dd85&&_0x47dd85[_0x0025('0x22')]){_0x1473e6['body'][_0x0025('0x25')]=_0x47dd85;_0x2674cc['body']=_0x47dd85[_0x0025('0x22')];_0x2674cc[_0x0025('0x26')]=_0x0025('0x25');_0x2674cc[_0x0025('0x27')]=JSON[_0x0025('0x1e')](_0x47dd85);return rpc[_0xf4588c+_0x0025('0x19')]['create'](_0x2674cc)['then'](function(_0x4b75c1){logger['info'](_0x0025('0xc'),_0x3d74b3,_0x2674cc['body']);if(_0x47dd85['dialogState']==_0x0025('0x28')){_0x15cdc8[_0x0025('0xe')]();}else{_0x15cdc8[_0x0025('0x20')]();}})[_0x0025('0x1c')](function(_0x23ebed){logger[_0x0025('0x1d')](_0x0025('0xc'),_0x3d74b3,JSON[_0x0025('0x1e')](_0x23ebed));_0x15cdc8['next']();});}else{_0x15cdc8[_0x0025('0xe')]();}});}}catch(_0x5aae54){logger[_0x0025('0x1d')](_0x0025('0xc'),_0x3d74b3,JSON[_0x0025('0x1e')](_0x5aae54));_0x15cdc8['stop']();}};}; \ 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 34e08d9..d32b43d 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 _0x6843=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','','replace','';_0x233042[_0x3684('0x33')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x3684('0x34'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x3684('0x2c')][_0x3684('0x35')],_0x233042)[_0x3684('0x36')](function(_0x4bc25d){logger[_0x3684('0x14')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3a81dc);_0x233042[_0x3684('0x37')]=_0x4bc25d[_0x3684('0x21')][_0x3684('0x37')];return rpc[_0x101ec7+_0x3684('0x2e')]['create'](_0x233042);})[_0x3684('0x36')](function(_0xbde346){logger[_0x3684('0x14')](_0x3684('0x19'),_0x3a81dc,JSON[_0x3684('0x38')](_0xbde346));})['catch'](function(_0x292a93){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x3a81dc,JSON[_0x3684('0x38')](_0x292a93));})['finally'](function(){Promise[_0x3684('0x39')]()[_0x3684('0x36')](function(){if(_0x4ee96f[0x0]!=='2'||_0x19bf45[_0x3684('0x1b')])return;return rpc[_0x101ec7+_0x3684('0x3a')][_0x3684('0x3b')](_0x19bf45['id'],{'autoreplyExecuted':!![]})[_0x3684('0x36')](function(_0x2073d1){logger[_0x3684('0x14')](_0x3684('0x1c'),_0x3a81dc,JSON[_0x3684('0x38')](_0x2073d1));})[_0x3684('0x3c')](function(_0x3f7abf){logger['error'](_0x3684('0x3d'),_0x3a81dc,JSON[_0x3684('0x38')](_0x3f7abf));});})[_0x3684('0x36')](function(){_0x4b0de2[_0x3684('0x16')]();});});}else{return rpc[this[_0x3684('0x11')]+_0x3684('0x2e')][_0x3684('0x3e')](_0x233042)[_0x3684('0x36')](function(){logger[_0x3684('0x14')](_0x3684('0x19'),_0x3a81dc,_0x233042[_0x3684('0x13')]);})[_0x3684('0x3c')](function(_0x5ba1c2){logger[_0x3684('0x3f')]('[%s][AUTOREPLY]\x20%s',_0x3a81dc,JSON['stringify'](_0x5ba1c2));})['finally'](function(){Promise[_0x3684('0x39')]()[_0x3684('0x36')](function(){if(_0x4ee96f[0x0]!=='2'||_0x19bf45[_0x3684('0x1b')])return;return rpc[_0x101ec7+_0x3684('0x3a')][_0x3684('0x3b')](_0x19bf45['id'],{'autoreplyExecuted':!![]})['then'](function(_0x218957){logger['info'](_0x3684('0x1c'),_0x3a81dc,JSON['stringify'](_0x218957));})['catch'](function(_0x5c603c){logger[_0x3684('0x3f')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3a81dc,JSON[_0x3684('0x38')](_0x5c603c));});})[_0x3684('0x36')](function(){_0x4b0de2['next']();});});}}}catch(_0x48d873){logger[_0x3684('0x3f')](_0x3684('0x19'),_0x3a81dc,JSON[_0x3684('0x38')](_0x48d873));_0x4b0de2['stop']();}};}; \ No newline at end of file +var _0x5db8=['../../rpc/mailInteraction','../../mailRpc','consequence','channel','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','upperFirst','account','InteractionId','Message','messageId','html','','','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','create','stringify','error','resolve','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','finally','update','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x2b5ffa,_0x8420cf){var _0x2bef51=function(_0x34c3dc){while(--_0x34c3dc){_0x2b5ffa['push'](_0x2b5ffa['shift']());}};_0x2bef51(++_0x8420cf);}(_0x5db8,0x13b));var _0x85db=function(_0x2dfd0e,_0x13739e){_0x2dfd0e=_0x2dfd0e-0x0;var _0x343af6=_0x5db8[_0x2dfd0e];return _0x343af6;};'use strict';var _=require(_0x85db('0x0'));var moment=require(_0x85db('0x1'));var utils=require(_0x85db('0x2'));var logger=require(_0x85db('0x3'))(_0x85db('0x4'));var rpc={'chatMessage':require(_0x85db('0x5')),'openchannelMessage':require(_0x85db('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x85db('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x85db('0x8')),'openchannelInteraction':require(_0x85db('0x9')),'mailInteraction':require(_0x85db('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x85db('0xb'));exports[_0x85db('0xc')]=function(_0x1efbc9,_0x52d983,_0x557142,_0x58af58){return function(_0x256a65){try{var _0x4603b1=this[_0x85db('0xd')];if(_0x4603b1==='mail'&&_0x58af58[_0x85db('0xe')]['isAutoreply']){logger[_0x85db('0xf')](_0x85db('0x10'),_0x1efbc9,_0x85db('0x11'));return _0x256a65[_0x85db('0x12')]();}if(_0x52d983[0x0]==='1'&&(_[_0x85db('0x13')](this[_0x85db('0x14')][_0x85db('0x15')])||!this[_0x85db('0x14')][_0x85db('0x15')])){logger[_0x85db('0xf')](_0x85db('0x10'),_0x1efbc9,_0x85db('0x16'));return _0x256a65['next']();}if(_0x52d983[0x0]==='2'&&this['interaction'][_0x85db('0x17')]){logger[_0x85db('0xf')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1efbc9,_0x85db('0x18'));return _0x256a65[_0x85db('0x12')]();}var _0x20f5a0={'ContactId':this[_0x85db('0x19')]['id'],'sentAt':moment()['format'](_0x85db('0x1a')),'direction':_0x85db('0x1b')};if(this['channel']===_0x85db('0x1c')){_0x20f5a0[_0x85db('0xe')]=utils[_0x85db('0x1d')](_0x52d983[0x2],this);}else{_0x20f5a0[_0x85db('0xe')]=utils[_0x85db('0x1d')](_0x52d983[0x1],this);}if(this[_0x85db('0x1e')]){_0x20f5a0['to']=this['message']['from']||'';if(this['channel']===_0x85db('0x1c')&&_0x52d983[0x1]==='1'){_0x20f5a0['cc']=this[_0x85db('0x1e')]['cc']||'';}_0x20f5a0[_0x85db('0x1f')]=this[_0x85db('0x1e')]['to']||'';_0x20f5a0[_0x85db('0x20')]=this[_0x85db('0x1e')][_0x85db('0x20')]||'';_0x20f5a0[_0x85db('0x21')]=!![];if(this[_0x85db('0x1e')][_0x85db('0x22')]){_0x20f5a0['subject']='';_0x20f5a0[_0x85db('0x22')]+=_[_0x85db('0x23')](this['message'][_0x85db('0x22')],_0x85db('0x24'))?'':_0x85db('0x25');_0x20f5a0[_0x85db('0x22')]+=this[_0x85db('0x1e')][_0x85db('0x22')];}}if(this['channel']===_0x85db('0x26')){_0x20f5a0['ChatWebsiteId']=this['account']['id'];}else{_0x20f5a0[_[_0x85db('0x27')](this[_0x85db('0xd')])+'AccountId']=this[_0x85db('0x28')]['id'];}_0x20f5a0[_['upperFirst'](this[_0x85db('0xd')])+_0x85db('0x29')]=this[_0x85db('0x14')]['id'];var _0x176549=this[_0x85db('0x14')];if(rpc[this[_0x85db('0xd')]+_0x85db('0x2a')]){if(this[_0x85db('0xd')]===_0x85db('0x1c')){_0x20f5a0['inReplyTo']=this['message'][_0x85db('0x2b')];_0x20f5a0[_0x85db('0x2c')]=_0x85db('0x2d')+_['replace'](_0x20f5a0[_0x85db('0xe')],_0x85db('0x2e'),_0x85db('0x2f'))+_0x85db('0x30');_0x20f5a0['headers']={'Auto-Submitted':_0x85db('0x31'),'X-Auto-Response-Suppress':_0x85db('0x32'),'Precedence':_0x85db('0x33')};return mailRpc[_0x85db('0x34')](this['account'][_0x85db('0x35')],_0x20f5a0)[_0x85db('0x36')](function(_0x2101c5){logger[_0x85db('0xf')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1efbc9);_0x20f5a0[_0x85db('0x2b')]=_0x2101c5[_0x85db('0x1e')][_0x85db('0x2b')];return rpc[_0x4603b1+_0x85db('0x2a')][_0x85db('0x37')](_0x20f5a0);})[_0x85db('0x36')](function(_0x2a0883){logger['info']('[%s][AUTOREPLY]\x20%s',_0x1efbc9,JSON[_0x85db('0x38')](_0x2a0883));})['catch'](function(_0x2f15a0){logger[_0x85db('0x39')]('[RPC][%s][AUTOREPLY]\x20%s',_0x1efbc9,JSON[_0x85db('0x38')](_0x2f15a0));})['finally'](function(){Promise[_0x85db('0x3a')]()[_0x85db('0x36')](function(){if(_0x52d983[0x0]!=='2'||_0x176549[_0x85db('0x17')])return;return rpc[_0x4603b1+'Interaction']['update'](_0x176549['id'],{'autoreplyExecuted':!![]})['then'](function(_0x11eb91){logger[_0x85db('0xf')](_0x85db('0x3b'),_0x1efbc9,JSON[_0x85db('0x38')](_0x11eb91));})['catch'](function(_0x4cdb1f){logger[_0x85db('0x39')](_0x85db('0x3c'),_0x1efbc9,JSON['stringify'](_0x4cdb1f));});})['then'](function(){_0x256a65['next']();});});}else{return rpc[this[_0x85db('0xd')]+'Message'][_0x85db('0x37')](_0x20f5a0)[_0x85db('0x36')](function(){logger[_0x85db('0xf')](_0x85db('0x10'),_0x1efbc9,_0x20f5a0['body']);})[_0x85db('0x3d')](function(_0x46ab8b){logger[_0x85db('0x39')](_0x85db('0x10'),_0x1efbc9,JSON['stringify'](_0x46ab8b));})[_0x85db('0x3e')](function(){Promise[_0x85db('0x3a')]()[_0x85db('0x36')](function(){if(_0x52d983[0x0]!=='2'||_0x176549[_0x85db('0x17')])return;return rpc[_0x4603b1+'Interaction'][_0x85db('0x3f')](_0x176549['id'],{'autoreplyExecuted':!![]})[_0x85db('0x36')](function(_0x2801cc){logger[_0x85db('0xf')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1efbc9,JSON[_0x85db('0x38')](_0x2801cc));})[_0x85db('0x3d')](function(_0x4c39ce){logger['error'](_0x85db('0x3c'),_0x1efbc9,JSON['stringify'](_0x4c39ce));});})[_0x85db('0x36')](function(){_0x256a65['next']();});});}}}catch(_0x212603){logger[_0x85db('0x39')](_0x85db('0x10'),_0x1efbc9,JSON[_0x85db('0x38')](_0x212603));_0x256a65[_0x85db('0x40')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 242776f..f7ba862 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcc0=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','info','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','channel','interaction','catch','error','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger'];(function(_0x4fb4c7,_0x856112){var _0x10eab0=function(_0x3196be){while(--_0x3196be){_0x4fb4c7['push'](_0x4fb4c7['shift']());}};_0x10eab0(++_0x856112);}(_0xbcc0,0xfd));var _0x0bcc=function(_0x204893,_0x4daa6e){_0x204893=_0x204893-0x0;var _0x58512b=_0xbcc0[_0x204893];return _0x58512b;};'use strict';var moment=require(_0x0bcc('0x0'));var logger=require(_0x0bcc('0x1'))(_0x0bcc('0x2'));var rpc={'chatInteraction':require(_0x0bcc('0x3')),'openchannelInteraction':require(_0x0bcc('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0bcc('0x5'))};exports['consequence']=function(_0x259c7c,_0x18fb3e,_0x38fe40,_0x453cd7){return function(_0x1a034b){try{logger[_0x0bcc('0x6')]('[%s][CLOSE]\x20reason\x20%s',_0x259c7c,_0x18fb3e[0x0]);var _0x4bd74d={'closed':0x1,'closedAt':moment()[_0x0bcc('0x7')](_0x0bcc('0x8')),'closeReason':'system','disposition':_0x18fb3e[0x0]};if(rpc[_0x453cd7['channel']+_0x0bcc('0x9')]){rpc[_0x453cd7[_0x0bcc('0xa')]+'Interaction']['update'](_0x453cd7[_0x0bcc('0xb')]['id'],_0x4bd74d)['then'](function(_0x7a4b8a){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x259c7c,_0x453cd7['interaction']['id']);})[_0x0bcc('0xc')](function(_0x120c55){logger[_0x0bcc('0xd')]('[%s][CLOSE]\x20%s',_0x259c7c,JSON['stringify'](_0x120c55));})[_0x0bcc('0xe')](function(){_0x1a034b[_0x0bcc('0xf')]();});}}catch(_0x27f169){logger[_0x0bcc('0xd')](_0x0bcc('0x10'),_0x259c7c,JSON['stringify'](_0x27f169));_0x1a034b[_0x0bcc('0xf')]();}};}; \ No newline at end of file +var _0x4f42=['system','Interaction','channel','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','finally','stringify','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x281f72,_0x3c5e70){var _0x2166b0=function(_0x39b426){while(--_0x39b426){_0x281f72['push'](_0x281f72['shift']());}};_0x2166b0(++_0x3c5e70);}(_0x4f42,0x1c0));var _0x24f4=function(_0x218b4e,_0x51328b){_0x218b4e=_0x218b4e-0x0;var _0xa8b20=_0x4f42[_0x218b4e];return _0xa8b20;};'use strict';var moment=require('moment');var logger=require(_0x24f4('0x0'))(_0x24f4('0x1'));var rpc={'chatInteraction':require(_0x24f4('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x24f4('0x3')),'mailInteraction':require(_0x24f4('0x4')),'faxInteraction':require(_0x24f4('0x5')),'whatsappInteraction':require(_0x24f4('0x6'))};exports[_0x24f4('0x7')]=function(_0x2c8de3,_0x2a4167,_0x5dfd39,_0x46b87d){return function(_0x274858){try{logger[_0x24f4('0x8')](_0x24f4('0x9'),_0x2c8de3,_0x2a4167[0x0]);var _0x55781d={'closed':0x1,'closedAt':moment()[_0x24f4('0xa')](_0x24f4('0xb')),'closeReason':_0x24f4('0xc'),'disposition':_0x2a4167[0x0]};if(rpc[_0x46b87d['channel']+_0x24f4('0xd')]){rpc[_0x46b87d[_0x24f4('0xe')]+'Interaction'][_0x24f4('0xf')](_0x46b87d['interaction']['id'],_0x55781d)['then'](function(_0xbe62d){logger[_0x24f4('0x8')](_0x24f4('0x10'),_0x2c8de3,_0x46b87d[_0x24f4('0x11')]['id']);})[_0x24f4('0x12')](function(_0x1834ce){logger[_0x24f4('0x13')](_0x24f4('0x14'),_0x2c8de3,JSON['stringify'](_0x1834ce));})[_0x24f4('0x15')](function(){_0x274858['stop']();});}}catch(_0x2a1d02){logger[_0x24f4('0x13')](_0x24f4('0x14'),_0x2c8de3,JSON[_0x24f4('0x16')](_0x2a1d02));_0x274858['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index bcd39fd..88d0bcc 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7ce=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','Message','create','then','body','catch','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','speech','providerName','providerResponse','result','metadata','endConversation','error','lodash','moment','apiai-promise','md5','routing'];(function(_0x4f1317,_0x566dea){var _0x367203=function(_0x319924){while(--_0x319924){_0x4f1317['push'](_0x4f1317['shift']());}};_0x367203(++_0x566dea);}(_0xd7ce,0x16b));var _0xed7c=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0xd7ce[_0x764874];return _0x29f9d5;};'use strict';var _=require(_0xed7c('0x0'));var moment=require(_0xed7c('0x1'));var apiai=require(_0xed7c('0x2'));var md5=require(_0xed7c('0x3'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xed7c('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xed7c('0x5')),'faxMessage':require(_0xed7c('0x6')),'whatsappMessage':require(_0xed7c('0x7'))};exports[_0xed7c('0x8')]=function(_0x34bbd7,_0x43a9e7){return function(_0x41afb9){try{if(!_[_0xed7c('0x9')](this[_0xed7c('0xa')][_0xed7c('0xb')])){logger[_0xed7c('0xc')](_0xed7c('0xd'),_0x34bbd7,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x41afb9[_0xed7c('0xe')]();}var _0x1e337e={'ContactId':this[_0xed7c('0xf')]['id'],'sentAt':moment()[_0xed7c('0x10')](_0xed7c('0x11')),'direction':_0xed7c('0x12')};if(this['channel']===_0xed7c('0x13')||this['channel']==='whatsapp'){_0x1e337e['phone']=this[_0xed7c('0xa')][_0xed7c('0x14')];}var _0x52cf82=this['channel'];if(_0x52cf82==='chat'){_0x1e337e[_0xed7c('0x15')]=this['account']['id'];}else{_0x1e337e[_[_0xed7c('0x16')](_0x52cf82)+_0xed7c('0x17')]=this['account']['id'];}_0x1e337e[_[_0xed7c('0x16')](_0x52cf82)+_0xed7c('0x18')]=this['interaction']['id'];if(this['interaction'][_0xed7c('0x19')]){var _0x28d260=_0x43a9e7[0x2];if(!_[_0xed7c('0x1a')](_0x28d260)){_0x1e337e['body']=utils['getMustacheRender'](_0x28d260,this);return rpc[_0x52cf82+_0xed7c('0x1b')][_0xed7c('0x1c')](_0x1e337e)[_0xed7c('0x1d')](function(_0x1be073){logger[_0xed7c('0xc')](_0xed7c('0xd'),_0x34bbd7,_0x1e337e[_0xed7c('0x1e')]);})[_0xed7c('0x1f')](function(_0x2500be){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x34bbd7,JSON[_0xed7c('0x20')](_0x2500be));})['finally'](function(){logger[_0xed7c('0xc')](_0xed7c('0x21'),_0x34bbd7);_0x41afb9[_0xed7c('0x22')]();});}else{logger['info'](_0xed7c('0x23'),_0x34bbd7);_0x41afb9[_0xed7c('0x22')]();}}else{var _0x2b4043=this;var _0x177cdf=apiai(_0x43a9e7[0x0],{'language':_0x43a9e7[0x1]||'en'});return _0x177cdf[_0xed7c('0x24')](this[_0xed7c('0x25')][_0xed7c('0x1e')],{'sessionId':md5(this[_0xed7c('0xa')]['id'])})[_0xed7c('0x1d')](function(_0x10e1e1){_0x2b4043[_0xed7c('0x1e')][_0xed7c('0x26')]=_0x10e1e1;_0x1e337e['body']=_0x10e1e1['result']['fulfillment'][_0xed7c('0x27')];_0x1e337e[_0xed7c('0x28')]=_0xed7c('0x26');_0x1e337e[_0xed7c('0x29')]=JSON[_0xed7c('0x20')](_0x10e1e1);return rpc[_0x52cf82+_0xed7c('0x1b')][_0xed7c('0x1c')](_0x1e337e)[_0xed7c('0x1d')](function(_0x183874){logger[_0xed7c('0xc')](_0xed7c('0xd'),_0x34bbd7,_0x1e337e['body']);if(_0x10e1e1[_0xed7c('0x2a')][_0xed7c('0x2b')][_0xed7c('0x2c')]){_0x41afb9[_0xed7c('0xe')]();}else{_0x41afb9[_0xed7c('0x22')]();}})['catch'](function(_0x5301fb){logger[_0xed7c('0x2d')](_0xed7c('0xd'),_0x34bbd7,JSON['stringify'](_0x5301fb));_0x41afb9[_0xed7c('0xe')]();});})[_0xed7c('0x1f')](function(_0x4c8d17){logger['error'](_0xed7c('0xd'),_0x34bbd7,_0x4c8d17[_0xed7c('0x25')]);_0x41afb9[_0xed7c('0xe')]();});}}catch(_0x540a82){logger[_0xed7c('0x2d')]('[%s][DIALOGFLOW]\x20%s',_0x34bbd7,JSON[_0xed7c('0x20')](_0x540a82));_0x41afb9[_0xed7c('0x22')]();}};}; \ No newline at end of file +var _0x7046=['then','info','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','Message','create'];(function(_0x5f18e1,_0x2bc4de){var _0x21b751=function(_0x522941){while(--_0x522941){_0x5f18e1['push'](_0x5f18e1['shift']());}};_0x21b751(++_0x2bc4de);}(_0x7046,0x144));var _0x6704=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7046[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x6704('0x0'));var moment=require(_0x6704('0x1'));var apiai=require(_0x6704('0x2'));var md5=require(_0x6704('0x3'));var utils=require('./utils');var logger=require(_0x6704('0x4'))(_0x6704('0x5'));var rpc={'chatMessage':require(_0x6704('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6704('0x7')),'smsMessage':require(_0x6704('0x8')),'faxMessage':require(_0x6704('0x9')),'whatsappMessage':require(_0x6704('0xa'))};exports[_0x6704('0xb')]=function(_0x4badf8,_0x5ced8){return function(_0x49b8b6){try{if(!_['isNil'](this[_0x6704('0xc')]['UserId'])){logger['info'](_0x6704('0xd'),_0x4badf8,_0x6704('0xe'));return _0x49b8b6[_0x6704('0xf')]();}var _0x454bd5={'ContactId':this[_0x6704('0x10')]['id'],'sentAt':moment()[_0x6704('0x11')](_0x6704('0x12')),'direction':_0x6704('0x13')};if(this['channel']===_0x6704('0x14')||this[_0x6704('0x15')]==='whatsapp'){_0x454bd5[_0x6704('0x16')]=this[_0x6704('0xc')][_0x6704('0x16')];}var _0x13b8f4=this[_0x6704('0x15')];if(_0x13b8f4===_0x6704('0x17')){_0x454bd5[_0x6704('0x18')]=this[_0x6704('0x19')]['id'];}else{_0x454bd5[_[_0x6704('0x1a')](_0x13b8f4)+'AccountId']=this[_0x6704('0x19')]['id'];}_0x454bd5[_[_0x6704('0x1a')](_0x13b8f4)+_0x6704('0x1b')]=this['interaction']['id'];if(this[_0x6704('0xc')][_0x6704('0x1c')]){var _0x3e7d1f=_0x5ced8[0x2];if(!_[_0x6704('0x1d')](_0x3e7d1f)){_0x454bd5[_0x6704('0x1e')]=utils['getMustacheRender'](_0x3e7d1f,this);return rpc[_0x13b8f4+_0x6704('0x1f')][_0x6704('0x20')](_0x454bd5)[_0x6704('0x21')](function(_0xe49450){logger[_0x6704('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x4badf8,_0x454bd5[_0x6704('0x1e')]);})[_0x6704('0x23')](function(_0x13e0c7){logger[_0x6704('0x24')](_0x6704('0xd'),_0x4badf8,JSON[_0x6704('0x25')](_0x13e0c7));})[_0x6704('0x26')](function(){logger['info'](_0x6704('0x27'),_0x4badf8);_0x49b8b6[_0x6704('0x28')]();});}else{logger[_0x6704('0x22')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4badf8);_0x49b8b6['stop']();}}else{var _0x48d829=this;var _0x3e183b=apiai(_0x5ced8[0x0],{'language':_0x5ced8[0x1]||'en'});return _0x3e183b[_0x6704('0x29')](this[_0x6704('0x2a')][_0x6704('0x1e')],{'sessionId':md5(this['interaction']['id'])})[_0x6704('0x21')](function(_0xabb97a){_0x48d829[_0x6704('0x1e')][_0x6704('0x2b')]=_0xabb97a;_0x454bd5[_0x6704('0x1e')]=_0xabb97a[_0x6704('0x2c')][_0x6704('0x2d')][_0x6704('0x2e')];_0x454bd5[_0x6704('0x2f')]=_0x6704('0x2b');_0x454bd5[_0x6704('0x30')]=JSON[_0x6704('0x25')](_0xabb97a);return rpc[_0x13b8f4+_0x6704('0x1f')]['create'](_0x454bd5)['then'](function(_0x167312){logger[_0x6704('0x22')](_0x6704('0xd'),_0x4badf8,_0x454bd5[_0x6704('0x1e')]);if(_0xabb97a['result'][_0x6704('0x31')][_0x6704('0x32')]){_0x49b8b6['next']();}else{_0x49b8b6['stop']();}})[_0x6704('0x23')](function(_0x5363c9){logger[_0x6704('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x4badf8,JSON['stringify'](_0x5363c9));_0x49b8b6[_0x6704('0xf')]();});})[_0x6704('0x23')](function(_0x45a286){logger['error'](_0x6704('0xd'),_0x4badf8,_0x45a286[_0x6704('0x2a')]);_0x49b8b6[_0x6704('0xf')]();});}}catch(_0x1c35ab){logger[_0x6704('0x24')](_0x6704('0xd'),_0x4badf8,JSON[_0x6704('0x25')](_0x1c35ab));_0x49b8b6[_0x6704('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index b757e08..bb9e00e 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c67=['getMustacheRender','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','body','Message','create','then','info','catch','error','stringify','consequence','isNil','interaction','UserId','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId'];(function(_0x44e9d8,_0x13c3cd){var _0x32a396=function(_0x2942b0){while(--_0x2942b0){_0x44e9d8['push'](_0x44e9d8['shift']());}};_0x32a396(++_0x13c3cd);}(_0x2c67,0x1c3));var _0x72c6=function(_0xe695dc,_0x227af8){_0xe695dc=_0xe695dc-0x0;var _0x487e07=_0x2c67[_0xe695dc];return _0x487e07;};'use strict';var _=require(_0x72c6('0x0'));var dialogflow=require(_0x72c6('0x1'));var md5=require(_0x72c6('0x2'));var moment=require(_0x72c6('0x3'));var Promise=require(_0x72c6('0x4'));var logger=require(_0x72c6('0x5'))(_0x72c6('0x6'));var utils=require(_0x72c6('0x7'));var rpc={'chatMessage':require(_0x72c6('0x8')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x72c6('0x9')),'smsMessage':require(_0x72c6('0xa')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x72c6('0xb'))};function createMessage(_0x1c0c6a,_0xeaaa40,_0x477b92,_0x123d76){return new Promise(function(_0x1d58ca,_0x6ba9b5){var _0x462020=_['clone'](_0x477b92);_0x462020[_0x72c6('0xc')]=_0x123d76;return rpc[_0xeaaa40+_0x72c6('0xd')][_0x72c6('0xe')](_0x462020)[_0x72c6('0xf')](function(){logger[_0x72c6('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c0c6a,_0x462020['body']);_0x1d58ca();})[_0x72c6('0x11')](function(_0xcfabc5){logger[_0x72c6('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c0c6a,JSON[_0x72c6('0x13')](_0xcfabc5));_0x6ba9b5(_0xcfabc5);});});}exports[_0x72c6('0x14')]=function(_0x149bf4,_0x1b7188){return function(_0x28fc7e){try{if(!_[_0x72c6('0x15')](this[_0x72c6('0x16')][_0x72c6('0x17')])){logger[_0x72c6('0x10')](_0x72c6('0x18'),_0x149bf4,_0x72c6('0x19'));return _0x28fc7e[_0x72c6('0x1a')]();}var _0x16842a={'ContactId':this['contact']['id'],'sentAt':moment()[_0x72c6('0x1b')](_0x72c6('0x1c')),'direction':_0x72c6('0x1d')};if(this['channel']===_0x72c6('0x1e')||this[_0x72c6('0x1f')]==='whatsapp'){_0x16842a['phone']=this[_0x72c6('0x16')][_0x72c6('0x20')];}var _0x19c506=this[_0x72c6('0x1f')];if(_0x19c506===_0x72c6('0x21')){_0x16842a[_0x72c6('0x22')]=this[_0x72c6('0x23')]['id'];}else{_0x16842a[_[_0x72c6('0x24')](_0x19c506)+_0x72c6('0x25')]=this[_0x72c6('0x23')]['id'];}_0x16842a[_[_0x72c6('0x24')](_0x19c506)+_0x72c6('0x26')]=this['interaction']['id'];if(this[_0x72c6('0x16')]['created']){var _0x10c33f=_0x1b7188[0x4];if(!_['isEmpty'](_0x10c33f)){_0x16842a[_0x72c6('0xc')]=utils[_0x72c6('0x27')](_0x10c33f,this);return rpc[_0x19c506+_0x72c6('0xd')][_0x72c6('0xe')](_0x16842a)[_0x72c6('0xf')](function(_0x2406e3){logger[_0x72c6('0x10')](_0x72c6('0x18'),_0x149bf4,_0x16842a[_0x72c6('0xc')]);})[_0x72c6('0x11')](function(_0x560e8c){logger[_0x72c6('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x149bf4,JSON[_0x72c6('0x13')](_0x560e8c));})[_0x72c6('0x28')](function(){logger[_0x72c6('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x149bf4);_0x28fc7e[_0x72c6('0x29')]();});}else{logger[_0x72c6('0x10')](_0x72c6('0x2a'),_0x149bf4);_0x28fc7e['stop']();}}else{var _0x3f825e=this;var _0x3da153=_0x1b7188[0x2]['replace'](/\\n/g,'\x0a');var _0x13d679={'credentials':{'private_key':_0x3da153,'client_email':_0x1b7188[0x1]}};var _0x41622b=new dialogflow[(_0x72c6('0x2b'))](_0x13d679);var _0x51758d=_0x41622b[_0x72c6('0x2c')](_0x1b7188[0x0],md5(_0x3f825e['interaction']['id']));var _0x49f9d7={'session':_0x51758d,'queryInput':{'text':{'text':_0x3f825e[_0x72c6('0x2d')][_0x72c6('0xc')],'languageCode':_0x1b7188[0x3]||'en'}}};return _0x41622b[_0x72c6('0x2e')](_0x49f9d7)[_0x72c6('0xf')](function(_0x4f1b21){if(_0x4f1b21&&_0x4f1b21[_0x72c6('0x2f')]){_0x3f825e[_0x72c6('0xc')][_0x72c6('0x30')]=_0x4f1b21;var _0x21305e=_0x4f1b21[0x0];var _0x50be0a=_0x21305e[_0x72c6('0x31')][_0x72c6('0x32')]&&_0x21305e[_0x72c6('0x31')][_0x72c6('0x32')][_0x72c6('0x33')]?_0x21305e[_0x72c6('0x31')][_0x72c6('0x32')][_0x72c6('0x33')][_0x72c6('0x34')][_0x72c6('0x35')]:![];_0x3f825e[_0x72c6('0xc')][_0x72c6('0x36')]=_0x21305e[_0x72c6('0x31')][_0x72c6('0x37')];_0x3f825e[_0x72c6('0xc')][_0x72c6('0x38')]=_0x21305e['queryResult']['allRequiredParamsPresent'];_0x3f825e[_0x72c6('0xc')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x21305e[_0x72c6('0x31')]['diagnosticInfo']&&_0x21305e[_0x72c6('0x31')][_0x72c6('0x32')]['fields']?_0x21305e[_0x72c6('0x31')][_0x72c6('0x32')][_0x72c6('0x33')][_0x72c6('0x34')][_0x72c6('0x35')]:![];_0x3f825e['body'][_0x72c6('0x39')]=_0x21305e[_0x72c6('0x31')][_0x72c6('0x3a')][_0x72c6('0x3b')];_0x3f825e[_0x72c6('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x21305e[_0x72c6('0x31')][_0x72c6('0x3a')][_0x72c6('0x3c')];_0x3f825e['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x21305e[_0x72c6('0x31')][_0x72c6('0x3a')]['isFallback'];_0x3f825e[_0x72c6('0xc')][_0x72c6('0x3d')]=_0x21305e[_0x72c6('0x31')]['languageCode'];_0x3f825e['body'][_0x72c6('0x3e')]=_0x21305e['queryResult']['queryText'];_0x3f825e[_0x72c6('0xc')][_0x72c6('0x3f')]=_0x21305e[_0x72c6('0x31')][_0x72c6('0x40')];_0x16842a['providerName']=_0x72c6('0x30');_0x16842a[_0x72c6('0x41')]=JSON[_0x72c6('0x13')](_0x4f1b21);var _0xd5713f=[];for(var _0x23d080=0x0;_0x23d080<_0x4f1b21[_0x72c6('0x2f')];_0x23d080++){var _0x49ff6b=_0x4f1b21[_0x23d080];if(_0x49ff6b&&_0x49ff6b[_0x72c6('0x31')]&&_0x49ff6b[_0x72c6('0x31')][_0x72c6('0x42')]){_0xd5713f[_0x72c6('0x43')](createMessage(_0x149bf4,_0x19c506,_0x16842a,_0x49ff6b['queryResult'][_0x72c6('0x42')]));}}return Promise[_0x72c6('0x44')](_0xd5713f)['then'](function(){if(_0x50be0a){_0x28fc7e['next']();}else{_0x28fc7e['stop']();}})[_0x72c6('0x11')](function(_0x23f59b){logger[_0x72c6('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x149bf4,JSON['stringify'](_0x23f59b));_0x28fc7e[_0x72c6('0x1a')]();});}})[_0x72c6('0x11')](function(_0x1eda99){logger[_0x72c6('0x12')](_0x72c6('0x18'),_0x149bf4,_0x1eda99['message'],_0x1eda99[_0x72c6('0x45')]);_0x28fc7e[_0x72c6('0x1a')]();});}}catch(_0x2f06ae){logger['error'](_0x72c6('0x18'),_0x149bf4,JSON[_0x72c6('0x13')](_0x2f06ae));_0x28fc7e[_0x72c6('0x29')]();}};}; \ No newline at end of file +var _0x4f02=['fulfillmentText','all','next','stack','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','error','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','length','dialogflowV2','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','queryResult','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4f02,0x1ae));var _0x24f0=function(_0x3496bd,_0x1d968e){_0x3496bd=_0x3496bd-0x0;var _0x38bc16=_0x4f02[_0x3496bd];return _0x38bc16;};'use strict';var _=require(_0x24f0('0x0'));var dialogflow=require(_0x24f0('0x1'));var md5=require(_0x24f0('0x2'));var moment=require('moment');var Promise=require(_0x24f0('0x3'));var logger=require(_0x24f0('0x4'))(_0x24f0('0x5'));var utils=require(_0x24f0('0x6'));var rpc={'chatMessage':require(_0x24f0('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x24f0('0x8')),'smsMessage':require(_0x24f0('0x9')),'faxMessage':require(_0x24f0('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0xfd00fc,_0x4cd507,_0x873e72,_0x15b9f1){return new Promise(function(_0x331e96,_0x2cc9a0){var _0x35a54a=_['clone'](_0x873e72);_0x35a54a['body']=_0x15b9f1;return rpc[_0x4cd507+'Message'][_0x24f0('0xb')](_0x35a54a)[_0x24f0('0xc')](function(){logger[_0x24f0('0xd')](_0x24f0('0xe'),_0xfd00fc,_0x35a54a['body']);_0x331e96();})[_0x24f0('0xf')](function(_0x438f5f){logger['error'](_0x24f0('0xe'),_0xfd00fc,JSON['stringify'](_0x438f5f));_0x2cc9a0(_0x438f5f);});});}exports['consequence']=function(_0x50b9b1,_0x123bda){return function(_0x5c9d02){try{if(!_[_0x24f0('0x10')](this[_0x24f0('0x11')]['UserId'])){logger[_0x24f0('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x50b9b1,_0x24f0('0x12'));return _0x5c9d02['next']();}var _0x4f1c8a={'ContactId':this[_0x24f0('0x13')]['id'],'sentAt':moment()['format'](_0x24f0('0x14')),'direction':'out'};if(this['channel']===_0x24f0('0x15')||this[_0x24f0('0x16')]===_0x24f0('0x17')){_0x4f1c8a[_0x24f0('0x18')]=this[_0x24f0('0x11')]['phone'];}var _0x1a585d=this[_0x24f0('0x16')];if(_0x1a585d===_0x24f0('0x19')){_0x4f1c8a[_0x24f0('0x1a')]=this[_0x24f0('0x1b')]['id'];}else{_0x4f1c8a[_[_0x24f0('0x1c')](_0x1a585d)+'AccountId']=this[_0x24f0('0x1b')]['id'];}_0x4f1c8a[_[_0x24f0('0x1c')](_0x1a585d)+_0x24f0('0x1d')]=this[_0x24f0('0x11')]['id'];if(this[_0x24f0('0x11')][_0x24f0('0x1e')]){var _0x2aaed0=_0x123bda[0x4];if(!_[_0x24f0('0x1f')](_0x2aaed0)){_0x4f1c8a[_0x24f0('0x20')]=utils[_0x24f0('0x21')](_0x2aaed0,this);return rpc[_0x1a585d+_0x24f0('0x22')][_0x24f0('0xb')](_0x4f1c8a)[_0x24f0('0xc')](function(_0x18ae04){logger['info'](_0x24f0('0xe'),_0x50b9b1,_0x4f1c8a[_0x24f0('0x20')]);})[_0x24f0('0xf')](function(_0x3f89d7){logger[_0x24f0('0x23')](_0x24f0('0xe'),_0x50b9b1,JSON[_0x24f0('0x24')](_0x3f89d7));})[_0x24f0('0x25')](function(){logger[_0x24f0('0xd')](_0x24f0('0x26'),_0x50b9b1);_0x5c9d02[_0x24f0('0x27')]();});}else{logger[_0x24f0('0xd')](_0x24f0('0x28'),_0x50b9b1);_0x5c9d02[_0x24f0('0x27')]();}}else{var _0x2775d2=this;var _0x59825f=_0x123bda[0x2]['replace'](/\\n/g,'\x0a');var _0x597fd9={'credentials':{'private_key':_0x59825f,'client_email':_0x123bda[0x1]}};var _0x4cac76=new dialogflow[(_0x24f0('0x29'))](_0x597fd9);var _0x3336bf=_0x4cac76[_0x24f0('0x2a')](_0x123bda[0x0],md5(_0x2775d2[_0x24f0('0x11')]['id']));var _0x58515e={'session':_0x3336bf,'queryInput':{'text':{'text':_0x2775d2[_0x24f0('0x2b')][_0x24f0('0x20')],'languageCode':_0x123bda[0x3]||'en'}}};return _0x4cac76['detectIntent'](_0x58515e)[_0x24f0('0xc')](function(_0x403c53){if(_0x403c53&&_0x403c53[_0x24f0('0x2c')]){_0x2775d2[_0x24f0('0x20')][_0x24f0('0x2d')]=_0x403c53;var _0x595d18=_0x403c53[0x0];var _0x132903=_0x595d18['queryResult'][_0x24f0('0x2e')]&&_0x595d18['queryResult'][_0x24f0('0x2e')]['fields']?_0x595d18['queryResult'][_0x24f0('0x2e')][_0x24f0('0x2f')]['end_conversation'][_0x24f0('0x30')]:![];_0x2775d2[_0x24f0('0x20')][_0x24f0('0x31')]=_0x595d18[_0x24f0('0x32')]['action'];_0x2775d2[_0x24f0('0x20')][_0x24f0('0x33')]=_0x595d18['queryResult']['allRequiredParamsPresent'];_0x2775d2['body'][_0x24f0('0x34')]=_0x595d18[_0x24f0('0x32')][_0x24f0('0x2e')]&&_0x595d18[_0x24f0('0x32')][_0x24f0('0x2e')][_0x24f0('0x2f')]?_0x595d18[_0x24f0('0x32')][_0x24f0('0x2e')][_0x24f0('0x2f')][_0x24f0('0x35')]['boolValue']:![];_0x2775d2[_0x24f0('0x20')][_0x24f0('0x36')]=_0x595d18['queryResult'][_0x24f0('0x37')][_0x24f0('0x38')];_0x2775d2['body'][_0x24f0('0x39')]=_0x595d18['queryResult'][_0x24f0('0x37')][_0x24f0('0x3a')];_0x2775d2['body'][_0x24f0('0x3b')]=_0x595d18[_0x24f0('0x32')]['intent'][_0x24f0('0x3c')];_0x2775d2[_0x24f0('0x20')]['DIALOGFLOWV2_LANGUAGECODE']=_0x595d18[_0x24f0('0x32')][_0x24f0('0x3d')];_0x2775d2[_0x24f0('0x20')]['DIALOGFLOWV2_QUERYTEXT']=_0x595d18[_0x24f0('0x32')][_0x24f0('0x3e')];_0x2775d2[_0x24f0('0x20')][_0x24f0('0x3f')]=_0x595d18[_0x24f0('0x32')][_0x24f0('0x40')];_0x4f1c8a[_0x24f0('0x41')]='dialogflowV2';_0x4f1c8a[_0x24f0('0x42')]=JSON[_0x24f0('0x24')](_0x403c53);var _0x57f759=[];for(var _0x2222cc=0x0;_0x2222cc<_0x403c53[_0x24f0('0x2c')];_0x2222cc++){var _0x4a5f08=_0x403c53[_0x2222cc];if(_0x4a5f08&&_0x4a5f08[_0x24f0('0x32')]&&_0x4a5f08[_0x24f0('0x32')][_0x24f0('0x43')]){_0x57f759['push'](createMessage(_0x50b9b1,_0x1a585d,_0x4f1c8a,_0x4a5f08[_0x24f0('0x32')][_0x24f0('0x43')]));}}return Promise[_0x24f0('0x44')](_0x57f759)[_0x24f0('0xc')](function(){if(_0x132903){_0x5c9d02[_0x24f0('0x45')]();}else{_0x5c9d02[_0x24f0('0x27')]();}})[_0x24f0('0xf')](function(_0x2db933){logger['error'](_0x24f0('0xe'),_0x50b9b1,JSON[_0x24f0('0x24')](_0x2db933));_0x5c9d02[_0x24f0('0x45')]();});}})['catch'](function(_0x120193){logger[_0x24f0('0x23')](_0x24f0('0xe'),_0x50b9b1,_0x120193[_0x24f0('0x2b')],_0x120193[_0x24f0('0x46')]);_0x5c9d02[_0x24f0('0x45')]();});}}catch(_0x3ab76d){logger[_0x24f0('0x23')](_0x24f0('0xe'),_0x50b9b1,JSON[_0x24f0('0x24')](_0x3ab76d));_0x5c9d02['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index a5f7b16..9a3c77c 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6d5=['number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x4b1475,_0x2912a3){var _0x3457d0=function(_0x15276b){while(--_0x15276b){_0x4b1475['push'](_0x4b1475['shift']());}};_0x3457d0(++_0x2912a3);}(_0xc6d5,0x172));var _0x5c6d=function(_0x37fcc1,_0x1057b4){_0x37fcc1=_0x37fcc1-0x0;var _0x5e3da8=_0xc6d5[_0x37fcc1];return _0x5e3da8;};'use strict';var schema=require(_0x5c6d('0x0'));var _=require(_0x5c6d('0x1'));var htmlToText=require(_0x5c6d('0x2'));var utils=require('./utils');var logger=require(_0x5c6d('0x3'))(_0x5c6d('0x4'));var gotoif=schema({'condition':{'type':_0x5c6d('0x5'),'required':!![],'message':_0x5c6d('0x6')},'priorityTrue':{'type':_0x5c6d('0x7'),'message':_0x5c6d('0x8')},'priorityFalse':{'type':'number','message':_0x5c6d('0x9')}});exports['consequence']=function(_0x25e473,_0x323400){return function(_0x3842e9){try{var _0x2ccf46={'condition':htmlToText[_0x5c6d('0xa')](utils['getMustacheRender'](_0x323400[0x0],this),{'wordwrap':![]})[_0x5c6d('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x323400[0x1],'priorityFalse':_0x323400[0x2]};var _0x1300d3=gotoif['validate'](_0x2ccf46,{'typecast':!![]});if(_0x1300d3[_0x5c6d('0xc')]){logger[_0x5c6d('0xd')](_0x5c6d('0xe'),_0x25e473,_[_0x5c6d('0xf')](_0x1300d3,_0x5c6d('0x10'))['join'](',\x20'));_0x3842e9[_0x5c6d('0x11')]();}else{try{var _0x1e6a51=eval('('+_0x2ccf46[_0x5c6d('0x12')]+')');var _0x15197c=_0x1e6a51?_0x2ccf46[_0x5c6d('0x13')]:_0x2ccf46[_0x5c6d('0x14')];logger['info'](_0x5c6d('0x15'),_0x25e473,_0x2ccf46['condition'],_0x1e6a51,_0x15197c||_0x5c6d('0x16'));if(_0x15197c){var _0x76aa73=_[_0x5c6d('0x17')](_0x3842e9[_0x5c6d('0x18')](),{'p':_0x15197c});if(_0x76aa73>=0x0){logger[_0x5c6d('0x19')](_0x5c6d('0x1a'),_0x25e473,_0x15197c||_0x5c6d('0x16'),_0x76aa73);_0x3842e9[_0x5c6d('0x16')](_0x76aa73);}else{logger[_0x5c6d('0x19')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x25e473,_0x15197c||_0x5c6d('0x16'));_0x3842e9['stop']();}}else{_0x3842e9[_0x5c6d('0x16')]();}}catch(_0x471cb5){logger['error'](_0x5c6d('0x1b'),_0x25e473,_0x471cb5['message']);_0x3842e9[_0x5c6d('0x11')]();}}}catch(_0x18caa7){logger[_0x5c6d('0xd')](_0x5c6d('0xe'),_0x25e473,JSON[_0x5c6d('0x1c')](_0x18caa7));_0x3842e9[_0x5c6d('0x11')]();}};}; \ No newline at end of file +var _0xa974=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','validate','error','message','join','condition','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules'];(function(_0x278ba5,_0x3bd3c4){var _0x106fba=function(_0x1644b7){while(--_0x1644b7){_0x278ba5['push'](_0x278ba5['shift']());}};_0x106fba(++_0x3bd3c4);}(_0xa974,0x195));var _0x4a97=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0xa974[_0x2df724];return _0x1b2504;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x4a97('0x0'));var utils=require(_0x4a97('0x1'));var logger=require(_0x4a97('0x2'))(_0x4a97('0x3'));var gotoif=schema({'condition':{'type':_0x4a97('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x4a97('0x5'),'message':_0x4a97('0x6')},'priorityFalse':{'type':_0x4a97('0x5'),'message':_0x4a97('0x7')}});exports[_0x4a97('0x8')]=function(_0x2b6185,_0x532c67){return function(_0x233f44){try{var _0x19554e={'condition':htmlToText['fromString'](utils[_0x4a97('0x9')](_0x532c67[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x532c67[0x1],'priorityFalse':_0x532c67[0x2]};var _0x38b8f8=gotoif[_0x4a97('0xa')](_0x19554e,{'typecast':!![]});if(_0x38b8f8['length']){logger[_0x4a97('0xb')]('[%s][GOTOIF]\x20%s',_0x2b6185,_['map'](_0x38b8f8,_0x4a97('0xc'))[_0x4a97('0xd')](',\x20'));_0x233f44['stop']();}else{try{var _0x3613c3=eval('('+_0x19554e[_0x4a97('0xe')]+')');var _0x42e681=_0x3613c3?_0x19554e['priorityTrue']:_0x19554e['priorityFalse'];logger[_0x4a97('0xf')](_0x4a97('0x10'),_0x2b6185,_0x19554e[_0x4a97('0xe')],_0x3613c3,_0x42e681||_0x4a97('0x11'));if(_0x42e681){var _0x21e591=_[_0x4a97('0x12')](_0x233f44[_0x4a97('0x13')](),{'p':_0x42e681});if(_0x21e591>=0x0){logger[_0x4a97('0xf')](_0x4a97('0x14'),_0x2b6185,_0x42e681||'next',_0x21e591);_0x233f44[_0x4a97('0x11')](_0x21e591);}else{logger[_0x4a97('0xf')](_0x4a97('0x15'),_0x2b6185,_0x42e681||_0x4a97('0x11'));_0x233f44[_0x4a97('0x16')]();}}else{_0x233f44[_0x4a97('0x11')]();}}catch(_0x4deb31){logger[_0x4a97('0xb')](_0x4a97('0x17'),_0x2b6185,_0x4deb31[_0x4a97('0xc')]);_0x233f44[_0x4a97('0x16')]();}}}catch(_0x325bff){logger['error'](_0x4a97('0x18'),_0x2b6185,JSON['stringify'](_0x325bff));_0x233f44[_0x4a97('0x16')]();}};}; \ 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 6e052cf..20add39 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 _0x668a=['validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify'];(function(_0x3c91d4,_0x2dc13b){var _0x29b00b=function(_0x3c6ca3){while(--_0x3c6ca3){_0x3c91d4['push'](_0x3c91d4['shift']());}};_0x29b00b(++_0x2dc13b);}(_0x668a,0x1cc));var _0xa668=function(_0x540002,_0x1c4372){_0x540002=_0x540002-0x0;var _0x7fcd4a=_0x668a[_0x540002];return _0x7fcd4a;};'use strict';var schema=require(_0xa668('0x0'));var _=require(_0xa668('0x1'));var logger=require(_0xa668('0x2'))(_0xa668('0x3'));var gotop=schema({'priority':{'type':_0xa668('0x4'),'required':!![],'message':_0xa668('0x5')}});exports[_0xa668('0x6')]=function(_0x4130fb,_0x2be21a){return function(_0x3a52ba){try{var _0x233257={'priority':_0x2be21a[0x0]};var _0x1719a0=gotop[_0xa668('0x0')](_0x233257,{'typecast':!![]});if(_0x1719a0[_0xa668('0x7')]){logger['error'](_0xa668('0x8'),_0x4130fb,_[_0xa668('0x9')](_0x1719a0,_0xa668('0xa'))[_0xa668('0xb')](',\x20'));_0x3a52ba[_0xa668('0xc')]();}else{logger[_0xa668('0xd')](_0xa668('0xe'),_0x4130fb,_0x233257[_0xa668('0xf')]);if(_0x233257[_0xa668('0xf')]){var _0x52663f=_[_0xa668('0x10')](_0x3a52ba[_0xa668('0x11')](),{'p':_0x233257[_0xa668('0xf')]});if(_0x52663f>=0x0){logger[_0xa668('0xd')](_0xa668('0x12'),_0x4130fb,_0x233257[_0xa668('0xf')]||_0xa668('0x13'),_0x52663f);_0x3a52ba[_0xa668('0x13')](_0x52663f);}else{logger[_0xa668('0xd')](_0xa668('0x14'),_0x4130fb,_0x233257[_0xa668('0xf')]||_0xa668('0x13'));_0x3a52ba[_0xa668('0xc')]();}}else{_0x3a52ba[_0xa668('0x13')]();}}}catch(_0x6bde7b){logger[_0xa668('0x15')](_0xa668('0x8'),_0x4130fb,JSON[_0xa668('0x16')](_0x6bde7b));_0x3a52ba[_0xa668('0xc')]();}};}; \ No newline at end of file +var _0x1fe4=['validate','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stop','stringify','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x4e768b,_0x1143ec){var _0x4c5165=function(_0x3dd5e0){while(--_0x3dd5e0){_0x4e768b['push'](_0x4e768b['shift']());}};_0x4c5165(++_0x1143ec);}(_0x1fe4,0x152));var _0x41fe=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x1fe4[_0xa990b7];return _0x52c99c;};'use strict';var schema=require('validate');var _=require(_0x41fe('0x0'));var logger=require('../../../../config/logger')(_0x41fe('0x1'));var gotop=schema({'priority':{'type':_0x41fe('0x2'),'required':!![],'message':_0x41fe('0x3')}});exports['consequence']=function(_0x49a7b9,_0x55c416){return function(_0x540268){try{var _0x169cc5={'priority':_0x55c416[0x0]};var _0x58df05=gotop[_0x41fe('0x4')](_0x169cc5,{'typecast':!![]});if(_0x58df05['length']){logger[_0x41fe('0x5')](_0x41fe('0x6'),_0x49a7b9,_[_0x41fe('0x7')](_0x58df05,_0x41fe('0x8'))[_0x41fe('0x9')](',\x20'));_0x540268['stop']();}else{logger[_0x41fe('0xa')](_0x41fe('0xb'),_0x49a7b9,_0x169cc5[_0x41fe('0xc')]);if(_0x169cc5[_0x41fe('0xc')]){var _0x5a1829=_[_0x41fe('0xd')](_0x540268['rules'](),{'p':_0x169cc5[_0x41fe('0xc')]});if(_0x5a1829>=0x0){logger[_0x41fe('0xa')](_0x41fe('0xe'),_0x49a7b9,_0x169cc5[_0x41fe('0xc')]||'next',_0x5a1829);_0x540268['next'](_0x5a1829);}else{logger[_0x41fe('0xa')](_0x41fe('0xf'),_0x49a7b9,_0x169cc5[_0x41fe('0xc')]||_0x41fe('0x10'));_0x540268[_0x41fe('0x11')]();}}else{_0x540268[_0x41fe('0x10')]();}}}catch(_0x4a17c2){logger[_0x41fe('0x5')](_0x41fe('0x6'),_0x49a7b9,JSON[_0x41fe('0x12')](_0x4a17c2));_0x540268[_0x41fe('0x11')]();}};}; \ 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 c6b6152..c93b2c9 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 _0x7400=['info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','create','then'];(function(_0x183070,_0x4a7adb){var _0x2d17ca=function(_0x438da0){while(--_0x438da0){_0x183070['push'](_0x183070['shift']());}};_0x2d17ca(++_0x4a7adb);}(_0x7400,0x1d7));var _0x0740=function(_0x308375,_0x3a93cc){_0x308375=_0x308375-0x0;var _0x18d40c=_0x7400[_0x308375];return _0x18d40c;};'use strict';var _=require('lodash');var utils=require(_0x0740('0x0'));var logger=require(_0x0740('0x1'))(_0x0740('0x2'));var rpc={'chatMessage':require(_0x0740('0x3')),'openchannelMessage':require(_0x0740('0x4')),'mailMessage':require(_0x0740('0x5')),'smsMessage':require(_0x0740('0x6')),'faxMessage':require(_0x0740('0x7')),'whatsappMessage':require(_0x0740('0x8'))};exports[_0x0740('0x9')]=function(_0x4f5bf5,_0x430d15){return function(_0x25cdee){try{var _0x5254e1={'body':utils[_0x0740('0xa')](_0x430d15[0x0],this),'ContactId':this[_0x0740('0xb')]['id']};if(this[_0x0740('0xc')]===_0x0740('0xd')){_0x5254e1[_0x0740('0xe')]=this['account']['id'];}else{_0x5254e1[_[_0x0740('0xf')](this[_0x0740('0xc')])+_0x0740('0x10')]=this[_0x0740('0x11')]['id'];}_0x5254e1[_[_0x0740('0xf')](this[_0x0740('0xc')])+_0x0740('0x12')]=this['interaction']['id'];if(rpc[this[_0x0740('0xc')]+_0x0740('0x13')]){return rpc[this['channel']+_0x0740('0x13')][_0x0740('0x14')](_0x5254e1)[_0x0740('0x15')](function(_0x6f5684){logger[_0x0740('0x16')](_0x0740('0x17'),_0x4f5bf5,_0x5254e1[_0x0740('0x18')]);_0x25cdee[_0x0740('0x19')]();})['catch'](function(_0x558a6e){logger[_0x0740('0x1a')](_0x0740('0x17'),_0x4f5bf5,JSON[_0x0740('0x1b')](_0x558a6e));_0x25cdee[_0x0740('0x1c')]();});}}catch(_0x51713d){logger[_0x0740('0x1a')](_0x0740('0x17'),_0x4f5bf5,JSON[_0x0740('0x1b')](_0x51713d));_0x25cdee[_0x0740('0x1c')]();}};}; \ No newline at end of file +var _0xcd6f=['lodash','./utils','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','AccountId','channel','interaction','Message','create','info','catch','[%s][MESSAGE]\x20%s','stringify','stop'];(function(_0x3d7a58,_0x409a0d){var _0x2a5fa7=function(_0x4f2c3f){while(--_0x4f2c3f){_0x3d7a58['push'](_0x3d7a58['shift']());}};_0x2a5fa7(++_0x409a0d);}(_0xcd6f,0x73));var _0xfcd6=function(_0x319fa0,_0x31377a){_0x319fa0=_0x319fa0-0x0;var _0x464fee=_0xcd6f[_0x319fa0];return _0x464fee;};'use strict';var _=require(_0xfcd6('0x0'));var utils=require(_0xfcd6('0x1'));var logger=require('../../../../config/logger')(_0xfcd6('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xfcd6('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xfcd6('0x4')),'faxMessage':require(_0xfcd6('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xfcd6('0x6')]=function(_0x360c10,_0x52ad4c){return function(_0x38e3b1){try{var _0x43dd46={'body':utils[_0xfcd6('0x7')](_0x52ad4c[0x0],this),'ContactId':this[_0xfcd6('0x8')]['id']};if(this['channel']===_0xfcd6('0x9')){_0x43dd46[_0xfcd6('0xa')]=this[_0xfcd6('0xb')]['id'];}else{_0x43dd46[_[_0xfcd6('0xc')](this['channel'])+_0xfcd6('0xd')]=this['account']['id'];}_0x43dd46[_[_0xfcd6('0xc')](this[_0xfcd6('0xe')])+'InteractionId']=this[_0xfcd6('0xf')]['id'];if(rpc[this[_0xfcd6('0xe')]+_0xfcd6('0x10')]){return rpc[this['channel']+_0xfcd6('0x10')][_0xfcd6('0x11')](_0x43dd46)['then'](function(_0x2b8723){logger[_0xfcd6('0x12')]('[%s][MESSAGE]\x20%s',_0x360c10,_0x43dd46['body']);_0x38e3b1['next']();})[_0xfcd6('0x13')](function(_0x6df0d5){logger['error'](_0xfcd6('0x14'),_0x360c10,JSON[_0xfcd6('0x15')](_0x6df0d5));_0x38e3b1['stop']();});}}catch(_0x5c4e5d){logger['error']('[%s][MESSAGE]\x20%s',_0x360c10,JSON[_0xfcd6('0x15')](_0x5c4e5d));_0x38e3b1[_0xfcd6('0x16')]();}};}; \ 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 b37c817..76aac4f 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 _0x35ff=['./utils','../../../../config/logger','consequence','getMustacheRender','next','error','stringify','stop'];(function(_0x17dee4,_0x569c71){var _0xfa0f08=function(_0x1ed82f){while(--_0x1ed82f){_0x17dee4['push'](_0x17dee4['shift']());}};_0xfa0f08(++_0x569c71);}(_0x35ff,0x128));var _0xf35f=function(_0x3bbac7,_0x544911){_0x3bbac7=_0x3bbac7-0x0;var _0x5c4cd4=_0x35ff[_0x3bbac7];return _0x5c4cd4;};'use strict';var utils=require(_0xf35f('0x0'));var logger=require(_0xf35f('0x1'))('routing');exports[_0xf35f('0x2')]=function(_0x93ee13,_0x42ed81){return function(_0x2b848f){try{logger['info']('[%s][NOOP]\x20%s',_0x93ee13,utils[_0xf35f('0x3')](_0x42ed81[0x0],this));_0x2b848f[_0xf35f('0x4')]();}catch(_0xae3d8b){logger[_0xf35f('0x5')]('[%s][NOOP]\x20%s',_0x93ee13,JSON[_0xf35f('0x6')](_0xae3d8b));_0x2b848f[_0xf35f('0x7')]();}};}; \ No newline at end of file +var _0xadfb=['./utils','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','stringify','stop'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xadfb,0x1b0));var _0xbadf=function(_0x5c4167,_0x590325){_0x5c4167=_0x5c4167-0x0;var _0x51dcfb=_0xadfb[_0x5c4167];return _0x51dcfb;};'use strict';var utils=require(_0xbadf('0x0'));var logger=require(_0xbadf('0x1'))(_0xbadf('0x2'));exports[_0xbadf('0x3')]=function(_0x335a7c,_0x414fc6){return function(_0x42d512){try{logger['info'](_0xbadf('0x4'),_0x335a7c,utils[_0xbadf('0x5')](_0x414fc6[0x0],this));_0x42d512['next']();}catch(_0x34d1c0){logger['error'](_0xbadf('0x4'),_0x335a7c,JSON[_0xbadf('0x6')](_0x34d1c0));_0x42d512[_0xbadf('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index d30f680..4787bf7 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 _0x44bb=['name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','validate','length','[%s][QUEUE]\x20%s','map','join','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','stop','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','socket.io-emitter','redis','queue_id','account','queue','from','clone','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x44bb,0x110));var _0xb44b=function(_0x1a55d9,_0x1c130b){_0x1a55d9=_0x1a55d9-0x0;var _0x3bdb9c=_0x44bb[_0x1a55d9];return _0x3bdb9c;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xb44b('0x0'));var seqqueue=require('seq-queue');var moment=require(_0xb44b('0x1'));var Redis=require(_0xb44b('0x2'));var config=require(_0xb44b('0x3'));var logger=require(_0xb44b('0x4'))(_0xb44b('0x5'));var strategy=require(_0xb44b('0x6'));config['redis']=_[_0xb44b('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb44b('0x8'))(new Redis(config[_0xb44b('0x9')]));var attributes=['id',_0xb44b('0xa'),_0xb44b('0xb'),_0xb44b('0xc'),_0xb44b('0xd'),'joinAt'];function emit(_0x41f46e,_0x8d7907,_0x247331){io['to'](_0x41f46e)['emit'](_0x8d7907,_0x247331);}function emitChannelQueueInteraction(_0x45e2ea,_0x21c7a5,_0x359905,_0x14b39e,_0xbba1d1,_0x43d1d2,_0x416259,_0x149ed7){var _0x46b36f=_[_0xb44b('0xe')](_0x359905);_0x46b36f[_0xb44b('0xa')]=_0x149ed7;_0x46b36f[_0xb44b('0xc')]=_0x21c7a5;_0x46b36f[_0xb44b('0xb')]=_0x14b39e;_0x46b36f['id']=_0xbba1d1;if(_0x43d1d2){attributes['push'](_[_0xb44b('0xf')](_0x45e2ea)+_0xb44b('0x10'));_0x416259[util[_0xb44b('0x11')](_0xb44b('0x12'),_0x45e2ea)][_0xbba1d1]=_[_0xb44b('0x13')](_0x46b36f,attributes);}else{delete _0x416259[util[_0xb44b('0x11')](_0xb44b('0x12'),_0x45e2ea)][_0xbba1d1];}emit(util[_0xb44b('0x11')]('%s:queue:%s',_0x45e2ea,_0x21c7a5),util[_0xb44b('0x11')](_0xb44b('0x14'),_0x45e2ea,_0x43d1d2?_0xb44b('0x15'):_0xb44b('0x16')),_[_0xb44b('0x13')](_0x46b36f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xb44b('0x17')),'chatQueueReport':require(_0xb44b('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xb44b('0x19')),'whatsappQueueReport':require(_0xb44b('0x1a')),'chatInteraction':require(_0xb44b('0x1b')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0xb44b('0x1c')),'openchannelInteraction':require(_0xb44b('0x1d')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0xb44b('0x1e'),'required':!![],'message':_0xb44b('0x1f')},'timeout':{'type':_0xb44b('0x20'),'message':_0xb44b('0x21')}});function startRouting(_0x4e3c1a,_0x3b975f,_0x5f086a,_0x2db4fe){if(_0x4e3c1a&&_0x3b975f&&_0x5f086a){_0x3b975f[_0xb44b('0x22')]+=0x1;var _0x55f1b4={'uniqueid':_0x4e3c1a,'from':_0x5f086a[_0xb44b('0x23')]?_0x5f086a[_0xb44b('0x23')][_0xb44b('0xd')]:'','joinAt':moment()[_0xb44b('0x11')](_0xb44b('0x24')),'ContactId':_0x5f086a[_0xb44b('0x25')]?_0x5f086a[_0xb44b('0x25')]['id']:null,'ListId':_0x5f086a[_0xb44b('0x26')]?_0x5f086a[_0xb44b('0x26')]['id']:null};_0x55f1b4[_[_0xb44b('0x27')](_0x5f086a[_0xb44b('0x28')])+_0xb44b('0x29')]=_0x3b975f['id']||null;_0x55f1b4[_['upperFirst'](_0x5f086a[_0xb44b('0x28')])+_0xb44b('0x10')]=_0x5f086a[_0xb44b('0x2a')]?_0x5f086a['interaction']['id']:null;_0x55f1b4[_['upperFirst'](_0x5f086a[_0xb44b('0x28')])+'MessageId']=_0x5f086a[_0xb44b('0x2b')]?_0x5f086a[_0xb44b('0x2b')]['id']:null;_0x55f1b4[_['upperFirst'](_0x5f086a['channel'])+(_0x5f086a[_0xb44b('0x28')]!=='chat'?_0xb44b('0x2c'):_0xb44b('0x2d'))]=_0x5f086a[_0xb44b('0xb')]?_0x5f086a[_0xb44b('0xb')]['id']:null;logger[_0xb44b('0x2e')](util[_0xb44b('0x11')](_0xb44b('0x2f'),_0x4e3c1a,_0x3b975f[_0xb44b('0x30')]));emitChannelQueueInteraction(_0x5f086a[_0xb44b('0x28')],_0x3b975f[_0xb44b('0x30')],_0x55f1b4,_0x5f086a['account']['name'],_0x5f086a[_0xb44b('0x2b')]['id'],!![],_0x2db4fe,_0x3b975f['id']);if(rpc[_0x5f086a[_0xb44b('0x28')]+_0xb44b('0x31')]){return rpc[_0x5f086a[_0xb44b('0x28')]+_0xb44b('0x31')][_0xb44b('0x32')](_0x55f1b4)[_0xb44b('0x33')](function(_0x4fc309){logger[_0xb44b('0x34')](_0xb44b('0x35'),_0x4fc309);});}}}function stopRouting(_0x49ca28,_0x814e72,_0x11ef91,_0xfd9a53){if(_0x49ca28&&_0x814e72){_0x814e72[_0xb44b('0x22')]-=0x1;var _0xf5e81a={'leaveAt':moment()[_0xb44b('0x11')](_0xb44b('0x24')),'acceptAt':moment()['format'](_0xb44b('0x24')),'reason':_0xb44b('0x36')};logger[_0xb44b('0x2e')](util['format'](_0xb44b('0x37'),_0x49ca28,_0x814e72[_0xb44b('0x30')]));emitChannelQueueInteraction(_0x11ef91[_0xb44b('0x28')],_0x814e72[_0xb44b('0x30')],_0x11ef91['body'],_0x11ef91[_0xb44b('0xb')]['name'],_0x11ef91[_0xb44b('0x2b')]['id'],![],_0xfd9a53,_0x814e72['id']);return rpc[_0x11ef91[_0xb44b('0x28')]+'Interaction'][_0xb44b('0x38')](_0x11ef91[_0xb44b('0x2a')]['id'],{'queueId':_0x814e72['id']})['then'](function(){if(rpc[_0x11ef91[_0xb44b('0x28')]+_0xb44b('0x31')]){return rpc[_0x11ef91[_0xb44b('0x28')]+_0xb44b('0x31')][_0xb44b('0x38')](_0x49ca28,_0xf5e81a)[_0xb44b('0x33')](function(_0x20e429){logger[_0xb44b('0x34')](_0xb44b('0x39'),_0x20e429);});}});}}function endRouting(_0x43bba9,_0x337bce,_0x42f0f0,_0xcf97f6){if(_0x43bba9&&_0x337bce){_0x337bce[_0xb44b('0x22')]-=0x1;var _0x34e40f={'leaveAt':moment()['format'](_0xb44b('0x24')),'exitAt':moment()['format'](_0xb44b('0x24')),'reason':_0xb44b('0x3a')};logger['info'](util[_0xb44b('0x11')](_0xb44b('0x3b'),_0x43bba9,_0x337bce[_0xb44b('0x30')]));emitChannelQueueInteraction(_0x42f0f0['channel'],_0x337bce[_0xb44b('0x30')],_0x42f0f0[_0xb44b('0x23')],_0x42f0f0[_0xb44b('0xb')][_0xb44b('0x30')],_0x42f0f0[_0xb44b('0x2b')]['id'],![],_0xcf97f6);if(rpc[_0x42f0f0[_0xb44b('0x28')]+_0xb44b('0x31')]){return rpc[_0x42f0f0['channel']+_0xb44b('0x31')]['update'](_0x43bba9,_0x34e40f)['catch'](function(_0x2be89b){logger[_0xb44b('0x34')](_0xb44b('0x39'),_0x2be89b);});}}}function handleFindQueue(_0x44d4c0){return function(_0x333e70){return _0x333e70[_0xb44b('0x30')][_0xb44b('0x3c')]()===_0x44d4c0[_0xb44b('0x3c')]();};}exports['consequence']=function(_0x5b4a05,_0x38d86f,_0x1a8457,_0x1b4a1e){return function(_0xf83b33){try{var _0x61fff3={'name':_0x38d86f[0x0],'timeout':_0x38d86f[0x1]};var _0x2dd746=queue[_0xb44b('0x3d')](_0x61fff3,{'typecast':!![]});if(_0x2dd746[_0xb44b('0x3e')]){logger[_0xb44b('0x34')](_0xb44b('0x3f'),_0x5b4a05,_[_0xb44b('0x40')](_0x2dd746,_0xb44b('0x2b'))[_0xb44b('0x41')](',\x20'));_0xf83b33['stop']();}else{var _0x597a42=_[_0xb44b('0x42')](_0x1a8457[_0x1b4a1e[_0xb44b('0x28')]+'Queues'],handleFindQueue(_0x61fff3[_0xb44b('0x30')]));if(_0x597a42){startRouting(_0x5b4a05,_0x597a42,_0x1b4a1e,_0x1a8457);var _0x3f5ce1=(_0x597a42[_0xb44b('0x3a')]||0xa)*0x3e8;var _0x2009b4=(_0x61fff3[_0xb44b('0x3a')]||0x14)*0x3e8;var _0xcc6c91;if(_0x3f5ce1>_0x2009b4){_0x2009b4=_0x3f5ce1;}var _0x5226e0=seqqueue[_0xb44b('0x43')](_0x3f5ce1);_0x5226e0['id']=_0x5b4a05;_0x5226e0[_0xb44b('0x44')]=_0x3f5ce1;_0x5226e0[_0xb44b('0x45')]=_0x2009b4;_0x5226e0[_0xb44b('0x28')]=_0x1b4a1e[_0xb44b('0x28')];_0x1a8457[_0xb44b('0x46')][_0x5b4a05]['on'](_0xb44b('0x47'),function(){logger[_0xb44b('0x2e')](_0xb44b('0x48'),_0x5b4a05);stopRouting(_0x5b4a05,_0x597a42,_0x1b4a1e,_0x1a8457);clearTimeout(_0xcc6c91);_0xcc6c91=undefined;_0x5226e0[_0xb44b('0x49')](!![]);if(_0x1a8457[_0xb44b('0x46')][_0x5b4a05]){delete _0x1a8457[_0xb44b('0x46')][_0x5b4a05];}_0xf83b33['stop']();});_0x1a8457['rules'][_0x5b4a05]['on'](_0xb44b('0x4a'),function(){if(_0x1a8457[_0xb44b('0x46')][_0x5b4a05]){delete _0x1a8457[_0xb44b('0x46')][_0x5b4a05];}});_0xcc6c91=setTimeout(function(){logger['info'](_0xb44b('0x4b'),_0x5b4a05);endRouting(_0x5b4a05,_0x597a42,_0x1b4a1e,_0x1a8457);clearTimeout(_0xcc6c91);_0x5226e0[_0xb44b('0x49')](!![]);_0xf83b33['next']();},_0x2009b4);switch(_0x597a42[_0xb44b('0x4c')]){case _0xb44b('0x4d'):strategy[_0xb44b('0x4d')](_0x5226e0,_0x597a42,_0x1a8457,_0x1b4a1e);break;default:strategy[_0xb44b('0x4e')](_0x5226e0,_0x597a42,_0x1a8457,_0x1b4a1e);}}else{logger[_0xb44b('0x34')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x5b4a05,_0x61fff3['name']);_0xf83b33[_0xb44b('0x4f')]();}}}catch(_0x664dac){logger[_0xb44b('0x34')](_0xb44b('0x3f'),_0x5b4a05,_0x664dac['stack']);_0xf83b33[_0xb44b('0x4f')]();}};}; \ No newline at end of file +var _0x65f0=['queue','push','capitalize','InteractionId','%sQueuesWaitingInteractions','format','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','accepted','Interaction','update','then','error','update\x20queue\x20report','timeout','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','createQueue','atimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','queue_id','account','from','emit','clone'];(function(_0x3233c3,_0x15e5fa){var _0x36029b=function(_0xe3dd12){while(--_0xe3dd12){_0x3233c3['push'](_0x3233c3['shift']());}};_0x36029b(++_0x15e5fa);}(_0x65f0,0x8f));var _0x065f=function(_0x12be6c,_0x493786){_0x12be6c=_0x12be6c-0x0;var _0x2dfe54=_0x65f0[_0x12be6c];return _0x2dfe54;};'use strict';var schema=require('validate');var _=require(_0x065f('0x0'));var util=require(_0x065f('0x1'));var seqqueue=require(_0x065f('0x2'));var moment=require(_0x065f('0x3'));var Redis=require(_0x065f('0x4'));var config=require(_0x065f('0x5'));var logger=require('../../../../config/logger')(_0x065f('0x6'));var strategy=require(_0x065f('0x7'));config[_0x065f('0x8')]=_[_0x065f('0x9')](config[_0x065f('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x065f('0x8')]));var attributes=['id',_0x065f('0xa'),_0x065f('0xb'),'queue',_0x065f('0xc'),'joinAt'];function emit(_0x44074a,_0x5186da,_0x195781){io['to'](_0x44074a)[_0x065f('0xd')](_0x5186da,_0x195781);}function emitChannelQueueInteraction(_0x543e36,_0x7ef67e,_0x2174e5,_0x326cad,_0xd4a6ec,_0x3a3b5c,_0x5c5476,_0xe4cf00){var _0x4087a5=_[_0x065f('0xe')](_0x2174e5);_0x4087a5['queue_id']=_0xe4cf00;_0x4087a5[_0x065f('0xf')]=_0x7ef67e;_0x4087a5['account']=_0x326cad;_0x4087a5['id']=_0xd4a6ec;if(_0x3a3b5c){attributes[_0x065f('0x10')](_[_0x065f('0x11')](_0x543e36)+_0x065f('0x12'));_0x5c5476[util['format'](_0x065f('0x13'),_0x543e36)][_0xd4a6ec]=_['pick'](_0x4087a5,attributes);}else{delete _0x5c5476[util[_0x065f('0x14')]('%sQueuesWaitingInteractions',_0x543e36)][_0xd4a6ec];}emit(util['format']('%s:queue:%s',_0x543e36,_0x7ef67e),util['format'](_0x065f('0x15'),_0x543e36,_0x3a3b5c?_0x065f('0x16'):_0x065f('0x17')),_[_0x065f('0x18')](_0x4087a5,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x065f('0x19')),'faxQueueReport':require(_0x065f('0x1a')),'whatsappQueueReport':require(_0x065f('0x1b')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x065f('0x1c')),'mailInteraction':require(_0x065f('0x1d')),'openchannelInteraction':require(_0x065f('0x1e')),'smsInteraction':require(_0x065f('0x1f')),'whatsappInteraction':require(_0x065f('0x20'))};var queue=schema({'name':{'type':_0x065f('0x21'),'required':!![],'message':_0x065f('0x22')},'timeout':{'type':_0x065f('0x23'),'message':_0x065f('0x24')}});function startRouting(_0x390bb5,_0x14d7fc,_0x51fe79,_0xa03fb4){if(_0x390bb5&&_0x14d7fc&&_0x51fe79){_0x14d7fc[_0x065f('0x25')]+=0x1;var _0x2dce2a={'uniqueid':_0x390bb5,'from':_0x51fe79[_0x065f('0x26')]?_0x51fe79['body'][_0x065f('0xc')]:'','joinAt':moment()[_0x065f('0x14')](_0x065f('0x27')),'ContactId':_0x51fe79[_0x065f('0x28')]?_0x51fe79[_0x065f('0x28')]['id']:null,'ListId':_0x51fe79['list']?_0x51fe79['list']['id']:null};_0x2dce2a[_[_0x065f('0x29')](_0x51fe79[_0x065f('0x2a')])+_0x065f('0x2b')]=_0x14d7fc['id']||null;_0x2dce2a[_[_0x065f('0x29')](_0x51fe79[_0x065f('0x2a')])+_0x065f('0x12')]=_0x51fe79[_0x065f('0x2c')]?_0x51fe79[_0x065f('0x2c')]['id']:null;_0x2dce2a[_[_0x065f('0x29')](_0x51fe79['channel'])+_0x065f('0x2d')]=_0x51fe79[_0x065f('0x2e')]?_0x51fe79[_0x065f('0x2e')]['id']:null;_0x2dce2a[_[_0x065f('0x29')](_0x51fe79[_0x065f('0x2a')])+(_0x51fe79[_0x065f('0x2a')]!==_0x065f('0x2f')?_0x065f('0x30'):_0x065f('0x31'))]=_0x51fe79[_0x065f('0xb')]?_0x51fe79[_0x065f('0xb')]['id']:null;logger[_0x065f('0x32')](util['format'](_0x065f('0x33'),_0x390bb5,_0x14d7fc[_0x065f('0x34')]));emitChannelQueueInteraction(_0x51fe79[_0x065f('0x2a')],_0x14d7fc[_0x065f('0x34')],_0x2dce2a,_0x51fe79['account'][_0x065f('0x34')],_0x51fe79['message']['id'],!![],_0xa03fb4,_0x14d7fc['id']);if(rpc[_0x51fe79[_0x065f('0x2a')]+'QueueReport']){return rpc[_0x51fe79[_0x065f('0x2a')]+_0x065f('0x35')]['create'](_0x2dce2a)['catch'](function(_0x5b3e09){logger['error']('create\x20queue\x20report',_0x5b3e09);});}}}function stopRouting(_0x7e1b19,_0x13ca17,_0xd1eb91,_0x46c472){if(_0x7e1b19&&_0x13ca17){_0x13ca17[_0x065f('0x25')]-=0x1;var _0x235abf={'leaveAt':moment()[_0x065f('0x14')](_0x065f('0x27')),'acceptAt':moment()[_0x065f('0x14')](_0x065f('0x27')),'reason':_0x065f('0x36')};logger[_0x065f('0x32')](util[_0x065f('0x14')]('[%s][STOP:QUEUE][NAME:%s]',_0x7e1b19,_0x13ca17[_0x065f('0x34')]));emitChannelQueueInteraction(_0xd1eb91[_0x065f('0x2a')],_0x13ca17[_0x065f('0x34')],_0xd1eb91[_0x065f('0x26')],_0xd1eb91[_0x065f('0xb')][_0x065f('0x34')],_0xd1eb91[_0x065f('0x2e')]['id'],![],_0x46c472,_0x13ca17['id']);return rpc[_0xd1eb91[_0x065f('0x2a')]+_0x065f('0x37')][_0x065f('0x38')](_0xd1eb91[_0x065f('0x2c')]['id'],{'queueId':_0x13ca17['id']})[_0x065f('0x39')](function(){if(rpc[_0xd1eb91[_0x065f('0x2a')]+'QueueReport']){return rpc[_0xd1eb91[_0x065f('0x2a')]+_0x065f('0x35')][_0x065f('0x38')](_0x7e1b19,_0x235abf)['catch'](function(_0x127013){logger[_0x065f('0x3a')](_0x065f('0x3b'),_0x127013);});}});}}function endRouting(_0x4219ec,_0x53fe9f,_0xbd8858,_0x41bfef){if(_0x4219ec&&_0x53fe9f){_0x53fe9f[_0x065f('0x25')]-=0x1;var _0x508c1d={'leaveAt':moment()['format'](_0x065f('0x27')),'exitAt':moment()['format'](_0x065f('0x27')),'reason':_0x065f('0x3c')};logger['info'](util[_0x065f('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x4219ec,_0x53fe9f['name']));emitChannelQueueInteraction(_0xbd8858['channel'],_0x53fe9f[_0x065f('0x34')],_0xbd8858[_0x065f('0x26')],_0xbd8858[_0x065f('0xb')][_0x065f('0x34')],_0xbd8858[_0x065f('0x2e')]['id'],![],_0x41bfef);if(rpc[_0xbd8858['channel']+'QueueReport']){return rpc[_0xbd8858[_0x065f('0x2a')]+_0x065f('0x35')]['update'](_0x4219ec,_0x508c1d)['catch'](function(_0x185d00){logger[_0x065f('0x3a')](_0x065f('0x3b'),_0x185d00);});}}}function handleFindQueue(_0xbe77e6){return function(_0xd6af2c){return _0xd6af2c[_0x065f('0x34')]['toLowerCase']()===_0xbe77e6['toLowerCase']();};}exports[_0x065f('0x3d')]=function(_0x2535a6,_0x1741fc,_0xdce713,_0x1d26f9){return function(_0x1ce5fe){try{var _0x6cc3af={'name':_0x1741fc[0x0],'timeout':_0x1741fc[0x1]};var _0x4c7c3d=queue['validate'](_0x6cc3af,{'typecast':!![]});if(_0x4c7c3d[_0x065f('0x3e')]){logger[_0x065f('0x3a')](_0x065f('0x3f'),_0x2535a6,_[_0x065f('0x40')](_0x4c7c3d,'message')[_0x065f('0x41')](',\x20'));_0x1ce5fe[_0x065f('0x42')]();}else{var _0x2ffad2=_['find'](_0xdce713[_0x1d26f9[_0x065f('0x2a')]+'Queues'],handleFindQueue(_0x6cc3af['name']));if(_0x2ffad2){startRouting(_0x2535a6,_0x2ffad2,_0x1d26f9,_0xdce713);var _0x819561=(_0x2ffad2['timeout']||0xa)*0x3e8;var _0x33ff2b=(_0x6cc3af[_0x065f('0x3c')]||0x14)*0x3e8;var _0x2cdb70;if(_0x819561>_0x33ff2b){_0x33ff2b=_0x819561;}var _0x2cad46=seqqueue[_0x065f('0x43')](_0x819561);_0x2cad46['id']=_0x2535a6;_0x2cad46[_0x065f('0x44')]=_0x819561;_0x2cad46['qtimeout']=_0x33ff2b;_0x2cad46['channel']=_0x1d26f9[_0x065f('0x2a')];_0xdce713[_0x065f('0x45')][_0x2535a6]['on'](_0x065f('0x46'),function(){logger[_0x065f('0x32')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2535a6);stopRouting(_0x2535a6,_0x2ffad2,_0x1d26f9,_0xdce713);clearTimeout(_0x2cdb70);_0x2cdb70=undefined;_0x2cad46[_0x065f('0x47')](!![]);if(_0xdce713[_0x065f('0x45')][_0x2535a6]){delete _0xdce713[_0x065f('0x45')][_0x2535a6];}_0x1ce5fe['stop']();});_0xdce713[_0x065f('0x45')][_0x2535a6]['on'](_0x065f('0x48'),function(){if(_0xdce713[_0x065f('0x45')][_0x2535a6]){delete _0xdce713[_0x065f('0x45')][_0x2535a6];}});_0x2cdb70=setTimeout(function(){logger[_0x065f('0x32')](_0x065f('0x49'),_0x2535a6);endRouting(_0x2535a6,_0x2ffad2,_0x1d26f9,_0xdce713);clearTimeout(_0x2cdb70);_0x2cad46[_0x065f('0x47')](!![]);_0x1ce5fe[_0x065f('0x4a')]();},_0x33ff2b);switch(_0x2ffad2['strategy']){case'rrmemory':strategy[_0x065f('0x4b')](_0x2cad46,_0x2ffad2,_0xdce713,_0x1d26f9);break;default:strategy[_0x065f('0x4c')](_0x2cad46,_0x2ffad2,_0xdce713,_0x1d26f9);}}else{logger[_0x065f('0x3a')](_0x065f('0x4d'),_0x2535a6,_0x6cc3af[_0x065f('0x34')]);_0x1ce5fe['stop']();}}}catch(_0x420a5f){logger[_0x065f('0x3a')](_0x065f('0x3f'),_0x2535a6,_0x420a5f[_0x065f('0x4e')]);_0x1ce5fe[_0x065f('0x42')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 6be5a85..156cd52 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 _0x33c5=['./util','routing','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','debug','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT','exports','uuid'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0x33c5,0xe6));var _0x533c=function(_0x217a6f,_0x3ecd8b){_0x217a6f=_0x217a6f-0x0;var _0x5553f3=_0x33c5[_0x217a6f];return _0x5553f3;};'use strict';var _=require('lodash');var uuid=require(_0x533c('0x0'));var util=require(_0x533c('0x1'));var logger=require('../../../../../config/logger')(_0x533c('0x2'));var Agent=function(_0x26b916,_0x221e43,_0x23a12d,_0x358127){this['notificationId']=uuid['v4']();this[_0x533c('0x3')]=_0x26b916;this[_0x533c('0x4')]=_0x221e43;this[_0x533c('0x5')]=_0x23a12d;this[_0x533c('0x2')]=_0x358127;this[_0x533c('0x3')][_0x533c('0x6')](this[_0x533c('0x7')][_0x533c('0x8')](this),this[_0x533c('0x9')][_0x533c('0x8')](this));this[_0x533c('0x3')]['on'](_0x533c('0xa'),this[_0x533c('0x9')][_0x533c('0x8')](this));this[_0x533c('0x3')]['on'](_0x533c('0xb'),this['handleDrained'][_0x533c('0x8')](this));};Agent[_0x533c('0xc')][_0x533c('0x6')]=function(){this[_0x533c('0x3')][_0x533c('0x6')](this[_0x533c('0x7')]['bind'](this),this[_0x533c('0x9')][_0x533c('0x8')](this));};Agent[_0x533c('0xc')][_0x533c('0xd')]=function(){this[_0x533c('0x9')](!![]);};Agent[_0x533c('0xc')][_0x533c('0x7')]=function(){logger[_0x533c('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x533c('0x3')]['id'],this[_0x533c('0x4')]['id']);if(_[_0x533c('0xf')](this[_0x533c('0x5')]['agents'][this[_0x533c('0x4')]['id']])){logger[_0x533c('0xe')](_0x533c('0x10'),this[_0x533c('0x3')]['id'],this[_0x533c('0x4')]['id']);setTimeout(this[_0x533c('0x6')][_0x533c('0x8')](this),0x3e8);}else{if(this[_0x533c('0x2')][_0x533c('0x11')]||util[_0x533c('0x12')](this[_0x533c('0x3')]['id'],this[_0x533c('0x5')][_0x533c('0x13')][this[_0x533c('0x4')]['id']],this[_0x533c('0x3')][_0x533c('0x14')],![])){this[_0x533c('0x5')][_0x533c('0x13')][this['agent']['id']][_0x533c('0x15')]=!![];this['realtime']['agents'][this[_0x533c('0x4')]['id']][_0x533c('0x16')]=undefined;util['saveWaitingNotification'](this[_0x533c('0x5')],this[_0x533c('0x2')],this[_0x533c('0x4')],this[_0x533c('0x3')]['channel']);util[_0x533c('0x17')](this[_0x533c('0x18')],this[_0x533c('0x3')]['id'],this[_0x533c('0x5')][_0x533c('0x13')][this[_0x533c('0x4')]['id']],null,this[_0x533c('0x2')]);util[_0x533c('0x19')](this[_0x533c('0x3')]['id'],this[_0x533c('0x5')]['agents'][this[_0x533c('0x4')]['id']],_0x533c('0x1a')+(this['routing'][_0x533c('0x11')]?':FORCED':''));}else{logger[_0x533c('0xe')](_0x533c('0x1b'),this[_0x533c('0x3')]['id'],this[_0x533c('0x4')]['id']);setTimeout(this[_0x533c('0x6')][_0x533c('0x8')](this),0x3e8);}}};Agent[_0x533c('0xc')][_0x533c('0x9')]=function(_0x3c559b){if(_[_0x533c('0xf')](this[_0x533c('0x5')][_0x533c('0x13')][this['agent']['id']])){return logger[_0x533c('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x533c('0x3')]['id'],this[_0x533c('0x4')]['id']);}else{logger[_0x533c('0xe')](_0x533c('0x1c'),this[_0x533c('0x3')]['id'],this[_0x533c('0x4')]['id']);util[_0x533c('0x1d')](this[_0x533c('0x18')],this[_0x533c('0x3')]['id'],this[_0x533c('0x5')][_0x533c('0x13')][this[_0x533c('0x4')]['id']],null,this[_0x533c('0x2')]);this[_0x533c('0x5')][_0x533c('0x13')][this['agent']['id']][_0x533c('0x15')]=![];this[_0x533c('0x5')][_0x533c('0x13')][this[_0x533c('0x4')]['id']]['busyQueue']=undefined;util[_0x533c('0x1e')](this[_0x533c('0x5')],this[_0x533c('0x2')],this[_0x533c('0x4')],this[_0x533c('0x3')]['channel']);util['writeLog'](this['squeue']['id'],this['realtime']['agents'][this[_0x533c('0x4')]['id']],_0x3c559b?'STOP':_0x533c('0x1f'));}if(!_0x3c559b){setTimeout(this['push'][_0x533c('0x8')](this),0x3e8);}};function agent(_0x3cd1e6,_0x14c121,_0x56adcc,_0x44a18d){return new Agent(_0x3cd1e6,_0x14c121,_0x56adcc,_0x44a18d);}module[_0x533c('0x20')]=agent; \ No newline at end of file +var _0xf3cd=['notificationId','agent','realtime','squeue','push','handleRun','handleTimeout','timeout','drained','handleDrained','bind','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','saveWaitingNotification','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3a7fe5,_0x371426){_0x3a7fe5=_0x3a7fe5-0x0;var _0x18ed66=_0xf3cd[_0x3a7fe5];return _0x18ed66;};'use strict';var _=require(_0xdf3c('0x0'));var uuid=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var logger=require(_0xdf3c('0x3'))(_0xdf3c('0x4'));var Agent=function(_0x433a7f,_0x54db05,_0x401518,_0x71b446){this[_0xdf3c('0x5')]=uuid['v4']();this['squeue']=_0x433a7f;this[_0xdf3c('0x6')]=_0x54db05;this[_0xdf3c('0x7')]=_0x401518;this[_0xdf3c('0x4')]=_0x71b446;this[_0xdf3c('0x8')][_0xdf3c('0x9')](this[_0xdf3c('0xa')]['bind'](this),this[_0xdf3c('0xb')]['bind'](this));this['squeue']['on'](_0xdf3c('0xc'),this[_0xdf3c('0xb')]['bind'](this));this[_0xdf3c('0x8')]['on'](_0xdf3c('0xd'),this[_0xdf3c('0xe')][_0xdf3c('0xf')](this));};Agent[_0xdf3c('0x10')][_0xdf3c('0x9')]=function(){this[_0xdf3c('0x8')][_0xdf3c('0x9')](this['handleRun'][_0xdf3c('0xf')](this),this[_0xdf3c('0xb')][_0xdf3c('0xf')](this));};Agent[_0xdf3c('0x10')]['handleDrained']=function(){this[_0xdf3c('0xb')](!![]);};Agent[_0xdf3c('0x10')][_0xdf3c('0xa')]=function(){logger['debug'](_0xdf3c('0x11'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);if(_[_0xdf3c('0x12')](this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']])){logger[_0xdf3c('0x14')](_0xdf3c('0x15'),this[_0xdf3c('0x8')]['id'],this['agent']['id']);setTimeout(this[_0xdf3c('0x9')][_0xdf3c('0xf')](this),0x3e8);}else{if(this[_0xdf3c('0x4')][_0xdf3c('0x16')]||util[_0xdf3c('0x17')](this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],this[_0xdf3c('0x8')][_0xdf3c('0x18')],![])){this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']]['busy']=!![];this[_0xdf3c('0x7')]['agents'][this[_0xdf3c('0x6')]['id']][_0xdf3c('0x19')]=undefined;util[_0xdf3c('0x1a')](this[_0xdf3c('0x7')],this[_0xdf3c('0x4')],this[_0xdf3c('0x6')],this['squeue'][_0xdf3c('0x18')]);util[_0xdf3c('0x1b')](this[_0xdf3c('0x5')],this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],null,this[_0xdf3c('0x4')]);util[_0xdf3c('0x1c')](this[_0xdf3c('0x8')]['id'],this['realtime'][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],'RINGING'+(this[_0xdf3c('0x4')]['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xdf3c('0x1d'),this[_0xdf3c('0x8')]['id'],this['agent']['id']);setTimeout(this['push'][_0xdf3c('0xf')](this),0x3e8);}}};Agent[_0xdf3c('0x10')][_0xdf3c('0xb')]=function(_0x1ccdd4){if(_['isNil'](this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']])){return logger['debug'](_0xdf3c('0x15'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);}else{logger['debug'](_0xdf3c('0x1e'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);util[_0xdf3c('0x1f')](this['notificationId'],this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')]['agents'][this[_0xdf3c('0x6')]['id']],null,this[_0xdf3c('0x4')]);this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']][_0xdf3c('0x20')]=![];this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']]['busyQueue']=undefined;util[_0xdf3c('0x21')](this[_0xdf3c('0x7')],this['routing'],this['agent'],this[_0xdf3c('0x8')]['channel']);util[_0xdf3c('0x1c')](this['squeue']['id'],this['realtime']['agents'][this[_0xdf3c('0x6')]['id']],_0x1ccdd4?_0xdf3c('0x22'):_0xdf3c('0x23'));}if(!_0x1ccdd4){setTimeout(this[_0xdf3c('0x9')]['bind'](this),0x3e8);}};function agent(_0x49f147,_0x3d8557,_0x49d0f0,_0x46e40f){return new Agent(_0x49f147,_0x3d8557,_0x49d0f0,_0x46e40f);}module[_0xdf3c('0x24')]=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 e5f39f8..eafd0a5 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 _0xdb05=['[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','queue','squeue','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','isNil','Agents','length','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busy','busyQueue','name','saveWaitingNotification','showNotification'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xdb05,0x140));var _0x5db0=function(_0x9d680d,_0x295c2f){_0x9d680d=_0x9d680d-0x0;var _0x2ff74d=_0xdb05[_0x9d680d];return _0x2ff74d;};'use strict';var _=require(_0x5db0('0x0'));var uuid=require(_0x5db0('0x1'));var util=require(_0x5db0('0x2'));var logger=require(_0x5db0('0x3'))(_0x5db0('0x4'));var Beepall=function(_0x456629,_0x3805dd,_0x36cf21,_0x3c68a3){this[_0x5db0('0x5')]=uuid['v4']();this['squeue']=_0x456629;this[_0x5db0('0x6')]=_0x3805dd;this['realtime']=_0x36cf21;this[_0x5db0('0x4')]=_0x3c68a3;this[_0x5db0('0x7')][_0x5db0('0x8')](this[_0x5db0('0x9')][_0x5db0('0xa')](this),this[_0x5db0('0xb')][_0x5db0('0xa')](this));this[_0x5db0('0x7')]['on'](_0x5db0('0xc'),this['handleTimeout']['bind'](this));this[_0x5db0('0x7')]['on']('drained',this[_0x5db0('0xd')][_0x5db0('0xa')](this));};Beepall[_0x5db0('0xe')][_0x5db0('0x8')]=function(){this[_0x5db0('0x7')][_0x5db0('0x8')](this[_0x5db0('0x9')][_0x5db0('0xa')](this),this[_0x5db0('0xb')]['bind'](this));};Beepall['prototype'][_0x5db0('0xd')]=function(){this[_0x5db0('0xb')](!![]);};Beepall[_0x5db0('0xe')][_0x5db0('0x9')]=function(){var _0x12dd01=!![];if(!_['isNil'](this[_0x5db0('0x6')])&&!_[_0x5db0('0xf')](this[_0x5db0('0x6')][_0x5db0('0x10')])&&this[_0x5db0('0x6')][_0x5db0('0x10')][_0x5db0('0x11')]>0x0){for(var _0x2add72=0x0,_0x466e96;_0x2add720x0){for(var _0x3e7a02=0x0,_0x7f0478;_0x3e7a020x0&&_0x471dc4[_0x2b67b1+_0x7717('0x1f')]>=_0x471dc4[_0x2b67b1+_0x7717('0x1e')]){writeLog(_0x2c25c5,_0x471dc4,_0x2b67b1[_0x7717('0x20')]()+_0x7717('0x21'));return![];}}return!![];};exports['showNotification']=function(_0x33e592,_0x584fa6,_0x431d91,_0x39fc4f,_0x470b2d){return sendNotification(!![],_0x33e592,_0x584fa6,_0x431d91,_0x39fc4f,_0x470b2d);};exports[_0x7717('0x22')]=function(_0xa4428b,_0x2f3de2,_0x7fa7a7,_0x59e312,_0x7eab8){return sendNotification(![],_0xa4428b,_0x2f3de2,_0x7fa7a7,_0x59e312,_0x7eab8);};exports[_0x7717('0x23')]=function(_0x208f36,_0x40242f,_0x492c22){var _0x5c0056=_0x40242f['interaction']['UserId'];if(!_0x5c0056&&_0x492c22){_0x5c0056=_0x492c22['id'];}var _0x145986=_['some'](_0x208f36[_0x40242f[_0x7717('0x24')]+_0x7717('0x25')],function(_0x18c831){var _0x20e1cb=_['capitalize'](_0x40242f['channel'])+'InteractionId';return _0x18c831[_0x20e1cb]===_0x40242f[_0x7717('0x26')]['id'];});if(!_0x145986&&_0x5c0056&&_0x208f36['agents'][_0x5c0056]){_0x145986=_['some'](_0x208f36['agents'][_0x5c0056][_0x40242f[_0x7717('0x24')]+_0x7717('0x27')],function(_0x110c82){return _0x110c82['id']===_0x40242f[_0x7717('0x26')]['id'];});}return _0x145986;};exports[_0x7717('0x28')]=function(_0x2ea1ee,_0x588fce,_0x10fa96,_0x5d631b){if(_0x10fa96&&_0x10fa96['id']&&_0x2ea1ee[_0x7717('0x29')]&&_0x2ea1ee[_0x7717('0x29')][_0x10fa96['id']]){_0x2ea1ee['agents'][_0x10fa96['id']][_0x5d631b+_0x7717('0x27')][_0x588fce[_0x7717('0x13')]['id']]={'id':_0x588fce['interaction']['id']};}};exports[_0x7717('0x2a')]=function(_0x4cef83,_0x1fdd1d,_0x1f161e,_0x59ddae){if(_0x1f161e&&_0x1f161e['id']&&_0x4cef83[_0x7717('0x29')]&&_0x4cef83[_0x7717('0x29')][_0x1f161e['id']]){delete _0x4cef83['agents'][_0x1f161e['id']][_0x59ddae+_0x7717('0x27')][_0x1fdd1d['message']['id']];}};exports[_0x7717('0x2b')]=writeLog; \ No newline at end of file +var _0x5c70=['[%s][QUEUE]\x20%s','user:%s','emit','notification:%s','save','remove','debug','isAgentAvailable','busy','online','OFFLINE','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','showNotification','hideNotification','checkWaitingNotifications','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','interaction','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','message','lodash','util','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','split','\x20interaction','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format'];(function(_0x237b8a,_0x2abfcb){var _0x135d6a=function(_0x5044ad){while(--_0x5044ad){_0x237b8a['push'](_0x237b8a['shift']());}};_0x135d6a(++_0x2abfcb);}(_0x5c70,0x123));var _0x05c7=function(_0x1a76d8,_0x1df29b){_0x1a76d8=_0x1a76d8-0x0;var _0x1cad14=_0x5c70[_0x1a76d8];return _0x1cad14;};'use strict';var _=require(_0x05c7('0x0'));var util=require(_0x05c7('0x1'));var utils=require('../utils');var Redis=require('ioredis');var config=require(_0x05c7('0x2'));var logger=require(_0x05c7('0x3'))(_0x05c7('0x4'));config[_0x05c7('0x5')]=_[_0x05c7('0x6')](config[_0x05c7('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x05c7('0x7'))(new Redis(config['redis']));function sendNotification(_0x1dd927,_0x401127,_0x5a6cc9,_0x309f5c,_0x16fdd0,_0x2db3e3){var _0x5ee95c=_0x2db3e3||{};var _0x5eb48a=_0x5a6cc9[_0x05c7('0x8')]('.');var _0x43766f={'uniqueid':_0x401127,'channel':_0x5eb48a[0x0],'id':_0x5eb48a[0x1],'title':_0x5eb48a[0x0]+_0x05c7('0x9'),'interactionId':_0x5eb48a[0x2],'queue':_0x16fdd0?_0x16fdd0[_0x05c7('0xa')]:null,'sound':_0x5ee95c[_0x05c7('0xb')][_0x05c7('0xc')],'shake':_0x5ee95c['account']['notificationShake']};try{if(!_0x5ee95c['body']){_0x5ee95c[_0x05c7('0xd')]={};}if(_0x16fdd0){_0x5ee95c[_0x05c7('0xd')][_0x05c7('0xe')]=_0x16fdd0;}else if(_0x5ee95c[_0x05c7('0xd')]['queue']){delete _0x5ee95c[_0x05c7('0xd')][_0x05c7('0xe')];}_0x43766f[_0x05c7('0xf')]=utils[_0x05c7('0x10')](_0x5ee95c[_0x05c7('0xb')][_0x05c7('0x11')],_0x5ee95c);}catch(_0x4c4d74){_0x43766f[_0x05c7('0xf')]=_0x05c7('0x12');logger[_0x05c7('0x13')](util[_0x05c7('0x14')](_0x05c7('0x15'),_0x401127,_0x4c4d74['message']));}io['to'](util[_0x05c7('0x14')](_0x05c7('0x16'),_0x309f5c[_0x05c7('0xa')]))[_0x05c7('0x17')](util[_0x05c7('0x14')](_0x05c7('0x18'),_0x1dd927?_0x05c7('0x19'):_0x05c7('0x1a')),_0x43766f);}function writeLog(_0xd8f469,_0x10672e,_0x53baf1){return logger[_0x05c7('0x1b')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0xd8f469,_0x10672e[_0x05c7('0xa')],_0x53baf1));}exports[_0x05c7('0x1c')]=function(_0xa35fb9,_0x85b7ce,_0x24bdbb,_0x5b3cc3){if(_0x85b7ce[_0x05c7('0x1d')]){writeLog(_0xa35fb9,_0x85b7ce,'BUSY');return![];}if(!_0x85b7ce[_0x05c7('0x1e')]){writeLog(_0xa35fb9,_0x85b7ce,_0x05c7('0x1f'));return![];}if(_0x85b7ce[_0x24bdbb+'Pause']){writeLog(_0xa35fb9,_0x85b7ce,_0x05c7('0x20'));return![];}if(_0x5b3cc3&&_0x85b7ce['hasOwnProperty'](_0x24bdbb+'Capacity')&&_0x85b7ce[_0x05c7('0x21')](_0x24bdbb+_0x05c7('0x22'))){if(_0x85b7ce[_0x24bdbb+'Capacity']>0x0&&_0x85b7ce[_0x24bdbb+_0x05c7('0x22')]>=_0x85b7ce[_0x24bdbb+_0x05c7('0x23')]){writeLog(_0xa35fb9,_0x85b7ce,_0x24bdbb[_0x05c7('0x24')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x05c7('0x25')]=function(_0x2764e7,_0x285f99,_0x4667f3,_0x386920,_0xdb3a66){return sendNotification(!![],_0x2764e7,_0x285f99,_0x4667f3,_0x386920,_0xdb3a66);};exports[_0x05c7('0x26')]=function(_0x38abcd,_0x4f3155,_0x177632,_0x397765,_0x53a1a8){return sendNotification(![],_0x38abcd,_0x4f3155,_0x177632,_0x397765,_0x53a1a8);};exports[_0x05c7('0x27')]=function(_0x18e687,_0x2fd531,_0x5436e6){var _0x576b1b=_0x2fd531['interaction'][_0x05c7('0x28')];if(!_0x576b1b&&_0x5436e6){_0x576b1b=_0x5436e6['id'];}var _0x5e5216=_[_0x05c7('0x29')](_0x18e687[_0x2fd531[_0x05c7('0x2a')]+_0x05c7('0x2b')],function(_0x299739){var _0x2a21c3=_[_0x05c7('0x2c')](_0x2fd531['channel'])+_0x05c7('0x2d');return _0x299739[_0x2a21c3]===_0x2fd531[_0x05c7('0x2e')]['id'];});if(!_0x5e5216&&_0x576b1b&&_0x18e687[_0x05c7('0x2f')][_0x576b1b]){_0x5e5216=_[_0x05c7('0x29')](_0x18e687[_0x05c7('0x2f')][_0x576b1b][_0x2fd531[_0x05c7('0x2a')]+_0x05c7('0x30')],function(_0x270b70){return _0x270b70['id']===_0x2fd531[_0x05c7('0x2e')]['id'];});}return _0x5e5216;};exports[_0x05c7('0x31')]=function(_0x43faaa,_0x42f212,_0x24e3fd,_0x46c4d6){if(_0x24e3fd&&_0x24e3fd['id']&&_0x43faaa[_0x05c7('0x2f')]&&_0x43faaa[_0x05c7('0x2f')][_0x24e3fd['id']]){_0x43faaa['agents'][_0x24e3fd['id']][_0x46c4d6+_0x05c7('0x30')][_0x42f212['message']['id']]={'id':_0x42f212['interaction']['id']};}};exports[_0x05c7('0x32')]=function(_0x4bb6f2,_0x1183a5,_0x5a56f8,_0x2b6375){if(_0x5a56f8&&_0x5a56f8['id']&&_0x4bb6f2[_0x05c7('0x2f')]&&_0x4bb6f2['agents'][_0x5a56f8['id']]){delete _0x4bb6f2[_0x05c7('0x2f')][_0x5a56f8['id']][_0x2b6375+_0x05c7('0x30')][_0x1183a5[_0x05c7('0x33')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index b9a6f64..beed8fd 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 _0x09bc=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0x09bc,0x188));var _0xc09b=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x09bc[_0x1fafa5];return _0xcf08c9;};'use strict';var schema=require(_0xc09b('0x0'));var sh=require(_0xc09b('0x1'));var _=require(_0xc09b('0x2'));var utils=require(_0xc09b('0x3'));var logger=require(_0xc09b('0x4'))('routing');var system=schema({'command':{'type':_0xc09b('0x5'),'required':!![],'message':_0xc09b('0x6')}});exports[_0xc09b('0x7')]=function(_0x2086a1,_0x53e3cc){return function(_0x455d5e){try{var _0x1f21b8={'command':_0x53e3cc[0x0]};var _0x30056b=system[_0xc09b('0x0')](_0x1f21b8,{'typecast':!![]});if(_0x30056b[_0xc09b('0x8')]){logger[_0xc09b('0x9')]('[%s][SYSTEM]\x20%s',_0x2086a1,_[_0xc09b('0xa')](_0x30056b,_0xc09b('0xb'))['join'](',\x20'));logger[_0xc09b('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2086a1);_0x455d5e[_0xc09b('0xd')]();}else{var _0x4af750=this;var _0x255b62=utils[_0xc09b('0xe')](_0x53e3cc[0x0],this);logger[_0xc09b('0xc')](_0xc09b('0xf'),_0x2086a1,_0x255b62);sh['exec'](_[_0xc09b('0x10')](_0x255b62),function(_0x1cf5c8,_0x1a8d4a){logger[_0xc09b('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2086a1,_0x1cf5c8);if(_0x1cf5c8==0x0){var _0x5f095f=_0x1a8d4a['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x53e3cc[0x1])||_['isEmpty'](_0x53e3cc[0x1])){logger[_0xc09b('0xc')](_0xc09b('0x11'),_0x2086a1);_0x4af750[_0xc09b('0x12')][_0x53e3cc[0x1]]=_0x5f095f;}else{logger[_0xc09b('0xc')](_0xc09b('0x13'),_0x2086a1,_0x53e3cc[0x1],_0x5f095f);_0x4af750[_0xc09b('0x12')][_0x53e3cc[0x1]]=_0x5f095f;}}_0x455d5e[_0xc09b('0xd')]();});}}catch(_0x218f6d){logger[_0xc09b('0x9')]('[%s][SYSTEM]\x20%s',_0x2086a1,_[_0xc09b('0x14')](_0x218f6d)?JSON[_0xc09b('0x15')](_0x218f6d):_0x218f6d);logger['info'](_0xc09b('0x16'),_0x2086a1);_0x455d5e[_0xc09b('0xd')]();}};}; \ No newline at end of file +var _0xb6b1=['error','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x1e4e22,_0x567aad){var _0x5a26ea=function(_0x1f9afd){while(--_0x1f9afd){_0x1e4e22['push'](_0x1e4e22['shift']());}};_0x5a26ea(++_0x567aad);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0xb6b1[_0x2f48cd];return _0x193ae2;};'use strict';var schema=require(_0x1b6b('0x0'));var sh=require('shelljs');var _=require(_0x1b6b('0x1'));var utils=require('./utils');var logger=require(_0x1b6b('0x2'))(_0x1b6b('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x1b6b('0x4')}});exports['consequence']=function(_0x2a2c45,_0xb1a61e){return function(_0x2c4040){try{var _0xdbbe22={'command':_0xb1a61e[0x0]};var _0x5870ca=system[_0x1b6b('0x0')](_0xdbbe22,{'typecast':!![]});if(_0x5870ca['length']){logger[_0x1b6b('0x5')]('[%s][SYSTEM]\x20%s',_0x2a2c45,_[_0x1b6b('0x6')](_0x5870ca,_0x1b6b('0x7'))[_0x1b6b('0x8')](',\x20'));logger[_0x1b6b('0x9')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2a2c45);_0x2c4040['next']();}else{var _0x475423=this;var _0x43d9f0=utils[_0x1b6b('0xa')](_0xb1a61e[0x0],this);logger[_0x1b6b('0x9')](_0x1b6b('0xb'),_0x2a2c45,_0x43d9f0);sh[_0x1b6b('0xc')](_[_0x1b6b('0xd')](_0x43d9f0),function(_0x5d45dd,_0x360a8b){logger[_0x1b6b('0x9')](_0x1b6b('0xe'),_0x2a2c45,_0x5d45dd);if(_0x5d45dd==0x0){var _0x5abe44=_0x360a8b[_0x1b6b('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xb1a61e[0x1])||_['isEmpty'](_0xb1a61e[0x1])){logger[_0x1b6b('0x9')](_0x1b6b('0x10'),_0x2a2c45);_0x475423[_0x1b6b('0x11')][_0xb1a61e[0x1]]=_0x5abe44;}else{logger[_0x1b6b('0x9')](_0x1b6b('0x12'),_0x2a2c45,_0xb1a61e[0x1],_0x5abe44);_0x475423[_0x1b6b('0x11')][_0xb1a61e[0x1]]=_0x5abe44;}}_0x2c4040[_0x1b6b('0x13')]();});}}catch(_0x553a6d){logger[_0x1b6b('0x5')](_0x1b6b('0x14'),_0x2a2c45,_[_0x1b6b('0x15')](_0x553a6d)?JSON[_0x1b6b('0x16')](_0x553a6d):_0x553a6d);logger['info'](_0x1b6b('0x17'),_0x2a2c45);_0x2c4040[_0x1b6b('0x13')]();}};}; \ 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 729520f..e6fb577 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 _0x35cd=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','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','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x35cd,0x99));var _0xd35c=function(_0x4d153e,_0x393297){_0x4d153e=_0x4d153e-0x0;var _0x254ef2=_0x35cd[_0x4d153e];return _0x254ef2;};'use strict';var schema=require(_0xd35c('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xd35c('0x1')),'smsInteraction':require(_0xd35c('0x2')),'mailInteraction':require(_0xd35c('0x3')),'faxInteraction':require(_0xd35c('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xd35c('0x5'))('routing');var tag=schema({'tag':{'type':_0xd35c('0x6'),'required':!![],'message':_0xd35c('0x7')}});exports[_0xd35c('0x8')]=function(_0x4a1b60,_0x106ade,_0x47d60f,_0x5e5588){return function(_0x4c9c54){try{var _0x73e62c={'tag':_0x106ade[0x0]};var _0x55ddcc=tag[_0xd35c('0x0')](_0x73e62c,{'typecast':!![]});if(_0x55ddcc[_0xd35c('0x9')]){logger[_0xd35c('0xa')]('[%s][TAG]\x20%s',_0x4a1b60,_[_0xd35c('0xb')](_0x55ddcc,_0xd35c('0xc'))['join'](',\x20'));logger[_0xd35c('0xd')](_0xd35c('0xe'),_0x4a1b60);_0x4c9c54[_0xd35c('0xf')]();}else{var _0x14f23f={'ids':[_0x106ade[0x0]]};if(rpc[_0x5e5588[_0xd35c('0x10')]+_0xd35c('0x11')]){rpc[_0x5e5588[_0xd35c('0x10')]+_0xd35c('0x11')][_0xd35c('0x12')](_0x5e5588['interaction']['id'],_0x14f23f)[_0xd35c('0x13')](function(_0x13f804){logger[_0xd35c('0xd')](_0xd35c('0x14'),_0x4a1b60,_0x106ade[0x1],_0x5e5588[_0xd35c('0x10')],_0x5e5588['interaction']['id']);})[_0xd35c('0x15')](function(_0x4a7cb9){logger['error'](_0xd35c('0x16'),_0x4a1b60,JSON[_0xd35c('0x17')](_0x4a7cb9));logger[_0xd35c('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4a1b60);})[_0xd35c('0x18')](function(){_0x4c9c54[_0xd35c('0xf')]();});}}}catch(_0x137541){logger[_0xd35c('0xa')]('[%s][TAG]\x20%s',_0x4a1b60,_[_0xd35c('0x19')](_0x137541)?JSON[_0xd35c('0x17')](_0x137541):_0x137541);logger[_0xd35c('0xd')](_0xd35c('0xe'),_0x4a1b60);_0x4c9c54[_0xd35c('0xf')]();}};}; \ No newline at end of file +var _0xb9a8=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','interaction','catch','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','join','info'];(function(_0x1d221e,_0x10ed79){var _0x59c091=function(_0x39229f){while(--_0x39229f){_0x1d221e['push'](_0x1d221e['shift']());}};_0x59c091(++_0x10ed79);}(_0xb9a8,0x104));var _0x8b9a=function(_0x923944,_0x41495c){_0x923944=_0x923944-0x0;var _0x2c8dbd=_0xb9a8[_0x923944];return _0x2c8dbd;};'use strict';var schema=require('validate');var _=require(_0x8b9a('0x0'));var rpc={'chatInteraction':require(_0x8b9a('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x8b9a('0x2')),'faxInteraction':require(_0x8b9a('0x3')),'whatsappInteraction':require(_0x8b9a('0x4'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x8b9a('0x5'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x8b9a('0x6')]=function(_0x378af1,_0x5c33b0,_0x5e0723,_0x1a9b1f){return function(_0x2cfaaf){try{var _0x4c39a9={'tag':_0x5c33b0[0x0]};var _0x484851=tag[_0x8b9a('0x7')](_0x4c39a9,{'typecast':!![]});if(_0x484851[_0x8b9a('0x8')]){logger[_0x8b9a('0x9')](_0x8b9a('0xa'),_0x378af1,_[_0x8b9a('0xb')](_0x484851,_0x8b9a('0xc'))[_0x8b9a('0xd')](',\x20'));logger[_0x8b9a('0xe')](_0x8b9a('0xf'),_0x378af1);_0x2cfaaf[_0x8b9a('0x10')]();}else{var _0x3e07f3={'ids':[_0x5c33b0[0x0]]};if(rpc[_0x1a9b1f[_0x8b9a('0x11')]+_0x8b9a('0x12')]){rpc[_0x1a9b1f[_0x8b9a('0x11')]+'Interaction']['addTags'](_0x1a9b1f['interaction']['id'],_0x3e07f3)[_0x8b9a('0x13')](function(_0x36751e){logger[_0x8b9a('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x378af1,_0x5c33b0[0x1],_0x1a9b1f['channel'],_0x1a9b1f[_0x8b9a('0x14')]['id']);})[_0x8b9a('0x15')](function(_0x2ee238){logger[_0x8b9a('0x9')](_0x8b9a('0xa'),_0x378af1,JSON[_0x8b9a('0x16')](_0x2ee238));logger[_0x8b9a('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x378af1);})[_0x8b9a('0x17')](function(){_0x2cfaaf[_0x8b9a('0x10')]();});}}}catch(_0x4e5514){logger[_0x8b9a('0x9')]('[%s][TAG]\x20%s',_0x378af1,_[_0x8b9a('0x18')](_0x4e5514)?JSON[_0x8b9a('0x16')](_0x4e5514):_0x4e5514);logger[_0x8b9a('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x378af1);_0x2cfaaf['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 d830edf..b3d6045 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 _0xd85e=['application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','params','stringify','utf8','POST'];(function(_0x9812e1,_0x306ec4){var _0x5ccfd9=function(_0x5ce631){while(--_0x5ce631){_0x9812e1['push'](_0x9812e1['shift']());}};_0x5ccfd9(++_0x306ec4);}(_0xd85e,0x10d));var _0xed85=function(_0x11d62f,_0x5995ad){_0x11d62f=_0x11d62f-0x0;var _0x211f94=_0xd85e[_0x11d62f];return _0x211f94;};'use strict';var rp=require(_0xed85('0x0'));var logger=require(_0xed85('0x1'))(_0xed85('0x2'));var _=require(_0xed85('0x3'));var arr=[];exports['consequence']=function(_0xf6987f,_0x4f7c63){return function(_0x1ddbc4){var _0x127f2d=_0x4f7c63[0xa];var _0x3071b8=_0x4f7c63[0xb];var _0x49b9a0=_0x4f7c63[0xc];var _0x39fac7=_0x4f7c63[0xd];var _0x252a8a=_0x4f7c63[0xe];var _0x28785c=_0x4f7c63[0xf][_0xed85('0x4')](/\n/g,_0xed85('0x5'));var _0x667b4c=_0x4f7c63[0x10][_0xed85('0x4')](/\n/g,'\x20');if(!arr[_0xed85('0x6')](_0x3071b8)){arr[_0xed85('0x7')](_0x3071b8);var _0x287483=_0x4f7c63[0x3];var _0x2ec529=_0x4f7c63[0x4];var _0x1ff6d8=_0x4f7c63[0x1];var _0x354d8c=_0x4f7c63[0x0];var _0x46996e={};_0x46996e[_0xed85('0x8')]=_0x4f7c63[0x8]+_0xed85('0x9')+_0x49b9a0+'|'+_0x127f2d+'|'+_0x39fac7+'|'+_0x3071b8+'|'+_0x252a8a;_0x46996e[_0xed85('0xa')]=_0x4f7c63[0x7]+'?params='+_0x49b9a0+'|'+_0x127f2d+'|'+_0x39fac7+'|'+_0x3071b8+'|'+_0x252a8a+'|'+_0x28785c+'|'+_0x667b4c;_0x46996e[_0xed85('0xb')]=_0x4f7c63[0x9];var _0x3118ba={};_0x3118ba[_0xed85('0xc')]=_0xed85('0xd');_0x3118ba[_0xed85('0xe')]='login';var _0x79b0b7=[];_0x79b0b7[_0xed85('0x7')](_0x4f7c63[0x2]);_0x79b0b7[_0xed85('0x7')](_0x4f7c63[0x5]);_0x79b0b7['push'](_0x4f7c63[0x6]);_0x3118ba[_0xed85('0xf')]=_0x79b0b7;_0x3118ba['id']=0x1;var _0x4a1a02=JSON[_0xed85('0x10')](_0x3118ba);var _0x534336={'encoding':_0xed85('0x11'),'method':_0xed85('0x12'),'timeout':0x2710,'url':_0x287483,'headers':{'Content-Type':_0xed85('0x13')},'body':_0x4a1a02};return rp(_0x534336)[_0xed85('0x14')](function(_0x197303){const _0x4829f6=JSON['parse'](_0x197303);if(!_0x4829f6[_0xed85('0x15')][_0xed85('0x16')]){throw new Error(_0xed85('0x17'));}var _0x7f203e=_0x3071b8;var _0x5d1d90=_0xed85('0x18')+_0x1ff6d8+'&serviceId='+_0x354d8c+_0xed85('0x19')+_0x7f203e+_0xed85('0x1a')+JSON['stringify'](_0x46996e);var _0x2f7c63=_0x2ec529+'?'+_0x5d1d90;return rp(_0x2f7c63);})[_0xed85('0x14')](function(_0x30b3f9){logger['info'](_0xed85('0x1b'),_0xf6987f,_0x30b3f9);_0x1ddbc4[_0xed85('0x1c')]();})[_0xed85('0x1d')](function(_0x55d731){logger[_0xed85('0x1e')](_0xed85('0x1f'),_0xf6987f,_[_0xed85('0x20')](_0x55d731)?JSON['stringify'](_0x55d731):_0x55d731);_0x1ddbc4[_0xed85('0x1c')]();});}else{logger[_0xed85('0x21')](_0xed85('0x22'),_0xf6987f);_0x1ddbc4[_0xed85('0x23')]();}};}; \ No newline at end of file +var _0x85be=['error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','includes','push','urlOnRing','?params=','title','jsonrpc','2.0','method','params','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch'];(function(_0x40eec9,_0x817a67){var _0xfee890=function(_0x186640){while(--_0x186640){_0x40eec9['push'](_0x40eec9['shift']());}};_0xfee890(++_0x817a67);}(_0x85be,0x12d));var _0xe85b=function(_0x91cd65,_0x936bc0){_0x91cd65=_0x91cd65-0x0;var _0x337efe=_0x85be[_0x91cd65];return _0x337efe;};'use strict';var rp=require(_0xe85b('0x0'));var logger=require(_0xe85b('0x1'))(_0xe85b('0x2'));var _=require(_0xe85b('0x3'));var arr=[];exports['consequence']=function(_0x15671e,_0x51e6e9){return function(_0x84d0bf){var _0x2f8347=_0x51e6e9[0xa];var _0x5b436f=_0x51e6e9[0xb];var _0x1ae948=_0x51e6e9[0xc];var _0xc84cc8=_0x51e6e9[0xd];var _0x5744b2=_0x51e6e9[0xe];var _0x1b1aef=_0x51e6e9[0xf]['replace'](/\n/g,'\x20-\x20');var _0x456cd5=_0x51e6e9[0x10][_0xe85b('0x4')](/\n/g,'\x20');if(!arr[_0xe85b('0x5')](_0x5b436f)){arr[_0xe85b('0x6')](_0x5b436f);var _0x351446=_0x51e6e9[0x3];var _0x44bfa9=_0x51e6e9[0x4];var _0x449168=_0x51e6e9[0x1];var _0xd631d1=_0x51e6e9[0x0];var _0x20dddc={};_0x20dddc['urlOnAnswer']=_0x51e6e9[0x8]+'?params='+_0x1ae948+'|'+_0x2f8347+'|'+_0xc84cc8+'|'+_0x5b436f+'|'+_0x5744b2;_0x20dddc[_0xe85b('0x7')]=_0x51e6e9[0x7]+_0xe85b('0x8')+_0x1ae948+'|'+_0x2f8347+'|'+_0xc84cc8+'|'+_0x5b436f+'|'+_0x5744b2+'|'+_0x1b1aef+'|'+_0x456cd5;_0x20dddc[_0xe85b('0x9')]=_0x51e6e9[0x9];var _0x4c3ab6={};_0x4c3ab6[_0xe85b('0xa')]=_0xe85b('0xb');_0x4c3ab6[_0xe85b('0xc')]='login';var _0x4d35ab=[];_0x4d35ab[_0xe85b('0x6')](_0x51e6e9[0x2]);_0x4d35ab[_0xe85b('0x6')](_0x51e6e9[0x5]);_0x4d35ab[_0xe85b('0x6')](_0x51e6e9[0x6]);_0x4c3ab6[_0xe85b('0xd')]=_0x4d35ab;_0x4c3ab6['id']=0x1;var _0x2d5127=JSON['stringify'](_0x4c3ab6);var _0x3d3d83={'encoding':_0xe85b('0xe'),'method':_0xe85b('0xf'),'timeout':0x2710,'url':_0x351446,'headers':{'Content-Type':_0xe85b('0x10')},'body':_0x2d5127};return rp(_0x3d3d83)[_0xe85b('0x11')](function(_0x1fd350){const _0x1c596b=JSON[_0xe85b('0x12')](_0x1fd350);if(!_0x1c596b[_0xe85b('0x13')][_0xe85b('0x14')]){throw new Error(_0xe85b('0x15'));}var _0x17621f=_0x5b436f;var _0x26d8a7=_0xe85b('0x16')+_0x449168+'&serviceId='+_0xd631d1+_0xe85b('0x17')+_0x17621f+_0xe85b('0x18')+JSON['stringify'](_0x20dddc);var _0x1ddcc3=_0x44bfa9+'?'+_0x26d8a7;return rp(_0x1ddcc3);})[_0xe85b('0x11')](function(_0x5ae31d){logger[_0xe85b('0x19')](_0xe85b('0x1a'),_0x15671e,_0x5ae31d);_0x84d0bf[_0xe85b('0x1b')]();})[_0xe85b('0x1c')](function(_0x1d5c47){logger[_0xe85b('0x1d')](_0xe85b('0x1e'),_0x15671e,_['isObject'](_0x1d5c47)?JSON['stringify'](_0x1d5c47):_0x1d5c47);_0x84d0bf[_0xe85b('0x1b')]();});}else{logger[_0xe85b('0x19')](_0xe85b('0x1f'),_0x15671e);_0x84d0bf[_0xe85b('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 6a9e462..1961e63 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x4e0fb1,_0x458ec6){var _0xd29419=function(_0x502643){while(--_0x502643){_0x4e0fb1['push'](_0x4e0fb1['shift']());}};_0xd29419(++_0x458ec6);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x3a586a,_0x51558f){var _0x1d33b8=function(_0x438054){while(--_0x438054){_0x3a586a['push'](_0x3a586a['shift']());}};_0x1d33b8(++_0x51558f);}(_0xe706,0xa3));var _0x6e70=function(_0x32e779,_0x1c2596){_0x32e779=_0x32e779-0x0;var _0x47d7b3=_0xe706[_0x32e779];return _0x47d7b3;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index e8c75e2..1875060 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 _0x6822=['faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions'];(function(_0x292893,_0x3cd21e){var _0x5a55ac=function(_0x420f8d){while(--_0x420f8d){_0x292893['push'](_0x292893['shift']());}};_0x5a55ac(++_0x3cd21e);}(_0x6822,0xca));var _0x2682=function(_0x34918a,_0x3b00f4){_0x34918a=_0x34918a-0x0;var _0x217d59=_0x6822[_0x34918a];return _0x217d59;};'use strict';var _=require(_0x2682('0x0'));var util=require(_0x2682('0x1'));var path=require(_0x2682('0x2'));var fs=require('fs');var jayson=require(_0x2682('0x3'));var BPromise=require(_0x2682('0x4'));var utils=require(_0x2682('0x5'));var sUtils=require(_0x2682('0x6'));var logger=require(_0x2682('0x7'))(_0x2682('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x2682('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x2682('0xa')),'faxQueueReport':require(_0x2682('0xb')),'whatsappQueueReport':require(_0x2682('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x5bfb13,_0x582d30,_0x2699f0){return util[_0x2682('0xd')](_0x2682('0xe'),_0x5bfb13,_0x582d30||0x0,_0x2699f0||0x0);}function getIntervals(_0x13fef8,_0x4b484e){var _0xc33e58=[];if(!_[_0x2682('0xf')](_0x4b484e[_0x2682('0x10')])&&!_[_0x2682('0xf')](_0x13fef8[_0x4b484e['IntervalId']])&&!_[_0x2682('0xf')](_0x13fef8[_0x4b484e[_0x2682('0x10')]][_0x2682('0x11')])){_0xc33e58=_[_0x2682('0x12')](_0x13fef8[_0x4b484e['IntervalId']][_0x2682('0x11')],_0x2682('0x13'));}else if(!_[_0x2682('0xf')](_0x4b484e[_0x2682('0x13')])){_0xc33e58=[_0x4b484e[_0x2682('0x13')]];}return _0xc33e58;}exports['listen']=function(_0x23785d){_0x23785d[_0x2682('0x14')]={};return new BPromise(function(_0x441af4,_0x2474a5){var _0x2efc76={'Start':function(_0x50c5b5){var _0xd7393c=this;return new Promise(function(_0x5212ed,_0x3723a0){if(_0x50c5b5){try{var _0x4e80db=[];var _0x364935=getId(_0x50c5b5[_0x2682('0x15')],_0x50c5b5[_0x2682('0x16')]?_0x50c5b5['message']['id']:0x0,_0x50c5b5[_0x2682('0x17')]?_0x50c5b5[_0x2682('0x17')]['id']:0x0);var _0x14e590=sUtils[_0x2682('0x18')](_0x23785d,_0x50c5b5);if(_0x50c5b5['transfer']||!_0x14e590&&_0x50c5b5[_0x2682('0x19')]&&_['isArray'](_0x50c5b5[_0x2682('0x19')])&&_0x50c5b5['applications'][_0x2682('0x1a')]){for(var _0x311e8a=0x0;_0x311e8a<_0x50c5b5[_0x2682('0x19')][_0x2682('0x1a')];_0x311e8a+=0x1){var _0x4b0f9f=_0x50c5b5[_0x2682('0x19')][_0x311e8a];if(fs[_0x2682('0x1b')](path[_0x2682('0x1c')](__dirname,_0x2682('0x19'),_0x4b0f9f['app']+'.js'))){var _0x5aa579=[];switch(_0x4b0f9f[_0x2682('0x1d')][_0x2682('0x1e')]()){case _0x2682('0x1f'):var _0x330950=_0x4b0f9f[_0x2682('0x20')][_0x2682('0x21')](',');if(_0x50c5b5[_0x2682('0x15')]===_0x2682('0x22')){_0x5aa579[_0x2682('0x23')](_0x330950[0x0]);_0x5aa579[_0x2682('0x23')](_0x330950[0x1]);_0x5aa579[_0x2682('0x23')](_0x330950[_0x2682('0x24')](0x2,_0x330950['length'])[_0x2682('0x1c')](','));}else{_0x5aa579[_0x2682('0x23')](_0x330950[0x0]);_0x5aa579[_0x2682('0x23')](_0x330950[_0x2682('0x24')](0x1,_0x330950[_0x2682('0x1a')])['join'](','));}break;case'dialogflow':var _0x1730ab=_0x4b0f9f['appdata'][_0x2682('0x21')](',');_0x5aa579['push'](_0x1730ab[0x0]);_0x5aa579['push'](_0x1730ab[0x1]);_0x5aa579[_0x2682('0x23')](_0x1730ab[_0x2682('0x24')](0x2,_0x1730ab[_0x2682('0x1a')])[_0x2682('0x1c')](','));break;case _0x2682('0x25'):var _0x1c2597=_0x4b0f9f['appdata'][_0x2682('0x21')](',');_0x5aa579[_0x2682('0x23')](_0x1c2597[0x0]);_0x5aa579[_0x2682('0x23')](_0x1c2597[0x1]);_0x5aa579[_0x2682('0x23')](_0x1c2597[0x2]);_0x5aa579[_0x2682('0x23')](_0x1c2597[0x3]);_0x5aa579[_0x2682('0x23')](_0x1c2597['slice'](0x4,_0x1c2597[_0x2682('0x1a')])[_0x2682('0x1c')](','));break;case _0x2682('0x26'):var _0x19232b=_0x4b0f9f[_0x2682('0x20')][_0x2682('0x21')](',');_0x5aa579['push'](_0x19232b[0x0]);_0x5aa579['push'](_0x19232b[0x1]);_0x5aa579['push'](_0x19232b[0x2]);_0x5aa579['push'](_0x19232b[0x3]);_0x5aa579[_0x2682('0x23')](_0x19232b[_0x2682('0x24')](0x4,_0x19232b['length'])[_0x2682('0x1c')](','));break;case _0x2682('0x16'):_0x5aa579['push'](_0x4b0f9f[_0x2682('0x20')]);break;case'tag':_0x5aa579[_0x2682('0x23')](_0x4b0f9f[_0x2682('0x27')]);_0x5aa579[_0x2682('0x23')](_0x4b0f9f[_0x2682('0x20')]);break;case _0x2682('0x28'):var _0x5e7871=utils[_0x2682('0x29')](_0x50c5b5[_0x2682('0x2a')][_0x2682('0x2b')],_0x50c5b5);var _0xdd0976=_0x4b0f9f[_0x2682('0x20')][_0x2682('0x21')](',');_0x5aa579['push'](_0xdd0976[0x0]);_0x5aa579[_0x2682('0x23')](_0xdd0976[0x1]);_0x5aa579['push'](_0xdd0976[0x2]);_0x5aa579[_0x2682('0x23')](_0xdd0976[0x3]);_0x5aa579[_0x2682('0x23')](_0xdd0976[0x4]);_0x5aa579[_0x2682('0x23')](_0xdd0976[0x5]);_0x5aa579[_0x2682('0x23')](_0xdd0976[0x6]);_0x5aa579['push'](_0xdd0976[0x7]);_0x5aa579[_0x2682('0x23')](_0xdd0976[0x8]);_0x5aa579[_0x2682('0x23')](_0xdd0976[0x9]);_0x5aa579[_0x2682('0x23')](_0xdd0976[0xa]);_0x5aa579[_0x2682('0x23')](_0x50c5b5['interaction']['id']);_0x5aa579[_0x2682('0x23')](_0x50c5b5[_0x2682('0x16')]['id']);_0x5aa579[_0x2682('0x23')](_0x4b0f9f[_0x2682('0x2c')]);_0x5aa579[_0x2682('0x23')](_0x50c5b5['interaction']['ContactId']);_0x5aa579[_0x2682('0x23')](_0x50c5b5['body']['body']);_0x5aa579[_0x2682('0x23')](_0x5e7871);break;default:_0x5aa579=_[_0x2682('0xf')](_0x4b0f9f[_0x2682('0x20')])?[]:_0x4b0f9f[_0x2682('0x20')][_0x2682('0x21')](',');}var _0x1ef103={'id':util[_0x2682('0xd')]('%s:%s:%s',_0x364935,_0x4b0f9f['id'],_0x4b0f9f[_0x2682('0x1d')]),'condition':require(_0x2682('0x2d'))[_0x2682('0x2e')](_0x364935,getIntervals(_0x23785d[_0x2682('0x2f')],_0x4b0f9f),_0x23785d),'consequence':require('./applications/'+_0x4b0f9f['app'])[_0x2682('0x30')](_0x364935,_0x5aa579,_0x23785d,_0x50c5b5),'p':_0x4b0f9f[_0x2682('0x31')]||0x0};logger[_0x2682('0x32')](_0x2682('0x33'),_0x1ef103['id'],_0x2682('0x34'),getIntervals(_0x23785d[_0x2682('0x2f')],_0x4b0f9f)['join'](_0x2682('0x35')));_0x4e80db[_0x2682('0x23')](_0x1ef103);}else{logger[_0x2682('0x36')](_0x2682('0x37'),path[_0x2682('0x1c')](__dirname,_0x2682('0x19'),_0x4b0f9f['app']+_0x2682('0x38')));}}_0x23785d[_0x2682('0x14')][_0x364935]=new RuleEngine(_0x4e80db);_0x23785d['rules'][_0x364935]['execute'](_0x50c5b5,function(_0x427db6){logger[_0x2682('0x32')]('Applications\x20executed',JSON[_0x2682('0x39')](_0x427db6[_0x2682('0x3a')]));if(_0x23785d[_0x2682('0x14')][_0x364935]){_0x23785d['rules'][_0x364935][_0x2682('0x3b')](_0x2682('0x3c'));}});return _0x5212ed({'code':0xc8,'message':_0x50c5b5});}else{if(_0x14e590){logger['info'](util[_0x2682('0xd')]('Skipped\x20routing\x20for\x20%s',_0x364935));}else{logger[_0x2682('0x32')](_0x2682('0x3d'));}return _0x5212ed({'code':0xc8,'message':_0x50c5b5});}}catch(_0x111150){logger[_0x2682('0x36')](_0x111150[_0x2682('0x3e')]);return _0x3723a0(_0xd7393c[_0x2682('0x36')](0x1f4,_0x111150));}}return _0x3723a0('routing\x20is\x20empty');});},'AcceptMessage':function(_0x208e75){var _0x7c20a6=this;return new Promise(function(_0x197177,_0x4e6ef5){if(_0x208e75[_0x2682('0x3f')]&&_0x208e75[_0x2682('0x3f')]['id']){if(_0x23785d[_0x2682('0x40')][_0x208e75[_0x2682('0x3f')]['id']]){_0x23785d[_0x2682('0x40')][_0x208e75[_0x2682('0x3f')]['id']][_0x2682('0x41')]=![];_0x23785d[_0x2682('0x40')][_0x208e75['agent']['id']]['busyQueue']=undefined;}}if(_0x208e75['message']&&_0x208e75[_0x2682('0x16')]['id']){try{var _0x22bbe7=getId(_0x208e75[_0x2682('0x15')],_0x208e75[_0x2682('0x16')]?_0x208e75['message']['id']:0x0,_0x208e75[_0x2682('0x17')]?_0x208e75[_0x2682('0x17')]['id']:0x0);if(_0x23785d[_0x2682('0x14')][_0x22bbe7]){_0x23785d[_0x2682('0x14')][_0x22bbe7][_0x2682('0x3b')](_0x2682('0x42'));if(rpc[_0x208e75[_0x2682('0x15')]+_0x2682('0x43')]){rpc[_0x208e75[_0x2682('0x15')]+_0x2682('0x43')][_0x2682('0x44')](_0x22bbe7,{'UserId':_0x208e75['message'][_0x2682('0x45')]})['catch'](function(){logger[_0x2682('0x36')](_0x2682('0x46'));});}}return _0x197177({'code':0xc8,'message':_0x208e75});}catch(_0xa5378b){logger[_0x2682('0x36')](_0xa5378b[_0x2682('0x3e')]);return _0x4e6ef5(_0x7c20a6[_0x2682('0x36')](0x1f4,_0xa5378b));}}logger['error'](_0x2682('0x47'));return _0x4e6ef5(_0x7c20a6['error'](0x1f4,_0x2682('0x47')));});},'RejectMessage':function(_0x3dfe98){var _0x223262=this;return new Promise(function(_0x14ed05,_0x2a0af2){if(_0x3dfe98['agent']&&_0x3dfe98[_0x2682('0x3f')]['id']){try{if(_0x23785d['agents'][_0x3dfe98[_0x2682('0x3f')]['id']]){_0x23785d[_0x2682('0x40')][_0x3dfe98[_0x2682('0x3f')]['id']][_0x2682('0x41')]=![];_0x23785d['agents'][_0x3dfe98[_0x2682('0x3f')]['id']][_0x2682('0x48')]=undefined;}return _0x14ed05({'code':0xc8,'message':_0x3dfe98});}catch(_0x5ed673){logger['error'](_0x5ed673['stack']);return _0x2a0af2(_0x223262[_0x2682('0x36')](0x1f4,_0x5ed673));}}logger[_0x2682('0x36')](_0x2682('0x47'));return _0x2a0af2(_0x223262[_0x2682('0x36')](0x1f4,_0x2682('0x47')));});},'AbandonInteraction':function(_0x30d31e){var _0x10582d=this;return new Promise(function(_0xfc33ab,_0x1ca44d){if(_0x30d31e[_0x2682('0x15')]&&_0x30d31e[_0x2682('0x17')]&&_0x30d31e['interaction']['id']){try{var _0x23e382=getId(_0x30d31e[_0x2682('0x15')],_0x30d31e[_0x2682('0x16')]?_0x30d31e[_0x2682('0x16')]['id']:0x0,_0x30d31e[_0x2682('0x17')]?_0x30d31e[_0x2682('0x17')]['id']:0x0);if(_0x23785d[_0x2682('0x14')][_0x23e382]){_0x23785d[_0x2682('0x14')][_0x23e382]['emit'](_0x2682('0x42'));}return _0xfc33ab({'code':0xc8,'message':_0x30d31e});}catch(_0x2ba1da){logger[_0x2682('0x36')](_0x2ba1da['stack']);return _0x1ca44d(_0x10582d[_0x2682('0x36')](0x1f4,_0x2ba1da));}}logger[_0x2682('0x36')](_0x2682('0x47'));return _0x1ca44d(_0x10582d['error'](0x1f4,_0x2682('0x47')));});},'AgentCapacity':function(_0x295fd2){var _0x1b79cd=this;return new Promise(function(_0x582d26,_0x1ce603){if(_0x23785d['agents'][_0x2682('0x49')](_0x295fd2['id'])){for(var _0x19f6c4 in _0x295fd2[_0x2682('0x4a')]){if(_0x295fd2['capacity'][_0x2682('0x49')](_0x19f6c4)){if(_0x23785d['agents'][_0x295fd2['id']]['hasOwnProperty'](_0x19f6c4+_0x2682('0x4b'))){_0x23785d[_0x2682('0x40')][_0x295fd2['id']][_0x19f6c4+_0x2682('0x4b')]=parseInt(_0x295fd2[_0x2682('0x4a')][_0x19f6c4],0xa);}}}_0x23785d[_0x2682('0x40')][_0x295fd2['id']][_0x2682('0x4c')]();return _0x582d26({'code':0xc8,'message':_0x23785d['agents'][_0x295fd2['id']]});}else{return _0x1ce603(_0x1b79cd['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x20ae53){return new Promise(function(_0x4e1b98){var _0x56bf80=_['values'](_0x23785d[_0x2682('0x40')]);if(_0x20ae53&&_0x20ae53['id']){var _0x49516a=_[_0x2682('0x4d')](_0x56bf80,function(_0x55b991){return _0x55b991['id']===_0x20ae53['id'];});_0x4e1b98(_0x49516a);}else{_0x4e1b98({'count':_0x56bf80[_0x2682('0x1a')],'rows':_0x56bf80});}});},'ChatQueues':function(){return new Promise(function(_0x38e91d){var _0x1268e4=[];for(var _0x2335be in _0x23785d[_0x2682('0x4e')]){if(_0x23785d[_0x2682('0x4e')][_0x2682('0x49')](_0x2335be)){var _0x4e6f53=_0x23785d[_0x2682('0x4e')][_0x2335be];var _0x2dfa4c={'id':_0x4e6f53['id'],'available':_0x4e6f53[_0x2682('0x4f')],'loggedIn':_0x4e6f53[_0x2682('0x50')],'name':_0x4e6f53[_0x2682('0x51')],'paused':_0x4e6f53[_0x2682('0x52')],'waiting':_0x4e6f53[_0x2682('0x53')]};_0x1268e4[_0x2682('0x23')](_0x2dfa4c);}}_0x38e91d({'count':_0x1268e4['length'],'rows':_0x1268e4});});},'MailQueues':function(){return new Promise(function(_0x5afe5b){var _0x5b63a5=[];for(var _0x261863 in _0x23785d['mailQueues']){if(_0x23785d[_0x2682('0x54')][_0x2682('0x49')](_0x261863)){var _0x3d5a02=_0x23785d[_0x2682('0x54')][_0x261863];var _0x2f2ecd={'id':_0x3d5a02['id'],'available':_0x3d5a02[_0x2682('0x4f')],'loggedIn':_0x3d5a02[_0x2682('0x50')],'name':_0x3d5a02[_0x2682('0x51')],'paused':_0x3d5a02[_0x2682('0x52')],'waiting':_0x3d5a02[_0x2682('0x53')]};_0x5b63a5[_0x2682('0x23')](_0x2f2ecd);}}_0x5afe5b({'count':_0x5b63a5[_0x2682('0x1a')],'rows':_0x5b63a5});});},'OpenchannelQueues':function(){return new Promise(function(_0x124505){var _0x35bb27=[];for(var _0xcfb1e1 in _0x23785d['openchannelQueues']){if(_0x23785d['openchannelQueues'][_0x2682('0x49')](_0xcfb1e1)){var _0x16da77=_0x23785d['openchannelQueues'][_0xcfb1e1];var _0xd3f382={'id':_0x16da77['id'],'available':_0x16da77[_0x2682('0x4f')],'loggedIn':_0x16da77[_0x2682('0x50')],'name':_0x16da77[_0x2682('0x51')],'paused':_0x16da77['paused'],'waiting':_0x16da77[_0x2682('0x53')]};_0x35bb27[_0x2682('0x23')](_0xd3f382);}}_0x124505({'count':_0x35bb27[_0x2682('0x1a')],'rows':_0x35bb27});});},'SmsQueues':function(){return new Promise(function(_0x43d2d4){var _0x51f4eb=[];for(var _0x174efc in _0x23785d[_0x2682('0x55')]){if(_0x23785d[_0x2682('0x55')]['hasOwnProperty'](_0x174efc)){var _0x457cfb=_0x23785d['smsQueues'][_0x174efc];var _0x1d4481={'id':_0x457cfb['id'],'available':_0x457cfb[_0x2682('0x4f')],'loggedIn':_0x457cfb[_0x2682('0x50')],'name':_0x457cfb[_0x2682('0x51')],'paused':_0x457cfb['paused'],'waiting':_0x457cfb[_0x2682('0x53')]};_0x51f4eb[_0x2682('0x23')](_0x1d4481);}}_0x43d2d4({'count':_0x51f4eb['length'],'rows':_0x51f4eb});});},'FaxQueues':function(){return new Promise(function(_0xc39ebf){var _0x311948=[];for(var _0x53e957 in _0x23785d[_0x2682('0x56')]){if(_0x23785d[_0x2682('0x56')]['hasOwnProperty'](_0x53e957)){var _0x4e3f15=_0x23785d[_0x2682('0x56')][_0x53e957];var _0x54ed5c={'id':_0x4e3f15['id'],'available':_0x4e3f15['available'],'loggedIn':_0x4e3f15[_0x2682('0x50')],'name':_0x4e3f15[_0x2682('0x51')],'paused':_0x4e3f15[_0x2682('0x52')],'waiting':_0x4e3f15['waiting']};_0x311948['push'](_0x54ed5c);}}_0xc39ebf({'count':_0x311948['length'],'rows':_0x311948});});},'WhatsappQueues':function(){return new Promise(function(_0x448628){var _0x3d2052=[];for(var _0x32f667 in _0x23785d['whatsappQueues']){if(_0x23785d[_0x2682('0x57')][_0x2682('0x49')](_0x32f667)){var _0x4637a8=_0x23785d[_0x2682('0x57')][_0x32f667];var _0x13e444={'id':_0x4637a8['id'],'available':_0x4637a8[_0x2682('0x4f')],'loggedIn':_0x4637a8[_0x2682('0x50')],'name':_0x4637a8[_0x2682('0x51')],'paused':_0x4637a8[_0x2682('0x52')],'waiting':_0x4637a8['waiting']};_0x3d2052[_0x2682('0x23')](_0x13e444);}}_0x448628({'count':_0x3d2052[_0x2682('0x1a')],'rows':_0x3d2052});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x23b08e){var _0x4afaf7=_['values'](_0x23785d['chatQueuesWaitingInteractions']);_0x23b08e({'count':_0x4afaf7[_0x2682('0x1a')],'rows':_0x4afaf7});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2a9a01){var _0x1d0fd6=_[_0x2682('0x58')](_0x23785d[_0x2682('0x59')]);_0x2a9a01({'count':_0x1d0fd6['length'],'rows':_0x1d0fd6});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x32b00a){var _0xea8b3c=_[_0x2682('0x58')](_0x23785d[_0x2682('0x5a')]);_0x32b00a({'count':_0xea8b3c[_0x2682('0x1a')],'rows':_0xea8b3c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x58c3d5){var _0x44c18f=_[_0x2682('0x58')](_0x23785d[_0x2682('0x5b')]);_0x58c3d5({'count':_0x44c18f[_0x2682('0x1a')],'rows':_0x44c18f});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4a58ff){var _0x569c73=_[_0x2682('0x58')](_0x23785d[_0x2682('0x5c')]);_0x4a58ff({'count':_0x569c73['length'],'rows':_0x569c73});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xaff6f){var _0x5372c5=_['values'](_0x23785d[_0x2682('0x5d')]);_0xaff6f({'count':_0x5372c5[_0x2682('0x1a')],'rows':_0x5372c5});});}};var _0x101e8f=jayson['server'](_0x2efc76)[_0x2682('0x5e')]();_0x101e8f['on']('error',function(_0x1cced9){logger[_0x2682('0x36')](JSON[_0x2682('0x39')](_0x1cced9));return _0x2474a5(_0x1cced9);});_0x101e8f[_0x2682('0x5f')](0x232c,_0x2682('0x60'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x441af4(_0x2682('0x61')+0x232c);});});}; \ No newline at end of file +var _0x50e5=['autoreply','appdata','split','mail','push','slice','join','dialogflowv2','amazonlex','message','tag','TagId','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','interaction','transfer','applications','isArray','length','existsSync','app','.js','toLowerCase'];(function(_0x2d97b2,_0xa3095){var _0x553cc9=function(_0x44953b){while(--_0x44953b){_0x2d97b2['push'](_0x2d97b2['shift']());}};_0x553cc9(++_0xa3095);}(_0x50e5,0xb7));var _0x550e=function(_0x2dc7e7,_0x578bba){_0x2dc7e7=_0x2dc7e7-0x0;var _0x6d41d5=_0x50e5[_0x2dc7e7];return _0x6d41d5;};'use strict';var _=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x550e('0x2'));var BPromise=require(_0x550e('0x3'));var utils=require(_0x550e('0x4'));var sUtils=require(_0x550e('0x5'));var logger=require(_0x550e('0x6'))(_0x550e('0x7'));var rpc={'openchannelQueueReport':require(_0x550e('0x8')),'mailQueueReport':require(_0x550e('0x9')),'chatQueueReport':require(_0x550e('0xa')),'smsQueueReport':require(_0x550e('0xb')),'faxQueueReport':require(_0x550e('0xc')),'whatsappQueueReport':require(_0x550e('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x27ae27,_0x20707a,_0x51318e){return util[_0x550e('0xe')](_0x550e('0xf'),_0x27ae27,_0x20707a||0x0,_0x51318e||0x0);}function getIntervals(_0x1390a4,_0x4d236d){var _0x1a1e3e=[];if(!_['isNil'](_0x4d236d['IntervalId'])&&!_[_0x550e('0x10')](_0x1390a4[_0x4d236d[_0x550e('0x11')]])&&!_['isNil'](_0x1390a4[_0x4d236d[_0x550e('0x11')]][_0x550e('0x12')])){_0x1a1e3e=_[_0x550e('0x13')](_0x1390a4[_0x4d236d[_0x550e('0x11')]]['Intervals'],_0x550e('0x14'));}else if(!_['isNil'](_0x4d236d[_0x550e('0x14')])){_0x1a1e3e=[_0x4d236d['interval']];}return _0x1a1e3e;}exports[_0x550e('0x15')]=function(_0x4c6070){_0x4c6070[_0x550e('0x16')]={};return new BPromise(function(_0x2d4b79,_0x136e79){var _0x4f79ed={'Start':function(_0x302be0){var _0x49787c=this;return new Promise(function(_0xf28ba7,_0x49474f){if(_0x302be0){try{var _0x4a5f7a=[];var _0x31f4bf=getId(_0x302be0[_0x550e('0x17')],_0x302be0['message']?_0x302be0['message']['id']:0x0,_0x302be0['interaction']?_0x302be0[_0x550e('0x18')]['id']:0x0);var _0x5ed213=sUtils['checkWaitingNotifications'](_0x4c6070,_0x302be0);if(_0x302be0[_0x550e('0x19')]||!_0x5ed213&&_0x302be0[_0x550e('0x1a')]&&_[_0x550e('0x1b')](_0x302be0[_0x550e('0x1a')])&&_0x302be0[_0x550e('0x1a')][_0x550e('0x1c')]){for(var _0x3b4dca=0x0;_0x3b4dca<_0x302be0[_0x550e('0x1a')][_0x550e('0x1c')];_0x3b4dca+=0x1){var _0x47e6e1=_0x302be0[_0x550e('0x1a')][_0x3b4dca];if(fs[_0x550e('0x1d')](path['join'](__dirname,'applications',_0x47e6e1[_0x550e('0x1e')]+_0x550e('0x1f')))){var _0x5769bb=[];switch(_0x47e6e1[_0x550e('0x1e')][_0x550e('0x20')]()){case _0x550e('0x21'):var _0x317249=_0x47e6e1[_0x550e('0x22')][_0x550e('0x23')](',');if(_0x302be0['channel']===_0x550e('0x24')){_0x5769bb[_0x550e('0x25')](_0x317249[0x0]);_0x5769bb[_0x550e('0x25')](_0x317249[0x1]);_0x5769bb[_0x550e('0x25')](_0x317249[_0x550e('0x26')](0x2,_0x317249[_0x550e('0x1c')])[_0x550e('0x27')](','));}else{_0x5769bb[_0x550e('0x25')](_0x317249[0x0]);_0x5769bb[_0x550e('0x25')](_0x317249[_0x550e('0x26')](0x1,_0x317249[_0x550e('0x1c')])[_0x550e('0x27')](','));}break;case'dialogflow':var _0x291976=_0x47e6e1[_0x550e('0x22')]['split'](',');_0x5769bb[_0x550e('0x25')](_0x291976[0x0]);_0x5769bb[_0x550e('0x25')](_0x291976[0x1]);_0x5769bb[_0x550e('0x25')](_0x291976[_0x550e('0x26')](0x2,_0x291976[_0x550e('0x1c')])[_0x550e('0x27')](','));break;case _0x550e('0x28'):var _0x116d18=_0x47e6e1[_0x550e('0x22')][_0x550e('0x23')](',');_0x5769bb[_0x550e('0x25')](_0x116d18[0x0]);_0x5769bb[_0x550e('0x25')](_0x116d18[0x1]);_0x5769bb[_0x550e('0x25')](_0x116d18[0x2]);_0x5769bb[_0x550e('0x25')](_0x116d18[0x3]);_0x5769bb['push'](_0x116d18[_0x550e('0x26')](0x4,_0x116d18[_0x550e('0x1c')])['join'](','));break;case _0x550e('0x29'):var _0x2dea4b=_0x47e6e1['appdata'][_0x550e('0x23')](',');_0x5769bb[_0x550e('0x25')](_0x2dea4b[0x0]);_0x5769bb[_0x550e('0x25')](_0x2dea4b[0x1]);_0x5769bb[_0x550e('0x25')](_0x2dea4b[0x2]);_0x5769bb[_0x550e('0x25')](_0x2dea4b[0x3]);_0x5769bb[_0x550e('0x25')](_0x2dea4b[_0x550e('0x26')](0x4,_0x2dea4b[_0x550e('0x1c')])['join'](','));break;case _0x550e('0x2a'):_0x5769bb['push'](_0x47e6e1[_0x550e('0x22')]);break;case _0x550e('0x2b'):_0x5769bb['push'](_0x47e6e1[_0x550e('0x2c')]);_0x5769bb[_0x550e('0x25')](_0x47e6e1['appdata']);break;case'tvox':var _0x5b2588=utils['getMustacheRender'](_0x302be0[_0x550e('0x2d')][_0x550e('0x2e')],_0x302be0);var _0x6c42c6=_0x47e6e1['appdata']['split'](',');_0x5769bb['push'](_0x6c42c6[0x0]);_0x5769bb[_0x550e('0x25')](_0x6c42c6[0x1]);_0x5769bb[_0x550e('0x25')](_0x6c42c6[0x2]);_0x5769bb['push'](_0x6c42c6[0x3]);_0x5769bb['push'](_0x6c42c6[0x4]);_0x5769bb['push'](_0x6c42c6[0x5]);_0x5769bb[_0x550e('0x25')](_0x6c42c6[0x6]);_0x5769bb[_0x550e('0x25')](_0x6c42c6[0x7]);_0x5769bb[_0x550e('0x25')](_0x6c42c6[0x8]);_0x5769bb['push'](_0x6c42c6[0x9]);_0x5769bb['push'](_0x6c42c6[0xa]);_0x5769bb[_0x550e('0x25')](_0x302be0[_0x550e('0x18')]['id']);_0x5769bb[_0x550e('0x25')](_0x302be0[_0x550e('0x2a')]['id']);_0x5769bb['push'](_0x47e6e1[_0x550e('0x2f')]);_0x5769bb[_0x550e('0x25')](_0x302be0['interaction']['ContactId']);_0x5769bb[_0x550e('0x25')](_0x302be0[_0x550e('0x30')][_0x550e('0x30')]);_0x5769bb[_0x550e('0x25')](_0x5b2588);break;default:_0x5769bb=_['isNil'](_0x47e6e1[_0x550e('0x22')])?[]:_0x47e6e1[_0x550e('0x22')][_0x550e('0x23')](',');}var _0x1fb603={'id':util['format'](_0x550e('0x31'),_0x31f4bf,_0x47e6e1['id'],_0x47e6e1[_0x550e('0x1e')]),'condition':require(_0x550e('0x32'))[_0x550e('0x33')](_0x31f4bf,getIntervals(_0x4c6070[_0x550e('0x34')],_0x47e6e1),_0x4c6070),'consequence':require(_0x550e('0x35')+_0x47e6e1['app'])[_0x550e('0x36')](_0x31f4bf,_0x5769bb,_0x4c6070,_0x302be0),'p':_0x47e6e1[_0x550e('0x37')]||0x0};logger[_0x550e('0x38')](_0x550e('0x39'),_0x1fb603['id'],_0x550e('0x3a'),getIntervals(_0x4c6070['intervals'],_0x47e6e1)[_0x550e('0x27')](_0x550e('0x3b')));_0x4a5f7a['push'](_0x1fb603);}else{logger[_0x550e('0x3c')](_0x550e('0x3d'),path[_0x550e('0x27')](__dirname,'applications',_0x47e6e1['app']+_0x550e('0x1f')));}}_0x4c6070[_0x550e('0x16')][_0x31f4bf]=new RuleEngine(_0x4a5f7a);_0x4c6070['rules'][_0x31f4bf][_0x550e('0x3e')](_0x302be0,function(_0x7dda5e){logger['info'](_0x550e('0x3f'),JSON[_0x550e('0x40')](_0x7dda5e[_0x550e('0x41')]));if(_0x4c6070[_0x550e('0x16')][_0x31f4bf]){_0x4c6070[_0x550e('0x16')][_0x31f4bf][_0x550e('0x42')]('complete');}});return _0xf28ba7({'code':0xc8,'message':_0x302be0});}else{if(_0x5ed213){logger[_0x550e('0x38')](util['format'](_0x550e('0x43'),_0x31f4bf));}else{logger[_0x550e('0x38')]('No\x20applications\x20to\x20execute');}return _0xf28ba7({'code':0xc8,'message':_0x302be0});}}catch(_0x1c9d04){logger[_0x550e('0x3c')](_0x1c9d04[_0x550e('0x44')]);return _0x49474f(_0x49787c[_0x550e('0x3c')](0x1f4,_0x1c9d04));}}return _0x49474f(_0x550e('0x45'));});},'AcceptMessage':function(_0x35881f){var _0x5e4596=this;return new Promise(function(_0x2de31c,_0x30f708){if(_0x35881f[_0x550e('0x46')]&&_0x35881f[_0x550e('0x46')]['id']){if(_0x4c6070[_0x550e('0x47')][_0x35881f[_0x550e('0x46')]['id']]){_0x4c6070[_0x550e('0x47')][_0x35881f[_0x550e('0x46')]['id']][_0x550e('0x48')]=![];_0x4c6070[_0x550e('0x47')][_0x35881f[_0x550e('0x46')]['id']][_0x550e('0x49')]=undefined;}}if(_0x35881f[_0x550e('0x2a')]&&_0x35881f[_0x550e('0x2a')]['id']){try{var _0x2e619d=getId(_0x35881f[_0x550e('0x17')],_0x35881f[_0x550e('0x2a')]?_0x35881f[_0x550e('0x2a')]['id']:0x0,_0x35881f[_0x550e('0x18')]?_0x35881f[_0x550e('0x18')]['id']:0x0);if(_0x4c6070[_0x550e('0x16')][_0x2e619d]){_0x4c6070[_0x550e('0x16')][_0x2e619d]['emit'](_0x550e('0x4a'));if(rpc[_0x35881f[_0x550e('0x17')]+_0x550e('0x4b')]){rpc[_0x35881f[_0x550e('0x17')]+_0x550e('0x4b')][_0x550e('0x4c')](_0x2e619d,{'UserId':_0x35881f[_0x550e('0x2a')]['UserId']})[_0x550e('0x4d')](function(){logger[_0x550e('0x3c')](_0x550e('0x4e'));});}}return _0x2de31c({'code':0xc8,'message':_0x35881f});}catch(_0x4d3d72){logger['error'](_0x4d3d72['stack']);return _0x30f708(_0x5e4596[_0x550e('0x3c')](0x1f4,_0x4d3d72));}}logger[_0x550e('0x3c')](_0x550e('0x4f'));return _0x30f708(_0x5e4596[_0x550e('0x3c')](0x1f4,_0x550e('0x4f')));});},'RejectMessage':function(_0xffba1f){var _0x5586a3=this;return new Promise(function(_0x7203cb,_0x3e9283){if(_0xffba1f[_0x550e('0x46')]&&_0xffba1f['agent']['id']){try{if(_0x4c6070[_0x550e('0x47')][_0xffba1f['agent']['id']]){_0x4c6070[_0x550e('0x47')][_0xffba1f['agent']['id']][_0x550e('0x48')]=![];_0x4c6070[_0x550e('0x47')][_0xffba1f['agent']['id']][_0x550e('0x49')]=undefined;}return _0x7203cb({'code':0xc8,'message':_0xffba1f});}catch(_0x4adc0a){logger[_0x550e('0x3c')](_0x4adc0a['stack']);return _0x3e9283(_0x5586a3[_0x550e('0x3c')](0x1f4,_0x4adc0a));}}logger[_0x550e('0x3c')]('message\x20is\x20empty');return _0x3e9283(_0x5586a3[_0x550e('0x3c')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0xbab6b9){var _0x897986=this;return new Promise(function(_0x2c8734,_0x417fe6){if(_0xbab6b9['channel']&&_0xbab6b9['interaction']&&_0xbab6b9[_0x550e('0x18')]['id']){try{var _0x564b7d=getId(_0xbab6b9['channel'],_0xbab6b9[_0x550e('0x2a')]?_0xbab6b9[_0x550e('0x2a')]['id']:0x0,_0xbab6b9[_0x550e('0x18')]?_0xbab6b9[_0x550e('0x18')]['id']:0x0);if(_0x4c6070[_0x550e('0x16')][_0x564b7d]){_0x4c6070[_0x550e('0x16')][_0x564b7d]['emit'](_0x550e('0x4a'));}return _0x2c8734({'code':0xc8,'message':_0xbab6b9});}catch(_0x28a703){logger[_0x550e('0x3c')](_0x28a703[_0x550e('0x44')]);return _0x417fe6(_0x897986[_0x550e('0x3c')](0x1f4,_0x28a703));}}logger[_0x550e('0x3c')](_0x550e('0x4f'));return _0x417fe6(_0x897986[_0x550e('0x3c')](0x1f4,_0x550e('0x4f')));});},'AgentCapacity':function(_0x527706){var _0x2929c0=this;return new Promise(function(_0x313245,_0x3ef361){if(_0x4c6070[_0x550e('0x47')][_0x550e('0x50')](_0x527706['id'])){for(var _0x3736e5 in _0x527706[_0x550e('0x51')]){if(_0x527706[_0x550e('0x51')][_0x550e('0x50')](_0x3736e5)){if(_0x4c6070[_0x550e('0x47')][_0x527706['id']]['hasOwnProperty'](_0x3736e5+_0x550e('0x52'))){_0x4c6070[_0x550e('0x47')][_0x527706['id']][_0x3736e5+_0x550e('0x52')]=parseInt(_0x527706[_0x550e('0x51')][_0x3736e5],0xa);}}}_0x4c6070[_0x550e('0x47')][_0x527706['id']][_0x550e('0x53')]();return _0x313245({'code':0xc8,'message':_0x4c6070[_0x550e('0x47')][_0x527706['id']]});}else{return _0x3ef361(_0x2929c0[_0x550e('0x3c')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x59f8af){return new Promise(function(_0x2568f3){var _0x80d993=_[_0x550e('0x54')](_0x4c6070[_0x550e('0x47')]);if(_0x59f8af&&_0x59f8af['id']){var _0x3b027f=_[_0x550e('0x55')](_0x80d993,function(_0x4c54b8){return _0x4c54b8['id']===_0x59f8af['id'];});_0x2568f3(_0x3b027f);}else{_0x2568f3({'count':_0x80d993[_0x550e('0x1c')],'rows':_0x80d993});}});},'ChatQueues':function(){return new Promise(function(_0x3a0051){var _0x5995bb=[];for(var _0x5176ca in _0x4c6070[_0x550e('0x56')]){if(_0x4c6070[_0x550e('0x56')][_0x550e('0x50')](_0x5176ca)){var _0x11bec1=_0x4c6070[_0x550e('0x56')][_0x5176ca];var _0x43689e={'id':_0x11bec1['id'],'available':_0x11bec1[_0x550e('0x57')],'loggedIn':_0x11bec1[_0x550e('0x58')],'name':_0x11bec1['name'],'paused':_0x11bec1[_0x550e('0x59')],'waiting':_0x11bec1[_0x550e('0x5a')]};_0x5995bb['push'](_0x43689e);}}_0x3a0051({'count':_0x5995bb[_0x550e('0x1c')],'rows':_0x5995bb});});},'MailQueues':function(){return new Promise(function(_0x117734){var _0xe1a1ad=[];for(var _0x1b8971 in _0x4c6070[_0x550e('0x5b')]){if(_0x4c6070[_0x550e('0x5b')][_0x550e('0x50')](_0x1b8971)){var _0x576476=_0x4c6070[_0x550e('0x5b')][_0x1b8971];var _0x46dcc9={'id':_0x576476['id'],'available':_0x576476[_0x550e('0x57')],'loggedIn':_0x576476[_0x550e('0x58')],'name':_0x576476[_0x550e('0x5c')],'paused':_0x576476['paused'],'waiting':_0x576476[_0x550e('0x5a')]};_0xe1a1ad[_0x550e('0x25')](_0x46dcc9);}}_0x117734({'count':_0xe1a1ad['length'],'rows':_0xe1a1ad});});},'OpenchannelQueues':function(){return new Promise(function(_0x42eaa0){var _0x6f8d6f=[];for(var _0x55fda6 in _0x4c6070[_0x550e('0x5d')]){if(_0x4c6070[_0x550e('0x5d')][_0x550e('0x50')](_0x55fda6)){var _0x749668=_0x4c6070['openchannelQueues'][_0x55fda6];var _0x14a18e={'id':_0x749668['id'],'available':_0x749668['available'],'loggedIn':_0x749668[_0x550e('0x58')],'name':_0x749668[_0x550e('0x5c')],'paused':_0x749668['paused'],'waiting':_0x749668[_0x550e('0x5a')]};_0x6f8d6f['push'](_0x14a18e);}}_0x42eaa0({'count':_0x6f8d6f[_0x550e('0x1c')],'rows':_0x6f8d6f});});},'SmsQueues':function(){return new Promise(function(_0x52a534){var _0x3d5edb=[];for(var _0x293db8 in _0x4c6070[_0x550e('0x5e')]){if(_0x4c6070[_0x550e('0x5e')][_0x550e('0x50')](_0x293db8)){var _0x229832=_0x4c6070[_0x550e('0x5e')][_0x293db8];var _0x107df0={'id':_0x229832['id'],'available':_0x229832[_0x550e('0x57')],'loggedIn':_0x229832[_0x550e('0x58')],'name':_0x229832[_0x550e('0x5c')],'paused':_0x229832[_0x550e('0x59')],'waiting':_0x229832[_0x550e('0x5a')]};_0x3d5edb[_0x550e('0x25')](_0x107df0);}}_0x52a534({'count':_0x3d5edb[_0x550e('0x1c')],'rows':_0x3d5edb});});},'FaxQueues':function(){return new Promise(function(_0x169391){var _0x56493d=[];for(var _0xa17320 in _0x4c6070[_0x550e('0x5f')]){if(_0x4c6070['faxQueues'][_0x550e('0x50')](_0xa17320)){var _0x52ec61=_0x4c6070[_0x550e('0x5f')][_0xa17320];var _0x1f472f={'id':_0x52ec61['id'],'available':_0x52ec61[_0x550e('0x57')],'loggedIn':_0x52ec61[_0x550e('0x58')],'name':_0x52ec61[_0x550e('0x5c')],'paused':_0x52ec61[_0x550e('0x59')],'waiting':_0x52ec61['waiting']};_0x56493d[_0x550e('0x25')](_0x1f472f);}}_0x169391({'count':_0x56493d['length'],'rows':_0x56493d});});},'WhatsappQueues':function(){return new Promise(function(_0x5e6aa2){var _0x2a6770=[];for(var _0x4ec69a in _0x4c6070[_0x550e('0x60')]){if(_0x4c6070[_0x550e('0x60')]['hasOwnProperty'](_0x4ec69a)){var _0x48efdb=_0x4c6070[_0x550e('0x60')][_0x4ec69a];var _0x2aa9e0={'id':_0x48efdb['id'],'available':_0x48efdb['available'],'loggedIn':_0x48efdb['loggedIn'],'name':_0x48efdb['name'],'paused':_0x48efdb[_0x550e('0x59')],'waiting':_0x48efdb[_0x550e('0x5a')]};_0x2a6770['push'](_0x2aa9e0);}}_0x5e6aa2({'count':_0x2a6770[_0x550e('0x1c')],'rows':_0x2a6770});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3100ca){var _0x2e3e26=_['values'](_0x4c6070[_0x550e('0x61')]);_0x3100ca({'count':_0x2e3e26['length'],'rows':_0x2e3e26});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x57af5c){var _0x2ee058=_['values'](_0x4c6070[_0x550e('0x62')]);_0x57af5c({'count':_0x2ee058[_0x550e('0x1c')],'rows':_0x2ee058});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x49ae13){var _0x2ac505=_[_0x550e('0x54')](_0x4c6070[_0x550e('0x63')]);_0x49ae13({'count':_0x2ac505[_0x550e('0x1c')],'rows':_0x2ac505});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2784bb){var _0x5c7385=_['values'](_0x4c6070[_0x550e('0x64')]);_0x2784bb({'count':_0x5c7385[_0x550e('0x1c')],'rows':_0x5c7385});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x347e24){var _0x38591a=_['values'](_0x4c6070['faxQueuesWaitingInteractions']);_0x347e24({'count':_0x38591a[_0x550e('0x1c')],'rows':_0x38591a});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x437331){var _0x4355b4=_[_0x550e('0x54')](_0x4c6070[_0x550e('0x65')]);_0x437331({'count':_0x4355b4[_0x550e('0x1c')],'rows':_0x4355b4});});}};var _0x3070d3=jayson[_0x550e('0x66')](_0x4f79ed)[_0x550e('0x67')]();_0x3070d3['on'](_0x550e('0x3c'),function(_0x4f61b0){logger[_0x550e('0x3c')](JSON[_0x550e('0x40')](_0x4f61b0));return _0x136e79(_0x4f61b0);});_0x3070d3['listen'](0x232c,_0x550e('0x68'),function(){console[_0x550e('0x69')](_0x550e('0x6a'),0x232c);return _0x2d4b79(_0x550e('0x6b')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 60ac2ba..4976555 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 _0xbf12=['iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','bluebird','routing','client','then','error','message','result','catch','condition','rules','stop','length','push','format'];(function(_0x1f4a62,_0x24192a){var _0x2a9fe7=function(_0x2c8e09){while(--_0x2c8e09){_0x1f4a62['push'](_0x1f4a62['shift']());}};_0x2a9fe7(++_0x24192a);}(_0xbf12,0x177));var _0x2bf1=function(_0xfe693f,_0x22a16a){_0xfe693f=_0xfe693f-0x0;var _0x32f413=_0xbf12[_0xfe693f];return _0x32f413;};'use strict';var util=require(_0x2bf1('0x0'));var BPromise=require(_0x2bf1('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')(_0x2bf1('0x2'));var client=jayson[_0x2bf1('0x3')]['http']({'port':0x232a});function request(_0x30d256,_0x221e74){return new BPromise(function(_0x385200,_0x2d7bf2){return client['request'](_0x30d256,_0x221e74)[_0x2bf1('0x4')](function(_0x3f2838){if(_0x3f2838['error']){return _0x2d7bf2(_0x3f2838[_0x2bf1('0x5')][_0x2bf1('0x6')]);}else{return _0x385200(_0x3f2838[_0x2bf1('0x7')]);}})[_0x2bf1('0x8')](function(_0x4a55d5){return _0x2d7bf2(_0x4a55d5);});});}exports[_0x2bf1('0x9')]=function(_0x332968,_0x487ae3,_0x18c117){return function(_0x5908f2){if(_0x18c117[_0x2bf1('0xa')]&&!_0x18c117[_0x2bf1('0xa')][_0x332968]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x332968);return _0x5908f2[_0x2bf1('0xb')]();}var _0x512484=[];for(var _0x49bf59=0x0;_0x49bf59<_0x487ae3[_0x2bf1('0xc')];_0x49bf59+=0x1){_0x512484[_0x2bf1('0xd')](request('Command',{'command':util[_0x2bf1('0xe')](_0x2bf1('0xf'),_0x487ae3[_0x49bf59])})['then'](function(_0x1a6d0b){return _0x1a6d0b&&_0x1a6d0b[_0x2bf1('0x6')]&&_0x1a6d0b[_0x2bf1('0x6')][_0x2bf1('0x10')](_0x2bf1('0x11'))>=0x0?!![]:![];})[_0x2bf1('0x8')](function(){logger[_0x2bf1('0x5')](_0x2bf1('0x12'),_0x332968,_0x487ae3[_0x49bf59]);}));}BPromise[_0x2bf1('0x13')](_0x512484)[_0x2bf1('0x4')](function(_0x2ec03e){var _0x1a825d=_[_0x2bf1('0x14')](_0x2ec03e);logger[_0x2bf1('0x15')](_0x2bf1('0x16'),_0x332968,_0x487ae3[_0x2bf1('0x17')](_0x2bf1('0x18')),_0x1a825d);_0x5908f2['when'](_0x1a825d);})[_0x2bf1('0x8')](function(_0x5867a1){logger[_0x2bf1('0x5')](_0x2bf1('0x16'),_0x332968,_0x487ae3[_0x2bf1('0x17')](_0x2bf1('0x18')),_0x5867a1[_0x2bf1('0x19')]);_0x5908f2['stop']();});};}; \ No newline at end of file +var _0xf5e5=['true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','bluebird','jayson/promise','../../../config/logger','routing','http','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xf5e5,0x1ac));var _0x5f5e=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0xf5e5[_0x4cd21c];return _0x5d8e5e;};'use strict';var util=require(_0x5f5e('0x0'));var BPromise=require(_0x5f5e('0x1'));var jayson=require(_0x5f5e('0x2'));var _=require('lodash');var logger=require(_0x5f5e('0x3'))(_0x5f5e('0x4'));var client=jayson['client'][_0x5f5e('0x5')]({'port':0x232a});function request(_0x5b6d03,_0x3494f1){return new BPromise(function(_0x3e9f3c,_0x49a7f0){return client['request'](_0x5b6d03,_0x3494f1)[_0x5f5e('0x6')](function(_0x4626b5){if(_0x4626b5[_0x5f5e('0x7')]){return _0x49a7f0(_0x4626b5['error'][_0x5f5e('0x8')]);}else{return _0x3e9f3c(_0x4626b5[_0x5f5e('0x9')]);}})[_0x5f5e('0xa')](function(_0x218203){return _0x49a7f0(_0x218203);});});}exports[_0x5f5e('0xb')]=function(_0x204c99,_0x416bfa,_0x28e958){return function(_0x14b91b){if(_0x28e958['rules']&&!_0x28e958[_0x5f5e('0xc')][_0x204c99]){logger[_0x5f5e('0xd')](_0x5f5e('0xe'),_0x204c99);return _0x14b91b[_0x5f5e('0xf')]();}var _0x541a03=[];for(var _0x41a499=0x0;_0x41a499<_0x416bfa[_0x5f5e('0x10')];_0x41a499+=0x1){_0x541a03[_0x5f5e('0x11')](request(_0x5f5e('0x12'),{'command':util[_0x5f5e('0x13')]('iftime\x20%s',_0x416bfa[_0x41a499])})[_0x5f5e('0x6')](function(_0x37a114){return _0x37a114&&_0x37a114[_0x5f5e('0x8')]&&_0x37a114[_0x5f5e('0x8')]['indexOf'](_0x5f5e('0x14'))>=0x0?!![]:![];})[_0x5f5e('0xa')](function(){logger[_0x5f5e('0x7')](_0x5f5e('0x15'),_0x204c99,_0x416bfa[_0x41a499]);}));}BPromise[_0x5f5e('0x16')](_0x541a03)['then'](function(_0x2b4c9b){var _0x2a3a96=_[_0x5f5e('0x17')](_0x2b4c9b);logger[_0x5f5e('0xd')](_0x5f5e('0x18'),_0x204c99,_0x416bfa[_0x5f5e('0x19')](_0x5f5e('0x1a')),_0x2a3a96);_0x14b91b['when'](_0x2a3a96);})['catch'](function(_0x42ee9a){logger[_0x5f5e('0x7')](_0x5f5e('0x18'),_0x204c99,_0x416bfa[_0x5f5e('0x19')](_0x5f5e('0x1a')),_0x42ee9a[_0x5f5e('0x1b')]);_0x14b91b[_0x5f5e('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 52ad6d5..bbd24da 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 _0xd3d1=['transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswer','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension'];(function(_0x4da03a,_0x2ba350){var _0x3eddc2=function(_0xbfe4df){while(--_0xbfe4df){_0x4da03a['push'](_0x4da03a['shift']());}};_0x3eddc2(++_0x2ba350);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd3d1[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x56f01c,_0x2d0605){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x4'),_0x56f01c[_0x1d3d('0x5')],_0x56f01c[_0x1d3d('0x6')],_0x56f01c[_0x1d3d('0x7')],_0x56f01c[_0x1d3d('0x8')],_0x56f01c[_0x1d3d('0x9')],_0x56f01c[_0x1d3d('0xa')],_0x56f01c[_0x1d3d('0xb')],_0x56f01c[_0x1d3d('0xc')]));if(_0x56f01c[_0x1d3d('0x7')]){utils[_0x1d3d('0xd')](_0x56f01c[_0x1d3d('0x7')])[_0x1d3d('0xe')](function(_0x3683c9){if(_0x3683c9){_0x56f01c['type']=_0x3683c9[_0x1d3d('0xf')];_0x56f01c[_0x1d3d('0x10')]=_0x56f01c[_0x1d3d('0x11')]?_0x3683c9[_0x1d3d('0x12')]:![];_0x56f01c[_0x1d3d('0x13')]=_0x56f01c[_0x1d3d('0x10')]?_0x3683c9[_0x1d3d('0x14')]:0x0;}utils[_0x1d3d('0x15')](_0x1d3d('0x16'),_0x56f01c);});}else{utils[_0x1d3d('0x15')](_0x1d3d('0x16'),_0x56f01c);}if(_0x2d0605){delete transfers[_0x56f01c['uniqueid']];}else{delete agents[_0x56f01c[_0x1d3d('0x17')]];}}exports[_0x1d3d('0x18')]=function(_0x494b82){try{utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x19'),_0x494b82[_0x1d3d('0x5')]),_0x494b82);agents[_0x494b82['destuniqueid']]=_0x494b82;agents[_0x494b82[_0x1d3d('0x17')]]['agentcalledAt']=utils[_0x1d3d('0x1a')]();agents[_0x494b82[_0x1d3d('0x17')]][_0x1d3d('0xc')]=_0x1d3d('0x1b');agents[_0x494b82[_0x1d3d('0x17')]][_0x1d3d('0xb')]=null;agents[_0x494b82[_0x1d3d('0x17')]]['connectedlinename']=null;utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x1c'),_0x494b82['uniqueid'],agents[_0x494b82[_0x1d3d('0x17')]]['membername'],_0x494b82[_0x1d3d('0x17')]));}catch(_0x392e92){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')]('[%s][agents][agentcalled]',_0x494b82[_0x1d3d('0x5')]),_0x392e92);}};exports['agentringnoanswer']=function(_0x56c424){try{if(!_[_0x1d3d('0x1e')](agents[_0x56c424[_0x1d3d('0x17')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x20'),_0x56c424[_0x1d3d('0x5')]),_0x56c424);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x21'),_0x56c424[_0x1d3d('0x5')],agents[_0x56c424[_0x1d3d('0x17')]]['membername'],_0x56c424[_0x1d3d('0x17')]));agents[_0x56c424[_0x1d3d('0x17')]]['agentringnoanswer']=!![];agents[_0x56c424[_0x1d3d('0x17')]]['agentringnoanswerAt']=utils[_0x1d3d('0x1a')]();agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0xc')]=_0x1d3d('0x22');agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0x23')]=_0x1d3d('0x22');agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0x24')]=_0x56c424[_0x1d3d('0x25')]?parseInt(_0x56c424[_0x1d3d('0x25')])/0x3e8:0x0;agents[_0x56c424['destuniqueid']][_0x1d3d('0x26')]=0x0;unanswered['push'](_0x56c424[_0x1d3d('0x17')]);}}catch(_0x2bcc2){utils['error'](util[_0x1d3d('0x3')](_0x1d3d('0x20'),_0x56c424[_0x1d3d('0x5')]),_0x2bcc2);}};exports[_0x1d3d('0x27')]=function(_0x4abbfc){try{_[_0x1d3d('0x28')](agents,function(_0x235ef3,_0x5d1b6c){if(_0x235ef3[_0x1d3d('0x5')]==_0x4abbfc['uniqueid']&&!_[_0x1d3d('0x29')](unanswered,_0x235ef3[_0x1d3d('0x17')])){utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x2a'),_0x4abbfc[_0x1d3d('0x5')]),_0x4abbfc);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x2b'),_0x4abbfc[_0x1d3d('0x5')],_0x235ef3[_0x1d3d('0x8')],_0x235ef3[_0x1d3d('0x17')]));_0x235ef3['agentringnoanswer']=!![];_0x235ef3[_0x1d3d('0x2c')]=utils[_0x1d3d('0x1a')]();_0x235ef3[_0x1d3d('0xc')]=_0x1d3d('0x2d');_0x235ef3['reason']='abandoned';_0x235ef3[_0x1d3d('0x24')]=_0x4abbfc[_0x1d3d('0x24')];_0x235ef3['talktime']=0x0;writeDB(_0x235ef3);}});}catch(_0x43ef5d){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x2a'),_0x4abbfc['uniqueid']),_0x43ef5d);}};exports['agentconnect']=function(_0x29fa6c){try{if(agents[_0x29fa6c['destuniqueid']]){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x2e'),_0x29fa6c[_0x1d3d('0x5')]),_0x29fa6c);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x2f'),_0x29fa6c[_0x1d3d('0x5')],agents[_0x29fa6c['destuniqueid']][_0x1d3d('0x8')],_0x29fa6c['destuniqueid']));agents[_0x29fa6c[_0x1d3d('0x17')]][_0x1d3d('0x30')]=utils['now']();agents[_0x29fa6c[_0x1d3d('0x17')]][_0x1d3d('0xb')]=_0x29fa6c[_0x1d3d('0xb')];agents[_0x29fa6c[_0x1d3d('0x17')]]['connectedlinename']=_0x29fa6c['connectedlinename'];agents[_0x29fa6c[_0x1d3d('0x17')]]['holdtime']=_0x29fa6c[_0x1d3d('0x25')];agents[_0x29fa6c[_0x1d3d('0x17')]]['lastevent']=_0x1d3d('0x31');_[_0x1d3d('0x28')](agents,function(_0x51be79,_0x2d5015){if(_0x51be79[_0x1d3d('0x17')]!=_0x29fa6c[_0x1d3d('0x17')]&&_0x51be79[_0x1d3d('0x5')]==_0x29fa6c[_0x1d3d('0x5')]){_0x51be79[_0x1d3d('0x26')]=0x0;_0x51be79['holdtime']=_0x29fa6c[_0x1d3d('0x25')];_0x51be79[_0x1d3d('0x32')]=!![];_0x51be79[_0x1d3d('0x2c')]=utils[_0x1d3d('0x1a')]();_0x51be79[_0x1d3d('0xc')]='answered_elsewhere';_0x51be79[_0x1d3d('0x23')]=_0x1d3d('0x33');_0x51be79[_0x1d3d('0x34')]=_0x29fa6c[_0x1d3d('0x17')];_0x51be79['answeredelsewheremembername']=_0x29fa6c[_0x1d3d('0x8')];writeDB(_0x51be79);}});}}catch(_0x977ea8){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x2e'),_0x29fa6c['uniqueid']),_0x977ea8);}};exports['agentcomplete']=function(_0x229f48){try{if(!_[_0x1d3d('0x1e')](agents[_0x229f48[_0x1d3d('0x17')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')]('[%s][agents][agentcomplete]',_0x229f48[_0x1d3d('0x5')]),_0x229f48);utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x35'),_0x229f48[_0x1d3d('0x5')],agents[_0x229f48[_0x1d3d('0x17')]]['membername'],_0x229f48[_0x1d3d('0x17')]));agents[_0x229f48[_0x1d3d('0x17')]][_0x1d3d('0x11')]=!![];agents[_0x229f48[_0x1d3d('0x17')]][_0x1d3d('0x36')]=utils[_0x1d3d('0x1a')]();agents[_0x229f48[_0x1d3d('0x17')]]['talktime']=utils[_0x1d3d('0x37')](agents[_0x229f48['destuniqueid']][_0x1d3d('0x36')],agents[_0x229f48[_0x1d3d('0x17')]]['agentconnectAt']);agents[_0x229f48[_0x1d3d('0x17')]]['reason']=_0x229f48[_0x1d3d('0x23')];agents[_0x229f48['destuniqueid']][_0x1d3d('0xc')]=_0x1d3d('0x38');writeDB(agents[_0x229f48[_0x1d3d('0x17')]]);}}catch(_0x25b547){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x39'),_0x229f48[_0x1d3d('0x5')]),_0x25b547);}};exports['blindtransfer']=function(_0x5899cc){try{if(!_['isNil'](agents[_0x5899cc[_0x1d3d('0x3a')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x3b'),_0x5899cc[_0x1d3d('0x5')]),_0x5899cc);utils[_0x1d3d('0x2')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5899cc['uniqueid'],agents[_0x5899cc['transfereruniqueid']][_0x1d3d('0x8')],agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x5')]));agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3c')]=!![];agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3d')]=_0x1d3d('0x3e');agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3f')]=_0x5899cc[_0x1d3d('0x40')];agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x41')]=agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x5')];}}catch(_0x5ce0d3){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x3b'),_0x5899cc[_0x1d3d('0x5')]),_0x5ce0d3);}};exports['attendedtransfer']=function(_0x41930f){try{utils['debug'](util['format'](_0x1d3d('0x42'),_0x41930f[_0x1d3d('0x43')]),_0x41930f);if(_0x41930f['origtransfereruniqueid']==_0x41930f[_0x1d3d('0x44')]){if(!_[_0x1d3d('0x1e')](agents[_0x41930f['secondtransfereruniqueid']])){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x45'),_0x41930f[_0x1d3d('0x43')],agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x8')]));agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x3c')]=!![];agents[_0x41930f[_0x1d3d('0x46')]]['transfertype']=_0x1d3d('0x47');agents[_0x41930f['secondtransfereruniqueid']]['transferexten']=_0x41930f['origtransfererexten'];agents[_0x41930f['secondtransfereruniqueid']][_0x1d3d('0x41')]=_0x41930f[_0x1d3d('0x43')];}if(_0x41930f[_0x1d3d('0x48')]&&agents[_0x41930f[_0x1d3d('0x48')]]){agents[_0x41930f['transfereeuniqueid']][_0x1d3d('0x49')]=0x1;transfers[_0x41930f['transfereeuniqueid']]=_[_0x1d3d('0x4a')](agents[_0x41930f[_0x1d3d('0x48')]]);transfers[_0x41930f['transfereeuniqueid']][_0x1d3d('0xa')]=agents[_0x41930f[_0x1d3d('0x46')]]['calleridnum'];transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x4b')]=agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x4b')];transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x4c')]=utils['now']();transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x30')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x24')]=0x0;transfers[_0x41930f['transfereeuniqueid']][_0x1d3d('0x49')]=0x2;}}else if(_0x41930f['secondtransfereruniqueid']==_0x41930f[_0x1d3d('0x4d')]){if(!_['isNil'](agents[_0x41930f[_0x1d3d('0x43')]])){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x45'),_0x41930f[_0x1d3d('0x43')],agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x8')]));agents[_0x41930f['origtransfereruniqueid']][_0x1d3d('0x3c')]=!![];agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x3d')]=_0x1d3d('0x47');agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x3f')]=_0x41930f['secondtransfererexten'];agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x41')]=_0x41930f[_0x1d3d('0x46')];}if(_0x41930f[_0x1d3d('0x4e')]&&agents[_0x41930f[_0x1d3d('0x4e')]]){agents[_0x41930f['transfertargetuniqueid']][_0x1d3d('0x49')]=0x1;transfers[_0x41930f[_0x1d3d('0x4e')]]=_[_0x1d3d('0x4a')](agents[_0x41930f['transfertargetuniqueid']]);transfers[_0x41930f[_0x1d3d('0x4e')]]['calleridnum']=agents[_0x41930f[_0x1d3d('0x43')]]['calleridnum'];transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x4b')]=agents[_0x41930f[_0x1d3d('0x43')]]['calleridname'];transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x4c')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f['transfertargetuniqueid']][_0x1d3d('0x30')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f[_0x1d3d('0x4e')]]['holdtime']=0x0;transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x49')]=0x2;}}}catch(_0x37667d){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')]('[%s][agents][attendedtransfer]',_0x41930f[_0x1d3d('0x43')]),_0x37667d);}};exports[_0x1d3d('0x4f')]=function(_0x25f4e0){try{utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x50'),_0x25f4e0[_0x1d3d('0x5')]),_0x25f4e0);if(agents[_0x25f4e0[_0x1d3d('0x5')]]&&agents[_0x25f4e0[_0x1d3d('0x5')]]['reason']===_0x1d3d('0x22')){if(_0x25f4e0[_0x1d3d('0x51')]==='21'){agents[_0x25f4e0['uniqueid']][_0x1d3d('0x23')]=_0x1d3d('0x52');agents[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]=_0x1d3d('0x52');}utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x25f4e0[_0x1d3d('0x5')],agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],agents[_0x25f4e0[_0x1d3d('0x5')]]['reason'],agents[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]));writeDB(agents[_0x25f4e0[_0x1d3d('0x5')]]);var _0x4604cc=unanswered[_0x1d3d('0x53')](_0x25f4e0[_0x1d3d('0x5')]);if(_0x4604cc>-0x1){unanswered[_0x1d3d('0x54')](_0x4604cc,0x1);}}if(transfers[_0x25f4e0[_0x1d3d('0x5')]]){transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x11')]=!![];transfers[_0x25f4e0[_0x1d3d('0x5')]]['agentcompleteAt']=utils[_0x1d3d('0x1a')]();transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x26')]=utils['diffTime'](transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')],transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x30')]);transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x23')]=_0x1d3d('0x55');transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0xc')]='complete';utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x56'),_0x25f4e0['uniqueid'],transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x23')],transfers[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]));writeDB(transfers[_0x25f4e0[_0x1d3d('0x5')]],!![]);}if(agents[_0x25f4e0['uniqueid']]&&agents[_0x25f4e0['uniqueid']][_0x1d3d('0x30')]){agents[_0x25f4e0[_0x1d3d('0x5')]]['agentcomplete']=!![];agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')]=utils[_0x1d3d('0x1a')]();agents[_0x25f4e0[_0x1d3d('0x5')]]['talktime']=utils[_0x1d3d('0x37')](agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')],agents[_0x25f4e0['uniqueid']][_0x1d3d('0x30')]);agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x23')]=agents[_0x25f4e0['uniqueid']][_0x1d3d('0x3c')]?_0x1d3d('0x3c'):_0x1d3d('0x55');agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0xc')]=_0x1d3d('0x38');utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x56'),_0x25f4e0['uniqueid'],agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],agents[_0x25f4e0[_0x1d3d('0x5')]]['reason'],agents[_0x25f4e0[_0x1d3d('0x5')]]['lastevent']));writeDB(agents[_0x25f4e0['uniqueid']]);}}catch(_0x49d1e7){utils[_0x1d3d('0x1d')](util['format'](_0x1d3d('0x50'),_0x25f4e0[_0x1d3d('0x5')]),_0x49d1e7);}}; \ No newline at end of file +var _0x4024=['push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','format','uniqueid','channel','interface','calleridnum','connectedlinenum','queue','then','type','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','timeout','reason','ringtime','talktime'];(function(_0x4f219b,_0x841f7e){var _0x8a7718=function(_0x3e8f25){while(--_0x3e8f25){_0x4f219b['push'](_0x4f219b['shift']());}};_0x8a7718(++_0x841f7e);}(_0x4024,0x89));var _0x4402=function(_0x4bde04,_0x4aac94){_0x4bde04=_0x4bde04-0x0;var _0x371ee4=_0x4024[_0x4bde04];return _0x371ee4;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x3074ac,_0x2b36c7){utils['info'](util[_0x4402('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3074ac[_0x4402('0x3')],_0x3074ac[_0x4402('0x4')],_0x3074ac['queue'],_0x3074ac['membername'],_0x3074ac[_0x4402('0x5')],_0x3074ac[_0x4402('0x6')],_0x3074ac[_0x4402('0x7')],_0x3074ac['lastevent']));if(_0x3074ac[_0x4402('0x8')]){utils['getVoiceQueueByName'](_0x3074ac['queue'])[_0x4402('0x9')](function(_0x4c6ca4){if(_0x4c6ca4){_0x3074ac['type']=_0x4c6ca4[_0x4402('0xa')];_0x3074ac['agentacw']=_0x3074ac[_0x4402('0xb')]?_0x4c6ca4['acw']:![];_0x3074ac[_0x4402('0xc')]=_0x3074ac['agentacw']?_0x4c6ca4[_0x4402('0xd')]:0x0;}utils[_0x4402('0xe')]('CreateVoiceAgentReport',_0x3074ac);});}else{utils[_0x4402('0xe')](_0x4402('0xf'),_0x3074ac);}if(_0x2b36c7){delete transfers[_0x3074ac[_0x4402('0x3')]];}else{delete agents[_0x3074ac['destuniqueid']];}}exports[_0x4402('0x10')]=function(_0x34d952){try{utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x12'),_0x34d952[_0x4402('0x3')]),_0x34d952);agents[_0x34d952[_0x4402('0x13')]]=_0x34d952;agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x14')]=utils[_0x4402('0x15')]();agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x16')]=_0x4402('0x17');agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x7')]=null;agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x18')]=null;utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x1a'),_0x34d952['uniqueid'],agents[_0x34d952['destuniqueid']][_0x4402('0x1b')],_0x34d952[_0x4402('0x13')]));}catch(_0x5681c5){utils[_0x4402('0x1c')](util[_0x4402('0x2')]('[%s][agents][agentcalled]',_0x34d952[_0x4402('0x3')]),_0x5681c5);}};exports['agentringnoanswer']=function(_0x55cc8c){try{if(!_[_0x4402('0x1d')](agents[_0x55cc8c[_0x4402('0x13')]])){utils[_0x4402('0x11')](util['format'](_0x4402('0x1e'),_0x55cc8c['uniqueid']),_0x55cc8c);utils['info'](util[_0x4402('0x2')](_0x4402('0x1f'),_0x55cc8c[_0x4402('0x3')],agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x1b')],_0x55cc8c[_0x4402('0x13')]));agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x20')]=!![];agents[_0x55cc8c[_0x4402('0x13')]]['agentringnoanswerAt']=utils[_0x4402('0x15')]();agents[_0x55cc8c['destuniqueid']][_0x4402('0x16')]=_0x4402('0x21');agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x22')]='timeout';agents[_0x55cc8c[_0x4402('0x13')]]['holdtime']=_0x55cc8c['ringtime']?parseInt(_0x55cc8c[_0x4402('0x23')])/0x3e8:0x0;agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x24')]=0x0;unanswered[_0x4402('0x25')](_0x55cc8c[_0x4402('0x13')]);}}catch(_0x514e41){utils[_0x4402('0x1c')](util['format'](_0x4402('0x1e'),_0x55cc8c[_0x4402('0x3')]),_0x514e41);}};exports[_0x4402('0x26')]=function(_0x48d20d){try{_[_0x4402('0x27')](agents,function(_0x6c87f6,_0x316239){if(_0x6c87f6[_0x4402('0x3')]==_0x48d20d[_0x4402('0x3')]&&!_[_0x4402('0x28')](unanswered,_0x6c87f6[_0x4402('0x13')])){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x29'),_0x48d20d[_0x4402('0x3')]),_0x48d20d);utils['info'](util[_0x4402('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x48d20d[_0x4402('0x3')],_0x6c87f6['membername'],_0x6c87f6[_0x4402('0x13')]));_0x6c87f6[_0x4402('0x20')]=!![];_0x6c87f6[_0x4402('0x2a')]=utils[_0x4402('0x15')]();_0x6c87f6[_0x4402('0x16')]='abandoned';_0x6c87f6[_0x4402('0x22')]=_0x4402('0x2b');_0x6c87f6[_0x4402('0x2c')]=_0x48d20d['holdtime'];_0x6c87f6[_0x4402('0x24')]=0x0;writeDB(_0x6c87f6);}});}catch(_0x3383e3){utils['error'](util[_0x4402('0x2')](_0x4402('0x29'),_0x48d20d[_0x4402('0x3')]),_0x3383e3);}};exports[_0x4402('0x2d')]=function(_0x170058){try{if(agents[_0x170058[_0x4402('0x13')]]){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x2e'),_0x170058['uniqueid']),_0x170058);utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x2f'),_0x170058['uniqueid'],agents[_0x170058[_0x4402('0x13')]][_0x4402('0x1b')],_0x170058['destuniqueid']));agents[_0x170058['destuniqueid']][_0x4402('0x30')]=utils[_0x4402('0x15')]();agents[_0x170058[_0x4402('0x13')]][_0x4402('0x7')]=_0x170058['connectedlinenum'];agents[_0x170058['destuniqueid']]['connectedlinename']=_0x170058[_0x4402('0x18')];agents[_0x170058[_0x4402('0x13')]][_0x4402('0x2c')]=_0x170058[_0x4402('0x23')];agents[_0x170058['destuniqueid']][_0x4402('0x16')]=_0x4402('0x31');_[_0x4402('0x27')](agents,function(_0x57843d,_0x2b92b7){if(_0x57843d['destuniqueid']!=_0x170058[_0x4402('0x13')]&&_0x57843d[_0x4402('0x3')]==_0x170058['uniqueid']){_0x57843d[_0x4402('0x24')]=0x0;_0x57843d['holdtime']=_0x170058[_0x4402('0x23')];_0x57843d[_0x4402('0x20')]=!![];_0x57843d['agentringnoanswerAt']=utils[_0x4402('0x15')]();_0x57843d[_0x4402('0x16')]=_0x4402('0x32');_0x57843d[_0x4402('0x22')]='answered_elsewhere';_0x57843d['answeredelsewheredestinationuniqueid']=_0x170058[_0x4402('0x13')];_0x57843d['answeredelsewheremembername']=_0x170058[_0x4402('0x1b')];writeDB(_0x57843d);}});}}catch(_0x2a6d78){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x2e'),_0x170058[_0x4402('0x3')]),_0x2a6d78);}};exports[_0x4402('0xb')]=function(_0x390169){try{if(!_[_0x4402('0x1d')](agents[_0x390169[_0x4402('0x13')]])){utils['debug'](util[_0x4402('0x2')](_0x4402('0x33'),_0x390169['uniqueid']),_0x390169);utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x390169[_0x4402('0x3')],agents[_0x390169[_0x4402('0x13')]][_0x4402('0x1b')],_0x390169[_0x4402('0x13')]));agents[_0x390169[_0x4402('0x13')]]['agentcomplete']=!![];agents[_0x390169[_0x4402('0x13')]][_0x4402('0x34')]=utils[_0x4402('0x15')]();agents[_0x390169[_0x4402('0x13')]][_0x4402('0x24')]=utils[_0x4402('0x35')](agents[_0x390169[_0x4402('0x13')]][_0x4402('0x34')],agents[_0x390169[_0x4402('0x13')]][_0x4402('0x30')]);agents[_0x390169[_0x4402('0x13')]]['reason']=_0x390169[_0x4402('0x22')];agents[_0x390169['destuniqueid']][_0x4402('0x16')]=_0x4402('0x36');writeDB(agents[_0x390169['destuniqueid']]);}}catch(_0x82f63a){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x33'),_0x390169[_0x4402('0x3')]),_0x82f63a);}};exports[_0x4402('0x37')]=function(_0x5b094b){try{if(!_[_0x4402('0x1d')](agents[_0x5b094b[_0x4402('0x38')]])){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x39'),_0x5b094b[_0x4402('0x3')]),_0x5b094b);utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x3a'),_0x5b094b['uniqueid'],agents[_0x5b094b['transfereruniqueid']]['membername'],agents[_0x5b094b['transfereruniqueid']][_0x4402('0x3')]));agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3b')]=!![];agents[_0x5b094b[_0x4402('0x38')]]['transfertype']=_0x4402('0x3c');agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3d')]=_0x5b094b[_0x4402('0x3e')];agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3f')]=agents[_0x5b094b[_0x4402('0x38')]]['uniqueid'];}}catch(_0x325b20){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x39'),_0x5b094b[_0x4402('0x3')]),_0x325b20);}};exports[_0x4402('0x40')]=function(_0x5477fd){try{utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x41'),_0x5477fd[_0x4402('0x42')]),_0x5477fd);if(_0x5477fd[_0x4402('0x42')]==_0x5477fd[_0x4402('0x43')]){if(!_[_0x4402('0x1d')](agents[_0x5477fd['secondtransfereruniqueid']])){utils['info'](util[_0x4402('0x2')](_0x4402('0x44'),_0x5477fd[_0x4402('0x42')],agents[_0x5477fd['secondtransfereruniqueid']]['membername']));agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3b')]=!![];agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x46')]=_0x4402('0x47');agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3d')]=_0x5477fd[_0x4402('0x48')];agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3f')]=_0x5477fd[_0x4402('0x42')];}if(_0x5477fd[_0x4402('0x49')]&&agents[_0x5477fd[_0x4402('0x49')]]){agents[_0x5477fd['transfereeuniqueid']][_0x4402('0x4a')]=0x1;transfers[_0x5477fd['transfereeuniqueid']]=_[_0x4402('0x4b')](agents[_0x5477fd['transfereeuniqueid']]);transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x6')]=agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x6')];transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x4c')]=agents[_0x5477fd['secondtransfereruniqueid']][_0x4402('0x4c')];transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x14')]=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x49')]]['agentconnectAt']=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x2c')]=0x0;transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x4a')]=0x2;}}else if(_0x5477fd[_0x4402('0x45')]==_0x5477fd[_0x4402('0x4d')]){if(!_[_0x4402('0x1d')](agents[_0x5477fd['origtransfereruniqueid']])){utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5477fd[_0x4402('0x42')],agents[_0x5477fd[_0x4402('0x42')]]['membername']));agents[_0x5477fd['origtransfereruniqueid']][_0x4402('0x3b')]=!![];agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x46')]='ATTENDED';agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x3d')]=_0x5477fd[_0x4402('0x4e')];agents[_0x5477fd['origtransfereruniqueid']][_0x4402('0x3f')]=_0x5477fd[_0x4402('0x45')];}if(_0x5477fd[_0x4402('0x4f')]&&agents[_0x5477fd['transfertargetuniqueid']]){agents[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x4a')]=0x1;transfers[_0x5477fd['transfertargetuniqueid']]=_['clone'](agents[_0x5477fd[_0x4402('0x4f')]]);transfers[_0x5477fd['transfertargetuniqueid']][_0x4402('0x6')]=agents[_0x5477fd[_0x4402('0x42')]]['calleridnum'];transfers[_0x5477fd['transfertargetuniqueid']][_0x4402('0x4c')]=agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x4c')];transfers[_0x5477fd[_0x4402('0x4f')]]['agentcalledAt']=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x30')]=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x2c')]=0x0;transfers[_0x5477fd[_0x4402('0x4f')]]['agententerreason']=0x2;}}}catch(_0x333a72){utils[_0x4402('0x1c')](util['format']('[%s][agents][attendedtransfer]',_0x5477fd[_0x4402('0x42')]),_0x333a72);}};exports['hangup']=function(_0x30569e){try{utils['debug'](util[_0x4402('0x2')](_0x4402('0x50'),_0x30569e[_0x4402('0x3')]),_0x30569e);if(agents[_0x30569e[_0x4402('0x3')]]&&agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]===_0x4402('0x21')){if(_0x30569e[_0x4402('0x51')]==='21'){agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]=_0x4402('0x52');agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]=_0x4402('0x52');}utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x30569e[_0x4402('0x3')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],agents[_0x30569e['uniqueid']][_0x4402('0x22')],agents[_0x30569e['uniqueid']][_0x4402('0x16')]));writeDB(agents[_0x30569e[_0x4402('0x3')]]);var _0x466755=unanswered[_0x4402('0x53')](_0x30569e['uniqueid']);if(_0x466755>-0x1){unanswered[_0x4402('0x54')](_0x466755,0x1);}}if(transfers[_0x30569e['uniqueid']]){transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0xb')]=!![];transfers[_0x30569e[_0x4402('0x3')]]['agentcompleteAt']=utils[_0x4402('0x15')]();transfers[_0x30569e['uniqueid']][_0x4402('0x24')]=utils[_0x4402('0x35')](transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x34')],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x30')]);transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]=_0x4402('0x55');transfers[_0x30569e['uniqueid']][_0x4402('0x16')]=_0x4402('0x36');utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x56'),_0x30569e[_0x4402('0x3')],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],transfers[_0x30569e[_0x4402('0x3')]]['reason'],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]));writeDB(transfers[_0x30569e[_0x4402('0x3')]],!![]);}if(agents[_0x30569e['uniqueid']]&&agents[_0x30569e[_0x4402('0x3')]]['agentconnectAt']){agents[_0x30569e[_0x4402('0x3')]]['agentcomplete']=!![];agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x34')]=utils['now']();agents[_0x30569e[_0x4402('0x3')]]['talktime']=utils[_0x4402('0x35')](agents[_0x30569e[_0x4402('0x3')]]['agentcompleteAt'],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x30')]);agents[_0x30569e['uniqueid']][_0x4402('0x22')]=agents[_0x30569e[_0x4402('0x3')]]['transfer']?_0x4402('0x3b'):_0x4402('0x55');agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]=_0x4402('0x36');utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x56'),_0x30569e[_0x4402('0x3')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')],agents[_0x30569e[_0x4402('0x3')]]['lastevent']));writeDB(agents[_0x30569e[_0x4402('0x3')]]);}}catch(_0xc3914e){utils['error'](util[_0x4402('0x2')]('[%s][agents][hangup]',_0x30569e[_0x4402('0x3')]),_0xc3914e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9d82db8..e4eb8ce 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 _0xc1fd=['[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','hangup','execif','set','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','[%s][calls][newchannel]','newstate','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','toNumber','error','[%s][calls][newstate]','[%s][calls][hangup]','callerid','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid'];(function(_0x442b47,_0xba219c){var _0x1b99bf=function(_0x29835e){while(--_0x29835e){_0x442b47['push'](_0x442b47['shift']());}};_0x1b99bf(++_0xba219c);}(_0xc1fd,0xa1));var _0xdc1f=function(_0x23bbf9,_0x24a29f){_0x23bbf9=_0x23bbf9-0x0;var _0x5c56a0=_0xc1fd[_0x23bbf9];return _0x5c56a0;};'use strict';var _=require(_0xdc1f('0x0'));var util=require(_0xdc1f('0x1'));var utils=require(_0xdc1f('0x2'));var dispositions=[_0xdc1f('0x3'),_0xdc1f('0x4'),'FAILED','NO\x20ANSWER','NO\x20ANSWER',_0xdc1f('0x3'),_0xdc1f('0x5'),'BUSY',_0xdc1f('0x4'),_0xdc1f('0x4'),'FAILED'];var channels={};function writeDB(_0x10ed99){utils[_0xdc1f('0x6')](util[_0xdc1f('0x7')](_0xdc1f('0x8'),_0x10ed99[_0xdc1f('0x9')],_0x10ed99[_0xdc1f('0xa')],_0x10ed99[_0xdc1f('0xb')],_0x10ed99[_0xdc1f('0xc')],_0x10ed99[_0xdc1f('0xd')],_0x10ed99['calleridnum'],_0x10ed99['connectedlinenum'],_0x10ed99[_0xdc1f('0xe')]));if(_0x10ed99[_0xdc1f('0xf')]){utils['getUserByInternal'](_0x10ed99[_0xdc1f('0xf')])[_0xdc1f('0x10')](function(_0x454eb2){if(_0x454eb2){_0x10ed99[_0xdc1f('0x11')]=_0x454eb2['id'];}utils[_0xdc1f('0x12')](_0xdc1f('0x13'),_0x10ed99);});}else{utils[_0xdc1f('0x12')](_0xdc1f('0x13'),_0x10ed99);}if(channels[_0x10ed99[_0xdc1f('0x9')]]){delete channels[_0x10ed99[_0xdc1f('0x9')]];}}exports[_0xdc1f('0x14')]=function(_0x3272c7){try{utils[_0xdc1f('0x15')](util['format']('[%s][calls][newchannel]',_0x3272c7['uniqueid']),_0x3272c7);if(_0x3272c7[_0xdc1f('0x9')]==_0x3272c7['linkedid']&&_0x3272c7[_0xdc1f('0xa')]!=_0xdc1f('0x16')){utils[_0xdc1f('0x6')](util['format'](_0xdc1f('0x17'),_0x3272c7[_0xdc1f('0x9')],_0x3272c7[_0xdc1f('0x18')],_0x3272c7[_0xdc1f('0x19')]));channels[_0x3272c7[_0xdc1f('0x9')]]={'uniqueid':_0x3272c7[_0xdc1f('0x9')],'accountcode':_0x3272c7[_0xdc1f('0xf')],'source':_0x3272c7[_0xdc1f('0x1a')],'destination':_0x3272c7['exten'],'destinationcontext':_0x3272c7[_0xdc1f('0x18')],'channel':_0x3272c7[_0xdc1f('0xa')],'starttime':utils[_0xdc1f('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xdc1f('0x3'),'amaflags':_0xdc1f('0x1c')};}}catch(_0x3a071a){utils['error'](util['format'](_0xdc1f('0x1d'),_0x3272c7[_0xdc1f('0x9')]),_0x3a071a);}};exports[_0xdc1f('0x1e')]=function(_0x1d140b){try{utils[_0xdc1f('0x15')](util[_0xdc1f('0x7')]('[%s][calls][newstate]',_0x1d140b[_0xdc1f('0x9')]),_0x1d140b);if(!_[_0xdc1f('0x1f')](channels[_0x1d140b['uniqueid']])&&_0x1d140b['channelstate']==0x6){utils[_0xdc1f('0x6')](util['format'](_0xdc1f('0x20'),_0x1d140b[_0xdc1f('0x9')],_0x1d140b[_0xdc1f('0x18')],_0x1d140b[_0xdc1f('0xa')]));if(_[_0xdc1f('0x1f')](channels[_0x1d140b[_0xdc1f('0x9')]][_0xdc1f('0x21')])){channels[_0x1d140b[_0xdc1f('0x9')]][_0xdc1f('0x21')]=utils[_0xdc1f('0x1b')]();}}else if(!_[_0xdc1f('0x1f')](channels[_0x1d140b['linkedid']])&&_0x1d140b[_0xdc1f('0x22')]==0x6&&_0x1d140b[_0xdc1f('0x18')]!=_0xdc1f('0x23')){utils[_0xdc1f('0x6')](util[_0xdc1f('0x7')](_0xdc1f('0x24'),_0x1d140b['uniqueid'],_0x1d140b['linkedid'],_0x1d140b[_0xdc1f('0x18')],_0x1d140b['channel']));channels[_0x1d140b[_0xdc1f('0x25')]][_0xdc1f('0xf')]=_0x1d140b[_0xdc1f('0xf')];channels[_0x1d140b[_0xdc1f('0x25')]][_0xdc1f('0x26')]=_0x1d140b[_0xdc1f('0xa')];if(_[_0xdc1f('0x1f')](channels[_0x1d140b['linkedid']][_0xdc1f('0x27')])){channels[_0x1d140b[_0xdc1f('0x25')]][_0xdc1f('0x27')]=utils['now']();}channels[_0x1d140b['linkedid']]['disposition']=dispositions[_[_0xdc1f('0x28')](_0x1d140b[_0xdc1f('0x22')])]||'ANSWERED';}}catch(_0x75a801){utils[_0xdc1f('0x29')](util[_0xdc1f('0x7')](_0xdc1f('0x2a'),_0x1d140b[_0xdc1f('0x9')]),_0x75a801);}};exports['hangup']=function(_0x4ce48d){try{if(!_['isNil'](channels[_0x4ce48d['uniqueid']])){utils[_0xdc1f('0x15')](util[_0xdc1f('0x7')](_0xdc1f('0x2b'),_0x4ce48d['uniqueid']),_0x4ce48d);if(_[_0xdc1f('0x1f')](channels[_0x4ce48d[_0xdc1f('0x9')]][_0xdc1f('0x2c')])){channels[_0x4ce48d[_0xdc1f('0x9')]][_0xdc1f('0x2c')]=_0x4ce48d['calleridname']+'\x20<'+_0x4ce48d['calleridnum']+'>';}utils[_0xdc1f('0x6')](util[_0xdc1f('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x4ce48d[_0xdc1f('0x9')],channels[_0x4ce48d[_0xdc1f('0x9')]][_0xdc1f('0x2c')],_0x4ce48d[_0xdc1f('0x2d')]));channels[_0x4ce48d[_0xdc1f('0x9')]][_0xdc1f('0x2e')]=utils[_0xdc1f('0x1b')]();channels[_0x4ce48d[_0xdc1f('0x9')]][_0xdc1f('0x2f')]=utils[_0xdc1f('0x30')](channels[_0x4ce48d[_0xdc1f('0x9')]][_0xdc1f('0x2e')],channels[_0x4ce48d[_0xdc1f('0x9')]]['starttime']);channels[_0x4ce48d['uniqueid']][_0xdc1f('0x31')]=channels[_0x4ce48d[_0xdc1f('0x9')]][_0xdc1f('0x27')]?utils[_0xdc1f('0x30')](channels[_0x4ce48d[_0xdc1f('0x9')]][_0xdc1f('0x2e')],channels[_0x4ce48d[_0xdc1f('0x9')]]['answertime']):0x0;writeDB(channels[_0x4ce48d[_0xdc1f('0x9')]]);}}catch(_0x4509fd){utils['error'](util[_0xdc1f('0x7')]('[%s][calls][hangup]',_0x4ce48d[_0xdc1f('0x9')]),_0x4509fd);}};exports[_0xdc1f('0x32')]=function(_0x41eef5){try{if(!_[_0xdc1f('0x1f')](channels[_0x41eef5[_0xdc1f('0x33')]])){utils['debug'](util[_0xdc1f('0x7')]('[%s][calls][attendedtransfer]',_0x41eef5[_0xdc1f('0x34')]),_0x41eef5);if(channels[_0x41eef5[_0xdc1f('0x33')]][_0xdc1f('0xa')]==_0x41eef5['transfereechannel']){utils[_0xdc1f('0x6')](util[_0xdc1f('0x7')](_0xdc1f('0x35'),_0x41eef5['origtransfereruniqueid'],_0x41eef5['localtwolinkedid'],_0x41eef5[_0xdc1f('0x36')]));channels[_0x41eef5[_0xdc1f('0x33')]][_0xdc1f('0x26')]=_0x41eef5['secondtransfererchannel'];channels[_0x41eef5[_0xdc1f('0x33')]][_0xdc1f('0x37')]=_0xdc1f('0x38');}else if(channels[_0x41eef5[_0xdc1f('0x33')]][_0xdc1f('0xa')]=_0x41eef5[_0xdc1f('0x39')]){utils['info'](util[_0xdc1f('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x41eef5[_0xdc1f('0x34')],_0x41eef5[_0xdc1f('0x33')],_0x41eef5[_0xdc1f('0x3a')]));channels[_0x41eef5[_0xdc1f('0x33')]][_0xdc1f('0x26')]=_0x41eef5[_0xdc1f('0x3a')];channels[_0x41eef5[_0xdc1f('0x33')]][_0xdc1f('0x37')]=_0xdc1f('0x38');}}}catch(_0x1a56da){utils[_0xdc1f('0x29')](util[_0xdc1f('0x7')]('[%s][calls][attendedtransfer]',_0x41eef5['origtransfereruniqueid']),_0x1a56da);}};exports['musiconholdstart']=function(_0x18e096){try{if(!_[_0xdc1f('0x1f')](channels[_0x18e096[_0xdc1f('0x9')]])){utils[_0xdc1f('0x15')](util['format'](_0xdc1f('0x3b'),_0x18e096[_0xdc1f('0x9')]),_0x18e096);channels[_0x18e096[_0xdc1f('0x9')]][_0xdc1f('0x3c')]=utils[_0xdc1f('0x1b')]();utils['info'](util['format'](_0xdc1f('0x3d'),_0x18e096[_0xdc1f('0x9')],channels[_0x18e096['uniqueid']]['musiconholdstartAt']));}}catch(_0x9d18d9){utils[_0xdc1f('0x29')](util[_0xdc1f('0x7')](_0xdc1f('0x3b'),_0x18e096[_0xdc1f('0x9')]),_0x9d18d9);}};exports['musiconholdstop']=function(_0x25b12b){try{if(!_[_0xdc1f('0x1f')](channels[_0x25b12b[_0xdc1f('0x9')]])){utils['debug'](util[_0xdc1f('0x7')](_0xdc1f('0x3e'),_0x25b12b[_0xdc1f('0x9')]),_0x25b12b);if(!_[_0xdc1f('0x1f')](channels[_0x25b12b[_0xdc1f('0x9')]][_0xdc1f('0x3c')])){channels[_0x25b12b[_0xdc1f('0x9')]]['mohtime']+=utils[_0xdc1f('0x30')](utils[_0xdc1f('0x1b')](),channels[_0x25b12b[_0xdc1f('0x9')]][_0xdc1f('0x3c')]);utils['info'](util['format'](_0xdc1f('0x3f'),_0x25b12b[_0xdc1f('0x9')],channels[_0x25b12b[_0xdc1f('0x9')]][_0xdc1f('0x40')]));delete channels[_0x25b12b[_0xdc1f('0x9')]][_0xdc1f('0x3c')];}}}catch(_0x13dce2){utils[_0xdc1f('0x29')](util['format'](_0xdc1f('0x3e'),_0x25b12b[_0xdc1f('0x9')]),_0x13dce2);}};exports[_0xdc1f('0x41')]=function(_0x5d4832){try{if(!_[_0xdc1f('0x1f')](channels[_0x5d4832[_0xdc1f('0x9')]])){utils[_0xdc1f('0x15')](util['format']('[%s][calls][varset]',_0x5d4832[_0xdc1f('0x9')]),_0x5d4832);if(!_['isNil'](_0x5d4832[_0xdc1f('0x42')][_0xdc1f('0x43')])){utils['info'](util[_0xdc1f('0x7')](_0xdc1f('0x44'),_0x5d4832[_0xdc1f('0x9')],_0x5d4832['value']));channels[_0x5d4832['uniqueid']][_0xdc1f('0x45')]=_0x5d4832['value'];}if(!_['isNil'](_0x5d4832[_0xdc1f('0x42')][_0xdc1f('0x46')])){utils[_0xdc1f('0x6')](util[_0xdc1f('0x7')](_0xdc1f('0x47'),_0x5d4832[_0xdc1f('0x9')],_0x5d4832[_0xdc1f('0x48')]));channels[_0x5d4832[_0xdc1f('0x9')]][_0xdc1f('0x49')]=_0x5d4832[_0xdc1f('0x48')];channels[_0x5d4832[_0xdc1f('0x9')]][_0xdc1f('0x2c')]='\x22'+_0x5d4832[_0xdc1f('0x48')]+_0xdc1f('0x4a')+_0x5d4832['value']+'>';}if(!_[_0xdc1f('0x1f')](_0x5d4832[_0xdc1f('0x42')][_0xdc1f('0x4b')])||!_['isNil'](_0x5d4832[_0xdc1f('0x42')]['xmd-callerid'])){utils[_0xdc1f('0x6')](util['format'](_0xdc1f('0x4c'),_0x5d4832[_0xdc1f('0x9')],!_[_0xdc1f('0x1f')](_0x5d4832[_0xdc1f('0x42')][_0xdc1f('0x4b')])?'xmd-callerid-preview':_0xdc1f('0x4d'),_0x5d4832['value']));channels[_0x5d4832['uniqueid']][_0xdc1f('0x2c')]=_0x5d4832[_0xdc1f('0x48')];}if(!_[_0xdc1f('0x1f')](_0x5d4832['variable'][_0xdc1f('0x4e')])||!_[_0xdc1f('0x1f')](_0x5d4832[_0xdc1f('0x42')][_0xdc1f('0x4f')])){utils[_0xdc1f('0x6')](util[_0xdc1f('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5d4832[_0xdc1f('0x9')],!_[_0xdc1f('0x1f')](_0x5d4832[_0xdc1f('0x42')][_0xdc1f('0x4e')])?_0xdc1f('0x4e'):_0xdc1f('0x4f'),_0x5d4832[_0xdc1f('0x48')]));channels[_0x5d4832[_0xdc1f('0x9')]][_0xdc1f('0x50')]=_0xdc1f('0x51');channels[_0x5d4832[_0xdc1f('0x9')]][_0xdc1f('0x52')]=_0x5d4832[_0xdc1f('0x48')];channels[_0x5d4832[_0xdc1f('0x9')]][_0xdc1f('0xb')]=!![];}if(!_['isNil'](_0x5d4832[_0xdc1f('0x42')][_0xdc1f('0x53')])){utils[_0xdc1f('0x6')](util['format'](_0xdc1f('0x54'),_0x5d4832['uniqueid'],_0x5d4832[_0xdc1f('0x48')]));channels[_0x5d4832[_0xdc1f('0x9')]][_0xdc1f('0x55')]=_0x5d4832['value'];}if(!_[_0xdc1f('0x1f')](_0x5d4832[_0xdc1f('0x42')][_0xdc1f('0x56')])){utils[_0xdc1f('0x6')](util['format'](_0xdc1f('0x57'),_0x5d4832['uniqueid'],_0x5d4832[_0xdc1f('0x48')]));channels[_0x5d4832[_0xdc1f('0x9')]][_0xdc1f('0x58')]=_0x5d4832['value'];}if(!_[_0xdc1f('0x1f')](_0x5d4832['variable']['outboundrouteid'])){utils['info'](util[_0xdc1f('0x7')](_0xdc1f('0x59'),_0x5d4832['uniqueid'],_0x5d4832[_0xdc1f('0x48')]));channels[_0x5d4832[_0xdc1f('0x9')]]['routeid']=_0x5d4832[_0xdc1f('0x48')];}if(!_['isNil'](_0x5d4832['variable']['sipcallid'])){utils[_0xdc1f('0x6')](util[_0xdc1f('0x7')](_0xdc1f('0x5a'),_0x5d4832[_0xdc1f('0x9')],_0x5d4832[_0xdc1f('0x48')]));channels[_0x5d4832[_0xdc1f('0x9')]][_0xdc1f('0x5b')]=_0x5d4832['value'];}}}catch(_0x17eaee){utils[_0xdc1f('0x29')](util[_0xdc1f('0x7')](_0xdc1f('0x5c'),_0x5d4832[_0xdc1f('0x9')]),_0x17eaee);}};exports[_0xdc1f('0x5d')]=function(_0x511cf0){try{if(!_[_0xdc1f('0x1f')](channels[_0x511cf0[_0xdc1f('0x9')]])){utils[_0xdc1f('0x15')](util[_0xdc1f('0x7')](_0xdc1f('0x5e'),_0x511cf0[_0xdc1f('0x9')]),_0x511cf0);utils[_0xdc1f('0x6')](util[_0xdc1f('0x7')](_0xdc1f('0x5f'),_0x511cf0[_0xdc1f('0x9')],_0x511cf0[_0xdc1f('0x60')],_0x511cf0[_0xdc1f('0x61')]));if(_0x511cf0['application'][_0xdc1f('0x62')]()=='set'&&_['startsWith'](_0x511cf0[_0xdc1f('0x61')][_0xdc1f('0x62')](),_0xdc1f('0x63'))){var _0x1cc1a7=_0x511cf0['appdata'][_0xdc1f('0x64')]('=');var _0x5be485=_0x1cc1a7[0x0][_0xdc1f('0x65')](_0x1cc1a7[0x0][_0xdc1f('0x66')]('(')+0x1,_0x1cc1a7[0x0]['lastIndexOf'](')'));var _0x56a0b4=_0x1cc1a7[0x1];channels[_0x511cf0[_0xdc1f('0x9')]][_0x5be485]=_0x56a0b4;}if(!_[_0xdc1f('0x67')]([_0xdc1f('0x68'),'noop',_0xdc1f('0x69'),_0xdc1f('0x6a'),'gotoif'],_0x511cf0['application']['toLowerCase']())){channels[_0x511cf0[_0xdc1f('0x9')]][_0xdc1f('0x50')]=_0x511cf0[_0xdc1f('0x60')];channels[_0x511cf0[_0xdc1f('0x9')]]['lastdata']=_0x511cf0[_0xdc1f('0x61')];}}}catch(_0x53f59a){utils[_0xdc1f('0x29')](util[_0xdc1f('0x7')](_0xdc1f('0x5e'),_0x511cf0['uniqueid']),_0x53f59a);}}; \ No newline at end of file +var _0xb9ad=['split','substring','lastIndexOf','includes','noop','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','debug','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','billableseconds','diffTime','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith'];(function(_0x4f25fc,_0x5d77e8){var _0x5c3d40=function(_0x3bce8d){while(--_0x3bce8d){_0x4f25fc['push'](_0x4f25fc['shift']());}};_0x5c3d40(++_0x5d77e8);}(_0xb9ad,0x1b2));var _0xdb9a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb9ad[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xdb9a('0x0'));var util=require(_0xdb9a('0x1'));var utils=require(_0xdb9a('0x2'));var dispositions=[_0xdb9a('0x3'),_0xdb9a('0x4'),_0xdb9a('0x4'),'NO\x20ANSWER',_0xdb9a('0x3'),_0xdb9a('0x3'),_0xdb9a('0x5'),'BUSY',_0xdb9a('0x4'),_0xdb9a('0x4'),_0xdb9a('0x4')];var channels={};function writeDB(_0xf02f9d){utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')](_0xdb9a('0x8'),_0xf02f9d[_0xdb9a('0x9')],_0xf02f9d[_0xdb9a('0xa')],_0xf02f9d['queue'],_0xf02f9d[_0xdb9a('0xb')],_0xf02f9d[_0xdb9a('0xc')],_0xf02f9d[_0xdb9a('0xd')],_0xf02f9d[_0xdb9a('0xe')],_0xf02f9d[_0xdb9a('0xf')]));if(_0xf02f9d[_0xdb9a('0x10')]){utils[_0xdb9a('0x11')](_0xf02f9d['accountcode'])[_0xdb9a('0x12')](function(_0x1130a6){if(_0x1130a6){_0xf02f9d['UserId']=_0x1130a6['id'];}utils[_0xdb9a('0x13')]('CreateVoiceCallReport',_0xf02f9d);});}else{utils[_0xdb9a('0x13')](_0xdb9a('0x14'),_0xf02f9d);}if(channels[_0xf02f9d['uniqueid']]){delete channels[_0xf02f9d[_0xdb9a('0x9')]];}}exports['newchannel']=function(_0x28c1b4){try{utils[_0xdb9a('0x15')](util[_0xdb9a('0x7')]('[%s][calls][newchannel]',_0x28c1b4[_0xdb9a('0x9')]),_0x28c1b4);if(_0x28c1b4['uniqueid']==_0x28c1b4['linkedid']&&_0x28c1b4[_0xdb9a('0xa')]!=_0xdb9a('0x16')){utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')](_0xdb9a('0x17'),_0x28c1b4[_0xdb9a('0x9')],_0x28c1b4[_0xdb9a('0x18')],_0x28c1b4[_0xdb9a('0x19')]));channels[_0x28c1b4['uniqueid']]={'uniqueid':_0x28c1b4[_0xdb9a('0x9')],'accountcode':_0x28c1b4['accountcode'],'source':_0x28c1b4[_0xdb9a('0xd')],'destination':_0x28c1b4['exten'],'destinationcontext':_0x28c1b4['context'],'channel':_0x28c1b4['channel'],'starttime':utils[_0xdb9a('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xdb9a('0x3'),'amaflags':_0xdb9a('0x1b')};}}catch(_0x101391){utils[_0xdb9a('0x1c')](util[_0xdb9a('0x7')](_0xdb9a('0x1d'),_0x28c1b4[_0xdb9a('0x9')]),_0x101391);}};exports[_0xdb9a('0x1e')]=function(_0xb6338b){try{utils[_0xdb9a('0x15')](util[_0xdb9a('0x7')]('[%s][calls][newstate]',_0xb6338b[_0xdb9a('0x9')]),_0xb6338b);if(!_[_0xdb9a('0x1f')](channels[_0xb6338b[_0xdb9a('0x9')]])&&_0xb6338b[_0xdb9a('0x20')]==0x6){utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')](_0xdb9a('0x21'),_0xb6338b[_0xdb9a('0x9')],_0xb6338b[_0xdb9a('0x18')],_0xb6338b[_0xdb9a('0xa')]));if(_[_0xdb9a('0x1f')](channels[_0xb6338b[_0xdb9a('0x9')]][_0xdb9a('0x22')])){channels[_0xb6338b[_0xdb9a('0x9')]][_0xdb9a('0x22')]=utils[_0xdb9a('0x1a')]();}}else if(!_[_0xdb9a('0x1f')](channels[_0xb6338b[_0xdb9a('0x23')]])&&_0xb6338b[_0xdb9a('0x20')]==0x6&&_0xb6338b[_0xdb9a('0x18')]!=_0xdb9a('0x24')){utils['info'](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0xb6338b['uniqueid'],_0xb6338b[_0xdb9a('0x23')],_0xb6338b[_0xdb9a('0x18')],_0xb6338b[_0xdb9a('0xa')]));channels[_0xb6338b[_0xdb9a('0x23')]]['accountcode']=_0xb6338b['accountcode'];channels[_0xb6338b['linkedid']][_0xdb9a('0x25')]=_0xb6338b[_0xdb9a('0xa')];if(_[_0xdb9a('0x1f')](channels[_0xb6338b[_0xdb9a('0x23')]][_0xdb9a('0x26')])){channels[_0xb6338b[_0xdb9a('0x23')]][_0xdb9a('0x26')]=utils[_0xdb9a('0x1a')]();}channels[_0xb6338b[_0xdb9a('0x23')]][_0xdb9a('0x27')]=dispositions[_[_0xdb9a('0x28')](_0xb6338b[_0xdb9a('0x20')])]||_0xdb9a('0x5');}}catch(_0x520248){utils[_0xdb9a('0x1c')](util[_0xdb9a('0x7')]('[%s][calls][newstate]',_0xb6338b[_0xdb9a('0x9')]),_0x520248);}};exports[_0xdb9a('0x29')]=function(_0x15fead){try{if(!_[_0xdb9a('0x1f')](channels[_0x15fead[_0xdb9a('0x9')]])){utils[_0xdb9a('0x15')](util[_0xdb9a('0x7')](_0xdb9a('0x2a'),_0x15fead[_0xdb9a('0x9')]),_0x15fead);if(_[_0xdb9a('0x1f')](channels[_0x15fead['uniqueid']]['callerid'])){channels[_0x15fead[_0xdb9a('0x9')]][_0xdb9a('0x2b')]=_0x15fead[_0xdb9a('0x2c')]+'\x20<'+_0x15fead[_0xdb9a('0xd')]+'>';}utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')](_0xdb9a('0x2d'),_0x15fead[_0xdb9a('0x9')],channels[_0x15fead[_0xdb9a('0x9')]][_0xdb9a('0x2b')],_0x15fead[_0xdb9a('0x2e')]));channels[_0x15fead[_0xdb9a('0x9')]][_0xdb9a('0x2f')]=utils[_0xdb9a('0x1a')]();channels[_0x15fead['uniqueid']][_0xdb9a('0x30')]=utils['diffTime'](channels[_0x15fead[_0xdb9a('0x9')]]['endtime'],channels[_0x15fead[_0xdb9a('0x9')]]['starttime']);channels[_0x15fead[_0xdb9a('0x9')]][_0xdb9a('0x31')]=channels[_0x15fead[_0xdb9a('0x9')]][_0xdb9a('0x26')]?utils[_0xdb9a('0x32')](channels[_0x15fead[_0xdb9a('0x9')]][_0xdb9a('0x2f')],channels[_0x15fead[_0xdb9a('0x9')]][_0xdb9a('0x26')]):0x0;writeDB(channels[_0x15fead[_0xdb9a('0x9')]]);}}catch(_0x2958fc){utils['error'](util[_0xdb9a('0x7')](_0xdb9a('0x2a'),_0x15fead[_0xdb9a('0x9')]),_0x2958fc);}};exports['attendedtransfer']=function(_0x23b79a){try{if(!_[_0xdb9a('0x1f')](channels[_0x23b79a[_0xdb9a('0x33')]])){utils[_0xdb9a('0x15')](util[_0xdb9a('0x7')]('[%s][calls][attendedtransfer]',_0x23b79a[_0xdb9a('0x34')]),_0x23b79a);if(channels[_0x23b79a[_0xdb9a('0x33')]][_0xdb9a('0xa')]==_0x23b79a[_0xdb9a('0x35')]){utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')](_0xdb9a('0x36'),_0x23b79a[_0xdb9a('0x34')],_0x23b79a[_0xdb9a('0x33')],_0x23b79a[_0xdb9a('0x37')]));channels[_0x23b79a[_0xdb9a('0x33')]][_0xdb9a('0x25')]=_0x23b79a['secondtransfererchannel'];channels[_0x23b79a[_0xdb9a('0x33')]][_0xdb9a('0x38')]=_0xdb9a('0x39');}else if(channels[_0x23b79a[_0xdb9a('0x33')]][_0xdb9a('0xa')]=_0x23b79a[_0xdb9a('0x3a')]){utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x23b79a['origtransfereruniqueid'],_0x23b79a[_0xdb9a('0x33')],_0x23b79a[_0xdb9a('0x3b')]));channels[_0x23b79a['localtwolinkedid']][_0xdb9a('0x25')]=_0x23b79a[_0xdb9a('0x3b')];channels[_0x23b79a[_0xdb9a('0x33')]][_0xdb9a('0x38')]=_0xdb9a('0x39');}}}catch(_0x16233d){utils['error'](util[_0xdb9a('0x7')](_0xdb9a('0x3c'),_0x23b79a['origtransfereruniqueid']),_0x16233d);}};exports[_0xdb9a('0x3d')]=function(_0x48fb06){try{if(!_[_0xdb9a('0x1f')](channels[_0x48fb06[_0xdb9a('0x9')]])){utils[_0xdb9a('0x15')](util['format'](_0xdb9a('0x3e'),_0x48fb06[_0xdb9a('0x9')]),_0x48fb06);channels[_0x48fb06[_0xdb9a('0x9')]][_0xdb9a('0x3f')]=utils[_0xdb9a('0x1a')]();utils['info'](util[_0xdb9a('0x7')](_0xdb9a('0x40'),_0x48fb06[_0xdb9a('0x9')],channels[_0x48fb06[_0xdb9a('0x9')]][_0xdb9a('0x3f')]));}}catch(_0x5a24b0){utils['error'](util[_0xdb9a('0x7')](_0xdb9a('0x3e'),_0x48fb06[_0xdb9a('0x9')]),_0x5a24b0);}};exports['musiconholdstop']=function(_0x5afc11){try{if(!_[_0xdb9a('0x1f')](channels[_0x5afc11[_0xdb9a('0x9')]])){utils[_0xdb9a('0x15')](util[_0xdb9a('0x7')](_0xdb9a('0x41'),_0x5afc11[_0xdb9a('0x9')]),_0x5afc11);if(!_[_0xdb9a('0x1f')](channels[_0x5afc11[_0xdb9a('0x9')]][_0xdb9a('0x3f')])){channels[_0x5afc11['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0xdb9a('0x1a')](),channels[_0x5afc11['uniqueid']][_0xdb9a('0x3f')]);utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5afc11[_0xdb9a('0x9')],channels[_0x5afc11[_0xdb9a('0x9')]][_0xdb9a('0x42')]));delete channels[_0x5afc11['uniqueid']][_0xdb9a('0x3f')];}}}catch(_0x17fb5e){utils[_0xdb9a('0x1c')](util[_0xdb9a('0x7')]('[%s][calls][musiconholdstop]',_0x5afc11[_0xdb9a('0x9')]),_0x17fb5e);}};exports[_0xdb9a('0x43')]=function(_0xecb001){try{if(!_[_0xdb9a('0x1f')](channels[_0xecb001[_0xdb9a('0x9')]])){utils[_0xdb9a('0x15')](util[_0xdb9a('0x7')]('[%s][calls][varset]',_0xecb001[_0xdb9a('0x9')]),_0xecb001);if(!_[_0xdb9a('0x1f')](_0xecb001[_0xdb9a('0x44')][_0xdb9a('0x45')])){utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')](_0xdb9a('0x46'),_0xecb001[_0xdb9a('0x9')],_0xecb001[_0xdb9a('0x47')]));channels[_0xecb001[_0xdb9a('0x9')]][_0xdb9a('0x48')]=_0xecb001['value'];}if(!_[_0xdb9a('0x1f')](_0xecb001['variable']['xmd-phone'])){utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')](_0xdb9a('0x49'),_0xecb001[_0xdb9a('0x9')],_0xecb001[_0xdb9a('0x47')]));channels[_0xecb001[_0xdb9a('0x9')]][_0xdb9a('0x4a')]=_0xecb001[_0xdb9a('0x47')];channels[_0xecb001[_0xdb9a('0x9')]][_0xdb9a('0x2b')]='\x22'+_0xecb001[_0xdb9a('0x47')]+_0xdb9a('0x4b')+_0xecb001['value']+'>';}if(!_[_0xdb9a('0x1f')](_0xecb001['variable'][_0xdb9a('0x4c')])||!_['isNil'](_0xecb001[_0xdb9a('0x44')]['xmd-callerid'])){utils[_0xdb9a('0x6')](util['format'](_0xdb9a('0x4d'),_0xecb001[_0xdb9a('0x9')],!_[_0xdb9a('0x1f')](_0xecb001[_0xdb9a('0x44')][_0xdb9a('0x4c')])?'xmd-callerid-preview':_0xdb9a('0x4e'),_0xecb001[_0xdb9a('0x47')]));channels[_0xecb001[_0xdb9a('0x9')]][_0xdb9a('0x2b')]=_0xecb001[_0xdb9a('0x47')];}if(!_['isNil'](_0xecb001[_0xdb9a('0x44')][_0xdb9a('0x4f')])||!_['isNil'](_0xecb001['variable']['xmcs-queue'])){utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')](_0xdb9a('0x4d'),_0xecb001[_0xdb9a('0x9')],!_[_0xdb9a('0x1f')](_0xecb001[_0xdb9a('0x44')]['xmd-queue'])?_0xdb9a('0x4f'):_0xdb9a('0x50'),_0xecb001[_0xdb9a('0x47')]));channels[_0xecb001[_0xdb9a('0x9')]][_0xdb9a('0x51')]='Queue';channels[_0xecb001[_0xdb9a('0x9')]][_0xdb9a('0x52')]=_0xecb001['value'];channels[_0xecb001[_0xdb9a('0x9')]][_0xdb9a('0x53')]=!![];}if(!_[_0xdb9a('0x1f')](_0xecb001[_0xdb9a('0x44')][_0xdb9a('0x54')])){utils[_0xdb9a('0x6')](util[_0xdb9a('0x7')](_0xdb9a('0x55'),_0xecb001[_0xdb9a('0x9')],_0xecb001[_0xdb9a('0x47')]));channels[_0xecb001[_0xdb9a('0x9')]]['ContactId']=_0xecb001['value'];}if(!_[_0xdb9a('0x1f')](_0xecb001['variable'][_0xdb9a('0x56')])){utils[_0xdb9a('0x6')](util['format'](_0xdb9a('0x57'),_0xecb001['uniqueid'],_0xecb001[_0xdb9a('0x47')]));channels[_0xecb001[_0xdb9a('0x9')]][_0xdb9a('0x58')]=_0xecb001['value'];}if(!_[_0xdb9a('0x1f')](_0xecb001['variable'][_0xdb9a('0x59')])){utils['info'](util['format'](_0xdb9a('0x5a'),_0xecb001['uniqueid'],_0xecb001['value']));channels[_0xecb001[_0xdb9a('0x9')]][_0xdb9a('0x5b')]=_0xecb001[_0xdb9a('0x47')];}if(!_[_0xdb9a('0x1f')](_0xecb001[_0xdb9a('0x44')][_0xdb9a('0x5c')])){utils['info'](util[_0xdb9a('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0xecb001[_0xdb9a('0x9')],_0xecb001[_0xdb9a('0x47')]));channels[_0xecb001[_0xdb9a('0x9')]][_0xdb9a('0x5c')]=_0xecb001['value'];}}}catch(_0x1e4773){utils[_0xdb9a('0x1c')](util[_0xdb9a('0x7')](_0xdb9a('0x5d'),_0xecb001[_0xdb9a('0x9')]),_0x1e4773);}};exports[_0xdb9a('0x5e')]=function(_0x2d620){try{if(!_['isNil'](channels[_0x2d620['uniqueid']])){utils[_0xdb9a('0x15')](util[_0xdb9a('0x7')](_0xdb9a('0x5f'),_0x2d620[_0xdb9a('0x9')]),_0x2d620);utils[_0xdb9a('0x6')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2d620[_0xdb9a('0x9')],_0x2d620[_0xdb9a('0x60')],_0x2d620[_0xdb9a('0x61')]));if(_0x2d620[_0xdb9a('0x60')][_0xdb9a('0x62')]()==_0xdb9a('0x63')&&_[_0xdb9a('0x64')](_0x2d620['appdata'][_0xdb9a('0x62')](),'cdr')){var _0x2991be=_0x2d620[_0xdb9a('0x61')][_0xdb9a('0x65')]('=');var _0x4b0188=_0x2991be[0x0][_0xdb9a('0x66')](_0x2991be[0x0][_0xdb9a('0x67')]('(')+0x1,_0x2991be[0x0][_0xdb9a('0x67')](')'));var _0x32133a=_0x2991be[0x1];channels[_0x2d620['uniqueid']][_0x4b0188]=_0x32133a;}if(!_[_0xdb9a('0x68')]([_0xdb9a('0x29'),_0xdb9a('0x69'),'execif',_0xdb9a('0x63'),_0xdb9a('0x6a')],_0x2d620[_0xdb9a('0x60')][_0xdb9a('0x62')]())){channels[_0x2d620[_0xdb9a('0x9')]][_0xdb9a('0x51')]=_0x2d620[_0xdb9a('0x60')];channels[_0x2d620['uniqueid']][_0xdb9a('0x52')]=_0x2d620[_0xdb9a('0x61')];}}}catch(_0x3444d7){utils[_0xdb9a('0x1c')](util[_0xdb9a('0x7')](_0xdb9a('0x5f'),_0x2d620[_0xdb9a('0x9')]),_0x3444d7);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d144d86..7c717f7 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 _0x9d1f=['shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','info','[core]\x20connected'];(function(_0x2baec5,_0x509266){var _0x2d90fd=function(_0x8479f2){while(--_0x8479f2){_0x2baec5['push'](_0x2baec5['shift']());}};_0x2d90fd(++_0x509266);}(_0x9d1f,0x9d));var _0xf9d1=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x9d1f[_0x400322];return _0xfdd597;};'use strict';var utils=require(_0xf9d1('0x0'));exports['connect']=function(){utils[_0xf9d1('0x1')](_0xf9d1('0x2'));};exports[_0xf9d1('0x3')]=function(){utils[_0xf9d1('0x1')](_0xf9d1('0x4'));};exports[_0xf9d1('0x5')]=function(){utils['info']('[core]\x20fullybooted');};exports[_0xf9d1('0x6')]=function(_0x2f5bda){utils[_0xf9d1('0x6')](_0xf9d1('0x7'),_0x2f5bda);};exports['close']=function(){utils[_0xf9d1('0x1')](_0xf9d1('0x8'));};exports[_0xf9d1('0x9')]=function(_0x4e1970){}; \ No newline at end of file +var _0x6823=['[core]\x20error','close','managerevent','./utils','[core]\x20connected','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x1f31cf,_0x3f1b12){var _0x76ff4a=function(_0xcf1c75){while(--_0xcf1c75){_0x1f31cf['push'](_0x1f31cf['shift']());}};_0x76ff4a(++_0x3f1b12);}(_0x6823,0x8f));var _0x3682=function(_0x404d22,_0x44b8fe){_0x404d22=_0x404d22-0x0;var _0x5eea94=_0x6823[_0x404d22];return _0x5eea94;};'use strict';var utils=require(_0x3682('0x0'));exports['connect']=function(){utils['info'](_0x3682('0x1'));};exports['shutdown']=function(){utils[_0x3682('0x2')](_0x3682('0x3'));};exports[_0x3682('0x4')]=function(){utils['info'](_0x3682('0x5'));};exports[_0x3682('0x6')]=function(_0x1ab244){utils[_0x3682('0x6')](_0x3682('0x7'),_0x1ab244);};exports[_0x3682('0x8')]=function(){utils[_0x3682('0x2')]('[core]\x20close');};exports[_0x3682('0x9')]=function(_0x1e1623){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d280776..c140596 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 _0x745b=['channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid'];(function(_0xd308e1,_0x90e0ae){var _0x315739=function(_0x4d0232){while(--_0x4d0232){_0xd308e1['push'](_0xd308e1['shift']());}};_0x315739(++_0x90e0ae);}(_0x745b,0x131));var _0xb745=function(_0x458e11,_0xab38c4){_0x458e11=_0x458e11-0x0;var _0x5408d6=_0x745b[_0x458e11];return _0x5408d6;};'use strict';var _=require(_0xb745('0x0'));var util=require(_0xb745('0x1'));var utils=require(_0xb745('0x2'));var dials={};function writeDB(_0x273729){utils[_0xb745('0x3')](util[_0xb745('0x4')](_0xb745('0x5'),_0x273729[_0xb745('0x6')],_0x273729[_0xb745('0x7')],_0x273729[_0xb745('0x8')],_0x273729[_0xb745('0x9')],_0x273729[_0xb745('0xa')],_0x273729[_0xb745('0xb')]));utils[_0xb745('0xc')]('CreateVoiceDialReport',_0x273729);delete dials[_0x273729[_0xb745('0x6')]];}exports[_0xb745('0xd')]=function(_0x58a4f0){try{utils[_0xb745('0xe')](util[_0xb745('0x4')](_0xb745('0xf'),_0x58a4f0[_0xb745('0x6')]),_0x58a4f0);utils[_0xb745('0x3')](util[_0xb745('0x4')](_0xb745('0x10'),_0x58a4f0[_0xb745('0x6')],_0x58a4f0[_0xb745('0x11')],_0x58a4f0[_0xb745('0x12')]));if(_0x58a4f0[_0xb745('0x11')][_0xb745('0x13')]()==_0xb745('0x14')&&_[_0xb745('0x15')](_0x58a4f0[_0xb745('0x12')][_0xb745('0x13')](),_0xb745('0x16'))){var _0x485d8c=_0x58a4f0[_0xb745('0x12')]['split']('=');dials[_0x58a4f0[_0xb745('0x6')]]={'routeId':_0x485d8c[0x1]};}}catch(_0x179365){utils['error'](util[_0xb745('0x4')]('[%s][dials][newexten]',_0x58a4f0[_0xb745('0x6')]),_0x179365);}};exports['varset']=function(_0x154513){try{utils['debug'](util[_0xb745('0x4')]('[%s][dials][varset]',_0x154513[_0xb745('0x6')]),_0x154513);if(!_[_0xb745('0x17')](_0x154513[_0xb745('0x18')][_0xb745('0x19')])){utils[_0xb745('0x3')](util[_0xb745('0x4')](_0xb745('0x1a'),_0x154513[_0xb745('0x6')],_0x154513['value']));dials[_0x154513[_0xb745('0x6')]]={'routeId':_0x154513[_0xb745('0x1b')]};}}catch(_0x4010cb){utils[_0xb745('0x1c')](util[_0xb745('0x4')](_0xb745('0x1d'),_0x154513[_0xb745('0x6')]),_0x4010cb);}};exports[_0xb745('0x1e')]=function(_0x17901a){try{if(!_[_0xb745('0x17')](dials[_0x17901a['uniqueid']])){utils[_0xb745('0xe')](util['format'](_0xb745('0x1f'),_0x17901a[_0xb745('0x6')]),_0x17901a);dials[_0x17901a[_0xb745('0x6')]]=_[_0xb745('0x20')](dials[_0x17901a[_0xb745('0x6')]],_0x17901a);dials[_0x17901a[_0xb745('0x6')]][_0xb745('0x21')]=utils[_0xb745('0x22')]();dials[_0x17901a[_0xb745('0x6')]]['lastevent']='called';utils[_0xb745('0x3')](util[_0xb745('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x17901a[_0xb745('0x6')],dials[_0x17901a[_0xb745('0x6')]]['starttime']));}}catch(_0x2e883a){utils[_0xb745('0x1c')](util['format'](_0xb745('0x1f'),_0x17901a['uniqueid']),_0x2e883a);}};exports['dialend']=function(_0x2eafc4){try{if(!_[_0xb745('0x17')](dials[_0x2eafc4[_0xb745('0x6')]])){utils['debug'](util[_0xb745('0x4')]('[%s][dials][dialend]',_0x2eafc4[_0xb745('0x6')]),_0x2eafc4);dials[_0x2eafc4['uniqueid']][_0xb745('0xb')]=_0x2eafc4[_0xb745('0xb')];if(_0x2eafc4[_0xb745('0xb')]==_0xb745('0x23')){dials[_0x2eafc4['uniqueid']]=_['assign'](dials[_0x2eafc4[_0xb745('0x6')]],_0x2eafc4);dials[_0x2eafc4[_0xb745('0x6')]][_0xb745('0x24')]=utils[_0xb745('0x22')]();dials[_0x2eafc4['uniqueid']]['lastevent']=_0xb745('0x25');utils[_0xb745('0x3')](util[_0xb745('0x4')](_0xb745('0x26'),_0x2eafc4[_0xb745('0x6')],_0x2eafc4[_0xb745('0xb')],dials[_0x2eafc4['uniqueid']]['answertime']));}else{utils[_0xb745('0x3')](util[_0xb745('0x4')](_0xb745('0x27'),_0x2eafc4[_0xb745('0x6')],_0x2eafc4['dialstatus']));}}}catch(_0x256eb7){utils[_0xb745('0x1c')](util[_0xb745('0x4')](_0xb745('0x28'),_0x2eafc4[_0xb745('0x6')]),_0x256eb7);}};exports[_0xb745('0x29')]=function(_0xce5f24){try{if(!_[_0xb745('0x17')](dials[_0xce5f24[_0xb745('0x6')]])){utils[_0xb745('0xe')](util['format'](_0xb745('0x2a'),_0xce5f24[_0xb745('0x6')]),_0xce5f24);utils[_0xb745('0x3')](util[_0xb745('0x4')](_0xb745('0x2b'),_0xce5f24[_0xb745('0x6')],_0xce5f24[_0xb745('0x9')],_0xce5f24[_0xb745('0x2c')],_0xce5f24[_0xb745('0x2d')]));dials[_0xce5f24['uniqueid']]=_[_0xb745('0x20')](dials[_0xce5f24[_0xb745('0x6')]],{'endtime':utils[_0xb745('0x22')](),'lastevent':_0xb745('0x2e')});dials[_0xce5f24['uniqueid']][_0xb745('0x2f')]=utils[_0xb745('0x30')](dials[_0xce5f24[_0xb745('0x6')]][_0xb745('0x31')],dials[_0xce5f24[_0xb745('0x6')]][_0xb745('0x21')]);dials[_0xce5f24[_0xb745('0x6')]][_0xb745('0x32')]=utils[_0xb745('0x30')](dials[_0xce5f24[_0xb745('0x6')]]['answertime']||dials[_0xce5f24[_0xb745('0x6')]][_0xb745('0x31')],dials[_0xce5f24[_0xb745('0x6')]][_0xb745('0x21')]);dials[_0xce5f24[_0xb745('0x6')]][_0xb745('0x33')]=dials[_0xce5f24[_0xb745('0x6')]][_0xb745('0x24')]?utils[_0xb745('0x30')](dials[_0xce5f24[_0xb745('0x6')]][_0xb745('0x31')],dials[_0xce5f24['uniqueid']][_0xb745('0x24')]):0x0;writeDB(dials[_0xce5f24[_0xb745('0x6')]]);}}catch(_0x255696){utils['error'](util[_0xb745('0x4')](_0xb745('0x2a'),_0xce5f24[_0xb745('0x6')]),_0x255696);}}; \ No newline at end of file +var _0x04c2=['lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','ANSWER','assign','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','duration','endtime','holdtime','diffTime','[%s][dials][hangup]'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x04c2,0x93));var _0x204c=function(_0x439cd5,_0x95e7cb){_0x439cd5=_0x439cd5-0x0;var _0xdaaa9=_0x04c2[_0x439cd5];return _0xdaaa9;};'use strict';var _=require(_0x204c('0x0'));var util=require('util');var utils=require(_0x204c('0x1'));var dials={};function writeDB(_0x2027ef){utils[_0x204c('0x2')](util[_0x204c('0x3')](_0x204c('0x4'),_0x2027ef[_0x204c('0x5')],_0x2027ef[_0x204c('0x6')],_0x2027ef[_0x204c('0x7')],_0x2027ef['calleridnum'],_0x2027ef[_0x204c('0x8')],_0x2027ef[_0x204c('0x9')]));utils[_0x204c('0xa')](_0x204c('0xb'),_0x2027ef);delete dials[_0x2027ef['uniqueid']];}exports['newexten']=function(_0xaecf67){try{utils[_0x204c('0xc')](util['format']('[%s][dials][newexten]',_0xaecf67[_0x204c('0x5')]),_0xaecf67);utils[_0x204c('0x2')](util[_0x204c('0x3')](_0x204c('0xd'),_0xaecf67[_0x204c('0x5')],_0xaecf67[_0x204c('0xe')],_0xaecf67[_0x204c('0xf')]));if(_0xaecf67[_0x204c('0xe')][_0x204c('0x10')]()==_0x204c('0x11')&&_[_0x204c('0x12')](_0xaecf67[_0x204c('0xf')][_0x204c('0x10')](),_0x204c('0x13'))){var _0x3ea7b7=_0xaecf67['appdata'][_0x204c('0x14')]('=');dials[_0xaecf67[_0x204c('0x5')]]={'routeId':_0x3ea7b7[0x1]};}}catch(_0x43dadf){utils[_0x204c('0x15')](util['format'](_0x204c('0x16'),_0xaecf67[_0x204c('0x5')]),_0x43dadf);}};exports[_0x204c('0x17')]=function(_0x43a0e0){try{utils[_0x204c('0xc')](util[_0x204c('0x3')](_0x204c('0x18'),_0x43a0e0[_0x204c('0x5')]),_0x43a0e0);if(!_[_0x204c('0x19')](_0x43a0e0[_0x204c('0x1a')][_0x204c('0x1b')])){utils['info'](util[_0x204c('0x3')](_0x204c('0x1c'),_0x43a0e0['uniqueid'],_0x43a0e0['value']));dials[_0x43a0e0['uniqueid']]={'routeId':_0x43a0e0['value']};}}catch(_0x1c5b12){utils[_0x204c('0x15')](util[_0x204c('0x3')](_0x204c('0x18'),_0x43a0e0[_0x204c('0x5')]),_0x1c5b12);}};exports['dialbegin']=function(_0x35b649){try{if(!_[_0x204c('0x19')](dials[_0x35b649[_0x204c('0x5')]])){utils[_0x204c('0xc')](util[_0x204c('0x3')](_0x204c('0x1d'),_0x35b649['uniqueid']),_0x35b649);dials[_0x35b649[_0x204c('0x5')]]=_['assign'](dials[_0x35b649[_0x204c('0x5')]],_0x35b649);dials[_0x35b649[_0x204c('0x5')]]['starttime']=utils[_0x204c('0x1e')]();dials[_0x35b649[_0x204c('0x5')]][_0x204c('0x1f')]=_0x204c('0x20');utils[_0x204c('0x2')](util['format'](_0x204c('0x21'),_0x35b649['uniqueid'],dials[_0x35b649[_0x204c('0x5')]][_0x204c('0x22')]));}}catch(_0x16aeab){utils['error'](util[_0x204c('0x3')]('[%s][dials][dialbegin]',_0x35b649[_0x204c('0x5')]),_0x16aeab);}};exports[_0x204c('0x23')]=function(_0x50e852){try{if(!_[_0x204c('0x19')](dials[_0x50e852[_0x204c('0x5')]])){utils[_0x204c('0xc')](util['format']('[%s][dials][dialend]',_0x50e852[_0x204c('0x5')]),_0x50e852);dials[_0x50e852[_0x204c('0x5')]][_0x204c('0x9')]=_0x50e852[_0x204c('0x9')];if(_0x50e852[_0x204c('0x9')]==_0x204c('0x24')){dials[_0x50e852['uniqueid']]=_[_0x204c('0x25')](dials[_0x50e852[_0x204c('0x5')]],_0x50e852);dials[_0x50e852[_0x204c('0x5')]][_0x204c('0x26')]=utils[_0x204c('0x1e')]();dials[_0x50e852[_0x204c('0x5')]][_0x204c('0x1f')]='connect';utils[_0x204c('0x2')](util[_0x204c('0x3')](_0x204c('0x27'),_0x50e852[_0x204c('0x5')],_0x50e852[_0x204c('0x9')],dials[_0x50e852[_0x204c('0x5')]][_0x204c('0x26')]));}else{utils['info'](util[_0x204c('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x50e852[_0x204c('0x5')],_0x50e852[_0x204c('0x9')]));}}}catch(_0x457a02){utils[_0x204c('0x15')](util[_0x204c('0x3')](_0x204c('0x28'),_0x50e852[_0x204c('0x5')]),_0x457a02);}};exports[_0x204c('0x29')]=function(_0x21b84d){try{if(!_[_0x204c('0x19')](dials[_0x21b84d[_0x204c('0x5')]])){utils[_0x204c('0xc')](util['format']('[%s][dials][hangup]',_0x21b84d['uniqueid']),_0x21b84d);utils['info'](util[_0x204c('0x3')](_0x204c('0x2a'),_0x21b84d[_0x204c('0x5')],_0x21b84d['calleridnum'],_0x21b84d['calleridname'],_0x21b84d[_0x204c('0x2b')]));dials[_0x21b84d[_0x204c('0x5')]]=_[_0x204c('0x25')](dials[_0x21b84d[_0x204c('0x5')]],{'endtime':utils[_0x204c('0x1e')](),'lastevent':'complete'});dials[_0x21b84d[_0x204c('0x5')]][_0x204c('0x2c')]=utils['diffTime'](dials[_0x21b84d[_0x204c('0x5')]][_0x204c('0x2d')],dials[_0x21b84d[_0x204c('0x5')]][_0x204c('0x22')]);dials[_0x21b84d[_0x204c('0x5')]][_0x204c('0x2e')]=utils[_0x204c('0x2f')](dials[_0x21b84d[_0x204c('0x5')]]['answertime']||dials[_0x21b84d[_0x204c('0x5')]][_0x204c('0x2d')],dials[_0x21b84d[_0x204c('0x5')]]['starttime']);dials[_0x21b84d[_0x204c('0x5')]]['billableseconds']=dials[_0x21b84d[_0x204c('0x5')]][_0x204c('0x26')]?utils[_0x204c('0x2f')](dials[_0x21b84d[_0x204c('0x5')]][_0x204c('0x2d')],dials[_0x21b84d[_0x204c('0x5')]][_0x204c('0x26')]):0x0;writeDB(dials[_0x21b84d[_0x204c('0x5')]]);}}catch(_0x186397){utils[_0x204c('0x15')](util['format'](_0x204c('0x30'),_0x21b84d[_0x204c('0x5')]),_0x186397);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 2f80077..259673e 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 _0x54d4=['[%s][index][newexten]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','production','local','asterisk','port','password','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','newexten'];(function(_0x270075,_0x142657){var _0x24a211=function(_0x47af03){while(--_0x47af03){_0x270075['push'](_0x270075['shift']());}};_0x24a211(++_0x142657);}(_0x54d4,0x113));var _0x454d=function(_0x2c7746,_0x345816){_0x2c7746=_0x2c7746-0x0;var _0x56a80c=_0x54d4[_0x2c7746];return _0x56a80c;};var AsteriskManager=require(_0x454d('0x0'));var config=require(_0x454d('0x1'));var utils=require('./utils');var util=require(_0x454d('0x2'));var isXDREnabled=config['xdr']&&config[_0x454d('0x3')][_0x454d('0x4')]?!config[_0x454d('0x3')][_0x454d('0x4')]:!![];var isProduction=config['env']===_0x454d('0x5')||![];var isLocalAsterisk=config[_0x454d('0x3')]&&config['xdr'][_0x454d('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x454d('0x7')][_0x454d('0x8')],config['asterisk']['ip'],config[_0x454d('0x7')]['username'],config[_0x454d('0x7')][_0x454d('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x454d('0xa')](_0x454d('0xb'));}else{var agents=require(_0x454d('0xc'));var calls=require(_0x454d('0xd'));var queues=require(_0x454d('0xe'));var recordings=require('./recordings.controller');var members=require(_0x454d('0xf'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x454d('0x10'));ami['on']('connect',core[_0x454d('0x11')]);ami['on'](_0x454d('0x12'),core['shutdown']);ami['on'](_0x454d('0x13'),core['fullybooted']);ami['on'](_0x454d('0x14'),core[_0x454d('0x14')]);ami['on'](_0x454d('0x15'),core[_0x454d('0x15')]);ami['on'](_0x454d('0x16'),core['managerevent']);ami['on'](_0x454d('0x17'),function(_0x1bf026){try{utils['debug'](util[_0x454d('0x18')](_0x454d('0x19'),_0x1bf026[_0x454d('0x1a')]),_0x1bf026);members['devicestatechange'](_0x1bf026);}catch(_0x1538c0){utils[_0x454d('0x14')](util[_0x454d('0x18')](_0x454d('0x19'),_0x1bf026[_0x454d('0x1a')]),_0x1538c0);}});ami['on']('agentcalled',function(_0x90af8a){try{utils[_0x454d('0x1b')](util[_0x454d('0x18')](_0x454d('0x1c'),_0x90af8a[_0x454d('0x1d')]),_0x90af8a);agents[_0x454d('0x1e')](_0x90af8a);}catch(_0x2e4d07){utils['error'](util[_0x454d('0x18')](_0x454d('0x1c'),_0x90af8a[_0x454d('0x1d')]),_0x2e4d07);}});ami['on'](_0x454d('0x1f'),function(_0x4878c4){try{utils[_0x454d('0x1b')](util[_0x454d('0x18')](_0x454d('0x20'),_0x4878c4[_0x454d('0x1d')]),_0x4878c4);agents[_0x454d('0x1f')](_0x4878c4);}catch(_0x2aa3b1){utils[_0x454d('0x14')](util[_0x454d('0x18')](_0x454d('0x20'),_0x4878c4[_0x454d('0x1d')]),_0x2aa3b1);}});ami['on'](_0x454d('0x21'),function(_0x1edc7a){try{utils['debug'](util[_0x454d('0x18')](_0x454d('0x22'),_0x1edc7a[_0x454d('0x1d')]),_0x1edc7a);agents[_0x454d('0x21')](_0x1edc7a);queues['agentconnect'](_0x1edc7a);}catch(_0xf3743b){utils['error'](util[_0x454d('0x18')](_0x454d('0x22'),_0x1edc7a[_0x454d('0x1d')]),_0xf3743b);}});ami['on'](_0x454d('0x23'),function(_0x14a5ea){try{utils[_0x454d('0x1b')](util[_0x454d('0x18')](_0x454d('0x24'),_0x14a5ea['uniqueid']),_0x14a5ea);agents[_0x454d('0x23')](_0x14a5ea);queues['agentcomplete'](_0x14a5ea);members[_0x454d('0x23')](_0x14a5ea);}catch(_0x483b31){utils[_0x454d('0x14')](util['format'](_0x454d('0x24'),_0x14a5ea['uniqueid']),_0x483b31);}});ami['on'](_0x454d('0x25'),function(_0x482941){try{utils[_0x454d('0x1b')](util['format'](_0x454d('0x26'),_0x482941[_0x454d('0x1d')]),_0x482941);agents[_0x454d('0x25')](_0x482941);queues['queuecallerabandon'](_0x482941);}catch(_0x3eee2f){utils['error'](util[_0x454d('0x18')](_0x454d('0x26'),_0x482941['uniqueid']),_0x3eee2f);}});ami['on'](_0x454d('0x27'),function(_0x14fa2b){try{utils[_0x454d('0x1b')](util['format'](_0x454d('0x28'),_0x14fa2b['uniqueid']),_0x14fa2b);queues[_0x454d('0x27')](_0x14fa2b);recordings[_0x454d('0x27')](_0x14fa2b);}catch(_0x326c07){utils[_0x454d('0x14')](util[_0x454d('0x18')](_0x454d('0x28'),_0x14fa2b[_0x454d('0x1d')]),_0x326c07);}});ami['on'](_0x454d('0x29'),function(_0xd4e40f){try{utils['debug'](util[_0x454d('0x18')]('[%s][index][queuecallerleave]',_0xd4e40f[_0x454d('0x1d')]),_0xd4e40f);queues['queuecallerleave'](_0xd4e40f);}catch(_0x238d5d){utils[_0x454d('0x14')](util[_0x454d('0x18')]('[%s][index][queuecallerleave]',_0xd4e40f[_0x454d('0x1d')]),_0x238d5d);}});ami['on'](_0x454d('0x2a'),function(_0x481459){try{utils[_0x454d('0x1b')](util['format'](_0x454d('0x2b'),_0x481459[_0x454d('0x1d')]),_0x481459);queues[_0x454d('0x2a')](_0x481459);calls[_0x454d('0x2a')](_0x481459);}catch(_0xd9e98){utils[_0x454d('0x14')](util[_0x454d('0x18')](_0x454d('0x2b'),_0x481459['uniqueid']),_0xd9e98);}});ami['on'](_0x454d('0x2c'),function(_0x1ead5e){try{utils[_0x454d('0x1b')](util['format'](_0x454d('0x2d'),_0x1ead5e[_0x454d('0x1d')]),_0x1ead5e);queues[_0x454d('0x2c')](_0x1ead5e);calls[_0x454d('0x2c')](_0x1ead5e);}catch(_0x28a38b){utils[_0x454d('0x14')](util['format'](_0x454d('0x2d'),_0x1ead5e['uniqueid']),_0x28a38b);}});ami['on'](_0x454d('0x2e'),function(_0xd56888){try{utils[_0x454d('0x1b')](util[_0x454d('0x18')]('[%s][index][newstate]',_0xd56888[_0x454d('0x1d')]),_0xd56888);calls[_0x454d('0x2e')](_0xd56888);recordings[_0x454d('0x2e')](_0xd56888);}catch(_0x36f4c4){utils[_0x454d('0x14')](util[_0x454d('0x18')](_0x454d('0x2f'),_0xd56888[_0x454d('0x1d')]),_0x36f4c4);}});ami['on'](_0x454d('0x30'),function(_0x4397ad){try{utils[_0x454d('0x1b')](util[_0x454d('0x18')]('[%s][index][hangup]',_0x4397ad[_0x454d('0x1d')]),_0x4397ad);calls[_0x454d('0x30')](_0x4397ad);recordings[_0x454d('0x30')](_0x4397ad);dials[_0x454d('0x30')](_0x4397ad);agents['hangup'](_0x4397ad);queues[_0x454d('0x30')](_0x4397ad);}catch(_0x1cf7ef){utils[_0x454d('0x14')](util[_0x454d('0x18')](_0x454d('0x31'),_0x4397ad[_0x454d('0x1d')]),_0x1cf7ef);}});ami['on']('cdr',function(_0x45985d){try{utils[_0x454d('0x1b')](util[_0x454d('0x18')](_0x454d('0x32'),_0x45985d['uniqueid']),_0x45985d);members[_0x454d('0x33')](_0x45985d);}catch(_0x4ca35e){utils[_0x454d('0x14')](util[_0x454d('0x18')](_0x454d('0x32'),_0x45985d[_0x454d('0x1d')]),_0x4ca35e);}});ami['on']('blindtransfer',function(_0x57b001){try{utils['debug'](util[_0x454d('0x18')](_0x454d('0x34'),_0x57b001[_0x454d('0x1d')]),_0x57b001);queues['blindtransfer'](_0x57b001);agents['blindtransfer'](_0x57b001);transfers[_0x454d('0x35')](_0x57b001);}catch(_0x568266){utils[_0x454d('0x14')](util[_0x454d('0x18')]('[%s][index][blindtransfer]',_0x57b001[_0x454d('0x1d')]),_0x568266);}});ami['on'](_0x454d('0x36'),function(_0x39513d){try{utils[_0x454d('0x1b')](util[_0x454d('0x18')]('[%s][index][attendedtransfer]',_0x39513d[_0x454d('0x37')]),_0x39513d);queues['attendedtransfer'](_0x39513d);transfers[_0x454d('0x36')](_0x39513d);agents[_0x454d('0x36')](_0x39513d);calls[_0x454d('0x36')](_0x39513d);}catch(_0x442c56){utils['error'](util['format'](_0x454d('0x38'),_0x39513d['origtransfereruniqueid']),_0x442c56);}});ami['on']('varset',function(_0x1d8297){try{utils[_0x454d('0x1b')](util[_0x454d('0x18')](_0x454d('0x39'),_0x1d8297[_0x454d('0x1d')]),_0x1d8297);queues[_0x454d('0x3a')](_0x1d8297);recordings['varset'](_0x1d8297);calls['varset'](_0x1d8297);dials['varset'](_0x1d8297);}catch(_0x5b1efb){utils['error'](util[_0x454d('0x18')](_0x454d('0x39'),_0x1d8297[_0x454d('0x1d')]),_0x5b1efb);}});ami['on'](_0x454d('0x3b'),function(_0x110199){try{utils['debug'](util[_0x454d('0x18')](_0x454d('0x3c'),_0x110199[_0x454d('0x1d')]),_0x110199);calls['newexten'](_0x110199);recordings['newexten'](_0x110199);dials['newexten'](_0x110199);}catch(_0x40ab9e){utils[_0x454d('0x14')](util[_0x454d('0x18')]('[%s][index][newexten]',_0x110199[_0x454d('0x1d')]),_0x40ab9e);}});ami['on'](_0x454d('0x3d'),function(_0x393665){try{utils['debug'](util[_0x454d('0x18')]('[%s][index][newchannel]',_0x393665['uniqueid']),_0x393665);calls[_0x454d('0x3d')](_0x393665);recordings[_0x454d('0x3d')](_0x393665);}catch(_0x1c49ae){utils[_0x454d('0x14')](util['format']('[%s][index][newchannel]',_0x393665[_0x454d('0x1d')]),_0x1c49ae);}});ami['on'](_0x454d('0x3e'),function(_0x234dea){try{utils[_0x454d('0x1b')](util[_0x454d('0x18')](_0x454d('0x3f'),_0x234dea[_0x454d('0x1d')]),_0x234dea);dials['dialbegin'](_0x234dea);}catch(_0x26f893){utils[_0x454d('0x14')](util['format'](_0x454d('0x40'),_0x234dea[_0x454d('0x1d')]),_0x26f893);}});ami['on'](_0x454d('0x41'),function(_0x205147){try{utils[_0x454d('0x1b')](util[_0x454d('0x18')](_0x454d('0x42'),_0x205147['uniqueid']),_0x205147);dials[_0x454d('0x41')](_0x205147);}catch(_0x93083){utils['error'](util[_0x454d('0x18')](_0x454d('0x42'),_0x205147[_0x454d('0x1d')]),_0x93083);}});} \ No newline at end of file +var _0x6c76=['agentcomplete','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','production','local','asterisk','username','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]'];(function(_0x4c8284,_0x2e05ac){var _0x290cd3=function(_0x1f5134){while(--_0x1f5134){_0x4c8284['push'](_0x4c8284['shift']());}};_0x290cd3(++_0x2e05ac);}(_0x6c76,0xe6));var _0x66c7=function(_0x508642,_0x2faacd){_0x508642=_0x508642-0x0;var _0x1dd29c=_0x6c76[_0x508642];return _0x1dd29c;};var AsteriskManager=require(_0x66c7('0x0'));var config=require(_0x66c7('0x1'));var utils=require('./utils');var util=require(_0x66c7('0x2'));var isXDREnabled=config[_0x66c7('0x3')]&&config[_0x66c7('0x3')][_0x66c7('0x4')]?!config[_0x66c7('0x3')][_0x66c7('0x4')]:!![];var isProduction=config[_0x66c7('0x5')]===_0x66c7('0x6')||![];var isLocalAsterisk=config[_0x66c7('0x3')]&&config['xdr'][_0x66c7('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x66c7('0x8')]['port'],config[_0x66c7('0x8')]['ip'],config[_0x66c7('0x8')][_0x66c7('0x9')],config[_0x66c7('0x8')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x66c7('0xa')](_0x66c7('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x66c7('0xa')](_0x66c7('0xc'));}else{var agents=require(_0x66c7('0xd'));var calls=require(_0x66c7('0xe'));var queues=require(_0x66c7('0xf'));var recordings=require(_0x66c7('0x10'));var members=require('./members.controller');var dials=require(_0x66c7('0x11'));var transfers=require(_0x66c7('0x12'));var core=require('./core.controller');ami['on'](_0x66c7('0x13'),core[_0x66c7('0x13')]);ami['on'](_0x66c7('0x14'),core[_0x66c7('0x14')]);ami['on'](_0x66c7('0x15'),core['fullybooted']);ami['on'](_0x66c7('0x16'),core[_0x66c7('0x16')]);ami['on'](_0x66c7('0x17'),core[_0x66c7('0x17')]);ami['on'](_0x66c7('0x18'),core[_0x66c7('0x18')]);ami['on'](_0x66c7('0x19'),function(_0x13ce69){try{utils[_0x66c7('0x1a')](util['format'](_0x66c7('0x1b'),_0x13ce69[_0x66c7('0x1c')]),_0x13ce69);members[_0x66c7('0x19')](_0x13ce69);}catch(_0x28aa0c){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')](_0x66c7('0x1b'),_0x13ce69[_0x66c7('0x1c')]),_0x28aa0c);}});ami['on'](_0x66c7('0x1e'),function(_0x4a8675){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')](_0x66c7('0x1f'),_0x4a8675[_0x66c7('0x20')]),_0x4a8675);agents['agentcalled'](_0x4a8675);}catch(_0x1d69ec){utils[_0x66c7('0x16')](util['format'](_0x66c7('0x1f'),_0x4a8675['uniqueid']),_0x1d69ec);}});ami['on'](_0x66c7('0x21'),function(_0x1582f6){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')]('[%s][index][agentringnoanswer]',_0x1582f6[_0x66c7('0x20')]),_0x1582f6);agents[_0x66c7('0x21')](_0x1582f6);}catch(_0x48ceeb){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')](_0x66c7('0x22'),_0x1582f6['uniqueid']),_0x48ceeb);}});ami['on'](_0x66c7('0x23'),function(_0x498cc6){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')](_0x66c7('0x24'),_0x498cc6[_0x66c7('0x20')]),_0x498cc6);agents[_0x66c7('0x23')](_0x498cc6);queues['agentconnect'](_0x498cc6);}catch(_0x499b72){utils['error'](util['format'](_0x66c7('0x24'),_0x498cc6[_0x66c7('0x20')]),_0x499b72);}});ami['on']('agentcomplete',function(_0x597bab){try{utils[_0x66c7('0x1a')](util['format'](_0x66c7('0x25'),_0x597bab[_0x66c7('0x20')]),_0x597bab);agents[_0x66c7('0x26')](_0x597bab);queues[_0x66c7('0x26')](_0x597bab);members[_0x66c7('0x26')](_0x597bab);}catch(_0x13212e){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')]('[%s][index][agentcomplete]',_0x597bab[_0x66c7('0x20')]),_0x13212e);}});ami['on'](_0x66c7('0x27'),function(_0x30dd55){try{utils[_0x66c7('0x1a')](util['format']('[%s][index][queuecallerabandon]',_0x30dd55[_0x66c7('0x20')]),_0x30dd55);agents[_0x66c7('0x27')](_0x30dd55);queues[_0x66c7('0x27')](_0x30dd55);}catch(_0x1f3932){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')]('[%s][index][queuecallerabandon]',_0x30dd55[_0x66c7('0x20')]),_0x1f3932);}});ami['on'](_0x66c7('0x28'),function(_0x3c65ff){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')](_0x66c7('0x29'),_0x3c65ff[_0x66c7('0x20')]),_0x3c65ff);queues['queuecallerjoin'](_0x3c65ff);recordings[_0x66c7('0x28')](_0x3c65ff);}catch(_0x47e618){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')](_0x66c7('0x29'),_0x3c65ff[_0x66c7('0x20')]),_0x47e618);}});ami['on'](_0x66c7('0x2a'),function(_0x1db853){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')](_0x66c7('0x2b'),_0x1db853[_0x66c7('0x20')]),_0x1db853);queues[_0x66c7('0x2a')](_0x1db853);}catch(_0x2c171b){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')](_0x66c7('0x2b'),_0x1db853[_0x66c7('0x20')]),_0x2c171b);}});ami['on']('musiconholdstart',function(_0x487dc7){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')](_0x66c7('0x2c'),_0x487dc7[_0x66c7('0x20')]),_0x487dc7);queues[_0x66c7('0x2d')](_0x487dc7);calls[_0x66c7('0x2d')](_0x487dc7);}catch(_0x1de930){utils[_0x66c7('0x16')](util['format'](_0x66c7('0x2c'),_0x487dc7[_0x66c7('0x20')]),_0x1de930);}});ami['on'](_0x66c7('0x2e'),function(_0x136ae1){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')](_0x66c7('0x2f'),_0x136ae1[_0x66c7('0x20')]),_0x136ae1);queues[_0x66c7('0x2e')](_0x136ae1);calls[_0x66c7('0x2e')](_0x136ae1);}catch(_0x4d82ea){utils[_0x66c7('0x16')](util['format'](_0x66c7('0x2f'),_0x136ae1[_0x66c7('0x20')]),_0x4d82ea);}});ami['on'](_0x66c7('0x30'),function(_0x5f2efb){try{utils[_0x66c7('0x1a')](util['format'](_0x66c7('0x31'),_0x5f2efb[_0x66c7('0x20')]),_0x5f2efb);calls[_0x66c7('0x30')](_0x5f2efb);recordings[_0x66c7('0x30')](_0x5f2efb);}catch(_0x2d01a6){utils[_0x66c7('0x16')](util['format'](_0x66c7('0x31'),_0x5f2efb['uniqueid']),_0x2d01a6);}});ami['on'](_0x66c7('0x32'),function(_0x21596d){try{utils['debug'](util[_0x66c7('0x1d')]('[%s][index][hangup]',_0x21596d['uniqueid']),_0x21596d);calls[_0x66c7('0x32')](_0x21596d);recordings['hangup'](_0x21596d);dials[_0x66c7('0x32')](_0x21596d);agents['hangup'](_0x21596d);queues['hangup'](_0x21596d);}catch(_0x7a0412){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')]('[%s][index][hangup]',_0x21596d[_0x66c7('0x20')]),_0x7a0412);}});ami['on'](_0x66c7('0x33'),function(_0x41da03){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')](_0x66c7('0x34'),_0x41da03[_0x66c7('0x20')]),_0x41da03);members[_0x66c7('0x33')](_0x41da03);}catch(_0x245d28){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')]('[%s][index][cdr]',_0x41da03['uniqueid']),_0x245d28);}});ami['on']('blindtransfer',function(_0x232ced){try{utils['debug'](util[_0x66c7('0x1d')]('[%s][index][blindtransfer]',_0x232ced[_0x66c7('0x20')]),_0x232ced);queues['blindtransfer'](_0x232ced);agents[_0x66c7('0x35')](_0x232ced);transfers[_0x66c7('0x35')](_0x232ced);}catch(_0x4a15e2){utils['error'](util[_0x66c7('0x1d')]('[%s][index][blindtransfer]',_0x232ced['uniqueid']),_0x4a15e2);}});ami['on'](_0x66c7('0x36'),function(_0xcd8ba6){try{utils[_0x66c7('0x1a')](util['format']('[%s][index][attendedtransfer]',_0xcd8ba6[_0x66c7('0x37')]),_0xcd8ba6);queues[_0x66c7('0x36')](_0xcd8ba6);transfers[_0x66c7('0x36')](_0xcd8ba6);agents[_0x66c7('0x36')](_0xcd8ba6);calls['attendedtransfer'](_0xcd8ba6);}catch(_0xf6c299){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')](_0x66c7('0x38'),_0xcd8ba6[_0x66c7('0x37')]),_0xf6c299);}});ami['on'](_0x66c7('0x39'),function(_0x201cf3){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')]('[%s][index][varset]',_0x201cf3[_0x66c7('0x20')]),_0x201cf3);queues[_0x66c7('0x39')](_0x201cf3);recordings[_0x66c7('0x39')](_0x201cf3);calls['varset'](_0x201cf3);dials[_0x66c7('0x39')](_0x201cf3);}catch(_0x52acbd){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')]('[%s][index][varset]',_0x201cf3[_0x66c7('0x20')]),_0x52acbd);}});ami['on'](_0x66c7('0x3a'),function(_0x322ad6){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')](_0x66c7('0x3b'),_0x322ad6['uniqueid']),_0x322ad6);calls['newexten'](_0x322ad6);recordings[_0x66c7('0x3a')](_0x322ad6);dials[_0x66c7('0x3a')](_0x322ad6);}catch(_0x427599){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')](_0x66c7('0x3b'),_0x322ad6['uniqueid']),_0x427599);}});ami['on']('newchannel',function(_0x4d02b1){try{utils['debug'](util[_0x66c7('0x1d')](_0x66c7('0x3c'),_0x4d02b1[_0x66c7('0x20')]),_0x4d02b1);calls['newchannel'](_0x4d02b1);recordings[_0x66c7('0x3d')](_0x4d02b1);}catch(_0x12b344){utils[_0x66c7('0x16')](util['format'](_0x66c7('0x3c'),_0x4d02b1[_0x66c7('0x20')]),_0x12b344);}});ami['on'](_0x66c7('0x3e'),function(_0x3beec6){try{utils[_0x66c7('0x1a')](util[_0x66c7('0x1d')](_0x66c7('0x3f'),_0x3beec6['uniqueid']),_0x3beec6);dials['dialbegin'](_0x3beec6);}catch(_0x4723a2){utils['error'](util[_0x66c7('0x1d')](_0x66c7('0x40'),_0x3beec6['uniqueid']),_0x4723a2);}});ami['on'](_0x66c7('0x41'),function(_0x3ab44c){try{utils['debug'](util['format'](_0x66c7('0x42'),_0x3ab44c['uniqueid']),_0x3ab44c);dials['dialend'](_0x3ab44c);}catch(_0xc119f8){utils[_0x66c7('0x16')](util[_0x66c7('0x1d')](_0x66c7('0x42'),_0x3ab44c[_0x66c7('0x20')]),_0xc119f8);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index e16af67..042f31e 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 _0x5c73=['internal','request','split','CreateMemberReport','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','debug','[%s][members][cdr]','assign','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','interface','getUserByInterface','then','name'];(function(_0xb7a4e5,_0x42cc80){var _0x18a0e8=function(_0x547392){while(--_0x547392){_0xb7a4e5['push'](_0xb7a4e5['shift']());}};_0x18a0e8(++_0x42cc80);}(_0x5c73,0x135));var _0x35c7=function(_0x43bf72,_0x4923d7){_0x43bf72=_0x43bf72-0x0;var _0x289929=_0x5c73[_0x43bf72];return _0x289929;};'use strict';var _=require(_0x35c7('0x0'));var util=require('util');var utils=require(_0x35c7('0x1'));var members={};var exclude=[_0x35c7('0x2'),_0x35c7('0x3')];function writeDB(_0x1e7e7e){utils[_0x35c7('0x4')](util[_0x35c7('0x5')](_0x35c7('0x6'),_0x1e7e7e['uniqueid'],_0x1e7e7e['interface'],_0x1e7e7e[_0x35c7('0x7')],_0x1e7e7e[_0x35c7('0x8')],_0x1e7e7e[_0x35c7('0x9')],_0x1e7e7e[_0x35c7('0xa')]));if(_0x1e7e7e[_0x35c7('0xb')]){utils[_0x35c7('0xc')](_0x1e7e7e['interface'])[_0x35c7('0xd')](function(_0x1ac275){if(_0x1ac275){_0x1e7e7e[_0x35c7('0x9')]=_0x1ac275[_0x35c7('0xe')];_0x1e7e7e[_0x35c7('0xf')]=_0x1ac275[_0x35c7('0xf')];utils[_0x35c7('0x10')]('CreateMemberReport',_0x1e7e7e);}else{utils['getUserByName'](_0x1e7e7e['interface'][_0x35c7('0x11')]('/')[0x1])[_0x35c7('0xd')](function(_0x58debe){if(_0x58debe){_0x1e7e7e[_0x35c7('0x9')]=_0x58debe[_0x35c7('0xe')];_0x1e7e7e[_0x35c7('0xf')]=_0x58debe[_0x35c7('0xf')];utils[_0x35c7('0x10')](_0x35c7('0x12'),_0x1e7e7e);}});}})['catch'](function(_0x68280d){utils[_0x35c7('0x13')](util[_0x35c7('0x5')](_0x35c7('0x14'),_0x1e7e7e[_0x35c7('0x15')]),_0x68280d);});}delete members[_0x1e7e7e[_0x35c7('0xb')]];}function startsWith(_0x1cbd8f,_0x33e088){return _[_0x35c7('0x16')](_0x1cbd8f,function(_0x1daf31){return _[_0x35c7('0x17')](_0x33e088,_0x1daf31);});}exports[_0x35c7('0x18')]=function(_0x5b086b){try{utils['debug'](util[_0x35c7('0x5')](_0x35c7('0x19'),members[_0x5b086b['device']]?members[_0x5b086b[_0x35c7('0x1a')]]['uniqueid']:_0x5b086b['device']),_0x5b086b);utils[_0x35c7('0x4')](util['format'](_0x35c7('0x1b'),members[_0x5b086b[_0x35c7('0x1a')]]?members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x15')]:_0x5b086b['device'],_0x5b086b[_0x35c7('0x1c')],_0x5b086b['device']));switch(_0x5b086b['state']){case _0x35c7('0x1d'):case _0x35c7('0x1e'):if(!startsWith(exclude,_0x5b086b['device'])){members[_0x5b086b[_0x35c7('0x1a')]]={'channel':_0x35c7('0x1f'),'interface':_0x5b086b[_0x35c7('0x1a')],'type':_0x35c7('0x20'),'enterAt':utils['now'](),'role':_0x35c7('0x21')};}break;case _0x35c7('0x22'):if(!_['isNil'](members[_0x5b086b[_0x35c7('0x1a')]])){members[_0x5b086b['device']][_0x35c7('0x23')]=utils['now']();members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x24')]=utils[_0x35c7('0x25')](members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x23')],members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x26')]);if(members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x15')]){writeDB(members[_0x5b086b[_0x35c7('0x1a')]]);}}break;default:break;}}catch(_0x449194){utils['error'](util[_0x35c7('0x5')](_0x35c7('0x19'),members[_0x5b086b[_0x35c7('0x1a')]]?members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x15')]:_0x5b086b['device']),_0x449194);}};exports[_0x35c7('0x27')]=function(_0x3179ad){try{if(!_[_0x35c7('0x28')](members[_0x3179ad[_0x35c7('0xb')]])){utils['debug'](util[_0x35c7('0x5')](_0x35c7('0x29'),_0x3179ad['uniqueid']),_0x3179ad);utils[_0x35c7('0x4')](util[_0x35c7('0x5')](_0x35c7('0x2a'),_0x3179ad['uniqueid'],_0x3179ad[_0x35c7('0xb')],_0x3179ad[_0x35c7('0x2b')]));members[_0x3179ad[_0x35c7('0xb')]]=_['assign'](members[_0x3179ad['interface']],{'data4':_0x3179ad[_0x35c7('0x2b')],'uniqueid':_0x3179ad[_0x35c7('0x15')]});}}catch(_0x16ef65){utils[_0x35c7('0x13')](util[_0x35c7('0x5')]('[%s][members][agentcomplete]',_0x3179ad['uniqueid']),_0x16ef65);}};exports[_0x35c7('0x2c')]=function(_0x4e96c5){try{utils[_0x35c7('0x2d')](util[_0x35c7('0x5')](_0x35c7('0x2e'),_0x4e96c5[_0x35c7('0x15')]),_0x4e96c5);if(_0x4e96c5[_0x35c7('0x7')]){var _0x5ede31=_0x4e96c5[_0x35c7('0x7')][_0x35c7('0x11')]('-')[0x0];if(!_['isNil'](members[_0x5ede31])){members[_0x5ede31]=_[_0x35c7('0x2f')](members[_0x5ede31],{'data1':members[_0x5ede31][_0x35c7('0x30')]||_0x4e96c5['type'],'data2':members[_0x5ede31]['data2']||_0x4e96c5['source'],'data3':members[_0x5ede31][_0x35c7('0x31')]||_0x4e96c5[_0x35c7('0x32')],'uniqueid':members[_0x5ede31][_0x35c7('0x15')]||_0x4e96c5[_0x35c7('0x15')]});utils[_0x35c7('0x4')](util[_0x35c7('0x5')](_0x35c7('0x33'),_0x4e96c5[_0x35c7('0x15')],members[_0x5ede31][_0x35c7('0x30')],members[_0x5ede31][_0x35c7('0x8')],members[_0x5ede31]['data3']));if(members[_0x5ede31]['exitAt']){writeDB(members[_0x5ede31]);}}}if(_0x4e96c5[_0x35c7('0x34')]){var _0x38afdc=_0x4e96c5['destinationchannel']['split']('-')[0x0];if(!_['isNil'](members[_0x38afdc])){members[_0x38afdc]=_[_0x35c7('0x2f')](members[_0x38afdc],{'data1':members[_0x38afdc][_0x35c7('0x30')]||_0x4e96c5[_0x35c7('0xa')],'data2':members[_0x38afdc][_0x35c7('0x8')]||_0x4e96c5[_0x35c7('0x35')],'data3':members[_0x38afdc][_0x35c7('0x31')]||_0x4e96c5[_0x35c7('0x32')],'uniqueid':members[_0x38afdc][_0x35c7('0x15')]||_0x4e96c5[_0x35c7('0x15')]});utils[_0x35c7('0x4')](util[_0x35c7('0x5')](_0x35c7('0x33'),_0x4e96c5[_0x35c7('0x15')],members[_0x38afdc][_0x35c7('0x30')],members[_0x38afdc][_0x35c7('0x8')],members[_0x38afdc][_0x35c7('0x31')]));if(members[_0x38afdc][_0x35c7('0x23')]){writeDB(members[_0x38afdc]);}}}}catch(_0x17556b){utils[_0x35c7('0x13')](util[_0x35c7('0x5')]('[%s][members][cdr]',_0x4e96c5[_0x35c7('0x15')]),_0x17556b);}}; \ No newline at end of file +var _0x67c7=['util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','source','lodash'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x67c7,0x172));var _0x767c=function(_0x1d606e,_0x438c6a){_0x1d606e=_0x1d606e-0x0;var _0x528543=_0x67c7[_0x1d606e];return _0x528543;};'use strict';var _=require(_0x767c('0x0'));var util=require(_0x767c('0x1'));var utils=require(_0x767c('0x2'));var members={};var exclude=[_0x767c('0x3'),_0x767c('0x4')];function writeDB(_0xc110cb){utils[_0x767c('0x5')](util[_0x767c('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0xc110cb[_0x767c('0x7')],_0xc110cb[_0x767c('0x8')],_0xc110cb['channel'],_0xc110cb[_0x767c('0x9')],_0xc110cb[_0x767c('0xa')],_0xc110cb[_0x767c('0xb')]));if(_0xc110cb[_0x767c('0x8')]){utils[_0x767c('0xc')](_0xc110cb[_0x767c('0x8')])[_0x767c('0xd')](function(_0x160a10){if(_0x160a10){_0xc110cb[_0x767c('0xa')]=_0x160a10[_0x767c('0xe')];_0xc110cb[_0x767c('0xf')]=_0x160a10[_0x767c('0xf')];utils[_0x767c('0x10')](_0x767c('0x11'),_0xc110cb);}else{utils[_0x767c('0x12')](_0xc110cb['interface'][_0x767c('0x13')]('/')[0x1])[_0x767c('0xd')](function(_0x3264b6){if(_0x3264b6){_0xc110cb[_0x767c('0xa')]=_0x3264b6[_0x767c('0xe')];_0xc110cb[_0x767c('0xf')]=_0x3264b6[_0x767c('0xf')];utils[_0x767c('0x10')](_0x767c('0x11'),_0xc110cb);}});}})['catch'](function(_0x5380da){utils[_0x767c('0x14')](util[_0x767c('0x6')](_0x767c('0x15'),_0xc110cb[_0x767c('0x7')]),_0x5380da);});}delete members[_0xc110cb[_0x767c('0x8')]];}function startsWith(_0xcccac7,_0x25d59e){return _[_0x767c('0x16')](_0xcccac7,function(_0x5e3b44){return _[_0x767c('0x17')](_0x25d59e,_0x5e3b44);});}exports[_0x767c('0x18')]=function(_0x3e4927){try{utils[_0x767c('0x19')](util[_0x767c('0x6')](_0x767c('0x1a'),members[_0x3e4927['device']]?members[_0x3e4927[_0x767c('0x1b')]]['uniqueid']:_0x3e4927[_0x767c('0x1b')]),_0x3e4927);utils[_0x767c('0x5')](util[_0x767c('0x6')](_0x767c('0x1c'),members[_0x3e4927[_0x767c('0x1b')]]?members[_0x3e4927[_0x767c('0x1b')]][_0x767c('0x7')]:_0x3e4927['device'],_0x3e4927[_0x767c('0x1d')],_0x3e4927[_0x767c('0x1b')]));switch(_0x3e4927['state']){case _0x767c('0x1e'):case _0x767c('0x1f'):if(!startsWith(exclude,_0x3e4927[_0x767c('0x1b')])){members[_0x3e4927[_0x767c('0x1b')]]={'channel':'voice','interface':_0x3e4927[_0x767c('0x1b')],'type':_0x767c('0x20'),'enterAt':utils[_0x767c('0x21')](),'role':_0x767c('0x22')};}break;case _0x767c('0x23'):if(!_[_0x767c('0x24')](members[_0x3e4927[_0x767c('0x1b')]])){members[_0x3e4927[_0x767c('0x1b')]][_0x767c('0x25')]=utils[_0x767c('0x21')]();members[_0x3e4927[_0x767c('0x1b')]][_0x767c('0x26')]=utils[_0x767c('0x27')](members[_0x3e4927[_0x767c('0x1b')]][_0x767c('0x25')],members[_0x3e4927[_0x767c('0x1b')]]['enterAt']);if(members[_0x3e4927['device']][_0x767c('0x7')]){writeDB(members[_0x3e4927[_0x767c('0x1b')]]);}}break;default:break;}}catch(_0x12fbbb){utils[_0x767c('0x14')](util[_0x767c('0x6')]('[%s][members][devicestatechange]',members[_0x3e4927[_0x767c('0x1b')]]?members[_0x3e4927[_0x767c('0x1b')]][_0x767c('0x7')]:_0x3e4927[_0x767c('0x1b')]),_0x12fbbb);}};exports[_0x767c('0x28')]=function(_0x2fb0bd){try{if(!_[_0x767c('0x24')](members[_0x2fb0bd[_0x767c('0x8')]])){utils[_0x767c('0x19')](util[_0x767c('0x6')](_0x767c('0x29'),_0x2fb0bd['uniqueid']),_0x2fb0bd);utils[_0x767c('0x5')](util[_0x767c('0x6')](_0x767c('0x2a'),_0x2fb0bd[_0x767c('0x7')],_0x2fb0bd['interface'],_0x2fb0bd[_0x767c('0x2b')]));members[_0x2fb0bd[_0x767c('0x8')]]=_[_0x767c('0x2c')](members[_0x2fb0bd[_0x767c('0x8')]],{'data4':_0x2fb0bd[_0x767c('0x2b')],'uniqueid':_0x2fb0bd[_0x767c('0x7')]});}}catch(_0x181bd0){utils[_0x767c('0x14')](util[_0x767c('0x6')]('[%s][members][agentcomplete]',_0x2fb0bd[_0x767c('0x7')]),_0x181bd0);}};exports[_0x767c('0x2d')]=function(_0xba57aa){try{utils['debug'](util[_0x767c('0x6')](_0x767c('0x2e'),_0xba57aa['uniqueid']),_0xba57aa);if(_0xba57aa[_0x767c('0x2f')]){var _0x412b0b=_0xba57aa[_0x767c('0x2f')][_0x767c('0x13')]('-')[0x0];if(!_[_0x767c('0x24')](members[_0x412b0b])){members[_0x412b0b]=_[_0x767c('0x2c')](members[_0x412b0b],{'data1':members[_0x412b0b][_0x767c('0x30')]||_0xba57aa[_0x767c('0xb')],'data2':members[_0x412b0b][_0x767c('0x9')]||_0xba57aa['source'],'data3':members[_0x412b0b][_0x767c('0x31')]||_0xba57aa[_0x767c('0x32')],'uniqueid':members[_0x412b0b][_0x767c('0x7')]||_0xba57aa[_0x767c('0x7')]});utils['info'](util[_0x767c('0x6')](_0x767c('0x33'),_0xba57aa[_0x767c('0x7')],members[_0x412b0b][_0x767c('0x30')],members[_0x412b0b]['data2'],members[_0x412b0b]['data3']));if(members[_0x412b0b]['exitAt']){writeDB(members[_0x412b0b]);}}}if(_0xba57aa['destinationchannel']){var _0x47a7d4=_0xba57aa['destinationchannel'][_0x767c('0x13')]('-')[0x0];if(!_[_0x767c('0x24')](members[_0x47a7d4])){members[_0x47a7d4]=_[_0x767c('0x2c')](members[_0x47a7d4],{'data1':members[_0x47a7d4][_0x767c('0x30')]||_0xba57aa[_0x767c('0xb')],'data2':members[_0x47a7d4][_0x767c('0x9')]||_0xba57aa[_0x767c('0x34')],'data3':members[_0x47a7d4][_0x767c('0x31')]||_0xba57aa[_0x767c('0x32')],'uniqueid':members[_0x47a7d4][_0x767c('0x7')]||_0xba57aa[_0x767c('0x7')]});utils['info'](util[_0x767c('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xba57aa[_0x767c('0x7')],members[_0x47a7d4][_0x767c('0x30')],members[_0x47a7d4][_0x767c('0x9')],members[_0x47a7d4][_0x767c('0x31')]));if(members[_0x47a7d4][_0x767c('0x25')]){writeDB(members[_0x47a7d4]);}}}}catch(_0x57a84d){utils['error'](util[_0x767c('0x6')](_0x767c('0x2e'),_0xba57aa['uniqueid']),_0x57a84d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 653e901..def1776 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 _0x2931=['assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerleave','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%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','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','mohtime','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','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2931,0x1f3));var _0x1293=function(_0x1e252a,_0x357cd0){_0x1e252a=_0x1e252a-0x0;var _0x1a31c3=_0x2931[_0x1e252a];return _0x1a31c3;};'use strict';var _=require(_0x1293('0x0'));var util=require(_0x1293('0x1'));var utils=require(_0x1293('0x2'));var queues={};function writeDB(_0x3508ff){utils[_0x1293('0x3')](util[_0x1293('0x4')](_0x1293('0x5'),_0x3508ff['uniqueid'],_0x3508ff['channel'],_0x3508ff[_0x1293('0x6')],_0x3508ff[_0x1293('0x7')],_0x3508ff[_0x1293('0x8')],_0x3508ff[_0x1293('0x9')],_0x3508ff['queuecallerexitreason']));if(_0x3508ff[_0x1293('0x6')]){utils[_0x1293('0xa')](_0x3508ff[_0x1293('0x6')])[_0x1293('0xb')](function(_0x1820f3){if(_0x1820f3){_0x3508ff[_0x1293('0xc')]=_0x1820f3[_0x1293('0xc')];}utils[_0x1293('0xd')](_0x1293('0xe'),_0x3508ff);});}else{utils[_0x1293('0xd')](_0x1293('0xe'),_0x3508ff);}if(_0x3508ff[_0x1293('0xf')]){delete queues[_0x3508ff[_0x1293('0xf')]];}else{delete queues[_0x3508ff['uniqueid']];}}exports[_0x1293('0x10')]=function(_0x50995e){try{utils['debug'](util['format'](_0x1293('0x11'),_0x50995e[_0x1293('0x12')]),_0x50995e);utils[_0x1293('0x3')](util[_0x1293('0x4')](_0x1293('0x13'),_0x50995e[_0x1293('0x12')],_0x50995e['queue'],_0x50995e[_0x1293('0x14')]));queues[_0x50995e[_0x1293('0x12')]]=_[_0x1293('0x15')](_0x50995e,{'originalposition':_0x50995e[_0x1293('0x14')],'queuecallerjoinAt':utils[_0x1293('0x16')](),'mohtime':0x0});}catch(_0x25aa60){utils[_0x1293('0x17')](util[_0x1293('0x4')](_0x1293('0x11'),_0x50995e[_0x1293('0x12')]),_0x25aa60);}};exports[_0x1293('0x18')]=function(_0x53b2cf){try{if(!_[_0x1293('0x19')](queues[_0x53b2cf[_0x1293('0x12')]])){utils[_0x1293('0x1a')](util[_0x1293('0x4')](_0x1293('0x1b'),_0x53b2cf[_0x1293('0x12')]),_0x53b2cf);if(queues[_0x53b2cf[_0x1293('0x12')]]['queuecallerleaveAt']){if(!queues[_0x53b2cf[_0x1293('0x12')]][_0x1293('0x1c')]&&!queues[_0x53b2cf[_0x1293('0x12')]][_0x1293('0x1d')]){queues[_0x53b2cf[_0x1293('0x12')]][_0x1293('0x1e')]=!![];queues[_0x53b2cf[_0x1293('0x12')]]['queuecallercompleteAt']=utils[_0x1293('0x16')]();queues[_0x53b2cf['uniqueid']][_0x1293('0x1f')]='COMPLETEDBYAGENT';}utils[_0x1293('0x3')](util[_0x1293('0x4')](_0x1293('0x20'),_0x53b2cf[_0x1293('0x12')],queues[_0x53b2cf[_0x1293('0x12')]][_0x1293('0x21')],queues[_0x53b2cf[_0x1293('0x12')]]['queuecallerexitreason']));writeDB(queues[_0x53b2cf[_0x1293('0x12')]]);}else if(queues[_0x53b2cf[_0x1293('0x12')]][_0x1293('0xf')]){utils[_0x1293('0x3')](util['format'](_0x1293('0x22'),_0x53b2cf['uniqueid'],queues[_0x53b2cf[_0x1293('0x12')]][_0x1293('0x21')],queues[_0x53b2cf[_0x1293('0x12')]][_0x1293('0xf')]));queues[queues[_0x53b2cf[_0x1293('0x12')]][_0x1293('0xf')]]=queues[_0x53b2cf['uniqueid']];queues[queues[_0x53b2cf[_0x1293('0x12')]]['transfereduniqueid']][_0x1293('0x23')]=0x2;delete queues[_0x53b2cf[_0x1293('0x12')]];}}}catch(_0x2373d9){utils[_0x1293('0x17')](util[_0x1293('0x4')]('[%s][queues][hangup]',_0x53b2cf['uniqueid']),_0x2373d9);}};exports[_0x1293('0x24')]=function(_0x56732b){try{utils['debug'](util['format']('[%s][queues][varset]',_0x56732b[_0x1293('0x12')]),_0x56732b);if(!_['isNil'](_0x56732b[_0x1293('0x25')][_0x1293('0x26')])&&_0x56732b['value'][_0x1293('0x27')]()!==_0x1293('0x28')){if(!_[_0x1293('0x19')](queues[_0x56732b[_0x1293('0x12')]])){queues[_0x56732b[_0x1293('0x12')]][_0x1293('0x1c')]=![];queues[_0x56732b['uniqueid']][_0x1293('0x29')]=null;queues[_0x56732b[_0x1293('0x12')]][_0x1293('0x1d')]=!![];queues[_0x56732b[_0x1293('0x12')]][_0x1293('0x2a')]=utils[_0x1293('0x16')]();queues[_0x56732b[_0x1293('0x12')]]['queuecallerexitreason']=_0x56732b['value'][_0x1293('0x27')]();utils[_0x1293('0x3')](util[_0x1293('0x4')](_0x1293('0x2b'),_0x56732b['uniqueid'],queues[_0x56732b['uniqueid']][_0x1293('0x21')],_0x56732b[_0x1293('0x2c')],queues[_0x56732b[_0x1293('0x12')]][_0x1293('0x1f')]));writeDB(queues[_0x56732b[_0x1293('0x12')]]);}}else if(!_[_0x1293('0x19')](_0x56732b[_0x1293('0x25')]['queueposition'])){if(!_[_0x1293('0x19')](queues[_0x56732b[_0x1293('0x12')]])&&!queues[_0x56732b[_0x1293('0x12')]][_0x1293('0x1c')]){queues[_0x56732b[_0x1293('0x12')]]['queuecallerabandon']=![];queues[_0x56732b[_0x1293('0x12')]][_0x1293('0x29')]=null;queues[_0x56732b[_0x1293('0x12')]][_0x1293('0x1d')]=!![];queues[_0x56732b[_0x1293('0x12')]]['queuecallerexitAt']=utils['now']();queues[_0x56732b[_0x1293('0x12')]][_0x1293('0x1f')]='EXITWITHKEY';utils[_0x1293('0x3')](util[_0x1293('0x4')](_0x1293('0x2d'),_0x56732b[_0x1293('0x12')],queues[_0x56732b[_0x1293('0x12')]][_0x1293('0x21')],_0x56732b[_0x1293('0x2c')],queues[_0x56732b['uniqueid']][_0x1293('0x1f')]));}}}catch(_0xd752f5){utils['error'](util[_0x1293('0x4')](_0x1293('0x2e'),_0x56732b[_0x1293('0x12')]),_0xd752f5);}};exports[_0x1293('0x1c')]=function(_0x393aab){try{if(!_[_0x1293('0x19')](queues[_0x393aab[_0x1293('0x12')]])){utils[_0x1293('0x1a')](util['format'](_0x1293('0x2f'),_0x393aab[_0x1293('0x12')]),_0x393aab);queues[_0x393aab[_0x1293('0x12')]][_0x1293('0x1d')]=![];queues[_0x393aab[_0x1293('0x12')]][_0x1293('0x2a')]=null;queues[_0x393aab[_0x1293('0x12')]][_0x1293('0x1c')]=!![];queues[_0x393aab[_0x1293('0x12')]][_0x1293('0x29')]=utils[_0x1293('0x16')]();queues[_0x393aab[_0x1293('0x12')]][_0x1293('0x1f')]='ABANDONED';utils[_0x1293('0x3')](util[_0x1293('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x393aab[_0x1293('0x12')],queues[_0x393aab['uniqueid']]['name'],queues[_0x393aab[_0x1293('0x12')]][_0x1293('0x1f')]));}}catch(_0x2607b1){utils['error'](util[_0x1293('0x4')](_0x1293('0x2f'),_0x393aab[_0x1293('0x12')]),_0x2607b1);}};exports[_0x1293('0x30')]=function(_0x127c9e){try{if(!_[_0x1293('0x19')](queues[_0x127c9e[_0x1293('0x12')]])){utils[_0x1293('0x1a')](util[_0x1293('0x4')]('[%s][queues][queuecallerleave]',_0x127c9e['uniqueid']),_0x127c9e);utils[_0x1293('0x3')](util[_0x1293('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x127c9e[_0x1293('0x12')],queues[_0x127c9e['uniqueid']][_0x1293('0x21')],_0x127c9e[_0x1293('0x31')],_0x127c9e[_0x1293('0x32')]));queues[_0x127c9e[_0x1293('0x12')]][_0x1293('0x30')]=!![];queues[_0x127c9e['uniqueid']][_0x1293('0x33')]=utils[_0x1293('0x16')]();queues[_0x127c9e[_0x1293('0x12')]][_0x1293('0x34')]=utils['diffTime'](queues[_0x127c9e[_0x1293('0x12')]]['queuecallerleaveAt'],queues[_0x127c9e[_0x1293('0x12')]][_0x1293('0x35')]);queues[_0x127c9e[_0x1293('0x12')]][_0x1293('0x14')]=_0x127c9e[_0x1293('0x14')];queues[_0x127c9e['uniqueid']][_0x1293('0x36')]=_0x127c9e['count'];queues[_0x127c9e[_0x1293('0x12')]]['connectedlinenum']=_0x127c9e[_0x1293('0x31')];queues[_0x127c9e[_0x1293('0x12')]]['connectedlinename']=_0x127c9e[_0x1293('0x32')];}}catch(_0x4f47cf){utils[_0x1293('0x17')](util[_0x1293('0x4')](_0x1293('0x37'),_0x127c9e['uniqueid']),_0x4f47cf);}};exports[_0x1293('0x38')]=function(_0x5b903b){try{if(!_['isNil'](queues[_0x5b903b[_0x1293('0x12')]])){utils[_0x1293('0x1a')](util[_0x1293('0x4')]('[%s][queues][agentconnect]',_0x5b903b[_0x1293('0x12')]),_0x5b903b);utils[_0x1293('0x3')](util[_0x1293('0x4')](_0x1293('0x39'),_0x5b903b[_0x1293('0x12')],queues[_0x5b903b[_0x1293('0x12')]][_0x1293('0x21')],_0x5b903b[_0x1293('0x3a')],_0x5b903b[_0x1293('0x3b')]));queues[_0x5b903b[_0x1293('0x12')]]['queuecallerabandon']=![];queues[_0x5b903b[_0x1293('0x12')]]['queuecallerabandon']=![];queues[_0x5b903b[_0x1293('0x12')]][_0x1293('0x29')]=null;queues[_0x5b903b[_0x1293('0x12')]]['queuecallerexit']=![];queues[_0x5b903b[_0x1293('0x12')]][_0x1293('0x1f')]=null;queues[_0x5b903b[_0x1293('0x12')]][_0x1293('0x2a')]=null;queues[_0x5b903b[_0x1293('0x12')]]['assigned']=!![];queues[_0x5b903b['uniqueid']][_0x1293('0x9')]=_0x5b903b[_0x1293('0x3b')];queues[_0x5b903b[_0x1293('0x12')]][_0x1293('0x7')]=_0x5b903b['membername'];}}catch(_0x11ae60){utils['error'](util[_0x1293('0x4')]('[%s][queues][agentconnect]',_0x5b903b['uniqueid']),_0x11ae60);}};exports[_0x1293('0x3c')]=function(_0x550b9f){try{if(!_[_0x1293('0x19')](queues[_0x550b9f['uniqueid']])){if(queues[_0x550b9f[_0x1293('0x12')]]['queuecallerleaveAt']){utils[_0x1293('0x1a')](util[_0x1293('0x4')](_0x1293('0x3d'),_0x550b9f['uniqueid']),_0x550b9f);queues[_0x550b9f[_0x1293('0x12')]][_0x1293('0x1c')]=![];queues[_0x550b9f[_0x1293('0x12')]][_0x1293('0x1c')]=![];queues[_0x550b9f['uniqueid']][_0x1293('0x29')]=null;queues[_0x550b9f['uniqueid']][_0x1293('0x1d')]=![];queues[_0x550b9f['uniqueid']]['queuecallerexitAt']=null;queues[_0x550b9f['uniqueid']][_0x1293('0x3e')]=!![];queues[_0x550b9f[_0x1293('0x12')]]['lastAssignedTo']=_0x550b9f[_0x1293('0x3a')];queues[_0x550b9f[_0x1293('0x12')]]['queuecallercomplete']=!![];queues[_0x550b9f['uniqueid']][_0x1293('0x3f')]=utils[_0x1293('0x16')]();if(_0x550b9f[_0x1293('0x40')]==_0x1293('0x41')){if(!queues[_0x550b9f[_0x1293('0x12')]]['transfer']){queues[_0x550b9f['uniqueid']][_0x1293('0x1f')]=_0x1293('0x42');}}else{queues[_0x550b9f[_0x1293('0x12')]]['queuecallerexitreason']=_0x1293('0x43')+_0x550b9f[_0x1293('0x40')]['toUpperCase']();}utils['info'](util['format'](_0x1293('0x44'),_0x550b9f[_0x1293('0x12')],queues[_0x550b9f['uniqueid']][_0x1293('0x21')],_0x550b9f[_0x1293('0x3a')],queues[_0x550b9f[_0x1293('0x12')]][_0x1293('0x1f')]));writeDB(queues[_0x550b9f[_0x1293('0x12')]]);}}}catch(_0x218dd7){utils['error'](util['format']('[%s][queues][agentcomplete]',_0x550b9f[_0x1293('0x12')]),_0x218dd7);}};exports['blindtransfer']=function(_0x1611a0){try{if(!_[_0x1293('0x19')](queues[_0x1611a0[_0x1293('0x45')]])){utils[_0x1293('0x1a')](util[_0x1293('0x4')]('[%s][queues][blindtransfer]',_0x1611a0[_0x1293('0x12')]),_0x1611a0);queues[_0x1611a0[_0x1293('0x45')]][_0x1293('0x41')]=!![];queues[_0x1611a0[_0x1293('0x45')]][_0x1293('0x46')]=_0x1293('0x47');queues[_0x1611a0[_0x1293('0x45')]]['transferexten']=_0x1611a0[_0x1293('0x48')];queues[_0x1611a0['transfereeuniqueid']]['transferuniqueid']=_0x1611a0[_0x1293('0x45')];queues[_0x1611a0['transfereeuniqueid']][_0x1293('0x1f')]='BLINDTRANSFER';utils['info'](util[_0x1293('0x4')](_0x1293('0x49'),_0x1611a0[_0x1293('0x12')],queues[_0x1611a0[_0x1293('0x45')]][_0x1293('0x21')],_0x1611a0[_0x1293('0x45')],_0x1611a0[_0x1293('0x48')]));}}catch(_0x388ecd){utils[_0x1293('0x17')](util['format'](_0x1293('0x4a'),_0x1611a0[_0x1293('0x12')]),_0x388ecd);}};exports['attendedtransfer']=function(_0xfce22){try{utils[_0x1293('0x1a')](util[_0x1293('0x4')](_0x1293('0x4b'),_0xfce22[_0x1293('0x4c')]),_0xfce22);if(_0xfce22['origtransfereruniqueid']==_0xfce22[_0x1293('0x4d')]){if(!_[_0x1293('0x19')](queues[_0xfce22[_0x1293('0x4e')]])){utils[_0x1293('0x3')](util['format'](_0x1293('0x4f'),_0xfce22[_0x1293('0x4c')],queues[_0xfce22[_0x1293('0x4e')]][_0x1293('0x21')],_0xfce22[_0x1293('0x50')]));queues[_0xfce22[_0x1293('0x4e')]][_0x1293('0x41')]=!![];queues[_0xfce22[_0x1293('0x4e')]][_0x1293('0x46')]=_0x1293('0x51');queues[_0xfce22[_0x1293('0x4e')]][_0x1293('0x52')]=_0xfce22[_0x1293('0x50')];queues[_0xfce22[_0x1293('0x4e')]][_0x1293('0x53')]=_0xfce22['origtransfereruniqueid'];queues[_0xfce22[_0x1293('0x4e')]][_0x1293('0x1f')]=_0x1293('0x54');}if(!_[_0x1293('0x19')](queues[_0xfce22[_0x1293('0x4d')]])){if(_0xfce22[_0x1293('0x55')]&&queues[_0xfce22[_0x1293('0x55')]]){queues[_0xfce22['transfereelinkedid']][_0x1293('0x23')]=0x1;queues[_0xfce22[_0x1293('0x45')]]=_[_0x1293('0x56')](queues[_0xfce22[_0x1293('0x55')]]);queues[_0xfce22[_0x1293('0x45')]][_0x1293('0xf')]=_0xfce22[_0x1293('0x57')];queues[_0xfce22[_0x1293('0x45')]][_0x1293('0x23')]=0x2;queues[_0xfce22[_0x1293('0x45')]][_0x1293('0x8')]=queues[_0xfce22[_0x1293('0x4e')]][_0x1293('0x8')];queues[_0xfce22['transfereeuniqueid']][_0x1293('0x58')]=queues[_0xfce22[_0x1293('0x4e')]][_0x1293('0x58')];queues[_0xfce22[_0x1293('0x45')]][_0x1293('0x35')]=utils[_0x1293('0x16')]();queues[_0xfce22[_0x1293('0x45')]]['queuecallerleaveAt']=utils[_0x1293('0x16')]();queues[_0xfce22[_0x1293('0x45')]][_0x1293('0x34')]=0x0;queues[_0xfce22[_0x1293('0x45')]]['mohtime']=0x0;utils['info'](util[_0x1293('0x4')](_0x1293('0x59'),_0xfce22[_0x1293('0x4c')],queues[_0xfce22['transfereeuniqueid']][_0x1293('0x21')],queues[_0xfce22['transfereeuniqueid']]['calleridnum'],queues[_0xfce22[_0x1293('0x45')]][_0x1293('0x58')]));}else{utils[_0x1293('0x3')](util[_0x1293('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xfce22[_0x1293('0x4c')],queues[_0xfce22[_0x1293('0x4d')]]['name'],_0xfce22['secondtransfererlinkedid']));queues[_0xfce22[_0x1293('0x4d')]][_0x1293('0xf')]=_0xfce22[_0x1293('0x4e')];}}}else if(_0xfce22[_0x1293('0x5a')]==_0xfce22[_0x1293('0x4e')]){if(!_['isNil'](queues[_0xfce22[_0x1293('0x4d')]])){utils[_0x1293('0x3')](util['format'](_0x1293('0x5b'),_0xfce22[_0x1293('0x4c')],queues[_0xfce22[_0x1293('0x4d')]][_0x1293('0x21')],_0xfce22[_0x1293('0x5a')],_0xfce22[_0x1293('0x5c')]));queues[_0xfce22[_0x1293('0x4d')]][_0x1293('0x41')]=!![];queues[_0xfce22[_0x1293('0x4d')]]['transfertype']='ATTENDED';queues[_0xfce22['origtransfererlinkedid']][_0x1293('0x52')]=_0xfce22[_0x1293('0x5c')];queues[_0xfce22[_0x1293('0x4d')]][_0x1293('0x53')]=_0xfce22[_0x1293('0x5a')];queues[_0xfce22[_0x1293('0x4d')]][_0x1293('0x1f')]=_0x1293('0x54');}if(!_[_0x1293('0x19')](queues[_0xfce22[_0x1293('0x4e')]])){if(_0xfce22['transfertargetlinkedid']&&queues[_0xfce22[_0x1293('0x5d')]]){queues[_0xfce22[_0x1293('0x5d')]][_0x1293('0x23')]=0x1;queues[_0xfce22[_0x1293('0x57')]]=_[_0x1293('0x56')](queues[_0xfce22[_0x1293('0x5d')]]);queues[_0xfce22['transfertargetuniqueid']][_0x1293('0xf')]=_0xfce22[_0x1293('0x57')];queues[_0xfce22[_0x1293('0x57')]][_0x1293('0x23')]=0x2;queues[_0xfce22['transfertargetuniqueid']][_0x1293('0x8')]=queues[_0xfce22[_0x1293('0x4d')]][_0x1293('0x8')];queues[_0xfce22[_0x1293('0x57')]][_0x1293('0x58')]=queues[_0xfce22[_0x1293('0x4d')]]['calleridname'];queues[_0xfce22['transfertargetuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0xfce22[_0x1293('0x57')]][_0x1293('0x33')]=utils['now']();queues[_0xfce22[_0x1293('0x57')]][_0x1293('0x34')]=0x0;queues[_0xfce22[_0x1293('0x57')]]['mohtime']=0x0;utils[_0x1293('0x3')](util[_0x1293('0x4')](_0x1293('0x5e'),_0xfce22[_0x1293('0x4c')],queues[_0xfce22['transfertargetuniqueid']][_0x1293('0x21')],queues[_0xfce22[_0x1293('0x57')]][_0x1293('0xf')],queues[_0xfce22[_0x1293('0x57')]]['calleridnum'],queues[_0xfce22[_0x1293('0x57')]][_0x1293('0x58')]));}else{utils[_0x1293('0x3')](util[_0x1293('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xfce22[_0x1293('0x4c')],queues[_0xfce22[_0x1293('0x4e')]][_0x1293('0x21')],_0xfce22[_0x1293('0x4d')]));queues[_0xfce22['secondtransfererlinkedid']][_0x1293('0xf')]=_0xfce22['origtransfererlinkedid'];}}}}catch(_0xae6450){utils[_0x1293('0x17')](util[_0x1293('0x4')](_0x1293('0x4b'),_0xfce22['origtransfereruniqueid']),_0xae6450);}};exports[_0x1293('0x5f')]=function(_0x1a0bb9){try{if(!_[_0x1293('0x19')](queues[_0x1a0bb9[_0x1293('0x12')]])){utils[_0x1293('0x1a')](util[_0x1293('0x4')](_0x1293('0x60'),_0x1a0bb9['uniqueid']),_0x1a0bb9);queues[_0x1a0bb9[_0x1293('0x12')]][_0x1293('0x61')]=utils[_0x1293('0x16')]();utils[_0x1293('0x3')](util[_0x1293('0x4')](_0x1293('0x62'),_0x1a0bb9['uniqueid'],queues[_0x1a0bb9['uniqueid']]['name'],queues[_0x1a0bb9[_0x1293('0x12')]][_0x1293('0x61')]));}}catch(_0x424f3c){utils[_0x1293('0x17')](util[_0x1293('0x4')](_0x1293('0x60'),_0x1a0bb9[_0x1293('0x12')]),_0x424f3c);}};exports[_0x1293('0x63')]=function(_0x1b0e3e){try{if(!_[_0x1293('0x19')](queues[_0x1b0e3e[_0x1293('0x12')]])){if(!_[_0x1293('0x19')](queues[_0x1b0e3e[_0x1293('0x12')]][_0x1293('0x61')])){utils[_0x1293('0x1a')](util[_0x1293('0x4')]('[%s][queues][musiconholdstop]',_0x1b0e3e[_0x1293('0x12')]),_0x1b0e3e);queues[_0x1b0e3e['uniqueid']][_0x1293('0x64')]+=utils[_0x1293('0x65')](utils[_0x1293('0x16')](),queues[_0x1b0e3e[_0x1293('0x12')]][_0x1293('0x61')]);utils[_0x1293('0x3')](util[_0x1293('0x4')](_0x1293('0x66'),_0x1b0e3e[_0x1293('0x12')],queues[_0x1b0e3e[_0x1293('0x12')]][_0x1293('0x21')],queues[_0x1b0e3e[_0x1293('0x12')]][_0x1293('0x64')]));delete queues[_0x1b0e3e['uniqueid']][_0x1293('0x61')];}}}catch(_0x2efa66){utils[_0x1293('0x17')](util[_0x1293('0x4')](_0x1293('0x67'),_0x1b0e3e[_0x1293('0x12')]),_0x2efa66);}}; \ No newline at end of file +var _0x0ec1=['[%s][queues][musiconholdstop]','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]'];(function(_0x4d2320,_0x5a8f88){var _0x3b70ff=function(_0x21f61c){while(--_0x21f61c){_0x4d2320['push'](_0x4d2320['shift']());}};_0x3b70ff(++_0x5a8f88);}(_0x0ec1,0x65));var _0x10ec=function(_0x15e34f,_0x248d70){_0x15e34f=_0x15e34f-0x0;var _0x286601=_0x0ec1[_0x15e34f];return _0x286601;};'use strict';var _=require(_0x10ec('0x0'));var util=require('util');var utils=require(_0x10ec('0x1'));var queues={};function writeDB(_0x35b689){utils[_0x10ec('0x2')](util[_0x10ec('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x35b689[_0x10ec('0x4')],_0x35b689[_0x10ec('0x5')],_0x35b689[_0x10ec('0x6')],_0x35b689[_0x10ec('0x7')],_0x35b689[_0x10ec('0x8')],_0x35b689['accountcode'],_0x35b689['queuecallerexitreason']));if(_0x35b689[_0x10ec('0x6')]){utils['getVoiceQueueByName'](_0x35b689['queue'])[_0x10ec('0x9')](function(_0x2dffe8){if(_0x2dffe8){_0x35b689[_0x10ec('0xa')]=_0x2dffe8['type'];}utils[_0x10ec('0xb')]('CreateVoiceQueueReport',_0x35b689);});}else{utils[_0x10ec('0xb')](_0x10ec('0xc'),_0x35b689);}if(_0x35b689[_0x10ec('0xd')]){delete queues[_0x35b689['transfereduniqueid']];}else{delete queues[_0x35b689[_0x10ec('0x4')]];}}exports[_0x10ec('0xe')]=function(_0xfe550e){try{utils[_0x10ec('0xf')](util[_0x10ec('0x3')](_0x10ec('0x10'),_0xfe550e[_0x10ec('0x4')]),_0xfe550e);utils[_0x10ec('0x2')](util[_0x10ec('0x3')](_0x10ec('0x11'),_0xfe550e[_0x10ec('0x4')],_0xfe550e['queue'],_0xfe550e[_0x10ec('0x12')]));queues[_0xfe550e[_0x10ec('0x4')]]=_[_0x10ec('0x13')](_0xfe550e,{'originalposition':_0xfe550e[_0x10ec('0x12')],'queuecallerjoinAt':utils[_0x10ec('0x14')](),'mohtime':0x0});}catch(_0x5e75dc){utils[_0x10ec('0x15')](util[_0x10ec('0x3')](_0x10ec('0x10'),_0xfe550e['uniqueid']),_0x5e75dc);}};exports[_0x10ec('0x16')]=function(_0x37b47f){try{if(!_[_0x10ec('0x17')](queues[_0x37b47f['uniqueid']])){utils[_0x10ec('0xf')](util[_0x10ec('0x3')](_0x10ec('0x18'),_0x37b47f['uniqueid']),_0x37b47f);if(queues[_0x37b47f['uniqueid']][_0x10ec('0x19')]){if(!queues[_0x37b47f['uniqueid']][_0x10ec('0x1a')]&&!queues[_0x37b47f[_0x10ec('0x4')]]['queuecallerexit']){queues[_0x37b47f[_0x10ec('0x4')]][_0x10ec('0x1b')]=!![];queues[_0x37b47f[_0x10ec('0x4')]][_0x10ec('0x1c')]=utils['now']();queues[_0x37b47f['uniqueid']][_0x10ec('0x1d')]=_0x10ec('0x1e');}utils['info'](util[_0x10ec('0x3')](_0x10ec('0x1f'),_0x37b47f[_0x10ec('0x4')],queues[_0x37b47f[_0x10ec('0x4')]]['name'],queues[_0x37b47f[_0x10ec('0x4')]][_0x10ec('0x1d')]));writeDB(queues[_0x37b47f['uniqueid']]);}else if(queues[_0x37b47f[_0x10ec('0x4')]][_0x10ec('0xd')]){utils[_0x10ec('0x2')](util[_0x10ec('0x3')](_0x10ec('0x20'),_0x37b47f[_0x10ec('0x4')],queues[_0x37b47f['uniqueid']][_0x10ec('0x21')],queues[_0x37b47f[_0x10ec('0x4')]][_0x10ec('0xd')]));queues[queues[_0x37b47f['uniqueid']]['transfereduniqueid']]=queues[_0x37b47f[_0x10ec('0x4')]];queues[queues[_0x37b47f['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x37b47f[_0x10ec('0x4')]];}}}catch(_0x24c2b1){utils[_0x10ec('0x15')](util[_0x10ec('0x3')](_0x10ec('0x18'),_0x37b47f[_0x10ec('0x4')]),_0x24c2b1);}};exports['varset']=function(_0x4309e0){try{utils['debug'](util[_0x10ec('0x3')]('[%s][queues][varset]',_0x4309e0['uniqueid']),_0x4309e0);if(!_['isNil'](_0x4309e0[_0x10ec('0x22')][_0x10ec('0x23')])&&_0x4309e0[_0x10ec('0x24')][_0x10ec('0x25')]()!==_0x10ec('0x26')){if(!_[_0x10ec('0x17')](queues[_0x4309e0[_0x10ec('0x4')]])){queues[_0x4309e0[_0x10ec('0x4')]][_0x10ec('0x1a')]=![];queues[_0x4309e0[_0x10ec('0x4')]][_0x10ec('0x27')]=null;queues[_0x4309e0[_0x10ec('0x4')]][_0x10ec('0x28')]=!![];queues[_0x4309e0[_0x10ec('0x4')]]['queuecallerexitAt']=utils[_0x10ec('0x14')]();queues[_0x4309e0[_0x10ec('0x4')]][_0x10ec('0x1d')]=_0x4309e0[_0x10ec('0x24')]['toUpperCase']();utils[_0x10ec('0x2')](util[_0x10ec('0x3')](_0x10ec('0x29'),_0x4309e0[_0x10ec('0x4')],queues[_0x4309e0[_0x10ec('0x4')]][_0x10ec('0x21')],_0x4309e0[_0x10ec('0x24')],queues[_0x4309e0[_0x10ec('0x4')]][_0x10ec('0x1d')]));writeDB(queues[_0x4309e0[_0x10ec('0x4')]]);}}else if(!_[_0x10ec('0x17')](_0x4309e0['variable'][_0x10ec('0x2a')])){if(!_[_0x10ec('0x17')](queues[_0x4309e0[_0x10ec('0x4')]])&&!queues[_0x4309e0['uniqueid']][_0x10ec('0x1a')]){queues[_0x4309e0[_0x10ec('0x4')]][_0x10ec('0x1a')]=![];queues[_0x4309e0['uniqueid']][_0x10ec('0x27')]=null;queues[_0x4309e0['uniqueid']][_0x10ec('0x28')]=!![];queues[_0x4309e0[_0x10ec('0x4')]][_0x10ec('0x2b')]=utils['now']();queues[_0x4309e0['uniqueid']]['queuecallerexitreason']=_0x10ec('0x2c');utils[_0x10ec('0x2')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4309e0[_0x10ec('0x4')],queues[_0x4309e0[_0x10ec('0x4')]]['name'],_0x4309e0[_0x10ec('0x24')],queues[_0x4309e0[_0x10ec('0x4')]][_0x10ec('0x1d')]));}}}catch(_0xd37810){utils[_0x10ec('0x15')](util[_0x10ec('0x3')]('[%s][queues][varset]',_0x4309e0[_0x10ec('0x4')]),_0xd37810);}};exports[_0x10ec('0x1a')]=function(_0x511730){try{if(!_[_0x10ec('0x17')](queues[_0x511730[_0x10ec('0x4')]])){utils[_0x10ec('0xf')](util[_0x10ec('0x3')](_0x10ec('0x2d'),_0x511730[_0x10ec('0x4')]),_0x511730);queues[_0x511730[_0x10ec('0x4')]][_0x10ec('0x28')]=![];queues[_0x511730['uniqueid']][_0x10ec('0x2b')]=null;queues[_0x511730[_0x10ec('0x4')]][_0x10ec('0x1a')]=!![];queues[_0x511730['uniqueid']][_0x10ec('0x27')]=utils[_0x10ec('0x14')]();queues[_0x511730['uniqueid']][_0x10ec('0x1d')]=_0x10ec('0x2e');utils[_0x10ec('0x2')](util[_0x10ec('0x3')](_0x10ec('0x2f'),_0x511730[_0x10ec('0x4')],queues[_0x511730[_0x10ec('0x4')]][_0x10ec('0x21')],queues[_0x511730[_0x10ec('0x4')]]['queuecallerexitreason']));}}catch(_0x43eb9b){utils[_0x10ec('0x15')](util[_0x10ec('0x3')](_0x10ec('0x2d'),_0x511730[_0x10ec('0x4')]),_0x43eb9b);}};exports[_0x10ec('0x30')]=function(_0x2af665){try{if(!_[_0x10ec('0x17')](queues[_0x2af665[_0x10ec('0x4')]])){utils[_0x10ec('0xf')](util['format'](_0x10ec('0x31'),_0x2af665['uniqueid']),_0x2af665);utils[_0x10ec('0x2')](util[_0x10ec('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2af665[_0x10ec('0x4')],queues[_0x2af665[_0x10ec('0x4')]][_0x10ec('0x21')],_0x2af665[_0x10ec('0x32')],_0x2af665[_0x10ec('0x33')]));queues[_0x2af665[_0x10ec('0x4')]]['queuecallerleave']=!![];queues[_0x2af665[_0x10ec('0x4')]][_0x10ec('0x19')]=utils[_0x10ec('0x14')]();queues[_0x2af665[_0x10ec('0x4')]][_0x10ec('0x34')]=utils[_0x10ec('0x35')](queues[_0x2af665['uniqueid']]['queuecallerleaveAt'],queues[_0x2af665['uniqueid']][_0x10ec('0x36')]);queues[_0x2af665[_0x10ec('0x4')]][_0x10ec('0x12')]=_0x2af665[_0x10ec('0x12')];queues[_0x2af665[_0x10ec('0x4')]]['count']=_0x2af665[_0x10ec('0x37')];queues[_0x2af665[_0x10ec('0x4')]][_0x10ec('0x32')]=_0x2af665[_0x10ec('0x32')];queues[_0x2af665[_0x10ec('0x4')]][_0x10ec('0x33')]=_0x2af665['connectedlinename'];}}catch(_0xd637ce){utils[_0x10ec('0x15')](util[_0x10ec('0x3')](_0x10ec('0x31'),_0x2af665[_0x10ec('0x4')]),_0xd637ce);}};exports['agentconnect']=function(_0x817543){try{if(!_[_0x10ec('0x17')](queues[_0x817543[_0x10ec('0x4')]])){utils[_0x10ec('0xf')](util[_0x10ec('0x3')]('[%s][queues][agentconnect]',_0x817543[_0x10ec('0x4')]),_0x817543);utils['info'](util[_0x10ec('0x3')](_0x10ec('0x38'),_0x817543['uniqueid'],queues[_0x817543[_0x10ec('0x4')]][_0x10ec('0x21')],_0x817543[_0x10ec('0x39')],_0x817543[_0x10ec('0x3a')]));queues[_0x817543[_0x10ec('0x4')]]['queuecallerabandon']=![];queues[_0x817543['uniqueid']][_0x10ec('0x1a')]=![];queues[_0x817543[_0x10ec('0x4')]][_0x10ec('0x27')]=null;queues[_0x817543[_0x10ec('0x4')]][_0x10ec('0x28')]=![];queues[_0x817543[_0x10ec('0x4')]]['queuecallerexitreason']=null;queues[_0x817543[_0x10ec('0x4')]]['queuecallerexitAt']=null;queues[_0x817543[_0x10ec('0x4')]][_0x10ec('0x3b')]=!![];queues[_0x817543['uniqueid']]['accountcode']=_0x817543[_0x10ec('0x3a')];queues[_0x817543[_0x10ec('0x4')]]['lastAssignedTo']=_0x817543['membername'];}}catch(_0x2f5fa6){utils[_0x10ec('0x15')](util[_0x10ec('0x3')]('[%s][queues][agentconnect]',_0x817543[_0x10ec('0x4')]),_0x2f5fa6);}};exports['agentcomplete']=function(_0x516d55){try{if(!_[_0x10ec('0x17')](queues[_0x516d55[_0x10ec('0x4')]])){if(queues[_0x516d55[_0x10ec('0x4')]][_0x10ec('0x19')]){utils[_0x10ec('0xf')](util[_0x10ec('0x3')](_0x10ec('0x3c'),_0x516d55[_0x10ec('0x4')]),_0x516d55);queues[_0x516d55[_0x10ec('0x4')]]['queuecallerabandon']=![];queues[_0x516d55['uniqueid']][_0x10ec('0x1a')]=![];queues[_0x516d55[_0x10ec('0x4')]]['queuecallerabandonAt']=null;queues[_0x516d55[_0x10ec('0x4')]][_0x10ec('0x28')]=![];queues[_0x516d55[_0x10ec('0x4')]][_0x10ec('0x2b')]=null;queues[_0x516d55[_0x10ec('0x4')]][_0x10ec('0x3b')]=!![];queues[_0x516d55[_0x10ec('0x4')]][_0x10ec('0x7')]=_0x516d55[_0x10ec('0x39')];queues[_0x516d55['uniqueid']]['queuecallercomplete']=!![];queues[_0x516d55[_0x10ec('0x4')]][_0x10ec('0x1c')]=utils[_0x10ec('0x14')]();if(_0x516d55[_0x10ec('0x3d')]==_0x10ec('0x3e')){if(!queues[_0x516d55[_0x10ec('0x4')]][_0x10ec('0x3e')]){queues[_0x516d55[_0x10ec('0x4')]]['queuecallerexitreason']=_0x10ec('0x3f');}}else{queues[_0x516d55[_0x10ec('0x4')]][_0x10ec('0x1d')]='COMPLETEDBY'+_0x516d55[_0x10ec('0x3d')][_0x10ec('0x25')]();}utils[_0x10ec('0x2')](util[_0x10ec('0x3')](_0x10ec('0x40'),_0x516d55[_0x10ec('0x4')],queues[_0x516d55[_0x10ec('0x4')]][_0x10ec('0x21')],_0x516d55['membername'],queues[_0x516d55[_0x10ec('0x4')]][_0x10ec('0x1d')]));writeDB(queues[_0x516d55[_0x10ec('0x4')]]);}}}catch(_0x52398d){utils[_0x10ec('0x15')](util[_0x10ec('0x3')]('[%s][queues][agentcomplete]',_0x516d55[_0x10ec('0x4')]),_0x52398d);}};exports['blindtransfer']=function(_0x448c29){try{if(!_[_0x10ec('0x17')](queues[_0x448c29[_0x10ec('0x41')]])){utils['debug'](util[_0x10ec('0x3')](_0x10ec('0x42'),_0x448c29[_0x10ec('0x4')]),_0x448c29);queues[_0x448c29['transfereeuniqueid']][_0x10ec('0x3e')]=!![];queues[_0x448c29[_0x10ec('0x41')]][_0x10ec('0x43')]=_0x10ec('0x44');queues[_0x448c29[_0x10ec('0x41')]][_0x10ec('0x45')]=_0x448c29['extension'];queues[_0x448c29[_0x10ec('0x41')]]['transferuniqueid']=_0x448c29['transfereeuniqueid'];queues[_0x448c29[_0x10ec('0x41')]][_0x10ec('0x1d')]=_0x10ec('0x46');utils['info'](util[_0x10ec('0x3')](_0x10ec('0x47'),_0x448c29[_0x10ec('0x4')],queues[_0x448c29[_0x10ec('0x41')]][_0x10ec('0x21')],_0x448c29[_0x10ec('0x41')],_0x448c29[_0x10ec('0x48')]));}}catch(_0x43b6a7){utils[_0x10ec('0x15')](util[_0x10ec('0x3')](_0x10ec('0x42'),_0x448c29[_0x10ec('0x4')]),_0x43b6a7);}};exports[_0x10ec('0x49')]=function(_0x350623){try{utils[_0x10ec('0xf')](util['format']('[%s][queues][attendedtransfer]',_0x350623[_0x10ec('0x4a')]),_0x350623);if(_0x350623[_0x10ec('0x4a')]==_0x350623[_0x10ec('0x4b')]){if(!_[_0x10ec('0x17')](queues[_0x350623['secondtransfererlinkedid']])){utils['info'](util[_0x10ec('0x3')](_0x10ec('0x4c'),_0x350623['origtransfereruniqueid'],queues[_0x350623[_0x10ec('0x4d')]][_0x10ec('0x21')],_0x350623[_0x10ec('0x4e')]));queues[_0x350623['secondtransfererlinkedid']][_0x10ec('0x3e')]=!![];queues[_0x350623[_0x10ec('0x4d')]]['transfertype']=_0x10ec('0x4f');queues[_0x350623[_0x10ec('0x4d')]]['transferexten']=_0x350623[_0x10ec('0x4e')];queues[_0x350623['secondtransfererlinkedid']][_0x10ec('0x50')]=_0x350623[_0x10ec('0x4a')];queues[_0x350623[_0x10ec('0x4d')]][_0x10ec('0x1d')]=_0x10ec('0x51');}if(!_[_0x10ec('0x17')](queues[_0x350623[_0x10ec('0x4b')]])){if(_0x350623['transfereelinkedid']&&queues[_0x350623['transfereelinkedid']]){queues[_0x350623[_0x10ec('0x52')]][_0x10ec('0x53')]=0x1;queues[_0x350623[_0x10ec('0x41')]]=_['clone'](queues[_0x350623['transfereelinkedid']]);queues[_0x350623[_0x10ec('0x41')]][_0x10ec('0xd')]=_0x350623[_0x10ec('0x54')];queues[_0x350623[_0x10ec('0x41')]][_0x10ec('0x53')]=0x2;queues[_0x350623[_0x10ec('0x41')]][_0x10ec('0x8')]=queues[_0x350623[_0x10ec('0x4d')]][_0x10ec('0x8')];queues[_0x350623[_0x10ec('0x41')]][_0x10ec('0x55')]=queues[_0x350623[_0x10ec('0x4d')]][_0x10ec('0x55')];queues[_0x350623[_0x10ec('0x41')]]['queuecallerjoinAt']=utils['now']();queues[_0x350623[_0x10ec('0x41')]][_0x10ec('0x19')]=utils[_0x10ec('0x14')]();queues[_0x350623['transfereeuniqueid']]['holdtime']=0x0;queues[_0x350623['transfereeuniqueid']]['mohtime']=0x0;utils[_0x10ec('0x2')](util[_0x10ec('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x350623[_0x10ec('0x4a')],queues[_0x350623[_0x10ec('0x41')]][_0x10ec('0x21')],queues[_0x350623[_0x10ec('0x41')]][_0x10ec('0x8')],queues[_0x350623[_0x10ec('0x41')]]['calleridname']));}else{utils[_0x10ec('0x2')](util[_0x10ec('0x3')](_0x10ec('0x56'),_0x350623[_0x10ec('0x4a')],queues[_0x350623[_0x10ec('0x4b')]][_0x10ec('0x21')],_0x350623[_0x10ec('0x4d')]));queues[_0x350623[_0x10ec('0x4b')]]['transfereduniqueid']=_0x350623[_0x10ec('0x4d')];}}}else if(_0x350623[_0x10ec('0x57')]==_0x350623[_0x10ec('0x4d')]){if(!_[_0x10ec('0x17')](queues[_0x350623['origtransfererlinkedid']])){utils[_0x10ec('0x2')](util[_0x10ec('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x350623[_0x10ec('0x4a')],queues[_0x350623[_0x10ec('0x4b')]][_0x10ec('0x21')],_0x350623[_0x10ec('0x57')],_0x350623[_0x10ec('0x58')]));queues[_0x350623[_0x10ec('0x4b')]][_0x10ec('0x3e')]=!![];queues[_0x350623[_0x10ec('0x4b')]][_0x10ec('0x43')]=_0x10ec('0x4f');queues[_0x350623[_0x10ec('0x4b')]][_0x10ec('0x45')]=_0x350623[_0x10ec('0x58')];queues[_0x350623[_0x10ec('0x4b')]][_0x10ec('0x50')]=_0x350623[_0x10ec('0x57')];queues[_0x350623['origtransfererlinkedid']]['queuecallerexitreason']=_0x10ec('0x51');}if(!_[_0x10ec('0x17')](queues[_0x350623[_0x10ec('0x4d')]])){if(_0x350623['transfertargetlinkedid']&&queues[_0x350623[_0x10ec('0x59')]]){queues[_0x350623[_0x10ec('0x59')]][_0x10ec('0x53')]=0x1;queues[_0x350623[_0x10ec('0x54')]]=_[_0x10ec('0x5a')](queues[_0x350623['transfertargetlinkedid']]);queues[_0x350623[_0x10ec('0x54')]][_0x10ec('0xd')]=_0x350623[_0x10ec('0x54')];queues[_0x350623['transfertargetuniqueid']][_0x10ec('0x53')]=0x2;queues[_0x350623[_0x10ec('0x54')]]['calleridnum']=queues[_0x350623[_0x10ec('0x4b')]][_0x10ec('0x8')];queues[_0x350623[_0x10ec('0x54')]][_0x10ec('0x55')]=queues[_0x350623[_0x10ec('0x4b')]][_0x10ec('0x55')];queues[_0x350623[_0x10ec('0x54')]][_0x10ec('0x36')]=utils['now']();queues[_0x350623['transfertargetuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x350623['transfertargetuniqueid']][_0x10ec('0x34')]=0x0;queues[_0x350623[_0x10ec('0x54')]]['mohtime']=0x0;utils[_0x10ec('0x2')](util[_0x10ec('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x350623[_0x10ec('0x4a')],queues[_0x350623[_0x10ec('0x54')]]['name'],queues[_0x350623['transfertargetuniqueid']][_0x10ec('0xd')],queues[_0x350623[_0x10ec('0x54')]][_0x10ec('0x8')],queues[_0x350623[_0x10ec('0x54')]][_0x10ec('0x55')]));}else{utils['info'](util[_0x10ec('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x350623[_0x10ec('0x4a')],queues[_0x350623[_0x10ec('0x4d')]]['name'],_0x350623[_0x10ec('0x4b')]));queues[_0x350623[_0x10ec('0x4d')]][_0x10ec('0xd')]=_0x350623[_0x10ec('0x4b')];}}}}catch(_0x2a9070){utils[_0x10ec('0x15')](util[_0x10ec('0x3')]('[%s][queues][attendedtransfer]',_0x350623['origtransfereruniqueid']),_0x2a9070);}};exports[_0x10ec('0x5b')]=function(_0x2f76a9){try{if(!_['isNil'](queues[_0x2f76a9[_0x10ec('0x4')]])){utils[_0x10ec('0xf')](util[_0x10ec('0x3')]('[%s][queues][musiconholdstart]',_0x2f76a9[_0x10ec('0x4')]),_0x2f76a9);queues[_0x2f76a9[_0x10ec('0x4')]][_0x10ec('0x5c')]=utils['now']();utils['info'](util[_0x10ec('0x3')](_0x10ec('0x5d'),_0x2f76a9[_0x10ec('0x4')],queues[_0x2f76a9[_0x10ec('0x4')]][_0x10ec('0x21')],queues[_0x2f76a9[_0x10ec('0x4')]][_0x10ec('0x5c')]));}}catch(_0x4c30b8){utils['error'](util[_0x10ec('0x3')](_0x10ec('0x5e'),_0x2f76a9[_0x10ec('0x4')]),_0x4c30b8);}};exports['musiconholdstop']=function(_0x45cc30){try{if(!_[_0x10ec('0x17')](queues[_0x45cc30['uniqueid']])){if(!_[_0x10ec('0x17')](queues[_0x45cc30['uniqueid']][_0x10ec('0x5c')])){utils[_0x10ec('0xf')](util[_0x10ec('0x3')](_0x10ec('0x5f'),_0x45cc30[_0x10ec('0x4')]),_0x45cc30);queues[_0x45cc30[_0x10ec('0x4')]][_0x10ec('0x60')]+=utils[_0x10ec('0x35')](utils['now'](),queues[_0x45cc30['uniqueid']][_0x10ec('0x5c')]);utils['info'](util[_0x10ec('0x3')](_0x10ec('0x61'),_0x45cc30[_0x10ec('0x4')],queues[_0x45cc30[_0x10ec('0x4')]][_0x10ec('0x21')],queues[_0x45cc30[_0x10ec('0x4')]]['mohtime']));delete queues[_0x45cc30[_0x10ec('0x4')]][_0x10ec('0x5c')];}}}catch(_0x529d85){utils['error'](util[_0x10ec('0x3')](_0x10ec('0x5f'),_0x45cc30['uniqueid']),_0x529d85);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4be6c55..e2b6c03 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 _0xa852=['type','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newchannel]','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x24d7c5,_0x42ca2f){var _0x2e46d4=function(_0x4f2f0f){while(--_0x4f2f0f){_0x24d7c5['push'](_0x24d7c5['shift']());}};_0x2e46d4(++_0x42ca2f);}(_0xa852,0x1bc));var _0x2a85=function(_0x31255c,_0x48d645){_0x31255c=_0x31255c-0x0;var _0x43c192=_0xa852[_0x31255c];return _0x43c192;};'use strict';var _=require(_0x2a85('0x0'));var util=require(_0x2a85('0x1'));var utils=require(_0x2a85('0x2'));var recordings={};function writeDB(_0x1b7414){utils[_0x2a85('0x3')](util['format'](_0x2a85('0x4'),_0x1b7414[_0x2a85('0x5')]));if(_0x1b7414[_0x2a85('0x6')]){utils[_0x2a85('0x7')](_0x1b7414[_0x2a85('0x6')])[_0x2a85('0x8')](function(_0xca3655){if(_0xca3655){_0x1b7414['membername']=_0xca3655['name'];_0x1b7414[_0x2a85('0x9')]=_0xca3655['id'];}utils[_0x2a85('0xa')](_0x2a85('0xb'),_0x1b7414);});}else{utils['request'](_0x2a85('0xb'),_0x1b7414);}}exports[_0x2a85('0xc')]=function(_0x36cec0){try{utils[_0x2a85('0xd')](util['format']('[%s][recordings][newchannel]',_0x36cec0[_0x2a85('0x5')]),_0x36cec0);if(_0x36cec0[_0x2a85('0x5')]==_0x36cec0['linkedid']){utils['info'](util[_0x2a85('0xe')](_0x2a85('0xf'),_0x36cec0[_0x2a85('0x5')],_0x36cec0['context'],_0x36cec0[_0x2a85('0x10')]));recordings[_0x36cec0[_0x2a85('0x5')]]={'uniqueid':_0x36cec0[_0x2a85('0x5')],'accountcode':_0x36cec0[_0x2a85('0x6')],'exten':_0x36cec0[_0x2a85('0x10')],'context':_0x36cec0[_0x2a85('0x11')],'channel':_0x36cec0[_0x2a85('0x12')],'monitors':[]};}}catch(_0xfa6fb4){utils[_0x2a85('0x13')](util[_0x2a85('0xe')](_0x2a85('0x14'),_0x36cec0[_0x2a85('0x5')]),_0xfa6fb4);}};exports[_0x2a85('0x15')]=function(_0x45b57d){try{utils[_0x2a85('0xd')](util['format']('[%s][recordings][newstate]',_0x45b57d[_0x2a85('0x5')]),_0x45b57d);if(!_[_0x2a85('0x16')](recordings[_0x45b57d[_0x2a85('0x5')]])&&_0x45b57d[_0x2a85('0x17')]==0x6){utils['info'](util['format'](_0x2a85('0x18'),_0x45b57d['uniqueid'],_0x45b57d[_0x2a85('0x11')],_0x45b57d[_0x2a85('0x12')]));}else if(!_['isNil'](recordings[_0x45b57d[_0x2a85('0x19')]])&&_0x45b57d[_0x2a85('0x17')]==0x6&&_0x45b57d[_0x2a85('0x11')]!=_0x2a85('0x1a')){utils[_0x2a85('0x3')](util[_0x2a85('0xe')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x45b57d[_0x2a85('0x5')],_0x45b57d[_0x2a85('0x19')],_0x45b57d[_0x2a85('0x11')],_0x45b57d[_0x2a85('0x12')]));recordings[_0x45b57d[_0x2a85('0x19')]][_0x2a85('0x6')]=_0x45b57d[_0x2a85('0x6')];}}catch(_0x340d97){utils['error'](util['format'](_0x2a85('0x1b'),_0x45b57d[_0x2a85('0x5')]),_0x340d97);}};exports[_0x2a85('0x1c')]=function(_0x148a28){try{if(!_['isNil'](_0x148a28[_0x2a85('0x1d')])&&!_[_0x2a85('0x16')](_0x148a28['variable'][_0x2a85('0x1e')])){utils[_0x2a85('0xd')](util[_0x2a85('0xe')](_0x2a85('0x1f'),_0x148a28[_0x2a85('0x5')]),_0x148a28);utils[_0x2a85('0x3')](util[_0x2a85('0xe')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x148a28[_0x2a85('0x5')],_0x148a28[_0x2a85('0x1d')],_0x148a28[_0x2a85('0x20')]));if(_[_0x2a85('0x21')](_0x148a28[_0x2a85('0x20')],_0x2a85('0x22'))){_0x148a28[_0x2a85('0x20')]=_0x148a28[_0x2a85('0x20')]['replace'](_0x2a85('0x22'),'.WAV');}if(recordings[_0x148a28[_0x2a85('0x19')]]){var _0x21d005=_[_0x2a85('0x23')](recordings[_0x148a28[_0x2a85('0x19')]][_0x2a85('0x24')],{'value':_0x148a28['value']});if(_['isNil'](_0x21d005)){recordings[_0x148a28['linkedid']][_0x2a85('0x24')]['push']({'value':_0x148a28[_0x2a85('0x20')]});}}}}catch(_0x464bd1){utils[_0x2a85('0x13')](util[_0x2a85('0xe')](_0x2a85('0x1f'),_0x148a28[_0x2a85('0x5')]),_0x464bd1);}};exports[_0x2a85('0x25')]=function(_0xb1e599){try{if(!_[_0x2a85('0x16')](recordings[_0xb1e599['uniqueid']])){utils[_0x2a85('0xd')](util[_0x2a85('0xe')](_0x2a85('0x26'),_0xb1e599[_0x2a85('0x5')]),_0xb1e599);utils[_0x2a85('0x3')](util[_0x2a85('0xe')](_0x2a85('0x27'),_0xb1e599[_0x2a85('0x5')],_0xb1e599['calleridnum'],_0xb1e599['calleridname'],_0xb1e599['cause-txt']));recordings[_0xb1e599[_0x2a85('0x5')]][_0x2a85('0x28')]=_0xb1e599[_0x2a85('0x28')];recordings[_0xb1e599[_0x2a85('0x5')]][_0x2a85('0x29')]=_0xb1e599[_0x2a85('0x29')];recordings[_0xb1e599[_0x2a85('0x5')]]['connectedlinenum']=_0xb1e599[_0x2a85('0x2a')];recordings[_0xb1e599[_0x2a85('0x5')]][_0x2a85('0x2b')]=_0xb1e599[_0x2a85('0x2b')];if(recordings[_0xb1e599[_0x2a85('0x5')]][_0x2a85('0x2c')]=='outbound'&&recordings[_0xb1e599['uniqueid']][_0x2a85('0x6')]){recordings[_0xb1e599[_0x2a85('0x5')]]['connectedlinenum']=recordings[_0xb1e599[_0x2a85('0x5')]][_0x2a85('0x6')];recordings[_0xb1e599[_0x2a85('0x5')]][_0x2a85('0x2b')]='';}recordings[_0xb1e599[_0x2a85('0x5')]][_0x2a85('0x24')][_0x2a85('0x2d')](function(_0x5450ce){var _0x1ae1af=_['clone'](recordings[_0xb1e599[_0x2a85('0x5')]]);_0x1ae1af['value']=_0x5450ce['value'];writeDB(_0x1ae1af);});delete recordings[_0xb1e599[_0x2a85('0x5')]];}}catch(_0x3af582){utils['error'](util[_0x2a85('0xe')](_0x2a85('0x26'),_0xb1e599['uniqueid']),_0x3af582);}};exports[_0x2a85('0x2e')]=function(_0x1582bb){try{if(!_[_0x2a85('0x16')](recordings[_0x1582bb[_0x2a85('0x5')]])){utils['debug'](util[_0x2a85('0xe')](_0x2a85('0x2f'),_0x1582bb[_0x2a85('0x5')]),_0x1582bb);utils['info'](util[_0x2a85('0xe')](_0x2a85('0x30'),_0x1582bb[_0x2a85('0x5')],_0x1582bb[_0x2a85('0x31')],_0x1582bb[_0x2a85('0x32')]));if(_0x1582bb['application']['toLowerCase']()=='set'&&_[_0x2a85('0x33')](_0x1582bb[_0x2a85('0x32')][_0x2a85('0x34')](),_0x2a85('0x35'))){var _0x501531=_0x1582bb['appdata'][_0x2a85('0x36')]('=');var _0x9c8c32=_0x501531[0x0][_0x2a85('0x37')](_0x501531[0x0][_0x2a85('0x38')]('(')+0x1,_0x501531[0x0][_0x2a85('0x38')](')'));var _0xdf450=_0x501531[0x1];recordings[_0x1582bb[_0x2a85('0x5')]][_0x9c8c32]=_0xdf450;}}}catch(_0x418e2a){utils[_0x2a85('0x13')](util[_0x2a85('0xe')](_0x2a85('0x2f'),_0x1582bb[_0x2a85('0x5')]),_0x418e2a);}};exports[_0x2a85('0x39')]=function(_0x37c082){try{if(!_[_0x2a85('0x16')](recordings[_0x37c082[_0x2a85('0x5')]])){utils[_0x2a85('0xd')](util[_0x2a85('0xe')](_0x2a85('0x3a'),_0x37c082[_0x2a85('0x5')]),_0x37c082);utils[_0x2a85('0x3')](util[_0x2a85('0xe')](_0x2a85('0x3b'),_0x37c082[_0x2a85('0x5')],_0x37c082[_0x2a85('0x3c')]));recordings[_0x37c082[_0x2a85('0x5')]]['queue']=_0x37c082['queue'];}}catch(_0x21af35){utils[_0x2a85('0x13')](util[_0x2a85('0xe')](_0x2a85('0x3a'),_0x37c082[_0x2a85('0x5')]),_0x21af35);}}; \ No newline at end of file +var _0x9c97=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','set','toLowerCase','cdr','split','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','error','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable'];(function(_0x179f4f,_0x14b780){var _0x102f89=function(_0x181dc2){while(--_0x181dc2){_0x179f4f['push'](_0x179f4f['shift']());}};_0x102f89(++_0x14b780);}(_0x9c97,0x15c));var _0x79c9=function(_0xebad95,_0x620560){_0xebad95=_0xebad95-0x0;var _0x454ec8=_0x9c97[_0xebad95];return _0x454ec8;};'use strict';var _=require('lodash');var util=require(_0x79c9('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x9925a8){utils[_0x79c9('0x1')](util[_0x79c9('0x2')](_0x79c9('0x3'),_0x9925a8[_0x79c9('0x4')]));if(_0x9925a8[_0x79c9('0x5')]){utils[_0x79c9('0x6')](_0x9925a8[_0x79c9('0x5')])[_0x79c9('0x7')](function(_0x469297){if(_0x469297){_0x9925a8[_0x79c9('0x8')]=_0x469297[_0x79c9('0x9')];_0x9925a8[_0x79c9('0xa')]=_0x469297['id'];}utils['request'](_0x79c9('0xb'),_0x9925a8);});}else{utils[_0x79c9('0xc')]('CreateVoiceRecording',_0x9925a8);}}exports[_0x79c9('0xd')]=function(_0x36fdfc){try{utils['debug'](util[_0x79c9('0x2')]('[%s][recordings][newchannel]',_0x36fdfc[_0x79c9('0x4')]),_0x36fdfc);if(_0x36fdfc[_0x79c9('0x4')]==_0x36fdfc[_0x79c9('0xe')]){utils[_0x79c9('0x1')](util['format'](_0x79c9('0xf'),_0x36fdfc[_0x79c9('0x4')],_0x36fdfc[_0x79c9('0x10')],_0x36fdfc['exten']));recordings[_0x36fdfc[_0x79c9('0x4')]]={'uniqueid':_0x36fdfc[_0x79c9('0x4')],'accountcode':_0x36fdfc[_0x79c9('0x5')],'exten':_0x36fdfc['exten'],'context':_0x36fdfc['context'],'channel':_0x36fdfc['channel'],'monitors':[]};}}catch(_0x253400){utils[_0x79c9('0x11')](util[_0x79c9('0x2')](_0x79c9('0x12'),_0x36fdfc['uniqueid']),_0x253400);}};exports[_0x79c9('0x13')]=function(_0x58c259){try{utils[_0x79c9('0x14')](util[_0x79c9('0x2')](_0x79c9('0x15'),_0x58c259[_0x79c9('0x4')]),_0x58c259);if(!_[_0x79c9('0x16')](recordings[_0x58c259[_0x79c9('0x4')]])&&_0x58c259[_0x79c9('0x17')]==0x6){utils[_0x79c9('0x1')](util[_0x79c9('0x2')](_0x79c9('0x18'),_0x58c259[_0x79c9('0x4')],_0x58c259[_0x79c9('0x10')],_0x58c259[_0x79c9('0x19')]));}else if(!_['isNil'](recordings[_0x58c259[_0x79c9('0xe')]])&&_0x58c259[_0x79c9('0x17')]==0x6&&_0x58c259['context']!=_0x79c9('0x1a')){utils['info'](util[_0x79c9('0x2')](_0x79c9('0x1b'),_0x58c259['uniqueid'],_0x58c259[_0x79c9('0xe')],_0x58c259[_0x79c9('0x10')],_0x58c259[_0x79c9('0x19')]));recordings[_0x58c259[_0x79c9('0xe')]][_0x79c9('0x5')]=_0x58c259[_0x79c9('0x5')];}}catch(_0x257083){utils[_0x79c9('0x11')](util[_0x79c9('0x2')](_0x79c9('0x15'),_0x58c259['uniqueid']),_0x257083);}};exports[_0x79c9('0x1c')]=function(_0x30fbee){try{if(!_['isNil'](_0x30fbee[_0x79c9('0x1d')])&&!_[_0x79c9('0x16')](_0x30fbee[_0x79c9('0x1d')]['mixmonitor_filename'])){utils[_0x79c9('0x14')](util[_0x79c9('0x2')](_0x79c9('0x1e'),_0x30fbee['uniqueid']),_0x30fbee);utils[_0x79c9('0x1')](util[_0x79c9('0x2')](_0x79c9('0x1f'),_0x30fbee[_0x79c9('0x4')],_0x30fbee['variable'],_0x30fbee[_0x79c9('0x20')]));if(_[_0x79c9('0x21')](_0x30fbee[_0x79c9('0x20')],'.wav49')){_0x30fbee[_0x79c9('0x20')]=_0x30fbee[_0x79c9('0x20')]['replace'](_0x79c9('0x22'),_0x79c9('0x23'));}if(recordings[_0x30fbee['linkedid']]){var _0x27b6f8=_[_0x79c9('0x24')](recordings[_0x30fbee[_0x79c9('0xe')]][_0x79c9('0x25')],{'value':_0x30fbee[_0x79c9('0x20')]});if(_['isNil'](_0x27b6f8)){recordings[_0x30fbee[_0x79c9('0xe')]][_0x79c9('0x25')][_0x79c9('0x26')]({'value':_0x30fbee['value']});}}}}catch(_0x5fb46b){utils[_0x79c9('0x11')](util[_0x79c9('0x2')](_0x79c9('0x1e'),_0x30fbee[_0x79c9('0x4')]),_0x5fb46b);}};exports[_0x79c9('0x27')]=function(_0x273fd2){try{if(!_[_0x79c9('0x16')](recordings[_0x273fd2[_0x79c9('0x4')]])){utils[_0x79c9('0x14')](util[_0x79c9('0x2')](_0x79c9('0x28'),_0x273fd2[_0x79c9('0x4')]),_0x273fd2);utils['info'](util['format'](_0x79c9('0x29'),_0x273fd2[_0x79c9('0x4')],_0x273fd2[_0x79c9('0x2a')],_0x273fd2['calleridname'],_0x273fd2[_0x79c9('0x2b')]));recordings[_0x273fd2['uniqueid']][_0x79c9('0x2a')]=_0x273fd2['calleridnum'];recordings[_0x273fd2[_0x79c9('0x4')]][_0x79c9('0x2c')]=_0x273fd2[_0x79c9('0x2c')];recordings[_0x273fd2[_0x79c9('0x4')]][_0x79c9('0x2d')]=_0x273fd2[_0x79c9('0x2d')];recordings[_0x273fd2['uniqueid']][_0x79c9('0x2e')]=_0x273fd2['connectedlinename'];if(recordings[_0x273fd2[_0x79c9('0x4')]]['type']==_0x79c9('0x2f')&&recordings[_0x273fd2[_0x79c9('0x4')]][_0x79c9('0x5')]){recordings[_0x273fd2[_0x79c9('0x4')]]['connectedlinenum']=recordings[_0x273fd2[_0x79c9('0x4')]][_0x79c9('0x5')];recordings[_0x273fd2[_0x79c9('0x4')]]['connectedlinename']='';}recordings[_0x273fd2[_0x79c9('0x4')]][_0x79c9('0x25')][_0x79c9('0x30')](function(_0x5dff75){var _0x1c96a8=_[_0x79c9('0x31')](recordings[_0x273fd2[_0x79c9('0x4')]]);_0x1c96a8[_0x79c9('0x20')]=_0x5dff75['value'];writeDB(_0x1c96a8);});delete recordings[_0x273fd2[_0x79c9('0x4')]];}}catch(_0x54e27d){utils['error'](util[_0x79c9('0x2')](_0x79c9('0x28'),_0x273fd2['uniqueid']),_0x54e27d);}};exports[_0x79c9('0x32')]=function(_0x3c331d){try{if(!_[_0x79c9('0x16')](recordings[_0x3c331d[_0x79c9('0x4')]])){utils[_0x79c9('0x14')](util[_0x79c9('0x2')](_0x79c9('0x33'),_0x3c331d['uniqueid']),_0x3c331d);utils[_0x79c9('0x1')](util[_0x79c9('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3c331d[_0x79c9('0x4')],_0x3c331d[_0x79c9('0x34')],_0x3c331d[_0x79c9('0x35')]));if(_0x3c331d[_0x79c9('0x34')]['toLowerCase']()==_0x79c9('0x36')&&_['startsWith'](_0x3c331d[_0x79c9('0x35')][_0x79c9('0x37')](),_0x79c9('0x38'))){var _0x373e67=_0x3c331d[_0x79c9('0x35')][_0x79c9('0x39')]('=');var _0x239184=_0x373e67[0x0][_0x79c9('0x3a')](_0x373e67[0x0]['lastIndexOf']('(')+0x1,_0x373e67[0x0]['lastIndexOf'](')'));var _0xa1b822=_0x373e67[0x1];recordings[_0x3c331d['uniqueid']][_0x239184]=_0xa1b822;}}}catch(_0x4d8c4f){utils[_0x79c9('0x11')](util['format'](_0x79c9('0x33'),_0x3c331d[_0x79c9('0x4')]),_0x4d8c4f);}};exports[_0x79c9('0x3b')]=function(_0x614165){try{if(!_[_0x79c9('0x16')](recordings[_0x614165[_0x79c9('0x4')]])){utils[_0x79c9('0x14')](util[_0x79c9('0x2')](_0x79c9('0x3c'),_0x614165[_0x79c9('0x4')]),_0x614165);utils['info'](util['format'](_0x79c9('0x3d'),_0x614165[_0x79c9('0x4')],_0x614165[_0x79c9('0x3e')]));recordings[_0x614165[_0x79c9('0x4')]][_0x79c9('0x3e')]=_0x614165[_0x79c9('0x3e')];}}catch(_0x50bb8b){utils[_0x79c9('0x11')](util[_0x79c9('0x2')](_0x79c9('0x3c'),_0x614165['uniqueid']),_0x50bb8b);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 018dacb..1f232ec 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 _0xeeef=['transfertargetcontext','transfertargetexten','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','type','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererexten','transfereechannel','transfertargetchannel'];(function(_0xaaa4a,_0x45fc68){var _0x41547f=function(_0x428d97){while(--_0x428d97){_0xaaa4a['push'](_0xaaa4a['shift']());}};_0x41547f(++_0x45fc68);}(_0xeeef,0x132));var _0xfeee=function(_0x1af557,_0x553074){_0x1af557=_0x1af557-0x0;var _0x496304=_0xeeef[_0x1af557];return _0x496304;};'use strict';var _=require('lodash');var util=require(_0xfeee('0x0'));var utils=require(_0xfeee('0x1'));function writeDB(_0x2cf0df){utils[_0xfeee('0x2')](util[_0xfeee('0x3')](_0xfeee('0x4'),_0x2cf0df['type']===_0xfeee('0x5')?_0x2cf0df[_0xfeee('0x6')]:_0x2cf0df['uniqueid'],_0x2cf0df[_0xfeee('0x7')]));utils[_0xfeee('0x8')](_0xfeee('0x9'),_0x2cf0df);}exports[_0xfeee('0xa')]=function(_0xdad5cb){try{utils['debug'](util[_0xfeee('0x3')](_0xfeee('0xb'),_0xdad5cb[_0xfeee('0xc')]),_0xdad5cb);utils[_0xfeee('0x2')](util[_0xfeee('0x3')](_0xfeee('0xd'),_0xdad5cb[_0xfeee('0xc')],_0xdad5cb['transferercalleridnum'],_0xdad5cb[_0xfeee('0xe')],_0xdad5cb[_0xfeee('0xf')],_0xdad5cb[_0xfeee('0x10')]));_0xdad5cb['type']=_0xfeee('0x11');writeDB(_0xdad5cb);}catch(_0x581980){utils[_0xfeee('0x12')](util[_0xfeee('0x3')](_0xfeee('0xb'),_0xdad5cb[_0xfeee('0xc')]),_0x581980);}};exports[_0xfeee('0x13')]=function(_0x42f703){try{utils['debug'](util['format'](_0xfeee('0x14'),_0x42f703[_0xfeee('0x6')]),_0x42f703);utils['info'](util[_0xfeee('0x3')](_0xfeee('0x15'),_0x42f703[_0xfeee('0x6')],_0x42f703[_0xfeee('0x16')],_0x42f703[_0xfeee('0x17')],_0x42f703[_0xfeee('0x18')],_0x42f703[_0xfeee('0x19')]));_0x42f703=_[_0xfeee('0x1a')](_0x42f703,{'transfererchannel':_0x42f703[_0xfeee('0x1b')],'transferercalleridnum':_0x42f703[_0xfeee('0x16')],'transferercalleridname':_0x42f703[_0xfeee('0x17')],'transfererconnectedlinenum':_0x42f703[_0xfeee('0x1c')],'transfererconnectedlinename':_0x42f703[_0xfeee('0x1d')],'transfereraccountcode':_0x42f703[_0xfeee('0x1e')],'transferercontext':_0x42f703[_0xfeee('0x1f')],'transfererexten':_0x42f703[_0xfeee('0x20')],'transfererlinkedid':_0x42f703['origtransfererlinkedid'],'context':_0x42f703['origtransferercontext'],'extension':_0x42f703[_0xfeee('0x21')],'type':_0xfeee('0x5')});if(_['isNil'](_0x42f703[_0xfeee('0x22')])){_0x42f703=_[_0xfeee('0x1a')](_0x42f703,{'transfereechannel':_0x42f703[_0xfeee('0x23')],'transfereecalleridnum':_0x42f703[_0xfeee('0x18')],'transfereecalleridname':_0x42f703[_0xfeee('0x19')],'transfereeconnectedlinenum':_0x42f703['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x42f703['transfertargetconnectedlinename'],'transfereeaccountcode':_0x42f703['transfertargetaccountcode'],'transfereecontext':_0x42f703[_0xfeee('0x24')],'transfereeexten':_0x42f703[_0xfeee('0x25')],'transfereelinkedid':_0x42f703['transfertargetlinkedid']});}writeDB(_0x42f703);}catch(_0x23e1f2){utils[_0xfeee('0x12')](util[_0xfeee('0x3')](_0xfeee('0x14'),_0x42f703['origtransfereruniqueid']),_0x23e1f2);}}; \ No newline at end of file +var _0xc31c=['type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','format','[%s][transfers][writeDB]\x20type:%s'];(function(_0x153e55,_0x2934a9){var _0x247804=function(_0x5daaaa){while(--_0x5daaaa){_0x153e55['push'](_0x153e55['shift']());}};_0x247804(++_0x2934a9);}(_0xc31c,0x144));var _0xcc31=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xc31c[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xcc31('0x0'));var util=require(_0xcc31('0x1'));var utils=require('./utils');function writeDB(_0x364aa9){utils['info'](util[_0xcc31('0x2')](_0xcc31('0x3'),_0x364aa9[_0xcc31('0x4')]==='attended'?_0x364aa9['origtransfereruniqueid']:_0x364aa9['uniqueid'],_0x364aa9[_0xcc31('0x4')]));utils[_0xcc31('0x5')](_0xcc31('0x6'),_0x364aa9);}exports[_0xcc31('0x7')]=function(_0x48ffa9){try{utils[_0xcc31('0x8')](util['format'](_0xcc31('0x9'),_0x48ffa9[_0xcc31('0xa')]),_0x48ffa9);utils[_0xcc31('0xb')](util[_0xcc31('0x2')](_0xcc31('0xc'),_0x48ffa9[_0xcc31('0xa')],_0x48ffa9['transferercalleridnum'],_0x48ffa9[_0xcc31('0xd')],_0x48ffa9[_0xcc31('0xe')],_0x48ffa9[_0xcc31('0xf')]));_0x48ffa9['type']='blind';writeDB(_0x48ffa9);}catch(_0x1e4a53){utils[_0xcc31('0x10')](util[_0xcc31('0x2')]('[%s][transfers][blindtransfer]',_0x48ffa9[_0xcc31('0xa')]),_0x1e4a53);}};exports[_0xcc31('0x11')]=function(_0x27bff5){try{utils['debug'](util[_0xcc31('0x2')](_0xcc31('0x12'),_0x27bff5[_0xcc31('0x13')]),_0x27bff5);utils['info'](util['format'](_0xcc31('0x14'),_0x27bff5['origtransfereruniqueid'],_0x27bff5['origtransferercalleridnum'],_0x27bff5['origtransferercalleridname'],_0x27bff5[_0xcc31('0x15')],_0x27bff5[_0xcc31('0x16')]));_0x27bff5=_[_0xcc31('0x17')](_0x27bff5,{'transfererchannel':_0x27bff5[_0xcc31('0x18')],'transferercalleridnum':_0x27bff5[_0xcc31('0x19')],'transferercalleridname':_0x27bff5[_0xcc31('0x1a')],'transfererconnectedlinenum':_0x27bff5[_0xcc31('0x1b')],'transfererconnectedlinename':_0x27bff5[_0xcc31('0x1c')],'transfereraccountcode':_0x27bff5[_0xcc31('0x1d')],'transferercontext':_0x27bff5[_0xcc31('0x1e')],'transfererexten':_0x27bff5['secondtransfererexten'],'transfererlinkedid':_0x27bff5[_0xcc31('0x1f')],'context':_0x27bff5[_0xcc31('0x20')],'extension':_0x27bff5[_0xcc31('0x21')],'type':'attended'});if(_['isNil'](_0x27bff5[_0xcc31('0x22')])){_0x27bff5=_[_0xcc31('0x17')](_0x27bff5,{'transfereechannel':_0x27bff5[_0xcc31('0x23')],'transfereecalleridnum':_0x27bff5[_0xcc31('0x15')],'transfereecalleridname':_0x27bff5[_0xcc31('0x16')],'transfereeconnectedlinenum':_0x27bff5[_0xcc31('0x24')],'transfereeconnectedlinename':_0x27bff5[_0xcc31('0x25')],'transfereeaccountcode':_0x27bff5[_0xcc31('0x26')],'transfereecontext':_0x27bff5['transfertargetcontext'],'transfereeexten':_0x27bff5[_0xcc31('0x27')],'transfereelinkedid':_0x27bff5[_0xcc31('0x28')]});}writeDB(_0x27bff5);}catch(_0x587d57){utils[_0xcc31('0x10')](util[_0xcc31('0x2')]('[%s][transfers][attendedtransfer]',_0x27bff5[_0xcc31('0x13')]),_0x587d57);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 585a4ba..65b5477 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 _0xd813=['http','../../config/logger','xdr','info','inspect','debug','error','request','GetUser','internal','then','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diffTime','diff','now','isAfter','isBefore','jayson/promise','util','client'];(function(_0x2996e9,_0x29ea7e){var _0x51bd96=function(_0x4e1c78){while(--_0x4e1c78){_0x2996e9['push'](_0x2996e9['shift']());}};_0x51bd96(++_0x29ea7e);}(_0xd813,0x1a4));var _0x3d81=function(_0x29caf3,_0x88a317){_0x29caf3=_0x29caf3-0x0;var _0x3dc931=_0xd813[_0x29caf3];return _0x3dc931;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x3d81('0x0'));var moment=require('moment');var util=require(_0x3d81('0x1'));var client=jayson[_0x3d81('0x2')][_0x3d81('0x3')]({'port':0x2329});var logger=require(_0x3d81('0x4'))(_0x3d81('0x5'));exports[_0x3d81('0x6')]=function(_0x3946ff,_0x4b15bd){logger[_0x3d81('0x6')](_0x3946ff,_0x4b15bd?util[_0x3d81('0x7')](_0x4b15bd,{'showHidden':![],'depth':null}):'');};exports[_0x3d81('0x8')]=function(_0x2818a7,_0x196e6c){logger[_0x3d81('0x8')](_0x2818a7,_0x196e6c?util[_0x3d81('0x7')](_0x196e6c,{'showHidden':![],'depth':null}):'');};exports[_0x3d81('0x9')]=function(_0x44b642,_0xa9cbf7){logger['error'](_0x44b642,_0xa9cbf7?util[_0x3d81('0x7')](_0xa9cbf7,{'showHidden':![],'depth':null}):'');};exports[_0x3d81('0xa')]=function(_0x5f1b1d,_0x55069c){return client[_0x3d81('0xa')](_0x5f1b1d,{'body':_0x55069c})['then'](function(_0x14e9e9){logger[_0x3d81('0x8')]('[utils][request]\x20name:%s',_0x5f1b1d,_0x14e9e9?util[_0x3d81('0x7')](_0x14e9e9,{'showHidden':![],'depth':null}):'');})['catch'](function(_0xacacf0){logger['error']('[utils][request]\x20name:%s',_0x5f1b1d,_0xacacf0?util[_0x3d81('0x7')](_0xacacf0,{'showHidden':![],'depth':null}):'');});};function getUser(_0x68afa){return client['request'](_0x3d81('0xb'),{'options':{'raw':!![],'attributes':['id',_0x3d81('0xc'),'name','interface'],'where':_0x68afa,'limit':0x1}})[_0x3d81('0xd')](function(_0xaf8bfb){logger['debug'](_0x3d81('0xe'),JSON[_0x3d81('0xf')](_0x68afa),_0xaf8bfb?util[_0x3d81('0x7')](_0xaf8bfb,{'showHidden':![],'depth':null}):'');return _0xaf8bfb[_0x3d81('0x10')]['length']?_0xaf8bfb['result'][0x0]:null;});}exports[_0x3d81('0x11')]=function(_0x532f33){return new BPromise(function(_0x164721,_0x5eb4da){if(_0x532f33){return getUser({'internal':_0x532f33})[_0x3d81('0xd')](function(_0x9d5bde){logger[_0x3d81('0x6')](_0x3d81('0x12'),_0x532f33,_0x9d5bde?'found':_0x3d81('0x13'));return _0x164721(_0x9d5bde);})[_0x3d81('0x14')](function(_0x262d07){logger[_0x3d81('0x9')](_0x3d81('0x15'),_0x262d07?util[_0x3d81('0x7')](_0x262d07,{'showHidden':![],'depth':null}):'');return _0x164721(null);});}return _0x164721(null);});};exports['getUserByInterface']=function(_0x34efdd){return new BPromise(function(_0x5a08d4,_0x310931){if(_0x34efdd){return getUser({'interface':_0x34efdd})['then'](function(_0x493bf2){logger[_0x3d81('0x6')](_0x3d81('0x16'),_0x34efdd,_0x493bf2?_0x3d81('0x17'):_0x3d81('0x13'));return _0x5a08d4(_0x493bf2);})[_0x3d81('0x14')](function(_0x14a45f){logger[_0x3d81('0x9')](_0x3d81('0x18'),_0x14a45f?util[_0x3d81('0x7')](_0x14a45f,{'showHidden':![],'depth':null}):'');return _0x5a08d4(null);});}return _0x5a08d4(null);});};exports[_0x3d81('0x19')]=function(_0x272f16){return new BPromise(function(_0x234d33,_0x384340){if(_0x272f16){return getUser({'name':_0x272f16})[_0x3d81('0xd')](function(_0x202d31){logger[_0x3d81('0x6')](_0x3d81('0x1a'),_0x272f16,_0x202d31?_0x3d81('0x17'):_0x3d81('0x13'));return _0x234d33(_0x202d31);})['catch'](function(_0x509561){logger[_0x3d81('0x9')](_0x3d81('0x1b'),_0x509561?util[_0x3d81('0x7')](_0x509561,{'showHidden':![],'depth':null}):'');return _0x234d33(null);});}return _0x234d33(null);});};exports[_0x3d81('0x1c')]=function(_0x408d0f){return new BPromise(function(_0xed1b7c,_0x4b1c00){if(_0x408d0f){return client[_0x3d81('0xa')](_0x3d81('0x1d'),{'options':{'raw':!![],'attributes':['id','name','type',_0x3d81('0x1e'),_0x3d81('0x1f')],'where':{'name':_0x408d0f},'limit':0x1}})[_0x3d81('0xd')](function(_0x1128b6){logger[_0x3d81('0x8')](_0x3d81('0x20'),_0x408d0f,_0x1128b6?util[_0x3d81('0x7')](_0x1128b6,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x408d0f,_0x1128b6?_0x3d81('0x17'):_0x3d81('0x13'));return _0xed1b7c(_0x1128b6[_0x3d81('0x10')][_0x3d81('0x21')]?_0x1128b6[_0x3d81('0x10')][0x0]:null);})[_0x3d81('0x14')](function(_0x179de1){logger[_0x3d81('0x9')](_0x3d81('0x22'),_0x179de1?util[_0x3d81('0x7')](_0x179de1,{'showHidden':![],'depth':null}):'');return _0xed1b7c(null);});}return _0xed1b7c(null);});};exports[_0x3d81('0x23')]=function(_0x5d1830,_0x1628be){return moment(_0x5d1830)[_0x3d81('0x24')](_0x1628be,'seconds')['format'](_0x3d81('0x25'));};exports[_0x3d81('0x26')]=function(_0x1f87e2,_0x313c09){return moment(_0x1f87e2)[_0x3d81('0x27')](_0x313c09,_0x3d81('0x28'))[_0x3d81('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3d81('0x2a')]=function(_0x55bd39,_0x46bcf5){return moment(_0x55bd39)[_0x3d81('0x2b')](moment(_0x46bcf5),'seconds');};exports['sumTime']=function(_0x4c894a,_0x25e47b){return parseInt(_0x4c894a,0xa)+parseInt(_0x25e47b,0xa);};exports[_0x3d81('0x2c')]=function(){return moment()[_0x3d81('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3d81('0x2d')]=function(_0x181087,_0x2bc7f6){if(_0x2bc7f6){return moment(_0x181087)[_0x3d81('0x2d')](_0x2bc7f6);}return!![];};exports['isBefore']=function(_0x6930c4,_0x3326f1){if(_0x3326f1){return moment(_0x6930c4)[_0x3d81('0x2e')](_0x3326f1);}else if(_0x6930c4){return!![];}return![];}; \ No newline at end of file +var _0x9365=['acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','GetUser','internal','name','then','stringify','length','result','getUserByInternal','found','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9365,0x1e5));var _0x5936=function(_0xd4968a,_0x5dc8fa){_0xd4968a=_0xd4968a-0x0;var _0x4afdae=_0x9365[_0xd4968a];return _0x4afdae;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x5936('0x0'));var moment=require(_0x5936('0x1'));var util=require(_0x5936('0x2'));var client=jayson['client'][_0x5936('0x3')]({'port':0x2329});var logger=require(_0x5936('0x4'))(_0x5936('0x5'));exports[_0x5936('0x6')]=function(_0x33809e,_0x1f81d1){logger[_0x5936('0x6')](_0x33809e,_0x1f81d1?util[_0x5936('0x7')](_0x1f81d1,{'showHidden':![],'depth':null}):'');};exports[_0x5936('0x8')]=function(_0x3e329b,_0x50c65e){logger[_0x5936('0x8')](_0x3e329b,_0x50c65e?util['inspect'](_0x50c65e,{'showHidden':![],'depth':null}):'');};exports[_0x5936('0x9')]=function(_0x39c614,_0x20b736){logger['error'](_0x39c614,_0x20b736?util['inspect'](_0x20b736,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x10444e,_0x338c25){return client[_0x5936('0xa')](_0x10444e,{'body':_0x338c25})['then'](function(_0x48827b){logger['debug'](_0x5936('0xb'),_0x10444e,_0x48827b?util[_0x5936('0x7')](_0x48827b,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1cda53){logger['error'](_0x5936('0xb'),_0x10444e,_0x1cda53?util['inspect'](_0x1cda53,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1cacd6){return client[_0x5936('0xa')](_0x5936('0xc'),{'options':{'raw':!![],'attributes':['id',_0x5936('0xd'),_0x5936('0xe'),'interface'],'where':_0x1cacd6,'limit':0x1}})[_0x5936('0xf')](function(_0x1e0859){logger[_0x5936('0x8')]('[utils][getUser]\x20where:%s',JSON[_0x5936('0x10')](_0x1cacd6),_0x1e0859?util[_0x5936('0x7')](_0x1e0859,{'showHidden':![],'depth':null}):'');return _0x1e0859['result'][_0x5936('0x11')]?_0x1e0859[_0x5936('0x12')][0x0]:null;});}exports[_0x5936('0x13')]=function(_0x5e3818){return new BPromise(function(_0x2e6bb1,_0x33061e){if(_0x5e3818){return getUser({'internal':_0x5e3818})[_0x5936('0xf')](function(_0x3211b2){logger[_0x5936('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x5e3818,_0x3211b2?_0x5936('0x14'):_0x5936('0x15'));return _0x2e6bb1(_0x3211b2);})[_0x5936('0x16')](function(_0x39512f){logger[_0x5936('0x9')](_0x5936('0x17'),_0x39512f?util['inspect'](_0x39512f,{'showHidden':![],'depth':null}):'');return _0x2e6bb1(null);});}return _0x2e6bb1(null);});};exports['getUserByInterface']=function(_0x590e87){return new BPromise(function(_0x3bdb1a,_0x9ac44c){if(_0x590e87){return getUser({'interface':_0x590e87})[_0x5936('0xf')](function(_0x293bc8){logger['info'](_0x5936('0x18'),_0x590e87,_0x293bc8?_0x5936('0x14'):_0x5936('0x15'));return _0x3bdb1a(_0x293bc8);})[_0x5936('0x16')](function(_0x103995){logger[_0x5936('0x9')](_0x5936('0x19'),_0x103995?util[_0x5936('0x7')](_0x103995,{'showHidden':![],'depth':null}):'');return _0x3bdb1a(null);});}return _0x3bdb1a(null);});};exports[_0x5936('0x1a')]=function(_0x5dd84e){return new BPromise(function(_0x170a24,_0x29ff3f){if(_0x5dd84e){return getUser({'name':_0x5dd84e})[_0x5936('0xf')](function(_0x1efb0d){logger[_0x5936('0x6')](_0x5936('0x1b'),_0x5dd84e,_0x1efb0d?_0x5936('0x14'):_0x5936('0x15'));return _0x170a24(_0x1efb0d);})[_0x5936('0x16')](function(_0x197adf){logger['error']('[utils][getUserByName]',_0x197adf?util[_0x5936('0x7')](_0x197adf,{'showHidden':![],'depth':null}):'');return _0x170a24(null);});}return _0x170a24(null);});};exports[_0x5936('0x1c')]=function(_0x2973e5){return new BPromise(function(_0x47fe34,_0x4cf453){if(_0x2973e5){return client[_0x5936('0xa')](_0x5936('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x5936('0xe'),_0x5936('0x1e'),_0x5936('0x1f'),_0x5936('0x20')],'where':{'name':_0x2973e5},'limit':0x1}})[_0x5936('0xf')](function(_0x57b6f8){logger[_0x5936('0x8')](_0x5936('0x21'),_0x2973e5,_0x57b6f8?util[_0x5936('0x7')](_0x57b6f8,{'showHidden':![],'depth':null}):'');logger[_0x5936('0x6')](_0x5936('0x22'),_0x2973e5,_0x57b6f8?_0x5936('0x14'):_0x5936('0x15'));return _0x47fe34(_0x57b6f8[_0x5936('0x12')][_0x5936('0x11')]?_0x57b6f8[_0x5936('0x12')][0x0]:null);})[_0x5936('0x16')](function(_0x21a1c2){logger['error']('[utils][getVoiceQueueByName]',_0x21a1c2?util[_0x5936('0x7')](_0x21a1c2,{'showHidden':![],'depth':null}):'');return _0x47fe34(null);});}return _0x47fe34(null);});};exports[_0x5936('0x23')]=function(_0x1f9c76,_0x1783f7){return moment(_0x1f9c76)[_0x5936('0x24')](_0x1783f7,_0x5936('0x25'))[_0x5936('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5936('0x27')]=function(_0x14e7c5,_0x2cf6e4){return moment(_0x14e7c5)[_0x5936('0x28')](_0x2cf6e4,_0x5936('0x25'))[_0x5936('0x26')](_0x5936('0x29'));};exports[_0x5936('0x2a')]=function(_0x767c9b,_0x2a7232){return moment(_0x767c9b)[_0x5936('0x2b')](moment(_0x2a7232),_0x5936('0x25'));};exports[_0x5936('0x2c')]=function(_0x371f75,_0x52b7e7){return parseInt(_0x371f75,0xa)+parseInt(_0x52b7e7,0xa);};exports[_0x5936('0x2d')]=function(){return moment()[_0x5936('0x26')](_0x5936('0x29'));};exports['isAfter']=function(_0x1cb0c4,_0x19fd92){if(_0x19fd92){return moment(_0x1cb0c4)[_0x5936('0x2e')](_0x19fd92);}return!![];};exports['isBefore']=function(_0x1bc526,_0x3de6dd){if(_0x3de6dd){return moment(_0x1bc526)['isBefore'](_0x3de6dd);}else if(_0x1bc526){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 256560e..07d4cf8 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55f9=['path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user','data','error','api','set','client-side-logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','use','logger','%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','setupLoggers','fs-extra','lodash','express-winston'];(function(_0x2c9173,_0x1f738f){var _0x5b6d01=function(_0x54d7a9){while(--_0x54d7a9){_0x2c9173['push'](_0x2c9173['shift']());}};_0x5b6d01(++_0x1f738f);}(_0x55f9,0xbd));var _0x955f=function(_0xf7fe40,_0x33aab4){_0xf7fe40=_0xf7fe40-0x0;var _0x3a38ce=_0x55f9[_0xf7fe40];return _0x3a38ce;};var fs=require(_0x955f('0x0'));var _=require(_0x955f('0x1'));var ewinston=require(_0x955f('0x2'));var path=require(_0x955f('0x3'));var util=require(_0x955f('0x4'));var fileLogger=require(_0x955f('0x5'))[_0x955f('0x6')];var safeTemplate=require(_0x955f('0x7'))[_0x955f('0x8')];var maskSensitiveData=require(_0x955f('0x9'))[_0x955f('0xa')];function ClientSideLogger(){function _0x298373(_0x410a97){var _0x6f9063=path[_0x955f('0xb')](_0x955f('0xc'),_0x955f('0xd'),_0x955f('0xe'));var _0x4b287c=path[_0x955f('0xb')](_0x955f('0xf'),_0x410a97[_0x955f('0x10')]+'-'+_0x410a97[_0x955f('0x11')]);return fs[_0x955f('0x12')](path[_0x955f('0xb')](_0x6f9063,_0x4b287c))[_0x955f('0x13')](function(){var _0x555a38=fileLogger(_0x955f('0xf'),path[_0x955f('0xb')](_0x6f9063,_0x4b287c));return _0x555a38;})[_0x955f('0x14')](function(_0x5ba6c1){throw _0x5ba6c1;});}this[_0x955f('0xd')]=function(_0x1b47ff,_0x480425,_0x36c368,_0x20b7be){return _0x298373(_0x1b47ff[_0x955f('0x15')])[_0x955f('0x13')](function(_0x24e972){var _0x3fcd3e=_0x24e972[_0x480425];return _0x3fcd3e;})[_0x955f('0x13')](function(_0xbc7a7e){var _0x2a7184=_0x1b47ff[_0x955f('0x15')]?_0x1b47ff[_0x955f('0x15')]['id']:_0x955f('0x16');var _0x98c529=_0x20b7be[_0x955f('0x17')];var _0x41b3c3=_0x20b7be['timestamp'];var _0x2aa8d0=new Date(Number(_0x41b3c3));return _0xbc7a7e(_0x2a7184,_0x2aa8d0,_0x36c368,_0x98c529);})[_0x955f('0x14')](function(_0x41d4a9){fileLogger('client')[_0x955f('0x18')](_0x41d4a9);});};}function setupLoggers(_0x546627){return new Promise(function(_0x5d0f67){var _0x583a98=new ClientSideLogger();var _0x1e74cd=fileLogger(_0x955f('0x19'));var _0x448129=fileLogger('auth');_0x546627[_0x955f('0x1a')](_0x955f('0x1b'),_0x583a98);_0x546627['use'](ewinston['logger']({'winstonInstance':_0x1e74cd,'meta':![],'statusLevels':!![],'msg':function(_0x1787f4,_0x2aadbe){var _0x2fb423=_0x955f('0x1c');if(!_[_0x955f('0x1d')](_0x1787f4[_0x955f('0x1e')])){_0x2fb423+='\x20body=%s';var _0x285ae4=_0x1787f4[_0x955f('0x1e')];maskSensitiveData(_0x285ae4);}return safeTemplate(util[_0x955f('0x1f')](_0x2fb423,_0x1787f4[_0x955f('0x20')],_0x1787f4[_0x955f('0x21')][_0x955f('0x22')]?_0x1787f4[_0x955f('0x21')]['x-forwarded-for']:_0x1787f4[_0x955f('0x23')][_0x955f('0x24')]||_0x1787f4['ip'],_0x1787f4[_0x955f('0x25')],_0x2aadbe['statusCode'],_0x2aadbe[_0x955f('0x26')],_0x1787f4[_0x955f('0x15')]?_0x1787f4[_0x955f('0x15')]['id']:null,_0x1787f4[_0x955f('0x15')]?_0x1787f4[_0x955f('0x15')][_0x955f('0x11')]:null,_0x1787f4[_0x955f('0x15')]?_0x1787f4[_0x955f('0x15')][_0x955f('0x10')]:null,_0x285ae4?util['inspect'](_0x285ae4,![],null):''));}}));_0x546627[_0x955f('0x27')](ewinston[_0x955f('0x28')]({'winstonInstance':_0x448129,'meta':![],'statusLevels':!![],'msg':function(_0x19ccc0,_0x247038){var _0x24554a=_0x955f('0x29');if(_0x19ccc0['body']&&_0x19ccc0[_0x955f('0x1e')]['device']&&_0x19ccc0[_0x955f('0x1e')][_0x955f('0x2a')]){_0x24554a=_0x955f('0x2b');}return util[_0x955f('0x1f')](_0x24554a,_0x19ccc0[_0x955f('0x20')],_0x19ccc0['headers'][_0x955f('0x22')]?_0x19ccc0[_0x955f('0x21')][_0x955f('0x22')]:_0x19ccc0['connection'][_0x955f('0x24')]||_0x19ccc0['ip'],_0x19ccc0['url'],_0x247038['statusCode'],_0x247038[_0x955f('0x26')],_0x19ccc0[_0x955f('0x15')]?_0x19ccc0[_0x955f('0x15')]['id']:null,_0x19ccc0[_0x955f('0x15')]?_0x19ccc0[_0x955f('0x15')]['name']:null,_0x19ccc0[_0x955f('0x15')]?_0x19ccc0['user'][_0x955f('0x10')]:null,_0x19ccc0['body']&&_0x19ccc0[_0x955f('0x1e')][_0x955f('0x2c')]?_0x19ccc0[_0x955f('0x1e')][_0x955f('0x2c')]:_0x955f('0x2d'),_0x19ccc0['body']&&_0x19ccc0['body'][_0x955f('0x2a')]?_0x19ccc0['body'][_0x955f('0x2a')]:'',_0x19ccc0[_0x955f('0x1e')]&&_0x19ccc0['body'][_0x955f('0x2e')]?_0x19ccc0[_0x955f('0x1e')][_0x955f('0x2e')]:'');},'ignoreRoute':function(_0x55fd5b){var _0x58f4f3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x58f4f3['test'](_0x55fd5b[_0x955f('0x25')]);}}));return _0x5d0f67();});}exports[_0x955f('0x2f')]=setupLoggers; \ No newline at end of file +var _0xb492=['xcally','client','name','then','catch','user','no-user','timestamp','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','remoteAddress','url','responseTime','role','logger','%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)','format','method','connection','statusCode','agent_name','test','setupLoggers','fs-extra','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log'];(function(_0x5cb5fc,_0x6cdda3){var _0x4b6fab=function(_0x353db1){while(--_0x353db1){_0x5cb5fc['push'](_0x5cb5fc['shift']());}};_0x4b6fab(++_0x6cdda3);}(_0xb492,0x1e4));var _0x2b49=function(_0x1d5d63,_0x40a6d3){_0x1d5d63=_0x1d5d63-0x0;var _0x6fb71c=_0xb492[_0x1d5d63];return _0x6fb71c;};var fs=require(_0x2b49('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require(_0x2b49('0x1'));var util=require(_0x2b49('0x2'));var fileLogger=require(_0x2b49('0x3'))[_0x2b49('0x4')];var safeTemplate=require(_0x2b49('0x5'))[_0x2b49('0x6')];var maskSensitiveData=require(_0x2b49('0x7'))[_0x2b49('0x8')];function ClientSideLogger(){function _0x41babc(_0x4d6518){var _0x45b8c2=path[_0x2b49('0x9')]('/var',_0x2b49('0xa'),_0x2b49('0xb'));var _0x47d370=path[_0x2b49('0x9')](_0x2b49('0xc'),_0x4d6518['role']+'-'+_0x4d6518[_0x2b49('0xd')]);return fs['ensureDir'](path['join'](_0x45b8c2,_0x47d370))[_0x2b49('0xe')](function(){var _0x5542c8=fileLogger(_0x2b49('0xc'),path[_0x2b49('0x9')](_0x45b8c2,_0x47d370));return _0x5542c8;})[_0x2b49('0xf')](function(_0x3c988c){throw _0x3c988c;});}this[_0x2b49('0xa')]=function(_0x6c2db4,_0x5f4784,_0x3f50da,_0x494818){return _0x41babc(_0x6c2db4['user'])[_0x2b49('0xe')](function(_0x3312af){var _0x48f67d=_0x3312af[_0x5f4784];return _0x48f67d;})[_0x2b49('0xe')](function(_0x1f1609){var _0x538529=_0x6c2db4[_0x2b49('0x10')]?_0x6c2db4[_0x2b49('0x10')]['id']:_0x2b49('0x11');var _0x182060=_0x494818['data'];var _0x160a56=_0x494818[_0x2b49('0x12')];var _0x326a01=new Date(Number(_0x160a56));return _0x1f1609(_0x538529,_0x326a01,_0x3f50da,_0x182060);})['catch'](function(_0x30932d){fileLogger(_0x2b49('0xc'))['error'](_0x30932d);});};}function setupLoggers(_0xaa9e61){return new Promise(function(_0x114f3e){var _0x1be6eb=new ClientSideLogger();var _0xfc6c0e=fileLogger(_0x2b49('0x13'));var _0x1fb0b9=fileLogger(_0x2b49('0x14'));_0xaa9e61[_0x2b49('0x15')](_0x2b49('0x16'),_0x1be6eb);_0xaa9e61[_0x2b49('0x17')](ewinston['logger']({'winstonInstance':_0xfc6c0e,'meta':![],'statusLevels':!![],'msg':function(_0x40d15f,_0x4b004c){var _0xcdce8=_0x2b49('0x18');if(!_[_0x2b49('0x19')](_0x40d15f[_0x2b49('0x1a')])){_0xcdce8+=_0x2b49('0x1b');var _0x1e65f2=_0x40d15f[_0x2b49('0x1a')];maskSensitiveData(_0x1e65f2);}return safeTemplate(util['format'](_0xcdce8,_0x40d15f['method'],_0x40d15f[_0x2b49('0x1c')][_0x2b49('0x1d')]?_0x40d15f[_0x2b49('0x1c')][_0x2b49('0x1d')]:_0x40d15f['connection'][_0x2b49('0x1e')]||_0x40d15f['ip'],_0x40d15f[_0x2b49('0x1f')],_0x4b004c['statusCode'],_0x4b004c[_0x2b49('0x20')],_0x40d15f[_0x2b49('0x10')]?_0x40d15f[_0x2b49('0x10')]['id']:null,_0x40d15f['user']?_0x40d15f[_0x2b49('0x10')][_0x2b49('0xd')]:null,_0x40d15f[_0x2b49('0x10')]?_0x40d15f[_0x2b49('0x10')][_0x2b49('0x21')]:null,_0x1e65f2?util['inspect'](_0x1e65f2,![],null):''));}}));_0xaa9e61['use'](ewinston[_0x2b49('0x22')]({'winstonInstance':_0x1fb0b9,'meta':![],'statusLevels':!![],'msg':function(_0x486a5d,_0x3ce264){var _0x26bc44=_0x2b49('0x23');if(_0x486a5d[_0x2b49('0x1a')]&&_0x486a5d[_0x2b49('0x1a')]['device']&&_0x486a5d['body'][_0x2b49('0x24')]){_0x26bc44=_0x2b49('0x25');}return util[_0x2b49('0x26')](_0x26bc44,_0x486a5d[_0x2b49('0x27')],_0x486a5d[_0x2b49('0x1c')][_0x2b49('0x1d')]?_0x486a5d[_0x2b49('0x1c')][_0x2b49('0x1d')]:_0x486a5d[_0x2b49('0x28')][_0x2b49('0x1e')]||_0x486a5d['ip'],_0x486a5d[_0x2b49('0x1f')],_0x3ce264[_0x2b49('0x29')],_0x3ce264['responseTime'],_0x486a5d[_0x2b49('0x10')]?_0x486a5d[_0x2b49('0x10')]['id']:null,_0x486a5d[_0x2b49('0x10')]?_0x486a5d[_0x2b49('0x10')][_0x2b49('0xd')]:null,_0x486a5d[_0x2b49('0x10')]?_0x486a5d[_0x2b49('0x10')][_0x2b49('0x21')]:null,_0x486a5d[_0x2b49('0x1a')]&&_0x486a5d[_0x2b49('0x1a')]['device']?_0x486a5d['body']['device']:'other',_0x486a5d[_0x2b49('0x1a')]&&_0x486a5d[_0x2b49('0x1a')][_0x2b49('0x24')]?_0x486a5d['body'][_0x2b49('0x24')]:'',_0x486a5d[_0x2b49('0x1a')]&&_0x486a5d[_0x2b49('0x1a')][_0x2b49('0x2a')]?_0x486a5d[_0x2b49('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x2b7593){var _0x928d8b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x928d8b[_0x2b49('0x2b')](_0x2b7593['url']);}}));return _0x114f3e();});}exports[_0x2b49('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 7915864..da8f6b6 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06a1=['map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','circularDoWInterval','monthsShort','exports','circularMonthInterval','hours','clone','minutes','isBefore','startOf','day','isBetween','format','ddd','includes','dowCompare','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','length','padStart','iftime','lodash'];(function(_0xac2a26,_0x387edd){var _0x44a39c=function(_0x13ebcb){while(--_0x13ebcb){_0xac2a26['push'](_0xac2a26['shift']());}};_0x44a39c(++_0x387edd);}(_0x06a1,0x1ac));var _0x106a=function(_0x1614ea,_0x5bf447){_0x1614ea=_0x1614ea-0x0;var _0x43bc7=_0x06a1[_0x1614ea];return _0x43bc7;};var _=require(_0x106a('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x106a('0x1')](function(_0x1209f3){return _0x1209f3[_0x106a('0x2')];})[_0x106a('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x106a('0x4');var EINVALID_DATE=_0x106a('0x5');function throwIfDateNotValid(_0x3db5a4){if(!_0x3db5a4[_0x106a('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4d2123){var _0x47dc25=_0x4d2123[_0x106a('0x7')](':')['map'](function(_0x48eb13){return parseInt(_0x48eb13,0xa);});var _0x58c611=_0x47dc25[0x0];var _0x1508a3=_0x47dc25[0x1];if(_0x58c611<0x0||_0x58c611>0x17||_0x1508a3<0x0||_0x1508a3>0x3b){throw new Error(EINVALID_DATE);}return[_0x58c611,_0x1508a3];}function circularDoWInterval(_0x12b198,_0x46dbe7){if(_0x12b198===_0x46dbe7){return[_0x12b198];}else{var _0x5000fc=moment[_0x106a('0x8')]();moment[_0x106a('0x8')]('en');var _0x9f75a=moment[_0x106a('0x9')]()[_0x106a('0x1')](function(_0x398a1e){return _0x398a1e[_0x106a('0xa')]();});moment['locale'](_0x5000fc);var _0x23b6dc=_0x9f75a['indexOf'](_0x12b198);var _0x5dce38=_0x9f75a[_0x106a('0xb')](_0x46dbe7);if(_0x5dce38>_0x23b6dc){return _0x9f75a[_0x106a('0xc')](_0x23b6dc,_0x5dce38+0x1);}else{var _0x3ec893=_0x9f75a[_0x106a('0xc')](0x0,_0x5dce38+0x1);var _0x21c60b=_0x9f75a[_0x106a('0xc')](_0x23b6dc);return _0x21c60b['concat'](_0x3ec893);}}}module['exports'][_0x106a('0xd')]=circularDoWInterval;function circularMonthInterval(_0x607c4,_0x50e387){if(_0x607c4===_0x50e387){return[_0x607c4];}else{var _0x1c56a5=moment[_0x106a('0x8')]();moment['locale']('en');var _0x4fe646=moment[_0x106a('0xe')]()['map'](function(_0x5edc48){return _0x5edc48[_0x106a('0xa')]();});moment[_0x106a('0x8')](_0x1c56a5);var _0x324262=_0x4fe646[_0x106a('0xb')](_0x607c4);var _0x208621=_0x4fe646[_0x106a('0xb')](_0x50e387);if(_0x208621>_0x324262){return _0x4fe646[_0x106a('0xc')](_0x324262,_0x208621+0x1);}else{var _0x1f2cdf=_0x4fe646[_0x106a('0xc')](0x0,_0x208621+0x1);var _0x826783=_0x4fe646['slice'](_0x324262);return _0x826783['concat'](_0x1f2cdf);}}}module[_0x106a('0xf')][_0x106a('0x10')]=circularMonthInterval;function parseDom(_0x51cc34){var _0x39a61f=parseInt(_0x51cc34,0xa);if(_0x39a61f<0x1||_0x39a61f>0x1f){throw new Error(EINVALID_DATE);}return _0x39a61f;}function timeCompare(_0x3e9873,_0x266d77,_0x5aa2dc){var _0x51b148=_0x3e9873['clone']();var _0x997bd=extractTime(_0x266d77);var _0x16ad81=_0x997bd[0x0];var _0x199288=_0x997bd[0x1];var _0x5577ee=_0x3e9873['clone']()[_0x106a('0x11')](_0x16ad81)['minutes'](_0x199288);throwIfDateNotValid(_0x5577ee);var _0x229e23=extractTime(_0x5aa2dc);var _0x2d005c=_0x229e23[0x0];var _0x359909=_0x229e23[0x1];var _0x28621b=_0x3e9873[_0x106a('0x12')]()['hours'](_0x2d005c)[_0x106a('0x13')](_0x359909);throwIfDateNotValid(_0x28621b);if(_0x28621b[_0x106a('0x14')](_0x5577ee)){var _0x4eeee8=_0x51b148['clone']()[_0x106a('0x15')](_0x106a('0x16'));var _0x278cdc=_0x51b148[_0x106a('0x12')]()['endOf'](_0x106a('0x16'));return _0x51b148['isBetween'](_0x5577ee,_0x278cdc,undefined,'[]')||_0x51b148['isBetween'](_0x4eeee8,_0x28621b,undefined,'[]');}else{return _0x51b148[_0x106a('0x17')](_0x5577ee,_0x28621b,undefined,'[]');}}module[_0x106a('0xf')]['timeCompare']=timeCompare;function dowCompare(_0x113fe6,_0x669f8c,_0x48508e){var _0x12919b=_0x113fe6[_0x106a('0x8')]('en')[_0x106a('0x18')](_0x106a('0x19'))[_0x106a('0xa')]();return circularDoWInterval(_0x669f8c,_0x48508e)[_0x106a('0x1a')](_0x12919b);}module['exports'][_0x106a('0x1b')]=dowCompare;function domCompare(_0x2ee6c9,_0x6d91cb,_0x3c57d8){var _0x5a7742=_0x2ee6c9['date']();if(_0x6d91cb===_0x3c57d8){return _0x5a7742===_0x6d91cb;}else{var _0x354aa0=_0x2ee6c9[_0x106a('0x1c')]();var _0x2c237e=_0x6d91cb<_0x3c57d8;let _0x13ebbc=![];var _0x472017=0x0;var _0x26a063=0x0;if(_0x2c237e){_0x472017=Math[_0x106a('0x1d')](0x1,_0x6d91cb);_0x26a063=Math[_0x106a('0x1e')](_0x3c57d8,_0x354aa0);_0x13ebbc=_0x5a7742>=_0x472017&&_0x5a7742<=_0x26a063;}else{_0x472017=Math[_0x106a('0x1e')](_0x6d91cb,_0x354aa0);_0x26a063=Math['max'](0x1,_0x3c57d8);_0x13ebbc=_0x5a7742>=_0x472017||_0x5a7742<=_0x26a063;}return _0x13ebbc;}}module[_0x106a('0xf')][_0x106a('0x1f')]=domCompare;function monthCompare(_0x36706a,_0x190d05,_0x510c32){var _0x170dd1=_0x36706a[_0x106a('0x8')]('en')[_0x106a('0x18')](_0x106a('0x20'))[_0x106a('0xa')]();return circularMonthInterval(_0x190d05,_0x510c32)['includes'](_0x170dd1);}module[_0x106a('0xf')][_0x106a('0x21')]=monthCompare;function iftime(_0x28e554,_0x5484fa=moment['tz'][_0x106a('0x22')](),_0x9a90a8=moment()){if(!validateRx[_0x106a('0x23')](_0x28e554)){throw new Error(EINVALID_STRING);}else{var _0x6df06d=(moment['isMoment'](_0x9a90a8)?_0x9a90a8[_0x106a('0x12')]():moment(_0x9a90a8))['tz'](_0x5484fa)[_0x106a('0x8')]('en');throwIfDateNotValid(_0x6df06d);var _0x500a88=_0x28e554[_0x106a('0x7')](',');var _0x3b9bba=_0x500a88[0x0];var _0x18fc36=_0x500a88[0x1];var _0x2fe6c7=_0x500a88[0x2];var _0x3da53d=_0x500a88[0x3];let _0x283e2e=!![];if(_0x3b9bba!=='*'){var _0x730ea0=_0x3b9bba['split']('-');var _0x309d2f=_['padStart'](_0x730ea0[0x0],0x5,'0');var _0x17915f=_0x730ea0[_0x106a('0x24')]===0x2?_[_0x106a('0x25')](_0x730ea0[0x1],0x5,'0'):_0x309d2f;_0x283e2e=timeCompare(_0x6df06d,_0x309d2f,_0x17915f);}let _0x243c5c=!![];if(_0x18fc36!=='*'){var _0x52294f=_0x18fc36[_0x106a('0x7')]('-');var _0x2d2b2c=_0x52294f[0x0];var _0x57d268=_0x52294f[_0x106a('0x24')]===0x2?_0x52294f[0x1]:_0x2d2b2c;_0x243c5c=dowCompare(_0x6df06d,_0x2d2b2c,_0x57d268);}let _0x64be29=!![];if(_0x2fe6c7!=='*'){var _0x41962c=_0x2fe6c7['split']('-');var _0x4797e4=parseDom(_0x41962c[0x0]);var _0x13b268=_0x41962c['length']===0x2?parseDom(_0x41962c[0x1]):_0x4797e4;_0x64be29=domCompare(_0x6df06d,_0x4797e4,_0x13b268);}let _0x11733f=!![];if(_0x3da53d!=='*'){var _0x13ea97=_0x3da53d[_0x106a('0x7')]('-');var _0x34bf19=_0x13ea97[0x0];var _0x30cfc8=_0x13ea97[_0x106a('0x24')]===0x2?_0x13ea97[0x1]:_0x13ea97[0x0];_0x11733f=monthCompare(_0x6df06d,_0x34bf19,_0x30cfc8);}return _0x283e2e&&_0x243c5c&&_0x64be29&&_0x11733f;}}module[_0x106a('0xf')][_0x106a('0x26')]=iftime; \ No newline at end of file +var _0x417a=['padStart','length','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','isValid','locale','indexOf','slice','concat','exports','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','includes','dowCompare','date','max','min','domCompare','format','MMM','monthCompare','guess','test','split'];(function(_0x240452,_0x15042b){var _0x54b2f7=function(_0x41d2cb){while(--_0x41d2cb){_0x240452['push'](_0x240452['shift']());}};_0x54b2f7(++_0x15042b);}(_0x417a,0x8e));var _0xa417=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x417a[_0x286726];return _0xcd4fe9;};var _=require(_0xa417('0x0'));var moment=require(_0xa417('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xa417('0x2')](function(_0x2588d6){return _0x2588d6['source'];})[_0xa417('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa417('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x31aed1){if(!_0x31aed1[_0xa417('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5bcb29){var _0xaf2a67=_0x5bcb29['split'](':')[_0xa417('0x2')](function(_0xa36557){return parseInt(_0xa36557,0xa);});var _0x7134fb=_0xaf2a67[0x0];var _0x52394d=_0xaf2a67[0x1];if(_0x7134fb<0x0||_0x7134fb>0x17||_0x52394d<0x0||_0x52394d>0x3b){throw new Error(EINVALID_DATE);}return[_0x7134fb,_0x52394d];}function circularDoWInterval(_0x4c7058,_0x240983){if(_0x4c7058===_0x240983){return[_0x4c7058];}else{var _0x282c9e=moment[_0xa417('0x6')]();moment[_0xa417('0x6')]('en');var _0x49776d=moment['weekdaysShort']()[_0xa417('0x2')](function(_0x589af7){return _0x589af7['toLowerCase']();});moment[_0xa417('0x6')](_0x282c9e);var _0x26ebb3=_0x49776d['indexOf'](_0x4c7058);var _0x5f8865=_0x49776d[_0xa417('0x7')](_0x240983);if(_0x5f8865>_0x26ebb3){return _0x49776d['slice'](_0x26ebb3,_0x5f8865+0x1);}else{var _0x3cf520=_0x49776d[_0xa417('0x8')](0x0,_0x5f8865+0x1);var _0x95e381=_0x49776d['slice'](_0x26ebb3);return _0x95e381[_0xa417('0x9')](_0x3cf520);}}}module[_0xa417('0xa')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x113437,_0x5c7465){if(_0x113437===_0x5c7465){return[_0x113437];}else{var _0x3c2d8c=moment[_0xa417('0x6')]();moment[_0xa417('0x6')]('en');var _0x2154a7=moment['monthsShort']()[_0xa417('0x2')](function(_0x5f5383){return _0x5f5383[_0xa417('0xb')]();});moment['locale'](_0x3c2d8c);var _0xa11021=_0x2154a7['indexOf'](_0x113437);var _0x4a0277=_0x2154a7[_0xa417('0x7')](_0x5c7465);if(_0x4a0277>_0xa11021){return _0x2154a7['slice'](_0xa11021,_0x4a0277+0x1);}else{var _0x5e00a0=_0x2154a7[_0xa417('0x8')](0x0,_0x4a0277+0x1);var _0x5bd611=_0x2154a7[_0xa417('0x8')](_0xa11021);return _0x5bd611[_0xa417('0x9')](_0x5e00a0);}}}module['exports'][_0xa417('0xc')]=circularMonthInterval;function parseDom(_0x466e4f){var _0x136518=parseInt(_0x466e4f,0xa);if(_0x136518<0x1||_0x136518>0x1f){throw new Error(EINVALID_DATE);}return _0x136518;}function timeCompare(_0x31c598,_0x19503f,_0x4157fa){var _0x5e4d1f=_0x31c598[_0xa417('0xd')]();var _0x2861f0=extractTime(_0x19503f);var _0x352164=_0x2861f0[0x0];var _0x5016fa=_0x2861f0[0x1];var _0x1f8477=_0x31c598['clone']()[_0xa417('0xe')](_0x352164)[_0xa417('0xf')](_0x5016fa);throwIfDateNotValid(_0x1f8477);var _0x208589=extractTime(_0x4157fa);var _0x21f913=_0x208589[0x0];var _0x5f5d72=_0x208589[0x1];var _0x3bea5c=_0x31c598[_0xa417('0xd')]()[_0xa417('0xe')](_0x21f913)[_0xa417('0xf')](_0x5f5d72);throwIfDateNotValid(_0x3bea5c);if(_0x3bea5c[_0xa417('0x10')](_0x1f8477)){var _0x269370=_0x5e4d1f[_0xa417('0xd')]()[_0xa417('0x11')]('day');var _0x529139=_0x5e4d1f['clone']()[_0xa417('0x12')](_0xa417('0x13'));return _0x5e4d1f[_0xa417('0x14')](_0x1f8477,_0x529139,undefined,'[]')||_0x5e4d1f[_0xa417('0x14')](_0x269370,_0x3bea5c,undefined,'[]');}else{return _0x5e4d1f[_0xa417('0x14')](_0x1f8477,_0x3bea5c,undefined,'[]');}}module[_0xa417('0xa')]['timeCompare']=timeCompare;function dowCompare(_0x23baa0,_0x356c40,_0x335a26){var _0x35f241=_0x23baa0[_0xa417('0x6')]('en')['format']('ddd')[_0xa417('0xb')]();return circularDoWInterval(_0x356c40,_0x335a26)[_0xa417('0x15')](_0x35f241);}module['exports'][_0xa417('0x16')]=dowCompare;function domCompare(_0x305f15,_0x4744d1,_0x12e585){var _0x238006=_0x305f15[_0xa417('0x17')]();if(_0x4744d1===_0x12e585){return _0x238006===_0x4744d1;}else{var _0x3f6b0d=_0x305f15['daysInMonth']();var _0x8fafdf=_0x4744d1<_0x12e585;let _0x599c7b=![];var _0x4a2738=0x0;var _0xda1e1=0x0;if(_0x8fafdf){_0x4a2738=Math[_0xa417('0x18')](0x1,_0x4744d1);_0xda1e1=Math[_0xa417('0x19')](_0x12e585,_0x3f6b0d);_0x599c7b=_0x238006>=_0x4a2738&&_0x238006<=_0xda1e1;}else{_0x4a2738=Math['min'](_0x4744d1,_0x3f6b0d);_0xda1e1=Math['max'](0x1,_0x12e585);_0x599c7b=_0x238006>=_0x4a2738||_0x238006<=_0xda1e1;}return _0x599c7b;}}module[_0xa417('0xa')][_0xa417('0x1a')]=domCompare;function monthCompare(_0x28247d,_0x5113e3,_0x1b3ad5){var _0x291852=_0x28247d[_0xa417('0x6')]('en')[_0xa417('0x1b')](_0xa417('0x1c'))[_0xa417('0xb')]();return circularMonthInterval(_0x5113e3,_0x1b3ad5)['includes'](_0x291852);}module[_0xa417('0xa')][_0xa417('0x1d')]=monthCompare;function iftime(_0x55ac73,_0x4340c9=moment['tz'][_0xa417('0x1e')](),_0x27061f=moment()){if(!validateRx[_0xa417('0x1f')](_0x55ac73)){throw new Error(EINVALID_STRING);}else{var _0x1895ec=(moment['isMoment'](_0x27061f)?_0x27061f[_0xa417('0xd')]():moment(_0x27061f))['tz'](_0x4340c9)[_0xa417('0x6')]('en');throwIfDateNotValid(_0x1895ec);var _0x30ae10=_0x55ac73[_0xa417('0x20')](',');var _0x286c35=_0x30ae10[0x0];var _0x40566b=_0x30ae10[0x1];var _0x4b596e=_0x30ae10[0x2];var _0x4efb07=_0x30ae10[0x3];let _0x23b3cc=!![];if(_0x286c35!=='*'){var _0x32a0e6=_0x286c35[_0xa417('0x20')]('-');var _0x4d2396=_[_0xa417('0x21')](_0x32a0e6[0x0],0x5,'0');var _0x44bea2=_0x32a0e6['length']===0x2?_['padStart'](_0x32a0e6[0x1],0x5,'0'):_0x4d2396;_0x23b3cc=timeCompare(_0x1895ec,_0x4d2396,_0x44bea2);}let _0x3016ec=!![];if(_0x40566b!=='*'){var _0x1c7ede=_0x40566b[_0xa417('0x20')]('-');var _0x5e5786=_0x1c7ede[0x0];var _0x1317d9=_0x1c7ede[_0xa417('0x22')]===0x2?_0x1c7ede[0x1]:_0x5e5786;_0x3016ec=dowCompare(_0x1895ec,_0x5e5786,_0x1317d9);}let _0x596e32=!![];if(_0x4b596e!=='*'){var _0x16b04c=_0x4b596e['split']('-');var _0x478c2f=parseDom(_0x16b04c[0x0]);var _0x7a2625=_0x16b04c['length']===0x2?parseDom(_0x16b04c[0x1]):_0x478c2f;_0x596e32=domCompare(_0x1895ec,_0x478c2f,_0x7a2625);}let _0xf86210=!![];if(_0x4efb07!=='*'){var _0x182244=_0x4efb07[_0xa417('0x20')]('-');var _0x3664f1=_0x182244[0x0];var _0x3f16c0=_0x182244[_0xa417('0x22')]===0x2?_0x182244[0x1]:_0x182244[0x0];_0xf86210=monthCompare(_0x1895ec,_0x3664f1,_0x3f16c0);}return _0x23b3cc&&_0x3016ec&&_0x596e32&&_0xf86210;}}module[_0xa417('0xa')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index ce9b7bf..4255af3 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6811=['%s-%s','error','fileLogger','moment','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','warn','transports','File'];(function(_0x565b4f,_0x56eff0){var _0x19f1d=function(_0x287e48){while(--_0x287e48){_0x565b4f['push'](_0x565b4f['shift']());}};_0x19f1d(++_0x56eff0);}(_0x6811,0x19a));var _0x1681=function(_0x4c03c3,_0x1c7bc1){_0x4c03c3=_0x4c03c3-0x0;var _0x5925e1=_0x6811[_0x4c03c3];return _0x5925e1;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x1681('0x0'));var winston=require('winston');var config=require(_0x1681('0x1'));var debugLevel=config[_0x1681('0x2')]?config[_0x1681('0x2')][_0x1681('0x3')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x1681('0x4'),'error':_0x1681('0x5'),'warn':_0x1681('0x6'),'info':'white','print':_0x1681('0x7'),'success':_0x1681('0x8'),'http':_0x1681('0x9'),'verbose':_0x1681('0xa'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0x1681('0xb')](XC_LOG_COLORS);function getLogFileName(_0x56a215,_0x5189b3,_0x56cf88){var _0x533069=_0x56a215||_0x1681('0xc');return path[_0x1681('0xd')](_0x533069,util[_0x1681('0xe')](_0x1681('0xf'),_0x5189b3,_0x56cf88));}function formatter(_0x29c8cd,_0x5d2bc3){_0x5d2bc3[_0x1681('0x10')]=_0x5d2bc3['message'][_0x1681('0x11')](/@@{/g,'{{{')[_0x1681('0x11')](/}@@/g,_0x1681('0x12'))[_0x1681('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x1681('0xe')](_0x1681('0x13'),moment()['format'](_0x1681('0x14')),_0x5d2bc3[_0x1681('0x15')][_0x1681('0x16')](),_0x29c8cd,_0x5d2bc3[_0x1681('0x10')]);}function fileFormat(_0x399021,_0x26658a){_0x26658a[_0x1681('0x10')]=_0x26658a[_0x1681('0x10')][_0x1681('0x11')](/@@{/g,_0x1681('0x17'))[_0x1681('0x11')](/}@@/g,_0x1681('0x12'))[_0x1681('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x180d3f=_0x26658a[_0x1681('0x18')]&&Object[_0x1681('0x19')](_0x26658a[_0x1681('0x18')])[_0x1681('0x1a')]?'\x0a\x09'+JSON[_0x1681('0x1b')](_0x26658a[_0x1681('0x18')]):'';return util['format'](_0x1681('0x1c'),moment()[_0x1681('0xe')](_0x1681('0x14')),_0x26658a['level'][_0x1681('0x16')](),_0x399021,_0x26658a[_0x1681('0x10')],_0x180d3f);}function consoleLogger(){var _0xb1744a=new winston[(_0x1681('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x1681('0x1e'))]({'level':_0x1681('0x1f'),'json':![],'formatter':function(_0x1874cc){return formatter('',_0x1874cc);}})]});return _0xb1744a;}function fileLogger(_0x4087b3,_0x5f501e){var _0x344ceb=new winston[(_0x1681('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1681('0x20'))][(_0x1681('0x21'))]({'name':util[_0x1681('0xe')](_0x1681('0x22'),_0x4087b3,_0x1681('0x23')),'filename':getLogFileName(_0x5f501e,_0x4087b3,'error'),'level':_0x1681('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5376c4){return fileFormat(_0x4087b3,_0x5376c4);}}),new winston[(_0x1681('0x20'))]['File']({'name':util[_0x1681('0xe')](_0x1681('0x22'),_0x4087b3,debugLevel),'filename':getLogFileName(_0x5f501e,_0x4087b3,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xdc1f5a){return fileFormat(_0x4087b3,_0xdc1f5a);}}),new winston['transports'][(_0x1681('0x1e'))]({'level':_0x1681('0x1f'),'json':![],'formatter':function(_0x55a8ed){return fileFormat(_0x4087b3,_0x55a8ed);}})]});return _0x344ceb;}exports['consoleLogger']=consoleLogger;exports[_0x1681('0x24')]=fileLogger; \ No newline at end of file +var _0x8621=['{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','Logger','transports','Console','warn','File','error','consoleLogger','fileLogger','path','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace'];(function(_0x536285,_0x55f546){var _0xd2f227=function(_0x1f153b){while(--_0x1f153b){_0x536285['push'](_0x536285['shift']());}};_0xd2f227(++_0x55f546);}(_0x8621,0xa0));var _0x1862=function(_0x8ac352,_0x355aab){_0x8ac352=_0x8ac352-0x0;var _0x24e47b=_0x8621[_0x8ac352];return _0x24e47b;};'use strict';var path=require(_0x1862('0x0'));var util=require('util');var moment=require('moment');var winston=require(_0x1862('0x1'));var config=require('../config/environment');var debugLevel=config[_0x1862('0x2')]?config[_0x1862('0x2')][_0x1862('0x3')]():_0x1862('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x1862('0x5'),'error':_0x1862('0x6'),'warn':'bold\x20yellow','info':'white','print':_0x1862('0x7'),'success':_0x1862('0x8'),'http':_0x1862('0x9'),'verbose':_0x1862('0xa'),'debug':_0x1862('0xb'),'silly':_0x1862('0xc')};winston[_0x1862('0xd')](XC_LOG_COLORS);function getLogFileName(_0x553da6,_0x375617,_0x4394bf){var _0x564614=_0x553da6||_0x1862('0xe');return path[_0x1862('0xf')](_0x564614,util[_0x1862('0x10')](_0x1862('0x11'),_0x375617,_0x4394bf));}function formatter(_0x44c18e,_0x411623){_0x411623[_0x1862('0x12')]=_0x411623[_0x1862('0x12')][_0x1862('0x13')](/@@{/g,_0x1862('0x14'))['replace'](/}@@/g,_0x1862('0x15'))[_0x1862('0x13')](/@{/g,'{{')[_0x1862('0x13')](/}@/g,'}}');return util[_0x1862('0x10')](_0x1862('0x16'),moment()[_0x1862('0x10')](_0x1862('0x17')),_0x411623[_0x1862('0x18')][_0x1862('0x19')](),_0x44c18e,_0x411623['message']);}function fileFormat(_0x2d00b5,_0x2942a9){_0x2942a9[_0x1862('0x12')]=_0x2942a9[_0x1862('0x12')]['replace'](/@@{/g,_0x1862('0x14'))[_0x1862('0x13')](/}@@/g,_0x1862('0x15'))[_0x1862('0x13')](/@{/g,'{{')[_0x1862('0x13')](/}@/g,'}}');var _0x765224=_0x2942a9['meta']&&Object[_0x1862('0x1a')](_0x2942a9[_0x1862('0x1b')])['length']?'\x0a\x09'+JSON['stringify'](_0x2942a9[_0x1862('0x1b')]):'';return util[_0x1862('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x1862('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2942a9[_0x1862('0x18')][_0x1862('0x19')](),_0x2d00b5,_0x2942a9['message'],_0x765224);}function consoleLogger(){var _0x32de06=new winston[(_0x1862('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1862('0x1d'))][(_0x1862('0x1e'))]({'level':_0x1862('0x1f'),'json':![],'formatter':function(_0x4531c2){return formatter('',_0x4531c2);}})]});return _0x32de06;}function fileLogger(_0x3a29b5,_0x564af5){var _0x4934ff=new winston[(_0x1862('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1862('0x1d'))][(_0x1862('0x20'))]({'name':util[_0x1862('0x10')]('%s-%s',_0x3a29b5,_0x1862('0x21')),'filename':getLogFileName(_0x564af5,_0x3a29b5,_0x1862('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x58a22b){return fileFormat(_0x3a29b5,_0x58a22b);}}),new winston['transports'][(_0x1862('0x20'))]({'name':util['format']('%s-%s',_0x3a29b5,debugLevel),'filename':getLogFileName(_0x564af5,_0x3a29b5,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5bb765){return fileFormat(_0x3a29b5,_0x5bb765);}}),new winston['transports'][(_0x1862('0x1e'))]({'level':_0x1862('0x1f'),'json':![],'formatter':function(_0x1cc46c){return fileFormat(_0x3a29b5,_0x1cc46c);}})]});return _0x4934ff;}exports[_0x1862('0x22')]=consoleLogger;exports[_0x1862('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 9f017cc..7138b41 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0x0295,0x1f0));var _0x5029=function(_0x59659d,_0xb17019){_0x59659d=_0x59659d-0x0;var _0x2adbb5=_0x0295[_0x59659d];return _0x2adbb5;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x3d664b,_0xc32991){_0x3d664b=_0x3d664b-0x0;var _0x232afb=_0x7a54[_0x3d664b];return _0x232afb;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index b665511..215f809 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['\x5c$&'];(function(_0xd4601b,_0xe664e5){var _0x5b149a=function(_0x578e0e){while(--_0x578e0e){_0xd4601b['push'](_0xd4601b['shift']());}};_0x5b149a(++_0xe664e5);}(_0x57ca,0x108));var _0xa57c=function(_0x49d95a,_0x51390a){_0x49d95a=_0x49d95a-0x0;var _0xd4de6c=_0x57ca[_0x49d95a];return _0xd4de6c;};module['exports']={'escapeRegExp'(_0x29cc65,_0x4ad696=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x29cc65['replace'](_0x4ad696,_0xa57c('0x0'));}}; \ No newline at end of file +var _0x326f=['replace','\x5c$&','exports'];(function(_0x149446,_0xed23e6){var _0x8ee097=function(_0xf9cc5d){while(--_0xf9cc5d){_0x149446['push'](_0x149446['shift']());}};_0x8ee097(++_0xed23e6);}(_0x326f,0xd1));var _0xf326=function(_0x280037,_0x3aae13){_0x280037=_0x280037-0x0;var _0x140ce2=_0x326f[_0x280037];return _0x140ce2;};module[_0xf326('0x0')]={'escapeRegExp'(_0x55c50e,_0x5452cc=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x55c50e[_0xf326('0x1')](_0x5452cc,_0xf326('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index a73f5e5..7a6f82d 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','exports'];(function(_0x223e57,_0x3a74a7){var _0x2bc42d=function(_0x1628de){while(--_0x1628de){_0x223e57['push'](_0x223e57['shift']());}};_0x2bc42d(++_0x3a74a7);}(_0x8603,0x190));var _0x3860=function(_0xc3b08e,_0x427235){_0xc3b08e=_0xc3b08e-0x0;var _0x4c5e08=_0x8603[_0xc3b08e];return _0x4c5e08;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2f848f){return _0x2f848f==='{{'?_0x3860('0x0'):_0x3860('0x1');}function safeTemplate(_0x51bfda){var _0x4961d6=_0x51bfda;if(typeof _0x51bfda===_0x3860('0x2')){_0x4961d6=_0x51bfda[_0x3860('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3860('0x4')](_0x51bfda)){_0x4961d6=_0x51bfda['map'](function(_0x2fc97a){return safeTemplate(_0x2fc97a);});}else if(_['isPlainObject'](_0x51bfda)){_0x4961d6=Object[_0x3860('0x5')](_0x51bfda)[_0x3860('0x6')](function(_0x1eca44,_0xd3ce26){_0x1eca44[_0xd3ce26]=safeTemplate(_0x51bfda[_0xd3ce26]);return _0x1eca44;},{});}return _0x4961d6;}module[_0x3860('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x5eb8=['{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate'];(function(_0xec0e75,_0x51c198){var _0x533165=function(_0x1a8359){while(--_0x1a8359){_0xec0e75['push'](_0xec0e75['shift']());}};_0x533165(++_0x51c198);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0x5eb8[_0x2ae8ce];return _0x4bf686;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x57e9bc){return _0x57e9bc==='{{'?_0x85eb('0x0'):_0x85eb('0x1');}function safeTemplate(_0x393a8a){var _0xd2f5dc=_0x393a8a;if(typeof _0x393a8a===_0x85eb('0x2')){_0xd2f5dc=_0x393a8a[_0x85eb('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x85eb('0x4')](_0x393a8a)){_0xd2f5dc=_0x393a8a[_0x85eb('0x5')](function(_0x3c5798){return safeTemplate(_0x3c5798);});}else if(_[_0x85eb('0x6')](_0x393a8a)){_0xd2f5dc=Object[_0x85eb('0x7')](_0x393a8a)[_0x85eb('0x8')](function(_0x4a8814,_0x16d7b9){_0x4a8814[_0x16d7b9]=safeTemplate(_0x393a8a[_0x16d7b9]);return _0x4a8814;},{});}return _0xd2f5dc;}module[_0x85eb('0x9')][_0x85eb('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 077bf80..9ec6f25 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9889=['info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','isArray','apps','findIndex','name','motion2','env','NODE_PATH','pathExists','then','readJSON','updated'];(function(_0x29b49d,_0x58c804){var _0x18ff22=function(_0x2104db){while(--_0x2104db){_0x29b49d['push'](_0x29b49d['shift']());}};_0x18ff22(++_0x58c804);}(_0x9889,0x90));var _0x9988=function(_0x19c930,_0x182ac6){_0x19c930=_0x19c930-0x0;var _0x7a5e05=_0x9889[_0x19c930];return _0x7a5e05;};var fs=require(_0x9988('0x0'));var path=require(_0x9988('0x1'));var config=require(_0x9988('0x2'));var root=config[_0x9988('0x3')];var APP_JSON_PATH=path[_0x9988('0x4')](root,'server/app.json');var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x37d3f3){let _0x5c683d=![];if(Array[_0x9988('0x5')](_0x37d3f3['apps'])){var _0x52a045=_0x37d3f3[_0x9988('0x6')][_0x9988('0x7')](function(_0x79eefb){return _0x79eefb[_0x9988('0x8')]===_0x9988('0x9');});if(_0x52a045>-0x1){var _0x2b8688=_0x37d3f3[_0x9988('0x6')][_0x52a045];if(typeof _0x2b8688[_0x9988('0xa')]['NODE_PATH']!=='string'){_0x2b8688[_0x9988('0xa')][_0x9988('0xb')]=NODEPATH;_0x5c683d=!![];}}return{'appConfig':_0x37d3f3,'updated':_0x5c683d};}}function updateAppConfig(_0x5e65b8){return fs[_0x9988('0xc')](APP_JSON_PATH)[_0x9988('0xd')](function(_0x2a8326){if(_0x2a8326){return fs[_0x9988('0xe')](APP_JSON_PATH)['then'](function(_0x4fd4ed){var _0x37535a=setLegacyLibsNodeEnvPath(_0x4fd4ed);if(_0x37535a[_0x9988('0xf')]){_0x5e65b8[_0x9988('0x10')](_0x9988('0x11'));return fs[_0x9988('0x12')](APP_JSON_PATH,_0x4fd4ed,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x9988('0x4')]();}});}module[_0x9988('0x13')]=updateAppConfig; \ No newline at end of file +var _0x8a0d=['../config/environment','root','resolve','server/app.json','legacy-libs','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','updated','info','writeJSON','fs-extra','path'];(function(_0x426a8b,_0x4a4e4f){var _0x44e17b=function(_0x59e374){while(--_0x59e374){_0x426a8b['push'](_0x426a8b['shift']());}};_0x44e17b(++_0x4a4e4f);}(_0x8a0d,0x7c));var _0xd8a0=function(_0x3b47a8,_0x1c08cb){_0x3b47a8=_0x3b47a8-0x0;var _0x35ff4a=_0x8a0d[_0x3b47a8];return _0x35ff4a;};var fs=require(_0xd8a0('0x0'));var path=require(_0xd8a0('0x1'));var config=require(_0xd8a0('0x2'));var root=config[_0xd8a0('0x3')];var APP_JSON_PATH=path[_0xd8a0('0x4')](root,_0xd8a0('0x5'));var NODEPATH=path[_0xd8a0('0x4')](root,_0xd8a0('0x6'));function setLegacyLibsNodeEnvPath(_0x30a490){let _0x4bd903=![];if(Array['isArray'](_0x30a490['apps'])){var _0x5c9591=_0x30a490['apps'][_0xd8a0('0x7')](function(_0x1023c1){return _0x1023c1[_0xd8a0('0x8')]===_0xd8a0('0x9');});if(_0x5c9591>-0x1){var _0x499a50=_0x30a490['apps'][_0x5c9591];if(typeof _0x499a50[_0xd8a0('0xa')][_0xd8a0('0xb')]!==_0xd8a0('0xc')){_0x499a50[_0xd8a0('0xa')][_0xd8a0('0xb')]=NODEPATH;_0x4bd903=!![];}}return{'appConfig':_0x30a490,'updated':_0x4bd903};}}function updateAppConfig(_0x2361a1){return fs[_0xd8a0('0xd')](APP_JSON_PATH)[_0xd8a0('0xe')](function(_0x464d74){if(_0x464d74){return fs['readJSON'](APP_JSON_PATH)[_0xd8a0('0xe')](function(_0x232996){var _0x17828e=setLegacyLibsNodeEnvPath(_0x232996);if(_0x17828e[_0xd8a0('0xf')]){_0x2361a1[_0xd8a0('0x10')]('Updating\x20app.json');return fs[_0xd8a0('0x11')](APP_JSON_PATH,_0x232996,{'spaces':0x2});}else{return Promise[_0xd8a0('0x4')]();}});}else{return Promise[_0xd8a0('0x4')]();}});}module['exports']=updateAppConfig; \ No newline at end of file